From: Andrea Bianco Date: Sat, 18 Dec 2021 20:01:23 +0000 (+0100) Subject: Built motion from commit 7158bc59.|2.5.42 X-Git-Url: http://repos.xcallymotion.com/?a=commitdiff_plain;h=28fd6f15837e3c94205f30439c544f9756967c42;p=motion2.git Built motion from commit 7158bc59.|2.5.42 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index df8b900..8feaba7 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-12-18T18:00:38.089Z", + "time": "2021-12-18T19:51:49.790Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 55c7a79..23c32a3 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-12-18T18:00:38.089Z", + "time": "2021-12-18T19:51:49.790Z", "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 0de6fb7..c574a59 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 _0x2af6=['bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','VIRTUAL','action','contactManager','integration','motionbar','urlForward','browser'];(function(_0x43d7ee,_0x48528a){var _0x58a668=function(_0x17d73e){while(--_0x17d73e){_0x43d7ee['push'](_0x43d7ee['shift']());}};_0x58a668(++_0x48528a);}(_0x2af6,0x170));var _0x62af=function(_0x13498d,_0x12cb32){_0x13498d=_0x13498d-0x0;var _0x2075ee=_0x2af6[_0x13498d];return _0x2075ee;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x62af('0x0')],'get':function(_0x99c60e){return this['getDataValue'](_0x62af('0x1'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x62af('0x2'),_0x62af('0x3'),_0x62af('0x4'),'jscripty',_0x62af('0x5'),_0x62af('0x6'),_0x62af('0x7'),_0x62af('0x8')]],'msg':_0x62af('0x9')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x62af('0xa')](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[_0x62af('0xa')](0x1000),'comment':_0x62af('0xb')},'data3':{'type':Sequelize[_0x62af('0xa')](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[_0x62af('0xa')](0x1000),'comments':_0x62af('0xc')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0x62af('0xa')],'comments':_0x62af('0xd')},'data7':{'type':Sequelize[_0x62af('0xe')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0x2066=['action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','sequelize','exports','getDataValue'];(function(_0x40707d,_0x2c61a0){var _0xb783f9=function(_0x42b774){while(--_0x42b774){_0x40707d['push'](_0x40707d['shift']());}};_0xb783f9(++_0x2c61a0);}(_0x2066,0x7b));var _0x6206=function(_0x2ff42f,_0x882e81){_0x2ff42f=_0x2ff42f-0x0;var _0x2dd612=_0x2066[_0x2ff42f];return _0x2dd612;};'use strict';var Sequelize=require(_0x6206('0x0'));module[_0x6206('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x550e3c){return this[_0x6206('0x2')](_0x6206('0x3'));}},'action':{'type':Sequelize[_0x6206('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x6206('0x5'),_0x6206('0x6'),_0x6206('0x7'),_0x6206('0x8'),_0x6206('0x9'),_0x6206('0xa'),_0x6206('0xb'),_0x6206('0xc')]],'msg':_0x6206('0xd')}},'comment':_0x6206('0xd')},'data1':{'type':Sequelize[_0x6206('0x4')](0x1000),'comment':_0x6206('0xe')},'data2':{'type':Sequelize[_0x6206('0x4')](0x1000),'comment':_0x6206('0xf')},'data3':{'type':Sequelize[_0x6206('0x4')](0x1000),'comment':_0x6206('0x10')},'data4':{'type':Sequelize[_0x6206('0x4')](0x1000),'comments':_0x6206('0x11')},'data5':{'type':Sequelize[_0x6206('0x4')](0x1000),'comments':_0x6206('0x12')},'data6':{'type':Sequelize[_0x6206('0x4')],'comments':_0x6206('0x13')},'data7':{'type':Sequelize['TEXT'],'comments':_0x6206('0x14')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 3c6ee18..daa4b90 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 _0x8601=['find','params','catch','eml-format','rimraf','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','limit','count','offset','status','Content-Range','json','apply','save','then','destroy','error','stack','name','update','body','Action'];(function(_0x4aa2cc,_0x6c3f5f){var _0x500fe7=function(_0x1dba85){while(--_0x1dba85){_0x4aa2cc['push'](_0x4aa2cc['shift']());}};_0x500fe7(++_0x6c3f5f);}(_0x8601,0x123));var _0x1860=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x8601[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x1860('0x0'));var rimraf=require(_0x1860('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1860('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1860('0x3'));var util=require(_0x1860('0x4'));var path=require(_0x1860('0x5'));var sox=require(_0x1860('0x6'));var csv=require('to-csv');var ejs=require(_0x1860('0x7'));var fs=require('fs');var fs_extra=require(_0x1860('0x8'));var _=require(_0x1860('0x9'));var squel=require(_0x1860('0xa'));var crypto=require(_0x1860('0xb'));var jsforce=require(_0x1860('0xc'));var deskjs=require(_0x1860('0xd'));var toCsv=require(_0x1860('0xe'));var querystring=require(_0x1860('0xf'));var Papa=require(_0x1860('0x10'));var Redis=require(_0x1860('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1860('0x12'));var as=require(_0x1860('0x13'));var hardwareService=require(_0x1860('0x14'));var logger=require(_0x1860('0x15'))(_0x1860('0x16'));var utils=require(_0x1860('0x17'));var config=require(_0x1860('0x18'));var licenseUtil=require(_0x1860('0x19'));var db=require(_0x1860('0x1a'))['db'];function respondWithStatusCode(_0x256959,_0x39f03b){_0x39f03b=_0x39f03b||0xcc;return function(_0x42a7fe){if(_0x42a7fe){return _0x256959[_0x1860('0x1b')](_0x39f03b);}return _0x256959['status'](_0x39f03b)[_0x1860('0x1c')]();};}function respondWithResult(_0x3d3a13,_0x12235a){_0x12235a=_0x12235a||0xc8;return function(_0x245fad){if(_0x245fad){return _0x3d3a13['status'](_0x12235a)['json'](_0x245fad);}};}function respondWithFilteredResult(_0x4dea57,_0x1fba98){return function(_0x39f77e){if(_0x39f77e){var _0x4e5a34=typeof _0x1fba98['offset']==='undefined'&&typeof _0x1fba98[_0x1860('0x1d')]==='undefined';var _0x161cae=_0x39f77e[_0x1860('0x1e')];var _0x190434=_0x4e5a34?0x0:_0x1fba98[_0x1860('0x1f')];var _0x651e18=_0x4e5a34?_0x39f77e['count']:_0x1fba98['offset']+_0x1fba98[_0x1860('0x1d')];var _0xa5fa52;if(_0x651e18>=_0x161cae){_0x651e18=_0x161cae;_0xa5fa52=0xc8;}else{_0xa5fa52=0xce;}_0x4dea57[_0x1860('0x20')](_0xa5fa52);return _0x4dea57['set'](_0x1860('0x21'),_0x190434+'-'+_0x651e18+'/'+_0x161cae)[_0x1860('0x22')](_0x39f77e);}return null;};}function patchUpdates(_0x1e40c3){return function(_0x5f48bd){try{jsonpatch[_0x1860('0x23')](_0x5f48bd,_0x1e40c3,!![]);}catch(_0xbd6f46){return BPromise['reject'](_0xbd6f46);}return _0x5f48bd[_0x1860('0x24')]();};}function saveUpdates(_0x31c3bb,_0x340e7c){return function(_0x500857){if(_0x500857){return _0x500857['update'](_0x31c3bb)[_0x1860('0x25')](function(_0x1b8523){return _0x1b8523;});}return null;};}function removeEntity(_0x4754bf,_0xcfc6b2){return function(_0x7dfa21){if(_0x7dfa21){return _0x7dfa21[_0x1860('0x26')]()[_0x1860('0x25')](function(){_0x4754bf[_0x1860('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b6998,_0x7bb085){return function(_0x22e3b6){if(!_0x22e3b6){_0x3b6998[_0x1860('0x1b')](0x194);}return _0x22e3b6;};}function handleError(_0x2008b4,_0x132807){_0x132807=_0x132807||0x1f4;return function(_0x2bc326){logger[_0x1860('0x27')](_0x2bc326[_0x1860('0x28')]);if(_0x2bc326[_0x1860('0x29')]){delete _0x2bc326[_0x1860('0x29')];}_0x2008b4[_0x1860('0x20')](_0x132807)['send'](_0x2bc326);};}exports[_0x1860('0x2a')]=function(_0x3e55a5,_0x427fc6){if(_0x3e55a5[_0x1860('0x2b')]['id']){delete _0x3e55a5[_0x1860('0x2b')]['id'];}return db[_0x1860('0x2c')][_0x1860('0x2d')]({'where':{'id':_0x3e55a5[_0x1860('0x2e')]['id']}})['then'](handleEntityNotFound(_0x427fc6,null))['then'](saveUpdates(_0x3e55a5[_0x1860('0x2b')],null))[_0x1860('0x25')](respondWithResult(_0x427fc6,null))[_0x1860('0x2f')](handleError(_0x427fc6,null));};exports[_0x1860('0x26')]=function(_0x544164,_0x4eaf57){return db[_0x1860('0x2c')][_0x1860('0x2d')]({'where':{'id':_0x544164[_0x1860('0x2e')]['id']}})[_0x1860('0x25')](handleEntityNotFound(_0x4eaf57,null))[_0x1860('0x25')](removeEntity(_0x4eaf57,null))[_0x1860('0x2f')](handleError(_0x4eaf57,null));}; \ No newline at end of file +var _0x0f01=['offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','body','params','destroy','Action','find','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json'];(function(_0x3fc357,_0x38370d){var _0xd7a9eb=function(_0x56aacd){while(--_0x56aacd){_0x3fc357['push'](_0x3fc357['shift']());}};_0xd7a9eb(++_0x38370d);}(_0x0f01,0xf6));var _0x10f0=function(_0x2f0366,_0x10885f){_0x2f0366=_0x2f0366-0x0;var _0x5e1c27=_0x0f01[_0x2f0366];return _0x5e1c27;};'use strict';var emlformat=require(_0x10f0('0x0'));var rimraf=require(_0x10f0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x10f0('0x2'));var rp=require('request-promise');var moment=require(_0x10f0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x10f0('0x4'));var util=require(_0x10f0('0x5'));var path=require(_0x10f0('0x6'));var sox=require('sox');var csv=require(_0x10f0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x10f0('0x8'));var _=require(_0x10f0('0x9'));var squel=require(_0x10f0('0xa'));var crypto=require(_0x10f0('0xb'));var jsforce=require(_0x10f0('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x10f0('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x10f0('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x10f0('0xf'));var hardwareService=require(_0x10f0('0x10'));var logger=require(_0x10f0('0x11'))(_0x10f0('0x12'));var utils=require(_0x10f0('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x10f0('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24a2a1,_0x1abb74){_0x1abb74=_0x1abb74||0xcc;return function(_0x1fd78a){if(_0x1fd78a){return _0x24a2a1['sendStatus'](_0x1abb74);}return _0x24a2a1[_0x10f0('0x15')](_0x1abb74)[_0x10f0('0x16')]();};}function respondWithResult(_0x189d85,_0x3522e9){_0x3522e9=_0x3522e9||0xc8;return function(_0x19bfe2){if(_0x19bfe2){return _0x189d85[_0x10f0('0x15')](_0x3522e9)[_0x10f0('0x17')](_0x19bfe2);}};}function respondWithFilteredResult(_0x3abd7b,_0x2291d8){return function(_0x285d53){if(_0x285d53){var _0x1b6679=typeof _0x2291d8[_0x10f0('0x18')]==='undefined'&&typeof _0x2291d8[_0x10f0('0x19')]===_0x10f0('0x1a');var _0x54545b=_0x285d53['count'];var _0x4fc36b=_0x1b6679?0x0:_0x2291d8['offset'];var _0x38d73d=_0x1b6679?_0x285d53[_0x10f0('0x1b')]:_0x2291d8['offset']+_0x2291d8['limit'];var _0x106cd3;if(_0x38d73d>=_0x54545b){_0x38d73d=_0x54545b;_0x106cd3=0xc8;}else{_0x106cd3=0xce;}_0x3abd7b['status'](_0x106cd3);return _0x3abd7b[_0x10f0('0x1c')](_0x10f0('0x1d'),_0x4fc36b+'-'+_0x38d73d+'/'+_0x54545b)['json'](_0x285d53);}return null;};}function patchUpdates(_0x12d955){return function(_0x3a845c){try{jsonpatch[_0x10f0('0x1e')](_0x3a845c,_0x12d955,!![]);}catch(_0xa3d9c5){return BPromise[_0x10f0('0x1f')](_0xa3d9c5);}return _0x3a845c[_0x10f0('0x20')]();};}function saveUpdates(_0x212a09,_0x120524){return function(_0x416fe7){if(_0x416fe7){return _0x416fe7[_0x10f0('0x21')](_0x212a09)[_0x10f0('0x22')](function(_0x3512e8){return _0x3512e8;});}return null;};}function removeEntity(_0x9f069,_0x4a30bc){return function(_0x32e451){if(_0x32e451){return _0x32e451['destroy']()['then'](function(){_0x9f069['status'](0xcc)[_0x10f0('0x16')]();});}};}function handleEntityNotFound(_0x9ccf35,_0x3f289e){return function(_0x345cab){if(!_0x345cab){_0x9ccf35[_0x10f0('0x23')](0x194);}return _0x345cab;};}function handleError(_0x2576a0,_0x3ff106){_0x3ff106=_0x3ff106||0x1f4;return function(_0x1954c6){logger[_0x10f0('0x24')](_0x1954c6[_0x10f0('0x25')]);if(_0x1954c6[_0x10f0('0x26')]){delete _0x1954c6['name'];}_0x2576a0[_0x10f0('0x15')](_0x3ff106)[_0x10f0('0x27')](_0x1954c6);};}exports[_0x10f0('0x21')]=function(_0x1d03e8,_0x9d4475){if(_0x1d03e8[_0x10f0('0x28')]['id']){delete _0x1d03e8[_0x10f0('0x28')]['id'];}return db['Action']['find']({'where':{'id':_0x1d03e8[_0x10f0('0x29')]['id']}})[_0x10f0('0x22')](handleEntityNotFound(_0x9d4475,null))[_0x10f0('0x22')](saveUpdates(_0x1d03e8[_0x10f0('0x28')],null))[_0x10f0('0x22')](respondWithResult(_0x9d4475,null))['catch'](handleError(_0x9d4475,null));};exports[_0x10f0('0x2a')]=function(_0x2d5258,_0x278a41){return db[_0x10f0('0x2b')][_0x10f0('0x2c')]({'where':{'id':_0x2d5258['params']['id']}})[_0x10f0('0x22')](handleEntityNotFound(_0x278a41,null))['then'](removeEntity(_0x278a41,null))['catch'](handleError(_0x278a41,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index b6071c0..d689b96 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 _0xa09f=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Action','util','../../config/logger','api','moment'];(function(_0x81dcac,_0x8ff7db){var _0xc7803b=function(_0x499b29){while(--_0x499b29){_0x81dcac['push'](_0x81dcac['shift']());}};_0xc7803b(++_0x8ff7db);}(_0xa09f,0x188));var _0xfa09=function(_0x2974c6,_0x456fe7){_0x2974c6=_0x2974c6-0x0;var _0x4b56c4=_0xa09f[_0x2974c6];return _0x4b56c4;};'use strict';var _=require('lodash');var util=require(_0xfa09('0x0'));var logger=require(_0xfa09('0x1'))(_0xfa09('0x2'));var moment=require(_0xfa09('0x3'));var BPromise=require(_0xfa09('0x4'));var rp=require(_0xfa09('0x5'));var fs=require('fs');var path=require(_0xfa09('0x6'));var rimraf=require(_0xfa09('0x7'));var config=require(_0xfa09('0x8'));var attributes=require('./action.attributes');module[_0xfa09('0x9')]=function(_0x36a9d7,_0x5bdbc7){return _0x36a9d7[_0xfa09('0xa')](_0xfa09('0xb'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0379=['exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./action.attributes'];(function(_0x3983c1,_0x273916){var _0x263f13=function(_0x5c0907){while(--_0x5c0907){_0x3983c1['push'](_0x3983c1['shift']());}};_0x263f13(++_0x273916);}(_0x0379,0xff));var _0x9037=function(_0x1c1b4d,_0x1dc649){_0x1c1b4d=_0x1c1b4d-0x0;var _0x1bbe55=_0x0379[_0x1c1b4d];return _0x1bbe55;};'use strict';var _=require(_0x9037('0x0'));var util=require(_0x9037('0x1'));var logger=require(_0x9037('0x2'))(_0x9037('0x3'));var moment=require(_0x9037('0x4'));var BPromise=require(_0x9037('0x5'));var rp=require(_0x9037('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9037('0x7'));var config=require('../../config/environment');var attributes=require(_0x9037('0x8'));module[_0x9037('0x9')]=function(_0x33f7a0,_0x391ab3){return _0x33f7a0[_0x9037('0xa')]('Action',attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 09dce3e..7adf2f4 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x78bb21,_0x1fda67){var _0x5da5d4=function(_0x5dde29){while(--_0x5dde29){_0x78bb21['push'](_0x78bb21['shift']());}};_0x5da5d4(++_0x1fda67);}(_0x5fc3,0xa8));var _0x35fc=function(_0x31b5b2,_0x5ab927){_0x31b5b2=_0x31b5b2-0x0;var _0x364f13=_0x5fc3[_0x31b5b2];return _0x364f13;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Action,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Action,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});} \ No newline at end of file +var _0x814b=['info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x814b,0x1a2));var _0xb814=function(_0x4557dc,_0x3687b2){_0x4557dc=_0x4557dc-0x0;var _0x1377aa=_0x814b[_0x4557dc];return _0x1377aa;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('Action,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index f978735..e22e9ee 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 _0x734c=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','/:id','isAuthenticated','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x248b7c,_0x1dace9){var _0xbcb223=function(_0x530871){while(--_0x530871){_0x248b7c['push'](_0x248b7c['shift']());}};_0xbcb223(++_0x1dace9);}(_0x734c,0x1cb));var _0xc734=function(_0x42c505,_0x4a8f7f){_0x42c505=_0x42c505-0x0;var _0x4d3df7=_0x734c[_0x42c505];return _0x4d3df7;};'use strict';var multer=require('multer');var util=require(_0xc734('0x0'));var path=require(_0xc734('0x1'));var timeout=require(_0xc734('0x2'));var express=require('express');var router=express[_0xc734('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc734('0x4'));var interaction=require(_0xc734('0x5'));var config=require(_0xc734('0x6'));var controller=require(_0xc734('0x7'));router['put'](_0xc734('0x8'),auth[_0xc734('0x9')](),controller[_0xc734('0xa')]);router[_0xc734('0xb')](_0xc734('0x8'),auth[_0xc734('0x9')](),controller[_0xc734('0xc')]);module[_0xc734('0xd')]=router; \ No newline at end of file +var _0xa733=['../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','delete','exports','multer','path','Router','fs-extra'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa733,0x88));var _0x3a73=function(_0x1b18e9,_0x1e2e19){_0x1b18e9=_0x1b18e9-0x0;var _0x15e8e1=_0xa733[_0x1b18e9];return _0x15e8e1;};'use strict';var multer=require(_0x3a73('0x0'));var util=require('util');var path=require(_0x3a73('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3a73('0x2')]();var fs_extra=require(_0x3a73('0x3'));var auth=require(_0x3a73('0x4'));var interaction=require(_0x3a73('0x5'));var config=require(_0x3a73('0x6'));var controller=require(_0x3a73('0x7'));router[_0x3a73('0x8')](_0x3a73('0x9'),auth[_0x3a73('0xa')](),controller[_0x3a73('0xb')]);router[_0x3a73('0xc')](_0x3a73('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x3a73('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 1b90f07..2d3d951 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 _0x5075=['exports','STRING','TEXT','sequelize'];(function(_0x21c601,_0x26f456){var _0xd423f=function(_0x52bc27){while(--_0x52bc27){_0x21c601['push'](_0x21c601['shift']());}};_0xd423f(++_0x26f456);}(_0x5075,0x73));var _0x5507=function(_0xb08b54,_0x149ec4){_0xb08b54=_0xb08b54-0x0;var _0x353ed9=_0x5075[_0xb08b54];return _0x353ed9;};'use strict';var Sequelize=require(_0x5507('0x0'));module[_0x5507('0x1')]={'name':{'type':Sequelize[_0x5507('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5507('0x2')]},'parent':{'type':Sequelize[_0x5507('0x2')]},'table':{'type':Sequelize[_0x5507('0x2')]},'conditions':{'type':Sequelize[_0x5507('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xb138=['TEXT','sequelize','exports','STRING'];(function(_0x236625,_0x391a8d){var _0xc786a5=function(_0x5a18a2){while(--_0x5a18a2){_0x236625['push'](_0x236625['shift']());}};_0xc786a5(++_0x391a8d);}(_0xb138,0x1dd));var _0x8b13=function(_0x17d581,_0x55ec2a){_0x17d581=_0x17d581-0x0;var _0x137ab8=_0xb138[_0x17d581];return _0x137ab8;};'use strict';var Sequelize=require(_0x8b13('0x0'));module[_0x8b13('0x1')]={'name':{'type':Sequelize[_0x8b13('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8b13('0x2')]},'parent':{'type':Sequelize[_0x8b13('0x2')]},'table':{'type':Sequelize[_0x8b13('0x2')]},'conditions':{'type':Sequelize[_0x8b13('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 2682b8c..989fc25 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 _0x977f=['reject','save','update','then','destroy','CustomReports','sendStatus','error','stack','name','send','index','AnalyticCustomReport','rawAttributes','fieldName','key','model','map','query','filters','fields','attributes','hasOwnProperty','limit','order','sort','where','filter','merge','type','VIRTUAL','options','count','includeAll','rows','catch','params','keys','intersection','length','include','find','create','body','user','get','role','Reports','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','cross_join','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)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','left_join','right_join','SUM(%s)','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','value','orderBy','DESC','parentKey','web','fullPath','%s-%s.%s','randomstring','generate','output','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','savename','select','COUNT(*)','SELECT','run','runReport','findAll','debug','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','dbH','status','offset','undefined','Content-Range','json'];(function(_0x331dfe,_0x13f0fc){var _0x104132=function(_0x41de65){while(--_0x41de65){_0x331dfe['push'](_0x331dfe['shift']());}};_0x104132(++_0x13f0fc);}(_0x977f,0x1d7));var _0xf977=function(_0x13aee3,_0x500a70){_0x13aee3=_0x13aee3-0x0;var _0x3cb89d=_0x977f[_0x13aee3];return _0x3cb89d;};'use strict';var emlformat=require(_0xf977('0x0'));var rimraf=require(_0xf977('0x1'));var zipdir=require(_0xf977('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf977('0x3'));var moment=require(_0xf977('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf977('0x5'));var util=require(_0xf977('0x6'));var path=require('path');var sox=require(_0xf977('0x7'));var csv=require('to-csv');var ejs=require(_0xf977('0x8'));var fs=require('fs');var fs_extra=require(_0xf977('0x9'));var _=require(_0xf977('0xa'));var squel=require(_0xf977('0xb'));var crypto=require(_0xf977('0xc'));var jsforce=require(_0xf977('0xd'));var deskjs=require(_0xf977('0xe'));var toCsv=require(_0xf977('0xf'));var querystring=require(_0xf977('0x10'));var Papa=require(_0xf977('0x11'));var Redis=require('ioredis');var authService=require(_0xf977('0x12'));var qs=require(_0xf977('0x13'));var as=require(_0xf977('0x14'));var hardwareService=require(_0xf977('0x15'));var logger=require(_0xf977('0x16'))(_0xf977('0x17'));var utils=require(_0xf977('0x18'));var config=require(_0xf977('0x19'));var licenseUtil=require(_0xf977('0x1a'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xf977('0x1b')];function respondWithStatusCode(_0x44e8dd,_0x4bdc7c){_0x4bdc7c=_0x4bdc7c||0xcc;return function(_0x1ee804){if(_0x1ee804){return _0x44e8dd['sendStatus'](_0x4bdc7c);}return _0x44e8dd['status'](_0x4bdc7c)['end']();};}function respondWithResult(_0x18510,_0x1be79c){_0x1be79c=_0x1be79c||0xc8;return function(_0x348afb){if(_0x348afb){return _0x18510[_0xf977('0x1c')](_0x1be79c)['json'](_0x348afb);}};}function respondWithFilteredResult(_0x46d27b,_0x3b34f6){return function(_0x3253ce){if(_0x3253ce){var _0x235dd7=typeof _0x3b34f6[_0xf977('0x1d')]===_0xf977('0x1e')&&typeof _0x3b34f6['limit']===_0xf977('0x1e');var _0x37ee57=_0x3253ce['count'];var _0x5b1568=_0x235dd7?0x0:_0x3b34f6[_0xf977('0x1d')];var _0x57be9e=_0x235dd7?_0x3253ce['count']:_0x3b34f6[_0xf977('0x1d')]+_0x3b34f6['limit'];var _0x1e64d0;if(_0x57be9e>=_0x37ee57){_0x57be9e=_0x37ee57;_0x1e64d0=0xc8;}else{_0x1e64d0=0xce;}_0x46d27b['status'](_0x1e64d0);return _0x46d27b['set'](_0xf977('0x1f'),_0x5b1568+'-'+_0x57be9e+'/'+_0x37ee57)[_0xf977('0x20')](_0x3253ce);}return null;};}function patchUpdates(_0x5d9b12){return function(_0x45ac11){try{jsonpatch['apply'](_0x45ac11,_0x5d9b12,!![]);}catch(_0x453aa0){return BPromise[_0xf977('0x21')](_0x453aa0);}return _0x45ac11[_0xf977('0x22')]();};}function saveUpdates(_0x1de7c8,_0x4ba9c8){return function(_0x4363ed){if(_0x4363ed){return _0x4363ed[_0xf977('0x23')](_0x1de7c8)[_0xf977('0x24')](function(_0x3cf169){return _0x3cf169;});}return null;};}function removeEntity(_0x563dd5,_0x397274){return function(_0x56eab7){if(_0x56eab7){return _0x56eab7[_0xf977('0x25')]()[_0xf977('0x24')](function(){var _0x5104d4=_0x56eab7['get']({'plain':!![]});var _0x1fa1ea=_0xf977('0x26');return db['UserProfileResource'][_0xf977('0x25')]({'where':{'type':_0x1fa1ea,'resourceId':_0x5104d4['id']}})[_0xf977('0x24')](function(){return _0x56eab7;});})[_0xf977('0x24')](function(){_0x563dd5[_0xf977('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3faa4c,_0x2f151f){return function(_0x3b7f51){if(!_0x3b7f51){_0x3faa4c[_0xf977('0x27')](0x194);}return _0x3b7f51;};}function handleError(_0x7e06f6,_0x14c492){_0x14c492=_0x14c492||0x1f4;return function(_0x5e74dc){logger[_0xf977('0x28')](_0x5e74dc[_0xf977('0x29')]);if(_0x5e74dc[_0xf977('0x2a')]){delete _0x5e74dc[_0xf977('0x2a')];}_0x7e06f6[_0xf977('0x1c')](_0x14c492)[_0xf977('0x2b')](_0x5e74dc);};}exports[_0xf977('0x2c')]=function(_0x3ab637,_0x4d9ba8){var _0x113e08={},_0x208fa0={},_0x472597={'count':0x0,'rows':[]};var _0xb5eed7=_['map'](db[_0xf977('0x2d')][_0xf977('0x2e')],function(_0x4e472a){return{'name':_0x4e472a[_0xf977('0x2f')],'type':_0x4e472a['type'][_0xf977('0x30')]};});_0x208fa0[_0xf977('0x31')]=_[_0xf977('0x32')](_0xb5eed7,_0xf977('0x2a'));_0x208fa0[_0xf977('0x33')]=_['keys'](_0x3ab637['query']);_0x208fa0[_0xf977('0x34')]=_['intersection'](_0x208fa0[_0xf977('0x31')],_0x208fa0[_0xf977('0x33')]);_0x113e08['attributes']=_['intersection'](_0x208fa0[_0xf977('0x31')],qs[_0xf977('0x35')](_0x3ab637['query']['fields']));_0x113e08[_0xf977('0x36')]=_0x113e08[_0xf977('0x36')]['length']?_0x113e08[_0xf977('0x36')]:_0x208fa0[_0xf977('0x31')];if(!_0x3ab637['query'][_0xf977('0x37')]('nolimit')){_0x113e08[_0xf977('0x38')]=qs[_0xf977('0x38')](_0x3ab637[_0xf977('0x33')][_0xf977('0x38')]);_0x113e08[_0xf977('0x1d')]=qs[_0xf977('0x1d')](_0x3ab637['query'][_0xf977('0x1d')]);}_0x113e08[_0xf977('0x39')]=qs[_0xf977('0x3a')](_0x3ab637['query'][_0xf977('0x3a')]);_0x113e08[_0xf977('0x3b')]=qs[_0xf977('0x34')](_['pick'](_0x3ab637['query'],_0x208fa0[_0xf977('0x34')]),_0xb5eed7);if(_0x3ab637['query'][_0xf977('0x3c')]){_0x113e08[_0xf977('0x3b')]=_[_0xf977('0x3d')](_0x113e08[_0xf977('0x3b')],{'$or':_[_0xf977('0x32')](_0xb5eed7,function(_0x30d32a){if(_0x30d32a[_0xf977('0x3e')]!==_0xf977('0x3f')){var _0x5ad59f={};_0x5ad59f[_0x30d32a[_0xf977('0x2a')]]={'$like':'%'+_0x3ab637[_0xf977('0x33')]['filter']+'%'};return _0x5ad59f;}})});}_0x113e08=_[_0xf977('0x3d')]({},_0x113e08,_0x3ab637[_0xf977('0x40')]);var _0x31b65a={'where':_0x113e08[_0xf977('0x3b')]};return db[_0xf977('0x2d')][_0xf977('0x41')](_0x31b65a)['then'](function(_0x38bc3e){_0x472597[_0xf977('0x41')]=_0x38bc3e;if(_0x3ab637[_0xf977('0x33')][_0xf977('0x42')]){_0x113e08['include']=[{'all':!![]}];}return db[_0xf977('0x2d')]['findAll'](_0x113e08);})[_0xf977('0x24')](function(_0x5ae644){_0x472597[_0xf977('0x43')]=_0x5ae644;return _0x472597;})['then'](respondWithFilteredResult(_0x4d9ba8,_0x113e08))[_0xf977('0x44')](handleError(_0x4d9ba8,null));};exports['show']=function(_0x443a95,_0x5cc677){var _0x5bbe7b={'raw':![],'where':{'id':_0x443a95[_0xf977('0x45')]['id']}},_0x5a4735={};_0x5a4735['model']=_[_0xf977('0x46')](db['AnalyticCustomReport'][_0xf977('0x2e')]);_0x5a4735[_0xf977('0x33')]=_[_0xf977('0x46')](_0x443a95[_0xf977('0x33')]);_0x5a4735[_0xf977('0x34')]=_[_0xf977('0x47')](_0x5a4735['model'],_0x5a4735[_0xf977('0x33')]);_0x5bbe7b[_0xf977('0x36')]=_['intersection'](_0x5a4735[_0xf977('0x31')],qs[_0xf977('0x35')](_0x443a95[_0xf977('0x33')][_0xf977('0x35')]));_0x5bbe7b[_0xf977('0x36')]=_0x5bbe7b['attributes'][_0xf977('0x48')]?_0x5bbe7b[_0xf977('0x36')]:_0x5a4735[_0xf977('0x31')];if(_0x443a95['query'][_0xf977('0x42')]){_0x5bbe7b[_0xf977('0x49')]=[{'all':!![]}];}_0x5bbe7b=_[_0xf977('0x3d')]({},_0x5bbe7b,_0x443a95[_0xf977('0x40')]);return db[_0xf977('0x2d')][_0xf977('0x4a')](_0x5bbe7b)[_0xf977('0x24')](handleEntityNotFound(_0x5cc677,null))[_0xf977('0x24')](respondWithResult(_0x5cc677,null))['catch'](handleError(_0x5cc677,null));};exports[_0xf977('0x4b')]=function(_0x450d5f,_0x35b3c4){return db[_0xf977('0x2d')]['create'](_0x450d5f[_0xf977('0x4c')],{})[_0xf977('0x24')](function(_0x226bda){var _0x2e9ff9=_0x450d5f[_0xf977('0x4d')][_0xf977('0x4e')]({'plain':!![]});if(!_0x2e9ff9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e9ff9[_0xf977('0x4f')]===_0xf977('0x4d')){var _0x21eae9=_0x226bda[_0xf977('0x4e')]({'plain':!![]});var _0x4cc6e2=_0xf977('0x50');return db['UserProfileSection']['find']({'where':{'name':_0x4cc6e2,'userProfileId':_0x2e9ff9[_0xf977('0x51')]},'raw':!![]})[_0xf977('0x24')](function(_0x31b092){if(_0x31b092&&_0x31b092[_0xf977('0x52')]===0x0){return db[_0xf977('0x53')][_0xf977('0x4b')]({'name':_0x21eae9[_0xf977('0x2a')],'resourceId':_0x21eae9['id'],'type':_0xf977('0x26'),'sectionId':_0x31b092['id']},{})['then'](function(){return _0x226bda;});}else{return _0x226bda;}})['catch'](function(_0x22d140){logger[_0xf977('0x28')](_0xf977('0x54'),_0x22d140);throw _0x22d140;});}return _0x226bda;})[_0xf977('0x24')](respondWithResult(_0x35b3c4,0xc9))['catch'](handleError(_0x35b3c4,null));};exports[_0xf977('0x23')]=function(_0x21fddd,_0x395bd0){if(_0x21fddd['body']['id']){delete _0x21fddd[_0xf977('0x4c')]['id'];}return db[_0xf977('0x2d')][_0xf977('0x4a')]({'where':{'id':_0x21fddd[_0xf977('0x45')]['id']}})[_0xf977('0x24')](handleEntityNotFound(_0x395bd0,null))['then'](saveUpdates(_0x21fddd[_0xf977('0x4c')],null))[_0xf977('0x24')](respondWithResult(_0x395bd0,null))[_0xf977('0x44')](handleError(_0x395bd0,null));};exports[_0xf977('0x25')]=function(_0x162203,_0x4bea88){return db[_0xf977('0x2d')]['find']({'where':{'id':_0x162203['params']['id']}})[_0xf977('0x24')](handleEntityNotFound(_0x4bea88,null))[_0xf977('0x24')](removeEntity(_0x4bea88,null))['catch'](handleError(_0x4bea88,null));};exports[_0xf977('0x55')]=function(_0x4ce1c6,_0x439cc4){var _0x2fef31=0xa;var _0x152f8f=[_0xf977('0x56'),'left_join','right_join',_0xf977('0x57')];var _0x15453e={'SUM':'SUM(%s)','COUNT':_0xf977('0x58'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xf977('0x59'),'MIN':_0xf977('0x5a'),'AVG':_0xf977('0x5b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xf977('0x5c'),'GROUP_CONCAT DESC':_0xf977('0x5d')};var _0x21b170={'SEC_TO_TIME':_0xf977('0x5e'),'DATE':'DATE(%s)','HOUR':_0xf977('0x5f'),'ROUND':_0xf977('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2ae985=function(_0x591ac6){return!_[_0xf977('0x61')]([_0xf977('0x62'),_0xf977('0x63'),_0xf977('0x64'),_0xf977('0x65')],_0x591ac6);};var _0x19394b=function(_0x2eea65){if(!_0x2eea65||!_0x2eea65[_0xf977('0x66')][_0xf977('0x48')]){return'';}for(var _0x3bb17a='(',_0x1bd0bb=0x0;_0x1bd0bb<_0x2eea65[_0xf977('0x66')][_0xf977('0x48')];_0x1bd0bb+=0x1){_0x1bd0bb>0x0&&(_0x3bb17a+='\x20'+_0x2eea65[_0xf977('0x67')]+'\x20');_0x3bb17a+=_0x2eea65['rules'][_0x1bd0bb][_0xf977('0x68')]?_0x19394b(_0x2eea65[_0xf977('0x66')][_0x1bd0bb][_0xf977('0x68')]):_0x2eea65[_0xf977('0x66')][_0x1bd0bb][_0xf977('0x69')]+'\x20'+_0x2eea65[_0xf977('0x66')][_0x1bd0bb]['condition']+(_0x2ae985(_0x2eea65['rules'][_0x1bd0bb][_0xf977('0x6a')])?'\x20'+_0x2eea65[_0xf977('0x66')][_0x1bd0bb]['value']:'');}return _0x3bb17a+')';};var _0x42c256={'where':{'id':_0x4ce1c6['params']['id']}},_0x546d1f,_0x5183c8,_0x5e7860,_0xf7ab94,_0x357350;_0x42c256=_['merge']({},_0x42c256,_0x4ce1c6[_0xf977('0x40')]);return db[_0xf977('0x2d')]['find'](_0x42c256)[_0xf977('0x24')](function(_0xe66c8a){if(_0xe66c8a){_0x546d1f=_0xe66c8a;return _0xe66c8a[_0xf977('0x6b')]();}return null;})[_0xf977('0x24')](function(_0x563244){if(_0x563244){if(!_0x563244[_0xf977('0x48')]){throw new db[(_0xf977('0x6c'))][(_0xf977('0x6d'))](_0xf977('0x6e'),0x193);}_0x5183c8=_0x563244;return db[_0xf977('0x6f')]['findAll']({'raw':!![]});}return null;})[_0xf977('0x24')](function(_0x2ea6ca){if(_0x2ea6ca){_0x5e7860=_[_0xf977('0x70')](_0x2ea6ca,'id');var _0x1bf08f;var _0x24d520=squel['select']();_0x24d520[_0xf977('0x71')](_0x546d1f[_0xf977('0x72')]);for(var _0x5d339e=0x0;_0x5d339e<_0x5183c8[_0xf977('0x48')];_0x5d339e+=0x1){_0x1bf08f=_0x5183c8[_0x5d339e][_0xf977('0x73')]?_0x5e7860[_0x5183c8[_0x5d339e][_0xf977('0x73')]][_0xf977('0x74')]:_0x5183c8[_0x5d339e]['field'];_0x1bf08f=_0x5183c8[_0x5d339e][_0xf977('0x75')]?_[_0xf977('0x76')](_0x15453e[_0x5183c8[_0x5d339e][_0xf977('0x75')]],'%s',_0x1bf08f):_0x1bf08f;_0x1bf08f=_0x5183c8[_0x5d339e][_0xf977('0x77')]?_[_0xf977('0x76')](_0x21b170[_0x5183c8[_0x5d339e][_0xf977('0x77')]],'%s',_0x1bf08f):_0x1bf08f;if(_0x5183c8[_0x5d339e][_0xf977('0x78')]){_0x24d520[_0xf977('0x68')](_0x1bf08f);}_0x5183c8[_0x5d339e]['orderBy']&&_0x24d520[_0xf977('0x39')](_0x1bf08f,_0x5183c8[_0x5d339e]['orderBy']==='DESC'?![]:!![]);_0x24d520[_0xf977('0x69')](_0x1bf08f,_0x5183c8[_0x5d339e][_0xf977('0x79')]||_0x1bf08f);}if(_0x546d1f[_0xf977('0x7a')]){_0x546d1f['joins']=JSON[_0xf977('0x7b')](_0x546d1f['joins']);for(var _0x1ee1fe=0x0;_0x1ee1fe<_0x546d1f[_0xf977('0x7a')][_0xf977('0x48')];_0x1ee1fe+=0x1){if(_0x546d1f[_0xf977('0x7a')][_0x1ee1fe]['type']&&_['includes'](_0x152f8f,_0x546d1f[_0xf977('0x7a')][_0x1ee1fe][_0xf977('0x3e')])&&_0x546d1f['joins'][_0x1ee1fe]['parentKey']&&_0x546d1f[_0xf977('0x7a')][_0x1ee1fe][_0xf977('0x7c')]&&_0x546d1f['joins'][_0x1ee1fe][_0xf977('0x7d')]){_0x24d520[_0x546d1f[_0xf977('0x7a')][_0x1ee1fe][_0xf977('0x3e')]](_0x546d1f[_0xf977('0x7a')][_0x1ee1fe][_0xf977('0x7c')],null,util['format'](_0xf977('0x7e'),_0x546d1f[_0xf977('0x72')],_0x546d1f['joins'][_0x1ee1fe]['parentKey'],_0x546d1f[_0xf977('0x7a')][_0x1ee1fe][_0xf977('0x7c')],_0x546d1f[_0xf977('0x7a')][_0x1ee1fe]['foreignKey']));}}}if(_0x546d1f[_0xf977('0x7f')]){_0x546d1f[_0xf977('0x7f')]=JSON['parse'](_0x546d1f[_0xf977('0x7f')]);_0x24d520[_0xf977('0x3b')](_0x19394b(_0x546d1f['conditions'][_0xf977('0x68')]));}_0x357350=_0x24d520[_0xf977('0x80')]();_0x24d520[_0xf977('0x38')](_0x2fef31);_0x24d520[_0xf977('0x1d')](0x0);logger['debug'](_0xf977('0x81'),_0x24d520[_0xf977('0x82')]());return dbH['sequelize'][_0xf977('0x33')](_0x24d520[_0xf977('0x82')](),{'type':dbH[_0xf977('0x83')][_0xf977('0x84')]['SELECT']});}})[_0xf977('0x24')](respondWithResult(_0x439cc4,null))[_0xf977('0x44')](handleError(_0x439cc4,null));};function runReport(_0x3ce7ed,_0x4f9ae7,_0x19594f){var _0x4ee3e6=_0x4f9ae7[_0xf977('0x2a')];var _0x2b8424=0xa;var _0x238246=[_0xf977('0x56'),_0xf977('0x85'),_0xf977('0x86'),_0xf977('0x57')];var _0x223f58={'SUM':_0xf977('0x87'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xf977('0x88'),'MAX':'MAX(%s)','MIN':_0xf977('0x5a'),'AVG':_0xf977('0x5b'),'GROUP_CONCAT':_0xf977('0x89'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xf977('0x5d')};var _0x432b7d={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf977('0x8a'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xf977('0x8b')};var _0x48c641=function(_0x2907d8){return!_[_0xf977('0x61')]([_0xf977('0x62'),_0xf977('0x63'),_0xf977('0x64'),_0xf977('0x65')],_0x2907d8);};var _0xd4f620=function(_0x308d82){if(!_0x308d82||!_0x308d82['rules']['length']){return'';}for(var _0x3e44a5='(',_0x776cea=0x0;_0x776cea<_0x308d82['rules'][_0xf977('0x48')];_0x776cea+=0x1){_0x776cea>0x0&&(_0x3e44a5+='\x20'+_0x308d82[_0xf977('0x67')]+'\x20');_0x3e44a5+=_0x308d82[_0xf977('0x66')][_0x776cea][_0xf977('0x68')]?_0xd4f620(_0x308d82[_0xf977('0x66')][_0x776cea][_0xf977('0x68')]):_0x308d82[_0xf977('0x66')][_0x776cea]['field']+'\x20'+_0x308d82[_0xf977('0x66')][_0x776cea][_0xf977('0x6a')]+(_0x48c641(_0x308d82['rules'][_0x776cea][_0xf977('0x6a')])?'\x20'+_0x308d82[_0xf977('0x66')][_0x776cea][_0xf977('0x8c')]:'');}return _0x3e44a5+')';};var _0x2cae22={'where':{'id':_0x3ce7ed['id']}},_0x3b599c,_0x374557,_0x20bce8,_0x4ed1a8,_0x2030a3;_0x2cae22=_[_0xf977('0x3d')]({},_0x2cae22,_0x19594f);return db[_0xf977('0x2d')][_0xf977('0x4a')](_0x2cae22)[_0xf977('0x24')](function(_0x2b8dd8){if(_0x2b8dd8){_0x3b599c=_0x2b8dd8;return _0x2b8dd8[_0xf977('0x6b')]();}return null;})[_0xf977('0x24')](function(_0xe2c2b9){if(_0xe2c2b9){if(!_0xe2c2b9[_0xf977('0x48')]){throw new db[(_0xf977('0x6c'))][(_0xf977('0x6d'))](_0xf977('0x6e'),0x193);}_0x374557=_0xe2c2b9;return db[_0xf977('0x6f')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x2dff45){if(_0x2dff45){_0x20bce8=_[_0xf977('0x70')](_0x2dff45,'id');var _0x5e5338;var _0x592d17=squel['select']();_0x592d17[_0xf977('0x71')](_0x3b599c[_0xf977('0x72')]);for(var _0x57937c=0x0;_0x57937c<_0x374557[_0xf977('0x48')];_0x57937c+=0x1){_0x5e5338=_0x374557[_0x57937c][_0xf977('0x73')]?_0x20bce8[_0x374557[_0x57937c][_0xf977('0x73')]]['metric']:_0x374557[_0x57937c]['field'];_0x5e5338=_0x374557[_0x57937c][_0xf977('0x75')]?_['replace'](_0x223f58[_0x374557[_0x57937c][_0xf977('0x75')]],'%s',_0x5e5338):_0x5e5338;_0x5e5338=_0x374557[_0x57937c][_0xf977('0x77')]?_[_0xf977('0x76')](_0x432b7d[_0x374557[_0x57937c][_0xf977('0x77')]],'%s',_0x5e5338):_0x5e5338;if(_0x374557[_0x57937c][_0xf977('0x78')]){_0x592d17[_0xf977('0x68')](_0x5e5338);}_0x374557[_0x57937c][_0xf977('0x8d')]&&_0x592d17[_0xf977('0x39')](_0x5e5338,_0x374557[_0x57937c][_0xf977('0x8d')]===_0xf977('0x8e')?![]:!![]);_0x592d17['field'](_0x5e5338,_0x374557[_0x57937c][_0xf977('0x79')]||_0x5e5338);}if(_0x3b599c[_0xf977('0x7a')]){_0x3b599c['joins']=JSON[_0xf977('0x7b')](_0x3b599c[_0xf977('0x7a')]);for(var _0x5be54c=0x0;_0x5be54c<_0x3b599c[_0xf977('0x7a')][_0xf977('0x48')];_0x5be54c+=0x1){if(_0x3b599c[_0xf977('0x7a')][_0x5be54c][_0xf977('0x3e')]&&_['includes'](_0x238246,_0x3b599c[_0xf977('0x7a')][_0x5be54c][_0xf977('0x3e')])&&_0x3b599c['joins'][_0x5be54c]['parentKey']&&_0x3b599c['joins'][_0x5be54c]['foreignTable']&&_0x3b599c[_0xf977('0x7a')][_0x5be54c][_0xf977('0x7d')]){_0x592d17[_0x3b599c[_0xf977('0x7a')][_0x5be54c]['type']](_0x3b599c[_0xf977('0x7a')][_0x5be54c][_0xf977('0x7c')],null,util[_0xf977('0x77')](_0xf977('0x7e'),_0x3b599c[_0xf977('0x72')],_0x3b599c[_0xf977('0x7a')][_0x5be54c][_0xf977('0x8f')],_0x3b599c['joins'][_0x5be54c][_0xf977('0x7c')],_0x3b599c[_0xf977('0x7a')][_0x5be54c][_0xf977('0x7d')]));}}}if(_0x3b599c[_0xf977('0x7f')]){_0x3b599c[_0xf977('0x7f')]=JSON[_0xf977('0x7b')](_0x3b599c[_0xf977('0x7f')]);_0x592d17[_0xf977('0x3b')](_0xd4f620(_0x3b599c[_0xf977('0x7f')]['group']));}_0x2030a3=_0x592d17[_0xf977('0x80')]();_0x592d17['limit'](_0x2b8424);_0x592d17[_0xf977('0x1d')](0x0);return;}})[_0xf977('0x24')](function(){if(_0x4f9ae7['output']===_0xf977('0x90')){return null;}var _0x25bd9d=_['merge'](_0x4f9ae7,{'name':_0x4f9ae7[_0xf977('0x91')]||_0x4f9ae7['name']||_0x3b599c['name'],'basename':_0x4ee3e6,'savename':util[_0xf977('0x77')](_0xf977('0x92'),_0x4f9ae7['name']||_0x3b599c[_0xf977('0x2a')],require(_0xf977('0x93'))[_0xf977('0x94')](0x4),_0x4f9ae7[_0xf977('0x95')]||_0xf977('0x96')),'reportId':_0x3b599c['id'],'reportType':_0xf977('0x97')});return db[_0xf977('0x98')][_0xf977('0x4b')](_0x25bd9d,{'raw':!![]});})['then'](function(_0x4c8086){if(_0x3b599c[_0xf977('0x72')]==='cdr'){_0x2030a3[_0xf977('0x3b')](_0x3b599c[_0xf977('0x72')]+_0xf977('0x99'),_0x4f9ae7[_0xf977('0x9a')],_0x4f9ae7[_0xf977('0x9b')]);}else{_0x2030a3[_0xf977('0x3b')](_0x3b599c[_0xf977('0x72')]+_0xf977('0x9c'),_0x4f9ae7[_0xf977('0x9a')],_0x4f9ae7[_0xf977('0x9b')]);}if(_0x4c8086){logger[_0xf977('0x9d')](_0xf977('0x9e'),_0x2030a3[_0xf977('0x82')]());require(_0xf977('0x9f'))['fork'](path[_0xf977('0x56')](__dirname,'../../components/export/',_0x4c8086[_0xf977('0x95')]),[_0x4c8086['id'],_0x2030a3['toString'](),path[_0xf977('0x56')](__dirname,'../../files/reports',_0x4c8086[_0xf977('0xa0')]),_0x4ee3e6]);return _0x4c8086;}else{var _0x211c94=squel[_0xf977('0xa1')]();_0x211c94['from']('('+_0x2030a3[_0xf977('0x82')]()+')','countTable');_0x211c94[_0xf977('0x69')](_0xf977('0xa2'),'count');_0x2030a3[_0xf977('0x38')](_0x4f9ae7[_0xf977('0x38')]||_0x2b8424);_0x2030a3[_0xf977('0x1d')](_0x4f9ae7[_0xf977('0x1d')]||0x0);return dbH[_0xf977('0x83')][_0xf977('0x33')](_0x211c94['toString'](),{'type':dbH[_0xf977('0x83')]['QueryTypes'][_0xf977('0xa3')]})[_0xf977('0x24')](function(_0x5e5adc){if(!_0x5e5adc[_0xf977('0x48')]){_0x4ed1a8=0x0;}else{_0x4ed1a8=_0x5e5adc[0x0][_0xf977('0x41')]||0x0;}return dbH[_0xf977('0x83')]['query'](_0x2030a3[_0xf977('0x82')](),{'type':dbH['sequelize'][_0xf977('0x84')][_0xf977('0xa3')]});})['then'](function(_0x8bf85c){return{'rows':_0x8bf85c||[],'count':_0x4ed1a8};});}});}exports[_0xf977('0xa4')]=function(_0x392b7a,_0x576fc8){return runReport(_0x392b7a['params'],_0x392b7a[_0xf977('0x33')],_0x392b7a[_0xf977('0x40')])['then'](respondWithResult(_0x576fc8,null))[_0xf977('0x44')](handleError(_0x576fc8,null));};exports[_0xf977('0xa5')]=runReport;exports['query']=function(_0x1f0088,_0x460a3f){var _0x478c30=0xa;var _0x5db39f=[_0xf977('0x56'),_0xf977('0x85'),_0xf977('0x86'),_0xf977('0x57')];var _0x45a51a={'SUM':'SUM(%s)','COUNT':_0xf977('0x58'),'COUNT DISTINCT':_0xf977('0x88'),'MAX':_0xf977('0x59'),'MIN':_0xf977('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xf977('0x89'),'GROUP_CONCAT ASC':_0xf977('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x42070a={'SEC_TO_TIME':_0xf977('0x5e'),'DATE':'DATE(%s)','HOUR':_0xf977('0x5f'),'ROUND':_0xf977('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3e0148=function(_0x524c2e){return!_[_0xf977('0x61')]([_0xf977('0x62'),_0xf977('0x63'),'IS\x20EMPTY',_0xf977('0x65')],_0x524c2e);};var _0x5729f5=function(_0x430575){if(!_0x430575||!_0x430575['rules']['length']){return'';}for(var _0x10f8a2='(',_0x461603=0x0;_0x461603<_0x430575[_0xf977('0x66')]['length'];_0x461603+=0x1){_0x461603>0x0&&(_0x10f8a2+='\x20'+_0x430575[_0xf977('0x67')]+'\x20');_0x10f8a2+=_0x430575[_0xf977('0x66')][_0x461603][_0xf977('0x68')]?_0x5729f5(_0x430575['rules'][_0x461603][_0xf977('0x68')]):_0x430575['rules'][_0x461603][_0xf977('0x69')]+'\x20'+_0x430575[_0xf977('0x66')][_0x461603][_0xf977('0x6a')]+(_0x3e0148(_0x430575['rules'][_0x461603][_0xf977('0x6a')])?'\x20'+_0x430575['rules'][_0x461603]['value']:'');}return _0x10f8a2+')';};var _0x559c4a={'where':{'id':_0x1f0088[_0xf977('0x45')]['id']}},_0x2acfdd,_0x16f072,_0x4266af,_0x44e60,_0x3195c9;_0x559c4a=_[_0xf977('0x3d')]({},_0x559c4a,_0x1f0088['options']);return db[_0xf977('0x2d')][_0xf977('0x4a')](_0x559c4a)[_0xf977('0x24')](function(_0x56839){if(_0x56839){_0x2acfdd=_0x56839;return _0x56839[_0xf977('0x6b')]();}return null;})[_0xf977('0x24')](function(_0x25a8e6){if(_0x25a8e6){if(!_0x25a8e6[_0xf977('0x48')]){throw new db['Sequelize'][(_0xf977('0x6d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x16f072=_0x25a8e6;return db['AnalyticMetric'][_0xf977('0xa6')]({'raw':!![]});}return null;})[_0xf977('0x24')](function(_0x1554d3){if(_0x1554d3){_0x4266af=_[_0xf977('0x70')](_0x1554d3,'id');var _0x7a9048;var _0x3345cf=squel[_0xf977('0xa1')]();_0x3345cf['from'](_0x2acfdd['table']);for(var _0x53c86f=0x0;_0x53c86f<_0x16f072['length'];_0x53c86f+=0x1){_0x7a9048=_0x16f072[_0x53c86f][_0xf977('0x73')]?_0x4266af[_0x16f072[_0x53c86f]['MetricId']][_0xf977('0x74')]:_0x16f072[_0x53c86f][_0xf977('0x69')];_0x7a9048=_0x16f072[_0x53c86f]['function']?_[_0xf977('0x76')](_0x45a51a[_0x16f072[_0x53c86f][_0xf977('0x75')]],'%s',_0x7a9048):_0x7a9048;_0x7a9048=_0x16f072[_0x53c86f][_0xf977('0x77')]?_['replace'](_0x42070a[_0x16f072[_0x53c86f][_0xf977('0x77')]],'%s',_0x7a9048):_0x7a9048;if(_0x16f072[_0x53c86f][_0xf977('0x78')]){_0x3345cf[_0xf977('0x68')](_0x7a9048);}_0x16f072[_0x53c86f][_0xf977('0x8d')]&&_0x3345cf[_0xf977('0x39')](_0x7a9048,_0x16f072[_0x53c86f][_0xf977('0x8d')]==='DESC'?![]:!![]);_0x3345cf['field'](_0x7a9048,_0x16f072[_0x53c86f][_0xf977('0x79')]||_0x7a9048);}if(_0x2acfdd[_0xf977('0x7a')]){_0x2acfdd[_0xf977('0x7a')]=JSON[_0xf977('0x7b')](_0x2acfdd[_0xf977('0x7a')]);for(var _0x3b62ba=0x0;_0x3b62ba<_0x2acfdd[_0xf977('0x7a')][_0xf977('0x48')];_0x3b62ba+=0x1){if(_0x2acfdd[_0xf977('0x7a')][_0x3b62ba]['type']&&_[_0xf977('0x61')](_0x5db39f,_0x2acfdd[_0xf977('0x7a')][_0x3b62ba][_0xf977('0x3e')])&&_0x2acfdd[_0xf977('0x7a')][_0x3b62ba][_0xf977('0x8f')]&&_0x2acfdd[_0xf977('0x7a')][_0x3b62ba][_0xf977('0x7c')]&&_0x2acfdd[_0xf977('0x7a')][_0x3b62ba][_0xf977('0x7d')]){_0x3345cf[_0x2acfdd[_0xf977('0x7a')][_0x3b62ba]['type']](_0x2acfdd[_0xf977('0x7a')][_0x3b62ba]['foreignTable'],null,util['format'](_0xf977('0x7e'),_0x2acfdd[_0xf977('0x72')],_0x2acfdd[_0xf977('0x7a')][_0x3b62ba][_0xf977('0x8f')],_0x2acfdd[_0xf977('0x7a')][_0x3b62ba][_0xf977('0x7c')],_0x2acfdd['joins'][_0x3b62ba][_0xf977('0x7d')]));}}}if(_0x2acfdd[_0xf977('0x7f')]){_0x2acfdd['conditions']=JSON[_0xf977('0x7b')](_0x2acfdd['conditions']);_0x3345cf[_0xf977('0x3b')](_0x5729f5(_0x2acfdd['conditions'][_0xf977('0x68')]));}_0x3195c9=_0x3345cf['clone']();_0x3345cf[_0xf977('0x38')](_0x478c30);_0x3345cf['offset'](0x0);logger[_0xf977('0xa7')](_0xf977('0x81'),_0x3345cf[_0xf977('0x82')]());return dbH[_0xf977('0x83')][_0xf977('0x33')](_0x3345cf[_0xf977('0x82')](),{'type':dbH[_0xf977('0x83')]['QueryTypes'][_0xf977('0xa3')]});}})['then'](function(){return{'sql':_0x3195c9[_0xf977('0x82')]()};})[_0xf977('0x24')](respondWithResult(_0x460a3f,null))[_0xf977('0x44')](handleError(_0x460a3f,null));}; \ No newline at end of file +var _0xc8f1=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','get','CustomReports','UserProfileResource','destroy','error','name','send','index','map','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','AnalyticCustomReport','rows','catch','show','rawAttributes','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','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','group','field','condition','value','params','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','table','MetricId','metric','function','format','replace','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','SEC_TO_TIME(%s)','includes','Sequelize','DESC','%s.%s\x20=\x20%s.%s','output','web','fullPath','randomstring','generate','csv','custom','cdr','endDate','startDate','info','Run\x20Query:','child_process','../../components/export/','savename','from','countTable','COUNT(*)','run','runReport','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x17f928,_0x5b3e05){var _0x35f22b=function(_0x55b336){while(--_0x55b336){_0x17f928['push'](_0x17f928['shift']());}};_0x35f22b(++_0x5b3e05);}(_0xc8f1,0x13a));var _0x1c8f=function(_0x14a1c8,_0x17772b){_0x14a1c8=_0x14a1c8-0x0;var _0x2311b2=_0xc8f1[_0x14a1c8];return _0x2311b2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1c8f('0x0'));var zipdir=require(_0x1c8f('0x1'));var jsonpatch=require(_0x1c8f('0x2'));var rp=require(_0x1c8f('0x3'));var moment=require(_0x1c8f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1c8f('0x5'));var util=require(_0x1c8f('0x6'));var path=require(_0x1c8f('0x7'));var sox=require(_0x1c8f('0x8'));var csv=require(_0x1c8f('0x9'));var ejs=require(_0x1c8f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1c8f('0xb'));var squel=require(_0x1c8f('0xc'));var crypto=require(_0x1c8f('0xd'));var jsforce=require(_0x1c8f('0xe'));var deskjs=require(_0x1c8f('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1c8f('0x10'));var Redis=require(_0x1c8f('0x11'));var authService=require(_0x1c8f('0x12'));var qs=require(_0x1c8f('0x13'));var as=require(_0x1c8f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1c8f('0x15'))(_0x1c8f('0x16'));var utils=require('../../config/utils');var config=require(_0x1c8f('0x17'));var licenseUtil=require(_0x1c8f('0x18'));var db=require('../../mysqldb')['db'];var dbH=require(_0x1c8f('0x19'))[_0x1c8f('0x1a')];function respondWithStatusCode(_0x1983c3,_0x1e6b7d){_0x1e6b7d=_0x1e6b7d||0xcc;return function(_0x5c9821){if(_0x5c9821){return _0x1983c3[_0x1c8f('0x1b')](_0x1e6b7d);}return _0x1983c3[_0x1c8f('0x1c')](_0x1e6b7d)[_0x1c8f('0x1d')]();};}function respondWithResult(_0x5aef5b,_0x346b88){_0x346b88=_0x346b88||0xc8;return function(_0x780b30){if(_0x780b30){return _0x5aef5b[_0x1c8f('0x1c')](_0x346b88)[_0x1c8f('0x1e')](_0x780b30);}};}function respondWithFilteredResult(_0x40010f,_0x42206){return function(_0x454f9b){if(_0x454f9b){var _0x14eb46=typeof _0x42206[_0x1c8f('0x1f')]===_0x1c8f('0x20')&&typeof _0x42206[_0x1c8f('0x21')]===_0x1c8f('0x20');var _0x5f1426=_0x454f9b[_0x1c8f('0x22')];var _0x2105ba=_0x14eb46?0x0:_0x42206[_0x1c8f('0x1f')];var _0x11e167=_0x14eb46?_0x454f9b['count']:_0x42206[_0x1c8f('0x1f')]+_0x42206[_0x1c8f('0x21')];var _0x505346;if(_0x11e167>=_0x5f1426){_0x11e167=_0x5f1426;_0x505346=0xc8;}else{_0x505346=0xce;}_0x40010f[_0x1c8f('0x1c')](_0x505346);return _0x40010f[_0x1c8f('0x23')](_0x1c8f('0x24'),_0x2105ba+'-'+_0x11e167+'/'+_0x5f1426)['json'](_0x454f9b);}return null;};}function patchUpdates(_0x385e2e){return function(_0x499cf2){try{jsonpatch[_0x1c8f('0x25')](_0x499cf2,_0x385e2e,!![]);}catch(_0x36f133){return BPromise['reject'](_0x36f133);}return _0x499cf2['save']();};}function saveUpdates(_0xaa36f6,_0xf68937){return function(_0x1ade50){if(_0x1ade50){return _0x1ade50[_0x1c8f('0x26')](_0xaa36f6)['then'](function(_0x18fe7c){return _0x18fe7c;});}return null;};}function removeEntity(_0x4ccd17,_0xc089e8){return function(_0x479669){if(_0x479669){return _0x479669['destroy']()[_0x1c8f('0x27')](function(){var _0x790a63=_0x479669[_0x1c8f('0x28')]({'plain':!![]});var _0x36d680=_0x1c8f('0x29');return db[_0x1c8f('0x2a')][_0x1c8f('0x2b')]({'where':{'type':_0x36d680,'resourceId':_0x790a63['id']}})[_0x1c8f('0x27')](function(){return _0x479669;});})[_0x1c8f('0x27')](function(){_0x4ccd17[_0x1c8f('0x1c')](0xcc)[_0x1c8f('0x1d')]();});}};}function handleEntityNotFound(_0x14a839,_0xa53a1a){return function(_0x1a27c9){if(!_0x1a27c9){_0x14a839[_0x1c8f('0x1b')](0x194);}return _0x1a27c9;};}function handleError(_0x86ed49,_0x3815d5){_0x3815d5=_0x3815d5||0x1f4;return function(_0x7031ca){logger[_0x1c8f('0x2c')](_0x7031ca['stack']);if(_0x7031ca[_0x1c8f('0x2d')]){delete _0x7031ca[_0x1c8f('0x2d')];}_0x86ed49['status'](_0x3815d5)[_0x1c8f('0x2e')](_0x7031ca);};}exports[_0x1c8f('0x2f')]=function(_0x51f87d,_0x10d441){var _0x50722b={},_0x247412={},_0x4fb489={'count':0x0,'rows':[]};var _0x2cc94b=_[_0x1c8f('0x30')](db['AnalyticCustomReport']['rawAttributes'],function(_0x2ef1c5){return{'name':_0x2ef1c5['fieldName'],'type':_0x2ef1c5[_0x1c8f('0x31')][_0x1c8f('0x32')]};});_0x247412[_0x1c8f('0x33')]=_[_0x1c8f('0x30')](_0x2cc94b,'name');_0x247412[_0x1c8f('0x34')]=_[_0x1c8f('0x35')](_0x51f87d['query']);_0x247412[_0x1c8f('0x36')]=_[_0x1c8f('0x37')](_0x247412[_0x1c8f('0x33')],_0x247412['query']);_0x50722b['attributes']=_[_0x1c8f('0x37')](_0x247412[_0x1c8f('0x33')],qs[_0x1c8f('0x38')](_0x51f87d[_0x1c8f('0x34')][_0x1c8f('0x38')]));_0x50722b['attributes']=_0x50722b[_0x1c8f('0x39')]['length']?_0x50722b['attributes']:_0x247412[_0x1c8f('0x33')];if(!_0x51f87d['query']['hasOwnProperty'](_0x1c8f('0x3a'))){_0x50722b[_0x1c8f('0x21')]=qs[_0x1c8f('0x21')](_0x51f87d[_0x1c8f('0x34')]['limit']);_0x50722b[_0x1c8f('0x1f')]=qs['offset'](_0x51f87d[_0x1c8f('0x34')][_0x1c8f('0x1f')]);}_0x50722b[_0x1c8f('0x3b')]=qs[_0x1c8f('0x3c')](_0x51f87d[_0x1c8f('0x34')][_0x1c8f('0x3c')]);_0x50722b[_0x1c8f('0x3d')]=qs['filters'](_[_0x1c8f('0x3e')](_0x51f87d[_0x1c8f('0x34')],_0x247412[_0x1c8f('0x36')]),_0x2cc94b);if(_0x51f87d[_0x1c8f('0x34')][_0x1c8f('0x3f')]){_0x50722b['where']=_[_0x1c8f('0x40')](_0x50722b[_0x1c8f('0x3d')],{'$or':_['map'](_0x2cc94b,function(_0x40ad55){if(_0x40ad55[_0x1c8f('0x31')]!==_0x1c8f('0x41')){var _0x5472ca={};_0x5472ca[_0x40ad55[_0x1c8f('0x2d')]]={'$like':'%'+_0x51f87d[_0x1c8f('0x34')][_0x1c8f('0x3f')]+'%'};return _0x5472ca;}})});}_0x50722b=_[_0x1c8f('0x40')]({},_0x50722b,_0x51f87d[_0x1c8f('0x42')]);var _0x12473a={'where':_0x50722b['where']};return db['AnalyticCustomReport']['count'](_0x12473a)[_0x1c8f('0x27')](function(_0x172a97){_0x4fb489[_0x1c8f('0x22')]=_0x172a97;if(_0x51f87d[_0x1c8f('0x34')][_0x1c8f('0x43')]){_0x50722b['include']=[{'all':!![]}];}return db[_0x1c8f('0x44')]['findAll'](_0x50722b);})[_0x1c8f('0x27')](function(_0x8a849b){_0x4fb489[_0x1c8f('0x45')]=_0x8a849b;return _0x4fb489;})['then'](respondWithFilteredResult(_0x10d441,_0x50722b))[_0x1c8f('0x46')](handleError(_0x10d441,null));};exports[_0x1c8f('0x47')]=function(_0x5399a7,_0x295c0a){var _0x17f54a={'raw':![],'where':{'id':_0x5399a7['params']['id']}},_0x1a2039={};_0x1a2039[_0x1c8f('0x33')]=_[_0x1c8f('0x35')](db['AnalyticCustomReport'][_0x1c8f('0x48')]);_0x1a2039[_0x1c8f('0x34')]=_[_0x1c8f('0x35')](_0x5399a7[_0x1c8f('0x34')]);_0x1a2039[_0x1c8f('0x36')]=_['intersection'](_0x1a2039[_0x1c8f('0x33')],_0x1a2039[_0x1c8f('0x34')]);_0x17f54a['attributes']=_[_0x1c8f('0x37')](_0x1a2039[_0x1c8f('0x33')],qs[_0x1c8f('0x38')](_0x5399a7[_0x1c8f('0x34')]['fields']));_0x17f54a['attributes']=_0x17f54a[_0x1c8f('0x39')][_0x1c8f('0x49')]?_0x17f54a[_0x1c8f('0x39')]:_0x1a2039['model'];if(_0x5399a7[_0x1c8f('0x34')][_0x1c8f('0x43')]){_0x17f54a[_0x1c8f('0x4a')]=[{'all':!![]}];}_0x17f54a=_[_0x1c8f('0x40')]({},_0x17f54a,_0x5399a7[_0x1c8f('0x42')]);return db['AnalyticCustomReport'][_0x1c8f('0x4b')](_0x17f54a)['then'](handleEntityNotFound(_0x295c0a,null))[_0x1c8f('0x27')](respondWithResult(_0x295c0a,null))['catch'](handleError(_0x295c0a,null));};exports[_0x1c8f('0x4c')]=function(_0x43c15d,_0x256cde){return db[_0x1c8f('0x44')][_0x1c8f('0x4c')](_0x43c15d[_0x1c8f('0x4d')],{})[_0x1c8f('0x27')](function(_0x242362){var _0x1f58db=_0x43c15d[_0x1c8f('0x4e')][_0x1c8f('0x28')]({'plain':!![]});if(!_0x1f58db)throw new Error(_0x1c8f('0x4f'));if(_0x1f58db[_0x1c8f('0x50')]===_0x1c8f('0x4e')){var _0x405fd3=_0x242362[_0x1c8f('0x28')]({'plain':!![]});var _0x240029='Reports';return db[_0x1c8f('0x51')]['find']({'where':{'name':_0x240029,'userProfileId':_0x1f58db[_0x1c8f('0x52')]},'raw':!![]})[_0x1c8f('0x27')](function(_0xd36713){if(_0xd36713&&_0xd36713[_0x1c8f('0x53')]===0x0){return db[_0x1c8f('0x2a')][_0x1c8f('0x4c')]({'name':_0x405fd3[_0x1c8f('0x2d')],'resourceId':_0x405fd3['id'],'type':_0x1c8f('0x29'),'sectionId':_0xd36713['id']},{})[_0x1c8f('0x27')](function(){return _0x242362;});}else{return _0x242362;}})[_0x1c8f('0x46')](function(_0x167662){logger[_0x1c8f('0x2c')](_0x1c8f('0x54'),_0x167662);throw _0x167662;});}return _0x242362;})[_0x1c8f('0x27')](respondWithResult(_0x256cde,0xc9))['catch'](handleError(_0x256cde,null));};exports['update']=function(_0x1f4363,_0x5184bf){if(_0x1f4363['body']['id']){delete _0x1f4363[_0x1c8f('0x4d')]['id'];}return db[_0x1c8f('0x44')]['find']({'where':{'id':_0x1f4363['params']['id']}})[_0x1c8f('0x27')](handleEntityNotFound(_0x5184bf,null))[_0x1c8f('0x27')](saveUpdates(_0x1f4363[_0x1c8f('0x4d')],null))[_0x1c8f('0x27')](respondWithResult(_0x5184bf,null))['catch'](handleError(_0x5184bf,null));};exports['destroy']=function(_0x538b38,_0x5a66b2){return db[_0x1c8f('0x44')][_0x1c8f('0x4b')]({'where':{'id':_0x538b38['params']['id']}})[_0x1c8f('0x27')](handleEntityNotFound(_0x5a66b2,null))['then'](removeEntity(_0x5a66b2,null))[_0x1c8f('0x46')](handleError(_0x5a66b2,null));};exports[_0x1c8f('0x55')]=function(_0x19190b,_0x37d119){var _0x4aeafc=0xa;var _0x4e26af=[_0x1c8f('0x56'),_0x1c8f('0x57'),_0x1c8f('0x58'),_0x1c8f('0x59')];var _0x3357e5={'SUM':_0x1c8f('0x5a'),'COUNT':_0x1c8f('0x5b'),'COUNT DISTINCT':_0x1c8f('0x5c'),'MAX':_0x1c8f('0x5d'),'MIN':_0x1c8f('0x5e'),'AVG':_0x1c8f('0x5f'),'GROUP_CONCAT':_0x1c8f('0x60'),'GROUP_CONCAT ASC':_0x1c8f('0x61'),'GROUP_CONCAT DESC':_0x1c8f('0x62')};var _0x514021={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x1c8f('0x63'),'HOUR':_0x1c8f('0x64'),'ROUND':_0x1c8f('0x65'),'UNIX_TIMESTAMP':_0x1c8f('0x66')};var _0x4a3813=function(_0x198f36){return!_['includes']([_0x1c8f('0x67'),_0x1c8f('0x68'),_0x1c8f('0x69'),_0x1c8f('0x6a')],_0x198f36);};var _0x219cbb=function(_0x5f092e){if(!_0x5f092e||!_0x5f092e['rules'][_0x1c8f('0x49')]){return'';}for(var _0x5d5c04='(',_0x1d23e9=0x0;_0x1d23e9<_0x5f092e[_0x1c8f('0x6b')][_0x1c8f('0x49')];_0x1d23e9+=0x1){_0x1d23e9>0x0&&(_0x5d5c04+='\x20'+_0x5f092e['operator']+'\x20');_0x5d5c04+=_0x5f092e['rules'][_0x1d23e9]['group']?_0x219cbb(_0x5f092e[_0x1c8f('0x6b')][_0x1d23e9][_0x1c8f('0x6c')]):_0x5f092e[_0x1c8f('0x6b')][_0x1d23e9][_0x1c8f('0x6d')]+'\x20'+_0x5f092e['rules'][_0x1d23e9][_0x1c8f('0x6e')]+(_0x4a3813(_0x5f092e[_0x1c8f('0x6b')][_0x1d23e9]['condition'])?'\x20'+_0x5f092e[_0x1c8f('0x6b')][_0x1d23e9][_0x1c8f('0x6f')]:'');}return _0x5d5c04+')';};var _0x5f3f6c={'where':{'id':_0x19190b[_0x1c8f('0x70')]['id']}},_0x2a705b,_0x577dae,_0x2c11da,_0x495036,_0x4f9d31;_0x5f3f6c=_[_0x1c8f('0x40')]({},_0x5f3f6c,_0x19190b['options']);return db[_0x1c8f('0x44')]['find'](_0x5f3f6c)[_0x1c8f('0x27')](function(_0xdb57be){if(_0xdb57be){_0x2a705b=_0xdb57be;return _0xdb57be[_0x1c8f('0x71')]();}return null;})[_0x1c8f('0x27')](function(_0x2d95bf){if(_0x2d95bf){if(!_0x2d95bf[_0x1c8f('0x49')]){throw new db['Sequelize'][(_0x1c8f('0x72'))](_0x1c8f('0x73'),0x193);}_0x577dae=_0x2d95bf;return db[_0x1c8f('0x74')][_0x1c8f('0x75')]({'raw':!![]});}return null;})[_0x1c8f('0x27')](function(_0x56623f){if(_0x56623f){_0x2c11da=_[_0x1c8f('0x76')](_0x56623f,'id');var _0xa6911a;var _0x50bf08=squel[_0x1c8f('0x77')]();_0x50bf08['from'](_0x2a705b[_0x1c8f('0x78')]);for(var _0x589d91=0x0;_0x589d91<_0x577dae[_0x1c8f('0x49')];_0x589d91+=0x1){_0xa6911a=_0x577dae[_0x589d91][_0x1c8f('0x79')]?_0x2c11da[_0x577dae[_0x589d91][_0x1c8f('0x79')]][_0x1c8f('0x7a')]:_0x577dae[_0x589d91]['field'];_0xa6911a=_0x577dae[_0x589d91][_0x1c8f('0x7b')]?_['replace'](_0x3357e5[_0x577dae[_0x589d91][_0x1c8f('0x7b')]],'%s',_0xa6911a):_0xa6911a;_0xa6911a=_0x577dae[_0x589d91][_0x1c8f('0x7c')]?_[_0x1c8f('0x7d')](_0x514021[_0x577dae[_0x589d91]['format']],'%s',_0xa6911a):_0xa6911a;if(_0x577dae[_0x589d91][_0x1c8f('0x7e')]){_0x50bf08[_0x1c8f('0x6c')](_0xa6911a);}_0x577dae[_0x589d91][_0x1c8f('0x7f')]&&_0x50bf08[_0x1c8f('0x3b')](_0xa6911a,_0x577dae[_0x589d91]['orderBy']==='DESC'?![]:!![]);_0x50bf08['field'](_0xa6911a,_0x577dae[_0x589d91][_0x1c8f('0x80')]||_0xa6911a);}if(_0x2a705b['joins']){_0x2a705b[_0x1c8f('0x81')]=JSON[_0x1c8f('0x82')](_0x2a705b[_0x1c8f('0x81')]);for(var _0x18407e=0x0;_0x18407e<_0x2a705b['joins'][_0x1c8f('0x49')];_0x18407e+=0x1){if(_0x2a705b[_0x1c8f('0x81')][_0x18407e][_0x1c8f('0x31')]&&_['includes'](_0x4e26af,_0x2a705b[_0x1c8f('0x81')][_0x18407e]['type'])&&_0x2a705b[_0x1c8f('0x81')][_0x18407e][_0x1c8f('0x83')]&&_0x2a705b[_0x1c8f('0x81')][_0x18407e][_0x1c8f('0x84')]&&_0x2a705b[_0x1c8f('0x81')][_0x18407e][_0x1c8f('0x85')]){_0x50bf08[_0x2a705b[_0x1c8f('0x81')][_0x18407e][_0x1c8f('0x31')]](_0x2a705b[_0x1c8f('0x81')][_0x18407e][_0x1c8f('0x84')],null,util[_0x1c8f('0x7c')]('%s.%s\x20=\x20%s.%s',_0x2a705b['table'],_0x2a705b[_0x1c8f('0x81')][_0x18407e][_0x1c8f('0x83')],_0x2a705b[_0x1c8f('0x81')][_0x18407e][_0x1c8f('0x84')],_0x2a705b['joins'][_0x18407e]['foreignKey']));}}}if(_0x2a705b[_0x1c8f('0x86')]){_0x2a705b[_0x1c8f('0x86')]=JSON[_0x1c8f('0x82')](_0x2a705b['conditions']);_0x50bf08['where'](_0x219cbb(_0x2a705b[_0x1c8f('0x86')][_0x1c8f('0x6c')]));}_0x4f9d31=_0x50bf08[_0x1c8f('0x87')]();_0x50bf08[_0x1c8f('0x21')](_0x4aeafc);_0x50bf08['offset'](0x0);logger[_0x1c8f('0x88')](_0x1c8f('0x89'),_0x50bf08[_0x1c8f('0x8a')]());return dbH[_0x1c8f('0x8b')][_0x1c8f('0x34')](_0x50bf08[_0x1c8f('0x8a')](),{'type':dbH[_0x1c8f('0x8b')][_0x1c8f('0x8c')][_0x1c8f('0x8d')]});}})[_0x1c8f('0x27')](respondWithResult(_0x37d119,null))[_0x1c8f('0x46')](handleError(_0x37d119,null));};function runReport(_0x4a8e68,_0x157e0d,_0x130df1){var _0x569099=_0x157e0d[_0x1c8f('0x2d')];var _0x3ac4a6=0xa;var _0x18193d=[_0x1c8f('0x56'),_0x1c8f('0x57'),_0x1c8f('0x58'),_0x1c8f('0x59')];var _0x562c58={'SUM':_0x1c8f('0x5a'),'COUNT':_0x1c8f('0x5b'),'COUNT DISTINCT':_0x1c8f('0x5c'),'MAX':_0x1c8f('0x5d'),'MIN':'MIN(%s)','AVG':_0x1c8f('0x5f'),'GROUP_CONCAT':_0x1c8f('0x60'),'GROUP_CONCAT ASC':_0x1c8f('0x61'),'GROUP_CONCAT DESC':_0x1c8f('0x62')};var _0x247605={'SEC_TO_TIME':_0x1c8f('0x8e'),'DATE':_0x1c8f('0x63'),'HOUR':_0x1c8f('0x64'),'ROUND':_0x1c8f('0x65'),'UNIX_TIMESTAMP':_0x1c8f('0x66')};var _0x2a2ec5=function(_0x31b827){return!_[_0x1c8f('0x8f')](['IS\x20NULL',_0x1c8f('0x68'),_0x1c8f('0x69'),_0x1c8f('0x6a')],_0x31b827);};var _0x366434=function(_0x4195ad){if(!_0x4195ad||!_0x4195ad[_0x1c8f('0x6b')]['length']){return'';}for(var _0x214fde='(',_0x7e238e=0x0;_0x7e238e<_0x4195ad[_0x1c8f('0x6b')]['length'];_0x7e238e+=0x1){_0x7e238e>0x0&&(_0x214fde+='\x20'+_0x4195ad['operator']+'\x20');_0x214fde+=_0x4195ad['rules'][_0x7e238e][_0x1c8f('0x6c')]?_0x366434(_0x4195ad['rules'][_0x7e238e][_0x1c8f('0x6c')]):_0x4195ad['rules'][_0x7e238e][_0x1c8f('0x6d')]+'\x20'+_0x4195ad['rules'][_0x7e238e][_0x1c8f('0x6e')]+(_0x2a2ec5(_0x4195ad[_0x1c8f('0x6b')][_0x7e238e][_0x1c8f('0x6e')])?'\x20'+_0x4195ad[_0x1c8f('0x6b')][_0x7e238e]['value']:'');}return _0x214fde+')';};var _0x268752={'where':{'id':_0x4a8e68['id']}},_0x502e71,_0x8937e7,_0x258971,_0x241947,_0x608880;_0x268752=_[_0x1c8f('0x40')]({},_0x268752,_0x130df1);return db[_0x1c8f('0x44')][_0x1c8f('0x4b')](_0x268752)[_0x1c8f('0x27')](function(_0x585c6e){if(_0x585c6e){_0x502e71=_0x585c6e;return _0x585c6e[_0x1c8f('0x71')]();}return null;})[_0x1c8f('0x27')](function(_0x3a5461){if(_0x3a5461){if(!_0x3a5461[_0x1c8f('0x49')]){throw new db[(_0x1c8f('0x90'))][(_0x1c8f('0x72'))](_0x1c8f('0x73'),0x193);}_0x8937e7=_0x3a5461;return db[_0x1c8f('0x74')][_0x1c8f('0x75')]({'raw':!![]});}return null;})[_0x1c8f('0x27')](function(_0x3d2ee5){if(_0x3d2ee5){_0x258971=_[_0x1c8f('0x76')](_0x3d2ee5,'id');var _0x2d53b7;var _0x5ab53a=squel[_0x1c8f('0x77')]();_0x5ab53a['from'](_0x502e71[_0x1c8f('0x78')]);for(var _0x3d588d=0x0;_0x3d588d<_0x8937e7['length'];_0x3d588d+=0x1){_0x2d53b7=_0x8937e7[_0x3d588d][_0x1c8f('0x79')]?_0x258971[_0x8937e7[_0x3d588d][_0x1c8f('0x79')]][_0x1c8f('0x7a')]:_0x8937e7[_0x3d588d]['field'];_0x2d53b7=_0x8937e7[_0x3d588d][_0x1c8f('0x7b')]?_[_0x1c8f('0x7d')](_0x562c58[_0x8937e7[_0x3d588d][_0x1c8f('0x7b')]],'%s',_0x2d53b7):_0x2d53b7;_0x2d53b7=_0x8937e7[_0x3d588d][_0x1c8f('0x7c')]?_[_0x1c8f('0x7d')](_0x247605[_0x8937e7[_0x3d588d]['format']],'%s',_0x2d53b7):_0x2d53b7;if(_0x8937e7[_0x3d588d][_0x1c8f('0x7e')]){_0x5ab53a[_0x1c8f('0x6c')](_0x2d53b7);}_0x8937e7[_0x3d588d][_0x1c8f('0x7f')]&&_0x5ab53a[_0x1c8f('0x3b')](_0x2d53b7,_0x8937e7[_0x3d588d][_0x1c8f('0x7f')]===_0x1c8f('0x91')?![]:!![]);_0x5ab53a[_0x1c8f('0x6d')](_0x2d53b7,_0x8937e7[_0x3d588d][_0x1c8f('0x80')]||_0x2d53b7);}if(_0x502e71[_0x1c8f('0x81')]){_0x502e71[_0x1c8f('0x81')]=JSON[_0x1c8f('0x82')](_0x502e71['joins']);for(var _0x2dc75=0x0;_0x2dc75<_0x502e71[_0x1c8f('0x81')]['length'];_0x2dc75+=0x1){if(_0x502e71[_0x1c8f('0x81')][_0x2dc75][_0x1c8f('0x31')]&&_['includes'](_0x18193d,_0x502e71['joins'][_0x2dc75][_0x1c8f('0x31')])&&_0x502e71['joins'][_0x2dc75][_0x1c8f('0x83')]&&_0x502e71[_0x1c8f('0x81')][_0x2dc75][_0x1c8f('0x84')]&&_0x502e71['joins'][_0x2dc75][_0x1c8f('0x85')]){_0x5ab53a[_0x502e71[_0x1c8f('0x81')][_0x2dc75]['type']](_0x502e71['joins'][_0x2dc75][_0x1c8f('0x84')],null,util[_0x1c8f('0x7c')](_0x1c8f('0x92'),_0x502e71[_0x1c8f('0x78')],_0x502e71['joins'][_0x2dc75][_0x1c8f('0x83')],_0x502e71[_0x1c8f('0x81')][_0x2dc75][_0x1c8f('0x84')],_0x502e71['joins'][_0x2dc75][_0x1c8f('0x85')]));}}}if(_0x502e71[_0x1c8f('0x86')]){_0x502e71[_0x1c8f('0x86')]=JSON[_0x1c8f('0x82')](_0x502e71[_0x1c8f('0x86')]);_0x5ab53a['where'](_0x366434(_0x502e71[_0x1c8f('0x86')][_0x1c8f('0x6c')]));}_0x608880=_0x5ab53a['clone']();_0x5ab53a[_0x1c8f('0x21')](_0x3ac4a6);_0x5ab53a[_0x1c8f('0x1f')](0x0);return;}})[_0x1c8f('0x27')](function(){if(_0x157e0d[_0x1c8f('0x93')]===_0x1c8f('0x94')){return null;}var _0x41f5e8=_['merge'](_0x157e0d,{'name':_0x157e0d[_0x1c8f('0x95')]||_0x157e0d[_0x1c8f('0x2d')]||_0x502e71['name'],'basename':_0x569099,'savename':util[_0x1c8f('0x7c')]('%s-%s.%s',_0x157e0d[_0x1c8f('0x2d')]||_0x502e71['name'],require(_0x1c8f('0x96'))[_0x1c8f('0x97')](0x4),_0x157e0d['output']||_0x1c8f('0x98')),'reportId':_0x502e71['id'],'reportType':_0x1c8f('0x99')});return db['AnalyticExtractedReport'][_0x1c8f('0x4c')](_0x41f5e8,{'raw':!![]});})[_0x1c8f('0x27')](function(_0xaefd39){if(_0x502e71[_0x1c8f('0x78')]===_0x1c8f('0x9a')){_0x608880[_0x1c8f('0x3d')](_0x502e71['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x157e0d['startDate'],_0x157e0d[_0x1c8f('0x9b')]);}else{_0x608880[_0x1c8f('0x3d')](_0x502e71[_0x1c8f('0x78')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x157e0d[_0x1c8f('0x9c')],_0x157e0d['endDate']);}if(_0xaefd39){logger[_0x1c8f('0x9d')](_0x1c8f('0x9e'),_0x608880['toString']());require(_0x1c8f('0x9f'))['fork'](path[_0x1c8f('0x56')](__dirname,_0x1c8f('0xa0'),_0xaefd39[_0x1c8f('0x93')]),[_0xaefd39['id'],_0x608880[_0x1c8f('0x8a')](),path[_0x1c8f('0x56')](__dirname,'../../files/reports',_0xaefd39[_0x1c8f('0xa1')]),_0x569099]);return _0xaefd39;}else{var _0x476349=squel[_0x1c8f('0x77')]();_0x476349[_0x1c8f('0xa2')]('('+_0x608880['toString']()+')',_0x1c8f('0xa3'));_0x476349['field'](_0x1c8f('0xa4'),_0x1c8f('0x22'));_0x608880[_0x1c8f('0x21')](_0x157e0d[_0x1c8f('0x21')]||_0x3ac4a6);_0x608880[_0x1c8f('0x1f')](_0x157e0d[_0x1c8f('0x1f')]||0x0);return dbH[_0x1c8f('0x8b')]['query'](_0x476349['toString'](),{'type':dbH['sequelize'][_0x1c8f('0x8c')]['SELECT']})[_0x1c8f('0x27')](function(_0x170c57){if(!_0x170c57[_0x1c8f('0x49')]){_0x241947=0x0;}else{_0x241947=_0x170c57[0x0]['count']||0x0;}return dbH[_0x1c8f('0x8b')][_0x1c8f('0x34')](_0x608880['toString'](),{'type':dbH[_0x1c8f('0x8b')][_0x1c8f('0x8c')][_0x1c8f('0x8d')]});})[_0x1c8f('0x27')](function(_0x1a844a){return{'rows':_0x1a844a||[],'count':_0x241947};});}});}exports[_0x1c8f('0xa5')]=function(_0x534c6d,_0xdb7593){return runReport(_0x534c6d[_0x1c8f('0x70')],_0x534c6d['query'],_0x534c6d['options'])[_0x1c8f('0x27')](respondWithResult(_0xdb7593,null))[_0x1c8f('0x46')](handleError(_0xdb7593,null));};exports[_0x1c8f('0xa6')]=runReport;exports[_0x1c8f('0x34')]=function(_0x3bf2de,_0x3f0457){var _0x21b8fa=0xa;var _0x4d30c5=['join',_0x1c8f('0x57'),_0x1c8f('0x58'),_0x1c8f('0x59')];var _0x48df6c={'SUM':'SUM(%s)','COUNT':_0x1c8f('0x5b'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x1c8f('0x5d'),'MIN':_0x1c8f('0x5e'),'AVG':_0x1c8f('0x5f'),'GROUP_CONCAT':_0x1c8f('0x60'),'GROUP_CONCAT ASC':_0x1c8f('0x61'),'GROUP_CONCAT DESC':_0x1c8f('0x62')};var _0x47d691={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x1c8f('0x63'),'HOUR':_0x1c8f('0x64'),'ROUND':_0x1c8f('0x65'),'UNIX_TIMESTAMP':_0x1c8f('0x66')};var _0x4eb4f2=function(_0x1c877d){return!_['includes']([_0x1c8f('0x67'),_0x1c8f('0x68'),_0x1c8f('0x69'),_0x1c8f('0x6a')],_0x1c877d);};var _0x5290ff=function(_0x56e423){if(!_0x56e423||!_0x56e423['rules']['length']){return'';}for(var _0x3adfe3='(',_0xd04fb6=0x0;_0xd04fb6<_0x56e423[_0x1c8f('0x6b')][_0x1c8f('0x49')];_0xd04fb6+=0x1){_0xd04fb6>0x0&&(_0x3adfe3+='\x20'+_0x56e423['operator']+'\x20');_0x3adfe3+=_0x56e423['rules'][_0xd04fb6]['group']?_0x5290ff(_0x56e423[_0x1c8f('0x6b')][_0xd04fb6][_0x1c8f('0x6c')]):_0x56e423[_0x1c8f('0x6b')][_0xd04fb6]['field']+'\x20'+_0x56e423['rules'][_0xd04fb6][_0x1c8f('0x6e')]+(_0x4eb4f2(_0x56e423[_0x1c8f('0x6b')][_0xd04fb6][_0x1c8f('0x6e')])?'\x20'+_0x56e423['rules'][_0xd04fb6]['value']:'');}return _0x3adfe3+')';};var _0x32db2f={'where':{'id':_0x3bf2de['params']['id']}},_0x3d43b0,_0x2df251,_0x56b5e4,_0x5c535e,_0x46895d;_0x32db2f=_[_0x1c8f('0x40')]({},_0x32db2f,_0x3bf2de[_0x1c8f('0x42')]);return db[_0x1c8f('0x44')]['find'](_0x32db2f)['then'](function(_0x5316b7){if(_0x5316b7){_0x3d43b0=_0x5316b7;return _0x5316b7[_0x1c8f('0x71')]();}return null;})[_0x1c8f('0x27')](function(_0x182b37){if(_0x182b37){if(!_0x182b37[_0x1c8f('0x49')]){throw new db[(_0x1c8f('0x90'))][(_0x1c8f('0x72'))](_0x1c8f('0x73'),0x193);}_0x2df251=_0x182b37;return db[_0x1c8f('0x74')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x2ea4fc){if(_0x2ea4fc){_0x56b5e4=_['keyBy'](_0x2ea4fc,'id');var _0x1a086f;var _0x51a42f=squel['select']();_0x51a42f[_0x1c8f('0xa2')](_0x3d43b0['table']);for(var _0x540284=0x0;_0x540284<_0x2df251[_0x1c8f('0x49')];_0x540284+=0x1){_0x1a086f=_0x2df251[_0x540284][_0x1c8f('0x79')]?_0x56b5e4[_0x2df251[_0x540284]['MetricId']][_0x1c8f('0x7a')]:_0x2df251[_0x540284][_0x1c8f('0x6d')];_0x1a086f=_0x2df251[_0x540284]['function']?_[_0x1c8f('0x7d')](_0x48df6c[_0x2df251[_0x540284][_0x1c8f('0x7b')]],'%s',_0x1a086f):_0x1a086f;_0x1a086f=_0x2df251[_0x540284][_0x1c8f('0x7c')]?_[_0x1c8f('0x7d')](_0x47d691[_0x2df251[_0x540284][_0x1c8f('0x7c')]],'%s',_0x1a086f):_0x1a086f;if(_0x2df251[_0x540284][_0x1c8f('0x7e')]){_0x51a42f[_0x1c8f('0x6c')](_0x1a086f);}_0x2df251[_0x540284][_0x1c8f('0x7f')]&&_0x51a42f['order'](_0x1a086f,_0x2df251[_0x540284][_0x1c8f('0x7f')]===_0x1c8f('0x91')?![]:!![]);_0x51a42f[_0x1c8f('0x6d')](_0x1a086f,_0x2df251[_0x540284]['alias']||_0x1a086f);}if(_0x3d43b0[_0x1c8f('0x81')]){_0x3d43b0[_0x1c8f('0x81')]=JSON[_0x1c8f('0x82')](_0x3d43b0[_0x1c8f('0x81')]);for(var _0x36417f=0x0;_0x36417f<_0x3d43b0[_0x1c8f('0x81')]['length'];_0x36417f+=0x1){if(_0x3d43b0[_0x1c8f('0x81')][_0x36417f][_0x1c8f('0x31')]&&_['includes'](_0x4d30c5,_0x3d43b0[_0x1c8f('0x81')][_0x36417f][_0x1c8f('0x31')])&&_0x3d43b0['joins'][_0x36417f][_0x1c8f('0x83')]&&_0x3d43b0['joins'][_0x36417f][_0x1c8f('0x84')]&&_0x3d43b0['joins'][_0x36417f]['foreignKey']){_0x51a42f[_0x3d43b0[_0x1c8f('0x81')][_0x36417f][_0x1c8f('0x31')]](_0x3d43b0['joins'][_0x36417f][_0x1c8f('0x84')],null,util['format'](_0x1c8f('0x92'),_0x3d43b0[_0x1c8f('0x78')],_0x3d43b0[_0x1c8f('0x81')][_0x36417f][_0x1c8f('0x83')],_0x3d43b0['joins'][_0x36417f][_0x1c8f('0x84')],_0x3d43b0[_0x1c8f('0x81')][_0x36417f]['foreignKey']));}}}if(_0x3d43b0[_0x1c8f('0x86')]){_0x3d43b0[_0x1c8f('0x86')]=JSON[_0x1c8f('0x82')](_0x3d43b0[_0x1c8f('0x86')]);_0x51a42f[_0x1c8f('0x3d')](_0x5290ff(_0x3d43b0[_0x1c8f('0x86')]['group']));}_0x46895d=_0x51a42f[_0x1c8f('0x87')]();_0x51a42f[_0x1c8f('0x21')](_0x21b8fa);_0x51a42f['offset'](0x0);logger[_0x1c8f('0x88')]('Limited\x20Query:',_0x51a42f[_0x1c8f('0x8a')]());return dbH['sequelize'][_0x1c8f('0x34')](_0x51a42f[_0x1c8f('0x8a')](),{'type':dbH[_0x1c8f('0x8b')][_0x1c8f('0x8c')][_0x1c8f('0x8d')]});}})[_0x1c8f('0x27')](function(){return{'sql':_0x46895d[_0x1c8f('0x8a')]()};})[_0x1c8f('0x27')](respondWithResult(_0x3f0457,null))['catch'](handleError(_0x3f0457,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 9d9a8ec..5038fec 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 _0xfac0=['moment','bluebird','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','define','analytics_custom_reports','lodash','util','../../config/logger','api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfac0,0xb0));var _0x0fac=function(_0x599307,_0x283e19){_0x599307=_0x599307-0x0;var _0x456e02=_0xfac0[_0x599307];return _0x456e02;};'use strict';var _=require(_0x0fac('0x0'));var util=require(_0x0fac('0x1'));var logger=require(_0x0fac('0x2'))(_0x0fac('0x3'));var moment=require(_0x0fac('0x4'));var BPromise=require(_0x0fac('0x5'));var rp=require(_0x0fac('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fac('0x7'));var config=require(_0x0fac('0x8'));var attributes=require(_0x0fac('0x9'));module['exports']=function(_0x24835b,_0x29407a){return _0x24835b[_0x0fac('0xa')]('AnalyticCustomReport',attributes,{'tableName':_0x0fac('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa41=['../../config/logger','bluebird','rimraf','./analyticCustomReport.attributes','exports','AnalyticCustomReport','analytics_custom_reports','lodash','util'];(function(_0x45f2a1,_0x525cbe){var _0x2b9912=function(_0x547f07){while(--_0x547f07){_0x45f2a1['push'](_0x45f2a1['shift']());}};_0x2b9912(++_0x525cbe);}(_0xaa41,0x1db));var _0x1aa4=function(_0x47c428,_0x35f4ff){_0x47c428=_0x47c428-0x0;var _0x479f21=_0xaa41[_0x47c428];return _0x479f21;};'use strict';var _=require(_0x1aa4('0x0'));var util=require(_0x1aa4('0x1'));var logger=require(_0x1aa4('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1aa4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1aa4('0x4'));var config=require('../../config/environment');var attributes=require(_0x1aa4('0x5'));module[_0x1aa4('0x6')]=function(_0x51b656,_0x5b1d59){return _0x51b656['define'](_0x1aa4('0x7'),attributes,{'tableName':_0x1aa4('0x8'),'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 94ac255..e43b5e5 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 _0xc6d2=['rpc','jayson/promise','client','http','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x2c1a16,_0x2e0cb4){var _0x51c0cf=function(_0x41e796){while(--_0x41e796){_0x2c1a16['push'](_0x2c1a16['shift']());}};_0x51c0cf(++_0x2e0cb4);}(_0xc6d2,0x19d));var _0x2c6d=function(_0x488acf,_0x75d657){_0x488acf=_0x488acf-0x0;var _0x43cb14=_0xc6d2[_0x488acf];return _0x43cb14;};'use strict';var _=require(_0x2c6d('0x0'));var util=require(_0x2c6d('0x1'));var moment=require(_0x2c6d('0x2'));var BPromise=require(_0x2c6d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c6d('0x4'));var db=require(_0x2c6d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2c6d('0x6'))(_0x2c6d('0x7'));var config=require('../../config/environment');var jayson=require(_0x2c6d('0x8'));var client=jayson[_0x2c6d('0x9')][_0x2c6d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2413d8,_0x2bfe81,_0x2ac9ee){return new BPromise(function(_0x24d703,_0x41d86b){return client['request'](_0x2413d8,_0x2ac9ee)['then'](function(_0x586cf8){logger['info'](_0x2c6d('0xb'),_0x2bfe81,'request\x20sent');logger[_0x2c6d('0xc')](_0x2c6d('0xd'),_0x2bfe81,_0x2c6d('0xe'),JSON[_0x2c6d('0xf')](_0x586cf8));if(_0x586cf8['error']){if(_0x586cf8[_0x2c6d('0x10')][_0x2c6d('0x11')]===0x1f4){logger['error'](_0x2c6d('0xb'),_0x2bfe81,_0x586cf8[_0x2c6d('0x10')]['message']);return _0x41d86b(_0x586cf8['error'][_0x2c6d('0x12')]);}logger[_0x2c6d('0x10')](_0x2c6d('0xb'),_0x2bfe81,_0x586cf8[_0x2c6d('0x10')]['message']);return _0x24d703(_0x586cf8[_0x2c6d('0x10')][_0x2c6d('0x12')]);}else{logger[_0x2c6d('0x13')](_0x2c6d('0xb'),_0x2bfe81,_0x2c6d('0xe'));_0x24d703(_0x586cf8[_0x2c6d('0x14')]['message']);}})['catch'](function(_0x36822d){logger[_0x2c6d('0x10')](_0x2c6d('0xb'),_0x2bfe81,_0x36822d);_0x41d86b(_0x36822d);});});} \ No newline at end of file +var _0x7aa6=['../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x1f6465,_0x284abc){var _0x4b5cde=function(_0x1188be){while(--_0x1188be){_0x1f6465['push'](_0x1f6465['shift']());}};_0x4b5cde(++_0x284abc);}(_0x7aa6,0x1c0));var _0x67aa=function(_0xe1c489,_0x31d858){_0xe1c489=_0xe1c489-0x0;var _0xc5ec08=_0x7aa6[_0xe1c489];return _0xc5ec08;};'use strict';var _=require(_0x67aa('0x0'));var util=require(_0x67aa('0x1'));var moment=require(_0x67aa('0x2'));var BPromise=require('bluebird');var rs=require(_0x67aa('0x3'));var fs=require('fs');var Redis=require(_0x67aa('0x4'));var db=require(_0x67aa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x67aa('0x6'))(_0x67aa('0x7'));var config=require(_0x67aa('0x8'));var jayson=require(_0x67aa('0x9'));var client=jayson[_0x67aa('0xa')][_0x67aa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7d6e91,_0xd00555,_0x448ce5){return new BPromise(function(_0x2b95ee,_0xbda886){return client[_0x67aa('0xc')](_0x7d6e91,_0x448ce5)[_0x67aa('0xd')](function(_0x1b6cd7){logger[_0x67aa('0xe')](_0x67aa('0xf'),_0xd00555,'request\x20sent');logger[_0x67aa('0x10')](_0x67aa('0x11'),_0xd00555,_0x67aa('0x12'),JSON['stringify'](_0x1b6cd7));if(_0x1b6cd7[_0x67aa('0x13')]){if(_0x1b6cd7[_0x67aa('0x13')][_0x67aa('0x14')]===0x1f4){logger['error'](_0x67aa('0xf'),_0xd00555,_0x1b6cd7[_0x67aa('0x13')][_0x67aa('0x15')]);return _0xbda886(_0x1b6cd7[_0x67aa('0x13')][_0x67aa('0x15')]);}logger[_0x67aa('0x13')](_0x67aa('0xf'),_0xd00555,_0x1b6cd7[_0x67aa('0x13')][_0x67aa('0x15')]);return _0x2b95ee(_0x1b6cd7['error']['message']);}else{logger['info'](_0x67aa('0xf'),_0xd00555,'request\x20sent');_0x2b95ee(_0x1b6cd7[_0x67aa('0x16')][_0x67aa('0x15')]);}})[_0x67aa('0x17')](function(_0x57bfc1){logger[_0x67aa('0x13')](_0x67aa('0xf'),_0xd00555,_0x57bfc1);_0xbda886(_0x57bfc1);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 90bdd86..0464bea 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 _0x0112=['query','post','create','update','delete','destroy','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','index','get','/:id','show','/:id/preview','preview','/:id/run','isAuthenticated','run'];(function(_0x3035d2,_0x477534){var _0x32ad0e=function(_0x1e53f1){while(--_0x1e53f1){_0x3035d2['push'](_0x3035d2['shift']());}};_0x32ad0e(++_0x477534);}(_0x0112,0xd6));var _0x2011=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x0112[_0x42245d];return _0x4b211a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2011('0x0'));var timeout=require('connect-timeout');var express=require(_0x2011('0x1'));var router=express[_0x2011('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2011('0x3'));var interaction=require(_0x2011('0x4'));var config=require(_0x2011('0x5'));var controller=require(_0x2011('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x2011('0x7')]);router[_0x2011('0x8')](_0x2011('0x9'),auth['isAuthenticated'](),controller[_0x2011('0xa')]);router['get'](_0x2011('0xb'),auth['isAuthenticated'](),controller[_0x2011('0xc')]);router[_0x2011('0x8')](_0x2011('0xd'),auth[_0x2011('0xe')](),controller[_0x2011('0xf')]);router[_0x2011('0x8')]('/:id/query',auth['isAuthenticated'](),controller[_0x2011('0x10')]);router[_0x2011('0x11')]('/',auth[_0x2011('0xe')](),controller[_0x2011('0x12')]);router['put'](_0x2011('0x9'),auth['isAuthenticated'](),controller[_0x2011('0x13')]);router[_0x2011('0x14')](_0x2011('0x9'),auth[_0x2011('0xe')](),controller[_0x2011('0x15')]);module[_0x2011('0x16')]=router; \ No newline at end of file +var _0xdb05=['/:id','isAuthenticated','show','get','/:id/preview','/:id/run','run','/:id/query','query','post','create','update','destroy','exports','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller'];(function(_0x491ed3,_0x2eb2e8){var _0x329b50=function(_0x46ca66){while(--_0x46ca66){_0x491ed3['push'](_0x491ed3['shift']());}};_0x329b50(++_0x2eb2e8);}(_0xdb05,0x188));var _0x5db0=function(_0x496623,_0x39258e){_0x496623=_0x496623-0x0;var _0xb8480=_0xdb05[_0x496623];return _0xb8480;};'use strict';var multer=require('multer');var util=require(_0x5db0('0x0'));var path=require('path');var timeout=require(_0x5db0('0x1'));var express=require(_0x5db0('0x2'));var router=express['Router']();var fs_extra=require(_0x5db0('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5db0('0x4'));var config=require(_0x5db0('0x5'));var controller=require(_0x5db0('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x5db0('0x7'),auth[_0x5db0('0x8')](),controller[_0x5db0('0x9')]);router[_0x5db0('0xa')](_0x5db0('0xb'),auth['isAuthenticated'](),controller['preview']);router[_0x5db0('0xa')](_0x5db0('0xc'),auth[_0x5db0('0x8')](),controller[_0x5db0('0xd')]);router[_0x5db0('0xa')](_0x5db0('0xe'),auth[_0x5db0('0x8')](),controller[_0x5db0('0xf')]);router[_0x5db0('0x10')]('/',auth[_0x5db0('0x8')](),controller[_0x5db0('0x11')]);router['put'](_0x5db0('0x7'),auth[_0x5db0('0x8')](),controller[_0x5db0('0x12')]);router['delete'](_0x5db0('0x7'),auth[_0x5db0('0x8')](),controller[_0x5db0('0x13')]);module[_0x5db0('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index c79255e..5fe9c31 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 _0xfdbd=['sequelize','exports','STRING','TEXT'];(function(_0x516ffb,_0x5b5b42){var _0x319667=function(_0x250098){while(--_0x250098){_0x516ffb['push'](_0x516ffb['shift']());}};_0x319667(++_0x5b5b42);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x111e94,_0x31c837){_0x111e94=_0x111e94-0x0;var _0x3de107=_0xfdbd[_0x111e94];return _0x3de107;};'use strict';var Sequelize=require(_0xdfdb('0x0'));module[_0xdfdb('0x1')]={'name':{'type':Sequelize[_0xdfdb('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdfdb('0x2')]},'parent':{'type':Sequelize[_0xdfdb('0x2')]},'table':{'type':Sequelize[_0xdfdb('0x2')]},'conditions':{'type':Sequelize[_0xdfdb('0x3')]},'joins':{'type':Sequelize[_0xdfdb('0x3')]}}; \ No newline at end of file +var _0xeda8=['sequelize','exports','STRING','TEXT'];(function(_0xe0b636,_0x5085f6){var _0xfb52fd=function(_0x2fbde7){while(--_0x2fbde7){_0xe0b636['push'](_0xe0b636['shift']());}};_0xfb52fd(++_0x5085f6);}(_0xeda8,0x104));var _0x8eda=function(_0x377867,_0x4c08aa){_0x377867=_0x377867-0x0;var _0x1a6433=_0xeda8[_0x377867];return _0x1a6433;};'use strict';var Sequelize=require(_0x8eda('0x0'));module[_0x8eda('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8eda('0x2')]},'parent':{'type':Sequelize[_0x8eda('0x2')]},'table':{'type':Sequelize[_0x8eda('0x2')]},'conditions':{'type':Sequelize[_0x8eda('0x3')]},'joins':{'type':Sequelize[_0x8eda('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 9bf6dae..de4427d 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 _0x326f=['order','orderBy','DESC','joins','foreignTable','foreignKey','parentKey','conditions','Limited\x20Query:','toString','sequelize','SELECT','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','UNIX_TIMESTAMP(%s)','operator','AnalyticMetric','select','from','function','parse','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','child_process','fork','join','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','SEC_TO_TIME(%s)','debug','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','count','apply','update','then','get','DefaultReports','UserProfileResource','destroy','end','error','name','send','index','map','AnalyticDefaultReport','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','keys','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','left_join','right_join','cross_join','COUNT(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','table','MetricId','metric','format','replace','groupBy'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x326f,0xd1));var _0xf326=function(_0x2aa7a9,_0x22d909){_0x2aa7a9=_0x2aa7a9-0x0;var _0x2708d8=_0x326f[_0x2aa7a9];return _0x2708d8;};'use strict';var emlformat=require(_0xf326('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf326('0x1'));var rp=require(_0xf326('0x2'));var moment=require(_0xf326('0x3'));var BPromise=require(_0xf326('0x4'));var Mustache=require(_0xf326('0x5'));var util=require(_0xf326('0x6'));var path=require(_0xf326('0x7'));var sox=require(_0xf326('0x8'));var csv=require(_0xf326('0x9'));var ejs=require(_0xf326('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var as=require(_0xf326('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf326('0x14'))('api');var utils=require(_0xf326('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf326('0x16'));var db=require('../../mysqldb')['db'];var dbH=require(_0xf326('0x17'))[_0xf326('0x18')];function respondWithStatusCode(_0x4b3966,_0x342fe5){_0x342fe5=_0x342fe5||0xcc;return function(_0x472632){if(_0x472632){return _0x4b3966[_0xf326('0x19')](_0x342fe5);}return _0x4b3966[_0xf326('0x1a')](_0x342fe5)['end']();};}function respondWithResult(_0x45c1b6,_0x5204ee){_0x5204ee=_0x5204ee||0xc8;return function(_0x54bd1a){if(_0x54bd1a){return _0x45c1b6[_0xf326('0x1a')](_0x5204ee)[_0xf326('0x1b')](_0x54bd1a);}};}function respondWithFilteredResult(_0x1f2e5a,_0xa63d1a){return function(_0x292f4b){if(_0x292f4b){var _0x287a2a=typeof _0xa63d1a[_0xf326('0x1c')]===_0xf326('0x1d')&&typeof _0xa63d1a['limit']===_0xf326('0x1d');var _0x453100=_0x292f4b[_0xf326('0x1e')];var _0x31ffb9=_0x287a2a?0x0:_0xa63d1a[_0xf326('0x1c')];var _0x311af0=_0x287a2a?_0x292f4b['count']:_0xa63d1a['offset']+_0xa63d1a['limit'];var _0x16e605;if(_0x311af0>=_0x453100){_0x311af0=_0x453100;_0x16e605=0xc8;}else{_0x16e605=0xce;}_0x1f2e5a[_0xf326('0x1a')](_0x16e605);return _0x1f2e5a['set']('Content-Range',_0x31ffb9+'-'+_0x311af0+'/'+_0x453100)[_0xf326('0x1b')](_0x292f4b);}return null;};}function patchUpdates(_0x4dfa76){return function(_0x5b6d3c){try{jsonpatch[_0xf326('0x1f')](_0x5b6d3c,_0x4dfa76,!![]);}catch(_0x18ead3){return BPromise['reject'](_0x18ead3);}return _0x5b6d3c['save']();};}function saveUpdates(_0x19b8ba,_0xb1efcf){return function(_0x5f21a2){if(_0x5f21a2){return _0x5f21a2[_0xf326('0x20')](_0x19b8ba)[_0xf326('0x21')](function(_0x43c53e){return _0x43c53e;});}return null;};}function removeEntity(_0x295752,_0x17c157){return function(_0x2049ec){if(_0x2049ec){return _0x2049ec['destroy']()['then'](function(){var _0x4f31f6=_0x2049ec[_0xf326('0x22')]({'plain':!![]});var _0x1a2c4e=_0xf326('0x23');return db[_0xf326('0x24')][_0xf326('0x25')]({'where':{'type':_0x1a2c4e,'resourceId':_0x4f31f6['id']}})[_0xf326('0x21')](function(){return _0x2049ec;});})['then'](function(){_0x295752[_0xf326('0x1a')](0xcc)[_0xf326('0x26')]();});}};}function handleEntityNotFound(_0x212d5d,_0x581531){return function(_0x1617d2){if(!_0x1617d2){_0x212d5d['sendStatus'](0x194);}return _0x1617d2;};}function handleError(_0x4a9abf,_0x6a8e89){_0x6a8e89=_0x6a8e89||0x1f4;return function(_0x1ae23a){logger[_0xf326('0x27')](_0x1ae23a['stack']);if(_0x1ae23a[_0xf326('0x28')]){delete _0x1ae23a[_0xf326('0x28')];}_0x4a9abf['status'](_0x6a8e89)[_0xf326('0x29')](_0x1ae23a);};}exports[_0xf326('0x2a')]=function(_0xd77aba,_0x18d110){var _0xa80156={},_0x269be9={},_0x161143={'count':0x0,'rows':[]};var _0x39a1e2=_[_0xf326('0x2b')](db[_0xf326('0x2c')]['rawAttributes'],function(_0x1035ed){return{'name':_0x1035ed[_0xf326('0x2d')],'type':_0x1035ed[_0xf326('0x2e')]['key']};});_0x269be9[_0xf326('0x2f')]=_[_0xf326('0x2b')](_0x39a1e2,_0xf326('0x28'));_0x269be9['query']=_['keys'](_0xd77aba[_0xf326('0x30')]);_0x269be9[_0xf326('0x31')]=_[_0xf326('0x32')](_0x269be9[_0xf326('0x2f')],_0x269be9[_0xf326('0x30')]);_0xa80156[_0xf326('0x33')]=_[_0xf326('0x32')](_0x269be9[_0xf326('0x2f')],qs['fields'](_0xd77aba[_0xf326('0x30')][_0xf326('0x34')]));_0xa80156['attributes']=_0xa80156[_0xf326('0x33')]['length']?_0xa80156[_0xf326('0x33')]:_0x269be9['model'];if(!_0xd77aba['query'][_0xf326('0x35')]('nolimit')){_0xa80156[_0xf326('0x36')]=qs['limit'](_0xd77aba[_0xf326('0x30')][_0xf326('0x36')]);_0xa80156[_0xf326('0x1c')]=qs['offset'](_0xd77aba[_0xf326('0x30')][_0xf326('0x1c')]);}_0xa80156['order']=qs[_0xf326('0x37')](_0xd77aba[_0xf326('0x30')][_0xf326('0x37')]);_0xa80156[_0xf326('0x38')]=qs['filters'](_[_0xf326('0x39')](_0xd77aba[_0xf326('0x30')],_0x269be9[_0xf326('0x31')]),_0x39a1e2);if(_0xd77aba[_0xf326('0x30')][_0xf326('0x3a')]){_0xa80156['where']=_[_0xf326('0x3b')](_0xa80156[_0xf326('0x38')],{'$or':_['map'](_0x39a1e2,function(_0x4dd361){if(_0x4dd361[_0xf326('0x2e')]!=='VIRTUAL'){var _0x55dfa8={};_0x55dfa8[_0x4dd361[_0xf326('0x28')]]={'$like':'%'+_0xd77aba['query'][_0xf326('0x3a')]+'%'};return _0x55dfa8;}})});}_0xa80156=_[_0xf326('0x3b')]({},_0xa80156,_0xd77aba[_0xf326('0x3c')]);var _0x39611e={'where':_0xa80156['where']};return db[_0xf326('0x2c')][_0xf326('0x1e')](_0x39611e)[_0xf326('0x21')](function(_0x365627){_0x161143[_0xf326('0x1e')]=_0x365627;if(_0xd77aba[_0xf326('0x30')][_0xf326('0x3d')]){_0xa80156[_0xf326('0x3e')]=[{'all':!![]}];}return db[_0xf326('0x2c')][_0xf326('0x3f')](_0xa80156);})[_0xf326('0x21')](function(_0x2bab13){_0x161143['rows']=_0x2bab13;return _0x161143;})[_0xf326('0x21')](respondWithFilteredResult(_0x18d110,_0xa80156))[_0xf326('0x40')](handleError(_0x18d110,null));};exports[_0xf326('0x41')]=function(_0x270288,_0x1dd262){var _0x1a2d0d={'raw':!![],'where':{'id':_0x270288[_0xf326('0x42')]['id']}},_0x4f4c51={};_0x4f4c51[_0xf326('0x2f')]=_['keys'](db[_0xf326('0x2c')][_0xf326('0x43')]);_0x4f4c51[_0xf326('0x30')]=_[_0xf326('0x44')](_0x270288[_0xf326('0x30')]);_0x4f4c51['filters']=_['intersection'](_0x4f4c51[_0xf326('0x2f')],_0x4f4c51[_0xf326('0x30')]);_0x1a2d0d['attributes']=_['intersection'](_0x4f4c51[_0xf326('0x2f')],qs[_0xf326('0x34')](_0x270288[_0xf326('0x30')]['fields']));_0x1a2d0d[_0xf326('0x33')]=_0x1a2d0d[_0xf326('0x33')][_0xf326('0x45')]?_0x1a2d0d[_0xf326('0x33')]:_0x4f4c51[_0xf326('0x2f')];if(_0x270288[_0xf326('0x30')][_0xf326('0x3d')]){_0x1a2d0d[_0xf326('0x3e')]=[{'all':!![]}];}_0x1a2d0d=_[_0xf326('0x3b')]({},_0x1a2d0d,_0x270288[_0xf326('0x3c')]);return db[_0xf326('0x2c')][_0xf326('0x46')](_0x1a2d0d)[_0xf326('0x21')](handleEntityNotFound(_0x1dd262,null))[_0xf326('0x21')](respondWithResult(_0x1dd262,null))[_0xf326('0x40')](handleError(_0x1dd262,null));};exports['create']=function(_0x199f8b,_0x1b0e03){return db[_0xf326('0x2c')][_0xf326('0x47')](_0x199f8b['body'],{})[_0xf326('0x21')](function(_0x2f5511){var _0xca88e=_0x199f8b[_0xf326('0x48')]['get']({'plain':!![]});if(!_0xca88e)throw new Error(_0xf326('0x49'));if(_0xca88e[_0xf326('0x4a')]===_0xf326('0x48')){var _0x451ac7=_0x2f5511[_0xf326('0x22')]({'plain':!![]});var _0x4970fb='Reports';return db[_0xf326('0x4b')][_0xf326('0x46')]({'where':{'name':_0x4970fb,'userProfileId':_0xca88e[_0xf326('0x4c')]},'raw':!![]})['then'](function(_0x102fba){if(_0x102fba&&_0x102fba[_0xf326('0x4d')]===0x0){return db[_0xf326('0x24')]['create']({'name':_0x451ac7['name'],'resourceId':_0x451ac7['id'],'type':_0xf326('0x23'),'sectionId':_0x102fba['id']},{})['then'](function(){return _0x2f5511;});}else{return _0x2f5511;}})[_0xf326('0x40')](function(_0x554277){logger[_0xf326('0x27')](_0xf326('0x4e'),_0x554277);throw _0x554277;});}return _0x2f5511;})[_0xf326('0x21')](respondWithResult(_0x1b0e03,0xc9))[_0xf326('0x40')](handleError(_0x1b0e03,null));};exports[_0xf326('0x20')]=function(_0x35d3c8,_0x7f7ece){if(_0x35d3c8['body']['id']){delete _0x35d3c8[_0xf326('0x4f')]['id'];}return db[_0xf326('0x2c')][_0xf326('0x46')]({'where':{'id':_0x35d3c8['params']['id']}})[_0xf326('0x21')](handleEntityNotFound(_0x7f7ece,null))[_0xf326('0x21')](saveUpdates(_0x35d3c8[_0xf326('0x4f')],null))[_0xf326('0x21')](respondWithResult(_0x7f7ece,null))[_0xf326('0x40')](handleError(_0x7f7ece,null));};exports['destroy']=function(_0x161fb3,_0x21eac7){return db[_0xf326('0x2c')][_0xf326('0x46')]({'where':{'id':_0x161fb3['params']['id']}})[_0xf326('0x21')](handleEntityNotFound(_0x21eac7,null))[_0xf326('0x21')](removeEntity(_0x21eac7,null))[_0xf326('0x40')](handleError(_0x21eac7,null));};exports[_0xf326('0x50')]=function(_0x4d3b9e,_0x5be2b1){var _0x18b46e=0xa;var _0x44d2ed=['join',_0xf326('0x51'),_0xf326('0x52'),_0xf326('0x53')];var _0x1258d1={'SUM':'SUM(%s)','COUNT':_0xf326('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xf326('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xf326('0x56'),'GROUP_CONCAT ASC':_0xf326('0x57'),'GROUP_CONCAT DESC':_0xf326('0x58')};var _0x4eef49={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf326('0x59'),'HOUR':_0xf326('0x5a'),'ROUND':_0xf326('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2759d7=function(_0x487020){return!_[_0xf326('0x5c')]([_0xf326('0x5d'),_0xf326('0x5e'),_0xf326('0x5f'),_0xf326('0x60')],_0x487020);};var _0x18dbfc=function(_0x23a9e8){if(!_0x23a9e8||!_0x23a9e8[_0xf326('0x61')][_0xf326('0x45')]){return'';}for(var _0x33f9dd='(',_0x33ffb8=0x0;_0x33ffb8<_0x23a9e8[_0xf326('0x61')][_0xf326('0x45')];_0x33ffb8+=0x1){_0x33ffb8>0x0&&(_0x33f9dd+='\x20'+_0x23a9e8['operator']+'\x20');_0x33f9dd+=_0x23a9e8[_0xf326('0x61')][_0x33ffb8]['group']?_0x18dbfc(_0x23a9e8[_0xf326('0x61')][_0x33ffb8][_0xf326('0x62')]):_0x23a9e8['rules'][_0x33ffb8][_0xf326('0x63')]+'\x20'+_0x23a9e8['rules'][_0x33ffb8][_0xf326('0x64')]+(_0x2759d7(_0x23a9e8[_0xf326('0x61')][_0x33ffb8][_0xf326('0x64')])?'\x20'+_0x23a9e8[_0xf326('0x61')][_0x33ffb8][_0xf326('0x65')]:'');}return _0x33f9dd+')';};var _0x51ff5e={'where':{'id':_0x4d3b9e[_0xf326('0x42')]['id']}},_0x4ec099,_0x1209ca,_0x32fe3a,_0x15a538,_0x21b3cc;_0x51ff5e=_['merge']({},_0x51ff5e,_0x4d3b9e[_0xf326('0x3c')]);return db[_0xf326('0x2c')]['find'](_0x51ff5e)['then'](function(_0x5b25ca){if(_0x5b25ca){_0x4ec099=_0x5b25ca;return _0x5b25ca[_0xf326('0x66')]();}return null;})[_0xf326('0x21')](function(_0x4150fa){if(_0x4150fa){if(!_0x4150fa[_0xf326('0x45')]){throw new db[(_0xf326('0x67'))][(_0xf326('0x68'))](_0xf326('0x69'),0x193);}_0x1209ca=_0x4150fa;return db['AnalyticMetric'][_0xf326('0x3f')]({'raw':!![]});}return null;})[_0xf326('0x21')](function(_0x3c3379){if(_0x3c3379){_0x32fe3a=_[_0xf326('0x6a')](_0x3c3379,'id');var _0x58de1e;var _0x3717fe=squel['select']();_0x3717fe['from'](_0x4ec099[_0xf326('0x6b')]);for(var _0x540fa0=0x0;_0x540fa0<_0x1209ca[_0xf326('0x45')];_0x540fa0+=0x1){_0x58de1e=_0x1209ca[_0x540fa0][_0xf326('0x6c')]?_0x32fe3a[_0x1209ca[_0x540fa0][_0xf326('0x6c')]][_0xf326('0x6d')]:_0x1209ca[_0x540fa0][_0xf326('0x63')];_0x58de1e=_0x1209ca[_0x540fa0]['function']?_['replace'](_0x1258d1[_0x1209ca[_0x540fa0]['function']],'%s',_0x58de1e):_0x58de1e;_0x58de1e=_0x1209ca[_0x540fa0][_0xf326('0x6e')]?_[_0xf326('0x6f')](_0x4eef49[_0x1209ca[_0x540fa0][_0xf326('0x6e')]],'%s',_0x58de1e):_0x58de1e;if(_0x1209ca[_0x540fa0][_0xf326('0x70')]){_0x3717fe[_0xf326('0x62')](_0x58de1e);}_0x1209ca[_0x540fa0]['orderBy']&&_0x3717fe[_0xf326('0x71')](_0x58de1e,_0x1209ca[_0x540fa0][_0xf326('0x72')]===_0xf326('0x73')?![]:!![]);_0x3717fe['field'](_0x58de1e,_0x1209ca[_0x540fa0]['alias']||_0x58de1e);}if(_0x4ec099[_0xf326('0x74')]){_0x4ec099[_0xf326('0x74')]=JSON['parse'](_0x4ec099['joins']);for(var _0x2497fd=0x0;_0x2497fd<_0x4ec099['joins'][_0xf326('0x45')];_0x2497fd+=0x1){if(_0x4ec099['joins'][_0x2497fd]['type']&&_['includes'](_0x44d2ed,_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x2e')])&&_0x4ec099[_0xf326('0x74')][_0x2497fd]['parentKey']&&_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x75')]&&_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x76')]){_0x3717fe[_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x2e')]](_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x75')],null,util[_0xf326('0x6e')]('%s.%s\x20=\x20%s.%s',_0x4ec099[_0xf326('0x6b')],_0x4ec099['joins'][_0x2497fd][_0xf326('0x77')],_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x75')],_0x4ec099['joins'][_0x2497fd][_0xf326('0x76')]));}}}if(_0x4ec099[_0xf326('0x78')]){_0x4ec099[_0xf326('0x78')]=JSON['parse'](_0x4ec099[_0xf326('0x78')]);_0x3717fe[_0xf326('0x38')](_0x18dbfc(_0x4ec099[_0xf326('0x78')][_0xf326('0x62')]));}_0x21b3cc=_0x3717fe['clone']();_0x3717fe[_0xf326('0x36')](_0x18b46e);_0x3717fe['offset'](0x0);logger['debug'](_0xf326('0x79'),_0x3717fe[_0xf326('0x7a')]());return dbH['sequelize']['query'](_0x3717fe['toString'](),{'type':dbH[_0xf326('0x7b')]['QueryTypes'][_0xf326('0x7c')]});}})[_0xf326('0x21')](respondWithResult(_0x5be2b1,null))[_0xf326('0x40')](handleError(_0x5be2b1,null));};function runReport(_0x2ec314,_0xf76a89,_0x25b56c){var _0x5d23f0=_0xf76a89[_0xf326('0x28')];var _0x323926=0xa;var _0x5f1724=['join',_0xf326('0x51'),'right_join',_0xf326('0x53')];var _0x147d51={'SUM':_0xf326('0x7d'),'COUNT':_0xf326('0x54'),'COUNT DISTINCT':_0xf326('0x7e'),'MAX':_0xf326('0x7f'),'MIN':_0xf326('0x55'),'AVG':_0xf326('0x80'),'GROUP_CONCAT':_0xf326('0x56'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xf326('0x58')};var _0x26bbb1={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf326('0x59'),'HOUR':'HOUR(%s)','ROUND':_0xf326('0x5b'),'UNIX_TIMESTAMP':_0xf326('0x81')};var _0x14e8c0=function(_0x5814ad){return!_[_0xf326('0x5c')]([_0xf326('0x5d'),_0xf326('0x5e'),_0xf326('0x5f'),_0xf326('0x60')],_0x5814ad);};var _0x1e50aa=function(_0x148779){if(!_0x148779||!_0x148779[_0xf326('0x61')][_0xf326('0x45')]){return'';}for(var _0x38b696='(',_0x384b46=0x0;_0x384b46<_0x148779[_0xf326('0x61')][_0xf326('0x45')];_0x384b46+=0x1){_0x384b46>0x0&&(_0x38b696+='\x20'+_0x148779[_0xf326('0x82')]+'\x20');_0x38b696+=_0x148779[_0xf326('0x61')][_0x384b46]['group']?_0x1e50aa(_0x148779[_0xf326('0x61')][_0x384b46][_0xf326('0x62')]):_0x148779['rules'][_0x384b46][_0xf326('0x63')]+'\x20'+_0x148779[_0xf326('0x61')][_0x384b46]['condition']+(_0x14e8c0(_0x148779[_0xf326('0x61')][_0x384b46][_0xf326('0x64')])?'\x20'+_0x148779[_0xf326('0x61')][_0x384b46][_0xf326('0x65')]:'');}return _0x38b696+')';};var _0x2ab607={'where':{'id':_0x2ec314['id']}},_0x35c228,_0x1bb7cc,_0x5794d0,_0x15d61e,_0x107c00;_0x2ab607=_[_0xf326('0x3b')]({},_0x2ab607,_0x25b56c);return db[_0xf326('0x2c')][_0xf326('0x46')](_0x2ab607)[_0xf326('0x21')](function(_0x204002){if(_0x204002){_0x35c228=_0x204002;return _0x204002[_0xf326('0x66')]();}return null;})['then'](function(_0xa8e05b){if(_0xa8e05b){if(!_0xa8e05b[_0xf326('0x45')]){throw new db['Sequelize'][(_0xf326('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1bb7cc=_0xa8e05b;return db[_0xf326('0x83')][_0xf326('0x3f')]({'raw':!![]});}return null;})[_0xf326('0x21')](function(_0x2a0f36){if(_0x2a0f36){_0x5794d0=_[_0xf326('0x6a')](_0x2a0f36,'id');var _0x3097cf;var _0xf66b70=squel[_0xf326('0x84')]();_0xf66b70[_0xf326('0x85')](_0x35c228[_0xf326('0x6b')]);for(var _0x3f073c=0x0;_0x3f073c<_0x1bb7cc[_0xf326('0x45')];_0x3f073c+=0x1){_0x3097cf=_0x1bb7cc[_0x3f073c][_0xf326('0x6c')]?_0x5794d0[_0x1bb7cc[_0x3f073c][_0xf326('0x6c')]]['metric']:_0x1bb7cc[_0x3f073c][_0xf326('0x63')];_0x3097cf=_0x1bb7cc[_0x3f073c][_0xf326('0x86')]?_[_0xf326('0x6f')](_0x147d51[_0x1bb7cc[_0x3f073c][_0xf326('0x86')]],'%s',_0x3097cf):_0x3097cf;_0x3097cf=_0x1bb7cc[_0x3f073c][_0xf326('0x6e')]?_['replace'](_0x26bbb1[_0x1bb7cc[_0x3f073c][_0xf326('0x6e')]],'%s',_0x3097cf):_0x3097cf;if(_0x1bb7cc[_0x3f073c][_0xf326('0x70')]){_0xf66b70[_0xf326('0x62')](_0x3097cf);}_0x1bb7cc[_0x3f073c][_0xf326('0x72')]&&_0xf66b70[_0xf326('0x71')](_0x3097cf,_0x1bb7cc[_0x3f073c]['orderBy']==='DESC'?![]:!![]);_0xf66b70[_0xf326('0x63')](_0x3097cf,_0x1bb7cc[_0x3f073c]['alias']||_0x3097cf);}if(_0x35c228[_0xf326('0x74')]){_0x35c228[_0xf326('0x74')]=JSON[_0xf326('0x87')](_0x35c228['joins']);for(var _0x54b023=0x0;_0x54b023<_0x35c228[_0xf326('0x74')][_0xf326('0x45')];_0x54b023+=0x1){if(_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x2e')]&&_[_0xf326('0x5c')](_0x5f1724,_0x35c228['joins'][_0x54b023][_0xf326('0x2e')])&&_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x77')]&&_0x35c228['joins'][_0x54b023]['foreignTable']&&_0x35c228['joins'][_0x54b023][_0xf326('0x76')]){_0xf66b70[_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x2e')]](_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x75')],null,util[_0xf326('0x6e')](_0xf326('0x88'),_0x35c228['table'],_0x35c228['joins'][_0x54b023][_0xf326('0x77')],_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x75')],_0x35c228['joins'][_0x54b023][_0xf326('0x76')]));}}}if(_0x35c228[_0xf326('0x78')]){_0x35c228[_0xf326('0x78')]=JSON['parse'](_0x35c228[_0xf326('0x78')]);_0xf66b70[_0xf326('0x38')](_0x1e50aa(_0x35c228[_0xf326('0x78')][_0xf326('0x62')]));}_0x107c00=_0xf66b70['clone']();_0xf66b70['limit'](_0x323926);_0xf66b70['offset'](0x0);return;}})[_0xf326('0x21')](function(){if(_0xf76a89[_0xf326('0x89')]===_0xf326('0x8a')){return null;}var _0x5f0b45=_[_0xf326('0x3b')](_0xf76a89,{'name':_0xf76a89[_0xf326('0x8b')]||_0xf76a89[_0xf326('0x28')]||_0x35c228['name'],'basename':_0x5d23f0,'savename':util[_0xf326('0x6e')](_0xf326('0x8c'),_0xf76a89[_0xf326('0x28')]||_0x35c228[_0xf326('0x28')],require('randomstring')[_0xf326('0x8d')](0x4),_0xf76a89['output']||_0xf326('0x8e')),'reportId':_0x35c228['id'],'reportType':_0xf326('0x8f')});return db[_0xf326('0x90')][_0xf326('0x47')](_0x5f0b45,{'raw':!![]});})['then'](function(_0x2e2f70){if(_0x35c228['table']===_0xf326('0x91')){_0x107c00[_0xf326('0x38')](_0x35c228[_0xf326('0x6b')]+_0xf326('0x92'),_0xf76a89[_0xf326('0x93')],_0xf76a89['endDate']);}else{_0x107c00['where'](_0x35c228[_0xf326('0x6b')]+_0xf326('0x94'),_0xf76a89[_0xf326('0x93')],_0xf76a89[_0xf326('0x95')]);}if(_0x2e2f70){logger['info'](_0xf326('0x96'),_0x107c00['toString']());require(_0xf326('0x97'))[_0xf326('0x98')](path[_0xf326('0x99')](__dirname,'../../components/export/',_0x2e2f70[_0xf326('0x89')]),[_0x2e2f70['id'],_0x107c00[_0xf326('0x7a')](),path[_0xf326('0x99')](__dirname,_0xf326('0x9a'),_0x2e2f70[_0xf326('0x9b')]),_0x5d23f0]);return _0x2e2f70;}else{var _0x4dc4bc=squel[_0xf326('0x84')]();_0x4dc4bc[_0xf326('0x85')]('('+_0x107c00['toString']()+')',_0xf326('0x9c'));_0x4dc4bc[_0xf326('0x63')](_0xf326('0x9d'),_0xf326('0x1e'));_0x107c00['limit'](_0xf76a89['limit']||_0x323926);_0x107c00[_0xf326('0x1c')](_0xf76a89[_0xf326('0x1c')]||0x0);return dbH['sequelize'][_0xf326('0x30')](_0x4dc4bc['toString'](),{'type':dbH['sequelize'][_0xf326('0x9e')][_0xf326('0x7c')]})[_0xf326('0x21')](function(_0x37cd6f){if(!_0x37cd6f[_0xf326('0x45')]){_0x15d61e=0x0;}else{_0x15d61e=_0x37cd6f[0x0][_0xf326('0x1e')]||0x0;}return dbH[_0xf326('0x7b')][_0xf326('0x30')](_0x107c00[_0xf326('0x7a')](),{'type':dbH['sequelize'][_0xf326('0x9e')][_0xf326('0x7c')]});})[_0xf326('0x21')](function(_0x1c7f81){return{'rows':_0x1c7f81||[],'count':_0x15d61e};});}});}exports['run']=function(_0x3e6a5d,_0x20020c){return runReport(_0x3e6a5d[_0xf326('0x42')],_0x3e6a5d[_0xf326('0x30')],_0x3e6a5d[_0xf326('0x3c')])['then'](respondWithResult(_0x20020c,null))[_0xf326('0x40')](handleError(_0x20020c,null));};exports['runReport']=runReport;exports[_0xf326('0x30')]=function(_0x14d255,_0xffd165){var _0x2bc501=0xa;var _0x4bd216=[_0xf326('0x99'),_0xf326('0x51'),_0xf326('0x52'),'cross_join'];var _0x23451e={'SUM':_0xf326('0x7d'),'COUNT':_0xf326('0x54'),'COUNT DISTINCT':_0xf326('0x7e'),'MAX':'MAX(%s)','MIN':_0xf326('0x55'),'AVG':_0xf326('0x80'),'GROUP_CONCAT':_0xf326('0x56'),'GROUP_CONCAT ASC':_0xf326('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x310223={'SEC_TO_TIME':_0xf326('0x9f'),'DATE':_0xf326('0x59'),'HOUR':'HOUR(%s)','ROUND':_0xf326('0x5b'),'UNIX_TIMESTAMP':_0xf326('0x81')};var _0x539d23=function(_0x171c53){return!_[_0xf326('0x5c')]([_0xf326('0x5d'),_0xf326('0x5e'),_0xf326('0x5f'),_0xf326('0x60')],_0x171c53);};var _0x4c7fc0=function(_0x4ffde1){if(!_0x4ffde1||!_0x4ffde1[_0xf326('0x61')][_0xf326('0x45')]){return'';}for(var _0x4307d9='(',_0x2fa05b=0x0;_0x2fa05b<_0x4ffde1[_0xf326('0x61')][_0xf326('0x45')];_0x2fa05b+=0x1){_0x2fa05b>0x0&&(_0x4307d9+='\x20'+_0x4ffde1['operator']+'\x20');_0x4307d9+=_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x62')]?_0x4c7fc0(_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x62')]):_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x63')]+'\x20'+_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x64')]+(_0x539d23(_0x4ffde1[_0xf326('0x61')][_0x2fa05b]['condition'])?'\x20'+_0x4ffde1[_0xf326('0x61')][_0x2fa05b]['value']:'');}return _0x4307d9+')';};var _0x590dc0={'where':{'id':_0x14d255[_0xf326('0x42')]['id']}},_0x32fc6e,_0x549a1f,_0x1f37f9,_0x3e0918,_0x3398fd;_0x590dc0=_[_0xf326('0x3b')]({},_0x590dc0,_0x14d255[_0xf326('0x3c')]);return db[_0xf326('0x2c')][_0xf326('0x46')](_0x590dc0)[_0xf326('0x21')](function(_0x314442){if(_0x314442){_0x32fc6e=_0x314442;return _0x314442[_0xf326('0x66')]();}return null;})[_0xf326('0x21')](function(_0x4c1fcd){if(_0x4c1fcd){if(!_0x4c1fcd[_0xf326('0x45')]){throw new db[(_0xf326('0x67'))][(_0xf326('0x68'))](_0xf326('0x69'),0x193);}_0x549a1f=_0x4c1fcd;return db[_0xf326('0x83')][_0xf326('0x3f')]({'raw':!![]});}return null;})[_0xf326('0x21')](function(_0x5429a2){if(_0x5429a2){_0x1f37f9=_[_0xf326('0x6a')](_0x5429a2,'id');var _0x15f799;var _0x320ab3=squel[_0xf326('0x84')]();_0x320ab3[_0xf326('0x85')](_0x32fc6e[_0xf326('0x6b')]);for(var _0x2094bf=0x0;_0x2094bf<_0x549a1f['length'];_0x2094bf+=0x1){_0x15f799=_0x549a1f[_0x2094bf][_0xf326('0x6c')]?_0x1f37f9[_0x549a1f[_0x2094bf][_0xf326('0x6c')]][_0xf326('0x6d')]:_0x549a1f[_0x2094bf][_0xf326('0x63')];_0x15f799=_0x549a1f[_0x2094bf][_0xf326('0x86')]?_[_0xf326('0x6f')](_0x23451e[_0x549a1f[_0x2094bf][_0xf326('0x86')]],'%s',_0x15f799):_0x15f799;_0x15f799=_0x549a1f[_0x2094bf][_0xf326('0x6e')]?_[_0xf326('0x6f')](_0x310223[_0x549a1f[_0x2094bf][_0xf326('0x6e')]],'%s',_0x15f799):_0x15f799;if(_0x549a1f[_0x2094bf][_0xf326('0x70')]){_0x320ab3[_0xf326('0x62')](_0x15f799);}_0x549a1f[_0x2094bf]['orderBy']&&_0x320ab3[_0xf326('0x71')](_0x15f799,_0x549a1f[_0x2094bf][_0xf326('0x72')]===_0xf326('0x73')?![]:!![]);_0x320ab3['field'](_0x15f799,_0x549a1f[_0x2094bf]['alias']||_0x15f799);}if(_0x32fc6e[_0xf326('0x74')]){_0x32fc6e[_0xf326('0x74')]=JSON[_0xf326('0x87')](_0x32fc6e[_0xf326('0x74')]);for(var _0x5384a5=0x0;_0x5384a5<_0x32fc6e[_0xf326('0x74')][_0xf326('0x45')];_0x5384a5+=0x1){if(_0x32fc6e[_0xf326('0x74')][_0x5384a5]['type']&&_['includes'](_0x4bd216,_0x32fc6e['joins'][_0x5384a5][_0xf326('0x2e')])&&_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x77')]&&_0x32fc6e['joins'][_0x5384a5][_0xf326('0x75')]&&_0x32fc6e['joins'][_0x5384a5][_0xf326('0x76')]){_0x320ab3[_0x32fc6e['joins'][_0x5384a5][_0xf326('0x2e')]](_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x75')],null,util[_0xf326('0x6e')](_0xf326('0x88'),_0x32fc6e[_0xf326('0x6b')],_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x77')],_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x75')],_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x76')]));}}}if(_0x32fc6e[_0xf326('0x78')]){_0x32fc6e[_0xf326('0x78')]=JSON['parse'](_0x32fc6e[_0xf326('0x78')]);_0x320ab3[_0xf326('0x38')](_0x4c7fc0(_0x32fc6e[_0xf326('0x78')]['group']));}_0x3398fd=_0x320ab3['clone']();_0x320ab3['limit'](_0x2bc501);_0x320ab3[_0xf326('0x1c')](0x0);logger[_0xf326('0xa0')](_0xf326('0x79'),_0x320ab3[_0xf326('0x7a')]());return dbH[_0xf326('0x7b')][_0xf326('0x30')](_0x320ab3['toString'](),{'type':dbH[_0xf326('0x7b')][_0xf326('0x9e')][_0xf326('0x7c')]});}})[_0xf326('0x21')](function(){return{'sql':_0x3398fd[_0xf326('0x7a')]()};})['then'](respondWithResult(_0xffd165,null))[_0xf326('0x40')](handleError(_0xffd165,null));}; \ No newline at end of file +var _0x187d=['fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','limit','undefined','count','offset','set','json','save','update','then','get','destroy','error','name','send','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','keys','filters','intersection','query','fields','attributes','order','sort','filter','where','merge','options','includeAll','rows','catch','include','create','role','user','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','params','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\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\x20NOT\x20EMPTY','rules','length','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','findAll','keyBy','from','table','MetricId','metric','replace','format','groupBy','orderBy','field','alias','joins','parse','parentKey','foreignKey','foreignTable','conditions','clone','Limited\x20Query:','toString','sequelize','SELECT','join','IS\x20EMPTY','operator','AnalyticMetric','function','DESC','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','fork','../../components/export/','savename','select','countTable','QueryTypes','runReport','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs'];(function(_0x588a02,_0x5bbc44){var _0x324657=function(_0x555cbf){while(--_0x555cbf){_0x588a02['push'](_0x588a02['shift']());}};_0x324657(++_0x5bbc44);}(_0x187d,0x93));var _0xd187=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0x187d[_0x9aada2];return _0x196dff;};'use strict';var emlformat=require(_0xd187('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd187('0x1'));var jsonpatch=require(_0xd187('0x2'));var rp=require(_0xd187('0x3'));var moment=require(_0xd187('0x4'));var BPromise=require(_0xd187('0x5'));var Mustache=require(_0xd187('0x6'));var util=require('util');var path=require(_0xd187('0x7'));var sox=require(_0xd187('0x8'));var csv=require('to-csv');var ejs=require(_0xd187('0x9'));var fs=require('fs');var fs_extra=require(_0xd187('0xa'));var _=require(_0xd187('0xb'));var squel=require(_0xd187('0xc'));var crypto=require(_0xd187('0xd'));var jsforce=require(_0xd187('0xe'));var deskjs=require(_0xd187('0xf'));var toCsv=require(_0xd187('0x10'));var querystring=require('querystring');var Papa=require(_0xd187('0x11'));var Redis=require(_0xd187('0x12'));var authService=require(_0xd187('0x13'));var qs=require(_0xd187('0x14'));var as=require(_0xd187('0x15'));var hardwareService=require(_0xd187('0x16'));var logger=require('../../config/logger')(_0xd187('0x17'));var utils=require(_0xd187('0x18'));var config=require(_0xd187('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd187('0x1a'))['db'];var dbH=require(_0xd187('0x1a'))[_0xd187('0x1b')];function respondWithStatusCode(_0x59ee4a,_0x33e3d5){_0x33e3d5=_0x33e3d5||0xcc;return function(_0x18ce42){if(_0x18ce42){return _0x59ee4a[_0xd187('0x1c')](_0x33e3d5);}return _0x59ee4a[_0xd187('0x1d')](_0x33e3d5)['end']();};}function respondWithResult(_0x39a927,_0x2050d5){_0x2050d5=_0x2050d5||0xc8;return function(_0x45ab10){if(_0x45ab10){return _0x39a927[_0xd187('0x1d')](_0x2050d5)['json'](_0x45ab10);}};}function respondWithFilteredResult(_0x245d3e,_0x52a208){return function(_0x5cf218){if(_0x5cf218){var _0x40ed84=typeof _0x52a208['offset']==='undefined'&&typeof _0x52a208[_0xd187('0x1e')]===_0xd187('0x1f');var _0x374fe0=_0x5cf218[_0xd187('0x20')];var _0x21df74=_0x40ed84?0x0:_0x52a208[_0xd187('0x21')];var _0x12b388=_0x40ed84?_0x5cf218[_0xd187('0x20')]:_0x52a208[_0xd187('0x21')]+_0x52a208[_0xd187('0x1e')];var _0x170d5c;if(_0x12b388>=_0x374fe0){_0x12b388=_0x374fe0;_0x170d5c=0xc8;}else{_0x170d5c=0xce;}_0x245d3e[_0xd187('0x1d')](_0x170d5c);return _0x245d3e[_0xd187('0x22')]('Content-Range',_0x21df74+'-'+_0x12b388+'/'+_0x374fe0)[_0xd187('0x23')](_0x5cf218);}return null;};}function patchUpdates(_0x81b988){return function(_0xc5bba5){try{jsonpatch['apply'](_0xc5bba5,_0x81b988,!![]);}catch(_0x5a0360){return BPromise['reject'](_0x5a0360);}return _0xc5bba5[_0xd187('0x24')]();};}function saveUpdates(_0x33741d,_0x249a82){return function(_0x4f62c8){if(_0x4f62c8){return _0x4f62c8[_0xd187('0x25')](_0x33741d)['then'](function(_0x145771){return _0x145771;});}return null;};}function removeEntity(_0x5a7a23,_0x1047f4){return function(_0x54f340){if(_0x54f340){return _0x54f340['destroy']()[_0xd187('0x26')](function(){var _0x4d992b=_0x54f340[_0xd187('0x27')]({'plain':!![]});var _0x598aa4='DefaultReports';return db['UserProfileResource'][_0xd187('0x28')]({'where':{'type':_0x598aa4,'resourceId':_0x4d992b['id']}})[_0xd187('0x26')](function(){return _0x54f340;});})[_0xd187('0x26')](function(){_0x5a7a23[_0xd187('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a20ed,_0x2875c8){return function(_0x5c8e52){if(!_0x5c8e52){_0x2a20ed[_0xd187('0x1c')](0x194);}return _0x5c8e52;};}function handleError(_0x1c87ee,_0x34febe){_0x34febe=_0x34febe||0x1f4;return function(_0x4c50a5){logger[_0xd187('0x29')](_0x4c50a5['stack']);if(_0x4c50a5[_0xd187('0x2a')]){delete _0x4c50a5[_0xd187('0x2a')];}_0x1c87ee[_0xd187('0x1d')](_0x34febe)[_0xd187('0x2b')](_0x4c50a5);};}exports['index']=function(_0x140e54,_0xb38778){var _0x5bba10={},_0x4cc587={},_0x1a1922={'count':0x0,'rows':[]};var _0x1836cf=_[_0xd187('0x2c')](db[_0xd187('0x2d')][_0xd187('0x2e')],function(_0x2d8843){return{'name':_0x2d8843[_0xd187('0x2f')],'type':_0x2d8843[_0xd187('0x30')]['key']};});_0x4cc587[_0xd187('0x31')]=_[_0xd187('0x2c')](_0x1836cf,_0xd187('0x2a'));_0x4cc587['query']=_[_0xd187('0x32')](_0x140e54['query']);_0x4cc587[_0xd187('0x33')]=_[_0xd187('0x34')](_0x4cc587[_0xd187('0x31')],_0x4cc587['query']);_0x5bba10['attributes']=_[_0xd187('0x34')](_0x4cc587[_0xd187('0x31')],qs['fields'](_0x140e54[_0xd187('0x35')][_0xd187('0x36')]));_0x5bba10[_0xd187('0x37')]=_0x5bba10['attributes']['length']?_0x5bba10[_0xd187('0x37')]:_0x4cc587[_0xd187('0x31')];if(!_0x140e54['query']['hasOwnProperty']('nolimit')){_0x5bba10[_0xd187('0x1e')]=qs['limit'](_0x140e54[_0xd187('0x35')][_0xd187('0x1e')]);_0x5bba10['offset']=qs[_0xd187('0x21')](_0x140e54['query'][_0xd187('0x21')]);}_0x5bba10[_0xd187('0x38')]=qs['sort'](_0x140e54[_0xd187('0x35')][_0xd187('0x39')]);_0x5bba10['where']=qs[_0xd187('0x33')](_['pick'](_0x140e54['query'],_0x4cc587[_0xd187('0x33')]),_0x1836cf);if(_0x140e54[_0xd187('0x35')][_0xd187('0x3a')]){_0x5bba10[_0xd187('0x3b')]=_[_0xd187('0x3c')](_0x5bba10['where'],{'$or':_[_0xd187('0x2c')](_0x1836cf,function(_0xe090ad){if(_0xe090ad[_0xd187('0x30')]!=='VIRTUAL'){var _0x4b121c={};_0x4b121c[_0xe090ad['name']]={'$like':'%'+_0x140e54['query'][_0xd187('0x3a')]+'%'};return _0x4b121c;}})});}_0x5bba10=_[_0xd187('0x3c')]({},_0x5bba10,_0x140e54[_0xd187('0x3d')]);var _0x367303={'where':_0x5bba10[_0xd187('0x3b')]};return db[_0xd187('0x2d')][_0xd187('0x20')](_0x367303)[_0xd187('0x26')](function(_0x526060){_0x1a1922[_0xd187('0x20')]=_0x526060;if(_0x140e54[_0xd187('0x35')][_0xd187('0x3e')]){_0x5bba10['include']=[{'all':!![]}];}return db[_0xd187('0x2d')]['findAll'](_0x5bba10);})[_0xd187('0x26')](function(_0x406d29){_0x1a1922[_0xd187('0x3f')]=_0x406d29;return _0x1a1922;})[_0xd187('0x26')](respondWithFilteredResult(_0xb38778,_0x5bba10))[_0xd187('0x40')](handleError(_0xb38778,null));};exports['show']=function(_0x3f0484,_0x3d9e60){var _0x3215b1={'raw':!![],'where':{'id':_0x3f0484['params']['id']}},_0x3fa19c={};_0x3fa19c[_0xd187('0x31')]=_[_0xd187('0x32')](db['AnalyticDefaultReport'][_0xd187('0x2e')]);_0x3fa19c[_0xd187('0x35')]=_['keys'](_0x3f0484['query']);_0x3fa19c[_0xd187('0x33')]=_[_0xd187('0x34')](_0x3fa19c['model'],_0x3fa19c['query']);_0x3215b1['attributes']=_[_0xd187('0x34')](_0x3fa19c[_0xd187('0x31')],qs[_0xd187('0x36')](_0x3f0484[_0xd187('0x35')][_0xd187('0x36')]));_0x3215b1[_0xd187('0x37')]=_0x3215b1[_0xd187('0x37')]['length']?_0x3215b1[_0xd187('0x37')]:_0x3fa19c[_0xd187('0x31')];if(_0x3f0484[_0xd187('0x35')][_0xd187('0x3e')]){_0x3215b1[_0xd187('0x41')]=[{'all':!![]}];}_0x3215b1=_[_0xd187('0x3c')]({},_0x3215b1,_0x3f0484[_0xd187('0x3d')]);return db[_0xd187('0x2d')]['find'](_0x3215b1)[_0xd187('0x26')](handleEntityNotFound(_0x3d9e60,null))[_0xd187('0x26')](respondWithResult(_0x3d9e60,null))[_0xd187('0x40')](handleError(_0x3d9e60,null));};exports[_0xd187('0x42')]=function(_0x36b99d,_0x5ad646){return db[_0xd187('0x2d')][_0xd187('0x42')](_0x36b99d['body'],{})[_0xd187('0x26')](function(_0xd9635d){var _0x55fac6=_0x36b99d['user']['get']({'plain':!![]});if(!_0x55fac6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x55fac6[_0xd187('0x43')]===_0xd187('0x44')){var _0x12d448=_0xd9635d[_0xd187('0x27')]({'plain':!![]});var _0x460202=_0xd187('0x45');return db[_0xd187('0x46')]['find']({'where':{'name':_0x460202,'userProfileId':_0x55fac6[_0xd187('0x47')]},'raw':!![]})[_0xd187('0x26')](function(_0x1b12c4){if(_0x1b12c4&&_0x1b12c4[_0xd187('0x48')]===0x0){return db['UserProfileResource'][_0xd187('0x42')]({'name':_0x12d448['name'],'resourceId':_0x12d448['id'],'type':'DefaultReports','sectionId':_0x1b12c4['id']},{})[_0xd187('0x26')](function(){return _0xd9635d;});}else{return _0xd9635d;}})['catch'](function(_0x1a1252){logger[_0xd187('0x29')](_0xd187('0x49'),_0x1a1252);throw _0x1a1252;});}return _0xd9635d;})[_0xd187('0x26')](respondWithResult(_0x5ad646,0xc9))[_0xd187('0x40')](handleError(_0x5ad646,null));};exports[_0xd187('0x25')]=function(_0x3c7ba6,_0x2b4f9d){if(_0x3c7ba6[_0xd187('0x4a')]['id']){delete _0x3c7ba6['body']['id'];}return db[_0xd187('0x2d')][_0xd187('0x4b')]({'where':{'id':_0x3c7ba6['params']['id']}})[_0xd187('0x26')](handleEntityNotFound(_0x2b4f9d,null))[_0xd187('0x26')](saveUpdates(_0x3c7ba6[_0xd187('0x4a')],null))['then'](respondWithResult(_0x2b4f9d,null))[_0xd187('0x40')](handleError(_0x2b4f9d,null));};exports[_0xd187('0x28')]=function(_0x50073d,_0x457da1){return db[_0xd187('0x2d')]['find']({'where':{'id':_0x50073d[_0xd187('0x4c')]['id']}})['then'](handleEntityNotFound(_0x457da1,null))[_0xd187('0x26')](removeEntity(_0x457da1,null))[_0xd187('0x40')](handleError(_0x457da1,null));};exports[_0xd187('0x4d')]=function(_0x508866,_0x100d64){var _0x2265fb=0xa;var _0x1675d9=['join',_0xd187('0x4e'),_0xd187('0x4f'),_0xd187('0x50')];var _0x56b36b={'SUM':_0xd187('0x51'),'COUNT':_0xd187('0x52'),'COUNT DISTINCT':_0xd187('0x53'),'MAX':_0xd187('0x54'),'MIN':_0xd187('0x55'),'AVG':_0xd187('0x56'),'GROUP_CONCAT':_0xd187('0x57'),'GROUP_CONCAT ASC':_0xd187('0x58'),'GROUP_CONCAT DESC':_0xd187('0x59')};var _0x2c7dd9={'SEC_TO_TIME':_0xd187('0x5a'),'DATE':_0xd187('0x5b'),'HOUR':_0xd187('0x5c'),'ROUND':_0xd187('0x5d'),'UNIX_TIMESTAMP':_0xd187('0x5e')};var _0xaff1e6=function(_0x42fb32){return!_[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),'IS\x20EMPTY',_0xd187('0x62')],_0x42fb32);};var _0x48c82d=function(_0x13d118){if(!_0x13d118||!_0x13d118[_0xd187('0x63')][_0xd187('0x64')]){return'';}for(var _0x4225e6='(',_0x51fbdb=0x0;_0x51fbdb<_0x13d118[_0xd187('0x63')][_0xd187('0x64')];_0x51fbdb+=0x1){_0x51fbdb>0x0&&(_0x4225e6+='\x20'+_0x13d118['operator']+'\x20');_0x4225e6+=_0x13d118['rules'][_0x51fbdb][_0xd187('0x65')]?_0x48c82d(_0x13d118[_0xd187('0x63')][_0x51fbdb][_0xd187('0x65')]):_0x13d118[_0xd187('0x63')][_0x51fbdb]['field']+'\x20'+_0x13d118[_0xd187('0x63')][_0x51fbdb]['condition']+(_0xaff1e6(_0x13d118[_0xd187('0x63')][_0x51fbdb][_0xd187('0x66')])?'\x20'+_0x13d118[_0xd187('0x63')][_0x51fbdb][_0xd187('0x67')]:'');}return _0x4225e6+')';};var _0x57cad7={'where':{'id':_0x508866['params']['id']}},_0x2409a8,_0xaea7e0,_0xd12560,_0x9e82c,_0x151f3c;_0x57cad7=_['merge']({},_0x57cad7,_0x508866[_0xd187('0x3d')]);return db[_0xd187('0x2d')][_0xd187('0x4b')](_0x57cad7)[_0xd187('0x26')](function(_0x13e05a){if(_0x13e05a){_0x2409a8=_0x13e05a;return _0x13e05a[_0xd187('0x68')]();}return null;})[_0xd187('0x26')](function(_0x1291cc){if(_0x1291cc){if(!_0x1291cc[_0xd187('0x64')]){throw new db[(_0xd187('0x69'))][(_0xd187('0x6a'))](_0xd187('0x6b'),0x193);}_0xaea7e0=_0x1291cc;return db['AnalyticMetric'][_0xd187('0x6c')]({'raw':!![]});}return null;})[_0xd187('0x26')](function(_0x54e908){if(_0x54e908){_0xd12560=_[_0xd187('0x6d')](_0x54e908,'id');var _0x1a9979;var _0x4bec3e=squel['select']();_0x4bec3e[_0xd187('0x6e')](_0x2409a8[_0xd187('0x6f')]);for(var _0x2ac56f=0x0;_0x2ac56f<_0xaea7e0[_0xd187('0x64')];_0x2ac56f+=0x1){_0x1a9979=_0xaea7e0[_0x2ac56f]['MetricId']?_0xd12560[_0xaea7e0[_0x2ac56f][_0xd187('0x70')]][_0xd187('0x71')]:_0xaea7e0[_0x2ac56f]['field'];_0x1a9979=_0xaea7e0[_0x2ac56f]['function']?_[_0xd187('0x72')](_0x56b36b[_0xaea7e0[_0x2ac56f]['function']],'%s',_0x1a9979):_0x1a9979;_0x1a9979=_0xaea7e0[_0x2ac56f][_0xd187('0x73')]?_[_0xd187('0x72')](_0x2c7dd9[_0xaea7e0[_0x2ac56f]['format']],'%s',_0x1a9979):_0x1a9979;if(_0xaea7e0[_0x2ac56f][_0xd187('0x74')]){_0x4bec3e['group'](_0x1a9979);}_0xaea7e0[_0x2ac56f][_0xd187('0x75')]&&_0x4bec3e['order'](_0x1a9979,_0xaea7e0[_0x2ac56f]['orderBy']==='DESC'?![]:!![]);_0x4bec3e[_0xd187('0x76')](_0x1a9979,_0xaea7e0[_0x2ac56f][_0xd187('0x77')]||_0x1a9979);}if(_0x2409a8[_0xd187('0x78')]){_0x2409a8[_0xd187('0x78')]=JSON[_0xd187('0x79')](_0x2409a8[_0xd187('0x78')]);for(var _0x11858e=0x0;_0x11858e<_0x2409a8[_0xd187('0x78')]['length'];_0x11858e+=0x1){if(_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x30')]&&_[_0xd187('0x5f')](_0x1675d9,_0x2409a8['joins'][_0x11858e][_0xd187('0x30')])&&_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x7a')]&&_0x2409a8[_0xd187('0x78')][_0x11858e]['foreignTable']&&_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x7b')]){_0x4bec3e[_0x2409a8['joins'][_0x11858e][_0xd187('0x30')]](_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x7c')],null,util[_0xd187('0x73')]('%s.%s\x20=\x20%s.%s',_0x2409a8[_0xd187('0x6f')],_0x2409a8[_0xd187('0x78')][_0x11858e]['parentKey'],_0x2409a8[_0xd187('0x78')][_0x11858e]['foreignTable'],_0x2409a8['joins'][_0x11858e]['foreignKey']));}}}if(_0x2409a8[_0xd187('0x7d')]){_0x2409a8[_0xd187('0x7d')]=JSON[_0xd187('0x79')](_0x2409a8[_0xd187('0x7d')]);_0x4bec3e[_0xd187('0x3b')](_0x48c82d(_0x2409a8[_0xd187('0x7d')]['group']));}_0x151f3c=_0x4bec3e[_0xd187('0x7e')]();_0x4bec3e[_0xd187('0x1e')](_0x2265fb);_0x4bec3e['offset'](0x0);logger['debug'](_0xd187('0x7f'),_0x4bec3e[_0xd187('0x80')]());return dbH[_0xd187('0x81')][_0xd187('0x35')](_0x4bec3e[_0xd187('0x80')](),{'type':dbH[_0xd187('0x81')]['QueryTypes'][_0xd187('0x82')]});}})[_0xd187('0x26')](respondWithResult(_0x100d64,null))[_0xd187('0x40')](handleError(_0x100d64,null));};function runReport(_0xbc650f,_0x1da684,_0x2879ff){var _0x1982cd=_0x1da684[_0xd187('0x2a')];var _0x3d9b2f=0xa;var _0xf31fac=[_0xd187('0x83'),_0xd187('0x4e'),'right_join','cross_join'];var _0x3d7e97={'SUM':_0xd187('0x51'),'COUNT':_0xd187('0x52'),'COUNT DISTINCT':_0xd187('0x53'),'MAX':_0xd187('0x54'),'MIN':_0xd187('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xd187('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd187('0x59')};var _0x520f86={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd187('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0xd187('0x5d'),'UNIX_TIMESTAMP':_0xd187('0x5e')};var _0x1ccb17=function(_0x432995){return!_[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),_0xd187('0x84'),_0xd187('0x62')],_0x432995);};var _0x395e45=function(_0x1e8839){if(!_0x1e8839||!_0x1e8839[_0xd187('0x63')][_0xd187('0x64')]){return'';}for(var _0x2101a3='(',_0x25fc08=0x0;_0x25fc08<_0x1e8839['rules'][_0xd187('0x64')];_0x25fc08+=0x1){_0x25fc08>0x0&&(_0x2101a3+='\x20'+_0x1e8839[_0xd187('0x85')]+'\x20');_0x2101a3+=_0x1e8839[_0xd187('0x63')][_0x25fc08][_0xd187('0x65')]?_0x395e45(_0x1e8839['rules'][_0x25fc08][_0xd187('0x65')]):_0x1e8839[_0xd187('0x63')][_0x25fc08]['field']+'\x20'+_0x1e8839['rules'][_0x25fc08][_0xd187('0x66')]+(_0x1ccb17(_0x1e8839[_0xd187('0x63')][_0x25fc08][_0xd187('0x66')])?'\x20'+_0x1e8839[_0xd187('0x63')][_0x25fc08][_0xd187('0x67')]:'');}return _0x2101a3+')';};var _0x475ea9={'where':{'id':_0xbc650f['id']}},_0x4dd0c7,_0x22900,_0x22424d,_0x5b7870,_0x3244dd;_0x475ea9=_[_0xd187('0x3c')]({},_0x475ea9,_0x2879ff);return db[_0xd187('0x2d')][_0xd187('0x4b')](_0x475ea9)['then'](function(_0x5be1c9){if(_0x5be1c9){_0x4dd0c7=_0x5be1c9;return _0x5be1c9[_0xd187('0x68')]();}return null;})[_0xd187('0x26')](function(_0x1cd0d2){if(_0x1cd0d2){if(!_0x1cd0d2['length']){throw new db[(_0xd187('0x69'))][(_0xd187('0x6a'))](_0xd187('0x6b'),0x193);}_0x22900=_0x1cd0d2;return db[_0xd187('0x86')]['findAll']({'raw':!![]});}return null;})[_0xd187('0x26')](function(_0x4efb9f){if(_0x4efb9f){_0x22424d=_['keyBy'](_0x4efb9f,'id');var _0x4a9310;var _0x54bf98=squel['select']();_0x54bf98['from'](_0x4dd0c7['table']);for(var _0x323311=0x0;_0x323311<_0x22900[_0xd187('0x64')];_0x323311+=0x1){_0x4a9310=_0x22900[_0x323311]['MetricId']?_0x22424d[_0x22900[_0x323311][_0xd187('0x70')]][_0xd187('0x71')]:_0x22900[_0x323311][_0xd187('0x76')];_0x4a9310=_0x22900[_0x323311][_0xd187('0x87')]?_[_0xd187('0x72')](_0x3d7e97[_0x22900[_0x323311]['function']],'%s',_0x4a9310):_0x4a9310;_0x4a9310=_0x22900[_0x323311][_0xd187('0x73')]?_['replace'](_0x520f86[_0x22900[_0x323311][_0xd187('0x73')]],'%s',_0x4a9310):_0x4a9310;if(_0x22900[_0x323311][_0xd187('0x74')]){_0x54bf98[_0xd187('0x65')](_0x4a9310);}_0x22900[_0x323311][_0xd187('0x75')]&&_0x54bf98[_0xd187('0x38')](_0x4a9310,_0x22900[_0x323311][_0xd187('0x75')]===_0xd187('0x88')?![]:!![]);_0x54bf98['field'](_0x4a9310,_0x22900[_0x323311][_0xd187('0x77')]||_0x4a9310);}if(_0x4dd0c7[_0xd187('0x78')]){_0x4dd0c7['joins']=JSON[_0xd187('0x79')](_0x4dd0c7[_0xd187('0x78')]);for(var _0x5df926=0x0;_0x5df926<_0x4dd0c7[_0xd187('0x78')][_0xd187('0x64')];_0x5df926+=0x1){if(_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x30')]&&_[_0xd187('0x5f')](_0xf31fac,_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x30')])&&_0x4dd0c7[_0xd187('0x78')][_0x5df926]['parentKey']&&_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7c')]&&_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7b')]){_0x54bf98[_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x30')]](_0x4dd0c7['joins'][_0x5df926]['foreignTable'],null,util[_0xd187('0x73')](_0xd187('0x89'),_0x4dd0c7['table'],_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7a')],_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7c')],_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7b')]));}}}if(_0x4dd0c7['conditions']){_0x4dd0c7[_0xd187('0x7d')]=JSON[_0xd187('0x79')](_0x4dd0c7[_0xd187('0x7d')]);_0x54bf98[_0xd187('0x3b')](_0x395e45(_0x4dd0c7[_0xd187('0x7d')][_0xd187('0x65')]));}_0x3244dd=_0x54bf98[_0xd187('0x7e')]();_0x54bf98[_0xd187('0x1e')](_0x3d9b2f);_0x54bf98[_0xd187('0x21')](0x0);return;}})['then'](function(){if(_0x1da684[_0xd187('0x8a')]===_0xd187('0x8b')){return null;}var _0x25a053=_['merge'](_0x1da684,{'name':_0x1da684[_0xd187('0x8c')]||_0x1da684[_0xd187('0x2a')]||_0x4dd0c7[_0xd187('0x2a')],'basename':_0x1982cd,'savename':util[_0xd187('0x73')](_0xd187('0x8d'),_0x1da684[_0xd187('0x2a')]||_0x4dd0c7['name'],require(_0xd187('0x8e'))[_0xd187('0x8f')](0x4),_0x1da684[_0xd187('0x8a')]||'csv'),'reportId':_0x4dd0c7['id'],'reportType':_0xd187('0x90')});return db[_0xd187('0x91')][_0xd187('0x42')](_0x25a053,{'raw':!![]});})[_0xd187('0x26')](function(_0x12599e){if(_0x4dd0c7[_0xd187('0x6f')]==='cdr'){_0x3244dd[_0xd187('0x3b')](_0x4dd0c7[_0xd187('0x6f')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x1da684[_0xd187('0x92')],_0x1da684[_0xd187('0x93')]);}else{_0x3244dd['where'](_0x4dd0c7[_0xd187('0x6f')]+_0xd187('0x94'),_0x1da684['startDate'],_0x1da684[_0xd187('0x93')]);}if(_0x12599e){logger[_0xd187('0x95')]('Run\x20Query:',_0x3244dd[_0xd187('0x80')]());require('child_process')[_0xd187('0x96')](path[_0xd187('0x83')](__dirname,_0xd187('0x97'),_0x12599e[_0xd187('0x8a')]),[_0x12599e['id'],_0x3244dd[_0xd187('0x80')](),path['join'](__dirname,'../../files/reports',_0x12599e[_0xd187('0x98')]),_0x1982cd]);return _0x12599e;}else{var _0x2a2c7f=squel[_0xd187('0x99')]();_0x2a2c7f[_0xd187('0x6e')]('('+_0x3244dd[_0xd187('0x80')]()+')',_0xd187('0x9a'));_0x2a2c7f[_0xd187('0x76')]('COUNT(*)',_0xd187('0x20'));_0x3244dd[_0xd187('0x1e')](_0x1da684[_0xd187('0x1e')]||_0x3d9b2f);_0x3244dd[_0xd187('0x21')](_0x1da684[_0xd187('0x21')]||0x0);return dbH[_0xd187('0x81')]['query'](_0x2a2c7f[_0xd187('0x80')](),{'type':dbH[_0xd187('0x81')][_0xd187('0x9b')][_0xd187('0x82')]})[_0xd187('0x26')](function(_0x38a7cd){if(!_0x38a7cd[_0xd187('0x64')]){_0x5b7870=0x0;}else{_0x5b7870=_0x38a7cd[0x0][_0xd187('0x20')]||0x0;}return dbH['sequelize'][_0xd187('0x35')](_0x3244dd['toString'](),{'type':dbH[_0xd187('0x81')][_0xd187('0x9b')]['SELECT']});})[_0xd187('0x26')](function(_0x254e0a){return{'rows':_0x254e0a||[],'count':_0x5b7870};});}});}exports['run']=function(_0x1776c1,_0x497a94){return runReport(_0x1776c1[_0xd187('0x4c')],_0x1776c1['query'],_0x1776c1['options'])[_0xd187('0x26')](respondWithResult(_0x497a94,null))[_0xd187('0x40')](handleError(_0x497a94,null));};exports[_0xd187('0x9c')]=runReport;exports[_0xd187('0x35')]=function(_0x568f72,_0x357526){var _0x13ee40=0xa;var _0x20c269=[_0xd187('0x83'),_0xd187('0x4e'),_0xd187('0x4f'),_0xd187('0x50')];var _0x25ff89={'SUM':_0xd187('0x51'),'COUNT':_0xd187('0x52'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xd187('0x54'),'MIN':_0xd187('0x55'),'AVG':_0xd187('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd187('0x59')};var _0x28798f={'SEC_TO_TIME':_0xd187('0x5a'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xd187('0x5d'),'UNIX_TIMESTAMP':_0xd187('0x5e')};var _0x56fcde=function(_0x37b1b0){return!_[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),'IS\x20EMPTY',_0xd187('0x62')],_0x37b1b0);};var _0x428e6c=function(_0x4524c3){if(!_0x4524c3||!_0x4524c3[_0xd187('0x63')][_0xd187('0x64')]){return'';}for(var _0x3a2937='(',_0xf03f9a=0x0;_0xf03f9a<_0x4524c3['rules'][_0xd187('0x64')];_0xf03f9a+=0x1){_0xf03f9a>0x0&&(_0x3a2937+='\x20'+_0x4524c3['operator']+'\x20');_0x3a2937+=_0x4524c3[_0xd187('0x63')][_0xf03f9a]['group']?_0x428e6c(_0x4524c3[_0xd187('0x63')][_0xf03f9a]['group']):_0x4524c3[_0xd187('0x63')][_0xf03f9a][_0xd187('0x76')]+'\x20'+_0x4524c3[_0xd187('0x63')][_0xf03f9a]['condition']+(_0x56fcde(_0x4524c3[_0xd187('0x63')][_0xf03f9a][_0xd187('0x66')])?'\x20'+_0x4524c3[_0xd187('0x63')][_0xf03f9a][_0xd187('0x67')]:'');}return _0x3a2937+')';};var _0x37405d={'where':{'id':_0x568f72[_0xd187('0x4c')]['id']}},_0xe84f78,_0x12b4a4,_0x3d09a6,_0x5acea7,_0x2a756f;_0x37405d=_[_0xd187('0x3c')]({},_0x37405d,_0x568f72['options']);return db[_0xd187('0x2d')][_0xd187('0x4b')](_0x37405d)[_0xd187('0x26')](function(_0x110af6){if(_0x110af6){_0xe84f78=_0x110af6;return _0x110af6[_0xd187('0x68')]();}return null;})[_0xd187('0x26')](function(_0x2e4db4){if(_0x2e4db4){if(!_0x2e4db4[_0xd187('0x64')]){throw new db[(_0xd187('0x69'))][(_0xd187('0x6a'))](_0xd187('0x6b'),0x193);}_0x12b4a4=_0x2e4db4;return db['AnalyticMetric'][_0xd187('0x6c')]({'raw':!![]});}return null;})[_0xd187('0x26')](function(_0x50d5b8){if(_0x50d5b8){_0x3d09a6=_[_0xd187('0x6d')](_0x50d5b8,'id');var _0x48ef98;var _0x2008e9=squel['select']();_0x2008e9[_0xd187('0x6e')](_0xe84f78[_0xd187('0x6f')]);for(var _0x9b8840=0x0;_0x9b8840<_0x12b4a4[_0xd187('0x64')];_0x9b8840+=0x1){_0x48ef98=_0x12b4a4[_0x9b8840][_0xd187('0x70')]?_0x3d09a6[_0x12b4a4[_0x9b8840]['MetricId']][_0xd187('0x71')]:_0x12b4a4[_0x9b8840][_0xd187('0x76')];_0x48ef98=_0x12b4a4[_0x9b8840][_0xd187('0x87')]?_[_0xd187('0x72')](_0x25ff89[_0x12b4a4[_0x9b8840][_0xd187('0x87')]],'%s',_0x48ef98):_0x48ef98;_0x48ef98=_0x12b4a4[_0x9b8840]['format']?_[_0xd187('0x72')](_0x28798f[_0x12b4a4[_0x9b8840][_0xd187('0x73')]],'%s',_0x48ef98):_0x48ef98;if(_0x12b4a4[_0x9b8840][_0xd187('0x74')]){_0x2008e9['group'](_0x48ef98);}_0x12b4a4[_0x9b8840]['orderBy']&&_0x2008e9[_0xd187('0x38')](_0x48ef98,_0x12b4a4[_0x9b8840][_0xd187('0x75')]===_0xd187('0x88')?![]:!![]);_0x2008e9[_0xd187('0x76')](_0x48ef98,_0x12b4a4[_0x9b8840]['alias']||_0x48ef98);}if(_0xe84f78[_0xd187('0x78')]){_0xe84f78[_0xd187('0x78')]=JSON[_0xd187('0x79')](_0xe84f78[_0xd187('0x78')]);for(var _0x4bff96=0x0;_0x4bff96<_0xe84f78[_0xd187('0x78')]['length'];_0x4bff96+=0x1){if(_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x30')]&&_[_0xd187('0x5f')](_0x20c269,_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x30')])&&_0xe84f78['joins'][_0x4bff96][_0xd187('0x7a')]&&_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7c')]&&_0xe84f78[_0xd187('0x78')][_0x4bff96]['foreignKey']){_0x2008e9[_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x30')]](_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7c')],null,util[_0xd187('0x73')](_0xd187('0x89'),_0xe84f78[_0xd187('0x6f')],_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7a')],_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7c')],_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7b')]));}}}if(_0xe84f78['conditions']){_0xe84f78[_0xd187('0x7d')]=JSON['parse'](_0xe84f78[_0xd187('0x7d')]);_0x2008e9['where'](_0x428e6c(_0xe84f78[_0xd187('0x7d')][_0xd187('0x65')]));}_0x2a756f=_0x2008e9[_0xd187('0x7e')]();_0x2008e9[_0xd187('0x1e')](_0x13ee40);_0x2008e9['offset'](0x0);logger['debug'](_0xd187('0x7f'),_0x2008e9[_0xd187('0x80')]());return dbH[_0xd187('0x81')][_0xd187('0x35')](_0x2008e9[_0xd187('0x80')](),{'type':dbH[_0xd187('0x81')]['QueryTypes']['SELECT']});}})[_0xd187('0x26')](function(){return{'sql':_0x2a756f[_0xd187('0x80')]()};})[_0xd187('0x26')](respondWithResult(_0x357526,null))['catch'](handleError(_0x357526,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index b9e0018..6bb6fd5 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 _0x4df0=['define','analytics_default_reports','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports'];(function(_0x3d91fd,_0x3a768b){var _0x137a3a=function(_0x19f617){while(--_0x19f617){_0x3d91fd['push'](_0x3d91fd['shift']());}};_0x137a3a(++_0x3a768b);}(_0x4df0,0x147));var _0x04df=function(_0x373e24,_0x39b6ec){_0x373e24=_0x373e24-0x0;var _0xc1e49a=_0x4df0[_0x373e24];return _0xc1e49a;};'use strict';var _=require(_0x04df('0x0'));var util=require(_0x04df('0x1'));var logger=require('../../config/logger')(_0x04df('0x2'));var moment=require(_0x04df('0x3'));var BPromise=require(_0x04df('0x4'));var rp=require(_0x04df('0x5'));var fs=require('fs');var path=require(_0x04df('0x6'));var rimraf=require(_0x04df('0x7'));var config=require(_0x04df('0x8'));var attributes=require(_0x04df('0x9'));module[_0x04df('0xa')]=function(_0x1acaf2,_0x5628b5){return _0x1acaf2[_0x04df('0xb')]('AnalyticDefaultReport',attributes,{'tableName':_0x04df('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbeec=['define','util','moment','bluebird','request-promise','path','../../config/environment','./analyticDefaultReport.attributes','exports'];(function(_0x3987a1,_0x447793){var _0xe2596e=function(_0x546925){while(--_0x546925){_0x3987a1['push'](_0x3987a1['shift']());}};_0xe2596e(++_0x447793);}(_0xbeec,0x1b1));var _0xcbee=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xbeec[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xcbee('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xcbee('0x1'));var BPromise=require(_0xcbee('0x2'));var rp=require(_0xcbee('0x3'));var fs=require('fs');var path=require(_0xcbee('0x4'));var rimraf=require('rimraf');var config=require(_0xcbee('0x5'));var attributes=require(_0xcbee('0x6'));module[_0xcbee('0x7')]=function(_0x1ae1ed,_0x12c350){return _0x1ae1ed[_0xcbee('0x8')]('AnalyticDefaultReport',attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index c9a9d1a..920575a 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 _0x558d=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment'];(function(_0x4e2bbf,_0x13553f){var _0x17f18c=function(_0x46371a){while(--_0x46371a){_0x4e2bbf['push'](_0x4e2bbf['shift']());}};_0x17f18c(++_0x13553f);}(_0x558d,0x11c));var _0xd558=function(_0x431cf2,_0x1d4456){_0x431cf2=_0x431cf2-0x0;var _0x10c9a7=_0x558d[_0x431cf2];return _0x10c9a7;};'use strict';var _=require('lodash');var util=require(_0xd558('0x0'));var moment=require(_0xd558('0x1'));var BPromise=require('bluebird');var rs=require(_0xd558('0x2'));var fs=require('fs');var Redis=require(_0xd558('0x3'));var db=require(_0xd558('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd558('0x5'))(_0xd558('0x6'));var config=require(_0xd558('0x7'));var jayson=require(_0xd558('0x8'));var client=jayson[_0xd558('0x9')][_0xd558('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a47f4,_0x26584d,_0x338d04){return new BPromise(function(_0x327003,_0x332de4){return client[_0xd558('0xb')](_0x1a47f4,_0x338d04)['then'](function(_0x5f5123){logger[_0xd558('0xc')](_0xd558('0xd'),_0x26584d,_0xd558('0xe'));logger[_0xd558('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x26584d,_0xd558('0xe'),JSON[_0xd558('0x10')](_0x5f5123));if(_0x5f5123['error']){if(_0x5f5123[_0xd558('0x11')][_0xd558('0x12')]===0x1f4){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x26584d,_0x5f5123[_0xd558('0x11')]['message']);return _0x332de4(_0x5f5123['error'][_0xd558('0x13')]);}logger[_0xd558('0x11')](_0xd558('0xd'),_0x26584d,_0x5f5123['error'][_0xd558('0x13')]);return _0x327003(_0x5f5123['error'][_0xd558('0x13')]);}else{logger['info'](_0xd558('0xd'),_0x26584d,_0xd558('0xe'));_0x327003(_0x5f5123[_0xd558('0x14')]['message']);}})[_0xd558('0x15')](function(_0x5b7daa){logger['error'](_0xd558('0xd'),_0x26584d,_0x5b7daa);_0x332de4(_0x5b7daa);});});} \ No newline at end of file +var _0x91f7=['error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x91f7,0x1d2));var _0x791f=function(_0xe6e232,_0x57f511){_0xe6e232=_0xe6e232-0x0;var _0x577291=_0x91f7[_0xe6e232];return _0x577291;};'use strict';var _=require(_0x791f('0x0'));var util=require(_0x791f('0x1'));var moment=require(_0x791f('0x2'));var BPromise=require('bluebird');var rs=require(_0x791f('0x3'));var fs=require('fs');var Redis=require(_0x791f('0x4'));var db=require(_0x791f('0x5'))['db'];var utils=require(_0x791f('0x6'));var logger=require(_0x791f('0x7'))('rpc');var config=require(_0x791f('0x8'));var jayson=require(_0x791f('0x9'));var client=jayson[_0x791f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x304cbe,_0x4da03e,_0x3ff39e){return new BPromise(function(_0x1d024e,_0x5b8142){return client[_0x791f('0xb')](_0x304cbe,_0x3ff39e)[_0x791f('0xc')](function(_0x4cc66b){logger[_0x791f('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4da03e,_0x791f('0xe'));logger['debug'](_0x791f('0xf'),_0x4da03e,_0x791f('0xe'),JSON[_0x791f('0x10')](_0x4cc66b));if(_0x4cc66b[_0x791f('0x11')]){if(_0x4cc66b[_0x791f('0x11')][_0x791f('0x12')]===0x1f4){logger[_0x791f('0x11')](_0x791f('0x13'),_0x4da03e,_0x4cc66b[_0x791f('0x11')][_0x791f('0x14')]);return _0x5b8142(_0x4cc66b[_0x791f('0x11')][_0x791f('0x14')]);}logger[_0x791f('0x11')](_0x791f('0x13'),_0x4da03e,_0x4cc66b[_0x791f('0x11')][_0x791f('0x14')]);return _0x1d024e(_0x4cc66b[_0x791f('0x11')]['message']);}else{logger[_0x791f('0xd')](_0x791f('0x13'),_0x4da03e,_0x791f('0xe'));_0x1d024e(_0x4cc66b[_0x791f('0x15')]['message']);}})[_0x791f('0x16')](function(_0x35bf6d){logger[_0x791f('0x11')](_0x791f('0x13'),_0x4da03e,_0x35bf6d);_0x5b8142(_0x35bf6d);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index defb7e0..ac5598f 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 _0x836f=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','/:id','isAuthenticated','/:id/preview','preview','/:id/run','/:id/query','post','create','put','update','destroy'];(function(_0x557ff2,_0x5d76c7){var _0x578d53=function(_0x48191a){while(--_0x48191a){_0x557ff2['push'](_0x557ff2['shift']());}};_0x578d53(++_0x5d76c7);}(_0x836f,0x91));var _0xf836=function(_0x3cab13,_0x2e4c12){_0x3cab13=_0x3cab13-0x0;var _0x28d92e=_0x836f[_0x3cab13];return _0x28d92e;};'use strict';var multer=require(_0xf836('0x0'));var util=require(_0xf836('0x1'));var path=require(_0xf836('0x2'));var timeout=require(_0xf836('0x3'));var express=require(_0xf836('0x4'));var router=express[_0xf836('0x5')]();var fs_extra=require(_0xf836('0x6'));var auth=require(_0xf836('0x7'));var interaction=require(_0xf836('0x8'));var config=require(_0xf836('0x9'));var controller=require(_0xf836('0xa'));router[_0xf836('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf836('0xb')](_0xf836('0xc'),auth[_0xf836('0xd')](),controller['show']);router[_0xf836('0xb')](_0xf836('0xe'),auth[_0xf836('0xd')](),controller[_0xf836('0xf')]);router[_0xf836('0xb')](_0xf836('0x10'),auth[_0xf836('0xd')](),controller['run']);router[_0xf836('0xb')](_0xf836('0x11'),auth['isAuthenticated'](),controller['query']);router[_0xf836('0x12')]('/',auth[_0xf836('0xd')](),controller[_0xf836('0x13')]);router[_0xf836('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xf836('0x15')]);router['delete'](_0xf836('0xc'),auth['isAuthenticated'](),controller[_0xf836('0x16')]);module[_0xf836('0x17')]=router; \ No newline at end of file +var _0xa218=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','index','/:id/preview','isAuthenticated','preview','/:id/run','/:id/query','query','post','create','update','delete'];(function(_0x979a1c,_0x1abe1d){var _0x2d957b=function(_0x3cb073){while(--_0x3cb073){_0x979a1c['push'](_0x979a1c['shift']());}};_0x2d957b(++_0x1abe1d);}(_0xa218,0x12d));var _0x8a21=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xa218[_0x1694f5];return _0x5b4321;};'use strict';var multer=require(_0x8a21('0x0'));var util=require(_0x8a21('0x1'));var path=require(_0x8a21('0x2'));var timeout=require(_0x8a21('0x3'));var express=require('express');var router=express[_0x8a21('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8a21('0x5'));var interaction=require(_0x8a21('0x6'));var config=require(_0x8a21('0x7'));var controller=require(_0x8a21('0x8'));router[_0x8a21('0x9')]('/',auth['isAuthenticated'](),controller[_0x8a21('0xa')]);router[_0x8a21('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x8a21('0x9')](_0x8a21('0xb'),auth[_0x8a21('0xc')](),controller[_0x8a21('0xd')]);router['get'](_0x8a21('0xe'),auth[_0x8a21('0xc')](),controller['run']);router[_0x8a21('0x9')](_0x8a21('0xf'),auth['isAuthenticated'](),controller[_0x8a21('0x10')]);router[_0x8a21('0x11')]('/',auth[_0x8a21('0xc')](),controller[_0x8a21('0x12')]);router['put']('/:id',auth[_0x8a21('0xc')](),controller[_0x8a21('0x13')]);router[_0x8a21('0x14')]('/:id',auth[_0x8a21('0xc')](),controller[_0x8a21('0x15')]);module[_0x8a21('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 5194cc5..a2b4106 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 _0x056a=['pdf','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv'];(function(_0x1e9edf,_0x1596a4){var _0x45ef59=function(_0x26c937){while(--_0x26c937){_0x1e9edf['push'](_0x1e9edf['shift']());}};_0x45ef59(++_0x1596a4);}(_0x056a,0xe4));var _0xa056=function(_0x2a16f1,_0x308ac1){_0x2a16f1=_0x2a16f1-0x0;var _0x3b5904=_0x056a[_0x2a16f1];return _0x3b5904;};'use strict';var Sequelize=require(_0xa056('0x0'));var moment=require(_0xa056('0x1'));module[_0xa056('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xa056('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xa056('0x4')](_0xa056('0x5'),_0xa056('0x6'),'xlsx'),'allowNull':![],'defaultValue':_0xa056('0x5')},'savename':{'type':Sequelize[_0xa056('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xa056('0x7')]},'endDate':{'type':Sequelize[_0xa056('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0xa056('0x8')},'type':{'type':Sequelize[_0xa056('0x4')](_0xa056('0x9'),_0xa056('0xa')),'allowNull':![],'defaultValue':_0xa056('0x9')},'reportId':{'type':Sequelize[_0xa056('0xb')](0xb)[_0xa056('0xc')]},'reportType':{'type':Sequelize[_0xa056('0x3')]}}; \ No newline at end of file +var _0x99cb=['INTEGER','UNSIGNED','moment','STRING','csv','pdf','xlsx','DATE','Loading','ENUM','manual','scheduled'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x99cb,0x13a));var _0xb99c=function(_0x46e0e2,_0x48bb62){_0x46e0e2=_0x46e0e2-0x0;var _0x438e6c=_0x99cb[_0x46e0e2];return _0x438e6c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb99c('0x0'));module['exports']={'name':{'type':Sequelize[_0xb99c('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0xb99c('0x1')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xb99c('0x2'),_0xb99c('0x3'),_0xb99c('0x4')),'allowNull':![],'defaultValue':_0xb99c('0x2')},'savename':{'type':Sequelize[_0xb99c('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0xb99c('0x5')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0xb99c('0x1')],'defaultValue':_0xb99c('0x6')},'type':{'type':Sequelize[_0xb99c('0x7')](_0xb99c('0x8'),_0xb99c('0x9')),'allowNull':![],'defaultValue':_0xb99c('0x8')},'reportId':{'type':Sequelize[_0xb99c('0xa')](0xb)[_0xb99c('0xb')]},'reportType':{'type':Sequelize[_0xb99c('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 8d2a457..5d2a0e4 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 _0xa28c=['basename','savename','output','root','server/files/reports','Sequelize','exists','format','%s.%s','toLowerCase','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','set','apply','update','then','destroy','get','ExtractedReports','UserProfileResource','error','name','send','index','map','AnalyticExtractedReport','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','type','VIRTUAL','options','findAll','rows','show','params','includeAll','merge','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download'];(function(_0x3fe8f7,_0x63b432){var _0x424799=function(_0x41ef2e){while(--_0x41ef2e){_0x3fe8f7['push'](_0x3fe8f7['shift']());}};_0x424799(++_0x63b432);}(_0xa28c,0x127));var _0xca28=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xa28c[_0x13e741];return _0x3f8bb3;};'use strict';var emlformat=require(_0xca28('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xca28('0x1'));var jsonpatch=require(_0xca28('0x2'));var rp=require(_0xca28('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xca28('0x4'));var util=require(_0xca28('0x5'));var path=require(_0xca28('0x6'));var sox=require(_0xca28('0x7'));var csv=require(_0xca28('0x8'));var ejs=require(_0xca28('0x9'));var fs=require('fs');var fs_extra=require(_0xca28('0xa'));var _=require(_0xca28('0xb'));var squel=require('squel');var crypto=require(_0xca28('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xca28('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xca28('0xe'));var Redis=require(_0xca28('0xf'));var authService=require(_0xca28('0x10'));var qs=require(_0xca28('0x11'));var as=require(_0xca28('0x12'));var hardwareService=require(_0xca28('0x13'));var logger=require(_0xca28('0x14'))(_0xca28('0x15'));var utils=require(_0xca28('0x16'));var config=require(_0xca28('0x17'));var licenseUtil=require(_0xca28('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52c663,_0x3c28ab){_0x3c28ab=_0x3c28ab||0xcc;return function(_0x4f732f){if(_0x4f732f){return _0x52c663[_0xca28('0x19')](_0x3c28ab);}return _0x52c663[_0xca28('0x1a')](_0x3c28ab)[_0xca28('0x1b')]();};}function respondWithResult(_0x27c675,_0x1d2379){_0x1d2379=_0x1d2379||0xc8;return function(_0xde79c5){if(_0xde79c5){return _0x27c675['status'](_0x1d2379)[_0xca28('0x1c')](_0xde79c5);}};}function respondWithFilteredResult(_0x50c17c,_0xa146cc){return function(_0x504b3e){if(_0x504b3e){var _0x31a4dd=typeof _0xa146cc['offset']===_0xca28('0x1d')&&typeof _0xa146cc[_0xca28('0x1e')]===_0xca28('0x1d');var _0x5efc7f=_0x504b3e[_0xca28('0x1f')];var _0x56182a=_0x31a4dd?0x0:_0xa146cc['offset'];var _0x2ab5b5=_0x31a4dd?_0x504b3e[_0xca28('0x1f')]:_0xa146cc['offset']+_0xa146cc[_0xca28('0x1e')];var _0x2371b9;if(_0x2ab5b5>=_0x5efc7f){_0x2ab5b5=_0x5efc7f;_0x2371b9=0xc8;}else{_0x2371b9=0xce;}_0x50c17c[_0xca28('0x1a')](_0x2371b9);return _0x50c17c[_0xca28('0x20')]('Content-Range',_0x56182a+'-'+_0x2ab5b5+'/'+_0x5efc7f)[_0xca28('0x1c')](_0x504b3e);}return null;};}function patchUpdates(_0x50b9db){return function(_0x1e1dc5){try{jsonpatch[_0xca28('0x21')](_0x1e1dc5,_0x50b9db,!![]);}catch(_0x1cbdbb){return BPromise['reject'](_0x1cbdbb);}return _0x1e1dc5['save']();};}function saveUpdates(_0x148c87,_0x3e5f96){return function(_0x1398d9){if(_0x1398d9){return _0x1398d9[_0xca28('0x22')](_0x148c87)[_0xca28('0x23')](function(_0xcda208){return _0xcda208;});}return null;};}function removeEntity(_0x1fd377,_0x226fea){return function(_0x41979a){if(_0x41979a){return _0x41979a[_0xca28('0x24')]()[_0xca28('0x23')](function(){var _0x558f94=_0x41979a[_0xca28('0x25')]({'plain':!![]});var _0x37e12a=_0xca28('0x26');return db[_0xca28('0x27')][_0xca28('0x24')]({'where':{'type':_0x37e12a,'resourceId':_0x558f94['id']}})[_0xca28('0x23')](function(){return _0x41979a;});})['then'](function(){_0x1fd377['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xe9a3cb,_0x5dffae){return function(_0x447cbf){if(!_0x447cbf){_0xe9a3cb[_0xca28('0x19')](0x194);}return _0x447cbf;};}function handleError(_0x1a6e88,_0x4a959b){_0x4a959b=_0x4a959b||0x1f4;return function(_0x364f93){logger[_0xca28('0x28')](_0x364f93['stack']);if(_0x364f93['name']){delete _0x364f93[_0xca28('0x29')];}_0x1a6e88[_0xca28('0x1a')](_0x4a959b)[_0xca28('0x2a')](_0x364f93);};}exports[_0xca28('0x2b')]=function(_0x309457,_0x1f3d68){var _0xfab1d8={},_0x5c9b3f={},_0x3f1ebd={'count':0x0,'rows':[]};var _0x444e6d=_[_0xca28('0x2c')](db[_0xca28('0x2d')]['rawAttributes'],function(_0x4b9dc6){return{'name':_0x4b9dc6[_0xca28('0x2e')],'type':_0x4b9dc6['type'][_0xca28('0x2f')]};});_0x5c9b3f[_0xca28('0x30')]=_[_0xca28('0x2c')](_0x444e6d,_0xca28('0x29'));_0x5c9b3f[_0xca28('0x31')]=_[_0xca28('0x32')](_0x309457[_0xca28('0x31')]);_0x5c9b3f[_0xca28('0x33')]=_['intersection'](_0x5c9b3f[_0xca28('0x30')],_0x5c9b3f[_0xca28('0x31')]);_0xfab1d8['attributes']=_[_0xca28('0x34')](_0x5c9b3f[_0xca28('0x30')],qs[_0xca28('0x35')](_0x309457['query'][_0xca28('0x35')]));_0xfab1d8[_0xca28('0x36')]=_0xfab1d8[_0xca28('0x36')][_0xca28('0x37')]?_0xfab1d8[_0xca28('0x36')]:_0x5c9b3f[_0xca28('0x30')];if(!_0x309457[_0xca28('0x31')][_0xca28('0x38')](_0xca28('0x39'))){_0xfab1d8[_0xca28('0x1e')]=qs[_0xca28('0x1e')](_0x309457[_0xca28('0x31')][_0xca28('0x1e')]);_0xfab1d8[_0xca28('0x3a')]=qs[_0xca28('0x3a')](_0x309457[_0xca28('0x31')][_0xca28('0x3a')]);}_0xfab1d8[_0xca28('0x3b')]=qs[_0xca28('0x3c')](_0x309457['query'][_0xca28('0x3c')]);_0xfab1d8[_0xca28('0x3d')]=qs[_0xca28('0x33')](_[_0xca28('0x3e')](_0x309457['query'],_0x5c9b3f[_0xca28('0x33')]),_0x444e6d);if(_0x309457[_0xca28('0x31')][_0xca28('0x3f')]){_0xfab1d8[_0xca28('0x3d')]=_['merge'](_0xfab1d8[_0xca28('0x3d')],{'$or':_['map'](_0x444e6d,function(_0x43cce1){if(_0x43cce1[_0xca28('0x40')]!==_0xca28('0x41')){var _0x4801dd={};_0x4801dd[_0x43cce1[_0xca28('0x29')]]={'$like':'%'+_0x309457['query'][_0xca28('0x3f')]+'%'};return _0x4801dd;}})});}_0xfab1d8=_['merge']({},_0xfab1d8,_0x309457[_0xca28('0x42')]);var _0x5bb14e={'where':_0xfab1d8[_0xca28('0x3d')]};return db[_0xca28('0x2d')]['count'](_0x5bb14e)[_0xca28('0x23')](function(_0x2321cc){_0x3f1ebd[_0xca28('0x1f')]=_0x2321cc;if(_0x309457['query']['includeAll']){_0xfab1d8['include']=[{'all':!![]}];}return db[_0xca28('0x2d')][_0xca28('0x43')](_0xfab1d8);})[_0xca28('0x23')](function(_0x69502){_0x3f1ebd[_0xca28('0x44')]=_0x69502;return _0x3f1ebd;})['then'](respondWithFilteredResult(_0x1f3d68,_0xfab1d8))['catch'](handleError(_0x1f3d68,null));};exports[_0xca28('0x45')]=function(_0x1bb9ea,_0x2760b1){var _0x5949e4={'raw':!![],'where':{'id':_0x1bb9ea[_0xca28('0x46')]['id']}},_0x565198={};_0x565198[_0xca28('0x30')]=_[_0xca28('0x32')](db[_0xca28('0x2d')]['rawAttributes']);_0x565198['query']=_[_0xca28('0x32')](_0x1bb9ea['query']);_0x565198['filters']=_[_0xca28('0x34')](_0x565198[_0xca28('0x30')],_0x565198['query']);_0x5949e4['attributes']=_[_0xca28('0x34')](_0x565198[_0xca28('0x30')],qs['fields'](_0x1bb9ea[_0xca28('0x31')][_0xca28('0x35')]));_0x5949e4['attributes']=_0x5949e4['attributes']['length']?_0x5949e4['attributes']:_0x565198[_0xca28('0x30')];if(_0x1bb9ea[_0xca28('0x31')][_0xca28('0x47')]){_0x5949e4['include']=[{'all':!![]}];}_0x5949e4=_[_0xca28('0x48')]({},_0x5949e4,_0x1bb9ea[_0xca28('0x42')]);return db[_0xca28('0x2d')][_0xca28('0x49')](_0x5949e4)[_0xca28('0x23')](handleEntityNotFound(_0x2760b1,null))['then'](respondWithResult(_0x2760b1,null))[_0xca28('0x4a')](handleError(_0x2760b1,null));};exports[_0xca28('0x4b')]=function(_0x4dc426,_0x5f882){return db['AnalyticExtractedReport'][_0xca28('0x4b')](_0x4dc426[_0xca28('0x4c')],{})[_0xca28('0x23')](function(_0x54e87a){var _0x586a9d=_0x4dc426[_0xca28('0x4d')][_0xca28('0x25')]({'plain':!![]});if(!_0x586a9d)throw new Error(_0xca28('0x4e'));if(_0x586a9d[_0xca28('0x4f')]===_0xca28('0x4d')){var _0x5b74f3=_0x54e87a[_0xca28('0x25')]({'plain':!![]});var _0x949dab=_0xca28('0x26');return db[_0xca28('0x50')][_0xca28('0x49')]({'where':{'name':_0x949dab,'userProfileId':_0x586a9d[_0xca28('0x51')]},'raw':!![]})[_0xca28('0x23')](function(_0x1040ef){if(_0x1040ef&&_0x1040ef[_0xca28('0x52')]===0x0){return db[_0xca28('0x27')][_0xca28('0x4b')]({'name':_0x5b74f3[_0xca28('0x29')],'resourceId':_0x5b74f3['id'],'type':_0x1040ef[_0xca28('0x29')],'sectionId':_0x1040ef['id']},{})[_0xca28('0x23')](function(){return _0x54e87a;});}else{return _0x54e87a;}})[_0xca28('0x4a')](function(_0x4b0093){logger[_0xca28('0x28')](_0xca28('0x53'),_0x4b0093);throw _0x4b0093;});}return _0x54e87a;})[_0xca28('0x23')](respondWithResult(_0x5f882,0xc9))['catch'](handleError(_0x5f882,null));};exports[_0xca28('0x22')]=function(_0x24cb92,_0x196e31){if(_0x24cb92[_0xca28('0x4c')]['id']){delete _0x24cb92['body']['id'];}return db[_0xca28('0x2d')][_0xca28('0x49')]({'where':{'id':_0x24cb92[_0xca28('0x46')]['id']}})[_0xca28('0x23')](handleEntityNotFound(_0x196e31,null))['then'](saveUpdates(_0x24cb92[_0xca28('0x4c')],null))['then'](respondWithResult(_0x196e31,null))[_0xca28('0x4a')](handleError(_0x196e31,null));};exports[_0xca28('0x24')]=function(_0x3631d8,_0x3833cf){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x3631d8[_0xca28('0x46')]['id']}})['then'](handleEntityNotFound(_0x3833cf,null))[_0xca28('0x23')](removeEntity(_0x3833cf,null))[_0xca28('0x4a')](handleError(_0x3833cf,null));};exports[_0xca28('0x54')]=function(_0x3a370b,_0x599aae,_0x2cb5c3){return db[_0xca28('0x2d')][_0xca28('0x49')]({'where':{'id':_0x3a370b[_0xca28('0x46')]['id']},'attributes':[_0xca28('0x29'),_0xca28('0x55'),_0xca28('0x56'),_0xca28('0x57')],'raw':!![]})['then'](handleEntityNotFound(_0x599aae,null))[_0xca28('0x23')](function(_0x367f9a){if(_0x367f9a){if(!fs['existsSync'](path['join'](config[_0xca28('0x58')],_0xca28('0x59'),_0x367f9a[_0xca28('0x56')]))){throw new db[(_0xca28('0x5a'))]['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x3a370b['query'][_0xca28('0x5b')]){return _0x599aae[_0xca28('0x19')](0xc8);}return _0x599aae['download'](path['join'](config['root'],_0xca28('0x59'),_0x367f9a[_0xca28('0x56')]),util[_0xca28('0x5c')](_0xca28('0x5d'),_0x367f9a['basename']||_0x367f9a[_0xca28('0x29')],_0x367f9a[_0xca28('0x57')][_0xca28('0x5e')]()));}})[_0xca28('0x4a')](handleError(_0x599aae,null));}; \ No newline at end of file +var _0xcb0e=['download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','sendStatus','format','%s.%s','toLowerCase','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','filter','merge','type','options','includeAll','include','findAll','rows','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update'];(function(_0x519756,_0x288785){var _0x37047e=function(_0x3d64a7){while(--_0x3d64a7){_0x519756['push'](_0x519756['shift']());}};_0x37047e(++_0x288785);}(_0xcb0e,0x133));var _0xecb0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcb0e[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xecb0('0x0'));var rimraf=require(_0xecb0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xecb0('0x2'));var rp=require('request-promise');var moment=require(_0xecb0('0x3'));var BPromise=require(_0xecb0('0x4'));var Mustache=require(_0xecb0('0x5'));var util=require(_0xecb0('0x6'));var path=require('path');var sox=require(_0xecb0('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xecb0('0x8'));var _=require(_0xecb0('0x9'));var squel=require(_0xecb0('0xa'));var crypto=require(_0xecb0('0xb'));var jsforce=require(_0xecb0('0xc'));var deskjs=require(_0xecb0('0xd'));var toCsv=require(_0xecb0('0xe'));var querystring=require(_0xecb0('0xf'));var Papa=require('papaparse');var Redis=require(_0xecb0('0x10'));var authService=require(_0xecb0('0x11'));var qs=require(_0xecb0('0x12'));var as=require(_0xecb0('0x13'));var hardwareService=require(_0xecb0('0x14'));var logger=require(_0xecb0('0x15'))(_0xecb0('0x16'));var utils=require('../../config/utils');var config=require(_0xecb0('0x17'));var licenseUtil=require(_0xecb0('0x18'));var db=require(_0xecb0('0x19'))['db'];function respondWithStatusCode(_0x416fb0,_0x58bf00){_0x58bf00=_0x58bf00||0xcc;return function(_0x3418f3){if(_0x3418f3){return _0x416fb0['sendStatus'](_0x58bf00);}return _0x416fb0[_0xecb0('0x1a')](_0x58bf00)[_0xecb0('0x1b')]();};}function respondWithResult(_0x155637,_0x1a1b5a){_0x1a1b5a=_0x1a1b5a||0xc8;return function(_0x32f6e8){if(_0x32f6e8){return _0x155637[_0xecb0('0x1a')](_0x1a1b5a)[_0xecb0('0x1c')](_0x32f6e8);}};}function respondWithFilteredResult(_0x48d032,_0x4e809e){return function(_0x3e365f){if(_0x3e365f){var _0x43b3e5=typeof _0x4e809e['offset']===_0xecb0('0x1d')&&typeof _0x4e809e['limit']===_0xecb0('0x1d');var _0x566b94=_0x3e365f[_0xecb0('0x1e')];var _0x3f503d=_0x43b3e5?0x0:_0x4e809e[_0xecb0('0x1f')];var _0x5533c8=_0x43b3e5?_0x3e365f[_0xecb0('0x1e')]:_0x4e809e[_0xecb0('0x1f')]+_0x4e809e[_0xecb0('0x20')];var _0x5e9327;if(_0x5533c8>=_0x566b94){_0x5533c8=_0x566b94;_0x5e9327=0xc8;}else{_0x5e9327=0xce;}_0x48d032[_0xecb0('0x1a')](_0x5e9327);return _0x48d032['set'](_0xecb0('0x21'),_0x3f503d+'-'+_0x5533c8+'/'+_0x566b94)[_0xecb0('0x1c')](_0x3e365f);}return null;};}function patchUpdates(_0x2c4126){return function(_0x5f201b){try{jsonpatch[_0xecb0('0x22')](_0x5f201b,_0x2c4126,!![]);}catch(_0x4de767){return BPromise[_0xecb0('0x23')](_0x4de767);}return _0x5f201b[_0xecb0('0x24')]();};}function saveUpdates(_0x545ff3,_0x51dfbe){return function(_0xed4b4a){if(_0xed4b4a){return _0xed4b4a['update'](_0x545ff3)[_0xecb0('0x25')](function(_0x3ed9b7){return _0x3ed9b7;});}return null;};}function removeEntity(_0x289d84,_0x3373c6){return function(_0x564e8e){if(_0x564e8e){return _0x564e8e['destroy']()['then'](function(){var _0x31d819=_0x564e8e[_0xecb0('0x26')]({'plain':!![]});var _0x2d8c3e='ExtractedReports';return db[_0xecb0('0x27')][_0xecb0('0x28')]({'where':{'type':_0x2d8c3e,'resourceId':_0x31d819['id']}})[_0xecb0('0x25')](function(){return _0x564e8e;});})[_0xecb0('0x25')](function(){_0x289d84[_0xecb0('0x1a')](0xcc)[_0xecb0('0x1b')]();});}};}function handleEntityNotFound(_0x213e0f,_0x1efc02){return function(_0x25eb2e){if(!_0x25eb2e){_0x213e0f['sendStatus'](0x194);}return _0x25eb2e;};}function handleError(_0x49716d,_0x12edfb){_0x12edfb=_0x12edfb||0x1f4;return function(_0x3e7f22){logger[_0xecb0('0x29')](_0x3e7f22[_0xecb0('0x2a')]);if(_0x3e7f22['name']){delete _0x3e7f22[_0xecb0('0x2b')];}_0x49716d[_0xecb0('0x1a')](_0x12edfb)[_0xecb0('0x2c')](_0x3e7f22);};}exports[_0xecb0('0x2d')]=function(_0x424318,_0x270904){var _0x5ee0d3={},_0x422dfd={},_0x121653={'count':0x0,'rows':[]};var _0x2dc3c0=_[_0xecb0('0x2e')](db[_0xecb0('0x2f')][_0xecb0('0x30')],function(_0x3c670d){return{'name':_0x3c670d[_0xecb0('0x31')],'type':_0x3c670d['type']['key']};});_0x422dfd[_0xecb0('0x32')]=_[_0xecb0('0x2e')](_0x2dc3c0,'name');_0x422dfd[_0xecb0('0x33')]=_[_0xecb0('0x34')](_0x424318[_0xecb0('0x33')]);_0x422dfd['filters']=_[_0xecb0('0x35')](_0x422dfd['model'],_0x422dfd[_0xecb0('0x33')]);_0x5ee0d3[_0xecb0('0x36')]=_[_0xecb0('0x35')](_0x422dfd['model'],qs[_0xecb0('0x37')](_0x424318['query'][_0xecb0('0x37')]));_0x5ee0d3[_0xecb0('0x36')]=_0x5ee0d3[_0xecb0('0x36')][_0xecb0('0x38')]?_0x5ee0d3['attributes']:_0x422dfd[_0xecb0('0x32')];if(!_0x424318[_0xecb0('0x33')]['hasOwnProperty']('nolimit')){_0x5ee0d3[_0xecb0('0x20')]=qs[_0xecb0('0x20')](_0x424318['query'][_0xecb0('0x20')]);_0x5ee0d3[_0xecb0('0x1f')]=qs[_0xecb0('0x1f')](_0x424318[_0xecb0('0x33')]['offset']);}_0x5ee0d3[_0xecb0('0x39')]=qs[_0xecb0('0x3a')](_0x424318[_0xecb0('0x33')][_0xecb0('0x3a')]);_0x5ee0d3[_0xecb0('0x3b')]=qs[_0xecb0('0x3c')](_['pick'](_0x424318['query'],_0x422dfd[_0xecb0('0x3c')]),_0x2dc3c0);if(_0x424318['query'][_0xecb0('0x3d')]){_0x5ee0d3[_0xecb0('0x3b')]=_[_0xecb0('0x3e')](_0x5ee0d3[_0xecb0('0x3b')],{'$or':_['map'](_0x2dc3c0,function(_0x457b6d){if(_0x457b6d[_0xecb0('0x3f')]!=='VIRTUAL'){var _0x57b080={};_0x57b080[_0x457b6d[_0xecb0('0x2b')]]={'$like':'%'+_0x424318['query'][_0xecb0('0x3d')]+'%'};return _0x57b080;}})});}_0x5ee0d3=_[_0xecb0('0x3e')]({},_0x5ee0d3,_0x424318[_0xecb0('0x40')]);var _0x2dce16={'where':_0x5ee0d3['where']};return db[_0xecb0('0x2f')][_0xecb0('0x1e')](_0x2dce16)[_0xecb0('0x25')](function(_0x52a5ab){_0x121653[_0xecb0('0x1e')]=_0x52a5ab;if(_0x424318['query'][_0xecb0('0x41')]){_0x5ee0d3[_0xecb0('0x42')]=[{'all':!![]}];}return db[_0xecb0('0x2f')][_0xecb0('0x43')](_0x5ee0d3);})[_0xecb0('0x25')](function(_0xbe5246){_0x121653[_0xecb0('0x44')]=_0xbe5246;return _0x121653;})[_0xecb0('0x25')](respondWithFilteredResult(_0x270904,_0x5ee0d3))[_0xecb0('0x45')](handleError(_0x270904,null));};exports['show']=function(_0x59a249,_0x3afe75){var _0x1183f7={'raw':!![],'where':{'id':_0x59a249[_0xecb0('0x46')]['id']}},_0x5e57b5={};_0x5e57b5[_0xecb0('0x32')]=_[_0xecb0('0x34')](db['AnalyticExtractedReport'][_0xecb0('0x30')]);_0x5e57b5[_0xecb0('0x33')]=_['keys'](_0x59a249[_0xecb0('0x33')]);_0x5e57b5[_0xecb0('0x3c')]=_[_0xecb0('0x35')](_0x5e57b5[_0xecb0('0x32')],_0x5e57b5[_0xecb0('0x33')]);_0x1183f7['attributes']=_[_0xecb0('0x35')](_0x5e57b5['model'],qs[_0xecb0('0x37')](_0x59a249[_0xecb0('0x33')][_0xecb0('0x37')]));_0x1183f7[_0xecb0('0x36')]=_0x1183f7[_0xecb0('0x36')]['length']?_0x1183f7[_0xecb0('0x36')]:_0x5e57b5[_0xecb0('0x32')];if(_0x59a249['query'][_0xecb0('0x41')]){_0x1183f7[_0xecb0('0x42')]=[{'all':!![]}];}_0x1183f7=_[_0xecb0('0x3e')]({},_0x1183f7,_0x59a249['options']);return db['AnalyticExtractedReport']['find'](_0x1183f7)['then'](handleEntityNotFound(_0x3afe75,null))[_0xecb0('0x25')](respondWithResult(_0x3afe75,null))[_0xecb0('0x45')](handleError(_0x3afe75,null));};exports[_0xecb0('0x47')]=function(_0x8dc2a4,_0x566e24){return db[_0xecb0('0x2f')][_0xecb0('0x47')](_0x8dc2a4[_0xecb0('0x48')],{})[_0xecb0('0x25')](function(_0x370609){var _0x551865=_0x8dc2a4[_0xecb0('0x49')][_0xecb0('0x26')]({'plain':!![]});if(!_0x551865)throw new Error(_0xecb0('0x4a'));if(_0x551865[_0xecb0('0x4b')]===_0xecb0('0x49')){var _0xdbc50d=_0x370609[_0xecb0('0x26')]({'plain':!![]});var _0x5663f4=_0xecb0('0x4c');return db[_0xecb0('0x4d')][_0xecb0('0x4e')]({'where':{'name':_0x5663f4,'userProfileId':_0x551865['userProfileId']},'raw':!![]})['then'](function(_0x13e4c4){if(_0x13e4c4&&_0x13e4c4['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xdbc50d[_0xecb0('0x2b')],'resourceId':_0xdbc50d['id'],'type':_0x13e4c4[_0xecb0('0x2b')],'sectionId':_0x13e4c4['id']},{})[_0xecb0('0x25')](function(){return _0x370609;});}else{return _0x370609;}})[_0xecb0('0x45')](function(_0x3e1084){logger[_0xecb0('0x29')](_0xecb0('0x4f'),_0x3e1084);throw _0x3e1084;});}return _0x370609;})['then'](respondWithResult(_0x566e24,0xc9))[_0xecb0('0x45')](handleError(_0x566e24,null));};exports[_0xecb0('0x50')]=function(_0x3d7b92,_0x30ccec){if(_0x3d7b92['body']['id']){delete _0x3d7b92['body']['id'];}return db[_0xecb0('0x2f')][_0xecb0('0x4e')]({'where':{'id':_0x3d7b92['params']['id']}})[_0xecb0('0x25')](handleEntityNotFound(_0x30ccec,null))[_0xecb0('0x25')](saveUpdates(_0x3d7b92['body'],null))[_0xecb0('0x25')](respondWithResult(_0x30ccec,null))['catch'](handleError(_0x30ccec,null));};exports[_0xecb0('0x28')]=function(_0x1a7fc8,_0x121780){return db[_0xecb0('0x2f')]['find']({'where':{'id':_0x1a7fc8['params']['id']}})['then'](handleEntityNotFound(_0x121780,null))['then'](removeEntity(_0x121780,null))[_0xecb0('0x45')](handleError(_0x121780,null));};exports[_0xecb0('0x51')]=function(_0x4cf077,_0x441f13,_0x23b414){return db[_0xecb0('0x2f')]['find']({'where':{'id':_0x4cf077[_0xecb0('0x46')]['id']},'attributes':[_0xecb0('0x2b'),_0xecb0('0x52'),_0xecb0('0x53'),_0xecb0('0x54')],'raw':!![]})[_0xecb0('0x25')](handleEntityNotFound(_0x441f13,null))['then'](function(_0x2b7efc){if(_0x2b7efc){if(!fs[_0xecb0('0x55')](path[_0xecb0('0x56')](config[_0xecb0('0x57')],_0xecb0('0x58'),_0x2b7efc[_0xecb0('0x53')]))){throw new db[(_0xecb0('0x59'))][(_0xecb0('0x5a'))](_0xecb0('0x5b'));}if(_0x4cf077[_0xecb0('0x33')][_0xecb0('0x5c')]){return _0x441f13[_0xecb0('0x5d')](0xc8);}return _0x441f13[_0xecb0('0x51')](path[_0xecb0('0x56')](config[_0xecb0('0x57')],_0xecb0('0x58'),_0x2b7efc[_0xecb0('0x53')]),util[_0xecb0('0x5e')](_0xecb0('0x5f'),_0x2b7efc[_0xecb0('0x52')]||_0x2b7efc[_0xecb0('0x2b')],_0x2b7efc[_0xecb0('0x54')][_0xecb0('0x60')]()));}})['catch'](handleError(_0x441f13,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 3460cfa..46d5741 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 _0x0b7f=['../../config/environment','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x22d68a,_0x3f6978){var _0x131c53=function(_0x1781dc){while(--_0x1781dc){_0x22d68a['push'](_0x22d68a['shift']());}};_0x131c53(++_0x3f6978);}(_0x0b7f,0xae));var _0xf0b7=function(_0x211f4e,_0x41fa9c){_0x211f4e=_0x211f4e-0x0;var _0x2cda9c=_0x0b7f[_0x211f4e];return _0x2cda9c;};'use strict';var _=require(_0xf0b7('0x0'));var util=require(_0xf0b7('0x1'));var logger=require(_0xf0b7('0x2'))('api');var moment=require(_0xf0b7('0x3'));var BPromise=require(_0xf0b7('0x4'));var rp=require(_0xf0b7('0x5'));var fs=require('fs');var path=require(_0xf0b7('0x6'));var rimraf=require(_0xf0b7('0x7'));var config=require(_0xf0b7('0x8'));var attributes=require(_0xf0b7('0x9'));module[_0xf0b7('0xa')]=function(_0x2c5407,_0xc0c8b8){return _0x2c5407['define'](_0xf0b7('0xb'),attributes,{'tableName':_0xf0b7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3fce=['./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x245afe,_0x319cde){var _0x4eefde=function(_0x15a1fa){while(--_0x15a1fa){_0x245afe['push'](_0x245afe['shift']());}};_0x4eefde(++_0x319cde);}(_0x3fce,0x1a2));var _0xe3fc=function(_0x2b3478,_0x58afd7){_0x2b3478=_0x2b3478-0x0;var _0x1c106f=_0x3fce[_0x2b3478];return _0x1c106f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe3fc('0x0'))(_0xe3fc('0x1'));var moment=require(_0xe3fc('0x2'));var BPromise=require(_0xe3fc('0x3'));var rp=require(_0xe3fc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe3fc('0x5'));module[_0xe3fc('0x6')]=function(_0x536683,_0x488256){return _0x536683[_0xe3fc('0x7')](_0xe3fc('0x8'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 249b537..dafbb7d 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 _0x317f=['message','AnalyticExtractedReport,\x20%s,\x20%s','result','catch','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','error'];(function(_0x24450e,_0x420ab9){var _0x7cf367=function(_0x3321a7){while(--_0x3321a7){_0x24450e['push'](_0x24450e['shift']());}};_0x7cf367(++_0x420ab9);}(_0x317f,0x17e));var _0xf317=function(_0x5e9e3d,_0x567718){_0x5e9e3d=_0x5e9e3d-0x0;var _0x579c2c=_0x317f[_0x5e9e3d];return _0x579c2c;};'use strict';var _=require('lodash');var util=require(_0xf317('0x0'));var moment=require(_0xf317('0x1'));var BPromise=require(_0xf317('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf317('0x3'));var db=require(_0xf317('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf317('0x5'));var config=require('../../config/environment');var jayson=require(_0xf317('0x6'));var client=jayson['client'][_0xf317('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4f6a74,_0x328145,_0x1ffff9){return new BPromise(function(_0x5b74dd,_0x5e9183){return client[_0xf317('0x8')](_0x4f6a74,_0x1ffff9)[_0xf317('0x9')](function(_0x3ae37c){logger[_0xf317('0xa')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x328145,_0xf317('0xb'));logger[_0xf317('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x328145,_0xf317('0xb'),JSON['stringify'](_0x3ae37c));if(_0x3ae37c['error']){if(_0x3ae37c[_0xf317('0xd')]['code']===0x1f4){logger[_0xf317('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x328145,_0x3ae37c[_0xf317('0xd')]['message']);return _0x5e9183(_0x3ae37c[_0xf317('0xd')][_0xf317('0xe')]);}logger['error'](_0xf317('0xf'),_0x328145,_0x3ae37c[_0xf317('0xd')][_0xf317('0xe')]);return _0x5b74dd(_0x3ae37c[_0xf317('0xd')][_0xf317('0xe')]);}else{logger[_0xf317('0xa')](_0xf317('0xf'),_0x328145,_0xf317('0xb'));_0x5b74dd(_0x3ae37c[_0xf317('0x10')][_0xf317('0xe')]);}})[_0xf317('0x11')](function(_0x23ecc2){logger['error'](_0xf317('0xf'),_0x328145,_0x23ecc2);_0x5e9183(_0x23ecc2);});});} \ No newline at end of file +var _0xb118=['message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','stringify','code','error'];(function(_0x4c8e32,_0x3fd15b){var _0xc61882=function(_0x1f68c0){while(--_0x1f68c0){_0x4c8e32['push'](_0x4c8e32['shift']());}};_0xc61882(++_0x3fd15b);}(_0xb118,0x1e8));var _0x8b11=function(_0x2c2863,_0x4487b6){_0x2c2863=_0x2c2863-0x0;var _0x4a4337=_0xb118[_0x2c2863];return _0x4a4337;};'use strict';var _=require('lodash');var util=require(_0x8b11('0x0'));var moment=require(_0x8b11('0x1'));var BPromise=require(_0x8b11('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b11('0x3'));var db=require(_0x8b11('0x4'))['db'];var utils=require(_0x8b11('0x5'));var logger=require(_0x8b11('0x6'))(_0x8b11('0x7'));var config=require(_0x8b11('0x8'));var jayson=require(_0x8b11('0x9'));var client=jayson[_0x8b11('0xa')][_0x8b11('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f6eaf,_0x19f623,_0x118408){return new BPromise(function(_0x23150b,_0x4a20af){return client['request'](_0x1f6eaf,_0x118408)[_0x8b11('0xc')](function(_0x4ece1d){logger['info'](_0x8b11('0xd'),_0x19f623,_0x8b11('0xe'));logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x19f623,'request\x20sent',JSON[_0x8b11('0xf')](_0x4ece1d));if(_0x4ece1d['error']){if(_0x4ece1d['error'][_0x8b11('0x10')]===0x1f4){logger[_0x8b11('0x11')](_0x8b11('0xd'),_0x19f623,_0x4ece1d[_0x8b11('0x11')][_0x8b11('0x12')]);return _0x4a20af(_0x4ece1d[_0x8b11('0x11')][_0x8b11('0x12')]);}logger[_0x8b11('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x19f623,_0x4ece1d['error'][_0x8b11('0x12')]);return _0x23150b(_0x4ece1d[_0x8b11('0x11')][_0x8b11('0x12')]);}else{logger[_0x8b11('0x13')](_0x8b11('0xd'),_0x19f623,_0x8b11('0xe'));_0x23150b(_0x4ece1d[_0x8b11('0x14')][_0x8b11('0x12')]);}})[_0x8b11('0x15')](function(_0x36fbc0){logger['error'](_0x8b11('0xd'),_0x19f623,_0x36fbc0);_0x4a20af(_0x36fbc0);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 603822e..5d910ad 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 _0x46f2=['download','post','create','put','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','get','isAuthenticated','index','/:id','/:id/download'];(function(_0x477e7e,_0x2929d4){var _0xd97cd0=function(_0x159537){while(--_0x159537){_0x477e7e['push'](_0x477e7e['shift']());}};_0xd97cd0(++_0x2929d4);}(_0x46f2,0xf5));var _0x246f=function(_0x3862e6,_0x168099){_0x3862e6=_0x3862e6-0x0;var _0x50b550=_0x46f2[_0x3862e6];return _0x50b550;};'use strict';var multer=require(_0x246f('0x0'));var util=require('util');var path=require(_0x246f('0x1'));var timeout=require(_0x246f('0x2'));var express=require('express');var router=express[_0x246f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x246f('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router[_0x246f('0x5')]('/',auth[_0x246f('0x6')](),controller[_0x246f('0x7')]);router['get'](_0x246f('0x8'),auth[_0x246f('0x6')](),controller['show']);router[_0x246f('0x5')](_0x246f('0x9'),auth[_0x246f('0x6')](),controller[_0x246f('0xa')]);router[_0x246f('0xb')]('/',auth[_0x246f('0x6')](),controller[_0x246f('0xc')]);router[_0x246f('0xd')](_0x246f('0x8'),auth[_0x246f('0x6')](),controller['update']);router[_0x246f('0xe')](_0x246f('0x8'),auth[_0x246f('0x6')](),controller[_0x246f('0xf')]);module[_0x246f('0x10')]=router; \ No newline at end of file +var _0x1489=['download','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','index','/:id','isAuthenticated','show','/:id/download'];(function(_0x15b2dd,_0x2f462e){var _0x3b7961=function(_0xea4c3b){while(--_0xea4c3b){_0x15b2dd['push'](_0x15b2dd['shift']());}};_0x3b7961(++_0x2f462e);}(_0x1489,0x1d3));var _0x9148=function(_0x59ddb0,_0x2081c3){_0x59ddb0=_0x59ddb0-0x0;var _0x1dba64=_0x1489[_0x59ddb0];return _0x1dba64;};'use strict';var multer=require(_0x9148('0x0'));var util=require(_0x9148('0x1'));var path=require(_0x9148('0x2'));var timeout=require(_0x9148('0x3'));var express=require(_0x9148('0x4'));var router=express[_0x9148('0x5')]();var fs_extra=require(_0x9148('0x6'));var auth=require(_0x9148('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x9148('0x8'));var controller=require(_0x9148('0x9'));router[_0x9148('0xa')]('/',auth['isAuthenticated'](),controller[_0x9148('0xb')]);router['get'](_0x9148('0xc'),auth[_0x9148('0xd')](),controller[_0x9148('0xe')]);router[_0x9148('0xa')](_0x9148('0xf'),auth[_0x9148('0xd')](),controller[_0x9148('0x10')]);router[_0x9148('0x11')]('/',auth[_0x9148('0xd')](),controller[_0x9148('0x12')]);router[_0x9148('0x13')](_0x9148('0xc'),auth['isAuthenticated'](),controller[_0x9148('0x14')]);router[_0x9148('0x15')](_0x9148('0xc'),auth[_0x9148('0xd')](),controller[_0x9148('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 745b114..60a402b 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 _0x389a=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x37914d,_0x4209c0){var _0x2b4118=function(_0x10de2){while(--_0x10de2){_0x37914d['push'](_0x37914d['shift']());}};_0x2b4118(++_0x4209c0);}(_0x389a,0x7a));var _0xa389=function(_0x285541,_0x48b48f){_0x285541=_0x285541-0x0;var _0x2f20b4=_0x389a[_0x285541];return _0x2f20b4;};'use strict';var Sequelize=require(_0xa389('0x0'));module[_0xa389('0x1')]={'field':{'type':Sequelize[_0xa389('0x2')]},'alias':{'type':Sequelize[_0xa389('0x3')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xa389('0x3')]},'custom':{'type':Sequelize[_0xa389('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x542a=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x26481b,_0x19a851){var _0x5890a9=function(_0x266290){while(--_0x266290){_0x26481b['push'](_0x26481b['shift']());}};_0x5890a9(++_0x19a851);}(_0x542a,0xbc));var _0xa542=function(_0x2bd34a,_0xd8f721){_0x2bd34a=_0x2bd34a-0x0;var _0x5497bc=_0x542a[_0x2bd34a];return _0x5497bc;};'use strict';var Sequelize=require(_0xa542('0x0'));module[_0xa542('0x1')]={'field':{'type':Sequelize[_0xa542('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xa542('0x3')]},'format':{'type':Sequelize[_0xa542('0x3')]},'groupBy':{'type':Sequelize[_0xa542('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xa542('0x3')]},'custom':{'type':Sequelize[_0xa542('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 83bcb22..8899b42 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 _0x9d14=['rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','send','index','AnalyticFieldReport','rawAttributes','type','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','bulkCreate','bulkDestroy','ids','addFields','sequelize','transaction','CustomReportId','eml-format'];(function(_0x3562a3,_0x11ec75){var _0x1ffc21=function(_0x291631){while(--_0x291631){_0x3562a3['push'](_0x3562a3['shift']());}};_0x1ffc21(++_0x11ec75);}(_0x9d14,0x1cd));var _0x49d1=function(_0x276ce1,_0x2846f8){_0x276ce1=_0x276ce1-0x0;var _0x301c54=_0x9d14[_0x276ce1];return _0x301c54;};'use strict';var emlformat=require(_0x49d1('0x0'));var rimraf=require(_0x49d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x49d1('0x2'));var rp=require(_0x49d1('0x3'));var moment=require('moment');var BPromise=require(_0x49d1('0x4'));var Mustache=require(_0x49d1('0x5'));var util=require(_0x49d1('0x6'));var path=require('path');var sox=require(_0x49d1('0x7'));var csv=require(_0x49d1('0x8'));var ejs=require(_0x49d1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x49d1('0xa'));var squel=require(_0x49d1('0xb'));var crypto=require(_0x49d1('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x49d1('0xd'));var Redis=require(_0x49d1('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x49d1('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x49d1('0x10'));var config=require(_0x49d1('0x11'));var licenseUtil=require(_0x49d1('0x12'));var db=require(_0x49d1('0x13'))['db'];function respondWithStatusCode(_0x456063,_0x1f8d79){_0x1f8d79=_0x1f8d79||0xcc;return function(_0x14a112){if(_0x14a112){return _0x456063[_0x49d1('0x14')](_0x1f8d79);}return _0x456063['status'](_0x1f8d79)[_0x49d1('0x15')]();};}function respondWithResult(_0x324101,_0x2ed474){_0x2ed474=_0x2ed474||0xc8;return function(_0x267704){if(_0x267704){return _0x324101[_0x49d1('0x16')](_0x2ed474)[_0x49d1('0x17')](_0x267704);}};}function respondWithFilteredResult(_0x308ab9,_0xcf1e2e){return function(_0x3f2508){if(_0x3f2508){var _0x5735eb=typeof _0xcf1e2e[_0x49d1('0x18')]===_0x49d1('0x19')&&typeof _0xcf1e2e[_0x49d1('0x1a')]==='undefined';var _0x104d9f=_0x3f2508[_0x49d1('0x1b')];var _0x1b6c24=_0x5735eb?0x0:_0xcf1e2e[_0x49d1('0x18')];var _0x5d64b8=_0x5735eb?_0x3f2508['count']:_0xcf1e2e[_0x49d1('0x18')]+_0xcf1e2e['limit'];var _0x592e2d;if(_0x5d64b8>=_0x104d9f){_0x5d64b8=_0x104d9f;_0x592e2d=0xc8;}else{_0x592e2d=0xce;}_0x308ab9[_0x49d1('0x16')](_0x592e2d);return _0x308ab9[_0x49d1('0x1c')]('Content-Range',_0x1b6c24+'-'+_0x5d64b8+'/'+_0x104d9f)[_0x49d1('0x17')](_0x3f2508);}return null;};}function patchUpdates(_0x98456e){return function(_0x45e83f){try{jsonpatch[_0x49d1('0x1d')](_0x45e83f,_0x98456e,!![]);}catch(_0x57e542){return BPromise['reject'](_0x57e542);}return _0x45e83f[_0x49d1('0x1e')]();};}function saveUpdates(_0x194821,_0x8fd12b){return function(_0x53b0b2){if(_0x53b0b2){return _0x53b0b2[_0x49d1('0x1f')](_0x194821)[_0x49d1('0x20')](function(_0x75b35b){return _0x75b35b;});}return null;};}function removeEntity(_0x33b4a6,_0x461b2e){return function(_0x53b568){if(_0x53b568){return _0x53b568[_0x49d1('0x21')]()[_0x49d1('0x20')](function(){_0x33b4a6[_0x49d1('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x322b66,_0x45ee9e){return function(_0x138836){if(!_0x138836){_0x322b66[_0x49d1('0x14')](0x194);}return _0x138836;};}function handleError(_0x96a7af,_0x32a7a1){_0x32a7a1=_0x32a7a1||0x1f4;return function(_0x184c4e){logger[_0x49d1('0x22')](_0x184c4e[_0x49d1('0x23')]);if(_0x184c4e[_0x49d1('0x24')]){delete _0x184c4e[_0x49d1('0x24')];}_0x96a7af[_0x49d1('0x16')](_0x32a7a1)[_0x49d1('0x25')](_0x184c4e);};}exports[_0x49d1('0x26')]=function(_0x3e27c3,_0x5beab3){var _0x585fe9={},_0x3b76f4={},_0x7354bd={'count':0x0,'rows':[]};var _0x522934=_['map'](db[_0x49d1('0x27')][_0x49d1('0x28')],function(_0x2aea83){return{'name':_0x2aea83['fieldName'],'type':_0x2aea83[_0x49d1('0x29')][_0x49d1('0x2a')]};});_0x3b76f4[_0x49d1('0x2b')]=_[_0x49d1('0x2c')](_0x522934,_0x49d1('0x24'));_0x3b76f4['query']=_[_0x49d1('0x2d')](_0x3e27c3[_0x49d1('0x2e')]);_0x3b76f4['filters']=_[_0x49d1('0x2f')](_0x3b76f4[_0x49d1('0x2b')],_0x3b76f4[_0x49d1('0x2e')]);_0x585fe9[_0x49d1('0x30')]=_['intersection'](_0x3b76f4[_0x49d1('0x2b')],qs[_0x49d1('0x31')](_0x3e27c3[_0x49d1('0x2e')][_0x49d1('0x31')]));_0x585fe9[_0x49d1('0x30')]=_0x585fe9[_0x49d1('0x30')]['length']?_0x585fe9[_0x49d1('0x30')]:_0x3b76f4[_0x49d1('0x2b')];if(!_0x3e27c3['query'][_0x49d1('0x32')](_0x49d1('0x33'))){_0x585fe9[_0x49d1('0x1a')]=qs['limit'](_0x3e27c3[_0x49d1('0x2e')][_0x49d1('0x1a')]);_0x585fe9[_0x49d1('0x18')]=qs[_0x49d1('0x18')](_0x3e27c3['query'][_0x49d1('0x18')]);}_0x585fe9[_0x49d1('0x34')]=qs[_0x49d1('0x35')](_0x3e27c3[_0x49d1('0x2e')][_0x49d1('0x35')]);_0x585fe9[_0x49d1('0x36')]=qs[_0x49d1('0x37')](_[_0x49d1('0x38')](_0x3e27c3[_0x49d1('0x2e')],_0x3b76f4['filters']),_0x522934);if(_0x3e27c3[_0x49d1('0x2e')][_0x49d1('0x39')]){_0x585fe9[_0x49d1('0x36')]=_[_0x49d1('0x3a')](_0x585fe9[_0x49d1('0x36')],{'$or':_[_0x49d1('0x2c')](_0x522934,function(_0x38dc21){if(_0x38dc21[_0x49d1('0x29')]!=='VIRTUAL'){var _0x51c524={};_0x51c524[_0x38dc21[_0x49d1('0x24')]]={'$like':'%'+_0x3e27c3[_0x49d1('0x2e')][_0x49d1('0x39')]+'%'};return _0x51c524;}})});}_0x585fe9=_[_0x49d1('0x3a')]({},_0x585fe9,_0x3e27c3[_0x49d1('0x3b')]);var _0x2a4fee={'where':_0x585fe9[_0x49d1('0x36')]};return db[_0x49d1('0x27')][_0x49d1('0x1b')](_0x2a4fee)['then'](function(_0x2cb22d){_0x7354bd[_0x49d1('0x1b')]=_0x2cb22d;if(_0x3e27c3['query'][_0x49d1('0x3c')]){_0x585fe9['include']=[{'all':!![]}];}return db[_0x49d1('0x27')][_0x49d1('0x3d')](_0x585fe9);})[_0x49d1('0x20')](function(_0x2d238e){_0x7354bd[_0x49d1('0x3e')]=_0x2d238e;return _0x7354bd;})[_0x49d1('0x20')](respondWithFilteredResult(_0x5beab3,_0x585fe9))['catch'](handleError(_0x5beab3,null));};exports[_0x49d1('0x3f')]=function(_0x304696,_0x119797){var _0x1d689d={'raw':![],'where':{'id':_0x304696[_0x49d1('0x40')]['id']}},_0x53ec51={};_0x53ec51[_0x49d1('0x2b')]=_['keys'](db[_0x49d1('0x27')][_0x49d1('0x28')]);_0x53ec51['query']=_[_0x49d1('0x2d')](_0x304696[_0x49d1('0x2e')]);_0x53ec51['filters']=_[_0x49d1('0x2f')](_0x53ec51['model'],_0x53ec51['query']);_0x1d689d[_0x49d1('0x30')]=_['intersection'](_0x53ec51[_0x49d1('0x2b')],qs[_0x49d1('0x31')](_0x304696[_0x49d1('0x2e')][_0x49d1('0x31')]));_0x1d689d[_0x49d1('0x30')]=_0x1d689d[_0x49d1('0x30')]['length']?_0x1d689d[_0x49d1('0x30')]:_0x53ec51[_0x49d1('0x2b')];if(_0x304696['query'][_0x49d1('0x3c')]){_0x1d689d[_0x49d1('0x41')]=[{'all':!![]}];}_0x1d689d=_['merge']({},_0x1d689d,_0x304696[_0x49d1('0x3b')]);return db[_0x49d1('0x27')][_0x49d1('0x42')](_0x1d689d)['then'](handleEntityNotFound(_0x119797,null))[_0x49d1('0x20')](respondWithResult(_0x119797,null))[_0x49d1('0x43')](handleError(_0x119797,null));};exports[_0x49d1('0x44')]=function(_0x579b5c,_0x4bffea){return db['AnalyticFieldReport'][_0x49d1('0x44')](_0x579b5c[_0x49d1('0x45')],{})[_0x49d1('0x20')](respondWithResult(_0x4bffea,0xc9))['catch'](handleError(_0x4bffea,null));};exports[_0x49d1('0x46')]=function(_0x16ee95,_0x4d51c5){return db[_0x49d1('0x27')]['bulkCreate'](_0x16ee95[_0x49d1('0x45')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x4d51c5,0xc9))[_0x49d1('0x43')](handleError(_0x4d51c5,null));};exports[_0x49d1('0x1f')]=function(_0x5ca011,_0x5cc4c7){if(_0x5ca011[_0x49d1('0x45')]['id']){delete _0x5ca011['body']['id'];}return db['AnalyticFieldReport'][_0x49d1('0x42')]({'where':{'id':_0x5ca011[_0x49d1('0x40')]['id']}})[_0x49d1('0x20')](handleEntityNotFound(_0x5cc4c7,null))[_0x49d1('0x20')](saveUpdates(_0x5ca011[_0x49d1('0x45')],null))[_0x49d1('0x20')](respondWithResult(_0x5cc4c7,null))[_0x49d1('0x43')](handleError(_0x5cc4c7,null));};exports[_0x49d1('0x21')]=function(_0x5e9cd9,_0x3e8441){return db[_0x49d1('0x27')]['find']({'where':{'id':_0x5e9cd9[_0x49d1('0x40')]['id']}})[_0x49d1('0x20')](handleEntityNotFound(_0x3e8441,null))[_0x49d1('0x20')](removeEntity(_0x3e8441,null))[_0x49d1('0x43')](handleError(_0x3e8441,null));};exports[_0x49d1('0x47')]=function(_0x19704b,_0x4b1852){return db['AnalyticFieldReport'][_0x49d1('0x21')]({'where':{'id':_0x19704b[_0x49d1('0x2e')][_0x49d1('0x48')]||[]},'raw':![],'individualHooks':!![]})[_0x49d1('0x20')](respondWithResult(_0x4b1852,0xcc))[_0x49d1('0x43')](handleError(_0x4b1852,null));};exports[_0x49d1('0x49')]=function(_0xe877d9,_0x1a5135,_0x42f5c1){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0xe877d9[_0x49d1('0x40')]['id']}})[_0x49d1('0x20')](handleEntityNotFound(_0x1a5135,null))[_0x49d1('0x20')](function(_0x3bc8e1){if(_0x3bc8e1){return db[_0x49d1('0x4a')][_0x49d1('0x4b')](function(_0xb78a47){return db[_0x49d1('0x27')][_0x49d1('0x21')]({'where':{'CustomReportId':_0xe877d9[_0x49d1('0x40')]['id']},'transaction':_0xb78a47})[_0x49d1('0x20')](function(_0x44639e){var _0x5da8e5=_[_0x49d1('0x2c')](_0xe877d9[_0x49d1('0x45')],function(_0xe8072b){delete _0xe8072b['id'];_0xe8072b[_0x49d1('0x4c')]=_0xe877d9[_0x49d1('0x40')]['id'];return _0xe8072b;});return db[_0x49d1('0x27')]['bulkCreate'](_0x5da8e5,{'transaction':_0xb78a47});});})['then'](function(){return db[_0x49d1('0x27')][_0x49d1('0x3d')]({'where':{'CustomReportId':_0xe877d9[_0x49d1('0x40')]['id']}});});}})[_0x49d1('0x20')](respondWithResult(_0x1a5135,null))['catch'](handleError(_0x1a5135,null));}; \ No newline at end of file +var _0x4fae=['zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','end','stack','name','map','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','AnalyticFieldReport','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','bulkCreate','update','params','ids','findOne','sequelize','transaction','eml-format','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4fae,0x19d));var _0xe4fa=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x4fae[_0x599f41];return _0x2e4d58;};'use strict';var emlformat=require(_0xe4fa('0x0'));var rimraf=require(_0xe4fa('0x1'));var zipdir=require(_0xe4fa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe4fa('0x3'));var moment=require(_0xe4fa('0x4'));var BPromise=require(_0xe4fa('0x5'));var Mustache=require(_0xe4fa('0x6'));var util=require(_0xe4fa('0x7'));var path=require(_0xe4fa('0x8'));var sox=require(_0xe4fa('0x9'));var csv=require(_0xe4fa('0xa'));var ejs=require(_0xe4fa('0xb'));var fs=require('fs');var fs_extra=require(_0xe4fa('0xc'));var _=require(_0xe4fa('0xd'));var squel=require(_0xe4fa('0xe'));var crypto=require('crypto');var jsforce=require(_0xe4fa('0xf'));var deskjs=require(_0xe4fa('0x10'));var toCsv=require(_0xe4fa('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe4fa('0x11'));var authService=require(_0xe4fa('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe4fa('0x13'));var hardwareService=require(_0xe4fa('0x14'));var logger=require(_0xe4fa('0x15'))(_0xe4fa('0x16'));var utils=require(_0xe4fa('0x17'));var config=require(_0xe4fa('0x18'));var licenseUtil=require(_0xe4fa('0x19'));var db=require(_0xe4fa('0x1a'))['db'];function respondWithStatusCode(_0x1affa1,_0x3f1828){_0x3f1828=_0x3f1828||0xcc;return function(_0x2a2aea){if(_0x2a2aea){return _0x1affa1[_0xe4fa('0x1b')](_0x3f1828);}return _0x1affa1[_0xe4fa('0x1c')](_0x3f1828)['end']();};}function respondWithResult(_0x51ade1,_0x28b75a){_0x28b75a=_0x28b75a||0xc8;return function(_0xe47c1b){if(_0xe47c1b){return _0x51ade1['status'](_0x28b75a)[_0xe4fa('0x1d')](_0xe47c1b);}};}function respondWithFilteredResult(_0x3a18e6,_0x3e1dba){return function(_0x46da2a){if(_0x46da2a){var _0x531c40=typeof _0x3e1dba[_0xe4fa('0x1e')]===_0xe4fa('0x1f')&&typeof _0x3e1dba[_0xe4fa('0x20')]==='undefined';var _0x29a88b=_0x46da2a['count'];var _0x2cb54d=_0x531c40?0x0:_0x3e1dba[_0xe4fa('0x1e')];var _0x35097d=_0x531c40?_0x46da2a[_0xe4fa('0x21')]:_0x3e1dba[_0xe4fa('0x1e')]+_0x3e1dba['limit'];var _0x1bd51f;if(_0x35097d>=_0x29a88b){_0x35097d=_0x29a88b;_0x1bd51f=0xc8;}else{_0x1bd51f=0xce;}_0x3a18e6['status'](_0x1bd51f);return _0x3a18e6[_0xe4fa('0x22')](_0xe4fa('0x23'),_0x2cb54d+'-'+_0x35097d+'/'+_0x29a88b)['json'](_0x46da2a);}return null;};}function patchUpdates(_0x364199){return function(_0x59e77c){try{jsonpatch['apply'](_0x59e77c,_0x364199,!![]);}catch(_0x42fd8e){return BPromise[_0xe4fa('0x24')](_0x42fd8e);}return _0x59e77c[_0xe4fa('0x25')]();};}function saveUpdates(_0x173c06,_0x1f7732){return function(_0x1abee1){if(_0x1abee1){return _0x1abee1['update'](_0x173c06)[_0xe4fa('0x26')](function(_0x47dc9a){return _0x47dc9a;});}return null;};}function removeEntity(_0x48f38f,_0x4a4487){return function(_0x58dc3a){if(_0x58dc3a){return _0x58dc3a[_0xe4fa('0x27')]()[_0xe4fa('0x26')](function(){_0x48f38f[_0xe4fa('0x1c')](0xcc)[_0xe4fa('0x28')]();});}};}function handleEntityNotFound(_0x25e381,_0x67e11d){return function(_0x53fa0b){if(!_0x53fa0b){_0x25e381['sendStatus'](0x194);}return _0x53fa0b;};}function handleError(_0x703fe,_0x341e7e){_0x341e7e=_0x341e7e||0x1f4;return function(_0xac1b8a){logger['error'](_0xac1b8a[_0xe4fa('0x29')]);if(_0xac1b8a[_0xe4fa('0x2a')]){delete _0xac1b8a[_0xe4fa('0x2a')];}_0x703fe[_0xe4fa('0x1c')](_0x341e7e)['send'](_0xac1b8a);};}exports['index']=function(_0x3ba597,_0x2fb5fc){var _0x3ae2f0={},_0x4f668f={},_0xb88283={'count':0x0,'rows':[]};var _0x49db73=_[_0xe4fa('0x2b')](db['AnalyticFieldReport']['rawAttributes'],function(_0x350c5c){return{'name':_0x350c5c[_0xe4fa('0x2c')],'type':_0x350c5c['type'][_0xe4fa('0x2d')]};});_0x4f668f[_0xe4fa('0x2e')]=_[_0xe4fa('0x2b')](_0x49db73,_0xe4fa('0x2a'));_0x4f668f['query']=_[_0xe4fa('0x2f')](_0x3ba597[_0xe4fa('0x30')]);_0x4f668f[_0xe4fa('0x31')]=_[_0xe4fa('0x32')](_0x4f668f[_0xe4fa('0x2e')],_0x4f668f[_0xe4fa('0x30')]);_0x3ae2f0['attributes']=_['intersection'](_0x4f668f[_0xe4fa('0x2e')],qs[_0xe4fa('0x33')](_0x3ba597[_0xe4fa('0x30')]['fields']));_0x3ae2f0[_0xe4fa('0x34')]=_0x3ae2f0[_0xe4fa('0x34')][_0xe4fa('0x35')]?_0x3ae2f0[_0xe4fa('0x34')]:_0x4f668f[_0xe4fa('0x2e')];if(!_0x3ba597[_0xe4fa('0x30')][_0xe4fa('0x36')](_0xe4fa('0x37'))){_0x3ae2f0[_0xe4fa('0x20')]=qs['limit'](_0x3ba597['query']['limit']);_0x3ae2f0[_0xe4fa('0x1e')]=qs[_0xe4fa('0x1e')](_0x3ba597[_0xe4fa('0x30')][_0xe4fa('0x1e')]);}_0x3ae2f0[_0xe4fa('0x38')]=qs[_0xe4fa('0x39')](_0x3ba597[_0xe4fa('0x30')][_0xe4fa('0x39')]);_0x3ae2f0[_0xe4fa('0x3a')]=qs[_0xe4fa('0x31')](_[_0xe4fa('0x3b')](_0x3ba597[_0xe4fa('0x30')],_0x4f668f[_0xe4fa('0x31')]),_0x49db73);if(_0x3ba597[_0xe4fa('0x30')]['filter']){_0x3ae2f0[_0xe4fa('0x3a')]=_[_0xe4fa('0x3c')](_0x3ae2f0[_0xe4fa('0x3a')],{'$or':_[_0xe4fa('0x2b')](_0x49db73,function(_0x11e637){if(_0x11e637[_0xe4fa('0x3d')]!==_0xe4fa('0x3e')){var _0x2ed2fe={};_0x2ed2fe[_0x11e637[_0xe4fa('0x2a')]]={'$like':'%'+_0x3ba597[_0xe4fa('0x30')][_0xe4fa('0x3f')]+'%'};return _0x2ed2fe;}})});}_0x3ae2f0=_[_0xe4fa('0x3c')]({},_0x3ae2f0,_0x3ba597[_0xe4fa('0x40')]);var _0x32de02={'where':_0x3ae2f0['where']};return db[_0xe4fa('0x41')]['count'](_0x32de02)[_0xe4fa('0x26')](function(_0x122067){_0xb88283[_0xe4fa('0x21')]=_0x122067;if(_0x3ba597[_0xe4fa('0x30')][_0xe4fa('0x42')]){_0x3ae2f0[_0xe4fa('0x43')]=[{'all':!![]}];}return db[_0xe4fa('0x41')][_0xe4fa('0x44')](_0x3ae2f0);})[_0xe4fa('0x26')](function(_0x6105cd){_0xb88283[_0xe4fa('0x45')]=_0x6105cd;return _0xb88283;})['then'](respondWithFilteredResult(_0x2fb5fc,_0x3ae2f0))[_0xe4fa('0x46')](handleError(_0x2fb5fc,null));};exports[_0xe4fa('0x47')]=function(_0x390246,_0x1b937c){var _0x542e18={'raw':![],'where':{'id':_0x390246['params']['id']}},_0x5a7f8a={};_0x5a7f8a[_0xe4fa('0x2e')]=_[_0xe4fa('0x2f')](db[_0xe4fa('0x41')][_0xe4fa('0x48')]);_0x5a7f8a['query']=_['keys'](_0x390246['query']);_0x5a7f8a['filters']=_[_0xe4fa('0x32')](_0x5a7f8a[_0xe4fa('0x2e')],_0x5a7f8a['query']);_0x542e18[_0xe4fa('0x34')]=_[_0xe4fa('0x32')](_0x5a7f8a[_0xe4fa('0x2e')],qs[_0xe4fa('0x33')](_0x390246[_0xe4fa('0x30')]['fields']));_0x542e18[_0xe4fa('0x34')]=_0x542e18[_0xe4fa('0x34')][_0xe4fa('0x35')]?_0x542e18[_0xe4fa('0x34')]:_0x5a7f8a['model'];if(_0x390246[_0xe4fa('0x30')][_0xe4fa('0x42')]){_0x542e18['include']=[{'all':!![]}];}_0x542e18=_[_0xe4fa('0x3c')]({},_0x542e18,_0x390246[_0xe4fa('0x40')]);return db[_0xe4fa('0x41')][_0xe4fa('0x49')](_0x542e18)[_0xe4fa('0x26')](handleEntityNotFound(_0x1b937c,null))['then'](respondWithResult(_0x1b937c,null))[_0xe4fa('0x46')](handleError(_0x1b937c,null));};exports[_0xe4fa('0x4a')]=function(_0x192a4a,_0x1c1c4e){return db[_0xe4fa('0x41')][_0xe4fa('0x4a')](_0x192a4a[_0xe4fa('0x4b')],{})[_0xe4fa('0x26')](respondWithResult(_0x1c1c4e,0xc9))[_0xe4fa('0x46')](handleError(_0x1c1c4e,null));};exports[_0xe4fa('0x4c')]=function(_0x164c24,_0x5b664b){return db[_0xe4fa('0x41')][_0xe4fa('0x4c')](_0x164c24[_0xe4fa('0x4b')],{'raw':![],'individualHooks':!![]})[_0xe4fa('0x26')](respondWithResult(_0x5b664b,0xc9))['catch'](handleError(_0x5b664b,null));};exports[_0xe4fa('0x4d')]=function(_0xf52e42,_0x465eac){if(_0xf52e42[_0xe4fa('0x4b')]['id']){delete _0xf52e42['body']['id'];}return db[_0xe4fa('0x41')]['find']({'where':{'id':_0xf52e42[_0xe4fa('0x4e')]['id']}})['then'](handleEntityNotFound(_0x465eac,null))[_0xe4fa('0x26')](saveUpdates(_0xf52e42[_0xe4fa('0x4b')],null))[_0xe4fa('0x26')](respondWithResult(_0x465eac,null))[_0xe4fa('0x46')](handleError(_0x465eac,null));};exports[_0xe4fa('0x27')]=function(_0x52853e,_0x25e0a0){return db[_0xe4fa('0x41')]['find']({'where':{'id':_0x52853e[_0xe4fa('0x4e')]['id']}})['then'](handleEntityNotFound(_0x25e0a0,null))[_0xe4fa('0x26')](removeEntity(_0x25e0a0,null))[_0xe4fa('0x46')](handleError(_0x25e0a0,null));};exports['bulkDestroy']=function(_0x1e7250,_0x3ca0d9){return db[_0xe4fa('0x41')]['destroy']({'where':{'id':_0x1e7250[_0xe4fa('0x30')][_0xe4fa('0x4f')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x3ca0d9,0xcc))[_0xe4fa('0x46')](handleError(_0x3ca0d9,null));};exports['addFields']=function(_0x2b62cc,_0x2cb0dd,_0x421179){return db['AnalyticCustomReport'][_0xe4fa('0x50')]({'where':{'id':_0x2b62cc[_0xe4fa('0x4e')]['id']}})[_0xe4fa('0x26')](handleEntityNotFound(_0x2cb0dd,null))[_0xe4fa('0x26')](function(_0x334f8a){if(_0x334f8a){return db[_0xe4fa('0x51')][_0xe4fa('0x52')](function(_0x445d52){return db['AnalyticFieldReport'][_0xe4fa('0x27')]({'where':{'CustomReportId':_0x2b62cc['params']['id']},'transaction':_0x445d52})[_0xe4fa('0x26')](function(_0x1bc425){var _0x59a2d7=_['map'](_0x2b62cc[_0xe4fa('0x4b')],function(_0x1d1ec8){delete _0x1d1ec8['id'];_0x1d1ec8['CustomReportId']=_0x2b62cc['params']['id'];return _0x1d1ec8;});return db[_0xe4fa('0x41')][_0xe4fa('0x4c')](_0x59a2d7,{'transaction':_0x445d52});});})[_0xe4fa('0x26')](function(){return db[_0xe4fa('0x41')]['findAll']({'where':{'CustomReportId':_0x2b62cc['params']['id']}});});}})[_0xe4fa('0x26')](respondWithResult(_0x2cb0dd,null))[_0xe4fa('0x46')](handleError(_0x2cb0dd,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index f9ce6e1..a9cd587 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 _0xcf92=['../../config/logger','api','moment','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','analytics_report_fields','lodash','util'];(function(_0x1c461e,_0x1b98ff){var _0x1dce4f=function(_0x5cbdf0){while(--_0x5cbdf0){_0x1c461e['push'](_0x1c461e['shift']());}};_0x1dce4f(++_0x1b98ff);}(_0xcf92,0x172));var _0x2cf9=function(_0x45ebd2,_0x575711){_0x45ebd2=_0x45ebd2-0x0;var _0x3da67f=_0xcf92[_0x45ebd2];return _0x3da67f;};'use strict';var _=require(_0x2cf9('0x0'));var util=require(_0x2cf9('0x1'));var logger=require(_0x2cf9('0x2'))(_0x2cf9('0x3'));var moment=require(_0x2cf9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2cf9('0x5'));var rimraf=require(_0x2cf9('0x6'));var config=require(_0x2cf9('0x7'));var attributes=require(_0x2cf9('0x8'));module[_0x2cf9('0x9')]=function(_0x5db801,_0x3b658c){return _0x5db801[_0x2cf9('0xa')]('AnalyticFieldReport',attributes,{'tableName':_0x2cf9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa06d=['api','moment','bluebird','request-promise','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger'];(function(_0x1da08f,_0x4c155d){var _0x35856b=function(_0xe6fb31){while(--_0xe6fb31){_0x1da08f['push'](_0x1da08f['shift']());}};_0x35856b(++_0x4c155d);}(_0xa06d,0x1d6));var _0xda06=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa06d[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0xda06('0x0'));var util=require(_0xda06('0x1'));var logger=require(_0xda06('0x2'))(_0xda06('0x3'));var moment=require(_0xda06('0x4'));var BPromise=require(_0xda06('0x5'));var rp=require(_0xda06('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xda06('0x7'));module[_0xda06('0x8')]=function(_0x367733,_0x36165e){return _0x367733['define'](_0xda06('0x9'),attributes,{'tableName':_0xda06('0xa'),'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 bac155f..b24d637 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 _0x7ad4=['then','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticFieldReport,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x5d95bd,_0x48296a){var _0x2a3489=function(_0x26d892){while(--_0x26d892){_0x5d95bd['push'](_0x5d95bd['shift']());}};_0x2a3489(++_0x48296a);}(_0x7ad4,0x130));var _0x47ad=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7ad4[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x47ad('0x0'));var moment=require(_0x47ad('0x1'));var BPromise=require(_0x47ad('0x2'));var rs=require(_0x47ad('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x47ad('0x4'));var logger=require(_0x47ad('0x5'))(_0x47ad('0x6'));var config=require('../../config/environment');var jayson=require(_0x47ad('0x7'));var client=jayson[_0x47ad('0x8')][_0x47ad('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ed25a,_0x5aed0c,_0x142b7c){return new BPromise(function(_0x27a487,_0x38fb12){return client[_0x47ad('0xa')](_0x5ed25a,_0x142b7c)[_0x47ad('0xb')](function(_0x20c1b1){logger[_0x47ad('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5aed0c,_0x47ad('0xd'));logger[_0x47ad('0xe')](_0x47ad('0xf'),_0x5aed0c,_0x47ad('0xd'),JSON[_0x47ad('0x10')](_0x20c1b1));if(_0x20c1b1[_0x47ad('0x11')]){if(_0x20c1b1[_0x47ad('0x11')]['code']===0x1f4){logger[_0x47ad('0x11')](_0x47ad('0x12'),_0x5aed0c,_0x20c1b1[_0x47ad('0x11')][_0x47ad('0x13')]);return _0x38fb12(_0x20c1b1[_0x47ad('0x11')]['message']);}logger[_0x47ad('0x11')](_0x47ad('0x12'),_0x5aed0c,_0x20c1b1[_0x47ad('0x11')]['message']);return _0x27a487(_0x20c1b1[_0x47ad('0x11')][_0x47ad('0x13')]);}else{logger[_0x47ad('0xc')](_0x47ad('0x12'),_0x5aed0c,'request\x20sent');_0x27a487(_0x20c1b1[_0x47ad('0x14')][_0x47ad('0x13')]);}})['catch'](function(_0x5a6bbb){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x5aed0c,_0x5a6bbb);_0x38fb12(_0x5a6bbb);});});} \ No newline at end of file +var _0x0948=['message','result','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x416fcb,_0x4afa09){var _0x299667=function(_0x2fb396){while(--_0x2fb396){_0x416fcb['push'](_0x416fcb['shift']());}};_0x299667(++_0x4afa09);}(_0x0948,0xab));var _0x8094=function(_0x40bc01,_0x22a9a9){_0x40bc01=_0x40bc01-0x0;var _0x42365b=_0x0948[_0x40bc01];return _0x42365b;};'use strict';var _=require(_0x8094('0x0'));var util=require(_0x8094('0x1'));var moment=require('moment');var BPromise=require(_0x8094('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8094('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8094('0x4'));var logger=require(_0x8094('0x5'))(_0x8094('0x6'));var config=require(_0x8094('0x7'));var jayson=require(_0x8094('0x8'));var client=jayson[_0x8094('0x9')][_0x8094('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15402a,_0x43ae5c,_0x4f40ee){return new BPromise(function(_0x224ceb,_0x185ad3){return client[_0x8094('0xb')](_0x15402a,_0x4f40ee)[_0x8094('0xc')](function(_0x10b49a){logger[_0x8094('0xd')](_0x8094('0xe'),_0x43ae5c,'request\x20sent');logger[_0x8094('0xf')](_0x8094('0x10'),_0x43ae5c,_0x8094('0x11'),JSON[_0x8094('0x12')](_0x10b49a));if(_0x10b49a['error']){if(_0x10b49a[_0x8094('0x13')][_0x8094('0x14')]===0x1f4){logger[_0x8094('0x13')](_0x8094('0xe'),_0x43ae5c,_0x10b49a['error'][_0x8094('0x15')]);return _0x185ad3(_0x10b49a[_0x8094('0x13')][_0x8094('0x15')]);}logger[_0x8094('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0x43ae5c,_0x10b49a[_0x8094('0x13')][_0x8094('0x15')]);return _0x224ceb(_0x10b49a['error'][_0x8094('0x15')]);}else{logger[_0x8094('0xd')](_0x8094('0xe'),_0x43ae5c,'request\x20sent');_0x224ceb(_0x10b49a[_0x8094('0x16')][_0x8094('0x15')]);}})[_0x8094('0x17')](function(_0xa03e06){logger[_0x8094('0x13')](_0x8094('0xe'),_0x43ae5c,_0xa03e06);_0x185ad3(_0xa03e06);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 2aebbef..cc2c809 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(_0x3a5b6c,_0x2123f4){var _0x2c891f=function(_0x9aa86e){while(--_0x9aa86e){_0x3a5b6c['push'](_0x3a5b6c['shift']());}};_0x2c891f(++_0x2123f4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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(_0x70cabc,_0x230aa3){var _0x40a5d3=function(_0x43598d){while(--_0x43598d){_0x70cabc['push'](_0x70cabc['shift']());}};_0x40a5d3(++_0x230aa3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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 db0e3f0..fd0b409 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 _0xfd07=['exports','STRING','sequelize'];(function(_0x48b986,_0x5acc83){var _0x324ed5=function(_0x343034){while(--_0x343034){_0x48b986['push'](_0x48b986['shift']());}};_0x324ed5(++_0x5acc83);}(_0xfd07,0x104));var _0x7fd0=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xfd07[_0x4a747d];return _0x3a5b5c;};'use strict';var Sequelize=require(_0x7fd0('0x0'));module[_0x7fd0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x7fd0('0x2')]}}; \ No newline at end of file +var _0x84a0=['name','TEXT','sequelize','exports','STRING'];(function(_0x1c77ed,_0x5265e9){var _0xd06baf=function(_0x2ff1c0){while(--_0x2ff1c0){_0x1c77ed['push'](_0x1c77ed['shift']());}};_0xd06baf(++_0x5265e9);}(_0x84a0,0x66));var _0x084a=function(_0x49eb22,_0x48300f){_0x49eb22=_0x49eb22-0x0;var _0xdcca20=_0x84a0[_0x49eb22];return _0xdcca20;};'use strict';var Sequelize=require(_0x084a('0x0'));module[_0x084a('0x1')]={'name':{'type':Sequelize[_0x084a('0x2')],'allowNull':![],'unique':_0x084a('0x3')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x084a('0x4')]},'description':{'type':Sequelize[_0x084a('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 381fcea..428257a 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(_0x174ad8,_0x46e5f0){var _0x20f68b=function(_0x35c0bf){while(--_0x35c0bf){_0x174ad8['push'](_0x174ad8['shift']());}};_0x20f68b(++_0x46e5f0);}(_0x8ef6,0xf2));var _0x68ef=function(_0x1e190c,_0x1a07b8){_0x1e190c=_0x1e190c-0x0;var _0x1823e6=_0x8ef6[_0x1e190c];return _0x1823e6;};'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 _0xdbf5=['../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','save','update','then','destroy','get','Metrics','UserProfileResource','end','error','name','send','index','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','VIRTUAL','AnalyticMetric','includeAll','include','findAll','rows','catch','show','keys','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','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'];(function(_0x3cbf32,_0x2cae2f){var _0x45c7cf=function(_0x6e21b9){while(--_0x6e21b9){_0x3cbf32['push'](_0x3cbf32['shift']());}};_0x45c7cf(++_0x2cae2f);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x5169f5,_0x3a6295){_0x5169f5=_0x5169f5-0x0;var _0xad21eb=_0xdbf5[_0x5169f5];return _0xad21eb;};'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'];function respondWithStatusCode(_0x182cec,_0x2bb7ed){_0x2bb7ed=_0x2bb7ed||0xcc;return function(_0x1453a9){if(_0x1453a9){return _0x182cec[_0x5dbf('0x16')](_0x2bb7ed);}return _0x182cec[_0x5dbf('0x17')](_0x2bb7ed)['end']();};}function respondWithResult(_0x4803ca,_0x2b4e1c){_0x2b4e1c=_0x2b4e1c||0xc8;return function(_0x3480c8){if(_0x3480c8){return _0x4803ca['status'](_0x2b4e1c)[_0x5dbf('0x18')](_0x3480c8);}};}function respondWithFilteredResult(_0x248e3c,_0x23f763){return function(_0x2dfa44){if(_0x2dfa44){var _0x181816=typeof _0x23f763[_0x5dbf('0x19')]===_0x5dbf('0x1a')&&typeof _0x23f763['limit']==='undefined';var _0x16dc82=_0x2dfa44[_0x5dbf('0x1b')];var _0x39c7aa=_0x181816?0x0:_0x23f763[_0x5dbf('0x19')];var _0x20c2b0=_0x181816?_0x2dfa44['count']:_0x23f763[_0x5dbf('0x19')]+_0x23f763['limit'];var _0x565efa;if(_0x20c2b0>=_0x16dc82){_0x20c2b0=_0x16dc82;_0x565efa=0xc8;}else{_0x565efa=0xce;}_0x248e3c['status'](_0x565efa);return _0x248e3c[_0x5dbf('0x1c')](_0x5dbf('0x1d'),_0x39c7aa+'-'+_0x20c2b0+'/'+_0x16dc82)[_0x5dbf('0x18')](_0x2dfa44);}return null;};}function patchUpdates(_0x2ab57c){return function(_0x1e3cce){try{jsonpatch['apply'](_0x1e3cce,_0x2ab57c,!![]);}catch(_0x2764ea){return BPromise['reject'](_0x2764ea);}return _0x1e3cce[_0x5dbf('0x1e')]();};}function saveUpdates(_0x11cc67,_0x14d133){return function(_0x43a612){if(_0x43a612){return _0x43a612[_0x5dbf('0x1f')](_0x11cc67)[_0x5dbf('0x20')](function(_0x58085e){return _0x58085e;});}return null;};}function removeEntity(_0x4027c3,_0x3e3a2d){return function(_0x2d3e1b){if(_0x2d3e1b){return _0x2d3e1b[_0x5dbf('0x21')]()[_0x5dbf('0x20')](function(){var _0x226b93=_0x2d3e1b[_0x5dbf('0x22')]({'plain':!![]});var _0x20ab1b=_0x5dbf('0x23');return db[_0x5dbf('0x24')][_0x5dbf('0x21')]({'where':{'type':_0x20ab1b,'resourceId':_0x226b93['id']}})[_0x5dbf('0x20')](function(){return _0x2d3e1b;});})[_0x5dbf('0x20')](function(){_0x4027c3[_0x5dbf('0x17')](0xcc)[_0x5dbf('0x25')]();});}};}function handleEntityNotFound(_0x17f135,_0x466985){return function(_0x3f8341){if(!_0x3f8341){_0x17f135[_0x5dbf('0x16')](0x194);}return _0x3f8341;};}function handleError(_0x22ec42,_0x6a9757){_0x6a9757=_0x6a9757||0x1f4;return function(_0x471027){logger[_0x5dbf('0x26')](_0x471027['stack']);if(_0x471027[_0x5dbf('0x27')]){delete _0x471027[_0x5dbf('0x27')];}_0x22ec42[_0x5dbf('0x17')](_0x6a9757)[_0x5dbf('0x28')](_0x471027);};}exports[_0x5dbf('0x29')]=function(_0x6a276d,_0x2a65c5){var _0x31d57a={},_0x406ce6={},_0x273b63={'count':0x0,'rows':[]};var _0x294dd7=_['map'](db['AnalyticMetric'][_0x5dbf('0x2a')],function(_0x19015a){return{'name':_0x19015a[_0x5dbf('0x2b')],'type':_0x19015a[_0x5dbf('0x2c')][_0x5dbf('0x2d')]};});_0x406ce6['model']=_['map'](_0x294dd7,_0x5dbf('0x27'));_0x406ce6[_0x5dbf('0x2e')]=_['keys'](_0x6a276d[_0x5dbf('0x2e')]);_0x406ce6[_0x5dbf('0x2f')]=_[_0x5dbf('0x30')](_0x406ce6[_0x5dbf('0x31')],_0x406ce6[_0x5dbf('0x2e')]);_0x31d57a['attributes']=_[_0x5dbf('0x30')](_0x406ce6[_0x5dbf('0x31')],qs[_0x5dbf('0x32')](_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x32')]));_0x31d57a['attributes']=_0x31d57a[_0x5dbf('0x33')][_0x5dbf('0x34')]?_0x31d57a[_0x5dbf('0x33')]:_0x406ce6[_0x5dbf('0x31')];if(!_0x6a276d['query'][_0x5dbf('0x35')](_0x5dbf('0x36'))){_0x31d57a[_0x5dbf('0x37')]=qs[_0x5dbf('0x37')](_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x37')]);_0x31d57a[_0x5dbf('0x19')]=qs[_0x5dbf('0x19')](_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x19')]);}_0x31d57a[_0x5dbf('0x38')]=qs['sort'](_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x39')]);_0x31d57a[_0x5dbf('0x3a')]=qs['filters'](_[_0x5dbf('0x3b')](_0x6a276d[_0x5dbf('0x2e')],_0x406ce6[_0x5dbf('0x2f')]),_0x294dd7);if(_0x6a276d['query'][_0x5dbf('0x3c')]){_0x31d57a[_0x5dbf('0x3a')]=_[_0x5dbf('0x3d')](_0x31d57a['where'],{'$or':_[_0x5dbf('0x3e')](_0x294dd7,function(_0x29a62d){if(_0x29a62d[_0x5dbf('0x2c')]!==_0x5dbf('0x3f')){var _0x10537d={};_0x10537d[_0x29a62d[_0x5dbf('0x27')]]={'$like':'%'+_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x3c')]+'%'};return _0x10537d;}})});}_0x31d57a=_['merge']({},_0x31d57a,_0x6a276d['options']);var _0x57ee72={'where':_0x31d57a['where']};return db[_0x5dbf('0x40')][_0x5dbf('0x1b')](_0x57ee72)['then'](function(_0x3ef0eb){_0x273b63[_0x5dbf('0x1b')]=_0x3ef0eb;if(_0x6a276d['query'][_0x5dbf('0x41')]){_0x31d57a[_0x5dbf('0x42')]=[{'all':!![]}];}return db[_0x5dbf('0x40')][_0x5dbf('0x43')](_0x31d57a);})[_0x5dbf('0x20')](function(_0x7c390d){_0x273b63[_0x5dbf('0x44')]=_0x7c390d;return _0x273b63;})[_0x5dbf('0x20')](respondWithFilteredResult(_0x2a65c5,_0x31d57a))[_0x5dbf('0x45')](handleError(_0x2a65c5,null));};exports[_0x5dbf('0x46')]=function(_0x50ac70,_0x78aef3){var _0x22f958={'raw':!![],'where':{'id':_0x50ac70['params']['id']}},_0xec1d28={};_0xec1d28[_0x5dbf('0x31')]=_[_0x5dbf('0x47')](db[_0x5dbf('0x40')][_0x5dbf('0x2a')]);_0xec1d28['query']=_[_0x5dbf('0x47')](_0x50ac70['query']);_0xec1d28[_0x5dbf('0x2f')]=_[_0x5dbf('0x30')](_0xec1d28[_0x5dbf('0x31')],_0xec1d28[_0x5dbf('0x2e')]);_0x22f958['attributes']=_['intersection'](_0xec1d28[_0x5dbf('0x31')],qs[_0x5dbf('0x32')](_0x50ac70[_0x5dbf('0x2e')]['fields']));_0x22f958[_0x5dbf('0x33')]=_0x22f958['attributes']['length']?_0x22f958['attributes']:_0xec1d28['model'];if(_0x50ac70[_0x5dbf('0x2e')][_0x5dbf('0x41')]){_0x22f958['include']=[{'all':!![]}];}_0x22f958=_[_0x5dbf('0x3d')]({},_0x22f958,_0x50ac70[_0x5dbf('0x48')]);return db['AnalyticMetric'][_0x5dbf('0x49')](_0x22f958)[_0x5dbf('0x20')](handleEntityNotFound(_0x78aef3,null))['then'](respondWithResult(_0x78aef3,null))[_0x5dbf('0x45')](handleError(_0x78aef3,null));};exports['create']=function(_0x5ab862,_0x337897){return db[_0x5dbf('0x40')][_0x5dbf('0x4a')](_0x5ab862['body'],{})['then'](function(_0x442a43){var _0x3e8612=_0x5ab862[_0x5dbf('0x4b')][_0x5dbf('0x22')]({'plain':!![]});if(!_0x3e8612)throw new Error(_0x5dbf('0x4c'));if(_0x3e8612[_0x5dbf('0x4d')]===_0x5dbf('0x4b')){var _0x319906=_0x442a43['get']({'plain':!![]});var _0x3f38a0=_0x5dbf('0x23');return db[_0x5dbf('0x4e')][_0x5dbf('0x49')]({'where':{'name':_0x3f38a0,'userProfileId':_0x3e8612[_0x5dbf('0x4f')]},'raw':!![]})[_0x5dbf('0x20')](function(_0x328dc5){if(_0x328dc5&&_0x328dc5['autoAssociation']===0x0){return db[_0x5dbf('0x24')]['create']({'name':_0x319906[_0x5dbf('0x27')],'resourceId':_0x319906['id'],'type':_0x328dc5[_0x5dbf('0x27')],'sectionId':_0x328dc5['id']},{})[_0x5dbf('0x20')](function(){return _0x442a43;});}else{return _0x442a43;}})[_0x5dbf('0x45')](function(_0x78ab84){logger[_0x5dbf('0x26')](_0x5dbf('0x50'),_0x78ab84);throw _0x78ab84;});}return _0x442a43;})['then'](respondWithResult(_0x337897,0xc9))['catch'](handleError(_0x337897,null));};exports['update']=function(_0x1e1876,_0xfdacc7){if(_0x1e1876[_0x5dbf('0x51')]['id']){delete _0x1e1876['body']['id'];}return db['AnalyticMetric'][_0x5dbf('0x49')]({'where':{'id':_0x1e1876[_0x5dbf('0x52')]['id']}})[_0x5dbf('0x20')](handleEntityNotFound(_0xfdacc7,null))['then'](saveUpdates(_0x1e1876[_0x5dbf('0x51')],null))['then'](respondWithResult(_0xfdacc7,null))[_0x5dbf('0x45')](handleError(_0xfdacc7,null));};exports[_0x5dbf('0x21')]=function(_0x2145ea,_0x5da14b){return db['AnalyticMetric'][_0x5dbf('0x49')]({'where':{'id':_0x2145ea[_0x5dbf('0x52')]['id']}})[_0x5dbf('0x20')](handleEntityNotFound(_0x5da14b,null))[_0x5dbf('0x20')](removeEntity(_0x5da14b,null))['catch'](handleError(_0x5da14b,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index d49712c..854665a 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 _0x22ed=['../../config/environment','./analyticMetric.attributes','exports','define','analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1bfb22,_0x11bf71){var _0x52c53c=function(_0x16152e){while(--_0x16152e){_0x1bfb22['push'](_0x1bfb22['shift']());}};_0x52c53c(++_0x11bf71);}(_0x22ed,0x1a9));var _0xd22e=function(_0x456f94,_0x300c8b){_0x456f94=_0x456f94-0x0;var _0x193640=_0x22ed[_0x456f94];return _0x193640;};'use strict';var _=require(_0xd22e('0x0'));var util=require(_0xd22e('0x1'));var logger=require(_0xd22e('0x2'))(_0xd22e('0x3'));var moment=require(_0xd22e('0x4'));var BPromise=require(_0xd22e('0x5'));var rp=require(_0xd22e('0x6'));var fs=require('fs');var path=require(_0xd22e('0x7'));var rimraf=require(_0xd22e('0x8'));var config=require(_0xd22e('0x9'));var attributes=require(_0xd22e('0xa'));module[_0xd22e('0xb')]=function(_0x4cd924,_0x131034){return _0x4cd924[_0xd22e('0xc')]('AnalyticMetric',attributes,{'tableName':_0xd22e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3fa4=['lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','define','analytics_metrics'];(function(_0x1ac5a4,_0x1eaf7f){var _0x224132=function(_0xdc27e2){while(--_0xdc27e2){_0x1ac5a4['push'](_0x1ac5a4['shift']());}};_0x224132(++_0x1eaf7f);}(_0x3fa4,0xf0));var _0x43fa=function(_0xdb1334,_0x2825b9){_0xdb1334=_0xdb1334-0x0;var _0x1ffaae=_0x3fa4[_0xdb1334];return _0x1ffaae;};'use strict';var _=require(_0x43fa('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x43fa('0x1'));var BPromise=require(_0x43fa('0x2'));var rp=require(_0x43fa('0x3'));var fs=require('fs');var path=require(_0x43fa('0x4'));var rimraf=require(_0x43fa('0x5'));var config=require(_0x43fa('0x6'));var attributes=require(_0x43fa('0x7'));module['exports']=function(_0x2c7789,_0x1e53b3){return _0x2c7789[_0x43fa('0x8')]('AnalyticMetric',attributes,{'tableName':_0x43fa('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 9efe4a3..8d86835 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 _0x207b=['client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0x207b,0x15e));var _0xb207=function(_0x7dee60,_0x4cb724){_0x7dee60=_0x7dee60-0x0;var _0x58892a=_0x207b[_0x7dee60];return _0x58892a;};'use strict';var _=require(_0xb207('0x0'));var util=require(_0xb207('0x1'));var moment=require(_0xb207('0x2'));var BPromise=require(_0xb207('0x3'));var rs=require(_0xb207('0x4'));var fs=require('fs');var Redis=require(_0xb207('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb207('0x6'));var logger=require(_0xb207('0x7'))(_0xb207('0x8'));var config=require('../../config/environment');var jayson=require(_0xb207('0x9'));var client=jayson[_0xb207('0xa')][_0xb207('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2369a0,_0x470804,_0x4e0aa9){return new BPromise(function(_0x15b3ac,_0x19915e){return client[_0xb207('0xc')](_0x2369a0,_0x4e0aa9)[_0xb207('0xd')](function(_0x1dad4d){logger[_0xb207('0xe')](_0xb207('0xf'),_0x470804,_0xb207('0x10'));logger[_0xb207('0x11')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x470804,'request\x20sent',JSON[_0xb207('0x12')](_0x1dad4d));if(_0x1dad4d[_0xb207('0x13')]){if(_0x1dad4d[_0xb207('0x13')][_0xb207('0x14')]===0x1f4){logger[_0xb207('0x13')](_0xb207('0xf'),_0x470804,_0x1dad4d['error'][_0xb207('0x15')]);return _0x19915e(_0x1dad4d[_0xb207('0x13')][_0xb207('0x15')]);}logger['error'](_0xb207('0xf'),_0x470804,_0x1dad4d[_0xb207('0x13')][_0xb207('0x15')]);return _0x15b3ac(_0x1dad4d['error'][_0xb207('0x15')]);}else{logger[_0xb207('0xe')](_0xb207('0xf'),_0x470804,_0xb207('0x10'));_0x15b3ac(_0x1dad4d[_0xb207('0x16')][_0xb207('0x15')]);}})[_0xb207('0x17')](function(_0x5a9d18){logger[_0xb207('0x13')](_0xb207('0xf'),_0x470804,_0x5a9d18);_0x19915e(_0x5a9d18);});});} \ No newline at end of file +var _0x4416=['stringify','error','code','message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s'];(function(_0x2e04ef,_0x31a596){var _0x5722b0=function(_0x386fbd){while(--_0x386fbd){_0x2e04ef['push'](_0x2e04ef['shift']());}};_0x5722b0(++_0x31a596);}(_0x4416,0x157));var _0x6441=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x4416[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0x6441('0x0'));var util=require('util');var moment=require(_0x6441('0x1'));var BPromise=require('bluebird');var rs=require(_0x6441('0x2'));var fs=require('fs');var Redis=require(_0x6441('0x3'));var db=require(_0x6441('0x4'))['db'];var utils=require(_0x6441('0x5'));var logger=require(_0x6441('0x6'))(_0x6441('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6441('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8c3aa5,_0x51c173,_0x5c73a1){return new BPromise(function(_0x2391b7,_0x47c124){return client[_0x6441('0x9')](_0x8c3aa5,_0x5c73a1)[_0x6441('0xa')](function(_0x14dce4){logger['info'](_0x6441('0xb'),_0x51c173,_0x6441('0xc'));logger['debug'](_0x6441('0xd'),_0x51c173,'request\x20sent',JSON[_0x6441('0xe')](_0x14dce4));if(_0x14dce4[_0x6441('0xf')]){if(_0x14dce4[_0x6441('0xf')][_0x6441('0x10')]===0x1f4){logger[_0x6441('0xf')](_0x6441('0xb'),_0x51c173,_0x14dce4[_0x6441('0xf')][_0x6441('0x11')]);return _0x47c124(_0x14dce4['error'][_0x6441('0x11')]);}logger[_0x6441('0xf')](_0x6441('0xb'),_0x51c173,_0x14dce4[_0x6441('0xf')][_0x6441('0x11')]);return _0x2391b7(_0x14dce4[_0x6441('0xf')][_0x6441('0x11')]);}else{logger[_0x6441('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x51c173,_0x6441('0xc'));_0x2391b7(_0x14dce4[_0x6441('0x13')][_0x6441('0x11')]);}})[_0x6441('0x14')](function(_0x49b685){logger[_0x6441('0xf')](_0x6441('0xb'),_0x51c173,_0x49b685);_0x47c124(_0x49b685);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 0ce73d8..367f9cc 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 _0x45d1=['multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','create','put','update','destroy','exports'];(function(_0x4a45b4,_0x59804f){var _0x1a99c9=function(_0x3aa517){while(--_0x3aa517){_0x4a45b4['push'](_0x4a45b4['shift']());}};_0x1a99c9(++_0x59804f);}(_0x45d1,0x1cb));var _0x145d=function(_0x9c3c56,_0x169b56){_0x9c3c56=_0x9c3c56-0x0;var _0x2dd782=_0x45d1[_0x9c3c56];return _0x2dd782;};'use strict';var multer=require(_0x145d('0x0'));var util=require(_0x145d('0x1'));var path=require('path');var timeout=require(_0x145d('0x2'));var express=require(_0x145d('0x3'));var router=express['Router']();var fs_extra=require(_0x145d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x145d('0x5'));var config=require(_0x145d('0x6'));var controller=require(_0x145d('0x7'));router[_0x145d('0x8')]('/',auth[_0x145d('0x9')](),controller[_0x145d('0xa')]);router[_0x145d('0x8')](_0x145d('0xb'),auth[_0x145d('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x145d('0xc')]);router[_0x145d('0xd')](_0x145d('0xb'),auth['isAuthenticated'](),controller[_0x145d('0xe')]);router['delete'](_0x145d('0xb'),auth[_0x145d('0x9')](),controller[_0x145d('0xf')]);module[_0x145d('0x10')]=router; \ No newline at end of file +var _0x6011=['create','put','exports','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show'];(function(_0x4da1e5,_0x4b126c){var _0x16f705=function(_0x482e55){while(--_0x482e55){_0x4da1e5['push'](_0x4da1e5['shift']());}};_0x16f705(++_0x4b126c);}(_0x6011,0x196));var _0x1601=function(_0x3d3dee,_0xd44fec){_0x3d3dee=_0x3d3dee-0x0;var _0x526d6b=_0x6011[_0x3d3dee];return _0x526d6b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1601('0x0')]();var fs_extra=require(_0x1601('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x1601('0x2'));var config=require(_0x1601('0x3'));var controller=require(_0x1601('0x4'));router[_0x1601('0x5')]('/',auth[_0x1601('0x6')](),controller[_0x1601('0x7')]);router[_0x1601('0x5')](_0x1601('0x8'),auth[_0x1601('0x6')](),controller[_0x1601('0x9')]);router['post']('/',auth[_0x1601('0x6')](),controller[_0x1601('0xa')]);router[_0x1601('0xb')](_0x1601('0x8'),auth[_0x1601('0x6')](),controller['update']);router['delete']('/:id',auth[_0x1601('0x6')](),controller['destroy']);module[_0x1601('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index a83d640..da9bf8b 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 _0xf478=['TEXT','exports'];(function(_0x3103cc,_0x55087e){var _0x34f61c=function(_0x532981){while(--_0x532981){_0x3103cc['push'](_0x3103cc['shift']());}};_0x34f61c(++_0x55087e);}(_0xf478,0xb7));var _0x8f47=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xf478[_0x376b45];return _0x2341b3;};'use strict';var Sequelize=require('sequelize');module[_0x8f47('0x0')]={'tree':{'type':Sequelize[_0x8f47('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xa5af=['TEXT','sequelize','exports'];(function(_0x1f8ee9,_0x521f85){var _0x24c8a9=function(_0x351d5a){while(--_0x351d5a){_0x1f8ee9['push'](_0x1f8ee9['shift']());}};_0x24c8a9(++_0x521f85);}(_0xa5af,0x11e));var _0xfa5a=function(_0x1b73c1,_0x30e266){_0x1b73c1=_0x1b73c1-0x0;var _0x252044=_0xa5af[_0x1b73c1];return _0x252044;};'use strict';var Sequelize=require(_0xfa5a('0x0'));module[_0xfa5a('0x1')]={'tree':{'type':Sequelize[_0xfa5a('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 4e4721b..3afe634 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 _0x5720=['count','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x3a7fe5,_0x371426){var _0x18ed66=function(_0x4f6a16){while(--_0x4f6a16){_0x3a7fe5['push'](_0x3a7fe5['shift']());}};_0x18ed66(++_0x371426);}(_0x5720,0x10d));var _0x0572=function(_0x5d868e,_0x3e31db){_0x5d868e=_0x5d868e-0x0;var _0x378d99=_0x5720[_0x5d868e];return _0x378d99;};'use strict';var emlformat=require(_0x0572('0x0'));var rimraf=require(_0x0572('0x1'));var zipdir=require(_0x0572('0x2'));var jsonpatch=require(_0x0572('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0572('0x4'));var Mustache=require(_0x0572('0x5'));var util=require(_0x0572('0x6'));var path=require(_0x0572('0x7'));var sox=require(_0x0572('0x8'));var csv=require(_0x0572('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0572('0xa'));var squel=require(_0x0572('0xb'));var crypto=require('crypto');var jsforce=require(_0x0572('0xc'));var deskjs=require(_0x0572('0xd'));var toCsv=require(_0x0572('0x9'));var querystring=require(_0x0572('0xe'));var Papa=require(_0x0572('0xf'));var Redis=require(_0x0572('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0572('0x11'));var as=require(_0x0572('0x12'));var hardwareService=require(_0x0572('0x13'));var logger=require('../../config/logger')(_0x0572('0x14'));var utils=require(_0x0572('0x15'));var config=require(_0x0572('0x16'));var licenseUtil=require(_0x0572('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2622e5,_0x4b20fe){_0x4b20fe=_0x4b20fe||0xcc;return function(_0x19eed7){if(_0x19eed7){return _0x2622e5[_0x0572('0x18')](_0x4b20fe);}return _0x2622e5[_0x0572('0x19')](_0x4b20fe)[_0x0572('0x1a')]();};}function respondWithResult(_0x561dbc,_0x2cc054){_0x2cc054=_0x2cc054||0xc8;return function(_0x53cd78){if(_0x53cd78){return _0x561dbc[_0x0572('0x19')](_0x2cc054)[_0x0572('0x1b')](_0x53cd78);}};}function respondWithFilteredResult(_0x365e05,_0x99e4fa){return function(_0x4ce1b6){if(_0x4ce1b6){var _0x19418b=typeof _0x99e4fa[_0x0572('0x1c')]===_0x0572('0x1d')&&typeof _0x99e4fa[_0x0572('0x1e')]===_0x0572('0x1d');var _0x5afc8d=_0x4ce1b6[_0x0572('0x1f')];var _0x4fbe74=_0x19418b?0x0:_0x99e4fa[_0x0572('0x1c')];var _0x2c06f1=_0x19418b?_0x4ce1b6['count']:_0x99e4fa[_0x0572('0x1c')]+_0x99e4fa[_0x0572('0x1e')];var _0x21e556;if(_0x2c06f1>=_0x5afc8d){_0x2c06f1=_0x5afc8d;_0x21e556=0xc8;}else{_0x21e556=0xce;}_0x365e05[_0x0572('0x19')](_0x21e556);return _0x365e05[_0x0572('0x20')](_0x0572('0x21'),_0x4fbe74+'-'+_0x2c06f1+'/'+_0x5afc8d)[_0x0572('0x1b')](_0x4ce1b6);}return null;};}function patchUpdates(_0x435631){return function(_0x692990){try{jsonpatch[_0x0572('0x22')](_0x692990,_0x435631,!![]);}catch(_0x214347){return BPromise['reject'](_0x214347);}return _0x692990[_0x0572('0x23')]();};}function saveUpdates(_0x43be08,_0x4213f3){return function(_0xc3e1b){if(_0xc3e1b){return _0xc3e1b[_0x0572('0x24')](_0x43be08)[_0x0572('0x25')](function(_0x466d69){return _0x466d69;});}return null;};}function removeEntity(_0x4c76b5,_0x3d87b8){return function(_0x5a9560){if(_0x5a9560){return _0x5a9560[_0x0572('0x26')]()[_0x0572('0x25')](function(){_0x4c76b5['status'](0xcc)[_0x0572('0x1a')]();});}};}function handleEntityNotFound(_0x408711,_0x7fbd84){return function(_0x41e8c6){if(!_0x41e8c6){_0x408711[_0x0572('0x18')](0x194);}return _0x41e8c6;};}function handleError(_0x582981,_0x451385){_0x451385=_0x451385||0x1f4;return function(_0x43bf44){logger[_0x0572('0x27')](_0x43bf44['stack']);if(_0x43bf44[_0x0572('0x28')]){delete _0x43bf44['name'];}_0x582981[_0x0572('0x19')](_0x451385)[_0x0572('0x29')](_0x43bf44);};}exports[_0x0572('0x2a')]=function(_0x577f3b,_0xf93a68){var _0x272792={},_0x1bffec={},_0x4dd80c={'count':0x0,'rows':[]};var _0x2e15aa=_[_0x0572('0x2b')](db[_0x0572('0x2c')][_0x0572('0x2d')],function(_0x1bbec8){return{'name':_0x1bbec8[_0x0572('0x2e')],'type':_0x1bbec8['type'][_0x0572('0x2f')]};});_0x1bffec[_0x0572('0x30')]=_[_0x0572('0x2b')](_0x2e15aa,'name');_0x1bffec[_0x0572('0x31')]=_[_0x0572('0x32')](_0x577f3b[_0x0572('0x31')]);_0x1bffec[_0x0572('0x33')]=_[_0x0572('0x34')](_0x1bffec[_0x0572('0x30')],_0x1bffec[_0x0572('0x31')]);_0x272792[_0x0572('0x35')]=_[_0x0572('0x34')](_0x1bffec[_0x0572('0x30')],qs[_0x0572('0x36')](_0x577f3b[_0x0572('0x31')]['fields']));_0x272792[_0x0572('0x35')]=_0x272792[_0x0572('0x35')][_0x0572('0x37')]?_0x272792[_0x0572('0x35')]:_0x1bffec[_0x0572('0x30')];if(!_0x577f3b[_0x0572('0x31')][_0x0572('0x38')](_0x0572('0x39'))){_0x272792['limit']=qs[_0x0572('0x1e')](_0x577f3b[_0x0572('0x31')][_0x0572('0x1e')]);_0x272792[_0x0572('0x1c')]=qs[_0x0572('0x1c')](_0x577f3b[_0x0572('0x31')][_0x0572('0x1c')]);}_0x272792['order']=qs[_0x0572('0x3a')](_0x577f3b[_0x0572('0x31')][_0x0572('0x3a')]);_0x272792[_0x0572('0x3b')]=qs[_0x0572('0x33')](_[_0x0572('0x3c')](_0x577f3b[_0x0572('0x31')],_0x1bffec['filters']),_0x2e15aa);if(_0x577f3b[_0x0572('0x31')]['filter']){_0x272792[_0x0572('0x3b')]=_[_0x0572('0x3d')](_0x272792[_0x0572('0x3b')],{'$or':_[_0x0572('0x2b')](_0x2e15aa,function(_0x2e185d){if(_0x2e185d[_0x0572('0x3e')]!==_0x0572('0x3f')){var _0x14aba1={};_0x14aba1[_0x2e185d[_0x0572('0x28')]]={'$like':'%'+_0x577f3b['query'][_0x0572('0x40')]+'%'};return _0x14aba1;}})});}_0x272792=_['merge']({},_0x272792,_0x577f3b[_0x0572('0x41')]);var _0x30cb76={'where':_0x272792[_0x0572('0x3b')]};return db[_0x0572('0x2c')]['count'](_0x30cb76)[_0x0572('0x25')](function(_0x353e55){_0x4dd80c[_0x0572('0x1f')]=_0x353e55;if(_0x577f3b[_0x0572('0x31')][_0x0572('0x42')]){_0x272792[_0x0572('0x43')]=[{'all':!![]}];}return db[_0x0572('0x2c')][_0x0572('0x44')](_0x272792);})['then'](function(_0x3b5a20){_0x4dd80c['rows']=_0x3b5a20;return _0x4dd80c;})[_0x0572('0x25')](respondWithFilteredResult(_0xf93a68,_0x272792))['catch'](handleError(_0xf93a68,null));};exports[_0x0572('0x45')]=function(_0x25c85f,_0x17e896){var _0x7949f9={'raw':!![],'where':{'id':_0x25c85f[_0x0572('0x46')]['id']}},_0x3284c3={};_0x3284c3['model']=_['keys'](db[_0x0572('0x2c')][_0x0572('0x2d')]);_0x3284c3['query']=_['keys'](_0x25c85f[_0x0572('0x31')]);_0x3284c3['filters']=_[_0x0572('0x34')](_0x3284c3[_0x0572('0x30')],_0x3284c3['query']);_0x7949f9[_0x0572('0x35')]=_[_0x0572('0x34')](_0x3284c3[_0x0572('0x30')],qs[_0x0572('0x36')](_0x25c85f[_0x0572('0x31')]['fields']));_0x7949f9[_0x0572('0x35')]=_0x7949f9['attributes']['length']?_0x7949f9[_0x0572('0x35')]:_0x3284c3[_0x0572('0x30')];if(_0x25c85f[_0x0572('0x31')][_0x0572('0x42')]){_0x7949f9[_0x0572('0x43')]=[{'all':!![]}];}_0x7949f9=_[_0x0572('0x3d')]({},_0x7949f9,_0x25c85f[_0x0572('0x41')]);return db[_0x0572('0x2c')][_0x0572('0x47')](_0x7949f9)['then'](handleEntityNotFound(_0x17e896,null))[_0x0572('0x25')](respondWithResult(_0x17e896,null))[_0x0572('0x48')](handleError(_0x17e896,null));};exports[_0x0572('0x49')]=function(_0x595ac5,_0x277405){return db['AnalyticTreeReport'][_0x0572('0x49')](_0x595ac5[_0x0572('0x4a')],{})['then'](respondWithResult(_0x277405,0xc9))[_0x0572('0x48')](handleError(_0x277405,null));};exports[_0x0572('0x24')]=function(_0x75456c,_0x2e2c15){if(_0x75456c[_0x0572('0x4a')]['id']){delete _0x75456c['body']['id'];}return db['AnalyticTreeReport'][_0x0572('0x47')]({'where':{'id':_0x75456c[_0x0572('0x46')]['id']}})[_0x0572('0x25')](handleEntityNotFound(_0x2e2c15,null))[_0x0572('0x25')](saveUpdates(_0x75456c[_0x0572('0x4a')],null))[_0x0572('0x25')](respondWithResult(_0x2e2c15,null))[_0x0572('0x48')](handleError(_0x2e2c15,null));};exports['destroy']=function(_0x3c50d1,_0x1345bb){return db[_0x0572('0x2c')][_0x0572('0x47')]({'where':{'id':_0x3c50d1[_0x0572('0x46')]['id']}})['then'](handleEntityNotFound(_0x1345bb,null))[_0x0572('0x25')](removeEntity(_0x1345bb,null))['catch'](handleError(_0x1345bb,null));}; \ No newline at end of file +var _0x062a=['sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','end','error','stack','name','send','map','AnalyticTreeReport','rawAttributes','query','keys','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','fields','length','find','catch','update','body','destroy','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x062a,0xc0));var _0xa062=function(_0xfb02c9,_0x43c274){_0xfb02c9=_0xfb02c9-0x0;var _0x9afb71=_0x062a[_0xfb02c9];return _0x9afb71;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa062('0x0'));var zipdir=require(_0xa062('0x1'));var jsonpatch=require(_0xa062('0x2'));var rp=require('request-promise');var moment=require(_0xa062('0x3'));var BPromise=require(_0xa062('0x4'));var Mustache=require('mustache');var util=require(_0xa062('0x5'));var path=require(_0xa062('0x6'));var sox=require(_0xa062('0x7'));var csv=require(_0xa062('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa062('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa062('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa062('0xb'));var Papa=require('papaparse');var Redis=require(_0xa062('0xc'));var authService=require(_0xa062('0xd'));var qs=require(_0xa062('0xe'));var as=require(_0xa062('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa062('0x10'))(_0xa062('0x11'));var utils=require(_0xa062('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xa062('0x13'));var db=require(_0xa062('0x14'))['db'];function respondWithStatusCode(_0x364418,_0x260e14){_0x260e14=_0x260e14||0xcc;return function(_0x51f6de){if(_0x51f6de){return _0x364418[_0xa062('0x15')](_0x260e14);}return _0x364418['status'](_0x260e14)['end']();};}function respondWithResult(_0x311d86,_0x16d163){_0x16d163=_0x16d163||0xc8;return function(_0x590ed5){if(_0x590ed5){return _0x311d86[_0xa062('0x16')](_0x16d163)[_0xa062('0x17')](_0x590ed5);}};}function respondWithFilteredResult(_0x10a0a1,_0x4bd4aa){return function(_0x156ee6){if(_0x156ee6){var _0x20c4b8=typeof _0x4bd4aa[_0xa062('0x18')]===_0xa062('0x19')&&typeof _0x4bd4aa['limit']===_0xa062('0x19');var _0x24e0c3=_0x156ee6[_0xa062('0x1a')];var _0xa46521=_0x20c4b8?0x0:_0x4bd4aa[_0xa062('0x18')];var _0x41998b=_0x20c4b8?_0x156ee6['count']:_0x4bd4aa[_0xa062('0x18')]+_0x4bd4aa[_0xa062('0x1b')];var _0x2a5ccc;if(_0x41998b>=_0x24e0c3){_0x41998b=_0x24e0c3;_0x2a5ccc=0xc8;}else{_0x2a5ccc=0xce;}_0x10a0a1[_0xa062('0x16')](_0x2a5ccc);return _0x10a0a1[_0xa062('0x1c')](_0xa062('0x1d'),_0xa46521+'-'+_0x41998b+'/'+_0x24e0c3)[_0xa062('0x17')](_0x156ee6);}return null;};}function patchUpdates(_0x47cff0){return function(_0x4ab0d7){try{jsonpatch[_0xa062('0x1e')](_0x4ab0d7,_0x47cff0,!![]);}catch(_0x2b8dca){return BPromise[_0xa062('0x1f')](_0x2b8dca);}return _0x4ab0d7[_0xa062('0x20')]();};}function saveUpdates(_0x6376dc,_0x5d047b){return function(_0x421092){if(_0x421092){return _0x421092['update'](_0x6376dc)[_0xa062('0x21')](function(_0x4e58b3){return _0x4e58b3;});}return null;};}function removeEntity(_0x5bb1fc,_0x35ddd2){return function(_0x2fcb63){if(_0x2fcb63){return _0x2fcb63['destroy']()[_0xa062('0x21')](function(){_0x5bb1fc['status'](0xcc)[_0xa062('0x22')]();});}};}function handleEntityNotFound(_0x1597d5,_0x415495){return function(_0x2740f4){if(!_0x2740f4){_0x1597d5[_0xa062('0x15')](0x194);}return _0x2740f4;};}function handleError(_0x162ea2,_0x216ac6){_0x216ac6=_0x216ac6||0x1f4;return function(_0x4f2c05){logger[_0xa062('0x23')](_0x4f2c05[_0xa062('0x24')]);if(_0x4f2c05[_0xa062('0x25')]){delete _0x4f2c05[_0xa062('0x25')];}_0x162ea2[_0xa062('0x16')](_0x216ac6)[_0xa062('0x26')](_0x4f2c05);};}exports['index']=function(_0x9fda4b,_0x4d8af6){var _0x574af6={},_0x21bfb4={},_0x50cbd4={'count':0x0,'rows':[]};var _0x349b18=_[_0xa062('0x27')](db[_0xa062('0x28')][_0xa062('0x29')],function(_0xd36dae){return{'name':_0xd36dae['fieldName'],'type':_0xd36dae['type']['key']};});_0x21bfb4['model']=_[_0xa062('0x27')](_0x349b18,_0xa062('0x25'));_0x21bfb4[_0xa062('0x2a')]=_[_0xa062('0x2b')](_0x9fda4b['query']);_0x21bfb4['filters']=_[_0xa062('0x2c')](_0x21bfb4[_0xa062('0x2d')],_0x21bfb4[_0xa062('0x2a')]);_0x574af6[_0xa062('0x2e')]=_['intersection'](_0x21bfb4[_0xa062('0x2d')],qs['fields'](_0x9fda4b[_0xa062('0x2a')]['fields']));_0x574af6[_0xa062('0x2e')]=_0x574af6['attributes']['length']?_0x574af6[_0xa062('0x2e')]:_0x21bfb4[_0xa062('0x2d')];if(!_0x9fda4b['query'][_0xa062('0x2f')](_0xa062('0x30'))){_0x574af6['limit']=qs[_0xa062('0x1b')](_0x9fda4b[_0xa062('0x2a')][_0xa062('0x1b')]);_0x574af6[_0xa062('0x18')]=qs[_0xa062('0x18')](_0x9fda4b['query'][_0xa062('0x18')]);}_0x574af6[_0xa062('0x31')]=qs[_0xa062('0x32')](_0x9fda4b[_0xa062('0x2a')][_0xa062('0x32')]);_0x574af6['where']=qs[_0xa062('0x33')](_['pick'](_0x9fda4b[_0xa062('0x2a')],_0x21bfb4[_0xa062('0x33')]),_0x349b18);if(_0x9fda4b[_0xa062('0x2a')][_0xa062('0x34')]){_0x574af6[_0xa062('0x35')]=_[_0xa062('0x36')](_0x574af6[_0xa062('0x35')],{'$or':_[_0xa062('0x27')](_0x349b18,function(_0x4a9fe7){if(_0x4a9fe7[_0xa062('0x37')]!==_0xa062('0x38')){var _0x57076f={};_0x57076f[_0x4a9fe7[_0xa062('0x25')]]={'$like':'%'+_0x9fda4b[_0xa062('0x2a')][_0xa062('0x34')]+'%'};return _0x57076f;}})});}_0x574af6=_['merge']({},_0x574af6,_0x9fda4b[_0xa062('0x39')]);var _0x554cae={'where':_0x574af6[_0xa062('0x35')]};return db[_0xa062('0x28')]['count'](_0x554cae)['then'](function(_0x4162bb){_0x50cbd4['count']=_0x4162bb;if(_0x9fda4b[_0xa062('0x2a')][_0xa062('0x3a')]){_0x574af6[_0xa062('0x3b')]=[{'all':!![]}];}return db[_0xa062('0x28')][_0xa062('0x3c')](_0x574af6);})['then'](function(_0x11ec77){_0x50cbd4[_0xa062('0x3d')]=_0x11ec77;return _0x50cbd4;})[_0xa062('0x21')](respondWithFilteredResult(_0x4d8af6,_0x574af6))['catch'](handleError(_0x4d8af6,null));};exports[_0xa062('0x3e')]=function(_0x3df7fc,_0x1fdeb3){var _0x5f5b7f={'raw':!![],'where':{'id':_0x3df7fc[_0xa062('0x3f')]['id']}},_0x400087={};_0x400087[_0xa062('0x2d')]=_[_0xa062('0x2b')](db[_0xa062('0x28')][_0xa062('0x29')]);_0x400087['query']=_['keys'](_0x3df7fc[_0xa062('0x2a')]);_0x400087['filters']=_[_0xa062('0x2c')](_0x400087[_0xa062('0x2d')],_0x400087[_0xa062('0x2a')]);_0x5f5b7f[_0xa062('0x2e')]=_[_0xa062('0x2c')](_0x400087[_0xa062('0x2d')],qs[_0xa062('0x40')](_0x3df7fc['query']['fields']));_0x5f5b7f[_0xa062('0x2e')]=_0x5f5b7f[_0xa062('0x2e')][_0xa062('0x41')]?_0x5f5b7f['attributes']:_0x400087[_0xa062('0x2d')];if(_0x3df7fc[_0xa062('0x2a')]['includeAll']){_0x5f5b7f[_0xa062('0x3b')]=[{'all':!![]}];}_0x5f5b7f=_[_0xa062('0x36')]({},_0x5f5b7f,_0x3df7fc['options']);return db[_0xa062('0x28')][_0xa062('0x42')](_0x5f5b7f)[_0xa062('0x21')](handleEntityNotFound(_0x1fdeb3,null))[_0xa062('0x21')](respondWithResult(_0x1fdeb3,null))['catch'](handleError(_0x1fdeb3,null));};exports['create']=function(_0x1952cc,_0x210613){return db['AnalyticTreeReport']['create'](_0x1952cc['body'],{})[_0xa062('0x21')](respondWithResult(_0x210613,0xc9))[_0xa062('0x43')](handleError(_0x210613,null));};exports[_0xa062('0x44')]=function(_0x1102d1,_0x193f0b){if(_0x1102d1[_0xa062('0x45')]['id']){delete _0x1102d1[_0xa062('0x45')]['id'];}return db[_0xa062('0x28')]['find']({'where':{'id':_0x1102d1[_0xa062('0x3f')]['id']}})[_0xa062('0x21')](handleEntityNotFound(_0x193f0b,null))['then'](saveUpdates(_0x1102d1[_0xa062('0x45')],null))[_0xa062('0x21')](respondWithResult(_0x193f0b,null))['catch'](handleError(_0x193f0b,null));};exports[_0xa062('0x46')]=function(_0x24f150,_0x3d6a65){return db[_0xa062('0x28')]['find']({'where':{'id':_0x24f150[_0xa062('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3d6a65,null))['then'](removeEntity(_0x3d6a65,null))[_0xa062('0x43')](handleError(_0x3d6a65,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index e737e53..ecd90f5 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 _0x80e4=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util'];(function(_0x6bf157,_0xdbf619){var _0x4c541e=function(_0x12b768){while(--_0x12b768){_0x6bf157['push'](_0x6bf157['shift']());}};_0x4c541e(++_0xdbf619);}(_0x80e4,0x116));var _0x480e=function(_0x5ad07c,_0x324dcd){_0x5ad07c=_0x5ad07c-0x0;var _0x204bae=_0x80e4[_0x5ad07c];return _0x204bae;};'use strict';var _=require(_0x480e('0x0'));var util=require(_0x480e('0x1'));var logger=require(_0x480e('0x2'))(_0x480e('0x3'));var moment=require(_0x480e('0x4'));var BPromise=require(_0x480e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x480e('0x6'));var rimraf=require(_0x480e('0x7'));var config=require(_0x480e('0x8'));var attributes=require(_0x480e('0x9'));module[_0x480e('0xa')]=function(_0x50c0cb,_0x18ceac){return _0x50c0cb[_0x480e('0xb')](_0x480e('0xc'),attributes,{'tableName':_0x480e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdfd2=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','AnalyticTreeReport','analytics_report_trees'];(function(_0xe7281f,_0x2d77c3){var _0x90dc99=function(_0x1e335b){while(--_0x1e335b){_0xe7281f['push'](_0xe7281f['shift']());}};_0x90dc99(++_0x2d77c3);}(_0xdfd2,0x120));var _0x2dfd=function(_0x3a7a0b,_0x5114aa){_0x3a7a0b=_0x3a7a0b-0x0;var _0x2755f3=_0xdfd2[_0x3a7a0b];return _0x2755f3;};'use strict';var _=require(_0x2dfd('0x0'));var util=require(_0x2dfd('0x1'));var logger=require('../../config/logger')(_0x2dfd('0x2'));var moment=require('moment');var BPromise=require(_0x2dfd('0x3'));var rp=require(_0x2dfd('0x4'));var fs=require('fs');var path=require(_0x2dfd('0x5'));var rimraf=require(_0x2dfd('0x6'));var config=require(_0x2dfd('0x7'));var attributes=require(_0x2dfd('0x8'));module[_0x2dfd('0x9')]=function(_0x5a67ae,_0x560f05){return _0x5a67ae['define'](_0x2dfd('0xa'),attributes,{'tableName':_0x2dfd('0xb'),'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 bbf4d96..f001cdd 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x22f5ea,_0x3a6a30){var _0xe5955=function(_0x139704){while(--_0x139704){_0x22f5ea['push'](_0x22f5ea['shift']());}};_0xe5955(++_0x3a6a30);}(_0xadb5,0xad));var _0x5adb=function(_0x32f706,_0x295301){_0x32f706=_0x32f706-0x0;var _0x35ac84=_0xadb5[_0x32f706];return _0x35ac84;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x7a54=['info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x3ceac8,_0x3a4aad){_0x3ceac8=_0x3ceac8-0x0;var _0x47c70b=_0x7a54[_0x3ceac8];return _0x47c70b;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index fcd9ed4..7e50e0b 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 _0xf641=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','/:id','post','create','update','delete','destroy','exports','connect-timeout','express'];(function(_0x295849,_0x42b3eb){var _0x27d8d4=function(_0x375ae0){while(--_0x375ae0){_0x295849['push'](_0x295849['shift']());}};_0x27d8d4(++_0x42b3eb);}(_0xf641,0x17e));var _0x1f64=function(_0x33ca22,_0xbcc94){_0x33ca22=_0x33ca22-0x0;var _0x1790c3=_0xf641[_0x33ca22];return _0x1790c3;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x1f64('0x0'));var express=require(_0x1f64('0x1'));var router=express[_0x1f64('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x1f64('0x3'));var interaction=require(_0x1f64('0x4'));var config=require(_0x1f64('0x5'));var controller=require(_0x1f64('0x6'));router[_0x1f64('0x7')]('/',auth[_0x1f64('0x8')](),controller['index']);router['get'](_0x1f64('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x1f64('0xa')]('/',auth[_0x1f64('0x8')](),controller[_0x1f64('0xb')]);router['put'](_0x1f64('0x9'),auth['isAuthenticated'](),controller[_0x1f64('0xc')]);router[_0x1f64('0xd')](_0x1f64('0x9'),auth[_0x1f64('0x8')](),controller[_0x1f64('0xe')]);module[_0x1f64('0xf')]=router; \ No newline at end of file +var _0xa0a0=['post','create','put','update','delete','destroy','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show'];(function(_0x4853b5,_0x128326){var _0x19e769=function(_0x557fdd){while(--_0x557fdd){_0x4853b5['push'](_0x4853b5['shift']());}};_0x19e769(++_0x128326);}(_0xa0a0,0x182));var _0x0a0a=function(_0x27d958,_0x29ef87){_0x27d958=_0x27d958-0x0;var _0x53e63e=_0xa0a0[_0x27d958];return _0x53e63e;};'use strict';var multer=require('multer');var util=require(_0x0a0a('0x0'));var path=require(_0x0a0a('0x1'));var timeout=require('connect-timeout');var express=require(_0x0a0a('0x2'));var router=express['Router']();var fs_extra=require(_0x0a0a('0x3'));var auth=require(_0x0a0a('0x4'));var interaction=require(_0x0a0a('0x5'));var config=require(_0x0a0a('0x6'));var controller=require(_0x0a0a('0x7'));router[_0x0a0a('0x8')]('/',auth[_0x0a0a('0x9')](),controller[_0x0a0a('0xa')]);router[_0x0a0a('0x8')](_0x0a0a('0xb'),auth['isAuthenticated'](),controller[_0x0a0a('0xc')]);router[_0x0a0a('0xd')]('/',auth[_0x0a0a('0x9')](),controller[_0x0a0a('0xe')]);router[_0x0a0a('0xf')](_0x0a0a('0xb'),auth['isAuthenticated'](),controller[_0x0a0a('0x10')]);router[_0x0a0a('0x11')]('/:id',auth[_0x0a0a('0x9')](),controller[_0x0a0a('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 03f11df..b3df672 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 _0x5044=['exports','STRING'];(function(_0x8599ab,_0x2aab42){var _0x191a01=function(_0x2bd1c9){while(--_0x2bd1c9){_0x8599ab['push'](_0x8599ab['shift']());}};_0x191a01(++_0x2aab42);}(_0x5044,0xc8));var _0x4504=function(_0x1c0e04,_0x402de0){_0x1c0e04=_0x1c0e04-0x0;var _0x2e01aa=_0x5044[_0x1c0e04];return _0x2e01aa;};'use strict';var Sequelize=require('sequelize');module[_0x4504('0x0')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x4504('0x1')]},'type':{'type':Sequelize[_0x4504('0x1')]}}; \ No newline at end of file +var _0xa991=['STRING','sequelize'];(function(_0x1b2763,_0x49e0b5){var _0x5a02a5=function(_0x4d13a9){while(--_0x4d13a9){_0x1b2763['push'](_0x1b2763['shift']());}};_0x5a02a5(++_0x49e0b5);}(_0xa991,0x143));var _0x1a99=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xa991[_0xdea41a];return _0x15d0d8;};'use strict';var Sequelize=require(_0x1a99('0x0'));module['exports']={'name':{'type':Sequelize[_0x1a99('0x1')]},'basename':{'type':Sequelize[_0x1a99('0x1')]},'type':{'type':Sequelize[_0x1a99('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 02c253b..bb9b388 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 _0x064e=['attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','then','include','rows','show','params','keys','rawAttributes','intersection','includeAll','find','catch','clone','options','get','createdAt','updatedAt','body','create','update','basename','file','filename','mimetype','download','ChatOfflineMessageId','join','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','end','error','name','send','map','Attachment','fieldName','type','key','model','query','filters'];(function(_0x366e51,_0x3a0178){var _0x4e23e3=function(_0x7ecebe){while(--_0x7ecebe){_0x366e51['push'](_0x366e51['shift']());}};_0x4e23e3(++_0x3a0178);}(_0x064e,0x12d));var _0xe064=function(_0x2cd463,_0x1ce1e8){_0x2cd463=_0x2cd463-0x0;var _0x45e961=_0x064e[_0x2cd463];return _0x45e961;};'use strict';var emlformat=require(_0xe064('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe064('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe064('0x2'));var moment=require(_0xe064('0x3'));var BPromise=require(_0xe064('0x4'));var Mustache=require(_0xe064('0x5'));var util=require('util');var path=require(_0xe064('0x6'));var sox=require(_0xe064('0x7'));var csv=require('to-csv');var ejs=require(_0xe064('0x8'));var fs=require('fs');var fs_extra=require(_0xe064('0x9'));var _=require(_0xe064('0xa'));var squel=require(_0xe064('0xb'));var crypto=require(_0xe064('0xc'));var jsforce=require(_0xe064('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe064('0xe'));var Papa=require(_0xe064('0xf'));var Redis=require(_0xe064('0x10'));var authService=require(_0xe064('0x11'));var qs=require(_0xe064('0x12'));var as=require(_0xe064('0x13'));var hardwareService=require(_0xe064('0x14'));var logger=require(_0xe064('0x15'))(_0xe064('0x16'));var utils=require(_0xe064('0x17'));var config=require(_0xe064('0x18'));var licenseUtil=require(_0xe064('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x328053,_0x2c60db){_0x2c60db=_0x2c60db||0xcc;return function(_0x16e7ba){if(_0x16e7ba){return _0x328053[_0xe064('0x1a')](_0x2c60db);}return _0x328053['status'](_0x2c60db)['end']();};}function respondWithResult(_0x2a3688,_0x1393f2){_0x1393f2=_0x1393f2||0xc8;return function(_0x46ed17){if(_0x46ed17){return _0x2a3688[_0xe064('0x1b')](_0x1393f2)[_0xe064('0x1c')](_0x46ed17);}};}function respondWithFilteredResult(_0x8d0c8f,_0x139926){return function(_0x5153ab){if(_0x5153ab){var _0x49ee4a=typeof _0x139926['offset']===_0xe064('0x1d')&&typeof _0x139926['limit']===_0xe064('0x1d');var _0x18e01a=_0x5153ab[_0xe064('0x1e')];var _0x19f2fe=_0x49ee4a?0x0:_0x139926[_0xe064('0x1f')];var _0x353ed9=_0x49ee4a?_0x5153ab[_0xe064('0x1e')]:_0x139926[_0xe064('0x1f')]+_0x139926[_0xe064('0x20')];var _0x58e51;if(_0x353ed9>=_0x18e01a){_0x353ed9=_0x18e01a;_0x58e51=0xc8;}else{_0x58e51=0xce;}_0x8d0c8f[_0xe064('0x1b')](_0x58e51);return _0x8d0c8f[_0xe064('0x21')](_0xe064('0x22'),_0x19f2fe+'-'+_0x353ed9+'/'+_0x18e01a)[_0xe064('0x1c')](_0x5153ab);}return null;};}function patchUpdates(_0x587c18){return function(_0x50b107){try{jsonpatch[_0xe064('0x23')](_0x50b107,_0x587c18,!![]);}catch(_0x586a30){return BPromise[_0xe064('0x24')](_0x586a30);}return _0x50b107[_0xe064('0x25')]();};}function saveUpdates(_0x49e44d,_0x4c490d){return function(_0x15337f){if(_0x15337f){return _0x15337f['update'](_0x49e44d)['then'](function(_0x288fbe){return _0x288fbe;});}return null;};}function removeEntity(_0x454355,_0x403aaf){return function(_0x295ac9){if(_0x295ac9){return _0x295ac9[_0xe064('0x26')]()['then'](function(){_0x454355['status'](0xcc)[_0xe064('0x27')]();});}};}function handleEntityNotFound(_0x1ac136,_0x2615a1){return function(_0x572c30){if(!_0x572c30){_0x1ac136[_0xe064('0x1a')](0x194);}return _0x572c30;};}function handleError(_0x56e90b,_0x2e350d){_0x2e350d=_0x2e350d||0x1f4;return function(_0x30f249){logger[_0xe064('0x28')](_0x30f249['stack']);if(_0x30f249[_0xe064('0x29')]){delete _0x30f249['name'];}_0x56e90b['status'](_0x2e350d)[_0xe064('0x2a')](_0x30f249);};}exports['index']=function(_0x52d356,_0xd1d99d){var _0x3c6556={},_0x2ec7a0={},_0x34c43a={'count':0x0,'rows':[]};var _0x3b1364=_[_0xe064('0x2b')](db[_0xe064('0x2c')]['rawAttributes'],function(_0x227a8c){return{'name':_0x227a8c[_0xe064('0x2d')],'type':_0x227a8c[_0xe064('0x2e')][_0xe064('0x2f')]};});_0x2ec7a0[_0xe064('0x30')]=_['map'](_0x3b1364,_0xe064('0x29'));_0x2ec7a0[_0xe064('0x31')]=_['keys'](_0x52d356[_0xe064('0x31')]);_0x2ec7a0[_0xe064('0x32')]=_['intersection'](_0x2ec7a0[_0xe064('0x30')],_0x2ec7a0[_0xe064('0x31')]);_0x3c6556[_0xe064('0x33')]=_['intersection'](_0x2ec7a0['model'],qs[_0xe064('0x34')](_0x52d356['query'][_0xe064('0x34')]));_0x3c6556[_0xe064('0x33')]=_0x3c6556[_0xe064('0x33')][_0xe064('0x35')]?_0x3c6556['attributes']:_0x2ec7a0[_0xe064('0x30')];if(!_0x52d356[_0xe064('0x31')][_0xe064('0x36')](_0xe064('0x37'))){_0x3c6556[_0xe064('0x20')]=qs[_0xe064('0x20')](_0x52d356[_0xe064('0x31')][_0xe064('0x20')]);_0x3c6556[_0xe064('0x1f')]=qs[_0xe064('0x1f')](_0x52d356['query'][_0xe064('0x1f')]);}_0x3c6556[_0xe064('0x38')]=qs['sort'](_0x52d356[_0xe064('0x31')]['sort']);_0x3c6556[_0xe064('0x39')]=qs[_0xe064('0x32')](_[_0xe064('0x3a')](_0x52d356['query'],_0x2ec7a0[_0xe064('0x32')]),_0x3b1364);if(_0x52d356[_0xe064('0x31')]['filter']){_0x3c6556[_0xe064('0x39')]=_[_0xe064('0x3b')](_0x3c6556[_0xe064('0x39')],{'$or':_[_0xe064('0x2b')](_0x3b1364,function(_0x12b776){if(_0x12b776[_0xe064('0x2e')]!==_0xe064('0x3c')){var _0x5cd968={};_0x5cd968[_0x12b776[_0xe064('0x29')]]={'$like':'%'+_0x52d356[_0xe064('0x31')][_0xe064('0x3d')]+'%'};return _0x5cd968;}})});}_0x3c6556=_['merge']({},_0x3c6556,_0x52d356['options']);var _0x4c88fb={'where':_0x3c6556[_0xe064('0x39')]};return db[_0xe064('0x2c')][_0xe064('0x1e')](_0x4c88fb)[_0xe064('0x3e')](function(_0x7d2ee1){_0x34c43a[_0xe064('0x1e')]=_0x7d2ee1;if(_0x52d356[_0xe064('0x31')]['includeAll']){_0x3c6556[_0xe064('0x3f')]=[{'all':!![]}];}return db['Attachment']['findAll'](_0x3c6556);})[_0xe064('0x3e')](function(_0x471646){_0x34c43a[_0xe064('0x40')]=_0x471646;return _0x34c43a;})[_0xe064('0x3e')](respondWithFilteredResult(_0xd1d99d,_0x3c6556))['catch'](handleError(_0xd1d99d,null));};exports[_0xe064('0x41')]=function(_0x1a83f3,_0x4d3a9e){var _0x161d6e={'raw':!![],'where':{'id':_0x1a83f3[_0xe064('0x42')]['id']}},_0x4d0282={};_0x4d0282['model']=_[_0xe064('0x43')](db['Attachment'][_0xe064('0x44')]);_0x4d0282['query']=_[_0xe064('0x43')](_0x1a83f3[_0xe064('0x31')]);_0x4d0282[_0xe064('0x32')]=_['intersection'](_0x4d0282[_0xe064('0x30')],_0x4d0282[_0xe064('0x31')]);_0x161d6e[_0xe064('0x33')]=_[_0xe064('0x45')](_0x4d0282[_0xe064('0x30')],qs[_0xe064('0x34')](_0x1a83f3[_0xe064('0x31')][_0xe064('0x34')]));_0x161d6e['attributes']=_0x161d6e['attributes'][_0xe064('0x35')]?_0x161d6e['attributes']:_0x4d0282[_0xe064('0x30')];if(_0x1a83f3['query'][_0xe064('0x46')]){_0x161d6e['include']=[{'all':!![]}];}_0x161d6e=_[_0xe064('0x3b')]({},_0x161d6e,_0x1a83f3['options']);return db[_0xe064('0x2c')][_0xe064('0x47')](_0x161d6e)['then'](handleEntityNotFound(_0x4d3a9e,null))[_0xe064('0x3e')](respondWithResult(_0x4d3a9e,null))[_0xe064('0x48')](handleError(_0x4d3a9e,null));};exports[_0xe064('0x49')]=function(_0x54808c,_0xfb6915){var _0x5ea9c1={'where':{'id':_0x54808c['params']['id']}},_0xe059e5={};_0xe059e5[_0xe064('0x30')]=_[_0xe064('0x43')](db[_0xe064('0x2c')][_0xe064('0x44')]);_0x5ea9c1[_0xe064('0x33')]=_['intersection'](_0xe059e5['model'],qs['fields'](_0x54808c[_0xe064('0x31')][_0xe064('0x34')]));_0x5ea9c1[_0xe064('0x33')]=_0x5ea9c1[_0xe064('0x33')]['length']?_0x5ea9c1['attributes']:_0xe059e5[_0xe064('0x30')];if(_0x54808c[_0xe064('0x31')][_0xe064('0x46')]){_0x5ea9c1[_0xe064('0x3f')]=[{'all':!![]}];}_0x5ea9c1=_[_0xe064('0x3b')]({},_0x5ea9c1,_0x54808c[_0xe064('0x4a')]);return db['Attachment'][_0xe064('0x47')](_0x5ea9c1)[_0xe064('0x3e')](handleEntityNotFound(_0xfb6915,null))[_0xe064('0x3e')](function(_0x5f415f){if(_0x5f415f){var _0x1fcfbc=_0x5f415f[_0xe064('0x4b')]({'plain':!![]});_0x1fcfbc=qs['omit'](_0x1fcfbc,['id',_0xe064('0x4c'),_0xe064('0x4d')]);_0x54808c[_0xe064('0x4e')]=_['omit'](_0x54808c['body'],['id',_0xe064('0x4c'),_0xe064('0x4d')]);return db[_0xe064('0x2c')][_0xe064('0x4f')](_[_0xe064('0x3b')](_0x1fcfbc,_0x54808c['body']),{'include':_0x54808c[_0xe064('0x31')][_0xe064('0x46')]?[{'all':!![]}]:undefined});}})[_0xe064('0x3e')](respondWithResult(_0xfb6915,0xc9))[_0xe064('0x48')](handleError(_0xfb6915,null));};exports[_0xe064('0x50')]=function(_0xd7ff66,_0x27a630){if(_0xd7ff66[_0xe064('0x4e')]['id']){delete _0xd7ff66['body']['id'];}return db[_0xe064('0x2c')][_0xe064('0x47')]({'where':{'id':_0xd7ff66[_0xe064('0x42')]['id']}})[_0xe064('0x3e')](handleEntityNotFound(_0x27a630,null))[_0xe064('0x3e')](saveUpdates(_0xd7ff66[_0xe064('0x4e')],null))[_0xe064('0x3e')](respondWithResult(_0x27a630,null))[_0xe064('0x48')](handleError(_0x27a630,null));};exports[_0xe064('0x26')]=function(_0x2c19fe,_0x16edbe){return db[_0xe064('0x2c')][_0xe064('0x47')]({'where':{'id':_0x2c19fe['params']['id']}})[_0xe064('0x3e')](handleEntityNotFound(_0x16edbe,null))[_0xe064('0x3e')](removeEntity(_0x16edbe,null))[_0xe064('0x48')](handleError(_0x16edbe,null));};exports[_0xe064('0x4f')]=function(_0x48741e,_0x45be39,_0x1abd38){_0x48741e[_0xe064('0x4e')]['name']=_0x48741e['file']['originalname'];_0x48741e['body'][_0xe064('0x51')]=_0x48741e[_0xe064('0x52')][_0xe064('0x53')];_0x48741e['body'][_0xe064('0x2e')]=_0x48741e[_0xe064('0x52')][_0xe064('0x54')];return db[_0xe064('0x2c')][_0xe064('0x4f')](_0x48741e[_0xe064('0x4e')])[_0xe064('0x3e')](respondWithResult(_0x45be39,0xc9))[_0xe064('0x48')](handleError(_0x45be39,null));};exports[_0xe064('0x55')]=function(_0x1e8b06,_0x4192de,_0x2f36ae){return db[_0xe064('0x2c')]['findOne']({'where':{'id':_0x1e8b06[_0xe064('0x42')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4192de,null))[_0xe064('0x3e')](function(_0x209d5b){if(_0x209d5b){var _0x110b57=_0x209d5b[_0xe064('0x56')]!==null;var _0x4939d7=path[_0xe064('0x57')](config['root'],'server/files/attachments/');if(_0x110b57){_0x4939d7=path['join'](_0x4939d7,'offline-chat/');}var _0x399e75=path['join'](_0x4939d7,_0x209d5b[_0xe064('0x51')]);return _0x4192de[_0xe064('0x55')](_0x399e75);}})['catch'](handleError(_0x4192de,null));}; \ No newline at end of file +var _0x791b=['hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','clone','omit','createdAt','body','updatedAt','create','update','originalname','basename','file','filename','type','download','findOne','ChatOfflineMessageId','join','server/files/attachments/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','Attachment','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x791b,0x12b));var _0xb791=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x791b[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0xb791('0x0'));var rimraf=require(_0xb791('0x1'));var zipdir=require(_0xb791('0x2'));var jsonpatch=require(_0xb791('0x3'));var rp=require(_0xb791('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb791('0x5'));var util=require(_0xb791('0x6'));var path=require(_0xb791('0x7'));var sox=require(_0xb791('0x8'));var csv=require(_0xb791('0x9'));var ejs=require(_0xb791('0xa'));var fs=require('fs');var fs_extra=require(_0xb791('0xb'));var _=require(_0xb791('0xc'));var squel=require(_0xb791('0xd'));var crypto=require('crypto');var jsforce=require(_0xb791('0xe'));var deskjs=require(_0xb791('0xf'));var toCsv=require(_0xb791('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb791('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb791('0x11'));var hardwareService=require(_0xb791('0x12'));var logger=require(_0xb791('0x13'))('api');var utils=require(_0xb791('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb791('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x525eb5,_0x467ad1){_0x467ad1=_0x467ad1||0xcc;return function(_0x3d2d46){if(_0x3d2d46){return _0x525eb5[_0xb791('0x16')](_0x467ad1);}return _0x525eb5[_0xb791('0x17')](_0x467ad1)[_0xb791('0x18')]();};}function respondWithResult(_0xee7d14,_0x1a152b){_0x1a152b=_0x1a152b||0xc8;return function(_0x399963){if(_0x399963){return _0xee7d14[_0xb791('0x17')](_0x1a152b)[_0xb791('0x19')](_0x399963);}};}function respondWithFilteredResult(_0x136ef2,_0x28d2db){return function(_0x36f03b){if(_0x36f03b){var _0x1280ee=typeof _0x28d2db[_0xb791('0x1a')]===_0xb791('0x1b')&&typeof _0x28d2db[_0xb791('0x1c')]===_0xb791('0x1b');var _0x11a3c2=_0x36f03b[_0xb791('0x1d')];var _0x1f57c8=_0x1280ee?0x0:_0x28d2db[_0xb791('0x1a')];var _0x33d2b0=_0x1280ee?_0x36f03b['count']:_0x28d2db[_0xb791('0x1a')]+_0x28d2db[_0xb791('0x1c')];var _0x3bf6b1;if(_0x33d2b0>=_0x11a3c2){_0x33d2b0=_0x11a3c2;_0x3bf6b1=0xc8;}else{_0x3bf6b1=0xce;}_0x136ef2[_0xb791('0x17')](_0x3bf6b1);return _0x136ef2['set'](_0xb791('0x1e'),_0x1f57c8+'-'+_0x33d2b0+'/'+_0x11a3c2)[_0xb791('0x19')](_0x36f03b);}return null;};}function patchUpdates(_0x5cf3d8){return function(_0x2a1028){try{jsonpatch[_0xb791('0x1f')](_0x2a1028,_0x5cf3d8,!![]);}catch(_0xe330a5){return BPromise[_0xb791('0x20')](_0xe330a5);}return _0x2a1028[_0xb791('0x21')]();};}function saveUpdates(_0x2254e2,_0xcb55c5){return function(_0x5f2f47){if(_0x5f2f47){return _0x5f2f47['update'](_0x2254e2)[_0xb791('0x22')](function(_0x1f5835){return _0x1f5835;});}return null;};}function removeEntity(_0x203a66,_0x33e0a8){return function(_0x233b83){if(_0x233b83){return _0x233b83[_0xb791('0x23')]()[_0xb791('0x22')](function(){_0x203a66[_0xb791('0x17')](0xcc)[_0xb791('0x18')]();});}};}function handleEntityNotFound(_0x5a0733,_0x15d13d){return function(_0x31fd63){if(!_0x31fd63){_0x5a0733[_0xb791('0x16')](0x194);}return _0x31fd63;};}function handleError(_0x5de59d,_0x2c02e8){_0x2c02e8=_0x2c02e8||0x1f4;return function(_0x2b7aa4){logger[_0xb791('0x24')](_0x2b7aa4[_0xb791('0x25')]);if(_0x2b7aa4[_0xb791('0x26')]){delete _0x2b7aa4['name'];}_0x5de59d['status'](_0x2c02e8)['send'](_0x2b7aa4);};}exports[_0xb791('0x27')]=function(_0xaf722,_0x3a04bd){var _0x3331be={},_0x546cb4={},_0x5072e2={'count':0x0,'rows':[]};var _0x1f1970=_[_0xb791('0x28')](db[_0xb791('0x29')][_0xb791('0x2a')],function(_0x2c839f){return{'name':_0x2c839f[_0xb791('0x2b')],'type':_0x2c839f['type'][_0xb791('0x2c')]};});_0x546cb4[_0xb791('0x2d')]=_['map'](_0x1f1970,_0xb791('0x26'));_0x546cb4[_0xb791('0x2e')]=_[_0xb791('0x2f')](_0xaf722['query']);_0x546cb4[_0xb791('0x30')]=_[_0xb791('0x31')](_0x546cb4[_0xb791('0x2d')],_0x546cb4[_0xb791('0x2e')]);_0x3331be[_0xb791('0x32')]=_['intersection'](_0x546cb4[_0xb791('0x2d')],qs[_0xb791('0x33')](_0xaf722['query'][_0xb791('0x33')]));_0x3331be[_0xb791('0x32')]=_0x3331be[_0xb791('0x32')][_0xb791('0x34')]?_0x3331be[_0xb791('0x32')]:_0x546cb4[_0xb791('0x2d')];if(!_0xaf722[_0xb791('0x2e')][_0xb791('0x35')](_0xb791('0x36'))){_0x3331be[_0xb791('0x1c')]=qs[_0xb791('0x1c')](_0xaf722[_0xb791('0x2e')][_0xb791('0x1c')]);_0x3331be['offset']=qs[_0xb791('0x1a')](_0xaf722[_0xb791('0x2e')][_0xb791('0x1a')]);}_0x3331be[_0xb791('0x37')]=qs['sort'](_0xaf722[_0xb791('0x2e')][_0xb791('0x38')]);_0x3331be[_0xb791('0x39')]=qs['filters'](_[_0xb791('0x3a')](_0xaf722[_0xb791('0x2e')],_0x546cb4['filters']),_0x1f1970);if(_0xaf722[_0xb791('0x2e')][_0xb791('0x3b')]){_0x3331be[_0xb791('0x39')]=_['merge'](_0x3331be[_0xb791('0x39')],{'$or':_[_0xb791('0x28')](_0x1f1970,function(_0x5dca1f){if(_0x5dca1f['type']!==_0xb791('0x3c')){var _0x46f43c={};_0x46f43c[_0x5dca1f[_0xb791('0x26')]]={'$like':'%'+_0xaf722['query'][_0xb791('0x3b')]+'%'};return _0x46f43c;}})});}_0x3331be=_[_0xb791('0x3d')]({},_0x3331be,_0xaf722[_0xb791('0x3e')]);var _0x310a42={'where':_0x3331be[_0xb791('0x39')]};return db[_0xb791('0x29')]['count'](_0x310a42)[_0xb791('0x22')](function(_0xd91330){_0x5072e2[_0xb791('0x1d')]=_0xd91330;if(_0xaf722['query'][_0xb791('0x3f')]){_0x3331be[_0xb791('0x40')]=[{'all':!![]}];}return db[_0xb791('0x29')][_0xb791('0x41')](_0x3331be);})[_0xb791('0x22')](function(_0x14e9a2){_0x5072e2[_0xb791('0x42')]=_0x14e9a2;return _0x5072e2;})[_0xb791('0x22')](respondWithFilteredResult(_0x3a04bd,_0x3331be))[_0xb791('0x43')](handleError(_0x3a04bd,null));};exports[_0xb791('0x44')]=function(_0x16a6d3,_0x5b4e32){var _0x238681={'raw':!![],'where':{'id':_0x16a6d3[_0xb791('0x45')]['id']}},_0x2cff29={};_0x2cff29[_0xb791('0x2d')]=_[_0xb791('0x2f')](db[_0xb791('0x29')][_0xb791('0x2a')]);_0x2cff29[_0xb791('0x2e')]=_[_0xb791('0x2f')](_0x16a6d3[_0xb791('0x2e')]);_0x2cff29[_0xb791('0x30')]=_[_0xb791('0x31')](_0x2cff29[_0xb791('0x2d')],_0x2cff29['query']);_0x238681['attributes']=_[_0xb791('0x31')](_0x2cff29[_0xb791('0x2d')],qs[_0xb791('0x33')](_0x16a6d3['query']['fields']));_0x238681[_0xb791('0x32')]=_0x238681[_0xb791('0x32')]['length']?_0x238681['attributes']:_0x2cff29[_0xb791('0x2d')];if(_0x16a6d3[_0xb791('0x2e')][_0xb791('0x3f')]){_0x238681[_0xb791('0x40')]=[{'all':!![]}];}_0x238681=_[_0xb791('0x3d')]({},_0x238681,_0x16a6d3[_0xb791('0x3e')]);return db[_0xb791('0x29')][_0xb791('0x46')](_0x238681)[_0xb791('0x22')](handleEntityNotFound(_0x5b4e32,null))[_0xb791('0x22')](respondWithResult(_0x5b4e32,null))['catch'](handleError(_0x5b4e32,null));};exports[_0xb791('0x47')]=function(_0x3da087,_0x1e72d6){var _0x55be15={'where':{'id':_0x3da087[_0xb791('0x45')]['id']}},_0x3212d5={};_0x3212d5[_0xb791('0x2d')]=_[_0xb791('0x2f')](db[_0xb791('0x29')][_0xb791('0x2a')]);_0x55be15['attributes']=_[_0xb791('0x31')](_0x3212d5[_0xb791('0x2d')],qs[_0xb791('0x33')](_0x3da087['query'][_0xb791('0x33')]));_0x55be15[_0xb791('0x32')]=_0x55be15[_0xb791('0x32')][_0xb791('0x34')]?_0x55be15[_0xb791('0x32')]:_0x3212d5['model'];if(_0x3da087[_0xb791('0x2e')][_0xb791('0x3f')]){_0x55be15[_0xb791('0x40')]=[{'all':!![]}];}_0x55be15=_[_0xb791('0x3d')]({},_0x55be15,_0x3da087['options']);return db[_0xb791('0x29')][_0xb791('0x46')](_0x55be15)[_0xb791('0x22')](handleEntityNotFound(_0x1e72d6,null))['then'](function(_0x2766cc){if(_0x2766cc){var _0x7ed265=_0x2766cc['get']({'plain':!![]});_0x7ed265=qs[_0xb791('0x48')](_0x7ed265,['id',_0xb791('0x49'),'updatedAt']);_0x3da087[_0xb791('0x4a')]=_[_0xb791('0x48')](_0x3da087[_0xb791('0x4a')],['id',_0xb791('0x49'),_0xb791('0x4b')]);return db[_0xb791('0x29')][_0xb791('0x4c')](_[_0xb791('0x3d')](_0x7ed265,_0x3da087['body']),{'include':_0x3da087[_0xb791('0x2e')][_0xb791('0x3f')]?[{'all':!![]}]:undefined});}})[_0xb791('0x22')](respondWithResult(_0x1e72d6,0xc9))[_0xb791('0x43')](handleError(_0x1e72d6,null));};exports[_0xb791('0x4d')]=function(_0x2a60af,_0x5c8d5a){if(_0x2a60af[_0xb791('0x4a')]['id']){delete _0x2a60af[_0xb791('0x4a')]['id'];}return db[_0xb791('0x29')][_0xb791('0x46')]({'where':{'id':_0x2a60af['params']['id']}})[_0xb791('0x22')](handleEntityNotFound(_0x5c8d5a,null))[_0xb791('0x22')](saveUpdates(_0x2a60af[_0xb791('0x4a')],null))[_0xb791('0x22')](respondWithResult(_0x5c8d5a,null))['catch'](handleError(_0x5c8d5a,null));};exports[_0xb791('0x23')]=function(_0x51f211,_0x2463be){return db[_0xb791('0x29')]['find']({'where':{'id':_0x51f211[_0xb791('0x45')]['id']}})[_0xb791('0x22')](handleEntityNotFound(_0x2463be,null))[_0xb791('0x22')](removeEntity(_0x2463be,null))[_0xb791('0x43')](handleError(_0x2463be,null));};exports['create']=function(_0x29771d,_0x95eb05,_0x4d617f){_0x29771d['body'][_0xb791('0x26')]=_0x29771d['file'][_0xb791('0x4e')];_0x29771d[_0xb791('0x4a')][_0xb791('0x4f')]=_0x29771d[_0xb791('0x50')][_0xb791('0x51')];_0x29771d[_0xb791('0x4a')][_0xb791('0x52')]=_0x29771d[_0xb791('0x50')]['mimetype'];return db['Attachment'][_0xb791('0x4c')](_0x29771d[_0xb791('0x4a')])['then'](respondWithResult(_0x95eb05,0xc9))['catch'](handleError(_0x95eb05,null));};exports[_0xb791('0x53')]=function(_0x1d1655,_0x521ff9,_0x4c26cf){return db[_0xb791('0x29')][_0xb791('0x54')]({'where':{'id':_0x1d1655['params']['id']},'raw':!![]})[_0xb791('0x22')](handleEntityNotFound(_0x521ff9,null))[_0xb791('0x22')](function(_0x1c7a3d){if(_0x1c7a3d){var _0x1539fd=_0x1c7a3d[_0xb791('0x55')]!==null;var _0x4b561c=path[_0xb791('0x56')](config['root'],_0xb791('0x57'));if(_0x1539fd){_0x4b561c=path[_0xb791('0x56')](_0x4b561c,'offline-chat/');}var _0xda70c6=path[_0xb791('0x56')](_0x4b561c,_0x1c7a3d['basename']);return _0x521ff9[_0xb791('0x53')](_0xda70c6);}})[_0xb791('0x43')](handleError(_0x521ff9,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 8dccd30..97d3935 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 _0x533f=['Attachment','attachments','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./attachment.attributes'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x533f,0x98));var _0xf533=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x533f[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xf533('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf533('0x1'));var moment=require(_0xf533('0x2'));var BPromise=require('bluebird');var rp=require(_0xf533('0x3'));var fs=require('fs');var path=require(_0xf533('0x4'));var rimraf=require(_0xf533('0x5'));var config=require(_0xf533('0x6'));var attributes=require(_0xf533('0x7'));module['exports']=function(_0x12c5af,_0x53a117){return _0x12c5af['define'](_0xf533('0x8'),attributes,{'tableName':_0xf533('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd416=['path','./attachment.attributes','exports','Attachment','lodash','../../config/logger','api','moment','bluebird'];(function(_0x33ea46,_0x27da46){var _0x261a12=function(_0x23e9f6){while(--_0x23e9f6){_0x33ea46['push'](_0x33ea46['shift']());}};_0x261a12(++_0x27da46);}(_0xd416,0xe5));var _0x6d41=function(_0x1220bb,_0x4be304){_0x1220bb=_0x1220bb-0x0;var _0x55d857=_0xd416[_0x1220bb];return _0x55d857;};'use strict';var _=require(_0x6d41('0x0'));var util=require('util');var logger=require(_0x6d41('0x1'))(_0x6d41('0x2'));var moment=require(_0x6d41('0x3'));var BPromise=require(_0x6d41('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6d41('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6d41('0x6'));module[_0x6d41('0x7')]=function(_0x1236ee,_0x452f17){return _0x1236ee['define'](_0x6d41('0x8'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index b97fc7c..3e38942 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 _0xc91b=['client','http','request','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','Attachment','create','body','options','raw','CreateAttachment','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x4314d7,_0x355218){var _0x5c599b=function(_0x556354){while(--_0x556354){_0x4314d7['push'](_0x4314d7['shift']());}};_0x5c599b(++_0x355218);}(_0xc91b,0x16f));var _0xbc91=function(_0x4bfe69,_0x4b0066){_0x4bfe69=_0x4bfe69-0x0;var _0x4e4c3d=_0xc91b[_0x4bfe69];return _0x4e4c3d;};'use strict';var _=require(_0xbc91('0x0'));var util=require(_0xbc91('0x1'));var moment=require(_0xbc91('0x2'));var BPromise=require(_0xbc91('0x3'));var rs=require(_0xbc91('0x4'));var fs=require('fs');var Redis=require(_0xbc91('0x5'));var db=require(_0xbc91('0x6'))['db'];var utils=require(_0xbc91('0x7'));var logger=require('../../config/logger')(_0xbc91('0x8'));var config=require(_0xbc91('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbc91('0xa')][_0xbc91('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x535cb9,_0xf88d45,_0x43731a){return new BPromise(function(_0x36e15f,_0x34f079){return client[_0xbc91('0xc')](_0x535cb9,_0x43731a)[_0xbc91('0xd')](function(_0xa20d9){logger['info'](_0xbc91('0xe'),_0xf88d45,_0xbc91('0xf'));logger[_0xbc91('0x10')]('Attachment,\x20%s,\x20%s,\x20%s',_0xf88d45,'request\x20sent',JSON[_0xbc91('0x11')](_0xa20d9));if(_0xa20d9[_0xbc91('0x12')]){if(_0xa20d9['error']['code']===0x1f4){logger[_0xbc91('0x12')]('Attachment,\x20%s,\x20%s',_0xf88d45,_0xa20d9['error'][_0xbc91('0x13')]);return _0x34f079(_0xa20d9[_0xbc91('0x12')][_0xbc91('0x13')]);}logger[_0xbc91('0x12')]('Attachment,\x20%s,\x20%s',_0xf88d45,_0xa20d9['error'][_0xbc91('0x13')]);return _0x36e15f(_0xa20d9[_0xbc91('0x12')]['message']);}else{logger[_0xbc91('0x14')](_0xbc91('0xe'),_0xf88d45,_0xbc91('0xf'));_0x36e15f(_0xa20d9[_0xbc91('0x15')][_0xbc91('0x13')]);}})[_0xbc91('0x16')](function(_0xb92600){logger[_0xbc91('0x12')](_0xbc91('0xe'),_0xf88d45,_0xb92600);_0x34f079(_0xb92600);});});}exports['CreateAttachment']=function(_0x60911a){var _0x439145=this;return new Promise(function(_0x181d48,_0x31ce1f){return db[_0xbc91('0x17')][_0xbc91('0x18')](_0x60911a[_0xbc91('0x19')],{'raw':_0x60911a['options']?_0x60911a[_0xbc91('0x1a')][_0xbc91('0x1b')]===undefined?!![]:![]:!![]})[_0xbc91('0xd')](function(_0x558c32){logger['info'](_0xbc91('0x1c'),_0x60911a);logger[_0xbc91('0x10')](_0xbc91('0x1c'),_0x60911a,JSON[_0xbc91('0x11')](_0x558c32));_0x181d48(_0x558c32);})['catch'](function(_0x521196){logger[_0xbc91('0x12')](_0xbc91('0x1c'),_0x521196[_0xbc91('0x13')],_0x60911a);_0x31ce1f(_0x439145[_0xbc91('0x12')](0x1f4,_0x521196[_0xbc91('0x13')]));});});}; \ No newline at end of file +var _0x13c0=['message','result','catch','CreateAttachment','create','body','options','raw','then','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x23f7ef,_0x1b2a00){var _0x1b2eca=function(_0x4ad2b2){while(--_0x4ad2b2){_0x23f7ef['push'](_0x23f7ef['shift']());}};_0x1b2eca(++_0x1b2a00);}(_0x13c0,0x79));var _0x013c=function(_0x2ab3c5,_0x35a3ef){_0x2ab3c5=_0x2ab3c5-0x0;var _0x2733aa=_0x13c0[_0x2ab3c5];return _0x2733aa;};'use strict';var _=require(_0x013c('0x0'));var util=require(_0x013c('0x1'));var moment=require(_0x013c('0x2'));var BPromise=require(_0x013c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x013c('0x4'));var logger=require(_0x013c('0x5'))(_0x013c('0x6'));var config=require(_0x013c('0x7'));var jayson=require(_0x013c('0x8'));var client=jayson[_0x013c('0x9')][_0x013c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3decb5,_0x50caf2,_0x4cf99d){return new BPromise(function(_0x593053,_0x27c830){return client[_0x013c('0xb')](_0x3decb5,_0x4cf99d)['then'](function(_0x28c3a0){logger[_0x013c('0xc')](_0x013c('0xd'),_0x50caf2,_0x013c('0xe'));logger[_0x013c('0xf')](_0x013c('0x10'),_0x50caf2,_0x013c('0xe'),JSON[_0x013c('0x11')](_0x28c3a0));if(_0x28c3a0[_0x013c('0x12')]){if(_0x28c3a0[_0x013c('0x12')]['code']===0x1f4){logger['error'](_0x013c('0xd'),_0x50caf2,_0x28c3a0[_0x013c('0x12')][_0x013c('0x13')]);return _0x27c830(_0x28c3a0[_0x013c('0x12')]['message']);}logger[_0x013c('0x12')](_0x013c('0xd'),_0x50caf2,_0x28c3a0[_0x013c('0x12')][_0x013c('0x13')]);return _0x593053(_0x28c3a0[_0x013c('0x12')]['message']);}else{logger[_0x013c('0xc')](_0x013c('0xd'),_0x50caf2,_0x013c('0xe'));_0x593053(_0x28c3a0[_0x013c('0x14')][_0x013c('0x13')]);}})[_0x013c('0x15')](function(_0x6b8b5){logger[_0x013c('0x12')](_0x013c('0xd'),_0x50caf2,_0x6b8b5);_0x27c830(_0x6b8b5);});});}exports[_0x013c('0x16')]=function(_0x34d59f){var _0x4268cf=this;return new Promise(function(_0x25eb26,_0x5a9142){return db['Attachment'][_0x013c('0x17')](_0x34d59f[_0x013c('0x18')],{'raw':_0x34d59f['options']?_0x34d59f[_0x013c('0x19')][_0x013c('0x1a')]===undefined?!![]:![]:!![]})[_0x013c('0x1b')](function(_0x38bac2){logger[_0x013c('0xc')]('CreateAttachment',_0x34d59f);logger[_0x013c('0xf')](_0x013c('0x16'),_0x34d59f,JSON['stringify'](_0x38bac2));_0x25eb26(_0x38bac2);})[_0x013c('0x15')](function(_0x82f9f1){logger['error']('CreateAttachment',_0x82f9f1[_0x013c('0x13')],_0x34d59f);_0x5a9142(_0x4268cf[_0x013c('0x12')](0x1f4,_0x82f9f1[_0x013c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index baeeccf..7a2c179 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 _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x2e7dab,_0x4cfcec){var _0xdc2995=function(_0xd696b4){while(--_0xd696b4){_0x2e7dab['push'](_0x2e7dab['shift']());}};_0xdc2995(++_0x4cfcec);}(_0xadb5,0xad));var _0x5adb=function(_0x4a0d09,_0x592f69){_0x4a0d09=_0x4a0d09-0x0;var _0x1191c7=_0xadb5[_0x4a0d09];return _0x1191c7;};'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('./attachment.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')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('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(_0x1a0bb3,_0x79885e){var _0xdbe37b=function(_0x1b4b97){while(--_0x1b4b97){_0x1a0bb3['push'](_0x1a0bb3['shift']());}};_0xdbe37b(++_0x79885e);}(_0xb10b,0x12a));var _0xbb10=function(_0x48051b,_0x339115){_0x48051b=_0x48051b-0x0;var _0x2a4f6e=_0xb10b[_0x48051b];return _0x2a4f6e;};'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 2842635..28d1356 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 _0x684b=['ad-login','signToken','use','passport','passport-local','Strategy','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','api','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled','blockedAt','online','admin','user','agent','then','activedirectory','blocked','add','clearBlockUser','getLicense','send','message'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x684b,0x18f));var _0xb684=function(_0x3d8cfb,_0x4c51d6){_0x3d8cfb=_0x3d8cfb-0x0;var _0x10e248=_0x684b[_0x3d8cfb];return _0x10e248;};'use strict';var passport=require(_0xb684('0x0'));var LocalStrategy=require(_0xb684('0x1'))[_0xb684('0x2')];var moment=require('moment');var ActiveDirectory=require('activedirectory2');var BPromise=require(_0xb684('0x3'));var util=require(_0xb684('0x4'));var db=require(_0xb684('0x5'))['db'];var authService=require(_0xb684('0x6'));var utils=require(_0xb684('0x7'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0xb684('0x8'));function isActiveDirectoryConfigured(_0x296ee9){var _0x19ffca=![];if(typeof _0x296ee9['activedirectory']!=='undefined'){_0x19ffca=_0x296ee9['activedirectory'][_0xb684('0x9')]&&_0x296ee9['activedirectory'][_0xb684('0xa')]&&_0x296ee9['activedirectory'][_0xb684('0xb')];}return _0x19ffca;}function adAuthenticate(_0x4aed30,_0x4183b1,_0x3b382){return new BPromise(function(_0xa5a7bb,_0x39495f){try{var _0x3b0698=new ActiveDirectory(_0x4aed30);_0x3b0698[_0xb684('0xc')](_0x4183b1,_0x3b382,function(_0x4cc63e,_0x5196dc){if(_0x4cc63e){logger[_0xb684('0xd')](_0xb684('0xe'),_0x4183b1,util['inspect'](_0x4cc63e,{'showHidden':![],'depth':null}));_0x39495f(_0xb684('0xf'));}else if(!_0x5196dc){logger[_0xb684('0xd')](_0xb684('0x10'),_0x4183b1);_0x39495f(_0xb684('0xf'));}else{_0xa5a7bb(_0x5196dc);}});}catch(_0x4312d0){_0x39495f(_0x4312d0);}});}function ActiveDirectoryAuthenticate(_0x15c1c4,_0x5590ce,_0x10e049,_0x425db4){var _0x3d2415,_0x51c8a0;if(!isActiveDirectoryConfigured(config)){logger[_0xb684('0xd')](_0xb684('0x11'),_0x5590ce);return _0x425db4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0xb684('0x12')][_0xb684('0x13')]({'where':{'id':0x1},'attributes':[_0xb684('0x14'),_0xb684('0x15')],'raw':!![]})['then'](function(_0x374036){_0x3d2415=_0x374036;if(!_0x3d2415[_0xb684('0x14')]){logger['error'](_0xb684('0x16'),_0x5590ce);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x15c1c4['findOne']({'logging':!![],'attributes':['id',_0xb684('0x17'),_0xb684('0x18'),_0xb684('0x19'),_0xb684('0x1a'),_0xb684('0x1b'),'blocked',_0xb684('0x1c'),_0xb684('0x1d')],'where':{'name':_0x5590ce,'role':{'$or':[_0xb684('0x1e'),_0xb684('0x1f'),_0xb684('0x20')]},'adSsoEnabled':!![]}});})[_0xb684('0x21')](function(_0xcc575){if(!_0xcc575||_0xcc575&&_0xcc575[_0xb684('0x17')]!==_0x5590ce){throw new Error(_0xb684('0xf'));}_0x51c8a0=_0xcc575;var _0x4cbb6c=_0x51c8a0[_0xb684('0x17')]+'@'+config['activedirectory'][_0xb684('0xb')];return adAuthenticate(config[_0xb684('0x22')],_0x4cbb6c,_0x10e049);})[_0xb684('0x21')](function(_0x103a88){if(_0x51c8a0[_0xb684('0x1b')]){throw new Error(_0xb684('0xf'));}if(_0x3d2415['blockDuration']>0x0){if(_0x51c8a0[_0xb684('0x23')]){if(moment(_0x51c8a0['blockedAt'])[_0xb684('0x24')](_0x3d2415[_0xb684('0x15')],'minutes')>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0xb684('0x25')](_0x51c8a0,0x0,![],null)[_0xb684('0x21')](function(){return utils[_0xb684('0x26')](_0x51c8a0);})[_0xb684('0x21')](function(){return _0x425db4(null,_0x51c8a0);});}else{return utils['getLicense'](_0x51c8a0)[_0xb684('0x21')](function(){return _0x425db4(null,_0x51c8a0);});}}else{return utils[_0xb684('0x26')](_0x51c8a0)[_0xb684('0x21')](function(){return _0x425db4(null,_0x51c8a0);});}})['catch'](function(_0x33b14f){return _0x425db4(null,![],_0x33b14f);});}function handleError(_0x45884c,_0x54404d,_0xcf99e6){return _0x45884c['status'](_0x54404d||0x1f4)[_0xb684('0x27')]({'message':_0xcf99e6?_0xcf99e6[_0xb684('0x28')]||_0xcf99e6:''});}exports['login']=function(_0x170cc1,_0x2b2483,_0x1c9d39){passport[_0xb684('0xc')](_0xb684('0x29'),function(_0x143a81,_0x471de2,_0x3ca74b){var _0x34c8e8=_0x143a81||_0x3ca74b;if(_0x34c8e8){return handleError(_0x2b2483,0x191,_0x34c8e8);}if(!_0x471de2){return handleError(_0x2b2483,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x17a5ad={'payload':{'id':_0x471de2['id'],'role':_0x471de2[_0xb684('0x1a')]},'options':{'expiresIn':0x15180}};return authService[_0xb684('0x2a')](_0x17a5ad)['then'](function(_0x574f09){_0x2b2483['json']({'id':_0x471de2['id'],'token':_0x574f09,'statusCall':'','isAlreadyLogged':_0x471de2[_0xb684('0x1d')]});});}})(_0x170cc1,_0x2b2483,_0x1c9d39);};passport[_0xb684('0x2b')](_0xb684('0x29'),new LocalStrategy({'usernameField':_0xb684('0x17'),'passwordField':_0xb684('0x18')},function(_0x743707,_0x2ea63c,_0x419c49){return ActiveDirectoryAuthenticate(db['User'],_0x743707,_0x2ea63c,_0x419c49);})); \ No newline at end of file +var _0x4b56=['status','send','message','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','password','User','passport','Strategy','moment','activedirectory2','bluebird','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','url','domain','authenticate','error','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','findOne','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','salt','role','disabled','blocked','online','admin','user','agent','name','blockedAt','minutes','clearBlockUser','getLicense','catch'];(function(_0x2cd49c,_0x2ed99e){var _0x4cde12=function(_0x99cbe){while(--_0x99cbe){_0x2cd49c['push'](_0x2cd49c['shift']());}};_0x4cde12(++_0x2ed99e);}(_0x4b56,0xf8));var _0x64b5=function(_0x1488cd,_0x25a893){_0x1488cd=_0x1488cd-0x0;var _0x63fa13=_0x4b56[_0x1488cd];return _0x63fa13;};'use strict';var passport=require(_0x64b5('0x0'));var LocalStrategy=require('passport-local')[_0x64b5('0x1')];var moment=require(_0x64b5('0x2'));var ActiveDirectory=require(_0x64b5('0x3'));var BPromise=require(_0x64b5('0x4'));var util=require('util');var db=require(_0x64b5('0x5'))['db'];var authService=require(_0x64b5('0x6'));var utils=require(_0x64b5('0x7'));var config=require(_0x64b5('0x8'));var logger=require(_0x64b5('0x9'))(_0x64b5('0xa'));function isActiveDirectoryConfigured(_0x44a868){var _0xe72651=![];if(typeof _0x44a868[_0x64b5('0xb')]!==_0x64b5('0xc')){_0xe72651=_0x44a868[_0x64b5('0xb')]['baseDN']&&_0x44a868[_0x64b5('0xb')][_0x64b5('0xd')]&&_0x44a868[_0x64b5('0xb')][_0x64b5('0xe')];}return _0xe72651;}function adAuthenticate(_0x84a11f,_0x1cfbce,_0x8a4142){return new BPromise(function(_0x17626b,_0x46abae){try{var _0x2e8183=new ActiveDirectory(_0x84a11f);_0x2e8183[_0x64b5('0xf')](_0x1cfbce,_0x8a4142,function(_0x261ec3,_0x3b09e4){if(_0x261ec3){logger[_0x64b5('0x10')]('Error\x20authenticate\x20%s:\x20%s',_0x1cfbce,util[_0x64b5('0x11')](_0x261ec3,{'showHidden':![],'depth':null}));_0x46abae('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x3b09e4){logger[_0x64b5('0x10')](_0x64b5('0x12'),_0x1cfbce);_0x46abae(_0x64b5('0x13'));}else{_0x17626b(_0x3b09e4);}});}catch(_0x4b5551){_0x46abae(_0x4b5551);}});}function ActiveDirectoryAuthenticate(_0x48bc46,_0x286cac,_0x4eaf91,_0xe28a7f){var _0x23535e,_0x1181cf;if(!isActiveDirectoryConfigured(config)){logger[_0x64b5('0x10')](_0x64b5('0x14'),_0x286cac);return _0xe28a7f(null,![],{'message':_0x64b5('0x13')});}return db[_0x64b5('0x15')][_0x64b5('0x16')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x64b5('0x17')],'raw':!![]})[_0x64b5('0x18')](function(_0x53ab74){_0x23535e=_0x53ab74;if(!_0x23535e['adSsoEnabled']){logger[_0x64b5('0x10')](_0x64b5('0x19'),_0x286cac);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x48bc46[_0x64b5('0x16')]({'logging':!![],'attributes':['id','name','password',_0x64b5('0x1a'),_0x64b5('0x1b'),_0x64b5('0x1c'),_0x64b5('0x1d'),'blockedAt',_0x64b5('0x1e')],'where':{'name':_0x286cac,'role':{'$or':[_0x64b5('0x1f'),_0x64b5('0x20'),_0x64b5('0x21')]},'adSsoEnabled':!![]}});})[_0x64b5('0x18')](function(_0x41e9ba){if(!_0x41e9ba||_0x41e9ba&&_0x41e9ba[_0x64b5('0x22')]!==_0x286cac){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x1181cf=_0x41e9ba;var _0x750c86=_0x1181cf[_0x64b5('0x22')]+'@'+config[_0x64b5('0xb')]['domain'];return adAuthenticate(config[_0x64b5('0xb')],_0x750c86,_0x4eaf91);})['then'](function(_0x3f476b){if(_0x1181cf[_0x64b5('0x1c')]){throw new Error(_0x64b5('0x13'));}if(_0x23535e[_0x64b5('0x17')]>0x0){if(_0x1181cf[_0x64b5('0x1d')]){if(moment(_0x1181cf[_0x64b5('0x23')])['add'](_0x23535e[_0x64b5('0x17')],_0x64b5('0x24'))>moment()){throw new Error(_0x64b5('0x13'));}return utils[_0x64b5('0x25')](_0x1181cf,0x0,![],null)['then'](function(){return utils[_0x64b5('0x26')](_0x1181cf);})[_0x64b5('0x18')](function(){return _0xe28a7f(null,_0x1181cf);});}else{return utils[_0x64b5('0x26')](_0x1181cf)['then'](function(){return _0xe28a7f(null,_0x1181cf);});}}else{return utils[_0x64b5('0x26')](_0x1181cf)[_0x64b5('0x18')](function(){return _0xe28a7f(null,_0x1181cf);});}})[_0x64b5('0x27')](function(_0xd6b984){return _0xe28a7f(null,![],_0xd6b984);});}function handleError(_0x46f6e7,_0x4bdbdb,_0x535fee){return _0x46f6e7[_0x64b5('0x28')](_0x4bdbdb||0x1f4)[_0x64b5('0x29')]({'message':_0x535fee?_0x535fee[_0x64b5('0x2a')]||_0x535fee:''});}exports[_0x64b5('0x2b')]=function(_0x3907f7,_0x3dfeb5,_0x7cd102){passport['authenticate']('ad-login',function(_0x2a5d0f,_0x31f070,_0x24e00f){var _0x41dc5f=_0x2a5d0f||_0x24e00f;if(_0x41dc5f){return handleError(_0x3dfeb5,0x191,_0x41dc5f);}if(!_0x31f070){return handleError(_0x3dfeb5,0x194,{'message':_0x64b5('0x2c')});}else{var _0x585bfd={'payload':{'id':_0x31f070['id'],'role':_0x31f070['role']},'options':{'expiresIn':0x15180}};return authService[_0x64b5('0x2d')](_0x585bfd)[_0x64b5('0x18')](function(_0x214399){_0x3dfeb5['json']({'id':_0x31f070['id'],'token':_0x214399,'statusCall':'','isAlreadyLogged':_0x31f070[_0x64b5('0x1e')]});});}})(_0x3907f7,_0x3dfeb5,_0x7cd102);};passport['use']('ad-login',new LocalStrategy({'usernameField':_0x64b5('0x22'),'passwordField':_0x64b5('0x2e')},function(_0x399b33,_0x2017e7,_0x1c7a5f){return ActiveDirectoryAuthenticate(db[_0x64b5('0x2f')],_0x399b33,_0x2017e7,_0x1c7a5f);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 51b5834..c4a42cb 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 _0x9320=['express','Router','./authActiveDirectory.controller','post','login','exports'];(function(_0x4574b0,_0x3bd754){var _0x3d720c=function(_0x18a7da){while(--_0x18a7da){_0x4574b0['push'](_0x4574b0['shift']());}};_0x3d720c(++_0x3bd754);}(_0x9320,0x1d4));var _0x0932=function(_0x1b10c1,_0x35f323){_0x1b10c1=_0x1b10c1-0x0;var _0xc584e1=_0x9320[_0x1b10c1];return _0xc584e1;};'use strict';var express=require(_0x0932('0x0'));var router=express[_0x0932('0x1')]();var controller=require(_0x0932('0x2'));router[_0x0932('0x3')]('/',controller[_0x0932('0x4')]);module[_0x0932('0x5')]=router; \ No newline at end of file +var _0xaea2=['express','./authActiveDirectory.controller','post','login'];(function(_0xfceef2,_0x5e147d){var _0x26445d=function(_0x410fe8){while(--_0x410fe8){_0xfceef2['push'](_0xfceef2['shift']());}};_0x26445d(++_0x5e147d);}(_0xaea2,0x1b4));var _0x2aea=function(_0x3e19fb,_0x3258e2){_0x3e19fb=_0x3e19fb-0x0;var _0x5b19bd=_0xaea2[_0x3e19fb];return _0x5b19bd;};'use strict';var express=require(_0x2aea('0x0'));var router=express['Router']();var controller=require(_0x2aea('0x1'));router[_0x2aea('0x2')]('/',controller[_0x2aea('0x3')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 1eec010..a5be6bb 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 _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(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x7a54,0x106));var _0x47a5=function(_0x24d65e,_0x23d4b7){_0x24d65e=_0x24d65e-0x0;var _0x2a1aa0=_0x7a54[_0x24d65e];return _0x2a1aa0;};'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 +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(_0x2c24b8,_0x168e0b){var _0x563ed6=function(_0x7c1aa9){while(--_0x7c1aa9){_0x2c24b8['push'](_0x2c24b8['shift']());}};_0x563ed6(++_0x168e0b);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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 diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 80ea9c6..6a61e9f 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 _0x8524=['get','login','callback','isMiddleware','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js'];(function(_0x39941c,_0x4ad1bb){var _0x52d9c7=function(_0x4e107e){while(--_0x4e107e){_0x39941c['push'](_0x39941c['shift']());}};_0x52d9c7(++_0x4ad1bb);}(_0x8524,0xb9));var _0x4852=function(_0x352072,_0x511db5){_0x352072=_0x352072-0x0;var _0x299d0d=_0x8524[_0x352072];return _0x299d0d;};'use strict';var express=require(_0x4852('0x0'));var passport=require(_0x4852('0x1'));var router=express[_0x4852('0x2')]();var controller=require(_0x4852('0x3'));var userController=require(_0x4852('0x4'));var authService=require('../../components/auth/service');router[_0x4852('0x5')]('/',controller[_0x4852('0x6')]);router[_0x4852('0x5')]('/callback',controller[_0x4852('0x7')],authService[_0x4852('0x8')],userController[_0x4852('0x6')],authService['setTokenCookie']);module[_0x4852('0x9')]=router; \ No newline at end of file +var _0xd955=['exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','/callback','callback','setTokenCookie'];(function(_0x5ca70f,_0x471b16){var _0x2b82eb=function(_0x249872){while(--_0x249872){_0x5ca70f['push'](_0x5ca70f['shift']());}};_0x2b82eb(++_0x471b16);}(_0xd955,0x156));var _0x5d95=function(_0x30ad84,_0x1bd8e1){_0x30ad84=_0x30ad84-0x0;var _0x4966f8=_0xd955[_0x30ad84];return _0x4966f8;};'use strict';var express=require(_0x5d95('0x0'));var passport=require(_0x5d95('0x1'));var router=express[_0x5d95('0x2')]();var controller=require(_0x5d95('0x3'));var userController=require(_0x5d95('0x4'));var authService=require(_0x5d95('0x5'));router[_0x5d95('0x6')]('/',controller['login']);router[_0x5d95('0x6')](_0x5d95('0x7'),controller[_0x5d95('0x8')],authService['isMiddleware'],userController['login'],authService[_0x5d95('0x9')]);module[_0x5d95('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index ca6180f..df732ba 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 _0x9e53=['passport-local','Strategy','jayson/promise','lodash','moment','../../components/auth/service','../../config/utils','http','Setting','findOne','blockDuration','then','name','password','role','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','allowedLoginAttempts','blocked','add','minutes','clearBlockUser','disabled','getLicense','catch','MailAccount','find','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','format','\x22%s\x22\x20<%s>','email','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','status','send','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','previousPasswords','use','passport'];(function(_0x555164,_0x13e97c){var _0x541861=function(_0x55d3c3){while(--_0x55d3c3){_0x555164['push'](_0x555164['shift']());}};_0x541861(++_0x13e97c);}(_0x9e53,0xfe));var _0x39e5=function(_0x5fe7ce,_0x1a0d39){_0x5fe7ce=_0x5fe7ce-0x0;var _0x3b5793=_0x9e53[_0x5fe7ce];return _0x3b5793;};'use strict';var util=require('util');var passport=require(_0x39e5('0x0'));var LocalStrategy=require(_0x39e5('0x1'))[_0x39e5('0x2')];var jayson=require(_0x39e5('0x3'));var _=require(_0x39e5('0x4'));var rs=require('randomstring');var moment=require(_0x39e5('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0x39e5('0x6'));var utils=require(_0x39e5('0x7'));var client=jayson['client'][_0x39e5('0x8')]({'port':0x232b});function localAuthenticate(_0x444564,_0x36bd3a,_0x42a237,_0x1a9355){var _0xe50eb4,_0x4f3261;return db[_0x39e5('0x9')][_0x39e5('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x39e5('0xb')],'raw':!![]})[_0x39e5('0xc')](function(_0x19afa4){_0xe50eb4=_0x19afa4;return _0x444564[_0x39e5('0xa')]({'attributes':['id',_0x39e5('0xd'),_0x39e5('0xe'),'salt',_0x39e5('0xf'),'disabled','blocked',_0x39e5('0x10'),_0x39e5('0x11')],'where':{'name':_0x36bd3a,'role':{'$or':[_0x39e5('0x12'),_0x39e5('0x13'),_0x39e5('0x14')]}}});})[_0x39e5('0xc')](function(_0x41af83){if(!_0x41af83||_0x41af83&&_0x41af83['name']!==_0x36bd3a){throw new Error(_0x39e5('0x15'));}else{_0x4f3261=_0x41af83;return _0x4f3261;}})[_0x39e5('0xc')](function(){_0x4f3261[_0x39e5('0x16')](_0x42a237,function(_0xf07f52,_0x4c118a){var _0x507233=_0x4f3261[_0x39e5('0x11')]+0x1;if(_0xf07f52){return _0x1a9355(_0xf07f52);}else if(!_0x4c118a){if(_0x4f3261['disabled']){return _0x1a9355(null,![],{'message':_0x39e5('0x15')});}else if(_0xe50eb4[_0x39e5('0x17')]>0x0){if(_0x4f3261[_0x39e5('0x18')]){if(_0xe50eb4['blockDuration']>0x0){if(moment(_0x4f3261[_0x39e5('0x10')])[_0x39e5('0x19')](_0xe50eb4['blockDuration'],_0x39e5('0x1a'))>moment()){return _0x1a9355(null,![],{'message':_0x39e5('0x15')});}else{return utils[_0x39e5('0x1b')](_0x4f3261,_0x507233,![],null)[_0x39e5('0xc')](function(){return _0x1a9355(null,![],{'message':_0x39e5('0x15')});});}}else{return _0x1a9355(null,![],{'message':_0x39e5('0x15')});}}else{if(_0x507233>=_0xe50eb4[_0x39e5('0x17')]){return utils[_0x39e5('0x1b')](_0x4f3261,0x0,!![],moment())[_0x39e5('0xc')](function(){return _0x1a9355(null,![],{'message':_0x39e5('0x15')});});}else{return utils['clearBlockUser'](_0x4f3261,_0x507233,![],null)[_0x39e5('0xc')](function(){return _0x1a9355(null,![],{'message':_0x39e5('0x15')});});}}}else{return _0x1a9355(null,![],{'message':_0x39e5('0x15')});}}else{if(_0x4f3261[_0x39e5('0x1c')]){return _0x1a9355(null,![],{'message':_0x39e5('0x15')});}else if(_0xe50eb4[_0x39e5('0x17')]>0x0){if(_0x4f3261[_0x39e5('0x18')]){if(_0xe50eb4['blockDuration']>0x0){if(moment(_0x4f3261[_0x39e5('0x10')])[_0x39e5('0x19')](_0xe50eb4[_0x39e5('0xb')],_0x39e5('0x1a'))>moment()){return _0x1a9355(null,![],{'message':_0x39e5('0x15')});}else{return utils[_0x39e5('0x1b')](_0x4f3261,0x0,![],null)['then'](function(){return utils['getLicense'](_0x4f3261);})[_0x39e5('0xc')](function(){return _0x1a9355(null,_0x4f3261);});}}else{return _0x1a9355(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x39e5('0x1b')](_0x4f3261,0x0,![],null)[_0x39e5('0xc')](function(){return utils[_0x39e5('0x1d')](_0x4f3261);})[_0x39e5('0xc')](function(){return _0x1a9355(null,_0x4f3261);})[_0x39e5('0x1e')](function(_0x1bcfd2){return _0x1a9355(null,![],_0x1bcfd2);});}}else{if(_0x4f3261[_0x39e5('0x18')]){return _0x1a9355(null,![],{'message':_0x39e5('0x15')});}else{return utils[_0x39e5('0x1d')](_0x4f3261)[_0x39e5('0xc')](function(){return _0x1a9355(null,_0x4f3261);});}}}});})[_0x39e5('0x1e')](function(_0x1f605d){return _0x1a9355(null,![],_0x1f605d);});}function sendServiceMail(_0x369a6a){return db[_0x39e5('0x1f')][_0x39e5('0x20')]({'where':{'service':!![]},'attributes':['id',_0x39e5('0xd'),'email'],'include':[{'model':db[_0x39e5('0x21')],'as':_0x39e5('0x22')}]})['then'](function(_0x2f1614){if(!_0x2f1614){throw new Error(_0x39e5('0x23'));}var _0x2b28fe={'tls':{'rejectUnauthorized':![]}};if(_0x2f1614[_0x39e5('0x22')][_0x39e5('0x24')]){_0x2b28fe[_0x39e5('0x24')]=_0x2f1614[_0x39e5('0x22')]['service'];}else{_0x2b28fe[_0x39e5('0x25')]=_0x2f1614[_0x39e5('0x22')]['host'];_0x2b28fe[_0x39e5('0x26')]=_0x2f1614[_0x39e5('0x22')]['port'];_0x2b28fe[_0x39e5('0x27')]=_0x2f1614[_0x39e5('0x22')][_0x39e5('0x27')];}if(_0x2f1614[_0x39e5('0x22')][_0x39e5('0x28')]){_0x2b28fe[_0x39e5('0x29')]={'user':_0x2f1614[_0x39e5('0x22')][_0x39e5('0x13')],'pass':_0x2f1614[_0x39e5('0x22')]['pass']};}var _0x12323e={'account':_0x2b28fe,'message':_['merge']({'from':util[_0x39e5('0x2a')](_0x39e5('0x2b'),_0x2f1614[_0x39e5('0xd')],_0x2f1614[_0x39e5('0x2c')]||_0x2f1614[_0x39e5('0x22')][_0x39e5('0x13')])},_0x369a6a)};return client[_0x39e5('0x2d')](_0x39e5('0x2e'),_0x12323e);})[_0x39e5('0xc')](function(_0x3649a9){if(_0x3649a9['error']){throw new Error(util[_0x39e5('0x2a')](_0x39e5('0x2f'),_0x3649a9[_0x39e5('0x30')][_0x39e5('0x31')]||JSON[_0x39e5('0x32')](_0x3649a9[_0x39e5('0x30')])));}return!![];});}function handleError(_0x4ee310,_0x3394ee,_0x252dbc){return _0x4ee310[_0x39e5('0x33')](_0x3394ee||0x1f4)[_0x39e5('0x34')]({'message':_0x252dbc?_0x252dbc['message']||_0x252dbc:''});}exports['login']=function(_0xe930fc,_0x2333a9,_0x35bf18){passport[_0x39e5('0x16')](_0x39e5('0x35'),function(_0x17b6c9,_0x3c2be7,_0x10824d){var _0x23f9c4=_0x17b6c9||_0x10824d;if(_0x23f9c4){return handleError(_0x2333a9,0x191,_0x23f9c4);}if(!_0x3c2be7){return handleError(_0x2333a9,0x194,{'message':_0x39e5('0x36')});}else{var _0x5eba10={'payload':{'id':_0x3c2be7['id'],'role':_0x3c2be7['role']},'options':{'expiresIn':0x15180}};return authService[_0x39e5('0x37')](_0x5eba10)['then'](function(_0x3721d8){_0x2333a9[_0x39e5('0x38')]({'id':_0x3c2be7['id'],'token':_0x3721d8,'statusCall':'','isAlreadyLogged':_0x3c2be7[_0x39e5('0x39')]});});}})(_0xe930fc,_0x2333a9,_0x35bf18);};exports[_0x39e5('0x3a')]=function(_0x31d059,_0x25e589,_0x151a95){if(!_0x31d059[_0x39e5('0x3b')][_0x39e5('0x2c')]){return handleError(_0x25e589,0x1f4,{'message':_0x39e5('0x3c')});}var _0x3ab2c7=rs[_0x39e5('0x3d')]();_0x31d059[_0x39e5('0x3b')][_0x39e5('0x2c')]=_0x31d059['body']['email']['trim']()[_0x39e5('0x3e')]();var _0x14a727;return db[_0x39e5('0x9')][_0x39e5('0xa')]({'where':{'id':0x1},'attributes':[_0x39e5('0x17'),'blockDuration'],'raw':!![]})[_0x39e5('0xc')](function(_0x35f51b){_0x14a727=_0x35f51b;return db[_0x39e5('0x3f')][_0x39e5('0x20')]({'where':{'email':_0x31d059[_0x39e5('0x3b')][_0x39e5('0x2c')]}});})['then'](function(_0x2f5335){if(!_0x2f5335){throw new Error(_0x39e5('0x40'));}if(_0x2f5335['disabled']){throw new Error(_0x39e5('0x41'));}if(_0x2f5335[_0x39e5('0x18')]){if(moment(_0x2f5335[_0x39e5('0x10')])[_0x39e5('0x19')](_0x14a727[_0x39e5('0xb')],'minutes')>moment()){throw new Error(_0x39e5('0x42'));}else{_0x2f5335[_0x39e5('0x18')]=![];_0x2f5335['blockedAt']=null;}}_0x2f5335[_0x39e5('0x43')]=_0x3ab2c7;_0x2f5335[_0x39e5('0x44')]=Date[_0x39e5('0x45')]()+0x36ee80;return _0x2f5335[_0x39e5('0x46')]();})[_0x39e5('0xc')](function(){return sendServiceMail({'to':_0x31d059['body'][_0x39e5('0x2c')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x39e5('0x47')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x39e5('0x48')+_0x31d059['headers'][_0x39e5('0x25')]+_0x39e5('0x49')+_0x3ab2c7+'\x0a\x0a'+_0x39e5('0x4a')});})['then'](function(){_0x25e589['status'](0xc8)[_0x39e5('0x34')]({'message':_0x39e5('0x4b')});})[_0x39e5('0x1e')](function(_0x52a22a){return handleError(_0x25e589,0x1f4,_0x52a22a);});};exports[_0x39e5('0x4c')]=function(_0x2e8b5f,_0x138c50,_0x142c3c){return db[_0x39e5('0x3f')][_0x39e5('0x20')]({'where':{'resetPasswordToken':_0x2e8b5f[_0x39e5('0x4d')]['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x39e5('0xc')](function(_0x49c1dc){if(!_0x49c1dc){throw new Error(_0x39e5('0x4e'));}return db[_0x39e5('0x9')][_0x39e5('0xa')]({'attributes':['id',_0x39e5('0x4f'),_0x39e5('0x50'),_0x39e5('0x51')]})[_0x39e5('0xc')](function(_0x527e8f){if(_0x527e8f['securePassword'])authService['validatePasswordPattern'](_0x2e8b5f[_0x39e5('0x3b')][_0x39e5('0xe')]);if(!_0x527e8f[_0x39e5('0x50')]||!_0x49c1dc['previousPasswords'])return _0x49c1dc;authService[_0x39e5('0x52')](_0x2e8b5f[_0x39e5('0x3b')][_0x39e5('0xe')],_0x49c1dc[_0x39e5('0x53')],_0x527e8f['passwordHistoryLimit']);return _0x49c1dc;})[_0x39e5('0xc')](function(){_0x49c1dc[_0x39e5('0xe')]=_0x2e8b5f['body'][_0x39e5('0xe')];_0x49c1dc[_0x39e5('0x43')]=null;_0x49c1dc[_0x39e5('0x44')]=null;return _0x49c1dc[_0x39e5('0x46')]();});})[_0x39e5('0xc')](function(){_0x138c50[_0x39e5('0x33')](0xc8)['send']({'message':'Password\x20reset!'});})['catch'](function(_0x43630f){return handleError(_0x138c50,0x1f4,_0x43630f);});};passport[_0x39e5('0x54')](_0x39e5('0x35'),new LocalStrategy({'usernameField':_0x39e5('0xd'),'passwordField':'password'},function(_0x348bac,_0x36ef02,_0xf82858){return localAuthenticate(db['User'],_0x348bac,_0x36ef02,_0xf82858);})); \ No newline at end of file +var _0x3c9d=['MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','status','message','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','body','Email\x20parameter\x20is\x20missing','generate','toLowerCase','Setting','findOne','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','https://','headers','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','previousPasswords','use','util','passport','passport-local','jayson/promise','lodash','randomstring','moment','../../config/utils','client','http','allowedLoginAttempts','blockDuration','password','salt','role','disabled','blockedAt','loginAttempts','admin','user','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','then','authenticate','blocked','add','minutes','clearBlockUser','catch','getLicense'];(function(_0x581522,_0x582814){var _0x4dd47c=function(_0x1c717c){while(--_0x1c717c){_0x581522['push'](_0x581522['shift']());}};_0x4dd47c(++_0x582814);}(_0x3c9d,0x185));var _0xd3c9=function(_0x453536,_0x46622b){_0x453536=_0x453536-0x0;var _0x252fb0=_0x3c9d[_0x453536];return _0x252fb0;};'use strict';var util=require(_0xd3c9('0x0'));var passport=require(_0xd3c9('0x1'));var LocalStrategy=require(_0xd3c9('0x2'))['Strategy'];var jayson=require(_0xd3c9('0x3'));var _=require(_0xd3c9('0x4'));var rs=require(_0xd3c9('0x5'));var moment=require(_0xd3c9('0x6'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require(_0xd3c9('0x7'));var client=jayson[_0xd3c9('0x8')][_0xd3c9('0x9')]({'port':0x232b});function localAuthenticate(_0x1e1d10,_0x39181b,_0xbef340,_0x14f598){var _0x2e75d3,_0x33efdd;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xd3c9('0xa'),_0xd3c9('0xb')],'raw':!![]})['then'](function(_0x40d776){_0x2e75d3=_0x40d776;return _0x1e1d10['findOne']({'attributes':['id','name',_0xd3c9('0xc'),_0xd3c9('0xd'),_0xd3c9('0xe'),_0xd3c9('0xf'),'blocked',_0xd3c9('0x10'),_0xd3c9('0x11')],'where':{'name':_0x39181b,'role':{'$or':[_0xd3c9('0x12'),_0xd3c9('0x13'),_0xd3c9('0x14')]}}});})['then'](function(_0x10c0b7){if(!_0x10c0b7||_0x10c0b7&&_0x10c0b7[_0xd3c9('0x15')]!==_0x39181b){throw new Error(_0xd3c9('0x16'));}else{_0x33efdd=_0x10c0b7;return _0x33efdd;}})[_0xd3c9('0x17')](function(){_0x33efdd[_0xd3c9('0x18')](_0xbef340,function(_0x4fb091,_0x5f32b1){var _0x5bba5c=_0x33efdd[_0xd3c9('0x11')]+0x1;if(_0x4fb091){return _0x14f598(_0x4fb091);}else if(!_0x5f32b1){if(_0x33efdd[_0xd3c9('0xf')]){return _0x14f598(null,![],{'message':_0xd3c9('0x16')});}else if(_0x2e75d3[_0xd3c9('0xa')]>0x0){if(_0x33efdd[_0xd3c9('0x19')]){if(_0x2e75d3[_0xd3c9('0xb')]>0x0){if(moment(_0x33efdd[_0xd3c9('0x10')])[_0xd3c9('0x1a')](_0x2e75d3['blockDuration'],_0xd3c9('0x1b'))>moment()){return _0x14f598(null,![],{'message':_0xd3c9('0x16')});}else{return utils[_0xd3c9('0x1c')](_0x33efdd,_0x5bba5c,![],null)['then'](function(){return _0x14f598(null,![],{'message':_0xd3c9('0x16')});});}}else{return _0x14f598(null,![],{'message':_0xd3c9('0x16')});}}else{if(_0x5bba5c>=_0x2e75d3[_0xd3c9('0xa')]){return utils[_0xd3c9('0x1c')](_0x33efdd,0x0,!![],moment())['then'](function(){return _0x14f598(null,![],{'message':_0xd3c9('0x16')});});}else{return utils[_0xd3c9('0x1c')](_0x33efdd,_0x5bba5c,![],null)['then'](function(){return _0x14f598(null,![],{'message':_0xd3c9('0x16')});});}}}else{return _0x14f598(null,![],{'message':_0xd3c9('0x16')});}}else{if(_0x33efdd[_0xd3c9('0xf')]){return _0x14f598(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x2e75d3['allowedLoginAttempts']>0x0){if(_0x33efdd[_0xd3c9('0x19')]){if(_0x2e75d3[_0xd3c9('0xb')]>0x0){if(moment(_0x33efdd[_0xd3c9('0x10')])[_0xd3c9('0x1a')](_0x2e75d3[_0xd3c9('0xb')],'minutes')>moment()){return _0x14f598(null,![],{'message':_0xd3c9('0x16')});}else{return utils[_0xd3c9('0x1c')](_0x33efdd,0x0,![],null)[_0xd3c9('0x17')](function(){return utils['getLicense'](_0x33efdd);})[_0xd3c9('0x17')](function(){return _0x14f598(null,_0x33efdd);});}}else{return _0x14f598(null,![],{'message':_0xd3c9('0x16')});}}else{return utils[_0xd3c9('0x1c')](_0x33efdd,0x0,![],null)[_0xd3c9('0x17')](function(){return utils['getLicense'](_0x33efdd);})[_0xd3c9('0x17')](function(){return _0x14f598(null,_0x33efdd);})[_0xd3c9('0x1d')](function(_0x159bd4){return _0x14f598(null,![],_0x159bd4);});}}else{if(_0x33efdd['blocked']){return _0x14f598(null,![],{'message':_0xd3c9('0x16')});}else{return utils[_0xd3c9('0x1e')](_0x33efdd)[_0xd3c9('0x17')](function(){return _0x14f598(null,_0x33efdd);});}}}});})[_0xd3c9('0x1d')](function(_0x1e27db){return _0x14f598(null,![],_0x1e27db);});}function sendServiceMail(_0x366cc5){return db[_0xd3c9('0x1f')][_0xd3c9('0x20')]({'where':{'service':!![]},'attributes':['id',_0xd3c9('0x15'),_0xd3c9('0x21')],'include':[{'model':db[_0xd3c9('0x22')],'as':_0xd3c9('0x23')}]})[_0xd3c9('0x17')](function(_0x29d65c){if(!_0x29d65c){throw new Error(_0xd3c9('0x24'));}var _0x1af635={'tls':{'rejectUnauthorized':![]}};if(_0x29d65c[_0xd3c9('0x23')][_0xd3c9('0x25')]){_0x1af635['service']=_0x29d65c[_0xd3c9('0x23')]['service'];}else{_0x1af635[_0xd3c9('0x26')]=_0x29d65c[_0xd3c9('0x23')]['host'];_0x1af635[_0xd3c9('0x27')]=_0x29d65c[_0xd3c9('0x23')][_0xd3c9('0x27')];_0x1af635[_0xd3c9('0x28')]=_0x29d65c[_0xd3c9('0x23')]['secure'];}if(_0x29d65c['Smtp'][_0xd3c9('0x29')]){_0x1af635[_0xd3c9('0x2a')]={'user':_0x29d65c['Smtp'][_0xd3c9('0x13')],'pass':_0x29d65c['Smtp'][_0xd3c9('0x2b')]};}var _0x55b0b0={'account':_0x1af635,'message':_[_0xd3c9('0x2c')]({'from':util[_0xd3c9('0x2d')](_0xd3c9('0x2e'),_0x29d65c[_0xd3c9('0x15')],_0x29d65c[_0xd3c9('0x21')]||_0x29d65c[_0xd3c9('0x23')][_0xd3c9('0x13')])},_0x366cc5)};return client['request'](_0xd3c9('0x2f'),_0x55b0b0);})['then'](function(_0x3d9dc2){if(_0x3d9dc2[_0xd3c9('0x30')]){throw new Error(util['format'](_0xd3c9('0x31'),_0x3d9dc2[_0xd3c9('0x30')]['message']||JSON['stringify'](_0x3d9dc2[_0xd3c9('0x30')])));}return!![];});}function handleError(_0x21b9fb,_0x580f42,_0x3340b5){return _0x21b9fb[_0xd3c9('0x32')](_0x580f42||0x1f4)['send']({'message':_0x3340b5?_0x3340b5[_0xd3c9('0x33')]||_0x3340b5:''});}exports[_0xd3c9('0x34')]=function(_0x4a4a8f,_0x1fe2db,_0x7c53bd){passport[_0xd3c9('0x18')](_0xd3c9('0x35'),function(_0xf19f2f,_0x4c6cc1,_0x39f9b1){var _0x1ca776=_0xf19f2f||_0x39f9b1;if(_0x1ca776){return handleError(_0x1fe2db,0x191,_0x1ca776);}if(!_0x4c6cc1){return handleError(_0x1fe2db,0x194,{'message':_0xd3c9('0x36')});}else{var _0x1e1770={'payload':{'id':_0x4c6cc1['id'],'role':_0x4c6cc1[_0xd3c9('0xe')]},'options':{'expiresIn':0x15180}};return authService[_0xd3c9('0x37')](_0x1e1770)[_0xd3c9('0x17')](function(_0x5e80e1){_0x1fe2db['json']({'id':_0x4c6cc1['id'],'token':_0x5e80e1,'statusCall':'','isAlreadyLogged':_0x4c6cc1[_0xd3c9('0x38')]});});}})(_0x4a4a8f,_0x1fe2db,_0x7c53bd);};exports['forgot']=function(_0x56e1d0,_0x2e5b68,_0x34aafe){if(!_0x56e1d0[_0xd3c9('0x39')][_0xd3c9('0x21')]){return handleError(_0x2e5b68,0x1f4,{'message':_0xd3c9('0x3a')});}var _0x1c28b2=rs[_0xd3c9('0x3b')]();_0x56e1d0[_0xd3c9('0x39')]['email']=_0x56e1d0[_0xd3c9('0x39')][_0xd3c9('0x21')]['trim']()[_0xd3c9('0x3c')]();var _0x45fed7;return db[_0xd3c9('0x3d')][_0xd3c9('0x3e')]({'where':{'id':0x1},'attributes':[_0xd3c9('0xa'),_0xd3c9('0xb')],'raw':!![]})['then'](function(_0x1617c7){_0x45fed7=_0x1617c7;return db[_0xd3c9('0x3f')][_0xd3c9('0x20')]({'where':{'email':_0x56e1d0['body'][_0xd3c9('0x21')]}});})[_0xd3c9('0x17')](function(_0x5c0558){if(!_0x5c0558){throw new Error(_0xd3c9('0x40'));}if(_0x5c0558[_0xd3c9('0xf')]){throw new Error(_0xd3c9('0x41'));}if(_0x5c0558[_0xd3c9('0x19')]){if(moment(_0x5c0558[_0xd3c9('0x10')])['add'](_0x45fed7['blockDuration'],_0xd3c9('0x1b'))>moment()){throw new Error(_0xd3c9('0x42'));}else{_0x5c0558['blocked']=![];_0x5c0558[_0xd3c9('0x10')]=null;}}_0x5c0558['resetPasswordToken']=_0x1c28b2;_0x5c0558[_0xd3c9('0x43')]=Date[_0xd3c9('0x44')]()+0x36ee80;return _0x5c0558[_0xd3c9('0x45')]();})[_0xd3c9('0x17')](function(){return sendServiceMail({'to':_0x56e1d0[_0xd3c9('0x39')][_0xd3c9('0x21')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0xd3c9('0x46')+_0x56e1d0[_0xd3c9('0x47')][_0xd3c9('0x26')]+'/reset/'+_0x1c28b2+'\x0a\x0a'+_0xd3c9('0x48')});})[_0xd3c9('0x17')](function(){_0x2e5b68[_0xd3c9('0x32')](0xc8)[_0xd3c9('0x49')]({'message':'Reset\x20Email\x20sent!'});})[_0xd3c9('0x1d')](function(_0x234e26){return handleError(_0x2e5b68,0x1f4,_0x234e26);});};exports[_0xd3c9('0x4a')]=function(_0x49fb96,_0x3b1fc2,_0x404239){return db['User'][_0xd3c9('0x20')]({'where':{'resetPasswordToken':_0x49fb96[_0xd3c9('0x4b')][_0xd3c9('0x4c')],'resetPasswordExpires':{'$gt':Date[_0xd3c9('0x44')]()}}})['then'](function(_0x576ffe){if(!_0x576ffe){throw new Error(_0xd3c9('0x4d'));}return db[_0xd3c9('0x3d')][_0xd3c9('0x3e')]({'attributes':['id',_0xd3c9('0x4e'),'enforcePasswordHistory',_0xd3c9('0x4f')]})['then'](function(_0xe8d8a){if(_0xe8d8a[_0xd3c9('0x4e')])authService[_0xd3c9('0x50')](_0x49fb96[_0xd3c9('0x39')]['password']);if(!_0xe8d8a[_0xd3c9('0x51')]||!_0x576ffe[_0xd3c9('0x52')])return _0x576ffe;authService['validatePasswordHistory'](_0x49fb96[_0xd3c9('0x39')][_0xd3c9('0xc')],_0x576ffe['previousPasswords'],_0xe8d8a[_0xd3c9('0x4f')]);return _0x576ffe;})[_0xd3c9('0x17')](function(){_0x576ffe[_0xd3c9('0xc')]=_0x49fb96[_0xd3c9('0x39')][_0xd3c9('0xc')];_0x576ffe['resetPasswordToken']=null;_0x576ffe[_0xd3c9('0x43')]=null;return _0x576ffe['save']();});})[_0xd3c9('0x17')](function(){_0x3b1fc2[_0xd3c9('0x32')](0xc8)[_0xd3c9('0x49')]({'message':'Password\x20reset!'});})['catch'](function(_0x2ebda8){return handleError(_0x3b1fc2,0x1f4,_0x2ebda8);});};passport[_0xd3c9('0x53')](_0xd3c9('0x35'),new LocalStrategy({'usernameField':_0xd3c9('0x15'),'passwordField':'password'},function(_0x108896,_0x2579f2,_0x2c396d){return localAuthenticate(db['User'],_0x108896,_0x2579f2,_0x2c396d);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 601939e..12efcda 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 _0x195d=['reset','exports','express','Router','post','login','/forgot','forgot','/reset/:token'];(function(_0x20b85e,_0x50d027){var _0x35ebc6=function(_0x2d7199){while(--_0x2d7199){_0x20b85e['push'](_0x20b85e['shift']());}};_0x35ebc6(++_0x50d027);}(_0x195d,0x92));var _0xd195=function(_0x5224ba,_0x3fb4e1){_0x5224ba=_0x5224ba-0x0;var _0x459bd2=_0x195d[_0x5224ba];return _0x459bd2;};'use strict';var express=require(_0xd195('0x0'));var router=express[_0xd195('0x1')]();var controller=require('./authLocal.controller');router[_0xd195('0x2')]('/',controller[_0xd195('0x3')]);router['post'](_0xd195('0x4'),controller[_0xd195('0x5')]);router[_0xd195('0x2')](_0xd195('0x6'),controller[_0xd195('0x7')]);module[_0xd195('0x8')]=router; \ No newline at end of file +var _0x9f69=['express','Router','./authLocal.controller','post','login','/forgot','forgot','reset','exports'];(function(_0x53403f,_0xffd0b5){var _0x590896=function(_0x1fab05){while(--_0x1fab05){_0x53403f['push'](_0x53403f['shift']());}};_0x590896(++_0xffd0b5);}(_0x9f69,0x120));var _0x99f6=function(_0x390b40,_0x32a62e){_0x390b40=_0x390b40-0x0;var _0x11a416=_0x9f69[_0x390b40];return _0x11a416;};'use strict';var express=require(_0x99f6('0x0'));var router=express[_0x99f6('0x1')]();var controller=require(_0x99f6('0x2'));router[_0x99f6('0x3')]('/',controller[_0x99f6('0x4')]);router[_0x99f6('0x3')](_0x99f6('0x5'),controller[_0x99f6('0x6')]);router[_0x99f6('0x3')]('/reset/:token',controller[_0x99f6('0x7')]);module[_0x99f6('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index bfc62f6..0d77c41 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 _0x8b3f=['INTEGER','STRING','BOOLEAN'];(function(_0x495977,_0x107906){var _0x2105f8=function(_0x4af937){while(--_0x4af937){_0x495977['push'](_0x495977['shift']());}};_0x2105f8(++_0x107906);}(_0x8b3f,0x1c6));var _0xf8b3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8b3f[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf8b3('0x0')],'allowNull':![]},'channel':{'type':Sequelize[_0xf8b3('0x0')]},'description':{'type':Sequelize[_0xf8b3('0x0')]},'status':{'type':Sequelize[_0xf8b3('0x1')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xf8b3('0x2')],'defaultValue':0xa}}; \ No newline at end of file +var _0x1180=['exports','STRING','INTEGER','sequelize'];(function(_0xbb14db,_0x3ee8c6){var _0x36bed7=function(_0x16c478){while(--_0x16c478){_0xbb14db['push'](_0xbb14db['shift']());}};_0x36bed7(++_0x3ee8c6);}(_0x1180,0xeb));var _0x0118=function(_0x2a782d,_0x1cc784){_0x2a782d=_0x2a782d-0x0;var _0xcf6d5c=_0x1180[_0x2a782d];return _0xcf6d5c;};'use strict';var Sequelize=require(_0x0118('0x0'));module[_0x0118('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x0118('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x0118('0x3')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 52337cf..f54bcbe 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 _0xa6c0=['where','pick','merge','filter','includeAll','findAll','rows','catch','show','params','include','options','create','body','find','addConditions','Condition','ids','omit','getConditions','findOne','fields','nolimit','addActions','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','Automation','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','order','sort'];(function(_0x1526a9,_0x48fb64){var _0x9f4049=function(_0x13271a){while(--_0x13271a){_0x1526a9['push'](_0x1526a9['shift']());}};_0x9f4049(++_0x48fb64);}(_0xa6c0,0x1cd));var _0x0a6c=function(_0x54c6a6,_0x2f8457){_0x54c6a6=_0x54c6a6-0x0;var _0x5e4f88=_0xa6c0[_0x54c6a6];return _0x5e4f88;};'use strict';var emlformat=require(_0x0a6c('0x0'));var rimraf=require(_0x0a6c('0x1'));var zipdir=require(_0x0a6c('0x2'));var jsonpatch=require(_0x0a6c('0x3'));var rp=require('request-promise');var moment=require(_0x0a6c('0x4'));var BPromise=require(_0x0a6c('0x5'));var Mustache=require(_0x0a6c('0x6'));var util=require(_0x0a6c('0x7'));var path=require(_0x0a6c('0x8'));var sox=require(_0x0a6c('0x9'));var csv=require('to-csv');var ejs=require(_0x0a6c('0xa'));var fs=require('fs');var fs_extra=require(_0x0a6c('0xb'));var _=require('lodash');var squel=require(_0x0a6c('0xc'));var crypto=require(_0x0a6c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0a6c('0xe'));var toCsv=require(_0x0a6c('0xf'));var querystring=require(_0x0a6c('0x10'));var Papa=require('papaparse');var Redis=require(_0x0a6c('0x11'));var authService=require(_0x0a6c('0x12'));var qs=require(_0x0a6c('0x13'));var as=require(_0x0a6c('0x14'));var hardwareService=require(_0x0a6c('0x15'));var logger=require(_0x0a6c('0x16'))(_0x0a6c('0x17'));var utils=require(_0x0a6c('0x18'));var config=require(_0x0a6c('0x19'));var licenseUtil=require(_0x0a6c('0x1a'));var db=require(_0x0a6c('0x1b'))['db'];function respondWithStatusCode(_0x4d9bf6,_0x262c5f){_0x262c5f=_0x262c5f||0xcc;return function(_0x2a3a66){if(_0x2a3a66){return _0x4d9bf6['sendStatus'](_0x262c5f);}return _0x4d9bf6[_0x0a6c('0x1c')](_0x262c5f)['end']();};}function respondWithResult(_0x24cb79,_0x3e6a04){_0x3e6a04=_0x3e6a04||0xc8;return function(_0x5733e1){if(_0x5733e1){return _0x24cb79[_0x0a6c('0x1c')](_0x3e6a04)['json'](_0x5733e1);}};}function respondWithFilteredResult(_0x46957b,_0x5e2e72){return function(_0x3a38dc){if(_0x3a38dc){var _0x28feef=typeof _0x5e2e72[_0x0a6c('0x1d')]===_0x0a6c('0x1e')&&typeof _0x5e2e72[_0x0a6c('0x1f')]===_0x0a6c('0x1e');var _0x16d51e=_0x3a38dc[_0x0a6c('0x20')];var _0x5e692c=_0x28feef?0x0:_0x5e2e72['offset'];var _0x1c18dd=_0x28feef?_0x3a38dc['count']:_0x5e2e72['offset']+_0x5e2e72[_0x0a6c('0x1f')];var _0x2f2e9d;if(_0x1c18dd>=_0x16d51e){_0x1c18dd=_0x16d51e;_0x2f2e9d=0xc8;}else{_0x2f2e9d=0xce;}_0x46957b[_0x0a6c('0x1c')](_0x2f2e9d);return _0x46957b[_0x0a6c('0x21')]('Content-Range',_0x5e692c+'-'+_0x1c18dd+'/'+_0x16d51e)[_0x0a6c('0x22')](_0x3a38dc);}return null;};}function patchUpdates(_0x49407f){return function(_0x593518){try{jsonpatch[_0x0a6c('0x23')](_0x593518,_0x49407f,!![]);}catch(_0x3ad84f){return BPromise[_0x0a6c('0x24')](_0x3ad84f);}return _0x593518[_0x0a6c('0x25')]();};}function saveUpdates(_0x470af2,_0x11984b){return function(_0x2dbffa){if(_0x2dbffa){return _0x2dbffa[_0x0a6c('0x26')](_0x470af2)[_0x0a6c('0x27')](function(_0x31f6a2){return _0x31f6a2;});}return null;};}function removeEntity(_0x4745c9,_0x3cf4be){return function(_0x48a31a){if(_0x48a31a){return _0x48a31a[_0x0a6c('0x28')]()[_0x0a6c('0x27')](function(){_0x4745c9[_0x0a6c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37bb32,_0x15e2c9){return function(_0x4e2ae4){if(!_0x4e2ae4){_0x37bb32['sendStatus'](0x194);}return _0x4e2ae4;};}function handleError(_0x3dcf08,_0x17253c){_0x17253c=_0x17253c||0x1f4;return function(_0xbbc89a){logger[_0x0a6c('0x29')](_0xbbc89a[_0x0a6c('0x2a')]);if(_0xbbc89a[_0x0a6c('0x2b')]){delete _0xbbc89a[_0x0a6c('0x2b')];}_0x3dcf08[_0x0a6c('0x1c')](_0x17253c)['send'](_0xbbc89a);};}exports[_0x0a6c('0x2c')]=function(_0x2a1245,_0x1ddd6c){var _0x244318={},_0x1d610c={},_0x53852e={'count':0x0,'rows':[]};var _0xbf8a8c=_[_0x0a6c('0x2d')](db[_0x0a6c('0x2e')][_0x0a6c('0x2f')],function(_0x3ad663){return{'name':_0x3ad663[_0x0a6c('0x30')],'type':_0x3ad663[_0x0a6c('0x31')][_0x0a6c('0x32')]};});_0x1d610c[_0x0a6c('0x33')]=_[_0x0a6c('0x2d')](_0xbf8a8c,_0x0a6c('0x2b'));_0x1d610c['query']=_[_0x0a6c('0x34')](_0x2a1245[_0x0a6c('0x35')]);_0x1d610c[_0x0a6c('0x36')]=_[_0x0a6c('0x37')](_0x1d610c[_0x0a6c('0x33')],_0x1d610c['query']);_0x244318[_0x0a6c('0x38')]=_[_0x0a6c('0x37')](_0x1d610c[_0x0a6c('0x33')],qs['fields'](_0x2a1245[_0x0a6c('0x35')]['fields']));_0x244318[_0x0a6c('0x38')]=_0x244318[_0x0a6c('0x38')][_0x0a6c('0x39')]?_0x244318[_0x0a6c('0x38')]:_0x1d610c[_0x0a6c('0x33')];if(!_0x2a1245[_0x0a6c('0x35')][_0x0a6c('0x3a')]('nolimit')){_0x244318[_0x0a6c('0x1f')]=qs[_0x0a6c('0x1f')](_0x2a1245[_0x0a6c('0x35')][_0x0a6c('0x1f')]);_0x244318['offset']=qs['offset'](_0x2a1245[_0x0a6c('0x35')][_0x0a6c('0x1d')]);}_0x244318[_0x0a6c('0x3b')]=qs[_0x0a6c('0x3c')](_0x2a1245['query']['sort']);_0x244318[_0x0a6c('0x3d')]=qs['filters'](_[_0x0a6c('0x3e')](_0x2a1245[_0x0a6c('0x35')],_0x1d610c['filters']),_0xbf8a8c);if(_0x2a1245[_0x0a6c('0x35')]['filter']){_0x244318[_0x0a6c('0x3d')]=_[_0x0a6c('0x3f')](_0x244318[_0x0a6c('0x3d')],{'$or':_[_0x0a6c('0x2d')](_0xbf8a8c,function(_0x22d853){if(_0x22d853[_0x0a6c('0x31')]!=='VIRTUAL'){var _0x351f3b={};_0x351f3b[_0x22d853[_0x0a6c('0x2b')]]={'$like':'%'+_0x2a1245['query'][_0x0a6c('0x40')]+'%'};return _0x351f3b;}})});}_0x244318=_[_0x0a6c('0x3f')]({},_0x244318,_0x2a1245['options']);var _0x233a2b={'where':_0x244318[_0x0a6c('0x3d')]};return db[_0x0a6c('0x2e')]['count'](_0x233a2b)[_0x0a6c('0x27')](function(_0x50e3af){_0x53852e[_0x0a6c('0x20')]=_0x50e3af;if(_0x2a1245[_0x0a6c('0x35')][_0x0a6c('0x41')]){_0x244318['include']=[{'all':!![]}];}return db[_0x0a6c('0x2e')][_0x0a6c('0x42')](_0x244318);})['then'](function(_0x539f9c){_0x53852e[_0x0a6c('0x43')]=_0x539f9c;return _0x53852e;})['then'](respondWithFilteredResult(_0x1ddd6c,_0x244318))[_0x0a6c('0x44')](handleError(_0x1ddd6c,null));};exports[_0x0a6c('0x45')]=function(_0x3ee8bf,_0x214b27){var _0x828888={'raw':![],'where':{'id':_0x3ee8bf[_0x0a6c('0x46')]['id']}},_0x3e0d27={};_0x3e0d27[_0x0a6c('0x33')]=_[_0x0a6c('0x34')](db[_0x0a6c('0x2e')][_0x0a6c('0x2f')]);_0x3e0d27['query']=_[_0x0a6c('0x34')](_0x3ee8bf[_0x0a6c('0x35')]);_0x3e0d27[_0x0a6c('0x36')]=_[_0x0a6c('0x37')](_0x3e0d27[_0x0a6c('0x33')],_0x3e0d27['query']);_0x828888[_0x0a6c('0x38')]=_[_0x0a6c('0x37')](_0x3e0d27[_0x0a6c('0x33')],qs['fields'](_0x3ee8bf['query']['fields']));_0x828888['attributes']=_0x828888[_0x0a6c('0x38')][_0x0a6c('0x39')]?_0x828888[_0x0a6c('0x38')]:_0x3e0d27[_0x0a6c('0x33')];if(_0x3ee8bf['query'][_0x0a6c('0x41')]){_0x828888[_0x0a6c('0x47')]=[{'all':!![]}];}_0x828888=_['merge']({},_0x828888,_0x3ee8bf[_0x0a6c('0x48')]);return db['Automation']['find'](_0x828888)['then'](handleEntityNotFound(_0x214b27,null))[_0x0a6c('0x27')](respondWithResult(_0x214b27,null))[_0x0a6c('0x44')](handleError(_0x214b27,null));};exports[_0x0a6c('0x49')]=function(_0x11d483,_0x495a01){return db[_0x0a6c('0x2e')][_0x0a6c('0x49')](_0x11d483['body'],{})[_0x0a6c('0x27')](respondWithResult(_0x495a01,0xc9))[_0x0a6c('0x44')](handleError(_0x495a01,null));};exports[_0x0a6c('0x26')]=function(_0xa5bf90,_0x12297a){if(_0xa5bf90['body']['id']){delete _0xa5bf90[_0x0a6c('0x4a')]['id'];}return db[_0x0a6c('0x2e')][_0x0a6c('0x4b')]({'where':{'id':_0xa5bf90[_0x0a6c('0x46')]['id']}})[_0x0a6c('0x27')](handleEntityNotFound(_0x12297a,null))[_0x0a6c('0x27')](saveUpdates(_0xa5bf90[_0x0a6c('0x4a')],null))['then'](respondWithResult(_0x12297a,null))[_0x0a6c('0x44')](handleError(_0x12297a,null));};exports[_0x0a6c('0x28')]=function(_0xfcf8ca,_0x1acbbe){return db[_0x0a6c('0x2e')]['find']({'where':{'id':_0xfcf8ca['params']['id']}})[_0x0a6c('0x27')](handleEntityNotFound(_0x1acbbe,null))['then'](removeEntity(_0x1acbbe,null))[_0x0a6c('0x44')](handleError(_0x1acbbe,null));};exports[_0x0a6c('0x4c')]=function(_0xd5da9e,_0x469760,_0x3f19e7){return db[_0x0a6c('0x4d')][_0x0a6c('0x4b')]({'where':{'id':_0xd5da9e['params']['id']}})['then'](handleEntityNotFound(_0x469760,null))[_0x0a6c('0x27')](function(_0xa68935){if(_0xa68935){return _0xa68935[_0x0a6c('0x4c')](_0xd5da9e[_0x0a6c('0x4a')][_0x0a6c('0x4e')],_[_0x0a6c('0x4f')](_0xd5da9e[_0x0a6c('0x4a')],[_0x0a6c('0x4e'),'id'])||{});}})['then'](respondWithResult(_0x469760,null))[_0x0a6c('0x44')](handleError(_0x469760,null));};exports[_0x0a6c('0x50')]=function(_0x2904fe,_0x347431,_0x3f1cfd){var _0x106e29={};var _0x35af83={};var _0x4d57f1;var _0x212bf8;return db[_0x0a6c('0x2e')][_0x0a6c('0x51')]({'where':{'id':_0x2904fe[_0x0a6c('0x46')]['id']}})[_0x0a6c('0x27')](handleEntityNotFound(_0x347431,null))[_0x0a6c('0x27')](function(_0x4a5438){if(_0x4a5438){_0x4d57f1=_0x4a5438;_0x35af83[_0x0a6c('0x33')]=_[_0x0a6c('0x34')](db[_0x0a6c('0x4d')][_0x0a6c('0x2f')]);_0x35af83[_0x0a6c('0x35')]=_[_0x0a6c('0x34')](_0x2904fe[_0x0a6c('0x35')]);_0x35af83[_0x0a6c('0x36')]=_['intersection'](_0x35af83[_0x0a6c('0x33')],_0x35af83[_0x0a6c('0x35')]);_0x106e29[_0x0a6c('0x38')]=_[_0x0a6c('0x37')](_0x35af83['model'],qs[_0x0a6c('0x52')](_0x2904fe['query'][_0x0a6c('0x52')]));_0x106e29[_0x0a6c('0x38')]=_0x106e29[_0x0a6c('0x38')][_0x0a6c('0x39')]?_0x106e29[_0x0a6c('0x38')]:_0x35af83['model'];_0x106e29[_0x0a6c('0x3b')]=qs['sort'](_0x2904fe[_0x0a6c('0x35')][_0x0a6c('0x3c')]);_0x106e29[_0x0a6c('0x3d')]=qs[_0x0a6c('0x36')](_[_0x0a6c('0x3e')](_0x2904fe[_0x0a6c('0x35')],_0x35af83[_0x0a6c('0x36')]));if(_0x2904fe[_0x0a6c('0x35')][_0x0a6c('0x40')]){_0x106e29[_0x0a6c('0x3d')]=_['merge'](_0x106e29['where'],{'$or':_[_0x0a6c('0x2d')](_0x106e29['attributes'],function(_0x132bd7){var _0x19dd6f={};_0x19dd6f[_0x132bd7]={'$like':'%'+_0x2904fe[_0x0a6c('0x35')][_0x0a6c('0x40')]+'%'};return _0x19dd6f;})});}_0x106e29=_[_0x0a6c('0x3f')]({},_0x106e29,_0x2904fe[_0x0a6c('0x48')]);return _0x4d57f1['getConditions'](_0x106e29);}})[_0x0a6c('0x27')](function(_0xb9bb07){if(_0xb9bb07){_0x212bf8=_0xb9bb07[_0x0a6c('0x39')];if(!_0x2904fe[_0x0a6c('0x35')][_0x0a6c('0x3a')](_0x0a6c('0x53'))){_0x106e29[_0x0a6c('0x1f')]=qs[_0x0a6c('0x1f')](_0x2904fe['query'][_0x0a6c('0x1f')]);_0x106e29['offset']=qs[_0x0a6c('0x1d')](_0x2904fe['query']['offset']);}return _0x4d57f1['getConditions'](_0x106e29);}})[_0x0a6c('0x27')](function(_0x55a3f1){if(_0x55a3f1){return _0x55a3f1?{'count':_0x212bf8,'rows':_0x55a3f1}:null;}})[_0x0a6c('0x27')](respondWithResult(_0x347431,null))[_0x0a6c('0x44')](handleError(_0x347431,null));};exports[_0x0a6c('0x54')]=function(_0x28c571,_0x1921a5,_0x319722){return db[_0x0a6c('0x55')][_0x0a6c('0x4b')]({'where':{'id':_0x28c571[_0x0a6c('0x46')]['id']}})['then'](handleEntityNotFound(_0x1921a5,null))[_0x0a6c('0x27')](function(_0xcf03d){if(_0xcf03d){return _0xcf03d[_0x0a6c('0x54')](_0x28c571[_0x0a6c('0x4a')][_0x0a6c('0x4e')],_['omit'](_0x28c571[_0x0a6c('0x4a')],[_0x0a6c('0x4e'),'id'])||{});}})[_0x0a6c('0x27')](respondWithResult(_0x1921a5,null))['catch'](handleError(_0x1921a5,null));};exports[_0x0a6c('0x56')]=function(_0x2977f2,_0x4a97f3,_0x3d039e){var _0x4c80e2={};var _0xf486c={};var _0x5a6a86;var _0x363626;return db[_0x0a6c('0x2e')]['findOne']({'where':{'id':_0x2977f2[_0x0a6c('0x46')]['id']}})[_0x0a6c('0x27')](handleEntityNotFound(_0x4a97f3,null))['then'](function(_0x2b9a1c){if(_0x2b9a1c){_0x5a6a86=_0x2b9a1c;_0xf486c['model']=_[_0x0a6c('0x34')](db[_0x0a6c('0x55')][_0x0a6c('0x2f')]);_0xf486c[_0x0a6c('0x35')]=_[_0x0a6c('0x34')](_0x2977f2[_0x0a6c('0x35')]);_0xf486c[_0x0a6c('0x36')]=_[_0x0a6c('0x37')](_0xf486c['model'],_0xf486c[_0x0a6c('0x35')]);_0x4c80e2[_0x0a6c('0x38')]=_['intersection'](_0xf486c[_0x0a6c('0x33')],qs[_0x0a6c('0x52')](_0x2977f2[_0x0a6c('0x35')][_0x0a6c('0x52')]));_0x4c80e2['attributes']=_0x4c80e2[_0x0a6c('0x38')]['length']?_0x4c80e2[_0x0a6c('0x38')]:_0xf486c[_0x0a6c('0x33')];_0x4c80e2[_0x0a6c('0x3b')]=qs['sort'](_0x2977f2[_0x0a6c('0x35')][_0x0a6c('0x3c')]);_0x4c80e2['where']=qs[_0x0a6c('0x36')](_['pick'](_0x2977f2[_0x0a6c('0x35')],_0xf486c[_0x0a6c('0x36')]));if(_0x2977f2[_0x0a6c('0x35')][_0x0a6c('0x40')]){_0x4c80e2['where']=_[_0x0a6c('0x3f')](_0x4c80e2[_0x0a6c('0x3d')],{'$or':_['map'](_0x4c80e2['attributes'],function(_0x5bb03b){var _0x358ae2={};_0x358ae2[_0x5bb03b]={'$like':'%'+_0x2977f2[_0x0a6c('0x35')][_0x0a6c('0x40')]+'%'};return _0x358ae2;})});}_0x4c80e2=_[_0x0a6c('0x3f')]({},_0x4c80e2,_0x2977f2[_0x0a6c('0x48')]);return _0x5a6a86[_0x0a6c('0x56')](_0x4c80e2);}})[_0x0a6c('0x27')](function(_0x4dcf6f){if(_0x4dcf6f){_0x363626=_0x4dcf6f[_0x0a6c('0x39')];if(!_0x2977f2[_0x0a6c('0x35')][_0x0a6c('0x3a')](_0x0a6c('0x53'))){_0x4c80e2[_0x0a6c('0x1f')]=qs[_0x0a6c('0x1f')](_0x2977f2['query']['limit']);_0x4c80e2[_0x0a6c('0x1d')]=qs[_0x0a6c('0x1d')](_0x2977f2[_0x0a6c('0x35')][_0x0a6c('0x1d')]);}return _0x5a6a86[_0x0a6c('0x56')](_0x4c80e2);}})[_0x0a6c('0x27')](function(_0x25aed8){if(_0x25aed8){return _0x25aed8?{'count':_0x363626,'rows':_0x25aed8}:null;}})[_0x0a6c('0x27')](respondWithResult(_0x4a97f3,null))[_0x0a6c('0x44')](handleError(_0x4a97f3,null));}; \ No newline at end of file +var _0xd00d=['moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','then','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','catch','show','params','update','body','find','addConditions','omit','ids','getConditions','findOne','Condition','nolimit','addActions','Action','getActions','eml-format','rimraf'];(function(_0x44f4c5,_0x60cd8b){var _0x35cf6a=function(_0x43a904){while(--_0x43a904){_0x44f4c5['push'](_0x44f4c5['shift']());}};_0x35cf6a(++_0x60cd8b);}(_0xd00d,0x136));var _0xdd00=function(_0x20fdc1,_0xde1296){_0x20fdc1=_0x20fdc1-0x0;var _0x25397c=_0xd00d[_0x20fdc1];return _0x25397c;};'use strict';var emlformat=require(_0xdd00('0x0'));var rimraf=require(_0xdd00('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdd00('0x2'));var BPromise=require(_0xdd00('0x3'));var Mustache=require(_0xdd00('0x4'));var util=require(_0xdd00('0x5'));var path=require(_0xdd00('0x6'));var sox=require(_0xdd00('0x7'));var csv=require('to-csv');var ejs=require(_0xdd00('0x8'));var fs=require('fs');var fs_extra=require(_0xdd00('0x9'));var _=require(_0xdd00('0xa'));var squel=require(_0xdd00('0xb'));var crypto=require('crypto');var jsforce=require(_0xdd00('0xc'));var deskjs=require(_0xdd00('0xd'));var toCsv=require(_0xdd00('0xe'));var querystring=require(_0xdd00('0xf'));var Papa=require(_0xdd00('0x10'));var Redis=require(_0xdd00('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdd00('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdd00('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdd00('0x14'));var db=require(_0xdd00('0x15'))['db'];function respondWithStatusCode(_0x14b237,_0x4a24ca){_0x4a24ca=_0x4a24ca||0xcc;return function(_0x5108c4){if(_0x5108c4){return _0x14b237[_0xdd00('0x16')](_0x4a24ca);}return _0x14b237[_0xdd00('0x17')](_0x4a24ca)[_0xdd00('0x18')]();};}function respondWithResult(_0xba51f1,_0x4da188){_0x4da188=_0x4da188||0xc8;return function(_0x1b4efb){if(_0x1b4efb){return _0xba51f1[_0xdd00('0x17')](_0x4da188)['json'](_0x1b4efb);}};}function respondWithFilteredResult(_0x3be55b,_0x1479f6){return function(_0x1f21cb){if(_0x1f21cb){var _0x1352c5=typeof _0x1479f6[_0xdd00('0x19')]==='undefined'&&typeof _0x1479f6[_0xdd00('0x1a')]===_0xdd00('0x1b');var _0x5cb767=_0x1f21cb[_0xdd00('0x1c')];var _0x2d903c=_0x1352c5?0x0:_0x1479f6[_0xdd00('0x19')];var _0x405042=_0x1352c5?_0x1f21cb[_0xdd00('0x1c')]:_0x1479f6[_0xdd00('0x19')]+_0x1479f6[_0xdd00('0x1a')];var _0x6083c;if(_0x405042>=_0x5cb767){_0x405042=_0x5cb767;_0x6083c=0xc8;}else{_0x6083c=0xce;}_0x3be55b[_0xdd00('0x17')](_0x6083c);return _0x3be55b[_0xdd00('0x1d')](_0xdd00('0x1e'),_0x2d903c+'-'+_0x405042+'/'+_0x5cb767)[_0xdd00('0x1f')](_0x1f21cb);}return null;};}function patchUpdates(_0x17422d){return function(_0x155baa){try{jsonpatch['apply'](_0x155baa,_0x17422d,!![]);}catch(_0x17d89f){return BPromise[_0xdd00('0x20')](_0x17d89f);}return _0x155baa['save']();};}function saveUpdates(_0x985b00,_0x436a97){return function(_0xcf11a5){if(_0xcf11a5){return _0xcf11a5['update'](_0x985b00)[_0xdd00('0x21')](function(_0x4cf7e3){return _0x4cf7e3;});}return null;};}function removeEntity(_0x1a834f,_0x2c46d0){return function(_0x3a1164){if(_0x3a1164){return _0x3a1164['destroy']()['then'](function(){_0x1a834f[_0xdd00('0x17')](0xcc)[_0xdd00('0x18')]();});}};}function handleEntityNotFound(_0x2da68d,_0x17cf2d){return function(_0x3558bf){if(!_0x3558bf){_0x2da68d[_0xdd00('0x16')](0x194);}return _0x3558bf;};}function handleError(_0x44baa5,_0x2947e6){_0x2947e6=_0x2947e6||0x1f4;return function(_0xc996e2){logger['error'](_0xc996e2[_0xdd00('0x22')]);if(_0xc996e2[_0xdd00('0x23')]){delete _0xc996e2['name'];}_0x44baa5[_0xdd00('0x17')](_0x2947e6)[_0xdd00('0x24')](_0xc996e2);};}exports[_0xdd00('0x25')]=function(_0x353c9f,_0x170809){var _0x405e85={},_0xdf0af6={},_0x1cb903={'count':0x0,'rows':[]};var _0x338ab3=_[_0xdd00('0x26')](db[_0xdd00('0x27')][_0xdd00('0x28')],function(_0x25d95c){return{'name':_0x25d95c[_0xdd00('0x29')],'type':_0x25d95c[_0xdd00('0x2a')]['key']};});_0xdf0af6[_0xdd00('0x2b')]=_[_0xdd00('0x26')](_0x338ab3,_0xdd00('0x23'));_0xdf0af6[_0xdd00('0x2c')]=_[_0xdd00('0x2d')](_0x353c9f[_0xdd00('0x2c')]);_0xdf0af6['filters']=_['intersection'](_0xdf0af6[_0xdd00('0x2b')],_0xdf0af6['query']);_0x405e85['attributes']=_[_0xdd00('0x2e')](_0xdf0af6[_0xdd00('0x2b')],qs[_0xdd00('0x2f')](_0x353c9f[_0xdd00('0x2c')]['fields']));_0x405e85['attributes']=_0x405e85[_0xdd00('0x30')][_0xdd00('0x31')]?_0x405e85[_0xdd00('0x30')]:_0xdf0af6[_0xdd00('0x2b')];if(!_0x353c9f[_0xdd00('0x2c')][_0xdd00('0x32')]('nolimit')){_0x405e85[_0xdd00('0x1a')]=qs[_0xdd00('0x1a')](_0x353c9f[_0xdd00('0x2c')][_0xdd00('0x1a')]);_0x405e85[_0xdd00('0x19')]=qs[_0xdd00('0x19')](_0x353c9f['query'][_0xdd00('0x19')]);}_0x405e85[_0xdd00('0x33')]=qs[_0xdd00('0x34')](_0x353c9f[_0xdd00('0x2c')][_0xdd00('0x34')]);_0x405e85[_0xdd00('0x35')]=qs[_0xdd00('0x36')](_[_0xdd00('0x37')](_0x353c9f['query'],_0xdf0af6[_0xdd00('0x36')]),_0x338ab3);if(_0x353c9f['query']['filter']){_0x405e85[_0xdd00('0x35')]=_['merge'](_0x405e85[_0xdd00('0x35')],{'$or':_[_0xdd00('0x26')](_0x338ab3,function(_0x5d8abb){if(_0x5d8abb['type']!==_0xdd00('0x38')){var _0x4e6de7={};_0x4e6de7[_0x5d8abb[_0xdd00('0x23')]]={'$like':'%'+_0x353c9f[_0xdd00('0x2c')][_0xdd00('0x39')]+'%'};return _0x4e6de7;}})});}_0x405e85=_[_0xdd00('0x3a')]({},_0x405e85,_0x353c9f[_0xdd00('0x3b')]);var _0x567331={'where':_0x405e85[_0xdd00('0x35')]};return db[_0xdd00('0x27')][_0xdd00('0x1c')](_0x567331)[_0xdd00('0x21')](function(_0x150785){_0x1cb903[_0xdd00('0x1c')]=_0x150785;if(_0x353c9f[_0xdd00('0x2c')][_0xdd00('0x3c')]){_0x405e85[_0xdd00('0x3d')]=[{'all':!![]}];}return db[_0xdd00('0x27')]['findAll'](_0x405e85);})[_0xdd00('0x21')](function(_0x3d21de){_0x1cb903['rows']=_0x3d21de;return _0x1cb903;})[_0xdd00('0x21')](respondWithFilteredResult(_0x170809,_0x405e85))[_0xdd00('0x3e')](handleError(_0x170809,null));};exports[_0xdd00('0x3f')]=function(_0x455e4b,_0xf81924){var _0x58a10c={'raw':![],'where':{'id':_0x455e4b[_0xdd00('0x40')]['id']}},_0x7f0c4b={};_0x7f0c4b[_0xdd00('0x2b')]=_[_0xdd00('0x2d')](db[_0xdd00('0x27')][_0xdd00('0x28')]);_0x7f0c4b[_0xdd00('0x2c')]=_[_0xdd00('0x2d')](_0x455e4b[_0xdd00('0x2c')]);_0x7f0c4b[_0xdd00('0x36')]=_['intersection'](_0x7f0c4b[_0xdd00('0x2b')],_0x7f0c4b['query']);_0x58a10c[_0xdd00('0x30')]=_[_0xdd00('0x2e')](_0x7f0c4b[_0xdd00('0x2b')],qs[_0xdd00('0x2f')](_0x455e4b[_0xdd00('0x2c')][_0xdd00('0x2f')]));_0x58a10c['attributes']=_0x58a10c[_0xdd00('0x30')][_0xdd00('0x31')]?_0x58a10c['attributes']:_0x7f0c4b['model'];if(_0x455e4b[_0xdd00('0x2c')][_0xdd00('0x3c')]){_0x58a10c[_0xdd00('0x3d')]=[{'all':!![]}];}_0x58a10c=_['merge']({},_0x58a10c,_0x455e4b[_0xdd00('0x3b')]);return db['Automation']['find'](_0x58a10c)[_0xdd00('0x21')](handleEntityNotFound(_0xf81924,null))['then'](respondWithResult(_0xf81924,null))['catch'](handleError(_0xf81924,null));};exports['create']=function(_0x4967ec,_0x4fbe7b){return db[_0xdd00('0x27')]['create'](_0x4967ec['body'],{})[_0xdd00('0x21')](respondWithResult(_0x4fbe7b,0xc9))[_0xdd00('0x3e')](handleError(_0x4fbe7b,null));};exports[_0xdd00('0x41')]=function(_0x4b403b,_0x129cc1){if(_0x4b403b[_0xdd00('0x42')]['id']){delete _0x4b403b[_0xdd00('0x42')]['id'];}return db[_0xdd00('0x27')][_0xdd00('0x43')]({'where':{'id':_0x4b403b[_0xdd00('0x40')]['id']}})[_0xdd00('0x21')](handleEntityNotFound(_0x129cc1,null))[_0xdd00('0x21')](saveUpdates(_0x4b403b[_0xdd00('0x42')],null))[_0xdd00('0x21')](respondWithResult(_0x129cc1,null))[_0xdd00('0x3e')](handleError(_0x129cc1,null));};exports['destroy']=function(_0x3057f0,_0x360a2e){return db['Automation'][_0xdd00('0x43')]({'where':{'id':_0x3057f0[_0xdd00('0x40')]['id']}})[_0xdd00('0x21')](handleEntityNotFound(_0x360a2e,null))['then'](removeEntity(_0x360a2e,null))[_0xdd00('0x3e')](handleError(_0x360a2e,null));};exports[_0xdd00('0x44')]=function(_0x202874,_0x41b30c,_0x159a8e){return db['Condition'][_0xdd00('0x43')]({'where':{'id':_0x202874['params']['id']}})[_0xdd00('0x21')](handleEntityNotFound(_0x41b30c,null))['then'](function(_0x40f0b9){if(_0x40f0b9){return _0x40f0b9[_0xdd00('0x44')](_0x202874['body']['ids'],_[_0xdd00('0x45')](_0x202874['body'],[_0xdd00('0x46'),'id'])||{});}})[_0xdd00('0x21')](respondWithResult(_0x41b30c,null))['catch'](handleError(_0x41b30c,null));};exports[_0xdd00('0x47')]=function(_0x59fb7d,_0x274430,_0x114ff4){var _0xa54d01={};var _0x11d3ee={};var _0x40b661;var _0x533859;return db['Automation'][_0xdd00('0x48')]({'where':{'id':_0x59fb7d[_0xdd00('0x40')]['id']}})[_0xdd00('0x21')](handleEntityNotFound(_0x274430,null))['then'](function(_0x455073){if(_0x455073){_0x40b661=_0x455073;_0x11d3ee[_0xdd00('0x2b')]=_[_0xdd00('0x2d')](db[_0xdd00('0x49')][_0xdd00('0x28')]);_0x11d3ee['query']=_[_0xdd00('0x2d')](_0x59fb7d['query']);_0x11d3ee[_0xdd00('0x36')]=_[_0xdd00('0x2e')](_0x11d3ee[_0xdd00('0x2b')],_0x11d3ee[_0xdd00('0x2c')]);_0xa54d01[_0xdd00('0x30')]=_['intersection'](_0x11d3ee[_0xdd00('0x2b')],qs[_0xdd00('0x2f')](_0x59fb7d[_0xdd00('0x2c')][_0xdd00('0x2f')]));_0xa54d01[_0xdd00('0x30')]=_0xa54d01[_0xdd00('0x30')][_0xdd00('0x31')]?_0xa54d01[_0xdd00('0x30')]:_0x11d3ee[_0xdd00('0x2b')];_0xa54d01[_0xdd00('0x33')]=qs[_0xdd00('0x34')](_0x59fb7d[_0xdd00('0x2c')]['sort']);_0xa54d01[_0xdd00('0x35')]=qs[_0xdd00('0x36')](_[_0xdd00('0x37')](_0x59fb7d['query'],_0x11d3ee[_0xdd00('0x36')]));if(_0x59fb7d[_0xdd00('0x2c')][_0xdd00('0x39')]){_0xa54d01[_0xdd00('0x35')]=_[_0xdd00('0x3a')](_0xa54d01[_0xdd00('0x35')],{'$or':_[_0xdd00('0x26')](_0xa54d01[_0xdd00('0x30')],function(_0x30b599){var _0x4ac7ff={};_0x4ac7ff[_0x30b599]={'$like':'%'+_0x59fb7d[_0xdd00('0x2c')][_0xdd00('0x39')]+'%'};return _0x4ac7ff;})});}_0xa54d01=_[_0xdd00('0x3a')]({},_0xa54d01,_0x59fb7d[_0xdd00('0x3b')]);return _0x40b661[_0xdd00('0x47')](_0xa54d01);}})['then'](function(_0x4ca574){if(_0x4ca574){_0x533859=_0x4ca574[_0xdd00('0x31')];if(!_0x59fb7d[_0xdd00('0x2c')][_0xdd00('0x32')](_0xdd00('0x4a'))){_0xa54d01[_0xdd00('0x1a')]=qs['limit'](_0x59fb7d['query'][_0xdd00('0x1a')]);_0xa54d01[_0xdd00('0x19')]=qs[_0xdd00('0x19')](_0x59fb7d[_0xdd00('0x2c')]['offset']);}return _0x40b661[_0xdd00('0x47')](_0xa54d01);}})[_0xdd00('0x21')](function(_0x4c9d97){if(_0x4c9d97){return _0x4c9d97?{'count':_0x533859,'rows':_0x4c9d97}:null;}})[_0xdd00('0x21')](respondWithResult(_0x274430,null))[_0xdd00('0x3e')](handleError(_0x274430,null));};exports[_0xdd00('0x4b')]=function(_0x567d2b,_0x18c0fe,_0x45d18c){return db[_0xdd00('0x4c')][_0xdd00('0x43')]({'where':{'id':_0x567d2b[_0xdd00('0x40')]['id']}})[_0xdd00('0x21')](handleEntityNotFound(_0x18c0fe,null))['then'](function(_0x8b1653){if(_0x8b1653){return _0x8b1653[_0xdd00('0x4b')](_0x567d2b['body'][_0xdd00('0x46')],_[_0xdd00('0x45')](_0x567d2b[_0xdd00('0x42')],['ids','id'])||{});}})[_0xdd00('0x21')](respondWithResult(_0x18c0fe,null))['catch'](handleError(_0x18c0fe,null));};exports[_0xdd00('0x4d')]=function(_0x2cab4a,_0xefb761,_0x4cc81d){var _0x4cfb43={};var _0x369c87={};var _0x1c8616;var _0x243420;return db[_0xdd00('0x27')][_0xdd00('0x48')]({'where':{'id':_0x2cab4a['params']['id']}})[_0xdd00('0x21')](handleEntityNotFound(_0xefb761,null))[_0xdd00('0x21')](function(_0x368bbe){if(_0x368bbe){_0x1c8616=_0x368bbe;_0x369c87['model']=_[_0xdd00('0x2d')](db[_0xdd00('0x4c')][_0xdd00('0x28')]);_0x369c87[_0xdd00('0x2c')]=_[_0xdd00('0x2d')](_0x2cab4a[_0xdd00('0x2c')]);_0x369c87[_0xdd00('0x36')]=_[_0xdd00('0x2e')](_0x369c87[_0xdd00('0x2b')],_0x369c87[_0xdd00('0x2c')]);_0x4cfb43[_0xdd00('0x30')]=_[_0xdd00('0x2e')](_0x369c87[_0xdd00('0x2b')],qs[_0xdd00('0x2f')](_0x2cab4a[_0xdd00('0x2c')]['fields']));_0x4cfb43[_0xdd00('0x30')]=_0x4cfb43[_0xdd00('0x30')][_0xdd00('0x31')]?_0x4cfb43[_0xdd00('0x30')]:_0x369c87[_0xdd00('0x2b')];_0x4cfb43[_0xdd00('0x33')]=qs[_0xdd00('0x34')](_0x2cab4a['query'][_0xdd00('0x34')]);_0x4cfb43[_0xdd00('0x35')]=qs[_0xdd00('0x36')](_[_0xdd00('0x37')](_0x2cab4a[_0xdd00('0x2c')],_0x369c87[_0xdd00('0x36')]));if(_0x2cab4a['query'][_0xdd00('0x39')]){_0x4cfb43[_0xdd00('0x35')]=_['merge'](_0x4cfb43[_0xdd00('0x35')],{'$or':_[_0xdd00('0x26')](_0x4cfb43[_0xdd00('0x30')],function(_0x2918b9){var _0x4ae1e1={};_0x4ae1e1[_0x2918b9]={'$like':'%'+_0x2cab4a[_0xdd00('0x2c')][_0xdd00('0x39')]+'%'};return _0x4ae1e1;})});}_0x4cfb43=_[_0xdd00('0x3a')]({},_0x4cfb43,_0x2cab4a[_0xdd00('0x3b')]);return _0x1c8616['getActions'](_0x4cfb43);}})['then'](function(_0x54c2e6){if(_0x54c2e6){_0x243420=_0x54c2e6['length'];if(!_0x2cab4a[_0xdd00('0x2c')][_0xdd00('0x32')](_0xdd00('0x4a'))){_0x4cfb43[_0xdd00('0x1a')]=qs[_0xdd00('0x1a')](_0x2cab4a[_0xdd00('0x2c')][_0xdd00('0x1a')]);_0x4cfb43[_0xdd00('0x19')]=qs[_0xdd00('0x19')](_0x2cab4a[_0xdd00('0x2c')]['offset']);}return _0x1c8616[_0xdd00('0x4d')](_0x4cfb43);}})[_0xdd00('0x21')](function(_0x1c0530){if(_0x1c0530){return _0x1c0530?{'count':_0x243420,'rows':_0x1c0530}:null;}})[_0xdd00('0x21')](respondWithResult(_0xefb761,null))[_0xdd00('0x3e')](handleError(_0xefb761,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index cd42f50..954f3a0 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 _0xbc6c=['exports','define','Automation','tools_automations','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./automation.attributes'];(function(_0x523985,_0x4d75bc){var _0x492a79=function(_0x137af4){while(--_0x137af4){_0x523985['push'](_0x523985['shift']());}};_0x492a79(++_0x4d75bc);}(_0xbc6c,0x64));var _0xcbc6=function(_0xb2386e,_0x40c6b2){_0xb2386e=_0xb2386e-0x0;var _0x568491=_0xbc6c[_0xb2386e];return _0x568491;};'use strict';var _=require(_0xcbc6('0x0'));var util=require(_0xcbc6('0x1'));var logger=require('../../config/logger')(_0xcbc6('0x2'));var moment=require(_0xcbc6('0x3'));var BPromise=require(_0xcbc6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcbc6('0x5'));var config=require(_0xcbc6('0x6'));var attributes=require(_0xcbc6('0x7'));module[_0xcbc6('0x8')]=function(_0x18e75d,_0x2d3aad){return _0x18e75d[_0xcbc6('0x9')](_0xcbc6('0xa'),attributes,{'tableName':_0xcbc6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9859=['../../config/environment','./automation.attributes','exports','define','Automation','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x2fa469,_0x26e9de){var _0x330d03=function(_0x4517d3){while(--_0x4517d3){_0x2fa469['push'](_0x2fa469['shift']());}};_0x330d03(++_0x26e9de);}(_0x9859,0xbb));var _0x9985=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0x9859[_0x1b6c6d];return _0x290d9d;};'use strict';var _=require(_0x9985('0x0'));var util=require(_0x9985('0x1'));var logger=require(_0x9985('0x2'))('api');var moment=require(_0x9985('0x3'));var BPromise=require(_0x9985('0x4'));var rp=require(_0x9985('0x5'));var fs=require('fs');var path=require(_0x9985('0x6'));var rimraf=require(_0x9985('0x7'));var config=require(_0x9985('0x8'));var attributes=require(_0x9985('0x9'));module[_0x9985('0xa')]=function(_0x14c812,_0x4f3902){return _0x14c812[_0x9985('0xb')](_0x9985('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 d50af25..1cb6c88 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 _0xe2cf=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x887b7,_0x280f32){var _0xd7c201=function(_0x21e108){while(--_0x21e108){_0x887b7['push'](_0x887b7['shift']());}};_0xd7c201(++_0x280f32);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x574617,_0x42eccc){_0x574617=_0x574617-0x0;var _0x29de90=_0xe2cf[_0x574617];return _0x29de90;};'use strict';var _=require('lodash');var util=require(_0xfe2c('0x0'));var moment=require('moment');var BPromise=require(_0xfe2c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe2c('0x2'));var db=require(_0xfe2c('0x3'))['db'];var utils=require(_0xfe2c('0x4'));var logger=require(_0xfe2c('0x5'))('rpc');var config=require(_0xfe2c('0x6'));var jayson=require(_0xfe2c('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4e0b97,_0x417bc4,_0x5e5b46){return new BPromise(function(_0x485a24,_0x30aafe){return client[_0xfe2c('0x8')](_0x4e0b97,_0x5e5b46)[_0xfe2c('0x9')](function(_0x562414){logger['info'](_0xfe2c('0xa'),_0x417bc4,_0xfe2c('0xb'));logger['debug'](_0xfe2c('0xc'),_0x417bc4,_0xfe2c('0xb'),JSON[_0xfe2c('0xd')](_0x562414));if(_0x562414[_0xfe2c('0xe')]){if(_0x562414[_0xfe2c('0xe')][_0xfe2c('0xf')]===0x1f4){logger[_0xfe2c('0xe')]('Automation,\x20%s,\x20%s',_0x417bc4,_0x562414['error']['message']);return _0x30aafe(_0x562414['error'][_0xfe2c('0x10')]);}logger['error']('Automation,\x20%s,\x20%s',_0x417bc4,_0x562414[_0xfe2c('0xe')][_0xfe2c('0x10')]);return _0x485a24(_0x562414[_0xfe2c('0xe')][_0xfe2c('0x10')]);}else{logger['info']('Automation,\x20%s,\x20%s',_0x417bc4,_0xfe2c('0xb'));_0x485a24(_0x562414[_0xfe2c('0x11')][_0xfe2c('0x10')]);}})[_0xfe2c('0x12')](function(_0x565f40){logger[_0xfe2c('0xe')](_0xfe2c('0xa'),_0x417bc4,_0x565f40);_0x30aafe(_0x565f40);});});} \ No newline at end of file +var _0x0137=['http','then','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3b231a,_0x53a00d){var _0x18d67a=function(_0x5e14c6){while(--_0x5e14c6){_0x3b231a['push'](_0x3b231a['shift']());}};_0x18d67a(++_0x53a00d);}(_0x0137,0x1d8));var _0x7013=function(_0x4287e9,_0x31f01c){_0x4287e9=_0x4287e9-0x0;var _0x2f8390=_0x0137[_0x4287e9];return _0x2f8390;};'use strict';var _=require(_0x7013('0x0'));var util=require(_0x7013('0x1'));var moment=require(_0x7013('0x2'));var BPromise=require(_0x7013('0x3'));var rs=require(_0x7013('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7013('0x5'))['db'];var utils=require(_0x7013('0x6'));var logger=require(_0x7013('0x7'))(_0x7013('0x8'));var config=require(_0x7013('0x9'));var jayson=require(_0x7013('0xa'));var client=jayson['client'][_0x7013('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x346a4d,_0x4e2460,_0x16c0c8){return new BPromise(function(_0x16dae3,_0x1b748c){return client['request'](_0x346a4d,_0x16c0c8)[_0x7013('0xc')](function(_0x551b8a){logger[_0x7013('0xd')](_0x7013('0xe'),_0x4e2460,'request\x20sent');logger[_0x7013('0xf')](_0x7013('0x10'),_0x4e2460,_0x7013('0x11'),JSON[_0x7013('0x12')](_0x551b8a));if(_0x551b8a[_0x7013('0x13')]){if(_0x551b8a[_0x7013('0x13')]['code']===0x1f4){logger[_0x7013('0x13')](_0x7013('0xe'),_0x4e2460,_0x551b8a[_0x7013('0x13')][_0x7013('0x14')]);return _0x1b748c(_0x551b8a[_0x7013('0x13')][_0x7013('0x14')]);}logger[_0x7013('0x13')](_0x7013('0xe'),_0x4e2460,_0x551b8a[_0x7013('0x13')][_0x7013('0x14')]);return _0x16dae3(_0x551b8a[_0x7013('0x13')]['message']);}else{logger['info'](_0x7013('0xe'),_0x4e2460,_0x7013('0x11'));_0x16dae3(_0x551b8a[_0x7013('0x15')][_0x7013('0x14')]);}})[_0x7013('0x16')](function(_0x48614e){logger['error'](_0x7013('0xe'),_0x4e2460,_0x48614e);_0x1b748c(_0x48614e);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index fe36652..2e3da76 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 _0x5735=['/:id/actions','post','/:id/conditions','addConditions','addActions','put','update','delete','destroy','exports','multer','connect-timeout','express','../../components/interaction/service','../../config/environment','./automation.controller','get','index','/:id','isAuthenticated','show','getConditions'];(function(_0x26b9fc,_0x17bafd){var _0x89ce9=function(_0x172e42){while(--_0x172e42){_0x26b9fc['push'](_0x26b9fc['shift']());}};_0x89ce9(++_0x17bafd);}(_0x5735,0x16a));var _0x5573=function(_0x4fd82a,_0x29d9d5){_0x4fd82a=_0x4fd82a-0x0;var _0x21d2a8=_0x5735[_0x4fd82a];return _0x21d2a8;};'use strict';var multer=require(_0x5573('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5573('0x1'));var express=require(_0x5573('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5573('0x3'));var config=require(_0x5573('0x4'));var controller=require(_0x5573('0x5'));router[_0x5573('0x6')]('/',auth['isAuthenticated'](),controller[_0x5573('0x7')]);router[_0x5573('0x6')](_0x5573('0x8'),auth[_0x5573('0x9')](),controller[_0x5573('0xa')]);router[_0x5573('0x6')]('/:id/conditions',auth['isAuthenticated'](),controller[_0x5573('0xb')]);router[_0x5573('0x6')](_0x5573('0xc'),auth[_0x5573('0x9')](),controller['getActions']);router['post']('/',auth[_0x5573('0x9')](),controller['create']);router[_0x5573('0xd')](_0x5573('0xe'),auth[_0x5573('0x9')](),controller[_0x5573('0xf')]);router[_0x5573('0xd')](_0x5573('0xc'),auth[_0x5573('0x9')](),controller[_0x5573('0x10')]);router[_0x5573('0x11')](_0x5573('0x8'),auth['isAuthenticated'](),controller[_0x5573('0x12')]);router[_0x5573('0x13')]('/:id',auth[_0x5573('0x9')](),controller[_0x5573('0x14')]);module[_0x5573('0x15')]=router; \ No newline at end of file +var _0xe8cb=['addConditions','addActions','put','update','delete','destroy','multer','util','path','Router','fs-extra','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','/:id/actions','getActions','post','create'];(function(_0x29fa3d,_0x45d24f){var _0x5d4bbf=function(_0x5b89ef){while(--_0x5b89ef){_0x29fa3d['push'](_0x29fa3d['shift']());}};_0x5d4bbf(++_0x45d24f);}(_0xe8cb,0x11a));var _0xbe8c=function(_0x50c332,_0x24afd0){_0x50c332=_0x50c332-0x0;var _0x4a307f=_0xe8cb[_0x50c332];return _0x4a307f;};'use strict';var multer=require(_0xbe8c('0x0'));var util=require(_0xbe8c('0x1'));var path=require(_0xbe8c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbe8c('0x3')]();var fs_extra=require(_0xbe8c('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbe8c('0x5'));var controller=require(_0xbe8c('0x6'));router[_0xbe8c('0x7')]('/',auth[_0xbe8c('0x8')](),controller[_0xbe8c('0x9')]);router['get'](_0xbe8c('0xa'),auth[_0xbe8c('0x8')](),controller[_0xbe8c('0xb')]);router[_0xbe8c('0x7')](_0xbe8c('0xc'),auth[_0xbe8c('0x8')](),controller['getConditions']);router[_0xbe8c('0x7')](_0xbe8c('0xd'),auth[_0xbe8c('0x8')](),controller[_0xbe8c('0xe')]);router[_0xbe8c('0xf')]('/',auth[_0xbe8c('0x8')](),controller[_0xbe8c('0x10')]);router[_0xbe8c('0xf')](_0xbe8c('0xc'),auth[_0xbe8c('0x8')](),controller[_0xbe8c('0x11')]);router[_0xbe8c('0xf')](_0xbe8c('0xd'),auth[_0xbe8c('0x8')](),controller[_0xbe8c('0x12')]);router[_0xbe8c('0x13')](_0xbe8c('0xa'),auth[_0xbe8c('0x8')](),controller[_0xbe8c('0x14')]);router[_0xbe8c('0x15')](_0xbe8c('0xa'),auth[_0xbe8c('0x8')](),controller[_0xbe8c('0x16')]);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 7ddb1e8..585b137 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 _0x40bc=['Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','ENUM','ivr','Active/Disactive\x20Campaign','INTEGER','STRING','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#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)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)'];(function(_0x5da8e9,_0x3beb32){var _0x24a605=function(_0x284ab3){while(--_0x284ab3){_0x5da8e9['push'](_0x5da8e9['shift']());}};_0x24a605(++_0x3beb32);}(_0x40bc,0x10e));var _0xc40b=function(_0xab3a19,_0x273596){_0xab3a19=_0xab3a19-0x0;var _0x30540e=_0x40bc[_0xab3a19];return _0x30540e;};'use strict';var Sequelize=require(_0xc40b('0x0'));module[_0xc40b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xc40b('0x2')](_0xc40b('0x3')),'allowNull':![],'defaultValue':_0xc40b('0x3')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xc40b('0x4')},'limitCalls':{'type':Sequelize[_0xc40b('0x5')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0xc40b('0x6')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc40b('0x6')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc40b('0x7')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc40b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc40b('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc40b('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xc40b('0x5')](0x3)[_0xc40b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc40b('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0xc40b('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc40b('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc40b('0x5')](0x3)[_0xc40b('0x8')],'defaultValue':0x3,'comment':_0xc40b('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc40b('0x5')](0x5)[_0xc40b('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc40b('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xc40b('0xd')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0xc40b('0x2')]('always','never',_0xc40b('0xe')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xc40b('0xf')],'defaultValue':0x0,'comment':_0xc40b('0x10')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xc40b('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xc40b('0x5')](0x9)[_0xc40b('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc40b('0x11')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xc40b('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc40b('0x12')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc40b('0x5')](0x9)[_0xc40b('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc40b('0x13')},'dialAMDMinWordLength':{'type':Sequelize[_0xc40b('0x5')](0x9)[_0xc40b('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc40b('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc40b('0x5')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc40b('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xc40b('0x5')](0x9)[_0xc40b('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xc40b('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc40b('0x5')](0x5)[_0xc40b('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc40b('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc40b('0x5')](0x9)[_0xc40b('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC','ASC'),'defaultValue':_0xc40b('0x18')},'dialPrefix':{'type':Sequelize[_0xc40b('0x6')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc40b('0x19')},'dialCutDigit':{'type':Sequelize[_0xc40b('0x5')](0x3)[_0xc40b('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc40b('0x1a')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc40b('0x5')](0x3)[_0xc40b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc40b('0x1b')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc40b('0x5')](0x5)[_0xc40b('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc40b('0x1c')},'dialDropMaxRetry':{'type':Sequelize[_0xc40b('0x5')](0x3)[_0xc40b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc40b('0x1d')},'dialDropRetryFrequency':{'type':Sequelize[_0xc40b('0x5')](0x5)[_0xc40b('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc40b('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc40b('0x5')](0x3)[_0xc40b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc40b('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc40b('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc40b('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0xc40b('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc40b('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0xc40b('0x5')](0x5)[_0xc40b('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc40b('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xc40b('0x5')](0x3)[_0xc40b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc40b('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xc40b('0x5')](0x5)[_0xc40b('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc40b('0x24')}}; \ No newline at end of file +var _0x0f23=['#AMD\x20Maximum\x20Number\x20Of\x20Words','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\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','name','ivr','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','ENUM','always','never','onlyIfOpen','BOOLEAN','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence'];(function(_0x124298,_0x542004){var _0x35ac24=function(_0x49afe8){while(--_0x49afe8){_0x124298['push'](_0x124298['shift']());}};_0x35ac24(++_0x542004);}(_0x0f23,0xeb));var _0x30f2=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x0f23[_0x13ce0c];return _0x4388fb;};'use strict';var Sequelize=require(_0x30f2('0x0'));module['exports']={'name':{'type':Sequelize[_0x30f2('0x1')],'unique':_0x30f2('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x30f2('0x3')),'allowNull':![],'defaultValue':_0x30f2('0x3')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x30f2('0x4')},'limitCalls':{'type':Sequelize[_0x30f2('0x5')](0x4)[_0x30f2('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x30f2('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x30f2('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x30f2('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x30f2('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x30f2('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x30f2('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x30f2('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x30f2('0x5')](0x5)[_0x30f2('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x30f2('0xa')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x30f2('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x30f2('0x5')](0x5)[_0x30f2('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x30f2('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x30f2('0x6')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x30f2('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x30f2('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0x30f2('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x30f2('0xd')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x30f2('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x30f2('0xe')](_0x30f2('0xf'),_0x30f2('0x10'),_0x30f2('0x11')),'defaultValue':_0x30f2('0xf')},'dialAMDActive':{'type':Sequelize[_0x30f2('0x12')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x30f2('0x5')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x30f2('0x5')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x30f2('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x30f2('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x30f2('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x30f2('0x5')](0x9)[_0x30f2('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x30f2('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x30f2('0x5')](0x9)[_0x30f2('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x30f2('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x30f2('0x5')](0x9)[_0x30f2('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x30f2('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x30f2('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x30f2('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x30f2('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x30f2('0x5')](0x9)[_0x30f2('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x30f2('0xe')](_0x30f2('0x19'),_0x30f2('0x1a')),'defaultValue':_0x30f2('0x19')},'dialPrefix':{'type':Sequelize[_0x30f2('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x30f2('0x5')](0x3)[_0x30f2('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x30f2('0x1b')},'dialCutDigit':{'type':Sequelize[_0x30f2('0x5')](0x3)[_0x30f2('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x30f2('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x30f2('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x30f2('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x30f2('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x30f2('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x30f2('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0x30f2('0x5')](0x5)[_0x30f2('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x30f2('0x5')](0x3)[_0x30f2('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x30f2('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x30f2('0x5')](0x5)[_0x30f2('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x30f2('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0x30f2('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x30f2('0x21')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x30f2('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x30f2('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x30f2('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x30f2('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x30f2('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x30f2('0x24')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 36bce73..8dd9d9c 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 _0x1ddb=['Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','body','createdAt','getHoppers','findOne','CmHopper','sort','CmHopperHistory','getHopperFinals','CampaignId','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','updatedAt','select','field','NOW()','cm_contacts','CmListId','COALESCE(calleridnum,\x27\x27)','from','CampaignId\x20=\x20?','toString','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','sequelize','all','removeLists','getBlackLists','addBlackLists','omit','cm_hopper_black','deletedAt\x20IS\x20NULL','push','removeBlackLists','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','end','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','includeAll','include','Campaign','findAll','rows','catch','params','options','find','create'];(function(_0x39cd99,_0x548c6d){var _0x534598=function(_0x1a48a6){while(--_0x1a48a6){_0x39cd99['push'](_0x39cd99['shift']());}};_0x534598(++_0x548c6d);}(_0x1ddb,0xc5));var _0xb1dd=function(_0x5c4444,_0x119726){_0x5c4444=_0x5c4444-0x0;var _0x20d93d=_0x1ddb[_0x5c4444];return _0x20d93d;};'use strict';var emlformat=require(_0xb1dd('0x0'));var rimraf=require(_0xb1dd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb1dd('0x2'));var rp=require('request-promise');var moment=require(_0xb1dd('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb1dd('0x4'));var util=require(_0xb1dd('0x5'));var path=require(_0xb1dd('0x6'));var sox=require(_0xb1dd('0x7'));var csv=require('to-csv');var ejs=require(_0xb1dd('0x8'));var fs=require('fs');var fs_extra=require(_0xb1dd('0x9'));var _=require(_0xb1dd('0xa'));var squel=require(_0xb1dd('0xb'));var crypto=require(_0xb1dd('0xc'));var jsforce=require(_0xb1dd('0xd'));var deskjs=require(_0xb1dd('0xe'));var toCsv=require(_0xb1dd('0xf'));var querystring=require(_0xb1dd('0x10'));var Papa=require(_0xb1dd('0x11'));var Redis=require('ioredis');var authService=require(_0xb1dd('0x12'));var qs=require(_0xb1dd('0x13'));var as=require(_0xb1dd('0x14'));var hardwareService=require(_0xb1dd('0x15'));var logger=require(_0xb1dd('0x16'))('api');var utils=require(_0xb1dd('0x17'));var config=require(_0xb1dd('0x18'));var licenseUtil=require(_0xb1dd('0x19'));var db=require(_0xb1dd('0x1a'))['db'];function respondWithStatusCode(_0x250d93,_0x22f682){_0x22f682=_0x22f682||0xcc;return function(_0x25b7a4){if(_0x25b7a4){return _0x250d93[_0xb1dd('0x1b')](_0x22f682);}return _0x250d93[_0xb1dd('0x1c')](_0x22f682)['end']();};}function respondWithResult(_0x4349fe,_0x2e99b9){_0x2e99b9=_0x2e99b9||0xc8;return function(_0x2a5a8d){if(_0x2a5a8d){return _0x4349fe[_0xb1dd('0x1c')](_0x2e99b9)[_0xb1dd('0x1d')](_0x2a5a8d);}};}function respondWithFilteredResult(_0x5f2481,_0x183c66){return function(_0x231b71){if(_0x231b71){var _0x2027c1=typeof _0x183c66[_0xb1dd('0x1e')]===_0xb1dd('0x1f')&&typeof _0x183c66['limit']===_0xb1dd('0x1f');var _0x17564f=_0x231b71[_0xb1dd('0x20')];var _0x595aa1=_0x2027c1?0x0:_0x183c66[_0xb1dd('0x1e')];var _0x5872a0=_0x2027c1?_0x231b71[_0xb1dd('0x20')]:_0x183c66['offset']+_0x183c66[_0xb1dd('0x21')];var _0x235109;if(_0x5872a0>=_0x17564f){_0x5872a0=_0x17564f;_0x235109=0xc8;}else{_0x235109=0xce;}_0x5f2481['status'](_0x235109);return _0x5f2481['set'](_0xb1dd('0x22'),_0x595aa1+'-'+_0x5872a0+'/'+_0x17564f)[_0xb1dd('0x1d')](_0x231b71);}return null;};}function patchUpdates(_0x5cedec){return function(_0x1e28c6){try{jsonpatch[_0xb1dd('0x23')](_0x1e28c6,_0x5cedec,!![]);}catch(_0x3bcd9e){return BPromise['reject'](_0x3bcd9e);}return _0x1e28c6[_0xb1dd('0x24')]();};}function saveUpdates(_0x5adcc3,_0x1bdc1c){return function(_0x22e1ee){if(_0x22e1ee){return _0x22e1ee[_0xb1dd('0x25')](_0x5adcc3)[_0xb1dd('0x26')](function(_0x3181f4){return _0x3181f4;});}return null;};}function removeEntity(_0x565d1b,_0x47bcba){return function(_0x3348fa){if(_0x3348fa){return _0x3348fa[_0xb1dd('0x27')]()[_0xb1dd('0x26')](function(){var _0x2c5086=_0x3348fa[_0xb1dd('0x28')]({'plain':!![]});var _0x5b9d6a=_0xb1dd('0x29');return db[_0xb1dd('0x2a')][_0xb1dd('0x27')]({'where':{'type':_0x5b9d6a,'resourceId':_0x2c5086['id']}})[_0xb1dd('0x26')](function(){return _0x3348fa;});})[_0xb1dd('0x26')](function(){_0x565d1b['status'](0xcc)[_0xb1dd('0x2b')]();});}};}function handleEntityNotFound(_0x19bfcf,_0x156554){return function(_0xef3c04){if(!_0xef3c04){_0x19bfcf['sendStatus'](0x194);}return _0xef3c04;};}function handleError(_0x28267c,_0x23d55d){_0x23d55d=_0x23d55d||0x1f4;return function(_0x7704d4){logger['error'](_0x7704d4[_0xb1dd('0x2c')]);if(_0x7704d4[_0xb1dd('0x2d')]){delete _0x7704d4[_0xb1dd('0x2d')];}_0x28267c[_0xb1dd('0x1c')](_0x23d55d)[_0xb1dd('0x2e')](_0x7704d4);};}exports['index']=function(_0x2e0fad,_0x249bbd){var _0x1c1457={},_0x4bf6f0={},_0x33d3dd={'count':0x0,'rows':[]};var _0x118fe1=_[_0xb1dd('0x2f')](db['Campaign'][_0xb1dd('0x30')],function(_0x20925f){return{'name':_0x20925f['fieldName'],'type':_0x20925f[_0xb1dd('0x31')][_0xb1dd('0x32')]};});_0x4bf6f0[_0xb1dd('0x33')]=_[_0xb1dd('0x2f')](_0x118fe1,'name');_0x4bf6f0[_0xb1dd('0x34')]=_[_0xb1dd('0x35')](_0x2e0fad['query']);_0x4bf6f0[_0xb1dd('0x36')]=_['intersection'](_0x4bf6f0[_0xb1dd('0x33')],_0x4bf6f0[_0xb1dd('0x34')]);_0x1c1457[_0xb1dd('0x37')]=_[_0xb1dd('0x38')](_0x4bf6f0[_0xb1dd('0x33')],qs[_0xb1dd('0x39')](_0x2e0fad['query'][_0xb1dd('0x39')]));_0x1c1457[_0xb1dd('0x37')]=_0x1c1457[_0xb1dd('0x37')][_0xb1dd('0x3a')]?_0x1c1457[_0xb1dd('0x37')]:_0x4bf6f0[_0xb1dd('0x33')];if(!_0x2e0fad['query'][_0xb1dd('0x3b')](_0xb1dd('0x3c'))){_0x1c1457['limit']=qs['limit'](_0x2e0fad[_0xb1dd('0x34')][_0xb1dd('0x21')]);_0x1c1457[_0xb1dd('0x1e')]=qs[_0xb1dd('0x1e')](_0x2e0fad[_0xb1dd('0x34')][_0xb1dd('0x1e')]);}_0x1c1457[_0xb1dd('0x3d')]=qs['sort'](_0x2e0fad[_0xb1dd('0x34')]['sort']);_0x1c1457[_0xb1dd('0x3e')]=qs[_0xb1dd('0x36')](_[_0xb1dd('0x3f')](_0x2e0fad['query'],_0x4bf6f0['filters']),_0x118fe1);if(_0x2e0fad[_0xb1dd('0x34')][_0xb1dd('0x40')]){_0x1c1457[_0xb1dd('0x3e')]=_['merge'](_0x1c1457['where'],{'$or':_[_0xb1dd('0x2f')](_0x118fe1,function(_0x1e214a){if(_0x1e214a['type']!==_0xb1dd('0x41')){var _0x45ebd4={};_0x45ebd4[_0x1e214a['name']]={'$like':'%'+_0x2e0fad[_0xb1dd('0x34')][_0xb1dd('0x40')]+'%'};return _0x45ebd4;}})});}_0x1c1457=_[_0xb1dd('0x42')]({},_0x1c1457,_0x2e0fad['options']);var _0xd36f93={'where':_0x1c1457[_0xb1dd('0x3e')]};return db['Campaign'][_0xb1dd('0x20')](_0xd36f93)['then'](function(_0x281434){_0x33d3dd[_0xb1dd('0x20')]=_0x281434;if(_0x2e0fad[_0xb1dd('0x34')][_0xb1dd('0x43')]){_0x1c1457[_0xb1dd('0x44')]=[{'all':!![]}];}return db[_0xb1dd('0x45')][_0xb1dd('0x46')](_0x1c1457);})['then'](function(_0x15f2ce){_0x33d3dd[_0xb1dd('0x47')]=_0x15f2ce;return _0x33d3dd;})[_0xb1dd('0x26')](respondWithFilteredResult(_0x249bbd,_0x1c1457))[_0xb1dd('0x48')](handleError(_0x249bbd,null));};exports['show']=function(_0x3e7e82,_0x458cc3){var _0x51ce60={'raw':![],'where':{'id':_0x3e7e82[_0xb1dd('0x49')]['id']}},_0x2787d1={};_0x2787d1[_0xb1dd('0x33')]=_['keys'](db[_0xb1dd('0x45')][_0xb1dd('0x30')]);_0x2787d1['query']=_['keys'](_0x3e7e82[_0xb1dd('0x34')]);_0x2787d1[_0xb1dd('0x36')]=_['intersection'](_0x2787d1[_0xb1dd('0x33')],_0x2787d1['query']);_0x51ce60[_0xb1dd('0x37')]=_['intersection'](_0x2787d1[_0xb1dd('0x33')],qs['fields'](_0x3e7e82[_0xb1dd('0x34')]['fields']));_0x51ce60[_0xb1dd('0x37')]=_0x51ce60['attributes'][_0xb1dd('0x3a')]?_0x51ce60[_0xb1dd('0x37')]:_0x2787d1[_0xb1dd('0x33')];if(_0x3e7e82[_0xb1dd('0x34')][_0xb1dd('0x43')]){_0x51ce60[_0xb1dd('0x44')]=[{'all':!![]}];}_0x51ce60=_[_0xb1dd('0x42')]({},_0x51ce60,_0x3e7e82[_0xb1dd('0x4a')]);return db[_0xb1dd('0x45')][_0xb1dd('0x4b')](_0x51ce60)[_0xb1dd('0x26')](handleEntityNotFound(_0x458cc3,null))[_0xb1dd('0x26')](respondWithResult(_0x458cc3,null))[_0xb1dd('0x48')](handleError(_0x458cc3,null));};exports[_0xb1dd('0x4c')]=function(_0x56a145,_0x3d83ee){return db['Campaign'][_0xb1dd('0x4c')](_0x56a145['body'],{})[_0xb1dd('0x26')](function(_0x45a8c8){var _0x304b90=_0x56a145['user'][_0xb1dd('0x28')]({'plain':!![]});if(!_0x304b90)throw new Error(_0xb1dd('0x4d'));if(_0x304b90['role']===_0xb1dd('0x4e')){var _0x5abff7=_0x45a8c8['get']({'plain':!![]});var _0x96e700='IvrCampaigns';return db[_0xb1dd('0x4f')][_0xb1dd('0x4b')]({'where':{'name':_0x96e700,'userProfileId':_0x304b90[_0xb1dd('0x50')]},'raw':!![]})[_0xb1dd('0x26')](function(_0x45b9a7){if(_0x45b9a7&&_0x45b9a7[_0xb1dd('0x51')]===0x0){return db[_0xb1dd('0x2a')][_0xb1dd('0x4c')]({'name':_0x5abff7[_0xb1dd('0x2d')],'resourceId':_0x5abff7['id'],'type':_0x45b9a7[_0xb1dd('0x2d')],'sectionId':_0x45b9a7['id']},{})[_0xb1dd('0x26')](function(){return _0x45a8c8;});}else{return _0x45a8c8;}})[_0xb1dd('0x48')](function(_0x1ae691){logger[_0xb1dd('0x52')](_0xb1dd('0x53'),_0x1ae691);throw _0x1ae691;});}return _0x45a8c8;})[_0xb1dd('0x26')](respondWithResult(_0x3d83ee,0xc9))[_0xb1dd('0x48')](handleError(_0x3d83ee,null));};exports[_0xb1dd('0x54')]=function(_0x4fd7a7,_0x187212){var _0x5251e4={'where':{'id':_0x4fd7a7['params']['id']}},_0x1ae166={};_0x1ae166[_0xb1dd('0x33')]=_[_0xb1dd('0x35')](db[_0xb1dd('0x45')]['rawAttributes']);_0x5251e4[_0xb1dd('0x37')]=_[_0xb1dd('0x38')](_0x1ae166[_0xb1dd('0x33')],qs['fields'](_0x4fd7a7['query']['fields']));_0x5251e4[_0xb1dd('0x37')]=_0x5251e4['attributes']['length']?_0x5251e4[_0xb1dd('0x37')]:_0x1ae166['model'];if(_0x4fd7a7[_0xb1dd('0x34')]['includeAll']){_0x5251e4[_0xb1dd('0x44')]=[{'all':!![]}];}_0x5251e4=_[_0xb1dd('0x42')]({},_0x5251e4,_0x4fd7a7[_0xb1dd('0x4a')]);return db['Campaign'][_0xb1dd('0x4b')](_0x5251e4)[_0xb1dd('0x26')](handleEntityNotFound(_0x187212,null))[_0xb1dd('0x26')](function(_0x207397){if(_0x207397){var _0xcff843=_0x207397[_0xb1dd('0x28')]({'plain':!![]});_0xcff843=qs['omit'](_0xcff843,['id','createdAt','updatedAt']);_0x4fd7a7[_0xb1dd('0x55')]=_['omit'](_0x4fd7a7[_0xb1dd('0x55')],['id',_0xb1dd('0x56'),'updatedAt']);return db['Campaign'][_0xb1dd('0x4c')](_[_0xb1dd('0x42')](_0xcff843,_0x4fd7a7[_0xb1dd('0x55')]),{'include':_0x4fd7a7[_0xb1dd('0x34')][_0xb1dd('0x43')]?[{'all':!![]}]:undefined})['then'](function(_0x59632b){var _0x38b8bf=_0x4fd7a7[_0xb1dd('0x4e')][_0xb1dd('0x28')]({'plain':!![]});if(!_0x38b8bf)throw new Error(_0xb1dd('0x4d'));if(_0x38b8bf['role']===_0xb1dd('0x4e')){var _0x108a2a=_0x59632b[_0xb1dd('0x28')]({'plain':!![]});var _0x54738b=_0xb1dd('0x29');return db['UserProfileSection'][_0xb1dd('0x4b')]({'where':{'name':_0x54738b,'userProfileId':_0x38b8bf['userProfileId']},'raw':!![]})[_0xb1dd('0x26')](function(_0x4398c0){if(_0x4398c0&&_0x4398c0[_0xb1dd('0x51')]===0x0){return db[_0xb1dd('0x2a')][_0xb1dd('0x4c')]({'name':_0x108a2a[_0xb1dd('0x2d')],'resourceId':_0x108a2a['id'],'type':_0x4398c0['name'],'sectionId':_0x4398c0['id']},{})[_0xb1dd('0x26')](function(){return _0x59632b;});}else{return _0x59632b;}})[_0xb1dd('0x48')](function(_0x545c7e){logger[_0xb1dd('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x545c7e);throw _0x545c7e;});}return _0x59632b;});}})['then'](respondWithResult(_0x187212,0xc9))['catch'](handleError(_0x187212,null));};exports[_0xb1dd('0x25')]=function(_0x56c359,_0x2b99b3){if(_0x56c359[_0xb1dd('0x55')]['id']){delete _0x56c359[_0xb1dd('0x55')]['id'];}return db[_0xb1dd('0x45')][_0xb1dd('0x4b')]({'where':{'id':_0x56c359[_0xb1dd('0x49')]['id']}})['then'](handleEntityNotFound(_0x2b99b3,null))[_0xb1dd('0x26')](saveUpdates(_0x56c359[_0xb1dd('0x55')],null))[_0xb1dd('0x26')](respondWithResult(_0x2b99b3,null))[_0xb1dd('0x48')](handleError(_0x2b99b3,null));};exports[_0xb1dd('0x27')]=function(_0xb3dc2f,_0x232995){return db[_0xb1dd('0x45')][_0xb1dd('0x4b')]({'where':{'id':_0xb3dc2f['params']['id']}})[_0xb1dd('0x26')](handleEntityNotFound(_0x232995,null))[_0xb1dd('0x26')](removeEntity(_0x232995,null))['catch'](handleError(_0x232995,null));};exports[_0xb1dd('0x57')]=function(_0x139053,_0x435a5f,_0x29a646){var _0x24d13a={'raw':!![],'where':{}};var _0x260eae={};var _0x3bd6c5={'count':0x0,'rows':[]};return db['Campaign'][_0xb1dd('0x58')]({'where':{'id':_0x139053[_0xb1dd('0x49')]['id']}})['then'](handleEntityNotFound(_0x435a5f,null))[_0xb1dd('0x26')](function(_0x1a9c29){if(_0x1a9c29){_0x260eae['model']=_[_0xb1dd('0x35')](db[_0xb1dd('0x59')]['rawAttributes']);_0x260eae['query']=_[_0xb1dd('0x35')](_0x139053[_0xb1dd('0x34')]);_0x260eae[_0xb1dd('0x36')]=_[_0xb1dd('0x38')](_0x260eae['model'],_0x260eae[_0xb1dd('0x34')]);_0x24d13a[_0xb1dd('0x37')]=_['intersection'](_0x260eae['model'],qs[_0xb1dd('0x39')](_0x139053['query'][_0xb1dd('0x39')]));_0x24d13a[_0xb1dd('0x37')]=_0x24d13a[_0xb1dd('0x37')][_0xb1dd('0x3a')]?_0x24d13a[_0xb1dd('0x37')]:_0x260eae[_0xb1dd('0x33')];if(!_0x139053[_0xb1dd('0x34')][_0xb1dd('0x3b')](_0xb1dd('0x3c'))){_0x24d13a[_0xb1dd('0x21')]=qs[_0xb1dd('0x21')](_0x139053[_0xb1dd('0x34')][_0xb1dd('0x21')]);_0x24d13a[_0xb1dd('0x1e')]=qs[_0xb1dd('0x1e')](_0x139053[_0xb1dd('0x34')][_0xb1dd('0x1e')]);}_0x24d13a['order']=qs[_0xb1dd('0x5a')](_0x139053[_0xb1dd('0x34')][_0xb1dd('0x5a')]);_0x24d13a[_0xb1dd('0x3e')]=qs[_0xb1dd('0x36')](_['pick'](_0x139053['query'],_0x260eae[_0xb1dd('0x36')]));_0x24d13a[_0xb1dd('0x3e')]['CampaignId']=_0x1a9c29['id'];if(_0x139053[_0xb1dd('0x34')][_0xb1dd('0x40')]){_0x24d13a[_0xb1dd('0x3e')]=_[_0xb1dd('0x42')](_0x24d13a[_0xb1dd('0x3e')],{'$or':_[_0xb1dd('0x2f')](_0x24d13a[_0xb1dd('0x37')],function(_0x3393af){var _0x5e4276={};_0x5e4276[_0x3393af]={'$like':'%'+_0x139053[_0xb1dd('0x34')][_0xb1dd('0x40')]+'%'};return _0x5e4276;})});}_0x24d13a=_[_0xb1dd('0x42')]({},_0x24d13a,_0x139053[_0xb1dd('0x4a')]);return db[_0xb1dd('0x59')][_0xb1dd('0x20')]({'where':_0x24d13a[_0xb1dd('0x3e')]})['then'](function(_0x2ad53d){_0x3bd6c5['count']=_0x2ad53d;if(_0x139053[_0xb1dd('0x34')][_0xb1dd('0x43')]){_0x24d13a[_0xb1dd('0x44')]=[{'all':!![]}];}return db[_0xb1dd('0x59')][_0xb1dd('0x46')](_0x24d13a);})[_0xb1dd('0x26')](function(_0xfb64c6){_0x3bd6c5[_0xb1dd('0x47')]=_0xfb64c6;return _0x3bd6c5;});}})[_0xb1dd('0x26')](respondWithFilteredResult(_0x435a5f,_0x24d13a))[_0xb1dd('0x48')](handleError(_0x435a5f,null));};exports['getHopperHistories']=function(_0x12498d,_0x4920d3,_0x47c205){var _0x28145c={'raw':!![],'where':{}};var _0xa5145b={};var _0x139bdf={'count':0x0,'rows':[]};return db['Campaign'][_0xb1dd('0x58')]({'where':{'id':_0x12498d[_0xb1dd('0x49')]['id']}})[_0xb1dd('0x26')](handleEntityNotFound(_0x4920d3,null))['then'](function(_0x402018){if(_0x402018){_0xa5145b['model']=_[_0xb1dd('0x35')](db[_0xb1dd('0x5b')][_0xb1dd('0x30')]);_0xa5145b[_0xb1dd('0x34')]=_[_0xb1dd('0x35')](_0x12498d[_0xb1dd('0x34')]);_0xa5145b[_0xb1dd('0x36')]=_['intersection'](_0xa5145b[_0xb1dd('0x33')],_0xa5145b['query']);_0x28145c[_0xb1dd('0x37')]=_[_0xb1dd('0x38')](_0xa5145b['model'],qs['fields'](_0x12498d[_0xb1dd('0x34')][_0xb1dd('0x39')]));_0x28145c[_0xb1dd('0x37')]=_0x28145c[_0xb1dd('0x37')][_0xb1dd('0x3a')]?_0x28145c[_0xb1dd('0x37')]:_0xa5145b[_0xb1dd('0x33')];if(!_0x12498d[_0xb1dd('0x34')][_0xb1dd('0x3b')](_0xb1dd('0x3c'))){_0x28145c[_0xb1dd('0x21')]=qs['limit'](_0x12498d[_0xb1dd('0x34')]['limit']);_0x28145c[_0xb1dd('0x1e')]=qs[_0xb1dd('0x1e')](_0x12498d[_0xb1dd('0x34')][_0xb1dd('0x1e')]);}_0x28145c[_0xb1dd('0x3d')]=qs[_0xb1dd('0x5a')](_0x12498d[_0xb1dd('0x34')][_0xb1dd('0x5a')]);_0x28145c['where']=qs[_0xb1dd('0x36')](_[_0xb1dd('0x3f')](_0x12498d[_0xb1dd('0x34')],_0xa5145b[_0xb1dd('0x36')]));_0x28145c[_0xb1dd('0x3e')]['CampaignId']=_0x402018['id'];if(_0x12498d['query'][_0xb1dd('0x40')]){_0x28145c['where']=_[_0xb1dd('0x42')](_0x28145c[_0xb1dd('0x3e')],{'$or':_[_0xb1dd('0x2f')](_0x28145c[_0xb1dd('0x37')],function(_0x58cf8f){var _0x2e2ad4={};_0x2e2ad4[_0x58cf8f]={'$like':'%'+_0x12498d[_0xb1dd('0x34')][_0xb1dd('0x40')]+'%'};return _0x2e2ad4;})});}_0x28145c=_[_0xb1dd('0x42')]({},_0x28145c,_0x12498d[_0xb1dd('0x4a')]);return db['CmHopperHistory'][_0xb1dd('0x20')]({'where':_0x28145c[_0xb1dd('0x3e')]})[_0xb1dd('0x26')](function(_0x451e78){_0x139bdf['count']=_0x451e78;if(_0x12498d[_0xb1dd('0x34')][_0xb1dd('0x43')]){_0x28145c[_0xb1dd('0x44')]=[{'all':!![]}];}return db[_0xb1dd('0x5b')][_0xb1dd('0x46')](_0x28145c);})[_0xb1dd('0x26')](function(_0x3d7c81){_0x139bdf[_0xb1dd('0x47')]=_0x3d7c81;return _0x139bdf;});}})[_0xb1dd('0x26')](respondWithFilteredResult(_0x4920d3,_0x28145c))['catch'](handleError(_0x4920d3,null));};exports[_0xb1dd('0x5c')]=function(_0x39c217,_0x4e3f86,_0x5c1779){var _0x40a27c={'raw':!![],'where':{}};var _0x100c7c={};var _0x735b3a={'count':0x0,'rows':[]};return db[_0xb1dd('0x45')][_0xb1dd('0x58')]({'where':{'id':_0x39c217[_0xb1dd('0x49')]['id']}})['then'](handleEntityNotFound(_0x4e3f86,null))[_0xb1dd('0x26')](function(_0x113b28){if(_0x113b28){_0x100c7c[_0xb1dd('0x33')]=_['keys'](db['CmHopperFinal'][_0xb1dd('0x30')]);_0x100c7c[_0xb1dd('0x34')]=_[_0xb1dd('0x35')](_0x39c217[_0xb1dd('0x34')]);_0x100c7c[_0xb1dd('0x36')]=_['intersection'](_0x100c7c[_0xb1dd('0x33')],_0x100c7c[_0xb1dd('0x34')]);_0x40a27c[_0xb1dd('0x37')]=_[_0xb1dd('0x38')](_0x100c7c['model'],qs[_0xb1dd('0x39')](_0x39c217[_0xb1dd('0x34')]['fields']));_0x40a27c['attributes']=_0x40a27c[_0xb1dd('0x37')]['length']?_0x40a27c['attributes']:_0x100c7c[_0xb1dd('0x33')];if(!_0x39c217[_0xb1dd('0x34')][_0xb1dd('0x3b')](_0xb1dd('0x3c'))){_0x40a27c[_0xb1dd('0x21')]=qs[_0xb1dd('0x21')](_0x39c217['query']['limit']);_0x40a27c[_0xb1dd('0x1e')]=qs[_0xb1dd('0x1e')](_0x39c217[_0xb1dd('0x34')][_0xb1dd('0x1e')]);}_0x40a27c[_0xb1dd('0x3d')]=qs[_0xb1dd('0x5a')](_0x39c217[_0xb1dd('0x34')][_0xb1dd('0x5a')]);_0x40a27c[_0xb1dd('0x3e')]=qs['filters'](_[_0xb1dd('0x3f')](_0x39c217[_0xb1dd('0x34')],_0x100c7c[_0xb1dd('0x36')]));_0x40a27c[_0xb1dd('0x3e')][_0xb1dd('0x5d')]=_0x113b28['id'];if(_0x39c217['query'][_0xb1dd('0x40')]){_0x40a27c[_0xb1dd('0x3e')]=_[_0xb1dd('0x42')](_0x40a27c[_0xb1dd('0x3e')],{'$or':_[_0xb1dd('0x2f')](_0x40a27c['attributes'],function(_0x2e7526){var _0x2d338b={};_0x2d338b[_0x2e7526]={'$like':'%'+_0x39c217['query'][_0xb1dd('0x40')]+'%'};return _0x2d338b;})});}_0x40a27c=_[_0xb1dd('0x42')]({},_0x40a27c,_0x39c217[_0xb1dd('0x4a')]);return db[_0xb1dd('0x5e')][_0xb1dd('0x20')]({'where':_0x40a27c[_0xb1dd('0x3e')]})[_0xb1dd('0x26')](function(_0x537607){_0x735b3a[_0xb1dd('0x20')]=_0x537607;if(_0x39c217[_0xb1dd('0x34')][_0xb1dd('0x43')]){_0x40a27c[_0xb1dd('0x44')]=[{'all':!![]}];}return db[_0xb1dd('0x5e')][_0xb1dd('0x46')](_0x40a27c);})[_0xb1dd('0x26')](function(_0x2de67f){_0x735b3a[_0xb1dd('0x47')]=_0x2de67f;return _0x735b3a;});}})[_0xb1dd('0x26')](respondWithFilteredResult(_0x4e3f86,_0x40a27c))[_0xb1dd('0x48')](handleError(_0x4e3f86,null));};exports[_0xb1dd('0x5f')]=function(_0x565bc8,_0x30da06,_0x48fb38){var _0x4881b9={'raw':!![],'where':{}};var _0x4a00e0={};var _0x865ab2={'count':0x0,'rows':[]};return db['Campaign'][_0xb1dd('0x58')]({'where':{'id':_0x565bc8[_0xb1dd('0x49')]['id']}})[_0xb1dd('0x26')](handleEntityNotFound(_0x30da06,null))['then'](function(_0x51561d){if(_0x51561d){_0x4a00e0['model']=_[_0xb1dd('0x35')](db['CmHopperBlack'][_0xb1dd('0x30')]);_0x4a00e0['query']=_[_0xb1dd('0x35')](_0x565bc8[_0xb1dd('0x34')]);_0x4a00e0[_0xb1dd('0x36')]=_[_0xb1dd('0x38')](_0x4a00e0[_0xb1dd('0x33')],_0x4a00e0['query']);_0x4881b9['attributes']=_[_0xb1dd('0x38')](_0x4a00e0[_0xb1dd('0x33')],qs['fields'](_0x565bc8[_0xb1dd('0x34')][_0xb1dd('0x39')]));_0x4881b9[_0xb1dd('0x37')]=_0x4881b9['attributes']['length']?_0x4881b9[_0xb1dd('0x37')]:_0x4a00e0['model'];if(!_0x565bc8[_0xb1dd('0x34')][_0xb1dd('0x3b')](_0xb1dd('0x3c'))){_0x4881b9[_0xb1dd('0x21')]=qs[_0xb1dd('0x21')](_0x565bc8[_0xb1dd('0x34')][_0xb1dd('0x21')]);_0x4881b9[_0xb1dd('0x1e')]=qs[_0xb1dd('0x1e')](_0x565bc8[_0xb1dd('0x34')][_0xb1dd('0x1e')]);}_0x4881b9['order']=qs['sort'](_0x565bc8['query']['sort']);_0x4881b9[_0xb1dd('0x3e')]=qs[_0xb1dd('0x36')](_[_0xb1dd('0x3f')](_0x565bc8['query'],_0x4a00e0[_0xb1dd('0x36')]));_0x4881b9['where'][_0xb1dd('0x5d')]=_0x51561d['id'];if(_0x565bc8[_0xb1dd('0x34')][_0xb1dd('0x40')]){_0x4881b9['where']=_[_0xb1dd('0x42')](_0x4881b9[_0xb1dd('0x3e')],{'$or':_[_0xb1dd('0x2f')](_0x4881b9['attributes'],function(_0x11cb93){var _0x3d672a={};_0x3d672a[_0x11cb93]={'$like':'%'+_0x565bc8[_0xb1dd('0x34')][_0xb1dd('0x40')]+'%'};return _0x3d672a;})});}_0x4881b9=_[_0xb1dd('0x42')]({},_0x4881b9,_0x565bc8[_0xb1dd('0x4a')]);return db[_0xb1dd('0x60')][_0xb1dd('0x20')]({'where':_0x4881b9[_0xb1dd('0x3e')]})[_0xb1dd('0x26')](function(_0x1d8969){_0x865ab2[_0xb1dd('0x20')]=_0x1d8969;if(_0x565bc8[_0xb1dd('0x34')][_0xb1dd('0x43')]){_0x4881b9[_0xb1dd('0x44')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xb1dd('0x46')](_0x4881b9);})[_0xb1dd('0x26')](function(_0x9812ec){_0x865ab2[_0xb1dd('0x47')]=_0x9812ec;return _0x865ab2;});}})[_0xb1dd('0x26')](respondWithFilteredResult(_0x30da06,_0x4881b9))['catch'](handleError(_0x30da06,null));};exports[_0xb1dd('0x61')]=function(_0x452906,_0x49b560,_0x5d8398){var _0x130647={};var _0x552599={};var _0x225fbc;var _0x4a9ee1;return db[_0xb1dd('0x45')]['findOne']({'where':{'id':_0x452906[_0xb1dd('0x49')]['id']}})[_0xb1dd('0x26')](handleEntityNotFound(_0x49b560,null))[_0xb1dd('0x26')](function(_0x1d03ba){if(_0x1d03ba){_0x225fbc=_0x1d03ba;_0x552599[_0xb1dd('0x33')]=_[_0xb1dd('0x35')](db[_0xb1dd('0x62')][_0xb1dd('0x30')]);_0x552599[_0xb1dd('0x34')]=_[_0xb1dd('0x35')](_0x452906[_0xb1dd('0x34')]);_0x552599[_0xb1dd('0x36')]=_[_0xb1dd('0x38')](_0x552599['model'],_0x552599[_0xb1dd('0x34')]);_0x130647[_0xb1dd('0x37')]=_[_0xb1dd('0x38')](_0x552599[_0xb1dd('0x33')],qs[_0xb1dd('0x39')](_0x452906[_0xb1dd('0x34')][_0xb1dd('0x39')]));_0x130647[_0xb1dd('0x37')]=_0x130647[_0xb1dd('0x37')][_0xb1dd('0x3a')]?_0x130647[_0xb1dd('0x37')]:_0x552599[_0xb1dd('0x33')];_0x130647[_0xb1dd('0x3d')]=qs['sort'](_0x452906['query'][_0xb1dd('0x5a')]);_0x130647[_0xb1dd('0x3e')]=qs[_0xb1dd('0x36')](_[_0xb1dd('0x3f')](_0x452906['query'],_0x552599['filters']));if(_0x452906[_0xb1dd('0x34')]['filter']){_0x130647[_0xb1dd('0x3e')]=_[_0xb1dd('0x42')](_0x130647[_0xb1dd('0x3e')],{'$or':_[_0xb1dd('0x2f')](_0x130647[_0xb1dd('0x37')],function(_0x296f14){var _0x1519c0={};_0x1519c0[_0x296f14]={'$like':'%'+_0x452906[_0xb1dd('0x34')][_0xb1dd('0x40')]+'%'};return _0x1519c0;})});}_0x130647=_[_0xb1dd('0x42')]({},_0x130647,_0x452906['options']);return _0x225fbc[_0xb1dd('0x61')](_0x130647);}})[_0xb1dd('0x26')](function(_0x4be8b3){if(_0x4be8b3){_0x4a9ee1=_0x4be8b3[_0xb1dd('0x3a')];if(!_0x452906[_0xb1dd('0x34')][_0xb1dd('0x3b')](_0xb1dd('0x3c'))){_0x130647['limit']=qs[_0xb1dd('0x21')](_0x452906[_0xb1dd('0x34')][_0xb1dd('0x21')]);_0x130647[_0xb1dd('0x1e')]=qs['offset'](_0x452906[_0xb1dd('0x34')][_0xb1dd('0x1e')]);}return _0x225fbc['getLists'](_0x130647);}})[_0xb1dd('0x26')](function(_0x1e8c80){if(_0x1e8c80){return _0x1e8c80?{'count':_0x4a9ee1,'rows':_0x1e8c80}:null;}})[_0xb1dd('0x26')](respondWithResult(_0x49b560,null))[_0xb1dd('0x48')](handleError(_0x49b560,null));};exports[_0xb1dd('0x63')]=function(_0x46f718,_0x27237e,_0x2c639a){var _0x5ba3af,_0x3f24cf;return db[_0xb1dd('0x45')][_0xb1dd('0x4b')]({'where':{'id':_0x46f718[_0xb1dd('0x49')]['id']}})[_0xb1dd('0x26')](handleEntityNotFound(_0x27237e,null))[_0xb1dd('0x26')](function(_0x13be2b){if(_0x13be2b){_0x3f24cf=_0x13be2b;return _0x13be2b[_0xb1dd('0x63')](_0x46f718['body'][_0xb1dd('0x64')],_['omit'](_0x46f718['body'],['ids','id'])||{});}return null;})[_0xb1dd('0x65')](function(_0x4c9824){var _0x333110;_0x5ba3af=_0x4c9824||[];var _0x1fffd2=[];if(_0x4c9824){for(var _0x422a0e=0x0;_0x422a0e<_0x4c9824[_0xb1dd('0x3a')];_0x422a0e+=0x1){var _0x2872af=_0x4c9824[_0x422a0e][_0xb1dd('0x28')]({'plain':!![]});_0x3f24cf[_0xb1dd('0x66')]=_0x46f718[_0xb1dd('0x55')][_0xb1dd('0x66')]?_0x46f718[_0xb1dd('0x55')]['dialCheckDuplicateType']:_0x3f24cf['dialCheckDuplicateType'];switch(_0x3f24cf[_0xb1dd('0x66')]){case _0xb1dd('0x67'):_0x333110=squel[_0xb1dd('0x68')]()[_0xb1dd('0x69')](_0xb1dd('0x6a'))[_0xb1dd('0x6b')]([_0xb1dd('0x6c'),_0xb1dd('0x6d'),_0xb1dd('0x6e'),_0xb1dd('0x6f'),_0xb1dd('0x5d'),_0xb1dd('0x56'),_0xb1dd('0x70')],squel[_0xb1dd('0x71')]()[_0xb1dd('0x72')]('phone',_0xb1dd('0x6c'))[_0xb1dd('0x72')](_0xb1dd('0x73'),_0xb1dd('0x6d'))['field']('id',_0xb1dd('0x6e'))[_0xb1dd('0x72')](_0x2872af['CmListId']['toString'](),'ListId')['field'](_0x46f718['params']['id']['toString'](),_0xb1dd('0x5d'))[_0xb1dd('0x72')]('NOW()',_0xb1dd('0x56'))[_0xb1dd('0x72')](_0xb1dd('0x73'),_0xb1dd('0x70'))['from'](_0xb1dd('0x74'))[_0xb1dd('0x3e')]('deletedAt\x20IS\x20NULL')[_0xb1dd('0x3e')]('ListId\x20=\x20?',_0x2872af[_0xb1dd('0x75')]['toString']())[_0xb1dd('0x3e')]('phone\x20IS\x20NOT\x20NULL')[_0xb1dd('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xb1dd('0x72')](_0xb1dd('0x76'))[_0xb1dd('0x77')]('cm_hopper_final')['where'](_0xb1dd('0x78'),_0x46f718['params']['id'][_0xb1dd('0x79')]()))['where'](_0xb1dd('0x7a'),squel[_0xb1dd('0x71')]()[_0xb1dd('0x72')](_0xb1dd('0x7b'))[_0xb1dd('0x77')](_0xb1dd('0x6a'))[_0xb1dd('0x3e')](_0xb1dd('0x78'),_0x46f718[_0xb1dd('0x49')]['id'][_0xb1dd('0x79')]())))[_0xb1dd('0x79')]();break;case _0xb1dd('0x7c'):_0x333110=squel[_0xb1dd('0x68')]()[_0xb1dd('0x69')](_0xb1dd('0x6a'))[_0xb1dd('0x6b')]([_0xb1dd('0x6c'),_0xb1dd('0x6d'),_0xb1dd('0x6e'),'ListId','CampaignId',_0xb1dd('0x56'),'updatedAt'],squel[_0xb1dd('0x71')]()[_0xb1dd('0x72')](_0xb1dd('0x6c'),_0xb1dd('0x6c'))[_0xb1dd('0x72')](_0xb1dd('0x73'),_0xb1dd('0x6d'))['field']('id',_0xb1dd('0x6e'))['field'](_0x2872af['CmListId'][_0xb1dd('0x79')](),'ListId')[_0xb1dd('0x72')](_0x46f718['params']['id'][_0xb1dd('0x79')](),_0xb1dd('0x5d'))[_0xb1dd('0x72')](_0xb1dd('0x73'),_0xb1dd('0x56'))[_0xb1dd('0x72')](_0xb1dd('0x73'),_0xb1dd('0x70'))['from'](_0xb1dd('0x74'))[_0xb1dd('0x3e')]('deletedAt\x20IS\x20NULL')[_0xb1dd('0x3e')](_0xb1dd('0x7d'),_0x2872af[_0xb1dd('0x75')][_0xb1dd('0x79')]())[_0xb1dd('0x3e')](_0xb1dd('0x7e'))[_0xb1dd('0x3e')](_0xb1dd('0x7a'),squel[_0xb1dd('0x71')]()[_0xb1dd('0x72')]('COALESCE(phone,\x27\x27)')[_0xb1dd('0x77')](_0xb1dd('0x6a'))['where'](_0xb1dd('0x78'),_0x46f718[_0xb1dd('0x49')]['id'][_0xb1dd('0x79')]())))[_0xb1dd('0x79')]();break;default:_0x333110=squel[_0xb1dd('0x68')]()[_0xb1dd('0x69')]('cm_hopper')[_0xb1dd('0x6b')](['phone',_0xb1dd('0x6d'),_0xb1dd('0x6e'),_0xb1dd('0x6f'),'CampaignId',_0xb1dd('0x56'),_0xb1dd('0x70')],squel[_0xb1dd('0x71')]()[_0xb1dd('0x72')](_0xb1dd('0x6c'),_0xb1dd('0x6c'))[_0xb1dd('0x72')](_0xb1dd('0x73'),_0xb1dd('0x6d'))[_0xb1dd('0x72')]('id',_0xb1dd('0x6e'))[_0xb1dd('0x72')](_0x2872af[_0xb1dd('0x75')]['toString'](),'ListId')['field'](_0x46f718[_0xb1dd('0x49')]['id'][_0xb1dd('0x79')](),'CampaignId')[_0xb1dd('0x72')](_0xb1dd('0x73'),_0xb1dd('0x56'))[_0xb1dd('0x72')](_0xb1dd('0x73'),_0xb1dd('0x70'))['from'](_0xb1dd('0x74'))[_0xb1dd('0x3e')]('deletedAt\x20IS\x20NULL')[_0xb1dd('0x3e')](_0xb1dd('0x7d'),_0x2872af[_0xb1dd('0x75')][_0xb1dd('0x79')]())[_0xb1dd('0x3e')]('phone\x20IS\x20NOT\x20NULL'))[_0xb1dd('0x79')]();}_0x1fffd2['push'](db[_0xb1dd('0x7f')][_0xb1dd('0x34')](_0x333110));}return BPromise[_0xb1dd('0x80')](_0x1fffd2);}})[_0xb1dd('0x26')](function(){return _0x5ba3af;})['then'](respondWithResult(_0x27237e,null))[_0xb1dd('0x48')](handleError(_0x27237e,null));};exports[_0xb1dd('0x81')]=function(_0x7f6a4e,_0x32d5ec,_0x570376){return db[_0xb1dd('0x45')]['find']({'where':{'id':_0x7f6a4e[_0xb1dd('0x49')]['id']}})[_0xb1dd('0x26')](handleEntityNotFound(_0x32d5ec,null))[_0xb1dd('0x26')](function(_0xc797fb){if(_0xc797fb){return _0xc797fb[_0xb1dd('0x81')](_0x7f6a4e['query'][_0xb1dd('0x64')]);}})[_0xb1dd('0x26')](function(_0x5255f8){if(_0x5255f8){return db[_0xb1dd('0x59')][_0xb1dd('0x27')]({'where':{'ListId':_0x7f6a4e[_0xb1dd('0x34')][_0xb1dd('0x64')],'CampaignId':_0x7f6a4e[_0xb1dd('0x49')]['id']}})[_0xb1dd('0x26')](function(){return _0x5255f8;});}})[_0xb1dd('0x26')](respondWithStatusCode(_0x32d5ec,null))[_0xb1dd('0x48')](handleError(_0x32d5ec,null));};exports[_0xb1dd('0x82')]=function(_0x5a7144,_0x767f4e,_0x20bb81){var _0x56f41c={};var _0x4de39f={};var _0xbb707;var _0x156e6c;return db[_0xb1dd('0x45')][_0xb1dd('0x58')]({'where':{'id':_0x5a7144['params']['id']}})['then'](handleEntityNotFound(_0x767f4e,null))[_0xb1dd('0x26')](function(_0x53b971){if(_0x53b971){_0xbb707=_0x53b971;_0x4de39f[_0xb1dd('0x33')]=_[_0xb1dd('0x35')](db[_0xb1dd('0x62')][_0xb1dd('0x30')]);_0x4de39f['query']=_[_0xb1dd('0x35')](_0x5a7144[_0xb1dd('0x34')]);_0x4de39f['filters']=_[_0xb1dd('0x38')](_0x4de39f[_0xb1dd('0x33')],_0x4de39f['query']);_0x56f41c[_0xb1dd('0x37')]=_['intersection'](_0x4de39f[_0xb1dd('0x33')],qs[_0xb1dd('0x39')](_0x5a7144['query'][_0xb1dd('0x39')]));_0x56f41c[_0xb1dd('0x37')]=_0x56f41c['attributes'][_0xb1dd('0x3a')]?_0x56f41c[_0xb1dd('0x37')]:_0x4de39f[_0xb1dd('0x33')];_0x56f41c[_0xb1dd('0x3d')]=qs[_0xb1dd('0x5a')](_0x5a7144['query'][_0xb1dd('0x5a')]);_0x56f41c[_0xb1dd('0x3e')]=qs[_0xb1dd('0x36')](_[_0xb1dd('0x3f')](_0x5a7144[_0xb1dd('0x34')],_0x4de39f[_0xb1dd('0x36')]));if(_0x5a7144['query'][_0xb1dd('0x40')]){_0x56f41c[_0xb1dd('0x3e')]=_[_0xb1dd('0x42')](_0x56f41c[_0xb1dd('0x3e')],{'$or':_['map'](_0x56f41c[_0xb1dd('0x37')],function(_0x1f5f31){var _0x5c78fe={};_0x5c78fe[_0x1f5f31]={'$like':'%'+_0x5a7144[_0xb1dd('0x34')][_0xb1dd('0x40')]+'%'};return _0x5c78fe;})});}_0x56f41c=_[_0xb1dd('0x42')]({},_0x56f41c,_0x5a7144[_0xb1dd('0x4a')]);return _0xbb707['getBlackLists'](_0x56f41c);}})[_0xb1dd('0x26')](function(_0x3c0235){if(_0x3c0235){_0x156e6c=_0x3c0235[_0xb1dd('0x3a')];if(!_0x5a7144['query'][_0xb1dd('0x3b')]('nolimit')){_0x56f41c[_0xb1dd('0x21')]=qs['limit'](_0x5a7144[_0xb1dd('0x34')][_0xb1dd('0x21')]);_0x56f41c[_0xb1dd('0x1e')]=qs['offset'](_0x5a7144['query']['offset']);}return _0xbb707['getBlackLists'](_0x56f41c);}})['then'](function(_0x1c4e86){if(_0x1c4e86){return _0x1c4e86?{'count':_0x156e6c,'rows':_0x1c4e86}:null;}})['then'](respondWithResult(_0x767f4e,null))[_0xb1dd('0x48')](handleError(_0x767f4e,null));};exports[_0xb1dd('0x83')]=function(_0x30badf,_0x31337b,_0x565abf){var _0x10ea7f,_0x53b49c;return db[_0xb1dd('0x45')][_0xb1dd('0x4b')]({'where':{'id':_0x30badf[_0xb1dd('0x49')]['id']}})[_0xb1dd('0x26')](handleEntityNotFound(_0x31337b,null))[_0xb1dd('0x26')](function(_0xdccf6){if(_0xdccf6){_0x53b49c=_0xdccf6;return _0xdccf6[_0xb1dd('0x83')](_0x30badf[_0xb1dd('0x55')]['ids'],_[_0xb1dd('0x84')](_0x30badf[_0xb1dd('0x55')],['ids','id'])||{});}return null;})[_0xb1dd('0x65')](function(_0xf90113){var _0x1ef11e;_0x10ea7f=_0xf90113||[];var _0x213c05=[];if(_0xf90113){for(var _0x322861=0x0;_0x322861<_0xf90113[_0xb1dd('0x3a')];_0x322861+=0x1){var _0x286a58=_0xf90113[_0x322861][_0xb1dd('0x28')]({'plain':!![]});_0x1ef11e=squel['insert']()['into'](_0xb1dd('0x85'))[_0xb1dd('0x6b')]([_0xb1dd('0x6c'),_0xb1dd('0x6e'),'ListId','CampaignId',_0xb1dd('0x56'),'updatedAt'],squel[_0xb1dd('0x71')]()[_0xb1dd('0x72')](_0xb1dd('0x6c'),_0xb1dd('0x6c'))[_0xb1dd('0x72')]('id',_0xb1dd('0x6e'))[_0xb1dd('0x72')](_0x286a58[_0xb1dd('0x75')]['toString'](),_0xb1dd('0x6f'))[_0xb1dd('0x72')](_0x30badf['params']['id'][_0xb1dd('0x79')](),_0xb1dd('0x5d'))[_0xb1dd('0x72')]('NOW()',_0xb1dd('0x56'))['field'](_0xb1dd('0x73'),_0xb1dd('0x70'))['from'](_0xb1dd('0x74'))[_0xb1dd('0x3e')](_0xb1dd('0x86'))[_0xb1dd('0x3e')](_0xb1dd('0x7d'),_0x286a58[_0xb1dd('0x75')][_0xb1dd('0x79')]())[_0xb1dd('0x3e')](_0xb1dd('0x7e')))[_0xb1dd('0x79')]();_0x213c05[_0xb1dd('0x87')](db[_0xb1dd('0x7f')][_0xb1dd('0x34')](_0x1ef11e));}return BPromise[_0xb1dd('0x80')](_0x213c05);}})['then'](function(){return _0x10ea7f;})[_0xb1dd('0x26')](respondWithResult(_0x31337b,null))['catch'](handleError(_0x31337b,null));};exports[_0xb1dd('0x88')]=function(_0x3eb1b4,_0x369ab0,_0x336f0d){return db[_0xb1dd('0x45')]['find']({'where':{'id':_0x3eb1b4[_0xb1dd('0x49')]['id']}})[_0xb1dd('0x26')](handleEntityNotFound(_0x369ab0,null))[_0xb1dd('0x26')](function(_0x418cd5){if(_0x418cd5){return _0x418cd5[_0xb1dd('0x88')](_0x3eb1b4[_0xb1dd('0x34')][_0xb1dd('0x64')]);}})[_0xb1dd('0x26')](function(_0x19298d){if(_0x19298d){return db['CmHopperBlack'][_0xb1dd('0x27')]({'where':{'ListId':_0x3eb1b4['query'][_0xb1dd('0x64')],'CampaignId':_0x3eb1b4[_0xb1dd('0x49')]['id']}})['then'](function(){return _0x19298d;});}})['then'](respondWithStatusCode(_0x369ab0,null))['catch'](handleError(_0x369ab0,null));}; \ No newline at end of file +var _0x26be=['NOW()','field','CmListId','toString','ListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','fromQuery','push','all','removeLists','getBlackLists','addBlackLists','sequelize','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','error','name','send','Campaign','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','findAll','catch','show','params','includeAll','include','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','updatedAt','body','omit','createdAt','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','pick','CampaignId','rows','getHopperHistories','CmHopperHistory','CmHopperFinal','CmHopperBlack','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ContactId','select'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x26be,0x9d));var _0xe26b=function(_0x183984,_0xc9db77){_0x183984=_0x183984-0x0;var _0x54152d=_0x26be[_0x183984];return _0x54152d;};'use strict';var emlformat=require(_0xe26b('0x0'));var rimraf=require(_0xe26b('0x1'));var zipdir=require(_0xe26b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe26b('0x3'));var moment=require(_0xe26b('0x4'));var BPromise=require(_0xe26b('0x5'));var Mustache=require(_0xe26b('0x6'));var util=require(_0xe26b('0x7'));var path=require(_0xe26b('0x8'));var sox=require(_0xe26b('0x9'));var csv=require(_0xe26b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe26b('0xb'));var _=require(_0xe26b('0xc'));var squel=require(_0xe26b('0xd'));var crypto=require(_0xe26b('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe26b('0xf'));var Papa=require(_0xe26b('0x10'));var Redis=require(_0xe26b('0x11'));var authService=require(_0xe26b('0x12'));var qs=require(_0xe26b('0x13'));var as=require(_0xe26b('0x14'));var hardwareService=require(_0xe26b('0x15'));var logger=require(_0xe26b('0x16'))('api');var utils=require(_0xe26b('0x17'));var config=require(_0xe26b('0x18'));var licenseUtil=require(_0xe26b('0x19'));var db=require(_0xe26b('0x1a'))['db'];function respondWithStatusCode(_0x537e90,_0x4a55c3){_0x4a55c3=_0x4a55c3||0xcc;return function(_0x4d75f8){if(_0x4d75f8){return _0x537e90[_0xe26b('0x1b')](_0x4a55c3);}return _0x537e90[_0xe26b('0x1c')](_0x4a55c3)[_0xe26b('0x1d')]();};}function respondWithResult(_0x22fa2b,_0x4567d2){_0x4567d2=_0x4567d2||0xc8;return function(_0x278e1b){if(_0x278e1b){return _0x22fa2b['status'](_0x4567d2)[_0xe26b('0x1e')](_0x278e1b);}};}function respondWithFilteredResult(_0x1782f4,_0x5d8ef7){return function(_0x28f4fb){if(_0x28f4fb){var _0x3498cf=typeof _0x5d8ef7[_0xe26b('0x1f')]===_0xe26b('0x20')&&typeof _0x5d8ef7[_0xe26b('0x21')]===_0xe26b('0x20');var _0x5dae00=_0x28f4fb[_0xe26b('0x22')];var _0x4eb50c=_0x3498cf?0x0:_0x5d8ef7['offset'];var _0x2d7989=_0x3498cf?_0x28f4fb[_0xe26b('0x22')]:_0x5d8ef7[_0xe26b('0x1f')]+_0x5d8ef7[_0xe26b('0x21')];var _0x167131;if(_0x2d7989>=_0x5dae00){_0x2d7989=_0x5dae00;_0x167131=0xc8;}else{_0x167131=0xce;}_0x1782f4[_0xe26b('0x1c')](_0x167131);return _0x1782f4[_0xe26b('0x23')]('Content-Range',_0x4eb50c+'-'+_0x2d7989+'/'+_0x5dae00)[_0xe26b('0x1e')](_0x28f4fb);}return null;};}function patchUpdates(_0x12c341){return function(_0x47aba6){try{jsonpatch['apply'](_0x47aba6,_0x12c341,!![]);}catch(_0x5bf79f){return BPromise[_0xe26b('0x24')](_0x5bf79f);}return _0x47aba6[_0xe26b('0x25')]();};}function saveUpdates(_0x312c65,_0x537734){return function(_0x4785f1){if(_0x4785f1){return _0x4785f1[_0xe26b('0x26')](_0x312c65)[_0xe26b('0x27')](function(_0x2ca619){return _0x2ca619;});}return null;};}function removeEntity(_0x509db4,_0x139b12){return function(_0x5012c8){if(_0x5012c8){return _0x5012c8[_0xe26b('0x28')]()[_0xe26b('0x27')](function(){var _0x180a70=_0x5012c8[_0xe26b('0x29')]({'plain':!![]});var _0x78dc3f=_0xe26b('0x2a');return db[_0xe26b('0x2b')][_0xe26b('0x28')]({'where':{'type':_0x78dc3f,'resourceId':_0x180a70['id']}})['then'](function(){return _0x5012c8;});})[_0xe26b('0x27')](function(){_0x509db4['status'](0xcc)[_0xe26b('0x1d')]();});}};}function handleEntityNotFound(_0x3b923a,_0x38078b){return function(_0x4ec4c5){if(!_0x4ec4c5){_0x3b923a[_0xe26b('0x1b')](0x194);}return _0x4ec4c5;};}function handleError(_0x230141,_0x3726c7){_0x3726c7=_0x3726c7||0x1f4;return function(_0x1dcc5b){logger[_0xe26b('0x2c')](_0x1dcc5b['stack']);if(_0x1dcc5b[_0xe26b('0x2d')]){delete _0x1dcc5b[_0xe26b('0x2d')];}_0x230141['status'](_0x3726c7)[_0xe26b('0x2e')](_0x1dcc5b);};}exports['index']=function(_0x49bcfe,_0x33c403){var _0xbaa4f0={},_0x3d96ec={},_0x21b121={'count':0x0,'rows':[]};var _0x4231af=_['map'](db[_0xe26b('0x2f')][_0xe26b('0x30')],function(_0x497b74){return{'name':_0x497b74[_0xe26b('0x31')],'type':_0x497b74[_0xe26b('0x32')][_0xe26b('0x33')]};});_0x3d96ec[_0xe26b('0x34')]=_[_0xe26b('0x35')](_0x4231af,_0xe26b('0x2d'));_0x3d96ec['query']=_[_0xe26b('0x36')](_0x49bcfe[_0xe26b('0x37')]);_0x3d96ec[_0xe26b('0x38')]=_[_0xe26b('0x39')](_0x3d96ec[_0xe26b('0x34')],_0x3d96ec['query']);_0xbaa4f0[_0xe26b('0x3a')]=_['intersection'](_0x3d96ec[_0xe26b('0x34')],qs[_0xe26b('0x3b')](_0x49bcfe[_0xe26b('0x37')][_0xe26b('0x3b')]));_0xbaa4f0[_0xe26b('0x3a')]=_0xbaa4f0[_0xe26b('0x3a')][_0xe26b('0x3c')]?_0xbaa4f0['attributes']:_0x3d96ec[_0xe26b('0x34')];if(!_0x49bcfe[_0xe26b('0x37')][_0xe26b('0x3d')](_0xe26b('0x3e'))){_0xbaa4f0[_0xe26b('0x21')]=qs[_0xe26b('0x21')](_0x49bcfe[_0xe26b('0x37')][_0xe26b('0x21')]);_0xbaa4f0[_0xe26b('0x1f')]=qs['offset'](_0x49bcfe[_0xe26b('0x37')]['offset']);}_0xbaa4f0[_0xe26b('0x3f')]=qs[_0xe26b('0x40')](_0x49bcfe[_0xe26b('0x37')][_0xe26b('0x40')]);_0xbaa4f0[_0xe26b('0x41')]=qs[_0xe26b('0x38')](_['pick'](_0x49bcfe[_0xe26b('0x37')],_0x3d96ec[_0xe26b('0x38')]),_0x4231af);if(_0x49bcfe[_0xe26b('0x37')][_0xe26b('0x42')]){_0xbaa4f0[_0xe26b('0x41')]=_['merge'](_0xbaa4f0[_0xe26b('0x41')],{'$or':_['map'](_0x4231af,function(_0x1901db){if(_0x1901db[_0xe26b('0x32')]!==_0xe26b('0x43')){var _0x29ae4e={};_0x29ae4e[_0x1901db[_0xe26b('0x2d')]]={'$like':'%'+_0x49bcfe['query'][_0xe26b('0x42')]+'%'};return _0x29ae4e;}})});}_0xbaa4f0=_['merge']({},_0xbaa4f0,_0x49bcfe[_0xe26b('0x44')]);var _0x256f80={'where':_0xbaa4f0[_0xe26b('0x41')]};return db[_0xe26b('0x2f')][_0xe26b('0x22')](_0x256f80)['then'](function(_0x292297){_0x21b121[_0xe26b('0x22')]=_0x292297;if(_0x49bcfe[_0xe26b('0x37')]['includeAll']){_0xbaa4f0['include']=[{'all':!![]}];}return db[_0xe26b('0x2f')][_0xe26b('0x45')](_0xbaa4f0);})[_0xe26b('0x27')](function(_0x244bee){_0x21b121['rows']=_0x244bee;return _0x21b121;})['then'](respondWithFilteredResult(_0x33c403,_0xbaa4f0))[_0xe26b('0x46')](handleError(_0x33c403,null));};exports[_0xe26b('0x47')]=function(_0xc2c88c,_0x4f6c4a){var _0x483bbd={'raw':![],'where':{'id':_0xc2c88c[_0xe26b('0x48')]['id']}},_0xf62e70={};_0xf62e70[_0xe26b('0x34')]=_['keys'](db['Campaign'][_0xe26b('0x30')]);_0xf62e70['query']=_[_0xe26b('0x36')](_0xc2c88c[_0xe26b('0x37')]);_0xf62e70[_0xe26b('0x38')]=_[_0xe26b('0x39')](_0xf62e70[_0xe26b('0x34')],_0xf62e70[_0xe26b('0x37')]);_0x483bbd[_0xe26b('0x3a')]=_['intersection'](_0xf62e70['model'],qs[_0xe26b('0x3b')](_0xc2c88c['query']['fields']));_0x483bbd['attributes']=_0x483bbd[_0xe26b('0x3a')]['length']?_0x483bbd[_0xe26b('0x3a')]:_0xf62e70[_0xe26b('0x34')];if(_0xc2c88c[_0xe26b('0x37')][_0xe26b('0x49')]){_0x483bbd[_0xe26b('0x4a')]=[{'all':!![]}];}_0x483bbd=_[_0xe26b('0x4b')]({},_0x483bbd,_0xc2c88c[_0xe26b('0x44')]);return db[_0xe26b('0x2f')][_0xe26b('0x4c')](_0x483bbd)[_0xe26b('0x27')](handleEntityNotFound(_0x4f6c4a,null))['then'](respondWithResult(_0x4f6c4a,null))[_0xe26b('0x46')](handleError(_0x4f6c4a,null));};exports[_0xe26b('0x4d')]=function(_0x4fa389,_0x15ff58){return db[_0xe26b('0x2f')][_0xe26b('0x4d')](_0x4fa389['body'],{})['then'](function(_0xbe00a0){var _0x2632d2=_0x4fa389[_0xe26b('0x4e')]['get']({'plain':!![]});if(!_0x2632d2)throw new Error(_0xe26b('0x4f'));if(_0x2632d2['role']===_0xe26b('0x4e')){var _0x3e8a59=_0xbe00a0['get']({'plain':!![]});var _0x1d5a7a=_0xe26b('0x2a');return db['UserProfileSection'][_0xe26b('0x4c')]({'where':{'name':_0x1d5a7a,'userProfileId':_0x2632d2[_0xe26b('0x50')]},'raw':!![]})[_0xe26b('0x27')](function(_0x3dab5b){if(_0x3dab5b&&_0x3dab5b['autoAssociation']===0x0){return db['UserProfileResource'][_0xe26b('0x4d')]({'name':_0x3e8a59[_0xe26b('0x2d')],'resourceId':_0x3e8a59['id'],'type':_0x3dab5b['name'],'sectionId':_0x3dab5b['id']},{})[_0xe26b('0x27')](function(){return _0xbe00a0;});}else{return _0xbe00a0;}})[_0xe26b('0x46')](function(_0x1deef7){logger[_0xe26b('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1deef7);throw _0x1deef7;});}return _0xbe00a0;})[_0xe26b('0x27')](respondWithResult(_0x15ff58,0xc9))[_0xe26b('0x46')](handleError(_0x15ff58,null));};exports['clone']=function(_0xb70c10,_0x384647){var _0x29d46b={'where':{'id':_0xb70c10['params']['id']}},_0x3fb3a0={};_0x3fb3a0[_0xe26b('0x34')]=_['keys'](db[_0xe26b('0x2f')][_0xe26b('0x30')]);_0x29d46b[_0xe26b('0x3a')]=_[_0xe26b('0x39')](_0x3fb3a0['model'],qs[_0xe26b('0x3b')](_0xb70c10[_0xe26b('0x37')]['fields']));_0x29d46b[_0xe26b('0x3a')]=_0x29d46b[_0xe26b('0x3a')]['length']?_0x29d46b[_0xe26b('0x3a')]:_0x3fb3a0['model'];if(_0xb70c10[_0xe26b('0x37')][_0xe26b('0x49')]){_0x29d46b[_0xe26b('0x4a')]=[{'all':!![]}];}_0x29d46b=_[_0xe26b('0x4b')]({},_0x29d46b,_0xb70c10[_0xe26b('0x44')]);return db[_0xe26b('0x2f')][_0xe26b('0x4c')](_0x29d46b)[_0xe26b('0x27')](handleEntityNotFound(_0x384647,null))['then'](function(_0x4d0e30){if(_0x4d0e30){var _0x501565=_0x4d0e30[_0xe26b('0x29')]({'plain':!![]});_0x501565=qs['omit'](_0x501565,['id','createdAt',_0xe26b('0x51')]);_0xb70c10[_0xe26b('0x52')]=_[_0xe26b('0x53')](_0xb70c10['body'],['id',_0xe26b('0x54'),'updatedAt']);return db[_0xe26b('0x2f')][_0xe26b('0x4d')](_[_0xe26b('0x4b')](_0x501565,_0xb70c10[_0xe26b('0x52')]),{'include':_0xb70c10[_0xe26b('0x37')]['includeAll']?[{'all':!![]}]:undefined})[_0xe26b('0x27')](function(_0x8546f5){var _0x54f259=_0xb70c10[_0xe26b('0x4e')][_0xe26b('0x29')]({'plain':!![]});if(!_0x54f259)throw new Error(_0xe26b('0x4f'));if(_0x54f259['role']===_0xe26b('0x4e')){var _0x4c43c8=_0x8546f5[_0xe26b('0x29')]({'plain':!![]});var _0x5c6d16=_0xe26b('0x2a');return db[_0xe26b('0x55')]['find']({'where':{'name':_0x5c6d16,'userProfileId':_0x54f259[_0xe26b('0x50')]},'raw':!![]})['then'](function(_0x265d76){if(_0x265d76&&_0x265d76[_0xe26b('0x56')]===0x0){return db[_0xe26b('0x2b')]['create']({'name':_0x4c43c8[_0xe26b('0x2d')],'resourceId':_0x4c43c8['id'],'type':_0x265d76[_0xe26b('0x2d')],'sectionId':_0x265d76['id']},{})[_0xe26b('0x27')](function(){return _0x8546f5;});}else{return _0x8546f5;}})['catch'](function(_0x4f9d64){logger['error'](_0xe26b('0x57'),_0x4f9d64);throw _0x4f9d64;});}return _0x8546f5;});}})[_0xe26b('0x27')](respondWithResult(_0x384647,0xc9))['catch'](handleError(_0x384647,null));};exports['update']=function(_0x2ab71a,_0x7e61bd){if(_0x2ab71a[_0xe26b('0x52')]['id']){delete _0x2ab71a['body']['id'];}return db['Campaign'][_0xe26b('0x4c')]({'where':{'id':_0x2ab71a['params']['id']}})[_0xe26b('0x27')](handleEntityNotFound(_0x7e61bd,null))['then'](saveUpdates(_0x2ab71a['body'],null))[_0xe26b('0x27')](respondWithResult(_0x7e61bd,null))['catch'](handleError(_0x7e61bd,null));};exports['destroy']=function(_0x33a504,_0xc8c187){return db['Campaign']['find']({'where':{'id':_0x33a504[_0xe26b('0x48')]['id']}})[_0xe26b('0x27')](handleEntityNotFound(_0xc8c187,null))[_0xe26b('0x27')](removeEntity(_0xc8c187,null))[_0xe26b('0x46')](handleError(_0xc8c187,null));};exports[_0xe26b('0x58')]=function(_0xac7d22,_0x411fde,_0x23fcf2){var _0x37dd45={'raw':!![],'where':{}};var _0xa2392d={};var _0x1e3ebb={'count':0x0,'rows':[]};return db[_0xe26b('0x2f')][_0xe26b('0x59')]({'where':{'id':_0xac7d22[_0xe26b('0x48')]['id']}})[_0xe26b('0x27')](handleEntityNotFound(_0x411fde,null))['then'](function(_0x54b788){if(_0x54b788){_0xa2392d[_0xe26b('0x34')]=_[_0xe26b('0x36')](db[_0xe26b('0x5a')]['rawAttributes']);_0xa2392d[_0xe26b('0x37')]=_[_0xe26b('0x36')](_0xac7d22[_0xe26b('0x37')]);_0xa2392d[_0xe26b('0x38')]=_[_0xe26b('0x39')](_0xa2392d[_0xe26b('0x34')],_0xa2392d[_0xe26b('0x37')]);_0x37dd45[_0xe26b('0x3a')]=_['intersection'](_0xa2392d[_0xe26b('0x34')],qs[_0xe26b('0x3b')](_0xac7d22[_0xe26b('0x37')]['fields']));_0x37dd45[_0xe26b('0x3a')]=_0x37dd45['attributes'][_0xe26b('0x3c')]?_0x37dd45[_0xe26b('0x3a')]:_0xa2392d[_0xe26b('0x34')];if(!_0xac7d22[_0xe26b('0x37')]['hasOwnProperty'](_0xe26b('0x3e'))){_0x37dd45[_0xe26b('0x21')]=qs[_0xe26b('0x21')](_0xac7d22[_0xe26b('0x37')][_0xe26b('0x21')]);_0x37dd45[_0xe26b('0x1f')]=qs[_0xe26b('0x1f')](_0xac7d22[_0xe26b('0x37')][_0xe26b('0x1f')]);}_0x37dd45[_0xe26b('0x3f')]=qs[_0xe26b('0x40')](_0xac7d22['query'][_0xe26b('0x40')]);_0x37dd45['where']=qs[_0xe26b('0x38')](_[_0xe26b('0x5b')](_0xac7d22[_0xe26b('0x37')],_0xa2392d[_0xe26b('0x38')]));_0x37dd45[_0xe26b('0x41')][_0xe26b('0x5c')]=_0x54b788['id'];if(_0xac7d22[_0xe26b('0x37')][_0xe26b('0x42')]){_0x37dd45[_0xe26b('0x41')]=_[_0xe26b('0x4b')](_0x37dd45[_0xe26b('0x41')],{'$or':_['map'](_0x37dd45[_0xe26b('0x3a')],function(_0x10b1c9){var _0xc390d0={};_0xc390d0[_0x10b1c9]={'$like':'%'+_0xac7d22[_0xe26b('0x37')][_0xe26b('0x42')]+'%'};return _0xc390d0;})});}_0x37dd45=_[_0xe26b('0x4b')]({},_0x37dd45,_0xac7d22[_0xe26b('0x44')]);return db[_0xe26b('0x5a')][_0xe26b('0x22')]({'where':_0x37dd45['where']})[_0xe26b('0x27')](function(_0x11c22d){_0x1e3ebb['count']=_0x11c22d;if(_0xac7d22['query']['includeAll']){_0x37dd45[_0xe26b('0x4a')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x37dd45);})['then'](function(_0x37f1ac){_0x1e3ebb[_0xe26b('0x5d')]=_0x37f1ac;return _0x1e3ebb;});}})[_0xe26b('0x27')](respondWithFilteredResult(_0x411fde,_0x37dd45))[_0xe26b('0x46')](handleError(_0x411fde,null));};exports[_0xe26b('0x5e')]=function(_0x510ce3,_0x343ea8,_0x2dcad6){var _0x89b7b2={'raw':!![],'where':{}};var _0x25319b={};var _0x175ee4={'count':0x0,'rows':[]};return db['Campaign'][_0xe26b('0x59')]({'where':{'id':_0x510ce3[_0xe26b('0x48')]['id']}})[_0xe26b('0x27')](handleEntityNotFound(_0x343ea8,null))[_0xe26b('0x27')](function(_0x486b80){if(_0x486b80){_0x25319b[_0xe26b('0x34')]=_[_0xe26b('0x36')](db[_0xe26b('0x5f')][_0xe26b('0x30')]);_0x25319b[_0xe26b('0x37')]=_['keys'](_0x510ce3[_0xe26b('0x37')]);_0x25319b['filters']=_['intersection'](_0x25319b[_0xe26b('0x34')],_0x25319b[_0xe26b('0x37')]);_0x89b7b2[_0xe26b('0x3a')]=_[_0xe26b('0x39')](_0x25319b[_0xe26b('0x34')],qs['fields'](_0x510ce3[_0xe26b('0x37')][_0xe26b('0x3b')]));_0x89b7b2[_0xe26b('0x3a')]=_0x89b7b2[_0xe26b('0x3a')][_0xe26b('0x3c')]?_0x89b7b2[_0xe26b('0x3a')]:_0x25319b[_0xe26b('0x34')];if(!_0x510ce3[_0xe26b('0x37')]['hasOwnProperty']('nolimit')){_0x89b7b2[_0xe26b('0x21')]=qs[_0xe26b('0x21')](_0x510ce3[_0xe26b('0x37')][_0xe26b('0x21')]);_0x89b7b2['offset']=qs[_0xe26b('0x1f')](_0x510ce3[_0xe26b('0x37')][_0xe26b('0x1f')]);}_0x89b7b2[_0xe26b('0x3f')]=qs[_0xe26b('0x40')](_0x510ce3[_0xe26b('0x37')][_0xe26b('0x40')]);_0x89b7b2[_0xe26b('0x41')]=qs['filters'](_['pick'](_0x510ce3[_0xe26b('0x37')],_0x25319b['filters']));_0x89b7b2[_0xe26b('0x41')][_0xe26b('0x5c')]=_0x486b80['id'];if(_0x510ce3[_0xe26b('0x37')][_0xe26b('0x42')]){_0x89b7b2[_0xe26b('0x41')]=_[_0xe26b('0x4b')](_0x89b7b2[_0xe26b('0x41')],{'$or':_['map'](_0x89b7b2[_0xe26b('0x3a')],function(_0x144aa0){var _0x34da63={};_0x34da63[_0x144aa0]={'$like':'%'+_0x510ce3[_0xe26b('0x37')]['filter']+'%'};return _0x34da63;})});}_0x89b7b2=_[_0xe26b('0x4b')]({},_0x89b7b2,_0x510ce3['options']);return db[_0xe26b('0x5f')]['count']({'where':_0x89b7b2[_0xe26b('0x41')]})['then'](function(_0x16e12d){_0x175ee4['count']=_0x16e12d;if(_0x510ce3[_0xe26b('0x37')][_0xe26b('0x49')]){_0x89b7b2['include']=[{'all':!![]}];}return db[_0xe26b('0x5f')]['findAll'](_0x89b7b2);})['then'](function(_0x407d86){_0x175ee4['rows']=_0x407d86;return _0x175ee4;});}})[_0xe26b('0x27')](respondWithFilteredResult(_0x343ea8,_0x89b7b2))['catch'](handleError(_0x343ea8,null));};exports['getHopperFinals']=function(_0x1f3390,_0x10d2e6,_0x31a7b1){var _0x3741fe={'raw':!![],'where':{}};var _0x313ad6={};var _0x34ca73={'count':0x0,'rows':[]};return db[_0xe26b('0x2f')][_0xe26b('0x59')]({'where':{'id':_0x1f3390[_0xe26b('0x48')]['id']}})[_0xe26b('0x27')](handleEntityNotFound(_0x10d2e6,null))[_0xe26b('0x27')](function(_0x30a2ca){if(_0x30a2ca){_0x313ad6[_0xe26b('0x34')]=_['keys'](db[_0xe26b('0x60')]['rawAttributes']);_0x313ad6[_0xe26b('0x37')]=_[_0xe26b('0x36')](_0x1f3390[_0xe26b('0x37')]);_0x313ad6[_0xe26b('0x38')]=_[_0xe26b('0x39')](_0x313ad6[_0xe26b('0x34')],_0x313ad6[_0xe26b('0x37')]);_0x3741fe[_0xe26b('0x3a')]=_[_0xe26b('0x39')](_0x313ad6[_0xe26b('0x34')],qs[_0xe26b('0x3b')](_0x1f3390[_0xe26b('0x37')]['fields']));_0x3741fe[_0xe26b('0x3a')]=_0x3741fe[_0xe26b('0x3a')][_0xe26b('0x3c')]?_0x3741fe['attributes']:_0x313ad6[_0xe26b('0x34')];if(!_0x1f3390[_0xe26b('0x37')][_0xe26b('0x3d')](_0xe26b('0x3e'))){_0x3741fe[_0xe26b('0x21')]=qs[_0xe26b('0x21')](_0x1f3390[_0xe26b('0x37')][_0xe26b('0x21')]);_0x3741fe[_0xe26b('0x1f')]=qs[_0xe26b('0x1f')](_0x1f3390[_0xe26b('0x37')][_0xe26b('0x1f')]);}_0x3741fe[_0xe26b('0x3f')]=qs[_0xe26b('0x40')](_0x1f3390[_0xe26b('0x37')]['sort']);_0x3741fe[_0xe26b('0x41')]=qs[_0xe26b('0x38')](_['pick'](_0x1f3390[_0xe26b('0x37')],_0x313ad6[_0xe26b('0x38')]));_0x3741fe['where'][_0xe26b('0x5c')]=_0x30a2ca['id'];if(_0x1f3390[_0xe26b('0x37')][_0xe26b('0x42')]){_0x3741fe[_0xe26b('0x41')]=_['merge'](_0x3741fe[_0xe26b('0x41')],{'$or':_[_0xe26b('0x35')](_0x3741fe[_0xe26b('0x3a')],function(_0x57b71d){var _0xcfbb5a={};_0xcfbb5a[_0x57b71d]={'$like':'%'+_0x1f3390[_0xe26b('0x37')]['filter']+'%'};return _0xcfbb5a;})});}_0x3741fe=_['merge']({},_0x3741fe,_0x1f3390['options']);return db[_0xe26b('0x60')][_0xe26b('0x22')]({'where':_0x3741fe[_0xe26b('0x41')]})[_0xe26b('0x27')](function(_0xc0bc64){_0x34ca73['count']=_0xc0bc64;if(_0x1f3390[_0xe26b('0x37')][_0xe26b('0x49')]){_0x3741fe['include']=[{'all':!![]}];}return db[_0xe26b('0x60')][_0xe26b('0x45')](_0x3741fe);})[_0xe26b('0x27')](function(_0x4cae09){_0x34ca73[_0xe26b('0x5d')]=_0x4cae09;return _0x34ca73;});}})[_0xe26b('0x27')](respondWithFilteredResult(_0x10d2e6,_0x3741fe))['catch'](handleError(_0x10d2e6,null));};exports['getHopperBlacks']=function(_0x423a18,_0x389783,_0x4805ac){var _0x4510ee={'raw':!![],'where':{}};var _0x121de7={};var _0x158893={'count':0x0,'rows':[]};return db[_0xe26b('0x2f')][_0xe26b('0x59')]({'where':{'id':_0x423a18['params']['id']}})[_0xe26b('0x27')](handleEntityNotFound(_0x389783,null))['then'](function(_0x119f57){if(_0x119f57){_0x121de7[_0xe26b('0x34')]=_[_0xe26b('0x36')](db[_0xe26b('0x61')][_0xe26b('0x30')]);_0x121de7[_0xe26b('0x37')]=_['keys'](_0x423a18[_0xe26b('0x37')]);_0x121de7[_0xe26b('0x38')]=_[_0xe26b('0x39')](_0x121de7[_0xe26b('0x34')],_0x121de7[_0xe26b('0x37')]);_0x4510ee[_0xe26b('0x3a')]=_[_0xe26b('0x39')](_0x121de7['model'],qs[_0xe26b('0x3b')](_0x423a18[_0xe26b('0x37')]['fields']));_0x4510ee[_0xe26b('0x3a')]=_0x4510ee[_0xe26b('0x3a')][_0xe26b('0x3c')]?_0x4510ee['attributes']:_0x121de7[_0xe26b('0x34')];if(!_0x423a18[_0xe26b('0x37')][_0xe26b('0x3d')](_0xe26b('0x3e'))){_0x4510ee[_0xe26b('0x21')]=qs[_0xe26b('0x21')](_0x423a18['query'][_0xe26b('0x21')]);_0x4510ee[_0xe26b('0x1f')]=qs[_0xe26b('0x1f')](_0x423a18[_0xe26b('0x37')][_0xe26b('0x1f')]);}_0x4510ee[_0xe26b('0x3f')]=qs[_0xe26b('0x40')](_0x423a18[_0xe26b('0x37')][_0xe26b('0x40')]);_0x4510ee[_0xe26b('0x41')]=qs[_0xe26b('0x38')](_[_0xe26b('0x5b')](_0x423a18[_0xe26b('0x37')],_0x121de7['filters']));_0x4510ee[_0xe26b('0x41')]['CampaignId']=_0x119f57['id'];if(_0x423a18[_0xe26b('0x37')]['filter']){_0x4510ee[_0xe26b('0x41')]=_[_0xe26b('0x4b')](_0x4510ee['where'],{'$or':_[_0xe26b('0x35')](_0x4510ee[_0xe26b('0x3a')],function(_0x5980e5){var _0x5ad360={};_0x5ad360[_0x5980e5]={'$like':'%'+_0x423a18[_0xe26b('0x37')][_0xe26b('0x42')]+'%'};return _0x5ad360;})});}_0x4510ee=_['merge']({},_0x4510ee,_0x423a18['options']);return db['CmHopperBlack']['count']({'where':_0x4510ee['where']})[_0xe26b('0x27')](function(_0x3e2c43){_0x158893[_0xe26b('0x22')]=_0x3e2c43;if(_0x423a18[_0xe26b('0x37')][_0xe26b('0x49')]){_0x4510ee[_0xe26b('0x4a')]=[{'all':!![]}];}return db[_0xe26b('0x61')][_0xe26b('0x45')](_0x4510ee);})[_0xe26b('0x27')](function(_0x32d1ac){_0x158893[_0xe26b('0x5d')]=_0x32d1ac;return _0x158893;});}})[_0xe26b('0x27')](respondWithFilteredResult(_0x389783,_0x4510ee))['catch'](handleError(_0x389783,null));};exports['getLists']=function(_0x47238c,_0x596598,_0x108c1a){var _0x262f7={};var _0x12ce59={};var _0x20d05e;var _0x96771f;return db['Campaign'][_0xe26b('0x59')]({'where':{'id':_0x47238c[_0xe26b('0x48')]['id']}})['then'](handleEntityNotFound(_0x596598,null))[_0xe26b('0x27')](function(_0x6c013f){if(_0x6c013f){_0x20d05e=_0x6c013f;_0x12ce59[_0xe26b('0x34')]=_[_0xe26b('0x36')](db[_0xe26b('0x62')][_0xe26b('0x30')]);_0x12ce59[_0xe26b('0x37')]=_[_0xe26b('0x36')](_0x47238c[_0xe26b('0x37')]);_0x12ce59[_0xe26b('0x38')]=_[_0xe26b('0x39')](_0x12ce59['model'],_0x12ce59['query']);_0x262f7[_0xe26b('0x3a')]=_[_0xe26b('0x39')](_0x12ce59[_0xe26b('0x34')],qs[_0xe26b('0x3b')](_0x47238c[_0xe26b('0x37')][_0xe26b('0x3b')]));_0x262f7[_0xe26b('0x3a')]=_0x262f7[_0xe26b('0x3a')][_0xe26b('0x3c')]?_0x262f7[_0xe26b('0x3a')]:_0x12ce59['model'];_0x262f7[_0xe26b('0x3f')]=qs[_0xe26b('0x40')](_0x47238c[_0xe26b('0x37')][_0xe26b('0x40')]);_0x262f7[_0xe26b('0x41')]=qs[_0xe26b('0x38')](_[_0xe26b('0x5b')](_0x47238c['query'],_0x12ce59['filters']));if(_0x47238c[_0xe26b('0x37')][_0xe26b('0x42')]){_0x262f7[_0xe26b('0x41')]=_[_0xe26b('0x4b')](_0x262f7[_0xe26b('0x41')],{'$or':_[_0xe26b('0x35')](_0x262f7['attributes'],function(_0x1af69f){var _0x378368={};_0x378368[_0x1af69f]={'$like':'%'+_0x47238c['query'][_0xe26b('0x42')]+'%'};return _0x378368;})});}_0x262f7=_[_0xe26b('0x4b')]({},_0x262f7,_0x47238c[_0xe26b('0x44')]);return _0x20d05e['getLists'](_0x262f7);}})[_0xe26b('0x27')](function(_0x206f52){if(_0x206f52){_0x96771f=_0x206f52['length'];if(!_0x47238c['query'][_0xe26b('0x3d')]('nolimit')){_0x262f7[_0xe26b('0x21')]=qs['limit'](_0x47238c['query'][_0xe26b('0x21')]);_0x262f7[_0xe26b('0x1f')]=qs['offset'](_0x47238c[_0xe26b('0x37')]['offset']);}return _0x20d05e['getLists'](_0x262f7);}})[_0xe26b('0x27')](function(_0x43cb6e){if(_0x43cb6e){return _0x43cb6e?{'count':_0x96771f,'rows':_0x43cb6e}:null;}})['then'](respondWithResult(_0x596598,null))[_0xe26b('0x46')](handleError(_0x596598,null));};exports[_0xe26b('0x63')]=function(_0x59030c,_0x3c356f,_0x340d29){var _0x19653e,_0x4b4a54;return db[_0xe26b('0x2f')]['find']({'where':{'id':_0x59030c[_0xe26b('0x48')]['id']}})[_0xe26b('0x27')](handleEntityNotFound(_0x3c356f,null))['then'](function(_0x531e77){if(_0x531e77){_0x4b4a54=_0x531e77;return _0x531e77['addLists'](_0x59030c[_0xe26b('0x52')][_0xe26b('0x64')],_[_0xe26b('0x53')](_0x59030c[_0xe26b('0x52')],[_0xe26b('0x64'),'id'])||{});}return null;})[_0xe26b('0x65')](function(_0x3b5f05){var _0x20a4e9;_0x19653e=_0x3b5f05||[];var _0x531956=[];if(_0x3b5f05){for(var _0xb01a45=0x0;_0xb01a45<_0x3b5f05[_0xe26b('0x3c')];_0xb01a45+=0x1){var _0x4669e5=_0x3b5f05[_0xb01a45][_0xe26b('0x29')]({'plain':!![]});_0x4b4a54['dialCheckDuplicateType']=_0x59030c[_0xe26b('0x52')][_0xe26b('0x66')]?_0x59030c[_0xe26b('0x52')]['dialCheckDuplicateType']:_0x4b4a54[_0xe26b('0x66')];switch(_0x4b4a54[_0xe26b('0x66')]){case _0xe26b('0x67'):_0x20a4e9=squel[_0xe26b('0x68')]()[_0xe26b('0x69')](_0xe26b('0x6a'))['fromQuery']([_0xe26b('0x6b'),_0xe26b('0x6c'),_0xe26b('0x6d'),'ListId',_0xe26b('0x5c'),_0xe26b('0x54'),_0xe26b('0x51')],squel[_0xe26b('0x6e')]()['field'](_0xe26b('0x6b'),'phone')['field'](_0xe26b('0x6f'),_0xe26b('0x6c'))[_0xe26b('0x70')]('id','ContactId')['field'](_0x4669e5[_0xe26b('0x71')][_0xe26b('0x72')](),_0xe26b('0x73'))[_0xe26b('0x70')](_0x59030c[_0xe26b('0x48')]['id']['toString'](),_0xe26b('0x5c'))[_0xe26b('0x70')](_0xe26b('0x6f'),_0xe26b('0x54'))[_0xe26b('0x70')](_0xe26b('0x6f'),_0xe26b('0x51'))[_0xe26b('0x74')](_0xe26b('0x75'))['where'](_0xe26b('0x76'))[_0xe26b('0x41')](_0xe26b('0x77'),_0x4669e5['CmListId']['toString']())[_0xe26b('0x41')](_0xe26b('0x78'))[_0xe26b('0x41')](_0xe26b('0x79'),squel[_0xe26b('0x6e')]()[_0xe26b('0x70')](_0xe26b('0x7a'))[_0xe26b('0x74')](_0xe26b('0x7b'))[_0xe26b('0x41')](_0xe26b('0x7c'),_0x59030c[_0xe26b('0x48')]['id'][_0xe26b('0x72')]()))['where'](_0xe26b('0x79'),squel['select']()[_0xe26b('0x70')](_0xe26b('0x7d'))['from'](_0xe26b('0x6a'))[_0xe26b('0x41')]('CampaignId\x20=\x20?',_0x59030c[_0xe26b('0x48')]['id']['toString']())))[_0xe26b('0x72')]();break;case'onlyIfOpen':_0x20a4e9=squel[_0xe26b('0x68')]()[_0xe26b('0x69')](_0xe26b('0x6a'))['fromQuery'](['phone',_0xe26b('0x6c'),'ContactId',_0xe26b('0x73'),_0xe26b('0x5c'),_0xe26b('0x54'),_0xe26b('0x51')],squel[_0xe26b('0x6e')]()['field'](_0xe26b('0x6b'),'phone')[_0xe26b('0x70')](_0xe26b('0x6f'),_0xe26b('0x6c'))[_0xe26b('0x70')]('id',_0xe26b('0x6d'))[_0xe26b('0x70')](_0x4669e5[_0xe26b('0x71')][_0xe26b('0x72')](),_0xe26b('0x73'))[_0xe26b('0x70')](_0x59030c['params']['id'][_0xe26b('0x72')](),_0xe26b('0x5c'))[_0xe26b('0x70')]('NOW()',_0xe26b('0x54'))[_0xe26b('0x70')](_0xe26b('0x6f'),_0xe26b('0x51'))[_0xe26b('0x74')](_0xe26b('0x75'))[_0xe26b('0x41')](_0xe26b('0x76'))[_0xe26b('0x41')](_0xe26b('0x77'),_0x4669e5[_0xe26b('0x71')][_0xe26b('0x72')]())[_0xe26b('0x41')](_0xe26b('0x78'))['where'](_0xe26b('0x79'),squel[_0xe26b('0x6e')]()[_0xe26b('0x70')](_0xe26b('0x7d'))['from'](_0xe26b('0x6a'))[_0xe26b('0x41')]('CampaignId\x20=\x20?',_0x59030c['params']['id'][_0xe26b('0x72')]())))[_0xe26b('0x72')]();break;default:_0x20a4e9=squel[_0xe26b('0x68')]()['into'](_0xe26b('0x6a'))[_0xe26b('0x7e')]([_0xe26b('0x6b'),_0xe26b('0x6c'),_0xe26b('0x6d'),'ListId',_0xe26b('0x5c'),_0xe26b('0x54'),_0xe26b('0x51')],squel[_0xe26b('0x6e')]()['field'](_0xe26b('0x6b'),_0xe26b('0x6b'))[_0xe26b('0x70')]('NOW()',_0xe26b('0x6c'))[_0xe26b('0x70')]('id',_0xe26b('0x6d'))[_0xe26b('0x70')](_0x4669e5[_0xe26b('0x71')]['toString'](),_0xe26b('0x73'))[_0xe26b('0x70')](_0x59030c[_0xe26b('0x48')]['id']['toString'](),_0xe26b('0x5c'))['field'](_0xe26b('0x6f'),_0xe26b('0x54'))['field'](_0xe26b('0x6f'),_0xe26b('0x51'))[_0xe26b('0x74')](_0xe26b('0x75'))['where'](_0xe26b('0x76'))['where'](_0xe26b('0x77'),_0x4669e5[_0xe26b('0x71')][_0xe26b('0x72')]())[_0xe26b('0x41')](_0xe26b('0x78')))['toString']();}_0x531956[_0xe26b('0x7f')](db['sequelize'][_0xe26b('0x37')](_0x20a4e9));}return BPromise[_0xe26b('0x80')](_0x531956);}})['then'](function(){return _0x19653e;})[_0xe26b('0x27')](respondWithResult(_0x3c356f,null))[_0xe26b('0x46')](handleError(_0x3c356f,null));};exports[_0xe26b('0x81')]=function(_0x166c02,_0x2ef880,_0x13191e){return db['Campaign'][_0xe26b('0x4c')]({'where':{'id':_0x166c02['params']['id']}})['then'](handleEntityNotFound(_0x2ef880,null))[_0xe26b('0x27')](function(_0x29e035){if(_0x29e035){return _0x29e035[_0xe26b('0x81')](_0x166c02[_0xe26b('0x37')][_0xe26b('0x64')]);}})[_0xe26b('0x27')](function(_0x248f83){if(_0x248f83){return db[_0xe26b('0x5a')][_0xe26b('0x28')]({'where':{'ListId':_0x166c02['query']['ids'],'CampaignId':_0x166c02[_0xe26b('0x48')]['id']}})['then'](function(){return _0x248f83;});}})[_0xe26b('0x27')](respondWithStatusCode(_0x2ef880,null))['catch'](handleError(_0x2ef880,null));};exports[_0xe26b('0x82')]=function(_0x5c9df5,_0x287fa9,_0x8768a2){var _0x10cbf2={};var _0x57f62d={};var _0x1e9744;var _0x2f1e7c;return db[_0xe26b('0x2f')]['findOne']({'where':{'id':_0x5c9df5[_0xe26b('0x48')]['id']}})[_0xe26b('0x27')](handleEntityNotFound(_0x287fa9,null))[_0xe26b('0x27')](function(_0x5aa07d){if(_0x5aa07d){_0x1e9744=_0x5aa07d;_0x57f62d[_0xe26b('0x34')]=_[_0xe26b('0x36')](db[_0xe26b('0x62')][_0xe26b('0x30')]);_0x57f62d[_0xe26b('0x37')]=_[_0xe26b('0x36')](_0x5c9df5[_0xe26b('0x37')]);_0x57f62d['filters']=_[_0xe26b('0x39')](_0x57f62d['model'],_0x57f62d[_0xe26b('0x37')]);_0x10cbf2[_0xe26b('0x3a')]=_[_0xe26b('0x39')](_0x57f62d[_0xe26b('0x34')],qs[_0xe26b('0x3b')](_0x5c9df5[_0xe26b('0x37')][_0xe26b('0x3b')]));_0x10cbf2[_0xe26b('0x3a')]=_0x10cbf2[_0xe26b('0x3a')][_0xe26b('0x3c')]?_0x10cbf2[_0xe26b('0x3a')]:_0x57f62d[_0xe26b('0x34')];_0x10cbf2['order']=qs[_0xe26b('0x40')](_0x5c9df5[_0xe26b('0x37')][_0xe26b('0x40')]);_0x10cbf2['where']=qs['filters'](_[_0xe26b('0x5b')](_0x5c9df5['query'],_0x57f62d[_0xe26b('0x38')]));if(_0x5c9df5[_0xe26b('0x37')][_0xe26b('0x42')]){_0x10cbf2[_0xe26b('0x41')]=_[_0xe26b('0x4b')](_0x10cbf2['where'],{'$or':_['map'](_0x10cbf2[_0xe26b('0x3a')],function(_0x5b7626){var _0xfb65f5={};_0xfb65f5[_0x5b7626]={'$like':'%'+_0x5c9df5[_0xe26b('0x37')][_0xe26b('0x42')]+'%'};return _0xfb65f5;})});}_0x10cbf2=_[_0xe26b('0x4b')]({},_0x10cbf2,_0x5c9df5['options']);return _0x1e9744[_0xe26b('0x82')](_0x10cbf2);}})[_0xe26b('0x27')](function(_0x314bd9){if(_0x314bd9){_0x2f1e7c=_0x314bd9[_0xe26b('0x3c')];if(!_0x5c9df5[_0xe26b('0x37')]['hasOwnProperty'](_0xe26b('0x3e'))){_0x10cbf2['limit']=qs[_0xe26b('0x21')](_0x5c9df5['query']['limit']);_0x10cbf2[_0xe26b('0x1f')]=qs[_0xe26b('0x1f')](_0x5c9df5[_0xe26b('0x37')][_0xe26b('0x1f')]);}return _0x1e9744[_0xe26b('0x82')](_0x10cbf2);}})['then'](function(_0x1280e1){if(_0x1280e1){return _0x1280e1?{'count':_0x2f1e7c,'rows':_0x1280e1}:null;}})['then'](respondWithResult(_0x287fa9,null))[_0xe26b('0x46')](handleError(_0x287fa9,null));};exports[_0xe26b('0x83')]=function(_0x406fb7,_0x4a3133,_0x5ba96f){var _0x9dc37a,_0x424013;return db['Campaign']['find']({'where':{'id':_0x406fb7[_0xe26b('0x48')]['id']}})[_0xe26b('0x27')](handleEntityNotFound(_0x4a3133,null))[_0xe26b('0x27')](function(_0xf38e1d){if(_0xf38e1d){_0x424013=_0xf38e1d;return _0xf38e1d['addBlackLists'](_0x406fb7[_0xe26b('0x52')]['ids'],_['omit'](_0x406fb7[_0xe26b('0x52')],[_0xe26b('0x64'),'id'])||{});}return null;})[_0xe26b('0x65')](function(_0x3704ba){var _0x2479d9;_0x9dc37a=_0x3704ba||[];var _0xa45c82=[];if(_0x3704ba){for(var _0x13a62f=0x0;_0x13a62f<_0x3704ba[_0xe26b('0x3c')];_0x13a62f+=0x1){var _0x288d1b=_0x3704ba[_0x13a62f][_0xe26b('0x29')]({'plain':!![]});_0x2479d9=squel[_0xe26b('0x68')]()[_0xe26b('0x69')]('cm_hopper_black')[_0xe26b('0x7e')](['phone',_0xe26b('0x6d'),_0xe26b('0x73'),_0xe26b('0x5c'),'createdAt',_0xe26b('0x51')],squel[_0xe26b('0x6e')]()[_0xe26b('0x70')](_0xe26b('0x6b'),_0xe26b('0x6b'))[_0xe26b('0x70')]('id',_0xe26b('0x6d'))[_0xe26b('0x70')](_0x288d1b['CmListId'][_0xe26b('0x72')](),_0xe26b('0x73'))['field'](_0x406fb7[_0xe26b('0x48')]['id'][_0xe26b('0x72')](),'CampaignId')[_0xe26b('0x70')](_0xe26b('0x6f'),_0xe26b('0x54'))[_0xe26b('0x70')](_0xe26b('0x6f'),_0xe26b('0x51'))[_0xe26b('0x74')](_0xe26b('0x75'))[_0xe26b('0x41')](_0xe26b('0x76'))['where'](_0xe26b('0x77'),_0x288d1b[_0xe26b('0x71')][_0xe26b('0x72')]())[_0xe26b('0x41')](_0xe26b('0x78')))[_0xe26b('0x72')]();_0xa45c82[_0xe26b('0x7f')](db[_0xe26b('0x84')][_0xe26b('0x37')](_0x2479d9));}return BPromise[_0xe26b('0x80')](_0xa45c82);}})[_0xe26b('0x27')](function(){return _0x9dc37a;})[_0xe26b('0x27')](respondWithResult(_0x4a3133,null))[_0xe26b('0x46')](handleError(_0x4a3133,null));};exports['removeBlackLists']=function(_0x1a5879,_0x42406e,_0x46904f){return db[_0xe26b('0x2f')][_0xe26b('0x4c')]({'where':{'id':_0x1a5879[_0xe26b('0x48')]['id']}})[_0xe26b('0x27')](handleEntityNotFound(_0x42406e,null))[_0xe26b('0x27')](function(_0x5950e2){if(_0x5950e2){return _0x5950e2[_0xe26b('0x85')](_0x1a5879['query'][_0xe26b('0x64')]);}})[_0xe26b('0x27')](function(_0x579f6f){if(_0x579f6f){return db[_0xe26b('0x61')][_0xe26b('0x28')]({'where':{'ListId':_0x1a5879['query'][_0xe26b('0x64')],'CampaignId':_0x1a5879['params']['id']}})[_0xe26b('0x27')](function(){return _0x579f6f;});}})[_0xe26b('0x27')](respondWithStatusCode(_0x42406e,null))[_0xe26b('0x46')](handleError(_0x42406e,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 6e936d1..f3f957b 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(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x3201c8,_0x50c2c9){var _0x2ecf11=function(_0x54dd8a){while(--_0x54dd8a){_0x3201c8['push'](_0x3201c8['shift']());}};_0x2ecf11(++_0x50c2c9);}(_0x7a54,0x106));var _0x47a5=function(_0x36fa40,_0x2651ee){_0x36fa40=_0x36fa40-0x0;var _0x309961=_0x7a54[_0x36fa40];return _0x309961;};'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 29009bb..7bd2278 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 _0x402f=['rpc','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','message','error','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x24a168,_0x4bad38){var _0x58c139=function(_0x12ec96){while(--_0x12ec96){_0x24a168['push'](_0x24a168['shift']());}};_0x58c139(++_0x4bad38);}(_0x402f,0x6f));var _0xf402=function(_0x3d4b54,_0x381964){_0x3d4b54=_0x3d4b54-0x0;var _0x786a5a=_0x402f[_0x3d4b54];return _0x786a5a;};'use strict';var _=require(_0xf402('0x0'));var util=require('util');var moment=require(_0xf402('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf402('0x2'));var db=require(_0xf402('0x3'))['db'];var utils=require(_0xf402('0x4'));var logger=require('../../config/logger')(_0xf402('0x5'));var config=require('../../config/environment');var jayson=require(_0xf402('0x6'));var client=jayson[_0xf402('0x7')][_0xf402('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2a8774,_0xa1b27d,_0x55c515){return new BPromise(function(_0x4d1771,_0x2f0ffe){return client[_0xf402('0x9')](_0x2a8774,_0x55c515)[_0xf402('0xa')](function(_0xdc18e0){logger[_0xf402('0xb')](_0xf402('0xc'),_0xa1b27d,_0xf402('0xd'));logger[_0xf402('0xe')]('Campaign,\x20%s,\x20%s,\x20%s',_0xa1b27d,_0xf402('0xd'),JSON['stringify'](_0xdc18e0));if(_0xdc18e0['error']){if(_0xdc18e0['error']['code']===0x1f4){logger['error'](_0xf402('0xc'),_0xa1b27d,_0xdc18e0['error']['message']);return _0x2f0ffe(_0xdc18e0['error'][_0xf402('0xf')]);}logger['error'](_0xf402('0xc'),_0xa1b27d,_0xdc18e0[_0xf402('0x10')][_0xf402('0xf')]);return _0x4d1771(_0xdc18e0[_0xf402('0x10')]['message']);}else{logger[_0xf402('0xb')]('Campaign,\x20%s,\x20%s',_0xa1b27d,_0xf402('0xd'));_0x4d1771(_0xdc18e0['result']['message']);}})['catch'](function(_0xb45d00){logger[_0xf402('0x10')](_0xf402('0xc'),_0xa1b27d,_0xb45d00);_0x2f0ffe(_0xb45d00);});});}exports[_0xf402('0x11')]=function(_0x2fbe36){var _0x5d7236=this;return new Promise(function(_0x3ed3eb,_0x151166){return db[_0xf402('0x12')][_0xf402('0x13')]({'raw':_0x2fbe36['options']?_0x2fbe36[_0xf402('0x14')][_0xf402('0x15')]===undefined?!![]:![]:!![],'where':_0x2fbe36[_0xf402('0x14')]?_0x2fbe36[_0xf402('0x14')][_0xf402('0x16')]||null:null,'attributes':_0x2fbe36[_0xf402('0x14')]?_0x2fbe36[_0xf402('0x14')][_0xf402('0x17')]||null:null,'limit':_0x2fbe36[_0xf402('0x14')]?_0x2fbe36['options'][_0xf402('0x18')]||null:null,'include':_0x2fbe36['options']?_0x2fbe36[_0xf402('0x14')][_0xf402('0x19')]?_[_0xf402('0x1a')](_0x2fbe36[_0xf402('0x14')][_0xf402('0x19')],function(_0x9cbd83){return{'model':db[_0x9cbd83[_0xf402('0x1b')]],'as':_0x9cbd83['as'],'attributes':_0x9cbd83[_0xf402('0x17')],'include':_0x9cbd83[_0xf402('0x19')]?_[_0xf402('0x1a')](_0x9cbd83[_0xf402('0x19')],function(_0xfad629){return{'model':db[_0xfad629['model']],'as':_0xfad629['as'],'attributes':_0xfad629[_0xf402('0x17')],'include':_0xfad629[_0xf402('0x19')]?_[_0xf402('0x1a')](_0xfad629[_0xf402('0x19')],function(_0x566a3d){return{'model':db[_0x566a3d['model']],'as':_0x566a3d['as'],'attributes':_0x566a3d[_0xf402('0x17')]};}):[]};}):[]};}):[]:[]})[_0xf402('0xa')](function(_0x3a6a8d){logger[_0xf402('0xb')](_0xf402('0x11'),_0x2fbe36);logger['debug'](_0xf402('0x11'),_0x2fbe36,JSON['stringify'](_0x3a6a8d));_0x3ed3eb(_0x3a6a8d);})[_0xf402('0x1c')](function(_0xe3dc2f){logger[_0xf402('0x10')](_0xf402('0x11'),_0xe3dc2f[_0xf402('0xf')],_0x2fbe36);_0x151166(_0x5d7236['error'](0x1f4,_0xe3dc2f[_0xf402('0xf')]));});});}; \ No newline at end of file +var _0xdab2=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','GetCampaign','Campaign','findAll','options','raw','where','attributes','map','include','model','catch','lodash','util'];(function(_0x5c3c5b,_0x1852aa){var _0x20642f=function(_0xb1347e){while(--_0xb1347e){_0x5c3c5b['push'](_0x5c3c5b['shift']());}};_0x20642f(++_0x1852aa);}(_0xdab2,0x130));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2dab('0x0'));var util=require(_0x2dab('0x1'));var moment=require('moment');var BPromise=require(_0x2dab('0x2'));var rs=require(_0x2dab('0x3'));var fs=require('fs');var Redis=require(_0x2dab('0x4'));var db=require(_0x2dab('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2dab('0x6'))(_0x2dab('0x7'));var config=require(_0x2dab('0x8'));var jayson=require(_0x2dab('0x9'));var client=jayson[_0x2dab('0xa')][_0x2dab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11da80,_0x627cdb,_0x218d6b){return new BPromise(function(_0x188cef,_0x215faa){return client[_0x2dab('0xc')](_0x11da80,_0x218d6b)[_0x2dab('0xd')](function(_0x533046){logger['info'](_0x2dab('0xe'),_0x627cdb,_0x2dab('0xf'));logger[_0x2dab('0x10')]('Campaign,\x20%s,\x20%s,\x20%s',_0x627cdb,'request\x20sent',JSON[_0x2dab('0x11')](_0x533046));if(_0x533046[_0x2dab('0x12')]){if(_0x533046[_0x2dab('0x12')][_0x2dab('0x13')]===0x1f4){logger[_0x2dab('0x12')]('Campaign,\x20%s,\x20%s',_0x627cdb,_0x533046[_0x2dab('0x12')][_0x2dab('0x14')]);return _0x215faa(_0x533046['error'][_0x2dab('0x14')]);}logger[_0x2dab('0x12')](_0x2dab('0xe'),_0x627cdb,_0x533046['error'][_0x2dab('0x14')]);return _0x188cef(_0x533046[_0x2dab('0x12')]['message']);}else{logger[_0x2dab('0x15')](_0x2dab('0xe'),_0x627cdb,_0x2dab('0xf'));_0x188cef(_0x533046[_0x2dab('0x16')][_0x2dab('0x14')]);}})['catch'](function(_0x128004){logger[_0x2dab('0x12')](_0x2dab('0xe'),_0x627cdb,_0x128004);_0x215faa(_0x128004);});});}exports[_0x2dab('0x17')]=function(_0x30bbde){var _0x2a86b5=this;return new Promise(function(_0x4ff9be,_0x9436f0){return db[_0x2dab('0x18')][_0x2dab('0x19')]({'raw':_0x30bbde['options']?_0x30bbde[_0x2dab('0x1a')][_0x2dab('0x1b')]===undefined?!![]:![]:!![],'where':_0x30bbde[_0x2dab('0x1a')]?_0x30bbde['options'][_0x2dab('0x1c')]||null:null,'attributes':_0x30bbde[_0x2dab('0x1a')]?_0x30bbde[_0x2dab('0x1a')][_0x2dab('0x1d')]||null:null,'limit':_0x30bbde[_0x2dab('0x1a')]?_0x30bbde[_0x2dab('0x1a')]['limit']||null:null,'include':_0x30bbde[_0x2dab('0x1a')]?_0x30bbde[_0x2dab('0x1a')]['include']?_[_0x2dab('0x1e')](_0x30bbde[_0x2dab('0x1a')][_0x2dab('0x1f')],function(_0x37cb08){return{'model':db[_0x37cb08[_0x2dab('0x20')]],'as':_0x37cb08['as'],'attributes':_0x37cb08[_0x2dab('0x1d')],'include':_0x37cb08[_0x2dab('0x1f')]?_[_0x2dab('0x1e')](_0x37cb08[_0x2dab('0x1f')],function(_0x1b1c5b){return{'model':db[_0x1b1c5b['model']],'as':_0x1b1c5b['as'],'attributes':_0x1b1c5b[_0x2dab('0x1d')],'include':_0x1b1c5b['include']?_[_0x2dab('0x1e')](_0x1b1c5b[_0x2dab('0x1f')],function(_0x594f6f){return{'model':db[_0x594f6f[_0x2dab('0x20')]],'as':_0x594f6f['as'],'attributes':_0x594f6f[_0x2dab('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2dab('0xd')](function(_0x2977ac){logger['info'](_0x2dab('0x17'),_0x30bbde);logger[_0x2dab('0x10')](_0x2dab('0x17'),_0x30bbde,JSON[_0x2dab('0x11')](_0x2977ac));_0x4ff9be(_0x2977ac);})[_0x2dab('0x21')](function(_0x577a09){logger[_0x2dab('0x12')](_0x2dab('0x17'),_0x577a09[_0x2dab('0x14')],_0x30bbde);_0x9436f0(_0x2a86b5[_0x2dab('0x12')](0x1f4,_0x577a09[_0x2dab('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 0d2e4b5..7f9ddcf 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 _0xe0c9=['addLists','addBlackLists','put','delete','destroy','removeLists','removeBlackLists','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','/:id/clone','clone'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0xe0c9,0x1b4));var _0x9e0c=function(_0x49f886,_0x2a4f51){_0x49f886=_0x49f886-0x0;var _0x5d6831=_0xe0c9[_0x49f886];return _0x5d6831;};'use strict';var multer=require('multer');var util=require(_0x9e0c('0x0'));var path=require(_0x9e0c('0x1'));var timeout=require(_0x9e0c('0x2'));var express=require(_0x9e0c('0x3'));var router=express[_0x9e0c('0x4')]();var fs_extra=require(_0x9e0c('0x5'));var auth=require(_0x9e0c('0x6'));var interaction=require(_0x9e0c('0x7'));var config=require('../../config/environment');var controller=require('./campaign.controller');router[_0x9e0c('0x8')]('/',auth[_0x9e0c('0x9')](),controller[_0x9e0c('0xa')]);router['get'](_0x9e0c('0xb'),auth[_0x9e0c('0x9')](),controller[_0x9e0c('0xc')]);router[_0x9e0c('0x8')](_0x9e0c('0xd'),auth[_0x9e0c('0x9')](),controller[_0x9e0c('0xe')]);router[_0x9e0c('0x8')](_0x9e0c('0xf'),auth['isAuthenticated'](),controller[_0x9e0c('0x10')]);router[_0x9e0c('0x8')]('/:id/hopper_finals',auth[_0x9e0c('0x9')](),controller[_0x9e0c('0x11')]);router[_0x9e0c('0x8')]('/:id/hopper_black',auth[_0x9e0c('0x9')](),controller[_0x9e0c('0x12')]);router[_0x9e0c('0x8')](_0x9e0c('0x13'),auth[_0x9e0c('0x9')](),controller[_0x9e0c('0x14')]);router[_0x9e0c('0x8')](_0x9e0c('0x15'),auth[_0x9e0c('0x9')](),controller[_0x9e0c('0x16')]);router['post']('/',auth[_0x9e0c('0x9')](),controller['create']);router[_0x9e0c('0x17')](_0x9e0c('0x18'),auth[_0x9e0c('0x9')](),controller[_0x9e0c('0x19')]);router[_0x9e0c('0x17')](_0x9e0c('0x13'),auth['isAuthenticated'](),controller[_0x9e0c('0x1a')]);router[_0x9e0c('0x17')](_0x9e0c('0x15'),auth[_0x9e0c('0x9')](),controller[_0x9e0c('0x1b')]);router[_0x9e0c('0x1c')](_0x9e0c('0xb'),auth[_0x9e0c('0x9')](),controller['update']);router[_0x9e0c('0x1d')](_0x9e0c('0xb'),auth['isAuthenticated'](),controller[_0x9e0c('0x1e')]);router['delete'](_0x9e0c('0x13'),auth[_0x9e0c('0x9')](),controller[_0x9e0c('0x1f')]);router[_0x9e0c('0x1d')](_0x9e0c('0x15'),auth[_0x9e0c('0x9')](),controller[_0x9e0c('0x20')]);module['exports']=router; \ No newline at end of file +var _0x2e31=['put','/:id','destroy','delete','removeLists','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./campaign.controller','isAuthenticated','index','show','get','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','create','clone','addLists','post'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x2e31,0x145));var _0x12e3=function(_0x4d2897,_0x2fc45b){_0x4d2897=_0x4d2897-0x0;var _0x54829a=_0x2e31[_0x4d2897];return _0x54829a;};'use strict';var multer=require(_0x12e3('0x0'));var util=require(_0x12e3('0x1'));var path=require(_0x12e3('0x2'));var timeout=require('connect-timeout');var express=require(_0x12e3('0x3'));var router=express[_0x12e3('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x12e3('0x5'));var config=require(_0x12e3('0x6'));var controller=require(_0x12e3('0x7'));router['get']('/',auth[_0x12e3('0x8')](),controller[_0x12e3('0x9')]);router['get']('/:id',auth[_0x12e3('0x8')](),controller[_0x12e3('0xa')]);router[_0x12e3('0xb')](_0x12e3('0xc'),auth['isAuthenticated'](),controller[_0x12e3('0xd')]);router[_0x12e3('0xb')](_0x12e3('0xe'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0x12e3('0xb')](_0x12e3('0xf'),auth[_0x12e3('0x8')](),controller[_0x12e3('0x10')]);router[_0x12e3('0xb')](_0x12e3('0x11'),auth[_0x12e3('0x8')](),controller[_0x12e3('0x12')]);router[_0x12e3('0xb')](_0x12e3('0x13'),auth[_0x12e3('0x8')](),controller[_0x12e3('0x14')]);router['get'](_0x12e3('0x15'),auth[_0x12e3('0x8')](),controller[_0x12e3('0x16')]);router['post']('/',auth[_0x12e3('0x8')](),controller[_0x12e3('0x17')]);router['post']('/:id/clone',auth['isAuthenticated'](),controller[_0x12e3('0x18')]);router['post'](_0x12e3('0x13'),auth[_0x12e3('0x8')](),controller[_0x12e3('0x19')]);router[_0x12e3('0x1a')](_0x12e3('0x15'),auth[_0x12e3('0x8')](),controller['addBlackLists']);router[_0x12e3('0x1b')](_0x12e3('0x1c'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x12e3('0x1c'),auth['isAuthenticated'](),controller[_0x12e3('0x1d')]);router[_0x12e3('0x1e')]('/:id/lists',auth['isAuthenticated'](),controller[_0x12e3('0x1f')]);router[_0x12e3('0x1e')](_0x12e3('0x15'),auth[_0x12e3('0x8')](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 49ee6d2..055d479 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 _0xd479=['TEXT','VIRTUAL','getDataValue','key','exports','STRING'];(function(_0x25ea59,_0x155f2a){var _0x305516=function(_0x109ac0){while(--_0x109ac0){_0x25ea59['push'](_0x25ea59['shift']());}};_0x305516(++_0x155f2a);}(_0xd479,0x11e));var _0x9d47=function(_0x5ddfce,_0x4dcb01){_0x5ddfce=_0x5ddfce-0x0;var _0x22049d=_0xd479[_0x5ddfce];return _0x22049d;};'use strict';var Sequelize=require('sequelize');module[_0x9d47('0x0')]={'key':{'type':Sequelize[_0x9d47('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x9d47('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x9d47('0x1')]},'name':{'type':Sequelize[_0x9d47('0x3')],'get':function(){return this[_0x9d47('0x4')](_0x9d47('0x5'));}}}; \ No newline at end of file +var _0x3546=['TEXT','VIRTUAL','getDataValue','key','exports','STRING'];(function(_0x2ea7b5,_0x2da3c8){var _0x3c1a51=function(_0x48b9ae){while(--_0x48b9ae){_0x2ea7b5['push'](_0x2ea7b5['shift']());}};_0x3c1a51(++_0x2da3c8);}(_0x3546,0x148));var _0x6354=function(_0x2f32c4,_0x531dc6){_0x2f32c4=_0x2f32c4-0x0;var _0x3f3018=_0x3546[_0x2f32c4];return _0x3f3018;};'use strict';var Sequelize=require('sequelize');module[_0x6354('0x0')]={'key':{'type':Sequelize[_0x6354('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x6354('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6354('0x1')]},'name':{'type':Sequelize[_0x6354('0x3')],'get':function(){return this[_0x6354('0x4')](_0x6354('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 13bf972..3fae20f 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 _0xc76e=['nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','map','CannedAnswer','rawAttributes','fieldName','query','keys','filters','model','attributes','intersection','fields','length'];(function(_0x27af7d,_0x2a2269){var _0x122d1f=function(_0xd84e7e){while(--_0xd84e7e){_0x27af7d['push'](_0x27af7d['shift']());}};_0x122d1f(++_0x2a2269);}(_0xc76e,0x1cf));var _0xec76=function(_0x29e8a1,_0xa8c01){_0x29e8a1=_0x29e8a1-0x0;var _0x54b5f7=_0xc76e[_0x29e8a1];return _0x54b5f7;};'use strict';var emlformat=require(_0xec76('0x0'));var rimraf=require(_0xec76('0x1'));var zipdir=require(_0xec76('0x2'));var jsonpatch=require(_0xec76('0x3'));var rp=require(_0xec76('0x4'));var moment=require(_0xec76('0x5'));var BPromise=require(_0xec76('0x6'));var Mustache=require('mustache');var util=require(_0xec76('0x7'));var path=require('path');var sox=require(_0xec76('0x8'));var csv=require(_0xec76('0x9'));var ejs=require(_0xec76('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xec76('0xb'));var crypto=require('crypto');var jsforce=require(_0xec76('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xec76('0x9'));var querystring=require(_0xec76('0xd'));var Papa=require(_0xec76('0xe'));var Redis=require(_0xec76('0xf'));var authService=require(_0xec76('0x10'));var qs=require(_0xec76('0x11'));var as=require(_0xec76('0x12'));var hardwareService=require(_0xec76('0x13'));var logger=require(_0xec76('0x14'))(_0xec76('0x15'));var utils=require(_0xec76('0x16'));var config=require(_0xec76('0x17'));var licenseUtil=require(_0xec76('0x18'));var db=require(_0xec76('0x19'))['db'];function respondWithStatusCode(_0x86a05b,_0x4eef04){_0x4eef04=_0x4eef04||0xcc;return function(_0x421c70){if(_0x421c70){return _0x86a05b[_0xec76('0x1a')](_0x4eef04);}return _0x86a05b[_0xec76('0x1b')](_0x4eef04)[_0xec76('0x1c')]();};}function respondWithResult(_0x2596bd,_0x32adb7){_0x32adb7=_0x32adb7||0xc8;return function(_0x268e0a){if(_0x268e0a){return _0x2596bd['status'](_0x32adb7)[_0xec76('0x1d')](_0x268e0a);}};}function respondWithFilteredResult(_0x181bc0,_0x43712d){return function(_0x65fd21){if(_0x65fd21){var _0x40ef94=typeof _0x43712d['offset']==='undefined'&&typeof _0x43712d[_0xec76('0x1e')]===_0xec76('0x1f');var _0x141cd1=_0x65fd21[_0xec76('0x20')];var _0x443edc=_0x40ef94?0x0:_0x43712d[_0xec76('0x21')];var _0x51173d=_0x40ef94?_0x65fd21[_0xec76('0x20')]:_0x43712d[_0xec76('0x21')]+_0x43712d[_0xec76('0x1e')];var _0x16cb35;if(_0x51173d>=_0x141cd1){_0x51173d=_0x141cd1;_0x16cb35=0xc8;}else{_0x16cb35=0xce;}_0x181bc0[_0xec76('0x1b')](_0x16cb35);return _0x181bc0[_0xec76('0x22')](_0xec76('0x23'),_0x443edc+'-'+_0x51173d+'/'+_0x141cd1)[_0xec76('0x1d')](_0x65fd21);}return null;};}function patchUpdates(_0x41b4d2){return function(_0x12c348){try{jsonpatch[_0xec76('0x24')](_0x12c348,_0x41b4d2,!![]);}catch(_0x17657a){return BPromise[_0xec76('0x25')](_0x17657a);}return _0x12c348[_0xec76('0x26')]();};}function saveUpdates(_0x14c857,_0x4bde3d){return function(_0x416621){if(_0x416621){return _0x416621[_0xec76('0x27')](_0x14c857)[_0xec76('0x28')](function(_0x1d3fce){return _0x1d3fce;});}return null;};}function removeEntity(_0x421dbe,_0xe2bfa2){return function(_0x5d063c){if(_0x5d063c){return _0x5d063c[_0xec76('0x29')]()[_0xec76('0x28')](function(){var _0x2aa328=_0x5d063c[_0xec76('0x2a')]({'plain':!![]});var _0x1c801b='CannedAnswers';return db[_0xec76('0x2b')][_0xec76('0x29')]({'where':{'type':_0x1c801b,'resourceId':_0x2aa328['id']}})[_0xec76('0x28')](function(){return _0x5d063c;});})[_0xec76('0x28')](function(){_0x421dbe[_0xec76('0x1b')](0xcc)[_0xec76('0x1c')]();});}};}function handleEntityNotFound(_0x2c202d,_0x23508a){return function(_0xac4234){if(!_0xac4234){_0x2c202d['sendStatus'](0x194);}return _0xac4234;};}function handleError(_0x2192c2,_0x49f531){_0x49f531=_0x49f531||0x1f4;return function(_0x526b79){logger[_0xec76('0x2c')](_0x526b79['stack']);if(_0x526b79[_0xec76('0x2d')]){delete _0x526b79['name'];}_0x2192c2['status'](_0x49f531)[_0xec76('0x2e')](_0x526b79);};}exports['index']=function(_0x33fbab,_0x927cbc){var _0x663dc4={},_0xda8805={},_0x393e54={'count':0x0,'rows':[]};var _0x1d1f6d=_[_0xec76('0x2f')](db[_0xec76('0x30')][_0xec76('0x31')],function(_0x3d9a8e){return{'name':_0x3d9a8e[_0xec76('0x32')],'type':_0x3d9a8e['type']['key']};});_0xda8805['model']=_[_0xec76('0x2f')](_0x1d1f6d,_0xec76('0x2d'));_0xda8805[_0xec76('0x33')]=_[_0xec76('0x34')](_0x33fbab['query']);_0xda8805[_0xec76('0x35')]=_['intersection'](_0xda8805[_0xec76('0x36')],_0xda8805['query']);_0x663dc4[_0xec76('0x37')]=_[_0xec76('0x38')](_0xda8805[_0xec76('0x36')],qs['fields'](_0x33fbab['query'][_0xec76('0x39')]));_0x663dc4['attributes']=_0x663dc4['attributes'][_0xec76('0x3a')]?_0x663dc4[_0xec76('0x37')]:_0xda8805[_0xec76('0x36')];if(!_0x33fbab[_0xec76('0x33')]['hasOwnProperty'](_0xec76('0x3b'))){_0x663dc4['limit']=qs[_0xec76('0x1e')](_0x33fbab[_0xec76('0x33')][_0xec76('0x1e')]);_0x663dc4[_0xec76('0x21')]=qs['offset'](_0x33fbab[_0xec76('0x33')][_0xec76('0x21')]);}_0x663dc4[_0xec76('0x3c')]=qs[_0xec76('0x3d')](_0x33fbab['query'][_0xec76('0x3d')]);_0x663dc4[_0xec76('0x3e')]=qs['filters'](_[_0xec76('0x3f')](_0x33fbab[_0xec76('0x33')],_0xda8805[_0xec76('0x35')]),_0x1d1f6d);if(_0x33fbab[_0xec76('0x33')][_0xec76('0x40')]){_0x663dc4[_0xec76('0x3e')]=_[_0xec76('0x41')](_0x663dc4['where'],{'$or':[{'key':{'$like':'%'+_0x33fbab[_0xec76('0x33')]['filter']+'%'}},{'value':{'$like':'%'+_0x33fbab['query']['filter']+'%'}}]});}_0x663dc4=_[_0xec76('0x41')]({},_0x663dc4,_0x33fbab[_0xec76('0x42')]);var _0x4de13a={'where':_0x663dc4[_0xec76('0x3e')]};return db['CannedAnswer'][_0xec76('0x20')](_0x4de13a)[_0xec76('0x28')](function(_0x5ce3e3){_0x393e54['count']=_0x5ce3e3;if(_0x33fbab[_0xec76('0x33')][_0xec76('0x43')]){_0x663dc4[_0xec76('0x44')]=[{'all':!![]}];}return db[_0xec76('0x30')][_0xec76('0x45')](_0x663dc4);})[_0xec76('0x28')](function(_0x1fcb35){_0x393e54[_0xec76('0x46')]=_0x1fcb35;return _0x393e54;})[_0xec76('0x28')](respondWithFilteredResult(_0x927cbc,_0x663dc4))[_0xec76('0x47')](handleError(_0x927cbc,null));};exports['show']=function(_0x111b9e,_0x36e581){var _0x26c161={'raw':!![],'where':{'id':_0x111b9e['params']['id']}},_0x2add39={};_0x2add39[_0xec76('0x36')]=_[_0xec76('0x34')](db[_0xec76('0x30')][_0xec76('0x31')]);_0x2add39['query']=_[_0xec76('0x34')](_0x111b9e[_0xec76('0x33')]);_0x2add39['filters']=_[_0xec76('0x38')](_0x2add39[_0xec76('0x36')],_0x2add39[_0xec76('0x33')]);_0x26c161[_0xec76('0x37')]=_['intersection'](_0x2add39[_0xec76('0x36')],qs[_0xec76('0x39')](_0x111b9e['query']['fields']));_0x26c161['attributes']=_0x26c161[_0xec76('0x37')][_0xec76('0x3a')]?_0x26c161[_0xec76('0x37')]:_0x2add39[_0xec76('0x36')];if(_0x111b9e[_0xec76('0x33')][_0xec76('0x43')]){_0x26c161['include']=[{'all':!![]}];}_0x26c161=_[_0xec76('0x41')]({},_0x26c161,_0x111b9e[_0xec76('0x42')]);return db[_0xec76('0x30')][_0xec76('0x48')](_0x26c161)['then'](handleEntityNotFound(_0x36e581,null))['then'](respondWithResult(_0x36e581,null))[_0xec76('0x47')](handleError(_0x36e581,null));};exports[_0xec76('0x27')]=function(_0x40f009,_0x54aca7){if(_0x40f009[_0xec76('0x49')]['id']){delete _0x40f009[_0xec76('0x49')]['id'];}return db[_0xec76('0x30')][_0xec76('0x48')]({'where':{'id':_0x40f009[_0xec76('0x4a')]['id']}})[_0xec76('0x28')](handleEntityNotFound(_0x54aca7,null))[_0xec76('0x28')](saveUpdates(_0x40f009['body'],null))[_0xec76('0x28')](respondWithResult(_0x54aca7,null))[_0xec76('0x47')](handleError(_0x54aca7,null));};exports[_0xec76('0x29')]=function(_0xb1c01b,_0x426c9c){return db[_0xec76('0x30')][_0xec76('0x48')]({'where':{'id':_0xb1c01b['params']['id']}})[_0xec76('0x28')](handleEntityNotFound(_0x426c9c,null))[_0xec76('0x28')](removeEntity(_0x426c9c,null))['catch'](handleError(_0x426c9c,null));};exports[_0xec76('0x4b')]=function(_0x14fa57,_0x456b71){var _0x348933={'key':_0x14fa57[_0xec76('0x49')]['key']};if(_0x14fa57[_0xec76('0x49')][_0xec76('0x4c')]){_0x348933['MailAccountId']=_0x14fa57[_0xec76('0x49')][_0xec76('0x4c')];}else if(_0x14fa57['body'][_0xec76('0x4d')]){_0x348933['SmsAccountId']=_0x14fa57['body'][_0xec76('0x4d')];}else if(_0x14fa57['body'][_0xec76('0x4e')]){_0x348933[_0xec76('0x4e')]=_0x14fa57[_0xec76('0x49')][_0xec76('0x4e')];}else if(_0x14fa57[_0xec76('0x49')]['ChatWebsiteId']){_0x348933[_0xec76('0x4f')]=_0x14fa57[_0xec76('0x49')][_0xec76('0x4f')];}return db['CannedAnswer']['find']({'where':_0x348933})[_0xec76('0x28')](function(_0x1e979b){if(_0x1e979b){throw new db[(_0xec76('0x50'))][(_0xec76('0x51'))](_0xec76('0x52'));}return db['CannedAnswer'][_0xec76('0x4b')](_0x14fa57[_0xec76('0x49')]);})[_0xec76('0x28')](function(_0x4a8ccc){var _0x2fbd79=_0x14fa57[_0xec76('0x53')][_0xec76('0x2a')]({'plain':!![]});if(!_0x2fbd79)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2fbd79[_0xec76('0x54')]===_0xec76('0x53')){var _0x155aad=_0x4a8ccc[_0xec76('0x2a')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'CannedAnswers','userProfileId':_0x2fbd79[_0xec76('0x55')]},'raw':!![]})[_0xec76('0x28')](function(_0x25721a){if(_0x25721a&&_0x25721a['autoAssociation']===0x0){return db[_0xec76('0x2b')][_0xec76('0x4b')]({'name':_0x155aad[_0xec76('0x2d')],'resourceId':_0x155aad['id'],'type':_0x25721a[_0xec76('0x2d')],'sectionId':_0x25721a['id']},{})[_0xec76('0x28')](function(){return _0x4a8ccc;});}else{return _0x4a8ccc;}})[_0xec76('0x47')](function(_0x519160){logger[_0xec76('0x2c')](_0xec76('0x56'),_0x519160);throw _0x519160;});}return _0x4a8ccc;})['then'](respondWithResult(_0x456b71,0xc9))['catch'](handleError(_0x456b71,null));}; \ No newline at end of file +var _0x4f0f=['save','update','then','destroy','get','UserProfileResource','stack','name','send','CannedAnswer','rawAttributes','fieldName','type','key','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','catch','show','model','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CannedAnswers','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject'];(function(_0x45e24b,_0x259b37){var _0x4b1fb2=function(_0x54cf56){while(--_0x54cf56){_0x45e24b['push'](_0x45e24b['shift']());}};_0x4b1fb2(++_0x259b37);}(_0x4f0f,0x184));var _0xf4f0=function(_0x2a7b1b,_0x2d4cea){_0x2a7b1b=_0x2a7b1b-0x0;var _0x42e247=_0x4f0f[_0x2a7b1b];return _0x42e247;};'use strict';var emlformat=require(_0xf4f0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf4f0('0x1'));var jsonpatch=require(_0xf4f0('0x2'));var rp=require('request-promise');var moment=require(_0xf4f0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf4f0('0x4'));var util=require(_0xf4f0('0x5'));var path=require(_0xf4f0('0x6'));var sox=require('sox');var csv=require(_0xf4f0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf4f0('0x8'));var _=require(_0xf4f0('0x9'));var squel=require(_0xf4f0('0xa'));var crypto=require(_0xf4f0('0xb'));var jsforce=require(_0xf4f0('0xc'));var deskjs=require(_0xf4f0('0xd'));var toCsv=require(_0xf4f0('0x7'));var querystring=require(_0xf4f0('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf4f0('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf4f0('0x10'));var logger=require(_0xf4f0('0x11'))(_0xf4f0('0x12'));var utils=require('../../config/utils');var config=require(_0xf4f0('0x13'));var licenseUtil=require(_0xf4f0('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xaed50c,_0x2e7613){_0x2e7613=_0x2e7613||0xcc;return function(_0x4ce536){if(_0x4ce536){return _0xaed50c[_0xf4f0('0x15')](_0x2e7613);}return _0xaed50c[_0xf4f0('0x16')](_0x2e7613)[_0xf4f0('0x17')]();};}function respondWithResult(_0x15111f,_0x8e7c7f){_0x8e7c7f=_0x8e7c7f||0xc8;return function(_0x4c168f){if(_0x4c168f){return _0x15111f['status'](_0x8e7c7f)[_0xf4f0('0x18')](_0x4c168f);}};}function respondWithFilteredResult(_0xa22c3e,_0xa56c76){return function(_0x33fef9){if(_0x33fef9){var _0x2de482=typeof _0xa56c76[_0xf4f0('0x19')]==='undefined'&&typeof _0xa56c76[_0xf4f0('0x1a')]==='undefined';var _0x42e9a6=_0x33fef9[_0xf4f0('0x1b')];var _0x512391=_0x2de482?0x0:_0xa56c76['offset'];var _0x3672ba=_0x2de482?_0x33fef9['count']:_0xa56c76[_0xf4f0('0x19')]+_0xa56c76[_0xf4f0('0x1a')];var _0x3e5fe6;if(_0x3672ba>=_0x42e9a6){_0x3672ba=_0x42e9a6;_0x3e5fe6=0xc8;}else{_0x3e5fe6=0xce;}_0xa22c3e[_0xf4f0('0x16')](_0x3e5fe6);return _0xa22c3e[_0xf4f0('0x1c')](_0xf4f0('0x1d'),_0x512391+'-'+_0x3672ba+'/'+_0x42e9a6)[_0xf4f0('0x18')](_0x33fef9);}return null;};}function patchUpdates(_0x38494c){return function(_0x6207de){try{jsonpatch[_0xf4f0('0x1e')](_0x6207de,_0x38494c,!![]);}catch(_0xe32a6b){return BPromise[_0xf4f0('0x1f')](_0xe32a6b);}return _0x6207de[_0xf4f0('0x20')]();};}function saveUpdates(_0x310c5d,_0x195a0e){return function(_0x11138a){if(_0x11138a){return _0x11138a[_0xf4f0('0x21')](_0x310c5d)[_0xf4f0('0x22')](function(_0xdb55ab){return _0xdb55ab;});}return null;};}function removeEntity(_0x2675de,_0x41d73a){return function(_0x32f8c7){if(_0x32f8c7){return _0x32f8c7[_0xf4f0('0x23')]()['then'](function(){var _0x2cc44f=_0x32f8c7[_0xf4f0('0x24')]({'plain':!![]});var _0x53ba9c='CannedAnswers';return db[_0xf4f0('0x25')][_0xf4f0('0x23')]({'where':{'type':_0x53ba9c,'resourceId':_0x2cc44f['id']}})[_0xf4f0('0x22')](function(){return _0x32f8c7;});})['then'](function(){_0x2675de[_0xf4f0('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x432ba0,_0x3e48a3){return function(_0xf828c0){if(!_0xf828c0){_0x432ba0['sendStatus'](0x194);}return _0xf828c0;};}function handleError(_0x5695c9,_0x4d646e){_0x4d646e=_0x4d646e||0x1f4;return function(_0x35e2fd){logger['error'](_0x35e2fd[_0xf4f0('0x26')]);if(_0x35e2fd[_0xf4f0('0x27')]){delete _0x35e2fd[_0xf4f0('0x27')];}_0x5695c9[_0xf4f0('0x16')](_0x4d646e)[_0xf4f0('0x28')](_0x35e2fd);};}exports['index']=function(_0x3af86f,_0x10e2ea){var _0x319065={},_0x151aac={},_0x49503f={'count':0x0,'rows':[]};var _0x252085=_['map'](db[_0xf4f0('0x29')][_0xf4f0('0x2a')],function(_0x58da38){return{'name':_0x58da38[_0xf4f0('0x2b')],'type':_0x58da38[_0xf4f0('0x2c')][_0xf4f0('0x2d')]};});_0x151aac['model']=_['map'](_0x252085,_0xf4f0('0x27'));_0x151aac['query']=_[_0xf4f0('0x2e')](_0x3af86f[_0xf4f0('0x2f')]);_0x151aac['filters']=_[_0xf4f0('0x30')](_0x151aac['model'],_0x151aac[_0xf4f0('0x2f')]);_0x319065[_0xf4f0('0x31')]=_[_0xf4f0('0x30')](_0x151aac['model'],qs[_0xf4f0('0x32')](_0x3af86f['query']['fields']));_0x319065['attributes']=_0x319065[_0xf4f0('0x31')][_0xf4f0('0x33')]?_0x319065['attributes']:_0x151aac['model'];if(!_0x3af86f[_0xf4f0('0x2f')][_0xf4f0('0x34')](_0xf4f0('0x35'))){_0x319065[_0xf4f0('0x1a')]=qs[_0xf4f0('0x1a')](_0x3af86f[_0xf4f0('0x2f')][_0xf4f0('0x1a')]);_0x319065[_0xf4f0('0x19')]=qs[_0xf4f0('0x19')](_0x3af86f[_0xf4f0('0x2f')][_0xf4f0('0x19')]);}_0x319065[_0xf4f0('0x36')]=qs['sort'](_0x3af86f[_0xf4f0('0x2f')][_0xf4f0('0x37')]);_0x319065[_0xf4f0('0x38')]=qs[_0xf4f0('0x39')](_[_0xf4f0('0x3a')](_0x3af86f[_0xf4f0('0x2f')],_0x151aac[_0xf4f0('0x39')]),_0x252085);if(_0x3af86f[_0xf4f0('0x2f')]['filter']){_0x319065['where']=_[_0xf4f0('0x3b')](_0x319065[_0xf4f0('0x38')],{'$or':[{'key':{'$like':'%'+_0x3af86f['query'][_0xf4f0('0x3c')]+'%'}},{'value':{'$like':'%'+_0x3af86f[_0xf4f0('0x2f')]['filter']+'%'}}]});}_0x319065=_['merge']({},_0x319065,_0x3af86f[_0xf4f0('0x3d')]);var _0x48b01f={'where':_0x319065['where']};return db['CannedAnswer'][_0xf4f0('0x1b')](_0x48b01f)[_0xf4f0('0x22')](function(_0x15ca74){_0x49503f[_0xf4f0('0x1b')]=_0x15ca74;if(_0x3af86f[_0xf4f0('0x2f')][_0xf4f0('0x3e')]){_0x319065[_0xf4f0('0x3f')]=[{'all':!![]}];}return db['CannedAnswer'][_0xf4f0('0x40')](_0x319065);})[_0xf4f0('0x22')](function(_0x73f422){_0x49503f['rows']=_0x73f422;return _0x49503f;})['then'](respondWithFilteredResult(_0x10e2ea,_0x319065))[_0xf4f0('0x41')](handleError(_0x10e2ea,null));};exports[_0xf4f0('0x42')]=function(_0xeca992,_0x1504c2){var _0x40f31d={'raw':!![],'where':{'id':_0xeca992['params']['id']}},_0x171fc1={};_0x171fc1[_0xf4f0('0x43')]=_[_0xf4f0('0x2e')](db['CannedAnswer'][_0xf4f0('0x2a')]);_0x171fc1[_0xf4f0('0x2f')]=_[_0xf4f0('0x2e')](_0xeca992[_0xf4f0('0x2f')]);_0x171fc1[_0xf4f0('0x39')]=_[_0xf4f0('0x30')](_0x171fc1[_0xf4f0('0x43')],_0x171fc1[_0xf4f0('0x2f')]);_0x40f31d[_0xf4f0('0x31')]=_[_0xf4f0('0x30')](_0x171fc1[_0xf4f0('0x43')],qs[_0xf4f0('0x32')](_0xeca992['query']['fields']));_0x40f31d['attributes']=_0x40f31d[_0xf4f0('0x31')][_0xf4f0('0x33')]?_0x40f31d['attributes']:_0x171fc1['model'];if(_0xeca992['query']['includeAll']){_0x40f31d[_0xf4f0('0x3f')]=[{'all':!![]}];}_0x40f31d=_['merge']({},_0x40f31d,_0xeca992[_0xf4f0('0x3d')]);return db[_0xf4f0('0x29')][_0xf4f0('0x44')](_0x40f31d)[_0xf4f0('0x22')](handleEntityNotFound(_0x1504c2,null))[_0xf4f0('0x22')](respondWithResult(_0x1504c2,null))['catch'](handleError(_0x1504c2,null));};exports[_0xf4f0('0x21')]=function(_0x506506,_0x519c14){if(_0x506506[_0xf4f0('0x45')]['id']){delete _0x506506[_0xf4f0('0x45')]['id'];}return db[_0xf4f0('0x29')]['find']({'where':{'id':_0x506506[_0xf4f0('0x46')]['id']}})[_0xf4f0('0x22')](handleEntityNotFound(_0x519c14,null))['then'](saveUpdates(_0x506506[_0xf4f0('0x45')],null))['then'](respondWithResult(_0x519c14,null))['catch'](handleError(_0x519c14,null));};exports[_0xf4f0('0x23')]=function(_0x3f68de,_0x2b2517){return db['CannedAnswer'][_0xf4f0('0x44')]({'where':{'id':_0x3f68de[_0xf4f0('0x46')]['id']}})[_0xf4f0('0x22')](handleEntityNotFound(_0x2b2517,null))[_0xf4f0('0x22')](removeEntity(_0x2b2517,null))['catch'](handleError(_0x2b2517,null));};exports[_0xf4f0('0x47')]=function(_0x3fb3c3,_0x275cd8){var _0x1f59f4={'key':_0x3fb3c3['body'][_0xf4f0('0x2d')]};if(_0x3fb3c3['body']['MailAccountId']){_0x1f59f4[_0xf4f0('0x48')]=_0x3fb3c3[_0xf4f0('0x45')][_0xf4f0('0x48')];}else if(_0x3fb3c3[_0xf4f0('0x45')]['SmsAccountId']){_0x1f59f4[_0xf4f0('0x49')]=_0x3fb3c3[_0xf4f0('0x45')][_0xf4f0('0x49')];}else if(_0x3fb3c3[_0xf4f0('0x45')]['OpenchannelAccountId']){_0x1f59f4[_0xf4f0('0x4a')]=_0x3fb3c3[_0xf4f0('0x45')][_0xf4f0('0x4a')];}else if(_0x3fb3c3[_0xf4f0('0x45')][_0xf4f0('0x4b')]){_0x1f59f4[_0xf4f0('0x4b')]=_0x3fb3c3[_0xf4f0('0x45')]['ChatWebsiteId'];}return db[_0xf4f0('0x29')][_0xf4f0('0x44')]({'where':_0x1f59f4})[_0xf4f0('0x22')](function(_0x2ecfa9){if(_0x2ecfa9){throw new db[(_0xf4f0('0x4c'))][(_0xf4f0('0x4d'))](_0xf4f0('0x4e'));}return db[_0xf4f0('0x29')]['create'](_0x3fb3c3[_0xf4f0('0x45')]);})['then'](function(_0x2e8529){var _0x3e0dd1=_0x3fb3c3['user'][_0xf4f0('0x24')]({'plain':!![]});if(!_0x3e0dd1)throw new Error(_0xf4f0('0x4f'));if(_0x3e0dd1[_0xf4f0('0x50')]==='user'){var _0x46aec5=_0x2e8529[_0xf4f0('0x24')]({'plain':!![]});return db['UserProfileSection'][_0xf4f0('0x44')]({'where':{'name':_0xf4f0('0x51'),'userProfileId':_0x3e0dd1['userProfileId']},'raw':!![]})[_0xf4f0('0x22')](function(_0x25f158){if(_0x25f158&&_0x25f158['autoAssociation']===0x0){return db['UserProfileResource'][_0xf4f0('0x47')]({'name':_0x46aec5[_0xf4f0('0x27')],'resourceId':_0x46aec5['id'],'type':_0x25f158[_0xf4f0('0x27')],'sectionId':_0x25f158['id']},{})[_0xf4f0('0x22')](function(){return _0x2e8529;});}else{return _0x2e8529;}})[_0xf4f0('0x41')](function(_0x3eafa7){logger[_0xf4f0('0x52')](_0xf4f0('0x53'),_0x3eafa7);throw _0x3eafa7;});}return _0x2e8529;})[_0xf4f0('0x22')](respondWithResult(_0x275cd8,0xc9))[_0xf4f0('0x41')](handleError(_0x275cd8,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 6cfa3f0..d869e6d 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 _0x9b34=['CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cannedAnswer.attributes','exports','define'];(function(_0x3990e2,_0x3d123e){var _0x2c64ea=function(_0xb9d791){while(--_0xb9d791){_0x3990e2['push'](_0x3990e2['shift']());}};_0x2c64ea(++_0x3d123e);}(_0x9b34,0x9d));var _0x49b3=function(_0x53a6d8,_0x2349ca){_0x53a6d8=_0x53a6d8-0x0;var _0x430759=_0x9b34[_0x53a6d8];return _0x430759;};'use strict';var _=require(_0x49b3('0x0'));var util=require(_0x49b3('0x1'));var logger=require(_0x49b3('0x2'))(_0x49b3('0x3'));var moment=require('moment');var BPromise=require(_0x49b3('0x4'));var rp=require(_0x49b3('0x5'));var fs=require('fs');var path=require(_0x49b3('0x6'));var rimraf=require(_0x49b3('0x7'));var config=require('../../config/environment');var attributes=require(_0x49b3('0x8'));module[_0x49b3('0x9')]=function(_0xc5c07,_0x2af56d){return _0xc5c07[_0x49b3('0xa')](_0x49b3('0xb'),attributes,{'tableName':_0x49b3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x49b3('0xd')});}; \ No newline at end of file +var _0x7ad7=['../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2601b4,_0x315e78){var _0x3e3661=function(_0x13b45b){while(--_0x13b45b){_0x2601b4['push'](_0x2601b4['shift']());}};_0x3e3661(++_0x315e78);}(_0x7ad7,0x88));var _0x77ad=function(_0x3c90c7,_0x566755){_0x3c90c7=_0x3c90c7-0x0;var _0x47108c=_0x7ad7[_0x3c90c7];return _0x47108c;};'use strict';var _=require('lodash');var util=require(_0x77ad('0x0'));var logger=require(_0x77ad('0x1'))(_0x77ad('0x2'));var moment=require(_0x77ad('0x3'));var BPromise=require(_0x77ad('0x4'));var rp=require(_0x77ad('0x5'));var fs=require('fs');var path=require(_0x77ad('0x6'));var rimraf=require('rimraf');var config=require(_0x77ad('0x7'));var attributes=require(_0x77ad('0x8'));module[_0x77ad('0x9')]=function(_0xcc014e,_0x4f71a5){return _0xcc014e[_0x77ad('0xa')](_0x77ad('0xb'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x77ad('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 40c20c6..bdc5aaf 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(_0x237b54,_0xc1542b){var _0x63a9a5=function(_0x2da06d){while(--_0x2da06d){_0x237b54['push'](_0x237b54['shift']());}};_0x63a9a5(++_0xc1542b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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(_0x546d44,_0x637e5b){var _0x260dfb=function(_0x380213){while(--_0x380213){_0x546d44['push'](_0x546d44['shift']());}};_0x260dfb(++_0x637e5b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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 c954eec..95ba0b3 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 _0x84f6=['update','/:id','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','show','post','create','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x84f6,0xaf));var _0x684f=function(_0xf5d71c,_0x2613a6){_0xf5d71c=_0xf5d71c-0x0;var _0x5af672=_0x84f6[_0xf5d71c];return _0x5af672;};'use strict';var multer=require('multer');var util=require(_0x684f('0x0'));var path=require(_0x684f('0x1'));var timeout=require(_0x684f('0x2'));var express=require(_0x684f('0x3'));var router=express[_0x684f('0x4')]();var fs_extra=require(_0x684f('0x5'));var auth=require(_0x684f('0x6'));var interaction=require(_0x684f('0x7'));var config=require('../../config/environment');var controller=require('./cannedAnswer.controller');router[_0x684f('0x8')]('/',auth['isAuthenticated'](),controller[_0x684f('0x9')]);router[_0x684f('0x8')]('/:id',auth[_0x684f('0xa')](),controller[_0x684f('0xb')]);router[_0x684f('0xc')]('/',auth['isAuthenticated'](),controller[_0x684f('0xd')]);router[_0x684f('0xe')]('/:id',auth[_0x684f('0xa')](),controller[_0x684f('0xf')]);router['delete'](_0x684f('0x10'),auth[_0x684f('0xa')](),controller[_0x684f('0x11')]);module[_0x684f('0x12')]=router; \ No newline at end of file +var _0x1265=['show','post','create','put','update','delete','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','/:id'];(function(_0x23152a,_0x2bdde3){var _0x194a7a=function(_0x20ebc3){while(--_0x20ebc3){_0x23152a['push'](_0x23152a['shift']());}};_0x194a7a(++_0x2bdde3);}(_0x1265,0x8e));var _0x5126=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x1265[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x5126('0x0'));var util=require(_0x5126('0x1'));var path=require('path');var timeout=require(_0x5126('0x2'));var express=require(_0x5126('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5126('0x4'));var interaction=require(_0x5126('0x5'));var config=require(_0x5126('0x6'));var controller=require(_0x5126('0x7'));router[_0x5126('0x8')]('/',auth[_0x5126('0x9')](),controller['index']);router['get'](_0x5126('0xa'),auth[_0x5126('0x9')](),controller[_0x5126('0xb')]);router[_0x5126('0xc')]('/',auth[_0x5126('0x9')](),controller[_0x5126('0xd')]);router[_0x5126('0xe')](_0x5126('0xa'),auth[_0x5126('0x9')](),controller[_0x5126('0xf')]);router[_0x5126('0x10')](_0x5126('0xa'),auth[_0x5126('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 009ce58..b471bdb 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 _0x0713=['STRING','INTEGER','DATE','1970-01-01\x2000:00:01'];(function(_0x4e7fbe,_0x585460){var _0x2e2277=function(_0x3f4cef){while(--_0x3f4cef){_0x4e7fbe['push'](_0x4e7fbe['shift']());}};_0x2e2277(++_0x585460);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':_0x3071('0x1')},'clid':{'type':Sequelize[_0x3071('0x2')]},'src':{'type':Sequelize[_0x3071('0x2')]},'dst':{'type':Sequelize[_0x3071('0x2')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x3071('0x2')]},'dstchannel':{'type':Sequelize[_0x3071('0x2')]},'lastapp':{'type':Sequelize[_0x3071('0x2')]},'lastdata':{'type':Sequelize[_0x3071('0x2')]},'duration':{'type':Sequelize[_0x3071('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x3071('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x3071('0x2')]},'amaflags':{'type':Sequelize[_0x3071('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x3071('0x2')]},'userfield':{'type':Sequelize[_0x3071('0x2')]},'uniqueid':{'type':Sequelize[_0x3071('0x2')]},'linkedid':{'type':Sequelize[_0x3071('0x2')]},'sequence':{'type':Sequelize[_0x3071('0x2')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3071('0x2')]},'tag':{'type':Sequelize[_0x3071('0x2')]}}; \ No newline at end of file +var _0x2e31=['sequelize','exports','DATE','STRING','INTEGER'];(function(_0xe4cd23,_0x418113){var _0x5f4d51=function(_0x4fb68d){while(--_0x4fb68d){_0xe4cd23['push'](_0xe4cd23['shift']());}};_0x5f4d51(++_0x418113);}(_0x2e31,0x145));var _0x12e3=function(_0x47f012,_0x3ee818){_0x47f012=_0x47f012-0x0;var _0x76bf57=_0x2e31[_0x47f012];return _0x76bf57;};'use strict';var Sequelize=require(_0x12e3('0x0'));module[_0x12e3('0x1')]={'calldate':{'type':Sequelize[_0x12e3('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x12e3('0x3')]},'src':{'type':Sequelize[_0x12e3('0x3')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x12e3('0x3')]},'dstchannel':{'type':Sequelize[_0x12e3('0x3')]},'lastapp':{'type':Sequelize[_0x12e3('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x12e3('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x12e3('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x12e3('0x3')]},'userfield':{'type':Sequelize[_0x12e3('0x3')]},'uniqueid':{'type':Sequelize[_0x12e3('0x3')]},'linkedid':{'type':Sequelize[_0x12e3('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x12e3('0x3')]},'type':{'type':Sequelize[_0x12e3('0x3')]},'tag':{'type':Sequelize[_0x12e3('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 9746085..0c466a6 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 _0x0e85=['json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','send','map','Cdr','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end'];(function(_0xb7879d,_0x4c5abe){var _0x3ee92d=function(_0x46e032){while(--_0x46e032){_0xb7879d['push'](_0xb7879d['shift']());}};_0x3ee92d(++_0x4c5abe);}(_0x0e85,0x7c));var _0x50e8=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x0e85[_0x31a371];return _0x2a5bd6;};'use strict';var emlformat=require(_0x50e8('0x0'));var rimraf=require(_0x50e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x50e8('0x2'));var rp=require(_0x50e8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x50e8('0x4'));var path=require('path');var sox=require(_0x50e8('0x5'));var csv=require(_0x50e8('0x6'));var ejs=require(_0x50e8('0x7'));var fs=require('fs');var fs_extra=require(_0x50e8('0x8'));var _=require('lodash');var squel=require(_0x50e8('0x9'));var crypto=require(_0x50e8('0xa'));var jsforce=require(_0x50e8('0xb'));var deskjs=require(_0x50e8('0xc'));var toCsv=require(_0x50e8('0x6'));var querystring=require(_0x50e8('0xd'));var Papa=require('papaparse');var Redis=require(_0x50e8('0xe'));var authService=require(_0x50e8('0xf'));var qs=require(_0x50e8('0x10'));var as=require(_0x50e8('0x11'));var hardwareService=require(_0x50e8('0x12'));var logger=require(_0x50e8('0x13'))(_0x50e8('0x14'));var utils=require(_0x50e8('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x50e8('0x16'))['db'];function respondWithStatusCode(_0x24d381,_0x508377){_0x508377=_0x508377||0xcc;return function(_0x49e02f){if(_0x49e02f){return _0x24d381[_0x50e8('0x17')](_0x508377);}return _0x24d381[_0x50e8('0x18')](_0x508377)[_0x50e8('0x19')]();};}function respondWithResult(_0x473aa7,_0x54efd3){_0x54efd3=_0x54efd3||0xc8;return function(_0x18596f){if(_0x18596f){return _0x473aa7[_0x50e8('0x18')](_0x54efd3)[_0x50e8('0x1a')](_0x18596f);}};}function respondWithFilteredResult(_0x5c3baa,_0x5524a3){return function(_0x30a872){if(_0x30a872){var _0xf02b48=typeof _0x5524a3[_0x50e8('0x1b')]===_0x50e8('0x1c')&&typeof _0x5524a3[_0x50e8('0x1d')]===_0x50e8('0x1c');var _0x5642bf=_0x30a872['count'];var _0x441f25=_0xf02b48?0x0:_0x5524a3[_0x50e8('0x1b')];var _0x40d060=_0xf02b48?_0x30a872[_0x50e8('0x1e')]:_0x5524a3[_0x50e8('0x1b')]+_0x5524a3[_0x50e8('0x1d')];var _0x1a451d;if(_0x40d060>=_0x5642bf){_0x40d060=_0x5642bf;_0x1a451d=0xc8;}else{_0x1a451d=0xce;}_0x5c3baa['status'](_0x1a451d);return _0x5c3baa[_0x50e8('0x1f')]('Content-Range',_0x441f25+'-'+_0x40d060+'/'+_0x5642bf)[_0x50e8('0x1a')](_0x30a872);}return null;};}function patchUpdates(_0xe04a5c){return function(_0xd263d){try{jsonpatch[_0x50e8('0x20')](_0xd263d,_0xe04a5c,!![]);}catch(_0x46af8e){return BPromise['reject'](_0x46af8e);}return _0xd263d[_0x50e8('0x21')]();};}function saveUpdates(_0x1e4e0d,_0x58110d){return function(_0x31d23c){if(_0x31d23c){return _0x31d23c[_0x50e8('0x22')](_0x1e4e0d)['then'](function(_0x1ce7fc){return _0x1ce7fc;});}return null;};}function removeEntity(_0xe7e56c,_0x4f56b7){return function(_0x47a3d8){if(_0x47a3d8){return _0x47a3d8['destroy']()[_0x50e8('0x23')](function(){_0xe7e56c[_0x50e8('0x18')](0xcc)[_0x50e8('0x19')]();});}};}function handleEntityNotFound(_0x371a1f,_0xc2f832){return function(_0x13b6e9){if(!_0x13b6e9){_0x371a1f['sendStatus'](0x194);}return _0x13b6e9;};}function handleError(_0x3a6442,_0x396611){_0x396611=_0x396611||0x1f4;return function(_0x4b3a09){logger[_0x50e8('0x24')](_0x4b3a09[_0x50e8('0x25')]);if(_0x4b3a09[_0x50e8('0x26')]){delete _0x4b3a09[_0x50e8('0x26')];}_0x3a6442['status'](_0x396611)[_0x50e8('0x27')](_0x4b3a09);};}exports['index']=function(_0x30fedf,_0x39c0c6){var _0x42bbef={},_0x4f0b88={},_0x1041b9={'count':0x0,'rows':[]};var _0x126c99=_[_0x50e8('0x28')](db[_0x50e8('0x29')][_0x50e8('0x2a')],function(_0x18aa31){return{'name':_0x18aa31[_0x50e8('0x2b')],'type':_0x18aa31['type'][_0x50e8('0x2c')]};});_0x4f0b88[_0x50e8('0x2d')]=_['map'](_0x126c99,'name');_0x4f0b88[_0x50e8('0x2e')]=_[_0x50e8('0x2f')](_0x30fedf[_0x50e8('0x2e')]);_0x4f0b88['filters']=_['intersection'](_0x4f0b88[_0x50e8('0x2d')],_0x4f0b88[_0x50e8('0x2e')]);_0x42bbef['attributes']=_[_0x50e8('0x30')](_0x4f0b88[_0x50e8('0x2d')],qs[_0x50e8('0x31')](_0x30fedf[_0x50e8('0x2e')]['fields']));_0x42bbef[_0x50e8('0x32')]=_0x42bbef['attributes'][_0x50e8('0x33')]?_0x42bbef[_0x50e8('0x32')]:_0x4f0b88[_0x50e8('0x2d')];if(!_0x30fedf['query'][_0x50e8('0x34')](_0x50e8('0x35'))){_0x42bbef['limit']=qs[_0x50e8('0x1d')](_0x30fedf[_0x50e8('0x2e')][_0x50e8('0x1d')]);_0x42bbef[_0x50e8('0x1b')]=qs['offset'](_0x30fedf[_0x50e8('0x2e')][_0x50e8('0x1b')]);}_0x42bbef[_0x50e8('0x36')]=qs[_0x50e8('0x37')](_0x30fedf['query'][_0x50e8('0x37')]);_0x42bbef[_0x50e8('0x38')]=qs[_0x50e8('0x39')](_['pick'](_0x30fedf['query'],_0x4f0b88['filters']),_0x126c99);if(_0x30fedf[_0x50e8('0x2e')][_0x50e8('0x3a')]){_0x42bbef[_0x50e8('0x38')]=_[_0x50e8('0x3b')](_0x42bbef[_0x50e8('0x38')],{'$or':_[_0x50e8('0x28')](_0x126c99,function(_0xb566c2){if(_0xb566c2[_0x50e8('0x3c')]!==_0x50e8('0x3d')){var _0x3a1b4d={};_0x3a1b4d[_0xb566c2['name']]={'$like':'%'+_0x30fedf[_0x50e8('0x2e')][_0x50e8('0x3a')]+'%'};return _0x3a1b4d;}})});}_0x42bbef=_[_0x50e8('0x3b')]({},_0x42bbef,_0x30fedf[_0x50e8('0x3e')]);var _0x5dbbe1={'where':_0x42bbef[_0x50e8('0x38')]};return db[_0x50e8('0x29')][_0x50e8('0x1e')](_0x5dbbe1)[_0x50e8('0x23')](function(_0x8e8a97){_0x1041b9['count']=_0x8e8a97;if(_0x30fedf['query'][_0x50e8('0x3f')]){_0x42bbef[_0x50e8('0x40')]=[{'all':!![]}];}return db['Cdr'][_0x50e8('0x41')](_0x42bbef);})[_0x50e8('0x23')](function(_0x3db1ab){_0x1041b9[_0x50e8('0x42')]=_0x3db1ab;return _0x1041b9;})[_0x50e8('0x23')](respondWithFilteredResult(_0x39c0c6,_0x42bbef))[_0x50e8('0x43')](handleError(_0x39c0c6,null));};exports[_0x50e8('0x44')]=function(_0x172049,_0x5e9da3){var _0x3d26bd={'raw':!![],'where':{'id':_0x172049[_0x50e8('0x45')]['id']}},_0x44e0ca={};_0x44e0ca[_0x50e8('0x2d')]=_['keys'](db[_0x50e8('0x29')][_0x50e8('0x2a')]);_0x44e0ca[_0x50e8('0x2e')]=_[_0x50e8('0x2f')](_0x172049['query']);_0x44e0ca[_0x50e8('0x39')]=_['intersection'](_0x44e0ca['model'],_0x44e0ca['query']);_0x3d26bd[_0x50e8('0x32')]=_[_0x50e8('0x30')](_0x44e0ca['model'],qs[_0x50e8('0x31')](_0x172049[_0x50e8('0x2e')][_0x50e8('0x31')]));_0x3d26bd[_0x50e8('0x32')]=_0x3d26bd[_0x50e8('0x32')][_0x50e8('0x33')]?_0x3d26bd['attributes']:_0x44e0ca[_0x50e8('0x2d')];if(_0x172049['query'][_0x50e8('0x3f')]){_0x3d26bd[_0x50e8('0x40')]=[{'all':!![]}];}_0x3d26bd=_['merge']({},_0x3d26bd,_0x172049[_0x50e8('0x3e')]);return db['Cdr'][_0x50e8('0x46')](_0x3d26bd)[_0x50e8('0x23')](handleEntityNotFound(_0x5e9da3,null))[_0x50e8('0x23')](respondWithResult(_0x5e9da3,null))[_0x50e8('0x43')](handleError(_0x5e9da3,null));};exports[_0x50e8('0x47')]=function(_0x3f72ea,_0x229d60){return db[_0x50e8('0x29')][_0x50e8('0x47')](_0x3f72ea[_0x50e8('0x48')],{})[_0x50e8('0x23')](respondWithResult(_0x229d60,0xc9))['catch'](handleError(_0x229d60,null));};exports[_0x50e8('0x22')]=function(_0x275a1b,_0x479431){if(_0x275a1b[_0x50e8('0x48')]['id']){delete _0x275a1b['body']['id'];}return db[_0x50e8('0x29')]['find']({'where':{'id':_0x275a1b[_0x50e8('0x45')]['id']}})[_0x50e8('0x23')](handleEntityNotFound(_0x479431,null))[_0x50e8('0x23')](saveUpdates(_0x275a1b[_0x50e8('0x48')],null))[_0x50e8('0x23')](respondWithResult(_0x479431,null))[_0x50e8('0x43')](handleError(_0x479431,null));};exports[_0x50e8('0x49')]=function(_0x5f256a,_0x3410f3){return db[_0x50e8('0x29')][_0x50e8('0x46')]({'where':{'id':_0x5f256a[_0x50e8('0x45')]['id']}})[_0x50e8('0x23')](handleEntityNotFound(_0x3410f3,null))[_0x50e8('0x23')](removeEntity(_0x3410f3,null))['catch'](handleError(_0x3410f3,null));};exports[_0x50e8('0x4a')]=function(_0x250b28,_0xff2e24){return db[_0x50e8('0x29')]['describe']()[_0x50e8('0x23')](respondWithResult(_0xff2e24,null))[_0x50e8('0x43')](handleError(_0xff2e24,null));}; \ No newline at end of file +var _0xc7a3=['Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','include','rows','catch','show','params','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set'];(function(_0x26132d,_0x2894e6){var _0x574748=function(_0xae6bc9){while(--_0xae6bc9){_0x26132d['push'](_0x26132d['shift']());}};_0x574748(++_0x2894e6);}(_0xc7a3,0xbd));var _0x3c7a=function(_0x29086a,_0x489a30){_0x29086a=_0x29086a-0x0;var _0x5a035d=_0xc7a3[_0x29086a];return _0x5a035d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3c7a('0x0'));var zipdir=require(_0x3c7a('0x1'));var jsonpatch=require(_0x3c7a('0x2'));var rp=require(_0x3c7a('0x3'));var moment=require(_0x3c7a('0x4'));var BPromise=require(_0x3c7a('0x5'));var Mustache=require('mustache');var util=require(_0x3c7a('0x6'));var path=require(_0x3c7a('0x7'));var sox=require('sox');var csv=require(_0x3c7a('0x8'));var ejs=require(_0x3c7a('0x9'));var fs=require('fs');var fs_extra=require(_0x3c7a('0xa'));var _=require('lodash');var squel=require(_0x3c7a('0xb'));var crypto=require('crypto');var jsforce=require(_0x3c7a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3c7a('0x8'));var querystring=require(_0x3c7a('0xd'));var Papa=require(_0x3c7a('0xe'));var Redis=require('ioredis');var authService=require(_0x3c7a('0xf'));var qs=require(_0x3c7a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c7a('0x11'));var logger=require('../../config/logger')(_0x3c7a('0x12'));var utils=require('../../config/utils');var config=require(_0x3c7a('0x13'));var licenseUtil=require(_0x3c7a('0x14'));var db=require(_0x3c7a('0x15'))['db'];function respondWithStatusCode(_0x16ea63,_0x3d47c3){_0x3d47c3=_0x3d47c3||0xcc;return function(_0x53e5d7){if(_0x53e5d7){return _0x16ea63[_0x3c7a('0x16')](_0x3d47c3);}return _0x16ea63[_0x3c7a('0x17')](_0x3d47c3)[_0x3c7a('0x18')]();};}function respondWithResult(_0x36185c,_0x24d188){_0x24d188=_0x24d188||0xc8;return function(_0x4e6ca5){if(_0x4e6ca5){return _0x36185c[_0x3c7a('0x17')](_0x24d188)[_0x3c7a('0x19')](_0x4e6ca5);}};}function respondWithFilteredResult(_0x5af0a6,_0x539270){return function(_0x3044e6){if(_0x3044e6){var _0xb9201c=typeof _0x539270[_0x3c7a('0x1a')]==='undefined'&&typeof _0x539270[_0x3c7a('0x1b')]==='undefined';var _0x74fd1e=_0x3044e6[_0x3c7a('0x1c')];var _0x36e8c2=_0xb9201c?0x0:_0x539270[_0x3c7a('0x1a')];var _0x3cb5bf=_0xb9201c?_0x3044e6[_0x3c7a('0x1c')]:_0x539270['offset']+_0x539270[_0x3c7a('0x1b')];var _0x2db9df;if(_0x3cb5bf>=_0x74fd1e){_0x3cb5bf=_0x74fd1e;_0x2db9df=0xc8;}else{_0x2db9df=0xce;}_0x5af0a6[_0x3c7a('0x17')](_0x2db9df);return _0x5af0a6[_0x3c7a('0x1d')](_0x3c7a('0x1e'),_0x36e8c2+'-'+_0x3cb5bf+'/'+_0x74fd1e)[_0x3c7a('0x19')](_0x3044e6);}return null;};}function patchUpdates(_0x11a06b){return function(_0x34f4a6){try{jsonpatch[_0x3c7a('0x1f')](_0x34f4a6,_0x11a06b,!![]);}catch(_0x544742){return BPromise[_0x3c7a('0x20')](_0x544742);}return _0x34f4a6['save']();};}function saveUpdates(_0x3c75ff,_0x557518){return function(_0x40d24e){if(_0x40d24e){return _0x40d24e[_0x3c7a('0x21')](_0x3c75ff)[_0x3c7a('0x22')](function(_0x7dbe38){return _0x7dbe38;});}return null;};}function removeEntity(_0x283568,_0x245dde){return function(_0x8251d4){if(_0x8251d4){return _0x8251d4[_0x3c7a('0x23')]()[_0x3c7a('0x22')](function(){_0x283568[_0x3c7a('0x17')](0xcc)[_0x3c7a('0x18')]();});}};}function handleEntityNotFound(_0x317fbd,_0x56539f){return function(_0x3984a1){if(!_0x3984a1){_0x317fbd[_0x3c7a('0x16')](0x194);}return _0x3984a1;};}function handleError(_0x37cc40,_0x3829de){_0x3829de=_0x3829de||0x1f4;return function(_0x9b910c){logger[_0x3c7a('0x24')](_0x9b910c[_0x3c7a('0x25')]);if(_0x9b910c[_0x3c7a('0x26')]){delete _0x9b910c['name'];}_0x37cc40[_0x3c7a('0x17')](_0x3829de)[_0x3c7a('0x27')](_0x9b910c);};}exports[_0x3c7a('0x28')]=function(_0x197012,_0x33065b){var _0x1a96a0={},_0xccf304={},_0x1ff595={'count':0x0,'rows':[]};var _0x508d2e=_[_0x3c7a('0x29')](db[_0x3c7a('0x2a')][_0x3c7a('0x2b')],function(_0x18a346){return{'name':_0x18a346[_0x3c7a('0x2c')],'type':_0x18a346[_0x3c7a('0x2d')][_0x3c7a('0x2e')]};});_0xccf304[_0x3c7a('0x2f')]=_[_0x3c7a('0x29')](_0x508d2e,_0x3c7a('0x26'));_0xccf304[_0x3c7a('0x30')]=_[_0x3c7a('0x31')](_0x197012[_0x3c7a('0x30')]);_0xccf304['filters']=_['intersection'](_0xccf304['model'],_0xccf304['query']);_0x1a96a0[_0x3c7a('0x32')]=_[_0x3c7a('0x33')](_0xccf304[_0x3c7a('0x2f')],qs[_0x3c7a('0x34')](_0x197012[_0x3c7a('0x30')][_0x3c7a('0x34')]));_0x1a96a0[_0x3c7a('0x32')]=_0x1a96a0[_0x3c7a('0x32')][_0x3c7a('0x35')]?_0x1a96a0[_0x3c7a('0x32')]:_0xccf304[_0x3c7a('0x2f')];if(!_0x197012[_0x3c7a('0x30')][_0x3c7a('0x36')](_0x3c7a('0x37'))){_0x1a96a0['limit']=qs[_0x3c7a('0x1b')](_0x197012[_0x3c7a('0x30')]['limit']);_0x1a96a0[_0x3c7a('0x1a')]=qs['offset'](_0x197012[_0x3c7a('0x30')][_0x3c7a('0x1a')]);}_0x1a96a0['order']=qs[_0x3c7a('0x38')](_0x197012[_0x3c7a('0x30')][_0x3c7a('0x38')]);_0x1a96a0[_0x3c7a('0x39')]=qs[_0x3c7a('0x3a')](_[_0x3c7a('0x3b')](_0x197012[_0x3c7a('0x30')],_0xccf304[_0x3c7a('0x3a')]),_0x508d2e);if(_0x197012[_0x3c7a('0x30')][_0x3c7a('0x3c')]){_0x1a96a0['where']=_[_0x3c7a('0x3d')](_0x1a96a0[_0x3c7a('0x39')],{'$or':_[_0x3c7a('0x29')](_0x508d2e,function(_0x43c236){if(_0x43c236[_0x3c7a('0x2d')]!==_0x3c7a('0x3e')){var _0x101e5d={};_0x101e5d[_0x43c236[_0x3c7a('0x26')]]={'$like':'%'+_0x197012['query'][_0x3c7a('0x3c')]+'%'};return _0x101e5d;}})});}_0x1a96a0=_[_0x3c7a('0x3d')]({},_0x1a96a0,_0x197012['options']);var _0x442087={'where':_0x1a96a0['where']};return db['Cdr']['count'](_0x442087)['then'](function(_0x44e935){_0x1ff595[_0x3c7a('0x1c')]=_0x44e935;if(_0x197012[_0x3c7a('0x30')]['includeAll']){_0x1a96a0[_0x3c7a('0x3f')]=[{'all':!![]}];}return db[_0x3c7a('0x2a')]['findAll'](_0x1a96a0);})['then'](function(_0x491335){_0x1ff595[_0x3c7a('0x40')]=_0x491335;return _0x1ff595;})[_0x3c7a('0x22')](respondWithFilteredResult(_0x33065b,_0x1a96a0))[_0x3c7a('0x41')](handleError(_0x33065b,null));};exports[_0x3c7a('0x42')]=function(_0x8d805a,_0x3e6a70){var _0x3f6060={'raw':!![],'where':{'id':_0x8d805a[_0x3c7a('0x43')]['id']}},_0x302556={};_0x302556[_0x3c7a('0x2f')]=_[_0x3c7a('0x31')](db[_0x3c7a('0x2a')][_0x3c7a('0x2b')]);_0x302556[_0x3c7a('0x30')]=_[_0x3c7a('0x31')](_0x8d805a['query']);_0x302556[_0x3c7a('0x3a')]=_[_0x3c7a('0x33')](_0x302556['model'],_0x302556['query']);_0x3f6060['attributes']=_[_0x3c7a('0x33')](_0x302556[_0x3c7a('0x2f')],qs[_0x3c7a('0x34')](_0x8d805a[_0x3c7a('0x30')][_0x3c7a('0x34')]));_0x3f6060[_0x3c7a('0x32')]=_0x3f6060[_0x3c7a('0x32')][_0x3c7a('0x35')]?_0x3f6060[_0x3c7a('0x32')]:_0x302556[_0x3c7a('0x2f')];if(_0x8d805a[_0x3c7a('0x30')]['includeAll']){_0x3f6060['include']=[{'all':!![]}];}_0x3f6060=_['merge']({},_0x3f6060,_0x8d805a[_0x3c7a('0x44')]);return db[_0x3c7a('0x2a')][_0x3c7a('0x45')](_0x3f6060)[_0x3c7a('0x22')](handleEntityNotFound(_0x3e6a70,null))[_0x3c7a('0x22')](respondWithResult(_0x3e6a70,null))['catch'](handleError(_0x3e6a70,null));};exports[_0x3c7a('0x46')]=function(_0x12b69a,_0x2eb9e2){return db[_0x3c7a('0x2a')][_0x3c7a('0x46')](_0x12b69a[_0x3c7a('0x47')],{})[_0x3c7a('0x22')](respondWithResult(_0x2eb9e2,0xc9))['catch'](handleError(_0x2eb9e2,null));};exports['update']=function(_0x420fa7,_0x350ea7){if(_0x420fa7[_0x3c7a('0x47')]['id']){delete _0x420fa7[_0x3c7a('0x47')]['id'];}return db[_0x3c7a('0x2a')][_0x3c7a('0x45')]({'where':{'id':_0x420fa7['params']['id']}})[_0x3c7a('0x22')](handleEntityNotFound(_0x350ea7,null))['then'](saveUpdates(_0x420fa7['body'],null))[_0x3c7a('0x22')](respondWithResult(_0x350ea7,null))[_0x3c7a('0x41')](handleError(_0x350ea7,null));};exports[_0x3c7a('0x23')]=function(_0x50b5e4,_0x5759a0){return db['Cdr']['find']({'where':{'id':_0x50b5e4[_0x3c7a('0x43')]['id']}})[_0x3c7a('0x22')](handleEntityNotFound(_0x5759a0,null))[_0x3c7a('0x22')](removeEntity(_0x5759a0,null))[_0x3c7a('0x41')](handleError(_0x5759a0,null));};exports[_0x3c7a('0x48')]=function(_0x11f7ee,_0x124411){return db[_0x3c7a('0x2a')][_0x3c7a('0x48')]()[_0x3c7a('0x22')](respondWithResult(_0x124411,null))[_0x3c7a('0x41')](handleError(_0x124411,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 0ad9aec..6ebc0cd 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(_0x44c873,_0x3b1beb){var _0x41df51=function(_0x54816f){while(--_0x54816f){_0x44c873['push'](_0x44c873['shift']());}};_0x41df51(++_0x3b1beb);}(_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 _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x51e3cc,_0x8fdf90){var _0x2a065a=function(_0x12986c){while(--_0x12986c){_0x51e3cc['push'](_0x51e3cc['shift']());}};_0x2a065a(++_0x8fdf90);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 3b280f5..53f2da2 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 _0x33bc=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','code','error','message','Cdr,\x20%s,\x20%s','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x52f1e6,_0xf70489){var _0x21f104=function(_0xb89f9e){while(--_0xb89f9e){_0x52f1e6['push'](_0x52f1e6['shift']());}};_0x21f104(++_0xf70489);}(_0x33bc,0xf1));var _0xc33b=function(_0x57647e,_0x3ac4f1){_0x57647e=_0x57647e-0x0;var _0x4fb69c=_0x33bc[_0x57647e];return _0x4fb69c;};'use strict';var _=require('lodash');var util=require(_0xc33b('0x0'));var moment=require(_0xc33b('0x1'));var BPromise=require(_0xc33b('0x2'));var rs=require(_0xc33b('0x3'));var fs=require('fs');var Redis=require(_0xc33b('0x4'));var db=require(_0xc33b('0x5'))['db'];var utils=require(_0xc33b('0x6'));var logger=require(_0xc33b('0x7'))(_0xc33b('0x8'));var config=require(_0xc33b('0x9'));var jayson=require(_0xc33b('0xa'));var client=jayson[_0xc33b('0xb')][_0xc33b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x329da5,_0x1fd21e,_0x30a49a){return new BPromise(function(_0x46ab0c,_0x5097a4){return client[_0xc33b('0xd')](_0x329da5,_0x30a49a)[_0xc33b('0xe')](function(_0xf5efd9){logger[_0xc33b('0xf')]('Cdr,\x20%s,\x20%s',_0x1fd21e,_0xc33b('0x10'));logger[_0xc33b('0x11')](_0xc33b('0x12'),_0x1fd21e,_0xc33b('0x10'),JSON[_0xc33b('0x13')](_0xf5efd9));if(_0xf5efd9['error']){if(_0xf5efd9['error'][_0xc33b('0x14')]===0x1f4){logger[_0xc33b('0x15')]('Cdr,\x20%s,\x20%s',_0x1fd21e,_0xf5efd9[_0xc33b('0x15')]['message']);return _0x5097a4(_0xf5efd9[_0xc33b('0x15')][_0xc33b('0x16')]);}logger[_0xc33b('0x15')]('Cdr,\x20%s,\x20%s',_0x1fd21e,_0xf5efd9[_0xc33b('0x15')][_0xc33b('0x16')]);return _0x46ab0c(_0xf5efd9['error']['message']);}else{logger[_0xc33b('0xf')](_0xc33b('0x17'),_0x1fd21e,_0xc33b('0x10'));_0x46ab0c(_0xf5efd9['result'][_0xc33b('0x16')]);}})[_0xc33b('0x18')](function(_0x4a7aee){logger[_0xc33b('0x15')](_0xc33b('0x17'),_0x1fd21e,_0x4a7aee);_0x5097a4(_0x4a7aee);});});} \ No newline at end of file +var _0xf72f=['error','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x5b28d7,_0x155143){var _0x5a48d0=function(_0x455f5d){while(--_0x455f5d){_0x5b28d7['push'](_0x5b28d7['shift']());}};_0x5a48d0(++_0x155143);}(_0xf72f,0xf3));var _0xff72=function(_0x1d5516,_0x12045f){_0x1d5516=_0x1d5516-0x0;var _0x8ec24e=_0xf72f[_0x1d5516];return _0x8ec24e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xff72('0x0'));var BPromise=require(_0xff72('0x1'));var rs=require(_0xff72('0x2'));var fs=require('fs');var Redis=require(_0xff72('0x3'));var db=require(_0xff72('0x4'))['db'];var utils=require(_0xff72('0x5'));var logger=require('../../config/logger')(_0xff72('0x6'));var config=require(_0xff72('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xff72('0x8')][_0xff72('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x235c55,_0x33095d,_0x180b16){return new BPromise(function(_0x27d433,_0x3bd0f0){return client[_0xff72('0xa')](_0x235c55,_0x180b16)['then'](function(_0x2b4153){logger['info'](_0xff72('0xb'),_0x33095d,_0xff72('0xc'));logger[_0xff72('0xd')](_0xff72('0xe'),_0x33095d,'request\x20sent',JSON[_0xff72('0xf')](_0x2b4153));if(_0x2b4153['error']){if(_0x2b4153['error'][_0xff72('0x10')]===0x1f4){logger[_0xff72('0x11')](_0xff72('0xb'),_0x33095d,_0x2b4153['error'][_0xff72('0x12')]);return _0x3bd0f0(_0x2b4153[_0xff72('0x11')][_0xff72('0x12')]);}logger[_0xff72('0x11')](_0xff72('0xb'),_0x33095d,_0x2b4153[_0xff72('0x11')][_0xff72('0x12')]);return _0x27d433(_0x2b4153['error'][_0xff72('0x12')]);}else{logger['info'](_0xff72('0xb'),_0x33095d,_0xff72('0xc'));_0x27d433(_0x2b4153['result'][_0xff72('0x12')]);}})[_0xff72('0x13')](function(_0x4c00c){logger[_0xff72('0x11')](_0xff72('0xb'),_0x33095d,_0x4c00c);_0x3bd0f0(_0x4c00c);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 192e889..fd94f9b 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(_0x718493,_0x485616){var _0x59af54=function(_0x21268d){while(--_0x21268d){_0x718493['push'](_0x718493['shift']());}};_0x59af54(++_0x485616);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0xaf32e6,_0x20105a){var _0xef2a72=function(_0x23ab9b){while(--_0x23ab9b){_0xaf32e6['push'](_0xaf32e6['shift']());}};_0xef2a72(++_0x20105a);}(_0xb10b,0x12a));var _0xbb10=function(_0x10bd94,_0x46b509){_0x10bd94=_0x10bd94-0x0;var _0x364677=_0xb10b[_0x10bd94];return _0x364677;};'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 diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 7d8f6b5..1e35b05 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 _0xf89b=['exports','INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x27f614,_0x2b0fdc){var _0x533fe0=function(_0x2f42f5){while(--_0x2f42f5){_0x27f614['push'](_0x27f614['shift']());}};_0x533fe0(++_0x2b0fdc);}(_0xf89b,0x95));var _0xbf89=function(_0xc1b4e5,_0x446061){_0xc1b4e5=_0xc1b4e5-0x0;var _0x526518=_0xf89b[_0xc1b4e5];return _0x526518;};'use strict';var Sequelize=require(_0xbf89('0x0'));module[_0xbf89('0x1')]={'priority':{'type':Sequelize[_0xbf89('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xbf89('0x3')],'allowNull':![],'defaultValue':_0xbf89('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xbf89('0x3')]},'interval':{'type':Sequelize[_0xbf89('0x3')],'defaultValue':_0xbf89('0x5')}}; \ No newline at end of file +var _0xc280=['*,*,*,*','exports','STRING','TEXT'];(function(_0x144dba,_0xb5c8e1){var _0x45d653=function(_0x556deb){while(--_0x556deb){_0x144dba['push'](_0x144dba['shift']());}};_0x45d653(++_0xb5c8e1);}(_0xc280,0x1b9));var _0x0c28=function(_0x4f1331,_0x57a194){_0x4f1331=_0x4f1331-0x0;var _0x147f62=_0xc280[_0x4f1331];return _0x147f62;};'use strict';var Sequelize=require('sequelize');module[_0x0c28('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x0c28('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x0c28('0x2')]()},'description':{'type':Sequelize[_0x0c28('0x1')]},'interval':{'type':Sequelize[_0x0c28('0x1')],'defaultValue':_0x0c28('0x3')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 4c26651..762f938 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 _0x325b=['stack','name','show','params','model','keys','ChatApplication','rawAttributes','query','filters','attributes','intersection','fields','length','include','options','find','body','catch','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','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/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','status','set','Content-Range','apply','save','update','then','destroy','error'];(function(_0xd8f71e,_0xf0de01){var _0x260ebf=function(_0xfc9b67){while(--_0xfc9b67){_0xd8f71e['push'](_0xd8f71e['shift']());}};_0x260ebf(++_0xf0de01);}(_0x325b,0x8b));var _0xb325=function(_0xf9203a,_0x187b36){_0xf9203a=_0xf9203a-0x0;var _0x24c339=_0x325b[_0xf9203a];return _0x24c339;};'use strict';var emlformat=require(_0xb325('0x0'));var rimraf=require(_0xb325('0x1'));var zipdir=require(_0xb325('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb325('0x3'));var moment=require(_0xb325('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb325('0x5'));var path=require(_0xb325('0x6'));var sox=require(_0xb325('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb325('0x8'));var _=require('lodash');var squel=require(_0xb325('0x9'));var crypto=require(_0xb325('0xa'));var jsforce=require(_0xb325('0xb'));var deskjs=require(_0xb325('0xc'));var toCsv=require(_0xb325('0xd'));var querystring=require(_0xb325('0xe'));var Papa=require(_0xb325('0xf'));var Redis=require(_0xb325('0x10'));var authService=require(_0xb325('0x11'));var qs=require(_0xb325('0x12'));var as=require(_0xb325('0x13'));var hardwareService=require(_0xb325('0x14'));var logger=require(_0xb325('0x15'))(_0xb325('0x16'));var utils=require('../../config/utils');var config=require(_0xb325('0x17'));var licenseUtil=require(_0xb325('0x18'));var db=require(_0xb325('0x19'))['db'];function respondWithStatusCode(_0x1ee42f,_0x4ac26f){_0x4ac26f=_0x4ac26f||0xcc;return function(_0x306758){if(_0x306758){return _0x1ee42f[_0xb325('0x1a')](_0x4ac26f);}return _0x1ee42f['status'](_0x4ac26f)[_0xb325('0x1b')]();};}function respondWithResult(_0x1265f0,_0x2f0cf1){_0x2f0cf1=_0x2f0cf1||0xc8;return function(_0x266429){if(_0x266429){return _0x1265f0['status'](_0x2f0cf1)[_0xb325('0x1c')](_0x266429);}};}function respondWithFilteredResult(_0x437db0,_0x2b103c){return function(_0x10ce0f){if(_0x10ce0f){var _0x2d7398=typeof _0x2b103c[_0xb325('0x1d')]===_0xb325('0x1e')&&typeof _0x2b103c[_0xb325('0x1f')]==='undefined';var _0x318598=_0x10ce0f['count'];var _0x45d8ac=_0x2d7398?0x0:_0x2b103c[_0xb325('0x1d')];var _0x14ae19=_0x2d7398?_0x10ce0f['count']:_0x2b103c[_0xb325('0x1d')]+_0x2b103c[_0xb325('0x1f')];var _0x345647;if(_0x14ae19>=_0x318598){_0x14ae19=_0x318598;_0x345647=0xc8;}else{_0x345647=0xce;}_0x437db0[_0xb325('0x20')](_0x345647);return _0x437db0[_0xb325('0x21')](_0xb325('0x22'),_0x45d8ac+'-'+_0x14ae19+'/'+_0x318598)[_0xb325('0x1c')](_0x10ce0f);}return null;};}function patchUpdates(_0x214b30){return function(_0x3c322c){try{jsonpatch[_0xb325('0x23')](_0x3c322c,_0x214b30,!![]);}catch(_0x489f02){return BPromise['reject'](_0x489f02);}return _0x3c322c[_0xb325('0x24')]();};}function saveUpdates(_0x40e111,_0xcc088b){return function(_0x259afd){if(_0x259afd){return _0x259afd[_0xb325('0x25')](_0x40e111)[_0xb325('0x26')](function(_0x31ab78){return _0x31ab78;});}return null;};}function removeEntity(_0x4c1027,_0x2166d3){return function(_0x2ad861){if(_0x2ad861){return _0x2ad861[_0xb325('0x27')]()[_0xb325('0x26')](function(){_0x4c1027[_0xb325('0x20')](0xcc)[_0xb325('0x1b')]();});}};}function handleEntityNotFound(_0x4f9034,_0x32af3e){return function(_0x159864){if(!_0x159864){_0x4f9034[_0xb325('0x1a')](0x194);}return _0x159864;};}function handleError(_0x4f5838,_0x2afef7){_0x2afef7=_0x2afef7||0x1f4;return function(_0x3c7c7d){logger[_0xb325('0x28')](_0x3c7c7d[_0xb325('0x29')]);if(_0x3c7c7d[_0xb325('0x2a')]){delete _0x3c7c7d[_0xb325('0x2a')];}_0x4f5838[_0xb325('0x20')](_0x2afef7)['send'](_0x3c7c7d);};}exports[_0xb325('0x2b')]=function(_0x4732ac,_0x383034){var _0x4ff71d={'raw':!![],'where':{'id':_0x4732ac[_0xb325('0x2c')]['id']}},_0x2eff4f={};_0x2eff4f[_0xb325('0x2d')]=_[_0xb325('0x2e')](db[_0xb325('0x2f')][_0xb325('0x30')]);_0x2eff4f['query']=_['keys'](_0x4732ac[_0xb325('0x31')]);_0x2eff4f[_0xb325('0x32')]=_['intersection'](_0x2eff4f['model'],_0x2eff4f[_0xb325('0x31')]);_0x4ff71d[_0xb325('0x33')]=_[_0xb325('0x34')](_0x2eff4f['model'],qs[_0xb325('0x35')](_0x4732ac['query']['fields']));_0x4ff71d[_0xb325('0x33')]=_0x4ff71d[_0xb325('0x33')][_0xb325('0x36')]?_0x4ff71d[_0xb325('0x33')]:_0x2eff4f[_0xb325('0x2d')];if(_0x4732ac[_0xb325('0x31')]['includeAll']){_0x4ff71d[_0xb325('0x37')]=[{'all':!![]}];}_0x4ff71d=_['merge']({},_0x4ff71d,_0x4732ac[_0xb325('0x38')]);return db['ChatApplication'][_0xb325('0x39')](_0x4ff71d)[_0xb325('0x26')](handleEntityNotFound(_0x383034,null))[_0xb325('0x26')](respondWithResult(_0x383034,null))['catch'](handleError(_0x383034,null));};exports[_0xb325('0x25')]=function(_0x565052,_0x13ee29){if(_0x565052[_0xb325('0x3a')]['id']){delete _0x565052['body']['id'];}return db[_0xb325('0x2f')][_0xb325('0x39')]({'where':{'id':_0x565052['params']['id']}})[_0xb325('0x26')](handleEntityNotFound(_0x13ee29,null))[_0xb325('0x26')](saveUpdates(_0x565052[_0xb325('0x3a')],null))[_0xb325('0x26')](respondWithResult(_0x13ee29,null))[_0xb325('0x3b')](handleError(_0x13ee29,null));};exports[_0xb325('0x27')]=function(_0x515c86,_0xf9798a){return db['ChatApplication'][_0xb325('0x39')]({'where':{'id':_0x515c86['params']['id']}})[_0xb325('0x26')](handleEntityNotFound(_0xf9798a,null))[_0xb325('0x26')](removeEntity(_0xf9798a,null))['catch'](handleError(_0xf9798a,null));}; \ No newline at end of file +var _0x5b05=['then','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../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','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b05,0x190));var _0x55b0=function(_0x47cece,_0x42ab8e){_0x47cece=_0x47cece-0x0;var _0x3291fa=_0x5b05[_0x47cece];return _0x3291fa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x55b0('0x0'));var zipdir=require(_0x55b0('0x1'));var jsonpatch=require(_0x55b0('0x2'));var rp=require(_0x55b0('0x3'));var moment=require(_0x55b0('0x4'));var BPromise=require(_0x55b0('0x5'));var Mustache=require(_0x55b0('0x6'));var util=require(_0x55b0('0x7'));var path=require(_0x55b0('0x8'));var sox=require(_0x55b0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x55b0('0xa'));var _=require(_0x55b0('0xb'));var squel=require(_0x55b0('0xc'));var crypto=require(_0x55b0('0xd'));var jsforce=require(_0x55b0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x55b0('0xf'));var querystring=require(_0x55b0('0x10'));var Papa=require(_0x55b0('0x11'));var Redis=require(_0x55b0('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x55b0('0x13'));var hardwareService=require(_0x55b0('0x14'));var logger=require(_0x55b0('0x15'))(_0x55b0('0x16'));var utils=require(_0x55b0('0x17'));var config=require(_0x55b0('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x55b0('0x19'))['db'];function respondWithStatusCode(_0x35212d,_0x4d8be8){_0x4d8be8=_0x4d8be8||0xcc;return function(_0x8c1df0){if(_0x8c1df0){return _0x35212d[_0x55b0('0x1a')](_0x4d8be8);}return _0x35212d[_0x55b0('0x1b')](_0x4d8be8)[_0x55b0('0x1c')]();};}function respondWithResult(_0x5baa88,_0x525f9b){_0x525f9b=_0x525f9b||0xc8;return function(_0x4d614b){if(_0x4d614b){return _0x5baa88[_0x55b0('0x1b')](_0x525f9b)['json'](_0x4d614b);}};}function respondWithFilteredResult(_0x7d7527,_0x3ca8e2){return function(_0x4d2271){if(_0x4d2271){var _0x15fa8f=typeof _0x3ca8e2[_0x55b0('0x1d')]===_0x55b0('0x1e')&&typeof _0x3ca8e2[_0x55b0('0x1f')]===_0x55b0('0x1e');var _0x4f98ba=_0x4d2271[_0x55b0('0x20')];var _0x20b1c5=_0x15fa8f?0x0:_0x3ca8e2[_0x55b0('0x1d')];var _0x5ca2ec=_0x15fa8f?_0x4d2271['count']:_0x3ca8e2[_0x55b0('0x1d')]+_0x3ca8e2[_0x55b0('0x1f')];var _0x3f9458;if(_0x5ca2ec>=_0x4f98ba){_0x5ca2ec=_0x4f98ba;_0x3f9458=0xc8;}else{_0x3f9458=0xce;}_0x7d7527['status'](_0x3f9458);return _0x7d7527[_0x55b0('0x21')](_0x55b0('0x22'),_0x20b1c5+'-'+_0x5ca2ec+'/'+_0x4f98ba)[_0x55b0('0x23')](_0x4d2271);}return null;};}function patchUpdates(_0x3ff56c){return function(_0x55b08e){try{jsonpatch[_0x55b0('0x24')](_0x55b08e,_0x3ff56c,!![]);}catch(_0x27ecd1){return BPromise[_0x55b0('0x25')](_0x27ecd1);}return _0x55b08e[_0x55b0('0x26')]();};}function saveUpdates(_0x4fa147,_0x4082ce){return function(_0x5e3acc){if(_0x5e3acc){return _0x5e3acc[_0x55b0('0x27')](_0x4fa147)['then'](function(_0x33bcc1){return _0x33bcc1;});}return null;};}function removeEntity(_0x25eb8a,_0x1ea756){return function(_0x3056f8){if(_0x3056f8){return _0x3056f8[_0x55b0('0x28')]()[_0x55b0('0x29')](function(){_0x25eb8a[_0x55b0('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x244092,_0x54f74f){return function(_0x494092){if(!_0x494092){_0x244092[_0x55b0('0x1a')](0x194);}return _0x494092;};}function handleError(_0x43b2c8,_0x5b2dc8){_0x5b2dc8=_0x5b2dc8||0x1f4;return function(_0x177bb8){logger['error'](_0x177bb8[_0x55b0('0x2a')]);if(_0x177bb8[_0x55b0('0x2b')]){delete _0x177bb8[_0x55b0('0x2b')];}_0x43b2c8[_0x55b0('0x1b')](_0x5b2dc8)[_0x55b0('0x2c')](_0x177bb8);};}exports[_0x55b0('0x2d')]=function(_0x20385f,_0x3b0262){var _0x10d5c9={'raw':!![],'where':{'id':_0x20385f[_0x55b0('0x2e')]['id']}},_0x4273e0={};_0x4273e0[_0x55b0('0x2f')]=_[_0x55b0('0x30')](db[_0x55b0('0x31')][_0x55b0('0x32')]);_0x4273e0[_0x55b0('0x33')]=_[_0x55b0('0x30')](_0x20385f['query']);_0x4273e0[_0x55b0('0x34')]=_[_0x55b0('0x35')](_0x4273e0[_0x55b0('0x2f')],_0x4273e0[_0x55b0('0x33')]);_0x10d5c9['attributes']=_[_0x55b0('0x35')](_0x4273e0[_0x55b0('0x2f')],qs[_0x55b0('0x36')](_0x20385f[_0x55b0('0x33')][_0x55b0('0x36')]));_0x10d5c9[_0x55b0('0x37')]=_0x10d5c9['attributes'][_0x55b0('0x38')]?_0x10d5c9['attributes']:_0x4273e0[_0x55b0('0x2f')];if(_0x20385f[_0x55b0('0x33')][_0x55b0('0x39')]){_0x10d5c9[_0x55b0('0x3a')]=[{'all':!![]}];}_0x10d5c9=_[_0x55b0('0x3b')]({},_0x10d5c9,_0x20385f[_0x55b0('0x3c')]);return db[_0x55b0('0x31')][_0x55b0('0x3d')](_0x10d5c9)[_0x55b0('0x29')](handleEntityNotFound(_0x3b0262,null))[_0x55b0('0x29')](respondWithResult(_0x3b0262,null))['catch'](handleError(_0x3b0262,null));};exports[_0x55b0('0x27')]=function(_0x14d978,_0x3df54f){if(_0x14d978[_0x55b0('0x3e')]['id']){delete _0x14d978[_0x55b0('0x3e')]['id'];}return db[_0x55b0('0x31')][_0x55b0('0x3d')]({'where':{'id':_0x14d978[_0x55b0('0x2e')]['id']}})[_0x55b0('0x29')](handleEntityNotFound(_0x3df54f,null))['then'](saveUpdates(_0x14d978['body'],null))[_0x55b0('0x29')](respondWithResult(_0x3df54f,null))['catch'](handleError(_0x3df54f,null));};exports[_0x55b0('0x28')]=function(_0x592d6e,_0x204df3){return db[_0x55b0('0x31')]['find']({'where':{'id':_0x592d6e[_0x55b0('0x2e')]['id']}})[_0x55b0('0x29')](handleEntityNotFound(_0x204df3,null))[_0x55b0('0x29')](removeEntity(_0x204df3,null))['catch'](handleError(_0x204df3,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 27a4757..38f3a02 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 _0x22fb=['./chatApplication.attributes','exports','define','ChatApplication','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x46fc3d,_0x607a8d){var _0x18eaaf=function(_0x130c11){while(--_0x130c11){_0x46fc3d['push'](_0x46fc3d['shift']());}};_0x18eaaf(++_0x607a8d);}(_0x22fb,0x192));var _0xb22f=function(_0x5da3eb,_0x3d2bf8){_0x5da3eb=_0x5da3eb-0x0;var _0xc06d0e=_0x22fb[_0x5da3eb];return _0xc06d0e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb22f('0x0'))('api');var moment=require(_0xb22f('0x1'));var BPromise=require(_0xb22f('0x2'));var rp=require(_0xb22f('0x3'));var fs=require('fs');var path=require(_0xb22f('0x4'));var rimraf=require(_0xb22f('0x5'));var config=require('../../config/environment');var attributes=require(_0xb22f('0x6'));module[_0xb22f('0x7')]=function(_0x2d1fb3,_0xc3ffcc){return _0x2d1fb3[_0xb22f('0x8')](_0xb22f('0x9'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb22f('0xa'),'collate':_0xb22f('0xb')});}; \ No newline at end of file +var _0x5d3c=['moment','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','ChatApplication','chat_applications','lodash','util','../../config/logger'];(function(_0x365350,_0xbde2d8){var _0x485daa=function(_0x4de8ec){while(--_0x4de8ec){_0x365350['push'](_0x365350['shift']());}};_0x485daa(++_0xbde2d8);}(_0x5d3c,0x159));var _0xc5d3=function(_0x1770d9,_0x29296b){_0x1770d9=_0x1770d9-0x0;var _0x4f9ce2=_0x5d3c[_0x1770d9];return _0x4f9ce2;};'use strict';var _=require(_0xc5d3('0x0'));var util=require(_0xc5d3('0x1'));var logger=require(_0xc5d3('0x2'))('api');var moment=require(_0xc5d3('0x3'));var BPromise=require('bluebird');var rp=require(_0xc5d3('0x4'));var fs=require('fs');var path=require(_0xc5d3('0x5'));var rimraf=require(_0xc5d3('0x6'));var config=require(_0xc5d3('0x7'));var attributes=require(_0xc5d3('0x8'));module[_0xc5d3('0x9')]=function(_0x2f52ee,_0x5d3cae){return _0x2f52ee['define'](_0xc5d3('0xa'),attributes,{'tableName':_0xc5d3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index cf4b06b..9045d64 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 _0xdab6=['info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x5b740b,_0x381833){var _0x6f8f4e=function(_0x86d068){while(--_0x86d068){_0x5b740b['push'](_0x5b740b['shift']());}};_0x6f8f4e(++_0x381833);}(_0xdab6,0x159));var _0x6dab=function(_0x16daee,_0xaf8850){_0x16daee=_0x16daee-0x0;var _0x436115=_0xdab6[_0x16daee];return _0x436115;};'use strict';var _=require('lodash');var util=require(_0x6dab('0x0'));var moment=require(_0x6dab('0x1'));var BPromise=require(_0x6dab('0x2'));var rs=require(_0x6dab('0x3'));var fs=require('fs');var Redis=require(_0x6dab('0x4'));var db=require(_0x6dab('0x5'))['db'];var utils=require(_0x6dab('0x6'));var logger=require('../../config/logger')(_0x6dab('0x7'));var config=require(_0x6dab('0x8'));var jayson=require(_0x6dab('0x9'));var client=jayson['client'][_0x6dab('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49452f,_0x20290e,_0x56fed3){return new BPromise(function(_0x140755,_0x26db02){return client[_0x6dab('0xb')](_0x49452f,_0x56fed3)['then'](function(_0x24ac94){logger[_0x6dab('0xc')](_0x6dab('0xd'),_0x20290e,_0x6dab('0xe'));logger['debug'](_0x6dab('0xf'),_0x20290e,_0x6dab('0xe'),JSON['stringify'](_0x24ac94));if(_0x24ac94[_0x6dab('0x10')]){if(_0x24ac94[_0x6dab('0x10')][_0x6dab('0x11')]===0x1f4){logger[_0x6dab('0x10')](_0x6dab('0xd'),_0x20290e,_0x24ac94['error']['message']);return _0x26db02(_0x24ac94[_0x6dab('0x10')][_0x6dab('0x12')]);}logger[_0x6dab('0x10')]('ChatApplication,\x20%s,\x20%s',_0x20290e,_0x24ac94[_0x6dab('0x10')][_0x6dab('0x12')]);return _0x140755(_0x24ac94[_0x6dab('0x10')][_0x6dab('0x12')]);}else{logger[_0x6dab('0xc')](_0x6dab('0xd'),_0x20290e,_0x6dab('0xe'));_0x140755(_0x24ac94[_0x6dab('0x13')][_0x6dab('0x12')]);}})[_0x6dab('0x14')](function(_0x37e704){logger[_0x6dab('0x10')](_0x6dab('0xd'),_0x20290e,_0x37e704);_0x26db02(_0x37e704);});});} \ No newline at end of file +var _0x929b=['http','request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x3f2e8e,_0x20f1d0){var _0x5a0b55=function(_0x539c30){while(--_0x539c30){_0x3f2e8e['push'](_0x3f2e8e['shift']());}};_0x5a0b55(++_0x20f1d0);}(_0x929b,0x155));var _0xb929=function(_0x4fb930,_0x4141c4){_0x4fb930=_0x4fb930-0x0;var _0x59adc4=_0x929b[_0x4fb930];return _0x59adc4;};'use strict';var _=require(_0xb929('0x0'));var util=require(_0xb929('0x1'));var moment=require(_0xb929('0x2'));var BPromise=require(_0xb929('0x3'));var rs=require(_0xb929('0x4'));var fs=require('fs');var Redis=require(_0xb929('0x5'));var db=require(_0xb929('0x6'))['db'];var utils=require(_0xb929('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xb929('0x8'));var jayson=require(_0xb929('0x9'));var client=jayson[_0xb929('0xa')][_0xb929('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x406b8b,_0xdf471e,_0x567fd4){return new BPromise(function(_0xe418f3,_0xdc6f63){return client[_0xb929('0xc')](_0x406b8b,_0x567fd4)['then'](function(_0x1c26a6){logger[_0xb929('0xd')](_0xb929('0xe'),_0xdf471e,_0xb929('0xf'));logger[_0xb929('0x10')](_0xb929('0x11'),_0xdf471e,_0xb929('0xf'),JSON[_0xb929('0x12')](_0x1c26a6));if(_0x1c26a6[_0xb929('0x13')]){if(_0x1c26a6[_0xb929('0x13')]['code']===0x1f4){logger[_0xb929('0x13')](_0xb929('0xe'),_0xdf471e,_0x1c26a6['error'][_0xb929('0x14')]);return _0xdc6f63(_0x1c26a6[_0xb929('0x13')]['message']);}logger['error'](_0xb929('0xe'),_0xdf471e,_0x1c26a6[_0xb929('0x13')]['message']);return _0xe418f3(_0x1c26a6['error'][_0xb929('0x14')]);}else{logger['info'](_0xb929('0xe'),_0xdf471e,_0xb929('0xf'));_0xe418f3(_0x1c26a6[_0xb929('0x15')][_0xb929('0x14')]);}})['catch'](function(_0x2e6d09){logger[_0xb929('0x13')]('ChatApplication,\x20%s,\x20%s',_0xdf471e,_0x2e6d09);_0xdc6f63(_0x2e6d09);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 07470b4..2e98c81 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 _0xdfd6=['destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update'];(function(_0x2ee84f,_0xcfa483){var _0x4f4ea6=function(_0x1fbb7b){while(--_0x1fbb7b){_0x2ee84f['push'](_0x2ee84f['shift']());}};_0x4f4ea6(++_0xcfa483);}(_0xdfd6,0x9a));var _0x6dfd=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xdfd6[_0x432682];return _0x463d05;};'use strict';var multer=require(_0x6dfd('0x0'));var util=require(_0x6dfd('0x1'));var path=require('path');var timeout=require(_0x6dfd('0x2'));var express=require(_0x6dfd('0x3'));var router=express[_0x6dfd('0x4')]();var fs_extra=require(_0x6dfd('0x5'));var auth=require(_0x6dfd('0x6'));var interaction=require(_0x6dfd('0x7'));var config=require(_0x6dfd('0x8'));var controller=require(_0x6dfd('0x9'));router[_0x6dfd('0xa')](_0x6dfd('0xb'),auth[_0x6dfd('0xc')](),controller[_0x6dfd('0xd')]);router[_0x6dfd('0xe')](_0x6dfd('0xb'),auth[_0x6dfd('0xc')](),controller[_0x6dfd('0xf')]);router['delete']('/:id',auth[_0x6dfd('0xc')](),controller[_0x6dfd('0x10')]);module['exports']=router; \ No newline at end of file +var _0xbcce=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','put'];(function(_0x52b978,_0x5205e5){var _0x28f939=function(_0x26da96){while(--_0x26da96){_0x52b978['push'](_0x52b978['shift']());}};_0x28f939(++_0x5205e5);}(_0xbcce,0x68));var _0xebcc=function(_0xf377ba,_0x1765d0){_0xf377ba=_0xf377ba-0x0;var _0x1f4eea=_0xbcce[_0xf377ba];return _0x1f4eea;};'use strict';var multer=require(_0xebcc('0x0'));var util=require(_0xebcc('0x1'));var path=require(_0xebcc('0x2'));var timeout=require(_0xebcc('0x3'));var express=require(_0xebcc('0x4'));var router=express[_0xebcc('0x5')]();var fs_extra=require(_0xebcc('0x6'));var auth=require(_0xebcc('0x7'));var interaction=require(_0xebcc('0x8'));var config=require(_0xebcc('0x9'));var controller=require(_0xebcc('0xa'));router[_0xebcc('0xb')](_0xebcc('0xc'),auth[_0xebcc('0xd')](),controller['show']);router[_0xebcc('0xe')](_0xebcc('0xc'),auth[_0xebcc('0xd')](),controller['update']);router['delete'](_0xebcc('0xc'),auth['isAuthenticated'](),controller[_0xebcc('0xf')]);module[_0xebcc('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 01c5f9f..ca3b399 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 _0x4d1b=['sequelize','STRING','BOOLEAN'];(function(_0x121046,_0x4f06de){var _0x277354=function(_0x43424e){while(--_0x43424e){_0x121046['push'](_0x121046['shift']());}};_0x277354(++_0x4f06de);}(_0x4d1b,0x102));var _0xb4d1=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x4d1b[_0x11005e];return _0x29338f;};'use strict';var Sequelize=require(_0xb4d1('0x0'));module['exports']={'name':{'type':Sequelize[_0xb4d1('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb4d1('0x1')]},'write':{'type':Sequelize[_0xb4d1('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xab95=['exports','STRING','BOOLEAN','sequelize'];(function(_0x258d6e,_0x54387b){var _0x1654f2=function(_0x1d58a7){while(--_0x1d58a7){_0x258d6e['push'](_0x258d6e['shift']());}};_0x1654f2(++_0x54387b);}(_0xab95,0xaf));var _0x5ab9=function(_0x280213,_0x14cd12){_0x280213=_0x280213-0x0;var _0x4410dc=_0xab95[_0x280213];return _0x4410dc;};'use strict';var Sequelize=require(_0x5ab9('0x0'));module[_0x5ab9('0x1')]={'name':{'type':Sequelize[_0x5ab9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5ab9('0x2')]},'write':{'type':Sequelize[_0x5ab9('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 3eb0b33..ed3154e 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 _0xcc97=['register','sendStatus','status','end','offset','undefined','count','set','Content-Range','apply','save','destroy','then','error','stack','name','send','index','ChatGroup','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','findOne','User','sort','getMembers','removeMembers','addMessage','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','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','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./chatGroup.socket'];(function(_0x2eb82f,_0x5b4bf1){var _0x229daa=function(_0x174d6e){while(--_0x174d6e){_0x2eb82f['push'](_0x2eb82f['shift']());}};_0x229daa(++_0x5b4bf1);}(_0xcc97,0x174));var _0x7cc9=function(_0x581bd0,_0x3c9a7c){_0x581bd0=_0x581bd0-0x0;var _0x5bd522=_0xcc97[_0x581bd0];return _0x5bd522;};'use strict';var emlformat=require(_0x7cc9('0x0'));var rimraf=require(_0x7cc9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7cc9('0x2'));var rp=require(_0x7cc9('0x3'));var moment=require(_0x7cc9('0x4'));var BPromise=require(_0x7cc9('0x5'));var Mustache=require(_0x7cc9('0x6'));var util=require(_0x7cc9('0x7'));var path=require(_0x7cc9('0x8'));var sox=require(_0x7cc9('0x9'));var csv=require(_0x7cc9('0xa'));var ejs=require(_0x7cc9('0xb'));var fs=require('fs');var fs_extra=require(_0x7cc9('0xc'));var _=require(_0x7cc9('0xd'));var squel=require(_0x7cc9('0xe'));var crypto=require(_0x7cc9('0xf'));var jsforce=require(_0x7cc9('0x10'));var deskjs=require(_0x7cc9('0x11'));var toCsv=require('to-csv');var querystring=require(_0x7cc9('0x12'));var Papa=require(_0x7cc9('0x13'));var Redis=require(_0x7cc9('0x14'));var authService=require(_0x7cc9('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x7cc9('0x16'));var hardwareService=require(_0x7cc9('0x17'));var logger=require(_0x7cc9('0x18'))(_0x7cc9('0x19'));var utils=require(_0x7cc9('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x7cc9('0x1b'));var db=require(_0x7cc9('0x1c'))['db'];config[_0x7cc9('0x1d')]=_['defaults'](config[_0x7cc9('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0x7cc9('0x1e'))(new Redis(config[_0x7cc9('0x1d')]));require(_0x7cc9('0x1f'))[_0x7cc9('0x20')](socket);function respondWithStatusCode(_0x5c4093,_0x446c0e){_0x446c0e=_0x446c0e||0xcc;return function(_0xb0fc58){if(_0xb0fc58){return _0x5c4093[_0x7cc9('0x21')](_0x446c0e);}return _0x5c4093[_0x7cc9('0x22')](_0x446c0e)[_0x7cc9('0x23')]();};}function respondWithResult(_0x5dcc88,_0x53762d){_0x53762d=_0x53762d||0xc8;return function(_0xcb7099){if(_0xcb7099){return _0x5dcc88['status'](_0x53762d)['json'](_0xcb7099);}};}function respondWithFilteredResult(_0x5dc1e5,_0x5aa2a1){return function(_0x86ddd2){if(_0x86ddd2){var _0x39e3b5=typeof _0x5aa2a1[_0x7cc9('0x24')]==='undefined'&&typeof _0x5aa2a1['limit']===_0x7cc9('0x25');var _0x22bb42=_0x86ddd2[_0x7cc9('0x26')];var _0x56dd8f=_0x39e3b5?0x0:_0x5aa2a1['offset'];var _0x2e9567=_0x39e3b5?_0x86ddd2[_0x7cc9('0x26')]:_0x5aa2a1[_0x7cc9('0x24')]+_0x5aa2a1['limit'];var _0x5e7dd1;if(_0x2e9567>=_0x22bb42){_0x2e9567=_0x22bb42;_0x5e7dd1=0xc8;}else{_0x5e7dd1=0xce;}_0x5dc1e5[_0x7cc9('0x22')](_0x5e7dd1);return _0x5dc1e5[_0x7cc9('0x27')](_0x7cc9('0x28'),_0x56dd8f+'-'+_0x2e9567+'/'+_0x22bb42)['json'](_0x86ddd2);}return null;};}function patchUpdates(_0x44ca12){return function(_0x32b1d1){try{jsonpatch[_0x7cc9('0x29')](_0x32b1d1,_0x44ca12,!![]);}catch(_0x1d77fd){return BPromise['reject'](_0x1d77fd);}return _0x32b1d1[_0x7cc9('0x2a')]();};}function saveUpdates(_0x5c38f5,_0x17a326){return function(_0x1be856){if(_0x1be856){return _0x1be856['update'](_0x5c38f5)['then'](function(_0xf369a){return _0xf369a;});}return null;};}function removeEntity(_0x42412b,_0x5e6cb8){return function(_0x27b2fb){if(_0x27b2fb){return _0x27b2fb[_0x7cc9('0x2b')]()[_0x7cc9('0x2c')](function(){_0x42412b[_0x7cc9('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51e7d4,_0x2a984a){return function(_0x4fc527){if(!_0x4fc527){_0x51e7d4[_0x7cc9('0x21')](0x194);}return _0x4fc527;};}function handleError(_0xcc9c26,_0x3a87b0){_0x3a87b0=_0x3a87b0||0x1f4;return function(_0x1b8595){logger[_0x7cc9('0x2d')](_0x1b8595[_0x7cc9('0x2e')]);if(_0x1b8595[_0x7cc9('0x2f')]){delete _0x1b8595[_0x7cc9('0x2f')];}_0xcc9c26[_0x7cc9('0x22')](_0x3a87b0)[_0x7cc9('0x30')](_0x1b8595);};}exports[_0x7cc9('0x31')]=function(_0x24ddcd,_0x208a08){var _0x281ada={},_0x779e9={},_0x1b3c51={'count':0x0,'rows':[]};var _0xc4ce5=_['map'](db[_0x7cc9('0x32')][_0x7cc9('0x33')],function(_0x1e9cf3){return{'name':_0x1e9cf3[_0x7cc9('0x34')],'type':_0x1e9cf3[_0x7cc9('0x35')]['key']};});_0x779e9[_0x7cc9('0x36')]=_[_0x7cc9('0x37')](_0xc4ce5,_0x7cc9('0x2f'));_0x779e9[_0x7cc9('0x38')]=_[_0x7cc9('0x39')](_0x24ddcd[_0x7cc9('0x38')]);_0x779e9[_0x7cc9('0x3a')]=_[_0x7cc9('0x3b')](_0x779e9[_0x7cc9('0x36')],_0x779e9[_0x7cc9('0x38')]);_0x281ada['attributes']=_['intersection'](_0x779e9['model'],qs[_0x7cc9('0x3c')](_0x24ddcd[_0x7cc9('0x38')][_0x7cc9('0x3c')]));_0x281ada[_0x7cc9('0x3d')]=_0x281ada[_0x7cc9('0x3d')][_0x7cc9('0x3e')]?_0x281ada[_0x7cc9('0x3d')]:_0x779e9['model'];if(!_0x24ddcd['query'][_0x7cc9('0x3f')](_0x7cc9('0x40'))){_0x281ada[_0x7cc9('0x41')]=qs[_0x7cc9('0x41')](_0x24ddcd[_0x7cc9('0x38')]['limit']);_0x281ada[_0x7cc9('0x24')]=qs[_0x7cc9('0x24')](_0x24ddcd['query']['offset']);}_0x281ada[_0x7cc9('0x42')]=qs['sort'](_0x24ddcd['query']['sort']);_0x281ada[_0x7cc9('0x43')]=qs[_0x7cc9('0x3a')](_[_0x7cc9('0x44')](_0x24ddcd[_0x7cc9('0x38')],_0x779e9[_0x7cc9('0x3a')]),_0xc4ce5);if(_0x24ddcd[_0x7cc9('0x38')]['filter']){_0x281ada[_0x7cc9('0x43')]=_[_0x7cc9('0x45')](_0x281ada[_0x7cc9('0x43')],{'$or':_['map'](_0xc4ce5,function(_0x155cfb){if(_0x155cfb[_0x7cc9('0x35')]!==_0x7cc9('0x46')){var _0x287cee={};_0x287cee[_0x155cfb['name']]={'$like':'%'+_0x24ddcd[_0x7cc9('0x38')][_0x7cc9('0x47')]+'%'};return _0x287cee;}})});}_0x281ada=_['merge']({},_0x281ada,_0x24ddcd[_0x7cc9('0x48')]);var _0x1320eb={'where':_0x281ada['where']};return db[_0x7cc9('0x32')][_0x7cc9('0x26')](_0x1320eb)[_0x7cc9('0x2c')](function(_0x4ce8ea){_0x1b3c51['count']=_0x4ce8ea;if(_0x24ddcd['query'][_0x7cc9('0x49')]){_0x281ada[_0x7cc9('0x4a')]=[{'all':!![]}];}return db[_0x7cc9('0x32')][_0x7cc9('0x4b')](_0x281ada);})[_0x7cc9('0x2c')](function(_0xbdda36){_0x1b3c51[_0x7cc9('0x4c')]=_0xbdda36;return _0x1b3c51;})[_0x7cc9('0x2c')](respondWithFilteredResult(_0x208a08,_0x281ada))[_0x7cc9('0x4d')](handleError(_0x208a08,null));};exports[_0x7cc9('0x4e')]=function(_0x28b33,_0x2ba3b5){var _0x4219c2={'raw':!![],'where':{'id':_0x28b33[_0x7cc9('0x4f')]['id']}},_0x3c44a2={};_0x3c44a2['model']=_[_0x7cc9('0x39')](db[_0x7cc9('0x32')][_0x7cc9('0x33')]);_0x3c44a2['query']=_[_0x7cc9('0x39')](_0x28b33['query']);_0x3c44a2[_0x7cc9('0x3a')]=_[_0x7cc9('0x3b')](_0x3c44a2[_0x7cc9('0x36')],_0x3c44a2['query']);_0x4219c2[_0x7cc9('0x3d')]=_[_0x7cc9('0x3b')](_0x3c44a2['model'],qs[_0x7cc9('0x3c')](_0x28b33['query'][_0x7cc9('0x3c')]));_0x4219c2['attributes']=_0x4219c2[_0x7cc9('0x3d')][_0x7cc9('0x3e')]?_0x4219c2[_0x7cc9('0x3d')]:_0x3c44a2['model'];if(_0x28b33[_0x7cc9('0x38')][_0x7cc9('0x49')]){_0x4219c2['include']=[{'all':!![]}];}_0x4219c2=_[_0x7cc9('0x45')]({},_0x4219c2,_0x28b33[_0x7cc9('0x48')]);return db[_0x7cc9('0x32')]['find'](_0x4219c2)[_0x7cc9('0x2c')](handleEntityNotFound(_0x2ba3b5,null))['then'](respondWithResult(_0x2ba3b5,null))[_0x7cc9('0x4d')](handleError(_0x2ba3b5,null));};exports[_0x7cc9('0x50')]=function(_0x5067cf,_0x3dd435){return db[_0x7cc9('0x32')][_0x7cc9('0x50')](_0x5067cf[_0x7cc9('0x51')],{})[_0x7cc9('0x2c')](respondWithResult(_0x3dd435,0xc9))[_0x7cc9('0x4d')](handleError(_0x3dd435,null));};exports['update']=function(_0x141e17,_0x585b3b){if(_0x141e17[_0x7cc9('0x51')]['id']){delete _0x141e17[_0x7cc9('0x51')]['id'];}return db[_0x7cc9('0x32')]['find']({'where':{'id':_0x141e17[_0x7cc9('0x4f')]['id']}})['then'](handleEntityNotFound(_0x585b3b,null))['then'](saveUpdates(_0x141e17[_0x7cc9('0x51')],null))['then'](respondWithResult(_0x585b3b,null))['catch'](handleError(_0x585b3b,null));};exports[_0x7cc9('0x2b')]=function(_0x496041,_0x3f1546){return db[_0x7cc9('0x32')][_0x7cc9('0x52')]({'where':{'id':_0x496041[_0x7cc9('0x4f')]['id']}})[_0x7cc9('0x2c')](handleEntityNotFound(_0x3f1546,null))[_0x7cc9('0x2c')](removeEntity(_0x3f1546,null))[_0x7cc9('0x4d')](handleError(_0x3f1546,null));};exports[_0x7cc9('0x53')]=function(_0x3ff96e,_0x4b5fb0){return db[_0x7cc9('0x32')][_0x7cc9('0x53')]()[_0x7cc9('0x2c')](respondWithResult(_0x4b5fb0,null))[_0x7cc9('0x4d')](handleError(_0x4b5fb0,null));};exports[_0x7cc9('0x54')]=function(_0x1d90da,_0x56340e,_0x10849b){return db[_0x7cc9('0x55')][_0x7cc9('0x26')]({'where':{'ChatGroupId':_0x1d90da[_0x7cc9('0x4f')]['id'],'ToId':_0x1d90da[_0x7cc9('0x56')]['id'],'read':![]}})[_0x7cc9('0x2c')](function(_0x480d4c){return{'id':_[_0x7cc9('0x57')](_0x1d90da[_0x7cc9('0x4f')]['id']),'count':_0x480d4c};})[_0x7cc9('0x2c')](respondWithResult(_0x56340e,null))[_0x7cc9('0x4d')](handleError(_0x56340e,null));};exports[_0x7cc9('0x58')]=function(_0x2e7cab,_0x34ad87,_0x5f29b8){return db[_0x7cc9('0x32')][_0x7cc9('0x52')]({'where':{'id':_0x2e7cab[_0x7cc9('0x4f')]['id']}})['then'](handleEntityNotFound(_0x34ad87,null))[_0x7cc9('0x2c')](function(_0x5ccef0){if(_0x5ccef0){return _0x5ccef0['addMembers'](_0x2e7cab[_0x7cc9('0x51')][_0x7cc9('0x59')],_[_0x7cc9('0x5a')](_0x2e7cab['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x34ad87,null))['catch'](handleError(_0x34ad87,null));};exports['getMembers']=function(_0x382944,_0x2c963a,_0x2d1966){var _0x4e554={};var _0x1eee24={};var _0xaf97e2;var _0x92551c;return db[_0x7cc9('0x32')][_0x7cc9('0x5b')]({'where':{'id':_0x382944[_0x7cc9('0x4f')]['id']}})[_0x7cc9('0x2c')](handleEntityNotFound(_0x2c963a,null))[_0x7cc9('0x2c')](function(_0x119b04){if(_0x119b04){_0xaf97e2=_0x119b04;_0x1eee24[_0x7cc9('0x36')]=_[_0x7cc9('0x39')](db[_0x7cc9('0x5c')][_0x7cc9('0x33')]);_0x1eee24[_0x7cc9('0x38')]=_[_0x7cc9('0x39')](_0x382944['query']);_0x1eee24['filters']=_[_0x7cc9('0x3b')](_0x1eee24[_0x7cc9('0x36')],_0x1eee24[_0x7cc9('0x38')]);_0x4e554[_0x7cc9('0x3d')]=_['intersection'](_0x1eee24[_0x7cc9('0x36')],qs[_0x7cc9('0x3c')](_0x382944[_0x7cc9('0x38')][_0x7cc9('0x3c')]));_0x4e554[_0x7cc9('0x3d')]=_0x4e554[_0x7cc9('0x3d')]['length']?_0x4e554[_0x7cc9('0x3d')]:_0x1eee24[_0x7cc9('0x36')];_0x4e554[_0x7cc9('0x42')]=qs[_0x7cc9('0x5d')](_0x382944[_0x7cc9('0x38')][_0x7cc9('0x5d')]);_0x4e554[_0x7cc9('0x43')]=qs[_0x7cc9('0x3a')](_[_0x7cc9('0x44')](_0x382944[_0x7cc9('0x38')],_0x1eee24[_0x7cc9('0x3a')]));if(_0x382944[_0x7cc9('0x38')]['filter']){_0x4e554[_0x7cc9('0x43')]=_['merge'](_0x4e554['where'],{'$or':_[_0x7cc9('0x37')](_0x4e554[_0x7cc9('0x3d')],function(_0x1b3464){var _0x2cd529={};_0x2cd529[_0x1b3464]={'$like':'%'+_0x382944[_0x7cc9('0x38')][_0x7cc9('0x47')]+'%'};return _0x2cd529;})});}_0x4e554=_['merge']({},_0x4e554,_0x382944['options']);return _0xaf97e2['getMembers'](_0x4e554);}})[_0x7cc9('0x2c')](function(_0x1b6077){if(_0x1b6077){_0x92551c=_0x1b6077[_0x7cc9('0x3e')];if(!_0x382944[_0x7cc9('0x38')][_0x7cc9('0x3f')]('nolimit')){_0x4e554[_0x7cc9('0x41')]=qs['limit'](_0x382944[_0x7cc9('0x38')]['limit']);_0x4e554[_0x7cc9('0x24')]=qs[_0x7cc9('0x24')](_0x382944[_0x7cc9('0x38')][_0x7cc9('0x24')]);}return _0xaf97e2[_0x7cc9('0x5e')](_0x4e554);}})[_0x7cc9('0x2c')](function(_0x5bfc1e){if(_0x5bfc1e){return _0x5bfc1e?{'count':_0x92551c,'rows':_0x5bfc1e}:null;}})[_0x7cc9('0x2c')](respondWithResult(_0x2c963a,null))[_0x7cc9('0x4d')](handleError(_0x2c963a,null));};exports[_0x7cc9('0x5f')]=function(_0x4529d0,_0x1bde55,_0x2d927b){return db[_0x7cc9('0x32')][_0x7cc9('0x52')]({'where':{'id':_0x4529d0['params']['id']}})['then'](handleEntityNotFound(_0x1bde55,null))[_0x7cc9('0x2c')](function(_0x351f04){if(_0x351f04){return _0x351f04[_0x7cc9('0x5f')](_0x4529d0[_0x7cc9('0x38')]['ids']);}})['then'](respondWithStatusCode(_0x1bde55,null))[_0x7cc9('0x4d')](handleError(_0x1bde55,null));};exports[_0x7cc9('0x60')]=function(_0x44fb8e,_0xbede80,_0x29c8d1){if(_0x44fb8e[_0x7cc9('0x51')]['id']){delete _0x44fb8e[_0x7cc9('0x51')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x44fb8e[_0x7cc9('0x4f')]['id']}})[_0x7cc9('0x2c')](handleEntityNotFound(_0xbede80,null))[_0x7cc9('0x2c')](function(_0x4b51c3){if(_0x4b51c3){_0x44fb8e[_0x7cc9('0x51')]['ChatGroupId']=_0x4b51c3['id'];return db[_0x7cc9('0x55')][_0x7cc9('0x50')](_0x44fb8e[_0x7cc9('0x51')]);}})[_0x7cc9('0x2c')](respondWithResult(_0xbede80,null))[_0x7cc9('0x4d')](handleError(_0xbede80,null));};exports[_0x7cc9('0x61')]=function(_0x923638,_0x43945a,_0x19817e){var _0x41afea={};var _0x21354d={};var _0x28d28b;var _0x2e5ad9;return db[_0x7cc9('0x32')][_0x7cc9('0x5b')]({'where':{'id':_0x923638[_0x7cc9('0x4f')]['id']}})[_0x7cc9('0x2c')](handleEntityNotFound(_0x43945a,null))[_0x7cc9('0x2c')](function(_0x296632){if(_0x296632){_0x28d28b=_0x296632;_0x21354d[_0x7cc9('0x36')]=_[_0x7cc9('0x39')](db[_0x7cc9('0x55')][_0x7cc9('0x33')]);_0x21354d[_0x7cc9('0x38')]=_[_0x7cc9('0x39')](_0x923638[_0x7cc9('0x38')]);_0x21354d[_0x7cc9('0x3a')]=_[_0x7cc9('0x3b')](_0x21354d[_0x7cc9('0x36')],_0x21354d[_0x7cc9('0x38')]);_0x41afea[_0x7cc9('0x3d')]=_[_0x7cc9('0x3b')](_0x21354d[_0x7cc9('0x36')],qs[_0x7cc9('0x3c')](_0x923638[_0x7cc9('0x38')][_0x7cc9('0x3c')]));_0x41afea['attributes']=_0x41afea[_0x7cc9('0x3d')]['length']?_0x41afea[_0x7cc9('0x3d')]:_0x21354d['model'];_0x41afea[_0x7cc9('0x42')]=qs['sort'](_0x923638[_0x7cc9('0x38')][_0x7cc9('0x5d')]);_0x41afea[_0x7cc9('0x43')]=qs[_0x7cc9('0x3a')](_[_0x7cc9('0x44')](_0x923638[_0x7cc9('0x38')],_0x21354d[_0x7cc9('0x3a')]));if(_0x923638['query'][_0x7cc9('0x47')]){_0x41afea['where']=_['merge'](_0x41afea[_0x7cc9('0x43')],{'$or':_['map'](_0x41afea[_0x7cc9('0x3d')],function(_0x5bffb7){var _0x22dad0={};_0x22dad0[_0x5bffb7]={'$like':'%'+_0x923638['query']['filter']+'%'};return _0x22dad0;})});}if(_0x923638[_0x7cc9('0x38')][_0x7cc9('0x62')]){var _0x29faec=_0x923638[_0x7cc9('0x38')][_0x7cc9('0x62')][_0x7cc9('0x63')](',');var _0xb93fe2={};_0xb93fe2[_0x29faec[0x0]]={'$gte':moment(_0x29faec[0x1])['format'](_0x7cc9('0x64'))};_0x41afea['where']=_[_0x7cc9('0x45')](_0x41afea[_0x7cc9('0x43')],_0xb93fe2);}_0x41afea=_[_0x7cc9('0x45')]({},_0x41afea,_0x923638['options']);return _0x28d28b[_0x7cc9('0x61')](_0x41afea);}})[_0x7cc9('0x2c')](function(_0x4e9a96){if(_0x4e9a96){_0x2e5ad9=_0x4e9a96[_0x7cc9('0x3e')];if(!_0x923638[_0x7cc9('0x38')][_0x7cc9('0x3f')]('nolimit')){_0x41afea['limit']=qs['limit'](_0x923638[_0x7cc9('0x38')][_0x7cc9('0x41')]);_0x41afea['offset']=qs[_0x7cc9('0x24')](_0x923638[_0x7cc9('0x38')]['offset']);}return _0x28d28b[_0x7cc9('0x61')](_0x41afea);}})[_0x7cc9('0x2c')](function(_0x5e02a3){if(_0x5e02a3){return _0x5e02a3?{'count':_0x2e5ad9,'rows':_0x5e02a3}:null;}})[_0x7cc9('0x2c')](respondWithResult(_0x43945a,null))[_0x7cc9('0x4d')](handleError(_0x43945a,null));}; \ No newline at end of file +var _0x1c23=['getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','register','status','json','undefined','limit','offset','count','set','apply','reject','then','destroy','sendStatus','error','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','pick','VIRTUAL','filter','merge','options','includeAll','catch','show','params','keys','include','create','body','update','find','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','omit','ids','getMembers','User','order','sort','removeMembers','ChatGroupId'];(function(_0x15f6a8,_0x4cac5a){var _0x30cf05=function(_0x453322){while(--_0x453322){_0x15f6a8['push'](_0x15f6a8['shift']());}};_0x30cf05(++_0x4cac5a);}(_0x1c23,0xbf));var _0x31c2=function(_0x33730a,_0x19284f){_0x33730a=_0x33730a-0x0;var _0x418a17=_0x1c23[_0x33730a];return _0x418a17;};'use strict';var emlformat=require(_0x31c2('0x0'));var rimraf=require(_0x31c2('0x1'));var zipdir=require(_0x31c2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x31c2('0x3'));var BPromise=require(_0x31c2('0x4'));var Mustache=require(_0x31c2('0x5'));var util=require(_0x31c2('0x6'));var path=require(_0x31c2('0x7'));var sox=require(_0x31c2('0x8'));var csv=require(_0x31c2('0x9'));var ejs=require(_0x31c2('0xa'));var fs=require('fs');var fs_extra=require(_0x31c2('0xb'));var _=require('lodash');var squel=require(_0x31c2('0xc'));var crypto=require(_0x31c2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x31c2('0xe'));var toCsv=require(_0x31c2('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x31c2('0xf'));var authService=require(_0x31c2('0x10'));var qs=require(_0x31c2('0x11'));var as=require(_0x31c2('0x12'));var hardwareService=require(_0x31c2('0x13'));var logger=require(_0x31c2('0x14'))('api');var utils=require(_0x31c2('0x15'));var config=require(_0x31c2('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x31c2('0x17'))['db'];config[_0x31c2('0x18')]=_['defaults'](config[_0x31c2('0x18')],{'host':_0x31c2('0x19'),'port':0x18eb});var socket=require(_0x31c2('0x1a'))(new Redis(config[_0x31c2('0x18')]));require(_0x31c2('0x1b'))[_0x31c2('0x1c')](socket);function respondWithStatusCode(_0x1ca0da,_0x2be9d1){_0x2be9d1=_0x2be9d1||0xcc;return function(_0xce676b){if(_0xce676b){return _0x1ca0da['sendStatus'](_0x2be9d1);}return _0x1ca0da[_0x31c2('0x1d')](_0x2be9d1)['end']();};}function respondWithResult(_0x44976b,_0x1bceae){_0x1bceae=_0x1bceae||0xc8;return function(_0x28ed5f){if(_0x28ed5f){return _0x44976b[_0x31c2('0x1d')](_0x1bceae)[_0x31c2('0x1e')](_0x28ed5f);}};}function respondWithFilteredResult(_0x577480,_0x1406bb){return function(_0x1f1dd0){if(_0x1f1dd0){var _0x2903b7=typeof _0x1406bb['offset']===_0x31c2('0x1f')&&typeof _0x1406bb[_0x31c2('0x20')]===_0x31c2('0x1f');var _0x30f693=_0x1f1dd0['count'];var _0x405a79=_0x2903b7?0x0:_0x1406bb[_0x31c2('0x21')];var _0x45986b=_0x2903b7?_0x1f1dd0[_0x31c2('0x22')]:_0x1406bb['offset']+_0x1406bb[_0x31c2('0x20')];var _0x191eb8;if(_0x45986b>=_0x30f693){_0x45986b=_0x30f693;_0x191eb8=0xc8;}else{_0x191eb8=0xce;}_0x577480[_0x31c2('0x1d')](_0x191eb8);return _0x577480[_0x31c2('0x23')]('Content-Range',_0x405a79+'-'+_0x45986b+'/'+_0x30f693)['json'](_0x1f1dd0);}return null;};}function patchUpdates(_0x240194){return function(_0x45a292){try{jsonpatch[_0x31c2('0x24')](_0x45a292,_0x240194,!![]);}catch(_0x1bd0d4){return BPromise[_0x31c2('0x25')](_0x1bd0d4);}return _0x45a292['save']();};}function saveUpdates(_0x552e57,_0x59ccde){return function(_0x69eb1a){if(_0x69eb1a){return _0x69eb1a['update'](_0x552e57)[_0x31c2('0x26')](function(_0x2c1f83){return _0x2c1f83;});}return null;};}function removeEntity(_0x278a59,_0x23d6df){return function(_0x24ce55){if(_0x24ce55){return _0x24ce55[_0x31c2('0x27')]()[_0x31c2('0x26')](function(){_0x278a59['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x20e987,_0x59a546){return function(_0x48bf34){if(!_0x48bf34){_0x20e987[_0x31c2('0x28')](0x194);}return _0x48bf34;};}function handleError(_0x2ec268,_0x5802f9){_0x5802f9=_0x5802f9||0x1f4;return function(_0x1114db){logger[_0x31c2('0x29')](_0x1114db[_0x31c2('0x2a')]);if(_0x1114db[_0x31c2('0x2b')]){delete _0x1114db[_0x31c2('0x2b')];}_0x2ec268[_0x31c2('0x1d')](_0x5802f9)[_0x31c2('0x2c')](_0x1114db);};}exports[_0x31c2('0x2d')]=function(_0x5d205a,_0x39c199){var _0x5aaa9a={},_0x1e37ff={},_0x425f45={'count':0x0,'rows':[]};var _0x12b3fe=_[_0x31c2('0x2e')](db[_0x31c2('0x2f')][_0x31c2('0x30')],function(_0x3e0e30){return{'name':_0x3e0e30[_0x31c2('0x31')],'type':_0x3e0e30[_0x31c2('0x32')][_0x31c2('0x33')]};});_0x1e37ff['model']=_[_0x31c2('0x2e')](_0x12b3fe,_0x31c2('0x2b'));_0x1e37ff['query']=_['keys'](_0x5d205a[_0x31c2('0x34')]);_0x1e37ff[_0x31c2('0x35')]=_[_0x31c2('0x36')](_0x1e37ff[_0x31c2('0x37')],_0x1e37ff['query']);_0x5aaa9a[_0x31c2('0x38')]=_[_0x31c2('0x36')](_0x1e37ff[_0x31c2('0x37')],qs[_0x31c2('0x39')](_0x5d205a[_0x31c2('0x34')][_0x31c2('0x39')]));_0x5aaa9a[_0x31c2('0x38')]=_0x5aaa9a['attributes'][_0x31c2('0x3a')]?_0x5aaa9a[_0x31c2('0x38')]:_0x1e37ff[_0x31c2('0x37')];if(!_0x5d205a[_0x31c2('0x34')][_0x31c2('0x3b')](_0x31c2('0x3c'))){_0x5aaa9a[_0x31c2('0x20')]=qs[_0x31c2('0x20')](_0x5d205a['query'][_0x31c2('0x20')]);_0x5aaa9a[_0x31c2('0x21')]=qs['offset'](_0x5d205a['query'][_0x31c2('0x21')]);}_0x5aaa9a['order']=qs['sort'](_0x5d205a[_0x31c2('0x34')]['sort']);_0x5aaa9a[_0x31c2('0x3d')]=qs['filters'](_[_0x31c2('0x3e')](_0x5d205a[_0x31c2('0x34')],_0x1e37ff['filters']),_0x12b3fe);if(_0x5d205a[_0x31c2('0x34')]['filter']){_0x5aaa9a[_0x31c2('0x3d')]=_['merge'](_0x5aaa9a[_0x31c2('0x3d')],{'$or':_['map'](_0x12b3fe,function(_0x4c6d57){if(_0x4c6d57[_0x31c2('0x32')]!==_0x31c2('0x3f')){var _0x19016e={};_0x19016e[_0x4c6d57[_0x31c2('0x2b')]]={'$like':'%'+_0x5d205a[_0x31c2('0x34')][_0x31c2('0x40')]+'%'};return _0x19016e;}})});}_0x5aaa9a=_[_0x31c2('0x41')]({},_0x5aaa9a,_0x5d205a[_0x31c2('0x42')]);var _0x590711={'where':_0x5aaa9a['where']};return db['ChatGroup'][_0x31c2('0x22')](_0x590711)[_0x31c2('0x26')](function(_0x1e8089){_0x425f45['count']=_0x1e8089;if(_0x5d205a[_0x31c2('0x34')][_0x31c2('0x43')]){_0x5aaa9a['include']=[{'all':!![]}];}return db[_0x31c2('0x2f')]['findAll'](_0x5aaa9a);})['then'](function(_0x70340c){_0x425f45['rows']=_0x70340c;return _0x425f45;})[_0x31c2('0x26')](respondWithFilteredResult(_0x39c199,_0x5aaa9a))[_0x31c2('0x44')](handleError(_0x39c199,null));};exports[_0x31c2('0x45')]=function(_0x2f1826,_0x5c72b8){var _0x59f5bb={'raw':!![],'where':{'id':_0x2f1826[_0x31c2('0x46')]['id']}},_0x33a28a={};_0x33a28a[_0x31c2('0x37')]=_[_0x31c2('0x47')](db[_0x31c2('0x2f')][_0x31c2('0x30')]);_0x33a28a[_0x31c2('0x34')]=_[_0x31c2('0x47')](_0x2f1826['query']);_0x33a28a['filters']=_[_0x31c2('0x36')](_0x33a28a[_0x31c2('0x37')],_0x33a28a[_0x31c2('0x34')]);_0x59f5bb[_0x31c2('0x38')]=_['intersection'](_0x33a28a[_0x31c2('0x37')],qs[_0x31c2('0x39')](_0x2f1826[_0x31c2('0x34')]['fields']));_0x59f5bb['attributes']=_0x59f5bb[_0x31c2('0x38')][_0x31c2('0x3a')]?_0x59f5bb[_0x31c2('0x38')]:_0x33a28a[_0x31c2('0x37')];if(_0x2f1826[_0x31c2('0x34')]['includeAll']){_0x59f5bb[_0x31c2('0x48')]=[{'all':!![]}];}_0x59f5bb=_[_0x31c2('0x41')]({},_0x59f5bb,_0x2f1826[_0x31c2('0x42')]);return db[_0x31c2('0x2f')]['find'](_0x59f5bb)[_0x31c2('0x26')](handleEntityNotFound(_0x5c72b8,null))['then'](respondWithResult(_0x5c72b8,null))['catch'](handleError(_0x5c72b8,null));};exports['create']=function(_0x4ab9ab,_0x23af02){return db[_0x31c2('0x2f')][_0x31c2('0x49')](_0x4ab9ab[_0x31c2('0x4a')],{})[_0x31c2('0x26')](respondWithResult(_0x23af02,0xc9))[_0x31c2('0x44')](handleError(_0x23af02,null));};exports[_0x31c2('0x4b')]=function(_0x93d9ae,_0x55cb08){if(_0x93d9ae[_0x31c2('0x4a')]['id']){delete _0x93d9ae[_0x31c2('0x4a')]['id'];}return db[_0x31c2('0x2f')][_0x31c2('0x4c')]({'where':{'id':_0x93d9ae[_0x31c2('0x46')]['id']}})[_0x31c2('0x26')](handleEntityNotFound(_0x55cb08,null))[_0x31c2('0x26')](saveUpdates(_0x93d9ae[_0x31c2('0x4a')],null))[_0x31c2('0x26')](respondWithResult(_0x55cb08,null))[_0x31c2('0x44')](handleError(_0x55cb08,null));};exports[_0x31c2('0x27')]=function(_0x23455d,_0x79eee4){return db[_0x31c2('0x2f')][_0x31c2('0x4c')]({'where':{'id':_0x23455d[_0x31c2('0x46')]['id']}})[_0x31c2('0x26')](handleEntityNotFound(_0x79eee4,null))[_0x31c2('0x26')](removeEntity(_0x79eee4,null))[_0x31c2('0x44')](handleError(_0x79eee4,null));};exports[_0x31c2('0x4d')]=function(_0x5cf3e9,_0x56f73f){return db[_0x31c2('0x2f')][_0x31c2('0x4d')]()[_0x31c2('0x26')](respondWithResult(_0x56f73f,null))[_0x31c2('0x44')](handleError(_0x56f73f,null));};exports[_0x31c2('0x4e')]=function(_0x5801fc,_0xc53739,_0xba2ccb){return db[_0x31c2('0x4f')][_0x31c2('0x22')]({'where':{'ChatGroupId':_0x5801fc[_0x31c2('0x46')]['id'],'ToId':_0x5801fc[_0x31c2('0x50')]['id'],'read':![]}})[_0x31c2('0x26')](function(_0xc15c5d){return{'id':_[_0x31c2('0x51')](_0x5801fc[_0x31c2('0x46')]['id']),'count':_0xc15c5d};})[_0x31c2('0x26')](respondWithResult(_0xc53739,null))[_0x31c2('0x44')](handleError(_0xc53739,null));};exports[_0x31c2('0x52')]=function(_0x3faa4f,_0x3601d9,_0x21fb2f){return db['ChatGroup'][_0x31c2('0x4c')]({'where':{'id':_0x3faa4f[_0x31c2('0x46')]['id']}})[_0x31c2('0x26')](handleEntityNotFound(_0x3601d9,null))['then'](function(_0x4cfd6c){if(_0x4cfd6c){return _0x4cfd6c[_0x31c2('0x52')](_0x3faa4f[_0x31c2('0x4a')]['ids'],_[_0x31c2('0x53')](_0x3faa4f[_0x31c2('0x4a')],[_0x31c2('0x54'),'id'])||{});}})[_0x31c2('0x26')](respondWithResult(_0x3601d9,null))[_0x31c2('0x44')](handleError(_0x3601d9,null));};exports[_0x31c2('0x55')]=function(_0x4c5019,_0x3c9efa,_0x35e189){var _0x5d1e97={};var _0xcac686={};var _0x2ceba9;var _0x298efc;return db[_0x31c2('0x2f')]['findOne']({'where':{'id':_0x4c5019['params']['id']}})['then'](handleEntityNotFound(_0x3c9efa,null))[_0x31c2('0x26')](function(_0x4e4cb8){if(_0x4e4cb8){_0x2ceba9=_0x4e4cb8;_0xcac686['model']=_[_0x31c2('0x47')](db[_0x31c2('0x56')][_0x31c2('0x30')]);_0xcac686[_0x31c2('0x34')]=_[_0x31c2('0x47')](_0x4c5019[_0x31c2('0x34')]);_0xcac686[_0x31c2('0x35')]=_[_0x31c2('0x36')](_0xcac686['model'],_0xcac686[_0x31c2('0x34')]);_0x5d1e97[_0x31c2('0x38')]=_[_0x31c2('0x36')](_0xcac686[_0x31c2('0x37')],qs[_0x31c2('0x39')](_0x4c5019[_0x31c2('0x34')][_0x31c2('0x39')]));_0x5d1e97[_0x31c2('0x38')]=_0x5d1e97[_0x31c2('0x38')]['length']?_0x5d1e97[_0x31c2('0x38')]:_0xcac686[_0x31c2('0x37')];_0x5d1e97[_0x31c2('0x57')]=qs[_0x31c2('0x58')](_0x4c5019['query']['sort']);_0x5d1e97[_0x31c2('0x3d')]=qs[_0x31c2('0x35')](_['pick'](_0x4c5019['query'],_0xcac686[_0x31c2('0x35')]));if(_0x4c5019[_0x31c2('0x34')][_0x31c2('0x40')]){_0x5d1e97[_0x31c2('0x3d')]=_[_0x31c2('0x41')](_0x5d1e97[_0x31c2('0x3d')],{'$or':_[_0x31c2('0x2e')](_0x5d1e97[_0x31c2('0x38')],function(_0x4760d0){var _0x5e1f03={};_0x5e1f03[_0x4760d0]={'$like':'%'+_0x4c5019[_0x31c2('0x34')][_0x31c2('0x40')]+'%'};return _0x5e1f03;})});}_0x5d1e97=_['merge']({},_0x5d1e97,_0x4c5019[_0x31c2('0x42')]);return _0x2ceba9[_0x31c2('0x55')](_0x5d1e97);}})[_0x31c2('0x26')](function(_0x2353cd){if(_0x2353cd){_0x298efc=_0x2353cd['length'];if(!_0x4c5019[_0x31c2('0x34')][_0x31c2('0x3b')](_0x31c2('0x3c'))){_0x5d1e97[_0x31c2('0x20')]=qs[_0x31c2('0x20')](_0x4c5019['query'][_0x31c2('0x20')]);_0x5d1e97['offset']=qs[_0x31c2('0x21')](_0x4c5019['query']['offset']);}return _0x2ceba9[_0x31c2('0x55')](_0x5d1e97);}})[_0x31c2('0x26')](function(_0x1f1169){if(_0x1f1169){return _0x1f1169?{'count':_0x298efc,'rows':_0x1f1169}:null;}})[_0x31c2('0x26')](respondWithResult(_0x3c9efa,null))['catch'](handleError(_0x3c9efa,null));};exports[_0x31c2('0x59')]=function(_0x23a07c,_0xce46c,_0x565141){return db[_0x31c2('0x2f')][_0x31c2('0x4c')]({'where':{'id':_0x23a07c[_0x31c2('0x46')]['id']}})[_0x31c2('0x26')](handleEntityNotFound(_0xce46c,null))[_0x31c2('0x26')](function(_0x7dc594){if(_0x7dc594){return _0x7dc594[_0x31c2('0x59')](_0x23a07c['query'][_0x31c2('0x54')]);}})['then'](respondWithStatusCode(_0xce46c,null))[_0x31c2('0x44')](handleError(_0xce46c,null));};exports['addMessage']=function(_0x2c17e3,_0x4c12bc,_0x3f0a23){if(_0x2c17e3[_0x31c2('0x4a')]['id']){delete _0x2c17e3[_0x31c2('0x4a')]['id'];}return db[_0x31c2('0x2f')]['find']({'where':{'id':_0x2c17e3[_0x31c2('0x46')]['id']}})[_0x31c2('0x26')](handleEntityNotFound(_0x4c12bc,null))[_0x31c2('0x26')](function(_0x5758d7){if(_0x5758d7){_0x2c17e3['body'][_0x31c2('0x5a')]=_0x5758d7['id'];return db[_0x31c2('0x4f')][_0x31c2('0x49')](_0x2c17e3['body']);}})['then'](respondWithResult(_0x4c12bc,null))[_0x31c2('0x44')](handleError(_0x4c12bc,null));};exports[_0x31c2('0x5b')]=function(_0x220221,_0x5a1051,_0x3fd503){var _0x575861={};var _0xf68549={};var _0x5f0e35;var _0x15dc36;return db[_0x31c2('0x2f')]['findOne']({'where':{'id':_0x220221['params']['id']}})['then'](handleEntityNotFound(_0x5a1051,null))[_0x31c2('0x26')](function(_0x4246b7){if(_0x4246b7){_0x5f0e35=_0x4246b7;_0xf68549[_0x31c2('0x37')]=_[_0x31c2('0x47')](db['ChatInternalMessage'][_0x31c2('0x30')]);_0xf68549[_0x31c2('0x34')]=_['keys'](_0x220221[_0x31c2('0x34')]);_0xf68549[_0x31c2('0x35')]=_[_0x31c2('0x36')](_0xf68549[_0x31c2('0x37')],_0xf68549[_0x31c2('0x34')]);_0x575861[_0x31c2('0x38')]=_[_0x31c2('0x36')](_0xf68549[_0x31c2('0x37')],qs['fields'](_0x220221[_0x31c2('0x34')][_0x31c2('0x39')]));_0x575861['attributes']=_0x575861[_0x31c2('0x38')]['length']?_0x575861[_0x31c2('0x38')]:_0xf68549[_0x31c2('0x37')];_0x575861[_0x31c2('0x57')]=qs[_0x31c2('0x58')](_0x220221[_0x31c2('0x34')][_0x31c2('0x58')]);_0x575861[_0x31c2('0x3d')]=qs[_0x31c2('0x35')](_[_0x31c2('0x3e')](_0x220221['query'],_0xf68549['filters']));if(_0x220221[_0x31c2('0x34')]['filter']){_0x575861['where']=_[_0x31c2('0x41')](_0x575861[_0x31c2('0x3d')],{'$or':_[_0x31c2('0x2e')](_0x575861[_0x31c2('0x38')],function(_0x3dae09){var _0x35732d={};_0x35732d[_0x3dae09]={'$like':'%'+_0x220221[_0x31c2('0x34')][_0x31c2('0x40')]+'%'};return _0x35732d;})});}if(_0x220221[_0x31c2('0x34')][_0x31c2('0x5c')]){var _0x2fc6ab=_0x220221['query'][_0x31c2('0x5c')]['split'](',');var _0x29a2f7={};_0x29a2f7[_0x2fc6ab[0x0]]={'$gte':moment(_0x2fc6ab[0x1])['format'](_0x31c2('0x5d'))};_0x575861[_0x31c2('0x3d')]=_['merge'](_0x575861[_0x31c2('0x3d')],_0x29a2f7);}_0x575861=_[_0x31c2('0x41')]({},_0x575861,_0x220221[_0x31c2('0x42')]);return _0x5f0e35[_0x31c2('0x5b')](_0x575861);}})[_0x31c2('0x26')](function(_0x3da1f9){if(_0x3da1f9){_0x15dc36=_0x3da1f9['length'];if(!_0x220221[_0x31c2('0x34')]['hasOwnProperty'](_0x31c2('0x3c'))){_0x575861[_0x31c2('0x20')]=qs[_0x31c2('0x20')](_0x220221[_0x31c2('0x34')][_0x31c2('0x20')]);_0x575861[_0x31c2('0x21')]=qs[_0x31c2('0x21')](_0x220221[_0x31c2('0x34')]['offset']);}return _0x5f0e35[_0x31c2('0x5b')](_0x575861);}})[_0x31c2('0x26')](function(_0x5e08cc){if(_0x5e08cc){return _0x5e08cc?{'count':_0x15dc36,'rows':_0x5e08cc}:null;}})['then'](respondWithResult(_0x5a1051,null))[_0x31c2('0x44')](handleError(_0x5a1051,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 11cdfd2..e87655f 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 _0x43c4=['ChatGroup','setMaxListeners','save','update','remove','emit','hook','../../mysqldb'];(function(_0x3eff98,_0x209781){var _0x40bc7e=function(_0x48dd99){while(--_0x48dd99){_0x3eff98['push'](_0x3eff98['shift']());}};_0x40bc7e(++_0x209781);}(_0x43c4,0xf7));var _0x443c=function(_0x31eff5,_0x262efe){_0x31eff5=_0x31eff5-0x0;var _0x13b099=_0x43c4[_0x31eff5];return _0x13b099;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x443c('0x0'))['db'][_0x443c('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x443c('0x2')](0x0);var events={'afterCreate':_0x443c('0x3'),'afterUpdate':_0x443c('0x4'),'afterDestroy':_0x443c('0x5')};function emitEvent(_0x946a91){return function(_0x8dcaf2,_0x362c49,_0x56a8c4){ChatGroupEvents[_0x443c('0x6')](_0x946a91+':'+_0x8dcaf2['id'],_0x8dcaf2);ChatGroupEvents[_0x443c('0x6')](_0x946a91,_0x8dcaf2);_0x56a8c4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x443c('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x44d5=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x34111e,_0x57fa47){var _0x223bcc=function(_0x45d416){while(--_0x45d416){_0x34111e['push'](_0x34111e['shift']());}};_0x223bcc(++_0x57fa47);}(_0x44d5,0xa1));var _0x544d=function(_0x9cae0c,_0x42b12d){_0x9cae0c=_0x9cae0c-0x0;var _0x45542e=_0x44d5[_0x9cae0c];return _0x45542e;};'use strict';var EventEmitter=require(_0x544d('0x0'));var ChatGroup=require('../../mysqldb')['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x544d('0x1')](0x0);var events={'afterCreate':_0x544d('0x2'),'afterUpdate':_0x544d('0x3'),'afterDestroy':_0x544d('0x4')};function emitEvent(_0x38a964){return function(_0x217129,_0x586a8a,_0x2a9784){ChatGroupEvents[_0x544d('0x5')](_0x38a964+':'+_0x217129['id'],_0x217129);ChatGroupEvents[_0x544d('0x5')](_0x38a964,_0x217129);_0x2a9784(null);};}for(var e in events){if(events[_0x544d('0x6')](e)){var event=events[e];ChatGroup[_0x544d('0x7')](e,emitEvent(event));}}module[_0x544d('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 6f6e3d1..7c81e11 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 _0xf8ac=['../../config/environment','./chatGroup.attributes','define','ChatGroup','chat_groups','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x18d879,_0x566761){var _0x14ffff=function(_0x3520cd){while(--_0x3520cd){_0x18d879['push'](_0x18d879['shift']());}};_0x14ffff(++_0x566761);}(_0xf8ac,0xc8));var _0xcf8a=function(_0x26d386,_0x1660c0){_0x26d386=_0x26d386-0x0;var _0x4ef9a8=_0xf8ac[_0x26d386];return _0x4ef9a8;};'use strict';var _=require(_0xcf8a('0x0'));var util=require('util');var logger=require(_0xcf8a('0x1'))(_0xcf8a('0x2'));var moment=require(_0xcf8a('0x3'));var BPromise=require(_0xcf8a('0x4'));var rp=require(_0xcf8a('0x5'));var fs=require('fs');var path=require(_0xcf8a('0x6'));var rimraf=require(_0xcf8a('0x7'));var config=require(_0xcf8a('0x8'));var attributes=require(_0xcf8a('0x9'));module['exports']=function(_0x5b1acd,_0x55d864){return _0x5b1acd[_0xcf8a('0xa')](_0xcf8a('0xb'),attributes,{'tableName':_0xcf8a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f1a=['rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x7f82c7,_0x2bec9d){var _0xccd46=function(_0x14083a){while(--_0x14083a){_0x7f82c7['push'](_0x7f82c7['shift']());}};_0xccd46(++_0x2bec9d);}(_0x4f1a,0x6e));var _0xa4f1=function(_0x5651ef,_0x4fd99a){_0x5651ef=_0x5651ef-0x0;var _0x392fba=_0x4f1a[_0x5651ef];return _0x392fba;};'use strict';var _=require(_0xa4f1('0x0'));var util=require(_0xa4f1('0x1'));var logger=require(_0xa4f1('0x2'))(_0xa4f1('0x3'));var moment=require(_0xa4f1('0x4'));var BPromise=require('bluebird');var rp=require(_0xa4f1('0x5'));var fs=require('fs');var path=require(_0xa4f1('0x6'));var rimraf=require(_0xa4f1('0x7'));var config=require(_0xa4f1('0x8'));var attributes=require(_0xa4f1('0x9'));module[_0xa4f1('0xa')]=function(_0x22bc72,_0x433d5e){return _0x22bc72[_0xa4f1('0xb')](_0xa4f1('0xc'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 7a67acb..af8c10a 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 _0x79b2=['lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','message','catch'];(function(_0x1c954d,_0x242aa2){var _0x5afef3=function(_0x46bae4){while(--_0x46bae4){_0x1c954d['push'](_0x1c954d['shift']());}};_0x5afef3(++_0x242aa2);}(_0x79b2,0x142));var _0x279b=function(_0x308dcb,_0x58d691){_0x308dcb=_0x308dcb-0x0;var _0x24eec1=_0x79b2[_0x308dcb];return _0x24eec1;};'use strict';var _=require(_0x279b('0x0'));var util=require('util');var moment=require(_0x279b('0x1'));var BPromise=require('bluebird');var rs=require(_0x279b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x279b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x279b('0x4'))(_0x279b('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x279b('0x6')][_0x279b('0x7')]({'port':0x232a});config[_0x279b('0x8')]=_[_0x279b('0x9')](config[_0x279b('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x279b('0xa'))(new Redis(config[_0x279b('0x8')]));require(_0x279b('0xb'))[_0x279b('0xc')](socket);function respondWithRpcPromise(_0x3fcc99,_0x43a8fd,_0x3af055){return new BPromise(function(_0x3ba356,_0x449b44){return client[_0x279b('0xd')](_0x3fcc99,_0x3af055)[_0x279b('0xe')](function(_0x3c8333){logger[_0x279b('0xf')](_0x279b('0x10'),_0x43a8fd,_0x279b('0x11'));logger[_0x279b('0x12')](_0x279b('0x13'),_0x43a8fd,_0x279b('0x11'),JSON['stringify'](_0x3c8333));if(_0x3c8333['error']){if(_0x3c8333[_0x279b('0x14')]['code']===0x1f4){logger[_0x279b('0x14')](_0x279b('0x10'),_0x43a8fd,_0x3c8333['error']['message']);return _0x449b44(_0x3c8333['error'][_0x279b('0x15')]);}logger[_0x279b('0x14')](_0x279b('0x10'),_0x43a8fd,_0x3c8333['error']['message']);return _0x3ba356(_0x3c8333[_0x279b('0x14')]['message']);}else{logger[_0x279b('0xf')](_0x279b('0x10'),_0x43a8fd,'request\x20sent');_0x3ba356(_0x3c8333['result']['message']);}})[_0x279b('0x16')](function(_0x10be24){logger[_0x279b('0x14')](_0x279b('0x10'),_0x43a8fd,_0x10be24);_0x449b44(_0x10be24);});});} \ No newline at end of file +var _0x1247=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatGroup.socket','register','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x524c1e,_0x16322d){var _0x4d3862=function(_0x4e4cb8){while(--_0x4e4cb8){_0x524c1e['push'](_0x524c1e['shift']());}};_0x4d3862(++_0x16322d);}(_0x1247,0xb6));var _0x7124=function(_0x23b655,_0x4feb2b){_0x23b655=_0x23b655-0x0;var _0x364b32=_0x1247[_0x23b655];return _0x364b32;};'use strict';var _=require(_0x7124('0x0'));var util=require(_0x7124('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7124('0x2'));var fs=require('fs');var Redis=require(_0x7124('0x3'));var db=require(_0x7124('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7124('0x5'))(_0x7124('0x6'));var config=require(_0x7124('0x7'));var jayson=require(_0x7124('0x8'));var client=jayson[_0x7124('0x9')][_0x7124('0xa')]({'port':0x232a});config[_0x7124('0xb')]=_[_0x7124('0xc')](config[_0x7124('0xb')],{'host':_0x7124('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7124('0xb')]));require(_0x7124('0xe'))[_0x7124('0xf')](socket);function respondWithRpcPromise(_0x3baa38,_0x1608e2,_0x2508ae){return new BPromise(function(_0x84e46c,_0x5c256a){return client[_0x7124('0x10')](_0x3baa38,_0x2508ae)['then'](function(_0x38fabd){logger[_0x7124('0x11')](_0x7124('0x12'),_0x1608e2,_0x7124('0x13'));logger['debug'](_0x7124('0x14'),_0x1608e2,_0x7124('0x13'),JSON['stringify'](_0x38fabd));if(_0x38fabd['error']){if(_0x38fabd[_0x7124('0x15')][_0x7124('0x16')]===0x1f4){logger[_0x7124('0x15')](_0x7124('0x12'),_0x1608e2,_0x38fabd[_0x7124('0x15')][_0x7124('0x17')]);return _0x5c256a(_0x38fabd[_0x7124('0x15')][_0x7124('0x17')]);}logger[_0x7124('0x15')](_0x7124('0x12'),_0x1608e2,_0x38fabd[_0x7124('0x15')][_0x7124('0x17')]);return _0x84e46c(_0x38fabd[_0x7124('0x15')][_0x7124('0x17')]);}else{logger[_0x7124('0x11')](_0x7124('0x12'),_0x1608e2,_0x7124('0x13'));_0x84e46c(_0x38fabd[_0x7124('0x18')][_0x7124('0x17')]);}})[_0x7124('0x19')](function(_0x4385e3){logger[_0x7124('0x15')](_0x7124('0x12'),_0x1608e2,_0x4385e3);_0x5c256a(_0x4385e3);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 43be41c..fa8a3e3 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 _0xbc67=['chatGroup:','./chatGroup.events','save','remove','update','emit','removeListener','register','length'];(function(_0x52e2a8,_0x22d875){var _0x3d3fb0=function(_0x37e675){while(--_0x37e675){_0x52e2a8['push'](_0x52e2a8['shift']());}};_0x3d3fb0(++_0x22d875);}(_0xbc67,0x64));var _0x7bc6=function(_0x5afb50,_0x39f4a6){_0x5afb50=_0x5afb50-0x0;var _0x4f6e0e=_0xbc67[_0x5afb50];return _0x4f6e0e;};'use strict';var ChatGroupEvents=require(_0x7bc6('0x0'));var events=[_0x7bc6('0x1'),_0x7bc6('0x2'),_0x7bc6('0x3')];function createListener(_0x516b66,_0x42eb13){return function(_0x25068c){_0x42eb13[_0x7bc6('0x4')](_0x516b66,_0x25068c);};}function removeListener(_0x4d8244,_0x19658b){return function(){ChatGroupEvents[_0x7bc6('0x5')](_0x4d8244,_0x19658b);};}exports[_0x7bc6('0x6')]=function(_0x564b67){for(var _0x17587f=0x0,_0x223f97=events[_0x7bc6('0x7')];_0x17587f<_0x223f97;_0x17587f++){var _0x554e64=events[_0x17587f];var _0x26febc=createListener(_0x7bc6('0x8')+_0x554e64,_0x564b67);ChatGroupEvents['on'](_0x554e64,_0x26febc);}}; \ No newline at end of file +var _0xecf2=['remove','update','register','length','chatGroup:'];(function(_0x5327de,_0x2680bd){var _0x5c3704=function(_0x436598){while(--_0x436598){_0x5327de['push'](_0x5327de['shift']());}};_0x5c3704(++_0x2680bd);}(_0xecf2,0x17c));var _0x2ecf=function(_0x75c1c3,_0x2d5442){_0x75c1c3=_0x75c1c3-0x0;var _0xbb84bc=_0xecf2[_0x75c1c3];return _0xbb84bc;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=['save',_0x2ecf('0x0'),_0x2ecf('0x1')];function createListener(_0x5d6325,_0x472c1e){return function(_0x3669a0){_0x472c1e['emit'](_0x5d6325,_0x3669a0);};}function removeListener(_0x4ebbcf,_0x959a14){return function(){ChatGroupEvents['removeListener'](_0x4ebbcf,_0x959a14);};}exports[_0x2ecf('0x2')]=function(_0x5bba6d){for(var _0x36cc38=0x0,_0x3bb6d0=events[_0x2ecf('0x3')];_0x36cc38<_0x3bb6d0;_0x36cc38++){var _0x4dfe93=events[_0x36cc38];var _0x5cac7b=createListener(_0x2ecf('0x4')+_0x4dfe93,_0x5bba6d);ChatGroupEvents['on'](_0x4dfe93,_0x5cac7b);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 5eed08d..ed8747b 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 _0xcdbd=['describe','/:id','show','/:id/unread','isAuthenticated','getUnread','/:id/members','getMembers','getMessages','post','create','addMembers','/:id/messages','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','index','/describe'];(function(_0x1f4b40,_0x52be55){var _0x48696b=function(_0x4add66){while(--_0x4add66){_0x1f4b40['push'](_0x1f4b40['shift']());}};_0x48696b(++_0x52be55);}(_0xcdbd,0xc0));var _0xdcdb=function(_0x5c99d6,_0x2602fa){_0x5c99d6=_0x5c99d6-0x0;var _0x3480e3=_0xcdbd[_0x5c99d6];return _0x3480e3;};'use strict';var multer=require(_0xdcdb('0x0'));var util=require(_0xdcdb('0x1'));var path=require('path');var timeout=require(_0xdcdb('0x2'));var express=require(_0xdcdb('0x3'));var router=express['Router']();var fs_extra=require(_0xdcdb('0x4'));var auth=require(_0xdcdb('0x5'));var interaction=require(_0xdcdb('0x6'));var config=require('../../config/environment');var controller=require(_0xdcdb('0x7'));router[_0xdcdb('0x8')]('/',auth['isAuthenticated'](),controller[_0xdcdb('0x9')]);router['get'](_0xdcdb('0xa'),auth['isAuthenticated'](),controller[_0xdcdb('0xb')]);router[_0xdcdb('0x8')](_0xdcdb('0xc'),auth['isAuthenticated'](),controller[_0xdcdb('0xd')]);router[_0xdcdb('0x8')](_0xdcdb('0xe'),auth[_0xdcdb('0xf')](),controller[_0xdcdb('0x10')]);router['get'](_0xdcdb('0x11'),auth[_0xdcdb('0xf')](),controller[_0xdcdb('0x12')]);router[_0xdcdb('0x8')]('/:id/messages',auth[_0xdcdb('0xf')](),controller[_0xdcdb('0x13')]);router[_0xdcdb('0x14')]('/',auth[_0xdcdb('0xf')](),controller[_0xdcdb('0x15')]);router[_0xdcdb('0x14')]('/:id/members',auth[_0xdcdb('0xf')](),controller[_0xdcdb('0x16')]);router[_0xdcdb('0x14')](_0xdcdb('0x17'),auth[_0xdcdb('0xf')](),controller['addMessage']);router[_0xdcdb('0x18')](_0xdcdb('0xc'),auth[_0xdcdb('0xf')](),controller[_0xdcdb('0x19')]);router[_0xdcdb('0x1a')](_0xdcdb('0xc'),auth[_0xdcdb('0xf')](),controller[_0xdcdb('0x1b')]);router[_0xdcdb('0x1a')](_0xdcdb('0x11'),auth[_0xdcdb('0xf')](),controller['removeMembers']);module[_0xdcdb('0x1c')]=router; \ No newline at end of file +var _0xf367=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','index','/describe','isAuthenticated','/:id','getUnread','getMembers','getMessages','post','create','/:id/members','addMembers','/:id/messages','addMessage','put','update','delete','destroy','removeMembers','multer','util','path','express','Router','fs-extra'];(function(_0x3be4da,_0x492933){var _0x360e8c=function(_0x3dc6b2){while(--_0x3dc6b2){_0x3be4da['push'](_0x3be4da['shift']());}};_0x360e8c(++_0x492933);}(_0xf367,0x173));var _0x7f36=function(_0x20efdd,_0x5ede0f){_0x20efdd=_0x20efdd-0x0;var _0x431b10=_0xf367[_0x20efdd];return _0x431b10;};'use strict';var multer=require(_0x7f36('0x0'));var util=require(_0x7f36('0x1'));var path=require(_0x7f36('0x2'));var timeout=require('connect-timeout');var express=require(_0x7f36('0x3'));var router=express[_0x7f36('0x4')]();var fs_extra=require(_0x7f36('0x5'));var auth=require(_0x7f36('0x6'));var interaction=require(_0x7f36('0x7'));var config=require(_0x7f36('0x8'));var controller=require(_0x7f36('0x9'));router[_0x7f36('0xa')]('/',auth['isAuthenticated'](),controller[_0x7f36('0xb')]);router[_0x7f36('0xa')](_0x7f36('0xc'),auth[_0x7f36('0xd')](),controller['describe']);router[_0x7f36('0xa')](_0x7f36('0xe'),auth[_0x7f36('0xd')](),controller['show']);router[_0x7f36('0xa')]('/:id/unread',auth[_0x7f36('0xd')](),controller[_0x7f36('0xf')]);router[_0x7f36('0xa')]('/:id/members',auth[_0x7f36('0xd')](),controller[_0x7f36('0x10')]);router['get']('/:id/messages',auth[_0x7f36('0xd')](),controller[_0x7f36('0x11')]);router[_0x7f36('0x12')]('/',auth[_0x7f36('0xd')](),controller[_0x7f36('0x13')]);router[_0x7f36('0x12')](_0x7f36('0x14'),auth['isAuthenticated'](),controller[_0x7f36('0x15')]);router[_0x7f36('0x12')](_0x7f36('0x16'),auth[_0x7f36('0xd')](),controller[_0x7f36('0x17')]);router[_0x7f36('0x18')](_0x7f36('0xe'),auth[_0x7f36('0xd')](),controller[_0x7f36('0x19')]);router[_0x7f36('0x1a')](_0x7f36('0xe'),auth[_0x7f36('0xd')](),controller[_0x7f36('0x1b')]);router['delete'](_0x7f36('0x14'),auth[_0x7f36('0xd')](),controller[_0x7f36('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 66199d0..5de8988 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 _0x6836=['BOOLEAN','ENUM','thumb','TEXT','STRING','DATE','out','sequelize','exports'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x6836,0x1c0));var _0x6683=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x6836[_0xbd08b4];return _0x314f1e;};'use strict';var Sequelize=require(_0x6683('0x0'));module[_0x6683('0x1')]={'closed':{'type':Sequelize[_0x6683('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x6683('0x3')]('star',_0x6683('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x6683('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x6683('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x6683('0x7')]},'disposition':{'type':Sequelize[_0x6683('0x6')]},'secondDisposition':{'type':Sequelize[_0x6683('0x6')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x6683('0x6')]},'browserName':{'type':Sequelize[_0x6683('0x6')]},'browserVersion':{'type':Sequelize[_0x6683('0x6')]},'osName':{'type':Sequelize[_0x6683('0x6')]},'osVersion':{'type':Sequelize[_0x6683('0x6')]},'deviceModel':{'type':Sequelize[_0x6683('0x6')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x6683('0x5')]},'customerIp':{'type':Sequelize[_0x6683('0x6')]},'formData':{'type':Sequelize[_0x6683('0x5')]('long')},'read1stAt':{'type':Sequelize[_0x6683('0x7')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x6683('0x3')]('in',_0x6683('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x6683('0x6')]},'customerPort':{'type':Sequelize[_0x6683('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x6683('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x6683('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x4483=['out','sequelize','exports','BOOLEAN','ENUM','star','thumb','TEXT','STRING','DATE','long'];(function(_0x4d84f7,_0x31e6c0){var _0xb15012=function(_0xa71313){while(--_0xa71313){_0x4d84f7['push'](_0x4d84f7['shift']());}};_0xb15012(++_0x31e6c0);}(_0x4483,0x1a3));var _0x3448=function(_0x55089a,_0x53cf4f){_0x55089a=_0x55089a-0x0;var _0x2397fe=_0x4483[_0x55089a];return _0x2397fe;};'use strict';var Sequelize=require(_0x3448('0x0'));module[_0x3448('0x1')]={'closed':{'type':Sequelize[_0x3448('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x3448('0x3')](_0x3448('0x4'),_0x3448('0x5')),'defaultValue':_0x3448('0x4')},'ratingMessage':{'type':Sequelize[_0x3448('0x6')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x3448('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x3448('0x8')]},'disposition':{'type':Sequelize[_0x3448('0x7')]},'secondDisposition':{'type':Sequelize[_0x3448('0x7')]},'thirdDisposition':{'type':Sequelize[_0x3448('0x7')]},'note':{'type':Sequelize[_0x3448('0x7')]},'browserName':{'type':Sequelize[_0x3448('0x7')]},'browserVersion':{'type':Sequelize[_0x3448('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x3448('0x7')]},'deviceVendor':{'type':Sequelize[_0x3448('0x7')]},'deviceType':{'type':Sequelize[_0x3448('0x7')]},'referer':{'type':Sequelize[_0x3448('0x6')]},'customerIp':{'type':Sequelize[_0x3448('0x7')]},'formData':{'type':Sequelize[_0x3448('0x6')](_0x3448('0x9'))},'read1stAt':{'type':Sequelize[_0x3448('0x8')]},'lastMsgAt':{'type':Sequelize[_0x3448('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x3448('0x3')]('in',_0x3448('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x3448('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x3448('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 248a0cd..f64ea70 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 _0x225b=['Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','ChatInteractionId','all','params','rawAttributes','options','create','describe','findOne','ChatWebsite','vidaooTopic','vidaooNote','vidaooMetadata','vidaooApiKey','email','POST','isNull','follow','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','attachmentDownload','Unauthorized','Attachment','ChatOfflineMessageId','root','join','download','close','mailTranscript','format','transcript-%s.txt','now','pathTranscript','Messages','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','agent_alias','alias','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','Smtp','service','host','port','secure','authentication','auth','pass','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','ids','getMessages','hasOwnProperty','rows','getMyMessages','nolimit','include','findAll','addTags','setTags','omit','spread','emit','chatInteractionTags:save','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Account','Owner','mkdirSync','Chat','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','referer','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','views','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','end','stack','name','send','merge','body','contact','agent','account','map','fullname','TagIds','Tags','forEach','push','talking','unmanaged','abandoned','closed','UserId','waiting','disposition','answered','total','index','ChatInteraction','type','key','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','users','u.id\x20=\x20ui.UserId','left_join','cm_contacts','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','start','compact','isEmpty','ChatWebsiteId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','sequelize','toString','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','contactName','c.firstName'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x225b,0x88));var _0xb225=function(_0x2ec770,_0x38f40a){_0x2ec770=_0x2ec770-0x0;var _0x578d59=_0x225b[_0x2ec770];return _0x578d59;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb225('0x0'));var jsonpatch=require(_0xb225('0x1'));var rp=require(_0xb225('0x2'));var moment=require(_0xb225('0x3'));var BPromise=require(_0xb225('0x4'));var Mustache=require(_0xb225('0x5'));var util=require(_0xb225('0x6'));var path=require(_0xb225('0x7'));var sox=require(_0xb225('0x8'));var csv=require('to-csv');var ejs=require(_0xb225('0x9'));var fs=require('fs');var fs_extra=require(_0xb225('0xa'));var _=require(_0xb225('0xb'));var squel=require('squel');var crypto=require(_0xb225('0xc'));var jsforce=require(_0xb225('0xd'));var deskjs=require(_0xb225('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb225('0xf'));var Papa=require(_0xb225('0x10'));var Redis=require(_0xb225('0x11'));var authService=require(_0xb225('0x12'));var qs=require(_0xb225('0x13'));var as=require(_0xb225('0x14'));var pdf=require(_0xb225('0x15'));var hardwareService=require(_0xb225('0x16'));var logger=require(_0xb225('0x17'))(_0xb225('0x18'));var utils=require(_0xb225('0x19'));var config=require(_0xb225('0x1a'));var licenseUtil=require(_0xb225('0x1b'));var db=require('../../mysqldb')['db'];config[_0xb225('0x1c')]=_['defaults'](config[_0xb225('0x1c')],{'host':_0xb225('0x1d'),'port':0x18eb});var socket=require(_0xb225('0x1e'))(new Redis(config[_0xb225('0x1c')]));require('./chatInteraction.socket')[_0xb225('0x1f')](socket);var jayson=require(_0xb225('0x20'));var client=jayson[_0xb225('0x21')][_0xb225('0x22')]({'port':0x232b});var client9004=jayson[_0xb225('0x21')][_0xb225('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x4c8d56,_0x1d72b9,_0x48e2f5,_0x5bb104){return new BPromise(function(_0x4f480e,_0x1b74e3){var _0x4aeda1=_0x5bb104||client;return _0x4aeda1[_0xb225('0x23')](_0x4c8d56,_0x48e2f5)[_0xb225('0x24')](function(_0x1c20fe){logger[_0xb225('0x25')]('ChatInteraction,\x20%s,\x20%s',_0x1d72b9,_0xb225('0x26'));logger[_0xb225('0x27')](_0xb225('0x28'),_0x1d72b9,_0xb225('0x26'),JSON[_0xb225('0x29')](_0x1c20fe));if(_0x1c20fe[_0xb225('0x2a')]){if(_0x1c20fe[_0xb225('0x2a')][_0xb225('0x2b')]===0x1f4){logger[_0xb225('0x2a')](_0xb225('0x2c'),_0x1d72b9,_0x1c20fe[_0xb225('0x2a')][_0xb225('0x2d')]);return _0x1b74e3(_0x1c20fe[_0xb225('0x2a')][_0xb225('0x2d')]);}logger['error'](_0xb225('0x2c'),_0x1d72b9,_0x1c20fe[_0xb225('0x2a')]['message']);return _0x4f480e(_0x1c20fe['error'][_0xb225('0x2d')]);}else{logger[_0xb225('0x25')](_0xb225('0x2c'),_0x1d72b9,_0xb225('0x26'));_0x4f480e(_0x1c20fe[_0xb225('0x2e')][_0xb225('0x2d')]);}})[_0xb225('0x2f')](function(_0x2ba106){logger['error'](_0xb225('0x2c'),_0x1d72b9,_0x2ba106);_0x1b74e3(_0x2ba106);});});}function respondWithStatusCode(_0xa3360e,_0x4da51a){_0x4da51a=_0x4da51a||0xcc;return function(_0x62904c){if(_0x62904c){return _0xa3360e[_0xb225('0x30')](_0x4da51a);}return _0xa3360e[_0xb225('0x31')](_0x4da51a)['end']();};}function respondWithResult(_0xbfe474,_0x310aa9){_0x310aa9=_0x310aa9||0xc8;return function(_0xfcb608){if(_0xfcb608){return _0xbfe474['status'](_0x310aa9)['json'](_0xfcb608);}};}function respondWithFilteredResult(_0x299f9a,_0x191be8){return function(_0x2ba218){if(_0x2ba218){var _0x1fe874=typeof _0x191be8[_0xb225('0x32')]===_0xb225('0x33')&&typeof _0x191be8[_0xb225('0x34')]===_0xb225('0x33');var _0x480ba3=_0x2ba218[_0xb225('0x35')];var _0x39136=_0x1fe874?0x0:_0x191be8[_0xb225('0x32')];var _0x40e383=_0x1fe874?_0x2ba218[_0xb225('0x35')]:_0x191be8[_0xb225('0x32')]+_0x191be8[_0xb225('0x34')];var _0x314d95;if(_0x40e383>=_0x480ba3){_0x40e383=_0x480ba3;_0x314d95=0xc8;}else{_0x314d95=0xce;}_0x299f9a[_0xb225('0x31')](_0x314d95);return _0x299f9a[_0xb225('0x36')]('Content-Range',_0x39136+'-'+_0x40e383+'/'+_0x480ba3)[_0xb225('0x37')](_0x2ba218);}return null;};}function patchUpdates(_0x5af676){return function(_0x627810){try{jsonpatch[_0xb225('0x38')](_0x627810,_0x5af676,!![]);}catch(_0x3547f5){return BPromise[_0xb225('0x39')](_0x3547f5);}return _0x627810[_0xb225('0x3a')]();};}function saveUpdates(_0x10929f,_0x20d689){return function(_0x182125){if(_0x182125){return _0x182125[_0xb225('0x3b')](_0x10929f)[_0xb225('0x24')](function(_0x22f6ec){return _0x22f6ec;});}return null;};}function removeEntity(_0x5e0bce,_0x2263ae){return function(_0x3e4a92){if(_0x3e4a92){return _0x3e4a92[_0xb225('0x3c')]()[_0xb225('0x24')](function(){_0x5e0bce[_0xb225('0x31')](0xcc)[_0xb225('0x3d')]();});}};}function handleEntityNotFound(_0x361464,_0x4b761){return function(_0x9330a8){if(!_0x9330a8){_0x361464[_0xb225('0x30')](0x194);}return _0x9330a8;};}function handleError(_0x125938,_0x2d8dcc){_0x2d8dcc=_0x2d8dcc||0x1f4;return function(_0x24dede){logger[_0xb225('0x2a')](_0x24dede[_0xb225('0x3e')]);if(_0x24dede[_0xb225('0x3f')]){delete _0x24dede[_0xb225('0x3f')];}_0x125938['status'](_0x2d8dcc)[_0xb225('0x40')](_0x24dede);};}function getMustacheRender(_0x29743f,_0x43347c){return Mustache['render'](_0x29743f,_[_0xb225('0x41')](_0x43347c[_0xb225('0x42')],{'contact':_0x43347c[_0xb225('0x43')],'message':_0x43347c['message'],'agent':_0x43347c[_0xb225('0x44')],'interaction':_0x43347c['interaction'],'account':_0x43347c[_0xb225('0x45')]}))||'';}function getInteractionUsers(_0x3d1a1e,_0x128b36){return new BPromise(function(_0x279833,_0x2898a3){try{if(_0x128b36[_0x3d1a1e['id']]){_0x3d1a1e['Users']=_[_0xb225('0x46')](_0x128b36[_0x3d1a1e['id']],function(_0x6de2d5){return{'id':_0x6de2d5['id'],'fullname':_0x6de2d5[_0xb225('0x47')]};});}}catch(_0x30dfc2){_0x2898a3(_0x30dfc2);}_0x279833(_0x3d1a1e);});}function getInteractionTags(_0x3dc1e8,_0x2b73a6){return new BPromise(function(_0x479cd2,_0x11c370){try{if(_0x3dc1e8[_0xb225('0x48')]){_0x3dc1e8[_0xb225('0x49')]=[];_0x3dc1e8[_0xb225('0x48')]['split'](',')[_0xb225('0x4a')](function(_0x218900){_0x3dc1e8['Tags'][_0xb225('0x4b')](_0x2b73a6[_0x218900]);});}delete _0x3dc1e8[_0xb225('0x48')];}catch(_0x1554de){_0x11c370(_0x1554de);}_0x479cd2(_0x3dc1e8);});}function updateChatInteraction(_0x22fb46,_0x4a60a6,_0x1e8b54){return new BPromise(function(_0x3d3d22,_0x27285e){return getInteractionUsers(_0x22fb46,_0x1e8b54)['then'](function(_0x3186c2){return getInteractionTags(_0x3186c2,_0x4a60a6);})[_0xb225('0x24')](function(_0x4ba115){return getStateInteraction(_0x4ba115);})[_0xb225('0x24')](function(_0x656542){_0x3d3d22(_0x656542);})['catch'](function(_0x424d2f){_0x27285e(_0x424d2f);});});}function getStateInteraction(_0x2856a8){return new BPromise(function(_0x45ce74){_0x2856a8['waiting']=0x0;_0x2856a8[_0xb225('0x4c')]=0x0;_0x2856a8['answered']=0x0;_0x2856a8[_0xb225('0x4d')]=0x0;_0x2856a8[_0xb225('0x4e')]=0x0;_0x2856a8['total']=0x0;if(!_0x2856a8[_0xb225('0x4f')]&&!_0x2856a8[_0xb225('0x50')]){_0x2856a8[_0xb225('0x51')]+=0x1;}if(!_0x2856a8[_0xb225('0x4f')]&&_0x2856a8['UserId']){_0x2856a8[_0xb225('0x4c')]+=0x1;if(_0x2856a8['waiting']){_0x2856a8[_0xb225('0x51')]-=0x1;}}if(_0x2856a8[_0xb225('0x4f')]&&_0x2856a8['disposition']==='abandoned'){_0x2856a8['abandoned']+=0x1;if(_0x2856a8[_0xb225('0x51')]){_0x2856a8[_0xb225('0x51')]-=0x1;}}else if(_0x2856a8[_0xb225('0x4f')]&&!_0x2856a8[_0xb225('0x50')]&&_0x2856a8[_0xb225('0x52')]){_0x2856a8[_0xb225('0x4d')]+=0x1;if(_0x2856a8[_0xb225('0x51')]){_0x2856a8['waiting']-=0x1;}}else if(_0x2856a8[_0xb225('0x4f')]&&_0x2856a8[_0xb225('0x50')]){_0x2856a8[_0xb225('0x53')]+=0x1;if(_0x2856a8['talking']){_0x2856a8['talking']-=0x1;}}_0x2856a8[_0xb225('0x54')]+=0x1;_0x45ce74(_0x2856a8);});}exports[_0xb225('0x55')]=function(_0x19d705,_0x5b3d83){var _0x499c71={},_0x4389b4={},_0x30e5c5={'count':0x0,'rows':[]};var _0x355c78=_['map'](db[_0xb225('0x56')]['rawAttributes'],function(_0x1cde61){return{'name':_0x1cde61['fieldName'],'type':_0x1cde61[_0xb225('0x57')][_0xb225('0x58')]};});_0x4389b4[_0xb225('0x59')]=_[_0xb225('0x46')](_0x355c78,_0xb225('0x3f'));_0x4389b4[_0xb225('0x5a')]=_[_0xb225('0x5b')](_0x19d705[_0xb225('0x5a')]);_0x4389b4['filters']=_[_0xb225('0x5c')](_0x4389b4[_0xb225('0x59')],_0x4389b4['query']);_0x499c71[_0xb225('0x5d')]=_['intersection'](_0x4389b4[_0xb225('0x59')],qs[_0xb225('0x5e')](_0x19d705[_0xb225('0x5a')]['fields']));_0x499c71[_0xb225('0x5d')]=_0x499c71[_0xb225('0x5d')][_0xb225('0x5f')]?_0x499c71[_0xb225('0x5d')]:_0x4389b4['model'];if(!_0x19d705['query']['hasOwnProperty']('nolimit')){_0x499c71[_0xb225('0x34')]=qs[_0xb225('0x34')](_0x19d705[_0xb225('0x5a')][_0xb225('0x34')]);_0x499c71[_0xb225('0x32')]=qs[_0xb225('0x32')](_0x19d705[_0xb225('0x5a')][_0xb225('0x32')]);}_0x499c71[_0xb225('0x60')]=qs[_0xb225('0x61')](_0x19d705['query']['sort']);_0x499c71[_0xb225('0x62')]=qs[_0xb225('0x63')](_[_0xb225('0x64')](_0x19d705['query'],_0x4389b4[_0xb225('0x63')]),_0x355c78);var _0x4548ed=[];var _0x380b71=squel[_0xb225('0x65')]()[_0xb225('0x66')]('id')[_0xb225('0x66')](_0xb225('0x3f'))[_0xb225('0x66')](_0xb225('0x67'))[_0xb225('0x68')](_0xb225('0x69'));var _0x5eaf03=squel[_0xb225('0x65')]()[_0xb225('0x66')](_0xb225('0x6a'))['field'](_0xb225('0x6b'))['field'](_0xb225('0x6c'))[_0xb225('0x68')](_0xb225('0x6d'),'ui')['left_join'](_0xb225('0x6e'),'u',_0xb225('0x6f'));var _0x30b696=squel['select']()[_0xb225('0x68')]('chat_interactions','i')[_0xb225('0x70')](_0xb225('0x71'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xb225('0x70')](_0xb225('0x6e'),'o',_0xb225('0x72'))[_0xb225('0x70')](_0xb225('0x73'),'a',_0xb225('0x74'))['left_join']('chat_messages','me',_0xb225('0x75'))[_0xb225('0x70')](_0xb225('0x76'),'it',_0xb225('0x77'))[_0xb225('0x70')]('tools_tags','t',_0xb225('0x78'));var _0x3f4751=squel[_0xb225('0x79')]();var _0x3b5ee3=[];var _0x539210=squel[_0xb225('0x79')]();var _0x1b3cf6;if(_0x19d705['query'][_0xb225('0x7a')]){_0x1b3cf6=as[_0xb225('0x7b')](_0x19d705[_0xb225('0x5a')][_0xb225('0x7a')]);var _0x4ccdd1=_0x1b3cf6[_0xb225('0x7c')];for(var _0x4c7aa0=0x0;_0x4c7aa0<_0x1b3cf6[_0xb225('0x7d')][_0xb225('0x5f')];_0x4c7aa0++){var _0x4a7ef0=_0x1b3cf6[_0xb225('0x7d')][_0x4c7aa0];var _0x2deaaa='i';var _0x4610b=_[_0xb225('0x7e')](_0x355c78,[_0xb225('0x3f'),_0x4a7ef0[_0xb225('0x66')]]);if(!_0x4610b){switch(_0x4a7ef0[_0xb225('0x66')]){case _0xb225('0x7f'):if(_0x4a7ef0[_0xb225('0x80')]==0x1){_0x30b696[_0xb225('0x81')]('`'+_0x4a7ef0[_0xb225('0x66')]+'`\x20=\x200');}else{_0x30b696['having']('`'+_0x4a7ef0['field']+_0xb225('0x82'));}break;case _0xb225('0x83'):if(_0x4a7ef0[_0xb225('0x84')]==='$substring'){if(_0x4a7ef0['value'][_0xb225('0x85')]('\x20')[_0xb225('0x5f')]>0x1){_0x3f4751[_0x4ccdd1](_0xb225('0x86'),qs[_0xb225('0x87')](_0x4a7ef0[_0xb225('0x80')]),null);}else{var _0x5bf935='%'+_0x4a7ef0[_0xb225('0x80')]+'%';_0x3f4751[_0x4ccdd1]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5bf935,_0x5bf935,_0x5bf935);}}else{_0x4610b=_[_0xb225('0x7e')](_0x355c78,['name','ContactId']);_0x4a7ef0['field']=_0xb225('0x88');_0x2850c5=as['buildExpression'](_0x2deaaa,_0x4610b['type'],_0x4a7ef0);_0x3f4751[_0x4ccdd1](_0x2850c5[_0xb225('0x89')],_0x2850c5[_0xb225('0x80')]['start'],_0x2850c5[_0xb225('0x80')][_0xb225('0x3d')]);}break;case _0xb225('0x8a'):var _0x28c96e=_0x4a7ef0[_0xb225('0x80')]['split'](',')[_0xb225('0x46')](function(_0x533cb5){return Number(_0x533cb5);});_0x28c96e[_0xb225('0x4a')](function(_0x4e560f){_0x539210['or'](_0xb225('0x8b'),'%,'+_0x4e560f+',%');});_0x3b5ee3=_[_0xb225('0x8c')](_0x3b5ee3,_0x28c96e);break;case _0xb225('0x8d'):if(_0x4a7ef0[_0xb225('0x84')]===_0xb225('0x8e')){_0x3f4751[_0x4ccdd1](_0xb225('0x8f'),'%'+_0x4a7ef0[_0xb225('0x80')]+'%',null);}else{_0x4610b=_[_0xb225('0x7e')](_0x355c78,[_0xb225('0x3f'),_0xb225('0x50')]);_0x4a7ef0['field']=_0xb225('0x50');_0x2850c5=as[_0xb225('0x90')](_0x2deaaa,_0x4610b[_0xb225('0x57')],_0x4a7ef0);_0x3f4751[_0x4ccdd1](_0x2850c5[_0xb225('0x89')],_0x2850c5['value'][_0xb225('0x91')],_0x2850c5['value'][_0xb225('0x3d')]);}break;case _0xb225('0x42'):_0x2850c5=as[_0xb225('0x90')]('me',null,_0x4a7ef0);_0x3f4751[_0x4ccdd1](_0x2850c5[_0xb225('0x89')],_0x2850c5[_0xb225('0x80')]['start'],_0x2850c5[_0xb225('0x80')][_0xb225('0x3d')]);break;}}else{var _0x2850c5=as['buildExpression'](_0x2deaaa,_0x4610b['type'],_0x4a7ef0);_0x3f4751[_0x4ccdd1](_0x2850c5[_0xb225('0x89')],_0x2850c5['value'][_0xb225('0x91')],_0x2850c5['value'][_0xb225('0x3d')]);}}}else{var _0x33b7fc=_(_0x19d705[_0xb225('0x5a')])[_0xb225('0x5b')]()[_0xb225('0x46')](function(_0xd52f85){return _['some'](_0x355c78,[_0xb225('0x3f'),_0xd52f85])?_0xd52f85:undefined;})[_0xb225('0x92')]()[_0xb225('0x80')]();if(!_[_0xb225('0x93')](_0x33b7fc)){_0x33b7fc[_0xb225('0x4a')](function(_0x7f5f3e){if(_0x7f5f3e===_0xb225('0x94')){_0x30b696[_0xb225('0x62')]('i.ChatWebsiteId\x20IN\x20?',[][_0xb225('0x95')](_0x19d705[_0xb225('0x5a')][_0x7f5f3e]));}else if(_0x7f5f3e===_0xb225('0x96')){var _0x484473=JSON[_0xb225('0x97')](_0x19d705[_0xb225('0x5a')][_0x7f5f3e])[_0xb225('0x98')];var _0x1cc037=JSON[_0xb225('0x97')](_0x19d705[_0xb225('0x5a')][_0x7f5f3e])[_0xb225('0x99')];_0x30b696[_0xb225('0x62')](_0xb225('0x9a'),_0x484473,_0x1cc037);}else{if(_0x19d705[_0xb225('0x5a')][_0x7f5f3e]===_0xb225('0x9b')){_0x30b696[_0xb225('0x62')]('i.'+_0x7f5f3e+'\x20IS\x20NULL');}else{_0x30b696['where']('i.'+_0x7f5f3e+_0xb225('0x9c'),_0x19d705[_0xb225('0x5a')][_0x7f5f3e]);}}});}if(_0x19d705['query'][_0xb225('0x9d')]){if(_0x19d705[_0xb225('0x5a')][_0xb225('0x9d')]==0x1){_0x30b696[_0xb225('0x81')](_0xb225('0x9e'));}else{_0x30b696[_0xb225('0x81')]('`unreadMessages`\x20>\x200');}}if(_0x19d705['query']['tag']){_0x3b5ee3=_['isArray'](_0x19d705['query'][_0xb225('0x9f')])?_0x19d705[_0xb225('0x5a')]['tag']:new Array(_0x19d705[_0xb225('0x5a')][_0xb225('0x9f')]);_0x3b5ee3[_0xb225('0x4a')](function(_0x369352){_0x539210['or'](_0xb225('0x8b'),'%,'+_0x369352+',%');});}if(_0x19d705[_0xb225('0x5a')][_0xb225('0xa0')]){var _0x5eff75=_0x19d705[_0xb225('0x5a')][_0xb225('0xa0')][_0xb225('0xa1')]('\x5c','\x5c\x5c')[_0xb225('0xa1')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x5eff75)){_0x3f4751['or'](_0xb225('0xa2'),_0x5eff75+'%');}else{_0x3f4751['or'](_0xb225('0xa3'),qs[_0xb225('0x87')](_0x5eff75))['or'](_0xb225('0xa4'),_0x5eff75+'%');}}}_0x30b696[_0xb225('0x62')](_0x3f4751);_0x30b696[_0xb225('0xa5')](_0xb225('0xa6'));var _0x11f43e={'type':db['Sequelize']['QueryTypes'][_0xb225('0xa7')],'raw':!![]};var _0x38f0b4=_0x30b696[_0xb225('0xa8')]();_0x38f0b4['field'](_0xb225('0xa6'));_0x38f0b4[_0xb225('0x66')](_0xb225('0xa9'),_0xb225('0x7f'));if(_0x499c71[_0xb225('0x60')]){_0x499c71['order']['forEach'](function(_0x153034){var _0x5ed7b3=_0x153034[0x0]==='contactName'?_0x153034[0x0]:'i.'+_0x153034[0x0];_0x30b696[_0xb225('0x60')](_0x5ed7b3,_0x153034[0x1]===_0xb225('0xaa')?![]:!![]);});}if(!_['isEmpty'](_0x3b5ee3)){_0x30b696[_0xb225('0x81')](_0x539210);_0x38f0b4[_0xb225('0x62')](_0xb225('0xab'),_0x3b5ee3);}BPromise[_0xb225('0xac')]()[_0xb225('0x24')](function(){if(!_0x1b3cf6){if(_0x19d705['query']['ChatWebsiteId'])return;_0x38f0b4[_0xb225('0x62')](_0xb225('0xad'));_0x30b696['where'](_0xb225('0xad'));return;}if(_0x19d705[_0xb225('0xae')][_0xb225('0xaf')]!==_0xb225('0x44'))return;return _0x19d705[_0xb225('0xae')][_0xb225('0xb0')]({'attributes':['id'],'raw':!![]})['then'](function(_0x474e39){if(_['isEmpty'](_0x474e39)){_0x38f0b4[_0xb225('0x62')](_0xb225('0xb1'));_0x30b696[_0xb225('0x62')](_0xb225('0xb1'));}else{_0x38f0b4[_0xb225('0x62')]('i.ChatWebsiteId\x20IN\x20?',_[_0xb225('0x46')](_0x474e39,'id'));_0x30b696['where'](_0xb225('0xb2'),_[_0xb225('0x46')](_0x474e39,'id'));}});})[_0xb225('0x24')](function(){if(_0x19d705[_0xb225('0xae')][_0xb225('0xaf')]===_0xb225('0x44')&&!_0x1b3cf6&&!_0x19d705[_0xb225('0x5a')][_0xb225('0x94')])return[];return db[_0xb225('0xb3')]['query'](_0x38f0b4[_0xb225('0xb4')](),_0x11f43e);})['then'](function(_0x409cb5){_0x30e5c5[_0xb225('0x35')]=_0x409cb5[_0xb225('0x5f')];if(_0x30e5c5['count']===0x0)return[];return db[_0xb225('0xb3')][_0xb225('0x5a')](_0x380b71['toString'](),_0x11f43e)[_0xb225('0x24')](function(_0x23aa6c){_0x4548ed=_['keyBy'](_0x23aa6c,'id');_0x11f43e=_[_0xb225('0x41')](_0x11f43e,{'model':db[_0xb225('0x56')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x19d705['query'][_0xb225('0x5e')]){_0x499c71[_0xb225('0x5d')][_0xb225('0x4a')](function(_0x355b9f){_0x30b696[_0xb225('0x66')]('i.'+_0x355b9f);});}else{_0x30b696['field'](_0xb225('0xa9'),_0xb225('0x7f'));_0x30b696[_0xb225('0x66')](_0xb225('0xb5'),_0xb225('0xb6'));_0x30b696['field'](_0xb225('0xb7'),_0xb225('0xb8'));_0x30b696[_0xb225('0x66')]('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',_0xb225('0xb9'));_0x30b696[_0xb225('0x66')]('i.*');_0x30b696[_0xb225('0x66')](_0xb225('0xba'),_0xb225('0xbb'));_0x30b696['field'](_0xb225('0xbc'),_0xb225('0xbd'));_0x30b696[_0xb225('0x66')](_0xb225('0xbe'),_0xb225('0xbf'));_0x30b696[_0xb225('0x66')](_0xb225('0xc0'),_0xb225('0xc1'));_0x30b696[_0xb225('0x66')](_0xb225('0xc2'),_0xb225('0xc3'));_0x30b696[_0xb225('0x66')](_0xb225('0xc4'),'Contact.fax');_0x30b696['field'](_0xb225('0xc5'),_0xb225('0xc6'));_0x30b696['field'](_0xb225('0xc7'),_0xb225('0xc8'));_0x30b696[_0xb225('0x66')](_0xb225('0xc9'),_0xb225('0x48'));}if(_0x499c71[_0xb225('0x34')])_0x30b696[_0xb225('0x34')](_0x499c71['limit']);if(_0x499c71[_0xb225('0x32')])_0x30b696['offset'](_0x499c71[_0xb225('0x32')]);return db[_0xb225('0xb3')][_0xb225('0x5a')](_0x30b696[_0xb225('0xb4')](),_0x11f43e);})[_0xb225('0x24')](function(_0x2df377){if(_0x2df377[_0xb225('0x5f')]>0x0)_0x5eaf03[_0xb225('0x62')]('ui.ChatInteractionId\x20IN\x20?',_[_0xb225('0x46')](_0x2df377,'id'));return db[_0xb225('0xb3')][_0xb225('0x5a')](_0x5eaf03[_0xb225('0xb4')](),_0x11f43e)[_0xb225('0x24')](function(_0x66e0c2){var _0x1e609d=_[_0xb225('0xca')](_0x66e0c2,_0xb225('0xcb'));var _0x389153=[];_0x2df377[_0xb225('0x4a')](function(_0x1668ed){_0x389153['push'](updateChatInteraction(_0x1668ed,_0x4548ed,_0x1e609d));});return BPromise[_0xb225('0xcc')](_0x389153);});});})['then'](function(_0x17ec7e){_0x30e5c5['rows']=_0x17ec7e;return _0x30e5c5;})[_0xb225('0x24')](respondWithFilteredResult(_0x5b3d83,_0x499c71))[_0xb225('0x2f')](handleError(_0x5b3d83,null));};exports['show']=function(_0x2bab08,_0x2eb77d){var _0x5c62f2={'raw':![],'where':{'id':_0x2bab08[_0xb225('0xcd')]['id']}},_0x57af52={};_0x57af52[_0xb225('0x59')]=_[_0xb225('0x5b')](db[_0xb225('0x56')][_0xb225('0xce')]);_0x57af52['query']=_['keys'](_0x2bab08[_0xb225('0x5a')]);_0x57af52[_0xb225('0x63')]=_['intersection'](_0x57af52[_0xb225('0x59')],_0x57af52[_0xb225('0x5a')]);_0x5c62f2[_0xb225('0x5d')]=_[_0xb225('0x5c')](_0x57af52[_0xb225('0x59')],qs[_0xb225('0x5e')](_0x2bab08[_0xb225('0x5a')][_0xb225('0x5e')]));_0x5c62f2['attributes']=_0x5c62f2[_0xb225('0x5d')][_0xb225('0x5f')]?_0x5c62f2[_0xb225('0x5d')]:_0x57af52[_0xb225('0x59')];if(_0x2bab08[_0xb225('0x5a')]['includeAll']){_0x5c62f2['include']=[{'all':!![]}];}_0x5c62f2=_[_0xb225('0x41')]({},_0x5c62f2,_0x2bab08[_0xb225('0xcf')]);return db[_0xb225('0x56')]['find'](_0x5c62f2)[_0xb225('0x24')](handleEntityNotFound(_0x2eb77d,null))['then'](respondWithResult(_0x2eb77d,null))['catch'](handleError(_0x2eb77d,null));};exports[_0xb225('0xd0')]=function(_0x128d73,_0x319894){return db[_0xb225('0x56')][_0xb225('0xd0')](_0x128d73['body'],{})[_0xb225('0x24')](respondWithResult(_0x319894,0xc9))[_0xb225('0x2f')](handleError(_0x319894,null));};exports[_0xb225('0x3b')]=function(_0x534dc5,_0x6aa7b7){if(_0x534dc5['body']['id']){delete _0x534dc5[_0xb225('0x42')]['id'];}return db[_0xb225('0x56')][_0xb225('0x7e')]({'where':{'id':_0x534dc5[_0xb225('0xcd')]['id']}})[_0xb225('0x24')](handleEntityNotFound(_0x6aa7b7,null))[_0xb225('0x24')](saveUpdates(_0x534dc5[_0xb225('0x42')],null))[_0xb225('0x24')](respondWithResult(_0x6aa7b7,null))['catch'](handleError(_0x6aa7b7,null));};exports['destroy']=function(_0x59b60,_0x1ab951){return db[_0xb225('0x56')][_0xb225('0x7e')]({'where':{'id':_0x59b60['params']['id']}})[_0xb225('0x24')](handleEntityNotFound(_0x1ab951,null))[_0xb225('0x24')](removeEntity(_0x1ab951,null))[_0xb225('0x2f')](handleError(_0x1ab951,null));};exports[_0xb225('0xd1')]=function(_0xfa4390,_0x9ef3d9){return db[_0xb225('0x56')][_0xb225('0xd1')]()[_0xb225('0x24')](respondWithResult(_0x9ef3d9,null))[_0xb225('0x2f')](handleError(_0x9ef3d9,null));};exports['createVidaooSession']=function(_0x1edf7b,_0x5273f8){var _0x475e83=_0x1edf7b[_0xb225('0xcd')]['id'];var _0x4e4cd7;var _0x33947d;var _0x4f2dc1;return db[_0xb225('0x56')][_0xb225('0xd2')]({'where':{'id':_0x475e83}})[_0xb225('0x24')](function(_0x360047){_0x4e4cd7=_0x360047;return db[_0xb225('0xd3')][_0xb225('0xd2')]({'where':{'id':_0x360047[_0xb225('0x94')]},'attributes':['id','vidaooApiKey','vidaooEscalation',_0xb225('0xd4'),_0xb225('0xd5'),_0xb225('0xd6')],'raw':!![]});})[_0xb225('0x24')](function(_0xddc786){if(_0xddc786&&_0xddc786[_0xb225('0xd7')]&&_0xddc786['vidaooEscalation']){_0x33947d=_0xddc786;var _0x34d641={'interaction':{'id':_0x475e83},'agent':{'id':_0x1edf7b[_0xb225('0xae')]['id'],'name':_0x1edf7b[_0xb225('0xae')]['name'],'fullname':_0x1edf7b[_0xb225('0xae')][_0xb225('0x47')],'email':_0x1edf7b['user'][_0xb225('0xd8')]},'contact':_0x1edf7b[_0xb225('0x42')][_0xb225('0x43')],'account':_0x1edf7b[_0xb225('0x42')][_0xb225('0x45')]};var _0x20b197={'rejectUnauthorized':![],'method':_0xb225('0xd9'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0xddc786['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x1edf7b['user'][_0xb225('0xd8')]],'buttons':null,'topic':_0x33947d[_0xb225('0xd4')],'note':_[_0xb225('0xda')](_0x33947d[_0xb225('0xd5')])?null:getMustacheRender(_0x33947d['vidaooNote'],_0x34d641),'metadata':null},'redirect':_0xb225('0xdb'),'json':!![]};try{if(!_[_0xb225('0xda')](_0x33947d['vidaooMetadata'])){var _0x11caa1=getMustacheRender(_0x33947d[_0xb225('0xd6')],_0x34d641);var _0x1d661c=JSON[_0xb225('0x97')](_0x11caa1);_0x20b197[_0xb225('0x42')]['metadata']=_0x1d661c;}}catch(_0x223dc5){throw new db[(_0xb225('0xdc'))][(_0xb225('0xdd'))](_0xb225('0xde'));}return rp(_0x20b197);}else{throw new db[(_0xb225('0xdc'))]['ValidationError'](_0xb225('0xdf'));}})[_0xb225('0x24')](function(_0x8e2df2){_0x4f2dc1=_0x8e2df2;if(_0x4f2dc1['id']){var _0xddf8a7={'body':_0x4f2dc1[_0xb225('0xe0')],'ChatWebsiteId':_0x33947d['id'],'ChatInteractionId':_0x4e4cd7['id'],'direction':_0xb225('0xe1'),'UserId':_0x1edf7b['user']['id']};return db[_0xb225('0xe2')][_0xb225('0xd0')](_0xddf8a7,{});}else{throw new db[(_0xb225('0xdc'))]['ValidationError'](_0xb225('0xe3'));}})['then'](function(){return _0x4e4cd7[_0xb225('0xe4')]({'vidaooSessionId':_0x4f2dc1['id']});})[_0xb225('0x24')](respondWithResult(_0x5273f8,null))[_0xb225('0x2f')](handleError(_0x5273f8,null));};exports[_0xb225('0xe5')]=function(_0x186ff4,_0x4aef81){if(_0x186ff4[_0xb225('0x42')]['id']){delete _0x186ff4['body']['id'];}return db[_0xb225('0x56')][_0xb225('0x7e')]({'where':{'id':_0x186ff4[_0xb225('0xcd')]['id']},'include':[{'model':db[_0xb225('0xe6')],'as':_0xb225('0x83')}]})[_0xb225('0x24')](handleEntityNotFound(_0x4aef81,null))[_0xb225('0x24')](saveUpdates(_0x186ff4['body'],null))[_0xb225('0x24')](respondWithResult(_0x4aef81,null))[_0xb225('0x2f')](handleError(_0x4aef81,null));};exports['abandon']=function(_0x217275,_0x347464,_0x47752d){if(_0x217275[_0xb225('0x42')]['id']){delete _0x217275[_0xb225('0x42')]['id'];}return db[_0xb225('0x56')][_0xb225('0x7e')]({'where':{'id':_0x217275[_0xb225('0xcd')]['id']}})[_0xb225('0x24')](function(_0x382db5){if(!_0x382db5){logger[_0xb225('0x2a')](_0xb225('0xe7'),_0xb225('0xe8'),0x194,_0xb225('0xe9'));_0x347464[_0xb225('0x30')](0x194);}else{if(_0x382db5['UserId']){throw new db[(_0xb225('0xdc'))][(_0xb225('0xdd'))](_0xb225('0xea'));}}return _0x382db5;})['then'](function(_0x197428){if(_0x197428){return _0x197428[_0xb225('0x3b')]({'closed':_0x217275['body'][_0xb225('0x4f')],'disposition':_0x217275[_0xb225('0x42')][_0xb225('0x52')]})[_0xb225('0x24')](function(_0x2180f8){return _0x2180f8;});}})['then'](function(_0x572447){return respondWithRpcPromise(_0xb225('0xeb'),_0xb225('0xe8'),_0x217275[_0xb225('0x42')],client9004);})['then'](respondWithResult(_0x347464,null))['catch'](handleError(_0x347464,null));};exports[_0xb225('0xec')]=function(_0x179bc8,_0x4bbb58,_0x586158){_0x179bc8[_0xb225('0x42')]['name']=_0x179bc8[_0xb225('0xed')][_0xb225('0xee')];_0x179bc8[_0xb225('0x42')][_0xb225('0xef')]=_0x179bc8['file'][_0xb225('0xf0')];_0x179bc8['body'][_0xb225('0x57')]=_0x179bc8[_0xb225('0xed')]['mimetype'];return db['Attachment']['create'](_0x179bc8['body'])[_0xb225('0x24')](respondWithResult(_0x4bbb58,0xc9))['catch'](handleError(_0x4bbb58,null));};exports[_0xb225('0xf1')]=function(_0x1c42bb,_0x26c3d7,_0xd9ab52){return db['ChatInteraction'][_0xb225('0xd2')]({'where':{'id':_0x1c42bb[_0xb225('0xcd')]['id']},'raw':!![]})[_0xb225('0x24')](handleEntityNotFound(_0x26c3d7,null))[_0xb225('0x24')](function(_0x59d195){if(_0x59d195){if(_0x59d195[_0xb225('0x4f')]){return _0x26c3d7['status'](0x193)[_0xb225('0x37')]({'status':0x193,'message':_0xb225('0xf2')});}return db[_0xb225('0xf3')][_0xb225('0xd2')]({'where':{'id':_0x1c42bb[_0xb225('0x5a')]['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x26c3d7,null));}})[_0xb225('0x24')](function(_0x254dd4){if(_0x254dd4){var _0x3ba914=_0x254dd4[_0xb225('0xf4')]!==null;var _0x5e2912=path['join'](config[_0xb225('0xf5')],'server/files/attachments/');if(_0x3ba914){_0x5e2912=path[_0xb225('0xf6')](_0x5e2912,'offline-chat/');}var _0x3c586c=path[_0xb225('0xf6')](_0x5e2912,_0x254dd4[_0xb225('0xef')]);return _0x26c3d7[_0xb225('0xf7')](_0x3c586c);}})[_0xb225('0x2f')](handleError(_0x26c3d7,null));};exports[_0xb225('0xf8')]=function(_0x4385e9,_0x4defb3){var _0x23d649=null;var _0x45c2d8=null;var _0x4c10a1=null;var _0x56e10c=null;if(_0x4385e9[_0xb225('0x42')]['id']){delete _0x4385e9[_0xb225('0x42')]['id'];}if(_0x4385e9['body'][_0xb225('0xf9')]){_0x56e10c=path['join'](config[_0xb225('0xf5')],'server/files/chat/upload/',util[_0xb225('0xfa')](_0xb225('0xfb'),Date[_0xb225('0xfc')]()));_0x4385e9[_0xb225('0x42')][_0xb225('0xfd')]=_0x56e10c;}return db[_0xb225('0x56')][_0xb225('0x7e')]({'where':{'id':_0x4385e9[_0xb225('0xcd')]['id']},'include':[{'model':db[_0xb225('0xe2')],'as':_0xb225('0xfe'),'include':[{'model':db[_0xb225('0x8d')],'as':'User'}]}]})['then'](handleEntityNotFound(_0x4defb3,null))['then'](saveUpdates(_0x4385e9[_0xb225('0x42')],null))[_0xb225('0x24')](function(_0x1037b4){if(_0x1037b4){_0x23d649=_0x1037b4;return db['ChatWebsite'][_0xb225('0x7e')]({'where':{'id':_0x23d649[_0xb225('0x94')]}});}})[_0xb225('0x24')](function(_0xb039aa){if(_0xb039aa){_0x4c10a1=_0xb039aa;return db[_0xb225('0xe6')][_0xb225('0x7e')]({'where':{'id':_0x23d649['ContactId']}});}})['then'](function(_0xfca62d){if(_0xfca62d){_0x45c2d8=_0xfca62d;if(_0x56e10c){var _0x9e28eb=null;for(var _0x1a81ab=0x1;_0x1a81ab<_0x23d649[_0xb225('0xfe')][_0xb225('0x5f')];++_0x1a81ab){_0x9e28eb=_0x23d649[_0xb225('0xfe')][_0x1a81ab];var _0x33a2aa=_0x9e28eb[_0xb225('0x50')]?util['format'](_0xb225('0xff'),_0x4c10a1[_0xb225('0x100')],_0x9e28eb[_0xb225('0x50')]):_0xb225('0x101');var _0x3fcda5=_0x4385e9['body'][_0xb225('0x102')]||util[_0xb225('0xfa')](_0xb225('0xff'),_0xb225('0x103'),_0x9e28eb[_0xb225('0x88')]);switch(_0x4c10a1[_0xb225('0x104')]){case'website_alias':_0x33a2aa=_0x9e28eb[_0xb225('0x50')]?util[_0xb225('0xfa')]('%s%d',_0x4c10a1[_0xb225('0x100')],_0x9e28eb['UserId']):_0xb225('0x101');break;case _0xb225('0x105'):_0x33a2aa=_0x9e28eb[_0xb225('0x50')]?_0x9e28eb[_0xb225('0x8d')][_0xb225('0x106')]||_0x9e28eb[_0xb225('0x8d')]['fullname']:'System';break;case _0xb225('0x107'):_0x33a2aa=_0x9e28eb[_0xb225('0x50')]?_0x9e28eb[_0xb225('0x8d')]['fullname']:'System';break;default:_0x33a2aa=_0x9e28eb[_0xb225('0x50')]?util[_0xb225('0xfa')]('%s%d',_0x4c10a1[_0xb225('0x100')],_0x9e28eb[_0xb225('0x50')]):_0xb225('0x101');}var _0x28e072=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x9e28eb['createdAt'])[_0xb225('0xfa')](_0xb225('0x108')),_0x9e28eb[_0xb225('0x109')]==='in'?_0x3fcda5:_0x33a2aa,_0x9e28eb[_0xb225('0x42')]);if(!_0x9e28eb[_0xb225('0x10a')]){fs[_0xb225('0x10b')](_0x56e10c,_0x28e072);}}return db[_0xb225('0x10c')][_0xb225('0xd2')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xb225('0x10d'),'raw':!![]}]});}}})[_0xb225('0x24')](function(_0x2adc39){if(_0x2adc39&&_0x2adc39[_0xb225('0x10d')]&&_0x4385e9[_0xb225('0x42')]){var _0x59c829={'tls':{'rejectUnauthorized':![]}};if(_0x2adc39[_0xb225('0x10d')][_0xb225('0x10e')]){_0x59c829[_0xb225('0x10e')]=_0x2adc39['Smtp'][_0xb225('0x10e')];}else{_0x59c829['host']=_0x2adc39[_0xb225('0x10d')][_0xb225('0x10f')];_0x59c829[_0xb225('0x110')]=_0x2adc39[_0xb225('0x10d')][_0xb225('0x110')];_0x59c829['secure']=_0x2adc39[_0xb225('0x10d')][_0xb225('0x111')];}if(_0x2adc39[_0xb225('0x10d')][_0xb225('0x112')]){_0x59c829[_0xb225('0x113')]={'user':_0x2adc39['Smtp']['user'],'pass':_0x2adc39[_0xb225('0x10d')][_0xb225('0x114')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x59c829,'message':{'from':util[_0xb225('0xfa')](_0xb225('0x115'),_0x2adc39[_0xb225('0x3f')],_0x2adc39[_0xb225('0xd8')]||_0x2adc39[_0xb225('0x10d')]['user']),'to':_0x4385e9['body'][_0xb225('0xf9')],'subject':_0xb225('0x116'),'text':util[_0xb225('0xfa')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x4385e9['body'][_0xb225('0xf9')]),'attachments':[{'path':_0x56e10c}]}})['then'](function(){return _0x23d649;})[_0xb225('0x2f')](function(_0x747232){console[_0xb225('0x2a')](_0x747232);});}else{return _0x23d649;}})[_0xb225('0x24')](respondWithStatusCode(_0x4defb3,0xc8))[_0xb225('0x2f')](handleError(_0x4defb3,null));};exports[_0xb225('0x117')]=function(_0x353a9f,_0x2dadd5,_0x9917fb){return db['ChatMessage']['find']({'where':{'id':_0x353a9f[_0xb225('0xcd')]['id']}})[_0xb225('0x24')](handleEntityNotFound(_0x2dadd5,null))[_0xb225('0x24')](function(_0x18fb42){if(_0x18fb42){return _0x18fb42[_0xb225('0x117')](_0x353a9f[_0xb225('0x42')][_0xb225('0x118')],_['omit'](_0x353a9f[_0xb225('0x42')],['ids','id'])||{});}})['then'](respondWithResult(_0x2dadd5,null))[_0xb225('0x2f')](handleError(_0x2dadd5,null));};exports[_0xb225('0x119')]=function(_0x46c662,_0x1767ee,_0x377d15){var _0x407f88={'raw':![],'where':{}};var _0x4e096a={};var _0x120598={'count':0x0,'rows':[]};return db[_0xb225('0x56')]['findOne']({'where':{'id':_0x46c662[_0xb225('0xcd')]['id']}})[_0xb225('0x24')](handleEntityNotFound(_0x1767ee,null))['then'](function(_0x286407){if(_0x286407){_0x4e096a[_0xb225('0x59')]=_[_0xb225('0x5b')](db[_0xb225('0xe2')]['rawAttributes']);_0x4e096a[_0xb225('0x5a')]=_[_0xb225('0x5b')](_0x46c662[_0xb225('0x5a')]);_0x4e096a[_0xb225('0x63')]=_[_0xb225('0x5c')](_0x4e096a[_0xb225('0x59')],_0x4e096a[_0xb225('0x5a')]);_0x407f88[_0xb225('0x5d')]=_[_0xb225('0x5c')](_0x4e096a[_0xb225('0x59')],qs['fields'](_0x46c662[_0xb225('0x5a')][_0xb225('0x5e')]));_0x407f88[_0xb225('0x5d')]=_0x407f88[_0xb225('0x5d')]['length']?_0x407f88[_0xb225('0x5d')]:_0x4e096a['model'];if(!_0x46c662[_0xb225('0x5a')][_0xb225('0x11a')]('nolimit')){_0x407f88['limit']=qs[_0xb225('0x34')](_0x46c662['query'][_0xb225('0x34')]);_0x407f88['offset']=qs[_0xb225('0x32')](_0x46c662[_0xb225('0x5a')]['offset']);}_0x407f88['order']=qs[_0xb225('0x61')](_0x46c662[_0xb225('0x5a')][_0xb225('0x61')]);_0x407f88[_0xb225('0x62')]=qs[_0xb225('0x63')](_[_0xb225('0x64')](_0x46c662['query'],_0x4e096a[_0xb225('0x63')]));_0x407f88[_0xb225('0x62')][_0xb225('0xcb')]=_0x286407['id'];if(_0x46c662[_0xb225('0x5a')]['filter']){_0x407f88[_0xb225('0x62')]=_[_0xb225('0x41')](_0x407f88[_0xb225('0x62')],{'$or':_[_0xb225('0x46')](_0x407f88[_0xb225('0x5d')],function(_0x3f268c){var _0x1b76f0={};_0x1b76f0[_0x3f268c]={'$like':'%'+_0x46c662[_0xb225('0x5a')][_0xb225('0xa0')]+'%'};return _0x1b76f0;})});}if(_0x46c662[_0xb225('0x5a')][_0xb225('0x98')]){var _0x462944=_0x46c662[_0xb225('0x5a')]['$gte'][_0xb225('0x85')](',');var _0x538cc0={};_0x538cc0[_0x462944[0x0]]={'$gte':moment(_0x462944[0x1])[_0xb225('0xfa')]('YYYY-MM-DD\x20HH:mm:ss')};_0x407f88[_0xb225('0x62')]=_[_0xb225('0x41')](_0x407f88[_0xb225('0x62')],_0x538cc0);}_0x407f88=_['merge']({},_0x407f88,_0x46c662[_0xb225('0xcf')]);return db[_0xb225('0xe2')]['count']({'where':_0x407f88['where']})[_0xb225('0x24')](function(_0x387d59){_0x120598[_0xb225('0x35')]=_0x387d59;if(_0x46c662['query']['includeAll']){_0x407f88['include']=[{'all':!![]}];}return db[_0xb225('0xe2')]['findAll'](_0x407f88);})[_0xb225('0x24')](function(_0x2dd683){_0x120598[_0xb225('0x11b')]=_0x2dd683;return _0x120598;});}})[_0xb225('0x24')](respondWithFilteredResult(_0x1767ee,_0x407f88))[_0xb225('0x2f')](handleError(_0x1767ee,null));};exports[_0xb225('0x11c')]=function(_0x3b5278,_0x5aae21,_0x2a8ff2){var _0x44f817={'where':{}},_0x329fb5={},_0x3f7f32={'count':0x0,'rows':[]};return db[_0xb225('0x56')][_0xb225('0xd2')]({'where':{'id':_0x3b5278[_0xb225('0xcd')]['id']}})[_0xb225('0x24')](handleEntityNotFound(_0x5aae21,null))['then'](function(_0x366860){if(_0x366860){_0x329fb5[_0xb225('0x59')]=_['keys'](db[_0xb225('0xe2')][_0xb225('0xce')]);_0x329fb5[_0xb225('0x5a')]=_['keys'](_0x3b5278['query']);_0x329fb5['filters']=_[_0xb225('0x5c')](_0x329fb5[_0xb225('0x59')],_0x329fb5[_0xb225('0x5a')]);_0x44f817['attributes']=_['intersection'](_0x329fb5[_0xb225('0x59')],qs[_0xb225('0x5e')](_0x3b5278[_0xb225('0x5a')][_0xb225('0x5e')]));_0x44f817[_0xb225('0x5d')]=_0x44f817[_0xb225('0x5d')][_0xb225('0x5f')]?_0x44f817[_0xb225('0x5d')]:_0x329fb5[_0xb225('0x59')];if(!_0x3b5278[_0xb225('0x5a')][_0xb225('0x11a')](_0xb225('0x11d'))){_0x44f817['limit']=qs['limit'](_0x3b5278[_0xb225('0x5a')][_0xb225('0x34')]);_0x44f817[_0xb225('0x32')]=qs[_0xb225('0x32')](_0x3b5278[_0xb225('0x5a')]['offset']);}_0x44f817[_0xb225('0x60')]=qs[_0xb225('0x61')](_0x3b5278['query'][_0xb225('0x61')]);_0x44f817['where']=qs[_0xb225('0x63')](_[_0xb225('0x64')](_0x3b5278[_0xb225('0x5a')],_0x329fb5[_0xb225('0x63')]));_0x44f817[_0xb225('0x62')][_0xb225('0xcb')]=_0x366860['id'];if(_0x3b5278[_0xb225('0x5a')][_0xb225('0xa0')]){_0x44f817['where']=_[_0xb225('0x41')](_0x44f817[_0xb225('0x62')],{'$or':_['map'](_0x44f817['attributes'],function(_0x1f0742){var _0x3eb3ba={};_0x3eb3ba[_0x1f0742]={'$like':'%'+_0x3b5278[_0xb225('0x5a')][_0xb225('0xa0')]+'%'};return _0x3eb3ba;})});}_0x44f817[_0xb225('0x62')][_0xb225('0x10a')]=![];if(_0x3b5278[_0xb225('0x5a')]['id']){_0x44f817[_0xb225('0x62')]['id']={'$gt':_0x3b5278[_0xb225('0x5a')]['id']};}_0x44f817=_[_0xb225('0x41')]({},_0x44f817,_0x3b5278[_0xb225('0xcf')]);return db[_0xb225('0xe2')][_0xb225('0x35')]({'where':_0x44f817[_0xb225('0x62')]})['then'](function(_0x26445b){_0x3f7f32[_0xb225('0x35')]=_0x26445b;_0x44f817['include']=[];if(_0x3b5278['query']['includeAgent']){_0x44f817[_0xb225('0x11e')][_0xb225('0x4b')]({'model':db['User'],'as':_0xb225('0x8d'),'attributes':['id','fullname',_0xb225('0x106')]});}if(_0x3b5278[_0xb225('0x5a')]['includeAll']){_0x44f817[_0xb225('0x11e')]=[{'all':!![]}];}return db[_0xb225('0xe2')][_0xb225('0x11f')](_0x44f817);})[_0xb225('0x24')](function(_0x25e678){_0x3f7f32[_0xb225('0x11b')]=_0x25e678;return _0x3f7f32;});}})[_0xb225('0x24')](respondWithFilteredResult(_0x5aae21,_0x44f817))[_0xb225('0x2f')](handleError(_0x5aae21,null));};exports[_0xb225('0x120')]=function(_0x418daa,_0x5519d7,_0x4778a2){return db[_0xb225('0x56')]['find']({'where':{'id':_0x418daa['params']['id']}})[_0xb225('0x24')](handleEntityNotFound(_0x5519d7,null))[_0xb225('0x24')](function(_0x532f82){if(_0x532f82){return _0x532f82[_0xb225('0x121')](_0x418daa['body'][_0xb225('0x118')],_[_0xb225('0x122')](_0x418daa['body'],[_0xb225('0x118'),'id'])||{})[_0xb225('0x123')](function(){return db[_0xb225('0x8a')]['findAll']({'attributes':['id','name',_0xb225('0x67')],'where':{'id':_0x418daa[_0xb225('0x42')][_0xb225('0x118')]}});})[_0xb225('0x24')](function(_0x112f79){socket[_0xb225('0x124')](_0xb225('0x125'),{'id':Number(_0x418daa[_0xb225('0xcd')]['id']),'tags':_0x112f79||[]});return{'id':Number(_0x418daa[_0xb225('0xcd')]['id']),'tags':_0x112f79||[]};});}})[_0xb225('0x24')](respondWithResult(_0x5519d7,null))[_0xb225('0x2f')](handleError(_0x5519d7,null));};exports['removeTags']=function(_0x384840,_0x2e4762,_0x218cd8){return db[_0xb225('0x56')][_0xb225('0x7e')]({'where':{'id':_0x384840[_0xb225('0xcd')]['id']}})[_0xb225('0x24')](handleEntityNotFound(_0x2e4762,null))[_0xb225('0x24')](function(_0x3cc05c){if(_0x3cc05c){return _0x3cc05c['removeTags'](_0x384840['query']['ids']);}})['then'](respondWithStatusCode(_0x2e4762,null))[_0xb225('0x2f')](handleError(_0x2e4762,null));};exports[_0xb225('0xf7')]=function(_0x3f52cc,_0x254c84){var _0x2b3f96=moment()['unix']()[_0xb225('0xb4')]();var _0x4da729=path['join'](config[_0xb225('0xf5')],_0xb225('0x126'),_0xb225('0x127'),_0xb225('0x128'));var _0x535643=path[_0xb225('0xf6')](config[_0xb225('0xf5')],'server',_0xb225('0x127'),_0xb225('0x129'));var _0x16456e=path[_0xb225('0xf6')](_0x4da729,_0x2b3f96);var _0x3af17f=util[_0xb225('0xfa')](_0xb225('0x12a'),_0x3f52cc[_0xb225('0xcd')]['id'],_0x2b3f96);var _0x805381=path[_0xb225('0xf6')](_0x4da729,_0x3af17f);var _0x5b5bf8=[];_0x5b5bf8['push']({'model':db[_0xb225('0x8d')],'as':_0xb225('0x8d'),'attributes':['id','fullname'],'raw':!![]});_0x5b5bf8[_0xb225('0x4b')]({'model':db[_0xb225('0xe6')],'as':_0xb225('0x83'),'attributes':['id',_0xb225('0x12b'),_0xb225('0x12c')],'raw':!![]});if(_0x3f52cc[_0xb225('0x5a')][_0xb225('0x129')]){_0x5b5bf8[_0xb225('0x4b')]({'model':db[_0xb225('0xf3')],'as':'Attachment','raw':!![]});}var _0x271e07=[{'model':db['ChatMessage'],'as':_0xb225('0xfe'),'attributes':['id',_0xb225('0x42'),_0xb225('0x96'),_0xb225('0x109'),_0xb225('0x10a'),'read'],'include':_0x5b5bf8}];_0x271e07[_0xb225('0x4b')]({'model':db[_0xb225('0xd3')],'as':_0xb225('0x12d'),'attributes':['id',_0xb225('0x3f')]});_0x271e07[_0xb225('0x4b')]({'model':db[_0xb225('0x8d')],'as':_0xb225('0x12e'),'attributes':['id',_0xb225('0x47')]});return db['ChatInteraction']['find']({'where':{'id':_0x3f52cc[_0xb225('0xcd')]['id']},'include':_0x271e07})[_0xb225('0x24')](handleEntityNotFound(_0x254c84,null))[_0xb225('0x24')](function(_0x45163a){if(_0x45163a){var _0x4c025c=_0x45163a['get']({'plain':!![]});fs[_0xb225('0x12f')](_0x16456e);var _0x12df26={'channel':_0xb225('0x130'),'account':_0x4c025c[_0xb225('0x12d')][_0xb225('0x3f')],'agent':_0x4c025c[_0xb225('0x12e')]?_0x4c025c[_0xb225('0x12e')][_0xb225('0x47')]:_0xb225('0x131'),'createdAt':moment(_0x4c025c[_0xb225('0x96')])[_0xb225('0xfa')](_0xb225('0x132'))[_0xb225('0xb4')](),'closedAt':_0x4c025c['closed']?moment(_0x4c025c[_0xb225('0x133')])[_0xb225('0xfa')](_0xb225('0x132'))['toString']():'','disposition':_0x4c025c[_0xb225('0x52')],'chatInfo':{'browser':_0x4c025c[_0xb225('0x134')],'os':_0x4c025c['osName'],'referer':_0x4c025c[_0xb225('0x135')],'customerIp':_0x4c025c[_0xb225('0x136')],'customerPort':_0x4c025c[_0xb225('0x137')]?_0x4c025c[_0xb225('0x137')]:_0xb225('0x131')},'messages':_(_0x4c025c['Messages'])[_0xb225('0x138')]()['filter']({'secret':![]})[_0xb225('0x46')](function(_0x115b0f){if(_0x115b0f[_0xb225('0xf3')]){var _0x4459e8=path[_0xb225('0xf6')](_0x535643,_0x115b0f['Attachment'][_0xb225('0xef')]);if(fs[_0xb225('0x139')](_0x4459e8)){fs['createReadStream'](_0x4459e8)[_0xb225('0x13a')](fs[_0xb225('0x13b')](path[_0xb225('0xf6')](_0x16456e,_0x115b0f[_0xb225('0xf3')][_0xb225('0xef')])));}}return{'date':moment(_0x115b0f['createdAt'])[_0xb225('0xfa')](_0xb225('0x132'))[_0xb225('0xb4')](),'sender':_0x115b0f[_0xb225('0x109')]===_0xb225('0xe1')?_0x115b0f[_0xb225('0x8d')]?_0x115b0f['User']['fullname']:_0xb225('0x101'):_0x115b0f['Contact'][_0xb225('0x12b')]+(_0x115b0f[_0xb225('0x83')][_0xb225('0x12c')]?'\x20'+_0x115b0f[_0xb225('0x83')][_0xb225('0x12c')]:''),'body':_0x115b0f[_0xb225('0xf3')]?_0x115b0f[_0xb225('0xf3')][_0xb225('0xef')]:_0x115b0f[_0xb225('0x42')],'direction':_0x115b0f[_0xb225('0x109')]===_0xb225('0xe1')?'A':'C','secret':_0x115b0f[_0xb225('0x10a')],'read':_0x115b0f[_0xb225('0x9d')],'attachment':_0x115b0f['Attachment']};})[_0xb225('0x80')]()};return ejs['renderFile'](path['join'](config[_0xb225('0xf5')],_0xb225('0x126'),_0xb225('0x13c'),'downloadInteraction.ejs'),{'interaction':_0x12df26})[_0xb225('0x24')](function(_0x2fda83){var _0x312975=path['join'](_0x16456e,_0xb225('0x13d')+_0x4c025c['id']+'-'+_0x2b3f96+_0xb225('0x13e'));var _0x4aa337={'path':_0x312975,'channel':_0xb225('0x130'),'interactionId':_0x4c025c['id']};return pdf[_0xb225('0x13f')](_0x2fda83,_0x4aa337);})[_0xb225('0x24')](function(){return new BPromise(function(_0x62370f,_0x23b523){zipdir(_0x16456e,{'saveTo':_0x805381},function(_0x5bf5d3,_0x487ed8){if(_0x5bf5d3)return _0x23b523(_0x5bf5d3);return _0x62370f(_0x487ed8);});})[_0xb225('0x24')](function(){return new BPromise(function(_0x229eb9,_0x1af0a9){rimraf(_0x16456e,function(_0x272ad6){if(_0x272ad6)_0x1af0a9(_0x272ad6);return _0x229eb9();});});})[_0xb225('0x24')](function(){return _0x254c84[_0xb225('0xf7')](_0x805381,_0x3af17f,function(_0x1dc7f2){if(_0x1dc7f2){console[_0xb225('0x140')](_0xb225('0x141'),_0x1dc7f2);}else{fs[_0xb225('0x142')](_0x805381);}});});});}else{return _0x254c84[_0xb225('0x30')](0xc8);}})['catch'](handleError(_0x254c84,null));}; \ No newline at end of file +var _0x97e2=['t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','buildExpression','body','some','compact','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','isEmpty','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','all','show','intersection','includeAll','include','options','create','update','params','describe','findOne','vidaooApiKey','vidaooMetadata','email','account','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','isNull','vidaooNote','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Sequelize','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','AbandonInteraction','attachmentUpload','originalname','basename','file','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','offline-chat/','join','close','root','server/files/chat/upload/','now','pathTranscript','Messages','ChatWebsite','format','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','hasOwnProperty','rows','addTags','setTags','spread','emit','chatInteractionTags:save','removeTags','download','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','direction','Account','mkdirSync','Chat','Owner','N.A.','createdAt','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','http','client','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','message','catch','sendStatus','end','status','offset','count','limit','json','apply','reject','destroy','name','render','merge','contact','agent','interaction','fullname','TagIds','Tags','forEach','push','waiting','answered','abandoned','total','closed','UserId','disposition','index','map','ChatInteraction','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','fields','length','nolimit','order','sort','where','pick','select','field','color','u.id','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','u.id\x20=\x20ui.UserId','chat_interactions','o.id\x20=\x20i.UserId','chat_websites','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x97e2,0xdc));var _0x297e=function(_0xed0fa1,_0x320d5){_0xed0fa1=_0xed0fa1-0x0;var _0xa039da=_0x97e2[_0xed0fa1];return _0xa039da;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x297e('0x0'));var zipdir=require(_0x297e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x297e('0x2'));var Mustache=require(_0x297e('0x3'));var util=require(_0x297e('0x4'));var path=require(_0x297e('0x5'));var sox=require(_0x297e('0x6'));var csv=require(_0x297e('0x7'));var ejs=require(_0x297e('0x8'));var fs=require('fs');var fs_extra=require(_0x297e('0x9'));var _=require(_0x297e('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x297e('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x297e('0xc'));var Papa=require(_0x297e('0xd'));var Redis=require(_0x297e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x297e('0xf'));var as=require(_0x297e('0x10'));var pdf=require(_0x297e('0x11'));var hardwareService=require(_0x297e('0x12'));var logger=require('../../config/logger')(_0x297e('0x13'));var utils=require(_0x297e('0x14'));var config=require(_0x297e('0x15'));var licenseUtil=require(_0x297e('0x16'));var db=require(_0x297e('0x17'))['db'];config[_0x297e('0x18')]=_[_0x297e('0x19')](config[_0x297e('0x18')],{'host':_0x297e('0x1a'),'port':0x18eb});var socket=require(_0x297e('0x1b'))(new Redis(config[_0x297e('0x18')]));require(_0x297e('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x297e('0x1d')]({'port':0x232b});var client9004=jayson[_0x297e('0x1e')][_0x297e('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x16c212,_0x175ec8,_0x13e838,_0xcfee5d){return new BPromise(function(_0x430b91,_0x176311){var _0x39e179=_0xcfee5d||client;return _0x39e179[_0x297e('0x1f')](_0x16c212,_0x13e838)[_0x297e('0x20')](function(_0x22def3){logger['info'](_0x297e('0x21'),_0x175ec8,_0x297e('0x22'));logger[_0x297e('0x23')](_0x297e('0x24'),_0x175ec8,_0x297e('0x22'),JSON['stringify'](_0x22def3));if(_0x22def3[_0x297e('0x25')]){if(_0x22def3[_0x297e('0x25')]['code']===0x1f4){logger[_0x297e('0x25')](_0x297e('0x21'),_0x175ec8,_0x22def3['error'][_0x297e('0x26')]);return _0x176311(_0x22def3[_0x297e('0x25')][_0x297e('0x26')]);}logger['error'](_0x297e('0x21'),_0x175ec8,_0x22def3[_0x297e('0x25')][_0x297e('0x26')]);return _0x430b91(_0x22def3['error'][_0x297e('0x26')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x175ec8,_0x297e('0x22'));_0x430b91(_0x22def3['result'][_0x297e('0x26')]);}})[_0x297e('0x27')](function(_0xc04e02){logger[_0x297e('0x25')](_0x297e('0x21'),_0x175ec8,_0xc04e02);_0x176311(_0xc04e02);});});}function respondWithStatusCode(_0x3893a1,_0x1a5d67){_0x1a5d67=_0x1a5d67||0xcc;return function(_0x101178){if(_0x101178){return _0x3893a1[_0x297e('0x28')](_0x1a5d67);}return _0x3893a1['status'](_0x1a5d67)[_0x297e('0x29')]();};}function respondWithResult(_0x23053e,_0x29380d){_0x29380d=_0x29380d||0xc8;return function(_0x8c9e7a){if(_0x8c9e7a){return _0x23053e[_0x297e('0x2a')](_0x29380d)['json'](_0x8c9e7a);}};}function respondWithFilteredResult(_0x1138e2,_0x38130c){return function(_0xfc77e){if(_0xfc77e){var _0xd121b4=typeof _0x38130c[_0x297e('0x2b')]==='undefined'&&typeof _0x38130c['limit']==='undefined';var _0x555a47=_0xfc77e[_0x297e('0x2c')];var _0x16944a=_0xd121b4?0x0:_0x38130c[_0x297e('0x2b')];var _0x54d54d=_0xd121b4?_0xfc77e['count']:_0x38130c['offset']+_0x38130c[_0x297e('0x2d')];var _0x43c148;if(_0x54d54d>=_0x555a47){_0x54d54d=_0x555a47;_0x43c148=0xc8;}else{_0x43c148=0xce;}_0x1138e2[_0x297e('0x2a')](_0x43c148);return _0x1138e2['set']('Content-Range',_0x16944a+'-'+_0x54d54d+'/'+_0x555a47)[_0x297e('0x2e')](_0xfc77e);}return null;};}function patchUpdates(_0x66ba6d){return function(_0x2afe3f){try{jsonpatch[_0x297e('0x2f')](_0x2afe3f,_0x66ba6d,!![]);}catch(_0x3ccc17){return BPromise[_0x297e('0x30')](_0x3ccc17);}return _0x2afe3f['save']();};}function saveUpdates(_0x6c1629,_0x1021df){return function(_0xec1fc7){if(_0xec1fc7){return _0xec1fc7['update'](_0x6c1629)[_0x297e('0x20')](function(_0x102ed0){return _0x102ed0;});}return null;};}function removeEntity(_0x391176,_0x58b249){return function(_0x2b87b7){if(_0x2b87b7){return _0x2b87b7[_0x297e('0x31')]()[_0x297e('0x20')](function(){_0x391176[_0x297e('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43158d,_0xc96ae3){return function(_0x3ad226){if(!_0x3ad226){_0x43158d[_0x297e('0x28')](0x194);}return _0x3ad226;};}function handleError(_0x1710af,_0x341d2d){_0x341d2d=_0x341d2d||0x1f4;return function(_0xca692b){logger[_0x297e('0x25')](_0xca692b['stack']);if(_0xca692b[_0x297e('0x32')]){delete _0xca692b[_0x297e('0x32')];}_0x1710af['status'](_0x341d2d)['send'](_0xca692b);};}function getMustacheRender(_0xc11d47,_0x4becfa){return Mustache[_0x297e('0x33')](_0xc11d47,_[_0x297e('0x34')](_0x4becfa['body'],{'contact':_0x4becfa[_0x297e('0x35')],'message':_0x4becfa[_0x297e('0x26')],'agent':_0x4becfa[_0x297e('0x36')],'interaction':_0x4becfa[_0x297e('0x37')],'account':_0x4becfa['account']}))||'';}function getInteractionUsers(_0x3590c5,_0x739035){return new BPromise(function(_0x43620d,_0x3b7137){try{if(_0x739035[_0x3590c5['id']]){_0x3590c5['Users']=_['map'](_0x739035[_0x3590c5['id']],function(_0x161e03){return{'id':_0x161e03['id'],'fullname':_0x161e03[_0x297e('0x38')]};});}}catch(_0x3ecad7){_0x3b7137(_0x3ecad7);}_0x43620d(_0x3590c5);});}function getInteractionTags(_0x56688c,_0x514e10){return new BPromise(function(_0x5d6638,_0xc5408){try{if(_0x56688c[_0x297e('0x39')]){_0x56688c[_0x297e('0x3a')]=[];_0x56688c['TagIds']['split'](',')[_0x297e('0x3b')](function(_0xa607de){_0x56688c['Tags'][_0x297e('0x3c')](_0x514e10[_0xa607de]);});}delete _0x56688c['TagIds'];}catch(_0x46af72){_0xc5408(_0x46af72);}_0x5d6638(_0x56688c);});}function updateChatInteraction(_0x4c2aa7,_0x12c4e1,_0x1806fa){return new BPromise(function(_0x3d471a,_0x4676fa){return getInteractionUsers(_0x4c2aa7,_0x1806fa)[_0x297e('0x20')](function(_0x29c701){return getInteractionTags(_0x29c701,_0x12c4e1);})['then'](function(_0x1d6efb){return getStateInteraction(_0x1d6efb);})[_0x297e('0x20')](function(_0xe93cb2){_0x3d471a(_0xe93cb2);})['catch'](function(_0xb63765){_0x4676fa(_0xb63765);});});}function getStateInteraction(_0x22e645){return new BPromise(function(_0x28941b){_0x22e645[_0x297e('0x3d')]=0x0;_0x22e645['talking']=0x0;_0x22e645[_0x297e('0x3e')]=0x0;_0x22e645['unmanaged']=0x0;_0x22e645[_0x297e('0x3f')]=0x0;_0x22e645[_0x297e('0x40')]=0x0;if(!_0x22e645[_0x297e('0x41')]&&!_0x22e645['UserId']){_0x22e645[_0x297e('0x3d')]+=0x1;}if(!_0x22e645[_0x297e('0x41')]&&_0x22e645[_0x297e('0x42')]){_0x22e645['talking']+=0x1;if(_0x22e645[_0x297e('0x3d')]){_0x22e645[_0x297e('0x3d')]-=0x1;}}if(_0x22e645[_0x297e('0x41')]&&_0x22e645[_0x297e('0x43')]==='abandoned'){_0x22e645[_0x297e('0x3f')]+=0x1;if(_0x22e645[_0x297e('0x3d')]){_0x22e645[_0x297e('0x3d')]-=0x1;}}else if(_0x22e645[_0x297e('0x41')]&&!_0x22e645['UserId']&&_0x22e645['disposition']){_0x22e645['unmanaged']+=0x1;if(_0x22e645['waiting']){_0x22e645['waiting']-=0x1;}}else if(_0x22e645['closed']&&_0x22e645['UserId']){_0x22e645['answered']+=0x1;if(_0x22e645['talking']){_0x22e645['talking']-=0x1;}}_0x22e645['total']+=0x1;_0x28941b(_0x22e645);});}exports[_0x297e('0x44')]=function(_0x2e81a4,_0x3608c2){var _0x5a0ea9={},_0x347313={},_0x5b3c00={'count':0x0,'rows':[]};var _0x4e7647=_[_0x297e('0x45')](db[_0x297e('0x46')][_0x297e('0x47')],function(_0x53e0ba){return{'name':_0x53e0ba[_0x297e('0x48')],'type':_0x53e0ba[_0x297e('0x49')][_0x297e('0x4a')]};});_0x347313['model']=_[_0x297e('0x45')](_0x4e7647,'name');_0x347313['query']=_[_0x297e('0x4b')](_0x2e81a4[_0x297e('0x4c')]);_0x347313[_0x297e('0x4d')]=_['intersection'](_0x347313[_0x297e('0x4e')],_0x347313[_0x297e('0x4c')]);_0x5a0ea9[_0x297e('0x4f')]=_['intersection'](_0x347313[_0x297e('0x4e')],qs[_0x297e('0x50')](_0x2e81a4[_0x297e('0x4c')]['fields']));_0x5a0ea9[_0x297e('0x4f')]=_0x5a0ea9['attributes'][_0x297e('0x51')]?_0x5a0ea9['attributes']:_0x347313[_0x297e('0x4e')];if(!_0x2e81a4[_0x297e('0x4c')]['hasOwnProperty'](_0x297e('0x52'))){_0x5a0ea9[_0x297e('0x2d')]=qs['limit'](_0x2e81a4[_0x297e('0x4c')][_0x297e('0x2d')]);_0x5a0ea9[_0x297e('0x2b')]=qs[_0x297e('0x2b')](_0x2e81a4[_0x297e('0x4c')]['offset']);}_0x5a0ea9[_0x297e('0x53')]=qs[_0x297e('0x54')](_0x2e81a4['query'][_0x297e('0x54')]);_0x5a0ea9[_0x297e('0x55')]=qs[_0x297e('0x4d')](_[_0x297e('0x56')](_0x2e81a4['query'],_0x347313['filters']),_0x4e7647);var _0x71f4da=[];var _0x568573=squel[_0x297e('0x57')]()[_0x297e('0x58')]('id')[_0x297e('0x58')](_0x297e('0x32'))[_0x297e('0x58')](_0x297e('0x59'))['from']('tools_tags');var _0x1438cb=squel[_0x297e('0x57')]()[_0x297e('0x58')](_0x297e('0x5a'))[_0x297e('0x58')]('u.fullname')[_0x297e('0x58')](_0x297e('0x5b'))[_0x297e('0x5c')](_0x297e('0x5d'),'ui')[_0x297e('0x5e')]('users','u',_0x297e('0x5f'));var _0x4901ee=squel[_0x297e('0x57')]()[_0x297e('0x5c')](_0x297e('0x60'),'i')['left_join']('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join']('users','o',_0x297e('0x61'))[_0x297e('0x5e')](_0x297e('0x62'),'a','a.id\x20=\x20i.ChatWebsiteId')['left_join']('chat_messages','me','me.ChatInteractionId\x20=\x20i.id')[_0x297e('0x5e')](_0x297e('0x63'),'it',_0x297e('0x64'))[_0x297e('0x5e')](_0x297e('0x65'),'t',_0x297e('0x66'));var _0x1ec371=squel[_0x297e('0x67')]();var _0x21e217=[];var _0x819680=squel[_0x297e('0x67')]();var _0x1b0df7;if(_0x2e81a4[_0x297e('0x4c')][_0x297e('0x68')]){_0x1b0df7=as[_0x297e('0x69')](_0x2e81a4[_0x297e('0x4c')][_0x297e('0x68')]);var _0x2231ff=_0x1b0df7[_0x297e('0x6a')];for(var _0x164f89=0x0;_0x164f89<_0x1b0df7[_0x297e('0x6b')][_0x297e('0x51')];_0x164f89++){var _0x1e3fe2=_0x1b0df7['conditions'][_0x164f89];var _0x2dbcd4='i';var _0x1cc043=_[_0x297e('0x6c')](_0x4e7647,[_0x297e('0x32'),_0x1e3fe2[_0x297e('0x58')]]);if(!_0x1cc043){switch(_0x1e3fe2[_0x297e('0x58')]){case'unreadMessages':if(_0x1e3fe2[_0x297e('0x6d')]==0x1){_0x4901ee[_0x297e('0x6e')]('`'+_0x1e3fe2[_0x297e('0x58')]+_0x297e('0x6f'));}else{_0x4901ee[_0x297e('0x6e')]('`'+_0x1e3fe2[_0x297e('0x58')]+_0x297e('0x70'));}break;case _0x297e('0x71'):if(_0x1e3fe2[_0x297e('0x72')]===_0x297e('0x73')){if(_0x1e3fe2[_0x297e('0x6d')]['split']('\x20')[_0x297e('0x51')]>0x1){_0x1ec371[_0x2231ff](_0x297e('0x74'),qs[_0x297e('0x75')](_0x1e3fe2['value']),null);}else{var _0x3a5eff='%'+_0x1e3fe2[_0x297e('0x6d')]+'%';_0x1ec371[_0x2231ff](_0x297e('0x76'),_0x3a5eff,_0x3a5eff,_0x3a5eff);}}else{_0x1cc043=_[_0x297e('0x6c')](_0x4e7647,['name',_0x297e('0x77')]);_0x1e3fe2[_0x297e('0x58')]=_0x297e('0x77');_0x80581f=as['buildExpression'](_0x2dbcd4,_0x1cc043[_0x297e('0x49')],_0x1e3fe2);_0x1ec371[_0x2231ff](_0x80581f[_0x297e('0x78')],_0x80581f[_0x297e('0x6d')][_0x297e('0x79')],_0x80581f[_0x297e('0x6d')][_0x297e('0x29')]);}break;case _0x297e('0x7a'):var _0x6bf134=_0x1e3fe2[_0x297e('0x6d')][_0x297e('0x7b')](',')[_0x297e('0x45')](function(_0x102547){return Number(_0x102547);});_0x6bf134[_0x297e('0x3b')](function(_0x531bf8){_0x819680['or'](_0x297e('0x7c'),'%,'+_0x531bf8+',%');});_0x21e217=_[_0x297e('0x7d')](_0x21e217,_0x6bf134);break;case _0x297e('0x7e'):if(_0x1e3fe2['operator']===_0x297e('0x73')){_0x1ec371[_0x2231ff]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1e3fe2['value']+'%',null);}else{_0x1cc043=_[_0x297e('0x6c')](_0x4e7647,[_0x297e('0x32'),_0x297e('0x42')]);_0x1e3fe2[_0x297e('0x58')]='UserId';_0x80581f=as[_0x297e('0x7f')](_0x2dbcd4,_0x1cc043[_0x297e('0x49')],_0x1e3fe2);_0x1ec371[_0x2231ff](_0x80581f[_0x297e('0x78')],_0x80581f[_0x297e('0x6d')][_0x297e('0x79')],_0x80581f[_0x297e('0x6d')]['end']);}break;case _0x297e('0x80'):_0x80581f=as[_0x297e('0x7f')]('me',null,_0x1e3fe2);_0x1ec371[_0x2231ff](_0x80581f[_0x297e('0x78')],_0x80581f[_0x297e('0x6d')][_0x297e('0x79')],_0x80581f[_0x297e('0x6d')][_0x297e('0x29')]);break;}}else{var _0x80581f=as[_0x297e('0x7f')](_0x2dbcd4,_0x1cc043[_0x297e('0x49')],_0x1e3fe2);_0x1ec371[_0x2231ff](_0x80581f['text'],_0x80581f[_0x297e('0x6d')][_0x297e('0x79')],_0x80581f[_0x297e('0x6d')][_0x297e('0x29')]);}}}else{var _0x599be3=_(_0x2e81a4[_0x297e('0x4c')])[_0x297e('0x4b')]()[_0x297e('0x45')](function(_0x5a14b1){return _[_0x297e('0x81')](_0x4e7647,[_0x297e('0x32'),_0x5a14b1])?_0x5a14b1:undefined;})[_0x297e('0x82')]()[_0x297e('0x6d')]();if(!_['isEmpty'](_0x599be3)){_0x599be3['forEach'](function(_0x2baa50){if(_0x2baa50===_0x297e('0x83')){_0x4901ee[_0x297e('0x55')](_0x297e('0x84'),[]['concat'](_0x2e81a4[_0x297e('0x4c')][_0x2baa50]));}else if(_0x2baa50==='createdAt'){var _0x3ac219=JSON[_0x297e('0x85')](_0x2e81a4['query'][_0x2baa50])[_0x297e('0x86')];var _0x503922=JSON[_0x297e('0x85')](_0x2e81a4[_0x297e('0x4c')][_0x2baa50])[_0x297e('0x87')];_0x4901ee[_0x297e('0x55')](_0x297e('0x88'),_0x3ac219,_0x503922);}else{if(_0x2e81a4['query'][_0x2baa50]==='null'){_0x4901ee[_0x297e('0x55')]('i.'+_0x2baa50+_0x297e('0x89'));}else{_0x4901ee[_0x297e('0x55')]('i.'+_0x2baa50+'\x20=\x20?',_0x2e81a4[_0x297e('0x4c')][_0x2baa50]);}}});}if(_0x2e81a4[_0x297e('0x4c')]['read']){if(_0x2e81a4[_0x297e('0x4c')][_0x297e('0x8a')]==0x1){_0x4901ee[_0x297e('0x6e')](_0x297e('0x8b'));}else{_0x4901ee[_0x297e('0x6e')](_0x297e('0x8c'));}}if(_0x2e81a4['query'][_0x297e('0x8d')]){_0x21e217=_[_0x297e('0x8e')](_0x2e81a4[_0x297e('0x4c')]['tag'])?_0x2e81a4['query'][_0x297e('0x8d')]:new Array(_0x2e81a4[_0x297e('0x4c')][_0x297e('0x8d')]);_0x21e217[_0x297e('0x3b')](function(_0x298a3a){_0x819680['or'](_0x297e('0x7c'),'%,'+_0x298a3a+',%');});}if(_0x2e81a4['query'][_0x297e('0x8f')]){var _0x333818=_0x2e81a4[_0x297e('0x4c')]['filter'][_0x297e('0x90')]('\x5c','\x5c\x5c')[_0x297e('0x90')](/'/g,'\x27\x27');if(qs[_0x297e('0x91')](_0x333818)){_0x1ec371['or']('i.id\x20LIKE\x20?',_0x333818+'%');}else{_0x1ec371['or'](_0x297e('0x92'),qs[_0x297e('0x75')](_0x333818))['or'](_0x297e('0x93'),_0x333818+'%');}}}_0x4901ee[_0x297e('0x55')](_0x1ec371);_0x4901ee[_0x297e('0x94')]('i.id');var _0x3a4662={'type':db['Sequelize'][_0x297e('0x95')]['SELECT'],'raw':!![]};var _0x2c342c=_0x4901ee[_0x297e('0x96')]();_0x2c342c['field'](_0x297e('0x97'));_0x2c342c[_0x297e('0x58')](_0x297e('0x98'),_0x297e('0x99'));if(_0x5a0ea9[_0x297e('0x53')]){_0x5a0ea9[_0x297e('0x53')]['forEach'](function(_0x4d7d05){var _0x418291=_0x4d7d05[0x0]===_0x297e('0x9a')?_0x4d7d05[0x0]:'i.'+_0x4d7d05[0x0];_0x4901ee['order'](_0x418291,_0x4d7d05[0x1]===_0x297e('0x9b')?![]:!![]);});}if(!_['isEmpty'](_0x21e217)){_0x4901ee['having'](_0x819680);_0x2c342c[_0x297e('0x55')](_0x297e('0x9c'),_0x21e217);}BPromise[_0x297e('0x9d')]()['then'](function(){if(!_0x1b0df7){if(_0x2e81a4[_0x297e('0x4c')][_0x297e('0x83')])return;_0x2c342c[_0x297e('0x55')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x4901ee['where'](_0x297e('0x9e'));return;}if(_0x2e81a4[_0x297e('0x9f')][_0x297e('0xa0')]!=='agent')return;return _0x2e81a4[_0x297e('0x9f')][_0x297e('0xa1')]({'attributes':['id'],'raw':!![]})[_0x297e('0x20')](function(_0xa1614d){if(_[_0x297e('0xa2')](_0xa1614d)){_0x2c342c[_0x297e('0x55')](_0x297e('0xa3'));_0x4901ee[_0x297e('0x55')](_0x297e('0xa3'));}else{_0x2c342c[_0x297e('0x55')](_0x297e('0x84'),_[_0x297e('0x45')](_0xa1614d,'id'));_0x4901ee[_0x297e('0x55')](_0x297e('0x84'),_[_0x297e('0x45')](_0xa1614d,'id'));}});})[_0x297e('0x20')](function(){if(_0x2e81a4['user'][_0x297e('0xa0')]===_0x297e('0x36')&&!_0x1b0df7&&!_0x2e81a4['query']['ChatWebsiteId'])return[];return db[_0x297e('0xa4')][_0x297e('0x4c')](_0x2c342c['toString'](),_0x3a4662);})[_0x297e('0x20')](function(_0x8f91fd){_0x5b3c00['count']=_0x8f91fd[_0x297e('0x51')];if(_0x5b3c00[_0x297e('0x2c')]===0x0)return[];return db['sequelize']['query'](_0x568573[_0x297e('0xa5')](),_0x3a4662)[_0x297e('0x20')](function(_0x78e410){_0x71f4da=_[_0x297e('0xa6')](_0x78e410,'id');_0x3a4662=_[_0x297e('0x34')](_0x3a4662,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2e81a4[_0x297e('0x4c')]['fields']){_0x5a0ea9[_0x297e('0x4f')][_0x297e('0x3b')](function(_0x525e47){_0x4901ee['field']('i.'+_0x525e47);});}else{_0x4901ee[_0x297e('0x58')](_0x297e('0x98'),_0x297e('0x99'));_0x4901ee[_0x297e('0x58')](_0x297e('0xa7'),_0x297e('0xa8'));_0x4901ee[_0x297e('0x58')](_0x297e('0xa9'),'Account.mandatoryDisposition');_0x4901ee[_0x297e('0x58')](_0x297e('0xaa'),_0x297e('0x9a'));_0x4901ee[_0x297e('0x58')](_0x297e('0xab'));_0x4901ee[_0x297e('0x58')](_0x297e('0xac'),'Contact.firstName');_0x4901ee[_0x297e('0x58')](_0x297e('0xad'),_0x297e('0xae'));_0x4901ee[_0x297e('0x58')](_0x297e('0xaf'),_0x297e('0xb0'));_0x4901ee[_0x297e('0x58')](_0x297e('0xb1'),_0x297e('0xb2'));_0x4901ee[_0x297e('0x58')](_0x297e('0xb3'),_0x297e('0xb4'));_0x4901ee['field'](_0x297e('0xb5'),_0x297e('0xb6'));_0x4901ee[_0x297e('0x58')](_0x297e('0xb7'),_0x297e('0xb8'));_0x4901ee[_0x297e('0x58')]('o.internal',_0x297e('0xb9'));_0x4901ee['field'](_0x297e('0xba'),_0x297e('0x39'));}if(_0x5a0ea9[_0x297e('0x2d')])_0x4901ee[_0x297e('0x2d')](_0x5a0ea9[_0x297e('0x2d')]);if(_0x5a0ea9[_0x297e('0x2b')])_0x4901ee['offset'](_0x5a0ea9['offset']);return db[_0x297e('0xa4')][_0x297e('0x4c')](_0x4901ee[_0x297e('0xa5')](),_0x3a4662);})['then'](function(_0x2d56c9){if(_0x2d56c9['length']>0x0)_0x1438cb['where'](_0x297e('0xbb'),_[_0x297e('0x45')](_0x2d56c9,'id'));return db['sequelize'][_0x297e('0x4c')](_0x1438cb[_0x297e('0xa5')](),_0x3a4662)['then'](function(_0x3459bb){var _0x5ead7f=_['groupBy'](_0x3459bb,'ChatInteractionId');var _0x4f0176=[];_0x2d56c9[_0x297e('0x3b')](function(_0x5b4ef5){_0x4f0176[_0x297e('0x3c')](updateChatInteraction(_0x5b4ef5,_0x71f4da,_0x5ead7f));});return BPromise[_0x297e('0xbc')](_0x4f0176);});});})[_0x297e('0x20')](function(_0x2ee382){_0x5b3c00['rows']=_0x2ee382;return _0x5b3c00;})[_0x297e('0x20')](respondWithFilteredResult(_0x3608c2,_0x5a0ea9))[_0x297e('0x27')](handleError(_0x3608c2,null));};exports[_0x297e('0xbd')]=function(_0x10704d,_0x7d91a4){var _0xc8088c={'raw':![],'where':{'id':_0x10704d['params']['id']}},_0x6ecac5={};_0x6ecac5['model']=_[_0x297e('0x4b')](db[_0x297e('0x46')][_0x297e('0x47')]);_0x6ecac5[_0x297e('0x4c')]=_[_0x297e('0x4b')](_0x10704d[_0x297e('0x4c')]);_0x6ecac5['filters']=_[_0x297e('0xbe')](_0x6ecac5['model'],_0x6ecac5['query']);_0xc8088c[_0x297e('0x4f')]=_['intersection'](_0x6ecac5[_0x297e('0x4e')],qs[_0x297e('0x50')](_0x10704d['query'][_0x297e('0x50')]));_0xc8088c[_0x297e('0x4f')]=_0xc8088c[_0x297e('0x4f')][_0x297e('0x51')]?_0xc8088c[_0x297e('0x4f')]:_0x6ecac5[_0x297e('0x4e')];if(_0x10704d['query'][_0x297e('0xbf')]){_0xc8088c[_0x297e('0xc0')]=[{'all':!![]}];}_0xc8088c=_[_0x297e('0x34')]({},_0xc8088c,_0x10704d[_0x297e('0xc1')]);return db['ChatInteraction'][_0x297e('0x6c')](_0xc8088c)['then'](handleEntityNotFound(_0x7d91a4,null))[_0x297e('0x20')](respondWithResult(_0x7d91a4,null))[_0x297e('0x27')](handleError(_0x7d91a4,null));};exports[_0x297e('0xc2')]=function(_0x15f2dc,_0x3fb369){return db[_0x297e('0x46')]['create'](_0x15f2dc[_0x297e('0x80')],{})[_0x297e('0x20')](respondWithResult(_0x3fb369,0xc9))[_0x297e('0x27')](handleError(_0x3fb369,null));};exports[_0x297e('0xc3')]=function(_0x5dd499,_0xa82e41){if(_0x5dd499[_0x297e('0x80')]['id']){delete _0x5dd499[_0x297e('0x80')]['id'];}return db[_0x297e('0x46')][_0x297e('0x6c')]({'where':{'id':_0x5dd499[_0x297e('0xc4')]['id']}})['then'](handleEntityNotFound(_0xa82e41,null))[_0x297e('0x20')](saveUpdates(_0x5dd499[_0x297e('0x80')],null))[_0x297e('0x20')](respondWithResult(_0xa82e41,null))[_0x297e('0x27')](handleError(_0xa82e41,null));};exports[_0x297e('0x31')]=function(_0x527c85,_0x653f46){return db[_0x297e('0x46')]['find']({'where':{'id':_0x527c85[_0x297e('0xc4')]['id']}})['then'](handleEntityNotFound(_0x653f46,null))['then'](removeEntity(_0x653f46,null))[_0x297e('0x27')](handleError(_0x653f46,null));};exports[_0x297e('0xc5')]=function(_0x22d6cb,_0x354072){return db['ChatInteraction'][_0x297e('0xc5')]()['then'](respondWithResult(_0x354072,null))[_0x297e('0x27')](handleError(_0x354072,null));};exports['createVidaooSession']=function(_0x1954cc,_0x4f7a16){var _0x1f6899=_0x1954cc[_0x297e('0xc4')]['id'];var _0x1c7789;var _0xc05fc2;var _0xec9eed;return db[_0x297e('0x46')]['findOne']({'where':{'id':_0x1f6899}})[_0x297e('0x20')](function(_0x1a18bb){_0x1c7789=_0x1a18bb;return db['ChatWebsite'][_0x297e('0xc6')]({'where':{'id':_0x1a18bb[_0x297e('0x83')]},'attributes':['id',_0x297e('0xc7'),'vidaooEscalation','vidaooTopic','vidaooNote',_0x297e('0xc8')],'raw':!![]});})[_0x297e('0x20')](function(_0x419dd1){if(_0x419dd1&&_0x419dd1[_0x297e('0xc7')]&&_0x419dd1['vidaooEscalation']){_0xc05fc2=_0x419dd1;var _0x155890={'interaction':{'id':_0x1f6899},'agent':{'id':_0x1954cc[_0x297e('0x9f')]['id'],'name':_0x1954cc[_0x297e('0x9f')]['name'],'fullname':_0x1954cc[_0x297e('0x9f')][_0x297e('0x38')],'email':_0x1954cc[_0x297e('0x9f')][_0x297e('0xc9')]},'contact':_0x1954cc[_0x297e('0x80')]['contact'],'account':_0x1954cc['body'][_0x297e('0xca')]};var _0x5a58aa={'rejectUnauthorized':![],'method':'POST','url':_0x297e('0xcb'),'headers':{'X-APIKEY':_0x419dd1['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x1954cc['user'][_0x297e('0xc9')]],'buttons':null,'topic':_0xc05fc2[_0x297e('0xcc')],'note':_[_0x297e('0xcd')](_0xc05fc2[_0x297e('0xce')])?null:getMustacheRender(_0xc05fc2[_0x297e('0xce')],_0x155890),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x297e('0xcd')](_0xc05fc2[_0x297e('0xc8')])){var _0x19832c=getMustacheRender(_0xc05fc2['vidaooMetadata'],_0x155890);var _0x297770=JSON[_0x297e('0x85')](_0x19832c);_0x5a58aa[_0x297e('0x80')][_0x297e('0xcf')]=_0x297770;}}catch(_0x3f303d){throw new db['Sequelize'][(_0x297e('0xd0'))](_0x297e('0xd1'));}return rp(_0x5a58aa);}else{throw new db[(_0x297e('0xd2'))][(_0x297e('0xd0'))](_0x297e('0xd3'));}})[_0x297e('0x20')](function(_0x28596c){_0xec9eed=_0x28596c;if(_0xec9eed['id']){var _0x1b7cc9={'body':_0xec9eed[_0x297e('0xd4')],'ChatWebsiteId':_0xc05fc2['id'],'ChatInteractionId':_0x1c7789['id'],'direction':_0x297e('0xd5'),'UserId':_0x1954cc['user']['id']};return db[_0x297e('0xd6')][_0x297e('0xc2')](_0x1b7cc9,{});}else{throw new db[(_0x297e('0xd2'))][(_0x297e('0xd0'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x297e('0x20')](function(){return _0x1c7789[_0x297e('0xd7')]({'vidaooSessionId':_0xec9eed['id']});})[_0x297e('0x20')](respondWithResult(_0x4f7a16,null))[_0x297e('0x27')](handleError(_0x4f7a16,null));};exports[_0x297e('0xd8')]=function(_0x30e946,_0x3caff7){if(_0x30e946['body']['id']){delete _0x30e946['body']['id'];}return db[_0x297e('0x46')]['find']({'where':{'id':_0x30e946[_0x297e('0xc4')]['id']},'include':[{'model':db[_0x297e('0xd9')],'as':_0x297e('0x71')}]})[_0x297e('0x20')](handleEntityNotFound(_0x3caff7,null))[_0x297e('0x20')](saveUpdates(_0x30e946[_0x297e('0x80')],null))[_0x297e('0x20')](respondWithResult(_0x3caff7,null))[_0x297e('0x27')](handleError(_0x3caff7,null));};exports[_0x297e('0xda')]=function(_0x1d736e,_0x15c8f6,_0x4f82a4){if(_0x1d736e[_0x297e('0x80')]['id']){delete _0x1d736e['body']['id'];}return db[_0x297e('0x46')][_0x297e('0x6c')]({'where':{'id':_0x1d736e[_0x297e('0xc4')]['id']}})['then'](function(_0x363977){if(!_0x363977){logger[_0x297e('0x25')](_0x297e('0xdb'),_0x297e('0xda'),0x194,_0x297e('0xdc'));_0x15c8f6[_0x297e('0x28')](0x194);}else{if(_0x363977['UserId']){throw new db[(_0x297e('0xd2'))][(_0x297e('0xd0'))](_0x297e('0xdd'));}}return _0x363977;})['then'](function(_0x4c8343){if(_0x4c8343){return _0x4c8343['update']({'closed':_0x1d736e[_0x297e('0x80')][_0x297e('0x41')],'disposition':_0x1d736e['body']['disposition']})[_0x297e('0x20')](function(_0x280d25){return _0x280d25;});}})[_0x297e('0x20')](function(_0x118b11){return respondWithRpcPromise(_0x297e('0xde'),_0x297e('0xda'),_0x1d736e[_0x297e('0x80')],client9004);})[_0x297e('0x20')](respondWithResult(_0x15c8f6,null))['catch'](handleError(_0x15c8f6,null));};exports[_0x297e('0xdf')]=function(_0x1035cb,_0x26aa94,_0x5bce12){_0x1035cb[_0x297e('0x80')][_0x297e('0x32')]=_0x1035cb['file'][_0x297e('0xe0')];_0x1035cb[_0x297e('0x80')][_0x297e('0xe1')]=_0x1035cb[_0x297e('0xe2')][_0x297e('0xe3')];_0x1035cb[_0x297e('0x80')]['type']=_0x1035cb[_0x297e('0xe2')][_0x297e('0xe4')];return db[_0x297e('0xe5')][_0x297e('0xc2')](_0x1035cb[_0x297e('0x80')])[_0x297e('0x20')](respondWithResult(_0x26aa94,0xc9))['catch'](handleError(_0x26aa94,null));};exports[_0x297e('0xe6')]=function(_0x4c77a8,_0xe1c8e3,_0x33ccc1){return db['ChatInteraction'][_0x297e('0xc6')]({'where':{'id':_0x4c77a8[_0x297e('0xc4')]['id']},'raw':!![]})[_0x297e('0x20')](handleEntityNotFound(_0xe1c8e3,null))[_0x297e('0x20')](function(_0xd248ce){if(_0xd248ce){if(_0xd248ce[_0x297e('0x41')]){return _0xe1c8e3['status'](0x193)[_0x297e('0x2e')]({'status':0x193,'message':_0x297e('0xe7')});}return db[_0x297e('0xe5')][_0x297e('0xc6')]({'where':{'id':_0x4c77a8[_0x297e('0x4c')][_0x297e('0xe8')]},'raw':!![]})[_0x297e('0x20')](handleEntityNotFound(_0xe1c8e3,null));}})['then'](function(_0x26ef8e){if(_0x26ef8e){var _0x56b621=_0x26ef8e[_0x297e('0xe9')]!==null;var _0x5a0b9e=path['join'](config['root'],'server/files/attachments/');if(_0x56b621){_0x5a0b9e=path['join'](_0x5a0b9e,_0x297e('0xea'));}var _0x5b8d42=path[_0x297e('0xeb')](_0x5a0b9e,_0x26ef8e[_0x297e('0xe1')]);return _0xe1c8e3['download'](_0x5b8d42);}})[_0x297e('0x27')](handleError(_0xe1c8e3,null));};exports[_0x297e('0xec')]=function(_0xeaf9a,_0x1c34ac){var _0x39212e=null;var _0x328d24=null;var _0x24c05b=null;var _0x20926a=null;if(_0xeaf9a['body']['id']){delete _0xeaf9a[_0x297e('0x80')]['id'];}if(_0xeaf9a['body']['mailTranscript']){_0x20926a=path[_0x297e('0xeb')](config[_0x297e('0xed')],_0x297e('0xee'),util['format']('transcript-%s.txt',Date[_0x297e('0xef')]()));_0xeaf9a['body'][_0x297e('0xf0')]=_0x20926a;}return db[_0x297e('0x46')][_0x297e('0x6c')]({'where':{'id':_0xeaf9a[_0x297e('0xc4')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x297e('0xf1'),'include':[{'model':db[_0x297e('0x7e')],'as':_0x297e('0x7e')}]}]})[_0x297e('0x20')](handleEntityNotFound(_0x1c34ac,null))['then'](saveUpdates(_0xeaf9a[_0x297e('0x80')],null))[_0x297e('0x20')](function(_0x4869bd){if(_0x4869bd){_0x39212e=_0x4869bd;return db[_0x297e('0xf2')][_0x297e('0x6c')]({'where':{'id':_0x39212e[_0x297e('0x83')]}});}})[_0x297e('0x20')](function(_0x7c0abd){if(_0x7c0abd){_0x24c05b=_0x7c0abd;return db['CmContact'][_0x297e('0x6c')]({'where':{'id':_0x39212e[_0x297e('0x77')]}});}})[_0x297e('0x20')](function(_0x19566a){if(_0x19566a){_0x328d24=_0x19566a;if(_0x20926a){var _0x1605ad=null;for(var _0x4be6ba=0x1;_0x4be6ba<_0x39212e[_0x297e('0xf1')][_0x297e('0x51')];++_0x4be6ba){_0x1605ad=_0x39212e[_0x297e('0xf1')][_0x4be6ba];var _0x9ccb0b=_0x1605ad['UserId']?util[_0x297e('0xf3')](_0x297e('0xf4'),_0x24c05b[_0x297e('0xf5')],_0x1605ad['UserId']):_0x297e('0xf6');var _0x4e85ed=_0xeaf9a[_0x297e('0x80')][_0x297e('0xf7')]||util[_0x297e('0xf3')](_0x297e('0xf4'),_0x297e('0xf8'),_0x1605ad[_0x297e('0x77')]);switch(_0x24c05b[_0x297e('0xf9')]){case _0x297e('0xfa'):_0x9ccb0b=_0x1605ad[_0x297e('0x42')]?util['format'](_0x297e('0xf4'),_0x24c05b[_0x297e('0xf5')],_0x1605ad[_0x297e('0x42')]):'System';break;case _0x297e('0xfb'):_0x9ccb0b=_0x1605ad[_0x297e('0x42')]?_0x1605ad[_0x297e('0x7e')][_0x297e('0xfc')]||_0x1605ad[_0x297e('0x7e')][_0x297e('0x38')]:_0x297e('0xf6');break;case _0x297e('0xfd'):_0x9ccb0b=_0x1605ad[_0x297e('0x42')]?_0x1605ad[_0x297e('0x7e')][_0x297e('0x38')]:_0x297e('0xf6');break;default:_0x9ccb0b=_0x1605ad['UserId']?util[_0x297e('0xf3')](_0x297e('0xf4'),_0x24c05b['agentAlias'],_0x1605ad[_0x297e('0x42')]):_0x297e('0xf6');}var _0x56870d=util[_0x297e('0xf3')]('[%s]\x20%s:\x20%s\x0a',moment(_0x1605ad['createdAt'])[_0x297e('0xf3')](_0x297e('0xfe')),_0x1605ad['direction']==='in'?_0x4e85ed:_0x9ccb0b,_0x1605ad[_0x297e('0x80')]);if(!_0x1605ad[_0x297e('0xff')]){fs[_0x297e('0x100')](_0x20926a,_0x56870d);}}return db[_0x297e('0x101')][_0x297e('0xc6')]({'where':{'service':!![]},'include':[{'model':db[_0x297e('0x102')],'as':'Smtp','raw':!![]}]});}}})[_0x297e('0x20')](function(_0x4e57c6){if(_0x4e57c6&&_0x4e57c6['Smtp']&&_0xeaf9a[_0x297e('0x80')]){var _0x3b90a7={'tls':{'rejectUnauthorized':![]}};if(_0x4e57c6[_0x297e('0x103')][_0x297e('0x104')]){_0x3b90a7['service']=_0x4e57c6[_0x297e('0x103')][_0x297e('0x104')];}else{_0x3b90a7['host']=_0x4e57c6[_0x297e('0x103')][_0x297e('0x105')];_0x3b90a7[_0x297e('0x106')]=_0x4e57c6['Smtp'][_0x297e('0x106')];_0x3b90a7['secure']=_0x4e57c6[_0x297e('0x103')][_0x297e('0x107')];}if(_0x4e57c6[_0x297e('0x103')][_0x297e('0x108')]){_0x3b90a7['auth']={'user':_0x4e57c6[_0x297e('0x103')][_0x297e('0x9f')],'pass':_0x4e57c6[_0x297e('0x103')][_0x297e('0x109')]};}return respondWithRpcPromise(_0x297e('0x10a'),_0x297e('0x10b'),{'account':_0x3b90a7,'message':{'from':util[_0x297e('0xf3')](_0x297e('0x10c'),_0x4e57c6[_0x297e('0x32')],_0x4e57c6[_0x297e('0xc9')]||_0x4e57c6[_0x297e('0x103')]['user']),'to':_0xeaf9a['body'][_0x297e('0x10d')],'subject':_0x297e('0x10e'),'text':util[_0x297e('0xf3')](_0x297e('0x10f'),_0xeaf9a[_0x297e('0x80')][_0x297e('0x10d')]),'attachments':[{'path':_0x20926a}]}})[_0x297e('0x20')](function(){return _0x39212e;})[_0x297e('0x27')](function(_0x4b117c){console[_0x297e('0x25')](_0x4b117c);});}else{return _0x39212e;}})['then'](respondWithStatusCode(_0x1c34ac,0xc8))['catch'](handleError(_0x1c34ac,null));};exports[_0x297e('0x110')]=function(_0x3189ec,_0x3daffb,_0x5ac541){return db['ChatMessage']['find']({'where':{'id':_0x3189ec[_0x297e('0xc4')]['id']}})[_0x297e('0x20')](handleEntityNotFound(_0x3daffb,null))[_0x297e('0x20')](function(_0xd2690f){if(_0xd2690f){return _0xd2690f[_0x297e('0x110')](_0x3189ec[_0x297e('0x80')][_0x297e('0x111')],_[_0x297e('0x112')](_0x3189ec['body'],[_0x297e('0x111'),'id'])||{});}})[_0x297e('0x20')](respondWithResult(_0x3daffb,null))[_0x297e('0x27')](handleError(_0x3daffb,null));};exports[_0x297e('0x113')]=function(_0x120405,_0x12eadc,_0x22adc9){var _0x4ad5e3={'raw':![],'where':{}};var _0x2038e8={};var _0x197c15={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x297e('0xc6')]({'where':{'id':_0x120405[_0x297e('0xc4')]['id']}})[_0x297e('0x20')](handleEntityNotFound(_0x12eadc,null))['then'](function(_0x58ea7b){if(_0x58ea7b){_0x2038e8['model']=_[_0x297e('0x4b')](db[_0x297e('0xd6')]['rawAttributes']);_0x2038e8[_0x297e('0x4c')]=_[_0x297e('0x4b')](_0x120405['query']);_0x2038e8[_0x297e('0x4d')]=_[_0x297e('0xbe')](_0x2038e8[_0x297e('0x4e')],_0x2038e8['query']);_0x4ad5e3['attributes']=_[_0x297e('0xbe')](_0x2038e8[_0x297e('0x4e')],qs['fields'](_0x120405['query'][_0x297e('0x50')]));_0x4ad5e3[_0x297e('0x4f')]=_0x4ad5e3[_0x297e('0x4f')][_0x297e('0x51')]?_0x4ad5e3[_0x297e('0x4f')]:_0x2038e8[_0x297e('0x4e')];if(!_0x120405[_0x297e('0x4c')]['hasOwnProperty'](_0x297e('0x52'))){_0x4ad5e3['limit']=qs[_0x297e('0x2d')](_0x120405[_0x297e('0x4c')][_0x297e('0x2d')]);_0x4ad5e3[_0x297e('0x2b')]=qs[_0x297e('0x2b')](_0x120405[_0x297e('0x4c')][_0x297e('0x2b')]);}_0x4ad5e3['order']=qs['sort'](_0x120405[_0x297e('0x4c')]['sort']);_0x4ad5e3[_0x297e('0x55')]=qs[_0x297e('0x4d')](_[_0x297e('0x56')](_0x120405[_0x297e('0x4c')],_0x2038e8[_0x297e('0x4d')]));_0x4ad5e3['where'][_0x297e('0x114')]=_0x58ea7b['id'];if(_0x120405[_0x297e('0x4c')]['filter']){_0x4ad5e3[_0x297e('0x55')]=_[_0x297e('0x34')](_0x4ad5e3[_0x297e('0x55')],{'$or':_[_0x297e('0x45')](_0x4ad5e3['attributes'],function(_0x59005a){var _0x5e44c3={};_0x5e44c3[_0x59005a]={'$like':'%'+_0x120405[_0x297e('0x4c')]['filter']+'%'};return _0x5e44c3;})});}if(_0x120405[_0x297e('0x4c')]['$gte']){var _0x486f03=_0x120405['query']['$gte'][_0x297e('0x7b')](',');var _0x459212={};_0x459212[_0x486f03[0x0]]={'$gte':moment(_0x486f03[0x1])[_0x297e('0xf3')](_0x297e('0x115'))};_0x4ad5e3['where']=_[_0x297e('0x34')](_0x4ad5e3[_0x297e('0x55')],_0x459212);}_0x4ad5e3=_['merge']({},_0x4ad5e3,_0x120405[_0x297e('0xc1')]);return db[_0x297e('0xd6')][_0x297e('0x2c')]({'where':_0x4ad5e3[_0x297e('0x55')]})['then'](function(_0x1d3445){_0x197c15[_0x297e('0x2c')]=_0x1d3445;if(_0x120405[_0x297e('0x4c')]['includeAll']){_0x4ad5e3['include']=[{'all':!![]}];}return db[_0x297e('0xd6')][_0x297e('0x116')](_0x4ad5e3);})[_0x297e('0x20')](function(_0x30c120){_0x197c15['rows']=_0x30c120;return _0x197c15;});}})['then'](respondWithFilteredResult(_0x12eadc,_0x4ad5e3))[_0x297e('0x27')](handleError(_0x12eadc,null));};exports[_0x297e('0x117')]=function(_0x4fbffa,_0x4dae60,_0x2969e4){var _0x33f3da={'where':{}},_0x4831dd={},_0x55516b={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x297e('0xc6')]({'where':{'id':_0x4fbffa[_0x297e('0xc4')]['id']}})[_0x297e('0x20')](handleEntityNotFound(_0x4dae60,null))[_0x297e('0x20')](function(_0x2ff479){if(_0x2ff479){_0x4831dd[_0x297e('0x4e')]=_['keys'](db[_0x297e('0xd6')][_0x297e('0x47')]);_0x4831dd[_0x297e('0x4c')]=_[_0x297e('0x4b')](_0x4fbffa['query']);_0x4831dd[_0x297e('0x4d')]=_[_0x297e('0xbe')](_0x4831dd[_0x297e('0x4e')],_0x4831dd['query']);_0x33f3da[_0x297e('0x4f')]=_[_0x297e('0xbe')](_0x4831dd[_0x297e('0x4e')],qs[_0x297e('0x50')](_0x4fbffa['query'][_0x297e('0x50')]));_0x33f3da[_0x297e('0x4f')]=_0x33f3da[_0x297e('0x4f')]['length']?_0x33f3da['attributes']:_0x4831dd['model'];if(!_0x4fbffa['query'][_0x297e('0x118')](_0x297e('0x52'))){_0x33f3da[_0x297e('0x2d')]=qs[_0x297e('0x2d')](_0x4fbffa['query'][_0x297e('0x2d')]);_0x33f3da[_0x297e('0x2b')]=qs[_0x297e('0x2b')](_0x4fbffa['query'][_0x297e('0x2b')]);}_0x33f3da[_0x297e('0x53')]=qs[_0x297e('0x54')](_0x4fbffa[_0x297e('0x4c')][_0x297e('0x54')]);_0x33f3da['where']=qs[_0x297e('0x4d')](_[_0x297e('0x56')](_0x4fbffa[_0x297e('0x4c')],_0x4831dd[_0x297e('0x4d')]));_0x33f3da[_0x297e('0x55')][_0x297e('0x114')]=_0x2ff479['id'];if(_0x4fbffa[_0x297e('0x4c')][_0x297e('0x8f')]){_0x33f3da['where']=_[_0x297e('0x34')](_0x33f3da[_0x297e('0x55')],{'$or':_['map'](_0x33f3da['attributes'],function(_0x333d84){var _0x4dab04={};_0x4dab04[_0x333d84]={'$like':'%'+_0x4fbffa[_0x297e('0x4c')][_0x297e('0x8f')]+'%'};return _0x4dab04;})});}_0x33f3da[_0x297e('0x55')][_0x297e('0xff')]=![];if(_0x4fbffa[_0x297e('0x4c')]['id']){_0x33f3da['where']['id']={'$gt':_0x4fbffa[_0x297e('0x4c')]['id']};}_0x33f3da=_[_0x297e('0x34')]({},_0x33f3da,_0x4fbffa[_0x297e('0xc1')]);return db[_0x297e('0xd6')][_0x297e('0x2c')]({'where':_0x33f3da['where']})[_0x297e('0x20')](function(_0x11d187){_0x55516b[_0x297e('0x2c')]=_0x11d187;_0x33f3da[_0x297e('0xc0')]=[];if(_0x4fbffa[_0x297e('0x4c')]['includeAgent']){_0x33f3da[_0x297e('0xc0')][_0x297e('0x3c')]({'model':db[_0x297e('0x7e')],'as':'User','attributes':['id',_0x297e('0x38'),'alias']});}if(_0x4fbffa[_0x297e('0x4c')]['includeAll']){_0x33f3da[_0x297e('0xc0')]=[{'all':!![]}];}return db[_0x297e('0xd6')][_0x297e('0x116')](_0x33f3da);})[_0x297e('0x20')](function(_0x3e9425){_0x55516b[_0x297e('0x119')]=_0x3e9425;return _0x55516b;});}})[_0x297e('0x20')](respondWithFilteredResult(_0x4dae60,_0x33f3da))[_0x297e('0x27')](handleError(_0x4dae60,null));};exports[_0x297e('0x11a')]=function(_0x14a2d9,_0x3690ae,_0x5b3743){return db[_0x297e('0x46')][_0x297e('0x6c')]({'where':{'id':_0x14a2d9['params']['id']}})[_0x297e('0x20')](handleEntityNotFound(_0x3690ae,null))['then'](function(_0x1f873f){if(_0x1f873f){return _0x1f873f[_0x297e('0x11b')](_0x14a2d9[_0x297e('0x80')][_0x297e('0x111')],_['omit'](_0x14a2d9[_0x297e('0x80')],[_0x297e('0x111'),'id'])||{})[_0x297e('0x11c')](function(){return db[_0x297e('0x7a')][_0x297e('0x116')]({'attributes':['id',_0x297e('0x32'),_0x297e('0x59')],'where':{'id':_0x14a2d9[_0x297e('0x80')]['ids']}});})[_0x297e('0x20')](function(_0x4a6be5){socket[_0x297e('0x11d')](_0x297e('0x11e'),{'id':Number(_0x14a2d9['params']['id']),'tags':_0x4a6be5||[]});return{'id':Number(_0x14a2d9[_0x297e('0xc4')]['id']),'tags':_0x4a6be5||[]};});}})[_0x297e('0x20')](respondWithResult(_0x3690ae,null))[_0x297e('0x27')](handleError(_0x3690ae,null));};exports[_0x297e('0x11f')]=function(_0x5855cc,_0x40a301,_0x57c6dd){return db[_0x297e('0x46')][_0x297e('0x6c')]({'where':{'id':_0x5855cc['params']['id']}})[_0x297e('0x20')](handleEntityNotFound(_0x40a301,null))[_0x297e('0x20')](function(_0x5135a6){if(_0x5135a6){return _0x5135a6['removeTags'](_0x5855cc[_0x297e('0x4c')][_0x297e('0x111')]);}})[_0x297e('0x20')](respondWithStatusCode(_0x40a301,null))['catch'](handleError(_0x40a301,null));};exports[_0x297e('0x120')]=function(_0x47c4f1,_0x449e0c){var _0x52f584=moment()[_0x297e('0x121')]()[_0x297e('0xa5')]();var _0x550658=path['join'](config[_0x297e('0xed')],_0x297e('0x122'),_0x297e('0x123'),_0x297e('0x124'));var _0x34382a=path[_0x297e('0xeb')](config[_0x297e('0xed')],_0x297e('0x122'),_0x297e('0x123'),_0x297e('0x125'));var _0x2f9747=path[_0x297e('0xeb')](_0x550658,_0x52f584);var _0x4f945a=util[_0x297e('0xf3')](_0x297e('0x126'),_0x47c4f1[_0x297e('0xc4')]['id'],_0x52f584);var _0x44109e=path[_0x297e('0xeb')](_0x550658,_0x4f945a);var _0x2dfe8d=[];_0x2dfe8d['push']({'model':db[_0x297e('0x7e')],'as':_0x297e('0x7e'),'attributes':['id',_0x297e('0x38')],'raw':!![]});_0x2dfe8d['push']({'model':db['CmContact'],'as':_0x297e('0x71'),'attributes':['id',_0x297e('0x127'),_0x297e('0x128')],'raw':!![]});if(_0x47c4f1[_0x297e('0x4c')][_0x297e('0x125')]){_0x2dfe8d[_0x297e('0x3c')]({'model':db[_0x297e('0xe5')],'as':_0x297e('0xe5'),'raw':!![]});}var _0x2d60a5=[{'model':db['ChatMessage'],'as':_0x297e('0xf1'),'attributes':['id',_0x297e('0x80'),'createdAt',_0x297e('0x129'),'secret',_0x297e('0x8a')],'include':_0x2dfe8d}];_0x2d60a5[_0x297e('0x3c')]({'model':db[_0x297e('0xf2')],'as':_0x297e('0x12a'),'attributes':['id',_0x297e('0x32')]});_0x2d60a5['push']({'model':db[_0x297e('0x7e')],'as':'Owner','attributes':['id',_0x297e('0x38')]});return db[_0x297e('0x46')][_0x297e('0x6c')]({'where':{'id':_0x47c4f1[_0x297e('0xc4')]['id']},'include':_0x2d60a5})[_0x297e('0x20')](handleEntityNotFound(_0x449e0c,null))[_0x297e('0x20')](function(_0x24fa7c){if(_0x24fa7c){var _0x4bf73d=_0x24fa7c['get']({'plain':!![]});fs[_0x297e('0x12b')](_0x2f9747);var _0x16d134={'channel':_0x297e('0x12c'),'account':_0x4bf73d[_0x297e('0x12a')][_0x297e('0x32')],'agent':_0x4bf73d['Owner']?_0x4bf73d[_0x297e('0x12d')][_0x297e('0x38')]:_0x297e('0x12e'),'createdAt':moment(_0x4bf73d[_0x297e('0x12f')])[_0x297e('0xf3')](_0x297e('0x115'))[_0x297e('0xa5')](),'closedAt':_0x4bf73d[_0x297e('0x41')]?moment(_0x4bf73d[_0x297e('0x130')])['format'](_0x297e('0x115'))['toString']():'','disposition':_0x4bf73d['disposition'],'chatInfo':{'browser':_0x4bf73d[_0x297e('0x131')],'os':_0x4bf73d[_0x297e('0x132')],'referer':_0x4bf73d[_0x297e('0x133')],'customerIp':_0x4bf73d[_0x297e('0x134')],'customerPort':_0x4bf73d[_0x297e('0x135')]?_0x4bf73d[_0x297e('0x135')]:_0x297e('0x12e')},'messages':_(_0x4bf73d['Messages'])[_0x297e('0x136')]()[_0x297e('0x8f')]({'secret':![]})['map'](function(_0x2f4a28){if(_0x2f4a28[_0x297e('0xe5')]){var _0x305c15=path['join'](_0x34382a,_0x2f4a28[_0x297e('0xe5')]['basename']);if(fs[_0x297e('0x137')](_0x305c15)){fs['createReadStream'](_0x305c15)[_0x297e('0x138')](fs[_0x297e('0x139')](path[_0x297e('0xeb')](_0x2f9747,_0x2f4a28[_0x297e('0xe5')]['basename'])));}}return{'date':moment(_0x2f4a28[_0x297e('0x12f')])[_0x297e('0xf3')](_0x297e('0x115'))[_0x297e('0xa5')](),'sender':_0x2f4a28[_0x297e('0x129')]===_0x297e('0xd5')?_0x2f4a28[_0x297e('0x7e')]?_0x2f4a28[_0x297e('0x7e')][_0x297e('0x38')]:_0x297e('0xf6'):_0x2f4a28[_0x297e('0x71')][_0x297e('0x127')]+(_0x2f4a28['Contact'][_0x297e('0x128')]?'\x20'+_0x2f4a28[_0x297e('0x71')]['lastName']:''),'body':_0x2f4a28[_0x297e('0xe5')]?_0x2f4a28['Attachment']['basename']:_0x2f4a28[_0x297e('0x80')],'direction':_0x2f4a28[_0x297e('0x129')]==='out'?'A':'C','secret':_0x2f4a28[_0x297e('0xff')],'read':_0x2f4a28['read'],'attachment':_0x2f4a28[_0x297e('0xe5')]};})[_0x297e('0x6d')]()};return ejs[_0x297e('0x13a')](path[_0x297e('0xeb')](config[_0x297e('0xed')],'server',_0x297e('0x13b'),_0x297e('0x13c')),{'interaction':_0x16d134})['then'](function(_0x594d4e){var _0x374eb3=path[_0x297e('0xeb')](_0x2f9747,_0x297e('0x13d')+_0x4bf73d['id']+'-'+_0x52f584+'.pdf');var _0x2ecd16={'path':_0x374eb3,'channel':'Chat','interactionId':_0x4bf73d['id']};return pdf[_0x297e('0x13e')](_0x594d4e,_0x2ecd16);})[_0x297e('0x20')](function(){return new BPromise(function(_0x1ace50,_0x39a707){zipdir(_0x2f9747,{'saveTo':_0x44109e},function(_0x2347f9,_0x24386a){if(_0x2347f9)return _0x39a707(_0x2347f9);return _0x1ace50(_0x24386a);});})['then'](function(){return new BPromise(function(_0x145315,_0x1b9804){rimraf(_0x2f9747,function(_0x3824cf){if(_0x3824cf)_0x1b9804(_0x3824cf);return _0x145315();});});})[_0x297e('0x20')](function(){return _0x449e0c[_0x297e('0x120')](_0x44109e,_0x4f945a,function(_0x572896){if(_0x572896){console[_0x297e('0x13f')](_0x297e('0x140'),_0x572896);}else{fs[_0x297e('0x141')](_0x44109e);}});});});}else{return _0x449e0c[_0x297e('0x28')](0xc8);}})['catch'](handleError(_0x449e0c,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index cc487fb..204e87e 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 _0x5790=['exports','events','ChatInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hook'];(function(_0x4bdc75,_0x43cddc){var _0xdc2b01=function(_0x18d7cf){while(--_0x18d7cf){_0x4bdc75['push'](_0x4bdc75['shift']());}};_0xdc2b01(++_0x43cddc);}(_0x5790,0x100));var _0x0579=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5790[_0x19950b];return _0x3c6b41;};'use strict';var EventEmitter=require(_0x0579('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x0579('0x1')];var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x0579('0x2')](0x0);var events={'afterCreate':_0x0579('0x3'),'afterUpdate':_0x0579('0x4'),'afterDestroy':_0x0579('0x5')};function emitEvent(_0x352d0f){return function(_0x3eea88,_0x4db200,_0x5d0049){_0x3eea88[_0x0579('0x6')]({'attributes':['id'],'raw':!![]})[_0x0579('0x7')](function(_0x5003d){_0x3eea88[_0x0579('0x8')](_0x0579('0x9'),_0x5003d[_0x0579('0xa')](function(_0x1cc0a4){return{'id':_0x1cc0a4['id']};}));return ChatMessage[_0x0579('0xb')]({'where':{'ChatInteractionId':_0x3eea88['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0579('0x7')](function(_0x4cad07){_0x3eea88['setDataValue'](_0x0579('0xc'),_0x4cad07['length']);ChatInteractionEvents[_0x0579('0xd')](_0x352d0f+':'+_0x3eea88['id'],_0x3eea88);ChatInteractionEvents['emit'](_0x352d0f,_0x3eea88);_0x5d0049(null);})[_0x0579('0xe')](_0x5d0049(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x0579('0xf')](e,emitEvent(event));}}module[_0x0579('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0xaff6=['emit','catch','hasOwnProperty','hook','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','getUsers','then','Users','map','findAll','unreadMessages','length'];(function(_0x137cb7,_0x278c1d){var _0x2402b6=function(_0x55ec0e){while(--_0x55ec0e){_0x137cb7['push'](_0x137cb7['shift']());}};_0x2402b6(++_0x278c1d);}(_0xaff6,0x194));var _0x6aff=function(_0x2ed7d1,_0x363741){_0x2ed7d1=_0x2ed7d1-0x0;var _0x38ae3c=_0xaff6[_0x2ed7d1];return _0x38ae3c;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x6aff('0x0'))['db'][_0x6aff('0x1')];var ChatMessage=require(_0x6aff('0x0'))['db'][_0x6aff('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x6aff('0x3')](0x0);var events={'afterCreate':_0x6aff('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x398d35){return function(_0x2f54bc,_0xce8fae,_0x45adca){_0x2f54bc[_0x6aff('0x5')]({'attributes':['id'],'raw':!![]})[_0x6aff('0x6')](function(_0x1965b4){_0x2f54bc['setDataValue'](_0x6aff('0x7'),_0x1965b4[_0x6aff('0x8')](function(_0x994d93){return{'id':_0x994d93['id']};}));return ChatMessage[_0x6aff('0x9')]({'where':{'ChatInteractionId':_0x2f54bc['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6aff('0x6')](function(_0x162aa3){_0x2f54bc['setDataValue'](_0x6aff('0xa'),_0x162aa3[_0x6aff('0xb')]);ChatInteractionEvents[_0x6aff('0xc')](_0x398d35+':'+_0x2f54bc['id'],_0x2f54bc);ChatInteractionEvents[_0x6aff('0xc')](_0x398d35,_0x2f54bc);_0x45adca(null);})[_0x6aff('0xd')](_0x45adca(null));};}for(var e in events){if(events[_0x6aff('0xe')](e)){var event=events[e];ChatInteraction[_0x6aff('0xf')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 98a863d..e38e3e8 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 _0x944c=['closed','closedAt','format','utf8mb4','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed'];(function(_0x16b6f4,_0x45369f){var _0x48cc8c=function(_0x588ebf){while(--_0x588ebf){_0x16b6f4['push'](_0x16b6f4['shift']());}};_0x48cc8c(++_0x45369f);}(_0x944c,0x17a));var _0xc944=function(_0x28aea6,_0x38cf69){_0x28aea6=_0x28aea6-0x0;var _0xa1a04a=_0x944c[_0x28aea6];return _0xa1a04a;};'use strict';var _=require(_0xc944('0x0'));var util=require(_0xc944('0x1'));var logger=require(_0xc944('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc944('0x3'));var rp=require(_0xc944('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc944('0x5'));var config=require(_0xc944('0x6'));var attributes=require(_0xc944('0x7'));module[_0xc944('0x8')]=function(_0x271823,_0x1806cc){return _0x271823[_0xc944('0x9')](_0xc944('0xa'),attributes,{'tableName':_0xc944('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xac1ecc,_0x11bedc,_0x57554c){if(_0xac1ecc[_0xc944('0xc')](_0xc944('0xd'))){_0xac1ecc[_0xc944('0xe')]=moment()[_0xc944('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x57554c(null,_0xac1ecc);}},'charset':_0xc944('0x10'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9af9=['utf8mb4','utf8mb4_unicode_ci','lodash','api','bluebird','request-promise','path','./chatInteraction.attributes','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format'];(function(_0x2af3e2,_0x44ece0){var _0x18b168=function(_0x2de174){while(--_0x2de174){_0x2af3e2['push'](_0x2af3e2['shift']());}};_0x18b168(++_0x44ece0);}(_0x9af9,0x16a));var _0x99af=function(_0x2e2a67,_0x4819da){_0x2e2a67=_0x2e2a67-0x0;var _0x250fee=_0x9af9[_0x2e2a67];return _0x250fee;};'use strict';var _=require(_0x99af('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x99af('0x1'));var moment=require('moment');var BPromise=require(_0x99af('0x2'));var rp=require(_0x99af('0x3'));var fs=require('fs');var path=require(_0x99af('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x99af('0x5'));module['exports']=function(_0x2ac902,_0x3ab229){return _0x2ac902[_0x99af('0x6')](_0x99af('0x7'),attributes,{'tableName':_0x99af('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3ed8ee,_0xeee74e,_0x18e924){if(_0x3ed8ee[_0x99af('0x9')](_0x99af('0xa'))){_0x3ed8ee[_0x99af('0xb')]=moment()[_0x99af('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x18e924(null,_0x3ed8ee);}},'charset':_0x99af('0xd'),'collate':_0x99af('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index fd4fe00..265c4e4 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 _0x5cf3=['client','http','redis','defaults','localhost','socket.io-emitter','request','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','ChatInteraction','update','options','raw','where','attributes','limit','then','UpdateChatInteraction','stringify','AddTagsToChatInteraction','find','body','ids','omit','spread','AddTags','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x5cf3,0xa5));var _0x35cf=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x5cf3[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require(_0x35cf('0x0'));var util=require('util');var moment=require(_0x35cf('0x1'));var BPromise=require(_0x35cf('0x2'));var rs=require(_0x35cf('0x3'));var fs=require('fs');var Redis=require(_0x35cf('0x4'));var db=require(_0x35cf('0x5'))['db'];var utils=require(_0x35cf('0x6'));var logger=require(_0x35cf('0x7'))(_0x35cf('0x8'));var config=require(_0x35cf('0x9'));var jayson=require(_0x35cf('0xa'));var client=jayson[_0x35cf('0xb')][_0x35cf('0xc')]({'port':0x232a});config[_0x35cf('0xd')]=_[_0x35cf('0xe')](config['redis'],{'host':_0x35cf('0xf'),'port':0x18eb});var socket=require(_0x35cf('0x10'))(new Redis(config[_0x35cf('0xd')]));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x459d32,_0x125cb9,_0xae5f0){return new BPromise(function(_0x520dfb,_0x678e56){return client[_0x35cf('0x11')](_0x459d32,_0xae5f0)['then'](function(_0x51b4f4){logger[_0x35cf('0x12')](_0x35cf('0x13'),_0x125cb9,'request\x20sent');logger[_0x35cf('0x14')](_0x35cf('0x15'),_0x125cb9,_0x35cf('0x16'),JSON['stringify'](_0x51b4f4));if(_0x51b4f4[_0x35cf('0x17')]){if(_0x51b4f4['error'][_0x35cf('0x18')]===0x1f4){logger[_0x35cf('0x17')](_0x35cf('0x13'),_0x125cb9,_0x51b4f4[_0x35cf('0x17')]['message']);return _0x678e56(_0x51b4f4[_0x35cf('0x17')][_0x35cf('0x19')]);}logger[_0x35cf('0x17')](_0x35cf('0x13'),_0x125cb9,_0x51b4f4[_0x35cf('0x17')][_0x35cf('0x19')]);return _0x520dfb(_0x51b4f4[_0x35cf('0x17')][_0x35cf('0x19')]);}else{logger[_0x35cf('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x125cb9,_0x35cf('0x16'));_0x520dfb(_0x51b4f4['result']['message']);}})['catch'](function(_0x1e67b8){logger[_0x35cf('0x17')](_0x35cf('0x13'),_0x125cb9,_0x1e67b8);_0x678e56(_0x1e67b8);});});}exports['UpdateChatInteraction']=function(_0x55e7cb){var _0x58b850=this;return new Promise(function(_0x213ea0,_0x5c3804){return db[_0x35cf('0x1a')][_0x35cf('0x1b')](_0x55e7cb['body'],{'raw':_0x55e7cb['options']?_0x55e7cb[_0x35cf('0x1c')][_0x35cf('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55e7cb[_0x35cf('0x1c')]?_0x55e7cb[_0x35cf('0x1c')][_0x35cf('0x1e')]||null:null,'attributes':_0x55e7cb[_0x35cf('0x1c')]?_0x55e7cb['options'][_0x35cf('0x1f')]||null:null,'limit':_0x55e7cb[_0x35cf('0x1c')]?_0x55e7cb[_0x35cf('0x1c')][_0x35cf('0x20')]||null:null})[_0x35cf('0x21')](function(_0x42f6cb){logger[_0x35cf('0x12')](_0x35cf('0x22'),_0x55e7cb);logger[_0x35cf('0x14')](_0x35cf('0x22'),_0x55e7cb,JSON[_0x35cf('0x23')](_0x42f6cb));_0x213ea0(_0x42f6cb);})['catch'](function(_0x1f7900){logger[_0x35cf('0x17')](_0x35cf('0x22'),_0x1f7900[_0x35cf('0x19')],_0x55e7cb);_0x5c3804(_0x58b850[_0x35cf('0x17')](0x1f4,_0x1f7900['message']));});});};exports[_0x35cf('0x24')]=function(_0x54bd52){return new Promise(function(_0x3fc589,_0x202eae){return db[_0x35cf('0x1a')][_0x35cf('0x25')]({'where':_0x54bd52[_0x35cf('0x1c')]?_0x54bd52['options']['where']||null:null})[_0x35cf('0x21')](function(_0x19933e){if(_0x19933e){return _0x19933e['addTags'](_0x54bd52[_0x35cf('0x26')][_0x35cf('0x27')],_[_0x35cf('0x28')](_0x54bd52[_0x35cf('0x26')],[_0x35cf('0x27'),'id'])||{});}})[_0x35cf('0x29')](function(_0x4f8b96){logger['info'](_0x35cf('0x2a'),_0x54bd52);logger[_0x35cf('0x14')](_0x35cf('0x2a'),_0x54bd52,JSON[_0x35cf('0x23')](_0x4f8b96));_0x3fc589(_0x4f8b96);})[_0x35cf('0x2b')](function(_0x1f153c){logger['error']('AddTags',_0x1f153c[_0x35cf('0x19')],_0x54bd52);_0x202eae(_this[_0x35cf('0x17')](0x1f4,_0x1f153c[_0x35cf('0x19')]));});});}; \ No newline at end of file +var _0x811c=['redis','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','update','options','raw','where','attributes','UpdateChatInteraction','AddTagsToChatInteraction','ChatInteraction','find','body','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x3c4f1f,_0x20d3ec){var _0x19cb69=function(_0x2e04bc){while(--_0x2e04bc){_0x3c4f1f['push'](_0x3c4f1f['shift']());}};_0x19cb69(++_0x20d3ec);}(_0x811c,0x1ad));var _0xc811=function(_0x2457df,_0x2a4789){_0x2457df=_0x2457df-0x0;var _0x5bbec9=_0x811c[_0x2457df];return _0x5bbec9;};'use strict';var _=require('lodash');var util=require(_0xc811('0x0'));var moment=require(_0xc811('0x1'));var BPromise=require(_0xc811('0x2'));var rs=require(_0xc811('0x3'));var fs=require('fs');var Redis=require(_0xc811('0x4'));var db=require(_0xc811('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc811('0x6'))(_0xc811('0x7'));var config=require(_0xc811('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc811('0x9')][_0xc811('0xa')]({'port':0x232a});config[_0xc811('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc811('0xc'))(new Redis(config[_0xc811('0xb')]));require(_0xc811('0xd'))[_0xc811('0xe')](socket);function respondWithRpcPromise(_0x145d82,_0x213b5e,_0x225377){return new BPromise(function(_0x4cf6fa,_0xa1aec1){return client[_0xc811('0xf')](_0x145d82,_0x225377)[_0xc811('0x10')](function(_0x3f5098){logger[_0xc811('0x11')](_0xc811('0x12'),_0x213b5e,_0xc811('0x13'));logger[_0xc811('0x14')](_0xc811('0x15'),_0x213b5e,'request\x20sent',JSON[_0xc811('0x16')](_0x3f5098));if(_0x3f5098['error']){if(_0x3f5098[_0xc811('0x17')]['code']===0x1f4){logger[_0xc811('0x17')](_0xc811('0x12'),_0x213b5e,_0x3f5098[_0xc811('0x17')][_0xc811('0x18')]);return _0xa1aec1(_0x3f5098[_0xc811('0x17')][_0xc811('0x18')]);}logger['error'](_0xc811('0x12'),_0x213b5e,_0x3f5098[_0xc811('0x17')][_0xc811('0x18')]);return _0x4cf6fa(_0x3f5098['error']['message']);}else{logger[_0xc811('0x11')]('ChatInteraction,\x20%s,\x20%s',_0x213b5e,'request\x20sent');_0x4cf6fa(_0x3f5098['result'][_0xc811('0x18')]);}})[_0xc811('0x19')](function(_0x1d1e66){logger[_0xc811('0x17')](_0xc811('0x12'),_0x213b5e,_0x1d1e66);_0xa1aec1(_0x1d1e66);});});}exports['UpdateChatInteraction']=function(_0xb0796d){var _0x2d693b=this;return new Promise(function(_0xb9d6d2,_0x586484){return db['ChatInteraction'][_0xc811('0x1a')](_0xb0796d['body'],{'raw':_0xb0796d[_0xc811('0x1b')]?_0xb0796d[_0xc811('0x1b')][_0xc811('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb0796d[_0xc811('0x1b')]?_0xb0796d[_0xc811('0x1b')][_0xc811('0x1d')]||null:null,'attributes':_0xb0796d[_0xc811('0x1b')]?_0xb0796d[_0xc811('0x1b')][_0xc811('0x1e')]||null:null,'limit':_0xb0796d[_0xc811('0x1b')]?_0xb0796d[_0xc811('0x1b')]['limit']||null:null})[_0xc811('0x10')](function(_0x336276){logger[_0xc811('0x11')]('UpdateChatInteraction',_0xb0796d);logger[_0xc811('0x14')](_0xc811('0x1f'),_0xb0796d,JSON['stringify'](_0x336276));_0xb9d6d2(_0x336276);})['catch'](function(_0x2f2851){logger[_0xc811('0x17')]('UpdateChatInteraction',_0x2f2851[_0xc811('0x18')],_0xb0796d);_0x586484(_0x2d693b[_0xc811('0x17')](0x1f4,_0x2f2851[_0xc811('0x18')]));});});};exports[_0xc811('0x20')]=function(_0x665a11){return new Promise(function(_0x34fe8f,_0x3e22b3){return db[_0xc811('0x21')][_0xc811('0x22')]({'where':_0x665a11[_0xc811('0x1b')]?_0x665a11['options'][_0xc811('0x1d')]||null:null})[_0xc811('0x10')](function(_0x107199){if(_0x107199){return _0x107199['addTags'](_0x665a11[_0xc811('0x23')][_0xc811('0x24')],_[_0xc811('0x25')](_0x665a11[_0xc811('0x23')],[_0xc811('0x24'),'id'])||{});}})[_0xc811('0x26')](function(_0xe6a95c){logger['info'](_0xc811('0x27'),_0x665a11);logger[_0xc811('0x14')](_0xc811('0x27'),_0x665a11,JSON[_0xc811('0x16')](_0xe6a95c));_0x34fe8f(_0xe6a95c);})[_0xc811('0x19')](function(_0xb497e0){logger[_0xc811('0x17')](_0xc811('0x27'),_0xb497e0['message'],_0x665a11);_0x3e22b3(_this[_0xc811('0x17')](0x1f4,_0xb497e0[_0xc811('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 11dfd02..d223a54 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 _0x89b2=['removeListener','register','./chatInteraction.events','save','remove','update','emit'];(function(_0x25404f,_0x41e06b){var _0xd0ba74=function(_0x3d45a9){while(--_0x3d45a9){_0x25404f['push'](_0x25404f['shift']());}};_0xd0ba74(++_0x41e06b);}(_0x89b2,0xc6));var _0x289b=function(_0x1b8300,_0x472f39){_0x1b8300=_0x1b8300-0x0;var _0x49deb2=_0x89b2[_0x1b8300];return _0x49deb2;};'use strict';var ChatInteractionEvents=require(_0x289b('0x0'));var events=[_0x289b('0x1'),_0x289b('0x2'),_0x289b('0x3')];function createListener(_0x1e9399,_0x9218b1){return function(_0xcf1649){_0x9218b1[_0x289b('0x4')](_0x1e9399,_0xcf1649);};}function removeListener(_0x1f95d6,_0x1067a0){return function(){ChatInteractionEvents[_0x289b('0x5')](_0x1f95d6,_0x1067a0);};}exports[_0x289b('0x6')]=function(_0x5a6cc7){for(var _0x1f7062=0x0,_0x5a3c5c=events['length'];_0x1f7062<_0x5a3c5c;_0x1f7062++){var _0x2376f0=events[_0x1f7062];var _0x4ab7ba=createListener('chatInteraction:'+_0x2376f0,_0x5a6cc7);ChatInteractionEvents['on'](_0x2376f0,_0x4ab7ba);}}; \ No newline at end of file +var _0xdd83=['./chatInteraction.events','update','removeListener','register','length'];(function(_0x587b3b,_0x40bca0){var _0x1493e2=function(_0x43305b){while(--_0x43305b){_0x587b3b['push'](_0x587b3b['shift']());}};_0x1493e2(++_0x40bca0);}(_0xdd83,0x195));var _0x3dd8=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xdd83[_0x46698a];return _0x356db0;};'use strict';var ChatInteractionEvents=require(_0x3dd8('0x0'));var events=['save','remove',_0x3dd8('0x1')];function createListener(_0xccfc13,_0x3d852d){return function(_0x31f451){_0x3d852d['emit'](_0xccfc13,_0x31f451);};}function removeListener(_0x2eafe6,_0x33cf1b){return function(){ChatInteractionEvents[_0x3dd8('0x2')](_0x2eafe6,_0x33cf1b);};}exports[_0x3dd8('0x3')]=function(_0x1d2b00){for(var _0x5d0abe=0x0,_0x13be02=events[_0x3dd8('0x4')];_0x5d0abe<_0x13be02;_0x5d0abe++){var _0x2b5723=events[_0x5d0abe];var _0x1f0122=createListener('chatInteraction:'+_0x2b5723,_0x1d2b00);ChatInteractionEvents['on'](_0x2b5723,_0x1f0122);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 846a09c..ec52235 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 _0x82a4=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','/:id','isChatInteractionAuthorized','attachmentDownload','/:id/messages','isAuthenticated','getMessages','getMyMessages','/:id/download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','%s-%s','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','chat','chatinteraction:addtags','addTags','chatinteraction:update','update','put','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags'];(function(_0x48df88,_0x500ded){var _0x377d1c=function(_0x381645){while(--_0x381645){_0x48df88['push'](_0x48df88['shift']());}};_0x377d1c(++_0x500ded);}(_0x82a4,0x9a));var _0x482a=function(_0x30c7e7,_0x4acce2){_0x30c7e7=_0x30c7e7-0x0;var _0x271e38=_0x82a4[_0x30c7e7];return _0x271e38;};'use strict';var multer=require(_0x482a('0x0'));var util=require(_0x482a('0x1'));var path=require('path');var timeout=require(_0x482a('0x2'));var express=require(_0x482a('0x3'));var router=express[_0x482a('0x4')]();var fs_extra=require(_0x482a('0x5'));var auth=require(_0x482a('0x6'));var interaction=require(_0x482a('0x7'));var config=require(_0x482a('0x8'));var controller=require('./chatInteraction.controller');router[_0x482a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x482a('0x9')](_0x482a('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x482a('0xb'),auth['isChatInteractionAuthorized'](),controller['show']);router['get']('/:id/attachment_download',auth[_0x482a('0xc')](),controller[_0x482a('0xd')]);router['get'](_0x482a('0xe'),auth[_0x482a('0xf')](),controller[_0x482a('0x10')]);router[_0x482a('0x9')]('/:id/my_messages',auth[_0x482a('0xc')](),controller[_0x482a('0x11')]);router['get'](_0x482a('0x12'),auth['isAuthenticated'](),controller['download']);router[_0x482a('0x13')]('/',auth[_0x482a('0xf')](),controller[_0x482a('0x14')]);router[_0x482a('0x13')](_0x482a('0x15'),auth[_0x482a('0xf')](),controller[_0x482a('0x16')]);var upload=multer({'storage':multer[_0x482a('0x17')]({'destination':function(_0x408eb0,_0x937c4e,_0x8e7592){_0x8e7592(null,path[_0x482a('0x18')](config[_0x482a('0x19')],_0x482a('0x1a')));},'filename':function(_0x4a1bb5,_0x4c1f9b,_0xf023fd){_0xf023fd(null,util['format'](_0x482a('0x1b'),Date['now'](),_0x4c1f9b['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x482a('0x1c'),upload[_0x482a('0x1d')](_0x482a('0x1e')),controller[_0x482a('0x1f')]);router[_0x482a('0x13')]('/:id/messages',auth[_0x482a('0xc')](),controller[_0x482a('0x20')]);router[_0x482a('0x13')](_0x482a('0x21'),auth[_0x482a('0xf')](),interaction['tracked'](_0x482a('0x22'),_0x482a('0x23')),controller[_0x482a('0x24')]);router['put'](_0x482a('0xb'),auth[_0x482a('0xf')](),interaction['tracked'](_0x482a('0x22'),_0x482a('0x25')),controller[_0x482a('0x26')]);router[_0x482a('0x27')](_0x482a('0x28'),controller[_0x482a('0x29')]);router[_0x482a('0x27')](_0x482a('0x2a'),auth[_0x482a('0xc')](),controller[_0x482a('0x2b')]);router[_0x482a('0x27')](_0x482a('0x2c'),controller[_0x482a('0x2d')]);router[_0x482a('0x2e')](_0x482a('0xb'),auth[_0x482a('0xf')](),interaction['tracked'](_0x482a('0x22'),_0x482a('0x2f')),controller[_0x482a('0x30')]);router[_0x482a('0x2e')](_0x482a('0x21'),auth[_0x482a('0xf')](),controller[_0x482a('0x31')]);module[_0x482a('0x32')]=router; \ No newline at end of file +var _0xceff=['%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/messages','addMessage','chat','chatinteraction:addtags','addTags','put','tracked','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','destroy','delete','/:id/tags','removeTags','connect-timeout','fs-extra','../../components/auth/service','./chatInteraction.controller','isAuthenticated','index','/describe','describe','get','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/my_messages','getMyMessages','/:id/download','download','post','join','root','server/files/attachments/','format'];(function(_0x58ada7,_0x2ec62d){var _0x3ac398=function(_0xf5d82){while(--_0xf5d82){_0x58ada7['push'](_0x58ada7['shift']());}};_0x3ac398(++_0x2ec62d);}(_0xceff,0x1d4));var _0xfcef=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xceff[_0x4d613c];return _0x301fe3;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xfcef('0x0'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xfcef('0x1'));var auth=require(_0xfcef('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfcef('0x3'));router['get']('/',auth[_0xfcef('0x4')](),controller[_0xfcef('0x5')]);router['get'](_0xfcef('0x6'),auth[_0xfcef('0x4')](),controller[_0xfcef('0x7')]);router[_0xfcef('0x8')](_0xfcef('0x9'),auth[_0xfcef('0xa')](),controller['show']);router[_0xfcef('0x8')](_0xfcef('0xb'),auth[_0xfcef('0xa')](),controller[_0xfcef('0xc')]);router[_0xfcef('0x8')]('/:id/messages',auth[_0xfcef('0x4')](),controller['getMessages']);router[_0xfcef('0x8')](_0xfcef('0xd'),auth[_0xfcef('0xa')](),controller[_0xfcef('0xe')]);router[_0xfcef('0x8')](_0xfcef('0xf'),auth[_0xfcef('0x4')](),controller[_0xfcef('0x10')]);router[_0xfcef('0x11')]('/',auth[_0xfcef('0x4')](),controller['create']);router['post']('/:id/vidaoo',auth[_0xfcef('0x4')](),controller['createVidaooSession']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3b5810,_0x30a430,_0x13ebb4){_0x13ebb4(null,path[_0xfcef('0x12')](config[_0xfcef('0x13')],_0xfcef('0x14')));},'filename':function(_0x1a8b3a,_0xd6ef3c,_0x5c1ea5){_0x5c1ea5(null,util[_0xfcef('0x15')](_0xfcef('0x16'),Date[_0xfcef('0x17')](),_0xd6ef3c[_0xfcef('0x18')][_0xfcef('0x19')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xfcef('0x1a'),upload[_0xfcef('0x1b')](_0xfcef('0x1c')),controller[_0xfcef('0x1d')]);router[_0xfcef('0x11')](_0xfcef('0x1e'),auth[_0xfcef('0xa')](),controller[_0xfcef('0x1f')]);router[_0xfcef('0x11')]('/:id/tags',auth['isAuthenticated'](),interaction['tracked'](_0xfcef('0x20'),_0xfcef('0x21')),controller[_0xfcef('0x22')]);router[_0xfcef('0x23')](_0xfcef('0x9'),auth[_0xfcef('0x4')](),interaction[_0xfcef('0x24')](_0xfcef('0x20'),_0xfcef('0x25')),controller[_0xfcef('0x26')]);router[_0xfcef('0x23')](_0xfcef('0x27'),controller[_0xfcef('0x28')]);router[_0xfcef('0x23')](_0xfcef('0x29'),auth[_0xfcef('0xa')](),controller[_0xfcef('0x2a')]);router[_0xfcef('0x23')](_0xfcef('0x2b'),controller[_0xfcef('0x2c')]);router['delete'](_0xfcef('0x9'),auth[_0xfcef('0x4')](),interaction['tracked'](_0xfcef('0x20'),'chatinteraction:destroy'),controller[_0xfcef('0x2d')]);router[_0xfcef('0x2e')](_0xfcef('0x2f'),auth[_0xfcef('0x4')](),controller[_0xfcef('0x30')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index a7de426..28883c3 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 _0x097b=['sequelize','exports','TEXT','medium','BOOLEAN','INTEGER'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x097b,0x19e));var _0xb097=function(_0x244605,_0x5a54cf){_0x244605=_0x244605-0x0;var _0x379650=_0x097b[_0x244605];return _0x379650;};'use strict';var Sequelize=require(_0xb097('0x0'));module[_0xb097('0x1')]={'body':{'type':Sequelize[_0xb097('0x2')](_0xb097('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xb097('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xb097('0x5')]}}; \ No newline at end of file +var _0x9426=['BOOLEAN','sequelize','TEXT','medium'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x9426,0x1e1));var _0x6942=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9426[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6942('0x0'));module['exports']={'body':{'type':Sequelize[_0x6942('0x1')](_0x6942('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x6942('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index e9a2e76..e5a7677 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 _0x40b6=['query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','agent','admin','user','fullname','role','internal','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','resourceId','push','FromId','ToId','read','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','localhost','register','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','save','update','then','destroy','stack','name','send','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model'];(function(_0x469665,_0x394876){var _0x291ab5=function(_0x55c1c7){while(--_0x55c1c7){_0x469665['push'](_0x469665['shift']());}};_0x291ab5(++_0x394876);}(_0x40b6,0x1dc));var _0x640b=function(_0x58999b,_0xea4695){_0x58999b=_0x58999b-0x0;var _0x5efc3a=_0x40b6[_0x58999b];return _0x5efc3a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x640b('0x0'));var zipdir=require(_0x640b('0x1'));var jsonpatch=require(_0x640b('0x2'));var rp=require(_0x640b('0x3'));var moment=require(_0x640b('0x4'));var BPromise=require(_0x640b('0x5'));var Mustache=require(_0x640b('0x6'));var util=require('util');var path=require(_0x640b('0x7'));var sox=require(_0x640b('0x8'));var csv=require('to-csv');var ejs=require(_0x640b('0x9'));var fs=require('fs');var fs_extra=require(_0x640b('0xa'));var _=require('lodash');var squel=require(_0x640b('0xb'));var crypto=require(_0x640b('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x640b('0xd'));var querystring=require(_0x640b('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x640b('0xf'));var qs=require(_0x640b('0x10'));var as=require(_0x640b('0x11'));var hardwareService=require(_0x640b('0x12'));var logger=require(_0x640b('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x640b('0x14'));var licenseUtil=require(_0x640b('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x640b('0x16')],{'host':_0x640b('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x640b('0x16')]));require('./chatInternalMessage.socket')[_0x640b('0x18')](socket);function respondWithStatusCode(_0x455d8a,_0x15d12e){_0x15d12e=_0x15d12e||0xcc;return function(_0xf249a5){if(_0xf249a5){return _0x455d8a[_0x640b('0x19')](_0x15d12e);}return _0x455d8a[_0x640b('0x1a')](_0x15d12e)[_0x640b('0x1b')]();};}function respondWithResult(_0x1880f3,_0x4d7edc){_0x4d7edc=_0x4d7edc||0xc8;return function(_0x41cde2){if(_0x41cde2){return _0x1880f3[_0x640b('0x1a')](_0x4d7edc)['json'](_0x41cde2);}};}function respondWithFilteredResult(_0x486657,_0x5c0ba0){return function(_0x456365){if(_0x456365){var _0x4b2902=typeof _0x5c0ba0[_0x640b('0x1c')]===_0x640b('0x1d')&&typeof _0x5c0ba0[_0x640b('0x1e')]===_0x640b('0x1d');var _0x57ed8c=_0x456365[_0x640b('0x1f')];var _0x24e144=_0x4b2902?0x0:_0x5c0ba0[_0x640b('0x1c')];var _0x58059e=_0x4b2902?_0x456365['count']:_0x5c0ba0[_0x640b('0x1c')]+_0x5c0ba0['limit'];var _0x15c80e;if(_0x58059e>=_0x57ed8c){_0x58059e=_0x57ed8c;_0x15c80e=0xc8;}else{_0x15c80e=0xce;}_0x486657[_0x640b('0x1a')](_0x15c80e);return _0x486657[_0x640b('0x20')]('Content-Range',_0x24e144+'-'+_0x58059e+'/'+_0x57ed8c)[_0x640b('0x21')](_0x456365);}return null;};}function patchUpdates(_0x5e98c7){return function(_0x35959b){try{jsonpatch[_0x640b('0x22')](_0x35959b,_0x5e98c7,!![]);}catch(_0x2936c1){return BPromise['reject'](_0x2936c1);}return _0x35959b[_0x640b('0x23')]();};}function saveUpdates(_0x29d12e,_0x447d29){return function(_0x764569){if(_0x764569){return _0x764569[_0x640b('0x24')](_0x29d12e)[_0x640b('0x25')](function(_0x263876){return _0x263876;});}return null;};}function removeEntity(_0x7376c8,_0x295b86){return function(_0x2a1dcf){if(_0x2a1dcf){return _0x2a1dcf[_0x640b('0x26')]()[_0x640b('0x25')](function(){_0x7376c8['status'](0xcc)[_0x640b('0x1b')]();});}};}function handleEntityNotFound(_0x50224e,_0x406678){return function(_0x15c074){if(!_0x15c074){_0x50224e[_0x640b('0x19')](0x194);}return _0x15c074;};}function handleError(_0x385700,_0x5bc411){_0x5bc411=_0x5bc411||0x1f4;return function(_0x390dd1){logger['error'](_0x390dd1[_0x640b('0x27')]);if(_0x390dd1['name']){delete _0x390dd1[_0x640b('0x28')];}_0x385700[_0x640b('0x1a')](_0x5bc411)[_0x640b('0x29')](_0x390dd1);};}exports['index']=function(_0x5f03c2,_0x1565b5){var _0x2ffdfa={},_0x5735d5={},_0x217719={'count':0x0,'rows':[]};var _0x1f4967=_[_0x640b('0x2a')](db[_0x640b('0x2b')][_0x640b('0x2c')],function(_0x2984db){return{'name':_0x2984db[_0x640b('0x2d')],'type':_0x2984db[_0x640b('0x2e')][_0x640b('0x2f')]};});_0x5735d5[_0x640b('0x30')]=_[_0x640b('0x2a')](_0x1f4967,_0x640b('0x28'));_0x5735d5[_0x640b('0x31')]=_[_0x640b('0x32')](_0x5f03c2[_0x640b('0x31')]);_0x5735d5['filters']=_[_0x640b('0x33')](_0x5735d5[_0x640b('0x30')],_0x5735d5['query']);_0x2ffdfa['attributes']=_[_0x640b('0x33')](_0x5735d5[_0x640b('0x30')],qs['fields'](_0x5f03c2[_0x640b('0x31')][_0x640b('0x34')]));_0x2ffdfa[_0x640b('0x35')]=_0x2ffdfa[_0x640b('0x35')][_0x640b('0x36')]?_0x2ffdfa[_0x640b('0x35')]:_0x5735d5['model'];if(!_0x5f03c2[_0x640b('0x31')][_0x640b('0x37')](_0x640b('0x38'))){_0x2ffdfa['limit']=qs[_0x640b('0x1e')](_0x5f03c2[_0x640b('0x31')][_0x640b('0x1e')]);_0x2ffdfa[_0x640b('0x1c')]=qs[_0x640b('0x1c')](_0x5f03c2[_0x640b('0x31')][_0x640b('0x1c')]);}_0x2ffdfa[_0x640b('0x39')]=qs[_0x640b('0x3a')](_0x5f03c2[_0x640b('0x31')]['sort']);_0x2ffdfa[_0x640b('0x3b')]=qs[_0x640b('0x3c')](_[_0x640b('0x3d')](_0x5f03c2[_0x640b('0x31')],_0x5735d5[_0x640b('0x3c')]),_0x1f4967);if(_0x5f03c2[_0x640b('0x31')]['filter']){_0x2ffdfa[_0x640b('0x3b')]=_[_0x640b('0x3e')](_0x2ffdfa[_0x640b('0x3b')],{'$or':_[_0x640b('0x2a')](_0x1f4967,function(_0x2a0072){if(_0x2a0072[_0x640b('0x2e')]!==_0x640b('0x3f')){var _0x4aeb56={};_0x4aeb56[_0x2a0072[_0x640b('0x28')]]={'$like':'%'+_0x5f03c2[_0x640b('0x31')][_0x640b('0x40')]+'%'};return _0x4aeb56;}})});}_0x2ffdfa=_[_0x640b('0x3e')]({},_0x2ffdfa,_0x5f03c2[_0x640b('0x41')]);var _0xb5c855={'where':_0x2ffdfa[_0x640b('0x3b')]};return db[_0x640b('0x2b')][_0x640b('0x1f')](_0xb5c855)['then'](function(_0x29fa59){_0x217719[_0x640b('0x1f')]=_0x29fa59;if(_0x5f03c2[_0x640b('0x31')][_0x640b('0x42')]){_0x2ffdfa[_0x640b('0x43')]=[{'all':!![]}];}return db[_0x640b('0x2b')][_0x640b('0x44')](_0x2ffdfa);})[_0x640b('0x25')](function(_0x4cc6b0){_0x217719[_0x640b('0x45')]=_0x4cc6b0;return _0x217719;})[_0x640b('0x25')](respondWithFilteredResult(_0x1565b5,_0x2ffdfa))[_0x640b('0x46')](handleError(_0x1565b5,null));};exports[_0x640b('0x47')]=function(_0x44c8ac,_0x61c4ac){var _0x3c47a1={'raw':!![],'where':{'id':_0x44c8ac[_0x640b('0x48')]['id']}},_0x36d169={};_0x36d169['model']=_[_0x640b('0x32')](db[_0x640b('0x2b')][_0x640b('0x2c')]);_0x36d169[_0x640b('0x31')]=_[_0x640b('0x32')](_0x44c8ac[_0x640b('0x31')]);_0x36d169[_0x640b('0x3c')]=_[_0x640b('0x33')](_0x36d169['model'],_0x36d169['query']);_0x3c47a1[_0x640b('0x35')]=_['intersection'](_0x36d169[_0x640b('0x30')],qs[_0x640b('0x34')](_0x44c8ac[_0x640b('0x31')][_0x640b('0x34')]));_0x3c47a1[_0x640b('0x35')]=_0x3c47a1[_0x640b('0x35')][_0x640b('0x36')]?_0x3c47a1[_0x640b('0x35')]:_0x36d169[_0x640b('0x30')];if(_0x44c8ac[_0x640b('0x31')][_0x640b('0x42')]){_0x3c47a1[_0x640b('0x43')]=[{'all':!![]}];}_0x3c47a1=_[_0x640b('0x3e')]({},_0x3c47a1,_0x44c8ac['options']);return db[_0x640b('0x2b')][_0x640b('0x49')](_0x3c47a1)[_0x640b('0x25')](handleEntityNotFound(_0x61c4ac,null))['then'](respondWithResult(_0x61c4ac,null))['catch'](handleError(_0x61c4ac,null));};exports[_0x640b('0x4a')]=function(_0x1efff2,_0x160b86){return db['ChatInternalMessage'][_0x640b('0x4a')](_0x1efff2[_0x640b('0x4b')],{})['then'](respondWithResult(_0x160b86,0xc9))['catch'](handleError(_0x160b86,null));};exports[_0x640b('0x24')]=function(_0x4db7f2,_0x4e1ad9){if(_0x4db7f2[_0x640b('0x4b')]['id']){delete _0x4db7f2[_0x640b('0x4b')]['id'];}return db[_0x640b('0x2b')][_0x640b('0x49')]({'where':{'id':_0x4db7f2[_0x640b('0x48')]['id']}})[_0x640b('0x25')](handleEntityNotFound(_0x4e1ad9,null))['then'](saveUpdates(_0x4db7f2[_0x640b('0x4b')],null))['then'](respondWithResult(_0x4e1ad9,null))[_0x640b('0x46')](handleError(_0x4e1ad9,null));};exports[_0x640b('0x26')]=function(_0x5d27d8,_0x18fb29){return db['ChatInternalMessage'][_0x640b('0x49')]({'where':{'id':_0x5d27d8[_0x640b('0x48')]['id']}})[_0x640b('0x25')](handleEntityNotFound(_0x18fb29,null))[_0x640b('0x25')](removeEntity(_0x18fb29,null))['catch'](handleError(_0x18fb29,null));};exports['describe']=function(_0x45fe39,_0x8a2f18){return db[_0x640b('0x2b')][_0x640b('0x4c')]()['then'](respondWithResult(_0x8a2f18,null))['catch'](handleError(_0x8a2f18,null));};function wrapUser(_0x1261e9){return function(_0x320d38){var _0x26623f=_0x1261e9['get']({'plain':!![]});_0x26623f[_0x640b('0x4d')]=[];if(_0x320d38){_0x26623f[_0x640b('0x4e')]=_0x320d38[_0x640b('0x4f')];_0x26623f[_0x640b('0x50')]=_0x320d38;}else{_0x26623f[_0x640b('0x4e')]=moment(0x0)[_0x640b('0x51')](_0x640b('0x52'));_0x26623f[_0x640b('0x50')]={};}return _0x26623f;};}exports['getUsers']=function(_0x56cb72,_0x1f4e7e,_0x7cc934){var _0x1b3333=[];return db['User'][_0x640b('0x44')]({'where':{'role':[_0x640b('0x53'),_0x640b('0x54'),_0x640b('0x55')]},'attributes':['id',_0x640b('0x56'),_0x640b('0x28'),_0x640b('0x57'),'userpic',_0x640b('0x58'),'online',_0x640b('0x59'),_0x640b('0x5a'),_0x640b('0x5b')],'order':qs['sort'](_0x640b('0x5c')),'include':[{'model':db[_0x640b('0x5d')],'as':'VoiceQueues','attributes':['id','name',_0x640b('0x2e')],'through':{'attributes':[]}}]})[_0x640b('0x25')](function(_0x4c845f){if(_0x4c845f){var _0x189900=_0x56cb72[_0x640b('0x55')][_0x640b('0x5e')]({'plain':!![]});if(!_0x189900)throw new Error(_0x640b('0x5f'));if(_0x189900['role']===_0x640b('0x55')){return db[_0x640b('0x60')][_0x640b('0x49')]({'where':{'name':'Agents','userProfileId':_0x189900[_0x640b('0x61')]},'raw':!![]})[_0x640b('0x25')](function(_0xb23bae){if(_0xb23bae){if(_0xb23bae[_0x640b('0x62')]===0x0){return db[_0x640b('0x63')][_0x640b('0x44')]({'where':{'sectionId':_0xb23bae['id']},'raw':!![]})['then'](function(_0x4e6bd0){var _0x1159e3=[];if(_['isEmpty'](_0x4e6bd0)){_0x1159e3=_[_0x640b('0x40')](_0x4c845f,function(_0x5ece27){if(_0x5ece27['role']!==_0x640b('0x53')){return _0x5ece27;}});return _0x1159e3;}else{for(var _0x219f5b=0x0;_0x219f5b<_0x4c845f[_0x640b('0x36')];_0x219f5b++){var _0x4db4af=_0x4c845f[_0x219f5b];if(_0x4db4af[_0x640b('0x57')]==='agent'){var _0x26e1b7=_[_0x640b('0x49')](_0x4e6bd0,function(_0x162c78){return _0x162c78[_0x640b('0x64')]===_0x4db4af['id'];});if(_0x26e1b7)_0x1159e3['push'](_0x4db4af);}else{_0x1159e3[_0x640b('0x65')](_0x4db4af);}}return _0x1159e3;}});}else{return _0x4c845f;}}else{var _0x126332=_['filter'](_0x4c845f,function(_0x2292a3){if(_0x2292a3['role']!=='agent'){return _0x2292a3;}});return _0x126332;}});}else{return _0x4c845f;}}})[_0x640b('0x25')](function(_0x4ba5f9){var _0x144d66=[];if(_0x4ba5f9){_0x1b3333=_0x4ba5f9;for(var _0x405e0c=0x0;_0x405e0c<_0x4ba5f9['length'];_0x405e0c+=0x1){_0x1b3333[_0x405e0c][_0x640b('0x4d')]=[];_0x144d66['push'](db[_0x640b('0x2b')][_0x640b('0x49')]({'where':{'FromId':[_0x56cb72[_0x640b('0x55')]['id'],_0x4ba5f9[_0x405e0c]['id']],'ToId':[_0x56cb72['user']['id'],_0x4ba5f9[_0x405e0c]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x640b('0x66'),_0x640b('0x67'),_0x640b('0x68'),'body'],'order':qs[_0x640b('0x3a')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x640b('0x25')](wrapUser(_0x4ba5f9[_0x405e0c])));}return BPromise['all'](_0x144d66);}return[];})[_0x640b('0x25')](function(_0x1b1326){return{'rows':_0x1b1326,'count':_0x1b1326['length']};})[_0x640b('0x25')](respondWithResult(_0x1f4e7e,null))[_0x640b('0x46')](handleError(_0x1f4e7e,null));}; \ No newline at end of file +var _0x9dba=['keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','type','VIRTUAL','merge','options','ChatInternalMessage','includeAll','include','findAll','show','params','find','catch','create','body','describe','get','lastMessageAt','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','User','admin','user','fullname','userpic','internal','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','role','Agents','userProfileId','UserProfileResource','isEmpty','agent','resourceId','push','FromId','ToId','sort','-createdAt','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','key','query'];(function(_0x2ca9d4,_0x51d5c6){var _0x258956=function(_0x47a0e5){while(--_0x47a0e5){_0x2ca9d4['push'](_0x2ca9d4['shift']());}};_0x258956(++_0x51d5c6);}(_0x9dba,0x172));var _0xa9db=function(_0xd088c0,_0x11d3c3){_0xd088c0=_0xd088c0-0x0;var _0x9e9ed2=_0x9dba[_0xd088c0];return _0x9e9ed2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa9db('0x0'));var zipdir=require(_0xa9db('0x1'));var jsonpatch=require(_0xa9db('0x2'));var rp=require(_0xa9db('0x3'));var moment=require(_0xa9db('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa9db('0x5'));var util=require(_0xa9db('0x6'));var path=require('path');var sox=require(_0xa9db('0x7'));var csv=require(_0xa9db('0x8'));var ejs=require(_0xa9db('0x9'));var fs=require('fs');var fs_extra=require(_0xa9db('0xa'));var _=require('lodash');var squel=require(_0xa9db('0xb'));var crypto=require(_0xa9db('0xc'));var jsforce=require(_0xa9db('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa9db('0xe'));var Papa=require(_0xa9db('0xf'));var Redis=require('ioredis');var authService=require(_0xa9db('0x10'));var qs=require(_0xa9db('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9db('0x12'))(_0xa9db('0x13'));var utils=require(_0xa9db('0x14'));var config=require(_0xa9db('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa9db('0x16'))['db'];config['redis']=_[_0xa9db('0x17')](config[_0xa9db('0x18')],{'host':_0xa9db('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa9db('0x18')]));require(_0xa9db('0x1a'))[_0xa9db('0x1b')](socket);function respondWithStatusCode(_0x5ee090,_0x105699){_0x105699=_0x105699||0xcc;return function(_0x5d9113){if(_0x5d9113){return _0x5ee090[_0xa9db('0x1c')](_0x105699);}return _0x5ee090[_0xa9db('0x1d')](_0x105699)[_0xa9db('0x1e')]();};}function respondWithResult(_0x6fb86b,_0x419fa2){_0x419fa2=_0x419fa2||0xc8;return function(_0x297dfb){if(_0x297dfb){return _0x6fb86b[_0xa9db('0x1d')](_0x419fa2)[_0xa9db('0x1f')](_0x297dfb);}};}function respondWithFilteredResult(_0x5a4f79,_0x326031){return function(_0x2ab314){if(_0x2ab314){var _0x401422=typeof _0x326031[_0xa9db('0x20')]===_0xa9db('0x21')&&typeof _0x326031[_0xa9db('0x22')]===_0xa9db('0x21');var _0x13f6ad=_0x2ab314[_0xa9db('0x23')];var _0x3624c1=_0x401422?0x0:_0x326031[_0xa9db('0x20')];var _0x268d74=_0x401422?_0x2ab314['count']:_0x326031[_0xa9db('0x20')]+_0x326031[_0xa9db('0x22')];var _0x858d90;if(_0x268d74>=_0x13f6ad){_0x268d74=_0x13f6ad;_0x858d90=0xc8;}else{_0x858d90=0xce;}_0x5a4f79[_0xa9db('0x1d')](_0x858d90);return _0x5a4f79[_0xa9db('0x24')](_0xa9db('0x25'),_0x3624c1+'-'+_0x268d74+'/'+_0x13f6ad)[_0xa9db('0x1f')](_0x2ab314);}return null;};}function patchUpdates(_0x1743c0){return function(_0x413476){try{jsonpatch['apply'](_0x413476,_0x1743c0,!![]);}catch(_0x2f5e25){return BPromise['reject'](_0x2f5e25);}return _0x413476['save']();};}function saveUpdates(_0x1ed652,_0x31e555){return function(_0x4e605c){if(_0x4e605c){return _0x4e605c[_0xa9db('0x26')](_0x1ed652)[_0xa9db('0x27')](function(_0x31ac5e){return _0x31ac5e;});}return null;};}function removeEntity(_0x227475,_0x50ae28){return function(_0xe4b46a){if(_0xe4b46a){return _0xe4b46a[_0xa9db('0x28')]()[_0xa9db('0x27')](function(){_0x227475['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x40754c,_0x3f6bc0){return function(_0x5d028d){if(!_0x5d028d){_0x40754c[_0xa9db('0x1c')](0x194);}return _0x5d028d;};}function handleError(_0x13a4cc,_0x2661be){_0x2661be=_0x2661be||0x1f4;return function(_0x4c288f){logger[_0xa9db('0x29')](_0x4c288f[_0xa9db('0x2a')]);if(_0x4c288f[_0xa9db('0x2b')]){delete _0x4c288f['name'];}_0x13a4cc[_0xa9db('0x1d')](_0x2661be)[_0xa9db('0x2c')](_0x4c288f);};}exports['index']=function(_0x2ede4d,_0x2d9eaf){var _0x20802a={},_0x4d509c={},_0x374599={'count':0x0,'rows':[]};var _0x5a6ba9=_[_0xa9db('0x2d')](db['ChatInternalMessage'][_0xa9db('0x2e')],function(_0x1154e5){return{'name':_0x1154e5[_0xa9db('0x2f')],'type':_0x1154e5['type'][_0xa9db('0x30')]};});_0x4d509c['model']=_[_0xa9db('0x2d')](_0x5a6ba9,_0xa9db('0x2b'));_0x4d509c[_0xa9db('0x31')]=_[_0xa9db('0x32')](_0x2ede4d['query']);_0x4d509c[_0xa9db('0x33')]=_[_0xa9db('0x34')](_0x4d509c[_0xa9db('0x35')],_0x4d509c[_0xa9db('0x31')]);_0x20802a[_0xa9db('0x36')]=_['intersection'](_0x4d509c[_0xa9db('0x35')],qs[_0xa9db('0x37')](_0x2ede4d[_0xa9db('0x31')]['fields']));_0x20802a[_0xa9db('0x36')]=_0x20802a[_0xa9db('0x36')][_0xa9db('0x38')]?_0x20802a['attributes']:_0x4d509c[_0xa9db('0x35')];if(!_0x2ede4d['query'][_0xa9db('0x39')](_0xa9db('0x3a'))){_0x20802a['limit']=qs[_0xa9db('0x22')](_0x2ede4d[_0xa9db('0x31')]['limit']);_0x20802a[_0xa9db('0x20')]=qs[_0xa9db('0x20')](_0x2ede4d[_0xa9db('0x31')][_0xa9db('0x20')]);}_0x20802a[_0xa9db('0x3b')]=qs['sort'](_0x2ede4d[_0xa9db('0x31')]['sort']);_0x20802a[_0xa9db('0x3c')]=qs[_0xa9db('0x33')](_['pick'](_0x2ede4d['query'],_0x4d509c[_0xa9db('0x33')]),_0x5a6ba9);if(_0x2ede4d['query'][_0xa9db('0x3d')]){_0x20802a['where']=_['merge'](_0x20802a[_0xa9db('0x3c')],{'$or':_[_0xa9db('0x2d')](_0x5a6ba9,function(_0x10feee){if(_0x10feee[_0xa9db('0x3e')]!==_0xa9db('0x3f')){var _0x1a1c80={};_0x1a1c80[_0x10feee[_0xa9db('0x2b')]]={'$like':'%'+_0x2ede4d['query']['filter']+'%'};return _0x1a1c80;}})});}_0x20802a=_[_0xa9db('0x40')]({},_0x20802a,_0x2ede4d[_0xa9db('0x41')]);var _0x1480b2={'where':_0x20802a['where']};return db[_0xa9db('0x42')][_0xa9db('0x23')](_0x1480b2)[_0xa9db('0x27')](function(_0x73e82a){_0x374599[_0xa9db('0x23')]=_0x73e82a;if(_0x2ede4d[_0xa9db('0x31')][_0xa9db('0x43')]){_0x20802a[_0xa9db('0x44')]=[{'all':!![]}];}return db[_0xa9db('0x42')][_0xa9db('0x45')](_0x20802a);})[_0xa9db('0x27')](function(_0x6805d){_0x374599['rows']=_0x6805d;return _0x374599;})[_0xa9db('0x27')](respondWithFilteredResult(_0x2d9eaf,_0x20802a))['catch'](handleError(_0x2d9eaf,null));};exports[_0xa9db('0x46')]=function(_0x222d98,_0x3869ac){var _0x2a7db7={'raw':!![],'where':{'id':_0x222d98[_0xa9db('0x47')]['id']}},_0x3f8339={};_0x3f8339[_0xa9db('0x35')]=_[_0xa9db('0x32')](db['ChatInternalMessage'][_0xa9db('0x2e')]);_0x3f8339[_0xa9db('0x31')]=_['keys'](_0x222d98[_0xa9db('0x31')]);_0x3f8339['filters']=_[_0xa9db('0x34')](_0x3f8339[_0xa9db('0x35')],_0x3f8339[_0xa9db('0x31')]);_0x2a7db7[_0xa9db('0x36')]=_[_0xa9db('0x34')](_0x3f8339[_0xa9db('0x35')],qs[_0xa9db('0x37')](_0x222d98[_0xa9db('0x31')][_0xa9db('0x37')]));_0x2a7db7[_0xa9db('0x36')]=_0x2a7db7['attributes'][_0xa9db('0x38')]?_0x2a7db7[_0xa9db('0x36')]:_0x3f8339['model'];if(_0x222d98['query'][_0xa9db('0x43')]){_0x2a7db7[_0xa9db('0x44')]=[{'all':!![]}];}_0x2a7db7=_[_0xa9db('0x40')]({},_0x2a7db7,_0x222d98[_0xa9db('0x41')]);return db['ChatInternalMessage'][_0xa9db('0x48')](_0x2a7db7)[_0xa9db('0x27')](handleEntityNotFound(_0x3869ac,null))[_0xa9db('0x27')](respondWithResult(_0x3869ac,null))[_0xa9db('0x49')](handleError(_0x3869ac,null));};exports['create']=function(_0x393413,_0x29e784){return db[_0xa9db('0x42')][_0xa9db('0x4a')](_0x393413[_0xa9db('0x4b')],{})['then'](respondWithResult(_0x29e784,0xc9))[_0xa9db('0x49')](handleError(_0x29e784,null));};exports[_0xa9db('0x26')]=function(_0x55e906,_0x2bfa2f){if(_0x55e906[_0xa9db('0x4b')]['id']){delete _0x55e906[_0xa9db('0x4b')]['id'];}return db[_0xa9db('0x42')][_0xa9db('0x48')]({'where':{'id':_0x55e906[_0xa9db('0x47')]['id']}})[_0xa9db('0x27')](handleEntityNotFound(_0x2bfa2f,null))[_0xa9db('0x27')](saveUpdates(_0x55e906[_0xa9db('0x4b')],null))[_0xa9db('0x27')](respondWithResult(_0x2bfa2f,null))[_0xa9db('0x49')](handleError(_0x2bfa2f,null));};exports[_0xa9db('0x28')]=function(_0xd45944,_0x16b45a){return db[_0xa9db('0x42')][_0xa9db('0x48')]({'where':{'id':_0xd45944[_0xa9db('0x47')]['id']}})[_0xa9db('0x27')](handleEntityNotFound(_0x16b45a,null))['then'](removeEntity(_0x16b45a,null))['catch'](handleError(_0x16b45a,null));};exports[_0xa9db('0x4c')]=function(_0x4a6e06,_0x195762){return db[_0xa9db('0x42')]['describe']()[_0xa9db('0x27')](respondWithResult(_0x195762,null))[_0xa9db('0x49')](handleError(_0x195762,null));};function wrapUser(_0x1c5be7){return function(_0x48cff7){var _0x255afb=_0x1c5be7[_0xa9db('0x4d')]({'plain':!![]});_0x255afb['messages']=[];if(_0x48cff7){_0x255afb[_0xa9db('0x4e')]=_0x48cff7[_0xa9db('0x4f')];_0x255afb[_0xa9db('0x50')]=_0x48cff7;}else{_0x255afb['lastMessageAt']=moment(0x0)['format'](_0xa9db('0x51'));_0x255afb[_0xa9db('0x50')]={};}return _0x255afb;};}exports['getUsers']=function(_0x12e20f,_0x510cfe,_0x2f0dde){var _0x1d6b6b=[];return db[_0xa9db('0x52')]['findAll']({'where':{'role':['agent',_0xa9db('0x53'),_0xa9db('0x54')]},'attributes':['id',_0xa9db('0x55'),_0xa9db('0x2b'),'role',_0xa9db('0x56'),_0xa9db('0x57'),'online','lastLoginAt',_0xa9db('0x58'),_0xa9db('0x59')],'order':qs['sort'](_0xa9db('0x5a')),'include':[{'model':db[_0xa9db('0x5b')],'as':_0xa9db('0x5c'),'attributes':['id',_0xa9db('0x2b'),_0xa9db('0x3e')],'through':{'attributes':[]}}]})[_0xa9db('0x27')](function(_0x2f67b4){if(_0x2f67b4){var _0x52f842=_0x12e20f['user']['get']({'plain':!![]});if(!_0x52f842)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x52f842[_0xa9db('0x5d')]===_0xa9db('0x54')){return db['UserProfileSection'][_0xa9db('0x48')]({'where':{'name':_0xa9db('0x5e'),'userProfileId':_0x52f842[_0xa9db('0x5f')]},'raw':!![]})[_0xa9db('0x27')](function(_0x25e1ad){if(_0x25e1ad){if(_0x25e1ad['autoAssociation']===0x0){return db[_0xa9db('0x60')][_0xa9db('0x45')]({'where':{'sectionId':_0x25e1ad['id']},'raw':!![]})['then'](function(_0x5f1656){var _0x5b7cdc=[];if(_[_0xa9db('0x61')](_0x5f1656)){_0x5b7cdc=_[_0xa9db('0x3d')](_0x2f67b4,function(_0x48fef9){if(_0x48fef9['role']!==_0xa9db('0x62')){return _0x48fef9;}});return _0x5b7cdc;}else{for(var _0x15bcec=0x0;_0x15bcec<_0x2f67b4['length'];_0x15bcec++){var _0x4d0400=_0x2f67b4[_0x15bcec];if(_0x4d0400['role']===_0xa9db('0x62')){var _0x2e0534=_[_0xa9db('0x48')](_0x5f1656,function(_0x5e8d7e){return _0x5e8d7e[_0xa9db('0x63')]===_0x4d0400['id'];});if(_0x2e0534)_0x5b7cdc[_0xa9db('0x64')](_0x4d0400);}else{_0x5b7cdc['push'](_0x4d0400);}}return _0x5b7cdc;}});}else{return _0x2f67b4;}}else{var _0x1dcb5d=_[_0xa9db('0x3d')](_0x2f67b4,function(_0x52fbf7){if(_0x52fbf7[_0xa9db('0x5d')]!=='agent'){return _0x52fbf7;}});return _0x1dcb5d;}});}else{return _0x2f67b4;}}})[_0xa9db('0x27')](function(_0x55e285){var _0x26975e=[];if(_0x55e285){_0x1d6b6b=_0x55e285;for(var _0x38a04f=0x0;_0x38a04f<_0x55e285[_0xa9db('0x38')];_0x38a04f+=0x1){_0x1d6b6b[_0x38a04f]['messages']=[];_0x26975e[_0xa9db('0x64')](db['ChatInternalMessage']['find']({'where':{'FromId':[_0x12e20f[_0xa9db('0x54')]['id'],_0x55e285[_0x38a04f]['id']],'ToId':[_0x12e20f[_0xa9db('0x54')]['id'],_0x55e285[_0x38a04f]['id']],'ChatGroupId':null},'attributes':['id',_0xa9db('0x4f'),_0xa9db('0x65'),_0xa9db('0x66'),'read','body'],'order':qs[_0xa9db('0x67')](_0xa9db('0x68')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xa9db('0x27')](wrapUser(_0x55e285[_0x38a04f])));}return BPromise['all'](_0x26975e);}return[];})['then'](function(_0x54d10f){return{'rows':_0x54d10f,'count':_0x54d10f[_0xa9db('0x38')]};})['then'](respondWithResult(_0x510cfe,null))[_0xa9db('0x49')](handleError(_0x510cfe,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index fe54d19..e0b1e73 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 _0x8eb3=['save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x185182,_0x5d4736){var _0x1d235e=function(_0x157a96){while(--_0x157a96){_0x185182['push'](_0x185182['shift']());}};_0x1d235e(++_0x5d4736);}(_0x8eb3,0x8b));var _0x38eb=function(_0x26ecfa,_0x59ca40){_0x26ecfa=_0x26ecfa-0x0;var _0x2ee323=_0x8eb3[_0x26ecfa];return _0x2ee323;};'use strict';var EventEmitter=require(_0x38eb('0x0'));var ChatInternalMessage=require('../../mysqldb')['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x38eb('0x1'),'afterUpdate':_0x38eb('0x2'),'afterDestroy':_0x38eb('0x3')};function emitEvent(_0x235b87){return function(_0x499f4c,_0x2f72aa,_0x405c62){ChatInternalMessageEvents[_0x38eb('0x4')](_0x235b87+':'+_0x499f4c['id'],_0x499f4c);ChatInternalMessageEvents[_0x38eb('0x4')](_0x235b87,_0x499f4c);_0x405c62(null);};}for(var e in events){if(events[_0x38eb('0x5')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x38eb('0x6')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x050d=['hook','exports','events','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x18d3d2,_0x48809e){var _0x582ee2=function(_0xf047f9){while(--_0xf047f9){_0x18d3d2['push'](_0x18d3d2['shift']());}};_0x582ee2(++_0x48809e);}(_0x050d,0x11a));var _0xd050=function(_0x2f32ec,_0x5711b6){_0x2f32ec=_0x2f32ec-0x0;var _0x6b7008=_0x050d[_0x2f32ec];return _0x6b7008;};'use strict';var EventEmitter=require(_0xd050('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0xd050('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xd050('0x2')](0x0);var events={'afterCreate':_0xd050('0x3'),'afterUpdate':_0xd050('0x4'),'afterDestroy':_0xd050('0x5')};function emitEvent(_0x543a99){return function(_0x1f88a0,_0x59b98c,_0x4b22ee){ChatInternalMessageEvents[_0xd050('0x6')](_0x543a99+':'+_0x1f88a0['id'],_0x1f88a0);ChatInternalMessageEvents[_0xd050('0x6')](_0x543a99,_0x1f88a0);_0x4b22ee(null);};}for(var e in events){if(events[_0xd050('0x7')](e)){var event=events[e];ChatInternalMessage[_0xd050('0x8')](e,emitEvent(event));}}module[_0xd050('0x9')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 29f6fbe..01ec653 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 _0x7648=['api','moment','bluebird','path','rimraf','../../config/environment','./chatInternalMessage.attributes','define','ChatInternalMessage','chat_internal_messages','utf8mb4','lodash','util','../../config/logger'];(function(_0x309bc1,_0x580f7c){var _0x89876=function(_0x3b7b52){while(--_0x3b7b52){_0x309bc1['push'](_0x309bc1['shift']());}};_0x89876(++_0x580f7c);}(_0x7648,0x1bd));var _0x8764=function(_0x35980d,_0xf1fec9){_0x35980d=_0x35980d-0x0;var _0xe865ec=_0x7648[_0x35980d];return _0xe865ec;};'use strict';var _=require(_0x8764('0x0'));var util=require(_0x8764('0x1'));var logger=require(_0x8764('0x2'))(_0x8764('0x3'));var moment=require(_0x8764('0x4'));var BPromise=require(_0x8764('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8764('0x6'));var rimraf=require(_0x8764('0x7'));var config=require(_0x8764('0x8'));var attributes=require(_0x8764('0x9'));module['exports']=function(_0xd6df37,_0x23c7b2){return _0xd6df37[_0x8764('0xa')](_0x8764('0xb'),attributes,{'tableName':_0x8764('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8764('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6a31=['moment','request-promise','path','./chatInternalMessage.attributes','exports','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x6a31,0x8c));var _0x16a3=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x6a31[_0x58dc25];return _0x21b0a7;};'use strict';var _=require(_0x16a3('0x0'));var util=require(_0x16a3('0x1'));var logger=require(_0x16a3('0x2'))(_0x16a3('0x3'));var moment=require(_0x16a3('0x4'));var BPromise=require('bluebird');var rp=require(_0x16a3('0x5'));var fs=require('fs');var path=require(_0x16a3('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x16a3('0x7'));module[_0x16a3('0x8')]=function(_0x271cca,_0x5b08ce){return _0x271cca['define']('ChatInternalMessage',attributes,{'tableName':_0x16a3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x16a3('0xa'),'collate':_0x16a3('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 3f03dbb..91dc67d 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 _0x76b9=['stringify','error','code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./chatInternalMessage.socket','request','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s'];(function(_0x38accc,_0x4b92df){var _0x5ee815=function(_0x477000){while(--_0x477000){_0x38accc['push'](_0x38accc['shift']());}};_0x5ee815(++_0x4b92df);}(_0x76b9,0x12f));var _0x976b=function(_0xa7c2b4,_0x451a6b){_0xa7c2b4=_0xa7c2b4-0x0;var _0x165e16=_0x76b9[_0xa7c2b4];return _0x165e16;};'use strict';var _=require('lodash');var util=require(_0x976b('0x0'));var moment=require(_0x976b('0x1'));var BPromise=require(_0x976b('0x2'));var rs=require(_0x976b('0x3'));var fs=require('fs');var Redis=require(_0x976b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x976b('0x5'));var logger=require(_0x976b('0x6'))(_0x976b('0x7'));var config=require(_0x976b('0x8'));var jayson=require(_0x976b('0x9'));var client=jayson['client'][_0x976b('0xa')]({'port':0x232a});config['redis']=_[_0x976b('0xb')](config['redis'],{'host':_0x976b('0xc'),'port':0x18eb});var socket=require(_0x976b('0xd'))(new Redis(config[_0x976b('0xe')]));require(_0x976b('0xf'))['register'](socket);function respondWithRpcPromise(_0x3fe685,_0x1fca5b,_0xc23000){return new BPromise(function(_0xccedc5,_0x3193b4){return client[_0x976b('0x10')](_0x3fe685,_0xc23000)['then'](function(_0x2d0d4b){logger['info'](_0x976b('0x11'),_0x1fca5b,_0x976b('0x12'));logger[_0x976b('0x13')](_0x976b('0x14'),_0x1fca5b,_0x976b('0x12'),JSON[_0x976b('0x15')](_0x2d0d4b));if(_0x2d0d4b[_0x976b('0x16')]){if(_0x2d0d4b[_0x976b('0x16')][_0x976b('0x17')]===0x1f4){logger[_0x976b('0x16')](_0x976b('0x11'),_0x1fca5b,_0x2d0d4b[_0x976b('0x16')][_0x976b('0x18')]);return _0x3193b4(_0x2d0d4b[_0x976b('0x16')]['message']);}logger[_0x976b('0x16')](_0x976b('0x11'),_0x1fca5b,_0x2d0d4b[_0x976b('0x16')]['message']);return _0xccedc5(_0x2d0d4b['error']['message']);}else{logger[_0x976b('0x19')](_0x976b('0x11'),_0x1fca5b,'request\x20sent');_0xccedc5(_0x2d0d4b['result'][_0x976b('0x18')]);}})[_0x976b('0x1a')](function(_0x31340e){logger['error'](_0x976b('0x11'),_0x1fca5b,_0x31340e);_0x3193b4(_0x31340e);});});} \ No newline at end of file +var _0x1ff8=['jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0x2a7c2a,_0x37cc9e){var _0x195732=function(_0x4d3902){while(--_0x4d3902){_0x2a7c2a['push'](_0x2a7c2a['shift']());}};_0x195732(++_0x37cc9e);}(_0x1ff8,0x154));var _0x81ff=function(_0xbc346f,_0x3db5c0){_0xbc346f=_0xbc346f-0x0;var _0x9f9260=_0x1ff8[_0xbc346f];return _0x9f9260;};'use strict';var _=require(_0x81ff('0x0'));var util=require('util');var moment=require(_0x81ff('0x1'));var BPromise=require(_0x81ff('0x2'));var rs=require(_0x81ff('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x81ff('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x81ff('0x5'));var client=jayson['client'][_0x81ff('0x6')]({'port':0x232a});config['redis']=_[_0x81ff('0x7')](config[_0x81ff('0x8')],{'host':_0x81ff('0x9'),'port':0x18eb});var socket=require(_0x81ff('0xa'))(new Redis(config['redis']));require(_0x81ff('0xb'))[_0x81ff('0xc')](socket);function respondWithRpcPromise(_0x2457bf,_0x191557,_0x32a2d8){return new BPromise(function(_0x3f474a,_0x27e016){return client[_0x81ff('0xd')](_0x2457bf,_0x32a2d8)[_0x81ff('0xe')](function(_0x16a912){logger[_0x81ff('0xf')](_0x81ff('0x10'),_0x191557,_0x81ff('0x11'));logger[_0x81ff('0x12')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x191557,_0x81ff('0x11'),JSON['stringify'](_0x16a912));if(_0x16a912[_0x81ff('0x13')]){if(_0x16a912[_0x81ff('0x13')]['code']===0x1f4){logger[_0x81ff('0x13')](_0x81ff('0x10'),_0x191557,_0x16a912[_0x81ff('0x13')][_0x81ff('0x14')]);return _0x27e016(_0x16a912[_0x81ff('0x13')][_0x81ff('0x14')]);}logger[_0x81ff('0x13')](_0x81ff('0x10'),_0x191557,_0x16a912[_0x81ff('0x13')][_0x81ff('0x14')]);return _0x3f474a(_0x16a912[_0x81ff('0x13')][_0x81ff('0x14')]);}else{logger['info'](_0x81ff('0x10'),_0x191557,_0x81ff('0x11'));_0x3f474a(_0x16a912[_0x81ff('0x15')][_0x81ff('0x14')]);}})[_0x81ff('0x16')](function(_0x2da365){logger['error'](_0x81ff('0x10'),_0x191557,_0x2da365);_0x27e016(_0x2da365);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index aba6e76..89252c3 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 _0x98d4=['removeListener','register','length','./chatInternalMessage.events','save','remove','update','emit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x98d4,0xd3));var _0x498d=function(_0x38cd94,_0x28b7ba){_0x38cd94=_0x38cd94-0x0;var _0x21d210=_0x98d4[_0x38cd94];return _0x21d210;};'use strict';var ChatInternalMessageEvents=require(_0x498d('0x0'));var events=[_0x498d('0x1'),_0x498d('0x2'),_0x498d('0x3')];function createListener(_0x163052,_0x25ef28){return function(_0x78f9fa){_0x25ef28[_0x498d('0x4')](_0x163052,_0x78f9fa);};}function removeListener(_0x23a80c,_0x196e78){return function(){ChatInternalMessageEvents[_0x498d('0x5')](_0x23a80c,_0x196e78);};}exports[_0x498d('0x6')]=function(_0x37de25){for(var _0x51b8d0=0x0,_0x21be3d=events[_0x498d('0x7')];_0x51b8d0<_0x21be3d;_0x51b8d0++){var _0x1b8b98=events[_0x51b8d0];var _0x364708=createListener('chatInternalMessage:'+_0x1b8b98,_0x37de25);ChatInternalMessageEvents['on'](_0x1b8b98,_0x364708);}}; \ No newline at end of file +var _0x706f=['removeListener','register','./chatInternalMessage.events','update','emit'];(function(_0x137686,_0x3a49f5){var _0x26658f=function(_0x4e59eb){while(--_0x4e59eb){_0x137686['push'](_0x137686['shift']());}};_0x26658f(++_0x3a49f5);}(_0x706f,0x1f1));var _0xf706=function(_0x1358cf,_0x329933){_0x1358cf=_0x1358cf-0x0;var _0x1b0344=_0x706f[_0x1358cf];return _0x1b0344;};'use strict';var ChatInternalMessageEvents=require(_0xf706('0x0'));var events=['save','remove',_0xf706('0x1')];function createListener(_0x4f4173,_0x27e482){return function(_0xcef240){_0x27e482[_0xf706('0x2')](_0x4f4173,_0xcef240);};}function removeListener(_0x4d8620,_0x4ad7a8){return function(){ChatInternalMessageEvents[_0xf706('0x3')](_0x4d8620,_0x4ad7a8);};}exports[_0xf706('0x4')]=function(_0x10b69c){for(var _0x1eb09c=0x0,_0x5128de=events['length'];_0x1eb09c<_0x5128de;_0x1eb09c++){var _0x3512f3=events[_0x1eb09c];var _0x4d4b84=createListener('chatInternalMessage:'+_0x3512f3,_0x10b69c);ChatInternalMessageEvents['on'](_0x3512f3,_0x4d4b84);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 4771366..6d8a15e 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 _0x12db=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./chatInternalMessage.controller','get','index','/describe','isAuthenticated','describe','getUsers','/:id','show','post'];(function(_0x14766d,_0x5282d4){var _0x4890e6=function(_0x5c95e4){while(--_0x5c95e4){_0x14766d['push'](_0x14766d['shift']());}};_0x4890e6(++_0x5282d4);}(_0x12db,0x15f));var _0xb12d=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x12db[_0x139a3c];return _0x2b375b;};'use strict';var multer=require(_0xb12d('0x0'));var util=require(_0xb12d('0x1'));var path=require(_0xb12d('0x2'));var timeout=require(_0xb12d('0x3'));var express=require(_0xb12d('0x4'));var router=express['Router']();var fs_extra=require(_0xb12d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb12d('0x6'));var config=require('../../config/environment');var controller=require(_0xb12d('0x7'));router[_0xb12d('0x8')]('/',auth['isAuthenticated'](),controller[_0xb12d('0x9')]);router[_0xb12d('0x8')](_0xb12d('0xa'),auth[_0xb12d('0xb')](),controller[_0xb12d('0xc')]);router[_0xb12d('0x8')]('/users',auth['isAuthenticated'](),controller[_0xb12d('0xd')]);router[_0xb12d('0x8')](_0xb12d('0xe'),auth[_0xb12d('0xb')](),controller[_0xb12d('0xf')]);router[_0xb12d('0x10')]('/',auth['isAuthenticated'](),controller[_0xb12d('0x11')]);router[_0xb12d('0x12')](_0xb12d('0xe'),controller[_0xb12d('0x13')]);router[_0xb12d('0x14')](_0xb12d('0xe'),auth[_0xb12d('0xb')](),controller[_0xb12d('0x15')]);module[_0xb12d('0x16')]=router; \ No newline at end of file +var _0x6f88=['/:id','show','post','create','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','getUsers'];(function(_0x59aa15,_0x197977){var _0xd26111=function(_0x314fc5){while(--_0x314fc5){_0x59aa15['push'](_0x59aa15['shift']());}};_0xd26111(++_0x197977);}(_0x6f88,0x179));var _0x86f8=function(_0x8356d3,_0xf3f07a){_0x8356d3=_0x8356d3-0x0;var _0x45add1=_0x6f88[_0x8356d3];return _0x45add1;};'use strict';var multer=require(_0x86f8('0x0'));var util=require('util');var path=require(_0x86f8('0x1'));var timeout=require('connect-timeout');var express=require(_0x86f8('0x2'));var router=express[_0x86f8('0x3')]();var fs_extra=require(_0x86f8('0x4'));var auth=require(_0x86f8('0x5'));var interaction=require(_0x86f8('0x6'));var config=require(_0x86f8('0x7'));var controller=require('./chatInternalMessage.controller');router[_0x86f8('0x8')]('/',auth[_0x86f8('0x9')](),controller[_0x86f8('0xa')]);router[_0x86f8('0x8')](_0x86f8('0xb'),auth[_0x86f8('0x9')](),controller[_0x86f8('0xc')]);router['get']('/users',auth['isAuthenticated'](),controller[_0x86f8('0xd')]);router[_0x86f8('0x8')](_0x86f8('0xe'),auth['isAuthenticated'](),controller[_0x86f8('0xf')]);router[_0x86f8('0x10')]('/',auth[_0x86f8('0x9')](),controller[_0x86f8('0x11')]);router[_0x86f8('0x12')]('/:id',controller[_0x86f8('0x13')]);router[_0x86f8('0x14')](_0x86f8('0xe'),auth['isAuthenticated'](),controller[_0x86f8('0x15')]);module[_0x86f8('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 17ec718..86e9d7b 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 _0x7072=['exports','TEXT','medium','BOOLEAN','out','STRING'];(function(_0x260696,_0x1fdb6a){var _0x2ef493=function(_0x58b7e0){while(--_0x58b7e0){_0x260696['push'](_0x260696['shift']());}};_0x2ef493(++_0x1fdb6a);}(_0x7072,0x138));var _0x2707=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x7072[_0x54d4a8];return _0x3b321b;};'use strict';var Sequelize=require('sequelize');module[_0x2707('0x0')]={'body':{'type':Sequelize[_0x2707('0x1')](_0x2707('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x2707('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x2707('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x2707('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x2707('0x5')]},'providerResponse':{'type':Sequelize[_0x2707('0x1')]}}; \ No newline at end of file +var _0x531a=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x2831f0,_0x278c7a){var _0x289f38=function(_0x1cf4fb){while(--_0x1cf4fb){_0x2831f0['push'](_0x2831f0['shift']());}};_0x289f38(++_0x278c7a);}(_0x531a,0x100));var _0xa531=function(_0x2e9ded,_0x235e2b){_0x2e9ded=_0x2e9ded-0x0;var _0xc88a61=_0x531a[_0x2e9ded];return _0xc88a61;};'use strict';var Sequelize=require(_0xa531('0x0'));module[_0xa531('0x1')]={'body':{'type':Sequelize[_0xa531('0x2')](_0xa531('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xa531('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xa531('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa531('0x5')]('in',_0xa531('0x6')),'defaultValue':_0xa531('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xa531('0x7')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xa531('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index b18d8b3..9364cb3 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 _0x5c5f=['read','readAt','format','UserId','user','get','ChatInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','agent','manual','interface','channel','EventManager','parse','formData','reject','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','ContactId','User','internal','motionChannel','event','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','http','client','request','then','ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','stack','name','index','map','ChatMessage','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','show','fields','options','find','body','params','describe','chat-interactions','accept','chat'];(function(_0x2041a2,_0x713d3e){var _0xeddfd2=function(_0x4e6809){while(--_0x4e6809){_0x2041a2['push'](_0x2041a2['shift']());}};_0xeddfd2(++_0x713d3e);}(_0x5c5f,0xab));var _0xf5c5=function(_0x2e797e,_0x1b2d11){_0x2e797e=_0x2e797e-0x0;var _0x12a46b=_0x5c5f[_0x2e797e];return _0x12a46b;};'use strict';var emlformat=require(_0xf5c5('0x0'));var rimraf=require(_0xf5c5('0x1'));var zipdir=require(_0xf5c5('0x2'));var jsonpatch=require(_0xf5c5('0x3'));var rp=require(_0xf5c5('0x4'));var moment=require(_0xf5c5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf5c5('0x6'));var util=require(_0xf5c5('0x7'));var path=require(_0xf5c5('0x8'));var sox=require('sox');var csv=require(_0xf5c5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf5c5('0xa'));var _=require(_0xf5c5('0xb'));var squel=require(_0xf5c5('0xc'));var crypto=require('crypto');var jsforce=require(_0xf5c5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf5c5('0x9'));var querystring=require(_0xf5c5('0xe'));var Papa=require('papaparse');var Redis=require(_0xf5c5('0xf'));var authService=require(_0xf5c5('0x10'));var qs=require(_0xf5c5('0x11'));var as=require(_0xf5c5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf5c5('0x13'))(_0xf5c5('0x14'));var utils=require(_0xf5c5('0x15'));var config=require(_0xf5c5('0x16'));var licenseUtil=require(_0xf5c5('0x17'));var db=require(_0xf5c5('0x18'))['db'];config[_0xf5c5('0x19')]=_['defaults'](config['redis'],{'host':_0xf5c5('0x1a'),'port':0x18eb});var socket=require(_0xf5c5('0x1b'))(new Redis(config[_0xf5c5('0x19')]));require(_0xf5c5('0x1c'))[_0xf5c5('0x1d')](socket);var jayson=require(_0xf5c5('0x1e'));var client=jayson['client'][_0xf5c5('0x1f')]({'port':0x232c});var client9002=jayson[_0xf5c5('0x20')][_0xf5c5('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x8a6ac0,_0x3fad23,_0x647fb6,_0x1f449e){return new BPromise(function(_0x52a8f9,_0x4138bd){var _0x2e4300=_0x1f449e||client;return _0x2e4300[_0xf5c5('0x21')](_0x8a6ac0,_0x647fb6)[_0xf5c5('0x22')](function(_0x5c69cc){logger['info'](_0xf5c5('0x23'),_0x3fad23,'request\x20sent');logger['debug'](_0xf5c5('0x24'),_0x3fad23,_0xf5c5('0x25'),JSON['stringify'](_0x5c69cc));if(_0x5c69cc[_0xf5c5('0x26')]){if(_0x5c69cc[_0xf5c5('0x26')][_0xf5c5('0x27')]===0x1f4){logger[_0xf5c5('0x26')](_0xf5c5('0x23'),_0x3fad23,_0x5c69cc['error'][_0xf5c5('0x28')]);return _0x4138bd(_0x5c69cc[_0xf5c5('0x26')][_0xf5c5('0x28')]);}logger[_0xf5c5('0x26')](_0xf5c5('0x23'),_0x3fad23,_0x5c69cc[_0xf5c5('0x26')][_0xf5c5('0x28')]);return _0x52a8f9(_0x5c69cc[_0xf5c5('0x26')][_0xf5c5('0x28')]);}else{logger[_0xf5c5('0x29')](_0xf5c5('0x23'),_0x3fad23,'request\x20sent');_0x52a8f9(_0x5c69cc['result']['message']);}})[_0xf5c5('0x2a')](function(_0x29476e){logger[_0xf5c5('0x26')]('ChatMessage,\x20%s,\x20%s',_0x3fad23,_0x29476e);_0x4138bd(_0x29476e);});});}function respondWithStatusCode(_0x187ed6,_0x2076ff){_0x2076ff=_0x2076ff||0xcc;return function(_0x1e9eda){if(_0x1e9eda){return _0x187ed6[_0xf5c5('0x2b')](_0x2076ff);}return _0x187ed6[_0xf5c5('0x2c')](_0x2076ff)[_0xf5c5('0x2d')]();};}function respondWithResult(_0x57c75d,_0x41460b){_0x41460b=_0x41460b||0xc8;return function(_0x396525){if(_0x396525){return _0x57c75d[_0xf5c5('0x2c')](_0x41460b)[_0xf5c5('0x2e')](_0x396525);}};}function respondWithFilteredResult(_0x262586,_0x2ed282){return function(_0x3e825f){if(_0x3e825f){var _0x2da664=typeof _0x2ed282[_0xf5c5('0x2f')]==='undefined'&&typeof _0x2ed282[_0xf5c5('0x30')]===_0xf5c5('0x31');var _0x4783b5=_0x3e825f[_0xf5c5('0x32')];var _0x409e40=_0x2da664?0x0:_0x2ed282['offset'];var _0x35624f=_0x2da664?_0x3e825f[_0xf5c5('0x32')]:_0x2ed282[_0xf5c5('0x2f')]+_0x2ed282[_0xf5c5('0x30')];var _0x262116;if(_0x35624f>=_0x4783b5){_0x35624f=_0x4783b5;_0x262116=0xc8;}else{_0x262116=0xce;}_0x262586[_0xf5c5('0x2c')](_0x262116);return _0x262586[_0xf5c5('0x33')](_0xf5c5('0x34'),_0x409e40+'-'+_0x35624f+'/'+_0x4783b5)['json'](_0x3e825f);}return null;};}function patchUpdates(_0x323ad0){return function(_0xa7ca1b){try{jsonpatch[_0xf5c5('0x35')](_0xa7ca1b,_0x323ad0,!![]);}catch(_0x3d920a){return BPromise['reject'](_0x3d920a);}return _0xa7ca1b[_0xf5c5('0x36')]();};}function saveUpdates(_0x3da238,_0x1d1f6b){return function(_0xff3253){if(_0xff3253){return _0xff3253[_0xf5c5('0x37')](_0x3da238)['then'](function(_0x16c8ba){return _0x16c8ba;});}return null;};}function removeEntity(_0x1efe7d,_0x1378fe){return function(_0x4a6d57){if(_0x4a6d57){return _0x4a6d57[_0xf5c5('0x38')]()[_0xf5c5('0x22')](function(){_0x1efe7d[_0xf5c5('0x2c')](0xcc)[_0xf5c5('0x2d')]();});}};}function handleEntityNotFound(_0x58c2fe,_0x5209cf){return function(_0x5bfe2c){if(!_0x5bfe2c){_0x58c2fe['sendStatus'](0x194);}return _0x5bfe2c;};}function handleError(_0x4e038b,_0x444f30){_0x444f30=_0x444f30||0x1f4;return function(_0x3a9b53){logger['error'](_0x3a9b53[_0xf5c5('0x39')]);if(_0x3a9b53[_0xf5c5('0x3a')]){delete _0x3a9b53[_0xf5c5('0x3a')];}_0x4e038b[_0xf5c5('0x2c')](_0x444f30)['send'](_0x3a9b53);};}exports[_0xf5c5('0x3b')]=function(_0x2e1b6d,_0x5dc612){var _0x3c7ece={},_0x452efe={},_0x242a70={'count':0x0,'rows':[]};var _0x40e2bd=_[_0xf5c5('0x3c')](db[_0xf5c5('0x3d')][_0xf5c5('0x3e')],function(_0x2cc715){return{'name':_0x2cc715['fieldName'],'type':_0x2cc715[_0xf5c5('0x3f')][_0xf5c5('0x40')]};});_0x452efe[_0xf5c5('0x41')]=_[_0xf5c5('0x3c')](_0x40e2bd,_0xf5c5('0x3a'));_0x452efe['query']=_[_0xf5c5('0x42')](_0x2e1b6d[_0xf5c5('0x43')]);_0x452efe[_0xf5c5('0x44')]=_[_0xf5c5('0x45')](_0x452efe['model'],_0x452efe[_0xf5c5('0x43')]);_0x3c7ece[_0xf5c5('0x46')]=_[_0xf5c5('0x45')](_0x452efe[_0xf5c5('0x41')],qs['fields'](_0x2e1b6d['query']['fields']));_0x3c7ece[_0xf5c5('0x46')]=_0x3c7ece[_0xf5c5('0x46')][_0xf5c5('0x47')]?_0x3c7ece[_0xf5c5('0x46')]:_0x452efe[_0xf5c5('0x41')];if(!_0x2e1b6d['query'][_0xf5c5('0x48')](_0xf5c5('0x49'))){_0x3c7ece[_0xf5c5('0x30')]=qs[_0xf5c5('0x30')](_0x2e1b6d[_0xf5c5('0x43')][_0xf5c5('0x30')]);_0x3c7ece[_0xf5c5('0x2f')]=qs[_0xf5c5('0x2f')](_0x2e1b6d[_0xf5c5('0x43')]['offset']);}_0x3c7ece['order']=qs[_0xf5c5('0x4a')](_0x2e1b6d[_0xf5c5('0x43')][_0xf5c5('0x4a')]);_0x3c7ece[_0xf5c5('0x4b')]=qs['filters'](_[_0xf5c5('0x4c')](_0x2e1b6d['query'],_0x452efe['filters']),_0x40e2bd);if(_0x2e1b6d[_0xf5c5('0x43')][_0xf5c5('0x4d')]){_0x3c7ece[_0xf5c5('0x4b')]=_[_0xf5c5('0x4e')](_0x3c7ece[_0xf5c5('0x4b')],{'$or':_[_0xf5c5('0x3c')](_0x40e2bd,function(_0x13ca8b){if(_0x13ca8b['type']!==_0xf5c5('0x4f')){var _0x26d85f={};_0x26d85f[_0x13ca8b[_0xf5c5('0x3a')]]={'$like':'%'+_0x2e1b6d[_0xf5c5('0x43')]['filter']+'%'};return _0x26d85f;}})});}_0x3c7ece=_[_0xf5c5('0x4e')]({},_0x3c7ece,_0x2e1b6d['options']);var _0x242c5b={'where':_0x3c7ece['where']};return db[_0xf5c5('0x3d')][_0xf5c5('0x32')](_0x242c5b)['then'](function(_0x4e635c){_0x242a70[_0xf5c5('0x32')]=_0x4e635c;if(_0x2e1b6d['query'][_0xf5c5('0x50')]){_0x3c7ece['include']=[{'all':!![]}];}return db[_0xf5c5('0x3d')]['findAll'](_0x3c7ece);})[_0xf5c5('0x22')](function(_0x1ba072){_0x242a70['rows']=_0x1ba072;return _0x242a70;})[_0xf5c5('0x22')](respondWithFilteredResult(_0x5dc612,_0x3c7ece))['catch'](handleError(_0x5dc612,null));};exports[_0xf5c5('0x51')]=function(_0x57e9c7,_0x522089){var _0x426504={'raw':!![],'where':{'id':_0x57e9c7['params']['id']}},_0x353901={};_0x353901[_0xf5c5('0x41')]=_[_0xf5c5('0x42')](db[_0xf5c5('0x3d')][_0xf5c5('0x3e')]);_0x353901[_0xf5c5('0x43')]=_[_0xf5c5('0x42')](_0x57e9c7[_0xf5c5('0x43')]);_0x353901['filters']=_['intersection'](_0x353901[_0xf5c5('0x41')],_0x353901[_0xf5c5('0x43')]);_0x426504[_0xf5c5('0x46')]=_[_0xf5c5('0x45')](_0x353901[_0xf5c5('0x41')],qs['fields'](_0x57e9c7[_0xf5c5('0x43')][_0xf5c5('0x52')]));_0x426504[_0xf5c5('0x46')]=_0x426504[_0xf5c5('0x46')][_0xf5c5('0x47')]?_0x426504[_0xf5c5('0x46')]:_0x353901[_0xf5c5('0x41')];if(_0x57e9c7[_0xf5c5('0x43')][_0xf5c5('0x50')]){_0x426504['include']=[{'all':!![]}];}_0x426504=_[_0xf5c5('0x4e')]({},_0x426504,_0x57e9c7[_0xf5c5('0x53')]);return db[_0xf5c5('0x3d')][_0xf5c5('0x54')](_0x426504)[_0xf5c5('0x22')](handleEntityNotFound(_0x522089,null))['then'](respondWithResult(_0x522089,null))[_0xf5c5('0x2a')](handleError(_0x522089,null));};exports['create']=function(_0x461144,_0x1693a5){return db['ChatMessage']['create'](_0x461144[_0xf5c5('0x55')],{})[_0xf5c5('0x22')](respondWithResult(_0x1693a5,0xc9))['catch'](handleError(_0x1693a5,null));};exports[_0xf5c5('0x37')]=function(_0x2c71b5,_0x47d490){if(_0x2c71b5[_0xf5c5('0x55')]['id']){delete _0x2c71b5[_0xf5c5('0x55')]['id'];}return db[_0xf5c5('0x3d')][_0xf5c5('0x54')]({'where':{'id':_0x2c71b5[_0xf5c5('0x56')]['id']}})[_0xf5c5('0x22')](handleEntityNotFound(_0x47d490,null))[_0xf5c5('0x22')](saveUpdates(_0x2c71b5[_0xf5c5('0x55')],null))['then'](respondWithResult(_0x47d490,null))['catch'](handleError(_0x47d490,null));};exports[_0xf5c5('0x38')]=function(_0x24fb4c,_0x41f0c0){return db[_0xf5c5('0x3d')]['find']({'where':{'id':_0x24fb4c[_0xf5c5('0x56')]['id']}})['then'](handleEntityNotFound(_0x41f0c0,null))[_0xf5c5('0x22')](removeEntity(_0x41f0c0,null))[_0xf5c5('0x2a')](handleError(_0x41f0c0,null));};exports[_0xf5c5('0x57')]=function(_0x52570c,_0x301886){return db[_0xf5c5('0x3d')][_0xf5c5('0x57')]()[_0xf5c5('0x22')](respondWithResult(_0x301886,null))['catch'](handleError(_0x301886,null));};var interaction_log=require('../../config/logger')(_0xf5c5('0x58'));exports[_0xf5c5('0x59')]=function(_0x153733,_0x1c8d66,_0x3f35af){var _0x149f78={'agent':{},'channel':_0xf5c5('0x5a')};if(_0x153733[_0xf5c5('0x55')]['id']){delete _0x153733['body']['id'];}_0x153733[_0xf5c5('0x55')][_0xf5c5('0x5b')]=!![];_0x153733[_0xf5c5('0x55')][_0xf5c5('0x5c')]=moment()[_0xf5c5('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x153733[_0xf5c5('0x55')][_0xf5c5('0x5e')]=_0x153733[_0xf5c5('0x55')][_0xf5c5('0x5e')]||_0x153733[_0xf5c5('0x5f')]['id'];_0x149f78['agent']['id']=_0x153733[_0xf5c5('0x55')]['UserId'];return db[_0xf5c5('0x3d')][_0xf5c5('0x54')]({'where':{'id':_0x153733[_0xf5c5('0x56')]['id'],'UserId':null}})[_0xf5c5('0x22')](handleEntityNotFound(_0x1c8d66,null))['then'](saveUpdates(_0x153733[_0xf5c5('0x55')],null))['then'](function(_0x38d43c){if(_0x38d43c){_0x149f78[_0xf5c5('0x28')]=_0x38d43c[_0xf5c5('0x60')]({'plain':!![]});return db['ChatInteraction'][_0xf5c5('0x54')]({'where':{'id':_0x38d43c[_0xf5c5('0x61')]}});}return null;})[_0xf5c5('0x22')](handleEntityNotFound(_0x1c8d66,null))[_0xf5c5('0x22')](function(_0x21f0d3){if(_0x21f0d3){return _0x21f0d3[_0xf5c5('0x37')]({'UserId':_0x153733['body']['UserId'],'read1stAt':_[_0xf5c5('0x62')](_0x21f0d3['read1stAt'])?moment()[_0xf5c5('0x5d')](_0xf5c5('0x63')):undefined});}return null;})[_0xf5c5('0x22')](function(_0x49e5df){if(_0x49e5df){_0x149f78[_0xf5c5('0x64')]=_0x49e5df[_0xf5c5('0x60')]({'plain':!![]});interaction_log['info'](_0xf5c5('0x65'),_0x153733[_0xf5c5('0x5f')]['id'],_0x153733[_0xf5c5('0x5f')][_0xf5c5('0x3a')],_0x153733[_0xf5c5('0x5f')][_0xf5c5('0x66')],_0x149f78['interaction']['id'],_0x153733[_0xf5c5('0x55')]?JSON[_0xf5c5('0x67')](_0x153733[_0xf5c5('0x55')]):_0xf5c5('0x68'));return respondWithRpcPromise(_0xf5c5('0x69'),'acceptMessage',_0x149f78);}return null;})[_0xf5c5('0x22')](function(_0xd862dc){var _0x4eba44=_0xf5c5('0x6a')+_0xd862dc['message']['ContactId'];return db[_0xf5c5('0x6b')][_0xf5c5('0x43')](_0x4eba44,{'type':db[_0xf5c5('0x6c')][_0xf5c5('0x6d')][_0xf5c5('0x6e')],'raw':!![]})['then'](function(_0x238a6c){return _0x238a6c;});})[_0xf5c5('0x22')](function(_0x408c6f){if(_0x408c6f){_0x149f78[_0xf5c5('0x28')][_0xf5c5('0x6f')]=_0x408c6f[0x0];if(!_0x153733[_0xf5c5('0x55')][_0xf5c5('0x5e')])return;return db['User'][_0xf5c5('0x54')]({'where':{'id':_0x153733[_0xf5c5('0x55')][_0xf5c5('0x5e')],'role':'agent'},'attributes':['id',_0xf5c5('0x3a'),_0xf5c5('0x70'),_0xf5c5('0x71'),'internal'],'raw':!![]});}return null;})[_0xf5c5('0x22')](function(_0x58b8f0){if(!_0x58b8f0)return null;_0x149f78[_0xf5c5('0x28')][_0xf5c5('0x72')]=_0x58b8f0;return _0x149f78;})[_0xf5c5('0x22')](function(_0x31c0a8){if(_0x31c0a8){if(_0x153733[_0xf5c5('0x55')][_0xf5c5('0x73')]){_0x149f78[_0xf5c5('0x28')][_0xf5c5('0x74')]=util['format']('SIP/%s',_0x153733[_0xf5c5('0x5f')][_0xf5c5('0x3a')]);_0x149f78[_0xf5c5('0x28')][_0xf5c5('0x75')]=_0x149f78[_0xf5c5('0x75')];_0x149f78[_0xf5c5('0x28')]['motionChannel']=_0x149f78['channel'];_0x149f78[_0xf5c5('0x28')]['event']='accept';return respondWithRpcPromise('EventManager',_0xf5c5('0x76'),{'event':'acceptmessage','message':_['merge'](_0x149f78['message'],JSON[_0xf5c5('0x77')](_0x149f78[_0xf5c5('0x64')][_0xf5c5('0x78')]))},client9002)[_0xf5c5('0x22')](function(){return _0x149f78;});}return _0x149f78;}return null;})['then'](respondWithResult(_0x1c8d66,null))[_0xf5c5('0x2a')](handleError(_0x1c8d66,null));};var interaction_log=require(_0xf5c5('0x13'))(_0xf5c5('0x58'));exports[_0xf5c5('0x79')]=function(_0x3661de,_0x500eab,_0x5963df){var _0x561784={'agent':{},'channel':_0xf5c5('0x5a')};if(_0x3661de[_0xf5c5('0x55')]['id']){delete _0x3661de[_0xf5c5('0x55')]['id'];}_0x3661de[_0xf5c5('0x55')][_0xf5c5('0x5e')]=_0x3661de[_0xf5c5('0x55')][_0xf5c5('0x5e')]||_0x3661de[_0xf5c5('0x5f')]['id'];_0x561784[_0xf5c5('0x72')]['id']=_0x3661de[_0xf5c5('0x55')][_0xf5c5('0x5e')];return db[_0xf5c5('0x3d')][_0xf5c5('0x54')]({'where':{'id':_0x3661de[_0xf5c5('0x56')]['id'],'UserId':null}})[_0xf5c5('0x22')](handleEntityNotFound(_0x500eab,null))[_0xf5c5('0x22')](function(_0x190d35){if(_0x190d35){_0x561784[_0xf5c5('0x28')]=_0x190d35[_0xf5c5('0x60')]({'plain':!![]});return db[_0xf5c5('0x7a')][_0xf5c5('0x54')]({'where':{'id':_0x190d35['ChatInteractionId']}});}return null;})[_0xf5c5('0x22')](handleEntityNotFound(_0x500eab,null))['then'](function(_0x598dcd){if(_0x598dcd){_0x561784[_0xf5c5('0x64')]=_0x598dcd['get']({'plain':!![]});interaction_log[_0xf5c5('0x29')](_0xf5c5('0x7b'),_0x3661de[_0xf5c5('0x5f')]['id'],_0x3661de['user'][_0xf5c5('0x3a')],_0x3661de[_0xf5c5('0x5f')][_0xf5c5('0x66')],_0x561784[_0xf5c5('0x64')]['id'],_0x3661de[_0xf5c5('0x55')]?JSON['stringify'](_0x3661de[_0xf5c5('0x55')]):_0xf5c5('0x68'));return respondWithRpcPromise(_0xf5c5('0x7c'),'rejectMessage',_0x561784);}return null;})[_0xf5c5('0x22')](function(_0x5da05d){var _0x19f1a4=_0xf5c5('0x6a')+_0x5da05d[_0xf5c5('0x28')][_0xf5c5('0x7d')];return db[_0xf5c5('0x6b')]['query'](_0x19f1a4,{'type':db[_0xf5c5('0x6c')][_0xf5c5('0x6d')][_0xf5c5('0x6e')],'raw':!![]})[_0xf5c5('0x22')](function(_0xaf6605){return _0xaf6605;});})[_0xf5c5('0x22')](function(_0x3fbe5a){if(_0x3fbe5a){_0x561784[_0xf5c5('0x28')][_0xf5c5('0x6f')]=_0x3fbe5a[0x0];if(!_0x3661de[_0xf5c5('0x55')][_0xf5c5('0x5e')])return;return db[_0xf5c5('0x7e')][_0xf5c5('0x54')]({'where':{'id':_0x3661de['body'][_0xf5c5('0x5e')],'role':_0xf5c5('0x72')},'attributes':['id',_0xf5c5('0x3a'),_0xf5c5('0x70'),'email',_0xf5c5('0x7f')],'raw':!![]});}return null;})[_0xf5c5('0x22')](function(_0x44b47c){if(!_0x44b47c)return null;_0x561784[_0xf5c5('0x28')]['agent']=_0x44b47c;return _0x561784;})[_0xf5c5('0x22')](function(_0xe7fb07){if(_0xe7fb07){_0xe7fb07[_0xf5c5('0x28')]['interface']=util[_0xf5c5('0x5d')]('SIP/%s',_0x3661de[_0xf5c5('0x5f')]['name']);_0xe7fb07['message'][_0xf5c5('0x75')]=_0x561784[_0xf5c5('0x75')];_0xe7fb07[_0xf5c5('0x28')][_0xf5c5('0x80')]=_0x561784['channel'];_0xe7fb07[_0xf5c5('0x28')][_0xf5c5('0x81')]=_0xf5c5('0x79');respondWithRpcPromise(_0xf5c5('0x76'),'EventManager',{'event':_0xf5c5('0x82'),'message':_[_0xf5c5('0x4e')](_0x561784[_0xf5c5('0x28')],JSON[_0xf5c5('0x77')](_0x561784[_0xf5c5('0x64')][_0xf5c5('0x78')]))},client9002);return _0x561784;}return null;})[_0xf5c5('0x22')](respondWithResult(_0x500eab,null))['catch'](handleError(_0x500eab,null));}; \ No newline at end of file +var _0xc212=['rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./chatMessage.socket','client','http','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','status','undefined','count','offset','limit','Content-Range','apply','reject','update','then','destroy','end','stack','name','index','ChatMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','params','create','body','find','describe','chat-interactions','accept','chat','read','format','UserId','user','agent','ChatInteraction','ChatInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','fullname','email','internal','manual','interface','channel','event','parse','../../config/logger','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','User','SIP/%s','motionChannel','EventManager'];(function(_0x47498c,_0x311e9d){var _0x52a0c1=function(_0x974c35){while(--_0x974c35){_0x47498c['push'](_0x47498c['shift']());}};_0x52a0c1(++_0x311e9d);}(_0xc212,0x80));var _0x2c21=function(_0x4d6c67,_0x3e0336){_0x4d6c67=_0x4d6c67-0x0;var _0x56be0c=_0xc212[_0x4d6c67];return _0x56be0c;};'use strict';var emlformat=require(_0x2c21('0x0'));var rimraf=require(_0x2c21('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2c21('0x2'));var rp=require(_0x2c21('0x3'));var moment=require('moment');var BPromise=require(_0x2c21('0x4'));var Mustache=require(_0x2c21('0x5'));var util=require(_0x2c21('0x6'));var path=require('path');var sox=require(_0x2c21('0x7'));var csv=require(_0x2c21('0x8'));var ejs=require(_0x2c21('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2c21('0xa'));var crypto=require(_0x2c21('0xb'));var jsforce=require(_0x2c21('0xc'));var deskjs=require(_0x2c21('0xd'));var toCsv=require(_0x2c21('0x8'));var querystring=require('querystring');var Papa=require(_0x2c21('0xe'));var Redis=require(_0x2c21('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2c21('0x10'));var as=require(_0x2c21('0x11'));var hardwareService=require(_0x2c21('0x12'));var logger=require('../../config/logger')(_0x2c21('0x13'));var utils=require(_0x2c21('0x14'));var config=require(_0x2c21('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2c21('0x16'))['db'];config[_0x2c21('0x17')]=_[_0x2c21('0x18')](config[_0x2c21('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2c21('0x17')]));require(_0x2c21('0x19'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x2c21('0x1a')][_0x2c21('0x1b')]({'port':0x232c});var client9002=jayson[_0x2c21('0x1a')][_0x2c21('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x549570,_0x35e418,_0x273b21,_0x2b4df2){return new BPromise(function(_0x4818ae,_0x34cf93){var _0x5c9b7b=_0x2b4df2||client;return _0x5c9b7b[_0x2c21('0x1c')](_0x549570,_0x273b21)['then'](function(_0x873257){logger[_0x2c21('0x1d')](_0x2c21('0x1e'),_0x35e418,_0x2c21('0x1f'));logger[_0x2c21('0x20')](_0x2c21('0x21'),_0x35e418,'request\x20sent',JSON['stringify'](_0x873257));if(_0x873257[_0x2c21('0x22')]){if(_0x873257[_0x2c21('0x22')]['code']===0x1f4){logger['error'](_0x2c21('0x1e'),_0x35e418,_0x873257['error'][_0x2c21('0x23')]);return _0x34cf93(_0x873257['error'][_0x2c21('0x23')]);}logger[_0x2c21('0x22')](_0x2c21('0x1e'),_0x35e418,_0x873257[_0x2c21('0x22')][_0x2c21('0x23')]);return _0x4818ae(_0x873257[_0x2c21('0x22')][_0x2c21('0x23')]);}else{logger[_0x2c21('0x1d')]('ChatMessage,\x20%s,\x20%s',_0x35e418,_0x2c21('0x1f'));_0x4818ae(_0x873257[_0x2c21('0x24')][_0x2c21('0x23')]);}})['catch'](function(_0x176e96){logger[_0x2c21('0x22')](_0x2c21('0x1e'),_0x35e418,_0x176e96);_0x34cf93(_0x176e96);});});}function respondWithStatusCode(_0xd06649,_0xcdb85d){_0xcdb85d=_0xcdb85d||0xcc;return function(_0x3c3107){if(_0x3c3107){return _0xd06649[_0x2c21('0x25')](_0xcdb85d);}return _0xd06649['status'](_0xcdb85d)['end']();};}function respondWithResult(_0x579b30,_0x33eb0f){_0x33eb0f=_0x33eb0f||0xc8;return function(_0x3ac77a){if(_0x3ac77a){return _0x579b30[_0x2c21('0x26')](_0x33eb0f)['json'](_0x3ac77a);}};}function respondWithFilteredResult(_0x30fc00,_0x2b6fcf){return function(_0x5ae8dd){if(_0x5ae8dd){var _0x5ccf16=typeof _0x2b6fcf['offset']===_0x2c21('0x27')&&typeof _0x2b6fcf['limit']==='undefined';var _0x1fbc62=_0x5ae8dd[_0x2c21('0x28')];var _0x5855f5=_0x5ccf16?0x0:_0x2b6fcf[_0x2c21('0x29')];var _0xee466c=_0x5ccf16?_0x5ae8dd[_0x2c21('0x28')]:_0x2b6fcf[_0x2c21('0x29')]+_0x2b6fcf[_0x2c21('0x2a')];var _0x9edf3e;if(_0xee466c>=_0x1fbc62){_0xee466c=_0x1fbc62;_0x9edf3e=0xc8;}else{_0x9edf3e=0xce;}_0x30fc00['status'](_0x9edf3e);return _0x30fc00['set'](_0x2c21('0x2b'),_0x5855f5+'-'+_0xee466c+'/'+_0x1fbc62)['json'](_0x5ae8dd);}return null;};}function patchUpdates(_0x23dfb0){return function(_0x16eab6){try{jsonpatch[_0x2c21('0x2c')](_0x16eab6,_0x23dfb0,!![]);}catch(_0x1be6de){return BPromise[_0x2c21('0x2d')](_0x1be6de);}return _0x16eab6['save']();};}function saveUpdates(_0x15b385,_0x2a274a){return function(_0x40bcd6){if(_0x40bcd6){return _0x40bcd6[_0x2c21('0x2e')](_0x15b385)[_0x2c21('0x2f')](function(_0x4255c6){return _0x4255c6;});}return null;};}function removeEntity(_0x38afb6,_0x524cff){return function(_0x58804e){if(_0x58804e){return _0x58804e[_0x2c21('0x30')]()['then'](function(){_0x38afb6[_0x2c21('0x26')](0xcc)[_0x2c21('0x31')]();});}};}function handleEntityNotFound(_0x572598,_0x3ff6f0){return function(_0x80f520){if(!_0x80f520){_0x572598[_0x2c21('0x25')](0x194);}return _0x80f520;};}function handleError(_0x4d1ea3,_0x454609){_0x454609=_0x454609||0x1f4;return function(_0x5476ed){logger[_0x2c21('0x22')](_0x5476ed[_0x2c21('0x32')]);if(_0x5476ed[_0x2c21('0x33')]){delete _0x5476ed[_0x2c21('0x33')];}_0x4d1ea3[_0x2c21('0x26')](_0x454609)['send'](_0x5476ed);};}exports[_0x2c21('0x34')]=function(_0x3d7474,_0x2e1ae1){var _0x9989d0={},_0xf9322d={},_0x2e1e11={'count':0x0,'rows':[]};var _0x15ce35=_['map'](db[_0x2c21('0x35')][_0x2c21('0x36')],function(_0x555205){return{'name':_0x555205[_0x2c21('0x37')],'type':_0x555205[_0x2c21('0x38')][_0x2c21('0x39')]};});_0xf9322d[_0x2c21('0x3a')]=_[_0x2c21('0x3b')](_0x15ce35,_0x2c21('0x33'));_0xf9322d[_0x2c21('0x3c')]=_[_0x2c21('0x3d')](_0x3d7474[_0x2c21('0x3c')]);_0xf9322d[_0x2c21('0x3e')]=_[_0x2c21('0x3f')](_0xf9322d['model'],_0xf9322d[_0x2c21('0x3c')]);_0x9989d0[_0x2c21('0x40')]=_[_0x2c21('0x3f')](_0xf9322d[_0x2c21('0x3a')],qs[_0x2c21('0x41')](_0x3d7474[_0x2c21('0x3c')][_0x2c21('0x41')]));_0x9989d0['attributes']=_0x9989d0[_0x2c21('0x40')][_0x2c21('0x42')]?_0x9989d0[_0x2c21('0x40')]:_0xf9322d[_0x2c21('0x3a')];if(!_0x3d7474['query']['hasOwnProperty'](_0x2c21('0x43'))){_0x9989d0['limit']=qs[_0x2c21('0x2a')](_0x3d7474[_0x2c21('0x3c')]['limit']);_0x9989d0[_0x2c21('0x29')]=qs['offset'](_0x3d7474[_0x2c21('0x3c')][_0x2c21('0x29')]);}_0x9989d0[_0x2c21('0x44')]=qs[_0x2c21('0x45')](_0x3d7474[_0x2c21('0x3c')][_0x2c21('0x45')]);_0x9989d0[_0x2c21('0x46')]=qs[_0x2c21('0x3e')](_[_0x2c21('0x47')](_0x3d7474[_0x2c21('0x3c')],_0xf9322d['filters']),_0x15ce35);if(_0x3d7474['query'][_0x2c21('0x48')]){_0x9989d0[_0x2c21('0x46')]=_['merge'](_0x9989d0[_0x2c21('0x46')],{'$or':_[_0x2c21('0x3b')](_0x15ce35,function(_0x3de9f6){if(_0x3de9f6[_0x2c21('0x38')]!=='VIRTUAL'){var _0x40bfa2={};_0x40bfa2[_0x3de9f6[_0x2c21('0x33')]]={'$like':'%'+_0x3d7474[_0x2c21('0x3c')][_0x2c21('0x48')]+'%'};return _0x40bfa2;}})});}_0x9989d0=_[_0x2c21('0x49')]({},_0x9989d0,_0x3d7474[_0x2c21('0x4a')]);var _0x3a4bb8={'where':_0x9989d0[_0x2c21('0x46')]};return db['ChatMessage'][_0x2c21('0x28')](_0x3a4bb8)[_0x2c21('0x2f')](function(_0x2dcd42){_0x2e1e11[_0x2c21('0x28')]=_0x2dcd42;if(_0x3d7474[_0x2c21('0x3c')][_0x2c21('0x4b')]){_0x9989d0[_0x2c21('0x4c')]=[{'all':!![]}];}return db[_0x2c21('0x35')][_0x2c21('0x4d')](_0x9989d0);})[_0x2c21('0x2f')](function(_0x55ebbc){_0x2e1e11['rows']=_0x55ebbc;return _0x2e1e11;})[_0x2c21('0x2f')](respondWithFilteredResult(_0x2e1ae1,_0x9989d0))[_0x2c21('0x4e')](handleError(_0x2e1ae1,null));};exports['show']=function(_0x1c39c6,_0x238bcb){var _0x52c2eb={'raw':!![],'where':{'id':_0x1c39c6[_0x2c21('0x4f')]['id']}},_0x38c7c3={};_0x38c7c3[_0x2c21('0x3a')]=_[_0x2c21('0x3d')](db[_0x2c21('0x35')][_0x2c21('0x36')]);_0x38c7c3[_0x2c21('0x3c')]=_[_0x2c21('0x3d')](_0x1c39c6[_0x2c21('0x3c')]);_0x38c7c3[_0x2c21('0x3e')]=_[_0x2c21('0x3f')](_0x38c7c3[_0x2c21('0x3a')],_0x38c7c3[_0x2c21('0x3c')]);_0x52c2eb[_0x2c21('0x40')]=_[_0x2c21('0x3f')](_0x38c7c3[_0x2c21('0x3a')],qs[_0x2c21('0x41')](_0x1c39c6['query'][_0x2c21('0x41')]));_0x52c2eb[_0x2c21('0x40')]=_0x52c2eb['attributes'][_0x2c21('0x42')]?_0x52c2eb[_0x2c21('0x40')]:_0x38c7c3[_0x2c21('0x3a')];if(_0x1c39c6['query'][_0x2c21('0x4b')]){_0x52c2eb['include']=[{'all':!![]}];}_0x52c2eb=_[_0x2c21('0x49')]({},_0x52c2eb,_0x1c39c6[_0x2c21('0x4a')]);return db[_0x2c21('0x35')]['find'](_0x52c2eb)[_0x2c21('0x2f')](handleEntityNotFound(_0x238bcb,null))[_0x2c21('0x2f')](respondWithResult(_0x238bcb,null))[_0x2c21('0x4e')](handleError(_0x238bcb,null));};exports['create']=function(_0x27ccc7,_0x3a44ad){return db[_0x2c21('0x35')][_0x2c21('0x50')](_0x27ccc7[_0x2c21('0x51')],{})['then'](respondWithResult(_0x3a44ad,0xc9))[_0x2c21('0x4e')](handleError(_0x3a44ad,null));};exports[_0x2c21('0x2e')]=function(_0x57c7e5,_0x14a32d){if(_0x57c7e5['body']['id']){delete _0x57c7e5['body']['id'];}return db[_0x2c21('0x35')][_0x2c21('0x52')]({'where':{'id':_0x57c7e5[_0x2c21('0x4f')]['id']}})[_0x2c21('0x2f')](handleEntityNotFound(_0x14a32d,null))[_0x2c21('0x2f')](saveUpdates(_0x57c7e5[_0x2c21('0x51')],null))['then'](respondWithResult(_0x14a32d,null))[_0x2c21('0x4e')](handleError(_0x14a32d,null));};exports[_0x2c21('0x30')]=function(_0x19a51d,_0x38bb6f){return db[_0x2c21('0x35')][_0x2c21('0x52')]({'where':{'id':_0x19a51d['params']['id']}})[_0x2c21('0x2f')](handleEntityNotFound(_0x38bb6f,null))[_0x2c21('0x2f')](removeEntity(_0x38bb6f,null))[_0x2c21('0x4e')](handleError(_0x38bb6f,null));};exports['describe']=function(_0x2d4ec0,_0x350ac6){return db['ChatMessage'][_0x2c21('0x53')]()[_0x2c21('0x2f')](respondWithResult(_0x350ac6,null))[_0x2c21('0x4e')](handleError(_0x350ac6,null));};var interaction_log=require('../../config/logger')(_0x2c21('0x54'));exports[_0x2c21('0x55')]=function(_0x589a86,_0x3db62b,_0x1fdded){var _0x3b54c7={'agent':{},'channel':_0x2c21('0x56')};if(_0x589a86[_0x2c21('0x51')]['id']){delete _0x589a86['body']['id'];}_0x589a86[_0x2c21('0x51')][_0x2c21('0x57')]=!![];_0x589a86[_0x2c21('0x51')]['readAt']=moment()[_0x2c21('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x589a86[_0x2c21('0x51')][_0x2c21('0x59')]=_0x589a86[_0x2c21('0x51')][_0x2c21('0x59')]||_0x589a86[_0x2c21('0x5a')]['id'];_0x3b54c7[_0x2c21('0x5b')]['id']=_0x589a86[_0x2c21('0x51')][_0x2c21('0x59')];return db['ChatMessage'][_0x2c21('0x52')]({'where':{'id':_0x589a86['params']['id'],'UserId':null}})[_0x2c21('0x2f')](handleEntityNotFound(_0x3db62b,null))['then'](saveUpdates(_0x589a86[_0x2c21('0x51')],null))[_0x2c21('0x2f')](function(_0x47bdfc){if(_0x47bdfc){_0x3b54c7[_0x2c21('0x23')]=_0x47bdfc['get']({'plain':!![]});return db[_0x2c21('0x5c')][_0x2c21('0x52')]({'where':{'id':_0x47bdfc[_0x2c21('0x5d')]}});}return null;})[_0x2c21('0x2f')](handleEntityNotFound(_0x3db62b,null))[_0x2c21('0x2f')](function(_0x1ef80f){if(_0x1ef80f){return _0x1ef80f[_0x2c21('0x2e')]({'UserId':_0x589a86[_0x2c21('0x51')][_0x2c21('0x59')],'read1stAt':_[_0x2c21('0x5e')](_0x1ef80f[_0x2c21('0x5f')])?moment()[_0x2c21('0x58')](_0x2c21('0x60')):undefined});}return null;})['then'](function(_0x42f337){if(_0x42f337){_0x3b54c7[_0x2c21('0x61')]=_0x42f337[_0x2c21('0x62')]({'plain':!![]});interaction_log[_0x2c21('0x1d')](_0x2c21('0x63'),_0x589a86[_0x2c21('0x5a')]['id'],_0x589a86['user'][_0x2c21('0x33')],_0x589a86[_0x2c21('0x5a')][_0x2c21('0x64')],_0x3b54c7[_0x2c21('0x61')]['id'],_0x589a86[_0x2c21('0x51')]?JSON[_0x2c21('0x65')](_0x589a86[_0x2c21('0x51')]):_0x2c21('0x66'));return respondWithRpcPromise(_0x2c21('0x67'),_0x2c21('0x68'),_0x3b54c7);}return null;})[_0x2c21('0x2f')](function(_0x288f40){var _0x111251=_0x2c21('0x69')+_0x288f40[_0x2c21('0x23')][_0x2c21('0x6a')];return db[_0x2c21('0x6b')]['query'](_0x111251,{'type':db[_0x2c21('0x6c')]['QueryTypes'][_0x2c21('0x6d')],'raw':!![]})[_0x2c21('0x2f')](function(_0x486537){return _0x486537;});})['then'](function(_0x245b0c){if(_0x245b0c){_0x3b54c7[_0x2c21('0x23')][_0x2c21('0x6e')]=_0x245b0c[0x0];if(!_0x589a86[_0x2c21('0x51')][_0x2c21('0x59')])return;return db['User']['find']({'where':{'id':_0x589a86['body'][_0x2c21('0x59')],'role':_0x2c21('0x5b')},'attributes':['id','name',_0x2c21('0x6f'),_0x2c21('0x70'),_0x2c21('0x71')],'raw':!![]});}return null;})['then'](function(_0x5863d6){if(!_0x5863d6)return null;_0x3b54c7[_0x2c21('0x23')][_0x2c21('0x5b')]=_0x5863d6;return _0x3b54c7;})[_0x2c21('0x2f')](function(_0xf85274){if(_0xf85274){if(_0x589a86[_0x2c21('0x51')][_0x2c21('0x72')]){_0x3b54c7[_0x2c21('0x23')][_0x2c21('0x73')]=util[_0x2c21('0x58')]('SIP/%s',_0x589a86['user'][_0x2c21('0x33')]);_0x3b54c7[_0x2c21('0x23')][_0x2c21('0x74')]=_0x3b54c7[_0x2c21('0x74')];_0x3b54c7['message']['motionChannel']=_0x3b54c7[_0x2c21('0x74')];_0x3b54c7[_0x2c21('0x23')][_0x2c21('0x75')]=_0x2c21('0x55');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_[_0x2c21('0x49')](_0x3b54c7[_0x2c21('0x23')],JSON[_0x2c21('0x76')](_0x3b54c7[_0x2c21('0x61')]['formData']))},client9002)[_0x2c21('0x2f')](function(){return _0x3b54c7;});}return _0x3b54c7;}return null;})[_0x2c21('0x2f')](respondWithResult(_0x3db62b,null))[_0x2c21('0x4e')](handleError(_0x3db62b,null));};var interaction_log=require(_0x2c21('0x77'))(_0x2c21('0x54'));exports['reject']=function(_0x4eed08,_0x199556,_0x1b5c44){var _0x25f43b={'agent':{},'channel':_0x2c21('0x56')};if(_0x4eed08[_0x2c21('0x51')]['id']){delete _0x4eed08[_0x2c21('0x51')]['id'];}_0x4eed08[_0x2c21('0x51')][_0x2c21('0x59')]=_0x4eed08['body']['UserId']||_0x4eed08['user']['id'];_0x25f43b[_0x2c21('0x5b')]['id']=_0x4eed08[_0x2c21('0x51')][_0x2c21('0x59')];return db[_0x2c21('0x35')]['find']({'where':{'id':_0x4eed08['params']['id'],'UserId':null}})[_0x2c21('0x2f')](handleEntityNotFound(_0x199556,null))['then'](function(_0xd11cc7){if(_0xd11cc7){_0x25f43b['message']=_0xd11cc7[_0x2c21('0x62')]({'plain':!![]});return db[_0x2c21('0x5c')]['find']({'where':{'id':_0xd11cc7['ChatInteractionId']}});}return null;})[_0x2c21('0x2f')](handleEntityNotFound(_0x199556,null))[_0x2c21('0x2f')](function(_0x5714d8){if(_0x5714d8){_0x25f43b[_0x2c21('0x61')]=_0x5714d8[_0x2c21('0x62')]({'plain':!![]});interaction_log[_0x2c21('0x1d')](_0x2c21('0x78'),_0x4eed08[_0x2c21('0x5a')]['id'],_0x4eed08[_0x2c21('0x5a')]['name'],_0x4eed08['user'][_0x2c21('0x64')],_0x25f43b[_0x2c21('0x61')]['id'],_0x4eed08[_0x2c21('0x51')]?JSON[_0x2c21('0x65')](_0x4eed08['body']):_0x2c21('0x66'));return respondWithRpcPromise(_0x2c21('0x79'),'rejectMessage',_0x25f43b);}return null;})[_0x2c21('0x2f')](function(_0x198bca){var _0x480929='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x198bca[_0x2c21('0x23')][_0x2c21('0x6a')];return db[_0x2c21('0x6b')]['query'](_0x480929,{'type':db[_0x2c21('0x6c')]['QueryTypes'][_0x2c21('0x6d')],'raw':!![]})[_0x2c21('0x2f')](function(_0x1a11d5){return _0x1a11d5;});})[_0x2c21('0x2f')](function(_0x189604){if(_0x189604){_0x25f43b[_0x2c21('0x23')][_0x2c21('0x6e')]=_0x189604[0x0];if(!_0x4eed08['body'][_0x2c21('0x59')])return;return db[_0x2c21('0x7a')][_0x2c21('0x52')]({'where':{'id':_0x4eed08[_0x2c21('0x51')]['UserId'],'role':'agent'},'attributes':['id',_0x2c21('0x33'),_0x2c21('0x6f'),_0x2c21('0x70'),_0x2c21('0x71')],'raw':!![]});}return null;})[_0x2c21('0x2f')](function(_0x617b87){if(!_0x617b87)return null;_0x25f43b[_0x2c21('0x23')][_0x2c21('0x5b')]=_0x617b87;return _0x25f43b;})[_0x2c21('0x2f')](function(_0x2443ec){if(_0x2443ec){_0x2443ec['message'][_0x2c21('0x73')]=util[_0x2c21('0x58')](_0x2c21('0x7b'),_0x4eed08[_0x2c21('0x5a')][_0x2c21('0x33')]);_0x2443ec[_0x2c21('0x23')][_0x2c21('0x74')]=_0x25f43b['channel'];_0x2443ec[_0x2c21('0x23')][_0x2c21('0x7c')]=_0x25f43b[_0x2c21('0x74')];_0x2443ec[_0x2c21('0x23')][_0x2c21('0x75')]=_0x2c21('0x2d');respondWithRpcPromise(_0x2c21('0x7d'),_0x2c21('0x7d'),{'event':_0x2c21('0x7e'),'message':_['merge'](_0x25f43b['message'],JSON['parse'](_0x25f43b[_0x2c21('0x61')]['formData']))},client9002);return _0x25f43b;}return null;})['then'](respondWithResult(_0x199556,null))['catch'](handleError(_0x199556,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 296baab..c957538 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 _0xa64f=['hook','exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x4090e2,_0x3c77ee){var _0x44b887=function(_0x5eded2){while(--_0x5eded2){_0x4090e2['push'](_0x4090e2['shift']());}};_0x44b887(++_0x3c77ee);}(_0xa64f,0x1a0));var _0xfa64=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa64f[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0xfa64('0x0'));var ChatMessage=require(_0xfa64('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfa64('0x2'),'afterUpdate':_0xfa64('0x3'),'afterDestroy':_0xfa64('0x4')};function emitEvent(_0x445d60){return function(_0x2824ea,_0xcd2b17,_0x401250){ChatMessageEvents[_0xfa64('0x5')](_0x445d60+':'+_0x2824ea['id'],_0x2824ea);ChatMessageEvents[_0xfa64('0x5')](_0x445d60,_0x2824ea);_0x401250(null);};}for(var e in events){if(events[_0xfa64('0x6')](e)){var event=events[e];ChatMessage[_0xfa64('0x7')](e,emitEvent(event));}}module[_0xfa64('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0xa8c8=['update','remove','emit','hasOwnProperty','events','setMaxListeners','save'];(function(_0x5ba353,_0x11fd8b){var _0x149f6b=function(_0x59b92e){while(--_0x59b92e){_0x5ba353['push'](_0x5ba353['shift']());}};_0x149f6b(++_0x11fd8b);}(_0xa8c8,0x154));var _0x8a8c=function(_0x5ddf67,_0x194e3d){_0x5ddf67=_0x5ddf67-0x0;var _0x2cedde=_0xa8c8[_0x5ddf67];return _0x2cedde;};'use strict';var EventEmitter=require(_0x8a8c('0x0'));var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x8a8c('0x1')](0x0);var events={'afterCreate':_0x8a8c('0x2'),'afterUpdate':_0x8a8c('0x3'),'afterDestroy':_0x8a8c('0x4')};function emitEvent(_0x5a01d0){return function(_0x60136f,_0x4da91e,_0x41421f){ChatMessageEvents[_0x8a8c('0x5')](_0x5a01d0+':'+_0x60136f['id'],_0x60136f);ChatMessageEvents[_0x8a8c('0x5')](_0x5a01d0,_0x60136f);_0x41421f(null);};}for(var e in events){if(events[_0x8a8c('0x6')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 199ca30..4a7e366 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 _0x299d=['../../config/logger','api','moment','bluebird','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','body','models','get','direction','toLowerCase','secret','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci'];(function(_0x414d4e,_0x289528){var _0x339185=function(_0x3d700a){while(--_0x3d700a){_0x414d4e['push'](_0x414d4e['shift']());}};_0x339185(++_0x289528);}(_0x299d,0x168));var _0xd299=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x299d[_0x2d7f0e];return _0x110b07;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd299('0x0'))(_0xd299('0x1'));var moment=require(_0xd299('0x2'));var BPromise=require(_0xd299('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd299('0x4'));module[_0xd299('0x5')]=function(_0x29b113,_0x4a6b4d){return _0x29b113[_0xd299('0x6')](_0xd299('0x7'),attributes,{'tableName':_0xd299('0x8'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0xd299('0x9')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x22c04a,_0x311ccc,_0x353215){var _0x26a6f0=_0x29b113[_0xd299('0xa')];var _0x5bef43=_0x22c04a[_0xd299('0xb')]({'plain':!![]});if(_0x5bef43[_0xd299('0xc')]['toLowerCase']()==='in'||_0x5bef43[_0xd299('0xc')][_0xd299('0xd')]()==='out'&&!_0x5bef43[_0xd299('0xe')]&&!_['isNil'](_0x5bef43['UserId'])){_0x26a6f0[_0xd299('0xf')][_0xd299('0x10')]({'where':{'id':_0x5bef43[_0xd299('0x11')]}})[_0xd299('0x12')](function(_0x228361){if(_0x228361){_0x228361[_0xd299('0x13')]({'lastMsgAt':_0x5bef43[_0xd299('0x14')],'lastMsgDirection':_0x5bef43[_0xd299('0xc')]['toLowerCase']()});}})[_0xd299('0x15')](function(_0x265f4e){console['error'](_0x265f4e);});}_0x353215();}},'charset':_0xd299('0x16'),'collate':_0xd299('0x17')});}; \ No newline at end of file +var _0x2dfd=['direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','chat_messages','fti_chat_messages','body','FULLTEXT'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x2dfd,0x12f));var _0xd2df=function(_0x3e0232,_0x5b968b){_0x3e0232=_0x3e0232-0x0;var _0x192e4b=_0x2dfd[_0x3e0232];return _0x192e4b;};'use strict';var _=require(_0xd2df('0x0'));var util=require(_0xd2df('0x1'));var logger=require(_0xd2df('0x2'))('api');var moment=require(_0xd2df('0x3'));var BPromise=require(_0xd2df('0x4'));var rp=require(_0xd2df('0x5'));var fs=require('fs');var path=require(_0xd2df('0x6'));var rimraf=require(_0xd2df('0x7'));var config=require(_0xd2df('0x8'));var attributes=require(_0xd2df('0x9'));module[_0xd2df('0xa')]=function(_0xaadff2,_0x48b910){return _0xaadff2[_0xd2df('0xb')]('ChatMessage',attributes,{'tableName':_0xd2df('0xc'),'paranoid':![],'indexes':[{'name':_0xd2df('0xd'),'fields':[_0xd2df('0xe')],'type':_0xd2df('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x71902d,_0xd161df,_0x3cb777){var _0x28266f=_0xaadff2['models'];var _0x2641f6=_0x71902d['get']({'plain':!![]});if(_0x2641f6[_0xd2df('0x10')][_0xd2df('0x11')]()==='in'||_0x2641f6[_0xd2df('0x10')][_0xd2df('0x11')]()===_0xd2df('0x12')&&!_0x2641f6[_0xd2df('0x13')]&&!_[_0xd2df('0x14')](_0x2641f6[_0xd2df('0x15')])){_0x28266f[_0xd2df('0x16')][_0xd2df('0x17')]({'where':{'id':_0x2641f6[_0xd2df('0x18')]}})[_0xd2df('0x19')](function(_0x392574){if(_0x392574){_0x392574['update']({'lastMsgAt':_0x2641f6['createdAt'],'lastMsgDirection':_0x2641f6[_0xd2df('0x10')][_0xd2df('0x11')]()});}})[_0xd2df('0x1a')](function(_0x50c347){console[_0xd2df('0x1b')](_0x50c347);});}_0x3cb777();}},'charset':'utf8mb4','collate':_0xd2df('0x1c')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index d455408..01fc869 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 _0xa894=['redis','defaults','localhost','socket.io-emitter','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatMessage,\x20%s,\x20%s','message','result','catch','CreateChatMessage','create','body','options','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x2ef251,_0x3687e5){var _0x5c931b=function(_0x3e1e36){while(--_0x3e1e36){_0x2ef251['push'](_0x2ef251['shift']());}};_0x5c931b(++_0x3687e5);}(_0xa894,0x1d6));var _0x4a89=function(_0x5b445b,_0xd251da){_0x5b445b=_0x5b445b-0x0;var _0x1a40fe=_0xa894[_0x5b445b];return _0x1a40fe;};'use strict';var _=require(_0x4a89('0x0'));var util=require(_0x4a89('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4a89('0x2'));var fs=require('fs');var Redis=require(_0x4a89('0x3'));var db=require(_0x4a89('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4a89('0x5'))(_0x4a89('0x6'));var config=require(_0x4a89('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4a89('0x8')][_0x4a89('0x9')]({'port':0x232a});config[_0x4a89('0xa')]=_[_0x4a89('0xb')](config[_0x4a89('0xa')],{'host':_0x4a89('0xc'),'port':0x18eb});var socket=require(_0x4a89('0xd'))(new Redis(config[_0x4a89('0xa')]));require('./chatMessage.socket')['register'](socket);function respondWithRpcPromise(_0x40da1b,_0x72d745,_0x1d21eb){return new BPromise(function(_0xe47002,_0x562940){return client[_0x4a89('0xe')](_0x40da1b,_0x1d21eb)[_0x4a89('0xf')](function(_0x47a212){logger[_0x4a89('0x10')]('ChatMessage,\x20%s,\x20%s',_0x72d745,_0x4a89('0x11'));logger[_0x4a89('0x12')](_0x4a89('0x13'),_0x72d745,_0x4a89('0x11'),JSON[_0x4a89('0x14')](_0x47a212));if(_0x47a212[_0x4a89('0x15')]){if(_0x47a212[_0x4a89('0x15')]['code']===0x1f4){logger['error'](_0x4a89('0x16'),_0x72d745,_0x47a212[_0x4a89('0x15')][_0x4a89('0x17')]);return _0x562940(_0x47a212[_0x4a89('0x15')][_0x4a89('0x17')]);}logger['error'](_0x4a89('0x16'),_0x72d745,_0x47a212[_0x4a89('0x15')]['message']);return _0xe47002(_0x47a212[_0x4a89('0x15')][_0x4a89('0x17')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x72d745,_0x4a89('0x11'));_0xe47002(_0x47a212[_0x4a89('0x18')][_0x4a89('0x17')]);}})[_0x4a89('0x19')](function(_0x71d8c6){logger[_0x4a89('0x15')](_0x4a89('0x16'),_0x72d745,_0x71d8c6);_0x562940(_0x71d8c6);});});}exports[_0x4a89('0x1a')]=function(_0x60dbf8){var _0x512dcd=this;return new Promise(function(_0x24a68d,_0x498ef5){return db['ChatMessage'][_0x4a89('0x1b')](_0x60dbf8[_0x4a89('0x1c')],{'raw':_0x60dbf8[_0x4a89('0x1d')]?_0x60dbf8[_0x4a89('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x4a89('0xf')](function(_0x1ef55b){logger[_0x4a89('0x10')]('CreateChatMessage',_0x60dbf8);logger['debug']('CreateChatMessage',_0x60dbf8,JSON['stringify'](_0x1ef55b));_0x24a68d(_0x1ef55b);})[_0x4a89('0x19')](function(_0x36eae0){logger['error'](_0x4a89('0x1a'),_0x36eae0['message'],_0x60dbf8);_0x498ef5(_0x512dcd[_0x4a89('0x15')](0x1f4,_0x36eae0['message']));});});}; \ No newline at end of file +var _0xb1cf=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./chatMessage.socket','register','request','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateChatMessage','create','body','options','raw','then','info','util','moment','bluebird','ioredis'];(function(_0x2075c4,_0x434590){var _0x118ffb=function(_0x237a50){while(--_0x237a50){_0x2075c4['push'](_0x2075c4['shift']());}};_0x118ffb(++_0x434590);}(_0xb1cf,0x1cd));var _0xfb1c=function(_0x28b0a4,_0x2ea758){_0x28b0a4=_0x28b0a4-0x0;var _0x105ce6=_0xb1cf[_0x28b0a4];return _0x105ce6;};'use strict';var _=require('lodash');var util=require(_0xfb1c('0x0'));var moment=require(_0xfb1c('0x1'));var BPromise=require(_0xfb1c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb1c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfb1c('0x4'));var logger=require(_0xfb1c('0x5'))('rpc');var config=require(_0xfb1c('0x6'));var jayson=require(_0xfb1c('0x7'));var client=jayson['client'][_0xfb1c('0x8')]({'port':0x232a});config[_0xfb1c('0x9')]=_[_0xfb1c('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfb1c('0xb'))(new Redis(config[_0xfb1c('0x9')]));require(_0xfb1c('0xc'))[_0xfb1c('0xd')](socket);function respondWithRpcPromise(_0x4d0bec,_0x12f5df,_0x47cd24){return new BPromise(function(_0x4d5dd0,_0x35422e){return client[_0xfb1c('0xe')](_0x4d0bec,_0x47cd24)['then'](function(_0x1a6736){logger['info'](_0xfb1c('0xf'),_0x12f5df,_0xfb1c('0x10'));logger[_0xfb1c('0x11')](_0xfb1c('0x12'),_0x12f5df,'request\x20sent',JSON[_0xfb1c('0x13')](_0x1a6736));if(_0x1a6736[_0xfb1c('0x14')]){if(_0x1a6736[_0xfb1c('0x14')][_0xfb1c('0x15')]===0x1f4){logger['error'](_0xfb1c('0xf'),_0x12f5df,_0x1a6736['error'][_0xfb1c('0x16')]);return _0x35422e(_0x1a6736[_0xfb1c('0x14')]['message']);}logger[_0xfb1c('0x14')](_0xfb1c('0xf'),_0x12f5df,_0x1a6736[_0xfb1c('0x14')][_0xfb1c('0x16')]);return _0x4d5dd0(_0x1a6736[_0xfb1c('0x14')][_0xfb1c('0x16')]);}else{logger['info'](_0xfb1c('0xf'),_0x12f5df,_0xfb1c('0x10'));_0x4d5dd0(_0x1a6736['result'][_0xfb1c('0x16')]);}})[_0xfb1c('0x17')](function(_0xfc2bde){logger['error'](_0xfb1c('0xf'),_0x12f5df,_0xfc2bde);_0x35422e(_0xfc2bde);});});}exports[_0xfb1c('0x18')]=function(_0x33d72a){var _0x2d1dc3=this;return new Promise(function(_0x227508,_0x5ae9dd){return db['ChatMessage'][_0xfb1c('0x19')](_0x33d72a[_0xfb1c('0x1a')],{'raw':_0x33d72a[_0xfb1c('0x1b')]?_0x33d72a[_0xfb1c('0x1b')][_0xfb1c('0x1c')]===undefined?!![]:![]:!![]})[_0xfb1c('0x1d')](function(_0x2dbef5){logger[_0xfb1c('0x1e')](_0xfb1c('0x18'),_0x33d72a);logger[_0xfb1c('0x11')]('CreateChatMessage',_0x33d72a,JSON[_0xfb1c('0x13')](_0x2dbef5));_0x227508(_0x2dbef5);})[_0xfb1c('0x17')](function(_0x355382){logger[_0xfb1c('0x14')](_0xfb1c('0x18'),_0x355382[_0xfb1c('0x16')],_0x33d72a);_0x5ae9dd(_0x2d1dc3[_0xfb1c('0x14')](0x1f4,_0x355382[_0xfb1c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 72d5e24..16b23cc 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 _0xb458=['length','./chatMessage.events','save','remove','emit','removeListener'];(function(_0x3d6294,_0x30bb31){var _0x168eff=function(_0x1d528d){while(--_0x1d528d){_0x3d6294['push'](_0x3d6294['shift']());}};_0x168eff(++_0x30bb31);}(_0xb458,0x103));var _0x8b45=function(_0x2de369,_0x47abbd){_0x2de369=_0x2de369-0x0;var _0xf18da1=_0xb458[_0x2de369];return _0xf18da1;};'use strict';var ChatMessageEvents=require(_0x8b45('0x0'));var events=[_0x8b45('0x1'),_0x8b45('0x2'),'update'];function createListener(_0x58a508,_0xdf89d4){return function(_0x93d9cd){_0xdf89d4[_0x8b45('0x3')](_0x58a508,_0x93d9cd);};}function removeListener(_0x13a8c6,_0x5d51e4){return function(){ChatMessageEvents[_0x8b45('0x4')](_0x13a8c6,_0x5d51e4);};}exports['register']=function(_0x5cc2d5){for(var _0xe8d774=0x0,_0x12bd05=events[_0x8b45('0x5')];_0xe8d774<_0x12bd05;_0xe8d774++){var _0x3a8ccb=events[_0xe8d774];var _0x32342f=createListener('chatMessage:'+_0x3a8ccb,_0x5cc2d5);ChatMessageEvents['on'](_0x3a8ccb,_0x32342f);}}; \ No newline at end of file +var _0x3645=['emit','removeListener','register','length','save','remove','update'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x3645,0x154));var _0x5364=function(_0xc7348b,_0x145880){_0xc7348b=_0xc7348b-0x0;var _0x307cec=_0x3645[_0xc7348b];return _0x307cec;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x5364('0x0'),_0x5364('0x1'),_0x5364('0x2')];function createListener(_0x28eafb,_0x2d71d7){return function(_0x2f629b){_0x2d71d7[_0x5364('0x3')](_0x28eafb,_0x2f629b);};}function removeListener(_0x5a63bf,_0x334a16){return function(){ChatMessageEvents[_0x5364('0x4')](_0x5a63bf,_0x334a16);};}exports[_0x5364('0x5')]=function(_0x1f9c6b){for(var _0x417c44=0x0,_0x7933a5=events[_0x5364('0x6')];_0x417c44<_0x7933a5;_0x417c44++){var _0x43fb3f=events[_0x417c44];var _0x3c1b21=createListener('chatMessage:'+_0x43fb3f,_0x1f9c6b);ChatMessageEvents['on'](_0x43fb3f,_0x3c1b21);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 71b70f5..f9edcea 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 _0xff88=['/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','/describe','describe','show','post','tracked','chat','chatmessage:create','create','put'];(function(_0x16e3ae,_0x56c581){var _0x5dbff6=function(_0x2d098f){while(--_0x2d098f){_0x16e3ae['push'](_0x16e3ae['shift']());}};_0x5dbff6(++_0x56c581);}(_0xff88,0xe1));var _0x8ff8=function(_0xe6b6e7,_0x3dc462){_0xe6b6e7=_0xe6b6e7-0x0;var _0x44c1ae=_0xff88[_0xe6b6e7];return _0x44c1ae;};'use strict';var multer=require(_0x8ff8('0x0'));var util=require(_0x8ff8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8ff8('0x2'));var router=express['Router']();var fs_extra=require(_0x8ff8('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x8ff8('0x4'));var config=require(_0x8ff8('0x5'));var controller=require(_0x8ff8('0x6'));router[_0x8ff8('0x7')]('/',auth[_0x8ff8('0x8')](),controller['index']);router[_0x8ff8('0x7')](_0x8ff8('0x9'),auth[_0x8ff8('0x8')](),controller[_0x8ff8('0xa')]);router[_0x8ff8('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x8ff8('0xb')]);router[_0x8ff8('0xc')]('/',auth[_0x8ff8('0x8')](),interaction[_0x8ff8('0xd')](_0x8ff8('0xe'),_0x8ff8('0xf')),controller[_0x8ff8('0x10')]);router[_0x8ff8('0x11')](_0x8ff8('0x12'),controller[_0x8ff8('0x13')]);router[_0x8ff8('0x11')](_0x8ff8('0x14'),auth[_0x8ff8('0x8')](),controller[_0x8ff8('0x15')]);router[_0x8ff8('0x11')](_0x8ff8('0x16'),auth[_0x8ff8('0x8')](),controller[_0x8ff8('0x17')]);router[_0x8ff8('0x18')](_0x8ff8('0x12'),auth['isAuthenticated'](),controller[_0x8ff8('0x19')]);module[_0x8ff8('0x1a')]=router; \ No newline at end of file +var _0x36dc=['create','put','/:id/accept','accept','/:id/reject','reject','delete','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','tracked','chat','chatmessage:create'];(function(_0x591951,_0x25ef76){var _0x13bf78=function(_0x436148){while(--_0x436148){_0x591951['push'](_0x591951['shift']());}};_0x13bf78(++_0x25ef76);}(_0x36dc,0x173));var _0xc36d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x36dc[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xc36d('0x0'));var util=require(_0xc36d('0x1'));var path=require(_0xc36d('0x2'));var timeout=require(_0xc36d('0x3'));var express=require(_0xc36d('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc36d('0x5'));var interaction=require(_0xc36d('0x6'));var config=require(_0xc36d('0x7'));var controller=require(_0xc36d('0x8'));router[_0xc36d('0x9')]('/',auth[_0xc36d('0xa')](),controller[_0xc36d('0xb')]);router['get']('/describe',auth[_0xc36d('0xa')](),controller[_0xc36d('0xc')]);router[_0xc36d('0x9')](_0xc36d('0xd'),auth[_0xc36d('0xa')](),controller[_0xc36d('0xe')]);router[_0xc36d('0xf')]('/',auth[_0xc36d('0xa')](),interaction[_0xc36d('0x10')](_0xc36d('0x11'),_0xc36d('0x12')),controller[_0xc36d('0x13')]);router[_0xc36d('0x14')](_0xc36d('0xd'),controller['update']);router[_0xc36d('0x14')](_0xc36d('0x15'),auth[_0xc36d('0xa')](),controller[_0xc36d('0x16')]);router['put'](_0xc36d('0x17'),auth['isAuthenticated'](),controller[_0xc36d('0x18')]);router[_0xc36d('0x19')](_0xc36d('0xd'),auth[_0xc36d('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index f8ff8ab..802cb5e 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 _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0x3529ab,_0x2dff17){var _0x25812d=function(_0x4b8efe){while(--_0x4b8efe){_0x3529ab['push'](_0x3529ab['shift']());}};_0x25812d(++_0x2dff17);}(_0xdb28,0x106));var _0x8db2=function(_0x369509,_0x1b8a2c){_0x369509=_0x369509-0x0;var _0x566b81=_0xdb28[_0x369509];return _0x566b81;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8db2('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x2032=['medium','exports','TEXT'];(function(_0x107790,_0x4e5fa6){var _0x2d79dc=function(_0x1fe72c){while(--_0x1fe72c){_0x107790['push'](_0x107790['shift']());}};_0x2d79dc(++_0x4e5fa6);}(_0x2032,0xd9));var _0x2203=function(_0x53f613,_0x3e6779){_0x53f613=_0x53f613-0x0;var _0x521009=_0x2032[_0x53f613];return _0x521009;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'body':{'type':Sequelize[_0x2203('0x1')](_0x2203('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2203('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 8c7ab95..d58dd14 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(_0x318189,_0x4b5b4a){var _0x2ed691=function(_0x594458){while(--_0x594458){_0x318189['push'](_0x318189['shift']());}};_0x2ed691(++_0x4b5b4a);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){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(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x7a54,0x106));var _0x47a5=function(_0x585567,_0x391cb5){_0x585567=_0x585567-0x0;var _0x592bc1=_0x7a54[_0x585567];return _0x592bc1;};'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 7b56078..16c7965 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 _0x8bf3=['ChatOfflineMessage','setMaxListeners','save','update','remove','emit','hook','events','../../mysqldb'];(function(_0x18eb0b,_0x11077e){var _0x1ddc58=function(_0x42dffa){while(--_0x42dffa){_0x18eb0b['push'](_0x18eb0b['shift']());}};_0x1ddc58(++_0x11077e);}(_0x8bf3,0x130));var _0x38bf=function(_0x4e1d6a,_0x3e3ec2){_0x4e1d6a=_0x4e1d6a-0x0;var _0x11c465=_0x8bf3[_0x4e1d6a];return _0x11c465;};'use strict';var EventEmitter=require(_0x38bf('0x0'));var ChatOfflineMessage=require(_0x38bf('0x1'))['db'][_0x38bf('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x38bf('0x3')](0x0);var events={'afterCreate':_0x38bf('0x4'),'afterUpdate':_0x38bf('0x5'),'afterDestroy':_0x38bf('0x6')};function emitEvent(_0x364dda){return function(_0xbf6785,_0x47db9b,_0x2e1579){ChatOfflineMessageEvents[_0x38bf('0x7')](_0x364dda+':'+_0xbf6785['id'],_0xbf6785);ChatOfflineMessageEvents[_0x38bf('0x7')](_0x364dda,_0xbf6785);_0x2e1579(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x38bf('0x8')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0xe083=['../../mysqldb','ChatOfflineMessage','setMaxListeners','update','remove','emit','hook','exports','events'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xe083,0x1a6));var _0x3e08=function(_0x50ab5d,_0x456384){_0x50ab5d=_0x50ab5d-0x0;var _0x2adbff=_0xe083[_0x50ab5d];return _0x2adbff;};'use strict';var EventEmitter=require(_0x3e08('0x0'));var ChatOfflineMessage=require(_0x3e08('0x1'))['db'][_0x3e08('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x3e08('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3e08('0x4'),'afterDestroy':_0x3e08('0x5')};function emitEvent(_0x23f47e){return function(_0x1f54b0,_0x39fd20,_0x376434){ChatOfflineMessageEvents[_0x3e08('0x6')](_0x23f47e+':'+_0x1f54b0['id'],_0x1f54b0);ChatOfflineMessageEvents[_0x3e08('0x6')](_0x23f47e,_0x1f54b0);_0x376434(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x3e08('0x7')](e,emitEvent(event));}}module[_0x3e08('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 75afdd3..057e469 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 _0x428e=['define','ChatOfflineMessage','utf8mb4_unicode_ci'];(function(_0x1f95f4,_0x4dd400){var _0x14e784=function(_0x4c206f){while(--_0x4c206f){_0x1f95f4['push'](_0x1f95f4['shift']());}};_0x14e784(++_0x4dd400);}(_0x428e,0x1c2));var _0xe428=function(_0x71e493,_0x4308b7){_0x71e493=_0x71e493-0x0;var _0x3d40ab=_0x428e[_0x71e493];return _0x3d40ab;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module['exports']=function(_0x11a3b2){return _0x11a3b2[_0xe428('0x0')](_0xe428('0x1'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe428('0x2')});}; \ No newline at end of file +var _0x1293=['utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage'];(function(_0xc06a59,_0x439dde){var _0x4cf9c0=function(_0x3ac6b3){while(--_0x3ac6b3){_0xc06a59['push'](_0xc06a59['shift']());}};_0x4cf9c0(++_0x439dde);}(_0x1293,0x1a6));var _0x3129=function(_0x7bf1fa,_0x3b87ce){_0x7bf1fa=_0x7bf1fa-0x0;var _0x32fe30=_0x1293[_0x7bf1fa];return _0x32fe30;};'use strict';var attributes=require(_0x3129('0x0'));module[_0x3129('0x1')]=function(_0x582834){return _0x582834[_0x3129('0x2')](_0x3129('0x3'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3129('0x4'),'collate':_0x3129('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 2e916ba..d4631ad 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 _0x9ac9=['message','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','ChatOfflineMessage,\x20%s,\x20%s'];(function(_0xad302d,_0x265208){var _0x2981e5=function(_0x312841){while(--_0x312841){_0xad302d['push'](_0xad302d['shift']());}};_0x2981e5(++_0x265208);}(_0x9ac9,0x1b9));var _0x99ac=function(_0x1bfac7,_0x5ee868){_0x1bfac7=_0x1bfac7-0x0;var _0x54c735=_0x9ac9[_0x1bfac7];return _0x54c735;};'use strict';var _=require(_0x99ac('0x0'));var util=require('util');var moment=require(_0x99ac('0x1'));var BPromise=require(_0x99ac('0x2'));var rs=require(_0x99ac('0x3'));var fs=require('fs');var Redis=require(_0x99ac('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x99ac('0x5'));var logger=require('../../config/logger')(_0x99ac('0x6'));var config=require(_0x99ac('0x7'));var jayson=require(_0x99ac('0x8'));var client=jayson[_0x99ac('0x9')][_0x99ac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1811ea,_0x2dcad3,_0x4da379){return new BPromise(function(_0x41df2f,_0x3b86ae){return client[_0x99ac('0xb')](_0x1811ea,_0x4da379)[_0x99ac('0xc')](function(_0x463715){logger[_0x99ac('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2dcad3,_0x99ac('0xe'));logger['debug'](_0x99ac('0xf'),_0x2dcad3,_0x99ac('0xe'),JSON['stringify'](_0x463715));if(_0x463715['error']){if(_0x463715[_0x99ac('0x10')][_0x99ac('0x11')]===0x1f4){logger['error'](_0x99ac('0x12'),_0x2dcad3,_0x463715[_0x99ac('0x10')]['message']);return _0x3b86ae(_0x463715[_0x99ac('0x10')]['message']);}logger['error'](_0x99ac('0x12'),_0x2dcad3,_0x463715[_0x99ac('0x10')][_0x99ac('0x13')]);return _0x41df2f(_0x463715[_0x99ac('0x10')][_0x99ac('0x13')]);}else{logger[_0x99ac('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2dcad3,'request\x20sent');_0x41df2f(_0x463715['result'][_0x99ac('0x13')]);}})['catch'](function(_0x5a5e0d){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x2dcad3,_0x5a5e0d);_0x3b86ae(_0x5a5e0d);});});} \ No newline at end of file +var _0x522b=['rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','lodash','util','bluebird','../../mysqldb','../../config/utils'];(function(_0x2aeb21,_0x2f8511){var _0x38dbb3=function(_0x34a8dd){while(--_0x34a8dd){_0x2aeb21['push'](_0x2aeb21['shift']());}};_0x38dbb3(++_0x2f8511);}(_0x522b,0x1c3));var _0xb522=function(_0x27e811,_0x20137c){_0x27e811=_0x27e811-0x0;var _0x1627fa=_0x522b[_0x27e811];return _0x1627fa;};'use strict';var _=require(_0xb522('0x0'));var util=require(_0xb522('0x1'));var moment=require('moment');var BPromise=require(_0xb522('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb522('0x3'))['db'];var utils=require(_0xb522('0x4'));var logger=require('../../config/logger')(_0xb522('0x5'));var config=require(_0xb522('0x6'));var jayson=require(_0xb522('0x7'));var client=jayson[_0xb522('0x8')][_0xb522('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55a5f0,_0x446229,_0x2f289f){return new BPromise(function(_0x5a5cd3,_0x55259d){return client[_0xb522('0xa')](_0x55a5f0,_0x2f289f)['then'](function(_0x3f4f63){logger[_0xb522('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x446229,_0xb522('0xc'));logger[_0xb522('0xd')](_0xb522('0xe'),_0x446229,'request\x20sent',JSON['stringify'](_0x3f4f63));if(_0x3f4f63[_0xb522('0xf')]){if(_0x3f4f63[_0xb522('0xf')][_0xb522('0x10')]===0x1f4){logger['error'](_0xb522('0x11'),_0x446229,_0x3f4f63['error'][_0xb522('0x12')]);return _0x55259d(_0x3f4f63[_0xb522('0xf')]['message']);}logger[_0xb522('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x446229,_0x3f4f63[_0xb522('0xf')][_0xb522('0x12')]);return _0x5a5cd3(_0x3f4f63[_0xb522('0xf')][_0xb522('0x12')]);}else{logger[_0xb522('0xb')](_0xb522('0x11'),_0x446229,_0xb522('0xc'));_0x5a5cd3(_0x3f4f63['result'][_0xb522('0x12')]);}})['catch'](function(_0x435f25){logger[_0xb522('0xf')](_0xb522('0x11'),_0x446229,_0x435f25);_0x55259d(_0x435f25);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 668ef40..b0bb4d7 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 _0xe2b6=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x258f46,_0xd27ae3){var _0x1e2a2f=function(_0x3e8897){while(--_0x3e8897){_0x258f46['push'](_0x258f46['shift']());}};_0x1e2a2f(++_0xd27ae3);}(_0xe2b6,0x135));var _0x6e2b=function(_0x2dbbea,_0x17ffc9){_0x2dbbea=_0x2dbbea-0x0;var _0x496b00=_0xe2b6[_0x2dbbea];return _0x496b00;};'use strict';var multer=require(_0x6e2b('0x0'));var util=require(_0x6e2b('0x1'));var path=require(_0x6e2b('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e2b('0x3'));var router=express[_0x6e2b('0x4')]();var fs_extra=require(_0x6e2b('0x5'));var auth=require(_0x6e2b('0x6'));var interaction=require(_0x6e2b('0x7'));var config=require('../../config/environment');var controller=require(_0x6e2b('0x8'));router[_0x6e2b('0x9')]('/',auth[_0x6e2b('0xa')](),controller[_0x6e2b('0xb')]);router[_0x6e2b('0x9')](_0x6e2b('0xc'),auth[_0x6e2b('0xa')](),controller['describe']);router[_0x6e2b('0x9')](_0x6e2b('0xd'),auth[_0x6e2b('0xa')](),controller[_0x6e2b('0xe')]);router[_0x6e2b('0xf')]('/',auth[_0x6e2b('0xa')](),controller[_0x6e2b('0x10')]);router[_0x6e2b('0x11')]('/:id',auth[_0x6e2b('0xa')](),controller[_0x6e2b('0x12')]);router[_0x6e2b('0x13')](_0x6e2b('0xd'),auth[_0x6e2b('0xa')](),controller[_0x6e2b('0x14')]);module[_0x6e2b('0x15')]=router; \ No newline at end of file +var _0x62f6=['post','create','put','update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x14c08e,_0x4720a8){var _0x155bd7=function(_0x20a317){while(--_0x20a317){_0x14c08e['push'](_0x14c08e['shift']());}};_0x155bd7(++_0x4720a8);}(_0x62f6,0x16a));var _0x662f=function(_0xd0a3fa,_0x57c5ab){_0xd0a3fa=_0xd0a3fa-0x0;var _0x49feca=_0x62f6[_0xd0a3fa];return _0x49feca;};'use strict';var multer=require('multer');var util=require(_0x662f('0x0'));var path=require(_0x662f('0x1'));var timeout=require(_0x662f('0x2'));var express=require(_0x662f('0x3'));var router=express[_0x662f('0x4')]();var fs_extra=require(_0x662f('0x5'));var auth=require(_0x662f('0x6'));var interaction=require(_0x662f('0x7'));var config=require(_0x662f('0x8'));var controller=require(_0x662f('0x9'));router[_0x662f('0xa')]('/',auth[_0x662f('0xb')](),controller['index']);router[_0x662f('0xa')](_0x662f('0xc'),auth[_0x662f('0xb')](),controller[_0x662f('0xd')]);router[_0x662f('0xa')](_0x662f('0xe'),auth['isAuthenticated'](),controller[_0x662f('0xf')]);router[_0x662f('0x10')]('/',auth[_0x662f('0xb')](),controller[_0x662f('0x11')]);router[_0x662f('0x12')](_0x662f('0xe'),auth[_0x662f('0xb')](),controller[_0x662f('0x13')]);router[_0x662f('0x14')](_0x662f('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index b3f1c00..1ceba6a 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 _0x464b=['INTEGER','STRING','mouseOver','timeout'];(function(_0x2f4b07,_0x5c1d23){var _0x10c313=function(_0x52314e){while(--_0x52314e){_0x2f4b07['push'](_0x2f4b07['shift']());}};_0x10c313(++_0x5c1d23);}(_0x464b,0x1f1));var _0xb464=function(_0x1c459f,_0x712186){_0x1c459f=_0x1c459f-0x0;var _0x5b4138=_0x464b[_0x1c459f];return _0x5b4138;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb464('0x0')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xb464('0x1'),_0xb464('0x2')),'defaultValue':_0xb464('0x1')},'selector':{'type':Sequelize[_0xb464('0x0')]},'timeout':{'type':Sequelize[_0xb464('0x3')]}}; \ No newline at end of file +var _0x6742=['mouseOver','timeout','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x5e4563,_0x3ff918){var _0x8d1bf5=function(_0x3bf7a9){while(--_0x3bf7a9){_0x5e4563['push'](_0x5e4563['shift']());}};_0x8d1bf5(++_0x3ff918);}(_0x6742,0xff));var _0x2674=function(_0x3bcfe5,_0x435367){_0x3bcfe5=_0x3bcfe5-0x0;var _0x589373=_0x6742[_0x3bcfe5];return _0x589373;};'use strict';var Sequelize=require(_0x2674('0x0'));module[_0x2674('0x1')]={'name':{'type':Sequelize[_0x2674('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2674('0x3')](_0x2674('0x4'),_0x2674('0x5')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x2674('0x2')]},'timeout':{'type':Sequelize[_0x2674('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 16001ea..304642f 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 _0xbdfd=['find','create','body','catch','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','include'];(function(_0x1e6346,_0x57ccbd){var _0x770c06=function(_0x4a9aa9){while(--_0x4a9aa9){_0x1e6346['push'](_0x1e6346['shift']());}};_0x770c06(++_0x57ccbd);}(_0xbdfd,0x135));var _0xdbdf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbdfd[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xdbdf('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdbdf('0x1'));var rp=require(_0xdbdf('0x2'));var moment=require(_0xdbdf('0x3'));var BPromise=require(_0xdbdf('0x4'));var Mustache=require('mustache');var util=require(_0xdbdf('0x5'));var path=require(_0xdbdf('0x6'));var sox=require('sox');var csv=require(_0xdbdf('0x7'));var ejs=require(_0xdbdf('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdbdf('0x9'));var squel=require(_0xdbdf('0xa'));var crypto=require(_0xdbdf('0xb'));var jsforce=require(_0xdbdf('0xc'));var deskjs=require(_0xdbdf('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdbdf('0xe'));var Papa=require(_0xdbdf('0xf'));var Redis=require(_0xdbdf('0x10'));var authService=require(_0xdbdf('0x11'));var qs=require(_0xdbdf('0x12'));var as=require(_0xdbdf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdbdf('0x14'));var utils=require(_0xdbdf('0x15'));var config=require(_0xdbdf('0x16'));var licenseUtil=require(_0xdbdf('0x17'));var db=require(_0xdbdf('0x18'))['db'];function respondWithStatusCode(_0x244ecd,_0x51212c){_0x51212c=_0x51212c||0xcc;return function(_0x152831){if(_0x152831){return _0x244ecd[_0xdbdf('0x19')](_0x51212c);}return _0x244ecd[_0xdbdf('0x1a')](_0x51212c)[_0xdbdf('0x1b')]();};}function respondWithResult(_0x45b824,_0x24dfde){_0x24dfde=_0x24dfde||0xc8;return function(_0xae4a21){if(_0xae4a21){return _0x45b824['status'](_0x24dfde)[_0xdbdf('0x1c')](_0xae4a21);}};}function respondWithFilteredResult(_0x127060,_0x98c104){return function(_0x173a18){if(_0x173a18){var _0x216c58=typeof _0x98c104['offset']===_0xdbdf('0x1d')&&typeof _0x98c104[_0xdbdf('0x1e')]===_0xdbdf('0x1d');var _0x282e4e=_0x173a18[_0xdbdf('0x1f')];var _0x439f87=_0x216c58?0x0:_0x98c104[_0xdbdf('0x20')];var _0x195c66=_0x216c58?_0x173a18[_0xdbdf('0x1f')]:_0x98c104[_0xdbdf('0x20')]+_0x98c104[_0xdbdf('0x1e')];var _0xe70149;if(_0x195c66>=_0x282e4e){_0x195c66=_0x282e4e;_0xe70149=0xc8;}else{_0xe70149=0xce;}_0x127060['status'](_0xe70149);return _0x127060[_0xdbdf('0x21')](_0xdbdf('0x22'),_0x439f87+'-'+_0x195c66+'/'+_0x282e4e)[_0xdbdf('0x1c')](_0x173a18);}return null;};}function patchUpdates(_0x2b6fe3){return function(_0x1670b3){try{jsonpatch[_0xdbdf('0x23')](_0x1670b3,_0x2b6fe3,!![]);}catch(_0x3dc35a){return BPromise[_0xdbdf('0x24')](_0x3dc35a);}return _0x1670b3['save']();};}function saveUpdates(_0x44d1d2,_0x2737e5){return function(_0x30a9fd){if(_0x30a9fd){return _0x30a9fd[_0xdbdf('0x25')](_0x44d1d2)['then'](function(_0x3b91ea){return _0x3b91ea;});}return null;};}function removeEntity(_0x3f02b8,_0x237d86){return function(_0x563628){if(_0x563628){return _0x563628[_0xdbdf('0x26')]()[_0xdbdf('0x27')](function(){_0x3f02b8[_0xdbdf('0x1a')](0xcc)[_0xdbdf('0x1b')]();});}};}function handleEntityNotFound(_0x5219f9,_0x3446f2){return function(_0x41c6e1){if(!_0x41c6e1){_0x5219f9[_0xdbdf('0x19')](0x194);}return _0x41c6e1;};}function handleError(_0x23b080,_0x1bc27b){_0x1bc27b=_0x1bc27b||0x1f4;return function(_0xcd0ee7){logger[_0xdbdf('0x28')](_0xcd0ee7[_0xdbdf('0x29')]);if(_0xcd0ee7[_0xdbdf('0x2a')]){delete _0xcd0ee7[_0xdbdf('0x2a')];}_0x23b080['status'](_0x1bc27b)['send'](_0xcd0ee7);};}exports[_0xdbdf('0x2b')]=function(_0x501ca8,_0x1995e0){var _0xfa1cd9={'raw':!![],'where':{'id':_0x501ca8[_0xdbdf('0x2c')]['id']}},_0x1ea57e={};_0x1ea57e[_0xdbdf('0x2d')]=_[_0xdbdf('0x2e')](db[_0xdbdf('0x2f')][_0xdbdf('0x30')]);_0x1ea57e[_0xdbdf('0x31')]=_['keys'](_0x501ca8[_0xdbdf('0x31')]);_0x1ea57e[_0xdbdf('0x32')]=_['intersection'](_0x1ea57e[_0xdbdf('0x2d')],_0x1ea57e[_0xdbdf('0x31')]);_0xfa1cd9[_0xdbdf('0x33')]=_[_0xdbdf('0x34')](_0x1ea57e[_0xdbdf('0x2d')],qs['fields'](_0x501ca8[_0xdbdf('0x31')][_0xdbdf('0x35')]));_0xfa1cd9['attributes']=_0xfa1cd9[_0xdbdf('0x33')][_0xdbdf('0x36')]?_0xfa1cd9[_0xdbdf('0x33')]:_0x1ea57e[_0xdbdf('0x2d')];if(_0x501ca8[_0xdbdf('0x31')][_0xdbdf('0x37')]){_0xfa1cd9[_0xdbdf('0x38')]=[{'all':!![]}];}_0xfa1cd9=_['merge']({},_0xfa1cd9,_0x501ca8['options']);return db['ChatProactiveAction'][_0xdbdf('0x39')](_0xfa1cd9)['then'](handleEntityNotFound(_0x1995e0,null))[_0xdbdf('0x27')](respondWithResult(_0x1995e0,null))['catch'](handleError(_0x1995e0,null));};exports['create']=function(_0x35f315,_0xa1a99c){return db[_0xdbdf('0x2f')][_0xdbdf('0x3a')](_0x35f315[_0xdbdf('0x3b')],{})[_0xdbdf('0x27')](respondWithResult(_0xa1a99c,0xc9))[_0xdbdf('0x3c')](handleError(_0xa1a99c,null));};exports['update']=function(_0x1025df,_0x1ae043){if(_0x1025df[_0xdbdf('0x3b')]['id']){delete _0x1025df[_0xdbdf('0x3b')]['id'];}return db[_0xdbdf('0x2f')][_0xdbdf('0x39')]({'where':{'id':_0x1025df[_0xdbdf('0x2c')]['id']}})[_0xdbdf('0x27')](handleEntityNotFound(_0x1ae043,null))['then'](saveUpdates(_0x1025df[_0xdbdf('0x3b')],null))[_0xdbdf('0x27')](respondWithResult(_0x1ae043,null))['catch'](handleError(_0x1ae043,null));};exports[_0xdbdf('0x26')]=function(_0x15f842,_0xf9bcae){return db[_0xdbdf('0x2f')]['find']({'where':{'id':_0x15f842[_0xdbdf('0x2c')]['id']}})['then'](handleEntityNotFound(_0xf9bcae,null))[_0xdbdf('0x27')](removeEntity(_0xf9bcae,null))['catch'](handleError(_0xf9bcae,null));}; \ No newline at end of file +var _0xa41a=['fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','save','update','destroy','then','error','stack','name','show','params','model','keys','rawAttributes','query','filters','fields','attributes','length','includeAll','include','merge','ChatProactiveAction','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs'];(function(_0x4ea138,_0x379b3d){var _0xfb3c62=function(_0x1d7813){while(--_0x1d7813){_0x4ea138['push'](_0x4ea138['shift']());}};_0xfb3c62(++_0x379b3d);}(_0xa41a,0x6b));var _0xaa41=function(_0x2236d4,_0x26d38b){_0x2236d4=_0x2236d4-0x0;var _0x2bcb12=_0xa41a[_0x2236d4];return _0x2bcb12;};'use strict';var emlformat=require(_0xaa41('0x0'));var rimraf=require(_0xaa41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa41('0x2'));var rp=require(_0xaa41('0x3'));var moment=require(_0xaa41('0x4'));var BPromise=require(_0xaa41('0x5'));var Mustache=require(_0xaa41('0x6'));var util=require(_0xaa41('0x7'));var path=require(_0xaa41('0x8'));var sox=require(_0xaa41('0x9'));var csv=require('to-csv');var ejs=require(_0xaa41('0xa'));var fs=require('fs');var fs_extra=require(_0xaa41('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa41('0xc'));var jsforce=require(_0xaa41('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaa41('0xe'));var querystring=require(_0xaa41('0xf'));var Papa=require(_0xaa41('0x10'));var Redis=require(_0xaa41('0x11'));var authService=require(_0xaa41('0x12'));var qs=require(_0xaa41('0x13'));var as=require(_0xaa41('0x14'));var hardwareService=require(_0xaa41('0x15'));var logger=require(_0xaa41('0x16'))('api');var utils=require(_0xaa41('0x17'));var config=require(_0xaa41('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d0a54,_0x518b5b){_0x518b5b=_0x518b5b||0xcc;return function(_0x19bd69){if(_0x19bd69){return _0x1d0a54[_0xaa41('0x19')](_0x518b5b);}return _0x1d0a54[_0xaa41('0x1a')](_0x518b5b)[_0xaa41('0x1b')]();};}function respondWithResult(_0x6f9ade,_0x4eaf81){_0x4eaf81=_0x4eaf81||0xc8;return function(_0x1e9d7f){if(_0x1e9d7f){return _0x6f9ade[_0xaa41('0x1a')](_0x4eaf81)[_0xaa41('0x1c')](_0x1e9d7f);}};}function respondWithFilteredResult(_0x1ef7d9,_0x2a6988){return function(_0x2005ae){if(_0x2005ae){var _0x1e1e02=typeof _0x2a6988['offset']===_0xaa41('0x1d')&&typeof _0x2a6988[_0xaa41('0x1e')]===_0xaa41('0x1d');var _0x391b01=_0x2005ae[_0xaa41('0x1f')];var _0xd20ddf=_0x1e1e02?0x0:_0x2a6988[_0xaa41('0x20')];var _0x46e6d3=_0x1e1e02?_0x2005ae[_0xaa41('0x1f')]:_0x2a6988['offset']+_0x2a6988['limit'];var _0x1f502a;if(_0x46e6d3>=_0x391b01){_0x46e6d3=_0x391b01;_0x1f502a=0xc8;}else{_0x1f502a=0xce;}_0x1ef7d9[_0xaa41('0x1a')](_0x1f502a);return _0x1ef7d9[_0xaa41('0x21')]('Content-Range',_0xd20ddf+'-'+_0x46e6d3+'/'+_0x391b01)[_0xaa41('0x1c')](_0x2005ae);}return null;};}function patchUpdates(_0x1f692b){return function(_0x4e768e){try{jsonpatch['apply'](_0x4e768e,_0x1f692b,!![]);}catch(_0x1b1910){return BPromise['reject'](_0x1b1910);}return _0x4e768e[_0xaa41('0x22')]();};}function saveUpdates(_0x209c83,_0x3e2175){return function(_0x1f27f3){if(_0x1f27f3){return _0x1f27f3[_0xaa41('0x23')](_0x209c83)['then'](function(_0x43c430){return _0x43c430;});}return null;};}function removeEntity(_0x43a85c,_0x448a21){return function(_0x21f596){if(_0x21f596){return _0x21f596[_0xaa41('0x24')]()[_0xaa41('0x25')](function(){_0x43a85c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16aec5,_0x527cac){return function(_0x493a10){if(!_0x493a10){_0x16aec5[_0xaa41('0x19')](0x194);}return _0x493a10;};}function handleError(_0x59707f,_0x536bed){_0x536bed=_0x536bed||0x1f4;return function(_0x2d0ac0){logger[_0xaa41('0x26')](_0x2d0ac0[_0xaa41('0x27')]);if(_0x2d0ac0[_0xaa41('0x28')]){delete _0x2d0ac0[_0xaa41('0x28')];}_0x59707f[_0xaa41('0x1a')](_0x536bed)['send'](_0x2d0ac0);};}exports[_0xaa41('0x29')]=function(_0x1f0275,_0x63c18c){var _0x9a16e3={'raw':!![],'where':{'id':_0x1f0275[_0xaa41('0x2a')]['id']}},_0x1d8c2b={};_0x1d8c2b[_0xaa41('0x2b')]=_[_0xaa41('0x2c')](db['ChatProactiveAction'][_0xaa41('0x2d')]);_0x1d8c2b['query']=_['keys'](_0x1f0275[_0xaa41('0x2e')]);_0x1d8c2b[_0xaa41('0x2f')]=_['intersection'](_0x1d8c2b[_0xaa41('0x2b')],_0x1d8c2b[_0xaa41('0x2e')]);_0x9a16e3['attributes']=_['intersection'](_0x1d8c2b['model'],qs[_0xaa41('0x30')](_0x1f0275[_0xaa41('0x2e')][_0xaa41('0x30')]));_0x9a16e3[_0xaa41('0x31')]=_0x9a16e3['attributes'][_0xaa41('0x32')]?_0x9a16e3[_0xaa41('0x31')]:_0x1d8c2b[_0xaa41('0x2b')];if(_0x1f0275['query'][_0xaa41('0x33')]){_0x9a16e3[_0xaa41('0x34')]=[{'all':!![]}];}_0x9a16e3=_[_0xaa41('0x35')]({},_0x9a16e3,_0x1f0275['options']);return db[_0xaa41('0x36')][_0xaa41('0x37')](_0x9a16e3)['then'](handleEntityNotFound(_0x63c18c,null))[_0xaa41('0x25')](respondWithResult(_0x63c18c,null))[_0xaa41('0x38')](handleError(_0x63c18c,null));};exports[_0xaa41('0x39')]=function(_0x5cec87,_0x22b272){return db['ChatProactiveAction'][_0xaa41('0x39')](_0x5cec87[_0xaa41('0x3a')],{})[_0xaa41('0x25')](respondWithResult(_0x22b272,0xc9))['catch'](handleError(_0x22b272,null));};exports['update']=function(_0x4cdd42,_0x2dc05a){if(_0x4cdd42[_0xaa41('0x3a')]['id']){delete _0x4cdd42[_0xaa41('0x3a')]['id'];}return db[_0xaa41('0x36')]['find']({'where':{'id':_0x4cdd42['params']['id']}})[_0xaa41('0x25')](handleEntityNotFound(_0x2dc05a,null))[_0xaa41('0x25')](saveUpdates(_0x4cdd42[_0xaa41('0x3a')],null))[_0xaa41('0x25')](respondWithResult(_0x2dc05a,null))[_0xaa41('0x38')](handleError(_0x2dc05a,null));};exports[_0xaa41('0x24')]=function(_0x44a4fc,_0x5e9879){return db[_0xaa41('0x36')][_0xaa41('0x37')]({'where':{'id':_0x44a4fc[_0xaa41('0x2a')]['id']}})[_0xaa41('0x25')](handleEntityNotFound(_0x5e9879,null))['then'](removeEntity(_0x5e9879,null))['catch'](handleError(_0x5e9879,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index b20bfb4..fc6a05f 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 _0x615c=['../../config/logger','api','path','rimraf','./chatProactiveAction.attributes','exports','chat_proactive_actions','lodash','util'];(function(_0x45cc3c,_0x4d1b53){var _0x4d57cc=function(_0x767f7f){while(--_0x767f7f){_0x45cc3c['push'](_0x45cc3c['shift']());}};_0x4d57cc(++_0x4d1b53);}(_0x615c,0x18a));var _0xc615=function(_0x3b0da2,_0x306d66){_0x3b0da2=_0x3b0da2-0x0;var _0x45a240=_0x615c[_0x3b0da2];return _0x45a240;};'use strict';var _=require(_0xc615('0x0'));var util=require(_0xc615('0x1'));var logger=require(_0xc615('0x2'))(_0xc615('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc615('0x4'));var rimraf=require(_0xc615('0x5'));var config=require('../../config/environment');var attributes=require(_0xc615('0x6'));module[_0xc615('0x7')]=function(_0x2b53b6,_0x2b6bed){return _0x2b53b6['define']('ChatProactiveAction',attributes,{'tableName':_0xc615('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3536=['path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','api','moment','bluebird','request-promise'];(function(_0x2abb39,_0xfd3b37){var _0x384af8=function(_0x5a0939){while(--_0x5a0939){_0x2abb39['push'](_0x2abb39['shift']());}};_0x384af8(++_0xfd3b37);}(_0x3536,0x1a9));var _0x6353=function(_0x25601f,_0x40b072){_0x25601f=_0x25601f-0x0;var _0x4d99e0=_0x3536[_0x25601f];return _0x4d99e0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x6353('0x0'));var moment=require(_0x6353('0x1'));var BPromise=require(_0x6353('0x2'));var rp=require(_0x6353('0x3'));var fs=require('fs');var path=require(_0x6353('0x4'));var rimraf=require(_0x6353('0x5'));var config=require(_0x6353('0x6'));var attributes=require(_0x6353('0x7'));module[_0x6353('0x8')]=function(_0x455285,_0x3c439e){return _0x455285[_0x6353('0x9')](_0x6353('0xa'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index ee71c9f..1a1540e 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 _0xd581=['debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x297eea,_0x5060be){var _0x1c42d2=function(_0x3afff4){while(--_0x3afff4){_0x297eea['push'](_0x297eea['shift']());}};_0x1c42d2(++_0x5060be);}(_0xd581,0x76));var _0x1d58=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xd581[_0x5627e1];return _0x2f013f;};'use strict';var _=require(_0x1d58('0x0'));var util=require(_0x1d58('0x1'));var moment=require(_0x1d58('0x2'));var BPromise=require(_0x1d58('0x3'));var rs=require(_0x1d58('0x4'));var fs=require('fs');var Redis=require(_0x1d58('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1d58('0x6'));var logger=require('../../config/logger')(_0x1d58('0x7'));var config=require(_0x1d58('0x8'));var jayson=require(_0x1d58('0x9'));var client=jayson[_0x1d58('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24257c,_0xcbaa77,_0x36e9e6){return new BPromise(function(_0x3d1fcf,_0x4dcf42){return client['request'](_0x24257c,_0x36e9e6)[_0x1d58('0xb')](function(_0x1388a8){logger[_0x1d58('0xc')](_0x1d58('0xd'),_0xcbaa77,'request\x20sent');logger[_0x1d58('0xe')](_0x1d58('0xf'),_0xcbaa77,_0x1d58('0x10'),JSON[_0x1d58('0x11')](_0x1388a8));if(_0x1388a8[_0x1d58('0x12')]){if(_0x1388a8['error'][_0x1d58('0x13')]===0x1f4){logger[_0x1d58('0x12')](_0x1d58('0xd'),_0xcbaa77,_0x1388a8[_0x1d58('0x12')][_0x1d58('0x14')]);return _0x4dcf42(_0x1388a8['error']['message']);}logger[_0x1d58('0x12')](_0x1d58('0xd'),_0xcbaa77,_0x1388a8[_0x1d58('0x12')][_0x1d58('0x14')]);return _0x3d1fcf(_0x1388a8['error']['message']);}else{logger['info'](_0x1d58('0xd'),_0xcbaa77,'request\x20sent');_0x3d1fcf(_0x1388a8[_0x1d58('0x15')][_0x1d58('0x14')]);}})['catch'](function(_0x9831fe){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0xcbaa77,_0x9831fe);_0x4dcf42(_0x9831fe);});});} \ No newline at end of file +var _0xac7a=['client','http','request','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x55fa3e,_0x2acc2f){var _0x45604e=function(_0x42f7c1){while(--_0x42f7c1){_0x55fa3e['push'](_0x55fa3e['shift']());}};_0x45604e(++_0x2acc2f);}(_0xac7a,0x172));var _0xaac7=function(_0x27cd10,_0x2e8b70){_0x27cd10=_0x27cd10-0x0;var _0x3a9c5a=_0xac7a[_0x27cd10];return _0x3a9c5a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xaac7('0x0'));var BPromise=require('bluebird');var rs=require(_0xaac7('0x1'));var fs=require('fs');var Redis=require(_0xaac7('0x2'));var db=require(_0xaac7('0x3'))['db'];var utils=require(_0xaac7('0x4'));var logger=require('../../config/logger')(_0xaac7('0x5'));var config=require(_0xaac7('0x6'));var jayson=require(_0xaac7('0x7'));var client=jayson[_0xaac7('0x8')][_0xaac7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ce765,_0xcc3b41,_0x43b29d){return new BPromise(function(_0xa637a,_0x10d735){return client[_0xaac7('0xa')](_0x4ce765,_0x43b29d)['then'](function(_0x105871){logger['info'](_0xaac7('0xb'),_0xcc3b41,'request\x20sent');logger[_0xaac7('0xc')](_0xaac7('0xd'),_0xcc3b41,'request\x20sent',JSON[_0xaac7('0xe')](_0x105871));if(_0x105871[_0xaac7('0xf')]){if(_0x105871['error']['code']===0x1f4){logger[_0xaac7('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0xcc3b41,_0x105871[_0xaac7('0xf')][_0xaac7('0x10')]);return _0x10d735(_0x105871['error'][_0xaac7('0x10')]);}logger[_0xaac7('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0xcc3b41,_0x105871['error'][_0xaac7('0x10')]);return _0xa637a(_0x105871['error'][_0xaac7('0x10')]);}else{logger[_0xaac7('0x11')](_0xaac7('0xb'),_0xcc3b41,_0xaac7('0x12'));_0xa637a(_0x105871[_0xaac7('0x13')][_0xaac7('0x10')]);}})[_0xaac7('0x14')](function(_0x493a12){logger[_0xaac7('0xf')](_0xaac7('0xb'),_0xcc3b41,_0x493a12);_0x10d735(_0x493a12);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 1001b63..aa867f8 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 _0x3f8a=['/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get'];(function(_0x43c6a6,_0x4e380d){var _0x26e372=function(_0x9c75e8){while(--_0x9c75e8){_0x43c6a6['push'](_0x43c6a6['shift']());}};_0x26e372(++_0x4e380d);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x3af270,_0x5675b4){_0x3af270=_0x3af270-0x0;var _0x1dc18a=_0x3f8a[_0x3af270];return _0x1dc18a;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var fs_extra=require(_0xa3f8('0x5'));var auth=require(_0xa3f8('0x6'));var interaction=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var controller=require(_0xa3f8('0x9'));router[_0xa3f8('0xa')](_0xa3f8('0xb'),auth[_0xa3f8('0xc')](),controller[_0xa3f8('0xd')]);router[_0xa3f8('0xe')]('/',auth[_0xa3f8('0xc')](),controller[_0xa3f8('0xf')]);router[_0xa3f8('0x10')](_0xa3f8('0xb'),auth[_0xa3f8('0xc')](),controller[_0xa3f8('0x11')]);router['delete'](_0xa3f8('0xb'),auth[_0xa3f8('0xc')](),controller[_0xa3f8('0x12')]);module[_0xa3f8('0x13')]=router; \ No newline at end of file +var _0x8ef6=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','show','post','isAuthenticated','put','/:id','update','delete'];(function(_0x43606b,_0x2f2292){var _0xbfd21a=function(_0x2f28fa){while(--_0x2f28fa){_0x43606b['push'](_0x43606b['shift']());}};_0xbfd21a(++_0x2f2292);}(_0x8ef6,0xf2));var _0x68ef=function(_0x42f6e3,_0x3cc5fd){_0x42f6e3=_0x42f6e3-0x0;var _0x4cf352=_0x8ef6[_0x42f6e3];return _0x4cf352;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var fs_extra=require(_0x68ef('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var controller=require(_0x68ef('0x9'));router[_0x68ef('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x68ef('0xb')]);router[_0x68ef('0xc')]('/',auth[_0x68ef('0xd')](),controller['create']);router[_0x68ef('0xe')](_0x68ef('0xf'),auth[_0x68ef('0xd')](),controller[_0x68ef('0x10')]);router[_0x68ef('0x11')](_0x68ef('0xf'),auth[_0x68ef('0xd')](),controller[_0x68ef('0x12')]);module[_0x68ef('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index a9f32d9..0cc0e90 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 _0x564c=['rrmemory','roundrobin','STRING','name'];(function(_0x6adec3,_0x3d264a){var _0xf68ec2=function(_0x54a2c1){while(--_0x54a2c1){_0x6adec3['push'](_0x6adec3['shift']());}};_0xf68ec2(++_0x3d264a);}(_0x564c,0xea));var _0xc564=function(_0x1433df,_0x1c1ddc){_0x1433df=_0x1433df-0x0;var _0x49fade=_0x564c[_0x1433df];return _0x49fade;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc564('0x0')],'unique':_0xc564('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc564('0x0')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xc564('0x2'),'beepall',_0xc564('0x3'))}}; \ No newline at end of file +var _0x8bbc=['sequelize','exports','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x50f5ae,_0x1f4029){var _0x85b7b0=function(_0x754981){while(--_0x754981){_0x50f5ae['push'](_0x50f5ae['shift']());}};_0x85b7b0(++_0x1f4029);}(_0x8bbc,0xa0));var _0xc8bb=function(_0x4aba15,_0x4e90aa){_0x4aba15=_0x4aba15-0x0;var _0x1c8122=_0x8bbc[_0x4aba15];return _0x1c8122;};'use strict';var Sequelize=require(_0xc8bb('0x0'));module[_0xc8bb('0x1')]={'name':{'type':Sequelize[_0xc8bb('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc8bb('0x2')]},'timeout':{'type':Sequelize[_0xc8bb('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc8bb('0x4')](_0xc8bb('0x5'),_0xc8bb('0x6'),_0xc8bb('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 795e855..c797b21 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 _0xefab=['../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','./chatQueue.socket','register','jayson/promise','http','request','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','status','offset','limit','undefined','count','Content-Range','apply','reject','save','destroy','then','ChatQueues','UserProfileResource','sendStatus','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','ChatQueue','includeAll','include','findAll','rows','show','params','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','UserChatQueue','nolimit','ChatQueueId','User','findAndCountAll','UserId','agent','chatPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','findOne','Team','order','ids','Agents','online','interface','sequelize','addTeams','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','tq.TeamId','from','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','value','transaction','userChatQueue:remove','addAgents','omit','removeAgents','getAgents','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api'];(function(_0xa27be,_0x2970dc){var _0x33d851=function(_0x2fdb0c){while(--_0x2fdb0c){_0xa27be['push'](_0xa27be['shift']());}};_0x33d851(++_0x2970dc);}(_0xefab,0x1a5));var _0xbefa=function(_0x2df2eb,_0x3959a0){_0x2df2eb=_0x2df2eb-0x0;var _0xa5abb9=_0xefab[_0x2df2eb];return _0xa5abb9;};'use strict';var emlformat=require(_0xbefa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbefa('0x1'));var jsonpatch=require(_0xbefa('0x2'));var rp=require('request-promise');var moment=require(_0xbefa('0x3'));var BPromise=require(_0xbefa('0x4'));var Mustache=require(_0xbefa('0x5'));var util=require(_0xbefa('0x6'));var path=require(_0xbefa('0x7'));var sox=require(_0xbefa('0x8'));var csv=require(_0xbefa('0x9'));var ejs=require(_0xbefa('0xa'));var fs=require('fs');var fs_extra=require(_0xbefa('0xb'));var _=require(_0xbefa('0xc'));var squel=require('squel');var crypto=require(_0xbefa('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbefa('0xe'));var toCsv=require(_0xbefa('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbefa('0xf'));var authService=require(_0xbefa('0x10'));var qs=require(_0xbefa('0x11'));var as=require(_0xbefa('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbefa('0x13'));var utils=require(_0xbefa('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xbefa('0x15'));var db=require(_0xbefa('0x16'))['db'];config['redis']=_[_0xbefa('0x17')](config[_0xbefa('0x18')],{'host':_0xbefa('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbefa('0x18')]));require(_0xbefa('0x1a'))[_0xbefa('0x1b')](socket);var jayson=require(_0xbefa('0x1c'));var client=jayson['client'][_0xbefa('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x10f06a,_0x13b105,_0x23e0a2,_0x381d03){return new BPromise(function(_0x2a1267,_0x249abc){var _0x2962b4=_0x381d03||client;return _0x2962b4[_0xbefa('0x1e')](_0x10f06a,_0x23e0a2)['then'](function(_0x3f339a){logger['info'](_0xbefa('0x1f'),_0x13b105,_0xbefa('0x20'));logger[_0xbefa('0x21')](_0xbefa('0x22'),_0x13b105,_0xbefa('0x20'),JSON[_0xbefa('0x23')](_0x3f339a));if(_0x3f339a[_0xbefa('0x24')]){if(_0x3f339a['error']['code']===0x1f4){logger[_0xbefa('0x24')]('ChatQueue,\x20%s,\x20%s',_0x13b105,_0x3f339a[_0xbefa('0x24')][_0xbefa('0x25')]);return _0x249abc(_0x3f339a[_0xbefa('0x24')][_0xbefa('0x25')]);}logger[_0xbefa('0x24')]('ChatQueue,\x20%s,\x20%s',_0x13b105,_0x3f339a[_0xbefa('0x24')][_0xbefa('0x25')]);return _0x2a1267(_0x3f339a[_0xbefa('0x24')][_0xbefa('0x25')]);}else{logger[_0xbefa('0x26')]('ChatQueue,\x20%s,\x20%s',_0x13b105,'request\x20sent');_0x2a1267(_0x3f339a['result']['message']);}})[_0xbefa('0x27')](function(_0x52ec0f){logger[_0xbefa('0x24')](_0xbefa('0x1f'),_0x13b105,_0x52ec0f);_0x249abc(_0x52ec0f);});});}function respondWithStatusCode(_0x527c51,_0x3c2b51){_0x3c2b51=_0x3c2b51||0xcc;return function(_0xdc1f4e){if(_0xdc1f4e){return _0x527c51['sendStatus'](_0x3c2b51);}return _0x527c51[_0xbefa('0x28')](_0x3c2b51)['end']();};}function respondWithResult(_0x47e7e7,_0x1f19f5){_0x1f19f5=_0x1f19f5||0xc8;return function(_0x54b5c9){if(_0x54b5c9){return _0x47e7e7['status'](_0x1f19f5)['json'](_0x54b5c9);}};}function respondWithFilteredResult(_0x632ecb,_0x1bbeff){return function(_0x4decf8){if(_0x4decf8){var _0xcf584b=typeof _0x1bbeff[_0xbefa('0x29')]==='undefined'&&typeof _0x1bbeff[_0xbefa('0x2a')]===_0xbefa('0x2b');var _0x58e1d6=_0x4decf8['count'];var _0x2f7025=_0xcf584b?0x0:_0x1bbeff[_0xbefa('0x29')];var _0x1109d9=_0xcf584b?_0x4decf8[_0xbefa('0x2c')]:_0x1bbeff[_0xbefa('0x29')]+_0x1bbeff[_0xbefa('0x2a')];var _0x68b5c6;if(_0x1109d9>=_0x58e1d6){_0x1109d9=_0x58e1d6;_0x68b5c6=0xc8;}else{_0x68b5c6=0xce;}_0x632ecb['status'](_0x68b5c6);return _0x632ecb['set'](_0xbefa('0x2d'),_0x2f7025+'-'+_0x1109d9+'/'+_0x58e1d6)['json'](_0x4decf8);}return null;};}function patchUpdates(_0x4f93a3){return function(_0x57f08e){try{jsonpatch[_0xbefa('0x2e')](_0x57f08e,_0x4f93a3,!![]);}catch(_0x288600){return BPromise[_0xbefa('0x2f')](_0x288600);}return _0x57f08e[_0xbefa('0x30')]();};}function saveUpdates(_0x2c4faa,_0x2a611d){return function(_0x209b67){if(_0x209b67){return _0x209b67['update'](_0x2c4faa)['then'](function(_0x302f7a){return _0x302f7a;});}return null;};}function removeEntity(_0x2ecadb,_0x850c8d){return function(_0x56b417){if(_0x56b417){return _0x56b417[_0xbefa('0x31')]()[_0xbefa('0x32')](function(){var _0x52d540=_0x56b417['get']({'plain':!![]});var _0x36b1dc=_0xbefa('0x33');return db[_0xbefa('0x34')]['destroy']({'where':{'type':_0x36b1dc,'resourceId':_0x52d540['id']}})['then'](function(){return _0x56b417;});})['then'](function(){_0x2ecadb[_0xbefa('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd0de81,_0x1206a9){return function(_0x4112d4){if(!_0x4112d4){_0xd0de81[_0xbefa('0x35')](0x194);}return _0x4112d4;};}function handleError(_0x39ba45,_0x3af5a3){_0x3af5a3=_0x3af5a3||0x1f4;return function(_0xdfda59){logger[_0xbefa('0x24')](_0xdfda59['stack']);if(_0xdfda59['name']){delete _0xdfda59[_0xbefa('0x36')];}_0x39ba45[_0xbefa('0x28')](_0x3af5a3)[_0xbefa('0x37')](_0xdfda59);};}exports[_0xbefa('0x38')]=function(_0x3d6446,_0x363c0e){var _0x292282={},_0x323dda={},_0x2b5b6d={'count':0x0,'rows':[]};var _0x3eca3e=_[_0xbefa('0x39')](db['ChatQueue'][_0xbefa('0x3a')],function(_0x939e55){return{'name':_0x939e55[_0xbefa('0x3b')],'type':_0x939e55[_0xbefa('0x3c')][_0xbefa('0x3d')]};});_0x323dda['model']=_[_0xbefa('0x39')](_0x3eca3e,_0xbefa('0x36'));_0x323dda['query']=_[_0xbefa('0x3e')](_0x3d6446[_0xbefa('0x3f')]);_0x323dda[_0xbefa('0x40')]=_[_0xbefa('0x41')](_0x323dda[_0xbefa('0x42')],_0x323dda[_0xbefa('0x3f')]);_0x292282[_0xbefa('0x43')]=_['intersection'](_0x323dda[_0xbefa('0x42')],qs[_0xbefa('0x44')](_0x3d6446[_0xbefa('0x3f')][_0xbefa('0x44')]));_0x292282[_0xbefa('0x43')]=_0x292282[_0xbefa('0x43')][_0xbefa('0x45')]?_0x292282[_0xbefa('0x43')]:_0x323dda[_0xbefa('0x42')];if(!_0x3d6446[_0xbefa('0x3f')][_0xbefa('0x46')]('nolimit')){_0x292282[_0xbefa('0x2a')]=qs[_0xbefa('0x2a')](_0x3d6446[_0xbefa('0x3f')][_0xbefa('0x2a')]);_0x292282[_0xbefa('0x29')]=qs[_0xbefa('0x29')](_0x3d6446[_0xbefa('0x3f')][_0xbefa('0x29')]);}_0x292282['order']=qs[_0xbefa('0x47')](_0x3d6446['query'][_0xbefa('0x47')]);_0x292282[_0xbefa('0x48')]=qs['filters'](_[_0xbefa('0x49')](_0x3d6446[_0xbefa('0x3f')],_0x323dda[_0xbefa('0x40')]),_0x3eca3e);if(_0x3d6446[_0xbefa('0x3f')][_0xbefa('0x4a')]){_0x292282['where']=_[_0xbefa('0x4b')](_0x292282[_0xbefa('0x48')],{'$or':_[_0xbefa('0x39')](_0x3eca3e,function(_0x5560cf){if(_0x5560cf[_0xbefa('0x3c')]!==_0xbefa('0x4c')){var _0x17f91c={};_0x17f91c[_0x5560cf['name']]={'$like':'%'+_0x3d6446[_0xbefa('0x3f')][_0xbefa('0x4a')]+'%'};return _0x17f91c;}})});}_0x292282=_[_0xbefa('0x4b')]({},_0x292282,_0x3d6446[_0xbefa('0x4d')]);var _0xc44bb3={'where':_0x292282[_0xbefa('0x48')]};return db[_0xbefa('0x4e')][_0xbefa('0x2c')](_0xc44bb3)[_0xbefa('0x32')](function(_0x202653){_0x2b5b6d[_0xbefa('0x2c')]=_0x202653;if(_0x3d6446[_0xbefa('0x3f')][_0xbefa('0x4f')]){_0x292282[_0xbefa('0x50')]=[{'all':!![]}];}return db['ChatQueue'][_0xbefa('0x51')](_0x292282);})[_0xbefa('0x32')](function(_0x261edc){_0x2b5b6d[_0xbefa('0x52')]=_0x261edc;return _0x2b5b6d;})[_0xbefa('0x32')](respondWithFilteredResult(_0x363c0e,_0x292282))[_0xbefa('0x27')](handleError(_0x363c0e,null));};exports[_0xbefa('0x53')]=function(_0x289ee1,_0x40e34b){var _0x3f3ecb={'raw':!![],'where':{'id':_0x289ee1[_0xbefa('0x54')]['id']}},_0x29aebc={};_0x29aebc[_0xbefa('0x42')]=_[_0xbefa('0x3e')](db['ChatQueue'][_0xbefa('0x3a')]);_0x29aebc[_0xbefa('0x3f')]=_[_0xbefa('0x3e')](_0x289ee1['query']);_0x29aebc[_0xbefa('0x40')]=_['intersection'](_0x29aebc[_0xbefa('0x42')],_0x29aebc[_0xbefa('0x3f')]);_0x3f3ecb[_0xbefa('0x43')]=_[_0xbefa('0x41')](_0x29aebc[_0xbefa('0x42')],qs[_0xbefa('0x44')](_0x289ee1['query'][_0xbefa('0x44')]));_0x3f3ecb[_0xbefa('0x43')]=_0x3f3ecb[_0xbefa('0x43')]['length']?_0x3f3ecb[_0xbefa('0x43')]:_0x29aebc['model'];if(_0x289ee1[_0xbefa('0x3f')][_0xbefa('0x4f')]){_0x3f3ecb[_0xbefa('0x50')]=[{'all':!![]}];}_0x3f3ecb=_[_0xbefa('0x4b')]({},_0x3f3ecb,_0x289ee1['options']);return db['ChatQueue']['find'](_0x3f3ecb)[_0xbefa('0x32')](handleEntityNotFound(_0x40e34b,null))['then'](respondWithResult(_0x40e34b,null))['catch'](handleError(_0x40e34b,null));};exports[_0xbefa('0x55')]=function(_0x589276,_0xcadaa){return db['ChatQueue']['create'](_0x589276['body'],{})[_0xbefa('0x32')](function(_0x51dbf6){var _0x415b3b=_0x589276[_0xbefa('0x56')][_0xbefa('0x57')]({'plain':!![]});if(!_0x415b3b)throw new Error(_0xbefa('0x58'));if(_0x415b3b[_0xbefa('0x59')]===_0xbefa('0x56')){var _0x39664a=_0x51dbf6[_0xbefa('0x57')]({'plain':!![]});var _0xeb0862=_0xbefa('0x33');return db['UserProfileSection'][_0xbefa('0x5a')]({'where':{'name':_0xeb0862,'userProfileId':_0x415b3b[_0xbefa('0x5b')]},'raw':!![]})[_0xbefa('0x32')](function(_0x107f60){if(_0x107f60&&_0x107f60['autoAssociation']===0x0){return db[_0xbefa('0x34')][_0xbefa('0x55')]({'name':_0x39664a[_0xbefa('0x36')],'resourceId':_0x39664a['id'],'type':_0x107f60[_0xbefa('0x36')],'sectionId':_0x107f60['id']},{})[_0xbefa('0x32')](function(){return _0x51dbf6;});}else{return _0x51dbf6;}})[_0xbefa('0x27')](function(_0x8cf864){logger[_0xbefa('0x24')](_0xbefa('0x5c'),_0x8cf864);throw _0x8cf864;});}return _0x51dbf6;})[_0xbefa('0x32')](respondWithResult(_0xcadaa,0xc9))[_0xbefa('0x27')](handleError(_0xcadaa,null));};exports[_0xbefa('0x5d')]=function(_0x2d3017,_0xb1907b){if(_0x2d3017['body']['id']){delete _0x2d3017[_0xbefa('0x5e')]['id'];}return db[_0xbefa('0x4e')][_0xbefa('0x5a')]({'where':{'id':_0x2d3017[_0xbefa('0x54')]['id']}})[_0xbefa('0x32')](handleEntityNotFound(_0xb1907b,null))[_0xbefa('0x32')](saveUpdates(_0x2d3017[_0xbefa('0x5e')],null))[_0xbefa('0x32')](respondWithResult(_0xb1907b,null))[_0xbefa('0x27')](handleError(_0xb1907b,null));};exports['destroy']=function(_0x5170bd,_0x4a386b){return db[_0xbefa('0x4e')]['find']({'where':{'id':_0x5170bd['params']['id']}})['then'](handleEntityNotFound(_0x4a386b,null))[_0xbefa('0x32')](removeEntity(_0x4a386b,null))[_0xbefa('0x27')](handleError(_0x4a386b,null));};exports['describe']=function(_0x39ec5c,_0x52b931){return db[_0xbefa('0x4e')][_0xbefa('0x5f')]()[_0xbefa('0x32')](respondWithResult(_0x52b931,null))[_0xbefa('0x27')](handleError(_0x52b931,null));};exports[_0xbefa('0x60')]=function(_0x531938,_0x4b3cff,_0x473d37){var _0x38e8d1={'raw':!![],'where':{}},_0x572f3f={},_0x421d7f;return db['ChatQueue']['findOne']({'where':{'id':_0x531938[_0xbefa('0x54')]['id']}})['then'](handleEntityNotFound(_0x4b3cff,null))[_0xbefa('0x32')](function(_0x1c3769){if(_0x1c3769){_0x421d7f=_0x1c3769[_0xbefa('0x57')]({'plain':!![]});_0x572f3f[_0xbefa('0x42')]=_[_0xbefa('0x3e')](db[_0xbefa('0x61')]['rawAttributes']);_0x572f3f[_0xbefa('0x3f')]=_['keys'](_0x531938[_0xbefa('0x3f')]);_0x572f3f[_0xbefa('0x40')]=_[_0xbefa('0x41')](_0x572f3f['model'],_0x572f3f[_0xbefa('0x3f')]);_0x38e8d1[_0xbefa('0x43')]=_[_0xbefa('0x41')](_0x572f3f[_0xbefa('0x42')],qs[_0xbefa('0x44')](_0x531938[_0xbefa('0x3f')][_0xbefa('0x44')]));_0x38e8d1['attributes']=_0x38e8d1[_0xbefa('0x43')][_0xbefa('0x45')]?_0x38e8d1[_0xbefa('0x43')]:_0x572f3f[_0xbefa('0x42')];if(!_0x531938[_0xbefa('0x3f')][_0xbefa('0x46')](_0xbefa('0x62'))){_0x38e8d1[_0xbefa('0x2a')]=qs[_0xbefa('0x2a')](_0x531938[_0xbefa('0x3f')][_0xbefa('0x2a')]);_0x38e8d1[_0xbefa('0x29')]=qs['offset'](_0x531938['query'][_0xbefa('0x29')]);}_0x38e8d1['order']=qs[_0xbefa('0x47')](_0x531938[_0xbefa('0x3f')][_0xbefa('0x47')]);_0x38e8d1[_0xbefa('0x48')]=qs[_0xbefa('0x40')](_[_0xbefa('0x49')](_0x531938[_0xbefa('0x3f')],_0x572f3f[_0xbefa('0x40')]));_0x38e8d1[_0xbefa('0x48')][_0xbefa('0x63')]=_0x1c3769['id'];if(_0x531938[_0xbefa('0x3f')][_0xbefa('0x4a')]){_0x38e8d1['where']=_[_0xbefa('0x4b')](_0x38e8d1[_0xbefa('0x48')],{'$or':_[_0xbefa('0x39')](_0x38e8d1[_0xbefa('0x43')],function(_0x1b06dd){var _0x133525={};_0x133525[_0x1b06dd]={'$like':'%'+_0x531938[_0xbefa('0x3f')][_0xbefa('0x4a')]+'%'};return _0x133525;})});}_0x38e8d1=_[_0xbefa('0x4b')]({},_0x38e8d1,_0x531938['options']);return db[_0xbefa('0x61')][_0xbefa('0x51')](_0x38e8d1);}})[_0xbefa('0x32')](function(_0x3efad2){if(_0x3efad2){return db[_0xbefa('0x64')][_0xbefa('0x65')]({'where':{'id':_['map'](_0x3efad2,_0xbefa('0x66')),'role':_0xbefa('0x67')},'attributes':['id',_0xbefa('0x36'),_0xbefa('0x68'),'updatedAt',_0xbefa('0x69')]});}})['then'](function(_0x47fd0a){if(_0x47fd0a){return{'count':_0x47fd0a[_0xbefa('0x2c')],'rows':_[_0xbefa('0x39')](_0x47fd0a['rows'],function(_0x323093){return{'membername':_0x323093['name'],'UserId':_0x323093['id'],'queue_name':_0x421d7f[_0xbefa('0x36')],'ChatQueueId':_0x421d7f['id'],'interface':util[_0xbefa('0x6a')](_0xbefa('0x6b'),_0xbefa('0x6c'),_0x323093[_0xbefa('0x36')]),'penalty':0x0,'paused':_0x323093[_0xbefa('0x68')],'createdAt':_0x323093['createdAt'],'updatedAt':_0x323093[_0xbefa('0x6d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xbefa('0x32')](respondWithFilteredResult(_0x4b3cff,_0x38e8d1))['catch'](handleError(_0x4b3cff,null));};exports[_0xbefa('0x6e')]=function(_0x3921d9,_0x11d006,_0x306632){var _0x59f4cb={};var _0xe4ee1={};var _0x5ca1bc;var _0xd1397c;return db[_0xbefa('0x4e')][_0xbefa('0x6f')]({'where':{'id':_0x3921d9[_0xbefa('0x54')]['id']}})[_0xbefa('0x32')](handleEntityNotFound(_0x11d006,null))[_0xbefa('0x32')](function(_0x2d3f51){if(_0x2d3f51){_0x5ca1bc=_0x2d3f51;_0xe4ee1[_0xbefa('0x42')]=_[_0xbefa('0x3e')](db[_0xbefa('0x70')][_0xbefa('0x3a')]);_0xe4ee1[_0xbefa('0x3f')]=_['keys'](_0x3921d9[_0xbefa('0x3f')]);_0xe4ee1[_0xbefa('0x40')]=_[_0xbefa('0x41')](_0xe4ee1['model'],_0xe4ee1['query']);_0x59f4cb['attributes']=_[_0xbefa('0x41')](_0xe4ee1[_0xbefa('0x42')],qs[_0xbefa('0x44')](_0x3921d9['query'][_0xbefa('0x44')]));_0x59f4cb[_0xbefa('0x43')]=_0x59f4cb[_0xbefa('0x43')][_0xbefa('0x45')]?_0x59f4cb['attributes']:_0xe4ee1[_0xbefa('0x42')];_0x59f4cb[_0xbefa('0x71')]=qs[_0xbefa('0x47')](_0x3921d9['query'][_0xbefa('0x47')]);_0x59f4cb[_0xbefa('0x48')]=qs[_0xbefa('0x40')](_[_0xbefa('0x49')](_0x3921d9[_0xbefa('0x3f')],_0xe4ee1[_0xbefa('0x40')]));if(_0x3921d9['query'][_0xbefa('0x4a')]){_0x59f4cb[_0xbefa('0x48')]=_[_0xbefa('0x4b')](_0x59f4cb[_0xbefa('0x48')],{'$or':_['map'](_0x59f4cb[_0xbefa('0x43')],function(_0x40b9f1){var _0x181fcd={};_0x181fcd[_0x40b9f1]={'$like':'%'+_0x3921d9['query'][_0xbefa('0x4a')]+'%'};return _0x181fcd;})});}_0x59f4cb=_[_0xbefa('0x4b')]({},_0x59f4cb,_0x3921d9[_0xbefa('0x4d')]);return _0x5ca1bc[_0xbefa('0x6e')](_0x59f4cb);}})[_0xbefa('0x32')](function(_0x1c4303){if(_0x1c4303){_0xd1397c=_0x1c4303[_0xbefa('0x45')];if(!_0x3921d9[_0xbefa('0x3f')][_0xbefa('0x46')]('nolimit')){_0x59f4cb[_0xbefa('0x2a')]=qs[_0xbefa('0x2a')](_0x3921d9[_0xbefa('0x3f')][_0xbefa('0x2a')]);_0x59f4cb[_0xbefa('0x29')]=qs['offset'](_0x3921d9['query'][_0xbefa('0x29')]);}return _0x5ca1bc['getTeams'](_0x59f4cb);}})[_0xbefa('0x32')](function(_0x126a57){if(_0x126a57){return _0x126a57?{'count':_0xd1397c,'rows':_0x126a57}:null;}})[_0xbefa('0x32')](respondWithResult(_0x11d006,null))[_0xbefa('0x27')](handleError(_0x11d006,null));};exports['addTeams']=function(_0x2e1333,_0x25c6da,_0xe28c8b){var _0x128d0e=_0x2e1333[_0xbefa('0x5e')][_0xbefa('0x72')];return db[_0xbefa('0x70')][_0xbefa('0x51')]({'where':{'id':_0x128d0e},'attributes':['id'],'include':[{'model':db['User'],'as':_0xbefa('0x73'),'attributes':['id','name',_0xbefa('0x74'),'voicePause',_0xbefa('0x75')],'raw':!![]}]})[_0xbefa('0x32')](function(_0x1a00bd){if(_0x1a00bd){var _0x4d5a75=_['flatMap'](_0x1a00bd,function(_0x48cd73){var _0x132dff=_0x48cd73[_0xbefa('0x57')]({'plain':!![]});return _0x132dff[_0xbefa('0x73')];});return db['ChatQueue'][_0xbefa('0x5a')]({'where':{'id':_0x2e1333['params']['id']}})[_0xbefa('0x32')](function(_0x54a5a1){return db[_0xbefa('0x76')]['transaction'](function(_0x386aca){return _0x54a5a1[_0xbefa('0x77')](_0x128d0e,{'transaction':_0x386aca})[_0xbefa('0x32')](function(){return BPromise[_0xbefa('0x78')](_0x4d5a75,function(_0x4fbbff){return db[_0xbefa('0x61')][_0xbefa('0x79')]({'where':{'UserId':_0x4fbbff['id'],'ChatQueueId':_0x2e1333['params']['id']},'transaction':_0x386aca});});})[_0xbefa('0x32')](function(){_0x4d5a75[_0xbefa('0x7a')](function(_0x2f4307){socket[_0xbefa('0x7b')](_0xbefa('0x7c'),{'UserId':_0x2f4307['id'],'ChatQueueId':_0x54a5a1['id']});});});});});}})[_0xbefa('0x32')](respondWithStatusCode(_0x25c6da,null))[_0xbefa('0x27')](handleError(_0x25c6da,null));};exports[_0xbefa('0x7d')]=function(_0x4b0651,_0x5540f8,_0x54f438){return db['Team'][_0xbefa('0x51')]({'where':{'id':_0x4b0651[_0xbefa('0x3f')][_0xbefa('0x72')]},'attributes':['id'],'include':[{'model':db[_0xbefa('0x64')],'as':_0xbefa('0x73'),'attributes':['id'],'raw':!![]}]})[_0xbefa('0x32')](handleEntityNotFound(_0x5540f8,null))[_0xbefa('0x32')](function(_0xd66ed0){var _0x1c5249=_[_0xbefa('0x39')](_0xd66ed0,'id');var _0x3bc88f=[];var _0x56d7c1=[];var _0x329e78=squel['select']();_0x329e78['field'](_0xbefa('0x7e'))[_0xbefa('0x7f')](_0xbefa('0x80'),'tq')[_0xbefa('0x81')]('user_has_teams','ut',_0xbefa('0x82'))['where']('ChatQueueId\x20=\x20?',_0x4b0651[_0xbefa('0x54')]['id']);for(var _0x365ef=0x0;_0x365ef<_0xd66ed0[_0xbefa('0x45')];_0x365ef+=0x1){let _0x202800=_0xd66ed0[_0x365ef];for(var _0x21c4e3=0x0;_0x21c4e3<_0x202800[_0xbefa('0x73')][_0xbefa('0x45')];_0x21c4e3+=0x1){let _0x3b0c34=_0x202800['Agents'][_0x21c4e3];var _0x1bf990=_0x329e78[_0xbefa('0x83')]();_0x1bf990[_0xbefa('0x48')]('ut.UserId\x20=\x20?',_0x3b0c34['id']);_0x56d7c1[_0xbefa('0x84')](db['sequelize'][_0xbefa('0x3f')](_0x1bf990[_0xbefa('0x85')](),{'type':db[_0xbefa('0x76')][_0xbefa('0x86')][_0xbefa('0x87')]})[_0xbefa('0x32')](function(_0x13dcfd){if(_0x13dcfd[_0xbefa('0x45')]===0x1){return _0x3b0c34['id'];}else{var _0x274a71=_[_0xbefa('0x88')](_[_0xbefa('0x39')](_0x13dcfd,_0xbefa('0x89')),function(_0x460ec8){return _[_0xbefa('0x8a')](_0x1c5249,_0x460ec8);});if(_0x274a71){return _0x3b0c34['id'];}}}));}}return BPromise[_0xbefa('0x8b')](_0x56d7c1)[_0xbefa('0x32')](function(_0x142930){_0x3bc88f=_(_0x3bc88f)['union'](_0x142930)['compact']()[_0xbefa('0x8c')]();return db[_0xbefa('0x4e')][_0xbefa('0x5a')]({'where':{'id':_0x4b0651['params']['id']}})[_0xbefa('0x32')](function(_0x5e01c2){return db[_0xbefa('0x76')][_0xbefa('0x8d')](function(_0x5db332){return _0x5e01c2[_0xbefa('0x7d')](_0x4b0651[_0xbefa('0x3f')][_0xbefa('0x72')],{'transaction':_0x5db332})[_0xbefa('0x32')](function(){if(!_['isEmpty'](_0x3bc88f)){return _0x5e01c2['removeAgents'](_0x3bc88f,{'transaction':_0x5db332});}})[_0xbefa('0x32')](function(){_0x3bc88f[_0xbefa('0x7a')](function(_0x5473cc){socket[_0xbefa('0x7b')](_0xbefa('0x8e'),{'UserId':_0x5473cc,'ChatQueueId':_0x5e01c2['id']});});});});});});})['then'](respondWithStatusCode(_0x5540f8,null))[_0xbefa('0x27')](handleError(_0x5540f8,null));};exports[_0xbefa('0x8f')]=function(_0x32424a,_0x32b336,_0x38a1df){return db[_0xbefa('0x4e')][_0xbefa('0x5a')]({'where':{'id':_0x32424a[_0xbefa('0x54')]['id']}})[_0xbefa('0x32')](handleEntityNotFound(_0x32b336,null))['then'](function(_0x5ddff1){if(_0x5ddff1){return _0x5ddff1[_0xbefa('0x8f')](_0x32424a[_0xbefa('0x5e')][_0xbefa('0x72')],_[_0xbefa('0x90')](_0x32424a[_0xbefa('0x5e')],[_0xbefa('0x72'),'id'])||{})['spread'](function(_0x55bdd8){for(var _0x4e5955=0x0;_0x4e5955<_0x32424a[_0xbefa('0x5e')]['ids']['length'];_0x4e5955+=0x1){socket[_0xbefa('0x7b')]('userChatQueue:save',{'UserId':Number(_0x32424a[_0xbefa('0x5e')][_0xbefa('0x72')][_0x4e5955]),'ChatQueueId':Number(_0x32424a[_0xbefa('0x54')]['id'])});}return _0x55bdd8;});}})['then'](respondWithResult(_0x32b336,null))[_0xbefa('0x27')](handleError(_0x32b336,null));};exports[_0xbefa('0x91')]=function(_0x75437,_0xf92b68,_0x4863e2){return db[_0xbefa('0x4e')][_0xbefa('0x5a')]({'where':{'id':_0x75437['params']['id']}})[_0xbefa('0x32')](handleEntityNotFound(_0xf92b68,null))[_0xbefa('0x32')](function(_0x15814d){if(_0x15814d){return _0x15814d[_0xbefa('0x91')](_0x75437['query'][_0xbefa('0x72')])[_0xbefa('0x32')](function(){if(_['isArray'](_0x75437['query'][_0xbefa('0x72')])){for(var _0x2f16b7=0x0;_0x2f16b7<_0x75437['query'][_0xbefa('0x72')][_0xbefa('0x45')];_0x2f16b7+=0x1){socket[_0xbefa('0x7b')]('userChatQueue:remove',{'UserId':Number(_0x75437['query']['ids'][_0x2f16b7]),'ChatQueueId':Number(_0x75437[_0xbefa('0x54')]['id'])});}}else{socket[_0xbefa('0x7b')](_0xbefa('0x8e'),{'UserId':Number(_0x75437['query'][_0xbefa('0x72')]),'ChatQueueId':Number(_0x75437['params']['id'])});}});}})[_0xbefa('0x32')](respondWithStatusCode(_0xf92b68,null))[_0xbefa('0x27')](handleError(_0xf92b68,null));};exports[_0xbefa('0x92')]=function(_0x54b1e2,_0x1af6c3,_0x4d2919){var _0x3afa61={};var _0x5cae95={};var _0x30d7d0;var _0x22e85c;return db['ChatQueue'][_0xbefa('0x6f')]({'where':{'id':_0x54b1e2[_0xbefa('0x54')]['id']}})['then'](handleEntityNotFound(_0x1af6c3,null))[_0xbefa('0x32')](function(_0x304eff){if(_0x304eff){_0x30d7d0=_0x304eff;_0x5cae95[_0xbefa('0x42')]=_[_0xbefa('0x3e')](db[_0xbefa('0x64')]['rawAttributes']);_0x5cae95[_0xbefa('0x3f')]=_[_0xbefa('0x3e')](_0x54b1e2[_0xbefa('0x3f')]);_0x5cae95[_0xbefa('0x40')]=_['intersection'](_0x5cae95[_0xbefa('0x42')],_0x5cae95[_0xbefa('0x3f')]);_0x3afa61[_0xbefa('0x43')]=_[_0xbefa('0x41')](_0x5cae95[_0xbefa('0x42')],qs[_0xbefa('0x44')](_0x54b1e2[_0xbefa('0x3f')][_0xbefa('0x44')]));_0x3afa61[_0xbefa('0x43')]=_0x3afa61[_0xbefa('0x43')]['length']?_0x3afa61[_0xbefa('0x43')]:_0x5cae95[_0xbefa('0x42')];_0x3afa61[_0xbefa('0x71')]=qs[_0xbefa('0x47')](_0x54b1e2[_0xbefa('0x3f')][_0xbefa('0x47')]);_0x3afa61[_0xbefa('0x48')]=qs[_0xbefa('0x40')](_[_0xbefa('0x49')](_0x54b1e2['query'],_0x5cae95[_0xbefa('0x40')]));if(_0x54b1e2[_0xbefa('0x3f')][_0xbefa('0x4a')]){_0x3afa61['where']=_[_0xbefa('0x4b')](_0x3afa61[_0xbefa('0x48')],{'$or':_[_0xbefa('0x39')](_0x3afa61['attributes'],function(_0x301baf){var _0x1c75da={};_0x1c75da[_0x301baf]={'$like':'%'+_0x54b1e2[_0xbefa('0x3f')][_0xbefa('0x4a')]+'%'};return _0x1c75da;})});}_0x3afa61=_[_0xbefa('0x4b')]({},_0x3afa61,_0x54b1e2[_0xbefa('0x4d')]);return _0x30d7d0[_0xbefa('0x92')](_0x3afa61);}})['then'](function(_0x5b434b){if(_0x5b434b){_0x22e85c=_0x5b434b[_0xbefa('0x45')];if(!_0x54b1e2[_0xbefa('0x3f')][_0xbefa('0x46')](_0xbefa('0x62'))){_0x3afa61[_0xbefa('0x2a')]=qs['limit'](_0x54b1e2[_0xbefa('0x3f')][_0xbefa('0x2a')]);_0x3afa61['offset']=qs['offset'](_0x54b1e2['query'][_0xbefa('0x29')]);}return _0x30d7d0['getAgents'](_0x3afa61);}})['then'](function(_0xf5fcb0){if(_0xf5fcb0){return _0xf5fcb0?{'count':_0x22e85c,'rows':_0xf5fcb0}:null;}})['then'](respondWithResult(_0x1af6c3,null))[_0xbefa('0x27')](handleError(_0x1af6c3,null));}; \ No newline at end of file +var _0x87d3=['jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./chatQueue.socket','register','jayson/promise','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','ChatQueues','UserProfileResource','stack','name','send','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','keys','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserChatQueue','nolimit','sort','ChatQueueId','User','findAndCountAll','UserId','agent','chatPause','updatedAt','format','SIP','createdAt','Team','getTeams','addTeams','Agents','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','ids','tq.TeamId','from','team_has_chat_queues','join','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','SELECT','every','includes','all','compact','value','isEmpty','removeAgents','addAgents','spread','userChatQueue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto'];(function(_0x92287b,_0x1c0331){var _0x2279d9=function(_0x3cf3cf){while(--_0x3cf3cf){_0x92287b['push'](_0x92287b['shift']());}};_0x2279d9(++_0x1c0331);}(_0x87d3,0x84));var _0x387d=function(_0x18a529,_0x2bea53){_0x18a529=_0x18a529-0x0;var _0x216fb8=_0x87d3[_0x18a529];return _0x216fb8;};'use strict';var emlformat=require(_0x387d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x387d('0x1'));var jsonpatch=require(_0x387d('0x2'));var rp=require(_0x387d('0x3'));var moment=require(_0x387d('0x4'));var BPromise=require(_0x387d('0x5'));var Mustache=require(_0x387d('0x6'));var util=require(_0x387d('0x7'));var path=require('path');var sox=require(_0x387d('0x8'));var csv=require('to-csv');var ejs=require(_0x387d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x387d('0xa'));var squel=require('squel');var crypto=require(_0x387d('0xb'));var jsforce=require(_0x387d('0xc'));var deskjs=require(_0x387d('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x387d('0xe'));var Redis=require(_0x387d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x387d('0x10'));var as=require(_0x387d('0x11'));var hardwareService=require(_0x387d('0x12'));var logger=require('../../config/logger')(_0x387d('0x13'));var utils=require('../../config/utils');var config=require(_0x387d('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x387d('0x15'))['db'];config[_0x387d('0x16')]=_['defaults'](config[_0x387d('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x387d('0x17'))(new Redis(config[_0x387d('0x16')]));require(_0x387d('0x18'))[_0x387d('0x19')](socket);var jayson=require(_0x387d('0x1a'));var client=jayson['client'][_0x387d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x39b151,_0x2cdd0f,_0x518c76,_0x10b71f){return new BPromise(function(_0x187d7d,_0x5314aa){var _0x31630d=_0x10b71f||client;return _0x31630d[_0x387d('0x1c')](_0x39b151,_0x518c76)[_0x387d('0x1d')](function(_0x334515){logger[_0x387d('0x1e')](_0x387d('0x1f'),_0x2cdd0f,_0x387d('0x20'));logger[_0x387d('0x21')](_0x387d('0x22'),_0x2cdd0f,_0x387d('0x20'),JSON[_0x387d('0x23')](_0x334515));if(_0x334515[_0x387d('0x24')]){if(_0x334515['error']['code']===0x1f4){logger[_0x387d('0x24')](_0x387d('0x1f'),_0x2cdd0f,_0x334515['error'][_0x387d('0x25')]);return _0x5314aa(_0x334515[_0x387d('0x24')]['message']);}logger['error'](_0x387d('0x1f'),_0x2cdd0f,_0x334515[_0x387d('0x24')]['message']);return _0x187d7d(_0x334515['error'][_0x387d('0x25')]);}else{logger[_0x387d('0x1e')](_0x387d('0x1f'),_0x2cdd0f,_0x387d('0x20'));_0x187d7d(_0x334515['result'][_0x387d('0x25')]);}})['catch'](function(_0x1cd052){logger[_0x387d('0x24')](_0x387d('0x1f'),_0x2cdd0f,_0x1cd052);_0x5314aa(_0x1cd052);});});}function respondWithStatusCode(_0x278920,_0x3e7ecd){_0x3e7ecd=_0x3e7ecd||0xcc;return function(_0x186e48){if(_0x186e48){return _0x278920[_0x387d('0x26')](_0x3e7ecd);}return _0x278920[_0x387d('0x27')](_0x3e7ecd)[_0x387d('0x28')]();};}function respondWithResult(_0x2c180f,_0x23b7ee){_0x23b7ee=_0x23b7ee||0xc8;return function(_0x3d521c){if(_0x3d521c){return _0x2c180f['status'](_0x23b7ee)[_0x387d('0x29')](_0x3d521c);}};}function respondWithFilteredResult(_0x71fda9,_0x538fd6){return function(_0x2e9c35){if(_0x2e9c35){var _0x48371b=typeof _0x538fd6[_0x387d('0x2a')]===_0x387d('0x2b')&&typeof _0x538fd6[_0x387d('0x2c')]===_0x387d('0x2b');var _0x447c6f=_0x2e9c35['count'];var _0x4fb562=_0x48371b?0x0:_0x538fd6['offset'];var _0x24b2b9=_0x48371b?_0x2e9c35[_0x387d('0x2d')]:_0x538fd6[_0x387d('0x2a')]+_0x538fd6[_0x387d('0x2c')];var _0x54c528;if(_0x24b2b9>=_0x447c6f){_0x24b2b9=_0x447c6f;_0x54c528=0xc8;}else{_0x54c528=0xce;}_0x71fda9[_0x387d('0x27')](_0x54c528);return _0x71fda9[_0x387d('0x2e')](_0x387d('0x2f'),_0x4fb562+'-'+_0x24b2b9+'/'+_0x447c6f)[_0x387d('0x29')](_0x2e9c35);}return null;};}function patchUpdates(_0x41c247){return function(_0x1805a8){try{jsonpatch[_0x387d('0x30')](_0x1805a8,_0x41c247,!![]);}catch(_0x7e1a4d){return BPromise[_0x387d('0x31')](_0x7e1a4d);}return _0x1805a8[_0x387d('0x32')]();};}function saveUpdates(_0x57e00c,_0x43b741){return function(_0x480a24){if(_0x480a24){return _0x480a24[_0x387d('0x33')](_0x57e00c)[_0x387d('0x1d')](function(_0x109f7b){return _0x109f7b;});}return null;};}function removeEntity(_0x9b452c,_0x57b3b5){return function(_0x4dd5c5){if(_0x4dd5c5){return _0x4dd5c5[_0x387d('0x34')]()[_0x387d('0x1d')](function(){var _0xeea464=_0x4dd5c5[_0x387d('0x35')]({'plain':!![]});var _0x198360=_0x387d('0x36');return db[_0x387d('0x37')][_0x387d('0x34')]({'where':{'type':_0x198360,'resourceId':_0xeea464['id']}})[_0x387d('0x1d')](function(){return _0x4dd5c5;});})[_0x387d('0x1d')](function(){_0x9b452c[_0x387d('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20987f,_0x5e3f2d){return function(_0x15f156){if(!_0x15f156){_0x20987f[_0x387d('0x26')](0x194);}return _0x15f156;};}function handleError(_0x73e6d8,_0x22e287){_0x22e287=_0x22e287||0x1f4;return function(_0x10c91c){logger[_0x387d('0x24')](_0x10c91c[_0x387d('0x38')]);if(_0x10c91c[_0x387d('0x39')]){delete _0x10c91c['name'];}_0x73e6d8[_0x387d('0x27')](_0x22e287)[_0x387d('0x3a')](_0x10c91c);};}exports['index']=function(_0x1e511d,_0x5aed4c){var _0x16ad4f={},_0x23edb8={},_0x5057e6={'count':0x0,'rows':[]};var _0x9accd6=_[_0x387d('0x3b')](db[_0x387d('0x3c')][_0x387d('0x3d')],function(_0x30b40f){return{'name':_0x30b40f[_0x387d('0x3e')],'type':_0x30b40f[_0x387d('0x3f')][_0x387d('0x40')]};});_0x23edb8[_0x387d('0x41')]=_[_0x387d('0x3b')](_0x9accd6,_0x387d('0x39'));_0x23edb8[_0x387d('0x42')]=_['keys'](_0x1e511d[_0x387d('0x42')]);_0x23edb8[_0x387d('0x43')]=_[_0x387d('0x44')](_0x23edb8['model'],_0x23edb8['query']);_0x16ad4f[_0x387d('0x45')]=_[_0x387d('0x44')](_0x23edb8[_0x387d('0x41')],qs[_0x387d('0x46')](_0x1e511d['query'][_0x387d('0x46')]));_0x16ad4f[_0x387d('0x45')]=_0x16ad4f[_0x387d('0x45')][_0x387d('0x47')]?_0x16ad4f['attributes']:_0x23edb8['model'];if(!_0x1e511d[_0x387d('0x42')][_0x387d('0x48')]('nolimit')){_0x16ad4f[_0x387d('0x2c')]=qs['limit'](_0x1e511d[_0x387d('0x42')]['limit']);_0x16ad4f[_0x387d('0x2a')]=qs[_0x387d('0x2a')](_0x1e511d[_0x387d('0x42')][_0x387d('0x2a')]);}_0x16ad4f[_0x387d('0x49')]=qs['sort'](_0x1e511d[_0x387d('0x42')]['sort']);_0x16ad4f[_0x387d('0x4a')]=qs[_0x387d('0x43')](_[_0x387d('0x4b')](_0x1e511d[_0x387d('0x42')],_0x23edb8['filters']),_0x9accd6);if(_0x1e511d['query'][_0x387d('0x4c')]){_0x16ad4f[_0x387d('0x4a')]=_[_0x387d('0x4d')](_0x16ad4f[_0x387d('0x4a')],{'$or':_[_0x387d('0x3b')](_0x9accd6,function(_0x3c7dd2){if(_0x3c7dd2[_0x387d('0x3f')]!==_0x387d('0x4e')){var _0x2addc5={};_0x2addc5[_0x3c7dd2[_0x387d('0x39')]]={'$like':'%'+_0x1e511d['query'][_0x387d('0x4c')]+'%'};return _0x2addc5;}})});}_0x16ad4f=_[_0x387d('0x4d')]({},_0x16ad4f,_0x1e511d[_0x387d('0x4f')]);var _0x51f151={'where':_0x16ad4f[_0x387d('0x4a')]};return db[_0x387d('0x3c')][_0x387d('0x2d')](_0x51f151)[_0x387d('0x1d')](function(_0x5bd7a5){_0x5057e6[_0x387d('0x2d')]=_0x5bd7a5;if(_0x1e511d[_0x387d('0x42')]['includeAll']){_0x16ad4f[_0x387d('0x50')]=[{'all':!![]}];}return db[_0x387d('0x3c')][_0x387d('0x51')](_0x16ad4f);})[_0x387d('0x1d')](function(_0x24e965){_0x5057e6[_0x387d('0x52')]=_0x24e965;return _0x5057e6;})[_0x387d('0x1d')](respondWithFilteredResult(_0x5aed4c,_0x16ad4f))[_0x387d('0x53')](handleError(_0x5aed4c,null));};exports['show']=function(_0x31b105,_0x1a29fe){var _0x3499ce={'raw':!![],'where':{'id':_0x31b105[_0x387d('0x54')]['id']}},_0x93f365={};_0x93f365['model']=_[_0x387d('0x55')](db[_0x387d('0x3c')][_0x387d('0x3d')]);_0x93f365[_0x387d('0x42')]=_[_0x387d('0x55')](_0x31b105[_0x387d('0x42')]);_0x93f365[_0x387d('0x43')]=_[_0x387d('0x44')](_0x93f365['model'],_0x93f365[_0x387d('0x42')]);_0x3499ce[_0x387d('0x45')]=_[_0x387d('0x44')](_0x93f365[_0x387d('0x41')],qs[_0x387d('0x46')](_0x31b105[_0x387d('0x42')][_0x387d('0x46')]));_0x3499ce[_0x387d('0x45')]=_0x3499ce[_0x387d('0x45')][_0x387d('0x47')]?_0x3499ce['attributes']:_0x93f365[_0x387d('0x41')];if(_0x31b105['query'][_0x387d('0x56')]){_0x3499ce[_0x387d('0x50')]=[{'all':!![]}];}_0x3499ce=_['merge']({},_0x3499ce,_0x31b105[_0x387d('0x4f')]);return db['ChatQueue'][_0x387d('0x57')](_0x3499ce)[_0x387d('0x1d')](handleEntityNotFound(_0x1a29fe,null))[_0x387d('0x1d')](respondWithResult(_0x1a29fe,null))['catch'](handleError(_0x1a29fe,null));};exports[_0x387d('0x58')]=function(_0x4ae3f3,_0x3a9bfe){return db[_0x387d('0x3c')][_0x387d('0x58')](_0x4ae3f3['body'],{})[_0x387d('0x1d')](function(_0x4ee31f){var _0x29f7ff=_0x4ae3f3[_0x387d('0x59')][_0x387d('0x35')]({'plain':!![]});if(!_0x29f7ff)throw new Error(_0x387d('0x5a'));if(_0x29f7ff[_0x387d('0x5b')]===_0x387d('0x59')){var _0x58110d=_0x4ee31f['get']({'plain':!![]});var _0x558598='ChatQueues';return db[_0x387d('0x5c')][_0x387d('0x57')]({'where':{'name':_0x558598,'userProfileId':_0x29f7ff['userProfileId']},'raw':!![]})['then'](function(_0x3f4190){if(_0x3f4190&&_0x3f4190['autoAssociation']===0x0){return db[_0x387d('0x37')][_0x387d('0x58')]({'name':_0x58110d[_0x387d('0x39')],'resourceId':_0x58110d['id'],'type':_0x3f4190[_0x387d('0x39')],'sectionId':_0x3f4190['id']},{})['then'](function(){return _0x4ee31f;});}else{return _0x4ee31f;}})['catch'](function(_0x506138){logger[_0x387d('0x24')](_0x387d('0x5d'),_0x506138);throw _0x506138;});}return _0x4ee31f;})['then'](respondWithResult(_0x3a9bfe,0xc9))[_0x387d('0x53')](handleError(_0x3a9bfe,null));};exports[_0x387d('0x33')]=function(_0x25bad7,_0xed862){if(_0x25bad7[_0x387d('0x5e')]['id']){delete _0x25bad7['body']['id'];}return db[_0x387d('0x3c')][_0x387d('0x57')]({'where':{'id':_0x25bad7['params']['id']}})[_0x387d('0x1d')](handleEntityNotFound(_0xed862,null))[_0x387d('0x1d')](saveUpdates(_0x25bad7[_0x387d('0x5e')],null))[_0x387d('0x1d')](respondWithResult(_0xed862,null))[_0x387d('0x53')](handleError(_0xed862,null));};exports[_0x387d('0x34')]=function(_0x3d633e,_0x1fdc27){return db[_0x387d('0x3c')][_0x387d('0x57')]({'where':{'id':_0x3d633e[_0x387d('0x54')]['id']}})[_0x387d('0x1d')](handleEntityNotFound(_0x1fdc27,null))[_0x387d('0x1d')](removeEntity(_0x1fdc27,null))[_0x387d('0x53')](handleError(_0x1fdc27,null));};exports[_0x387d('0x5f')]=function(_0x207713,_0x409a0d){return db[_0x387d('0x3c')][_0x387d('0x5f')]()[_0x387d('0x1d')](respondWithResult(_0x409a0d,null))[_0x387d('0x53')](handleError(_0x409a0d,null));};exports[_0x387d('0x60')]=function(_0x42710b,_0x5ef75d,_0x393ff2){var _0x59820f={'raw':!![],'where':{}},_0xd7a961={},_0x47ab28;return db[_0x387d('0x3c')][_0x387d('0x61')]({'where':{'id':_0x42710b[_0x387d('0x54')]['id']}})['then'](handleEntityNotFound(_0x5ef75d,null))['then'](function(_0x34b6d4){if(_0x34b6d4){_0x47ab28=_0x34b6d4[_0x387d('0x35')]({'plain':!![]});_0xd7a961[_0x387d('0x41')]=_[_0x387d('0x55')](db[_0x387d('0x62')][_0x387d('0x3d')]);_0xd7a961[_0x387d('0x42')]=_[_0x387d('0x55')](_0x42710b[_0x387d('0x42')]);_0xd7a961[_0x387d('0x43')]=_[_0x387d('0x44')](_0xd7a961[_0x387d('0x41')],_0xd7a961[_0x387d('0x42')]);_0x59820f[_0x387d('0x45')]=_[_0x387d('0x44')](_0xd7a961[_0x387d('0x41')],qs[_0x387d('0x46')](_0x42710b[_0x387d('0x42')][_0x387d('0x46')]));_0x59820f[_0x387d('0x45')]=_0x59820f[_0x387d('0x45')][_0x387d('0x47')]?_0x59820f['attributes']:_0xd7a961[_0x387d('0x41')];if(!_0x42710b[_0x387d('0x42')][_0x387d('0x48')](_0x387d('0x63'))){_0x59820f[_0x387d('0x2c')]=qs[_0x387d('0x2c')](_0x42710b[_0x387d('0x42')][_0x387d('0x2c')]);_0x59820f[_0x387d('0x2a')]=qs[_0x387d('0x2a')](_0x42710b['query'][_0x387d('0x2a')]);}_0x59820f[_0x387d('0x49')]=qs[_0x387d('0x64')](_0x42710b[_0x387d('0x42')][_0x387d('0x64')]);_0x59820f['where']=qs['filters'](_[_0x387d('0x4b')](_0x42710b[_0x387d('0x42')],_0xd7a961['filters']));_0x59820f[_0x387d('0x4a')][_0x387d('0x65')]=_0x34b6d4['id'];if(_0x42710b['query'][_0x387d('0x4c')]){_0x59820f[_0x387d('0x4a')]=_[_0x387d('0x4d')](_0x59820f[_0x387d('0x4a')],{'$or':_['map'](_0x59820f[_0x387d('0x45')],function(_0x23aeba){var _0xc0a2b8={};_0xc0a2b8[_0x23aeba]={'$like':'%'+_0x42710b[_0x387d('0x42')]['filter']+'%'};return _0xc0a2b8;})});}_0x59820f=_[_0x387d('0x4d')]({},_0x59820f,_0x42710b[_0x387d('0x4f')]);return db['UserChatQueue'][_0x387d('0x51')](_0x59820f);}})[_0x387d('0x1d')](function(_0x3ff9d3){if(_0x3ff9d3){return db[_0x387d('0x66')][_0x387d('0x67')]({'where':{'id':_[_0x387d('0x3b')](_0x3ff9d3,_0x387d('0x68')),'role':_0x387d('0x69')},'attributes':['id',_0x387d('0x39'),_0x387d('0x6a'),_0x387d('0x6b'),'createdAt']});}})[_0x387d('0x1d')](function(_0x12a7b2){if(_0x12a7b2){return{'count':_0x12a7b2[_0x387d('0x2d')],'rows':_[_0x387d('0x3b')](_0x12a7b2[_0x387d('0x52')],function(_0x213693){return{'membername':_0x213693[_0x387d('0x39')],'UserId':_0x213693['id'],'queue_name':_0x47ab28[_0x387d('0x39')],'ChatQueueId':_0x47ab28['id'],'interface':util[_0x387d('0x6c')]('%s/%s',_0x387d('0x6d'),_0x213693[_0x387d('0x39')]),'penalty':0x0,'paused':_0x213693['chatPause'],'createdAt':_0x213693[_0x387d('0x6e')],'updatedAt':_0x213693['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x387d('0x1d')](respondWithFilteredResult(_0x5ef75d,_0x59820f))['catch'](handleError(_0x5ef75d,null));};exports['getTeams']=function(_0x47c9b0,_0x1331f3,_0x204c40){var _0xf8937a={};var _0x53df53={};var _0x283b28;var _0x2dc1c9;return db[_0x387d('0x3c')][_0x387d('0x61')]({'where':{'id':_0x47c9b0[_0x387d('0x54')]['id']}})[_0x387d('0x1d')](handleEntityNotFound(_0x1331f3,null))[_0x387d('0x1d')](function(_0x1e4d69){if(_0x1e4d69){_0x283b28=_0x1e4d69;_0x53df53[_0x387d('0x41')]=_[_0x387d('0x55')](db[_0x387d('0x6f')][_0x387d('0x3d')]);_0x53df53[_0x387d('0x42')]=_[_0x387d('0x55')](_0x47c9b0[_0x387d('0x42')]);_0x53df53[_0x387d('0x43')]=_[_0x387d('0x44')](_0x53df53[_0x387d('0x41')],_0x53df53[_0x387d('0x42')]);_0xf8937a[_0x387d('0x45')]=_[_0x387d('0x44')](_0x53df53[_0x387d('0x41')],qs['fields'](_0x47c9b0[_0x387d('0x42')]['fields']));_0xf8937a[_0x387d('0x45')]=_0xf8937a[_0x387d('0x45')][_0x387d('0x47')]?_0xf8937a[_0x387d('0x45')]:_0x53df53['model'];_0xf8937a['order']=qs[_0x387d('0x64')](_0x47c9b0['query'][_0x387d('0x64')]);_0xf8937a[_0x387d('0x4a')]=qs[_0x387d('0x43')](_[_0x387d('0x4b')](_0x47c9b0['query'],_0x53df53['filters']));if(_0x47c9b0[_0x387d('0x42')][_0x387d('0x4c')]){_0xf8937a[_0x387d('0x4a')]=_[_0x387d('0x4d')](_0xf8937a['where'],{'$or':_[_0x387d('0x3b')](_0xf8937a[_0x387d('0x45')],function(_0xcd8fd3){var _0x1efb95={};_0x1efb95[_0xcd8fd3]={'$like':'%'+_0x47c9b0[_0x387d('0x42')][_0x387d('0x4c')]+'%'};return _0x1efb95;})});}_0xf8937a=_[_0x387d('0x4d')]({},_0xf8937a,_0x47c9b0[_0x387d('0x4f')]);return _0x283b28[_0x387d('0x70')](_0xf8937a);}})[_0x387d('0x1d')](function(_0xe0c155){if(_0xe0c155){_0x2dc1c9=_0xe0c155[_0x387d('0x47')];if(!_0x47c9b0[_0x387d('0x42')][_0x387d('0x48')](_0x387d('0x63'))){_0xf8937a[_0x387d('0x2c')]=qs[_0x387d('0x2c')](_0x47c9b0[_0x387d('0x42')][_0x387d('0x2c')]);_0xf8937a['offset']=qs[_0x387d('0x2a')](_0x47c9b0['query'][_0x387d('0x2a')]);}return _0x283b28[_0x387d('0x70')](_0xf8937a);}})['then'](function(_0x55936b){if(_0x55936b){return _0x55936b?{'count':_0x2dc1c9,'rows':_0x55936b}:null;}})[_0x387d('0x1d')](respondWithResult(_0x1331f3,null))[_0x387d('0x53')](handleError(_0x1331f3,null));};exports[_0x387d('0x71')]=function(_0x35dc9e,_0x13b889,_0x5a362e){var _0x45c6a6=_0x35dc9e[_0x387d('0x5e')]['ids'];return db[_0x387d('0x6f')]['findAll']({'where':{'id':_0x45c6a6},'attributes':['id'],'include':[{'model':db['User'],'as':_0x387d('0x72'),'attributes':['id','name','online','voicePause','interface'],'raw':!![]}]})[_0x387d('0x1d')](function(_0x2c0831){if(_0x2c0831){var _0x14cf4e=_[_0x387d('0x73')](_0x2c0831,function(_0x5444b3){var _0x3b0f89=_0x5444b3[_0x387d('0x35')]({'plain':!![]});return _0x3b0f89[_0x387d('0x72')];});return db[_0x387d('0x3c')][_0x387d('0x57')]({'where':{'id':_0x35dc9e['params']['id']}})[_0x387d('0x1d')](function(_0x8b180f){return db[_0x387d('0x74')][_0x387d('0x75')](function(_0x364229){return _0x8b180f[_0x387d('0x71')](_0x45c6a6,{'transaction':_0x364229})[_0x387d('0x1d')](function(){return BPromise[_0x387d('0x76')](_0x14cf4e,function(_0x1ff274){return db[_0x387d('0x62')][_0x387d('0x77')]({'where':{'UserId':_0x1ff274['id'],'ChatQueueId':_0x35dc9e[_0x387d('0x54')]['id']},'transaction':_0x364229});});})[_0x387d('0x1d')](function(){_0x14cf4e[_0x387d('0x78')](function(_0x3b15c4){socket[_0x387d('0x79')](_0x387d('0x7a'),{'UserId':_0x3b15c4['id'],'ChatQueueId':_0x8b180f['id']});});});});});}})[_0x387d('0x1d')](respondWithStatusCode(_0x13b889,null))[_0x387d('0x53')](handleError(_0x13b889,null));};exports[_0x387d('0x7b')]=function(_0x10cde7,_0x1575ec,_0x26de40){return db[_0x387d('0x6f')][_0x387d('0x51')]({'where':{'id':_0x10cde7[_0x387d('0x42')][_0x387d('0x7c')]},'attributes':['id'],'include':[{'model':db[_0x387d('0x66')],'as':_0x387d('0x72'),'attributes':['id'],'raw':!![]}]})[_0x387d('0x1d')](handleEntityNotFound(_0x1575ec,null))[_0x387d('0x1d')](function(_0x2e8868){var _0x3cc8ea=_['map'](_0x2e8868,'id');var _0x182122=[];var _0x1fe31e=[];var _0x345ed0=squel['select']();_0x345ed0['field'](_0x387d('0x7d'))[_0x387d('0x7e')](_0x387d('0x7f'),'tq')[_0x387d('0x80')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x387d('0x81'),_0x10cde7[_0x387d('0x54')]['id']);for(var _0x3a7b62=0x0;_0x3a7b62<_0x2e8868[_0x387d('0x47')];_0x3a7b62+=0x1){let _0x5290a7=_0x2e8868[_0x3a7b62];for(var _0x386a85=0x0;_0x386a85<_0x5290a7[_0x387d('0x72')]['length'];_0x386a85+=0x1){let _0x34ef55=_0x5290a7[_0x387d('0x72')][_0x386a85];var _0x9abcf3=_0x345ed0['clone']();_0x9abcf3['where'](_0x387d('0x82'),_0x34ef55['id']);_0x1fe31e[_0x387d('0x83')](db[_0x387d('0x74')][_0x387d('0x42')](_0x9abcf3['toString'](),{'type':db[_0x387d('0x74')]['QueryTypes'][_0x387d('0x84')]})[_0x387d('0x1d')](function(_0x6b7d61){if(_0x6b7d61['length']===0x1){return _0x34ef55['id'];}else{var _0x66559b=_[_0x387d('0x85')](_[_0x387d('0x3b')](_0x6b7d61,'TeamId'),function(_0x4f54a2){return _[_0x387d('0x86')](_0x3cc8ea,_0x4f54a2);});if(_0x66559b){return _0x34ef55['id'];}}}));}}return BPromise[_0x387d('0x87')](_0x1fe31e)[_0x387d('0x1d')](function(_0x328962){_0x182122=_(_0x182122)['union'](_0x328962)[_0x387d('0x88')]()[_0x387d('0x89')]();return db[_0x387d('0x3c')][_0x387d('0x57')]({'where':{'id':_0x10cde7[_0x387d('0x54')]['id']}})[_0x387d('0x1d')](function(_0x430927){return db[_0x387d('0x74')]['transaction'](function(_0xb11c9d){return _0x430927['removeTeams'](_0x10cde7[_0x387d('0x42')][_0x387d('0x7c')],{'transaction':_0xb11c9d})[_0x387d('0x1d')](function(){if(!_[_0x387d('0x8a')](_0x182122)){return _0x430927[_0x387d('0x8b')](_0x182122,{'transaction':_0xb11c9d});}})[_0x387d('0x1d')](function(){_0x182122[_0x387d('0x78')](function(_0x4e01e3){socket['emit']('userChatQueue:remove',{'UserId':_0x4e01e3,'ChatQueueId':_0x430927['id']});});});});});});})['then'](respondWithStatusCode(_0x1575ec,null))[_0x387d('0x53')](handleError(_0x1575ec,null));};exports[_0x387d('0x8c')]=function(_0x406f23,_0x21d55b,_0x34c24b){return db[_0x387d('0x3c')]['find']({'where':{'id':_0x406f23[_0x387d('0x54')]['id']}})[_0x387d('0x1d')](handleEntityNotFound(_0x21d55b,null))[_0x387d('0x1d')](function(_0xf9c423){if(_0xf9c423){return _0xf9c423[_0x387d('0x8c')](_0x406f23[_0x387d('0x5e')][_0x387d('0x7c')],_['omit'](_0x406f23['body'],['ids','id'])||{})[_0x387d('0x8d')](function(_0xfd1871){for(var _0x28c7f8=0x0;_0x28c7f8<_0x406f23['body'][_0x387d('0x7c')]['length'];_0x28c7f8+=0x1){socket[_0x387d('0x79')](_0x387d('0x7a'),{'UserId':Number(_0x406f23['body'][_0x387d('0x7c')][_0x28c7f8]),'ChatQueueId':Number(_0x406f23[_0x387d('0x54')]['id'])});}return _0xfd1871;});}})[_0x387d('0x1d')](respondWithResult(_0x21d55b,null))['catch'](handleError(_0x21d55b,null));};exports[_0x387d('0x8b')]=function(_0x25a670,_0x3ef766,_0x501e54){return db['ChatQueue'][_0x387d('0x57')]({'where':{'id':_0x25a670[_0x387d('0x54')]['id']}})['then'](handleEntityNotFound(_0x3ef766,null))['then'](function(_0x26e0dd){if(_0x26e0dd){return _0x26e0dd[_0x387d('0x8b')](_0x25a670[_0x387d('0x42')][_0x387d('0x7c')])[_0x387d('0x1d')](function(){if(_['isArray'](_0x25a670[_0x387d('0x42')][_0x387d('0x7c')])){for(var _0x1fa29e=0x0;_0x1fa29e<_0x25a670[_0x387d('0x42')][_0x387d('0x7c')][_0x387d('0x47')];_0x1fa29e+=0x1){socket['emit'](_0x387d('0x8e'),{'UserId':Number(_0x25a670[_0x387d('0x42')][_0x387d('0x7c')][_0x1fa29e]),'ChatQueueId':Number(_0x25a670[_0x387d('0x54')]['id'])});}}else{socket[_0x387d('0x79')](_0x387d('0x8e'),{'UserId':Number(_0x25a670['query']['ids']),'ChatQueueId':Number(_0x25a670[_0x387d('0x54')]['id'])});}});}})[_0x387d('0x1d')](respondWithStatusCode(_0x3ef766,null))[_0x387d('0x53')](handleError(_0x3ef766,null));};exports['getAgents']=function(_0x5527e7,_0x143e77,_0x55aef7){var _0x12704c={};var _0x32aa22={};var _0x56596c;var _0x1f3111;return db[_0x387d('0x3c')][_0x387d('0x61')]({'where':{'id':_0x5527e7['params']['id']}})['then'](handleEntityNotFound(_0x143e77,null))[_0x387d('0x1d')](function(_0x18955b){if(_0x18955b){_0x56596c=_0x18955b;_0x32aa22[_0x387d('0x41')]=_[_0x387d('0x55')](db[_0x387d('0x66')]['rawAttributes']);_0x32aa22[_0x387d('0x42')]=_[_0x387d('0x55')](_0x5527e7[_0x387d('0x42')]);_0x32aa22['filters']=_[_0x387d('0x44')](_0x32aa22[_0x387d('0x41')],_0x32aa22[_0x387d('0x42')]);_0x12704c[_0x387d('0x45')]=_[_0x387d('0x44')](_0x32aa22['model'],qs['fields'](_0x5527e7[_0x387d('0x42')][_0x387d('0x46')]));_0x12704c[_0x387d('0x45')]=_0x12704c[_0x387d('0x45')][_0x387d('0x47')]?_0x12704c[_0x387d('0x45')]:_0x32aa22[_0x387d('0x41')];_0x12704c[_0x387d('0x49')]=qs[_0x387d('0x64')](_0x5527e7[_0x387d('0x42')]['sort']);_0x12704c[_0x387d('0x4a')]=qs[_0x387d('0x43')](_['pick'](_0x5527e7['query'],_0x32aa22['filters']));if(_0x5527e7['query'][_0x387d('0x4c')]){_0x12704c[_0x387d('0x4a')]=_[_0x387d('0x4d')](_0x12704c['where'],{'$or':_['map'](_0x12704c[_0x387d('0x45')],function(_0x20e751){var _0xcff30f={};_0xcff30f[_0x20e751]={'$like':'%'+_0x5527e7[_0x387d('0x42')][_0x387d('0x4c')]+'%'};return _0xcff30f;})});}_0x12704c=_[_0x387d('0x4d')]({},_0x12704c,_0x5527e7['options']);return _0x56596c[_0x387d('0x8f')](_0x12704c);}})[_0x387d('0x1d')](function(_0x1f00d7){if(_0x1f00d7){_0x1f3111=_0x1f00d7[_0x387d('0x47')];if(!_0x5527e7[_0x387d('0x42')][_0x387d('0x48')]('nolimit')){_0x12704c[_0x387d('0x2c')]=qs[_0x387d('0x2c')](_0x5527e7[_0x387d('0x42')][_0x387d('0x2c')]);_0x12704c[_0x387d('0x2a')]=qs[_0x387d('0x2a')](_0x5527e7[_0x387d('0x42')]['offset']);}return _0x56596c[_0x387d('0x8f')](_0x12704c);}})['then'](function(_0x54734a){if(_0x54734a){return _0x54734a?{'count':_0x1f3111,'rows':_0x54734a}:null;}})[_0x387d('0x1d')](respondWithResult(_0x143e77,null))[_0x387d('0x53')](handleError(_0x143e77,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 6be82f4..47276af 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 _0x9cb8=['update','remove','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x9cb8,0x155));var _0x89cb=function(_0x439f63,_0x53dee3){_0x439f63=_0x439f63-0x0;var _0x570d0a=_0x9cb8[_0x439f63];return _0x570d0a;};'use strict';var EventEmitter=require(_0x89cb('0x0'));var ChatQueue=require(_0x89cb('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x89cb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x89cb('0x3'),'afterDestroy':_0x89cb('0x4')};function emitEvent(_0x5cb1ab){return function(_0x108431,_0x299c2d,_0x4d95e3){ChatQueueEvents['emit'](_0x5cb1ab+':'+_0x108431['id'],_0x108431);ChatQueueEvents['emit'](_0x5cb1ab,_0x108431);_0x4d95e3(null);};}for(var e in events){if(events[_0x89cb('0x5')](e)){var event=events[e];ChatQueue[_0x89cb('0x6')](e,emitEvent(event));}}module[_0x89cb('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0xa67b=['../../mysqldb','ChatQueue','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x21a49e,_0x35b78c){var _0xafb8fa=function(_0x3cbbd0){while(--_0x3cbbd0){_0x21a49e['push'](_0x21a49e['shift']());}};_0xafb8fa(++_0x35b78c);}(_0xa67b,0xc5));var _0xba67=function(_0x817e9b,_0x15800c){_0x817e9b=_0x817e9b-0x0;var _0x71162f=_0xa67b[_0x817e9b];return _0x71162f;};'use strict';var EventEmitter=require(_0xba67('0x0'));var ChatQueue=require(_0xba67('0x1'))['db'][_0xba67('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xba67('0x3'),'afterUpdate':'update','afterDestroy':_0xba67('0x4')};function emitEvent(_0xe75443){return function(_0x550f0e,_0x268c6a,_0x6cc93e){ChatQueueEvents['emit'](_0xe75443+':'+_0x550f0e['id'],_0x550f0e);ChatQueueEvents[_0xba67('0x5')](_0xe75443,_0x550f0e);_0x6cc93e(null);};}for(var e in events){if(events[_0xba67('0x6')](e)){var event=events[e];ChatQueue[_0xba67('0x7')](e,emitEvent(event));}}module[_0xba67('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 1808236..4d62841 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 _0xd935=['../../config/logger','api','moment','request-promise','path','rimraf','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util'];(function(_0x5d1e63,_0x2d5c8f){var _0x408c1d=function(_0x24949a){while(--_0x24949a){_0x5d1e63['push'](_0x5d1e63['shift']());}};_0x408c1d(++_0x2d5c8f);}(_0xd935,0x8d));var _0x5d93=function(_0x498468,_0x4558db){_0x498468=_0x498468-0x0;var _0x57cb61=_0xd935[_0x498468];return _0x57cb61;};'use strict';var _=require(_0x5d93('0x0'));var util=require(_0x5d93('0x1'));var logger=require(_0x5d93('0x2'))(_0x5d93('0x3'));var moment=require(_0x5d93('0x4'));var BPromise=require('bluebird');var rp=require(_0x5d93('0x5'));var fs=require('fs');var path=require(_0x5d93('0x6'));var rimraf=require(_0x5d93('0x7'));var config=require('../../config/environment');var attributes=require(_0x5d93('0x8'));module[_0x5d93('0x9')]=function(_0x4cadde,_0x19185f){return _0x4cadde[_0x5d93('0xa')](_0x5d93('0xb'),attributes,{'tableName':_0x5d93('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa6af=['chat_queues','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./chatQueue.attributes','define','ChatQueue'];(function(_0x441b29,_0x7c92ab){var _0x4e3bbe=function(_0x682ee4){while(--_0x682ee4){_0x441b29['push'](_0x441b29['shift']());}};_0x4e3bbe(++_0x7c92ab);}(_0xa6af,0x1da));var _0xfa6a=function(_0x5b2a50,_0x369b12){_0x5b2a50=_0x5b2a50-0x0;var _0x4dc9db=_0xa6af[_0x5b2a50];return _0x4dc9db;};'use strict';var _=require(_0xfa6a('0x0'));var util=require(_0xfa6a('0x1'));var logger=require('../../config/logger')(_0xfa6a('0x2'));var moment=require(_0xfa6a('0x3'));var BPromise=require(_0xfa6a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfa6a('0x5'));var config=require(_0xfa6a('0x6'));var attributes=require(_0xfa6a('0x7'));module['exports']=function(_0x1e0e49,_0x53ff0d){return _0x1e0e49[_0xfa6a('0x8')](_0xfa6a('0x9'),attributes,{'tableName':_0xfa6a('0xa'),'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 b0b88fc..e0ce226 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 _0xa81d=['include','map','model','GetChatQueue','ShowChatQueue','find','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatQueue','findAll','options','raw','where','attributes'];(function(_0x14f815,_0x2ee3ce){var _0x1211ae=function(_0x407f7a){while(--_0x407f7a){_0x14f815['push'](_0x14f815['shift']());}};_0x1211ae(++_0x2ee3ce);}(_0xa81d,0x11e));var _0xda81=function(_0x4500b6,_0x29d34f){_0x4500b6=_0x4500b6-0x0;var _0x4b957e=_0xa81d[_0x4500b6];return _0x4b957e;};'use strict';var _=require(_0xda81('0x0'));var util=require(_0xda81('0x1'));var moment=require('moment');var BPromise=require(_0xda81('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda81('0x3'));var db=require(_0xda81('0x4'))['db'];var utils=require(_0xda81('0x5'));var logger=require(_0xda81('0x6'))(_0xda81('0x7'));var config=require(_0xda81('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xda81('0x9')]({'port':0x232a});config['redis']=_[_0xda81('0xa')](config[_0xda81('0xb')],{'host':_0xda81('0xc'),'port':0x18eb});var socket=require(_0xda81('0xd'))(new Redis(config[_0xda81('0xb')]));require(_0xda81('0xe'))['register'](socket);function respondWithRpcPromise(_0x4db7f3,_0xd1bd2a,_0x5af9c5){return new BPromise(function(_0xb545b5,_0x21afe9){return client[_0xda81('0xf')](_0x4db7f3,_0x5af9c5)[_0xda81('0x10')](function(_0x420c67){logger[_0xda81('0x11')](_0xda81('0x12'),_0xd1bd2a,_0xda81('0x13'));logger[_0xda81('0x14')](_0xda81('0x15'),_0xd1bd2a,'request\x20sent',JSON[_0xda81('0x16')](_0x420c67));if(_0x420c67[_0xda81('0x17')]){if(_0x420c67['error'][_0xda81('0x18')]===0x1f4){logger['error'](_0xda81('0x12'),_0xd1bd2a,_0x420c67['error'][_0xda81('0x19')]);return _0x21afe9(_0x420c67[_0xda81('0x17')][_0xda81('0x19')]);}logger[_0xda81('0x17')](_0xda81('0x12'),_0xd1bd2a,_0x420c67[_0xda81('0x17')]['message']);return _0xb545b5(_0x420c67[_0xda81('0x17')][_0xda81('0x19')]);}else{logger[_0xda81('0x11')](_0xda81('0x12'),_0xd1bd2a,_0xda81('0x13'));_0xb545b5(_0x420c67[_0xda81('0x1a')][_0xda81('0x19')]);}})[_0xda81('0x1b')](function(_0x415465){logger[_0xda81('0x17')](_0xda81('0x12'),_0xd1bd2a,_0x415465);_0x21afe9(_0x415465);});});}exports['GetChatQueue']=function(_0x186539){var _0x50b080=this;return new Promise(function(_0x291b6d,_0x2353bd){return db[_0xda81('0x1c')][_0xda81('0x1d')]({'raw':_0x186539[_0xda81('0x1e')]?_0x186539[_0xda81('0x1e')][_0xda81('0x1f')]===undefined?!![]:![]:!![],'where':_0x186539[_0xda81('0x1e')]?_0x186539[_0xda81('0x1e')][_0xda81('0x20')]||null:null,'attributes':_0x186539[_0xda81('0x1e')]?_0x186539[_0xda81('0x1e')][_0xda81('0x21')]||null:null,'limit':_0x186539[_0xda81('0x1e')]?_0x186539['options']['limit']||null:null,'include':_0x186539[_0xda81('0x1e')]?_0x186539[_0xda81('0x1e')][_0xda81('0x22')]?_[_0xda81('0x23')](_0x186539[_0xda81('0x1e')]['include'],function(_0x2caa71){return{'model':db[_0x2caa71[_0xda81('0x24')]],'as':_0x2caa71['as'],'attributes':_0x2caa71[_0xda81('0x21')],'include':_0x2caa71[_0xda81('0x22')]?_[_0xda81('0x23')](_0x2caa71[_0xda81('0x22')],function(_0x3e8a14){return{'model':db[_0x3e8a14[_0xda81('0x24')]],'as':_0x3e8a14['as'],'attributes':_0x3e8a14[_0xda81('0x21')],'include':_0x3e8a14[_0xda81('0x22')]?_[_0xda81('0x23')](_0x3e8a14['include'],function(_0x3948af){return{'model':db[_0x3948af[_0xda81('0x24')]],'as':_0x3948af['as'],'attributes':_0x3948af[_0xda81('0x21')]};}):[]};}):[]};}):[]:[]})[_0xda81('0x10')](function(_0x3d2e9b){logger[_0xda81('0x11')](_0xda81('0x25'),_0x186539);logger[_0xda81('0x14')](_0xda81('0x25'),_0x186539,JSON[_0xda81('0x16')](_0x3d2e9b));_0x291b6d(_0x3d2e9b);})[_0xda81('0x1b')](function(_0x3337f6){logger[_0xda81('0x17')](_0xda81('0x25'),_0x3337f6['message'],_0x186539);_0x2353bd(_0x50b080[_0xda81('0x17')](0x1f4,_0x3337f6[_0xda81('0x19')]));});});};exports[_0xda81('0x26')]=function(_0x5d939b){var _0x39d43f=this;return new Promise(function(_0x23edc3,_0x3d656c){return db[_0xda81('0x1c')][_0xda81('0x27')]({'raw':_0x5d939b[_0xda81('0x1e')]?_0x5d939b[_0xda81('0x1e')][_0xda81('0x1f')]===undefined?!![]:![]:!![],'where':_0x5d939b['options']?_0x5d939b[_0xda81('0x1e')][_0xda81('0x20')]||null:null,'attributes':_0x5d939b['options']?_0x5d939b['options'][_0xda81('0x21')]||null:null,'include':_0x5d939b['options']?_0x5d939b[_0xda81('0x1e')][_0xda81('0x22')]?_[_0xda81('0x23')](_0x5d939b[_0xda81('0x1e')][_0xda81('0x22')],function(_0x58d4e3){return{'model':db[_0x58d4e3[_0xda81('0x24')]],'as':_0x58d4e3['as'],'attributes':_0x58d4e3[_0xda81('0x21')],'include':_0x58d4e3['include']?_['map'](_0x58d4e3[_0xda81('0x22')],function(_0x46b8b3){return{'model':db[_0x46b8b3[_0xda81('0x24')]],'as':_0x46b8b3['as'],'attributes':_0x46b8b3[_0xda81('0x21')],'include':_0x46b8b3[_0xda81('0x22')]?_[_0xda81('0x23')](_0x46b8b3['include'],function(_0x5acdeb){return{'model':db[_0x5acdeb[_0xda81('0x24')]],'as':_0x5acdeb['as'],'attributes':_0x5acdeb['attributes']};}):[]};}):[]};}):[]:[]})[_0xda81('0x10')](function(_0x3c8648){logger['info'](_0xda81('0x26'),_0x5d939b);logger['debug'](_0xda81('0x26'),_0x5d939b,JSON[_0xda81('0x16')](_0x3c8648));_0x23edc3(_0x3c8648);})[_0xda81('0x1b')](function(_0x1b9090){logger[_0xda81('0x17')](_0xda81('0x26'),_0x1b9090['message'],_0x5d939b);_0x3d656c(_0x39d43f[_0xda81('0x17')](0x1f4,_0x1b9090[_0xda81('0x19')]));});});}; \ No newline at end of file +var _0x3ef7=['ShowChatQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./chatQueue.socket','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0xca1f0e,_0x2713d5){var _0x35e4ef=function(_0x44c40f){while(--_0x44c40f){_0xca1f0e['push'](_0xca1f0e['shift']());}};_0x35e4ef(++_0x2713d5);}(_0x3ef7,0xa2));var _0x73ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ef7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x73ef('0x0'));var util=require('util');var moment=require(_0x73ef('0x1'));var BPromise=require(_0x73ef('0x2'));var rs=require(_0x73ef('0x3'));var fs=require('fs');var Redis=require(_0x73ef('0x4'));var db=require(_0x73ef('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x73ef('0x6'))(_0x73ef('0x7'));var config=require(_0x73ef('0x8'));var jayson=require(_0x73ef('0x9'));var client=jayson['client'][_0x73ef('0xa')]({'port':0x232a});config[_0x73ef('0xb')]=_[_0x73ef('0xc')](config[_0x73ef('0xb')],{'host':_0x73ef('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x73ef('0xb')]));require(_0x73ef('0xe'))['register'](socket);function respondWithRpcPromise(_0x1055e1,_0x21bfed,_0x364470){return new BPromise(function(_0x3bd4c9,_0x33aa09){return client['request'](_0x1055e1,_0x364470)[_0x73ef('0xf')](function(_0x111ce3){logger[_0x73ef('0x10')](_0x73ef('0x11'),_0x21bfed,_0x73ef('0x12'));logger[_0x73ef('0x13')](_0x73ef('0x14'),_0x21bfed,_0x73ef('0x12'),JSON[_0x73ef('0x15')](_0x111ce3));if(_0x111ce3[_0x73ef('0x16')]){if(_0x111ce3[_0x73ef('0x16')][_0x73ef('0x17')]===0x1f4){logger[_0x73ef('0x16')]('ChatQueue,\x20%s,\x20%s',_0x21bfed,_0x111ce3[_0x73ef('0x16')]['message']);return _0x33aa09(_0x111ce3[_0x73ef('0x16')][_0x73ef('0x18')]);}logger[_0x73ef('0x16')]('ChatQueue,\x20%s,\x20%s',_0x21bfed,_0x111ce3[_0x73ef('0x16')][_0x73ef('0x18')]);return _0x3bd4c9(_0x111ce3['error'][_0x73ef('0x18')]);}else{logger[_0x73ef('0x10')](_0x73ef('0x11'),_0x21bfed,_0x73ef('0x12'));_0x3bd4c9(_0x111ce3[_0x73ef('0x19')]['message']);}})[_0x73ef('0x1a')](function(_0x4dc000){logger[_0x73ef('0x16')]('ChatQueue,\x20%s,\x20%s',_0x21bfed,_0x4dc000);_0x33aa09(_0x4dc000);});});}exports[_0x73ef('0x1b')]=function(_0x2168ec){var _0x36d02f=this;return new Promise(function(_0x2c4d28,_0x35d733){return db[_0x73ef('0x1c')][_0x73ef('0x1d')]({'raw':_0x2168ec[_0x73ef('0x1e')]?_0x2168ec['options'][_0x73ef('0x1f')]===undefined?!![]:![]:!![],'where':_0x2168ec[_0x73ef('0x1e')]?_0x2168ec[_0x73ef('0x1e')][_0x73ef('0x20')]||null:null,'attributes':_0x2168ec['options']?_0x2168ec[_0x73ef('0x1e')][_0x73ef('0x21')]||null:null,'limit':_0x2168ec[_0x73ef('0x1e')]?_0x2168ec[_0x73ef('0x1e')][_0x73ef('0x22')]||null:null,'include':_0x2168ec[_0x73ef('0x1e')]?_0x2168ec[_0x73ef('0x1e')][_0x73ef('0x23')]?_[_0x73ef('0x24')](_0x2168ec[_0x73ef('0x1e')]['include'],function(_0x2f9cae){return{'model':db[_0x2f9cae[_0x73ef('0x25')]],'as':_0x2f9cae['as'],'attributes':_0x2f9cae['attributes'],'include':_0x2f9cae['include']?_[_0x73ef('0x24')](_0x2f9cae['include'],function(_0x592e57){return{'model':db[_0x592e57[_0x73ef('0x25')]],'as':_0x592e57['as'],'attributes':_0x592e57[_0x73ef('0x21')],'include':_0x592e57[_0x73ef('0x23')]?_[_0x73ef('0x24')](_0x592e57['include'],function(_0x35462d){return{'model':db[_0x35462d['model']],'as':_0x35462d['as'],'attributes':_0x35462d[_0x73ef('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x946100){logger[_0x73ef('0x10')](_0x73ef('0x1b'),_0x2168ec);logger[_0x73ef('0x13')](_0x73ef('0x1b'),_0x2168ec,JSON[_0x73ef('0x15')](_0x946100));_0x2c4d28(_0x946100);})[_0x73ef('0x1a')](function(_0x557b5d){logger[_0x73ef('0x16')](_0x73ef('0x1b'),_0x557b5d[_0x73ef('0x18')],_0x2168ec);_0x35d733(_0x36d02f['error'](0x1f4,_0x557b5d['message']));});});};exports[_0x73ef('0x26')]=function(_0x44b8c3){var _0x5f39e3=this;return new Promise(function(_0x252d1a,_0x589c4e){return db[_0x73ef('0x1c')][_0x73ef('0x27')]({'raw':_0x44b8c3[_0x73ef('0x1e')]?_0x44b8c3['options'][_0x73ef('0x1f')]===undefined?!![]:![]:!![],'where':_0x44b8c3[_0x73ef('0x1e')]?_0x44b8c3['options'][_0x73ef('0x20')]||null:null,'attributes':_0x44b8c3[_0x73ef('0x1e')]?_0x44b8c3[_0x73ef('0x1e')]['attributes']||null:null,'include':_0x44b8c3[_0x73ef('0x1e')]?_0x44b8c3[_0x73ef('0x1e')][_0x73ef('0x23')]?_['map'](_0x44b8c3[_0x73ef('0x1e')][_0x73ef('0x23')],function(_0x4100fb){return{'model':db[_0x4100fb[_0x73ef('0x25')]],'as':_0x4100fb['as'],'attributes':_0x4100fb[_0x73ef('0x21')],'include':_0x4100fb[_0x73ef('0x23')]?_[_0x73ef('0x24')](_0x4100fb[_0x73ef('0x23')],function(_0x459306){return{'model':db[_0x459306[_0x73ef('0x25')]],'as':_0x459306['as'],'attributes':_0x459306['attributes'],'include':_0x459306[_0x73ef('0x23')]?_[_0x73ef('0x24')](_0x459306[_0x73ef('0x23')],function(_0x50a986){return{'model':db[_0x50a986[_0x73ef('0x25')]],'as':_0x50a986['as'],'attributes':_0x50a986[_0x73ef('0x21')]};}):[]};}):[]};}):[]:[]})[_0x73ef('0xf')](function(_0x1303d9){logger[_0x73ef('0x10')]('ShowChatQueue',_0x44b8c3);logger['debug']('ShowChatQueue',_0x44b8c3,JSON[_0x73ef('0x15')](_0x1303d9));_0x252d1a(_0x1303d9);})[_0x73ef('0x1a')](function(_0x4e277c){logger[_0x73ef('0x16')](_0x73ef('0x26'),_0x4e277c[_0x73ef('0x18')],_0x44b8c3);_0x589c4e(_0x5f39e3['error'](0x1f4,_0x4e277c[_0x73ef('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 37db6a9..75a0ea2 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 _0x81bd=['save','remove','update','removeListener','./chatQueue.events'];(function(_0x2868ec,_0x3aef29){var _0x2ad998=function(_0x554d06){while(--_0x554d06){_0x2868ec['push'](_0x2868ec['shift']());}};_0x2ad998(++_0x3aef29);}(_0x81bd,0x7c));var _0xd81b=function(_0x12d951,_0x249808){_0x12d951=_0x12d951-0x0;var _0x44de17=_0x81bd[_0x12d951];return _0x44de17;};'use strict';var ChatQueueEvents=require(_0xd81b('0x0'));var events=[_0xd81b('0x1'),_0xd81b('0x2'),_0xd81b('0x3')];function createListener(_0x2d27cb,_0x2ec03a){return function(_0x111a9c){_0x2ec03a['emit'](_0x2d27cb,_0x111a9c);};}function removeListener(_0x16e8de,_0x2c3d9e){return function(){ChatQueueEvents[_0xd81b('0x4')](_0x16e8de,_0x2c3d9e);};}exports['register']=function(_0x42a0aa){for(var _0x34eb73=0x0,_0x1f3f2c=events['length'];_0x34eb73<_0x1f3f2c;_0x34eb73++){var _0x5e14e8=events[_0x34eb73];var _0xa4cf97=createListener('chatQueue:'+_0x5e14e8,_0x42a0aa);ChatQueueEvents['on'](_0x5e14e8,_0xa4cf97);}}; \ No newline at end of file +var _0x5db8=['remove','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x5e4ed4,_0x3eca5e){var _0x1c0c29=function(_0x28fa08){while(--_0x28fa08){_0x5e4ed4['push'](_0x5e4ed4['shift']());}};_0x1c0c29(++_0x3eca5e);}(_0x5db8,0xbb));var _0x85db=function(_0x5c6994,_0x19ad9a){_0x5c6994=_0x5c6994-0x0;var _0x1d5c84=_0x5db8[_0x5c6994];return _0x1d5c84;};'use strict';var ChatQueueEvents=require(_0x85db('0x0'));var events=[_0x85db('0x1'),_0x85db('0x2'),'update'];function createListener(_0x14ab3d,_0x16c069){return function(_0x42c47f){_0x16c069['emit'](_0x14ab3d,_0x42c47f);};}function removeListener(_0x5b7426,_0x13c216){return function(){ChatQueueEvents[_0x85db('0x3')](_0x5b7426,_0x13c216);};}exports[_0x85db('0x4')]=function(_0x34d71f){for(var _0x48bf16=0x0,_0x489b13=events[_0x85db('0x5')];_0x48bf16<_0x489b13;_0x48bf16++){var _0x3a10dd=events[_0x48bf16];var _0xc6fd00=createListener(_0x85db('0x6')+_0x3a10dd,_0x34d71f);ChatQueueEvents['on'](_0x3a10dd,_0xc6fd00);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 2a643d8..f3d12bd 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 _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(_0x5fa910,_0x3a7dbc){var _0x3ca597=function(_0xa9c417){while(--_0xa9c417){_0x5fa910['push'](_0x5fa910['shift']());}};_0x3ca597(++_0x3a7dbc);}(_0x008c,0x188));var _0xc008=function(_0x42d41d,_0x17b8ea){_0x42d41d=_0x42d41d-0x0;var _0x2e6184=_0x008c[_0x42d41d];return _0x2e6184;};'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 +var _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x56ec52,_0x35e3c3){var _0x324eb2=function(_0x38a417){while(--_0x38a417){_0x56ec52['push'](_0x56ec52['shift']());}};_0x324eb2(++_0x35e3c3);}(_0x55ca,0x126));var _0xa55c=function(_0x2e93d0,_0x5d6526){_0x2e93d0=_0x2e93d0-0x0;var _0x2a88a6=_0x55ca[_0x2e93d0];return _0x2a88a6;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index f7f18c6..14fe0b6 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 _0xfa1b=['exports','STRING','DATE','sequelize'];(function(_0x52096b,_0x20bab4){var _0x2b1cc7=function(_0x3f7021){while(--_0x3f7021){_0x52096b['push'](_0x52096b['shift']());}};_0x2b1cc7(++_0x20bab4);}(_0xfa1b,0xaf));var _0xbfa1=function(_0x4a0f12,_0x3986c8){_0x4a0f12=_0x4a0f12-0x0;var _0x597b2c=_0xfa1b[_0x4a0f12];return _0x597b2c;};'use strict';var moment=require('moment');var Sequelize=require(_0xbfa1('0x0'));module[_0xbfa1('0x1')]={'uniqueid':{'type':Sequelize[_0xbfa1('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xbfa1('0x2')]},'joinAt':{'type':Sequelize[_0xbfa1('0x3')]},'leaveAt':{'type':Sequelize[_0xbfa1('0x3')]},'acceptAt':{'type':Sequelize[_0xbfa1('0x3')]},'exitAt':{'type':Sequelize[_0xbfa1('0x3')]},'reason':{'type':Sequelize[_0xbfa1('0x2')]}}; \ No newline at end of file +var _0xb82a=['exports','STRING','DATE','sequelize'];(function(_0x3fbbd0,_0x269a1f){var _0x135c98=function(_0x19cda4){while(--_0x19cda4){_0x3fbbd0['push'](_0x3fbbd0['shift']());}};_0x135c98(++_0x269a1f);}(_0xb82a,0x93));var _0xab82=function(_0x39c87d,_0x51e136){_0x39c87d=_0x39c87d-0x0;var _0x2a87ec=_0xb82a[_0x39c87d];return _0x2a87ec;};'use strict';var moment=require('moment');var Sequelize=require(_0xab82('0x0'));module[_0xab82('0x1')]={'uniqueid':{'type':Sequelize[_0xab82('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xab82('0x3')]},'leaveAt':{'type':Sequelize[_0xab82('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xab82('0x3')]},'reason':{'type':Sequelize[_0xab82('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 4d8e19d..21a08cf 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 _0xd48e=['create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','update','then','destroy','error','name','index','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','ChatQueueReport','count','includeAll','include','rows','catch','show','params','keys','find'];(function(_0x46596f,_0x300967){var _0x5f0981=function(_0x290396){while(--_0x290396){_0x46596f['push'](_0x46596f['shift']());}};_0x5f0981(++_0x300967);}(_0xd48e,0x93));var _0xed48=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0xd48e[_0x2aa0e7];return _0x1472c0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xed48('0x0'));var zipdir=require(_0xed48('0x1'));var jsonpatch=require(_0xed48('0x2'));var rp=require(_0xed48('0x3'));var moment=require(_0xed48('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xed48('0x5'));var util=require(_0xed48('0x6'));var path=require(_0xed48('0x7'));var sox=require('sox');var csv=require(_0xed48('0x8'));var ejs=require(_0xed48('0x9'));var fs=require('fs');var fs_extra=require(_0xed48('0xa'));var _=require('lodash');var squel=require(_0xed48('0xb'));var crypto=require(_0xed48('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xed48('0xd'));var Papa=require(_0xed48('0xe'));var Redis=require(_0xed48('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xed48('0x10'));var hardwareService=require(_0xed48('0x11'));var logger=require(_0xed48('0x12'))('api');var utils=require(_0xed48('0x13'));var config=require(_0xed48('0x14'));var licenseUtil=require(_0xed48('0x15'));var db=require(_0xed48('0x16'))['db'];function respondWithStatusCode(_0x7ee238,_0xaf4b6d){_0xaf4b6d=_0xaf4b6d||0xcc;return function(_0x30bb80){if(_0x30bb80){return _0x7ee238[_0xed48('0x17')](_0xaf4b6d);}return _0x7ee238[_0xed48('0x18')](_0xaf4b6d)[_0xed48('0x19')]();};}function respondWithResult(_0x408ce8,_0x24e67c){_0x24e67c=_0x24e67c||0xc8;return function(_0x429024){if(_0x429024){return _0x408ce8['status'](_0x24e67c)[_0xed48('0x1a')](_0x429024);}};}function respondWithFilteredResult(_0x4a0296,_0x3bf0b7){return function(_0x4d23d9){if(_0x4d23d9){var _0x4d896f=typeof _0x3bf0b7[_0xed48('0x1b')]===_0xed48('0x1c')&&typeof _0x3bf0b7[_0xed48('0x1d')]===_0xed48('0x1c');var _0x1d0d94=_0x4d23d9['count'];var _0x355224=_0x4d896f?0x0:_0x3bf0b7['offset'];var _0x10c4a8=_0x4d896f?_0x4d23d9['count']:_0x3bf0b7[_0xed48('0x1b')]+_0x3bf0b7[_0xed48('0x1d')];var _0x122bf1;if(_0x10c4a8>=_0x1d0d94){_0x10c4a8=_0x1d0d94;_0x122bf1=0xc8;}else{_0x122bf1=0xce;}_0x4a0296['status'](_0x122bf1);return _0x4a0296['set'](_0xed48('0x1e'),_0x355224+'-'+_0x10c4a8+'/'+_0x1d0d94)[_0xed48('0x1a')](_0x4d23d9);}return null;};}function patchUpdates(_0x225d0f){return function(_0x54288f){try{jsonpatch[_0xed48('0x1f')](_0x54288f,_0x225d0f,!![]);}catch(_0x35f451){return BPromise[_0xed48('0x20')](_0x35f451);}return _0x54288f['save']();};}function saveUpdates(_0x277efb,_0x1bda45){return function(_0x13cb25){if(_0x13cb25){return _0x13cb25[_0xed48('0x21')](_0x277efb)[_0xed48('0x22')](function(_0x17a39b){return _0x17a39b;});}return null;};}function removeEntity(_0x4a6d93,_0x2683e4){return function(_0x4b829b){if(_0x4b829b){return _0x4b829b[_0xed48('0x23')]()[_0xed48('0x22')](function(){_0x4a6d93[_0xed48('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b460f,_0x51f67f){return function(_0x350c3c){if(!_0x350c3c){_0x4b460f[_0xed48('0x17')](0x194);}return _0x350c3c;};}function handleError(_0x277ef8,_0x26bff5){_0x26bff5=_0x26bff5||0x1f4;return function(_0x28dbf6){logger[_0xed48('0x24')](_0x28dbf6['stack']);if(_0x28dbf6[_0xed48('0x25')]){delete _0x28dbf6[_0xed48('0x25')];}_0x277ef8[_0xed48('0x18')](_0x26bff5)['send'](_0x28dbf6);};}exports[_0xed48('0x26')]=function(_0x2352a4,_0x5c66e4){var _0x2baff3={},_0x5ed24d={},_0x52a315={'count':0x0,'rows':[]};var _0x391e46=_['map'](db['ChatQueueReport'][_0xed48('0x27')],function(_0x982fdd){return{'name':_0x982fdd[_0xed48('0x28')],'type':_0x982fdd['type'][_0xed48('0x29')]};});_0x5ed24d[_0xed48('0x2a')]=_[_0xed48('0x2b')](_0x391e46,_0xed48('0x25'));_0x5ed24d['query']=_['keys'](_0x2352a4[_0xed48('0x2c')]);_0x5ed24d['filters']=_[_0xed48('0x2d')](_0x5ed24d[_0xed48('0x2a')],_0x5ed24d[_0xed48('0x2c')]);_0x2baff3[_0xed48('0x2e')]=_['intersection'](_0x5ed24d['model'],qs[_0xed48('0x2f')](_0x2352a4[_0xed48('0x2c')][_0xed48('0x2f')]));_0x2baff3[_0xed48('0x2e')]=_0x2baff3[_0xed48('0x2e')][_0xed48('0x30')]?_0x2baff3[_0xed48('0x2e')]:_0x5ed24d[_0xed48('0x2a')];if(!_0x2352a4[_0xed48('0x2c')][_0xed48('0x31')](_0xed48('0x32'))){_0x2baff3[_0xed48('0x1d')]=qs['limit'](_0x2352a4[_0xed48('0x2c')][_0xed48('0x1d')]);_0x2baff3[_0xed48('0x1b')]=qs[_0xed48('0x1b')](_0x2352a4[_0xed48('0x2c')][_0xed48('0x1b')]);}_0x2baff3[_0xed48('0x33')]=qs[_0xed48('0x34')](_0x2352a4[_0xed48('0x2c')][_0xed48('0x34')]);_0x2baff3['where']=qs[_0xed48('0x35')](_[_0xed48('0x36')](_0x2352a4[_0xed48('0x2c')],_0x5ed24d[_0xed48('0x35')]),_0x391e46);if(_0x2352a4['query'][_0xed48('0x37')]){_0x2baff3[_0xed48('0x38')]=_['merge'](_0x2baff3[_0xed48('0x38')],{'$or':_[_0xed48('0x2b')](_0x391e46,function(_0x104f65){if(_0x104f65['type']!=='VIRTUAL'){var _0x3281c2={};_0x3281c2[_0x104f65['name']]={'$like':'%'+_0x2352a4[_0xed48('0x2c')][_0xed48('0x37')]+'%'};return _0x3281c2;}})});}_0x2baff3=_[_0xed48('0x39')]({},_0x2baff3,_0x2352a4[_0xed48('0x3a')]);var _0x2a3bfc={'where':_0x2baff3[_0xed48('0x38')]};return db[_0xed48('0x3b')][_0xed48('0x3c')](_0x2a3bfc)[_0xed48('0x22')](function(_0x5b1b8c){_0x52a315[_0xed48('0x3c')]=_0x5b1b8c;if(_0x2352a4[_0xed48('0x2c')][_0xed48('0x3d')]){_0x2baff3[_0xed48('0x3e')]=[{'all':!![]}];}return db[_0xed48('0x3b')]['findAll'](_0x2baff3);})[_0xed48('0x22')](function(_0x1af81d){_0x52a315[_0xed48('0x3f')]=_0x1af81d;return _0x52a315;})[_0xed48('0x22')](respondWithFilteredResult(_0x5c66e4,_0x2baff3))[_0xed48('0x40')](handleError(_0x5c66e4,null));};exports[_0xed48('0x41')]=function(_0x13d84b,_0x1af430){var _0x1d4d1d={'raw':!![],'where':{'id':_0x13d84b[_0xed48('0x42')]['id']}},_0x28014f={};_0x28014f[_0xed48('0x2a')]=_[_0xed48('0x43')](db[_0xed48('0x3b')][_0xed48('0x27')]);_0x28014f[_0xed48('0x2c')]=_[_0xed48('0x43')](_0x13d84b[_0xed48('0x2c')]);_0x28014f['filters']=_[_0xed48('0x2d')](_0x28014f[_0xed48('0x2a')],_0x28014f[_0xed48('0x2c')]);_0x1d4d1d[_0xed48('0x2e')]=_[_0xed48('0x2d')](_0x28014f[_0xed48('0x2a')],qs['fields'](_0x13d84b[_0xed48('0x2c')]['fields']));_0x1d4d1d[_0xed48('0x2e')]=_0x1d4d1d[_0xed48('0x2e')]['length']?_0x1d4d1d['attributes']:_0x28014f[_0xed48('0x2a')];if(_0x13d84b['query'][_0xed48('0x3d')]){_0x1d4d1d['include']=[{'all':!![]}];}_0x1d4d1d=_['merge']({},_0x1d4d1d,_0x13d84b['options']);return db[_0xed48('0x3b')][_0xed48('0x44')](_0x1d4d1d)[_0xed48('0x22')](handleEntityNotFound(_0x1af430,null))[_0xed48('0x22')](respondWithResult(_0x1af430,null))[_0xed48('0x40')](handleError(_0x1af430,null));};exports[_0xed48('0x45')]=function(_0x5b02a0,_0x51d9d6){return db[_0xed48('0x3b')][_0xed48('0x45')](_0x5b02a0[_0xed48('0x46')],{})[_0xed48('0x22')](respondWithResult(_0x51d9d6,0xc9))[_0xed48('0x40')](handleError(_0x51d9d6,null));};exports[_0xed48('0x21')]=function(_0x505ef9,_0x25fee5){if(_0x505ef9['body']['id']){delete _0x505ef9['body']['id'];}return db['ChatQueueReport'][_0xed48('0x44')]({'where':{'id':_0x505ef9[_0xed48('0x42')]['id']}})[_0xed48('0x22')](handleEntityNotFound(_0x25fee5,null))[_0xed48('0x22')](saveUpdates(_0x505ef9[_0xed48('0x46')],null))[_0xed48('0x22')](respondWithResult(_0x25fee5,null))[_0xed48('0x40')](handleError(_0x25fee5,null));};exports[_0xed48('0x23')]=function(_0x16b21e,_0x3d62a2){return db[_0xed48('0x3b')][_0xed48('0x44')]({'where':{'id':_0x16b21e['params']['id']}})[_0xed48('0x22')](handleEntityNotFound(_0x3d62a2,null))[_0xed48('0x22')](removeEntity(_0x3d62a2,null))[_0xed48('0x40')](handleError(_0x3d62a2,null));};exports[_0xed48('0x47')]=function(_0x1f30ec,_0x143920){return db[_0xed48('0x3b')][_0xed48('0x47')]()[_0xed48('0x22')](respondWithResult(_0x143920,null))[_0xed48('0x40')](handleError(_0x143920,null));}; \ No newline at end of file +var _0xc838=['count','limit','set','Content-Range','save','update','then','error','send','ChatQueueReport','rawAttributes','fieldName','type','key','map','name','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','includeAll','rows','catch','show','options','create','body','find','destroy','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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/license/util','sendStatus','status','end','json','offset','undefined'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xc838,0xbd));var _0x8c83=function(_0xaed985,_0x154e32){_0xaed985=_0xaed985-0x0;var _0x3f31d9=_0xc838[_0xaed985];return _0x3f31d9;};'use strict';var emlformat=require(_0x8c83('0x0'));var rimraf=require(_0x8c83('0x1'));var zipdir=require(_0x8c83('0x2'));var jsonpatch=require(_0x8c83('0x3'));var rp=require(_0x8c83('0x4'));var moment=require(_0x8c83('0x5'));var BPromise=require(_0x8c83('0x6'));var Mustache=require(_0x8c83('0x7'));var util=require(_0x8c83('0x8'));var path=require(_0x8c83('0x9'));var sox=require(_0x8c83('0xa'));var csv=require(_0x8c83('0xb'));var ejs=require(_0x8c83('0xc'));var fs=require('fs');var fs_extra=require(_0x8c83('0xd'));var _=require(_0x8c83('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8c83('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8c83('0xb'));var querystring=require(_0x8c83('0x10'));var Papa=require(_0x8c83('0x11'));var Redis=require(_0x8c83('0x12'));var authService=require(_0x8c83('0x13'));var qs=require(_0x8c83('0x14'));var as=require(_0x8c83('0x15'));var hardwareService=require(_0x8c83('0x16'));var logger=require(_0x8c83('0x17'))(_0x8c83('0x18'));var utils=require(_0x8c83('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x8c83('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51d568,_0x4a2fc7){_0x4a2fc7=_0x4a2fc7||0xcc;return function(_0x57a0b5){if(_0x57a0b5){return _0x51d568[_0x8c83('0x1b')](_0x4a2fc7);}return _0x51d568[_0x8c83('0x1c')](_0x4a2fc7)[_0x8c83('0x1d')]();};}function respondWithResult(_0x45d86c,_0x401fc5){_0x401fc5=_0x401fc5||0xc8;return function(_0x1aaac5){if(_0x1aaac5){return _0x45d86c[_0x8c83('0x1c')](_0x401fc5)[_0x8c83('0x1e')](_0x1aaac5);}};}function respondWithFilteredResult(_0x1ac932,_0xf2dee0){return function(_0x573b7d){if(_0x573b7d){var _0x2b4027=typeof _0xf2dee0[_0x8c83('0x1f')]==='undefined'&&typeof _0xf2dee0['limit']===_0x8c83('0x20');var _0x4e3da8=_0x573b7d[_0x8c83('0x21')];var _0x535962=_0x2b4027?0x0:_0xf2dee0['offset'];var _0x3f4b38=_0x2b4027?_0x573b7d['count']:_0xf2dee0[_0x8c83('0x1f')]+_0xf2dee0[_0x8c83('0x22')];var _0x505c0c;if(_0x3f4b38>=_0x4e3da8){_0x3f4b38=_0x4e3da8;_0x505c0c=0xc8;}else{_0x505c0c=0xce;}_0x1ac932['status'](_0x505c0c);return _0x1ac932[_0x8c83('0x23')](_0x8c83('0x24'),_0x535962+'-'+_0x3f4b38+'/'+_0x4e3da8)['json'](_0x573b7d);}return null;};}function patchUpdates(_0x41e629){return function(_0x18f718){try{jsonpatch['apply'](_0x18f718,_0x41e629,!![]);}catch(_0x34825d){return BPromise['reject'](_0x34825d);}return _0x18f718[_0x8c83('0x25')]();};}function saveUpdates(_0x39b02f,_0x17937e){return function(_0xf7b089){if(_0xf7b089){return _0xf7b089[_0x8c83('0x26')](_0x39b02f)['then'](function(_0x4faecd){return _0x4faecd;});}return null;};}function removeEntity(_0x29fced,_0x3a21e9){return function(_0x59e6f9){if(_0x59e6f9){return _0x59e6f9['destroy']()[_0x8c83('0x27')](function(){_0x29fced[_0x8c83('0x1c')](0xcc)[_0x8c83('0x1d')]();});}};}function handleEntityNotFound(_0x5034e1,_0x1bd922){return function(_0x4f7088){if(!_0x4f7088){_0x5034e1[_0x8c83('0x1b')](0x194);}return _0x4f7088;};}function handleError(_0xc5d97d,_0x29b5d8){_0x29b5d8=_0x29b5d8||0x1f4;return function(_0x1180e1){logger[_0x8c83('0x28')](_0x1180e1['stack']);if(_0x1180e1['name']){delete _0x1180e1['name'];}_0xc5d97d[_0x8c83('0x1c')](_0x29b5d8)[_0x8c83('0x29')](_0x1180e1);};}exports['index']=function(_0x106f71,_0x12419a){var _0x142201={},_0x596ff0={},_0x48a74b={'count':0x0,'rows':[]};var _0x1b054a=_['map'](db[_0x8c83('0x2a')][_0x8c83('0x2b')],function(_0x290af8){return{'name':_0x290af8[_0x8c83('0x2c')],'type':_0x290af8[_0x8c83('0x2d')][_0x8c83('0x2e')]};});_0x596ff0['model']=_[_0x8c83('0x2f')](_0x1b054a,_0x8c83('0x30'));_0x596ff0[_0x8c83('0x31')]=_[_0x8c83('0x32')](_0x106f71[_0x8c83('0x31')]);_0x596ff0[_0x8c83('0x33')]=_[_0x8c83('0x34')](_0x596ff0[_0x8c83('0x35')],_0x596ff0[_0x8c83('0x31')]);_0x142201[_0x8c83('0x36')]=_['intersection'](_0x596ff0[_0x8c83('0x35')],qs[_0x8c83('0x37')](_0x106f71[_0x8c83('0x31')]['fields']));_0x142201[_0x8c83('0x36')]=_0x142201[_0x8c83('0x36')]['length']?_0x142201[_0x8c83('0x36')]:_0x596ff0[_0x8c83('0x35')];if(!_0x106f71[_0x8c83('0x31')][_0x8c83('0x38')](_0x8c83('0x39'))){_0x142201[_0x8c83('0x22')]=qs[_0x8c83('0x22')](_0x106f71[_0x8c83('0x31')][_0x8c83('0x22')]);_0x142201[_0x8c83('0x1f')]=qs[_0x8c83('0x1f')](_0x106f71[_0x8c83('0x31')]['offset']);}_0x142201['order']=qs[_0x8c83('0x3a')](_0x106f71[_0x8c83('0x31')][_0x8c83('0x3a')]);_0x142201[_0x8c83('0x3b')]=qs[_0x8c83('0x33')](_['pick'](_0x106f71['query'],_0x596ff0[_0x8c83('0x33')]),_0x1b054a);if(_0x106f71[_0x8c83('0x31')][_0x8c83('0x3c')]){_0x142201['where']=_['merge'](_0x142201['where'],{'$or':_['map'](_0x1b054a,function(_0x259bca){if(_0x259bca[_0x8c83('0x2d')]!==_0x8c83('0x3d')){var _0xbc83f8={};_0xbc83f8[_0x259bca[_0x8c83('0x30')]]={'$like':'%'+_0x106f71[_0x8c83('0x31')][_0x8c83('0x3c')]+'%'};return _0xbc83f8;}})});}_0x142201=_[_0x8c83('0x3e')]({},_0x142201,_0x106f71['options']);var _0x5bfea5={'where':_0x142201[_0x8c83('0x3b')]};return db[_0x8c83('0x2a')][_0x8c83('0x21')](_0x5bfea5)['then'](function(_0x2bab6d){_0x48a74b['count']=_0x2bab6d;if(_0x106f71[_0x8c83('0x31')][_0x8c83('0x3f')]){_0x142201['include']=[{'all':!![]}];}return db[_0x8c83('0x2a')]['findAll'](_0x142201);})['then'](function(_0x5dfc16){_0x48a74b[_0x8c83('0x40')]=_0x5dfc16;return _0x48a74b;})[_0x8c83('0x27')](respondWithFilteredResult(_0x12419a,_0x142201))[_0x8c83('0x41')](handleError(_0x12419a,null));};exports[_0x8c83('0x42')]=function(_0x3e4eb9,_0x3883de){var _0x3a6c98={'raw':!![],'where':{'id':_0x3e4eb9['params']['id']}},_0x4b540d={};_0x4b540d[_0x8c83('0x35')]=_[_0x8c83('0x32')](db[_0x8c83('0x2a')][_0x8c83('0x2b')]);_0x4b540d[_0x8c83('0x31')]=_[_0x8c83('0x32')](_0x3e4eb9[_0x8c83('0x31')]);_0x4b540d['filters']=_['intersection'](_0x4b540d[_0x8c83('0x35')],_0x4b540d[_0x8c83('0x31')]);_0x3a6c98[_0x8c83('0x36')]=_[_0x8c83('0x34')](_0x4b540d[_0x8c83('0x35')],qs[_0x8c83('0x37')](_0x3e4eb9[_0x8c83('0x31')][_0x8c83('0x37')]));_0x3a6c98[_0x8c83('0x36')]=_0x3a6c98[_0x8c83('0x36')]['length']?_0x3a6c98['attributes']:_0x4b540d[_0x8c83('0x35')];if(_0x3e4eb9[_0x8c83('0x31')][_0x8c83('0x3f')]){_0x3a6c98['include']=[{'all':!![]}];}_0x3a6c98=_[_0x8c83('0x3e')]({},_0x3a6c98,_0x3e4eb9[_0x8c83('0x43')]);return db[_0x8c83('0x2a')]['find'](_0x3a6c98)['then'](handleEntityNotFound(_0x3883de,null))['then'](respondWithResult(_0x3883de,null))[_0x8c83('0x41')](handleError(_0x3883de,null));};exports['create']=function(_0x5d3734,_0x35ee54){return db['ChatQueueReport'][_0x8c83('0x44')](_0x5d3734[_0x8c83('0x45')],{})[_0x8c83('0x27')](respondWithResult(_0x35ee54,0xc9))[_0x8c83('0x41')](handleError(_0x35ee54,null));};exports['update']=function(_0x5d8f9f,_0x2c8853){if(_0x5d8f9f[_0x8c83('0x45')]['id']){delete _0x5d8f9f[_0x8c83('0x45')]['id'];}return db['ChatQueueReport'][_0x8c83('0x46')]({'where':{'id':_0x5d8f9f['params']['id']}})[_0x8c83('0x27')](handleEntityNotFound(_0x2c8853,null))[_0x8c83('0x27')](saveUpdates(_0x5d8f9f[_0x8c83('0x45')],null))[_0x8c83('0x27')](respondWithResult(_0x2c8853,null))['catch'](handleError(_0x2c8853,null));};exports[_0x8c83('0x47')]=function(_0x5830b5,_0x595397){return db[_0x8c83('0x2a')][_0x8c83('0x46')]({'where':{'id':_0x5830b5[_0x8c83('0x48')]['id']}})[_0x8c83('0x27')](handleEntityNotFound(_0x595397,null))['then'](removeEntity(_0x595397,null))[_0x8c83('0x41')](handleError(_0x595397,null));};exports[_0x8c83('0x49')]=function(_0x2c1039,_0xd4badb){return db[_0x8c83('0x2a')][_0x8c83('0x49')]()[_0x8c83('0x27')](respondWithResult(_0xd4badb,null))[_0x8c83('0x41')](handleError(_0xd4badb,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 8569d16..cab9cf4 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x18fdee,_0x1660cb){var _0x7c3726=function(_0x16ec2b){while(--_0x16ec2b){_0x18fdee['push'](_0x18fdee['shift']());}};_0x7c3726(++_0x1660cb);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x33eb12,_0x17a69a){var _0x51a799=function(_0x5edbf1){while(--_0x5edbf1){_0x33eb12['push'](_0x33eb12['shift']());}};_0x51a799(++_0x17a69a);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 3354f9a..0618cc8 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 _0xb545=['stringify','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','UpdateChatQueueReport','update','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x9e4d50,_0x35ed2f){var _0x158548=function(_0x24389b){while(--_0x24389b){_0x9e4d50['push'](_0x9e4d50['shift']());}};_0x158548(++_0x35ed2f);}(_0xb545,0x74));var _0x5b54=function(_0x34f690,_0x4e4e7e){_0x34f690=_0x34f690-0x0;var _0x55700b=_0xb545[_0x34f690];return _0x55700b;};'use strict';var _=require(_0x5b54('0x0'));var util=require(_0x5b54('0x1'));var moment=require('moment');var BPromise=require(_0x5b54('0x2'));var rs=require(_0x5b54('0x3'));var fs=require('fs');var Redis=require(_0x5b54('0x4'));var db=require(_0x5b54('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5b54('0x6'));var config=require(_0x5b54('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5b54('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45472a,_0x3ff15f,_0xce41d6){return new BPromise(function(_0x18debd,_0x82a1f8){return client[_0x5b54('0x9')](_0x45472a,_0xce41d6)[_0x5b54('0xa')](function(_0x3f3cda){logger[_0x5b54('0xb')](_0x5b54('0xc'),_0x3ff15f,'request\x20sent');logger[_0x5b54('0xd')](_0x5b54('0xe'),_0x3ff15f,_0x5b54('0xf'),JSON[_0x5b54('0x10')](_0x3f3cda));if(_0x3f3cda[_0x5b54('0x11')]){if(_0x3f3cda['error'][_0x5b54('0x12')]===0x1f4){logger[_0x5b54('0x11')](_0x5b54('0xc'),_0x3ff15f,_0x3f3cda[_0x5b54('0x11')][_0x5b54('0x13')]);return _0x82a1f8(_0x3f3cda[_0x5b54('0x11')][_0x5b54('0x13')]);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x3ff15f,_0x3f3cda[_0x5b54('0x11')]['message']);return _0x18debd(_0x3f3cda[_0x5b54('0x11')][_0x5b54('0x13')]);}else{logger[_0x5b54('0xb')](_0x5b54('0xc'),_0x3ff15f,_0x5b54('0xf'));_0x18debd(_0x3f3cda[_0x5b54('0x14')][_0x5b54('0x13')]);}})[_0x5b54('0x15')](function(_0x3a7080){logger[_0x5b54('0x11')](_0x5b54('0xc'),_0x3ff15f,_0x3a7080);_0x82a1f8(_0x3a7080);});});}exports[_0x5b54('0x16')]=function(_0x41439f){var _0x593cb1=this;return new Promise(function(_0x37c4de,_0x37e937){return db[_0x5b54('0x17')][_0x5b54('0x18')](_0x41439f[_0x5b54('0x19')],{'raw':_0x41439f['options']?_0x41439f[_0x5b54('0x1a')][_0x5b54('0x1b')]===undefined?!![]:![]:!![]})[_0x5b54('0xa')](function(_0x26d1c3){logger[_0x5b54('0xb')](_0x5b54('0x16'),_0x41439f);logger[_0x5b54('0xd')]('CreateChatQueueReport',_0x41439f,JSON[_0x5b54('0x10')](_0x26d1c3));_0x37c4de(_0x26d1c3);})['catch'](function(_0x21c1a5){logger[_0x5b54('0x11')]('CreateChatQueueReport',_0x21c1a5[_0x5b54('0x13')],_0x41439f);_0x37e937(_0x593cb1[_0x5b54('0x11')](0x1f4,_0x21c1a5[_0x5b54('0x13')]));});});};exports[_0x5b54('0x1c')]=function(_0x56035c){var _0x900e54=this;return new Promise(function(_0x333588,_0x369005){return db['ChatQueueReport'][_0x5b54('0x1d')](_0x56035c['body'],{'raw':_0x56035c['options']?_0x56035c['options'][_0x5b54('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56035c[_0x5b54('0x1a')]?_0x56035c[_0x5b54('0x1a')][_0x5b54('0x1e')]||null:null,'attributes':_0x56035c['options']?_0x56035c[_0x5b54('0x1a')][_0x5b54('0x1f')]||null:null,'limit':_0x56035c[_0x5b54('0x1a')]?_0x56035c['options'][_0x5b54('0x20')]||null:null})[_0x5b54('0xa')](function(_0x343ab1){logger[_0x5b54('0xb')]('UpdateChatQueueReport',_0x56035c);logger['debug'](_0x5b54('0x1c'),_0x56035c,JSON[_0x5b54('0x10')](_0x343ab1));_0x333588(_0x343ab1);})[_0x5b54('0x15')](function(_0xb8e7a1){logger['error'](_0x5b54('0x1c'),_0xb8e7a1[_0x5b54('0x13')],_0x56035c);_0x369005(_0x900e54[_0x5b54('0x11')](0x1f4,_0xb8e7a1['message']));});});}; \ No newline at end of file +var _0x09da=['attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','debug','UpdateChatQueueReport','where'];(function(_0x4f9589,_0x508341){var _0x461484=function(_0x292e1b){while(--_0x292e1b){_0x4f9589['push'](_0x4f9589['shift']());}};_0x461484(++_0x508341);}(_0x09da,0x65));var _0xa09d=function(_0x4d692f,_0xd710ba){_0x4d692f=_0x4d692f-0x0;var _0x5159a9=_0x09da[_0x4d692f];return _0x5159a9;};'use strict';var _=require(_0xa09d('0x0'));var util=require('util');var moment=require(_0xa09d('0x1'));var BPromise=require(_0xa09d('0x2'));var rs=require(_0xa09d('0x3'));var fs=require('fs');var Redis=require(_0xa09d('0x4'));var db=require(_0xa09d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa09d('0x6'))(_0xa09d('0x7'));var config=require('../../config/environment');var jayson=require(_0xa09d('0x8'));var client=jayson[_0xa09d('0x9')][_0xa09d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f3a1b,_0x4e8e77,_0x5a466d){return new BPromise(function(_0x3bb547,_0x13055b){return client[_0xa09d('0xb')](_0x2f3a1b,_0x5a466d)[_0xa09d('0xc')](function(_0x3419e3){logger['info'](_0xa09d('0xd'),_0x4e8e77,_0xa09d('0xe'));logger['debug'](_0xa09d('0xf'),_0x4e8e77,_0xa09d('0xe'),JSON[_0xa09d('0x10')](_0x3419e3));if(_0x3419e3[_0xa09d('0x11')]){if(_0x3419e3[_0xa09d('0x11')]['code']===0x1f4){logger[_0xa09d('0x11')](_0xa09d('0xd'),_0x4e8e77,_0x3419e3[_0xa09d('0x11')]['message']);return _0x13055b(_0x3419e3[_0xa09d('0x11')]['message']);}logger[_0xa09d('0x11')](_0xa09d('0xd'),_0x4e8e77,_0x3419e3[_0xa09d('0x11')][_0xa09d('0x12')]);return _0x3bb547(_0x3419e3[_0xa09d('0x11')][_0xa09d('0x12')]);}else{logger[_0xa09d('0x13')](_0xa09d('0xd'),_0x4e8e77,_0xa09d('0xe'));_0x3bb547(_0x3419e3[_0xa09d('0x14')][_0xa09d('0x12')]);}})[_0xa09d('0x15')](function(_0x3e16dd){logger[_0xa09d('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x4e8e77,_0x3e16dd);_0x13055b(_0x3e16dd);});});}exports[_0xa09d('0x16')]=function(_0x13bdb4){var _0x90505c=this;return new Promise(function(_0x591bcf,_0x5c331e){return db[_0xa09d('0x17')][_0xa09d('0x18')](_0x13bdb4[_0xa09d('0x19')],{'raw':_0x13bdb4[_0xa09d('0x1a')]?_0x13bdb4['options'][_0xa09d('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x55668b){logger['info'](_0xa09d('0x16'),_0x13bdb4);logger[_0xa09d('0x1c')](_0xa09d('0x16'),_0x13bdb4,JSON[_0xa09d('0x10')](_0x55668b));_0x591bcf(_0x55668b);})[_0xa09d('0x15')](function(_0x43d01d){logger[_0xa09d('0x11')](_0xa09d('0x16'),_0x43d01d[_0xa09d('0x12')],_0x13bdb4);_0x5c331e(_0x90505c['error'](0x1f4,_0x43d01d[_0xa09d('0x12')]));});});};exports[_0xa09d('0x1d')]=function(_0x11e003){var _0xc05280=this;return new Promise(function(_0x14486f,_0x117482){return db['ChatQueueReport']['update'](_0x11e003['body'],{'raw':_0x11e003[_0xa09d('0x1a')]?_0x11e003[_0xa09d('0x1a')][_0xa09d('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11e003[_0xa09d('0x1a')]?_0x11e003[_0xa09d('0x1a')][_0xa09d('0x1e')]||null:null,'attributes':_0x11e003[_0xa09d('0x1a')]?_0x11e003['options'][_0xa09d('0x1f')]||null:null,'limit':_0x11e003[_0xa09d('0x1a')]?_0x11e003[_0xa09d('0x1a')][_0xa09d('0x20')]||null:null})['then'](function(_0x572f84){logger[_0xa09d('0x13')](_0xa09d('0x1d'),_0x11e003);logger[_0xa09d('0x1c')]('UpdateChatQueueReport',_0x11e003,JSON[_0xa09d('0x10')](_0x572f84));_0x14486f(_0x572f84);})[_0xa09d('0x15')](function(_0x4adcd6){logger[_0xa09d('0x11')](_0xa09d('0x1d'),_0x4adcd6[_0xa09d('0x12')],_0x11e003);_0x117482(_0xc05280[_0xa09d('0x11')](0x1f4,_0x4adcd6[_0xa09d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 5279bb6..28d0f58 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 _0xa586=['show','post','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueueReport.controller','index','/describe','isAuthenticated','describe','get'];(function(_0x5de751,_0x1951b7){var _0x2debd1=function(_0x38922e){while(--_0x38922e){_0x5de751['push'](_0x5de751['shift']());}};_0x2debd1(++_0x1951b7);}(_0xa586,0x151));var _0x6a58=function(_0xbf5e16,_0x146ce3){_0xbf5e16=_0xbf5e16-0x0;var _0x5975a5=_0xa586[_0xbf5e16];return _0x5975a5;};'use strict';var multer=require(_0x6a58('0x0'));var util=require(_0x6a58('0x1'));var path=require(_0x6a58('0x2'));var timeout=require(_0x6a58('0x3'));var express=require(_0x6a58('0x4'));var router=express[_0x6a58('0x5')]();var fs_extra=require(_0x6a58('0x6'));var auth=require(_0x6a58('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6a58('0x8'));var controller=require(_0x6a58('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x6a58('0xa')]);router['get'](_0x6a58('0xb'),auth[_0x6a58('0xc')](),controller[_0x6a58('0xd')]);router[_0x6a58('0xe')]('/:id',auth[_0x6a58('0xc')](),controller[_0x6a58('0xf')]);router[_0x6a58('0x10')]('/',auth[_0x6a58('0xc')](),controller['create']);router['put'](_0x6a58('0x11'),auth['isAuthenticated'](),controller[_0x6a58('0x12')]);router[_0x6a58('0x13')](_0x6a58('0x11'),auth[_0x6a58('0xc')](),controller[_0x6a58('0x14')]);module[_0x6a58('0x15')]=router; \ No newline at end of file +var _0xbca3=['index','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./chatQueueReport.controller','get'];(function(_0x996bc8,_0x291e01){var _0x20b0ea=function(_0x5ba992){while(--_0x5ba992){_0x996bc8['push'](_0x996bc8['shift']());}};_0x20b0ea(++_0x291e01);}(_0xbca3,0x6f));var _0x3bca=function(_0x358fa2,_0x58764a){_0x358fa2=_0x358fa2-0x0;var _0xd18947=_0xbca3[_0x358fa2];return _0xd18947;};'use strict';var multer=require(_0x3bca('0x0'));var util=require(_0x3bca('0x1'));var path=require('path');var timeout=require(_0x3bca('0x2'));var express=require(_0x3bca('0x3'));var router=express[_0x3bca('0x4')]();var fs_extra=require(_0x3bca('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3bca('0x6'));var controller=require(_0x3bca('0x7'));router[_0x3bca('0x8')]('/',auth['isAuthenticated'](),controller[_0x3bca('0x9')]);router[_0x3bca('0x8')](_0x3bca('0xa'),auth[_0x3bca('0xb')](),controller[_0x3bca('0xc')]);router[_0x3bca('0x8')](_0x3bca('0xd'),auth[_0x3bca('0xb')](),controller[_0x3bca('0xe')]);router[_0x3bca('0xf')]('/',auth[_0x3bca('0xb')](),controller[_0x3bca('0x10')]);router[_0x3bca('0x11')](_0x3bca('0xd'),auth[_0x3bca('0xb')](),controller['update']);router[_0x3bca('0x12')](_0x3bca('0xd'),auth[_0x3bca('0xb')](),controller['destroy']);module[_0x3bca('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index c7da2df..8c06801 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0xb3737e,_0x31f04b){var _0x2d9223=function(_0x4afec8){while(--_0x4afec8){_0xb3737e['push'](_0xb3737e['shift']());}};_0x2d9223(++_0x31f04b);}(_0x00bb,0x1d8));var _0xb00b=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x00bb[_0xa1e3e3];return _0xc980e9;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x008c,0x188));var _0xc008=function(_0x24b477,_0x30393b){_0x24b477=_0x24b477-0x0;var _0x4041a6=_0x008c[_0x24b477];return _0x4041a6;};'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/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 59489d0..0abb223 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 _0x05e1=['ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','then','sendStatus','error','stack','name','index','map','ChatTransferReport','rawAttributes','type','key','model','query','keys','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','fields','options','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox'];(function(_0x438ce2,_0x33ba8f){var _0x8cc47a=function(_0x7482a3){while(--_0x7482a3){_0x438ce2['push'](_0x438ce2['shift']());}};_0x8cc47a(++_0x33ba8f);}(_0x05e1,0x1d3));var _0x105e=function(_0x56c91a,_0x21a76f){_0x56c91a=_0x56c91a-0x0;var _0x536659=_0x05e1[_0x56c91a];return _0x536659;};'use strict';var emlformat=require(_0x105e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x105e('0x1'));var jsonpatch=require(_0x105e('0x2'));var rp=require(_0x105e('0x3'));var moment=require('moment');var BPromise=require(_0x105e('0x4'));var Mustache=require(_0x105e('0x5'));var util=require(_0x105e('0x6'));var path=require(_0x105e('0x7'));var sox=require(_0x105e('0x8'));var csv=require('to-csv');var ejs=require(_0x105e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x105e('0xa'));var squel=require('squel');var crypto=require(_0x105e('0xb'));var jsforce=require(_0x105e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x105e('0xd'));var querystring=require(_0x105e('0xe'));var Papa=require(_0x105e('0xf'));var Redis=require(_0x105e('0x10'));var authService=require(_0x105e('0x11'));var qs=require(_0x105e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x105e('0x13'));var logger=require('../../config/logger')(_0x105e('0x14'));var utils=require('../../config/utils');var config=require(_0x105e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x105e('0x16'))['db'];function respondWithStatusCode(_0x597aa1,_0x3d9736){_0x3d9736=_0x3d9736||0xcc;return function(_0x53c391){if(_0x53c391){return _0x597aa1['sendStatus'](_0x3d9736);}return _0x597aa1[_0x105e('0x17')](_0x3d9736)[_0x105e('0x18')]();};}function respondWithResult(_0x47b80c,_0x4e8226){_0x4e8226=_0x4e8226||0xc8;return function(_0x3b4dfc){if(_0x3b4dfc){return _0x47b80c[_0x105e('0x17')](_0x4e8226)[_0x105e('0x19')](_0x3b4dfc);}};}function respondWithFilteredResult(_0x3d3889,_0x283121){return function(_0x2ce37c){if(_0x2ce37c){var _0x4db9e7=typeof _0x283121[_0x105e('0x1a')]===_0x105e('0x1b')&&typeof _0x283121['limit']==='undefined';var _0x1c0dce=_0x2ce37c[_0x105e('0x1c')];var _0xf49c3f=_0x4db9e7?0x0:_0x283121[_0x105e('0x1a')];var _0x5bce69=_0x4db9e7?_0x2ce37c[_0x105e('0x1c')]:_0x283121['offset']+_0x283121[_0x105e('0x1d')];var _0x2cdb5f;if(_0x5bce69>=_0x1c0dce){_0x5bce69=_0x1c0dce;_0x2cdb5f=0xc8;}else{_0x2cdb5f=0xce;}_0x3d3889[_0x105e('0x17')](_0x2cdb5f);return _0x3d3889[_0x105e('0x1e')](_0x105e('0x1f'),_0xf49c3f+'-'+_0x5bce69+'/'+_0x1c0dce)[_0x105e('0x19')](_0x2ce37c);}return null;};}function patchUpdates(_0x2b8c5b){return function(_0x47baa2){try{jsonpatch['apply'](_0x47baa2,_0x2b8c5b,!![]);}catch(_0x53cbd0){return BPromise['reject'](_0x53cbd0);}return _0x47baa2['save']();};}function saveUpdates(_0x533f04,_0x3b54a3){return function(_0x2e00de){if(_0x2e00de){return _0x2e00de['update'](_0x533f04)[_0x105e('0x20')](function(_0x3cd14a){return _0x3cd14a;});}return null;};}function removeEntity(_0x40855a,_0x1b8a92){return function(_0x38f24e){if(_0x38f24e){return _0x38f24e['destroy']()[_0x105e('0x20')](function(){_0x40855a[_0x105e('0x17')](0xcc)[_0x105e('0x18')]();});}};}function handleEntityNotFound(_0x217191,_0x1aa3df){return function(_0x31eebb){if(!_0x31eebb){_0x217191[_0x105e('0x21')](0x194);}return _0x31eebb;};}function handleError(_0x4f014b,_0x468acc){_0x468acc=_0x468acc||0x1f4;return function(_0x12ee60){logger[_0x105e('0x22')](_0x12ee60[_0x105e('0x23')]);if(_0x12ee60[_0x105e('0x24')]){delete _0x12ee60['name'];}_0x4f014b[_0x105e('0x17')](_0x468acc)['send'](_0x12ee60);};}exports[_0x105e('0x25')]=function(_0x18adf5,_0x5e8098){var _0x22c189={},_0x532488={},_0xc1d166={'count':0x0,'rows':[]};var _0x4199e7=_[_0x105e('0x26')](db[_0x105e('0x27')][_0x105e('0x28')],function(_0x1287a1){return{'name':_0x1287a1['fieldName'],'type':_0x1287a1[_0x105e('0x29')][_0x105e('0x2a')]};});_0x532488[_0x105e('0x2b')]=_[_0x105e('0x26')](_0x4199e7,_0x105e('0x24'));_0x532488[_0x105e('0x2c')]=_[_0x105e('0x2d')](_0x18adf5[_0x105e('0x2c')]);_0x532488['filters']=_['intersection'](_0x532488[_0x105e('0x2b')],_0x532488[_0x105e('0x2c')]);_0x22c189[_0x105e('0x2e')]=_[_0x105e('0x2f')](_0x532488[_0x105e('0x2b')],qs['fields'](_0x18adf5[_0x105e('0x2c')]['fields']));_0x22c189[_0x105e('0x2e')]=_0x22c189['attributes'][_0x105e('0x30')]?_0x22c189[_0x105e('0x2e')]:_0x532488[_0x105e('0x2b')];if(!_0x18adf5[_0x105e('0x2c')][_0x105e('0x31')](_0x105e('0x32'))){_0x22c189['limit']=qs[_0x105e('0x1d')](_0x18adf5['query']['limit']);_0x22c189[_0x105e('0x1a')]=qs[_0x105e('0x1a')](_0x18adf5[_0x105e('0x2c')][_0x105e('0x1a')]);}_0x22c189['order']=qs[_0x105e('0x33')](_0x18adf5[_0x105e('0x2c')][_0x105e('0x33')]);_0x22c189[_0x105e('0x34')]=qs[_0x105e('0x35')](_['pick'](_0x18adf5[_0x105e('0x2c')],_0x532488[_0x105e('0x35')]),_0x4199e7);if(_0x18adf5[_0x105e('0x2c')][_0x105e('0x36')]){_0x22c189['where']=_[_0x105e('0x37')](_0x22c189[_0x105e('0x34')],{'$or':_['map'](_0x4199e7,function(_0x1d517a){if(_0x1d517a[_0x105e('0x29')]!==_0x105e('0x38')){var _0x285a43={};_0x285a43[_0x1d517a[_0x105e('0x24')]]={'$like':'%'+_0x18adf5['query'][_0x105e('0x36')]+'%'};return _0x285a43;}})});}_0x22c189=_[_0x105e('0x37')]({},_0x22c189,_0x18adf5['options']);var _0x5648a7={'where':_0x22c189[_0x105e('0x34')]};return db['ChatTransferReport'][_0x105e('0x1c')](_0x5648a7)[_0x105e('0x20')](function(_0x9d0586){_0xc1d166[_0x105e('0x1c')]=_0x9d0586;if(_0x18adf5['query'][_0x105e('0x39')]){_0x22c189[_0x105e('0x3a')]=[{'all':!![]}];}return db[_0x105e('0x27')][_0x105e('0x3b')](_0x22c189);})['then'](function(_0x1dc5cb){_0xc1d166[_0x105e('0x3c')]=_0x1dc5cb;return _0xc1d166;})[_0x105e('0x20')](respondWithFilteredResult(_0x5e8098,_0x22c189))[_0x105e('0x3d')](handleError(_0x5e8098,null));};exports['show']=function(_0x3176c6,_0x2a1324){var _0x15eb20={'raw':!![],'where':{'id':_0x3176c6['params']['id']}},_0x31aa54={};_0x31aa54[_0x105e('0x2b')]=_[_0x105e('0x2d')](db[_0x105e('0x27')][_0x105e('0x28')]);_0x31aa54[_0x105e('0x2c')]=_[_0x105e('0x2d')](_0x3176c6[_0x105e('0x2c')]);_0x31aa54['filters']=_[_0x105e('0x2f')](_0x31aa54[_0x105e('0x2b')],_0x31aa54[_0x105e('0x2c')]);_0x15eb20['attributes']=_[_0x105e('0x2f')](_0x31aa54[_0x105e('0x2b')],qs[_0x105e('0x3e')](_0x3176c6[_0x105e('0x2c')][_0x105e('0x3e')]));_0x15eb20[_0x105e('0x2e')]=_0x15eb20[_0x105e('0x2e')]['length']?_0x15eb20[_0x105e('0x2e')]:_0x31aa54[_0x105e('0x2b')];if(_0x3176c6[_0x105e('0x2c')][_0x105e('0x39')]){_0x15eb20[_0x105e('0x3a')]=[{'all':!![]}];}_0x15eb20=_['merge']({},_0x15eb20,_0x3176c6[_0x105e('0x3f')]);return db[_0x105e('0x27')]['find'](_0x15eb20)[_0x105e('0x20')](handleEntityNotFound(_0x2a1324,null))['then'](respondWithResult(_0x2a1324,null))[_0x105e('0x3d')](handleError(_0x2a1324,null));};exports[_0x105e('0x40')]=function(_0x33ee53,_0x50fd47){return db[_0x105e('0x27')][_0x105e('0x40')](_0x33ee53['body'],{})[_0x105e('0x20')](respondWithResult(_0x50fd47,0xc9))[_0x105e('0x3d')](handleError(_0x50fd47,null));};exports['update']=function(_0x499aa7,_0x3ad513){if(_0x499aa7[_0x105e('0x41')]['id']){delete _0x499aa7[_0x105e('0x41')]['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x499aa7[_0x105e('0x42')]['id']}})[_0x105e('0x20')](handleEntityNotFound(_0x3ad513,null))[_0x105e('0x20')](saveUpdates(_0x499aa7[_0x105e('0x41')],null))[_0x105e('0x20')](respondWithResult(_0x3ad513,null))[_0x105e('0x3d')](handleError(_0x3ad513,null));};exports['destroy']=function(_0x47838e,_0x40e70a){return db[_0x105e('0x27')]['find']({'where':{'id':_0x47838e[_0x105e('0x42')]['id']}})['then'](handleEntityNotFound(_0x40e70a,null))[_0x105e('0x20')](removeEntity(_0x40e70a,null))[_0x105e('0x3d')](handleError(_0x40e70a,null));};exports[_0x105e('0x43')]=function(_0x478c66,_0x33b9e4){return db['ChatTransferReport'][_0x105e('0x43')]()[_0x105e('0x20')](respondWithResult(_0x33b9e4,null))[_0x105e('0x3d')](handleError(_0x33b9e4,null));}; \ No newline at end of file +var _0x036c=['squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','status','send','index','map','rawAttributes','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','ChatTransferReport','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x38b7d2,_0x583aab){var _0x80e337=function(_0x1955fb){while(--_0x1955fb){_0x38b7d2['push'](_0x38b7d2['shift']());}};_0x80e337(++_0x583aab);}(_0x036c,0x1bb));var _0xc036=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x036c[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0xc036('0x0'));var rimraf=require(_0xc036('0x1'));var zipdir=require(_0xc036('0x2'));var jsonpatch=require(_0xc036('0x3'));var rp=require(_0xc036('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc036('0x5'));var util=require(_0xc036('0x6'));var path=require(_0xc036('0x7'));var sox=require(_0xc036('0x8'));var csv=require(_0xc036('0x9'));var ejs=require(_0xc036('0xa'));var fs=require('fs');var fs_extra=require(_0xc036('0xb'));var _=require(_0xc036('0xc'));var squel=require(_0xc036('0xd'));var crypto=require(_0xc036('0xe'));var jsforce=require(_0xc036('0xf'));var deskjs=require(_0xc036('0x10'));var toCsv=require(_0xc036('0x9'));var querystring=require(_0xc036('0x11'));var Papa=require(_0xc036('0x12'));var Redis=require('ioredis');var authService=require(_0xc036('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc036('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc036('0x15'))('api');var utils=require(_0xc036('0x16'));var config=require(_0xc036('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc036('0x18'))['db'];function respondWithStatusCode(_0x585572,_0x45771c){_0x45771c=_0x45771c||0xcc;return function(_0x344e90){if(_0x344e90){return _0x585572[_0xc036('0x19')](_0x45771c);}return _0x585572['status'](_0x45771c)['end']();};}function respondWithResult(_0x37f01c,_0x16caa2){_0x16caa2=_0x16caa2||0xc8;return function(_0x43942b){if(_0x43942b){return _0x37f01c['status'](_0x16caa2)[_0xc036('0x1a')](_0x43942b);}};}function respondWithFilteredResult(_0x57adf4,_0x180090){return function(_0x318910){if(_0x318910){var _0x17afbe=typeof _0x180090[_0xc036('0x1b')]===_0xc036('0x1c')&&typeof _0x180090[_0xc036('0x1d')]===_0xc036('0x1c');var _0x5907e9=_0x318910[_0xc036('0x1e')];var _0x302fb7=_0x17afbe?0x0:_0x180090[_0xc036('0x1b')];var _0xc8fdd7=_0x17afbe?_0x318910[_0xc036('0x1e')]:_0x180090['offset']+_0x180090[_0xc036('0x1d')];var _0x36e9c1;if(_0xc8fdd7>=_0x5907e9){_0xc8fdd7=_0x5907e9;_0x36e9c1=0xc8;}else{_0x36e9c1=0xce;}_0x57adf4['status'](_0x36e9c1);return _0x57adf4[_0xc036('0x1f')](_0xc036('0x20'),_0x302fb7+'-'+_0xc8fdd7+'/'+_0x5907e9)[_0xc036('0x1a')](_0x318910);}return null;};}function patchUpdates(_0x4147bb){return function(_0x4d857a){try{jsonpatch[_0xc036('0x21')](_0x4d857a,_0x4147bb,!![]);}catch(_0x7a4b8c){return BPromise['reject'](_0x7a4b8c);}return _0x4d857a[_0xc036('0x22')]();};}function saveUpdates(_0x3005b6,_0x5e5d44){return function(_0x5b961f){if(_0x5b961f){return _0x5b961f[_0xc036('0x23')](_0x3005b6)[_0xc036('0x24')](function(_0x4cff40){return _0x4cff40;});}return null;};}function removeEntity(_0x271d0c,_0x160005){return function(_0x121763){if(_0x121763){return _0x121763[_0xc036('0x25')]()[_0xc036('0x24')](function(){_0x271d0c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x100e16,_0x31f728){return function(_0x10f3e5){if(!_0x10f3e5){_0x100e16['sendStatus'](0x194);}return _0x10f3e5;};}function handleError(_0x3f334d,_0x3d48ce){_0x3d48ce=_0x3d48ce||0x1f4;return function(_0x7a6155){logger[_0xc036('0x26')](_0x7a6155[_0xc036('0x27')]);if(_0x7a6155['name']){delete _0x7a6155[_0xc036('0x28')];}_0x3f334d[_0xc036('0x29')](_0x3d48ce)[_0xc036('0x2a')](_0x7a6155);};}exports[_0xc036('0x2b')]=function(_0x32038d,_0x2faae3){var _0xf6559f={},_0x236f68={},_0x483ce1={'count':0x0,'rows':[]};var _0x412122=_[_0xc036('0x2c')](db['ChatTransferReport'][_0xc036('0x2d')],function(_0x3154b1){return{'name':_0x3154b1['fieldName'],'type':_0x3154b1[_0xc036('0x2e')][_0xc036('0x2f')]};});_0x236f68['model']=_[_0xc036('0x2c')](_0x412122,_0xc036('0x28'));_0x236f68[_0xc036('0x30')]=_['keys'](_0x32038d['query']);_0x236f68[_0xc036('0x31')]=_[_0xc036('0x32')](_0x236f68[_0xc036('0x33')],_0x236f68[_0xc036('0x30')]);_0xf6559f['attributes']=_['intersection'](_0x236f68[_0xc036('0x33')],qs[_0xc036('0x34')](_0x32038d[_0xc036('0x30')]['fields']));_0xf6559f[_0xc036('0x35')]=_0xf6559f['attributes'][_0xc036('0x36')]?_0xf6559f[_0xc036('0x35')]:_0x236f68['model'];if(!_0x32038d[_0xc036('0x30')][_0xc036('0x37')]('nolimit')){_0xf6559f[_0xc036('0x1d')]=qs[_0xc036('0x1d')](_0x32038d['query'][_0xc036('0x1d')]);_0xf6559f[_0xc036('0x1b')]=qs[_0xc036('0x1b')](_0x32038d[_0xc036('0x30')][_0xc036('0x1b')]);}_0xf6559f[_0xc036('0x38')]=qs['sort'](_0x32038d[_0xc036('0x30')][_0xc036('0x39')]);_0xf6559f[_0xc036('0x3a')]=qs[_0xc036('0x31')](_['pick'](_0x32038d[_0xc036('0x30')],_0x236f68[_0xc036('0x31')]),_0x412122);if(_0x32038d[_0xc036('0x30')][_0xc036('0x3b')]){_0xf6559f[_0xc036('0x3a')]=_[_0xc036('0x3c')](_0xf6559f[_0xc036('0x3a')],{'$or':_[_0xc036('0x2c')](_0x412122,function(_0x7b5468){if(_0x7b5468[_0xc036('0x2e')]!==_0xc036('0x3d')){var _0x54a267={};_0x54a267[_0x7b5468['name']]={'$like':'%'+_0x32038d['query'][_0xc036('0x3b')]+'%'};return _0x54a267;}})});}_0xf6559f=_[_0xc036('0x3c')]({},_0xf6559f,_0x32038d['options']);var _0x2b6ef0={'where':_0xf6559f[_0xc036('0x3a')]};return db[_0xc036('0x3e')][_0xc036('0x1e')](_0x2b6ef0)[_0xc036('0x24')](function(_0x1a8e9d){_0x483ce1[_0xc036('0x1e')]=_0x1a8e9d;if(_0x32038d[_0xc036('0x30')][_0xc036('0x3f')]){_0xf6559f[_0xc036('0x40')]=[{'all':!![]}];}return db[_0xc036('0x3e')][_0xc036('0x41')](_0xf6559f);})[_0xc036('0x24')](function(_0xacfcc4){_0x483ce1[_0xc036('0x42')]=_0xacfcc4;return _0x483ce1;})[_0xc036('0x24')](respondWithFilteredResult(_0x2faae3,_0xf6559f))[_0xc036('0x43')](handleError(_0x2faae3,null));};exports[_0xc036('0x44')]=function(_0x2da4bb,_0x5a450b){var _0x3d16a2={'raw':!![],'where':{'id':_0x2da4bb[_0xc036('0x45')]['id']}},_0x534d55={};_0x534d55[_0xc036('0x33')]=_[_0xc036('0x46')](db['ChatTransferReport'][_0xc036('0x2d')]);_0x534d55[_0xc036('0x30')]=_[_0xc036('0x46')](_0x2da4bb[_0xc036('0x30')]);_0x534d55[_0xc036('0x31')]=_[_0xc036('0x32')](_0x534d55[_0xc036('0x33')],_0x534d55['query']);_0x3d16a2[_0xc036('0x35')]=_[_0xc036('0x32')](_0x534d55['model'],qs[_0xc036('0x34')](_0x2da4bb['query'][_0xc036('0x34')]));_0x3d16a2['attributes']=_0x3d16a2[_0xc036('0x35')]['length']?_0x3d16a2[_0xc036('0x35')]:_0x534d55[_0xc036('0x33')];if(_0x2da4bb['query'][_0xc036('0x3f')]){_0x3d16a2['include']=[{'all':!![]}];}_0x3d16a2=_[_0xc036('0x3c')]({},_0x3d16a2,_0x2da4bb[_0xc036('0x47')]);return db[_0xc036('0x3e')][_0xc036('0x48')](_0x3d16a2)[_0xc036('0x24')](handleEntityNotFound(_0x5a450b,null))[_0xc036('0x24')](respondWithResult(_0x5a450b,null))[_0xc036('0x43')](handleError(_0x5a450b,null));};exports[_0xc036('0x49')]=function(_0x247770,_0x3df765){return db[_0xc036('0x3e')][_0xc036('0x49')](_0x247770[_0xc036('0x4a')],{})[_0xc036('0x24')](respondWithResult(_0x3df765,0xc9))[_0xc036('0x43')](handleError(_0x3df765,null));};exports[_0xc036('0x23')]=function(_0xc7212c,_0x4fc611){if(_0xc7212c['body']['id']){delete _0xc7212c[_0xc036('0x4a')]['id'];}return db[_0xc036('0x3e')][_0xc036('0x48')]({'where':{'id':_0xc7212c[_0xc036('0x45')]['id']}})[_0xc036('0x24')](handleEntityNotFound(_0x4fc611,null))['then'](saveUpdates(_0xc7212c[_0xc036('0x4a')],null))[_0xc036('0x24')](respondWithResult(_0x4fc611,null))['catch'](handleError(_0x4fc611,null));};exports[_0xc036('0x25')]=function(_0x53718b,_0x4639f1){return db[_0xc036('0x3e')][_0xc036('0x48')]({'where':{'id':_0x53718b[_0xc036('0x45')]['id']}})[_0xc036('0x24')](handleEntityNotFound(_0x4639f1,null))['then'](removeEntity(_0x4639f1,null))[_0xc036('0x43')](handleError(_0x4639f1,null));};exports[_0xc036('0x4b')]=function(_0x4f3709,_0x52765c){return db['ChatTransferReport']['describe']()['then'](respondWithResult(_0x52765c,null))[_0xc036('0x43')](handleError(_0x52765c,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 68ebd56..7730259 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 _0xba32=['bluebird','path','rimraf','../../config/environment','exports','ChatTransferReport','report_chat_transfer','uniqueid','api','moment'];(function(_0x39106e,_0x586f3d){var _0x892aec=function(_0xded1b5){while(--_0xded1b5){_0x39106e['push'](_0x39106e['shift']());}};_0x892aec(++_0x586f3d);}(_0xba32,0x170));var _0x2ba3=function(_0x3918a3,_0x3e3db8){_0x3918a3=_0x3918a3-0x0;var _0x4f252f=_0xba32[_0x3918a3];return _0x4f252f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x2ba3('0x0'));var moment=require(_0x2ba3('0x1'));var BPromise=require(_0x2ba3('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ba3('0x3'));var rimraf=require(_0x2ba3('0x4'));var config=require(_0x2ba3('0x5'));var attributes=require('./chatTransferReport.attributes');module[_0x2ba3('0x6')]=function(_0x3dcb11,_0x5d5328){return _0x3dcb11['define'](_0x2ba3('0x7'),attributes,{'tableName':_0x2ba3('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2ba3('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8459=['path','../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer','uniqueid','../../config/logger','api','moment'];(function(_0x23d1c4,_0x1d2689){var _0x5181f0=function(_0x75a113){while(--_0x75a113){_0x23d1c4['push'](_0x23d1c4['shift']());}};_0x5181f0(++_0x1d2689);}(_0x8459,0x18d));var _0x9845=function(_0x2ad92d,_0x5ea0f0){_0x2ad92d=_0x2ad92d-0x0;var _0x45b2d1=_0x8459[_0x2ad92d];return _0x45b2d1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9845('0x0'))(_0x9845('0x1'));var moment=require(_0x9845('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9845('0x3'));var rimraf=require('rimraf');var config=require(_0x9845('0x4'));var attributes=require(_0x9845('0x5'));module[_0x9845('0x6')]=function(_0x26844b,_0x4c0b1b){return _0x26844b['define'](_0x9845('0x7'),attributes,{'tableName':_0x9845('0x8'),'paranoid':![],'indexes':[{'name':_0x9845('0x9'),'fields':[_0x9845('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 44f48c5..e3234bd 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 _0xcf58=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash'];(function(_0x1760f3,_0x6f17b9){var _0x52139b=function(_0x1e7f32){while(--_0x1e7f32){_0x1760f3['push'](_0x1760f3['shift']());}};_0x52139b(++_0x6f17b9);}(_0xcf58,0x175));var _0x8cf5=function(_0x544251,_0x56291e){_0x544251=_0x544251-0x0;var _0x48513f=_0xcf58[_0x544251];return _0x48513f;};'use strict';var _=require(_0x8cf5('0x0'));var util=require('util');var moment=require(_0x8cf5('0x1'));var BPromise=require(_0x8cf5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8cf5('0x3'));var db=require(_0x8cf5('0x4'))['db'];var utils=require(_0x8cf5('0x5'));var logger=require(_0x8cf5('0x6'))(_0x8cf5('0x7'));var config=require(_0x8cf5('0x8'));var jayson=require(_0x8cf5('0x9'));var client=jayson[_0x8cf5('0xa')][_0x8cf5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x587e56,_0x505abb,_0x413ddd){return new BPromise(function(_0x4ccaa4,_0x3767fe){return client[_0x8cf5('0xc')](_0x587e56,_0x413ddd)[_0x8cf5('0xd')](function(_0x60046c){logger['info'](_0x8cf5('0xe'),_0x505abb,_0x8cf5('0xf'));logger[_0x8cf5('0x10')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x505abb,'request\x20sent',JSON[_0x8cf5('0x11')](_0x60046c));if(_0x60046c['error']){if(_0x60046c[_0x8cf5('0x12')][_0x8cf5('0x13')]===0x1f4){logger[_0x8cf5('0x12')](_0x8cf5('0xe'),_0x505abb,_0x60046c[_0x8cf5('0x12')][_0x8cf5('0x14')]);return _0x3767fe(_0x60046c[_0x8cf5('0x12')][_0x8cf5('0x14')]);}logger[_0x8cf5('0x12')](_0x8cf5('0xe'),_0x505abb,_0x60046c[_0x8cf5('0x12')][_0x8cf5('0x14')]);return _0x4ccaa4(_0x60046c[_0x8cf5('0x12')][_0x8cf5('0x14')]);}else{logger['info'](_0x8cf5('0xe'),_0x505abb,'request\x20sent');_0x4ccaa4(_0x60046c['result'][_0x8cf5('0x14')]);}})[_0x8cf5('0x15')](function(_0x319f43){logger['error'](_0x8cf5('0xe'),_0x505abb,_0x319f43);_0x3767fe(_0x319f43);});});} \ No newline at end of file +var _0xfc71=['info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x2cc89a,_0x35191a){var _0x35d9b5=function(_0x40b8a9){while(--_0x40b8a9){_0x2cc89a['push'](_0x2cc89a['shift']());}};_0x35d9b5(++_0x35191a);}(_0xfc71,0x179));var _0x1fc7=function(_0x29db71,_0x306de1){_0x29db71=_0x29db71-0x0;var _0x2c8a07=_0xfc71[_0x29db71];return _0x2c8a07;};'use strict';var _=require(_0x1fc7('0x0'));var util=require(_0x1fc7('0x1'));var moment=require('moment');var BPromise=require(_0x1fc7('0x2'));var rs=require(_0x1fc7('0x3'));var fs=require('fs');var Redis=require(_0x1fc7('0x4'));var db=require(_0x1fc7('0x5'))['db'];var utils=require(_0x1fc7('0x6'));var logger=require(_0x1fc7('0x7'))('rpc');var config=require(_0x1fc7('0x8'));var jayson=require(_0x1fc7('0x9'));var client=jayson[_0x1fc7('0xa')][_0x1fc7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1395a5,_0x1adaac,_0x3cc2d2){return new BPromise(function(_0x31d5a0,_0x109e18){return client[_0x1fc7('0xc')](_0x1395a5,_0x3cc2d2)[_0x1fc7('0xd')](function(_0x2a04e4){logger[_0x1fc7('0xe')](_0x1fc7('0xf'),_0x1adaac,_0x1fc7('0x10'));logger[_0x1fc7('0x11')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x1adaac,'request\x20sent',JSON[_0x1fc7('0x12')](_0x2a04e4));if(_0x2a04e4[_0x1fc7('0x13')]){if(_0x2a04e4[_0x1fc7('0x13')][_0x1fc7('0x14')]===0x1f4){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x1adaac,_0x2a04e4[_0x1fc7('0x13')][_0x1fc7('0x15')]);return _0x109e18(_0x2a04e4['error'][_0x1fc7('0x15')]);}logger[_0x1fc7('0x13')]('ChatTransferReport,\x20%s,\x20%s',_0x1adaac,_0x2a04e4[_0x1fc7('0x13')][_0x1fc7('0x15')]);return _0x31d5a0(_0x2a04e4[_0x1fc7('0x13')]['message']);}else{logger[_0x1fc7('0xe')](_0x1fc7('0xf'),_0x1adaac,_0x1fc7('0x10'));_0x31d5a0(_0x2a04e4[_0x1fc7('0x16')]['message']);}})['catch'](function(_0x1e70c1){logger[_0x1fc7('0x13')]('ChatTransferReport,\x20%s,\x20%s',_0x1adaac,_0x1e70c1);_0x109e18(_0x1e70c1);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index fbe7a8f..9006749 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 _0xdee2=['get','/describe','isAuthenticated','describe','/:id','show','post','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatTransferReport.controller'];(function(_0x324012,_0x23f45f){var _0x435cf2=function(_0x378a82){while(--_0x378a82){_0x324012['push'](_0x324012['shift']());}};_0x435cf2(++_0x23f45f);}(_0xdee2,0x19b));var _0x2dee=function(_0x21e4fc,_0x3e3020){_0x21e4fc=_0x21e4fc-0x0;var _0x4df40c=_0xdee2[_0x21e4fc];return _0x4df40c;};'use strict';var multer=require(_0x2dee('0x0'));var util=require(_0x2dee('0x1'));var path=require(_0x2dee('0x2'));var timeout=require('connect-timeout');var express=require(_0x2dee('0x3'));var router=express[_0x2dee('0x4')]();var fs_extra=require(_0x2dee('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2dee('0x6'));var config=require(_0x2dee('0x7'));var controller=require(_0x2dee('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2dee('0x9')](_0x2dee('0xa'),auth[_0x2dee('0xb')](),controller[_0x2dee('0xc')]);router[_0x2dee('0x9')](_0x2dee('0xd'),auth[_0x2dee('0xb')](),controller[_0x2dee('0xe')]);router[_0x2dee('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2dee('0x10')](_0x2dee('0xd'),auth['isAuthenticated'](),controller[_0x2dee('0x11')]);router[_0x2dee('0x12')](_0x2dee('0xd'),auth[_0x2dee('0xb')](),controller['destroy']);module[_0x2dee('0x13')]=router; \ No newline at end of file +var _0x1ebe=['/describe','/:id','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','isAuthenticated','index'];(function(_0x32b1bf,_0x4025e6){var _0x26432c=function(_0x59c42a){while(--_0x59c42a){_0x32b1bf['push'](_0x32b1bf['shift']());}};_0x26432c(++_0x4025e6);}(_0x1ebe,0x73));var _0xe1eb=function(_0x7b583,_0x3a506d){_0x7b583=_0x7b583-0x0;var _0x2eda64=_0x1ebe[_0x7b583];return _0x2eda64;};'use strict';var multer=require('multer');var util=require(_0xe1eb('0x0'));var path=require(_0xe1eb('0x1'));var timeout=require(_0xe1eb('0x2'));var express=require(_0xe1eb('0x3'));var router=express[_0xe1eb('0x4')]();var fs_extra=require(_0xe1eb('0x5'));var auth=require(_0xe1eb('0x6'));var interaction=require(_0xe1eb('0x7'));var config=require('../../config/environment');var controller=require(_0xe1eb('0x8'));router['get']('/',auth[_0xe1eb('0x9')](),controller[_0xe1eb('0xa')]);router['get'](_0xe1eb('0xb'),auth[_0xe1eb('0x9')](),controller['describe']);router['get'](_0xe1eb('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xe1eb('0x9')](),controller[_0xe1eb('0xd')]);router['put'](_0xe1eb('0xc'),auth[_0xe1eb('0x9')](),controller[_0xe1eb('0xe')]);router[_0xe1eb('0xf')](_0xe1eb('0xc'),auth[_0xe1eb('0x9')](),controller[_0xe1eb('0x10')]);module[_0xe1eb('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 dc70043..c9328c1 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 _0x41ba=['INTEGER','BOOLEAN','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Feedback','ENUM','star','thumb','stringify','input','text','name','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','CHAT','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','email','#011F6A','#ffffff'];(function(_0x1a733e,_0x6cec06){var _0x5a0f2b=function(_0x4c1562){while(--_0x4c1562){_0x1a733e['push'](_0x1a733e['shift']());}};_0x5a0f2b(++_0x6cec06);}(_0x41ba,0x8c));var _0xa41b=function(_0x1c37fb,_0x29f819){_0x1c37fb=_0x1c37fb-0x0;var _0x29d071=_0x41ba[_0x1c37fb];return _0x29d071;};'use strict';var Sequelize=require(_0xa41b('0x0'));var rs=require(_0xa41b('0x1'));module[_0xa41b('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0xa41b('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':_0xa41b('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xa41b('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xa41b('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xa41b('0x3')],'allowNull':![],'defaultValue':_0xa41b('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xa41b('0x3')],'allowNull':![],'defaultValue':_0xa41b('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xa41b('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xa41b('0x3')]},'animation':{'type':Sequelize[_0xa41b('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0xa41b('0x9'),'squared'),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':_0xa41b('0xa')},'start_chat_button':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':_0xa41b('0xb')},'offline_chat_button':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':_0xa41b('0xc')},'header_offline':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':_0xa41b('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0xa41b('0xe')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xa41b('0xf')]},'closingQuestion':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':_0xa41b('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':_0xa41b('0x11')},'noteTitle':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':_0xa41b('0x12')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xa41b('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xa41b('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xa41b('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':_0xa41b('0x13')},'ratingType':{'type':Sequelize[_0xa41b('0x14')](_0xa41b('0x15'),_0xa41b('0x16')),'defaultValue':_0xa41b('0x15')},'ratingStarsNumber':{'type':Sequelize[_0xa41b('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xa41b('0x17')]({'items':[{'type':_0xa41b('0x18'),'variable':null,'config':{'placeholder':'name','type':_0xa41b('0x19'),'required':!![]},'props':{'title':_0xa41b('0x1a'),'helpText':''}},{'type':_0xa41b('0x18'),'props':{'title':_0xa41b('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xa41b('0x1b')](_0xa41b('0x1c'))?JSON[_0xa41b('0x1d')](this[_0xa41b('0x1b')]('onlineForm')):{};},'set':function(_0x31ba35){return this[_0xa41b('0x1e')](_0xa41b('0x1c'),JSON[_0xa41b('0x17')](_0x31ba35));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xa41b('0x17')]({'items':[{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xa41b('0x4'),'type':_0xa41b('0x4')},'variable':null},{'type':_0xa41b('0x1f'),'config':{'placeholder':'Comments'},'props':{'title':_0xa41b('0x20'),'helpText':_0xa41b('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0xa41b('0x1b')](_0xa41b('0x22'))?JSON[_0xa41b('0x1d')](this['getDataValue'](_0xa41b('0x22'))):{};},'set':function(_0xd6dc72){return this[_0xa41b('0x1e')](_0xa41b('0x22'),JSON[_0xa41b('0x17')](_0xd6dc72));}},'token':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':function(){return rs[_0xa41b('0x23')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xa41b('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xa41b('0x3')]},'forwardOffline':{'type':Sequelize[_0xa41b('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':_0xa41b('0x24')},'offlineMessageSubject':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':_0xa41b('0x25')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xa41b('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xa41b('0x26')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xa41b('0x27')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xa41b('0xc')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xa41b('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xa41b('0xf')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xa41b('0x3')]},'notificationTemplate':{'type':Sequelize[_0xa41b('0xf')],'defaultValue':function(){return _0xa41b('0x28');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa41b('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xa41b('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xa41b('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':_0xa41b('0x29')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0xa41b('0x2a')},'messagesAlignment':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xa41b('0x3')]},'customerAvatar':{'type':Sequelize[_0xa41b('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0xa41b('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xa41b('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xa41b('0x3')],'allowNull':![],'defaultValue':_0xa41b('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xa41b('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa41b('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa41b('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa41b('0x7')],'comment':_0xa41b('0x2c')},'mandatoryDisposition':{'type':Sequelize[_0xa41b('0x8')],'defaultValue':![],'comment':_0xa41b('0x2d'),'set':function(_0x24d763){if(!_0x24d763)this['setDataValue'](_0xa41b('0x2e'),null);this[_0xa41b('0x1e')](_0xa41b('0x2f'),_0x24d763);}},'vidaooEscalation':{'type':Sequelize[_0xa41b('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xa41b('0x3')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xa41b('0x30');}},'vidaooMetadata':{'type':Sequelize[_0xa41b('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xa41b('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xa41b('0xf')]}}; \ No newline at end of file +var _0x35e4=['star','thumb','stringify','text','name','getDataValue','onlineForm','parse','setDataValue','input','textarea','Comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Send','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','CHAT','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','STRING','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','rounded','We\x20are\x20here!','Chat','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','ENUM'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x35e4,0x17b));var _0x435e=function(_0x3feab4,_0x512555){_0x3feab4=_0x3feab4-0x0;var _0x43df8c=_0x35e4[_0x3feab4];return _0x43df8c;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x435e('0x0'));module['exports']={'name':{'type':Sequelize[_0x435e('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x435e('0x1')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x435e('0x1')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x435e('0x2')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x435e('0x2')},'key':{'type':Sequelize[_0x435e('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x435e('0x1')],'defaultValue':_0x435e('0x3')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x435e('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x435e('0x4'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x435e('0x1')],'allowNull':![],'defaultValue':_0x435e('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x435e('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x435e('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded','squared'),'defaultValue':_0x435e('0x8')},'header_online':{'type':Sequelize[_0x435e('0x1')],'defaultValue':_0x435e('0x9')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x435e('0xa')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x435e('0x1')],'defaultValue':_0x435e('0xb')},'download_transcript':{'type':Sequelize[_0x435e('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x435e('0x6')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x435e('0xc')},'defaultWhiteLabel':{'type':Sequelize[_0x435e('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x435e('0xd')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x435e('0xe')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x435e('0x1')],'defaultValue':_0x435e('0xf')},'noteTitle':{'type':Sequelize[_0x435e('0x1')],'defaultValue':_0x435e('0x10')},'placeholderMessage':{'type':Sequelize[_0x435e('0x1')],'defaultValue':_0x435e('0x11')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x435e('0x12')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x435e('0x1')],'defaultValue':_0x435e('0x13')},'conditionAgreement':{'type':Sequelize[_0x435e('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x435e('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x435e('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x435e('0x1')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x435e('0x14')](_0x435e('0x15'),_0x435e('0x16')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x435e('0xd')],'defaultValue':function(){return JSON[_0x435e('0x17')]({'items':[{'type':'input','variable':null,'config':{'placeholder':'name','type':_0x435e('0x18'),'required':!![]},'props':{'title':_0x435e('0x19'),'helpText':''}},{'type':'input','props':{'title':_0x435e('0x2'),'helpText':''},'config':{'required':!![],'placeholder':_0x435e('0x2'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x435e('0x1a')](_0x435e('0x1b'))?JSON[_0x435e('0x1c')](this['getDataValue'](_0x435e('0x1b'))):{};},'set':function(_0x76b202){return this[_0x435e('0x1d')](_0x435e('0x1b'),JSON[_0x435e('0x17')](_0x76b202));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x435e('0x1e'),'props':{'title':_0x435e('0x2'),'helpText':''},'config':{'required':!![],'placeholder':_0x435e('0x2'),'type':'email'},'variable':null},{'type':_0x435e('0x1f'),'config':{'placeholder':_0x435e('0x20')},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x435e('0x1a')](_0x435e('0x21'))?JSON[_0x435e('0x1c')](this[_0x435e('0x1a')]('offlineForm')):{};},'set':function(_0x2d1e82){return this['setDataValue'](_0x435e('0x21'),JSON['stringify'](_0x2d1e82));}},'token':{'type':Sequelize[_0x435e('0x1')],'defaultValue':function(){return rs[_0x435e('0x22')]();}},'autoclose':{'type':Sequelize[_0x435e('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x435e('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x435e('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x435e('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x435e('0x1')],'defaultValue':_0x435e('0x23')},'waitingMessage':{'type':Sequelize[_0x435e('0x1')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x435e('0x1')],'defaultValue':_0x435e('0x24')},'enableUnmanagedNote':{'type':Sequelize[_0x435e('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x435e('0x1')],'defaultValue':_0x435e('0x25')},'skipUnmanaged':{'type':Sequelize[_0x435e('0x1')],'defaultValue':_0x435e('0x13')},'sendUnmanaged':{'type':Sequelize[_0x435e('0x1')],'defaultValue':_0x435e('0x26')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x435e('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x435e('0xd')],'defaultValue':function(){return _0x435e('0x27');}},'notificationSound':{'type':Sequelize[_0x435e('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x435e('0x1')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x435e('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x435e('0x1')],'defaultValue':_0x435e('0x28')},'verticalAlignment':{'type':Sequelize[_0x435e('0x6')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x435e('0x1')],'defaultValue':_0x435e('0x29')},'messagesAlignment':{'type':Sequelize[_0x435e('0x1')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x435e('0xd')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x435e('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x435e('0x1')],'allowNull':![],'defaultValue':_0x435e('0x2a'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x435e('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x435e('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x435e('0x1')],'defaultValue':_0x435e('0x2b')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x435e('0x6')],'comment':_0x435e('0x2c')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x435e('0x2d'),'set':function(_0x57e797){if(!_0x57e797)this[_0x435e('0x1d')](_0x435e('0x2e'),null);this[_0x435e('0x1d')](_0x435e('0x2f'),_0x57e797);}},'vidaooEscalation':{'type':Sequelize[_0x435e('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x435e('0x1')],'allowNull':![],'defaultValue':_0x435e('0x30')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x435e('0x31');}},'vidaooMetadata':{'type':Sequelize[_0x435e('0xd')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x435e('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x435e('0xd')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index bf91277..c811938 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 _0xb10b=['removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','util','path','ejs','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','destroy','get','UserProfileResource','stack','name','index','map','ChatWebsite','rawAttributes','fieldName','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','filter','options','includeAll','findAll','rows','mandatoryDispositionPause','intersection','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChatWebsites','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','Pause','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','addAvatar','agentAvatar','file','addCustomerAvatar','customerAvatar','filename','systemAvatar','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','user-agent','getResult','chat','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','CmList','List','Contacts','ChatApplication','Applications','account','applications','list','orderBy','asc','defaults','contact','customerIp','cf-connecting-ip','headers','x-forwarded-for','first','split','firstName','lastName','referer','browser','version','format','%s\x20%s','unknown','device','threadId','ChatInteraction','ContactId','interaction','spread','messageId','created','close','unmanaged','ChatMessage','AttachmentId','UserId','User','unshift','agent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','offline','describe','ListId','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','service','host','port','authentication','auth','pass','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','mimetype','subjectOffline','toPairsIn','mapValues','Chat','MailAccountId','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','timezone','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','getSnippet','Interval','Intervals','getProactiveActions','getLicense','virtual','License','chatLicenseExceeded','readFileSync','server/files/chat/iframe.ejs','remote','x-real-ip','connection','labelText','textColor','backgroundColor','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit'];(function(_0x4af806,_0x5fff0a){var _0x5170d2=function(_0x2800b1){while(--_0x2800b1){_0x4af806['push'](_0x4af806['shift']());}};_0x5170d2(++_0x5fff0a);}(_0xb10b,0x12a));var _0xbb10=function(_0x59a3e9,_0x27fb38){_0x59a3e9=_0x59a3e9-0x0;var _0x5179ac=_0xb10b[_0x59a3e9];return _0x5179ac;};'use strict';var BPromise=require(_0xbb10('0x0'));var Mustache=require('mustache');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var ejs=require(_0xbb10('0x3'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb10('0x4'));var querystring=require(_0xbb10('0x5'));var Redis=require(_0xbb10('0x6'));var qs=require(_0xbb10('0x7'));var logger=require(_0xbb10('0x8'))(_0xbb10('0x9'));var config=require('../../config/environment');var db=require(_0xbb10('0xa'))['db'];config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);var htmlToText=require(_0xbb10('0x10'));var jayson=require(_0xbb10('0x11'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xbb10('0x12')][_0xbb10('0x13')]({'port':0x232a});var client9003=jayson[_0xbb10('0x12')]['http']({'port':0x232b});var client9001=jayson[_0xbb10('0x12')]['http']({'port':0x2329});function respondWithRpcPromise(_0x44fb19,_0x916a32,_0x285009,_0x193a27){return new BPromise(function(_0x442548,_0x147230){var _0x58a612=_0x193a27||client;return _0x58a612[_0xbb10('0x14')](_0x44fb19,_0x285009)[_0xbb10('0x15')](function(_0x45b9d6){logger[_0xbb10('0x16')](_0xbb10('0x17'),_0x916a32,_0xbb10('0x18'));logger[_0xbb10('0x19')](_0xbb10('0x1a'),_0x916a32,_0xbb10('0x18'),JSON[_0xbb10('0x1b')](_0x45b9d6));if(_0x45b9d6['error']){if(_0x45b9d6[_0xbb10('0x1c')][_0xbb10('0x1d')]===0x1f4){logger[_0xbb10('0x1c')](_0xbb10('0x17'),_0x916a32,_0x45b9d6[_0xbb10('0x1c')][_0xbb10('0x1e')]);return _0x147230(_0x45b9d6[_0xbb10('0x1c')][_0xbb10('0x1e')]);}logger[_0xbb10('0x1c')](_0xbb10('0x17'),_0x916a32,_0x45b9d6['error'][_0xbb10('0x1e')]);return _0x442548(_0x45b9d6[_0xbb10('0x1c')][_0xbb10('0x1e')]);}else{logger[_0xbb10('0x16')](_0xbb10('0x17'),_0x916a32,_0xbb10('0x18'));_0x442548(_0x45b9d6['result'][_0xbb10('0x1e')]);}})[_0xbb10('0x1f')](function(_0x50aea1){logger['error'](_0xbb10('0x17'),_0x916a32,_0x50aea1);_0x147230(_0x50aea1);});});}function respondWithStatusCode(_0x311abe,_0x2e911d){_0x2e911d=_0x2e911d||0xcc;return function(_0x317da4){if(_0x317da4){return _0x311abe[_0xbb10('0x20')](_0x2e911d);}return _0x311abe[_0xbb10('0x21')](_0x2e911d)[_0xbb10('0x22')]();};}function respondWithResult(_0x436104,_0x7f2377){_0x7f2377=_0x7f2377||0xc8;return function(_0x395404){if(_0x395404){return _0x436104[_0xbb10('0x21')](_0x7f2377)[_0xbb10('0x23')](_0x395404);}};}function respondWithFilteredResult(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(_0x4fb5e0){var _0xc93a04=typeof _0x4fedac[_0xbb10('0x24')]===_0xbb10('0x25')&&typeof _0x4fedac['limit']===_0xbb10('0x25');var _0x24d586=_0x4fb5e0[_0xbb10('0x26')];var _0x1d5e95=_0xc93a04?0x0:_0x4fedac[_0xbb10('0x24')];var _0x20d946=_0xc93a04?_0x4fb5e0[_0xbb10('0x26')]:_0x4fedac['offset']+_0x4fedac[_0xbb10('0x27')];var _0x21ac54;if(_0x20d946>=_0x24d586){_0x20d946=_0x24d586;_0x21ac54=0xc8;}else{_0x21ac54=0xce;}_0x537898[_0xbb10('0x21')](_0x21ac54);return _0x537898[_0xbb10('0x28')](_0xbb10('0x29'),_0x1d5e95+'-'+_0x20d946+'/'+_0x24d586)[_0xbb10('0x23')](_0x4fb5e0);}return null;};}function saveUpdates(_0x5d5c80){return function(_0x221624){if(_0x221624){return _0x221624['update'](_0x5d5c80)[_0xbb10('0x15')](function(_0x56f2da){return _0x56f2da;});}return null;};}function removeEntity(_0x16ad2a){return function(_0x1dcc9c){if(_0x1dcc9c){return _0x1dcc9c[_0xbb10('0x2a')]()['then'](function(){var _0x518d47=_0x1dcc9c[_0xbb10('0x2b')]({'plain':!![]});var _0x34f65e='ChatWebsites';return db[_0xbb10('0x2c')][_0xbb10('0x2a')]({'where':{'type':_0x34f65e,'resourceId':_0x518d47['id']}})[_0xbb10('0x15')](function(){return _0x1dcc9c;});})[_0xbb10('0x15')](function(){_0x16ad2a[_0xbb10('0x21')](0xcc)[_0xbb10('0x22')]();});}};}function handleEntityNotFound(_0xf85197){return function(_0x4975f5){if(!_0x4975f5){_0xf85197[_0xbb10('0x20')](0x194);}return _0x4975f5;};}function handleError(_0x1da9c9,_0x441d15){_0x441d15=_0x441d15||0x1f4;return function(_0x8c1ce6){logger[_0xbb10('0x1c')](_0x8c1ce6[_0xbb10('0x2d')]);if(_0x8c1ce6[_0xbb10('0x2e')]){delete _0x8c1ce6[_0xbb10('0x2e')];}_0x1da9c9[_0xbb10('0x21')](_0x441d15)['send'](_0x8c1ce6);};}exports[_0xbb10('0x2f')]=function(_0x150107,_0x1ddd9e){var _0x3c3c45={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x570f5a={},_0x111762={'count':0x0,'rows':[]};var _0x3eb3cc=_[_0xbb10('0x30')](db[_0xbb10('0x31')][_0xbb10('0x32')],function(_0x15d895){return{'name':_0x15d895[_0xbb10('0x33')],'type':_0x15d895['type'][_0xbb10('0x34')]};});_0x570f5a[_0xbb10('0x35')]=_['map'](_0x3eb3cc,'name');_0x570f5a['query']=_[_0xbb10('0x36')](_0x150107[_0xbb10('0x37')]);_0x570f5a[_0xbb10('0x38')]=_['intersection'](_0x570f5a[_0xbb10('0x35')],_0x570f5a[_0xbb10('0x37')]);_0x3c3c45[_0xbb10('0x39')]=_['intersection'](_0x570f5a[_0xbb10('0x35')],qs[_0xbb10('0x3a')](_0x150107[_0xbb10('0x37')][_0xbb10('0x3a')]));_0x3c3c45['attributes']=_0x3c3c45[_0xbb10('0x39')][_0xbb10('0x3b')]?_0x3c3c45['attributes']:_0x570f5a[_0xbb10('0x35')];if(!_0x150107[_0xbb10('0x37')][_0xbb10('0x3c')](_0xbb10('0x3d'))){_0x3c3c45[_0xbb10('0x27')]=qs[_0xbb10('0x27')](_0x150107['query'][_0xbb10('0x27')]);_0x3c3c45[_0xbb10('0x24')]=qs[_0xbb10('0x24')](_0x150107[_0xbb10('0x37')]['offset']);}_0x3c3c45[_0xbb10('0x3e')]=qs[_0xbb10('0x3f')](_0x150107[_0xbb10('0x37')][_0xbb10('0x3f')]);_0x3c3c45['where']=qs[_0xbb10('0x38')](_[_0xbb10('0x40')](_0x150107['query'],_0x570f5a['filters']),_0x3eb3cc);if(_0x150107[_0xbb10('0x37')]['filter']){_0x3c3c45[_0xbb10('0x41')]=_[_0xbb10('0x42')](_0x3c3c45['where'],{'$or':_[_0xbb10('0x30')](_0x3eb3cc,function(_0x1d82bf){if(_0x1d82bf[_0xbb10('0x43')]!=='VIRTUAL'){var _0x2dd02b={};_0x2dd02b[_0x1d82bf[_0xbb10('0x2e')]]={'$like':'%'+_0x150107[_0xbb10('0x37')][_0xbb10('0x44')]+'%'};return _0x2dd02b;}})});}_0x3c3c45=_[_0xbb10('0x42')]({},_0x3c3c45,_0x150107[_0xbb10('0x45')]);var _0x190781={'where':_0x3c3c45[_0xbb10('0x41')]};return db[_0xbb10('0x31')][_0xbb10('0x26')](_0x190781)[_0xbb10('0x15')](function(_0x1eadd2){_0x111762['count']=_0x1eadd2;if(_0x150107[_0xbb10('0x37')][_0xbb10('0x46')]){_0x3c3c45['include']=[{'all':!![]}];}return db[_0xbb10('0x31')][_0xbb10('0x47')](_0x3c3c45);})[_0xbb10('0x15')](function(_0x5a5226){_0x111762[_0xbb10('0x48')]=_0x5a5226;return _0x111762;})[_0xbb10('0x15')](respondWithFilteredResult(_0x1ddd9e,_0x3c3c45))[_0xbb10('0x1f')](handleError(_0x1ddd9e,null));};exports['show']=function(_0x4a9793,_0xcb3354){var _0x76a208={'raw':![],'where':{'id':_0x4a9793['params']['id']},'include':[{'model':db['Pause'],'as':_0xbb10('0x49')}]},_0x2b12bd={};_0x2b12bd[_0xbb10('0x35')]=_[_0xbb10('0x36')](db[_0xbb10('0x31')][_0xbb10('0x32')]);_0x2b12bd[_0xbb10('0x37')]=_[_0xbb10('0x36')](_0x4a9793[_0xbb10('0x37')]);_0x2b12bd[_0xbb10('0x38')]=_[_0xbb10('0x4a')](_0x2b12bd['model'],_0x2b12bd['query']);_0x76a208[_0xbb10('0x39')]=_[_0xbb10('0x4a')](_0x2b12bd[_0xbb10('0x35')],qs[_0xbb10('0x3a')](_0x4a9793[_0xbb10('0x37')][_0xbb10('0x3a')]));_0x76a208[_0xbb10('0x39')]=_0x76a208[_0xbb10('0x39')][_0xbb10('0x3b')]?_0x76a208[_0xbb10('0x39')]:_0x2b12bd[_0xbb10('0x35')];if(_0x4a9793[_0xbb10('0x37')][_0xbb10('0x46')]){_0x76a208[_0xbb10('0x4b')]=[{'all':!![]}];}_0x76a208=_[_0xbb10('0x42')]({},_0x76a208,_0x4a9793['options']);return db[_0xbb10('0x31')]['find'](_0x76a208)[_0xbb10('0x15')](handleEntityNotFound(_0xcb3354,null))[_0xbb10('0x15')](respondWithResult(_0xcb3354,null))[_0xbb10('0x1f')](handleError(_0xcb3354,null));};exports[_0xbb10('0x4c')]=function(_0x26e66e,_0x32d8e9){return db[_0xbb10('0x31')][_0xbb10('0x4c')](_0x26e66e[_0xbb10('0x4d')],{})[_0xbb10('0x15')](function(_0x44a056){var _0x1c2dce=_0x26e66e[_0xbb10('0x4e')][_0xbb10('0x2b')]({'plain':!![]});if(!_0x1c2dce)throw new Error(_0xbb10('0x4f'));if(_0x1c2dce['role']===_0xbb10('0x4e')){var _0x466eb7=_0x44a056[_0xbb10('0x2b')]({'plain':!![]});var _0x4ce8e7=_0xbb10('0x50');return db[_0xbb10('0x51')]['find']({'where':{'name':_0x4ce8e7,'userProfileId':_0x1c2dce[_0xbb10('0x52')]},'raw':!![]})[_0xbb10('0x15')](function(_0x2909a1){if(_0x2909a1&&_0x2909a1[_0xbb10('0x53')]===0x0){return db[_0xbb10('0x2c')][_0xbb10('0x4c')]({'name':_0x466eb7[_0xbb10('0x2e')],'resourceId':_0x466eb7['id'],'type':_0x2909a1[_0xbb10('0x2e')],'sectionId':_0x2909a1['id']},{})[_0xbb10('0x15')](function(){return _0x44a056;});}else{return _0x44a056;}})[_0xbb10('0x1f')](function(_0x2eb05a){logger[_0xbb10('0x1c')](_0xbb10('0x54'),_0x2eb05a);throw _0x2eb05a;});}return _0x44a056;})['then'](respondWithResult(_0x32d8e9,0xc9))['catch'](handleError(_0x32d8e9,null));};exports[_0xbb10('0x55')]=function(_0x3e6338,_0x3d0cb7){if(_0x3e6338[_0xbb10('0x4d')]['id']){delete _0x3e6338['body']['id'];}return db['ChatWebsite'][_0xbb10('0x56')]({'where':{'id':_0x3e6338[_0xbb10('0x57')]['id']},'include':[{'model':db[_0xbb10('0x58')],'as':_0xbb10('0x49')}]})[_0xbb10('0x15')](handleEntityNotFound(_0x3d0cb7,null))[_0xbb10('0x15')](saveUpdates(_0x3e6338[_0xbb10('0x4d')],null))['then'](respondWithResult(_0x3d0cb7,null))[_0xbb10('0x1f')](handleError(_0x3d0cb7,null));};exports[_0xbb10('0x2a')]=function(_0x4917a5,_0x5e03cb){return db['ChatWebsite'][_0xbb10('0x56')]({'where':{'id':_0x4917a5[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x5e03cb,null))['then'](removeEntity(_0x5e03cb,null))['catch'](handleError(_0x5e03cb,null));};exports['describe']=function(_0x3ebc5f,_0x249b33){return db[_0xbb10('0x31')]['describe']()[_0xbb10('0x15')](respondWithResult(_0x249b33,null))[_0xbb10('0x1f')](handleError(_0x249b33,null));};exports['addDisposition']=function(_0x4a560c,_0x27d7b9){if(_0x4a560c[_0xbb10('0x4d')]['id']){delete _0x4a560c[_0xbb10('0x4d')]['id'];}return db[_0xbb10('0x31')]['find']({'where':{'id':_0x4a560c[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x27d7b9,null))[_0xbb10('0x15')](function(_0x5202d7){if(_0x5202d7){_0x4a560c[_0xbb10('0x4d')][_0xbb10('0x59')]=_0x5202d7['id'];return db[_0xbb10('0x5a')]['create'](_0x4a560c[_0xbb10('0x4d')]);}})[_0xbb10('0x15')](respondWithResult(_0x27d7b9,null))[_0xbb10('0x1f')](handleError(_0x27d7b9,null));};exports[_0xbb10('0x5b')]=function(_0x5e4a6e,_0x251417){var _0x258e55={'raw':![],'where':{}};var _0x108e5b={};var _0x2d0f4b={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xbb10('0x5c')]({'where':{'id':_0x5e4a6e[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x251417,null))[_0xbb10('0x15')](function(_0x12f750){if(_0x12f750){_0x108e5b[_0xbb10('0x35')]=_[_0xbb10('0x36')](db['Disposition']['rawAttributes']);_0x108e5b['query']=_[_0xbb10('0x36')](_0x5e4a6e[_0xbb10('0x37')]);_0x108e5b[_0xbb10('0x38')]=_['intersection'](_0x108e5b['model'],_0x108e5b[_0xbb10('0x37')]);_0x258e55[_0xbb10('0x39')]=_[_0xbb10('0x4a')](_0x108e5b[_0xbb10('0x35')],qs[_0xbb10('0x3a')](_0x5e4a6e[_0xbb10('0x37')]['fields']));_0x258e55[_0xbb10('0x39')]=_0x258e55[_0xbb10('0x39')][_0xbb10('0x3b')]?_0x258e55[_0xbb10('0x39')]:_0x108e5b[_0xbb10('0x35')];if(!_0x5e4a6e['query']['hasOwnProperty']('nolimit')){_0x258e55[_0xbb10('0x27')]=qs[_0xbb10('0x27')](_0x5e4a6e[_0xbb10('0x37')][_0xbb10('0x27')]);_0x258e55[_0xbb10('0x24')]=qs[_0xbb10('0x24')](_0x5e4a6e['query'][_0xbb10('0x24')]);}_0x258e55['order']=qs['sort'](_0x5e4a6e['query'][_0xbb10('0x3f')]);_0x258e55[_0xbb10('0x41')]=qs[_0xbb10('0x38')](_[_0xbb10('0x40')](_0x5e4a6e['query'],_0x108e5b[_0xbb10('0x38')]));_0x258e55['where']['ChatWebsiteId']=_0x12f750['id'];if(_0x5e4a6e[_0xbb10('0x37')][_0xbb10('0x44')]){_0x258e55[_0xbb10('0x41')]=_[_0xbb10('0x42')](_0x258e55[_0xbb10('0x41')],{'$or':_['map'](_0x258e55[_0xbb10('0x39')],function(_0x19fcec){var _0x2c6429={};_0x2c6429[_0x19fcec]={'$like':'%'+_0x5e4a6e[_0xbb10('0x37')][_0xbb10('0x44')]+'%'};return _0x2c6429;})});}_0x258e55=_[_0xbb10('0x42')]({},_0x258e55,_0x5e4a6e[_0xbb10('0x45')]);return db['Disposition'][_0xbb10('0x26')]({'where':_0x258e55[_0xbb10('0x41')]})[_0xbb10('0x15')](function(_0x322b41){_0x2d0f4b[_0xbb10('0x26')]=_0x322b41;if(_0x5e4a6e[_0xbb10('0x37')][_0xbb10('0x46')]){_0x258e55[_0xbb10('0x4b')]=[{'all':!![]}];}return db['Disposition'][_0xbb10('0x47')](_0x258e55);})[_0xbb10('0x15')](function(_0x145baf){_0x2d0f4b['rows']=_0x145baf;return _0x2d0f4b;});}})['then'](respondWithFilteredResult(_0x251417,_0x258e55))['catch'](handleError(_0x251417,null));};exports[_0xbb10('0x5d')]=function(_0x5a3c44,_0x4e3d6a){return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x5a3c44[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x4e3d6a,null))[_0xbb10('0x15')](function(_0x24dca6){if(_0x24dca6){return _0x24dca6[_0xbb10('0x5d')](_0x5a3c44[_0xbb10('0x37')][_0xbb10('0x5e')]);}})['then'](respondWithStatusCode(_0x4e3d6a,null))[_0xbb10('0x1f')](handleError(_0x4e3d6a,null));};exports[_0xbb10('0x5f')]=function(_0x46b6d2,_0x35b811){if(_0x46b6d2['body']['id']){delete _0x46b6d2['body']['id'];}return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x46b6d2[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x35b811,null))['then'](function(_0x17d596){if(_0x17d596){_0x46b6d2[_0xbb10('0x4d')][_0xbb10('0x59')]=_0x17d596['id'];return db[_0xbb10('0x60')][_0xbb10('0x4c')](_0x46b6d2['body']);}})['then'](respondWithResult(_0x35b811,null))[_0xbb10('0x1f')](handleError(_0x35b811,null));};exports[_0xbb10('0x61')]=function(_0x22c030,_0x5239da){var _0x256b35={'raw':![],'where':{}};var _0x13e2ab={};var _0x50bcc9={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xbb10('0x5c')]({'where':{'id':_0x22c030[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x5239da,null))['then'](function(_0x32d5a5){if(_0x32d5a5){_0x13e2ab[_0xbb10('0x35')]=_[_0xbb10('0x36')](db[_0xbb10('0x60')][_0xbb10('0x32')]);_0x13e2ab[_0xbb10('0x37')]=_[_0xbb10('0x36')](_0x22c030[_0xbb10('0x37')]);_0x13e2ab[_0xbb10('0x38')]=_['intersection'](_0x13e2ab[_0xbb10('0x35')],_0x13e2ab[_0xbb10('0x37')]);_0x256b35[_0xbb10('0x39')]=_[_0xbb10('0x4a')](_0x13e2ab[_0xbb10('0x35')],qs[_0xbb10('0x3a')](_0x22c030[_0xbb10('0x37')][_0xbb10('0x3a')]));_0x256b35[_0xbb10('0x39')]=_0x256b35[_0xbb10('0x39')][_0xbb10('0x3b')]?_0x256b35[_0xbb10('0x39')]:_0x13e2ab['model'];if(!_0x22c030['query'][_0xbb10('0x3c')](_0xbb10('0x3d'))){_0x256b35[_0xbb10('0x27')]=qs[_0xbb10('0x27')](_0x22c030[_0xbb10('0x37')]['limit']);_0x256b35[_0xbb10('0x24')]=qs[_0xbb10('0x24')](_0x22c030[_0xbb10('0x37')][_0xbb10('0x24')]);}_0x256b35[_0xbb10('0x3e')]=qs[_0xbb10('0x3f')](_0x22c030['query'][_0xbb10('0x3f')]);_0x256b35[_0xbb10('0x41')]=qs['filters'](_[_0xbb10('0x40')](_0x22c030['query'],_0x13e2ab[_0xbb10('0x38')]));_0x256b35[_0xbb10('0x41')][_0xbb10('0x59')]=_0x32d5a5['id'];if(_0x22c030[_0xbb10('0x37')][_0xbb10('0x44')]){_0x256b35['where']=_[_0xbb10('0x42')](_0x256b35['where'],{'$or':_[_0xbb10('0x30')](_0x256b35[_0xbb10('0x39')],function(_0x5d767f){var _0x5aaa20={};_0x5aaa20[_0x5d767f]={'$like':'%'+_0x22c030[_0xbb10('0x37')][_0xbb10('0x44')]+'%'};return _0x5aaa20;})});}_0x256b35=_[_0xbb10('0x42')]({},_0x256b35,_0x22c030[_0xbb10('0x45')]);return db[_0xbb10('0x60')][_0xbb10('0x26')]({'where':_0x256b35[_0xbb10('0x41')]})[_0xbb10('0x15')](function(_0x252ab8){_0x50bcc9[_0xbb10('0x26')]=_0x252ab8;if(_0x22c030[_0xbb10('0x37')]['includeAll']){_0x256b35[_0xbb10('0x4b')]=[{'all':!![]}];}return db[_0xbb10('0x60')][_0xbb10('0x47')](_0x256b35);})[_0xbb10('0x15')](function(_0xfe02f5){_0x50bcc9[_0xbb10('0x48')]=_0xfe02f5;return _0x50bcc9;});}})[_0xbb10('0x15')](respondWithFilteredResult(_0x5239da,_0x256b35))[_0xbb10('0x1f')](handleError(_0x5239da,null));};exports[_0xbb10('0x62')]=function(_0x18a136,_0x1c4235){return db[_0xbb10('0x31')]['find']({'where':{'id':_0x18a136[_0xbb10('0x57')]['id']}})['then'](handleEntityNotFound(_0x1c4235,null))[_0xbb10('0x15')](function(_0x3675cd){if(_0x3675cd){return _0x3675cd[_0xbb10('0x62')](_0x18a136[_0xbb10('0x37')][_0xbb10('0x5e')]);}})['then'](respondWithStatusCode(_0x1c4235,null))[_0xbb10('0x1f')](handleError(_0x1c4235,null));};exports[_0xbb10('0x63')]=function(_0x44d1d2,_0x12e89d){_0x44d1d2[_0xbb10('0x4d')][_0xbb10('0x64')]=_0x44d1d2['file']['filename'];return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x44d1d2[_0xbb10('0x57')]['id']}})['then'](handleEntityNotFound(_0x12e89d,null))[_0xbb10('0x15')](saveUpdates(_0x44d1d2[_0xbb10('0x4d')],null))['then'](respondWithResult(_0x12e89d,null))[_0xbb10('0x1f')](handleError(_0x12e89d,null));};exports[_0xbb10('0x65')]=function(_0x5642c3,_0xdd3c7e){_0x5642c3['body'][_0xbb10('0x66')]=_0x5642c3[_0xbb10('0x67')]['filename'];return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x5642c3['params']['id']}})['then'](handleEntityNotFound(_0xdd3c7e,null))[_0xbb10('0x15')](saveUpdates(_0x5642c3[_0xbb10('0x4d')],null))[_0xbb10('0x15')](respondWithResult(_0xdd3c7e,null))[_0xbb10('0x1f')](handleError(_0xdd3c7e,null));};exports[_0xbb10('0x68')]=function(_0x4c3bdc,_0xe7c0a3){_0x4c3bdc[_0xbb10('0x4d')][_0xbb10('0x69')]=_0x4c3bdc['file'][_0xbb10('0x6a')];return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x4c3bdc[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0xe7c0a3,null))[_0xbb10('0x15')](saveUpdates(_0x4c3bdc[_0xbb10('0x4d')],null))[_0xbb10('0x15')](respondWithResult(_0xe7c0a3,null))[_0xbb10('0x1f')](handleError(_0xe7c0a3,null));};exports['addSystemAvatar']=function(_0x4fc544,_0x37e40c){_0x4fc544[_0xbb10('0x4d')][_0xbb10('0x6b')]=_0x4fc544[_0xbb10('0x67')][_0xbb10('0x6a')];return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x4fc544[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x37e40c,null))[_0xbb10('0x15')](saveUpdates(_0x4fc544[_0xbb10('0x4d')],null))[_0xbb10('0x15')](respondWithResult(_0x37e40c,null))[_0xbb10('0x1f')](handleError(_0x37e40c,null));};exports['getLogo']=function(_0x1e022d,_0x123587){var _0x24076a=path[_0xbb10('0x6c')](config[_0xbb10('0x6d')],_0xbb10('0x6e'));var _0x4258fc={'where':{'id':_0x1e022d[_0xbb10('0x57')]['id']},'attributes':['id',_0xbb10('0x64')],'raw':!![]};var _0x3c92f4=![];return require(_0xbb10('0x6f'))['getLicense']()[_0xbb10('0x15')](function(_0x5e1ac5){if(_0x5e1ac5){_0x3c92f4=_0x5e1ac5[_0xbb10('0x70')];}})[_0xbb10('0x15')](function(){return db[_0xbb10('0x31')][_0xbb10('0x56')](_0x4258fc);})[_0xbb10('0x15')](handleEntityNotFound(_0x123587,null))[_0xbb10('0x15')](function(_0x4e9cad){if(_0x4e9cad){if(!_[_0xbb10('0x71')](_0x4e9cad['sitepic'])){if(fs[_0xbb10('0x72')](path[_0xbb10('0x6c')](config[_0xbb10('0x6d')],_0xbb10('0x73'),_0x4e9cad[_0xbb10('0x64')]))&&_0x3c92f4){_0x24076a=path[_0xbb10('0x6c')](config[_0xbb10('0x6d')],_0xbb10('0x73'),_0x4e9cad[_0xbb10('0x64')]);}}return _0x123587[_0xbb10('0x74')](_0x24076a);}})[_0xbb10('0x1f')](handleError(_0x123587,null));};exports[_0xbb10('0x75')]=function(_0x589565,_0x3696b3){var _0x516520=path[_0xbb10('0x6c')](config[_0xbb10('0x6d')],_0xbb10('0x76'));var _0x7673a0={'where':{'id':_0x589565[_0xbb10('0x57')]['id']},'attributes':['id',_0xbb10('0x66')],'raw':!![]};return db[_0xbb10('0x31')]['find'](_0x7673a0)[_0xbb10('0x15')](handleEntityNotFound(_0x3696b3,null))['then'](function(_0x51063a){if(_0x51063a){if(!_[_0xbb10('0x71')](_0x51063a[_0xbb10('0x66')])){if(fs[_0xbb10('0x72')](path[_0xbb10('0x6c')](config[_0xbb10('0x6d')],_0xbb10('0x77'),_0x51063a['agentAvatar']))){_0x516520=path[_0xbb10('0x6c')](config[_0xbb10('0x6d')],_0xbb10('0x77'),_0x51063a[_0xbb10('0x66')]);}}return _0x3696b3[_0xbb10('0x74')](_0x516520);}})[_0xbb10('0x1f')](handleError(_0x3696b3,null));};exports['getCustomerAvatar']=function(_0xdfdc42,_0x4093a4){var _0xb7c454=path[_0xbb10('0x6c')](config[_0xbb10('0x6d')],_0xbb10('0x78'));var _0x2764e1={'where':{'id':_0xdfdc42['params']['id']},'attributes':['id',_0xbb10('0x69'),'showCustomerAvatar'],'raw':!![]};return db[_0xbb10('0x31')]['find'](_0x2764e1)['then'](handleEntityNotFound(_0x4093a4,null))[_0xbb10('0x15')](function(_0x225064){if(_0x225064){if(!_[_0xbb10('0x71')](_0x225064[_0xbb10('0x69')])){if(fs[_0xbb10('0x72')](path['join'](config[_0xbb10('0x6d')],'server/files/images/avatars/',_0x225064['customerAvatar']))&&_0x225064['showCustomerAvatar']){_0xb7c454=path[_0xbb10('0x6c')](config[_0xbb10('0x6d')],_0xbb10('0x77'),_0x225064[_0xbb10('0x69')]);}}return _0x4093a4[_0xbb10('0x74')](_0xb7c454);}})['catch'](handleError(_0x4093a4,null));};exports[_0xbb10('0x79')]=function(_0x42a2d7,_0x352de4){var _0x1bd1c1=path[_0xbb10('0x6c')](config[_0xbb10('0x6d')],_0xbb10('0x7a'));var _0x485c1a={'where':{'id':_0x42a2d7['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xbb10('0x31')][_0xbb10('0x56')](_0x485c1a)[_0xbb10('0x15')](handleEntityNotFound(_0x352de4,null))[_0xbb10('0x15')](function(_0x25cba1){if(_0x25cba1){if(!_[_0xbb10('0x71')](_0x25cba1[_0xbb10('0x6b')])){if(fs[_0xbb10('0x72')](path[_0xbb10('0x6c')](config[_0xbb10('0x6d')],'server/files/images/avatars/',_0x25cba1['systemAvatar']))){_0x1bd1c1=path['join'](config[_0xbb10('0x6d')],_0xbb10('0x77'),_0x25cba1[_0xbb10('0x6b')]);}}return _0x352de4['download'](_0x1bd1c1);}})[_0xbb10('0x1f')](handleError(_0x352de4,null));};exports[_0xbb10('0x7b')]=function(_0x2c638d,_0x290280){var _0x2a6589=require(_0xbb10('0x7c'));var _0x485f46=new _0x2a6589();var _0x57fe03=_0x485f46[_0xbb10('0x7d')](_0x2c638d['headers'][_0xbb10('0x7e')])[_0xbb10('0x7f')]();var _0x152ca9={'body':_0x2c638d[_0xbb10('0x4d')],'channel':_0xbb10('0x80')};var _0x2dfa04=[];var _0x13a29e=[];var _0x1388f6={};var _0xd3c2c8=![];return db[_0xbb10('0x81')]['describe']()[_0xbb10('0x15')](function(_0x5a9277){if(!_0x5a9277){throw new db[(_0xbb10('0x82'))]['ValidationError'](_0xbb10('0x83'));}_0x2dfa04=_[_0xbb10('0x84')](_[_0xbb10('0x36')](_0x5a9277),[_0xbb10('0x85'),'updatedAt']);_0x13a29e=_[_0xbb10('0x84')](_['keys'](_0x5a9277),[_0xbb10('0x85'),_0xbb10('0x86'),_0xbb10('0x87'),'ListId']);if(_0x2c638d[_0xbb10('0x4d')]['id']){delete _0x2c638d[_0xbb10('0x4d')]['id'];}if(_[_0xbb10('0x71')](_0x2c638d[_0xbb10('0x4d')][_0xbb10('0x88')])){throw new db[(_0xbb10('0x82'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x2c638d[_0xbb10('0x4d')]['body'])||_0x2c638d[_0xbb10('0x4d')]['body']===''){throw new db[(_0xbb10('0x82'))][(_0xbb10('0x89'))](_0xbb10('0x8a'));}if(_['isNil'](_0x2c638d['body'][_0xbb10('0x8b')])){throw new db[(_0xbb10('0x82'))][(_0xbb10('0x89'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x13a29e);}if(!_[_0xbb10('0x8c')](_0x13a29e,_0x2c638d[_0xbb10('0x4d')][_0xbb10('0x8b')])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x13a29e);}_0x1388f6[_0x2c638d[_0xbb10('0x4d')]['mapKey']]=_0x2c638d[_0xbb10('0x4d')][_0xbb10('0x88')];})[_0xbb10('0x15')](function(){return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x2c638d[_0xbb10('0x57')]['id']},'include':[{'model':db[_0xbb10('0x8d')],'as':_0xbb10('0x8e'),'include':[{'model':db[_0xbb10('0x81')],'as':_0xbb10('0x8f'),'where':_0x1388f6,'limit':0x1,'order':[[_0xbb10('0x86'),'DESC']]}]},{'model':db[_0xbb10('0x90')],'as':_0xbb10('0x91')}]});})['then'](handleEntityNotFound(_0x290280,null))[_0xbb10('0x15')](function(_0x5e3fac){if(_0x5e3fac&&_0x5e3fac['List']){_0x152ca9[_0xbb10('0x92')]=_0x5e3fac;_0x152ca9[_0xbb10('0x93')]=_0x5e3fac[_0xbb10('0x91')];_0x152ca9[_0xbb10('0x94')]=_0x5e3fac[_0xbb10('0x8e')];_0x152ca9['applications']=_[_0xbb10('0x95')](_0x152ca9[_0xbb10('0x93')],['priority'],[_0xbb10('0x96')]);if(_0x152ca9[_0xbb10('0x92')]['Applications']){delete _0x152ca9[_0xbb10('0x92')]['Applications'];}if(_0x152ca9[_0xbb10('0x92')][_0xbb10('0x8e')]&&_0x152ca9[_0xbb10('0x92')][_0xbb10('0x8e')][_0xbb10('0x8f')][_0xbb10('0x3b')]){return _0x152ca9[_0xbb10('0x92')]['List'][_0xbb10('0x8f')][0x0];}var _0x4720a1=_[_0xbb10('0x97')](_0x2c638d[_0xbb10('0x4d')],{'firstName':_0x2c638d[_0xbb10('0x4d')][_0xbb10('0x88')],'ListId':_0x5e3fac['ListId']});_0x4720a1[_0x2c638d['body']['mapKey']]=_0x2c638d[_0xbb10('0x4d')][_0xbb10('0x88')];return db[_0xbb10('0x81')][_0xbb10('0x4c')](_0x4720a1,{'fields':_0x2dfa04,'raw':!![]});}})['then'](handleEntityNotFound(_0x290280,null))[_0xbb10('0x15')](function(_0x3d7b4d){_0x152ca9[_0xbb10('0x98')]=_0x3d7b4d;var _0x577d27=_0x2c638d['body'][_0xbb10('0x99')];if(_0x2c638d['headers'][_0xbb10('0x9a')]){_0x577d27=_0x2c638d[_0xbb10('0x9b')][_0xbb10('0x9a')];}else if(_0x2c638d[_0xbb10('0x9b')][_0xbb10('0x9c')]){_0x577d27=_[_0xbb10('0x9d')](_0x2c638d[_0xbb10('0x9b')]['x-forwarded-for'][_0xbb10('0x9e')](','));}if(_0x3d7b4d){var _0x1eca6c={'ContactId':_0x3d7b4d['id'],'ChatWebsiteId':_0x2c638d['params']['id'],'from':(_0x3d7b4d[_0xbb10('0x9f')]||'')+'\x20'+(_0x3d7b4d[_0xbb10('0xa0')]||''),'customerIp':_0x577d27,'customerPort':_0x2c638d[_0xbb10('0x9b')]['x-real-port']?_0x2c638d['headers']['x-real-port']:null,'referer':_0x2c638d[_0xbb10('0x4d')][_0xbb10('0xa1')],'browserName':_0x57fe03['browser'][_0xbb10('0x2e')]&&_0x57fe03[_0xbb10('0xa2')][_0xbb10('0xa3')]?util[_0xbb10('0xa4')](_0xbb10('0xa5'),_0x57fe03[_0xbb10('0xa2')][_0xbb10('0x2e')],_0x57fe03['browser'][_0xbb10('0xa3')]):'unknown','browserVersion':_0x57fe03['browser']['version']||_0xbb10('0xa6'),'osName':util[_0xbb10('0xa4')]('%s\x20%s',_0x57fe03['os'][_0xbb10('0x2e')],_0x57fe03['os']['version']),'osVersion':_0x57fe03['os'][_0xbb10('0xa3')],'deviceModel':_0x57fe03[_0xbb10('0xa7')][_0xbb10('0x35')]&&_0x57fe03['device']['vendor']?util[_0xbb10('0xa4')]('%s\x20%s\x20%s',_0x57fe03[_0xbb10('0xa7')][_0xbb10('0x35')],_0x57fe03['device']['vendor'],_0x57fe03[_0xbb10('0xa7')][_0xbb10('0x43')]):null,'deviceVendor':_0x57fe03[_0xbb10('0xa7')]['vendor'],'deviceType':_0x57fe03[_0xbb10('0xa7')][_0xbb10('0x43')],'formData':JSON[_0xbb10('0x1b')](_0x2c638d['body'])};var _0x414066={'ChatWebsiteId':_0x2c638d[_0xbb10('0x57')]['id'],'closed':![]};if(_0x2c638d[_0xbb10('0x4d')][_0xbb10('0xa8')]){_0x414066[_0xbb10('0xa8')]=_0x2c638d[_0xbb10('0x4d')][_0xbb10('0xa8')];return db[_0xbb10('0xa9')][_0xbb10('0x56')]({'where':_0x414066})[_0xbb10('0x15')](function(_0x10ca4a){if(_0x10ca4a){return[_0x10ca4a,![]];}_0x1eca6c[_0xbb10('0xa8')]=_0x2c638d[_0xbb10('0x4d')]['threadId'];_0x1eca6c['externalUrl']=_0x2c638d[_0xbb10('0x4d')]['externalUrl'];return db[_0xbb10('0xa9')][_0xbb10('0x4c')](_0x1eca6c)[_0xbb10('0x15')](function(_0x4e5236){return[_0x4e5236,!![]];});});}_0x414066[_0xbb10('0xaa')]=_0x3d7b4d['id'];if(_0x2c638d[_0xbb10('0x4d')][_0xbb10('0xab')]&&_0x2c638d[_0xbb10('0x4d')][_0xbb10('0xab')]['id']){_0x414066['id']=_0x2c638d['body'][_0xbb10('0xab')]['id'];return db[_0xbb10('0xa9')][_0xbb10('0x56')]({'where':_0x414066})[_0xbb10('0x15')](function(_0x150d4c){if(_0x150d4c){return[_0x150d4c,![]];}return db[_0xbb10('0xa9')]['create'](_0x1eca6c)[_0xbb10('0x15')](function(_0x2f0262){return[_0x2f0262,!![]];});});}return db['ChatInteraction'][_0xbb10('0x4c')](_0x1eca6c)[_0xbb10('0x15')](function(_0x2d0de5){return[_0x2d0de5,!![]];});}})[_0xbb10('0xac')](function(_0x3abc15,_0x43df3c){if(_0x3abc15){_0xd3c2c8=_0x43df3c;if(!_0x43df3c){var _0x45593c={'from':(_0x152ca9[_0xbb10('0x98')][_0xbb10('0x9f')]||'')+'\x20'+(_0x152ca9[_0xbb10('0x98')][_0xbb10('0xa0')]||'')};if(_0x2c638d[_0xbb10('0x4d')][_0xbb10('0xa8')]&&_0x2c638d[_0xbb10('0x4d')][_0xbb10('0xad')]&&_0x2c638d['body'][_0xbb10('0xa8')]!=_0x2c638d[_0xbb10('0x4d')]['messageId']){_0x45593c['threadId']=_0x2c638d[_0xbb10('0x4d')][_0xbb10('0xad')];}return _0x3abc15[_0xbb10('0x55')](_0x45593c);}else{return _0x3abc15;}}})[_0xbb10('0x15')](function(_0x27fb82){_0x152ca9[_0xbb10('0xab')]=_0x27fb82[_0xbb10('0x2b')]({'plain':!![]});_0x152ca9[_0xbb10('0xab')][_0xbb10('0xae')]=_0xd3c2c8;if(_0x152ca9['interaction']['created']){if(_0x152ca9['account']['autoclose']){_0x152ca9['applications']['push']({'id':0x0,'priority':_0x152ca9[_0xbb10('0x93')][_0xbb10('0x3b')]+0x1,'app':_0xbb10('0xaf'),'appdata':_0xbb10('0xb0'),'interval':'*,*,*,*'});}}return db[_0xbb10('0xb1')][_0xbb10('0x4c')]({'body':_0x2c638d[_0xbb10('0x4d')][_0xbb10('0x4d')],'ChatWebsiteId':_0x2c638d['params']['id'],'ChatInteractionId':_0x27fb82['id'],'direction':'in','ContactId':_0x152ca9['contact']['id'],'AttachmentId':_0x2c638d[_0xbb10('0x4d')][_0xbb10('0xb2')]});})['then'](function(_0x581832){_0x152ca9[_0xbb10('0x1e')]=_0x581832;if(_0x152ca9[_0xbb10('0xab')][_0xbb10('0xb3')]){return db[_0xbb10('0xb4')][_0xbb10('0x56')]({'attributes':['id','name'],'where':{'id':_0x152ca9[_0xbb10('0xab')]['UserId']}})['then'](function(_0x9d96e2){if(_0x9d96e2){_0x152ca9[_0xbb10('0x93')][_0xbb10('0xb5')]({'id':0x0,'priority':0x0,'app':_0xbb10('0xb6'),'appdata':_0x9d96e2[_0xbb10('0x2e')]+','+(_0x152ca9[_0xbb10('0x92')]['waitForTheAssignedAgent']||0xa),'interval':_0xbb10('0xb7')});_0x152ca9[_0xbb10('0xb8')]=!![];}return respondWithRpcPromise(_0xbb10('0xb9'),_0xbb10('0xba'),_0x152ca9);});}return respondWithRpcPromise(_0xbb10('0xb9'),_0xbb10('0xba'),_0x152ca9);})[_0xbb10('0x15')](function(_0xce60f4){respondWithRpcPromise(_0xbb10('0xbb'),_0xbb10('0xbb'),{'event':_0xbb10('0x7b'),'message':_0xce60f4},client9002);return _0xce60f4;})[_0xbb10('0x15')](respondWithResult(_0x290280,null))[_0xbb10('0x1f')](handleError(_0x290280,null));};exports[_0xbb10('0xbc')]=function(_0x45b31c,_0x3cf074){var _0x232a1b,_0xbdc520,_0x246ee3;var _0x43a203=[];var _0x1ca43e={};var _0x1f84b0=_0x45b31c['files']||[];var _0x2158e2=[];var _0x47883f;return db[_0xbb10('0x81')][_0xbb10('0xbd')]()[_0xbb10('0x15')](function(_0x2b1f0f){if(!_0x2b1f0f){throw new db[(_0xbb10('0x82'))]['ValidationError']('no\x20available\x20attributes');}_0x43a203=_['difference'](_[_0xbb10('0x36')](_0x2b1f0f),[_0xbb10('0x85'),'updatedAt',_0xbb10('0x87'),_0xbb10('0xbe')]);if(_0x45b31c[_0xbb10('0x4d')]['id']){delete _0x45b31c['body']['id'];}if(_[_0xbb10('0x71')](_0x45b31c[_0xbb10('0x4d')][_0xbb10('0x88')])){throw _0x3cf074['status'](0x1f4)[_0xbb10('0xbf')](new db['Sequelize'][(_0xbb10('0x89'))]('from\x20is\x20mandatory'));}if(_['isNil'](_0x45b31c['body']['body'])||_0x45b31c['body']['body']===''){throw _0x3cf074[_0xbb10('0x21')](0x1f4)[_0xbb10('0xbf')](new db[(_0xbb10('0x82'))][(_0xbb10('0x89'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xbb10('0x71')](_0x45b31c[_0xbb10('0x4d')][_0xbb10('0xc0')])){throw _0x3cf074[_0xbb10('0x21')](0x1f4)[_0xbb10('0xbf')](new db[(_0xbb10('0x82'))][(_0xbb10('0x89'))](_0xbb10('0xc1')+_0x43a203));}if(!_[_0xbb10('0x8c')](_0x43a203,_0x45b31c[_0xbb10('0x4d')]['mapKeyOffline'])){throw _0x3cf074[_0xbb10('0x21')](0x1f4)[_0xbb10('0xbf')](new db[(_0xbb10('0x82'))]['ValidationError'](_0xbb10('0xc2')+_0x43a203));}_0x1ca43e[_0x45b31c[_0xbb10('0x4d')][_0xbb10('0xc0')]]=_0x45b31c[_0xbb10('0x4d')]['from'];})[_0xbb10('0x15')](function(){return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x45b31c[_0xbb10('0x57')]['id']},'include':[{'model':db[_0xbb10('0x8d')],'as':_0xbb10('0x8e')},{'model':db[_0xbb10('0xc3')],'as':_0xbb10('0xc3')}]});})[_0xbb10('0x15')](handleEntityNotFound(_0x3cf074,null))[_0xbb10('0x15')](function(_0x3c01ff){if(_0x3c01ff&&_0x3c01ff['List']){_0xbdc520=_0x3c01ff;var _0x59d917=_[_0xbb10('0x97')](_0x45b31c['body'],{'firstName':_0x45b31c['body'][_0xbb10('0x88')],'phone':_0x45b31c[_0xbb10('0x4d')]['from'],'ListId':_0x3c01ff[_0xbb10('0xbe')]});_0x59d917[_0x45b31c[_0xbb10('0x4d')]['mapKeyOffline']]=_0x45b31c[_0xbb10('0x4d')][_0xbb10('0x88')];return db[_0xbb10('0x81')][_0xbb10('0xc4')]({'where':_0x1ca43e,'defaults':_0x59d917});}})[_0xbb10('0xac')](function(_0x4d2c76){if(_0x4d2c76){_0x246ee3=_0x4d2c76;var _0x4fc260=fs['readFileSync'](path[_0xbb10('0x6c')](config['root'],_0xbb10('0xc5')),'utf8');var _0x510467=ejs[_0xbb10('0xc6')](_0x4fc260,{'body':_[_0xbb10('0xc7')](_0x45b31c[_0xbb10('0x4d')][_0xbb10('0x4d')]),'bodyTitle':_0xbdc520[_0xbb10('0xc8')]});return db[_0xbb10('0xc9')]['create']({'body':_0x510467,'plainBody':htmlToText['fromString'](_0x510467),'ContactId':_0x4d2c76['id'],'ChatWebsiteId':_0xbdc520['id']});}})['then'](function(_0x5ad067){_0x47883f=_0x5ad067;if(_0x1f84b0[_0xbb10('0x3b')]){var _0x18632f=_0x1f84b0[_0xbb10('0x30')](function(_0x26bc1c){return{'name':_0x26bc1c[_0xbb10('0xca')],'basename':_0x26bc1c[_0xbb10('0x6a')],'type':_0x26bc1c['mimetype'],'ChatOfflineMessageId':_0x5ad067['id']};});_0x2158e2=_0x18632f[_0xbb10('0x30')](_0x207bbb=>{var _0x35586a={'filename':_0x207bbb[_0xbb10('0x2e')],'path':path['join'](config[_0xbb10('0x6d')],'server','files',_0xbb10('0xcb'),_0xbb10('0xcc'),_0x207bbb[_0xbb10('0xcd')])};return _0x35586a;});if(!_0xbdc520[_0xbb10('0xce')]){return db[_0xbb10('0xcf')][_0xbb10('0xd0')](function(_0x4b7bf8){return db[_0xbb10('0xd1')][_0xbb10('0xd2')](_0x18632f,{'transaction':_0x4b7bf8});});}}})[_0xbb10('0x15')](function(){if(_0x47883f){_0x232a1b=_0x47883f;return db[_0xbb10('0xc3')][_0xbb10('0x5c')]({'where':{'active':!![]},'include':[{'model':db[_0xbb10('0xd3')],'as':_0xbb10('0xd4'),'raw':!![]}]});}})['then'](function(_0x2cbbb6){if(_0x2cbbb6&&_0x2cbbb6[_0xbb10('0xd4')]&&_0xbdc520[_0xbb10('0xd5')]&&_0xbdc520['forwardOfflineAddress']){var _0x595664={'tls':{'rejectUnauthorized':![]}};if(_0x2cbbb6[_0xbb10('0xd4')][_0xbb10('0xd6')]){_0x595664[_0xbb10('0xd6')]=_0x2cbbb6[_0xbb10('0xd4')][_0xbb10('0xd6')];}else{_0x595664[_0xbb10('0xd7')]=_0x2cbbb6[_0xbb10('0xd4')]['host'];_0x595664[_0xbb10('0xd8')]=_0x2cbbb6[_0xbb10('0xd4')][_0xbb10('0xd8')];_0x595664['secure']=_0x2cbbb6['Smtp']['secure'];}if(_0x2cbbb6['Smtp'][_0xbb10('0xd9')]){_0x595664[_0xbb10('0xda')]={'user':_0x2cbbb6[_0xbb10('0xd4')][_0xbb10('0x4e')],'pass':_0x2cbbb6['Smtp'][_0xbb10('0xdb')]};}return respondWithRpcPromise('SendMail',_0xbb10('0xdc'),{'account':_0x595664,'message':{'from':util[_0xbb10('0xa4')](_0xbb10('0xdd'),_0x2cbbb6[_0xbb10('0x2e')],_0x2cbbb6[_0xbb10('0xde')]||_0x2cbbb6[_0xbb10('0xd4')][_0xbb10('0x4e')]),'to':_0xbdc520[_0xbb10('0xdf')],'subject':_0xbdc520[_0xbb10('0xe0')],'html':_0x232a1b[_0xbb10('0x4d')],'attachments':_0x2158e2}},client9003)[_0xbb10('0x15')](function(){return _0x232a1b;})[_0xbb10('0x1f')](function(_0x4c969d){console[_0xbb10('0x1c')](_0x4c969d);});}})[_0xbb10('0x15')](function(){if(_0xbdc520&&_0xbdc520[_0xbb10('0xce')]&&_0xbdc520['MailAccountId']){var _0x204ebf=[];if(_0x1f84b0['length']){_0x204ebf=_0x1f84b0[_0xbb10('0x30')](function(_0x446bcf){return{'name':_0x446bcf[_0xbb10('0xca')],'basename':_0x446bcf[_0xbb10('0x6a')],'type':_0x446bcf[_0xbb10('0xe1')],'ChatOfflineMessageId':_0x47883f['id']};});}var _0x533327;if(!_['isNil'](_0xbdc520[_0xbb10('0xe2')])){var _0x4cf5cc=_['map'](_0x45b31c[_0xbb10('0x4d')],function(_0x5621b1){return _0x5621b1;});var _0xa9ed32=_[_0xbb10('0xe3')](_0x4cf5cc)[0x0];var _0x3f0a4e=_[_0xbb10('0xe4')](_0xa9ed32,function(_0x309b4a){return _0x309b4a;});_0x533327=_0x3f0a4e[0x1][_0xbdc520[_0xbb10('0xe2')]];}var _0x3a0940={'from':_0x246ee3[_0xbb10('0xde')],'firstName':_0x246ee3['firstName'],'lastName':_0x246ee3[_0xbb10('0xa0')],'mapKey':'email','message':{'from':_0x246ee3[_0xbb10('0xde')],'to':_0xbdc520['MailAccount'][_0xbb10('0xde')],'cc':'','subject':_[_0xbb10('0x71')](_0x533327)?_0xbdc520['offlineMessageSubject']:_0x533327,'messageId':'','sentAt':new Date(),'attach':_0x204ebf[_0xbb10('0x3b')],'attachments':_0x204ebf,'originChannel':_0xbb10('0xe5'),'ChatWebsiteId':_0xbdc520['id'],'ChatOfflineMessageId':_0x232a1b['id'],'originTo':_0xbdc520[_0xbb10('0xc3')]['email']},'body':_0x232a1b[_0xbb10('0x4d')]};var _0x1a8503={'account':{'id':_0xbdc520[_0xbb10('0xe6')]},'body':_0x3a0940,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0xbb10('0xe7'),_0xbb10('0xe8'),_0x1a8503,client9001)[_0xbb10('0x15')](function(){return _0x232a1b;})['catch'](function(_0x3e6756){console['error'](_0x3e6756);});}return;})[_0xbb10('0x15')](function(){if(_0x232a1b){return _0x232a1b;}})[_0xbb10('0x15')](respondWithResult(_0x3cf074,null))[_0xbb10('0x1f')](function(_0xd94118){console[_0xbb10('0x1c')](_0xbb10('0x1f'),_0xd94118);for(var _0x23e592 of _0x1f84b0){var _0x44d28a=path[_0xbb10('0x6c')](config[_0xbb10('0x6d')],'server','files',_0xbb10('0xcb'),_0xbb10('0xcc'),_0x23e592[_0xbb10('0x6a')]);fs_extra['remove'](_0x44d28a)[_0xbb10('0x1f')](function(_0x1067f2){console[_0xbb10('0x1c')](_0xbb10('0xe9'),_0x44d28a,_0x1067f2);});}});};exports[_0xbb10('0xea')]=function(_0x431673,_0x81d970){return db[_0xbb10('0xa9')][_0xbb10('0x56')]({'where':{'id':_0x431673['params']['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x81d970,null))[_0xbb10('0x15')](function(_0x4102af){if(_0x4102af){return _0x4102af[_0xbb10('0xea')](_0x431673['body'][_0xbb10('0x5e')],_[_0xbb10('0xeb')](_0x431673[_0xbb10('0x4d')],['ids','id'])||{});}})['then'](respondWithResult(_0x81d970,null))[_0xbb10('0x1f')](handleError(_0x81d970,null));};exports['getInteractions']=function(_0x37c688,_0x4874be){var _0x3fd69e={'raw':![],'where':{}};var _0x1aa860={};var _0x28cd8e={'count':0x0,'rows':[]};return db[_0xbb10('0x31')][_0xbb10('0x5c')]({'where':{'id':_0x37c688[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x4874be,null))['then'](function(_0x20c514){if(_0x20c514){_0x1aa860[_0xbb10('0x35')]=_[_0xbb10('0x36')](db[_0xbb10('0xa9')][_0xbb10('0x32')]);_0x1aa860[_0xbb10('0x37')]=_['keys'](_0x37c688[_0xbb10('0x37')]);_0x1aa860[_0xbb10('0x38')]=_[_0xbb10('0x4a')](_0x1aa860[_0xbb10('0x35')],_0x1aa860[_0xbb10('0x37')]);_0x3fd69e[_0xbb10('0x39')]=_[_0xbb10('0x4a')](_0x1aa860['model'],qs[_0xbb10('0x3a')](_0x37c688[_0xbb10('0x37')][_0xbb10('0x3a')]));_0x3fd69e['attributes']=_0x3fd69e[_0xbb10('0x39')]['length']?_0x3fd69e[_0xbb10('0x39')]:_0x1aa860[_0xbb10('0x35')];if(!_0x37c688[_0xbb10('0x37')]['hasOwnProperty']('nolimit')){_0x3fd69e[_0xbb10('0x27')]=qs[_0xbb10('0x27')](_0x37c688[_0xbb10('0x37')][_0xbb10('0x27')]);_0x3fd69e[_0xbb10('0x24')]=qs[_0xbb10('0x24')](_0x37c688[_0xbb10('0x37')][_0xbb10('0x24')]);}_0x3fd69e[_0xbb10('0x3e')]=qs[_0xbb10('0x3f')](_0x37c688[_0xbb10('0x37')]['sort']);_0x3fd69e['where']=qs[_0xbb10('0x38')](_[_0xbb10('0x40')](_0x37c688['query'],_0x1aa860['filters']));_0x3fd69e[_0xbb10('0x41')][_0xbb10('0x59')]=_0x20c514['id'];if(_0x37c688[_0xbb10('0x37')]['filter']){_0x3fd69e[_0xbb10('0x41')]=_[_0xbb10('0x42')](_0x3fd69e['where'],{'$or':_[_0xbb10('0x30')](_0x3fd69e[_0xbb10('0x39')],function(_0x544c9c){var _0x5a5349={};_0x5a5349[_0x544c9c]={'$like':'%'+_0x37c688[_0xbb10('0x37')][_0xbb10('0x44')]+'%'};return _0x5a5349;})});}_0x3fd69e=_[_0xbb10('0x42')]({},_0x3fd69e,_0x37c688['options']);return db['ChatInteraction'][_0xbb10('0x26')]({'where':_0x3fd69e[_0xbb10('0x41')]})['then'](function(_0x1e9dd2){_0x28cd8e[_0xbb10('0x26')]=_0x1e9dd2;if(_0x37c688['query'][_0xbb10('0x46')]){_0x3fd69e[_0xbb10('0x4b')]=[{'model':db[_0xbb10('0x81')],'as':_0xbb10('0xec'),'required':![]},{'model':db['User'],'as':_0xbb10('0xed'),'attributes':['name',_0xbb10('0xee'),_0xbb10('0xef')],'required':![]},{'model':db[_0xbb10('0xf0')],'as':_0xbb10('0xf1'),'attributes':['id',_0xbb10('0x2e'),_0xbb10('0xf2')],'where':_0x37c688[_0xbb10('0x37')][_0xbb10('0xf3')]?{'id':_0x37c688['query'][_0xbb10('0xf3')]}:undefined,'required':_0x37c688[_0xbb10('0x37')][_0xbb10('0xf3')]?!![]:![]}];}return db[_0xbb10('0xa9')]['findAll'](_0x3fd69e);})['then'](function(_0xd23108){_0x28cd8e[_0xbb10('0x48')]=_0xd23108;return _0x28cd8e;});}})[_0xbb10('0x15')](respondWithFilteredResult(_0x4874be,_0x3fd69e))[_0xbb10('0x1f')](handleError(_0x4874be,null));};function iftimePromise(_0x5b2e0b,_0x215028){return respondWithRpcPromise(_0xbb10('0xf4'),'getSnippet',{'command':_0x215028[_0xbb10('0xf5')]?util['format']('iftime\x20%s,%s',_0x5b2e0b[_0xbb10('0xf6')],_0x215028[_0xbb10('0xf5')]):util[_0xbb10('0xa4')](_0xbb10('0xf7'),_0x5b2e0b[_0xbb10('0xf6')])},client9002)['then'](function(_0x38403e){var _0x262078=_0x38403e&&_0x38403e[_0xbb10('0xf8')](_0xbb10('0xf9'))>=0x0?!![]:![];logger[_0xbb10('0x16')](_0xbb10('0xfa'),_0x215028['id'],_0x5b2e0b['id'],_0x5b2e0b[_0xbb10('0xf6')],_0x262078?_0xbb10('0xfb'):_0xbb10('0xfc'),_0x215028[_0xbb10('0xf5')]?_0x215028[_0xbb10('0xf5')]:_0xbb10('0xfd'));return _0x262078;})[_0xbb10('0x1f')](function(_0x9fcc26){logger[_0xbb10('0x1c')](_0xbb10('0xfa'),_0x215028['id'],_0x5b2e0b['id'],_0x5b2e0b[_0xbb10('0xf6')],util[_0xbb10('0xfe')](_0x9fcc26,{'showHidden':![],'depth':null}),_0x215028[_0xbb10('0xf5')]?_0x215028[_0xbb10('0xf5')]:_0xbb10('0xfd'));return![];});}exports[_0xbb10('0xff')]=function(_0x1b4873,_0x1ca72c){var _0x36615e=0x0;var _0x2f38d3=0x0;var _0x5a4d21=![];var _0x57b891;var _0x19eaa2;return db[_0xbb10('0x31')]['find']({'where':{'id':_0x1b4873[_0xbb10('0x57')]['id']},'include':[{'model':db[_0xbb10('0x100')],'as':'Interval','include':[{'model':db[_0xbb10('0x100')],'as':_0xbb10('0x101'),'attributes':['id','interval'],'raw':!![]}]}]})[_0xbb10('0x15')](handleEntityNotFound(_0x1ca72c,null))[_0xbb10('0x15')](function(_0xb4fdea){if(_0xb4fdea){_0x57b891=_0xb4fdea;return _0xb4fdea[_0xbb10('0x102')]({'raw':!![]});}})['then'](function(_0x170061){if(_0x57b891){if(_0x170061){_0x19eaa2=_0x170061;}}return require(_0xbb10('0x6f'))[_0xbb10('0x103')]();})[_0xbb10('0x15')](function(_0x5c0732){if(_0x5c0732){_0x2f38d3=_0x5c0732[_0xbb10('0x104')];_0x5a4d21=_0x5c0732[_0xbb10('0x70')];}})[_0xbb10('0x15')](function(){return db[_0xbb10('0xa9')][_0xbb10('0x26')]({'where':{'closed':![]}});})[_0xbb10('0x15')](function(_0x2f626b){_0x36615e=_0x2f626b;if(_0x2f38d3&&_0x2f626b>_0x2f38d3){return db[_0xbb10('0x105')][_0xbb10('0x5c')]({'where':{'id':0x1}})[_0xbb10('0x15')](function(_0x2fd942){if(_0x2fd942){_0x2fd942['increment'](_0xbb10('0x106'));}});}})[_0xbb10('0x15')](function(){if(_0x57b891[_0xbb10('0x100')]&&_0x57b891[_0xbb10('0x100')]['Intervals']){var _0x5116d8=[];for(var _0x8bfc0f=0x0;_0x8bfc0f<_0x57b891[_0xbb10('0x100')][_0xbb10('0x101')][_0xbb10('0x3b')];_0x8bfc0f++){var _0x5f0576=_0x57b891[_0xbb10('0x100')][_0xbb10('0x101')][_0x8bfc0f][_0xbb10('0x2b')]({'plain':!![]});_0x5116d8['push'](iftimePromise(_0x5f0576,_0x57b891));}return BPromise['all'](_0x5116d8)[_0xbb10('0x15')](function(_0xd6b33){return _['some'](_0xd6b33);});}else{return!![];}})['then'](function(_0x424bb1){var _0x615606=fs[_0xbb10('0x107')](path[_0xbb10('0x6c')](config[_0xbb10('0x6d')],_0xbb10('0x108')),'utf8');var _0x408544={'remote':_0x57b891[_0xbb10('0x109')],'query':querystring[_0xbb10('0x1b')](_[_0xbb10('0x42')](_0x57b891[_0xbb10('0x2b')]({'plain':!![]}),{'customerIp':_0x1b4873[_0xbb10('0x9b')][_0xbb10('0x9c')]||_0x1b4873[_0xbb10('0x9b')][_0xbb10('0x10a')]||_0x1b4873[_0xbb10('0x10b')]['remoteAddress']||_0x1b4873['ip'],'referer':_0x1b4873[_0xbb10('0x9b')][_0xbb10('0xa1')],'openedInteractions':_0x36615e,'maxInteractions':_0x2f38d3,'virtual':_0x5a4d21['virtual'],'online':_0x424bb1,'custom':_0x5a4d21}))['replace'](/'/g,'\x5c\x27')};_0x1ca72c['send'](ejs['render'](Mustache['render'](_0x615606,_0x408544),{'proactiveActions':_0x19eaa2,'alignment':_0x57b891['alignment'],'verticalAlignment':_0x57b891['verticalAlignment'],'div_color':_0x57b891['color'],'labelText':_0x57b891[_0xbb10('0x10c')],'text_color':_0x57b891[_0xbb10('0x10d')],'button_color':_0x57b891['color_button'],'background_color':_0x57b891[_0xbb10('0x10e')]}));})[_0xbb10('0x1f')](handleError(_0x1ca72c,null));};exports[_0xbb10('0x10f')]=function(_0x3b9bec,_0x1d099a){var _0x1d36fa=_0x3b9bec[_0xbb10('0x57')]['id'];var _0x23179d=_0x3b9bec[_0xbb10('0x4d')];var _0x14d9e7=0xc8;var _0x19dfef=null;return db[_0xbb10('0xcf')]['transaction']({'isolationLevel':db[_0xbb10('0xcf')][_0xbb10('0x110')][_0xbb10('0x111')][_0xbb10('0x112')]},function(_0x155f92){return db['ChatWebsite'][_0xbb10('0x5c')]({'where':{'id':_0x1d36fa},'transaction':_0x155f92})['then'](function(_0x52209c){if(_0x52209c){return db[_0xbb10('0x90')][_0xbb10('0x2a')]({'where':{'ChatWebsiteId':_0x1d36fa},'transaction':_0x155f92})['then'](function(){var _0x3e433b=_[_0xbb10('0x30')](_0x23179d,function(_0x201e05){_0x201e05[_0xbb10('0x59')]=_0x1d36fa;return _0x201e05;});return db[_0xbb10('0x90')]['bulkCreate'](_0x3e433b,{'transaction':_0x155f92});});}else{_0x14d9e7=0x194;_0x19dfef=[];}});})['then'](function(){if(_0x14d9e7!==0x194){return db[_0xbb10('0x90')][_0xbb10('0x113')]({'where':{'ChatWebsiteId':_0x1d36fa},'order':'priority'})[_0xbb10('0x15')](function(_0x4cf976){_0x19dfef=_0x4cf976;});}})[_0xbb10('0x1f')](function(_0x1a2f42){_0x14d9e7=0x1f4;logger[_0xbb10('0x1c')](_0x1a2f42[_0xbb10('0x2d')]);if(_0x1a2f42[_0xbb10('0x2e')]){delete _0x1a2f42[_0xbb10('0x2e')];}_0x19dfef=_0x1a2f42;})[_0xbb10('0x114')](function(){if(_0x19dfef===null){_0x1d099a['sendStatus'](_0x14d9e7);}else{if(_0x14d9e7===0x1f4){_0x1d099a[_0xbb10('0x21')](_0x14d9e7)[_0xbb10('0xbf')](_0x19dfef);}else{_0x1d099a[_0xbb10('0x21')](_0x14d9e7)[_0xbb10('0x23')](_0x19dfef);}}});};exports['getApplications']=function(_0x20347b,_0x22ffc6){var _0x530785={};var _0x49ef50={};var _0xeac82d;var _0x5a4de3;return db[_0xbb10('0x31')][_0xbb10('0x5c')]({'where':{'id':_0x20347b[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x22ffc6,null))['then'](function(_0x90ab9f){if(_0x90ab9f){_0xeac82d=_0x90ab9f;_0x49ef50['model']=_[_0xbb10('0x36')](db[_0xbb10('0x90')][_0xbb10('0x32')]);_0x49ef50[_0xbb10('0x37')]=_[_0xbb10('0x36')](_0x20347b[_0xbb10('0x37')]);_0x49ef50[_0xbb10('0x38')]=_[_0xbb10('0x4a')](_0x49ef50[_0xbb10('0x35')],_0x49ef50['query']);_0x530785[_0xbb10('0x39')]=_[_0xbb10('0x4a')](_0x49ef50[_0xbb10('0x35')],qs[_0xbb10('0x3a')](_0x20347b[_0xbb10('0x37')]['fields']));_0x530785[_0xbb10('0x39')]=_0x530785[_0xbb10('0x39')][_0xbb10('0x3b')]?_0x530785[_0xbb10('0x39')]:_0x49ef50[_0xbb10('0x35')];_0x530785['order']=qs['sort'](_0x20347b['query'][_0xbb10('0x3f')]);_0x530785['where']=qs['filters'](_[_0xbb10('0x40')](_0x20347b['query'],_0x49ef50[_0xbb10('0x38')]));if(_0x20347b[_0xbb10('0x37')]['filter']){_0x530785[_0xbb10('0x41')]=_[_0xbb10('0x42')](_0x530785[_0xbb10('0x41')],{'$or':_[_0xbb10('0x30')](_0x530785['attributes'],function(_0x4b08b2){var _0x57abfe={};_0x57abfe[_0x4b08b2]={'$like':'%'+_0x20347b[_0xbb10('0x37')][_0xbb10('0x44')]+'%'};return _0x57abfe;})});}_0x530785=_['merge']({},_0x530785,_0x20347b[_0xbb10('0x45')]);return _0xeac82d[_0xbb10('0x115')](_0x530785);}})[_0xbb10('0x15')](function(_0x33a92a){if(_0x33a92a){_0x5a4de3=_0x33a92a[_0xbb10('0x3b')];if(!_0x20347b['query'][_0xbb10('0x3c')](_0xbb10('0x3d'))){_0x530785[_0xbb10('0x27')]=qs['limit'](_0x20347b[_0xbb10('0x37')]['limit']);_0x530785[_0xbb10('0x24')]=qs[_0xbb10('0x24')](_0x20347b[_0xbb10('0x37')]['offset']);}return _0xeac82d[_0xbb10('0x115')](_0x530785);}})[_0xbb10('0x15')](function(_0x4ba58f){if(_0x4ba58f){return _0x4ba58f?{'count':_0x5a4de3,'rows':_0x4ba58f}:null;}})[_0xbb10('0x15')](respondWithResult(_0x22ffc6,null))[_0xbb10('0x1f')](handleError(_0x22ffc6,null));};exports[_0xbb10('0x116')]=function(_0x2e03eb,_0x24e7bc){return db['chatProactiveAction']['find']({'where':{'id':_0x2e03eb[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x24e7bc,null))[_0xbb10('0x15')](function(_0x1b0734){if(_0x1b0734){return _0x1b0734[_0xbb10('0x116')](_0x2e03eb['body'][_0xbb10('0x5e')],_[_0xbb10('0xeb')](_0x2e03eb[_0xbb10('0x4d')],[_0xbb10('0x5e'),'id'])||{});}})[_0xbb10('0x15')](respondWithResult(_0x24e7bc,null))['catch'](handleError(_0x24e7bc,null));};exports['getProactiveActions']=function(_0x2f675c,_0x18f6b1){var _0x1052f5={};var _0x119e8f={};var _0x5a031b;var _0x4c8e28;return db[_0xbb10('0x31')]['findOne']({'where':{'id':_0x2f675c['params']['id']}})['then'](handleEntityNotFound(_0x18f6b1,null))['then'](function(_0x3758dd){if(_0x3758dd){_0x5a031b=_0x3758dd;_0x119e8f[_0xbb10('0x35')]=_[_0xbb10('0x36')](db[_0xbb10('0x117')][_0xbb10('0x32')]);_0x119e8f['query']=_[_0xbb10('0x36')](_0x2f675c[_0xbb10('0x37')]);_0x119e8f[_0xbb10('0x38')]=_['intersection'](_0x119e8f[_0xbb10('0x35')],_0x119e8f[_0xbb10('0x37')]);_0x1052f5[_0xbb10('0x39')]=_[_0xbb10('0x4a')](_0x119e8f[_0xbb10('0x35')],qs[_0xbb10('0x3a')](_0x2f675c[_0xbb10('0x37')][_0xbb10('0x3a')]));_0x1052f5[_0xbb10('0x39')]=_0x1052f5[_0xbb10('0x39')][_0xbb10('0x3b')]?_0x1052f5[_0xbb10('0x39')]:_0x119e8f[_0xbb10('0x35')];_0x1052f5[_0xbb10('0x3e')]=qs[_0xbb10('0x3f')](_0x2f675c['query']['sort']);_0x1052f5['where']=qs[_0xbb10('0x38')](_['pick'](_0x2f675c[_0xbb10('0x37')],_0x119e8f['filters']));if(_0x2f675c[_0xbb10('0x37')]['filter']){_0x1052f5['where']=_[_0xbb10('0x42')](_0x1052f5[_0xbb10('0x41')],{'$or':_['map'](_0x1052f5[_0xbb10('0x39')],function(_0x131d48){var _0x338e7a={};_0x338e7a[_0x131d48]={'$like':'%'+_0x2f675c[_0xbb10('0x37')]['filter']+'%'};return _0x338e7a;})});}_0x1052f5=_['merge']({},_0x1052f5,_0x2f675c[_0xbb10('0x45')]);return _0x5a031b[_0xbb10('0x102')](_0x1052f5);}})[_0xbb10('0x15')](function(_0x53f3c2){if(_0x53f3c2){_0x4c8e28=_0x53f3c2[_0xbb10('0x3b')];if(!_0x2f675c[_0xbb10('0x37')][_0xbb10('0x3c')]('nolimit')){_0x1052f5[_0xbb10('0x27')]=qs['limit'](_0x2f675c['query'][_0xbb10('0x27')]);_0x1052f5['offset']=qs[_0xbb10('0x24')](_0x2f675c[_0xbb10('0x37')][_0xbb10('0x24')]);}return _0x5a031b[_0xbb10('0x102')](_0x1052f5);}})[_0xbb10('0x15')](function(_0x57a6bc){if(_0x57a6bc){return _0x57a6bc?{'count':_0x4c8e28,'rows':_0x57a6bc}:null;}})[_0xbb10('0x15')](respondWithResult(_0x18f6b1,null))[_0xbb10('0x1f')](handleError(_0x18f6b1,null));};exports[_0xbb10('0x118')]=function(_0x2701e8,_0x1b0086){var _0x1c387b=_0x2701e8['query']['online']===_0xbb10('0x119')?_0xbb10('0x11a'):_0xbb10('0x11b');return db[_0xbb10('0x31')][_0xbb10('0x56')]({'attributes':['id',_0x1c387b],'where':{'id':_0x2701e8['params']['id']}})['then'](handleEntityNotFound(_0x1b0086,null))[_0xbb10('0x15')](function(_0x23cbf4){if(_0x23cbf4){var _0x536519=_0x23cbf4[_0x1c387b];var _0x50dde9=_0x536519&&_0x536519[_0xbb10('0x11c')]?_0x536519[_0xbb10('0x11c')]:[];_0x1b0086[_0xbb10('0xbf')]({'fromKey':_[_0xbb10('0x71')](_0x536519[_0xbb10('0x11d')])?undefined:_0x536519[_0xbb10('0x11d')],'count':_0x50dde9['length'],'rows':_0x50dde9});}})[_0xbb10('0x1f')](handleError(_0x1b0086,null));};exports[_0xbb10('0x11e')]=function(_0x261c9b,_0x232794){var _0x35b3f8={'raw':![],'where':{}};var _0x3783d0={};var _0xdd7d5c={'count':0x0,'rows':[]};return db[_0xbb10('0x31')][_0xbb10('0x5c')]({'where':{'id':_0x261c9b['params']['id']}})['then'](handleEntityNotFound(_0x232794,null))['then'](function(_0x111c15){if(_0x111c15){_0x3783d0[_0xbb10('0x35')]=_[_0xbb10('0x36')](db[_0xbb10('0xc9')]['rawAttributes']);_0x3783d0['query']=_['keys'](_0x261c9b[_0xbb10('0x37')]);_0x3783d0[_0xbb10('0x38')]=_[_0xbb10('0x4a')](_0x3783d0[_0xbb10('0x35')],_0x3783d0[_0xbb10('0x37')]);_0x35b3f8[_0xbb10('0x39')]=_[_0xbb10('0x4a')](_0x3783d0[_0xbb10('0x35')],qs[_0xbb10('0x3a')](_0x261c9b[_0xbb10('0x37')][_0xbb10('0x3a')]));_0x35b3f8[_0xbb10('0x39')]=_0x35b3f8[_0xbb10('0x39')][_0xbb10('0x3b')]?_0x35b3f8['attributes']:_0x3783d0[_0xbb10('0x35')];if(!_0x261c9b[_0xbb10('0x37')][_0xbb10('0x3c')](_0xbb10('0x3d'))){_0x35b3f8[_0xbb10('0x27')]=qs[_0xbb10('0x27')](_0x261c9b['query'][_0xbb10('0x27')]);_0x35b3f8[_0xbb10('0x24')]=qs[_0xbb10('0x24')](_0x261c9b[_0xbb10('0x37')][_0xbb10('0x24')]);}_0x35b3f8[_0xbb10('0x3e')]=qs[_0xbb10('0x3f')](_0x261c9b[_0xbb10('0x37')][_0xbb10('0x3f')]);_0x35b3f8['where']=qs[_0xbb10('0x38')](_[_0xbb10('0x40')](_0x261c9b[_0xbb10('0x37')],_0x3783d0[_0xbb10('0x38')]));_0x35b3f8[_0xbb10('0x41')][_0xbb10('0x59')]=_0x111c15['id'];if(_0x261c9b[_0xbb10('0x37')][_0xbb10('0x44')]){_0x35b3f8[_0xbb10('0x41')]=_['merge'](_0x35b3f8[_0xbb10('0x41')],{'$or':_['map'](_0x35b3f8[_0xbb10('0x39')],function(_0x2cd1b0){var _0x57e0b2={};_0x57e0b2[_0x2cd1b0]={'$like':'%'+_0x261c9b['query'][_0xbb10('0x44')]+'%'};return _0x57e0b2;})});}_0x35b3f8=_[_0xbb10('0x42')]({},_0x35b3f8,_0x261c9b[_0xbb10('0x45')]);return db[_0xbb10('0xc9')][_0xbb10('0x26')]({'where':_0x35b3f8[_0xbb10('0x41')]})[_0xbb10('0x15')](function(_0x40a208){_0xdd7d5c[_0xbb10('0x26')]=_0x40a208;if(_0x261c9b[_0xbb10('0x37')][_0xbb10('0x46')]){_0x35b3f8[_0xbb10('0x4b')]=[{'all':!![]}];}else{_0x35b3f8[_0xbb10('0x4b')]=[{'model':db[_0xbb10('0x81')],'as':_0xbb10('0xec'),'required':![]},{'model':db['Attachment'],'as':_0xbb10('0x11f'),'required':![]}];}return db['ChatOfflineMessage'][_0xbb10('0x47')](_0x35b3f8);})[_0xbb10('0x15')](function(_0x234dc5){_0xdd7d5c[_0xbb10('0x48')]=_0x234dc5;return _0xdd7d5c;});}})[_0xbb10('0x15')](respondWithFilteredResult(_0x232794,_0x35b3f8))[_0xbb10('0x1f')](handleError(_0x232794,null));};exports[_0xbb10('0x120')]=function(_0x45dcaa,_0x5c88bd){return db['ChatWebsite']['find']({'where':{'id':_0x45dcaa[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x5c88bd,null))[_0xbb10('0x15')](function(_0x54c61c){if(_0x54c61c){return _0x54c61c[_0xbb10('0x120')](_0x45dcaa['body'][_0xbb10('0x5e')],_[_0xbb10('0xeb')](_0x45dcaa['body'],[_0xbb10('0x5e'),'id'])||{})[_0xbb10('0xac')](function(_0xa52322){for(var _0xc1691=0x0;_0xc1691<_0x45dcaa[_0xbb10('0x4d')]['ids'][_0xbb10('0x3b')];_0xc1691+=0x1){socket[_0xbb10('0x121')]('userChatWebsite:save',{'UserId':Number(_0x45dcaa[_0xbb10('0x4d')][_0xbb10('0x5e')][_0xc1691]),'ChatWebsiteId':Number(_0x45dcaa['params']['id'])});}return _0xa52322;});}})[_0xbb10('0x15')](respondWithResult(_0x5c88bd,null))[_0xbb10('0x1f')](handleError(_0x5c88bd,null));};exports[_0xbb10('0x122')]=function(_0x24f1d2,_0x481a0a){return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x24f1d2[_0xbb10('0x57')]['id']}})['then'](handleEntityNotFound(_0x481a0a,null))['then'](function(_0x284b77){if(_0x284b77){return _0x284b77[_0xbb10('0x122')](_0x24f1d2[_0xbb10('0x37')][_0xbb10('0x5e')])['then'](function(){if(_[_0xbb10('0x123')](_0x24f1d2[_0xbb10('0x37')][_0xbb10('0x5e')])){for(var _0x28c680=0x0;_0x28c680<_0x24f1d2[_0xbb10('0x37')]['ids']['length'];_0x28c680+=0x1){socket[_0xbb10('0x121')](_0xbb10('0x124'),{'UserId':Number(_0x24f1d2['query']['ids'][_0x28c680]),'ChatWebsiteId':Number(_0x24f1d2[_0xbb10('0x57')]['id'])});}}else{socket[_0xbb10('0x121')](_0xbb10('0x124'),{'UserId':Number(_0x24f1d2[_0xbb10('0x37')][_0xbb10('0x5e')]),'ChatWebsiteId':Number(_0x24f1d2[_0xbb10('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x481a0a,null))['catch'](handleError(_0x481a0a,null));};exports[_0xbb10('0x125')]=function(_0x1c3cbc,_0x24bda8){var _0x27ddfc={};var _0x39a047={};var _0x9a80a7;var _0x5e08c5;return db[_0xbb10('0x31')][_0xbb10('0x5c')]({'where':{'id':_0x1c3cbc[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x24bda8,null))['then'](function(_0x21ad98){if(_0x21ad98){_0x9a80a7=_0x21ad98;_0x39a047[_0xbb10('0x35')]=_[_0xbb10('0x36')](db[_0xbb10('0xb4')][_0xbb10('0x32')]);_0x39a047[_0xbb10('0x37')]=_[_0xbb10('0x36')](_0x1c3cbc[_0xbb10('0x37')]);_0x39a047[_0xbb10('0x38')]=_[_0xbb10('0x4a')](_0x39a047[_0xbb10('0x35')],_0x39a047[_0xbb10('0x37')]);_0x27ddfc['attributes']=_[_0xbb10('0x4a')](_0x39a047[_0xbb10('0x35')],qs['fields'](_0x1c3cbc[_0xbb10('0x37')][_0xbb10('0x3a')]));_0x27ddfc[_0xbb10('0x39')]=_0x27ddfc['attributes'][_0xbb10('0x3b')]?_0x27ddfc[_0xbb10('0x39')]:_0x39a047[_0xbb10('0x35')];_0x27ddfc[_0xbb10('0x3e')]=qs[_0xbb10('0x3f')](_0x1c3cbc[_0xbb10('0x37')]['sort']);_0x27ddfc[_0xbb10('0x41')]=qs['filters'](_[_0xbb10('0x40')](_0x1c3cbc[_0xbb10('0x37')],_0x39a047[_0xbb10('0x38')]));if(_0x1c3cbc[_0xbb10('0x37')]['filter']){_0x27ddfc[_0xbb10('0x41')]=_[_0xbb10('0x42')](_0x27ddfc['where'],{'$or':_[_0xbb10('0x30')](_0x27ddfc['attributes'],function(_0x31c086){var _0x40845c={};_0x40845c[_0x31c086]={'$like':'%'+_0x1c3cbc[_0xbb10('0x37')][_0xbb10('0x44')]+'%'};return _0x40845c;})});}_0x27ddfc=_[_0xbb10('0x42')]({},_0x27ddfc,_0x1c3cbc[_0xbb10('0x45')]);return _0x9a80a7[_0xbb10('0x125')](_0x27ddfc);}})[_0xbb10('0x15')](function(_0x55ee36){if(_0x55ee36){_0x5e08c5=_0x55ee36['length'];if(!_0x1c3cbc[_0xbb10('0x37')][_0xbb10('0x3c')](_0xbb10('0x3d'))){_0x27ddfc[_0xbb10('0x27')]=qs[_0xbb10('0x27')](_0x1c3cbc[_0xbb10('0x37')][_0xbb10('0x27')]);_0x27ddfc[_0xbb10('0x24')]=qs[_0xbb10('0x24')](_0x1c3cbc['query'][_0xbb10('0x24')]);}return _0x9a80a7['getAgents'](_0x27ddfc);}})[_0xbb10('0x15')](function(_0x2a618a){if(_0x2a618a){return _0x2a618a?{'count':_0x5e08c5,'rows':_0x2a618a}:null;}})['then'](respondWithResult(_0x24bda8,null))[_0xbb10('0x1f')](handleError(_0x24bda8,null));}; \ No newline at end of file +var _0xb7e7=['../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','http','client','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','get','ChatWebsites','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filters','filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','params','rawAttributes','options','find','create','user','UserProfileSection','userProfileId','autoAssociation','body','describe','Disposition','getDispositions','length','order','ChatWebsiteId','include','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addLogo','sitepic','filename','addAvatar','agentAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','getCustomerAvatar','showCustomerAvatar','server/files/images/avatars/','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','ChatApplication','Applications','list','applications','orderBy','priority','asc','account','Contacts','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','vendor','%s\x20%s\x20%s','device','threadId','externalUrl','ChatInteraction','ContactId','interaction','firstName','messageId','autoclose','push','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','agent','Start','startRouting','EventManager','files','CompanyId','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','render','toPairs','offlineMessageBody','fromString','originalname','mimetype','attachments','basename','openNewInteraction','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','server','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Contact','Owner','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','inspect','Interval','Intervals','getProactiveActions','virtual','License','chatLicenseExceeded','all','server/files/chat/iframe.ejs','remote','x-real-ip','connection','replace','alignment','verticalAlignment','labelText','textColor','color_button','backgroundColor','sequelize','Transaction','ISOLATION_LEVELS','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','omit','getFields','online','onlineForm','items','fromKey','ChatOfflineMessage','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','util','ejs','lodash','ioredis','../../components/parsers/qs','../../config/logger'];(function(_0x544215,_0x51eb67){var _0x1cd9fc=function(_0xf8c4a){while(--_0xf8c4a){_0x544215['push'](_0x544215['shift']());}};_0x1cd9fc(++_0x51eb67);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xb7e7[_0x3e5086];return _0xfeb102;};'use strict';var BPromise=require(_0x7b7e('0x0'));var Mustache=require('mustache');var util=require(_0x7b7e('0x1'));var path=require('path');var ejs=require(_0x7b7e('0x2'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7b7e('0x3'));var querystring=require('querystring');var Redis=require(_0x7b7e('0x4'));var qs=require(_0x7b7e('0x5'));var logger=require(_0x7b7e('0x6'))('api');var config=require('../../config/environment');var db=require(_0x7b7e('0x7'))['db'];config[_0x7b7e('0x8')]=_[_0x7b7e('0x9')](config['redis'],{'host':_0x7b7e('0xa'),'port':0x18eb});var socket=require(_0x7b7e('0xb'))(new Redis(config[_0x7b7e('0x8')]));require(_0x7b7e('0xc'))[_0x7b7e('0xd')](socket);var htmlToText=require(_0x7b7e('0xe'));var jayson=require(_0x7b7e('0xf'));var client=jayson['client'][_0x7b7e('0x10')]({'port':0x232c});var client9002=jayson[_0x7b7e('0x11')][_0x7b7e('0x10')]({'port':0x232a});var client9003=jayson[_0x7b7e('0x11')][_0x7b7e('0x10')]({'port':0x232b});var client9001=jayson[_0x7b7e('0x11')][_0x7b7e('0x10')]({'port':0x2329});function respondWithRpcPromise(_0x55620b,_0xaadda,_0x54d8ce,_0x267446){return new BPromise(function(_0x430eab,_0x50d7d2){var _0x422d3a=_0x267446||client;return _0x422d3a['request'](_0x55620b,_0x54d8ce)['then'](function(_0x2889ed){logger[_0x7b7e('0x12')](_0x7b7e('0x13'),_0xaadda,_0x7b7e('0x14'));logger[_0x7b7e('0x15')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0xaadda,'request\x20sent',JSON[_0x7b7e('0x16')](_0x2889ed));if(_0x2889ed[_0x7b7e('0x17')]){if(_0x2889ed[_0x7b7e('0x17')][_0x7b7e('0x18')]===0x1f4){logger[_0x7b7e('0x17')](_0x7b7e('0x13'),_0xaadda,_0x2889ed[_0x7b7e('0x17')][_0x7b7e('0x19')]);return _0x50d7d2(_0x2889ed[_0x7b7e('0x17')][_0x7b7e('0x19')]);}logger[_0x7b7e('0x17')](_0x7b7e('0x13'),_0xaadda,_0x2889ed[_0x7b7e('0x17')][_0x7b7e('0x19')]);return _0x430eab(_0x2889ed[_0x7b7e('0x17')][_0x7b7e('0x19')]);}else{logger[_0x7b7e('0x12')]('ChatWebsite,\x20%s,\x20%s',_0xaadda,_0x7b7e('0x14'));_0x430eab(_0x2889ed[_0x7b7e('0x1a')][_0x7b7e('0x19')]);}})['catch'](function(_0x313122){logger[_0x7b7e('0x17')](_0x7b7e('0x13'),_0xaadda,_0x313122);_0x50d7d2(_0x313122);});});}function respondWithStatusCode(_0x200156,_0x2b7211){_0x2b7211=_0x2b7211||0xcc;return function(_0x303d8c){if(_0x303d8c){return _0x200156[_0x7b7e('0x1b')](_0x2b7211);}return _0x200156[_0x7b7e('0x1c')](_0x2b7211)['end']();};}function respondWithResult(_0x5d6215,_0x4a836a){_0x4a836a=_0x4a836a||0xc8;return function(_0x26ee14){if(_0x26ee14){return _0x5d6215[_0x7b7e('0x1c')](_0x4a836a)[_0x7b7e('0x1d')](_0x26ee14);}};}function respondWithFilteredResult(_0x483c6f,_0x51d3b1){return function(_0x5dadbb){if(_0x5dadbb){var _0x182245=typeof _0x51d3b1[_0x7b7e('0x1e')]===_0x7b7e('0x1f')&&typeof _0x51d3b1[_0x7b7e('0x20')]===_0x7b7e('0x1f');var _0x48fad1=_0x5dadbb[_0x7b7e('0x21')];var _0x21a15=_0x182245?0x0:_0x51d3b1['offset'];var _0x57b9da=_0x182245?_0x5dadbb['count']:_0x51d3b1[_0x7b7e('0x1e')]+_0x51d3b1[_0x7b7e('0x20')];var _0x503625;if(_0x57b9da>=_0x48fad1){_0x57b9da=_0x48fad1;_0x503625=0xc8;}else{_0x503625=0xce;}_0x483c6f[_0x7b7e('0x1c')](_0x503625);return _0x483c6f['set'](_0x7b7e('0x22'),_0x21a15+'-'+_0x57b9da+'/'+_0x48fad1)[_0x7b7e('0x1d')](_0x5dadbb);}return null;};}function saveUpdates(_0x27b525){return function(_0x5515ca){if(_0x5515ca){return _0x5515ca[_0x7b7e('0x23')](_0x27b525)[_0x7b7e('0x24')](function(_0x35602a){return _0x35602a;});}return null;};}function removeEntity(_0x326dd2){return function(_0x33f9a1){if(_0x33f9a1){return _0x33f9a1['destroy']()[_0x7b7e('0x24')](function(){var _0x51c010=_0x33f9a1[_0x7b7e('0x25')]({'plain':!![]});var _0x1c7de4=_0x7b7e('0x26');return db[_0x7b7e('0x27')][_0x7b7e('0x28')]({'where':{'type':_0x1c7de4,'resourceId':_0x51c010['id']}})[_0x7b7e('0x24')](function(){return _0x33f9a1;});})[_0x7b7e('0x24')](function(){_0x326dd2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xebcdbc){return function(_0x162b84){if(!_0x162b84){_0xebcdbc['sendStatus'](0x194);}return _0x162b84;};}function handleError(_0x3a3bc7,_0x2a4754){_0x2a4754=_0x2a4754||0x1f4;return function(_0x2ca366){logger['error'](_0x2ca366[_0x7b7e('0x29')]);if(_0x2ca366[_0x7b7e('0x2a')]){delete _0x2ca366[_0x7b7e('0x2a')];}_0x3a3bc7[_0x7b7e('0x1c')](_0x2a4754)[_0x7b7e('0x2b')](_0x2ca366);};}exports[_0x7b7e('0x2c')]=function(_0x3e8cf4,_0x202f04){var _0x44497c={'include':[{'model':db[_0x7b7e('0x2d')],'as':_0x7b7e('0x2e')}]},_0x39b3bb={},_0xd5a64d={'count':0x0,'rows':[]};var _0xdcb8ef=_[_0x7b7e('0x2f')](db[_0x7b7e('0x30')]['rawAttributes'],function(_0x8c80d5){return{'name':_0x8c80d5[_0x7b7e('0x31')],'type':_0x8c80d5[_0x7b7e('0x32')][_0x7b7e('0x33')]};});_0x39b3bb[_0x7b7e('0x34')]=_[_0x7b7e('0x2f')](_0xdcb8ef,_0x7b7e('0x2a'));_0x39b3bb[_0x7b7e('0x35')]=_[_0x7b7e('0x36')](_0x3e8cf4[_0x7b7e('0x35')]);_0x39b3bb['filters']=_[_0x7b7e('0x37')](_0x39b3bb[_0x7b7e('0x34')],_0x39b3bb[_0x7b7e('0x35')]);_0x44497c[_0x7b7e('0x38')]=_['intersection'](_0x39b3bb[_0x7b7e('0x34')],qs[_0x7b7e('0x39')](_0x3e8cf4[_0x7b7e('0x35')]['fields']));_0x44497c['attributes']=_0x44497c[_0x7b7e('0x38')]['length']?_0x44497c[_0x7b7e('0x38')]:_0x39b3bb[_0x7b7e('0x34')];if(!_0x3e8cf4['query'][_0x7b7e('0x3a')](_0x7b7e('0x3b'))){_0x44497c[_0x7b7e('0x20')]=qs[_0x7b7e('0x20')](_0x3e8cf4[_0x7b7e('0x35')][_0x7b7e('0x20')]);_0x44497c[_0x7b7e('0x1e')]=qs[_0x7b7e('0x1e')](_0x3e8cf4[_0x7b7e('0x35')]['offset']);}_0x44497c['order']=qs[_0x7b7e('0x3c')](_0x3e8cf4['query'][_0x7b7e('0x3c')]);_0x44497c['where']=qs['filters'](_[_0x7b7e('0x3d')](_0x3e8cf4['query'],_0x39b3bb[_0x7b7e('0x3e')]),_0xdcb8ef);if(_0x3e8cf4['query'][_0x7b7e('0x3f')]){_0x44497c[_0x7b7e('0x40')]=_[_0x7b7e('0x41')](_0x44497c[_0x7b7e('0x40')],{'$or':_['map'](_0xdcb8ef,function(_0x1e4505){if(_0x1e4505[_0x7b7e('0x32')]!==_0x7b7e('0x42')){var _0x37895a={};_0x37895a[_0x1e4505[_0x7b7e('0x2a')]]={'$like':'%'+_0x3e8cf4[_0x7b7e('0x35')]['filter']+'%'};return _0x37895a;}})});}_0x44497c=_['merge']({},_0x44497c,_0x3e8cf4['options']);var _0xc5280c={'where':_0x44497c[_0x7b7e('0x40')]};return db[_0x7b7e('0x30')][_0x7b7e('0x21')](_0xc5280c)[_0x7b7e('0x24')](function(_0x2d47c6){_0xd5a64d['count']=_0x2d47c6;if(_0x3e8cf4[_0x7b7e('0x35')][_0x7b7e('0x43')]){_0x44497c['include']=[{'all':!![]}];}return db['ChatWebsite'][_0x7b7e('0x44')](_0x44497c);})[_0x7b7e('0x24')](function(_0x249a6d){_0xd5a64d[_0x7b7e('0x45')]=_0x249a6d;return _0xd5a64d;})[_0x7b7e('0x24')](respondWithFilteredResult(_0x202f04,_0x44497c))[_0x7b7e('0x46')](handleError(_0x202f04,null));};exports['show']=function(_0x2673eb,_0x4cc7db){var _0x402793={'raw':![],'where':{'id':_0x2673eb[_0x7b7e('0x47')]['id']},'include':[{'model':db[_0x7b7e('0x2d')],'as':'mandatoryDispositionPause'}]},_0x1dad4c={};_0x1dad4c[_0x7b7e('0x34')]=_[_0x7b7e('0x36')](db[_0x7b7e('0x30')][_0x7b7e('0x48')]);_0x1dad4c[_0x7b7e('0x35')]=_['keys'](_0x2673eb[_0x7b7e('0x35')]);_0x1dad4c[_0x7b7e('0x3e')]=_[_0x7b7e('0x37')](_0x1dad4c[_0x7b7e('0x34')],_0x1dad4c[_0x7b7e('0x35')]);_0x402793['attributes']=_[_0x7b7e('0x37')](_0x1dad4c[_0x7b7e('0x34')],qs[_0x7b7e('0x39')](_0x2673eb[_0x7b7e('0x35')][_0x7b7e('0x39')]));_0x402793[_0x7b7e('0x38')]=_0x402793[_0x7b7e('0x38')]['length']?_0x402793[_0x7b7e('0x38')]:_0x1dad4c['model'];if(_0x2673eb[_0x7b7e('0x35')][_0x7b7e('0x43')]){_0x402793['include']=[{'all':!![]}];}_0x402793=_[_0x7b7e('0x41')]({},_0x402793,_0x2673eb[_0x7b7e('0x49')]);return db[_0x7b7e('0x30')][_0x7b7e('0x4a')](_0x402793)[_0x7b7e('0x24')](handleEntityNotFound(_0x4cc7db,null))[_0x7b7e('0x24')](respondWithResult(_0x4cc7db,null))[_0x7b7e('0x46')](handleError(_0x4cc7db,null));};exports['create']=function(_0xbf044d,_0x3ff731){return db[_0x7b7e('0x30')][_0x7b7e('0x4b')](_0xbf044d['body'],{})['then'](function(_0x5bdf1d){var _0x2471ad=_0xbf044d[_0x7b7e('0x4c')][_0x7b7e('0x25')]({'plain':!![]});if(!_0x2471ad)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2471ad['role']===_0x7b7e('0x4c')){var _0x39efb5=_0x5bdf1d['get']({'plain':!![]});var _0xf54f87=_0x7b7e('0x26');return db[_0x7b7e('0x4d')]['find']({'where':{'name':_0xf54f87,'userProfileId':_0x2471ad[_0x7b7e('0x4e')]},'raw':!![]})[_0x7b7e('0x24')](function(_0x4d9a71){if(_0x4d9a71&&_0x4d9a71[_0x7b7e('0x4f')]===0x0){return db[_0x7b7e('0x27')][_0x7b7e('0x4b')]({'name':_0x39efb5[_0x7b7e('0x2a')],'resourceId':_0x39efb5['id'],'type':_0x4d9a71[_0x7b7e('0x2a')],'sectionId':_0x4d9a71['id']},{})[_0x7b7e('0x24')](function(){return _0x5bdf1d;});}else{return _0x5bdf1d;}})[_0x7b7e('0x46')](function(_0x2d1908){logger[_0x7b7e('0x17')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2d1908);throw _0x2d1908;});}return _0x5bdf1d;})[_0x7b7e('0x24')](respondWithResult(_0x3ff731,0xc9))[_0x7b7e('0x46')](handleError(_0x3ff731,null));};exports['update']=function(_0xc2b1b6,_0xa22edc){if(_0xc2b1b6[_0x7b7e('0x50')]['id']){delete _0xc2b1b6['body']['id'];}return db[_0x7b7e('0x30')]['find']({'where':{'id':_0xc2b1b6[_0x7b7e('0x47')]['id']},'include':[{'model':db[_0x7b7e('0x2d')],'as':'mandatoryDispositionPause'}]})[_0x7b7e('0x24')](handleEntityNotFound(_0xa22edc,null))[_0x7b7e('0x24')](saveUpdates(_0xc2b1b6['body'],null))[_0x7b7e('0x24')](respondWithResult(_0xa22edc,null))[_0x7b7e('0x46')](handleError(_0xa22edc,null));};exports[_0x7b7e('0x28')]=function(_0x3b1adb,_0x5eb32c){return db[_0x7b7e('0x30')][_0x7b7e('0x4a')]({'where':{'id':_0x3b1adb[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x5eb32c,null))[_0x7b7e('0x24')](removeEntity(_0x5eb32c,null))[_0x7b7e('0x46')](handleError(_0x5eb32c,null));};exports[_0x7b7e('0x51')]=function(_0x709e87,_0x3665ca){return db[_0x7b7e('0x30')]['describe']()[_0x7b7e('0x24')](respondWithResult(_0x3665ca,null))['catch'](handleError(_0x3665ca,null));};exports['addDisposition']=function(_0x2b105a,_0x7cbe6c){if(_0x2b105a[_0x7b7e('0x50')]['id']){delete _0x2b105a[_0x7b7e('0x50')]['id'];}return db['ChatWebsite'][_0x7b7e('0x4a')]({'where':{'id':_0x2b105a[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x7cbe6c,null))[_0x7b7e('0x24')](function(_0x169540){if(_0x169540){_0x2b105a[_0x7b7e('0x50')]['ChatWebsiteId']=_0x169540['id'];return db[_0x7b7e('0x52')]['create'](_0x2b105a['body']);}})[_0x7b7e('0x24')](respondWithResult(_0x7cbe6c,null))['catch'](handleError(_0x7cbe6c,null));};exports[_0x7b7e('0x53')]=function(_0x4a2378,_0x3c3d29){var _0x148dde={'raw':![],'where':{}};var _0x4c46e0={};var _0x2c167d={'count':0x0,'rows':[]};return db[_0x7b7e('0x30')]['findOne']({'where':{'id':_0x4a2378[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x3c3d29,null))[_0x7b7e('0x24')](function(_0x430033){if(_0x430033){_0x4c46e0[_0x7b7e('0x34')]=_[_0x7b7e('0x36')](db[_0x7b7e('0x52')][_0x7b7e('0x48')]);_0x4c46e0[_0x7b7e('0x35')]=_[_0x7b7e('0x36')](_0x4a2378['query']);_0x4c46e0['filters']=_[_0x7b7e('0x37')](_0x4c46e0[_0x7b7e('0x34')],_0x4c46e0[_0x7b7e('0x35')]);_0x148dde[_0x7b7e('0x38')]=_[_0x7b7e('0x37')](_0x4c46e0[_0x7b7e('0x34')],qs[_0x7b7e('0x39')](_0x4a2378['query'][_0x7b7e('0x39')]));_0x148dde[_0x7b7e('0x38')]=_0x148dde['attributes'][_0x7b7e('0x54')]?_0x148dde[_0x7b7e('0x38')]:_0x4c46e0[_0x7b7e('0x34')];if(!_0x4a2378[_0x7b7e('0x35')][_0x7b7e('0x3a')](_0x7b7e('0x3b'))){_0x148dde[_0x7b7e('0x20')]=qs[_0x7b7e('0x20')](_0x4a2378[_0x7b7e('0x35')][_0x7b7e('0x20')]);_0x148dde[_0x7b7e('0x1e')]=qs['offset'](_0x4a2378[_0x7b7e('0x35')][_0x7b7e('0x1e')]);}_0x148dde[_0x7b7e('0x55')]=qs[_0x7b7e('0x3c')](_0x4a2378[_0x7b7e('0x35')][_0x7b7e('0x3c')]);_0x148dde[_0x7b7e('0x40')]=qs['filters'](_[_0x7b7e('0x3d')](_0x4a2378[_0x7b7e('0x35')],_0x4c46e0[_0x7b7e('0x3e')]));_0x148dde['where'][_0x7b7e('0x56')]=_0x430033['id'];if(_0x4a2378[_0x7b7e('0x35')][_0x7b7e('0x3f')]){_0x148dde[_0x7b7e('0x40')]=_[_0x7b7e('0x41')](_0x148dde['where'],{'$or':_['map'](_0x148dde['attributes'],function(_0x397923){var _0x8b339c={};_0x8b339c[_0x397923]={'$like':'%'+_0x4a2378[_0x7b7e('0x35')]['filter']+'%'};return _0x8b339c;})});}_0x148dde=_[_0x7b7e('0x41')]({},_0x148dde,_0x4a2378[_0x7b7e('0x49')]);return db[_0x7b7e('0x52')]['count']({'where':_0x148dde[_0x7b7e('0x40')]})[_0x7b7e('0x24')](function(_0x111c99){_0x2c167d[_0x7b7e('0x21')]=_0x111c99;if(_0x4a2378['query'][_0x7b7e('0x43')]){_0x148dde[_0x7b7e('0x57')]=[{'all':!![]}];}return db[_0x7b7e('0x52')][_0x7b7e('0x44')](_0x148dde);})['then'](function(_0x4ec41e){_0x2c167d[_0x7b7e('0x45')]=_0x4ec41e;return _0x2c167d;});}})['then'](respondWithFilteredResult(_0x3c3d29,_0x148dde))[_0x7b7e('0x46')](handleError(_0x3c3d29,null));};exports[_0x7b7e('0x58')]=function(_0x4e2b05,_0x30b703){return db['ChatWebsite'][_0x7b7e('0x4a')]({'where':{'id':_0x4e2b05[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x30b703,null))[_0x7b7e('0x24')](function(_0x374312){if(_0x374312){return _0x374312[_0x7b7e('0x58')](_0x4e2b05[_0x7b7e('0x35')][_0x7b7e('0x59')]);}})[_0x7b7e('0x24')](respondWithStatusCode(_0x30b703,null))[_0x7b7e('0x46')](handleError(_0x30b703,null));};exports[_0x7b7e('0x5a')]=function(_0x31a353,_0xbdc4b9){if(_0x31a353[_0x7b7e('0x50')]['id']){delete _0x31a353[_0x7b7e('0x50')]['id'];}return db[_0x7b7e('0x30')]['find']({'where':{'id':_0x31a353[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0xbdc4b9,null))[_0x7b7e('0x24')](function(_0xa03d7a){if(_0xa03d7a){_0x31a353[_0x7b7e('0x50')][_0x7b7e('0x56')]=_0xa03d7a['id'];return db[_0x7b7e('0x5b')]['create'](_0x31a353[_0x7b7e('0x50')]);}})[_0x7b7e('0x24')](respondWithResult(_0xbdc4b9,null))[_0x7b7e('0x46')](handleError(_0xbdc4b9,null));};exports[_0x7b7e('0x5c')]=function(_0x920e05,_0x4b4f55){var _0x51d41f={'raw':![],'where':{}};var _0xb294bd={};var _0x110f2b={'count':0x0,'rows':[]};return db[_0x7b7e('0x30')][_0x7b7e('0x5d')]({'where':{'id':_0x920e05[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x4b4f55,null))[_0x7b7e('0x24')](function(_0x27d180){if(_0x27d180){_0xb294bd[_0x7b7e('0x34')]=_[_0x7b7e('0x36')](db['CannedAnswer'][_0x7b7e('0x48')]);_0xb294bd[_0x7b7e('0x35')]=_[_0x7b7e('0x36')](_0x920e05[_0x7b7e('0x35')]);_0xb294bd[_0x7b7e('0x3e')]=_[_0x7b7e('0x37')](_0xb294bd[_0x7b7e('0x34')],_0xb294bd['query']);_0x51d41f[_0x7b7e('0x38')]=_['intersection'](_0xb294bd[_0x7b7e('0x34')],qs[_0x7b7e('0x39')](_0x920e05['query'][_0x7b7e('0x39')]));_0x51d41f[_0x7b7e('0x38')]=_0x51d41f[_0x7b7e('0x38')][_0x7b7e('0x54')]?_0x51d41f[_0x7b7e('0x38')]:_0xb294bd['model'];if(!_0x920e05[_0x7b7e('0x35')]['hasOwnProperty']('nolimit')){_0x51d41f[_0x7b7e('0x20')]=qs[_0x7b7e('0x20')](_0x920e05[_0x7b7e('0x35')][_0x7b7e('0x20')]);_0x51d41f['offset']=qs[_0x7b7e('0x1e')](_0x920e05['query'][_0x7b7e('0x1e')]);}_0x51d41f[_0x7b7e('0x55')]=qs[_0x7b7e('0x3c')](_0x920e05[_0x7b7e('0x35')][_0x7b7e('0x3c')]);_0x51d41f[_0x7b7e('0x40')]=qs[_0x7b7e('0x3e')](_['pick'](_0x920e05[_0x7b7e('0x35')],_0xb294bd[_0x7b7e('0x3e')]));_0x51d41f['where'][_0x7b7e('0x56')]=_0x27d180['id'];if(_0x920e05[_0x7b7e('0x35')][_0x7b7e('0x3f')]){_0x51d41f[_0x7b7e('0x40')]=_[_0x7b7e('0x41')](_0x51d41f[_0x7b7e('0x40')],{'$or':_[_0x7b7e('0x2f')](_0x51d41f[_0x7b7e('0x38')],function(_0x41e2b5){var _0x97232d={};_0x97232d[_0x41e2b5]={'$like':'%'+_0x920e05[_0x7b7e('0x35')][_0x7b7e('0x3f')]+'%'};return _0x97232d;})});}_0x51d41f=_[_0x7b7e('0x41')]({},_0x51d41f,_0x920e05[_0x7b7e('0x49')]);return db[_0x7b7e('0x5b')][_0x7b7e('0x21')]({'where':_0x51d41f[_0x7b7e('0x40')]})[_0x7b7e('0x24')](function(_0x45a690){_0x110f2b[_0x7b7e('0x21')]=_0x45a690;if(_0x920e05[_0x7b7e('0x35')][_0x7b7e('0x43')]){_0x51d41f['include']=[{'all':!![]}];}return db[_0x7b7e('0x5b')][_0x7b7e('0x44')](_0x51d41f);})['then'](function(_0x36fae4){_0x110f2b['rows']=_0x36fae4;return _0x110f2b;});}})['then'](respondWithFilteredResult(_0x4b4f55,_0x51d41f))[_0x7b7e('0x46')](handleError(_0x4b4f55,null));};exports['removeAnswers']=function(_0x4d91c6,_0x8925c6){return db[_0x7b7e('0x30')][_0x7b7e('0x4a')]({'where':{'id':_0x4d91c6['params']['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x8925c6,null))[_0x7b7e('0x24')](function(_0x2a6fdd){if(_0x2a6fdd){return _0x2a6fdd[_0x7b7e('0x5e')](_0x4d91c6[_0x7b7e('0x35')][_0x7b7e('0x59')]);}})[_0x7b7e('0x24')](respondWithStatusCode(_0x8925c6,null))[_0x7b7e('0x46')](handleError(_0x8925c6,null));};exports[_0x7b7e('0x5f')]=function(_0x47fb99,_0x2a31f8){_0x47fb99[_0x7b7e('0x50')][_0x7b7e('0x60')]=_0x47fb99['file'][_0x7b7e('0x61')];return db[_0x7b7e('0x30')]['find']({'where':{'id':_0x47fb99[_0x7b7e('0x47')]['id']}})['then'](handleEntityNotFound(_0x2a31f8,null))['then'](saveUpdates(_0x47fb99[_0x7b7e('0x50')],null))[_0x7b7e('0x24')](respondWithResult(_0x2a31f8,null))['catch'](handleError(_0x2a31f8,null));};exports[_0x7b7e('0x62')]=function(_0x5ab8a7,_0x4c7158){_0x5ab8a7[_0x7b7e('0x50')][_0x7b7e('0x63')]=_0x5ab8a7[_0x7b7e('0x64')][_0x7b7e('0x61')];return db[_0x7b7e('0x30')][_0x7b7e('0x4a')]({'where':{'id':_0x5ab8a7[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x4c7158,null))['then'](saveUpdates(_0x5ab8a7[_0x7b7e('0x50')],null))[_0x7b7e('0x24')](respondWithResult(_0x4c7158,null))[_0x7b7e('0x46')](handleError(_0x4c7158,null));};exports[_0x7b7e('0x65')]=function(_0x1ae419,_0x13c910){_0x1ae419[_0x7b7e('0x50')][_0x7b7e('0x66')]=_0x1ae419[_0x7b7e('0x64')][_0x7b7e('0x61')];return db[_0x7b7e('0x30')][_0x7b7e('0x4a')]({'where':{'id':_0x1ae419['params']['id']}})['then'](handleEntityNotFound(_0x13c910,null))[_0x7b7e('0x24')](saveUpdates(_0x1ae419[_0x7b7e('0x50')],null))[_0x7b7e('0x24')](respondWithResult(_0x13c910,null))[_0x7b7e('0x46')](handleError(_0x13c910,null));};exports[_0x7b7e('0x67')]=function(_0x420199,_0x2d885c){_0x420199[_0x7b7e('0x50')][_0x7b7e('0x68')]=_0x420199[_0x7b7e('0x64')][_0x7b7e('0x61')];return db[_0x7b7e('0x30')]['find']({'where':{'id':_0x420199[_0x7b7e('0x47')]['id']}})['then'](handleEntityNotFound(_0x2d885c,null))[_0x7b7e('0x24')](saveUpdates(_0x420199[_0x7b7e('0x50')],null))[_0x7b7e('0x24')](respondWithResult(_0x2d885c,null))['catch'](handleError(_0x2d885c,null));};exports['getLogo']=function(_0x4e7889,_0x110ad6){var _0x88ad=path[_0x7b7e('0x69')](config[_0x7b7e('0x6a')],_0x7b7e('0x6b'));var _0x42531c={'where':{'id':_0x4e7889[_0x7b7e('0x47')]['id']},'attributes':['id',_0x7b7e('0x60')],'raw':!![]};var _0x18846e=![];return require(_0x7b7e('0x6c'))[_0x7b7e('0x6d')]()['then'](function(_0x229527){if(_0x229527){_0x18846e=_0x229527[_0x7b7e('0x6e')];}})[_0x7b7e('0x24')](function(){return db[_0x7b7e('0x30')]['find'](_0x42531c);})[_0x7b7e('0x24')](handleEntityNotFound(_0x110ad6,null))[_0x7b7e('0x24')](function(_0x46f43a){if(_0x46f43a){if(!_[_0x7b7e('0x6f')](_0x46f43a[_0x7b7e('0x60')])){if(fs[_0x7b7e('0x70')](path[_0x7b7e('0x69')](config[_0x7b7e('0x6a')],_0x7b7e('0x71'),_0x46f43a[_0x7b7e('0x60')]))&&_0x18846e){_0x88ad=path[_0x7b7e('0x69')](config[_0x7b7e('0x6a')],_0x7b7e('0x71'),_0x46f43a[_0x7b7e('0x60')]);}}return _0x110ad6[_0x7b7e('0x72')](_0x88ad);}})[_0x7b7e('0x46')](handleError(_0x110ad6,null));};exports[_0x7b7e('0x73')]=function(_0x451862,_0x1ba63b){var _0x42def4=path[_0x7b7e('0x69')](config[_0x7b7e('0x6a')],_0x7b7e('0x74'));var _0x28a696={'where':{'id':_0x451862[_0x7b7e('0x47')]['id']},'attributes':['id',_0x7b7e('0x63')],'raw':!![]};return db[_0x7b7e('0x30')][_0x7b7e('0x4a')](_0x28a696)['then'](handleEntityNotFound(_0x1ba63b,null))[_0x7b7e('0x24')](function(_0x4ebfa7){if(_0x4ebfa7){if(!_['isNil'](_0x4ebfa7['agentAvatar'])){if(fs[_0x7b7e('0x70')](path[_0x7b7e('0x69')](config['root'],'server/files/images/avatars/',_0x4ebfa7[_0x7b7e('0x63')]))){_0x42def4=path[_0x7b7e('0x69')](config[_0x7b7e('0x6a')],'server/files/images/avatars/',_0x4ebfa7[_0x7b7e('0x63')]);}}return _0x1ba63b['download'](_0x42def4);}})['catch'](handleError(_0x1ba63b,null));};exports[_0x7b7e('0x75')]=function(_0x596ec1,_0x4deac2){var _0xc55b86=path[_0x7b7e('0x69')](config[_0x7b7e('0x6a')],'server/files/images/avatars/customer_avatar.png');var _0x59e5f1={'where':{'id':_0x596ec1[_0x7b7e('0x47')]['id']},'attributes':['id',_0x7b7e('0x66'),_0x7b7e('0x76')],'raw':!![]};return db[_0x7b7e('0x30')][_0x7b7e('0x4a')](_0x59e5f1)[_0x7b7e('0x24')](handleEntityNotFound(_0x4deac2,null))[_0x7b7e('0x24')](function(_0x1b4600){if(_0x1b4600){if(!_[_0x7b7e('0x6f')](_0x1b4600['customerAvatar'])){if(fs[_0x7b7e('0x70')](path['join'](config[_0x7b7e('0x6a')],_0x7b7e('0x77'),_0x1b4600[_0x7b7e('0x66')]))&&_0x1b4600[_0x7b7e('0x76')]){_0xc55b86=path[_0x7b7e('0x69')](config['root'],_0x7b7e('0x77'),_0x1b4600[_0x7b7e('0x66')]);}}return _0x4deac2[_0x7b7e('0x72')](_0xc55b86);}})[_0x7b7e('0x46')](handleError(_0x4deac2,null));};exports['getSystemAvatar']=function(_0x137ba6,_0x1d7938){var _0x5e067f=path[_0x7b7e('0x69')](config[_0x7b7e('0x6a')],_0x7b7e('0x78'));var _0x218861={'where':{'id':_0x137ba6[_0x7b7e('0x47')]['id']},'attributes':['id',_0x7b7e('0x68')],'raw':!![]};return db[_0x7b7e('0x30')][_0x7b7e('0x4a')](_0x218861)[_0x7b7e('0x24')](handleEntityNotFound(_0x1d7938,null))[_0x7b7e('0x24')](function(_0x23e2ad){if(_0x23e2ad){if(!_['isNil'](_0x23e2ad[_0x7b7e('0x68')])){if(fs[_0x7b7e('0x70')](path['join'](config[_0x7b7e('0x6a')],'server/files/images/avatars/',_0x23e2ad[_0x7b7e('0x68')]))){_0x5e067f=path[_0x7b7e('0x69')](config[_0x7b7e('0x6a')],'server/files/images/avatars/',_0x23e2ad[_0x7b7e('0x68')]);}}return _0x1d7938[_0x7b7e('0x72')](_0x5e067f);}})[_0x7b7e('0x46')](handleError(_0x1d7938,null));};exports[_0x7b7e('0x79')]=function(_0xeeaf19,_0x27785c){var _0x176a28=require(_0x7b7e('0x7a'));var _0x394db1=new _0x176a28();var _0x285728=_0x394db1['setUA'](_0xeeaf19[_0x7b7e('0x7b')][_0x7b7e('0x7c')])[_0x7b7e('0x7d')]();var _0x5d0479={'body':_0xeeaf19['body'],'channel':_0x7b7e('0x7e')};var _0x5afd0b=[];var _0x5ac317=[];var _0x26aef0={};var _0x173308=![];return db[_0x7b7e('0x7f')]['describe']()[_0x7b7e('0x24')](function(_0x33eba1){if(!_0x33eba1){throw new db[(_0x7b7e('0x80'))][(_0x7b7e('0x81'))](_0x7b7e('0x82'));}_0x5afd0b=_['difference'](_[_0x7b7e('0x36')](_0x33eba1),[_0x7b7e('0x83'),_0x7b7e('0x84')]);_0x5ac317=_[_0x7b7e('0x85')](_[_0x7b7e('0x36')](_0x33eba1),[_0x7b7e('0x83'),'updatedAt','CompanyId',_0x7b7e('0x86')]);if(_0xeeaf19['body']['id']){delete _0xeeaf19[_0x7b7e('0x50')]['id'];}if(_[_0x7b7e('0x6f')](_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0x87')])){throw new db[(_0x7b7e('0x80'))][(_0x7b7e('0x81'))](_0x7b7e('0x88'));}if(_['isNil'](_0xeeaf19['body'][_0x7b7e('0x50')])||_0xeeaf19[_0x7b7e('0x50')]['body']===''){throw new db[(_0x7b7e('0x80'))][(_0x7b7e('0x81'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0x89')])){throw new db[(_0x7b7e('0x80'))]['ValidationError'](_0x7b7e('0x8a')+_0x5ac317);}if(!_[_0x7b7e('0x8b')](_0x5ac317,_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0x89')])){throw new db[(_0x7b7e('0x80'))][(_0x7b7e('0x81'))](_0x7b7e('0x8c')+_0x5ac317);}_0x26aef0[_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0x89')]]=_0xeeaf19[_0x7b7e('0x50')]['from'];})['then'](function(){return db['ChatWebsite'][_0x7b7e('0x4a')]({'where':{'id':_0xeeaf19['params']['id']},'include':[{'model':db[_0x7b7e('0x8d')],'as':_0x7b7e('0x8e'),'include':[{'model':db[_0x7b7e('0x7f')],'as':'Contacts','where':_0x26aef0,'limit':0x1,'order':[[_0x7b7e('0x84'),_0x7b7e('0x8f')]]}]},{'model':db[_0x7b7e('0x90')],'as':_0x7b7e('0x91')}]});})[_0x7b7e('0x24')](handleEntityNotFound(_0x27785c,null))[_0x7b7e('0x24')](function(_0x398345){if(_0x398345&&_0x398345['List']){_0x5d0479['account']=_0x398345;_0x5d0479['applications']=_0x398345[_0x7b7e('0x91')];_0x5d0479[_0x7b7e('0x92')]=_0x398345[_0x7b7e('0x8e')];_0x5d0479[_0x7b7e('0x93')]=_[_0x7b7e('0x94')](_0x5d0479[_0x7b7e('0x93')],[_0x7b7e('0x95')],[_0x7b7e('0x96')]);if(_0x5d0479[_0x7b7e('0x97')]['Applications']){delete _0x5d0479[_0x7b7e('0x97')][_0x7b7e('0x91')];}if(_0x5d0479[_0x7b7e('0x97')]['List']&&_0x5d0479[_0x7b7e('0x97')]['List'][_0x7b7e('0x98')][_0x7b7e('0x54')]){return _0x5d0479[_0x7b7e('0x97')][_0x7b7e('0x8e')]['Contacts'][0x0];}var _0x40b101=_[_0x7b7e('0x9')](_0xeeaf19[_0x7b7e('0x50')],{'firstName':_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0x87')],'ListId':_0x398345['ListId']});_0x40b101[_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0x89')]]=_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0x87')];return db[_0x7b7e('0x7f')][_0x7b7e('0x4b')](_0x40b101,{'fields':_0x5afd0b,'raw':!![]});}})[_0x7b7e('0x24')](handleEntityNotFound(_0x27785c,null))[_0x7b7e('0x24')](function(_0x576d82){_0x5d0479[_0x7b7e('0x99')]=_0x576d82;var _0x65ccc1=_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0x9a')];if(_0xeeaf19[_0x7b7e('0x7b')]['cf-connecting-ip']){_0x65ccc1=_0xeeaf19[_0x7b7e('0x7b')][_0x7b7e('0x9b')];}else if(_0xeeaf19[_0x7b7e('0x7b')][_0x7b7e('0x9c')]){_0x65ccc1=_[_0x7b7e('0x9d')](_0xeeaf19[_0x7b7e('0x7b')][_0x7b7e('0x9c')][_0x7b7e('0x9e')](','));}if(_0x576d82){var _0x3cfe88={'ContactId':_0x576d82['id'],'ChatWebsiteId':_0xeeaf19[_0x7b7e('0x47')]['id'],'from':(_0x576d82['firstName']||'')+'\x20'+(_0x576d82[_0x7b7e('0x9f')]||''),'customerIp':_0x65ccc1,'customerPort':_0xeeaf19['headers'][_0x7b7e('0xa0')]?_0xeeaf19[_0x7b7e('0x7b')][_0x7b7e('0xa0')]:null,'referer':_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0xa1')],'browserName':_0x285728[_0x7b7e('0xa2')][_0x7b7e('0x2a')]&&_0x285728[_0x7b7e('0xa2')][_0x7b7e('0xa3')]?util[_0x7b7e('0xa4')](_0x7b7e('0xa5'),_0x285728[_0x7b7e('0xa2')][_0x7b7e('0x2a')],_0x285728['browser']['version']):_0x7b7e('0xa6'),'browserVersion':_0x285728['browser'][_0x7b7e('0xa3')]||_0x7b7e('0xa6'),'osName':util[_0x7b7e('0xa4')](_0x7b7e('0xa5'),_0x285728['os'][_0x7b7e('0x2a')],_0x285728['os']['version']),'osVersion':_0x285728['os'][_0x7b7e('0xa3')],'deviceModel':_0x285728['device']['model']&&_0x285728['device'][_0x7b7e('0xa7')]?util[_0x7b7e('0xa4')](_0x7b7e('0xa8'),_0x285728[_0x7b7e('0xa9')][_0x7b7e('0x34')],_0x285728[_0x7b7e('0xa9')][_0x7b7e('0xa7')],_0x285728['device'][_0x7b7e('0x32')]):null,'deviceVendor':_0x285728[_0x7b7e('0xa9')][_0x7b7e('0xa7')],'deviceType':_0x285728[_0x7b7e('0xa9')][_0x7b7e('0x32')],'formData':JSON[_0x7b7e('0x16')](_0xeeaf19[_0x7b7e('0x50')])};var _0x7025d7={'ChatWebsiteId':_0xeeaf19[_0x7b7e('0x47')]['id'],'closed':![]};if(_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0xaa')]){_0x7025d7[_0x7b7e('0xaa')]=_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0xaa')];return db['ChatInteraction']['find']({'where':_0x7025d7})[_0x7b7e('0x24')](function(_0x42a8f9){if(_0x42a8f9){return[_0x42a8f9,![]];}_0x3cfe88[_0x7b7e('0xaa')]=_0xeeaf19['body'][_0x7b7e('0xaa')];_0x3cfe88[_0x7b7e('0xab')]=_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0xab')];return db[_0x7b7e('0xac')]['create'](_0x3cfe88)['then'](function(_0x51ed9d){return[_0x51ed9d,!![]];});});}_0x7025d7[_0x7b7e('0xad')]=_0x576d82['id'];if(_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0xae')]&&_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0xae')]['id']){_0x7025d7['id']=_0xeeaf19['body'][_0x7b7e('0xae')]['id'];return db['ChatInteraction'][_0x7b7e('0x4a')]({'where':_0x7025d7})['then'](function(_0x4a2fa9){if(_0x4a2fa9){return[_0x4a2fa9,![]];}return db['ChatInteraction'][_0x7b7e('0x4b')](_0x3cfe88)[_0x7b7e('0x24')](function(_0x5a922a){return[_0x5a922a,!![]];});});}return db[_0x7b7e('0xac')][_0x7b7e('0x4b')](_0x3cfe88)[_0x7b7e('0x24')](function(_0x27a391){return[_0x27a391,!![]];});}})['spread'](function(_0x845230,_0x62846d){if(_0x845230){_0x173308=_0x62846d;if(!_0x62846d){var _0x495348={'from':(_0x5d0479[_0x7b7e('0x99')][_0x7b7e('0xaf')]||'')+'\x20'+(_0x5d0479[_0x7b7e('0x99')][_0x7b7e('0x9f')]||'')};if(_0xeeaf19['body'][_0x7b7e('0xaa')]&&_0xeeaf19[_0x7b7e('0x50')]['messageId']&&_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0xaa')]!=_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0xb0')]){_0x495348[_0x7b7e('0xaa')]=_0xeeaf19[_0x7b7e('0x50')]['messageId'];}return _0x845230[_0x7b7e('0x23')](_0x495348);}else{return _0x845230;}}})['then'](function(_0x42957f){_0x5d0479['interaction']=_0x42957f[_0x7b7e('0x25')]({'plain':!![]});_0x5d0479[_0x7b7e('0xae')]['created']=_0x173308;if(_0x5d0479['interaction']['created']){if(_0x5d0479[_0x7b7e('0x97')][_0x7b7e('0xb1')]){_0x5d0479[_0x7b7e('0x93')][_0x7b7e('0xb2')]({'id':0x0,'priority':_0x5d0479[_0x7b7e('0x93')][_0x7b7e('0x54')]+0x1,'app':'close','appdata':_0x7b7e('0xb3'),'interval':_0x7b7e('0xb4')});}}return db[_0x7b7e('0xb5')]['create']({'body':_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0x50')],'ChatWebsiteId':_0xeeaf19[_0x7b7e('0x47')]['id'],'ChatInteractionId':_0x42957f['id'],'direction':'in','ContactId':_0x5d0479[_0x7b7e('0x99')]['id'],'AttachmentId':_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0xb6')]});})[_0x7b7e('0x24')](function(_0xc9ed8f){_0x5d0479[_0x7b7e('0x19')]=_0xc9ed8f;if(_0x5d0479[_0x7b7e('0xae')][_0x7b7e('0xb7')]){return db[_0x7b7e('0xb8')]['find']({'attributes':['id',_0x7b7e('0x2a')],'where':{'id':_0x5d0479['interaction'][_0x7b7e('0xb7')]}})['then'](function(_0x276a76){if(_0x276a76){_0x5d0479[_0x7b7e('0x93')]['unshift']({'id':0x0,'priority':0x0,'app':_0x7b7e('0xb9'),'appdata':_0x276a76['name']+','+(_0x5d0479[_0x7b7e('0x97')]['waitForTheAssignedAgent']||0xa),'interval':_0x7b7e('0xb4')});_0x5d0479['forcedOwnership']=!![];}return respondWithRpcPromise(_0x7b7e('0xba'),_0x7b7e('0xbb'),_0x5d0479);});}return respondWithRpcPromise(_0x7b7e('0xba'),_0x7b7e('0xbb'),_0x5d0479);})[_0x7b7e('0x24')](function(_0x255fed){respondWithRpcPromise(_0x7b7e('0xbc'),_0x7b7e('0xbc'),{'event':_0x7b7e('0x79'),'message':_0x255fed},client9002);return _0x255fed;})[_0x7b7e('0x24')](respondWithResult(_0x27785c,null))[_0x7b7e('0x46')](handleError(_0x27785c,null));};exports['offline']=function(_0x5eae74,_0x4999af){var _0x4a193a,_0x55b604,_0x283d97;var _0x1586b9=[];var _0x3a10d3={};var _0x46f331=_0x5eae74[_0x7b7e('0xbd')]||[];var _0x4ce6b2=[];var _0x5a9723;return db[_0x7b7e('0x7f')]['describe']()[_0x7b7e('0x24')](function(_0x350a01){if(!_0x350a01){throw new db[(_0x7b7e('0x80'))][(_0x7b7e('0x81'))](_0x7b7e('0x82'));}_0x1586b9=_[_0x7b7e('0x85')](_[_0x7b7e('0x36')](_0x350a01),[_0x7b7e('0x83'),'updatedAt',_0x7b7e('0xbe'),'ListId']);if(_0x5eae74['body']['id']){delete _0x5eae74[_0x7b7e('0x50')]['id'];}if(_[_0x7b7e('0x6f')](_0x5eae74[_0x7b7e('0x50')][_0x7b7e('0x87')])){throw _0x4999af[_0x7b7e('0x1c')](0x1f4)[_0x7b7e('0x2b')](new db[(_0x7b7e('0x80'))][(_0x7b7e('0x81'))](_0x7b7e('0x88')));}if(_[_0x7b7e('0x6f')](_0x5eae74[_0x7b7e('0x50')][_0x7b7e('0x50')])||_0x5eae74[_0x7b7e('0x50')]['body']===''){throw _0x4999af[_0x7b7e('0x1c')](0x1f4)[_0x7b7e('0x2b')](new db[(_0x7b7e('0x80'))][(_0x7b7e('0x81'))](_0x7b7e('0xbf')));}if(_[_0x7b7e('0x6f')](_0x5eae74[_0x7b7e('0x50')][_0x7b7e('0xc0')])){throw _0x4999af[_0x7b7e('0x1c')](0x1f4)['send'](new db[(_0x7b7e('0x80'))][(_0x7b7e('0x81'))](_0x7b7e('0xc1')+_0x1586b9));}if(!_[_0x7b7e('0x8b')](_0x1586b9,_0x5eae74[_0x7b7e('0x50')]['mapKeyOffline'])){throw _0x4999af[_0x7b7e('0x1c')](0x1f4)[_0x7b7e('0x2b')](new db[(_0x7b7e('0x80'))]['ValidationError'](_0x7b7e('0xc2')+_0x1586b9));}_0x3a10d3[_0x5eae74[_0x7b7e('0x50')]['mapKeyOffline']]=_0x5eae74['body'][_0x7b7e('0x87')];})[_0x7b7e('0x24')](function(){return db['ChatWebsite'][_0x7b7e('0x4a')]({'where':{'id':_0x5eae74[_0x7b7e('0x47')]['id']},'include':[{'model':db[_0x7b7e('0x8d')],'as':_0x7b7e('0x8e')},{'model':db[_0x7b7e('0xc3')],'as':'MailAccount'}]});})['then'](handleEntityNotFound(_0x4999af,null))[_0x7b7e('0x24')](function(_0x4a6398){if(_0x4a6398&&_0x4a6398[_0x7b7e('0x8e')]){_0x55b604=_0x4a6398;var _0x4b3682=_[_0x7b7e('0x9')](_0x5eae74['body'],{'firstName':_0x5eae74[_0x7b7e('0x50')]['from'],'phone':_0x5eae74['body'][_0x7b7e('0x87')],'ListId':_0x4a6398['ListId']});_0x4b3682[_0x5eae74['body'][_0x7b7e('0xc0')]]=_0x5eae74[_0x7b7e('0x50')]['from'];return db[_0x7b7e('0x7f')][_0x7b7e('0xc4')]({'where':_0x3a10d3,'defaults':_0x4b3682});}})[_0x7b7e('0xc5')](function(_0x45c9b7){if(_0x45c9b7){_0x283d97=_0x45c9b7;var _0x1dc553=fs[_0x7b7e('0xc6')](path[_0x7b7e('0x69')](config[_0x7b7e('0x6a')],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x3e0e3e=ejs[_0x7b7e('0xc7')](_0x1dc553,{'body':_[_0x7b7e('0xc8')](_0x5eae74[_0x7b7e('0x50')][_0x7b7e('0x50')]),'bodyTitle':_0x55b604[_0x7b7e('0xc9')]});return db['ChatOfflineMessage'][_0x7b7e('0x4b')]({'body':_0x3e0e3e,'plainBody':htmlToText[_0x7b7e('0xca')](_0x3e0e3e),'ContactId':_0x45c9b7['id'],'ChatWebsiteId':_0x55b604['id']});}})['then'](function(_0x4a656c){_0x5a9723=_0x4a656c;if(_0x46f331[_0x7b7e('0x54')]){var _0x52531d=_0x46f331[_0x7b7e('0x2f')](function(_0x23f186){return{'name':_0x23f186[_0x7b7e('0xcb')],'basename':_0x23f186[_0x7b7e('0x61')],'type':_0x23f186[_0x7b7e('0xcc')],'ChatOfflineMessageId':_0x4a656c['id']};});_0x4ce6b2=_0x52531d['map'](_0x2405ba=>{var _0x582bb9={'filename':_0x2405ba[_0x7b7e('0x2a')],'path':path[_0x7b7e('0x69')](config[_0x7b7e('0x6a')],'server',_0x7b7e('0xbd'),_0x7b7e('0xcd'),'offline-chat',_0x2405ba[_0x7b7e('0xce')])};return _0x582bb9;});if(!_0x55b604[_0x7b7e('0xcf')]){return db['sequelize'][_0x7b7e('0xd0')](function(_0x30e0ac){return db[_0x7b7e('0xd1')][_0x7b7e('0xd2')](_0x52531d,{'transaction':_0x30e0ac});});}}})['then'](function(){if(_0x5a9723){_0x4a193a=_0x5a9723;return db[_0x7b7e('0xc3')]['findOne']({'where':{'active':!![]},'include':[{'model':db[_0x7b7e('0xd3')],'as':'Smtp','raw':!![]}]});}})[_0x7b7e('0x24')](function(_0x4e4703){if(_0x4e4703&&_0x4e4703[_0x7b7e('0xd4')]&&_0x55b604[_0x7b7e('0xd5')]&&_0x55b604[_0x7b7e('0xd6')]){var _0xf34506={'tls':{'rejectUnauthorized':![]}};if(_0x4e4703[_0x7b7e('0xd4')]['service']){_0xf34506[_0x7b7e('0xd7')]=_0x4e4703[_0x7b7e('0xd4')][_0x7b7e('0xd7')];}else{_0xf34506['host']=_0x4e4703['Smtp'][_0x7b7e('0xd8')];_0xf34506[_0x7b7e('0xd9')]=_0x4e4703[_0x7b7e('0xd4')][_0x7b7e('0xd9')];_0xf34506['secure']=_0x4e4703[_0x7b7e('0xd4')][_0x7b7e('0xda')];}if(_0x4e4703[_0x7b7e('0xd4')]['authentication']){_0xf34506[_0x7b7e('0xdb')]={'user':_0x4e4703[_0x7b7e('0xd4')][_0x7b7e('0x4c')],'pass':_0x4e4703['Smtp'][_0x7b7e('0xdc')]};}return respondWithRpcPromise(_0x7b7e('0xdd'),_0x7b7e('0xde'),{'account':_0xf34506,'message':{'from':util[_0x7b7e('0xa4')](_0x7b7e('0xdf'),_0x4e4703['name'],_0x4e4703[_0x7b7e('0xe0')]||_0x4e4703[_0x7b7e('0xd4')]['user']),'to':_0x55b604['forwardOfflineAddress'],'subject':_0x55b604[_0x7b7e('0xe1')],'html':_0x4a193a[_0x7b7e('0x50')],'attachments':_0x4ce6b2}},client9003)[_0x7b7e('0x24')](function(){return _0x4a193a;})[_0x7b7e('0x46')](function(_0x1bbd6d){console[_0x7b7e('0x17')](_0x1bbd6d);});}})[_0x7b7e('0x24')](function(){if(_0x55b604&&_0x55b604[_0x7b7e('0xcf')]&&_0x55b604[_0x7b7e('0xe2')]){var _0x50a68e=[];if(_0x46f331[_0x7b7e('0x54')]){_0x50a68e=_0x46f331['map'](function(_0x471524){return{'name':_0x471524['originalname'],'basename':_0x471524[_0x7b7e('0x61')],'type':_0x471524['mimetype'],'ChatOfflineMessageId':_0x5a9723['id']};});}var _0x4c63f5;if(!_['isNil'](_0x55b604[_0x7b7e('0xe3')])){var _0x423c16=_['map'](_0x5eae74[_0x7b7e('0x50')],function(_0x22d7a7){return _0x22d7a7;});var _0x12bd58=_[_0x7b7e('0xe4')](_0x423c16)[0x0];var _0x5e3718=_[_0x7b7e('0xe5')](_0x12bd58,function(_0x22153b){return _0x22153b;});_0x4c63f5=_0x5e3718[0x1][_0x55b604[_0x7b7e('0xe3')]];}var _0x59d4ef={'from':_0x283d97['email'],'firstName':_0x283d97['firstName'],'lastName':_0x283d97[_0x7b7e('0x9f')],'mapKey':'email','message':{'from':_0x283d97[_0x7b7e('0xe0')],'to':_0x55b604[_0x7b7e('0xc3')][_0x7b7e('0xe0')],'cc':'','subject':_[_0x7b7e('0x6f')](_0x4c63f5)?_0x55b604['offlineMessageSubject']:_0x4c63f5,'messageId':'','sentAt':new Date(),'attach':_0x50a68e['length'],'attachments':_0x50a68e,'originChannel':_0x7b7e('0xe6'),'ChatWebsiteId':_0x55b604['id'],'ChatOfflineMessageId':_0x4a193a['id'],'originTo':_0x55b604['MailAccount'][_0x7b7e('0xe0')]},'body':_0x4a193a['body']};var _0x1b2f83={'account':{'id':_0x55b604[_0x7b7e('0xe2')]},'body':_0x59d4ef,'log':_0x7b7e('0xe7')};return respondWithRpcPromise('NotifyMailAccount',_0x7b7e('0xe8'),_0x1b2f83,client9001)[_0x7b7e('0x24')](function(){return _0x4a193a;})[_0x7b7e('0x46')](function(_0x5d0a9e){console[_0x7b7e('0x17')](_0x5d0a9e);});}return;})['then'](function(){if(_0x4a193a){return _0x4a193a;}})[_0x7b7e('0x24')](respondWithResult(_0x4999af,null))['catch'](function(_0x4e4ab6){console[_0x7b7e('0x17')](_0x7b7e('0x46'),_0x4e4ab6);for(var _0x44c7e4 of _0x46f331){var _0x28e62f=path[_0x7b7e('0x69')](config['root'],_0x7b7e('0xe9'),'files',_0x7b7e('0xcd'),_0x7b7e('0xea'),_0x44c7e4[_0x7b7e('0x61')]);fs_extra[_0x7b7e('0xeb')](_0x28e62f)[_0x7b7e('0x46')](function(_0x22fe0f){console[_0x7b7e('0x17')](_0x7b7e('0xec'),_0x28e62f,_0x22fe0f);});}});};exports[_0x7b7e('0xed')]=function(_0x2f7540,_0x11901c){return db[_0x7b7e('0xac')][_0x7b7e('0x4a')]({'where':{'id':_0x2f7540[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x11901c,null))[_0x7b7e('0x24')](function(_0x18d515){if(_0x18d515){return _0x18d515[_0x7b7e('0xed')](_0x2f7540[_0x7b7e('0x50')][_0x7b7e('0x59')],_['omit'](_0x2f7540[_0x7b7e('0x50')],['ids','id'])||{});}})[_0x7b7e('0x24')](respondWithResult(_0x11901c,null))[_0x7b7e('0x46')](handleError(_0x11901c,null));};exports[_0x7b7e('0xee')]=function(_0x5d4968,_0x37ae1c){var _0x4bb4e5={'raw':![],'where':{}};var _0x1c7308={};var _0x57ea72={'count':0x0,'rows':[]};return db[_0x7b7e('0x30')]['findOne']({'where':{'id':_0x5d4968['params']['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x37ae1c,null))['then'](function(_0x215583){if(_0x215583){_0x1c7308[_0x7b7e('0x34')]=_[_0x7b7e('0x36')](db['ChatInteraction'][_0x7b7e('0x48')]);_0x1c7308[_0x7b7e('0x35')]=_[_0x7b7e('0x36')](_0x5d4968[_0x7b7e('0x35')]);_0x1c7308[_0x7b7e('0x3e')]=_[_0x7b7e('0x37')](_0x1c7308[_0x7b7e('0x34')],_0x1c7308[_0x7b7e('0x35')]);_0x4bb4e5['attributes']=_[_0x7b7e('0x37')](_0x1c7308['model'],qs[_0x7b7e('0x39')](_0x5d4968['query']['fields']));_0x4bb4e5['attributes']=_0x4bb4e5[_0x7b7e('0x38')][_0x7b7e('0x54')]?_0x4bb4e5[_0x7b7e('0x38')]:_0x1c7308[_0x7b7e('0x34')];if(!_0x5d4968[_0x7b7e('0x35')]['hasOwnProperty']('nolimit')){_0x4bb4e5[_0x7b7e('0x20')]=qs[_0x7b7e('0x20')](_0x5d4968[_0x7b7e('0x35')][_0x7b7e('0x20')]);_0x4bb4e5[_0x7b7e('0x1e')]=qs[_0x7b7e('0x1e')](_0x5d4968[_0x7b7e('0x35')]['offset']);}_0x4bb4e5['order']=qs[_0x7b7e('0x3c')](_0x5d4968[_0x7b7e('0x35')]['sort']);_0x4bb4e5[_0x7b7e('0x40')]=qs[_0x7b7e('0x3e')](_[_0x7b7e('0x3d')](_0x5d4968[_0x7b7e('0x35')],_0x1c7308[_0x7b7e('0x3e')]));_0x4bb4e5[_0x7b7e('0x40')]['ChatWebsiteId']=_0x215583['id'];if(_0x5d4968[_0x7b7e('0x35')]['filter']){_0x4bb4e5[_0x7b7e('0x40')]=_[_0x7b7e('0x41')](_0x4bb4e5[_0x7b7e('0x40')],{'$or':_['map'](_0x4bb4e5[_0x7b7e('0x38')],function(_0x401dd6){var _0x3bbf22={};_0x3bbf22[_0x401dd6]={'$like':'%'+_0x5d4968[_0x7b7e('0x35')]['filter']+'%'};return _0x3bbf22;})});}_0x4bb4e5=_[_0x7b7e('0x41')]({},_0x4bb4e5,_0x5d4968[_0x7b7e('0x49')]);return db[_0x7b7e('0xac')][_0x7b7e('0x21')]({'where':_0x4bb4e5['where']})[_0x7b7e('0x24')](function(_0x2be57d){_0x57ea72[_0x7b7e('0x21')]=_0x2be57d;if(_0x5d4968[_0x7b7e('0x35')]['includeAll']){_0x4bb4e5[_0x7b7e('0x57')]=[{'model':db['CmContact'],'as':_0x7b7e('0xef'),'required':![]},{'model':db[_0x7b7e('0xb8')],'as':_0x7b7e('0xf0'),'attributes':['name','fullname',_0x7b7e('0xf1')],'required':![]},{'model':db[_0x7b7e('0xf2')],'as':_0x7b7e('0xf3'),'attributes':['id',_0x7b7e('0x2a'),_0x7b7e('0xf4')],'where':_0x5d4968[_0x7b7e('0x35')][_0x7b7e('0xf5')]?{'id':_0x5d4968[_0x7b7e('0x35')][_0x7b7e('0xf5')]}:undefined,'required':_0x5d4968[_0x7b7e('0x35')][_0x7b7e('0xf5')]?!![]:![]}];}return db[_0x7b7e('0xac')][_0x7b7e('0x44')](_0x4bb4e5);})[_0x7b7e('0x24')](function(_0x2eb712){_0x57ea72[_0x7b7e('0x45')]=_0x2eb712;return _0x57ea72;});}})['then'](respondWithFilteredResult(_0x37ae1c,_0x4bb4e5))[_0x7b7e('0x46')](handleError(_0x37ae1c,null));};function iftimePromise(_0x5a78d6,_0x27d9b7){return respondWithRpcPromise(_0x7b7e('0xf6'),_0x7b7e('0xf7'),{'command':_0x27d9b7[_0x7b7e('0xf8')]?util['format'](_0x7b7e('0xf9'),_0x5a78d6[_0x7b7e('0xfa')],_0x27d9b7[_0x7b7e('0xf8')]):util[_0x7b7e('0xa4')](_0x7b7e('0xfb'),_0x5a78d6[_0x7b7e('0xfa')])},client9002)[_0x7b7e('0x24')](function(_0x1f2174){var _0x1b60e7=_0x1f2174&&_0x1f2174[_0x7b7e('0xfc')](_0x7b7e('0xfd'))>=0x0?!![]:![];logger[_0x7b7e('0x12')](_0x7b7e('0xfe'),_0x27d9b7['id'],_0x5a78d6['id'],_0x5a78d6[_0x7b7e('0xfa')],_0x1b60e7?'ONLINE':_0x7b7e('0xff'),_0x27d9b7[_0x7b7e('0xf8')]?_0x27d9b7[_0x7b7e('0xf8')]:'No\x20timezone');return _0x1b60e7;})[_0x7b7e('0x46')](function(_0x322025){logger['error'](_0x7b7e('0xfe'),_0x27d9b7['id'],_0x5a78d6['id'],_0x5a78d6[_0x7b7e('0xfa')],util[_0x7b7e('0x100')](_0x322025,{'showHidden':![],'depth':null}),_0x27d9b7[_0x7b7e('0xf8')]?_0x27d9b7[_0x7b7e('0xf8')]:'No\x20timezone');return![];});}exports[_0x7b7e('0xf7')]=function(_0x33693d,_0xe12d13){var _0x19a9ec=0x0;var _0x1da40b=0x0;var _0x377613=![];var _0x3b4171;var _0x14757d;return db[_0x7b7e('0x30')][_0x7b7e('0x4a')]({'where':{'id':_0x33693d[_0x7b7e('0x47')]['id']},'include':[{'model':db[_0x7b7e('0x101')],'as':_0x7b7e('0x101'),'include':[{'model':db[_0x7b7e('0x101')],'as':_0x7b7e('0x102'),'attributes':['id',_0x7b7e('0xfa')],'raw':!![]}]}]})[_0x7b7e('0x24')](handleEntityNotFound(_0xe12d13,null))['then'](function(_0x528506){if(_0x528506){_0x3b4171=_0x528506;return _0x528506[_0x7b7e('0x103')]({'raw':!![]});}})[_0x7b7e('0x24')](function(_0x42d6aa){if(_0x3b4171){if(_0x42d6aa){_0x14757d=_0x42d6aa;}}return require(_0x7b7e('0x6c'))[_0x7b7e('0x6d')]();})[_0x7b7e('0x24')](function(_0x2a7845){if(_0x2a7845){_0x1da40b=_0x2a7845[_0x7b7e('0x104')];_0x377613=_0x2a7845[_0x7b7e('0x6e')];}})['then'](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})['then'](function(_0x204397){_0x19a9ec=_0x204397;if(_0x1da40b&&_0x204397>_0x1da40b){return db[_0x7b7e('0x105')][_0x7b7e('0x5d')]({'where':{'id':0x1}})[_0x7b7e('0x24')](function(_0x43a7fa){if(_0x43a7fa){_0x43a7fa['increment'](_0x7b7e('0x106'));}});}})[_0x7b7e('0x24')](function(){if(_0x3b4171['Interval']&&_0x3b4171[_0x7b7e('0x101')]['Intervals']){var _0x30a1a0=[];for(var _0x2d5595=0x0;_0x2d5595<_0x3b4171[_0x7b7e('0x101')]['Intervals'][_0x7b7e('0x54')];_0x2d5595++){var _0x5ac66a=_0x3b4171[_0x7b7e('0x101')][_0x7b7e('0x102')][_0x2d5595][_0x7b7e('0x25')]({'plain':!![]});_0x30a1a0[_0x7b7e('0xb2')](iftimePromise(_0x5ac66a,_0x3b4171));}return BPromise[_0x7b7e('0x107')](_0x30a1a0)[_0x7b7e('0x24')](function(_0x36755d){return _['some'](_0x36755d);});}else{return!![];}})[_0x7b7e('0x24')](function(_0x5273e5){var _0xeaeb7=fs[_0x7b7e('0xc6')](path[_0x7b7e('0x69')](config[_0x7b7e('0x6a')],_0x7b7e('0x108')),'utf8');var _0x3c9c06={'remote':_0x3b4171[_0x7b7e('0x109')],'query':querystring[_0x7b7e('0x16')](_['merge'](_0x3b4171[_0x7b7e('0x25')]({'plain':!![]}),{'customerIp':_0x33693d[_0x7b7e('0x7b')]['x-forwarded-for']||_0x33693d[_0x7b7e('0x7b')][_0x7b7e('0x10a')]||_0x33693d[_0x7b7e('0x10b')]['remoteAddress']||_0x33693d['ip'],'referer':_0x33693d[_0x7b7e('0x7b')][_0x7b7e('0xa1')],'openedInteractions':_0x19a9ec,'maxInteractions':_0x1da40b,'virtual':_0x377613[_0x7b7e('0x104')],'online':_0x5273e5,'custom':_0x377613}))[_0x7b7e('0x10c')](/'/g,'\x5c\x27')};_0xe12d13[_0x7b7e('0x2b')](ejs['render'](Mustache['render'](_0xeaeb7,_0x3c9c06),{'proactiveActions':_0x14757d,'alignment':_0x3b4171[_0x7b7e('0x10d')],'verticalAlignment':_0x3b4171[_0x7b7e('0x10e')],'div_color':_0x3b4171['color'],'labelText':_0x3b4171[_0x7b7e('0x10f')],'text_color':_0x3b4171[_0x7b7e('0x110')],'button_color':_0x3b4171[_0x7b7e('0x111')],'background_color':_0x3b4171[_0x7b7e('0x112')]}));})[_0x7b7e('0x46')](handleError(_0xe12d13,null));};exports['addApplications']=function(_0x24b8e0,_0x143e7b){var _0x472bbd=_0x24b8e0[_0x7b7e('0x47')]['id'];var _0x335f4b=_0x24b8e0[_0x7b7e('0x50')];var _0x22f1a4=0xc8;var _0x4f1e67=null;return db[_0x7b7e('0x113')]['transaction']({'isolationLevel':db[_0x7b7e('0x113')][_0x7b7e('0x114')][_0x7b7e('0x115')]['READ_COMMITTED']},function(_0x15f854){return db[_0x7b7e('0x30')][_0x7b7e('0x5d')]({'where':{'id':_0x472bbd},'transaction':_0x15f854})[_0x7b7e('0x24')](function(_0xe077b4){if(_0xe077b4){return db[_0x7b7e('0x90')]['destroy']({'where':{'ChatWebsiteId':_0x472bbd},'transaction':_0x15f854})[_0x7b7e('0x24')](function(){var _0xe3ef56=_['map'](_0x335f4b,function(_0x217a46){_0x217a46[_0x7b7e('0x56')]=_0x472bbd;return _0x217a46;});return db[_0x7b7e('0x90')][_0x7b7e('0xd2')](_0xe3ef56,{'transaction':_0x15f854});});}else{_0x22f1a4=0x194;_0x4f1e67=[];}});})[_0x7b7e('0x24')](function(){if(_0x22f1a4!==0x194){return db[_0x7b7e('0x90')][_0x7b7e('0x116')]({'where':{'ChatWebsiteId':_0x472bbd},'order':_0x7b7e('0x95')})['then'](function(_0x508c76){_0x4f1e67=_0x508c76;});}})['catch'](function(_0x2d271d){_0x22f1a4=0x1f4;logger['error'](_0x2d271d[_0x7b7e('0x29')]);if(_0x2d271d[_0x7b7e('0x2a')]){delete _0x2d271d[_0x7b7e('0x2a')];}_0x4f1e67=_0x2d271d;})[_0x7b7e('0x117')](function(){if(_0x4f1e67===null){_0x143e7b[_0x7b7e('0x1b')](_0x22f1a4);}else{if(_0x22f1a4===0x1f4){_0x143e7b[_0x7b7e('0x1c')](_0x22f1a4)['send'](_0x4f1e67);}else{_0x143e7b[_0x7b7e('0x1c')](_0x22f1a4)[_0x7b7e('0x1d')](_0x4f1e67);}}});};exports[_0x7b7e('0x118')]=function(_0x10aaf2,_0x25be32){var _0xc29f56={};var _0x3d9e71={};var _0x33673a;var _0x321eb6;return db['ChatWebsite']['findOne']({'where':{'id':_0x10aaf2[_0x7b7e('0x47')]['id']}})['then'](handleEntityNotFound(_0x25be32,null))['then'](function(_0x444bf4){if(_0x444bf4){_0x33673a=_0x444bf4;_0x3d9e71[_0x7b7e('0x34')]=_[_0x7b7e('0x36')](db[_0x7b7e('0x90')][_0x7b7e('0x48')]);_0x3d9e71[_0x7b7e('0x35')]=_['keys'](_0x10aaf2[_0x7b7e('0x35')]);_0x3d9e71[_0x7b7e('0x3e')]=_[_0x7b7e('0x37')](_0x3d9e71[_0x7b7e('0x34')],_0x3d9e71[_0x7b7e('0x35')]);_0xc29f56[_0x7b7e('0x38')]=_['intersection'](_0x3d9e71['model'],qs[_0x7b7e('0x39')](_0x10aaf2[_0x7b7e('0x35')][_0x7b7e('0x39')]));_0xc29f56[_0x7b7e('0x38')]=_0xc29f56['attributes']['length']?_0xc29f56[_0x7b7e('0x38')]:_0x3d9e71['model'];_0xc29f56['order']=qs['sort'](_0x10aaf2[_0x7b7e('0x35')][_0x7b7e('0x3c')]);_0xc29f56['where']=qs[_0x7b7e('0x3e')](_[_0x7b7e('0x3d')](_0x10aaf2[_0x7b7e('0x35')],_0x3d9e71[_0x7b7e('0x3e')]));if(_0x10aaf2[_0x7b7e('0x35')][_0x7b7e('0x3f')]){_0xc29f56[_0x7b7e('0x40')]=_[_0x7b7e('0x41')](_0xc29f56[_0x7b7e('0x40')],{'$or':_['map'](_0xc29f56['attributes'],function(_0xc31bf){var _0x4794df={};_0x4794df[_0xc31bf]={'$like':'%'+_0x10aaf2[_0x7b7e('0x35')][_0x7b7e('0x3f')]+'%'};return _0x4794df;})});}_0xc29f56=_[_0x7b7e('0x41')]({},_0xc29f56,_0x10aaf2['options']);return _0x33673a[_0x7b7e('0x118')](_0xc29f56);}})[_0x7b7e('0x24')](function(_0x4c6547){if(_0x4c6547){_0x321eb6=_0x4c6547[_0x7b7e('0x54')];if(!_0x10aaf2[_0x7b7e('0x35')]['hasOwnProperty']('nolimit')){_0xc29f56['limit']=qs[_0x7b7e('0x20')](_0x10aaf2[_0x7b7e('0x35')][_0x7b7e('0x20')]);_0xc29f56[_0x7b7e('0x1e')]=qs[_0x7b7e('0x1e')](_0x10aaf2['query'][_0x7b7e('0x1e')]);}return _0x33673a[_0x7b7e('0x118')](_0xc29f56);}})[_0x7b7e('0x24')](function(_0x1f0878){if(_0x1f0878){return _0x1f0878?{'count':_0x321eb6,'rows':_0x1f0878}:null;}})['then'](respondWithResult(_0x25be32,null))[_0x7b7e('0x46')](handleError(_0x25be32,null));};exports[_0x7b7e('0x119')]=function(_0x4746bb,_0x6865f0){return db[_0x7b7e('0x11a')][_0x7b7e('0x4a')]({'where':{'id':_0x4746bb[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x6865f0,null))[_0x7b7e('0x24')](function(_0x3b0796){if(_0x3b0796){return _0x3b0796[_0x7b7e('0x119')](_0x4746bb[_0x7b7e('0x50')][_0x7b7e('0x59')],_[_0x7b7e('0x11b')](_0x4746bb[_0x7b7e('0x50')],[_0x7b7e('0x59'),'id'])||{});}})[_0x7b7e('0x24')](respondWithResult(_0x6865f0,null))[_0x7b7e('0x46')](handleError(_0x6865f0,null));};exports[_0x7b7e('0x103')]=function(_0x119050,_0xd4abb1){var _0x5a79a5={};var _0x246351={};var _0x12de27;var _0x554684;return db[_0x7b7e('0x30')][_0x7b7e('0x5d')]({'where':{'id':_0x119050[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0xd4abb1,null))[_0x7b7e('0x24')](function(_0x2784cb){if(_0x2784cb){_0x12de27=_0x2784cb;_0x246351['model']=_[_0x7b7e('0x36')](db['ChatProactiveAction'][_0x7b7e('0x48')]);_0x246351[_0x7b7e('0x35')]=_['keys'](_0x119050['query']);_0x246351[_0x7b7e('0x3e')]=_['intersection'](_0x246351['model'],_0x246351['query']);_0x5a79a5[_0x7b7e('0x38')]=_[_0x7b7e('0x37')](_0x246351[_0x7b7e('0x34')],qs[_0x7b7e('0x39')](_0x119050[_0x7b7e('0x35')][_0x7b7e('0x39')]));_0x5a79a5[_0x7b7e('0x38')]=_0x5a79a5[_0x7b7e('0x38')][_0x7b7e('0x54')]?_0x5a79a5[_0x7b7e('0x38')]:_0x246351[_0x7b7e('0x34')];_0x5a79a5[_0x7b7e('0x55')]=qs[_0x7b7e('0x3c')](_0x119050['query'][_0x7b7e('0x3c')]);_0x5a79a5[_0x7b7e('0x40')]=qs[_0x7b7e('0x3e')](_[_0x7b7e('0x3d')](_0x119050[_0x7b7e('0x35')],_0x246351[_0x7b7e('0x3e')]));if(_0x119050[_0x7b7e('0x35')][_0x7b7e('0x3f')]){_0x5a79a5[_0x7b7e('0x40')]=_[_0x7b7e('0x41')](_0x5a79a5[_0x7b7e('0x40')],{'$or':_[_0x7b7e('0x2f')](_0x5a79a5[_0x7b7e('0x38')],function(_0x56bb34){var _0x5510d1={};_0x5510d1[_0x56bb34]={'$like':'%'+_0x119050[_0x7b7e('0x35')]['filter']+'%'};return _0x5510d1;})});}_0x5a79a5=_[_0x7b7e('0x41')]({},_0x5a79a5,_0x119050[_0x7b7e('0x49')]);return _0x12de27['getProactiveActions'](_0x5a79a5);}})[_0x7b7e('0x24')](function(_0x297ef5){if(_0x297ef5){_0x554684=_0x297ef5[_0x7b7e('0x54')];if(!_0x119050[_0x7b7e('0x35')][_0x7b7e('0x3a')](_0x7b7e('0x3b'))){_0x5a79a5[_0x7b7e('0x20')]=qs[_0x7b7e('0x20')](_0x119050[_0x7b7e('0x35')][_0x7b7e('0x20')]);_0x5a79a5['offset']=qs[_0x7b7e('0x1e')](_0x119050[_0x7b7e('0x35')][_0x7b7e('0x1e')]);}return _0x12de27[_0x7b7e('0x103')](_0x5a79a5);}})[_0x7b7e('0x24')](function(_0x5607c0){if(_0x5607c0){return _0x5607c0?{'count':_0x554684,'rows':_0x5607c0}:null;}})[_0x7b7e('0x24')](respondWithResult(_0xd4abb1,null))[_0x7b7e('0x46')](handleError(_0xd4abb1,null));};exports[_0x7b7e('0x11c')]=function(_0x1bb023,_0x28f668){var _0x58b728=_0x1bb023[_0x7b7e('0x35')][_0x7b7e('0x11d')]==='false'?'offlineForm':_0x7b7e('0x11e');return db[_0x7b7e('0x30')][_0x7b7e('0x4a')]({'attributes':['id',_0x58b728],'where':{'id':_0x1bb023['params']['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x28f668,null))[_0x7b7e('0x24')](function(_0x5c61e3){if(_0x5c61e3){var _0x4772ad=_0x5c61e3[_0x58b728];var _0x3b6f4a=_0x4772ad&&_0x4772ad[_0x7b7e('0x11f')]?_0x4772ad[_0x7b7e('0x11f')]:[];_0x28f668[_0x7b7e('0x2b')]({'fromKey':_['isNil'](_0x4772ad[_0x7b7e('0x120')])?undefined:_0x4772ad[_0x7b7e('0x120')],'count':_0x3b6f4a[_0x7b7e('0x54')],'rows':_0x3b6f4a});}})[_0x7b7e('0x46')](handleError(_0x28f668,null));};exports['getOfflineMessages']=function(_0x16d369,_0x51a98f){var _0x21d4ca={'raw':![],'where':{}};var _0x3409ed={};var _0x2eb5a3={'count':0x0,'rows':[]};return db[_0x7b7e('0x30')][_0x7b7e('0x5d')]({'where':{'id':_0x16d369['params']['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x51a98f,null))[_0x7b7e('0x24')](function(_0x5793a9){if(_0x5793a9){_0x3409ed[_0x7b7e('0x34')]=_[_0x7b7e('0x36')](db[_0x7b7e('0x121')]['rawAttributes']);_0x3409ed[_0x7b7e('0x35')]=_[_0x7b7e('0x36')](_0x16d369['query']);_0x3409ed[_0x7b7e('0x3e')]=_[_0x7b7e('0x37')](_0x3409ed['model'],_0x3409ed[_0x7b7e('0x35')]);_0x21d4ca[_0x7b7e('0x38')]=_['intersection'](_0x3409ed[_0x7b7e('0x34')],qs[_0x7b7e('0x39')](_0x16d369[_0x7b7e('0x35')][_0x7b7e('0x39')]));_0x21d4ca[_0x7b7e('0x38')]=_0x21d4ca[_0x7b7e('0x38')][_0x7b7e('0x54')]?_0x21d4ca[_0x7b7e('0x38')]:_0x3409ed[_0x7b7e('0x34')];if(!_0x16d369[_0x7b7e('0x35')][_0x7b7e('0x3a')]('nolimit')){_0x21d4ca[_0x7b7e('0x20')]=qs['limit'](_0x16d369[_0x7b7e('0x35')][_0x7b7e('0x20')]);_0x21d4ca[_0x7b7e('0x1e')]=qs[_0x7b7e('0x1e')](_0x16d369[_0x7b7e('0x35')][_0x7b7e('0x1e')]);}_0x21d4ca['order']=qs[_0x7b7e('0x3c')](_0x16d369[_0x7b7e('0x35')][_0x7b7e('0x3c')]);_0x21d4ca[_0x7b7e('0x40')]=qs[_0x7b7e('0x3e')](_['pick'](_0x16d369[_0x7b7e('0x35')],_0x3409ed['filters']));_0x21d4ca[_0x7b7e('0x40')]['ChatWebsiteId']=_0x5793a9['id'];if(_0x16d369[_0x7b7e('0x35')][_0x7b7e('0x3f')]){_0x21d4ca[_0x7b7e('0x40')]=_['merge'](_0x21d4ca[_0x7b7e('0x40')],{'$or':_[_0x7b7e('0x2f')](_0x21d4ca[_0x7b7e('0x38')],function(_0x432292){var _0x13541e={};_0x13541e[_0x432292]={'$like':'%'+_0x16d369[_0x7b7e('0x35')][_0x7b7e('0x3f')]+'%'};return _0x13541e;})});}_0x21d4ca=_[_0x7b7e('0x41')]({},_0x21d4ca,_0x16d369['options']);return db[_0x7b7e('0x121')][_0x7b7e('0x21')]({'where':_0x21d4ca[_0x7b7e('0x40')]})[_0x7b7e('0x24')](function(_0x3b9377){_0x2eb5a3[_0x7b7e('0x21')]=_0x3b9377;if(_0x16d369['query']['includeAll']){_0x21d4ca[_0x7b7e('0x57')]=[{'all':!![]}];}else{_0x21d4ca[_0x7b7e('0x57')]=[{'model':db['CmContact'],'as':_0x7b7e('0xef'),'required':![]},{'model':db[_0x7b7e('0xd1')],'as':'Attachments','required':![]}];}return db[_0x7b7e('0x121')][_0x7b7e('0x44')](_0x21d4ca);})[_0x7b7e('0x24')](function(_0x58f17c){_0x2eb5a3[_0x7b7e('0x45')]=_0x58f17c;return _0x2eb5a3;});}})[_0x7b7e('0x24')](respondWithFilteredResult(_0x51a98f,_0x21d4ca))[_0x7b7e('0x46')](handleError(_0x51a98f,null));};exports[_0x7b7e('0x122')]=function(_0x1b4510,_0x5581d2){return db[_0x7b7e('0x30')][_0x7b7e('0x4a')]({'where':{'id':_0x1b4510[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x5581d2,null))[_0x7b7e('0x24')](function(_0x1febae){if(_0x1febae){return _0x1febae[_0x7b7e('0x122')](_0x1b4510[_0x7b7e('0x50')]['ids'],_[_0x7b7e('0x11b')](_0x1b4510[_0x7b7e('0x50')],[_0x7b7e('0x59'),'id'])||{})[_0x7b7e('0xc5')](function(_0x386416){for(var _0x6297b1=0x0;_0x6297b1<_0x1b4510[_0x7b7e('0x50')][_0x7b7e('0x59')][_0x7b7e('0x54')];_0x6297b1+=0x1){socket[_0x7b7e('0x123')]('userChatWebsite:save',{'UserId':Number(_0x1b4510['body'][_0x7b7e('0x59')][_0x6297b1]),'ChatWebsiteId':Number(_0x1b4510[_0x7b7e('0x47')]['id'])});}return _0x386416;});}})[_0x7b7e('0x24')](respondWithResult(_0x5581d2,null))[_0x7b7e('0x46')](handleError(_0x5581d2,null));};exports[_0x7b7e('0x124')]=function(_0xd1688a,_0x43a6a5){return db[_0x7b7e('0x30')][_0x7b7e('0x4a')]({'where':{'id':_0xd1688a[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x43a6a5,null))[_0x7b7e('0x24')](function(_0x444b73){if(_0x444b73){return _0x444b73['removeAgents'](_0xd1688a[_0x7b7e('0x35')][_0x7b7e('0x59')])[_0x7b7e('0x24')](function(){if(_[_0x7b7e('0x125')](_0xd1688a['query'][_0x7b7e('0x59')])){for(var _0x2eef95=0x0;_0x2eef95<_0xd1688a['query']['ids'][_0x7b7e('0x54')];_0x2eef95+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0xd1688a[_0x7b7e('0x35')][_0x7b7e('0x59')][_0x2eef95]),'ChatWebsiteId':Number(_0xd1688a[_0x7b7e('0x47')]['id'])});}}else{socket[_0x7b7e('0x123')](_0x7b7e('0x126'),{'UserId':Number(_0xd1688a['query'][_0x7b7e('0x59')]),'ChatWebsiteId':Number(_0xd1688a[_0x7b7e('0x47')]['id'])});}});}})[_0x7b7e('0x24')](respondWithStatusCode(_0x43a6a5,null))[_0x7b7e('0x46')](handleError(_0x43a6a5,null));};exports[_0x7b7e('0x127')]=function(_0x3947ea,_0x58c9e7){var _0x439bda={};var _0x11526f={};var _0x37fd3e;var _0x6f772;return db[_0x7b7e('0x30')][_0x7b7e('0x5d')]({'where':{'id':_0x3947ea[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x58c9e7,null))[_0x7b7e('0x24')](function(_0x1c3415){if(_0x1c3415){_0x37fd3e=_0x1c3415;_0x11526f[_0x7b7e('0x34')]=_['keys'](db['User'][_0x7b7e('0x48')]);_0x11526f[_0x7b7e('0x35')]=_['keys'](_0x3947ea['query']);_0x11526f[_0x7b7e('0x3e')]=_[_0x7b7e('0x37')](_0x11526f[_0x7b7e('0x34')],_0x11526f[_0x7b7e('0x35')]);_0x439bda[_0x7b7e('0x38')]=_['intersection'](_0x11526f['model'],qs['fields'](_0x3947ea[_0x7b7e('0x35')][_0x7b7e('0x39')]));_0x439bda['attributes']=_0x439bda[_0x7b7e('0x38')]['length']?_0x439bda['attributes']:_0x11526f[_0x7b7e('0x34')];_0x439bda['order']=qs['sort'](_0x3947ea[_0x7b7e('0x35')][_0x7b7e('0x3c')]);_0x439bda[_0x7b7e('0x40')]=qs['filters'](_[_0x7b7e('0x3d')](_0x3947ea['query'],_0x11526f['filters']));if(_0x3947ea[_0x7b7e('0x35')]['filter']){_0x439bda[_0x7b7e('0x40')]=_['merge'](_0x439bda[_0x7b7e('0x40')],{'$or':_[_0x7b7e('0x2f')](_0x439bda[_0x7b7e('0x38')],function(_0x592624){var _0x1a0cd7={};_0x1a0cd7[_0x592624]={'$like':'%'+_0x3947ea[_0x7b7e('0x35')]['filter']+'%'};return _0x1a0cd7;})});}_0x439bda=_[_0x7b7e('0x41')]({},_0x439bda,_0x3947ea[_0x7b7e('0x49')]);return _0x37fd3e[_0x7b7e('0x127')](_0x439bda);}})['then'](function(_0x2b4c67){if(_0x2b4c67){_0x6f772=_0x2b4c67['length'];if(!_0x3947ea['query']['hasOwnProperty'](_0x7b7e('0x3b'))){_0x439bda[_0x7b7e('0x20')]=qs[_0x7b7e('0x20')](_0x3947ea[_0x7b7e('0x35')][_0x7b7e('0x20')]);_0x439bda[_0x7b7e('0x1e')]=qs[_0x7b7e('0x1e')](_0x3947ea[_0x7b7e('0x35')][_0x7b7e('0x1e')]);}return _0x37fd3e[_0x7b7e('0x127')](_0x439bda);}})[_0x7b7e('0x24')](function(_0x2ee403){if(_0x2ee403){return _0x2ee403?{'count':_0x6f772,'rows':_0x2ee403}:null;}})['then'](respondWithResult(_0x58c9e7,null))[_0x7b7e('0x46')](handleError(_0x58c9e7,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 8f38ba4..2ecc2d0 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 _0x25b0=['events','../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0xcee81d,_0xe79deb){var _0x2781f4=function(_0x54cc91){while(--_0x54cc91){_0xcee81d['push'](_0xcee81d['shift']());}};_0x2781f4(++_0xe79deb);}(_0x25b0,0x140));var _0x025b=function(_0x286726,_0x20a337){_0x286726=_0x286726-0x0;var _0xcd4fe9=_0x25b0[_0x286726];return _0xcd4fe9;};'use strict';var EventEmitter=require(_0x025b('0x0'));var ChatWebsite=require(_0x025b('0x1'))['db'][_0x025b('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x025b('0x3')](0x0);var events={'afterCreate':_0x025b('0x4'),'afterUpdate':_0x025b('0x5'),'afterDestroy':_0x025b('0x6')};function emitEvent(_0x1c2c48){return function(_0x86752b,_0x286601,_0x516a8d){ChatWebsiteEvents[_0x025b('0x7')](_0x1c2c48+':'+_0x86752b['id'],_0x86752b);ChatWebsiteEvents[_0x025b('0x7')](_0x1c2c48,_0x86752b);_0x516a8d(null);};}for(var e in events){if(events[_0x025b('0x8')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x025b('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0xbcc7=['hook','exports','events','../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x4fb334,_0x4ca8c9){var _0x56dc84=function(_0x470d7b){while(--_0x470d7b){_0x4fb334['push'](_0x4fb334['shift']());}};_0x56dc84(++_0x4ca8c9);}(_0xbcc7,0x19a));var _0x7bcc=function(_0x44d961,_0x29a215){_0x44d961=_0x44d961-0x0;var _0x4154fd=_0xbcc7[_0x44d961];return _0x4154fd;};'use strict';var EventEmitter=require(_0x7bcc('0x0'));var ChatWebsite=require(_0x7bcc('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x7bcc('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7bcc('0x3')};function emitEvent(_0x4bbf6b){return function(_0x24bc1a,_0x3692c2,_0x55c176){ChatWebsiteEvents[_0x7bcc('0x4')](_0x4bbf6b+':'+_0x24bc1a['id'],_0x24bc1a);ChatWebsiteEvents[_0x7bcc('0x4')](_0x4bbf6b,_0x24bc1a);_0x55c176(null);};}for(var e in events){if(events[_0x7bcc('0x5')](e)){var event=events[e];ChatWebsite[_0x7bcc('0x6')](e,emitEvent(event));}}module[_0x7bcc('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 7e413f8..d363a8a 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 _0xb667=['chat_websites','util','../../config/logger','api','moment','bluebird','request-promise','path','ChatWebsite'];(function(_0x1dfa55,_0x1d2007){var _0x893d0e=function(_0x30cace){while(--_0x30cace){_0x1dfa55['push'](_0x1dfa55['shift']());}};_0x893d0e(++_0x1d2007);}(_0xb667,0x121));var _0x7b66=function(_0x5572d5,_0x592da6){_0x5572d5=_0x5572d5-0x0;var _0x2a80fd=_0xb667[_0x5572d5];return _0x2a80fd;};'use strict';var _=require('lodash');var util=require(_0x7b66('0x0'));var logger=require(_0x7b66('0x1'))(_0x7b66('0x2'));var moment=require(_0x7b66('0x3'));var BPromise=require(_0x7b66('0x4'));var rp=require(_0x7b66('0x5'));var fs=require('fs');var path=require(_0x7b66('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x338164,_0x63779d){return _0x338164['define'](_0x7b66('0x7'),attributes,{'tableName':_0x7b66('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23a8=['./chatWebsite.attributes','define','chat_websites','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x23a8,0x163));var _0x823a=function(_0x253ccd,_0x3702ad){_0x253ccd=_0x253ccd-0x0;var _0x4f9cc8=_0x23a8[_0x253ccd];return _0x4f9cc8;};'use strict';var _=require(_0x823a('0x0'));var util=require(_0x823a('0x1'));var logger=require(_0x823a('0x2'))(_0x823a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x823a('0x4'));var fs=require('fs');var path=require(_0x823a('0x5'));var rimraf=require(_0x823a('0x6'));var config=require(_0x823a('0x7'));var attributes=require(_0x823a('0x8'));module['exports']=function(_0x570758,_0x2f630d){return _0x570758[_0x823a('0x9')]('ChatWebsite',attributes,{'tableName':_0x823a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 91bb3ef..7b455cb 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 _0x5bb9=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','request','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x5bb9,0x18d));var _0x95bb=function(_0x138d2e,_0x336360){_0x138d2e=_0x138d2e-0x0;var _0x4e2647=_0x5bb9[_0x138d2e];return _0x4e2647;};'use strict';var _=require(_0x95bb('0x0'));var util=require(_0x95bb('0x1'));var moment=require(_0x95bb('0x2'));var BPromise=require(_0x95bb('0x3'));var rs=require(_0x95bb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x95bb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x95bb('0x6'))(_0x95bb('0x7'));var config=require('../../config/environment');var jayson=require(_0x95bb('0x8'));var client=jayson[_0x95bb('0x9')]['http']({'port':0x232a});config[_0x95bb('0xa')]=_[_0x95bb('0xb')](config[_0x95bb('0xa')],{'host':_0x95bb('0xc'),'port':0x18eb});var socket=require(_0x95bb('0xd'))(new Redis(config[_0x95bb('0xa')]));require('./chatWebsite.socket')['register'](socket);function respondWithRpcPromise(_0x1d8634,_0x55952b,_0x59839d){return new BPromise(function(_0x23debe,_0x4460b7){return client[_0x95bb('0xe')](_0x1d8634,_0x59839d)['then'](function(_0x23380e){logger[_0x95bb('0xf')](_0x95bb('0x10'),_0x55952b,'request\x20sent');logger[_0x95bb('0x11')](_0x95bb('0x12'),_0x55952b,_0x95bb('0x13'),JSON[_0x95bb('0x14')](_0x23380e));if(_0x23380e['error']){if(_0x23380e[_0x95bb('0x15')][_0x95bb('0x16')]===0x1f4){logger[_0x95bb('0x15')](_0x95bb('0x10'),_0x55952b,_0x23380e[_0x95bb('0x15')][_0x95bb('0x17')]);return _0x4460b7(_0x23380e[_0x95bb('0x15')][_0x95bb('0x17')]);}logger[_0x95bb('0x15')](_0x95bb('0x10'),_0x55952b,_0x23380e[_0x95bb('0x15')][_0x95bb('0x17')]);return _0x23debe(_0x23380e[_0x95bb('0x15')]['message']);}else{logger[_0x95bb('0xf')]('ChatWebsite,\x20%s,\x20%s',_0x55952b,_0x95bb('0x13'));_0x23debe(_0x23380e[_0x95bb('0x18')]['message']);}})['catch'](function(_0x230ad7){logger[_0x95bb('0x15')](_0x95bb('0x10'),_0x55952b,_0x230ad7);_0x4460b7(_0x230ad7);});});} \ No newline at end of file +var _0x5939=['../../config/utils','rpc','../../config/environment','client','defaults','redis','localhost','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','util','moment','randomstring','../../mysqldb'];(function(_0xa7c370,_0x2de929){var _0x206e54=function(_0x5ae91f){while(--_0x5ae91f){_0xa7c370['push'](_0xa7c370['shift']());}};_0x206e54(++_0x2de929);}(_0x5939,0x11a));var _0x9593=function(_0x1e95fe,_0x138cd5){_0x1e95fe=_0x1e95fe-0x0;var _0xaaafc8=_0x5939[_0x1e95fe];return _0xaaafc8;};'use strict';var _=require('lodash');var util=require(_0x9593('0x0'));var moment=require(_0x9593('0x1'));var BPromise=require('bluebird');var rs=require(_0x9593('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9593('0x3'))['db'];var utils=require(_0x9593('0x4'));var logger=require('../../config/logger')(_0x9593('0x5'));var config=require(_0x9593('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9593('0x7')]['http']({'port':0x232a});config['redis']=_[_0x9593('0x8')](config[_0x9593('0x9')],{'host':_0x9593('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9593('0x9')]));require(_0x9593('0xb'))[_0x9593('0xc')](socket);function respondWithRpcPromise(_0x1f34f0,_0x2908d8,_0x3ea2d4){return new BPromise(function(_0x153e15,_0x421245){return client[_0x9593('0xd')](_0x1f34f0,_0x3ea2d4)[_0x9593('0xe')](function(_0x1a79ec){logger[_0x9593('0xf')](_0x9593('0x10'),_0x2908d8,_0x9593('0x11'));logger['debug'](_0x9593('0x12'),_0x2908d8,'request\x20sent',JSON['stringify'](_0x1a79ec));if(_0x1a79ec[_0x9593('0x13')]){if(_0x1a79ec['error'][_0x9593('0x14')]===0x1f4){logger['error'](_0x9593('0x10'),_0x2908d8,_0x1a79ec[_0x9593('0x13')][_0x9593('0x15')]);return _0x421245(_0x1a79ec[_0x9593('0x13')]['message']);}logger['error'](_0x9593('0x10'),_0x2908d8,_0x1a79ec[_0x9593('0x13')]['message']);return _0x153e15(_0x1a79ec[_0x9593('0x13')][_0x9593('0x15')]);}else{logger[_0x9593('0xf')](_0x9593('0x10'),_0x2908d8,'request\x20sent');_0x153e15(_0x1a79ec['result'][_0x9593('0x15')]);}})['catch'](function(_0x5e63cc){logger[_0x9593('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x2908d8,_0x5e63cc);_0x421245(_0x5e63cc);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 11e8a7b..3fca5ab 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 _0x74c4=['update','emit','removeListener','length','./chatWebsite.events','save','remove'];(function(_0x2f5d2f,_0x553fc5){var _0x1292e9=function(_0x117d77){while(--_0x117d77){_0x2f5d2f['push'](_0x2f5d2f['shift']());}};_0x1292e9(++_0x553fc5);}(_0x74c4,0x1af));var _0x474c=function(_0x246a86,_0x3bb3e9){_0x246a86=_0x246a86-0x0;var _0x219026=_0x74c4[_0x246a86];return _0x219026;};'use strict';var ChatWebsiteEvents=require(_0x474c('0x0'));var events=[_0x474c('0x1'),_0x474c('0x2'),_0x474c('0x3')];function createListener(_0x28377b,_0x39ca9f){return function(_0x40d89f){_0x39ca9f[_0x474c('0x4')](_0x28377b,_0x40d89f);};}function removeListener(_0x3adcc4,_0xca8fec){return function(){ChatWebsiteEvents[_0x474c('0x5')](_0x3adcc4,_0xca8fec);};}exports['register']=function(_0x52ce54){for(var _0x3b92fe=0x0,_0x587e75=events[_0x474c('0x6')];_0x3b92fe<_0x587e75;_0x3b92fe++){var _0x587578=events[_0x3b92fe];var _0x2893d1=createListener('chatWebsite:'+_0x587578,_0x52ce54);ChatWebsiteEvents['on'](_0x587578,_0x2893d1);}}; \ No newline at end of file +var _0x59f3=['register','length','chatWebsite:','save','remove','update','removeListener'];(function(_0x5cd2a0,_0x284c78){var _0x260959=function(_0x46c1b4){while(--_0x46c1b4){_0x5cd2a0['push'](_0x5cd2a0['shift']());}};_0x260959(++_0x284c78);}(_0x59f3,0xe3));var _0x359f=function(_0xa4928c,_0x16b89c){_0xa4928c=_0xa4928c-0x0;var _0x27cc29=_0x59f3[_0xa4928c];return _0x27cc29;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x359f('0x0'),_0x359f('0x1'),_0x359f('0x2')];function createListener(_0x24ff6e,_0x47cd02){return function(_0x5ded5d){_0x47cd02['emit'](_0x24ff6e,_0x5ded5d);};}function removeListener(_0x18d709,_0x5812db){return function(){ChatWebsiteEvents[_0x359f('0x3')](_0x18d709,_0x5812db);};}exports[_0x359f('0x4')]=function(_0x3ed6e8){for(var _0x36ca27=0x0,_0x470a6d=events[_0x359f('0x5')];_0x36ca27<_0x470a6d;_0x36ca27++){var _0x1abbe7=events[_0x36ca27];var _0x168ddd=createListener(_0x359f('0x6')+_0x1abbe7,_0x3ed6e8);ChatWebsiteEvents['on'](_0x1abbe7,_0x168ddd);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index e569f48..1a2f1d7 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 _0x837d=['removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','/:id/applications','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','join','root','server/files/images/logos/','now','originalname','single','file','addLogo','diskStorage','format','%s-%s','addAvatar','server/files/images/avatars/','/:id/customer_avatar','addSystemAvatar','/:id/notify','server/files','attachments','offline-chat','replace','extname','/:id/offline','offline','addApplications','/:id/proactive_actions','addAgents','put','destroy','delete'];(function(_0x1b40f1,_0x1e2cab){var _0x1950d0=function(_0x2c0011){while(--_0x2c0011){_0x1b40f1['push'](_0x1b40f1['shift']());}};_0x1950d0(++_0x1e2cab);}(_0x837d,0x171));var _0xd837=function(_0x292e18,_0x166e87){_0x292e18=_0x292e18-0x0;var _0x81ec67=_0x837d[_0x292e18];return _0x81ec67;};'use strict';var multer=require(_0xd837('0x0'));var util=require('util');var path=require(_0xd837('0x1'));var timeout=require(_0xd837('0x2'));var express=require(_0xd837('0x3'));var router=express['Router']();var fs_extra=require(_0xd837('0x4'));var auth=require(_0xd837('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd837('0x6'));var controller=require(_0xd837('0x7'));router[_0xd837('0x8')]('/',auth[_0xd837('0x9')](),controller[_0xd837('0xa')]);router[_0xd837('0x8')](_0xd837('0xb'),auth[_0xd837('0x9')](),controller[_0xd837('0xc')]);router[_0xd837('0x8')](_0xd837('0xd'),auth[_0xd837('0x9')](),controller[_0xd837('0xe')]);router[_0xd837('0x8')](_0xd837('0xf'),auth['isAuthenticated'](),controller[_0xd837('0x10')]);router[_0xd837('0x8')](_0xd837('0x11'),auth[_0xd837('0x9')](),controller[_0xd837('0x12')]);router[_0xd837('0x8')](_0xd837('0x13'),controller[_0xd837('0x14')]);router['get'](_0xd837('0x15'),controller[_0xd837('0x16')]);router['get']('/:id/customer_avatar',controller[_0xd837('0x17')]);router[_0xd837('0x8')](_0xd837('0x18'),controller[_0xd837('0x19')]);router[_0xd837('0x8')](_0xd837('0x1a'),auth[_0xd837('0x9')](),controller['getInteractions']);router[_0xd837('0x8')](_0xd837('0x1b'),controller[_0xd837('0x1c')]);router[_0xd837('0x8')](_0xd837('0x1d'),auth[_0xd837('0x9')](),controller['getApplications']);router[_0xd837('0x8')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0xd837('0x1e')]);router['get'](_0xd837('0x1f'),controller[_0xd837('0x20')]);router[_0xd837('0x8')](_0xd837('0x21'),auth['isAuthenticated'](),controller[_0xd837('0x22')]);router['get'](_0xd837('0x23'),auth[_0xd837('0x9')](),controller[_0xd837('0x24')]);router[_0xd837('0x25')]('/',auth['isAuthenticated'](),controller[_0xd837('0x26')]);router[_0xd837('0x25')]('/:id/dispositions',auth[_0xd837('0x9')](),controller[_0xd837('0x27')]);router[_0xd837('0x25')](_0xd837('0x11'),auth['isAuthenticated'](),controller['addAnswer']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1ba313,_0x4ae0c1,_0x2642e6){_0x2642e6(null,path[_0xd837('0x28')](config[_0xd837('0x29')],_0xd837('0x2a')));},'filename':function(_0x427e62,_0x1e4b8d,_0x193cd6){_0x193cd6(null,util['format']('%s-%s',Date[_0xd837('0x2b')](),_0x1e4b8d[_0xd837('0x2c')]));}})});router[_0xd837('0x25')](_0xd837('0x13'),upload[_0xd837('0x2d')](_0xd837('0x2e')),controller[_0xd837('0x2f')]);var upload=multer({'storage':multer[_0xd837('0x30')]({'destination':function(_0x35ec9e,_0xe233c,_0x182861){_0x182861(null,path['join'](config[_0xd837('0x29')],'server/files/images/avatars/'));},'filename':function(_0x13c822,_0x967285,_0x3dea01){_0x3dea01(null,util[_0xd837('0x31')](_0xd837('0x32'),Date[_0xd837('0x2b')](),_0x967285[_0xd837('0x2c')]));}})});router[_0xd837('0x25')](_0xd837('0x15'),upload[_0xd837('0x2d')](_0xd837('0x2e')),controller[_0xd837('0x33')]);var upload=multer({'storage':multer[_0xd837('0x30')]({'destination':function(_0x503bfb,_0x551dff,_0xae0b57){_0xae0b57(null,path[_0xd837('0x28')](config[_0xd837('0x29')],_0xd837('0x34')));},'filename':function(_0x2ec3e6,_0x1d5330,_0x311dab){_0x311dab(null,util[_0xd837('0x31')]('%s-%s',Date[_0xd837('0x2b')](),_0x1d5330[_0xd837('0x2c')]));}})});router['post'](_0xd837('0x35'),upload['single'](_0xd837('0x2e')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xd837('0x30')]({'destination':function(_0x59d23c,_0x2f6a76,_0x3b2db2){_0x3b2db2(null,path[_0xd837('0x28')](config[_0xd837('0x29')],_0xd837('0x34')));},'filename':function(_0x42c022,_0x2f1540,_0x191079){_0x191079(null,util['format'](_0xd837('0x32'),Date[_0xd837('0x2b')](),_0x2f1540[_0xd837('0x2c')]));}})});router[_0xd837('0x25')](_0xd837('0x18'),upload['single'](_0xd837('0x2e')),controller[_0xd837('0x36')]);router['post'](_0xd837('0x37'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xd837('0x30')]({'destination':function(_0x3c1640,_0x3d7111,_0x9dfd06){const _0x8cef94=path['join'](config[_0xd837('0x29')],_0xd837('0x38'),_0xd837('0x39'),_0xd837('0x3a'));fs_extra['ensureDir'](_0x8cef94,function(){_0x9dfd06(null,_0x8cef94);});},'filename':function(_0x24466f,_0x315061,_0x5c1e09){const _0xb506d5=_0x315061[_0xd837('0x2c')][_0xd837('0x3b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1f1c96=path[_0xd837('0x3c')](_0xb506d5);const _0x78d93a=Date[_0xd837('0x2b')]()+'-'+_0xb506d5[_0xd837('0x3b')](_0x1f1c96,'')+_0x1f1c96;_0x5c1e09(null,_0x78d93a);}})});router[_0xd837('0x25')](_0xd837('0x3d'),offlineUploadMulter['any'](),controller[_0xd837('0x3e')]);router['post'](_0xd837('0x1a'),auth[_0xd837('0x9')](),controller['addInteraction']);router['post'](_0xd837('0x1d'),auth[_0xd837('0x9')](),controller[_0xd837('0x3f')]);router[_0xd837('0x25')](_0xd837('0x40'),auth[_0xd837('0x9')](),controller['addProactiveActions']);router[_0xd837('0x25')](_0xd837('0x23'),auth['isAuthenticated'](),controller[_0xd837('0x41')]);router[_0xd837('0x42')](_0xd837('0xd'),auth[_0xd837('0x9')](),controller['update']);router['delete'](_0xd837('0xd'),auth[_0xd837('0x9')](),controller[_0xd837('0x43')]);router[_0xd837('0x44')](_0xd837('0xf'),auth['isAuthenticated'](),controller[_0xd837('0x45')]);router[_0xd837('0x44')](_0xd837('0x11'),auth['isAuthenticated'](),controller[_0xd837('0x46')]);router['delete'](_0xd837('0x23'),auth[_0xd837('0x9')](),controller[_0xd837('0x47')]);module[_0xd837('0x48')]=router; \ No newline at end of file +var _0x68ae=['/:id/avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','/:id/dispositions','addDisposition','join','format','now','originalname','file','addLogo','diskStorage','root','server/files/images/avatars/','%s-%s','single','addAvatar','/:id/customer_avatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','ensureDir','replace','extname','/:id/offline','any','addInteraction','addProactiveActions','addAgents','/:id','delete','destroy','/:id/canned_answers','removeAnswers','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','/describe','show','getDispositions','getAnswers','getLogo'];(function(_0x3b5ad9,_0x223867){var _0x611ae9=function(_0x1c5e28){while(--_0x1c5e28){_0x3b5ad9['push'](_0x3b5ad9['shift']());}};_0x611ae9(++_0x223867);}(_0x68ae,0x18c));var _0xe68a=function(_0x2c03a4,_0x1f06c8){_0x2c03a4=_0x2c03a4-0x0;var _0x582aad=_0x68ae[_0x2c03a4];return _0x582aad;};'use strict';var multer=require(_0xe68a('0x0'));var util=require(_0xe68a('0x1'));var path=require(_0xe68a('0x2'));var timeout=require(_0xe68a('0x3'));var express=require(_0xe68a('0x4'));var router=express['Router']();var fs_extra=require(_0xe68a('0x5'));var auth=require(_0xe68a('0x6'));var interaction=require(_0xe68a('0x7'));var config=require(_0xe68a('0x8'));var controller=require(_0xe68a('0x9'));router['get']('/',auth[_0xe68a('0xa')](),controller[_0xe68a('0xb')]);router[_0xe68a('0xc')](_0xe68a('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0xe68a('0xc')]('/:id',auth[_0xe68a('0xa')](),controller[_0xe68a('0xe')]);router[_0xe68a('0xc')]('/:id/dispositions',auth[_0xe68a('0xa')](),controller[_0xe68a('0xf')]);router[_0xe68a('0xc')]('/:id/canned_answers',auth[_0xe68a('0xa')](),controller[_0xe68a('0x10')]);router['get']('/:id/logo',controller[_0xe68a('0x11')]);router[_0xe68a('0xc')](_0xe68a('0x12'),controller['getAvatar']);router[_0xe68a('0xc')]('/:id/customer_avatar',controller[_0xe68a('0x13')]);router[_0xe68a('0xc')](_0xe68a('0x14'),controller[_0xe68a('0x15')]);router[_0xe68a('0xc')](_0xe68a('0x16'),auth['isAuthenticated'](),controller[_0xe68a('0x17')]);router['get'](_0xe68a('0x18'),controller['getSnippet']);router[_0xe68a('0xc')](_0xe68a('0x19'),auth['isAuthenticated'](),controller['getApplications']);router[_0xe68a('0xc')](_0xe68a('0x1a'),auth[_0xe68a('0xa')](),controller[_0xe68a('0x1b')]);router['get'](_0xe68a('0x1c'),controller[_0xe68a('0x1d')]);router[_0xe68a('0xc')](_0xe68a('0x1e'),auth['isAuthenticated'](),controller[_0xe68a('0x1f')]);router[_0xe68a('0xc')](_0xe68a('0x20'),auth[_0xe68a('0xa')](),controller[_0xe68a('0x21')]);router[_0xe68a('0x22')]('/',auth[_0xe68a('0xa')](),controller['create']);router[_0xe68a('0x22')](_0xe68a('0x23'),auth['isAuthenticated'](),controller[_0xe68a('0x24')]);router[_0xe68a('0x22')]('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3cb2be,_0x510c9e,_0x2c01f0){_0x2c01f0(null,path[_0xe68a('0x25')](config['root'],'server/files/images/logos/'));},'filename':function(_0x261110,_0x5607b2,_0x1af68d){_0x1af68d(null,util[_0xe68a('0x26')]('%s-%s',Date[_0xe68a('0x27')](),_0x5607b2[_0xe68a('0x28')]));}})});router['post']('/:id/logo',upload['single'](_0xe68a('0x29')),controller[_0xe68a('0x2a')]);var upload=multer({'storage':multer[_0xe68a('0x2b')]({'destination':function(_0x31c416,_0x378da0,_0x5f1dc5){_0x5f1dc5(null,path[_0xe68a('0x25')](config[_0xe68a('0x2c')],_0xe68a('0x2d')));},'filename':function(_0x5fb05d,_0x483313,_0x13ce23){_0x13ce23(null,util[_0xe68a('0x26')](_0xe68a('0x2e'),Date[_0xe68a('0x27')](),_0x483313[_0xe68a('0x28')]));}})});router[_0xe68a('0x22')]('/:id/avatar',upload[_0xe68a('0x2f')]('file'),controller[_0xe68a('0x30')]);var upload=multer({'storage':multer[_0xe68a('0x2b')]({'destination':function(_0x58e04c,_0x145429,_0x5e85b0){_0x5e85b0(null,path[_0xe68a('0x25')](config['root'],_0xe68a('0x2d')));},'filename':function(_0x25b060,_0x451fdc,_0x244708){_0x244708(null,util[_0xe68a('0x26')](_0xe68a('0x2e'),Date[_0xe68a('0x27')](),_0x451fdc[_0xe68a('0x28')]));}})});router[_0xe68a('0x22')](_0xe68a('0x31'),upload['single'](_0xe68a('0x29')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xe68a('0x2b')]({'destination':function(_0xb4982a,_0x4c51aa,_0x57481f){_0x57481f(null,path['join'](config[_0xe68a('0x2c')],'server/files/images/avatars/'));},'filename':function(_0x5d763a,_0x375822,_0x23619f){_0x23619f(null,util[_0xe68a('0x26')](_0xe68a('0x2e'),Date[_0xe68a('0x27')](),_0x375822[_0xe68a('0x28')]));}})});router[_0xe68a('0x22')]('/:id/system_avatar',upload[_0xe68a('0x2f')]('file'),controller[_0xe68a('0x32')]);router[_0xe68a('0x22')](_0xe68a('0x33'),controller[_0xe68a('0x34')]);const offlineUploadMulter=multer({'storage':multer[_0xe68a('0x2b')]({'destination':function(_0x33c747,_0x56a5c2,_0x5bd115){const _0xfa45f3=path[_0xe68a('0x25')](config[_0xe68a('0x2c')],_0xe68a('0x35'),_0xe68a('0x36'),'offline-chat');fs_extra[_0xe68a('0x37')](_0xfa45f3,function(){_0x5bd115(null,_0xfa45f3);});},'filename':function(_0x5824ab,_0x2a4a14,_0xc75a8){const _0x599d30=_0x2a4a14['originalname'][_0xe68a('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x934ce9=path[_0xe68a('0x39')](_0x599d30);const _0x11d1f0=Date['now']()+'-'+_0x599d30['replace'](_0x934ce9,'')+_0x934ce9;_0xc75a8(null,_0x11d1f0);}})});router['post'](_0xe68a('0x3a'),offlineUploadMulter[_0xe68a('0x3b')](),controller['offline']);router[_0xe68a('0x22')](_0xe68a('0x16'),auth[_0xe68a('0xa')](),controller[_0xe68a('0x3c')]);router[_0xe68a('0x22')](_0xe68a('0x19'),auth[_0xe68a('0xa')](),controller['addApplications']);router['post'](_0xe68a('0x1a'),auth['isAuthenticated'](),controller[_0xe68a('0x3d')]);router['post'](_0xe68a('0x20'),auth[_0xe68a('0xa')](),controller[_0xe68a('0x3e')]);router['put'](_0xe68a('0x3f'),auth[_0xe68a('0xa')](),controller['update']);router[_0xe68a('0x40')](_0xe68a('0x3f'),auth[_0xe68a('0xa')](),controller[_0xe68a('0x41')]);router['delete'](_0xe68a('0x23'),auth[_0xe68a('0xa')](),controller['removeDispositions']);router['delete'](_0xe68a('0x42'),auth[_0xe68a('0xa')](),controller[_0xe68a('0x43')]);router[_0xe68a('0x40')](_0xe68a('0x20'),auth[_0xe68a('0xa')](),controller['removeAgents']);module[_0xe68a('0x44')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 4285759..c81bb13 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 _0x3239=['AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM'];(function(_0x3a03a5,_0x468eb5){var _0x343768=function(_0x1fb9fb){while(--_0x1fb9fb){_0x3a03a5['push'](_0x3a03a5['shift']());}};_0x343768(++_0x468eb5);}(_0x3239,0xcc));var _0x9323=function(_0x4ab341,_0x43b4f8){_0x4ab341=_0x4ab341-0x0;var _0x12eb77=_0x3239[_0x4ab341];return _0x12eb77;};'use strict';var Sequelize=require(_0x9323('0x0'));module[_0x9323('0x1')]={'name':{'type':Sequelize[_0x9323('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x9323('0x3')](_0x9323('0x4'),_0x9323('0x5'),_0x9323('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x9323('0x7'),_0x9323('0x8'))},'data1':{'type':Sequelize[_0x9323('0x2')],'comment':_0x9323('0x9')},'data2':{'type':Sequelize[_0x9323('0x2')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0x9323('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize['STRING'],'comment':_0x9323('0xa')},'data5':{'type':Sequelize[_0x9323('0xb')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0x9323('0xb')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x9323('0xb')],'comment':_0x9323('0xc')}}; \ No newline at end of file +var _0x8ede=['Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure'];(function(_0x550835,_0x42002e){var _0x2ebe5f=function(_0x332a39){while(--_0x332a39){_0x550835['push'](_0x550835['shift']());}};_0x2ebe5f(++_0x42002e);}(_0x8ede,0x145));var _0xe8ed=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8ede[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe8ed('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xe8ed('0x1')](_0xe8ed('0x2'),_0xe8ed('0x3'),_0xe8ed('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xe8ed('0x1')](_0xe8ed('0x5'),_0xe8ed('0x6'))},'data1':{'type':Sequelize[_0xe8ed('0x0')],'comment':_0xe8ed('0x7')},'data2':{'type':Sequelize[_0xe8ed('0x0')],'comment':_0xe8ed('0x8')},'data3':{'type':Sequelize[_0xe8ed('0x0')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0xe8ed('0x0')],'comment':_0xe8ed('0x9')},'data5':{'type':Sequelize[_0xe8ed('0xa')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0xe8ed('0xa')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0xe8ed('0xa')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index c660ae7..590664f 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 _0xd552=['Unable\x20to\x20validate\x20id_token','del','code','data5','data6','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','lodash','../../components/encryptor','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','error','stack','padEnd','slice','map','type','key','keys','query','filters','intersection','model','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL','name','include','CloudProvider','findAll','service','decryptString','data3','catch','rawAttributes','includeAll','options','find','MicrosoftAzure','body','Service\x20parameter\x20not\x20specified','values','includes','join','encryptString','create','params','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','state','Invalid\x20state\x20parameter','parse','from','toString','ascii','isValidIdToken'];(function(_0x1d50f2,_0x3c3ec6){var _0x3769b8=function(_0x50926a){while(--_0x50926a){_0x1d50f2['push'](_0x1d50f2['shift']());}};_0x3769b8(++_0x3c3ec6);}(_0xd552,0x1b4));var _0x2d55=function(_0x480c29,_0x2051db){_0x480c29=_0x480c29-0x0;var _0x1c5321=_0xd552[_0x480c29];return _0x1c5321;};'use strict';var _=require(_0x2d55('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var encryptor=require(_0x2d55('0x1'));var config=require('../../config/environment');var logger=require(_0x2d55('0x2'))(_0x2d55('0x3'));var db=require(_0x2d55('0x4'))['db'];var oauth=require('./cloudProvider.oauth');config['redis']=_['defaults'](config[_0x2d55('0x5')],{'host':_0x2d55('0x6'),'port':0x18eb});var socket=require(_0x2d55('0x7'))(new Redis(config['redis']));var redis=new Redis(config[_0x2d55('0x5')]);function respondWithStatusCode(_0x3f5d35,_0x10cb36){_0x10cb36=_0x10cb36||0xcc;return function(_0x2c895f){if(_0x2c895f){return _0x3f5d35[_0x2d55('0x8')](_0x10cb36);}return _0x3f5d35[_0x2d55('0x9')](_0x10cb36)[_0x2d55('0xa')]();};}function respondWithResult(_0x28646f,_0x3fa4bd){_0x3fa4bd=_0x3fa4bd||0xc8;return function(_0x166416){if(_0x166416){return _0x28646f[_0x2d55('0x9')](_0x3fa4bd)[_0x2d55('0xb')](_0x166416);}};}function respondWithFilteredResult(_0x82e8d4,_0x381dd8){return function(_0x1df21a){if(_0x1df21a){var _0x2badd7=typeof _0x381dd8['offset']===_0x2d55('0xc')&&typeof _0x381dd8[_0x2d55('0xd')]==='undefined';var _0x4b7f00=_0x1df21a[_0x2d55('0xe')];var _0xee9d96=_0x2badd7?0x0:_0x381dd8[_0x2d55('0xf')];var _0x28aa8c=_0x2badd7?_0x1df21a[_0x2d55('0xe')]:_0x381dd8[_0x2d55('0xf')]+_0x381dd8[_0x2d55('0xd')];var _0x328f91;if(_0x28aa8c>=_0x4b7f00){_0x28aa8c=_0x4b7f00;_0x328f91=0xc8;}else{_0x328f91=0xce;}_0x82e8d4[_0x2d55('0x9')](_0x328f91);return _0x82e8d4[_0x2d55('0x10')](_0x2d55('0x11'),_0xee9d96+'-'+_0x28aa8c+'/'+_0x4b7f00)[_0x2d55('0xb')](_0x1df21a);}return null;};}function saveUpdates(_0x22c315){return function(_0x466bd4){if(_0x466bd4){return _0x466bd4[_0x2d55('0x12')](_0x22c315)[_0x2d55('0x13')](function(_0x169a00){return _0x169a00;});}return null;};}function removeEntity(_0x138d18){return function(_0x518754){if(_0x518754){return _0x518754[_0x2d55('0x14')]()['then'](function(){_0x138d18[_0x2d55('0x9')](0xcc)[_0x2d55('0xa')]();});}};}function handleEntityNotFound(_0x3de4e6){return function(_0x362cae){if(!_0x362cae){_0x3de4e6[_0x2d55('0x8')](0x194);}return _0x362cae;};}function handleError(_0x18e16e,_0x4e4b55){_0x4e4b55=_0x4e4b55||0x1f4;return function(_0xa62cbe){logger[_0x2d55('0x15')](_0xa62cbe[_0x2d55('0x16')]);if(_0xa62cbe['name']){delete _0xa62cbe['name'];}_0x18e16e[_0x2d55('0x9')](_0x4e4b55)['send'](_0xa62cbe);};}function maskClientSecret(_0x25ec31){return _[_0x2d55('0x17')](_0x25ec31[_0x2d55('0x18')](0x0,0x3),0x14,'*');}exports['index']=function(_0x3ff3a8,_0x2e1299){var _0x4bc042={},_0x41d4fb={},_0x18f8fa={'count':0x0,'rows':[]};var _0x12f047=_[_0x2d55('0x19')](db['CloudProvider']['rawAttributes'],function(_0x4e608f){return{'name':_0x4e608f['fieldName'],'type':_0x4e608f[_0x2d55('0x1a')][_0x2d55('0x1b')]};});_0x41d4fb['model']=_['map'](_0x12f047,'name');_0x41d4fb['query']=_[_0x2d55('0x1c')](_0x3ff3a8[_0x2d55('0x1d')]);_0x41d4fb[_0x2d55('0x1e')]=_[_0x2d55('0x1f')](_0x41d4fb[_0x2d55('0x20')],_0x41d4fb[_0x2d55('0x1d')]);_0x4bc042[_0x2d55('0x21')]=_[_0x2d55('0x1f')](_0x41d4fb[_0x2d55('0x20')],qs['fields'](_0x3ff3a8[_0x2d55('0x1d')][_0x2d55('0x22')]));_0x4bc042[_0x2d55('0x21')]=_0x4bc042[_0x2d55('0x21')][_0x2d55('0x23')]?_0x4bc042[_0x2d55('0x21')]:_0x41d4fb[_0x2d55('0x20')];if(!_0x3ff3a8[_0x2d55('0x1d')]['hasOwnProperty']('nolimit')){_0x4bc042[_0x2d55('0xd')]=qs[_0x2d55('0xd')](_0x3ff3a8['query'][_0x2d55('0xd')]);_0x4bc042[_0x2d55('0xf')]=qs[_0x2d55('0xf')](_0x3ff3a8[_0x2d55('0x1d')][_0x2d55('0xf')]);}_0x4bc042[_0x2d55('0x24')]=qs[_0x2d55('0x25')](_0x3ff3a8[_0x2d55('0x1d')][_0x2d55('0x25')]);_0x4bc042[_0x2d55('0x26')]=qs[_0x2d55('0x1e')](_['pick'](_0x3ff3a8['query'],_0x41d4fb[_0x2d55('0x1e')]),_0x12f047);if(_0x3ff3a8[_0x2d55('0x1d')][_0x2d55('0x27')]){_0x4bc042[_0x2d55('0x26')]=_[_0x2d55('0x28')](_0x4bc042[_0x2d55('0x26')],{'$or':_[_0x2d55('0x19')](_0x12f047,function(_0x24756d){if(_0x24756d[_0x2d55('0x1a')]!==_0x2d55('0x29')){var _0x2d1553={};_0x2d1553[_0x24756d[_0x2d55('0x2a')]]={'$like':'%'+_0x3ff3a8[_0x2d55('0x1d')][_0x2d55('0x27')]+'%'};return _0x2d1553;}})});}_0x4bc042=_[_0x2d55('0x28')]({},_0x4bc042,_0x3ff3a8['options']);var _0xa0552={'where':_0x4bc042[_0x2d55('0x26')]};return db['CloudProvider'][_0x2d55('0xe')](_0xa0552)['then'](function(_0x543f8d){_0x18f8fa[_0x2d55('0xe')]=_0x543f8d;if(_0x3ff3a8[_0x2d55('0x1d')]['includeAll']){_0x4bc042[_0x2d55('0x2b')]=[{'all':!![]}];}return db[_0x2d55('0x2c')][_0x2d55('0x2d')](_0x4bc042);})[_0x2d55('0x13')](function(_0x5bbaf9){_0x18f8fa['rows']=_[_0x2d55('0x19')](_0x5bbaf9,function(_0x4a0023){if(_0x4a0023[_0x2d55('0x2e')]==='MicrosoftAzure'){var _0x598a83=encryptor[_0x2d55('0x2f')](_0x4a0023[_0x2d55('0x30')]);_0x4a0023[_0x2d55('0x30')]=maskClientSecret(_0x598a83);}return _0x4a0023;});return _0x18f8fa;})[_0x2d55('0x13')](respondWithFilteredResult(_0x2e1299,_0x4bc042))[_0x2d55('0x31')](handleError(_0x2e1299,null));};exports['show']=function(_0x5a9202,_0x29ddb4){var _0x6c9c95={'raw':!![],'where':{'id':_0x5a9202['params']['id']}},_0x1151a2={};_0x1151a2['model']=_[_0x2d55('0x1c')](db[_0x2d55('0x2c')][_0x2d55('0x32')]);_0x1151a2[_0x2d55('0x1d')]=_[_0x2d55('0x1c')](_0x5a9202['query']);_0x1151a2[_0x2d55('0x1e')]=_['intersection'](_0x1151a2[_0x2d55('0x20')],_0x1151a2[_0x2d55('0x1d')]);_0x6c9c95[_0x2d55('0x21')]=_[_0x2d55('0x1f')](_0x1151a2['model'],qs[_0x2d55('0x22')](_0x5a9202['query'][_0x2d55('0x22')]));_0x6c9c95[_0x2d55('0x21')]=_0x6c9c95[_0x2d55('0x21')][_0x2d55('0x23')]?_0x6c9c95[_0x2d55('0x21')]:_0x1151a2[_0x2d55('0x20')];if(_0x5a9202[_0x2d55('0x1d')][_0x2d55('0x33')]){_0x6c9c95['include']=[{'all':!![]}];}_0x6c9c95=_['merge']({},_0x6c9c95,_0x5a9202[_0x2d55('0x34')]);return db[_0x2d55('0x2c')][_0x2d55('0x35')](_0x6c9c95)[_0x2d55('0x13')](handleEntityNotFound(_0x29ddb4,null))[_0x2d55('0x13')](function(_0x27aeb7){if(_0x27aeb7[_0x2d55('0x2e')]===_0x2d55('0x36')){var _0x1005a4=encryptor['decryptString'](_0x27aeb7[_0x2d55('0x30')]);_0x27aeb7[_0x2d55('0x30')]=maskClientSecret(_0x1005a4);}return _0x27aeb7;})[_0x2d55('0x13')](respondWithResult(_0x29ddb4,null))[_0x2d55('0x31')](handleError(_0x29ddb4,null));};exports['create']=function(_0x5b43bb,_0x29ce21){if(!_0x5b43bb[_0x2d55('0x37')][_0x2d55('0x2a')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x5b43bb['body'][_0x2d55('0x2e')])throw new Error(_0x2d55('0x38'));var _0x43ef5e=db[_0x2d55('0x2c')][_0x2d55('0x32')][_0x2d55('0x2e')][_0x2d55('0x39')];if(!_0x43ef5e[_0x2d55('0x3a')](_0x5b43bb[_0x2d55('0x37')][_0x2d55('0x2e')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x43ef5e[_0x2d55('0x3b')](',\x20'));if(_0x5b43bb[_0x2d55('0x37')]['service']===_0x2d55('0x36')&&_0x5b43bb[_0x2d55('0x37')][_0x2d55('0x30')]){_0x5b43bb[_0x2d55('0x37')][_0x2d55('0x30')]=encryptor[_0x2d55('0x3c')](_0x5b43bb[_0x2d55('0x37')][_0x2d55('0x30')]);}return db[_0x2d55('0x2c')][_0x2d55('0x3d')](_0x5b43bb[_0x2d55('0x37')],{})[_0x2d55('0x13')](respondWithResult(_0x29ce21,0xc9))[_0x2d55('0x31')](handleError(_0x29ce21,null));};exports[_0x2d55('0x12')]=function(_0x3162f3,_0xc481bf){if(_0x3162f3[_0x2d55('0x37')]['id']){delete _0x3162f3[_0x2d55('0x37')]['id'];}return db[_0x2d55('0x2c')]['find']({'where':{'id':_0x3162f3['params']['id']}})[_0x2d55('0x13')](handleEntityNotFound(_0xc481bf,null))[_0x2d55('0x13')](function(_0x331a1b){if(_0x331a1b[_0x2d55('0x2e')]==='MicrosoftAzure'&&_0x3162f3[_0x2d55('0x37')][_0x2d55('0x30')]){_0x3162f3[_0x2d55('0x37')][_0x2d55('0x30')]=encryptor[_0x2d55('0x3c')](_0x3162f3[_0x2d55('0x37')][_0x2d55('0x30')]);}return _0x331a1b;})[_0x2d55('0x13')](saveUpdates(_0x3162f3['body'],null))[_0x2d55('0x13')](respondWithResult(_0xc481bf,null))[_0x2d55('0x31')](handleError(_0xc481bf,null));};exports['destroy']=function(_0x1b1bbf,_0xe8229){return db['CloudProvider'][_0x2d55('0x35')]({'where':{'id':_0x1b1bbf[_0x2d55('0x3e')]['id']}})[_0x2d55('0x13')](handleEntityNotFound(_0xe8229,null))[_0x2d55('0x13')](removeEntity(_0xe8229,null))[_0x2d55('0x31')](handleError(_0xe8229,null));};exports[_0x2d55('0x3f')]=function(_0x2363b9,_0x1d5d54){return db[_0x2d55('0x2c')][_0x2d55('0x40')]({'where':{'id':_0x2363b9[_0x2d55('0x3e')]['id']},'raw':!![]})[_0x2d55('0x13')](function(_0x4b40b8){if(!_0x4b40b8)return _0x1d5d54['sendStatus'](0x194);return{'url':oauth[_0x2d55('0x41')](_0x4b40b8,_0x2363b9[_0x2d55('0x42')]['id'])};})[_0x2d55('0x13')](respondWithResult(_0x1d5d54,null))[_0x2d55('0x31')](handleError(_0x1d5d54,null));};exports['oauth2MicrosoftCallback']=function(_0x5514a5,_0x2b831d){var _0x5daff6=_0x5514a5[_0x2d55('0x37')];var _0x2b7050;var _0x3e0fcf;if(_0x5daff6['error'])throw _0x5daff6;redis['get'](_0x5daff6[_0x2d55('0x43')])[_0x2d55('0x13')](function(_0x432ceb){if(!_0x432ceb)throw new Error(_0x2d55('0x44'));_0x2b7050=JSON[_0x2d55('0x45')](_0x432ceb);var _0x3bf58b=Buffer[_0x2d55('0x46')](_0x5daff6[_0x2d55('0x43')],'base64')[_0x2d55('0x47')](_0x2d55('0x48'));_0x3e0fcf=JSON[_0x2d55('0x45')](_0x3bf58b);if(!oauth[_0x2d55('0x49')](_0x5daff6['id_token'],_0x2b7050['oauth2Claims']))throw new Error(_0x2d55('0x4a'));redis[_0x2d55('0x4b')](_0x5daff6['state']);return oauth['getOauth2MicrosoftAccessToken'](_0x5daff6[_0x2d55('0x4c')],_0x2b7050);})[_0x2d55('0x13')](function(_0x4449ee){_0x2b7050[_0x2d55('0x4d')]=_0x4449ee['access_token'];_0x2b7050[_0x2d55('0x4e')]=_0x4449ee['refresh_token'];return db[_0x2d55('0x2c')][_0x2d55('0x12')]({'data5':_0x2b7050[_0x2d55('0x4d')],'data6':_0x2b7050[_0x2d55('0x4e')]},{'where':{'id':_0x2b7050['id']}});})['then'](function(){oauth[_0x2d55('0x4f')](_0x2b7050);socket[_0x2d55('0x50')](_0x2d55('0x51'),{'id':_0x3e0fcf['id']});return;})['then'](respondWithStatusCode(_0x2b831d,null))[_0x2d55('0x31')](function(_0x2e206c){if(_0x3e0fcf){socket[_0x2d55('0x50')](_0x2d55('0x52'),{'id':_0x3e0fcf['id']});}if(!_0x2b7050){logger['error'](_0x2d55('0x53'),_0x2e206c);return _0x2b831d[_0x2d55('0x9')](0x1f4)['send'](_0x2e206c[_0x2d55('0x54')]);}logger['error']('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s',_0x2b7050['id'],_0x2e206c);});}; \ No newline at end of file +var _0x1286=['Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','find','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','error','state','parse','from','toString','isValidIdToken','id_token','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','data5','access_token','data6','refresh_token','startRefreshInterval','microsoftAuthorization:success','emit','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','../../mysqldb','./cloudProvider.oauth','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','stack','name','send','padEnd','slice','index','CloudProvider','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','include','findAll','decryptString','data3','catch','show','params','length','includeAll','merge','service','MicrosoftAzure','create','body','values','includes'];(function(_0x3dbe14,_0x542edc){var _0x6525b9=function(_0xe72193){while(--_0xe72193){_0x3dbe14['push'](_0x3dbe14['shift']());}};_0x6525b9(++_0x542edc);}(_0x1286,0x78));var _0x6128=function(_0x83af7f,_0x49c6fd){_0x83af7f=_0x83af7f-0x0;var _0x32d85c=_0x1286[_0x83af7f];return _0x32d85c;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0x6128('0x0'));var encryptor=require(_0x6128('0x1'));var config=require(_0x6128('0x2'));var logger=require(_0x6128('0x3'))('api');var db=require(_0x6128('0x4'))['db'];var oauth=require(_0x6128('0x5'));config['redis']=_['defaults'](config[_0x6128('0x6')],{'host':_0x6128('0x7'),'port':0x18eb});var socket=require(_0x6128('0x8'))(new Redis(config['redis']));var redis=new Redis(config[_0x6128('0x6')]);function respondWithStatusCode(_0x59dd17,_0x3bad2c){_0x3bad2c=_0x3bad2c||0xcc;return function(_0x20a109){if(_0x20a109){return _0x59dd17[_0x6128('0x9')](_0x3bad2c);}return _0x59dd17[_0x6128('0xa')](_0x3bad2c)[_0x6128('0xb')]();};}function respondWithResult(_0x5e1554,_0x4601b6){_0x4601b6=_0x4601b6||0xc8;return function(_0x3971b1){if(_0x3971b1){return _0x5e1554[_0x6128('0xa')](_0x4601b6)[_0x6128('0xc')](_0x3971b1);}};}function respondWithFilteredResult(_0xfd6218,_0x430ea6){return function(_0x2c2fed){if(_0x2c2fed){var _0x4f741f=typeof _0x430ea6[_0x6128('0xd')]===_0x6128('0xe')&&typeof _0x430ea6['limit']===_0x6128('0xe');var _0x5ab823=_0x2c2fed[_0x6128('0xf')];var _0x5d0e7f=_0x4f741f?0x0:_0x430ea6[_0x6128('0xd')];var _0x39d577=_0x4f741f?_0x2c2fed[_0x6128('0xf')]:_0x430ea6[_0x6128('0xd')]+_0x430ea6[_0x6128('0x10')];var _0x2755cf;if(_0x39d577>=_0x5ab823){_0x39d577=_0x5ab823;_0x2755cf=0xc8;}else{_0x2755cf=0xce;}_0xfd6218['status'](_0x2755cf);return _0xfd6218[_0x6128('0x11')](_0x6128('0x12'),_0x5d0e7f+'-'+_0x39d577+'/'+_0x5ab823)[_0x6128('0xc')](_0x2c2fed);}return null;};}function saveUpdates(_0x57ee11){return function(_0x2853a0){if(_0x2853a0){return _0x2853a0[_0x6128('0x13')](_0x57ee11)[_0x6128('0x14')](function(_0x1a63dd){return _0x1a63dd;});}return null;};}function removeEntity(_0x2ef761){return function(_0x522abc){if(_0x522abc){return _0x522abc[_0x6128('0x15')]()['then'](function(){_0x2ef761[_0x6128('0xa')](0xcc)[_0x6128('0xb')]();});}};}function handleEntityNotFound(_0x1fe94c){return function(_0xfa6197){if(!_0xfa6197){_0x1fe94c[_0x6128('0x9')](0x194);}return _0xfa6197;};}function handleError(_0x550e42,_0x210b40){_0x210b40=_0x210b40||0x1f4;return function(_0x5c72e7){logger['error'](_0x5c72e7[_0x6128('0x16')]);if(_0x5c72e7[_0x6128('0x17')]){delete _0x5c72e7[_0x6128('0x17')];}_0x550e42[_0x6128('0xa')](_0x210b40)[_0x6128('0x18')](_0x5c72e7);};}function maskClientSecret(_0x4071e6){return _[_0x6128('0x19')](_0x4071e6[_0x6128('0x1a')](0x0,0x3),0x14,'*');}exports[_0x6128('0x1b')]=function(_0x2933a6,_0xcaadae){var _0x78d3d3={},_0x465bd5={},_0x174007={'count':0x0,'rows':[]};var _0xde298b=_['map'](db[_0x6128('0x1c')][_0x6128('0x1d')],function(_0x4db6ab){return{'name':_0x4db6ab[_0x6128('0x1e')],'type':_0x4db6ab[_0x6128('0x1f')][_0x6128('0x20')]};});_0x465bd5[_0x6128('0x21')]=_[_0x6128('0x22')](_0xde298b,_0x6128('0x17'));_0x465bd5[_0x6128('0x23')]=_[_0x6128('0x24')](_0x2933a6[_0x6128('0x23')]);_0x465bd5[_0x6128('0x25')]=_[_0x6128('0x26')](_0x465bd5['model'],_0x465bd5[_0x6128('0x23')]);_0x78d3d3['attributes']=_['intersection'](_0x465bd5[_0x6128('0x21')],qs[_0x6128('0x27')](_0x2933a6[_0x6128('0x23')][_0x6128('0x27')]));_0x78d3d3[_0x6128('0x28')]=_0x78d3d3[_0x6128('0x28')]['length']?_0x78d3d3['attributes']:_0x465bd5[_0x6128('0x21')];if(!_0x2933a6[_0x6128('0x23')][_0x6128('0x29')](_0x6128('0x2a'))){_0x78d3d3[_0x6128('0x10')]=qs['limit'](_0x2933a6[_0x6128('0x23')]['limit']);_0x78d3d3['offset']=qs[_0x6128('0xd')](_0x2933a6['query'][_0x6128('0xd')]);}_0x78d3d3[_0x6128('0x2b')]=qs[_0x6128('0x2c')](_0x2933a6[_0x6128('0x23')][_0x6128('0x2c')]);_0x78d3d3['where']=qs[_0x6128('0x25')](_[_0x6128('0x2d')](_0x2933a6['query'],_0x465bd5[_0x6128('0x25')]),_0xde298b);if(_0x2933a6[_0x6128('0x23')][_0x6128('0x2e')]){_0x78d3d3[_0x6128('0x2f')]=_['merge'](_0x78d3d3['where'],{'$or':_[_0x6128('0x22')](_0xde298b,function(_0x4bcdc7){if(_0x4bcdc7['type']!==_0x6128('0x30')){var _0x4381d3={};_0x4381d3[_0x4bcdc7[_0x6128('0x17')]]={'$like':'%'+_0x2933a6[_0x6128('0x23')][_0x6128('0x2e')]+'%'};return _0x4381d3;}})});}_0x78d3d3=_['merge']({},_0x78d3d3,_0x2933a6[_0x6128('0x31')]);var _0x49f6df={'where':_0x78d3d3[_0x6128('0x2f')]};return db[_0x6128('0x1c')][_0x6128('0xf')](_0x49f6df)[_0x6128('0x14')](function(_0x3aeeef){_0x174007[_0x6128('0xf')]=_0x3aeeef;if(_0x2933a6[_0x6128('0x23')]['includeAll']){_0x78d3d3[_0x6128('0x32')]=[{'all':!![]}];}return db[_0x6128('0x1c')][_0x6128('0x33')](_0x78d3d3);})[_0x6128('0x14')](function(_0x4d6d3a){_0x174007['rows']=_[_0x6128('0x22')](_0x4d6d3a,function(_0xfce603){if(_0xfce603['service']==='MicrosoftAzure'){var _0x288946=encryptor[_0x6128('0x34')](_0xfce603[_0x6128('0x35')]);_0xfce603[_0x6128('0x35')]=maskClientSecret(_0x288946);}return _0xfce603;});return _0x174007;})[_0x6128('0x14')](respondWithFilteredResult(_0xcaadae,_0x78d3d3))[_0x6128('0x36')](handleError(_0xcaadae,null));};exports[_0x6128('0x37')]=function(_0x4926ca,_0x3646c0){var _0x10edf8={'raw':!![],'where':{'id':_0x4926ca[_0x6128('0x38')]['id']}},_0x18db84={};_0x18db84[_0x6128('0x21')]=_['keys'](db['CloudProvider'][_0x6128('0x1d')]);_0x18db84[_0x6128('0x23')]=_['keys'](_0x4926ca['query']);_0x18db84[_0x6128('0x25')]=_[_0x6128('0x26')](_0x18db84[_0x6128('0x21')],_0x18db84[_0x6128('0x23')]);_0x10edf8[_0x6128('0x28')]=_['intersection'](_0x18db84[_0x6128('0x21')],qs['fields'](_0x4926ca[_0x6128('0x23')][_0x6128('0x27')]));_0x10edf8[_0x6128('0x28')]=_0x10edf8[_0x6128('0x28')][_0x6128('0x39')]?_0x10edf8[_0x6128('0x28')]:_0x18db84[_0x6128('0x21')];if(_0x4926ca[_0x6128('0x23')][_0x6128('0x3a')]){_0x10edf8[_0x6128('0x32')]=[{'all':!![]}];}_0x10edf8=_[_0x6128('0x3b')]({},_0x10edf8,_0x4926ca['options']);return db[_0x6128('0x1c')]['find'](_0x10edf8)['then'](handleEntityNotFound(_0x3646c0,null))['then'](function(_0x3b76cd){if(_0x3b76cd[_0x6128('0x3c')]===_0x6128('0x3d')){var _0x52be0e=encryptor[_0x6128('0x34')](_0x3b76cd['data3']);_0x3b76cd[_0x6128('0x35')]=maskClientSecret(_0x52be0e);}return _0x3b76cd;})[_0x6128('0x14')](respondWithResult(_0x3646c0,null))[_0x6128('0x36')](handleError(_0x3646c0,null));};exports[_0x6128('0x3e')]=function(_0x3acbbc,_0x4e208e){if(!_0x3acbbc[_0x6128('0x3f')][_0x6128('0x17')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x3acbbc['body'][_0x6128('0x3c')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x54980c=db[_0x6128('0x1c')][_0x6128('0x1d')][_0x6128('0x3c')][_0x6128('0x40')];if(!_0x54980c[_0x6128('0x41')](_0x3acbbc[_0x6128('0x3f')][_0x6128('0x3c')]))throw new Error(_0x6128('0x42')+_0x54980c['join'](',\x20'));if(_0x3acbbc[_0x6128('0x3f')]['service']===_0x6128('0x3d')&&_0x3acbbc[_0x6128('0x3f')][_0x6128('0x35')]){_0x3acbbc[_0x6128('0x3f')][_0x6128('0x35')]=encryptor['encryptString'](_0x3acbbc['body'][_0x6128('0x35')]);}return db[_0x6128('0x1c')][_0x6128('0x3e')](_0x3acbbc[_0x6128('0x3f')],{})[_0x6128('0x14')](respondWithResult(_0x4e208e,0xc9))[_0x6128('0x36')](handleError(_0x4e208e,null));};exports['update']=function(_0x782e0f,_0x23d2d7){if(_0x782e0f['body']['id']){delete _0x782e0f[_0x6128('0x3f')]['id'];}return db[_0x6128('0x1c')]['find']({'where':{'id':_0x782e0f[_0x6128('0x38')]['id']}})['then'](handleEntityNotFound(_0x23d2d7,null))['then'](function(_0x122cb0){if(_0x122cb0[_0x6128('0x3c')]===_0x6128('0x3d')&&_0x782e0f[_0x6128('0x3f')]['data3']){_0x782e0f[_0x6128('0x3f')][_0x6128('0x35')]=encryptor[_0x6128('0x43')](_0x782e0f[_0x6128('0x3f')][_0x6128('0x35')]);}return _0x122cb0;})[_0x6128('0x14')](saveUpdates(_0x782e0f[_0x6128('0x3f')],null))[_0x6128('0x14')](respondWithResult(_0x23d2d7,null))[_0x6128('0x36')](handleError(_0x23d2d7,null));};exports[_0x6128('0x15')]=function(_0x2261fa,_0x279e51){return db[_0x6128('0x1c')][_0x6128('0x44')]({'where':{'id':_0x2261fa[_0x6128('0x38')]['id']}})[_0x6128('0x14')](handleEntityNotFound(_0x279e51,null))[_0x6128('0x14')](removeEntity(_0x279e51,null))[_0x6128('0x36')](handleError(_0x279e51,null));};exports[_0x6128('0x45')]=function(_0x319f64,_0x311847){return db[_0x6128('0x1c')][_0x6128('0x46')]({'where':{'id':_0x319f64['params']['id']},'raw':!![]})['then'](function(_0x23e96e){if(!_0x23e96e)return _0x311847[_0x6128('0x9')](0x194);return{'url':oauth[_0x6128('0x47')](_0x23e96e,_0x319f64[_0x6128('0x48')]['id'])};})['then'](respondWithResult(_0x311847,null))[_0x6128('0x36')](handleError(_0x311847,null));};exports[_0x6128('0x49')]=function(_0x493530,_0x24b93e){var _0x6b89d2=_0x493530['body'];var _0x278d44;var _0x42a722;if(_0x6b89d2[_0x6128('0x4a')])throw _0x6b89d2;redis['get'](_0x6b89d2[_0x6128('0x4b')])['then'](function(_0x38fb2f){if(!_0x38fb2f)throw new Error('Invalid\x20state\x20parameter');_0x278d44=JSON[_0x6128('0x4c')](_0x38fb2f);var _0x173141=Buffer[_0x6128('0x4d')](_0x6b89d2[_0x6128('0x4b')],'base64')[_0x6128('0x4e')]('ascii');_0x42a722=JSON[_0x6128('0x4c')](_0x173141);if(!oauth[_0x6128('0x4f')](_0x6b89d2[_0x6128('0x50')],_0x278d44['oauth2Claims']))throw new Error(_0x6128('0x51'));redis[_0x6128('0x52')](_0x6b89d2[_0x6128('0x4b')]);return oauth[_0x6128('0x53')](_0x6b89d2['code'],_0x278d44);})[_0x6128('0x14')](function(_0x159e70){_0x278d44[_0x6128('0x54')]=_0x159e70[_0x6128('0x55')];_0x278d44[_0x6128('0x56')]=_0x159e70[_0x6128('0x57')];return db[_0x6128('0x1c')]['update']({'data5':_0x278d44[_0x6128('0x54')],'data6':_0x278d44[_0x6128('0x56')]},{'where':{'id':_0x278d44['id']}});})[_0x6128('0x14')](function(){oauth[_0x6128('0x58')](_0x278d44);socket['emit'](_0x6128('0x59'),{'id':_0x42a722['id']});return;})[_0x6128('0x14')](respondWithStatusCode(_0x24b93e,null))['catch'](function(_0x3cff91){if(_0x42a722){socket[_0x6128('0x5a')]('microsoftAuthorization:error',{'id':_0x42a722['id']});}if(!_0x278d44){logger[_0x6128('0x4a')]('Invalid\x20authentication\x20state\x20parameter',_0x3cff91);return _0x24b93e[_0x6128('0xa')](0x1f4)['send'](_0x3cff91[_0x6128('0x5b')]);}logger[_0x6128('0x4a')](_0x6128('0x5c'),_0x278d44['id'],_0x3cff91);});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index e4ec0f5..6e02040 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 _0x97a1=['request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','cloud_providers','util','../../config/logger','moment'];(function(_0x3457b4,_0x4cd8f9){var _0xaa8fa9=function(_0x51897a){while(--_0x51897a){_0x3457b4['push'](_0x3457b4['shift']());}};_0xaa8fa9(++_0x4cd8f9);}(_0x97a1,0x13c));var _0x197a=function(_0x3d8627,_0x34e543){_0x3d8627=_0x3d8627-0x0;var _0x557c0d=_0x97a1[_0x3d8627];return _0x557c0d;};'use strict';var _=require('lodash');var util=require(_0x197a('0x0'));var logger=require(_0x197a('0x1'))('api');var moment=require(_0x197a('0x2'));var BPromise=require('bluebird');var rp=require(_0x197a('0x3'));var fs=require('fs');var path=require(_0x197a('0x4'));var rimraf=require(_0x197a('0x5'));var config=require(_0x197a('0x6'));var attributes=require(_0x197a('0x7'));module[_0x197a('0x8')]=function(_0x182ef1,_0x2dd313){return _0x182ef1[_0x197a('0x9')]('CloudProvider',attributes,{'tableName':_0x197a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c20=['../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x841cb5,_0x5600e9){var _0x2f4837=function(_0x29bc5e){while(--_0x29bc5e){_0x841cb5['push'](_0x841cb5['shift']());}};_0x2f4837(++_0x5600e9);}(_0x1c20,0x16e));var _0x01c2=function(_0x359bbe,_0x5b7fcc){_0x359bbe=_0x359bbe-0x0;var _0x1b3353=_0x1c20[_0x359bbe];return _0x1b3353;};'use strict';var _=require(_0x01c2('0x0'));var util=require('util');var logger=require(_0x01c2('0x1'))(_0x01c2('0x2'));var moment=require(_0x01c2('0x3'));var BPromise=require('bluebird');var rp=require(_0x01c2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x01c2('0x5'));var config=require(_0x01c2('0x6'));var attributes=require(_0x01c2('0x7'));module[_0x01c2('0x8')]=function(_0x5a1e44,_0x90864c){return _0x5a1e44[_0x01c2('0x9')](_0x01c2('0xa'),attributes,{'tableName':_0x01c2('0xb'),'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 b7f6a9a..584e082 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 _0x1261=['toString','randomBytes','data1','response_type','redirect_uri','response_mode','form_post','state','key','value','oauth2Claims','replace','set','stringify','decode','payload','iss','aud','nonce','isAfter','exp','then','data3','CloudProvider','refresh_token','data6','data4','POST','data5','access_token','update','error','decryptString','intervals','bind','findAll','all','catch','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart','exports','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365','{TENANT_ID}','data2','id_token'];(function(_0x30fd00,_0x33a97f){var _0x2626f2=function(_0x305987){while(--_0x305987){_0x30fd00['push'](_0x30fd00['shift']());}};_0x2626f2(++_0x33a97f);}(_0x1261,0x144));var _0x1126=function(_0x2383bc,_0x2d5ec9){_0x2383bc=_0x2383bc-0x0;var _0x283573=_0x1261[_0x2383bc];return _0x283573;};'use strict';var _=require('lodash');var crypto=require(_0x1126('0x0'));var jwt=require(_0x1126('0x1'));var moment=require(_0x1126('0x2'));var Redis=require(_0x1126('0x3'));var rp=require(_0x1126('0x4'));var util=require(_0x1126('0x5'));var encryptor=require(_0x1126('0x6'));var config=require(_0x1126('0x7'));var logger=require(_0x1126('0x8'))(_0x1126('0x9'));var schedule=require('../../config/schedule/cloud-provider');var db=require('../../mysqldb')['db'];config[_0x1126('0xa')]=_[_0x1126('0xb')](config['redis'],{'host':_0x1126('0xc'),'port':0x18eb});var redis=new Redis(config[_0x1126('0xa')]);var MICROSOFT_AUTH_URL=_0x1126('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0x1126('0xe'),_0x1126('0xf'),'email',_0x1126('0x10'),_0x1126('0x11'),_0x1126('0x12'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x1126('0xe'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x1126('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x561b93){var _0x15e89b=_[_0x1126('0x14')](AZURE_AUTH_SCOPES[_0x561b93[_0x1126('0x15')]]);if(_0x561b93[_0x1126('0x15')]===_0x1126('0x16'))_0x15e89b[_0x1126('0x17')](_0x561b93[_0x1126('0x18')]+_0x1126('0x19'));return _0x15e89b[_0x1126('0x1a')]('\x20');}function getAccessTokenScope(_0x53a8f0){if(_0x53a8f0['type']===_0x1126('0x1b'))return _0x1126('0x11');if(_0x53a8f0[_0x1126('0x15')]==='Dynamics365')return _0x53a8f0[_0x1126('0x18')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x35fe9f,_0x42f379){var _0x257b5f=MICROSOFT_AUTH_URL['replace'](_0x1126('0x1c'),_0x35fe9f[_0x1126('0x1d')]);var _0x4a7b49=['code',_0x1126('0x1e')];var _0x2b2487=Buffer['from'](JSON['stringify']({'id':_0x42f379}))[_0x1126('0x1f')]('base64');var _0x22ed37=crypto[_0x1126('0x20')](0x10)[_0x1126('0x1f')]('hex');var _0x2a08ba=getAuthorizationScopes(_0x35fe9f);var _0x49d209=[{'key':'client_id','value':_0x35fe9f[_0x1126('0x21')]},{'key':_0x1126('0x22'),'value':encodeURIComponent(_0x4a7b49[_0x1126('0x1a')]('\x20'))},{'key':_0x1126('0x23'),'value':_0x35fe9f['data4']},{'key':_0x1126('0x24'),'value':_0x1126('0x25')},{'key':'scope','value':encodeURIComponent(_0x2a08ba)},{'key':_0x1126('0x26'),'value':_0x2b2487},{'key':'nonce','value':_0x22ed37},{'key':'prompt','value':'login'}];var _0x2199d9=_0x257b5f+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x1126('0x14')](_0x49d209,function(_0x329914){return _0x329914[_0x1126('0x27')]+'='+_0x329914[_0x1126('0x28')];})[_0x1126('0x1a')]('&');_0x35fe9f[_0x1126('0x29')]={'issuer':_0x257b5f[_0x1126('0x2a')]('oauth2/',''),'audience':_0x35fe9f[_0x1126('0x21')],'state':_0x2b2487,'nonce':_0x22ed37};redis[_0x1126('0x2b')](_0x2b2487,JSON[_0x1126('0x2c')](_0x35fe9f));return _0x2199d9;}function isValidIdToken(_0x5ddf63,_0x541bc9){try{var _0xeb7d89=jwt[_0x1126('0x2d')](_0x5ddf63,{'complete':!![]});var _0x55e195=_0xeb7d89[_0x1126('0x2e')];if(_0x55e195[_0x1126('0x2f')]!==_0x541bc9['issuer'])return![];if(_0x55e195[_0x1126('0x30')]!==_0x541bc9['audience'])return![];if(_0x55e195[_0x1126('0x31')]!==_0x541bc9['nonce'])return![];if(moment()[_0x1126('0x32')](moment['unix'](_0x55e195[_0x1126('0x33')])))return![];return!![];}catch(_0x5f2611){throw _0x5f2611;}}function refreshOauth2MicrosoftAccessToken(_0x5252e0){return Promise['resolve']()[_0x1126('0x34')](function(){if(_0x5252e0[_0x1126('0x35')])return _0x5252e0;return db[_0x1126('0x36')]['findOne']({'where':{'id':_0x5252e0['id']},'raw':!![]});})[_0x1126('0x34')](function(_0x226afb){var _0x56f7f8={'grant_type':_0x1126('0x37'),'refresh_token':_0x226afb[_0x1126('0x38')],'scope':getAccessTokenScope(_0x226afb),'redirect_uri':_0x226afb[_0x1126('0x39')],'client_id':_0x226afb[_0x1126('0x21')],'client_secret':encryptor['decryptString'](_0x226afb['data3'])};var _0x2a7edc={'method':_0x1126('0x3a'),'uri':MICROSOFT_AUTH_URL[_0x1126('0x2a')](_0x1126('0x1c'),_0x226afb['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x56f7f8,'json':!![]};return rp(_0x2a7edc);})[_0x1126('0x34')](function(_0x6f4312){_0x5252e0[_0x1126('0x3b')]=_0x6f4312[_0x1126('0x3c')];_0x5252e0[_0x1126('0x38')]=_0x6f4312['refresh_token'];return db[_0x1126('0x36')][_0x1126('0x3d')]({'data5':_0x5252e0[_0x1126('0x3b')],'data6':_0x5252e0[_0x1126('0x38')]},{'where':{'id':_0x5252e0['id']}});})['then'](function(){return _0x5252e0;})['catch'](function(_0x22827a){logger[_0x1126('0x3e')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s',_0x5252e0['id'],_0x22827a);});}function getOauth2MicrosoftAccessToken(_0xde37cf,_0xf3c21b){var _0x11b0f6={'grant_type':'authorization_code','code':_0xde37cf,'scope':getAccessTokenScope(_0xf3c21b),'redirect_uri':_0xf3c21b['data4'],'client_id':_0xf3c21b[_0x1126('0x21')],'client_secret':encryptor[_0x1126('0x3f')](_0xf3c21b[_0x1126('0x35')])};var _0x156554={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x1126('0x2a')]('{TENANT_ID}',_0xf3c21b[_0x1126('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x11b0f6,'json':!![]};return rp(_0x156554);}function startRefreshInterval(_0x20e43a){var _0xfa96e0=schedule[_0x1126('0x40')];if(_0xfa96e0[_0x20e43a['id']])clearInterval(_0xfa96e0[_0x20e43a['id']]);_0xfa96e0[_0x20e43a['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x1126('0x41')](this,{'id':_0x20e43a['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0xfa96e0;}function startAllRefreshIntervals(){return db[_0x1126('0x36')][_0x1126('0x42')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x1126('0x34')](function(_0x397e3b){var _0x3469a2=_0x397e3b[_0x1126('0x14')](function(_0x3052f9){return refreshOauth2MicrosoftAccessToken(_0x3052f9)['then'](function(_0x1c8d8a){startRefreshInterval(_0x1c8d8a);});});return Promise[_0x1126('0x43')](_0x3469a2);})[_0x1126('0x44')](function(_0xf3a0bd){var _0xcf0483=_0xf3a0bd?util['inspect'](_0xf3a0bd,{'showHidden':![],'depth':null}):'';logger['error'](_0x1126('0x45'),_0xcf0483);});}module[_0x1126('0x46')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x7a54=['data3','CloudProvider','findOne','refresh_token','decryptString','replace','access_token','data6','update','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s','authorization_code','POST','data2','bind','intervals','findAll','all','catch','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart','exports','lodash','crypto','jsonwebtoken','ioredis','request-promise','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','push','data7','/.default','join','Outlook365','Dynamics365','{TENANT_ID}','code','id_token','from','stringify','toString','base64','randomBytes','hex','client_id','data1','response_type','redirect_uri','data4','response_mode','form_post','state','nonce','login','key','oauth2Claims','oauth2/','set','decode','payload','iss','issuer','aud','audience','isAfter','exp','then'];(function(_0x172ce5,_0x1ebd44){var _0xeaca69=function(_0x50391a){while(--_0x50391a){_0x172ce5['push'](_0x172ce5['shift']());}};_0xeaca69(++_0x1ebd44);}(_0x7a54,0x106));var _0x47a5=function(_0x136457,_0xf4889d){_0x136457=_0x136457-0x0;var _0x58c159=_0x7a54[_0x136457];return _0x58c159;};'use strict';var _=require(_0x47a5('0x0'));var crypto=require(_0x47a5('0x1'));var jwt=require(_0x47a5('0x2'));var moment=require('moment');var Redis=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var util=require('util');var encryptor=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var logger=require(_0x47a5('0x7'))(_0x47a5('0x8'));var schedule=require(_0x47a5('0x9'));var db=require('../../mysqldb')['db'];config[_0x47a5('0xa')]=_['defaults'](config[_0x47a5('0xa')],{'host':_0x47a5('0xb'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0x47a5('0xc');var AZURE_AUTH_SCOPES={'Outlook365':['openid','profile','email',_0x47a5('0xd'),_0x47a5('0xe'),'https://outlook.office.com/POP.AccessAsUser.All',_0x47a5('0xf')],'Dynamics365':['openid','offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0x47a5('0x10');var MICROSOFT_TOKEN_ENDPOINT=_0x47a5('0x11');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x2f399b){var _0x250fad=_[_0x47a5('0x12')](AZURE_AUTH_SCOPES[_0x2f399b[_0x47a5('0x13')]]);if(_0x2f399b[_0x47a5('0x13')]==='Dynamics365')_0x250fad[_0x47a5('0x14')](_0x2f399b[_0x47a5('0x15')]+_0x47a5('0x16'));return _0x250fad[_0x47a5('0x17')]('\x20');}function getAccessTokenScope(_0x139f25){if(_0x139f25[_0x47a5('0x13')]===_0x47a5('0x18'))return _0x47a5('0xe');if(_0x139f25['type']===_0x47a5('0x19'))return _0x139f25[_0x47a5('0x15')]+_0x47a5('0x16');}function generateMicrosoftAuthorizationUrl(_0x2a2cbb,_0x1ef44c){var _0x574af6=MICROSOFT_AUTH_URL['replace'](_0x47a5('0x1a'),_0x2a2cbb['data2']);var _0x5247fd=[_0x47a5('0x1b'),_0x47a5('0x1c')];var _0x2ce454=Buffer[_0x47a5('0x1d')](JSON[_0x47a5('0x1e')]({'id':_0x1ef44c}))[_0x47a5('0x1f')](_0x47a5('0x20'));var _0xe3c618=crypto[_0x47a5('0x21')](0x10)['toString'](_0x47a5('0x22'));var _0xf160ba=getAuthorizationScopes(_0x2a2cbb);var _0x47cf3c=[{'key':_0x47a5('0x23'),'value':_0x2a2cbb[_0x47a5('0x24')]},{'key':_0x47a5('0x25'),'value':encodeURIComponent(_0x5247fd['join']('\x20'))},{'key':_0x47a5('0x26'),'value':_0x2a2cbb[_0x47a5('0x27')]},{'key':_0x47a5('0x28'),'value':_0x47a5('0x29')},{'key':'scope','value':encodeURIComponent(_0xf160ba)},{'key':_0x47a5('0x2a'),'value':_0x2ce454},{'key':_0x47a5('0x2b'),'value':_0xe3c618},{'key':'prompt','value':_0x47a5('0x2c')}];var _0xc4cd63=_0x574af6+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x47a5('0x12')](_0x47cf3c,function(_0x129ce5){return _0x129ce5[_0x47a5('0x2d')]+'='+_0x129ce5['value'];})['join']('&');_0x2a2cbb[_0x47a5('0x2e')]={'issuer':_0x574af6['replace'](_0x47a5('0x2f'),''),'audience':_0x2a2cbb['data1'],'state':_0x2ce454,'nonce':_0xe3c618};redis[_0x47a5('0x30')](_0x2ce454,JSON[_0x47a5('0x1e')](_0x2a2cbb));return _0xc4cd63;}function isValidIdToken(_0x36ad34,_0x1dac65){try{var _0x21f296=jwt[_0x47a5('0x31')](_0x36ad34,{'complete':!![]});var _0x24b162=_0x21f296[_0x47a5('0x32')];if(_0x24b162[_0x47a5('0x33')]!==_0x1dac65[_0x47a5('0x34')])return![];if(_0x24b162[_0x47a5('0x35')]!==_0x1dac65[_0x47a5('0x36')])return![];if(_0x24b162[_0x47a5('0x2b')]!==_0x1dac65['nonce'])return![];if(moment()[_0x47a5('0x37')](moment['unix'](_0x24b162[_0x47a5('0x38')])))return![];return!![];}catch(_0x9ac908){throw _0x9ac908;}}function refreshOauth2MicrosoftAccessToken(_0x16901f){return Promise['resolve']()[_0x47a5('0x39')](function(){if(_0x16901f[_0x47a5('0x3a')])return _0x16901f;return db[_0x47a5('0x3b')][_0x47a5('0x3c')]({'where':{'id':_0x16901f['id']},'raw':!![]});})['then'](function(_0x50d875){var _0x6f9a12={'grant_type':_0x47a5('0x3d'),'refresh_token':_0x50d875['data6'],'scope':getAccessTokenScope(_0x50d875),'redirect_uri':_0x50d875['data4'],'client_id':_0x50d875[_0x47a5('0x24')],'client_secret':encryptor[_0x47a5('0x3e')](_0x50d875['data3'])};var _0x42f70c={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x47a5('0x3f')](_0x47a5('0x1a'),_0x50d875['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x6f9a12,'json':!![]};return rp(_0x42f70c);})['then'](function(_0x274e34){_0x16901f['data5']=_0x274e34[_0x47a5('0x40')];_0x16901f[_0x47a5('0x41')]=_0x274e34[_0x47a5('0x3d')];return db['CloudProvider'][_0x47a5('0x42')]({'data5':_0x16901f['data5'],'data6':_0x16901f['data6']},{'where':{'id':_0x16901f['id']}});})[_0x47a5('0x39')](function(){return _0x16901f;})['catch'](function(_0x25cce0){logger['error'](_0x47a5('0x43'),_0x16901f['id'],_0x25cce0);});}function getOauth2MicrosoftAccessToken(_0x3534cb,_0x38c8d4){var _0x199698={'grant_type':_0x47a5('0x44'),'code':_0x3534cb,'scope':getAccessTokenScope(_0x38c8d4),'redirect_uri':_0x38c8d4[_0x47a5('0x27')],'client_id':_0x38c8d4[_0x47a5('0x24')],'client_secret':encryptor[_0x47a5('0x3e')](_0x38c8d4[_0x47a5('0x3a')])};var _0x4caed5={'method':_0x47a5('0x45'),'uri':MICROSOFT_AUTH_URL[_0x47a5('0x3f')]('{TENANT_ID}',_0x38c8d4[_0x47a5('0x46')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x199698,'json':!![]};return rp(_0x4caed5);}function startRefreshInterval(_0x2bf53d){var _0x1d4348=schedule['intervals'];if(_0x1d4348[_0x2bf53d['id']])clearInterval(_0x1d4348[_0x2bf53d['id']]);_0x1d4348[_0x2bf53d['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x47a5('0x47')](this,{'id':_0x2bf53d['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x47a5('0x48')]=_0x1d4348;}function startAllRefreshIntervals(){return db['CloudProvider'][_0x47a5('0x49')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x47a5('0x39')](function(_0x54ae35){var _0x55c5eb=_0x54ae35['map'](function(_0x12d9f2){return refreshOauth2MicrosoftAccessToken(_0x12d9f2)['then'](function(_0x9b5eaf){startRefreshInterval(_0x9b5eaf);});});return Promise[_0x47a5('0x4a')](_0x55c5eb);})[_0x47a5('0x4b')](function(_0x111f0d){var _0x1b2c80=_0x111f0d?util[_0x47a5('0x4c')](_0x111f0d,{'showHidden':![],'depth':null}):'';logger[_0x47a5('0x4d')](_0x47a5('0x4e'),_0x1b2c80);});}module[_0x47a5('0x4f')]={'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 2a95dc3..97ea63f 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 _0x8322=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','CloudProvider,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x41f5ba,_0xd0ffa8){var _0x535e03=function(_0x7b8c37){while(--_0x7b8c37){_0x41f5ba['push'](_0x41f5ba['shift']());}};_0x535e03(++_0xd0ffa8);}(_0x8322,0x186));var _0x2832=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x8322[_0x13ce0c];return _0x4388fb;};'use strict';var _=require(_0x2832('0x0'));var util=require(_0x2832('0x1'));var moment=require(_0x2832('0x2'));var BPromise=require(_0x2832('0x3'));var rs=require(_0x2832('0x4'));var fs=require('fs');var Redis=require(_0x2832('0x5'));var db=require(_0x2832('0x6'))['db'];var utils=require(_0x2832('0x7'));var logger=require(_0x2832('0x8'))(_0x2832('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2832('0xa')][_0x2832('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xab2c39,_0x29a788,_0x1488df){return new BPromise(function(_0x4b0ca8,_0xb57a3c){return client[_0x2832('0xc')](_0xab2c39,_0x1488df)[_0x2832('0xd')](function(_0xb1f005){logger['info'](_0x2832('0xe'),_0x29a788,_0x2832('0xf'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0x29a788,_0x2832('0xf'),JSON['stringify'](_0xb1f005));if(_0xb1f005['error']){if(_0xb1f005[_0x2832('0x10')][_0x2832('0x11')]===0x1f4){logger[_0x2832('0x10')](_0x2832('0xe'),_0x29a788,_0xb1f005['error'][_0x2832('0x12')]);return _0xb57a3c(_0xb1f005[_0x2832('0x10')]['message']);}logger[_0x2832('0x10')](_0x2832('0xe'),_0x29a788,_0xb1f005[_0x2832('0x10')][_0x2832('0x12')]);return _0x4b0ca8(_0xb1f005[_0x2832('0x10')][_0x2832('0x12')]);}else{logger[_0x2832('0x13')]('CloudProvider,\x20%s,\x20%s',_0x29a788,_0x2832('0xf'));_0x4b0ca8(_0xb1f005[_0x2832('0x14')]['message']);}})[_0x2832('0x15')](function(_0x56d1e6){logger[_0x2832('0x10')]('CloudProvider,\x20%s,\x20%s',_0x29a788,_0x56d1e6);_0xb57a3c(_0x56d1e6);});});} \ No newline at end of file +var _0xa702=['info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','then'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xa702,0x1ae));var _0x2a70=function(_0x1792ae,_0x74760a){_0x1792ae=_0x1792ae-0x0;var _0x49f2fd=_0xa702[_0x1792ae];return _0x49f2fd;};'use strict';var _=require(_0x2a70('0x0'));var util=require(_0x2a70('0x1'));var moment=require(_0x2a70('0x2'));var BPromise=require(_0x2a70('0x3'));var rs=require(_0x2a70('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a70('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2a70('0x6'));var config=require('../../config/environment');var jayson=require(_0x2a70('0x7'));var client=jayson[_0x2a70('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54e5a2,_0x26a166,_0x261c54){return new BPromise(function(_0x51e726,_0x768a34){return client['request'](_0x54e5a2,_0x261c54)[_0x2a70('0x9')](function(_0x3f3a15){logger[_0x2a70('0xa')](_0x2a70('0xb'),_0x26a166,_0x2a70('0xc'));logger[_0x2a70('0xd')](_0x2a70('0xe'),_0x26a166,_0x2a70('0xc'),JSON[_0x2a70('0xf')](_0x3f3a15));if(_0x3f3a15[_0x2a70('0x10')]){if(_0x3f3a15[_0x2a70('0x10')][_0x2a70('0x11')]===0x1f4){logger['error'](_0x2a70('0xb'),_0x26a166,_0x3f3a15[_0x2a70('0x10')][_0x2a70('0x12')]);return _0x768a34(_0x3f3a15[_0x2a70('0x10')][_0x2a70('0x12')]);}logger['error'](_0x2a70('0xb'),_0x26a166,_0x3f3a15[_0x2a70('0x10')]['message']);return _0x51e726(_0x3f3a15[_0x2a70('0x10')][_0x2a70('0x12')]);}else{logger['info'](_0x2a70('0xb'),_0x26a166,_0x2a70('0xc'));_0x51e726(_0x3f3a15['result']['message']);}})[_0x2a70('0x13')](function(_0x450273){logger[_0x2a70('0x10')](_0x2a70('0xb'),_0x26a166,_0x450273);_0x768a34(_0x450273);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 474dad4..81db106 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 _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0xda7474,_0x568b1e){var _0x1d582c=function(_0x4564f8){while(--_0x4564f8){_0xda7474['push'](_0xda7474['shift']());}};_0x1d582c(++_0x568b1e);}(_0x2ef3,0xba));var _0x32ef=function(_0x1413b3,_0x366db0){_0x1413b3=_0x1413b3-0x0;var _0x5db7e0=_0x2ef3[_0x1413b3];return _0x5db7e0;};'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['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file +var _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0x2bda16,_0x8442a7){var _0x396c50=function(_0x5913f3){while(--_0x5913f3){_0x2bda16['push'](_0x2bda16['shift']());}};_0x396c50(++_0x8442a7);}(_0xdb28,0x106));var _0x8db2=function(_0x3297b3,_0x1d7f03){_0x3297b3=_0x3297b3-0x0;var _0x120273=_0xdb28[_0x3297b3];return _0x120273;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index cfd9662..c29d8de 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 _0x36e1=['sequelize','exports','STRING'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x36e1,0xae));var _0x136e=function(_0x39780c,_0x5782c9){_0x39780c=_0x39780c-0x0;var _0x53c19b=_0x36e1[_0x39780c];return _0x53c19b;};'use strict';var Sequelize=require(_0x136e('0x0'));module[_0x136e('0x1')]={'name':{'type':Sequelize[_0x136e('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x136e('0x2')]},'companyId':{'type':Sequelize[_0x136e('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x136e('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x136e('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x136e('0x2')]},'city':{'type':Sequelize[_0x136e('0x2')]},'country':{'type':Sequelize[_0x136e('0x2')]},'email':{'type':Sequelize[_0x136e('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x136e('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x136e('0x2')]},'sCity':{'type':Sequelize[_0x136e('0x2')]},'sCountry':{'type':Sequelize[_0x136e('0x2')]},'description':{'type':Sequelize[_0x136e('0x2')]}}; \ No newline at end of file +var _0x25f0=['sequelize','exports','STRING','name'];(function(_0x3cad14,_0x216b68){var _0x48465b=function(_0x22ae5a){while(--_0x22ae5a){_0x3cad14['push'](_0x3cad14['shift']());}};_0x48465b(++_0x216b68);}(_0x25f0,0x108));var _0x025f=function(_0x46a3a0,_0x4a1c82){_0x46a3a0=_0x46a3a0-0x0;var _0x189670=_0x25f0[_0x46a3a0];return _0x189670;};'use strict';var Sequelize=require(_0x025f('0x0'));module[_0x025f('0x1')]={'name':{'type':Sequelize[_0x025f('0x2')],'unique':_0x025f('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x025f('0x2')]},'companyId':{'type':Sequelize[_0x025f('0x2')]},'website':{'type':Sequelize[_0x025f('0x2')]},'phone':{'type':Sequelize[_0x025f('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x025f('0x2')]},'street':{'type':Sequelize[_0x025f('0x2')]},'postalCode':{'type':Sequelize[_0x025f('0x2')]},'city':{'type':Sequelize[_0x025f('0x2')]},'country':{'type':Sequelize[_0x025f('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x025f('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x025f('0x2')]},'sCity':{'type':Sequelize[_0x025f('0x2')]},'sCountry':{'type':Sequelize[_0x025f('0x2')]},'description':{'type':Sequelize[_0x025f('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 5ed3ddf..786f2ed 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 _0xb932=['UserProfileSection','userProfileId','autoAssociation','error','update','body','addContacts','CmContact','ids','omit','getContacts','findOne','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','destroy','UserProfileResource','stack','name','send','CmCompany','describe','keys','query','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','map','includeAll','include','findAll','rows','catch','params','rawAttributes','merge','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x2f33c8,_0x57018c){var _0x2acf21=function(_0x5a8020){while(--_0x5a8020){_0x2f33c8['push'](_0x2f33c8['shift']());}};_0x2acf21(++_0x57018c);}(_0xb932,0x114));var _0x2b93=function(_0x4b9be2,_0x7f791e){_0x4b9be2=_0x4b9be2-0x0;var _0x43093c=_0xb932[_0x4b9be2];return _0x43093c;};'use strict';var emlformat=require(_0x2b93('0x0'));var rimraf=require(_0x2b93('0x1'));var zipdir=require(_0x2b93('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2b93('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2b93('0x4'));var util=require(_0x2b93('0x5'));var path=require(_0x2b93('0x6'));var sox=require(_0x2b93('0x7'));var csv=require(_0x2b93('0x8'));var ejs=require(_0x2b93('0x9'));var fs=require('fs');var fs_extra=require(_0x2b93('0xa'));var _=require(_0x2b93('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2b93('0xc'));var deskjs=require(_0x2b93('0xd'));var toCsv=require(_0x2b93('0x8'));var querystring=require(_0x2b93('0xe'));var Papa=require(_0x2b93('0xf'));var Redis=require('ioredis');var authService=require(_0x2b93('0x10'));var qs=require(_0x2b93('0x11'));var as=require(_0x2b93('0x12'));var hardwareService=require(_0x2b93('0x13'));var logger=require(_0x2b93('0x14'))(_0x2b93('0x15'));var utils=require(_0x2b93('0x16'));var config=require(_0x2b93('0x17'));var licenseUtil=require(_0x2b93('0x18'));var db=require(_0x2b93('0x19'))['db'];function respondWithStatusCode(_0x3b2799,_0x42577c){_0x42577c=_0x42577c||0xcc;return function(_0x3a5cc1){if(_0x3a5cc1){return _0x3b2799[_0x2b93('0x1a')](_0x42577c);}return _0x3b2799['status'](_0x42577c)[_0x2b93('0x1b')]();};}function respondWithResult(_0x5f041f,_0x14c3d2){_0x14c3d2=_0x14c3d2||0xc8;return function(_0x43e7f6){if(_0x43e7f6){return _0x5f041f[_0x2b93('0x1c')](_0x14c3d2)[_0x2b93('0x1d')](_0x43e7f6);}};}function respondWithFilteredResult(_0x40f4e8,_0x14f628){return function(_0x3b0ca5){if(_0x3b0ca5){var _0x5ab0f1=typeof _0x14f628[_0x2b93('0x1e')]==='undefined'&&typeof _0x14f628[_0x2b93('0x1f')]===_0x2b93('0x20');var _0xf21713=_0x3b0ca5['count'];var _0x1630fc=_0x5ab0f1?0x0:_0x14f628['offset'];var _0x26950a=_0x5ab0f1?_0x3b0ca5[_0x2b93('0x21')]:_0x14f628[_0x2b93('0x1e')]+_0x14f628[_0x2b93('0x1f')];var _0x550f5a;if(_0x26950a>=_0xf21713){_0x26950a=_0xf21713;_0x550f5a=0xc8;}else{_0x550f5a=0xce;}_0x40f4e8[_0x2b93('0x1c')](_0x550f5a);return _0x40f4e8[_0x2b93('0x22')](_0x2b93('0x23'),_0x1630fc+'-'+_0x26950a+'/'+_0xf21713)['json'](_0x3b0ca5);}return null;};}function patchUpdates(_0xc1031f){return function(_0x5897e0){try{jsonpatch[_0x2b93('0x24')](_0x5897e0,_0xc1031f,!![]);}catch(_0x3748c0){return BPromise[_0x2b93('0x25')](_0x3748c0);}return _0x5897e0['save']();};}function saveUpdates(_0x36ca7d,_0x375f2a){return function(_0x363208){if(_0x363208){return _0x363208['update'](_0x36ca7d)[_0x2b93('0x26')](function(_0x2b213c){return _0x2b213c;});}return null;};}function removeEntity(_0x3cf9c7,_0x2a787b){return function(_0x33855e){if(_0x33855e){return _0x33855e[_0x2b93('0x27')]()[_0x2b93('0x26')](function(){var _0x1919a0=_0x33855e['get']({'plain':!![]});var _0x3bdb65='Companies';return db[_0x2b93('0x28')]['destroy']({'where':{'type':_0x3bdb65,'resourceId':_0x1919a0['id']}})[_0x2b93('0x26')](function(){return _0x33855e;});})[_0x2b93('0x26')](function(){_0x3cf9c7[_0x2b93('0x1c')](0xcc)[_0x2b93('0x1b')]();});}};}function handleEntityNotFound(_0x29c05b,_0x39289d){return function(_0x5476cf){if(!_0x5476cf){_0x29c05b[_0x2b93('0x1a')](0x194);}return _0x5476cf;};}function handleError(_0x40ea28,_0x5f5b8b){_0x5f5b8b=_0x5f5b8b||0x1f4;return function(_0x1f7a90){logger['error'](_0x1f7a90[_0x2b93('0x29')]);if(_0x1f7a90[_0x2b93('0x2a')]){delete _0x1f7a90['name'];}_0x40ea28[_0x2b93('0x1c')](_0x5f5b8b)[_0x2b93('0x2b')](_0x1f7a90);};}exports['index']=function(_0xafab08,_0xbf6fff){var _0x1d5366={},_0x5c69cb={},_0x205cda={'count':0x0,'rows':[]};return db[_0x2b93('0x2c')][_0x2b93('0x2d')]()[_0x2b93('0x26')](function(_0x40b5f3){_0x5c69cb['model']=_[_0x2b93('0x2e')](_0x40b5f3);_0x5c69cb[_0x2b93('0x2f')]=_[_0x2b93('0x2e')](_0xafab08[_0x2b93('0x2f')]);_0x5c69cb['filters']=_['intersection'](_0x5c69cb[_0x2b93('0x30')],_0x5c69cb['query']);_0x1d5366[_0x2b93('0x31')]=_[_0x2b93('0x32')](_0x5c69cb['model'],qs[_0x2b93('0x33')](_0xafab08[_0x2b93('0x2f')][_0x2b93('0x33')]));_0x1d5366[_0x2b93('0x31')]=_0x1d5366[_0x2b93('0x31')][_0x2b93('0x34')]?_0x1d5366[_0x2b93('0x31')]:_0x5c69cb['model'];if(!_0xafab08[_0x2b93('0x2f')][_0x2b93('0x35')]('nolimit')){_0x1d5366['limit']=qs['limit'](_0xafab08[_0x2b93('0x2f')][_0x2b93('0x1f')]);_0x1d5366[_0x2b93('0x1e')]=qs[_0x2b93('0x1e')](_0xafab08[_0x2b93('0x2f')][_0x2b93('0x1e')]);}_0x1d5366[_0x2b93('0x36')]=qs[_0x2b93('0x37')](_0xafab08[_0x2b93('0x2f')]['sort']);_0x1d5366[_0x2b93('0x38')]=qs['filters'](_[_0x2b93('0x39')](_0xafab08[_0x2b93('0x2f')],_0x5c69cb[_0x2b93('0x3a')]),_0x40b5f3);if(_0xafab08[_0x2b93('0x2f')][_0x2b93('0x3b')]){_0x1d5366[_0x2b93('0x38')]=_['merge'](_0x1d5366[_0x2b93('0x38')],{'$or':_[_0x2b93('0x3c')](_0x1d5366[_0x2b93('0x31')],function(_0x454012){var _0x43fe38={};_0x43fe38[_0x454012]={'$like':'%'+_0xafab08[_0x2b93('0x2f')][_0x2b93('0x3b')]+'%'};return _0x43fe38;})});}_0x1d5366=_['merge']({},_0x1d5366,_0xafab08['options']);var _0x3a1272={'where':_0x1d5366['where']};return db[_0x2b93('0x2c')][_0x2b93('0x21')](_0x3a1272)[_0x2b93('0x26')](function(_0x11d4f1){_0x205cda['count']=_0x11d4f1;if(_0xafab08['query'][_0x2b93('0x3d')]){_0x1d5366[_0x2b93('0x3e')]=[{'all':!![]}];}return db['CmCompany'][_0x2b93('0x3f')](_0x1d5366);})[_0x2b93('0x26')](function(_0x4f4962){_0x205cda[_0x2b93('0x40')]=_0x4f4962;return _0x205cda;})[_0x2b93('0x26')](respondWithFilteredResult(_0xbf6fff,_0x1d5366))[_0x2b93('0x41')](handleError(_0xbf6fff,null));})[_0x2b93('0x41')](handleError(_0xbf6fff,null));};exports['show']=function(_0x5bb7e2,_0x39a72c){var _0x43643f={'raw':![],'where':{'id':_0x5bb7e2[_0x2b93('0x42')]['id']}},_0x4a5b16={};_0x4a5b16[_0x2b93('0x30')]=_[_0x2b93('0x2e')](db[_0x2b93('0x2c')][_0x2b93('0x43')]);_0x4a5b16[_0x2b93('0x2f')]=_[_0x2b93('0x2e')](_0x5bb7e2['query']);_0x4a5b16[_0x2b93('0x3a')]=_[_0x2b93('0x32')](_0x4a5b16[_0x2b93('0x30')],_0x4a5b16['query']);_0x43643f[_0x2b93('0x31')]=_[_0x2b93('0x32')](_0x4a5b16[_0x2b93('0x30')],qs[_0x2b93('0x33')](_0x5bb7e2[_0x2b93('0x2f')][_0x2b93('0x33')]));_0x43643f['attributes']=_0x43643f['attributes'][_0x2b93('0x34')]?_0x43643f[_0x2b93('0x31')]:_0x4a5b16[_0x2b93('0x30')];if(_0x5bb7e2[_0x2b93('0x2f')][_0x2b93('0x3d')]){_0x43643f[_0x2b93('0x3e')]=[{'all':!![]}];}_0x43643f=_[_0x2b93('0x44')]({},_0x43643f,_0x5bb7e2[_0x2b93('0x45')]);return db[_0x2b93('0x2c')][_0x2b93('0x46')](_0x43643f)[_0x2b93('0x26')](handleEntityNotFound(_0x39a72c,null))[_0x2b93('0x26')](respondWithResult(_0x39a72c,null))[_0x2b93('0x41')](handleError(_0x39a72c,null));};exports[_0x2b93('0x47')]=function(_0x6a13d5,_0x3bde66){return db[_0x2b93('0x2c')][_0x2b93('0x47')](_0x6a13d5['body'],{})['then'](function(_0x5a0a4d){var _0x349b46=_0x6a13d5[_0x2b93('0x48')][_0x2b93('0x49')]({'plain':!![]});if(!_0x349b46)throw new Error(_0x2b93('0x4a'));if(_0x349b46[_0x2b93('0x4b')]===_0x2b93('0x48')){var _0x1abb52=_0x5a0a4d['get']({'plain':!![]});var _0x535db0='Companies';return db[_0x2b93('0x4c')][_0x2b93('0x46')]({'where':{'name':_0x535db0,'userProfileId':_0x349b46[_0x2b93('0x4d')]},'raw':!![]})[_0x2b93('0x26')](function(_0x1b382a){if(_0x1b382a&&_0x1b382a[_0x2b93('0x4e')]===0x0){return db[_0x2b93('0x28')][_0x2b93('0x47')]({'name':_0x1abb52[_0x2b93('0x2a')],'resourceId':_0x1abb52['id'],'type':_0x1b382a[_0x2b93('0x2a')],'sectionId':_0x1b382a['id']},{})[_0x2b93('0x26')](function(){return _0x5a0a4d;});}else{return _0x5a0a4d;}})['catch'](function(_0x9f81fa){logger[_0x2b93('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9f81fa);throw _0x9f81fa;});}return _0x5a0a4d;})[_0x2b93('0x26')](respondWithResult(_0x3bde66,0xc9))['catch'](handleError(_0x3bde66,null));};exports[_0x2b93('0x50')]=function(_0x97d8a,_0x579ab2){if(_0x97d8a[_0x2b93('0x51')]['id']){delete _0x97d8a[_0x2b93('0x51')]['id'];}return db[_0x2b93('0x2c')][_0x2b93('0x46')]({'where':{'id':_0x97d8a['params']['id']}})[_0x2b93('0x26')](handleEntityNotFound(_0x579ab2,null))[_0x2b93('0x26')](saveUpdates(_0x97d8a[_0x2b93('0x51')],null))['then'](respondWithResult(_0x579ab2,null))[_0x2b93('0x41')](handleError(_0x579ab2,null));};exports[_0x2b93('0x27')]=function(_0xcb6b95,_0x34b1f2){return db[_0x2b93('0x2c')][_0x2b93('0x46')]({'where':{'id':_0xcb6b95[_0x2b93('0x42')]['id']}})['then'](handleEntityNotFound(_0x34b1f2,null))[_0x2b93('0x26')](removeEntity(_0x34b1f2,null))[_0x2b93('0x41')](handleError(_0x34b1f2,null));};exports[_0x2b93('0x2d')]=function(_0x2c68fd,_0x34c129){return db[_0x2b93('0x2c')][_0x2b93('0x2d')]()[_0x2b93('0x26')](respondWithResult(_0x34c129,null))[_0x2b93('0x41')](handleError(_0x34c129,null));};exports[_0x2b93('0x52')]=function(_0x36142d,_0x5e5a0a,_0x46fda9){return db[_0x2b93('0x53')][_0x2b93('0x46')]({'where':{'id':_0x36142d[_0x2b93('0x42')]['id']}})[_0x2b93('0x26')](handleEntityNotFound(_0x5e5a0a,null))['then'](function(_0xeb7351){if(_0xeb7351){return _0xeb7351[_0x2b93('0x52')](_0x36142d[_0x2b93('0x51')][_0x2b93('0x54')],_[_0x2b93('0x55')](_0x36142d[_0x2b93('0x51')],['ids','id'])||{});}})['then'](respondWithResult(_0x5e5a0a,null))[_0x2b93('0x41')](handleError(_0x5e5a0a,null));};exports[_0x2b93('0x56')]=function(_0x1314c5,_0x2c5168,_0x23b72a){var _0x5c49bc={};var _0x356fac={};var _0x21d864;var _0x56ba67;return db['CmCompany'][_0x2b93('0x57')]({'where':{'id':_0x1314c5[_0x2b93('0x42')]['id']}})[_0x2b93('0x26')](handleEntityNotFound(_0x2c5168,null))[_0x2b93('0x26')](function(_0x380534){if(_0x380534){_0x21d864=_0x380534;_0x356fac[_0x2b93('0x30')]=_[_0x2b93('0x2e')](db[_0x2b93('0x53')]['rawAttributes']);_0x356fac[_0x2b93('0x2f')]=_[_0x2b93('0x2e')](_0x1314c5['query']);_0x356fac[_0x2b93('0x3a')]=_[_0x2b93('0x32')](_0x356fac[_0x2b93('0x30')],_0x356fac[_0x2b93('0x2f')]);_0x5c49bc[_0x2b93('0x31')]=_[_0x2b93('0x32')](_0x356fac[_0x2b93('0x30')],qs['fields'](_0x1314c5[_0x2b93('0x2f')]['fields']));_0x5c49bc[_0x2b93('0x31')]=_0x5c49bc['attributes'][_0x2b93('0x34')]?_0x5c49bc[_0x2b93('0x31')]:_0x356fac[_0x2b93('0x30')];_0x5c49bc['order']=qs[_0x2b93('0x37')](_0x1314c5[_0x2b93('0x2f')][_0x2b93('0x37')]);_0x5c49bc[_0x2b93('0x38')]=qs[_0x2b93('0x3a')](_['pick'](_0x1314c5[_0x2b93('0x2f')],_0x356fac[_0x2b93('0x3a')]));if(_0x1314c5[_0x2b93('0x2f')][_0x2b93('0x3b')]){_0x5c49bc[_0x2b93('0x38')]=_[_0x2b93('0x44')](_0x5c49bc['where'],{'$or':_[_0x2b93('0x3c')](_0x5c49bc[_0x2b93('0x31')],function(_0x309c88){var _0x39d218={};_0x39d218[_0x309c88]={'$like':'%'+_0x1314c5[_0x2b93('0x2f')][_0x2b93('0x3b')]+'%'};return _0x39d218;})});}_0x5c49bc=_['merge']({},_0x5c49bc,_0x1314c5[_0x2b93('0x45')]);return _0x21d864[_0x2b93('0x56')](_0x5c49bc);}})[_0x2b93('0x26')](function(_0x48abfc){if(_0x48abfc){_0x56ba67=_0x48abfc[_0x2b93('0x34')];if(!_0x1314c5['query'][_0x2b93('0x35')]('nolimit')){_0x5c49bc[_0x2b93('0x1f')]=qs['limit'](_0x1314c5[_0x2b93('0x2f')][_0x2b93('0x1f')]);_0x5c49bc[_0x2b93('0x1e')]=qs['offset'](_0x1314c5[_0x2b93('0x2f')][_0x2b93('0x1e')]);}return _0x21d864[_0x2b93('0x56')](_0x5c49bc);}})[_0x2b93('0x26')](function(_0x550d87){if(_0x550d87){return _0x550d87?{'count':_0x56ba67,'rows':_0x550d87}:null;}})[_0x2b93('0x26')](respondWithResult(_0x2c5168,null))[_0x2b93('0x41')](handleError(_0x2c5168,null));}; \ No newline at end of file +var _0x97bb=['rimraf','zip-dir','request-promise','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','CmCompany','describe','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','include','findAll','rows','catch','show','rawAttributes','includeAll','options','find','create','body','role','user','Companies','UserProfileSection','userProfileId','autoAssociation','params','addContacts','CmContact','ids','omit','getContacts','findOne','map','nolimit','eml-format'];(function(_0x3a1138,_0x4bff93){var _0x3cfd7a=function(_0x2901d6){while(--_0x2901d6){_0x3a1138['push'](_0x3a1138['shift']());}};_0x3cfd7a(++_0x4bff93);}(_0x97bb,0x113));var _0xb97b=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x97bb[_0x5f0089];return _0x193892;};'use strict';var emlformat=require(_0xb97b('0x0'));var rimraf=require(_0xb97b('0x1'));var zipdir=require(_0xb97b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb97b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb97b('0x4'));var util=require('util');var path=require(_0xb97b('0x5'));var sox=require(_0xb97b('0x6'));var csv=require('to-csv');var ejs=require(_0xb97b('0x7'));var fs=require('fs');var fs_extra=require(_0xb97b('0x8'));var _=require(_0xb97b('0x9'));var squel=require(_0xb97b('0xa'));var crypto=require(_0xb97b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb97b('0xc'));var toCsv=require(_0xb97b('0xd'));var querystring=require(_0xb97b('0xe'));var Papa=require(_0xb97b('0xf'));var Redis=require(_0xb97b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb97b('0x11'));var as=require(_0xb97b('0x12'));var hardwareService=require(_0xb97b('0x13'));var logger=require(_0xb97b('0x14'))(_0xb97b('0x15'));var utils=require(_0xb97b('0x16'));var config=require(_0xb97b('0x17'));var licenseUtil=require(_0xb97b('0x18'));var db=require(_0xb97b('0x19'))['db'];function respondWithStatusCode(_0x3d266c,_0x343c86){_0x343c86=_0x343c86||0xcc;return function(_0x1b30b3){if(_0x1b30b3){return _0x3d266c[_0xb97b('0x1a')](_0x343c86);}return _0x3d266c[_0xb97b('0x1b')](_0x343c86)[_0xb97b('0x1c')]();};}function respondWithResult(_0x3f408f,_0x35c78b){_0x35c78b=_0x35c78b||0xc8;return function(_0x1c9fab){if(_0x1c9fab){return _0x3f408f[_0xb97b('0x1b')](_0x35c78b)[_0xb97b('0x1d')](_0x1c9fab);}};}function respondWithFilteredResult(_0xf9464c,_0x5c4e95){return function(_0x98bd0c){if(_0x98bd0c){var _0x104d8f=typeof _0x5c4e95[_0xb97b('0x1e')]===_0xb97b('0x1f')&&typeof _0x5c4e95['limit']===_0xb97b('0x1f');var _0x319826=_0x98bd0c[_0xb97b('0x20')];var _0x5a94a6=_0x104d8f?0x0:_0x5c4e95[_0xb97b('0x1e')];var _0x174720=_0x104d8f?_0x98bd0c['count']:_0x5c4e95['offset']+_0x5c4e95[_0xb97b('0x21')];var _0x323744;if(_0x174720>=_0x319826){_0x174720=_0x319826;_0x323744=0xc8;}else{_0x323744=0xce;}_0xf9464c['status'](_0x323744);return _0xf9464c[_0xb97b('0x22')](_0xb97b('0x23'),_0x5a94a6+'-'+_0x174720+'/'+_0x319826)[_0xb97b('0x1d')](_0x98bd0c);}return null;};}function patchUpdates(_0x5a155b){return function(_0x323095){try{jsonpatch[_0xb97b('0x24')](_0x323095,_0x5a155b,!![]);}catch(_0x5e6717){return BPromise[_0xb97b('0x25')](_0x5e6717);}return _0x323095[_0xb97b('0x26')]();};}function saveUpdates(_0x496ecd,_0x25e8ab){return function(_0x4b6a7d){if(_0x4b6a7d){return _0x4b6a7d[_0xb97b('0x27')](_0x496ecd)[_0xb97b('0x28')](function(_0x2266a8){return _0x2266a8;});}return null;};}function removeEntity(_0x262635,_0xc51d9a){return function(_0x391bdc){if(_0x391bdc){return _0x391bdc[_0xb97b('0x29')]()[_0xb97b('0x28')](function(){var _0x212478=_0x391bdc[_0xb97b('0x2a')]({'plain':!![]});var _0x509152='Companies';return db[_0xb97b('0x2b')][_0xb97b('0x29')]({'where':{'type':_0x509152,'resourceId':_0x212478['id']}})['then'](function(){return _0x391bdc;});})[_0xb97b('0x28')](function(){_0x262635['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22ad61,_0x3bdf4c){return function(_0x4aed8b){if(!_0x4aed8b){_0x22ad61[_0xb97b('0x1a')](0x194);}return _0x4aed8b;};}function handleError(_0x3faf02,_0x271d64){_0x271d64=_0x271d64||0x1f4;return function(_0x27a737){logger[_0xb97b('0x2c')](_0x27a737[_0xb97b('0x2d')]);if(_0x27a737[_0xb97b('0x2e')]){delete _0x27a737[_0xb97b('0x2e')];}_0x3faf02[_0xb97b('0x1b')](_0x271d64)[_0xb97b('0x2f')](_0x27a737);};}exports[_0xb97b('0x30')]=function(_0x1dedf7,_0x40451b){var _0x3d13e5={},_0x5b8fc0={},_0x2076bd={'count':0x0,'rows':[]};return db[_0xb97b('0x31')][_0xb97b('0x32')]()[_0xb97b('0x28')](function(_0x12f346){_0x5b8fc0[_0xb97b('0x33')]=_['keys'](_0x12f346);_0x5b8fc0[_0xb97b('0x34')]=_[_0xb97b('0x35')](_0x1dedf7[_0xb97b('0x34')]);_0x5b8fc0[_0xb97b('0x36')]=_[_0xb97b('0x37')](_0x5b8fc0[_0xb97b('0x33')],_0x5b8fc0[_0xb97b('0x34')]);_0x3d13e5['attributes']=_['intersection'](_0x5b8fc0[_0xb97b('0x33')],qs[_0xb97b('0x38')](_0x1dedf7['query']['fields']));_0x3d13e5[_0xb97b('0x39')]=_0x3d13e5[_0xb97b('0x39')][_0xb97b('0x3a')]?_0x3d13e5['attributes']:_0x5b8fc0['model'];if(!_0x1dedf7[_0xb97b('0x34')][_0xb97b('0x3b')]('nolimit')){_0x3d13e5['limit']=qs[_0xb97b('0x21')](_0x1dedf7[_0xb97b('0x34')][_0xb97b('0x21')]);_0x3d13e5['offset']=qs[_0xb97b('0x1e')](_0x1dedf7[_0xb97b('0x34')][_0xb97b('0x1e')]);}_0x3d13e5[_0xb97b('0x3c')]=qs[_0xb97b('0x3d')](_0x1dedf7[_0xb97b('0x34')]['sort']);_0x3d13e5[_0xb97b('0x3e')]=qs[_0xb97b('0x36')](_[_0xb97b('0x3f')](_0x1dedf7[_0xb97b('0x34')],_0x5b8fc0['filters']),_0x12f346);if(_0x1dedf7[_0xb97b('0x34')][_0xb97b('0x40')]){_0x3d13e5[_0xb97b('0x3e')]=_[_0xb97b('0x41')](_0x3d13e5['where'],{'$or':_['map'](_0x3d13e5[_0xb97b('0x39')],function(_0x3c4da7){var _0x45947e={};_0x45947e[_0x3c4da7]={'$like':'%'+_0x1dedf7['query'][_0xb97b('0x40')]+'%'};return _0x45947e;})});}_0x3d13e5=_[_0xb97b('0x41')]({},_0x3d13e5,_0x1dedf7['options']);var _0x32e256={'where':_0x3d13e5[_0xb97b('0x3e')]};return db[_0xb97b('0x31')][_0xb97b('0x20')](_0x32e256)[_0xb97b('0x28')](function(_0xa16d80){_0x2076bd[_0xb97b('0x20')]=_0xa16d80;if(_0x1dedf7['query']['includeAll']){_0x3d13e5[_0xb97b('0x42')]=[{'all':!![]}];}return db[_0xb97b('0x31')][_0xb97b('0x43')](_0x3d13e5);})[_0xb97b('0x28')](function(_0x48dcbd){_0x2076bd[_0xb97b('0x44')]=_0x48dcbd;return _0x2076bd;})[_0xb97b('0x28')](respondWithFilteredResult(_0x40451b,_0x3d13e5))[_0xb97b('0x45')](handleError(_0x40451b,null));})[_0xb97b('0x45')](handleError(_0x40451b,null));};exports[_0xb97b('0x46')]=function(_0x40e56d,_0x10052d){var _0x59c286={'raw':![],'where':{'id':_0x40e56d['params']['id']}},_0x2041e2={};_0x2041e2[_0xb97b('0x33')]=_[_0xb97b('0x35')](db['CmCompany'][_0xb97b('0x47')]);_0x2041e2[_0xb97b('0x34')]=_[_0xb97b('0x35')](_0x40e56d[_0xb97b('0x34')]);_0x2041e2[_0xb97b('0x36')]=_[_0xb97b('0x37')](_0x2041e2[_0xb97b('0x33')],_0x2041e2[_0xb97b('0x34')]);_0x59c286[_0xb97b('0x39')]=_[_0xb97b('0x37')](_0x2041e2[_0xb97b('0x33')],qs[_0xb97b('0x38')](_0x40e56d['query']['fields']));_0x59c286[_0xb97b('0x39')]=_0x59c286[_0xb97b('0x39')][_0xb97b('0x3a')]?_0x59c286[_0xb97b('0x39')]:_0x2041e2[_0xb97b('0x33')];if(_0x40e56d['query'][_0xb97b('0x48')]){_0x59c286[_0xb97b('0x42')]=[{'all':!![]}];}_0x59c286=_[_0xb97b('0x41')]({},_0x59c286,_0x40e56d[_0xb97b('0x49')]);return db[_0xb97b('0x31')][_0xb97b('0x4a')](_0x59c286)['then'](handleEntityNotFound(_0x10052d,null))['then'](respondWithResult(_0x10052d,null))[_0xb97b('0x45')](handleError(_0x10052d,null));};exports[_0xb97b('0x4b')]=function(_0x5cb649,_0x15e07e){return db[_0xb97b('0x31')][_0xb97b('0x4b')](_0x5cb649[_0xb97b('0x4c')],{})[_0xb97b('0x28')](function(_0x5c07cb){var _0x50e648=_0x5cb649['user']['get']({'plain':!![]});if(!_0x50e648)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x50e648[_0xb97b('0x4d')]===_0xb97b('0x4e')){var _0x47e644=_0x5c07cb[_0xb97b('0x2a')]({'plain':!![]});var _0x142664=_0xb97b('0x4f');return db[_0xb97b('0x50')][_0xb97b('0x4a')]({'where':{'name':_0x142664,'userProfileId':_0x50e648[_0xb97b('0x51')]},'raw':!![]})['then'](function(_0x55ddc0){if(_0x55ddc0&&_0x55ddc0[_0xb97b('0x52')]===0x0){return db[_0xb97b('0x2b')][_0xb97b('0x4b')]({'name':_0x47e644[_0xb97b('0x2e')],'resourceId':_0x47e644['id'],'type':_0x55ddc0[_0xb97b('0x2e')],'sectionId':_0x55ddc0['id']},{})[_0xb97b('0x28')](function(){return _0x5c07cb;});}else{return _0x5c07cb;}})[_0xb97b('0x45')](function(_0x3b1960){logger[_0xb97b('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b1960);throw _0x3b1960;});}return _0x5c07cb;})[_0xb97b('0x28')](respondWithResult(_0x15e07e,0xc9))[_0xb97b('0x45')](handleError(_0x15e07e,null));};exports[_0xb97b('0x27')]=function(_0x430781,_0x2e0875){if(_0x430781[_0xb97b('0x4c')]['id']){delete _0x430781[_0xb97b('0x4c')]['id'];}return db[_0xb97b('0x31')][_0xb97b('0x4a')]({'where':{'id':_0x430781[_0xb97b('0x53')]['id']}})['then'](handleEntityNotFound(_0x2e0875,null))['then'](saveUpdates(_0x430781[_0xb97b('0x4c')],null))['then'](respondWithResult(_0x2e0875,null))['catch'](handleError(_0x2e0875,null));};exports[_0xb97b('0x29')]=function(_0x27a711,_0x427bce){return db[_0xb97b('0x31')][_0xb97b('0x4a')]({'where':{'id':_0x27a711[_0xb97b('0x53')]['id']}})[_0xb97b('0x28')](handleEntityNotFound(_0x427bce,null))['then'](removeEntity(_0x427bce,null))[_0xb97b('0x45')](handleError(_0x427bce,null));};exports[_0xb97b('0x32')]=function(_0x5b466b,_0x3296d1){return db[_0xb97b('0x31')][_0xb97b('0x32')]()[_0xb97b('0x28')](respondWithResult(_0x3296d1,null))[_0xb97b('0x45')](handleError(_0x3296d1,null));};exports[_0xb97b('0x54')]=function(_0x3096ae,_0x22aa84,_0x51d6f4){return db[_0xb97b('0x55')][_0xb97b('0x4a')]({'where':{'id':_0x3096ae[_0xb97b('0x53')]['id']}})[_0xb97b('0x28')](handleEntityNotFound(_0x22aa84,null))['then'](function(_0x596b7e){if(_0x596b7e){return _0x596b7e[_0xb97b('0x54')](_0x3096ae[_0xb97b('0x4c')][_0xb97b('0x56')],_[_0xb97b('0x57')](_0x3096ae['body'],['ids','id'])||{});}})[_0xb97b('0x28')](respondWithResult(_0x22aa84,null))['catch'](handleError(_0x22aa84,null));};exports[_0xb97b('0x58')]=function(_0x2b4f76,_0x1663ad,_0x47d831){var _0x54080f={};var _0x337bef={};var _0x4f1978;var _0x32c969;return db[_0xb97b('0x31')][_0xb97b('0x59')]({'where':{'id':_0x2b4f76[_0xb97b('0x53')]['id']}})['then'](handleEntityNotFound(_0x1663ad,null))[_0xb97b('0x28')](function(_0x5d8191){if(_0x5d8191){_0x4f1978=_0x5d8191;_0x337bef['model']=_[_0xb97b('0x35')](db['CmContact'][_0xb97b('0x47')]);_0x337bef[_0xb97b('0x34')]=_[_0xb97b('0x35')](_0x2b4f76[_0xb97b('0x34')]);_0x337bef[_0xb97b('0x36')]=_[_0xb97b('0x37')](_0x337bef[_0xb97b('0x33')],_0x337bef['query']);_0x54080f[_0xb97b('0x39')]=_[_0xb97b('0x37')](_0x337bef[_0xb97b('0x33')],qs['fields'](_0x2b4f76[_0xb97b('0x34')]['fields']));_0x54080f[_0xb97b('0x39')]=_0x54080f[_0xb97b('0x39')][_0xb97b('0x3a')]?_0x54080f[_0xb97b('0x39')]:_0x337bef['model'];_0x54080f[_0xb97b('0x3c')]=qs[_0xb97b('0x3d')](_0x2b4f76['query'][_0xb97b('0x3d')]);_0x54080f[_0xb97b('0x3e')]=qs[_0xb97b('0x36')](_[_0xb97b('0x3f')](_0x2b4f76[_0xb97b('0x34')],_0x337bef[_0xb97b('0x36')]));if(_0x2b4f76[_0xb97b('0x34')]['filter']){_0x54080f[_0xb97b('0x3e')]=_[_0xb97b('0x41')](_0x54080f['where'],{'$or':_[_0xb97b('0x5a')](_0x54080f[_0xb97b('0x39')],function(_0x42fc77){var _0x45e0d4={};_0x45e0d4[_0x42fc77]={'$like':'%'+_0x2b4f76[_0xb97b('0x34')][_0xb97b('0x40')]+'%'};return _0x45e0d4;})});}_0x54080f=_[_0xb97b('0x41')]({},_0x54080f,_0x2b4f76[_0xb97b('0x49')]);return _0x4f1978[_0xb97b('0x58')](_0x54080f);}})[_0xb97b('0x28')](function(_0x1146eb){if(_0x1146eb){_0x32c969=_0x1146eb[_0xb97b('0x3a')];if(!_0x2b4f76[_0xb97b('0x34')][_0xb97b('0x3b')](_0xb97b('0x5b'))){_0x54080f['limit']=qs[_0xb97b('0x21')](_0x2b4f76['query'][_0xb97b('0x21')]);_0x54080f['offset']=qs[_0xb97b('0x1e')](_0x2b4f76[_0xb97b('0x34')][_0xb97b('0x1e')]);}return _0x4f1978['getContacts'](_0x54080f);}})[_0xb97b('0x28')](function(_0x548a04){if(_0x548a04){return _0x548a04?{'count':_0x32c969,'rows':_0x548a04}:null;}})['then'](respondWithResult(_0x1663ad,null))[_0xb97b('0x45')](handleError(_0x1663ad,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 15d3ff3..5b5531c 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 _0x5206=['CmCompany','lodash','util','../../config/logger','bluebird','path','rimraf','exports'];(function(_0x5b75ba,_0x22681a){var _0x1b2ced=function(_0x467f78){while(--_0x467f78){_0x5b75ba['push'](_0x5b75ba['shift']());}};_0x1b2ced(++_0x22681a);}(_0x5206,0xc1));var _0x6520=function(_0x557c41,_0x30e964){_0x557c41=_0x557c41-0x0;var _0x141745=_0x5206[_0x557c41];return _0x141745;};'use strict';var _=require(_0x6520('0x0'));var util=require(_0x6520('0x1'));var logger=require(_0x6520('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6520('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6520('0x4'));var rimraf=require(_0x6520('0x5'));var config=require('../../config/environment');var attributes=require('./cmCompany.attributes');module[_0x6520('0x6')]=function(_0x19cbe0,_0xfa266c){return _0x19cbe0['define'](_0x6520('0x7'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1221=['path','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','util','moment','bluebird','request-promise'];(function(_0x5db334,_0x571404){var _0x3e7669=function(_0x12d83d){while(--_0x12d83d){_0x5db334['push'](_0x5db334['shift']());}};_0x3e7669(++_0x571404);}(_0x1221,0x14b));var _0x1122=function(_0x2f82a8,_0x502ff1){_0x2f82a8=_0x2f82a8-0x0;var _0x268b64=_0x1221[_0x2f82a8];return _0x268b64;};'use strict';var _=require(_0x1122('0x0'));var util=require(_0x1122('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1122('0x2'));var BPromise=require(_0x1122('0x3'));var rp=require(_0x1122('0x4'));var fs=require('fs');var path=require(_0x1122('0x5'));var rimraf=require('rimraf');var config=require(_0x1122('0x6'));var attributes=require(_0x1122('0x7'));module[_0x1122('0x8')]=function(_0x396ef6,_0x339b41){return _0x396ef6[_0x1122('0x9')](_0x1122('0xa'),attributes,{'tableName':_0x1122('0xb'),'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 1191c8f..51a1ba9 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 _0x70ad=['randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','CmCompany,\x20%s,\x20%s','message','catch','lodash','util','bluebird'];(function(_0x114c53,_0x2249c6){var _0x4e0c14=function(_0x1fe406){while(--_0x1fe406){_0x114c53['push'](_0x114c53['shift']());}};_0x4e0c14(++_0x2249c6);}(_0x70ad,0x7b));var _0xd70a=function(_0x306626,_0x425e93){_0x306626=_0x306626-0x0;var _0x466728=_0x70ad[_0x306626];return _0x466728;};'use strict';var _=require(_0xd70a('0x0'));var util=require(_0xd70a('0x1'));var moment=require('moment');var BPromise=require(_0xd70a('0x2'));var rs=require(_0xd70a('0x3'));var fs=require('fs');var Redis=require(_0xd70a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd70a('0x5'));var logger=require('../../config/logger')(_0xd70a('0x6'));var config=require('../../config/environment');var jayson=require(_0xd70a('0x7'));var client=jayson[_0xd70a('0x8')][_0xd70a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x576218,_0x1f33b6,_0x836c5e){return new BPromise(function(_0x5b9120,_0x4298a1){return client[_0xd70a('0xa')](_0x576218,_0x836c5e)[_0xd70a('0xb')](function(_0x536671){logger[_0xd70a('0xc')]('CmCompany,\x20%s,\x20%s',_0x1f33b6,_0xd70a('0xd'));logger[_0xd70a('0xe')](_0xd70a('0xf'),_0x1f33b6,'request\x20sent',JSON[_0xd70a('0x10')](_0x536671));if(_0x536671['error']){if(_0x536671[_0xd70a('0x11')]['code']===0x1f4){logger[_0xd70a('0x11')](_0xd70a('0x12'),_0x1f33b6,_0x536671[_0xd70a('0x11')]['message']);return _0x4298a1(_0x536671['error'][_0xd70a('0x13')]);}logger[_0xd70a('0x11')](_0xd70a('0x12'),_0x1f33b6,_0x536671[_0xd70a('0x11')][_0xd70a('0x13')]);return _0x5b9120(_0x536671[_0xd70a('0x11')][_0xd70a('0x13')]);}else{logger[_0xd70a('0xc')](_0xd70a('0x12'),_0x1f33b6,_0xd70a('0xd'));_0x5b9120(_0x536671['result'][_0xd70a('0x13')]);}})[_0xd70a('0x14')](function(_0x3e480c){logger[_0xd70a('0x11')](_0xd70a('0x12'),_0x1f33b6,_0x3e480c);_0x4298a1(_0x3e480c);});});} \ No newline at end of file +var _0x500c=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCompany,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird'];(function(_0x5b0bdd,_0x38515d){var _0x2d5bf7=function(_0x13ffa4){while(--_0x13ffa4){_0x5b0bdd['push'](_0x5b0bdd['shift']());}};_0x2d5bf7(++_0x38515d);}(_0x500c,0x111));var _0xc500=function(_0x1e3aab,_0x196b19){_0x1e3aab=_0x1e3aab-0x0;var _0x385044=_0x500c[_0x1e3aab];return _0x385044;};'use strict';var _=require(_0xc500('0x0'));var util=require('util');var moment=require(_0xc500('0x1'));var BPromise=require(_0xc500('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc500('0x3'));var db=require(_0xc500('0x4'))['db'];var utils=require(_0xc500('0x5'));var logger=require('../../config/logger')(_0xc500('0x6'));var config=require(_0xc500('0x7'));var jayson=require(_0xc500('0x8'));var client=jayson[_0xc500('0x9')][_0xc500('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5534e5,_0x443030,_0x2fea27){return new BPromise(function(_0x2107d9,_0x45f66d){return client[_0xc500('0xb')](_0x5534e5,_0x2fea27)['then'](function(_0x1f5278){logger['info']('CmCompany,\x20%s,\x20%s',_0x443030,_0xc500('0xc'));logger[_0xc500('0xd')](_0xc500('0xe'),_0x443030,_0xc500('0xc'),JSON[_0xc500('0xf')](_0x1f5278));if(_0x1f5278[_0xc500('0x10')]){if(_0x1f5278[_0xc500('0x10')][_0xc500('0x11')]===0x1f4){logger['error'](_0xc500('0x12'),_0x443030,_0x1f5278[_0xc500('0x10')]['message']);return _0x45f66d(_0x1f5278['error'][_0xc500('0x13')]);}logger['error'](_0xc500('0x12'),_0x443030,_0x1f5278[_0xc500('0x10')]['message']);return _0x2107d9(_0x1f5278[_0xc500('0x10')][_0xc500('0x13')]);}else{logger[_0xc500('0x14')]('CmCompany,\x20%s,\x20%s',_0x443030,_0xc500('0xc'));_0x2107d9(_0x1f5278[_0xc500('0x15')][_0xc500('0x13')]);}})[_0xc500('0x16')](function(_0x20c465){logger['error'](_0xc500('0x12'),_0x443030,_0x20c465);_0x45f66d(_0x20c465);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index e1877f5..69f5e59 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 _0xdbcb=['/:id/contacts','post','create','addContacts','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','describe','/:id'];(function(_0x1ef2b0,_0x274ecd){var _0x3d40f4=function(_0x494909){while(--_0x494909){_0x1ef2b0['push'](_0x1ef2b0['shift']());}};_0x3d40f4(++_0x274ecd);}(_0xdbcb,0x1d6));var _0xbdbc=function(_0xfed299,_0x21b8d0){_0xfed299=_0xfed299-0x0;var _0x4ef1f2=_0xdbcb[_0xfed299];return _0x4ef1f2;};'use strict';var multer=require(_0xbdbc('0x0'));var util=require(_0xbdbc('0x1'));var path=require(_0xbdbc('0x2'));var timeout=require(_0xbdbc('0x3'));var express=require(_0xbdbc('0x4'));var router=express[_0xbdbc('0x5')]();var fs_extra=require(_0xbdbc('0x6'));var auth=require(_0xbdbc('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xbdbc('0x8'));var controller=require('./cmCompany.controller');router[_0xbdbc('0x9')]('/',auth[_0xbdbc('0xa')](),controller['index']);router[_0xbdbc('0x9')]('/describe',auth[_0xbdbc('0xa')](),controller[_0xbdbc('0xb')]);router[_0xbdbc('0x9')](_0xbdbc('0xc'),auth[_0xbdbc('0xa')](),controller['show']);router[_0xbdbc('0x9')](_0xbdbc('0xd'),auth[_0xbdbc('0xa')](),controller['getContacts']);router[_0xbdbc('0xe')]('/',auth[_0xbdbc('0xa')](),controller[_0xbdbc('0xf')]);router[_0xbdbc('0xe')](_0xbdbc('0xd'),auth['isAuthenticated'](),controller[_0xbdbc('0x10')]);router[_0xbdbc('0x11')](_0xbdbc('0xc'),auth[_0xbdbc('0xa')](),controller[_0xbdbc('0x12')]);router['delete']('/:id',auth[_0xbdbc('0xa')](),controller[_0xbdbc('0x13')]);module[_0xbdbc('0x14')]=router; \ No newline at end of file +var _0x1a5e=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','index','/describe','describe','isAuthenticated','show','/:id/contacts','getContacts','post','put','/:id','update','destroy','exports','multer'];(function(_0x4589fd,_0x4c6f26){var _0x44084b=function(_0x1eeabd){while(--_0x1eeabd){_0x4589fd['push'](_0x4589fd['shift']());}};_0x44084b(++_0x4c6f26);}(_0x1a5e,0x1df));var _0xe1a5=function(_0x51390a,_0x4f3b06){_0x51390a=_0x51390a-0x0;var _0x2ef5df=_0x1a5e[_0x51390a];return _0x2ef5df;};'use strict';var multer=require(_0xe1a5('0x0'));var util=require(_0xe1a5('0x1'));var path=require('path');var timeout=require(_0xe1a5('0x2'));var express=require(_0xe1a5('0x3'));var router=express[_0xe1a5('0x4')]();var fs_extra=require(_0xe1a5('0x5'));var auth=require(_0xe1a5('0x6'));var interaction=require(_0xe1a5('0x7'));var config=require(_0xe1a5('0x8'));var controller=require(_0xe1a5('0x9'));router[_0xe1a5('0xa')]('/',auth['isAuthenticated'](),controller[_0xe1a5('0xb')]);router[_0xe1a5('0xa')](_0xe1a5('0xc'),auth['isAuthenticated'](),controller[_0xe1a5('0xd')]);router[_0xe1a5('0xa')]('/:id',auth[_0xe1a5('0xe')](),controller[_0xe1a5('0xf')]);router[_0xe1a5('0xa')](_0xe1a5('0x10'),auth[_0xe1a5('0xe')](),controller[_0xe1a5('0x11')]);router[_0xe1a5('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe1a5('0x12')](_0xe1a5('0x10'),auth[_0xe1a5('0xe')](),controller['addContacts']);router[_0xe1a5('0x13')](_0xe1a5('0x14'),auth[_0xe1a5('0xe')](),controller[_0xe1a5('0x15')]);router['delete'](_0xe1a5('0x14'),auth[_0xe1a5('0xe')](),controller[_0xe1a5('0x16')]);module[_0xe1a5('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 93885dd..25df376 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 _0x34b4=['UNSIGNED','DATE','NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER'];(function(_0x3d7db0,_0x19f465){var _0x10632d=function(_0x1112ec){while(--_0x1112ec){_0x3d7db0['push'](_0x3d7db0['shift']());}};_0x10632d(++_0x19f465);}(_0x34b4,0x135));var _0x434b=function(_0x4e151c,_0x1aec10){_0x4e151c=_0x4e151c-0x0;var _0xe92cdd=_0x34b4[_0x4e151c];return _0xe92cdd;};'use strict';var _=require(_0x434b('0x0'));var Sequelize=require(_0x434b('0x1'));module[_0x434b('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x434b('0x3')]},'postalCode':{'type':Sequelize[_0x434b('0x3')]},'city':{'type':Sequelize[_0x434b('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x434b('0x3')]},'description':{'type':Sequelize[_0x434b('0x4')]},'phone':{'type':Sequelize[_0x434b('0x3')]},'mobile':{'type':Sequelize[_0x434b('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x434b('0x3')]},'url':{'type':Sequelize[_0x434b('0x3')]},'facebook':{'type':Sequelize[_0x434b('0x3')]},'fb_data':{'type':Sequelize[_0x434b('0x3')]},'twitter':{'type':Sequelize[_0x434b('0x3')]},'skype':{'type':Sequelize[_0x434b('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x434b('0x3')]},'line':{'type':Sequelize[_0x434b('0x3')]},'wechat':{'type':Sequelize[_0x434b('0x3')]},'telegram':{'type':Sequelize[_0x434b('0x3')]},'UserId':{'type':Sequelize[_0x434b('0x5')]},'priority':{'type':Sequelize[_0x434b('0x5')](0x2)[_0x434b('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x434b('0x7')],'defaultValue':Sequelize[_0x434b('0x8')]}}; \ No newline at end of file +var _0xff5e=['lodash','sequelize','exports','STRING','INTEGER','DATE','NOW'];(function(_0x141782,_0x20a5de){var _0x504c01=function(_0x50452f){while(--_0x50452f){_0x141782['push'](_0x141782['shift']());}};_0x504c01(++_0x20a5de);}(_0xff5e,0xe0));var _0xeff5=function(_0x2b009a,_0xe18995){_0x2b009a=_0x2b009a-0x0;var _0x40501d=_0xff5e[_0x2b009a];return _0x40501d;};'use strict';var _=require(_0xeff5('0x0'));var Sequelize=require(_0xeff5('0x1'));module[_0xeff5('0x2')]={'firstName':{'type':Sequelize[_0xeff5('0x3')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xeff5('0x3')]},'postalCode':{'type':Sequelize[_0xeff5('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xeff5('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xeff5('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xeff5('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xeff5('0x3')]},'facebook':{'type':Sequelize[_0xeff5('0x3')]},'fb_data':{'type':Sequelize[_0xeff5('0x3')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0xeff5('0x3')]},'teams':{'type':Sequelize[_0xeff5('0x3')]},'viber':{'type':Sequelize[_0xeff5('0x3')]},'line':{'type':Sequelize[_0xeff5('0x3')]},'wechat':{'type':Sequelize[_0xeff5('0x3')]},'telegram':{'type':Sequelize[_0xeff5('0x3')]},'UserId':{'type':Sequelize[_0xeff5('0x4')]},'priority':{'type':Sequelize[_0xeff5('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xeff5('0x5')],'defaultValue':Sequelize[_0xeff5('0x6')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index d3d40b0..f635093 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 _0xd5fc=['$and','format','cf_%d','omit','pickBy','table','cm_contacts','setFields','id\x20=\x20?','toParam','text','phone','getTags','rawAttributes','options','setTags','ids','ContactId','includeAll','include','rows','getHopperHistories','nolimit','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','join','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','parse','binding','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','error\x20child\x20process','getJourney','mail','chat','openchannel','fax','voice','-createdAt','channel','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','destination','callerid','starttime','endtime','duration','createdAt','userDisposition','userThirdDisposition','fullname','DESC','findAndCountAll','startCase','closed','closedAt','note','secondDisposition','thirdDisposition','UserId','key','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingValue','referer','subject','substatus','externalUrl','threadId','Interaction','sortBy','reverse','moment','util','path','lodash','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','defaults','redis','socket.io-emitter','./cmContact.socket','register','status','json','offset','limit','undefined','count','set','update','destroy','then','end','error','stack','name','send','index','CmContact','describe','keys','length','startsWith','push','CmCustomField','findOne','trimStart','cf_','fieldType','type','model','query','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filters','select','field','color','from','tools_tags','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','Tag','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','uc.UserId\x20=\x20?','dateOfBirth','datetime','castTo','buildExpression','start','filter','isNil','Contact','isEmpty','c.ListId\x20IN\x20?','concat','\x20=\x20?','tag','isArray','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','c.id','Sequelize','SELECT','having','t.id\x20IN\x20?','resolve','user','role','agent','some','getLists','c.ListId\x20IS\x20NULL','ListId','sequelize','toString','keyBy','merge','c.lastName','c.phone','c.mobile','c.ListId','c.createdAt','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','catch','find','params','tags','columnName','displayName','analytics','findAll','alias','values','body','get','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','create','bulkCreate','each','duplicates','$or','findOrCreate','spread','show'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd5fc,0x6a));var _0xcd5f=function(_0x32d508,_0x193b4b){_0x32d508=_0x32d508-0x0;var _0x17a3ed=_0xd5fc[_0x32d508];return _0x17a3ed;};'use strict';var moment=require(_0xcd5f('0x0'));var BPromise=require('bluebird');var util=require(_0xcd5f('0x1'));var path=require(_0xcd5f('0x2'));var fs=require('fs');var _=require(_0xcd5f('0x3'));var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0xcd5f('0x4'));var qs=require(_0xcd5f('0x5'));var as=require(_0xcd5f('0x6'));var logger=require(_0xcd5f('0x7'))(_0xcd5f('0x8'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0xcd5f('0x9')](config[_0xcd5f('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xcd5f('0xb'))(new Redis(config[_0xcd5f('0xa')]));require(_0xcd5f('0xc'))[_0xcd5f('0xd')](socket);function respondWithResult(_0x1c4042,_0x3cfcac){_0x3cfcac=_0x3cfcac||0xc8;return function(_0x3d3625){if(_0x3d3625){return _0x1c4042[_0xcd5f('0xe')](_0x3cfcac)[_0xcd5f('0xf')](_0x3d3625);}};}function respondWithFilteredResult(_0x4e8404,_0x3c98b6){return function(_0x38c78b){if(_0x38c78b){var _0x277a8b=typeof _0x3c98b6[_0xcd5f('0x10')]==='undefined'&&typeof _0x3c98b6[_0xcd5f('0x11')]===_0xcd5f('0x12');var _0x3e52c2=_0x38c78b['count'];var _0x140134=_0x277a8b?0x0:_0x3c98b6[_0xcd5f('0x10')];var _0x5e29d2=_0x277a8b?_0x38c78b[_0xcd5f('0x13')]:_0x3c98b6['offset']+_0x3c98b6[_0xcd5f('0x11')];var _0x31fc2a;if(_0x5e29d2>=_0x3e52c2){_0x5e29d2=_0x3e52c2;_0x31fc2a=0xc8;}else{_0x31fc2a=0xce;}_0x4e8404['status'](_0x31fc2a);return _0x4e8404[_0xcd5f('0x14')]('Content-Range',_0x140134+'-'+_0x5e29d2+'/'+_0x3e52c2)['json'](_0x38c78b);}return null;};}function saveUpdates(_0x3cdc1d){return function(_0x4b1768){if(_0x4b1768){return _0x4b1768[_0xcd5f('0x15')](_0x3cdc1d)['then'](function(_0x5dec7b){return _0x5dec7b;});}return null;};}function removeEntity(_0x533fcf){return function(_0x37f635){if(_0x37f635){return _0x37f635[_0xcd5f('0x16')]()[_0xcd5f('0x17')](function(){_0x533fcf[_0xcd5f('0xe')](0xcc)[_0xcd5f('0x18')]();});}};}function handleEntityNotFound(_0x3fedbc){return function(_0x5e8dd1){if(!_0x5e8dd1){_0x3fedbc['sendStatus'](0x194);}return _0x5e8dd1;};}function handleError(_0x397b62,_0x2cd575){_0x2cd575=_0x2cd575||0x1f4;return function(_0x19efb5){logger[_0xcd5f('0x19')](_0x19efb5[_0xcd5f('0x1a')]);if(_0x19efb5[_0xcd5f('0x1b')]){delete _0x19efb5[_0xcd5f('0x1b')];}_0x397b62['status'](_0x2cd575)[_0xcd5f('0x1c')](_0x19efb5);};}exports[_0xcd5f('0x1d')]=function(_0x4bda14,_0x5ecb8d){var _0x20e83c={},_0x329cc0={},_0x47ef18={'count':0x0,'rows':[]};return db[_0xcd5f('0x1e')][_0xcd5f('0x1f')]()[_0xcd5f('0x17')](function(_0x3625d7){var _0x33437b=[];for(var _0x1663d9=0x0;_0x1663d90x1){_0xba6118['or'](_0xcd5f('0x5e'),qs[_0xcd5f('0x5f')](_0x377716),null);}else{if(qs[_0xcd5f('0x60')](_0x377716)){_0xba6118['or'](_0xcd5f('0x61'),_0x377716+'%');_0xba6118['or']('c.phone\x20LIKE\x20?',_0x377716+'%');_0xba6118['or'](_0xcd5f('0x62'),_0x377716+'%');_0xba6118['or']('c.fax\x20LIKE\x20?',_0x377716+'%');}else if(qs['isEmail'](_0x377716)){_0xba6118['or']('c.email\x20LIKE\x20?',_0x377716+'%');}else{_0xba6118['or']('c.firstName\x20LIKE\x20?','%'+_0x377716+'%');_0xba6118['or'](_0xcd5f('0x63'),'%'+_0x377716+'%');_0xba6118['or'](_0xcd5f('0x64'),'%'+_0x377716+'%');}}}}_0x2fe9e6[_0xcd5f('0x32')](_0xba6118);_0x2fe9e6['group'](_0xcd5f('0x65'));var _0x4e9437={'type':db[_0xcd5f('0x66')]['QueryTypes'][_0xcd5f('0x67')],'raw':!![]};var _0x1dcf4b=_0x2fe9e6['clone']()[_0xcd5f('0x36')](_0xcd5f('0x65'));if(_0x20e83c['order']){_0x20e83c[_0xcd5f('0x30')]['forEach'](function(_0x33b629){_0x2fe9e6[_0xcd5f('0x30')]('c.'+_0x33b629[0x0],_0x33b629[0x1]==='DESC'?![]:!![]);});}if(!_[_0xcd5f('0x57')](_0x542461)){_0x2fe9e6[_0xcd5f('0x68')](_0x340532);_0x1dcf4b['where'](_0xcd5f('0x69'),_0x542461);}BPromise[_0xcd5f('0x6a')]()[_0xcd5f('0x17')](function(){if(!_0x28b6a7)return;if(_0x4bda14[_0xcd5f('0x6b')][_0xcd5f('0x6c')]!==_0xcd5f('0x6d'))return;if(!_[_0xcd5f('0x6e')](_0x28b6a7[_0xcd5f('0x45')],[_0xcd5f('0x36'),_0xcd5f('0x4d')])){return _0x4bda14[_0xcd5f('0x6b')][_0xcd5f('0x6f')]({'attributes':['id'],'raw':!![]})[_0xcd5f('0x17')](function(_0x5623c2){if(_['isEmpty'](_0x5623c2)){_0x1dcf4b[_0xcd5f('0x32')](_0xcd5f('0x70'));_0x2fe9e6[_0xcd5f('0x32')]('c.ListId\x20IS\x20NULL');}else{_0x1dcf4b[_0xcd5f('0x32')](_0xcd5f('0x58'),_[_0xcd5f('0x49')](_0x5623c2,'id'));_0x2fe9e6[_0xcd5f('0x32')](_0xcd5f('0x58'),_[_0xcd5f('0x49')](_0x5623c2,'id'));}});}})[_0xcd5f('0x17')](function(){if(_0x4bda14['user'][_0xcd5f('0x6c')]===_0xcd5f('0x6d')&&!_0x28b6a7&&!_0x4bda14[_0xcd5f('0x2b')][_0xcd5f('0x71')])return[];return db[_0xcd5f('0x72')]['query'](_0x1dcf4b[_0xcd5f('0x73')](),_0x4e9437);})[_0xcd5f('0x17')](function(_0x1060f5){_0x47ef18[_0xcd5f('0x13')]=_0x1060f5[_0xcd5f('0x21')];if(_0x47ef18[_0xcd5f('0x13')]===0x0)return[];return db[_0xcd5f('0x72')]['query'](_0x412462[_0xcd5f('0x73')](),_0x4e9437)[_0xcd5f('0x17')](function(_0x2547f6){_0x4c0e65=_[_0xcd5f('0x74')](_0x2547f6,'id');_0x4e9437=_[_0xcd5f('0x75')](_0x4e9437,{'model':db[_0xcd5f('0x1e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4bda14[_0xcd5f('0x2b')]['fields']){_0x20e83c[_0xcd5f('0x2e')]['forEach'](function(_0x3b5572){_0x2fe9e6[_0xcd5f('0x36')]('c.'+_0x3b5572);});}else{_0x2fe9e6[_0xcd5f('0x36')](_0xcd5f('0x65'));_0x2fe9e6[_0xcd5f('0x36')]('c.firstName');_0x2fe9e6[_0xcd5f('0x36')](_0xcd5f('0x76'));_0x2fe9e6[_0xcd5f('0x36')](_0xcd5f('0x77'));_0x2fe9e6[_0xcd5f('0x36')](_0xcd5f('0x78'));_0x2fe9e6[_0xcd5f('0x36')]('c.fax');_0x2fe9e6[_0xcd5f('0x36')]('c.email');_0x2fe9e6['field'](_0xcd5f('0x79'));_0x2fe9e6[_0xcd5f('0x36')](_0xcd5f('0x7a'));_0x2fe9e6[_0xcd5f('0x36')](_0xcd5f('0x7b'));_0x2fe9e6['field'](_0xcd5f('0x7c'));_0x2fe9e6['field'](_0xcd5f('0x7d'),'TagIds');}if(_0x20e83c['limit'])_0x2fe9e6[_0xcd5f('0x11')](_0x20e83c['limit']);if(_0x20e83c[_0xcd5f('0x10')])_0x2fe9e6[_0xcd5f('0x10')](_0x20e83c['offset']);return db[_0xcd5f('0x72')]['query'](_0x2fe9e6[_0xcd5f('0x73')](),_0x4e9437);});})[_0xcd5f('0x17')](function(_0x28843b){_0x28843b[_0xcd5f('0x4a')](function(_0x3e08b3){if(_0x3e08b3[_0xcd5f('0x7e')]){_0x3e08b3[_0xcd5f('0x7f')]=[];_0x3e08b3[_0xcd5f('0x7e')][_0xcd5f('0x48')](',')[_0xcd5f('0x4a')](function(_0x52c799){_0x3e08b3['Tags'][_0xcd5f('0x23')](_0x4c0e65[_0x52c799]);});}delete _0x3e08b3[_0xcd5f('0x7e')];});_0x47ef18['rows']=_0x28843b;return _0x47ef18;})['then'](respondWithFilteredResult(_0x5ecb8d,_0x20e83c));})[_0xcd5f('0x80')](handleError(_0x5ecb8d,null));};exports['destroy']=function(_0x4a80de,_0x2789a4){return db['CmContact'][_0xcd5f('0x81')]({'where':{'id':_0x4a80de[_0xcd5f('0x82')]['id']}})[_0xcd5f('0x17')](handleEntityNotFound(_0x2789a4,null))[_0xcd5f('0x17')](removeEntity(_0x2789a4,null))['catch'](handleError(_0x2789a4,null));};exports[_0xcd5f('0x1f')]=function(_0x4cbc2a,_0x825980){return db[_0xcd5f('0x1e')][_0xcd5f('0x1f')]()[_0xcd5f('0x17')](function(_0x1888ab){delete _0x1888ab[_0xcd5f('0x83')];for(var _0x563edb=0x0;_0x563edb=_0x3f4cfb){_0x98f592=_0x3f4cfb;_0x143edc=0xc8;}else{_0x143edc=0xce;}_0xd6ac47['status'](_0x143edc);return _0xd6ac47[_0xe8bf('0x13')](_0xe8bf('0x14'),_0x276bb6+'-'+_0x98f592+'/'+_0x3f4cfb)['json'](_0xd46d6);}return null;};}function saveUpdates(_0x3f6ebc){return function(_0x527175){if(_0x527175){return _0x527175[_0xe8bf('0x15')](_0x3f6ebc)[_0xe8bf('0x16')](function(_0x25bd5b){return _0x25bd5b;});}return null;};}function removeEntity(_0x2501ee){return function(_0x268f02){if(_0x268f02){return _0x268f02[_0xe8bf('0x17')]()[_0xe8bf('0x16')](function(){_0x2501ee[_0xe8bf('0xd')](0xcc)[_0xe8bf('0x18')]();});}};}function handleEntityNotFound(_0x6a8f13){return function(_0x4bc6ee){if(!_0x4bc6ee){_0x6a8f13['sendStatus'](0x194);}return _0x4bc6ee;};}function handleError(_0x343253,_0x449ba1){_0x449ba1=_0x449ba1||0x1f4;return function(_0x1f1b20){logger[_0xe8bf('0x19')](_0x1f1b20['stack']);if(_0x1f1b20[_0xe8bf('0x1a')]){delete _0x1f1b20[_0xe8bf('0x1a')];}_0x343253[_0xe8bf('0xd')](_0x449ba1)[_0xe8bf('0x1b')](_0x1f1b20);};}exports[_0xe8bf('0x1c')]=function(_0x2ea881,_0xb85cb0){var _0x27201c={},_0x24f5ce={},_0x393e2c={'count':0x0,'rows':[]};return db[_0xe8bf('0x1d')][_0xe8bf('0x1e')]()[_0xe8bf('0x16')](function(_0x15e9d0){var _0x50e91c=[];for(var _0x48e47b=0x0;_0x48e47b0x1){_0x31ccf8['or'](_0xe8bf('0x5d'),qs['getFullTextValue'](_0x2166e1),null);}else{if(qs['isNumeric'](_0x2166e1)){_0x31ccf8['or'](_0xe8bf('0x5e'),_0x2166e1+'%');_0x31ccf8['or']('c.phone\x20LIKE\x20?',_0x2166e1+'%');_0x31ccf8['or'](_0xe8bf('0x5f'),_0x2166e1+'%');_0x31ccf8['or'](_0xe8bf('0x60'),_0x2166e1+'%');}else if(qs[_0xe8bf('0x61')](_0x2166e1)){_0x31ccf8['or']('c.email\x20LIKE\x20?',_0x2166e1+'%');}else{_0x31ccf8['or'](_0xe8bf('0x62'),'%'+_0x2166e1+'%');_0x31ccf8['or'](_0xe8bf('0x63'),'%'+_0x2166e1+'%');_0x31ccf8['or'](_0xe8bf('0x64'),'%'+_0x2166e1+'%');}}}}_0x18520e[_0xe8bf('0x34')](_0x31ccf8);_0x18520e[_0xe8bf('0x65')](_0xe8bf('0x66'));var _0xea6b9b={'type':db[_0xe8bf('0x67')][_0xe8bf('0x68')][_0xe8bf('0x69')],'raw':!![]};var _0x43fc16=_0x18520e[_0xe8bf('0x6a')]()['field']('c.id');if(_0x27201c[_0xe8bf('0x32')]){_0x27201c[_0xe8bf('0x32')][_0xe8bf('0x4a')](function(_0x1c5639){_0x18520e[_0xe8bf('0x32')]('c.'+_0x1c5639[0x0],_0x1c5639[0x1]===_0xe8bf('0x6b')?![]:!![]);});}if(!_['isEmpty'](_0x108da4)){_0x18520e['having'](_0x565e33);_0x43fc16['where']('t.id\x20IN\x20?',_0x108da4);}BPromise['resolve']()[_0xe8bf('0x16')](function(){if(!_0x4459e8)return;if(_0x2ea881[_0xe8bf('0x6c')][_0xe8bf('0x6d')]!=='agent')return;if(!_[_0xe8bf('0x6e')](_0x4459e8[_0xe8bf('0x44')],[_0xe8bf('0x36'),_0xe8bf('0x4d')])){return _0x2ea881['user'][_0xe8bf('0x6f')]({'attributes':['id'],'raw':!![]})[_0xe8bf('0x16')](function(_0x7401cc){if(_['isEmpty'](_0x7401cc)){_0x43fc16[_0xe8bf('0x34')]('c.ListId\x20IS\x20NULL');_0x18520e[_0xe8bf('0x34')](_0xe8bf('0x70'));}else{_0x43fc16['where']('c.ListId\x20IN\x20?',_[_0xe8bf('0x49')](_0x7401cc,'id'));_0x18520e[_0xe8bf('0x34')](_0xe8bf('0x59'),_[_0xe8bf('0x49')](_0x7401cc,'id'));}});}})['then'](function(){if(_0x2ea881[_0xe8bf('0x6c')]['role']===_0xe8bf('0x71')&&!_0x4459e8&&!_0x2ea881['query'][_0xe8bf('0x58')])return[];return db['sequelize'][_0xe8bf('0x2b')](_0x43fc16[_0xe8bf('0x72')](),_0xea6b9b);})[_0xe8bf('0x16')](function(_0x3a4415){_0x393e2c[_0xe8bf('0x12')]=_0x3a4415[_0xe8bf('0x1f')];if(_0x393e2c['count']===0x0)return[];return db[_0xe8bf('0x73')]['query'](_0x18c549[_0xe8bf('0x72')](),_0xea6b9b)[_0xe8bf('0x16')](function(_0x3b4591){_0x5935f5=_[_0xe8bf('0x74')](_0x3b4591,'id');_0xea6b9b=_[_0xe8bf('0x75')](_0xea6b9b,{'model':db[_0xe8bf('0x1d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2ea881[_0xe8bf('0x2b')][_0xe8bf('0x2f')]){_0x27201c[_0xe8bf('0x2e')][_0xe8bf('0x4a')](function(_0x1bd4f8){_0x18520e['field']('c.'+_0x1bd4f8);});}else{_0x18520e[_0xe8bf('0x36')]('c.id');_0x18520e[_0xe8bf('0x36')](_0xe8bf('0x76'));_0x18520e[_0xe8bf('0x36')](_0xe8bf('0x77'));_0x18520e[_0xe8bf('0x36')]('c.phone');_0x18520e['field']('c.mobile');_0x18520e[_0xe8bf('0x36')](_0xe8bf('0x78'));_0x18520e['field']('c.email');_0x18520e[_0xe8bf('0x36')](_0xe8bf('0x79'));_0x18520e['field'](_0xe8bf('0x7a'));_0x18520e[_0xe8bf('0x36')](_0xe8bf('0x7b'));_0x18520e['field'](_0xe8bf('0x7c'));_0x18520e[_0xe8bf('0x36')](_0xe8bf('0x7d'),'TagIds');}if(_0x27201c[_0xe8bf('0x10')])_0x18520e['limit'](_0x27201c['limit']);if(_0x27201c['offset'])_0x18520e[_0xe8bf('0xf')](_0x27201c[_0xe8bf('0xf')]);return db[_0xe8bf('0x73')]['query'](_0x18520e['toString'](),_0xea6b9b);});})['then'](function(_0x2e99b1){_0x2e99b1['forEach'](function(_0x474d9e){if(_0x474d9e['TagIds']){_0x474d9e[_0xe8bf('0x7e')]=[];_0x474d9e[_0xe8bf('0x7f')][_0xe8bf('0x48')](',')['forEach'](function(_0x534a3d){_0x474d9e[_0xe8bf('0x7e')][_0xe8bf('0x23')](_0x5935f5[_0x534a3d]);});}delete _0x474d9e[_0xe8bf('0x7f')];});_0x393e2c[_0xe8bf('0x80')]=_0x2e99b1;return _0x393e2c;})[_0xe8bf('0x16')](respondWithFilteredResult(_0xb85cb0,_0x27201c));})[_0xe8bf('0x81')](handleError(_0xb85cb0,null));};exports[_0xe8bf('0x17')]=function(_0x350c88,_0x4a853d){return db[_0xe8bf('0x1d')]['find']({'where':{'id':_0x350c88[_0xe8bf('0x82')]['id']}})[_0xe8bf('0x16')](handleEntityNotFound(_0x4a853d,null))[_0xe8bf('0x16')](removeEntity(_0x4a853d,null))[_0xe8bf('0x81')](handleError(_0x4a853d,null));};exports[_0xe8bf('0x1e')]=function(_0x48b942,_0x3d75ab){return db['CmContact'][_0xe8bf('0x1e')]()[_0xe8bf('0x16')](function(_0xb537a){delete _0xb537a['tags'];for(var _0x1ccc34=0x0;_0x1ccc34{}\s\\|]/g,'-');_0x47aafa(null,util[_0x4e7a('0x23')]('%s-%s%s',path['basename'](_0x4caa4b[_0x4e7a('0x21')],path[_0x4e7a('0x24')](_0x4caa4b[_0x4e7a('0x21')])),Date[_0x4e7a('0x25')](),path['extname'](_0x4caa4b['originalname'])));}})});router[_0x4e7a('0x1c')](_0x4e7a('0x26'),upload[_0x4e7a('0x27')]('file'),controller[_0x4e7a('0x28')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53f650,_0x38dafc,_0x2d277b){_0x2d277b(null,path[_0x4e7a('0x1f')](config[_0x4e7a('0x20')],_0x4e7a('0x29')));},'filename':function(_0x359ace,_0x2d746e,_0x25f822){_0x2d746e['originalname']=_0x2d746e[_0x4e7a('0x21')][_0x4e7a('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x25f822(null,util[_0x4e7a('0x23')](_0x4e7a('0x2a'),path[_0x4e7a('0x2b')](_0x2d746e['originalname'],path[_0x4e7a('0x24')](_0x2d746e[_0x4e7a('0x21')])),Date[_0x4e7a('0x25')](),path[_0x4e7a('0x24')](_0x2d746e[_0x4e7a('0x21')])));}})});router['post'](_0x4e7a('0x2c'),upload[_0x4e7a('0x27')]('file'),controller[_0x4e7a('0x2d')]);router['post'](_0x4e7a('0x2e'),auth[_0x4e7a('0xa')](),controller[_0x4e7a('0x2f')]);router['put'](_0x4e7a('0xe'),auth[_0x4e7a('0xa')](),controller['update']);router['delete'](_0x4e7a('0xe'),auth['isAuthenticated'](),controller[_0x4e7a('0x30')]);module[_0x4e7a('0x31')]=router; \ No newline at end of file +var _0x9a6d=['getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','/:id/journey','getJourney','post','/merge','create','/create_many','bulkCreate','/:id/tags','setTags','diskStorage','root','server/files/tmp','originalname','%s-%s%s','extname','now','single','file','uploadCsv','join','replace','format','basename','upload','import','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmContact.controller','get','isAuthenticated','describe','/:id','/:id/hoppers','/:id/hopper_histories'];(function(_0x199c03,_0x3254aa){var _0x11a7d4=function(_0x49e1da){while(--_0x49e1da){_0x199c03['push'](_0x199c03['shift']());}};_0x11a7d4(++_0x3254aa);}(_0x9a6d,0x171));var _0xd9a6=function(_0x386599,_0xe927e3){_0x386599=_0x386599-0x0;var _0x23d737=_0x9a6d[_0x386599];return _0x23d737;};'use strict';var multer=require(_0xd9a6('0x0'));var util=require(_0xd9a6('0x1'));var path=require(_0xd9a6('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9a6('0x3'));var router=express[_0xd9a6('0x4')]();var fs_extra=require(_0xd9a6('0x5'));var auth=require(_0xd9a6('0x6'));var interaction=require(_0xd9a6('0x7'));var config=require('../../config/environment');var controller=require(_0xd9a6('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd9a6('0x9')]('/describe',auth[_0xd9a6('0xa')](),controller[_0xd9a6('0xb')]);router[_0xd9a6('0x9')](_0xd9a6('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xd9a6('0x9')]('/:id/tags',auth[_0xd9a6('0xa')](),controller['getTags']);router[_0xd9a6('0x9')](_0xd9a6('0xd'),auth['isAuthenticated'](),controller['getHoppers']);router[_0xd9a6('0x9')](_0xd9a6('0xe'),auth[_0xd9a6('0xa')](),controller[_0xd9a6('0xf')]);router['get'](_0xd9a6('0x10'),auth[_0xd9a6('0xa')](),controller[_0xd9a6('0x11')]);router[_0xd9a6('0x9')](_0xd9a6('0x12'),auth[_0xd9a6('0xa')](),controller['getJscriptySessions']);router[_0xd9a6('0x9')](_0xd9a6('0x13'),auth['isAuthenticated'](),controller[_0xd9a6('0x14')]);router[_0xd9a6('0x15')](_0xd9a6('0x16'),auth[_0xd9a6('0xa')](),controller['merge']);router[_0xd9a6('0x15')]('/',auth[_0xd9a6('0xa')](),controller[_0xd9a6('0x17')]);router[_0xd9a6('0x15')](_0xd9a6('0x18'),auth['isAuthenticated'](),controller[_0xd9a6('0x19')]);router['post'](_0xd9a6('0x1a'),auth['isAuthenticated'](),controller[_0xd9a6('0x1b')]);var upload=multer({'storage':multer[_0xd9a6('0x1c')]({'destination':function(_0x1cdd47,_0x2c22bd,_0x1923a7){_0x1923a7(null,path['join'](config[_0xd9a6('0x1d')],_0xd9a6('0x1e')));},'filename':function(_0x52b51c,_0x57694b,_0x57b846){_0x57694b[_0xd9a6('0x1f')]=_0x57694b[_0xd9a6('0x1f')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x57b846(null,util['format'](_0xd9a6('0x20'),path['basename'](_0x57694b[_0xd9a6('0x1f')],path[_0xd9a6('0x21')](_0x57694b[_0xd9a6('0x1f')])),Date[_0xd9a6('0x22')](),path[_0xd9a6('0x21')](_0x57694b['originalname'])));}})});router[_0xd9a6('0x15')]('/csv',upload[_0xd9a6('0x23')](_0xd9a6('0x24')),controller[_0xd9a6('0x25')]);var upload=multer({'storage':multer[_0xd9a6('0x1c')]({'destination':function(_0x2d54b0,_0x27d448,_0x343e51){_0x343e51(null,path[_0xd9a6('0x26')](config['root'],'server/files/tmp'));},'filename':function(_0x25a71e,_0x1992b5,_0x3535c8){_0x1992b5[_0xd9a6('0x1f')]=_0x1992b5['originalname'][_0xd9a6('0x27')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3535c8(null,util[_0xd9a6('0x28')]('%s-%s%s',path[_0xd9a6('0x29')](_0x1992b5[_0xd9a6('0x1f')],path[_0xd9a6('0x21')](_0x1992b5[_0xd9a6('0x1f')])),Date[_0xd9a6('0x22')](),path[_0xd9a6('0x21')](_0x1992b5[_0xd9a6('0x1f')])));}})});router['post']('/upload',upload[_0xd9a6('0x23')](_0xd9a6('0x24')),controller[_0xd9a6('0x2a')]);router[_0xd9a6('0x15')]('/upload/:id',auth['isAuthenticated'](),controller[_0xd9a6('0x2b')]);router[_0xd9a6('0x2c')](_0xd9a6('0xc'),auth[_0xd9a6('0xa')](),controller[_0xd9a6('0x2d')]);router[_0xd9a6('0x2e')](_0xd9a6('0xc'),auth[_0xd9a6('0xa')](),controller[_0xd9a6('0x2f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 203cfb9..21d84e6 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 _0x9aa9=['getDataValue','name','TEXT','long','type','select','parse','values','isArray','BOOLEAN','voice','lodash','exports','VIRTUAL','alias','STRING','setDataValue'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x9aa9,0xc6));var _0x99aa=function(_0xcf10b8,_0x1c32da){_0xcf10b8=_0xcf10b8-0x0;var _0x12eeb9=_0x9aa9[_0xcf10b8];return _0x12eeb9;};'use strict';var Sequelize=require('sequelize');var _=require(_0x99aa('0x0'));module[_0x99aa('0x1')]={'name':{'type':Sequelize[_0x99aa('0x2')],'get':function(_0x2f4141){return this['getDataValue'](_0x99aa('0x3'));}},'alias':{'type':Sequelize[_0x99aa('0x4')],'allowNull':![],'set':function(_0x105877){this[_0x99aa('0x5')]('alias',_0x105877?_0x105877:this[_0x99aa('0x6')](_0x99aa('0x7')));}},'type':{'type':Sequelize[_0x99aa('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x99aa('0x8')](_0x99aa('0x9')),'get':function(){if(this['getDataValue'](_0x99aa('0xa'))===_0x99aa('0xb')){return JSON[_0x99aa('0xc')](this[_0x99aa('0x6')](_0x99aa('0xd')));}else{return this[_0x99aa('0x6')](_0x99aa('0xd'));}},'set':function(_0x391350){if(Array[_0x99aa('0xe')](_0x391350)){this[_0x99aa('0x5')]('values',JSON['stringify'](_0x391350));}else{this[_0x99aa('0x5')]('values',_0x391350);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x99aa('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x99aa('0x10'))}}; \ No newline at end of file +var _0x2fc2=['getDataValue','name','long','type','select','parse','values','isArray','stringify','BOOLEAN','voice','sequelize','exports','VIRTUAL','alias','STRING','setDataValue'];(function(_0x34df4a,_0x209d10){var _0x145c69=function(_0xb9bcbd){while(--_0xb9bcbd){_0x34df4a['push'](_0x34df4a['shift']());}};_0x145c69(++_0x209d10);}(_0x2fc2,0x1a3));var _0x22fc=function(_0x2c7402,_0x58125e){_0x2c7402=_0x2c7402-0x0;var _0x266ce2=_0x2fc2[_0x2c7402];return _0x266ce2;};'use strict';var Sequelize=require(_0x22fc('0x0'));var _=require('lodash');module[_0x22fc('0x1')]={'name':{'type':Sequelize[_0x22fc('0x2')],'get':function(_0x3bd3d1){return this['getDataValue'](_0x22fc('0x3'));}},'alias':{'type':Sequelize[_0x22fc('0x4')],'allowNull':![],'set':function(_0x3a267c){this[_0x22fc('0x5')](_0x22fc('0x3'),_0x3a267c?_0x3a267c:this[_0x22fc('0x6')](_0x22fc('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x22fc('0x8')),'get':function(){if(this[_0x22fc('0x6')](_0x22fc('0x9'))===_0x22fc('0xa')){return JSON[_0x22fc('0xb')](this['getDataValue']('values'));}else{return this[_0x22fc('0x6')](_0x22fc('0xc'));}},'set':function(_0x2fca22){if(Array[_0x22fc('0xd')](_0x2fca22)){this[_0x22fc('0x5')](_0x22fc('0xc'),JSON[_0x22fc('0xe')](_0x2fca22));}else{this[_0x22fc('0x5')]('values',_0x2fca22);}}},'required':{'type':Sequelize[_0x22fc('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x22fc('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x22fc('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 05c26a1..563c819 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 _0x6e8b=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','Content-Range','json','apply','save','update','then','destroy','end','error','stack','name','send','index','CmCustomField','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','keys','find','body','create','sequelize','transaction','TEXT','text','number','Sequelize','INTEGER','switch','BOOLEAN','cm_contacts','format','cf_%d','eml-format','zip-dir','fast-json-patch','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'];(function(_0x96acad,_0x38400e){var _0xe3d13e=function(_0x4108f0){while(--_0x4108f0){_0x96acad['push'](_0x96acad['shift']());}};_0xe3d13e(++_0x38400e);}(_0x6e8b,0x156));var _0xb6e8=function(_0x4b9b78,_0x1dc74a){_0x4b9b78=_0x4b9b78-0x0;var _0x330388=_0x6e8b[_0x4b9b78];return _0x330388;};'use strict';var emlformat=require(_0xb6e8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb6e8('0x1'));var jsonpatch=require(_0xb6e8('0x2'));var rp=require('request-promise');var moment=require(_0xb6e8('0x3'));var BPromise=require(_0xb6e8('0x4'));var Mustache=require(_0xb6e8('0x5'));var util=require(_0xb6e8('0x6'));var path=require(_0xb6e8('0x7'));var sox=require(_0xb6e8('0x8'));var csv=require(_0xb6e8('0x9'));var ejs=require(_0xb6e8('0xa'));var fs=require('fs');var fs_extra=require(_0xb6e8('0xb'));var _=require(_0xb6e8('0xc'));var squel=require(_0xb6e8('0xd'));var crypto=require(_0xb6e8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb6e8('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb6e8('0x10'));var Papa=require(_0xb6e8('0x11'));var Redis=require(_0xb6e8('0x12'));var authService=require(_0xb6e8('0x13'));var qs=require(_0xb6e8('0x14'));var as=require(_0xb6e8('0x15'));var hardwareService=require(_0xb6e8('0x16'));var logger=require(_0xb6e8('0x17'))(_0xb6e8('0x18'));var utils=require('../../config/utils');var config=require(_0xb6e8('0x19'));var licenseUtil=require(_0xb6e8('0x1a'));var db=require(_0xb6e8('0x1b'))['db'];function respondWithStatusCode(_0x4d694d,_0x437da8){_0x437da8=_0x437da8||0xcc;return function(_0xcd21be){if(_0xcd21be){return _0x4d694d[_0xb6e8('0x1c')](_0x437da8);}return _0x4d694d[_0xb6e8('0x1d')](_0x437da8)['end']();};}function respondWithResult(_0x4a7c90,_0x29b68d){_0x29b68d=_0x29b68d||0xc8;return function(_0x104f31){if(_0x104f31){return _0x4a7c90[_0xb6e8('0x1d')](_0x29b68d)['json'](_0x104f31);}};}function respondWithFilteredResult(_0x1da1df,_0x187a01){return function(_0x767b3){if(_0x767b3){var _0x5da63c=typeof _0x187a01[_0xb6e8('0x1e')]===_0xb6e8('0x1f')&&typeof _0x187a01['limit']===_0xb6e8('0x1f');var _0x3be6d7=_0x767b3['count'];var _0x2840e5=_0x5da63c?0x0:_0x187a01['offset'];var _0x2a9178=_0x5da63c?_0x767b3['count']:_0x187a01['offset']+_0x187a01[_0xb6e8('0x20')];var _0x281fe2;if(_0x2a9178>=_0x3be6d7){_0x2a9178=_0x3be6d7;_0x281fe2=0xc8;}else{_0x281fe2=0xce;}_0x1da1df[_0xb6e8('0x1d')](_0x281fe2);return _0x1da1df['set'](_0xb6e8('0x21'),_0x2840e5+'-'+_0x2a9178+'/'+_0x3be6d7)[_0xb6e8('0x22')](_0x767b3);}return null;};}function patchUpdates(_0x234345){return function(_0x403daf){try{jsonpatch[_0xb6e8('0x23')](_0x403daf,_0x234345,!![]);}catch(_0x3562ee){return BPromise['reject'](_0x3562ee);}return _0x403daf[_0xb6e8('0x24')]();};}function saveUpdates(_0xd41b65,_0x21e56c){return function(_0x436cb2){if(_0x436cb2){return _0x436cb2[_0xb6e8('0x25')](_0xd41b65)[_0xb6e8('0x26')](function(_0x4679da){return _0x4679da;});}return null;};}function removeEntity(_0x352550,_0x2bf98e){return function(_0x4cc93c){if(_0x4cc93c){return _0x4cc93c[_0xb6e8('0x27')]()[_0xb6e8('0x26')](function(){_0x352550[_0xb6e8('0x1d')](0xcc)[_0xb6e8('0x28')]();});}};}function handleEntityNotFound(_0x1ef13e,_0x2ab339){return function(_0x2d660f){if(!_0x2d660f){_0x1ef13e[_0xb6e8('0x1c')](0x194);}return _0x2d660f;};}function handleError(_0x521e0d,_0x2595d1){_0x2595d1=_0x2595d1||0x1f4;return function(_0x5c7faf){logger[_0xb6e8('0x29')](_0x5c7faf[_0xb6e8('0x2a')]);if(_0x5c7faf[_0xb6e8('0x2b')]){delete _0x5c7faf['name'];}_0x521e0d[_0xb6e8('0x1d')](_0x2595d1)[_0xb6e8('0x2c')](_0x5c7faf);};}exports[_0xb6e8('0x2d')]=function(_0x4f6962,_0x4c5a8d){var _0x2034eb={},_0x28637e={},_0x2b6ba1={'count':0x0,'rows':[]};var _0x2f9bfe=_['map'](db[_0xb6e8('0x2e')][_0xb6e8('0x2f')],function(_0x312e18){return{'name':_0x312e18[_0xb6e8('0x30')],'type':_0x312e18[_0xb6e8('0x31')][_0xb6e8('0x32')]};});_0x28637e[_0xb6e8('0x33')]=_['differenceBy'](_[_0xb6e8('0x34')](_0x2f9bfe,_0xb6e8('0x2b')),[_0xb6e8('0x2b')]);_0x28637e['query']=_['keys'](_0x4f6962[_0xb6e8('0x35')]);_0x28637e[_0xb6e8('0x36')]=_['intersection'](_0x28637e[_0xb6e8('0x33')],_0x28637e['query']);_0x2034eb[_0xb6e8('0x37')]=_[_0xb6e8('0x38')](_0x28637e['model'],qs[_0xb6e8('0x39')](_0x4f6962[_0xb6e8('0x35')]['fields']));_0x2034eb[_0xb6e8('0x37')]=_0x2034eb[_0xb6e8('0x37')][_0xb6e8('0x3a')]?_0x2034eb[_0xb6e8('0x37')]:_0x28637e['model'];if(!_0x4f6962[_0xb6e8('0x35')][_0xb6e8('0x3b')]('nolimit')){_0x2034eb['limit']=qs[_0xb6e8('0x20')](_0x4f6962['query'][_0xb6e8('0x20')]);_0x2034eb[_0xb6e8('0x1e')]=qs[_0xb6e8('0x1e')](_0x4f6962[_0xb6e8('0x35')][_0xb6e8('0x1e')]);}_0x2034eb[_0xb6e8('0x3c')]=qs[_0xb6e8('0x3d')](_0x4f6962[_0xb6e8('0x35')][_0xb6e8('0x3d')]);_0x2034eb[_0xb6e8('0x3e')]=qs[_0xb6e8('0x36')](_[_0xb6e8('0x3f')](_0x4f6962['query'],_0x28637e[_0xb6e8('0x36')]),_0x2f9bfe);if(_0x4f6962[_0xb6e8('0x35')][_0xb6e8('0x40')]){_0x2034eb[_0xb6e8('0x3e')]=_[_0xb6e8('0x41')](_0x2034eb[_0xb6e8('0x3e')],{'$or':_[_0xb6e8('0x34')](_0x2f9bfe,function(_0x5b646d){if(_0x5b646d[_0xb6e8('0x31')]!==_0xb6e8('0x42')){var _0x2ce05f={};_0x2ce05f[_0x5b646d[_0xb6e8('0x2b')]]={'$like':'%'+_0x4f6962[_0xb6e8('0x35')][_0xb6e8('0x40')]+'%'};return _0x2ce05f;}})});}_0x2034eb=_[_0xb6e8('0x41')]({},_0x2034eb,_0x4f6962[_0xb6e8('0x43')]);var _0x46c41f={'where':_0x2034eb['where']};return db[_0xb6e8('0x2e')][_0xb6e8('0x44')](_0x46c41f)['then'](function(_0x1ccbe8){_0x2b6ba1['count']=_0x1ccbe8;if(_0x4f6962[_0xb6e8('0x35')][_0xb6e8('0x45')]){_0x2034eb[_0xb6e8('0x46')]=[{'all':!![]}];}return db[_0xb6e8('0x2e')][_0xb6e8('0x47')](_0x2034eb);})[_0xb6e8('0x26')](function(_0x6b2086){_0x2b6ba1[_0xb6e8('0x48')]=_0x6b2086;return _0x2b6ba1;})['then'](respondWithFilteredResult(_0x4c5a8d,_0x2034eb))[_0xb6e8('0x49')](handleError(_0x4c5a8d,null));};exports['show']=function(_0x27e5fc,_0x2e54e0){var _0x476dd9={'raw':!![],'where':{'id':_0x27e5fc[_0xb6e8('0x4a')]['id']}},_0x3c22fa={};_0x3c22fa[_0xb6e8('0x33')]=_[_0xb6e8('0x4b')](db[_0xb6e8('0x2e')][_0xb6e8('0x2f')]);_0x3c22fa[_0xb6e8('0x35')]=_[_0xb6e8('0x4b')](_0x27e5fc[_0xb6e8('0x35')]);_0x3c22fa[_0xb6e8('0x36')]=_[_0xb6e8('0x38')](_0x3c22fa[_0xb6e8('0x33')],_0x3c22fa[_0xb6e8('0x35')]);_0x476dd9[_0xb6e8('0x37')]=_[_0xb6e8('0x38')](_0x3c22fa[_0xb6e8('0x33')],qs[_0xb6e8('0x39')](_0x27e5fc[_0xb6e8('0x35')][_0xb6e8('0x39')]));_0x476dd9[_0xb6e8('0x37')]=_0x476dd9[_0xb6e8('0x37')][_0xb6e8('0x3a')]?_0x476dd9[_0xb6e8('0x37')]:_0x3c22fa[_0xb6e8('0x33')];if(_0x27e5fc[_0xb6e8('0x35')][_0xb6e8('0x45')]){_0x476dd9[_0xb6e8('0x46')]=[{'all':!![]}];}_0x476dd9=_[_0xb6e8('0x41')]({},_0x476dd9,_0x27e5fc['options']);return db[_0xb6e8('0x2e')][_0xb6e8('0x4c')](_0x476dd9)['then'](handleEntityNotFound(_0x2e54e0,null))['then'](respondWithResult(_0x2e54e0,null))[_0xb6e8('0x49')](handleError(_0x2e54e0,null));};exports[_0xb6e8('0x25')]=function(_0x2e98cc,_0x5dd079){if(_0x2e98cc[_0xb6e8('0x4d')]['id']){delete _0x2e98cc[_0xb6e8('0x4d')]['id'];}return db[_0xb6e8('0x2e')][_0xb6e8('0x4c')]({'where':{'id':_0x2e98cc['params']['id']}})['then'](handleEntityNotFound(_0x5dd079,null))[_0xb6e8('0x26')](saveUpdates(_0x2e98cc[_0xb6e8('0x4d')],null))[_0xb6e8('0x26')](respondWithResult(_0x5dd079,null))[_0xb6e8('0x49')](handleError(_0x5dd079,null));};exports[_0xb6e8('0x27')]=function(_0x8c792f,_0x2374f9){return db['CmCustomField'][_0xb6e8('0x4c')]({'where':{'id':_0x8c792f[_0xb6e8('0x4a')]['id']}})[_0xb6e8('0x26')](handleEntityNotFound(_0x2374f9,null))['then'](removeEntity(_0x2374f9,null))[_0xb6e8('0x49')](handleError(_0x2374f9,null));};exports[_0xb6e8('0x4e')]=function(_0x252f56,_0x6f60f9){var _0x15ddc3;return db[_0xb6e8('0x4f')][_0xb6e8('0x50')](function(_0x428566){return db[_0xb6e8('0x2e')][_0xb6e8('0x4e')](_0x252f56['body'],{'transaction':_0x428566})[_0xb6e8('0x26')](function(_0x295371){_0x15ddc3=_0x295371;var _0x783fc3={'type':db['Sequelize'][_0xb6e8('0x51')],'transaction':_0x428566};switch(_0x252f56['body'][_0xb6e8('0x31')]){case _0xb6e8('0x52'):_0x783fc3['type']=db['Sequelize'][_0xb6e8('0x51')];break;case _0xb6e8('0x53'):_0x783fc3[_0xb6e8('0x31')]=db[_0xb6e8('0x54')][_0xb6e8('0x55')];break;case _0xb6e8('0x56'):_0x783fc3['type']=db[_0xb6e8('0x54')][_0xb6e8('0x57')];_0x783fc3['defaultValue']=![];break;default:}return db['sequelize']['queryInterface']['addColumn'](_0xb6e8('0x58'),util[_0xb6e8('0x59')](_0xb6e8('0x5a'),_0x15ddc3['id']),_0x783fc3);})[_0xb6e8('0x26')](function(){return _0x15ddc3;});})[_0xb6e8('0x26')](respondWithResult(_0x6f60f9,0xc9))[_0xb6e8('0x49')](handleError(_0x6f60f9,null));}; \ No newline at end of file +var _0x47c1=['squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','CmCustomField','rawAttributes','type','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','options','find','catch','update','body','create','sequelize','transaction','Sequelize','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','cf_%d','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash'];(function(_0xb5cfdd,_0x135ff8){var _0x2cd042=function(_0x7926da){while(--_0x7926da){_0xb5cfdd['push'](_0xb5cfdd['shift']());}};_0x2cd042(++_0x135ff8);}(_0x47c1,0x142));var _0x147c=function(_0x484813,_0xfd47d2){_0x484813=_0x484813-0x0;var _0x12602b=_0x47c1[_0x484813];return _0x12602b;};'use strict';var emlformat=require(_0x147c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x147c('0x1'));var jsonpatch=require(_0x147c('0x2'));var rp=require('request-promise');var moment=require(_0x147c('0x3'));var BPromise=require(_0x147c('0x4'));var Mustache=require('mustache');var util=require(_0x147c('0x5'));var path=require('path');var sox=require(_0x147c('0x6'));var csv=require(_0x147c('0x7'));var ejs=require(_0x147c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x147c('0x9'));var squel=require(_0x147c('0xa'));var crypto=require(_0x147c('0xb'));var jsforce=require(_0x147c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x147c('0x7'));var querystring=require('querystring');var Papa=require(_0x147c('0xd'));var Redis=require(_0x147c('0xe'));var authService=require(_0x147c('0xf'));var qs=require(_0x147c('0x10'));var as=require(_0x147c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x147c('0x12'))(_0x147c('0x13'));var utils=require(_0x147c('0x14'));var config=require(_0x147c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x147c('0x16'))['db'];function respondWithStatusCode(_0x32140b,_0xc64aae){_0xc64aae=_0xc64aae||0xcc;return function(_0x39fcce){if(_0x39fcce){return _0x32140b[_0x147c('0x17')](_0xc64aae);}return _0x32140b[_0x147c('0x18')](_0xc64aae)[_0x147c('0x19')]();};}function respondWithResult(_0x1f1fbf,_0x44e5ac){_0x44e5ac=_0x44e5ac||0xc8;return function(_0x87bd5c){if(_0x87bd5c){return _0x1f1fbf['status'](_0x44e5ac)[_0x147c('0x1a')](_0x87bd5c);}};}function respondWithFilteredResult(_0x15c282,_0x32635e){return function(_0x14009e){if(_0x14009e){var _0x5eedac=typeof _0x32635e[_0x147c('0x1b')]===_0x147c('0x1c')&&typeof _0x32635e[_0x147c('0x1d')]===_0x147c('0x1c');var _0xd8d668=_0x14009e[_0x147c('0x1e')];var _0xb32eb8=_0x5eedac?0x0:_0x32635e[_0x147c('0x1b')];var _0x2868fc=_0x5eedac?_0x14009e[_0x147c('0x1e')]:_0x32635e['offset']+_0x32635e[_0x147c('0x1d')];var _0x3d92b1;if(_0x2868fc>=_0xd8d668){_0x2868fc=_0xd8d668;_0x3d92b1=0xc8;}else{_0x3d92b1=0xce;}_0x15c282['status'](_0x3d92b1);return _0x15c282[_0x147c('0x1f')](_0x147c('0x20'),_0xb32eb8+'-'+_0x2868fc+'/'+_0xd8d668)[_0x147c('0x1a')](_0x14009e);}return null;};}function patchUpdates(_0x1f8ed9){return function(_0x24c625){try{jsonpatch[_0x147c('0x21')](_0x24c625,_0x1f8ed9,!![]);}catch(_0x350be6){return BPromise[_0x147c('0x22')](_0x350be6);}return _0x24c625['save']();};}function saveUpdates(_0x1bde0a,_0x4a62d6){return function(_0x4aaf5d){if(_0x4aaf5d){return _0x4aaf5d['update'](_0x1bde0a)[_0x147c('0x23')](function(_0x1064c3){return _0x1064c3;});}return null;};}function removeEntity(_0x42a706,_0x7c8f0b){return function(_0x1016aa){if(_0x1016aa){return _0x1016aa[_0x147c('0x24')]()[_0x147c('0x23')](function(){_0x42a706[_0x147c('0x18')](0xcc)[_0x147c('0x19')]();});}};}function handleEntityNotFound(_0xadeafa,_0x141247){return function(_0x5d8915){if(!_0x5d8915){_0xadeafa[_0x147c('0x17')](0x194);}return _0x5d8915;};}function handleError(_0x4cd06e,_0x32258e){_0x32258e=_0x32258e||0x1f4;return function(_0x2e4733){logger[_0x147c('0x25')](_0x2e4733[_0x147c('0x26')]);if(_0x2e4733['name']){delete _0x2e4733[_0x147c('0x27')];}_0x4cd06e[_0x147c('0x18')](_0x32258e)[_0x147c('0x28')](_0x2e4733);};}exports['index']=function(_0x58917d,_0x47f020){var _0x2beeb4={},_0x95a4e7={},_0x5467d9={'count':0x0,'rows':[]};var _0x584f99=_['map'](db[_0x147c('0x29')][_0x147c('0x2a')],function(_0x4337f2){return{'name':_0x4337f2['fieldName'],'type':_0x4337f2[_0x147c('0x2b')]['key']};});_0x95a4e7[_0x147c('0x2c')]=_['differenceBy'](_['map'](_0x584f99,_0x147c('0x27')),[_0x147c('0x27')]);_0x95a4e7['query']=_[_0x147c('0x2d')](_0x58917d[_0x147c('0x2e')]);_0x95a4e7[_0x147c('0x2f')]=_[_0x147c('0x30')](_0x95a4e7['model'],_0x95a4e7[_0x147c('0x2e')]);_0x2beeb4['attributes']=_[_0x147c('0x30')](_0x95a4e7[_0x147c('0x2c')],qs[_0x147c('0x31')](_0x58917d[_0x147c('0x2e')]['fields']));_0x2beeb4[_0x147c('0x32')]=_0x2beeb4[_0x147c('0x32')][_0x147c('0x33')]?_0x2beeb4[_0x147c('0x32')]:_0x95a4e7['model'];if(!_0x58917d[_0x147c('0x2e')]['hasOwnProperty'](_0x147c('0x34'))){_0x2beeb4[_0x147c('0x1d')]=qs[_0x147c('0x1d')](_0x58917d[_0x147c('0x2e')][_0x147c('0x1d')]);_0x2beeb4[_0x147c('0x1b')]=qs['offset'](_0x58917d['query']['offset']);}_0x2beeb4[_0x147c('0x35')]=qs['sort'](_0x58917d[_0x147c('0x2e')][_0x147c('0x36')]);_0x2beeb4[_0x147c('0x37')]=qs[_0x147c('0x2f')](_[_0x147c('0x38')](_0x58917d[_0x147c('0x2e')],_0x95a4e7[_0x147c('0x2f')]),_0x584f99);if(_0x58917d[_0x147c('0x2e')][_0x147c('0x39')]){_0x2beeb4[_0x147c('0x37')]=_[_0x147c('0x3a')](_0x2beeb4[_0x147c('0x37')],{'$or':_['map'](_0x584f99,function(_0x116c46){if(_0x116c46[_0x147c('0x2b')]!==_0x147c('0x3b')){var _0x512ebf={};_0x512ebf[_0x116c46['name']]={'$like':'%'+_0x58917d[_0x147c('0x2e')][_0x147c('0x39')]+'%'};return _0x512ebf;}})});}_0x2beeb4=_[_0x147c('0x3a')]({},_0x2beeb4,_0x58917d['options']);var _0x120b1c={'where':_0x2beeb4[_0x147c('0x37')]};return db[_0x147c('0x29')][_0x147c('0x1e')](_0x120b1c)[_0x147c('0x23')](function(_0x3c2290){_0x5467d9[_0x147c('0x1e')]=_0x3c2290;if(_0x58917d[_0x147c('0x2e')][_0x147c('0x3c')]){_0x2beeb4['include']=[{'all':!![]}];}return db[_0x147c('0x29')][_0x147c('0x3d')](_0x2beeb4);})[_0x147c('0x23')](function(_0xbcbe6f){_0x5467d9[_0x147c('0x3e')]=_0xbcbe6f;return _0x5467d9;})[_0x147c('0x23')](respondWithFilteredResult(_0x47f020,_0x2beeb4))['catch'](handleError(_0x47f020,null));};exports[_0x147c('0x3f')]=function(_0x4fff2d,_0x13f1de){var _0x47e802={'raw':!![],'where':{'id':_0x4fff2d[_0x147c('0x40')]['id']}},_0x5d498f={};_0x5d498f[_0x147c('0x2c')]=_[_0x147c('0x2d')](db[_0x147c('0x29')][_0x147c('0x2a')]);_0x5d498f[_0x147c('0x2e')]=_['keys'](_0x4fff2d[_0x147c('0x2e')]);_0x5d498f[_0x147c('0x2f')]=_[_0x147c('0x30')](_0x5d498f[_0x147c('0x2c')],_0x5d498f[_0x147c('0x2e')]);_0x47e802[_0x147c('0x32')]=_[_0x147c('0x30')](_0x5d498f[_0x147c('0x2c')],qs[_0x147c('0x31')](_0x4fff2d['query'][_0x147c('0x31')]));_0x47e802['attributes']=_0x47e802[_0x147c('0x32')]['length']?_0x47e802[_0x147c('0x32')]:_0x5d498f[_0x147c('0x2c')];if(_0x4fff2d['query'][_0x147c('0x3c')]){_0x47e802['include']=[{'all':!![]}];}_0x47e802=_[_0x147c('0x3a')]({},_0x47e802,_0x4fff2d[_0x147c('0x41')]);return db[_0x147c('0x29')][_0x147c('0x42')](_0x47e802)[_0x147c('0x23')](handleEntityNotFound(_0x13f1de,null))['then'](respondWithResult(_0x13f1de,null))[_0x147c('0x43')](handleError(_0x13f1de,null));};exports[_0x147c('0x44')]=function(_0x25cbf8,_0x2f3e8d){if(_0x25cbf8[_0x147c('0x45')]['id']){delete _0x25cbf8['body']['id'];}return db[_0x147c('0x29')][_0x147c('0x42')]({'where':{'id':_0x25cbf8[_0x147c('0x40')]['id']}})['then'](handleEntityNotFound(_0x2f3e8d,null))[_0x147c('0x23')](saveUpdates(_0x25cbf8[_0x147c('0x45')],null))['then'](respondWithResult(_0x2f3e8d,null))['catch'](handleError(_0x2f3e8d,null));};exports['destroy']=function(_0x3de6ee,_0x3a864e){return db[_0x147c('0x29')][_0x147c('0x42')]({'where':{'id':_0x3de6ee['params']['id']}})[_0x147c('0x23')](handleEntityNotFound(_0x3a864e,null))[_0x147c('0x23')](removeEntity(_0x3a864e,null))[_0x147c('0x43')](handleError(_0x3a864e,null));};exports[_0x147c('0x46')]=function(_0x1d69a2,_0x153fbc){var _0x50b5a3;return db[_0x147c('0x47')][_0x147c('0x48')](function(_0x3996c3){return db[_0x147c('0x29')][_0x147c('0x46')](_0x1d69a2[_0x147c('0x45')],{'transaction':_0x3996c3})['then'](function(_0x57808e){_0x50b5a3=_0x57808e;var _0x1d47b2={'type':db[_0x147c('0x49')]['TEXT'],'transaction':_0x3996c3};switch(_0x1d69a2[_0x147c('0x45')][_0x147c('0x2b')]){case _0x147c('0x4a'):_0x1d47b2[_0x147c('0x2b')]=db[_0x147c('0x49')]['TEXT'];break;case _0x147c('0x4b'):_0x1d47b2[_0x147c('0x2b')]=db['Sequelize'][_0x147c('0x4c')];break;case _0x147c('0x4d'):_0x1d47b2[_0x147c('0x2b')]=db[_0x147c('0x49')][_0x147c('0x4e')];_0x1d47b2[_0x147c('0x4f')]=![];break;default:}return db[_0x147c('0x47')][_0x147c('0x50')]['addColumn'](_0x147c('0x51'),util['format'](_0x147c('0x52'),_0x50b5a3['id']),_0x1d47b2);})['then'](function(){return _0x50b5a3;});})[_0x147c('0x23')](respondWithResult(_0x153fbc,0xc9))[_0x147c('0x43')](handleError(_0x153fbc,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index a27c5db..5dc476d 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 _0x5586=['cm_custom_fields','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField'];(function(_0x55109f,_0x51215a){var _0x23a583=function(_0x4762c2){while(--_0x4762c2){_0x55109f['push'](_0x55109f['shift']());}};_0x23a583(++_0x51215a);}(_0x5586,0x121));var _0x6558=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x5586[_0x344a3f];return _0x264712;};'use strict';var _=require(_0x6558('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6558('0x1'));var moment=require('moment');var BPromise=require(_0x6558('0x2'));var rp=require(_0x6558('0x3'));var fs=require('fs');var path=require(_0x6558('0x4'));var rimraf=require(_0x6558('0x5'));var config=require(_0x6558('0x6'));var attributes=require(_0x6558('0x7'));module[_0x6558('0x8')]=function(_0x445a34,_0x116d42){return _0x445a34[_0x6558('0x9')](_0x6558('0xa'),attributes,{'tableName':_0x6558('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1bc0=['lodash','util','api','moment','request-promise','path','./cmCustomField.attributes','exports','CmCustomField','cm_custom_fields'];(function(_0x19cf13,_0x151fe2){var _0x4ad4b3=function(_0x4490fd){while(--_0x4490fd){_0x19cf13['push'](_0x19cf13['shift']());}};_0x4ad4b3(++_0x151fe2);}(_0x1bc0,0x140));var _0x01bc=function(_0x2fbe98,_0x3f7a8a){_0x2fbe98=_0x2fbe98-0x0;var _0x5106ef=_0x1bc0[_0x2fbe98];return _0x5106ef;};'use strict';var _=require(_0x01bc('0x0'));var util=require(_0x01bc('0x1'));var logger=require('../../config/logger')(_0x01bc('0x2'));var moment=require(_0x01bc('0x3'));var BPromise=require('bluebird');var rp=require(_0x01bc('0x4'));var fs=require('fs');var path=require(_0x01bc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x01bc('0x6'));module[_0x01bc('0x7')]=function(_0x551d0c,_0x37f7ec){return _0x551d0c['define'](_0x01bc('0x8'),attributes,{'tableName':_0x01bc('0x9'),'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 04f45a4..cff9b0d 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 _0xc0c0=['debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent'];(function(_0xd719d2,_0x88d330){var _0x2c1995=function(_0x169c0c){while(--_0x169c0c){_0xd719d2['push'](_0xd719d2['shift']());}};_0x2c1995(++_0x88d330);}(_0xc0c0,0x1d1));var _0x0c0c=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0xc0c0[_0xda464c];return _0x19e222;};'use strict';var _=require(_0x0c0c('0x0'));var util=require(_0x0c0c('0x1'));var moment=require(_0x0c0c('0x2'));var BPromise=require('bluebird');var rs=require(_0x0c0c('0x3'));var fs=require('fs');var Redis=require(_0x0c0c('0x4'));var db=require(_0x0c0c('0x5'))['db'];var utils=require(_0x0c0c('0x6'));var logger=require(_0x0c0c('0x7'))(_0x0c0c('0x8'));var config=require('../../config/environment');var jayson=require(_0x0c0c('0x9'));var client=jayson[_0x0c0c('0xa')][_0x0c0c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd790b6,_0x5bf35b,_0x32ea87){return new BPromise(function(_0xdf8663,_0x4e2914){return client[_0x0c0c('0xc')](_0xd790b6,_0x32ea87)['then'](function(_0x4e30f8){logger[_0x0c0c('0xd')]('CmCustomField,\x20%s,\x20%s',_0x5bf35b,_0x0c0c('0xe'));logger[_0x0c0c('0xf')](_0x0c0c('0x10'),_0x5bf35b,'request\x20sent',JSON[_0x0c0c('0x11')](_0x4e30f8));if(_0x4e30f8[_0x0c0c('0x12')]){if(_0x4e30f8[_0x0c0c('0x12')][_0x0c0c('0x13')]===0x1f4){logger['error'](_0x0c0c('0x14'),_0x5bf35b,_0x4e30f8['error'][_0x0c0c('0x15')]);return _0x4e2914(_0x4e30f8[_0x0c0c('0x12')][_0x0c0c('0x15')]);}logger[_0x0c0c('0x12')](_0x0c0c('0x14'),_0x5bf35b,_0x4e30f8[_0x0c0c('0x12')][_0x0c0c('0x15')]);return _0xdf8663(_0x4e30f8['error'][_0x0c0c('0x15')]);}else{logger[_0x0c0c('0xd')]('CmCustomField,\x20%s,\x20%s',_0x5bf35b,_0x0c0c('0xe'));_0xdf8663(_0x4e30f8[_0x0c0c('0x16')][_0x0c0c('0x15')]);}})[_0x0c0c('0x17')](function(_0x4acb86){logger[_0x0c0c('0x12')](_0x0c0c('0x14'),_0x5bf35b,_0x4acb86);_0x4e2914(_0x4acb86);});});} \ No newline at end of file +var _0x4aef=['message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','error','code'];(function(_0xdf3db6,_0x2a1952){var _0x4b7a65=function(_0x2953be){while(--_0x2953be){_0xdf3db6['push'](_0xdf3db6['shift']());}};_0x4b7a65(++_0x2a1952);}(_0x4aef,0x1e6));var _0xf4ae=function(_0x38e6e8,_0x541de0){_0x38e6e8=_0x38e6e8-0x0;var _0x3936d8=_0x4aef[_0x38e6e8];return _0x3936d8;};'use strict';var _=require('lodash');var util=require(_0xf4ae('0x0'));var moment=require(_0xf4ae('0x1'));var BPromise=require(_0xf4ae('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf4ae('0x3'));var db=require(_0xf4ae('0x4'))['db'];var utils=require(_0xf4ae('0x5'));var logger=require('../../config/logger')(_0xf4ae('0x6'));var config=require(_0xf4ae('0x7'));var jayson=require(_0xf4ae('0x8'));var client=jayson[_0xf4ae('0x9')][_0xf4ae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa4472e,_0x2ed846,_0x18cd25){return new BPromise(function(_0x1edaeb,_0x152442){return client[_0xf4ae('0xb')](_0xa4472e,_0x18cd25)['then'](function(_0xe257ad){logger[_0xf4ae('0xc')](_0xf4ae('0xd'),_0x2ed846,_0xf4ae('0xe'));logger['debug'](_0xf4ae('0xf'),_0x2ed846,_0xf4ae('0xe'),JSON['stringify'](_0xe257ad));if(_0xe257ad['error']){if(_0xe257ad[_0xf4ae('0x10')][_0xf4ae('0x11')]===0x1f4){logger[_0xf4ae('0x10')](_0xf4ae('0xd'),_0x2ed846,_0xe257ad['error'][_0xf4ae('0x12')]);return _0x152442(_0xe257ad[_0xf4ae('0x10')]['message']);}logger['error'](_0xf4ae('0xd'),_0x2ed846,_0xe257ad[_0xf4ae('0x10')]['message']);return _0x1edaeb(_0xe257ad[_0xf4ae('0x10')][_0xf4ae('0x12')]);}else{logger['info'](_0xf4ae('0xd'),_0x2ed846,_0xf4ae('0xe'));_0x1edaeb(_0xe257ad[_0xf4ae('0x13')]['message']);}})[_0xf4ae('0x14')](function(_0x5d924b){logger[_0xf4ae('0x10')](_0xf4ae('0xd'),_0x2ed846,_0x5d924b);_0x152442(_0x5d924b);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index bea7d4b..452bad9 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 _0x2ac4=['isAuthenticated','get','show','post','create','/:id','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmCustomField.controller'];(function(_0x5ebf85,_0x598413){var _0x5b175a=function(_0x3b213a){while(--_0x3b213a){_0x5ebf85['push'](_0x5ebf85['shift']());}};_0x5b175a(++_0x598413);}(_0x2ac4,0x68));var _0x42ac=function(_0x3dbd6d,_0x3ee9d7){_0x3dbd6d=_0x3dbd6d-0x0;var _0x1216f1=_0x2ac4[_0x3dbd6d];return _0x1216f1;};'use strict';var multer=require('multer');var util=require(_0x42ac('0x0'));var path=require('path');var timeout=require(_0x42ac('0x1'));var express=require(_0x42ac('0x2'));var router=express[_0x42ac('0x3')]();var fs_extra=require(_0x42ac('0x4'));var auth=require(_0x42ac('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x42ac('0x6'));var controller=require(_0x42ac('0x7'));router['get']('/',auth[_0x42ac('0x8')](),controller['index']);router[_0x42ac('0x9')]('/:id',auth[_0x42ac('0x8')](),controller[_0x42ac('0xa')]);router[_0x42ac('0xb')]('/',auth[_0x42ac('0x8')](),controller[_0x42ac('0xc')]);router['put'](_0x42ac('0xd'),auth[_0x42ac('0x8')](),controller['update']);router[_0x42ac('0xe')](_0x42ac('0xd'),auth[_0x42ac('0x8')](),controller['destroy']);module[_0x42ac('0xf')]=router; \ No newline at end of file +var _0xe384=['post','isAuthenticated','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','show'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe384,0x160));var _0x4e38=function(_0x3b4a81,_0x2400b7){_0x3b4a81=_0x3b4a81-0x0;var _0x13fd35=_0xe384[_0x3b4a81];return _0x13fd35;};'use strict';var multer=require(_0x4e38('0x0'));var util=require('util');var path=require(_0x4e38('0x1'));var timeout=require(_0x4e38('0x2'));var express=require(_0x4e38('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4e38('0x4'));var interaction=require(_0x4e38('0x5'));var config=require('../../config/environment');var controller=require('./cmCustomField.controller');router[_0x4e38('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4e38('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x4e38('0x7')]);router[_0x4e38('0x8')]('/',auth[_0x4e38('0x9')](),controller['create']);router['put'](_0x4e38('0xa'),auth['isAuthenticated'](),controller[_0x4e38('0xb')]);router[_0x4e38('0xc')](_0x4e38('0xa'),auth[_0x4e38('0x9')](),controller[_0x4e38('0xd')]);module[_0x4e38('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 84adf2e..aa309a1 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 _0x7e48=['exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e48,0x1c1));var _0x87e4=function(_0x157085,_0x2f63a6){_0x157085=_0x157085-0x0;var _0xbeb17c=_0x7e48[_0x157085];return _0xbeb17c;};'use strict';var moment=require(_0x87e4('0x0'));var Sequelize=require('sequelize');module[_0x87e4('0x1')]={'phone':{'type':Sequelize[_0x87e4('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x87e4('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x87e4('0x4')],'defaultValue':moment()[_0x87e4('0x5')](_0x87e4('0x6'))},'countbusyretry':{'type':Sequelize[_0x87e4('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x87e4('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x87e4('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x87e4('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x87e4('0x7')](0x2)[_0x87e4('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x87e4('0x7')],'unique':_0x87e4('0x9')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x87e4('0x9')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x87e4('0x9')},'CampaignId':{'type':Sequelize[_0x87e4('0x7')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x87e4('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x87e4('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x87e4('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x87e4('0x7')],'defaultValue':0x0},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x6b40=['INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x6b40,0x1c6));var _0x06b4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6b40[_0x2641f9];return _0x585741;};'use strict';var moment=require(_0x06b4('0x0'));var Sequelize=require(_0x06b4('0x1'));module[_0x06b4('0x2')]={'phone':{'type':Sequelize[_0x06b4('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x06b4('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x06b4('0x5')],'defaultValue':moment()[_0x06b4('0x6')](_0x06b4('0x7'))},'countbusyretry':{'type':Sequelize[_0x06b4('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x06b4('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x06b4('0x8')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x06b4('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x06b4('0x8')](0x2)[_0x06b4('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x06b4('0x8')],'unique':_0x06b4('0xa')},'ListId':{'type':Sequelize[_0x06b4('0x8')],'unique':_0x06b4('0xa')},'UserId':{'type':Sequelize[_0x06b4('0x8')]},'VoiceQueueId':{'type':Sequelize[_0x06b4('0x8')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x06b4('0x8')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x06b4('0x8')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x06b4('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'recallmeNotifiedDate':{'type':Sequelize[_0x06b4('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index f8b92e7..f0e4436 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 _0x86c1=['isEmpty','hopperIds','ASC','scheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','priority','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','Queue','dialActive','getPreviewRecall','getVoiceQueues','preview','dialPreviewAutoRecallMe','length','hopperId','recallme','List','getOpenContacts','outbound','format','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','destroy','error','stack','name','index','map','CmHopper','type','key','query','keys','filters','model','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$in','$notIn','$like','$notLike','$iLike','$overlap','$contained','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','include','rows','catch','show','rawAttributes','fields','find','then','body','params','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','dataValues','createdAt','updatedAt','state','deleted','membername','user','UserId','YYYY-MM-DD\x20HH:mm:ss','calleridnum','queue','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally','CmHopperFinal','create','getPreview','dialOrderByScheduledAt','sequelize','transaction','value','direction','prev'];(function(_0x18721e,_0x59606b){var _0x35929e=function(_0x79db04){while(--_0x79db04){_0x18721e['push'](_0x18721e['shift']());}};_0x35929e(++_0x59606b);}(_0x86c1,0x150));var _0x186c=function(_0x1ea756,_0x11b08f){_0x1ea756=_0x1ea756-0x0;var _0x4ea5b8=_0x86c1[_0x1ea756];return _0x4ea5b8;};'use strict';var emlformat=require(_0x186c('0x0'));var rimraf=require(_0x186c('0x1'));var zipdir=require(_0x186c('0x2'));var jsonpatch=require(_0x186c('0x3'));var rp=require('request-promise');var moment=require(_0x186c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x186c('0x5'));var path=require(_0x186c('0x6'));var sox=require(_0x186c('0x7'));var csv=require(_0x186c('0x8'));var ejs=require(_0x186c('0x9'));var fs=require('fs');var fs_extra=require(_0x186c('0xa'));var _=require(_0x186c('0xb'));var squel=require('squel');var crypto=require(_0x186c('0xc'));var jsforce=require(_0x186c('0xd'));var deskjs=require(_0x186c('0xe'));var toCsv=require(_0x186c('0x8'));var querystring=require('querystring');var Papa=require(_0x186c('0xf'));var Redis=require(_0x186c('0x10'));var authService=require(_0x186c('0x11'));var qs=require(_0x186c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x186c('0x13'));var logger=require(_0x186c('0x14'))(_0x186c('0x15'));var utils=require(_0x186c('0x16'));var config=require(_0x186c('0x17'));var licenseUtil=require(_0x186c('0x18'));var db=require(_0x186c('0x19'))['db'];function respondWithStatusCode(_0x28b892,_0x382ade){_0x382ade=_0x382ade||0xcc;return function(_0x29664f){if(_0x29664f){return _0x28b892[_0x186c('0x1a')](_0x382ade);}return _0x28b892[_0x186c('0x1b')](_0x382ade)['end']();};}function respondWithResult(_0x5de553,_0x4cd49b){_0x4cd49b=_0x4cd49b||0xc8;return function(_0x94f8d0){if(_0x94f8d0){return _0x5de553[_0x186c('0x1b')](_0x4cd49b)[_0x186c('0x1c')](_0x94f8d0);}};}function respondWithFilteredResult(_0x978e9b,_0x31ca11){return function(_0x1e9f99){if(_0x1e9f99){var _0x1ce02f=typeof _0x31ca11[_0x186c('0x1d')]===_0x186c('0x1e')&&typeof _0x31ca11[_0x186c('0x1f')]==='undefined';var _0x41ce54=_0x1e9f99[_0x186c('0x20')];var _0x1a15e5=_0x1ce02f?0x0:_0x31ca11[_0x186c('0x1d')];var _0x4a71cb=_0x1ce02f?_0x1e9f99[_0x186c('0x20')]:_0x31ca11[_0x186c('0x1d')]+_0x31ca11[_0x186c('0x1f')];var _0x3b8388;if(_0x4a71cb>=_0x41ce54){_0x4a71cb=_0x41ce54;_0x3b8388=0xc8;}else{_0x3b8388=0xce;}_0x978e9b[_0x186c('0x1b')](_0x3b8388);return _0x978e9b[_0x186c('0x21')]('Content-Range',_0x1a15e5+'-'+_0x4a71cb+'/'+_0x41ce54)[_0x186c('0x1c')](_0x1e9f99);}return null;};}function patchUpdates(_0x58c311){return function(_0x3abd86){try{jsonpatch[_0x186c('0x22')](_0x3abd86,_0x58c311,!![]);}catch(_0x3138a2){return BPromise['reject'](_0x3138a2);}return _0x3abd86[_0x186c('0x23')]();};}function saveUpdates(_0x4c6069,_0x5ec48e){return function(_0x5107ba){if(_0x5107ba){return _0x5107ba[_0x186c('0x24')](_0x4c6069)['then'](function(_0x6ab11c){return _0x6ab11c;});}return null;};}function removeEntity(_0x5ae042,_0x2b0359){return function(_0x2f2d03){if(_0x2f2d03){return _0x2f2d03[_0x186c('0x25')]()['then'](function(){_0x5ae042[_0x186c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xed37c0,_0x1aed92){return function(_0x3d46dd){if(!_0x3d46dd){_0xed37c0[_0x186c('0x1a')](0x194);}return _0x3d46dd;};}function handleError(_0x2ea74d,_0x17f613){_0x17f613=_0x17f613||0x1f4;return function(_0x53f8c7){logger[_0x186c('0x26')](_0x53f8c7[_0x186c('0x27')]);if(_0x53f8c7[_0x186c('0x28')]){delete _0x53f8c7[_0x186c('0x28')];}_0x2ea74d[_0x186c('0x1b')](_0x17f613)['send'](_0x53f8c7);};}exports[_0x186c('0x29')]=function(_0x20abd7,_0x2f508e){var _0xaeaa36={},_0x10eecc={},_0x1df27c={'count':0x0,'rows':[]};var _0x2fd7b0=_[_0x186c('0x2a')](db[_0x186c('0x2b')]['rawAttributes'],function(_0x4894c9){return{'name':_0x4894c9['fieldName'],'type':_0x4894c9[_0x186c('0x2c')][_0x186c('0x2d')]};});_0x10eecc['model']=_[_0x186c('0x2a')](_0x2fd7b0,_0x186c('0x28'));_0x10eecc[_0x186c('0x2e')]=_[_0x186c('0x2f')](_0x20abd7['query']);_0x10eecc[_0x186c('0x30')]=_['intersection'](_0x10eecc[_0x186c('0x31')],_0x10eecc[_0x186c('0x2e')]);_0x10eecc[_0x186c('0x30')]=_['concat'](_0x10eecc['filters'],[_0x186c('0x32'),_0x186c('0x33'),_0x186c('0x34'),_0x186c('0x35'),_0x186c('0x36'),_0x186c('0x37'),_0x186c('0x38'),_0x186c('0x39'),_0x186c('0x3a'),_0x186c('0x3b'),'$notBetween',_0x186c('0x3c'),_0x186c('0x3d'),_0x186c('0x3e'),_0x186c('0x3f'),_0x186c('0x40'),'$notILike',_0x186c('0x3e'),_0x186c('0x41'),'$contains',_0x186c('0x42'),'$any']);_0xaeaa36['attributes']=_[_0x186c('0x43')](_0x10eecc[_0x186c('0x31')],qs['fields'](_0x20abd7[_0x186c('0x2e')]['fields']));_0xaeaa36[_0x186c('0x44')]=_0xaeaa36[_0x186c('0x44')]['length']?_0xaeaa36[_0x186c('0x44')]:_0x10eecc[_0x186c('0x31')];if(!_0x20abd7['query'][_0x186c('0x45')](_0x186c('0x46'))){_0xaeaa36[_0x186c('0x1f')]=qs[_0x186c('0x1f')](_0x20abd7[_0x186c('0x2e')][_0x186c('0x1f')]);_0xaeaa36[_0x186c('0x1d')]=qs[_0x186c('0x1d')](_0x20abd7['query'][_0x186c('0x1d')]);}_0xaeaa36[_0x186c('0x47')]=qs[_0x186c('0x48')](_0x20abd7['query']['sort']);_0xaeaa36[_0x186c('0x49')]=qs[_0x186c('0x30')](_[_0x186c('0x4a')](_0x20abd7[_0x186c('0x2e')],_0x10eecc[_0x186c('0x30')]),_0x2fd7b0);if(_0x20abd7[_0x186c('0x2e')]['filter']){_0xaeaa36['where']=_[_0x186c('0x4b')](_0xaeaa36[_0x186c('0x49')],{'$or':_[_0x186c('0x2a')](_0x2fd7b0,function(_0x1d148b){if(_0x1d148b[_0x186c('0x2c')]!=='VIRTUAL'){var _0x4325c3={};_0x4325c3[_0x1d148b[_0x186c('0x28')]]={'$like':'%'+_0x20abd7[_0x186c('0x2e')]['filter']+'%'};return _0x4325c3;}})});}_0xaeaa36=_['merge']({},_0xaeaa36,_0x20abd7[_0x186c('0x4c')]);var _0x5df014={'where':_0xaeaa36[_0x186c('0x49')]};return db[_0x186c('0x2b')][_0x186c('0x20')](_0x5df014)['then'](function(_0x5456b7){_0x1df27c[_0x186c('0x20')]=_0x5456b7;if(_0x20abd7[_0x186c('0x2e')][_0x186c('0x4d')]){_0xaeaa36[_0x186c('0x4e')]=[{'all':!![]}];}return db[_0x186c('0x2b')]['findAll'](_0xaeaa36);})['then'](function(_0x72f698){_0x1df27c[_0x186c('0x4f')]=_0x72f698;return _0x1df27c;})['then'](respondWithFilteredResult(_0x2f508e,_0xaeaa36))[_0x186c('0x50')](handleError(_0x2f508e,null));};exports[_0x186c('0x51')]=function(_0xac39a2,_0x3cc2fc){var _0x45123e={'raw':!![],'where':{'id':_0xac39a2['params']['id']}},_0x25749b={};_0x25749b['model']=_[_0x186c('0x2f')](db[_0x186c('0x2b')][_0x186c('0x52')]);_0x25749b[_0x186c('0x2e')]=_[_0x186c('0x2f')](_0xac39a2['query']);_0x25749b['filters']=_[_0x186c('0x43')](_0x25749b[_0x186c('0x31')],_0x25749b[_0x186c('0x2e')]);_0x45123e['attributes']=_[_0x186c('0x43')](_0x25749b[_0x186c('0x31')],qs['fields'](_0xac39a2[_0x186c('0x2e')][_0x186c('0x53')]));_0x45123e[_0x186c('0x44')]=_0x45123e[_0x186c('0x44')]['length']?_0x45123e[_0x186c('0x44')]:_0x25749b['model'];if(_0xac39a2[_0x186c('0x2e')][_0x186c('0x4d')]){_0x45123e[_0x186c('0x4e')]=[{'all':!![]}];}_0x45123e=_[_0x186c('0x4b')]({},_0x45123e,_0xac39a2['options']);return db[_0x186c('0x2b')][_0x186c('0x54')](_0x45123e)[_0x186c('0x55')](handleEntityNotFound(_0x3cc2fc,null))[_0x186c('0x55')](respondWithResult(_0x3cc2fc,null))['catch'](handleError(_0x3cc2fc,null));};exports['create']=function(_0x1a5c4d,_0x35fda5){return db[_0x186c('0x2b')]['create'](_0x1a5c4d[_0x186c('0x56')],{})[_0x186c('0x55')](respondWithResult(_0x35fda5,0xc9))[_0x186c('0x50')](handleError(_0x35fda5,null));};exports['update']=function(_0x377a43,_0x4bb0da){if(_0x377a43[_0x186c('0x56')]['id']){delete _0x377a43[_0x186c('0x56')]['id'];}return db[_0x186c('0x2b')]['find']({'where':{'id':_0x377a43[_0x186c('0x57')]['id']}})['then'](handleEntityNotFound(_0x4bb0da,null))['then'](saveUpdates(_0x377a43[_0x186c('0x56')],null))[_0x186c('0x55')](respondWithResult(_0x4bb0da,null))['catch'](handleError(_0x4bb0da,null));};exports[_0x186c('0x58')]=function(_0x56d86f,_0xb01177){return db[_0x186c('0x2b')]['describe']()[_0x186c('0x55')](respondWithResult(_0xb01177,null))[_0x186c('0x50')](handleError(_0xb01177,null));};exports[_0x186c('0x25')]=function(_0x381d35,_0x438e48){var _0x18fc2d;return db[_0x186c('0x2b')]['find']({'where':{'id':_0x381d35[_0x186c('0x57')]['id']}})[_0x186c('0x55')](handleEntityNotFound(_0x438e48,null))[_0x186c('0x55')](function(_0x49abf3){if(_0x49abf3){return _0x49abf3['destroy']()[_0x186c('0x55')](function(_0x10ea74){return _0x10ea74;});}})[_0x186c('0x55')](function(_0x2ff2d7){_0x18fc2d=_0x2ff2d7;if(_0x2ff2d7){if(_0x2ff2d7[_0x186c('0x59')]||_0x2ff2d7[_0x186c('0x5a')]){return db[_0x2ff2d7[_0x186c('0x59')]?_0x186c('0x5b'):_0x186c('0x5c')]['find']({'where':{'id':_0x2ff2d7[_0x186c('0x59')]?_0x2ff2d7['VoiceQueueId']:_0x2ff2d7[_0x186c('0x5a')]},'attributes':['id',_0x186c('0x28')],'raw':!![]});}}})[_0x186c('0x55')](function(_0x2be91d){var _0x36b2aa={};if(_0x2be91d){_[_0x186c('0x4b')](_0x36b2aa,_['omit'](_0x18fc2d[_0x186c('0x5d')],[_0x186c('0x5e'),_0x186c('0x5f'),'id']));_0x36b2aa[_0x186c('0x60')]=0x15;_0x36b2aa['statedesc']=_0x186c('0x61');_0x36b2aa['campaign']=_0x2be91d[_0x186c('0x28')];_0x36b2aa[_0x186c('0x62')]=_0x381d35[_0x186c('0x63')][_0x186c('0x28')];_0x36b2aa[_0x186c('0x64')]=_0x381d35['user']['id'];_0x36b2aa[_0x186c('0x61')]=!![];_0x36b2aa['deletedat']=moment()['format'](_0x186c('0x65'));_0x36b2aa[_0x186c('0x66')]=_0x18fc2d['phone'];_0x36b2aa['campaigntype']=_0x18fc2d[_0x186c('0x59')]?_0x186c('0x67'):'ivr';return db[_0x186c('0x68')][_0x186c('0x54')]({'where':{'id':_0x36b2aa[_0x186c('0x69')]},'attributes':[_0x186c('0x6a'),'lastName']})[_0x186c('0x55')](function(_0x83a482){if(!_[_0x186c('0x6b')](_0x438e48)&&!_['isNil'](_0x83a482[_0x186c('0x6a')])){_0x36b2aa[_0x186c('0x6c')]=_0x83a482[_0x186c('0x6a')];if(!_[_0x186c('0x6b')](_0x83a482[_0x186c('0x6d')])){_0x36b2aa['calleridname']+='\x20'+_0x83a482[_0x186c('0x6d')];}}})[_0x186c('0x6e')](function(){return db[_0x186c('0x6f')][_0x186c('0x70')](_0x36b2aa);});}})[_0x186c('0x55')](function(){return _0x438e48[_0x186c('0x1b')](0xcc)['end']();})[_0x186c('0x50')](handleError(_0x438e48,null));};exports[_0x186c('0x71')]=function(_0x24f19a,_0x3ddf0e,_0x62ff27){var _0x3a94fd=[];return db['CmContact'][_0x186c('0x58')]()[_0x186c('0x55')](function(_0x1eca4b){_0x3a94fd=_['keys'](_0x1eca4b);return _0x24f19a[_0x186c('0x63')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x186c('0x72'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x186c('0x55')](function(_0x2afecc){if(_0x2afecc&&_0x2afecc['length']){return db[_0x186c('0x73')][_0x186c('0x74')](function(_0x12b125){var _0x2b796b={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x2afecc,'id')},'$or':[{'UserId':null},{'UserId':_0x24f19a[_0x186c('0x63')]['id']}]};var _0x1ca639={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2afecc)['filter'](['dialPreviewAutoRecallMe',0x0])['map']('id')[_0x186c('0x75')]()},'$or':[{'UserId':null},{'UserId':_0x24f19a[_0x186c('0x63')]['id']}]};var _0x2c9b0f={'$or':[_0x2b796b,_0x1ca639]};var _0x4b8de1=[];if(_0x24f19a[_0x186c('0x56')][_0x186c('0x76')]&&_0x24f19a['body'][_0x186c('0x76')]===_0x186c('0x77')){if(!_[_0x186c('0x78')](_0x24f19a['body'][_0x186c('0x79')])){_0x2c9b0f['id']={'$in':_0x24f19a[_0x186c('0x56')]['hopperIds']};}_0x4b8de1=[['priority',_0x186c('0x7a')],[_0x186c('0x7b'),_0x2afecc[0x0][_0x186c('0x72')]==='ASC'?_0x186c('0x7c'):'ASC'],db[_0x186c('0x73')]['literal'](_0x186c('0x7d')),['id','DESC']];}else{if(!_[_0x186c('0x78')](_0x24f19a[_0x186c('0x56')][_0x186c('0x79')])){_0x2c9b0f['id']={'$notIn':_0x24f19a['body']['hopperIds']};}_0x4b8de1=[[_0x186c('0x7e'),'DESC'],['scheduledAt',_0x2afecc[0x0][_0x186c('0x72')]],db[_0x186c('0x73')]['literal'](_0x186c('0x7f')),['id','ASC']];}return db[_0x186c('0x2b')][_0x186c('0x80')]({'attributes':['id',_0x186c('0x81'),'recallme'],'where':_0x2c9b0f,'order':_0x4b8de1,'transaction':_0x12b125,'lock':_0x12b125[_0x186c('0x82')][_0x186c('0x83')],'include':[{'model':db[_0x186c('0x68')],'as':_0x186c('0x84'),'attributes':_0x3a94fd,'include':[{'model':db[_0x186c('0x85')],'as':_0x186c('0x86'),'attributes':['id',_0x186c('0x28')]}]},{'model':db[_0x186c('0x87')],'as':'List','attributes':['id',_0x186c('0x28')]},{'model':db[_0x186c('0x5b')],'as':_0x186c('0x88'),'attributes':['id',_0x186c('0x28'),_0x186c('0x89')]}]})[_0x186c('0x55')](function(_0x5bc427){if(_0x5bc427){return _0x5bc427[_0x186c('0x24')]({'UserId':_0x24f19a['user']['id']},{'transaction':_0x12b125});}});});}})[_0x186c('0x55')](handleEntityNotFound(_0x3ddf0e,null))[_0x186c('0x55')](respondWithResult(_0x3ddf0e,null))[_0x186c('0x50')](handleError(_0x3ddf0e,null));};exports[_0x186c('0x8a')]=function(_0x14266f,_0x5464f3,_0xfbd3a1){var _0x10a60c=[];return db['CmContact']['describe']()[_0x186c('0x55')](function(_0x434c59){_0x10a60c=_['keys'](_0x434c59);return _0x14266f[_0x186c('0x63')][_0x186c('0x8b')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x186c('0x8c')},'attributes':['id','dialOrderByScheduledAt',_0x186c('0x8d')],'raw':!![]});})[_0x186c('0x55')](function(_0x8c0f45){if(_0x8c0f45&&_0x8c0f45[_0x186c('0x8e')]){return db['sequelize'][_0x186c('0x74')](function(_0x3fcea2){var _0x2c2719={'active':![],'recallme':!![],'id':_0x14266f[_0x186c('0x56')][_0x186c('0x8f')]};return db[_0x186c('0x2b')][_0x186c('0x80')]({'attributes':['id',_0x186c('0x81'),_0x186c('0x90')],'where':_0x2c2719,'transaction':_0x3fcea2,'lock':_0x3fcea2[_0x186c('0x82')][_0x186c('0x83')],'include':[{'model':db[_0x186c('0x68')],'as':_0x186c('0x84'),'attributes':_0x10a60c,'include':[{'model':db[_0x186c('0x85')],'as':'Company','attributes':['id',_0x186c('0x28')]}]},{'model':db[_0x186c('0x87')],'as':_0x186c('0x91'),'attributes':['id',_0x186c('0x28')]},{'model':db[_0x186c('0x5b')],'as':_0x186c('0x88'),'attributes':['id',_0x186c('0x28'),_0x186c('0x89')]}]})[_0x186c('0x55')](function(_0x2373bf){if(_0x2373bf){return _0x2373bf[_0x186c('0x24')]({'UserId':_0x14266f[_0x186c('0x63')]['id']},{'transaction':_0x3fcea2});}});});}})[_0x186c('0x55')](handleEntityNotFound(_0x5464f3,null))[_0x186c('0x55')](respondWithResult(_0x5464f3,null))['catch'](handleError(_0x5464f3,null));};exports[_0x186c('0x92')]=function(_0x3d4038,_0x413281,_0x5028d5){return _0x3d4038[_0x186c('0x63')][_0x186c('0x8b')]({'where':{'type':_0x186c('0x93'),'dialActive':!![],'dialMethod':_0x186c('0x8c')},'attributes':['id'],'raw':!![]})['then'](function(_0x228ccc){if(_0x228ccc&&_0x228ccc[_0x186c('0x8e')]){return db['CmHopper'][_0x186c('0x20')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x186c('0x94')](_0x186c('0x65'))},'VoiceQueueId':{'$in':_[_0x186c('0x2a')](_0x228ccc,'id')},'$or':[{'UserId':null},{'UserId':_0x3d4038[_0x186c('0x63')]['id']}]}});}return 0x0;})[_0x186c('0x55')](function(_0xdd9181){if(!_[_0x186c('0x6b')](_0xdd9181)&&_[_0x186c('0x95')](_0xdd9181)){return _0x413281[_0x186c('0x1b')](0xc8)[_0x186c('0x1c')]({'contacts':_0xdd9181});}else{logger[_0x186c('0x26')](_0x186c('0x96'),'getOpenContacts',0x194,_0x186c('0x97'));_0x413281[_0x186c('0x1a')](0x194);}})[_0x186c('0x50')](handleError(_0x413281,null));}; \ No newline at end of file +var _0xef3b=['transaction','hopperId','scheduledat','Company','Queue','dialActive','getVoiceQueues','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','json','apply','reject','save','then','destroy','error','name','send','index','map','CmHopper','rawAttributes','fieldName','type','model','query','keys','filters','concat','$and','$gt','$lt','$lte','$eq','$not','$between','$notBetween','$in','$like','$notLike','$notILike','$contained','$any','intersection','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','fields','create','body','update','find','params','describe','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','campaign','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','VoiceQueueId','queue','ivr','CmContact','ContactId','isNil','firstName','calleridname','lastName','finally','CmHopperFinal','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','sequelize','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','recallme','LOCK','UPDATE','Contact','CmCompany','CmList','List','getPreviewRecall'];(function(_0x19eba6,_0x4b28e2){var _0x5d4062=function(_0x5a5bb7){while(--_0x5a5bb7){_0x19eba6['push'](_0x19eba6['shift']());}};_0x5d4062(++_0x4b28e2);}(_0xef3b,0x141));var _0xbef3=function(_0x147cb0,_0x28316e){_0x147cb0=_0x147cb0-0x0;var _0x5bc46c=_0xef3b[_0x147cb0];return _0x5bc46c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbef3('0x0'));var zipdir=require(_0xbef3('0x1'));var jsonpatch=require(_0xbef3('0x2'));var rp=require(_0xbef3('0x3'));var moment=require(_0xbef3('0x4'));var BPromise=require(_0xbef3('0x5'));var Mustache=require('mustache');var util=require(_0xbef3('0x6'));var path=require(_0xbef3('0x7'));var sox=require(_0xbef3('0x8'));var csv=require('to-csv');var ejs=require(_0xbef3('0x9'));var fs=require('fs');var fs_extra=require(_0xbef3('0xa'));var _=require(_0xbef3('0xb'));var squel=require(_0xbef3('0xc'));var crypto=require(_0xbef3('0xd'));var jsforce=require(_0xbef3('0xe'));var deskjs=require(_0xbef3('0xf'));var toCsv=require(_0xbef3('0x10'));var querystring=require(_0xbef3('0x11'));var Papa=require(_0xbef3('0x12'));var Redis=require(_0xbef3('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xbef3('0x14'));var as=require(_0xbef3('0x15'));var hardwareService=require(_0xbef3('0x16'));var logger=require('../../config/logger')(_0xbef3('0x17'));var utils=require(_0xbef3('0x18'));var config=require(_0xbef3('0x19'));var licenseUtil=require(_0xbef3('0x1a'));var db=require(_0xbef3('0x1b'))['db'];function respondWithStatusCode(_0xe7ab0,_0x44ed32){_0x44ed32=_0x44ed32||0xcc;return function(_0x53c998){if(_0x53c998){return _0xe7ab0['sendStatus'](_0x44ed32);}return _0xe7ab0[_0xbef3('0x1c')](_0x44ed32)[_0xbef3('0x1d')]();};}function respondWithResult(_0x522b40,_0x24490d){_0x24490d=_0x24490d||0xc8;return function(_0x1302a6){if(_0x1302a6){return _0x522b40[_0xbef3('0x1c')](_0x24490d)['json'](_0x1302a6);}};}function respondWithFilteredResult(_0x1791f7,_0x44379b){return function(_0x5b7e0c){if(_0x5b7e0c){var _0x5eeacb=typeof _0x44379b['offset']===_0xbef3('0x1e')&&typeof _0x44379b[_0xbef3('0x1f')]===_0xbef3('0x1e');var _0x34cd7f=_0x5b7e0c[_0xbef3('0x20')];var _0x44420d=_0x5eeacb?0x0:_0x44379b[_0xbef3('0x21')];var _0x22f19a=_0x5eeacb?_0x5b7e0c['count']:_0x44379b['offset']+_0x44379b['limit'];var _0x3b0212;if(_0x22f19a>=_0x34cd7f){_0x22f19a=_0x34cd7f;_0x3b0212=0xc8;}else{_0x3b0212=0xce;}_0x1791f7['status'](_0x3b0212);return _0x1791f7['set']('Content-Range',_0x44420d+'-'+_0x22f19a+'/'+_0x34cd7f)[_0xbef3('0x22')](_0x5b7e0c);}return null;};}function patchUpdates(_0x401235){return function(_0x6f167c){try{jsonpatch[_0xbef3('0x23')](_0x6f167c,_0x401235,!![]);}catch(_0xa02e79){return BPromise[_0xbef3('0x24')](_0xa02e79);}return _0x6f167c[_0xbef3('0x25')]();};}function saveUpdates(_0x46b419,_0x36a31e){return function(_0x408a3f){if(_0x408a3f){return _0x408a3f['update'](_0x46b419)[_0xbef3('0x26')](function(_0x7241bf){return _0x7241bf;});}return null;};}function removeEntity(_0x5e35a3,_0x745277){return function(_0x16e77a){if(_0x16e77a){return _0x16e77a[_0xbef3('0x27')]()['then'](function(){_0x5e35a3[_0xbef3('0x1c')](0xcc)[_0xbef3('0x1d')]();});}};}function handleEntityNotFound(_0x5bed0e,_0x213c61){return function(_0x3712b4){if(!_0x3712b4){_0x5bed0e['sendStatus'](0x194);}return _0x3712b4;};}function handleError(_0x50b8ed,_0x32b7d3){_0x32b7d3=_0x32b7d3||0x1f4;return function(_0x2c3bc9){logger[_0xbef3('0x28')](_0x2c3bc9['stack']);if(_0x2c3bc9[_0xbef3('0x29')]){delete _0x2c3bc9[_0xbef3('0x29')];}_0x50b8ed['status'](_0x32b7d3)[_0xbef3('0x2a')](_0x2c3bc9);};}exports[_0xbef3('0x2b')]=function(_0x4555fe,_0x5b3b8e){var _0x4ba8f1={},_0x3a303c={},_0x42e6c9={'count':0x0,'rows':[]};var _0x494841=_[_0xbef3('0x2c')](db[_0xbef3('0x2d')][_0xbef3('0x2e')],function(_0x114ac6){return{'name':_0x114ac6[_0xbef3('0x2f')],'type':_0x114ac6[_0xbef3('0x30')]['key']};});_0x3a303c[_0xbef3('0x31')]=_[_0xbef3('0x2c')](_0x494841,_0xbef3('0x29'));_0x3a303c[_0xbef3('0x32')]=_[_0xbef3('0x33')](_0x4555fe[_0xbef3('0x32')]);_0x3a303c[_0xbef3('0x34')]=_['intersection'](_0x3a303c[_0xbef3('0x31')],_0x3a303c['query']);_0x3a303c['filters']=_[_0xbef3('0x35')](_0x3a303c[_0xbef3('0x34')],[_0xbef3('0x36'),'$or',_0xbef3('0x37'),'$gte',_0xbef3('0x38'),_0xbef3('0x39'),'$ne',_0xbef3('0x3a'),_0xbef3('0x3b'),_0xbef3('0x3c'),_0xbef3('0x3d'),_0xbef3('0x3e'),'$notIn',_0xbef3('0x3f'),_0xbef3('0x40'),'$iLike',_0xbef3('0x41'),_0xbef3('0x3f'),'$overlap','$contains',_0xbef3('0x42'),_0xbef3('0x43')]);_0x4ba8f1['attributes']=_[_0xbef3('0x44')](_0x3a303c[_0xbef3('0x31')],qs['fields'](_0x4555fe[_0xbef3('0x32')]['fields']));_0x4ba8f1[_0xbef3('0x45')]=_0x4ba8f1[_0xbef3('0x45')][_0xbef3('0x46')]?_0x4ba8f1[_0xbef3('0x45')]:_0x3a303c[_0xbef3('0x31')];if(!_0x4555fe['query'][_0xbef3('0x47')](_0xbef3('0x48'))){_0x4ba8f1['limit']=qs['limit'](_0x4555fe[_0xbef3('0x32')][_0xbef3('0x1f')]);_0x4ba8f1[_0xbef3('0x21')]=qs[_0xbef3('0x21')](_0x4555fe[_0xbef3('0x32')][_0xbef3('0x21')]);}_0x4ba8f1[_0xbef3('0x49')]=qs['sort'](_0x4555fe[_0xbef3('0x32')]['sort']);_0x4ba8f1[_0xbef3('0x4a')]=qs[_0xbef3('0x34')](_[_0xbef3('0x4b')](_0x4555fe[_0xbef3('0x32')],_0x3a303c[_0xbef3('0x34')]),_0x494841);if(_0x4555fe[_0xbef3('0x32')][_0xbef3('0x4c')]){_0x4ba8f1[_0xbef3('0x4a')]=_[_0xbef3('0x4d')](_0x4ba8f1[_0xbef3('0x4a')],{'$or':_[_0xbef3('0x2c')](_0x494841,function(_0x433c10){if(_0x433c10[_0xbef3('0x30')]!==_0xbef3('0x4e')){var _0x243e92={};_0x243e92[_0x433c10['name']]={'$like':'%'+_0x4555fe['query'][_0xbef3('0x4c')]+'%'};return _0x243e92;}})});}_0x4ba8f1=_[_0xbef3('0x4d')]({},_0x4ba8f1,_0x4555fe[_0xbef3('0x4f')]);var _0x585431={'where':_0x4ba8f1['where']};return db[_0xbef3('0x2d')][_0xbef3('0x20')](_0x585431)[_0xbef3('0x26')](function(_0x4bd87d){_0x42e6c9[_0xbef3('0x20')]=_0x4bd87d;if(_0x4555fe[_0xbef3('0x32')][_0xbef3('0x50')]){_0x4ba8f1[_0xbef3('0x51')]=[{'all':!![]}];}return db[_0xbef3('0x2d')][_0xbef3('0x52')](_0x4ba8f1);})[_0xbef3('0x26')](function(_0x566139){_0x42e6c9[_0xbef3('0x53')]=_0x566139;return _0x42e6c9;})[_0xbef3('0x26')](respondWithFilteredResult(_0x5b3b8e,_0x4ba8f1))[_0xbef3('0x54')](handleError(_0x5b3b8e,null));};exports[_0xbef3('0x55')]=function(_0x1e4b71,_0x1acaa8){var _0x2b9132={'raw':!![],'where':{'id':_0x1e4b71['params']['id']}},_0x301a78={};_0x301a78['model']=_[_0xbef3('0x33')](db[_0xbef3('0x2d')]['rawAttributes']);_0x301a78[_0xbef3('0x32')]=_['keys'](_0x1e4b71['query']);_0x301a78[_0xbef3('0x34')]=_[_0xbef3('0x44')](_0x301a78[_0xbef3('0x31')],_0x301a78['query']);_0x2b9132[_0xbef3('0x45')]=_['intersection'](_0x301a78[_0xbef3('0x31')],qs[_0xbef3('0x56')](_0x1e4b71[_0xbef3('0x32')][_0xbef3('0x56')]));_0x2b9132[_0xbef3('0x45')]=_0x2b9132[_0xbef3('0x45')]['length']?_0x2b9132[_0xbef3('0x45')]:_0x301a78[_0xbef3('0x31')];if(_0x1e4b71['query']['includeAll']){_0x2b9132[_0xbef3('0x51')]=[{'all':!![]}];}_0x2b9132=_[_0xbef3('0x4d')]({},_0x2b9132,_0x1e4b71[_0xbef3('0x4f')]);return db[_0xbef3('0x2d')]['find'](_0x2b9132)[_0xbef3('0x26')](handleEntityNotFound(_0x1acaa8,null))[_0xbef3('0x26')](respondWithResult(_0x1acaa8,null))[_0xbef3('0x54')](handleError(_0x1acaa8,null));};exports[_0xbef3('0x57')]=function(_0xb313bd,_0x2d56f2){return db[_0xbef3('0x2d')][_0xbef3('0x57')](_0xb313bd[_0xbef3('0x58')],{})[_0xbef3('0x26')](respondWithResult(_0x2d56f2,0xc9))['catch'](handleError(_0x2d56f2,null));};exports[_0xbef3('0x59')]=function(_0x2020b3,_0xac6aaf){if(_0x2020b3[_0xbef3('0x58')]['id']){delete _0x2020b3[_0xbef3('0x58')]['id'];}return db[_0xbef3('0x2d')][_0xbef3('0x5a')]({'where':{'id':_0x2020b3[_0xbef3('0x5b')]['id']}})[_0xbef3('0x26')](handleEntityNotFound(_0xac6aaf,null))[_0xbef3('0x26')](saveUpdates(_0x2020b3[_0xbef3('0x58')],null))['then'](respondWithResult(_0xac6aaf,null))[_0xbef3('0x54')](handleError(_0xac6aaf,null));};exports[_0xbef3('0x5c')]=function(_0x419b2a,_0x1f1add){return db[_0xbef3('0x2d')][_0xbef3('0x5c')]()['then'](respondWithResult(_0x1f1add,null))[_0xbef3('0x54')](handleError(_0x1f1add,null));};exports[_0xbef3('0x27')]=function(_0x38afa4,_0x9a00ce){var _0x54a9e9;return db[_0xbef3('0x2d')]['find']({'where':{'id':_0x38afa4['params']['id']}})['then'](handleEntityNotFound(_0x9a00ce,null))['then'](function(_0x495f24){if(_0x495f24){return _0x495f24[_0xbef3('0x27')]()[_0xbef3('0x26')](function(_0x3fdb68){return _0x3fdb68;});}})['then'](function(_0x3c1e45){_0x54a9e9=_0x3c1e45;if(_0x3c1e45){if(_0x3c1e45['VoiceQueueId']||_0x3c1e45[_0xbef3('0x5d')]){return db[_0x3c1e45['VoiceQueueId']?_0xbef3('0x5e'):_0xbef3('0x5f')][_0xbef3('0x5a')]({'where':{'id':_0x3c1e45['VoiceQueueId']?_0x3c1e45['VoiceQueueId']:_0x3c1e45[_0xbef3('0x5d')]},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0x5ae46c){var _0x31114a={};if(_0x5ae46c){_[_0xbef3('0x4d')](_0x31114a,_[_0xbef3('0x60')](_0x54a9e9[_0xbef3('0x61')],[_0xbef3('0x62'),_0xbef3('0x63'),'id']));_0x31114a[_0xbef3('0x64')]=0x15;_0x31114a[_0xbef3('0x65')]='deleted';_0x31114a[_0xbef3('0x66')]=_0x5ae46c['name'];_0x31114a['membername']=_0x38afa4[_0xbef3('0x67')][_0xbef3('0x29')];_0x31114a[_0xbef3('0x68')]=_0x38afa4[_0xbef3('0x67')]['id'];_0x31114a['deleted']=!![];_0x31114a[_0xbef3('0x69')]=moment()[_0xbef3('0x6a')](_0xbef3('0x6b'));_0x31114a[_0xbef3('0x6c')]=_0x54a9e9[_0xbef3('0x6d')];_0x31114a[_0xbef3('0x6e')]=_0x54a9e9[_0xbef3('0x6f')]?_0xbef3('0x70'):_0xbef3('0x71');return db[_0xbef3('0x72')][_0xbef3('0x5a')]({'where':{'id':_0x31114a[_0xbef3('0x73')]},'attributes':['firstName','lastName']})[_0xbef3('0x26')](function(_0x4e2fe5){if(!_[_0xbef3('0x74')](_0x9a00ce)&&!_[_0xbef3('0x74')](_0x4e2fe5[_0xbef3('0x75')])){_0x31114a[_0xbef3('0x76')]=_0x4e2fe5['firstName'];if(!_['isNil'](_0x4e2fe5[_0xbef3('0x77')])){_0x31114a[_0xbef3('0x76')]+='\x20'+_0x4e2fe5['lastName'];}}})[_0xbef3('0x78')](function(){return db[_0xbef3('0x79')][_0xbef3('0x57')](_0x31114a);});}})[_0xbef3('0x26')](function(){return _0x9a00ce[_0xbef3('0x1c')](0xcc)[_0xbef3('0x1d')]();})[_0xbef3('0x54')](handleError(_0x9a00ce,null));};exports['getPreview']=function(_0x683e99,_0x49c66c,_0x53dfd5){var _0x30c5f0=[];return db[_0xbef3('0x72')][_0xbef3('0x5c')]()[_0xbef3('0x26')](function(_0x2fac0c){_0x30c5f0=_[_0xbef3('0x33')](_0x2fac0c);return _0x683e99[_0xbef3('0x67')]['getVoiceQueues']({'where':{'type':_0xbef3('0x7a'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xbef3('0x7b'),_0xbef3('0x7c')],'raw':!![]});})[_0xbef3('0x26')](function(_0x292c43){if(_0x292c43&&_0x292c43['length']){return db['sequelize']['transaction'](function(_0x137028){var _0x1c0bd8={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xbef3('0x2c')](_0x292c43,'id')},'$or':[{'UserId':null},{'UserId':_0x683e99[_0xbef3('0x67')]['id']}]};var _0xd8f413={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x292c43)[_0xbef3('0x4c')]([_0xbef3('0x7c'),0x0])[_0xbef3('0x2c')]('id')[_0xbef3('0x7d')]()},'$or':[{'UserId':null},{'UserId':_0x683e99[_0xbef3('0x67')]['id']}]};var _0x50da95={'$or':[_0x1c0bd8,_0xd8f413]};var _0x34da10=[];if(_0x683e99['body']['direction']&&_0x683e99[_0xbef3('0x58')][_0xbef3('0x7e')]===_0xbef3('0x7f')){if(!_[_0xbef3('0x80')](_0x683e99['body']['hopperIds'])){_0x50da95['id']={'$in':_0x683e99[_0xbef3('0x58')][_0xbef3('0x81')]};}_0x34da10=[[_0xbef3('0x82'),_0xbef3('0x83')],[_0xbef3('0x84'),_0x292c43[0x0][_0xbef3('0x7b')]===_0xbef3('0x83')?'DESC':_0xbef3('0x83')],db[_0xbef3('0x85')]['literal'](_0xbef3('0x86')),['id',_0xbef3('0x87')]];}else{if(!_['isEmpty'](_0x683e99[_0xbef3('0x58')][_0xbef3('0x81')])){_0x50da95['id']={'$notIn':_0x683e99[_0xbef3('0x58')][_0xbef3('0x81')]};}_0x34da10=[[_0xbef3('0x82'),_0xbef3('0x87')],[_0xbef3('0x84'),_0x292c43[0x0][_0xbef3('0x7b')]],db['sequelize'][_0xbef3('0x88')](_0xbef3('0x89')),['id','ASC']];}return db[_0xbef3('0x2d')][_0xbef3('0x8a')]({'attributes':['id','scheduledat',_0xbef3('0x8b')],'where':_0x50da95,'order':_0x34da10,'transaction':_0x137028,'lock':_0x137028[_0xbef3('0x8c')][_0xbef3('0x8d')],'include':[{'model':db['CmContact'],'as':_0xbef3('0x8e'),'attributes':_0x30c5f0,'include':[{'model':db[_0xbef3('0x8f')],'as':'Company','attributes':['id',_0xbef3('0x29')]}]},{'model':db[_0xbef3('0x90')],'as':_0xbef3('0x91'),'attributes':['id',_0xbef3('0x29')]},{'model':db[_0xbef3('0x5e')],'as':'Queue','attributes':['id',_0xbef3('0x29'),'dialActive']}]})[_0xbef3('0x26')](function(_0x11fe09){if(_0x11fe09){return _0x11fe09['update']({'UserId':_0x683e99[_0xbef3('0x67')]['id']},{'transaction':_0x137028});}});});}})[_0xbef3('0x26')](handleEntityNotFound(_0x49c66c,null))[_0xbef3('0x26')](respondWithResult(_0x49c66c,null))[_0xbef3('0x54')](handleError(_0x49c66c,null));};exports[_0xbef3('0x92')]=function(_0x1fa94f,_0x56c691,_0x4fe457){var _0x5bb80c=[];return db[_0xbef3('0x72')]['describe']()[_0xbef3('0x26')](function(_0x55caba){_0x5bb80c=_[_0xbef3('0x33')](_0x55caba);return _0x1fa94f['user']['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xbef3('0x7b'),_0xbef3('0x7c')],'raw':!![]});})['then'](function(_0x43f52d){if(_0x43f52d&&_0x43f52d[_0xbef3('0x46')]){return db[_0xbef3('0x85')][_0xbef3('0x93')](function(_0x473dfc){var _0x2e135f={'active':![],'recallme':!![],'id':_0x1fa94f['body'][_0xbef3('0x94')]};return db[_0xbef3('0x2d')][_0xbef3('0x8a')]({'attributes':['id',_0xbef3('0x95'),_0xbef3('0x8b')],'where':_0x2e135f,'transaction':_0x473dfc,'lock':_0x473dfc[_0xbef3('0x8c')][_0xbef3('0x8d')],'include':[{'model':db[_0xbef3('0x72')],'as':_0xbef3('0x8e'),'attributes':_0x5bb80c,'include':[{'model':db['CmCompany'],'as':_0xbef3('0x96'),'attributes':['id','name']}]},{'model':db[_0xbef3('0x90')],'as':_0xbef3('0x91'),'attributes':['id',_0xbef3('0x29')]},{'model':db[_0xbef3('0x5e')],'as':_0xbef3('0x97'),'attributes':['id','name',_0xbef3('0x98')]}]})[_0xbef3('0x26')](function(_0x3571a4){if(_0x3571a4){return _0x3571a4[_0xbef3('0x59')]({'UserId':_0x1fa94f[_0xbef3('0x67')]['id']},{'transaction':_0x473dfc});}});});}})[_0xbef3('0x26')](handleEntityNotFound(_0x56c691,null))['then'](respondWithResult(_0x56c691,null))[_0xbef3('0x54')](handleError(_0x56c691,null));};exports['getOpenContacts']=function(_0x59136b,_0xd49fa1,_0x43488e){return _0x59136b[_0xbef3('0x67')][_0xbef3('0x99')]({'where':{'type':_0xbef3('0x7a'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0xbef3('0x26')](function(_0x3598a7){if(_0x3598a7&&_0x3598a7[_0xbef3('0x46')]){return db[_0xbef3('0x2d')][_0xbef3('0x20')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xbef3('0x6a')](_0xbef3('0x6b'))},'VoiceQueueId':{'$in':_[_0xbef3('0x2c')](_0x3598a7,'id')},'$or':[{'UserId':null},{'UserId':_0x59136b[_0xbef3('0x67')]['id']}]}});}return 0x0;})[_0xbef3('0x26')](function(_0x3cc30e){if(!_['isNil'](_0x3cc30e)&&_['isNumber'](_0x3cc30e)){return _0xd49fa1['status'](0xc8)['json']({'contacts':_0x3cc30e});}else{logger['error'](_0xbef3('0x9a'),'getOpenContacts',0x194,_0xbef3('0x9b'));_0xd49fa1['sendStatus'](0x194);}})[_0xbef3('0x54')](handleError(_0xd49fa1,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index a21b55c..94fd0fc 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 _0xacf4=['define','CmHopper','cm_hopper','scheduledat','phone','priority','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopper.attributes','exports'];(function(_0x1a7e89,_0x86bb7e){var _0xc8ebc4=function(_0x3ed474){while(--_0x3ed474){_0x1a7e89['push'](_0x1a7e89['shift']());}};_0xc8ebc4(++_0x86bb7e);}(_0xacf4,0xe7));var _0x4acf=function(_0x4905e6,_0xf1295c){_0x4905e6=_0x4905e6-0x0;var _0x1f7655=_0xacf4[_0x4905e6];return _0x1f7655;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4acf('0x0'))(_0x4acf('0x1'));var moment=require(_0x4acf('0x2'));var BPromise=require(_0x4acf('0x3'));var rp=require(_0x4acf('0x4'));var fs=require('fs');var path=require(_0x4acf('0x5'));var rimraf=require(_0x4acf('0x6'));var config=require('../../config/environment');var attributes=require(_0x4acf('0x7'));module[_0x4acf('0x8')]=function(_0x4e0c43,_0x24bf24){return _0x4e0c43[_0x4acf('0x9')](_0x4acf('0xa'),attributes,{'tableName':_0x4acf('0xb'),'paranoid':![],'indexes':[{'name':_0x4acf('0xc'),'fields':['scheduledat']},{'name':'phone','fields':[_0x4acf('0xd')]},{'name':'priority','fields':[_0x4acf('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1623=['scheduledat','phone','priority','lodash','api','moment','bluebird','request-promise','path','./cmHopper.attributes','CmHopper','cm_hopper'];(function(_0x5a5dcf,_0x1d3fa3){var _0x1c4aff=function(_0xd2fe2c){while(--_0xd2fe2c){_0x5a5dcf['push'](_0x5a5dcf['shift']());}};_0x1c4aff(++_0x1d3fa3);}(_0x1623,0xab));var _0x3162=function(_0x14c6c0,_0x444e1b){_0x14c6c0=_0x14c6c0-0x0;var _0x222122=_0x1623[_0x14c6c0];return _0x222122;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3162('0x1'));var moment=require(_0x3162('0x2'));var BPromise=require(_0x3162('0x3'));var rp=require(_0x3162('0x4'));var fs=require('fs');var path=require(_0x3162('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3162('0x6'));module['exports']=function(_0x1b55f2,_0x428de6){return _0x1b55f2['define'](_0x3162('0x7'),attributes,{'tableName':_0x3162('0x8'),'paranoid':![],'indexes':[{'name':_0x3162('0x9'),'fields':[_0x3162('0x9')]},{'name':_0x3162('0xa'),'fields':[_0x3162('0xa')]},{'name':_0x3162('0xb'),'fields':[_0x3162('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 074eda0..6277bd2 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 _0x1eae=['GetCmHopper','CmHopper','findAll','options','raw','where','attributes','map','include','model','ShowCmHopper','find','CreateCmHopper','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','limit','UPDATE','Contact','keys','User','name','voicePause','UserId','push','includes','all','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','order','LOCK','GetCmHopperPreview','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','interval','NOW()\x20+\x20INTERVAL\x20','List','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','twilio/lib/webhooks/webhooks','client','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x7d4b9d,_0x494c27){var _0x568e19=function(_0x261b13){while(--_0x261b13){_0x7d4b9d['push'](_0x7d4b9d['shift']());}};_0x568e19(++_0x494c27);}(_0x1eae,0x196));var _0xe1ea=function(_0x3315de,_0x75bb88){_0x3315de=_0x3315de-0x0;var _0x4272c5=_0x1eae[_0x3315de];return _0x4272c5;};'use strict';var _=require(_0xe1ea('0x0'));var util=require(_0xe1ea('0x1'));var moment=require(_0xe1ea('0x2'));var BPromise=require(_0xe1ea('0x3'));var rs=require(_0xe1ea('0x4'));var fs=require('fs');var Redis=require(_0xe1ea('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe1ea('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xe1ea('0x7'));var jayson=require(_0xe1ea('0x8'));const {validateExpressRequest}=require(_0xe1ea('0x9'));var client=jayson[_0xe1ea('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3fe71a,_0x2799bb,_0x14b13c){return new BPromise(function(_0x233105,_0x2be01c){return client[_0xe1ea('0xb')](_0x3fe71a,_0x14b13c)[_0xe1ea('0xc')](function(_0x1ae263){logger[_0xe1ea('0xd')](_0xe1ea('0xe'),_0x2799bb,_0xe1ea('0xf'));logger[_0xe1ea('0x10')](_0xe1ea('0x11'),_0x2799bb,_0xe1ea('0xf'),JSON[_0xe1ea('0x12')](_0x1ae263));if(_0x1ae263[_0xe1ea('0x13')]){if(_0x1ae263['error'][_0xe1ea('0x14')]===0x1f4){logger[_0xe1ea('0x13')]('CmHopper,\x20%s,\x20%s',_0x2799bb,_0x1ae263[_0xe1ea('0x13')][_0xe1ea('0x15')]);return _0x2be01c(_0x1ae263['error'][_0xe1ea('0x15')]);}logger['error']('CmHopper,\x20%s,\x20%s',_0x2799bb,_0x1ae263[_0xe1ea('0x13')][_0xe1ea('0x15')]);return _0x233105(_0x1ae263[_0xe1ea('0x13')][_0xe1ea('0x15')]);}else{logger[_0xe1ea('0xd')]('CmHopper,\x20%s,\x20%s',_0x2799bb,_0xe1ea('0xf'));_0x233105(_0x1ae263[_0xe1ea('0x16')][_0xe1ea('0x15')]);}})[_0xe1ea('0x17')](function(_0x46e94e){logger[_0xe1ea('0x13')](_0xe1ea('0xe'),_0x2799bb,_0x46e94e);_0x2be01c(_0x46e94e);});});}exports[_0xe1ea('0x18')]=function(_0x56dc69){var _0x28a6c1=this;return new Promise(function(_0xa4be39,_0x2c438e){return db[_0xe1ea('0x19')][_0xe1ea('0x1a')]({'raw':_0x56dc69[_0xe1ea('0x1b')]?_0x56dc69[_0xe1ea('0x1b')][_0xe1ea('0x1c')]===undefined?!![]:![]:!![],'where':_0x56dc69[_0xe1ea('0x1b')]?_0x56dc69[_0xe1ea('0x1b')][_0xe1ea('0x1d')]||null:null,'attributes':_0x56dc69[_0xe1ea('0x1b')]?_0x56dc69[_0xe1ea('0x1b')][_0xe1ea('0x1e')]||null:null,'limit':_0x56dc69['options']?_0x56dc69[_0xe1ea('0x1b')]['limit']||null:null,'include':_0x56dc69[_0xe1ea('0x1b')]?_0x56dc69[_0xe1ea('0x1b')]['include']?_[_0xe1ea('0x1f')](_0x56dc69[_0xe1ea('0x1b')][_0xe1ea('0x20')],function(_0x37a607){return{'model':db[_0x37a607['model']],'as':_0x37a607['as'],'attributes':_0x37a607[_0xe1ea('0x1e')],'include':_0x37a607[_0xe1ea('0x20')]?_[_0xe1ea('0x1f')](_0x37a607['include'],function(_0x5729a1){return{'model':db[_0x5729a1[_0xe1ea('0x21')]],'as':_0x5729a1['as'],'attributes':_0x5729a1['attributes'],'include':_0x5729a1[_0xe1ea('0x20')]?_[_0xe1ea('0x1f')](_0x5729a1[_0xe1ea('0x20')],function(_0x2e1e1f){return{'model':db[_0x2e1e1f[_0xe1ea('0x21')]],'as':_0x2e1e1f['as'],'attributes':_0x2e1e1f['attributes']};}):[]};}):[]};}):[]:[]})[_0xe1ea('0xc')](function(_0x51318e){logger['info'](_0xe1ea('0x18'),_0x56dc69);logger[_0xe1ea('0x10')]('GetCmHopper',_0x56dc69,JSON[_0xe1ea('0x12')](_0x51318e));_0xa4be39(_0x51318e);})[_0xe1ea('0x17')](function(_0x1e3a06){logger[_0xe1ea('0x13')](_0xe1ea('0x18'),_0x1e3a06[_0xe1ea('0x15')],_0x56dc69);_0x2c438e(_0x28a6c1[_0xe1ea('0x13')](0x1f4,_0x1e3a06[_0xe1ea('0x15')]));});});};exports[_0xe1ea('0x22')]=function(_0x79f6e0){var _0x98dc8a=this;return new Promise(function(_0x5f30ce,_0x5ebd4d){return db['CmHopper'][_0xe1ea('0x23')]({'raw':_0x79f6e0['options']?_0x79f6e0[_0xe1ea('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x79f6e0['options']?_0x79f6e0['options']['where']||null:null,'attributes':_0x79f6e0[_0xe1ea('0x1b')]?_0x79f6e0[_0xe1ea('0x1b')][_0xe1ea('0x1e')]||null:null,'include':_0x79f6e0[_0xe1ea('0x1b')]?_0x79f6e0[_0xe1ea('0x1b')][_0xe1ea('0x20')]?_[_0xe1ea('0x1f')](_0x79f6e0['options'][_0xe1ea('0x20')],function(_0x255056){return{'model':db[_0x255056[_0xe1ea('0x21')]],'as':_0x255056['as'],'attributes':_0x255056[_0xe1ea('0x1e')],'include':_0x255056[_0xe1ea('0x20')]?_['map'](_0x255056['include'],function(_0x31e24f){return{'model':db[_0x31e24f[_0xe1ea('0x21')]],'as':_0x31e24f['as'],'attributes':_0x31e24f['attributes'],'include':_0x31e24f[_0xe1ea('0x20')]?_['map'](_0x31e24f['include'],function(_0x2e8ab5){return{'model':db[_0x2e8ab5[_0xe1ea('0x21')]],'as':_0x2e8ab5['as'],'attributes':_0x2e8ab5['attributes']};}):[]};}):[]};}):[]:[]})[_0xe1ea('0xc')](function(_0x4eb62c){logger[_0xe1ea('0xd')](_0xe1ea('0x22'),_0x79f6e0);logger[_0xe1ea('0x10')](_0xe1ea('0x22'),_0x79f6e0,JSON[_0xe1ea('0x12')](_0x4eb62c));_0x5f30ce(_0x4eb62c);})[_0xe1ea('0x17')](function(_0xc25331){logger[_0xe1ea('0x13')](_0xe1ea('0x22'),_0xc25331['message'],_0x79f6e0);_0x5ebd4d(_0x98dc8a['error'](0x1f4,_0xc25331[_0xe1ea('0x15')]));});});};exports[_0xe1ea('0x24')]=function(_0x551550){var _0x268a45=this;return new Promise(function(_0x31dda1,_0x15315d){return db['CmHopper']['create'](_0x551550[_0xe1ea('0x25')],{'raw':_0x551550[_0xe1ea('0x1b')]?_0x551550[_0xe1ea('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1d62e1){logger[_0xe1ea('0xd')](_0xe1ea('0x24'),_0x551550);logger[_0xe1ea('0x10')](_0xe1ea('0x24'),_0x551550,JSON[_0xe1ea('0x12')](_0x1d62e1));_0x31dda1(_0x1d62e1);})[_0xe1ea('0x17')](function(_0x3db84f){logger[_0xe1ea('0x13')](_0xe1ea('0x24'),_0x3db84f[_0xe1ea('0x15')],_0x551550);_0x15315d(_0x268a45[_0xe1ea('0x13')](0x1f4,_0x3db84f[_0xe1ea('0x15')]));});});};exports[_0xe1ea('0x26')]=function(_0x447c1f){var _0x43d181=this;return new Promise(function(_0x7a6ff,_0x32d7d5){return db[_0xe1ea('0x19')][_0xe1ea('0x27')](_0x447c1f[_0xe1ea('0x25')],{'raw':_0x447c1f['options']?_0x447c1f['options'][_0xe1ea('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x447c1f[_0xe1ea('0x1b')]?_0x447c1f[_0xe1ea('0x1b')][_0xe1ea('0x1d')]||null:null,'attributes':_0x447c1f['options']?_0x447c1f[_0xe1ea('0x1b')]['attributes']||null:null,'limit':_0x447c1f[_0xe1ea('0x1b')]?_0x447c1f['options']['limit']||null:null})[_0xe1ea('0xc')](function(_0x1bf4b3){logger[_0xe1ea('0xd')](_0xe1ea('0x26'),_0x447c1f);logger[_0xe1ea('0xd')](_0xe1ea('0x28'),JSON[_0xe1ea('0x12')](_0x447c1f[_0xe1ea('0x1b')][_0xe1ea('0x1d')]),_0x447c1f[_0xe1ea('0x25')][_0xe1ea('0x29')]);logger[_0xe1ea('0x10')](_0xe1ea('0x26'),_0x447c1f,JSON[_0xe1ea('0x12')](_0x1bf4b3));_0x7a6ff(_0x1bf4b3);})['catch'](function(_0x4b6774){logger['error'](_0xe1ea('0x26'),_0x4b6774[_0xe1ea('0x15')],_0x447c1f);_0x32d7d5(_0x43d181['error'](0x1f4,_0x4b6774[_0xe1ea('0x15')]));});});};exports[_0xe1ea('0x2a')]=function(_0x4df6da){var _0x299871=this;return new Promise(function(_0x24cc3d,_0x2fa47b){return db[_0xe1ea('0x19')][_0xe1ea('0x2b')]({'where':_0x4df6da[_0xe1ea('0x1b')]?_0x4df6da['options'][_0xe1ea('0x1d')]||null:null})['then'](function(_0x228cda){logger[_0xe1ea('0xd')](_0xe1ea('0x2a'),_0x4df6da);logger[_0xe1ea('0x10')]('DestroyCmHopper',_0x4df6da,JSON[_0xe1ea('0x12')](_0x228cda));_0x24cc3d(_0x228cda);})[_0xe1ea('0x17')](function(_0x1e0554){logger['error'](_0xe1ea('0x2a'),_0x1e0554[_0xe1ea('0x15')],_0x4df6da);_0x2fa47b(_0x299871[_0xe1ea('0x13')](0x1f4,_0x1e0554[_0xe1ea('0x15')]));});});};exports[_0xe1ea('0x2c')]=function(_0x20146c){var _0x2e832d=this;return new Promise(function(_0xe517e2,_0x292bb5){return db[_0xe1ea('0x2d')][_0xe1ea('0x2e')]()[_0xe1ea('0xc')](function(_0x4759d2){return db[_0xe1ea('0x2f')][_0xe1ea('0x30')](function(_0x596ceb){return db[_0xe1ea('0x19')][_0xe1ea('0x1a')]({'where':_0x20146c[_0xe1ea('0x1b')]?_0x20146c[_0xe1ea('0x1b')][_0xe1ea('0x1d')]||null:null,'attributes':_0x20146c[_0xe1ea('0x1b')]?_0x20146c['options']['attributes']||null:null,'limit':_0x20146c['options']?_0x20146c[_0xe1ea('0x1b')][_0xe1ea('0x31')]||null:null,'order':_0x20146c[_0xe1ea('0x1b')]?_0x20146c[_0xe1ea('0x1b')]['order']||null:null,'transaction':_0x596ceb,'lock':_0x596ceb['LOCK'][_0xe1ea('0x32')],'include':[{'model':db['CmContact'],'as':_0xe1ea('0x33'),'attributes':_[_0xe1ea('0x34')](_0x4759d2)},{'model':db[_0xe1ea('0x35')],'as':'Agent','attributes':['id',_0xe1ea('0x36'),_0xe1ea('0x37')]}]})[_0xe1ea('0xc')](function(_0x4f64c8){var _0x1bd200=[];var _0x1c5b9c=[];for(var _0x308e3b=0x0;_0x308e3b<_0x4f64c8['length'];_0x308e3b+=0x1){var _0x2f6c72=_0x4f64c8[_0x308e3b][_0xe1ea('0x38')];if(_0x2f6c72===null){_0x1bd200[_0xe1ea('0x39')](_0x4f64c8[_0x308e3b][_0xe1ea('0x27')](_0x20146c[_0xe1ea('0x25')],{'transaction':_0x596ceb}));}else if(!_0x1c5b9c[_0xe1ea('0x3a')](_0x2f6c72)){_0x1c5b9c[_0xe1ea('0x39')](_0x2f6c72);_0x1bd200[_0xe1ea('0x39')](_0x4f64c8[_0x308e3b][_0xe1ea('0x27')](_0x20146c['body'],{'transaction':_0x596ceb}));}}return BPromise[_0xe1ea('0x3b')](_0x1bd200);});})[_0xe1ea('0xc')](function(_0x54eeba){logger[_0xe1ea('0xd')]('GetContactDialer',_0x20146c);if(_0x54eeba[_0xe1ea('0x3c')]>0x0){logger[_0xe1ea('0xd')](_0xe1ea('0x3d'),_0x54eeba[0x0][_0xe1ea('0x3e')]['id'],_0x54eeba[0x0][_0xe1ea('0x3e')][_0xe1ea('0x3f')],_0x54eeba[0x0][_0xe1ea('0x3e')][_0xe1ea('0x29')]);}logger[_0xe1ea('0x10')]('GetContactDialer',_0x20146c,JSON[_0xe1ea('0x12')](_0x54eeba));_0xe517e2(_0x54eeba);})['catch'](function(_0x5d70f2){logger[_0xe1ea('0x13')](_0xe1ea('0x2c'),_0x5d70f2[_0xe1ea('0x15')],_0x20146c);_0x292bb5(_0x2e832d['error'](0x1f4,_0x5d70f2['message']));});});});};exports[_0xe1ea('0x40')]=function(_0x58c37a){var _0x210bc8=this;return new Promise(function(_0x442914,_0x4c32ac){return db['sequelize'][_0xe1ea('0x30')](function(_0x13d995){return db[_0xe1ea('0x41')][_0xe1ea('0x42')](_0x58c37a['body'],{'raw':_0x58c37a[_0xe1ea('0x1b')]?_0x58c37a[_0xe1ea('0x1b')]['raw']===undefined?!![]:![]:!![],'transaction':_0x13d995})[_0xe1ea('0xc')](function(){logger[_0xe1ea('0xd')](_0xe1ea('0x43'),JSON['stringify'](_0x58c37a[_0xe1ea('0x1b')][_0xe1ea('0x1d')]),_0x58c37a['options'][_0xe1ea('0x1d')][_0xe1ea('0x29')]);return db['CmHopper']['destroy']({'where':_0x58c37a[_0xe1ea('0x1b')]?_0x58c37a[_0xe1ea('0x1b')][_0xe1ea('0x1d')]||null:null,'transaction':_0x13d995});});})[_0xe1ea('0xc')](function(_0x45ca23){logger[_0xe1ea('0xd')](_0xe1ea('0x40'),_0x58c37a);logger['debug']('MoveContactManagedDialer',_0x58c37a,JSON[_0xe1ea('0x12')](_0x45ca23));_0x442914(_0x45ca23);})['catch'](function(_0x12d232){logger[_0xe1ea('0x13')](_0xe1ea('0x40'),_0x12d232[_0xe1ea('0x15')],_0x58c37a);_0x4c32ac(_0x210bc8[_0xe1ea('0x13')](0x1f4,_0x12d232[_0xe1ea('0x15')]));});});};exports[_0xe1ea('0x44')]=function(_0x4f5b92){var _0x4d4de1=this;return new Promise(function(_0x42c2e8,_0x29f303){return db[_0xe1ea('0x19')][_0xe1ea('0x1a')]({'raw':_0x4f5b92[_0xe1ea('0x1b')]?_0x4f5b92[_0xe1ea('0x1b')][_0xe1ea('0x1c')]===undefined?!![]:![]:!![],'where':_0x4f5b92[_0xe1ea('0x1b')]?_0x4f5b92[_0xe1ea('0x1b')][_0xe1ea('0x1d')]||null:null,'attributes':[[db[_0xe1ea('0x2f')]['fn'](_0xe1ea('0x45'),db[_0xe1ea('0x2f')]['fn']('IF',db[_0xe1ea('0x2f')][_0xe1ea('0x46')]('`scheduledat`\x20>=\x20'+util[_0xe1ea('0x47')](_0xe1ea('0x48'),moment()[_0xe1ea('0x47')](_0xe1ea('0x49')))+_0xe1ea('0x4a')))),_0xe1ea('0x4b')]]})['then'](function(_0x529d89){logger[_0xe1ea('0xd')](_0xe1ea('0x44'),_0x4f5b92);logger[_0xe1ea('0x10')]('CountReScheduled',_0x4f5b92,JSON['stringify'](_0x529d89));_0x42c2e8(_0x529d89);})[_0xe1ea('0x17')](function(_0x184a96){logger[_0xe1ea('0x13')](_0xe1ea('0x44'),_0x184a96[_0xe1ea('0x15')],_0x4f5b92);_0x29f303(_0x4d4de1[_0xe1ea('0x13')](0x1f4,_0x184a96[_0xe1ea('0x15')]));});});};exports[_0xe1ea('0x4c')]=function(_0x49e85b){var _0x288aee=this;return new Promise(function(_0x5a9b88,_0x3dfd49){return db[_0xe1ea('0x2d')][_0xe1ea('0x2e')]()['then'](function(_0x175e44){return db[_0xe1ea('0x2f')][_0xe1ea('0x30')](function(_0x1d6602){return db[_0xe1ea('0x19')][_0xe1ea('0x1a')]({'where':_0x49e85b[_0xe1ea('0x1b')]?_0x49e85b[_0xe1ea('0x1b')]['where']||null:null,'attributes':_0x49e85b[_0xe1ea('0x1b')]?_0x49e85b[_0xe1ea('0x1b')]['attributes']||null:null,'limit':0x1,'order':_0x49e85b[_0xe1ea('0x1b')]?_0x49e85b['options'][_0xe1ea('0x4d')]||null:null,'group':db['CmHopper'][_0xe1ea('0x38')],'transaction':_0x1d6602,'lock':_0x1d6602[_0xe1ea('0x4e')][_0xe1ea('0x32')],'include':_0x49e85b['options']?_0x49e85b[_0xe1ea('0x1b')][_0xe1ea('0x20')]?_['map'](_0x49e85b['options']['include'],function(_0x1460b2){return{'model':db[_0x1460b2['model']],'as':_0x1460b2['as'],'attributes':_0x1460b2[_0xe1ea('0x1e')],'include':_0x1460b2[_0xe1ea('0x20')]?_[_0xe1ea('0x1f')](_0x1460b2[_0xe1ea('0x20')],function(_0x536cbb){return{'model':db[_0x536cbb[_0xe1ea('0x21')]],'as':_0x536cbb['as'],'attributes':_0x536cbb[_0xe1ea('0x1e')],'include':_0x536cbb['include']?_['map'](_0x536cbb['include'],function(_0x2630ff){return{'model':db[_0x2630ff['model']],'as':_0x2630ff['as'],'attributes':_0x2630ff['attributes']};}):[]};}):[]};}):[]:[]})[_0xe1ea('0xc')](function(_0x140f6e){var _0x5222da=[];for(var _0x10175d=0x0;_0x10175d<_0x140f6e[_0xe1ea('0x3c')];_0x10175d+=0x1){_0x5222da['push'](_0x140f6e[_0x10175d][_0xe1ea('0x27')](_0x49e85b[_0xe1ea('0x25')],{'transaction':_0x1d6602}));}return BPromise[_0xe1ea('0x3b')](_0x5222da);});})[_0xe1ea('0xc')](function(_0x5b26ff){logger['info'](_0xe1ea('0x4c'),_0x49e85b);logger[_0xe1ea('0x10')](_0xe1ea('0x4c'),_0x49e85b,JSON[_0xe1ea('0x12')](_0x5b26ff));_0x5a9b88(_0x5b26ff);})[_0xe1ea('0x17')](function(_0x5a4294){logger[_0xe1ea('0x13')](_0xe1ea('0x4c'),_0x5a4294[_0xe1ea('0x15')],_0x49e85b);_0x3dfd49(_0x288aee[_0xe1ea('0x13')](0x1f4,_0x5a4294['message']));});});});};exports[_0xe1ea('0x4f')]=function(_0x16c406){var _0x3b5403=this;return new Promise(function(_0x4a468f,_0x4708df){db['CmContact'][_0xe1ea('0x2e')]()['then'](function(_0x29ff7a){return db[_0xe1ea('0x19')][_0xe1ea('0x1a')]({'raw':_0x16c406[_0xe1ea('0x1b')]?_0x16c406['options'][_0xe1ea('0x1c')]===undefined?!![]:![]:!![],'where':_0x16c406[_0xe1ea('0x1b')]?_0x16c406[_0xe1ea('0x1b')][_0xe1ea('0x1d')]||null:null,'attributes':_0x16c406['options']?_0x16c406[_0xe1ea('0x1b')][_0xe1ea('0x1e')]||null:null,'limit':_0x16c406[_0xe1ea('0x1b')]?_0x16c406[_0xe1ea('0x1b')][_0xe1ea('0x31')]||null:null,'include':_0x16c406[_0xe1ea('0x1b')]?_0x16c406[_0xe1ea('0x1b')][_0xe1ea('0x20')]?_[_0xe1ea('0x1f')](_0x16c406[_0xe1ea('0x1b')][_0xe1ea('0x20')],function(_0x579100){return{'model':db[_0x579100[_0xe1ea('0x21')]],'as':_0x579100['as'],'attributes':_0x579100['as']===_0xe1ea('0x33')?_[_0xe1ea('0x34')](_0x29ff7a):_0x579100[_0xe1ea('0x1e')],'include':_0x579100[_0xe1ea('0x20')]?_[_0xe1ea('0x1f')](_0x579100['include'],function(_0x1ae3c1){return{'model':db[_0x1ae3c1[_0xe1ea('0x21')]],'as':_0x1ae3c1['as'],'attributes':_0x1ae3c1[_0xe1ea('0x1e')],'include':_0x1ae3c1[_0xe1ea('0x20')]?_['map'](_0x1ae3c1['include'],function(_0x3f3ec2){return{'model':db[_0x3f3ec2[_0xe1ea('0x21')]],'as':_0x3f3ec2['as'],'attributes':_0x3f3ec2['attributes']};}):[]};}):[]};}):[]:[]})[_0xe1ea('0xc')](function(_0x1095c0){logger[_0xe1ea('0xd')](_0xe1ea('0x18'),_0x16c406);logger['debug'](_0xe1ea('0x18'),_0x16c406,JSON['stringify'](_0x1095c0));_0x4a468f(_0x1095c0);})['catch'](function(_0x27aafe){logger['error'](_0xe1ea('0x18'),_0x27aafe[_0xe1ea('0x15')],_0x16c406);_0x4708df(_0x3b5403[_0xe1ea('0x13')](0x1f4,_0x27aafe[_0xe1ea('0x15')]));});});});};exports[_0xe1ea('0x50')]=function(_0x5c9f0e){var _0x4a500e=this;return new Promise(function(_0x447567,_0x436935){return db['sequelize'][_0xe1ea('0x30')](function(_0x1c0d8a){return db[_0xe1ea('0x19')][_0xe1ea('0x27')]({'active':![]},{'where':{},'transaction':_0x1c0d8a})['then'](function(_0x4f9569){logger['info'](_0xe1ea('0x50'),_0x5c9f0e);logger[_0xe1ea('0x10')](_0xe1ea('0x50'),_0x5c9f0e,JSON[_0xe1ea('0x12')](_0x4f9569));_0x447567(_0x4f9569);})[_0xe1ea('0x17')](function(_0x42b59f){logger[_0xe1ea('0x13')](_0xe1ea('0x50'),_0x42b59f['message'],_0x5c9f0e);_0x436935(_0x4a500e['error'](0x1f4,_0x42b59f[_0xe1ea('0x15')]));});});});};exports[_0xe1ea('0x51')]=function(_0x479630){var _0x4ebada=this;var _0x1e90c2=_0x479630['body'][_0xe1ea('0x1d')][_0xe1ea('0x52')];var _0x4140ba=_0x479630[_0xe1ea('0x25')][_0xe1ea('0x1d')][_0xe1ea('0x53')];return new Promise(function(_0x55891c,_0x13a583){return db['CmHopper'][_0xe1ea('0x1a')]({'where':{'voiceQueueId':_0x1e90c2,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db['sequelize']['literal'](_0xe1ea('0x54')+_0x4140ba+'\x20MINUTE')}},'include':[{'model':db[_0xe1ea('0x2d')],'as':'Contact'},{'model':db[_0xe1ea('0x35')],'as':'Agent','attributes':['id',_0xe1ea('0x36'),'voicePause']},{'model':db['CmList'],'as':_0xe1ea('0x55')}]})['then'](function(_0x4c90c7){return db[_0xe1ea('0x2f')][_0xe1ea('0x30')](function(_0x5d9172){return db['CmHopper'][_0xe1ea('0x27')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x1e90c2,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0xe1ea('0x2f')][_0xe1ea('0x46')](_0xe1ea('0x54')+_0x4140ba+'\x20MINUTE')}},'transaction':_0x5d9172})[_0xe1ea('0xc')](function(_0x40cc34){_0x55891c(_0x4c90c7);})[_0xe1ea('0x17')](function(_0x5b4b0e){logger[_0xe1ea('0x13')](_0xe1ea('0x51'),_0x5b4b0e[_0xe1ea('0x15')],_0x479630);_0x13a583(validateExpressRequest);});});})[_0xe1ea('0x17')](function(_0x298020){logger[_0xe1ea('0x13')]('CmHopperHandlePreviewRecallNotifications',_0x298020['message'],_0x479630);_0x13a583(_0x4ebada['error'](0x1f4,_0x298020[_0xe1ea('0x15')]));});});}; \ No newline at end of file +var _0x00f5=['info','CmHopper,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','GetCmHopper','CmHopper','options','raw','attributes','include','map','model','then','ShowCmHopper','where','stringify','CreateCmHopper','create','UpdateCmHopper','update','body','active','DestroyCmHopper','destroy','CmContact','describe','sequelize','transaction','limit','order','keys','User','Agent','name','voicePause','length','push','all','GetContactDialer','dataValues','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','findAll','COUNT','literal','format','GetContactRecallMe','UserId','LOCK','UPDATE','GetCmHopperPreview','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','interval','\x20MINUTE','Contact','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','twilio/lib/webhooks/webhooks','client','http'];(function(_0x3ab353,_0x5d5283){var _0x1e2285=function(_0x55804f){while(--_0x55804f){_0x3ab353['push'](_0x3ab353['shift']());}};_0x1e2285(++_0x5d5283);}(_0x00f5,0xda));var _0x500f=function(_0x16934b,_0xdd1a3e){_0x16934b=_0x16934b-0x0;var _0x45b9e8=_0x00f5[_0x16934b];return _0x45b9e8;};'use strict';var _=require(_0x500f('0x0'));var util=require('util');var moment=require(_0x500f('0x1'));var BPromise=require(_0x500f('0x2'));var rs=require(_0x500f('0x3'));var fs=require('fs');var Redis=require(_0x500f('0x4'));var db=require(_0x500f('0x5'))['db'];var utils=require(_0x500f('0x6'));var logger=require('../../config/logger')(_0x500f('0x7'));var config=require(_0x500f('0x8'));var jayson=require(_0x500f('0x9'));const {validateExpressRequest}=require(_0x500f('0xa'));var client=jayson[_0x500f('0xb')][_0x500f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d6b9d,_0x5586d5,_0x3519d7){return new BPromise(function(_0x4e4b8c,_0x8f8783){return client['request'](_0x2d6b9d,_0x3519d7)['then'](function(_0x28e43d){logger[_0x500f('0xd')](_0x500f('0xe'),_0x5586d5,'request\x20sent');logger[_0x500f('0xf')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x5586d5,'request\x20sent',JSON['stringify'](_0x28e43d));if(_0x28e43d[_0x500f('0x10')]){if(_0x28e43d[_0x500f('0x10')][_0x500f('0x11')]===0x1f4){logger[_0x500f('0x10')](_0x500f('0xe'),_0x5586d5,_0x28e43d[_0x500f('0x10')]['message']);return _0x8f8783(_0x28e43d[_0x500f('0x10')][_0x500f('0x12')]);}logger['error'](_0x500f('0xe'),_0x5586d5,_0x28e43d['error'][_0x500f('0x12')]);return _0x4e4b8c(_0x28e43d[_0x500f('0x10')][_0x500f('0x12')]);}else{logger[_0x500f('0xd')](_0x500f('0xe'),_0x5586d5,_0x500f('0x13'));_0x4e4b8c(_0x28e43d[_0x500f('0x14')][_0x500f('0x12')]);}})[_0x500f('0x15')](function(_0xb95fc2){logger[_0x500f('0x10')](_0x500f('0xe'),_0x5586d5,_0xb95fc2);_0x8f8783(_0xb95fc2);});});}exports[_0x500f('0x16')]=function(_0x345422){var _0x1f197e=this;return new Promise(function(_0x59253e,_0x4a0848){return db[_0x500f('0x17')]['findAll']({'raw':_0x345422[_0x500f('0x18')]?_0x345422[_0x500f('0x18')][_0x500f('0x19')]===undefined?!![]:![]:!![],'where':_0x345422['options']?_0x345422[_0x500f('0x18')]['where']||null:null,'attributes':_0x345422[_0x500f('0x18')]?_0x345422['options'][_0x500f('0x1a')]||null:null,'limit':_0x345422['options']?_0x345422[_0x500f('0x18')]['limit']||null:null,'include':_0x345422[_0x500f('0x18')]?_0x345422['options'][_0x500f('0x1b')]?_[_0x500f('0x1c')](_0x345422[_0x500f('0x18')][_0x500f('0x1b')],function(_0xc89790){return{'model':db[_0xc89790[_0x500f('0x1d')]],'as':_0xc89790['as'],'attributes':_0xc89790[_0x500f('0x1a')],'include':_0xc89790[_0x500f('0x1b')]?_[_0x500f('0x1c')](_0xc89790[_0x500f('0x1b')],function(_0x446150){return{'model':db[_0x446150[_0x500f('0x1d')]],'as':_0x446150['as'],'attributes':_0x446150[_0x500f('0x1a')],'include':_0x446150[_0x500f('0x1b')]?_[_0x500f('0x1c')](_0x446150[_0x500f('0x1b')],function(_0x2b3bec){return{'model':db[_0x2b3bec[_0x500f('0x1d')]],'as':_0x2b3bec['as'],'attributes':_0x2b3bec[_0x500f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x500f('0x1e')](function(_0x4670a3){logger['info'](_0x500f('0x16'),_0x345422);logger[_0x500f('0xf')](_0x500f('0x16'),_0x345422,JSON['stringify'](_0x4670a3));_0x59253e(_0x4670a3);})[_0x500f('0x15')](function(_0x5e53fe){logger[_0x500f('0x10')](_0x500f('0x16'),_0x5e53fe[_0x500f('0x12')],_0x345422);_0x4a0848(_0x1f197e[_0x500f('0x10')](0x1f4,_0x5e53fe[_0x500f('0x12')]));});});};exports[_0x500f('0x1f')]=function(_0x5fb05b){var _0x22fc2c=this;return new Promise(function(_0x442a11,_0x5a6f7d){return db['CmHopper']['find']({'raw':_0x5fb05b[_0x500f('0x18')]?_0x5fb05b['options']['raw']===undefined?!![]:![]:!![],'where':_0x5fb05b['options']?_0x5fb05b[_0x500f('0x18')][_0x500f('0x20')]||null:null,'attributes':_0x5fb05b[_0x500f('0x18')]?_0x5fb05b[_0x500f('0x18')][_0x500f('0x1a')]||null:null,'include':_0x5fb05b[_0x500f('0x18')]?_0x5fb05b['options']['include']?_[_0x500f('0x1c')](_0x5fb05b[_0x500f('0x18')][_0x500f('0x1b')],function(_0x473f40){return{'model':db[_0x473f40['model']],'as':_0x473f40['as'],'attributes':_0x473f40[_0x500f('0x1a')],'include':_0x473f40[_0x500f('0x1b')]?_['map'](_0x473f40[_0x500f('0x1b')],function(_0x27055d){return{'model':db[_0x27055d[_0x500f('0x1d')]],'as':_0x27055d['as'],'attributes':_0x27055d[_0x500f('0x1a')],'include':_0x27055d[_0x500f('0x1b')]?_[_0x500f('0x1c')](_0x27055d[_0x500f('0x1b')],function(_0x44b3bb){return{'model':db[_0x44b3bb[_0x500f('0x1d')]],'as':_0x44b3bb['as'],'attributes':_0x44b3bb[_0x500f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x500f('0x1e')](function(_0x3d006f){logger[_0x500f('0xd')]('ShowCmHopper',_0x5fb05b);logger[_0x500f('0xf')](_0x500f('0x1f'),_0x5fb05b,JSON[_0x500f('0x21')](_0x3d006f));_0x442a11(_0x3d006f);})[_0x500f('0x15')](function(_0x1d422f){logger[_0x500f('0x10')]('ShowCmHopper',_0x1d422f[_0x500f('0x12')],_0x5fb05b);_0x5a6f7d(_0x22fc2c[_0x500f('0x10')](0x1f4,_0x1d422f[_0x500f('0x12')]));});});};exports[_0x500f('0x22')]=function(_0x478334){var _0x403bef=this;return new Promise(function(_0x1871ea,_0x162e30){return db[_0x500f('0x17')][_0x500f('0x23')](_0x478334['body'],{'raw':_0x478334[_0x500f('0x18')]?_0x478334[_0x500f('0x18')][_0x500f('0x19')]===undefined?!![]:![]:!![]})[_0x500f('0x1e')](function(_0x38b875){logger[_0x500f('0xd')](_0x500f('0x22'),_0x478334);logger[_0x500f('0xf')](_0x500f('0x22'),_0x478334,JSON[_0x500f('0x21')](_0x38b875));_0x1871ea(_0x38b875);})[_0x500f('0x15')](function(_0x3393b8){logger['error']('CreateCmHopper',_0x3393b8[_0x500f('0x12')],_0x478334);_0x162e30(_0x403bef[_0x500f('0x10')](0x1f4,_0x3393b8[_0x500f('0x12')]));});});};exports[_0x500f('0x24')]=function(_0x4b8095){var _0x3c25ab=this;return new Promise(function(_0x2e1815,_0x347fe7){return db[_0x500f('0x17')][_0x500f('0x25')](_0x4b8095[_0x500f('0x26')],{'raw':_0x4b8095['options']?_0x4b8095[_0x500f('0x18')][_0x500f('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b8095[_0x500f('0x18')]?_0x4b8095[_0x500f('0x18')][_0x500f('0x20')]||null:null,'attributes':_0x4b8095[_0x500f('0x18')]?_0x4b8095[_0x500f('0x18')][_0x500f('0x1a')]||null:null,'limit':_0x4b8095['options']?_0x4b8095[_0x500f('0x18')]['limit']||null:null})[_0x500f('0x1e')](function(_0x41e0f9){logger[_0x500f('0xd')](_0x500f('0x24'),_0x4b8095);logger[_0x500f('0xd')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x4b8095['options'][_0x500f('0x20')]),_0x4b8095[_0x500f('0x26')][_0x500f('0x27')]);logger[_0x500f('0xf')](_0x500f('0x24'),_0x4b8095,JSON[_0x500f('0x21')](_0x41e0f9));_0x2e1815(_0x41e0f9);})[_0x500f('0x15')](function(_0x402f1a){logger['error'](_0x500f('0x24'),_0x402f1a[_0x500f('0x12')],_0x4b8095);_0x347fe7(_0x3c25ab[_0x500f('0x10')](0x1f4,_0x402f1a['message']));});});};exports[_0x500f('0x28')]=function(_0x3cae1e){var _0x4a1744=this;return new Promise(function(_0x112412,_0x57bc77){return db[_0x500f('0x17')][_0x500f('0x29')]({'where':_0x3cae1e[_0x500f('0x18')]?_0x3cae1e['options'][_0x500f('0x20')]||null:null})['then'](function(_0x5138c0){logger[_0x500f('0xd')](_0x500f('0x28'),_0x3cae1e);logger[_0x500f('0xf')](_0x500f('0x28'),_0x3cae1e,JSON[_0x500f('0x21')](_0x5138c0));_0x112412(_0x5138c0);})[_0x500f('0x15')](function(_0x42e71d){logger[_0x500f('0x10')]('DestroyCmHopper',_0x42e71d['message'],_0x3cae1e);_0x57bc77(_0x4a1744[_0x500f('0x10')](0x1f4,_0x42e71d[_0x500f('0x12')]));});});};exports['GetContactDialer']=function(_0x506eb6){var _0x4ddb10=this;return new Promise(function(_0x484dc7,_0x9d56db){return db[_0x500f('0x2a')][_0x500f('0x2b')]()[_0x500f('0x1e')](function(_0x4286cd){return db[_0x500f('0x2c')][_0x500f('0x2d')](function(_0x2d1115){return db[_0x500f('0x17')]['findAll']({'where':_0x506eb6[_0x500f('0x18')]?_0x506eb6[_0x500f('0x18')][_0x500f('0x20')]||null:null,'attributes':_0x506eb6[_0x500f('0x18')]?_0x506eb6['options'][_0x500f('0x1a')]||null:null,'limit':_0x506eb6[_0x500f('0x18')]?_0x506eb6[_0x500f('0x18')][_0x500f('0x2e')]||null:null,'order':_0x506eb6[_0x500f('0x18')]?_0x506eb6[_0x500f('0x18')][_0x500f('0x2f')]||null:null,'transaction':_0x2d1115,'lock':_0x2d1115['LOCK']['UPDATE'],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_[_0x500f('0x30')](_0x4286cd)},{'model':db[_0x500f('0x31')],'as':_0x500f('0x32'),'attributes':['id',_0x500f('0x33'),_0x500f('0x34')]}]})[_0x500f('0x1e')](function(_0x103673){var _0x1ee874=[];var _0x17b8a8=[];for(var _0x281b0e=0x0;_0x281b0e<_0x103673[_0x500f('0x35')];_0x281b0e+=0x1){var _0x4232e2=_0x103673[_0x281b0e]['UserId'];if(_0x4232e2===null){_0x1ee874[_0x500f('0x36')](_0x103673[_0x281b0e][_0x500f('0x25')](_0x506eb6[_0x500f('0x26')],{'transaction':_0x2d1115}));}else if(!_0x17b8a8['includes'](_0x4232e2)){_0x17b8a8['push'](_0x4232e2);_0x1ee874['push'](_0x103673[_0x281b0e]['update'](_0x506eb6[_0x500f('0x26')],{'transaction':_0x2d1115}));}}return BPromise[_0x500f('0x37')](_0x1ee874);});})[_0x500f('0x1e')](function(_0x22cd46){logger[_0x500f('0xd')](_0x500f('0x38'),_0x506eb6);if(_0x22cd46['length']>0x0){logger[_0x500f('0xd')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x22cd46[0x0]['dataValues']['id'],_0x22cd46[0x0][_0x500f('0x39')]['ContactId'],_0x22cd46[0x0]['dataValues'][_0x500f('0x27')]);}logger[_0x500f('0xf')]('GetContactDialer',_0x506eb6,JSON['stringify'](_0x22cd46));_0x484dc7(_0x22cd46);})['catch'](function(_0x5dc568){logger[_0x500f('0x10')](_0x500f('0x38'),_0x5dc568[_0x500f('0x12')],_0x506eb6);_0x9d56db(_0x4ddb10['error'](0x1f4,_0x5dc568[_0x500f('0x12')]));});});});};exports[_0x500f('0x3a')]=function(_0x411b3b){var _0x5b3579=this;return new Promise(function(_0x471dfa,_0x3401c4){return db[_0x500f('0x2c')][_0x500f('0x2d')](function(_0x17d043){return db[_0x500f('0x3b')][_0x500f('0x23')](_0x411b3b[_0x500f('0x26')],{'raw':_0x411b3b[_0x500f('0x18')]?_0x411b3b['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x17d043})['then'](function(){logger['info'](_0x500f('0x3c'),JSON[_0x500f('0x21')](_0x411b3b[_0x500f('0x18')][_0x500f('0x20')]),_0x411b3b[_0x500f('0x18')][_0x500f('0x20')][_0x500f('0x27')]);return db['CmHopper'][_0x500f('0x29')]({'where':_0x411b3b[_0x500f('0x18')]?_0x411b3b[_0x500f('0x18')][_0x500f('0x20')]||null:null,'transaction':_0x17d043});});})[_0x500f('0x1e')](function(_0x5ead7b){logger[_0x500f('0xd')](_0x500f('0x3a'),_0x411b3b);logger[_0x500f('0xf')](_0x500f('0x3a'),_0x411b3b,JSON[_0x500f('0x21')](_0x5ead7b));_0x471dfa(_0x5ead7b);})[_0x500f('0x15')](function(_0xf205ec){logger[_0x500f('0x10')](_0x500f('0x3a'),_0xf205ec[_0x500f('0x12')],_0x411b3b);_0x3401c4(_0x5b3579[_0x500f('0x10')](0x1f4,_0xf205ec[_0x500f('0x12')]));});});};exports[_0x500f('0x3d')]=function(_0x2bce71){var _0x4fffa0=this;return new Promise(function(_0x292e27,_0x4edfe2){return db[_0x500f('0x17')][_0x500f('0x3e')]({'raw':_0x2bce71[_0x500f('0x18')]?_0x2bce71[_0x500f('0x18')][_0x500f('0x19')]===undefined?!![]:![]:!![],'where':_0x2bce71['options']?_0x2bce71[_0x500f('0x18')][_0x500f('0x20')]||null:null,'attributes':[[db[_0x500f('0x2c')]['fn'](_0x500f('0x3f'),db[_0x500f('0x2c')]['fn']('IF',db['sequelize'][_0x500f('0x40')]('`scheduledat`\x20>=\x20'+util[_0x500f('0x41')]('\x22%s\x22',moment()[_0x500f('0x41')]('YYYY-MM-DD\x20HH:mm:ss'))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})[_0x500f('0x1e')](function(_0x505070){logger[_0x500f('0xd')](_0x500f('0x3d'),_0x2bce71);logger['debug']('CountReScheduled',_0x2bce71,JSON[_0x500f('0x21')](_0x505070));_0x292e27(_0x505070);})[_0x500f('0x15')](function(_0x124f17){logger[_0x500f('0x10')](_0x500f('0x3d'),_0x124f17[_0x500f('0x12')],_0x2bce71);_0x4edfe2(_0x4fffa0[_0x500f('0x10')](0x1f4,_0x124f17[_0x500f('0x12')]));});});};exports[_0x500f('0x42')]=function(_0x77c6b0){var _0x3e13e4=this;return new Promise(function(_0x120563,_0x39fc2b){return db[_0x500f('0x2a')][_0x500f('0x2b')]()[_0x500f('0x1e')](function(_0xcaacd4){return db['sequelize'][_0x500f('0x2d')](function(_0x48c122){return db['CmHopper'][_0x500f('0x3e')]({'where':_0x77c6b0[_0x500f('0x18')]?_0x77c6b0[_0x500f('0x18')][_0x500f('0x20')]||null:null,'attributes':_0x77c6b0[_0x500f('0x18')]?_0x77c6b0[_0x500f('0x18')][_0x500f('0x1a')]||null:null,'limit':0x1,'order':_0x77c6b0[_0x500f('0x18')]?_0x77c6b0[_0x500f('0x18')]['order']||null:null,'group':db['CmHopper'][_0x500f('0x43')],'transaction':_0x48c122,'lock':_0x48c122[_0x500f('0x44')][_0x500f('0x45')],'include':_0x77c6b0['options']?_0x77c6b0[_0x500f('0x18')][_0x500f('0x1b')]?_[_0x500f('0x1c')](_0x77c6b0[_0x500f('0x18')]['include'],function(_0x54b555){return{'model':db[_0x54b555[_0x500f('0x1d')]],'as':_0x54b555['as'],'attributes':_0x54b555[_0x500f('0x1a')],'include':_0x54b555['include']?_[_0x500f('0x1c')](_0x54b555[_0x500f('0x1b')],function(_0x41fde0){return{'model':db[_0x41fde0['model']],'as':_0x41fde0['as'],'attributes':_0x41fde0[_0x500f('0x1a')],'include':_0x41fde0[_0x500f('0x1b')]?_['map'](_0x41fde0[_0x500f('0x1b')],function(_0xdf29cb){return{'model':db[_0xdf29cb['model']],'as':_0xdf29cb['as'],'attributes':_0xdf29cb[_0x500f('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x552a5b){var _0x28e942=[];for(var _0x21ce14=0x0;_0x21ce14<_0x552a5b['length'];_0x21ce14+=0x1){_0x28e942['push'](_0x552a5b[_0x21ce14][_0x500f('0x25')](_0x77c6b0[_0x500f('0x26')],{'transaction':_0x48c122}));}return BPromise[_0x500f('0x37')](_0x28e942);});})[_0x500f('0x1e')](function(_0xbc36b2){logger[_0x500f('0xd')](_0x500f('0x42'),_0x77c6b0);logger[_0x500f('0xf')](_0x500f('0x42'),_0x77c6b0,JSON[_0x500f('0x21')](_0xbc36b2));_0x120563(_0xbc36b2);})['catch'](function(_0x40b1d2){logger[_0x500f('0x10')]('GetContactRecallMe',_0x40b1d2[_0x500f('0x12')],_0x77c6b0);_0x39fc2b(_0x3e13e4['error'](0x1f4,_0x40b1d2[_0x500f('0x12')]));});});});};exports[_0x500f('0x46')]=function(_0xf52e73){var _0x4a0c57=this;return new Promise(function(_0x5aaaaf,_0x47a5e9){db[_0x500f('0x2a')][_0x500f('0x2b')]()[_0x500f('0x1e')](function(_0x1d3d81){return db[_0x500f('0x17')][_0x500f('0x3e')]({'raw':_0xf52e73[_0x500f('0x18')]?_0xf52e73[_0x500f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xf52e73[_0x500f('0x18')]?_0xf52e73['options']['where']||null:null,'attributes':_0xf52e73[_0x500f('0x18')]?_0xf52e73[_0x500f('0x18')]['attributes']||null:null,'limit':_0xf52e73[_0x500f('0x18')]?_0xf52e73[_0x500f('0x18')][_0x500f('0x2e')]||null:null,'include':_0xf52e73[_0x500f('0x18')]?_0xf52e73[_0x500f('0x18')]['include']?_[_0x500f('0x1c')](_0xf52e73['options'][_0x500f('0x1b')],function(_0x126b18){return{'model':db[_0x126b18[_0x500f('0x1d')]],'as':_0x126b18['as'],'attributes':_0x126b18['as']==='Contact'?_[_0x500f('0x30')](_0x1d3d81):_0x126b18[_0x500f('0x1a')],'include':_0x126b18[_0x500f('0x1b')]?_['map'](_0x126b18['include'],function(_0xc7c4cd){return{'model':db[_0xc7c4cd[_0x500f('0x1d')]],'as':_0xc7c4cd['as'],'attributes':_0xc7c4cd[_0x500f('0x1a')],'include':_0xc7c4cd['include']?_[_0x500f('0x1c')](_0xc7c4cd[_0x500f('0x1b')],function(_0x364f33){return{'model':db[_0x364f33['model']],'as':_0x364f33['as'],'attributes':_0x364f33[_0x500f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x500f('0x1e')](function(_0x4832e4){logger[_0x500f('0xd')](_0x500f('0x16'),_0xf52e73);logger[_0x500f('0xf')]('GetCmHopper',_0xf52e73,JSON[_0x500f('0x21')](_0x4832e4));_0x5aaaaf(_0x4832e4);})[_0x500f('0x15')](function(_0x5f1f61){logger[_0x500f('0x10')](_0x500f('0x16'),_0x5f1f61[_0x500f('0x12')],_0xf52e73);_0x47a5e9(_0x4a0c57[_0x500f('0x10')](0x1f4,_0x5f1f61[_0x500f('0x12')]));});});});};exports[_0x500f('0x47')]=function(_0x3cd0e7){var _0x20c926=this;return new Promise(function(_0x5c67db,_0x3da134){return db[_0x500f('0x2c')][_0x500f('0x2d')](function(_0x1f459b){return db[_0x500f('0x17')]['update']({'active':![]},{'where':{},'transaction':_0x1f459b})[_0x500f('0x1e')](function(_0x154d00){logger[_0x500f('0xd')](_0x500f('0x47'),_0x3cd0e7);logger['debug']('ResetActiveCalls',_0x3cd0e7,JSON['stringify'](_0x154d00));_0x5c67db(_0x154d00);})[_0x500f('0x15')](function(_0x50f2a9){logger[_0x500f('0x10')](_0x500f('0x47'),_0x50f2a9['message'],_0x3cd0e7);_0x3da134(_0x20c926['error'](0x1f4,_0x50f2a9[_0x500f('0x12')]));});});});};exports[_0x500f('0x48')]=function(_0x22e7a6){var _0x1e5461=this;var _0x3042d1=_0x22e7a6[_0x500f('0x26')][_0x500f('0x20')][_0x500f('0x49')];var _0x3c603d=_0x22e7a6[_0x500f('0x26')]['where'][_0x500f('0x4a')];return new Promise(function(_0x1b08dd,_0x23d117){return db[_0x500f('0x17')][_0x500f('0x3e')]({'where':{'voiceQueueId':_0x3042d1,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db['sequelize'][_0x500f('0x40')]('NOW()\x20+\x20INTERVAL\x20'+_0x3c603d+_0x500f('0x4b'))}},'include':[{'model':db[_0x500f('0x2a')],'as':_0x500f('0x4c')},{'model':db[_0x500f('0x31')],'as':'Agent','attributes':['id',_0x500f('0x33'),_0x500f('0x34')]},{'model':db['CmList'],'as':'List'}]})[_0x500f('0x1e')](function(_0x31dccd){return db[_0x500f('0x2c')][_0x500f('0x2d')](function(_0x5a2b56){return db['CmHopper']['update']({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x3042d1,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x500f('0x2c')][_0x500f('0x40')]('NOW()\x20+\x20INTERVAL\x20'+_0x3c603d+_0x500f('0x4b'))}},'transaction':_0x5a2b56})[_0x500f('0x1e')](function(_0x3aee13){_0x1b08dd(_0x31dccd);})[_0x500f('0x15')](function(_0x2cf05e){logger[_0x500f('0x10')](_0x500f('0x48'),_0x2cf05e[_0x500f('0x12')],_0x22e7a6);_0x23d117(validateExpressRequest);});});})['catch'](function(_0x46aa3d){logger[_0x500f('0x10')](_0x500f('0x48'),_0x46aa3d[_0x500f('0x12')],_0x22e7a6);_0x23d117(_0x1e5461[_0x500f('0x10')](0x1f4,_0x46aa3d[_0x500f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 9034910..0f91075 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 _0xcfda=['getOpenContacts','/:id','isAuthenticated','show','post','create','/preview','getPreview','/previewrecall','put','update','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','index','get','/describe','describe','/opencontacts'];(function(_0x43d637,_0x222c15){var _0x2c429b=function(_0x242453){while(--_0x242453){_0x43d637['push'](_0x43d637['shift']());}};_0x2c429b(++_0x222c15);}(_0xcfda,0xca));var _0xacfd=function(_0x5c5233,_0x241813){_0x5c5233=_0x5c5233-0x0;var _0x3b9cbd=_0xcfda[_0x5c5233];return _0x3b9cbd;};'use strict';var multer=require(_0xacfd('0x0'));var util=require(_0xacfd('0x1'));var path=require('path');var timeout=require(_0xacfd('0x2'));var express=require('express');var router=express[_0xacfd('0x3')]();var fs_extra=require(_0xacfd('0x4'));var auth=require(_0xacfd('0x5'));var interaction=require(_0xacfd('0x6'));var config=require(_0xacfd('0x7'));var controller=require(_0xacfd('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xacfd('0x9')]);router[_0xacfd('0xa')](_0xacfd('0xb'),auth['isAuthenticated'](),controller[_0xacfd('0xc')]);router['get'](_0xacfd('0xd'),auth['isAuthenticated'](),controller[_0xacfd('0xe')]);router[_0xacfd('0xa')](_0xacfd('0xf'),auth[_0xacfd('0x10')](),controller[_0xacfd('0x11')]);router[_0xacfd('0x12')]('/',auth['isAuthenticated'](),controller[_0xacfd('0x13')]);router[_0xacfd('0x12')](_0xacfd('0x14'),auth[_0xacfd('0x10')](),controller[_0xacfd('0x15')]);router[_0xacfd('0x12')](_0xacfd('0x16'),auth[_0xacfd('0x10')](),controller['getPreviewRecall']);router[_0xacfd('0x17')](_0xacfd('0xf'),auth[_0xacfd('0x10')](),controller[_0xacfd('0x18')]);router[_0xacfd('0x19')](_0xacfd('0xf'),auth[_0xacfd('0x10')](),controller[_0xacfd('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x8c5c=['post','create','/preview','getPreview','getPreviewRecall','put','/:id','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','/opencontacts'];(function(_0x19dbfa,_0x2338d7){var _0x4a74bc=function(_0x30f64d){while(--_0x30f64d){_0x19dbfa['push'](_0x19dbfa['shift']());}};_0x4a74bc(++_0x2338d7);}(_0x8c5c,0xa5));var _0xc8c5=function(_0x7271aa,_0x560cff){_0x7271aa=_0x7271aa-0x0;var _0x4db1f6=_0x8c5c[_0x7271aa];return _0x4db1f6;};'use strict';var multer=require(_0xc8c5('0x0'));var util=require(_0xc8c5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc8c5('0x2'));var router=express[_0xc8c5('0x3')]();var fs_extra=require(_0xc8c5('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc8c5('0x5'));var controller=require('./cmHopper.controller');router[_0xc8c5('0x6')]('/',auth[_0xc8c5('0x7')](),controller[_0xc8c5('0x8')]);router['get'](_0xc8c5('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xc8c5('0xa'),auth[_0xc8c5('0x7')](),controller['getOpenContacts']);router[_0xc8c5('0x6')]('/:id',auth[_0xc8c5('0x7')](),controller['show']);router[_0xc8c5('0xb')]('/',auth['isAuthenticated'](),controller[_0xc8c5('0xc')]);router[_0xc8c5('0xb')](_0xc8c5('0xd'),auth[_0xc8c5('0x7')](),controller[_0xc8c5('0xe')]);router[_0xc8c5('0xb')]('/previewrecall',auth[_0xc8c5('0x7')](),controller[_0xc8c5('0xf')]);router[_0xc8c5('0x10')](_0xc8c5('0x11'),auth[_0xc8c5('0x7')](),controller[_0xc8c5('0x12')]);router[_0xc8c5('0x13')]('/:id',auth[_0xc8c5('0x7')](),controller[_0xc8c5('0x14')]);module[_0xc8c5('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 0db264f..0a431e9 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 _0x5ff9=['moment','sequelize','STRING','INTEGER','contactListQueue'];(function(_0x2fec51,_0x480819){var _0x4d2f6f=function(_0xd3f55f){while(--_0xd3f55f){_0x2fec51['push'](_0x2fec51['shift']());}};_0x4d2f6f(++_0x480819);}(_0x5ff9,0xa0));var _0x95ff=function(_0x14e60d,_0x1da9b4){_0x14e60d=_0x14e60d-0x0;var _0x2d93fb=_0x5ff9[_0x14e60d];return _0x2d93fb;};'use strict';var moment=require(_0x95ff('0x0'));var Sequelize=require(_0x95ff('0x1'));module['exports']={'phone':{'type':Sequelize[_0x95ff('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x95ff('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x95ff('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x8daf=['INTEGER','contactListQueue'];(function(_0x45317a,_0x330225){var _0x47d7a8=function(_0x161e0d){while(--_0x161e0d){_0x45317a['push'](_0x45317a['shift']());}};_0x47d7a8(++_0x330225);}(_0x8daf,0x15c));var _0xf8da=function(_0x493030,_0x29ec7e){_0x493030=_0x493030-0x0;var _0x56f5e4=_0x8daf[_0x493030];return _0x56f5e4;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xf8da('0x0')],'unique':_0xf8da('0x1')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xf8da('0x1')},'VoiceQueueId':{'type':Sequelize[_0xf8da('0x0')],'unique':_0xf8da('0x1')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 98f1015..033e6f3 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 _0x3525=['crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','then','rows','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel'];(function(_0x20fe26,_0x4ef59b){var _0x564da2=function(_0x248a3e){while(--_0x248a3e){_0x20fe26['push'](_0x20fe26['shift']());}};_0x564da2(++_0x4ef59b);}(_0x3525,0x16a));var _0x5352=function(_0x5ed8d3,_0x3f149c){_0x5ed8d3=_0x5ed8d3-0x0;var _0x4ae472=_0x3525[_0x5ed8d3];return _0x4ae472;};'use strict';var emlformat=require(_0x5352('0x0'));var rimraf=require(_0x5352('0x1'));var zipdir=require(_0x5352('0x2'));var jsonpatch=require(_0x5352('0x3'));var rp=require(_0x5352('0x4'));var moment=require(_0x5352('0x5'));var BPromise=require(_0x5352('0x6'));var Mustache=require(_0x5352('0x7'));var util=require(_0x5352('0x8'));var path=require('path');var sox=require(_0x5352('0x9'));var csv=require(_0x5352('0xa'));var ejs=require(_0x5352('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5352('0xc'));var crypto=require(_0x5352('0xd'));var jsforce=require(_0x5352('0xe'));var deskjs=require(_0x5352('0xf'));var toCsv=require(_0x5352('0xa'));var querystring=require('querystring');var Papa=require(_0x5352('0x10'));var Redis=require(_0x5352('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5352('0x12'));var as=require(_0x5352('0x13'));var hardwareService=require(_0x5352('0x14'));var logger=require(_0x5352('0x15'))(_0x5352('0x16'));var utils=require(_0x5352('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45f0e5,_0x3ccde3){_0x3ccde3=_0x3ccde3||0xcc;return function(_0x11d2c4){if(_0x11d2c4){return _0x45f0e5[_0x5352('0x18')](_0x3ccde3);}return _0x45f0e5[_0x5352('0x19')](_0x3ccde3)[_0x5352('0x1a')]();};}function respondWithResult(_0x213cd1,_0x471186){_0x471186=_0x471186||0xc8;return function(_0x1894dd){if(_0x1894dd){return _0x213cd1['status'](_0x471186)['json'](_0x1894dd);}};}function respondWithFilteredResult(_0x246eb3,_0x5c5be4){return function(_0x343491){if(_0x343491){var _0x27e58f=typeof _0x5c5be4[_0x5352('0x1b')]===_0x5352('0x1c')&&typeof _0x5c5be4[_0x5352('0x1d')]===_0x5352('0x1c');var _0xb5a7a5=_0x343491[_0x5352('0x1e')];var _0x2c076c=_0x27e58f?0x0:_0x5c5be4[_0x5352('0x1b')];var _0x28a8a1=_0x27e58f?_0x343491['count']:_0x5c5be4[_0x5352('0x1b')]+_0x5c5be4['limit'];var _0x39a8f6;if(_0x28a8a1>=_0xb5a7a5){_0x28a8a1=_0xb5a7a5;_0x39a8f6=0xc8;}else{_0x39a8f6=0xce;}_0x246eb3[_0x5352('0x19')](_0x39a8f6);return _0x246eb3[_0x5352('0x1f')](_0x5352('0x20'),_0x2c076c+'-'+_0x28a8a1+'/'+_0xb5a7a5)[_0x5352('0x21')](_0x343491);}return null;};}function patchUpdates(_0x509bf9){return function(_0x57979f){try{jsonpatch[_0x5352('0x22')](_0x57979f,_0x509bf9,!![]);}catch(_0xcc24b6){return BPromise[_0x5352('0x23')](_0xcc24b6);}return _0x57979f[_0x5352('0x24')]();};}function saveUpdates(_0x7a6298,_0x5f1f9d){return function(_0x48fa99){if(_0x48fa99){return _0x48fa99[_0x5352('0x25')](_0x7a6298)['then'](function(_0xda1b27){return _0xda1b27;});}return null;};}function removeEntity(_0x47c896,_0x5e4bdc){return function(_0x5cdd64){if(_0x5cdd64){return _0x5cdd64[_0x5352('0x26')]()['then'](function(){_0x47c896[_0x5352('0x19')](0xcc)[_0x5352('0x1a')]();});}};}function handleEntityNotFound(_0x59da7c,_0x304b17){return function(_0x129bdf){if(!_0x129bdf){_0x59da7c['sendStatus'](0x194);}return _0x129bdf;};}function handleError(_0x532da7,_0x55a5f7){_0x55a5f7=_0x55a5f7||0x1f4;return function(_0x36d758){logger['error'](_0x36d758[_0x5352('0x27')]);if(_0x36d758[_0x5352('0x28')]){delete _0x36d758[_0x5352('0x28')];}_0x532da7[_0x5352('0x19')](_0x55a5f7)[_0x5352('0x29')](_0x36d758);};}exports[_0x5352('0x2a')]=function(_0x31cbb5,_0x29714c){var _0x4189cb={},_0x1f16db={},_0x5d8bb6={'count':0x0,'rows':[]};var _0x2be40e=_[_0x5352('0x2b')](db[_0x5352('0x2c')][_0x5352('0x2d')],function(_0x21ee2d){return{'name':_0x21ee2d[_0x5352('0x2e')],'type':_0x21ee2d[_0x5352('0x2f')][_0x5352('0x30')]};});_0x1f16db[_0x5352('0x31')]=_['map'](_0x2be40e,_0x5352('0x28'));_0x1f16db[_0x5352('0x32')]=_[_0x5352('0x33')](_0x31cbb5[_0x5352('0x32')]);_0x1f16db['filters']=_['intersection'](_0x1f16db[_0x5352('0x31')],_0x1f16db[_0x5352('0x32')]);_0x4189cb[_0x5352('0x34')]=_[_0x5352('0x35')](_0x1f16db[_0x5352('0x31')],qs[_0x5352('0x36')](_0x31cbb5[_0x5352('0x32')]['fields']));_0x4189cb[_0x5352('0x34')]=_0x4189cb['attributes']['length']?_0x4189cb[_0x5352('0x34')]:_0x1f16db[_0x5352('0x31')];if(!_0x31cbb5[_0x5352('0x32')][_0x5352('0x37')](_0x5352('0x38'))){_0x4189cb[_0x5352('0x1d')]=qs['limit'](_0x31cbb5[_0x5352('0x32')][_0x5352('0x1d')]);_0x4189cb[_0x5352('0x1b')]=qs['offset'](_0x31cbb5['query'][_0x5352('0x1b')]);}_0x4189cb[_0x5352('0x39')]=qs[_0x5352('0x3a')](_0x31cbb5[_0x5352('0x32')]['sort']);_0x4189cb[_0x5352('0x3b')]=qs[_0x5352('0x3c')](_['pick'](_0x31cbb5[_0x5352('0x32')],_0x1f16db[_0x5352('0x3c')]),_0x2be40e);if(_0x31cbb5[_0x5352('0x32')]['filter']){_0x4189cb[_0x5352('0x3b')]=_['merge'](_0x4189cb[_0x5352('0x3b')],{'$or':_[_0x5352('0x2b')](_0x2be40e,function(_0x12cb5e){if(_0x12cb5e[_0x5352('0x2f')]!=='VIRTUAL'){var _0x4d1856={};_0x4d1856[_0x12cb5e['name']]={'$like':'%'+_0x31cbb5[_0x5352('0x32')][_0x5352('0x3d')]+'%'};return _0x4d1856;}})});}_0x4189cb=_[_0x5352('0x3e')]({},_0x4189cb,_0x31cbb5[_0x5352('0x3f')]);var _0x361714={'where':_0x4189cb[_0x5352('0x3b')]};return db[_0x5352('0x2c')][_0x5352('0x1e')](_0x361714)['then'](function(_0x3b6266){_0x5d8bb6[_0x5352('0x1e')]=_0x3b6266;if(_0x31cbb5[_0x5352('0x32')][_0x5352('0x40')]){_0x4189cb[_0x5352('0x41')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x5352('0x42')](_0x4189cb);})[_0x5352('0x43')](function(_0x48bcc2){_0x5d8bb6[_0x5352('0x44')]=_0x48bcc2;return _0x5d8bb6;})[_0x5352('0x43')](respondWithFilteredResult(_0x29714c,_0x4189cb))[_0x5352('0x45')](handleError(_0x29714c,null));};exports[_0x5352('0x46')]=function(_0x29bab4,_0x37c2a4){var _0x5e5c68={'raw':!![],'where':{'id':_0x29bab4[_0x5352('0x47')]['id']}},_0x6e7bd5={};_0x6e7bd5[_0x5352('0x31')]=_[_0x5352('0x33')](db[_0x5352('0x2c')][_0x5352('0x2d')]);_0x6e7bd5['query']=_['keys'](_0x29bab4['query']);_0x6e7bd5[_0x5352('0x3c')]=_['intersection'](_0x6e7bd5[_0x5352('0x31')],_0x6e7bd5['query']);_0x5e5c68[_0x5352('0x34')]=_[_0x5352('0x35')](_0x6e7bd5[_0x5352('0x31')],qs[_0x5352('0x36')](_0x29bab4[_0x5352('0x32')]['fields']));_0x5e5c68[_0x5352('0x34')]=_0x5e5c68[_0x5352('0x34')]['length']?_0x5e5c68[_0x5352('0x34')]:_0x6e7bd5[_0x5352('0x31')];if(_0x29bab4[_0x5352('0x32')][_0x5352('0x40')]){_0x5e5c68['include']=[{'all':!![]}];}_0x5e5c68=_['merge']({},_0x5e5c68,_0x29bab4['options']);return db[_0x5352('0x2c')][_0x5352('0x48')](_0x5e5c68)[_0x5352('0x43')](handleEntityNotFound(_0x37c2a4,null))[_0x5352('0x43')](respondWithResult(_0x37c2a4,null))['catch'](handleError(_0x37c2a4,null));};exports[_0x5352('0x25')]=function(_0x35ef4d,_0x47b5cb){if(_0x35ef4d[_0x5352('0x49')]['id']){delete _0x35ef4d[_0x5352('0x49')]['id'];}return db['CmHopperBlack'][_0x5352('0x48')]({'where':{'id':_0x35ef4d[_0x5352('0x47')]['id']}})[_0x5352('0x43')](handleEntityNotFound(_0x47b5cb,null))[_0x5352('0x43')](saveUpdates(_0x35ef4d[_0x5352('0x49')],null))[_0x5352('0x43')](respondWithResult(_0x47b5cb,null))[_0x5352('0x45')](handleError(_0x47b5cb,null));};exports[_0x5352('0x26')]=function(_0x38274a,_0x1d6b6a){return db[_0x5352('0x2c')]['find']({'where':{'id':_0x38274a[_0x5352('0x47')]['id']}})[_0x5352('0x43')](handleEntityNotFound(_0x1d6b6a,null))['then'](removeEntity(_0x1d6b6a,null))['catch'](handleError(_0x1d6b6a,null));};exports[_0x5352('0x4a')]=function(_0x915810,_0xe3d9f3){return db['CmHopperBlack'][_0x5352('0x4a')]()[_0x5352('0x43')](respondWithResult(_0xe3d9f3,null))[_0x5352('0x45')](handleError(_0xe3d9f3,null));}; \ No newline at end of file +var _0x737d=['catch','show','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','map','CmHopperBlack','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','rows'];(function(_0x114b7c,_0xc4b93b){var _0x47185f=function(_0x5b4cfa){while(--_0x5b4cfa){_0x114b7c['push'](_0x114b7c['shift']());}};_0x47185f(++_0xc4b93b);}(_0x737d,0x17d));var _0xd737=function(_0xbc5cb5,_0x2c4de5){_0xbc5cb5=_0xbc5cb5-0x0;var _0x5d1194=_0x737d[_0xbc5cb5];return _0x5d1194;};'use strict';var emlformat=require(_0xd737('0x0'));var rimraf=require(_0xd737('0x1'));var zipdir=require(_0xd737('0x2'));var jsonpatch=require(_0xd737('0x3'));var rp=require(_0xd737('0x4'));var moment=require(_0xd737('0x5'));var BPromise=require(_0xd737('0x6'));var Mustache=require(_0xd737('0x7'));var util=require(_0xd737('0x8'));var path=require(_0xd737('0x9'));var sox=require(_0xd737('0xa'));var csv=require(_0xd737('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd737('0xc'));var _=require(_0xd737('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd737('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd737('0xb'));var querystring=require(_0xd737('0xf'));var Papa=require(_0xd737('0x10'));var Redis=require(_0xd737('0x11'));var authService=require(_0xd737('0x12'));var qs=require(_0xd737('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd737('0x14'));var utils=require(_0xd737('0x15'));var config=require(_0xd737('0x16'));var licenseUtil=require(_0xd737('0x17'));var db=require(_0xd737('0x18'))['db'];function respondWithStatusCode(_0x435d38,_0x33f77a){_0x33f77a=_0x33f77a||0xcc;return function(_0x10e533){if(_0x10e533){return _0x435d38['sendStatus'](_0x33f77a);}return _0x435d38[_0xd737('0x19')](_0x33f77a)[_0xd737('0x1a')]();};}function respondWithResult(_0x14db8d,_0x36f7f6){_0x36f7f6=_0x36f7f6||0xc8;return function(_0x37a388){if(_0x37a388){return _0x14db8d[_0xd737('0x19')](_0x36f7f6)[_0xd737('0x1b')](_0x37a388);}};}function respondWithFilteredResult(_0x75807f,_0x43fb78){return function(_0x5465bf){if(_0x5465bf){var _0x48c232=typeof _0x43fb78[_0xd737('0x1c')]==='undefined'&&typeof _0x43fb78[_0xd737('0x1d')]===_0xd737('0x1e');var _0x4a6d1e=_0x5465bf[_0xd737('0x1f')];var _0x3c9847=_0x48c232?0x0:_0x43fb78[_0xd737('0x1c')];var _0x285839=_0x48c232?_0x5465bf['count']:_0x43fb78[_0xd737('0x1c')]+_0x43fb78[_0xd737('0x1d')];var _0x27d5bd;if(_0x285839>=_0x4a6d1e){_0x285839=_0x4a6d1e;_0x27d5bd=0xc8;}else{_0x27d5bd=0xce;}_0x75807f['status'](_0x27d5bd);return _0x75807f[_0xd737('0x20')](_0xd737('0x21'),_0x3c9847+'-'+_0x285839+'/'+_0x4a6d1e)[_0xd737('0x1b')](_0x5465bf);}return null;};}function patchUpdates(_0x3e2d5f){return function(_0x294614){try{jsonpatch[_0xd737('0x22')](_0x294614,_0x3e2d5f,!![]);}catch(_0x38aa3e){return BPromise[_0xd737('0x23')](_0x38aa3e);}return _0x294614[_0xd737('0x24')]();};}function saveUpdates(_0x5331df,_0x1135a5){return function(_0x24fc9c){if(_0x24fc9c){return _0x24fc9c[_0xd737('0x25')](_0x5331df)[_0xd737('0x26')](function(_0xbf2b25){return _0xbf2b25;});}return null;};}function removeEntity(_0x6e37ee,_0x4d4be6){return function(_0x149d42){if(_0x149d42){return _0x149d42[_0xd737('0x27')]()[_0xd737('0x26')](function(){_0x6e37ee[_0xd737('0x19')](0xcc)[_0xd737('0x1a')]();});}};}function handleEntityNotFound(_0x6d0e3f,_0x755315){return function(_0xc31b8a){if(!_0xc31b8a){_0x6d0e3f[_0xd737('0x28')](0x194);}return _0xc31b8a;};}function handleError(_0x2a61e0,_0x51b095){_0x51b095=_0x51b095||0x1f4;return function(_0x2dfe2b){logger[_0xd737('0x29')](_0x2dfe2b[_0xd737('0x2a')]);if(_0x2dfe2b['name']){delete _0x2dfe2b[_0xd737('0x2b')];}_0x2a61e0[_0xd737('0x19')](_0x51b095)['send'](_0x2dfe2b);};}exports['index']=function(_0x1f8dfd,_0x560a28){var _0x36518f={},_0x24bb58={},_0x265f4a={'count':0x0,'rows':[]};var _0x55ba14=_[_0xd737('0x2c')](db[_0xd737('0x2d')][_0xd737('0x2e')],function(_0x42904a){return{'name':_0x42904a[_0xd737('0x2f')],'type':_0x42904a['type'][_0xd737('0x30')]};});_0x24bb58[_0xd737('0x31')]=_['map'](_0x55ba14,_0xd737('0x2b'));_0x24bb58['query']=_[_0xd737('0x32')](_0x1f8dfd['query']);_0x24bb58[_0xd737('0x33')]=_[_0xd737('0x34')](_0x24bb58[_0xd737('0x31')],_0x24bb58[_0xd737('0x35')]);_0x36518f[_0xd737('0x36')]=_[_0xd737('0x34')](_0x24bb58[_0xd737('0x31')],qs[_0xd737('0x37')](_0x1f8dfd[_0xd737('0x35')][_0xd737('0x37')]));_0x36518f['attributes']=_0x36518f[_0xd737('0x36')][_0xd737('0x38')]?_0x36518f['attributes']:_0x24bb58['model'];if(!_0x1f8dfd['query'][_0xd737('0x39')](_0xd737('0x3a'))){_0x36518f[_0xd737('0x1d')]=qs['limit'](_0x1f8dfd[_0xd737('0x35')][_0xd737('0x1d')]);_0x36518f[_0xd737('0x1c')]=qs[_0xd737('0x1c')](_0x1f8dfd[_0xd737('0x35')][_0xd737('0x1c')]);}_0x36518f['order']=qs[_0xd737('0x3b')](_0x1f8dfd['query'][_0xd737('0x3b')]);_0x36518f[_0xd737('0x3c')]=qs['filters'](_[_0xd737('0x3d')](_0x1f8dfd[_0xd737('0x35')],_0x24bb58[_0xd737('0x33')]),_0x55ba14);if(_0x1f8dfd[_0xd737('0x35')][_0xd737('0x3e')]){_0x36518f[_0xd737('0x3c')]=_[_0xd737('0x3f')](_0x36518f[_0xd737('0x3c')],{'$or':_[_0xd737('0x2c')](_0x55ba14,function(_0x329de2){if(_0x329de2[_0xd737('0x40')]!==_0xd737('0x41')){var _0x268887={};_0x268887[_0x329de2['name']]={'$like':'%'+_0x1f8dfd[_0xd737('0x35')]['filter']+'%'};return _0x268887;}})});}_0x36518f=_['merge']({},_0x36518f,_0x1f8dfd[_0xd737('0x42')]);var _0x272f2a={'where':_0x36518f[_0xd737('0x3c')]};return db['CmHopperBlack']['count'](_0x272f2a)[_0xd737('0x26')](function(_0xf61381){_0x265f4a[_0xd737('0x1f')]=_0xf61381;if(_0x1f8dfd['query']['includeAll']){_0x36518f[_0xd737('0x43')]=[{'all':!![]}];}return db[_0xd737('0x2d')]['findAll'](_0x36518f);})[_0xd737('0x26')](function(_0x404d63){_0x265f4a[_0xd737('0x44')]=_0x404d63;return _0x265f4a;})[_0xd737('0x26')](respondWithFilteredResult(_0x560a28,_0x36518f))[_0xd737('0x45')](handleError(_0x560a28,null));};exports[_0xd737('0x46')]=function(_0x358b36,_0x51207c){var _0x172b21={'raw':!![],'where':{'id':_0x358b36['params']['id']}},_0x55a7b2={};_0x55a7b2['model']=_[_0xd737('0x32')](db[_0xd737('0x2d')][_0xd737('0x2e')]);_0x55a7b2['query']=_[_0xd737('0x32')](_0x358b36['query']);_0x55a7b2['filters']=_[_0xd737('0x34')](_0x55a7b2[_0xd737('0x31')],_0x55a7b2[_0xd737('0x35')]);_0x172b21[_0xd737('0x36')]=_[_0xd737('0x34')](_0x55a7b2['model'],qs['fields'](_0x358b36[_0xd737('0x35')][_0xd737('0x37')]));_0x172b21[_0xd737('0x36')]=_0x172b21[_0xd737('0x36')][_0xd737('0x38')]?_0x172b21[_0xd737('0x36')]:_0x55a7b2[_0xd737('0x31')];if(_0x358b36[_0xd737('0x35')]['includeAll']){_0x172b21[_0xd737('0x43')]=[{'all':!![]}];}_0x172b21=_[_0xd737('0x3f')]({},_0x172b21,_0x358b36[_0xd737('0x42')]);return db[_0xd737('0x2d')][_0xd737('0x47')](_0x172b21)[_0xd737('0x26')](handleEntityNotFound(_0x51207c,null))[_0xd737('0x26')](respondWithResult(_0x51207c,null))[_0xd737('0x45')](handleError(_0x51207c,null));};exports[_0xd737('0x25')]=function(_0x4108ca,_0x575b1f){if(_0x4108ca[_0xd737('0x48')]['id']){delete _0x4108ca[_0xd737('0x48')]['id'];}return db[_0xd737('0x2d')][_0xd737('0x47')]({'where':{'id':_0x4108ca[_0xd737('0x49')]['id']}})['then'](handleEntityNotFound(_0x575b1f,null))[_0xd737('0x26')](saveUpdates(_0x4108ca[_0xd737('0x48')],null))['then'](respondWithResult(_0x575b1f,null))[_0xd737('0x45')](handleError(_0x575b1f,null));};exports['destroy']=function(_0x2c7665,_0x42b6e8){return db['CmHopperBlack']['find']({'where':{'id':_0x2c7665[_0xd737('0x49')]['id']}})[_0xd737('0x26')](handleEntityNotFound(_0x42b6e8,null))['then'](removeEntity(_0x42b6e8,null))['catch'](handleError(_0x42b6e8,null));};exports[_0xd737('0x4a')]=function(_0xd9c2ae,_0x419821){return db['CmHopperBlack'][_0xd737('0x4a')]()[_0xd737('0x26')](respondWithResult(_0x419821,null))['catch'](handleError(_0x419821,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index b49733d..b5ac39a 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 _0x596b=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','define','CmHopperBlack','cm_hopper_black','util'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x596b,0x151));var _0xb596=function(_0x36a94d,_0x2f8299){_0x36a94d=_0x36a94d-0x0;var _0x1aa6ec=_0x596b[_0x36a94d];return _0x1aa6ec;};'use strict';var _=require('lodash');var util=require(_0xb596('0x0'));var logger=require(_0xb596('0x1'))(_0xb596('0x2'));var moment=require(_0xb596('0x3'));var BPromise=require(_0xb596('0x4'));var rp=require(_0xb596('0x5'));var fs=require('fs');var path=require(_0xb596('0x6'));var rimraf=require(_0xb596('0x7'));var config=require(_0xb596('0x8'));var attributes=require(_0xb596('0x9'));module['exports']=function(_0x535005,_0x5e19d6){return _0x535005[_0xb596('0xa')](_0xb596('0xb'),attributes,{'tableName':_0xb596('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8777=['./cmHopperBlack.attributes','exports','CmHopperBlack','cm_hopper_black','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x20da0b,_0x226054){var _0x1fb6a0=function(_0x31866e){while(--_0x31866e){_0x20da0b['push'](_0x20da0b['shift']());}};_0x1fb6a0(++_0x226054);}(_0x8777,0xd5));var _0x7877=function(_0x15b94c,_0x18e669){_0x15b94c=_0x15b94c-0x0;var _0x92212d=_0x8777[_0x15b94c];return _0x92212d;};'use strict';var _=require('lodash');var util=require(_0x7877('0x0'));var logger=require(_0x7877('0x1'))(_0x7877('0x2'));var moment=require(_0x7877('0x3'));var BPromise=require(_0x7877('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7877('0x5'));var rimraf=require(_0x7877('0x6'));var config=require('../../config/environment');var attributes=require(_0x7877('0x7'));module[_0x7877('0x8')]=function(_0x430a15,_0xe03214){return _0x430a15['define'](_0x7877('0x9'),attributes,{'tableName':_0x7877('0xa'),'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 87120f3..b970705 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 _0x7dda=['attributes','limit','include','map','model','debug','UpdateCmHopperBlack','body','destroy','DestroyCmHopperBlack','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','message','CmHopperBlack,\x20%s,\x20%s','result','catch','GetCmHopperBlack','CmHopperBlack','options','raw','where'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7dda,0x114));var _0xa7dd=function(_0x32b0af,_0x3a32b3){_0x32b0af=_0x32b0af-0x0;var _0x42e83e=_0x7dda[_0x32b0af];return _0x42e83e;};'use strict';var _=require('lodash');var util=require(_0xa7dd('0x0'));var moment=require(_0xa7dd('0x1'));var BPromise=require(_0xa7dd('0x2'));var rs=require(_0xa7dd('0x3'));var fs=require('fs');var Redis=require(_0xa7dd('0x4'));var db=require(_0xa7dd('0x5'))['db'];var utils=require(_0xa7dd('0x6'));var logger=require('../../config/logger')(_0xa7dd('0x7'));var config=require(_0xa7dd('0x8'));var jayson=require(_0xa7dd('0x9'));var client=jayson[_0xa7dd('0xa')][_0xa7dd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x458121,_0x2581b8,_0xc419b){return new BPromise(function(_0x31903e,_0x3e9f24){return client[_0xa7dd('0xc')](_0x458121,_0xc419b)[_0xa7dd('0xd')](function(_0x4c7444){logger[_0xa7dd('0xe')]('CmHopperBlack,\x20%s,\x20%s',_0x2581b8,'request\x20sent');logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x2581b8,_0xa7dd('0xf'),JSON[_0xa7dd('0x10')](_0x4c7444));if(_0x4c7444[_0xa7dd('0x11')]){if(_0x4c7444['error'][_0xa7dd('0x12')]===0x1f4){logger[_0xa7dd('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x2581b8,_0x4c7444[_0xa7dd('0x11')][_0xa7dd('0x13')]);return _0x3e9f24(_0x4c7444[_0xa7dd('0x11')][_0xa7dd('0x13')]);}logger[_0xa7dd('0x11')](_0xa7dd('0x14'),_0x2581b8,_0x4c7444[_0xa7dd('0x11')][_0xa7dd('0x13')]);return _0x31903e(_0x4c7444[_0xa7dd('0x11')][_0xa7dd('0x13')]);}else{logger['info'](_0xa7dd('0x14'),_0x2581b8,_0xa7dd('0xf'));_0x31903e(_0x4c7444[_0xa7dd('0x15')][_0xa7dd('0x13')]);}})[_0xa7dd('0x16')](function(_0x28e957){logger[_0xa7dd('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x2581b8,_0x28e957);_0x3e9f24(_0x28e957);});});}exports[_0xa7dd('0x17')]=function(_0x1650b2){var _0x53c627=this;return new Promise(function(_0xeb71a2,_0x5adbc1){return db[_0xa7dd('0x18')]['findAll']({'raw':_0x1650b2[_0xa7dd('0x19')]?_0x1650b2['options'][_0xa7dd('0x1a')]===undefined?!![]:![]:!![],'where':_0x1650b2[_0xa7dd('0x19')]?_0x1650b2[_0xa7dd('0x19')][_0xa7dd('0x1b')]||null:null,'attributes':_0x1650b2[_0xa7dd('0x19')]?_0x1650b2[_0xa7dd('0x19')][_0xa7dd('0x1c')]||null:null,'limit':_0x1650b2[_0xa7dd('0x19')]?_0x1650b2[_0xa7dd('0x19')][_0xa7dd('0x1d')]||null:null,'include':_0x1650b2[_0xa7dd('0x19')]?_0x1650b2[_0xa7dd('0x19')][_0xa7dd('0x1e')]?_['map'](_0x1650b2[_0xa7dd('0x19')][_0xa7dd('0x1e')],function(_0x56489b){return{'model':db[_0x56489b['model']],'as':_0x56489b['as'],'attributes':_0x56489b['attributes'],'include':_0x56489b[_0xa7dd('0x1e')]?_[_0xa7dd('0x1f')](_0x56489b['include'],function(_0x35a081){return{'model':db[_0x35a081[_0xa7dd('0x20')]],'as':_0x35a081['as'],'attributes':_0x35a081['attributes'],'include':_0x35a081['include']?_[_0xa7dd('0x1f')](_0x35a081[_0xa7dd('0x1e')],function(_0x3bca5a){return{'model':db[_0x3bca5a[_0xa7dd('0x20')]],'as':_0x3bca5a['as'],'attributes':_0x3bca5a[_0xa7dd('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa7dd('0xd')](function(_0x38cd36){logger['info'](_0xa7dd('0x17'),_0x1650b2);logger[_0xa7dd('0x21')]('GetCmHopperBlack',_0x1650b2,JSON['stringify'](_0x38cd36));_0xeb71a2(_0x38cd36);})[_0xa7dd('0x16')](function(_0x39742c){logger[_0xa7dd('0x11')](_0xa7dd('0x17'),_0x39742c[_0xa7dd('0x13')],_0x1650b2);_0x5adbc1(_0x53c627[_0xa7dd('0x11')](0x1f4,_0x39742c[_0xa7dd('0x13')]));});});};exports[_0xa7dd('0x22')]=function(_0x4a0ef2){var _0x54cd5e=this;return new Promise(function(_0x597a74,_0x2ca660){return db[_0xa7dd('0x18')]['update'](_0x4a0ef2[_0xa7dd('0x23')],{'raw':_0x4a0ef2[_0xa7dd('0x19')]?_0x4a0ef2['options'][_0xa7dd('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a0ef2['options']?_0x4a0ef2[_0xa7dd('0x19')][_0xa7dd('0x1b')]||null:null,'attributes':_0x4a0ef2[_0xa7dd('0x19')]?_0x4a0ef2[_0xa7dd('0x19')][_0xa7dd('0x1c')]||null:null,'limit':_0x4a0ef2[_0xa7dd('0x19')]?_0x4a0ef2[_0xa7dd('0x19')][_0xa7dd('0x1d')]||null:null})[_0xa7dd('0xd')](function(_0x412c76){logger['info'](_0xa7dd('0x22'),_0x4a0ef2);logger[_0xa7dd('0x21')](_0xa7dd('0x22'),_0x4a0ef2,JSON[_0xa7dd('0x10')](_0x412c76));_0x597a74(_0x412c76);})[_0xa7dd('0x16')](function(_0x30e032){logger[_0xa7dd('0x11')](_0xa7dd('0x22'),_0x30e032[_0xa7dd('0x13')],_0x4a0ef2);_0x2ca660(_0x54cd5e[_0xa7dd('0x11')](0x1f4,_0x30e032[_0xa7dd('0x13')]));});});};exports['DestroyCmHopperBlack']=function(_0x213f4e){var _0x4427ca=this;return new Promise(function(_0x127c9f,_0x4ff544){return db[_0xa7dd('0x18')][_0xa7dd('0x24')]({'where':_0x213f4e['options']?_0x213f4e[_0xa7dd('0x19')]['where']||null:null})['then'](function(_0x3c85bb){logger[_0xa7dd('0xe')]('DestroyCmHopperBlack',_0x213f4e);logger[_0xa7dd('0x21')]('DestroyCmHopperBlack',_0x213f4e,JSON[_0xa7dd('0x10')](_0x3c85bb));_0x127c9f(_0x3c85bb);})['catch'](function(_0x2ad1cd){logger[_0xa7dd('0x11')](_0xa7dd('0x25'),_0x2ad1cd[_0xa7dd('0x13')],_0x213f4e);_0x4ff544(_0x4427ca['error'](0x1f4,_0x2ad1cd[_0xa7dd('0x13')]));});});}; \ No newline at end of file +var _0x95cb=['code','message','info','GetCmHopperBlack','findAll','options','attributes','limit','include','map','model','catch','CmHopperBlack','body','raw','where','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x313df3,_0x4fca45){var _0x241d59=function(_0x452786){while(--_0x452786){_0x313df3['push'](_0x313df3['shift']());}};_0x241d59(++_0x4fca45);}(_0x95cb,0x1b7));var _0xb95c=function(_0x11aa5e,_0x1e0a06){_0x11aa5e=_0x11aa5e-0x0;var _0x205672=_0x95cb[_0x11aa5e];return _0x205672;};'use strict';var _=require(_0xb95c('0x0'));var util=require(_0xb95c('0x1'));var moment=require(_0xb95c('0x2'));var BPromise=require('bluebird');var rs=require(_0xb95c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb95c('0x4'))['db'];var utils=require(_0xb95c('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb95c('0x6'));var jayson=require(_0xb95c('0x7'));var client=jayson['client'][_0xb95c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5bc686,_0x1df559,_0xbd40b){return new BPromise(function(_0x353264,_0x76badf){return client['request'](_0x5bc686,_0xbd40b)[_0xb95c('0x9')](function(_0x4e5b5e){logger['info'](_0xb95c('0xa'),_0x1df559,_0xb95c('0xb'));logger[_0xb95c('0xc')](_0xb95c('0xd'),_0x1df559,_0xb95c('0xb'),JSON[_0xb95c('0xe')](_0x4e5b5e));if(_0x4e5b5e['error']){if(_0x4e5b5e[_0xb95c('0xf')][_0xb95c('0x10')]===0x1f4){logger[_0xb95c('0xf')](_0xb95c('0xa'),_0x1df559,_0x4e5b5e[_0xb95c('0xf')]['message']);return _0x76badf(_0x4e5b5e[_0xb95c('0xf')][_0xb95c('0x11')]);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x1df559,_0x4e5b5e[_0xb95c('0xf')][_0xb95c('0x11')]);return _0x353264(_0x4e5b5e[_0xb95c('0xf')][_0xb95c('0x11')]);}else{logger[_0xb95c('0x12')](_0xb95c('0xa'),_0x1df559,_0xb95c('0xb'));_0x353264(_0x4e5b5e['result'][_0xb95c('0x11')]);}})['catch'](function(_0x3834c3){logger[_0xb95c('0xf')](_0xb95c('0xa'),_0x1df559,_0x3834c3);_0x76badf(_0x3834c3);});});}exports[_0xb95c('0x13')]=function(_0x3618b1){var _0x3b392d=this;return new Promise(function(_0x250823,_0x33272d){return db['CmHopperBlack'][_0xb95c('0x14')]({'raw':_0x3618b1[_0xb95c('0x15')]?_0x3618b1[_0xb95c('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x3618b1['options']?_0x3618b1['options']['where']||null:null,'attributes':_0x3618b1[_0xb95c('0x15')]?_0x3618b1[_0xb95c('0x15')][_0xb95c('0x16')]||null:null,'limit':_0x3618b1[_0xb95c('0x15')]?_0x3618b1[_0xb95c('0x15')][_0xb95c('0x17')]||null:null,'include':_0x3618b1[_0xb95c('0x15')]?_0x3618b1[_0xb95c('0x15')][_0xb95c('0x18')]?_[_0xb95c('0x19')](_0x3618b1[_0xb95c('0x15')][_0xb95c('0x18')],function(_0x3c3ea3){return{'model':db[_0x3c3ea3['model']],'as':_0x3c3ea3['as'],'attributes':_0x3c3ea3[_0xb95c('0x16')],'include':_0x3c3ea3[_0xb95c('0x18')]?_[_0xb95c('0x19')](_0x3c3ea3['include'],function(_0x37adc6){return{'model':db[_0x37adc6['model']],'as':_0x37adc6['as'],'attributes':_0x37adc6[_0xb95c('0x16')],'include':_0x37adc6[_0xb95c('0x18')]?_[_0xb95c('0x19')](_0x37adc6['include'],function(_0x5c26be){return{'model':db[_0x5c26be[_0xb95c('0x1a')]],'as':_0x5c26be['as'],'attributes':_0x5c26be[_0xb95c('0x16')]};}):[]};}):[]};}):[]:[]})[_0xb95c('0x9')](function(_0x41d984){logger[_0xb95c('0x12')](_0xb95c('0x13'),_0x3618b1);logger[_0xb95c('0xc')](_0xb95c('0x13'),_0x3618b1,JSON[_0xb95c('0xe')](_0x41d984));_0x250823(_0x41d984);})[_0xb95c('0x1b')](function(_0x10208f){logger[_0xb95c('0xf')](_0xb95c('0x13'),_0x10208f[_0xb95c('0x11')],_0x3618b1);_0x33272d(_0x3b392d[_0xb95c('0xf')](0x1f4,_0x10208f[_0xb95c('0x11')]));});});};exports['UpdateCmHopperBlack']=function(_0x1d6f6e){var _0x1b8298=this;return new Promise(function(_0x4d9fce,_0xceba5b){return db[_0xb95c('0x1c')]['update'](_0x1d6f6e[_0xb95c('0x1d')],{'raw':_0x1d6f6e[_0xb95c('0x15')]?_0x1d6f6e['options'][_0xb95c('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d6f6e[_0xb95c('0x15')]?_0x1d6f6e[_0xb95c('0x15')][_0xb95c('0x1f')]||null:null,'attributes':_0x1d6f6e[_0xb95c('0x15')]?_0x1d6f6e[_0xb95c('0x15')][_0xb95c('0x16')]||null:null,'limit':_0x1d6f6e[_0xb95c('0x15')]?_0x1d6f6e[_0xb95c('0x15')][_0xb95c('0x17')]||null:null})['then'](function(_0x5f08dd){logger[_0xb95c('0x12')](_0xb95c('0x20'),_0x1d6f6e);logger[_0xb95c('0xc')](_0xb95c('0x20'),_0x1d6f6e,JSON[_0xb95c('0xe')](_0x5f08dd));_0x4d9fce(_0x5f08dd);})[_0xb95c('0x1b')](function(_0x4723eb){logger['error'](_0xb95c('0x20'),_0x4723eb[_0xb95c('0x11')],_0x1d6f6e);_0xceba5b(_0x1b8298[_0xb95c('0xf')](0x1f4,_0x4723eb[_0xb95c('0x11')]));});});};exports[_0xb95c('0x21')]=function(_0x21438b){var _0x13834c=this;return new Promise(function(_0x179315,_0x5901aa){return db['CmHopperBlack'][_0xb95c('0x22')]({'where':_0x21438b[_0xb95c('0x15')]?_0x21438b['options'][_0xb95c('0x1f')]||null:null})[_0xb95c('0x9')](function(_0x2cfadb){logger[_0xb95c('0x12')](_0xb95c('0x21'),_0x21438b);logger[_0xb95c('0xc')]('DestroyCmHopperBlack',_0x21438b,JSON['stringify'](_0x2cfadb));_0x179315(_0x2cfadb);})['catch'](function(_0x10f7a5){logger[_0xb95c('0xf')](_0xb95c('0x21'),_0x10f7a5['message'],_0x21438b);_0x5901aa(_0x13834c[_0xb95c('0xf')](0x1f4,_0x10f7a5[_0xb95c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 89fef79..cc79c34 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 _0x7096=['destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','show','put','/:id','update'];(function(_0x3b18b5,_0x343411){var _0x3e7dcc=function(_0x374aa0){while(--_0x374aa0){_0x3b18b5['push'](_0x3b18b5['shift']());}};_0x3e7dcc(++_0x343411);}(_0x7096,0x10c));var _0x6709=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x7096[_0x4709c0];return _0x13348b;};'use strict';var multer=require('multer');var util=require(_0x6709('0x0'));var path=require('path');var timeout=require(_0x6709('0x1'));var express=require('express');var router=express[_0x6709('0x2')]();var fs_extra=require(_0x6709('0x3'));var auth=require(_0x6709('0x4'));var interaction=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var controller=require(_0x6709('0x7'));router[_0x6709('0x8')]('/',auth[_0x6709('0x9')](),controller[_0x6709('0xa')]);router[_0x6709('0x8')](_0x6709('0xb'),auth[_0x6709('0x9')](),controller[_0x6709('0xc')]);router['get']('/:id',auth[_0x6709('0x9')](),controller[_0x6709('0xd')]);router[_0x6709('0xe')](_0x6709('0xf'),auth[_0x6709('0x9')](),controller[_0x6709('0x10')]);router['delete']('/:id',auth[_0x6709('0x9')](),controller[_0x6709('0x11')]);module[_0x6709('0x12')]=router; \ No newline at end of file +var _0xba34=['./cmHopperBlack.controller','get','isAuthenticated','index','describe','/:id','show','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment'];(function(_0x339cc2,_0x374b00){var _0x2eec53=function(_0x6af351){while(--_0x6af351){_0x339cc2['push'](_0x339cc2['shift']());}};_0x2eec53(++_0x374b00);}(_0xba34,0x119));var _0x4ba3=function(_0x2516f3,_0xe24eec){_0x2516f3=_0x2516f3-0x0;var _0x171361=_0xba34[_0x2516f3];return _0x171361;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var controller=require(_0x4ba3('0x7'));router[_0x4ba3('0x8')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xa')]);router[_0x4ba3('0x8')]('/describe',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0x8')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0xe')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x10')]('/:id',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 46558d9..ea0faa3 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 _0xcb00=['getDataValue','endtime','diff','setDataValue','dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE'];(function(_0x59c17e,_0x527262){var _0x244753=function(_0x295375){while(--_0x295375){_0x59c17e['push'](_0x59c17e['shift']());}};_0x244753(++_0x527262);}(_0xcb00,0xf6));var _0x0cb0=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0xcb00[_0x4c440b];return _0x2d48cf;};'use strict';var Sequelize=require(_0x0cb0('0x0'));var moment=require(_0x0cb0('0x1'));module[_0x0cb0('0x2')]={'state':{'type':Sequelize[_0x0cb0('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x0cb0('0x4')]},'scheduledat':{'type':Sequelize[_0x0cb0('0x5')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0cb0('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0cb0('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x0cb0('0x4')]},'originatecalleridname':{'type':Sequelize[_0x0cb0('0x4')]},'calleridnum':{'type':Sequelize[_0x0cb0('0x4')]},'calleridname':{'type':Sequelize[_0x0cb0('0x4')]},'starttime':{'type':Sequelize[_0x0cb0('0x5')]},'responsetime':{'type':Sequelize[_0x0cb0('0x5')]},'answertime':{'type':Sequelize[_0x0cb0('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x0cb0('0x5')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0cb0('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x0cb0('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x0cb0('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x0cb0('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x0cb0('0x4')]},'reason':{'type':Sequelize[_0x0cb0('0x4')]},'disposition':{'type':Sequelize[_0x0cb0('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x0cb0('0x4')]},'dispositionat':{'type':Sequelize[_0x0cb0('0x5')],'set':function(_0x1c01c3){var _0x4d4672=this[_0x0cb0('0x6')](_0x0cb0('0x7'));if(_0x4d4672&&_0x1c01c3){this['setDataValue']('followuptime',moment(_0x1c01c3)[_0x0cb0('0x8')](moment(_0x4d4672),'seconds'));}return this[_0x0cb0('0x9')](_0x0cb0('0xa'),_0x1c01c3);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x0cb0('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x0cb0('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x0cb0('0x5')]},'callback':{'type':Sequelize[_0x0cb0('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0cb0('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x0cb0('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x0cb0('0x5')]},'recallme':{'type':Sequelize[_0x0cb0('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x0cb0('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x0cb0('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0cb0('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0cb0('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0cb0('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0cb0('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7d29=['BOOLEAN','sequelize','moment','exports','STRING','INTEGER','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds'];(function(_0x58aab9,_0x4d0fd0){var _0x2b3474=function(_0x4dee80){while(--_0x4dee80){_0x58aab9['push'](_0x58aab9['shift']());}};_0x2b3474(++_0x4d0fd0);}(_0x7d29,0x69));var _0x97d2=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x7d29[_0x13d07a];return _0x5ee0ee;};'use strict';var Sequelize=require(_0x97d2('0x0'));var moment=require(_0x97d2('0x1'));module[_0x97d2('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x97d2('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x97d2('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x97d2('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x97d2('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x97d2('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x97d2('0x3')]},'calleridnum':{'type':Sequelize[_0x97d2('0x3')]},'calleridname':{'type':Sequelize[_0x97d2('0x3')]},'starttime':{'type':Sequelize[_0x97d2('0x5')]},'responsetime':{'type':Sequelize[_0x97d2('0x5')]},'answertime':{'type':Sequelize[_0x97d2('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x97d2('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x97d2('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x97d2('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x97d2('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x97d2('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x97d2('0x3')]},'membername':{'type':Sequelize[_0x97d2('0x3')]},'reason':{'type':Sequelize[_0x97d2('0x3')]},'disposition':{'type':Sequelize[_0x97d2('0x3')]},'secondDisposition':{'type':Sequelize[_0x97d2('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x97d2('0x5')],'set':function(_0xdd3121){var _0x4962b8=this[_0x97d2('0x6')](_0x97d2('0x7'));if(_0x4962b8&&_0xdd3121){this[_0x97d2('0x8')](_0x97d2('0x9'),moment(_0xdd3121)[_0x97d2('0xa')](moment(_0x4962b8),_0x97d2('0xb')));}return this[_0x97d2('0x8')]('dispositionat',_0xdd3121);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x97d2('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x97d2('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x97d2('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x97d2('0x5')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x97d2('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x97d2('0x5')]},'deleted':{'type':Sequelize[_0x97d2('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x97d2('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x97d2('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x97d2('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x97d2('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x97d2('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'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 bea07b3..7faa3a4 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 _0xdb28=['zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','CmHopperFinal','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','describe','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x2010\x20,\x201,\x20null','insert','into','cm_hopper','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','ListId','CampaignId','ANY_VALUE(CampaignId)','state','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','rimraf'];(function(_0x58a7f2,_0x4d788e){var _0x3d839e=function(_0x586199){while(--_0x586199){_0x58a7f2['push'](_0x58a7f2['shift']());}};_0x3d839e(++_0x4d788e);}(_0xdb28,0x106));var _0x8db2=function(_0x4e59b6,_0x2e1abd){_0x4e59b6=_0x4e59b6-0x0;var _0xaad3cc=_0xdb28[_0x4e59b6];return _0xaad3cc;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'all':!![]}];}return db[_0x8db2('0x2b')][_0x8db2('0x40')](_0x21bae5);})['then'](function(_0x49a7ae){_0x3124d5[_0x8db2('0x41')]=_0x49a7ae;return _0x3124d5;})['then'](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x42')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x43')]=function(_0x313130,_0x307783){var _0xb4fe2c={'raw':!![],'where':{'id':_0x313130[_0x8db2('0x44')]['id']}},_0x30d606={};_0x30d606['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x45')]);_0x30d606[_0x8db2('0x30')]=_['keys'](_0x313130[_0x8db2('0x30')]);_0x30d606[_0x8db2('0x39')]=_[_0x8db2('0x46')](_0x30d606[_0x8db2('0x32')],_0x30d606['query']);_0xb4fe2c[_0x8db2('0x34')]=_['intersection'](_0x30d606[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x313130[_0x8db2('0x30')]['fields']));_0xb4fe2c['attributes']=_0xb4fe2c[_0x8db2('0x34')]['length']?_0xb4fe2c[_0x8db2('0x34')]:_0x30d606[_0x8db2('0x32')];if(_0x313130[_0x8db2('0x30')][_0x8db2('0x3f')]){_0xb4fe2c[_0x8db2('0x47')]=[{'all':!![]}];}_0xb4fe2c=_[_0x8db2('0x3d')]({},_0xb4fe2c,_0x313130[_0x8db2('0x3e')]);return db[_0x8db2('0x2b')][_0x8db2('0x48')](_0xb4fe2c)[_0x8db2('0x24')](handleEntityNotFound(_0x307783,null))[_0x8db2('0x24')](respondWithResult(_0x307783,null))[_0x8db2('0x42')](handleError(_0x307783,null));};exports['describe']=function(_0x449109,_0x2ada52){return db[_0x8db2('0x2b')][_0x8db2('0x49')]()['then'](respondWithResult(_0x2ada52,null))['catch'](handleError(_0x2ada52,null));};exports[_0x8db2('0x23')]=function(_0x2e46d4,_0x164020){if(_0x2e46d4['body']['uniqueid']){delete _0x2e46d4['body'][_0x8db2('0x4a')];}return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'uniqueid':_0x2e46d4[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x164020,null))[_0x8db2('0x24')](saveUpdates(_0x2e46d4[_0x8db2('0x4b')],null))['then'](respondWithResult(_0x164020,null))['catch'](handleError(_0x164020,null));};exports[_0x8db2('0x4c')]=function(_0x18c6ef,_0x2908e4,_0x2f0bd0){return db[_0x8db2('0x2b')][_0x8db2('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x18c6ef[_0x8db2('0x44')]['id']},'attributes':[[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x50')))),_0x8db2('0x51')],[db[_0x8db2('0x4d')]['fn']('COUNT',db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')]['literal'](_0x8db2('0x52')))),_0x8db2('0x53')],[db[_0x8db2('0x4d')]['fn']('COUNT',db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x54')))),_0x8db2('0x55')],[db['sequelize']['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')]['literal'](_0x8db2('0x56')))),_0x8db2('0x57')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x8db2('0x58')],[db[_0x8db2('0x4d')]['fn']('COUNT',db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')]['literal'](_0x8db2('0x59')))),_0x8db2('0x5a')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x5b')))),_0x8db2('0x5c')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x5d')))),_0x8db2('0x5e')]]})['then'](handleEntityNotFound(_0x2908e4,null))[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x42')](handleError(_0x2908e4,null));};exports[_0x8db2('0x5f')]=function(_0xc27a7e,_0x349db0,_0x53b2dc){return db[_0x8db2('0x2b')][_0x8db2('0x40')]({'raw':![],'where':{'CampaignId':_0xc27a7e[_0x8db2('0x44')]['id']},'attributes':[[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x50')))),_0x8db2('0x51')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x52')))),_0x8db2('0x53')],[db[_0x8db2('0x4d')]['fn']('COUNT',db[_0x8db2('0x4d')]['fn']('IF',db['sequelize'][_0x8db2('0x4f')]('`state`\x20=\x205,\x201,\x20null'))),_0x8db2('0x55')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x8db2('0x57')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x60')))),_0x8db2('0x58')],[db['sequelize']['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x59')))),_0x8db2('0x5a')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db['sequelize']['fn']('IF',db['sequelize'][_0x8db2('0x4f')](_0x8db2('0x5b')))),_0x8db2('0x5c')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db['sequelize']['fn']('IF',db['sequelize'][_0x8db2('0x4f')](_0x8db2('0x5d')))),'answeringMachine']]})[_0x8db2('0x24')](handleEntityNotFound(_0x349db0,null))[_0x8db2('0x24')](respondWithResult(_0x349db0,null))[_0x8db2('0x42')](handleError(_0x349db0,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x26523b,_0x291375,_0x2cf731){return db['VoiceQueue'][_0x8db2('0x48')]({'where':{'id':_0x26523b[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x291375,null))[_0x8db2('0x24')](function(_0x3a0946){var _0x5923b3;if(_0x3a0946){_0x5923b3=squel[_0x8db2('0x61')]()[_0x8db2('0x62')](_0x8db2('0x63'))['fromQuery'](['phone',_0x8db2('0x64'),_0x8db2('0x65'),'ListId',_0x8db2('0x66'),_0x8db2('0x67'),_0x8db2('0x68')],squel[_0x8db2('0x69')]()[_0x8db2('0x6a')](_0x8db2('0x6b'),_0x8db2('0x6c'))[_0x8db2('0x6a')](_0x8db2('0x6d'),_0x8db2('0x64'))[_0x8db2('0x6a')](_0x8db2('0x6e'),_0x8db2('0x65'))['field'](_0x8db2('0x6f'),'ListId')[_0x8db2('0x6a')](_0x8db2('0x70'),'VoiceQueueId')[_0x8db2('0x6a')](_0x8db2('0x6d'),'createdAt')[_0x8db2('0x6a')](_0x8db2('0x6d'),_0x8db2('0x68'))[_0x8db2('0x71')](_0x8db2('0x72'))[_0x8db2('0x3b')](_0x8db2('0x73'),_0x26523b[_0x8db2('0x44')]['id'][_0x8db2('0x74')]())['where']('state\x20=\x20?',_0x26523b[_0x8db2('0x4b')]['state'][_0x8db2('0x74')]())[_0x8db2('0x3b')](_0x8db2('0x75'))['where'](_0x8db2('0x76'),squel[_0x8db2('0x69')]()[_0x8db2('0x6a')]('phone')[_0x8db2('0x71')](_0x8db2('0x63'))[_0x8db2('0x3b')](_0x8db2('0x73'),_0x26523b['params']['id'][_0x8db2('0x74')]()))[_0x8db2('0x3b')](_0x8db2('0x76'),squel[_0x8db2('0x69')]()[_0x8db2('0x6a')](_0x8db2('0x77'))[_0x8db2('0x71')](_0x8db2('0x72'))[_0x8db2('0x3b')](_0x8db2('0x73'),_0x26523b[_0x8db2('0x44')]['id']['toString']())[_0x8db2('0x3b')](_0x8db2('0x78')))[_0x8db2('0x79')]('ContactId'))['toString']();return db['sequelize'][_0x8db2('0x30')](_0x5923b3);}return[];})[_0x8db2('0x24')](respondWithResult(_0x291375,null))[_0x8db2('0x42')](handleError(_0x291375,null));};exports[_0x8db2('0x7a')]=function(_0x2ad024,_0x313918,_0x339d09){return db[_0x8db2('0x7b')][_0x8db2('0x48')]({'where':{'id':_0x2ad024[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x313918,null))['then'](function(_0x360a06){var _0xa2e293;if(_0x360a06){_0xa2e293=squel[_0x8db2('0x61')]()[_0x8db2('0x62')]('cm_hopper')['fromQuery']([_0x8db2('0x6c'),_0x8db2('0x64'),'ContactId',_0x8db2('0x7c'),_0x8db2('0x7d'),_0x8db2('0x67'),'updatedAt'],squel['select']()['field'](_0x8db2('0x6b'),_0x8db2('0x6c'))[_0x8db2('0x6a')](_0x8db2('0x6d'),_0x8db2('0x64'))['field'](_0x8db2('0x6e'),'ContactId')[_0x8db2('0x6a')](_0x8db2('0x6f'),_0x8db2('0x7c'))[_0x8db2('0x6a')](_0x8db2('0x7e'),'CampaignId')['field'](_0x8db2('0x6d'),'createdAt')[_0x8db2('0x6a')](_0x8db2('0x6d'),_0x8db2('0x68'))[_0x8db2('0x71')](_0x8db2('0x72'))[_0x8db2('0x3b')]('CampaignId\x20=\x20?',_0x2ad024[_0x8db2('0x44')]['id'][_0x8db2('0x74')]())[_0x8db2('0x3b')]('state\x20=\x20?',_0x2ad024[_0x8db2('0x4b')][_0x8db2('0x7f')]['toString']())[_0x8db2('0x3b')](_0x8db2('0x75'))[_0x8db2('0x3b')](_0x8db2('0x76'),squel[_0x8db2('0x69')]()[_0x8db2('0x6a')](_0x8db2('0x6c'))[_0x8db2('0x71')](_0x8db2('0x63'))['where'](_0x8db2('0x80'),_0x2ad024[_0x8db2('0x44')]['id'][_0x8db2('0x74')]()))[_0x8db2('0x3b')](_0x8db2('0x76'),squel[_0x8db2('0x69')]()[_0x8db2('0x6a')](_0x8db2('0x77'))[_0x8db2('0x71')](_0x8db2('0x72'))['where'](_0x8db2('0x80'),_0x2ad024[_0x8db2('0x44')]['id'][_0x8db2('0x74')]())[_0x8db2('0x3b')]('state\x20=\x204'))[_0x8db2('0x79')](_0x8db2('0x65')))[_0x8db2('0x74')]();return db['sequelize']['query'](_0xa2e293);}return[];})[_0x8db2('0x24')](respondWithResult(_0x313918,null))[_0x8db2('0x42')](handleError(_0x313918,null));};exports[_0x8db2('0x81')]=function(_0xc83913,_0x4f9ce4,_0xaa2661){return db[_0x8db2('0x82')][_0x8db2('0x83')]({'where':{'VoiceQueueId':_0xc83913[_0x8db2('0x4b')]['VoiceQueueId'],'CampaignId':_0xc83913[_0x8db2('0x4b')][_0x8db2('0x7d')],'ContactId':_0xc83913[_0x8db2('0x4b')]['ContactId']}})['then'](handleEntityNotFound(_0x4f9ce4,null))['then'](function(_0x1ba097){if(_0x1ba097){return _0x1ba097;}return null;})[_0x8db2('0x24')](respondWithResult(_0x4f9ce4,null))[_0x8db2('0x42')](handleError(_0x4f9ce4,null));}; \ No newline at end of file +var _0xe3da=['COUNT','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','noSuchContacts','congestionContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','phone','ContactId','select','field','NOW()','scheduledAt','ANY_VALUE(ContactId)','ListId','ANY_VALUE(VoiceQueueId)','VoiceQueueId','cm_hopper_final','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','VoiceQueueId\x20=\x20?','from','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','fromQuery','CampaignId','createdAt','updatedAt','ANY_VALUE(calleridnum)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','order','sort','where','pick','map','VIRTUAL','filter','merge','options','count','include','findAll','rows','catch','show','params','length','includeAll','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts'];(function(_0x103ff9,_0x576a4d){var _0x40693e=function(_0xd67bce){while(--_0xd67bce){_0x103ff9['push'](_0x103ff9['shift']());}};_0x40693e(++_0x576a4d);}(_0xe3da,0x1cd));var _0xae3d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe3da[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0xae3d('0x0'));var rimraf=require(_0xae3d('0x1'));var zipdir=require(_0xae3d('0x2'));var jsonpatch=require(_0xae3d('0x3'));var rp=require(_0xae3d('0x4'));var moment=require(_0xae3d('0x5'));var BPromise=require(_0xae3d('0x6'));var Mustache=require(_0xae3d('0x7'));var util=require(_0xae3d('0x8'));var path=require(_0xae3d('0x9'));var sox=require(_0xae3d('0xa'));var csv=require(_0xae3d('0xb'));var ejs=require(_0xae3d('0xc'));var fs=require('fs');var fs_extra=require(_0xae3d('0xd'));var _=require(_0xae3d('0xe'));var squel=require(_0xae3d('0xf'));var crypto=require('crypto');var jsforce=require(_0xae3d('0x10'));var deskjs=require(_0xae3d('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xae3d('0x12'));var Redis=require(_0xae3d('0x13'));var authService=require(_0xae3d('0x14'));var qs=require(_0xae3d('0x15'));var as=require(_0xae3d('0x16'));var hardwareService=require(_0xae3d('0x17'));var logger=require('../../config/logger')(_0xae3d('0x18'));var utils=require('../../config/utils');var config=require(_0xae3d('0x19'));var licenseUtil=require(_0xae3d('0x1a'));var db=require(_0xae3d('0x1b'))['db'];function respondWithStatusCode(_0x172f7a,_0x48aa74){_0x48aa74=_0x48aa74||0xcc;return function(_0xfb7869){if(_0xfb7869){return _0x172f7a[_0xae3d('0x1c')](_0x48aa74);}return _0x172f7a[_0xae3d('0x1d')](_0x48aa74)[_0xae3d('0x1e')]();};}function respondWithResult(_0x2afdd3,_0x430659){_0x430659=_0x430659||0xc8;return function(_0x31498d){if(_0x31498d){return _0x2afdd3['status'](_0x430659)[_0xae3d('0x1f')](_0x31498d);}};}function respondWithFilteredResult(_0x42f4b4,_0x46295b){return function(_0x230afb){if(_0x230afb){var _0x192c13=typeof _0x46295b[_0xae3d('0x20')]==='undefined'&&typeof _0x46295b[_0xae3d('0x21')]===_0xae3d('0x22');var _0x2e31f1=_0x230afb['count'];var _0x3f8cf9=_0x192c13?0x0:_0x46295b[_0xae3d('0x20')];var _0x558e42=_0x192c13?_0x230afb['count']:_0x46295b[_0xae3d('0x20')]+_0x46295b[_0xae3d('0x21')];var _0x19c44d;if(_0x558e42>=_0x2e31f1){_0x558e42=_0x2e31f1;_0x19c44d=0xc8;}else{_0x19c44d=0xce;}_0x42f4b4[_0xae3d('0x1d')](_0x19c44d);return _0x42f4b4[_0xae3d('0x23')]('Content-Range',_0x3f8cf9+'-'+_0x558e42+'/'+_0x2e31f1)[_0xae3d('0x1f')](_0x230afb);}return null;};}function patchUpdates(_0x48f00e){return function(_0x4a09c2){try{jsonpatch[_0xae3d('0x24')](_0x4a09c2,_0x48f00e,!![]);}catch(_0x1415e8){return BPromise[_0xae3d('0x25')](_0x1415e8);}return _0x4a09c2[_0xae3d('0x26')]();};}function saveUpdates(_0x3e7afc,_0x26c419){return function(_0x155099){if(_0x155099){return _0x155099[_0xae3d('0x27')](_0x3e7afc)[_0xae3d('0x28')](function(_0x300be8){return _0x300be8;});}return null;};}function removeEntity(_0x9bf34a,_0x37f5ff){return function(_0x1b2acb){if(_0x1b2acb){return _0x1b2acb[_0xae3d('0x29')]()[_0xae3d('0x28')](function(){_0x9bf34a[_0xae3d('0x1d')](0xcc)[_0xae3d('0x1e')]();});}};}function handleEntityNotFound(_0x2131e9,_0x1b1217){return function(_0x5d45db){if(!_0x5d45db){_0x2131e9[_0xae3d('0x1c')](0x194);}return _0x5d45db;};}function handleError(_0x185e71,_0xb5940){_0xb5940=_0xb5940||0x1f4;return function(_0x52df0f){logger[_0xae3d('0x2a')](_0x52df0f[_0xae3d('0x2b')]);if(_0x52df0f[_0xae3d('0x2c')]){delete _0x52df0f['name'];}_0x185e71['status'](_0xb5940)[_0xae3d('0x2d')](_0x52df0f);};}exports[_0xae3d('0x2e')]=function(_0x3a5840,_0x3114f9){var _0xb69ec9={},_0x561371={},_0x1d1483={'count':0x0,'rows':[]};var _0x3a2434=_['map'](db[_0xae3d('0x2f')][_0xae3d('0x30')],function(_0x2cf750){return{'name':_0x2cf750[_0xae3d('0x31')],'type':_0x2cf750[_0xae3d('0x32')][_0xae3d('0x33')]};});_0x561371['model']=_['map'](_0x3a2434,'name');_0x561371[_0xae3d('0x34')]=_[_0xae3d('0x35')](_0x3a5840[_0xae3d('0x34')]);_0x561371[_0xae3d('0x36')]=_['intersection'](_0x561371[_0xae3d('0x37')],_0x561371[_0xae3d('0x34')]);_0xb69ec9[_0xae3d('0x38')]=_[_0xae3d('0x39')](_0x561371[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0x3a5840[_0xae3d('0x34')]['fields']));_0xb69ec9[_0xae3d('0x38')]=_0xb69ec9['attributes']['length']?_0xb69ec9[_0xae3d('0x38')]:_0x561371['model'];if(!_0x3a5840[_0xae3d('0x34')]['hasOwnProperty']('nolimit')){_0xb69ec9[_0xae3d('0x21')]=qs[_0xae3d('0x21')](_0x3a5840[_0xae3d('0x34')]['limit']);_0xb69ec9[_0xae3d('0x20')]=qs['offset'](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x20')]);}_0xb69ec9[_0xae3d('0x3b')]=qs[_0xae3d('0x3c')](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x3c')]);_0xb69ec9[_0xae3d('0x3d')]=qs[_0xae3d('0x36')](_[_0xae3d('0x3e')](_0x3a5840[_0xae3d('0x34')],_0x561371[_0xae3d('0x36')]),_0x3a2434);if(_0x3a5840['query']['filter']){_0xb69ec9[_0xae3d('0x3d')]=_['merge'](_0xb69ec9[_0xae3d('0x3d')],{'$or':_[_0xae3d('0x3f')](_0x3a2434,function(_0x1db3c1){if(_0x1db3c1[_0xae3d('0x32')]!==_0xae3d('0x40')){var _0x35db44={};_0x35db44[_0x1db3c1[_0xae3d('0x2c')]]={'$like':'%'+_0x3a5840[_0xae3d('0x34')][_0xae3d('0x41')]+'%'};return _0x35db44;}})});}_0xb69ec9=_[_0xae3d('0x42')]({},_0xb69ec9,_0x3a5840[_0xae3d('0x43')]);var _0x549db8={'where':_0xb69ec9[_0xae3d('0x3d')]};return db[_0xae3d('0x2f')][_0xae3d('0x44')](_0x549db8)['then'](function(_0x4df102){_0x1d1483[_0xae3d('0x44')]=_0x4df102;if(_0x3a5840[_0xae3d('0x34')]['includeAll']){_0xb69ec9[_0xae3d('0x45')]=[{'all':!![]}];}return db[_0xae3d('0x2f')][_0xae3d('0x46')](_0xb69ec9);})[_0xae3d('0x28')](function(_0x436a04){_0x1d1483[_0xae3d('0x47')]=_0x436a04;return _0x1d1483;})['then'](respondWithFilteredResult(_0x3114f9,_0xb69ec9))[_0xae3d('0x48')](handleError(_0x3114f9,null));};exports[_0xae3d('0x49')]=function(_0xce7f34,_0x938811){var _0x1fef90={'raw':!![],'where':{'id':_0xce7f34[_0xae3d('0x4a')]['id']}},_0x515220={};_0x515220['model']=_[_0xae3d('0x35')](db[_0xae3d('0x2f')][_0xae3d('0x30')]);_0x515220[_0xae3d('0x34')]=_['keys'](_0xce7f34['query']);_0x515220['filters']=_[_0xae3d('0x39')](_0x515220[_0xae3d('0x37')],_0x515220['query']);_0x1fef90['attributes']=_['intersection'](_0x515220[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0xce7f34[_0xae3d('0x34')][_0xae3d('0x3a')]));_0x1fef90[_0xae3d('0x38')]=_0x1fef90[_0xae3d('0x38')][_0xae3d('0x4b')]?_0x1fef90['attributes']:_0x515220['model'];if(_0xce7f34['query'][_0xae3d('0x4c')]){_0x1fef90['include']=[{'all':!![]}];}_0x1fef90=_[_0xae3d('0x42')]({},_0x1fef90,_0xce7f34[_0xae3d('0x43')]);return db[_0xae3d('0x2f')][_0xae3d('0x4d')](_0x1fef90)[_0xae3d('0x28')](handleEntityNotFound(_0x938811,null))[_0xae3d('0x28')](respondWithResult(_0x938811,null))[_0xae3d('0x48')](handleError(_0x938811,null));};exports[_0xae3d('0x4e')]=function(_0x38f92d,_0x4ed0f9){return db[_0xae3d('0x2f')]['describe']()['then'](respondWithResult(_0x4ed0f9,null))['catch'](handleError(_0x4ed0f9,null));};exports[_0xae3d('0x27')]=function(_0xc8f551,_0x39f213){if(_0xc8f551[_0xae3d('0x4f')]['uniqueid']){delete _0xc8f551['body'][_0xae3d('0x50')];}return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'uniqueid':_0xc8f551[_0xae3d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x39f213,null))[_0xae3d('0x28')](saveUpdates(_0xc8f551[_0xae3d('0x4f')],null))[_0xae3d('0x28')](respondWithResult(_0x39f213,null))[_0xae3d('0x48')](handleError(_0x39f213,null));};exports[_0xae3d('0x51')]=function(_0x38ccf1,_0x3e30ea,_0x291c7d){return db[_0xae3d('0x2f')][_0xae3d('0x46')]({'raw':![],'where':{'VoiceQueueId':_0x38ccf1[_0xae3d('0x4a')]['id']},'attributes':[[db[_0xae3d('0x52')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x54')))),'noSuchContacts'],[db[_0xae3d('0x52')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x55')))),_0xae3d('0x56')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x58')))),_0xae3d('0x59')],[db[_0xae3d('0x52')]['fn']('COUNT',db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x5a')))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db[_0xae3d('0x52')]['fn']('IF',db['sequelize']['literal'](_0xae3d('0x5b')))),_0xae3d('0x5c')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')]['literal'](_0xae3d('0x5d')))),_0xae3d('0x5e')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')]['literal'](_0xae3d('0x5f')))),_0xae3d('0x60')],[db[_0xae3d('0x52')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x61')))),'answeringMachine']]})[_0xae3d('0x28')](handleEntityNotFound(_0x3e30ea,null))[_0xae3d('0x28')](respondWithResult(_0x3e30ea,null))[_0xae3d('0x48')](handleError(_0x3e30ea,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x3a39ed,_0x31b362,_0x253ee4){return db[_0xae3d('0x2f')][_0xae3d('0x46')]({'raw':![],'where':{'CampaignId':_0x3a39ed[_0xae3d('0x4a')]['id']},'attributes':[[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x54')))),_0xae3d('0x62')],[db['sequelize']['fn']('COUNT',db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x55')))),'noAnswerContacts'],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x58')))),_0xae3d('0x59')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x5a')))),_0xae3d('0x63')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x5b')))),_0xae3d('0x5c')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xae3d('0x5e')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x5f')))),_0xae3d('0x60')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')]['literal'](_0xae3d('0x61')))),_0xae3d('0x64')]]})['then'](handleEntityNotFound(_0x31b362,null))[_0xae3d('0x28')](respondWithResult(_0x31b362,null))['catch'](handleError(_0x31b362,null));};exports[_0xae3d('0x65')]=function(_0x115e99,_0x26c409,_0x4709ea){return db[_0xae3d('0x66')]['find']({'where':{'id':_0x115e99[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x26c409,null))[_0xae3d('0x28')](function(_0x5f1e9c){var _0x546991;if(_0x5f1e9c){_0x546991=squel[_0xae3d('0x67')]()[_0xae3d('0x68')]('cm_hopper')['fromQuery']([_0xae3d('0x69'),'scheduledAt',_0xae3d('0x6a'),'ListId','VoiceQueueId','createdAt','updatedAt'],squel[_0xae3d('0x6b')]()[_0xae3d('0x6c')]('ANY_VALUE(calleridnum)','phone')[_0xae3d('0x6c')](_0xae3d('0x6d'),_0xae3d('0x6e'))[_0xae3d('0x6c')](_0xae3d('0x6f'),_0xae3d('0x6a'))[_0xae3d('0x6c')]('ANY_VALUE(ListId)',_0xae3d('0x70'))[_0xae3d('0x6c')](_0xae3d('0x71'),_0xae3d('0x72'))[_0xae3d('0x6c')](_0xae3d('0x6d'),'createdAt')[_0xae3d('0x6c')](_0xae3d('0x6d'),'updatedAt')['from'](_0xae3d('0x73'))[_0xae3d('0x3d')]('VoiceQueueId\x20=\x20?',_0x115e99[_0xae3d('0x4a')]['id'][_0xae3d('0x74')]())[_0xae3d('0x3d')]('state\x20=\x20?',_0x115e99[_0xae3d('0x4f')][_0xae3d('0x75')]['toString']())['where'](_0xae3d('0x76'))[_0xae3d('0x3d')](_0xae3d('0x77'),squel['select']()[_0xae3d('0x6c')](_0xae3d('0x69'))['from'](_0xae3d('0x78'))[_0xae3d('0x3d')](_0xae3d('0x79'),_0x115e99['params']['id'][_0xae3d('0x74')]()))[_0xae3d('0x3d')](_0xae3d('0x77'),squel['select']()[_0xae3d('0x6c')]('calleridnum')[_0xae3d('0x7a')]('cm_hopper_final')['where'](_0xae3d('0x79'),_0x115e99['params']['id'][_0xae3d('0x74')]())[_0xae3d('0x3d')](_0xae3d('0x7b')))[_0xae3d('0x7c')]('ContactId'))[_0xae3d('0x74')]();return db[_0xae3d('0x52')][_0xae3d('0x34')](_0x546991);}return[];})[_0xae3d('0x28')](respondWithResult(_0x26c409,null))[_0xae3d('0x48')](handleError(_0x26c409,null));};exports[_0xae3d('0x7d')]=function(_0x1c5f67,_0xa083d0,_0x26e422){return db[_0xae3d('0x7e')][_0xae3d('0x4d')]({'where':{'id':_0x1c5f67[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0xa083d0,null))[_0xae3d('0x28')](function(_0xf281f5){var _0x3261e5;if(_0xf281f5){_0x3261e5=squel[_0xae3d('0x67')]()['into'](_0xae3d('0x78'))[_0xae3d('0x7f')]([_0xae3d('0x69'),_0xae3d('0x6e'),_0xae3d('0x6a'),'ListId',_0xae3d('0x80'),_0xae3d('0x81'),_0xae3d('0x82')],squel[_0xae3d('0x6b')]()[_0xae3d('0x6c')](_0xae3d('0x83'),_0xae3d('0x69'))[_0xae3d('0x6c')]('NOW()',_0xae3d('0x6e'))[_0xae3d('0x6c')](_0xae3d('0x6f'),'ContactId')[_0xae3d('0x6c')](_0xae3d('0x84'),_0xae3d('0x70'))['field'](_0xae3d('0x85'),_0xae3d('0x80'))['field'](_0xae3d('0x6d'),'createdAt')[_0xae3d('0x6c')]('NOW()',_0xae3d('0x82'))[_0xae3d('0x7a')](_0xae3d('0x73'))[_0xae3d('0x3d')](_0xae3d('0x86'),_0x1c5f67['params']['id'][_0xae3d('0x74')]())[_0xae3d('0x3d')]('state\x20=\x20?',_0x1c5f67['body'][_0xae3d('0x75')][_0xae3d('0x74')]())[_0xae3d('0x3d')](_0xae3d('0x76'))['where'](_0xae3d('0x77'),squel[_0xae3d('0x6b')]()[_0xae3d('0x6c')]('phone')['from'](_0xae3d('0x78'))['where'](_0xae3d('0x86'),_0x1c5f67['params']['id'][_0xae3d('0x74')]()))[_0xae3d('0x3d')](_0xae3d('0x77'),squel[_0xae3d('0x6b')]()['field'](_0xae3d('0x87'))[_0xae3d('0x7a')](_0xae3d('0x73'))['where'](_0xae3d('0x86'),_0x1c5f67['params']['id'][_0xae3d('0x74')]())[_0xae3d('0x3d')]('state\x20=\x204'))['group'](_0xae3d('0x6a')))['toString']();return db['sequelize'][_0xae3d('0x34')](_0x3261e5);}return[];})['then'](respondWithResult(_0xa083d0,null))[_0xae3d('0x48')](handleError(_0xa083d0,null));};exports['checkContactHopper']=function(_0x31f606,_0x47aa7a,_0x27c0ff){return db['CmHopper'][_0xae3d('0x88')]({'where':{'VoiceQueueId':_0x31f606['body'][_0xae3d('0x72')],'CampaignId':_0x31f606[_0xae3d('0x4f')][_0xae3d('0x80')],'ContactId':_0x31f606[_0xae3d('0x4f')][_0xae3d('0x6a')]}})[_0xae3d('0x28')](handleEntityNotFound(_0x47aa7a,null))[_0xae3d('0x28')](function(_0x95c4ce){if(_0x95c4ce){return _0x95c4ce;}return null;})[_0xae3d('0x28')](respondWithResult(_0x47aa7a,null))['catch'](handleError(_0x47aa7a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 44194db..10a7e6d 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 _0xa83b=['../../config/environment','./cmHopperFinal.attributes','exports','define','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','rimraf'];(function(_0x2666f8,_0x5a9495){var _0x56ac67=function(_0x2d1e65){while(--_0x2d1e65){_0x2666f8['push'](_0x2666f8['shift']());}};_0x56ac67(++_0x5a9495);}(_0xa83b,0xa3));var _0xba83=function(_0x982128,_0x24854e){_0x982128=_0x982128-0x0;var _0x44a3e0=_0xa83b[_0x982128];return _0x44a3e0;};'use strict';var _=require(_0xba83('0x0'));var util=require(_0xba83('0x1'));var logger=require(_0xba83('0x2'))(_0xba83('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(_0xba83('0x4'));var config=require(_0xba83('0x5'));var attributes=require(_0xba83('0x6'));module[_0xba83('0x7')]=function(_0x59284c,_0xa2c68d){return _0x59284c[_0xba83('0x8')]('CmHopperFinal',attributes,{'tableName':_0xba83('0x9'),'paranoid':![],'indexes':[{'name':_0xba83('0xa'),'fields':[_0xba83('0xa')]},{'name':_0xba83('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc140=['lodash','api','moment','bluebird','request-promise','rimraf','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid'];(function(_0x2d3c60,_0x4df458){var _0x560041=function(_0x5568af){while(--_0x5568af){_0x2d3c60['push'](_0x2d3c60['shift']());}};_0x560041(++_0x4df458);}(_0xc140,0xd0));var _0x0c14=function(_0x2ff4bd,_0x4780a6){_0x2ff4bd=_0x2ff4bd-0x0;var _0x28edc6=_0xc140[_0x2ff4bd];return _0x28edc6;};'use strict';var _=require(_0x0c14('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0c14('0x1'));var moment=require(_0x0c14('0x2'));var BPromise=require(_0x0c14('0x3'));var rp=require(_0x0c14('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0c14('0x5'));var config=require('../../config/environment');var attributes=require(_0x0c14('0x6'));module[_0x0c14('0x7')]=function(_0x5d1a12,_0x57d7e8){return _0x5d1a12[_0x0c14('0x8')](_0x0c14('0x9'),attributes,{'tableName':_0x0c14('0xa'),'paranoid':![],'indexes':[{'name':_0x0c14('0xb'),'fields':['calleridnum']},{'name':_0x0c14('0xc'),'fields':[_0x0c14('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 28ab283..ae24852 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0xb0b7a,_0x165a73){var _0x5efbde=function(_0xa27fdd){while(--_0xa27fdd){_0xb0b7a['push'](_0xb0b7a['shift']());}};_0x5efbde(++_0x165a73);}(_0x7a54,0x106));var _0x47a5=function(_0x1052f9,_0x4b808a){_0x1052f9=_0x1052f9-0x0;var _0x55e3e1=_0x7a54[_0x1052f9];return _0x55e3e1;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x312989,_0x482997){var _0x209c02=function(_0x470715){while(--_0x470715){_0x312989['push'](_0x312989['shift']());}};_0x209c02(++_0x482997);}(_0x7a54,0x106));var _0x47a5=function(_0x598963,_0x5cc202){_0x598963=_0x598963-0x0;var _0x274c1d=_0x7a54[_0x598963];return _0x274c1d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 71c1d39..8f915ba 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 _0x2356=['/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','index','/describe','describe','/:id','isAuthenticated','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post'];(function(_0x51c726,_0x332b95){var _0x23fe86=function(_0x3145c8){while(--_0x3145c8){_0x51c726['push'](_0x51c726['shift']());}};_0x23fe86(++_0x332b95);}(_0x2356,0x73));var _0x6235=function(_0x31f94d,_0x97563){_0x31f94d=_0x31f94d-0x0;var _0xca77c0=_0x2356[_0x31f94d];return _0xca77c0;};'use strict';var multer=require(_0x6235('0x0'));var util=require(_0x6235('0x1'));var path=require(_0x6235('0x2'));var timeout=require(_0x6235('0x3'));var express=require(_0x6235('0x4'));var router=express[_0x6235('0x5')]();var fs_extra=require(_0x6235('0x6'));var auth=require(_0x6235('0x7'));var interaction=require(_0x6235('0x8'));var config=require(_0x6235('0x9'));var controller=require(_0x6235('0xa'));router[_0x6235('0xb')]('/',auth['isAuthenticated'](),controller[_0x6235('0xc')]);router[_0x6235('0xb')](_0x6235('0xd'),auth['isAuthenticated'](),controller[_0x6235('0xe')]);router['get'](_0x6235('0xf'),auth[_0x6235('0x10')](),controller['show']);router[_0x6235('0xb')]('/voice/queue/countAttributes/:id',auth['isAuthenticated'](),controller[_0x6235('0x11')]);router[_0x6235('0xb')]('/campaign/countAttributes/:id',auth[_0x6235('0x10')](),controller[_0x6235('0x12')]);router[_0x6235('0x13')](_0x6235('0x14'),auth['isAuthenticated'](),controller[_0x6235('0x15')]);router[_0x6235('0x13')](_0x6235('0x16'),auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router['post'](_0x6235('0x17'),auth['isAuthenticated'](),controller[_0x6235('0x18')]);router[_0x6235('0x19')](_0x6235('0xf'),auth[_0x6235('0x10')](),controller[_0x6235('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x4a37=['./cmHopperFinal.controller','get','isAuthenticated','index','/:id','show','/voice/queue/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4a37,0x12e));var _0x74a3=function(_0x10f7e5,_0x4f215e){_0x10f7e5=_0x10f7e5-0x0;var _0x14aeec=_0x4a37[_0x10f7e5];return _0x14aeec;};'use strict';var multer=require(_0x74a3('0x0'));var util=require('util');var path=require(_0x74a3('0x1'));var timeout=require(_0x74a3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x74a3('0x3'));var auth=require(_0x74a3('0x4'));var interaction=require(_0x74a3('0x5'));var config=require('../../config/environment');var controller=require(_0x74a3('0x6'));router[_0x74a3('0x7')]('/',auth[_0x74a3('0x8')](),controller[_0x74a3('0x9')]);router[_0x74a3('0x7')]('/describe',auth[_0x74a3('0x8')](),controller['describe']);router[_0x74a3('0x7')](_0x74a3('0xa'),auth[_0x74a3('0x8')](),controller[_0x74a3('0xb')]);router[_0x74a3('0x7')](_0x74a3('0xc'),auth[_0x74a3('0x8')](),controller['countContactsQueueCampaignHopperFinal']);router['get']('/campaign/countAttributes/:id',auth[_0x74a3('0x8')](),controller[_0x74a3('0xd')]);router[_0x74a3('0xe')]('/voice/queue/moveContacts/:id',auth['isAuthenticated'](),controller[_0x74a3('0xf')]);router['post'](_0x74a3('0x10'),auth[_0x74a3('0x8')](),controller[_0x74a3('0x11')]);router[_0x74a3('0xe')](_0x74a3('0x12'),auth[_0x74a3('0x8')](),controller[_0x74a3('0x13')]);router[_0x74a3('0x14')](_0x74a3('0xa'),auth['isAuthenticated'](),controller['update']);module[_0x74a3('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index a441903..39870ed 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 _0x74f5=['INTEGER','STRING','DATE','BOOLEAN'];(function(_0x460f4e,_0x1ed514){var _0x51635d=function(_0x38e3ad){while(--_0x38e3ad){_0x460f4e['push'](_0x460f4e['shift']());}};_0x51635d(++_0x1ed514);}(_0x74f5,0x10c));var _0x574f=function(_0x10d07b,_0xa771c5){_0x10d07b=_0x10d07b-0x0;var _0x2c880e=_0x74f5[_0x10d07b];return _0x2c880e;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x574f('0x0')](0x2)},'statedesc':{'type':Sequelize[_0x574f('0x1')]},'scheduledat':{'type':Sequelize[_0x574f('0x2')]},'countbusyretry':{'type':Sequelize[_0x574f('0x0')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x574f('0x0')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x574f('0x0')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x574f('0x0')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x574f('0x1')]},'originatecalleridnum':{'type':Sequelize[_0x574f('0x1')]},'originatecalleridname':{'type':Sequelize[_0x574f('0x1')]},'calleridnum':{'type':Sequelize[_0x574f('0x1')]},'calleridname':{'type':Sequelize[_0x574f('0x1')]},'starttime':{'type':Sequelize[_0x574f('0x2')]},'responsetime':{'type':Sequelize[_0x574f('0x2')]},'answertime':{'type':Sequelize[_0x574f('0x2')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x574f('0x2')]},'ringtime':{'type':Sequelize[_0x574f('0x0')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x574f('0x0')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x574f('0x1')]},'membername':{'type':Sequelize[_0x574f('0x1')]},'reason':{'type':Sequelize[_0x574f('0x1')]},'amd':{'type':Sequelize[_0x574f('0x3')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x574f('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x574f('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x574f('0x2')]},'recallme':{'type':Sequelize[_0x574f('0x3')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x574f('0x2')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x574f('0x0')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x574f('0x0')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x574f('0x0')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x574f('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb89a=['DATE','STRING','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x32a48a,_0x516395){var _0x2d6ac2=function(_0x18f52e){while(--_0x18f52e){_0x32a48a['push'](_0x32a48a['shift']());}};_0x2d6ac2(++_0x516395);}(_0xb89a,0x1d1));var _0xab89=function(_0x1c6ef2,_0x8d926a){_0x1c6ef2=_0x1c6ef2-0x0;var _0x404b8c=_0xb89a[_0x1c6ef2];return _0x404b8c;};'use strict';var Sequelize=require(_0xab89('0x0'));module[_0xab89('0x1')]={'state':{'type':Sequelize[_0xab89('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xab89('0x3')]},'countbusyretry':{'type':Sequelize[_0xab89('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xab89('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xab89('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xab89('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xab89('0x4')]},'originatecalleridname':{'type':Sequelize[_0xab89('0x4')]},'calleridnum':{'type':Sequelize[_0xab89('0x4')]},'calleridname':{'type':Sequelize[_0xab89('0x4')]},'starttime':{'type':Sequelize[_0xab89('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xab89('0x3')]},'droptime':{'type':Sequelize[_0xab89('0x3')]},'endtime':{'type':Sequelize[_0xab89('0x3')]},'ringtime':{'type':Sequelize[_0xab89('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xab89('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xab89('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xab89('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xab89('0x4')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xab89('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xab89('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xab89('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xab89('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0xab89('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xab89('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xab89('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xab89('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xab89('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 3b87f5f..29da163 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 _0xc6b6=['filters','intersection','attributes','fields','nolimit','offset','order','sort','where','pick','VIRTUAL','filter','options','CmHopperHistory','count','includeAll','include','rows','catch','params','length','merge','create','body','describe','update','uniqueid','find','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','set','Content-Range','json','apply','reject','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query'];(function(_0x22ebf2,_0x430ca6){var _0x445103=function(_0xe11157){while(--_0xe11157){_0x22ebf2['push'](_0x22ebf2['shift']());}};_0x445103(++_0x430ca6);}(_0xc6b6,0x1a7));var _0x6c6b=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc6b6[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0x6c6b('0x0'));var rimraf=require(_0x6c6b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6c6b('0x2'));var rp=require(_0x6c6b('0x3'));var moment=require(_0x6c6b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6c6b('0x5'));var util=require(_0x6c6b('0x6'));var path=require(_0x6c6b('0x7'));var sox=require(_0x6c6b('0x8'));var csv=require(_0x6c6b('0x9'));var ejs=require(_0x6c6b('0xa'));var fs=require('fs');var fs_extra=require(_0x6c6b('0xb'));var _=require(_0x6c6b('0xc'));var squel=require('squel');var crypto=require(_0x6c6b('0xd'));var jsforce=require(_0x6c6b('0xe'));var deskjs=require(_0x6c6b('0xf'));var toCsv=require(_0x6c6b('0x9'));var querystring=require(_0x6c6b('0x10'));var Papa=require(_0x6c6b('0x11'));var Redis=require('ioredis');var authService=require(_0x6c6b('0x12'));var qs=require(_0x6c6b('0x13'));var as=require(_0x6c6b('0x14'));var hardwareService=require(_0x6c6b('0x15'));var logger=require(_0x6c6b('0x16'))(_0x6c6b('0x17'));var utils=require(_0x6c6b('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x6c6b('0x19'));var db=require(_0x6c6b('0x1a'))['db'];function respondWithStatusCode(_0x5d755b,_0x5e332e){_0x5e332e=_0x5e332e||0xcc;return function(_0x5d8361){if(_0x5d8361){return _0x5d755b[_0x6c6b('0x1b')](_0x5e332e);}return _0x5d755b[_0x6c6b('0x1c')](_0x5e332e)['end']();};}function respondWithResult(_0x43e919,_0x4f8332){_0x4f8332=_0x4f8332||0xc8;return function(_0x5dbd2c){if(_0x5dbd2c){return _0x43e919[_0x6c6b('0x1c')](_0x4f8332)['json'](_0x5dbd2c);}};}function respondWithFilteredResult(_0x41426c,_0xcbda28){return function(_0x2b00ac){if(_0x2b00ac){var _0x16e2d5=typeof _0xcbda28['offset']===_0x6c6b('0x1d')&&typeof _0xcbda28[_0x6c6b('0x1e')]===_0x6c6b('0x1d');var _0x55e6fa=_0x2b00ac['count'];var _0x324103=_0x16e2d5?0x0:_0xcbda28['offset'];var _0x28b414=_0x16e2d5?_0x2b00ac['count']:_0xcbda28['offset']+_0xcbda28[_0x6c6b('0x1e')];var _0x292a15;if(_0x28b414>=_0x55e6fa){_0x28b414=_0x55e6fa;_0x292a15=0xc8;}else{_0x292a15=0xce;}_0x41426c['status'](_0x292a15);return _0x41426c[_0x6c6b('0x1f')](_0x6c6b('0x20'),_0x324103+'-'+_0x28b414+'/'+_0x55e6fa)[_0x6c6b('0x21')](_0x2b00ac);}return null;};}function patchUpdates(_0x171790){return function(_0x3a564e){try{jsonpatch[_0x6c6b('0x22')](_0x3a564e,_0x171790,!![]);}catch(_0x10cbc5){return BPromise[_0x6c6b('0x23')](_0x10cbc5);}return _0x3a564e['save']();};}function saveUpdates(_0x4c7ca0,_0x4936a0){return function(_0x1704a7){if(_0x1704a7){return _0x1704a7['update'](_0x4c7ca0)[_0x6c6b('0x24')](function(_0x377bca){return _0x377bca;});}return null;};}function removeEntity(_0x592395,_0x1d13cd){return function(_0x681d3){if(_0x681d3){return _0x681d3[_0x6c6b('0x25')]()[_0x6c6b('0x24')](function(){_0x592395['status'](0xcc)[_0x6c6b('0x26')]();});}};}function handleEntityNotFound(_0xc58331,_0x54a907){return function(_0x4a4896){if(!_0x4a4896){_0xc58331['sendStatus'](0x194);}return _0x4a4896;};}function handleError(_0x43ee5f,_0x52777e){_0x52777e=_0x52777e||0x1f4;return function(_0x37ba2c){logger[_0x6c6b('0x27')](_0x37ba2c[_0x6c6b('0x28')]);if(_0x37ba2c[_0x6c6b('0x29')]){delete _0x37ba2c[_0x6c6b('0x29')];}_0x43ee5f[_0x6c6b('0x1c')](_0x52777e)[_0x6c6b('0x2a')](_0x37ba2c);};}exports['index']=function(_0x33d596,_0xdcb669){var _0x536558={},_0x300980={},_0x39bb2b={'count':0x0,'rows':[]};var _0x4713db=_[_0x6c6b('0x2b')](db['CmHopperHistory'][_0x6c6b('0x2c')],function(_0x55626b){return{'name':_0x55626b[_0x6c6b('0x2d')],'type':_0x55626b[_0x6c6b('0x2e')][_0x6c6b('0x2f')]};});_0x300980[_0x6c6b('0x30')]=_[_0x6c6b('0x2b')](_0x4713db,_0x6c6b('0x29'));_0x300980['query']=_[_0x6c6b('0x31')](_0x33d596[_0x6c6b('0x32')]);_0x300980[_0x6c6b('0x33')]=_[_0x6c6b('0x34')](_0x300980[_0x6c6b('0x30')],_0x300980['query']);_0x536558[_0x6c6b('0x35')]=_[_0x6c6b('0x34')](_0x300980[_0x6c6b('0x30')],qs[_0x6c6b('0x36')](_0x33d596[_0x6c6b('0x32')][_0x6c6b('0x36')]));_0x536558[_0x6c6b('0x35')]=_0x536558[_0x6c6b('0x35')]['length']?_0x536558[_0x6c6b('0x35')]:_0x300980[_0x6c6b('0x30')];if(!_0x33d596['query']['hasOwnProperty'](_0x6c6b('0x37'))){_0x536558[_0x6c6b('0x1e')]=qs['limit'](_0x33d596[_0x6c6b('0x32')][_0x6c6b('0x1e')]);_0x536558[_0x6c6b('0x38')]=qs['offset'](_0x33d596[_0x6c6b('0x32')][_0x6c6b('0x38')]);}_0x536558[_0x6c6b('0x39')]=qs['sort'](_0x33d596[_0x6c6b('0x32')][_0x6c6b('0x3a')]);_0x536558[_0x6c6b('0x3b')]=qs['filters'](_[_0x6c6b('0x3c')](_0x33d596['query'],_0x300980[_0x6c6b('0x33')]),_0x4713db);if(_0x33d596[_0x6c6b('0x32')]['filter']){_0x536558[_0x6c6b('0x3b')]=_['merge'](_0x536558[_0x6c6b('0x3b')],{'$or':_[_0x6c6b('0x2b')](_0x4713db,function(_0x440656){if(_0x440656['type']!==_0x6c6b('0x3d')){var _0x37492b={};_0x37492b[_0x440656[_0x6c6b('0x29')]]={'$like':'%'+_0x33d596[_0x6c6b('0x32')][_0x6c6b('0x3e')]+'%'};return _0x37492b;}})});}_0x536558=_['merge']({},_0x536558,_0x33d596[_0x6c6b('0x3f')]);var _0x364294={'where':_0x536558[_0x6c6b('0x3b')]};return db[_0x6c6b('0x40')][_0x6c6b('0x41')](_0x364294)[_0x6c6b('0x24')](function(_0x183694){_0x39bb2b[_0x6c6b('0x41')]=_0x183694;if(_0x33d596['query'][_0x6c6b('0x42')]){_0x536558[_0x6c6b('0x43')]=[{'all':!![]}];}return db[_0x6c6b('0x40')]['findAll'](_0x536558);})['then'](function(_0x1f6f55){_0x39bb2b[_0x6c6b('0x44')]=_0x1f6f55;return _0x39bb2b;})[_0x6c6b('0x24')](respondWithFilteredResult(_0xdcb669,_0x536558))[_0x6c6b('0x45')](handleError(_0xdcb669,null));};exports['show']=function(_0x22263f,_0x1a2ddd){var _0x1b5e08={'raw':!![],'where':{'id':_0x22263f[_0x6c6b('0x46')]['id']}},_0x5b3e95={};_0x5b3e95[_0x6c6b('0x30')]=_[_0x6c6b('0x31')](db[_0x6c6b('0x40')][_0x6c6b('0x2c')]);_0x5b3e95[_0x6c6b('0x32')]=_[_0x6c6b('0x31')](_0x22263f[_0x6c6b('0x32')]);_0x5b3e95[_0x6c6b('0x33')]=_[_0x6c6b('0x34')](_0x5b3e95['model'],_0x5b3e95[_0x6c6b('0x32')]);_0x1b5e08[_0x6c6b('0x35')]=_[_0x6c6b('0x34')](_0x5b3e95[_0x6c6b('0x30')],qs[_0x6c6b('0x36')](_0x22263f['query']['fields']));_0x1b5e08[_0x6c6b('0x35')]=_0x1b5e08[_0x6c6b('0x35')][_0x6c6b('0x47')]?_0x1b5e08[_0x6c6b('0x35')]:_0x5b3e95[_0x6c6b('0x30')];if(_0x22263f[_0x6c6b('0x32')][_0x6c6b('0x42')]){_0x1b5e08['include']=[{'all':!![]}];}_0x1b5e08=_[_0x6c6b('0x48')]({},_0x1b5e08,_0x22263f[_0x6c6b('0x3f')]);return db[_0x6c6b('0x40')]['find'](_0x1b5e08)[_0x6c6b('0x24')](handleEntityNotFound(_0x1a2ddd,null))['then'](respondWithResult(_0x1a2ddd,null))[_0x6c6b('0x45')](handleError(_0x1a2ddd,null));};exports[_0x6c6b('0x49')]=function(_0x4c7314,_0x3473ac){return db[_0x6c6b('0x40')][_0x6c6b('0x49')](_0x4c7314[_0x6c6b('0x4a')],{})[_0x6c6b('0x24')](respondWithResult(_0x3473ac,0xc9))[_0x6c6b('0x45')](handleError(_0x3473ac,null));};exports[_0x6c6b('0x4b')]=function(_0x5899ba,_0x3ee9bf){return db[_0x6c6b('0x40')][_0x6c6b('0x4b')]()[_0x6c6b('0x24')](respondWithResult(_0x3ee9bf,null))[_0x6c6b('0x45')](handleError(_0x3ee9bf,null));};exports[_0x6c6b('0x4c')]=function(_0x424659,_0x2c54b9){if(_0x424659['body'][_0x6c6b('0x4d')]){delete _0x424659[_0x6c6b('0x4a')][_0x6c6b('0x4d')];}return db['CmHopperHistory'][_0x6c6b('0x4e')]({'where':{'uniqueid':_0x424659['params']['id']}})['then'](handleEntityNotFound(_0x2c54b9,null))[_0x6c6b('0x24')](saveUpdates(_0x424659[_0x6c6b('0x4a')],null))[_0x6c6b('0x24')](respondWithResult(_0x2c54b9,null))[_0x6c6b('0x45')](handleError(_0x2c54b9,null));}; \ No newline at end of file +var _0xa193=['squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','destroy','error','stack','name','send','index','map','CmHopperHistory','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','catch','show','params','rawAttributes','keys','fields','create','describe','body','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra'];(function(_0x4d1839,_0x1522bb){var _0x3adf77=function(_0x41ac4e){while(--_0x41ac4e){_0x4d1839['push'](_0x4d1839['shift']());}};_0x3adf77(++_0x1522bb);}(_0xa193,0xd8));var _0x3a19=function(_0x17f940,_0x4e5de9){_0x17f940=_0x17f940-0x0;var _0x1aa701=_0xa193[_0x17f940];return _0x1aa701;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3a19('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3a19('0x1'));var moment=require('moment');var BPromise=require(_0x3a19('0x2'));var Mustache=require(_0x3a19('0x3'));var util=require(_0x3a19('0x4'));var path=require(_0x3a19('0x5'));var sox=require(_0x3a19('0x6'));var csv=require('to-csv');var ejs=require(_0x3a19('0x7'));var fs=require('fs');var fs_extra=require(_0x3a19('0x8'));var _=require('lodash');var squel=require(_0x3a19('0x9'));var crypto=require(_0x3a19('0xa'));var jsforce=require(_0x3a19('0xb'));var deskjs=require(_0x3a19('0xc'));var toCsv=require(_0x3a19('0xd'));var querystring=require(_0x3a19('0xe'));var Papa=require(_0x3a19('0xf'));var Redis=require(_0x3a19('0x10'));var authService=require(_0x3a19('0x11'));var qs=require(_0x3a19('0x12'));var as=require(_0x3a19('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3a19('0x14'))(_0x3a19('0x15'));var utils=require(_0x3a19('0x16'));var config=require(_0x3a19('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3a19('0x18'))['db'];function respondWithStatusCode(_0x19360e,_0x57dfdc){_0x57dfdc=_0x57dfdc||0xcc;return function(_0x249af7){if(_0x249af7){return _0x19360e[_0x3a19('0x19')](_0x57dfdc);}return _0x19360e[_0x3a19('0x1a')](_0x57dfdc)[_0x3a19('0x1b')]();};}function respondWithResult(_0x234bb8,_0x2c5855){_0x2c5855=_0x2c5855||0xc8;return function(_0x3642dd){if(_0x3642dd){return _0x234bb8[_0x3a19('0x1a')](_0x2c5855)['json'](_0x3642dd);}};}function respondWithFilteredResult(_0x427574,_0x2f304d){return function(_0x11eb71){if(_0x11eb71){var _0x1e0647=typeof _0x2f304d[_0x3a19('0x1c')]===_0x3a19('0x1d')&&typeof _0x2f304d[_0x3a19('0x1e')]===_0x3a19('0x1d');var _0x436088=_0x11eb71['count'];var _0x3fcae7=_0x1e0647?0x0:_0x2f304d[_0x3a19('0x1c')];var _0x58194c=_0x1e0647?_0x11eb71[_0x3a19('0x1f')]:_0x2f304d[_0x3a19('0x1c')]+_0x2f304d['limit'];var _0x4db4d5;if(_0x58194c>=_0x436088){_0x58194c=_0x436088;_0x4db4d5=0xc8;}else{_0x4db4d5=0xce;}_0x427574[_0x3a19('0x1a')](_0x4db4d5);return _0x427574[_0x3a19('0x20')](_0x3a19('0x21'),_0x3fcae7+'-'+_0x58194c+'/'+_0x436088)[_0x3a19('0x22')](_0x11eb71);}return null;};}function patchUpdates(_0x209dee){return function(_0x2eb0dd){try{jsonpatch['apply'](_0x2eb0dd,_0x209dee,!![]);}catch(_0x162249){return BPromise[_0x3a19('0x23')](_0x162249);}return _0x2eb0dd['save']();};}function saveUpdates(_0x5107d,_0x2d7704){return function(_0x2eab8b){if(_0x2eab8b){return _0x2eab8b[_0x3a19('0x24')](_0x5107d)[_0x3a19('0x25')](function(_0x2f8287){return _0x2f8287;});}return null;};}function removeEntity(_0x1f95ee,_0x386cf1){return function(_0x4af9a8){if(_0x4af9a8){return _0x4af9a8[_0x3a19('0x26')]()[_0x3a19('0x25')](function(){_0x1f95ee[_0x3a19('0x1a')](0xcc)[_0x3a19('0x1b')]();});}};}function handleEntityNotFound(_0x57694c,_0x266a1e){return function(_0x3981e3){if(!_0x3981e3){_0x57694c['sendStatus'](0x194);}return _0x3981e3;};}function handleError(_0x457d4c,_0x2d8f66){_0x2d8f66=_0x2d8f66||0x1f4;return function(_0x323c95){logger[_0x3a19('0x27')](_0x323c95[_0x3a19('0x28')]);if(_0x323c95[_0x3a19('0x29')]){delete _0x323c95['name'];}_0x457d4c[_0x3a19('0x1a')](_0x2d8f66)[_0x3a19('0x2a')](_0x323c95);};}exports[_0x3a19('0x2b')]=function(_0x48e75a,_0x81ae5f){var _0x2a4ad3={},_0x46e48e={},_0x2a6688={'count':0x0,'rows':[]};var _0x57915b=_[_0x3a19('0x2c')](db[_0x3a19('0x2d')]['rawAttributes'],function(_0x2cde42){return{'name':_0x2cde42[_0x3a19('0x2e')],'type':_0x2cde42[_0x3a19('0x2f')][_0x3a19('0x30')]};});_0x46e48e[_0x3a19('0x31')]=_[_0x3a19('0x2c')](_0x57915b,'name');_0x46e48e['query']=_['keys'](_0x48e75a[_0x3a19('0x32')]);_0x46e48e[_0x3a19('0x33')]=_[_0x3a19('0x34')](_0x46e48e[_0x3a19('0x31')],_0x46e48e[_0x3a19('0x32')]);_0x2a4ad3[_0x3a19('0x35')]=_[_0x3a19('0x34')](_0x46e48e[_0x3a19('0x31')],qs['fields'](_0x48e75a['query']['fields']));_0x2a4ad3[_0x3a19('0x35')]=_0x2a4ad3['attributes'][_0x3a19('0x36')]?_0x2a4ad3['attributes']:_0x46e48e[_0x3a19('0x31')];if(!_0x48e75a[_0x3a19('0x32')][_0x3a19('0x37')](_0x3a19('0x38'))){_0x2a4ad3['limit']=qs[_0x3a19('0x1e')](_0x48e75a[_0x3a19('0x32')][_0x3a19('0x1e')]);_0x2a4ad3[_0x3a19('0x1c')]=qs[_0x3a19('0x1c')](_0x48e75a['query'][_0x3a19('0x1c')]);}_0x2a4ad3[_0x3a19('0x39')]=qs[_0x3a19('0x3a')](_0x48e75a['query']['sort']);_0x2a4ad3[_0x3a19('0x3b')]=qs[_0x3a19('0x33')](_['pick'](_0x48e75a[_0x3a19('0x32')],_0x46e48e[_0x3a19('0x33')]),_0x57915b);if(_0x48e75a['query'][_0x3a19('0x3c')]){_0x2a4ad3[_0x3a19('0x3b')]=_['merge'](_0x2a4ad3[_0x3a19('0x3b')],{'$or':_[_0x3a19('0x2c')](_0x57915b,function(_0x5c6b96){if(_0x5c6b96[_0x3a19('0x2f')]!==_0x3a19('0x3d')){var _0x50d76e={};_0x50d76e[_0x5c6b96[_0x3a19('0x29')]]={'$like':'%'+_0x48e75a[_0x3a19('0x32')]['filter']+'%'};return _0x50d76e;}})});}_0x2a4ad3=_[_0x3a19('0x3e')]({},_0x2a4ad3,_0x48e75a[_0x3a19('0x3f')]);var _0x16d8d9={'where':_0x2a4ad3[_0x3a19('0x3b')]};return db['CmHopperHistory'][_0x3a19('0x1f')](_0x16d8d9)[_0x3a19('0x25')](function(_0x6342d1){_0x2a6688['count']=_0x6342d1;if(_0x48e75a[_0x3a19('0x32')][_0x3a19('0x40')]){_0x2a4ad3[_0x3a19('0x41')]=[{'all':!![]}];}return db[_0x3a19('0x2d')]['findAll'](_0x2a4ad3);})[_0x3a19('0x25')](function(_0x32e061){_0x2a6688['rows']=_0x32e061;return _0x2a6688;})['then'](respondWithFilteredResult(_0x81ae5f,_0x2a4ad3))[_0x3a19('0x42')](handleError(_0x81ae5f,null));};exports[_0x3a19('0x43')]=function(_0x495bd9,_0x244998){var _0x260a99={'raw':!![],'where':{'id':_0x495bd9[_0x3a19('0x44')]['id']}},_0x2a44bf={};_0x2a44bf[_0x3a19('0x31')]=_['keys'](db['CmHopperHistory'][_0x3a19('0x45')]);_0x2a44bf[_0x3a19('0x32')]=_[_0x3a19('0x46')](_0x495bd9['query']);_0x2a44bf[_0x3a19('0x33')]=_[_0x3a19('0x34')](_0x2a44bf[_0x3a19('0x31')],_0x2a44bf[_0x3a19('0x32')]);_0x260a99[_0x3a19('0x35')]=_[_0x3a19('0x34')](_0x2a44bf[_0x3a19('0x31')],qs[_0x3a19('0x47')](_0x495bd9[_0x3a19('0x32')]['fields']));_0x260a99[_0x3a19('0x35')]=_0x260a99[_0x3a19('0x35')][_0x3a19('0x36')]?_0x260a99[_0x3a19('0x35')]:_0x2a44bf['model'];if(_0x495bd9[_0x3a19('0x32')][_0x3a19('0x40')]){_0x260a99[_0x3a19('0x41')]=[{'all':!![]}];}_0x260a99=_[_0x3a19('0x3e')]({},_0x260a99,_0x495bd9[_0x3a19('0x3f')]);return db[_0x3a19('0x2d')]['find'](_0x260a99)[_0x3a19('0x25')](handleEntityNotFound(_0x244998,null))['then'](respondWithResult(_0x244998,null))[_0x3a19('0x42')](handleError(_0x244998,null));};exports[_0x3a19('0x48')]=function(_0x12c543,_0x69b2b0){return db['CmHopperHistory'][_0x3a19('0x48')](_0x12c543['body'],{})[_0x3a19('0x25')](respondWithResult(_0x69b2b0,0xc9))[_0x3a19('0x42')](handleError(_0x69b2b0,null));};exports[_0x3a19('0x49')]=function(_0x4f9a98,_0x12b5fe){return db[_0x3a19('0x2d')][_0x3a19('0x49')]()[_0x3a19('0x25')](respondWithResult(_0x12b5fe,null))[_0x3a19('0x42')](handleError(_0x12b5fe,null));};exports[_0x3a19('0x24')]=function(_0x149d51,_0x300f7e){if(_0x149d51[_0x3a19('0x4a')]['uniqueid']){delete _0x149d51['body']['uniqueid'];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x149d51['params']['id']}})['then'](handleEntityNotFound(_0x300f7e,null))[_0x3a19('0x25')](saveUpdates(_0x149d51[_0x3a19('0x4a')],null))[_0x3a19('0x25')](respondWithResult(_0x300f7e,null))[_0x3a19('0x42')](handleError(_0x300f7e,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 639cd33..c1e0ce1 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 _0xa613=['cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define'];(function(_0x2b4909,_0xb81a58){var _0x160be6=function(_0x4fa5a5){while(--_0x4fa5a5){_0x2b4909['push'](_0x2b4909['shift']());}};_0x160be6(++_0xb81a58);}(_0xa613,0x8a));var _0x3a61=function(_0x5d92c2,_0x26d815){_0x5d92c2=_0x5d92c2-0x0;var _0x415601=_0xa613[_0x5d92c2];return _0x415601;};'use strict';var _=require(_0x3a61('0x0'));var util=require('util');var logger=require(_0x3a61('0x1'))(_0x3a61('0x2'));var moment=require(_0x3a61('0x3'));var BPromise=require(_0x3a61('0x4'));var rp=require(_0x3a61('0x5'));var fs=require('fs');var path=require(_0x3a61('0x6'));var rimraf=require(_0x3a61('0x7'));var config=require(_0x3a61('0x8'));var attributes=require(_0x3a61('0x9'));module[_0x3a61('0xa')]=function(_0x50a744,_0x37904a){return _0x50a744[_0x3a61('0xb')]('CmHopperHistory',attributes,{'tableName':_0x3a61('0xc'),'paranoid':![],'indexes':[{'name':_0x3a61('0xd'),'fields':[_0x3a61('0xd')]},{'name':_0x3a61('0xe'),'fields':[_0x3a61('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0eeb=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','cm_hopper_history','endtime'];(function(_0x425716,_0x3e9d1c){var _0x2d39af=function(_0x1febc1){while(--_0x1febc1){_0x425716['push'](_0x425716['shift']());}};_0x2d39af(++_0x3e9d1c);}(_0x0eeb,0xc5));var _0xb0ee=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x0eeb[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xb0ee('0x0'));var util=require(_0xb0ee('0x1'));var logger=require(_0xb0ee('0x2'))(_0xb0ee('0x3'));var moment=require(_0xb0ee('0x4'));var BPromise=require(_0xb0ee('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb0ee('0x6'));var config=require(_0xb0ee('0x7'));var attributes=require(_0xb0ee('0x8'));module[_0xb0ee('0x9')]=function(_0x209dda,_0x453fa4){return _0x209dda[_0xb0ee('0xa')]('CmHopperHistory',attributes,{'tableName':_0xb0ee('0xb'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0xb0ee('0xc')]},{'name':_0xb0ee('0xd'),'fields':[_0xb0ee('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 19d12ec..1ef50cd 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 _0x6ea9=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','CmHopperHistory','create','body','raw','CreateCmHopperHistory','catch','AvgHandleTime','findAll','options','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','name','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring'];(function(_0x30b1a4,_0x2a3b25){var _0x7da915=function(_0x4e3834){while(--_0x4e3834){_0x30b1a4['push'](_0x30b1a4['shift']());}};_0x7da915(++_0x2a3b25);}(_0x6ea9,0x89));var _0x96ea=function(_0x52885e,_0x3380da){_0x52885e=_0x52885e-0x0;var _0x363e23=_0x6ea9[_0x52885e];return _0x363e23;};'use strict';var _=require(_0x96ea('0x0'));var util=require(_0x96ea('0x1'));var moment=require(_0x96ea('0x2'));var BPromise=require(_0x96ea('0x3'));var rs=require(_0x96ea('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x96ea('0x5'))['db'];var utils=require(_0x96ea('0x6'));var logger=require(_0x96ea('0x7'))('rpc');var config=require(_0x96ea('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x96ea('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x124a0d,_0x5da08c,_0x5cd8f3){return new BPromise(function(_0x1504a9,_0xa73260){return client[_0x96ea('0xa')](_0x124a0d,_0x5cd8f3)[_0x96ea('0xb')](function(_0x34f728){logger['info'](_0x96ea('0xc'),_0x5da08c,_0x96ea('0xd'));logger[_0x96ea('0xe')](_0x96ea('0xf'),_0x5da08c,_0x96ea('0xd'),JSON[_0x96ea('0x10')](_0x34f728));if(_0x34f728[_0x96ea('0x11')]){if(_0x34f728[_0x96ea('0x11')][_0x96ea('0x12')]===0x1f4){logger[_0x96ea('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x5da08c,_0x34f728[_0x96ea('0x11')]['message']);return _0xa73260(_0x34f728[_0x96ea('0x11')][_0x96ea('0x13')]);}logger['error'](_0x96ea('0xc'),_0x5da08c,_0x34f728[_0x96ea('0x11')][_0x96ea('0x13')]);return _0x1504a9(_0x34f728[_0x96ea('0x11')][_0x96ea('0x13')]);}else{logger[_0x96ea('0x14')](_0x96ea('0xc'),_0x5da08c,_0x96ea('0xd'));_0x1504a9(_0x34f728['result'][_0x96ea('0x13')]);}})['catch'](function(_0x5cbeca){logger[_0x96ea('0x11')](_0x96ea('0xc'),_0x5da08c,_0x5cbeca);_0xa73260(_0x5cbeca);});});}exports['CreateCmHopperHistory']=function(_0x47444c){var _0x4476da=this;return new Promise(function(_0x24c940,_0x3b7811){return db[_0x96ea('0x15')][_0x96ea('0x16')](_0x47444c[_0x96ea('0x17')],{'raw':_0x47444c['options']?_0x47444c['options'][_0x96ea('0x18')]===undefined?!![]:![]:!![]})[_0x96ea('0xb')](function(_0xfaec11){logger[_0x96ea('0x14')](_0x96ea('0x19'),_0x47444c);logger[_0x96ea('0xe')](_0x96ea('0x19'),_0x47444c,JSON[_0x96ea('0x10')](_0xfaec11));_0x24c940(_0xfaec11);})[_0x96ea('0x1a')](function(_0x3a618c){logger[_0x96ea('0x11')]('CreateCmHopperHistory',_0x3a618c[_0x96ea('0x13')],_0x47444c);_0x3b7811(_0x4476da[_0x96ea('0x11')](0x1f4,_0x3a618c[_0x96ea('0x13')]));});});};exports[_0x96ea('0x1b')]=function(_0x396117){var _0x1676e7=this;return new Promise(function(_0x56cbc7,_0x33e05b){return db['CmHopperHistory'][_0x96ea('0x1c')]({'raw':_0x396117[_0x96ea('0x1d')]?_0x396117['options']['raw']===undefined?!![]:![]:!![],'where':_0x396117[_0x96ea('0x1d')]?_0x396117[_0x96ea('0x1d')][_0x96ea('0x1e')]||null:null,'attributes':[[db[_0x96ea('0x1f')]['fn'](_0x96ea('0x20'),db['sequelize'][_0x96ea('0x21')]('id')),_0x96ea('0x22')],[db[_0x96ea('0x1f')]['fn'](_0x96ea('0x20'),db[_0x96ea('0x1f')]['fn']('IF',db[_0x96ea('0x1f')][_0x96ea('0x23')](_0x96ea('0x24')))),_0x96ea('0x25')],[db[_0x96ea('0x1f')]['fn'](_0x96ea('0x20'),db[_0x96ea('0x1f')]['fn']('IF',db[_0x96ea('0x1f')][_0x96ea('0x23')](_0x96ea('0x26')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x96ea('0x1f')]['fn'](_0x96ea('0x20'),db[_0x96ea('0x1f')]['fn']('IF',db['sequelize'][_0x96ea('0x23')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x96ea('0x1f')]['fn'](_0x96ea('0x27'),db['sequelize']['fn']('IF',db[_0x96ea('0x1f')][_0x96ea('0x23')](_0x96ea('0x28')))),_0x96ea('0x29')],[db[_0x96ea('0x1f')]['fn'](_0x96ea('0x27'),db[_0x96ea('0x1f')]['fn']('IF',db[_0x96ea('0x1f')]['literal'](_0x96ea('0x2a')))),_0x96ea('0x2b')]]})['then'](function(_0x2547f7){logger[_0x96ea('0x14')](_0x96ea('0x1b'),_0x396117);logger[_0x96ea('0xe')](_0x96ea('0x1b'),_0x396117,JSON[_0x96ea('0x10')](_0x2547f7));_0x56cbc7(_0x2547f7);})[_0x96ea('0x1a')](function(_0x58aede){logger[_0x96ea('0x11')](_0x96ea('0x1b'),_0x58aede[_0x96ea('0x13')],_0x396117);_0x33e05b(_0x1676e7[_0x96ea('0x11')](0x1f4,_0x58aede[_0x96ea('0x13')]));});});};exports[_0x96ea('0x2c')]=function(_0x461540){var _0x2deed9=this;return new Promise(function(_0x27a9d5,_0x1eb16e){return db[_0x96ea('0x15')][_0x96ea('0x1c')]({'raw':_0x461540[_0x96ea('0x1d')]?_0x461540[_0x96ea('0x1d')][_0x96ea('0x18')]===undefined?!![]:![]:!![],'where':_0x461540[_0x96ea('0x1d')]?_0x461540[_0x96ea('0x1d')][_0x96ea('0x1e')]||null:null,'attributes':[[_0x96ea('0x2d'),'name'],[db[_0x96ea('0x1f')]['fn']('COUNT',db[_0x96ea('0x1f')]['fn']('IF',db[_0x96ea('0x1f')][_0x96ea('0x23')](_0x96ea('0x2e')))),_0x96ea('0x2f')],[db['sequelize']['fn'](_0x96ea('0x20'),db[_0x96ea('0x1f')]['fn']('IF',db[_0x96ea('0x1f')]['literal'](_0x96ea('0x30')))),'outboundNoAnswerCallsDay'],[db[_0x96ea('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x96ea('0x1f')][_0x96ea('0x23')](_0x96ea('0x24')))),_0x96ea('0x31')],[db['sequelize']['fn'](_0x96ea('0x20'),db[_0x96ea('0x1f')]['fn']('IF',db[_0x96ea('0x1f')][_0x96ea('0x23')](_0x96ea('0x32')))),'outboundBusyCallsDay'],[db[_0x96ea('0x1f')]['fn'](_0x96ea('0x20'),db[_0x96ea('0x1f')]['fn']('IF',db[_0x96ea('0x1f')]['literal'](_0x96ea('0x33')))),_0x96ea('0x34')],[db['sequelize']['fn']('COUNT',db[_0x96ea('0x1f')]['fn']('IF',db[_0x96ea('0x1f')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x96ea('0x35')],[db[_0x96ea('0x1f')]['fn'](_0x96ea('0x20'),db['sequelize']['fn']('IF',db[_0x96ea('0x1f')][_0x96ea('0x23')](_0x96ea('0x36')))),_0x96ea('0x37')],[db['sequelize']['fn'](_0x96ea('0x20'),db[_0x96ea('0x1f')]['fn']('IF',db[_0x96ea('0x1f')]['literal'](_0x96ea('0x38')))),_0x96ea('0x39')],[db[_0x96ea('0x1f')]['fn']('COUNT',db[_0x96ea('0x1f')]['fn']('IF',db[_0x96ea('0x1f')][_0x96ea('0x23')](_0x96ea('0x3a')))),_0x96ea('0x3b')],[db[_0x96ea('0x1f')]['fn'](_0x96ea('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x96ea('0x23')](_0x96ea('0x3c')))),_0x96ea('0x3d')],[db[_0x96ea('0x1f')]['fn'](_0x96ea('0x20'),db[_0x96ea('0x1f')]['fn']('IF',db[_0x96ea('0x1f')]['literal']('`state`\x20=\x2018,\x201,\x20null'))),_0x96ea('0x3e')],[db[_0x96ea('0x1f')]['fn'](_0x96ea('0x20'),db[_0x96ea('0x1f')]['fn']('IF',db[_0x96ea('0x1f')][_0x96ea('0x23')](_0x96ea('0x3f')))),'outboundAnswerAgiCallsDay'],[db[_0x96ea('0x1f')]['fn'](_0x96ea('0x20'),db['sequelize']['fn']('IF',db[_0x96ea('0x1f')][_0x96ea('0x23')](_0x96ea('0x40')))),'outboundRejectCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x96ea('0x1f')]['fn']('IF',db[_0x96ea('0x1f')][_0x96ea('0x23')](_0x96ea('0x41')))),_0x96ea('0x42')]],'group':[_0x96ea('0x2d')]})['then'](function(_0x3ef29b){logger[_0x96ea('0x14')](_0x96ea('0x2c'),_0x461540);logger['debug'](_0x96ea('0x2c'),_0x461540,JSON[_0x96ea('0x10')](_0x3ef29b));_0x27a9d5(_0x3ef29b);})[_0x96ea('0x1a')](function(_0x28db59){logger[_0x96ea('0x11')](_0x96ea('0x2c'),_0x28db59['message'],_0x461540);_0x1eb16e(_0x2deed9['error'](0x1f4,_0x28db59['message']));});});};exports[_0x96ea('0x43')]=function(_0x5d96fc){var _0x2ff5bf=this;return new Promise(function(_0xcc2876,_0x24c99d){return db[_0x96ea('0x15')][_0x96ea('0x1c')]({'raw':_0x5d96fc['options']?_0x5d96fc[_0x96ea('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5d96fc[_0x96ea('0x1d')]?_0x5d96fc['options'][_0x96ea('0x1e')]||null:null,'attributes':[[_0x96ea('0x2d'),_0x96ea('0x44')],[db[_0x96ea('0x1f')]['fn'](_0x96ea('0x20'),db[_0x96ea('0x1f')]['col']('id')),_0x96ea('0x45')],[db[_0x96ea('0x1f')]['fn'](_0x96ea('0x20'),db[_0x96ea('0x1f')]['fn']('IF',db[_0x96ea('0x1f')][_0x96ea('0x23')]('`state`\x20=\x204,\x201,\x20null'))),_0x96ea('0x46')]],'group':[_0x96ea('0x2d')]})[_0x96ea('0xb')](function(_0x2b5473){logger['info'](_0x96ea('0x43'),_0x5d96fc);logger[_0x96ea('0xe')](_0x96ea('0x43'),_0x5d96fc,JSON[_0x96ea('0x10')](_0x2b5473));_0xcc2876(_0x2b5473);})[_0x96ea('0x1a')](function(_0x39f934){logger[_0x96ea('0x11')](_0x96ea('0x43'),_0x39f934['message'],_0x5d96fc);_0x24c99d(_0x2ff5bf['error'](0x1f4,_0x39f934[_0x96ea('0x13')]));});});}; \ No newline at end of file +var _0xd1d4=['`state`\x20=\x203,\x201,\x20null','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','where','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','create','body','options','raw','AvgHandleTime','CmHopperHistory','findAll','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay'];(function(_0x3f9715,_0x431051){var _0x2d1e42=function(_0x5d85f8){while(--_0x5d85f8){_0x3f9715['push'](_0x3f9715['shift']());}};_0x2d1e42(++_0x431051);}(_0xd1d4,0xfb));var _0x4d1d=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xd1d4[_0x1abb09];return _0xea1c07;};'use strict';var _=require(_0x4d1d('0x0'));var util=require(_0x4d1d('0x1'));var moment=require('moment');var BPromise=require(_0x4d1d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4d1d('0x3'))['db'];var utils=require(_0x4d1d('0x4'));var logger=require(_0x4d1d('0x5'))(_0x4d1d('0x6'));var config=require(_0x4d1d('0x7'));var jayson=require(_0x4d1d('0x8'));var client=jayson[_0x4d1d('0x9')][_0x4d1d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1547d5,_0x1e0694,_0x23f6c4){return new BPromise(function(_0x54da0f,_0x4d6679){return client[_0x4d1d('0xb')](_0x1547d5,_0x23f6c4)[_0x4d1d('0xc')](function(_0x52cbbf){logger[_0x4d1d('0xd')](_0x4d1d('0xe'),_0x1e0694,_0x4d1d('0xf'));logger[_0x4d1d('0x10')](_0x4d1d('0x11'),_0x1e0694,_0x4d1d('0xf'),JSON[_0x4d1d('0x12')](_0x52cbbf));if(_0x52cbbf[_0x4d1d('0x13')]){if(_0x52cbbf[_0x4d1d('0x13')][_0x4d1d('0x14')]===0x1f4){logger[_0x4d1d('0x13')](_0x4d1d('0xe'),_0x1e0694,_0x52cbbf[_0x4d1d('0x13')]['message']);return _0x4d6679(_0x52cbbf[_0x4d1d('0x13')][_0x4d1d('0x15')]);}logger[_0x4d1d('0x13')](_0x4d1d('0xe'),_0x1e0694,_0x52cbbf['error']['message']);return _0x54da0f(_0x52cbbf[_0x4d1d('0x13')][_0x4d1d('0x15')]);}else{logger[_0x4d1d('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x1e0694,_0x4d1d('0xf'));_0x54da0f(_0x52cbbf[_0x4d1d('0x16')][_0x4d1d('0x15')]);}})[_0x4d1d('0x17')](function(_0x5d232d){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x1e0694,_0x5d232d);_0x4d6679(_0x5d232d);});});}exports[_0x4d1d('0x18')]=function(_0x83eb5a){var _0x3bea29=this;return new Promise(function(_0x38d465,_0x4fc413){return db['CmHopperHistory'][_0x4d1d('0x19')](_0x83eb5a[_0x4d1d('0x1a')],{'raw':_0x83eb5a[_0x4d1d('0x1b')]?_0x83eb5a[_0x4d1d('0x1b')][_0x4d1d('0x1c')]===undefined?!![]:![]:!![]})[_0x4d1d('0xc')](function(_0x1a5dae){logger['info'](_0x4d1d('0x18'),_0x83eb5a);logger['debug'](_0x4d1d('0x18'),_0x83eb5a,JSON[_0x4d1d('0x12')](_0x1a5dae));_0x38d465(_0x1a5dae);})[_0x4d1d('0x17')](function(_0xf1c555){logger[_0x4d1d('0x13')](_0x4d1d('0x18'),_0xf1c555[_0x4d1d('0x15')],_0x83eb5a);_0x4fc413(_0x3bea29['error'](0x1f4,_0xf1c555[_0x4d1d('0x15')]));});});};exports[_0x4d1d('0x1d')]=function(_0x207472){var _0x7b13a5=this;return new Promise(function(_0x2d060b,_0x50e7b0){return db[_0x4d1d('0x1e')][_0x4d1d('0x1f')]({'raw':_0x207472[_0x4d1d('0x1b')]?_0x207472[_0x4d1d('0x1b')][_0x4d1d('0x1c')]===undefined?!![]:![]:!![],'where':_0x207472['options']?_0x207472[_0x4d1d('0x1b')]['where']||null:null,'attributes':[[db[_0x4d1d('0x20')]['fn'](_0x4d1d('0x21'),db[_0x4d1d('0x20')][_0x4d1d('0x22')]('id')),_0x4d1d('0x23')],[db[_0x4d1d('0x20')]['fn']('COUNT',db[_0x4d1d('0x20')]['fn']('IF',db[_0x4d1d('0x20')][_0x4d1d('0x24')]('`state`\x20=\x204,\x201,\x20null'))),_0x4d1d('0x25')],[db[_0x4d1d('0x20')]['fn']('COUNT',db[_0x4d1d('0x20')]['fn']('IF',db[_0x4d1d('0x20')][_0x4d1d('0x24')](_0x4d1d('0x26')))),_0x4d1d('0x27')],[db[_0x4d1d('0x20')]['fn'](_0x4d1d('0x21'),db[_0x4d1d('0x20')]['fn']('IF',db['sequelize']['literal'](_0x4d1d('0x28')))),_0x4d1d('0x29')],[db['sequelize']['fn'](_0x4d1d('0x2a'),db['sequelize']['fn']('IF',db['sequelize'][_0x4d1d('0x24')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x4d1d('0x2b')],[db['sequelize']['fn']('AVG',db[_0x4d1d('0x20')]['fn']('IF',db[_0x4d1d('0x20')][_0x4d1d('0x24')](_0x4d1d('0x2c')))),'predictiveIntervalAvgTalktime']]})['then'](function(_0x2aa965){logger[_0x4d1d('0xd')](_0x4d1d('0x1d'),_0x207472);logger[_0x4d1d('0x10')](_0x4d1d('0x1d'),_0x207472,JSON[_0x4d1d('0x12')](_0x2aa965));_0x2d060b(_0x2aa965);})['catch'](function(_0x9682e8){logger[_0x4d1d('0x13')](_0x4d1d('0x1d'),_0x9682e8[_0x4d1d('0x15')],_0x207472);_0x50e7b0(_0x7b13a5[_0x4d1d('0x13')](0x1f4,_0x9682e8[_0x4d1d('0x15')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x20c657){var _0xf1a1fe=this;return new Promise(function(_0x1f0d41,_0x4506fa){return db['CmHopperHistory'][_0x4d1d('0x1f')]({'raw':_0x20c657[_0x4d1d('0x1b')]?_0x20c657['options']['raw']===undefined?!![]:![]:!![],'where':_0x20c657[_0x4d1d('0x1b')]?_0x20c657[_0x4d1d('0x1b')]['where']||null:null,'attributes':[[_0x4d1d('0x2d'),_0x4d1d('0x2e')],[db[_0x4d1d('0x20')]['fn'](_0x4d1d('0x21'),db[_0x4d1d('0x20')]['fn']('IF',db[_0x4d1d('0x20')][_0x4d1d('0x24')](_0x4d1d('0x2f')))),_0x4d1d('0x30')],[db[_0x4d1d('0x20')]['fn'](_0x4d1d('0x21'),db['sequelize']['fn']('IF',db[_0x4d1d('0x20')][_0x4d1d('0x24')](_0x4d1d('0x31')))),'outboundNoAnswerCallsDay'],[db[_0x4d1d('0x20')]['fn'](_0x4d1d('0x21'),db[_0x4d1d('0x20')]['fn']('IF',db[_0x4d1d('0x20')][_0x4d1d('0x24')](_0x4d1d('0x32')))),'outboundAnswerCallsDay'],[db[_0x4d1d('0x20')]['fn'](_0x4d1d('0x21'),db[_0x4d1d('0x20')]['fn']('IF',db['sequelize']['literal'](_0x4d1d('0x33')))),'outboundBusyCallsDay'],[db[_0x4d1d('0x20')]['fn'](_0x4d1d('0x21'),db['sequelize']['fn']('IF',db['sequelize'][_0x4d1d('0x24')](_0x4d1d('0x34')))),_0x4d1d('0x35')],[db[_0x4d1d('0x20')]['fn'](_0x4d1d('0x21'),db['sequelize']['fn']('IF',db[_0x4d1d('0x20')][_0x4d1d('0x24')](_0x4d1d('0x36')))),_0x4d1d('0x37')],[db['sequelize']['fn'](_0x4d1d('0x21'),db[_0x4d1d('0x20')]['fn']('IF',db[_0x4d1d('0x20')][_0x4d1d('0x24')](_0x4d1d('0x38')))),_0x4d1d('0x39')],[db['sequelize']['fn'](_0x4d1d('0x21'),db[_0x4d1d('0x20')]['fn']('IF',db[_0x4d1d('0x20')][_0x4d1d('0x24')](_0x4d1d('0x3a')))),_0x4d1d('0x3b')],[db[_0x4d1d('0x20')]['fn'](_0x4d1d('0x21'),db['sequelize']['fn']('IF',db[_0x4d1d('0x20')]['literal'](_0x4d1d('0x3c')))),_0x4d1d('0x3d')],[db[_0x4d1d('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4d1d('0x20')][_0x4d1d('0x24')]('`state`\x20=\x2014,\x201,\x20null'))),_0x4d1d('0x3e')],[db[_0x4d1d('0x20')]['fn'](_0x4d1d('0x21'),db[_0x4d1d('0x20')]['fn']('IF',db[_0x4d1d('0x20')]['literal'](_0x4d1d('0x3f')))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x4d1d('0x21'),db[_0x4d1d('0x20')]['fn']('IF',db[_0x4d1d('0x20')][_0x4d1d('0x24')](_0x4d1d('0x40')))),_0x4d1d('0x41')],[db['sequelize']['fn'](_0x4d1d('0x21'),db[_0x4d1d('0x20')]['fn']('IF',db['sequelize'][_0x4d1d('0x24')](_0x4d1d('0x42')))),_0x4d1d('0x43')],[db[_0x4d1d('0x20')]['fn']('COUNT',db[_0x4d1d('0x20')]['fn']('IF',db[_0x4d1d('0x20')][_0x4d1d('0x24')](_0x4d1d('0x44')))),_0x4d1d('0x45')]],'group':[_0x4d1d('0x2d')]})['then'](function(_0x544537){logger[_0x4d1d('0xd')](_0x4d1d('0x46'),_0x20c657);logger[_0x4d1d('0x10')](_0x4d1d('0x46'),_0x20c657,JSON['stringify'](_0x544537));_0x1f0d41(_0x544537);})['catch'](function(_0x1cbfc6){logger[_0x4d1d('0x13')](_0x4d1d('0x46'),_0x1cbfc6[_0x4d1d('0x15')],_0x20c657);_0x4506fa(_0xf1a1fe[_0x4d1d('0x13')](0x1f4,_0x1cbfc6[_0x4d1d('0x15')]));});});};exports[_0x4d1d('0x47')]=function(_0xb862ae){var _0xb5be1d=this;return new Promise(function(_0x3bb5df,_0x1164a0){return db['CmHopperHistory'][_0x4d1d('0x1f')]({'raw':_0xb862ae[_0x4d1d('0x1b')]?_0xb862ae[_0x4d1d('0x1b')][_0x4d1d('0x1c')]===undefined?!![]:![]:!![],'where':_0xb862ae[_0x4d1d('0x1b')]?_0xb862ae[_0x4d1d('0x1b')][_0x4d1d('0x48')]||null:null,'attributes':[[_0x4d1d('0x2d'),'name'],[db[_0x4d1d('0x20')]['fn'](_0x4d1d('0x21'),db['sequelize'][_0x4d1d('0x22')]('id')),_0x4d1d('0x49')],[db[_0x4d1d('0x20')]['fn']('COUNT',db[_0x4d1d('0x20')]['fn']('IF',db[_0x4d1d('0x20')][_0x4d1d('0x24')](_0x4d1d('0x32')))),_0x4d1d('0x4a')]],'group':[_0x4d1d('0x2d')]})['then'](function(_0x4b3b01){logger[_0x4d1d('0xd')]('GetCampaignHopperHistory',_0xb862ae);logger[_0x4d1d('0x10')](_0x4d1d('0x47'),_0xb862ae,JSON[_0x4d1d('0x12')](_0x4b3b01));_0x3bb5df(_0x4b3b01);})[_0x4d1d('0x17')](function(_0x17cf98){logger['error'](_0x4d1d('0x47'),_0x17cf98[_0x4d1d('0x15')],_0xb862ae);_0x1164a0(_0xb5be1d[_0x4d1d('0x13')](0x1f4,_0x17cf98['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 85b2e38..7b78933 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 _0xb772=['fs-extra','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','exports','multer','util','connect-timeout','express','Router'];(function(_0x573647,_0x46e315){var _0x3c1fb4=function(_0x2fbd04){while(--_0x2fbd04){_0x573647['push'](_0x573647['shift']());}};_0x3c1fb4(++_0x46e315);}(_0xb772,0x9b));var _0x2b77=function(_0x48caf9,_0x561dcb){_0x48caf9=_0x48caf9-0x0;var _0x42a263=_0xb772[_0x48caf9];return _0x42a263;};'use strict';var multer=require(_0x2b77('0x0'));var util=require(_0x2b77('0x1'));var path=require('path');var timeout=require(_0x2b77('0x2'));var express=require(_0x2b77('0x3'));var router=express[_0x2b77('0x4')]();var fs_extra=require(_0x2b77('0x5'));var auth=require(_0x2b77('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2b77('0x7'));var controller=require(_0x2b77('0x8'));router[_0x2b77('0x9')]('/',auth[_0x2b77('0xa')](),controller[_0x2b77('0xb')]);router[_0x2b77('0x9')](_0x2b77('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x2b77('0x9')](_0x2b77('0xd'),auth[_0x2b77('0xa')](),controller[_0x2b77('0xe')]);router[_0x2b77('0xf')]('/',auth['isAuthenticated'](),controller[_0x2b77('0x10')]);router[_0x2b77('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x2b77('0x12')]);module[_0x2b77('0x13')]=router; \ No newline at end of file +var _0x02bf=['path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated','get','/describe','describe','/:id','show','post','put','update','exports','multer','util'];(function(_0x11e56d,_0x39d699){var _0x5ac13f=function(_0x282e8d){while(--_0x282e8d){_0x11e56d['push'](_0x11e56d['shift']());}};_0x5ac13f(++_0x39d699);}(_0x02bf,0xbc));var _0xf02b=function(_0x450bf9,_0x1895de){_0x450bf9=_0x450bf9-0x0;var _0x268350=_0x02bf[_0x450bf9];return _0x268350;};'use strict';var multer=require(_0xf02b('0x0'));var util=require(_0xf02b('0x1'));var path=require(_0xf02b('0x2'));var timeout=require('connect-timeout');var express=require(_0xf02b('0x3'));var router=express[_0xf02b('0x4')]();var fs_extra=require(_0xf02b('0x5'));var auth=require(_0xf02b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf02b('0x7'));var controller=require(_0xf02b('0x8'));router['get']('/',auth[_0xf02b('0x9')](),controller['index']);router[_0xf02b('0xa')](_0xf02b('0xb'),auth[_0xf02b('0x9')](),controller[_0xf02b('0xc')]);router[_0xf02b('0xa')](_0xf02b('0xd'),auth[_0xf02b('0x9')](),controller[_0xf02b('0xe')]);router[_0xf02b('0xf')]('/',auth[_0xf02b('0x9')](),controller['create']);router[_0xf02b('0x10')](_0xf02b('0xd'),auth['isAuthenticated'](),controller[_0xf02b('0x11')]);module[_0xf02b('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 77b29ac..a8083e1 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 _0xf2ca=['exports','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x512e72,_0x49ffe1){_0x512e72=_0x512e72-0x0;var _0x143086=_0xf2ca[_0x512e72];return _0x143086;};'use strict';var Sequelize=require(_0xaf2c('0x0'));module[_0xaf2c('0x1')]={'name':{'type':Sequelize[_0xaf2c('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xaf2c('0x2')]},'dialPrefix':{'type':Sequelize[_0xaf2c('0x2')]}}; \ No newline at end of file +var _0x09f4=['STRING','name'];(function(_0x174edc,_0x552a22){var _0x5eb2a4=function(_0x18014b){while(--_0x18014b){_0x174edc['push'](_0x174edc['shift']());}};_0x5eb2a4(++_0x552a22);}(_0x09f4,0xe4));var _0x409f=function(_0x1c4554,_0xdfc048){_0x1c4554=_0x1c4554-0x0;var _0x30f0c4=_0x09f4[_0x1c4554];return _0x30f0c4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x409f('0x0')],'unique':_0x409f('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x409f('0x0')]},'dialPrefix':{'type':Sequelize[_0x409f('0x0')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 951c33d..f1b60e1 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 _0xd5bb=['defaults','redis','./cmList.socket','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','get','Lists','destroy','end','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','removeDispositions','addContacts','tags','isArray','join','push','CmContact','omit','errors','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContacts','isEmpty','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','TEXT','type','Sequelize','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','getCustomFields','findOne','findAndCountAll','addAgents','ids','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb'];(function(_0x496a7e,_0x11537e){var _0xb10022=function(_0x304389){while(--_0x304389){_0x496a7e['push'](_0x496a7e['shift']());}};_0xb10022(++_0x11537e);}(_0xd5bb,0x73));var _0xbd5b=function(_0xfc23ed,_0x5d7148){_0xfc23ed=_0xfc23ed-0x0;var _0x58d8aa=_0xd5bb[_0xfc23ed];return _0x58d8aa;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbd5b('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbd5b('0x1'));var moment=require(_0xbd5b('0x2'));var BPromise=require(_0xbd5b('0x3'));var Mustache=require(_0xbd5b('0x4'));var util=require('util');var path=require(_0xbd5b('0x5'));var sox=require(_0xbd5b('0x6'));var csv=require(_0xbd5b('0x7'));var ejs=require(_0xbd5b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbd5b('0x9'));var crypto=require(_0xbd5b('0xa'));var jsforce=require(_0xbd5b('0xb'));var deskjs=require(_0xbd5b('0xc'));var toCsv=require(_0xbd5b('0x7'));var querystring=require(_0xbd5b('0xd'));var Papa=require('papaparse');var Redis=require(_0xbd5b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xbd5b('0xf'));var as=require(_0xbd5b('0x10'));var hardwareService=require(_0xbd5b('0x11'));var logger=require(_0xbd5b('0x12'))(_0xbd5b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbd5b('0x14'))['db'];config['redis']=_[_0xbd5b('0x15')](config[_0xbd5b('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbd5b('0x16')]));require(_0xbd5b('0x17'))['register'](socket);function respondWithStatusCode(_0x3da069,_0x43c180){_0x43c180=_0x43c180||0xcc;return function(_0x31b37a){if(_0x31b37a){return _0x3da069[_0xbd5b('0x18')](_0x43c180);}return _0x3da069[_0xbd5b('0x19')](_0x43c180)['end']();};}function respondWithResult(_0x2e120d,_0x31c7e9){_0x31c7e9=_0x31c7e9||0xc8;return function(_0x55a147){if(_0x55a147){return _0x2e120d['status'](_0x31c7e9)[_0xbd5b('0x1a')](_0x55a147);}};}function respondWithFilteredResult(_0x978d8e,_0x2bd29f){return function(_0x48781a){if(_0x48781a){var _0x3d194f=typeof _0x2bd29f['offset']===_0xbd5b('0x1b')&&typeof _0x2bd29f[_0xbd5b('0x1c')]===_0xbd5b('0x1b');var _0x14e3e0=_0x48781a['count'];var _0x2ac9b4=_0x3d194f?0x0:_0x2bd29f[_0xbd5b('0x1d')];var _0x489c24=_0x3d194f?_0x48781a[_0xbd5b('0x1e')]:_0x2bd29f['offset']+_0x2bd29f['limit'];var _0x2a4cd1;if(_0x489c24>=_0x14e3e0){_0x489c24=_0x14e3e0;_0x2a4cd1=0xc8;}else{_0x2a4cd1=0xce;}_0x978d8e['status'](_0x2a4cd1);return _0x978d8e[_0xbd5b('0x1f')](_0xbd5b('0x20'),_0x2ac9b4+'-'+_0x489c24+'/'+_0x14e3e0)['json'](_0x48781a);}return null;};}function patchUpdates(_0x27e386){return function(_0xa2920e){try{jsonpatch[_0xbd5b('0x21')](_0xa2920e,_0x27e386,!![]);}catch(_0x27fbd0){return BPromise['reject'](_0x27fbd0);}return _0xa2920e[_0xbd5b('0x22')]();};}function saveUpdates(_0x4804dd,_0x1f2df6){return function(_0x245265){if(_0x245265){return _0x245265[_0xbd5b('0x23')](_0x4804dd)[_0xbd5b('0x24')](function(_0x3b40a1){return _0x3b40a1;});}return null;};}function removeEntity(_0x16b381,_0x2927d6){return function(_0x25daf9){if(_0x25daf9){return _0x25daf9['destroy']()['then'](function(){var _0x3f6240=_0x25daf9[_0xbd5b('0x25')]({'plain':!![]});var _0x340bd4=_0xbd5b('0x26');return db['UserProfileResource'][_0xbd5b('0x27')]({'where':{'type':_0x340bd4,'resourceId':_0x3f6240['id']}})[_0xbd5b('0x24')](function(){return _0x25daf9;});})[_0xbd5b('0x24')](function(){_0x16b381[_0xbd5b('0x19')](0xcc)[_0xbd5b('0x28')]();});}};}function handleEntityNotFound(_0x22a981,_0x31d1e6){return function(_0x53efb5){if(!_0x53efb5){_0x22a981[_0xbd5b('0x18')](0x194);}return _0x53efb5;};}function handleError(_0x102951,_0x5c9163){_0x5c9163=_0x5c9163||0x1f4;return function(_0x4895aa){logger['error'](_0x4895aa[_0xbd5b('0x29')]);if(_0x4895aa['name']){delete _0x4895aa[_0xbd5b('0x2a')];}_0x102951[_0xbd5b('0x19')](_0x5c9163)[_0xbd5b('0x2b')](_0x4895aa);};}exports[_0xbd5b('0x2c')]=function(_0x27b27a,_0x44cbdd){var _0x8eded2={},_0x215dc8={},_0x468571={'count':0x0,'rows':[]};var _0x19017b=_[_0xbd5b('0x2d')](db[_0xbd5b('0x2e')][_0xbd5b('0x2f')],function(_0x4f2d2f){return{'name':_0x4f2d2f[_0xbd5b('0x30')],'type':_0x4f2d2f['type'][_0xbd5b('0x31')]};});_0x215dc8[_0xbd5b('0x32')]=_[_0xbd5b('0x2d')](_0x19017b,_0xbd5b('0x2a'));_0x215dc8[_0xbd5b('0x33')]=_[_0xbd5b('0x34')](_0x27b27a[_0xbd5b('0x33')]);_0x215dc8[_0xbd5b('0x35')]=_[_0xbd5b('0x36')](_0x215dc8[_0xbd5b('0x32')],_0x215dc8[_0xbd5b('0x33')]);_0x8eded2[_0xbd5b('0x37')]=_[_0xbd5b('0x36')](_0x215dc8[_0xbd5b('0x32')],qs[_0xbd5b('0x38')](_0x27b27a['query'][_0xbd5b('0x38')]));_0x8eded2[_0xbd5b('0x37')]=_0x8eded2['attributes'][_0xbd5b('0x39')]?_0x8eded2[_0xbd5b('0x37')]:_0x215dc8[_0xbd5b('0x32')];if(!_0x27b27a[_0xbd5b('0x33')][_0xbd5b('0x3a')](_0xbd5b('0x3b'))){_0x8eded2[_0xbd5b('0x1c')]=qs[_0xbd5b('0x1c')](_0x27b27a[_0xbd5b('0x33')][_0xbd5b('0x1c')]);_0x8eded2[_0xbd5b('0x1d')]=qs[_0xbd5b('0x1d')](_0x27b27a[_0xbd5b('0x33')][_0xbd5b('0x1d')]);}_0x8eded2[_0xbd5b('0x3c')]=qs[_0xbd5b('0x3d')](_0x27b27a['query'][_0xbd5b('0x3d')]);_0x8eded2[_0xbd5b('0x3e')]=qs[_0xbd5b('0x35')](_[_0xbd5b('0x3f')](_0x27b27a[_0xbd5b('0x33')],_0x215dc8[_0xbd5b('0x35')]),_0x19017b);if(_0x27b27a['query']['filter']){_0x8eded2[_0xbd5b('0x3e')]=_[_0xbd5b('0x40')](_0x8eded2['where'],{'$or':_[_0xbd5b('0x2d')](_0x19017b,function(_0x486c61){if(_0x486c61['type']!==_0xbd5b('0x41')){var _0x19e08c={};_0x19e08c[_0x486c61[_0xbd5b('0x2a')]]={'$like':'%'+_0x27b27a['query'][_0xbd5b('0x42')]+'%'};return _0x19e08c;}})});}_0x8eded2=_[_0xbd5b('0x40')]({},_0x8eded2,_0x27b27a[_0xbd5b('0x43')]);var _0x1c96eb={'where':_0x8eded2[_0xbd5b('0x3e')]};return db[_0xbd5b('0x2e')][_0xbd5b('0x1e')](_0x1c96eb)[_0xbd5b('0x24')](function(_0x5a4021){_0x468571['count']=_0x5a4021;if(_0x27b27a[_0xbd5b('0x33')][_0xbd5b('0x44')]){_0x8eded2[_0xbd5b('0x45')]=[{'all':!![]}];}return db[_0xbd5b('0x2e')]['findAll'](_0x8eded2);})['then'](function(_0xa847a5){_0x468571[_0xbd5b('0x46')]=_0xa847a5;return _0x468571;})[_0xbd5b('0x24')](respondWithFilteredResult(_0x44cbdd,_0x8eded2))['catch'](handleError(_0x44cbdd,null));};exports[_0xbd5b('0x47')]=function(_0x2f08e7,_0x5ee595){var _0x419c64={'raw':![],'where':{'id':_0x2f08e7[_0xbd5b('0x48')]['id']}},_0x15268e={};_0x15268e['model']=_[_0xbd5b('0x34')](db[_0xbd5b('0x2e')][_0xbd5b('0x2f')]);_0x15268e[_0xbd5b('0x33')]=_[_0xbd5b('0x34')](_0x2f08e7[_0xbd5b('0x33')]);_0x15268e[_0xbd5b('0x35')]=_[_0xbd5b('0x36')](_0x15268e[_0xbd5b('0x32')],_0x15268e['query']);_0x419c64['attributes']=_[_0xbd5b('0x36')](_0x15268e[_0xbd5b('0x32')],qs[_0xbd5b('0x38')](_0x2f08e7[_0xbd5b('0x33')]['fields']));_0x419c64[_0xbd5b('0x37')]=_0x419c64[_0xbd5b('0x37')]['length']?_0x419c64['attributes']:_0x15268e[_0xbd5b('0x32')];if(_0x2f08e7[_0xbd5b('0x33')]['includeAll']){_0x419c64[_0xbd5b('0x45')]=[{'all':!![]}];}_0x419c64=_[_0xbd5b('0x40')]({},_0x419c64,_0x2f08e7[_0xbd5b('0x43')]);return db['CmList'][_0xbd5b('0x49')](_0x419c64)[_0xbd5b('0x24')](handleEntityNotFound(_0x5ee595,null))[_0xbd5b('0x24')](respondWithResult(_0x5ee595,null))[_0xbd5b('0x4a')](handleError(_0x5ee595,null));};exports['create']=function(_0x2fac26,_0x2b8abe){return db[_0xbd5b('0x2e')][_0xbd5b('0x4b')](_0x2fac26[_0xbd5b('0x4c')],{})['then'](function(_0x230ea6){var _0x2fa6a1=_0x2fac26['user'][_0xbd5b('0x25')]({'plain':!![]});if(!_0x2fa6a1)throw new Error(_0xbd5b('0x4d'));if(_0x2fa6a1['role']==='user'){var _0x1fa862=_0x230ea6['get']({'plain':!![]});var _0x4f2002=_0xbd5b('0x26');return db['UserProfileSection'][_0xbd5b('0x49')]({'where':{'name':_0x4f2002,'userProfileId':_0x2fa6a1[_0xbd5b('0x4e')]},'raw':!![]})[_0xbd5b('0x24')](function(_0x3066f2){if(_0x3066f2&&_0x3066f2['autoAssociation']===0x0){return db[_0xbd5b('0x4f')]['create']({'name':_0x1fa862['name'],'resourceId':_0x1fa862['id'],'type':_0x3066f2[_0xbd5b('0x2a')],'sectionId':_0x3066f2['id']},{})['then'](function(){return _0x230ea6;});}else{return _0x230ea6;}})[_0xbd5b('0x4a')](function(_0x5efa76){logger[_0xbd5b('0x50')](_0xbd5b('0x51'),_0x5efa76);throw _0x5efa76;});}return _0x230ea6;})[_0xbd5b('0x24')](respondWithResult(_0x2b8abe,0xc9))[_0xbd5b('0x4a')](handleError(_0x2b8abe,null));};exports[_0xbd5b('0x23')]=function(_0x3cee50,_0x397299){if(_0x3cee50['body']['id']){delete _0x3cee50[_0xbd5b('0x4c')]['id'];}return db[_0xbd5b('0x2e')][_0xbd5b('0x49')]({'where':{'id':_0x3cee50[_0xbd5b('0x48')]['id']}})[_0xbd5b('0x24')](handleEntityNotFound(_0x397299,null))['then'](saveUpdates(_0x3cee50[_0xbd5b('0x4c')],null))[_0xbd5b('0x24')](respondWithResult(_0x397299,null))[_0xbd5b('0x4a')](handleError(_0x397299,null));};exports[_0xbd5b('0x27')]=function(_0x4ec826,_0x576186){return db[_0xbd5b('0x2e')]['find']({'where':{'id':_0x4ec826[_0xbd5b('0x48')]['id']}})[_0xbd5b('0x24')](handleEntityNotFound(_0x576186,null))[_0xbd5b('0x24')](removeEntity(_0x576186,null))[_0xbd5b('0x4a')](handleError(_0x576186,null));};exports['describe']=function(_0x3a443,_0x5c74e1){return db['CmList'][_0xbd5b('0x52')]()[_0xbd5b('0x24')](respondWithResult(_0x5c74e1,null))[_0xbd5b('0x4a')](handleError(_0x5c74e1,null));};exports[_0xbd5b('0x53')]=function(_0x5ba753,_0x4fbd89,_0x24f253){if(_0x5ba753[_0xbd5b('0x4c')]['id']){delete _0x5ba753[_0xbd5b('0x4c')]['id'];}return db[_0xbd5b('0x2e')]['find']({'where':{'id':_0x5ba753[_0xbd5b('0x48')]['id']}})['then'](handleEntityNotFound(_0x4fbd89,null))[_0xbd5b('0x24')](function(_0x25589b){if(_0x25589b){_0x5ba753[_0xbd5b('0x4c')][_0xbd5b('0x54')]=_0x25589b['id'];return db[_0xbd5b('0x55')][_0xbd5b('0x4b')](_0x5ba753[_0xbd5b('0x4c')]);}})[_0xbd5b('0x24')](respondWithResult(_0x4fbd89,null))[_0xbd5b('0x4a')](handleError(_0x4fbd89,null));};exports['getDispositions']=function(_0x479af1,_0x3f170e,_0x3c8da6){var _0x30c9b1={'raw':![],'where':{}};var _0x39f16f={};var _0x51724b={'count':0x0,'rows':[]};return db['CmList']['findOne']({'where':{'id':_0x479af1[_0xbd5b('0x48')]['id']}})[_0xbd5b('0x24')](handleEntityNotFound(_0x3f170e,null))[_0xbd5b('0x24')](function(_0x26b2e7){if(_0x26b2e7){_0x39f16f[_0xbd5b('0x32')]=_['keys'](db['Disposition']['rawAttributes']);_0x39f16f[_0xbd5b('0x33')]=_[_0xbd5b('0x34')](_0x479af1[_0xbd5b('0x33')]);_0x39f16f[_0xbd5b('0x35')]=_[_0xbd5b('0x36')](_0x39f16f[_0xbd5b('0x32')],_0x39f16f[_0xbd5b('0x33')]);_0x30c9b1[_0xbd5b('0x37')]=_[_0xbd5b('0x36')](_0x39f16f[_0xbd5b('0x32')],qs[_0xbd5b('0x38')](_0x479af1[_0xbd5b('0x33')][_0xbd5b('0x38')]));_0x30c9b1['attributes']=_0x30c9b1[_0xbd5b('0x37')][_0xbd5b('0x39')]?_0x30c9b1[_0xbd5b('0x37')]:_0x39f16f[_0xbd5b('0x32')];if(!_0x479af1[_0xbd5b('0x33')][_0xbd5b('0x3a')](_0xbd5b('0x3b'))){_0x30c9b1['limit']=qs['limit'](_0x479af1[_0xbd5b('0x33')][_0xbd5b('0x1c')]);_0x30c9b1['offset']=qs[_0xbd5b('0x1d')](_0x479af1['query'][_0xbd5b('0x1d')]);}_0x30c9b1[_0xbd5b('0x3c')]=qs[_0xbd5b('0x3d')](_0x479af1[_0xbd5b('0x33')][_0xbd5b('0x3d')]);_0x30c9b1[_0xbd5b('0x3e')]=qs[_0xbd5b('0x35')](_[_0xbd5b('0x3f')](_0x479af1['query'],_0x39f16f[_0xbd5b('0x35')]));_0x30c9b1[_0xbd5b('0x3e')]['ListId']=_0x26b2e7['id'];if(_0x479af1['query'][_0xbd5b('0x42')]){_0x30c9b1[_0xbd5b('0x3e')]=_['merge'](_0x30c9b1['where'],{'$or':_[_0xbd5b('0x2d')](_0x30c9b1[_0xbd5b('0x37')],function(_0x47a6d4){var _0x292c3c={};_0x292c3c[_0x47a6d4]={'$like':'%'+_0x479af1['query']['filter']+'%'};return _0x292c3c;})});}_0x30c9b1=_[_0xbd5b('0x40')]({},_0x30c9b1,_0x479af1[_0xbd5b('0x43')]);return db[_0xbd5b('0x55')][_0xbd5b('0x1e')]({'where':_0x30c9b1[_0xbd5b('0x3e')]})[_0xbd5b('0x24')](function(_0x4affc1){_0x51724b[_0xbd5b('0x1e')]=_0x4affc1;if(_0x479af1['query'][_0xbd5b('0x44')]){_0x30c9b1[_0xbd5b('0x45')]=[{'all':!![]}];}return db[_0xbd5b('0x55')]['findAll'](_0x30c9b1);})['then'](function(_0x47b433){_0x51724b[_0xbd5b('0x46')]=_0x47b433;return _0x51724b;});}})['then'](respondWithFilteredResult(_0x3f170e,_0x30c9b1))['catch'](handleError(_0x3f170e,null));};exports[_0xbd5b('0x56')]=function(_0x4de281,_0x55c376,_0x40f1ad){return db[_0xbd5b('0x2e')][_0xbd5b('0x49')]({'where':{'id':_0x4de281['params']['id']}})[_0xbd5b('0x24')](handleEntityNotFound(_0x55c376,null))['then'](function(_0xb578f5){if(_0xb578f5){return _0xb578f5['removeDispositions'](_0x4de281[_0xbd5b('0x33')]['ids']);}})['then'](respondWithStatusCode(_0x55c376,null))[_0xbd5b('0x4a')](handleError(_0x55c376,null));};exports[_0xbd5b('0x57')]=function(_0x3463b3,_0x1d0b79,_0x5d3586){return db[_0xbd5b('0x2e')]['find']({'where':{'id':_0x3463b3[_0xbd5b('0x48')]['id']}})[_0xbd5b('0x24')](handleEntityNotFound(_0x1d0b79,null))[_0xbd5b('0x24')](function(_0x591ebf){if(_0x591ebf){var _0x27cc2a=[];var _0x33f505={'success':[],'errors':[]};return db['CmContact'][_0xbd5b('0x52')]()[_0xbd5b('0x24')](function(_0x542d0e){if(_0x3463b3['body'][_0xbd5b('0x58')]&&_[_0xbd5b('0x59')](_0x3463b3[_0xbd5b('0x4c')][_0xbd5b('0x58')])){if(_0x3463b3['body'][_0xbd5b('0x58')]['length']){_0x3463b3[_0xbd5b('0x4c')][_0xbd5b('0x58')]=_0x3463b3[_0xbd5b('0x4c')]['tags'][_0xbd5b('0x5a')](';')+';';}else{_0x3463b3[_0xbd5b('0x4c')][_0xbd5b('0x58')]=null;}}else{_0x3463b3[_0xbd5b('0x4c')][_0xbd5b('0x58')]=null;}if(_0x3463b3[_0xbd5b('0x4c')]&&_[_0xbd5b('0x59')](_0x3463b3[_0xbd5b('0x4c')])){for(var _0x27a9f6=0x0;_0x27a9f6<_0x3463b3[_0xbd5b('0x4c')][_0xbd5b('0x39')];_0x27a9f6+=0x1){_0x3463b3[_0xbd5b('0x4c')][_0x27a9f6][_0xbd5b('0x54')]=_0x3463b3[_0xbd5b('0x48')]['id'];_0x27cc2a[_0xbd5b('0x5b')](_0x3463b3[_0xbd5b('0x4c')][_0x27a9f6]);}return BPromise['each'](_0x27cc2a,function(_0x4a6e7b){return db[_0xbd5b('0x5c')]['create'](_[_0xbd5b('0x5d')](_0x4a6e7b,['ids','id'])||{},{'fields':_['keys'](_0x542d0e),'raw':!![]})['then'](function(_0x191a0c){_0x33f505['success'][_0xbd5b('0x5b')](_0x191a0c['dataValues']);})['catch'](function(_0x44806b){_0x33f505[_0xbd5b('0x5e')][_0xbd5b('0x5b')]({'data':_0x4a6e7b,'error':_0x44806b['message']});});})[_0xbd5b('0x24')](function(_0x51be36){return _0x33f505;})[_0xbd5b('0x4a')](function(_0x5dde7f){return _0x5dde7f;});}else{_0x1d0b79[_0xbd5b('0x19')](0x190)[_0xbd5b('0x1a')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0xbd5b('0x24')](respondWithResult(_0x1d0b79,null))[_0xbd5b('0x4a')](handleError(_0x1d0b79,null));};exports['getContacts']=function(_0x219454,_0x4a46c2,_0x371ed2){var _0xb971af;return db[_0xbd5b('0x2e')]['find']({'where':{'id':_0x219454[_0xbd5b('0x48')]['id']},'include':[{'model':db[_0xbd5b('0x5f')],'as':_0xbd5b('0x60')}]})['then'](handleEntityNotFound(_0x4a46c2,null))[_0xbd5b('0x24')](function(_0x4d703b){if(_0x4d703b){_0xb971af=_0x4d703b;return db[_0xbd5b('0x5c')][_0xbd5b('0x2f')];}})['then'](function(_0x9ed40e){if(_0x9ed40e){var _0x1224a6={};var _0x11e7f9={};_0x11e7f9[_0xbd5b('0x32')]=_[_0xbd5b('0x61')](_[_0xbd5b('0x34')](_0x9ed40e),_[_0xbd5b('0x2d')](_0xb971af['CustomFields'],function(_0xd992f1){return util[_0xbd5b('0x62')](_0xbd5b('0x63'),_0xd992f1['id']);}));_0x11e7f9[_0xbd5b('0x33')]=_[_0xbd5b('0x34')](_0x219454[_0xbd5b('0x33')]);_0x11e7f9[_0xbd5b('0x35')]=_[_0xbd5b('0x36')](_0x11e7f9[_0xbd5b('0x32')],_0x11e7f9[_0xbd5b('0x33')]);_0x1224a6['attributes']=_[_0xbd5b('0x36')](_0x11e7f9[_0xbd5b('0x32')],qs[_0xbd5b('0x38')](_0x219454[_0xbd5b('0x33')][_0xbd5b('0x38')]));_0x1224a6[_0xbd5b('0x37')]=_0x1224a6[_0xbd5b('0x37')][_0xbd5b('0x39')]?_0x1224a6[_0xbd5b('0x37')]:_0x11e7f9['model'];if(!_0x219454['query']['hasOwnProperty'](_0xbd5b('0x3b'))){_0x1224a6[_0xbd5b('0x1c')]=qs[_0xbd5b('0x1c')](_0x219454[_0xbd5b('0x33')]['limit']);_0x1224a6[_0xbd5b('0x1d')]=qs[_0xbd5b('0x1d')](_0x219454[_0xbd5b('0x33')][_0xbd5b('0x1d')]);}_0x1224a6[_0xbd5b('0x3c')]=qs[_0xbd5b('0x3d')](_0x219454[_0xbd5b('0x33')][_0xbd5b('0x3d')]);_0x1224a6[_0xbd5b('0x3e')]=qs[_0xbd5b('0x35')](_[_0xbd5b('0x3f')](_0x219454[_0xbd5b('0x33')],_0x11e7f9[_0xbd5b('0x35')]));_0x1224a6[_0xbd5b('0x64')]=!![];if(_0x219454[_0xbd5b('0x33')][_0xbd5b('0x42')]){_0x1224a6['where']=_[_0xbd5b('0x40')](_0x1224a6['where'],{'$or':_['map'](_0x1224a6[_0xbd5b('0x37')],function(_0x19638d){var _0x3a6445={};_0x3a6445[_0x19638d]={'$like':'%'+_0x219454[_0xbd5b('0x33')]['filter']+'%'};return _0x3a6445;})});}_0x1224a6=_[_0xbd5b('0x40')]({},_0x1224a6,_0x219454[_0xbd5b('0x43')]);return _0xb971af[_0xbd5b('0x65')](_0x1224a6);}})[_0xbd5b('0x24')](respondWithResult(_0x4a46c2,null))[_0xbd5b('0x4a')](handleError(_0x4a46c2,null));};exports['getContactsCsv']=function(_0x3d105b,_0x4df20e,_0x5a9891){var _0x48531d;return db['CmList'][_0xbd5b('0x49')]({'where':{'id':_0x3d105b[_0xbd5b('0x48')]['id']},'include':[{'model':db[_0xbd5b('0x5f')],'as':'CustomFields'}]})[_0xbd5b('0x24')](handleEntityNotFound(_0x4df20e,null))['then'](function(_0x228e7a){if(_0x228e7a){_0x48531d=_0x228e7a;return db[_0xbd5b('0x5c')][_0xbd5b('0x2f')];}})[_0xbd5b('0x24')](function(_0x2e57aa){if(_0x2e57aa){var _0x34fd45={};var _0x591463={};_0x591463['model']=_['concat'](_[_0xbd5b('0x34')](_0x2e57aa),_[_0xbd5b('0x2d')](_0x48531d[_0xbd5b('0x60')],function(_0x4a4555){return util[_0xbd5b('0x62')](_0xbd5b('0x63'),_0x4a4555['id']);}));_0x591463[_0xbd5b('0x33')]=_[_0xbd5b('0x34')](_0x3d105b[_0xbd5b('0x33')]);_0x591463[_0xbd5b('0x35')]=_[_0xbd5b('0x36')](_0x591463[_0xbd5b('0x32')],_0x591463[_0xbd5b('0x33')]);_0x34fd45[_0xbd5b('0x37')]=_[_0xbd5b('0x36')](_0x591463[_0xbd5b('0x32')],qs['fields'](_0x3d105b[_0xbd5b('0x33')]['fields']));_0x34fd45[_0xbd5b('0x37')]=_0x34fd45[_0xbd5b('0x37')][_0xbd5b('0x39')]?_0x34fd45[_0xbd5b('0x37')]:_0x591463[_0xbd5b('0x32')];if(!_0x3d105b[_0xbd5b('0x33')]['hasOwnProperty'](_0xbd5b('0x3b'))){_0x34fd45[_0xbd5b('0x1c')]=qs[_0xbd5b('0x1c')](_0x3d105b[_0xbd5b('0x33')][_0xbd5b('0x1c')]);_0x34fd45[_0xbd5b('0x1d')]=qs[_0xbd5b('0x1d')](_0x3d105b[_0xbd5b('0x33')][_0xbd5b('0x1d')]);}_0x34fd45[_0xbd5b('0x3c')]=qs[_0xbd5b('0x3d')](_0x3d105b[_0xbd5b('0x33')][_0xbd5b('0x3d')]);_0x34fd45['where']=qs[_0xbd5b('0x35')](_['pick'](_0x3d105b['query'],_0x591463['filters']));_0x34fd45['raw']=!![];if(_0x3d105b[_0xbd5b('0x33')][_0xbd5b('0x42')]){_0x34fd45[_0xbd5b('0x3e')]=_['merge'](_0x34fd45[_0xbd5b('0x3e')],{'$or':_[_0xbd5b('0x2d')](_0x34fd45[_0xbd5b('0x37')],function(_0xc1cde2){var _0xf43d5e={};_0xf43d5e[_0xc1cde2]={'$like':'%'+_0x3d105b['query'][_0xbd5b('0x42')]+'%'};return _0xf43d5e;})});}_0x34fd45=_[_0xbd5b('0x40')]({},_0x34fd45,_0x3d105b[_0xbd5b('0x43')]);return _0x48531d['getContacts'](_0x34fd45);}})[_0xbd5b('0x24')](function(_0x482aae){if(!_[_0xbd5b('0x66')](_0x482aae)){var _0x2f1b52=toCsv(_0x482aae);var _0x52f1d7=Date['now']();fs['writeFileSync'](util[_0xbd5b('0x62')](_0xbd5b('0x67'),_0x48531d['id'],_0x52f1d7),_0x2f1b52);_0x4df20e[_0xbd5b('0x68')](_0xbd5b('0x69'),_0xbd5b('0x6a')+util['format'](_0xbd5b('0x6b'),_0x48531d['id'],_0x52f1d7));_0x4df20e['setHeader']('Content-type',_0xbd5b('0x6c'));return _0x4df20e[_0xbd5b('0x6d')](util[_0xbd5b('0x62')](_0xbd5b('0x67'),_0x48531d['id'],_0x52f1d7));}else{return _0x4df20e[_0xbd5b('0x18')](0xcc);}})[_0xbd5b('0x4a')](handleError(_0x4df20e,null));};exports[_0xbd5b('0x6e')]=function(_0x5ba480,_0x5bc59d,_0x444783){var _0x569839;delete _0x5ba480['body']['id'];return db['CmList']['findOne']({'where':{'id':_0x5ba480[_0xbd5b('0x48')]['id']}})[_0xbd5b('0x24')](handleEntityNotFound(_0x5bc59d,null))[_0xbd5b('0x24')](function(_0x5d66b5){if(_0x5d66b5){return db[_0xbd5b('0x6f')][_0xbd5b('0x70')](function(_0x270487){return db['CmCustomField'][_0xbd5b('0x4b')](_0x5ba480[_0xbd5b('0x4c')],{'transaction':_0x270487})['then'](function(_0x4d73ac){_0x569839=_0x4d73ac;return _0x5d66b5[_0xbd5b('0x71')](_0x4d73ac,{'transaction':_0x270487});})[_0xbd5b('0x24')](function(){var _0x38a2be={'type':db['Sequelize'][_0xbd5b('0x72')],'transaction':_0x270487};switch(_0x5ba480[_0xbd5b('0x4c')][_0xbd5b('0x73')]){case'text':_0x38a2be['type']=db[_0xbd5b('0x74')][_0xbd5b('0x72')];break;case _0xbd5b('0x75'):_0x38a2be['type']=db[_0xbd5b('0x74')][_0xbd5b('0x76')];break;case _0xbd5b('0x77'):_0x38a2be['type']=db[_0xbd5b('0x74')][_0xbd5b('0x78')];_0x38a2be[_0xbd5b('0x79')]=![];break;default:}return db[_0xbd5b('0x6f')][_0xbd5b('0x7a')][_0xbd5b('0x7b')](_0xbd5b('0x7c'),util[_0xbd5b('0x62')]('cf_%s',_0x569839['id']),_0x38a2be);})[_0xbd5b('0x24')](function(){return _0x569839;});});}})[_0xbd5b('0x24')](respondWithResult(_0x5bc59d,null))[_0xbd5b('0x4a')](handleError(_0x5bc59d,null));};exports[_0xbd5b('0x7d')]=function(_0x12cfff,_0x516a1b,_0x24946b){var _0x567b22={};var _0xbab8d5={};var _0x4dc920;var _0x3f8c3b;return db[_0xbd5b('0x2e')][_0xbd5b('0x7e')]({'where':{'id':_0x12cfff[_0xbd5b('0x48')]['id']}})[_0xbd5b('0x24')](handleEntityNotFound(_0x516a1b,null))[_0xbd5b('0x24')](function(_0x316f67){if(_0x316f67){_0x4dc920=_0x316f67;_0xbab8d5['model']=_[_0xbd5b('0x34')](db[_0xbd5b('0x5f')][_0xbd5b('0x2f')]);_0xbab8d5[_0xbd5b('0x33')]=_['keys'](_0x12cfff['query']);_0xbab8d5['filters']=_[_0xbd5b('0x36')](_0xbab8d5[_0xbd5b('0x32')],_0xbab8d5[_0xbd5b('0x33')]);_0x567b22['attributes']=_[_0xbd5b('0x36')](_0xbab8d5[_0xbd5b('0x32')],qs[_0xbd5b('0x38')](_0x12cfff['query']['fields']));_0x567b22[_0xbd5b('0x37')]=_0x567b22[_0xbd5b('0x37')][_0xbd5b('0x39')]?_0x567b22[_0xbd5b('0x37')]:_0xbab8d5[_0xbd5b('0x32')];_0x567b22[_0xbd5b('0x3c')]=qs[_0xbd5b('0x3d')](_0x12cfff[_0xbd5b('0x33')][_0xbd5b('0x3d')]);_0x567b22[_0xbd5b('0x3e')]=qs[_0xbd5b('0x35')](_[_0xbd5b('0x3f')](_0x12cfff[_0xbd5b('0x33')],_0xbab8d5[_0xbd5b('0x35')]));_0x567b22[_0xbd5b('0x3e')]=_[_0xbd5b('0x40')](_0x567b22[_0xbd5b('0x3e')],{'$or':[{'ListId':_0x316f67['id']},{'ListId':null}]});if(_0x12cfff[_0xbd5b('0x33')][_0xbd5b('0x42')]){_0x567b22[_0xbd5b('0x3e')]=_[_0xbd5b('0x40')](_0x567b22[_0xbd5b('0x3e')],{'$or':_[_0xbd5b('0x2d')](_0x567b22[_0xbd5b('0x37')],function(_0x37cc2b){var _0x19beac={};_0x19beac[_0x37cc2b]={'$like':'%'+_0x12cfff[_0xbd5b('0x33')][_0xbd5b('0x42')]+'%'};return _0x19beac;})});}_0x567b22=_[_0xbd5b('0x40')]({},_0x567b22,_0x12cfff[_0xbd5b('0x43')]);return db[_0xbd5b('0x5f')][_0xbd5b('0x7f')](_0x567b22);}})['then'](respondWithResult(_0x516a1b,null))[_0xbd5b('0x4a')](handleError(_0x516a1b,null));};exports[_0xbd5b('0x80')]=function(_0x12e724,_0x423d01,_0x3a6608){return db[_0xbd5b('0x2e')]['find']({'where':{'id':_0x12e724[_0xbd5b('0x48')]['id']}})[_0xbd5b('0x24')](handleEntityNotFound(_0x423d01,null))[_0xbd5b('0x24')](function(_0x3f628f){if(_0x3f628f){return _0x3f628f[_0xbd5b('0x80')](_0x12e724['body']['ids'],_[_0xbd5b('0x5d')](_0x12e724[_0xbd5b('0x4c')],['ids','id'])||{})['spread'](function(_0x5abe47){for(var _0x131ca4=0x0;_0x131ca4<_0x12e724['body'][_0xbd5b('0x81')]['length'];_0x131ca4+=0x1){socket[_0xbd5b('0x82')](_0xbd5b('0x83'),{'UserId':Number(_0x12e724[_0xbd5b('0x4c')]['ids'][_0x131ca4]),'CmListId':Number(_0x12e724[_0xbd5b('0x48')]['id'])});}return _0x5abe47;});}})[_0xbd5b('0x24')](respondWithResult(_0x423d01,null))[_0xbd5b('0x4a')](handleError(_0x423d01,null));};exports[_0xbd5b('0x84')]=function(_0x50dea1,_0x1bf7a7,_0x249dd7){return db[_0xbd5b('0x2e')][_0xbd5b('0x49')]({'where':{'id':_0x50dea1['params']['id']}})[_0xbd5b('0x24')](handleEntityNotFound(_0x1bf7a7,null))[_0xbd5b('0x24')](function(_0x302b3e){if(_0x302b3e){return _0x302b3e['removeAgents'](_0x50dea1[_0xbd5b('0x33')][_0xbd5b('0x81')])[_0xbd5b('0x24')](function(){if(_[_0xbd5b('0x59')](_0x50dea1[_0xbd5b('0x33')][_0xbd5b('0x81')])){for(var _0x260abe=0x0;_0x260abe<_0x50dea1[_0xbd5b('0x33')]['ids'][_0xbd5b('0x39')];_0x260abe+=0x1){socket[_0xbd5b('0x82')]('userCmList:remove',{'UserId':Number(_0x50dea1['query'][_0xbd5b('0x81')][_0x260abe]),'CmListId':Number(_0x50dea1[_0xbd5b('0x48')]['id'])});}}else{socket[_0xbd5b('0x82')](_0xbd5b('0x85'),{'UserId':Number(_0x50dea1['query']['ids']),'CmListId':Number(_0x50dea1[_0xbd5b('0x48')]['id'])});}});}})[_0xbd5b('0x24')](respondWithStatusCode(_0x1bf7a7,null))[_0xbd5b('0x4a')](handleError(_0x1bf7a7,null));};exports['getAgents']=function(_0x1cd780,_0x301155,_0x36709c){var _0x336344={};var _0x1815c4={};var _0x19ddfd;var _0xdf02cd;return db[_0xbd5b('0x2e')][_0xbd5b('0x7e')]({'where':{'id':_0x1cd780[_0xbd5b('0x48')]['id']}})[_0xbd5b('0x24')](handleEntityNotFound(_0x301155,null))['then'](function(_0x35bcb3){if(_0x35bcb3){_0x19ddfd=_0x35bcb3;_0x1815c4['model']=_[_0xbd5b('0x34')](db[_0xbd5b('0x86')][_0xbd5b('0x2f')]);_0x1815c4[_0xbd5b('0x33')]=_[_0xbd5b('0x34')](_0x1cd780[_0xbd5b('0x33')]);_0x1815c4[_0xbd5b('0x35')]=_[_0xbd5b('0x36')](_0x1815c4[_0xbd5b('0x32')],_0x1815c4[_0xbd5b('0x33')]);_0x336344[_0xbd5b('0x37')]=_['intersection'](_0x1815c4['model'],qs['fields'](_0x1cd780['query']['fields']));_0x336344[_0xbd5b('0x37')]=_0x336344[_0xbd5b('0x37')][_0xbd5b('0x39')]?_0x336344[_0xbd5b('0x37')]:_0x1815c4['model'];_0x336344[_0xbd5b('0x3c')]=qs[_0xbd5b('0x3d')](_0x1cd780['query'][_0xbd5b('0x3d')]);_0x336344[_0xbd5b('0x3e')]=qs['filters'](_[_0xbd5b('0x3f')](_0x1cd780['query'],_0x1815c4[_0xbd5b('0x35')]));if(_0x1cd780[_0xbd5b('0x33')][_0xbd5b('0x42')]){_0x336344[_0xbd5b('0x3e')]=_[_0xbd5b('0x40')](_0x336344[_0xbd5b('0x3e')],{'$or':_[_0xbd5b('0x2d')](_0x336344['attributes'],function(_0x2a02c6){var _0x36c7a8={};_0x36c7a8[_0x2a02c6]={'$like':'%'+_0x1cd780[_0xbd5b('0x33')][_0xbd5b('0x42')]+'%'};return _0x36c7a8;})});}_0x336344=_['merge']({},_0x336344,_0x1cd780['options']);return _0x19ddfd[_0xbd5b('0x87')](_0x336344);}})[_0xbd5b('0x24')](function(_0xfebdf7){if(_0xfebdf7){_0xdf02cd=_0xfebdf7['length'];if(!_0x1cd780['query'][_0xbd5b('0x3a')]('nolimit')){_0x336344[_0xbd5b('0x1c')]=qs[_0xbd5b('0x1c')](_0x1cd780['query'][_0xbd5b('0x1c')]);_0x336344[_0xbd5b('0x1d')]=qs[_0xbd5b('0x1d')](_0x1cd780[_0xbd5b('0x33')][_0xbd5b('0x1d')]);}return _0x19ddfd[_0xbd5b('0x87')](_0x336344);}})['then'](function(_0x1311f6){if(_0x1311f6){return _0x1311f6?{'count':_0xdf02cd,'rows':_0x1311f6}:null;}})[_0xbd5b('0x24')](respondWithResult(_0x301155,null))['catch'](handleError(_0x301155,null));}; \ No newline at end of file +var _0x681e=['catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','removeDispositions','ids','addContacts','CmContact','tags','isArray','push','each','omit','dataValues','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','now','writeFileSync','/tmp/list_%d_%s.csv','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','text/csv','download','findOne','sequelize','TEXT','text','number','INTEGER','switch','Sequelize','BOOLEAN','queryInterface','addColumn','cm_contacts','getCustomFields','findAndCountAll','addAgents','spread','removeAgents','userCmList:remove','emit','getAgents','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','Lists','UserProfileResource','end','error','stack','name','send','CmList','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x2dbce7,_0x57cb8d){var _0x3a3ed0=function(_0x28c8c6){while(--_0x28c8c6){_0x2dbce7['push'](_0x2dbce7['shift']());}};_0x3a3ed0(++_0x57cb8d);}(_0x681e,0xd0));var _0xe681=function(_0x169045,_0x5d2d40){_0x169045=_0x169045-0x0;var _0x4d210b=_0x681e[_0x169045];return _0x4d210b;};'use strict';var emlformat=require(_0xe681('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe681('0x1'));var rp=require(_0xe681('0x2'));var moment=require(_0xe681('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe681('0x4'));var util=require(_0xe681('0x5'));var path=require(_0xe681('0x6'));var sox=require(_0xe681('0x7'));var csv=require(_0xe681('0x8'));var ejs=require(_0xe681('0x9'));var fs=require('fs');var fs_extra=require(_0xe681('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe681('0xb'));var deskjs=require(_0xe681('0xc'));var toCsv=require(_0xe681('0x8'));var querystring=require(_0xe681('0xd'));var Papa=require('papaparse');var Redis=require(_0xe681('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe681('0xf'));var as=require(_0xe681('0x10'));var hardwareService=require(_0xe681('0x11'));var logger=require('../../config/logger')(_0xe681('0x12'));var utils=require(_0xe681('0x13'));var config=require(_0xe681('0x14'));var licenseUtil=require(_0xe681('0x15'));var db=require(_0xe681('0x16'))['db'];config['redis']=_[_0xe681('0x17')](config[_0xe681('0x18')],{'host':_0xe681('0x19'),'port':0x18eb});var socket=require(_0xe681('0x1a'))(new Redis(config[_0xe681('0x18')]));require('./cmList.socket')['register'](socket);function respondWithStatusCode(_0x5e6a23,_0x53ef85){_0x53ef85=_0x53ef85||0xcc;return function(_0x32fd70){if(_0x32fd70){return _0x5e6a23[_0xe681('0x1b')](_0x53ef85);}return _0x5e6a23[_0xe681('0x1c')](_0x53ef85)['end']();};}function respondWithResult(_0x98689,_0x5d8ec4){_0x5d8ec4=_0x5d8ec4||0xc8;return function(_0x4bd7fe){if(_0x4bd7fe){return _0x98689[_0xe681('0x1c')](_0x5d8ec4)[_0xe681('0x1d')](_0x4bd7fe);}};}function respondWithFilteredResult(_0x292490,_0x5cde5a){return function(_0x67c0c7){if(_0x67c0c7){var _0x130625=typeof _0x5cde5a[_0xe681('0x1e')]===_0xe681('0x1f')&&typeof _0x5cde5a[_0xe681('0x20')]===_0xe681('0x1f');var _0x126bfd=_0x67c0c7['count'];var _0x52c39f=_0x130625?0x0:_0x5cde5a[_0xe681('0x1e')];var _0x4c4e5c=_0x130625?_0x67c0c7[_0xe681('0x21')]:_0x5cde5a[_0xe681('0x1e')]+_0x5cde5a[_0xe681('0x20')];var _0x37c8da;if(_0x4c4e5c>=_0x126bfd){_0x4c4e5c=_0x126bfd;_0x37c8da=0xc8;}else{_0x37c8da=0xce;}_0x292490[_0xe681('0x1c')](_0x37c8da);return _0x292490[_0xe681('0x22')](_0xe681('0x23'),_0x52c39f+'-'+_0x4c4e5c+'/'+_0x126bfd)[_0xe681('0x1d')](_0x67c0c7);}return null;};}function patchUpdates(_0x3d03b5){return function(_0x36a355){try{jsonpatch['apply'](_0x36a355,_0x3d03b5,!![]);}catch(_0x1cecf9){return BPromise[_0xe681('0x24')](_0x1cecf9);}return _0x36a355[_0xe681('0x25')]();};}function saveUpdates(_0x42d970,_0x6e39e2){return function(_0x4cad2e){if(_0x4cad2e){return _0x4cad2e[_0xe681('0x26')](_0x42d970)[_0xe681('0x27')](function(_0xffa44b){return _0xffa44b;});}return null;};}function removeEntity(_0x481690,_0xbdaa86){return function(_0x19fb0b){if(_0x19fb0b){return _0x19fb0b[_0xe681('0x28')]()[_0xe681('0x27')](function(){var _0x3587e5=_0x19fb0b['get']({'plain':!![]});var _0x4957f3=_0xe681('0x29');return db[_0xe681('0x2a')]['destroy']({'where':{'type':_0x4957f3,'resourceId':_0x3587e5['id']}})['then'](function(){return _0x19fb0b;});})[_0xe681('0x27')](function(){_0x481690['status'](0xcc)[_0xe681('0x2b')]();});}};}function handleEntityNotFound(_0x1d14c4,_0xe9bfdf){return function(_0x433b6b){if(!_0x433b6b){_0x1d14c4[_0xe681('0x1b')](0x194);}return _0x433b6b;};}function handleError(_0x16417c,_0x554aef){_0x554aef=_0x554aef||0x1f4;return function(_0x410adb){logger[_0xe681('0x2c')](_0x410adb[_0xe681('0x2d')]);if(_0x410adb['name']){delete _0x410adb[_0xe681('0x2e')];}_0x16417c['status'](_0x554aef)[_0xe681('0x2f')](_0x410adb);};}exports['index']=function(_0x2855ad,_0xbe87e8){var _0x52c22f={},_0x202a8b={},_0x4db9b3={'count':0x0,'rows':[]};var _0x2115eb=_['map'](db[_0xe681('0x30')][_0xe681('0x31')],function(_0x1be038){return{'name':_0x1be038[_0xe681('0x32')],'type':_0x1be038[_0xe681('0x33')][_0xe681('0x34')]};});_0x202a8b[_0xe681('0x35')]=_[_0xe681('0x36')](_0x2115eb,'name');_0x202a8b[_0xe681('0x37')]=_[_0xe681('0x38')](_0x2855ad[_0xe681('0x37')]);_0x202a8b[_0xe681('0x39')]=_[_0xe681('0x3a')](_0x202a8b['model'],_0x202a8b[_0xe681('0x37')]);_0x52c22f['attributes']=_['intersection'](_0x202a8b['model'],qs[_0xe681('0x3b')](_0x2855ad['query'][_0xe681('0x3b')]));_0x52c22f[_0xe681('0x3c')]=_0x52c22f['attributes'][_0xe681('0x3d')]?_0x52c22f[_0xe681('0x3c')]:_0x202a8b['model'];if(!_0x2855ad[_0xe681('0x37')][_0xe681('0x3e')](_0xe681('0x3f'))){_0x52c22f[_0xe681('0x20')]=qs[_0xe681('0x20')](_0x2855ad['query'][_0xe681('0x20')]);_0x52c22f[_0xe681('0x1e')]=qs[_0xe681('0x1e')](_0x2855ad['query'][_0xe681('0x1e')]);}_0x52c22f[_0xe681('0x40')]=qs['sort'](_0x2855ad['query'][_0xe681('0x41')]);_0x52c22f[_0xe681('0x42')]=qs[_0xe681('0x39')](_[_0xe681('0x43')](_0x2855ad[_0xe681('0x37')],_0x202a8b[_0xe681('0x39')]),_0x2115eb);if(_0x2855ad[_0xe681('0x37')][_0xe681('0x44')]){_0x52c22f[_0xe681('0x42')]=_[_0xe681('0x45')](_0x52c22f[_0xe681('0x42')],{'$or':_[_0xe681('0x36')](_0x2115eb,function(_0x584d2a){if(_0x584d2a[_0xe681('0x33')]!==_0xe681('0x46')){var _0x34458a={};_0x34458a[_0x584d2a[_0xe681('0x2e')]]={'$like':'%'+_0x2855ad['query'][_0xe681('0x44')]+'%'};return _0x34458a;}})});}_0x52c22f=_['merge']({},_0x52c22f,_0x2855ad[_0xe681('0x47')]);var _0x17db4c={'where':_0x52c22f[_0xe681('0x42')]};return db[_0xe681('0x30')][_0xe681('0x21')](_0x17db4c)[_0xe681('0x27')](function(_0xcc3ab7){_0x4db9b3[_0xe681('0x21')]=_0xcc3ab7;if(_0x2855ad[_0xe681('0x37')][_0xe681('0x48')]){_0x52c22f[_0xe681('0x49')]=[{'all':!![]}];}return db[_0xe681('0x30')][_0xe681('0x4a')](_0x52c22f);})[_0xe681('0x27')](function(_0x2e3c40){_0x4db9b3[_0xe681('0x4b')]=_0x2e3c40;return _0x4db9b3;})[_0xe681('0x27')](respondWithFilteredResult(_0xbe87e8,_0x52c22f))[_0xe681('0x4c')](handleError(_0xbe87e8,null));};exports[_0xe681('0x4d')]=function(_0x31fdbe,_0xeaa4be){var _0x5a272f={'raw':![],'where':{'id':_0x31fdbe[_0xe681('0x4e')]['id']}},_0x14142a={};_0x14142a[_0xe681('0x35')]=_['keys'](db[_0xe681('0x30')][_0xe681('0x31')]);_0x14142a['query']=_['keys'](_0x31fdbe[_0xe681('0x37')]);_0x14142a[_0xe681('0x39')]=_[_0xe681('0x3a')](_0x14142a[_0xe681('0x35')],_0x14142a['query']);_0x5a272f[_0xe681('0x3c')]=_[_0xe681('0x3a')](_0x14142a['model'],qs[_0xe681('0x3b')](_0x31fdbe[_0xe681('0x37')][_0xe681('0x3b')]));_0x5a272f[_0xe681('0x3c')]=_0x5a272f[_0xe681('0x3c')][_0xe681('0x3d')]?_0x5a272f['attributes']:_0x14142a[_0xe681('0x35')];if(_0x31fdbe[_0xe681('0x37')]['includeAll']){_0x5a272f[_0xe681('0x49')]=[{'all':!![]}];}_0x5a272f=_['merge']({},_0x5a272f,_0x31fdbe['options']);return db[_0xe681('0x30')][_0xe681('0x4f')](_0x5a272f)['then'](handleEntityNotFound(_0xeaa4be,null))[_0xe681('0x27')](respondWithResult(_0xeaa4be,null))[_0xe681('0x4c')](handleError(_0xeaa4be,null));};exports[_0xe681('0x50')]=function(_0x367a27,_0x2576b4){return db['CmList'][_0xe681('0x50')](_0x367a27[_0xe681('0x51')],{})[_0xe681('0x27')](function(_0x6e3876){var _0x432334=_0x367a27[_0xe681('0x52')][_0xe681('0x53')]({'plain':!![]});if(!_0x432334)throw new Error(_0xe681('0x54'));if(_0x432334['role']==='user'){var _0x65c9da=_0x6e3876[_0xe681('0x53')]({'plain':!![]});var _0x13efb5=_0xe681('0x29');return db[_0xe681('0x55')][_0xe681('0x4f')]({'where':{'name':_0x13efb5,'userProfileId':_0x432334[_0xe681('0x56')]},'raw':!![]})[_0xe681('0x27')](function(_0xd6b72f){if(_0xd6b72f&&_0xd6b72f[_0xe681('0x57')]===0x0){return db[_0xe681('0x2a')][_0xe681('0x50')]({'name':_0x65c9da[_0xe681('0x2e')],'resourceId':_0x65c9da['id'],'type':_0xd6b72f[_0xe681('0x2e')],'sectionId':_0xd6b72f['id']},{})[_0xe681('0x27')](function(){return _0x6e3876;});}else{return _0x6e3876;}})['catch'](function(_0x53a638){logger[_0xe681('0x2c')](_0xe681('0x58'),_0x53a638);throw _0x53a638;});}return _0x6e3876;})['then'](respondWithResult(_0x2576b4,0xc9))[_0xe681('0x4c')](handleError(_0x2576b4,null));};exports[_0xe681('0x26')]=function(_0x1640a3,_0x48136a){if(_0x1640a3[_0xe681('0x51')]['id']){delete _0x1640a3['body']['id'];}return db[_0xe681('0x30')]['find']({'where':{'id':_0x1640a3['params']['id']}})['then'](handleEntityNotFound(_0x48136a,null))['then'](saveUpdates(_0x1640a3[_0xe681('0x51')],null))[_0xe681('0x27')](respondWithResult(_0x48136a,null))['catch'](handleError(_0x48136a,null));};exports[_0xe681('0x28')]=function(_0x4f1b24,_0x3d6b30){return db[_0xe681('0x30')][_0xe681('0x4f')]({'where':{'id':_0x4f1b24[_0xe681('0x4e')]['id']}})[_0xe681('0x27')](handleEntityNotFound(_0x3d6b30,null))[_0xe681('0x27')](removeEntity(_0x3d6b30,null))[_0xe681('0x4c')](handleError(_0x3d6b30,null));};exports[_0xe681('0x59')]=function(_0x3ff03f,_0x1b10dc){return db['CmList']['describe']()[_0xe681('0x27')](respondWithResult(_0x1b10dc,null))[_0xe681('0x4c')](handleError(_0x1b10dc,null));};exports[_0xe681('0x5a')]=function(_0x59e339,_0x368054,_0x18af14){if(_0x59e339[_0xe681('0x51')]['id']){delete _0x59e339['body']['id'];}return db[_0xe681('0x30')][_0xe681('0x4f')]({'where':{'id':_0x59e339[_0xe681('0x4e')]['id']}})['then'](handleEntityNotFound(_0x368054,null))['then'](function(_0x36f876){if(_0x36f876){_0x59e339[_0xe681('0x51')][_0xe681('0x5b')]=_0x36f876['id'];return db[_0xe681('0x5c')][_0xe681('0x50')](_0x59e339[_0xe681('0x51')]);}})['then'](respondWithResult(_0x368054,null))[_0xe681('0x4c')](handleError(_0x368054,null));};exports[_0xe681('0x5d')]=function(_0xcc31c6,_0x3da103,_0x486378){var _0x4474cb={'raw':![],'where':{}};var _0x149681={};var _0x19004c={'count':0x0,'rows':[]};return db[_0xe681('0x30')]['findOne']({'where':{'id':_0xcc31c6['params']['id']}})['then'](handleEntityNotFound(_0x3da103,null))['then'](function(_0x59f268){if(_0x59f268){_0x149681[_0xe681('0x35')]=_['keys'](db[_0xe681('0x5c')][_0xe681('0x31')]);_0x149681[_0xe681('0x37')]=_[_0xe681('0x38')](_0xcc31c6[_0xe681('0x37')]);_0x149681[_0xe681('0x39')]=_[_0xe681('0x3a')](_0x149681[_0xe681('0x35')],_0x149681[_0xe681('0x37')]);_0x4474cb['attributes']=_['intersection'](_0x149681[_0xe681('0x35')],qs[_0xe681('0x3b')](_0xcc31c6[_0xe681('0x37')][_0xe681('0x3b')]));_0x4474cb['attributes']=_0x4474cb[_0xe681('0x3c')][_0xe681('0x3d')]?_0x4474cb[_0xe681('0x3c')]:_0x149681['model'];if(!_0xcc31c6[_0xe681('0x37')][_0xe681('0x3e')](_0xe681('0x3f'))){_0x4474cb[_0xe681('0x20')]=qs['limit'](_0xcc31c6['query']['limit']);_0x4474cb['offset']=qs[_0xe681('0x1e')](_0xcc31c6[_0xe681('0x37')][_0xe681('0x1e')]);}_0x4474cb['order']=qs[_0xe681('0x41')](_0xcc31c6['query']['sort']);_0x4474cb[_0xe681('0x42')]=qs[_0xe681('0x39')](_[_0xe681('0x43')](_0xcc31c6[_0xe681('0x37')],_0x149681[_0xe681('0x39')]));_0x4474cb[_0xe681('0x42')][_0xe681('0x5b')]=_0x59f268['id'];if(_0xcc31c6[_0xe681('0x37')][_0xe681('0x44')]){_0x4474cb['where']=_['merge'](_0x4474cb[_0xe681('0x42')],{'$or':_[_0xe681('0x36')](_0x4474cb['attributes'],function(_0x302203){var _0x211e5={};_0x211e5[_0x302203]={'$like':'%'+_0xcc31c6[_0xe681('0x37')][_0xe681('0x44')]+'%'};return _0x211e5;})});}_0x4474cb=_[_0xe681('0x45')]({},_0x4474cb,_0xcc31c6[_0xe681('0x47')]);return db[_0xe681('0x5c')][_0xe681('0x21')]({'where':_0x4474cb[_0xe681('0x42')]})[_0xe681('0x27')](function(_0x35ba38){_0x19004c[_0xe681('0x21')]=_0x35ba38;if(_0xcc31c6[_0xe681('0x37')][_0xe681('0x48')]){_0x4474cb[_0xe681('0x49')]=[{'all':!![]}];}return db[_0xe681('0x5c')][_0xe681('0x4a')](_0x4474cb);})[_0xe681('0x27')](function(_0x171347){_0x19004c[_0xe681('0x4b')]=_0x171347;return _0x19004c;});}})[_0xe681('0x27')](respondWithFilteredResult(_0x3da103,_0x4474cb))['catch'](handleError(_0x3da103,null));};exports[_0xe681('0x5e')]=function(_0x57f69a,_0x4c8244,_0x383a75){return db[_0xe681('0x30')][_0xe681('0x4f')]({'where':{'id':_0x57f69a['params']['id']}})[_0xe681('0x27')](handleEntityNotFound(_0x4c8244,null))[_0xe681('0x27')](function(_0x1468b2){if(_0x1468b2){return _0x1468b2[_0xe681('0x5e')](_0x57f69a[_0xe681('0x37')][_0xe681('0x5f')]);}})[_0xe681('0x27')](respondWithStatusCode(_0x4c8244,null))['catch'](handleError(_0x4c8244,null));};exports[_0xe681('0x60')]=function(_0x38d167,_0x3b91bf,_0x16d7c2){return db['CmList'][_0xe681('0x4f')]({'where':{'id':_0x38d167[_0xe681('0x4e')]['id']}})[_0xe681('0x27')](handleEntityNotFound(_0x3b91bf,null))[_0xe681('0x27')](function(_0x5839a2){if(_0x5839a2){var _0x254f9e=[];var _0x2575f2={'success':[],'errors':[]};return db[_0xe681('0x61')]['describe']()[_0xe681('0x27')](function(_0x489e6b){if(_0x38d167[_0xe681('0x51')][_0xe681('0x62')]&&_['isArray'](_0x38d167[_0xe681('0x51')]['tags'])){if(_0x38d167['body'][_0xe681('0x62')][_0xe681('0x3d')]){_0x38d167[_0xe681('0x51')][_0xe681('0x62')]=_0x38d167['body'][_0xe681('0x62')]['join'](';')+';';}else{_0x38d167[_0xe681('0x51')][_0xe681('0x62')]=null;}}else{_0x38d167[_0xe681('0x51')][_0xe681('0x62')]=null;}if(_0x38d167[_0xe681('0x51')]&&_[_0xe681('0x63')](_0x38d167['body'])){for(var _0x258b42=0x0;_0x258b42<_0x38d167[_0xe681('0x51')][_0xe681('0x3d')];_0x258b42+=0x1){_0x38d167['body'][_0x258b42]['ListId']=_0x38d167[_0xe681('0x4e')]['id'];_0x254f9e[_0xe681('0x64')](_0x38d167['body'][_0x258b42]);}return BPromise[_0xe681('0x65')](_0x254f9e,function(_0x4ffd32){return db[_0xe681('0x61')]['create'](_[_0xe681('0x66')](_0x4ffd32,[_0xe681('0x5f'),'id'])||{},{'fields':_[_0xe681('0x38')](_0x489e6b),'raw':!![]})['then'](function(_0x9ea0d1){_0x2575f2['success'][_0xe681('0x64')](_0x9ea0d1[_0xe681('0x67')]);})[_0xe681('0x4c')](function(_0x71bcfc){_0x2575f2['errors'][_0xe681('0x64')]({'data':_0x4ffd32,'error':_0x71bcfc[_0xe681('0x68')]});});})[_0xe681('0x27')](function(_0x294b43){return _0x2575f2;})['catch'](function(_0x4f99ce){return _0x4f99ce;});}else{_0x3b91bf[_0xe681('0x1c')](0x190)['json']({'message':_0xe681('0x69')});}});}})[_0xe681('0x27')](respondWithResult(_0x3b91bf,null))[_0xe681('0x4c')](handleError(_0x3b91bf,null));};exports[_0xe681('0x6a')]=function(_0x40d68b,_0x143c60,_0x4860c4){var _0x37eec5;return db[_0xe681('0x30')][_0xe681('0x4f')]({'where':{'id':_0x40d68b[_0xe681('0x4e')]['id']},'include':[{'model':db[_0xe681('0x6b')],'as':_0xe681('0x6c')}]})['then'](handleEntityNotFound(_0x143c60,null))[_0xe681('0x27')](function(_0x5005bf){if(_0x5005bf){_0x37eec5=_0x5005bf;return db[_0xe681('0x61')][_0xe681('0x31')];}})[_0xe681('0x27')](function(_0x4bd00d){if(_0x4bd00d){var _0x36f62f={};var _0x44c024={};_0x44c024['model']=_[_0xe681('0x6d')](_[_0xe681('0x38')](_0x4bd00d),_[_0xe681('0x36')](_0x37eec5[_0xe681('0x6c')],function(_0x585396){return util[_0xe681('0x6e')](_0xe681('0x6f'),_0x585396['id']);}));_0x44c024['query']=_[_0xe681('0x38')](_0x40d68b[_0xe681('0x37')]);_0x44c024[_0xe681('0x39')]=_[_0xe681('0x3a')](_0x44c024[_0xe681('0x35')],_0x44c024[_0xe681('0x37')]);_0x36f62f['attributes']=_[_0xe681('0x3a')](_0x44c024[_0xe681('0x35')],qs['fields'](_0x40d68b[_0xe681('0x37')][_0xe681('0x3b')]));_0x36f62f[_0xe681('0x3c')]=_0x36f62f[_0xe681('0x3c')]['length']?_0x36f62f[_0xe681('0x3c')]:_0x44c024['model'];if(!_0x40d68b[_0xe681('0x37')]['hasOwnProperty']('nolimit')){_0x36f62f[_0xe681('0x20')]=qs[_0xe681('0x20')](_0x40d68b[_0xe681('0x37')][_0xe681('0x20')]);_0x36f62f['offset']=qs[_0xe681('0x1e')](_0x40d68b[_0xe681('0x37')][_0xe681('0x1e')]);}_0x36f62f['order']=qs[_0xe681('0x41')](_0x40d68b['query'][_0xe681('0x41')]);_0x36f62f[_0xe681('0x42')]=qs['filters'](_[_0xe681('0x43')](_0x40d68b[_0xe681('0x37')],_0x44c024['filters']));_0x36f62f[_0xe681('0x70')]=!![];if(_0x40d68b['query'][_0xe681('0x44')]){_0x36f62f[_0xe681('0x42')]=_['merge'](_0x36f62f['where'],{'$or':_[_0xe681('0x36')](_0x36f62f[_0xe681('0x3c')],function(_0x2e5ee4){var _0x2c45b7={};_0x2c45b7[_0x2e5ee4]={'$like':'%'+_0x40d68b[_0xe681('0x37')][_0xe681('0x44')]+'%'};return _0x2c45b7;})});}_0x36f62f=_[_0xe681('0x45')]({},_0x36f62f,_0x40d68b[_0xe681('0x47')]);return _0x37eec5[_0xe681('0x6a')](_0x36f62f);}})[_0xe681('0x27')](respondWithResult(_0x143c60,null))[_0xe681('0x4c')](handleError(_0x143c60,null));};exports['getContactsCsv']=function(_0x3bbe1b,_0x4432e2,_0x10ce04){var _0x1428c2;return db[_0xe681('0x30')][_0xe681('0x4f')]({'where':{'id':_0x3bbe1b[_0xe681('0x4e')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xe681('0x6c')}]})[_0xe681('0x27')](handleEntityNotFound(_0x4432e2,null))[_0xe681('0x27')](function(_0x34454f){if(_0x34454f){_0x1428c2=_0x34454f;return db[_0xe681('0x61')]['rawAttributes'];}})[_0xe681('0x27')](function(_0x46a091){if(_0x46a091){var _0x4ad159={};var _0x39a1df={};_0x39a1df[_0xe681('0x35')]=_[_0xe681('0x6d')](_[_0xe681('0x38')](_0x46a091),_['map'](_0x1428c2[_0xe681('0x6c')],function(_0x2af73d){return util[_0xe681('0x6e')](_0xe681('0x6f'),_0x2af73d['id']);}));_0x39a1df[_0xe681('0x37')]=_[_0xe681('0x38')](_0x3bbe1b[_0xe681('0x37')]);_0x39a1df[_0xe681('0x39')]=_[_0xe681('0x3a')](_0x39a1df[_0xe681('0x35')],_0x39a1df[_0xe681('0x37')]);_0x4ad159[_0xe681('0x3c')]=_['intersection'](_0x39a1df['model'],qs[_0xe681('0x3b')](_0x3bbe1b['query'][_0xe681('0x3b')]));_0x4ad159['attributes']=_0x4ad159['attributes'][_0xe681('0x3d')]?_0x4ad159[_0xe681('0x3c')]:_0x39a1df['model'];if(!_0x3bbe1b['query'][_0xe681('0x3e')]('nolimit')){_0x4ad159[_0xe681('0x20')]=qs['limit'](_0x3bbe1b[_0xe681('0x37')][_0xe681('0x20')]);_0x4ad159[_0xe681('0x1e')]=qs[_0xe681('0x1e')](_0x3bbe1b['query']['offset']);}_0x4ad159['order']=qs[_0xe681('0x41')](_0x3bbe1b[_0xe681('0x37')][_0xe681('0x41')]);_0x4ad159[_0xe681('0x42')]=qs[_0xe681('0x39')](_[_0xe681('0x43')](_0x3bbe1b[_0xe681('0x37')],_0x39a1df[_0xe681('0x39')]));_0x4ad159['raw']=!![];if(_0x3bbe1b[_0xe681('0x37')][_0xe681('0x44')]){_0x4ad159[_0xe681('0x42')]=_[_0xe681('0x45')](_0x4ad159['where'],{'$or':_[_0xe681('0x36')](_0x4ad159[_0xe681('0x3c')],function(_0x2746d1){var _0x2c21ac={};_0x2c21ac[_0x2746d1]={'$like':'%'+_0x3bbe1b['query']['filter']+'%'};return _0x2c21ac;})});}_0x4ad159=_[_0xe681('0x45')]({},_0x4ad159,_0x3bbe1b[_0xe681('0x47')]);return _0x1428c2[_0xe681('0x6a')](_0x4ad159);}})[_0xe681('0x27')](function(_0x1a2dcf){if(!_['isEmpty'](_0x1a2dcf)){var _0x1bd35e=toCsv(_0x1a2dcf);var _0x42d1fb=Date[_0xe681('0x71')]();fs[_0xe681('0x72')](util[_0xe681('0x6e')](_0xe681('0x73'),_0x1428c2['id'],_0x42d1fb),_0x1bd35e);_0x4432e2['setHeader']('Content-disposition',_0xe681('0x74')+util[_0xe681('0x6e')](_0xe681('0x75'),_0x1428c2['id'],_0x42d1fb));_0x4432e2[_0xe681('0x76')](_0xe681('0x77'),_0xe681('0x78'));return _0x4432e2[_0xe681('0x79')](util[_0xe681('0x6e')]('/tmp/list_%d_%s.csv',_0x1428c2['id'],_0x42d1fb));}else{return _0x4432e2[_0xe681('0x1b')](0xcc);}})[_0xe681('0x4c')](handleError(_0x4432e2,null));};exports['addCustomField']=function(_0x107690,_0x473719,_0x50490e){var _0x44b117;delete _0x107690[_0xe681('0x51')]['id'];return db[_0xe681('0x30')][_0xe681('0x7a')]({'where':{'id':_0x107690[_0xe681('0x4e')]['id']}})[_0xe681('0x27')](handleEntityNotFound(_0x473719,null))[_0xe681('0x27')](function(_0x2c82fd){if(_0x2c82fd){return db[_0xe681('0x7b')]['transaction'](function(_0x5ba756){return db[_0xe681('0x6b')][_0xe681('0x50')](_0x107690[_0xe681('0x51')],{'transaction':_0x5ba756})['then'](function(_0x506d1b){_0x44b117=_0x506d1b;return _0x2c82fd['addCustomFields'](_0x506d1b,{'transaction':_0x5ba756});})[_0xe681('0x27')](function(){var _0x108072={'type':db['Sequelize'][_0xe681('0x7c')],'transaction':_0x5ba756};switch(_0x107690[_0xe681('0x51')][_0xe681('0x33')]){case _0xe681('0x7d'):_0x108072[_0xe681('0x33')]=db['Sequelize']['TEXT'];break;case _0xe681('0x7e'):_0x108072[_0xe681('0x33')]=db['Sequelize'][_0xe681('0x7f')];break;case _0xe681('0x80'):_0x108072[_0xe681('0x33')]=db[_0xe681('0x81')][_0xe681('0x82')];_0x108072['defaultValue']=![];break;default:}return db[_0xe681('0x7b')][_0xe681('0x83')][_0xe681('0x84')](_0xe681('0x85'),util['format']('cf_%s',_0x44b117['id']),_0x108072);})['then'](function(){return _0x44b117;});});}})['then'](respondWithResult(_0x473719,null))['catch'](handleError(_0x473719,null));};exports[_0xe681('0x86')]=function(_0x48f1ce,_0x3b92d7,_0x363892){var _0x4ac9fe={};var _0x14ea16={};var _0x579cc9;var _0x4a9436;return db[_0xe681('0x30')]['findOne']({'where':{'id':_0x48f1ce[_0xe681('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3b92d7,null))['then'](function(_0x43d07f){if(_0x43d07f){_0x579cc9=_0x43d07f;_0x14ea16[_0xe681('0x35')]=_[_0xe681('0x38')](db[_0xe681('0x6b')][_0xe681('0x31')]);_0x14ea16[_0xe681('0x37')]=_[_0xe681('0x38')](_0x48f1ce[_0xe681('0x37')]);_0x14ea16['filters']=_[_0xe681('0x3a')](_0x14ea16[_0xe681('0x35')],_0x14ea16['query']);_0x4ac9fe[_0xe681('0x3c')]=_[_0xe681('0x3a')](_0x14ea16[_0xe681('0x35')],qs[_0xe681('0x3b')](_0x48f1ce[_0xe681('0x37')][_0xe681('0x3b')]));_0x4ac9fe[_0xe681('0x3c')]=_0x4ac9fe['attributes'][_0xe681('0x3d')]?_0x4ac9fe['attributes']:_0x14ea16['model'];_0x4ac9fe['order']=qs[_0xe681('0x41')](_0x48f1ce[_0xe681('0x37')][_0xe681('0x41')]);_0x4ac9fe['where']=qs[_0xe681('0x39')](_[_0xe681('0x43')](_0x48f1ce[_0xe681('0x37')],_0x14ea16[_0xe681('0x39')]));_0x4ac9fe[_0xe681('0x42')]=_[_0xe681('0x45')](_0x4ac9fe[_0xe681('0x42')],{'$or':[{'ListId':_0x43d07f['id']},{'ListId':null}]});if(_0x48f1ce['query']['filter']){_0x4ac9fe[_0xe681('0x42')]=_[_0xe681('0x45')](_0x4ac9fe[_0xe681('0x42')],{'$or':_[_0xe681('0x36')](_0x4ac9fe[_0xe681('0x3c')],function(_0x2cad60){var _0x11ec61={};_0x11ec61[_0x2cad60]={'$like':'%'+_0x48f1ce[_0xe681('0x37')][_0xe681('0x44')]+'%'};return _0x11ec61;})});}_0x4ac9fe=_[_0xe681('0x45')]({},_0x4ac9fe,_0x48f1ce[_0xe681('0x47')]);return db[_0xe681('0x6b')][_0xe681('0x87')](_0x4ac9fe);}})[_0xe681('0x27')](respondWithResult(_0x3b92d7,null))[_0xe681('0x4c')](handleError(_0x3b92d7,null));};exports[_0xe681('0x88')]=function(_0x15a197,_0x272852,_0x3efe8f){return db[_0xe681('0x30')][_0xe681('0x4f')]({'where':{'id':_0x15a197[_0xe681('0x4e')]['id']}})[_0xe681('0x27')](handleEntityNotFound(_0x272852,null))[_0xe681('0x27')](function(_0x3c810a){if(_0x3c810a){return _0x3c810a[_0xe681('0x88')](_0x15a197[_0xe681('0x51')][_0xe681('0x5f')],_[_0xe681('0x66')](_0x15a197[_0xe681('0x51')],[_0xe681('0x5f'),'id'])||{})[_0xe681('0x89')](function(_0x258256){for(var _0x20f2d1=0x0;_0x20f2d1<_0x15a197[_0xe681('0x51')][_0xe681('0x5f')]['length'];_0x20f2d1+=0x1){socket['emit']('userCmList:save',{'UserId':Number(_0x15a197[_0xe681('0x51')][_0xe681('0x5f')][_0x20f2d1]),'CmListId':Number(_0x15a197[_0xe681('0x4e')]['id'])});}return _0x258256;});}})['then'](respondWithResult(_0x272852,null))['catch'](handleError(_0x272852,null));};exports[_0xe681('0x8a')]=function(_0x53ddbc,_0x2e9e27,_0x13e040){return db['CmList']['find']({'where':{'id':_0x53ddbc[_0xe681('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2e9e27,null))[_0xe681('0x27')](function(_0x271bf2){if(_0x271bf2){return _0x271bf2[_0xe681('0x8a')](_0x53ddbc['query']['ids'])[_0xe681('0x27')](function(){if(_[_0xe681('0x63')](_0x53ddbc[_0xe681('0x37')][_0xe681('0x5f')])){for(var _0x1d748b=0x0;_0x1d748b<_0x53ddbc[_0xe681('0x37')]['ids']['length'];_0x1d748b+=0x1){socket['emit'](_0xe681('0x8b'),{'UserId':Number(_0x53ddbc[_0xe681('0x37')][_0xe681('0x5f')][_0x1d748b]),'CmListId':Number(_0x53ddbc['params']['id'])});}}else{socket[_0xe681('0x8c')](_0xe681('0x8b'),{'UserId':Number(_0x53ddbc[_0xe681('0x37')][_0xe681('0x5f')]),'CmListId':Number(_0x53ddbc[_0xe681('0x4e')]['id'])});}});}})[_0xe681('0x27')](respondWithStatusCode(_0x2e9e27,null))[_0xe681('0x4c')](handleError(_0x2e9e27,null));};exports[_0xe681('0x8d')]=function(_0x3fd156,_0x176b17,_0x3be041){var _0x1886a4={};var _0x141fdc={};var _0x5e0f7e;var _0xa72fb1;return db[_0xe681('0x30')][_0xe681('0x7a')]({'where':{'id':_0x3fd156['params']['id']}})[_0xe681('0x27')](handleEntityNotFound(_0x176b17,null))[_0xe681('0x27')](function(_0xa4626a){if(_0xa4626a){_0x5e0f7e=_0xa4626a;_0x141fdc[_0xe681('0x35')]=_['keys'](db['User']['rawAttributes']);_0x141fdc[_0xe681('0x37')]=_[_0xe681('0x38')](_0x3fd156['query']);_0x141fdc[_0xe681('0x39')]=_['intersection'](_0x141fdc['model'],_0x141fdc[_0xe681('0x37')]);_0x1886a4[_0xe681('0x3c')]=_[_0xe681('0x3a')](_0x141fdc[_0xe681('0x35')],qs[_0xe681('0x3b')](_0x3fd156[_0xe681('0x37')][_0xe681('0x3b')]));_0x1886a4[_0xe681('0x3c')]=_0x1886a4[_0xe681('0x3c')][_0xe681('0x3d')]?_0x1886a4['attributes']:_0x141fdc[_0xe681('0x35')];_0x1886a4[_0xe681('0x40')]=qs['sort'](_0x3fd156['query'][_0xe681('0x41')]);_0x1886a4[_0xe681('0x42')]=qs[_0xe681('0x39')](_[_0xe681('0x43')](_0x3fd156[_0xe681('0x37')],_0x141fdc[_0xe681('0x39')]));if(_0x3fd156[_0xe681('0x37')]['filter']){_0x1886a4[_0xe681('0x42')]=_[_0xe681('0x45')](_0x1886a4[_0xe681('0x42')],{'$or':_[_0xe681('0x36')](_0x1886a4[_0xe681('0x3c')],function(_0x3cefdd){var _0x1d08e4={};_0x1d08e4[_0x3cefdd]={'$like':'%'+_0x3fd156[_0xe681('0x37')][_0xe681('0x44')]+'%'};return _0x1d08e4;})});}_0x1886a4=_[_0xe681('0x45')]({},_0x1886a4,_0x3fd156[_0xe681('0x47')]);return _0x5e0f7e[_0xe681('0x8d')](_0x1886a4);}})[_0xe681('0x27')](function(_0x2cdd11){if(_0x2cdd11){_0xa72fb1=_0x2cdd11['length'];if(!_0x3fd156[_0xe681('0x37')][_0xe681('0x3e')](_0xe681('0x3f'))){_0x1886a4['limit']=qs[_0xe681('0x20')](_0x3fd156[_0xe681('0x37')]['limit']);_0x1886a4[_0xe681('0x1e')]=qs[_0xe681('0x1e')](_0x3fd156[_0xe681('0x37')][_0xe681('0x1e')]);}return _0x5e0f7e[_0xe681('0x8d')](_0x1886a4);}})[_0xe681('0x27')](function(_0x512237){if(_0x512237){return _0x512237?{'count':_0xa72fb1,'rows':_0x512237}:null;}})[_0xe681('0x27')](respondWithResult(_0x176b17,null))[_0xe681('0x4c')](handleError(_0x176b17,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 1520b90..e207514 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(_0x16960e,_0x169c9f){var _0x1c24ce=function(_0x58c97){while(--_0x58c97){_0x16960e['push'](_0x16960e['shift']());}};_0x1c24ce(++_0x169c9f);}(_0x814b,0x1a2));var _0xb814=function(_0x36d8d9,_0x17b58a){_0x36d8d9=_0x36d8d9-0x0;var _0x1ac3a2=_0x814b[_0x36d8d9];return _0x1ac3a2;};'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 _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0xbc4560,_0x4020b8){var _0x298cfb=function(_0x254423){while(--_0x254423){_0xbc4560['push'](_0xbc4560['shift']());}};_0x298cfb(++_0x4020b8);}(_0x55ca,0x126));var _0xa55c=function(_0x4c3296,_0x262566){_0x4c3296=_0x4c3296-0x0;var _0x5260de=_0x55ca[_0x4c3296];return _0x5260de;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var CmList=require(_0xa55c('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){CmListEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);CmListEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];CmList[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index ef21c83..3bd5fdb 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 _0x6f0d=['./cmList.attributes','define','CmList','cm_lists','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x4801c8,_0x470ce5){_0x4801c8=_0x4801c8-0x0;var _0x353fc7=_0x6f0d[_0x4801c8];return _0x353fc7;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var logger=require(_0xd6f0('0x1'))(_0xd6f0('0x2'));var moment=require(_0xd6f0('0x3'));var BPromise=require('bluebird');var rp=require(_0xd6f0('0x4'));var fs=require('fs');var path=require(_0xd6f0('0x5'));var rimraf=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var attributes=require(_0xd6f0('0x8'));module['exports']=function(_0x2d2ce6,_0x4a8b0c){return _0x2d2ce6[_0xd6f0('0x9')](_0xd6f0('0xa'),attributes,{'tableName':_0xd6f0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee5b=['request-promise','path','rimraf','exports','define','lodash','../../config/logger','api','bluebird'];(function(_0xc64a5f,_0xfbfc7f){var _0xec5a29=function(_0xfce9c4){while(--_0xfce9c4){_0xc64a5f['push'](_0xc64a5f['shift']());}};_0xec5a29(++_0xfbfc7f);}(_0xee5b,0x1f4));var _0xbee5=function(_0x25415a,_0x1d9f37){_0x25415a=_0x25415a-0x0;var _0x5061e7=_0xee5b[_0x25415a];return _0x5061e7;};'use strict';var _=require(_0xbee5('0x0'));var util=require('util');var logger=require(_0xbee5('0x1'))(_0xbee5('0x2'));var moment=require('moment');var BPromise=require(_0xbee5('0x3'));var rp=require(_0xbee5('0x4'));var fs=require('fs');var path=require(_0xbee5('0x5'));var rimraf=require(_0xbee5('0x6'));var config=require('../../config/environment');var attributes=require('./cmList.attributes');module[_0xbee5('0x7')]=function(_0x2c0bde,_0xab6e4d){return _0x2c0bde[_0xbee5('0x8')]('CmList',attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 9802f9c..3145e13 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 _0x8647=['rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./cmList.socket','register','then','info','request\x20sent','debug','stringify','error','code','CmList,\x20%s,\x20%s','message','result','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4a1c3c,_0x8e95ef){var _0x46da32=function(_0x1c6ce6){while(--_0x1c6ce6){_0x4a1c3c['push'](_0x4a1c3c['shift']());}};_0x46da32(++_0x8e95ef);}(_0x8647,0x18a));var _0x7864=function(_0x47e383,_0x32adc9){_0x47e383=_0x47e383-0x0;var _0x49ac3e=_0x8647[_0x47e383];return _0x49ac3e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x7864('0x0'));var rs=require(_0x7864('0x1'));var fs=require('fs');var Redis=require(_0x7864('0x2'));var db=require(_0x7864('0x3'))['db'];var utils=require(_0x7864('0x4'));var logger=require(_0x7864('0x5'))(_0x7864('0x6'));var config=require(_0x7864('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7864('0x8')][_0x7864('0x9')]({'port':0x232a});config[_0x7864('0xa')]=_['defaults'](config[_0x7864('0xa')],{'host':_0x7864('0xb'),'port':0x18eb});var socket=require(_0x7864('0xc'))(new Redis(config[_0x7864('0xa')]));require(_0x7864('0xd'))[_0x7864('0xe')](socket);function respondWithRpcPromise(_0x2b2b35,_0xe82cf,_0x101e8a){return new BPromise(function(_0x2a5157,_0x36a84f){return client['request'](_0x2b2b35,_0x101e8a)[_0x7864('0xf')](function(_0x53722c){logger[_0x7864('0x10')]('CmList,\x20%s,\x20%s',_0xe82cf,_0x7864('0x11'));logger[_0x7864('0x12')]('CmList,\x20%s,\x20%s,\x20%s',_0xe82cf,'request\x20sent',JSON[_0x7864('0x13')](_0x53722c));if(_0x53722c[_0x7864('0x14')]){if(_0x53722c[_0x7864('0x14')][_0x7864('0x15')]===0x1f4){logger[_0x7864('0x14')](_0x7864('0x16'),_0xe82cf,_0x53722c['error'][_0x7864('0x17')]);return _0x36a84f(_0x53722c[_0x7864('0x14')][_0x7864('0x17')]);}logger['error'](_0x7864('0x16'),_0xe82cf,_0x53722c['error'][_0x7864('0x17')]);return _0x2a5157(_0x53722c[_0x7864('0x14')][_0x7864('0x17')]);}else{logger[_0x7864('0x10')](_0x7864('0x16'),_0xe82cf,_0x7864('0x11'));_0x2a5157(_0x53722c[_0x7864('0x18')][_0x7864('0x17')]);}})['catch'](function(_0x36d935){logger[_0x7864('0x14')](_0x7864('0x16'),_0xe82cf,_0x36d935);_0x36a84f(_0x36d935);});});} \ No newline at end of file +var _0x435b=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment'];(function(_0x1c3d6d,_0x22294e){var _0x219ef4=function(_0x1126fd){while(--_0x1126fd){_0x1c3d6d['push'](_0x1c3d6d['shift']());}};_0x219ef4(++_0x22294e);}(_0x435b,0x150));var _0xb435=function(_0xb2649b,_0x335cb2){_0xb2649b=_0xb2649b-0x0;var _0x2ab546=_0x435b[_0xb2649b];return _0x2ab546;};'use strict';var _=require('lodash');var util=require(_0xb435('0x0'));var moment=require(_0xb435('0x1'));var BPromise=require(_0xb435('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb435('0x3'));var db=require(_0xb435('0x4'))['db'];var utils=require(_0xb435('0x5'));var logger=require(_0xb435('0x6'))(_0xb435('0x7'));var config=require(_0xb435('0x8'));var jayson=require(_0xb435('0x9'));var client=jayson['client'][_0xb435('0xa')]({'port':0x232a});config['redis']=_[_0xb435('0xb')](config[_0xb435('0xc')],{'host':_0xb435('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb435('0xc')]));require('./cmList.socket')['register'](socket);function respondWithRpcPromise(_0x4a8d26,_0x36dbde,_0x15cd94){return new BPromise(function(_0x2630ae,_0x45e114){return client[_0xb435('0xe')](_0x4a8d26,_0x15cd94)[_0xb435('0xf')](function(_0xb0fa6f){logger[_0xb435('0x10')](_0xb435('0x11'),_0x36dbde,_0xb435('0x12'));logger[_0xb435('0x13')](_0xb435('0x14'),_0x36dbde,_0xb435('0x12'),JSON[_0xb435('0x15')](_0xb0fa6f));if(_0xb0fa6f[_0xb435('0x16')]){if(_0xb0fa6f[_0xb435('0x16')][_0xb435('0x17')]===0x1f4){logger[_0xb435('0x16')]('CmList,\x20%s,\x20%s',_0x36dbde,_0xb0fa6f['error'][_0xb435('0x18')]);return _0x45e114(_0xb0fa6f['error'][_0xb435('0x18')]);}logger['error'](_0xb435('0x11'),_0x36dbde,_0xb0fa6f[_0xb435('0x16')][_0xb435('0x18')]);return _0x2630ae(_0xb0fa6f['error'][_0xb435('0x18')]);}else{logger['info'](_0xb435('0x11'),_0x36dbde,'request\x20sent');_0x2630ae(_0xb0fa6f['result']['message']);}})[_0xb435('0x19')](function(_0x569918){logger[_0xb435('0x16')](_0xb435('0x11'),_0x36dbde,_0x569918);_0x45e114(_0x569918);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 7807443..ebf03d1 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 _0x7c40=['register','length','cmList:','./cmList.events','save','remove','update','emit','removeListener'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x7c40,0x12c));var _0x07c4=function(_0x54d581,_0x2b61f3){_0x54d581=_0x54d581-0x0;var _0x344aea=_0x7c40[_0x54d581];return _0x344aea;};'use strict';var CmListEvents=require(_0x07c4('0x0'));var events=[_0x07c4('0x1'),_0x07c4('0x2'),_0x07c4('0x3')];function createListener(_0x3d0bf2,_0x199855){return function(_0x1fc78e){_0x199855[_0x07c4('0x4')](_0x3d0bf2,_0x1fc78e);};}function removeListener(_0x5c5d98,_0x24651f){return function(){CmListEvents[_0x07c4('0x5')](_0x5c5d98,_0x24651f);};}exports[_0x07c4('0x6')]=function(_0x13ff22){for(var _0x2b6325=0x0,_0x10ba36=events[_0x07c4('0x7')];_0x2b6325<_0x10ba36;_0x2b6325++){var _0x51b844=events[_0x2b6325];var _0x2eaf10=createListener(_0x07c4('0x8')+_0x51b844,_0x13ff22);CmListEvents['on'](_0x51b844,_0x2eaf10);}}; \ No newline at end of file +var _0x076a=['./cmList.events','save','update','emit','removeListener','register','length','cmList:'];(function(_0x4d756c,_0x417d24){var _0x1c7a60=function(_0x47f24f){while(--_0x47f24f){_0x4d756c['push'](_0x4d756c['shift']());}};_0x1c7a60(++_0x417d24);}(_0x076a,0x178));var _0xa076=function(_0xf26e77,_0x429091){_0xf26e77=_0xf26e77-0x0;var _0x3256fe=_0x076a[_0xf26e77];return _0x3256fe;};'use strict';var CmListEvents=require(_0xa076('0x0'));var events=[_0xa076('0x1'),'remove',_0xa076('0x2')];function createListener(_0x1c40d0,_0x124c6a){return function(_0x8aec2f){_0x124c6a[_0xa076('0x3')](_0x1c40d0,_0x8aec2f);};}function removeListener(_0x179468,_0x3e66fd){return function(){CmListEvents[_0xa076('0x4')](_0x179468,_0x3e66fd);};}exports[_0xa076('0x5')]=function(_0xf1449e){for(var _0xc8482e=0x0,_0x44a028=events[_0xa076('0x6')];_0xc8482e<_0x44a028;_0xc8482e++){var _0x26ff78=events[_0xc8482e];var _0x4972b1=createListener(_0xa076('0x7')+_0x26ff78,_0xf1449e);CmListEvents['on'](_0x26ff78,_0x4972b1);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index e51907e..6d0492d 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 _0x33e3=['show','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','getAgents','post','create','addContacts','addCustomField','/:id/users','addAgents','put','delete','removeDispositions','removeAgents','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x33e3,0x1a0));var _0x333e=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x33e3[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require('multer');var util=require(_0x333e('0x0'));var path=require(_0x333e('0x1'));var timeout=require(_0x333e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x333e('0x3'));var auth=require(_0x333e('0x4'));var interaction=require(_0x333e('0x5'));var config=require(_0x333e('0x6'));var controller=require(_0x333e('0x7'));router[_0x333e('0x8')]('/',auth[_0x333e('0x9')](),controller[_0x333e('0xa')]);router[_0x333e('0x8')](_0x333e('0xb'),auth[_0x333e('0x9')](),controller['describe']);router[_0x333e('0x8')](_0x333e('0xc'),auth[_0x333e('0x9')](),controller[_0x333e('0xd')]);router['get'](_0x333e('0xe'),auth['isAuthenticated'](),controller[_0x333e('0xf')]);router[_0x333e('0x8')](_0x333e('0x10'),auth[_0x333e('0x9')](),controller['getContacts']);router[_0x333e('0x8')](_0x333e('0x11'),auth[_0x333e('0x9')](),controller[_0x333e('0x12')]);router[_0x333e('0x8')](_0x333e('0x13'),auth['isAuthenticated'](),controller[_0x333e('0x14')]);router[_0x333e('0x8')]('/:id/users',auth[_0x333e('0x9')](),controller[_0x333e('0x15')]);router[_0x333e('0x16')]('/',auth[_0x333e('0x9')](),controller[_0x333e('0x17')]);router['post'](_0x333e('0xe'),auth[_0x333e('0x9')](),controller['addDisposition']);router[_0x333e('0x16')]('/:id/contacts',auth[_0x333e('0x9')](),controller[_0x333e('0x18')]);router['post'](_0x333e('0x13'),auth[_0x333e('0x9')](),controller[_0x333e('0x19')]);router[_0x333e('0x16')](_0x333e('0x1a'),auth['isAuthenticated'](),controller[_0x333e('0x1b')]);router[_0x333e('0x1c')]('/:id',auth[_0x333e('0x9')](),controller['update']);router[_0x333e('0x1d')](_0x333e('0xc'),auth[_0x333e('0x9')](),controller['destroy']);router[_0x333e('0x1d')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x333e('0x1e')]);router['delete']('/:id/users',auth[_0x333e('0x9')](),controller[_0x333e('0x1f')]);module[_0x333e('0x20')]=router; \ No newline at end of file +var _0x31cd=['/:id','show','/:id/dispositions','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','create','post','addDisposition','addCustomField','addAgents','put','delete','destroy','removeDispositions','removeAgents','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','describe'];(function(_0x2b0f84,_0x432b47){var _0x2f7fe1=function(_0x1f6cc6){while(--_0x1f6cc6){_0x2b0f84['push'](_0x2b0f84['shift']());}};_0x2f7fe1(++_0x432b47);}(_0x31cd,0x103));var _0xd31c=function(_0x307bd8,_0x36c26c){_0x307bd8=_0x307bd8-0x0;var _0x3a8ed0=_0x31cd[_0x307bd8];return _0x3a8ed0;};'use strict';var multer=require(_0xd31c('0x0'));var util=require(_0xd31c('0x1'));var path=require(_0xd31c('0x2'));var timeout=require(_0xd31c('0x3'));var express=require(_0xd31c('0x4'));var router=express['Router']();var fs_extra=require(_0xd31c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd31c('0x6'));var config=require(_0xd31c('0x7'));var controller=require(_0xd31c('0x8'));router[_0xd31c('0x9')]('/',auth[_0xd31c('0xa')](),controller[_0xd31c('0xb')]);router[_0xd31c('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xd31c('0xc')]);router['get'](_0xd31c('0xd'),auth[_0xd31c('0xa')](),controller[_0xd31c('0xe')]);router[_0xd31c('0x9')](_0xd31c('0xf'),auth['isAuthenticated'](),controller[_0xd31c('0x10')]);router[_0xd31c('0x9')]('/:id/contacts',auth['isAuthenticated'](),controller[_0xd31c('0x11')]);router[_0xd31c('0x9')](_0xd31c('0x12'),auth[_0xd31c('0xa')](),controller[_0xd31c('0x13')]);router[_0xd31c('0x9')](_0xd31c('0x14'),auth['isAuthenticated'](),controller[_0xd31c('0x15')]);router[_0xd31c('0x9')](_0xd31c('0x16'),auth[_0xd31c('0xa')](),controller[_0xd31c('0x17')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd31c('0x18')]);router[_0xd31c('0x19')](_0xd31c('0xf'),auth[_0xd31c('0xa')](),controller[_0xd31c('0x1a')]);router[_0xd31c('0x19')]('/:id/contacts',auth[_0xd31c('0xa')](),controller['addContacts']);router[_0xd31c('0x19')]('/:id/fields',auth[_0xd31c('0xa')](),controller[_0xd31c('0x1b')]);router['post'](_0xd31c('0x16'),auth[_0xd31c('0xa')](),controller[_0xd31c('0x1c')]);router[_0xd31c('0x1d')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd31c('0x1e')](_0xd31c('0xd'),auth[_0xd31c('0xa')](),controller[_0xd31c('0x1f')]);router['delete'](_0xd31c('0xf'),auth[_0xd31c('0xa')](),controller[_0xd31c('0x20')]);router[_0xd31c('0x1e')]('/:id/users',auth['isAuthenticated'](),controller[_0xd31c('0x21')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 2e102a8..9775eb8 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 _0xe8c8=['getDataValue','field','STRING','sequelize','exports'];(function(_0x40d550,_0x23f9f2){var _0x532ff9=function(_0x54a3a9){while(--_0x54a3a9){_0x40d550['push'](_0x40d550['shift']());}};_0x532ff9(++_0x23f9f2);}(_0xe8c8,0x1c5));var _0x8e8c=function(_0x547637,_0x2d9726){_0x547637=_0x547637-0x0;var _0x54d512=_0xe8c8[_0x547637];return _0x54d512;};'use strict';var Sequelize=require(_0x8e8c('0x0'));module[_0x8e8c('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2ac41b){return this[_0x8e8c('0x2')](_0x8e8c('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x8e8c('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x8e8c('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xa2dc=['STRING','sequelize','exports','VIRTUAL','getDataValue','field'];(function(_0x8e68c1,_0xa3f72d){var _0x3e9ba7=function(_0x806d3b){while(--_0x806d3b){_0x8e68c1['push'](_0x8e68c1['shift']());}};_0x3e9ba7(++_0xa3f72d);}(_0xa2dc,0xe5));var _0xca2d=function(_0x11a962,_0x3cc338){_0x11a962=_0x11a962-0x0;var _0x55d423=_0xa2dc[_0x11a962];return _0x55d423;};'use strict';var Sequelize=require(_0xca2d('0x0'));module[_0xca2d('0x1')]={'name':{'type':Sequelize[_0xca2d('0x2')],'get':function(_0x50bac3){return this[_0xca2d('0x3')](_0xca2d('0x4'));}},'field':{'type':Sequelize[_0xca2d('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0xca2d('0x5')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 46d52fc..e8acef4 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x4c86f7,_0x1472bb){var _0x17fd90=function(_0x2835b1){while(--_0x2835b1){_0x4c86f7['push'](_0x4c86f7['shift']());}};_0x17fd90(++_0x1472bb);}(_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 +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(_0xe12571,_0x3bb120){var _0x2c0644=function(_0x3b917b){while(--_0x3b917b){_0xe12571['push'](_0xe12571['shift']());}};_0x2c0644(++_0x3bb120);}(_0x7a54,0x106));var _0x47a5=function(_0x55d7d8,_0x357510){_0x55d7d8=_0x55d7d8-0x0;var _0x1307f6=_0x7a54[_0x55d7d8];return _0x1307f6;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index a416a2e..41ce5e6 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 _0x0950=['path','rimraf','../../config/environment','./condition.attributes','define','tools_conditions','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0xba6b88,_0x4f1e92){var _0x575135=function(_0x52cf18){while(--_0x52cf18){_0xba6b88['push'](_0xba6b88['shift']());}};_0x575135(++_0x4f1e92);}(_0x0950,0x7e));var _0x0095=function(_0x41dcdb,_0x4e1a2f){_0x41dcdb=_0x41dcdb-0x0;var _0xce4042=_0x0950[_0x41dcdb];return _0xce4042;};'use strict';var _=require(_0x0095('0x0'));var util=require(_0x0095('0x1'));var logger=require(_0x0095('0x2'))(_0x0095('0x3'));var moment=require('moment');var BPromise=require(_0x0095('0x4'));var rp=require(_0x0095('0x5'));var fs=require('fs');var path=require(_0x0095('0x6'));var rimraf=require(_0x0095('0x7'));var config=require(_0x0095('0x8'));var attributes=require(_0x0095('0x9'));module['exports']=function(_0x5c24e1,_0x2eaa67){return _0x5c24e1[_0x0095('0xa')]('Condition',attributes,{'tableName':_0x0095('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8708=['exports','Condition','tools_conditions','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./condition.attributes'];(function(_0x17e771,_0x55fd17){var _0x1f3a6d=function(_0x346ee3){while(--_0x346ee3){_0x17e771['push'](_0x17e771['shift']());}};_0x1f3a6d(++_0x55fd17);}(_0x8708,0x148));var _0x8870=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x8708[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x8870('0x0'));var util=require(_0x8870('0x1'));var logger=require(_0x8870('0x2'))(_0x8870('0x3'));var moment=require(_0x8870('0x4'));var BPromise=require('bluebird');var rp=require(_0x8870('0x5'));var fs=require('fs');var path=require(_0x8870('0x6'));var rimraf=require(_0x8870('0x7'));var config=require(_0x8870('0x8'));var attributes=require(_0x8870('0x9'));module[_0x8870('0xa')]=function(_0x279db0,_0x577b48){return _0x279db0['define'](_0x8870('0xb'),attributes,{'tableName':_0x8870('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 7584f6d..51327f0 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 _0x40f0=['Condition,\x20%s,\x20%s','message','result','util','moment','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x46012c,_0x66bacf){var _0x26d30f=function(_0x3a281a){while(--_0x3a281a){_0x46012c['push'](_0x46012c['shift']());}};_0x26d30f(++_0x66bacf);}(_0x40f0,0x81));var _0x040f=function(_0x5062dc,_0x4af19b){_0x5062dc=_0x5062dc-0x0;var _0x1a2945=_0x40f0[_0x5062dc];return _0x1a2945;};'use strict';var _=require('lodash');var util=require(_0x040f('0x0'));var moment=require(_0x040f('0x1'));var BPromise=require('bluebird');var rs=require(_0x040f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x040f('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x040f('0x4'));var jayson=require(_0x040f('0x5'));var client=jayson[_0x040f('0x6')][_0x040f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x9c93c2,_0x469838,_0x717aa3){return new BPromise(function(_0x4d0f88,_0x2a4b65){return client['request'](_0x9c93c2,_0x717aa3)[_0x040f('0x8')](function(_0x411596){logger[_0x040f('0x9')]('Condition,\x20%s,\x20%s',_0x469838,'request\x20sent');logger['debug'](_0x040f('0xa'),_0x469838,_0x040f('0xb'),JSON[_0x040f('0xc')](_0x411596));if(_0x411596[_0x040f('0xd')]){if(_0x411596[_0x040f('0xd')][_0x040f('0xe')]===0x1f4){logger[_0x040f('0xd')](_0x040f('0xf'),_0x469838,_0x411596[_0x040f('0xd')][_0x040f('0x10')]);return _0x2a4b65(_0x411596[_0x040f('0xd')][_0x040f('0x10')]);}logger[_0x040f('0xd')](_0x040f('0xf'),_0x469838,_0x411596[_0x040f('0xd')]['message']);return _0x4d0f88(_0x411596[_0x040f('0xd')]['message']);}else{logger[_0x040f('0x9')]('Condition,\x20%s,\x20%s',_0x469838,_0x040f('0xb'));_0x4d0f88(_0x411596[_0x040f('0x11')][_0x040f('0x10')]);}})['catch'](function(_0x163008){logger[_0x040f('0xd')](_0x040f('0xf'),_0x469838,_0x163008);_0x2a4b65(_0x163008);});});} \ No newline at end of file +var _0x319d=['info','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','Condition,\x20%s,\x20%s','message'];(function(_0x5e7dc0,_0x37e8ba){var _0x2946c2=function(_0x59ff0f){while(--_0x59ff0f){_0x5e7dc0['push'](_0x5e7dc0['shift']());}};_0x2946c2(++_0x37e8ba);}(_0x319d,0x1c6));var _0xd319=function(_0x4633f9,_0x91b9a9){_0x4633f9=_0x4633f9-0x0;var _0x2404ee=_0x319d[_0x4633f9];return _0x2404ee;};'use strict';var _=require(_0xd319('0x0'));var util=require('util');var moment=require(_0xd319('0x1'));var BPromise=require(_0xd319('0x2'));var rs=require(_0xd319('0x3'));var fs=require('fs');var Redis=require(_0xd319('0x4'));var db=require(_0xd319('0x5'))['db'];var utils=require(_0xd319('0x6'));var logger=require(_0xd319('0x7'))(_0xd319('0x8'));var config=require(_0xd319('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd319('0xa')][_0xd319('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x152259,_0x557612,_0x32456d){return new BPromise(function(_0x1e1341,_0x248590){return client[_0xd319('0xc')](_0x152259,_0x32456d)[_0xd319('0xd')](function(_0x5c283e){logger['info']('Condition,\x20%s,\x20%s',_0x557612,'request\x20sent');logger[_0xd319('0xe')](_0xd319('0xf'),_0x557612,'request\x20sent',JSON[_0xd319('0x10')](_0x5c283e));if(_0x5c283e[_0xd319('0x11')]){if(_0x5c283e[_0xd319('0x11')][_0xd319('0x12')]===0x1f4){logger['error'](_0xd319('0x13'),_0x557612,_0x5c283e[_0xd319('0x11')]['message']);return _0x248590(_0x5c283e[_0xd319('0x11')][_0xd319('0x14')]);}logger[_0xd319('0x11')]('Condition,\x20%s,\x20%s',_0x557612,_0x5c283e['error'][_0xd319('0x14')]);return _0x1e1341(_0x5c283e[_0xd319('0x11')][_0xd319('0x14')]);}else{logger[_0xd319('0x15')]('Condition,\x20%s,\x20%s',_0x557612,_0xd319('0x16'));_0x1e1341(_0x5c283e[_0xd319('0x17')]['message']);}})[_0xd319('0x18')](function(_0x1eb251){logger[_0xd319('0x11')](_0xd319('0x13'),_0x557612,_0x1eb251);_0x248590(_0x1eb251);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index e8bfe07..41ae16d 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 _0xac4a=['express','Router','fs-extra','../../config/environment','./condition.controller','put','isAuthenticated','update','delete','/:id','exports','multer','path'];(function(_0x57259c,_0x19607c){var _0x5707a1=function(_0x6a88a){while(--_0x6a88a){_0x57259c['push'](_0x57259c['shift']());}};_0x5707a1(++_0x19607c);}(_0xac4a,0x136));var _0xaac4=function(_0x5b3d39,_0x2ee32c){_0x5b3d39=_0x5b3d39-0x0;var _0x46e677=_0xac4a[_0x5b3d39];return _0x46e677;};'use strict';var multer=require(_0xaac4('0x0'));var util=require('util');var path=require(_0xaac4('0x1'));var timeout=require('connect-timeout');var express=require(_0xaac4('0x2'));var router=express[_0xaac4('0x3')]();var fs_extra=require(_0xaac4('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaac4('0x5'));var controller=require(_0xaac4('0x6'));router[_0xaac4('0x7')]('/:id',auth[_0xaac4('0x8')](),controller[_0xaac4('0x9')]);router[_0xaac4('0xa')](_0xaac4('0xb'),auth[_0xaac4('0x8')](),controller['destroy']);module[_0xaac4('0xc')]=router; \ No newline at end of file +var _0xbcbc=['exports','util','Router','../../components/interaction/service','./condition.controller','/:id','update','delete','isAuthenticated','destroy'];(function(_0x3b4704,_0x5a65fe){var _0x5ad2d9=function(_0x23a259){while(--_0x23a259){_0x3b4704['push'](_0x3b4704['shift']());}};_0x5ad2d9(++_0x5a65fe);}(_0xbcbc,0xa1));var _0xcbcb=function(_0x1088dd,_0x497614){_0x1088dd=_0x1088dd-0x0;var _0x3fc2b6=_0xbcbc[_0x1088dd];return _0x3fc2b6;};'use strict';var multer=require('multer');var util=require(_0xcbcb('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcbcb('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcbcb('0x2'));var config=require('../../config/environment');var controller=require(_0xcbcb('0x3'));router['put'](_0xcbcb('0x4'),auth['isAuthenticated'](),controller[_0xcbcb('0x5')]);router[_0xcbcb('0x6')](_0xcbcb('0x4'),auth[_0xcbcb('0x7')](),controller[_0xcbcb('0x8')]);module[_0xcbcb('0x9')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 7f37a84..5dc7cca 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 _0x2032=['name','exports','STRING'];(function(_0x439dd5,_0x5615a3){var _0xd2b861=function(_0x14d416){while(--_0x14d416){_0x439dd5['push'](_0x439dd5['shift']());}};_0xd2b861(++_0x5615a3);}(_0x2032,0xd9));var _0x2203=function(_0x158a0a,_0x11138d){_0x158a0a=_0x158a0a-0x0;var _0x33ac05=_0x2032[_0x158a0a];return _0x33ac05;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x21cee2,_0xdbe60){var _0x2d0cdf=function(_0x238b40){while(--_0x238b40){_0x21cee2['push'](_0x21cee2['shift']());}};_0x2d0cdf(++_0xdbe60);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index cc774f9..78e86b4 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 _0xa62d=['redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','Dashboard','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','findOne','rawAttributes','pick','rimraf','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb'];(function(_0x11ddf7,_0x4e3a75){var _0x39bfd7=function(_0x2de089){while(--_0x2de089){_0x11ddf7['push'](_0x11ddf7['shift']());}};_0x39bfd7(++_0x4e3a75);}(_0xa62d,0x170));var _0xda62=function(_0x29b5e4,_0x3ef737){_0x29b5e4=_0x29b5e4-0x0;var _0x46c3c0=_0xa62d[_0x29b5e4];return _0x46c3c0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xda62('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xda62('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xda62('0x2'));var util=require(_0xda62('0x3'));var path=require(_0xda62('0x4'));var sox=require(_0xda62('0x5'));var csv=require(_0xda62('0x6'));var ejs=require(_0xda62('0x7'));var fs=require('fs');var fs_extra=require(_0xda62('0x8'));var _=require(_0xda62('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xda62('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xda62('0x6'));var querystring=require('querystring');var Papa=require(_0xda62('0xb'));var Redis=require('ioredis');var authService=require(_0xda62('0xc'));var qs=require(_0xda62('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xda62('0xe'));var logger=require(_0xda62('0xf'))(_0xda62('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xda62('0x11'));var db=require(_0xda62('0x12'))['db'];config[_0xda62('0x13')]=_[_0xda62('0x14')](config[_0xda62('0x13')],{'host':_0xda62('0x15'),'port':0x18eb});var socket=require(_0xda62('0x16'))(new Redis(config[_0xda62('0x13')]));require(_0xda62('0x17'))[_0xda62('0x18')](socket);function respondWithStatusCode(_0x1e7dcd,_0x25c8b){_0x25c8b=_0x25c8b||0xcc;return function(_0x1665ac){if(_0x1665ac){return _0x1e7dcd[_0xda62('0x19')](_0x25c8b);}return _0x1e7dcd[_0xda62('0x1a')](_0x25c8b)[_0xda62('0x1b')]();};}function respondWithResult(_0x153c17,_0x245956){_0x245956=_0x245956||0xc8;return function(_0x42add1){if(_0x42add1){return _0x153c17[_0xda62('0x1a')](_0x245956)[_0xda62('0x1c')](_0x42add1);}};}function respondWithFilteredResult(_0x5c6f22,_0x4e3d8e){return function(_0x1fa5b1){if(_0x1fa5b1){var _0x648e7a=typeof _0x4e3d8e[_0xda62('0x1d')]===_0xda62('0x1e')&&typeof _0x4e3d8e[_0xda62('0x1f')]==='undefined';var _0x209334=_0x1fa5b1[_0xda62('0x20')];var _0x5b996e=_0x648e7a?0x0:_0x4e3d8e[_0xda62('0x1d')];var _0x22b426=_0x648e7a?_0x1fa5b1[_0xda62('0x20')]:_0x4e3d8e[_0xda62('0x1d')]+_0x4e3d8e['limit'];var _0x3c9fa4;if(_0x22b426>=_0x209334){_0x22b426=_0x209334;_0x3c9fa4=0xc8;}else{_0x3c9fa4=0xce;}_0x5c6f22[_0xda62('0x1a')](_0x3c9fa4);return _0x5c6f22[_0xda62('0x21')](_0xda62('0x22'),_0x5b996e+'-'+_0x22b426+'/'+_0x209334)[_0xda62('0x1c')](_0x1fa5b1);}return null;};}function patchUpdates(_0x49d922){return function(_0x55b6df){try{jsonpatch[_0xda62('0x23')](_0x55b6df,_0x49d922,!![]);}catch(_0xe8771c){return BPromise[_0xda62('0x24')](_0xe8771c);}return _0x55b6df[_0xda62('0x25')]();};}function saveUpdates(_0x3732ef,_0x291b22){return function(_0x1ffbb2){if(_0x1ffbb2){return _0x1ffbb2[_0xda62('0x26')](_0x3732ef)[_0xda62('0x27')](function(_0x19c5c6){return _0x19c5c6;});}return null;};}function removeEntity(_0x6749b2,_0x47a13f){return function(_0x4ae658){if(_0x4ae658){return _0x4ae658[_0xda62('0x28')]()[_0xda62('0x27')](function(){var _0x407606=_0x4ae658['get']({'plain':!![]});var _0xf0a5c4='CustomDashboards';return db[_0xda62('0x29')][_0xda62('0x28')]({'where':{'type':_0xf0a5c4,'resourceId':_0x407606['id']}})[_0xda62('0x27')](function(){return _0x4ae658;});})[_0xda62('0x27')](function(){_0x6749b2[_0xda62('0x1a')](0xcc)[_0xda62('0x1b')]();});}};}function handleEntityNotFound(_0x9744c0,_0x4dfa83){return function(_0x3f564d){if(!_0x3f564d){_0x9744c0['sendStatus'](0x194);}return _0x3f564d;};}function handleError(_0x36c107,_0x46cd35){_0x46cd35=_0x46cd35||0x1f4;return function(_0x236ea2){logger[_0xda62('0x2a')](_0x236ea2[_0xda62('0x2b')]);if(_0x236ea2['name']){delete _0x236ea2[_0xda62('0x2c')];}_0x36c107['status'](_0x46cd35)[_0xda62('0x2d')](_0x236ea2);};}exports[_0xda62('0x2e')]=function(_0x5bbabd,_0x49c88f){var _0x1f1e9d={},_0xb0bc0c={},_0x3e0c4a={'count':0x0,'rows':[]};var _0x3523c8=_[_0xda62('0x2f')](db[_0xda62('0x30')]['rawAttributes'],function(_0x1ee501){return{'name':_0x1ee501[_0xda62('0x31')],'type':_0x1ee501[_0xda62('0x32')][_0xda62('0x33')]};});_0xb0bc0c[_0xda62('0x34')]=_[_0xda62('0x2f')](_0x3523c8,_0xda62('0x2c'));_0xb0bc0c[_0xda62('0x35')]=_[_0xda62('0x36')](_0x5bbabd[_0xda62('0x35')]);_0xb0bc0c[_0xda62('0x37')]=_[_0xda62('0x38')](_0xb0bc0c[_0xda62('0x34')],_0xb0bc0c[_0xda62('0x35')]);_0x1f1e9d[_0xda62('0x39')]=_[_0xda62('0x38')](_0xb0bc0c['model'],qs[_0xda62('0x3a')](_0x5bbabd[_0xda62('0x35')][_0xda62('0x3a')]));_0x1f1e9d[_0xda62('0x39')]=_0x1f1e9d[_0xda62('0x39')]['length']?_0x1f1e9d['attributes']:_0xb0bc0c[_0xda62('0x34')];if(!_0x5bbabd[_0xda62('0x35')][_0xda62('0x3b')](_0xda62('0x3c'))){_0x1f1e9d[_0xda62('0x1f')]=qs['limit'](_0x5bbabd[_0xda62('0x35')][_0xda62('0x1f')]);_0x1f1e9d['offset']=qs[_0xda62('0x1d')](_0x5bbabd[_0xda62('0x35')][_0xda62('0x1d')]);}_0x1f1e9d[_0xda62('0x3d')]=qs[_0xda62('0x3e')](_0x5bbabd[_0xda62('0x35')][_0xda62('0x3e')]);_0x1f1e9d[_0xda62('0x3f')]=qs['filters'](_['pick'](_0x5bbabd[_0xda62('0x35')],_0xb0bc0c[_0xda62('0x37')]),_0x3523c8);if(_0x5bbabd[_0xda62('0x35')][_0xda62('0x40')]){_0x1f1e9d[_0xda62('0x3f')]=_[_0xda62('0x41')](_0x1f1e9d[_0xda62('0x3f')],{'$or':_['map'](_0x3523c8,function(_0x229a99){if(_0x229a99[_0xda62('0x32')]!=='VIRTUAL'){var _0x2a3b15={};_0x2a3b15[_0x229a99[_0xda62('0x2c')]]={'$like':'%'+_0x5bbabd['query'][_0xda62('0x40')]+'%'};return _0x2a3b15;}})});}_0x1f1e9d=_[_0xda62('0x41')]({},_0x1f1e9d,_0x5bbabd[_0xda62('0x42')]);var _0x1ccd8f={'where':_0x1f1e9d['where']};return db[_0xda62('0x30')][_0xda62('0x20')](_0x1ccd8f)[_0xda62('0x27')](function(_0x2fc1f9){_0x3e0c4a[_0xda62('0x20')]=_0x2fc1f9;if(_0x5bbabd['query'][_0xda62('0x43')]){_0x1f1e9d[_0xda62('0x44')]=[{'all':!![]}];}return db[_0xda62('0x30')][_0xda62('0x45')](_0x1f1e9d);})[_0xda62('0x27')](function(_0x265024){_0x3e0c4a[_0xda62('0x46')]=_0x265024;return _0x3e0c4a;})[_0xda62('0x27')](respondWithFilteredResult(_0x49c88f,_0x1f1e9d))['catch'](handleError(_0x49c88f,null));};exports[_0xda62('0x47')]=function(_0x240dc8,_0xf94253){var _0x28891d={'raw':![],'where':{'id':_0x240dc8[_0xda62('0x48')]['id']}},_0x3ff665={};_0x3ff665['model']=_[_0xda62('0x36')](db['Dashboard']['rawAttributes']);_0x3ff665['query']=_['keys'](_0x240dc8[_0xda62('0x35')]);_0x3ff665[_0xda62('0x37')]=_[_0xda62('0x38')](_0x3ff665['model'],_0x3ff665[_0xda62('0x35')]);_0x28891d[_0xda62('0x39')]=_['intersection'](_0x3ff665[_0xda62('0x34')],qs['fields'](_0x240dc8[_0xda62('0x35')][_0xda62('0x3a')]));_0x28891d[_0xda62('0x39')]=_0x28891d[_0xda62('0x39')][_0xda62('0x49')]?_0x28891d[_0xda62('0x39')]:_0x3ff665[_0xda62('0x34')];if(_0x240dc8[_0xda62('0x35')][_0xda62('0x43')]){_0x28891d[_0xda62('0x44')]=[{'all':!![]}];}_0x28891d=_[_0xda62('0x41')]({},_0x28891d,_0x240dc8[_0xda62('0x42')]);return db['Dashboard'][_0xda62('0x4a')](_0x28891d)[_0xda62('0x27')](handleEntityNotFound(_0xf94253,null))[_0xda62('0x27')](respondWithResult(_0xf94253,null))[_0xda62('0x4b')](handleError(_0xf94253,null));};exports[_0xda62('0x4c')]=function(_0x17f032,_0x5ae6d0){return db[_0xda62('0x30')][_0xda62('0x4c')](_0x17f032[_0xda62('0x4d')],{})[_0xda62('0x27')](function(_0x5e5ac6){var _0x526de9=_0x17f032[_0xda62('0x4e')][_0xda62('0x4f')]({'plain':!![]});if(!_0x526de9)throw new Error(_0xda62('0x50'));if(_0x526de9[_0xda62('0x51')]===_0xda62('0x4e')){var _0x45864f=_0x5e5ac6['get']({'plain':!![]});var _0xeefbd1=_0xda62('0x52');return db[_0xda62('0x53')][_0xda62('0x4a')]({'where':{'name':_0xeefbd1,'userProfileId':_0x526de9[_0xda62('0x54')]},'raw':!![]})[_0xda62('0x27')](function(_0x15d6a6){if(_0x15d6a6&&_0x15d6a6[_0xda62('0x55')]===0x0){return db[_0xda62('0x29')][_0xda62('0x4c')]({'name':_0x45864f[_0xda62('0x2c')],'resourceId':_0x45864f['id'],'type':_0x15d6a6['name'],'sectionId':_0x15d6a6['id']},{})[_0xda62('0x27')](function(){return _0x5e5ac6;});}else{return _0x5e5ac6;}})[_0xda62('0x4b')](function(_0x516288){logger['error'](_0xda62('0x56'),_0x516288);throw _0x516288;});}return _0x5e5ac6;})[_0xda62('0x27')](respondWithResult(_0x5ae6d0,0xc9))[_0xda62('0x4b')](handleError(_0x5ae6d0,null));};exports[_0xda62('0x57')]=function(_0xca4f62,_0x520788){var _0x47f97b={'where':{'id':_0xca4f62['params']['id']}},_0x3d84a9={};_0x3d84a9[_0xda62('0x34')]=_['keys'](db[_0xda62('0x30')]['rawAttributes']);_0x47f97b[_0xda62('0x39')]=_[_0xda62('0x38')](_0x3d84a9['model'],qs[_0xda62('0x3a')](_0xca4f62[_0xda62('0x35')][_0xda62('0x3a')]));_0x47f97b[_0xda62('0x39')]=_0x47f97b['attributes'][_0xda62('0x49')]?_0x47f97b[_0xda62('0x39')]:_0x3d84a9['model'];if(_0xca4f62['query']['includeAll']){_0x47f97b[_0xda62('0x44')]=[{'all':!![]}];}_0x47f97b=_['merge']({},_0x47f97b,_0xca4f62[_0xda62('0x42')]);return db['Dashboard'][_0xda62('0x4a')](_0x47f97b)[_0xda62('0x27')](handleEntityNotFound(_0x520788,null))[_0xda62('0x27')](function(_0x428762){if(_0x428762){var _0x17d4b1=_0x428762[_0xda62('0x4f')]({'plain':!![]});_0x17d4b1=qs[_0xda62('0x58')](_0x17d4b1,['id',_0xda62('0x59'),_0xda62('0x5a')]);_0xca4f62['body']=_[_0xda62('0x58')](_0xca4f62[_0xda62('0x4d')],['id',_0xda62('0x59'),_0xda62('0x5a')]);return db[_0xda62('0x30')]['create'](_['merge'](_0x17d4b1,_0xca4f62[_0xda62('0x4d')]),{'include':_0xca4f62[_0xda62('0x35')]['includeAll']?[{'all':!![]}]:undefined})[_0xda62('0x27')](function(_0x14ed46){var _0x4bcbf8=_0xca4f62[_0xda62('0x4e')][_0xda62('0x4f')]({'plain':!![]});if(!_0x4bcbf8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4bcbf8[_0xda62('0x51')]==='user'){var _0x18c6f3=_0x14ed46[_0xda62('0x4f')]({'plain':!![]});var _0x144c15=_0xda62('0x52');return db['UserProfileSection'][_0xda62('0x4a')]({'where':{'name':_0x144c15,'userProfileId':_0x4bcbf8[_0xda62('0x54')]},'raw':!![]})['then'](function(_0x4e94b2){if(_0x4e94b2&&_0x4e94b2[_0xda62('0x55')]===0x0){return db[_0xda62('0x29')][_0xda62('0x4c')]({'name':_0x18c6f3[_0xda62('0x2c')],'resourceId':_0x18c6f3['id'],'type':_0x4e94b2[_0xda62('0x2c')],'sectionId':_0x4e94b2['id']},{})['then'](function(){return _0x14ed46;});}else{return _0x14ed46;}})[_0xda62('0x4b')](function(_0x2767ab){logger[_0xda62('0x2a')](_0xda62('0x56'),_0x2767ab);throw _0x2767ab;});}return _0x14ed46;});}})['then'](respondWithResult(_0x520788,0xc9))[_0xda62('0x4b')](handleError(_0x520788,null));};exports[_0xda62('0x26')]=function(_0xa69ebb,_0x46daee){if(_0xa69ebb['body']['id']){delete _0xa69ebb[_0xda62('0x4d')]['id'];}return db[_0xda62('0x30')][_0xda62('0x4a')]({'where':{'id':_0xa69ebb[_0xda62('0x48')]['id']}})[_0xda62('0x27')](handleEntityNotFound(_0x46daee,null))[_0xda62('0x27')](saveUpdates(_0xa69ebb['body'],null))[_0xda62('0x27')](respondWithResult(_0x46daee,null))['catch'](handleError(_0x46daee,null));};exports[_0xda62('0x28')]=function(_0x4904a1,_0x2fda6a){return db['Dashboard'][_0xda62('0x4a')]({'where':{'id':_0x4904a1[_0xda62('0x48')]['id']}})[_0xda62('0x27')](handleEntityNotFound(_0x2fda6a,null))[_0xda62('0x27')](removeEntity(_0x2fda6a,null))[_0xda62('0x4b')](handleError(_0x2fda6a,null));};function widgetAttributes(_0x4566eb){try{switch(_0x4566eb[_0xda62('0x32')]){case'iframe':return[{'name':_0xda62('0x5b'),'value':_0x4566eb[_0xda62('0x5b')]||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb[_0xda62('0x5c')][0x0]?_0x4566eb['attrs'][0x0][_0xda62('0x5d')]:undefined)||'https://'}];case _0xda62('0x5e'):return[{'name':_0xda62('0x5f'),'value':_0x4566eb[_0xda62('0x5f')]||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb[_0xda62('0x5c')][0x0]?_0x4566eb[_0xda62('0x5c')][0x0]['value']:undefined)||''}];case _0xda62('0x60'):return[{'name':_0xda62('0x61'),'value':_0x4566eb['attrHourFormat']||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb[_0xda62('0x5c')][0x0]?_0x4566eb[_0xda62('0x5c')][0x0][_0xda62('0x5d')]:undefined)||_0xda62('0x62')},{'name':_0xda62('0x63'),'value':_0x4566eb['attrTimezone']||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb['attrs'][0x1]?_0x4566eb[_0xda62('0x5c')][0x1][_0xda62('0x5d')]:undefined)||'0.00'},{'name':_0xda62('0x64'),'value':_0x4566eb[_0xda62('0x64')]||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb[_0xda62('0x5c')][0x2]?_0x4566eb['attrs'][0x2]['value']:undefined)||0xc}];case _0xda62('0x65'):return[{'name':_0xda62('0x66'),'value':_0x4566eb['attrMetric']||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb[_0xda62('0x5c')][0x0]?_0x4566eb['attrs'][0x0][_0xda62('0x5d')]:undefined)||_0xda62('0x67')},{'name':_0xda62('0x68'),'value':_0x4566eb['attrVoiceQueues']||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb[_0xda62('0x5c')][0x1]?_0x4566eb[_0xda62('0x5c')][0x1][_0xda62('0x5d')]:undefined)||[]},{'name':_0xda62('0x64'),'value':_0x4566eb[_0xda62('0x64')]||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb[_0xda62('0x5c')][0x2]?_0x4566eb[_0xda62('0x5c')][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x4566eb[_0xda62('0x69')]||(_0x4566eb['attrs']&&_0x4566eb[_0xda62('0x5c')][0x3]?_0x4566eb[_0xda62('0x5c')][0x3]['value']:undefined)||'voice'},{'name':_0xda62('0x6a'),'value':_0x4566eb[_0xda62('0x6a')]||(_0x4566eb['attrs']&&_0x4566eb[_0xda62('0x5c')][0x4]?_0x4566eb[_0xda62('0x5c')][0x4][_0xda62('0x5d')]:undefined)||''},{'name':_0xda62('0x6b'),'value':_0x4566eb[_0xda62('0x6b')]||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb[_0xda62('0x5c')][0x5]?_0x4566eb[_0xda62('0x5c')][0x5][_0xda62('0x5d')]:undefined)||''},{'name':_0xda62('0x6c'),'value':_0x4566eb[_0xda62('0x6c')]||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb['attrs'][0x6]?_0x4566eb['attrs'][0x6]['value']:undefined)||''},{'name':_0xda62('0x6d'),'value':_0x4566eb[_0xda62('0x6d')]||(_0x4566eb['attrs']&&_0x4566eb[_0xda62('0x5c')][0x7]?_0x4566eb[_0xda62('0x5c')][0x7]['value']:undefined)||''},{'name':_0xda62('0x6e'),'value':_0x4566eb[_0xda62('0x6e')]||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb[_0xda62('0x5c')][0x8]?_0x4566eb[_0xda62('0x5c')][0x8][_0xda62('0x5d')]:undefined)||''},{'name':'attrChatWebsites','value':_0x4566eb[_0xda62('0x6f')]||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb['attrs'][0x9]?_0x4566eb['attrs'][0x9]['value']:undefined)||''}];case _0xda62('0x70'):case _0xda62('0x71'):return[{'name':'attrSerie1','value':_0x4566eb[_0xda62('0x72')]||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb['attrs'][0x0]?_0x4566eb[_0xda62('0x5c')][0x0]['value']:undefined)||'total'},{'name':_0xda62('0x73'),'value':_0x4566eb[_0xda62('0x73')]||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb['attrs'][0x1]?_0x4566eb[_0xda62('0x5c')][0x1][_0xda62('0x5d')]:undefined)||null},{'name':_0xda62('0x74'),'value':_0x4566eb[_0xda62('0x74')]||(_0x4566eb['attrs']&&_0x4566eb[_0xda62('0x5c')][0x2]?_0x4566eb['attrs'][0x2]['value']:undefined)||null},{'name':_0xda62('0x68'),'value':_0x4566eb['attrVoiceQueues']||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb[_0xda62('0x5c')][0x3]?_0x4566eb['attrs'][0x3][_0xda62('0x5d')]:undefined)||[]},{'name':_0xda62('0x69'),'value':_0x4566eb['attrChannel']||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb[_0xda62('0x5c')][0x4]?_0x4566eb[_0xda62('0x5c')][0x4][_0xda62('0x5d')]:undefined)||_0xda62('0x75')},{'name':'attrEmailAccounts','value':_0x4566eb[_0xda62('0x6a')]||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb[_0xda62('0x5c')][0x5]?_0x4566eb[_0xda62('0x5c')][0x5][_0xda62('0x5d')]:undefined)||''},{'name':_0xda62('0x6b'),'value':_0x4566eb[_0xda62('0x6b')]||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb['attrs'][0x6]?_0x4566eb[_0xda62('0x5c')][0x6][_0xda62('0x5d')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x4566eb[_0xda62('0x6c')]||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb[_0xda62('0x5c')][0x7]?_0x4566eb[_0xda62('0x5c')][0x7]['value']:undefined)||''},{'name':_0xda62('0x6d'),'value':_0x4566eb[_0xda62('0x6d')]||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb['attrs'][0x8]?_0x4566eb[_0xda62('0x5c')][0x8]['value']:undefined)||''},{'name':_0xda62('0x6e'),'value':_0x4566eb['attrWhatsappAccounts']||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb[_0xda62('0x5c')][0x9]?_0x4566eb[_0xda62('0x5c')][0x9]['value']:undefined)||''},{'name':_0xda62('0x6f'),'value':_0x4566eb[_0xda62('0x6f')]||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb['attrs'][0xa]?_0x4566eb[_0xda62('0x5c')][0xa][_0xda62('0x5d')]:undefined)||''}];case _0xda62('0x76'):return[{'name':_0xda62('0x77'),'type':_0x4566eb['reportType']||(_0x4566eb['attrs']&&_0x4566eb[_0xda62('0x5c')][0x0]?_0x4566eb[_0xda62('0x5c')][0x0]['type']:undefined)||null,'value':_0x4566eb[_0xda62('0x77')]||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb[_0xda62('0x5c')][0x0]?_0x4566eb[_0xda62('0x5c')][0x0][_0xda62('0x5d')]:undefined)||null},{'name':_0xda62('0x78'),'value':_0x4566eb['attrRefresh']||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb[_0xda62('0x5c')][0x1]?_0x4566eb[_0xda62('0x5c')][0x1][_0xda62('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x10f985){logger[_0xda62('0x2a')](_0xda62('0x79'),JSON[_0xda62('0x7a')](_0x10f985));return[];}}exports['addItem']=function(_0x529d67,_0x594827,_0x253e7c){if(_0x529d67[_0xda62('0x4d')]['id']){delete _0x529d67[_0xda62('0x4d')]['id'];}return db[_0xda62('0x30')][_0xda62('0x4a')]({'where':{'id':_0x529d67[_0xda62('0x48')]['id']}})[_0xda62('0x27')](handleEntityNotFound(_0x594827,null))['then'](function(_0x289941){if(_0x289941){_0x529d67['body'][_0xda62('0x7b')]=_0x289941['id'];_0x529d67[_0xda62('0x4d')][_0xda62('0x5c')]=widgetAttributes(_0x529d67[_0xda62('0x4d')]);return db[_0xda62('0x7c')][_0xda62('0x4c')](_0x529d67['body']);}})[_0xda62('0x27')](respondWithResult(_0x594827,null))[_0xda62('0x4b')](handleError(_0x594827,null));};exports[_0xda62('0x7d')]=function(_0xc42db6,_0xffdc12,_0x463f65){var _0x27a2dd={};var _0x23eeda={};var _0x3f7b01;var _0x2c0572;return db[_0xda62('0x30')][_0xda62('0x7e')]({'where':{'id':_0xc42db6[_0xda62('0x48')]['id']}})['then'](handleEntityNotFound(_0xffdc12,null))['then'](function(_0x1c3465){if(_0x1c3465){_0x3f7b01=_0x1c3465;_0x23eeda[_0xda62('0x34')]=_[_0xda62('0x36')](db['DashboardItem'][_0xda62('0x7f')]);_0x23eeda[_0xda62('0x35')]=_[_0xda62('0x36')](_0xc42db6[_0xda62('0x35')]);_0x23eeda[_0xda62('0x37')]=_[_0xda62('0x38')](_0x23eeda[_0xda62('0x34')],_0x23eeda[_0xda62('0x35')]);_0x27a2dd[_0xda62('0x39')]=_[_0xda62('0x38')](_0x23eeda[_0xda62('0x34')],qs[_0xda62('0x3a')](_0xc42db6[_0xda62('0x35')][_0xda62('0x3a')]));_0x27a2dd[_0xda62('0x39')]=_0x27a2dd['attributes'][_0xda62('0x49')]?_0x27a2dd[_0xda62('0x39')]:_0x23eeda[_0xda62('0x34')];_0x27a2dd[_0xda62('0x3d')]=qs[_0xda62('0x3e')](_0xc42db6[_0xda62('0x35')][_0xda62('0x3e')]);_0x27a2dd['where']=qs[_0xda62('0x37')](_[_0xda62('0x80')](_0xc42db6[_0xda62('0x35')],_0x23eeda[_0xda62('0x37')]));if(_0xc42db6[_0xda62('0x35')][_0xda62('0x40')]){_0x27a2dd[_0xda62('0x3f')]=_['merge'](_0x27a2dd[_0xda62('0x3f')],{'$or':_[_0xda62('0x2f')](_0x27a2dd[_0xda62('0x39')],function(_0x220234){var _0x1f9405={};_0x1f9405[_0x220234]={'$like':'%'+_0xc42db6[_0xda62('0x35')]['filter']+'%'};return _0x1f9405;})});}_0x27a2dd=_[_0xda62('0x41')]({},_0x27a2dd,_0xc42db6['options']);return _0x3f7b01[_0xda62('0x7d')](_0x27a2dd);}})[_0xda62('0x27')](function(_0x57c301){if(_0x57c301){_0x2c0572=_0x57c301['length'];if(!_0xc42db6[_0xda62('0x35')][_0xda62('0x3b')](_0xda62('0x3c'))){_0x27a2dd[_0xda62('0x1f')]=qs[_0xda62('0x1f')](_0xc42db6[_0xda62('0x35')][_0xda62('0x1f')]);_0x27a2dd[_0xda62('0x1d')]=qs[_0xda62('0x1d')](_0xc42db6['query'][_0xda62('0x1d')]);}return _0x3f7b01['getItems'](_0x27a2dd);}})[_0xda62('0x27')](function(_0x1a962a){if(_0x1a962a){return _0x1a962a?{'count':_0x2c0572,'rows':_0x1a962a}:null;}})['then'](respondWithResult(_0xffdc12,null))[_0xda62('0x4b')](handleError(_0xffdc12,null));}; \ No newline at end of file +var _0x3609=['apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','name','index','map','Dashboard','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','count','includeAll','include','findAll','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','UserProfileSection','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrChatWebsites','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','findOne','rawAttributes','nolimit','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','./dashboard.socket','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json'];(function(_0xd6fe81,_0x1411eb){var _0x8a726c=function(_0x4b770a){while(--_0x4b770a){_0xd6fe81['push'](_0xd6fe81['shift']());}};_0x8a726c(++_0x1411eb);}(_0x3609,0x156));var _0x9360=function(_0x101e32,_0x4769c2){_0x101e32=_0x101e32-0x0;var _0x31197c=_0x3609[_0x101e32];return _0x31197c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9360('0x0'));var jsonpatch=require(_0x9360('0x1'));var rp=require('request-promise');var moment=require(_0x9360('0x2'));var BPromise=require(_0x9360('0x3'));var Mustache=require(_0x9360('0x4'));var util=require(_0x9360('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x9360('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9360('0x7'));var _=require(_0x9360('0x8'));var squel=require(_0x9360('0x9'));var crypto=require(_0x9360('0xa'));var jsforce=require(_0x9360('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9360('0xc'));var Papa=require(_0x9360('0xd'));var Redis=require('ioredis');var authService=require(_0x9360('0xe'));var qs=require(_0x9360('0xf'));var as=require(_0x9360('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9360('0x11'))(_0x9360('0x12'));var utils=require(_0x9360('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x9360('0x14'));var db=require('../../mysqldb')['db'];config[_0x9360('0x15')]=_[_0x9360('0x16')](config[_0x9360('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9360('0x15')]));require(_0x9360('0x17'))['register'](socket);function respondWithStatusCode(_0x46e17e,_0x335ea9){_0x335ea9=_0x335ea9||0xcc;return function(_0x7e8556){if(_0x7e8556){return _0x46e17e[_0x9360('0x18')](_0x335ea9);}return _0x46e17e[_0x9360('0x19')](_0x335ea9)[_0x9360('0x1a')]();};}function respondWithResult(_0x141281,_0x5e475b){_0x5e475b=_0x5e475b||0xc8;return function(_0x17198f){if(_0x17198f){return _0x141281[_0x9360('0x19')](_0x5e475b)['json'](_0x17198f);}};}function respondWithFilteredResult(_0x1423a3,_0x41b065){return function(_0x5afe56){if(_0x5afe56){var _0x595ebf=typeof _0x41b065[_0x9360('0x1b')]===_0x9360('0x1c')&&typeof _0x41b065['limit']===_0x9360('0x1c');var _0x193855=_0x5afe56['count'];var _0x5481db=_0x595ebf?0x0:_0x41b065[_0x9360('0x1b')];var _0x4474e3=_0x595ebf?_0x5afe56['count']:_0x41b065[_0x9360('0x1b')]+_0x41b065[_0x9360('0x1d')];var _0x2994cf;if(_0x4474e3>=_0x193855){_0x4474e3=_0x193855;_0x2994cf=0xc8;}else{_0x2994cf=0xce;}_0x1423a3[_0x9360('0x19')](_0x2994cf);return _0x1423a3[_0x9360('0x1e')](_0x9360('0x1f'),_0x5481db+'-'+_0x4474e3+'/'+_0x193855)[_0x9360('0x20')](_0x5afe56);}return null;};}function patchUpdates(_0x5b97d0){return function(_0x9e5a85){try{jsonpatch[_0x9360('0x21')](_0x9e5a85,_0x5b97d0,!![]);}catch(_0x5e96d2){return BPromise[_0x9360('0x22')](_0x5e96d2);}return _0x9e5a85[_0x9360('0x23')]();};}function saveUpdates(_0xf82354,_0x5d617a){return function(_0x3f8b2f){if(_0x3f8b2f){return _0x3f8b2f[_0x9360('0x24')](_0xf82354)[_0x9360('0x25')](function(_0x4df7d5){return _0x4df7d5;});}return null;};}function removeEntity(_0x378389,_0x368dcd){return function(_0x20ef92){if(_0x20ef92){return _0x20ef92[_0x9360('0x26')]()[_0x9360('0x25')](function(){var _0x34c4ce=_0x20ef92[_0x9360('0x27')]({'plain':!![]});var _0x41815f=_0x9360('0x28');return db[_0x9360('0x29')][_0x9360('0x26')]({'where':{'type':_0x41815f,'resourceId':_0x34c4ce['id']}})[_0x9360('0x25')](function(){return _0x20ef92;});})[_0x9360('0x25')](function(){_0x378389[_0x9360('0x19')](0xcc)[_0x9360('0x1a')]();});}};}function handleEntityNotFound(_0x1445b0,_0x22e137){return function(_0x314186){if(!_0x314186){_0x1445b0[_0x9360('0x18')](0x194);}return _0x314186;};}function handleError(_0x5ebc4c,_0x425804){_0x425804=_0x425804||0x1f4;return function(_0x396daf){logger[_0x9360('0x2a')](_0x396daf['stack']);if(_0x396daf[_0x9360('0x2b')]){delete _0x396daf[_0x9360('0x2b')];}_0x5ebc4c[_0x9360('0x19')](_0x425804)['send'](_0x396daf);};}exports[_0x9360('0x2c')]=function(_0x20ea65,_0x527ced){var _0x5db2ff={},_0x2753a8={},_0xbc1dfd={'count':0x0,'rows':[]};var _0x432787=_[_0x9360('0x2d')](db[_0x9360('0x2e')]['rawAttributes'],function(_0x17d503){return{'name':_0x17d503[_0x9360('0x2f')],'type':_0x17d503[_0x9360('0x30')]['key']};});_0x2753a8[_0x9360('0x31')]=_[_0x9360('0x2d')](_0x432787,'name');_0x2753a8[_0x9360('0x32')]=_[_0x9360('0x33')](_0x20ea65['query']);_0x2753a8['filters']=_[_0x9360('0x34')](_0x2753a8['model'],_0x2753a8[_0x9360('0x32')]);_0x5db2ff[_0x9360('0x35')]=_[_0x9360('0x34')](_0x2753a8['model'],qs['fields'](_0x20ea65[_0x9360('0x32')][_0x9360('0x36')]));_0x5db2ff[_0x9360('0x35')]=_0x5db2ff['attributes'][_0x9360('0x37')]?_0x5db2ff[_0x9360('0x35')]:_0x2753a8[_0x9360('0x31')];if(!_0x20ea65[_0x9360('0x32')][_0x9360('0x38')]('nolimit')){_0x5db2ff['limit']=qs[_0x9360('0x1d')](_0x20ea65['query'][_0x9360('0x1d')]);_0x5db2ff['offset']=qs[_0x9360('0x1b')](_0x20ea65[_0x9360('0x32')]['offset']);}_0x5db2ff[_0x9360('0x39')]=qs[_0x9360('0x3a')](_0x20ea65[_0x9360('0x32')][_0x9360('0x3a')]);_0x5db2ff[_0x9360('0x3b')]=qs[_0x9360('0x3c')](_[_0x9360('0x3d')](_0x20ea65[_0x9360('0x32')],_0x2753a8[_0x9360('0x3c')]),_0x432787);if(_0x20ea65[_0x9360('0x32')][_0x9360('0x3e')]){_0x5db2ff[_0x9360('0x3b')]=_[_0x9360('0x3f')](_0x5db2ff[_0x9360('0x3b')],{'$or':_[_0x9360('0x2d')](_0x432787,function(_0x1510db){if(_0x1510db[_0x9360('0x30')]!=='VIRTUAL'){var _0x41e4f4={};_0x41e4f4[_0x1510db['name']]={'$like':'%'+_0x20ea65[_0x9360('0x32')]['filter']+'%'};return _0x41e4f4;}})});}_0x5db2ff=_['merge']({},_0x5db2ff,_0x20ea65[_0x9360('0x40')]);var _0x5e396c={'where':_0x5db2ff[_0x9360('0x3b')]};return db[_0x9360('0x2e')][_0x9360('0x41')](_0x5e396c)[_0x9360('0x25')](function(_0xe9e093){_0xbc1dfd[_0x9360('0x41')]=_0xe9e093;if(_0x20ea65[_0x9360('0x32')][_0x9360('0x42')]){_0x5db2ff[_0x9360('0x43')]=[{'all':!![]}];}return db[_0x9360('0x2e')][_0x9360('0x44')](_0x5db2ff);})[_0x9360('0x25')](function(_0x30d38f){_0xbc1dfd['rows']=_0x30d38f;return _0xbc1dfd;})[_0x9360('0x25')](respondWithFilteredResult(_0x527ced,_0x5db2ff))[_0x9360('0x45')](handleError(_0x527ced,null));};exports[_0x9360('0x46')]=function(_0x598174,_0x3064fe){var _0x4f6897={'raw':![],'where':{'id':_0x598174[_0x9360('0x47')]['id']}},_0x23349c={};_0x23349c[_0x9360('0x31')]=_[_0x9360('0x33')](db[_0x9360('0x2e')]['rawAttributes']);_0x23349c[_0x9360('0x32')]=_[_0x9360('0x33')](_0x598174['query']);_0x23349c[_0x9360('0x3c')]=_[_0x9360('0x34')](_0x23349c['model'],_0x23349c[_0x9360('0x32')]);_0x4f6897[_0x9360('0x35')]=_[_0x9360('0x34')](_0x23349c[_0x9360('0x31')],qs['fields'](_0x598174[_0x9360('0x32')][_0x9360('0x36')]));_0x4f6897[_0x9360('0x35')]=_0x4f6897[_0x9360('0x35')][_0x9360('0x37')]?_0x4f6897[_0x9360('0x35')]:_0x23349c[_0x9360('0x31')];if(_0x598174[_0x9360('0x32')]['includeAll']){_0x4f6897[_0x9360('0x43')]=[{'all':!![]}];}_0x4f6897=_[_0x9360('0x3f')]({},_0x4f6897,_0x598174[_0x9360('0x40')]);return db[_0x9360('0x2e')]['find'](_0x4f6897)[_0x9360('0x25')](handleEntityNotFound(_0x3064fe,null))[_0x9360('0x25')](respondWithResult(_0x3064fe,null))[_0x9360('0x45')](handleError(_0x3064fe,null));};exports[_0x9360('0x48')]=function(_0x520f6d,_0x45125b){return db[_0x9360('0x2e')]['create'](_0x520f6d[_0x9360('0x49')],{})[_0x9360('0x25')](function(_0x435000){var _0x3a9928=_0x520f6d[_0x9360('0x4a')][_0x9360('0x27')]({'plain':!![]});if(!_0x3a9928)throw new Error(_0x9360('0x4b'));if(_0x3a9928['role']===_0x9360('0x4a')){var _0x3577c3=_0x435000[_0x9360('0x27')]({'plain':!![]});var _0x2a645b=_0x9360('0x28');return db['UserProfileSection'][_0x9360('0x4c')]({'where':{'name':_0x2a645b,'userProfileId':_0x3a9928[_0x9360('0x4d')]},'raw':!![]})[_0x9360('0x25')](function(_0x4511d3){if(_0x4511d3&&_0x4511d3[_0x9360('0x4e')]===0x0){return db['UserProfileResource'][_0x9360('0x48')]({'name':_0x3577c3[_0x9360('0x2b')],'resourceId':_0x3577c3['id'],'type':_0x4511d3['name'],'sectionId':_0x4511d3['id']},{})[_0x9360('0x25')](function(){return _0x435000;});}else{return _0x435000;}})['catch'](function(_0x4f523b){logger[_0x9360('0x2a')](_0x9360('0x4f'),_0x4f523b);throw _0x4f523b;});}return _0x435000;})[_0x9360('0x25')](respondWithResult(_0x45125b,0xc9))[_0x9360('0x45')](handleError(_0x45125b,null));};exports[_0x9360('0x50')]=function(_0x4a6452,_0x276c6d){var _0x14dc43={'where':{'id':_0x4a6452[_0x9360('0x47')]['id']}},_0xb2bbe4={};_0xb2bbe4[_0x9360('0x31')]=_[_0x9360('0x33')](db[_0x9360('0x2e')]['rawAttributes']);_0x14dc43[_0x9360('0x35')]=_[_0x9360('0x34')](_0xb2bbe4[_0x9360('0x31')],qs[_0x9360('0x36')](_0x4a6452[_0x9360('0x32')][_0x9360('0x36')]));_0x14dc43['attributes']=_0x14dc43[_0x9360('0x35')][_0x9360('0x37')]?_0x14dc43['attributes']:_0xb2bbe4[_0x9360('0x31')];if(_0x4a6452[_0x9360('0x32')][_0x9360('0x42')]){_0x14dc43[_0x9360('0x43')]=[{'all':!![]}];}_0x14dc43=_[_0x9360('0x3f')]({},_0x14dc43,_0x4a6452[_0x9360('0x40')]);return db[_0x9360('0x2e')][_0x9360('0x4c')](_0x14dc43)[_0x9360('0x25')](handleEntityNotFound(_0x276c6d,null))[_0x9360('0x25')](function(_0x34bc19){if(_0x34bc19){var _0x2084e3=_0x34bc19[_0x9360('0x27')]({'plain':!![]});_0x2084e3=qs[_0x9360('0x51')](_0x2084e3,['id',_0x9360('0x52'),_0x9360('0x53')]);_0x4a6452[_0x9360('0x49')]=_[_0x9360('0x51')](_0x4a6452['body'],['id',_0x9360('0x52'),_0x9360('0x53')]);return db[_0x9360('0x2e')][_0x9360('0x48')](_[_0x9360('0x3f')](_0x2084e3,_0x4a6452[_0x9360('0x49')]),{'include':_0x4a6452[_0x9360('0x32')][_0x9360('0x42')]?[{'all':!![]}]:undefined})[_0x9360('0x25')](function(_0x1e887b){var _0x4b3624=_0x4a6452[_0x9360('0x4a')][_0x9360('0x27')]({'plain':!![]});if(!_0x4b3624)throw new Error(_0x9360('0x4b'));if(_0x4b3624[_0x9360('0x54')]===_0x9360('0x4a')){var _0x42f82b=_0x1e887b['get']({'plain':!![]});var _0x771cf3=_0x9360('0x28');return db[_0x9360('0x55')][_0x9360('0x4c')]({'where':{'name':_0x771cf3,'userProfileId':_0x4b3624[_0x9360('0x4d')]},'raw':!![]})[_0x9360('0x25')](function(_0x319f64){if(_0x319f64&&_0x319f64[_0x9360('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x42f82b[_0x9360('0x2b')],'resourceId':_0x42f82b['id'],'type':_0x319f64[_0x9360('0x2b')],'sectionId':_0x319f64['id']},{})[_0x9360('0x25')](function(){return _0x1e887b;});}else{return _0x1e887b;}})['catch'](function(_0x15039){logger['error'](_0x9360('0x4f'),_0x15039);throw _0x15039;});}return _0x1e887b;});}})[_0x9360('0x25')](respondWithResult(_0x276c6d,0xc9))[_0x9360('0x45')](handleError(_0x276c6d,null));};exports[_0x9360('0x24')]=function(_0xaf0f,_0xb05348){if(_0xaf0f[_0x9360('0x49')]['id']){delete _0xaf0f[_0x9360('0x49')]['id'];}return db[_0x9360('0x2e')][_0x9360('0x4c')]({'where':{'id':_0xaf0f['params']['id']}})[_0x9360('0x25')](handleEntityNotFound(_0xb05348,null))[_0x9360('0x25')](saveUpdates(_0xaf0f[_0x9360('0x49')],null))['then'](respondWithResult(_0xb05348,null))[_0x9360('0x45')](handleError(_0xb05348,null));};exports[_0x9360('0x26')]=function(_0x138e8d,_0x5edc9a){return db[_0x9360('0x2e')][_0x9360('0x4c')]({'where':{'id':_0x138e8d[_0x9360('0x47')]['id']}})['then'](handleEntityNotFound(_0x5edc9a,null))[_0x9360('0x25')](removeEntity(_0x5edc9a,null))['catch'](handleError(_0x5edc9a,null));};function widgetAttributes(_0x516c65){try{switch(_0x516c65['type']){case'iframe':return[{'name':_0x9360('0x56'),'value':_0x516c65[_0x9360('0x56')]||(_0x516c65[_0x9360('0x57')]&&_0x516c65['attrs'][0x0]?_0x516c65[_0x9360('0x57')][0x0][_0x9360('0x58')]:undefined)||_0x9360('0x59')}];case _0x9360('0x5a'):return[{'name':_0x9360('0x5b'),'value':_0x516c65['attrPath']||(_0x516c65[_0x9360('0x57')]&&_0x516c65[_0x9360('0x57')][0x0]?_0x516c65[_0x9360('0x57')][0x0][_0x9360('0x58')]:undefined)||''}];case _0x9360('0x5c'):return[{'name':_0x9360('0x5d'),'value':_0x516c65[_0x9360('0x5d')]||(_0x516c65[_0x9360('0x57')]&&_0x516c65['attrs'][0x0]?_0x516c65[_0x9360('0x57')][0x0][_0x9360('0x58')]:undefined)||'HH:mm:ss'},{'name':_0x9360('0x5e'),'value':_0x516c65[_0x9360('0x5e')]||(_0x516c65[_0x9360('0x57')]&&_0x516c65[_0x9360('0x57')][0x1]?_0x516c65[_0x9360('0x57')][0x1][_0x9360('0x58')]:undefined)||_0x9360('0x5f')},{'name':_0x9360('0x60'),'value':_0x516c65[_0x9360('0x60')]||(_0x516c65[_0x9360('0x57')]&&_0x516c65[_0x9360('0x57')][0x2]?_0x516c65[_0x9360('0x57')][0x2][_0x9360('0x58')]:undefined)||0xc}];case _0x9360('0x61'):return[{'name':_0x9360('0x62'),'value':_0x516c65[_0x9360('0x62')]||(_0x516c65['attrs']&&_0x516c65[_0x9360('0x57')][0x0]?_0x516c65[_0x9360('0x57')][0x0][_0x9360('0x58')]:undefined)||_0x9360('0x63')},{'name':_0x9360('0x64'),'value':_0x516c65[_0x9360('0x64')]||(_0x516c65[_0x9360('0x57')]&&_0x516c65['attrs'][0x1]?_0x516c65[_0x9360('0x57')][0x1][_0x9360('0x58')]:undefined)||[]},{'name':'attrFontSize','value':_0x516c65[_0x9360('0x60')]||(_0x516c65[_0x9360('0x57')]&&_0x516c65[_0x9360('0x57')][0x2]?_0x516c65[_0x9360('0x57')][0x2][_0x9360('0x58')]:undefined)||0x14},{'name':'attrChannel','value':_0x516c65[_0x9360('0x65')]||(_0x516c65[_0x9360('0x57')]&&_0x516c65[_0x9360('0x57')][0x3]?_0x516c65[_0x9360('0x57')][0x3][_0x9360('0x58')]:undefined)||_0x9360('0x66')},{'name':_0x9360('0x67'),'value':_0x516c65[_0x9360('0x67')]||(_0x516c65[_0x9360('0x57')]&&_0x516c65[_0x9360('0x57')][0x4]?_0x516c65[_0x9360('0x57')][0x4][_0x9360('0x58')]:undefined)||''},{'name':_0x9360('0x68'),'value':_0x516c65[_0x9360('0x68')]||(_0x516c65[_0x9360('0x57')]&&_0x516c65[_0x9360('0x57')][0x5]?_0x516c65[_0x9360('0x57')][0x5]['value']:undefined)||''},{'name':_0x9360('0x69'),'value':_0x516c65[_0x9360('0x69')]||(_0x516c65['attrs']&&_0x516c65[_0x9360('0x57')][0x6]?_0x516c65['attrs'][0x6][_0x9360('0x58')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x516c65[_0x9360('0x6a')]||(_0x516c65[_0x9360('0x57')]&&_0x516c65[_0x9360('0x57')][0x7]?_0x516c65[_0x9360('0x57')][0x7][_0x9360('0x58')]:undefined)||''},{'name':_0x9360('0x6b'),'value':_0x516c65[_0x9360('0x6b')]||(_0x516c65[_0x9360('0x57')]&&_0x516c65['attrs'][0x8]?_0x516c65[_0x9360('0x57')][0x8][_0x9360('0x58')]:undefined)||''},{'name':'attrChatWebsites','value':_0x516c65['attrChatWebsites']||(_0x516c65[_0x9360('0x57')]&&_0x516c65['attrs'][0x9]?_0x516c65[_0x9360('0x57')][0x9]['value']:undefined)||''}];case _0x9360('0x6c'):case _0x9360('0x6d'):return[{'name':_0x9360('0x6e'),'value':_0x516c65[_0x9360('0x6e')]||(_0x516c65[_0x9360('0x57')]&&_0x516c65[_0x9360('0x57')][0x0]?_0x516c65[_0x9360('0x57')][0x0]['value']:undefined)||_0x9360('0x63')},{'name':_0x9360('0x6f'),'value':_0x516c65['attrSerie2']||(_0x516c65['attrs']&&_0x516c65[_0x9360('0x57')][0x1]?_0x516c65[_0x9360('0x57')][0x1][_0x9360('0x58')]:undefined)||null},{'name':_0x9360('0x70'),'value':_0x516c65[_0x9360('0x70')]||(_0x516c65[_0x9360('0x57')]&&_0x516c65[_0x9360('0x57')][0x2]?_0x516c65[_0x9360('0x57')][0x2][_0x9360('0x58')]:undefined)||null},{'name':_0x9360('0x64'),'value':_0x516c65['attrVoiceQueues']||(_0x516c65[_0x9360('0x57')]&&_0x516c65[_0x9360('0x57')][0x3]?_0x516c65[_0x9360('0x57')][0x3][_0x9360('0x58')]:undefined)||[]},{'name':_0x9360('0x65'),'value':_0x516c65[_0x9360('0x65')]||(_0x516c65[_0x9360('0x57')]&&_0x516c65[_0x9360('0x57')][0x4]?_0x516c65[_0x9360('0x57')][0x4][_0x9360('0x58')]:undefined)||_0x9360('0x66')},{'name':'attrEmailAccounts','value':_0x516c65[_0x9360('0x67')]||(_0x516c65[_0x9360('0x57')]&&_0x516c65[_0x9360('0x57')][0x5]?_0x516c65[_0x9360('0x57')][0x5][_0x9360('0x58')]:undefined)||''},{'name':_0x9360('0x68'),'value':_0x516c65[_0x9360('0x68')]||(_0x516c65['attrs']&&_0x516c65[_0x9360('0x57')][0x6]?_0x516c65[_0x9360('0x57')][0x6][_0x9360('0x58')]:undefined)||''},{'name':_0x9360('0x69'),'value':_0x516c65[_0x9360('0x69')]||(_0x516c65[_0x9360('0x57')]&&_0x516c65[_0x9360('0x57')][0x7]?_0x516c65[_0x9360('0x57')][0x7][_0x9360('0x58')]:undefined)||''},{'name':_0x9360('0x6a'),'value':_0x516c65['attrOpenchannelAccounts']||(_0x516c65[_0x9360('0x57')]&&_0x516c65[_0x9360('0x57')][0x8]?_0x516c65[_0x9360('0x57')][0x8][_0x9360('0x58')]:undefined)||''},{'name':_0x9360('0x6b'),'value':_0x516c65[_0x9360('0x6b')]||(_0x516c65['attrs']&&_0x516c65[_0x9360('0x57')][0x9]?_0x516c65[_0x9360('0x57')][0x9][_0x9360('0x58')]:undefined)||''},{'name':_0x9360('0x71'),'value':_0x516c65[_0x9360('0x71')]||(_0x516c65['attrs']&&_0x516c65[_0x9360('0x57')][0xa]?_0x516c65[_0x9360('0x57')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':_0x9360('0x72'),'type':_0x516c65[_0x9360('0x73')]||(_0x516c65[_0x9360('0x57')]&&_0x516c65[_0x9360('0x57')][0x0]?_0x516c65[_0x9360('0x57')][0x0][_0x9360('0x30')]:undefined)||null,'value':_0x516c65[_0x9360('0x72')]||(_0x516c65[_0x9360('0x57')]&&_0x516c65[_0x9360('0x57')][0x0]?_0x516c65[_0x9360('0x57')][0x0]['value']:undefined)||null},{'name':_0x9360('0x74'),'value':_0x516c65[_0x9360('0x74')]||(_0x516c65[_0x9360('0x57')]&&_0x516c65[_0x9360('0x57')][0x1]?_0x516c65[_0x9360('0x57')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x3f9360){logger[_0x9360('0x2a')](_0x9360('0x75'),JSON[_0x9360('0x76')](_0x3f9360));return[];}}exports[_0x9360('0x77')]=function(_0xf6ffb9,_0x495a8c,_0x41b408){if(_0xf6ffb9[_0x9360('0x49')]['id']){delete _0xf6ffb9[_0x9360('0x49')]['id'];}return db[_0x9360('0x2e')]['find']({'where':{'id':_0xf6ffb9[_0x9360('0x47')]['id']}})['then'](handleEntityNotFound(_0x495a8c,null))[_0x9360('0x25')](function(_0x2de1ab){if(_0x2de1ab){_0xf6ffb9[_0x9360('0x49')]['DashboardId']=_0x2de1ab['id'];_0xf6ffb9[_0x9360('0x49')][_0x9360('0x57')]=widgetAttributes(_0xf6ffb9[_0x9360('0x49')]);return db[_0x9360('0x78')][_0x9360('0x48')](_0xf6ffb9[_0x9360('0x49')]);}})[_0x9360('0x25')](respondWithResult(_0x495a8c,null))[_0x9360('0x45')](handleError(_0x495a8c,null));};exports[_0x9360('0x79')]=function(_0x29fa88,_0x51376d,_0x3e3a5f){var _0x4eecb2={};var _0x1b1041={};var _0x520de2;var _0x5afbeb;return db[_0x9360('0x2e')][_0x9360('0x7a')]({'where':{'id':_0x29fa88[_0x9360('0x47')]['id']}})[_0x9360('0x25')](handleEntityNotFound(_0x51376d,null))[_0x9360('0x25')](function(_0x4b1036){if(_0x4b1036){_0x520de2=_0x4b1036;_0x1b1041[_0x9360('0x31')]=_['keys'](db[_0x9360('0x78')][_0x9360('0x7b')]);_0x1b1041[_0x9360('0x32')]=_['keys'](_0x29fa88[_0x9360('0x32')]);_0x1b1041['filters']=_['intersection'](_0x1b1041[_0x9360('0x31')],_0x1b1041[_0x9360('0x32')]);_0x4eecb2[_0x9360('0x35')]=_['intersection'](_0x1b1041[_0x9360('0x31')],qs[_0x9360('0x36')](_0x29fa88[_0x9360('0x32')][_0x9360('0x36')]));_0x4eecb2[_0x9360('0x35')]=_0x4eecb2[_0x9360('0x35')][_0x9360('0x37')]?_0x4eecb2['attributes']:_0x1b1041[_0x9360('0x31')];_0x4eecb2[_0x9360('0x39')]=qs[_0x9360('0x3a')](_0x29fa88[_0x9360('0x32')][_0x9360('0x3a')]);_0x4eecb2[_0x9360('0x3b')]=qs[_0x9360('0x3c')](_['pick'](_0x29fa88[_0x9360('0x32')],_0x1b1041[_0x9360('0x3c')]));if(_0x29fa88['query']['filter']){_0x4eecb2[_0x9360('0x3b')]=_[_0x9360('0x3f')](_0x4eecb2[_0x9360('0x3b')],{'$or':_[_0x9360('0x2d')](_0x4eecb2['attributes'],function(_0xac1c67){var _0x5eded6={};_0x5eded6[_0xac1c67]={'$like':'%'+_0x29fa88[_0x9360('0x32')][_0x9360('0x3e')]+'%'};return _0x5eded6;})});}_0x4eecb2=_[_0x9360('0x3f')]({},_0x4eecb2,_0x29fa88[_0x9360('0x40')]);return _0x520de2[_0x9360('0x79')](_0x4eecb2);}})['then'](function(_0x2a5620){if(_0x2a5620){_0x5afbeb=_0x2a5620[_0x9360('0x37')];if(!_0x29fa88['query'][_0x9360('0x38')](_0x9360('0x7c'))){_0x4eecb2[_0x9360('0x1d')]=qs[_0x9360('0x1d')](_0x29fa88['query']['limit']);_0x4eecb2[_0x9360('0x1b')]=qs[_0x9360('0x1b')](_0x29fa88['query'][_0x9360('0x1b')]);}return _0x520de2['getItems'](_0x4eecb2);}})[_0x9360('0x25')](function(_0x1cd0b0){if(_0x1cd0b0){return _0x1cd0b0?{'count':_0x5afbeb,'rows':_0x1cd0b0}:null;}})[_0x9360('0x25')](respondWithResult(_0x51376d,null))[_0x9360('0x45')](handleError(_0x51376d,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 65d5e67..adaef1d 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 _0xe7e4=['setMaxListeners','save','remove','emit','hook','exports','events','Dashboard'];(function(_0x5b45df,_0x2623ba){var _0x1d7de0=function(_0x481a25){while(--_0x481a25){_0x5b45df['push'](_0x5b45df['shift']());}};_0x1d7de0(++_0x2623ba);}(_0xe7e4,0x1be));var _0x4e7e=function(_0x293ac7,_0xb6da39){_0x293ac7=_0x293ac7-0x0;var _0x525884=_0xe7e4[_0x293ac7];return _0x525884;};'use strict';var EventEmitter=require(_0x4e7e('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x4e7e('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x4e7e('0x2')](0x0);var events={'afterCreate':_0x4e7e('0x3'),'afterUpdate':'update','afterDestroy':_0x4e7e('0x4')};function emitEvent(_0x2316e6){return function(_0x1afc5d,_0x59fd25,_0x2e4be9){DashboardEvents[_0x4e7e('0x5')](_0x2316e6+':'+_0x1afc5d['id'],_0x1afc5d);DashboardEvents['emit'](_0x2316e6,_0x1afc5d);_0x2e4be9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x4e7e('0x6')](e,emitEvent(event));}}module[_0x4e7e('0x7')]=DashboardEvents; \ No newline at end of file +var _0xb70d=['events','../../mysqldb','Dashboard','save','update','remove','emit','hook','exports'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0xb70d,0xc6));var _0xdb70=function(_0x1da9b1,_0x1356d7){_0x1da9b1=_0x1da9b1-0x0;var _0x1eef81=_0xb70d[_0x1da9b1];return _0x1eef81;};'use strict';var EventEmitter=require(_0xdb70('0x0'));var Dashboard=require(_0xdb70('0x1'))['db'][_0xdb70('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdb70('0x3'),'afterUpdate':_0xdb70('0x4'),'afterDestroy':_0xdb70('0x5')};function emitEvent(_0x4e533a){return function(_0x17dcbb,_0x394978,_0x4d964d){DashboardEvents[_0xdb70('0x6')](_0x4e533a+':'+_0x17dcbb['id'],_0x17dcbb);DashboardEvents[_0xdb70('0x6')](_0x4e533a,_0x17dcbb);_0x4d964d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xdb70('0x7')](e,emitEvent(event));}}module[_0xdb70('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 8e62bfe..98d732f 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 _0x33d2=['path','rimraf','../../config/environment','./dashboard.attributes','exports','define','dashboards','lodash','util','../../config/logger','moment','bluebird'];(function(_0x4062ed,_0x1e0bb7){var _0x4d308d=function(_0x1227ab){while(--_0x1227ab){_0x4062ed['push'](_0x4062ed['shift']());}};_0x4d308d(++_0x1e0bb7);}(_0x33d2,0x7f));var _0x233d=function(_0x34c3f3,_0x15f139){_0x34c3f3=_0x34c3f3-0x0;var _0x3ca5cb=_0x33d2[_0x34c3f3];return _0x3ca5cb;};'use strict';var _=require(_0x233d('0x0'));var util=require(_0x233d('0x1'));var logger=require(_0x233d('0x2'))('api');var moment=require(_0x233d('0x3'));var BPromise=require(_0x233d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x233d('0x5'));var rimraf=require(_0x233d('0x6'));var config=require(_0x233d('0x7'));var attributes=require(_0x233d('0x8'));module[_0x233d('0x9')]=function(_0x3f311b,_0x15ba43){return _0x3f311b[_0x233d('0xa')]('Dashboard',attributes,{'tableName':_0x233d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xddc7=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','Dashboard','dashboards'];(function(_0x1192d9,_0xad86f0){var _0x5fe878=function(_0xbfb085){while(--_0xbfb085){_0x1192d9['push'](_0x1192d9['shift']());}};_0x5fe878(++_0xad86f0);}(_0xddc7,0x1b0));var _0x7ddc=function(_0x29f013,_0x2b13f3){_0x29f013=_0x29f013-0x0;var _0x5001bb=_0xddc7[_0x29f013];return _0x5001bb;};'use strict';var _=require(_0x7ddc('0x0'));var util=require(_0x7ddc('0x1'));var logger=require(_0x7ddc('0x2'))('api');var moment=require(_0x7ddc('0x3'));var BPromise=require(_0x7ddc('0x4'));var rp=require(_0x7ddc('0x5'));var fs=require('fs');var path=require(_0x7ddc('0x6'));var rimraf=require(_0x7ddc('0x7'));var config=require(_0x7ddc('0x8'));var attributes=require('./dashboard.attributes');module['exports']=function(_0x531548,_0xbde15){return _0x531548[_0x7ddc('0x9')](_0x7ddc('0xa'),attributes,{'tableName':_0x7ddc('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 fd4d370..0be70bd 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 _0x9547=['./dashboard.socket','request','Dashboard,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x85eeab,_0x367d2a){var _0x5b1338=function(_0x207d98){while(--_0x207d98){_0x85eeab['push'](_0x85eeab['shift']());}};_0x5b1338(++_0x367d2a);}(_0x9547,0xd9));var _0x7954=function(_0x35387d,_0x1ba72f){_0x35387d=_0x35387d-0x0;var _0x3aba56=_0x9547[_0x35387d];return _0x3aba56;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7954('0x0'));var BPromise=require(_0x7954('0x1'));var rs=require(_0x7954('0x2'));var fs=require('fs');var Redis=require(_0x7954('0x3'));var db=require(_0x7954('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7954('0x5'))(_0x7954('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7954('0x7')][_0x7954('0x8')]({'port':0x232a});config[_0x7954('0x9')]=_[_0x7954('0xa')](config[_0x7954('0x9')],{'host':_0x7954('0xb'),'port':0x18eb});var socket=require(_0x7954('0xc'))(new Redis(config[_0x7954('0x9')]));require(_0x7954('0xd'))['register'](socket);function respondWithRpcPromise(_0x112b14,_0x4febff,_0x26a18e){return new BPromise(function(_0x1279db,_0x5e3a09){return client[_0x7954('0xe')](_0x112b14,_0x26a18e)['then'](function(_0x3180d0){logger['info'](_0x7954('0xf'),_0x4febff,_0x7954('0x10'));logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0x4febff,_0x7954('0x10'),JSON[_0x7954('0x11')](_0x3180d0));if(_0x3180d0[_0x7954('0x12')]){if(_0x3180d0['error'][_0x7954('0x13')]===0x1f4){logger[_0x7954('0x12')](_0x7954('0xf'),_0x4febff,_0x3180d0['error'][_0x7954('0x14')]);return _0x5e3a09(_0x3180d0[_0x7954('0x12')][_0x7954('0x14')]);}logger[_0x7954('0x12')](_0x7954('0xf'),_0x4febff,_0x3180d0['error'][_0x7954('0x14')]);return _0x1279db(_0x3180d0[_0x7954('0x12')][_0x7954('0x14')]);}else{logger[_0x7954('0x15')](_0x7954('0xf'),_0x4febff,_0x7954('0x10'));_0x1279db(_0x3180d0['result'][_0x7954('0x14')]);}})[_0x7954('0x16')](function(_0x42a840){logger[_0x7954('0x12')]('Dashboard,\x20%s,\x20%s',_0x4febff,_0x42a840);_0x5e3a09(_0x42a840);});});} \ No newline at end of file +var _0x5193=['redis','defaults','register','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x1d9076,_0x579d20){var _0x65356=function(_0x494ac7){while(--_0x494ac7){_0x1d9076['push'](_0x1d9076['shift']());}};_0x65356(++_0x579d20);}(_0x5193,0x65));var _0x3519=function(_0x14c0dc,_0x59c300){_0x14c0dc=_0x14c0dc-0x0;var _0x3403ae=_0x5193[_0x14c0dc];return _0x3403ae;};'use strict';var _=require(_0x3519('0x0'));var util=require(_0x3519('0x1'));var moment=require(_0x3519('0x2'));var BPromise=require(_0x3519('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3519('0x4'))['db'];var utils=require(_0x3519('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3519('0x6'));var jayson=require(_0x3519('0x7'));var client=jayson[_0x3519('0x8')]['http']({'port':0x232a});config[_0x3519('0x9')]=_[_0x3519('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./dashboard.socket')[_0x3519('0xb')](socket);function respondWithRpcPromise(_0x113e41,_0x4e4769,_0x10df13){return new BPromise(function(_0x5ee4d5,_0x453d5d){return client[_0x3519('0xc')](_0x113e41,_0x10df13)[_0x3519('0xd')](function(_0x5f2be3){logger['info'](_0x3519('0xe'),_0x4e4769,_0x3519('0xf'));logger[_0x3519('0x10')](_0x3519('0x11'),_0x4e4769,'request\x20sent',JSON[_0x3519('0x12')](_0x5f2be3));if(_0x5f2be3[_0x3519('0x13')]){if(_0x5f2be3[_0x3519('0x13')][_0x3519('0x14')]===0x1f4){logger[_0x3519('0x13')](_0x3519('0xe'),_0x4e4769,_0x5f2be3[_0x3519('0x13')][_0x3519('0x15')]);return _0x453d5d(_0x5f2be3['error']['message']);}logger['error']('Dashboard,\x20%s,\x20%s',_0x4e4769,_0x5f2be3[_0x3519('0x13')]['message']);return _0x5ee4d5(_0x5f2be3[_0x3519('0x13')]['message']);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0x4e4769,'request\x20sent');_0x5ee4d5(_0x5f2be3['result'][_0x3519('0x15')]);}})['catch'](function(_0x3236fd){logger['error'](_0x3519('0xe'),_0x4e4769,_0x3236fd);_0x453d5d(_0x3236fd);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index a09a1c0..436bce4 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 _0x6633=['dashboard:','./dashboard.events','save','remove','update','emit','removeListener','register'];(function(_0x551322,_0x365709){var _0x2b8cf6=function(_0x3e4d71){while(--_0x3e4d71){_0x551322['push'](_0x551322['shift']());}};_0x2b8cf6(++_0x365709);}(_0x6633,0xd1));var _0x3663=function(_0x36472f,_0x50db34){_0x36472f=_0x36472f-0x0;var _0x5e31b6=_0x6633[_0x36472f];return _0x5e31b6;};'use strict';var DashboardEvents=require(_0x3663('0x0'));var events=[_0x3663('0x1'),_0x3663('0x2'),_0x3663('0x3')];function createListener(_0x30169d,_0x300eea){return function(_0x32bbe2){_0x300eea[_0x3663('0x4')](_0x30169d,_0x32bbe2);};}function removeListener(_0x36a1e6,_0x303627){return function(){DashboardEvents[_0x3663('0x5')](_0x36a1e6,_0x303627);};}exports[_0x3663('0x6')]=function(_0x5f5c65){for(var _0x49985f=0x0,_0x583c1f=events['length'];_0x49985f<_0x583c1f;_0x49985f++){var _0x38f616=events[_0x49985f];var _0x2e3b2d=createListener(_0x3663('0x7')+_0x38f616,_0x5f5c65);DashboardEvents['on'](_0x38f616,_0x2e3b2d);}}; \ No newline at end of file +var _0x79c8=['dashboard:','./dashboard.events','save','remove','update','emit','removeListener','register','length'];(function(_0x35dcaa,_0x668cac){var _0x218e33=function(_0x212aa8){while(--_0x212aa8){_0x35dcaa['push'](_0x35dcaa['shift']());}};_0x218e33(++_0x668cac);}(_0x79c8,0x184));var _0x879c=function(_0x5e24bc,_0x1dfc37){_0x5e24bc=_0x5e24bc-0x0;var _0x54b0f7=_0x79c8[_0x5e24bc];return _0x54b0f7;};'use strict';var DashboardEvents=require(_0x879c('0x0'));var events=[_0x879c('0x1'),_0x879c('0x2'),_0x879c('0x3')];function createListener(_0x5530d3,_0x2615ab){return function(_0x2f979c){_0x2615ab[_0x879c('0x4')](_0x5530d3,_0x2f979c);};}function removeListener(_0x3cffc4,_0x16f14d){return function(){DashboardEvents[_0x879c('0x5')](_0x3cffc4,_0x16f14d);};}exports[_0x879c('0x6')]=function(_0x42ddf4){for(var _0x463db1=0x0,_0x325c5f=events[_0x879c('0x7')];_0x463db1<_0x325c5f;_0x463db1++){var _0x52c0d0=events[_0x463db1];var _0x3560bf=createListener(_0x879c('0x8')+_0x52c0d0,_0x42ddf4);DashboardEvents['on'](_0x52c0d0,_0x3560bf);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index e7de1a9..19d18a9 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 _0x9001=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','/:id/items','getItems','post','create','/:id/clone','put','update','destroy','exports','multer'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x9001,0x92));var _0x1900=function(_0x1d791b,_0x5797b4){_0x1d791b=_0x1d791b-0x0;var _0x44c2a2=_0x9001[_0x1d791b];return _0x44c2a2;};'use strict';var multer=require(_0x1900('0x0'));var util=require('util');var path=require(_0x1900('0x1'));var timeout=require(_0x1900('0x2'));var express=require(_0x1900('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1900('0x4'));var interaction=require(_0x1900('0x5'));var config=require(_0x1900('0x6'));var controller=require(_0x1900('0x7'));router[_0x1900('0x8')]('/',auth[_0x1900('0x9')](),controller[_0x1900('0xa')]);router['get'](_0x1900('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1900('0x8')](_0x1900('0xc'),auth[_0x1900('0x9')](),controller[_0x1900('0xd')]);router[_0x1900('0xe')]('/',auth[_0x1900('0x9')](),controller[_0x1900('0xf')]);router[_0x1900('0xe')](_0x1900('0x10'),auth['isAuthenticated'](),controller['clone']);router[_0x1900('0xe')](_0x1900('0xc'),auth[_0x1900('0x9')](),controller['addItem']);router[_0x1900('0x11')](_0x1900('0xb'),auth[_0x1900('0x9')](),controller[_0x1900('0x12')]);router['delete'](_0x1900('0xb'),auth['isAuthenticated'](),controller[_0x1900('0x13')]);module[_0x1900('0x14')]=router; \ No newline at end of file +var _0x9414=['addItem','put','update','/:id','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','show','/:id/items','getItems','post','create','clone'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x9414,0x90));var _0x4941=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x9414[_0x5b78e8];return _0xf2c321;};'use strict';var multer=require(_0x4941('0x0'));var util=require('util');var path=require(_0x4941('0x1'));var timeout=require('connect-timeout');var express=require(_0x4941('0x2'));var router=express[_0x4941('0x3')]();var fs_extra=require(_0x4941('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4941('0x5'));var config=require(_0x4941('0x6'));var controller=require(_0x4941('0x7'));router[_0x4941('0x8')]('/',auth[_0x4941('0x9')](),controller[_0x4941('0xa')]);router['get']('/:id',auth[_0x4941('0x9')](),controller[_0x4941('0xb')]);router['get'](_0x4941('0xc'),auth['isAuthenticated'](),controller[_0x4941('0xd')]);router[_0x4941('0xe')]('/',auth[_0x4941('0x9')](),controller[_0x4941('0xf')]);router['post']('/:id/clone',auth['isAuthenticated'](),controller[_0x4941('0x10')]);router['post'](_0x4941('0xc'),auth[_0x4941('0x9')](),controller[_0x4941('0x11')]);router[_0x4941('0x12')]('/:id',auth[_0x4941('0x9')](),controller[_0x4941('0x13')]);router['delete'](_0x4941('0x14'),auth['isAuthenticated'](),controller[_0x4941('0x15')]);module[_0x4941('0x16')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 24d5a2f..95e0fd6 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 _0x46ed=['sequelize','squel','exports','STRING','long','parse','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3'];(function(_0x420f2a,_0x2cc58d){var _0x28f802=function(_0x3329cc){while(--_0x3329cc){_0x420f2a['push'](_0x420f2a['shift']());}};_0x28f802(++_0x2cc58d);}(_0x46ed,0x168));var _0xd46e=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x46ed[_0x46e363];return _0x3fb059;};'use strict';var Sequelize=require(_0xd46e('0x0'));var squel=require(_0xd46e('0x1'));var _=require('lodash');module[_0xd46e('0x2')]={'title':{'type':Sequelize[_0xd46e('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xd46e('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xd46e('0x4')),'get':function(){try{return JSON[_0xd46e('0x5')](this['getDataValue'](_0xd46e('0x6')));}catch(_0x1926d9){return[];}},'set':function(_0x160bcf){try{this[_0xd46e('0x7')](_0xd46e('0x6'),JSON[_0xd46e('0x8')](_0x160bcf));}catch(_0x437ea0){this[_0xd46e('0x7')](_0xd46e('0x6'),JSON[_0xd46e('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0xd46e('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xd46e('0x9')]},'col':{'type':Sequelize[_0xd46e('0x9')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd46e('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xd46e('0x3')],'allowNull':![],'defaultValue':_0xd46e('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xd46e('0x3')]},'titleFontSize':{'type':Sequelize[_0xd46e('0x9')],'defaultValue':0xc}}; \ No newline at end of file +var _0xda19=['TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','squel','lodash','STRING'];(function(_0x4ce028,_0x526d4b){var _0x583d0c=function(_0x874178){while(--_0x874178){_0x4ce028['push'](_0x4ce028['shift']());}};_0x583d0c(++_0x526d4b);}(_0xda19,0xd5));var _0x9da1=function(_0x3c863f,_0x45bc09){_0x3c863f=_0x3c863f-0x0;var _0x36550e=_0xda19[_0x3c863f];return _0x36550e;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x9da1('0x0'));var _=require(_0x9da1('0x1'));module['exports']={'title':{'type':Sequelize[_0x9da1('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x9da1('0x3')]('long'),'get':function(){try{return JSON[_0x9da1('0x4')](this[_0x9da1('0x5')](_0x9da1('0x6')));}catch(_0x470043){return[];}},'set':function(_0x156faf){try{this[_0x9da1('0x7')](_0x9da1('0x6'),JSON[_0x9da1('0x8')](_0x156faf));}catch(_0x1c24e6){this[_0x9da1('0x7')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x9da1('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x9da1('0x9')]},'background':{'type':Sequelize[_0x9da1('0x2')],'allowNull':![],'defaultValue':_0x9da1('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x9da1('0x2')],'allowNull':![],'defaultValue':_0x9da1('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x9da1('0x2')]},'titleFontSize':{'type':Sequelize[_0x9da1('0x9')],'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 b923b0e..716f9aa 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 _0x0adf=['apply','reject','save','update','then','destroy','error','stack','name','send','params','model','keys','DashboardItem','rawAttributes','query','attributes','intersection','fields','includeAll','include','merge','options','catch','find','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range'];(function(_0x4f6342,_0x1c54e5){var _0xbb2867=function(_0x39f231){while(--_0x39f231){_0x4f6342['push'](_0x4f6342['shift']());}};_0xbb2867(++_0x1c54e5);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x3d20ed,_0x30576e){_0x3d20ed=_0x3d20ed-0x0;var _0x4dbbd2=_0x0adf[_0x3d20ed];return _0x4dbbd2;};'use strict';var emlformat=require(_0xf0ad('0x0'));var rimraf=require(_0xf0ad('0x1'));var zipdir=require(_0xf0ad('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf0ad('0x3'));var moment=require(_0xf0ad('0x4'));var BPromise=require(_0xf0ad('0x5'));var Mustache=require(_0xf0ad('0x6'));var util=require(_0xf0ad('0x7'));var path=require(_0xf0ad('0x8'));var sox=require(_0xf0ad('0x9'));var csv=require('to-csv');var ejs=require(_0xf0ad('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf0ad('0xb'));var squel=require(_0xf0ad('0xc'));var crypto=require(_0xf0ad('0xd'));var jsforce=require(_0xf0ad('0xe'));var deskjs=require(_0xf0ad('0xf'));var toCsv=require(_0xf0ad('0x10'));var querystring=require(_0xf0ad('0x11'));var Papa=require('papaparse');var Redis=require(_0xf0ad('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf0ad('0x13'));var as=require(_0xf0ad('0x14'));var hardwareService=require(_0xf0ad('0x15'));var logger=require(_0xf0ad('0x16'))(_0xf0ad('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf0ad('0x18'));var db=require(_0xf0ad('0x19'))['db'];config[_0xf0ad('0x1a')]=_[_0xf0ad('0x1b')](config['redis'],{'host':_0xf0ad('0x1c'),'port':0x18eb});var socket=require(_0xf0ad('0x1d'))(new Redis(config['redis']));require('./dashboardItem.socket')['register'](socket);function respondWithStatusCode(_0x221d7b,_0x513237){_0x513237=_0x513237||0xcc;return function(_0x1dad7b){if(_0x1dad7b){return _0x221d7b[_0xf0ad('0x1e')](_0x513237);}return _0x221d7b[_0xf0ad('0x1f')](_0x513237)[_0xf0ad('0x20')]();};}function respondWithResult(_0x237dd9,_0x5c23ff){_0x5c23ff=_0x5c23ff||0xc8;return function(_0x1ad9e0){if(_0x1ad9e0){return _0x237dd9[_0xf0ad('0x1f')](_0x5c23ff)[_0xf0ad('0x21')](_0x1ad9e0);}};}function respondWithFilteredResult(_0x1c9fac,_0x47fa2b){return function(_0x4e9970){if(_0x4e9970){var _0x2466e8=typeof _0x47fa2b[_0xf0ad('0x22')]==='undefined'&&typeof _0x47fa2b[_0xf0ad('0x23')]===_0xf0ad('0x24');var _0x9a95bf=_0x4e9970[_0xf0ad('0x25')];var _0x4cc08a=_0x2466e8?0x0:_0x47fa2b['offset'];var _0x3f8cf3=_0x2466e8?_0x4e9970[_0xf0ad('0x25')]:_0x47fa2b[_0xf0ad('0x22')]+_0x47fa2b[_0xf0ad('0x23')];var _0x2ac8ba;if(_0x3f8cf3>=_0x9a95bf){_0x3f8cf3=_0x9a95bf;_0x2ac8ba=0xc8;}else{_0x2ac8ba=0xce;}_0x1c9fac[_0xf0ad('0x1f')](_0x2ac8ba);return _0x1c9fac['set'](_0xf0ad('0x26'),_0x4cc08a+'-'+_0x3f8cf3+'/'+_0x9a95bf)[_0xf0ad('0x21')](_0x4e9970);}return null;};}function patchUpdates(_0x31635b){return function(_0x3ece1e){try{jsonpatch[_0xf0ad('0x27')](_0x3ece1e,_0x31635b,!![]);}catch(_0x88b47b){return BPromise[_0xf0ad('0x28')](_0x88b47b);}return _0x3ece1e[_0xf0ad('0x29')]();};}function saveUpdates(_0x3fc97e,_0x112f20){return function(_0x39b3e8){if(_0x39b3e8){return _0x39b3e8[_0xf0ad('0x2a')](_0x3fc97e)[_0xf0ad('0x2b')](function(_0x456f81){return _0x456f81;});}return null;};}function removeEntity(_0x879f89,_0x557f90){return function(_0x234bc7){if(_0x234bc7){return _0x234bc7[_0xf0ad('0x2c')]()[_0xf0ad('0x2b')](function(){_0x879f89[_0xf0ad('0x1f')](0xcc)[_0xf0ad('0x20')]();});}};}function handleEntityNotFound(_0x30f8ee,_0x560417){return function(_0x2cbe00){if(!_0x2cbe00){_0x30f8ee[_0xf0ad('0x1e')](0x194);}return _0x2cbe00;};}function handleError(_0x2b62,_0x1e60b1){_0x1e60b1=_0x1e60b1||0x1f4;return function(_0x1b6880){logger[_0xf0ad('0x2d')](_0x1b6880[_0xf0ad('0x2e')]);if(_0x1b6880[_0xf0ad('0x2f')]){delete _0x1b6880[_0xf0ad('0x2f')];}_0x2b62[_0xf0ad('0x1f')](_0x1e60b1)[_0xf0ad('0x30')](_0x1b6880);};}exports['show']=function(_0x1a1e1c,_0x5f5115){var _0x83f211={'raw':![],'where':{'id':_0x1a1e1c[_0xf0ad('0x31')]['id']}},_0x57a1f3={};_0x57a1f3[_0xf0ad('0x32')]=_[_0xf0ad('0x33')](db[_0xf0ad('0x34')][_0xf0ad('0x35')]);_0x57a1f3[_0xf0ad('0x36')]=_[_0xf0ad('0x33')](_0x1a1e1c[_0xf0ad('0x36')]);_0x57a1f3['filters']=_['intersection'](_0x57a1f3[_0xf0ad('0x32')],_0x57a1f3[_0xf0ad('0x36')]);_0x83f211[_0xf0ad('0x37')]=_[_0xf0ad('0x38')](_0x57a1f3['model'],qs[_0xf0ad('0x39')](_0x1a1e1c['query'][_0xf0ad('0x39')]));_0x83f211['attributes']=_0x83f211[_0xf0ad('0x37')]['length']?_0x83f211[_0xf0ad('0x37')]:_0x57a1f3[_0xf0ad('0x32')];if(_0x1a1e1c[_0xf0ad('0x36')][_0xf0ad('0x3a')]){_0x83f211[_0xf0ad('0x3b')]=[{'all':!![]}];}_0x83f211=_[_0xf0ad('0x3c')]({},_0x83f211,_0x1a1e1c[_0xf0ad('0x3d')]);return db[_0xf0ad('0x34')]['find'](_0x83f211)[_0xf0ad('0x2b')](handleEntityNotFound(_0x5f5115,null))['then'](respondWithResult(_0x5f5115,null))[_0xf0ad('0x3e')](handleError(_0x5f5115,null));};exports['destroy']=function(_0x3f7e2b,_0x25246b){return db[_0xf0ad('0x34')][_0xf0ad('0x3f')]({'where':{'id':_0x3f7e2b[_0xf0ad('0x31')]['id']}})['then'](handleEntityNotFound(_0x25246b,null))[_0xf0ad('0x2b')](removeEntity(_0x25246b,null))[_0xf0ad('0x3e')](handleError(_0x25246b,null));};function widgetAttributes(_0x1d57d1){try{switch(_0x1d57d1[_0xf0ad('0x40')]){case _0xf0ad('0x41'):return[{'name':_0xf0ad('0x42'),'value':_0x1d57d1[_0xf0ad('0x42')]||(_0x1d57d1['attrs']&&_0x1d57d1[_0xf0ad('0x43')][0x0]?_0x1d57d1[_0xf0ad('0x43')][0x0][_0xf0ad('0x44')]:undefined)||_0xf0ad('0x45')}];case _0xf0ad('0x46'):return[{'name':_0xf0ad('0x47'),'value':_0x1d57d1[_0xf0ad('0x47')]||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1[_0xf0ad('0x43')][0x0]?_0x1d57d1['attrs'][0x0][_0xf0ad('0x44')]:undefined)||''}];case _0xf0ad('0x48'):return[{'name':_0xf0ad('0x49'),'value':_0x1d57d1['attrHourFormat']||(_0x1d57d1['attrs']&&_0x1d57d1['attrs'][0x0]?_0x1d57d1[_0xf0ad('0x43')][0x0][_0xf0ad('0x44')]:undefined)||_0xf0ad('0x4a')},{'name':_0xf0ad('0x4b'),'value':_0x1d57d1[_0xf0ad('0x4b')]||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1[_0xf0ad('0x43')][0x1]?_0x1d57d1[_0xf0ad('0x43')][0x1][_0xf0ad('0x44')]:undefined)||_0xf0ad('0x4c')},{'name':_0xf0ad('0x4d'),'value':_0x1d57d1['attrFontSize']||(_0x1d57d1['attrs']&&_0x1d57d1['attrs'][0x2]?_0x1d57d1[_0xf0ad('0x43')][0x2][_0xf0ad('0x44')]:undefined)||0xc}];case'counter':return[{'name':_0xf0ad('0x4e'),'value':_0x1d57d1[_0xf0ad('0x4e')]||(_0x1d57d1['attrs']&&_0x1d57d1[_0xf0ad('0x43')][0x0]?_0x1d57d1[_0xf0ad('0x43')][0x0][_0xf0ad('0x44')]:undefined)||_0xf0ad('0x4f')},{'name':'attrVoiceQueues','value':_0x1d57d1[_0xf0ad('0x50')]||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1[_0xf0ad('0x43')][0x1]?_0x1d57d1[_0xf0ad('0x43')][0x1][_0xf0ad('0x44')]:undefined)||[]},{'name':_0xf0ad('0x4d'),'value':_0x1d57d1[_0xf0ad('0x4d')]||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1[_0xf0ad('0x43')][0x2]?_0x1d57d1[_0xf0ad('0x43')][0x2][_0xf0ad('0x44')]:undefined)||0x14},{'name':'attrChannel','value':_0x1d57d1[_0xf0ad('0x51')]||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1[_0xf0ad('0x43')][0x3]?_0x1d57d1['attrs'][0x3]['value']:undefined)||_0xf0ad('0x52')},{'name':_0xf0ad('0x53'),'value':_0x1d57d1[_0xf0ad('0x53')]||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1[_0xf0ad('0x43')][0x4]?_0x1d57d1[_0xf0ad('0x43')][0x4][_0xf0ad('0x44')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x1d57d1[_0xf0ad('0x54')]||(_0x1d57d1['attrs']&&_0x1d57d1[_0xf0ad('0x43')][0x5]?_0x1d57d1[_0xf0ad('0x43')][0x5][_0xf0ad('0x44')]:undefined)||''},{'name':_0xf0ad('0x55'),'value':_0x1d57d1[_0xf0ad('0x55')]||(_0x1d57d1['attrs']&&_0x1d57d1['attrs'][0x6]?_0x1d57d1[_0xf0ad('0x43')][0x6][_0xf0ad('0x44')]:undefined)||''},{'name':_0xf0ad('0x56'),'value':_0x1d57d1[_0xf0ad('0x56')]||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1[_0xf0ad('0x43')][0x7]?_0x1d57d1[_0xf0ad('0x43')][0x7]['value']:undefined)||''},{'name':_0xf0ad('0x57'),'value':_0x1d57d1[_0xf0ad('0x57')]||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1[_0xf0ad('0x43')][0x8]?_0x1d57d1[_0xf0ad('0x43')][0x8]['value']:undefined)||''},{'name':_0xf0ad('0x58'),'value':_0x1d57d1[_0xf0ad('0x58')]||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1[_0xf0ad('0x43')][0x9]?_0x1d57d1[_0xf0ad('0x43')][0x9][_0xf0ad('0x44')]:undefined)||''}];case _0xf0ad('0x59'):case'pie-chart':return[{'name':_0xf0ad('0x5a'),'value':_0x1d57d1[_0xf0ad('0x5a')]||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1['attrs'][0x0]?_0x1d57d1[_0xf0ad('0x43')][0x0][_0xf0ad('0x44')]:undefined)||_0xf0ad('0x4f')},{'name':_0xf0ad('0x5b'),'value':_0x1d57d1[_0xf0ad('0x5b')]||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1[_0xf0ad('0x43')][0x1]?_0x1d57d1[_0xf0ad('0x43')][0x1][_0xf0ad('0x44')]:undefined)||null},{'name':_0xf0ad('0x5c'),'value':_0x1d57d1[_0xf0ad('0x5c')]||(_0x1d57d1['attrs']&&_0x1d57d1['attrs'][0x2]?_0x1d57d1[_0xf0ad('0x43')][0x2][_0xf0ad('0x44')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x1d57d1[_0xf0ad('0x50')]||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1['attrs'][0x3]?_0x1d57d1['attrs'][0x3][_0xf0ad('0x44')]:undefined)||[]},{'name':'attrChannel','value':_0x1d57d1['attrChannel']||(_0x1d57d1['attrs']&&_0x1d57d1[_0xf0ad('0x43')][0x4]?_0x1d57d1['attrs'][0x4]['value']:undefined)||_0xf0ad('0x52')},{'name':_0xf0ad('0x53'),'value':_0x1d57d1[_0xf0ad('0x53')]||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1[_0xf0ad('0x43')][0x5]?_0x1d57d1[_0xf0ad('0x43')][0x5][_0xf0ad('0x44')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x1d57d1[_0xf0ad('0x54')]||(_0x1d57d1['attrs']&&_0x1d57d1['attrs'][0x6]?_0x1d57d1['attrs'][0x6]['value']:undefined)||''},{'name':_0xf0ad('0x55'),'value':_0x1d57d1[_0xf0ad('0x55')]||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1[_0xf0ad('0x43')][0x7]?_0x1d57d1[_0xf0ad('0x43')][0x7][_0xf0ad('0x44')]:undefined)||''},{'name':_0xf0ad('0x56'),'value':_0x1d57d1[_0xf0ad('0x56')]||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1[_0xf0ad('0x43')][0x8]?_0x1d57d1[_0xf0ad('0x43')][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x1d57d1[_0xf0ad('0x57')]||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1['attrs'][0x9]?_0x1d57d1[_0xf0ad('0x43')][0x9][_0xf0ad('0x44')]:undefined)||''},{'name':'attrChatWebsites','value':_0x1d57d1[_0xf0ad('0x58')]||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1[_0xf0ad('0x43')][0xa]?_0x1d57d1['attrs'][0xa][_0xf0ad('0x44')]:undefined)||''}];case _0xf0ad('0x5d'):return[{'name':_0xf0ad('0x5e'),'type':_0x1d57d1[_0xf0ad('0x5f')]||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1[_0xf0ad('0x43')][0x0]?_0x1d57d1[_0xf0ad('0x43')][0x0][_0xf0ad('0x40')]:undefined)||null,'value':_0x1d57d1['attrReport']||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1['attrs'][0x0]?_0x1d57d1[_0xf0ad('0x43')][0x0][_0xf0ad('0x44')]:undefined)||null},{'name':_0xf0ad('0x60'),'value':_0x1d57d1['attrRefresh']||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1['attrs'][0x1]?_0x1d57d1[_0xf0ad('0x43')][0x1][_0xf0ad('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x3b2e92){logger[_0xf0ad('0x2d')](_0xf0ad('0x61'),JSON[_0xf0ad('0x62')](_0x3b2e92));return[];}}exports[_0xf0ad('0x63')]=function(_0x53d8e0,_0x1ea760){if(_0x53d8e0[_0xf0ad('0x64')]){_0x53d8e0['body'][_0xf0ad('0x43')]=widgetAttributes(_0x53d8e0[_0xf0ad('0x64')]);}return db[_0xf0ad('0x34')][_0xf0ad('0x63')](_0x53d8e0[_0xf0ad('0x64')],{})[_0xf0ad('0x2b')](respondWithResult(_0x1ea760,0xc9))[_0xf0ad('0x3e')](handleError(_0x1ea760,null));};exports[_0xf0ad('0x2a')]=function(_0x8e1333,_0x3b56d3){if(_0x8e1333[_0xf0ad('0x64')]['id']){delete _0x8e1333[_0xf0ad('0x64')]['id'];}_0x8e1333[_0xf0ad('0x64')]['attrs']=widgetAttributes(_0x8e1333[_0xf0ad('0x64')]);return db[_0xf0ad('0x34')][_0xf0ad('0x3f')]({'where':{'id':_0x8e1333[_0xf0ad('0x31')]['id']}})['then'](handleEntityNotFound(_0x3b56d3,null))[_0xf0ad('0x2b')](saveUpdates(_0x8e1333[_0xf0ad('0x64')],null))[_0xf0ad('0x2b')](respondWithResult(_0x3b56d3,null))['catch'](handleError(_0x3b56d3,null));}; \ No newline at end of file +var _0x5a43=['Content-Range','reject','save','update','destroy','then','error','stack','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','find','catch','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','type','attrRefresh','body','create','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./dashboardItem.socket','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x1d2ac9,_0x3f0ebf){var _0x43b829=function(_0x49db97){while(--_0x49db97){_0x1d2ac9['push'](_0x1d2ac9['shift']());}};_0x43b829(++_0x3f0ebf);}(_0x5a43,0xf1));var _0x35a4=function(_0x33ee93,_0x1569a7){_0x33ee93=_0x33ee93-0x0;var _0x2e94d1=_0x5a43[_0x33ee93];return _0x2e94d1;};'use strict';var emlformat=require(_0x35a4('0x0'));var rimraf=require(_0x35a4('0x1'));var zipdir=require(_0x35a4('0x2'));var jsonpatch=require(_0x35a4('0x3'));var rp=require(_0x35a4('0x4'));var moment=require(_0x35a4('0x5'));var BPromise=require(_0x35a4('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x35a4('0x7'));var ejs=require(_0x35a4('0x8'));var fs=require('fs');var fs_extra=require(_0x35a4('0x9'));var _=require(_0x35a4('0xa'));var squel=require(_0x35a4('0xb'));var crypto=require(_0x35a4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x35a4('0xd'));var toCsv=require(_0x35a4('0x7'));var querystring=require(_0x35a4('0xe'));var Papa=require(_0x35a4('0xf'));var Redis=require(_0x35a4('0x10'));var authService=require(_0x35a4('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x35a4('0x12'))('api');var utils=require(_0x35a4('0x13'));var config=require(_0x35a4('0x14'));var licenseUtil=require(_0x35a4('0x15'));var db=require('../../mysqldb')['db'];config[_0x35a4('0x16')]=_[_0x35a4('0x17')](config[_0x35a4('0x16')],{'host':_0x35a4('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x35a4('0x16')]));require(_0x35a4('0x19'))['register'](socket);function respondWithStatusCode(_0x417c52,_0x5dd749){_0x5dd749=_0x5dd749||0xcc;return function(_0x376cb0){if(_0x376cb0){return _0x417c52[_0x35a4('0x1a')](_0x5dd749);}return _0x417c52[_0x35a4('0x1b')](_0x5dd749)[_0x35a4('0x1c')]();};}function respondWithResult(_0x2609a7,_0x17601e){_0x17601e=_0x17601e||0xc8;return function(_0x4111b7){if(_0x4111b7){return _0x2609a7[_0x35a4('0x1b')](_0x17601e)[_0x35a4('0x1d')](_0x4111b7);}};}function respondWithFilteredResult(_0x4b214e,_0x476c00){return function(_0x41b56c){if(_0x41b56c){var _0x199ef3=typeof _0x476c00[_0x35a4('0x1e')]===_0x35a4('0x1f')&&typeof _0x476c00[_0x35a4('0x20')]===_0x35a4('0x1f');var _0x3e29ba=_0x41b56c['count'];var _0x15113f=_0x199ef3?0x0:_0x476c00['offset'];var _0x4dcdb2=_0x199ef3?_0x41b56c[_0x35a4('0x21')]:_0x476c00[_0x35a4('0x1e')]+_0x476c00[_0x35a4('0x20')];var _0x4a39ed;if(_0x4dcdb2>=_0x3e29ba){_0x4dcdb2=_0x3e29ba;_0x4a39ed=0xc8;}else{_0x4a39ed=0xce;}_0x4b214e[_0x35a4('0x1b')](_0x4a39ed);return _0x4b214e[_0x35a4('0x22')](_0x35a4('0x23'),_0x15113f+'-'+_0x4dcdb2+'/'+_0x3e29ba)['json'](_0x41b56c);}return null;};}function patchUpdates(_0xa1130){return function(_0xdf703c){try{jsonpatch['apply'](_0xdf703c,_0xa1130,!![]);}catch(_0x13fc5a){return BPromise[_0x35a4('0x24')](_0x13fc5a);}return _0xdf703c[_0x35a4('0x25')]();};}function saveUpdates(_0x2af3ff,_0x4d9983){return function(_0x55ad4d){if(_0x55ad4d){return _0x55ad4d[_0x35a4('0x26')](_0x2af3ff)['then'](function(_0x469728){return _0x469728;});}return null;};}function removeEntity(_0x311428,_0x1d0cfc){return function(_0x3d80e4){if(_0x3d80e4){return _0x3d80e4[_0x35a4('0x27')]()[_0x35a4('0x28')](function(){_0x311428['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x56456e,_0x34bdf6){return function(_0x69b73e){if(!_0x69b73e){_0x56456e['sendStatus'](0x194);}return _0x69b73e;};}function handleError(_0x490002,_0x7d2c5){_0x7d2c5=_0x7d2c5||0x1f4;return function(_0x410aa9){logger[_0x35a4('0x29')](_0x410aa9[_0x35a4('0x2a')]);if(_0x410aa9['name']){delete _0x410aa9['name'];}_0x490002['status'](_0x7d2c5)['send'](_0x410aa9);};}exports[_0x35a4('0x2b')]=function(_0x427f3e,_0x3ce259){var _0x1da508={'raw':![],'where':{'id':_0x427f3e[_0x35a4('0x2c')]['id']}},_0x2e1985={};_0x2e1985[_0x35a4('0x2d')]=_[_0x35a4('0x2e')](db[_0x35a4('0x2f')][_0x35a4('0x30')]);_0x2e1985[_0x35a4('0x31')]=_[_0x35a4('0x2e')](_0x427f3e[_0x35a4('0x31')]);_0x2e1985[_0x35a4('0x32')]=_[_0x35a4('0x33')](_0x2e1985[_0x35a4('0x2d')],_0x2e1985['query']);_0x1da508[_0x35a4('0x34')]=_[_0x35a4('0x33')](_0x2e1985[_0x35a4('0x2d')],qs['fields'](_0x427f3e[_0x35a4('0x31')][_0x35a4('0x35')]));_0x1da508[_0x35a4('0x34')]=_0x1da508['attributes']['length']?_0x1da508[_0x35a4('0x34')]:_0x2e1985['model'];if(_0x427f3e[_0x35a4('0x31')][_0x35a4('0x36')]){_0x1da508[_0x35a4('0x37')]=[{'all':!![]}];}_0x1da508=_['merge']({},_0x1da508,_0x427f3e['options']);return db[_0x35a4('0x2f')][_0x35a4('0x38')](_0x1da508)[_0x35a4('0x28')](handleEntityNotFound(_0x3ce259,null))[_0x35a4('0x28')](respondWithResult(_0x3ce259,null))[_0x35a4('0x39')](handleError(_0x3ce259,null));};exports[_0x35a4('0x27')]=function(_0x35161,_0x368330){return db['DashboardItem']['find']({'where':{'id':_0x35161[_0x35a4('0x2c')]['id']}})[_0x35a4('0x28')](handleEntityNotFound(_0x368330,null))[_0x35a4('0x28')](removeEntity(_0x368330,null))[_0x35a4('0x39')](handleError(_0x368330,null));};function widgetAttributes(_0xba030a){try{switch(_0xba030a['type']){case _0x35a4('0x3a'):return[{'name':'attrUrl','value':_0xba030a[_0x35a4('0x3b')]||(_0xba030a['attrs']&&_0xba030a[_0x35a4('0x3c')][0x0]?_0xba030a[_0x35a4('0x3c')][0x0][_0x35a4('0x3d')]:undefined)||_0x35a4('0x3e')}];case _0x35a4('0x3f'):return[{'name':_0x35a4('0x40'),'value':_0xba030a['attrPath']||(_0xba030a[_0x35a4('0x3c')]&&_0xba030a[_0x35a4('0x3c')][0x0]?_0xba030a[_0x35a4('0x3c')][0x0][_0x35a4('0x3d')]:undefined)||''}];case _0x35a4('0x41'):return[{'name':_0x35a4('0x42'),'value':_0xba030a[_0x35a4('0x42')]||(_0xba030a[_0x35a4('0x3c')]&&_0xba030a[_0x35a4('0x3c')][0x0]?_0xba030a[_0x35a4('0x3c')][0x0][_0x35a4('0x3d')]:undefined)||_0x35a4('0x43')},{'name':'attrTimezone','value':_0xba030a[_0x35a4('0x44')]||(_0xba030a['attrs']&&_0xba030a[_0x35a4('0x3c')][0x1]?_0xba030a[_0x35a4('0x3c')][0x1][_0x35a4('0x3d')]:undefined)||_0x35a4('0x45')},{'name':_0x35a4('0x46'),'value':_0xba030a[_0x35a4('0x46')]||(_0xba030a[_0x35a4('0x3c')]&&_0xba030a[_0x35a4('0x3c')][0x2]?_0xba030a[_0x35a4('0x3c')][0x2][_0x35a4('0x3d')]:undefined)||0xc}];case'counter':return[{'name':_0x35a4('0x47'),'value':_0xba030a[_0x35a4('0x47')]||(_0xba030a[_0x35a4('0x3c')]&&_0xba030a[_0x35a4('0x3c')][0x0]?_0xba030a[_0x35a4('0x3c')][0x0][_0x35a4('0x3d')]:undefined)||_0x35a4('0x48')},{'name':'attrVoiceQueues','value':_0xba030a[_0x35a4('0x49')]||(_0xba030a[_0x35a4('0x3c')]&&_0xba030a[_0x35a4('0x3c')][0x1]?_0xba030a['attrs'][0x1][_0x35a4('0x3d')]:undefined)||[]},{'name':_0x35a4('0x46'),'value':_0xba030a[_0x35a4('0x46')]||(_0xba030a[_0x35a4('0x3c')]&&_0xba030a[_0x35a4('0x3c')][0x2]?_0xba030a[_0x35a4('0x3c')][0x2][_0x35a4('0x3d')]:undefined)||0x14},{'name':'attrChannel','value':_0xba030a[_0x35a4('0x4a')]||(_0xba030a['attrs']&&_0xba030a[_0x35a4('0x3c')][0x3]?_0xba030a[_0x35a4('0x3c')][0x3][_0x35a4('0x3d')]:undefined)||_0x35a4('0x4b')},{'name':'attrEmailAccounts','value':_0xba030a[_0x35a4('0x4c')]||(_0xba030a[_0x35a4('0x3c')]&&_0xba030a[_0x35a4('0x3c')][0x4]?_0xba030a[_0x35a4('0x3c')][0x4][_0x35a4('0x3d')]:undefined)||''},{'name':_0x35a4('0x4d'),'value':_0xba030a[_0x35a4('0x4d')]||(_0xba030a[_0x35a4('0x3c')]&&_0xba030a[_0x35a4('0x3c')][0x5]?_0xba030a['attrs'][0x5][_0x35a4('0x3d')]:undefined)||''},{'name':_0x35a4('0x4e'),'value':_0xba030a['attrSmsAccounts']||(_0xba030a[_0x35a4('0x3c')]&&_0xba030a[_0x35a4('0x3c')][0x6]?_0xba030a[_0x35a4('0x3c')][0x6][_0x35a4('0x3d')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0xba030a[_0x35a4('0x4f')]||(_0xba030a[_0x35a4('0x3c')]&&_0xba030a[_0x35a4('0x3c')][0x7]?_0xba030a['attrs'][0x7][_0x35a4('0x3d')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0xba030a[_0x35a4('0x50')]||(_0xba030a[_0x35a4('0x3c')]&&_0xba030a['attrs'][0x8]?_0xba030a[_0x35a4('0x3c')][0x8]['value']:undefined)||''},{'name':_0x35a4('0x51'),'value':_0xba030a['attrChatWebsites']||(_0xba030a[_0x35a4('0x3c')]&&_0xba030a[_0x35a4('0x3c')][0x9]?_0xba030a[_0x35a4('0x3c')][0x9][_0x35a4('0x3d')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':_0x35a4('0x52'),'value':_0xba030a[_0x35a4('0x52')]||(_0xba030a[_0x35a4('0x3c')]&&_0xba030a[_0x35a4('0x3c')][0x0]?_0xba030a['attrs'][0x0][_0x35a4('0x3d')]:undefined)||_0x35a4('0x48')},{'name':_0x35a4('0x53'),'value':_0xba030a['attrSerie2']||(_0xba030a['attrs']&&_0xba030a[_0x35a4('0x3c')][0x1]?_0xba030a[_0x35a4('0x3c')][0x1]['value']:undefined)||null},{'name':_0x35a4('0x54'),'value':_0xba030a['attrSerie3']||(_0xba030a[_0x35a4('0x3c')]&&_0xba030a[_0x35a4('0x3c')][0x2]?_0xba030a[_0x35a4('0x3c')][0x2][_0x35a4('0x3d')]:undefined)||null},{'name':_0x35a4('0x49'),'value':_0xba030a[_0x35a4('0x49')]||(_0xba030a[_0x35a4('0x3c')]&&_0xba030a[_0x35a4('0x3c')][0x3]?_0xba030a[_0x35a4('0x3c')][0x3][_0x35a4('0x3d')]:undefined)||[]},{'name':_0x35a4('0x4a'),'value':_0xba030a['attrChannel']||(_0xba030a['attrs']&&_0xba030a[_0x35a4('0x3c')][0x4]?_0xba030a[_0x35a4('0x3c')][0x4]['value']:undefined)||_0x35a4('0x4b')},{'name':_0x35a4('0x4c'),'value':_0xba030a[_0x35a4('0x4c')]||(_0xba030a[_0x35a4('0x3c')]&&_0xba030a[_0x35a4('0x3c')][0x5]?_0xba030a[_0x35a4('0x3c')][0x5][_0x35a4('0x3d')]:undefined)||''},{'name':'attrFaxAccounts','value':_0xba030a[_0x35a4('0x4d')]||(_0xba030a[_0x35a4('0x3c')]&&_0xba030a[_0x35a4('0x3c')][0x6]?_0xba030a[_0x35a4('0x3c')][0x6]['value']:undefined)||''},{'name':_0x35a4('0x4e'),'value':_0xba030a[_0x35a4('0x4e')]||(_0xba030a[_0x35a4('0x3c')]&&_0xba030a[_0x35a4('0x3c')][0x7]?_0xba030a['attrs'][0x7][_0x35a4('0x3d')]:undefined)||''},{'name':_0x35a4('0x4f'),'value':_0xba030a[_0x35a4('0x4f')]||(_0xba030a['attrs']&&_0xba030a[_0x35a4('0x3c')][0x8]?_0xba030a[_0x35a4('0x3c')][0x8][_0x35a4('0x3d')]:undefined)||''},{'name':_0x35a4('0x50'),'value':_0xba030a[_0x35a4('0x50')]||(_0xba030a['attrs']&&_0xba030a[_0x35a4('0x3c')][0x9]?_0xba030a[_0x35a4('0x3c')][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0xba030a[_0x35a4('0x51')]||(_0xba030a[_0x35a4('0x3c')]&&_0xba030a[_0x35a4('0x3c')][0xa]?_0xba030a[_0x35a4('0x3c')][0xa]['value']:undefined)||''}];case _0x35a4('0x55'):return[{'name':_0x35a4('0x56'),'type':_0xba030a[_0x35a4('0x57')]||(_0xba030a['attrs']&&_0xba030a['attrs'][0x0]?_0xba030a[_0x35a4('0x3c')][0x0][_0x35a4('0x58')]:undefined)||null,'value':_0xba030a[_0x35a4('0x56')]||(_0xba030a[_0x35a4('0x3c')]&&_0xba030a['attrs'][0x0]?_0xba030a['attrs'][0x0][_0x35a4('0x3d')]:undefined)||null},{'name':_0x35a4('0x59'),'value':_0xba030a[_0x35a4('0x59')]||(_0xba030a['attrs']&&_0xba030a['attrs'][0x1]?_0xba030a[_0x35a4('0x3c')][0x1][_0x35a4('0x3d')]:undefined)||0x0}];default:return[];}}catch(_0x47a6ab){logger[_0x35a4('0x29')]('widgetAttributes:\x20%s',JSON['stringify'](_0x47a6ab));return[];}}exports['create']=function(_0x416812,_0x13759d){if(_0x416812[_0x35a4('0x5a')]){_0x416812[_0x35a4('0x5a')]['attrs']=widgetAttributes(_0x416812[_0x35a4('0x5a')]);}return db['DashboardItem'][_0x35a4('0x5b')](_0x416812['body'],{})[_0x35a4('0x28')](respondWithResult(_0x13759d,0xc9))['catch'](handleError(_0x13759d,null));};exports[_0x35a4('0x26')]=function(_0x13e652,_0x48c6f2){if(_0x13e652[_0x35a4('0x5a')]['id']){delete _0x13e652[_0x35a4('0x5a')]['id'];}_0x13e652['body'][_0x35a4('0x3c')]=widgetAttributes(_0x13e652['body']);return db[_0x35a4('0x2f')][_0x35a4('0x38')]({'where':{'id':_0x13e652[_0x35a4('0x2c')]['id']}})['then'](handleEntityNotFound(_0x48c6f2,null))[_0x35a4('0x28')](saveUpdates(_0x13e652[_0x35a4('0x5a')],null))[_0x35a4('0x28')](respondWithResult(_0x48c6f2,null))['catch'](handleError(_0x48c6f2,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 73ffa0d..c485980 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 _0xe35d=['setMaxListeners','save','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe35d,0xbe));var _0xde35=function(_0x1bc4cc,_0x4e47c2){_0x1bc4cc=_0x1bc4cc-0x0;var _0x7c6009=_0xe35d[_0x1bc4cc];return _0x7c6009;};'use strict';var EventEmitter=require(_0xde35('0x0'));var DashboardItem=require(_0xde35('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xde35('0x2')](0x0);var events={'afterCreate':_0xde35('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4ae282){return function(_0xab808f,_0x1920f0,_0x452949){DashboardItemEvents[_0xde35('0x4')](_0x4ae282+':'+_0xab808f['id'],_0xab808f);DashboardItemEvents[_0xde35('0x4')](_0x4ae282,_0xab808f);_0x452949(null);};}for(var e in events){if(events[_0xde35('0x5')](e)){var event=events[e];DashboardItem[_0xde35('0x6')](e,emitEvent(event));}}module[_0xde35('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0x7939=['emit','hasOwnProperty','hook','DashboardItem','update','remove'];(function(_0x5ade89,_0x2a90b0){var _0x272f1f=function(_0x571f9a){while(--_0x571f9a){_0x5ade89['push'](_0x5ade89['shift']());}};_0x272f1f(++_0x2a90b0);}(_0x7939,0x117));var _0x9793=function(_0x40ccb3,_0xbbd8de){_0x40ccb3=_0x40ccb3-0x0;var _0x490835=_0x7939[_0x40ccb3];return _0x490835;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db'][_0x9793('0x0')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9793('0x1'),'afterDestroy':_0x9793('0x2')};function emitEvent(_0xbd52f4){return function(_0x342812,_0x25f835,_0x82cc14){DashboardItemEvents[_0x9793('0x3')](_0xbd52f4+':'+_0x342812['id'],_0x342812);DashboardItemEvents['emit'](_0xbd52f4,_0x342812);_0x82cc14(null);};}for(var e in events){if(events[_0x9793('0x4')](e)){var event=events[e];DashboardItem[_0x9793('0x5')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 84d1f9a..d904ff0 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 _0x9221=['dashboard_items','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','DashboardItem'];(function(_0x6b113f,_0x5edb4d){var _0x73ccd=function(_0x452d89){while(--_0x452d89){_0x6b113f['push'](_0x6b113f['shift']());}};_0x73ccd(++_0x5edb4d);}(_0x9221,0x64));var _0x1922=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x9221[_0x4a3898];return _0x25ceb0;};'use strict';var _=require('lodash');var util=require(_0x1922('0x0'));var logger=require(_0x1922('0x1'))('api');var moment=require(_0x1922('0x2'));var BPromise=require(_0x1922('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1922('0x4'));var rimraf=require(_0x1922('0x5'));var config=require(_0x1922('0x6'));var attributes=require(_0x1922('0x7'));module[_0x1922('0x8')]=function(_0x1944a5,_0x1351a0){return _0x1944a5['define'](_0x1922('0x9'),attributes,{'tableName':_0x1922('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a47=['./dashboardItem.attributes','dashboard_items','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x3a249c,_0x30bff6){var _0x339212=function(_0x3f1a8a){while(--_0x3f1a8a){_0x3a249c['push'](_0x3a249c['shift']());}};_0x339212(++_0x30bff6);}(_0x8a47,0x17e));var _0x78a4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8a47[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x78a4('0x0'));var util=require(_0x78a4('0x1'));var logger=require(_0x78a4('0x2'))(_0x78a4('0x3'));var moment=require('moment');var BPromise=require(_0x78a4('0x4'));var rp=require(_0x78a4('0x5'));var fs=require('fs');var path=require(_0x78a4('0x6'));var rimraf=require(_0x78a4('0x7'));var config=require('../../config/environment');var attributes=require(_0x78a4('0x8'));module['exports']=function(_0x4184fc,_0x2d7ec3){return _0x4184fc['define']('DashboardItem',attributes,{'tableName':_0x78a4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index b5f7e61..56ec581 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 _0x30c1=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','./dashboardItem.socket','request','then','info','request\x20sent','debug','error','code','DashboardItem,\x20%s,\x20%s','message','catch'];(function(_0x3cb6dc,_0x120dd3){var _0x47ec89=function(_0x55150a){while(--_0x55150a){_0x3cb6dc['push'](_0x3cb6dc['shift']());}};_0x47ec89(++_0x120dd3);}(_0x30c1,0x187));var _0x130c=function(_0x457a2e,_0x5b06e0){_0x457a2e=_0x457a2e-0x0;var _0x1c3b03=_0x30c1[_0x457a2e];return _0x1c3b03;};'use strict';var _=require('lodash');var util=require(_0x130c('0x0'));var moment=require(_0x130c('0x1'));var BPromise=require(_0x130c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x130c('0x3'));var db=require(_0x130c('0x4'))['db'];var utils=require(_0x130c('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x130c('0x6'));var jayson=require(_0x130c('0x7'));var client=jayson[_0x130c('0x8')][_0x130c('0x9')]({'port':0x232a});config[_0x130c('0xa')]=_[_0x130c('0xb')](config[_0x130c('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x130c('0xa')]));require(_0x130c('0xc'))['register'](socket);function respondWithRpcPromise(_0x1009ea,_0x32e4e5,_0x2f7c67){return new BPromise(function(_0x45a921,_0x12d8a3){return client[_0x130c('0xd')](_0x1009ea,_0x2f7c67)[_0x130c('0xe')](function(_0x2bd65a){logger[_0x130c('0xf')]('DashboardItem,\x20%s,\x20%s',_0x32e4e5,_0x130c('0x10'));logger[_0x130c('0x11')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x32e4e5,'request\x20sent',JSON['stringify'](_0x2bd65a));if(_0x2bd65a['error']){if(_0x2bd65a[_0x130c('0x12')][_0x130c('0x13')]===0x1f4){logger[_0x130c('0x12')](_0x130c('0x14'),_0x32e4e5,_0x2bd65a[_0x130c('0x12')][_0x130c('0x15')]);return _0x12d8a3(_0x2bd65a[_0x130c('0x12')]['message']);}logger[_0x130c('0x12')](_0x130c('0x14'),_0x32e4e5,_0x2bd65a[_0x130c('0x12')][_0x130c('0x15')]);return _0x45a921(_0x2bd65a[_0x130c('0x12')][_0x130c('0x15')]);}else{logger[_0x130c('0xf')](_0x130c('0x14'),_0x32e4e5,'request\x20sent');_0x45a921(_0x2bd65a['result']['message']);}})[_0x130c('0x16')](function(_0x5eca9b){logger['error']('DashboardItem,\x20%s,\x20%s',_0x32e4e5,_0x5eca9b);_0x12d8a3(_0x5eca9b);});});} \ No newline at end of file +var _0x6efe=['stringify','code','error','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','redis','localhost','./dashboardItem.socket','register','request','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x57eb89,_0x33851a){var _0x2b7f3a=function(_0x3e3e81){while(--_0x3e3e81){_0x57eb89['push'](_0x57eb89['shift']());}};_0x2b7f3a(++_0x33851a);}(_0x6efe,0x6a));var _0xe6ef=function(_0x18b61f,_0x4f46e1){_0x18b61f=_0x18b61f-0x0;var _0x18fe78=_0x6efe[_0x18b61f];return _0x18fe78;};'use strict';var _=require(_0xe6ef('0x0'));var util=require(_0xe6ef('0x1'));var moment=require(_0xe6ef('0x2'));var BPromise=require(_0xe6ef('0x3'));var rs=require(_0xe6ef('0x4'));var fs=require('fs');var Redis=require(_0xe6ef('0x5'));var db=require(_0xe6ef('0x6'))['db'];var utils=require(_0xe6ef('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xe6ef('0x8'));var jayson=require(_0xe6ef('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xe6ef('0xa')]=_['defaults'](config[_0xe6ef('0xa')],{'host':_0xe6ef('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe6ef('0xa')]));require(_0xe6ef('0xc'))[_0xe6ef('0xd')](socket);function respondWithRpcPromise(_0x45a5ac,_0x2bf01c,_0x20e8d0){return new BPromise(function(_0x2cf32e,_0x2749c3){return client[_0xe6ef('0xe')](_0x45a5ac,_0x20e8d0)['then'](function(_0x123c7f){logger['info'](_0xe6ef('0xf'),_0x2bf01c,'request\x20sent');logger[_0xe6ef('0x10')](_0xe6ef('0x11'),_0x2bf01c,_0xe6ef('0x12'),JSON[_0xe6ef('0x13')](_0x123c7f));if(_0x123c7f['error']){if(_0x123c7f['error'][_0xe6ef('0x14')]===0x1f4){logger['error'](_0xe6ef('0xf'),_0x2bf01c,_0x123c7f[_0xe6ef('0x15')][_0xe6ef('0x16')]);return _0x2749c3(_0x123c7f[_0xe6ef('0x15')][_0xe6ef('0x16')]);}logger['error'](_0xe6ef('0xf'),_0x2bf01c,_0x123c7f[_0xe6ef('0x15')][_0xe6ef('0x16')]);return _0x2cf32e(_0x123c7f[_0xe6ef('0x15')][_0xe6ef('0x16')]);}else{logger[_0xe6ef('0x17')](_0xe6ef('0xf'),_0x2bf01c,'request\x20sent');_0x2cf32e(_0x123c7f['result'][_0xe6ef('0x16')]);}})[_0xe6ef('0x18')](function(_0x897bdf){logger[_0xe6ef('0x15')](_0xe6ef('0xf'),_0x2bf01c,_0x897bdf);_0x2749c3(_0x897bdf);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 16ffe0a..d6b35b6 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 _0xc02e=['save','removeListener','length','dashboardItem:','./dashboardItem.events'];(function(_0x216799,_0x44b817){var _0x3661c3=function(_0x28f85e){while(--_0x28f85e){_0x216799['push'](_0x216799['shift']());}};_0x3661c3(++_0x44b817);}(_0xc02e,0xa4));var _0xec02=function(_0x41980e,_0x527b1d){_0x41980e=_0x41980e-0x0;var _0x1428fc=_0xc02e[_0x41980e];return _0x1428fc;};'use strict';var DashboardItemEvents=require(_0xec02('0x0'));var events=[_0xec02('0x1'),'remove','update'];function createListener(_0x217648,_0x125e1a){return function(_0x320f08){_0x125e1a['emit'](_0x217648,_0x320f08);};}function removeListener(_0x3a4f30,_0x3aded5){return function(){DashboardItemEvents[_0xec02('0x2')](_0x3a4f30,_0x3aded5);};}exports['register']=function(_0x1663dd){for(var _0x1c2b1c=0x0,_0x24d2b4=events[_0xec02('0x3')];_0x1c2b1c<_0x24d2b4;_0x1c2b1c++){var _0x20852c=events[_0x1c2b1c];var _0x39c46b=createListener(_0xec02('0x4')+_0x20852c,_0x1663dd);DashboardItemEvents['on'](_0x20852c,_0x39c46b);}}; \ No newline at end of file +var _0xd2d2=['update','emit','removeListener','register','dashboardItem:','./dashboardItem.events','save','remove'];(function(_0x459a0a,_0x25c46f){var _0x4ab46c=function(_0x451a6a){while(--_0x451a6a){_0x459a0a['push'](_0x459a0a['shift']());}};_0x4ab46c(++_0x25c46f);}(_0xd2d2,0x85));var _0x2d2d=function(_0x24a34b,_0x16a721){_0x24a34b=_0x24a34b-0x0;var _0x3fdd98=_0xd2d2[_0x24a34b];return _0x3fdd98;};'use strict';var DashboardItemEvents=require(_0x2d2d('0x0'));var events=[_0x2d2d('0x1'),_0x2d2d('0x2'),_0x2d2d('0x3')];function createListener(_0x53ae44,_0x2df46c){return function(_0x3fa3ea){_0x2df46c[_0x2d2d('0x4')](_0x53ae44,_0x3fa3ea);};}function removeListener(_0x310ab8,_0x2efff6){return function(){DashboardItemEvents[_0x2d2d('0x5')](_0x310ab8,_0x2efff6);};}exports[_0x2d2d('0x6')]=function(_0x3ca144){for(var _0x25729c=0x0,_0x4cc54f=events['length'];_0x25729c<_0x4cc54f;_0x25729c++){var _0x520bb8=events[_0x25729c];var _0x3dc915=createListener(_0x2d2d('0x7')+_0x520bb8,_0x3ca144);DashboardItemEvents['on'](_0x520bb8,_0x3dc915);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index ec38dc6..a637b5d 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 _0x272a=['show','isAuthenticated','create','put','/:id','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','./dashboardItem.controller','get'];(function(_0x2a3844,_0x27530d){var _0x3c725b=function(_0x59ab36){while(--_0x59ab36){_0x2a3844['push'](_0x2a3844['shift']());}};_0x3c725b(++_0x27530d);}(_0x272a,0x129));var _0xa272=function(_0x32af03,_0x4c58bd){_0x32af03=_0x32af03-0x0;var _0x22295=_0x272a[_0x32af03];return _0x22295;};'use strict';var multer=require('multer');var util=require(_0xa272('0x0'));var path=require(_0xa272('0x1'));var timeout=require('connect-timeout');var express=require(_0xa272('0x2'));var router=express[_0xa272('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa272('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa272('0x5'));router[_0xa272('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xa272('0x7')]);router['post']('/',auth[_0xa272('0x8')](),controller[_0xa272('0x9')]);router[_0xa272('0xa')](_0xa272('0xb'),auth[_0xa272('0x8')](),controller[_0xa272('0xc')]);router[_0xa272('0xd')](_0xa272('0xb'),auth['isAuthenticated'](),controller[_0xa272('0xe')]);module[_0xa272('0xf')]=router; \ No newline at end of file +var _0x85d5=['put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','show','create'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x85d5,0xe1));var _0x585d=function(_0x2f227c,_0x2d7f63){_0x2f227c=_0x2f227c-0x0;var _0x386295=_0x85d5[_0x2f227c];return _0x386295;};'use strict';var multer=require(_0x585d('0x0'));var util=require(_0x585d('0x1'));var path=require(_0x585d('0x2'));var timeout=require('connect-timeout');var express=require(_0x585d('0x3'));var router=express[_0x585d('0x4')]();var fs_extra=require(_0x585d('0x5'));var auth=require(_0x585d('0x6'));var interaction=require(_0x585d('0x7'));var config=require('../../config/environment');var controller=require('./dashboardItem.controller');router[_0x585d('0x8')](_0x585d('0x9'),auth[_0x585d('0xa')](),controller[_0x585d('0xb')]);router['post']('/',auth[_0x585d('0xa')](),controller[_0x585d('0xc')]);router[_0x585d('0xd')](_0x585d('0x9'),auth[_0x585d('0xa')](),controller['update']);router[_0x585d('0xe')](_0x585d('0x9'),auth[_0x585d('0xa')](),controller[_0x585d('0xf')]);module[_0x585d('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index f31c31c..925c441 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 _0x9e06=['ENUM','first','second','third','exports','STRING'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x9e06,0x1a2));var _0x69e0=function(_0x1f3839,_0x2ca6cf){_0x1f3839=_0x1f3839-0x0;var _0x3d5183=_0x9e06[_0x1f3839];return _0x3d5183;};'use strict';var Sequelize=require('sequelize');module[_0x69e0('0x0')]={'name':{'type':Sequelize[_0x69e0('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x69e0('0x2')](_0x69e0('0x3'),_0x69e0('0x4'),_0x69e0('0x5')),'allowNull':![],'defaultValue':_0x69e0('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9496=['ENUM','first','third','sequelize','STRING'];(function(_0x550b7b,_0x3d6314){var _0x451b9f=function(_0x156429){while(--_0x156429){_0x550b7b['push'](_0x550b7b['shift']());}};_0x451b9f(++_0x3d6314);}(_0x9496,0xb2));var _0x6949=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x9496[_0x35885a];return _0xe86249;};'use strict';var Sequelize=require(_0x6949('0x0'));module['exports']={'name':{'type':Sequelize[_0x6949('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x6949('0x2')](_0x6949('0x3'),'second',_0x6949('0x4')),'allowNull':![],'defaultValue':_0x6949('0x3')},'description':{'type':Sequelize[_0x6949('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 6cbebcc..06cf682 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 _0xd5a2=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','limit','undefined','offset','set','Content-Range','apply','reject','save','update','then','get','Dispositions','UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','options','count','includeAll','include','rows','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','destroy','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','fs-extra','squel','jsforce','desk.js'];(function(_0x5777e4,_0x44f0e7){var _0x46b773=function(_0x2d5bac){while(--_0x2d5bac){_0x5777e4['push'](_0x5777e4['shift']());}};_0x46b773(++_0x44f0e7);}(_0xd5a2,0x93));var _0x2d5a=function(_0x2cf8c5,_0x224e0c){_0x2cf8c5=_0x2cf8c5-0x0;var _0x1cbd5b=_0xd5a2[_0x2cf8c5];return _0x1cbd5b;};'use strict';var emlformat=require(_0x2d5a('0x0'));var rimraf=require(_0x2d5a('0x1'));var zipdir=require(_0x2d5a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2d5a('0x3'));var BPromise=require(_0x2d5a('0x4'));var Mustache=require(_0x2d5a('0x5'));var util=require(_0x2d5a('0x6'));var path=require(_0x2d5a('0x7'));var sox=require(_0x2d5a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2d5a('0x9'));var _=require('lodash');var squel=require(_0x2d5a('0xa'));var crypto=require('crypto');var jsforce=require(_0x2d5a('0xb'));var deskjs=require(_0x2d5a('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2d5a('0xd'));var authService=require(_0x2d5a('0xe'));var qs=require(_0x2d5a('0xf'));var as=require(_0x2d5a('0x10'));var hardwareService=require(_0x2d5a('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x2d5a('0x12'));var config=require(_0x2d5a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x2d5a('0x14'))['db'];function respondWithStatusCode(_0x322604,_0x3be1b6){_0x3be1b6=_0x3be1b6||0xcc;return function(_0x1f5c6c){if(_0x1f5c6c){return _0x322604[_0x2d5a('0x15')](_0x3be1b6);}return _0x322604[_0x2d5a('0x16')](_0x3be1b6)[_0x2d5a('0x17')]();};}function respondWithResult(_0x5a9b45,_0x5551fe){_0x5551fe=_0x5551fe||0xc8;return function(_0x2ba045){if(_0x2ba045){return _0x5a9b45[_0x2d5a('0x16')](_0x5551fe)['json'](_0x2ba045);}};}function respondWithFilteredResult(_0xcad989,_0x4ab0e0){return function(_0x5b4617){if(_0x5b4617){var _0x4ed804=typeof _0x4ab0e0['offset']==='undefined'&&typeof _0x4ab0e0[_0x2d5a('0x18')]===_0x2d5a('0x19');var _0x210485=_0x5b4617['count'];var _0x36baa8=_0x4ed804?0x0:_0x4ab0e0[_0x2d5a('0x1a')];var _0x41094a=_0x4ed804?_0x5b4617['count']:_0x4ab0e0['offset']+_0x4ab0e0[_0x2d5a('0x18')];var _0x3b7043;if(_0x41094a>=_0x210485){_0x41094a=_0x210485;_0x3b7043=0xc8;}else{_0x3b7043=0xce;}_0xcad989[_0x2d5a('0x16')](_0x3b7043);return _0xcad989[_0x2d5a('0x1b')](_0x2d5a('0x1c'),_0x36baa8+'-'+_0x41094a+'/'+_0x210485)['json'](_0x5b4617);}return null;};}function patchUpdates(_0x25b83a){return function(_0x132aa4){try{jsonpatch[_0x2d5a('0x1d')](_0x132aa4,_0x25b83a,!![]);}catch(_0x2a4624){return BPromise[_0x2d5a('0x1e')](_0x2a4624);}return _0x132aa4[_0x2d5a('0x1f')]();};}function saveUpdates(_0x17980b,_0x38bb6f){return function(_0x4ab9bd){if(_0x4ab9bd){return _0x4ab9bd[_0x2d5a('0x20')](_0x17980b)[_0x2d5a('0x21')](function(_0xe24054){return _0xe24054;});}return null;};}function removeEntity(_0x3625ee,_0x44aa06){return function(_0x4c4f0c){if(_0x4c4f0c){return _0x4c4f0c['destroy']()['then'](function(){var _0x13b64c=_0x4c4f0c[_0x2d5a('0x22')]({'plain':!![]});var _0x4a1a0b=_0x2d5a('0x23');return db[_0x2d5a('0x24')]['destroy']({'where':{'type':_0x4a1a0b,'resourceId':_0x13b64c['id']}})[_0x2d5a('0x21')](function(){return _0x4c4f0c;});})[_0x2d5a('0x21')](function(){_0x3625ee[_0x2d5a('0x16')](0xcc)[_0x2d5a('0x17')]();});}};}function handleEntityNotFound(_0x554024,_0x248d86){return function(_0x40e11f){if(!_0x40e11f){_0x554024[_0x2d5a('0x15')](0x194);}return _0x40e11f;};}function handleError(_0x10f52f,_0x36b1ca){_0x36b1ca=_0x36b1ca||0x1f4;return function(_0x472d63){logger[_0x2d5a('0x25')](_0x472d63[_0x2d5a('0x26')]);if(_0x472d63[_0x2d5a('0x27')]){delete _0x472d63[_0x2d5a('0x27')];}_0x10f52f[_0x2d5a('0x16')](_0x36b1ca)[_0x2d5a('0x28')](_0x472d63);};}exports[_0x2d5a('0x29')]=function(_0x103356,_0x1807f5){var _0xb3dee={},_0x331634={},_0x1fe333={'count':0x0,'rows':[]};var _0x2fc75d=_[_0x2d5a('0x2a')](db[_0x2d5a('0x2b')][_0x2d5a('0x2c')],function(_0x472e2c){return{'name':_0x472e2c[_0x2d5a('0x2d')],'type':_0x472e2c[_0x2d5a('0x2e')][_0x2d5a('0x2f')]};});_0x331634['model']=_['map'](_0x2fc75d,_0x2d5a('0x27'));_0x331634[_0x2d5a('0x30')]=_[_0x2d5a('0x31')](_0x103356[_0x2d5a('0x30')]);_0x331634[_0x2d5a('0x32')]=_[_0x2d5a('0x33')](_0x331634[_0x2d5a('0x34')],_0x331634[_0x2d5a('0x30')]);_0xb3dee[_0x2d5a('0x35')]=_['intersection'](_0x331634['model'],qs[_0x2d5a('0x36')](_0x103356[_0x2d5a('0x30')][_0x2d5a('0x36')]));_0xb3dee[_0x2d5a('0x35')]=_0xb3dee[_0x2d5a('0x35')][_0x2d5a('0x37')]?_0xb3dee['attributes']:_0x331634[_0x2d5a('0x34')];if(!_0x103356[_0x2d5a('0x30')][_0x2d5a('0x38')](_0x2d5a('0x39'))){_0xb3dee[_0x2d5a('0x18')]=qs[_0x2d5a('0x18')](_0x103356[_0x2d5a('0x30')][_0x2d5a('0x18')]);_0xb3dee[_0x2d5a('0x1a')]=qs[_0x2d5a('0x1a')](_0x103356[_0x2d5a('0x30')][_0x2d5a('0x1a')]);}_0xb3dee[_0x2d5a('0x3a')]=qs[_0x2d5a('0x3b')](_0x103356[_0x2d5a('0x30')]['sort']);_0xb3dee['where']=qs[_0x2d5a('0x32')](_['pick'](_0x103356[_0x2d5a('0x30')],_0x331634[_0x2d5a('0x32')]),_0x2fc75d);if(_0x103356['query'][_0x2d5a('0x3c')]){_0xb3dee['where']=_[_0x2d5a('0x3d')](_0xb3dee[_0x2d5a('0x3e')],{'$or':_['map'](_0x2fc75d,function(_0x11142f){if(_0x11142f[_0x2d5a('0x2e')]!=='VIRTUAL'){var _0x53ae8c={};_0x53ae8c[_0x11142f[_0x2d5a('0x27')]]={'$like':'%'+_0x103356[_0x2d5a('0x30')][_0x2d5a('0x3c')]+'%'};return _0x53ae8c;}})});}_0xb3dee=_['merge']({},_0xb3dee,_0x103356[_0x2d5a('0x3f')]);var _0x1715f4={'where':_0xb3dee['where']};return db[_0x2d5a('0x2b')][_0x2d5a('0x40')](_0x1715f4)[_0x2d5a('0x21')](function(_0x3c3702){_0x1fe333['count']=_0x3c3702;if(_0x103356[_0x2d5a('0x30')][_0x2d5a('0x41')]){_0xb3dee[_0x2d5a('0x42')]=[{'all':!![]}];}return db[_0x2d5a('0x2b')]['findAll'](_0xb3dee);})[_0x2d5a('0x21')](function(_0x4bfb9a){_0x1fe333[_0x2d5a('0x43')]=_0x4bfb9a;return _0x1fe333;})[_0x2d5a('0x21')](respondWithFilteredResult(_0x1807f5,_0xb3dee))['catch'](handleError(_0x1807f5,null));};exports['show']=function(_0x2202c3,_0x5ca1e4){var _0xd3304d={'raw':!![],'where':{'id':_0x2202c3['params']['id']}},_0xcb49b3={};_0xcb49b3[_0x2d5a('0x34')]=_[_0x2d5a('0x31')](db[_0x2d5a('0x2b')][_0x2d5a('0x2c')]);_0xcb49b3[_0x2d5a('0x30')]=_['keys'](_0x2202c3[_0x2d5a('0x30')]);_0xcb49b3[_0x2d5a('0x32')]=_[_0x2d5a('0x33')](_0xcb49b3[_0x2d5a('0x34')],_0xcb49b3[_0x2d5a('0x30')]);_0xd3304d[_0x2d5a('0x35')]=_[_0x2d5a('0x33')](_0xcb49b3[_0x2d5a('0x34')],qs[_0x2d5a('0x36')](_0x2202c3['query'][_0x2d5a('0x36')]));_0xd3304d[_0x2d5a('0x35')]=_0xd3304d[_0x2d5a('0x35')][_0x2d5a('0x37')]?_0xd3304d['attributes']:_0xcb49b3[_0x2d5a('0x34')];if(_0x2202c3[_0x2d5a('0x30')][_0x2d5a('0x41')]){_0xd3304d[_0x2d5a('0x42')]=[{'all':!![]}];}_0xd3304d=_[_0x2d5a('0x3d')]({},_0xd3304d,_0x2202c3[_0x2d5a('0x3f')]);return db['Disposition'][_0x2d5a('0x44')](_0xd3304d)['then'](handleEntityNotFound(_0x5ca1e4,null))[_0x2d5a('0x21')](respondWithResult(_0x5ca1e4,null))[_0x2d5a('0x45')](handleError(_0x5ca1e4,null));};exports[_0x2d5a('0x46')]=function(_0x541832,_0x2ab7c2){return db[_0x2d5a('0x2b')]['create'](_0x541832['body'],{})['then'](function(_0x1f5bbb){var _0x141006=_0x541832[_0x2d5a('0x47')]['get']({'plain':!![]});if(!_0x141006)throw new Error(_0x2d5a('0x48'));if(_0x141006[_0x2d5a('0x49')]===_0x2d5a('0x47')){var _0x1bcbe8=_0x1f5bbb[_0x2d5a('0x22')]({'plain':!![]});var _0x5c7365=_0x2d5a('0x23');return db[_0x2d5a('0x4a')]['find']({'where':{'name':_0x5c7365,'userProfileId':_0x141006[_0x2d5a('0x4b')]},'raw':!![]})[_0x2d5a('0x21')](function(_0x5d2d3f){if(_0x5d2d3f&&_0x5d2d3f['autoAssociation']===0x0){return db['UserProfileResource'][_0x2d5a('0x46')]({'name':_0x1bcbe8['name'],'resourceId':_0x1bcbe8['id'],'type':_0x5d2d3f[_0x2d5a('0x27')],'sectionId':_0x5d2d3f['id']},{})[_0x2d5a('0x21')](function(){return _0x1f5bbb;});}else{return _0x1f5bbb;}})[_0x2d5a('0x45')](function(_0x4f5436){logger['error'](_0x2d5a('0x4c'),_0x4f5436);throw _0x4f5436;});}return _0x1f5bbb;})['then'](respondWithResult(_0x2ab7c2,0xc9))['catch'](handleError(_0x2ab7c2,null));};exports[_0x2d5a('0x20')]=function(_0x4bb2d0,_0x4dd32a){if(_0x4bb2d0[_0x2d5a('0x4d')]['id']){delete _0x4bb2d0[_0x2d5a('0x4d')]['id'];}return db[_0x2d5a('0x2b')][_0x2d5a('0x44')]({'where':{'id':_0x4bb2d0[_0x2d5a('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4dd32a,null))[_0x2d5a('0x21')](saveUpdates(_0x4bb2d0[_0x2d5a('0x4d')],null))[_0x2d5a('0x21')](respondWithResult(_0x4dd32a,null))[_0x2d5a('0x45')](handleError(_0x4dd32a,null));};exports[_0x2d5a('0x4f')]=function(_0x6dafdb,_0x15ae1d){return db['Disposition'][_0x2d5a('0x44')]({'where':{'id':_0x6dafdb[_0x2d5a('0x4e')]['id']}})[_0x2d5a('0x21')](handleEntityNotFound(_0x15ae1d,null))[_0x2d5a('0x21')](removeEntity(_0x15ae1d,null))[_0x2d5a('0x45')](handleError(_0x15ae1d,null));}; \ No newline at end of file +var _0xc2b2=['Disposition','rawAttributes','type','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','Dispositions','end','stack','name','send','index'];(function(_0x1bdf2e,_0x560871){var _0x591312=function(_0x20605e){while(--_0x20605e){_0x1bdf2e['push'](_0x1bdf2e['shift']());}};_0x591312(++_0x560871);}(_0xc2b2,0xd3));var _0x2c2b=function(_0x55af4a,_0xab66fd){_0x55af4a=_0x55af4a-0x0;var _0x429ab3=_0xc2b2[_0x55af4a];return _0x429ab3;};'use strict';var emlformat=require(_0x2c2b('0x0'));var rimraf=require(_0x2c2b('0x1'));var zipdir=require(_0x2c2b('0x2'));var jsonpatch=require(_0x2c2b('0x3'));var rp=require(_0x2c2b('0x4'));var moment=require(_0x2c2b('0x5'));var BPromise=require(_0x2c2b('0x6'));var Mustache=require(_0x2c2b('0x7'));var util=require(_0x2c2b('0x8'));var path=require('path');var sox=require(_0x2c2b('0x9'));var csv=require(_0x2c2b('0xa'));var ejs=require(_0x2c2b('0xb'));var fs=require('fs');var fs_extra=require(_0x2c2b('0xc'));var _=require(_0x2c2b('0xd'));var squel=require('squel');var crypto=require(_0x2c2b('0xe'));var jsforce=require(_0x2c2b('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2c2b('0xa'));var querystring=require(_0x2c2b('0x10'));var Papa=require(_0x2c2b('0x11'));var Redis=require(_0x2c2b('0x12'));var authService=require(_0x2c2b('0x13'));var qs=require(_0x2c2b('0x14'));var as=require(_0x2c2b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2c2b('0x16'))(_0x2c2b('0x17'));var utils=require(_0x2c2b('0x18'));var config=require(_0x2c2b('0x19'));var licenseUtil=require(_0x2c2b('0x1a'));var db=require(_0x2c2b('0x1b'))['db'];function respondWithStatusCode(_0x25371c,_0x5f4775){_0x5f4775=_0x5f4775||0xcc;return function(_0x1723c8){if(_0x1723c8){return _0x25371c[_0x2c2b('0x1c')](_0x5f4775);}return _0x25371c[_0x2c2b('0x1d')](_0x5f4775)['end']();};}function respondWithResult(_0x3d2b64,_0x420fd4){_0x420fd4=_0x420fd4||0xc8;return function(_0x37ce0f){if(_0x37ce0f){return _0x3d2b64['status'](_0x420fd4)['json'](_0x37ce0f);}};}function respondWithFilteredResult(_0x5a76fe,_0x29b9a9){return function(_0x48908d){if(_0x48908d){var _0x2e3f94=typeof _0x29b9a9[_0x2c2b('0x1e')]===_0x2c2b('0x1f')&&typeof _0x29b9a9[_0x2c2b('0x20')]===_0x2c2b('0x1f');var _0x4183c6=_0x48908d[_0x2c2b('0x21')];var _0x4a8ae3=_0x2e3f94?0x0:_0x29b9a9[_0x2c2b('0x1e')];var _0x20f4bc=_0x2e3f94?_0x48908d[_0x2c2b('0x21')]:_0x29b9a9[_0x2c2b('0x1e')]+_0x29b9a9[_0x2c2b('0x20')];var _0x2685e9;if(_0x20f4bc>=_0x4183c6){_0x20f4bc=_0x4183c6;_0x2685e9=0xc8;}else{_0x2685e9=0xce;}_0x5a76fe[_0x2c2b('0x1d')](_0x2685e9);return _0x5a76fe[_0x2c2b('0x22')]('Content-Range',_0x4a8ae3+'-'+_0x20f4bc+'/'+_0x4183c6)['json'](_0x48908d);}return null;};}function patchUpdates(_0x8910ad){return function(_0x376f55){try{jsonpatch[_0x2c2b('0x23')](_0x376f55,_0x8910ad,!![]);}catch(_0x1d2c59){return BPromise[_0x2c2b('0x24')](_0x1d2c59);}return _0x376f55[_0x2c2b('0x25')]();};}function saveUpdates(_0x595230,_0xd0bfaf){return function(_0x3eb85f){if(_0x3eb85f){return _0x3eb85f[_0x2c2b('0x26')](_0x595230)[_0x2c2b('0x27')](function(_0x214ebf){return _0x214ebf;});}return null;};}function removeEntity(_0x39248d,_0x45307c){return function(_0x2fa92e){if(_0x2fa92e){return _0x2fa92e[_0x2c2b('0x28')]()[_0x2c2b('0x27')](function(){var _0x12a8c6=_0x2fa92e['get']({'plain':!![]});var _0x30468d=_0x2c2b('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x30468d,'resourceId':_0x12a8c6['id']}})[_0x2c2b('0x27')](function(){return _0x2fa92e;});})[_0x2c2b('0x27')](function(){_0x39248d[_0x2c2b('0x1d')](0xcc)[_0x2c2b('0x2a')]();});}};}function handleEntityNotFound(_0x39ed45,_0x413e1f){return function(_0x1fa880){if(!_0x1fa880){_0x39ed45[_0x2c2b('0x1c')](0x194);}return _0x1fa880;};}function handleError(_0x1b9690,_0x4466b3){_0x4466b3=_0x4466b3||0x1f4;return function(_0x25fac2){logger['error'](_0x25fac2[_0x2c2b('0x2b')]);if(_0x25fac2['name']){delete _0x25fac2[_0x2c2b('0x2c')];}_0x1b9690['status'](_0x4466b3)[_0x2c2b('0x2d')](_0x25fac2);};}exports[_0x2c2b('0x2e')]=function(_0xf67e25,_0xea4ea7){var _0x2621e9={},_0x391059={},_0x449486={'count':0x0,'rows':[]};var _0x5b8a4f=_['map'](db[_0x2c2b('0x2f')][_0x2c2b('0x30')],function(_0x42c5ff){return{'name':_0x42c5ff['fieldName'],'type':_0x42c5ff[_0x2c2b('0x31')]['key']};});_0x391059[_0x2c2b('0x32')]=_[_0x2c2b('0x33')](_0x5b8a4f,_0x2c2b('0x2c'));_0x391059[_0x2c2b('0x34')]=_[_0x2c2b('0x35')](_0xf67e25[_0x2c2b('0x34')]);_0x391059['filters']=_[_0x2c2b('0x36')](_0x391059[_0x2c2b('0x32')],_0x391059[_0x2c2b('0x34')]);_0x2621e9[_0x2c2b('0x37')]=_[_0x2c2b('0x36')](_0x391059[_0x2c2b('0x32')],qs[_0x2c2b('0x38')](_0xf67e25[_0x2c2b('0x34')][_0x2c2b('0x38')]));_0x2621e9[_0x2c2b('0x37')]=_0x2621e9['attributes'][_0x2c2b('0x39')]?_0x2621e9[_0x2c2b('0x37')]:_0x391059[_0x2c2b('0x32')];if(!_0xf67e25[_0x2c2b('0x34')]['hasOwnProperty'](_0x2c2b('0x3a'))){_0x2621e9[_0x2c2b('0x20')]=qs[_0x2c2b('0x20')](_0xf67e25[_0x2c2b('0x34')][_0x2c2b('0x20')]);_0x2621e9['offset']=qs[_0x2c2b('0x1e')](_0xf67e25[_0x2c2b('0x34')][_0x2c2b('0x1e')]);}_0x2621e9[_0x2c2b('0x3b')]=qs['sort'](_0xf67e25['query'][_0x2c2b('0x3c')]);_0x2621e9[_0x2c2b('0x3d')]=qs['filters'](_[_0x2c2b('0x3e')](_0xf67e25[_0x2c2b('0x34')],_0x391059[_0x2c2b('0x3f')]),_0x5b8a4f);if(_0xf67e25[_0x2c2b('0x34')][_0x2c2b('0x40')]){_0x2621e9[_0x2c2b('0x3d')]=_[_0x2c2b('0x41')](_0x2621e9[_0x2c2b('0x3d')],{'$or':_[_0x2c2b('0x33')](_0x5b8a4f,function(_0x494e02){if(_0x494e02[_0x2c2b('0x31')]!==_0x2c2b('0x42')){var _0x2b6194={};_0x2b6194[_0x494e02[_0x2c2b('0x2c')]]={'$like':'%'+_0xf67e25[_0x2c2b('0x34')][_0x2c2b('0x40')]+'%'};return _0x2b6194;}})});}_0x2621e9=_[_0x2c2b('0x41')]({},_0x2621e9,_0xf67e25[_0x2c2b('0x43')]);var _0x5dcc82={'where':_0x2621e9[_0x2c2b('0x3d')]};return db[_0x2c2b('0x2f')]['count'](_0x5dcc82)['then'](function(_0xeeba80){_0x449486[_0x2c2b('0x21')]=_0xeeba80;if(_0xf67e25['query'][_0x2c2b('0x44')]){_0x2621e9[_0x2c2b('0x45')]=[{'all':!![]}];}return db[_0x2c2b('0x2f')][_0x2c2b('0x46')](_0x2621e9);})['then'](function(_0x541c6b){_0x449486['rows']=_0x541c6b;return _0x449486;})['then'](respondWithFilteredResult(_0xea4ea7,_0x2621e9))[_0x2c2b('0x47')](handleError(_0xea4ea7,null));};exports[_0x2c2b('0x48')]=function(_0x47e4da,_0x301d65){var _0x515a1f={'raw':!![],'where':{'id':_0x47e4da['params']['id']}},_0x24de52={};_0x24de52['model']=_[_0x2c2b('0x35')](db[_0x2c2b('0x2f')][_0x2c2b('0x30')]);_0x24de52[_0x2c2b('0x34')]=_[_0x2c2b('0x35')](_0x47e4da[_0x2c2b('0x34')]);_0x24de52['filters']=_['intersection'](_0x24de52['model'],_0x24de52[_0x2c2b('0x34')]);_0x515a1f[_0x2c2b('0x37')]=_['intersection'](_0x24de52['model'],qs[_0x2c2b('0x38')](_0x47e4da[_0x2c2b('0x34')][_0x2c2b('0x38')]));_0x515a1f[_0x2c2b('0x37')]=_0x515a1f['attributes'][_0x2c2b('0x39')]?_0x515a1f[_0x2c2b('0x37')]:_0x24de52[_0x2c2b('0x32')];if(_0x47e4da[_0x2c2b('0x34')][_0x2c2b('0x44')]){_0x515a1f['include']=[{'all':!![]}];}_0x515a1f=_['merge']({},_0x515a1f,_0x47e4da['options']);return db[_0x2c2b('0x2f')][_0x2c2b('0x49')](_0x515a1f)['then'](handleEntityNotFound(_0x301d65,null))[_0x2c2b('0x27')](respondWithResult(_0x301d65,null))[_0x2c2b('0x47')](handleError(_0x301d65,null));};exports[_0x2c2b('0x4a')]=function(_0x434b2e,_0x3c65f2){return db[_0x2c2b('0x2f')][_0x2c2b('0x4a')](_0x434b2e[_0x2c2b('0x4b')],{})['then'](function(_0x5af223){var _0x252388=_0x434b2e[_0x2c2b('0x4c')][_0x2c2b('0x4d')]({'plain':!![]});if(!_0x252388)throw new Error(_0x2c2b('0x4e'));if(_0x252388[_0x2c2b('0x4f')]===_0x2c2b('0x4c')){var _0xbb58fa=_0x5af223[_0x2c2b('0x4d')]({'plain':!![]});var _0x1b6bcd='Dispositions';return db[_0x2c2b('0x50')][_0x2c2b('0x49')]({'where':{'name':_0x1b6bcd,'userProfileId':_0x252388[_0x2c2b('0x51')]},'raw':!![]})[_0x2c2b('0x27')](function(_0xeeea40){if(_0xeeea40&&_0xeeea40[_0x2c2b('0x52')]===0x0){return db[_0x2c2b('0x53')]['create']({'name':_0xbb58fa[_0x2c2b('0x2c')],'resourceId':_0xbb58fa['id'],'type':_0xeeea40['name'],'sectionId':_0xeeea40['id']},{})[_0x2c2b('0x27')](function(){return _0x5af223;});}else{return _0x5af223;}})[_0x2c2b('0x47')](function(_0x280e64){logger['error'](_0x2c2b('0x54'),_0x280e64);throw _0x280e64;});}return _0x5af223;})[_0x2c2b('0x27')](respondWithResult(_0x3c65f2,0xc9))[_0x2c2b('0x47')](handleError(_0x3c65f2,null));};exports[_0x2c2b('0x26')]=function(_0x540252,_0xb0db6){if(_0x540252['body']['id']){delete _0x540252[_0x2c2b('0x4b')]['id'];}return db['Disposition'][_0x2c2b('0x49')]({'where':{'id':_0x540252[_0x2c2b('0x55')]['id']}})['then'](handleEntityNotFound(_0xb0db6,null))['then'](saveUpdates(_0x540252['body'],null))[_0x2c2b('0x27')](respondWithResult(_0xb0db6,null))[_0x2c2b('0x47')](handleError(_0xb0db6,null));};exports[_0x2c2b('0x28')]=function(_0x47ccbe,_0x3505b9){return db['Disposition'][_0x2c2b('0x49')]({'where':{'id':_0x47ccbe[_0x2c2b('0x55')]['id']}})[_0x2c2b('0x27')](handleEntityNotFound(_0x3505b9,null))['then'](removeEntity(_0x3505b9,null))[_0x2c2b('0x47')](handleError(_0x3505b9,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 28d4c37..99ad730 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 _0x4c34=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','Disposition','tools_dispositions','name','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4c34,0xef));var _0x44c3=function(_0x155e8f,_0x1a6438){_0x155e8f=_0x155e8f-0x0;var _0x2319f6=_0x4c34[_0x155e8f];return _0x2319f6;};'use strict';var _=require(_0x44c3('0x0'));var util=require('util');var logger=require(_0x44c3('0x1'))('api');var moment=require(_0x44c3('0x2'));var BPromise=require(_0x44c3('0x3'));var rp=require(_0x44c3('0x4'));var fs=require('fs');var path=require(_0x44c3('0x5'));var rimraf=require(_0x44c3('0x6'));var config=require(_0x44c3('0x7'));var attributes=require('./disposition.attributes');module['exports']=function(_0x439191,_0x1d8e88){return _0x439191[_0x44c3('0x8')](_0x44c3('0x9'),attributes,{'tableName':_0x44c3('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x44c3('0xb'),'ListId']},{'unique':!![],'name':_0x44c3('0xc'),'fields':[_0x44c3('0xb'),_0x44c3('0xd')]},{'unique':!![],'name':_0x44c3('0xe'),'fields':[_0x44c3('0xb'),_0x44c3('0xf')]},{'unique':!![],'name':_0x44c3('0x10'),'fields':[_0x44c3('0xb'),_0x44c3('0x11')]},{'unique':!![],'name':_0x44c3('0x12'),'fields':[_0x44c3('0xb'),_0x44c3('0x13')]},{'unique':!![],'name':_0x44c3('0x14'),'fields':['name',_0x44c3('0x15')]},{'unique':!![],'name':_0x44c3('0x16'),'fields':[_0x44c3('0xb'),_0x44c3('0x17')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbb25=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./disposition.attributes','define','Disposition','tools_dispositions','name_voice','name_chat','name','ChatWebsiteId','name_mail','MailAccountId','name_sms','name_fax','name_whatsapp'];(function(_0x4bcfa6,_0x2526b8){var _0x5a8935=function(_0xf67332){while(--_0xf67332){_0x4bcfa6['push'](_0x4bcfa6['shift']());}};_0x5a8935(++_0x2526b8);}(_0xbb25,0x1e3));var _0x5bb2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbb25[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5bb2('0x0'));var util=require(_0x5bb2('0x1'));var logger=require(_0x5bb2('0x2'))('api');var moment=require(_0x5bb2('0x3'));var BPromise=require(_0x5bb2('0x4'));var rp=require(_0x5bb2('0x5'));var fs=require('fs');var path=require(_0x5bb2('0x6'));var rimraf=require('rimraf');var config=require(_0x5bb2('0x7'));var attributes=require(_0x5bb2('0x8'));module['exports']=function(_0x739229,_0x3ae4b7){return _0x739229[_0x5bb2('0x9')](_0x5bb2('0xa'),attributes,{'tableName':_0x5bb2('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x5bb2('0xc'),'fields':['name','ListId']},{'unique':!![],'name':_0x5bb2('0xd'),'fields':[_0x5bb2('0xe'),_0x5bb2('0xf')]},{'unique':!![],'name':_0x5bb2('0x10'),'fields':[_0x5bb2('0xe'),_0x5bb2('0x11')]},{'unique':!![],'name':_0x5bb2('0x12'),'fields':[_0x5bb2('0xe'),'SmsAccountId']},{'unique':!![],'name':_0x5bb2('0x13'),'fields':['name','FaxAccountId']},{'unique':!![],'name':'name_openchannel','fields':[_0x5bb2('0xe'),'OpenchannelAccountId']},{'unique':!![],'name':_0x5bb2('0x14'),'fields':[_0x5bb2('0xe'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 4d0cdd9..cfaa40b 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(_0x5c6048,_0x41234f){var _0x319609=function(_0xe0353b){while(--_0xe0353b){_0x5c6048['push'](_0x5c6048['shift']());}};_0x319609(++_0x41234f);}(_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','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(_0x278c54,_0x46e734){var _0x48cf28=function(_0xd1cc50){while(--_0xd1cc50){_0x278c54['push'](_0x278c54['shift']());}};_0x48cf28(++_0x46e734);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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 93eb458..494f9ec 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 _0xe147=['Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post','/:id','update','destroy','exports','util','path','express'];(function(_0x50bcb2,_0x33a0e6){var _0x4115e0=function(_0x33ca08){while(--_0x33ca08){_0x50bcb2['push'](_0x50bcb2['shift']());}};_0x4115e0(++_0x33a0e6);}(_0xe147,0x1ec));var _0x7e14=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe147[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x7e14('0x0'));var path=require(_0x7e14('0x1'));var timeout=require('connect-timeout');var express=require(_0x7e14('0x2'));var router=express[_0x7e14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7e14('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7e14('0x5'));var controller=require('./disposition.controller');router[_0x7e14('0x6')]('/',auth[_0x7e14('0x7')](),controller[_0x7e14('0x8')]);router[_0x7e14('0x6')]('/:id',auth[_0x7e14('0x7')](),controller[_0x7e14('0x9')]);router[_0x7e14('0xa')]('/',auth[_0x7e14('0x7')](),controller['create']);router['put'](_0x7e14('0xb'),auth['isAuthenticated'](),controller[_0x7e14('0xc')]);router['delete'](_0x7e14('0xb'),auth[_0x7e14('0x7')](),controller[_0x7e14('0xd')]);module[_0x7e14('0xe')]=router; \ No newline at end of file +var _0xd4f8=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','delete','exports','multer','util','connect-timeout'];(function(_0x1fcf33,_0x22d50a){var _0xecad3a=function(_0xd66b5b){while(--_0xd66b5b){_0x1fcf33['push'](_0x1fcf33['shift']());}};_0xecad3a(++_0x22d50a);}(_0xd4f8,0x18d));var _0x8d4f=function(_0x55e412,_0x2f3739){_0x55e412=_0x55e412-0x0;var _0x2e1d05=_0xd4f8[_0x55e412];return _0x2e1d05;};'use strict';var multer=require(_0x8d4f('0x0'));var util=require(_0x8d4f('0x1'));var path=require('path');var timeout=require(_0x8d4f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8d4f('0x3'));var interaction=require(_0x8d4f('0x4'));var config=require(_0x8d4f('0x5'));var controller=require('./disposition.controller');router[_0x8d4f('0x6')]('/',auth[_0x8d4f('0x7')](),controller[_0x8d4f('0x8')]);router[_0x8d4f('0x6')](_0x8d4f('0x9'),auth['isAuthenticated'](),controller[_0x8d4f('0xa')]);router['post']('/',auth[_0x8d4f('0x7')](),controller[_0x8d4f('0xb')]);router[_0x8d4f('0xc')]('/:id',auth[_0x8d4f('0x7')](),controller[_0x8d4f('0xd')]);router[_0x8d4f('0xe')](_0x8d4f('0x9'),auth[_0x8d4f('0x7')](),controller['destroy']);module[_0x8d4f('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index c461065..975bc84 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 _0xcf9c=['mandatoryDispositionPauseId','mandatoryDisposition','exports','ENUM','yes','STRING','xCALLY\x20Motion\x20Fax','localstationid','4800','7200','12000','14400','2400','9600','INTEGER','SIP','IAX','DADHI','KHOMP','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xcf9c,0x1e5));var _0xccf9=function(_0x1d7be2,_0x2a38b4){_0x1d7be2=_0x1d7be2-0x0;var _0x19ac2e=_0xcf9c[_0x1d7be2];return _0x19ac2e;};'use strict';var Sequelize=require('sequelize');module[_0xccf9('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0xccf9('0x1')](_0xccf9('0x2'),'no'),'defaultValue':_0xccf9('0x2')},'headerinfo':{'type':Sequelize[_0xccf9('0x3')],'defaultValue':_0xccf9('0x4')},'localstationid':{'type':Sequelize[_0xccf9('0x3')],'unique':_0xccf9('0x5')},'minrate':{'type':Sequelize[_0xccf9('0x1')]('2400',_0xccf9('0x6'),_0xccf9('0x7'),'9600',_0xccf9('0x8'),_0xccf9('0x9')),'defaultValue':_0xccf9('0x6')},'maxrate':{'type':Sequelize[_0xccf9('0x1')](_0xccf9('0xa'),_0xccf9('0x6'),_0xccf9('0x7'),_0xccf9('0xb'),_0xccf9('0x8'),_0xccf9('0x9')),'defaultValue':_0xccf9('0x9')},'modem':{'type':Sequelize[_0xccf9('0x3')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xccf9('0x3')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xccf9('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xccf9('0x1')](_0xccf9('0xd'),_0xccf9('0xe'),_0xccf9('0xf'),_0xccf9('0x10')),'defaultValue':_0xccf9('0xd')},'key':{'type':Sequelize[_0xccf9('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xccf9('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xccf9('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xccf9('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xccf9('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xccf9('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xccf9('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xccf9('0x12')},'mandatoryDisposition':{'type':Sequelize[_0xccf9('0x11')],'defaultValue':![],'comment':_0xccf9('0x13'),'set':function(_0xebceef){if(!_0xebceef)this[_0xccf9('0x14')](_0xccf9('0x15'),null);this[_0xccf9('0x14')](_0xccf9('0x16'),_0xebceef);}}}; \ No newline at end of file +var _0xf869=['v17,v27,v29','INTEGER','IAX','DADHI','KHOMP','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','exports','STRING','ENUM','yes','localstationid','2400','4800','7200','9600','12000','14400'];(function(_0x409fb8,_0x5ab3d3){var _0x278270=function(_0x58849c){while(--_0x58849c){_0x409fb8['push'](_0x409fb8['shift']());}};_0x278270(++_0x5ab3d3);}(_0xf869,0x96));var _0x9f86=function(_0x23be51,_0xc02a1b){_0x23be51=_0x23be51-0x0;var _0x47a26d=_0xf869[_0x23be51];return _0x47a26d;};'use strict';var Sequelize=require('sequelize');module[_0x9f86('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9f86('0x1')]},'ecm':{'type':Sequelize[_0x9f86('0x2')](_0x9f86('0x3'),'no'),'defaultValue':_0x9f86('0x3')},'headerinfo':{'type':Sequelize[_0x9f86('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize['STRING'],'unique':_0x9f86('0x4')},'minrate':{'type':Sequelize['ENUM'](_0x9f86('0x5'),_0x9f86('0x6'),_0x9f86('0x7'),_0x9f86('0x8'),_0x9f86('0x9'),'14400'),'defaultValue':_0x9f86('0x6')},'maxrate':{'type':Sequelize[_0x9f86('0x2')](_0x9f86('0x5'),_0x9f86('0x6'),_0x9f86('0x7'),_0x9f86('0x8'),_0x9f86('0x9'),_0x9f86('0xa')),'defaultValue':_0x9f86('0xa')},'modem':{'type':Sequelize[_0x9f86('0x1')],'defaultValue':_0x9f86('0xb')},'gateway':{'type':Sequelize[_0x9f86('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x9f86('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x9f86('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x9f86('0x2')]('SIP',_0x9f86('0xd'),_0x9f86('0xe'),_0x9f86('0xf')),'defaultValue':_0x9f86('0x10')},'key':{'type':Sequelize[_0x9f86('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9f86('0x11')],'defaultValue':function(){return _0x9f86('0x12');}},'notificationSound':{'type':Sequelize[_0x9f86('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9f86('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9f86('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9f86('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9f86('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9f86('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9f86('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x9f86('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x9f86('0x13')],'defaultValue':![],'comment':_0x9f86('0x15'),'set':function(_0x159ab1){if(!_0x159ab1)this[_0x9f86('0x16')]('mandatoryDispositionPauseId',null);this[_0x9f86('0x16')]('mandatoryDisposition',_0x159ab1);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index fb44896..88495dc 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 _0x7d6c=['end','json','offset','undefined','limit','count','set','apply','save','update','destroy','get','UserProfileResource','status','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','FaxAccounts','UserProfileSection','userProfileId','autoAssociation','describe','Disposition','findOne','FaxAccountId','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','order','addInteraction','FaxInteraction','CmContact','Owner','fullname','internal','color','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','bulkCreate','FaxApplication','findAndCountAll','priority','finally','getApplications','from-voip-provider','localstationid','app','system','description','push','Answer','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','ReceiveFax','addAccountApplications','updateAccountApplications','VoiceExtension','omit','tech','updatedAt','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','info','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','register','jayson/promise','client','request','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus'];(function(_0x556408,_0x350888){var _0x371c3f=function(_0x28b538){while(--_0x28b538){_0x556408['push'](_0x556408['shift']());}};_0x371c3f(++_0x350888);}(_0x7d6c,0x15a));var _0xc7d6=function(_0x56deaa,_0x521441){_0x56deaa=_0x56deaa-0x0;var _0x31dc54=_0x7d6c[_0x56deaa];return _0x31dc54;};'use strict';var emlformat=require(_0xc7d6('0x0'));var rimraf=require(_0xc7d6('0x1'));var zipdir=require(_0xc7d6('0x2'));var jsonpatch=require(_0xc7d6('0x3'));var rp=require(_0xc7d6('0x4'));var moment=require(_0xc7d6('0x5'));var BPromise=require(_0xc7d6('0x6'));var Mustache=require(_0xc7d6('0x7'));var util=require('util');var path=require(_0xc7d6('0x8'));var sox=require(_0xc7d6('0x9'));var csv=require(_0xc7d6('0xa'));var ejs=require(_0xc7d6('0xb'));var fs=require('fs');var fs_extra=require(_0xc7d6('0xc'));var _=require(_0xc7d6('0xd'));var squel=require(_0xc7d6('0xe'));var crypto=require(_0xc7d6('0xf'));var jsforce=require(_0xc7d6('0x10'));var deskjs=require(_0xc7d6('0x11'));var toCsv=require(_0xc7d6('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc7d6('0x12'));var qs=require(_0xc7d6('0x13'));var as=require(_0xc7d6('0x14'));var hardwareService=require(_0xc7d6('0x15'));var logger=require(_0xc7d6('0x16'))(_0xc7d6('0x17'));var utils=require(_0xc7d6('0x18'));var config=require(_0xc7d6('0x19'));var licenseUtil=require(_0xc7d6('0x1a'));var db=require(_0xc7d6('0x1b'))['db'];config['redis']=_[_0xc7d6('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc7d6('0x1d')]));require('./faxAccount.socket')[_0xc7d6('0x1e')](socket);var jayson=require(_0xc7d6('0x1f'));var client=jayson[_0xc7d6('0x20')]['http']({'port':0x232c});var client9002=jayson[_0xc7d6('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x699a21,_0x555b38,_0x50c72a,_0x2b8b9b){return new BPromise(function(_0x2a8aff,_0xbf45f){var _0x26f17f=_0x2b8b9b||client;return _0x26f17f[_0xc7d6('0x21')](_0x699a21,_0x50c72a)[_0xc7d6('0x22')](function(_0x1e50ae){logger['info']('FaxAccount,\x20%s,\x20%s',_0x555b38,_0xc7d6('0x23'));logger[_0xc7d6('0x24')](_0xc7d6('0x25'),_0x555b38,_0xc7d6('0x23'),JSON[_0xc7d6('0x26')](_0x1e50ae));if(_0x1e50ae['error']){if(_0x1e50ae[_0xc7d6('0x27')][_0xc7d6('0x28')]===0x1f4){logger[_0xc7d6('0x27')](_0xc7d6('0x29'),_0x555b38,_0x1e50ae[_0xc7d6('0x27')][_0xc7d6('0x2a')]);return _0xbf45f(_0x1e50ae[_0xc7d6('0x27')][_0xc7d6('0x2a')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x555b38,_0x1e50ae[_0xc7d6('0x27')][_0xc7d6('0x2a')]);return _0x2a8aff(_0x1e50ae['error'][_0xc7d6('0x2a')]);}else{logger['info'](_0xc7d6('0x29'),_0x555b38,_0xc7d6('0x23'));_0x2a8aff(_0x1e50ae[_0xc7d6('0x2b')][_0xc7d6('0x2a')]);}})[_0xc7d6('0x2c')](function(_0x1a4545){logger[_0xc7d6('0x27')]('FaxAccount,\x20%s,\x20%s',_0x555b38,_0x1a4545);_0xbf45f(_0x1a4545);});});}function respondWithStatusCode(_0x31b03c,_0x1a6b89){_0x1a6b89=_0x1a6b89||0xcc;return function(_0x6188ba){if(_0x6188ba){return _0x31b03c[_0xc7d6('0x2d')](_0x1a6b89);}return _0x31b03c['status'](_0x1a6b89)[_0xc7d6('0x2e')]();};}function respondWithResult(_0x2e72a9,_0x1ab7d7){_0x1ab7d7=_0x1ab7d7||0xc8;return function(_0x341d3c){if(_0x341d3c){return _0x2e72a9['status'](_0x1ab7d7)[_0xc7d6('0x2f')](_0x341d3c);}};}function respondWithFilteredResult(_0x176751,_0x32f812){return function(_0x5187f6){if(_0x5187f6){var _0x4032a4=typeof _0x32f812[_0xc7d6('0x30')]===_0xc7d6('0x31')&&typeof _0x32f812[_0xc7d6('0x32')]==='undefined';var _0x3d000e=_0x5187f6['count'];var _0x54d0fa=_0x4032a4?0x0:_0x32f812[_0xc7d6('0x30')];var _0xb73a40=_0x4032a4?_0x5187f6[_0xc7d6('0x33')]:_0x32f812['offset']+_0x32f812['limit'];var _0x59e2ba;if(_0xb73a40>=_0x3d000e){_0xb73a40=_0x3d000e;_0x59e2ba=0xc8;}else{_0x59e2ba=0xce;}_0x176751['status'](_0x59e2ba);return _0x176751[_0xc7d6('0x34')]('Content-Range',_0x54d0fa+'-'+_0xb73a40+'/'+_0x3d000e)[_0xc7d6('0x2f')](_0x5187f6);}return null;};}function patchUpdates(_0x53013d){return function(_0x44e03d){try{jsonpatch[_0xc7d6('0x35')](_0x44e03d,_0x53013d,!![]);}catch(_0x39b30c){return BPromise['reject'](_0x39b30c);}return _0x44e03d[_0xc7d6('0x36')]();};}function saveUpdates(_0x190885,_0x19d322){return function(_0x567550){if(_0x567550){return _0x567550[_0xc7d6('0x37')](_0x190885)['then'](function(_0x4c6592){return _0x4c6592;});}return null;};}function removeEntity(_0x162e5e,_0x5150b9){return function(_0x4bb2a1){if(_0x4bb2a1){return _0x4bb2a1[_0xc7d6('0x38')]()[_0xc7d6('0x22')](function(){var _0x72fdf=_0x4bb2a1[_0xc7d6('0x39')]({'plain':!![]});var _0x1f0732='FaxAccounts';return db[_0xc7d6('0x3a')]['destroy']({'where':{'type':_0x1f0732,'resourceId':_0x72fdf['id']}})['then'](function(){return _0x4bb2a1;});})[_0xc7d6('0x22')](function(){_0x162e5e[_0xc7d6('0x3b')](0xcc)[_0xc7d6('0x2e')]();});}};}function handleEntityNotFound(_0x40a99c,_0x5ca1d4){return function(_0x3ea1e8){if(!_0x3ea1e8){_0x40a99c[_0xc7d6('0x2d')](0x194);}return _0x3ea1e8;};}function handleError(_0x2e1b15,_0x311a0a){_0x311a0a=_0x311a0a||0x1f4;return function(_0x51b88c){logger[_0xc7d6('0x27')](_0x51b88c[_0xc7d6('0x3c')]);if(_0x51b88c[_0xc7d6('0x3d')]){delete _0x51b88c['name'];}_0x2e1b15[_0xc7d6('0x3b')](_0x311a0a)[_0xc7d6('0x3e')](_0x51b88c);};}exports[_0xc7d6('0x3f')]=function(_0x3971e3,_0x4adef7){var _0x26ab65={'include':[{'model':db[_0xc7d6('0x40')],'as':_0xc7d6('0x41')}]},_0x1f9092={},_0x509c18={'count':0x0,'rows':[]};var _0x6835fa=_[_0xc7d6('0x42')](db[_0xc7d6('0x43')][_0xc7d6('0x44')],function(_0x5235aa){return{'name':_0x5235aa[_0xc7d6('0x45')],'type':_0x5235aa['type'][_0xc7d6('0x46')]};});_0x1f9092[_0xc7d6('0x47')]=_['map'](_0x6835fa,_0xc7d6('0x3d'));_0x1f9092[_0xc7d6('0x48')]=_[_0xc7d6('0x49')](_0x3971e3[_0xc7d6('0x48')]);_0x1f9092['filters']=_[_0xc7d6('0x4a')](_0x1f9092[_0xc7d6('0x47')],_0x1f9092[_0xc7d6('0x48')]);_0x26ab65['attributes']=_[_0xc7d6('0x4a')](_0x1f9092[_0xc7d6('0x47')],qs[_0xc7d6('0x4b')](_0x3971e3[_0xc7d6('0x48')]['fields']));_0x26ab65[_0xc7d6('0x4c')]=_0x26ab65[_0xc7d6('0x4c')][_0xc7d6('0x4d')]?_0x26ab65[_0xc7d6('0x4c')]:_0x1f9092[_0xc7d6('0x47')];if(!_0x3971e3['query'][_0xc7d6('0x4e')](_0xc7d6('0x4f'))){_0x26ab65[_0xc7d6('0x32')]=qs['limit'](_0x3971e3['query'][_0xc7d6('0x32')]);_0x26ab65[_0xc7d6('0x30')]=qs['offset'](_0x3971e3[_0xc7d6('0x48')][_0xc7d6('0x30')]);}_0x26ab65['order']=qs[_0xc7d6('0x50')](_0x3971e3['query'][_0xc7d6('0x50')]);_0x26ab65[_0xc7d6('0x51')]=qs[_0xc7d6('0x52')](_[_0xc7d6('0x53')](_0x3971e3[_0xc7d6('0x48')],_0x1f9092[_0xc7d6('0x52')]),_0x6835fa);if(_0x3971e3[_0xc7d6('0x48')][_0xc7d6('0x54')]){_0x26ab65[_0xc7d6('0x51')]=_[_0xc7d6('0x55')](_0x26ab65[_0xc7d6('0x51')],{'$or':_[_0xc7d6('0x42')](_0x6835fa,function(_0x116576){if(_0x116576[_0xc7d6('0x56')]!==_0xc7d6('0x57')){var _0x5557ee={};_0x5557ee[_0x116576['name']]={'$like':'%'+_0x3971e3[_0xc7d6('0x48')][_0xc7d6('0x54')]+'%'};return _0x5557ee;}})});}_0x26ab65=_[_0xc7d6('0x55')]({},_0x26ab65,_0x3971e3[_0xc7d6('0x58')]);var _0x2bf04a={'where':_0x26ab65[_0xc7d6('0x51')]};return db['FaxAccount'][_0xc7d6('0x33')](_0x2bf04a)[_0xc7d6('0x22')](function(_0x343bae){_0x509c18[_0xc7d6('0x33')]=_0x343bae;if(_0x3971e3[_0xc7d6('0x48')][_0xc7d6('0x59')]){_0x26ab65[_0xc7d6('0x5a')]=[{'all':!![]}];}return db[_0xc7d6('0x43')]['findAll'](_0x26ab65);})[_0xc7d6('0x22')](function(_0xaf2cbf){_0x509c18[_0xc7d6('0x5b')]=_0xaf2cbf;return _0x509c18;})['then'](respondWithFilteredResult(_0x4adef7,_0x26ab65))[_0xc7d6('0x2c')](handleError(_0x4adef7,null));};exports[_0xc7d6('0x5c')]=function(_0x25dc39,_0x45ad04){var _0x595055={'raw':![],'where':{'id':_0x25dc39[_0xc7d6('0x5d')]['id']},'include':[{'model':db[_0xc7d6('0x40')],'as':'mandatoryDispositionPause'}]},_0x384517={};_0x384517[_0xc7d6('0x47')]=_[_0xc7d6('0x49')](db['FaxAccount'][_0xc7d6('0x44')]);_0x384517[_0xc7d6('0x48')]=_[_0xc7d6('0x49')](_0x25dc39[_0xc7d6('0x48')]);_0x384517[_0xc7d6('0x52')]=_[_0xc7d6('0x4a')](_0x384517[_0xc7d6('0x47')],_0x384517['query']);_0x595055[_0xc7d6('0x4c')]=_['intersection'](_0x384517['model'],qs[_0xc7d6('0x4b')](_0x25dc39['query'][_0xc7d6('0x4b')]));_0x595055[_0xc7d6('0x4c')]=_0x595055[_0xc7d6('0x4c')][_0xc7d6('0x4d')]?_0x595055[_0xc7d6('0x4c')]:_0x384517[_0xc7d6('0x47')];if(_0x25dc39[_0xc7d6('0x48')]['includeAll']){_0x595055[_0xc7d6('0x5a')]=[{'all':!![]}];}_0x595055=_[_0xc7d6('0x55')]({},_0x595055,_0x25dc39[_0xc7d6('0x58')]);return db[_0xc7d6('0x43')][_0xc7d6('0x5e')](_0x595055)[_0xc7d6('0x22')](handleEntityNotFound(_0x45ad04,null))[_0xc7d6('0x22')](respondWithResult(_0x45ad04,null))[_0xc7d6('0x2c')](handleError(_0x45ad04,null));};exports[_0xc7d6('0x5f')]=function(_0x5ef9d2,_0x4de1d0){return db[_0xc7d6('0x43')][_0xc7d6('0x5f')](_0x5ef9d2[_0xc7d6('0x60')],{})[_0xc7d6('0x22')](function(_0x393471){var _0x46fb48=_0x5ef9d2['user'][_0xc7d6('0x39')]({'plain':!![]});if(!_0x46fb48)throw new Error(_0xc7d6('0x61'));if(_0x46fb48[_0xc7d6('0x62')]===_0xc7d6('0x63')){var _0xbe49c=_0x393471[_0xc7d6('0x39')]({'plain':!![]});var _0x174b39=_0xc7d6('0x64');return db[_0xc7d6('0x65')][_0xc7d6('0x5e')]({'where':{'name':_0x174b39,'userProfileId':_0x46fb48[_0xc7d6('0x66')]},'raw':!![]})[_0xc7d6('0x22')](function(_0x210012){if(_0x210012&&_0x210012[_0xc7d6('0x67')]===0x0){return db[_0xc7d6('0x3a')]['create']({'name':_0xbe49c[_0xc7d6('0x3d')],'resourceId':_0xbe49c['id'],'type':_0x210012[_0xc7d6('0x3d')],'sectionId':_0x210012['id']},{})[_0xc7d6('0x22')](function(){return _0x393471;});}else{return _0x393471;}})[_0xc7d6('0x2c')](function(_0xaefd95){logger[_0xc7d6('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xaefd95);throw _0xaefd95;});}return _0x393471;})[_0xc7d6('0x22')](respondWithResult(_0x4de1d0,0xc9))[_0xc7d6('0x2c')](handleError(_0x4de1d0,null));};exports['update']=function(_0x3dada3,_0x29f2de){if(_0x3dada3[_0xc7d6('0x60')]['id']){delete _0x3dada3[_0xc7d6('0x60')]['id'];}return db[_0xc7d6('0x43')]['find']({'where':{'id':_0x3dada3[_0xc7d6('0x5d')]['id']},'include':[{'model':db[_0xc7d6('0x40')],'as':_0xc7d6('0x41')}]})[_0xc7d6('0x22')](handleEntityNotFound(_0x29f2de,null))[_0xc7d6('0x22')](saveUpdates(_0x3dada3['body'],null))[_0xc7d6('0x22')](respondWithResult(_0x29f2de,null))['catch'](handleError(_0x29f2de,null));};exports['destroy']=function(_0x22fdb6,_0x155cd4){return db[_0xc7d6('0x43')][_0xc7d6('0x5e')]({'where':{'id':_0x22fdb6[_0xc7d6('0x5d')]['id']}})[_0xc7d6('0x22')](handleEntityNotFound(_0x155cd4,null))[_0xc7d6('0x22')](removeEntity(_0x155cd4,null))[_0xc7d6('0x2c')](handleError(_0x155cd4,null));};exports[_0xc7d6('0x68')]=function(_0x364b26,_0x52996c){return db[_0xc7d6('0x43')][_0xc7d6('0x68')]()[_0xc7d6('0x22')](respondWithResult(_0x52996c,null))[_0xc7d6('0x2c')](handleError(_0x52996c,null));};exports['addDisposition']=function(_0x5cf9f7,_0x590fe7,_0x18f88c){if(_0x5cf9f7[_0xc7d6('0x60')]['id']){delete _0x5cf9f7['body']['id'];}return db[_0xc7d6('0x43')]['find']({'where':{'id':_0x5cf9f7[_0xc7d6('0x5d')]['id']}})['then'](handleEntityNotFound(_0x590fe7,null))['then'](function(_0x3868a1){if(_0x3868a1){_0x5cf9f7[_0xc7d6('0x60')]['FaxAccountId']=_0x3868a1['id'];return db[_0xc7d6('0x69')][_0xc7d6('0x5f')](_0x5cf9f7['body']);}})[_0xc7d6('0x22')](respondWithResult(_0x590fe7,null))[_0xc7d6('0x2c')](handleError(_0x590fe7,null));};exports['getDispositions']=function(_0x500161,_0x2b01b1,_0x44df0e){var _0x1e35c5={'raw':![],'where':{}};var _0x5b6aa2={};var _0x49d311={'count':0x0,'rows':[]};return db['FaxAccount'][_0xc7d6('0x6a')]({'where':{'id':_0x500161[_0xc7d6('0x5d')]['id']}})[_0xc7d6('0x22')](handleEntityNotFound(_0x2b01b1,null))[_0xc7d6('0x22')](function(_0x47ac54){if(_0x47ac54){_0x5b6aa2['model']=_[_0xc7d6('0x49')](db['Disposition'][_0xc7d6('0x44')]);_0x5b6aa2[_0xc7d6('0x48')]=_[_0xc7d6('0x49')](_0x500161[_0xc7d6('0x48')]);_0x5b6aa2[_0xc7d6('0x52')]=_[_0xc7d6('0x4a')](_0x5b6aa2[_0xc7d6('0x47')],_0x5b6aa2[_0xc7d6('0x48')]);_0x1e35c5[_0xc7d6('0x4c')]=_['intersection'](_0x5b6aa2[_0xc7d6('0x47')],qs[_0xc7d6('0x4b')](_0x500161[_0xc7d6('0x48')]['fields']));_0x1e35c5['attributes']=_0x1e35c5[_0xc7d6('0x4c')][_0xc7d6('0x4d')]?_0x1e35c5[_0xc7d6('0x4c')]:_0x5b6aa2[_0xc7d6('0x47')];if(!_0x500161['query'][_0xc7d6('0x4e')]('nolimit')){_0x1e35c5[_0xc7d6('0x32')]=qs[_0xc7d6('0x32')](_0x500161['query']['limit']);_0x1e35c5['offset']=qs[_0xc7d6('0x30')](_0x500161[_0xc7d6('0x48')][_0xc7d6('0x30')]);}_0x1e35c5['order']=qs[_0xc7d6('0x50')](_0x500161[_0xc7d6('0x48')][_0xc7d6('0x50')]);_0x1e35c5[_0xc7d6('0x51')]=qs[_0xc7d6('0x52')](_[_0xc7d6('0x53')](_0x500161['query'],_0x5b6aa2['filters']));_0x1e35c5['where'][_0xc7d6('0x6b')]=_0x47ac54['id'];if(_0x500161['query'][_0xc7d6('0x54')]){_0x1e35c5['where']=_['merge'](_0x1e35c5[_0xc7d6('0x51')],{'$or':_['map'](_0x1e35c5['attributes'],function(_0x4eb5d7){var _0x56bd9b={};_0x56bd9b[_0x4eb5d7]={'$like':'%'+_0x500161[_0xc7d6('0x48')]['filter']+'%'};return _0x56bd9b;})});}_0x1e35c5=_['merge']({},_0x1e35c5,_0x500161['options']);return db[_0xc7d6('0x69')][_0xc7d6('0x33')]({'where':_0x1e35c5['where']})[_0xc7d6('0x22')](function(_0x3b79a2){_0x49d311['count']=_0x3b79a2;if(_0x500161[_0xc7d6('0x48')][_0xc7d6('0x59')]){_0x1e35c5[_0xc7d6('0x5a')]=[{'all':!![]}];}return db[_0xc7d6('0x69')][_0xc7d6('0x6c')](_0x1e35c5);})[_0xc7d6('0x22')](function(_0x5eeaa8){_0x49d311[_0xc7d6('0x5b')]=_0x5eeaa8;return _0x49d311;});}})['then'](respondWithFilteredResult(_0x2b01b1,_0x1e35c5))['catch'](handleError(_0x2b01b1,null));};exports[_0xc7d6('0x6d')]=function(_0xac69c5,_0x4b57bc,_0x2daa29){return db[_0xc7d6('0x43')][_0xc7d6('0x5e')]({'where':{'id':_0xac69c5[_0xc7d6('0x5d')]['id']}})[_0xc7d6('0x22')](handleEntityNotFound(_0x4b57bc,null))[_0xc7d6('0x22')](function(_0x3bb255){if(_0x3bb255){return _0x3bb255[_0xc7d6('0x6d')](_0xac69c5[_0xc7d6('0x48')][_0xc7d6('0x6e')]);}})[_0xc7d6('0x22')](respondWithStatusCode(_0x4b57bc,null))[_0xc7d6('0x2c')](handleError(_0x4b57bc,null));};exports[_0xc7d6('0x6f')]=function(_0x27ff90,_0x148e55,_0x4a1ce2){if(_0x27ff90[_0xc7d6('0x60')]['id']){delete _0x27ff90['body']['id'];}return db[_0xc7d6('0x43')][_0xc7d6('0x5e')]({'where':{'id':_0x27ff90[_0xc7d6('0x5d')]['id']}})[_0xc7d6('0x22')](handleEntityNotFound(_0x148e55,null))[_0xc7d6('0x22')](function(_0x170e86){if(_0x170e86){_0x27ff90[_0xc7d6('0x60')][_0xc7d6('0x6b')]=_0x170e86['id'];return db[_0xc7d6('0x70')][_0xc7d6('0x5f')](_0x27ff90[_0xc7d6('0x60')]);}})[_0xc7d6('0x22')](respondWithResult(_0x148e55,null))[_0xc7d6('0x2c')](handleError(_0x148e55,null));};exports[_0xc7d6('0x71')]=function(_0x32a922,_0x33bc53,_0x18d761){var _0x4b4423={'raw':![],'where':{}};var _0xfb479c={};var _0x536a9b={'count':0x0,'rows':[]};return db[_0xc7d6('0x43')][_0xc7d6('0x6a')]({'where':{'id':_0x32a922[_0xc7d6('0x5d')]['id']}})[_0xc7d6('0x22')](handleEntityNotFound(_0x33bc53,null))[_0xc7d6('0x22')](function(_0x39c9df){if(_0x39c9df){_0xfb479c[_0xc7d6('0x47')]=_[_0xc7d6('0x49')](db[_0xc7d6('0x70')][_0xc7d6('0x44')]);_0xfb479c['query']=_[_0xc7d6('0x49')](_0x32a922[_0xc7d6('0x48')]);_0xfb479c['filters']=_[_0xc7d6('0x4a')](_0xfb479c[_0xc7d6('0x47')],_0xfb479c[_0xc7d6('0x48')]);_0x4b4423[_0xc7d6('0x4c')]=_[_0xc7d6('0x4a')](_0xfb479c[_0xc7d6('0x47')],qs[_0xc7d6('0x4b')](_0x32a922['query'][_0xc7d6('0x4b')]));_0x4b4423[_0xc7d6('0x4c')]=_0x4b4423[_0xc7d6('0x4c')][_0xc7d6('0x4d')]?_0x4b4423[_0xc7d6('0x4c')]:_0xfb479c[_0xc7d6('0x47')];if(!_0x32a922[_0xc7d6('0x48')][_0xc7d6('0x4e')](_0xc7d6('0x4f'))){_0x4b4423[_0xc7d6('0x32')]=qs['limit'](_0x32a922[_0xc7d6('0x48')][_0xc7d6('0x32')]);_0x4b4423[_0xc7d6('0x30')]=qs[_0xc7d6('0x30')](_0x32a922[_0xc7d6('0x48')][_0xc7d6('0x30')]);}_0x4b4423[_0xc7d6('0x72')]=qs[_0xc7d6('0x50')](_0x32a922[_0xc7d6('0x48')][_0xc7d6('0x50')]);_0x4b4423['where']=qs['filters'](_['pick'](_0x32a922[_0xc7d6('0x48')],_0xfb479c[_0xc7d6('0x52')]));_0x4b4423[_0xc7d6('0x51')][_0xc7d6('0x6b')]=_0x39c9df['id'];if(_0x32a922[_0xc7d6('0x48')]['filter']){_0x4b4423[_0xc7d6('0x51')]=_[_0xc7d6('0x55')](_0x4b4423[_0xc7d6('0x51')],{'$or':_[_0xc7d6('0x42')](_0x4b4423[_0xc7d6('0x4c')],function(_0x4af637){var _0x9df0ea={};_0x9df0ea[_0x4af637]={'$like':'%'+_0x32a922[_0xc7d6('0x48')][_0xc7d6('0x54')]+'%'};return _0x9df0ea;})});}_0x4b4423=_[_0xc7d6('0x55')]({},_0x4b4423,_0x32a922[_0xc7d6('0x58')]);return db[_0xc7d6('0x70')][_0xc7d6('0x33')]({'where':_0x4b4423[_0xc7d6('0x51')]})[_0xc7d6('0x22')](function(_0x2b08b9){_0x536a9b[_0xc7d6('0x33')]=_0x2b08b9;if(_0x32a922['query'][_0xc7d6('0x59')]){_0x4b4423[_0xc7d6('0x5a')]=[{'all':!![]}];}return db[_0xc7d6('0x70')][_0xc7d6('0x6c')](_0x4b4423);})[_0xc7d6('0x22')](function(_0x16f497){_0x536a9b[_0xc7d6('0x5b')]=_0x16f497;return _0x536a9b;});}})[_0xc7d6('0x22')](respondWithFilteredResult(_0x33bc53,_0x4b4423))['catch'](handleError(_0x33bc53,null));};exports['removeAnswers']=function(_0xfc0b8e,_0x5edc2f,_0xa5bb0e){return db['FaxAccount'][_0xc7d6('0x5e')]({'where':{'id':_0xfc0b8e[_0xc7d6('0x5d')]['id']}})['then'](handleEntityNotFound(_0x5edc2f,null))['then'](function(_0x35fd22){if(_0x35fd22){return _0x35fd22['removeAnswers'](_0xfc0b8e['query']['ids']);}})[_0xc7d6('0x22')](respondWithStatusCode(_0x5edc2f,null))[_0xc7d6('0x2c')](handleError(_0x5edc2f,null));};exports[_0xc7d6('0x73')]=function(_0x4f3c4a,_0x2582e9,_0x38e26a){return db['FaxInteraction'][_0xc7d6('0x5e')]({'where':{'id':_0x4f3c4a[_0xc7d6('0x5d')]['id']}})[_0xc7d6('0x22')](handleEntityNotFound(_0x2582e9,null))[_0xc7d6('0x22')](function(_0x40eedd){if(_0x40eedd){return _0x40eedd[_0xc7d6('0x73')](_0x4f3c4a[_0xc7d6('0x60')][_0xc7d6('0x6e')],_['omit'](_0x4f3c4a[_0xc7d6('0x60')],['ids','id'])||{});}})[_0xc7d6('0x22')](respondWithResult(_0x2582e9,null))[_0xc7d6('0x2c')](handleError(_0x2582e9,null));};exports['getInteractions']=function(_0x47944a,_0x25e3ac,_0x42fd32){var _0x54531a={'raw':![],'where':{}};var _0x588882={};var _0x3fa0c6={'count':0x0,'rows':[]};return db[_0xc7d6('0x43')][_0xc7d6('0x6a')]({'where':{'id':_0x47944a[_0xc7d6('0x5d')]['id']}})['then'](handleEntityNotFound(_0x25e3ac,null))[_0xc7d6('0x22')](function(_0x10d3f8){if(_0x10d3f8){_0x588882['model']=_['keys'](db[_0xc7d6('0x74')][_0xc7d6('0x44')]);_0x588882[_0xc7d6('0x48')]=_[_0xc7d6('0x49')](_0x47944a[_0xc7d6('0x48')]);_0x588882['filters']=_['intersection'](_0x588882[_0xc7d6('0x47')],_0x588882[_0xc7d6('0x48')]);_0x54531a[_0xc7d6('0x4c')]=_[_0xc7d6('0x4a')](_0x588882[_0xc7d6('0x47')],qs[_0xc7d6('0x4b')](_0x47944a[_0xc7d6('0x48')][_0xc7d6('0x4b')]));_0x54531a[_0xc7d6('0x4c')]=_0x54531a[_0xc7d6('0x4c')]['length']?_0x54531a[_0xc7d6('0x4c')]:_0x588882[_0xc7d6('0x47')];if(!_0x47944a['query'][_0xc7d6('0x4e')](_0xc7d6('0x4f'))){_0x54531a[_0xc7d6('0x32')]=qs['limit'](_0x47944a[_0xc7d6('0x48')][_0xc7d6('0x32')]);_0x54531a[_0xc7d6('0x30')]=qs[_0xc7d6('0x30')](_0x47944a[_0xc7d6('0x48')][_0xc7d6('0x30')]);}_0x54531a[_0xc7d6('0x72')]=qs[_0xc7d6('0x50')](_0x47944a[_0xc7d6('0x48')]['sort']);_0x54531a[_0xc7d6('0x51')]=qs[_0xc7d6('0x52')](_[_0xc7d6('0x53')](_0x47944a[_0xc7d6('0x48')],_0x588882[_0xc7d6('0x52')]));_0x54531a[_0xc7d6('0x51')][_0xc7d6('0x6b')]=_0x10d3f8['id'];if(_0x47944a['query'][_0xc7d6('0x54')]){_0x54531a['where']=_[_0xc7d6('0x55')](_0x54531a[_0xc7d6('0x51')],{'$or':_['map'](_0x54531a[_0xc7d6('0x4c')],function(_0x5c2779){var _0xd5ff2b={};_0xd5ff2b[_0x5c2779]={'$like':'%'+_0x47944a['query']['filter']+'%'};return _0xd5ff2b;})});}_0x54531a=_[_0xc7d6('0x55')]({},_0x54531a,_0x47944a['options']);return db[_0xc7d6('0x74')][_0xc7d6('0x33')]({'where':_0x54531a['where']})['then'](function(_0x1ef911){_0x3fa0c6[_0xc7d6('0x33')]=_0x1ef911;if(_0x47944a[_0xc7d6('0x48')][_0xc7d6('0x59')]){_0x54531a['include']=[{'model':db[_0xc7d6('0x75')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xc7d6('0x76'),'attributes':[_0xc7d6('0x3d'),_0xc7d6('0x77'),_0xc7d6('0x78')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name',_0xc7d6('0x79')],'where':_0x47944a['query'][_0xc7d6('0x7a')]?{'id':_0x47944a[_0xc7d6('0x48')][_0xc7d6('0x7a')]}:undefined,'required':_0x47944a['query']['tag']?!![]:![]}];}return db[_0xc7d6('0x74')]['findAll'](_0x54531a);})[_0xc7d6('0x22')](function(_0x3d76c9){_0x3fa0c6[_0xc7d6('0x5b')]=_0x3d76c9;return _0x3fa0c6;});}})['then'](respondWithFilteredResult(_0x25e3ac,_0x54531a))[_0xc7d6('0x2c')](handleError(_0x25e3ac,null));};exports[_0xc7d6('0x7b')]=function(_0x5d8c1f,_0x19b4d6){var _0x38eaf6=_0x5d8c1f['params']['id'];var _0x292ca1=_0x5d8c1f['body'];var _0x5d4337=0xc8;var _0x26ea59=null;return db['sequelize'][_0xc7d6('0x7c')]({'isolationLevel':db[_0xc7d6('0x7d')][_0xc7d6('0x7e')][_0xc7d6('0x7f')]['READ_COMMITTED']},function(_0x1a4d73){return db[_0xc7d6('0x43')][_0xc7d6('0x6a')]({'where':{'id':_0x38eaf6},'transaction':_0x1a4d73})['then'](function(_0x244e3d){if(_0x244e3d){return db['FaxApplication'][_0xc7d6('0x38')]({'where':{'FaxAccountId':_0x38eaf6},'transaction':_0x1a4d73})[_0xc7d6('0x22')](function(){var _0x8b998d=_[_0xc7d6('0x42')](_0x292ca1,function(_0xa63180){_0xa63180['FaxAccountId']=_0x38eaf6;return _0xa63180;});return db['FaxApplication'][_0xc7d6('0x80')](_0x8b998d,{'transaction':_0x1a4d73});});}else{_0x5d4337=0x194;_0x26ea59=[];}});})[_0xc7d6('0x22')](function(){if(_0x5d4337!==0x194){return db[_0xc7d6('0x81')][_0xc7d6('0x82')]({'where':{'FaxAccountId':_0x38eaf6},'order':_0xc7d6('0x83')})['then'](function(_0x42106c){_0x26ea59=_0x42106c;});}})[_0xc7d6('0x2c')](function(_0x819e88){_0x5d4337=0x1f4;logger['error'](_0x819e88[_0xc7d6('0x3c')]);if(_0x819e88['name']){delete _0x819e88[_0xc7d6('0x3d')];}_0x26ea59=_0x819e88;})[_0xc7d6('0x84')](function(){if(_0x26ea59===null){_0x19b4d6[_0xc7d6('0x2d')](_0x5d4337);}else{if(_0x5d4337===0x1f4){_0x19b4d6[_0xc7d6('0x3b')](_0x5d4337)[_0xc7d6('0x3e')](_0x26ea59);}else{_0x19b4d6[_0xc7d6('0x3b')](_0x5d4337)[_0xc7d6('0x2f')](_0x26ea59);}}});};exports[_0xc7d6('0x85')]=function(_0xc90819,_0x478881,_0x1c0c94){var _0x5910a5={};var _0x5e4670={};var _0x58624c;var _0x8b7dc0;return db[_0xc7d6('0x43')][_0xc7d6('0x6a')]({'where':{'id':_0xc90819['params']['id']}})['then'](handleEntityNotFound(_0x478881,null))['then'](function(_0x44da58){if(_0x44da58){_0x58624c=_0x44da58;_0x5e4670[_0xc7d6('0x47')]=_[_0xc7d6('0x49')](db[_0xc7d6('0x81')]['rawAttributes']);_0x5e4670['query']=_['keys'](_0xc90819['query']);_0x5e4670['filters']=_[_0xc7d6('0x4a')](_0x5e4670['model'],_0x5e4670[_0xc7d6('0x48')]);_0x5910a5[_0xc7d6('0x4c')]=_[_0xc7d6('0x4a')](_0x5e4670[_0xc7d6('0x47')],qs['fields'](_0xc90819[_0xc7d6('0x48')]['fields']));_0x5910a5[_0xc7d6('0x4c')]=_0x5910a5[_0xc7d6('0x4c')][_0xc7d6('0x4d')]?_0x5910a5['attributes']:_0x5e4670['model'];_0x5910a5['order']=qs[_0xc7d6('0x50')](_0xc90819[_0xc7d6('0x48')][_0xc7d6('0x50')]);_0x5910a5['where']=qs[_0xc7d6('0x52')](_[_0xc7d6('0x53')](_0xc90819[_0xc7d6('0x48')],_0x5e4670[_0xc7d6('0x52')]));if(_0xc90819['query']['filter']){_0x5910a5['where']=_[_0xc7d6('0x55')](_0x5910a5['where'],{'$or':_['map'](_0x5910a5[_0xc7d6('0x4c')],function(_0x1a47bd){var _0x154653={};_0x154653[_0x1a47bd]={'$like':'%'+_0xc90819[_0xc7d6('0x48')][_0xc7d6('0x54')]+'%'};return _0x154653;})});}_0x5910a5=_[_0xc7d6('0x55')]({},_0x5910a5,_0xc90819[_0xc7d6('0x58')]);return _0x58624c[_0xc7d6('0x85')](_0x5910a5);}})[_0xc7d6('0x22')](function(_0x47a829){if(_0x47a829){_0x8b7dc0=_0x47a829[_0xc7d6('0x4d')];if(!_0xc90819[_0xc7d6('0x48')][_0xc7d6('0x4e')](_0xc7d6('0x4f'))){_0x5910a5[_0xc7d6('0x32')]=qs[_0xc7d6('0x32')](_0xc90819[_0xc7d6('0x48')][_0xc7d6('0x32')]);_0x5910a5[_0xc7d6('0x30')]=qs[_0xc7d6('0x30')](_0xc90819[_0xc7d6('0x48')][_0xc7d6('0x30')]);}return _0x58624c[_0xc7d6('0x85')](_0x5910a5);}})['then'](function(_0x386313){if(_0x386313){return _0x386313?{'count':_0x8b7dc0,'rows':_0x386313}:null;}})[_0xc7d6('0x22')](respondWithResult(_0x478881,null))['catch'](handleError(_0x478881,null));};function Extension(_0x1fc22f,_0x1cb01b,_0x27b423,_0x4ff7bc){this['context']=_0xc7d6('0x86');this['exten']=_0x1fc22f[_0xc7d6('0x87')];this[_0xc7d6('0x88')]=_0x4ff7bc;this['type']=_0xc7d6('0x89');this[_0xc7d6('0x8a')]='Fax\x20Extension';this[_0xc7d6('0x6b')]=_0x1fc22f['id'];this[_0xc7d6('0x83')]=_0x1cb01b;this['appdata']=_0x27b423;}function createExtensionsReciveFax(_0xd4b212){var _0xbce6de=0x1;var _0x4b5675=[];_0x4b5675[_0xc7d6('0x8b')](new Extension(_0xd4b212,_0xbce6de,'',_0xc7d6('0x8c')));_0xbce6de+=0x1;_0x4b5675[_0xc7d6('0x8b')](new Extension(_0xd4b212,_0xbce6de,'CDR(type)=inbound-fax','Set'));_0xbce6de+=0x1;for(var _0x60f44f in _0xd4b212){if(_0xd4b212[_0xc7d6('0x4e')](_0x60f44f)&&(_0x60f44f===_0xc7d6('0x8d')||_0x60f44f===_0xc7d6('0x87')||_0x60f44f===_0xc7d6('0x8e')||_0x60f44f===_0xc7d6('0x8f')||_0x60f44f===_0xc7d6('0x90')||_0x60f44f===_0xc7d6('0x91')||_0x60f44f===_0xc7d6('0x92')||_0x60f44f===_0xc7d6('0x93')||_0x60f44f===_0xc7d6('0x94'))){_0x4b5675[_0xc7d6('0x8b')](new Extension(_0xd4b212,_0xbce6de,_0xc7d6('0x95')+_0x60f44f+')='+_0xd4b212[_0x60f44f],'Set'));_0xbce6de+=0x1;}}_0x4b5675[_0xc7d6('0x8b')](new Extension(_0xd4b212,_0xbce6de,'6',_0xc7d6('0x96')));_0xbce6de+=0x1;_0x4b5675[_0xc7d6('0x8b')](new Extension(_0xd4b212,_0xbce6de,'/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',_0xc7d6('0x97')));_0xbce6de=0x0;return _0x4b5675;}exports[_0xc7d6('0x98')]=function(_0xbcc966,_0x1c36e5,_0x4e5762){var _0x20cc9f;return db['sequelize'][_0xc7d6('0x7c')](function(_0x1cc8b0){return db[_0xc7d6('0x43')]['create'](_0xbcc966['body'],{'transaction':_0x1cc8b0})['then'](function(_0x3db237){_0x20cc9f=_0x3db237[_0xc7d6('0x39')]({'plain':!![]});return db['VoiceExtension'][_0xc7d6('0x80')](createExtensionsReciveFax(_0x20cc9f),{'transaction':_0x1cc8b0});});})[_0xc7d6('0x22')](function(){return _0x20cc9f;})[_0xc7d6('0x22')](respondWithResult(_0x1c36e5,null))['catch'](handleError(_0x1c36e5,null));};exports[_0xc7d6('0x99')]=function(_0x46e9ba,_0x12f9e2,_0x42497d){var _0x5097f4;return db['sequelize'][_0xc7d6('0x7c')](function(_0x28ee3f){return db[_0xc7d6('0x43')]['update'](_0x46e9ba[_0xc7d6('0x60')],{'where':{'id':_0x46e9ba[_0xc7d6('0x60')]['id']},'transaction':_0x28ee3f})[_0xc7d6('0x22')](function(_0x325bac){return db[_0xc7d6('0x9a')][_0xc7d6('0x38')]({'where':{'FaxAccountId':_0x46e9ba['body']['id']},'transaction':_0x28ee3f})[_0xc7d6('0x22')](function(_0x76d31){return db[_0xc7d6('0x9a')]['bulkCreate'](createExtensionsReciveFax(_[_0xc7d6('0x9b')](_0x46e9ba[_0xc7d6('0x60')],[_0xc7d6('0x9c'),_0xc7d6('0x46'),'createdAt',_0xc7d6('0x9d'),'TrunkId',_0xc7d6('0x9e')])),{'transaction':_0x28ee3f});});});})[_0xc7d6('0x22')](function(){return db[_0xc7d6('0x43')][_0xc7d6('0x9f')](_0x46e9ba[_0xc7d6('0x60')]['id']);})[_0xc7d6('0x22')](respondWithResult(_0x12f9e2,null))[_0xc7d6('0x2c')](handleError(_0x12f9e2,null));};exports[_0xc7d6('0xa0')]=function(_0xac9e1e,_0x12766f,_0xf0858d){var _0x5658ca={'raw':!![],'where':{}};var _0x5864a9={};var _0x120458={'count':0x0,'rows':[]};return db['FaxAccount'][_0xc7d6('0x6a')]({'where':{'id':_0xac9e1e['params']['id']}})['then'](handleEntityNotFound(_0x12766f,null))['then'](function(_0x326f2a){if(_0x326f2a){_0x5864a9[_0xc7d6('0x47')]=_['keys'](db[_0xc7d6('0xa1')][_0xc7d6('0x44')]);_0x5864a9['query']=_[_0xc7d6('0x49')](_0xac9e1e[_0xc7d6('0x48')]);_0x5864a9['filters']=_['intersection'](_0x5864a9['model'],_0x5864a9[_0xc7d6('0x48')]);_0x5658ca[_0xc7d6('0x4c')]=_['intersection'](_0x5864a9[_0xc7d6('0x47')],qs[_0xc7d6('0x4b')](_0xac9e1e[_0xc7d6('0x48')]['fields']));_0x5658ca[_0xc7d6('0x4c')]=_0x5658ca[_0xc7d6('0x4c')][_0xc7d6('0x4d')]?_0x5658ca[_0xc7d6('0x4c')]:_0x5864a9[_0xc7d6('0x47')];if(!_0xac9e1e[_0xc7d6('0x48')][_0xc7d6('0x4e')](_0xc7d6('0x4f'))){_0x5658ca[_0xc7d6('0x32')]=qs['limit'](_0xac9e1e[_0xc7d6('0x48')][_0xc7d6('0x32')]);_0x5658ca[_0xc7d6('0x30')]=qs[_0xc7d6('0x30')](_0xac9e1e[_0xc7d6('0x48')][_0xc7d6('0x30')]);}_0x5658ca[_0xc7d6('0x72')]=qs['sort'](_0xac9e1e[_0xc7d6('0x48')]['sort']);_0x5658ca[_0xc7d6('0x51')]=qs['filters'](_[_0xc7d6('0x53')](_0xac9e1e[_0xc7d6('0x48')],_0x5864a9[_0xc7d6('0x52')]));_0x5658ca[_0xc7d6('0x51')][_0xc7d6('0x6b')]=_0x326f2a['id'];if(_0xac9e1e['query'][_0xc7d6('0x54')]){_0x5658ca[_0xc7d6('0x51')]=_['merge'](_0x5658ca[_0xc7d6('0x51')],{'$or':_['map'](_0x5658ca[_0xc7d6('0x4c')],function(_0x2ad8df){var _0x38f08e={};_0x38f08e[_0x2ad8df]={'$like':'%'+_0xac9e1e['query'][_0xc7d6('0x54')]+'%'};return _0x38f08e;})});}if(_0xac9e1e[_0xc7d6('0x48')][_0xc7d6('0xa2')]){var _0xffc116=_0xac9e1e[_0xc7d6('0x48')][_0xc7d6('0xa2')][_0xc7d6('0xa3')](',');var _0xf18fc4={};_0xf18fc4[_0xffc116[0x0]]={'$gte':moment(_0xffc116[0x1])[_0xc7d6('0xa4')](_0xc7d6('0xa5'))};_0x5658ca['where']=_[_0xc7d6('0x55')](_0x5658ca[_0xc7d6('0x51')],_0xf18fc4);}_0x5658ca=_[_0xc7d6('0x55')]({},_0x5658ca,_0xac9e1e[_0xc7d6('0x58')]);return db[_0xc7d6('0xa1')][_0xc7d6('0x33')]({'where':_0x5658ca[_0xc7d6('0x51')]})[_0xc7d6('0x22')](function(_0x35219b){_0x120458[_0xc7d6('0x33')]=_0x35219b;if(_0xac9e1e[_0xc7d6('0x48')]['includeAll']){_0x5658ca[_0xc7d6('0x5a')]=[{'all':!![]}];}return db[_0xc7d6('0xa1')]['findAll'](_0x5658ca);})['then'](function(_0x63576a){_0x120458[_0xc7d6('0x5b')]=_0x63576a;return _0x120458;});}})[_0xc7d6('0x22')](respondWithFilteredResult(_0x12766f,_0x5658ca))[_0xc7d6('0x2c')](handleError(_0x12766f,null));};exports[_0xc7d6('0x3e')]=function(_0x373fa9,_0x1314ab,_0x42d3e9){var _0x546fbc,_0x1663b4={},_0x924c97;if(_0x373fa9[_0xc7d6('0x60')]['to']){_0x924c97=_0x373fa9[_0xc7d6('0x60')]['to'][0x0];}return db[_0xc7d6('0x43')]['find']({'where':{'id':_0x373fa9[_0xc7d6('0x5d')]['id']},'include':[{'model':db[_0xc7d6('0xa6')],'as':'List','include':[{'model':db['CmContact'],'as':_0xc7d6('0xa7'),'where':{'fax':_0x924c97},'limit':0x1,'order':[['updatedAt',_0xc7d6('0xa8')]]}]}]})['then'](handleEntityNotFound(_0x1314ab,null))[_0xc7d6('0x22')](function(_0x4aa1e1){_0x546fbc=_0x4aa1e1;if(_0x373fa9[_0xc7d6('0x60')][_0xc7d6('0xa9')]&&_0x373fa9[_0xc7d6('0x60')][_0xc7d6('0xa9')][_0xc7d6('0x4d')]){for(var _0x3996ae=0x0;_0x3996ae<_0x373fa9[_0xc7d6('0x60')][_0xc7d6('0xa9')][_0xc7d6('0x4d')];_0x3996ae+=0x1){_0x373fa9[_0xc7d6('0x60')][_0xc7d6('0xa9')][_0x3996ae]={'filename':_0x373fa9[_0xc7d6('0x60')]['attachments'][_0x3996ae]['name'],'id':_0x373fa9[_0xc7d6('0x60')][_0xc7d6('0xa9')][_0x3996ae]['id'],'path':path[_0xc7d6('0xaa')](config['root'],_0xc7d6('0xab'),_0x373fa9[_0xc7d6('0x60')][_0xc7d6('0xa9')][_0x3996ae][_0xc7d6('0xac')])};}}return respondWithRpcPromise(_0xc7d6('0xad'),'CheckAfterSend',{'FaxAccountId':_['isNil'](_0x373fa9['params']['id'])?undefined:_0x373fa9[_0xc7d6('0x5d')]['id'],'path':_[_0xc7d6('0xae')](_0x373fa9[_0xc7d6('0x60')][_0xc7d6('0xa9')][0x0][_0xc7d6('0x8')])?undefined:_0x373fa9['body']['attachments'][0x0][_0xc7d6('0x8')],'fax':_[_0xc7d6('0xae')](_0x373fa9[_0xc7d6('0x60')]['to'][0x0])?undefined:_0x373fa9[_0xc7d6('0x60')]['to'][0x0]},client9002);})[_0xc7d6('0x22')](function(){if(_0x546fbc){if(_[_0xc7d6('0xae')](_0x373fa9['body'][_0xc7d6('0xaf')])){_0x373fa9[_0xc7d6('0x60')][_0xc7d6('0xaf')]=util[_0xc7d6('0xa4')](_0xc7d6('0xb0'),_0x546fbc[_0xc7d6('0x3d')],_0x546fbc[_0xc7d6('0xb1')]);}if(_0x546fbc[_0xc7d6('0xb2')]){if(_0x546fbc[_0xc7d6('0xb2')][_0xc7d6('0xa7')]['length']){return _0x546fbc[_0xc7d6('0xb2')][_0xc7d6('0xa7')][0x0];}else{return db[_0xc7d6('0x75')][_0xc7d6('0x5f')](_[_0xc7d6('0x1c')](_0x373fa9[_0xc7d6('0x60')],{'firstName':_0x373fa9[_0xc7d6('0x60')]['to'][0x0],'phone':_0x373fa9[_0xc7d6('0x60')]['to'][0x0],'fax':_0x373fa9[_0xc7d6('0x60')]['to'][0x0],'ListId':_0x546fbc['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xc7d6('0x22')](function(_0x1ef8f1){if(_0x1ef8f1){return db['FaxInteraction'][_0xc7d6('0x5e')]({'where':{'ContactId':_0x1ef8f1['id'],'closed':![],'FaxAccountId':_0x546fbc['id']}})[_0xc7d6('0x22')](function(_0x33046a){if(_0x33046a){return[_0x33046a,![]];}return db[_0xc7d6('0x74')][_0xc7d6('0x5f')]({'UserId':_0x373fa9[_0xc7d6('0x63')]['id'],'ContactId':_0x1ef8f1['id'],'FaxAccountId':_0x546fbc['id'],'fax':_0x373fa9['body']['to'][0x0],'firstMsgDirection':_0xc7d6('0xb3'),'Messages':[_['merge'](_0x373fa9['body'],{'read':![],'body':_0x373fa9['body']['attachments'][0x0][_0xc7d6('0xb4')],'FaxAccountId':_0x546fbc['id'],'UserId':_0x373fa9[_0xc7d6('0x63')]['id'],'ContactId':_0x1ef8f1['id'],'AttachmentId':_0x373fa9[_0xc7d6('0x60')][_0xc7d6('0xa9')][0x0]['id']})]},{'include':[{'model':db[_0xc7d6('0xa1')],'as':_0xc7d6('0xb5')}]})['then'](function(_0x5a6513){return[_0x5a6513,!![]];});});}else{throw new Error(_0xc7d6('0xb6'));}})['spread'](function(_0x55102b,_0x2754f0){if(_0x2754f0){return _0x55102b;}return db['FaxMessage'][_0xc7d6('0x5f')]({'direction':_0xc7d6('0xb3'),'read':![],'body':_0x373fa9[_0xc7d6('0x60')]['attachments'][0x0][_0xc7d6('0xb4')],'FaxAccountId':_0x546fbc['id'],'FaxInteractionId':_0x55102b['id'],'UserId':_0x373fa9['user']['id'],'ContactId':_0x55102b[_0xc7d6('0xb7')],'AttachmentId':_0x373fa9[_0xc7d6('0x60')][_0xc7d6('0xa9')][0x0]['id']})[_0xc7d6('0x22')](function(_0x549e54){_0x55102b[_0xc7d6('0xb8')]['Messages']=[];_0x55102b[_0xc7d6('0xb8')][_0xc7d6('0xb5')][_0xc7d6('0x8b')](_0x549e54['dataValues']);return _0x55102b;});})[_0xc7d6('0x22')](function(_0x33d085){respondWithRpcPromise('SendFax',_0xc7d6('0xb9'),{'FaxAccountId':_['isNil'](_0x373fa9[_0xc7d6('0x5d')]['id'])?undefined:_0x373fa9[_0xc7d6('0x5d')]['id'],'path':_[_0xc7d6('0xae')](_0x373fa9[_0xc7d6('0x60')]['attachments'][0x0]['path'])?undefined:_0x373fa9['body'][_0xc7d6('0xa9')][0x0]['path'],'fax':_[_0xc7d6('0xae')](_0x373fa9[_0xc7d6('0x60')]['to'][0x0])?undefined:_0x373fa9['body']['to'][0x0],'AttachmentId':_0x373fa9[_0xc7d6('0x60')][_0xc7d6('0xa9')][0x0]['id']},client9002)[_0xc7d6('0x22')](function(_0x53d930){logger[_0xc7d6('0xba')]('SendFaxRpc,\x20%s',_0x53d930);})[_0xc7d6('0x2c')](function(_0x16d0fd){logger[_0xc7d6('0xba')]('SendFaxRpc,\x20%s',_0x16d0fd);});return _0x33d085;})[_0xc7d6('0x22')](respondWithResult(_0x1314ab,null))[_0xc7d6('0x2c')](handleError(_0x1314ab,null));};exports[_0xc7d6('0xbb')]=function(_0x509167,_0xa1796c,_0xe2fb39){return db[_0xc7d6('0x43')]['find']({'where':{'id':_0x509167['params']['id']}})[_0xc7d6('0x22')](handleEntityNotFound(_0xa1796c,null))['then'](function(_0x25227f){if(_0x25227f){return _0x25227f['addAgents'](_0x509167['body']['ids'],_[_0xc7d6('0x9b')](_0x509167['body'],[_0xc7d6('0x6e'),'id'])||{})[_0xc7d6('0xbc')](function(_0x3cefb3){for(var _0x250b0e=0x0;_0x250b0e<_0x509167[_0xc7d6('0x60')][_0xc7d6('0x6e')][_0xc7d6('0x4d')];_0x250b0e+=0x1){socket[_0xc7d6('0xbd')](_0xc7d6('0xbe'),{'UserId':Number(_0x509167[_0xc7d6('0x60')]['ids'][_0x250b0e]),'FaxAccountId':Number(_0x509167[_0xc7d6('0x5d')]['id'])});}return _0x3cefb3;});}})['then'](respondWithResult(_0xa1796c,null))[_0xc7d6('0x2c')](handleError(_0xa1796c,null));};exports[_0xc7d6('0xbf')]=function(_0x32631e,_0xda48ae,_0x128eb9){return db['FaxAccount'][_0xc7d6('0x5e')]({'where':{'id':_0x32631e[_0xc7d6('0x5d')]['id']}})['then'](handleEntityNotFound(_0xda48ae,null))['then'](function(_0x328c33){if(_0x328c33){return _0x328c33[_0xc7d6('0xbf')](_0x32631e[_0xc7d6('0x48')]['ids'])['then'](function(){if(_[_0xc7d6('0xc0')](_0x32631e['query'][_0xc7d6('0x6e')])){for(var _0x41ebef=0x0;_0x41ebef<_0x32631e[_0xc7d6('0x48')][_0xc7d6('0x6e')][_0xc7d6('0x4d')];_0x41ebef+=0x1){socket[_0xc7d6('0xbd')]('userFaxAccount:remove',{'UserId':Number(_0x32631e[_0xc7d6('0x48')]['ids'][_0x41ebef]),'FaxAccountId':Number(_0x32631e[_0xc7d6('0x5d')]['id'])});}}else{socket[_0xc7d6('0xbd')](_0xc7d6('0xc1'),{'UserId':Number(_0x32631e[_0xc7d6('0x48')][_0xc7d6('0x6e')]),'FaxAccountId':Number(_0x32631e[_0xc7d6('0x5d')]['id'])});}});}})[_0xc7d6('0x22')](respondWithStatusCode(_0xda48ae,null))[_0xc7d6('0x2c')](handleError(_0xda48ae,null));};exports[_0xc7d6('0xc2')]=function(_0x5ec646,_0x366c0b,_0x19b824){var _0x448fc3={};var _0xcce900={};var _0x53d1c5;var _0x25edb7;return db[_0xc7d6('0x43')][_0xc7d6('0x6a')]({'where':{'id':_0x5ec646[_0xc7d6('0x5d')]['id']}})[_0xc7d6('0x22')](handleEntityNotFound(_0x366c0b,null))[_0xc7d6('0x22')](function(_0x429dc7){if(_0x429dc7){_0x53d1c5=_0x429dc7;_0xcce900[_0xc7d6('0x47')]=_[_0xc7d6('0x49')](db[_0xc7d6('0xc3')][_0xc7d6('0x44')]);_0xcce900[_0xc7d6('0x48')]=_[_0xc7d6('0x49')](_0x5ec646[_0xc7d6('0x48')]);_0xcce900['filters']=_[_0xc7d6('0x4a')](_0xcce900[_0xc7d6('0x47')],_0xcce900[_0xc7d6('0x48')]);_0x448fc3[_0xc7d6('0x4c')]=_[_0xc7d6('0x4a')](_0xcce900[_0xc7d6('0x47')],qs[_0xc7d6('0x4b')](_0x5ec646[_0xc7d6('0x48')]['fields']));_0x448fc3[_0xc7d6('0x4c')]=_0x448fc3[_0xc7d6('0x4c')][_0xc7d6('0x4d')]?_0x448fc3[_0xc7d6('0x4c')]:_0xcce900['model'];_0x448fc3['order']=qs['sort'](_0x5ec646[_0xc7d6('0x48')][_0xc7d6('0x50')]);_0x448fc3[_0xc7d6('0x51')]=qs[_0xc7d6('0x52')](_[_0xc7d6('0x53')](_0x5ec646[_0xc7d6('0x48')],_0xcce900['filters']));if(_0x5ec646[_0xc7d6('0x48')][_0xc7d6('0x54')]){_0x448fc3[_0xc7d6('0x51')]=_[_0xc7d6('0x55')](_0x448fc3[_0xc7d6('0x51')],{'$or':_[_0xc7d6('0x42')](_0x448fc3[_0xc7d6('0x4c')],function(_0x40c7e6){var _0x1cfc2f={};_0x1cfc2f[_0x40c7e6]={'$like':'%'+_0x5ec646[_0xc7d6('0x48')][_0xc7d6('0x54')]+'%'};return _0x1cfc2f;})});}_0x448fc3=_['merge']({},_0x448fc3,_0x5ec646[_0xc7d6('0x58')]);return _0x53d1c5[_0xc7d6('0xc2')](_0x448fc3);}})[_0xc7d6('0x22')](function(_0xaffd70){if(_0xaffd70){_0x25edb7=_0xaffd70['length'];if(!_0x5ec646[_0xc7d6('0x48')]['hasOwnProperty'](_0xc7d6('0x4f'))){_0x448fc3[_0xc7d6('0x32')]=qs[_0xc7d6('0x32')](_0x5ec646[_0xc7d6('0x48')]['limit']);_0x448fc3['offset']=qs['offset'](_0x5ec646['query'][_0xc7d6('0x30')]);}return _0x53d1c5[_0xc7d6('0xc2')](_0x448fc3);}})[_0xc7d6('0x22')](function(_0x49930d){if(_0x49930d){return _0x49930d?{'count':_0x25edb7,'rows':_0x49930d}:null;}})['then'](respondWithResult(_0x366c0b,null))['catch'](handleError(_0x366c0b,null));}; \ No newline at end of file +var _0xcc5f=['ecm','localstationid','headerinfo','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','key','createdAt','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','path','isNil','from','fax','List\x20not\x20found','out','filename','Messages','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','get','FaxAccounts','stack','name','send','index','map','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','FaxAccount','includeAll','include','findAll','rows','show','params','Pause','mandatoryDispositionPause','rawAttributes','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','UserProfileResource','describe','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','finally','getApplications','from-voip-provider','system','description','Fax\x20Extension','push','CDR(type)=inbound-fax','Set'];(function(_0x4fd109,_0x33c503){var _0x30f0a6=function(_0xc11c0d){while(--_0xc11c0d){_0x4fd109['push'](_0x4fd109['shift']());}};_0x30f0a6(++_0x33c503);}(_0xcc5f,0x1b3));var _0xfcc5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcc5f[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xfcc5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfcc5('0x1'));var jsonpatch=require(_0xfcc5('0x2'));var rp=require(_0xfcc5('0x3'));var moment=require(_0xfcc5('0x4'));var BPromise=require(_0xfcc5('0x5'));var Mustache=require('mustache');var util=require(_0xfcc5('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xfcc5('0x7'));var ejs=require(_0xfcc5('0x8'));var fs=require('fs');var fs_extra=require(_0xfcc5('0x9'));var _=require(_0xfcc5('0xa'));var squel=require(_0xfcc5('0xb'));var crypto=require(_0xfcc5('0xc'));var jsforce=require(_0xfcc5('0xd'));var deskjs=require(_0xfcc5('0xe'));var toCsv=require(_0xfcc5('0x7'));var querystring=require('querystring');var Papa=require(_0xfcc5('0xf'));var Redis=require(_0xfcc5('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfcc5('0x11'));var hardwareService=require(_0xfcc5('0x12'));var logger=require(_0xfcc5('0x13'))(_0xfcc5('0x14'));var utils=require(_0xfcc5('0x15'));var config=require(_0xfcc5('0x16'));var licenseUtil=require(_0xfcc5('0x17'));var db=require(_0xfcc5('0x18'))['db'];config['redis']=_[_0xfcc5('0x19')](config[_0xfcc5('0x1a')],{'host':_0xfcc5('0x1b'),'port':0x18eb});var socket=require(_0xfcc5('0x1c'))(new Redis(config[_0xfcc5('0x1a')]));require(_0xfcc5('0x1d'))[_0xfcc5('0x1e')](socket);var jayson=require(_0xfcc5('0x1f'));var client=jayson[_0xfcc5('0x20')][_0xfcc5('0x21')]({'port':0x232c});var client9002=jayson['client'][_0xfcc5('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x342735,_0x40088f,_0x59c7d6,_0x5e22eb){return new BPromise(function(_0x20985f,_0x618197){var _0x125fcb=_0x5e22eb||client;return _0x125fcb[_0xfcc5('0x22')](_0x342735,_0x59c7d6)[_0xfcc5('0x23')](function(_0x31aed6){logger[_0xfcc5('0x24')]('FaxAccount,\x20%s,\x20%s',_0x40088f,_0xfcc5('0x25'));logger[_0xfcc5('0x26')](_0xfcc5('0x27'),_0x40088f,'request\x20sent',JSON[_0xfcc5('0x28')](_0x31aed6));if(_0x31aed6[_0xfcc5('0x29')]){if(_0x31aed6[_0xfcc5('0x29')][_0xfcc5('0x2a')]===0x1f4){logger[_0xfcc5('0x29')](_0xfcc5('0x2b'),_0x40088f,_0x31aed6[_0xfcc5('0x29')][_0xfcc5('0x2c')]);return _0x618197(_0x31aed6[_0xfcc5('0x29')][_0xfcc5('0x2c')]);}logger[_0xfcc5('0x29')](_0xfcc5('0x2b'),_0x40088f,_0x31aed6[_0xfcc5('0x29')][_0xfcc5('0x2c')]);return _0x20985f(_0x31aed6[_0xfcc5('0x29')][_0xfcc5('0x2c')]);}else{logger[_0xfcc5('0x24')](_0xfcc5('0x2b'),_0x40088f,_0xfcc5('0x25'));_0x20985f(_0x31aed6[_0xfcc5('0x2d')]['message']);}})[_0xfcc5('0x2e')](function(_0x24441b){logger[_0xfcc5('0x29')](_0xfcc5('0x2b'),_0x40088f,_0x24441b);_0x618197(_0x24441b);});});}function respondWithStatusCode(_0x3fdced,_0x8546a){_0x8546a=_0x8546a||0xcc;return function(_0x493b87){if(_0x493b87){return _0x3fdced[_0xfcc5('0x2f')](_0x8546a);}return _0x3fdced[_0xfcc5('0x30')](_0x8546a)[_0xfcc5('0x31')]();};}function respondWithResult(_0x4e72c8,_0x11f005){_0x11f005=_0x11f005||0xc8;return function(_0x435ea2){if(_0x435ea2){return _0x4e72c8[_0xfcc5('0x30')](_0x11f005)[_0xfcc5('0x32')](_0x435ea2);}};}function respondWithFilteredResult(_0x4fe3d3,_0x1357ce){return function(_0x2dedb0){if(_0x2dedb0){var _0x21f730=typeof _0x1357ce[_0xfcc5('0x33')]==='undefined'&&typeof _0x1357ce['limit']===_0xfcc5('0x34');var _0x43a10d=_0x2dedb0[_0xfcc5('0x35')];var _0x2f808d=_0x21f730?0x0:_0x1357ce[_0xfcc5('0x33')];var _0x389912=_0x21f730?_0x2dedb0['count']:_0x1357ce[_0xfcc5('0x33')]+_0x1357ce[_0xfcc5('0x36')];var _0xcb8870;if(_0x389912>=_0x43a10d){_0x389912=_0x43a10d;_0xcb8870=0xc8;}else{_0xcb8870=0xce;}_0x4fe3d3[_0xfcc5('0x30')](_0xcb8870);return _0x4fe3d3['set'](_0xfcc5('0x37'),_0x2f808d+'-'+_0x389912+'/'+_0x43a10d)[_0xfcc5('0x32')](_0x2dedb0);}return null;};}function patchUpdates(_0x4e19e7){return function(_0x4f2aeb){try{jsonpatch[_0xfcc5('0x38')](_0x4f2aeb,_0x4e19e7,!![]);}catch(_0x4b1dbf){return BPromise[_0xfcc5('0x39')](_0x4b1dbf);}return _0x4f2aeb[_0xfcc5('0x3a')]();};}function saveUpdates(_0x2938b6,_0xf4e9c2){return function(_0x53cbc4){if(_0x53cbc4){return _0x53cbc4[_0xfcc5('0x3b')](_0x2938b6)['then'](function(_0x39aa4e){return _0x39aa4e;});}return null;};}function removeEntity(_0x1787de,_0x6ba9dd){return function(_0xabb60e){if(_0xabb60e){return _0xabb60e[_0xfcc5('0x3c')]()[_0xfcc5('0x23')](function(){var _0x22dc3e=_0xabb60e[_0xfcc5('0x3d')]({'plain':!![]});var _0x57f779=_0xfcc5('0x3e');return db['UserProfileResource']['destroy']({'where':{'type':_0x57f779,'resourceId':_0x22dc3e['id']}})[_0xfcc5('0x23')](function(){return _0xabb60e;});})[_0xfcc5('0x23')](function(){_0x1787de[_0xfcc5('0x30')](0xcc)[_0xfcc5('0x31')]();});}};}function handleEntityNotFound(_0x3229b7,_0x1cce3a){return function(_0x586bf0){if(!_0x586bf0){_0x3229b7[_0xfcc5('0x2f')](0x194);}return _0x586bf0;};}function handleError(_0x10c430,_0x5d0ab0){_0x5d0ab0=_0x5d0ab0||0x1f4;return function(_0x28e0eb){logger['error'](_0x28e0eb[_0xfcc5('0x3f')]);if(_0x28e0eb['name']){delete _0x28e0eb[_0xfcc5('0x40')];}_0x10c430[_0xfcc5('0x30')](_0x5d0ab0)[_0xfcc5('0x41')](_0x28e0eb);};}exports[_0xfcc5('0x42')]=function(_0x9aab3a,_0x3d518d){var _0x5b2cea={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x24936e={},_0x450277={'count':0x0,'rows':[]};var _0x2ca790=_[_0xfcc5('0x43')](db['FaxAccount']['rawAttributes'],function(_0x3091d5){return{'name':_0x3091d5[_0xfcc5('0x44')],'type':_0x3091d5[_0xfcc5('0x45')]['key']};});_0x24936e['model']=_[_0xfcc5('0x43')](_0x2ca790,_0xfcc5('0x40'));_0x24936e[_0xfcc5('0x46')]=_[_0xfcc5('0x47')](_0x9aab3a[_0xfcc5('0x46')]);_0x24936e[_0xfcc5('0x48')]=_[_0xfcc5('0x49')](_0x24936e[_0xfcc5('0x4a')],_0x24936e[_0xfcc5('0x46')]);_0x5b2cea[_0xfcc5('0x4b')]=_[_0xfcc5('0x49')](_0x24936e[_0xfcc5('0x4a')],qs[_0xfcc5('0x4c')](_0x9aab3a[_0xfcc5('0x46')]['fields']));_0x5b2cea[_0xfcc5('0x4b')]=_0x5b2cea[_0xfcc5('0x4b')][_0xfcc5('0x4d')]?_0x5b2cea[_0xfcc5('0x4b')]:_0x24936e[_0xfcc5('0x4a')];if(!_0x9aab3a[_0xfcc5('0x46')][_0xfcc5('0x4e')](_0xfcc5('0x4f'))){_0x5b2cea[_0xfcc5('0x36')]=qs['limit'](_0x9aab3a['query']['limit']);_0x5b2cea['offset']=qs[_0xfcc5('0x33')](_0x9aab3a[_0xfcc5('0x46')][_0xfcc5('0x33')]);}_0x5b2cea[_0xfcc5('0x50')]=qs['sort'](_0x9aab3a[_0xfcc5('0x46')][_0xfcc5('0x51')]);_0x5b2cea[_0xfcc5('0x52')]=qs[_0xfcc5('0x48')](_[_0xfcc5('0x53')](_0x9aab3a[_0xfcc5('0x46')],_0x24936e[_0xfcc5('0x48')]),_0x2ca790);if(_0x9aab3a[_0xfcc5('0x46')][_0xfcc5('0x54')]){_0x5b2cea[_0xfcc5('0x52')]=_['merge'](_0x5b2cea['where'],{'$or':_[_0xfcc5('0x43')](_0x2ca790,function(_0x2b6f80){if(_0x2b6f80[_0xfcc5('0x45')]!=='VIRTUAL'){var _0xe66dc7={};_0xe66dc7[_0x2b6f80[_0xfcc5('0x40')]]={'$like':'%'+_0x9aab3a[_0xfcc5('0x46')]['filter']+'%'};return _0xe66dc7;}})});}_0x5b2cea=_['merge']({},_0x5b2cea,_0x9aab3a[_0xfcc5('0x55')]);var _0x4b580a={'where':_0x5b2cea[_0xfcc5('0x52')]};return db[_0xfcc5('0x56')]['count'](_0x4b580a)[_0xfcc5('0x23')](function(_0x55849e){_0x450277[_0xfcc5('0x35')]=_0x55849e;if(_0x9aab3a['query'][_0xfcc5('0x57')]){_0x5b2cea[_0xfcc5('0x58')]=[{'all':!![]}];}return db[_0xfcc5('0x56')][_0xfcc5('0x59')](_0x5b2cea);})[_0xfcc5('0x23')](function(_0xcdafe5){_0x450277[_0xfcc5('0x5a')]=_0xcdafe5;return _0x450277;})[_0xfcc5('0x23')](respondWithFilteredResult(_0x3d518d,_0x5b2cea))[_0xfcc5('0x2e')](handleError(_0x3d518d,null));};exports[_0xfcc5('0x5b')]=function(_0x5e6bd0,_0x38b392){var _0x549014={'raw':![],'where':{'id':_0x5e6bd0[_0xfcc5('0x5c')]['id']},'include':[{'model':db[_0xfcc5('0x5d')],'as':_0xfcc5('0x5e')}]},_0x2ef2a3={};_0x2ef2a3['model']=_[_0xfcc5('0x47')](db[_0xfcc5('0x56')][_0xfcc5('0x5f')]);_0x2ef2a3[_0xfcc5('0x46')]=_[_0xfcc5('0x47')](_0x5e6bd0[_0xfcc5('0x46')]);_0x2ef2a3[_0xfcc5('0x48')]=_[_0xfcc5('0x49')](_0x2ef2a3[_0xfcc5('0x4a')],_0x2ef2a3['query']);_0x549014['attributes']=_[_0xfcc5('0x49')](_0x2ef2a3[_0xfcc5('0x4a')],qs[_0xfcc5('0x4c')](_0x5e6bd0['query'][_0xfcc5('0x4c')]));_0x549014[_0xfcc5('0x4b')]=_0x549014[_0xfcc5('0x4b')][_0xfcc5('0x4d')]?_0x549014[_0xfcc5('0x4b')]:_0x2ef2a3['model'];if(_0x5e6bd0[_0xfcc5('0x46')]['includeAll']){_0x549014['include']=[{'all':!![]}];}_0x549014=_[_0xfcc5('0x60')]({},_0x549014,_0x5e6bd0[_0xfcc5('0x55')]);return db[_0xfcc5('0x56')]['find'](_0x549014)['then'](handleEntityNotFound(_0x38b392,null))[_0xfcc5('0x23')](respondWithResult(_0x38b392,null))['catch'](handleError(_0x38b392,null));};exports['create']=function(_0x5209d5,_0x25fc38){return db[_0xfcc5('0x56')][_0xfcc5('0x61')](_0x5209d5[_0xfcc5('0x62')],{})[_0xfcc5('0x23')](function(_0x36902a){var _0x53d73f=_0x5209d5[_0xfcc5('0x63')][_0xfcc5('0x3d')]({'plain':!![]});if(!_0x53d73f)throw new Error(_0xfcc5('0x64'));if(_0x53d73f['role']===_0xfcc5('0x63')){var _0x56eb4c=_0x36902a[_0xfcc5('0x3d')]({'plain':!![]});var _0x241cbd=_0xfcc5('0x3e');return db[_0xfcc5('0x65')][_0xfcc5('0x66')]({'where':{'name':_0x241cbd,'userProfileId':_0x53d73f[_0xfcc5('0x67')]},'raw':!![]})[_0xfcc5('0x23')](function(_0x1f4a25){if(_0x1f4a25&&_0x1f4a25['autoAssociation']===0x0){return db[_0xfcc5('0x68')][_0xfcc5('0x61')]({'name':_0x56eb4c[_0xfcc5('0x40')],'resourceId':_0x56eb4c['id'],'type':_0x1f4a25['name'],'sectionId':_0x1f4a25['id']},{})[_0xfcc5('0x23')](function(){return _0x36902a;});}else{return _0x36902a;}})[_0xfcc5('0x2e')](function(_0x32af3d){logger[_0xfcc5('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32af3d);throw _0x32af3d;});}return _0x36902a;})[_0xfcc5('0x23')](respondWithResult(_0x25fc38,0xc9))['catch'](handleError(_0x25fc38,null));};exports[_0xfcc5('0x3b')]=function(_0x3b2182,_0x56383a){if(_0x3b2182[_0xfcc5('0x62')]['id']){delete _0x3b2182[_0xfcc5('0x62')]['id'];}return db[_0xfcc5('0x56')][_0xfcc5('0x66')]({'where':{'id':_0x3b2182['params']['id']},'include':[{'model':db[_0xfcc5('0x5d')],'as':_0xfcc5('0x5e')}]})[_0xfcc5('0x23')](handleEntityNotFound(_0x56383a,null))[_0xfcc5('0x23')](saveUpdates(_0x3b2182[_0xfcc5('0x62')],null))[_0xfcc5('0x23')](respondWithResult(_0x56383a,null))[_0xfcc5('0x2e')](handleError(_0x56383a,null));};exports[_0xfcc5('0x3c')]=function(_0x5aa299,_0x496b27){return db['FaxAccount'][_0xfcc5('0x66')]({'where':{'id':_0x5aa299[_0xfcc5('0x5c')]['id']}})['then'](handleEntityNotFound(_0x496b27,null))[_0xfcc5('0x23')](removeEntity(_0x496b27,null))[_0xfcc5('0x2e')](handleError(_0x496b27,null));};exports[_0xfcc5('0x69')]=function(_0x412dd3,_0x2b6091){return db[_0xfcc5('0x56')][_0xfcc5('0x69')]()[_0xfcc5('0x23')](respondWithResult(_0x2b6091,null))[_0xfcc5('0x2e')](handleError(_0x2b6091,null));};exports['addDisposition']=function(_0x224614,_0x3cc49b,_0x9f5bbc){if(_0x224614[_0xfcc5('0x62')]['id']){delete _0x224614[_0xfcc5('0x62')]['id'];}return db[_0xfcc5('0x56')]['find']({'where':{'id':_0x224614[_0xfcc5('0x5c')]['id']}})[_0xfcc5('0x23')](handleEntityNotFound(_0x3cc49b,null))[_0xfcc5('0x23')](function(_0x5c6635){if(_0x5c6635){_0x224614[_0xfcc5('0x62')][_0xfcc5('0x6a')]=_0x5c6635['id'];return db[_0xfcc5('0x6b')][_0xfcc5('0x61')](_0x224614[_0xfcc5('0x62')]);}})['then'](respondWithResult(_0x3cc49b,null))[_0xfcc5('0x2e')](handleError(_0x3cc49b,null));};exports[_0xfcc5('0x6c')]=function(_0x4b98a1,_0x3c1978,_0x42063b){var _0x500dad={'raw':![],'where':{}};var _0x177aed={};var _0x4c4245={'count':0x0,'rows':[]};return db['FaxAccount'][_0xfcc5('0x6d')]({'where':{'id':_0x4b98a1[_0xfcc5('0x5c')]['id']}})[_0xfcc5('0x23')](handleEntityNotFound(_0x3c1978,null))[_0xfcc5('0x23')](function(_0x2e79bf){if(_0x2e79bf){_0x177aed[_0xfcc5('0x4a')]=_[_0xfcc5('0x47')](db['Disposition'][_0xfcc5('0x5f')]);_0x177aed[_0xfcc5('0x46')]=_['keys'](_0x4b98a1['query']);_0x177aed[_0xfcc5('0x48')]=_[_0xfcc5('0x49')](_0x177aed[_0xfcc5('0x4a')],_0x177aed[_0xfcc5('0x46')]);_0x500dad['attributes']=_[_0xfcc5('0x49')](_0x177aed[_0xfcc5('0x4a')],qs['fields'](_0x4b98a1[_0xfcc5('0x46')][_0xfcc5('0x4c')]));_0x500dad[_0xfcc5('0x4b')]=_0x500dad[_0xfcc5('0x4b')][_0xfcc5('0x4d')]?_0x500dad[_0xfcc5('0x4b')]:_0x177aed[_0xfcc5('0x4a')];if(!_0x4b98a1['query']['hasOwnProperty'](_0xfcc5('0x4f'))){_0x500dad[_0xfcc5('0x36')]=qs[_0xfcc5('0x36')](_0x4b98a1[_0xfcc5('0x46')][_0xfcc5('0x36')]);_0x500dad[_0xfcc5('0x33')]=qs[_0xfcc5('0x33')](_0x4b98a1['query'][_0xfcc5('0x33')]);}_0x500dad['order']=qs[_0xfcc5('0x51')](_0x4b98a1['query']['sort']);_0x500dad[_0xfcc5('0x52')]=qs[_0xfcc5('0x48')](_[_0xfcc5('0x53')](_0x4b98a1[_0xfcc5('0x46')],_0x177aed['filters']));_0x500dad[_0xfcc5('0x52')][_0xfcc5('0x6a')]=_0x2e79bf['id'];if(_0x4b98a1['query'][_0xfcc5('0x54')]){_0x500dad['where']=_[_0xfcc5('0x60')](_0x500dad[_0xfcc5('0x52')],{'$or':_['map'](_0x500dad[_0xfcc5('0x4b')],function(_0x138e9f){var _0x960e67={};_0x960e67[_0x138e9f]={'$like':'%'+_0x4b98a1['query'][_0xfcc5('0x54')]+'%'};return _0x960e67;})});}_0x500dad=_[_0xfcc5('0x60')]({},_0x500dad,_0x4b98a1['options']);return db[_0xfcc5('0x6b')][_0xfcc5('0x35')]({'where':_0x500dad[_0xfcc5('0x52')]})[_0xfcc5('0x23')](function(_0x1c811c){_0x4c4245[_0xfcc5('0x35')]=_0x1c811c;if(_0x4b98a1[_0xfcc5('0x46')]['includeAll']){_0x500dad[_0xfcc5('0x58')]=[{'all':!![]}];}return db[_0xfcc5('0x6b')][_0xfcc5('0x59')](_0x500dad);})[_0xfcc5('0x23')](function(_0x203b6a){_0x4c4245[_0xfcc5('0x5a')]=_0x203b6a;return _0x4c4245;});}})[_0xfcc5('0x23')](respondWithFilteredResult(_0x3c1978,_0x500dad))['catch'](handleError(_0x3c1978,null));};exports[_0xfcc5('0x6e')]=function(_0x10a37e,_0x500f35,_0x501667){return db[_0xfcc5('0x56')][_0xfcc5('0x66')]({'where':{'id':_0x10a37e['params']['id']}})['then'](handleEntityNotFound(_0x500f35,null))['then'](function(_0x3074bc){if(_0x3074bc){return _0x3074bc[_0xfcc5('0x6e')](_0x10a37e[_0xfcc5('0x46')][_0xfcc5('0x6f')]);}})[_0xfcc5('0x23')](respondWithStatusCode(_0x500f35,null))[_0xfcc5('0x2e')](handleError(_0x500f35,null));};exports[_0xfcc5('0x70')]=function(_0x289043,_0x49fb17,_0x45f875){if(_0x289043[_0xfcc5('0x62')]['id']){delete _0x289043[_0xfcc5('0x62')]['id'];}return db[_0xfcc5('0x56')][_0xfcc5('0x66')]({'where':{'id':_0x289043['params']['id']}})[_0xfcc5('0x23')](handleEntityNotFound(_0x49fb17,null))[_0xfcc5('0x23')](function(_0x4dcec5){if(_0x4dcec5){_0x289043['body']['FaxAccountId']=_0x4dcec5['id'];return db[_0xfcc5('0x71')][_0xfcc5('0x61')](_0x289043['body']);}})['then'](respondWithResult(_0x49fb17,null))[_0xfcc5('0x2e')](handleError(_0x49fb17,null));};exports[_0xfcc5('0x72')]=function(_0x1546cc,_0x1eb4fb,_0x54806f){var _0x3dc00f={'raw':![],'where':{}};var _0x2d1577={};var _0x45c84b={'count':0x0,'rows':[]};return db[_0xfcc5('0x56')][_0xfcc5('0x6d')]({'where':{'id':_0x1546cc['params']['id']}})[_0xfcc5('0x23')](handleEntityNotFound(_0x1eb4fb,null))[_0xfcc5('0x23')](function(_0x4d75be){if(_0x4d75be){_0x2d1577['model']=_[_0xfcc5('0x47')](db[_0xfcc5('0x71')]['rawAttributes']);_0x2d1577['query']=_[_0xfcc5('0x47')](_0x1546cc['query']);_0x2d1577['filters']=_[_0xfcc5('0x49')](_0x2d1577['model'],_0x2d1577['query']);_0x3dc00f['attributes']=_[_0xfcc5('0x49')](_0x2d1577[_0xfcc5('0x4a')],qs[_0xfcc5('0x4c')](_0x1546cc[_0xfcc5('0x46')][_0xfcc5('0x4c')]));_0x3dc00f[_0xfcc5('0x4b')]=_0x3dc00f[_0xfcc5('0x4b')][_0xfcc5('0x4d')]?_0x3dc00f['attributes']:_0x2d1577[_0xfcc5('0x4a')];if(!_0x1546cc[_0xfcc5('0x46')]['hasOwnProperty'](_0xfcc5('0x4f'))){_0x3dc00f['limit']=qs[_0xfcc5('0x36')](_0x1546cc['query'][_0xfcc5('0x36')]);_0x3dc00f['offset']=qs[_0xfcc5('0x33')](_0x1546cc[_0xfcc5('0x46')][_0xfcc5('0x33')]);}_0x3dc00f[_0xfcc5('0x50')]=qs[_0xfcc5('0x51')](_0x1546cc[_0xfcc5('0x46')][_0xfcc5('0x51')]);_0x3dc00f[_0xfcc5('0x52')]=qs[_0xfcc5('0x48')](_[_0xfcc5('0x53')](_0x1546cc[_0xfcc5('0x46')],_0x2d1577[_0xfcc5('0x48')]));_0x3dc00f[_0xfcc5('0x52')][_0xfcc5('0x6a')]=_0x4d75be['id'];if(_0x1546cc[_0xfcc5('0x46')]['filter']){_0x3dc00f[_0xfcc5('0x52')]=_[_0xfcc5('0x60')](_0x3dc00f['where'],{'$or':_['map'](_0x3dc00f[_0xfcc5('0x4b')],function(_0x21324a){var _0x6f1004={};_0x6f1004[_0x21324a]={'$like':'%'+_0x1546cc[_0xfcc5('0x46')][_0xfcc5('0x54')]+'%'};return _0x6f1004;})});}_0x3dc00f=_[_0xfcc5('0x60')]({},_0x3dc00f,_0x1546cc['options']);return db[_0xfcc5('0x71')][_0xfcc5('0x35')]({'where':_0x3dc00f[_0xfcc5('0x52')]})[_0xfcc5('0x23')](function(_0x3ba063){_0x45c84b[_0xfcc5('0x35')]=_0x3ba063;if(_0x1546cc[_0xfcc5('0x46')][_0xfcc5('0x57')]){_0x3dc00f[_0xfcc5('0x58')]=[{'all':!![]}];}return db[_0xfcc5('0x71')]['findAll'](_0x3dc00f);})[_0xfcc5('0x23')](function(_0x13ddaa){_0x45c84b[_0xfcc5('0x5a')]=_0x13ddaa;return _0x45c84b;});}})[_0xfcc5('0x23')](respondWithFilteredResult(_0x1eb4fb,_0x3dc00f))[_0xfcc5('0x2e')](handleError(_0x1eb4fb,null));};exports[_0xfcc5('0x73')]=function(_0x242c8d,_0x265bbc,_0x12e100){return db[_0xfcc5('0x56')][_0xfcc5('0x66')]({'where':{'id':_0x242c8d[_0xfcc5('0x5c')]['id']}})[_0xfcc5('0x23')](handleEntityNotFound(_0x265bbc,null))[_0xfcc5('0x23')](function(_0x58f0c7){if(_0x58f0c7){return _0x58f0c7[_0xfcc5('0x73')](_0x242c8d[_0xfcc5('0x46')][_0xfcc5('0x6f')]);}})[_0xfcc5('0x23')](respondWithStatusCode(_0x265bbc,null))['catch'](handleError(_0x265bbc,null));};exports[_0xfcc5('0x74')]=function(_0x27d097,_0x5ac6c8,_0x52fad2){return db[_0xfcc5('0x75')][_0xfcc5('0x66')]({'where':{'id':_0x27d097[_0xfcc5('0x5c')]['id']}})[_0xfcc5('0x23')](handleEntityNotFound(_0x5ac6c8,null))['then'](function(_0x227077){if(_0x227077){return _0x227077['addInteraction'](_0x27d097['body'][_0xfcc5('0x6f')],_[_0xfcc5('0x76')](_0x27d097['body'],[_0xfcc5('0x6f'),'id'])||{});}})['then'](respondWithResult(_0x5ac6c8,null))[_0xfcc5('0x2e')](handleError(_0x5ac6c8,null));};exports[_0xfcc5('0x77')]=function(_0x3bfeda,_0x1ae3ed,_0xa89130){var _0x1c4be6={'raw':![],'where':{}};var _0x104ee4={};var _0x3c0044={'count':0x0,'rows':[]};return db['FaxAccount'][_0xfcc5('0x6d')]({'where':{'id':_0x3bfeda[_0xfcc5('0x5c')]['id']}})[_0xfcc5('0x23')](handleEntityNotFound(_0x1ae3ed,null))[_0xfcc5('0x23')](function(_0x92c6d5){if(_0x92c6d5){_0x104ee4[_0xfcc5('0x4a')]=_[_0xfcc5('0x47')](db[_0xfcc5('0x75')][_0xfcc5('0x5f')]);_0x104ee4[_0xfcc5('0x46')]=_[_0xfcc5('0x47')](_0x3bfeda[_0xfcc5('0x46')]);_0x104ee4['filters']=_[_0xfcc5('0x49')](_0x104ee4[_0xfcc5('0x4a')],_0x104ee4[_0xfcc5('0x46')]);_0x1c4be6[_0xfcc5('0x4b')]=_[_0xfcc5('0x49')](_0x104ee4[_0xfcc5('0x4a')],qs[_0xfcc5('0x4c')](_0x3bfeda['query']['fields']));_0x1c4be6[_0xfcc5('0x4b')]=_0x1c4be6[_0xfcc5('0x4b')]['length']?_0x1c4be6['attributes']:_0x104ee4['model'];if(!_0x3bfeda['query']['hasOwnProperty'](_0xfcc5('0x4f'))){_0x1c4be6[_0xfcc5('0x36')]=qs['limit'](_0x3bfeda[_0xfcc5('0x46')][_0xfcc5('0x36')]);_0x1c4be6[_0xfcc5('0x33')]=qs[_0xfcc5('0x33')](_0x3bfeda[_0xfcc5('0x46')]['offset']);}_0x1c4be6[_0xfcc5('0x50')]=qs[_0xfcc5('0x51')](_0x3bfeda[_0xfcc5('0x46')][_0xfcc5('0x51')]);_0x1c4be6['where']=qs[_0xfcc5('0x48')](_[_0xfcc5('0x53')](_0x3bfeda[_0xfcc5('0x46')],_0x104ee4[_0xfcc5('0x48')]));_0x1c4be6[_0xfcc5('0x52')][_0xfcc5('0x6a')]=_0x92c6d5['id'];if(_0x3bfeda[_0xfcc5('0x46')][_0xfcc5('0x54')]){_0x1c4be6[_0xfcc5('0x52')]=_[_0xfcc5('0x60')](_0x1c4be6[_0xfcc5('0x52')],{'$or':_[_0xfcc5('0x43')](_0x1c4be6[_0xfcc5('0x4b')],function(_0x5b8ab8){var _0x151c9c={};_0x151c9c[_0x5b8ab8]={'$like':'%'+_0x3bfeda['query'][_0xfcc5('0x54')]+'%'};return _0x151c9c;})});}_0x1c4be6=_[_0xfcc5('0x60')]({},_0x1c4be6,_0x3bfeda[_0xfcc5('0x55')]);return db[_0xfcc5('0x75')][_0xfcc5('0x35')]({'where':_0x1c4be6[_0xfcc5('0x52')]})[_0xfcc5('0x23')](function(_0x2fb598){_0x3c0044['count']=_0x2fb598;if(_0x3bfeda[_0xfcc5('0x46')][_0xfcc5('0x57')]){_0x1c4be6[_0xfcc5('0x58')]=[{'model':db[_0xfcc5('0x78')],'as':_0xfcc5('0x79'),'required':![]},{'model':db[_0xfcc5('0x7a')],'as':_0xfcc5('0x7b'),'attributes':['name',_0xfcc5('0x7c'),_0xfcc5('0x7d')],'required':![]},{'model':db[_0xfcc5('0x7e')],'as':_0xfcc5('0x7f'),'attributes':['id',_0xfcc5('0x40'),_0xfcc5('0x80')],'where':_0x3bfeda[_0xfcc5('0x46')][_0xfcc5('0x81')]?{'id':_0x3bfeda[_0xfcc5('0x46')][_0xfcc5('0x81')]}:undefined,'required':_0x3bfeda[_0xfcc5('0x46')][_0xfcc5('0x81')]?!![]:![]}];}return db['FaxInteraction']['findAll'](_0x1c4be6);})[_0xfcc5('0x23')](function(_0x582599){_0x3c0044['rows']=_0x582599;return _0x3c0044;});}})[_0xfcc5('0x23')](respondWithFilteredResult(_0x1ae3ed,_0x1c4be6))[_0xfcc5('0x2e')](handleError(_0x1ae3ed,null));};exports[_0xfcc5('0x82')]=function(_0x3033ab,_0x81dadd){var _0xc9d2b8=_0x3033ab['params']['id'];var _0x4118e0=_0x3033ab[_0xfcc5('0x62')];var _0xf18994=0xc8;var _0x479905=null;return db[_0xfcc5('0x83')][_0xfcc5('0x84')]({'isolationLevel':db[_0xfcc5('0x83')][_0xfcc5('0x85')][_0xfcc5('0x86')]['READ_COMMITTED']},function(_0xed5d6){return db[_0xfcc5('0x56')][_0xfcc5('0x6d')]({'where':{'id':_0xc9d2b8},'transaction':_0xed5d6})[_0xfcc5('0x23')](function(_0xab0c0e){if(_0xab0c0e){return db[_0xfcc5('0x87')][_0xfcc5('0x3c')]({'where':{'FaxAccountId':_0xc9d2b8},'transaction':_0xed5d6})['then'](function(){var _0x1773f8=_['map'](_0x4118e0,function(_0x3b1809){_0x3b1809[_0xfcc5('0x6a')]=_0xc9d2b8;return _0x3b1809;});return db[_0xfcc5('0x87')][_0xfcc5('0x88')](_0x1773f8,{'transaction':_0xed5d6});});}else{_0xf18994=0x194;_0x479905=[];}});})[_0xfcc5('0x23')](function(){if(_0xf18994!==0x194){return db['FaxApplication'][_0xfcc5('0x89')]({'where':{'FaxAccountId':_0xc9d2b8},'order':'priority'})['then'](function(_0x5ad214){_0x479905=_0x5ad214;});}})[_0xfcc5('0x2e')](function(_0x530821){_0xf18994=0x1f4;logger[_0xfcc5('0x29')](_0x530821[_0xfcc5('0x3f')]);if(_0x530821[_0xfcc5('0x40')]){delete _0x530821[_0xfcc5('0x40')];}_0x479905=_0x530821;})[_0xfcc5('0x8a')](function(){if(_0x479905===null){_0x81dadd['sendStatus'](_0xf18994);}else{if(_0xf18994===0x1f4){_0x81dadd[_0xfcc5('0x30')](_0xf18994)[_0xfcc5('0x41')](_0x479905);}else{_0x81dadd[_0xfcc5('0x30')](_0xf18994)[_0xfcc5('0x32')](_0x479905);}}});};exports[_0xfcc5('0x8b')]=function(_0x30772d,_0x439bd4,_0x1b5831){var _0x32c9af={};var _0x34325e={};var _0x2a0df3;var _0x4fe5d6;return db['FaxAccount'][_0xfcc5('0x6d')]({'where':{'id':_0x30772d[_0xfcc5('0x5c')]['id']}})['then'](handleEntityNotFound(_0x439bd4,null))['then'](function(_0x2ecc04){if(_0x2ecc04){_0x2a0df3=_0x2ecc04;_0x34325e[_0xfcc5('0x4a')]=_[_0xfcc5('0x47')](db[_0xfcc5('0x87')][_0xfcc5('0x5f')]);_0x34325e[_0xfcc5('0x46')]=_[_0xfcc5('0x47')](_0x30772d[_0xfcc5('0x46')]);_0x34325e[_0xfcc5('0x48')]=_[_0xfcc5('0x49')](_0x34325e[_0xfcc5('0x4a')],_0x34325e[_0xfcc5('0x46')]);_0x32c9af[_0xfcc5('0x4b')]=_[_0xfcc5('0x49')](_0x34325e[_0xfcc5('0x4a')],qs[_0xfcc5('0x4c')](_0x30772d[_0xfcc5('0x46')][_0xfcc5('0x4c')]));_0x32c9af[_0xfcc5('0x4b')]=_0x32c9af['attributes'][_0xfcc5('0x4d')]?_0x32c9af[_0xfcc5('0x4b')]:_0x34325e['model'];_0x32c9af['order']=qs[_0xfcc5('0x51')](_0x30772d[_0xfcc5('0x46')]['sort']);_0x32c9af[_0xfcc5('0x52')]=qs[_0xfcc5('0x48')](_[_0xfcc5('0x53')](_0x30772d['query'],_0x34325e[_0xfcc5('0x48')]));if(_0x30772d[_0xfcc5('0x46')][_0xfcc5('0x54')]){_0x32c9af[_0xfcc5('0x52')]=_['merge'](_0x32c9af[_0xfcc5('0x52')],{'$or':_[_0xfcc5('0x43')](_0x32c9af[_0xfcc5('0x4b')],function(_0x3ed868){var _0x5adb22={};_0x5adb22[_0x3ed868]={'$like':'%'+_0x30772d[_0xfcc5('0x46')][_0xfcc5('0x54')]+'%'};return _0x5adb22;})});}_0x32c9af=_[_0xfcc5('0x60')]({},_0x32c9af,_0x30772d[_0xfcc5('0x55')]);return _0x2a0df3[_0xfcc5('0x8b')](_0x32c9af);}})[_0xfcc5('0x23')](function(_0x3b466c){if(_0x3b466c){_0x4fe5d6=_0x3b466c[_0xfcc5('0x4d')];if(!_0x30772d[_0xfcc5('0x46')][_0xfcc5('0x4e')](_0xfcc5('0x4f'))){_0x32c9af['limit']=qs['limit'](_0x30772d['query']['limit']);_0x32c9af[_0xfcc5('0x33')]=qs[_0xfcc5('0x33')](_0x30772d[_0xfcc5('0x46')]['offset']);}return _0x2a0df3[_0xfcc5('0x8b')](_0x32c9af);}})['then'](function(_0x4904c8){if(_0x4904c8){return _0x4904c8?{'count':_0x4fe5d6,'rows':_0x4904c8}:null;}})[_0xfcc5('0x23')](respondWithResult(_0x439bd4,null))[_0xfcc5('0x2e')](handleError(_0x439bd4,null));};function Extension(_0x9508a6,_0x5d8070,_0x5a5af4,_0x271c96){this['context']=_0xfcc5('0x8c');this['exten']=_0x9508a6['localstationid'];this['app']=_0x271c96;this[_0xfcc5('0x45')]=_0xfcc5('0x8d');this[_0xfcc5('0x8e')]=_0xfcc5('0x8f');this['FaxAccountId']=_0x9508a6['id'];this['priority']=_0x5d8070;this['appdata']=_0x5a5af4;}function createExtensionsReciveFax(_0x23c1cc){var _0x803a97=0x1;var _0x48af9f=[];_0x48af9f['push'](new Extension(_0x23c1cc,_0x803a97,'','Answer'));_0x803a97+=0x1;_0x48af9f[_0xfcc5('0x90')](new Extension(_0x23c1cc,_0x803a97,_0xfcc5('0x91'),_0xfcc5('0x92')));_0x803a97+=0x1;for(var _0x5c6e73 in _0x23c1cc){if(_0x23c1cc[_0xfcc5('0x4e')](_0x5c6e73)&&(_0x5c6e73===_0xfcc5('0x93')||_0x5c6e73===_0xfcc5('0x94')||_0x5c6e73==='gateway'||_0x5c6e73==='faxdetect'||_0x5c6e73===_0xfcc5('0x95')||_0x5c6e73==='maxrate'||_0x5c6e73==='minrate'||_0x5c6e73===_0xfcc5('0x96')||_0x5c6e73===_0xfcc5('0x97'))){_0x48af9f[_0xfcc5('0x90')](new Extension(_0x23c1cc,_0x803a97,_0xfcc5('0x98')+_0x5c6e73+')='+_0x23c1cc[_0x5c6e73],_0xfcc5('0x92')));_0x803a97+=0x1;}}_0x48af9f[_0xfcc5('0x90')](new Extension(_0x23c1cc,_0x803a97,'6',_0xfcc5('0x99')));_0x803a97+=0x1;_0x48af9f[_0xfcc5('0x90')](new Extension(_0x23c1cc,_0x803a97,_0xfcc5('0x9a'),_0xfcc5('0x9b')));_0x803a97=0x0;return _0x48af9f;}exports[_0xfcc5('0x9c')]=function(_0x778846,_0x356d86,_0x2d88c6){var _0x3468d9;return db[_0xfcc5('0x83')][_0xfcc5('0x84')](function(_0x409870){return db['FaxAccount'][_0xfcc5('0x61')](_0x778846[_0xfcc5('0x62')],{'transaction':_0x409870})['then'](function(_0x1bc664){_0x3468d9=_0x1bc664[_0xfcc5('0x3d')]({'plain':!![]});return db[_0xfcc5('0x9d')][_0xfcc5('0x88')](createExtensionsReciveFax(_0x3468d9),{'transaction':_0x409870});});})[_0xfcc5('0x23')](function(){return _0x3468d9;})[_0xfcc5('0x23')](respondWithResult(_0x356d86,null))[_0xfcc5('0x2e')](handleError(_0x356d86,null));};exports[_0xfcc5('0x9e')]=function(_0x35cdb4,_0x2de28e,_0x39ccde){var _0x38638c;return db[_0xfcc5('0x83')]['transaction'](function(_0x2d351e){return db[_0xfcc5('0x56')]['update'](_0x35cdb4[_0xfcc5('0x62')],{'where':{'id':_0x35cdb4[_0xfcc5('0x62')]['id']},'transaction':_0x2d351e})[_0xfcc5('0x23')](function(_0x17fb59){return db[_0xfcc5('0x9d')][_0xfcc5('0x3c')]({'where':{'FaxAccountId':_0x35cdb4['body']['id']},'transaction':_0x2d351e})[_0xfcc5('0x23')](function(_0xbb1138){return db[_0xfcc5('0x9d')][_0xfcc5('0x88')](createExtensionsReciveFax(_['omit'](_0x35cdb4[_0xfcc5('0x62')],['tech',_0xfcc5('0x9f'),_0xfcc5('0xa0'),_0xfcc5('0xa1'),_0xfcc5('0xa2'),'ListId'])),{'transaction':_0x2d351e});});});})[_0xfcc5('0x23')](function(){return db[_0xfcc5('0x56')][_0xfcc5('0xa3')](_0x35cdb4[_0xfcc5('0x62')]['id']);})['then'](respondWithResult(_0x2de28e,null))[_0xfcc5('0x2e')](handleError(_0x2de28e,null));};exports[_0xfcc5('0xa4')]=function(_0x4a6a77,_0x292f6f,_0x58bcc9){var _0x1edd2f={'raw':!![],'where':{}};var _0x32c1b5={};var _0x306735={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x4a6a77[_0xfcc5('0x5c')]['id']}})['then'](handleEntityNotFound(_0x292f6f,null))[_0xfcc5('0x23')](function(_0x4e652e){if(_0x4e652e){_0x32c1b5[_0xfcc5('0x4a')]=_[_0xfcc5('0x47')](db[_0xfcc5('0xa5')]['rawAttributes']);_0x32c1b5[_0xfcc5('0x46')]=_[_0xfcc5('0x47')](_0x4a6a77[_0xfcc5('0x46')]);_0x32c1b5[_0xfcc5('0x48')]=_[_0xfcc5('0x49')](_0x32c1b5['model'],_0x32c1b5['query']);_0x1edd2f['attributes']=_[_0xfcc5('0x49')](_0x32c1b5[_0xfcc5('0x4a')],qs[_0xfcc5('0x4c')](_0x4a6a77[_0xfcc5('0x46')][_0xfcc5('0x4c')]));_0x1edd2f[_0xfcc5('0x4b')]=_0x1edd2f[_0xfcc5('0x4b')]['length']?_0x1edd2f['attributes']:_0x32c1b5[_0xfcc5('0x4a')];if(!_0x4a6a77[_0xfcc5('0x46')][_0xfcc5('0x4e')](_0xfcc5('0x4f'))){_0x1edd2f[_0xfcc5('0x36')]=qs[_0xfcc5('0x36')](_0x4a6a77[_0xfcc5('0x46')][_0xfcc5('0x36')]);_0x1edd2f[_0xfcc5('0x33')]=qs['offset'](_0x4a6a77['query'][_0xfcc5('0x33')]);}_0x1edd2f[_0xfcc5('0x50')]=qs[_0xfcc5('0x51')](_0x4a6a77['query'][_0xfcc5('0x51')]);_0x1edd2f[_0xfcc5('0x52')]=qs[_0xfcc5('0x48')](_[_0xfcc5('0x53')](_0x4a6a77[_0xfcc5('0x46')],_0x32c1b5['filters']));_0x1edd2f[_0xfcc5('0x52')][_0xfcc5('0x6a')]=_0x4e652e['id'];if(_0x4a6a77[_0xfcc5('0x46')][_0xfcc5('0x54')]){_0x1edd2f[_0xfcc5('0x52')]=_[_0xfcc5('0x60')](_0x1edd2f[_0xfcc5('0x52')],{'$or':_[_0xfcc5('0x43')](_0x1edd2f[_0xfcc5('0x4b')],function(_0x33fd81){var _0x1296ab={};_0x1296ab[_0x33fd81]={'$like':'%'+_0x4a6a77[_0xfcc5('0x46')]['filter']+'%'};return _0x1296ab;})});}if(_0x4a6a77['query'][_0xfcc5('0xa6')]){var _0x24d413=_0x4a6a77[_0xfcc5('0x46')]['$gte']['split'](',');var _0xcdc072={};_0xcdc072[_0x24d413[0x0]]={'$gte':moment(_0x24d413[0x1])['format'](_0xfcc5('0xa7'))};_0x1edd2f['where']=_['merge'](_0x1edd2f[_0xfcc5('0x52')],_0xcdc072);}_0x1edd2f=_[_0xfcc5('0x60')]({},_0x1edd2f,_0x4a6a77[_0xfcc5('0x55')]);return db[_0xfcc5('0xa5')][_0xfcc5('0x35')]({'where':_0x1edd2f['where']})['then'](function(_0x3f1934){_0x306735[_0xfcc5('0x35')]=_0x3f1934;if(_0x4a6a77[_0xfcc5('0x46')][_0xfcc5('0x57')]){_0x1edd2f['include']=[{'all':!![]}];}return db[_0xfcc5('0xa5')][_0xfcc5('0x59')](_0x1edd2f);})[_0xfcc5('0x23')](function(_0x28e5c6){_0x306735[_0xfcc5('0x5a')]=_0x28e5c6;return _0x306735;});}})['then'](respondWithFilteredResult(_0x292f6f,_0x1edd2f))[_0xfcc5('0x2e')](handleError(_0x292f6f,null));};exports[_0xfcc5('0x41')]=function(_0x2476b2,_0x1b1e83,_0x433333){var _0x277359,_0x2244ab={},_0x7c8074;if(_0x2476b2[_0xfcc5('0x62')]['to']){_0x7c8074=_0x2476b2['body']['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0x2476b2['params']['id']},'include':[{'model':db['CmList'],'as':_0xfcc5('0xa8'),'include':[{'model':db[_0xfcc5('0x78')],'as':_0xfcc5('0xa9'),'where':{'fax':_0x7c8074},'limit':0x1,'order':[[_0xfcc5('0xa1'),_0xfcc5('0xaa')]]}]}]})['then'](handleEntityNotFound(_0x1b1e83,null))[_0xfcc5('0x23')](function(_0x2d6a78){_0x277359=_0x2d6a78;if(_0x2476b2[_0xfcc5('0x62')]['attachments']&&_0x2476b2[_0xfcc5('0x62')][_0xfcc5('0xab')][_0xfcc5('0x4d')]){for(var _0x1ed731=0x0;_0x1ed731<_0x2476b2['body'][_0xfcc5('0xab')][_0xfcc5('0x4d')];_0x1ed731+=0x1){_0x2476b2[_0xfcc5('0x62')]['attachments'][_0x1ed731]={'filename':_0x2476b2[_0xfcc5('0x62')][_0xfcc5('0xab')][_0x1ed731]['name'],'id':_0x2476b2['body'][_0xfcc5('0xab')][_0x1ed731]['id'],'path':path[_0xfcc5('0xac')](config['root'],_0xfcc5('0xad'),_0x2476b2[_0xfcc5('0x62')][_0xfcc5('0xab')][_0x1ed731][_0xfcc5('0xae')])};}}return respondWithRpcPromise(_0xfcc5('0xaf'),'CheckAfterSend',{'FaxAccountId':_['isNil'](_0x2476b2[_0xfcc5('0x5c')]['id'])?undefined:_0x2476b2[_0xfcc5('0x5c')]['id'],'path':_['isNil'](_0x2476b2['body'][_0xfcc5('0xab')][0x0][_0xfcc5('0xb0')])?undefined:_0x2476b2[_0xfcc5('0x62')][_0xfcc5('0xab')][0x0][_0xfcc5('0xb0')],'fax':_[_0xfcc5('0xb1')](_0x2476b2['body']['to'][0x0])?undefined:_0x2476b2['body']['to'][0x0]},client9002);})[_0xfcc5('0x23')](function(){if(_0x277359){if(_[_0xfcc5('0xb1')](_0x2476b2['body']['from'])){_0x2476b2[_0xfcc5('0x62')][_0xfcc5('0xb2')]=util['format']('\x22%s\x22\x20<%s>',_0x277359[_0xfcc5('0x40')],_0x277359[_0xfcc5('0xb3')]);}if(_0x277359[_0xfcc5('0xa8')]){if(_0x277359[_0xfcc5('0xa8')][_0xfcc5('0xa9')][_0xfcc5('0x4d')]){return _0x277359[_0xfcc5('0xa8')][_0xfcc5('0xa9')][0x0];}else{return db[_0xfcc5('0x78')][_0xfcc5('0x61')](_['defaults'](_0x2476b2[_0xfcc5('0x62')],{'firstName':_0x2476b2[_0xfcc5('0x62')]['to'][0x0],'phone':_0x2476b2[_0xfcc5('0x62')]['to'][0x0],'fax':_0x2476b2[_0xfcc5('0x62')]['to'][0x0],'ListId':_0x277359['ListId']}));}}else{throw new Error(_0xfcc5('0xb4'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xfcc5('0x23')](function(_0x4c3f99){if(_0x4c3f99){return db['FaxInteraction'][_0xfcc5('0x66')]({'where':{'ContactId':_0x4c3f99['id'],'closed':![],'FaxAccountId':_0x277359['id']}})[_0xfcc5('0x23')](function(_0x41c3b7){if(_0x41c3b7){return[_0x41c3b7,![]];}return db['FaxInteraction'][_0xfcc5('0x61')]({'UserId':_0x2476b2[_0xfcc5('0x63')]['id'],'ContactId':_0x4c3f99['id'],'FaxAccountId':_0x277359['id'],'fax':_0x2476b2[_0xfcc5('0x62')]['to'][0x0],'firstMsgDirection':_0xfcc5('0xb5'),'Messages':[_[_0xfcc5('0x60')](_0x2476b2[_0xfcc5('0x62')],{'read':![],'body':_0x2476b2[_0xfcc5('0x62')][_0xfcc5('0xab')][0x0][_0xfcc5('0xb6')],'FaxAccountId':_0x277359['id'],'UserId':_0x2476b2[_0xfcc5('0x63')]['id'],'ContactId':_0x4c3f99['id'],'AttachmentId':_0x2476b2[_0xfcc5('0x62')][_0xfcc5('0xab')][0x0]['id']})]},{'include':[{'model':db[_0xfcc5('0xa5')],'as':_0xfcc5('0xb7')}]})['then'](function(_0x10c764){return[_0x10c764,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xfcc5('0xb8')](function(_0x2cc765,_0x190fdc){if(_0x190fdc){return _0x2cc765;}return db[_0xfcc5('0xa5')][_0xfcc5('0x61')]({'direction':_0xfcc5('0xb5'),'read':![],'body':_0x2476b2['body']['attachments'][0x0][_0xfcc5('0xb6')],'FaxAccountId':_0x277359['id'],'FaxInteractionId':_0x2cc765['id'],'UserId':_0x2476b2[_0xfcc5('0x63')]['id'],'ContactId':_0x2cc765[_0xfcc5('0xb9')],'AttachmentId':_0x2476b2[_0xfcc5('0x62')]['attachments'][0x0]['id']})['then'](function(_0x3c5a86){_0x2cc765[_0xfcc5('0xba')][_0xfcc5('0xb7')]=[];_0x2cc765[_0xfcc5('0xba')][_0xfcc5('0xb7')][_0xfcc5('0x90')](_0x3c5a86[_0xfcc5('0xba')]);return _0x2cc765;});})[_0xfcc5('0x23')](function(_0x32e107){respondWithRpcPromise(_0xfcc5('0xbb'),_0xfcc5('0xbb'),{'FaxAccountId':_[_0xfcc5('0xb1')](_0x2476b2[_0xfcc5('0x5c')]['id'])?undefined:_0x2476b2['params']['id'],'path':_['isNil'](_0x2476b2[_0xfcc5('0x62')][_0xfcc5('0xab')][0x0][_0xfcc5('0xb0')])?undefined:_0x2476b2['body'][_0xfcc5('0xab')][0x0]['path'],'fax':_[_0xfcc5('0xb1')](_0x2476b2[_0xfcc5('0x62')]['to'][0x0])?undefined:_0x2476b2[_0xfcc5('0x62')]['to'][0x0],'AttachmentId':_0x2476b2[_0xfcc5('0x62')][_0xfcc5('0xab')][0x0]['id']},client9002)[_0xfcc5('0x23')](function(_0x9e22d5){logger[_0xfcc5('0x24')](_0xfcc5('0xbc'),_0x9e22d5);})['catch'](function(_0x55bc7b){logger[_0xfcc5('0x24')](_0xfcc5('0xbc'),_0x55bc7b);});return _0x32e107;})['then'](respondWithResult(_0x1b1e83,null))['catch'](handleError(_0x1b1e83,null));};exports['addAgents']=function(_0x5c78d9,_0x2d3a82,_0xef3638){return db[_0xfcc5('0x56')]['find']({'where':{'id':_0x5c78d9[_0xfcc5('0x5c')]['id']}})[_0xfcc5('0x23')](handleEntityNotFound(_0x2d3a82,null))[_0xfcc5('0x23')](function(_0x26ec37){if(_0x26ec37){return _0x26ec37['addAgents'](_0x5c78d9[_0xfcc5('0x62')][_0xfcc5('0x6f')],_['omit'](_0x5c78d9[_0xfcc5('0x62')],['ids','id'])||{})['spread'](function(_0x3a3a38){for(var _0x3bbfca=0x0;_0x3bbfca<_0x5c78d9[_0xfcc5('0x62')][_0xfcc5('0x6f')][_0xfcc5('0x4d')];_0x3bbfca+=0x1){socket[_0xfcc5('0xbd')]('userFaxAccount:save',{'UserId':Number(_0x5c78d9[_0xfcc5('0x62')][_0xfcc5('0x6f')][_0x3bbfca]),'FaxAccountId':Number(_0x5c78d9['params']['id'])});}return _0x3a3a38;});}})[_0xfcc5('0x23')](respondWithResult(_0x2d3a82,null))[_0xfcc5('0x2e')](handleError(_0x2d3a82,null));};exports['removeAgents']=function(_0x5ea2fd,_0x2aa31c,_0x238254){return db[_0xfcc5('0x56')]['find']({'where':{'id':_0x5ea2fd[_0xfcc5('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2aa31c,null))['then'](function(_0x17ea36){if(_0x17ea36){return _0x17ea36[_0xfcc5('0xbe')](_0x5ea2fd[_0xfcc5('0x46')][_0xfcc5('0x6f')])['then'](function(){if(_[_0xfcc5('0xbf')](_0x5ea2fd['query']['ids'])){for(var _0x16b16b=0x0;_0x16b16b<_0x5ea2fd['query'][_0xfcc5('0x6f')]['length'];_0x16b16b+=0x1){socket[_0xfcc5('0xbd')](_0xfcc5('0xc0'),{'UserId':Number(_0x5ea2fd[_0xfcc5('0x46')][_0xfcc5('0x6f')][_0x16b16b]),'FaxAccountId':Number(_0x5ea2fd[_0xfcc5('0x5c')]['id'])});}}else{socket[_0xfcc5('0xbd')](_0xfcc5('0xc0'),{'UserId':Number(_0x5ea2fd['query'][_0xfcc5('0x6f')]),'FaxAccountId':Number(_0x5ea2fd[_0xfcc5('0x5c')]['id'])});}});}})[_0xfcc5('0x23')](respondWithStatusCode(_0x2aa31c,null))[_0xfcc5('0x2e')](handleError(_0x2aa31c,null));};exports[_0xfcc5('0xc1')]=function(_0x2dd43a,_0x2c337c,_0x2e84e2){var _0x16fd34={};var _0x5def8f={};var _0x163cca;var _0x11dff5;return db[_0xfcc5('0x56')][_0xfcc5('0x6d')]({'where':{'id':_0x2dd43a['params']['id']}})[_0xfcc5('0x23')](handleEntityNotFound(_0x2c337c,null))['then'](function(_0x529dc8){if(_0x529dc8){_0x163cca=_0x529dc8;_0x5def8f['model']=_['keys'](db[_0xfcc5('0x7a')][_0xfcc5('0x5f')]);_0x5def8f[_0xfcc5('0x46')]=_['keys'](_0x2dd43a[_0xfcc5('0x46')]);_0x5def8f[_0xfcc5('0x48')]=_['intersection'](_0x5def8f['model'],_0x5def8f[_0xfcc5('0x46')]);_0x16fd34[_0xfcc5('0x4b')]=_['intersection'](_0x5def8f['model'],qs[_0xfcc5('0x4c')](_0x2dd43a[_0xfcc5('0x46')][_0xfcc5('0x4c')]));_0x16fd34[_0xfcc5('0x4b')]=_0x16fd34[_0xfcc5('0x4b')][_0xfcc5('0x4d')]?_0x16fd34['attributes']:_0x5def8f[_0xfcc5('0x4a')];_0x16fd34[_0xfcc5('0x50')]=qs[_0xfcc5('0x51')](_0x2dd43a[_0xfcc5('0x46')]['sort']);_0x16fd34['where']=qs[_0xfcc5('0x48')](_[_0xfcc5('0x53')](_0x2dd43a[_0xfcc5('0x46')],_0x5def8f[_0xfcc5('0x48')]));if(_0x2dd43a['query'][_0xfcc5('0x54')]){_0x16fd34[_0xfcc5('0x52')]=_[_0xfcc5('0x60')](_0x16fd34[_0xfcc5('0x52')],{'$or':_[_0xfcc5('0x43')](_0x16fd34[_0xfcc5('0x4b')],function(_0x4cc1a9){var _0x51eb87={};_0x51eb87[_0x4cc1a9]={'$like':'%'+_0x2dd43a[_0xfcc5('0x46')]['filter']+'%'};return _0x51eb87;})});}_0x16fd34=_[_0xfcc5('0x60')]({},_0x16fd34,_0x2dd43a[_0xfcc5('0x55')]);return _0x163cca[_0xfcc5('0xc1')](_0x16fd34);}})['then'](function(_0x444d03){if(_0x444d03){_0x11dff5=_0x444d03[_0xfcc5('0x4d')];if(!_0x2dd43a[_0xfcc5('0x46')][_0xfcc5('0x4e')]('nolimit')){_0x16fd34[_0xfcc5('0x36')]=qs['limit'](_0x2dd43a[_0xfcc5('0x46')][_0xfcc5('0x36')]);_0x16fd34[_0xfcc5('0x33')]=qs[_0xfcc5('0x33')](_0x2dd43a[_0xfcc5('0x46')][_0xfcc5('0x33')]);}return _0x163cca['getAgents'](_0x16fd34);}})[_0xfcc5('0x23')](function(_0x28f715){if(_0x28f715){return _0x28f715?{'count':_0x11dff5,'rows':_0x28f715}:null;}})[_0xfcc5('0x23')](respondWithResult(_0x2c337c,null))[_0xfcc5('0x2e')](handleError(_0x2c337c,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 1504ec6..a45230c 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 _0xdc7e=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x10d0bc,_0xa3106b){var _0x632b6e=function(_0x399d1b){while(--_0x399d1b){_0x10d0bc['push'](_0x10d0bc['shift']());}};_0x632b6e(++_0xa3106b);}(_0xdc7e,0x1e9));var _0xedc7=function(_0x5a4243,_0x1a97be){_0x5a4243=_0x5a4243-0x0;var _0x1d6389=_0xdc7e[_0x5a4243];return _0x1d6389;};'use strict';var EventEmitter=require(_0xedc7('0x0'));var FaxAccount=require(_0xedc7('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xedc7('0x2')](0x0);var events={'afterCreate':_0xedc7('0x3'),'afterUpdate':_0xedc7('0x4'),'afterDestroy':_0xedc7('0x5')};function emitEvent(_0x949840){return function(_0x5571b7,_0x2a59a2,_0x5766cc){FaxAccountEvents[_0xedc7('0x6')](_0x949840+':'+_0x5571b7['id'],_0x5571b7);FaxAccountEvents['emit'](_0x949840,_0x5571b7);_0x5766cc(null);};}for(var e in events){if(events[_0xedc7('0x7')](e)){var event=events[e];FaxAccount[_0xedc7('0x8')](e,emitEvent(event));}}module[_0xedc7('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0x8fa7=['remove','emit','hasOwnProperty','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x295c41,_0x294f9c){var _0x37f336=function(_0xef0263){while(--_0xef0263){_0x295c41['push'](_0x295c41['shift']());}};_0x37f336(++_0x294f9c);}(_0x8fa7,0x13c));var _0x78fa=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0x8fa7[_0x266618];return _0x54dbf5;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x78fa('0x0'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x78fa('0x1')](0x0);var events={'afterCreate':_0x78fa('0x2'),'afterUpdate':_0x78fa('0x3'),'afterDestroy':_0x78fa('0x4')};function emitEvent(_0x3df507){return function(_0x351e14,_0x4245f2,_0x19dbe0){FaxAccountEvents['emit'](_0x3df507+':'+_0x351e14['id'],_0x351e14);FaxAccountEvents[_0x78fa('0x5')](_0x3df507,_0x351e14);_0x19dbe0(null);};}for(var e in events){if(events[_0x78fa('0x6')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x78fa('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 29c6b9d..0127913 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 _0x0992=['fax_accounts','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount'];(function(_0x190b95,_0xfbfcc9){var _0x4d5c92=function(_0x3a00ea){while(--_0x3a00ea){_0x190b95['push'](_0x190b95['shift']());}};_0x4d5c92(++_0xfbfcc9);}(_0x0992,0xb7));var _0x2099=function(_0x23e6bb,_0x5c2d69){_0x23e6bb=_0x23e6bb-0x0;var _0x1e3b4c=_0x0992[_0x23e6bb];return _0x1e3b4c;};'use strict';var _=require(_0x2099('0x0'));var util=require(_0x2099('0x1'));var logger=require('../../config/logger')(_0x2099('0x2'));var moment=require(_0x2099('0x3'));var BPromise=require(_0x2099('0x4'));var rp=require(_0x2099('0x5'));var fs=require('fs');var path=require(_0x2099('0x6'));var rimraf=require('rimraf');var config=require(_0x2099('0x7'));var attributes=require(_0x2099('0x8'));module[_0x2099('0x9')]=function(_0x74728,_0x311969){return _0x74728[_0x2099('0xa')](_0x2099('0xb'),attributes,{'tableName':_0x2099('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa9c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxAccount','fax_accounts','lodash','api'];(function(_0x463a77,_0xc0ae28){var _0x17a0f4=function(_0x23209c){while(--_0x23209c){_0x463a77['push'](_0x463a77['shift']());}};_0x17a0f4(++_0xc0ae28);}(_0xfa9c,0x11e));var _0xcfa9=function(_0x214ea2,_0xa9f0ed){_0x214ea2=_0x214ea2-0x0;var _0x3359a8=_0xfa9c[_0x214ea2];return _0x3359a8;};'use strict';var _=require(_0xcfa9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcfa9('0x1'));var moment=require(_0xcfa9('0x2'));var BPromise=require(_0xcfa9('0x3'));var rp=require(_0xcfa9('0x4'));var fs=require('fs');var path=require(_0xcfa9('0x5'));var rimraf=require(_0xcfa9('0x6'));var config=require(_0xcfa9('0x7'));var attributes=require('./faxAccount.attributes');module[_0xcfa9('0x8')]=function(_0x53f459,_0x25e295){return _0x53f459[_0xcfa9('0x9')](_0xcfa9('0xa'),attributes,{'tableName':_0xcfa9('0xb'),'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 e0167e2..e71f420 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 _0x60f9=['DESC','FaxApplication','Applications','applications','list','orderBy','priority','asc','contact','FaxInteraction','create','Contact\x20not\x20found','spread','get','autoclose','push','length','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','./faxAccount.socket','register','info','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','map','include','model','then','debug','NotifyFaxAccount','fax','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','CmContact','Contacts'];(function(_0xd3e0b9,_0xd80d4d){var _0x470133=function(_0x1aede8){while(--_0x1aede8){_0xd3e0b9['push'](_0xd3e0b9['shift']());}};_0x470133(++_0xd80d4d);}(_0x60f9,0x1a4));var _0x960f=function(_0x1da72f,_0x443d42){_0x1da72f=_0x1da72f-0x0;var _0x49a2a3=_0x60f9[_0x1da72f];return _0x49a2a3;};'use strict';var _=require(_0x960f('0x0'));var util=require(_0x960f('0x1'));var moment=require(_0x960f('0x2'));var BPromise=require(_0x960f('0x3'));var rs=require(_0x960f('0x4'));var fs=require('fs');var Redis=require(_0x960f('0x5'));var db=require(_0x960f('0x6'))['db'];var utils=require(_0x960f('0x7'));var logger=require(_0x960f('0x8'))(_0x960f('0x9'));var config=require(_0x960f('0xa'));var jayson=require(_0x960f('0xb'));var client=jayson['client']['http']({'port':0x232c});config['redis']=_[_0x960f('0xc')](config[_0x960f('0xd')],{'host':_0x960f('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x960f('0xd')]));require(_0x960f('0xf'))[_0x960f('0x10')](socket);function respondWithRpcPromise(_0x59e51e,_0x1ed5b7,_0x302f4d){return new BPromise(function(_0x171ab3,_0x3b9582){return client['request'](_0x59e51e,_0x302f4d)['then'](function(_0x568e6f){logger[_0x960f('0x11')]('FaxAccount,\x20%s,\x20%s',_0x1ed5b7,_0x960f('0x12'));logger['debug'](_0x960f('0x13'),_0x1ed5b7,_0x960f('0x12'),JSON[_0x960f('0x14')](_0x568e6f));if(_0x568e6f[_0x960f('0x15')]){if(_0x568e6f[_0x960f('0x15')][_0x960f('0x16')]===0x1f4){logger[_0x960f('0x15')](_0x960f('0x17'),_0x1ed5b7,_0x568e6f[_0x960f('0x15')][_0x960f('0x18')]);return _0x3b9582(_0x568e6f['error'][_0x960f('0x18')]);}logger[_0x960f('0x15')](_0x960f('0x17'),_0x1ed5b7,_0x568e6f[_0x960f('0x15')][_0x960f('0x18')]);return _0x171ab3(_0x568e6f[_0x960f('0x15')][_0x960f('0x18')]);}else{logger[_0x960f('0x11')](_0x960f('0x17'),_0x1ed5b7,_0x960f('0x12'));_0x171ab3(_0x568e6f[_0x960f('0x19')][_0x960f('0x18')]);}})[_0x960f('0x1a')](function(_0x204839){logger[_0x960f('0x15')](_0x960f('0x17'),_0x1ed5b7,_0x204839);_0x3b9582(_0x204839);});});}exports[_0x960f('0x1b')]=function(_0x179e09){var _0x52a52f=this;return new Promise(function(_0x4ae967,_0x3a89b0){return db[_0x960f('0x1c')][_0x960f('0x1d')]({'raw':_0x179e09[_0x960f('0x1e')]?_0x179e09[_0x960f('0x1e')][_0x960f('0x1f')]===undefined?!![]:![]:!![],'where':_0x179e09[_0x960f('0x1e')]?_0x179e09[_0x960f('0x1e')][_0x960f('0x20')]||null:null,'attributes':_0x179e09[_0x960f('0x1e')]?_0x179e09[_0x960f('0x1e')][_0x960f('0x21')]||null:null,'limit':_0x179e09[_0x960f('0x1e')]?_0x179e09[_0x960f('0x1e')]['limit']||null:null,'include':_0x179e09[_0x960f('0x1e')]?_0x179e09['options']['include']?_[_0x960f('0x22')](_0x179e09['options']['include'],function(_0x221f7c){return{'model':db[_0x221f7c['model']],'as':_0x221f7c['as'],'attributes':_0x221f7c['attributes'],'include':_0x221f7c[_0x960f('0x23')]?_['map'](_0x221f7c[_0x960f('0x23')],function(_0x167cb8){return{'model':db[_0x167cb8[_0x960f('0x24')]],'as':_0x167cb8['as'],'attributes':_0x167cb8[_0x960f('0x21')],'include':_0x167cb8[_0x960f('0x23')]?_[_0x960f('0x22')](_0x167cb8[_0x960f('0x23')],function(_0x392791){return{'model':db[_0x392791[_0x960f('0x24')]],'as':_0x392791['as'],'attributes':_0x392791[_0x960f('0x21')]};}):[]};}):[]};}):[]:[]})[_0x960f('0x25')](function(_0x315fcc){logger[_0x960f('0x11')](_0x960f('0x1b'),_0x179e09);logger[_0x960f('0x26')](_0x960f('0x1b'),_0x179e09,JSON[_0x960f('0x14')](_0x315fcc));_0x4ae967(_0x315fcc);})['catch'](function(_0x38483b){logger['error'](_0x960f('0x1b'),_0x38483b['message'],_0x179e09);_0x3a89b0(_0x52a52f[_0x960f('0x15')](0x1f4,_0x38483b[_0x960f('0x18')]));});});};exports[_0x960f('0x27')]=function(_0xf3eee5,_0x3c66a2,_0xd4796a){var _0x5c5d08=this;return new Promise(function(_0x2834b6,_0x45cbb3){var _0x4068fa={'body':_0xf3eee5['body'],'channel':_0x960f('0x28')};var _0x9f1339=[];var _0x4fd52a=[];var _0x4483a8={};return db['CmContact']['describe']()[_0x960f('0x25')](function(_0x344fab){if(!_0x344fab){throw new db[(_0x960f('0x29'))][(_0x960f('0x2a'))](_0x960f('0x2b'));}_0x9f1339=_[_0x960f('0x2c')](_[_0x960f('0x2d')](_0x344fab),[_0x960f('0x2e'),_0x960f('0x2f')]);_0x4fd52a=_['difference'](_[_0x960f('0x2d')](_0x344fab),[_0x960f('0x2e'),_0x960f('0x2f'),_0x960f('0x30'),_0x960f('0x31')]);if(_0xf3eee5[_0x960f('0x32')]['id']){delete _0xf3eee5[_0x960f('0x32')]['id'];}if(_[_0x960f('0x33')](_0xf3eee5['body'][_0x960f('0x34')])){throw new db['Sequelize']['ValidationError'](_0x960f('0x35'));}if(_[_0x960f('0x33')](_0xf3eee5[_0x960f('0x32')][_0x960f('0x32')])||_0xf3eee5[_0x960f('0x32')]['body']===''){throw new db['Sequelize']['ValidationError'](_0x960f('0x36'));}if(_[_0x960f('0x33')](_0xf3eee5[_0x960f('0x32')]['mapKey'])){throw new db[(_0x960f('0x29'))][(_0x960f('0x2a'))](_0x960f('0x37')+_0x4fd52a);}if(!_[_0x960f('0x38')](_0x4fd52a,_0xf3eee5[_0x960f('0x32')][_0x960f('0x39')])){throw new db['Sequelize'][(_0x960f('0x2a'))](_0x960f('0x3a')+_0x4fd52a);}_0x4483a8[_0xf3eee5['body'][_0x960f('0x39')]]=_0xf3eee5[_0x960f('0x32')][_0x960f('0x34')];})[_0x960f('0x25')](function(){return db['FaxAccount'][_0x960f('0x3b')]({'where':{'id':_0xf3eee5[_0x960f('0x3c')]['id']},'include':[{'model':db[_0x960f('0x3d')],'as':_0x960f('0x3e'),'include':[{'model':db[_0x960f('0x3f')],'as':_0x960f('0x40'),'where':_0x4483a8,'limit':0x1,'order':[[_0x960f('0x2f'),_0x960f('0x41')]]}]},{'model':db[_0x960f('0x42')],'as':_0x960f('0x43')}]});})[_0x960f('0x25')](function(_0x481804){if(_0x481804&&_0x481804['List']){var _0xe33657=_0x481804['get']({'plain':!![]});_0x4068fa[_0x960f('0x3c')]=_0xe33657;_0x4068fa[_0x960f('0x44')]=_0xe33657[_0x960f('0x43')];_0x4068fa[_0x960f('0x45')]=_0xe33657['List'];_0x4068fa[_0x960f('0x44')]=_[_0x960f('0x46')](_0x4068fa['applications'],[_0x960f('0x47')],[_0x960f('0x48')]);if(_0x4068fa['account'][_0x960f('0x43')]){delete _0x4068fa[_0x960f('0x3c')][_0x960f('0x43')];}if(_0x4068fa[_0x960f('0x3c')][_0x960f('0x3e')]&&_0x4068fa[_0x960f('0x3c')][_0x960f('0x3e')][_0x960f('0x40')]['length']){return _0x4068fa[_0x960f('0x3c')]['List'][_0x960f('0x40')][0x0];}var _0x1af105=_[_0x960f('0xc')](_0xf3eee5['body'],{'firstName':_0xf3eee5[_0x960f('0x32')][_0x960f('0x34')],'ListId':_0xe33657['ListId']});_0x1af105[_0xf3eee5[_0x960f('0x32')][_0x960f('0x39')]]=_0xf3eee5[_0x960f('0x32')][_0x960f('0x34')];return db[_0x960f('0x3f')]['create'](_0x1af105,{'fields':_0x9f1339,'raw':!![]});}})[_0x960f('0x25')](function(_0x19a474){_0x4068fa[_0x960f('0x49')]=_0x19a474;if(_0x19a474){var _0x2a5321={'ContactId':_0x19a474['id'],'FaxAccountId':_0xf3eee5[_0x960f('0x3c')]['id'],'fax':_0x19a474[_0x960f('0x28')]};return db[_0x960f('0x4a')][_0x960f('0x3b')]({'where':{'ContactId':_0x19a474['id'],'closed':![],'FaxAccountId':_0xf3eee5[_0x960f('0x3c')]['id']}})[_0x960f('0x25')](function(_0xb9b491){if(_0xb9b491){return[_0xb9b491,![]];}return db['FaxInteraction'][_0x960f('0x4b')](_0x2a5321)[_0x960f('0x25')](function(_0x2a113f){return[_0x2a113f,!![]];});});}else{throw new Error(_0x960f('0x4c'));}})[_0x960f('0x4d')](function(_0x302434,_0xd3c9ad){var _0x289570=_0x302434[_0x960f('0x4e')]({'plain':!![]});if(_0xd3c9ad){if(_0x4068fa[_0x960f('0x3c')][_0x960f('0x4f')]){_0x4068fa[_0x960f('0x44')][_0x960f('0x50')]({'id':0x0,'priority':_0x4068fa['applications'][_0x960f('0x51')]+0x1,'app':_0x960f('0x52'),'appdata':_0x960f('0x53'),'interval':_0x960f('0x54')});}_0x289570[_0x960f('0x55')]=!![];}else{_0x289570['created']=![];}_0x4068fa[_0x960f('0x56')]=_0x289570;return db[_0x960f('0x57')][_0x960f('0x4b')]({'body':_0xf3eee5[_0x960f('0x32')][_0x960f('0x32')],'FaxAccountId':_0xf3eee5[_0x960f('0x3c')]['id'],'FaxInteractionId':_0x302434['id'],'direction':'in','ContactId':_0x302434[_0x960f('0x58')],'AttachmentId':_0xf3eee5[_0x960f('0x32')][_0x960f('0x59')]});})[_0x960f('0x25')](function(_0xcbbbb8){_0x4068fa[_0x960f('0x18')]=_0xcbbbb8;if(_0x4068fa['interaction'][_0x960f('0x5a')]){return db[_0x960f('0x5b')][_0x960f('0x3b')]({'attributes':['id',_0x960f('0x5c')],'where':{'id':_0x4068fa[_0x960f('0x56')][_0x960f('0x5a')]}})[_0x960f('0x25')](function(_0x50cd4d){if(_0x50cd4d){_0x4068fa[_0x960f('0x44')]['unshift']({'id':0x0,'priority':0x0,'app':_0x960f('0x5d'),'appdata':_0x50cd4d[_0x960f('0x5c')]+','+(_0x4068fa['account'][_0x960f('0x5e')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x960f('0x5f'),_0x960f('0x60'),_0x4068fa);});}return respondWithRpcPromise(_0x960f('0x5f'),_0x960f('0x60'),_0x4068fa);})['then'](function(_0x243d9b){_0x2834b6(_0x243d9b);})[_0x960f('0x1a')](function(_0x4ebd7a){_0x45cbb3(_0x5c5d08[_0x960f('0x15')](0x1f4,_0x4ebd7a['message']));});});}; \ No newline at end of file +var _0xe589=['startRouting','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFaxAccount','FaxAccount','options','raw','where','limit','include','map','model','attributes','NotifyFaxAccount','body','fax','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','list','applications','orderBy','priority','asc','length','create','contact','FaxInteraction','spread','get','autoclose','push','close','unmanaged','*,*,*,*','created','FaxMessage','AttachmentId','UserId','User','interaction','unshift','name','waitForTheAssignedAgent','Start'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xe589,0x169));var _0x9e58=function(_0x3f6942,_0x5ca7a3){_0x3f6942=_0x3f6942-0x0;var _0x4738b9=_0xe589[_0x3f6942];return _0x4738b9;};'use strict';var _=require(_0x9e58('0x0'));var util=require(_0x9e58('0x1'));var moment=require(_0x9e58('0x2'));var BPromise=require(_0x9e58('0x3'));var rs=require(_0x9e58('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9e58('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9e58('0x6'));var config=require(_0x9e58('0x7'));var jayson=require(_0x9e58('0x8'));var client=jayson[_0x9e58('0x9')][_0x9e58('0xa')]({'port':0x232c});config[_0x9e58('0xb')]=_[_0x9e58('0xc')](config[_0x9e58('0xb')],{'host':_0x9e58('0xd'),'port':0x18eb});var socket=require(_0x9e58('0xe'))(new Redis(config[_0x9e58('0xb')]));require(_0x9e58('0xf'))[_0x9e58('0x10')](socket);function respondWithRpcPromise(_0x3e0927,_0x3672d3,_0x65ebf6){return new BPromise(function(_0x45df53,_0x120682){return client['request'](_0x3e0927,_0x65ebf6)[_0x9e58('0x11')](function(_0x39397f){logger[_0x9e58('0x12')](_0x9e58('0x13'),_0x3672d3,_0x9e58('0x14'));logger[_0x9e58('0x15')](_0x9e58('0x16'),_0x3672d3,'request\x20sent',JSON[_0x9e58('0x17')](_0x39397f));if(_0x39397f[_0x9e58('0x18')]){if(_0x39397f[_0x9e58('0x18')]['code']===0x1f4){logger['error'](_0x9e58('0x13'),_0x3672d3,_0x39397f[_0x9e58('0x18')][_0x9e58('0x19')]);return _0x120682(_0x39397f['error'][_0x9e58('0x19')]);}logger[_0x9e58('0x18')](_0x9e58('0x13'),_0x3672d3,_0x39397f['error'][_0x9e58('0x19')]);return _0x45df53(_0x39397f['error'][_0x9e58('0x19')]);}else{logger[_0x9e58('0x12')](_0x9e58('0x13'),_0x3672d3,_0x9e58('0x14'));_0x45df53(_0x39397f[_0x9e58('0x1a')][_0x9e58('0x19')]);}})[_0x9e58('0x1b')](function(_0x2c84f5){logger['error'](_0x9e58('0x13'),_0x3672d3,_0x2c84f5);_0x120682(_0x2c84f5);});});}exports[_0x9e58('0x1c')]=function(_0x5e33f3){var _0x230cfa=this;return new Promise(function(_0x5242f5,_0x3ae777){return db[_0x9e58('0x1d')]['findAll']({'raw':_0x5e33f3[_0x9e58('0x1e')]?_0x5e33f3[_0x9e58('0x1e')][_0x9e58('0x1f')]===undefined?!![]:![]:!![],'where':_0x5e33f3[_0x9e58('0x1e')]?_0x5e33f3[_0x9e58('0x1e')][_0x9e58('0x20')]||null:null,'attributes':_0x5e33f3['options']?_0x5e33f3[_0x9e58('0x1e')]['attributes']||null:null,'limit':_0x5e33f3['options']?_0x5e33f3['options'][_0x9e58('0x21')]||null:null,'include':_0x5e33f3['options']?_0x5e33f3['options'][_0x9e58('0x22')]?_[_0x9e58('0x23')](_0x5e33f3[_0x9e58('0x1e')]['include'],function(_0x72c221){return{'model':db[_0x72c221[_0x9e58('0x24')]],'as':_0x72c221['as'],'attributes':_0x72c221[_0x9e58('0x25')],'include':_0x72c221['include']?_['map'](_0x72c221['include'],function(_0x1136e2){return{'model':db[_0x1136e2[_0x9e58('0x24')]],'as':_0x1136e2['as'],'attributes':_0x1136e2['attributes'],'include':_0x1136e2[_0x9e58('0x22')]?_['map'](_0x1136e2[_0x9e58('0x22')],function(_0x34212d){return{'model':db[_0x34212d[_0x9e58('0x24')]],'as':_0x34212d['as'],'attributes':_0x34212d[_0x9e58('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a4763){logger[_0x9e58('0x12')](_0x9e58('0x1c'),_0x5e33f3);logger[_0x9e58('0x15')](_0x9e58('0x1c'),_0x5e33f3,JSON[_0x9e58('0x17')](_0x1a4763));_0x5242f5(_0x1a4763);})['catch'](function(_0x573516){logger[_0x9e58('0x18')](_0x9e58('0x1c'),_0x573516['message'],_0x5e33f3);_0x3ae777(_0x230cfa[_0x9e58('0x18')](0x1f4,_0x573516[_0x9e58('0x19')]));});});};exports[_0x9e58('0x26')]=function(_0x197a32,_0x233906,_0x231108){var _0x26646a=this;return new Promise(function(_0x34e42c,_0x288866){var _0x121c77={'body':_0x197a32[_0x9e58('0x27')],'channel':_0x9e58('0x28')};var _0x4d343f=[];var _0x476b0e=[];var _0x390c74={};return db[_0x9e58('0x29')]['describe']()[_0x9e58('0x11')](function(_0x386996){if(!_0x386996){throw new db[(_0x9e58('0x2a'))][(_0x9e58('0x2b'))](_0x9e58('0x2c'));}_0x4d343f=_[_0x9e58('0x2d')](_[_0x9e58('0x2e')](_0x386996),[_0x9e58('0x2f'),_0x9e58('0x30')]);_0x476b0e=_['difference'](_['keys'](_0x386996),['createdAt',_0x9e58('0x30'),'CompanyId',_0x9e58('0x31')]);if(_0x197a32[_0x9e58('0x27')]['id']){delete _0x197a32[_0x9e58('0x27')]['id'];}if(_[_0x9e58('0x32')](_0x197a32['body'][_0x9e58('0x33')])){throw new db['Sequelize'][(_0x9e58('0x2b'))](_0x9e58('0x34'));}if(_['isNil'](_0x197a32[_0x9e58('0x27')][_0x9e58('0x27')])||_0x197a32[_0x9e58('0x27')][_0x9e58('0x27')]===''){throw new db[(_0x9e58('0x2a'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x9e58('0x32')](_0x197a32[_0x9e58('0x27')]['mapKey'])){throw new db[(_0x9e58('0x2a'))][(_0x9e58('0x2b'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x476b0e);}if(!_['includes'](_0x476b0e,_0x197a32['body'][_0x9e58('0x35')])){throw new db[(_0x9e58('0x2a'))][(_0x9e58('0x2b'))](_0x9e58('0x36')+_0x476b0e);}_0x390c74[_0x197a32[_0x9e58('0x27')]['mapKey']]=_0x197a32[_0x9e58('0x27')]['from'];})[_0x9e58('0x11')](function(){return db[_0x9e58('0x1d')][_0x9e58('0x37')]({'where':{'id':_0x197a32[_0x9e58('0x38')]['id']},'include':[{'model':db[_0x9e58('0x39')],'as':_0x9e58('0x3a'),'include':[{'model':db[_0x9e58('0x29')],'as':_0x9e58('0x3b'),'where':_0x390c74,'limit':0x1,'order':[[_0x9e58('0x30'),_0x9e58('0x3c')]]}]},{'model':db[_0x9e58('0x3d')],'as':_0x9e58('0x3e')}]});})[_0x9e58('0x11')](function(_0x7344eb){if(_0x7344eb&&_0x7344eb[_0x9e58('0x3a')]){var _0x47d7ac=_0x7344eb['get']({'plain':!![]});_0x121c77[_0x9e58('0x38')]=_0x47d7ac;_0x121c77['applications']=_0x47d7ac[_0x9e58('0x3e')];_0x121c77[_0x9e58('0x3f')]=_0x47d7ac[_0x9e58('0x3a')];_0x121c77[_0x9e58('0x40')]=_[_0x9e58('0x41')](_0x121c77[_0x9e58('0x40')],[_0x9e58('0x42')],[_0x9e58('0x43')]);if(_0x121c77[_0x9e58('0x38')]['Applications']){delete _0x121c77[_0x9e58('0x38')]['Applications'];}if(_0x121c77[_0x9e58('0x38')][_0x9e58('0x3a')]&&_0x121c77[_0x9e58('0x38')][_0x9e58('0x3a')][_0x9e58('0x3b')][_0x9e58('0x44')]){return _0x121c77[_0x9e58('0x38')]['List'][_0x9e58('0x3b')][0x0];}var _0x447f33=_[_0x9e58('0xc')](_0x197a32[_0x9e58('0x27')],{'firstName':_0x197a32[_0x9e58('0x27')][_0x9e58('0x33')],'ListId':_0x47d7ac['ListId']});_0x447f33[_0x197a32[_0x9e58('0x27')][_0x9e58('0x35')]]=_0x197a32[_0x9e58('0x27')][_0x9e58('0x33')];return db[_0x9e58('0x29')][_0x9e58('0x45')](_0x447f33,{'fields':_0x4d343f,'raw':!![]});}})['then'](function(_0x3818d7){_0x121c77[_0x9e58('0x46')]=_0x3818d7;if(_0x3818d7){var _0x150cda={'ContactId':_0x3818d7['id'],'FaxAccountId':_0x197a32[_0x9e58('0x38')]['id'],'fax':_0x3818d7[_0x9e58('0x28')]};return db[_0x9e58('0x47')][_0x9e58('0x37')]({'where':{'ContactId':_0x3818d7['id'],'closed':![],'FaxAccountId':_0x197a32['account']['id']}})[_0x9e58('0x11')](function(_0x1440cb){if(_0x1440cb){return[_0x1440cb,![]];}return db['FaxInteraction'][_0x9e58('0x45')](_0x150cda)[_0x9e58('0x11')](function(_0x13a853){return[_0x13a853,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x9e58('0x48')](function(_0x30cfe2,_0x2d910f){var _0x5f4625=_0x30cfe2[_0x9e58('0x49')]({'plain':!![]});if(_0x2d910f){if(_0x121c77[_0x9e58('0x38')][_0x9e58('0x4a')]){_0x121c77['applications'][_0x9e58('0x4b')]({'id':0x0,'priority':_0x121c77['applications']['length']+0x1,'app':_0x9e58('0x4c'),'appdata':_0x9e58('0x4d'),'interval':_0x9e58('0x4e')});}_0x5f4625['created']=!![];}else{_0x5f4625[_0x9e58('0x4f')]=![];}_0x121c77['interaction']=_0x5f4625;return db[_0x9e58('0x50')][_0x9e58('0x45')]({'body':_0x197a32[_0x9e58('0x27')][_0x9e58('0x27')],'FaxAccountId':_0x197a32[_0x9e58('0x38')]['id'],'FaxInteractionId':_0x30cfe2['id'],'direction':'in','ContactId':_0x30cfe2['ContactId'],'AttachmentId':_0x197a32[_0x9e58('0x27')][_0x9e58('0x51')]});})['then'](function(_0x57e831){_0x121c77[_0x9e58('0x19')]=_0x57e831;if(_0x121c77['interaction'][_0x9e58('0x52')]){return db[_0x9e58('0x53')]['find']({'attributes':['id','name'],'where':{'id':_0x121c77[_0x9e58('0x54')][_0x9e58('0x52')]}})[_0x9e58('0x11')](function(_0xf46909){if(_0xf46909){_0x121c77[_0x9e58('0x40')][_0x9e58('0x55')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xf46909[_0x9e58('0x56')]+','+(_0x121c77['account'][_0x9e58('0x57')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x9e58('0x58'),_0x9e58('0x59'),_0x121c77);});}return respondWithRpcPromise(_0x9e58('0x58'),_0x9e58('0x59'),_0x121c77);})[_0x9e58('0x11')](function(_0x591e1f){_0x34e42c(_0x591e1f);})[_0x9e58('0x1b')](function(_0x4df0b5){_0x288866(_0x26646a[_0x9e58('0x18')](0x1f4,_0x4df0b5[_0x9e58('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index bb0fd8d..8cb4825 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 _0x0d0c=['save','remove','update','removeListener','register','length','./faxAccount.events'];(function(_0x865a5b,_0x3ecd1a){var _0x46c374=function(_0x1fa804){while(--_0x1fa804){_0x865a5b['push'](_0x865a5b['shift']());}};_0x46c374(++_0x3ecd1a);}(_0x0d0c,0xb5));var _0xc0d0=function(_0x250d51,_0x289368){_0x250d51=_0x250d51-0x0;var _0x1a882b=_0x0d0c[_0x250d51];return _0x1a882b;};'use strict';var FaxAccountEvents=require(_0xc0d0('0x0'));var events=[_0xc0d0('0x1'),_0xc0d0('0x2'),_0xc0d0('0x3')];function createListener(_0xd597b9,_0x2d3b59){return function(_0x3b1387){_0x2d3b59['emit'](_0xd597b9,_0x3b1387);};}function removeListener(_0x2049c4,_0x567f59){return function(){FaxAccountEvents[_0xc0d0('0x4')](_0x2049c4,_0x567f59);};}exports[_0xc0d0('0x5')]=function(_0x4f5bc0){for(var _0x2afcee=0x0,_0x174713=events[_0xc0d0('0x6')];_0x2afcee<_0x174713;_0x2afcee++){var _0x5adf7b=events[_0x2afcee];var _0x196df5=createListener('faxAccount:'+_0x5adf7b,_0x4f5bc0);FaxAccountEvents['on'](_0x5adf7b,_0x196df5);}}; \ No newline at end of file +var _0xcca8=['length','faxAccount:','save','emit','removeListener','register'];(function(_0x33bcdb,_0x11846b){var _0x18a9bf=function(_0x34417a){while(--_0x34417a){_0x33bcdb['push'](_0x33bcdb['shift']());}};_0x18a9bf(++_0x11846b);}(_0xcca8,0x110));var _0x8cca=function(_0x405fe8,_0xa55e2f){_0x405fe8=_0x405fe8-0x0;var _0x50e490=_0xcca8[_0x405fe8];return _0x50e490;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x8cca('0x0'),'remove','update'];function createListener(_0x169224,_0x267a4d){return function(_0x517007){_0x267a4d[_0x8cca('0x1')](_0x169224,_0x517007);};}function removeListener(_0x585a0b,_0x31f3a5){return function(){FaxAccountEvents[_0x8cca('0x2')](_0x585a0b,_0x31f3a5);};}exports[_0x8cca('0x3')]=function(_0x23d0fa){for(var _0x5239e6=0x0,_0x51df46=events[_0x8cca('0x4')];_0x5239e6<_0x51df46;_0x5239e6++){var _0xd13bb5=events[_0x5239e6];var _0xfb4f92=createListener(_0x8cca('0x5')+_0xd13bb5,_0x23d0fa);FaxAccountEvents['on'](_0xd13bb5,_0xfb4f92);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 0709f6a..19188d4 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x430298,_0x4a2293){var _0x481e9a=function(_0x1a75b7){while(--_0x1a75b7){_0x430298['push'](_0x430298['shift']());}};_0x481e9a(++_0x4a2293);}(_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'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x1eb36d,_0xf36f69){var _0x30cae3=function(_0xf70ff5){while(--_0xf70ff5){_0x1eb36d['push'](_0x1eb36d['shift']());}};_0x30cae3(++_0xf36f69);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 6ad12bf..a5f1602 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 _0x5806=['STRING','TEXT','sequelize','exports','INTEGER'];(function(_0x5732d6,_0x2c9500){var _0x3a1a0f=function(_0x5ae05e){while(--_0x5ae05e){_0x5732d6['push'](_0x5732d6['shift']());}};_0x3a1a0f(++_0x2c9500);}(_0x5806,0x174));var _0x6580=function(_0x291d3f,_0x3ef99f){_0x291d3f=_0x291d3f-0x0;var _0x242080=_0x5806[_0x291d3f];return _0x242080;};'use strict';var Sequelize=require(_0x6580('0x0'));module[_0x6580('0x1')]={'priority':{'type':Sequelize[_0x6580('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6580('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x6580('0x4')]()},'description':{'type':Sequelize[_0x6580('0x3')]},'interval':{'type':Sequelize[_0x6580('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xedf7=['STRING','*,*,*,*','sequelize','INTEGER','TEXT'];(function(_0x1034ca,_0x14ecd6){var _0x1a023a=function(_0x2cfa65){while(--_0x2cfa65){_0x1034ca['push'](_0x1034ca['shift']());}};_0x1a023a(++_0x14ecd6);}(_0xedf7,0xe3));var _0x7edf=function(_0x51da10,_0x1f4191){_0x51da10=_0x51da10-0x0;var _0x2795a9=_0xedf7[_0x51da10];return _0x2795a9;};'use strict';var Sequelize=require(_0x7edf('0x0'));module['exports']={'priority':{'type':Sequelize[_0x7edf('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x7edf('0x2')]()},'description':{'type':Sequelize[_0x7edf('0x3')]},'interval':{'type':Sequelize[_0x7edf('0x3')],'defaultValue':_0x7edf('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index a6a5a76..b0dc697 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 _0x53e2=['set','reject','save','update','then','error','stack','name','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','pick','merge','where','VIRTUAL','filter','options','include','FaxApplication','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count'];(function(_0x4dcbec,_0x588b0a){var _0x498a21=function(_0x31edd8){while(--_0x31edd8){_0x4dcbec['push'](_0x4dcbec['shift']());}};_0x498a21(++_0x588b0a);}(_0x53e2,0xc3));var _0x253e=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x53e2[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x253e('0x0'));var zipdir=require(_0x253e('0x1'));var jsonpatch=require(_0x253e('0x2'));var rp=require(_0x253e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x253e('0x4'));var util=require(_0x253e('0x5'));var path=require('path');var sox=require(_0x253e('0x6'));var csv=require(_0x253e('0x7'));var ejs=require(_0x253e('0x8'));var fs=require('fs');var fs_extra=require(_0x253e('0x9'));var _=require('lodash');var squel=require(_0x253e('0xa'));var crypto=require(_0x253e('0xb'));var jsforce=require(_0x253e('0xc'));var deskjs=require(_0x253e('0xd'));var toCsv=require(_0x253e('0x7'));var querystring=require(_0x253e('0xe'));var Papa=require(_0x253e('0xf'));var Redis=require(_0x253e('0x10'));var authService=require(_0x253e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x253e('0x12'));var hardwareService=require(_0x253e('0x13'));var logger=require(_0x253e('0x14'))(_0x253e('0x15'));var utils=require(_0x253e('0x16'));var config=require(_0x253e('0x17'));var licenseUtil=require(_0x253e('0x18'));var db=require(_0x253e('0x19'))['db'];function respondWithStatusCode(_0x11242d,_0x32db49){_0x32db49=_0x32db49||0xcc;return function(_0x12f5dc){if(_0x12f5dc){return _0x11242d[_0x253e('0x1a')](_0x32db49);}return _0x11242d[_0x253e('0x1b')](_0x32db49)[_0x253e('0x1c')]();};}function respondWithResult(_0x56ae16,_0x194a81){_0x194a81=_0x194a81||0xc8;return function(_0x53a315){if(_0x53a315){return _0x56ae16['status'](_0x194a81)[_0x253e('0x1d')](_0x53a315);}};}function respondWithFilteredResult(_0x5500b1,_0x514f10){return function(_0x30fcab){if(_0x30fcab){var _0x4845a6=typeof _0x514f10[_0x253e('0x1e')]===_0x253e('0x1f')&&typeof _0x514f10['limit']===_0x253e('0x1f');var _0x193bb9=_0x30fcab['count'];var _0x40f1ec=_0x4845a6?0x0:_0x514f10[_0x253e('0x1e')];var _0x53aef9=_0x4845a6?_0x30fcab[_0x253e('0x20')]:_0x514f10[_0x253e('0x1e')]+_0x514f10['limit'];var _0x548b69;if(_0x53aef9>=_0x193bb9){_0x53aef9=_0x193bb9;_0x548b69=0xc8;}else{_0x548b69=0xce;}_0x5500b1[_0x253e('0x1b')](_0x548b69);return _0x5500b1[_0x253e('0x21')]('Content-Range',_0x40f1ec+'-'+_0x53aef9+'/'+_0x193bb9)['json'](_0x30fcab);}return null;};}function patchUpdates(_0x3965ff){return function(_0x49ad09){try{jsonpatch['apply'](_0x49ad09,_0x3965ff,!![]);}catch(_0x129b67){return BPromise[_0x253e('0x22')](_0x129b67);}return _0x49ad09[_0x253e('0x23')]();};}function saveUpdates(_0x5a4182,_0x3f48bd){return function(_0x1d5571){if(_0x1d5571){return _0x1d5571[_0x253e('0x24')](_0x5a4182)[_0x253e('0x25')](function(_0x2a42a8){return _0x2a42a8;});}return null;};}function removeEntity(_0x2c0063,_0x55a1a8){return function(_0x2a4cf9){if(_0x2a4cf9){return _0x2a4cf9['destroy']()[_0x253e('0x25')](function(){_0x2c0063['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x272e6c,_0x55f303){return function(_0x11567f){if(!_0x11567f){_0x272e6c[_0x253e('0x1a')](0x194);}return _0x11567f;};}function handleError(_0x3735e6,_0x56bd8e){_0x56bd8e=_0x56bd8e||0x1f4;return function(_0x204a64){logger[_0x253e('0x26')](_0x204a64[_0x253e('0x27')]);if(_0x204a64[_0x253e('0x28')]){delete _0x204a64['name'];}_0x3735e6[_0x253e('0x1b')](_0x56bd8e)['send'](_0x204a64);};}exports['index']=function(_0x2ad169,_0x254431){var _0x5c7996={},_0x488df9={},_0x1177ef={'count':0x0,'rows':[]};var _0x3603fa=_[_0x253e('0x29')](db['FaxApplication']['rawAttributes'],function(_0x2c7d13){return{'name':_0x2c7d13[_0x253e('0x2a')],'type':_0x2c7d13[_0x253e('0x2b')][_0x253e('0x2c')]};});_0x488df9[_0x253e('0x2d')]=_[_0x253e('0x29')](_0x3603fa,'name');_0x488df9[_0x253e('0x2e')]=_[_0x253e('0x2f')](_0x2ad169[_0x253e('0x2e')]);_0x488df9[_0x253e('0x30')]=_[_0x253e('0x31')](_0x488df9[_0x253e('0x2d')],_0x488df9['query']);_0x5c7996['attributes']=_[_0x253e('0x31')](_0x488df9['model'],qs[_0x253e('0x32')](_0x2ad169[_0x253e('0x2e')][_0x253e('0x32')]));_0x5c7996[_0x253e('0x33')]=_0x5c7996[_0x253e('0x33')][_0x253e('0x34')]?_0x5c7996[_0x253e('0x33')]:_0x488df9[_0x253e('0x2d')];if(!_0x2ad169[_0x253e('0x2e')][_0x253e('0x35')](_0x253e('0x36'))){_0x5c7996[_0x253e('0x37')]=qs[_0x253e('0x37')](_0x2ad169[_0x253e('0x2e')][_0x253e('0x37')]);_0x5c7996[_0x253e('0x1e')]=qs[_0x253e('0x1e')](_0x2ad169['query'][_0x253e('0x1e')]);}_0x5c7996['order']=qs[_0x253e('0x38')](_0x2ad169[_0x253e('0x2e')][_0x253e('0x38')]);_0x5c7996['where']=qs[_0x253e('0x30')](_[_0x253e('0x39')](_0x2ad169['query'],_0x488df9['filters']),_0x3603fa);if(_0x2ad169[_0x253e('0x2e')]['filter']){_0x5c7996['where']=_[_0x253e('0x3a')](_0x5c7996[_0x253e('0x3b')],{'$or':_[_0x253e('0x29')](_0x3603fa,function(_0x3031bd){if(_0x3031bd[_0x253e('0x2b')]!==_0x253e('0x3c')){var _0x3434e8={};_0x3434e8[_0x3031bd[_0x253e('0x28')]]={'$like':'%'+_0x2ad169[_0x253e('0x2e')][_0x253e('0x3d')]+'%'};return _0x3434e8;}})});}_0x5c7996=_['merge']({},_0x5c7996,_0x2ad169[_0x253e('0x3e')]);var _0x355859={'where':_0x5c7996['where']};return db['FaxApplication']['count'](_0x355859)['then'](function(_0x2a9550){_0x1177ef[_0x253e('0x20')]=_0x2a9550;if(_0x2ad169[_0x253e('0x2e')]['includeAll']){_0x5c7996[_0x253e('0x3f')]=[{'all':!![]}];}return db[_0x253e('0x40')][_0x253e('0x41')](_0x5c7996);})[_0x253e('0x25')](function(_0x5e6482){_0x1177ef[_0x253e('0x42')]=_0x5e6482;return _0x1177ef;})[_0x253e('0x25')](respondWithFilteredResult(_0x254431,_0x5c7996))[_0x253e('0x43')](handleError(_0x254431,null));};exports[_0x253e('0x44')]=function(_0x252dfe,_0x2b3438){var _0x28bf19={'raw':!![],'where':{'id':_0x252dfe[_0x253e('0x45')]['id']}},_0x525b8f={};_0x525b8f[_0x253e('0x2d')]=_['keys'](db[_0x253e('0x40')][_0x253e('0x46')]);_0x525b8f[_0x253e('0x2e')]=_[_0x253e('0x2f')](_0x252dfe[_0x253e('0x2e')]);_0x525b8f[_0x253e('0x30')]=_['intersection'](_0x525b8f[_0x253e('0x2d')],_0x525b8f[_0x253e('0x2e')]);_0x28bf19[_0x253e('0x33')]=_[_0x253e('0x31')](_0x525b8f['model'],qs[_0x253e('0x32')](_0x252dfe[_0x253e('0x2e')][_0x253e('0x32')]));_0x28bf19[_0x253e('0x33')]=_0x28bf19[_0x253e('0x33')]['length']?_0x28bf19[_0x253e('0x33')]:_0x525b8f[_0x253e('0x2d')];if(_0x252dfe['query'][_0x253e('0x47')]){_0x28bf19[_0x253e('0x3f')]=[{'all':!![]}];}_0x28bf19=_[_0x253e('0x3a')]({},_0x28bf19,_0x252dfe['options']);return db[_0x253e('0x40')][_0x253e('0x48')](_0x28bf19)[_0x253e('0x25')](handleEntityNotFound(_0x2b3438,null))[_0x253e('0x25')](respondWithResult(_0x2b3438,null))['catch'](handleError(_0x2b3438,null));};exports[_0x253e('0x49')]=function(_0x448215,_0xaae06c){return db[_0x253e('0x40')][_0x253e('0x49')](_0x448215[_0x253e('0x4a')],{})['then'](respondWithResult(_0xaae06c,0xc9))[_0x253e('0x43')](handleError(_0xaae06c,null));};exports[_0x253e('0x24')]=function(_0x2efead,_0x1f9fda){if(_0x2efead[_0x253e('0x4a')]['id']){delete _0x2efead[_0x253e('0x4a')]['id'];}return db[_0x253e('0x40')]['find']({'where':{'id':_0x2efead[_0x253e('0x45')]['id']}})['then'](handleEntityNotFound(_0x1f9fda,null))[_0x253e('0x25')](saveUpdates(_0x2efead[_0x253e('0x4a')],null))[_0x253e('0x25')](respondWithResult(_0x1f9fda,null))[_0x253e('0x43')](handleError(_0x1f9fda,null));};exports[_0x253e('0x4b')]=function(_0x19f6dc,_0x54e9d2){return db[_0x253e('0x40')][_0x253e('0x48')]({'where':{'id':_0x19f6dc[_0x253e('0x45')]['id']}})[_0x253e('0x25')](handleEntityNotFound(_0x54e9d2,null))[_0x253e('0x25')](removeEntity(_0x54e9d2,null))[_0x253e('0x43')](handleError(_0x54e9d2,null));}; \ No newline at end of file +var _0x01cd=['includeAll','include','rows','catch','show','params','merge','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','FaxApplication','rawAttributes','fieldName','key','map','name','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','type','VIRTUAL'];(function(_0x499da1,_0xccefec){var _0x40156f=function(_0x4c0c88){while(--_0x4c0c88){_0x499da1['push'](_0x499da1['shift']());}};_0x40156f(++_0xccefec);}(_0x01cd,0x1c0));var _0xd01c=function(_0x2daa59,_0x23bd79){_0x2daa59=_0x2daa59-0x0;var _0x58501d=_0x01cd[_0x2daa59];return _0x58501d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd01c('0x0'));var zipdir=require(_0xd01c('0x1'));var jsonpatch=require(_0xd01c('0x2'));var rp=require(_0xd01c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd01c('0x4'));var util=require(_0xd01c('0x5'));var path=require(_0xd01c('0x6'));var sox=require(_0xd01c('0x7'));var csv=require(_0xd01c('0x8'));var ejs=require(_0xd01c('0x9'));var fs=require('fs');var fs_extra=require(_0xd01c('0xa'));var _=require('lodash');var squel=require(_0xd01c('0xb'));var crypto=require(_0xd01c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd01c('0xd'));var Papa=require('papaparse');var Redis=require(_0xd01c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd01c('0xf'));var as=require(_0xd01c('0x10'));var hardwareService=require(_0xd01c('0x11'));var logger=require('../../config/logger')(_0xd01c('0x12'));var utils=require(_0xd01c('0x13'));var config=require(_0xd01c('0x14'));var licenseUtil=require(_0xd01c('0x15'));var db=require(_0xd01c('0x16'))['db'];function respondWithStatusCode(_0x182c50,_0x129e16){_0x129e16=_0x129e16||0xcc;return function(_0x4aa441){if(_0x4aa441){return _0x182c50[_0xd01c('0x17')](_0x129e16);}return _0x182c50['status'](_0x129e16)[_0xd01c('0x18')]();};}function respondWithResult(_0x4c45b6,_0x506fd3){_0x506fd3=_0x506fd3||0xc8;return function(_0x3d7229){if(_0x3d7229){return _0x4c45b6['status'](_0x506fd3)['json'](_0x3d7229);}};}function respondWithFilteredResult(_0x3c1c8c,_0x22fca3){return function(_0x1991fb){if(_0x1991fb){var _0x575360=typeof _0x22fca3[_0xd01c('0x19')]===_0xd01c('0x1a')&&typeof _0x22fca3[_0xd01c('0x1b')]==='undefined';var _0x2d53f0=_0x1991fb[_0xd01c('0x1c')];var _0x839173=_0x575360?0x0:_0x22fca3[_0xd01c('0x19')];var _0x8a306=_0x575360?_0x1991fb[_0xd01c('0x1c')]:_0x22fca3['offset']+_0x22fca3[_0xd01c('0x1b')];var _0x3e13b0;if(_0x8a306>=_0x2d53f0){_0x8a306=_0x2d53f0;_0x3e13b0=0xc8;}else{_0x3e13b0=0xce;}_0x3c1c8c[_0xd01c('0x1d')](_0x3e13b0);return _0x3c1c8c[_0xd01c('0x1e')](_0xd01c('0x1f'),_0x839173+'-'+_0x8a306+'/'+_0x2d53f0)['json'](_0x1991fb);}return null;};}function patchUpdates(_0x48868e){return function(_0x2db453){try{jsonpatch[_0xd01c('0x20')](_0x2db453,_0x48868e,!![]);}catch(_0x46dd6c){return BPromise[_0xd01c('0x21')](_0x46dd6c);}return _0x2db453[_0xd01c('0x22')]();};}function saveUpdates(_0x5af629,_0x82b5bf){return function(_0x51d8a6){if(_0x51d8a6){return _0x51d8a6[_0xd01c('0x23')](_0x5af629)[_0xd01c('0x24')](function(_0x45c735){return _0x45c735;});}return null;};}function removeEntity(_0x2e96ab,_0x2671cf){return function(_0x109850){if(_0x109850){return _0x109850[_0xd01c('0x25')]()['then'](function(){_0x2e96ab[_0xd01c('0x1d')](0xcc)[_0xd01c('0x18')]();});}};}function handleEntityNotFound(_0x4051df,_0x7e9055){return function(_0x42213e){if(!_0x42213e){_0x4051df[_0xd01c('0x17')](0x194);}return _0x42213e;};}function handleError(_0x482901,_0x32b9fa){_0x32b9fa=_0x32b9fa||0x1f4;return function(_0x4138e3){logger[_0xd01c('0x26')](_0x4138e3[_0xd01c('0x27')]);if(_0x4138e3['name']){delete _0x4138e3['name'];}_0x482901['status'](_0x32b9fa)[_0xd01c('0x28')](_0x4138e3);};}exports['index']=function(_0x1db4d1,_0x13432d){var _0x48eaf8={},_0x204c35={},_0xe7296d={'count':0x0,'rows':[]};var _0x26b9d8=_['map'](db[_0xd01c('0x29')][_0xd01c('0x2a')],function(_0x9046d2){return{'name':_0x9046d2[_0xd01c('0x2b')],'type':_0x9046d2['type'][_0xd01c('0x2c')]};});_0x204c35['model']=_[_0xd01c('0x2d')](_0x26b9d8,_0xd01c('0x2e'));_0x204c35[_0xd01c('0x2f')]=_[_0xd01c('0x30')](_0x1db4d1[_0xd01c('0x2f')]);_0x204c35['filters']=_[_0xd01c('0x31')](_0x204c35[_0xd01c('0x32')],_0x204c35[_0xd01c('0x2f')]);_0x48eaf8['attributes']=_['intersection'](_0x204c35[_0xd01c('0x32')],qs[_0xd01c('0x33')](_0x1db4d1[_0xd01c('0x2f')][_0xd01c('0x33')]));_0x48eaf8[_0xd01c('0x34')]=_0x48eaf8[_0xd01c('0x34')][_0xd01c('0x35')]?_0x48eaf8['attributes']:_0x204c35[_0xd01c('0x32')];if(!_0x1db4d1[_0xd01c('0x2f')][_0xd01c('0x36')]('nolimit')){_0x48eaf8[_0xd01c('0x1b')]=qs[_0xd01c('0x1b')](_0x1db4d1[_0xd01c('0x2f')]['limit']);_0x48eaf8[_0xd01c('0x19')]=qs[_0xd01c('0x19')](_0x1db4d1[_0xd01c('0x2f')]['offset']);}_0x48eaf8[_0xd01c('0x37')]=qs[_0xd01c('0x38')](_0x1db4d1[_0xd01c('0x2f')][_0xd01c('0x38')]);_0x48eaf8[_0xd01c('0x39')]=qs[_0xd01c('0x3a')](_[_0xd01c('0x3b')](_0x1db4d1[_0xd01c('0x2f')],_0x204c35[_0xd01c('0x3a')]),_0x26b9d8);if(_0x1db4d1[_0xd01c('0x2f')][_0xd01c('0x3c')]){_0x48eaf8[_0xd01c('0x39')]=_['merge'](_0x48eaf8[_0xd01c('0x39')],{'$or':_[_0xd01c('0x2d')](_0x26b9d8,function(_0x3693f7){if(_0x3693f7[_0xd01c('0x3d')]!==_0xd01c('0x3e')){var _0x571a0a={};_0x571a0a[_0x3693f7[_0xd01c('0x2e')]]={'$like':'%'+_0x1db4d1[_0xd01c('0x2f')][_0xd01c('0x3c')]+'%'};return _0x571a0a;}})});}_0x48eaf8=_['merge']({},_0x48eaf8,_0x1db4d1['options']);var _0x138b92={'where':_0x48eaf8['where']};return db[_0xd01c('0x29')]['count'](_0x138b92)[_0xd01c('0x24')](function(_0x1ce62f){_0xe7296d['count']=_0x1ce62f;if(_0x1db4d1['query'][_0xd01c('0x3f')]){_0x48eaf8[_0xd01c('0x40')]=[{'all':!![]}];}return db[_0xd01c('0x29')]['findAll'](_0x48eaf8);})[_0xd01c('0x24')](function(_0x53d63a){_0xe7296d[_0xd01c('0x41')]=_0x53d63a;return _0xe7296d;})[_0xd01c('0x24')](respondWithFilteredResult(_0x13432d,_0x48eaf8))[_0xd01c('0x42')](handleError(_0x13432d,null));};exports[_0xd01c('0x43')]=function(_0xb65a36,_0x32635e){var _0x483b1c={'raw':!![],'where':{'id':_0xb65a36[_0xd01c('0x44')]['id']}},_0x5ba548={};_0x5ba548['model']=_[_0xd01c('0x30')](db[_0xd01c('0x29')][_0xd01c('0x2a')]);_0x5ba548[_0xd01c('0x2f')]=_[_0xd01c('0x30')](_0xb65a36[_0xd01c('0x2f')]);_0x5ba548[_0xd01c('0x3a')]=_[_0xd01c('0x31')](_0x5ba548[_0xd01c('0x32')],_0x5ba548[_0xd01c('0x2f')]);_0x483b1c[_0xd01c('0x34')]=_['intersection'](_0x5ba548[_0xd01c('0x32')],qs[_0xd01c('0x33')](_0xb65a36[_0xd01c('0x2f')][_0xd01c('0x33')]));_0x483b1c[_0xd01c('0x34')]=_0x483b1c[_0xd01c('0x34')][_0xd01c('0x35')]?_0x483b1c[_0xd01c('0x34')]:_0x5ba548[_0xd01c('0x32')];if(_0xb65a36[_0xd01c('0x2f')][_0xd01c('0x3f')]){_0x483b1c['include']=[{'all':!![]}];}_0x483b1c=_[_0xd01c('0x45')]({},_0x483b1c,_0xb65a36['options']);return db[_0xd01c('0x29')][_0xd01c('0x46')](_0x483b1c)[_0xd01c('0x24')](handleEntityNotFound(_0x32635e,null))[_0xd01c('0x24')](respondWithResult(_0x32635e,null))[_0xd01c('0x42')](handleError(_0x32635e,null));};exports[_0xd01c('0x47')]=function(_0x2cd0d1,_0x2711d7){return db['FaxApplication']['create'](_0x2cd0d1[_0xd01c('0x48')],{})[_0xd01c('0x24')](respondWithResult(_0x2711d7,0xc9))[_0xd01c('0x42')](handleError(_0x2711d7,null));};exports[_0xd01c('0x23')]=function(_0x13abe3,_0x2a3752){if(_0x13abe3['body']['id']){delete _0x13abe3['body']['id'];}return db[_0xd01c('0x29')][_0xd01c('0x46')]({'where':{'id':_0x13abe3[_0xd01c('0x44')]['id']}})['then'](handleEntityNotFound(_0x2a3752,null))['then'](saveUpdates(_0x13abe3[_0xd01c('0x48')],null))[_0xd01c('0x24')](respondWithResult(_0x2a3752,null))['catch'](handleError(_0x2a3752,null));};exports[_0xd01c('0x25')]=function(_0x215463,_0x16e4ba){return db['FaxApplication'][_0xd01c('0x46')]({'where':{'id':_0x215463[_0xd01c('0x44')]['id']}})[_0xd01c('0x24')](handleEntityNotFound(_0x16e4ba,null))[_0xd01c('0x24')](removeEntity(_0x16e4ba,null))[_0xd01c('0x42')](handleError(_0x16e4ba,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 437b8ab..0ec27db 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 _0x73f8=['lodash','api','moment','bluebird','request-promise','../../config/environment','./faxApplication.attributes','exports','utf8mb4','utf8mb4_unicode_ci'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x73f8,0x1f4));var _0x873f=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x73f8[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x873f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x873f('0x1'));var moment=require(_0x873f('0x2'));var BPromise=require(_0x873f('0x3'));var rp=require(_0x873f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x873f('0x5'));var attributes=require(_0x873f('0x6'));module[_0x873f('0x7')]=function(_0x2b91b1,_0x323556){return _0x2b91b1['define']('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x873f('0x8'),'collate':_0x873f('0x9')});}; \ No newline at end of file +var _0xa1fc=['exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./faxApplication.attributes'];(function(_0x54afef,_0x36a843){var _0x23a9d0=function(_0x477178){while(--_0x477178){_0x54afef['push'](_0x54afef['shift']());}};_0x23a9d0(++_0x36a843);}(_0xa1fc,0x1c8));var _0xca1f=function(_0x58c2ac,_0x58c01b){_0x58c2ac=_0x58c2ac-0x0;var _0x10cb51=_0xa1fc[_0x58c2ac];return _0x10cb51;};'use strict';var _=require(_0xca1f('0x0'));var util=require(_0xca1f('0x1'));var logger=require(_0xca1f('0x2'))('api');var moment=require(_0xca1f('0x3'));var BPromise=require(_0xca1f('0x4'));var rp=require(_0xca1f('0x5'));var fs=require('fs');var path=require(_0xca1f('0x6'));var rimraf=require(_0xca1f('0x7'));var config=require('../../config/environment');var attributes=require(_0xca1f('0x8'));module[_0xca1f('0x9')]=function(_0x325023,_0x5744e2){return _0x325023[_0xca1f('0xa')](_0xca1f('0xb'),attributes,{'tableName':_0xca1f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xca1f('0xd'),'collate':_0xca1f('0xe')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 76de80c..b9d426e 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 _0x6b4e=['request','then','info','request\x20sent','debug','error','FaxApplication,\x20%s,\x20%s','message','result','catch','FaxApplication','body','options','raw','where','attributes','limit','stringify','UpdateFaxApplication','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x6b4e,0x1a8));var _0xe6b4=function(_0x243261,_0x5bdda8){_0x243261=_0x243261-0x0;var _0x1791a6=_0x6b4e[_0x243261];return _0x1791a6;};'use strict';var _=require('lodash');var util=require(_0xe6b4('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe6b4('0x1'))['db'];var utils=require(_0xe6b4('0x2'));var logger=require(_0xe6b4('0x3'))(_0xe6b4('0x4'));var config=require(_0xe6b4('0x5'));var jayson=require(_0xe6b4('0x6'));var client=jayson['client'][_0xe6b4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3458d8,_0x3391b9,_0x1d062b){return new BPromise(function(_0x15cf31,_0x3e5506){return client[_0xe6b4('0x8')](_0x3458d8,_0x1d062b)[_0xe6b4('0x9')](function(_0x461f53){logger[_0xe6b4('0xa')]('FaxApplication,\x20%s,\x20%s',_0x3391b9,_0xe6b4('0xb'));logger[_0xe6b4('0xc')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x3391b9,'request\x20sent',JSON['stringify'](_0x461f53));if(_0x461f53[_0xe6b4('0xd')]){if(_0x461f53[_0xe6b4('0xd')]['code']===0x1f4){logger[_0xe6b4('0xd')](_0xe6b4('0xe'),_0x3391b9,_0x461f53[_0xe6b4('0xd')][_0xe6b4('0xf')]);return _0x3e5506(_0x461f53[_0xe6b4('0xd')]['message']);}logger[_0xe6b4('0xd')](_0xe6b4('0xe'),_0x3391b9,_0x461f53[_0xe6b4('0xd')][_0xe6b4('0xf')]);return _0x15cf31(_0x461f53['error'][_0xe6b4('0xf')]);}else{logger[_0xe6b4('0xa')](_0xe6b4('0xe'),_0x3391b9,_0xe6b4('0xb'));_0x15cf31(_0x461f53[_0xe6b4('0x10')]['message']);}})[_0xe6b4('0x11')](function(_0x2c9335){logger[_0xe6b4('0xd')]('FaxApplication,\x20%s,\x20%s',_0x3391b9,_0x2c9335);_0x3e5506(_0x2c9335);});});}exports['UpdateFaxApplication']=function(_0x5e77f2){var _0x3b5ce6=this;return new Promise(function(_0x5877c1,_0x529858){return db[_0xe6b4('0x12')]['update'](_0x5e77f2[_0xe6b4('0x13')],{'raw':_0x5e77f2[_0xe6b4('0x14')]?_0x5e77f2[_0xe6b4('0x14')][_0xe6b4('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e77f2[_0xe6b4('0x14')]?_0x5e77f2[_0xe6b4('0x14')][_0xe6b4('0x16')]||null:null,'attributes':_0x5e77f2[_0xe6b4('0x14')]?_0x5e77f2['options'][_0xe6b4('0x17')]||null:null,'limit':_0x5e77f2['options']?_0x5e77f2[_0xe6b4('0x14')][_0xe6b4('0x18')]||null:null})[_0xe6b4('0x9')](function(_0x32ee76){logger[_0xe6b4('0xa')]('UpdateFaxApplication',_0x5e77f2);logger['debug']('UpdateFaxApplication',_0x5e77f2,JSON[_0xe6b4('0x19')](_0x32ee76));_0x5877c1(_0x32ee76);})['catch'](function(_0x3fca0a){logger[_0xe6b4('0xd')](_0xe6b4('0x1a'),_0x3fca0a[_0xe6b4('0xf')],_0x5e77f2);_0x529858(_0x3b5ce6['error'](0x1f4,_0x3fca0a[_0xe6b4('0xf')]));});});}; \ No newline at end of file +var _0x27d1=['request','then','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','info','catch','UpdateFaxApplication','FaxApplication','update','options','raw','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x44171e,_0x260c65){var _0x25535c=function(_0x68fcde){while(--_0x68fcde){_0x44171e['push'](_0x44171e['shift']());}};_0x25535c(++_0x260c65);}(_0x27d1,0x88));var _0x127d=function(_0x5d29f2,_0x5069ec){_0x5d29f2=_0x5d29f2-0x0;var _0x8c8ce=_0x27d1[_0x5d29f2];return _0x8c8ce;};'use strict';var _=require(_0x127d('0x0'));var util=require(_0x127d('0x1'));var moment=require('moment');var BPromise=require(_0x127d('0x2'));var rs=require(_0x127d('0x3'));var fs=require('fs');var Redis=require(_0x127d('0x4'));var db=require(_0x127d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x127d('0x6'))(_0x127d('0x7'));var config=require('../../config/environment');var jayson=require(_0x127d('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x32e0be,_0x17bbad,_0x597d1c){return new BPromise(function(_0x368f2c,_0x1d803f){return client[_0x127d('0x9')](_0x32e0be,_0x597d1c)[_0x127d('0xa')](function(_0x2275d6){logger['info']('FaxApplication,\x20%s,\x20%s',_0x17bbad,_0x127d('0xb'));logger[_0x127d('0xc')](_0x127d('0xd'),_0x17bbad,'request\x20sent',JSON[_0x127d('0xe')](_0x2275d6));if(_0x2275d6[_0x127d('0xf')]){if(_0x2275d6['error'][_0x127d('0x10')]===0x1f4){logger[_0x127d('0xf')](_0x127d('0x11'),_0x17bbad,_0x2275d6[_0x127d('0xf')]['message']);return _0x1d803f(_0x2275d6['error'][_0x127d('0x12')]);}logger['error'](_0x127d('0x11'),_0x17bbad,_0x2275d6[_0x127d('0xf')]['message']);return _0x368f2c(_0x2275d6['error'][_0x127d('0x12')]);}else{logger[_0x127d('0x13')](_0x127d('0x11'),_0x17bbad,_0x127d('0xb'));_0x368f2c(_0x2275d6['result'][_0x127d('0x12')]);}})[_0x127d('0x14')](function(_0x120bcf){logger[_0x127d('0xf')](_0x127d('0x11'),_0x17bbad,_0x120bcf);_0x1d803f(_0x120bcf);});});}exports[_0x127d('0x15')]=function(_0x3c998f){var _0x32236b=this;return new Promise(function(_0xa5405e,_0x254a53){return db[_0x127d('0x16')][_0x127d('0x17')](_0x3c998f['body'],{'raw':_0x3c998f[_0x127d('0x18')]?_0x3c998f[_0x127d('0x18')][_0x127d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c998f[_0x127d('0x18')]?_0x3c998f[_0x127d('0x18')][_0x127d('0x1a')]||null:null,'attributes':_0x3c998f['options']?_0x3c998f['options'][_0x127d('0x1b')]||null:null,'limit':_0x3c998f[_0x127d('0x18')]?_0x3c998f[_0x127d('0x18')][_0x127d('0x1c')]||null:null})[_0x127d('0xa')](function(_0x2e378e){logger[_0x127d('0x13')]('UpdateFaxApplication',_0x3c998f);logger[_0x127d('0xc')](_0x127d('0x15'),_0x3c998f,JSON['stringify'](_0x2e378e));_0xa5405e(_0x2e378e);})[_0x127d('0x14')](function(_0x23dc5d){logger['error'](_0x127d('0x15'),_0x23dc5d['message'],_0x3c998f);_0x254a53(_0x32236b[_0x127d('0xf')](0x1f4,_0x23dc5d[_0x127d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 06c2324..f5c9ebb 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(_0xed09d9,_0x193b6f){var _0x492860=function(_0x1b01f1){while(--_0x1b01f1){_0xed09d9['push'](_0xed09d9['shift']());}};_0x492860(++_0x193b6f);}(_0x1775,0x1db));var _0x5177=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1775[_0x14add3];return _0x4a174f;};'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 _0x8f4c=['/:id','show','post','isAuthenticated','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x43f756,_0xae9f58){var _0x5ba710=function(_0x5205d4){while(--_0x5205d4){_0x43f756['push'](_0x43f756['shift']());}};_0x5ba710(++_0xae9f58);}(_0x8f4c,0x113));var _0xc8f4=function(_0x55db3e,_0x5efa08){_0x55db3e=_0x55db3e-0x0;var _0x43ff08=_0x8f4c[_0x55db3e];return _0x43ff08;};'use strict';var multer=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var path=require(_0xc8f4('0x2'));var timeout=require(_0xc8f4('0x3'));var express=require(_0xc8f4('0x4'));var router=express[_0xc8f4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc8f4('0x6'));var interaction=require(_0xc8f4('0x7'));var config=require(_0xc8f4('0x8'));var controller=require('./faxApplication.controller');router[_0xc8f4('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xc8f4('0xa'),auth['isAuthenticated'](),controller[_0xc8f4('0xb')]);router[_0xc8f4('0xc')]('/',auth[_0xc8f4('0xd')](),controller[_0xc8f4('0xe')]);router[_0xc8f4('0xf')]('/:id',auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x10')]);router[_0xc8f4('0x11')](_0xc8f4('0xa'),auth['isAuthenticated'](),controller[_0xc8f4('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 4a1a9bd..b28ca9c 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 _0xb238=['BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x14f2ce,_0x22f9c0){var _0x58db9f=function(_0x2f65f3){while(--_0x2f65f3){_0x14f2ce['push'](_0x14f2ce['shift']());}};_0x58db9f(++_0x22f9c0);}(_0xb238,0x1af));var _0x8b23=function(_0x26c279,_0x1ce9b8){_0x26c279=_0x26c279-0x0;var _0x196f8b=_0xb238[_0x26c279];return _0x196f8b;};'use strict';var Sequelize=require(_0x8b23('0x0'));module['exports']={'closed':{'type':Sequelize[_0x8b23('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8b23('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x8b23('0x3')]},'thirdDisposition':{'type':Sequelize[_0x8b23('0x3')]},'note':{'type':Sequelize[_0x8b23('0x3')]},'read1stAt':{'type':Sequelize[_0x8b23('0x2')]},'fax':{'type':Sequelize[_0x8b23('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x8b23('0x4')]('in',_0x8b23('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8b23('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x8b23('0x4')]('in',_0x8b23('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x6a95=['DATE','ENUM','out','sequelize','exports','STRING'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x6a95,0xdb));var _0x56a9=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x6a95[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require(_0x56a9('0x0'));module[_0x56a9('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x56a9('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x56a9('0x2')]},'note':{'type':Sequelize[_0x56a9('0x2')]},'read1stAt':{'type':Sequelize[_0x56a9('0x3')]},'fax':{'type':Sequelize[_0x56a9('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x56a9('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x56a9('0x4')]('in',_0x56a9('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 90bdae8..9271ac6 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 _0x2838=['operator','$substring','value','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','compact','isEmpty','forEach','i.FaxAccountId\x20IN\x20?','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','c.email','c.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','FaxInteractionId','all','show','params','keys','includeAll','options','describe','addMessage','FaxMessage','ids','omit','getMessages','intersection','$gte','format','include','findAll','rows','addTags','setTags','faxInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','basename','createReadStream','pipe','createWriteStream','log','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','Users','fullname','Tags','push','TagIds','catch','waiting','talking','unmanaged','total','closed','UserId','index','map','FaxInteraction','rawAttributes','fieldName','type','key','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','users','fax_accounts','fax_messages','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2838,0x14f));var _0x8283=function(_0x47c89e,_0x18692c){_0x47c89e=_0x47c89e-0x0;var _0x1de51e=_0x2838[_0x47c89e];return _0x1de51e;};'use strict';var emlformat=require(_0x8283('0x0'));var rimraf=require(_0x8283('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8283('0x2'));var rp=require(_0x8283('0x3'));var moment=require(_0x8283('0x4'));var BPromise=require(_0x8283('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x8283('0x6'));var csv=require(_0x8283('0x7'));var ejs=require(_0x8283('0x8'));var fs=require('fs');var fs_extra=require(_0x8283('0x9'));var _=require(_0x8283('0xa'));var squel=require(_0x8283('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8283('0xc'));var toCsv=require(_0x8283('0x7'));var querystring=require('querystring');var Papa=require(_0x8283('0xd'));var Redis=require(_0x8283('0xe'));var authService=require(_0x8283('0xf'));var qs=require(_0x8283('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8283('0x11'))(_0x8283('0x12'));var utils=require(_0x8283('0x13'));var config=require(_0x8283('0x14'));var licenseUtil=require(_0x8283('0x15'));var db=require(_0x8283('0x16'))['db'];config[_0x8283('0x17')]=_[_0x8283('0x18')](config[_0x8283('0x17')],{'host':_0x8283('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8283('0x17')]));require(_0x8283('0x1a'))[_0x8283('0x1b')](socket);function respondWithStatusCode(_0x2cef07,_0x1e701c){_0x1e701c=_0x1e701c||0xcc;return function(_0xee42bc){if(_0xee42bc){return _0x2cef07[_0x8283('0x1c')](_0x1e701c);}return _0x2cef07[_0x8283('0x1d')](_0x1e701c)[_0x8283('0x1e')]();};}function respondWithResult(_0x5b9054,_0x47a333){_0x47a333=_0x47a333||0xc8;return function(_0x27605a){if(_0x27605a){return _0x5b9054[_0x8283('0x1d')](_0x47a333)['json'](_0x27605a);}};}function respondWithFilteredResult(_0x401866,_0x551152){return function(_0x456f29){if(_0x456f29){var _0x512af1=typeof _0x551152[_0x8283('0x1f')]===_0x8283('0x20')&&typeof _0x551152[_0x8283('0x21')]==='undefined';var _0x25e6b8=_0x456f29[_0x8283('0x22')];var _0xf8c903=_0x512af1?0x0:_0x551152[_0x8283('0x1f')];var _0x551f4c=_0x512af1?_0x456f29['count']:_0x551152['offset']+_0x551152['limit'];var _0x21551f;if(_0x551f4c>=_0x25e6b8){_0x551f4c=_0x25e6b8;_0x21551f=0xc8;}else{_0x21551f=0xce;}_0x401866[_0x8283('0x1d')](_0x21551f);return _0x401866[_0x8283('0x23')](_0x8283('0x24'),_0xf8c903+'-'+_0x551f4c+'/'+_0x25e6b8)[_0x8283('0x25')](_0x456f29);}return null;};}function patchUpdates(_0x42e5d0){return function(_0x4b4813){try{jsonpatch[_0x8283('0x26')](_0x4b4813,_0x42e5d0,!![]);}catch(_0x23ca1e){return BPromise[_0x8283('0x27')](_0x23ca1e);}return _0x4b4813[_0x8283('0x28')]();};}function saveUpdates(_0x5c8327,_0x561f04){return function(_0x45b069){if(_0x45b069){return _0x45b069[_0x8283('0x29')](_0x5c8327)[_0x8283('0x2a')](function(_0x432de2){return _0x432de2;});}return null;};}function removeEntity(_0x176244,_0x1a4c76){return function(_0x1ebba6){if(_0x1ebba6){return _0x1ebba6[_0x8283('0x2b')]()[_0x8283('0x2a')](function(){_0x176244['status'](0xcc)[_0x8283('0x1e')]();});}};}function handleEntityNotFound(_0x3beabd,_0x843bed){return function(_0x33ce24){if(!_0x33ce24){_0x3beabd[_0x8283('0x1c')](0x194);}return _0x33ce24;};}function handleError(_0x13198f,_0x42e838){_0x42e838=_0x42e838||0x1f4;return function(_0x216f9b){logger[_0x8283('0x2c')](_0x216f9b[_0x8283('0x2d')]);if(_0x216f9b['name']){delete _0x216f9b[_0x8283('0x2e')];}_0x13198f[_0x8283('0x1d')](_0x42e838)[_0x8283('0x2f')](_0x216f9b);};}function getInteractionUsers(_0x1eea2d,_0x18c072){return new BPromise(function(_0x48629d,_0x589cd7){try{if(_0x18c072[_0x1eea2d['id']]){_0x1eea2d[_0x8283('0x30')]=_['map'](_0x18c072[_0x1eea2d['id']],function(_0x1c60b7){return{'id':_0x1c60b7['id'],'fullname':_0x1c60b7[_0x8283('0x31')]};});}}catch(_0x353884){_0x589cd7(_0x353884);}_0x48629d(_0x1eea2d);});}function getInteractionTags(_0x235047,_0x34033d){return new BPromise(function(_0x5554f8,_0x123d9d){try{if(_0x235047['TagIds']){_0x235047[_0x8283('0x32')]=[];_0x235047['TagIds']['split'](',')['forEach'](function(_0x5e2dda){_0x235047[_0x8283('0x32')][_0x8283('0x33')](_0x34033d[_0x5e2dda]);});}delete _0x235047[_0x8283('0x34')];}catch(_0x1a3a72){_0x123d9d(_0x1a3a72);}_0x5554f8(_0x235047);});}function updateFaxInteraction(_0x29a10b,_0x480c5f,_0x21041c){return new BPromise(function(_0x2637e3,_0x51a9c7){return getInteractionUsers(_0x29a10b,_0x21041c)[_0x8283('0x2a')](function(_0x43339b){return getInteractionTags(_0x43339b,_0x480c5f);})['then'](function(_0xe3793e){return getStateInteraction(_0xe3793e);})[_0x8283('0x2a')](function(_0x23069e){_0x2637e3(_0x23069e);})[_0x8283('0x35')](function(_0x5e51c5){_0x51a9c7(_0x5e51c5);});});}function getStateInteraction(_0x250e74){return new BPromise(function(_0x28928e){_0x250e74[_0x8283('0x36')]=0x0;_0x250e74[_0x8283('0x37')]=0x0;_0x250e74['answered']=0x0;_0x250e74[_0x8283('0x38')]=0x0;_0x250e74[_0x8283('0x39')]=0x0;if(!_0x250e74[_0x8283('0x3a')]&&!_0x250e74[_0x8283('0x3b')]){_0x250e74[_0x8283('0x36')]+=0x1;}if(!_0x250e74[_0x8283('0x3a')]&&_0x250e74[_0x8283('0x3b')]){_0x250e74['talking']+=0x1;if(_0x250e74['waiting']){_0x250e74[_0x8283('0x36')]-=0x1;}}if(_0x250e74[_0x8283('0x3a')]&&_0x250e74[_0x8283('0x3b')]){_0x250e74['answered']+=0x1;if(_0x250e74[_0x8283('0x37')]){_0x250e74[_0x8283('0x37')]-=0x1;}}if(_0x250e74[_0x8283('0x3a')]&&!_0x250e74[_0x8283('0x3b')]){_0x250e74[_0x8283('0x38')]+=0x1;if(_0x250e74['waiting']){_0x250e74['waiting']-=0x1;}}_0x250e74[_0x8283('0x39')]+=0x1;_0x28928e(_0x250e74);});}exports[_0x8283('0x3c')]=function(_0x379a7c,_0x5c07f6){var _0x2fc03b={},_0xbdfe9a={},_0x4903bf={'count':0x0,'rows':[]};var _0x2fa02f=_[_0x8283('0x3d')](db[_0x8283('0x3e')][_0x8283('0x3f')],function(_0x2f8ba8){return{'name':_0x2f8ba8[_0x8283('0x40')],'type':_0x2f8ba8[_0x8283('0x41')][_0x8283('0x42')]};});_0xbdfe9a[_0x8283('0x43')]=_['map'](_0x2fa02f,_0x8283('0x2e'));_0xbdfe9a[_0x8283('0x44')]=_['keys'](_0x379a7c[_0x8283('0x44')]);_0xbdfe9a[_0x8283('0x45')]=_['intersection'](_0xbdfe9a[_0x8283('0x43')],_0xbdfe9a[_0x8283('0x44')]);_0x2fc03b['attributes']=_['intersection'](_0xbdfe9a[_0x8283('0x43')],qs[_0x8283('0x46')](_0x379a7c['query']['fields']));_0x2fc03b[_0x8283('0x47')]=_0x2fc03b[_0x8283('0x47')][_0x8283('0x48')]?_0x2fc03b[_0x8283('0x47')]:_0xbdfe9a[_0x8283('0x43')];if(!_0x379a7c[_0x8283('0x44')][_0x8283('0x49')](_0x8283('0x4a'))){_0x2fc03b[_0x8283('0x21')]=qs['limit'](_0x379a7c['query'][_0x8283('0x21')]);_0x2fc03b[_0x8283('0x1f')]=qs[_0x8283('0x1f')](_0x379a7c[_0x8283('0x44')][_0x8283('0x1f')]);}_0x2fc03b['order']=qs[_0x8283('0x4b')](_0x379a7c[_0x8283('0x44')][_0x8283('0x4b')]);_0x2fc03b[_0x8283('0x4c')]=qs['filters'](_[_0x8283('0x4d')](_0x379a7c[_0x8283('0x44')],_0xbdfe9a[_0x8283('0x45')]),_0x2fa02f);var _0x10b2a4=[];var _0x149031=squel[_0x8283('0x4e')]()[_0x8283('0x4f')]('id')[_0x8283('0x4f')](_0x8283('0x2e'))['field'](_0x8283('0x50'))[_0x8283('0x51')]('tools_tags');var _0x44c7b6=squel['select']()[_0x8283('0x4f')]('u.id')[_0x8283('0x4f')](_0x8283('0x52'))[_0x8283('0x4f')](_0x8283('0x53'))[_0x8283('0x51')](_0x8283('0x54'),'ui')[_0x8283('0x55')]('users','u',_0x8283('0x56'));var _0x709b70=squel[_0x8283('0x4e')]()[_0x8283('0x51')](_0x8283('0x57'),'i')[_0x8283('0x55')](_0x8283('0x58'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x8283('0x55')](_0x8283('0x59'),'o','o.id\x20=\x20i.UserId')[_0x8283('0x55')](_0x8283('0x5a'),'a','a.id\x20=\x20i.FaxAccountId')[_0x8283('0x55')](_0x8283('0x5b'),'me',_0x8283('0x5c'))[_0x8283('0x55')]('fax_interaction_has_tags','it',_0x8283('0x5d'))[_0x8283('0x55')](_0x8283('0x5e'),'t',_0x8283('0x5f'));var _0x2ec1f8=squel['expr']();var _0x59e0d9=[];var _0x2b713e=squel[_0x8283('0x60')]();var _0x4a0974;if(_0x379a7c[_0x8283('0x44')][_0x8283('0x61')]){_0x4a0974=as[_0x8283('0x62')](_0x379a7c[_0x8283('0x44')]['search']);var _0x288aff=_0x4a0974[_0x8283('0x63')];for(var _0x5243fa=0x0;_0x5243fa<_0x4a0974[_0x8283('0x64')][_0x8283('0x48')];_0x5243fa++){var _0x58df76=_0x4a0974['conditions'][_0x5243fa];var _0x4a9f0b='i';var _0x5494ab=_[_0x8283('0x65')](_0x2fa02f,[_0x8283('0x2e'),_0x58df76[_0x8283('0x4f')]]);if(!_0x5494ab){switch(_0x58df76[_0x8283('0x4f')]){case _0x8283('0x66'):if(_0x58df76['value']==0x1){_0x709b70[_0x8283('0x67')]('`'+_0x58df76['field']+_0x8283('0x68'));}else{_0x709b70['having']('`'+_0x58df76[_0x8283('0x4f')]+_0x8283('0x69'));}break;case _0x8283('0x6a'):if(_0x58df76[_0x8283('0x6b')]===_0x8283('0x6c')){if(_0x58df76[_0x8283('0x6d')][_0x8283('0x6e')]('\x20')[_0x8283('0x48')]>0x1){_0x2ec1f8[_0x288aff](_0x8283('0x6f'),qs[_0x8283('0x70')](_0x58df76['value']),null);}else{var _0x46a486='%'+_0x58df76[_0x8283('0x6d')]+'%';_0x2ec1f8[_0x288aff](_0x8283('0x71'),_0x46a486,_0x46a486,_0x46a486);}}else{_0x5494ab=_[_0x8283('0x65')](_0x2fa02f,['name','ContactId']);_0x58df76['field']='ContactId';_0x193a75=as[_0x8283('0x72')](_0x4a9f0b,_0x5494ab[_0x8283('0x41')],_0x58df76);_0x2ec1f8[_0x288aff](_0x193a75[_0x8283('0x73')],_0x193a75[_0x8283('0x6d')][_0x8283('0x74')],_0x193a75[_0x8283('0x6d')][_0x8283('0x1e')]);}break;case _0x8283('0x75'):var _0x62d7ca=_0x58df76[_0x8283('0x6d')][_0x8283('0x6e')](',')[_0x8283('0x3d')](function(_0xb237b1){return Number(_0xb237b1);});_0x62d7ca['forEach'](function(_0x5a3dfe){_0x2b713e['or'](_0x8283('0x76'),'%,'+_0x5a3dfe+',%');});_0x59e0d9=_['union'](_0x59e0d9,_0x62d7ca);break;case _0x8283('0x77'):if(_0x58df76['operator']==='$substring'){_0x2ec1f8[_0x288aff](_0x8283('0x78'),'%'+_0x58df76[_0x8283('0x6d')]+'%',null);}else{_0x5494ab=_['find'](_0x2fa02f,[_0x8283('0x2e'),'UserId']);_0x58df76['field']=_0x8283('0x3b');_0x193a75=as[_0x8283('0x72')](_0x4a9f0b,_0x5494ab[_0x8283('0x41')],_0x58df76);_0x2ec1f8[_0x288aff](_0x193a75[_0x8283('0x73')],_0x193a75[_0x8283('0x6d')][_0x8283('0x74')],_0x193a75['value'][_0x8283('0x1e')]);}break;case _0x8283('0x79'):_0x193a75=as[_0x8283('0x72')]('me',null,_0x58df76);_0x2ec1f8[_0x288aff](_0x193a75[_0x8283('0x73')],_0x193a75[_0x8283('0x6d')][_0x8283('0x74')],_0x193a75[_0x8283('0x6d')][_0x8283('0x1e')]);break;}}else{var _0x193a75=as[_0x8283('0x72')](_0x4a9f0b,_0x5494ab[_0x8283('0x41')],_0x58df76);_0x2ec1f8[_0x288aff](_0x193a75[_0x8283('0x73')],_0x193a75['value'][_0x8283('0x74')],_0x193a75[_0x8283('0x6d')][_0x8283('0x1e')]);}}}else{var _0x50f868=_(_0x379a7c[_0x8283('0x44')])['keys']()[_0x8283('0x3d')](function(_0x463b83){return _[_0x8283('0x7a')](_0x2fa02f,[_0x8283('0x2e'),_0x463b83])?_0x463b83:undefined;})[_0x8283('0x7b')]()[_0x8283('0x6d')]();if(!_[_0x8283('0x7c')](_0x50f868)){_0x50f868[_0x8283('0x7d')](function(_0x57dad9){if(_0x57dad9==='FaxAccountId'){_0x709b70[_0x8283('0x4c')](_0x8283('0x7e'),[][_0x8283('0x7f')](_0x379a7c[_0x8283('0x44')][_0x57dad9]));}else if(_0x57dad9==='createdAt'){var _0x40bbf2=JSON[_0x8283('0x80')](_0x379a7c[_0x8283('0x44')][_0x57dad9])['$gte'];var _0x5c5887=JSON[_0x8283('0x80')](_0x379a7c[_0x8283('0x44')][_0x57dad9])[_0x8283('0x81')];_0x709b70['where'](_0x8283('0x82'),_0x40bbf2,_0x5c5887);}else{if(_0x379a7c[_0x8283('0x44')][_0x57dad9]===_0x8283('0x83')){_0x709b70[_0x8283('0x4c')]('i.'+_0x57dad9+_0x8283('0x84'));}else{_0x709b70['where']('i.'+_0x57dad9+_0x8283('0x85'),_0x379a7c[_0x8283('0x44')][_0x57dad9]);}}});}if(_0x379a7c[_0x8283('0x44')]['read']){if(_0x379a7c[_0x8283('0x44')][_0x8283('0x86')]==0x1){_0x709b70[_0x8283('0x67')](_0x8283('0x87'));}else{_0x709b70[_0x8283('0x67')](_0x8283('0x88'));}}if(_0x379a7c[_0x8283('0x44')][_0x8283('0x89')]){_0x59e0d9=_[_0x8283('0x8a')](_0x379a7c[_0x8283('0x44')][_0x8283('0x89')])?_0x379a7c['query']['tag']:new Array(_0x379a7c[_0x8283('0x44')]['tag']);_0x59e0d9[_0x8283('0x7d')](function(_0x50bea7){_0x2b713e['or'](_0x8283('0x76'),'%,'+_0x50bea7+',%');});}if(_0x379a7c[_0x8283('0x44')][_0x8283('0x8b')]){var _0x318a02=_0x379a7c[_0x8283('0x44')]['filter'][_0x8283('0x8c')]('\x5c','\x5c\x5c')[_0x8283('0x8c')](/'/g,'\x27\x27');if(qs[_0x8283('0x8d')](_0x318a02)){_0x2ec1f8['or'](_0x8283('0x8e'),_0x318a02+'%')['or']('i.fax\x20LIKE\x20?',_0x318a02+'%');}_0x2ec1f8['or'](_0x8283('0x8f'),_0x318a02+'%');}}_0x709b70[_0x8283('0x4c')](_0x2ec1f8);_0x709b70[_0x8283('0x90')](_0x8283('0x91'));var _0x5b452d={'type':db[_0x8283('0x92')]['QueryTypes'][_0x8283('0x93')],'raw':!![]};var _0x464767=_0x709b70[_0x8283('0x94')]();_0x464767['field'](_0x8283('0x91'));_0x464767[_0x8283('0x4f')](_0x8283('0x95'),_0x8283('0x66'));if(_0x2fc03b['order']){_0x2fc03b[_0x8283('0x96')]['forEach'](function(_0x30a6e9){var _0x16f9e5=_0x30a6e9[0x0]===_0x8283('0x97')?_0x30a6e9[0x0]:'i.'+_0x30a6e9[0x0];_0x709b70[_0x8283('0x96')](_0x16f9e5,_0x30a6e9[0x1]===_0x8283('0x98')?![]:!![]);});}if(!_[_0x8283('0x7c')](_0x59e0d9)){_0x709b70[_0x8283('0x67')](_0x2b713e);_0x464767[_0x8283('0x4c')](_0x8283('0x99'),_0x59e0d9);}BPromise[_0x8283('0x9a')]()[_0x8283('0x2a')](function(){if(!_0x4a0974){if(_0x379a7c['query'][_0x8283('0x9b')])return;_0x464767[_0x8283('0x4c')](_0x8283('0x9c'));_0x709b70[_0x8283('0x4c')](_0x8283('0x9c'));return;}if(_0x379a7c[_0x8283('0x9d')][_0x8283('0x9e')]!==_0x8283('0x9f'))return;return _0x379a7c[_0x8283('0x9d')][_0x8283('0xa0')]({'attributes':['id'],'raw':!![]})[_0x8283('0x2a')](function(_0x5cbe63){if(_[_0x8283('0x7c')](_0x5cbe63)){_0x464767[_0x8283('0x4c')](_0x8283('0xa1'));_0x709b70[_0x8283('0x4c')](_0x8283('0xa1'));}else{_0x464767[_0x8283('0x4c')](_0x8283('0x7e'),_['map'](_0x5cbe63,'id'));_0x709b70[_0x8283('0x4c')]('i.FaxAccountId\x20IN\x20?',_[_0x8283('0x3d')](_0x5cbe63,'id'));}});})[_0x8283('0x2a')](function(){if(_0x379a7c[_0x8283('0x9d')][_0x8283('0x9e')]==='agent'&&!_0x4a0974&&!_0x379a7c[_0x8283('0x44')][_0x8283('0x9b')])return[];return db[_0x8283('0xa2')][_0x8283('0x44')](_0x464767['toString'](),_0x5b452d);})[_0x8283('0x2a')](function(_0x4fdd1d){_0x4903bf[_0x8283('0x22')]=_0x4fdd1d['length'];if(_0x4903bf[_0x8283('0x22')]===0x0)return[];return db[_0x8283('0xa2')]['query'](_0x149031[_0x8283('0xa3')](),_0x5b452d)[_0x8283('0x2a')](function(_0x54fbb6){_0x10b2a4=_[_0x8283('0xa4')](_0x54fbb6,'id');_0x5b452d=_[_0x8283('0xa5')](_0x5b452d,{'model':db[_0x8283('0x3e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x379a7c[_0x8283('0x44')][_0x8283('0x46')]){_0x2fc03b['attributes']['forEach'](function(_0x27ad02){_0x709b70[_0x8283('0x4f')]('i.'+_0x27ad02);});}else{_0x709b70[_0x8283('0x4f')](_0x8283('0x95'),_0x8283('0x66'));_0x709b70[_0x8283('0x4f')]('a.key',_0x8283('0xa6'));_0x709b70[_0x8283('0x4f')](_0x8283('0xa7'),_0x8283('0xa8'));_0x709b70[_0x8283('0x4f')](_0x8283('0xa9'),_0x8283('0x97'));_0x709b70[_0x8283('0x4f')](_0x8283('0xaa'));_0x709b70[_0x8283('0x4f')]('c.firstName',_0x8283('0xab'));_0x709b70[_0x8283('0x4f')](_0x8283('0xac'),'Contact.lastName');_0x709b70[_0x8283('0x4f')](_0x8283('0xad'),'Contact.email');_0x709b70[_0x8283('0x4f')](_0x8283('0xae'),'Contact.phone');_0x709b70['field'](_0x8283('0xaf'),_0x8283('0xb0'));_0x709b70[_0x8283('0x4f')]('c.fax',_0x8283('0xb1'));_0x709b70[_0x8283('0x4f')](_0x8283('0xb2'),_0x8283('0xb3'));_0x709b70[_0x8283('0x4f')](_0x8283('0xb4'),_0x8283('0xb5'));_0x709b70['field'](_0x8283('0xb6'),_0x8283('0x34'));}if(_0x2fc03b[_0x8283('0x21')])_0x709b70[_0x8283('0x21')](_0x2fc03b['limit']);if(_0x2fc03b[_0x8283('0x1f')])_0x709b70['offset'](_0x2fc03b['offset']);return db[_0x8283('0xa2')][_0x8283('0x44')](_0x709b70[_0x8283('0xa3')](),_0x5b452d);})[_0x8283('0x2a')](function(_0x3c02dd){if(_0x3c02dd['length']>0x0)_0x44c7b6[_0x8283('0x4c')]('ui.FaxInteractionId\x20IN\x20?',_[_0x8283('0x3d')](_0x3c02dd,'id'));return db['sequelize'][_0x8283('0x44')](_0x44c7b6[_0x8283('0xa3')](),_0x5b452d)[_0x8283('0x2a')](function(_0x38fac7){var _0x159897=_['groupBy'](_0x38fac7,_0x8283('0xb7'));var _0x2d3ceb=[];_0x3c02dd[_0x8283('0x7d')](function(_0x1fb3c8){_0x2d3ceb[_0x8283('0x33')](updateFaxInteraction(_0x1fb3c8,_0x10b2a4,_0x159897));});return BPromise[_0x8283('0xb8')](_0x2d3ceb);});});})['then'](function(_0xb2ce61){_0x4903bf['rows']=_0xb2ce61;return _0x4903bf;})[_0x8283('0x2a')](respondWithFilteredResult(_0x5c07f6,_0x2fc03b))[_0x8283('0x35')](handleError(_0x5c07f6,null));};exports[_0x8283('0xb9')]=function(_0x6893c5,_0x32d39c){var _0x205bce={'raw':![],'where':{'id':_0x6893c5[_0x8283('0xba')]['id']}},_0x5d37f6={};_0x5d37f6[_0x8283('0x43')]=_[_0x8283('0xbb')](db[_0x8283('0x3e')][_0x8283('0x3f')]);_0x5d37f6[_0x8283('0x44')]=_[_0x8283('0xbb')](_0x6893c5['query']);_0x5d37f6['filters']=_['intersection'](_0x5d37f6[_0x8283('0x43')],_0x5d37f6[_0x8283('0x44')]);_0x205bce['attributes']=_['intersection'](_0x5d37f6['model'],qs['fields'](_0x6893c5['query'][_0x8283('0x46')]));_0x205bce[_0x8283('0x47')]=_0x205bce[_0x8283('0x47')][_0x8283('0x48')]?_0x205bce[_0x8283('0x47')]:_0x5d37f6['model'];if(_0x6893c5['query'][_0x8283('0xbc')]){_0x205bce['include']=[{'all':!![]}];}_0x205bce=_['merge']({},_0x205bce,_0x6893c5[_0x8283('0xbd')]);return db[_0x8283('0x3e')][_0x8283('0x65')](_0x205bce)[_0x8283('0x2a')](handleEntityNotFound(_0x32d39c,null))[_0x8283('0x2a')](respondWithResult(_0x32d39c,null))['catch'](handleError(_0x32d39c,null));};exports['create']=function(_0x3438df,_0x214cc8){return db[_0x8283('0x3e')]['create'](_0x3438df[_0x8283('0x79')],{})['then'](respondWithResult(_0x214cc8,0xc9))['catch'](handleError(_0x214cc8,null));};exports[_0x8283('0x29')]=function(_0x129aac,_0x242a7c){if(_0x129aac[_0x8283('0x79')]['id']){delete _0x129aac[_0x8283('0x79')]['id'];}return db[_0x8283('0x3e')]['find']({'where':{'id':_0x129aac[_0x8283('0xba')]['id']}})[_0x8283('0x2a')](handleEntityNotFound(_0x242a7c,null))['then'](saveUpdates(_0x129aac[_0x8283('0x79')],null))[_0x8283('0x2a')](respondWithResult(_0x242a7c,null))[_0x8283('0x35')](handleError(_0x242a7c,null));};exports[_0x8283('0x2b')]=function(_0x3f705d,_0x3756f7){return db[_0x8283('0x3e')][_0x8283('0x65')]({'where':{'id':_0x3f705d[_0x8283('0xba')]['id']}})[_0x8283('0x2a')](handleEntityNotFound(_0x3756f7,null))[_0x8283('0x2a')](removeEntity(_0x3756f7,null))[_0x8283('0x35')](handleError(_0x3756f7,null));};exports[_0x8283('0xbe')]=function(_0x1b709e,_0x4f93e6){return db['FaxInteraction']['describe']()['then'](respondWithResult(_0x4f93e6,null))[_0x8283('0x35')](handleError(_0x4f93e6,null));};exports[_0x8283('0xbf')]=function(_0x6a34de,_0x108d4c,_0x571d1f){return db[_0x8283('0xc0')]['find']({'where':{'id':_0x6a34de['params']['id']}})[_0x8283('0x2a')](handleEntityNotFound(_0x108d4c,null))[_0x8283('0x2a')](function(_0xeb60a6){if(_0xeb60a6){return _0xeb60a6[_0x8283('0xbf')](_0x6a34de[_0x8283('0x79')][_0x8283('0xc1')],_[_0x8283('0xc2')](_0x6a34de[_0x8283('0x79')],[_0x8283('0xc1'),'id'])||{});}})[_0x8283('0x2a')](respondWithResult(_0x108d4c,null))[_0x8283('0x35')](handleError(_0x108d4c,null));};exports[_0x8283('0xc3')]=function(_0x4b8947,_0x35e2de,_0x5b9452){var _0x4fd7e1={'raw':![],'where':{}};var _0x13435b={};var _0x4f2534={'count':0x0,'rows':[]};return db[_0x8283('0x3e')]['findOne']({'where':{'id':_0x4b8947[_0x8283('0xba')]['id']}})[_0x8283('0x2a')](handleEntityNotFound(_0x35e2de,null))[_0x8283('0x2a')](function(_0x45858e){if(_0x45858e){_0x13435b['model']=_[_0x8283('0xbb')](db['FaxMessage']['rawAttributes']);_0x13435b['query']=_[_0x8283('0xbb')](_0x4b8947['query']);_0x13435b[_0x8283('0x45')]=_[_0x8283('0xc4')](_0x13435b[_0x8283('0x43')],_0x13435b[_0x8283('0x44')]);_0x4fd7e1['attributes']=_[_0x8283('0xc4')](_0x13435b[_0x8283('0x43')],qs[_0x8283('0x46')](_0x4b8947[_0x8283('0x44')][_0x8283('0x46')]));_0x4fd7e1['attributes']=_0x4fd7e1[_0x8283('0x47')]['length']?_0x4fd7e1[_0x8283('0x47')]:_0x13435b['model'];if(!_0x4b8947[_0x8283('0x44')][_0x8283('0x49')](_0x8283('0x4a'))){_0x4fd7e1['limit']=qs[_0x8283('0x21')](_0x4b8947[_0x8283('0x44')]['limit']);_0x4fd7e1[_0x8283('0x1f')]=qs[_0x8283('0x1f')](_0x4b8947[_0x8283('0x44')][_0x8283('0x1f')]);}_0x4fd7e1[_0x8283('0x96')]=qs[_0x8283('0x4b')](_0x4b8947[_0x8283('0x44')]['sort']);_0x4fd7e1['where']=qs[_0x8283('0x45')](_[_0x8283('0x4d')](_0x4b8947[_0x8283('0x44')],_0x13435b[_0x8283('0x45')]));_0x4fd7e1['where'][_0x8283('0xb7')]=_0x45858e['id'];if(_0x4b8947[_0x8283('0x44')]['filter']){_0x4fd7e1['where']=_[_0x8283('0xa5')](_0x4fd7e1[_0x8283('0x4c')],{'$or':_['map'](_0x4fd7e1[_0x8283('0x47')],function(_0x48d324){var _0x2d3fb7={};_0x2d3fb7[_0x48d324]={'$like':'%'+_0x4b8947[_0x8283('0x44')]['filter']+'%'};return _0x2d3fb7;})});}if(_0x4b8947[_0x8283('0x44')]['$gte']){var _0x5e0ef4=_0x4b8947[_0x8283('0x44')][_0x8283('0xc5')]['split'](',');var _0x4611c6={};_0x4611c6[_0x5e0ef4[0x0]]={'$gte':moment(_0x5e0ef4[0x1])[_0x8283('0xc6')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4fd7e1[_0x8283('0x4c')]=_[_0x8283('0xa5')](_0x4fd7e1['where'],_0x4611c6);}_0x4fd7e1=_[_0x8283('0xa5')]({},_0x4fd7e1,_0x4b8947[_0x8283('0xbd')]);return db[_0x8283('0xc0')][_0x8283('0x22')]({'where':_0x4fd7e1[_0x8283('0x4c')]})[_0x8283('0x2a')](function(_0x580fe3){_0x4f2534[_0x8283('0x22')]=_0x580fe3;if(_0x4b8947[_0x8283('0x44')][_0x8283('0xbc')]){_0x4fd7e1[_0x8283('0xc7')]=[{'all':!![]}];}return db[_0x8283('0xc0')][_0x8283('0xc8')](_0x4fd7e1);})['then'](function(_0x5c037f){_0x4f2534[_0x8283('0xc9')]=_0x5c037f;return _0x4f2534;});}})['then'](respondWithFilteredResult(_0x35e2de,_0x4fd7e1))[_0x8283('0x35')](handleError(_0x35e2de,null));};exports[_0x8283('0xca')]=function(_0x55b746,_0x44949b,_0x67fad9){return db['FaxInteraction'][_0x8283('0x65')]({'where':{'id':_0x55b746[_0x8283('0xba')]['id']}})[_0x8283('0x2a')](handleEntityNotFound(_0x44949b,null))[_0x8283('0x2a')](function(_0x599e8e){if(_0x599e8e){return _0x599e8e[_0x8283('0xcb')](_0x55b746['body'][_0x8283('0xc1')],_[_0x8283('0xc2')](_0x55b746[_0x8283('0x79')],[_0x8283('0xc1'),'id'])||{})['spread'](function(){return db['Tag'][_0x8283('0xc8')]({'attributes':['id',_0x8283('0x2e'),_0x8283('0x50')],'where':{'id':_0x55b746['body'][_0x8283('0xc1')]}});})[_0x8283('0x2a')](function(_0x133886){socket['emit'](_0x8283('0xcc'),{'id':Number(_0x55b746[_0x8283('0xba')]['id']),'tags':_0x133886||[]});return{'id':Number(_0x55b746[_0x8283('0xba')]['id']),'tags':_0x133886||[]};});}})[_0x8283('0x2a')](respondWithResult(_0x44949b,null))['catch'](handleError(_0x44949b,null));};exports[_0x8283('0xcd')]=function(_0x2a45d6,_0x43968c,_0xf43b52){return db[_0x8283('0x3e')][_0x8283('0x65')]({'where':{'id':_0x2a45d6[_0x8283('0xba')]['id']}})[_0x8283('0x2a')](handleEntityNotFound(_0x43968c,null))['then'](function(_0x467d6d){if(_0x467d6d){return _0x467d6d[_0x8283('0xcd')](_0x2a45d6[_0x8283('0x44')]['ids']);}})[_0x8283('0x2a')](respondWithStatusCode(_0x43968c,null))[_0x8283('0x35')](handleError(_0x43968c,null));};exports[_0x8283('0xce')]=function(_0x2a102a,_0x1021ef){var _0xda82=moment()['unix']()[_0x8283('0xa3')]();var _0x3d771d=path[_0x8283('0xcf')](config[_0x8283('0xd0')],_0x8283('0xd1'),_0x8283('0xd2'),_0x8283('0xd3'));var _0x202cc3=path['join'](config[_0x8283('0xd0')],_0x8283('0xd1'),'files',_0x8283('0xd4'));var _0xca8089=path['join'](_0x3d771d,_0xda82);var _0x566921=util['format'](_0x8283('0xd5'),_0x2a102a['params']['id'],_0xda82);var _0x37573a=path[_0x8283('0xcf')](_0x3d771d,_0x566921);var _0x575c5e=[];_0x575c5e[_0x8283('0x33')]({'model':db[_0x8283('0xd6')],'as':_0x8283('0xd6'),'raw':!![]});var _0x27337b=[{'model':db[_0x8283('0xc0')],'as':_0x8283('0xd7'),'attributes':['id',_0x8283('0x79'),'createdAt'],'include':_0x575c5e}];return db[_0x8283('0x3e')][_0x8283('0x65')]({'where':{'id':_0x2a102a[_0x8283('0xba')]['id']},'include':_0x27337b})[_0x8283('0x2a')](handleEntityNotFound(_0x1021ef,null))[_0x8283('0x2a')](function(_0x536d4d){if(_0x536d4d&&_0x536d4d[_0x8283('0xd7')]){var _0x245ecc=_0x536d4d['get']({'plain':!![]});fs['mkdirSync'](_0xca8089);for(var _0x5b0d75=0x0;_0x5b0d75<_0x245ecc[_0x8283('0xd7')][_0x8283('0x48')];_0x5b0d75++){var _0x1338c1=_0x245ecc[_0x8283('0xd7')][_0x5b0d75][_0x8283('0xd6')];if(_0x1338c1){var _0x30f681=path[_0x8283('0xcf')](_0x202cc3,_0x1338c1[_0x8283('0xd8')]);if(fs['existsSync'](_0x30f681)){fs[_0x8283('0xd9')](_0x30f681)[_0x8283('0xda')](fs[_0x8283('0xdb')](path[_0x8283('0xcf')](_0xca8089,_0x1338c1['basename'])));}}}return BPromise[_0x8283('0x9a')]()[_0x8283('0x2a')](function(){return new BPromise(function(_0x5821e5,_0x1f1029){zipdir(_0xca8089,{'saveTo':_0x37573a},function(_0x4128b5,_0x4356a8){if(_0x4128b5)return _0x1f1029(_0x4128b5);return _0x5821e5(_0x4356a8);});})[_0x8283('0x2a')](function(){return new BPromise(function(_0x3dfa25,_0x1b12db){rimraf(_0xca8089,function(_0xd5953c){if(_0xd5953c)_0x1b12db(_0xd5953c);return _0x3dfa25();});});})['then'](function(){return _0x1021ef['download'](_0x37573a,_0x566921,function(_0x424c5e){if(_0x424c5e){console[_0x8283('0xdc')]('err',_0x424c5e);}else{fs['unlinkSync'](_0x37573a);}});});});}else{return _0x1021ef[_0x8283('0x1c')](0xc8);}})[_0x8283('0x35')](handleError(_0x1021ef,null));}; \ No newline at end of file +var _0x5940=['c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','o.internal','Owner.internal','ui.FaxInteractionId\x20IN\x20?','FaxInteractionId','all','rows','catch','show','includeAll','include','options','create','update','params','describe','addMessage','FaxMessage','ids','getMessages','findOne','rawAttributes','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','omit','spread','Tag','faxInteractionTags:save','removeTags','download','unix','join','root','tmp','files','attachments','Attachment','Messages','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','log','err','unlinkSync','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','end','status','json','offset','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','Users','fullname','TagIds','split','forEach','Tags','push','waiting','talking','answered','unmanaged','total','UserId','closed','index','map','FaxInteraction','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','tools_tags','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','value','having','`\x20>\x200','Contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','compact','FaxAccountId','where','concat','createdAt','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','clone','i.id','unreadMessages','contactName','DESC','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName'];(function(_0x5c1abf,_0x42af92){var _0x1142b5=function(_0x554b87){while(--_0x554b87){_0x5c1abf['push'](_0x5c1abf['shift']());}};_0x1142b5(++_0x42af92);}(_0x5940,0x118));var _0x0594=function(_0x45b719,_0x270132){_0x45b719=_0x45b719-0x0;var _0x1dcaa2=_0x5940[_0x45b719];return _0x1dcaa2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0594('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0594('0x1'));var rp=require(_0x0594('0x2'));var moment=require('moment');var BPromise=require(_0x0594('0x3'));var Mustache=require(_0x0594('0x4'));var util=require(_0x0594('0x5'));var path=require('path');var sox=require(_0x0594('0x6'));var csv=require(_0x0594('0x7'));var ejs=require(_0x0594('0x8'));var fs=require('fs');var fs_extra=require(_0x0594('0x9'));var _=require('lodash');var squel=require(_0x0594('0xa'));var crypto=require('crypto');var jsforce=require(_0x0594('0xb'));var deskjs=require(_0x0594('0xc'));var toCsv=require(_0x0594('0x7'));var querystring=require(_0x0594('0xd'));var Papa=require('papaparse');var Redis=require(_0x0594('0xe'));var authService=require(_0x0594('0xf'));var qs=require(_0x0594('0x10'));var as=require(_0x0594('0x11'));var hardwareService=require(_0x0594('0x12'));var logger=require('../../config/logger')(_0x0594('0x13'));var utils=require(_0x0594('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0594('0x15'));var db=require(_0x0594('0x16'))['db'];config[_0x0594('0x17')]=_['defaults'](config[_0x0594('0x17')],{'host':_0x0594('0x18'),'port':0x18eb});var socket=require(_0x0594('0x19'))(new Redis(config[_0x0594('0x17')]));require(_0x0594('0x1a'))[_0x0594('0x1b')](socket);function respondWithStatusCode(_0x241b1f,_0x1d0ad6){_0x1d0ad6=_0x1d0ad6||0xcc;return function(_0x217e4e){if(_0x217e4e){return _0x241b1f[_0x0594('0x1c')](_0x1d0ad6);}return _0x241b1f['status'](_0x1d0ad6)[_0x0594('0x1d')]();};}function respondWithResult(_0x595288,_0x536aac){_0x536aac=_0x536aac||0xc8;return function(_0x159642){if(_0x159642){return _0x595288[_0x0594('0x1e')](_0x536aac)[_0x0594('0x1f')](_0x159642);}};}function respondWithFilteredResult(_0x9a0b5b,_0x30e116){return function(_0x5ec782){if(_0x5ec782){var _0x499253=typeof _0x30e116[_0x0594('0x20')]==='undefined'&&typeof _0x30e116[_0x0594('0x21')]==='undefined';var _0x189dec=_0x5ec782[_0x0594('0x22')];var _0xf3ea93=_0x499253?0x0:_0x30e116[_0x0594('0x20')];var _0xfddd6b=_0x499253?_0x5ec782[_0x0594('0x22')]:_0x30e116[_0x0594('0x20')]+_0x30e116[_0x0594('0x21')];var _0x2f68e5;if(_0xfddd6b>=_0x189dec){_0xfddd6b=_0x189dec;_0x2f68e5=0xc8;}else{_0x2f68e5=0xce;}_0x9a0b5b['status'](_0x2f68e5);return _0x9a0b5b['set'](_0x0594('0x23'),_0xf3ea93+'-'+_0xfddd6b+'/'+_0x189dec)[_0x0594('0x1f')](_0x5ec782);}return null;};}function patchUpdates(_0xbde3ab){return function(_0x2d7242){try{jsonpatch[_0x0594('0x24')](_0x2d7242,_0xbde3ab,!![]);}catch(_0x3d90ca){return BPromise[_0x0594('0x25')](_0x3d90ca);}return _0x2d7242[_0x0594('0x26')]();};}function saveUpdates(_0x40e827,_0x742e5e){return function(_0xde109d){if(_0xde109d){return _0xde109d['update'](_0x40e827)[_0x0594('0x27')](function(_0x197f6c){return _0x197f6c;});}return null;};}function removeEntity(_0x3c3dc0,_0x9e53fe){return function(_0x40dd30){if(_0x40dd30){return _0x40dd30[_0x0594('0x28')]()['then'](function(){_0x3c3dc0[_0x0594('0x1e')](0xcc)[_0x0594('0x1d')]();});}};}function handleEntityNotFound(_0x18bdd2,_0x4c7038){return function(_0x4fde37){if(!_0x4fde37){_0x18bdd2[_0x0594('0x1c')](0x194);}return _0x4fde37;};}function handleError(_0x5d6f63,_0x8a88aa){_0x8a88aa=_0x8a88aa||0x1f4;return function(_0x19132a){logger[_0x0594('0x29')](_0x19132a[_0x0594('0x2a')]);if(_0x19132a[_0x0594('0x2b')]){delete _0x19132a[_0x0594('0x2b')];}_0x5d6f63['status'](_0x8a88aa)[_0x0594('0x2c')](_0x19132a);};}function getInteractionUsers(_0x92cfb7,_0x3424d2){return new BPromise(function(_0x2c690e,_0x9a9bcf){try{if(_0x3424d2[_0x92cfb7['id']]){_0x92cfb7[_0x0594('0x2d')]=_['map'](_0x3424d2[_0x92cfb7['id']],function(_0x30676a){return{'id':_0x30676a['id'],'fullname':_0x30676a[_0x0594('0x2e')]};});}}catch(_0x84647c){_0x9a9bcf(_0x84647c);}_0x2c690e(_0x92cfb7);});}function getInteractionTags(_0x33ea83,_0x4cc458){return new BPromise(function(_0x1dd16c,_0x29f6c5){try{if(_0x33ea83[_0x0594('0x2f')]){_0x33ea83['Tags']=[];_0x33ea83['TagIds'][_0x0594('0x30')](',')[_0x0594('0x31')](function(_0x25bf81){_0x33ea83[_0x0594('0x32')][_0x0594('0x33')](_0x4cc458[_0x25bf81]);});}delete _0x33ea83['TagIds'];}catch(_0x55df0b){_0x29f6c5(_0x55df0b);}_0x1dd16c(_0x33ea83);});}function updateFaxInteraction(_0x3521fb,_0x336927,_0x45c254){return new BPromise(function(_0x40f710,_0x870fc1){return getInteractionUsers(_0x3521fb,_0x45c254)['then'](function(_0x3514e6){return getInteractionTags(_0x3514e6,_0x336927);})[_0x0594('0x27')](function(_0x6ee791){return getStateInteraction(_0x6ee791);})[_0x0594('0x27')](function(_0x4316f6){_0x40f710(_0x4316f6);})['catch'](function(_0x13d96c){_0x870fc1(_0x13d96c);});});}function getStateInteraction(_0xffe5e4){return new BPromise(function(_0x4b3e8e){_0xffe5e4[_0x0594('0x34')]=0x0;_0xffe5e4[_0x0594('0x35')]=0x0;_0xffe5e4[_0x0594('0x36')]=0x0;_0xffe5e4[_0x0594('0x37')]=0x0;_0xffe5e4[_0x0594('0x38')]=0x0;if(!_0xffe5e4['closed']&&!_0xffe5e4[_0x0594('0x39')]){_0xffe5e4['waiting']+=0x1;}if(!_0xffe5e4['closed']&&_0xffe5e4['UserId']){_0xffe5e4[_0x0594('0x35')]+=0x1;if(_0xffe5e4[_0x0594('0x34')]){_0xffe5e4[_0x0594('0x34')]-=0x1;}}if(_0xffe5e4[_0x0594('0x3a')]&&_0xffe5e4[_0x0594('0x39')]){_0xffe5e4[_0x0594('0x36')]+=0x1;if(_0xffe5e4[_0x0594('0x35')]){_0xffe5e4['talking']-=0x1;}}if(_0xffe5e4[_0x0594('0x3a')]&&!_0xffe5e4[_0x0594('0x39')]){_0xffe5e4['unmanaged']+=0x1;if(_0xffe5e4[_0x0594('0x34')]){_0xffe5e4[_0x0594('0x34')]-=0x1;}}_0xffe5e4['total']+=0x1;_0x4b3e8e(_0xffe5e4);});}exports[_0x0594('0x3b')]=function(_0x59d0e4,_0x5f3776){var _0x2554e6={},_0x4fd69a={},_0x413096={'count':0x0,'rows':[]};var _0x492745=_[_0x0594('0x3c')](db[_0x0594('0x3d')]['rawAttributes'],function(_0x1d6b60){return{'name':_0x1d6b60[_0x0594('0x3e')],'type':_0x1d6b60[_0x0594('0x3f')]['key']};});_0x4fd69a[_0x0594('0x40')]=_['map'](_0x492745,_0x0594('0x2b'));_0x4fd69a[_0x0594('0x41')]=_[_0x0594('0x42')](_0x59d0e4[_0x0594('0x41')]);_0x4fd69a[_0x0594('0x43')]=_[_0x0594('0x44')](_0x4fd69a['model'],_0x4fd69a[_0x0594('0x41')]);_0x2554e6['attributes']=_[_0x0594('0x44')](_0x4fd69a[_0x0594('0x40')],qs[_0x0594('0x45')](_0x59d0e4[_0x0594('0x41')][_0x0594('0x45')]));_0x2554e6['attributes']=_0x2554e6[_0x0594('0x46')][_0x0594('0x47')]?_0x2554e6['attributes']:_0x4fd69a['model'];if(!_0x59d0e4['query'][_0x0594('0x48')](_0x0594('0x49'))){_0x2554e6[_0x0594('0x21')]=qs['limit'](_0x59d0e4[_0x0594('0x41')][_0x0594('0x21')]);_0x2554e6['offset']=qs['offset'](_0x59d0e4[_0x0594('0x41')]['offset']);}_0x2554e6[_0x0594('0x4a')]=qs['sort'](_0x59d0e4['query'][_0x0594('0x4b')]);_0x2554e6['where']=qs[_0x0594('0x43')](_[_0x0594('0x4c')](_0x59d0e4[_0x0594('0x41')],_0x4fd69a[_0x0594('0x43')]),_0x492745);var _0x555907=[];var _0x2ef80d=squel[_0x0594('0x4d')]()[_0x0594('0x4e')]('id')[_0x0594('0x4e')](_0x0594('0x2b'))['field'](_0x0594('0x4f'))[_0x0594('0x50')](_0x0594('0x51'));var _0x1640df=squel[_0x0594('0x4d')]()[_0x0594('0x4e')]('u.id')['field'](_0x0594('0x52'))[_0x0594('0x4e')](_0x0594('0x53'))[_0x0594('0x50')](_0x0594('0x54'),'ui')[_0x0594('0x55')]('users','u',_0x0594('0x56'));var _0x48e280=squel[_0x0594('0x4d')]()['from']('fax_interactions','i')[_0x0594('0x55')](_0x0594('0x57'),'c',_0x0594('0x58'))['left_join'](_0x0594('0x59'),'o',_0x0594('0x5a'))[_0x0594('0x55')](_0x0594('0x5b'),'a',_0x0594('0x5c'))[_0x0594('0x55')](_0x0594('0x5d'),'me',_0x0594('0x5e'))[_0x0594('0x55')]('fax_interaction_has_tags','it',_0x0594('0x5f'))[_0x0594('0x55')](_0x0594('0x51'),'t',_0x0594('0x60'));var _0x5c60f7=squel[_0x0594('0x61')]();var _0x2592d6=[];var _0x53fd50=squel['expr']();var _0x41d5de;if(_0x59d0e4[_0x0594('0x41')][_0x0594('0x62')]){_0x41d5de=as[_0x0594('0x63')](_0x59d0e4[_0x0594('0x41')]['search']);var _0x362252=_0x41d5de[_0x0594('0x64')];for(var _0x35b7c5=0x0;_0x35b7c5<_0x41d5de[_0x0594('0x65')][_0x0594('0x47')];_0x35b7c5++){var _0x5579f9=_0x41d5de['conditions'][_0x35b7c5];var _0x1d466a='i';var _0x5ebf22=_[_0x0594('0x66')](_0x492745,['name',_0x5579f9['field']]);if(!_0x5ebf22){switch(_0x5579f9[_0x0594('0x4e')]){case'unreadMessages':if(_0x5579f9[_0x0594('0x67')]==0x1){_0x48e280[_0x0594('0x68')]('`'+_0x5579f9['field']+'`\x20=\x200');}else{_0x48e280[_0x0594('0x68')]('`'+_0x5579f9[_0x0594('0x4e')]+_0x0594('0x69'));}break;case _0x0594('0x6a'):if(_0x5579f9['operator']==='$substring'){if(_0x5579f9['value'][_0x0594('0x30')]('\x20')[_0x0594('0x47')]>0x1){_0x5c60f7[_0x362252](_0x0594('0x6b'),qs['getFullTextValue'](_0x5579f9[_0x0594('0x67')]),null);}else{var _0x5941ec='%'+_0x5579f9['value']+'%';_0x5c60f7[_0x362252](_0x0594('0x6c'),_0x5941ec,_0x5941ec,_0x5941ec);}}else{_0x5ebf22=_[_0x0594('0x66')](_0x492745,[_0x0594('0x2b'),_0x0594('0x6d')]);_0x5579f9[_0x0594('0x4e')]='ContactId';_0x40542a=as[_0x0594('0x6e')](_0x1d466a,_0x5ebf22[_0x0594('0x3f')],_0x5579f9);_0x5c60f7[_0x362252](_0x40542a[_0x0594('0x6f')],_0x40542a['value'][_0x0594('0x70')],_0x40542a[_0x0594('0x67')]['end']);}break;case'Tag':var _0x35efe3=_0x5579f9[_0x0594('0x67')]['split'](',')[_0x0594('0x3c')](function(_0x3017cf){return Number(_0x3017cf);});_0x35efe3[_0x0594('0x31')](function(_0x483c2a){_0x53fd50['or'](_0x0594('0x71'),'%,'+_0x483c2a+',%');});_0x2592d6=_['union'](_0x2592d6,_0x35efe3);break;case _0x0594('0x72'):if(_0x5579f9['operator']===_0x0594('0x73')){_0x5c60f7[_0x362252](_0x0594('0x74'),'%'+_0x5579f9[_0x0594('0x67')]+'%',null);}else{_0x5ebf22=_[_0x0594('0x66')](_0x492745,[_0x0594('0x2b'),'UserId']);_0x5579f9[_0x0594('0x4e')]=_0x0594('0x39');_0x40542a=as[_0x0594('0x6e')](_0x1d466a,_0x5ebf22[_0x0594('0x3f')],_0x5579f9);_0x5c60f7[_0x362252](_0x40542a['text'],_0x40542a[_0x0594('0x67')][_0x0594('0x70')],_0x40542a['value'][_0x0594('0x1d')]);}break;case _0x0594('0x75'):_0x40542a=as[_0x0594('0x6e')]('me',null,_0x5579f9);_0x5c60f7[_0x362252](_0x40542a[_0x0594('0x6f')],_0x40542a[_0x0594('0x67')][_0x0594('0x70')],_0x40542a['value'][_0x0594('0x1d')]);break;}}else{var _0x40542a=as['buildExpression'](_0x1d466a,_0x5ebf22[_0x0594('0x3f')],_0x5579f9);_0x5c60f7[_0x362252](_0x40542a[_0x0594('0x6f')],_0x40542a[_0x0594('0x67')][_0x0594('0x70')],_0x40542a[_0x0594('0x67')][_0x0594('0x1d')]);}}}else{var _0x5517c6=_(_0x59d0e4[_0x0594('0x41')])['keys']()[_0x0594('0x3c')](function(_0x299af5){return _[_0x0594('0x76')](_0x492745,[_0x0594('0x2b'),_0x299af5])?_0x299af5:undefined;})[_0x0594('0x77')]()[_0x0594('0x67')]();if(!_['isEmpty'](_0x5517c6)){_0x5517c6[_0x0594('0x31')](function(_0x70ef0){if(_0x70ef0===_0x0594('0x78')){_0x48e280[_0x0594('0x79')]('i.FaxAccountId\x20IN\x20?',[][_0x0594('0x7a')](_0x59d0e4[_0x0594('0x41')][_0x70ef0]));}else if(_0x70ef0===_0x0594('0x7b')){var _0x59edb8=JSON['parse'](_0x59d0e4['query'][_0x70ef0])[_0x0594('0x7c')];var _0x540f1c=JSON['parse'](_0x59d0e4[_0x0594('0x41')][_0x70ef0])['$lte'];_0x48e280[_0x0594('0x79')](_0x0594('0x7d'),_0x59edb8,_0x540f1c);}else{if(_0x59d0e4['query'][_0x70ef0]==='null'){_0x48e280[_0x0594('0x79')]('i.'+_0x70ef0+_0x0594('0x7e'));}else{_0x48e280[_0x0594('0x79')]('i.'+_0x70ef0+_0x0594('0x7f'),_0x59d0e4[_0x0594('0x41')][_0x70ef0]);}}});}if(_0x59d0e4[_0x0594('0x41')][_0x0594('0x80')]){if(_0x59d0e4[_0x0594('0x41')][_0x0594('0x80')]==0x1){_0x48e280['having'](_0x0594('0x81'));}else{_0x48e280[_0x0594('0x68')](_0x0594('0x82'));}}if(_0x59d0e4[_0x0594('0x41')]['tag']){_0x2592d6=_[_0x0594('0x83')](_0x59d0e4[_0x0594('0x41')][_0x0594('0x84')])?_0x59d0e4[_0x0594('0x41')][_0x0594('0x84')]:new Array(_0x59d0e4[_0x0594('0x41')]['tag']);_0x2592d6['forEach'](function(_0x4623ba){_0x53fd50['or'](_0x0594('0x71'),'%,'+_0x4623ba+',%');});}if(_0x59d0e4[_0x0594('0x41')][_0x0594('0x85')]){var _0xd765bf=_0x59d0e4[_0x0594('0x41')][_0x0594('0x85')]['replace']('\x5c','\x5c\x5c')[_0x0594('0x86')](/'/g,'\x27\x27');if(qs['isNumeric'](_0xd765bf)){_0x5c60f7['or'](_0x0594('0x87'),_0xd765bf+'%')['or']('i.fax\x20LIKE\x20?',_0xd765bf+'%');}_0x5c60f7['or'](_0x0594('0x88'),_0xd765bf+'%');}}_0x48e280['where'](_0x5c60f7);_0x48e280[_0x0594('0x89')]('i.id');var _0x154028={'type':db[_0x0594('0x8a')]['QueryTypes']['SELECT'],'raw':!![]};var _0xf70062=_0x48e280[_0x0594('0x8b')]();_0xf70062[_0x0594('0x4e')](_0x0594('0x8c'));_0xf70062[_0x0594('0x4e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0594('0x8d'));if(_0x2554e6[_0x0594('0x4a')]){_0x2554e6['order'][_0x0594('0x31')](function(_0x46b77a){var _0x14072c=_0x46b77a[0x0]===_0x0594('0x8e')?_0x46b77a[0x0]:'i.'+_0x46b77a[0x0];_0x48e280[_0x0594('0x4a')](_0x14072c,_0x46b77a[0x1]===_0x0594('0x8f')?![]:!![]);});}if(!_['isEmpty'](_0x2592d6)){_0x48e280[_0x0594('0x68')](_0x53fd50);_0xf70062[_0x0594('0x79')]('t.id\x20IN\x20?',_0x2592d6);}BPromise[_0x0594('0x90')]()[_0x0594('0x27')](function(){if(!_0x41d5de){if(_0x59d0e4[_0x0594('0x41')][_0x0594('0x78')])return;_0xf70062[_0x0594('0x79')](_0x0594('0x91'));_0x48e280[_0x0594('0x79')](_0x0594('0x91'));return;}if(_0x59d0e4[_0x0594('0x92')][_0x0594('0x93')]!==_0x0594('0x94'))return;return _0x59d0e4['user'][_0x0594('0x95')]({'attributes':['id'],'raw':!![]})[_0x0594('0x27')](function(_0x21087d){if(_['isEmpty'](_0x21087d)){_0xf70062[_0x0594('0x79')](_0x0594('0x96'));_0x48e280['where'](_0x0594('0x96'));}else{_0xf70062['where'](_0x0594('0x97'),_[_0x0594('0x3c')](_0x21087d,'id'));_0x48e280[_0x0594('0x79')](_0x0594('0x97'),_[_0x0594('0x3c')](_0x21087d,'id'));}});})[_0x0594('0x27')](function(){if(_0x59d0e4['user'][_0x0594('0x93')]===_0x0594('0x94')&&!_0x41d5de&&!_0x59d0e4[_0x0594('0x41')][_0x0594('0x78')])return[];return db[_0x0594('0x98')][_0x0594('0x41')](_0xf70062[_0x0594('0x99')](),_0x154028);})[_0x0594('0x27')](function(_0xbba3a4){_0x413096['count']=_0xbba3a4['length'];if(_0x413096[_0x0594('0x22')]===0x0)return[];return db[_0x0594('0x98')][_0x0594('0x41')](_0x2ef80d[_0x0594('0x99')](),_0x154028)[_0x0594('0x27')](function(_0x3a0d82){_0x555907=_[_0x0594('0x9a')](_0x3a0d82,'id');_0x154028=_[_0x0594('0x9b')](_0x154028,{'model':db[_0x0594('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x59d0e4[_0x0594('0x41')]['fields']){_0x2554e6['attributes'][_0x0594('0x31')](function(_0x34424b){_0x48e280[_0x0594('0x4e')]('i.'+_0x34424b);});}else{_0x48e280[_0x0594('0x4e')](_0x0594('0x9c'),_0x0594('0x8d'));_0x48e280['field'](_0x0594('0x9d'),_0x0594('0x9e'));_0x48e280[_0x0594('0x4e')](_0x0594('0x9f'),_0x0594('0xa0'));_0x48e280[_0x0594('0x4e')](_0x0594('0xa1'),_0x0594('0x8e'));_0x48e280[_0x0594('0x4e')](_0x0594('0xa2'));_0x48e280[_0x0594('0x4e')](_0x0594('0xa3'),_0x0594('0xa4'));_0x48e280[_0x0594('0x4e')](_0x0594('0xa5'),'Contact.lastName');_0x48e280[_0x0594('0x4e')](_0x0594('0xa6'),_0x0594('0xa7'));_0x48e280[_0x0594('0x4e')](_0x0594('0xa8'),_0x0594('0xa9'));_0x48e280[_0x0594('0x4e')](_0x0594('0xaa'),_0x0594('0xab'));_0x48e280['field']('c.fax',_0x0594('0xac'));_0x48e280[_0x0594('0x4e')](_0x0594('0xad'),'Owner.fullname');_0x48e280[_0x0594('0x4e')](_0x0594('0xae'),_0x0594('0xaf'));_0x48e280[_0x0594('0x4e')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x2554e6[_0x0594('0x21')])_0x48e280['limit'](_0x2554e6[_0x0594('0x21')]);if(_0x2554e6[_0x0594('0x20')])_0x48e280[_0x0594('0x20')](_0x2554e6[_0x0594('0x20')]);return db[_0x0594('0x98')][_0x0594('0x41')](_0x48e280[_0x0594('0x99')](),_0x154028);})[_0x0594('0x27')](function(_0x31a6fe){if(_0x31a6fe['length']>0x0)_0x1640df[_0x0594('0x79')](_0x0594('0xb0'),_[_0x0594('0x3c')](_0x31a6fe,'id'));return db['sequelize']['query'](_0x1640df[_0x0594('0x99')](),_0x154028)[_0x0594('0x27')](function(_0x43ef99){var _0x2bcd03=_['groupBy'](_0x43ef99,_0x0594('0xb1'));var _0x590018=[];_0x31a6fe[_0x0594('0x31')](function(_0x572cd8){_0x590018[_0x0594('0x33')](updateFaxInteraction(_0x572cd8,_0x555907,_0x2bcd03));});return BPromise[_0x0594('0xb2')](_0x590018);});});})[_0x0594('0x27')](function(_0x1a6775){_0x413096[_0x0594('0xb3')]=_0x1a6775;return _0x413096;})[_0x0594('0x27')](respondWithFilteredResult(_0x5f3776,_0x2554e6))[_0x0594('0xb4')](handleError(_0x5f3776,null));};exports[_0x0594('0xb5')]=function(_0x48a704,_0x582f86){var _0x542d5d={'raw':![],'where':{'id':_0x48a704['params']['id']}},_0x479f00={};_0x479f00[_0x0594('0x40')]=_['keys'](db['FaxInteraction']['rawAttributes']);_0x479f00[_0x0594('0x41')]=_[_0x0594('0x42')](_0x48a704[_0x0594('0x41')]);_0x479f00['filters']=_[_0x0594('0x44')](_0x479f00[_0x0594('0x40')],_0x479f00[_0x0594('0x41')]);_0x542d5d[_0x0594('0x46')]=_[_0x0594('0x44')](_0x479f00[_0x0594('0x40')],qs[_0x0594('0x45')](_0x48a704[_0x0594('0x41')][_0x0594('0x45')]));_0x542d5d[_0x0594('0x46')]=_0x542d5d[_0x0594('0x46')][_0x0594('0x47')]?_0x542d5d['attributes']:_0x479f00[_0x0594('0x40')];if(_0x48a704[_0x0594('0x41')][_0x0594('0xb6')]){_0x542d5d[_0x0594('0xb7')]=[{'all':!![]}];}_0x542d5d=_[_0x0594('0x9b')]({},_0x542d5d,_0x48a704[_0x0594('0xb8')]);return db[_0x0594('0x3d')][_0x0594('0x66')](_0x542d5d)[_0x0594('0x27')](handleEntityNotFound(_0x582f86,null))[_0x0594('0x27')](respondWithResult(_0x582f86,null))[_0x0594('0xb4')](handleError(_0x582f86,null));};exports[_0x0594('0xb9')]=function(_0x9242d7,_0x1a1015){return db[_0x0594('0x3d')][_0x0594('0xb9')](_0x9242d7['body'],{})[_0x0594('0x27')](respondWithResult(_0x1a1015,0xc9))[_0x0594('0xb4')](handleError(_0x1a1015,null));};exports[_0x0594('0xba')]=function(_0x370b6e,_0x3b3afc){if(_0x370b6e[_0x0594('0x75')]['id']){delete _0x370b6e['body']['id'];}return db['FaxInteraction'][_0x0594('0x66')]({'where':{'id':_0x370b6e[_0x0594('0xbb')]['id']}})[_0x0594('0x27')](handleEntityNotFound(_0x3b3afc,null))[_0x0594('0x27')](saveUpdates(_0x370b6e[_0x0594('0x75')],null))[_0x0594('0x27')](respondWithResult(_0x3b3afc,null))[_0x0594('0xb4')](handleError(_0x3b3afc,null));};exports[_0x0594('0x28')]=function(_0x563684,_0x4f3e31){return db[_0x0594('0x3d')][_0x0594('0x66')]({'where':{'id':_0x563684[_0x0594('0xbb')]['id']}})[_0x0594('0x27')](handleEntityNotFound(_0x4f3e31,null))[_0x0594('0x27')](removeEntity(_0x4f3e31,null))[_0x0594('0xb4')](handleError(_0x4f3e31,null));};exports[_0x0594('0xbc')]=function(_0x11769e,_0xbe704c){return db['FaxInteraction']['describe']()['then'](respondWithResult(_0xbe704c,null))['catch'](handleError(_0xbe704c,null));};exports[_0x0594('0xbd')]=function(_0x2255a9,_0x5c69dd,_0x482032){return db[_0x0594('0xbe')]['find']({'where':{'id':_0x2255a9[_0x0594('0xbb')]['id']}})['then'](handleEntityNotFound(_0x5c69dd,null))[_0x0594('0x27')](function(_0x53f640){if(_0x53f640){return _0x53f640['addMessage'](_0x2255a9[_0x0594('0x75')][_0x0594('0xbf')],_['omit'](_0x2255a9[_0x0594('0x75')],['ids','id'])||{});}})['then'](respondWithResult(_0x5c69dd,null))[_0x0594('0xb4')](handleError(_0x5c69dd,null));};exports[_0x0594('0xc0')]=function(_0x25a5c2,_0x1b06e6,_0x58264c){var _0x284a3b={'raw':![],'where':{}};var _0x3582da={};var _0x550540={'count':0x0,'rows':[]};return db[_0x0594('0x3d')][_0x0594('0xc1')]({'where':{'id':_0x25a5c2[_0x0594('0xbb')]['id']}})[_0x0594('0x27')](handleEntityNotFound(_0x1b06e6,null))['then'](function(_0x47b6b4){if(_0x47b6b4){_0x3582da[_0x0594('0x40')]=_[_0x0594('0x42')](db[_0x0594('0xbe')][_0x0594('0xc2')]);_0x3582da[_0x0594('0x41')]=_['keys'](_0x25a5c2[_0x0594('0x41')]);_0x3582da[_0x0594('0x43')]=_[_0x0594('0x44')](_0x3582da['model'],_0x3582da[_0x0594('0x41')]);_0x284a3b[_0x0594('0x46')]=_[_0x0594('0x44')](_0x3582da[_0x0594('0x40')],qs[_0x0594('0x45')](_0x25a5c2[_0x0594('0x41')][_0x0594('0x45')]));_0x284a3b[_0x0594('0x46')]=_0x284a3b[_0x0594('0x46')][_0x0594('0x47')]?_0x284a3b['attributes']:_0x3582da['model'];if(!_0x25a5c2[_0x0594('0x41')]['hasOwnProperty']('nolimit')){_0x284a3b[_0x0594('0x21')]=qs[_0x0594('0x21')](_0x25a5c2['query'][_0x0594('0x21')]);_0x284a3b['offset']=qs['offset'](_0x25a5c2[_0x0594('0x41')]['offset']);}_0x284a3b['order']=qs[_0x0594('0x4b')](_0x25a5c2['query'][_0x0594('0x4b')]);_0x284a3b[_0x0594('0x79')]=qs[_0x0594('0x43')](_[_0x0594('0x4c')](_0x25a5c2['query'],_0x3582da[_0x0594('0x43')]));_0x284a3b['where'][_0x0594('0xb1')]=_0x47b6b4['id'];if(_0x25a5c2['query'][_0x0594('0x85')]){_0x284a3b[_0x0594('0x79')]=_[_0x0594('0x9b')](_0x284a3b['where'],{'$or':_[_0x0594('0x3c')](_0x284a3b[_0x0594('0x46')],function(_0x360cfe){var _0x53f5f0={};_0x53f5f0[_0x360cfe]={'$like':'%'+_0x25a5c2[_0x0594('0x41')][_0x0594('0x85')]+'%'};return _0x53f5f0;})});}if(_0x25a5c2[_0x0594('0x41')][_0x0594('0x7c')]){var _0x48a42b=_0x25a5c2[_0x0594('0x41')][_0x0594('0x7c')]['split'](',');var _0x4018fe={};_0x4018fe[_0x48a42b[0x0]]={'$gte':moment(_0x48a42b[0x1])[_0x0594('0xc3')](_0x0594('0xc4'))};_0x284a3b[_0x0594('0x79')]=_[_0x0594('0x9b')](_0x284a3b[_0x0594('0x79')],_0x4018fe);}_0x284a3b=_[_0x0594('0x9b')]({},_0x284a3b,_0x25a5c2[_0x0594('0xb8')]);return db[_0x0594('0xbe')][_0x0594('0x22')]({'where':_0x284a3b['where']})['then'](function(_0x5253ee){_0x550540[_0x0594('0x22')]=_0x5253ee;if(_0x25a5c2[_0x0594('0x41')][_0x0594('0xb6')]){_0x284a3b[_0x0594('0xb7')]=[{'all':!![]}];}return db[_0x0594('0xbe')][_0x0594('0xc5')](_0x284a3b);})[_0x0594('0x27')](function(_0x3e954f){_0x550540[_0x0594('0xb3')]=_0x3e954f;return _0x550540;});}})['then'](respondWithFilteredResult(_0x1b06e6,_0x284a3b))[_0x0594('0xb4')](handleError(_0x1b06e6,null));};exports[_0x0594('0xc6')]=function(_0x31cb1b,_0x2b023e,_0x399886){return db[_0x0594('0x3d')][_0x0594('0x66')]({'where':{'id':_0x31cb1b[_0x0594('0xbb')]['id']}})[_0x0594('0x27')](handleEntityNotFound(_0x2b023e,null))[_0x0594('0x27')](function(_0x4b8698){if(_0x4b8698){return _0x4b8698[_0x0594('0xc7')](_0x31cb1b['body']['ids'],_[_0x0594('0xc8')](_0x31cb1b[_0x0594('0x75')],[_0x0594('0xbf'),'id'])||{})[_0x0594('0xc9')](function(){return db[_0x0594('0xca')][_0x0594('0xc5')]({'attributes':['id',_0x0594('0x2b'),_0x0594('0x4f')],'where':{'id':_0x31cb1b[_0x0594('0x75')]['ids']}});})[_0x0594('0x27')](function(_0xd4aba5){socket['emit'](_0x0594('0xcb'),{'id':Number(_0x31cb1b['params']['id']),'tags':_0xd4aba5||[]});return{'id':Number(_0x31cb1b[_0x0594('0xbb')]['id']),'tags':_0xd4aba5||[]};});}})['then'](respondWithResult(_0x2b023e,null))[_0x0594('0xb4')](handleError(_0x2b023e,null));};exports[_0x0594('0xcc')]=function(_0x2a198b,_0x56c65b,_0x28d6e8){return db[_0x0594('0x3d')][_0x0594('0x66')]({'where':{'id':_0x2a198b[_0x0594('0xbb')]['id']}})[_0x0594('0x27')](handleEntityNotFound(_0x56c65b,null))[_0x0594('0x27')](function(_0x166fe4){if(_0x166fe4){return _0x166fe4[_0x0594('0xcc')](_0x2a198b[_0x0594('0x41')][_0x0594('0xbf')]);}})['then'](respondWithStatusCode(_0x56c65b,null))[_0x0594('0xb4')](handleError(_0x56c65b,null));};exports[_0x0594('0xcd')]=function(_0x4afc77,_0x53ebfd){var _0x122ae9=moment()[_0x0594('0xce')]()[_0x0594('0x99')]();var _0x325ad4=path[_0x0594('0xcf')](config[_0x0594('0xd0')],'server','files',_0x0594('0xd1'));var _0x20d363=path['join'](config['root'],'server',_0x0594('0xd2'),_0x0594('0xd3'));var _0x5e2d44=path[_0x0594('0xcf')](_0x325ad4,_0x122ae9);var _0x20e420=util[_0x0594('0xc3')]('transcript-%d-%s.zip',_0x4afc77[_0x0594('0xbb')]['id'],_0x122ae9);var _0x2c21be=path['join'](_0x325ad4,_0x20e420);var _0x8b6db0=[];_0x8b6db0[_0x0594('0x33')]({'model':db[_0x0594('0xd4')],'as':_0x0594('0xd4'),'raw':!![]});var _0x36046f=[{'model':db[_0x0594('0xbe')],'as':_0x0594('0xd5'),'attributes':['id','body','createdAt'],'include':_0x8b6db0}];return db[_0x0594('0x3d')][_0x0594('0x66')]({'where':{'id':_0x4afc77['params']['id']},'include':_0x36046f})[_0x0594('0x27')](handleEntityNotFound(_0x53ebfd,null))[_0x0594('0x27')](function(_0x435041){if(_0x435041&&_0x435041[_0x0594('0xd5')]){var _0x97f964=_0x435041['get']({'plain':!![]});fs[_0x0594('0xd6')](_0x5e2d44);for(var _0x5b70e2=0x0;_0x5b70e2<_0x97f964[_0x0594('0xd5')][_0x0594('0x47')];_0x5b70e2++){var _0x47aa34=_0x97f964[_0x0594('0xd5')][_0x5b70e2][_0x0594('0xd4')];if(_0x47aa34){var _0x3c4aae=path[_0x0594('0xcf')](_0x20d363,_0x47aa34[_0x0594('0xd7')]);if(fs[_0x0594('0xd8')](_0x3c4aae)){fs[_0x0594('0xd9')](_0x3c4aae)[_0x0594('0xda')](fs[_0x0594('0xdb')](path['join'](_0x5e2d44,_0x47aa34[_0x0594('0xd7')])));}}}return BPromise['resolve']()[_0x0594('0x27')](function(){return new BPromise(function(_0x17a360,_0x3f3b0d){zipdir(_0x5e2d44,{'saveTo':_0x2c21be},function(_0x5d3e74,_0x8db164){if(_0x5d3e74)return _0x3f3b0d(_0x5d3e74);return _0x17a360(_0x8db164);});})[_0x0594('0x27')](function(){return new BPromise(function(_0x5a0ad4,_0x641d12){rimraf(_0x5e2d44,function(_0xe6250){if(_0xe6250)_0x641d12(_0xe6250);return _0x5a0ad4();});});})['then'](function(){return _0x53ebfd[_0x0594('0xcd')](_0x2c21be,_0x20e420,function(_0x376ec3){if(_0x376ec3){console[_0x0594('0xdc')](_0x0594('0xdd'),_0x376ec3);}else{fs[_0x0594('0xde')](_0x2c21be);}});});});}else{return _0x53ebfd[_0x0594('0x1c')](0xc8);}})[_0x0594('0xb4')](handleError(_0x53ebfd,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index a0dc7c9..73bf7b6 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 _0x4eec=['unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','map','findAll','setDataValue'];(function(_0x6f3151,_0x406745){var _0x305fb8=function(_0x24e5a8){while(--_0x24e5a8){_0x6f3151['push'](_0x6f3151['shift']());}};_0x305fb8(++_0x406745);}(_0x4eec,0x1e1));var _0xc4ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4eec[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xc4ee('0x0'));var FaxInteraction=require(_0xc4ee('0x1'))['db'][_0xc4ee('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0xc4ee('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xc4ee('0x4')](0x0);var events={'afterCreate':_0xc4ee('0x5'),'afterUpdate':_0xc4ee('0x6'),'afterDestroy':_0xc4ee('0x7')};function emitEvent(_0x127e76){return function(_0x5cc02c,_0x13e773,_0x35bf43){_0x5cc02c[_0xc4ee('0x8')]({'attributes':['id'],'raw':!![]})[_0xc4ee('0x9')](function(_0x4a3faa){_0x5cc02c['setDataValue']('Users',_0x4a3faa[_0xc4ee('0xa')](function(_0x5ea035){return{'id':_0x5ea035['id']};}));return FaxMessage[_0xc4ee('0xb')]({'where':{'FaxInteractionId':_0x5cc02c['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5a547f){_0x5cc02c[_0xc4ee('0xc')](_0xc4ee('0xd'),_0x5a547f['length']);FaxInteractionEvents[_0xc4ee('0xe')](_0x127e76+':'+_0x5cc02c['id'],_0x5cc02c);FaxInteractionEvents['emit'](_0x127e76,_0x5cc02c);_0x35bf43(null);})[_0xc4ee('0xf')](_0x35bf43(null));};}for(var e in events){if(events[_0xc4ee('0x10')](e)){var event=events[e];FaxInteraction[_0xc4ee('0x11')](e,emitEvent(event));}}module[_0xc4ee('0x12')]=FaxInteractionEvents; \ No newline at end of file +var _0x3c6b=['catch','hasOwnProperty','../../mysqldb','FaxMessage','save','update','remove','getUsers','then','setDataValue','Users','unreadMessages','emit'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x3c6b,0x147));var _0xb3c6=function(_0x262f81,_0x180ede){_0x262f81=_0x262f81-0x0;var _0x4e7f00=_0x3c6b[_0x262f81];return _0x4e7f00;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0xb3c6('0x0'))['db']['FaxInteraction'];var FaxMessage=require(_0xb3c6('0x0'))['db'][_0xb3c6('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb3c6('0x2'),'afterUpdate':_0xb3c6('0x3'),'afterDestroy':_0xb3c6('0x4')};function emitEvent(_0x52dd64){return function(_0x2215c2,_0x59893b,_0x511b12){_0x2215c2[_0xb3c6('0x5')]({'attributes':['id'],'raw':!![]})[_0xb3c6('0x6')](function(_0x363e66){_0x2215c2[_0xb3c6('0x7')](_0xb3c6('0x8'),_0x363e66['map'](function(_0x199568){return{'id':_0x199568['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x2215c2['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3d654a){_0x2215c2['setDataValue'](_0xb3c6('0x9'),_0x3d654a['length']);FaxInteractionEvents['emit'](_0x52dd64+':'+_0x2215c2['id'],_0x2215c2);FaxInteractionEvents[_0xb3c6('0xa')](_0x52dd64,_0x2215c2);_0x511b12(null);})[_0xb3c6('0xb')](_0x511b12(null));};}for(var e in events){if(events[_0xb3c6('0xc')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 4f9c97c..cdfbbec 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 _0xf230=['moment','path','rimraf','../../config/environment','exports','define','fax_interactions','changed','closed','format','lodash','util','../../config/logger','api'];(function(_0x11e571,_0x140120){var _0x306e5b=function(_0x263ce7){while(--_0x263ce7){_0x11e571['push'](_0x11e571['shift']());}};_0x306e5b(++_0x140120);}(_0xf230,0xea));var _0x0f23=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf230[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x0f23('0x0'));var util=require(_0x0f23('0x1'));var logger=require(_0x0f23('0x2'))(_0x0f23('0x3'));var moment=require(_0x0f23('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0f23('0x5'));var rimraf=require(_0x0f23('0x6'));var config=require(_0x0f23('0x7'));var attributes=require('./faxInteraction.attributes');module[_0x0f23('0x8')]=function(_0x5c78cf,_0x5cb5bf){return _0x5c78cf[_0x0f23('0x9')]('FaxInteraction',attributes,{'tableName':_0x0f23('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5e4eed,_0x3a2bfe,_0x357270){if(_0x5e4eed[_0x0f23('0xb')](_0x0f23('0xc'))){_0x5e4eed['closedAt']=moment()[_0x0f23('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x357270(null,_0x5e4eed);}}});}; \ No newline at end of file +var _0x2e5d=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util'];(function(_0x59149e,_0x357f8c){var _0x41700b=function(_0x1a2e7c){while(--_0x1a2e7c){_0x59149e['push'](_0x59149e['shift']());}};_0x41700b(++_0x357f8c);}(_0x2e5d,0x1c1));var _0xd2e5=function(_0x31df6f,_0x380e73){_0x31df6f=_0x31df6f-0x0;var _0x31e353=_0x2e5d[_0x31df6f];return _0x31e353;};'use strict';var _=require('lodash');var util=require(_0xd2e5('0x0'));var logger=require(_0xd2e5('0x1'))(_0xd2e5('0x2'));var moment=require(_0xd2e5('0x3'));var BPromise=require(_0xd2e5('0x4'));var rp=require(_0xd2e5('0x5'));var fs=require('fs');var path=require(_0xd2e5('0x6'));var rimraf=require(_0xd2e5('0x7'));var config=require(_0xd2e5('0x8'));var attributes=require(_0xd2e5('0x9'));module[_0xd2e5('0xa')]=function(_0x220b8b,_0x7e67a){return _0x220b8b[_0xd2e5('0xb')](_0xd2e5('0xc'),attributes,{'tableName':_0xd2e5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x40885f,_0xffdc16,_0x3a76c3){if(_0x40885f[_0xd2e5('0xe')]('closed')){_0x40885f[_0xd2e5('0xf')]=moment()[_0xd2e5('0x10')](_0xd2e5('0x11'));}_0x3a76c3(null,_0x40885f);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 6187dd1..b4cb98d 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 _0xe13a=['http','redis','defaults','localhost','socket.io-emitter','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','FaxInteraction','update','body','options','raw','where','attributes','limit','UpdateFaxInteraction','catch','find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x1236df,_0x257758){var _0x21aa07=function(_0x4ab42b){while(--_0x4ab42b){_0x1236df['push'](_0x1236df['shift']());}};_0x21aa07(++_0x257758);}(_0xe13a,0x1ed));var _0xae13=function(_0x275f05,_0x1e581a){_0x275f05=_0x275f05-0x0;var _0xfcf997=_0xe13a[_0x275f05];return _0xfcf997;};'use strict';var _=require(_0xae13('0x0'));var util=require(_0xae13('0x1'));var moment=require(_0xae13('0x2'));var BPromise=require(_0xae13('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xae13('0x4'));var db=require(_0xae13('0x5'))['db'];var utils=require(_0xae13('0x6'));var logger=require(_0xae13('0x7'))(_0xae13('0x8'));var config=require(_0xae13('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xae13('0xa')][_0xae13('0xb')]({'port':0x232a});config[_0xae13('0xc')]=_[_0xae13('0xd')](config[_0xae13('0xc')],{'host':_0xae13('0xe'),'port':0x18eb});var socket=require(_0xae13('0xf'))(new Redis(config[_0xae13('0xc')]));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x2ff4bf,_0x590974,_0x54f3a9){return new BPromise(function(_0x502b3f,_0x2e3cad){return client[_0xae13('0x10')](_0x2ff4bf,_0x54f3a9)[_0xae13('0x11')](function(_0x206e04){logger['info'](_0xae13('0x12'),_0x590974,_0xae13('0x13'));logger[_0xae13('0x14')](_0xae13('0x15'),_0x590974,'request\x20sent',JSON[_0xae13('0x16')](_0x206e04));if(_0x206e04[_0xae13('0x17')]){if(_0x206e04[_0xae13('0x17')]['code']===0x1f4){logger[_0xae13('0x17')](_0xae13('0x12'),_0x590974,_0x206e04['error'][_0xae13('0x18')]);return _0x2e3cad(_0x206e04[_0xae13('0x17')][_0xae13('0x18')]);}logger['error'](_0xae13('0x12'),_0x590974,_0x206e04['error'][_0xae13('0x18')]);return _0x502b3f(_0x206e04[_0xae13('0x17')][_0xae13('0x18')]);}else{logger[_0xae13('0x19')]('FaxInteraction,\x20%s,\x20%s',_0x590974,_0xae13('0x13'));_0x502b3f(_0x206e04[_0xae13('0x1a')]['message']);}})['catch'](function(_0x2a1554){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x590974,_0x2a1554);_0x2e3cad(_0x2a1554);});});}exports['UpdateFaxInteraction']=function(_0x460fcd){var _0x41dcbf=this;return new Promise(function(_0x44ede3,_0x4f11e8){return db[_0xae13('0x1b')][_0xae13('0x1c')](_0x460fcd[_0xae13('0x1d')],{'raw':_0x460fcd[_0xae13('0x1e')]?_0x460fcd[_0xae13('0x1e')][_0xae13('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x460fcd[_0xae13('0x1e')]?_0x460fcd[_0xae13('0x1e')][_0xae13('0x20')]||null:null,'attributes':_0x460fcd[_0xae13('0x1e')]?_0x460fcd[_0xae13('0x1e')][_0xae13('0x21')]||null:null,'limit':_0x460fcd['options']?_0x460fcd[_0xae13('0x1e')][_0xae13('0x22')]||null:null})[_0xae13('0x11')](function(_0x462951){logger[_0xae13('0x19')](_0xae13('0x23'),_0x460fcd);logger[_0xae13('0x14')](_0xae13('0x23'),_0x460fcd,JSON[_0xae13('0x16')](_0x462951));_0x44ede3(_0x462951);})[_0xae13('0x24')](function(_0x4a8ae2){logger[_0xae13('0x17')](_0xae13('0x23'),_0x4a8ae2['message'],_0x460fcd);_0x4f11e8(_0x41dcbf[_0xae13('0x17')](0x1f4,_0x4a8ae2[_0xae13('0x18')]));});});};exports['AddTagsToFaxInteraction']=function(_0x18f7d0){return new Promise(function(_0x1b728c,_0x3e3e78){return db['FaxInteraction'][_0xae13('0x25')]({'where':_0x18f7d0[_0xae13('0x1e')]?_0x18f7d0[_0xae13('0x1e')][_0xae13('0x20')]||null:null})[_0xae13('0x11')](function(_0x56a4db){if(_0x56a4db){return _0x56a4db[_0xae13('0x26')](_0x18f7d0['body'][_0xae13('0x27')],_['omit'](_0x18f7d0['body'],[_0xae13('0x27'),'id'])||{});}})[_0xae13('0x28')](function(_0x4a65d0){logger['info'](_0xae13('0x29'),_0x18f7d0);logger[_0xae13('0x14')](_0xae13('0x29'),_0x18f7d0,JSON[_0xae13('0x16')](_0x4a65d0));_0x1b728c(_0x4a65d0);})[_0xae13('0x24')](function(_0x139e08){logger[_0xae13('0x17')]('AddTags',_0x139e08[_0xae13('0x18')],_0x18f7d0);_0x3e3e78(_this[_0xae13('0x17')](0x1f4,_0x139e08['message']));});});}; \ No newline at end of file +var _0xee5b=['FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','UpdateFaxInteraction','FaxInteraction','body','options','where','attributes','limit','AddTagsToFaxInteraction','find','addTags','ids','spread','AddTags','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxInteraction.socket','request','then'];(function(_0x47bbd5,_0xfab6bc){var _0xea2a13=function(_0xc1964c){while(--_0xc1964c){_0x47bbd5['push'](_0x47bbd5['shift']());}};_0xea2a13(++_0xfab6bc);}(_0xee5b,0x14e));var _0xbee5=function(_0x2b5d52,_0x9bbc09){_0x2b5d52=_0x2b5d52-0x0;var _0x451e8e=_0xee5b[_0x2b5d52];return _0x451e8e;};'use strict';var _=require('lodash');var util=require(_0xbee5('0x0'));var moment=require('moment');var BPromise=require(_0xbee5('0x1'));var rs=require(_0xbee5('0x2'));var fs=require('fs');var Redis=require(_0xbee5('0x3'));var db=require(_0xbee5('0x4'))['db'];var utils=require(_0xbee5('0x5'));var logger=require('../../config/logger')(_0xbee5('0x6'));var config=require(_0xbee5('0x7'));var jayson=require(_0xbee5('0x8'));var client=jayson[_0xbee5('0x9')][_0xbee5('0xa')]({'port':0x232a});config[_0xbee5('0xb')]=_[_0xbee5('0xc')](config[_0xbee5('0xb')],{'host':_0xbee5('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbee5('0xb')]));require(_0xbee5('0xe'))['register'](socket);function respondWithRpcPromise(_0x2ba820,_0x411731,_0x44431f){return new BPromise(function(_0x456794,_0x11556b){return client[_0xbee5('0xf')](_0x2ba820,_0x44431f)[_0xbee5('0x10')](function(_0x17689f){logger['info'](_0xbee5('0x11'),_0x411731,_0xbee5('0x12'));logger[_0xbee5('0x13')](_0xbee5('0x14'),_0x411731,_0xbee5('0x12'),JSON[_0xbee5('0x15')](_0x17689f));if(_0x17689f[_0xbee5('0x16')]){if(_0x17689f[_0xbee5('0x16')]['code']===0x1f4){logger[_0xbee5('0x16')](_0xbee5('0x11'),_0x411731,_0x17689f[_0xbee5('0x16')]['message']);return _0x11556b(_0x17689f[_0xbee5('0x16')][_0xbee5('0x17')]);}logger[_0xbee5('0x16')](_0xbee5('0x11'),_0x411731,_0x17689f[_0xbee5('0x16')][_0xbee5('0x17')]);return _0x456794(_0x17689f[_0xbee5('0x16')][_0xbee5('0x17')]);}else{logger[_0xbee5('0x18')](_0xbee5('0x11'),_0x411731,_0xbee5('0x12'));_0x456794(_0x17689f['result'][_0xbee5('0x17')]);}})[_0xbee5('0x19')](function(_0x13d209){logger[_0xbee5('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x411731,_0x13d209);_0x11556b(_0x13d209);});});}exports[_0xbee5('0x1a')]=function(_0x21c744){var _0x12f93c=this;return new Promise(function(_0x3e23ad,_0x46d88b){return db[_0xbee5('0x1b')]['update'](_0x21c744[_0xbee5('0x1c')],{'raw':_0x21c744[_0xbee5('0x1d')]?_0x21c744[_0xbee5('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21c744[_0xbee5('0x1d')]?_0x21c744[_0xbee5('0x1d')][_0xbee5('0x1e')]||null:null,'attributes':_0x21c744[_0xbee5('0x1d')]?_0x21c744[_0xbee5('0x1d')][_0xbee5('0x1f')]||null:null,'limit':_0x21c744[_0xbee5('0x1d')]?_0x21c744[_0xbee5('0x1d')][_0xbee5('0x20')]||null:null})[_0xbee5('0x10')](function(_0x1ad0f1){logger[_0xbee5('0x18')](_0xbee5('0x1a'),_0x21c744);logger[_0xbee5('0x13')]('UpdateFaxInteraction',_0x21c744,JSON[_0xbee5('0x15')](_0x1ad0f1));_0x3e23ad(_0x1ad0f1);})[_0xbee5('0x19')](function(_0x162cf4){logger[_0xbee5('0x16')]('UpdateFaxInteraction',_0x162cf4[_0xbee5('0x17')],_0x21c744);_0x46d88b(_0x12f93c[_0xbee5('0x16')](0x1f4,_0x162cf4[_0xbee5('0x17')]));});});};exports[_0xbee5('0x21')]=function(_0x2b8d1a){return new Promise(function(_0x488488,_0x11af57){return db[_0xbee5('0x1b')][_0xbee5('0x22')]({'where':_0x2b8d1a['options']?_0x2b8d1a[_0xbee5('0x1d')]['where']||null:null})[_0xbee5('0x10')](function(_0x129b7f){if(_0x129b7f){return _0x129b7f[_0xbee5('0x23')](_0x2b8d1a[_0xbee5('0x1c')][_0xbee5('0x24')],_['omit'](_0x2b8d1a['body'],['ids','id'])||{});}})[_0xbee5('0x25')](function(_0x54911){logger[_0xbee5('0x18')](_0xbee5('0x26'),_0x2b8d1a);logger[_0xbee5('0x13')](_0xbee5('0x26'),_0x2b8d1a,JSON['stringify'](_0x54911));_0x488488(_0x54911);})[_0xbee5('0x19')](function(_0x15ef65){logger['error'](_0xbee5('0x26'),_0x15ef65[_0xbee5('0x17')],_0x2b8d1a);_0x11af57(_this[_0xbee5('0x16')](0x1f4,_0x15ef65[_0xbee5('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index a7c878b..36f84b6 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 _0x1dc1=['faxInteraction:','./faxInteraction.events','save','remove','removeListener'];(function(_0xd18983,_0x2b573b){var _0x378278=function(_0x332e5f){while(--_0x332e5f){_0xd18983['push'](_0xd18983['shift']());}};_0x378278(++_0x2b573b);}(_0x1dc1,0xd3));var _0x11dc=function(_0x5f42b4,_0x30a60f){_0x5f42b4=_0x5f42b4-0x0;var _0x28d226=_0x1dc1[_0x5f42b4];return _0x28d226;};'use strict';var FaxInteractionEvents=require(_0x11dc('0x0'));var events=[_0x11dc('0x1'),_0x11dc('0x2'),'update'];function createListener(_0x57f7f2,_0x517007){return function(_0x2b6520){_0x517007['emit'](_0x57f7f2,_0x2b6520);};}function removeListener(_0x390b9b,_0x1c79d4){return function(){FaxInteractionEvents[_0x11dc('0x3')](_0x390b9b,_0x1c79d4);};}exports['register']=function(_0x15d854){for(var _0x20944d=0x0,_0x27dcac=events['length'];_0x20944d<_0x27dcac;_0x20944d++){var _0x132dd7=events[_0x20944d];var _0xaae3ef=createListener(_0x11dc('0x4')+_0x132dd7,_0x15d854);FaxInteractionEvents['on'](_0x132dd7,_0xaae3ef);}}; \ No newline at end of file +var _0x8925=['register','length','save','update','emit'];(function(_0x2e249d,_0x41b7e7){var _0x1faa37=function(_0x1422b4){while(--_0x1422b4){_0x2e249d['push'](_0x2e249d['shift']());}};_0x1faa37(++_0x41b7e7);}(_0x8925,0xca));var _0x5892=function(_0x5c804e,_0x583316){_0x5c804e=_0x5c804e-0x0;var _0x317514=_0x8925[_0x5c804e];return _0x317514;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x5892('0x0'),'remove',_0x5892('0x1')];function createListener(_0x3c53fa,_0x7204f8){return function(_0x224fa8){_0x7204f8[_0x5892('0x2')](_0x3c53fa,_0x224fa8);};}function removeListener(_0x42efeb,_0xe0a53b){return function(){FaxInteractionEvents['removeListener'](_0x42efeb,_0xe0a53b);};}exports[_0x5892('0x3')]=function(_0x4aadba){for(var _0x555b70=0x0,_0x447f91=events[_0x5892('0x4')];_0x555b70<_0x447f91;_0x555b70++){var _0x5bbeda=events[_0x555b70];var _0x4359aa=createListener('faxInteraction:'+_0x5bbeda,_0x4aadba);FaxInteractionEvents['on'](_0x5bbeda,_0x4359aa);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 025896e..9f4f2db 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 _0xb828=['/:id/tags','tracked','fax','addTags','update','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','index','get','/:id','isAuthenticated','show','/:id/messages','getMessages','download','post','create','addMessage'];(function(_0x538380,_0x574b01){var _0xa647cc=function(_0x19ea22){while(--_0x19ea22){_0x538380['push'](_0x538380['shift']());}};_0xa647cc(++_0x574b01);}(_0xb828,0x120));var _0x8b82=function(_0x4b2cc6,_0x29ef43){_0x4b2cc6=_0x4b2cc6-0x0;var _0x3e0b08=_0xb828[_0x4b2cc6];return _0x3e0b08;};'use strict';var multer=require(_0x8b82('0x0'));var util=require(_0x8b82('0x1'));var path=require(_0x8b82('0x2'));var timeout=require(_0x8b82('0x3'));var express=require(_0x8b82('0x4'));var router=express[_0x8b82('0x5')]();var fs_extra=require(_0x8b82('0x6'));var auth=require(_0x8b82('0x7'));var interaction=require(_0x8b82('0x8'));var config=require(_0x8b82('0x9'));var controller=require(_0x8b82('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x8b82('0xb')]);router[_0x8b82('0xc')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x8b82('0xc')](_0x8b82('0xd'),auth[_0x8b82('0xe')](),controller[_0x8b82('0xf')]);router[_0x8b82('0xc')](_0x8b82('0x10'),auth[_0x8b82('0xe')](),controller[_0x8b82('0x11')]);router[_0x8b82('0xc')]('/:id/download',auth[_0x8b82('0xe')](),controller[_0x8b82('0x12')]);router[_0x8b82('0x13')]('/',auth['isAuthenticated'](),controller[_0x8b82('0x14')]);router['post'](_0x8b82('0x10'),auth[_0x8b82('0xe')](),controller[_0x8b82('0x15')]);router[_0x8b82('0x13')](_0x8b82('0x16'),auth['isAuthenticated'](),interaction[_0x8b82('0x17')](_0x8b82('0x18'),'faxinteraction:addtags'),controller[_0x8b82('0x19')]);router['put'](_0x8b82('0xd'),auth[_0x8b82('0xe')](),interaction['tracked'](_0x8b82('0x18'),'faxinteraction:update'),controller[_0x8b82('0x1a')]);router[_0x8b82('0x1b')](_0x8b82('0xd'),auth[_0x8b82('0xe')](),interaction[_0x8b82('0x17')](_0x8b82('0x18'),'faxinteraction:destroy'),controller[_0x8b82('0x1c')]);router[_0x8b82('0x1b')](_0x8b82('0x16'),auth['isAuthenticated'](),controller[_0x8b82('0x1d')]);module[_0x8b82('0x1e')]=router; \ No newline at end of file +var _0x1775=['post','addMessage','tracked','fax','faxinteraction:addtags','addTags','update','delete','faxinteraction:destroy','destroy','/:id/tags','removeTags','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','index','get','/describe','isAuthenticated','/:id','/:id/messages','getMessages','/:id/download','download','create'];(function(_0x18d344,_0x5a8f0b){var _0x1d9e02=function(_0x185aa0){while(--_0x185aa0){_0x18d344['push'](_0x18d344['shift']());}};_0x1d9e02(++_0x5a8f0b);}(_0x1775,0x16d));var _0x5177=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x1775[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5177('0x0'));var timeout=require(_0x5177('0x1'));var express=require(_0x5177('0x2'));var router=express[_0x5177('0x3')]();var fs_extra=require(_0x5177('0x4'));var auth=require(_0x5177('0x5'));var interaction=require(_0x5177('0x6'));var config=require(_0x5177('0x7'));var controller=require(_0x5177('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x5177('0x9')]);router[_0x5177('0xa')](_0x5177('0xb'),auth[_0x5177('0xc')](),controller['describe']);router[_0x5177('0xa')](_0x5177('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x5177('0xa')](_0x5177('0xe'),auth[_0x5177('0xc')](),controller[_0x5177('0xf')]);router[_0x5177('0xa')](_0x5177('0x10'),auth[_0x5177('0xc')](),controller[_0x5177('0x11')]);router['post']('/',auth[_0x5177('0xc')](),controller[_0x5177('0x12')]);router[_0x5177('0x13')](_0x5177('0xe'),auth[_0x5177('0xc')](),controller[_0x5177('0x14')]);router[_0x5177('0x13')]('/:id/tags',auth[_0x5177('0xc')](),interaction[_0x5177('0x15')](_0x5177('0x16'),_0x5177('0x17')),controller[_0x5177('0x18')]);router['put'](_0x5177('0xd'),auth[_0x5177('0xc')](),interaction[_0x5177('0x15')](_0x5177('0x16'),'faxinteraction:update'),controller[_0x5177('0x19')]);router[_0x5177('0x1a')](_0x5177('0xd'),auth[_0x5177('0xc')](),interaction[_0x5177('0x15')](_0x5177('0x16'),_0x5177('0x1b')),controller[_0x5177('0x1c')]);router[_0x5177('0x1a')](_0x5177('0x1d'),auth[_0x5177('0xc')](),controller[_0x5177('0x1e')]);module[_0x5177('0x1f')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 8f5a5b6..16e4514 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 _0x4a81=['DATE','sequelize','exports','TEXT','medium','out'];(function(_0x42ac20,_0x21a33b){var _0x5a7862=function(_0x36a3ec){while(--_0x36a3ec){_0x42ac20['push'](_0x42ac20['shift']());}};_0x5a7862(++_0x21a33b);}(_0x4a81,0x1b7));var _0x14a8=function(_0x1a8627,_0x534868){_0x1a8627=_0x1a8627-0x0;var _0x33073f=_0x4a81[_0x1a8627];return _0x33073f;};'use strict';var Sequelize=require(_0x14a8('0x0'));module[_0x14a8('0x1')]={'body':{'type':Sequelize[_0x14a8('0x2')](_0x14a8('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x14a8('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x14a8('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x14a8('0x5')]}}; \ No newline at end of file +var _0x5089=['out','DATE','sequelize','exports','medium','BOOLEAN','ENUM'];(function(_0xd73239,_0x488346){var _0x41cee6=function(_0x4a8bb3){while(--_0x4a8bb3){_0xd73239['push'](_0xd73239['shift']());}};_0x41cee6(++_0x488346);}(_0x5089,0x1bb));var _0x9508=function(_0x5ebc04,_0x14a363){_0x5ebc04=_0x5ebc04-0x0;var _0x17845c=_0x5089[_0x5ebc04];return _0x17845c;};'use strict';var Sequelize=require(_0x9508('0x0'));module[_0x9508('0x1')]={'body':{'type':Sequelize['TEXT'](_0x9508('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x9508('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9508('0x4')]('in',_0x9508('0x5')),'defaultValue':_0x9508('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x9508('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index daf95b7..16fcfe7 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 _0xa638=['code','error','FaxMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','destroy','stack','name','send','map','FaxMessage','rawAttributes','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows','show','include','body','params','describe','../../config/logger','fax-interactions','accept','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','find','FaxInteractionId','update','read1stAt','interaction','get','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','sequelize','QueryTypes','SELECT','contact','motionChannel','rejectmessage','create','findOne','isNil','Attachment','AttachmentId','SendFax','download','join','root','server','files','attachments','basename','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3822cc,_0x37bfb0){var _0x17c40a=function(_0x55a670){while(--_0x55a670){_0x3822cc['push'](_0x3822cc['shift']());}};_0x17c40a(++_0x37bfb0);}(_0xa638,0x196));var _0x8a63=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xa638[_0x1969a7];return _0x3d665f;};'use strict';var emlformat=require(_0x8a63('0x0'));var rimraf=require(_0x8a63('0x1'));var zipdir=require(_0x8a63('0x2'));var jsonpatch=require(_0x8a63('0x3'));var rp=require(_0x8a63('0x4'));var moment=require(_0x8a63('0x5'));var BPromise=require(_0x8a63('0x6'));var Mustache=require(_0x8a63('0x7'));var util=require(_0x8a63('0x8'));var path=require(_0x8a63('0x9'));var sox=require(_0x8a63('0xa'));var csv=require(_0x8a63('0xb'));var ejs=require(_0x8a63('0xc'));var fs=require('fs');var fs_extra=require(_0x8a63('0xd'));var _=require('lodash');var squel=require(_0x8a63('0xe'));var crypto=require(_0x8a63('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x8a63('0x10'));var toCsv=require(_0x8a63('0xb'));var querystring=require(_0x8a63('0x11'));var Papa=require(_0x8a63('0x12'));var Redis=require(_0x8a63('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x8a63('0x14'));var as=require(_0x8a63('0x15'));var hardwareService=require(_0x8a63('0x16'));var logger=require('../../config/logger')(_0x8a63('0x17'));var utils=require(_0x8a63('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x8a63('0x19')]=_[_0x8a63('0x1a')](config[_0x8a63('0x19')],{'host':_0x8a63('0x1b'),'port':0x18eb});var socket=require(_0x8a63('0x1c'))(new Redis(config[_0x8a63('0x19')]));require(_0x8a63('0x1d'))[_0x8a63('0x1e')](socket);var jayson=require(_0x8a63('0x1f'));var client=jayson[_0x8a63('0x20')]['http']({'port':0x232c});var client9002=jayson[_0x8a63('0x20')][_0x8a63('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x5c51e3,_0x330208,_0x4c7b59,_0xc74fb6){return new BPromise(function(_0x571c7b,_0x12ca19){var _0x10ef75=_0xc74fb6||client;return _0x10ef75[_0x8a63('0x22')](_0x5c51e3,_0x4c7b59)[_0x8a63('0x23')](function(_0x2979e9){logger[_0x8a63('0x24')]('FaxMessage,\x20%s,\x20%s',_0x330208,_0x8a63('0x25'));logger[_0x8a63('0x26')](_0x8a63('0x27'),_0x330208,_0x8a63('0x25'),JSON[_0x8a63('0x28')](_0x2979e9));if(_0x2979e9['error']){if(_0x2979e9['error'][_0x8a63('0x29')]===0x1f4){logger[_0x8a63('0x2a')](_0x8a63('0x2b'),_0x330208,_0x2979e9[_0x8a63('0x2a')][_0x8a63('0x2c')]);return _0x12ca19(_0x2979e9['error']['message']);}logger[_0x8a63('0x2a')](_0x8a63('0x2b'),_0x330208,_0x2979e9[_0x8a63('0x2a')]['message']);return _0x571c7b(_0x2979e9[_0x8a63('0x2a')][_0x8a63('0x2c')]);}else{logger[_0x8a63('0x24')]('FaxMessage,\x20%s,\x20%s',_0x330208,'request\x20sent');_0x571c7b(_0x2979e9[_0x8a63('0x2d')][_0x8a63('0x2c')]);}})[_0x8a63('0x2e')](function(_0x4878e4){logger[_0x8a63('0x2a')](_0x8a63('0x2b'),_0x330208,_0x4878e4);_0x12ca19(_0x4878e4);});});}function respondWithStatusCode(_0x25165c,_0x3aafc6){_0x3aafc6=_0x3aafc6||0xcc;return function(_0x3d1608){if(_0x3d1608){return _0x25165c[_0x8a63('0x2f')](_0x3aafc6);}return _0x25165c[_0x8a63('0x30')](_0x3aafc6)[_0x8a63('0x31')]();};}function respondWithResult(_0x12c9f3,_0x14310b){_0x14310b=_0x14310b||0xc8;return function(_0x57dbdf){if(_0x57dbdf){return _0x12c9f3[_0x8a63('0x30')](_0x14310b)[_0x8a63('0x32')](_0x57dbdf);}};}function respondWithFilteredResult(_0x52cdc2,_0x1f7c23){return function(_0x1c1240){if(_0x1c1240){var _0x1b985b=typeof _0x1f7c23[_0x8a63('0x33')]===_0x8a63('0x34')&&typeof _0x1f7c23['limit']===_0x8a63('0x34');var _0x2f563b=_0x1c1240[_0x8a63('0x35')];var _0x27a2bb=_0x1b985b?0x0:_0x1f7c23['offset'];var _0x523880=_0x1b985b?_0x1c1240[_0x8a63('0x35')]:_0x1f7c23[_0x8a63('0x33')]+_0x1f7c23[_0x8a63('0x36')];var _0x177072;if(_0x523880>=_0x2f563b){_0x523880=_0x2f563b;_0x177072=0xc8;}else{_0x177072=0xce;}_0x52cdc2[_0x8a63('0x30')](_0x177072);return _0x52cdc2[_0x8a63('0x37')](_0x8a63('0x38'),_0x27a2bb+'-'+_0x523880+'/'+_0x2f563b)['json'](_0x1c1240);}return null;};}function patchUpdates(_0x1375c1){return function(_0x5daef2){try{jsonpatch['apply'](_0x5daef2,_0x1375c1,!![]);}catch(_0x30c646){return BPromise[_0x8a63('0x39')](_0x30c646);}return _0x5daef2[_0x8a63('0x3a')]();};}function saveUpdates(_0x5bef6c,_0x2a9ae5){return function(_0x2f5dcb){if(_0x2f5dcb){return _0x2f5dcb['update'](_0x5bef6c)['then'](function(_0x523e09){return _0x523e09;});}return null;};}function removeEntity(_0x29173f,_0x53d3c4){return function(_0x3a97a1){if(_0x3a97a1){return _0x3a97a1[_0x8a63('0x3b')]()[_0x8a63('0x23')](function(){_0x29173f[_0x8a63('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x321aa2,_0x239ce6){return function(_0x101c9b){if(!_0x101c9b){_0x321aa2['sendStatus'](0x194);}return _0x101c9b;};}function handleError(_0x4c9753,_0x496b40){_0x496b40=_0x496b40||0x1f4;return function(_0x4393d2){logger[_0x8a63('0x2a')](_0x4393d2[_0x8a63('0x3c')]);if(_0x4393d2[_0x8a63('0x3d')]){delete _0x4393d2[_0x8a63('0x3d')];}_0x4c9753['status'](_0x496b40)[_0x8a63('0x3e')](_0x4393d2);};}exports['index']=function(_0x13928d,_0xe72cac){var _0x25e6eb={},_0x250ef2={},_0x2474e5={'count':0x0,'rows':[]};var _0x5db382=_[_0x8a63('0x3f')](db[_0x8a63('0x40')][_0x8a63('0x41')],function(_0x502958){return{'name':_0x502958['fieldName'],'type':_0x502958[_0x8a63('0x42')][_0x8a63('0x43')]};});_0x250ef2[_0x8a63('0x44')]=_['map'](_0x5db382,'name');_0x250ef2['query']=_[_0x8a63('0x45')](_0x13928d[_0x8a63('0x46')]);_0x250ef2['filters']=_[_0x8a63('0x47')](_0x250ef2['model'],_0x250ef2[_0x8a63('0x46')]);_0x25e6eb['attributes']=_[_0x8a63('0x47')](_0x250ef2[_0x8a63('0x44')],qs[_0x8a63('0x48')](_0x13928d[_0x8a63('0x46')][_0x8a63('0x48')]));_0x25e6eb[_0x8a63('0x49')]=_0x25e6eb[_0x8a63('0x49')][_0x8a63('0x4a')]?_0x25e6eb['attributes']:_0x250ef2[_0x8a63('0x44')];if(!_0x13928d[_0x8a63('0x46')][_0x8a63('0x4b')](_0x8a63('0x4c'))){_0x25e6eb[_0x8a63('0x36')]=qs[_0x8a63('0x36')](_0x13928d[_0x8a63('0x46')]['limit']);_0x25e6eb['offset']=qs[_0x8a63('0x33')](_0x13928d['query'][_0x8a63('0x33')]);}_0x25e6eb[_0x8a63('0x4d')]=qs['sort'](_0x13928d[_0x8a63('0x46')][_0x8a63('0x4e')]);_0x25e6eb[_0x8a63('0x4f')]=qs[_0x8a63('0x50')](_[_0x8a63('0x51')](_0x13928d[_0x8a63('0x46')],_0x250ef2[_0x8a63('0x50')]),_0x5db382);if(_0x13928d[_0x8a63('0x46')][_0x8a63('0x52')]){_0x25e6eb[_0x8a63('0x4f')]=_['merge'](_0x25e6eb[_0x8a63('0x4f')],{'$or':_[_0x8a63('0x3f')](_0x5db382,function(_0x4665d6){if(_0x4665d6[_0x8a63('0x42')]!=='VIRTUAL'){var _0x199579={};_0x199579[_0x4665d6[_0x8a63('0x3d')]]={'$like':'%'+_0x13928d[_0x8a63('0x46')]['filter']+'%'};return _0x199579;}})});}_0x25e6eb=_[_0x8a63('0x53')]({},_0x25e6eb,_0x13928d[_0x8a63('0x54')]);var _0x269ad9={'where':_0x25e6eb[_0x8a63('0x4f')]};return db[_0x8a63('0x40')][_0x8a63('0x35')](_0x269ad9)[_0x8a63('0x23')](function(_0x4645e2){_0x2474e5[_0x8a63('0x35')]=_0x4645e2;if(_0x13928d[_0x8a63('0x46')][_0x8a63('0x55')]){_0x25e6eb['include']=[{'all':!![]}];}return db[_0x8a63('0x40')][_0x8a63('0x56')](_0x25e6eb);})[_0x8a63('0x23')](function(_0x3b86eb){_0x2474e5[_0x8a63('0x57')]=_0x3b86eb;return _0x2474e5;})['then'](respondWithFilteredResult(_0xe72cac,_0x25e6eb))[_0x8a63('0x2e')](handleError(_0xe72cac,null));};exports[_0x8a63('0x58')]=function(_0x493386,_0x549da6){var _0x464f45={'raw':!![],'where':{'id':_0x493386['params']['id']}},_0x23de2a={};_0x23de2a['model']=_[_0x8a63('0x45')](db[_0x8a63('0x40')]['rawAttributes']);_0x23de2a[_0x8a63('0x46')]=_[_0x8a63('0x45')](_0x493386['query']);_0x23de2a[_0x8a63('0x50')]=_['intersection'](_0x23de2a[_0x8a63('0x44')],_0x23de2a['query']);_0x464f45['attributes']=_[_0x8a63('0x47')](_0x23de2a[_0x8a63('0x44')],qs[_0x8a63('0x48')](_0x493386[_0x8a63('0x46')][_0x8a63('0x48')]));_0x464f45['attributes']=_0x464f45['attributes'][_0x8a63('0x4a')]?_0x464f45[_0x8a63('0x49')]:_0x23de2a[_0x8a63('0x44')];if(_0x493386[_0x8a63('0x46')][_0x8a63('0x55')]){_0x464f45[_0x8a63('0x59')]=[{'all':!![]}];}_0x464f45=_[_0x8a63('0x53')]({},_0x464f45,_0x493386[_0x8a63('0x54')]);return db['FaxMessage']['find'](_0x464f45)[_0x8a63('0x23')](handleEntityNotFound(_0x549da6,null))[_0x8a63('0x23')](respondWithResult(_0x549da6,null))[_0x8a63('0x2e')](handleError(_0x549da6,null));};exports['update']=function(_0x46a4d8,_0x33edb3){if(_0x46a4d8[_0x8a63('0x5a')]['id']){delete _0x46a4d8['body']['id'];}return db[_0x8a63('0x40')]['find']({'where':{'id':_0x46a4d8[_0x8a63('0x5b')]['id']}})['then'](handleEntityNotFound(_0x33edb3,null))[_0x8a63('0x23')](saveUpdates(_0x46a4d8[_0x8a63('0x5a')],null))[_0x8a63('0x23')](respondWithResult(_0x33edb3,null))[_0x8a63('0x2e')](handleError(_0x33edb3,null));};exports[_0x8a63('0x3b')]=function(_0x53b99f,_0x16aef4){return db[_0x8a63('0x40')]['find']({'where':{'id':_0x53b99f[_0x8a63('0x5b')]['id']}})[_0x8a63('0x23')](handleEntityNotFound(_0x16aef4,null))[_0x8a63('0x23')](removeEntity(_0x16aef4,null))[_0x8a63('0x2e')](handleError(_0x16aef4,null));};exports[_0x8a63('0x5c')]=function(_0x7645d4,_0xa3604b){return db['FaxMessage'][_0x8a63('0x5c')]()[_0x8a63('0x23')](respondWithResult(_0xa3604b,null))[_0x8a63('0x2e')](handleError(_0xa3604b,null));};var interaction_log=require(_0x8a63('0x5d'))(_0x8a63('0x5e'));exports[_0x8a63('0x5f')]=function(_0x947c0c,_0x122e80,_0x36efd7){var _0x3ea8da={'agent':{},'channel':_0x8a63('0x60')};if(_0x947c0c[_0x8a63('0x5a')]['id']){delete _0x947c0c[_0x8a63('0x5a')]['id'];}_0x947c0c[_0x8a63('0x5a')][_0x8a63('0x61')]=!![];_0x947c0c[_0x8a63('0x5a')]['readAt']=moment()[_0x8a63('0x62')](_0x8a63('0x63'));_0x947c0c[_0x8a63('0x5a')][_0x8a63('0x64')]=_0x947c0c[_0x8a63('0x5a')]['UserId']||_0x947c0c[_0x8a63('0x65')]['id'];_0x3ea8da[_0x8a63('0x66')]['id']=_0x947c0c['body'][_0x8a63('0x64')];return db[_0x8a63('0x40')][_0x8a63('0x67')]({'where':{'id':_0x947c0c[_0x8a63('0x5b')]['id'],'UserId':null}})[_0x8a63('0x23')](handleEntityNotFound(_0x122e80,null))['then'](saveUpdates(_0x947c0c[_0x8a63('0x5a')],null))['then'](function(_0x40521a){if(_0x40521a){_0x3ea8da[_0x8a63('0x2c')]=_0x40521a['get']({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x40521a[_0x8a63('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x122e80,null))[_0x8a63('0x23')](function(_0x20a69f){if(_0x20a69f){return _0x20a69f[_0x8a63('0x69')]({'UserId':_0x947c0c[_0x8a63('0x5a')][_0x8a63('0x64')],'read1stAt':_['isNil'](_0x20a69f[_0x8a63('0x6a')])?moment()[_0x8a63('0x62')](_0x8a63('0x63')):undefined});}return null;})[_0x8a63('0x23')](function(_0x298431){if(_0x298431){_0x3ea8da[_0x8a63('0x6b')]=_0x298431[_0x8a63('0x6c')]({'plain':!![]});interaction_log[_0x8a63('0x24')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x947c0c[_0x8a63('0x65')]['id'],_0x947c0c['user'][_0x8a63('0x3d')],_0x947c0c[_0x8a63('0x65')][_0x8a63('0x6d')],_0x3ea8da[_0x8a63('0x6b')]['id'],_0x947c0c['body']?JSON[_0x8a63('0x28')](_0x947c0c[_0x8a63('0x5a')]):'null');return respondWithRpcPromise(_0x8a63('0x6e'),_0x8a63('0x6f'),_0x3ea8da);}return null;})[_0x8a63('0x23')](function(_0x4d7fef){var _0xe038f2=_0x8a63('0x70')+_0x4d7fef[_0x8a63('0x2c')][_0x8a63('0x71')];return db['sequelize'][_0x8a63('0x46')](_0xe038f2,{'type':db[_0x8a63('0x72')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x45315e){return _0x45315e;});})[_0x8a63('0x23')](function(_0x1fd250){if(_0x1fd250){_0x3ea8da[_0x8a63('0x2c')]['contact']=_0x1fd250[0x0];if(!_0x947c0c[_0x8a63('0x5a')][_0x8a63('0x64')])return;return db[_0x8a63('0x73')][_0x8a63('0x67')]({'where':{'id':_0x947c0c[_0x8a63('0x5a')][_0x8a63('0x64')],'role':'agent'},'attributes':['id',_0x8a63('0x3d'),_0x8a63('0x74'),_0x8a63('0x75'),_0x8a63('0x76')],'raw':!![]});}return null;})[_0x8a63('0x23')](function(_0x3887d2){if(!_0x3887d2)return null;_0x3ea8da[_0x8a63('0x2c')]['agent']=_0x3887d2;return _0x3ea8da;})[_0x8a63('0x23')](function(_0x1e0bfa){if(_0x1e0bfa){if(_0x947c0c[_0x8a63('0x5a')][_0x8a63('0x77')]){_0x3ea8da[_0x8a63('0x2c')][_0x8a63('0x78')]=util[_0x8a63('0x62')](_0x8a63('0x79'),_0x947c0c[_0x8a63('0x65')][_0x8a63('0x3d')]);_0x3ea8da[_0x8a63('0x2c')][_0x8a63('0x7a')]=_0x3ea8da['channel'];_0x3ea8da[_0x8a63('0x2c')]['motionChannel']=_0x3ea8da[_0x8a63('0x7a')];_0x3ea8da[_0x8a63('0x2c')][_0x8a63('0x7b')]=_0x8a63('0x5f');return respondWithRpcPromise(_0x8a63('0x7c'),_0x8a63('0x7c'),{'event':_0x8a63('0x7d'),'message':_0x3ea8da[_0x8a63('0x2c')]},client9002)[_0x8a63('0x23')](function(){return _0x3ea8da;});}return _0x3ea8da;}return null;})[_0x8a63('0x23')](respondWithResult(_0x122e80,null))[_0x8a63('0x2e')](handleError(_0x122e80,null));};var interaction_log=require(_0x8a63('0x5d'))(_0x8a63('0x5e'));exports[_0x8a63('0x39')]=function(_0x37216d,_0x278b25,_0x3c4247){var _0x36db6b={'agent':{},'channel':_0x8a63('0x60')};if(_0x37216d[_0x8a63('0x5a')]['id']){delete _0x37216d[_0x8a63('0x5a')]['id'];}_0x37216d[_0x8a63('0x5a')][_0x8a63('0x64')]=_0x37216d['body'][_0x8a63('0x64')]||_0x37216d[_0x8a63('0x65')]['id'];_0x36db6b[_0x8a63('0x66')]['id']=_0x37216d[_0x8a63('0x5a')]['UserId'];return db[_0x8a63('0x40')][_0x8a63('0x67')]({'where':{'id':_0x37216d[_0x8a63('0x5b')]['id'],'UserId':null}})[_0x8a63('0x23')](handleEntityNotFound(_0x278b25,null))[_0x8a63('0x23')](function(_0x314f0c){if(_0x314f0c){_0x36db6b[_0x8a63('0x2c')]=_0x314f0c['get']({'plain':!![]});return db[_0x8a63('0x7e')][_0x8a63('0x67')]({'where':{'id':_0x314f0c[_0x8a63('0x68')]}});}return null;})[_0x8a63('0x23')](handleEntityNotFound(_0x278b25,null))[_0x8a63('0x23')](function(_0x37d378){if(_0x37d378){_0x36db6b[_0x8a63('0x6b')]=_0x37d378[_0x8a63('0x6c')]({'plain':!![]});interaction_log[_0x8a63('0x24')](_0x8a63('0x7f'),_0x37216d[_0x8a63('0x65')]['id'],_0x37216d[_0x8a63('0x65')][_0x8a63('0x3d')],_0x37216d[_0x8a63('0x65')][_0x8a63('0x6d')],_0x36db6b[_0x8a63('0x6b')]['id'],_0x37216d['body']?JSON[_0x8a63('0x28')](_0x37216d[_0x8a63('0x5a')]):_0x8a63('0x80'));return respondWithRpcPromise(_0x8a63('0x81'),'rejectMessage',_0x36db6b);}return null;})[_0x8a63('0x23')](function(_0x56c326){var _0x2f9275='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x56c326[_0x8a63('0x2c')][_0x8a63('0x71')];return db[_0x8a63('0x82')][_0x8a63('0x46')](_0x2f9275,{'type':db[_0x8a63('0x72')][_0x8a63('0x83')][_0x8a63('0x84')],'raw':!![]})['then'](function(_0x7a83cf){return _0x7a83cf;});})[_0x8a63('0x23')](function(_0x498fcf){if(_0x498fcf){_0x36db6b[_0x8a63('0x2c')][_0x8a63('0x85')]=_0x498fcf[0x0];if(!_0x37216d[_0x8a63('0x5a')][_0x8a63('0x64')])return;return db[_0x8a63('0x73')][_0x8a63('0x67')]({'where':{'id':_0x37216d[_0x8a63('0x5a')][_0x8a63('0x64')],'role':_0x8a63('0x66')},'attributes':['id',_0x8a63('0x3d'),_0x8a63('0x74'),'email','internal'],'raw':!![]});}return null;})[_0x8a63('0x23')](function(_0x5c5b70){if(!_0x5c5b70)return null;_0x36db6b[_0x8a63('0x2c')]['agent']=_0x5c5b70;return _0x36db6b;})[_0x8a63('0x23')](function(_0x33113f){if(_0x33113f){_0x33113f[_0x8a63('0x2c')]['interface']=util[_0x8a63('0x62')](_0x8a63('0x79'),_0x37216d[_0x8a63('0x65')][_0x8a63('0x3d')]);_0x33113f[_0x8a63('0x2c')][_0x8a63('0x7a')]=_0x36db6b['channel'];_0x33113f[_0x8a63('0x2c')][_0x8a63('0x86')]=_0x36db6b[_0x8a63('0x7a')];_0x33113f[_0x8a63('0x2c')]['event']='reject';respondWithRpcPromise(_0x8a63('0x7c'),'EventManager',{'event':_0x8a63('0x87'),'message':_0x33113f[_0x8a63('0x2c')]},client9002);return _0x36db6b;}return null;})[_0x8a63('0x23')](respondWithResult(_0x278b25,null))['catch'](handleError(_0x278b25,null));};exports[_0x8a63('0x88')]=function(_0xca203d,_0x1a108c){var _0x3f64ff;return db[_0x8a63('0x40')]['create'](_0xca203d[_0x8a63('0x5a')],{})[_0x8a63('0x23')](function(_0x51a64c){_0x3f64ff=_0x51a64c;return db['CmContact'][_0x8a63('0x89')]({'where':{'id':_0x3f64ff[_0x8a63('0x71')]}});})[_0x8a63('0x23')](function(_0x34b651){if(_[_0x8a63('0x8a')](_0x34b651)){return;}else{_0x3f64ff[_0x8a63('0x60')]=_0x34b651[_0x8a63('0x60')];return db[_0x8a63('0x8b')][_0x8a63('0x89')]({'where':{'id':_0x3f64ff[_0x8a63('0x8c')]}});}})[_0x8a63('0x23')](function(_0x956053){return respondWithRpcPromise(_0x8a63('0x8d'),_0x8a63('0x8d'),{'FaxAccountId':_[_0x8a63('0x8a')](_0xca203d['body'])?undefined:_0xca203d['body']['FaxAccountId'],'path':_[_0x8a63('0x8a')](_0x956053)?undefined:util[_0x8a63('0x62')]('/var/opt/motion2/server/files/attachments/%s',_0x956053['basename']),'fax':_[_0x8a63('0x8a')](_0x3f64ff[_0x8a63('0x60')])?undefined:_0x3f64ff['fax'],'AttachmentId':_0x3f64ff[_0x8a63('0x8c')]},client9002);})['then'](respondWithResult(_0x1a108c,0xc9))['catch'](handleError(_0x1a108c,null));};exports[_0x8a63('0x8e')]=function(_0x70df61,_0x140c88){var _0x41e545=path[_0x8a63('0x8f')](config[_0x8a63('0x90')],_0x8a63('0x91'),_0x8a63('0x92'),_0x8a63('0x93'));return db[_0x8a63('0x40')][_0x8a63('0x67')]({'where':{'id':_0x70df61['params']['id']},'include':[{'model':db[_0x8a63('0x8b')],'as':'Attachment'}]})[_0x8a63('0x23')](handleEntityNotFound(_0x140c88,null))[_0x8a63('0x23')](function(_0x2125c3){if(_0x2125c3){return _0x140c88[_0x8a63('0x8e')](path['join'](_0x41e545,_0x2125c3['Attachment'][_0x8a63('0x94')]));}})[_0x8a63('0x2e')](handleError(_0x140c88,null));}; \ No newline at end of file +var _0x15af=['update','body','describe','../../config/logger','fax-interactions','accept','fax','read','format','UserId','user','agent','get','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','QueryTypes','SELECT','contact','User','email','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','FaxInteraction','FaxInteractionId','RejectMessage','rejectMessage','Sequelize','fullname','internal','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','files','attachments','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','client','http','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','includeAll','findAll','rows','params','include','options','find'];(function(_0x3b2397,_0x4d52e8){var _0x4a81ea=function(_0xf92c9e){while(--_0xf92c9e){_0x3b2397['push'](_0x3b2397['shift']());}};_0x4a81ea(++_0x4d52e8);}(_0x15af,0xc8));var _0xf15a=function(_0x59eefb,_0x2151ce){_0x59eefb=_0x59eefb-0x0;var _0x1a49e8=_0x15af[_0x59eefb];return _0x1a49e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf15a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf15a('0x1'));var rp=require(_0xf15a('0x2'));var moment=require(_0xf15a('0x3'));var BPromise=require(_0xf15a('0x4'));var Mustache=require(_0xf15a('0x5'));var util=require(_0xf15a('0x6'));var path=require(_0xf15a('0x7'));var sox=require('sox');var csv=require(_0xf15a('0x8'));var ejs=require(_0xf15a('0x9'));var fs=require('fs');var fs_extra=require(_0xf15a('0xa'));var _=require(_0xf15a('0xb'));var squel=require(_0xf15a('0xc'));var crypto=require(_0xf15a('0xd'));var jsforce=require(_0xf15a('0xe'));var deskjs=require(_0xf15a('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf15a('0x10'));var Papa=require(_0xf15a('0x11'));var Redis=require(_0xf15a('0x12'));var authService=require(_0xf15a('0x13'));var qs=require(_0xf15a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf15a('0x15'));var logger=require('../../config/logger')(_0xf15a('0x16'));var utils=require(_0xf15a('0x17'));var config=require(_0xf15a('0x18'));var licenseUtil=require(_0xf15a('0x19'));var db=require('../../mysqldb')['db'];config[_0xf15a('0x1a')]=_[_0xf15a('0x1b')](config[_0xf15a('0x1a')],{'host':_0xf15a('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf15a('0x1a')]));require('./faxMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xf15a('0x1d')][_0xf15a('0x1e')]({'port':0x232c});var client9002=jayson[_0xf15a('0x1d')][_0xf15a('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2801fe,_0x37e946,_0x2a1ab0,_0x5b0944){return new BPromise(function(_0x63b26d,_0x5882a4){var _0x3c4763=_0x5b0944||client;return _0x3c4763[_0xf15a('0x1f')](_0x2801fe,_0x2a1ab0)['then'](function(_0x460029){logger[_0xf15a('0x20')](_0xf15a('0x21'),_0x37e946,_0xf15a('0x22'));logger[_0xf15a('0x23')](_0xf15a('0x24'),_0x37e946,_0xf15a('0x22'),JSON[_0xf15a('0x25')](_0x460029));if(_0x460029[_0xf15a('0x26')]){if(_0x460029[_0xf15a('0x26')][_0xf15a('0x27')]===0x1f4){logger['error'](_0xf15a('0x21'),_0x37e946,_0x460029[_0xf15a('0x26')][_0xf15a('0x28')]);return _0x5882a4(_0x460029[_0xf15a('0x26')][_0xf15a('0x28')]);}logger[_0xf15a('0x26')](_0xf15a('0x21'),_0x37e946,_0x460029[_0xf15a('0x26')][_0xf15a('0x28')]);return _0x63b26d(_0x460029[_0xf15a('0x26')][_0xf15a('0x28')]);}else{logger[_0xf15a('0x20')]('FaxMessage,\x20%s,\x20%s',_0x37e946,_0xf15a('0x22'));_0x63b26d(_0x460029[_0xf15a('0x29')]['message']);}})[_0xf15a('0x2a')](function(_0x3004cd){logger[_0xf15a('0x26')](_0xf15a('0x21'),_0x37e946,_0x3004cd);_0x5882a4(_0x3004cd);});});}function respondWithStatusCode(_0x4949f2,_0x1b4610){_0x1b4610=_0x1b4610||0xcc;return function(_0x32c73b){if(_0x32c73b){return _0x4949f2[_0xf15a('0x2b')](_0x1b4610);}return _0x4949f2[_0xf15a('0x2c')](_0x1b4610)[_0xf15a('0x2d')]();};}function respondWithResult(_0x357f6a,_0x45c740){_0x45c740=_0x45c740||0xc8;return function(_0x500aa1){if(_0x500aa1){return _0x357f6a[_0xf15a('0x2c')](_0x45c740)[_0xf15a('0x2e')](_0x500aa1);}};}function respondWithFilteredResult(_0x547fb4,_0x4bc4eb){return function(_0x4a1a4c){if(_0x4a1a4c){var _0x4951fb=typeof _0x4bc4eb[_0xf15a('0x2f')]===_0xf15a('0x30')&&typeof _0x4bc4eb[_0xf15a('0x31')]===_0xf15a('0x30');var _0x5a3765=_0x4a1a4c['count'];var _0x1275be=_0x4951fb?0x0:_0x4bc4eb['offset'];var _0x5e0353=_0x4951fb?_0x4a1a4c[_0xf15a('0x32')]:_0x4bc4eb[_0xf15a('0x2f')]+_0x4bc4eb[_0xf15a('0x31')];var _0x58eb41;if(_0x5e0353>=_0x5a3765){_0x5e0353=_0x5a3765;_0x58eb41=0xc8;}else{_0x58eb41=0xce;}_0x547fb4[_0xf15a('0x2c')](_0x58eb41);return _0x547fb4[_0xf15a('0x33')](_0xf15a('0x34'),_0x1275be+'-'+_0x5e0353+'/'+_0x5a3765)['json'](_0x4a1a4c);}return null;};}function patchUpdates(_0x19d65d){return function(_0x27d5a3){try{jsonpatch[_0xf15a('0x35')](_0x27d5a3,_0x19d65d,!![]);}catch(_0x31b8dd){return BPromise[_0xf15a('0x36')](_0x31b8dd);}return _0x27d5a3[_0xf15a('0x37')]();};}function saveUpdates(_0x4b97e0,_0x203494){return function(_0x25cac3){if(_0x25cac3){return _0x25cac3['update'](_0x4b97e0)[_0xf15a('0x38')](function(_0x513839){return _0x513839;});}return null;};}function removeEntity(_0x3b3abd,_0x35b4df){return function(_0x5a3e47){if(_0x5a3e47){return _0x5a3e47[_0xf15a('0x39')]()['then'](function(){_0x3b3abd[_0xf15a('0x2c')](0xcc)[_0xf15a('0x2d')]();});}};}function handleEntityNotFound(_0x223e7d,_0x4f19b3){return function(_0x2b1b9b){if(!_0x2b1b9b){_0x223e7d[_0xf15a('0x2b')](0x194);}return _0x2b1b9b;};}function handleError(_0x260e35,_0x406231){_0x406231=_0x406231||0x1f4;return function(_0x29d62d){logger[_0xf15a('0x26')](_0x29d62d[_0xf15a('0x3a')]);if(_0x29d62d[_0xf15a('0x3b')]){delete _0x29d62d[_0xf15a('0x3b')];}_0x260e35['status'](_0x406231)[_0xf15a('0x3c')](_0x29d62d);};}exports[_0xf15a('0x3d')]=function(_0x2cfc9c,_0x51661a){var _0x4c6e5e={},_0x320856={},_0x3f890e={'count':0x0,'rows':[]};var _0x592ae4=_[_0xf15a('0x3e')](db[_0xf15a('0x3f')][_0xf15a('0x40')],function(_0x44005f){return{'name':_0x44005f[_0xf15a('0x41')],'type':_0x44005f[_0xf15a('0x42')]['key']};});_0x320856[_0xf15a('0x43')]=_['map'](_0x592ae4,_0xf15a('0x3b'));_0x320856[_0xf15a('0x44')]=_[_0xf15a('0x45')](_0x2cfc9c[_0xf15a('0x44')]);_0x320856[_0xf15a('0x46')]=_[_0xf15a('0x47')](_0x320856[_0xf15a('0x43')],_0x320856['query']);_0x4c6e5e[_0xf15a('0x48')]=_[_0xf15a('0x47')](_0x320856['model'],qs[_0xf15a('0x49')](_0x2cfc9c[_0xf15a('0x44')][_0xf15a('0x49')]));_0x4c6e5e['attributes']=_0x4c6e5e[_0xf15a('0x48')][_0xf15a('0x4a')]?_0x4c6e5e[_0xf15a('0x48')]:_0x320856[_0xf15a('0x43')];if(!_0x2cfc9c[_0xf15a('0x44')][_0xf15a('0x4b')]('nolimit')){_0x4c6e5e[_0xf15a('0x31')]=qs[_0xf15a('0x31')](_0x2cfc9c[_0xf15a('0x44')]['limit']);_0x4c6e5e[_0xf15a('0x2f')]=qs[_0xf15a('0x2f')](_0x2cfc9c[_0xf15a('0x44')]['offset']);}_0x4c6e5e[_0xf15a('0x4c')]=qs[_0xf15a('0x4d')](_0x2cfc9c[_0xf15a('0x44')][_0xf15a('0x4d')]);_0x4c6e5e[_0xf15a('0x4e')]=qs[_0xf15a('0x46')](_['pick'](_0x2cfc9c[_0xf15a('0x44')],_0x320856['filters']),_0x592ae4);if(_0x2cfc9c[_0xf15a('0x44')]['filter']){_0x4c6e5e['where']=_['merge'](_0x4c6e5e[_0xf15a('0x4e')],{'$or':_[_0xf15a('0x3e')](_0x592ae4,function(_0x4b4ef4){if(_0x4b4ef4[_0xf15a('0x42')]!=='VIRTUAL'){var _0x18b473={};_0x18b473[_0x4b4ef4[_0xf15a('0x3b')]]={'$like':'%'+_0x2cfc9c[_0xf15a('0x44')][_0xf15a('0x4f')]+'%'};return _0x18b473;}})});}_0x4c6e5e=_[_0xf15a('0x50')]({},_0x4c6e5e,_0x2cfc9c['options']);var _0x198f77={'where':_0x4c6e5e[_0xf15a('0x4e')]};return db['FaxMessage'][_0xf15a('0x32')](_0x198f77)[_0xf15a('0x38')](function(_0x3fffb8){_0x3f890e[_0xf15a('0x32')]=_0x3fffb8;if(_0x2cfc9c[_0xf15a('0x44')][_0xf15a('0x51')]){_0x4c6e5e['include']=[{'all':!![]}];}return db[_0xf15a('0x3f')][_0xf15a('0x52')](_0x4c6e5e);})['then'](function(_0x596bd3){_0x3f890e[_0xf15a('0x53')]=_0x596bd3;return _0x3f890e;})['then'](respondWithFilteredResult(_0x51661a,_0x4c6e5e))[_0xf15a('0x2a')](handleError(_0x51661a,null));};exports['show']=function(_0x519d40,_0x48a128){var _0x1554af={'raw':!![],'where':{'id':_0x519d40[_0xf15a('0x54')]['id']}},_0x2acd64={};_0x2acd64['model']=_[_0xf15a('0x45')](db[_0xf15a('0x3f')][_0xf15a('0x40')]);_0x2acd64[_0xf15a('0x44')]=_['keys'](_0x519d40[_0xf15a('0x44')]);_0x2acd64[_0xf15a('0x46')]=_[_0xf15a('0x47')](_0x2acd64[_0xf15a('0x43')],_0x2acd64[_0xf15a('0x44')]);_0x1554af[_0xf15a('0x48')]=_['intersection'](_0x2acd64[_0xf15a('0x43')],qs[_0xf15a('0x49')](_0x519d40[_0xf15a('0x44')][_0xf15a('0x49')]));_0x1554af[_0xf15a('0x48')]=_0x1554af[_0xf15a('0x48')][_0xf15a('0x4a')]?_0x1554af[_0xf15a('0x48')]:_0x2acd64[_0xf15a('0x43')];if(_0x519d40[_0xf15a('0x44')]['includeAll']){_0x1554af[_0xf15a('0x55')]=[{'all':!![]}];}_0x1554af=_[_0xf15a('0x50')]({},_0x1554af,_0x519d40[_0xf15a('0x56')]);return db[_0xf15a('0x3f')][_0xf15a('0x57')](_0x1554af)[_0xf15a('0x38')](handleEntityNotFound(_0x48a128,null))[_0xf15a('0x38')](respondWithResult(_0x48a128,null))['catch'](handleError(_0x48a128,null));};exports[_0xf15a('0x58')]=function(_0x5df801,_0x206ac5){if(_0x5df801[_0xf15a('0x59')]['id']){delete _0x5df801[_0xf15a('0x59')]['id'];}return db[_0xf15a('0x3f')]['find']({'where':{'id':_0x5df801[_0xf15a('0x54')]['id']}})['then'](handleEntityNotFound(_0x206ac5,null))[_0xf15a('0x38')](saveUpdates(_0x5df801[_0xf15a('0x59')],null))['then'](respondWithResult(_0x206ac5,null))[_0xf15a('0x2a')](handleError(_0x206ac5,null));};exports[_0xf15a('0x39')]=function(_0x25ee16,_0x20d5d2){return db['FaxMessage']['find']({'where':{'id':_0x25ee16[_0xf15a('0x54')]['id']}})[_0xf15a('0x38')](handleEntityNotFound(_0x20d5d2,null))[_0xf15a('0x38')](removeEntity(_0x20d5d2,null))['catch'](handleError(_0x20d5d2,null));};exports[_0xf15a('0x5a')]=function(_0x2bd814,_0x257d7a){return db[_0xf15a('0x3f')][_0xf15a('0x5a')]()[_0xf15a('0x38')](respondWithResult(_0x257d7a,null))[_0xf15a('0x2a')](handleError(_0x257d7a,null));};var interaction_log=require(_0xf15a('0x5b'))(_0xf15a('0x5c'));exports[_0xf15a('0x5d')]=function(_0x5c4643,_0x30008f,_0x14b4e6){var _0x584942={'agent':{},'channel':_0xf15a('0x5e')};if(_0x5c4643[_0xf15a('0x59')]['id']){delete _0x5c4643[_0xf15a('0x59')]['id'];}_0x5c4643['body'][_0xf15a('0x5f')]=!![];_0x5c4643['body']['readAt']=moment()[_0xf15a('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x5c4643['body'][_0xf15a('0x61')]=_0x5c4643[_0xf15a('0x59')][_0xf15a('0x61')]||_0x5c4643[_0xf15a('0x62')]['id'];_0x584942[_0xf15a('0x63')]['id']=_0x5c4643[_0xf15a('0x59')][_0xf15a('0x61')];return db['FaxMessage'][_0xf15a('0x57')]({'where':{'id':_0x5c4643[_0xf15a('0x54')]['id'],'UserId':null}})[_0xf15a('0x38')](handleEntityNotFound(_0x30008f,null))['then'](saveUpdates(_0x5c4643[_0xf15a('0x59')],null))[_0xf15a('0x38')](function(_0x4b366e){if(_0x4b366e){_0x584942[_0xf15a('0x28')]=_0x4b366e[_0xf15a('0x64')]({'plain':!![]});return db['FaxInteraction'][_0xf15a('0x57')]({'where':{'id':_0x4b366e['FaxInteractionId']}});}return null;})[_0xf15a('0x38')](handleEntityNotFound(_0x30008f,null))[_0xf15a('0x38')](function(_0x194d6a){if(_0x194d6a){return _0x194d6a[_0xf15a('0x58')]({'UserId':_0x5c4643[_0xf15a('0x59')][_0xf15a('0x61')],'read1stAt':_[_0xf15a('0x65')](_0x194d6a['read1stAt'])?moment()['format'](_0xf15a('0x66')):undefined});}return null;})[_0xf15a('0x38')](function(_0x428555){if(_0x428555){_0x584942[_0xf15a('0x67')]=_0x428555[_0xf15a('0x64')]({'plain':!![]});interaction_log['info'](_0xf15a('0x68'),_0x5c4643[_0xf15a('0x62')]['id'],_0x5c4643[_0xf15a('0x62')][_0xf15a('0x3b')],_0x5c4643[_0xf15a('0x62')][_0xf15a('0x69')],_0x584942[_0xf15a('0x67')]['id'],_0x5c4643[_0xf15a('0x59')]?JSON[_0xf15a('0x25')](_0x5c4643[_0xf15a('0x59')]):_0xf15a('0x6a'));return respondWithRpcPromise(_0xf15a('0x6b'),_0xf15a('0x6c'),_0x584942);}return null;})[_0xf15a('0x38')](function(_0x49eb20){var _0x28bbd5='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x49eb20[_0xf15a('0x28')][_0xf15a('0x6d')];return db[_0xf15a('0x6e')][_0xf15a('0x44')](_0x28bbd5,{'type':db['Sequelize'][_0xf15a('0x6f')][_0xf15a('0x70')],'raw':!![]})[_0xf15a('0x38')](function(_0x3b7ffd){return _0x3b7ffd;});})[_0xf15a('0x38')](function(_0x4e86ad){if(_0x4e86ad){_0x584942['message'][_0xf15a('0x71')]=_0x4e86ad[0x0];if(!_0x5c4643[_0xf15a('0x59')][_0xf15a('0x61')])return;return db[_0xf15a('0x72')][_0xf15a('0x57')]({'where':{'id':_0x5c4643[_0xf15a('0x59')][_0xf15a('0x61')],'role':_0xf15a('0x63')},'attributes':['id','name','fullname',_0xf15a('0x73'),'internal'],'raw':!![]});}return null;})[_0xf15a('0x38')](function(_0x5ce91d){if(!_0x5ce91d)return null;_0x584942['message'][_0xf15a('0x63')]=_0x5ce91d;return _0x584942;})[_0xf15a('0x38')](function(_0x334aed){if(_0x334aed){if(_0x5c4643[_0xf15a('0x59')]['manual']){_0x584942[_0xf15a('0x28')][_0xf15a('0x74')]=util[_0xf15a('0x60')](_0xf15a('0x75'),_0x5c4643[_0xf15a('0x62')][_0xf15a('0x3b')]);_0x584942['message'][_0xf15a('0x76')]=_0x584942['channel'];_0x584942['message'][_0xf15a('0x77')]=_0x584942[_0xf15a('0x76')];_0x584942[_0xf15a('0x28')][_0xf15a('0x78')]=_0xf15a('0x5d');return respondWithRpcPromise('EventManager',_0xf15a('0x79'),{'event':_0xf15a('0x7a'),'message':_0x584942[_0xf15a('0x28')]},client9002)[_0xf15a('0x38')](function(){return _0x584942;});}return _0x584942;}return null;})[_0xf15a('0x38')](respondWithResult(_0x30008f,null))['catch'](handleError(_0x30008f,null));};var interaction_log=require(_0xf15a('0x5b'))(_0xf15a('0x5c'));exports[_0xf15a('0x36')]=function(_0x5c9576,_0x5d88a1,_0x20dad0){var _0x4d6b41={'agent':{},'channel':_0xf15a('0x5e')};if(_0x5c9576['body']['id']){delete _0x5c9576['body']['id'];}_0x5c9576[_0xf15a('0x59')]['UserId']=_0x5c9576[_0xf15a('0x59')][_0xf15a('0x61')]||_0x5c9576['user']['id'];_0x4d6b41[_0xf15a('0x63')]['id']=_0x5c9576['body'][_0xf15a('0x61')];return db[_0xf15a('0x3f')]['find']({'where':{'id':_0x5c9576[_0xf15a('0x54')]['id'],'UserId':null}})[_0xf15a('0x38')](handleEntityNotFound(_0x5d88a1,null))[_0xf15a('0x38')](function(_0x1e6886){if(_0x1e6886){_0x4d6b41[_0xf15a('0x28')]=_0x1e6886[_0xf15a('0x64')]({'plain':!![]});return db[_0xf15a('0x7b')][_0xf15a('0x57')]({'where':{'id':_0x1e6886[_0xf15a('0x7c')]}});}return null;})['then'](handleEntityNotFound(_0x5d88a1,null))[_0xf15a('0x38')](function(_0x51c667){if(_0x51c667){_0x4d6b41[_0xf15a('0x67')]=_0x51c667[_0xf15a('0x64')]({'plain':!![]});interaction_log[_0xf15a('0x20')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5c9576[_0xf15a('0x62')]['id'],_0x5c9576[_0xf15a('0x62')][_0xf15a('0x3b')],_0x5c9576[_0xf15a('0x62')]['role'],_0x4d6b41[_0xf15a('0x67')]['id'],_0x5c9576[_0xf15a('0x59')]?JSON['stringify'](_0x5c9576[_0xf15a('0x59')]):_0xf15a('0x6a'));return respondWithRpcPromise(_0xf15a('0x7d'),_0xf15a('0x7e'),_0x4d6b41);}return null;})['then'](function(_0x1b2f2c){var _0x5633e1='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1b2f2c[_0xf15a('0x28')][_0xf15a('0x6d')];return db[_0xf15a('0x6e')][_0xf15a('0x44')](_0x5633e1,{'type':db[_0xf15a('0x7f')]['QueryTypes'][_0xf15a('0x70')],'raw':!![]})[_0xf15a('0x38')](function(_0x5813ac){return _0x5813ac;});})[_0xf15a('0x38')](function(_0x20fc18){if(_0x20fc18){_0x4d6b41[_0xf15a('0x28')]['contact']=_0x20fc18[0x0];if(!_0x5c9576['body'][_0xf15a('0x61')])return;return db[_0xf15a('0x72')][_0xf15a('0x57')]({'where':{'id':_0x5c9576[_0xf15a('0x59')][_0xf15a('0x61')],'role':'agent'},'attributes':['id','name',_0xf15a('0x80'),_0xf15a('0x73'),_0xf15a('0x81')],'raw':!![]});}return null;})[_0xf15a('0x38')](function(_0x1f3dc2){if(!_0x1f3dc2)return null;_0x4d6b41[_0xf15a('0x28')]['agent']=_0x1f3dc2;return _0x4d6b41;})[_0xf15a('0x38')](function(_0x40c2e3){if(_0x40c2e3){_0x40c2e3['message'][_0xf15a('0x74')]=util[_0xf15a('0x60')](_0xf15a('0x75'),_0x5c9576[_0xf15a('0x62')][_0xf15a('0x3b')]);_0x40c2e3['message'][_0xf15a('0x76')]=_0x4d6b41[_0xf15a('0x76')];_0x40c2e3[_0xf15a('0x28')][_0xf15a('0x77')]=_0x4d6b41[_0xf15a('0x76')];_0x40c2e3[_0xf15a('0x28')][_0xf15a('0x78')]=_0xf15a('0x36');respondWithRpcPromise(_0xf15a('0x79'),'EventManager',{'event':'rejectmessage','message':_0x40c2e3[_0xf15a('0x28')]},client9002);return _0x4d6b41;}return null;})['then'](respondWithResult(_0x5d88a1,null))[_0xf15a('0x2a')](handleError(_0x5d88a1,null));};exports[_0xf15a('0x82')]=function(_0x2b2535,_0x4b79cb){var _0x416b4d;return db[_0xf15a('0x3f')][_0xf15a('0x82')](_0x2b2535[_0xf15a('0x59')],{})['then'](function(_0x1e2178){_0x416b4d=_0x1e2178;return db[_0xf15a('0x83')][_0xf15a('0x84')]({'where':{'id':_0x416b4d['ContactId']}});})[_0xf15a('0x38')](function(_0x56d06c){if(_[_0xf15a('0x65')](_0x56d06c)){return;}else{_0x416b4d[_0xf15a('0x5e')]=_0x56d06c[_0xf15a('0x5e')];return db[_0xf15a('0x85')][_0xf15a('0x84')]({'where':{'id':_0x416b4d[_0xf15a('0x86')]}});}})[_0xf15a('0x38')](function(_0xf26d45){return respondWithRpcPromise(_0xf15a('0x87'),'SendFax',{'FaxAccountId':_[_0xf15a('0x65')](_0x2b2535[_0xf15a('0x59')])?undefined:_0x2b2535[_0xf15a('0x59')][_0xf15a('0x88')],'path':_[_0xf15a('0x65')](_0xf26d45)?undefined:util[_0xf15a('0x60')](_0xf15a('0x89'),_0xf26d45[_0xf15a('0x8a')]),'fax':_[_0xf15a('0x65')](_0x416b4d['fax'])?undefined:_0x416b4d[_0xf15a('0x5e')],'AttachmentId':_0x416b4d[_0xf15a('0x86')]},client9002);})[_0xf15a('0x38')](respondWithResult(_0x4b79cb,0xc9))[_0xf15a('0x2a')](handleError(_0x4b79cb,null));};exports[_0xf15a('0x8b')]=function(_0x224104,_0x56d951){var _0x1514af=path[_0xf15a('0x8c')](config[_0xf15a('0x8d')],'server',_0xf15a('0x8e'),_0xf15a('0x8f'));return db['FaxMessage'][_0xf15a('0x57')]({'where':{'id':_0x224104[_0xf15a('0x54')]['id']},'include':[{'model':db[_0xf15a('0x85')],'as':_0xf15a('0x85')}]})[_0xf15a('0x38')](handleEntityNotFound(_0x56d951,null))[_0xf15a('0x38')](function(_0x1529e7){if(_0x1529e7){return _0x56d951[_0xf15a('0x8b')](path[_0xf15a('0x8c')](_0x1514af,_0x1529e7[_0xf15a('0x85')][_0xf15a('0x8a')]));}})[_0xf15a('0x2a')](handleError(_0x56d951,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index d6c3776..c255236 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 _0x905a=['hasOwnProperty','hook','exports','events','FaxMessage','update','remove','emit'];(function(_0x4454c3,_0x24c130){var _0x195fa6=function(_0x594c1a){while(--_0x594c1a){_0x4454c3['push'](_0x4454c3['shift']());}};_0x195fa6(++_0x24c130);}(_0x905a,0xeb));var _0xa905=function(_0x1e6882,_0x315ed8){_0x1e6882=_0x1e6882-0x0;var _0x1cbdbf=_0x905a[_0x1e6882];return _0x1cbdbf;};'use strict';var EventEmitter=require(_0xa905('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0xa905('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa905('0x2'),'afterDestroy':_0xa905('0x3')};function emitEvent(_0x54450f){return function(_0xf28f88,_0x2db00d,_0xb2f96a){FaxMessageEvents[_0xa905('0x4')](_0x54450f+':'+_0xf28f88['id'],_0xf28f88);FaxMessageEvents[_0xa905('0x4')](_0x54450f,_0xf28f88);_0xb2f96a(null);};}for(var e in events){if(events[_0xa905('0x5')](e)){var event=events[e];FaxMessage[_0xa905('0x6')](e,emitEvent(event));}}module[_0xa905('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x80c3=['events','setMaxListeners','update','remove','emit','hook','exports'];(function(_0x6b0438,_0x59f919){var _0x14e7e9=function(_0x2255c3){while(--_0x2255c3){_0x6b0438['push'](_0x6b0438['shift']());}};_0x14e7e9(++_0x59f919);}(_0x80c3,0x18f));var _0x380c=function(_0x23c6f2,_0x4e033c){_0x23c6f2=_0x23c6f2-0x0;var _0x4c270b=_0x80c3[_0x23c6f2];return _0x4c270b;};'use strict';var EventEmitter=require(_0x380c('0x0'));var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x380c('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x380c('0x2'),'afterDestroy':_0x380c('0x3')};function emitEvent(_0x24728a){return function(_0x52fd7e,_0x565a08,_0x553158){FaxMessageEvents[_0x380c('0x4')](_0x24728a+':'+_0x52fd7e['id'],_0x52fd7e);FaxMessageEvents['emit'](_0x24728a,_0x52fd7e);_0x553158(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x380c('0x5')](e,emitEvent(event));}}module[_0x380c('0x6')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 36c2b1a..ef05b37 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 _0xc462=['../../config/logger','api','moment','path','rimraf','./faxMessage.attributes','exports','define','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x2751e8,_0x19ee57){var _0x455c9b=function(_0x481a2d){while(--_0x481a2d){_0x2751e8['push'](_0x2751e8['shift']());}};_0x455c9b(++_0x19ee57);}(_0xc462,0x179));var _0x2c46=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xc462[_0x53ccf2];return _0x5a2964;};'use strict';var _=require('lodash');var util=require(_0x2c46('0x0'));var logger=require(_0x2c46('0x1'))(_0x2c46('0x2'));var moment=require(_0x2c46('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2c46('0x4'));var rimraf=require(_0x2c46('0x5'));var config=require('../../config/environment');var attributes=require(_0x2c46('0x6'));module[_0x2c46('0x7')]=function(_0x384259,_0x561a08){return _0x384259[_0x2c46('0x8')]('FaxMessage',attributes,{'tableName':_0x2c46('0x9'),'paranoid':![],'indexes':[{'name':_0x2c46('0xa'),'fields':[_0x2c46('0xb')],'type':_0x2c46('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x56e09c,_0x3bf2fb,_0x15c5d5){var _0x50c453=_0x384259[_0x2c46('0xd')];var _0x39818c=_0x56e09c[_0x2c46('0xe')]({'plain':!![]});if(_0x39818c[_0x2c46('0xf')][_0x2c46('0x10')]()==='in'||_0x39818c[_0x2c46('0xf')]['toLowerCase']()==='out'&&!_0x39818c['secret']&&!_['isNil'](_0x39818c[_0x2c46('0x11')])){_0x50c453[_0x2c46('0x12')][_0x2c46('0x13')]({'where':{'id':_0x39818c[_0x2c46('0x14')]}})[_0x2c46('0x15')](function(_0x246eb3){if(_0x246eb3){_0x246eb3[_0x2c46('0x16')]({'lastMsgAt':_0x39818c[_0x2c46('0x17')],'lastMsgDirection':_0x39818c[_0x2c46('0xf')][_0x2c46('0x10')]()});}})['catch'](function(_0x4db894){console[_0x2c46('0x18')](_0x4db894);});}_0x15c5d5();}},'charset':_0x2c46('0x19'),'collate':_0x2c46('0x1a')});}; \ No newline at end of file +var _0xee22=['catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','fax_messages','body','get','direction','toLowerCase','out','secret','isNil','FaxInteraction','findOne','FaxInteractionId','then','update'];(function(_0x3499a8,_0x369d94){var _0x3fe668=function(_0x2121f3){while(--_0x2121f3){_0x3499a8['push'](_0x3499a8['shift']());}};_0x3fe668(++_0x369d94);}(_0xee22,0x154));var _0x2ee2=function(_0x5f2920,_0x12e236){_0x5f2920=_0x5f2920-0x0;var _0x42a70f=_0xee22[_0x5f2920];return _0x42a70f;};'use strict';var _=require(_0x2ee2('0x0'));var util=require(_0x2ee2('0x1'));var logger=require('../../config/logger')(_0x2ee2('0x2'));var moment=require(_0x2ee2('0x3'));var BPromise=require(_0x2ee2('0x4'));var rp=require(_0x2ee2('0x5'));var fs=require('fs');var path=require(_0x2ee2('0x6'));var rimraf=require(_0x2ee2('0x7'));var config=require(_0x2ee2('0x8'));var attributes=require(_0x2ee2('0x9'));module[_0x2ee2('0xa')]=function(_0x42ff95,_0x38f1c4){return _0x42ff95['define']('FaxMessage',attributes,{'tableName':_0x2ee2('0xb'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x2ee2('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4e0946,_0x590379,_0x232766){var _0x1e3794=_0x42ff95['models'];var _0x150198=_0x4e0946[_0x2ee2('0xd')]({'plain':!![]});if(_0x150198[_0x2ee2('0xe')][_0x2ee2('0xf')]()==='in'||_0x150198['direction'][_0x2ee2('0xf')]()===_0x2ee2('0x10')&&!_0x150198[_0x2ee2('0x11')]&&!_[_0x2ee2('0x12')](_0x150198['UserId'])){_0x1e3794[_0x2ee2('0x13')][_0x2ee2('0x14')]({'where':{'id':_0x150198[_0x2ee2('0x15')]}})[_0x2ee2('0x16')](function(_0x11351d){if(_0x11351d){_0x11351d[_0x2ee2('0x17')]({'lastMsgAt':_0x150198['createdAt'],'lastMsgDirection':_0x150198[_0x2ee2('0xe')][_0x2ee2('0xf')]()});}})[_0x2ee2('0x18')](function(_0x42e44c){console[_0x2ee2('0x19')](_0x42e44c);});}_0x232766();}},'charset':_0x2ee2('0x1a'),'collate':_0x2ee2('0x1b')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index e729427..726d17a 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 _0xed1f=['jayson/promise','client','http','redis','defaults','localhost','./faxMessage.socket','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','CreateFaxMessage','FaxMessage','create','body','options','raw','info','catch','UpdateFaxMessage','update','attributes','limit','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xed1f,0x6a));var _0xfed1=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0xed1f[_0x32b542];return _0x554d54;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var moment=require(_0xfed1('0x2'));var BPromise=require(_0xfed1('0x3'));var rs=require(_0xfed1('0x4'));var fs=require('fs');var Redis=require(_0xfed1('0x5'));var db=require(_0xfed1('0x6'))['db'];var utils=require(_0xfed1('0x7'));var logger=require(_0xfed1('0x8'))(_0xfed1('0x9'));var config=require(_0xfed1('0xa'));var jayson=require(_0xfed1('0xb'));var client=jayson[_0xfed1('0xc')][_0xfed1('0xd')]({'port':0x232a});config[_0xfed1('0xe')]=_[_0xfed1('0xf')](config[_0xfed1('0xe')],{'host':_0xfed1('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfed1('0xe')]));require(_0xfed1('0x11'))['register'](socket);function respondWithRpcPromise(_0x1414be,_0x7bf48c,_0x4a564e){return new BPromise(function(_0x3ce017,_0x48c338){return client[_0xfed1('0x12')](_0x1414be,_0x4a564e)[_0xfed1('0x13')](function(_0x4a8369){logger['info'](_0xfed1('0x14'),_0x7bf48c,_0xfed1('0x15'));logger['debug'](_0xfed1('0x16'),_0x7bf48c,'request\x20sent',JSON['stringify'](_0x4a8369));if(_0x4a8369[_0xfed1('0x17')]){if(_0x4a8369[_0xfed1('0x17')]['code']===0x1f4){logger[_0xfed1('0x17')]('FaxMessage,\x20%s,\x20%s',_0x7bf48c,_0x4a8369['error'][_0xfed1('0x18')]);return _0x48c338(_0x4a8369[_0xfed1('0x17')][_0xfed1('0x18')]);}logger[_0xfed1('0x17')]('FaxMessage,\x20%s,\x20%s',_0x7bf48c,_0x4a8369[_0xfed1('0x17')]['message']);return _0x3ce017(_0x4a8369[_0xfed1('0x17')][_0xfed1('0x18')]);}else{logger['info'](_0xfed1('0x14'),_0x7bf48c,_0xfed1('0x15'));_0x3ce017(_0x4a8369['result']['message']);}})['catch'](function(_0x1e5afb){logger['error'](_0xfed1('0x14'),_0x7bf48c,_0x1e5afb);_0x48c338(_0x1e5afb);});});}exports[_0xfed1('0x19')]=function(_0x51a860){var _0x94cb84=this;return new Promise(function(_0x65f14b,_0x59ee9d){return db[_0xfed1('0x1a')][_0xfed1('0x1b')](_0x51a860[_0xfed1('0x1c')],{'raw':_0x51a860[_0xfed1('0x1d')]?_0x51a860['options'][_0xfed1('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x446558){logger[_0xfed1('0x1f')](_0xfed1('0x19'),_0x51a860);logger['debug'](_0xfed1('0x19'),_0x51a860,JSON['stringify'](_0x446558));_0x65f14b(_0x446558);})[_0xfed1('0x20')](function(_0x2793b7){logger[_0xfed1('0x17')](_0xfed1('0x19'),_0x2793b7[_0xfed1('0x18')],_0x51a860);_0x59ee9d(_0x94cb84[_0xfed1('0x17')](0x1f4,_0x2793b7['message']));});});};exports[_0xfed1('0x21')]=function(_0xcb1cdc){var _0x49072b=this;return new Promise(function(_0x1d6c72,_0x2b9dd2){return db[_0xfed1('0x1a')][_0xfed1('0x22')](_0xcb1cdc[_0xfed1('0x1c')],{'raw':_0xcb1cdc[_0xfed1('0x1d')]?_0xcb1cdc['options'][_0xfed1('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcb1cdc['options']?_0xcb1cdc[_0xfed1('0x1d')]['where']||null:null,'attributes':_0xcb1cdc['options']?_0xcb1cdc[_0xfed1('0x1d')][_0xfed1('0x23')]||null:null,'limit':_0xcb1cdc[_0xfed1('0x1d')]?_0xcb1cdc['options'][_0xfed1('0x24')]||null:null})[_0xfed1('0x13')](function(_0x13f414){logger[_0xfed1('0x1f')](_0xfed1('0x21'),_0xcb1cdc);logger[_0xfed1('0x25')]('UpdateFaxMessage',_0xcb1cdc,JSON[_0xfed1('0x26')](_0x13f414));_0x1d6c72(_0x13f414);})[_0xfed1('0x20')](function(_0x4fc309){logger['error'](_0xfed1('0x21'),_0x4fc309[_0xfed1('0x18')],_0xcb1cdc);_0x2b9dd2(_0x49072b[_0xfed1('0x17')](0x1f4,_0x4fc309[_0xfed1('0x18')]));});});}; \ No newline at end of file +var _0xeec6=['FaxMessage','create','body','options','then','catch','UpdateFaxMessage','update','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','CreateFaxMessage'];(function(_0x5923be,_0x3023ae){var _0x303700=function(_0x13d05c){while(--_0x13d05c){_0x5923be['push'](_0x5923be['shift']());}};_0x303700(++_0x3023ae);}(_0xeec6,0x1c2));var _0x6eec=function(_0x18ea8a,_0x32f09f){_0x18ea8a=_0x18ea8a-0x0;var _0x19c99a=_0xeec6[_0x18ea8a];return _0x19c99a;};'use strict';var _=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var moment=require(_0x6eec('0x2'));var BPromise=require(_0x6eec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6eec('0x4'));var db=require(_0x6eec('0x5'))['db'];var utils=require(_0x6eec('0x6'));var logger=require(_0x6eec('0x7'))(_0x6eec('0x8'));var config=require(_0x6eec('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6eec('0xa')][_0x6eec('0xb')]({'port':0x232a});config['redis']=_[_0x6eec('0xc')](config[_0x6eec('0xd')],{'host':_0x6eec('0xe'),'port':0x18eb});var socket=require(_0x6eec('0xf'))(new Redis(config['redis']));require(_0x6eec('0x10'))[_0x6eec('0x11')](socket);function respondWithRpcPromise(_0x1c774d,_0x49ad4c,_0x595dd4){return new BPromise(function(_0x5e8aba,_0x295cae){return client[_0x6eec('0x12')](_0x1c774d,_0x595dd4)['then'](function(_0x4b8de1){logger[_0x6eec('0x13')]('FaxMessage,\x20%s,\x20%s',_0x49ad4c,_0x6eec('0x14'));logger[_0x6eec('0x15')](_0x6eec('0x16'),_0x49ad4c,_0x6eec('0x14'),JSON[_0x6eec('0x17')](_0x4b8de1));if(_0x4b8de1['error']){if(_0x4b8de1[_0x6eec('0x18')][_0x6eec('0x19')]===0x1f4){logger[_0x6eec('0x18')](_0x6eec('0x1a'),_0x49ad4c,_0x4b8de1[_0x6eec('0x18')][_0x6eec('0x1b')]);return _0x295cae(_0x4b8de1[_0x6eec('0x18')][_0x6eec('0x1b')]);}logger[_0x6eec('0x18')](_0x6eec('0x1a'),_0x49ad4c,_0x4b8de1['error'][_0x6eec('0x1b')]);return _0x5e8aba(_0x4b8de1['error'][_0x6eec('0x1b')]);}else{logger[_0x6eec('0x13')]('FaxMessage,\x20%s,\x20%s',_0x49ad4c,_0x6eec('0x14'));_0x5e8aba(_0x4b8de1[_0x6eec('0x1c')][_0x6eec('0x1b')]);}})['catch'](function(_0x87f3be){logger[_0x6eec('0x18')](_0x6eec('0x1a'),_0x49ad4c,_0x87f3be);_0x295cae(_0x87f3be);});});}exports[_0x6eec('0x1d')]=function(_0xd86135){var _0x1761f4=this;return new Promise(function(_0x536429,_0x328693){return db[_0x6eec('0x1e')][_0x6eec('0x1f')](_0xd86135[_0x6eec('0x20')],{'raw':_0xd86135[_0x6eec('0x21')]?_0xd86135[_0x6eec('0x21')]['raw']===undefined?!![]:![]:!![]})[_0x6eec('0x22')](function(_0x852d08){logger[_0x6eec('0x13')](_0x6eec('0x1d'),_0xd86135);logger[_0x6eec('0x15')](_0x6eec('0x1d'),_0xd86135,JSON['stringify'](_0x852d08));_0x536429(_0x852d08);})[_0x6eec('0x23')](function(_0x2ad14b){logger[_0x6eec('0x18')](_0x6eec('0x1d'),_0x2ad14b[_0x6eec('0x1b')],_0xd86135);_0x328693(_0x1761f4[_0x6eec('0x18')](0x1f4,_0x2ad14b[_0x6eec('0x1b')]));});});};exports[_0x6eec('0x24')]=function(_0x316317){var _0x58f95c=this;return new Promise(function(_0x1d750c,_0x44b31c){return db[_0x6eec('0x1e')][_0x6eec('0x25')](_0x316317['body'],{'raw':_0x316317[_0x6eec('0x21')]?_0x316317[_0x6eec('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x316317['options']?_0x316317[_0x6eec('0x21')]['where']||null:null,'attributes':_0x316317[_0x6eec('0x21')]?_0x316317[_0x6eec('0x21')][_0x6eec('0x26')]||null:null,'limit':_0x316317[_0x6eec('0x21')]?_0x316317[_0x6eec('0x21')][_0x6eec('0x27')]||null:null})[_0x6eec('0x22')](function(_0x33e4a1){logger[_0x6eec('0x13')](_0x6eec('0x24'),_0x316317);logger['debug'](_0x6eec('0x24'),_0x316317,JSON['stringify'](_0x33e4a1));_0x1d750c(_0x33e4a1);})[_0x6eec('0x23')](function(_0x125bfc){logger[_0x6eec('0x18')]('UpdateFaxMessage',_0x125bfc['message'],_0x316317);_0x44b31c(_0x58f95c['error'](0x1f4,_0x125bfc[_0x6eec('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 825daac..12bfb6d 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 _0xf031=['update','faxMessage:','./faxMessage.events'];(function(_0x193eb3,_0x44e075){var _0x5af017=function(_0x51d8cd){while(--_0x51d8cd){_0x193eb3['push'](_0x193eb3['shift']());}};_0x5af017(++_0x44e075);}(_0xf031,0x1dc));var _0x1f03=function(_0x536b7b,_0x50c100){_0x536b7b=_0x536b7b-0x0;var _0x125583=_0xf031[_0x536b7b];return _0x125583;};'use strict';var FaxMessageEvents=require(_0x1f03('0x0'));var events=['save','remove',_0x1f03('0x1')];function createListener(_0x44f004,_0x29b2f5){return function(_0x33b9f5){_0x29b2f5['emit'](_0x44f004,_0x33b9f5);};}function removeListener(_0x3a47d6,_0x4826eb){return function(){FaxMessageEvents['removeListener'](_0x3a47d6,_0x4826eb);};}exports['register']=function(_0x289a43){for(var _0x323f50=0x0,_0x27f202=events['length'];_0x323f50<_0x27f202;_0x323f50++){var _0x4c94c9=events[_0x323f50];var _0x249093=createListener(_0x1f03('0x2')+_0x4c94c9,_0x289a43);FaxMessageEvents['on'](_0x4c94c9,_0x249093);}}; \ No newline at end of file +var _0xd96b=['register','length','update','removeListener'];(function(_0x113955,_0x5069c7){var _0x17c934=function(_0x29d269){while(--_0x29d269){_0x113955['push'](_0x113955['shift']());}};_0x17c934(++_0x5069c7);}(_0xd96b,0x156));var _0xbd96=function(_0x2fcae3,_0x347eb2){_0x2fcae3=_0x2fcae3-0x0;var _0x341fb8=_0xd96b[_0x2fcae3];return _0x341fb8;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=['save','remove',_0xbd96('0x0')];function createListener(_0x1c2e8e,_0x265877){return function(_0x94fda8){_0x265877['emit'](_0x1c2e8e,_0x94fda8);};}function removeListener(_0x450267,_0x25dbb5){return function(){FaxMessageEvents[_0xbd96('0x1')](_0x450267,_0x25dbb5);};}exports[_0xbd96('0x2')]=function(_0x3e0d63){for(var _0x35a817=0x0,_0x4ca4d6=events[_0xbd96('0x3')];_0x35a817<_0x4ca4d6;_0x35a817++){var _0x4bc581=events[_0x35a817];var _0x4156e7=createListener('faxMessage:'+_0x4bc581,_0x3e0d63);FaxMessageEvents['on'](_0x4bc581,_0x4156e7);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 99e0f21..5ac48f2 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 _0xdace=['/describe','describe','/:id','show','download','tracked','fax','create','update','put','/:id/accept','accept','reject','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x5a1f78,_0x16c0f0){var _0x25366e=function(_0x406fdc){while(--_0x406fdc){_0x5a1f78['push'](_0x5a1f78['shift']());}};_0x25366e(++_0x16c0f0);}(_0xdace,0xc5));var _0xedac=function(_0x1558ab,_0x39d1de){_0x1558ab=_0x1558ab-0x0;var _0x53b64a=_0xdace[_0x1558ab];return _0x53b64a;};'use strict';var multer=require(_0xedac('0x0'));var util=require('util');var path=require(_0xedac('0x1'));var timeout=require(_0xedac('0x2'));var express=require(_0xedac('0x3'));var router=express['Router']();var fs_extra=require(_0xedac('0x4'));var auth=require(_0xedac('0x5'));var interaction=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var controller=require('./faxMessage.controller');router[_0xedac('0x8')]('/',auth[_0xedac('0x9')](),controller[_0xedac('0xa')]);router['get'](_0xedac('0xb'),auth[_0xedac('0x9')](),controller[_0xedac('0xc')]);router['get'](_0xedac('0xd'),auth[_0xedac('0x9')](),controller[_0xedac('0xe')]);router['get']('/:id/download',auth[_0xedac('0x9')](),controller[_0xedac('0xf')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xedac('0x10')](_0xedac('0x11'),'faxmessage:create'),controller[_0xedac('0x12')]);router['put'](_0xedac('0xd'),auth[_0xedac('0x9')](),controller[_0xedac('0x13')]);router[_0xedac('0x14')](_0xedac('0x15'),auth[_0xedac('0x9')](),controller[_0xedac('0x16')]);router[_0xedac('0x14')]('/:id/reject',auth[_0xedac('0x9')](),controller[_0xedac('0x17')]);router[_0xedac('0x18')](_0xedac('0xd'),auth[_0xedac('0x9')](),controller['destroy']);module[_0xedac('0x19')]=router; \ No newline at end of file +var _0xf109=['update','/:id/accept','put','/:id/reject','delete','destroy','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','/:id','show','download','post','fax','faxmessage:create','create'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xf109,0xce));var _0x9f10=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xf109[_0x16b9ed];return _0x66b1f8;};'use strict';var multer=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var path=require(_0x9f10('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x9f10('0x3'));var auth=require(_0x9f10('0x4'));var interaction=require(_0x9f10('0x5'));var config=require(_0x9f10('0x6'));var controller=require(_0x9f10('0x7'));router[_0x9f10('0x8')]('/',auth[_0x9f10('0x9')](),controller[_0x9f10('0xa')]);router[_0x9f10('0x8')](_0x9f10('0xb'),auth[_0x9f10('0x9')](),controller['describe']);router[_0x9f10('0x8')](_0x9f10('0xc'),auth[_0x9f10('0x9')](),controller[_0x9f10('0xd')]);router[_0x9f10('0x8')]('/:id/download',auth[_0x9f10('0x9')](),controller[_0x9f10('0xe')]);router[_0x9f10('0xf')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x9f10('0x10'),_0x9f10('0x11')),controller[_0x9f10('0x12')]);router['put'](_0x9f10('0xc'),auth[_0x9f10('0x9')](),controller[_0x9f10('0x13')]);router['put'](_0x9f10('0x14'),auth[_0x9f10('0x9')](),controller['accept']);router[_0x9f10('0x15')](_0x9f10('0x16'),auth['isAuthenticated'](),controller['reject']);router[_0x9f10('0x17')](_0x9f10('0xc'),auth['isAuthenticated'](),controller[_0x9f10('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 75700cf..177c227 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 _0x6083=['exports','name','STRING','INTEGER','ENUM','beepall','roundrobin','sequelize'];(function(_0x52f309,_0x4ea2df){var _0x58ab0d=function(_0x3fa291){while(--_0x3fa291){_0x52f309['push'](_0x52f309['shift']());}};_0x58ab0d(++_0x4ea2df);}(_0x6083,0x9f));var _0x3608=function(_0x47337b,_0x369073){_0x47337b=_0x47337b-0x0;var _0x4bc4dc=_0x6083[_0x47337b];return _0x4bc4dc;};'use strict';var Sequelize=require(_0x3608('0x0'));module[_0x3608('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x3608('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3608('0x3')]},'timeout':{'type':Sequelize[_0x3608('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3608('0x5')]('rrmemory',_0x3608('0x6'),_0x3608('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x3608('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3761=['name','INTEGER','ENUM','rrmemory','roundrobin','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3761,0x8a));var _0x1376=function(_0x332cf1,_0x1fe873){_0x332cf1=_0x332cf1-0x0;var _0x129eb0=_0x3761[_0x332cf1];return _0x129eb0;};'use strict';var Sequelize=require('sequelize');module[_0x1376('0x0')]={'name':{'type':Sequelize[_0x1376('0x1')],'unique':_0x1376('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1376('0x1')]},'timeout':{'type':Sequelize[_0x1376('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1376('0x4')](_0x1376('0x5'),'beepall',_0x1376('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 21abbe4..df49847 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 _0x5105=['from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','every','includes','union','compact','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','userFaxQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','FaxQueue','include','findAll','rows','catch','show','params','keys','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','UserFaxQueue','pick','User','findAndCountAll','UserId','agent','faxPause','createdAt','updatedAt','findOne','Team','getTeams','addTeams','ids','Agents','flatMap','transaction','each','forEach','emit','removeTeams','select'];(function(_0x2d6197,_0x82ebfb){var _0x4d0e75=function(_0x577e7a){while(--_0x577e7a){_0x2d6197['push'](_0x2d6197['shift']());}};_0x4d0e75(++_0x82ebfb);}(_0x5105,0x122));var _0x5510=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5105[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0x5510('0x0'));var rimraf=require(_0x5510('0x1'));var zipdir=require(_0x5510('0x2'));var jsonpatch=require(_0x5510('0x3'));var rp=require('request-promise');var moment=require(_0x5510('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5510('0x5'));var sox=require(_0x5510('0x6'));var csv=require(_0x5510('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5510('0x8'));var _=require(_0x5510('0x9'));var squel=require('squel');var crypto=require(_0x5510('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5510('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5510('0xc'));var Papa=require(_0x5510('0xd'));var Redis=require(_0x5510('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x5510('0xf'));var as=require(_0x5510('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5510('0x11'))(_0x5510('0x12'));var utils=require('../../config/utils');var config=require(_0x5510('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5510('0x14'))['db'];config[_0x5510('0x15')]=_[_0x5510('0x16')](config['redis'],{'host':_0x5510('0x17'),'port':0x18eb});var socket=require(_0x5510('0x18'))(new Redis(config[_0x5510('0x15')]));require('./faxQueue.socket')[_0x5510('0x19')](socket);function respondWithStatusCode(_0x873f73,_0x497259){_0x497259=_0x497259||0xcc;return function(_0x31ab07){if(_0x31ab07){return _0x873f73[_0x5510('0x1a')](_0x497259);}return _0x873f73[_0x5510('0x1b')](_0x497259)[_0x5510('0x1c')]();};}function respondWithResult(_0x59e435,_0x465ff4){_0x465ff4=_0x465ff4||0xc8;return function(_0x52c03f){if(_0x52c03f){return _0x59e435[_0x5510('0x1b')](_0x465ff4)['json'](_0x52c03f);}};}function respondWithFilteredResult(_0x59a934,_0x43028a){return function(_0x108b2a){if(_0x108b2a){var _0xb31138=typeof _0x43028a[_0x5510('0x1d')]===_0x5510('0x1e')&&typeof _0x43028a[_0x5510('0x1f')]===_0x5510('0x1e');var _0x5f0e28=_0x108b2a[_0x5510('0x20')];var _0x51d370=_0xb31138?0x0:_0x43028a[_0x5510('0x1d')];var _0x4d1f1b=_0xb31138?_0x108b2a[_0x5510('0x20')]:_0x43028a['offset']+_0x43028a['limit'];var _0x5717f0;if(_0x4d1f1b>=_0x5f0e28){_0x4d1f1b=_0x5f0e28;_0x5717f0=0xc8;}else{_0x5717f0=0xce;}_0x59a934[_0x5510('0x1b')](_0x5717f0);return _0x59a934[_0x5510('0x21')](_0x5510('0x22'),_0x51d370+'-'+_0x4d1f1b+'/'+_0x5f0e28)[_0x5510('0x23')](_0x108b2a);}return null;};}function patchUpdates(_0x22797b){return function(_0x55c19a){try{jsonpatch[_0x5510('0x24')](_0x55c19a,_0x22797b,!![]);}catch(_0x10d625){return BPromise[_0x5510('0x25')](_0x10d625);}return _0x55c19a[_0x5510('0x26')]();};}function saveUpdates(_0x2e7bde,_0x29e8c4){return function(_0x4777ca){if(_0x4777ca){return _0x4777ca['update'](_0x2e7bde)[_0x5510('0x27')](function(_0x4e103c){return _0x4e103c;});}return null;};}function removeEntity(_0x404aa4,_0x57dba2){return function(_0xd17dab){if(_0xd17dab){return _0xd17dab[_0x5510('0x28')]()[_0x5510('0x27')](function(){var _0x4659cf=_0xd17dab[_0x5510('0x29')]({'plain':!![]});var _0x1592be=_0x5510('0x2a');return db[_0x5510('0x2b')][_0x5510('0x28')]({'where':{'type':_0x1592be,'resourceId':_0x4659cf['id']}})[_0x5510('0x27')](function(){return _0xd17dab;});})['then'](function(){_0x404aa4[_0x5510('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x583746,_0x508ce9){return function(_0x2011b3){if(!_0x2011b3){_0x583746[_0x5510('0x1a')](0x194);}return _0x2011b3;};}function handleError(_0x14d8fe,_0x2ae92){_0x2ae92=_0x2ae92||0x1f4;return function(_0x2798f5){logger[_0x5510('0x2c')](_0x2798f5[_0x5510('0x2d')]);if(_0x2798f5[_0x5510('0x2e')]){delete _0x2798f5['name'];}_0x14d8fe[_0x5510('0x1b')](_0x2ae92)[_0x5510('0x2f')](_0x2798f5);};}exports[_0x5510('0x30')]=function(_0x5f4736,_0x44c07c){var _0x802626={},_0x4e75b3={},_0x52d2d9={'count':0x0,'rows':[]};var _0x5d84da=_[_0x5510('0x31')](db['FaxQueue'][_0x5510('0x32')],function(_0x4e3037){return{'name':_0x4e3037[_0x5510('0x33')],'type':_0x4e3037[_0x5510('0x34')]['key']};});_0x4e75b3['model']=_[_0x5510('0x31')](_0x5d84da,_0x5510('0x2e'));_0x4e75b3[_0x5510('0x35')]=_['keys'](_0x5f4736[_0x5510('0x35')]);_0x4e75b3[_0x5510('0x36')]=_[_0x5510('0x37')](_0x4e75b3['model'],_0x4e75b3[_0x5510('0x35')]);_0x802626[_0x5510('0x38')]=_['intersection'](_0x4e75b3['model'],qs[_0x5510('0x39')](_0x5f4736[_0x5510('0x35')][_0x5510('0x39')]));_0x802626[_0x5510('0x38')]=_0x802626[_0x5510('0x38')][_0x5510('0x3a')]?_0x802626[_0x5510('0x38')]:_0x4e75b3[_0x5510('0x3b')];if(!_0x5f4736[_0x5510('0x35')][_0x5510('0x3c')](_0x5510('0x3d'))){_0x802626[_0x5510('0x1f')]=qs[_0x5510('0x1f')](_0x5f4736['query'][_0x5510('0x1f')]);_0x802626[_0x5510('0x1d')]=qs[_0x5510('0x1d')](_0x5f4736[_0x5510('0x35')]['offset']);}_0x802626[_0x5510('0x3e')]=qs[_0x5510('0x3f')](_0x5f4736[_0x5510('0x35')]['sort']);_0x802626[_0x5510('0x40')]=qs[_0x5510('0x36')](_['pick'](_0x5f4736[_0x5510('0x35')],_0x4e75b3['filters']),_0x5d84da);if(_0x5f4736[_0x5510('0x35')][_0x5510('0x41')]){_0x802626['where']=_[_0x5510('0x42')](_0x802626[_0x5510('0x40')],{'$or':_[_0x5510('0x31')](_0x5d84da,function(_0xdd83a4){if(_0xdd83a4['type']!==_0x5510('0x43')){var _0x34aed1={};_0x34aed1[_0xdd83a4[_0x5510('0x2e')]]={'$like':'%'+_0x5f4736[_0x5510('0x35')][_0x5510('0x41')]+'%'};return _0x34aed1;}})});}_0x802626=_[_0x5510('0x42')]({},_0x802626,_0x5f4736[_0x5510('0x44')]);var _0x281e00={'where':_0x802626[_0x5510('0x40')]};return db[_0x5510('0x45')][_0x5510('0x20')](_0x281e00)[_0x5510('0x27')](function(_0x3be8cf){_0x52d2d9[_0x5510('0x20')]=_0x3be8cf;if(_0x5f4736[_0x5510('0x35')]['includeAll']){_0x802626[_0x5510('0x46')]=[{'all':!![]}];}return db[_0x5510('0x45')][_0x5510('0x47')](_0x802626);})[_0x5510('0x27')](function(_0x3c434f){_0x52d2d9[_0x5510('0x48')]=_0x3c434f;return _0x52d2d9;})['then'](respondWithFilteredResult(_0x44c07c,_0x802626))[_0x5510('0x49')](handleError(_0x44c07c,null));};exports[_0x5510('0x4a')]=function(_0x57cf37,_0xd72cde){var _0x1d1c56={'raw':!![],'where':{'id':_0x57cf37[_0x5510('0x4b')]['id']}},_0x198716={};_0x198716[_0x5510('0x3b')]=_[_0x5510('0x4c')](db['FaxQueue'][_0x5510('0x32')]);_0x198716[_0x5510('0x35')]=_[_0x5510('0x4c')](_0x57cf37[_0x5510('0x35')]);_0x198716['filters']=_['intersection'](_0x198716[_0x5510('0x3b')],_0x198716[_0x5510('0x35')]);_0x1d1c56[_0x5510('0x38')]=_[_0x5510('0x37')](_0x198716['model'],qs[_0x5510('0x39')](_0x57cf37[_0x5510('0x35')]['fields']));_0x1d1c56['attributes']=_0x1d1c56[_0x5510('0x38')][_0x5510('0x3a')]?_0x1d1c56[_0x5510('0x38')]:_0x198716[_0x5510('0x3b')];if(_0x57cf37[_0x5510('0x35')][_0x5510('0x4d')]){_0x1d1c56['include']=[{'all':!![]}];}_0x1d1c56=_[_0x5510('0x42')]({},_0x1d1c56,_0x57cf37[_0x5510('0x44')]);return db[_0x5510('0x45')][_0x5510('0x4e')](_0x1d1c56)[_0x5510('0x27')](handleEntityNotFound(_0xd72cde,null))[_0x5510('0x27')](respondWithResult(_0xd72cde,null))[_0x5510('0x49')](handleError(_0xd72cde,null));};exports[_0x5510('0x4f')]=function(_0x436b56,_0x5daaa7){return db[_0x5510('0x45')]['create'](_0x436b56['body'],{})[_0x5510('0x27')](function(_0x4229de){var _0x30f8b8=_0x436b56[_0x5510('0x50')][_0x5510('0x29')]({'plain':!![]});if(!_0x30f8b8)throw new Error(_0x5510('0x51'));if(_0x30f8b8[_0x5510('0x52')]===_0x5510('0x50')){var _0x5cb9a2=_0x4229de[_0x5510('0x29')]({'plain':!![]});var _0x4a1080='FaxQueues';return db[_0x5510('0x53')]['find']({'where':{'name':_0x4a1080,'userProfileId':_0x30f8b8[_0x5510('0x54')]},'raw':!![]})[_0x5510('0x27')](function(_0x558fdd){if(_0x558fdd&&_0x558fdd[_0x5510('0x55')]===0x0){return db[_0x5510('0x2b')][_0x5510('0x4f')]({'name':_0x5cb9a2['name'],'resourceId':_0x5cb9a2['id'],'type':_0x558fdd[_0x5510('0x2e')],'sectionId':_0x558fdd['id']},{})[_0x5510('0x27')](function(){return _0x4229de;});}else{return _0x4229de;}})[_0x5510('0x49')](function(_0x5dc50c){logger[_0x5510('0x2c')](_0x5510('0x56'),_0x5dc50c);throw _0x5dc50c;});}return _0x4229de;})[_0x5510('0x27')](respondWithResult(_0x5daaa7,0xc9))['catch'](handleError(_0x5daaa7,null));};exports[_0x5510('0x57')]=function(_0x133b2b,_0x23b290){if(_0x133b2b[_0x5510('0x58')]['id']){delete _0x133b2b['body']['id'];}return db['FaxQueue'][_0x5510('0x4e')]({'where':{'id':_0x133b2b[_0x5510('0x4b')]['id']}})[_0x5510('0x27')](handleEntityNotFound(_0x23b290,null))['then'](saveUpdates(_0x133b2b['body'],null))['then'](respondWithResult(_0x23b290,null))[_0x5510('0x49')](handleError(_0x23b290,null));};exports[_0x5510('0x28')]=function(_0x1761e0,_0x3791a4){return db[_0x5510('0x45')][_0x5510('0x4e')]({'where':{'id':_0x1761e0[_0x5510('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3791a4,null))['then'](removeEntity(_0x3791a4,null))[_0x5510('0x49')](handleError(_0x3791a4,null));};exports['describe']=function(_0x64ee34,_0x2fedd9){return db[_0x5510('0x45')][_0x5510('0x59')]()[_0x5510('0x27')](respondWithResult(_0x2fedd9,null))[_0x5510('0x49')](handleError(_0x2fedd9,null));};exports['getMembers']=function(_0x3682c1,_0x8512f6,_0x50fc7e){var _0x13b1b5={'raw':!![],'where':{}},_0x3f578b={},_0x3167cd;return db[_0x5510('0x45')]['findOne']({'where':{'id':_0x3682c1[_0x5510('0x4b')]['id']}})[_0x5510('0x27')](handleEntityNotFound(_0x8512f6,null))[_0x5510('0x27')](function(_0x29f261){if(_0x29f261){_0x3167cd=_0x29f261[_0x5510('0x29')]({'plain':!![]});_0x3f578b['model']=_[_0x5510('0x4c')](db[_0x5510('0x5a')][_0x5510('0x32')]);_0x3f578b[_0x5510('0x35')]=_['keys'](_0x3682c1[_0x5510('0x35')]);_0x3f578b[_0x5510('0x36')]=_[_0x5510('0x37')](_0x3f578b[_0x5510('0x3b')],_0x3f578b[_0x5510('0x35')]);_0x13b1b5['attributes']=_[_0x5510('0x37')](_0x3f578b[_0x5510('0x3b')],qs[_0x5510('0x39')](_0x3682c1['query']['fields']));_0x13b1b5[_0x5510('0x38')]=_0x13b1b5['attributes'][_0x5510('0x3a')]?_0x13b1b5['attributes']:_0x3f578b[_0x5510('0x3b')];if(!_0x3682c1[_0x5510('0x35')][_0x5510('0x3c')](_0x5510('0x3d'))){_0x13b1b5[_0x5510('0x1f')]=qs[_0x5510('0x1f')](_0x3682c1[_0x5510('0x35')]['limit']);_0x13b1b5[_0x5510('0x1d')]=qs[_0x5510('0x1d')](_0x3682c1[_0x5510('0x35')][_0x5510('0x1d')]);}_0x13b1b5[_0x5510('0x3e')]=qs[_0x5510('0x3f')](_0x3682c1['query'][_0x5510('0x3f')]);_0x13b1b5[_0x5510('0x40')]=qs[_0x5510('0x36')](_[_0x5510('0x5b')](_0x3682c1[_0x5510('0x35')],_0x3f578b[_0x5510('0x36')]));_0x13b1b5['where']['FaxQueueId']=_0x29f261['id'];if(_0x3682c1[_0x5510('0x35')][_0x5510('0x41')]){_0x13b1b5['where']=_[_0x5510('0x42')](_0x13b1b5[_0x5510('0x40')],{'$or':_['map'](_0x13b1b5['attributes'],function(_0x4875d7){var _0xeb0184={};_0xeb0184[_0x4875d7]={'$like':'%'+_0x3682c1['query'][_0x5510('0x41')]+'%'};return _0xeb0184;})});}_0x13b1b5=_[_0x5510('0x42')]({},_0x13b1b5,_0x3682c1[_0x5510('0x44')]);return db[_0x5510('0x5a')][_0x5510('0x47')](_0x13b1b5);}})[_0x5510('0x27')](function(_0x4d1c8f){if(_0x4d1c8f){return db[_0x5510('0x5c')][_0x5510('0x5d')]({'where':{'id':_[_0x5510('0x31')](_0x4d1c8f,_0x5510('0x5e')),'role':_0x5510('0x5f')},'attributes':['id',_0x5510('0x2e'),_0x5510('0x60'),'updatedAt','createdAt']});}})[_0x5510('0x27')](function(_0x2b8461){if(_0x2b8461){return{'count':_0x2b8461[_0x5510('0x20')],'rows':_[_0x5510('0x31')](_0x2b8461[_0x5510('0x48')],function(_0x3a23e4){return{'membername':_0x3a23e4[_0x5510('0x2e')],'UserId':_0x3a23e4['id'],'queue_name':_0x3167cd[_0x5510('0x2e')],'FaxQueueId':_0x3167cd['id'],'interface':util['format']('%s/%s','SIP',_0x3a23e4[_0x5510('0x2e')]),'penalty':0x0,'paused':_0x3a23e4[_0x5510('0x60')],'createdAt':_0x3a23e4[_0x5510('0x61')],'updatedAt':_0x3a23e4[_0x5510('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5510('0x27')](respondWithFilteredResult(_0x8512f6,_0x13b1b5))['catch'](handleError(_0x8512f6,null));};exports['getTeams']=function(_0x4d72f4,_0x58c446,_0x2fdfe0){var _0x32d1b6={};var _0x5652b0={};var _0x9683;var _0x5d7df6;return db['FaxQueue'][_0x5510('0x63')]({'where':{'id':_0x4d72f4[_0x5510('0x4b')]['id']}})[_0x5510('0x27')](handleEntityNotFound(_0x58c446,null))[_0x5510('0x27')](function(_0x2ef4c5){if(_0x2ef4c5){_0x9683=_0x2ef4c5;_0x5652b0[_0x5510('0x3b')]=_[_0x5510('0x4c')](db[_0x5510('0x64')][_0x5510('0x32')]);_0x5652b0[_0x5510('0x35')]=_[_0x5510('0x4c')](_0x4d72f4[_0x5510('0x35')]);_0x5652b0[_0x5510('0x36')]=_[_0x5510('0x37')](_0x5652b0['model'],_0x5652b0[_0x5510('0x35')]);_0x32d1b6[_0x5510('0x38')]=_[_0x5510('0x37')](_0x5652b0[_0x5510('0x3b')],qs['fields'](_0x4d72f4['query'][_0x5510('0x39')]));_0x32d1b6[_0x5510('0x38')]=_0x32d1b6['attributes'][_0x5510('0x3a')]?_0x32d1b6[_0x5510('0x38')]:_0x5652b0['model'];_0x32d1b6[_0x5510('0x3e')]=qs[_0x5510('0x3f')](_0x4d72f4[_0x5510('0x35')][_0x5510('0x3f')]);_0x32d1b6['where']=qs[_0x5510('0x36')](_['pick'](_0x4d72f4[_0x5510('0x35')],_0x5652b0[_0x5510('0x36')]));if(_0x4d72f4['query'][_0x5510('0x41')]){_0x32d1b6[_0x5510('0x40')]=_[_0x5510('0x42')](_0x32d1b6[_0x5510('0x40')],{'$or':_[_0x5510('0x31')](_0x32d1b6[_0x5510('0x38')],function(_0x568edb){var _0x29428c={};_0x29428c[_0x568edb]={'$like':'%'+_0x4d72f4['query']['filter']+'%'};return _0x29428c;})});}_0x32d1b6=_[_0x5510('0x42')]({},_0x32d1b6,_0x4d72f4[_0x5510('0x44')]);return _0x9683[_0x5510('0x65')](_0x32d1b6);}})['then'](function(_0x32641a){if(_0x32641a){_0x5d7df6=_0x32641a['length'];if(!_0x4d72f4[_0x5510('0x35')][_0x5510('0x3c')](_0x5510('0x3d'))){_0x32d1b6[_0x5510('0x1f')]=qs['limit'](_0x4d72f4[_0x5510('0x35')][_0x5510('0x1f')]);_0x32d1b6['offset']=qs[_0x5510('0x1d')](_0x4d72f4[_0x5510('0x35')][_0x5510('0x1d')]);}return _0x9683[_0x5510('0x65')](_0x32d1b6);}})[_0x5510('0x27')](function(_0x201f51){if(_0x201f51){return _0x201f51?{'count':_0x5d7df6,'rows':_0x201f51}:null;}})[_0x5510('0x27')](respondWithResult(_0x58c446,null))['catch'](handleError(_0x58c446,null));};exports[_0x5510('0x66')]=function(_0x271332,_0x20817e,_0x51f170){var _0x1773d3=_0x271332[_0x5510('0x58')][_0x5510('0x67')];return db[_0x5510('0x64')]['findAll']({'where':{'id':_0x1773d3},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5510('0x68'),'attributes':['id','name','online','voicePause','interface'],'raw':!![]}]})[_0x5510('0x27')](function(_0xc340e8){if(_0xc340e8){var _0x3e81af=_[_0x5510('0x69')](_0xc340e8,function(_0x4f4290){var _0x36a6da=_0x4f4290[_0x5510('0x29')]({'plain':!![]});return _0x36a6da[_0x5510('0x68')];});return db[_0x5510('0x45')][_0x5510('0x4e')]({'where':{'id':_0x271332[_0x5510('0x4b')]['id']}})[_0x5510('0x27')](function(_0x2b1751){return db['sequelize'][_0x5510('0x6a')](function(_0x878ce2){return _0x2b1751['addTeams'](_0x1773d3,{'transaction':_0x878ce2})[_0x5510('0x27')](function(){return BPromise[_0x5510('0x6b')](_0x3e81af,function(_0x29ee16){return db['UserFaxQueue']['findOrCreate']({'where':{'UserId':_0x29ee16['id'],'FaxQueueId':_0x271332[_0x5510('0x4b')]['id']},'transaction':_0x878ce2});});})[_0x5510('0x27')](function(){_0x3e81af[_0x5510('0x6c')](function(_0x3c2407){socket[_0x5510('0x6d')]('userFaxQueue:save',{'UserId':_0x3c2407['id'],'FaxQueueId':_0x2b1751['id']});});});});});}})['then'](respondWithStatusCode(_0x20817e,null))[_0x5510('0x49')](handleError(_0x20817e,null));};exports[_0x5510('0x6e')]=function(_0x4013cd,_0x239e4e,_0x1c827c){return db[_0x5510('0x64')][_0x5510('0x47')]({'where':{'id':_0x4013cd[_0x5510('0x35')][_0x5510('0x67')]},'attributes':['id'],'include':[{'model':db[_0x5510('0x5c')],'as':_0x5510('0x68'),'attributes':['id'],'raw':!![]}]})[_0x5510('0x27')](handleEntityNotFound(_0x239e4e,null))[_0x5510('0x27')](function(_0x1d921c){var _0x10e1fd=_[_0x5510('0x31')](_0x1d921c,'id');var _0x5db207=[];var _0x25a191=[];var _0x1abf3b=squel[_0x5510('0x6f')]();_0x1abf3b['field']('tq.TeamId')[_0x5510('0x70')]('team_has_fax_queues','tq')['join'](_0x5510('0x71'),'ut',_0x5510('0x72'))[_0x5510('0x40')]('FaxQueueId\x20=\x20?',_0x4013cd[_0x5510('0x4b')]['id']);for(var _0x4c1e84=0x0;_0x4c1e84<_0x1d921c[_0x5510('0x3a')];_0x4c1e84+=0x1){let _0x4f6935=_0x1d921c[_0x4c1e84];for(var _0x28a127=0x0;_0x28a127<_0x4f6935[_0x5510('0x68')]['length'];_0x28a127+=0x1){let _0x1643a9=_0x4f6935[_0x5510('0x68')][_0x28a127];var _0x4ae6c0=_0x1abf3b[_0x5510('0x73')]();_0x4ae6c0[_0x5510('0x40')](_0x5510('0x74'),_0x1643a9['id']);_0x25a191[_0x5510('0x75')](db[_0x5510('0x76')][_0x5510('0x35')](_0x4ae6c0[_0x5510('0x77')](),{'type':db[_0x5510('0x76')][_0x5510('0x78')]['SELECT']})['then'](function(_0x197fe6){if(_0x197fe6[_0x5510('0x3a')]===0x1){return _0x1643a9['id'];}else{var _0x505249=_[_0x5510('0x79')](_['map'](_0x197fe6,'TeamId'),function(_0x4d8f4a){return _[_0x5510('0x7a')](_0x10e1fd,_0x4d8f4a);});if(_0x505249){return _0x1643a9['id'];}}}));}}return BPromise['all'](_0x25a191)['then'](function(_0x10d0c7){_0x5db207=_(_0x5db207)[_0x5510('0x7b')](_0x10d0c7)[_0x5510('0x7c')]()['value']();return db[_0x5510('0x45')][_0x5510('0x4e')]({'where':{'id':_0x4013cd[_0x5510('0x4b')]['id']}})['then'](function(_0x4de32f){return db['sequelize'][_0x5510('0x6a')](function(_0x385a38){return _0x4de32f[_0x5510('0x6e')](_0x4013cd['query']['ids'],{'transaction':_0x385a38})[_0x5510('0x27')](function(){if(!_[_0x5510('0x7d')](_0x5db207)){return _0x4de32f[_0x5510('0x7e')](_0x5db207,{'transaction':_0x385a38});}})[_0x5510('0x27')](function(){_0x5db207['forEach'](function(_0x193d26){socket[_0x5510('0x6d')](_0x5510('0x7f'),{'UserId':_0x193d26,'FaxQueueId':_0x4de32f['id']});});});});});});})[_0x5510('0x27')](respondWithStatusCode(_0x239e4e,null))['catch'](handleError(_0x239e4e,null));};exports[_0x5510('0x80')]=function(_0x92f776,_0x4164ac,_0x357446){return db['FaxQueue'][_0x5510('0x4e')]({'where':{'id':_0x92f776[_0x5510('0x4b')]['id']}})[_0x5510('0x27')](handleEntityNotFound(_0x4164ac,null))[_0x5510('0x27')](function(_0x13187b){if(_0x13187b){return _0x13187b[_0x5510('0x80')](_0x92f776[_0x5510('0x58')][_0x5510('0x67')],_[_0x5510('0x81')](_0x92f776[_0x5510('0x58')],[_0x5510('0x67'),'id'])||{})[_0x5510('0x82')](function(_0x5c5760){for(var _0x4d7b65=0x0;_0x4d7b65<_0x92f776[_0x5510('0x58')][_0x5510('0x67')]['length'];_0x4d7b65+=0x1){socket[_0x5510('0x6d')](_0x5510('0x83'),{'UserId':Number(_0x92f776[_0x5510('0x58')]['ids'][_0x4d7b65]),'FaxQueueId':Number(_0x92f776[_0x5510('0x4b')]['id'])});}return _0x5c5760;});}})[_0x5510('0x27')](respondWithResult(_0x4164ac,null))[_0x5510('0x49')](handleError(_0x4164ac,null));};exports['removeAgents']=function(_0x5c3957,_0x20b3d8,_0x24d434){return db['FaxQueue'][_0x5510('0x4e')]({'where':{'id':_0x5c3957['params']['id']}})[_0x5510('0x27')](handleEntityNotFound(_0x20b3d8,null))[_0x5510('0x27')](function(_0x432625){if(_0x432625){return _0x432625[_0x5510('0x7e')](_0x5c3957['query'][_0x5510('0x67')])[_0x5510('0x27')](function(){if(_[_0x5510('0x84')](_0x5c3957['query'][_0x5510('0x67')])){for(var _0x212075=0x0;_0x212075<_0x5c3957[_0x5510('0x35')][_0x5510('0x67')][_0x5510('0x3a')];_0x212075+=0x1){socket[_0x5510('0x6d')]('userFaxQueue:remove',{'UserId':Number(_0x5c3957[_0x5510('0x35')][_0x5510('0x67')][_0x212075]),'FaxQueueId':Number(_0x5c3957['params']['id'])});}}else{socket[_0x5510('0x6d')]('userFaxQueue:remove',{'UserId':Number(_0x5c3957[_0x5510('0x35')][_0x5510('0x67')]),'FaxQueueId':Number(_0x5c3957['params']['id'])});}});}})['then'](respondWithStatusCode(_0x20b3d8,null))[_0x5510('0x49')](handleError(_0x20b3d8,null));};exports[_0x5510('0x85')]=function(_0xa791cb,_0x4b358d,_0x281162){var _0x493a89={};var _0x453096={};var _0xa11e7b;var _0x4664d4;return db[_0x5510('0x45')][_0x5510('0x63')]({'where':{'id':_0xa791cb[_0x5510('0x4b')]['id']}})[_0x5510('0x27')](handleEntityNotFound(_0x4b358d,null))[_0x5510('0x27')](function(_0x1ec4cb){if(_0x1ec4cb){_0xa11e7b=_0x1ec4cb;_0x453096['model']=_[_0x5510('0x4c')](db[_0x5510('0x5c')][_0x5510('0x32')]);_0x453096[_0x5510('0x35')]=_[_0x5510('0x4c')](_0xa791cb[_0x5510('0x35')]);_0x453096[_0x5510('0x36')]=_[_0x5510('0x37')](_0x453096[_0x5510('0x3b')],_0x453096[_0x5510('0x35')]);_0x493a89['attributes']=_['intersection'](_0x453096['model'],qs[_0x5510('0x39')](_0xa791cb[_0x5510('0x35')][_0x5510('0x39')]));_0x493a89[_0x5510('0x38')]=_0x493a89[_0x5510('0x38')][_0x5510('0x3a')]?_0x493a89[_0x5510('0x38')]:_0x453096['model'];_0x493a89[_0x5510('0x3e')]=qs['sort'](_0xa791cb[_0x5510('0x35')]['sort']);_0x493a89[_0x5510('0x40')]=qs[_0x5510('0x36')](_[_0x5510('0x5b')](_0xa791cb[_0x5510('0x35')],_0x453096['filters']));if(_0xa791cb[_0x5510('0x35')]['filter']){_0x493a89[_0x5510('0x40')]=_[_0x5510('0x42')](_0x493a89[_0x5510('0x40')],{'$or':_['map'](_0x493a89[_0x5510('0x38')],function(_0xdc53f1){var _0x2bc49c={};_0x2bc49c[_0xdc53f1]={'$like':'%'+_0xa791cb[_0x5510('0x35')]['filter']+'%'};return _0x2bc49c;})});}_0x493a89=_[_0x5510('0x42')]({},_0x493a89,_0xa791cb[_0x5510('0x44')]);return _0xa11e7b[_0x5510('0x85')](_0x493a89);}})['then'](function(_0x5d2206){if(_0x5d2206){_0x4664d4=_0x5d2206[_0x5510('0x3a')];if(!_0xa791cb['query']['hasOwnProperty'](_0x5510('0x3d'))){_0x493a89['limit']=qs[_0x5510('0x1f')](_0xa791cb[_0x5510('0x35')][_0x5510('0x1f')]);_0x493a89[_0x5510('0x1d')]=qs[_0x5510('0x1d')](_0xa791cb[_0x5510('0x35')][_0x5510('0x1d')]);}return _0xa11e7b['getAgents'](_0x493a89);}})[_0x5510('0x27')](function(_0x478bbb){if(_0x478bbb){return _0x478bbb?{'count':_0x4664d4,'rows':_0x478bbb}:null;}})[_0x5510('0x27')](respondWithResult(_0x4b358d,null))[_0x5510('0x49')](handleError(_0x4b358d,null));}; \ No newline at end of file +var _0x2ca0=['forEach','emit','removeTeams','select','field','tq.TeamId','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','union','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','getAgents','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','FaxQueues','then','error','name','send','map','FaxQueue','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','catch','show','keys','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','findAll','User','findAndCountAll','UserId','faxPause','updatedAt','createdAt','rows','format','%s/%s','SIP','Team','getTeams','ids','Agents','flatMap','sequelize','addTeams','each','findOrCreate'];(function(_0xbc1ccb,_0x4e040c){var _0x57c83a=function(_0x516ef3){while(--_0x516ef3){_0xbc1ccb['push'](_0xbc1ccb['shift']());}};_0x57c83a(++_0x4e040c);}(_0x2ca0,0x128));var _0x02ca=function(_0x21b1e0,_0x59d6e4){_0x21b1e0=_0x21b1e0-0x0;var _0x18e44c=_0x2ca0[_0x21b1e0];return _0x18e44c;};'use strict';var emlformat=require(_0x02ca('0x0'));var rimraf=require(_0x02ca('0x1'));var zipdir=require(_0x02ca('0x2'));var jsonpatch=require(_0x02ca('0x3'));var rp=require(_0x02ca('0x4'));var moment=require(_0x02ca('0x5'));var BPromise=require(_0x02ca('0x6'));var Mustache=require(_0x02ca('0x7'));var util=require(_0x02ca('0x8'));var path=require(_0x02ca('0x9'));var sox=require(_0x02ca('0xa'));var csv=require(_0x02ca('0xb'));var ejs=require(_0x02ca('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x02ca('0xd'));var squel=require(_0x02ca('0xe'));var crypto=require(_0x02ca('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x02ca('0x10'));var toCsv=require(_0x02ca('0xb'));var querystring=require(_0x02ca('0x11'));var Papa=require('papaparse');var Redis=require(_0x02ca('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x02ca('0x13'));var as=require(_0x02ca('0x14'));var hardwareService=require(_0x02ca('0x15'));var logger=require(_0x02ca('0x16'))('api');var utils=require(_0x02ca('0x17'));var config=require(_0x02ca('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x02ca('0x19'))['db'];config[_0x02ca('0x1a')]=_[_0x02ca('0x1b')](config[_0x02ca('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x02ca('0x1c'))(new Redis(config[_0x02ca('0x1a')]));require('./faxQueue.socket')[_0x02ca('0x1d')](socket);function respondWithStatusCode(_0x31446f,_0xe46eda){_0xe46eda=_0xe46eda||0xcc;return function(_0x5b212f){if(_0x5b212f){return _0x31446f[_0x02ca('0x1e')](_0xe46eda);}return _0x31446f[_0x02ca('0x1f')](_0xe46eda)['end']();};}function respondWithResult(_0x31a305,_0x46c624){_0x46c624=_0x46c624||0xc8;return function(_0x3b0bb8){if(_0x3b0bb8){return _0x31a305[_0x02ca('0x1f')](_0x46c624)[_0x02ca('0x20')](_0x3b0bb8);}};}function respondWithFilteredResult(_0x5ac2ba,_0x40e758){return function(_0x205624){if(_0x205624){var _0x5e4fe3=typeof _0x40e758[_0x02ca('0x21')]===_0x02ca('0x22')&&typeof _0x40e758[_0x02ca('0x23')]===_0x02ca('0x22');var _0x46c712=_0x205624[_0x02ca('0x24')];var _0x40e074=_0x5e4fe3?0x0:_0x40e758[_0x02ca('0x21')];var _0x3ebd82=_0x5e4fe3?_0x205624[_0x02ca('0x24')]:_0x40e758[_0x02ca('0x21')]+_0x40e758['limit'];var _0x24019c;if(_0x3ebd82>=_0x46c712){_0x3ebd82=_0x46c712;_0x24019c=0xc8;}else{_0x24019c=0xce;}_0x5ac2ba['status'](_0x24019c);return _0x5ac2ba['set'](_0x02ca('0x25'),_0x40e074+'-'+_0x3ebd82+'/'+_0x46c712)[_0x02ca('0x20')](_0x205624);}return null;};}function patchUpdates(_0x5b2fce){return function(_0x3e351d){try{jsonpatch[_0x02ca('0x26')](_0x3e351d,_0x5b2fce,!![]);}catch(_0x54075e){return BPromise[_0x02ca('0x27')](_0x54075e);}return _0x3e351d[_0x02ca('0x28')]();};}function saveUpdates(_0x36146c,_0x1ae551){return function(_0x577b47){if(_0x577b47){return _0x577b47[_0x02ca('0x29')](_0x36146c)['then'](function(_0x4ae9aa){return _0x4ae9aa;});}return null;};}function removeEntity(_0x5b9a75,_0x1b7c8c){return function(_0x35ca90){if(_0x35ca90){return _0x35ca90[_0x02ca('0x2a')]()['then'](function(){var _0x1915db=_0x35ca90['get']({'plain':!![]});var _0x3a418a=_0x02ca('0x2b');return db['UserProfileResource'][_0x02ca('0x2a')]({'where':{'type':_0x3a418a,'resourceId':_0x1915db['id']}})[_0x02ca('0x2c')](function(){return _0x35ca90;});})[_0x02ca('0x2c')](function(){_0x5b9a75[_0x02ca('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16dc08,_0x552a37){return function(_0x2a7762){if(!_0x2a7762){_0x16dc08['sendStatus'](0x194);}return _0x2a7762;};}function handleError(_0x57c71d,_0x224913){_0x224913=_0x224913||0x1f4;return function(_0x4432db){logger[_0x02ca('0x2d')](_0x4432db['stack']);if(_0x4432db[_0x02ca('0x2e')]){delete _0x4432db[_0x02ca('0x2e')];}_0x57c71d[_0x02ca('0x1f')](_0x224913)[_0x02ca('0x2f')](_0x4432db);};}exports['index']=function(_0x564e83,_0x20beb6){var _0x4535dd={},_0x3cb1ae={},_0x5008c1={'count':0x0,'rows':[]};var _0x533e37=_[_0x02ca('0x30')](db[_0x02ca('0x31')][_0x02ca('0x32')],function(_0x32ba7e){return{'name':_0x32ba7e[_0x02ca('0x33')],'type':_0x32ba7e[_0x02ca('0x34')][_0x02ca('0x35')]};});_0x3cb1ae['model']=_[_0x02ca('0x30')](_0x533e37,'name');_0x3cb1ae[_0x02ca('0x36')]=_['keys'](_0x564e83[_0x02ca('0x36')]);_0x3cb1ae[_0x02ca('0x37')]=_[_0x02ca('0x38')](_0x3cb1ae[_0x02ca('0x39')],_0x3cb1ae[_0x02ca('0x36')]);_0x4535dd[_0x02ca('0x3a')]=_[_0x02ca('0x38')](_0x3cb1ae[_0x02ca('0x39')],qs[_0x02ca('0x3b')](_0x564e83[_0x02ca('0x36')][_0x02ca('0x3b')]));_0x4535dd[_0x02ca('0x3a')]=_0x4535dd[_0x02ca('0x3a')][_0x02ca('0x3c')]?_0x4535dd[_0x02ca('0x3a')]:_0x3cb1ae[_0x02ca('0x39')];if(!_0x564e83[_0x02ca('0x36')]['hasOwnProperty'](_0x02ca('0x3d'))){_0x4535dd['limit']=qs[_0x02ca('0x23')](_0x564e83[_0x02ca('0x36')][_0x02ca('0x23')]);_0x4535dd[_0x02ca('0x21')]=qs[_0x02ca('0x21')](_0x564e83[_0x02ca('0x36')][_0x02ca('0x21')]);}_0x4535dd[_0x02ca('0x3e')]=qs[_0x02ca('0x3f')](_0x564e83[_0x02ca('0x36')][_0x02ca('0x3f')]);_0x4535dd['where']=qs[_0x02ca('0x37')](_['pick'](_0x564e83[_0x02ca('0x36')],_0x3cb1ae['filters']),_0x533e37);if(_0x564e83[_0x02ca('0x36')][_0x02ca('0x40')]){_0x4535dd[_0x02ca('0x41')]=_[_0x02ca('0x42')](_0x4535dd[_0x02ca('0x41')],{'$or':_[_0x02ca('0x30')](_0x533e37,function(_0x15a570){if(_0x15a570[_0x02ca('0x34')]!==_0x02ca('0x43')){var _0x32756f={};_0x32756f[_0x15a570['name']]={'$like':'%'+_0x564e83[_0x02ca('0x36')][_0x02ca('0x40')]+'%'};return _0x32756f;}})});}_0x4535dd=_['merge']({},_0x4535dd,_0x564e83[_0x02ca('0x44')]);var _0x59fa19={'where':_0x4535dd[_0x02ca('0x41')]};return db[_0x02ca('0x31')][_0x02ca('0x24')](_0x59fa19)[_0x02ca('0x2c')](function(_0x5bd0cd){_0x5008c1[_0x02ca('0x24')]=_0x5bd0cd;if(_0x564e83['query'][_0x02ca('0x45')]){_0x4535dd[_0x02ca('0x46')]=[{'all':!![]}];}return db[_0x02ca('0x31')]['findAll'](_0x4535dd);})['then'](function(_0x309237){_0x5008c1['rows']=_0x309237;return _0x5008c1;})[_0x02ca('0x2c')](respondWithFilteredResult(_0x20beb6,_0x4535dd))[_0x02ca('0x47')](handleError(_0x20beb6,null));};exports[_0x02ca('0x48')]=function(_0x3e9712,_0x565a19){var _0x43810e={'raw':!![],'where':{'id':_0x3e9712['params']['id']}},_0x546670={};_0x546670[_0x02ca('0x39')]=_[_0x02ca('0x49')](db[_0x02ca('0x31')]['rawAttributes']);_0x546670['query']=_[_0x02ca('0x49')](_0x3e9712[_0x02ca('0x36')]);_0x546670[_0x02ca('0x37')]=_[_0x02ca('0x38')](_0x546670['model'],_0x546670[_0x02ca('0x36')]);_0x43810e[_0x02ca('0x3a')]=_[_0x02ca('0x38')](_0x546670[_0x02ca('0x39')],qs[_0x02ca('0x3b')](_0x3e9712[_0x02ca('0x36')][_0x02ca('0x3b')]));_0x43810e['attributes']=_0x43810e[_0x02ca('0x3a')][_0x02ca('0x3c')]?_0x43810e[_0x02ca('0x3a')]:_0x546670['model'];if(_0x3e9712['query'][_0x02ca('0x45')]){_0x43810e[_0x02ca('0x46')]=[{'all':!![]}];}_0x43810e=_['merge']({},_0x43810e,_0x3e9712[_0x02ca('0x44')]);return db['FaxQueue']['find'](_0x43810e)[_0x02ca('0x2c')](handleEntityNotFound(_0x565a19,null))[_0x02ca('0x2c')](respondWithResult(_0x565a19,null))[_0x02ca('0x47')](handleError(_0x565a19,null));};exports[_0x02ca('0x4a')]=function(_0x527fbe,_0x104dc2){return db[_0x02ca('0x31')][_0x02ca('0x4a')](_0x527fbe[_0x02ca('0x4b')],{})[_0x02ca('0x2c')](function(_0x3e764a){var _0x516a46=_0x527fbe['user'][_0x02ca('0x4c')]({'plain':!![]});if(!_0x516a46)throw new Error(_0x02ca('0x4d'));if(_0x516a46[_0x02ca('0x4e')]===_0x02ca('0x4f')){var _0x2aa2e0=_0x3e764a[_0x02ca('0x4c')]({'plain':!![]});var _0x32e395=_0x02ca('0x2b');return db[_0x02ca('0x50')][_0x02ca('0x51')]({'where':{'name':_0x32e395,'userProfileId':_0x516a46[_0x02ca('0x52')]},'raw':!![]})[_0x02ca('0x2c')](function(_0x5944b8){if(_0x5944b8&&_0x5944b8[_0x02ca('0x53')]===0x0){return db[_0x02ca('0x54')]['create']({'name':_0x2aa2e0['name'],'resourceId':_0x2aa2e0['id'],'type':_0x5944b8['name'],'sectionId':_0x5944b8['id']},{})[_0x02ca('0x2c')](function(){return _0x3e764a;});}else{return _0x3e764a;}})[_0x02ca('0x47')](function(_0x3f1528){logger[_0x02ca('0x2d')](_0x02ca('0x55'),_0x3f1528);throw _0x3f1528;});}return _0x3e764a;})['then'](respondWithResult(_0x104dc2,0xc9))[_0x02ca('0x47')](handleError(_0x104dc2,null));};exports[_0x02ca('0x29')]=function(_0x3ea6a8,_0x1eb25d){if(_0x3ea6a8[_0x02ca('0x4b')]['id']){delete _0x3ea6a8[_0x02ca('0x4b')]['id'];}return db[_0x02ca('0x31')]['find']({'where':{'id':_0x3ea6a8[_0x02ca('0x56')]['id']}})['then'](handleEntityNotFound(_0x1eb25d,null))['then'](saveUpdates(_0x3ea6a8['body'],null))[_0x02ca('0x2c')](respondWithResult(_0x1eb25d,null))['catch'](handleError(_0x1eb25d,null));};exports['destroy']=function(_0xaa80a2,_0x1bdff3){return db[_0x02ca('0x31')][_0x02ca('0x51')]({'where':{'id':_0xaa80a2['params']['id']}})[_0x02ca('0x2c')](handleEntityNotFound(_0x1bdff3,null))[_0x02ca('0x2c')](removeEntity(_0x1bdff3,null))[_0x02ca('0x47')](handleError(_0x1bdff3,null));};exports[_0x02ca('0x57')]=function(_0x42fac7,_0x5f1937){return db[_0x02ca('0x31')][_0x02ca('0x57')]()[_0x02ca('0x2c')](respondWithResult(_0x5f1937,null))[_0x02ca('0x47')](handleError(_0x5f1937,null));};exports[_0x02ca('0x58')]=function(_0x9527bb,_0x5116c6,_0x564f3f){var _0x3976a7={'raw':!![],'where':{}},_0x121508={},_0x1e2372;return db['FaxQueue'][_0x02ca('0x59')]({'where':{'id':_0x9527bb[_0x02ca('0x56')]['id']}})['then'](handleEntityNotFound(_0x5116c6,null))[_0x02ca('0x2c')](function(_0x28772f){if(_0x28772f){_0x1e2372=_0x28772f[_0x02ca('0x4c')]({'plain':!![]});_0x121508['model']=_[_0x02ca('0x49')](db[_0x02ca('0x5a')][_0x02ca('0x32')]);_0x121508['query']=_['keys'](_0x9527bb['query']);_0x121508[_0x02ca('0x37')]=_[_0x02ca('0x38')](_0x121508[_0x02ca('0x39')],_0x121508[_0x02ca('0x36')]);_0x3976a7['attributes']=_[_0x02ca('0x38')](_0x121508[_0x02ca('0x39')],qs['fields'](_0x9527bb[_0x02ca('0x36')][_0x02ca('0x3b')]));_0x3976a7[_0x02ca('0x3a')]=_0x3976a7[_0x02ca('0x3a')][_0x02ca('0x3c')]?_0x3976a7['attributes']:_0x121508[_0x02ca('0x39')];if(!_0x9527bb[_0x02ca('0x36')][_0x02ca('0x5b')](_0x02ca('0x3d'))){_0x3976a7['limit']=qs[_0x02ca('0x23')](_0x9527bb[_0x02ca('0x36')][_0x02ca('0x23')]);_0x3976a7[_0x02ca('0x21')]=qs[_0x02ca('0x21')](_0x9527bb[_0x02ca('0x36')]['offset']);}_0x3976a7[_0x02ca('0x3e')]=qs[_0x02ca('0x3f')](_0x9527bb['query'][_0x02ca('0x3f')]);_0x3976a7['where']=qs[_0x02ca('0x37')](_['pick'](_0x9527bb[_0x02ca('0x36')],_0x121508[_0x02ca('0x37')]));_0x3976a7['where']['FaxQueueId']=_0x28772f['id'];if(_0x9527bb['query']['filter']){_0x3976a7[_0x02ca('0x41')]=_[_0x02ca('0x42')](_0x3976a7[_0x02ca('0x41')],{'$or':_[_0x02ca('0x30')](_0x3976a7['attributes'],function(_0x18cbb5){var _0x29d58a={};_0x29d58a[_0x18cbb5]={'$like':'%'+_0x9527bb[_0x02ca('0x36')]['filter']+'%'};return _0x29d58a;})});}_0x3976a7=_[_0x02ca('0x42')]({},_0x3976a7,_0x9527bb['options']);return db['UserFaxQueue'][_0x02ca('0x5c')](_0x3976a7);}})[_0x02ca('0x2c')](function(_0x595aa8){if(_0x595aa8){return db[_0x02ca('0x5d')][_0x02ca('0x5e')]({'where':{'id':_['map'](_0x595aa8,_0x02ca('0x5f')),'role':'agent'},'attributes':['id',_0x02ca('0x2e'),_0x02ca('0x60'),_0x02ca('0x61'),_0x02ca('0x62')]});}})[_0x02ca('0x2c')](function(_0x164b7f){if(_0x164b7f){return{'count':_0x164b7f[_0x02ca('0x24')],'rows':_[_0x02ca('0x30')](_0x164b7f[_0x02ca('0x63')],function(_0x31b836){return{'membername':_0x31b836[_0x02ca('0x2e')],'UserId':_0x31b836['id'],'queue_name':_0x1e2372[_0x02ca('0x2e')],'FaxQueueId':_0x1e2372['id'],'interface':util[_0x02ca('0x64')](_0x02ca('0x65'),_0x02ca('0x66'),_0x31b836[_0x02ca('0x2e')]),'penalty':0x0,'paused':_0x31b836[_0x02ca('0x60')],'createdAt':_0x31b836['createdAt'],'updatedAt':_0x31b836[_0x02ca('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5116c6,_0x3976a7))[_0x02ca('0x47')](handleError(_0x5116c6,null));};exports['getTeams']=function(_0x318694,_0x3a2384,_0x3570c5){var _0x2a55f4={};var _0x3c7e7b={};var _0x3fa08b;var _0x2d49fc;return db[_0x02ca('0x31')]['findOne']({'where':{'id':_0x318694[_0x02ca('0x56')]['id']}})[_0x02ca('0x2c')](handleEntityNotFound(_0x3a2384,null))[_0x02ca('0x2c')](function(_0xb619a3){if(_0xb619a3){_0x3fa08b=_0xb619a3;_0x3c7e7b['model']=_['keys'](db[_0x02ca('0x67')][_0x02ca('0x32')]);_0x3c7e7b[_0x02ca('0x36')]=_[_0x02ca('0x49')](_0x318694['query']);_0x3c7e7b[_0x02ca('0x37')]=_['intersection'](_0x3c7e7b[_0x02ca('0x39')],_0x3c7e7b[_0x02ca('0x36')]);_0x2a55f4[_0x02ca('0x3a')]=_['intersection'](_0x3c7e7b[_0x02ca('0x39')],qs[_0x02ca('0x3b')](_0x318694[_0x02ca('0x36')][_0x02ca('0x3b')]));_0x2a55f4['attributes']=_0x2a55f4['attributes']['length']?_0x2a55f4['attributes']:_0x3c7e7b[_0x02ca('0x39')];_0x2a55f4[_0x02ca('0x3e')]=qs[_0x02ca('0x3f')](_0x318694[_0x02ca('0x36')][_0x02ca('0x3f')]);_0x2a55f4[_0x02ca('0x41')]=qs[_0x02ca('0x37')](_['pick'](_0x318694[_0x02ca('0x36')],_0x3c7e7b['filters']));if(_0x318694['query']['filter']){_0x2a55f4[_0x02ca('0x41')]=_[_0x02ca('0x42')](_0x2a55f4[_0x02ca('0x41')],{'$or':_['map'](_0x2a55f4[_0x02ca('0x3a')],function(_0x335983){var _0x3aad78={};_0x3aad78[_0x335983]={'$like':'%'+_0x318694['query'][_0x02ca('0x40')]+'%'};return _0x3aad78;})});}_0x2a55f4=_[_0x02ca('0x42')]({},_0x2a55f4,_0x318694[_0x02ca('0x44')]);return _0x3fa08b[_0x02ca('0x68')](_0x2a55f4);}})[_0x02ca('0x2c')](function(_0x102a15){if(_0x102a15){_0x2d49fc=_0x102a15[_0x02ca('0x3c')];if(!_0x318694[_0x02ca('0x36')][_0x02ca('0x5b')](_0x02ca('0x3d'))){_0x2a55f4['limit']=qs['limit'](_0x318694[_0x02ca('0x36')][_0x02ca('0x23')]);_0x2a55f4[_0x02ca('0x21')]=qs[_0x02ca('0x21')](_0x318694[_0x02ca('0x36')][_0x02ca('0x21')]);}return _0x3fa08b[_0x02ca('0x68')](_0x2a55f4);}})[_0x02ca('0x2c')](function(_0x59019c){if(_0x59019c){return _0x59019c?{'count':_0x2d49fc,'rows':_0x59019c}:null;}})[_0x02ca('0x2c')](respondWithResult(_0x3a2384,null))['catch'](handleError(_0x3a2384,null));};exports['addTeams']=function(_0x5c915e,_0x5966b6,_0x211adb){var _0x24cdba=_0x5c915e[_0x02ca('0x4b')][_0x02ca('0x69')];return db['Team'][_0x02ca('0x5c')]({'where':{'id':_0x24cdba},'attributes':['id'],'include':[{'model':db[_0x02ca('0x5d')],'as':_0x02ca('0x6a'),'attributes':['id',_0x02ca('0x2e'),'online','voicePause','interface'],'raw':!![]}]})[_0x02ca('0x2c')](function(_0x47bcd5){if(_0x47bcd5){var _0x139def=_[_0x02ca('0x6b')](_0x47bcd5,function(_0x45d18b){var _0x4b0cbc=_0x45d18b[_0x02ca('0x4c')]({'plain':!![]});return _0x4b0cbc['Agents'];});return db[_0x02ca('0x31')][_0x02ca('0x51')]({'where':{'id':_0x5c915e[_0x02ca('0x56')]['id']}})[_0x02ca('0x2c')](function(_0x54583b){return db[_0x02ca('0x6c')]['transaction'](function(_0x49f2f6){return _0x54583b[_0x02ca('0x6d')](_0x24cdba,{'transaction':_0x49f2f6})[_0x02ca('0x2c')](function(){return BPromise[_0x02ca('0x6e')](_0x139def,function(_0x4e56b3){return db['UserFaxQueue'][_0x02ca('0x6f')]({'where':{'UserId':_0x4e56b3['id'],'FaxQueueId':_0x5c915e['params']['id']},'transaction':_0x49f2f6});});})[_0x02ca('0x2c')](function(){_0x139def[_0x02ca('0x70')](function(_0x5a10e6){socket[_0x02ca('0x71')]('userFaxQueue:save',{'UserId':_0x5a10e6['id'],'FaxQueueId':_0x54583b['id']});});});});});}})[_0x02ca('0x2c')](respondWithStatusCode(_0x5966b6,null))[_0x02ca('0x47')](handleError(_0x5966b6,null));};exports[_0x02ca('0x72')]=function(_0x171c92,_0xf205e8,_0x466030){return db[_0x02ca('0x67')][_0x02ca('0x5c')]({'where':{'id':_0x171c92[_0x02ca('0x36')][_0x02ca('0x69')]},'attributes':['id'],'include':[{'model':db[_0x02ca('0x5d')],'as':_0x02ca('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x02ca('0x2c')](handleEntityNotFound(_0xf205e8,null))[_0x02ca('0x2c')](function(_0x49382d){var _0x2ba14b=_[_0x02ca('0x30')](_0x49382d,'id');var _0x4cbf01=[];var _0x120ae8=[];var _0x255a0e=squel[_0x02ca('0x73')]();_0x255a0e[_0x02ca('0x74')](_0x02ca('0x75'))['from'](_0x02ca('0x76'),'tq')[_0x02ca('0x77')](_0x02ca('0x78'),'ut',_0x02ca('0x79'))['where'](_0x02ca('0x7a'),_0x171c92[_0x02ca('0x56')]['id']);for(var _0x18a873=0x0;_0x18a873<_0x49382d[_0x02ca('0x3c')];_0x18a873+=0x1){let _0x58b125=_0x49382d[_0x18a873];for(var _0x239d9b=0x0;_0x239d9b<_0x58b125['Agents']['length'];_0x239d9b+=0x1){let _0x527dde=_0x58b125['Agents'][_0x239d9b];var _0x3642ad=_0x255a0e['clone']();_0x3642ad[_0x02ca('0x41')]('ut.UserId\x20=\x20?',_0x527dde['id']);_0x120ae8['push'](db[_0x02ca('0x6c')][_0x02ca('0x36')](_0x3642ad[_0x02ca('0x7b')](),{'type':db[_0x02ca('0x6c')][_0x02ca('0x7c')][_0x02ca('0x7d')]})[_0x02ca('0x2c')](function(_0x2ed124){if(_0x2ed124['length']===0x1){return _0x527dde['id'];}else{var _0xf434a4=_[_0x02ca('0x7e')](_[_0x02ca('0x30')](_0x2ed124,'TeamId'),function(_0x16fe7e){return _[_0x02ca('0x7f')](_0x2ba14b,_0x16fe7e);});if(_0xf434a4){return _0x527dde['id'];}}}));}}return BPromise['all'](_0x120ae8)['then'](function(_0x15f336){_0x4cbf01=_(_0x4cbf01)[_0x02ca('0x80')](_0x15f336)['compact']()[_0x02ca('0x81')]();return db['FaxQueue'][_0x02ca('0x51')]({'where':{'id':_0x171c92['params']['id']}})[_0x02ca('0x2c')](function(_0xcff70e){return db[_0x02ca('0x6c')]['transaction'](function(_0x1522cb){return _0xcff70e[_0x02ca('0x72')](_0x171c92['query'][_0x02ca('0x69')],{'transaction':_0x1522cb})[_0x02ca('0x2c')](function(){if(!_[_0x02ca('0x82')](_0x4cbf01)){return _0xcff70e[_0x02ca('0x83')](_0x4cbf01,{'transaction':_0x1522cb});}})[_0x02ca('0x2c')](function(){_0x4cbf01[_0x02ca('0x70')](function(_0x5097aa){socket[_0x02ca('0x71')](_0x02ca('0x84'),{'UserId':_0x5097aa,'FaxQueueId':_0xcff70e['id']});});});});});});})['then'](respondWithStatusCode(_0xf205e8,null))[_0x02ca('0x47')](handleError(_0xf205e8,null));};exports[_0x02ca('0x85')]=function(_0x5094e4,_0x5f58f3,_0x29a9e5){return db['FaxQueue'][_0x02ca('0x51')]({'where':{'id':_0x5094e4[_0x02ca('0x56')]['id']}})[_0x02ca('0x2c')](handleEntityNotFound(_0x5f58f3,null))[_0x02ca('0x2c')](function(_0x53913c){if(_0x53913c){return _0x53913c['addAgents'](_0x5094e4['body'][_0x02ca('0x69')],_['omit'](_0x5094e4[_0x02ca('0x4b')],[_0x02ca('0x69'),'id'])||{})['spread'](function(_0x56ac9e){for(var _0x4293d7=0x0;_0x4293d7<_0x5094e4[_0x02ca('0x4b')][_0x02ca('0x69')][_0x02ca('0x3c')];_0x4293d7+=0x1){socket[_0x02ca('0x71')]('userFaxQueue:save',{'UserId':Number(_0x5094e4[_0x02ca('0x4b')][_0x02ca('0x69')][_0x4293d7]),'FaxQueueId':Number(_0x5094e4[_0x02ca('0x56')]['id'])});}return _0x56ac9e;});}})['then'](respondWithResult(_0x5f58f3,null))[_0x02ca('0x47')](handleError(_0x5f58f3,null));};exports[_0x02ca('0x83')]=function(_0x1cc1de,_0x2e8e78,_0x2121e4){return db[_0x02ca('0x31')][_0x02ca('0x51')]({'where':{'id':_0x1cc1de[_0x02ca('0x56')]['id']}})[_0x02ca('0x2c')](handleEntityNotFound(_0x2e8e78,null))['then'](function(_0x1ba79f){if(_0x1ba79f){return _0x1ba79f[_0x02ca('0x83')](_0x1cc1de[_0x02ca('0x36')][_0x02ca('0x69')])[_0x02ca('0x2c')](function(){if(_['isArray'](_0x1cc1de[_0x02ca('0x36')]['ids'])){for(var _0x358044=0x0;_0x358044<_0x1cc1de[_0x02ca('0x36')][_0x02ca('0x69')][_0x02ca('0x3c')];_0x358044+=0x1){socket[_0x02ca('0x71')](_0x02ca('0x84'),{'UserId':Number(_0x1cc1de[_0x02ca('0x36')]['ids'][_0x358044]),'FaxQueueId':Number(_0x1cc1de[_0x02ca('0x56')]['id'])});}}else{socket['emit'](_0x02ca('0x84'),{'UserId':Number(_0x1cc1de['query'][_0x02ca('0x69')]),'FaxQueueId':Number(_0x1cc1de[_0x02ca('0x56')]['id'])});}});}})[_0x02ca('0x2c')](respondWithStatusCode(_0x2e8e78,null))['catch'](handleError(_0x2e8e78,null));};exports[_0x02ca('0x86')]=function(_0x5d4914,_0x3a16ce,_0x40fceb){var _0x2a8fe9={};var _0x55663d={};var _0x2125fc;var _0x4c03d;return db[_0x02ca('0x31')][_0x02ca('0x59')]({'where':{'id':_0x5d4914['params']['id']}})[_0x02ca('0x2c')](handleEntityNotFound(_0x3a16ce,null))['then'](function(_0x4f576b){if(_0x4f576b){_0x2125fc=_0x4f576b;_0x55663d[_0x02ca('0x39')]=_[_0x02ca('0x49')](db[_0x02ca('0x5d')][_0x02ca('0x32')]);_0x55663d['query']=_[_0x02ca('0x49')](_0x5d4914[_0x02ca('0x36')]);_0x55663d['filters']=_[_0x02ca('0x38')](_0x55663d[_0x02ca('0x39')],_0x55663d[_0x02ca('0x36')]);_0x2a8fe9[_0x02ca('0x3a')]=_[_0x02ca('0x38')](_0x55663d[_0x02ca('0x39')],qs['fields'](_0x5d4914[_0x02ca('0x36')][_0x02ca('0x3b')]));_0x2a8fe9[_0x02ca('0x3a')]=_0x2a8fe9[_0x02ca('0x3a')][_0x02ca('0x3c')]?_0x2a8fe9[_0x02ca('0x3a')]:_0x55663d['model'];_0x2a8fe9[_0x02ca('0x3e')]=qs['sort'](_0x5d4914[_0x02ca('0x36')]['sort']);_0x2a8fe9[_0x02ca('0x41')]=qs[_0x02ca('0x37')](_[_0x02ca('0x87')](_0x5d4914[_0x02ca('0x36')],_0x55663d[_0x02ca('0x37')]));if(_0x5d4914[_0x02ca('0x36')][_0x02ca('0x40')]){_0x2a8fe9[_0x02ca('0x41')]=_[_0x02ca('0x42')](_0x2a8fe9[_0x02ca('0x41')],{'$or':_[_0x02ca('0x30')](_0x2a8fe9[_0x02ca('0x3a')],function(_0x217aa4){var _0x143268={};_0x143268[_0x217aa4]={'$like':'%'+_0x5d4914[_0x02ca('0x36')][_0x02ca('0x40')]+'%'};return _0x143268;})});}_0x2a8fe9=_[_0x02ca('0x42')]({},_0x2a8fe9,_0x5d4914[_0x02ca('0x44')]);return _0x2125fc['getAgents'](_0x2a8fe9);}})[_0x02ca('0x2c')](function(_0x3502b7){if(_0x3502b7){_0x4c03d=_0x3502b7[_0x02ca('0x3c')];if(!_0x5d4914['query'][_0x02ca('0x5b')](_0x02ca('0x3d'))){_0x2a8fe9[_0x02ca('0x23')]=qs[_0x02ca('0x23')](_0x5d4914[_0x02ca('0x36')][_0x02ca('0x23')]);_0x2a8fe9[_0x02ca('0x21')]=qs[_0x02ca('0x21')](_0x5d4914['query'][_0x02ca('0x21')]);}return _0x2125fc[_0x02ca('0x86')](_0x2a8fe9);}})[_0x02ca('0x2c')](function(_0x1ee26e){if(_0x1ee26e){return _0x1ee26e?{'count':_0x4c03d,'rows':_0x1ee26e}:null;}})[_0x02ca('0x2c')](respondWithResult(_0x3a16ce,null))[_0x02ca('0x47')](handleError(_0x3a16ce,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 5ba2235..3e13444 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 _0x6d5f=['events','../../mysqldb','FaxQueue','setMaxListeners','save','update','emit','hook'];(function(_0x25c454,_0x190f0d){var _0x955617=function(_0x430210){while(--_0x430210){_0x25c454['push'](_0x25c454['shift']());}};_0x955617(++_0x190f0d);}(_0x6d5f,0x1b0));var _0xf6d5=function(_0x396701,_0x1600e2){_0x396701=_0x396701-0x0;var _0x5df190=_0x6d5f[_0x396701];return _0x5df190;};'use strict';var EventEmitter=require(_0xf6d5('0x0'));var FaxQueue=require(_0xf6d5('0x1'))['db'][_0xf6d5('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xf6d5('0x3')](0x0);var events={'afterCreate':_0xf6d5('0x4'),'afterUpdate':_0xf6d5('0x5'),'afterDestroy':'remove'};function emitEvent(_0x28f012){return function(_0xa2df75,_0x3be769,_0x31cc04){FaxQueueEvents[_0xf6d5('0x6')](_0x28f012+':'+_0xa2df75['id'],_0xa2df75);FaxQueueEvents[_0xf6d5('0x6')](_0x28f012,_0xa2df75);_0x31cc04(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0xf6d5('0x7')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x4365=['../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x2b4969,_0x4f6a6b){var _0x43d792=function(_0x5e3a40){while(--_0x5e3a40){_0x2b4969['push'](_0x2b4969['shift']());}};_0x43d792(++_0x4f6a6b);}(_0x4365,0xdb));var _0x5436=function(_0x27c7b7,_0x3ac29c){_0x27c7b7=_0x27c7b7-0x0;var _0x22e7d5=_0x4365[_0x27c7b7];return _0x22e7d5;};'use strict';var EventEmitter=require(_0x5436('0x0'));var FaxQueue=require(_0x5436('0x1'))['db'][_0x5436('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x5436('0x3')](0x0);var events={'afterCreate':_0x5436('0x4'),'afterUpdate':_0x5436('0x5'),'afterDestroy':_0x5436('0x6')};function emitEvent(_0x11204f){return function(_0x4af1ba,_0x2e1bd2,_0x1a09e0){FaxQueueEvents[_0x5436('0x7')](_0x11204f+':'+_0x4af1ba['id'],_0x4af1ba);FaxQueueEvents[_0x5436('0x7')](_0x11204f,_0x4af1ba);_0x1a09e0(null);};}for(var e in events){if(events[_0x5436('0x8')](e)){var event=events[e];FaxQueue[_0x5436('0x9')](e,emitEvent(event));}}module[_0x5436('0xa')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index bed9a26..22e624b 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 _0xbdd9=['rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3c20ff,_0x428706){var _0x22c041=function(_0x3f585d){while(--_0x3f585d){_0x3c20ff['push'](_0x3c20ff['shift']());}};_0x22c041(++_0x428706);}(_0xbdd9,0x157));var _0x9bdd=function(_0x1f8053,_0x111077){_0x1f8053=_0x1f8053-0x0;var _0x174fd8=_0xbdd9[_0x1f8053];return _0x174fd8;};'use strict';var _=require('lodash');var util=require(_0x9bdd('0x0'));var logger=require(_0x9bdd('0x1'))(_0x9bdd('0x2'));var moment=require(_0x9bdd('0x3'));var BPromise=require(_0x9bdd('0x4'));var rp=require(_0x9bdd('0x5'));var fs=require('fs');var path=require(_0x9bdd('0x6'));var rimraf=require(_0x9bdd('0x7'));var config=require(_0x9bdd('0x8'));var attributes=require(_0x9bdd('0x9'));module[_0x9bdd('0xa')]=function(_0xf6d219,_0xf059fc){return _0xf6d219[_0x9bdd('0xb')](_0x9bdd('0xc'),attributes,{'tableName':_0x9bdd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x05ee=['api','moment','bluebird','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','../../config/logger'];(function(_0x1fc0e7,_0x234ccc){var _0x489b87=function(_0xf9caed){while(--_0xf9caed){_0x1fc0e7['push'](_0x1fc0e7['shift']());}};_0x489b87(++_0x234ccc);}(_0x05ee,0x129));var _0xe05e=function(_0x16e0f5,_0x4ec0f3){_0x16e0f5=_0x16e0f5-0x0;var _0x4839d5=_0x05ee[_0x16e0f5];return _0x4839d5;};'use strict';var _=require(_0xe05e('0x0'));var util=require('util');var logger=require(_0xe05e('0x1'))(_0xe05e('0x2'));var moment=require(_0xe05e('0x3'));var BPromise=require(_0xe05e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe05e('0x5'));var rimraf=require(_0xe05e('0x6'));var config=require(_0xe05e('0x7'));var attributes=require(_0xe05e('0x8'));module[_0xe05e('0x9')]=function(_0x8e66ef,_0xb41b7e){return _0x8e66ef[_0xe05e('0xa')](_0xe05e('0xb'),attributes,{'tableName':_0xe05e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 40ed859..0046e35 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 _0xc21d=['./faxQueue.socket','register','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetFaxQueue','FaxQueue','options','raw','where','attributes','limit','include','map','model','then','ShowFaxQueue','find','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc21d,0x11c));var _0xdc21=function(_0x5959ce,_0xfaac21){_0x5959ce=_0x5959ce-0x0;var _0x250707=_0xc21d[_0x5959ce];return _0x250707;};'use strict';var _=require('lodash');var util=require(_0xdc21('0x0'));var moment=require(_0xdc21('0x1'));var BPromise=require(_0xdc21('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdc21('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdc21('0x4'))(_0xdc21('0x5'));var config=require(_0xdc21('0x6'));var jayson=require(_0xdc21('0x7'));var client=jayson['client'][_0xdc21('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0xdc21('0x9')],{'host':_0xdc21('0xa'),'port':0x18eb});var socket=require(_0xdc21('0xb'))(new Redis(config[_0xdc21('0x9')]));require(_0xdc21('0xc'))[_0xdc21('0xd')](socket);function respondWithRpcPromise(_0x1414bb,_0x3282ba,_0x1eeb0c){return new BPromise(function(_0x3aba94,_0xd08c5e){return client[_0xdc21('0xe')](_0x1414bb,_0x1eeb0c)['then'](function(_0x2edf3d){logger[_0xdc21('0xf')](_0xdc21('0x10'),_0x3282ba,_0xdc21('0x11'));logger[_0xdc21('0x12')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x3282ba,_0xdc21('0x11'),JSON[_0xdc21('0x13')](_0x2edf3d));if(_0x2edf3d[_0xdc21('0x14')]){if(_0x2edf3d[_0xdc21('0x14')]['code']===0x1f4){logger[_0xdc21('0x14')](_0xdc21('0x10'),_0x3282ba,_0x2edf3d[_0xdc21('0x14')][_0xdc21('0x15')]);return _0xd08c5e(_0x2edf3d[_0xdc21('0x14')][_0xdc21('0x15')]);}logger[_0xdc21('0x14')](_0xdc21('0x10'),_0x3282ba,_0x2edf3d[_0xdc21('0x14')]['message']);return _0x3aba94(_0x2edf3d[_0xdc21('0x14')][_0xdc21('0x15')]);}else{logger[_0xdc21('0xf')](_0xdc21('0x10'),_0x3282ba,_0xdc21('0x11'));_0x3aba94(_0x2edf3d[_0xdc21('0x16')][_0xdc21('0x15')]);}})[_0xdc21('0x17')](function(_0x4f1033){logger[_0xdc21('0x14')](_0xdc21('0x10'),_0x3282ba,_0x4f1033);_0xd08c5e(_0x4f1033);});});}exports[_0xdc21('0x18')]=function(_0x3eca8d){var _0x57c611=this;return new Promise(function(_0x49d6b4,_0xe8de8a){return db[_0xdc21('0x19')]['findAll']({'raw':_0x3eca8d[_0xdc21('0x1a')]?_0x3eca8d[_0xdc21('0x1a')][_0xdc21('0x1b')]===undefined?!![]:![]:!![],'where':_0x3eca8d['options']?_0x3eca8d['options'][_0xdc21('0x1c')]||null:null,'attributes':_0x3eca8d[_0xdc21('0x1a')]?_0x3eca8d['options'][_0xdc21('0x1d')]||null:null,'limit':_0x3eca8d[_0xdc21('0x1a')]?_0x3eca8d[_0xdc21('0x1a')][_0xdc21('0x1e')]||null:null,'include':_0x3eca8d[_0xdc21('0x1a')]?_0x3eca8d['options'][_0xdc21('0x1f')]?_[_0xdc21('0x20')](_0x3eca8d['options'][_0xdc21('0x1f')],function(_0x154cf9){return{'model':db[_0x154cf9[_0xdc21('0x21')]],'as':_0x154cf9['as'],'attributes':_0x154cf9[_0xdc21('0x1d')],'include':_0x154cf9['include']?_[_0xdc21('0x20')](_0x154cf9[_0xdc21('0x1f')],function(_0x339488){return{'model':db[_0x339488[_0xdc21('0x21')]],'as':_0x339488['as'],'attributes':_0x339488[_0xdc21('0x1d')],'include':_0x339488[_0xdc21('0x1f')]?_[_0xdc21('0x20')](_0x339488[_0xdc21('0x1f')],function(_0x4dbee2){return{'model':db[_0x4dbee2[_0xdc21('0x21')]],'as':_0x4dbee2['as'],'attributes':_0x4dbee2[_0xdc21('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdc21('0x22')](function(_0x22f258){logger['info'](_0xdc21('0x18'),_0x3eca8d);logger['debug'](_0xdc21('0x18'),_0x3eca8d,JSON[_0xdc21('0x13')](_0x22f258));_0x49d6b4(_0x22f258);})[_0xdc21('0x17')](function(_0x1ffa21){logger[_0xdc21('0x14')](_0xdc21('0x18'),_0x1ffa21[_0xdc21('0x15')],_0x3eca8d);_0xe8de8a(_0x57c611[_0xdc21('0x14')](0x1f4,_0x1ffa21[_0xdc21('0x15')]));});});};exports[_0xdc21('0x23')]=function(_0x44ada3){var _0x5a4966=this;return new Promise(function(_0xecd078,_0x5d75f1){return db[_0xdc21('0x19')][_0xdc21('0x24')]({'raw':_0x44ada3[_0xdc21('0x1a')]?_0x44ada3[_0xdc21('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x44ada3['options']?_0x44ada3[_0xdc21('0x1a')][_0xdc21('0x1c')]||null:null,'attributes':_0x44ada3[_0xdc21('0x1a')]?_0x44ada3[_0xdc21('0x1a')][_0xdc21('0x1d')]||null:null,'include':_0x44ada3[_0xdc21('0x1a')]?_0x44ada3[_0xdc21('0x1a')][_0xdc21('0x1f')]?_[_0xdc21('0x20')](_0x44ada3[_0xdc21('0x1a')][_0xdc21('0x1f')],function(_0x613bc6){return{'model':db[_0x613bc6[_0xdc21('0x21')]],'as':_0x613bc6['as'],'attributes':_0x613bc6[_0xdc21('0x1d')],'include':_0x613bc6[_0xdc21('0x1f')]?_['map'](_0x613bc6[_0xdc21('0x1f')],function(_0xbb36ac){return{'model':db[_0xbb36ac[_0xdc21('0x21')]],'as':_0xbb36ac['as'],'attributes':_0xbb36ac[_0xdc21('0x1d')],'include':_0xbb36ac['include']?_[_0xdc21('0x20')](_0xbb36ac[_0xdc21('0x1f')],function(_0x502fdf){return{'model':db[_0x502fdf[_0xdc21('0x21')]],'as':_0x502fdf['as'],'attributes':_0x502fdf[_0xdc21('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x486168){logger[_0xdc21('0xf')]('ShowFaxQueue',_0x44ada3);logger[_0xdc21('0x12')]('ShowFaxQueue',_0x44ada3,JSON['stringify'](_0x486168));_0xecd078(_0x486168);})[_0xdc21('0x17')](function(_0x4ccf33){logger[_0xdc21('0x14')]('ShowFaxQueue',_0x4ccf33[_0xdc21('0x15')],_0x44ada3);_0x5d75f1(_0x5a4966['error'](0x1f4,_0x4ccf33[_0xdc21('0x15')]));});});}; \ No newline at end of file +var _0xddaa=['GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowFaxQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','request\x20sent','stringify','error','FaxQueue,\x20%s,\x20%s','message','catch'];(function(_0x13f0f2,_0x2b3566){var _0xe733ed=function(_0x2c64e4){while(--_0x2c64e4){_0x13f0f2['push'](_0x13f0f2['shift']());}};_0xe733ed(++_0x2b3566);}(_0xddaa,0x134));var _0xadda=function(_0x1e14e5,_0x27f63a){_0x1e14e5=_0x1e14e5-0x0;var _0x3dce1b=_0xddaa[_0x1e14e5];return _0x3dce1b;};'use strict';var _=require(_0xadda('0x0'));var util=require(_0xadda('0x1'));var moment=require(_0xadda('0x2'));var BPromise=require(_0xadda('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xadda('0x4'));var db=require(_0xadda('0x5'))['db'];var utils=require(_0xadda('0x6'));var logger=require(_0xadda('0x7'))('rpc');var config=require(_0xadda('0x8'));var jayson=require(_0xadda('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xadda('0xa')]=_[_0xadda('0xb')](config[_0xadda('0xa')],{'host':_0xadda('0xc'),'port':0x18eb});var socket=require(_0xadda('0xd'))(new Redis(config[_0xadda('0xa')]));require(_0xadda('0xe'))[_0xadda('0xf')](socket);function respondWithRpcPromise(_0xce3011,_0x57c799,_0x1b1444){return new BPromise(function(_0x56e0b2,_0x3b2d9f){return client[_0xadda('0x10')](_0xce3011,_0x1b1444)[_0xadda('0x11')](function(_0x4be8d2){logger[_0xadda('0x12')]('FaxQueue,\x20%s,\x20%s',_0x57c799,'request\x20sent');logger['debug']('FaxQueue,\x20%s,\x20%s,\x20%s',_0x57c799,_0xadda('0x13'),JSON[_0xadda('0x14')](_0x4be8d2));if(_0x4be8d2[_0xadda('0x15')]){if(_0x4be8d2[_0xadda('0x15')]['code']===0x1f4){logger['error'](_0xadda('0x16'),_0x57c799,_0x4be8d2[_0xadda('0x15')][_0xadda('0x17')]);return _0x3b2d9f(_0x4be8d2[_0xadda('0x15')]['message']);}logger[_0xadda('0x15')](_0xadda('0x16'),_0x57c799,_0x4be8d2[_0xadda('0x15')][_0xadda('0x17')]);return _0x56e0b2(_0x4be8d2[_0xadda('0x15')][_0xadda('0x17')]);}else{logger[_0xadda('0x12')]('FaxQueue,\x20%s,\x20%s',_0x57c799,_0xadda('0x13'));_0x56e0b2(_0x4be8d2['result'][_0xadda('0x17')]);}})[_0xadda('0x18')](function(_0xf7b144){logger['error']('FaxQueue,\x20%s,\x20%s',_0x57c799,_0xf7b144);_0x3b2d9f(_0xf7b144);});});}exports[_0xadda('0x19')]=function(_0xc2135c){var _0x23e77d=this;return new Promise(function(_0x205238,_0x1afcf4){return db[_0xadda('0x1a')][_0xadda('0x1b')]({'raw':_0xc2135c['options']?_0xc2135c[_0xadda('0x1c')][_0xadda('0x1d')]===undefined?!![]:![]:!![],'where':_0xc2135c[_0xadda('0x1c')]?_0xc2135c[_0xadda('0x1c')][_0xadda('0x1e')]||null:null,'attributes':_0xc2135c['options']?_0xc2135c[_0xadda('0x1c')][_0xadda('0x1f')]||null:null,'limit':_0xc2135c[_0xadda('0x1c')]?_0xc2135c[_0xadda('0x1c')][_0xadda('0x20')]||null:null,'include':_0xc2135c[_0xadda('0x1c')]?_0xc2135c[_0xadda('0x1c')][_0xadda('0x21')]?_[_0xadda('0x22')](_0xc2135c[_0xadda('0x1c')]['include'],function(_0x1d7ad2){return{'model':db[_0x1d7ad2[_0xadda('0x23')]],'as':_0x1d7ad2['as'],'attributes':_0x1d7ad2[_0xadda('0x1f')],'include':_0x1d7ad2[_0xadda('0x21')]?_[_0xadda('0x22')](_0x1d7ad2[_0xadda('0x21')],function(_0x40ff7f){return{'model':db[_0x40ff7f[_0xadda('0x23')]],'as':_0x40ff7f['as'],'attributes':_0x40ff7f[_0xadda('0x1f')],'include':_0x40ff7f[_0xadda('0x21')]?_[_0xadda('0x22')](_0x40ff7f['include'],function(_0x3be119){return{'model':db[_0x3be119[_0xadda('0x23')]],'as':_0x3be119['as'],'attributes':_0x3be119[_0xadda('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xadda('0x11')](function(_0x3b5e72){logger[_0xadda('0x12')]('GetFaxQueue',_0xc2135c);logger['debug'](_0xadda('0x19'),_0xc2135c,JSON['stringify'](_0x3b5e72));_0x205238(_0x3b5e72);})[_0xadda('0x18')](function(_0x3dc42c){logger['error'](_0xadda('0x19'),_0x3dc42c[_0xadda('0x17')],_0xc2135c);_0x1afcf4(_0x23e77d[_0xadda('0x15')](0x1f4,_0x3dc42c[_0xadda('0x17')]));});});};exports[_0xadda('0x24')]=function(_0x2ce0c6){var _0x41f3fb=this;return new Promise(function(_0xd195f2,_0x5701f5){return db[_0xadda('0x1a')]['find']({'raw':_0x2ce0c6[_0xadda('0x1c')]?_0x2ce0c6[_0xadda('0x1c')][_0xadda('0x1d')]===undefined?!![]:![]:!![],'where':_0x2ce0c6[_0xadda('0x1c')]?_0x2ce0c6[_0xadda('0x1c')]['where']||null:null,'attributes':_0x2ce0c6[_0xadda('0x1c')]?_0x2ce0c6[_0xadda('0x1c')][_0xadda('0x1f')]||null:null,'include':_0x2ce0c6[_0xadda('0x1c')]?_0x2ce0c6[_0xadda('0x1c')][_0xadda('0x21')]?_[_0xadda('0x22')](_0x2ce0c6[_0xadda('0x1c')][_0xadda('0x21')],function(_0x5c25a2){return{'model':db[_0x5c25a2['model']],'as':_0x5c25a2['as'],'attributes':_0x5c25a2[_0xadda('0x1f')],'include':_0x5c25a2[_0xadda('0x21')]?_[_0xadda('0x22')](_0x5c25a2[_0xadda('0x21')],function(_0x172db5){return{'model':db[_0x172db5['model']],'as':_0x172db5['as'],'attributes':_0x172db5[_0xadda('0x1f')],'include':_0x172db5[_0xadda('0x21')]?_[_0xadda('0x22')](_0x172db5[_0xadda('0x21')],function(_0x896e08){return{'model':db[_0x896e08['model']],'as':_0x896e08['as'],'attributes':_0x896e08[_0xadda('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f1149){logger[_0xadda('0x12')](_0xadda('0x24'),_0x2ce0c6);logger['debug'](_0xadda('0x24'),_0x2ce0c6,JSON[_0xadda('0x14')](_0x1f1149));_0xd195f2(_0x1f1149);})['catch'](function(_0x3e1d42){logger['error'](_0xadda('0x24'),_0x3e1d42[_0xadda('0x17')],_0x2ce0c6);_0x5701f5(_0x41f3fb['error'](0x1f4,_0x3e1d42['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index b90725d..3eb4ff1 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 _0xec30=['update','removeListener','register','length','save'];(function(_0xa9e8cd,_0x399e59){var _0x5ca5c7=function(_0x57ab7b){while(--_0x57ab7b){_0xa9e8cd['push'](_0xa9e8cd['shift']());}};_0x5ca5c7(++_0x399e59);}(_0xec30,0xf9));var _0x0ec3=function(_0x49c1b0,_0x35b033){_0x49c1b0=_0x49c1b0-0x0;var _0x5be831=_0xec30[_0x49c1b0];return _0x5be831;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x0ec3('0x0'),'remove',_0x0ec3('0x1')];function createListener(_0x496b07,_0x1d42c1){return function(_0x16dce0){_0x1d42c1['emit'](_0x496b07,_0x16dce0);};}function removeListener(_0x86436,_0x1a408d){return function(){FaxQueueEvents[_0x0ec3('0x2')](_0x86436,_0x1a408d);};}exports[_0x0ec3('0x3')]=function(_0x1214f2){for(var _0x33b4eb=0x0,_0x434677=events[_0x0ec3('0x4')];_0x33b4eb<_0x434677;_0x33b4eb++){var _0x5eda72=events[_0x33b4eb];var _0x549769=createListener('faxQueue:'+_0x5eda72,_0x1214f2);FaxQueueEvents['on'](_0x5eda72,_0x549769);}}; \ No newline at end of file +var _0x757c=['update','emit','removeListener','register','length','./faxQueue.events','save'];(function(_0x4c752a,_0x3d9697){var _0x4294f4=function(_0x1a496b){while(--_0x1a496b){_0x4c752a['push'](_0x4c752a['shift']());}};_0x4294f4(++_0x3d9697);}(_0x757c,0xc9));var _0xc757=function(_0x5dd9de,_0x747713){_0x5dd9de=_0x5dd9de-0x0;var _0x5b6c51=_0x757c[_0x5dd9de];return _0x5b6c51;};'use strict';var FaxQueueEvents=require(_0xc757('0x0'));var events=[_0xc757('0x1'),'remove',_0xc757('0x2')];function createListener(_0x1e89ff,_0x104de2){return function(_0x3556a2){_0x104de2[_0xc757('0x3')](_0x1e89ff,_0x3556a2);};}function removeListener(_0x4165bb,_0x2ad58b){return function(){FaxQueueEvents[_0xc757('0x4')](_0x4165bb,_0x2ad58b);};}exports[_0xc757('0x5')]=function(_0x29cb3a){for(var _0x4f15ef=0x0,_0x1d5777=events[_0xc757('0x6')];_0x4f15ef<_0x1d5777;_0x4f15ef++){var _0xe6caa5=events[_0x4f15ef];var _0xa7a346=createListener('faxQueue:'+_0xe6caa5,_0x29cb3a);FaxQueueEvents['on'](_0xe6caa5,_0xa7a346);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index b8882f3..90f2fda 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 _0x4819=['describe','get','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','put','delete','destroy','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','isAuthenticated','/describe'];(function(_0x299a19,_0xc19020){var _0x293435=function(_0x124b40){while(--_0x124b40){_0x299a19['push'](_0x299a19['shift']());}};_0x293435(++_0xc19020);}(_0x4819,0xcd));var _0x9481=function(_0x1179f3,_0x100df5){_0x1179f3=_0x1179f3-0x0;var _0x8a9a2b=_0x4819[_0x1179f3];return _0x8a9a2b;};'use strict';var multer=require('multer');var util=require(_0x9481('0x0'));var path=require(_0x9481('0x1'));var timeout=require(_0x9481('0x2'));var express=require(_0x9481('0x3'));var router=express[_0x9481('0x4')]();var fs_extra=require(_0x9481('0x5'));var auth=require(_0x9481('0x6'));var interaction=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var controller=require(_0x9481('0x9'));router['get']('/',auth[_0x9481('0xa')](),controller['index']);router['get'](_0x9481('0xb'),auth[_0x9481('0xa')](),controller[_0x9481('0xc')]);router[_0x9481('0xd')](_0x9481('0xe'),auth['isAuthenticated'](),controller[_0x9481('0xf')]);router['get'](_0x9481('0x10'),auth['isAuthenticated'](),controller[_0x9481('0x11')]);router[_0x9481('0xd')](_0x9481('0x12'),auth[_0x9481('0xa')](),controller[_0x9481('0x13')]);router[_0x9481('0xd')](_0x9481('0x14'),auth[_0x9481('0xa')](),controller[_0x9481('0x15')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9481('0x16')]);router[_0x9481('0x17')](_0x9481('0x12'),auth[_0x9481('0xa')](),controller[_0x9481('0x18')]);router[_0x9481('0x17')](_0x9481('0x14'),auth['isAuthenticated'](),controller[_0x9481('0x19')]);router[_0x9481('0x1a')]('/:id',auth[_0x9481('0xa')](),controller['update']);router[_0x9481('0x1b')](_0x9481('0xe'),auth[_0x9481('0xa')](),controller[_0x9481('0x1c')]);router['delete']('/:id/teams',auth[_0x9481('0xa')](),controller['removeTeams']);router['delete'](_0x9481('0x14'),auth[_0x9481('0xa')](),controller[_0x9481('0x1d')]);module[_0x9481('0x1e')]=router; \ No newline at end of file +var _0x2da6=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','/:id','update','delete','removeTeams','removeAgents','multer','util','path'];(function(_0x3320d6,_0x4576ed){var _0x1356d3=function(_0x381f8d){while(--_0x381f8d){_0x3320d6['push'](_0x3320d6['shift']());}};_0x1356d3(++_0x4576ed);}(_0x2da6,0x1dd));var _0x62da=function(_0x57a37c,_0x443af5){_0x57a37c=_0x57a37c-0x0;var _0x26e394=_0x2da6[_0x57a37c];return _0x26e394;};'use strict';var multer=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var path=require(_0x62da('0x2'));var timeout=require(_0x62da('0x3'));var express=require(_0x62da('0x4'));var router=express[_0x62da('0x5')]();var fs_extra=require(_0x62da('0x6'));var auth=require(_0x62da('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x62da('0x8'));router[_0x62da('0x9')]('/',auth[_0x62da('0xa')](),controller[_0x62da('0xb')]);router[_0x62da('0x9')](_0x62da('0xc'),auth[_0x62da('0xa')](),controller[_0x62da('0xd')]);router[_0x62da('0x9')]('/:id',auth[_0x62da('0xa')](),controller[_0x62da('0xe')]);router[_0x62da('0x9')](_0x62da('0xf'),auth['isAuthenticated'](),controller[_0x62da('0x10')]);router[_0x62da('0x9')](_0x62da('0x11'),auth[_0x62da('0xa')](),controller[_0x62da('0x12')]);router['get'](_0x62da('0x13'),auth[_0x62da('0xa')](),controller[_0x62da('0x14')]);router[_0x62da('0x15')]('/',auth[_0x62da('0xa')](),controller['create']);router['post'](_0x62da('0x11'),auth[_0x62da('0xa')](),controller[_0x62da('0x16')]);router[_0x62da('0x15')](_0x62da('0x13'),auth[_0x62da('0xa')](),controller[_0x62da('0x17')]);router[_0x62da('0x18')](_0x62da('0x19'),auth[_0x62da('0xa')](),controller[_0x62da('0x1a')]);router[_0x62da('0x1b')](_0x62da('0x19'),auth[_0x62da('0xa')](),controller['destroy']);router['delete'](_0x62da('0x11'),auth['isAuthenticated'](),controller[_0x62da('0x1c')]);router[_0x62da('0x1b')](_0x62da('0x13'),auth['isAuthenticated'](),controller[_0x62da('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 087f89c..8aa19fb 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 _0x4111=['moment','sequelize','exports','STRING','DATE'];(function(_0x2a7ccf,_0x6b7008){var _0x3a44b7=function(_0xc84f76){while(--_0xc84f76){_0x2a7ccf['push'](_0x2a7ccf['shift']());}};_0x3a44b7(++_0x6b7008);}(_0x4111,0x91));var _0x1411=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4111[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x1411('0x0'));var Sequelize=require(_0x1411('0x1'));module[_0x1411('0x2')]={'uniqueid':{'type':Sequelize[_0x1411('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x1411('0x4')]},'leaveAt':{'type':Sequelize[_0x1411('0x4')]},'acceptAt':{'type':Sequelize[_0x1411('0x4')]},'exitAt':{'type':Sequelize[_0x1411('0x4')]},'reason':{'type':Sequelize[_0x1411('0x3')]}}; \ No newline at end of file +var _0xc335=['STRING','DATE','sequelize'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0xc335,0x15b));var _0x5c33=function(_0x5b139c,_0x923735){_0x5b139c=_0x5b139c-0x0;var _0x15f562=_0xc335[_0x5b139c];return _0x15f562;};'use strict';var moment=require('moment');var Sequelize=require(_0x5c33('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x5c33('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x5c33('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x5c33('0x2')]},'acceptAt':{'type':Sequelize[_0x5c33('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x5c33('0x1')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 5cef935..bba933b 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 _0x4d46=['sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','map','fieldName','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','type','VIRTUAL','filter','merge','options','FaxQueueReport','include','rows','catch','show','params','keys','includeAll','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x7b3d99,_0x52a6f1){var _0x5da75f=function(_0x154938){while(--_0x154938){_0x7b3d99['push'](_0x7b3d99['shift']());}};_0x5da75f(++_0x52a6f1);}(_0x4d46,0x197));var _0x64d4=function(_0x3ffd5d,_0x159469){_0x3ffd5d=_0x3ffd5d-0x0;var _0x246111=_0x4d46[_0x3ffd5d];return _0x246111;};'use strict';var emlformat=require(_0x64d4('0x0'));var rimraf=require(_0x64d4('0x1'));var zipdir=require(_0x64d4('0x2'));var jsonpatch=require(_0x64d4('0x3'));var rp=require(_0x64d4('0x4'));var moment=require(_0x64d4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x64d4('0x6'));var util=require(_0x64d4('0x7'));var path=require(_0x64d4('0x8'));var sox=require(_0x64d4('0x9'));var csv=require(_0x64d4('0xa'));var ejs=require(_0x64d4('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x64d4('0xc'));var squel=require(_0x64d4('0xd'));var crypto=require('crypto');var jsforce=require(_0x64d4('0xe'));var deskjs=require(_0x64d4('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x64d4('0x10'));var as=require(_0x64d4('0x11'));var hardwareService=require(_0x64d4('0x12'));var logger=require(_0x64d4('0x13'))(_0x64d4('0x14'));var utils=require(_0x64d4('0x15'));var config=require(_0x64d4('0x16'));var licenseUtil=require(_0x64d4('0x17'));var db=require(_0x64d4('0x18'))['db'];function respondWithStatusCode(_0x4a4cbe,_0x3d3b97){_0x3d3b97=_0x3d3b97||0xcc;return function(_0x553f90){if(_0x553f90){return _0x4a4cbe[_0x64d4('0x19')](_0x3d3b97);}return _0x4a4cbe[_0x64d4('0x1a')](_0x3d3b97)[_0x64d4('0x1b')]();};}function respondWithResult(_0x4762a9,_0x13b111){_0x13b111=_0x13b111||0xc8;return function(_0x2b0c39){if(_0x2b0c39){return _0x4762a9['status'](_0x13b111)[_0x64d4('0x1c')](_0x2b0c39);}};}function respondWithFilteredResult(_0x433af8,_0x4574c2){return function(_0x3a25a3){if(_0x3a25a3){var _0x1b005a=typeof _0x4574c2[_0x64d4('0x1d')]===_0x64d4('0x1e')&&typeof _0x4574c2['limit']===_0x64d4('0x1e');var _0x260561=_0x3a25a3['count'];var _0x1bbaf0=_0x1b005a?0x0:_0x4574c2[_0x64d4('0x1d')];var _0x13900e=_0x1b005a?_0x3a25a3[_0x64d4('0x1f')]:_0x4574c2[_0x64d4('0x1d')]+_0x4574c2[_0x64d4('0x20')];var _0x1b2516;if(_0x13900e>=_0x260561){_0x13900e=_0x260561;_0x1b2516=0xc8;}else{_0x1b2516=0xce;}_0x433af8[_0x64d4('0x1a')](_0x1b2516);return _0x433af8['set'](_0x64d4('0x21'),_0x1bbaf0+'-'+_0x13900e+'/'+_0x260561)[_0x64d4('0x1c')](_0x3a25a3);}return null;};}function patchUpdates(_0x35ee04){return function(_0xf6e129){try{jsonpatch['apply'](_0xf6e129,_0x35ee04,!![]);}catch(_0x4d9f29){return BPromise[_0x64d4('0x22')](_0x4d9f29);}return _0xf6e129[_0x64d4('0x23')]();};}function saveUpdates(_0x374119,_0x4c0b0b){return function(_0x3c7a8c){if(_0x3c7a8c){return _0x3c7a8c[_0x64d4('0x24')](_0x374119)[_0x64d4('0x25')](function(_0x3259a0){return _0x3259a0;});}return null;};}function removeEntity(_0x157639,_0x2fec7d){return function(_0x4b8b72){if(_0x4b8b72){return _0x4b8b72[_0x64d4('0x26')]()[_0x64d4('0x25')](function(){_0x157639[_0x64d4('0x1a')](0xcc)[_0x64d4('0x1b')]();});}};}function handleEntityNotFound(_0x4ee0b9,_0x494640){return function(_0x598457){if(!_0x598457){_0x4ee0b9[_0x64d4('0x19')](0x194);}return _0x598457;};}function handleError(_0x58d1e8,_0x24c45e){_0x24c45e=_0x24c45e||0x1f4;return function(_0x512d67){logger[_0x64d4('0x27')](_0x512d67[_0x64d4('0x28')]);if(_0x512d67[_0x64d4('0x29')]){delete _0x512d67[_0x64d4('0x29')];}_0x58d1e8[_0x64d4('0x1a')](_0x24c45e)['send'](_0x512d67);};}exports['index']=function(_0x3865ef,_0x2a38b4){var _0x236691={},_0x18e1b1={},_0x77912e={'count':0x0,'rows':[]};var _0x1c3347=_[_0x64d4('0x2a')](db['FaxQueueReport']['rawAttributes'],function(_0x184813){return{'name':_0x184813[_0x64d4('0x2b')],'type':_0x184813['type'][_0x64d4('0x2c')]};});_0x18e1b1[_0x64d4('0x2d')]=_[_0x64d4('0x2a')](_0x1c3347,_0x64d4('0x29'));_0x18e1b1[_0x64d4('0x2e')]=_['keys'](_0x3865ef[_0x64d4('0x2e')]);_0x18e1b1['filters']=_['intersection'](_0x18e1b1[_0x64d4('0x2d')],_0x18e1b1[_0x64d4('0x2e')]);_0x236691['attributes']=_[_0x64d4('0x2f')](_0x18e1b1['model'],qs[_0x64d4('0x30')](_0x3865ef[_0x64d4('0x2e')]['fields']));_0x236691['attributes']=_0x236691[_0x64d4('0x31')][_0x64d4('0x32')]?_0x236691[_0x64d4('0x31')]:_0x18e1b1[_0x64d4('0x2d')];if(!_0x3865ef[_0x64d4('0x2e')]['hasOwnProperty'](_0x64d4('0x33'))){_0x236691[_0x64d4('0x20')]=qs[_0x64d4('0x20')](_0x3865ef['query']['limit']);_0x236691[_0x64d4('0x1d')]=qs[_0x64d4('0x1d')](_0x3865ef[_0x64d4('0x2e')][_0x64d4('0x1d')]);}_0x236691[_0x64d4('0x34')]=qs[_0x64d4('0x35')](_0x3865ef['query']['sort']);_0x236691[_0x64d4('0x36')]=qs[_0x64d4('0x37')](_['pick'](_0x3865ef['query'],_0x18e1b1[_0x64d4('0x37')]),_0x1c3347);if(_0x3865ef['query']['filter']){_0x236691['where']=_['merge'](_0x236691[_0x64d4('0x36')],{'$or':_[_0x64d4('0x2a')](_0x1c3347,function(_0xa9f459){if(_0xa9f459[_0x64d4('0x38')]!==_0x64d4('0x39')){var _0x130dba={};_0x130dba[_0xa9f459['name']]={'$like':'%'+_0x3865ef[_0x64d4('0x2e')][_0x64d4('0x3a')]+'%'};return _0x130dba;}})});}_0x236691=_[_0x64d4('0x3b')]({},_0x236691,_0x3865ef[_0x64d4('0x3c')]);var _0x2fd846={'where':_0x236691[_0x64d4('0x36')]};return db[_0x64d4('0x3d')][_0x64d4('0x1f')](_0x2fd846)['then'](function(_0x107871){_0x77912e['count']=_0x107871;if(_0x3865ef[_0x64d4('0x2e')]['includeAll']){_0x236691[_0x64d4('0x3e')]=[{'all':!![]}];}return db['FaxQueueReport']['findAll'](_0x236691);})[_0x64d4('0x25')](function(_0x463bf0){_0x77912e[_0x64d4('0x3f')]=_0x463bf0;return _0x77912e;})[_0x64d4('0x25')](respondWithFilteredResult(_0x2a38b4,_0x236691))[_0x64d4('0x40')](handleError(_0x2a38b4,null));};exports[_0x64d4('0x41')]=function(_0x11577b,_0xd99afd){var _0x2ccb14={'raw':!![],'where':{'id':_0x11577b[_0x64d4('0x42')]['id']}},_0x5f0213={};_0x5f0213[_0x64d4('0x2d')]=_[_0x64d4('0x43')](db[_0x64d4('0x3d')]['rawAttributes']);_0x5f0213[_0x64d4('0x2e')]=_[_0x64d4('0x43')](_0x11577b['query']);_0x5f0213['filters']=_[_0x64d4('0x2f')](_0x5f0213['model'],_0x5f0213[_0x64d4('0x2e')]);_0x2ccb14['attributes']=_[_0x64d4('0x2f')](_0x5f0213[_0x64d4('0x2d')],qs[_0x64d4('0x30')](_0x11577b['query'][_0x64d4('0x30')]));_0x2ccb14[_0x64d4('0x31')]=_0x2ccb14[_0x64d4('0x31')][_0x64d4('0x32')]?_0x2ccb14[_0x64d4('0x31')]:_0x5f0213[_0x64d4('0x2d')];if(_0x11577b['query'][_0x64d4('0x44')]){_0x2ccb14[_0x64d4('0x3e')]=[{'all':!![]}];}_0x2ccb14=_[_0x64d4('0x3b')]({},_0x2ccb14,_0x11577b[_0x64d4('0x3c')]);return db['FaxQueueReport'][_0x64d4('0x45')](_0x2ccb14)[_0x64d4('0x25')](handleEntityNotFound(_0xd99afd,null))[_0x64d4('0x25')](respondWithResult(_0xd99afd,null))[_0x64d4('0x40')](handleError(_0xd99afd,null));};exports['create']=function(_0x49930e,_0x38d59f){return db[_0x64d4('0x3d')]['create'](_0x49930e[_0x64d4('0x46')],{})[_0x64d4('0x25')](respondWithResult(_0x38d59f,0xc9))[_0x64d4('0x40')](handleError(_0x38d59f,null));};exports[_0x64d4('0x24')]=function(_0x4b3c17,_0x46bd77){if(_0x4b3c17[_0x64d4('0x46')]['id']){delete _0x4b3c17[_0x64d4('0x46')]['id'];}return db[_0x64d4('0x3d')][_0x64d4('0x45')]({'where':{'id':_0x4b3c17['params']['id']}})[_0x64d4('0x25')](handleEntityNotFound(_0x46bd77,null))[_0x64d4('0x25')](saveUpdates(_0x4b3c17['body'],null))[_0x64d4('0x25')](respondWithResult(_0x46bd77,null))[_0x64d4('0x40')](handleError(_0x46bd77,null));};exports[_0x64d4('0x26')]=function(_0x5829e6,_0x11ed80){return db['FaxQueueReport'][_0x64d4('0x45')]({'where':{'id':_0x5829e6[_0x64d4('0x42')]['id']}})[_0x64d4('0x25')](handleEntityNotFound(_0x11ed80,null))[_0x64d4('0x25')](removeEntity(_0x11ed80,null))[_0x64d4('0x40')](handleError(_0x11ed80,null));};exports[_0x64d4('0x47')]=function(_0x3f228a,_0x5a7677){return db['FaxQueueReport']['describe']()[_0x64d4('0x25')](respondWithResult(_0x5a7677,null))[_0x64d4('0x40')](handleError(_0x5a7677,null));}; \ No newline at end of file +var _0xcf1c=['params','keys','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set','Content-Range','apply','update','then','sendStatus','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show'];(function(_0x1ff2ec,_0x386e86){var _0x405683=function(_0x22f921){while(--_0x22f921){_0x1ff2ec['push'](_0x1ff2ec['shift']());}};_0x405683(++_0x386e86);}(_0xcf1c,0x18d));var _0xccf1=function(_0xbed8a2,_0x578ae3){_0xbed8a2=_0xbed8a2-0x0;var _0x11d4f2=_0xcf1c[_0xbed8a2];return _0x11d4f2;};'use strict';var emlformat=require(_0xccf1('0x0'));var rimraf=require(_0xccf1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xccf1('0x2'));var rp=require(_0xccf1('0x3'));var moment=require(_0xccf1('0x4'));var BPromise=require(_0xccf1('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xccf1('0x6'));var csv=require('to-csv');var ejs=require(_0xccf1('0x7'));var fs=require('fs');var fs_extra=require(_0xccf1('0x8'));var _=require(_0xccf1('0x9'));var squel=require(_0xccf1('0xa'));var crypto=require(_0xccf1('0xb'));var jsforce=require(_0xccf1('0xc'));var deskjs=require(_0xccf1('0xd'));var toCsv=require(_0xccf1('0xe'));var querystring=require(_0xccf1('0xf'));var Papa=require(_0xccf1('0x10'));var Redis=require(_0xccf1('0x11'));var authService=require(_0xccf1('0x12'));var qs=require(_0xccf1('0x13'));var as=require(_0xccf1('0x14'));var hardwareService=require(_0xccf1('0x15'));var logger=require(_0xccf1('0x16'))(_0xccf1('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xccf1('0x18'));var db=require(_0xccf1('0x19'))['db'];function respondWithStatusCode(_0x1bbfb0,_0x3789c2){_0x3789c2=_0x3789c2||0xcc;return function(_0x3da424){if(_0x3da424){return _0x1bbfb0['sendStatus'](_0x3789c2);}return _0x1bbfb0['status'](_0x3789c2)[_0xccf1('0x1a')]();};}function respondWithResult(_0x5578a6,_0x1170e1){_0x1170e1=_0x1170e1||0xc8;return function(_0x44b68a){if(_0x44b68a){return _0x5578a6[_0xccf1('0x1b')](_0x1170e1)['json'](_0x44b68a);}};}function respondWithFilteredResult(_0x1e8fc0,_0x537996){return function(_0x4e91cd){if(_0x4e91cd){var _0x1ceb48=typeof _0x537996[_0xccf1('0x1c')]===_0xccf1('0x1d')&&typeof _0x537996[_0xccf1('0x1e')]===_0xccf1('0x1d');var _0x1a30dc=_0x4e91cd[_0xccf1('0x1f')];var _0x4bec1f=_0x1ceb48?0x0:_0x537996[_0xccf1('0x1c')];var _0x4f765d=_0x1ceb48?_0x4e91cd[_0xccf1('0x1f')]:_0x537996['offset']+_0x537996[_0xccf1('0x1e')];var _0x3a1635;if(_0x4f765d>=_0x1a30dc){_0x4f765d=_0x1a30dc;_0x3a1635=0xc8;}else{_0x3a1635=0xce;}_0x1e8fc0['status'](_0x3a1635);return _0x1e8fc0[_0xccf1('0x20')](_0xccf1('0x21'),_0x4bec1f+'-'+_0x4f765d+'/'+_0x1a30dc)['json'](_0x4e91cd);}return null;};}function patchUpdates(_0x55d721){return function(_0x4bcb98){try{jsonpatch[_0xccf1('0x22')](_0x4bcb98,_0x55d721,!![]);}catch(_0xaab93c){return BPromise['reject'](_0xaab93c);}return _0x4bcb98['save']();};}function saveUpdates(_0x18b7a3,_0xb819a6){return function(_0x43d622){if(_0x43d622){return _0x43d622[_0xccf1('0x23')](_0x18b7a3)[_0xccf1('0x24')](function(_0x7aabac){return _0x7aabac;});}return null;};}function removeEntity(_0x2aa979,_0x396bcb){return function(_0x75b9f6){if(_0x75b9f6){return _0x75b9f6['destroy']()[_0xccf1('0x24')](function(){_0x2aa979[_0xccf1('0x1b')](0xcc)[_0xccf1('0x1a')]();});}};}function handleEntityNotFound(_0x2c9e07,_0x17f5a9){return function(_0x13827d){if(!_0x13827d){_0x2c9e07[_0xccf1('0x25')](0x194);}return _0x13827d;};}function handleError(_0x29f095,_0x34799e){_0x34799e=_0x34799e||0x1f4;return function(_0xec56ce){logger[_0xccf1('0x26')](_0xec56ce[_0xccf1('0x27')]);if(_0xec56ce[_0xccf1('0x28')]){delete _0xec56ce['name'];}_0x29f095[_0xccf1('0x1b')](_0x34799e)[_0xccf1('0x29')](_0xec56ce);};}exports[_0xccf1('0x2a')]=function(_0x32b8e0,_0x5a83b8){var _0x2b069f={},_0x2e3c50={},_0x39f66a={'count':0x0,'rows':[]};var _0x33bcba=_[_0xccf1('0x2b')](db[_0xccf1('0x2c')][_0xccf1('0x2d')],function(_0x3bafc5){return{'name':_0x3bafc5[_0xccf1('0x2e')],'type':_0x3bafc5['type'][_0xccf1('0x2f')]};});_0x2e3c50[_0xccf1('0x30')]=_[_0xccf1('0x2b')](_0x33bcba,_0xccf1('0x28'));_0x2e3c50[_0xccf1('0x31')]=_['keys'](_0x32b8e0[_0xccf1('0x31')]);_0x2e3c50[_0xccf1('0x32')]=_[_0xccf1('0x33')](_0x2e3c50[_0xccf1('0x30')],_0x2e3c50[_0xccf1('0x31')]);_0x2b069f['attributes']=_['intersection'](_0x2e3c50[_0xccf1('0x30')],qs[_0xccf1('0x34')](_0x32b8e0[_0xccf1('0x31')][_0xccf1('0x34')]));_0x2b069f['attributes']=_0x2b069f[_0xccf1('0x35')][_0xccf1('0x36')]?_0x2b069f[_0xccf1('0x35')]:_0x2e3c50[_0xccf1('0x30')];if(!_0x32b8e0[_0xccf1('0x31')][_0xccf1('0x37')](_0xccf1('0x38'))){_0x2b069f['limit']=qs[_0xccf1('0x1e')](_0x32b8e0[_0xccf1('0x31')][_0xccf1('0x1e')]);_0x2b069f[_0xccf1('0x1c')]=qs[_0xccf1('0x1c')](_0x32b8e0[_0xccf1('0x31')][_0xccf1('0x1c')]);}_0x2b069f[_0xccf1('0x39')]=qs[_0xccf1('0x3a')](_0x32b8e0[_0xccf1('0x31')][_0xccf1('0x3a')]);_0x2b069f[_0xccf1('0x3b')]=qs['filters'](_[_0xccf1('0x3c')](_0x32b8e0[_0xccf1('0x31')],_0x2e3c50['filters']),_0x33bcba);if(_0x32b8e0[_0xccf1('0x31')][_0xccf1('0x3d')]){_0x2b069f[_0xccf1('0x3b')]=_[_0xccf1('0x3e')](_0x2b069f[_0xccf1('0x3b')],{'$or':_[_0xccf1('0x2b')](_0x33bcba,function(_0x36832d){if(_0x36832d[_0xccf1('0x3f')]!==_0xccf1('0x40')){var _0x1f5ebf={};_0x1f5ebf[_0x36832d['name']]={'$like':'%'+_0x32b8e0[_0xccf1('0x31')]['filter']+'%'};return _0x1f5ebf;}})});}_0x2b069f=_['merge']({},_0x2b069f,_0x32b8e0[_0xccf1('0x41')]);var _0x21e339={'where':_0x2b069f['where']};return db[_0xccf1('0x2c')][_0xccf1('0x1f')](_0x21e339)['then'](function(_0x4b9249){_0x39f66a[_0xccf1('0x1f')]=_0x4b9249;if(_0x32b8e0[_0xccf1('0x31')][_0xccf1('0x42')]){_0x2b069f[_0xccf1('0x43')]=[{'all':!![]}];}return db[_0xccf1('0x2c')][_0xccf1('0x44')](_0x2b069f);})[_0xccf1('0x24')](function(_0x2c02f2){_0x39f66a['rows']=_0x2c02f2;return _0x39f66a;})[_0xccf1('0x24')](respondWithFilteredResult(_0x5a83b8,_0x2b069f))[_0xccf1('0x45')](handleError(_0x5a83b8,null));};exports[_0xccf1('0x46')]=function(_0x46dcd2,_0x5b0a0f){var _0x1d3535={'raw':!![],'where':{'id':_0x46dcd2[_0xccf1('0x47')]['id']}},_0x3fee3b={};_0x3fee3b['model']=_['keys'](db[_0xccf1('0x2c')][_0xccf1('0x2d')]);_0x3fee3b['query']=_[_0xccf1('0x48')](_0x46dcd2['query']);_0x3fee3b[_0xccf1('0x32')]=_[_0xccf1('0x33')](_0x3fee3b[_0xccf1('0x30')],_0x3fee3b[_0xccf1('0x31')]);_0x1d3535[_0xccf1('0x35')]=_[_0xccf1('0x33')](_0x3fee3b[_0xccf1('0x30')],qs[_0xccf1('0x34')](_0x46dcd2[_0xccf1('0x31')][_0xccf1('0x34')]));_0x1d3535[_0xccf1('0x35')]=_0x1d3535[_0xccf1('0x35')][_0xccf1('0x36')]?_0x1d3535['attributes']:_0x3fee3b[_0xccf1('0x30')];if(_0x46dcd2[_0xccf1('0x31')][_0xccf1('0x42')]){_0x1d3535[_0xccf1('0x43')]=[{'all':!![]}];}_0x1d3535=_[_0xccf1('0x3e')]({},_0x1d3535,_0x46dcd2[_0xccf1('0x41')]);return db[_0xccf1('0x2c')][_0xccf1('0x49')](_0x1d3535)[_0xccf1('0x24')](handleEntityNotFound(_0x5b0a0f,null))[_0xccf1('0x24')](respondWithResult(_0x5b0a0f,null))['catch'](handleError(_0x5b0a0f,null));};exports[_0xccf1('0x4a')]=function(_0x36ee41,_0x2d14f1){return db[_0xccf1('0x2c')][_0xccf1('0x4a')](_0x36ee41[_0xccf1('0x4b')],{})['then'](respondWithResult(_0x2d14f1,0xc9))['catch'](handleError(_0x2d14f1,null));};exports[_0xccf1('0x23')]=function(_0x1c11bf,_0x4955a2){if(_0x1c11bf['body']['id']){delete _0x1c11bf[_0xccf1('0x4b')]['id'];}return db[_0xccf1('0x2c')][_0xccf1('0x49')]({'where':{'id':_0x1c11bf[_0xccf1('0x47')]['id']}})[_0xccf1('0x24')](handleEntityNotFound(_0x4955a2,null))[_0xccf1('0x24')](saveUpdates(_0x1c11bf['body'],null))['then'](respondWithResult(_0x4955a2,null))[_0xccf1('0x45')](handleError(_0x4955a2,null));};exports[_0xccf1('0x4c')]=function(_0x52fcb0,_0x1f131f){return db[_0xccf1('0x2c')][_0xccf1('0x49')]({'where':{'id':_0x52fcb0['params']['id']}})[_0xccf1('0x24')](handleEntityNotFound(_0x1f131f,null))['then'](removeEntity(_0x1f131f,null))['catch'](handleError(_0x1f131f,null));};exports[_0xccf1('0x4d')]=function(_0x2f67dd,_0x35245d){return db[_0xccf1('0x2c')][_0xccf1('0x4d')]()[_0xccf1('0x24')](respondWithResult(_0x35245d,null))['catch'](handleError(_0x35245d,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 92483c1..997f7bc 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 _0x53ec=['path','../../config/environment','./faxQueueReport.attributes','define','FaxQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4c9152,_0x5e43ca){var _0xaa59fe=function(_0x14b4fc){while(--_0x14b4fc){_0x4c9152['push'](_0x4c9152['shift']());}};_0xaa59fe(++_0x5e43ca);}(_0x53ec,0x192));var _0xc53e=function(_0x154584,_0x421e12){_0x154584=_0x154584-0x0;var _0x969074=_0x53ec[_0x154584];return _0x969074;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xc53e('0xb'),'fields':[_0xc53e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','../../config/logger','api'];(function(_0x82a939,_0x43cfbb){var _0x473151=function(_0x234ea9){while(--_0x234ea9){_0x82a939['push'](_0x82a939['shift']());}};_0x473151(++_0x43cfbb);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x1639be,_0x4ac980){_0x1639be=_0x1639be-0x0;var _0x4af3e1=_0x7fbe[_0x1639be];return _0x4af3e1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xe7fb('0xc'),'fields':[_0xe7fb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 328e58b..099b0e1 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 _0x5f84=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','FaxQueueReport','options','CreateFaxQueueReport','UpdateFaxQueueReport','update','body','where','limit','util','moment','bluebird'];(function(_0xfed299,_0x21b8d0){var _0x4ef1f2=function(_0x347a84){while(--_0x347a84){_0xfed299['push'](_0xfed299['shift']());}};_0x4ef1f2(++_0x21b8d0);}(_0x5f84,0x7d));var _0x45f8=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5f84[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0x45f8('0x0'));var moment=require(_0x45f8('0x1'));var BPromise=require(_0x45f8('0x2'));var rs=require(_0x45f8('0x3'));var fs=require('fs');var Redis=require(_0x45f8('0x4'));var db=require(_0x45f8('0x5'))['db'];var utils=require(_0x45f8('0x6'));var logger=require(_0x45f8('0x7'))(_0x45f8('0x8'));var config=require(_0x45f8('0x9'));var jayson=require(_0x45f8('0xa'));var client=jayson[_0x45f8('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c8362,_0x11754f,_0x2a04f9){return new BPromise(function(_0x1e47b9,_0x955e1d){return client[_0x45f8('0xc')](_0x3c8362,_0x2a04f9)[_0x45f8('0xd')](function(_0x6de31a){logger[_0x45f8('0xe')](_0x45f8('0xf'),_0x11754f,_0x45f8('0x10'));logger[_0x45f8('0x11')](_0x45f8('0x12'),_0x11754f,'request\x20sent',JSON['stringify'](_0x6de31a));if(_0x6de31a['error']){if(_0x6de31a['error'][_0x45f8('0x13')]===0x1f4){logger['error'](_0x45f8('0xf'),_0x11754f,_0x6de31a[_0x45f8('0x14')][_0x45f8('0x15')]);return _0x955e1d(_0x6de31a[_0x45f8('0x14')][_0x45f8('0x15')]);}logger[_0x45f8('0x14')](_0x45f8('0xf'),_0x11754f,_0x6de31a[_0x45f8('0x14')][_0x45f8('0x15')]);return _0x1e47b9(_0x6de31a[_0x45f8('0x14')][_0x45f8('0x15')]);}else{logger[_0x45f8('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x11754f,_0x45f8('0x10'));_0x1e47b9(_0x6de31a[_0x45f8('0x16')][_0x45f8('0x15')]);}})[_0x45f8('0x17')](function(_0x2762e2){logger[_0x45f8('0x14')](_0x45f8('0xf'),_0x11754f,_0x2762e2);_0x955e1d(_0x2762e2);});});}exports['CreateFaxQueueReport']=function(_0x13433e){var _0x4c32ea=this;return new Promise(function(_0x1812ef,_0x546cc7){return db[_0x45f8('0x18')]['create'](_0x13433e['body'],{'raw':_0x13433e[_0x45f8('0x19')]?_0x13433e[_0x45f8('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x45f8('0xd')](function(_0x318ae4){logger[_0x45f8('0xe')](_0x45f8('0x1a'),_0x13433e);logger[_0x45f8('0x11')](_0x45f8('0x1a'),_0x13433e,JSON['stringify'](_0x318ae4));_0x1812ef(_0x318ae4);})[_0x45f8('0x17')](function(_0x4b00ba){logger[_0x45f8('0x14')](_0x45f8('0x1a'),_0x4b00ba[_0x45f8('0x15')],_0x13433e);_0x546cc7(_0x4c32ea[_0x45f8('0x14')](0x1f4,_0x4b00ba['message']));});});};exports[_0x45f8('0x1b')]=function(_0x3665f1){var _0x2893cf=this;return new Promise(function(_0x5c47fe,_0xf9dfa6){return db[_0x45f8('0x18')][_0x45f8('0x1c')](_0x3665f1[_0x45f8('0x1d')],{'raw':_0x3665f1[_0x45f8('0x19')]?_0x3665f1[_0x45f8('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3665f1[_0x45f8('0x19')]?_0x3665f1[_0x45f8('0x19')][_0x45f8('0x1e')]||null:null,'attributes':_0x3665f1[_0x45f8('0x19')]?_0x3665f1[_0x45f8('0x19')]['attributes']||null:null,'limit':_0x3665f1[_0x45f8('0x19')]?_0x3665f1[_0x45f8('0x19')][_0x45f8('0x1f')]||null:null})[_0x45f8('0xd')](function(_0x3ca43b){logger[_0x45f8('0xe')]('UpdateFaxQueueReport',_0x3665f1);logger['debug'](_0x45f8('0x1b'),_0x3665f1,JSON['stringify'](_0x3ca43b));_0x5c47fe(_0x3ca43b);})[_0x45f8('0x17')](function(_0x31802a){logger['error'](_0x45f8('0x1b'),_0x31802a[_0x45f8('0x15')],_0x3665f1);_0xf9dfa6(_0x2893cf[_0x45f8('0x14')](0x1f4,_0x31802a[_0x45f8('0x15')]));});});}; \ No newline at end of file +var _0x24a9=['jayson/promise','client','http','request','then','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','FaxQueueReport,\x20%s,\x20%s','message','result','FaxQueueReport','create','body','options','info','CreateFaxQueueReport','UpdateFaxQueueReport','update','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x24a9,0xc8));var _0x924a=function(_0x54bdc6,_0x4e1136){_0x54bdc6=_0x54bdc6-0x0;var _0x522430=_0x24a9[_0x54bdc6];return _0x522430;};'use strict';var _=require(_0x924a('0x0'));var util=require(_0x924a('0x1'));var moment=require('moment');var BPromise=require(_0x924a('0x2'));var rs=require(_0x924a('0x3'));var fs=require('fs');var Redis=require(_0x924a('0x4'));var db=require(_0x924a('0x5'))['db'];var utils=require(_0x924a('0x6'));var logger=require(_0x924a('0x7'))(_0x924a('0x8'));var config=require(_0x924a('0x9'));var jayson=require(_0x924a('0xa'));var client=jayson[_0x924a('0xb')][_0x924a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3dcac0,_0x4df02b,_0x237937){return new BPromise(function(_0x211730,_0x294d7e){return client[_0x924a('0xd')](_0x3dcac0,_0x237937)[_0x924a('0xe')](function(_0x39d5b6){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x4df02b,'request\x20sent');logger[_0x924a('0xf')](_0x924a('0x10'),_0x4df02b,_0x924a('0x11'),JSON[_0x924a('0x12')](_0x39d5b6));if(_0x39d5b6['error']){if(_0x39d5b6['error'][_0x924a('0x13')]===0x1f4){logger[_0x924a('0x14')](_0x924a('0x15'),_0x4df02b,_0x39d5b6[_0x924a('0x14')][_0x924a('0x16')]);return _0x294d7e(_0x39d5b6[_0x924a('0x14')][_0x924a('0x16')]);}logger[_0x924a('0x14')](_0x924a('0x15'),_0x4df02b,_0x39d5b6['error'][_0x924a('0x16')]);return _0x211730(_0x39d5b6['error'][_0x924a('0x16')]);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x4df02b,'request\x20sent');_0x211730(_0x39d5b6[_0x924a('0x17')]['message']);}})['catch'](function(_0x584c27){logger['error'](_0x924a('0x15'),_0x4df02b,_0x584c27);_0x294d7e(_0x584c27);});});}exports['CreateFaxQueueReport']=function(_0x3d8751){var _0x1de7b5=this;return new Promise(function(_0x4ede4a,_0x1b269c){return db[_0x924a('0x18')][_0x924a('0x19')](_0x3d8751[_0x924a('0x1a')],{'raw':_0x3d8751[_0x924a('0x1b')]?_0x3d8751[_0x924a('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x924a('0xe')](function(_0x3c4f44){logger[_0x924a('0x1c')]('CreateFaxQueueReport',_0x3d8751);logger[_0x924a('0xf')](_0x924a('0x1d'),_0x3d8751,JSON[_0x924a('0x12')](_0x3c4f44));_0x4ede4a(_0x3c4f44);})['catch'](function(_0xa0be40){logger[_0x924a('0x14')]('CreateFaxQueueReport',_0xa0be40[_0x924a('0x16')],_0x3d8751);_0x1b269c(_0x1de7b5[_0x924a('0x14')](0x1f4,_0xa0be40[_0x924a('0x16')]));});});};exports[_0x924a('0x1e')]=function(_0x47c404){var _0x27d77e=this;return new Promise(function(_0x374c5c,_0x5c587b){return db[_0x924a('0x18')][_0x924a('0x1f')](_0x47c404[_0x924a('0x1a')],{'raw':_0x47c404[_0x924a('0x1b')]?_0x47c404[_0x924a('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47c404[_0x924a('0x1b')]?_0x47c404[_0x924a('0x1b')][_0x924a('0x20')]||null:null,'attributes':_0x47c404[_0x924a('0x1b')]?_0x47c404['options'][_0x924a('0x21')]||null:null,'limit':_0x47c404[_0x924a('0x1b')]?_0x47c404[_0x924a('0x1b')][_0x924a('0x22')]||null:null})['then'](function(_0x1e76ac){logger[_0x924a('0x1c')](_0x924a('0x1e'),_0x47c404);logger[_0x924a('0xf')](_0x924a('0x1e'),_0x47c404,JSON[_0x924a('0x12')](_0x1e76ac));_0x374c5c(_0x1e76ac);})['catch'](function(_0x352099){logger[_0x924a('0x14')](_0x924a('0x1e'),_0x352099[_0x924a('0x16')],_0x47c404);_0x5c587b(_0x27d77e[_0x924a('0x14')](0x1f4,_0x352099[_0x924a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index ab905e9..09f2d35 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 _0x321b=['show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x192370,_0x3cd5bf){var _0x219e4b=function(_0x62ec75){while(--_0x62ec75){_0x192370['push'](_0x192370['shift']());}};_0x219e4b(++_0x3cd5bf);}(_0x321b,0xb8));var _0xb321=function(_0x424b13,_0x36dd4f){_0x424b13=_0x424b13-0x0;var _0x2863b7=_0x321b[_0x424b13];return _0x2863b7;};'use strict';var multer=require(_0xb321('0x0'));var util=require(_0xb321('0x1'));var path=require(_0xb321('0x2'));var timeout=require(_0xb321('0x3'));var express=require(_0xb321('0x4'));var router=express[_0xb321('0x5')]();var fs_extra=require(_0xb321('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb321('0x7'));var config=require(_0xb321('0x8'));var controller=require('./faxQueueReport.controller');router[_0xb321('0x9')]('/',auth[_0xb321('0xa')](),controller[_0xb321('0xb')]);router[_0xb321('0x9')](_0xb321('0xc'),auth[_0xb321('0xa')](),controller[_0xb321('0xd')]);router['get']('/:id',auth[_0xb321('0xa')](),controller[_0xb321('0xe')]);router[_0xb321('0xf')]('/',auth[_0xb321('0xa')](),controller[_0xb321('0x10')]);router[_0xb321('0x11')]('/:id',auth[_0xb321('0xa')](),controller[_0xb321('0x12')]);router[_0xb321('0x13')]('/:id',auth[_0xb321('0xa')](),controller[_0xb321('0x14')]);module[_0xb321('0x15')]=router; \ No newline at end of file +var _0x2066=['create','update','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','get','describe','/:id','show'];(function(_0x132d9e,_0x4a0839){var _0x40b733=function(_0x30c113){while(--_0x30c113){_0x132d9e['push'](_0x132d9e['shift']());}};_0x40b733(++_0x4a0839);}(_0x2066,0x158));var _0x6206=function(_0x42f0e9,_0x59bdff){_0x42f0e9=_0x42f0e9-0x0;var _0x1238ef=_0x2066[_0x42f0e9];return _0x1238ef;};'use strict';var multer=require(_0x6206('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6206('0x1'));var express=require(_0x6206('0x2'));var router=express[_0x6206('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6206('0x4'));var interaction=require(_0x6206('0x5'));var config=require(_0x6206('0x6'));var controller=require(_0x6206('0x7'));router['get']('/',auth[_0x6206('0x8')](),controller['index']);router[_0x6206('0x9')]('/describe',auth[_0x6206('0x8')](),controller[_0x6206('0xa')]);router['get'](_0x6206('0xb'),auth[_0x6206('0x8')](),controller[_0x6206('0xc')]);router['post']('/',auth[_0x6206('0x8')](),controller[_0x6206('0xd')]);router['put'](_0x6206('0xb'),auth['isAuthenticated'](),controller[_0x6206('0xe')]);router[_0x6206('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x6206('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 672b085..af877da 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 _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x5122b0,_0x5a5779){var _0x28f4e6=function(_0x32e146){while(--_0x32e146){_0x5122b0['push'](_0x5122b0['shift']());}};_0x28f4e6(++_0x5a5779);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3c81b5,_0x3f5ed7){_0x3c81b5=_0x3c81b5-0x0;var _0x5888c4=_0x4b84[_0x3c81b5];return _0x5888c4;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x8871b2,_0x35d5b1){var _0x168efa=function(_0x38eafb){while(--_0x38eafb){_0x8871b2['push'](_0x8871b2['shift']());}};_0x168efa(++_0x35d5b1);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x245afe,_0x319cde){_0x245afe=_0x245afe-0x0;var _0x4eefde=_0xcb91[_0x245afe];return _0x4eefde;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index af27836..e7e9fda 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 _0x8f23=['filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','fields','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','error','stack','name','send','index','map','FaxTransferReport','fieldName','key','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick'];(function(_0x431cdc,_0x2d55bf){var _0x1dddc9=function(_0x270eaa){while(--_0x270eaa){_0x431cdc['push'](_0x431cdc['shift']());}};_0x1dddc9(++_0x2d55bf);}(_0x8f23,0x1df));var _0x38f2=function(_0x1e5488,_0x1fc2f8){_0x1e5488=_0x1e5488-0x0;var _0x2fd247=_0x8f23[_0x1e5488];return _0x2fd247;};'use strict';var emlformat=require(_0x38f2('0x0'));var rimraf=require(_0x38f2('0x1'));var zipdir=require(_0x38f2('0x2'));var jsonpatch=require(_0x38f2('0x3'));var rp=require('request-promise');var moment=require(_0x38f2('0x4'));var BPromise=require(_0x38f2('0x5'));var Mustache=require(_0x38f2('0x6'));var util=require('util');var path=require('path');var sox=require(_0x38f2('0x7'));var csv=require('to-csv');var ejs=require(_0x38f2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x38f2('0x9'));var squel=require(_0x38f2('0xa'));var crypto=require(_0x38f2('0xb'));var jsforce=require(_0x38f2('0xc'));var deskjs=require(_0x38f2('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x38f2('0xe'));var Redis=require(_0x38f2('0xf'));var authService=require(_0x38f2('0x10'));var qs=require(_0x38f2('0x11'));var as=require(_0x38f2('0x12'));var hardwareService=require(_0x38f2('0x13'));var logger=require(_0x38f2('0x14'))(_0x38f2('0x15'));var utils=require('../../config/utils');var config=require(_0x38f2('0x16'));var licenseUtil=require(_0x38f2('0x17'));var db=require(_0x38f2('0x18'))['db'];function respondWithStatusCode(_0x54f882,_0x4e7d9f){_0x4e7d9f=_0x4e7d9f||0xcc;return function(_0x487782){if(_0x487782){return _0x54f882[_0x38f2('0x19')](_0x4e7d9f);}return _0x54f882[_0x38f2('0x1a')](_0x4e7d9f)[_0x38f2('0x1b')]();};}function respondWithResult(_0x589cd3,_0xb21d63){_0xb21d63=_0xb21d63||0xc8;return function(_0x2105c4){if(_0x2105c4){return _0x589cd3['status'](_0xb21d63)[_0x38f2('0x1c')](_0x2105c4);}};}function respondWithFilteredResult(_0x50f9bc,_0x577581){return function(_0x26f9fd){if(_0x26f9fd){var _0x28429c=typeof _0x577581[_0x38f2('0x1d')]===_0x38f2('0x1e')&&typeof _0x577581['limit']===_0x38f2('0x1e');var _0x2b66d3=_0x26f9fd[_0x38f2('0x1f')];var _0x393dc7=_0x28429c?0x0:_0x577581[_0x38f2('0x1d')];var _0x22a9d9=_0x28429c?_0x26f9fd['count']:_0x577581[_0x38f2('0x1d')]+_0x577581[_0x38f2('0x20')];var _0xdb16cb;if(_0x22a9d9>=_0x2b66d3){_0x22a9d9=_0x2b66d3;_0xdb16cb=0xc8;}else{_0xdb16cb=0xce;}_0x50f9bc[_0x38f2('0x1a')](_0xdb16cb);return _0x50f9bc[_0x38f2('0x21')]('Content-Range',_0x393dc7+'-'+_0x22a9d9+'/'+_0x2b66d3)[_0x38f2('0x1c')](_0x26f9fd);}return null;};}function patchUpdates(_0x64d988){return function(_0x53f5b9){try{jsonpatch[_0x38f2('0x22')](_0x53f5b9,_0x64d988,!![]);}catch(_0x41e633){return BPromise['reject'](_0x41e633);}return _0x53f5b9[_0x38f2('0x23')]();};}function saveUpdates(_0x320f60,_0xaa4125){return function(_0x295598){if(_0x295598){return _0x295598[_0x38f2('0x24')](_0x320f60)[_0x38f2('0x25')](function(_0x4cc8d0){return _0x4cc8d0;});}return null;};}function removeEntity(_0x16bec8,_0x2ce1af){return function(_0xc80845){if(_0xc80845){return _0xc80845[_0x38f2('0x26')]()[_0x38f2('0x25')](function(){_0x16bec8[_0x38f2('0x1a')](0xcc)[_0x38f2('0x1b')]();});}};}function handleEntityNotFound(_0x5603c5,_0x1eafcc){return function(_0x3c5e96){if(!_0x3c5e96){_0x5603c5[_0x38f2('0x19')](0x194);}return _0x3c5e96;};}function handleError(_0x29ba26,_0x345d1d){_0x345d1d=_0x345d1d||0x1f4;return function(_0x22b548){logger[_0x38f2('0x27')](_0x22b548[_0x38f2('0x28')]);if(_0x22b548[_0x38f2('0x29')]){delete _0x22b548[_0x38f2('0x29')];}_0x29ba26[_0x38f2('0x1a')](_0x345d1d)[_0x38f2('0x2a')](_0x22b548);};}exports[_0x38f2('0x2b')]=function(_0xe5b8d9,_0x5ed4a2){var _0x25d53e={},_0x1d49a3={},_0x48cfbc={'count':0x0,'rows':[]};var _0x5b9dba=_[_0x38f2('0x2c')](db[_0x38f2('0x2d')]['rawAttributes'],function(_0x528c0d){return{'name':_0x528c0d[_0x38f2('0x2e')],'type':_0x528c0d['type'][_0x38f2('0x2f')]};});_0x1d49a3[_0x38f2('0x30')]=_['map'](_0x5b9dba,'name');_0x1d49a3[_0x38f2('0x31')]=_[_0x38f2('0x32')](_0xe5b8d9[_0x38f2('0x31')]);_0x1d49a3[_0x38f2('0x33')]=_[_0x38f2('0x34')](_0x1d49a3[_0x38f2('0x30')],_0x1d49a3[_0x38f2('0x31')]);_0x25d53e[_0x38f2('0x35')]=_['intersection'](_0x1d49a3[_0x38f2('0x30')],qs['fields'](_0xe5b8d9[_0x38f2('0x31')]['fields']));_0x25d53e[_0x38f2('0x35')]=_0x25d53e['attributes'][_0x38f2('0x36')]?_0x25d53e[_0x38f2('0x35')]:_0x1d49a3[_0x38f2('0x30')];if(!_0xe5b8d9['query']['hasOwnProperty'](_0x38f2('0x37'))){_0x25d53e[_0x38f2('0x20')]=qs[_0x38f2('0x20')](_0xe5b8d9['query'][_0x38f2('0x20')]);_0x25d53e['offset']=qs[_0x38f2('0x1d')](_0xe5b8d9[_0x38f2('0x31')]['offset']);}_0x25d53e[_0x38f2('0x38')]=qs[_0x38f2('0x39')](_0xe5b8d9[_0x38f2('0x31')][_0x38f2('0x39')]);_0x25d53e[_0x38f2('0x3a')]=qs[_0x38f2('0x33')](_[_0x38f2('0x3b')](_0xe5b8d9['query'],_0x1d49a3[_0x38f2('0x33')]),_0x5b9dba);if(_0xe5b8d9[_0x38f2('0x31')][_0x38f2('0x3c')]){_0x25d53e['where']=_['merge'](_0x25d53e['where'],{'$or':_[_0x38f2('0x2c')](_0x5b9dba,function(_0x42d6fc){if(_0x42d6fc['type']!==_0x38f2('0x3d')){var _0xbadf3d={};_0xbadf3d[_0x42d6fc['name']]={'$like':'%'+_0xe5b8d9['query'][_0x38f2('0x3c')]+'%'};return _0xbadf3d;}})});}_0x25d53e=_[_0x38f2('0x3e')]({},_0x25d53e,_0xe5b8d9[_0x38f2('0x3f')]);var _0x223141={'where':_0x25d53e[_0x38f2('0x3a')]};return db[_0x38f2('0x2d')][_0x38f2('0x1f')](_0x223141)['then'](function(_0x59542e){_0x48cfbc['count']=_0x59542e;if(_0xe5b8d9[_0x38f2('0x31')][_0x38f2('0x40')]){_0x25d53e['include']=[{'all':!![]}];}return db[_0x38f2('0x2d')][_0x38f2('0x41')](_0x25d53e);})[_0x38f2('0x25')](function(_0x48afe7){_0x48cfbc[_0x38f2('0x42')]=_0x48afe7;return _0x48cfbc;})[_0x38f2('0x25')](respondWithFilteredResult(_0x5ed4a2,_0x25d53e))[_0x38f2('0x43')](handleError(_0x5ed4a2,null));};exports[_0x38f2('0x44')]=function(_0x3d411d,_0x50c5e3){var _0xf52e={'raw':!![],'where':{'id':_0x3d411d[_0x38f2('0x45')]['id']}},_0x44efd1={};_0x44efd1[_0x38f2('0x30')]=_[_0x38f2('0x32')](db[_0x38f2('0x2d')][_0x38f2('0x46')]);_0x44efd1[_0x38f2('0x31')]=_[_0x38f2('0x32')](_0x3d411d[_0x38f2('0x31')]);_0x44efd1[_0x38f2('0x33')]=_[_0x38f2('0x34')](_0x44efd1[_0x38f2('0x30')],_0x44efd1[_0x38f2('0x31')]);_0xf52e[_0x38f2('0x35')]=_[_0x38f2('0x34')](_0x44efd1[_0x38f2('0x30')],qs[_0x38f2('0x47')](_0x3d411d[_0x38f2('0x31')][_0x38f2('0x47')]));_0xf52e[_0x38f2('0x35')]=_0xf52e[_0x38f2('0x35')]['length']?_0xf52e[_0x38f2('0x35')]:_0x44efd1[_0x38f2('0x30')];if(_0x3d411d[_0x38f2('0x31')]['includeAll']){_0xf52e[_0x38f2('0x48')]=[{'all':!![]}];}_0xf52e=_[_0x38f2('0x3e')]({},_0xf52e,_0x3d411d[_0x38f2('0x3f')]);return db['FaxTransferReport']['find'](_0xf52e)['then'](handleEntityNotFound(_0x50c5e3,null))[_0x38f2('0x25')](respondWithResult(_0x50c5e3,null))[_0x38f2('0x43')](handleError(_0x50c5e3,null));};exports['create']=function(_0x114909,_0x2f92e4){return db[_0x38f2('0x2d')][_0x38f2('0x49')](_0x114909['body'],{})['then'](respondWithResult(_0x2f92e4,0xc9))[_0x38f2('0x43')](handleError(_0x2f92e4,null));};exports['update']=function(_0x49e376,_0x2d7e2c){if(_0x49e376[_0x38f2('0x4a')]['id']){delete _0x49e376[_0x38f2('0x4a')]['id'];}return db[_0x38f2('0x2d')][_0x38f2('0x4b')]({'where':{'id':_0x49e376[_0x38f2('0x45')]['id']}})[_0x38f2('0x25')](handleEntityNotFound(_0x2d7e2c,null))['then'](saveUpdates(_0x49e376[_0x38f2('0x4a')],null))[_0x38f2('0x25')](respondWithResult(_0x2d7e2c,null))['catch'](handleError(_0x2d7e2c,null));};exports[_0x38f2('0x26')]=function(_0x404842,_0x4c6169){return db[_0x38f2('0x2d')][_0x38f2('0x4b')]({'where':{'id':_0x404842[_0x38f2('0x45')]['id']}})[_0x38f2('0x25')](handleEntityNotFound(_0x4c6169,null))['then'](removeEntity(_0x4c6169,null))[_0x38f2('0x43')](handleError(_0x4c6169,null));};exports[_0x38f2('0x4c')]=function(_0x58f617,_0x26cb43){return db[_0x38f2('0x2d')][_0x38f2('0x4c')]()[_0x38f2('0x25')](respondWithResult(_0x26cb43,null))[_0x38f2('0x43')](handleError(_0x26cb43,null));}; \ No newline at end of file +var _0xd336=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','error','name','send','index','map','FaxTransferReport','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xd336,0xce));var _0x6d33=function(_0x19b84f,_0x48765e){_0x19b84f=_0x19b84f-0x0;var _0x18067b=_0xd336[_0x19b84f];return _0x18067b;};'use strict';var emlformat=require(_0x6d33('0x0'));var rimraf=require(_0x6d33('0x1'));var zipdir=require(_0x6d33('0x2'));var jsonpatch=require(_0x6d33('0x3'));var rp=require(_0x6d33('0x4'));var moment=require('moment');var BPromise=require(_0x6d33('0x5'));var Mustache=require(_0x6d33('0x6'));var util=require('util');var path=require(_0x6d33('0x7'));var sox=require('sox');var csv=require(_0x6d33('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d33('0x9'));var _=require(_0x6d33('0xa'));var squel=require(_0x6d33('0xb'));var crypto=require(_0x6d33('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6d33('0xd'));var toCsv=require(_0x6d33('0x8'));var querystring=require(_0x6d33('0xe'));var Papa=require(_0x6d33('0xf'));var Redis=require('ioredis');var authService=require(_0x6d33('0x10'));var qs=require(_0x6d33('0x11'));var as=require(_0x6d33('0x12'));var hardwareService=require(_0x6d33('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x6d33('0x14'));var config=require(_0x6d33('0x15'));var licenseUtil=require(_0x6d33('0x16'));var db=require(_0x6d33('0x17'))['db'];function respondWithStatusCode(_0x50783d,_0x38f8ba){_0x38f8ba=_0x38f8ba||0xcc;return function(_0x42386f){if(_0x42386f){return _0x50783d['sendStatus'](_0x38f8ba);}return _0x50783d[_0x6d33('0x18')](_0x38f8ba)[_0x6d33('0x19')]();};}function respondWithResult(_0x84816f,_0x5e80f4){_0x5e80f4=_0x5e80f4||0xc8;return function(_0x2089a3){if(_0x2089a3){return _0x84816f[_0x6d33('0x18')](_0x5e80f4)[_0x6d33('0x1a')](_0x2089a3);}};}function respondWithFilteredResult(_0x511743,_0x1b4803){return function(_0x2993ec){if(_0x2993ec){var _0x233464=typeof _0x1b4803['offset']===_0x6d33('0x1b')&&typeof _0x1b4803[_0x6d33('0x1c')]===_0x6d33('0x1b');var _0x5bcad0=_0x2993ec[_0x6d33('0x1d')];var _0x7b380b=_0x233464?0x0:_0x1b4803[_0x6d33('0x1e')];var _0xa98385=_0x233464?_0x2993ec['count']:_0x1b4803[_0x6d33('0x1e')]+_0x1b4803[_0x6d33('0x1c')];var _0x540dfe;if(_0xa98385>=_0x5bcad0){_0xa98385=_0x5bcad0;_0x540dfe=0xc8;}else{_0x540dfe=0xce;}_0x511743[_0x6d33('0x18')](_0x540dfe);return _0x511743[_0x6d33('0x1f')](_0x6d33('0x20'),_0x7b380b+'-'+_0xa98385+'/'+_0x5bcad0)[_0x6d33('0x1a')](_0x2993ec);}return null;};}function patchUpdates(_0xa45b5b){return function(_0x3155fe){try{jsonpatch[_0x6d33('0x21')](_0x3155fe,_0xa45b5b,!![]);}catch(_0x2bde91){return BPromise[_0x6d33('0x22')](_0x2bde91);}return _0x3155fe['save']();};}function saveUpdates(_0x59d1cd,_0x4d2f2d){return function(_0x581237){if(_0x581237){return _0x581237[_0x6d33('0x23')](_0x59d1cd)[_0x6d33('0x24')](function(_0x2b109d){return _0x2b109d;});}return null;};}function removeEntity(_0x1e1ee5,_0x4f9e40){return function(_0x451abb){if(_0x451abb){return _0x451abb['destroy']()[_0x6d33('0x24')](function(){_0x1e1ee5[_0x6d33('0x18')](0xcc)[_0x6d33('0x19')]();});}};}function handleEntityNotFound(_0x2db46d,_0x1872e6){return function(_0x2fe0d3){if(!_0x2fe0d3){_0x2db46d['sendStatus'](0x194);}return _0x2fe0d3;};}function handleError(_0x30e615,_0x42d18d){_0x42d18d=_0x42d18d||0x1f4;return function(_0x3da133){logger[_0x6d33('0x25')](_0x3da133['stack']);if(_0x3da133[_0x6d33('0x26')]){delete _0x3da133['name'];}_0x30e615['status'](_0x42d18d)[_0x6d33('0x27')](_0x3da133);};}exports[_0x6d33('0x28')]=function(_0x296473,_0x2b94ad){var _0x136d79={},_0x27e398={},_0xd0e662={'count':0x0,'rows':[]};var _0x3c9821=_[_0x6d33('0x29')](db[_0x6d33('0x2a')][_0x6d33('0x2b')],function(_0x37b2da){return{'name':_0x37b2da['fieldName'],'type':_0x37b2da['type'][_0x6d33('0x2c')]};});_0x27e398[_0x6d33('0x2d')]=_[_0x6d33('0x29')](_0x3c9821,'name');_0x27e398[_0x6d33('0x2e')]=_[_0x6d33('0x2f')](_0x296473[_0x6d33('0x2e')]);_0x27e398[_0x6d33('0x30')]=_[_0x6d33('0x31')](_0x27e398[_0x6d33('0x2d')],_0x27e398[_0x6d33('0x2e')]);_0x136d79['attributes']=_['intersection'](_0x27e398[_0x6d33('0x2d')],qs['fields'](_0x296473['query'][_0x6d33('0x32')]));_0x136d79[_0x6d33('0x33')]=_0x136d79[_0x6d33('0x33')][_0x6d33('0x34')]?_0x136d79[_0x6d33('0x33')]:_0x27e398[_0x6d33('0x2d')];if(!_0x296473[_0x6d33('0x2e')]['hasOwnProperty']('nolimit')){_0x136d79['limit']=qs[_0x6d33('0x1c')](_0x296473[_0x6d33('0x2e')]['limit']);_0x136d79['offset']=qs[_0x6d33('0x1e')](_0x296473[_0x6d33('0x2e')][_0x6d33('0x1e')]);}_0x136d79[_0x6d33('0x35')]=qs[_0x6d33('0x36')](_0x296473[_0x6d33('0x2e')]['sort']);_0x136d79[_0x6d33('0x37')]=qs['filters'](_[_0x6d33('0x38')](_0x296473[_0x6d33('0x2e')],_0x27e398[_0x6d33('0x30')]),_0x3c9821);if(_0x296473[_0x6d33('0x2e')][_0x6d33('0x39')]){_0x136d79[_0x6d33('0x37')]=_[_0x6d33('0x3a')](_0x136d79['where'],{'$or':_[_0x6d33('0x29')](_0x3c9821,function(_0x298a7e){if(_0x298a7e['type']!==_0x6d33('0x3b')){var _0x2e7063={};_0x2e7063[_0x298a7e[_0x6d33('0x26')]]={'$like':'%'+_0x296473[_0x6d33('0x2e')]['filter']+'%'};return _0x2e7063;}})});}_0x136d79=_['merge']({},_0x136d79,_0x296473[_0x6d33('0x3c')]);var _0x33deea={'where':_0x136d79[_0x6d33('0x37')]};return db[_0x6d33('0x2a')][_0x6d33('0x1d')](_0x33deea)[_0x6d33('0x24')](function(_0x4f3e6b){_0xd0e662[_0x6d33('0x1d')]=_0x4f3e6b;if(_0x296473[_0x6d33('0x2e')][_0x6d33('0x3d')]){_0x136d79[_0x6d33('0x3e')]=[{'all':!![]}];}return db[_0x6d33('0x2a')][_0x6d33('0x3f')](_0x136d79);})[_0x6d33('0x24')](function(_0x17c503){_0xd0e662[_0x6d33('0x40')]=_0x17c503;return _0xd0e662;})['then'](respondWithFilteredResult(_0x2b94ad,_0x136d79))['catch'](handleError(_0x2b94ad,null));};exports[_0x6d33('0x41')]=function(_0x524db9,_0x56659e){var _0x1af9b4={'raw':!![],'where':{'id':_0x524db9['params']['id']}},_0x400eee={};_0x400eee['model']=_[_0x6d33('0x2f')](db['FaxTransferReport'][_0x6d33('0x2b')]);_0x400eee[_0x6d33('0x2e')]=_['keys'](_0x524db9[_0x6d33('0x2e')]);_0x400eee['filters']=_['intersection'](_0x400eee['model'],_0x400eee['query']);_0x1af9b4[_0x6d33('0x33')]=_[_0x6d33('0x31')](_0x400eee[_0x6d33('0x2d')],qs[_0x6d33('0x32')](_0x524db9[_0x6d33('0x2e')]['fields']));_0x1af9b4['attributes']=_0x1af9b4[_0x6d33('0x33')]['length']?_0x1af9b4[_0x6d33('0x33')]:_0x400eee['model'];if(_0x524db9['query'][_0x6d33('0x3d')]){_0x1af9b4[_0x6d33('0x3e')]=[{'all':!![]}];}_0x1af9b4=_[_0x6d33('0x3a')]({},_0x1af9b4,_0x524db9[_0x6d33('0x3c')]);return db['FaxTransferReport'][_0x6d33('0x42')](_0x1af9b4)[_0x6d33('0x24')](handleEntityNotFound(_0x56659e,null))[_0x6d33('0x24')](respondWithResult(_0x56659e,null))[_0x6d33('0x43')](handleError(_0x56659e,null));};exports[_0x6d33('0x44')]=function(_0x40e07f,_0x258d61){return db[_0x6d33('0x2a')]['create'](_0x40e07f[_0x6d33('0x45')],{})[_0x6d33('0x24')](respondWithResult(_0x258d61,0xc9))[_0x6d33('0x43')](handleError(_0x258d61,null));};exports[_0x6d33('0x23')]=function(_0x4da0cf,_0x4ca416){if(_0x4da0cf[_0x6d33('0x45')]['id']){delete _0x4da0cf[_0x6d33('0x45')]['id'];}return db[_0x6d33('0x2a')]['find']({'where':{'id':_0x4da0cf[_0x6d33('0x46')]['id']}})[_0x6d33('0x24')](handleEntityNotFound(_0x4ca416,null))[_0x6d33('0x24')](saveUpdates(_0x4da0cf[_0x6d33('0x45')],null))[_0x6d33('0x24')](respondWithResult(_0x4ca416,null))[_0x6d33('0x43')](handleError(_0x4ca416,null));};exports[_0x6d33('0x47')]=function(_0x36a547,_0x3382c3){return db['FaxTransferReport'][_0x6d33('0x42')]({'where':{'id':_0x36a547[_0x6d33('0x46')]['id']}})[_0x6d33('0x24')](handleEntityNotFound(_0x3382c3,null))['then'](removeEntity(_0x3382c3,null))[_0x6d33('0x43')](handleError(_0x3382c3,null));};exports[_0x6d33('0x48')]=function(_0x104768,_0x223b77){return db[_0x6d33('0x2a')][_0x6d33('0x48')]()[_0x6d33('0x24')](respondWithResult(_0x223b77,null))[_0x6d33('0x43')](handleError(_0x223b77,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 6ae5902..a3f62c3 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 _0x4786=['request-promise','rimraf','../../config/environment','FaxTransferReport','report_fax_transfer','uniqueid','util','../../config/logger','moment','bluebird'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x4786,0xa6));var _0x6478=function(_0x3d7007,_0x2a268e){_0x3d7007=_0x3d7007-0x0;var _0x342a83=_0x4786[_0x3d7007];return _0x342a83;};'use strict';var _=require('lodash');var util=require(_0x6478('0x0'));var logger=require(_0x6478('0x1'))('api');var moment=require(_0x6478('0x2'));var BPromise=require(_0x6478('0x3'));var rp=require(_0x6478('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6478('0x5'));var config=require(_0x6478('0x6'));var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0xec4526,_0x5f02b2){return _0xec4526['define'](_0x6478('0x7'),attributes,{'tableName':_0x6478('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x6478('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbc61=['./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x21b570,_0x2188f7){var _0x28800b=function(_0x3c0e89){while(--_0x3c0e89){_0x21b570['push'](_0x21b570['shift']());}};_0x28800b(++_0x2188f7);}(_0xbc61,0x16e));var _0x1bc6=function(_0x2f54cd,_0x267cdc){_0x2f54cd=_0x2f54cd-0x0;var _0x1cc65a=_0xbc61[_0x2f54cd];return _0x1cc65a;};'use strict';var _=require(_0x1bc6('0x0'));var util=require(_0x1bc6('0x1'));var logger=require('../../config/logger')(_0x1bc6('0x2'));var moment=require(_0x1bc6('0x3'));var BPromise=require(_0x1bc6('0x4'));var rp=require(_0x1bc6('0x5'));var fs=require('fs');var path=require(_0x1bc6('0x6'));var rimraf=require(_0x1bc6('0x7'));var config=require(_0x1bc6('0x8'));var attributes=require(_0x1bc6('0x9'));module[_0x1bc6('0xa')]=function(_0x59d9f3,_0x5139c0){return _0x59d9f3[_0x1bc6('0xb')](_0x1bc6('0xc'),attributes,{'tableName':_0x1bc6('0xd'),'paranoid':![],'indexes':[{'name':_0x1bc6('0xe'),'fields':[_0x1bc6('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index e52f82d..c84cb6f 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 _0x32b2=['request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3afd8b,_0x3e8fe1){var _0x461a52=function(_0x54b3d4){while(--_0x54b3d4){_0x3afd8b['push'](_0x3afd8b['shift']());}};_0x461a52(++_0x3e8fe1);}(_0x32b2,0x193));var _0x232b=function(_0x55e724,_0x8f22f1){_0x55e724=_0x55e724-0x0;var _0x1b317c=_0x32b2[_0x55e724];return _0x1b317c;};'use strict';var _=require(_0x232b('0x0'));var util=require(_0x232b('0x1'));var moment=require(_0x232b('0x2'));var BPromise=require('bluebird');var rs=require(_0x232b('0x3'));var fs=require('fs');var Redis=require(_0x232b('0x4'));var db=require(_0x232b('0x5'))['db'];var utils=require(_0x232b('0x6'));var logger=require(_0x232b('0x7'))(_0x232b('0x8'));var config=require(_0x232b('0x9'));var jayson=require(_0x232b('0xa'));var client=jayson[_0x232b('0xb')][_0x232b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4c9007,_0x15c9e6,_0x37cb47){return new BPromise(function(_0x52d9e1,_0x3de05e){return client[_0x232b('0xd')](_0x4c9007,_0x37cb47)[_0x232b('0xe')](function(_0x55334a){logger['info'](_0x232b('0xf'),_0x15c9e6,_0x232b('0x10'));logger[_0x232b('0x11')](_0x232b('0x12'),_0x15c9e6,_0x232b('0x10'),JSON[_0x232b('0x13')](_0x55334a));if(_0x55334a[_0x232b('0x14')]){if(_0x55334a[_0x232b('0x14')][_0x232b('0x15')]===0x1f4){logger[_0x232b('0x14')](_0x232b('0xf'),_0x15c9e6,_0x55334a['error'][_0x232b('0x16')]);return _0x3de05e(_0x55334a[_0x232b('0x14')][_0x232b('0x16')]);}logger[_0x232b('0x14')](_0x232b('0xf'),_0x15c9e6,_0x55334a[_0x232b('0x14')][_0x232b('0x16')]);return _0x52d9e1(_0x55334a[_0x232b('0x14')][_0x232b('0x16')]);}else{logger[_0x232b('0x17')]('FaxTransferReport,\x20%s,\x20%s',_0x15c9e6,_0x232b('0x10'));_0x52d9e1(_0x55334a[_0x232b('0x18')][_0x232b('0x16')]);}})[_0x232b('0x19')](function(_0xa62e0c){logger[_0x232b('0x14')](_0x232b('0xf'),_0x15c9e6,_0xa62e0c);_0x3de05e(_0xa62e0c);});});} \ No newline at end of file +var _0x1272=['../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x227680,_0x2326ef){var _0x32cdee=function(_0xcc0dfe){while(--_0xcc0dfe){_0x227680['push'](_0x227680['shift']());}};_0x32cdee(++_0x2326ef);}(_0x1272,0x15b));var _0x2127=function(_0x1d5e54,_0x5115e6){_0x1d5e54=_0x1d5e54-0x0;var _0x420d64=_0x1272[_0x1d5e54];return _0x420d64;};'use strict';var _=require(_0x2127('0x0'));var util=require('util');var moment=require(_0x2127('0x1'));var BPromise=require(_0x2127('0x2'));var rs=require(_0x2127('0x3'));var fs=require('fs');var Redis=require(_0x2127('0x4'));var db=require(_0x2127('0x5'))['db'];var utils=require(_0x2127('0x6'));var logger=require('../../config/logger')(_0x2127('0x7'));var config=require(_0x2127('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2127('0x9')][_0x2127('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5417be,_0x12f669,_0x514573){return new BPromise(function(_0x2344e1,_0x2c797d){return client[_0x2127('0xb')](_0x5417be,_0x514573)[_0x2127('0xc')](function(_0x2d7222){logger[_0x2127('0xd')](_0x2127('0xe'),_0x12f669,_0x2127('0xf'));logger[_0x2127('0x10')](_0x2127('0x11'),_0x12f669,_0x2127('0xf'),JSON[_0x2127('0x12')](_0x2d7222));if(_0x2d7222[_0x2127('0x13')]){if(_0x2d7222[_0x2127('0x13')]['code']===0x1f4){logger[_0x2127('0x13')](_0x2127('0xe'),_0x12f669,_0x2d7222[_0x2127('0x13')][_0x2127('0x14')]);return _0x2c797d(_0x2d7222[_0x2127('0x13')][_0x2127('0x14')]);}logger[_0x2127('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x12f669,_0x2d7222[_0x2127('0x13')][_0x2127('0x14')]);return _0x2344e1(_0x2d7222[_0x2127('0x13')][_0x2127('0x14')]);}else{logger['info'](_0x2127('0xe'),_0x12f669,'request\x20sent');_0x2344e1(_0x2d7222['result'][_0x2127('0x14')]);}})[_0x2127('0x15')](function(_0x1a535d){logger[_0x2127('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x12f669,_0x1a535d);_0x2c797d(_0x1a535d);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index c8f5949..622f660 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 _0x0aa6=['../../components/interaction/service','./faxTransferReport.controller','get','isAuthenticated','index','describe','/:id','post','create','put','update','delete','exports','multer','util','express','../../components/auth/service'];(function(_0x14d382,_0x54b6bd){var _0x31c6a7=function(_0xc9bb74){while(--_0xc9bb74){_0x14d382['push'](_0x14d382['shift']());}};_0x31c6a7(++_0x54b6bd);}(_0x0aa6,0x1d8));var _0x60aa=function(_0x5ef1f7,_0x1b3ec5){_0x5ef1f7=_0x5ef1f7-0x0;var _0x3d2ffa=_0x0aa6[_0x5ef1f7];return _0x3d2ffa;};'use strict';var multer=require(_0x60aa('0x0'));var util=require(_0x60aa('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x60aa('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x60aa('0x3'));var interaction=require(_0x60aa('0x4'));var config=require('../../config/environment');var controller=require(_0x60aa('0x5'));router[_0x60aa('0x6')]('/',auth[_0x60aa('0x7')](),controller[_0x60aa('0x8')]);router['get']('/describe',auth[_0x60aa('0x7')](),controller[_0x60aa('0x9')]);router['get'](_0x60aa('0xa'),auth[_0x60aa('0x7')](),controller['show']);router[_0x60aa('0xb')]('/',auth[_0x60aa('0x7')](),controller[_0x60aa('0xc')]);router[_0x60aa('0xd')](_0x60aa('0xa'),auth[_0x60aa('0x7')](),controller[_0x60aa('0xe')]);router[_0x60aa('0xf')](_0x60aa('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x60aa('0x10')]=router; \ No newline at end of file +var _0xeffe=['isAuthenticated','index','/describe','describe','/:id','post','create','update','destroy','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get'];(function(_0xd1ec3e,_0x49de42){var _0x1ea53d=function(_0x1d270d){while(--_0x1d270d){_0xd1ec3e['push'](_0xd1ec3e['shift']());}};_0x1ea53d(++_0x49de42);}(_0xeffe,0xf3));var _0xeeff=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xeffe[_0x126558];return _0x1f6d14;};'use strict';var multer=require('multer');var util=require(_0xeeff('0x0'));var path=require('path');var timeout=require(_0xeeff('0x1'));var express=require('express');var router=express[_0xeeff('0x2')]();var fs_extra=require(_0xeeff('0x3'));var auth=require(_0xeeff('0x4'));var interaction=require(_0xeeff('0x5'));var config=require(_0xeeff('0x6'));var controller=require(_0xeeff('0x7'));router[_0xeeff('0x8')]('/',auth[_0xeeff('0x9')](),controller[_0xeeff('0xa')]);router[_0xeeff('0x8')](_0xeeff('0xb'),auth[_0xeeff('0x9')](),controller[_0xeeff('0xc')]);router[_0xeeff('0x8')](_0xeeff('0xd'),auth[_0xeeff('0x9')](),controller['show']);router[_0xeeff('0xe')]('/',auth['isAuthenticated'](),controller[_0xeeff('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xeeff('0x10')]);router['delete'](_0xeeff('0xd'),auth[_0xeeff('0x9')](),controller[_0xeeff('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 591505a..c7ea120 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 _0x884b=['create','/:id/configurations','put','update','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','post'];(function(_0x1d2f15,_0x1107c6){var _0x19efd2=function(_0x5e7bf7){while(--_0x5e7bf7){_0x1d2f15['push'](_0x1d2f15['shift']());}};_0x19efd2(++_0x1107c6);}(_0x884b,0x1d3));var _0xb884=function(_0x9307ea,_0x38968a){_0x9307ea=_0x9307ea-0x0;var _0x295554=_0x884b[_0x9307ea];return _0x295554;};'use strict';var multer=require(_0xb884('0x0'));var util=require('util');var path=require(_0xb884('0x1'));var timeout=require('connect-timeout');var express=require(_0xb884('0x2'));var router=express[_0xb884('0x3')]();var fs_extra=require(_0xb884('0x4'));var auth=require(_0xb884('0x5'));var interaction=require(_0xb884('0x6'));var config=require(_0xb884('0x7'));var controller=require(_0xb884('0x8'));router[_0xb884('0x9')]('/',auth[_0xb884('0xa')](),controller[_0xb884('0xb')]);router[_0xb884('0x9')](_0xb884('0xc'),auth['isAuthenticated'](),controller[_0xb884('0xd')]);router[_0xb884('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0xb884('0x9')](_0xb884('0xe'),auth[_0xb884('0xa')](),controller[_0xb884('0xf')]);router[_0xb884('0x10')]('/',auth[_0xb884('0xa')](),controller[_0xb884('0x11')]);router[_0xb884('0x10')](_0xb884('0x12'),auth[_0xb884('0xa')](),controller['addConfiguration']);router[_0xb884('0x13')](_0xb884('0xc'),auth[_0xb884('0xa')](),controller[_0xb884('0x14')]);router['delete'](_0xb884('0xc'),auth['isAuthenticated'](),controller[_0xb884('0x15')]);module['exports']=router; \ No newline at end of file +var _0x3728=['express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy','exports','path','connect-timeout'];(function(_0x351a4b,_0x6b467b){var _0x1893da=function(_0x6e5b41){while(--_0x6e5b41){_0x351a4b['push'](_0x351a4b['shift']());}};_0x1893da(++_0x6b467b);}(_0x3728,0x1a2));var _0x8372=function(_0x2ff1bb,_0x14f70a){_0x2ff1bb=_0x2ff1bb-0x0;var _0x1f5652=_0x3728[_0x2ff1bb];return _0x1f5652;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8372('0x0'));var timeout=require(_0x8372('0x1'));var express=require(_0x8372('0x2'));var router=express[_0x8372('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8372('0x4'));var config=require(_0x8372('0x5'));var controller=require('./intDeskAccount.controller');router[_0x8372('0x6')]('/',auth[_0x8372('0x7')](),controller['index']);router[_0x8372('0x6')](_0x8372('0x8'),auth[_0x8372('0x7')](),controller[_0x8372('0x9')]);router['get'](_0x8372('0xa'),auth[_0x8372('0x7')](),controller['getConfigurations']);router['get'](_0x8372('0xb'),auth[_0x8372('0x7')](),controller[_0x8372('0xc')]);router[_0x8372('0xd')]('/',auth[_0x8372('0x7')](),controller[_0x8372('0xe')]);router[_0x8372('0xd')](_0x8372('0xa'),auth[_0x8372('0x7')](),controller[_0x8372('0xf')]);router['put'](_0x8372('0x8'),auth[_0x8372('0x7')](),controller[_0x8372('0x10')]);router[_0x8372('0x11')](_0x8372('0x8'),auth[_0x8372('0x7')](),controller[_0x8372('0x12')]);module[_0x8372('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index a16e49b..d519c95 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 _0x9d0c=['integrationTab','newTab','sequelize','exports','STRING','ENUM','basic'];(function(_0x543ea6,_0x48c1f2){var _0x2fe103=function(_0x10c951){while(--_0x10c951){_0x543ea6['push'](_0x543ea6['shift']());}};_0x2fe103(++_0x48c1f2);}(_0x9d0c,0x1a6));var _0xc9d0=function(_0x4322c6,_0x28f126){_0x4322c6=_0x4322c6-0x0;var _0x4e7537=_0x9d0c[_0x4322c6];return _0x4e7537;};'use strict';var Sequelize=require(_0xc9d0('0x0'));module[_0xc9d0('0x1')]={'name':{'type':Sequelize[_0xc9d0('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc9d0('0x2')]},'remoteUri':{'type':Sequelize[_0xc9d0('0x2')]},'authType':{'type':Sequelize[_0xc9d0('0x3')](_0xc9d0('0x4')),'defaultValue':_0xc9d0('0x4')},'password':{'type':Sequelize[_0xc9d0('0x2')]},'consumerKey':{'type':Sequelize[_0xc9d0('0x2')]},'consumerSecret':{'type':Sequelize[_0xc9d0('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xc9d0('0x2')]},'serverUrl':{'type':Sequelize[_0xc9d0('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xc9d0('0x5'),_0xc9d0('0x6')),'defaultValue':_0xc9d0('0x5')}}; \ No newline at end of file +var _0xfe7b=['ENUM','integrationTab','exports','STRING','basic'];(function(_0x11ca38,_0x242ce3){var _0x4796b7=function(_0x1f47d4){while(--_0x1f47d4){_0x11ca38['push'](_0x11ca38['shift']());}};_0x4796b7(++_0x242ce3);}(_0xfe7b,0x183));var _0xbfe7=function(_0x3d34f0,_0x4a5dc0){_0x3d34f0=_0x3d34f0-0x0;var _0x135ecd=_0xfe7b[_0x3d34f0];return _0x135ecd;};'use strict';var Sequelize=require('sequelize');module[_0xbfe7('0x0')]={'name':{'type':Sequelize[_0xbfe7('0x1')]},'description':{'type':Sequelize[_0xbfe7('0x1')]},'username':{'type':Sequelize[_0xbfe7('0x1')]},'remoteUri':{'type':Sequelize[_0xbfe7('0x1')]},'authType':{'type':Sequelize['ENUM'](_0xbfe7('0x2')),'defaultValue':_0xbfe7('0x2')},'password':{'type':Sequelize[_0xbfe7('0x1')]},'consumerKey':{'type':Sequelize[_0xbfe7('0x1')]},'consumerSecret':{'type':Sequelize[_0xbfe7('0x1')]},'token':{'type':Sequelize[_0xbfe7('0x1')]},'tokenSecret':{'type':Sequelize[_0xbfe7('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xbfe7('0x3')]('integrationTab','newTab'),'defaultValue':_0xbfe7('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index c443a36..fca7be8 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 _0x78cd=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','limit','count','Content-Range','json','apply','reject','save','then','destroy','error','name','send','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','intersection','find','create','body','params','getConfigurations','findOne','DeskConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','DeskField','Descriptions','priority','remoteUri','authType','username','password','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','entries','active','label','test','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service'];(function(_0xdefbc3,_0x1ea49a){var _0x367798=function(_0x594678){while(--_0x594678){_0xdefbc3['push'](_0xdefbc3['shift']());}};_0x367798(++_0x1ea49a);}(_0x78cd,0x199));var _0xd78c=function(_0x3c4958,_0x450ef9){_0x3c4958=_0x3c4958-0x0;var _0x46bd11=_0x78cd[_0x3c4958];return _0x46bd11;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd78c('0x0'));var zipdir=require(_0xd78c('0x1'));var jsonpatch=require(_0xd78c('0x2'));var rp=require('request-promise');var moment=require(_0xd78c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd78c('0x4'));var util=require('util');var path=require('path');var sox=require(_0xd78c('0x5'));var csv=require(_0xd78c('0x6'));var ejs=require(_0xd78c('0x7'));var fs=require('fs');var fs_extra=require(_0xd78c('0x8'));var _=require('lodash');var squel=require(_0xd78c('0x9'));var crypto=require(_0xd78c('0xa'));var jsforce=require(_0xd78c('0xb'));var deskjs=require(_0xd78c('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd78c('0xd'));var authService=require(_0xd78c('0xe'));var qs=require(_0xd78c('0xf'));var as=require(_0xd78c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd78c('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xd78c('0x12'));var licenseUtil=require(_0xd78c('0x13'));var db=require(_0xd78c('0x14'))['db'];var integrations=require(_0xd78c('0x15'));function respondWithStatusCode(_0x5454f5,_0x3fe19f){_0x3fe19f=_0x3fe19f||0xcc;return function(_0x58427c){if(_0x58427c){return _0x5454f5[_0xd78c('0x16')](_0x3fe19f);}return _0x5454f5['status'](_0x3fe19f)[_0xd78c('0x17')]();};}function respondWithResult(_0x190267,_0x4d671a){_0x4d671a=_0x4d671a||0xc8;return function(_0x2de4cc){if(_0x2de4cc){return _0x190267[_0xd78c('0x18')](_0x4d671a)['json'](_0x2de4cc);}};}function respondWithFilteredResult(_0x37dd68,_0x2a8e2a){return function(_0x5e2aca){if(_0x5e2aca){var _0x37fd11=typeof _0x2a8e2a[_0xd78c('0x19')]==='undefined'&&typeof _0x2a8e2a[_0xd78c('0x1a')]==='undefined';var _0x485f0d=_0x5e2aca[_0xd78c('0x1b')];var _0x5228d1=_0x37fd11?0x0:_0x2a8e2a['offset'];var _0x2fdbbd=_0x37fd11?_0x5e2aca['count']:_0x2a8e2a[_0xd78c('0x19')]+_0x2a8e2a[_0xd78c('0x1a')];var _0x2ac265;if(_0x2fdbbd>=_0x485f0d){_0x2fdbbd=_0x485f0d;_0x2ac265=0xc8;}else{_0x2ac265=0xce;}_0x37dd68[_0xd78c('0x18')](_0x2ac265);return _0x37dd68['set'](_0xd78c('0x1c'),_0x5228d1+'-'+_0x2fdbbd+'/'+_0x485f0d)[_0xd78c('0x1d')](_0x5e2aca);}return null;};}function patchUpdates(_0x307c52){return function(_0x26ae84){try{jsonpatch[_0xd78c('0x1e')](_0x26ae84,_0x307c52,!![]);}catch(_0x2fee0e){return BPromise[_0xd78c('0x1f')](_0x2fee0e);}return _0x26ae84[_0xd78c('0x20')]();};}function saveUpdates(_0x3719f8,_0x299845){return function(_0x3cf5d8){if(_0x3cf5d8){return _0x3cf5d8['update'](_0x3719f8)[_0xd78c('0x21')](function(_0x269883){return _0x269883;});}return null;};}function removeEntity(_0xb7bfc3,_0x4a34dd){return function(_0x7bf92){if(_0x7bf92){return _0x7bf92[_0xd78c('0x22')]()[_0xd78c('0x21')](function(){_0xb7bfc3[_0xd78c('0x18')](0xcc)[_0xd78c('0x17')]();});}};}function handleEntityNotFound(_0xac5979,_0x189b9f){return function(_0x289453){if(!_0x289453){_0xac5979[_0xd78c('0x16')](0x194);}return _0x289453;};}function handleError(_0x208f44,_0x26fed3){_0x26fed3=_0x26fed3||0x1f4;return function(_0x33ecfb){logger[_0xd78c('0x23')](_0x33ecfb['stack']);if(_0x33ecfb[_0xd78c('0x24')]){delete _0x33ecfb[_0xd78c('0x24')];}_0x208f44[_0xd78c('0x18')](_0x26fed3)[_0xd78c('0x25')](_0x33ecfb);};}exports['index']=function(_0x20431a,_0x32817e){var _0x49ab8a={},_0x18e03b={},_0x49bfa8={'count':0x0,'rows':[]};var _0x67e858=_[_0xd78c('0x26')](db[_0xd78c('0x27')][_0xd78c('0x28')],function(_0x4c979b){return{'name':_0x4c979b[_0xd78c('0x29')],'type':_0x4c979b[_0xd78c('0x2a')][_0xd78c('0x2b')]};});_0x18e03b[_0xd78c('0x2c')]=_[_0xd78c('0x26')](_0x67e858,'name');_0x18e03b[_0xd78c('0x2d')]=_[_0xd78c('0x2e')](_0x20431a[_0xd78c('0x2d')]);_0x18e03b[_0xd78c('0x2f')]=_['intersection'](_0x18e03b['model'],_0x18e03b[_0xd78c('0x2d')]);_0x49ab8a[_0xd78c('0x30')]=_['intersection'](_0x18e03b[_0xd78c('0x2c')],qs[_0xd78c('0x31')](_0x20431a[_0xd78c('0x2d')]['fields']));_0x49ab8a[_0xd78c('0x30')]=_0x49ab8a['attributes'][_0xd78c('0x32')]?_0x49ab8a[_0xd78c('0x30')]:_0x18e03b['model'];if(!_0x20431a[_0xd78c('0x2d')]['hasOwnProperty'](_0xd78c('0x33'))){_0x49ab8a['limit']=qs['limit'](_0x20431a[_0xd78c('0x2d')]['limit']);_0x49ab8a[_0xd78c('0x19')]=qs[_0xd78c('0x19')](_0x20431a[_0xd78c('0x2d')]['offset']);}_0x49ab8a[_0xd78c('0x34')]=qs[_0xd78c('0x35')](_0x20431a[_0xd78c('0x2d')][_0xd78c('0x35')]);_0x49ab8a[_0xd78c('0x36')]=qs[_0xd78c('0x2f')](_[_0xd78c('0x37')](_0x20431a[_0xd78c('0x2d')],_0x18e03b[_0xd78c('0x2f')]),_0x67e858);if(_0x20431a[_0xd78c('0x2d')][_0xd78c('0x38')]){_0x49ab8a[_0xd78c('0x36')]=_[_0xd78c('0x39')](_0x49ab8a[_0xd78c('0x36')],{'$or':_['map'](_0x67e858,function(_0x1cb6cb){if(_0x1cb6cb[_0xd78c('0x2a')]!==_0xd78c('0x3a')){var _0x9a481d={};_0x9a481d[_0x1cb6cb[_0xd78c('0x24')]]={'$like':'%'+_0x20431a[_0xd78c('0x2d')][_0xd78c('0x38')]+'%'};return _0x9a481d;}})});}_0x49ab8a=_['merge']({},_0x49ab8a,_0x20431a[_0xd78c('0x3b')]);var _0x2b570b={'where':_0x49ab8a[_0xd78c('0x36')]};return db['DeskAccount'][_0xd78c('0x1b')](_0x2b570b)[_0xd78c('0x21')](function(_0x552f17){_0x49bfa8['count']=_0x552f17;if(_0x20431a[_0xd78c('0x2d')][_0xd78c('0x3c')]){_0x49ab8a[_0xd78c('0x3d')]=[{'all':!![]}];}return db[_0xd78c('0x27')]['findAll'](_0x49ab8a);})[_0xd78c('0x21')](function(_0x339f82){_0x49bfa8[_0xd78c('0x3e')]=_0x339f82;return _0x49bfa8;})['then'](respondWithFilteredResult(_0x32817e,_0x49ab8a))[_0xd78c('0x3f')](handleError(_0x32817e,null));};exports[_0xd78c('0x40')]=function(_0x2a3c11,_0x42e9f1){var _0x129fef={'raw':![],'where':{'id':_0x2a3c11['params']['id']}},_0x1fc75c={};_0x1fc75c[_0xd78c('0x2c')]=_[_0xd78c('0x2e')](db[_0xd78c('0x27')][_0xd78c('0x28')]);_0x1fc75c[_0xd78c('0x2d')]=_[_0xd78c('0x2e')](_0x2a3c11[_0xd78c('0x2d')]);_0x1fc75c[_0xd78c('0x2f')]=_[_0xd78c('0x41')](_0x1fc75c[_0xd78c('0x2c')],_0x1fc75c['query']);_0x129fef[_0xd78c('0x30')]=_[_0xd78c('0x41')](_0x1fc75c[_0xd78c('0x2c')],qs[_0xd78c('0x31')](_0x2a3c11[_0xd78c('0x2d')][_0xd78c('0x31')]));_0x129fef[_0xd78c('0x30')]=_0x129fef[_0xd78c('0x30')]['length']?_0x129fef['attributes']:_0x1fc75c[_0xd78c('0x2c')];if(_0x2a3c11[_0xd78c('0x2d')]['includeAll']){_0x129fef[_0xd78c('0x3d')]=[{'all':!![]}];}_0x129fef=_[_0xd78c('0x39')]({},_0x129fef,_0x2a3c11[_0xd78c('0x3b')]);return db[_0xd78c('0x27')][_0xd78c('0x42')](_0x129fef)[_0xd78c('0x21')](handleEntityNotFound(_0x42e9f1,null))[_0xd78c('0x21')](respondWithResult(_0x42e9f1,null))['catch'](handleError(_0x42e9f1,null));};exports[_0xd78c('0x43')]=function(_0x191555,_0x2f93e9){return db[_0xd78c('0x27')][_0xd78c('0x43')](_0x191555['body'],{})['then'](respondWithResult(_0x2f93e9,0xc9))[_0xd78c('0x3f')](handleError(_0x2f93e9,null));};exports['update']=function(_0x394687,_0x4f8fec){if(_0x394687[_0xd78c('0x44')]['id']){delete _0x394687[_0xd78c('0x44')]['id'];}return db['DeskAccount'][_0xd78c('0x42')]({'where':{'id':_0x394687[_0xd78c('0x45')]['id']}})[_0xd78c('0x21')](handleEntityNotFound(_0x4f8fec,null))[_0xd78c('0x21')](saveUpdates(_0x394687[_0xd78c('0x44')],null))[_0xd78c('0x21')](respondWithResult(_0x4f8fec,null))['catch'](handleError(_0x4f8fec,null));};exports[_0xd78c('0x22')]=function(_0x57ee6c,_0x7ebdbe){return db[_0xd78c('0x27')][_0xd78c('0x42')]({'where':{'id':_0x57ee6c[_0xd78c('0x45')]['id']}})[_0xd78c('0x21')](handleEntityNotFound(_0x7ebdbe,null))['then'](removeEntity(_0x7ebdbe,null))[_0xd78c('0x3f')](handleError(_0x7ebdbe,null));};exports[_0xd78c('0x46')]=function(_0x98d58b,_0x15a2e4,_0x1aea1f){var _0x2ee9fc={};var _0x310b76={};var _0x26304f;var _0x3fe1ad;return db[_0xd78c('0x27')][_0xd78c('0x47')]({'where':{'id':_0x98d58b[_0xd78c('0x45')]['id']}})[_0xd78c('0x21')](handleEntityNotFound(_0x15a2e4,null))[_0xd78c('0x21')](function(_0x3842f7){if(_0x3842f7){_0x26304f=_0x3842f7;_0x310b76[_0xd78c('0x2c')]=_[_0xd78c('0x2e')](db[_0xd78c('0x48')][_0xd78c('0x28')]);_0x310b76[_0xd78c('0x2d')]=_[_0xd78c('0x2e')](_0x98d58b['query']);_0x310b76[_0xd78c('0x2f')]=_[_0xd78c('0x41')](_0x310b76[_0xd78c('0x2c')],_0x310b76[_0xd78c('0x2d')]);_0x2ee9fc['attributes']=_[_0xd78c('0x41')](_0x310b76[_0xd78c('0x2c')],qs['fields'](_0x98d58b['query'][_0xd78c('0x31')]));_0x2ee9fc[_0xd78c('0x30')]=_0x2ee9fc['attributes'][_0xd78c('0x32')]?_0x2ee9fc[_0xd78c('0x30')]:_0x310b76[_0xd78c('0x2c')];_0x2ee9fc[_0xd78c('0x34')]=qs['sort'](_0x98d58b[_0xd78c('0x2d')][_0xd78c('0x35')]);_0x2ee9fc['where']=qs[_0xd78c('0x2f')](_[_0xd78c('0x37')](_0x98d58b[_0xd78c('0x2d')],_0x310b76['filters']));if(_0x98d58b[_0xd78c('0x2d')]['filter']){_0x2ee9fc['where']=_['merge'](_0x2ee9fc[_0xd78c('0x36')],{'$or':_[_0xd78c('0x26')](_0x2ee9fc[_0xd78c('0x30')],function(_0x11c5a3){var _0x391b8d={};_0x391b8d[_0x11c5a3]={'$like':'%'+_0x98d58b[_0xd78c('0x2d')]['filter']+'%'};return _0x391b8d;})});}_0x2ee9fc=_['merge']({},_0x2ee9fc,_0x98d58b[_0xd78c('0x3b')]);return _0x26304f['getConfigurations'](_0x2ee9fc);}})[_0xd78c('0x21')](function(_0x1869dd){if(_0x1869dd){_0x3fe1ad=_0x1869dd[_0xd78c('0x32')];if(!_0x98d58b[_0xd78c('0x2d')][_0xd78c('0x49')]('nolimit')){_0x2ee9fc[_0xd78c('0x1a')]=qs[_0xd78c('0x1a')](_0x98d58b['query'][_0xd78c('0x1a')]);_0x2ee9fc[_0xd78c('0x19')]=qs[_0xd78c('0x19')](_0x98d58b[_0xd78c('0x2d')][_0xd78c('0x19')]);}return _0x26304f[_0xd78c('0x46')](_0x2ee9fc);}})[_0xd78c('0x21')](function(_0x98b83a){if(_0x98b83a){return _0x98b83a?{'count':_0x3fe1ad,'rows':_0x98b83a}:null;}})['then'](respondWithResult(_0x15a2e4,null))['catch'](handleError(_0x15a2e4,null));};exports[_0xd78c('0x4a')]=function(_0x1e8dcf,_0x5cab39,_0x44432b){if(_0x1e8dcf[_0xd78c('0x44')]['id']){delete _0x1e8dcf[_0xd78c('0x44')]['id'];}return db[_0xd78c('0x27')][_0xd78c('0x47')]({'where':{'id':_0x1e8dcf['params']['id']}})[_0xd78c('0x21')](handleEntityNotFound(_0x5cab39,null))[_0xd78c('0x21')](function(_0x47ff0d){if(_0x47ff0d){_0x1e8dcf[_0xd78c('0x44')][_0xd78c('0x4b')]=_0x47ff0d['id'];_0x1e8dcf[_0xd78c('0x44')][_0xd78c('0x4c')]=integrations[_0xd78c('0x4d')](_0x1e8dcf[_0xd78c('0x44')]['channel'],_0x1e8dcf[_0xd78c('0x44')][_0xd78c('0x2a')]);_0x1e8dcf[_0xd78c('0x44')]['Descriptions']=integrations['getDescriptions'](_0x1e8dcf[_0xd78c('0x44')]['channel'],_0x1e8dcf[_0xd78c('0x44')][_0xd78c('0x2a')]);return db[_0xd78c('0x48')]['create'](_0x1e8dcf['body'],{'include':[{'model':db[_0xd78c('0x4e')],'as':'Subjects'},{'model':db['DeskField'],'as':_0xd78c('0x4f')}]});}return null;})[_0xd78c('0x21')](respondWithResult(_0x5cab39,null))[_0xd78c('0x3f')](handleError(_0x5cab39,null));};exports['getFields']=function(_0x473c06,_0x3bf243,_0x1b7ec3){var _0x3745a2=[{'name':_0xd78c('0x50'),'label':_0xd78c('0x50'),'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 _0x5d63a5='';return db[_0xd78c('0x27')][_0xd78c('0x47')]({'where':{'id':_0x473c06[_0xd78c('0x45')]['id']},'attributes':['id',_0xd78c('0x51'),_0xd78c('0x52'),_0xd78c('0x53'),_0xd78c('0x54'),'consumerKey',_0xd78c('0x55'),_0xd78c('0x56'),_0xd78c('0x57')]})[_0xd78c('0x21')](handleEntityNotFound(_0x3bf243,null))[_0xd78c('0x21')](function(_0x54707a){if(_0x54707a){_0x5d63a5=_0x54707a[_0xd78c('0x51')];var _0x51cbb5=_0x5d63a5[_0xd78c('0x58')](-0x1);if(_0x51cbb5==='/'){_0x5d63a5=_0x5d63a5[_0xd78c('0x59')](0x0,_0x5d63a5[_0xd78c('0x5a')](_0x51cbb5));}var _0x1d6db7={'method':_0xd78c('0x5b'),'uri':util[_0xd78c('0x5c')](_0xd78c('0x5d'),_0x5d63a5),'headers':{'Content-Type':_0xd78c('0x5e'),'Accept':'application/json'},'json':!![]};if(_0x54707a[_0xd78c('0x52')]==='basic'){_0x1d6db7[_0xd78c('0x5f')][_0xd78c('0x60')]=util[_0xd78c('0x5c')](_0xd78c('0x61'),new Buffer(util[_0xd78c('0x5c')](_0xd78c('0x62'),_0x54707a[_0xd78c('0x53')],_0x54707a[_0xd78c('0x54')]))[_0xd78c('0x63')](_0xd78c('0x64')));}return rp(_0x1d6db7)[_0xd78c('0x21')](function(_0x161e62){return _0x3745a2[_0xd78c('0x65')](_[_0xd78c('0x26')](_0x161e62['_embedded'][_0xd78c('0x66')],function(_0x58aecb){return{'id':_0x58aecb[_0xd78c('0x24')],'name':_0x58aecb[_0xd78c('0x24')],'type':_0x58aecb['type'],'active':_0x58aecb[_0xd78c('0x67')],'label':_0x58aecb[_0xd78c('0x68')],'custom':!![]};}));});}})['then'](function(_0x58e45d){return{'count':_0x58e45d['length'],'rows':_0x58e45d};})['then'](respondWithResult(_0x3bf243,null))[_0xd78c('0x3f')](function(_0x34c319){var _0x550929=_0x473c06[_0xd78c('0x2d')][_0xd78c('0x69')]?0x1f4:_0x34c319['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x550929,JSON['stringify'](_0x34c319));delete _0x34c319[_0xd78c('0x24')];if(_0x550929===0x191){_0x550929=0x190;}_0x3bf243[_0xd78c('0x18')](_0x550929)[_0xd78c('0x25')](_0x473c06[_0xd78c('0x2d')][_0xd78c('0x69')]?{'message':'Wrong\x20credentials','statusCode':_0x34c319['statusCode']}:_0x34c319);});}; \ No newline at end of file +var _0x1ef8=['create','body','find','destroy','DeskConfiguration','order','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','consumerKey','consumerSecret','token','tokenSecret','slice','substring','GET','%s/custom_fields','application/json','headers','Authorization','Basic\x20%s','format','%s:%s','toString','base64','concat','_embedded','active','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','error','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','includeAll','include','findAll','rows','catch','show','params','merge','options'];(function(_0x2e84d7,_0x123b90){var _0x43d404=function(_0x55f6f0){while(--_0x55f6f0){_0x2e84d7['push'](_0x2e84d7['shift']());}};_0x43d404(++_0x123b90);}(_0x1ef8,0xa0));var _0x81ef=function(_0x216e3d,_0x2ab74f){_0x216e3d=_0x216e3d-0x0;var _0x46592c=_0x1ef8[_0x216e3d];return _0x46592c;};'use strict';var emlformat=require(_0x81ef('0x0'));var rimraf=require(_0x81ef('0x1'));var zipdir=require(_0x81ef('0x2'));var jsonpatch=require(_0x81ef('0x3'));var rp=require(_0x81ef('0x4'));var moment=require('moment');var BPromise=require(_0x81ef('0x5'));var Mustache=require(_0x81ef('0x6'));var util=require(_0x81ef('0x7'));var path=require(_0x81ef('0x8'));var sox=require('sox');var csv=require(_0x81ef('0x9'));var ejs=require(_0x81ef('0xa'));var fs=require('fs');var fs_extra=require(_0x81ef('0xb'));var _=require(_0x81ef('0xc'));var squel=require(_0x81ef('0xd'));var crypto=require('crypto');var jsforce=require(_0x81ef('0xe'));var deskjs=require(_0x81ef('0xf'));var toCsv=require(_0x81ef('0x9'));var querystring=require(_0x81ef('0x10'));var Papa=require(_0x81ef('0x11'));var Redis=require(_0x81ef('0x12'));var authService=require(_0x81ef('0x13'));var qs=require(_0x81ef('0x14'));var as=require(_0x81ef('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x81ef('0x16'))('api');var utils=require(_0x81ef('0x17'));var config=require(_0x81ef('0x18'));var licenseUtil=require(_0x81ef('0x19'));var db=require(_0x81ef('0x1a'))['db'];var integrations=require(_0x81ef('0x1b'));function respondWithStatusCode(_0x471ed6,_0x2ab244){_0x2ab244=_0x2ab244||0xcc;return function(_0x4d425d){if(_0x4d425d){return _0x471ed6[_0x81ef('0x1c')](_0x2ab244);}return _0x471ed6[_0x81ef('0x1d')](_0x2ab244)[_0x81ef('0x1e')]();};}function respondWithResult(_0x141e2a,_0x1cf047){_0x1cf047=_0x1cf047||0xc8;return function(_0x1c1ade){if(_0x1c1ade){return _0x141e2a[_0x81ef('0x1d')](_0x1cf047)[_0x81ef('0x1f')](_0x1c1ade);}};}function respondWithFilteredResult(_0x44712f,_0x39fb33){return function(_0x45d3df){if(_0x45d3df){var _0x17f74f=typeof _0x39fb33['offset']===_0x81ef('0x20')&&typeof _0x39fb33[_0x81ef('0x21')]===_0x81ef('0x20');var _0x377235=_0x45d3df[_0x81ef('0x22')];var _0xdcc951=_0x17f74f?0x0:_0x39fb33[_0x81ef('0x23')];var _0x222493=_0x17f74f?_0x45d3df[_0x81ef('0x22')]:_0x39fb33[_0x81ef('0x23')]+_0x39fb33[_0x81ef('0x21')];var _0x3b8ee4;if(_0x222493>=_0x377235){_0x222493=_0x377235;_0x3b8ee4=0xc8;}else{_0x3b8ee4=0xce;}_0x44712f['status'](_0x3b8ee4);return _0x44712f[_0x81ef('0x24')]('Content-Range',_0xdcc951+'-'+_0x222493+'/'+_0x377235)['json'](_0x45d3df);}return null;};}function patchUpdates(_0x3ac015){return function(_0x487ce1){try{jsonpatch[_0x81ef('0x25')](_0x487ce1,_0x3ac015,!![]);}catch(_0x5db384){return BPromise[_0x81ef('0x26')](_0x5db384);}return _0x487ce1[_0x81ef('0x27')]();};}function saveUpdates(_0x5957ad,_0x42ad9e){return function(_0x376f7a){if(_0x376f7a){return _0x376f7a[_0x81ef('0x28')](_0x5957ad)[_0x81ef('0x29')](function(_0x40ae14){return _0x40ae14;});}return null;};}function removeEntity(_0xa34a71,_0x4ac9d4){return function(_0x52282c){if(_0x52282c){return _0x52282c['destroy']()[_0x81ef('0x29')](function(){_0xa34a71[_0x81ef('0x1d')](0xcc)[_0x81ef('0x1e')]();});}};}function handleEntityNotFound(_0x1d48b6,_0x1314e1){return function(_0x5388cd){if(!_0x5388cd){_0x1d48b6[_0x81ef('0x1c')](0x194);}return _0x5388cd;};}function handleError(_0x211fa3,_0xf04095){_0xf04095=_0xf04095||0x1f4;return function(_0x1a5722){logger[_0x81ef('0x2a')](_0x1a5722[_0x81ef('0x2b')]);if(_0x1a5722['name']){delete _0x1a5722[_0x81ef('0x2c')];}_0x211fa3[_0x81ef('0x1d')](_0xf04095)[_0x81ef('0x2d')](_0x1a5722);};}exports[_0x81ef('0x2e')]=function(_0x33c36f,_0x2cb92a){var _0x57527e={},_0x1a5512={},_0x4ee8e3={'count':0x0,'rows':[]};var _0x5d023b=_[_0x81ef('0x2f')](db[_0x81ef('0x30')][_0x81ef('0x31')],function(_0x2a9ebf){return{'name':_0x2a9ebf[_0x81ef('0x32')],'type':_0x2a9ebf[_0x81ef('0x33')][_0x81ef('0x34')]};});_0x1a5512['model']=_[_0x81ef('0x2f')](_0x5d023b,_0x81ef('0x2c'));_0x1a5512[_0x81ef('0x35')]=_[_0x81ef('0x36')](_0x33c36f[_0x81ef('0x35')]);_0x1a5512['filters']=_[_0x81ef('0x37')](_0x1a5512[_0x81ef('0x38')],_0x1a5512[_0x81ef('0x35')]);_0x57527e[_0x81ef('0x39')]=_[_0x81ef('0x37')](_0x1a5512['model'],qs['fields'](_0x33c36f['query'][_0x81ef('0x3a')]));_0x57527e[_0x81ef('0x39')]=_0x57527e[_0x81ef('0x39')][_0x81ef('0x3b')]?_0x57527e['attributes']:_0x1a5512['model'];if(!_0x33c36f[_0x81ef('0x35')][_0x81ef('0x3c')](_0x81ef('0x3d'))){_0x57527e[_0x81ef('0x21')]=qs[_0x81ef('0x21')](_0x33c36f[_0x81ef('0x35')]['limit']);_0x57527e[_0x81ef('0x23')]=qs[_0x81ef('0x23')](_0x33c36f[_0x81ef('0x35')][_0x81ef('0x23')]);}_0x57527e['order']=qs['sort'](_0x33c36f['query'][_0x81ef('0x3e')]);_0x57527e[_0x81ef('0x3f')]=qs[_0x81ef('0x40')](_[_0x81ef('0x41')](_0x33c36f[_0x81ef('0x35')],_0x1a5512[_0x81ef('0x40')]),_0x5d023b);if(_0x33c36f['query'][_0x81ef('0x42')]){_0x57527e['where']=_['merge'](_0x57527e[_0x81ef('0x3f')],{'$or':_[_0x81ef('0x2f')](_0x5d023b,function(_0x2e1629){if(_0x2e1629[_0x81ef('0x33')]!=='VIRTUAL'){var _0x3d6d50={};_0x3d6d50[_0x2e1629[_0x81ef('0x2c')]]={'$like':'%'+_0x33c36f[_0x81ef('0x35')][_0x81ef('0x42')]+'%'};return _0x3d6d50;}})});}_0x57527e=_['merge']({},_0x57527e,_0x33c36f['options']);var _0x389b7c={'where':_0x57527e[_0x81ef('0x3f')]};return db['DeskAccount']['count'](_0x389b7c)[_0x81ef('0x29')](function(_0x156723){_0x4ee8e3[_0x81ef('0x22')]=_0x156723;if(_0x33c36f[_0x81ef('0x35')][_0x81ef('0x43')]){_0x57527e[_0x81ef('0x44')]=[{'all':!![]}];}return db[_0x81ef('0x30')][_0x81ef('0x45')](_0x57527e);})[_0x81ef('0x29')](function(_0x448571){_0x4ee8e3[_0x81ef('0x46')]=_0x448571;return _0x4ee8e3;})['then'](respondWithFilteredResult(_0x2cb92a,_0x57527e))[_0x81ef('0x47')](handleError(_0x2cb92a,null));};exports[_0x81ef('0x48')]=function(_0xf37826,_0x3714d0){var _0x224738={'raw':![],'where':{'id':_0xf37826[_0x81ef('0x49')]['id']}},_0x16edf4={};_0x16edf4[_0x81ef('0x38')]=_[_0x81ef('0x36')](db['DeskAccount'][_0x81ef('0x31')]);_0x16edf4['query']=_['keys'](_0xf37826[_0x81ef('0x35')]);_0x16edf4['filters']=_[_0x81ef('0x37')](_0x16edf4['model'],_0x16edf4[_0x81ef('0x35')]);_0x224738[_0x81ef('0x39')]=_['intersection'](_0x16edf4['model'],qs[_0x81ef('0x3a')](_0xf37826[_0x81ef('0x35')][_0x81ef('0x3a')]));_0x224738[_0x81ef('0x39')]=_0x224738[_0x81ef('0x39')][_0x81ef('0x3b')]?_0x224738[_0x81ef('0x39')]:_0x16edf4[_0x81ef('0x38')];if(_0xf37826[_0x81ef('0x35')]['includeAll']){_0x224738['include']=[{'all':!![]}];}_0x224738=_[_0x81ef('0x4a')]({},_0x224738,_0xf37826[_0x81ef('0x4b')]);return db[_0x81ef('0x30')]['find'](_0x224738)['then'](handleEntityNotFound(_0x3714d0,null))[_0x81ef('0x29')](respondWithResult(_0x3714d0,null))[_0x81ef('0x47')](handleError(_0x3714d0,null));};exports[_0x81ef('0x4c')]=function(_0x2d8592,_0x265f18){return db['DeskAccount']['create'](_0x2d8592[_0x81ef('0x4d')],{})[_0x81ef('0x29')](respondWithResult(_0x265f18,0xc9))[_0x81ef('0x47')](handleError(_0x265f18,null));};exports[_0x81ef('0x28')]=function(_0x2b3a91,_0x37daf4){if(_0x2b3a91[_0x81ef('0x4d')]['id']){delete _0x2b3a91[_0x81ef('0x4d')]['id'];}return db[_0x81ef('0x30')][_0x81ef('0x4e')]({'where':{'id':_0x2b3a91['params']['id']}})[_0x81ef('0x29')](handleEntityNotFound(_0x37daf4,null))['then'](saveUpdates(_0x2b3a91['body'],null))[_0x81ef('0x29')](respondWithResult(_0x37daf4,null))['catch'](handleError(_0x37daf4,null));};exports[_0x81ef('0x4f')]=function(_0x11024a,_0x1b28f7){return db[_0x81ef('0x30')][_0x81ef('0x4e')]({'where':{'id':_0x11024a[_0x81ef('0x49')]['id']}})[_0x81ef('0x29')](handleEntityNotFound(_0x1b28f7,null))[_0x81ef('0x29')](removeEntity(_0x1b28f7,null))[_0x81ef('0x47')](handleError(_0x1b28f7,null));};exports['getConfigurations']=function(_0x27e7a0,_0x406457,_0x3cfacd){var _0x36294d={};var _0x54e36c={};var _0x8552a5;var _0x1c33eb;return db[_0x81ef('0x30')]['findOne']({'where':{'id':_0x27e7a0[_0x81ef('0x49')]['id']}})['then'](handleEntityNotFound(_0x406457,null))[_0x81ef('0x29')](function(_0x2b33a0){if(_0x2b33a0){_0x8552a5=_0x2b33a0;_0x54e36c['model']=_['keys'](db[_0x81ef('0x50')][_0x81ef('0x31')]);_0x54e36c[_0x81ef('0x35')]=_['keys'](_0x27e7a0[_0x81ef('0x35')]);_0x54e36c[_0x81ef('0x40')]=_[_0x81ef('0x37')](_0x54e36c[_0x81ef('0x38')],_0x54e36c['query']);_0x36294d['attributes']=_[_0x81ef('0x37')](_0x54e36c[_0x81ef('0x38')],qs[_0x81ef('0x3a')](_0x27e7a0[_0x81ef('0x35')][_0x81ef('0x3a')]));_0x36294d[_0x81ef('0x39')]=_0x36294d['attributes']['length']?_0x36294d[_0x81ef('0x39')]:_0x54e36c['model'];_0x36294d[_0x81ef('0x51')]=qs[_0x81ef('0x3e')](_0x27e7a0['query'][_0x81ef('0x3e')]);_0x36294d[_0x81ef('0x3f')]=qs['filters'](_[_0x81ef('0x41')](_0x27e7a0[_0x81ef('0x35')],_0x54e36c[_0x81ef('0x40')]));if(_0x27e7a0[_0x81ef('0x35')][_0x81ef('0x42')]){_0x36294d[_0x81ef('0x3f')]=_[_0x81ef('0x4a')](_0x36294d[_0x81ef('0x3f')],{'$or':_[_0x81ef('0x2f')](_0x36294d[_0x81ef('0x39')],function(_0x1632cf){var _0x278e2a={};_0x278e2a[_0x1632cf]={'$like':'%'+_0x27e7a0[_0x81ef('0x35')][_0x81ef('0x42')]+'%'};return _0x278e2a;})});}_0x36294d=_[_0x81ef('0x4a')]({},_0x36294d,_0x27e7a0['options']);return _0x8552a5[_0x81ef('0x52')](_0x36294d);}})[_0x81ef('0x29')](function(_0x17499c){if(_0x17499c){_0x1c33eb=_0x17499c['length'];if(!_0x27e7a0[_0x81ef('0x35')][_0x81ef('0x3c')](_0x81ef('0x3d'))){_0x36294d[_0x81ef('0x21')]=qs[_0x81ef('0x21')](_0x27e7a0['query'][_0x81ef('0x21')]);_0x36294d[_0x81ef('0x23')]=qs['offset'](_0x27e7a0['query'][_0x81ef('0x23')]);}return _0x8552a5[_0x81ef('0x52')](_0x36294d);}})['then'](function(_0x42a1cc){if(_0x42a1cc){return _0x42a1cc?{'count':_0x1c33eb,'rows':_0x42a1cc}:null;}})[_0x81ef('0x29')](respondWithResult(_0x406457,null))[_0x81ef('0x47')](handleError(_0x406457,null));};exports[_0x81ef('0x53')]=function(_0x5f064f,_0x2298f5,_0x547c2e){if(_0x5f064f[_0x81ef('0x4d')]['id']){delete _0x5f064f['body']['id'];}return db[_0x81ef('0x30')]['findOne']({'where':{'id':_0x5f064f['params']['id']}})[_0x81ef('0x29')](handleEntityNotFound(_0x2298f5,null))[_0x81ef('0x29')](function(_0x4f683e){if(_0x4f683e){_0x5f064f[_0x81ef('0x4d')]['AccountId']=_0x4f683e['id'];_0x5f064f['body'][_0x81ef('0x54')]=integrations[_0x81ef('0x55')](_0x5f064f[_0x81ef('0x4d')][_0x81ef('0x56')],_0x5f064f[_0x81ef('0x4d')][_0x81ef('0x33')]);_0x5f064f[_0x81ef('0x4d')][_0x81ef('0x57')]=integrations[_0x81ef('0x58')](_0x5f064f[_0x81ef('0x4d')][_0x81ef('0x56')],_0x5f064f['body']['type']);return db[_0x81ef('0x50')][_0x81ef('0x4c')](_0x5f064f[_0x81ef('0x4d')],{'include':[{'model':db[_0x81ef('0x59')],'as':_0x81ef('0x54')},{'model':db[_0x81ef('0x59')],'as':'Descriptions'}]});}return null;})[_0x81ef('0x29')](respondWithResult(_0x2298f5,null))[_0x81ef('0x47')](handleError(_0x2298f5,null));};exports[_0x81ef('0x5a')]=function(_0x1bc194,_0x4942bc,_0x11096c){var _0x5f534e=[{'name':_0x81ef('0x5b'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x595cae='';return db['DeskAccount']['findOne']({'where':{'id':_0x1bc194[_0x81ef('0x49')]['id']},'attributes':['id',_0x81ef('0x5c'),_0x81ef('0x5d'),_0x81ef('0x5e'),'password',_0x81ef('0x5f'),_0x81ef('0x60'),_0x81ef('0x61'),_0x81ef('0x62')]})['then'](handleEntityNotFound(_0x4942bc,null))[_0x81ef('0x29')](function(_0x5393ce){if(_0x5393ce){_0x595cae=_0x5393ce[_0x81ef('0x5c')];var _0x34c6d1=_0x595cae[_0x81ef('0x63')](-0x1);if(_0x34c6d1==='/'){_0x595cae=_0x595cae[_0x81ef('0x64')](0x0,_0x595cae['lastIndexOf'](_0x34c6d1));}var _0x516aac={'method':_0x81ef('0x65'),'uri':util['format'](_0x81ef('0x66'),_0x595cae),'headers':{'Content-Type':_0x81ef('0x67'),'Accept':'application/json'},'json':!![]};if(_0x5393ce[_0x81ef('0x5d')]==='basic'){_0x516aac[_0x81ef('0x68')][_0x81ef('0x69')]=util['format'](_0x81ef('0x6a'),new Buffer(util[_0x81ef('0x6b')](_0x81ef('0x6c'),_0x5393ce[_0x81ef('0x5e')],_0x5393ce['password']))[_0x81ef('0x6d')](_0x81ef('0x6e')));}return rp(_0x516aac)['then'](function(_0x17c14b){return _0x5f534e[_0x81ef('0x6f')](_['map'](_0x17c14b[_0x81ef('0x70')]['entries'],function(_0x2c611f){return{'id':_0x2c611f[_0x81ef('0x2c')],'name':_0x2c611f[_0x81ef('0x2c')],'type':_0x2c611f[_0x81ef('0x33')],'active':_0x2c611f[_0x81ef('0x71')],'label':_0x2c611f['label'],'custom':!![]};}));});}})[_0x81ef('0x29')](function(_0x1dce6f){return{'count':_0x1dce6f[_0x81ef('0x3b')],'rows':_0x1dce6f};})[_0x81ef('0x29')](respondWithResult(_0x4942bc,null))[_0x81ef('0x47')](function(_0x3d7c0){var _0x4d7253=_0x1bc194[_0x81ef('0x35')][_0x81ef('0x72')]?0x1f4:_0x3d7c0[_0x81ef('0x73')]||0x1f4;logger[_0x81ef('0x2a')](_0x81ef('0x74'),_0x81ef('0x5a'),_0x4d7253,JSON[_0x81ef('0x75')](_0x3d7c0));delete _0x3d7c0[_0x81ef('0x2c')];if(_0x4d7253===0x191){_0x4d7253=0x190;}_0x4942bc[_0x81ef('0x1d')](_0x4d7253)[_0x81ef('0x2d')](_0x1bc194[_0x81ef('0x35')][_0x81ef('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x3d7c0['statusCode']}:_0x3d7c0);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 3372c7e..e0512e6 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 _0x3345=['moment','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','DeskAccount','int_desk_accounts','lodash','../../config/logger','api'];(function(_0x1d196b,_0x1e4a01){var _0x23b6ae=function(_0x5cf9f1){while(--_0x5cf9f1){_0x1d196b['push'](_0x1d196b['shift']());}};_0x23b6ae(++_0x1e4a01);}(_0x3345,0xb3));var _0x5334=function(_0x52d013,_0x3f3f02){_0x52d013=_0x52d013-0x0;var _0x29b137=_0x3345[_0x52d013];return _0x29b137;};'use strict';var _=require(_0x5334('0x0'));var util=require('util');var logger=require(_0x5334('0x1'))(_0x5334('0x2'));var moment=require(_0x5334('0x3'));var BPromise=require('bluebird');var rp=require(_0x5334('0x4'));var fs=require('fs');var path=require(_0x5334('0x5'));var rimraf=require(_0x5334('0x6'));var config=require(_0x5334('0x7'));var attributes=require(_0x5334('0x8'));var integrations=require(_0x5334('0x9'));module[_0x5334('0xa')]=function(_0x291bc7,_0xbfb340){return _0x291bc7['define'](_0x5334('0xb'),attributes,{'tableName':_0x5334('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f8a=['lodash','util','api','moment','request-promise','path','../../config/environment','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x1f8a,0x90));var _0xa1f8=function(_0x4facd6,_0x4d6398){_0x4facd6=_0x4facd6-0x0;var _0xbe69f8=_0x1f8a[_0x4facd6];return _0xbe69f8;};'use strict';var _=require(_0xa1f8('0x0'));var util=require(_0xa1f8('0x1'));var logger=require('../../config/logger')(_0xa1f8('0x2'));var moment=require(_0xa1f8('0x3'));var BPromise=require('bluebird');var rp=require(_0xa1f8('0x4'));var fs=require('fs');var path=require(_0xa1f8('0x5'));var rimraf=require('rimraf');var config=require(_0xa1f8('0x6'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xa1f8('0x7'));module[_0xa1f8('0x8')]=function(_0x18fd1b,_0x4f579f){return _0x18fd1b[_0xa1f8('0x9')](_0xa1f8('0xa'),attributes,{'tableName':_0xa1f8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 54a6876..4954cd9 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 _0x5297=['map','model','ShowDeskAccount','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','options','raw','where','attributes','limit','include'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5297,0x1be));var _0x7529=function(_0x5ce3c8,_0x2503bd){_0x5ce3c8=_0x5ce3c8-0x0;var _0xa76867=_0x5297[_0x5ce3c8];return _0xa76867;};'use strict';var _=require(_0x7529('0x0'));var util=require('util');var moment=require(_0x7529('0x1'));var BPromise=require(_0x7529('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7529('0x3'));var db=require(_0x7529('0x4'))['db'];var utils=require(_0x7529('0x5'));var logger=require(_0x7529('0x6'))('rpc');var config=require(_0x7529('0x7'));var jayson=require(_0x7529('0x8'));var client=jayson[_0x7529('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x560a5a,_0x4b0f64,_0xa1c8c6){return new BPromise(function(_0x3b2353,_0x1cb187){return client['request'](_0x560a5a,_0xa1c8c6)[_0x7529('0xa')](function(_0x5ab964){logger[_0x7529('0xb')](_0x7529('0xc'),_0x4b0f64,'request\x20sent');logger[_0x7529('0xd')](_0x7529('0xe'),_0x4b0f64,_0x7529('0xf'),JSON[_0x7529('0x10')](_0x5ab964));if(_0x5ab964[_0x7529('0x11')]){if(_0x5ab964[_0x7529('0x11')][_0x7529('0x12')]===0x1f4){logger[_0x7529('0x11')](_0x7529('0xc'),_0x4b0f64,_0x5ab964['error']['message']);return _0x1cb187(_0x5ab964['error'][_0x7529('0x13')]);}logger[_0x7529('0x11')](_0x7529('0xc'),_0x4b0f64,_0x5ab964[_0x7529('0x11')][_0x7529('0x13')]);return _0x3b2353(_0x5ab964[_0x7529('0x11')][_0x7529('0x13')]);}else{logger[_0x7529('0xb')]('DeskAccount,\x20%s,\x20%s',_0x4b0f64,'request\x20sent');_0x3b2353(_0x5ab964[_0x7529('0x14')][_0x7529('0x13')]);}})[_0x7529('0x15')](function(_0x6a5fcc){logger[_0x7529('0x11')]('DeskAccount,\x20%s,\x20%s',_0x4b0f64,_0x6a5fcc);_0x1cb187(_0x6a5fcc);});});}exports[_0x7529('0x16')]=function(_0x5d97e4){var _0x12262d=this;return new Promise(function(_0x55ddcf,_0x3d7ef5){return db[_0x7529('0x17')]['findAll']({'raw':_0x5d97e4[_0x7529('0x18')]?_0x5d97e4[_0x7529('0x18')][_0x7529('0x19')]===undefined?!![]:![]:!![],'where':_0x5d97e4[_0x7529('0x18')]?_0x5d97e4[_0x7529('0x18')][_0x7529('0x1a')]||null:null,'attributes':_0x5d97e4['options']?_0x5d97e4[_0x7529('0x18')][_0x7529('0x1b')]||null:null,'limit':_0x5d97e4[_0x7529('0x18')]?_0x5d97e4[_0x7529('0x18')][_0x7529('0x1c')]||null:null,'include':_0x5d97e4['options']?_0x5d97e4['options'][_0x7529('0x1d')]?_[_0x7529('0x1e')](_0x5d97e4[_0x7529('0x18')]['include'],function(_0x1eed22){return{'model':db[_0x1eed22['model']],'as':_0x1eed22['as'],'attributes':_0x1eed22[_0x7529('0x1b')],'include':_0x1eed22['include']?_[_0x7529('0x1e')](_0x1eed22[_0x7529('0x1d')],function(_0x2ca078){return{'model':db[_0x2ca078[_0x7529('0x1f')]],'as':_0x2ca078['as'],'attributes':_0x2ca078[_0x7529('0x1b')],'include':_0x2ca078['include']?_['map'](_0x2ca078[_0x7529('0x1d')],function(_0x597ecb){return{'model':db[_0x597ecb[_0x7529('0x1f')]],'as':_0x597ecb['as'],'attributes':_0x597ecb[_0x7529('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7529('0xa')](function(_0x284be2){logger[_0x7529('0xb')](_0x7529('0x16'),_0x5d97e4);logger[_0x7529('0xd')](_0x7529('0x16'),_0x5d97e4,JSON[_0x7529('0x10')](_0x284be2));_0x55ddcf(_0x284be2);})[_0x7529('0x15')](function(_0x2994d3){logger[_0x7529('0x11')](_0x7529('0x16'),_0x2994d3['message'],_0x5d97e4);_0x3d7ef5(_0x12262d[_0x7529('0x11')](0x1f4,_0x2994d3['message']));});});};exports[_0x7529('0x20')]=function(_0x45a2ec){var _0x5bb4f9=this;return new Promise(function(_0x1eb027,_0x16d024){return db[_0x7529('0x17')][_0x7529('0x21')]({'raw':_0x45a2ec[_0x7529('0x18')]?_0x45a2ec['options'][_0x7529('0x19')]===undefined?!![]:![]:!![],'where':_0x45a2ec[_0x7529('0x18')]?_0x45a2ec[_0x7529('0x18')][_0x7529('0x1a')]||null:null,'attributes':_0x45a2ec[_0x7529('0x18')]?_0x45a2ec[_0x7529('0x18')][_0x7529('0x1b')]||null:null,'include':_0x45a2ec['options']?_0x45a2ec['options'][_0x7529('0x1d')]?_[_0x7529('0x1e')](_0x45a2ec[_0x7529('0x18')][_0x7529('0x1d')],function(_0x3fad0d){return{'model':db[_0x3fad0d[_0x7529('0x1f')]],'as':_0x3fad0d['as'],'attributes':_0x3fad0d[_0x7529('0x1b')],'include':_0x3fad0d[_0x7529('0x1d')]?_[_0x7529('0x1e')](_0x3fad0d[_0x7529('0x1d')],function(_0x4dbb10){return{'model':db[_0x4dbb10[_0x7529('0x1f')]],'as':_0x4dbb10['as'],'attributes':_0x4dbb10[_0x7529('0x1b')],'include':_0x4dbb10[_0x7529('0x1d')]?_['map'](_0x4dbb10['include'],function(_0x1633b0){return{'model':db[_0x1633b0[_0x7529('0x1f')]],'as':_0x1633b0['as'],'attributes':_0x1633b0[_0x7529('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17ca50){logger[_0x7529('0xb')](_0x7529('0x20'),_0x45a2ec);logger[_0x7529('0xd')](_0x7529('0x20'),_0x45a2ec,JSON['stringify'](_0x17ca50));_0x1eb027(_0x17ca50);})[_0x7529('0x15')](function(_0x47189a){logger['error']('ShowDeskAccount',_0x47189a['message'],_0x45a2ec);_0x16d024(_0x5bb4f9[_0x7529('0x11')](0x1f4,_0x47189a[_0x7529('0x13')]));});});}; \ No newline at end of file +var _0x2c36=['error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','find','ShowDeskAccount','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2c36,0xa4));var _0x62c3=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0x2c36[_0x24259d];return _0x5a701;};'use strict';var _=require('lodash');var util=require(_0x62c3('0x0'));var moment=require(_0x62c3('0x1'));var BPromise=require(_0x62c3('0x2'));var rs=require(_0x62c3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x62c3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x62c3('0x5'))(_0x62c3('0x6'));var config=require(_0x62c3('0x7'));var jayson=require(_0x62c3('0x8'));var client=jayson[_0x62c3('0x9')][_0x62c3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4abe71,_0x12c54e,_0x51e5f8){return new BPromise(function(_0x49dffb,_0x27bcb3){return client['request'](_0x4abe71,_0x51e5f8)[_0x62c3('0xb')](function(_0x24458e){logger[_0x62c3('0xc')](_0x62c3('0xd'),_0x12c54e,_0x62c3('0xe'));logger['debug'](_0x62c3('0xf'),_0x12c54e,_0x62c3('0xe'),JSON['stringify'](_0x24458e));if(_0x24458e['error']){if(_0x24458e[_0x62c3('0x10')][_0x62c3('0x11')]===0x1f4){logger[_0x62c3('0x10')](_0x62c3('0xd'),_0x12c54e,_0x24458e['error'][_0x62c3('0x12')]);return _0x27bcb3(_0x24458e['error']['message']);}logger[_0x62c3('0x10')](_0x62c3('0xd'),_0x12c54e,_0x24458e[_0x62c3('0x10')][_0x62c3('0x12')]);return _0x49dffb(_0x24458e['error'][_0x62c3('0x12')]);}else{logger[_0x62c3('0xc')]('DeskAccount,\x20%s,\x20%s',_0x12c54e,_0x62c3('0xe'));_0x49dffb(_0x24458e[_0x62c3('0x13')][_0x62c3('0x12')]);}})[_0x62c3('0x14')](function(_0x1631eb){logger[_0x62c3('0x10')](_0x62c3('0xd'),_0x12c54e,_0x1631eb);_0x27bcb3(_0x1631eb);});});}exports[_0x62c3('0x15')]=function(_0x29e801){var _0x4a4a91=this;return new Promise(function(_0x4d90b7,_0x6d5020){return db[_0x62c3('0x16')][_0x62c3('0x17')]({'raw':_0x29e801[_0x62c3('0x18')]?_0x29e801[_0x62c3('0x18')][_0x62c3('0x19')]===undefined?!![]:![]:!![],'where':_0x29e801[_0x62c3('0x18')]?_0x29e801['options'][_0x62c3('0x1a')]||null:null,'attributes':_0x29e801['options']?_0x29e801[_0x62c3('0x18')][_0x62c3('0x1b')]||null:null,'limit':_0x29e801[_0x62c3('0x18')]?_0x29e801[_0x62c3('0x18')][_0x62c3('0x1c')]||null:null,'include':_0x29e801[_0x62c3('0x18')]?_0x29e801[_0x62c3('0x18')][_0x62c3('0x1d')]?_[_0x62c3('0x1e')](_0x29e801[_0x62c3('0x18')][_0x62c3('0x1d')],function(_0x3f0ee5){return{'model':db[_0x3f0ee5[_0x62c3('0x1f')]],'as':_0x3f0ee5['as'],'attributes':_0x3f0ee5['attributes'],'include':_0x3f0ee5[_0x62c3('0x1d')]?_[_0x62c3('0x1e')](_0x3f0ee5['include'],function(_0x11b28f){return{'model':db[_0x11b28f[_0x62c3('0x1f')]],'as':_0x11b28f['as'],'attributes':_0x11b28f[_0x62c3('0x1b')],'include':_0x11b28f[_0x62c3('0x1d')]?_[_0x62c3('0x1e')](_0x11b28f[_0x62c3('0x1d')],function(_0x16046c){return{'model':db[_0x16046c[_0x62c3('0x1f')]],'as':_0x16046c['as'],'attributes':_0x16046c[_0x62c3('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x62c3('0xb')](function(_0x315616){logger[_0x62c3('0xc')](_0x62c3('0x15'),_0x29e801);logger[_0x62c3('0x20')]('GetDeskAccount',_0x29e801,JSON[_0x62c3('0x21')](_0x315616));_0x4d90b7(_0x315616);})[_0x62c3('0x14')](function(_0x9e8d87){logger[_0x62c3('0x10')](_0x62c3('0x15'),_0x9e8d87[_0x62c3('0x12')],_0x29e801);_0x6d5020(_0x4a4a91[_0x62c3('0x10')](0x1f4,_0x9e8d87[_0x62c3('0x12')]));});});};exports['ShowDeskAccount']=function(_0x209618){var _0x11e287=this;return new Promise(function(_0x492266,_0x2d1558){return db[_0x62c3('0x16')][_0x62c3('0x22')]({'raw':_0x209618[_0x62c3('0x18')]?_0x209618[_0x62c3('0x18')][_0x62c3('0x19')]===undefined?!![]:![]:!![],'where':_0x209618[_0x62c3('0x18')]?_0x209618['options'][_0x62c3('0x1a')]||null:null,'attributes':_0x209618['options']?_0x209618[_0x62c3('0x18')][_0x62c3('0x1b')]||null:null,'include':_0x209618[_0x62c3('0x18')]?_0x209618[_0x62c3('0x18')][_0x62c3('0x1d')]?_['map'](_0x209618[_0x62c3('0x18')]['include'],function(_0x5855c0){return{'model':db[_0x5855c0[_0x62c3('0x1f')]],'as':_0x5855c0['as'],'attributes':_0x5855c0['attributes'],'include':_0x5855c0[_0x62c3('0x1d')]?_[_0x62c3('0x1e')](_0x5855c0[_0x62c3('0x1d')],function(_0x2054f8){return{'model':db[_0x2054f8[_0x62c3('0x1f')]],'as':_0x2054f8['as'],'attributes':_0x2054f8[_0x62c3('0x1b')],'include':_0x2054f8[_0x62c3('0x1d')]?_['map'](_0x2054f8[_0x62c3('0x1d')],function(_0x4065d6){return{'model':db[_0x4065d6[_0x62c3('0x1f')]],'as':_0x4065d6['as'],'attributes':_0x4065d6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x271b74){logger[_0x62c3('0xc')](_0x62c3('0x23'),_0x209618);logger['debug'](_0x62c3('0x23'),_0x209618,JSON['stringify'](_0x271b74));_0x492266(_0x271b74);})[_0x62c3('0x14')](function(_0x56d4cd){logger[_0x62c3('0x10')](_0x62c3('0x23'),_0x56d4cd['message'],_0x209618);_0x2d1558(_0x11e287[_0x62c3('0x10')](0x1f4,_0x56d4cd[_0x62c3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index adf5acf..4b4bec7 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(_0x3e9d3a,_0x24a218){var _0x17dac8=function(_0x11edaa){while(--_0x11edaa){_0x3e9d3a['push'](_0x3e9d3a['shift']());}};_0x17dac8(++_0x24a218);}(_0x008c,0x188));var _0xc008=function(_0x2e891a,_0xb5a3b5){_0x2e891a=_0x2e891a-0x0;var _0x39f989=_0x008c[_0x2e891a];return _0x39f989;};'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 _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x19285d,_0xb02cee){var _0x43195c=function(_0x2a5964){while(--_0x2a5964){_0x19285d['push'](_0x19285d['shift']());}};_0x43195c(++_0xb02cee);}(_0xedd9,0xfc));var _0x9edd=function(_0x1eabe2,_0x24666c){_0x1eabe2=_0x1eabe2-0x0;var _0x39adc0=_0xedd9[_0x1eabe2];return _0x39adc0;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 6269630..8d32a13 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 _0x4419=['STRING'];(function(_0x47e0a1,_0x3f3a3e){var _0x3cdf39=function(_0x4b0668){while(--_0x4b0668){_0x47e0a1['push'](_0x47e0a1['shift']());}};_0x3cdf39(++_0x3f3a3e);}(_0x4419,0xb9));var _0x9441=function(_0xb0ea2c,_0x3bfb90){_0xb0ea2c=_0xb0ea2c-0x0;var _0x4c316d=_0x4419[_0xb0ea2c];return _0x4c316d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9441('0x0')]}}; \ No newline at end of file +var _0x772c=['STRING','sequelize','exports'];(function(_0x55d58f,_0x2bea83){var _0x1ad6e6=function(_0x31447e){while(--_0x31447e){_0x55d58f['push'](_0x55d58f['shift']());}};_0x1ad6e6(++_0x2bea83);}(_0x772c,0x13f));var _0xc772=function(_0x412e2c,_0x4d02c5){_0x412e2c=_0x412e2c-0x0;var _0x538300=_0x772c[_0x412e2c];return _0x538300;};'use strict';var Sequelize=require(_0xc772('0x0'));module[_0xc772('0x1')]={'name':{'type':Sequelize[_0xc772('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index e0cc2c4..1993d24 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 _0xeaf9=['ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','DeskConfiguration','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','keys','create','body','find','findOne','DeskField','getFields','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0x2cc594,_0x4d727b){var _0x4abff7=function(_0x22b01d){while(--_0x22b01d){_0x2cc594['push'](_0x2cc594['shift']());}};_0x4abff7(++_0x4d727b);}(_0xeaf9,0x1a0));var _0x9eaf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeaf9[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9eaf('0x0'));var rimraf=require(_0x9eaf('0x1'));var zipdir=require(_0x9eaf('0x2'));var jsonpatch=require(_0x9eaf('0x3'));var rp=require(_0x9eaf('0x4'));var moment=require(_0x9eaf('0x5'));var BPromise=require(_0x9eaf('0x6'));var Mustache=require(_0x9eaf('0x7'));var util=require('util');var path=require(_0x9eaf('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9eaf('0x9'));var fs=require('fs');var fs_extra=require(_0x9eaf('0xa'));var _=require('lodash');var squel=require(_0x9eaf('0xb'));var crypto=require(_0x9eaf('0xc'));var jsforce=require(_0x9eaf('0xd'));var deskjs=require(_0x9eaf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9eaf('0xf'));var Papa=require(_0x9eaf('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9eaf('0x11'));var as=require(_0x9eaf('0x12'));var hardwareService=require(_0x9eaf('0x13'));var logger=require(_0x9eaf('0x14'))(_0x9eaf('0x15'));var utils=require(_0x9eaf('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9eaf('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f7cf3,_0x43bedb){_0x43bedb=_0x43bedb||0xcc;return function(_0xfe59a1){if(_0xfe59a1){return _0x1f7cf3[_0x9eaf('0x18')](_0x43bedb);}return _0x1f7cf3['status'](_0x43bedb)['end']();};}function respondWithResult(_0x5dd372,_0x4b22f8){_0x4b22f8=_0x4b22f8||0xc8;return function(_0x4a1798){if(_0x4a1798){return _0x5dd372['status'](_0x4b22f8)[_0x9eaf('0x19')](_0x4a1798);}};}function respondWithFilteredResult(_0x52226d,_0x1fb62a){return function(_0x25f1d0){if(_0x25f1d0){var _0x334e1f=typeof _0x1fb62a[_0x9eaf('0x1a')]===_0x9eaf('0x1b')&&typeof _0x1fb62a[_0x9eaf('0x1c')]===_0x9eaf('0x1b');var _0x4b4ab2=_0x25f1d0[_0x9eaf('0x1d')];var _0x4b23cd=_0x334e1f?0x0:_0x1fb62a['offset'];var _0x28a34c=_0x334e1f?_0x25f1d0['count']:_0x1fb62a[_0x9eaf('0x1a')]+_0x1fb62a[_0x9eaf('0x1c')];var _0x3d51c1;if(_0x28a34c>=_0x4b4ab2){_0x28a34c=_0x4b4ab2;_0x3d51c1=0xc8;}else{_0x3d51c1=0xce;}_0x52226d[_0x9eaf('0x1e')](_0x3d51c1);return _0x52226d[_0x9eaf('0x1f')](_0x9eaf('0x20'),_0x4b23cd+'-'+_0x28a34c+'/'+_0x4b4ab2)[_0x9eaf('0x19')](_0x25f1d0);}return null;};}function patchUpdates(_0x12cd98){return function(_0x16fb69){try{jsonpatch[_0x9eaf('0x21')](_0x16fb69,_0x12cd98,!![]);}catch(_0x1a0a6a){return BPromise[_0x9eaf('0x22')](_0x1a0a6a);}return _0x16fb69[_0x9eaf('0x23')]();};}function saveUpdates(_0x1735b0,_0x1c9876){return function(_0x4feb10){if(_0x4feb10){return _0x4feb10[_0x9eaf('0x24')](_0x1735b0)[_0x9eaf('0x25')](function(_0x5d3afc){return _0x5d3afc;});}return null;};}function removeEntity(_0x308161,_0x57fbf0){return function(_0x551aa7){if(_0x551aa7){return _0x551aa7[_0x9eaf('0x26')]()[_0x9eaf('0x25')](function(){_0x308161[_0x9eaf('0x1e')](0xcc)[_0x9eaf('0x27')]();});}};}function handleEntityNotFound(_0x41db4d,_0x1e88d7){return function(_0x148091){if(!_0x148091){_0x41db4d['sendStatus'](0x194);}return _0x148091;};}function handleError(_0x3d9c74,_0x3fa86c){_0x3fa86c=_0x3fa86c||0x1f4;return function(_0x336d05){logger[_0x9eaf('0x28')](_0x336d05[_0x9eaf('0x29')]);if(_0x336d05[_0x9eaf('0x2a')]){delete _0x336d05[_0x9eaf('0x2a')];}_0x3d9c74['status'](_0x3fa86c)['send'](_0x336d05);};}exports[_0x9eaf('0x2b')]=function(_0xbd78cd,_0x31cf31){var _0x1ce6bd={},_0x4d126d={},_0x5abdfc={'count':0x0,'rows':[]};var _0x4955a7=_[_0x9eaf('0x2c')](db[_0x9eaf('0x2d')][_0x9eaf('0x2e')],function(_0x227e47){return{'name':_0x227e47['fieldName'],'type':_0x227e47[_0x9eaf('0x2f')][_0x9eaf('0x30')]};});_0x4d126d[_0x9eaf('0x31')]=_[_0x9eaf('0x2c')](_0x4955a7,_0x9eaf('0x2a'));_0x4d126d['query']=_['keys'](_0xbd78cd[_0x9eaf('0x32')]);_0x4d126d['filters']=_[_0x9eaf('0x33')](_0x4d126d[_0x9eaf('0x31')],_0x4d126d['query']);_0x1ce6bd[_0x9eaf('0x34')]=_['intersection'](_0x4d126d[_0x9eaf('0x31')],qs[_0x9eaf('0x35')](_0xbd78cd[_0x9eaf('0x32')]['fields']));_0x1ce6bd[_0x9eaf('0x34')]=_0x1ce6bd[_0x9eaf('0x34')][_0x9eaf('0x36')]?_0x1ce6bd[_0x9eaf('0x34')]:_0x4d126d[_0x9eaf('0x31')];if(!_0xbd78cd[_0x9eaf('0x32')][_0x9eaf('0x37')](_0x9eaf('0x38'))){_0x1ce6bd['limit']=qs[_0x9eaf('0x1c')](_0xbd78cd[_0x9eaf('0x32')][_0x9eaf('0x1c')]);_0x1ce6bd['offset']=qs[_0x9eaf('0x1a')](_0xbd78cd[_0x9eaf('0x32')][_0x9eaf('0x1a')]);}_0x1ce6bd[_0x9eaf('0x39')]=qs[_0x9eaf('0x3a')](_0xbd78cd[_0x9eaf('0x32')][_0x9eaf('0x3a')]);_0x1ce6bd['where']=qs[_0x9eaf('0x3b')](_[_0x9eaf('0x3c')](_0xbd78cd[_0x9eaf('0x32')],_0x4d126d['filters']),_0x4955a7);if(_0xbd78cd['query']['filter']){_0x1ce6bd[_0x9eaf('0x3d')]=_[_0x9eaf('0x3e')](_0x1ce6bd[_0x9eaf('0x3d')],{'$or':_['map'](_0x4955a7,function(_0x5af3a7){if(_0x5af3a7[_0x9eaf('0x2f')]!==_0x9eaf('0x3f')){var _0x3b467c={};_0x3b467c[_0x5af3a7[_0x9eaf('0x2a')]]={'$like':'%'+_0xbd78cd[_0x9eaf('0x32')][_0x9eaf('0x40')]+'%'};return _0x3b467c;}})});}_0x1ce6bd=_[_0x9eaf('0x3e')]({},_0x1ce6bd,_0xbd78cd[_0x9eaf('0x41')]);var _0x351e8c={'where':_0x1ce6bd[_0x9eaf('0x3d')]};return db['DeskConfiguration'][_0x9eaf('0x1d')](_0x351e8c)[_0x9eaf('0x25')](function(_0x452e90){_0x5abdfc[_0x9eaf('0x1d')]=_0x452e90;if(_0xbd78cd[_0x9eaf('0x32')][_0x9eaf('0x42')]){_0x1ce6bd[_0x9eaf('0x43')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x9eaf('0x44')](_0x1ce6bd);})[_0x9eaf('0x25')](function(_0x561a3f){_0x5abdfc['rows']=_0x561a3f;return _0x5abdfc;})[_0x9eaf('0x25')](respondWithFilteredResult(_0x31cf31,_0x1ce6bd))[_0x9eaf('0x45')](handleError(_0x31cf31,null));};exports[_0x9eaf('0x46')]=function(_0x3339a0,_0x1d5a32){var _0x5aff7a={'raw':![],'where':{'id':_0x3339a0[_0x9eaf('0x47')]['id']}},_0x704cd8={};_0x704cd8[_0x9eaf('0x31')]=_[_0x9eaf('0x48')](db[_0x9eaf('0x2d')][_0x9eaf('0x2e')]);_0x704cd8[_0x9eaf('0x32')]=_[_0x9eaf('0x48')](_0x3339a0['query']);_0x704cd8[_0x9eaf('0x3b')]=_['intersection'](_0x704cd8[_0x9eaf('0x31')],_0x704cd8[_0x9eaf('0x32')]);_0x5aff7a[_0x9eaf('0x34')]=_[_0x9eaf('0x33')](_0x704cd8['model'],qs['fields'](_0x3339a0[_0x9eaf('0x32')][_0x9eaf('0x35')]));_0x5aff7a['attributes']=_0x5aff7a[_0x9eaf('0x34')][_0x9eaf('0x36')]?_0x5aff7a['attributes']:_0x704cd8[_0x9eaf('0x31')];if(_0x3339a0[_0x9eaf('0x32')][_0x9eaf('0x42')]){_0x5aff7a[_0x9eaf('0x43')]=[{'all':!![]}];}_0x5aff7a=_[_0x9eaf('0x3e')]({},_0x5aff7a,_0x3339a0[_0x9eaf('0x41')]);return db['DeskConfiguration']['find'](_0x5aff7a)[_0x9eaf('0x25')](handleEntityNotFound(_0x1d5a32,null))[_0x9eaf('0x25')](respondWithResult(_0x1d5a32,null))[_0x9eaf('0x45')](handleError(_0x1d5a32,null));};exports['create']=function(_0xb55f8e,_0x41cbf2){return db['DeskConfiguration'][_0x9eaf('0x49')](_0xb55f8e[_0x9eaf('0x4a')],{})[_0x9eaf('0x25')](respondWithResult(_0x41cbf2,0xc9))[_0x9eaf('0x45')](handleError(_0x41cbf2,null));};exports[_0x9eaf('0x24')]=function(_0x1b4dc6,_0x23616b){if(_0x1b4dc6[_0x9eaf('0x4a')]['id']){delete _0x1b4dc6[_0x9eaf('0x4a')]['id'];}return db['DeskConfiguration'][_0x9eaf('0x4b')]({'where':{'id':_0x1b4dc6[_0x9eaf('0x47')]['id']}})['then'](handleEntityNotFound(_0x23616b,null))[_0x9eaf('0x25')](saveUpdates(_0x1b4dc6[_0x9eaf('0x4a')],null))[_0x9eaf('0x25')](respondWithResult(_0x23616b,null))[_0x9eaf('0x45')](handleError(_0x23616b,null));};exports[_0x9eaf('0x26')]=function(_0x25ce42,_0x298965){return db['DeskConfiguration'][_0x9eaf('0x4b')]({'where':{'id':_0x25ce42['params']['id']}})[_0x9eaf('0x25')](handleEntityNotFound(_0x298965,null))[_0x9eaf('0x25')](removeEntity(_0x298965,null))[_0x9eaf('0x45')](handleError(_0x298965,null));};exports['getFields']=function(_0x557018,_0x383757,_0x5c12e8){var _0x2f5797={};var _0x3d6e72={};var _0x532df2;var _0x4e72e2;return db[_0x9eaf('0x2d')][_0x9eaf('0x4c')]({'where':{'id':_0x557018[_0x9eaf('0x47')]['id']}})[_0x9eaf('0x25')](handleEntityNotFound(_0x383757,null))[_0x9eaf('0x25')](function(_0x430fc4){if(_0x430fc4){_0x532df2=_0x430fc4;_0x3d6e72['model']=_[_0x9eaf('0x48')](db[_0x9eaf('0x4d')][_0x9eaf('0x2e')]);_0x3d6e72[_0x9eaf('0x32')]=_[_0x9eaf('0x48')](_0x557018[_0x9eaf('0x32')]);_0x3d6e72['filters']=_[_0x9eaf('0x33')](_0x3d6e72[_0x9eaf('0x31')],_0x3d6e72[_0x9eaf('0x32')]);_0x2f5797[_0x9eaf('0x34')]=_[_0x9eaf('0x33')](_0x3d6e72[_0x9eaf('0x31')],qs['fields'](_0x557018[_0x9eaf('0x32')][_0x9eaf('0x35')]));_0x2f5797[_0x9eaf('0x34')]=_0x2f5797[_0x9eaf('0x34')][_0x9eaf('0x36')]?_0x2f5797[_0x9eaf('0x34')]:_0x3d6e72[_0x9eaf('0x31')];_0x2f5797['order']=qs[_0x9eaf('0x3a')](_0x557018[_0x9eaf('0x32')][_0x9eaf('0x3a')]);_0x2f5797[_0x9eaf('0x3d')]=qs[_0x9eaf('0x3b')](_[_0x9eaf('0x3c')](_0x557018[_0x9eaf('0x32')],_0x3d6e72[_0x9eaf('0x3b')]));if(_0x557018[_0x9eaf('0x32')][_0x9eaf('0x40')]){_0x2f5797[_0x9eaf('0x3d')]=_[_0x9eaf('0x3e')](_0x2f5797[_0x9eaf('0x3d')],{'$or':_[_0x9eaf('0x2c')](_0x2f5797[_0x9eaf('0x34')],function(_0x334cf1){var _0x400eeb={};_0x400eeb[_0x334cf1]={'$like':'%'+_0x557018['query'][_0x9eaf('0x40')]+'%'};return _0x400eeb;})});}_0x2f5797=_[_0x9eaf('0x3e')]({},_0x2f5797,_0x557018['options']);return _0x532df2[_0x9eaf('0x4e')](_0x2f5797);}})[_0x9eaf('0x25')](function(_0x401aa3){if(_0x401aa3){_0x4e72e2=_0x401aa3[_0x9eaf('0x36')];if(!_0x557018[_0x9eaf('0x32')][_0x9eaf('0x37')](_0x9eaf('0x38'))){_0x2f5797['limit']=qs[_0x9eaf('0x1c')](_0x557018[_0x9eaf('0x32')][_0x9eaf('0x1c')]);_0x2f5797[_0x9eaf('0x1a')]=qs[_0x9eaf('0x1a')](_0x557018[_0x9eaf('0x32')][_0x9eaf('0x1a')]);}return _0x532df2[_0x9eaf('0x4e')](_0x2f5797);}})[_0x9eaf('0x25')](function(_0x118714){if(_0x118714){return _0x118714?{'count':_0x4e72e2,'rows':_0x118714}:null;}})[_0x9eaf('0x25')](respondWithResult(_0x383757,null))[_0x9eaf('0x45')](handleError(_0x383757,null));};exports['getSubjects']=function(_0x3c56ed,_0x12ccf4,_0x5cc972){var _0x26e7cb={};var _0x2bfd25={};var _0x1e5241;var _0x3e2358;return db[_0x9eaf('0x2d')][_0x9eaf('0x4c')]({'where':{'id':_0x3c56ed[_0x9eaf('0x47')]['id']}})['then'](handleEntityNotFound(_0x12ccf4,null))[_0x9eaf('0x25')](function(_0x3a7b9a){if(_0x3a7b9a){_0x1e5241=_0x3a7b9a;_0x2bfd25['model']=_[_0x9eaf('0x48')](db[_0x9eaf('0x4d')][_0x9eaf('0x2e')]);_0x2bfd25['query']=_[_0x9eaf('0x48')](_0x3c56ed[_0x9eaf('0x32')]);_0x2bfd25['filters']=_[_0x9eaf('0x33')](_0x2bfd25[_0x9eaf('0x31')],_0x2bfd25[_0x9eaf('0x32')]);_0x26e7cb[_0x9eaf('0x34')]=_[_0x9eaf('0x33')](_0x2bfd25[_0x9eaf('0x31')],qs['fields'](_0x3c56ed[_0x9eaf('0x32')][_0x9eaf('0x35')]));_0x26e7cb[_0x9eaf('0x34')]=_0x26e7cb[_0x9eaf('0x34')][_0x9eaf('0x36')]?_0x26e7cb[_0x9eaf('0x34')]:_0x2bfd25[_0x9eaf('0x31')];_0x26e7cb[_0x9eaf('0x39')]=qs['sort'](_0x3c56ed[_0x9eaf('0x32')][_0x9eaf('0x3a')]);_0x26e7cb[_0x9eaf('0x3d')]=qs['filters'](_['pick'](_0x3c56ed[_0x9eaf('0x32')],_0x2bfd25['filters']));if(_0x3c56ed['query']['filter']){_0x26e7cb[_0x9eaf('0x3d')]=_[_0x9eaf('0x3e')](_0x26e7cb[_0x9eaf('0x3d')],{'$or':_['map'](_0x26e7cb[_0x9eaf('0x34')],function(_0x58700d){var _0x4edbce={};_0x4edbce[_0x58700d]={'$like':'%'+_0x3c56ed[_0x9eaf('0x32')]['filter']+'%'};return _0x4edbce;})});}_0x26e7cb=_[_0x9eaf('0x3e')]({},_0x26e7cb,_0x3c56ed[_0x9eaf('0x41')]);return _0x1e5241[_0x9eaf('0x4f')](_0x26e7cb);}})[_0x9eaf('0x25')](function(_0x23c698){if(_0x23c698){_0x3e2358=_0x23c698[_0x9eaf('0x36')];if(!_0x3c56ed[_0x9eaf('0x32')]['hasOwnProperty'](_0x9eaf('0x38'))){_0x26e7cb[_0x9eaf('0x1c')]=qs[_0x9eaf('0x1c')](_0x3c56ed['query'][_0x9eaf('0x1c')]);_0x26e7cb[_0x9eaf('0x1a')]=qs['offset'](_0x3c56ed[_0x9eaf('0x32')]['offset']);}return _0x1e5241[_0x9eaf('0x4f')](_0x26e7cb);}})[_0x9eaf('0x25')](function(_0x386904){if(_0x386904){return _0x386904?{'count':_0x3e2358,'rows':_0x386904}:null;}})[_0x9eaf('0x25')](respondWithResult(_0x12ccf4,null))[_0x9eaf('0x45')](handleError(_0x12ccf4,null));};exports[_0x9eaf('0x50')]=function(_0x3177f4,_0x5d447b,_0x3b1cdf){var _0x2f3f33={};var _0x4ba802={};var _0xe228ff;var _0x15f5d9;return db['DeskConfiguration']['findOne']({'where':{'id':_0x3177f4[_0x9eaf('0x47')]['id']}})[_0x9eaf('0x25')](handleEntityNotFound(_0x5d447b,null))[_0x9eaf('0x25')](function(_0x14cefc){if(_0x14cefc){_0xe228ff=_0x14cefc;_0x4ba802[_0x9eaf('0x31')]=_[_0x9eaf('0x48')](db[_0x9eaf('0x4d')][_0x9eaf('0x2e')]);_0x4ba802[_0x9eaf('0x32')]=_[_0x9eaf('0x48')](_0x3177f4[_0x9eaf('0x32')]);_0x4ba802[_0x9eaf('0x3b')]=_[_0x9eaf('0x33')](_0x4ba802['model'],_0x4ba802[_0x9eaf('0x32')]);_0x2f3f33[_0x9eaf('0x34')]=_[_0x9eaf('0x33')](_0x4ba802[_0x9eaf('0x31')],qs[_0x9eaf('0x35')](_0x3177f4[_0x9eaf('0x32')][_0x9eaf('0x35')]));_0x2f3f33['attributes']=_0x2f3f33[_0x9eaf('0x34')][_0x9eaf('0x36')]?_0x2f3f33[_0x9eaf('0x34')]:_0x4ba802[_0x9eaf('0x31')];_0x2f3f33[_0x9eaf('0x39')]=qs[_0x9eaf('0x3a')](_0x3177f4[_0x9eaf('0x32')][_0x9eaf('0x3a')]);_0x2f3f33[_0x9eaf('0x3d')]=qs[_0x9eaf('0x3b')](_['pick'](_0x3177f4[_0x9eaf('0x32')],_0x4ba802['filters']));if(_0x3177f4[_0x9eaf('0x32')][_0x9eaf('0x40')]){_0x2f3f33[_0x9eaf('0x3d')]=_['merge'](_0x2f3f33[_0x9eaf('0x3d')],{'$or':_['map'](_0x2f3f33[_0x9eaf('0x34')],function(_0x50928c){var _0x49d05e={};_0x49d05e[_0x50928c]={'$like':'%'+_0x3177f4[_0x9eaf('0x32')][_0x9eaf('0x40')]+'%'};return _0x49d05e;})});}_0x2f3f33=_[_0x9eaf('0x3e')]({},_0x2f3f33,_0x3177f4['options']);return _0xe228ff['getDescriptions'](_0x2f3f33);}})[_0x9eaf('0x25')](function(_0x145b91){if(_0x145b91){_0x15f5d9=_0x145b91[_0x9eaf('0x36')];if(!_0x3177f4['query'][_0x9eaf('0x37')]('nolimit')){_0x2f3f33['limit']=qs['limit'](_0x3177f4[_0x9eaf('0x32')][_0x9eaf('0x1c')]);_0x2f3f33[_0x9eaf('0x1a')]=qs[_0x9eaf('0x1a')](_0x3177f4[_0x9eaf('0x32')][_0x9eaf('0x1a')]);}return _0xe228ff[_0x9eaf('0x50')](_0x2f3f33);}})[_0x9eaf('0x25')](function(_0x1f9ab4){if(_0x1f9ab4){return _0x1f9ab4?{'count':_0x15f5d9,'rows':_0x1f9ab4}:null;}})[_0x9eaf('0x25')](respondWithResult(_0x5d447b,null))[_0x9eaf('0x45')](handleError(_0x5d447b,null));};exports['getTags']=function(_0x20bdd0,_0x11123d,_0x37a4cb){var _0x39b0da={};var _0x7be998={};var _0x4d38a4;var _0x4b698b;return db[_0x9eaf('0x2d')]['findOne']({'where':{'id':_0x20bdd0[_0x9eaf('0x47')]['id']}})[_0x9eaf('0x25')](handleEntityNotFound(_0x11123d,null))[_0x9eaf('0x25')](function(_0x589f6f){if(_0x589f6f){_0x4d38a4=_0x589f6f;_0x7be998[_0x9eaf('0x31')]=_[_0x9eaf('0x48')](db[_0x9eaf('0x51')][_0x9eaf('0x2e')]);_0x7be998['query']=_[_0x9eaf('0x48')](_0x20bdd0[_0x9eaf('0x32')]);_0x7be998['filters']=_[_0x9eaf('0x33')](_0x7be998[_0x9eaf('0x31')],_0x7be998[_0x9eaf('0x32')]);_0x39b0da[_0x9eaf('0x34')]=_[_0x9eaf('0x33')](_0x7be998['model'],qs[_0x9eaf('0x35')](_0x20bdd0[_0x9eaf('0x32')][_0x9eaf('0x35')]));_0x39b0da['attributes']=_0x39b0da[_0x9eaf('0x34')][_0x9eaf('0x36')]?_0x39b0da['attributes']:_0x7be998[_0x9eaf('0x31')];_0x39b0da['order']=qs[_0x9eaf('0x3a')](_0x20bdd0[_0x9eaf('0x32')][_0x9eaf('0x3a')]);_0x39b0da[_0x9eaf('0x3d')]=qs['filters'](_[_0x9eaf('0x3c')](_0x20bdd0[_0x9eaf('0x32')],_0x7be998[_0x9eaf('0x3b')]));if(_0x20bdd0[_0x9eaf('0x32')][_0x9eaf('0x40')]){_0x39b0da[_0x9eaf('0x3d')]=_[_0x9eaf('0x3e')](_0x39b0da[_0x9eaf('0x3d')],{'$or':_[_0x9eaf('0x2c')](_0x39b0da[_0x9eaf('0x34')],function(_0x32ef9f){var _0x5b179e={};_0x5b179e[_0x32ef9f]={'$like':'%'+_0x20bdd0[_0x9eaf('0x32')][_0x9eaf('0x40')]+'%'};return _0x5b179e;})});}_0x39b0da=_[_0x9eaf('0x3e')]({},_0x39b0da,_0x20bdd0[_0x9eaf('0x41')]);return _0x4d38a4['getTags'](_0x39b0da);}})['then'](function(_0x1b6170){if(_0x1b6170){_0x4b698b=_0x1b6170[_0x9eaf('0x36')];if(!_0x20bdd0[_0x9eaf('0x32')][_0x9eaf('0x37')](_0x9eaf('0x38'))){_0x39b0da[_0x9eaf('0x1c')]=qs[_0x9eaf('0x1c')](_0x20bdd0[_0x9eaf('0x32')]['limit']);_0x39b0da[_0x9eaf('0x1a')]=qs[_0x9eaf('0x1a')](_0x20bdd0[_0x9eaf('0x32')]['offset']);}return _0x4d38a4[_0x9eaf('0x52')](_0x39b0da);}})[_0x9eaf('0x25')](function(_0xd92716){if(_0xd92716){return _0xd92716?{'count':_0x4b698b,'rows':_0xd92716}:null;}})[_0x9eaf('0x25')](respondWithResult(_0x11123d,null))['catch'](handleError(_0x11123d,null));};exports[_0x9eaf('0x53')]=function(_0x219fcb,_0x4737d6,_0x210694){if(_0x219fcb[_0x9eaf('0x4a')]['id']){delete _0x219fcb[_0x9eaf('0x4a')]['id'];}return db[_0x9eaf('0x2d')][_0x9eaf('0x4c')]({'where':{'id':_0x219fcb['params']['id']}})['then'](handleEntityNotFound(_0x4737d6,null))[_0x9eaf('0x25')](function(_0x39e143){if(_0x39e143){return _0x39e143[_0x9eaf('0x53')](_0x219fcb['body'][_0x9eaf('0x54')]||[]);}return null;})[_0x9eaf('0x25')](respondWithResult(_0x4737d6,null))[_0x9eaf('0x45')](handleError(_0x4737d6,null));}; \ No newline at end of file +var _0x33a2=['bluebird','mustache','path','sox','ejs','fs-extra','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','stack','name','send','index','map','DeskConfiguration','rawAttributes','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','find','create','body','update','DeskField','options','getFields','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x4db9af,_0x52299a){var _0x17c016=function(_0x3837bb){while(--_0x3837bb){_0x4db9af['push'](_0x4db9af['shift']());}};_0x17c016(++_0x52299a);}(_0x33a2,0x1ae));var _0x233a=function(_0x3c0d2e,_0xcde140){_0x3c0d2e=_0x3c0d2e-0x0;var _0x3cfde7=_0x33a2[_0x3c0d2e];return _0x3cfde7;};'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('request-promise');var moment=require(_0x233a('0x4'));var BPromise=require(_0x233a('0x5'));var Mustache=require(_0x233a('0x6'));var util=require('util');var path=require(_0x233a('0x7'));var sox=require(_0x233a('0x8'));var csv=require('to-csv');var ejs=require(_0x233a('0x9'));var fs=require('fs');var fs_extra=require(_0x233a('0xa'));var _=require('lodash');var squel=require(_0x233a('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x233a('0xc'));var toCsv=require(_0x233a('0xd'));var querystring=require(_0x233a('0xe'));var Papa=require(_0x233a('0xf'));var Redis=require(_0x233a('0x10'));var authService=require(_0x233a('0x11'));var qs=require(_0x233a('0x12'));var as=require(_0x233a('0x13'));var hardwareService=require(_0x233a('0x14'));var logger=require(_0x233a('0x15'))('api');var utils=require(_0x233a('0x16'));var config=require(_0x233a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x233a('0x18'))['db'];function respondWithStatusCode(_0x422106,_0x146185){_0x146185=_0x146185||0xcc;return function(_0x1a2838){if(_0x1a2838){return _0x422106['sendStatus'](_0x146185);}return _0x422106[_0x233a('0x19')](_0x146185)[_0x233a('0x1a')]();};}function respondWithResult(_0x15587d,_0x3da106){_0x3da106=_0x3da106||0xc8;return function(_0x4499f4){if(_0x4499f4){return _0x15587d[_0x233a('0x19')](_0x3da106)[_0x233a('0x1b')](_0x4499f4);}};}function respondWithFilteredResult(_0x3fcdd6,_0x4813ef){return function(_0x1cca68){if(_0x1cca68){var _0x11f8c6=typeof _0x4813ef[_0x233a('0x1c')]===_0x233a('0x1d')&&typeof _0x4813ef[_0x233a('0x1e')]===_0x233a('0x1d');var _0x522e74=_0x1cca68[_0x233a('0x1f')];var _0x43801c=_0x11f8c6?0x0:_0x4813ef[_0x233a('0x1c')];var _0x424efb=_0x11f8c6?_0x1cca68['count']:_0x4813ef['offset']+_0x4813ef[_0x233a('0x1e')];var _0x2858cf;if(_0x424efb>=_0x522e74){_0x424efb=_0x522e74;_0x2858cf=0xc8;}else{_0x2858cf=0xce;}_0x3fcdd6[_0x233a('0x19')](_0x2858cf);return _0x3fcdd6[_0x233a('0x20')](_0x233a('0x21'),_0x43801c+'-'+_0x424efb+'/'+_0x522e74)['json'](_0x1cca68);}return null;};}function patchUpdates(_0x1faefb){return function(_0x4f70af){try{jsonpatch[_0x233a('0x22')](_0x4f70af,_0x1faefb,!![]);}catch(_0x5ec7af){return BPromise[_0x233a('0x23')](_0x5ec7af);}return _0x4f70af[_0x233a('0x24')]();};}function saveUpdates(_0x4f9aa4,_0x19738c){return function(_0x1f4f3d){if(_0x1f4f3d){return _0x1f4f3d['update'](_0x4f9aa4)[_0x233a('0x25')](function(_0x2ab730){return _0x2ab730;});}return null;};}function removeEntity(_0xf8b4f0,_0x432d38){return function(_0x3571ea){if(_0x3571ea){return _0x3571ea[_0x233a('0x26')]()[_0x233a('0x25')](function(){_0xf8b4f0[_0x233a('0x19')](0xcc)[_0x233a('0x1a')]();});}};}function handleEntityNotFound(_0x1850b4,_0x5d5ac7){return function(_0x2ef1c8){if(!_0x2ef1c8){_0x1850b4[_0x233a('0x27')](0x194);}return _0x2ef1c8;};}function handleError(_0x5ebe27,_0x474330){_0x474330=_0x474330||0x1f4;return function(_0x3b3228){logger['error'](_0x3b3228[_0x233a('0x28')]);if(_0x3b3228[_0x233a('0x29')]){delete _0x3b3228[_0x233a('0x29')];}_0x5ebe27[_0x233a('0x19')](_0x474330)[_0x233a('0x2a')](_0x3b3228);};}exports[_0x233a('0x2b')]=function(_0x408119,_0x97c2b2){var _0x28c050={},_0x27eb7d={},_0x3ac8ba={'count':0x0,'rows':[]};var _0x26f86d=_[_0x233a('0x2c')](db[_0x233a('0x2d')][_0x233a('0x2e')],function(_0x3ca786){return{'name':_0x3ca786['fieldName'],'type':_0x3ca786['type'][_0x233a('0x2f')]};});_0x27eb7d['model']=_[_0x233a('0x2c')](_0x26f86d,'name');_0x27eb7d[_0x233a('0x30')]=_[_0x233a('0x31')](_0x408119[_0x233a('0x30')]);_0x27eb7d[_0x233a('0x32')]=_[_0x233a('0x33')](_0x27eb7d['model'],_0x27eb7d[_0x233a('0x30')]);_0x28c050[_0x233a('0x34')]=_[_0x233a('0x33')](_0x27eb7d[_0x233a('0x35')],qs[_0x233a('0x36')](_0x408119[_0x233a('0x30')][_0x233a('0x36')]));_0x28c050[_0x233a('0x34')]=_0x28c050[_0x233a('0x34')][_0x233a('0x37')]?_0x28c050['attributes']:_0x27eb7d[_0x233a('0x35')];if(!_0x408119[_0x233a('0x30')][_0x233a('0x38')](_0x233a('0x39'))){_0x28c050[_0x233a('0x1e')]=qs[_0x233a('0x1e')](_0x408119[_0x233a('0x30')][_0x233a('0x1e')]);_0x28c050[_0x233a('0x1c')]=qs[_0x233a('0x1c')](_0x408119['query'][_0x233a('0x1c')]);}_0x28c050[_0x233a('0x3a')]=qs[_0x233a('0x3b')](_0x408119[_0x233a('0x30')]['sort']);_0x28c050['where']=qs[_0x233a('0x32')](_[_0x233a('0x3c')](_0x408119[_0x233a('0x30')],_0x27eb7d[_0x233a('0x32')]),_0x26f86d);if(_0x408119['query'][_0x233a('0x3d')]){_0x28c050[_0x233a('0x3e')]=_[_0x233a('0x3f')](_0x28c050[_0x233a('0x3e')],{'$or':_['map'](_0x26f86d,function(_0xdfc58f){if(_0xdfc58f[_0x233a('0x40')]!==_0x233a('0x41')){var _0xd8b1ff={};_0xd8b1ff[_0xdfc58f[_0x233a('0x29')]]={'$like':'%'+_0x408119[_0x233a('0x30')][_0x233a('0x3d')]+'%'};return _0xd8b1ff;}})});}_0x28c050=_['merge']({},_0x28c050,_0x408119['options']);var _0x356f65={'where':_0x28c050[_0x233a('0x3e')]};return db[_0x233a('0x2d')][_0x233a('0x1f')](_0x356f65)['then'](function(_0x2c7e45){_0x3ac8ba[_0x233a('0x1f')]=_0x2c7e45;if(_0x408119['query']['includeAll']){_0x28c050[_0x233a('0x42')]=[{'all':!![]}];}return db[_0x233a('0x2d')][_0x233a('0x43')](_0x28c050);})['then'](function(_0x185d66){_0x3ac8ba[_0x233a('0x44')]=_0x185d66;return _0x3ac8ba;})[_0x233a('0x25')](respondWithFilteredResult(_0x97c2b2,_0x28c050))[_0x233a('0x45')](handleError(_0x97c2b2,null));};exports[_0x233a('0x46')]=function(_0x254be1,_0x104c15){var _0x1806bd={'raw':![],'where':{'id':_0x254be1[_0x233a('0x47')]['id']}},_0x1134d2={};_0x1134d2[_0x233a('0x35')]=_['keys'](db[_0x233a('0x2d')][_0x233a('0x2e')]);_0x1134d2[_0x233a('0x30')]=_[_0x233a('0x31')](_0x254be1[_0x233a('0x30')]);_0x1134d2[_0x233a('0x32')]=_[_0x233a('0x33')](_0x1134d2['model'],_0x1134d2[_0x233a('0x30')]);_0x1806bd[_0x233a('0x34')]=_[_0x233a('0x33')](_0x1134d2[_0x233a('0x35')],qs[_0x233a('0x36')](_0x254be1['query']['fields']));_0x1806bd[_0x233a('0x34')]=_0x1806bd['attributes'][_0x233a('0x37')]?_0x1806bd[_0x233a('0x34')]:_0x1134d2[_0x233a('0x35')];if(_0x254be1[_0x233a('0x30')][_0x233a('0x48')]){_0x1806bd[_0x233a('0x42')]=[{'all':!![]}];}_0x1806bd=_['merge']({},_0x1806bd,_0x254be1['options']);return db[_0x233a('0x2d')][_0x233a('0x49')](_0x1806bd)[_0x233a('0x25')](handleEntityNotFound(_0x104c15,null))[_0x233a('0x25')](respondWithResult(_0x104c15,null))[_0x233a('0x45')](handleError(_0x104c15,null));};exports[_0x233a('0x4a')]=function(_0x1f9107,_0xe916fd){return db[_0x233a('0x2d')]['create'](_0x1f9107[_0x233a('0x4b')],{})[_0x233a('0x25')](respondWithResult(_0xe916fd,0xc9))[_0x233a('0x45')](handleError(_0xe916fd,null));};exports[_0x233a('0x4c')]=function(_0xe9cec3,_0x35b7f3){if(_0xe9cec3[_0x233a('0x4b')]['id']){delete _0xe9cec3[_0x233a('0x4b')]['id'];}return db[_0x233a('0x2d')]['find']({'where':{'id':_0xe9cec3[_0x233a('0x47')]['id']}})[_0x233a('0x25')](handleEntityNotFound(_0x35b7f3,null))[_0x233a('0x25')](saveUpdates(_0xe9cec3['body'],null))[_0x233a('0x25')](respondWithResult(_0x35b7f3,null))['catch'](handleError(_0x35b7f3,null));};exports['destroy']=function(_0x5beed7,_0x5cd71d){return db[_0x233a('0x2d')]['find']({'where':{'id':_0x5beed7[_0x233a('0x47')]['id']}})[_0x233a('0x25')](handleEntityNotFound(_0x5cd71d,null))[_0x233a('0x25')](removeEntity(_0x5cd71d,null))[_0x233a('0x45')](handleError(_0x5cd71d,null));};exports['getFields']=function(_0x44c023,_0x554cee,_0x5d3ddf){var _0xfe6b30={};var _0x59266e={};var _0x4e4f3c;var _0x308165;return db[_0x233a('0x2d')]['findOne']({'where':{'id':_0x44c023[_0x233a('0x47')]['id']}})[_0x233a('0x25')](handleEntityNotFound(_0x554cee,null))['then'](function(_0x5c463b){if(_0x5c463b){_0x4e4f3c=_0x5c463b;_0x59266e['model']=_[_0x233a('0x31')](db[_0x233a('0x4d')][_0x233a('0x2e')]);_0x59266e[_0x233a('0x30')]=_[_0x233a('0x31')](_0x44c023['query']);_0x59266e[_0x233a('0x32')]=_[_0x233a('0x33')](_0x59266e[_0x233a('0x35')],_0x59266e[_0x233a('0x30')]);_0xfe6b30['attributes']=_[_0x233a('0x33')](_0x59266e[_0x233a('0x35')],qs['fields'](_0x44c023[_0x233a('0x30')]['fields']));_0xfe6b30[_0x233a('0x34')]=_0xfe6b30['attributes'][_0x233a('0x37')]?_0xfe6b30[_0x233a('0x34')]:_0x59266e['model'];_0xfe6b30[_0x233a('0x3a')]=qs[_0x233a('0x3b')](_0x44c023[_0x233a('0x30')]['sort']);_0xfe6b30[_0x233a('0x3e')]=qs[_0x233a('0x32')](_[_0x233a('0x3c')](_0x44c023[_0x233a('0x30')],_0x59266e[_0x233a('0x32')]));if(_0x44c023[_0x233a('0x30')][_0x233a('0x3d')]){_0xfe6b30[_0x233a('0x3e')]=_[_0x233a('0x3f')](_0xfe6b30['where'],{'$or':_[_0x233a('0x2c')](_0xfe6b30['attributes'],function(_0x50f4c2){var _0x415569={};_0x415569[_0x50f4c2]={'$like':'%'+_0x44c023[_0x233a('0x30')][_0x233a('0x3d')]+'%'};return _0x415569;})});}_0xfe6b30=_[_0x233a('0x3f')]({},_0xfe6b30,_0x44c023[_0x233a('0x4e')]);return _0x4e4f3c['getFields'](_0xfe6b30);}})[_0x233a('0x25')](function(_0x584172){if(_0x584172){_0x308165=_0x584172[_0x233a('0x37')];if(!_0x44c023[_0x233a('0x30')]['hasOwnProperty'](_0x233a('0x39'))){_0xfe6b30[_0x233a('0x1e')]=qs[_0x233a('0x1e')](_0x44c023['query'][_0x233a('0x1e')]);_0xfe6b30[_0x233a('0x1c')]=qs[_0x233a('0x1c')](_0x44c023[_0x233a('0x30')][_0x233a('0x1c')]);}return _0x4e4f3c[_0x233a('0x4f')](_0xfe6b30);}})[_0x233a('0x25')](function(_0x5272d3){if(_0x5272d3){return _0x5272d3?{'count':_0x308165,'rows':_0x5272d3}:null;}})[_0x233a('0x25')](respondWithResult(_0x554cee,null))['catch'](handleError(_0x554cee,null));};exports[_0x233a('0x50')]=function(_0xd7f091,_0x350e25,_0x663da7){var _0xcc884f={};var _0x4beb93={};var _0xfb9688;var _0x188739;return db[_0x233a('0x2d')]['findOne']({'where':{'id':_0xd7f091[_0x233a('0x47')]['id']}})[_0x233a('0x25')](handleEntityNotFound(_0x350e25,null))[_0x233a('0x25')](function(_0x12d630){if(_0x12d630){_0xfb9688=_0x12d630;_0x4beb93['model']=_[_0x233a('0x31')](db[_0x233a('0x4d')]['rawAttributes']);_0x4beb93['query']=_[_0x233a('0x31')](_0xd7f091[_0x233a('0x30')]);_0x4beb93[_0x233a('0x32')]=_['intersection'](_0x4beb93['model'],_0x4beb93[_0x233a('0x30')]);_0xcc884f['attributes']=_[_0x233a('0x33')](_0x4beb93['model'],qs['fields'](_0xd7f091[_0x233a('0x30')][_0x233a('0x36')]));_0xcc884f[_0x233a('0x34')]=_0xcc884f['attributes']['length']?_0xcc884f[_0x233a('0x34')]:_0x4beb93[_0x233a('0x35')];_0xcc884f[_0x233a('0x3a')]=qs[_0x233a('0x3b')](_0xd7f091[_0x233a('0x30')][_0x233a('0x3b')]);_0xcc884f['where']=qs[_0x233a('0x32')](_[_0x233a('0x3c')](_0xd7f091[_0x233a('0x30')],_0x4beb93[_0x233a('0x32')]));if(_0xd7f091[_0x233a('0x30')][_0x233a('0x3d')]){_0xcc884f[_0x233a('0x3e')]=_['merge'](_0xcc884f[_0x233a('0x3e')],{'$or':_[_0x233a('0x2c')](_0xcc884f[_0x233a('0x34')],function(_0x418d88){var _0x5f4410={};_0x5f4410[_0x418d88]={'$like':'%'+_0xd7f091[_0x233a('0x30')][_0x233a('0x3d')]+'%'};return _0x5f4410;})});}_0xcc884f=_[_0x233a('0x3f')]({},_0xcc884f,_0xd7f091['options']);return _0xfb9688[_0x233a('0x50')](_0xcc884f);}})[_0x233a('0x25')](function(_0x1a35dd){if(_0x1a35dd){_0x188739=_0x1a35dd[_0x233a('0x37')];if(!_0xd7f091[_0x233a('0x30')][_0x233a('0x38')](_0x233a('0x39'))){_0xcc884f[_0x233a('0x1e')]=qs[_0x233a('0x1e')](_0xd7f091[_0x233a('0x30')]['limit']);_0xcc884f[_0x233a('0x1c')]=qs[_0x233a('0x1c')](_0xd7f091[_0x233a('0x30')][_0x233a('0x1c')]);}return _0xfb9688[_0x233a('0x50')](_0xcc884f);}})['then'](function(_0x1ba639){if(_0x1ba639){return _0x1ba639?{'count':_0x188739,'rows':_0x1ba639}:null;}})[_0x233a('0x25')](respondWithResult(_0x350e25,null))['catch'](handleError(_0x350e25,null));};exports['getDescriptions']=function(_0x581f9b,_0x2ced92,_0x496ee7){var _0x11d92={};var _0x57b49f={};var _0x47fe71;var _0x464cb4;return db[_0x233a('0x2d')][_0x233a('0x51')]({'where':{'id':_0x581f9b[_0x233a('0x47')]['id']}})['then'](handleEntityNotFound(_0x2ced92,null))[_0x233a('0x25')](function(_0x2d74a6){if(_0x2d74a6){_0x47fe71=_0x2d74a6;_0x57b49f[_0x233a('0x35')]=_[_0x233a('0x31')](db[_0x233a('0x4d')][_0x233a('0x2e')]);_0x57b49f[_0x233a('0x30')]=_[_0x233a('0x31')](_0x581f9b[_0x233a('0x30')]);_0x57b49f['filters']=_['intersection'](_0x57b49f[_0x233a('0x35')],_0x57b49f[_0x233a('0x30')]);_0x11d92[_0x233a('0x34')]=_[_0x233a('0x33')](_0x57b49f[_0x233a('0x35')],qs[_0x233a('0x36')](_0x581f9b[_0x233a('0x30')][_0x233a('0x36')]));_0x11d92[_0x233a('0x34')]=_0x11d92[_0x233a('0x34')][_0x233a('0x37')]?_0x11d92[_0x233a('0x34')]:_0x57b49f['model'];_0x11d92[_0x233a('0x3a')]=qs[_0x233a('0x3b')](_0x581f9b[_0x233a('0x30')]['sort']);_0x11d92['where']=qs[_0x233a('0x32')](_[_0x233a('0x3c')](_0x581f9b[_0x233a('0x30')],_0x57b49f[_0x233a('0x32')]));if(_0x581f9b[_0x233a('0x30')][_0x233a('0x3d')]){_0x11d92[_0x233a('0x3e')]=_[_0x233a('0x3f')](_0x11d92[_0x233a('0x3e')],{'$or':_['map'](_0x11d92[_0x233a('0x34')],function(_0x57ca02){var _0x1214d2={};_0x1214d2[_0x57ca02]={'$like':'%'+_0x581f9b[_0x233a('0x30')][_0x233a('0x3d')]+'%'};return _0x1214d2;})});}_0x11d92=_[_0x233a('0x3f')]({},_0x11d92,_0x581f9b[_0x233a('0x4e')]);return _0x47fe71['getDescriptions'](_0x11d92);}})[_0x233a('0x25')](function(_0x434805){if(_0x434805){_0x464cb4=_0x434805[_0x233a('0x37')];if(!_0x581f9b['query'][_0x233a('0x38')](_0x233a('0x39'))){_0x11d92[_0x233a('0x1e')]=qs['limit'](_0x581f9b['query'][_0x233a('0x1e')]);_0x11d92['offset']=qs[_0x233a('0x1c')](_0x581f9b[_0x233a('0x30')][_0x233a('0x1c')]);}return _0x47fe71[_0x233a('0x52')](_0x11d92);}})[_0x233a('0x25')](function(_0x3fb482){if(_0x3fb482){return _0x3fb482?{'count':_0x464cb4,'rows':_0x3fb482}:null;}})['then'](respondWithResult(_0x2ced92,null))[_0x233a('0x45')](handleError(_0x2ced92,null));};exports[_0x233a('0x53')]=function(_0x11badb,_0x41b0b0,_0x503ba9){var _0x58e3a5={};var _0x596e5b={};var _0x2a0dfe;var _0x7f323b;return db[_0x233a('0x2d')]['findOne']({'where':{'id':_0x11badb[_0x233a('0x47')]['id']}})[_0x233a('0x25')](handleEntityNotFound(_0x41b0b0,null))[_0x233a('0x25')](function(_0x44b239){if(_0x44b239){_0x2a0dfe=_0x44b239;_0x596e5b[_0x233a('0x35')]=_[_0x233a('0x31')](db[_0x233a('0x54')][_0x233a('0x2e')]);_0x596e5b['query']=_[_0x233a('0x31')](_0x11badb[_0x233a('0x30')]);_0x596e5b[_0x233a('0x32')]=_['intersection'](_0x596e5b['model'],_0x596e5b[_0x233a('0x30')]);_0x58e3a5[_0x233a('0x34')]=_[_0x233a('0x33')](_0x596e5b['model'],qs[_0x233a('0x36')](_0x11badb[_0x233a('0x30')][_0x233a('0x36')]));_0x58e3a5[_0x233a('0x34')]=_0x58e3a5[_0x233a('0x34')][_0x233a('0x37')]?_0x58e3a5[_0x233a('0x34')]:_0x596e5b['model'];_0x58e3a5['order']=qs[_0x233a('0x3b')](_0x11badb['query'][_0x233a('0x3b')]);_0x58e3a5[_0x233a('0x3e')]=qs[_0x233a('0x32')](_['pick'](_0x11badb['query'],_0x596e5b['filters']));if(_0x11badb['query'][_0x233a('0x3d')]){_0x58e3a5[_0x233a('0x3e')]=_['merge'](_0x58e3a5[_0x233a('0x3e')],{'$or':_['map'](_0x58e3a5[_0x233a('0x34')],function(_0x325434){var _0x56cff2={};_0x56cff2[_0x325434]={'$like':'%'+_0x11badb['query']['filter']+'%'};return _0x56cff2;})});}_0x58e3a5=_[_0x233a('0x3f')]({},_0x58e3a5,_0x11badb['options']);return _0x2a0dfe[_0x233a('0x53')](_0x58e3a5);}})['then'](function(_0x5984c8){if(_0x5984c8){_0x7f323b=_0x5984c8[_0x233a('0x37')];if(!_0x11badb[_0x233a('0x30')][_0x233a('0x38')](_0x233a('0x39'))){_0x58e3a5[_0x233a('0x1e')]=qs['limit'](_0x11badb[_0x233a('0x30')]['limit']);_0x58e3a5['offset']=qs[_0x233a('0x1c')](_0x11badb[_0x233a('0x30')][_0x233a('0x1c')]);}return _0x2a0dfe[_0x233a('0x53')](_0x58e3a5);}})[_0x233a('0x25')](function(_0x19fc44){if(_0x19fc44){return _0x19fc44?{'count':_0x7f323b,'rows':_0x19fc44}:null;}})['then'](respondWithResult(_0x41b0b0,null))[_0x233a('0x45')](handleError(_0x41b0b0,null));};exports[_0x233a('0x55')]=function(_0x3858c4,_0x4627f4,_0x1a199b){if(_0x3858c4[_0x233a('0x4b')]['id']){delete _0x3858c4[_0x233a('0x4b')]['id'];}return db[_0x233a('0x2d')][_0x233a('0x51')]({'where':{'id':_0x3858c4[_0x233a('0x47')]['id']}})[_0x233a('0x25')](handleEntityNotFound(_0x4627f4,null))[_0x233a('0x25')](function(_0xb521f){if(_0xb521f){return _0xb521f[_0x233a('0x55')](_0x3858c4[_0x233a('0x4b')][_0x233a('0x56')]||[]);}return null;})[_0x233a('0x25')](respondWithResult(_0x4627f4,null))[_0x233a('0x45')](handleError(_0x4627f4,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 3842685..490b36e 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 _0x246f=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash'];(function(_0x41e7cf,_0x268b1b){var _0x312209=function(_0x545003){while(--_0x545003){_0x41e7cf['push'](_0x41e7cf['shift']());}};_0x312209(++_0x268b1b);}(_0x246f,0x1c6));var _0xf246=function(_0x1fdb85,_0x39c0bf){_0x1fdb85=_0x1fdb85-0x0;var _0x58a446=_0x246f[_0x1fdb85];return _0x58a446;};'use strict';var _=require(_0xf246('0x0'));var util=require(_0xf246('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf246('0x2'));var BPromise=require(_0xf246('0x3'));var rp=require(_0xf246('0x4'));var fs=require('fs');var path=require(_0xf246('0x5'));var rimraf=require(_0xf246('0x6'));var config=require(_0xf246('0x7'));var attributes=require(_0xf246('0x8'));module[_0xf246('0x9')]=function(_0x159b9b,_0x3f21e2){return _0x159b9b[_0xf246('0xa')](_0xf246('0xb'),attributes,{'tableName':_0xf246('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x03e0=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','int_desk_configurations','lodash','util'];(function(_0xf73c09,_0x4e424e){var _0xa8923c=function(_0x4831c1){while(--_0x4831c1){_0xf73c09['push'](_0xf73c09['shift']());}};_0xa8923c(++_0x4e424e);}(_0x03e0,0x1a2));var _0x003e=function(_0x1097d2,_0x53ad38){_0x1097d2=_0x1097d2-0x0;var _0x4d972c=_0x03e0[_0x1097d2];return _0x4d972c;};'use strict';var _=require(_0x003e('0x0'));var util=require(_0x003e('0x1'));var logger=require(_0x003e('0x2'))(_0x003e('0x3'));var moment=require('moment');var BPromise=require(_0x003e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x003e('0x5'));var rimraf=require(_0x003e('0x6'));var config=require(_0x003e('0x7'));var attributes=require(_0x003e('0x8'));module[_0x003e('0x9')]=function(_0x114bbd,_0x17d14b){return _0x114bbd[_0x003e('0xa')]('DeskConfiguration',attributes,{'tableName':_0x003e('0xb'),'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 d51f877..dfc1d0a 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 _0xccbf=['../../config/environment','jayson/promise','client','http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','bluebird','../../config/utils','../../config/logger','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xccbf,0x1ef));var _0xfccb=function(_0x2ac8bb,_0x3add43){_0x2ac8bb=_0x2ac8bb-0x0;var _0x526451=_0xccbf[_0x2ac8bb];return _0x526451;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfccb('0x0'));var BPromise=require(_0xfccb('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfccb('0x2'));var logger=require(_0xfccb('0x3'))(_0xfccb('0x4'));var config=require(_0xfccb('0x5'));var jayson=require(_0xfccb('0x6'));var client=jayson[_0xfccb('0x7')][_0xfccb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x26c7b1,_0xc8c5e4,_0x119afc){return new BPromise(function(_0x5a0fa2,_0x48a3f0){return client[_0xfccb('0x9')](_0x26c7b1,_0x119afc)['then'](function(_0x17a0bb){logger[_0xfccb('0xa')](_0xfccb('0xb'),_0xc8c5e4,_0xfccb('0xc'));logger[_0xfccb('0xd')](_0xfccb('0xe'),_0xc8c5e4,_0xfccb('0xc'),JSON['stringify'](_0x17a0bb));if(_0x17a0bb[_0xfccb('0xf')]){if(_0x17a0bb['error'][_0xfccb('0x10')]===0x1f4){logger[_0xfccb('0xf')](_0xfccb('0xb'),_0xc8c5e4,_0x17a0bb[_0xfccb('0xf')][_0xfccb('0x11')]);return _0x48a3f0(_0x17a0bb['error'][_0xfccb('0x11')]);}logger[_0xfccb('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0xc8c5e4,_0x17a0bb[_0xfccb('0xf')][_0xfccb('0x11')]);return _0x5a0fa2(_0x17a0bb[_0xfccb('0xf')][_0xfccb('0x11')]);}else{logger[_0xfccb('0xa')]('DeskConfiguration,\x20%s,\x20%s',_0xc8c5e4,_0xfccb('0xc'));_0x5a0fa2(_0x17a0bb[_0xfccb('0x12')][_0xfccb('0x11')]);}})[_0xfccb('0x13')](function(_0x56dca0){logger[_0xfccb('0xf')](_0xfccb('0xb'),_0xc8c5e4,_0x56dca0);_0x48a3f0(_0x56dca0);});});} \ No newline at end of file +var _0xfef9=['DeskConfiguration,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','info','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5c3ebc,_0x370b9e){var _0x46f3a3=function(_0x4cc3e3){while(--_0x4cc3e3){_0x5c3ebc['push'](_0x5c3ebc['shift']());}};_0x46f3a3(++_0x370b9e);}(_0xfef9,0xd3));var _0x9fef=function(_0x1ac6e5,_0x40f47f){_0x1ac6e5=_0x1ac6e5-0x0;var _0x5877dc=_0xfef9[_0x1ac6e5];return _0x5877dc;};'use strict';var _=require(_0x9fef('0x0'));var util=require(_0x9fef('0x1'));var moment=require('moment');var BPromise=require(_0x9fef('0x2'));var rs=require(_0x9fef('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9fef('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9fef('0x5'))('rpc');var config=require(_0x9fef('0x6'));var jayson=require(_0x9fef('0x7'));var client=jayson['client'][_0x9fef('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x311595,_0x480161,_0x2d8768){return new BPromise(function(_0x2d990b,_0x1e4342){return client['request'](_0x311595,_0x2d8768)[_0x9fef('0x9')](function(_0x171152){logger[_0x9fef('0xa')]('DeskConfiguration,\x20%s,\x20%s',_0x480161,_0x9fef('0xb'));logger['debug'](_0x9fef('0xc'),_0x480161,_0x9fef('0xb'),JSON[_0x9fef('0xd')](_0x171152));if(_0x171152[_0x9fef('0xe')]){if(_0x171152[_0x9fef('0xe')][_0x9fef('0xf')]===0x1f4){logger[_0x9fef('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x480161,_0x171152[_0x9fef('0xe')][_0x9fef('0x10')]);return _0x1e4342(_0x171152[_0x9fef('0xe')]['message']);}logger[_0x9fef('0xe')](_0x9fef('0x11'),_0x480161,_0x171152[_0x9fef('0xe')][_0x9fef('0x10')]);return _0x2d990b(_0x171152[_0x9fef('0xe')]['message']);}else{logger[_0x9fef('0xa')]('DeskConfiguration,\x20%s,\x20%s',_0x480161,_0x9fef('0xb'));_0x2d990b(_0x171152['result'][_0x9fef('0x10')]);}})[_0x9fef('0x12')](function(_0x4d9197){logger[_0x9fef('0xe')](_0x9fef('0x11'),_0x480161,_0x4d9197);_0x1e4342(_0x4d9197);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 7d46377..4f72ff9 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 _0x2c79=['post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./intDeskField.controller','get','isAuthenticated','index','show'];(function(_0x37756b,_0x24db76){var _0x46efec=function(_0x319807){while(--_0x319807){_0x37756b['push'](_0x37756b['shift']());}};_0x46efec(++_0x24db76);}(_0x2c79,0x66));var _0x92c7=function(_0xb4c49d,_0x2a1140){_0xb4c49d=_0xb4c49d-0x0;var _0x49d235=_0x2c79[_0xb4c49d];return _0x49d235;};'use strict';var multer=require(_0x92c7('0x0'));var util=require(_0x92c7('0x1'));var path=require(_0x92c7('0x2'));var timeout=require(_0x92c7('0x3'));var express=require(_0x92c7('0x4'));var router=express['Router']();var fs_extra=require(_0x92c7('0x5'));var auth=require(_0x92c7('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x92c7('0x7'));router[_0x92c7('0x8')]('/',auth[_0x92c7('0x9')](),controller[_0x92c7('0xa')]);router[_0x92c7('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x92c7('0xb')]);router[_0x92c7('0xc')]('/',auth[_0x92c7('0x9')](),controller['create']);router[_0x92c7('0xd')](_0x92c7('0xe'),auth[_0x92c7('0x9')](),controller[_0x92c7('0xf')]);router[_0x92c7('0x10')](_0x92c7('0xe'),auth[_0x92c7('0x9')](),controller[_0x92c7('0x11')]);module[_0x92c7('0x12')]=router; \ No newline at end of file +var _0x1d89=['multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated','get','show','post','create','put','/:id','update','destroy','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1d89,0x156));var _0x91d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d89[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x91d8('0x0'));var util=require(_0x91d8('0x1'));var path=require('path');var timeout=require(_0x91d8('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x91d8('0x3'));var auth=require(_0x91d8('0x4'));var interaction=require(_0x91d8('0x5'));var config=require(_0x91d8('0x6'));var controller=require(_0x91d8('0x7'));router['get']('/',auth[_0x91d8('0x8')](),controller['index']);router[_0x91d8('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x91d8('0xa')]);router[_0x91d8('0xb')]('/',auth[_0x91d8('0x8')](),controller[_0x91d8('0xc')]);router[_0x91d8('0xd')](_0x91d8('0xe'),auth['isAuthenticated'](),controller[_0x91d8('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x91d8('0x10')]);module[_0x91d8('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 5c96844..f545d4e 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 _0xbe05=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x2f8194,_0x50b945){var _0x145a77=function(_0x5ab7b9){while(--_0x5ab7b9){_0x2f8194['push'](_0x2f8194['shift']());}};_0x145a77(++_0x50b945);}(_0xbe05,0x92));var _0x5be0=function(_0x4f4d49,_0x5c8512){_0x4f4d49=_0x4f4d49-0x0;var _0x2813eb=_0xbe05[_0x4f4d49];return _0x2813eb;};'use strict';var Sequelize=require(_0x5be0('0x0'));module[_0x5be0('0x1')]={'type':{'type':Sequelize[_0x5be0('0x2')](_0x5be0('0x3'),_0x5be0('0x4'),_0x5be0('0x5'),_0x5be0('0x6'),_0x5be0('0x7')),'defaultValue':_0x5be0('0x3')},'content':{'type':Sequelize[_0x5be0('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5be0('0x2')](_0x5be0('0x3'),_0x5be0('0x4'),_0x5be0('0x5'))},'keyContent':{'type':Sequelize[_0x5be0('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5be0('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5be0('0x8')]}}; \ No newline at end of file +var _0xd9b1=['keyValue','picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable'];(function(_0x57ef2b,_0x2adde9){var _0x1f1234=function(_0x40c534){while(--_0x40c534){_0x57ef2b['push'](_0x57ef2b['shift']());}};_0x1f1234(++_0x2adde9);}(_0xd9b1,0xd7));var _0x1d9b=function(_0x8d95a3,_0x735f63){_0x8d95a3=_0x8d95a3-0x0;var _0x1acf63=_0xd9b1[_0x8d95a3];return _0x1acf63;};'use strict';var Sequelize=require(_0x1d9b('0x0'));module[_0x1d9b('0x1')]={'type':{'type':Sequelize[_0x1d9b('0x2')]('string',_0x1d9b('0x3'),_0x1d9b('0x4'),_0x1d9b('0x5'),_0x1d9b('0x6')),'defaultValue':_0x1d9b('0x7')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1d9b('0x8')]},'keyType':{'type':Sequelize[_0x1d9b('0x2')](_0x1d9b('0x7'),_0x1d9b('0x3'),_0x1d9b('0x4'))},'keyContent':{'type':Sequelize[_0x1d9b('0x8')]},'idField':{'type':Sequelize[_0x1d9b('0x8')]},'nameField':{'type':Sequelize[_0x1d9b('0x8')]},'customField':{'type':Sequelize[_0x1d9b('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 194a314..ede2d94 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 _0xce27=['DeskField','rawAttributes','type','key','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','map'];(function(_0x403115,_0x2d6d03){var _0x596ef3=function(_0x145d97){while(--_0x145d97){_0x403115['push'](_0x403115['shift']());}};_0x596ef3(++_0x2d6d03);}(_0xce27,0xef));var _0x7ce2=function(_0x2ce6b5,_0x11c553){_0x2ce6b5=_0x2ce6b5-0x0;var _0x40875d=_0xce27[_0x2ce6b5];return _0x40875d;};'use strict';var emlformat=require(_0x7ce2('0x0'));var rimraf=require(_0x7ce2('0x1'));var zipdir=require(_0x7ce2('0x2'));var jsonpatch=require(_0x7ce2('0x3'));var rp=require(_0x7ce2('0x4'));var moment=require(_0x7ce2('0x5'));var BPromise=require(_0x7ce2('0x6'));var Mustache=require(_0x7ce2('0x7'));var util=require('util');var path=require('path');var sox=require(_0x7ce2('0x8'));var csv=require(_0x7ce2('0x9'));var ejs=require(_0x7ce2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7ce2('0xb'));var crypto=require(_0x7ce2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7ce2('0xd'));var toCsv=require(_0x7ce2('0x9'));var querystring=require('querystring');var Papa=require(_0x7ce2('0xe'));var Redis=require('ioredis');var authService=require(_0x7ce2('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7ce2('0x10'));var hardwareService=require(_0x7ce2('0x11'));var logger=require(_0x7ce2('0x12'))(_0x7ce2('0x13'));var utils=require(_0x7ce2('0x14'));var config=require(_0x7ce2('0x15'));var licenseUtil=require(_0x7ce2('0x16'));var db=require(_0x7ce2('0x17'))['db'];function respondWithStatusCode(_0x386a6d,_0x4c6ec0){_0x4c6ec0=_0x4c6ec0||0xcc;return function(_0x3de14f){if(_0x3de14f){return _0x386a6d['sendStatus'](_0x4c6ec0);}return _0x386a6d[_0x7ce2('0x18')](_0x4c6ec0)[_0x7ce2('0x19')]();};}function respondWithResult(_0x4a0138,_0x12559c){_0x12559c=_0x12559c||0xc8;return function(_0x18787f){if(_0x18787f){return _0x4a0138[_0x7ce2('0x18')](_0x12559c)[_0x7ce2('0x1a')](_0x18787f);}};}function respondWithFilteredResult(_0x1ae16a,_0xe7e65e){return function(_0x422c62){if(_0x422c62){var _0x3a1157=typeof _0xe7e65e[_0x7ce2('0x1b')]===_0x7ce2('0x1c')&&typeof _0xe7e65e[_0x7ce2('0x1d')]===_0x7ce2('0x1c');var _0x162e3b=_0x422c62[_0x7ce2('0x1e')];var _0x232ca2=_0x3a1157?0x0:_0xe7e65e[_0x7ce2('0x1b')];var _0x4466a0=_0x3a1157?_0x422c62[_0x7ce2('0x1e')]:_0xe7e65e[_0x7ce2('0x1b')]+_0xe7e65e['limit'];var _0x70a257;if(_0x4466a0>=_0x162e3b){_0x4466a0=_0x162e3b;_0x70a257=0xc8;}else{_0x70a257=0xce;}_0x1ae16a[_0x7ce2('0x18')](_0x70a257);return _0x1ae16a['set'](_0x7ce2('0x1f'),_0x232ca2+'-'+_0x4466a0+'/'+_0x162e3b)['json'](_0x422c62);}return null;};}function patchUpdates(_0x4fbff3){return function(_0x4e3a6d){try{jsonpatch[_0x7ce2('0x20')](_0x4e3a6d,_0x4fbff3,!![]);}catch(_0x4443e2){return BPromise['reject'](_0x4443e2);}return _0x4e3a6d[_0x7ce2('0x21')]();};}function saveUpdates(_0x2fdfa7,_0x1e5697){return function(_0x187cd0){if(_0x187cd0){return _0x187cd0[_0x7ce2('0x22')](_0x2fdfa7)[_0x7ce2('0x23')](function(_0x1a970a){return _0x1a970a;});}return null;};}function removeEntity(_0x25c67e,_0x685ec){return function(_0x216498){if(_0x216498){return _0x216498[_0x7ce2('0x24')]()[_0x7ce2('0x23')](function(){_0x25c67e['status'](0xcc)[_0x7ce2('0x19')]();});}};}function handleEntityNotFound(_0x14bfe4,_0x3940d3){return function(_0x14d111){if(!_0x14d111){_0x14bfe4[_0x7ce2('0x25')](0x194);}return _0x14d111;};}function handleError(_0x32d853,_0x85b772){_0x85b772=_0x85b772||0x1f4;return function(_0x4375b1){logger['error'](_0x4375b1['stack']);if(_0x4375b1[_0x7ce2('0x26')]){delete _0x4375b1[_0x7ce2('0x26')];}_0x32d853['status'](_0x85b772)[_0x7ce2('0x27')](_0x4375b1);};}exports['index']=function(_0x34a59a,_0x24cf96){var _0x3864ed={},_0x134e4f={},_0x54288c={'count':0x0,'rows':[]};var _0x37c8d2=_[_0x7ce2('0x28')](db[_0x7ce2('0x29')][_0x7ce2('0x2a')],function(_0x211541){return{'name':_0x211541['fieldName'],'type':_0x211541[_0x7ce2('0x2b')][_0x7ce2('0x2c')]};});_0x134e4f['model']=_[_0x7ce2('0x28')](_0x37c8d2,_0x7ce2('0x26'));_0x134e4f[_0x7ce2('0x2d')]=_[_0x7ce2('0x2e')](_0x34a59a[_0x7ce2('0x2d')]);_0x134e4f['filters']=_[_0x7ce2('0x2f')](_0x134e4f['model'],_0x134e4f[_0x7ce2('0x2d')]);_0x3864ed[_0x7ce2('0x30')]=_[_0x7ce2('0x2f')](_0x134e4f['model'],qs['fields'](_0x34a59a[_0x7ce2('0x2d')][_0x7ce2('0x31')]));_0x3864ed['attributes']=_0x3864ed[_0x7ce2('0x30')][_0x7ce2('0x32')]?_0x3864ed[_0x7ce2('0x30')]:_0x134e4f[_0x7ce2('0x33')];if(!_0x34a59a['query'][_0x7ce2('0x34')]('nolimit')){_0x3864ed['limit']=qs[_0x7ce2('0x1d')](_0x34a59a[_0x7ce2('0x2d')][_0x7ce2('0x1d')]);_0x3864ed[_0x7ce2('0x1b')]=qs['offset'](_0x34a59a[_0x7ce2('0x2d')][_0x7ce2('0x1b')]);}_0x3864ed['order']=qs['sort'](_0x34a59a[_0x7ce2('0x2d')][_0x7ce2('0x35')]);_0x3864ed[_0x7ce2('0x36')]=qs[_0x7ce2('0x37')](_[_0x7ce2('0x38')](_0x34a59a['query'],_0x134e4f['filters']),_0x37c8d2);if(_0x34a59a[_0x7ce2('0x2d')][_0x7ce2('0x39')]){_0x3864ed[_0x7ce2('0x36')]=_[_0x7ce2('0x3a')](_0x3864ed[_0x7ce2('0x36')],{'$or':_[_0x7ce2('0x28')](_0x37c8d2,function(_0x43c080){if(_0x43c080[_0x7ce2('0x2b')]!==_0x7ce2('0x3b')){var _0x4c98b8={};_0x4c98b8[_0x43c080['name']]={'$like':'%'+_0x34a59a['query'][_0x7ce2('0x39')]+'%'};return _0x4c98b8;}})});}_0x3864ed=_[_0x7ce2('0x3a')]({},_0x3864ed,_0x34a59a['options']);var _0x4dbba5={'where':_0x3864ed[_0x7ce2('0x36')]};return db[_0x7ce2('0x29')][_0x7ce2('0x1e')](_0x4dbba5)[_0x7ce2('0x23')](function(_0x4a3247){_0x54288c[_0x7ce2('0x1e')]=_0x4a3247;if(_0x34a59a[_0x7ce2('0x2d')][_0x7ce2('0x3c')]){_0x3864ed[_0x7ce2('0x3d')]=[{'all':!![]}];}return db[_0x7ce2('0x29')][_0x7ce2('0x3e')](_0x3864ed);})[_0x7ce2('0x23')](function(_0xad22de){_0x54288c[_0x7ce2('0x3f')]=_0xad22de;return _0x54288c;})[_0x7ce2('0x23')](respondWithFilteredResult(_0x24cf96,_0x3864ed))[_0x7ce2('0x40')](handleError(_0x24cf96,null));};exports[_0x7ce2('0x41')]=function(_0x2062f9,_0x4c0553){var _0x219c8c={'raw':!![],'where':{'id':_0x2062f9[_0x7ce2('0x42')]['id']}},_0x3665a6={};_0x3665a6['model']=_[_0x7ce2('0x2e')](db[_0x7ce2('0x29')][_0x7ce2('0x2a')]);_0x3665a6['query']=_[_0x7ce2('0x2e')](_0x2062f9['query']);_0x3665a6['filters']=_[_0x7ce2('0x2f')](_0x3665a6[_0x7ce2('0x33')],_0x3665a6[_0x7ce2('0x2d')]);_0x219c8c['attributes']=_[_0x7ce2('0x2f')](_0x3665a6[_0x7ce2('0x33')],qs[_0x7ce2('0x31')](_0x2062f9['query'][_0x7ce2('0x31')]));_0x219c8c[_0x7ce2('0x30')]=_0x219c8c[_0x7ce2('0x30')][_0x7ce2('0x32')]?_0x219c8c['attributes']:_0x3665a6[_0x7ce2('0x33')];if(_0x2062f9[_0x7ce2('0x2d')][_0x7ce2('0x3c')]){_0x219c8c[_0x7ce2('0x3d')]=[{'all':!![]}];}_0x219c8c=_[_0x7ce2('0x3a')]({},_0x219c8c,_0x2062f9['options']);return db['DeskField'][_0x7ce2('0x43')](_0x219c8c)[_0x7ce2('0x23')](handleEntityNotFound(_0x4c0553,null))[_0x7ce2('0x23')](respondWithResult(_0x4c0553,null))[_0x7ce2('0x40')](handleError(_0x4c0553,null));};exports[_0x7ce2('0x44')]=function(_0xbe581e,_0x5b752f){return db[_0x7ce2('0x29')][_0x7ce2('0x44')](_0xbe581e[_0x7ce2('0x45')],{})[_0x7ce2('0x23')](respondWithResult(_0x5b752f,0xc9))[_0x7ce2('0x40')](handleError(_0x5b752f,null));};exports[_0x7ce2('0x22')]=function(_0x6ea087,_0x323daf){if(_0x6ea087[_0x7ce2('0x45')]['id']){delete _0x6ea087[_0x7ce2('0x45')]['id'];}return db[_0x7ce2('0x29')]['find']({'where':{'id':_0x6ea087[_0x7ce2('0x42')]['id']}})['then'](handleEntityNotFound(_0x323daf,null))[_0x7ce2('0x23')](saveUpdates(_0x6ea087[_0x7ce2('0x45')],null))[_0x7ce2('0x23')](respondWithResult(_0x323daf,null))[_0x7ce2('0x40')](handleError(_0x323daf,null));};exports[_0x7ce2('0x24')]=function(_0x44cca5,_0x19e7a2){return db[_0x7ce2('0x29')][_0x7ce2('0x43')]({'where':{'id':_0x44cca5['params']['id']}})['then'](handleEntityNotFound(_0x19e7a2,null))[_0x7ce2('0x23')](removeEntity(_0x19e7a2,null))['catch'](handleError(_0x19e7a2,null));}; \ No newline at end of file +var _0x3787=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','destroy','then','end','error','stack','name','index','map','DeskField','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','show','params','include','options','find','catch','create','body','rimraf','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x118fc0,_0x1aedba){var _0x3473e4=function(_0x15fe5e){while(--_0x15fe5e){_0x118fc0['push'](_0x118fc0['shift']());}};_0x3473e4(++_0x1aedba);}(_0x3787,0xd3));var _0x7378=function(_0x57767b,_0x12c9b6){_0x57767b=_0x57767b-0x0;var _0x6fe025=_0x3787[_0x57767b];return _0x6fe025;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7378('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7378('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7378('0x2'));var util=require(_0x7378('0x3'));var path=require(_0x7378('0x4'));var sox=require(_0x7378('0x5'));var csv=require(_0x7378('0x6'));var ejs=require(_0x7378('0x7'));var fs=require('fs');var fs_extra=require(_0x7378('0x8'));var _=require(_0x7378('0x9'));var squel=require(_0x7378('0xa'));var crypto=require(_0x7378('0xb'));var jsforce=require(_0x7378('0xc'));var deskjs=require(_0x7378('0xd'));var toCsv=require(_0x7378('0x6'));var querystring=require(_0x7378('0xe'));var Papa=require(_0x7378('0xf'));var Redis=require(_0x7378('0x10'));var authService=require(_0x7378('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7378('0x12'));var hardwareService=require(_0x7378('0x13'));var logger=require('../../config/logger')(_0x7378('0x14'));var utils=require(_0x7378('0x15'));var config=require(_0x7378('0x16'));var licenseUtil=require(_0x7378('0x17'));var db=require(_0x7378('0x18'))['db'];function respondWithStatusCode(_0x573670,_0x4ac0b0){_0x4ac0b0=_0x4ac0b0||0xcc;return function(_0x50f896){if(_0x50f896){return _0x573670[_0x7378('0x19')](_0x4ac0b0);}return _0x573670[_0x7378('0x1a')](_0x4ac0b0)['end']();};}function respondWithResult(_0x1377f5,_0x319dfb){_0x319dfb=_0x319dfb||0xc8;return function(_0x485021){if(_0x485021){return _0x1377f5[_0x7378('0x1a')](_0x319dfb)['json'](_0x485021);}};}function respondWithFilteredResult(_0x177cac,_0x149fa1){return function(_0x873f4f){if(_0x873f4f){var _0x7dd3bf=typeof _0x149fa1[_0x7378('0x1b')]===_0x7378('0x1c')&&typeof _0x149fa1['limit']==='undefined';var _0x13141b=_0x873f4f[_0x7378('0x1d')];var _0x3ee05d=_0x7dd3bf?0x0:_0x149fa1[_0x7378('0x1b')];var _0x2980e8=_0x7dd3bf?_0x873f4f['count']:_0x149fa1[_0x7378('0x1b')]+_0x149fa1[_0x7378('0x1e')];var _0x25ecf2;if(_0x2980e8>=_0x13141b){_0x2980e8=_0x13141b;_0x25ecf2=0xc8;}else{_0x25ecf2=0xce;}_0x177cac[_0x7378('0x1a')](_0x25ecf2);return _0x177cac['set'](_0x7378('0x1f'),_0x3ee05d+'-'+_0x2980e8+'/'+_0x13141b)[_0x7378('0x20')](_0x873f4f);}return null;};}function patchUpdates(_0x33eac6){return function(_0x50d976){try{jsonpatch[_0x7378('0x21')](_0x50d976,_0x33eac6,!![]);}catch(_0x543207){return BPromise[_0x7378('0x22')](_0x543207);}return _0x50d976[_0x7378('0x23')]();};}function saveUpdates(_0x61a85d,_0x3478bb){return function(_0x3c1e99){if(_0x3c1e99){return _0x3c1e99[_0x7378('0x24')](_0x61a85d)['then'](function(_0x53bb16){return _0x53bb16;});}return null;};}function removeEntity(_0x29e038,_0x3afe0c){return function(_0x57e44e){if(_0x57e44e){return _0x57e44e[_0x7378('0x25')]()[_0x7378('0x26')](function(){_0x29e038[_0x7378('0x1a')](0xcc)[_0x7378('0x27')]();});}};}function handleEntityNotFound(_0x4293f3,_0x5c7b19){return function(_0x5868bf){if(!_0x5868bf){_0x4293f3[_0x7378('0x19')](0x194);}return _0x5868bf;};}function handleError(_0x1f7341,_0x2f1c82){_0x2f1c82=_0x2f1c82||0x1f4;return function(_0x3015a2){logger[_0x7378('0x28')](_0x3015a2[_0x7378('0x29')]);if(_0x3015a2[_0x7378('0x2a')]){delete _0x3015a2[_0x7378('0x2a')];}_0x1f7341[_0x7378('0x1a')](_0x2f1c82)['send'](_0x3015a2);};}exports[_0x7378('0x2b')]=function(_0x3d72ac,_0x149c49){var _0x3227d6={},_0x1b3e19={},_0x4e0bad={'count':0x0,'rows':[]};var _0x55f8de=_[_0x7378('0x2c')](db[_0x7378('0x2d')][_0x7378('0x2e')],function(_0x1c34b0){return{'name':_0x1c34b0[_0x7378('0x2f')],'type':_0x1c34b0['type'][_0x7378('0x30')]};});_0x1b3e19[_0x7378('0x31')]=_['map'](_0x55f8de,_0x7378('0x2a'));_0x1b3e19[_0x7378('0x32')]=_[_0x7378('0x33')](_0x3d72ac[_0x7378('0x32')]);_0x1b3e19[_0x7378('0x34')]=_['intersection'](_0x1b3e19['model'],_0x1b3e19[_0x7378('0x32')]);_0x3227d6[_0x7378('0x35')]=_[_0x7378('0x36')](_0x1b3e19[_0x7378('0x31')],qs[_0x7378('0x37')](_0x3d72ac['query'][_0x7378('0x37')]));_0x3227d6[_0x7378('0x35')]=_0x3227d6[_0x7378('0x35')][_0x7378('0x38')]?_0x3227d6[_0x7378('0x35')]:_0x1b3e19['model'];if(!_0x3d72ac[_0x7378('0x32')]['hasOwnProperty'](_0x7378('0x39'))){_0x3227d6[_0x7378('0x1e')]=qs['limit'](_0x3d72ac[_0x7378('0x32')]['limit']);_0x3227d6['offset']=qs['offset'](_0x3d72ac[_0x7378('0x32')][_0x7378('0x1b')]);}_0x3227d6[_0x7378('0x3a')]=qs[_0x7378('0x3b')](_0x3d72ac['query'][_0x7378('0x3b')]);_0x3227d6[_0x7378('0x3c')]=qs[_0x7378('0x34')](_[_0x7378('0x3d')](_0x3d72ac[_0x7378('0x32')],_0x1b3e19[_0x7378('0x34')]),_0x55f8de);if(_0x3d72ac[_0x7378('0x32')]['filter']){_0x3227d6['where']=_[_0x7378('0x3e')](_0x3227d6[_0x7378('0x3c')],{'$or':_['map'](_0x55f8de,function(_0x20e9ef){if(_0x20e9ef['type']!==_0x7378('0x3f')){var _0x1523c6={};_0x1523c6[_0x20e9ef[_0x7378('0x2a')]]={'$like':'%'+_0x3d72ac[_0x7378('0x32')][_0x7378('0x40')]+'%'};return _0x1523c6;}})});}_0x3227d6=_[_0x7378('0x3e')]({},_0x3227d6,_0x3d72ac['options']);var _0x392cab={'where':_0x3227d6[_0x7378('0x3c')]};return db[_0x7378('0x2d')]['count'](_0x392cab)[_0x7378('0x26')](function(_0x31e32e){_0x4e0bad[_0x7378('0x1d')]=_0x31e32e;if(_0x3d72ac[_0x7378('0x32')][_0x7378('0x41')]){_0x3227d6['include']=[{'all':!![]}];}return db[_0x7378('0x2d')]['findAll'](_0x3227d6);})['then'](function(_0x302381){_0x4e0bad['rows']=_0x302381;return _0x4e0bad;})[_0x7378('0x26')](respondWithFilteredResult(_0x149c49,_0x3227d6))['catch'](handleError(_0x149c49,null));};exports[_0x7378('0x42')]=function(_0x41346c,_0x68a961){var _0x2fcbba={'raw':!![],'where':{'id':_0x41346c[_0x7378('0x43')]['id']}},_0xda9fa9={};_0xda9fa9[_0x7378('0x31')]=_[_0x7378('0x33')](db[_0x7378('0x2d')]['rawAttributes']);_0xda9fa9[_0x7378('0x32')]=_[_0x7378('0x33')](_0x41346c[_0x7378('0x32')]);_0xda9fa9['filters']=_[_0x7378('0x36')](_0xda9fa9['model'],_0xda9fa9[_0x7378('0x32')]);_0x2fcbba[_0x7378('0x35')]=_[_0x7378('0x36')](_0xda9fa9[_0x7378('0x31')],qs[_0x7378('0x37')](_0x41346c['query']['fields']));_0x2fcbba[_0x7378('0x35')]=_0x2fcbba[_0x7378('0x35')]['length']?_0x2fcbba[_0x7378('0x35')]:_0xda9fa9[_0x7378('0x31')];if(_0x41346c['query']['includeAll']){_0x2fcbba[_0x7378('0x44')]=[{'all':!![]}];}_0x2fcbba=_['merge']({},_0x2fcbba,_0x41346c[_0x7378('0x45')]);return db[_0x7378('0x2d')][_0x7378('0x46')](_0x2fcbba)[_0x7378('0x26')](handleEntityNotFound(_0x68a961,null))[_0x7378('0x26')](respondWithResult(_0x68a961,null))[_0x7378('0x47')](handleError(_0x68a961,null));};exports[_0x7378('0x48')]=function(_0x5837ca,_0x4bd4a7){return db[_0x7378('0x2d')][_0x7378('0x48')](_0x5837ca[_0x7378('0x49')],{})[_0x7378('0x26')](respondWithResult(_0x4bd4a7,0xc9))[_0x7378('0x47')](handleError(_0x4bd4a7,null));};exports[_0x7378('0x24')]=function(_0xb39228,_0x4842be){if(_0xb39228[_0x7378('0x49')]['id']){delete _0xb39228[_0x7378('0x49')]['id'];}return db[_0x7378('0x2d')][_0x7378('0x46')]({'where':{'id':_0xb39228[_0x7378('0x43')]['id']}})[_0x7378('0x26')](handleEntityNotFound(_0x4842be,null))['then'](saveUpdates(_0xb39228['body'],null))[_0x7378('0x26')](respondWithResult(_0x4842be,null))[_0x7378('0x47')](handleError(_0x4842be,null));};exports['destroy']=function(_0x687f1f,_0x537c36){return db[_0x7378('0x2d')][_0x7378('0x46')]({'where':{'id':_0x687f1f[_0x7378('0x43')]['id']}})[_0x7378('0x26')](handleEntityNotFound(_0x537c36,null))[_0x7378('0x26')](removeEntity(_0x537c36,null))['catch'](handleError(_0x537c36,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index ef6b53b..4927046 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 _0xf3c3=['request-promise','path','rimraf','../../config/environment','exports','define','desk_unique_index','idField','FieldId','../../config/logger','moment','bluebird'];(function(_0x1c841f,_0x41fbc6){var _0x51024d=function(_0x4d3722){while(--_0x4d3722){_0x1c841f['push'](_0x1c841f['shift']());}};_0x51024d(++_0x41fbc6);}(_0xf3c3,0x105));var _0x3f3c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf3c3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3f3c('0x0'))('api');var moment=require(_0x3f3c('0x1'));var BPromise=require(_0x3f3c('0x2'));var rp=require(_0x3f3c('0x3'));var fs=require('fs');var path=require(_0x3f3c('0x4'));var rimraf=require(_0x3f3c('0x5'));var config=require(_0x3f3c('0x6'));var attributes=require('./intDeskField.attributes');module[_0x3f3c('0x7')]=function(_0x1f7fac,_0x141a02){return _0x1f7fac[_0x3f3c('0x8')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x3f3c('0x9'),'fields':[_0x3f3c('0xa'),_0x3f3c('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd890=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','util'];(function(_0x361c85,_0x5a261c){var _0x135ad3=function(_0xd35f23){while(--_0xd35f23){_0x361c85['push'](_0x361c85['shift']());}};_0x135ad3(++_0x5a261c);}(_0xd890,0x13f));var _0x0d89=function(_0x254b22,_0x27159f){_0x254b22=_0x254b22-0x0;var _0x1279db=_0xd890[_0x254b22];return _0x1279db;};'use strict';var _=require('lodash');var util=require(_0x0d89('0x0'));var logger=require(_0x0d89('0x1'))(_0x0d89('0x2'));var moment=require(_0x0d89('0x3'));var BPromise=require(_0x0d89('0x4'));var rp=require(_0x0d89('0x5'));var fs=require('fs');var path=require(_0x0d89('0x6'));var rimraf=require(_0x0d89('0x7'));var config=require(_0x0d89('0x8'));var attributes=require(_0x0d89('0x9'));module[_0x0d89('0xa')]=function(_0x57661a,_0x584444){return _0x57661a[_0x0d89('0xb')](_0x0d89('0xc'),attributes,{'tableName':_0x0d89('0xd'),'paranoid':![],'indexes':[{'name':_0x0d89('0xe'),'fields':[_0x0d89('0xf'),'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 10e3980..aa3d70c 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 _0x596b=['rpc','../../config/environment','jayson/promise','client','request','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x701d0c,_0x4dba94){var _0x240681=function(_0x24e5f1){while(--_0x24e5f1){_0x701d0c['push'](_0x701d0c['shift']());}};_0x240681(++_0x4dba94);}(_0x596b,0xca));var _0xb596=function(_0xc9b768,_0x2117ef){_0xc9b768=_0xc9b768-0x0;var _0x56dfa2=_0x596b[_0xc9b768];return _0x56dfa2;};'use strict';var _=require(_0xb596('0x0'));var util=require(_0xb596('0x1'));var moment=require(_0xb596('0x2'));var BPromise=require(_0xb596('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb596('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb596('0x5'));var logger=require(_0xb596('0x6'))(_0xb596('0x7'));var config=require(_0xb596('0x8'));var jayson=require(_0xb596('0x9'));var client=jayson[_0xb596('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22183a,_0x3f5450,_0x31ce88){return new BPromise(function(_0x5d4142,_0x332095){return client[_0xb596('0xb')](_0x22183a,_0x31ce88)['then'](function(_0x3058bb){logger[_0xb596('0xc')](_0xb596('0xd'),_0x3f5450,_0xb596('0xe'));logger['debug'](_0xb596('0xf'),_0x3f5450,_0xb596('0xe'),JSON['stringify'](_0x3058bb));if(_0x3058bb['error']){if(_0x3058bb[_0xb596('0x10')]['code']===0x1f4){logger['error'](_0xb596('0xd'),_0x3f5450,_0x3058bb[_0xb596('0x10')]['message']);return _0x332095(_0x3058bb[_0xb596('0x10')][_0xb596('0x11')]);}logger[_0xb596('0x10')](_0xb596('0xd'),_0x3f5450,_0x3058bb[_0xb596('0x10')][_0xb596('0x11')]);return _0x5d4142(_0x3058bb[_0xb596('0x10')][_0xb596('0x11')]);}else{logger[_0xb596('0xc')](_0xb596('0xd'),_0x3f5450,'request\x20sent');_0x5d4142(_0x3058bb['result'][_0xb596('0x11')]);}})[_0xb596('0x12')](function(_0x4af3b3){logger[_0xb596('0x10')]('DeskField,\x20%s,\x20%s',_0x3f5450,_0x4af3b3);_0x332095(_0x4af3b3);});});} \ No newline at end of file +var _0x89a4=['lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch'];(function(_0x196126,_0x35ce6c){var _0xe144e9=function(_0x5d03a7){while(--_0x5d03a7){_0x196126['push'](_0x196126['shift']());}};_0xe144e9(++_0x35ce6c);}(_0x89a4,0x1ce));var _0x489a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x89a4[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x489a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x489a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x489a('0x2'));var db=require(_0x489a('0x3'))['db'];var utils=require(_0x489a('0x4'));var logger=require(_0x489a('0x5'))('rpc');var config=require(_0x489a('0x6'));var jayson=require(_0x489a('0x7'));var client=jayson[_0x489a('0x8')][_0x489a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a75dc,_0x309ef4,_0xb25ef1){return new BPromise(function(_0x1b2b13,_0x33e8d1){return client[_0x489a('0xa')](_0x5a75dc,_0xb25ef1)[_0x489a('0xb')](function(_0x5684e4){logger['info'](_0x489a('0xc'),_0x309ef4,_0x489a('0xd'));logger['debug'](_0x489a('0xe'),_0x309ef4,_0x489a('0xd'),JSON[_0x489a('0xf')](_0x5684e4));if(_0x5684e4[_0x489a('0x10')]){if(_0x5684e4['error'][_0x489a('0x11')]===0x1f4){logger[_0x489a('0x10')](_0x489a('0xc'),_0x309ef4,_0x5684e4[_0x489a('0x10')][_0x489a('0x12')]);return _0x33e8d1(_0x5684e4[_0x489a('0x10')][_0x489a('0x12')]);}logger[_0x489a('0x10')](_0x489a('0xc'),_0x309ef4,_0x5684e4[_0x489a('0x10')][_0x489a('0x12')]);return _0x1b2b13(_0x5684e4[_0x489a('0x10')][_0x489a('0x12')]);}else{logger[_0x489a('0x13')](_0x489a('0xc'),_0x309ef4,_0x489a('0xd'));_0x1b2b13(_0x5684e4['result'][_0x489a('0x12')]);}})[_0x489a('0x14')](function(_0x4cc153){logger['error']('DeskField,\x20%s,\x20%s',_0x309ef4,_0x4cc153);_0x33e8d1(_0x4cc153);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 08739c1..6ac9b7b 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 _0x19bf=['/:id','show','/:id/fields','getFields','create','addConfiguration','put','update','multer','util','path','Router','fs-extra','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index'];(function(_0x3e5bc8,_0x457d89){var _0xfd84bc=function(_0x1a766c){while(--_0x1a766c){_0x3e5bc8['push'](_0x3e5bc8['shift']());}};_0xfd84bc(++_0x457d89);}(_0x19bf,0x1a6));var _0xf19b=function(_0x2d935c,_0x413082){_0x2d935c=_0x2d935c-0x0;var _0x50f63b=_0x19bf[_0x2d935c];return _0x50f63b;};'use strict';var multer=require(_0xf19b('0x0'));var util=require(_0xf19b('0x1'));var path=require(_0xf19b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf19b('0x3')]();var fs_extra=require(_0xf19b('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf19b('0x5'));var controller=require(_0xf19b('0x6'));router[_0xf19b('0x7')]('/',auth[_0xf19b('0x8')](),controller[_0xf19b('0x9')]);router[_0xf19b('0x7')](_0xf19b('0xa'),auth[_0xf19b('0x8')](),controller[_0xf19b('0xb')]);router[_0xf19b('0x7')]('/:id/configurations',auth[_0xf19b('0x8')](),controller['getConfigurations']);router[_0xf19b('0x7')](_0xf19b('0xc'),auth[_0xf19b('0x8')](),controller[_0xf19b('0xd')]);router['post']('/',auth[_0xf19b('0x8')](),controller[_0xf19b('0xe')]);router['post']('/:id/configurations',auth[_0xf19b('0x8')](),controller[_0xf19b('0xf')]);router[_0xf19b('0x10')](_0xf19b('0xa'),auth[_0xf19b('0x8')](),controller[_0xf19b('0x11')]);router['delete'](_0xf19b('0xa'),auth[_0xf19b('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7401=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','get','isAuthenticated','index','/:id/configurations','/:id/fields','post','create','addConfiguration','/:id','update','delete','destroy','path','connect-timeout','express'];(function(_0x1230c1,_0x17107d){var _0x3d5298=function(_0x4414d3){while(--_0x4414d3){_0x1230c1['push'](_0x1230c1['shift']());}};_0x3d5298(++_0x17107d);}(_0x7401,0x18d));var _0x1740=function(_0x3b0ccf,_0x398f04){_0x3b0ccf=_0x3b0ccf-0x0;var _0x360d9d=_0x7401[_0x3b0ccf];return _0x360d9d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1740('0x0'));var timeout=require(_0x1740('0x1'));var express=require(_0x1740('0x2'));var router=express[_0x1740('0x3')]();var fs_extra=require(_0x1740('0x4'));var auth=require(_0x1740('0x5'));var interaction=require(_0x1740('0x6'));var config=require('../../config/environment');var controller=require(_0x1740('0x7'));router[_0x1740('0x8')]('/',auth[_0x1740('0x9')](),controller[_0x1740('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x1740('0x8')](_0x1740('0xb'),auth[_0x1740('0x9')](),controller['getConfigurations']);router[_0x1740('0x8')](_0x1740('0xc'),auth[_0x1740('0x9')](),controller['getFields']);router[_0x1740('0xd')]('/',auth['isAuthenticated'](),controller[_0x1740('0xe')]);router[_0x1740('0xd')](_0x1740('0xb'),auth[_0x1740('0x9')](),controller[_0x1740('0xf')]);router['put'](_0x1740('0x10'),auth['isAuthenticated'](),controller[_0x1740('0x11')]);router[_0x1740('0x12')](_0x1740('0x10'),auth[_0x1740('0x9')](),controller[_0x1740('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index c92a559..9de2dd2 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 _0x7a4b=['sequelize','STRING'];(function(_0x4e029f,_0x177074){var _0x135b7e=function(_0x37caff){while(--_0x37caff){_0x4e029f['push'](_0x4e029f['shift']());}};_0x135b7e(++_0x177074);}(_0x7a4b,0x186));var _0xb7a4=function(_0x505cff,_0x1b16c7){_0x505cff=_0x505cff-0x0;var _0x1eae92=_0x7a4b[_0x505cff];return _0x1eae92;};'use strict';var Sequelize=require(_0xb7a4('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xb7a4('0x1')]},'remoteUri':{'type':Sequelize[_0xb7a4('0x1')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xb7a4('0x1')]},'clientSecret':{'type':Sequelize[_0xb7a4('0x1')]},'serverUrl':{'type':Sequelize[_0xb7a4('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb7a4('0x1')]}}; \ No newline at end of file +var _0xd027=['sequelize','exports','STRING'];(function(_0x3ce16a,_0xa54941){var _0x1f24a9=function(_0x34cfed){while(--_0x34cfed){_0x3ce16a['push'](_0x3ce16a['shift']());}};_0x1f24a9(++_0xa54941);}(_0xd027,0x117));var _0x7d02=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd027[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7d02('0x0'));module[_0x7d02('0x1')]={'name':{'type':Sequelize[_0x7d02('0x2')]},'username':{'type':Sequelize[_0x7d02('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x7d02('0x2')]},'tenantId':{'type':Sequelize[_0x7d02('0x2')]},'clientId':{'type':Sequelize[_0x7d02('0x2')]},'clientSecret':{'type':Sequelize[_0x7d02('0x2')]},'serverUrl':{'type':Sequelize[_0x7d02('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index d605a7f..9747a05 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 _0x8d97=['params','keys','options','create','body','find','findOne','Dynamics365Configuration','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','Dynamics365Field','getFields','ticketType','incident','Incident','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyyominame','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','escalatedon','firstresponsebykpiidname','importsequencenumber','influencescore','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','tenantId','clientId','clientSecret','slice','substring','lastIndexOf','format','POST','/oauth2/token','access_token','GET','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','remove','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','Wrong\x20credentials','statusCode','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value',')/Attributes(','TrueOption','true','DisplayName','?$select=DisplayName,LogicalName','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','includeAll','include','findAll','catch','show'];(function(_0x156696,_0x3a9a2e){var _0x5ab7c4=function(_0x26179a){while(--_0x26179a){_0x156696['push'](_0x156696['shift']());}};_0x5ab7c4(++_0x3a9a2e);}(_0x8d97,0x82));var _0x78d9=function(_0xbf129b,_0x2482d0){_0xbf129b=_0xbf129b-0x0;var _0x4dd642=_0x8d97[_0xbf129b];return _0x4dd642;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x78d9('0x0'));var zipdir=require(_0x78d9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x78d9('0x2'));var moment=require(_0x78d9('0x3'));var BPromise=require(_0x78d9('0x4'));var Mustache=require(_0x78d9('0x5'));var util=require(_0x78d9('0x6'));var path=require('path');var sox=require(_0x78d9('0x7'));var csv=require(_0x78d9('0x8'));var ejs=require(_0x78d9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x78d9('0xa'));var jsforce=require(_0x78d9('0xb'));var deskjs=require(_0x78d9('0xc'));var toCsv=require(_0x78d9('0x8'));var querystring=require(_0x78d9('0xd'));var Papa=require(_0x78d9('0xe'));var Redis=require('ioredis');var authService=require(_0x78d9('0xf'));var qs=require(_0x78d9('0x10'));var as=require(_0x78d9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x78d9('0x12'));var utils=require(_0x78d9('0x13'));var config=require(_0x78d9('0x14'));var licenseUtil=require(_0x78d9('0x15'));var db=require(_0x78d9('0x16'))['db'];var integrations=require(_0x78d9('0x17'));function respondWithStatusCode(_0x528746,_0x8186eb){_0x8186eb=_0x8186eb||0xcc;return function(_0x431199){if(_0x431199){return _0x528746[_0x78d9('0x18')](_0x8186eb);}return _0x528746[_0x78d9('0x19')](_0x8186eb)[_0x78d9('0x1a')]();};}function respondWithResult(_0x2928a8,_0x2b27a9){_0x2b27a9=_0x2b27a9||0xc8;return function(_0x3d8c2f){if(_0x3d8c2f){return _0x2928a8[_0x78d9('0x19')](_0x2b27a9)[_0x78d9('0x1b')](_0x3d8c2f);}};}function respondWithFilteredResult(_0x826882,_0x38aa28){return function(_0x45934d){if(_0x45934d){var _0x3501b5=typeof _0x38aa28[_0x78d9('0x1c')]===_0x78d9('0x1d')&&typeof _0x38aa28[_0x78d9('0x1e')]==='undefined';var _0xfabfde=_0x45934d[_0x78d9('0x1f')];var _0x36f1e4=_0x3501b5?0x0:_0x38aa28[_0x78d9('0x1c')];var _0x43ea59=_0x3501b5?_0x45934d[_0x78d9('0x1f')]:_0x38aa28[_0x78d9('0x1c')]+_0x38aa28[_0x78d9('0x1e')];var _0x3fc3c2;if(_0x43ea59>=_0xfabfde){_0x43ea59=_0xfabfde;_0x3fc3c2=0xc8;}else{_0x3fc3c2=0xce;}_0x826882[_0x78d9('0x19')](_0x3fc3c2);return _0x826882[_0x78d9('0x20')](_0x78d9('0x21'),_0x36f1e4+'-'+_0x43ea59+'/'+_0xfabfde)[_0x78d9('0x1b')](_0x45934d);}return null;};}function patchUpdates(_0x148e30){return function(_0x1e0461){try{jsonpatch[_0x78d9('0x22')](_0x1e0461,_0x148e30,!![]);}catch(_0x4df145){return BPromise[_0x78d9('0x23')](_0x4df145);}return _0x1e0461[_0x78d9('0x24')]();};}function saveUpdates(_0x24d236,_0x18bb18){return function(_0x4d571f){if(_0x4d571f){return _0x4d571f[_0x78d9('0x25')](_0x24d236)[_0x78d9('0x26')](function(_0x45b6f6){return _0x45b6f6;});}return null;};}function removeEntity(_0x51549d,_0x51c4ce){return function(_0x30e434){if(_0x30e434){return _0x30e434['destroy']()['then'](function(){_0x51549d['status'](0xcc)[_0x78d9('0x1a')]();});}};}function handleEntityNotFound(_0x1fa9a1,_0x361a5e){return function(_0xacd80c){if(!_0xacd80c){_0x1fa9a1[_0x78d9('0x18')](0x194);}return _0xacd80c;};}function handleError(_0x17db22,_0x4e87cf){_0x4e87cf=_0x4e87cf||0x1f4;return function(_0x17b928){logger['error'](_0x17b928[_0x78d9('0x27')]);if(_0x17b928[_0x78d9('0x28')]){delete _0x17b928[_0x78d9('0x28')];}_0x17db22['status'](_0x4e87cf)[_0x78d9('0x29')](_0x17b928);};}exports[_0x78d9('0x2a')]=function(_0x59b9d2,_0x47f189){var _0x55617c={},_0x4fce54={},_0x1e4f67={'count':0x0,'rows':[]};var _0xcbb803=_[_0x78d9('0x2b')](db[_0x78d9('0x2c')][_0x78d9('0x2d')],function(_0x3fe42b){return{'name':_0x3fe42b[_0x78d9('0x2e')],'type':_0x3fe42b[_0x78d9('0x2f')][_0x78d9('0x30')]};});_0x4fce54[_0x78d9('0x31')]=_['map'](_0xcbb803,_0x78d9('0x28'));_0x4fce54['query']=_['keys'](_0x59b9d2[_0x78d9('0x32')]);_0x4fce54[_0x78d9('0x33')]=_[_0x78d9('0x34')](_0x4fce54[_0x78d9('0x31')],_0x4fce54[_0x78d9('0x32')]);_0x55617c[_0x78d9('0x35')]=_[_0x78d9('0x34')](_0x4fce54['model'],qs[_0x78d9('0x36')](_0x59b9d2[_0x78d9('0x32')][_0x78d9('0x36')]));_0x55617c[_0x78d9('0x35')]=_0x55617c['attributes'][_0x78d9('0x37')]?_0x55617c['attributes']:_0x4fce54['model'];if(!_0x59b9d2['query']['hasOwnProperty'](_0x78d9('0x38'))){_0x55617c[_0x78d9('0x1e')]=qs[_0x78d9('0x1e')](_0x59b9d2[_0x78d9('0x32')][_0x78d9('0x1e')]);_0x55617c[_0x78d9('0x1c')]=qs[_0x78d9('0x1c')](_0x59b9d2[_0x78d9('0x32')][_0x78d9('0x1c')]);}_0x55617c[_0x78d9('0x39')]=qs[_0x78d9('0x3a')](_0x59b9d2[_0x78d9('0x32')][_0x78d9('0x3a')]);_0x55617c[_0x78d9('0x3b')]=qs[_0x78d9('0x33')](_[_0x78d9('0x3c')](_0x59b9d2[_0x78d9('0x32')],_0x4fce54[_0x78d9('0x33')]),_0xcbb803);if(_0x59b9d2['query']['filter']){_0x55617c[_0x78d9('0x3b')]=_[_0x78d9('0x3d')](_0x55617c[_0x78d9('0x3b')],{'$or':_[_0x78d9('0x2b')](_0xcbb803,function(_0x2cc4eb){if(_0x2cc4eb[_0x78d9('0x2f')]!=='VIRTUAL'){var _0x46802d={};_0x46802d[_0x2cc4eb[_0x78d9('0x28')]]={'$like':'%'+_0x59b9d2[_0x78d9('0x32')][_0x78d9('0x3e')]+'%'};return _0x46802d;}})});}_0x55617c=_[_0x78d9('0x3d')]({},_0x55617c,_0x59b9d2['options']);var _0x283e35={'where':_0x55617c[_0x78d9('0x3b')]};return db[_0x78d9('0x2c')][_0x78d9('0x1f')](_0x283e35)['then'](function(_0x30abd4){_0x1e4f67[_0x78d9('0x1f')]=_0x30abd4;if(_0x59b9d2[_0x78d9('0x32')][_0x78d9('0x3f')]){_0x55617c[_0x78d9('0x40')]=[{'all':!![]}];}return db[_0x78d9('0x2c')][_0x78d9('0x41')](_0x55617c);})[_0x78d9('0x26')](function(_0x403d36){_0x1e4f67['rows']=_0x403d36;return _0x1e4f67;})[_0x78d9('0x26')](respondWithFilteredResult(_0x47f189,_0x55617c))[_0x78d9('0x42')](handleError(_0x47f189,null));};exports[_0x78d9('0x43')]=function(_0xc4e054,_0x2ddb1e){var _0x2d4c80={'raw':![],'where':{'id':_0xc4e054[_0x78d9('0x44')]['id']}},_0x33649b={};_0x33649b[_0x78d9('0x31')]=_[_0x78d9('0x45')](db[_0x78d9('0x2c')]['rawAttributes']);_0x33649b['query']=_[_0x78d9('0x45')](_0xc4e054[_0x78d9('0x32')]);_0x33649b['filters']=_[_0x78d9('0x34')](_0x33649b[_0x78d9('0x31')],_0x33649b[_0x78d9('0x32')]);_0x2d4c80[_0x78d9('0x35')]=_[_0x78d9('0x34')](_0x33649b[_0x78d9('0x31')],qs[_0x78d9('0x36')](_0xc4e054[_0x78d9('0x32')][_0x78d9('0x36')]));_0x2d4c80[_0x78d9('0x35')]=_0x2d4c80['attributes'][_0x78d9('0x37')]?_0x2d4c80[_0x78d9('0x35')]:_0x33649b[_0x78d9('0x31')];if(_0xc4e054[_0x78d9('0x32')][_0x78d9('0x3f')]){_0x2d4c80['include']=[{'all':!![]}];}_0x2d4c80=_['merge']({},_0x2d4c80,_0xc4e054[_0x78d9('0x46')]);return db[_0x78d9('0x2c')]['find'](_0x2d4c80)['then'](handleEntityNotFound(_0x2ddb1e,null))[_0x78d9('0x26')](respondWithResult(_0x2ddb1e,null))['catch'](handleError(_0x2ddb1e,null));};exports[_0x78d9('0x47')]=function(_0x62dd38,_0x285211){return db[_0x78d9('0x2c')][_0x78d9('0x47')](_0x62dd38[_0x78d9('0x48')],{})[_0x78d9('0x26')](respondWithResult(_0x285211,0xc9))[_0x78d9('0x42')](handleError(_0x285211,null));};exports[_0x78d9('0x25')]=function(_0x3cec0a,_0xfeee4a){if(_0x3cec0a['body']['id']){delete _0x3cec0a[_0x78d9('0x48')]['id'];}return db['Dynamics365Account'][_0x78d9('0x49')]({'where':{'id':_0x3cec0a[_0x78d9('0x44')]['id']}})[_0x78d9('0x26')](handleEntityNotFound(_0xfeee4a,null))[_0x78d9('0x26')](saveUpdates(_0x3cec0a['body'],null))[_0x78d9('0x26')](respondWithResult(_0xfeee4a,null))['catch'](handleError(_0xfeee4a,null));};exports['destroy']=function(_0x579c3b,_0x9bba1){return db[_0x78d9('0x2c')][_0x78d9('0x49')]({'where':{'id':_0x579c3b[_0x78d9('0x44')]['id']}})[_0x78d9('0x26')](handleEntityNotFound(_0x9bba1,null))['then'](removeEntity(_0x9bba1,null))[_0x78d9('0x42')](handleError(_0x9bba1,null));};exports['getConfigurations']=function(_0x351d4a,_0x106652,_0x3d8e0d){var _0x30766e={};var _0x540854={};var _0x57a741;var _0x3e6076;return db[_0x78d9('0x2c')][_0x78d9('0x4a')]({'where':{'id':_0x351d4a[_0x78d9('0x44')]['id']}})[_0x78d9('0x26')](handleEntityNotFound(_0x106652,null))[_0x78d9('0x26')](function(_0x28bb8c){if(_0x28bb8c){_0x57a741=_0x28bb8c;_0x540854[_0x78d9('0x31')]=_[_0x78d9('0x45')](db[_0x78d9('0x4b')][_0x78d9('0x2d')]);_0x540854[_0x78d9('0x32')]=_['keys'](_0x351d4a[_0x78d9('0x32')]);_0x540854[_0x78d9('0x33')]=_[_0x78d9('0x34')](_0x540854[_0x78d9('0x31')],_0x540854['query']);_0x30766e[_0x78d9('0x35')]=_[_0x78d9('0x34')](_0x540854['model'],qs[_0x78d9('0x36')](_0x351d4a['query']['fields']));_0x30766e[_0x78d9('0x35')]=_0x30766e[_0x78d9('0x35')][_0x78d9('0x37')]?_0x30766e['attributes']:_0x540854[_0x78d9('0x31')];_0x30766e[_0x78d9('0x39')]=qs[_0x78d9('0x3a')](_0x351d4a['query'][_0x78d9('0x3a')]);_0x30766e['where']=qs[_0x78d9('0x33')](_[_0x78d9('0x3c')](_0x351d4a[_0x78d9('0x32')],_0x540854['filters']));if(_0x351d4a['query'][_0x78d9('0x3e')]){_0x30766e[_0x78d9('0x3b')]=_[_0x78d9('0x3d')](_0x30766e[_0x78d9('0x3b')],{'$or':_['map'](_0x30766e['attributes'],function(_0x2503a2){var _0xe55fe={};_0xe55fe[_0x2503a2]={'$like':'%'+_0x351d4a[_0x78d9('0x32')]['filter']+'%'};return _0xe55fe;})});}_0x30766e=_['merge']({},_0x30766e,_0x351d4a[_0x78d9('0x46')]);return _0x57a741[_0x78d9('0x4c')](_0x30766e);}})[_0x78d9('0x26')](function(_0x3086f1){if(_0x3086f1){_0x3e6076=_0x3086f1[_0x78d9('0x37')];if(!_0x351d4a['query'][_0x78d9('0x4d')](_0x78d9('0x38'))){_0x30766e['limit']=qs[_0x78d9('0x1e')](_0x351d4a[_0x78d9('0x32')][_0x78d9('0x1e')]);_0x30766e[_0x78d9('0x1c')]=qs[_0x78d9('0x1c')](_0x351d4a[_0x78d9('0x32')][_0x78d9('0x1c')]);}return _0x57a741[_0x78d9('0x4c')](_0x30766e);}})[_0x78d9('0x26')](function(_0x457036){if(_0x457036){return _0x457036?{'count':_0x3e6076,'rows':_0x457036}:null;}})[_0x78d9('0x26')](respondWithResult(_0x106652,null))[_0x78d9('0x42')](handleError(_0x106652,null));};exports[_0x78d9('0x4e')]=function(_0x253f81,_0x4e0f9a,_0x28f856){if(_0x253f81[_0x78d9('0x48')]['id']){delete _0x253f81[_0x78d9('0x48')]['id'];}return db[_0x78d9('0x2c')][_0x78d9('0x4a')]({'where':{'id':_0x253f81['params']['id']}})[_0x78d9('0x26')](handleEntityNotFound(_0x4e0f9a,null))[_0x78d9('0x26')](function(_0x4c7ecb){if(_0x4c7ecb){_0x253f81[_0x78d9('0x48')][_0x78d9('0x4f')]=_0x4c7ecb['id'];_0x253f81[_0x78d9('0x48')][_0x78d9('0x50')]=integrations['getSubjects'](_0x253f81[_0x78d9('0x48')]['channel'],_0x253f81[_0x78d9('0x48')][_0x78d9('0x2f')]);_0x253f81[_0x78d9('0x48')][_0x78d9('0x51')]=integrations[_0x78d9('0x52')](_0x253f81[_0x78d9('0x48')][_0x78d9('0x53')],_0x253f81[_0x78d9('0x48')]['type']);return db['Dynamics365Configuration'][_0x78d9('0x47')](_0x253f81['body'],{'include':[{'model':db[_0x78d9('0x54')],'as':'Subjects'},{'model':db[_0x78d9('0x54')],'as':_0x78d9('0x51')}]});}return null;})['then'](respondWithResult(_0x4e0f9a,null))[_0x78d9('0x42')](handleError(_0x4e0f9a,null));};exports[_0x78d9('0x55')]=function(_0x5861b8,_0x5b085b,_0x2aa82b){var _0x18e3d9=_0x5861b8['query'][_0x78d9('0x56')];var _0x46b996=_0x18e3d9===_0x78d9('0x57')?_0x78d9('0x58'):'PhoneCall';var _0x7b79f9='';var _0xbf6eee='';var _0x63a23a='';var _0x1c92ef='';var _0x2252b2='';var _0x1522c5='';var _0x3f33a3='';var _0x1513ab='';var _0x2b6014=['title','description',_0x78d9('0x59'),_0x78d9('0x5a'),_0x78d9('0x5b'),_0x78d9('0x5c'),_0x78d9('0x5d'),_0x78d9('0x5e'),_0x78d9('0x5f'),'phonecall_activity_parties'];var _0x1692da=[_0x78d9('0x60'),_0x78d9('0x61'),_0x78d9('0x62'),_0x78d9('0x63'),_0x78d9('0x64'),_0x78d9('0x65'),_0x78d9('0x66'),_0x78d9('0x67'),'createdbyexternalpartyname',_0x78d9('0x68'),'createdbyname',_0x78d9('0x69'),'createdon','createdonbehalfbyname',_0x78d9('0x6a'),_0x78d9('0x6b'),_0x78d9('0x6c'),_0x78d9('0x6d'),_0x78d9('0x6e'),'entitlementidname',_0x78d9('0x6f'),'entityimage_url',_0x78d9('0x70'),'exchangerate',_0x78d9('0x71'),'followupby',_0x78d9('0x72'),_0x78d9('0x73'),'kbarticleidname','lastonholdtime',_0x78d9('0x74'),_0x78d9('0x75'),_0x78d9('0x76'),_0x78d9('0x77'),'modifiedbyyominame','modifiedon','modifiedonbehalfbyname',_0x78d9('0x78'),_0x78d9('0x79'),_0x78d9('0x7a'),_0x78d9('0x7b'),'onholdtime',_0x78d9('0x7c'),'owneridname','owneridtype',_0x78d9('0x7d'),_0x78d9('0x7e'),_0x78d9('0x7f'),_0x78d9('0x80'),_0x78d9('0x81'),_0x78d9('0x82'),_0x78d9('0x83'),_0x78d9('0x84'),_0x78d9('0x85'),_0x78d9('0x86'),_0x78d9('0x87'),_0x78d9('0x88'),_0x78d9('0x89'),_0x78d9('0x8a'),_0x78d9('0x8b'),_0x78d9('0x8c'),_0x78d9('0x8d'),_0x78d9('0x8e'),_0x78d9('0x8f'),_0x78d9('0x90'),_0x78d9('0x91'),'transactioncurrencyidname',_0x78d9('0x92'),_0x78d9('0x93'),_0x78d9('0x94')];var _0x14eb18=_0x2b6014[_0x78d9('0x95')](_0x1692da);return db[_0x78d9('0x2c')]['findOne']({'where':{'id':_0x5861b8[_0x78d9('0x44')]['id']},'attributes':['id',_0x78d9('0x96'),'password','remoteUri',_0x78d9('0x97'),_0x78d9('0x98'),_0x78d9('0x99')]})[_0x78d9('0x26')](handleEntityNotFound(_0x5b085b,null))['then'](function(_0x83efd1){if(_0x83efd1){_0x1513ab=_0x83efd1['remoteUri'];var _0x378a83=_0x1513ab[_0x78d9('0x9a')](-0x1);if(_0x378a83==='/'){_0x1513ab=_0x1513ab[_0x78d9('0x9b')](0x0,_0x1513ab[_0x78d9('0x9c')](_0x378a83));}_0x3f33a3=util[_0x78d9('0x9d')]('%s/api/data/v9.0/',_0x1513ab);var _0x20438b={'method':_0x78d9('0x9e'),'uri':'https://login.microsoftonline.com/'+_0x83efd1[_0x78d9('0x97')]+_0x78d9('0x9f'),'form':{'client_id':_0x83efd1[_0x78d9('0x98')],'resource':_0x1513ab,'username':_0x83efd1['username'],'password':_0x83efd1['password'],'grant_type':'password','client_secret':_0x83efd1[_0x78d9('0x99')]},'json':!![]};return rp(_0x20438b);}})['then'](function(_0x4dffd1){_0x1522c5=_0x4dffd1[_0x78d9('0xa0')];var _0x633137={'method':_0x78d9('0xa1'),'uri':encodeURI(_0x3f33a3+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x46b996+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x1522c5,'If-None-Match':null,'OData-Version':_0x78d9('0xa2')},'json':!![]};return rp(_0x633137);})[_0x78d9('0x26')](function(_0x4fc8a3){var _0xe7d85c=_0x4fc8a3[_0x78d9('0xa3')][0x0];var _0x5bc62f=_0xe7d85c[_0x78d9('0xa4')];var _0x17901e={'method':_0x78d9('0xa1'),'uri':_0x3f33a3+_0x78d9('0xa5')+_0x5bc62f+_0x78d9('0xa6'),'headers':{'Authorization':_0x78d9('0xa7')+_0x1522c5,'If-None-Match':null,'OData-Version':_0x78d9('0xa2')},'json':!![]};return rp(_0x17901e);})[_0x78d9('0x26')](function(_0x200022){_0x7b79f9=_0x200022;_0xbf6eee=_0x7b79f9['Attributes'];_0xbf6eee=_[_0x78d9('0xa8')](_0xbf6eee,function(_0x3126fc){return!_0x14eb18['includes'](_0x3126fc[_0x78d9('0xa9')]);});var _0x3064ec=[];var _0x2a3c40=[];_0xbf6eee[_0x78d9('0xaa')](function(_0x2a0afd){if(_0x2a0afd[_0x78d9('0xab')]){var _0x1bef3e=_0x2a0afd[_0x78d9('0xab')]['substring'](_0x2a0afd[_0x78d9('0xab')]['lastIndexOf']('.')+0x1);if(_0x1bef3e===_0x78d9('0xac')){_0x3064ec[_0x78d9('0xad')](getSelectList(_0x3f33a3,_0x18e3d9,_0x2a3c40,_0x7b79f9[_0x78d9('0xa4')],_0x2a0afd['MetadataId'],_0x1522c5));}}});return Promise[_0x78d9('0xae')](_0x3064ec);})[_0x78d9('0x26')](function(_0x275b4e){_0x63a23a=_0x275b4e[0x0];var _0x2c0bb8=[];var _0x43d91a=[];_0xbf6eee[_0x78d9('0xaa')](function(_0x295d42){if(!_[_0x78d9('0xaf')](_0x295d42[_0x78d9('0xab')])){var _0x12e6da=_0x295d42[_0x78d9('0xab')][_0x78d9('0x9b')](_0x295d42[_0x78d9('0xab')][_0x78d9('0x9c')]('.')+0x1);if(_0x12e6da===_0x78d9('0xb0')){_0x2c0bb8[_0x78d9('0xad')](getBooleanList(_0x3f33a3,_0x18e3d9,_0x43d91a,_0x7b79f9[_0x78d9('0xa4')],_0x295d42[_0x78d9('0xa4')],_0x1522c5));}}});return Promise[_0x78d9('0xae')](_0x2c0bb8);})[_0x78d9('0x26')](function(_0x529af7){_0x1c92ef=_0x529af7[0x0];var _0x558a97=[];var _0x2a0ba8=[];_0xbf6eee[_0x78d9('0xaa')](function(_0x51d692){if(_0x51d692[_0x78d9('0xab')]){var _0x48326b=_0x51d692[_0x78d9('0xab')][_0x78d9('0x9b')](_0x51d692[_0x78d9('0xab')][_0x78d9('0x9c')]('.')+0x1);if(_0x48326b===_0x78d9('0xb1')||_0x48326b==='DoubleAttributeMetadata'||_0x48326b===_0x78d9('0xb2')||_0x48326b===_0x78d9('0xb3')||_0x48326b==='MemoAttributeMetadata'||_0x48326b===_0x78d9('0xb4')||_0x48326b===_0x78d9('0xb5')||_0x48326b===_0x78d9('0xb6')||_0x48326b==='StateAttributeMetadata'||_0x48326b===_0x78d9('0xb7')){_0x558a97[_0x78d9('0xad')](getInputList(_0x3f33a3,_0x18e3d9,_0x48326b,_0x2a0ba8,_0x7b79f9[_0x78d9('0xa4')],_0x51d692['MetadataId'],_0x1522c5));}}});return Promise[_0x78d9('0xae')](_0x558a97);})[_0x78d9('0x26')](function(_0x1740a0){_0x2252b2=_0x1740a0[0x0];var _0x5e6da2=_0x63a23a['concat'](_0x1c92ef)[_0x78d9('0x95')](_0x2252b2);var _0x4112e3={'count':_0x5e6da2[_0x78d9('0x37')],'rows':_0x5e6da2};return _0x4112e3;})[_0x78d9('0x26')](respondWithResult(_0x5b085b,null))[_0x78d9('0x42')](function(_0x132173){var _0x4d76c9=_0x5861b8[_0x78d9('0x32')][_0x78d9('0xb8')]?0x1f4:_0x132173['statusCode']||0x1f4;logger['error'](_0x132173['stack']);delete _0x132173['name'];if(_0x4d76c9===0x191){_0x4d76c9=0x190;}_0x5b085b[_0x78d9('0x19')](_0x4d76c9)[_0x78d9('0x29')](_0x5861b8[_0x78d9('0x32')][_0x78d9('0xb8')]?{'message':_0x78d9('0xb9'),'statusCode':_0x132173[_0x78d9('0xba')]}:_0x132173);});};function getSelectList(_0x15d63a,_0x233999,_0x526f31,_0x1b4a70,_0x5b56aa,_0x424aa8){var _0x4356d3={'method':_0x78d9('0xa1'),'uri':_0x15d63a+_0x78d9('0xa5')+_0x1b4a70+')/Attributes('+_0x5b56aa+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x78d9('0xbb'),'headers':{'Authorization':_0x78d9('0xa7')+_0x424aa8,'If-None-Match':null,'OData-Version':_0x78d9('0xa2')},'json':!![]};return rp(_0x4356d3)['then'](function(_0x268d51){var _0x43e882=[];var _0x202b34=_0x268d51[_0x78d9('0xbc')][_0x78d9('0xbd')];_0x202b34[_0x78d9('0xaa')](function(_0x3c4df0){_0x43e882[_0x78d9('0xad')]({'name':_0x3c4df0[_0x78d9('0xbe')][_0x78d9('0xbf')][_0x78d9('0xbe')],'value':String(_0x3c4df0[_0x78d9('0xc0')])});});var _0xab6210={'id':_0x233999+'_'+_0x268d51[_0x78d9('0xa9')],'name':_0x268d51['DisplayName']['UserLocalizedLabel'][_0x78d9('0xbe')],'custom':![],'options':_0x43e882};_0x526f31[_0x78d9('0xad')](_0xab6210);return _0x526f31;});}function getBooleanList(_0x56df6d,_0x54927f,_0x433384,_0x26e1a0,_0x329d0f,_0x5c2445){var _0x522138={'method':_0x78d9('0xa1'),'uri':_0x56df6d+'EntityDefinitions('+_0x26e1a0+_0x78d9('0xc1')+_0x329d0f+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x78d9('0xa7')+_0x5c2445,'If-None-Match':null,'OData-Version':_0x78d9('0xa2')},'json':!![]};return rp(_0x522138)[_0x78d9('0x26')](function(_0x178c87){var _0x432305=[];_0x432305[_0x78d9('0xad')]({'name':_0x178c87[_0x78d9('0xbc')][_0x78d9('0xc2')][_0x78d9('0xbe')][_0x78d9('0xbf')][_0x78d9('0xbe')],'value':_0x78d9('0xc3')},{'name':_0x178c87[_0x78d9('0xbc')]['FalseOption'][_0x78d9('0xbe')]['UserLocalizedLabel']['Label'],'value':'false'});var _0x394826={'id':_0x54927f+'_'+_0x178c87[_0x78d9('0xa9')],'name':_0x178c87[_0x78d9('0xc4')]['UserLocalizedLabel'][_0x78d9('0xbe')],'custom':![],'options':_0x432305};_0x433384[_0x78d9('0xad')](_0x394826);return _0x433384;});}function getInputList(_0x221259,_0x4189dc,_0x5051c7,_0x35e16a,_0x3b43b6,_0x257ef9,_0x5a7b39){var _0x36f6e5={'method':_0x78d9('0xa1'),'uri':_0x221259+'EntityDefinitions('+_0x3b43b6+_0x78d9('0xc1')+_0x257ef9+')/Microsoft.Dynamics.CRM.'+_0x5051c7+_0x78d9('0xc5'),'headers':{'Authorization':_0x78d9('0xa7')+_0x5a7b39,'If-None-Match':null,'OData-Version':_0x78d9('0xa2')},'json':!![]};return rp(_0x36f6e5)[_0x78d9('0x26')](function(_0x5490c0){var _0x29f0b9={'id':_0x4189dc+'_'+_0x5490c0['LogicalName'],'name':_0x5490c0[_0x78d9('0xc4')][_0x78d9('0xbf')]?_0x5490c0[_0x78d9('0xc4')][_0x78d9('0xbf')][_0x78d9('0xbe')]:_0x5490c0[_0x78d9('0xa9')],'custom':![],'options':[]};_0x35e16a[_0x78d9('0xad')](_0x29f0b9);return _0x35e16a;});} \ No newline at end of file +var _0xc906=['MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','Wrong\x20credentials','statusCode',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','query','intersection','fields','attributes','model','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','filters','length','include','find','create','update','body','findOne','Dynamics365Configuration','getConfigurations','getDescriptions','Dynamics365Field','Subjects','Descriptions','ticketType','incident','PhoneCall','description','customerid','ownerid','caseorigincode','subject','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridyominame','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','masteridname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','utcconversiontimezonecode','versionnumber','concat','password','remoteUri','tenantId','clientId','clientSecret','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','username','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','@odata.type','PicklistAttributeMetadata','push','all','forEach','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata'];(function(_0xa0d569,_0x5644c6){var _0x4c96f0=function(_0x547d5f){while(--_0x547d5f){_0xa0d569['push'](_0xa0d569['shift']());}};_0x4c96f0(++_0x5644c6);}(_0xc906,0x1ad));var _0x6c90=function(_0x38c7fe,_0x2d529d){_0x38c7fe=_0x38c7fe-0x0;var _0x3d738a=_0xc906[_0x38c7fe];return _0x3d738a;};'use strict';var emlformat=require(_0x6c90('0x0'));var rimraf=require(_0x6c90('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6c90('0x2'));var rp=require(_0x6c90('0x3'));var moment=require(_0x6c90('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6c90('0x5'));var util=require(_0x6c90('0x6'));var path=require(_0x6c90('0x7'));var sox=require(_0x6c90('0x8'));var csv=require(_0x6c90('0x9'));var ejs=require(_0x6c90('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6c90('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6c90('0xc'));var toCsv=require(_0x6c90('0x9'));var querystring=require(_0x6c90('0xd'));var Papa=require(_0x6c90('0xe'));var Redis=require(_0x6c90('0xf'));var authService=require(_0x6c90('0x10'));var qs=require(_0x6c90('0x11'));var as=require(_0x6c90('0x12'));var hardwareService=require(_0x6c90('0x13'));var logger=require(_0x6c90('0x14'))(_0x6c90('0x15'));var utils=require(_0x6c90('0x16'));var config=require(_0x6c90('0x17'));var licenseUtil=require(_0x6c90('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x447fb3,_0x2d7755){_0x2d7755=_0x2d7755||0xcc;return function(_0xe093a5){if(_0xe093a5){return _0x447fb3[_0x6c90('0x19')](_0x2d7755);}return _0x447fb3[_0x6c90('0x1a')](_0x2d7755)[_0x6c90('0x1b')]();};}function respondWithResult(_0x117da5,_0x30f64a){_0x30f64a=_0x30f64a||0xc8;return function(_0x428232){if(_0x428232){return _0x117da5[_0x6c90('0x1a')](_0x30f64a)['json'](_0x428232);}};}function respondWithFilteredResult(_0x2bb817,_0x226917){return function(_0x273ed1){if(_0x273ed1){var _0x1c6143=typeof _0x226917['offset']===_0x6c90('0x1c')&&typeof _0x226917[_0x6c90('0x1d')]==='undefined';var _0x1cfb2c=_0x273ed1[_0x6c90('0x1e')];var _0x1701d5=_0x1c6143?0x0:_0x226917[_0x6c90('0x1f')];var _0x222ea3=_0x1c6143?_0x273ed1[_0x6c90('0x1e')]:_0x226917['offset']+_0x226917[_0x6c90('0x1d')];var _0x326767;if(_0x222ea3>=_0x1cfb2c){_0x222ea3=_0x1cfb2c;_0x326767=0xc8;}else{_0x326767=0xce;}_0x2bb817[_0x6c90('0x1a')](_0x326767);return _0x2bb817['set']('Content-Range',_0x1701d5+'-'+_0x222ea3+'/'+_0x1cfb2c)[_0x6c90('0x20')](_0x273ed1);}return null;};}function patchUpdates(_0x6f0a46){return function(_0x4cc5d0){try{jsonpatch[_0x6c90('0x21')](_0x4cc5d0,_0x6f0a46,!![]);}catch(_0x522692){return BPromise[_0x6c90('0x22')](_0x522692);}return _0x4cc5d0[_0x6c90('0x23')]();};}function saveUpdates(_0x4f8818,_0x137285){return function(_0x5f0efe){if(_0x5f0efe){return _0x5f0efe['update'](_0x4f8818)[_0x6c90('0x24')](function(_0x59ba0e){return _0x59ba0e;});}return null;};}function removeEntity(_0x26139e,_0x55ddfc){return function(_0xc3f320){if(_0xc3f320){return _0xc3f320[_0x6c90('0x25')]()[_0x6c90('0x24')](function(){_0x26139e[_0x6c90('0x1a')](0xcc)[_0x6c90('0x1b')]();});}};}function handleEntityNotFound(_0x4e1976,_0x3ad642){return function(_0x3c2744){if(!_0x3c2744){_0x4e1976['sendStatus'](0x194);}return _0x3c2744;};}function handleError(_0x2a04f6,_0x5aaf2f){_0x5aaf2f=_0x5aaf2f||0x1f4;return function(_0x315c78){logger[_0x6c90('0x26')](_0x315c78[_0x6c90('0x27')]);if(_0x315c78[_0x6c90('0x28')]){delete _0x315c78[_0x6c90('0x28')];}_0x2a04f6['status'](_0x5aaf2f)[_0x6c90('0x29')](_0x315c78);};}exports[_0x6c90('0x2a')]=function(_0x1d1cc6,_0x4cffd0){var _0x17dfbd={},_0xb029e4={},_0x18fb32={'count':0x0,'rows':[]};var _0xfe451c=_[_0x6c90('0x2b')](db[_0x6c90('0x2c')][_0x6c90('0x2d')],function(_0x4a010e){return{'name':_0x4a010e[_0x6c90('0x2e')],'type':_0x4a010e[_0x6c90('0x2f')][_0x6c90('0x30')]};});_0xb029e4['model']=_[_0x6c90('0x2b')](_0xfe451c,_0x6c90('0x28'));_0xb029e4[_0x6c90('0x31')]=_['keys'](_0x1d1cc6[_0x6c90('0x31')]);_0xb029e4['filters']=_[_0x6c90('0x32')](_0xb029e4['model'],_0xb029e4[_0x6c90('0x31')]);_0x17dfbd['attributes']=_[_0x6c90('0x32')](_0xb029e4['model'],qs[_0x6c90('0x33')](_0x1d1cc6[_0x6c90('0x31')]['fields']));_0x17dfbd['attributes']=_0x17dfbd[_0x6c90('0x34')]['length']?_0x17dfbd[_0x6c90('0x34')]:_0xb029e4[_0x6c90('0x35')];if(!_0x1d1cc6[_0x6c90('0x31')][_0x6c90('0x36')](_0x6c90('0x37'))){_0x17dfbd[_0x6c90('0x1d')]=qs[_0x6c90('0x1d')](_0x1d1cc6['query'][_0x6c90('0x1d')]);_0x17dfbd[_0x6c90('0x1f')]=qs['offset'](_0x1d1cc6[_0x6c90('0x31')][_0x6c90('0x1f')]);}_0x17dfbd[_0x6c90('0x38')]=qs[_0x6c90('0x39')](_0x1d1cc6[_0x6c90('0x31')][_0x6c90('0x39')]);_0x17dfbd['where']=qs['filters'](_[_0x6c90('0x3a')](_0x1d1cc6[_0x6c90('0x31')],_0xb029e4['filters']),_0xfe451c);if(_0x1d1cc6['query'][_0x6c90('0x3b')]){_0x17dfbd[_0x6c90('0x3c')]=_[_0x6c90('0x3d')](_0x17dfbd[_0x6c90('0x3c')],{'$or':_[_0x6c90('0x2b')](_0xfe451c,function(_0x4f3888){if(_0x4f3888['type']!==_0x6c90('0x3e')){var _0x3dec45={};_0x3dec45[_0x4f3888[_0x6c90('0x28')]]={'$like':'%'+_0x1d1cc6['query'][_0x6c90('0x3b')]+'%'};return _0x3dec45;}})});}_0x17dfbd=_[_0x6c90('0x3d')]({},_0x17dfbd,_0x1d1cc6[_0x6c90('0x3f')]);var _0x444147={'where':_0x17dfbd[_0x6c90('0x3c')]};return db[_0x6c90('0x2c')]['count'](_0x444147)[_0x6c90('0x24')](function(_0xc94d86){_0x18fb32[_0x6c90('0x1e')]=_0xc94d86;if(_0x1d1cc6['query'][_0x6c90('0x40')]){_0x17dfbd['include']=[{'all':!![]}];}return db['Dynamics365Account'][_0x6c90('0x41')](_0x17dfbd);})[_0x6c90('0x24')](function(_0xcb091b){_0x18fb32[_0x6c90('0x42')]=_0xcb091b;return _0x18fb32;})[_0x6c90('0x24')](respondWithFilteredResult(_0x4cffd0,_0x17dfbd))[_0x6c90('0x43')](handleError(_0x4cffd0,null));};exports[_0x6c90('0x44')]=function(_0x4b97fa,_0x160610){var _0x3b4143={'raw':![],'where':{'id':_0x4b97fa[_0x6c90('0x45')]['id']}},_0x8d1ef={};_0x8d1ef[_0x6c90('0x35')]=_[_0x6c90('0x46')](db[_0x6c90('0x2c')]['rawAttributes']);_0x8d1ef[_0x6c90('0x31')]=_[_0x6c90('0x46')](_0x4b97fa[_0x6c90('0x31')]);_0x8d1ef[_0x6c90('0x47')]=_[_0x6c90('0x32')](_0x8d1ef['model'],_0x8d1ef[_0x6c90('0x31')]);_0x3b4143['attributes']=_['intersection'](_0x8d1ef[_0x6c90('0x35')],qs[_0x6c90('0x33')](_0x4b97fa['query']['fields']));_0x3b4143[_0x6c90('0x34')]=_0x3b4143[_0x6c90('0x34')][_0x6c90('0x48')]?_0x3b4143[_0x6c90('0x34')]:_0x8d1ef[_0x6c90('0x35')];if(_0x4b97fa['query']['includeAll']){_0x3b4143[_0x6c90('0x49')]=[{'all':!![]}];}_0x3b4143=_[_0x6c90('0x3d')]({},_0x3b4143,_0x4b97fa[_0x6c90('0x3f')]);return db['Dynamics365Account'][_0x6c90('0x4a')](_0x3b4143)[_0x6c90('0x24')](handleEntityNotFound(_0x160610,null))[_0x6c90('0x24')](respondWithResult(_0x160610,null))[_0x6c90('0x43')](handleError(_0x160610,null));};exports[_0x6c90('0x4b')]=function(_0x30b150,_0x3a56a0){return db[_0x6c90('0x2c')]['create'](_0x30b150['body'],{})[_0x6c90('0x24')](respondWithResult(_0x3a56a0,0xc9))[_0x6c90('0x43')](handleError(_0x3a56a0,null));};exports[_0x6c90('0x4c')]=function(_0x725da5,_0x573656){if(_0x725da5[_0x6c90('0x4d')]['id']){delete _0x725da5[_0x6c90('0x4d')]['id'];}return db[_0x6c90('0x2c')][_0x6c90('0x4a')]({'where':{'id':_0x725da5['params']['id']}})[_0x6c90('0x24')](handleEntityNotFound(_0x573656,null))['then'](saveUpdates(_0x725da5[_0x6c90('0x4d')],null))[_0x6c90('0x24')](respondWithResult(_0x573656,null))['catch'](handleError(_0x573656,null));};exports[_0x6c90('0x25')]=function(_0x47be6f,_0x3ffc15){return db[_0x6c90('0x2c')]['find']({'where':{'id':_0x47be6f[_0x6c90('0x45')]['id']}})[_0x6c90('0x24')](handleEntityNotFound(_0x3ffc15,null))['then'](removeEntity(_0x3ffc15,null))['catch'](handleError(_0x3ffc15,null));};exports['getConfigurations']=function(_0x3e0232,_0x5ac95b,_0x3a0441){var _0xa922cd={};var _0x2224c5={};var _0x584c77;var _0x7637d1;return db[_0x6c90('0x2c')][_0x6c90('0x4e')]({'where':{'id':_0x3e0232['params']['id']}})[_0x6c90('0x24')](handleEntityNotFound(_0x5ac95b,null))[_0x6c90('0x24')](function(_0x54586d){if(_0x54586d){_0x584c77=_0x54586d;_0x2224c5[_0x6c90('0x35')]=_[_0x6c90('0x46')](db[_0x6c90('0x4f')][_0x6c90('0x2d')]);_0x2224c5['query']=_[_0x6c90('0x46')](_0x3e0232[_0x6c90('0x31')]);_0x2224c5[_0x6c90('0x47')]=_['intersection'](_0x2224c5[_0x6c90('0x35')],_0x2224c5[_0x6c90('0x31')]);_0xa922cd[_0x6c90('0x34')]=_[_0x6c90('0x32')](_0x2224c5[_0x6c90('0x35')],qs[_0x6c90('0x33')](_0x3e0232[_0x6c90('0x31')][_0x6c90('0x33')]));_0xa922cd[_0x6c90('0x34')]=_0xa922cd[_0x6c90('0x34')][_0x6c90('0x48')]?_0xa922cd[_0x6c90('0x34')]:_0x2224c5['model'];_0xa922cd['order']=qs[_0x6c90('0x39')](_0x3e0232['query'][_0x6c90('0x39')]);_0xa922cd[_0x6c90('0x3c')]=qs[_0x6c90('0x47')](_[_0x6c90('0x3a')](_0x3e0232['query'],_0x2224c5[_0x6c90('0x47')]));if(_0x3e0232[_0x6c90('0x31')][_0x6c90('0x3b')]){_0xa922cd[_0x6c90('0x3c')]=_['merge'](_0xa922cd[_0x6c90('0x3c')],{'$or':_['map'](_0xa922cd[_0x6c90('0x34')],function(_0x48ac18){var _0x3c468e={};_0x3c468e[_0x48ac18]={'$like':'%'+_0x3e0232['query'][_0x6c90('0x3b')]+'%'};return _0x3c468e;})});}_0xa922cd=_[_0x6c90('0x3d')]({},_0xa922cd,_0x3e0232['options']);return _0x584c77['getConfigurations'](_0xa922cd);}})[_0x6c90('0x24')](function(_0x4782ce){if(_0x4782ce){_0x7637d1=_0x4782ce[_0x6c90('0x48')];if(!_0x3e0232[_0x6c90('0x31')][_0x6c90('0x36')]('nolimit')){_0xa922cd[_0x6c90('0x1d')]=qs[_0x6c90('0x1d')](_0x3e0232[_0x6c90('0x31')][_0x6c90('0x1d')]);_0xa922cd['offset']=qs[_0x6c90('0x1f')](_0x3e0232[_0x6c90('0x31')][_0x6c90('0x1f')]);}return _0x584c77[_0x6c90('0x50')](_0xa922cd);}})[_0x6c90('0x24')](function(_0x178cb5){if(_0x178cb5){return _0x178cb5?{'count':_0x7637d1,'rows':_0x178cb5}:null;}})[_0x6c90('0x24')](respondWithResult(_0x5ac95b,null))[_0x6c90('0x43')](handleError(_0x5ac95b,null));};exports['addConfiguration']=function(_0x1d5f9e,_0x868918,_0x363937){if(_0x1d5f9e['body']['id']){delete _0x1d5f9e['body']['id'];}return db[_0x6c90('0x2c')]['findOne']({'where':{'id':_0x1d5f9e['params']['id']}})['then'](handleEntityNotFound(_0x868918,null))[_0x6c90('0x24')](function(_0x57bc38){if(_0x57bc38){_0x1d5f9e[_0x6c90('0x4d')]['AccountId']=_0x57bc38['id'];_0x1d5f9e[_0x6c90('0x4d')]['Subjects']=integrations['getSubjects'](_0x1d5f9e[_0x6c90('0x4d')]['channel'],_0x1d5f9e[_0x6c90('0x4d')][_0x6c90('0x2f')]);_0x1d5f9e['body']['Descriptions']=integrations[_0x6c90('0x51')](_0x1d5f9e[_0x6c90('0x4d')]['channel'],_0x1d5f9e[_0x6c90('0x4d')][_0x6c90('0x2f')]);return db[_0x6c90('0x4f')][_0x6c90('0x4b')](_0x1d5f9e['body'],{'include':[{'model':db[_0x6c90('0x52')],'as':_0x6c90('0x53')},{'model':db['Dynamics365Field'],'as':_0x6c90('0x54')}]});}return null;})[_0x6c90('0x24')](respondWithResult(_0x868918,null))[_0x6c90('0x43')](handleError(_0x868918,null));};exports['getFields']=function(_0x14da42,_0x2f380c,_0x71921a){var _0x290e4d=_0x14da42[_0x6c90('0x31')][_0x6c90('0x55')];var _0x19003d=_0x290e4d===_0x6c90('0x56')?'Incident':_0x6c90('0x57');var _0x2f1588='';var _0x2993b2='';var _0x1102bb='';var _0x3010a2='';var _0x53d81d='';var _0x3ccf59='';var _0x13b1dd='';var _0x219499='';var _0x12ba56=['title',_0x6c90('0x58'),_0x6c90('0x59'),_0x6c90('0x5a'),_0x6c90('0x5b'),_0x6c90('0x5c'),'phonenumber','regardingobjectid',_0x6c90('0x5d'),_0x6c90('0x5e')];var _0x4599c6=[_0x6c90('0x5f'),_0x6c90('0x60'),_0x6c90('0x61'),_0x6c90('0x62'),_0x6c90('0x63'),_0x6c90('0x64'),_0x6c90('0x65'),_0x6c90('0x66'),_0x6c90('0x67'),'createdbyexternalpartyyominame',_0x6c90('0x68'),_0x6c90('0x69'),_0x6c90('0x6a'),_0x6c90('0x6b'),'createdonbehalfbyyominame','customeridname','customeridtype',_0x6c90('0x6c'),'emailaddress','entitlementidname',_0x6c90('0x6d'),'entityimage_url',_0x6c90('0x6e'),_0x6c90('0x6f'),_0x6c90('0x70'),_0x6c90('0x71'),_0x6c90('0x72'),_0x6c90('0x73'),'kbarticleidname','lastonholdtime',_0x6c90('0x74'),'modifiedbyexternalpartyname',_0x6c90('0x75'),'modifiedbyname',_0x6c90('0x76'),_0x6c90('0x77'),_0x6c90('0x78'),'modifiedonbehalfbyyominame',_0x6c90('0x79'),_0x6c90('0x7a'),_0x6c90('0x7b'),'onholdtime',_0x6c90('0x7c'),_0x6c90('0x7d'),_0x6c90('0x7e'),_0x6c90('0x7f'),_0x6c90('0x80'),'primarycontactidname',_0x6c90('0x81'),_0x6c90('0x82'),_0x6c90('0x83'),_0x6c90('0x84'),_0x6c90('0x85'),_0x6c90('0x86'),'responseby',_0x6c90('0x87'),_0x6c90('0x88'),_0x6c90('0x89'),'slainvokedidname',_0x6c90('0x8a'),_0x6c90('0x8b'),_0x6c90('0x8c'),_0x6c90('0x8d'),_0x6c90('0x8e'),_0x6c90('0x8f'),_0x6c90('0x90'),'transactioncurrencyidname','traversedpath',_0x6c90('0x91'),_0x6c90('0x92')];var _0x14117e=_0x12ba56[_0x6c90('0x93')](_0x4599c6);return db[_0x6c90('0x2c')][_0x6c90('0x4e')]({'where':{'id':_0x14da42['params']['id']},'attributes':['id','username',_0x6c90('0x94'),_0x6c90('0x95'),_0x6c90('0x96'),_0x6c90('0x97'),_0x6c90('0x98')]})[_0x6c90('0x24')](handleEntityNotFound(_0x2f380c,null))[_0x6c90('0x24')](function(_0x5ccb17){if(_0x5ccb17){_0x219499=_0x5ccb17[_0x6c90('0x95')];var _0x1be8b0=_0x219499[_0x6c90('0x99')](-0x1);if(_0x1be8b0==='/'){_0x219499=_0x219499[_0x6c90('0x9a')](0x0,_0x219499[_0x6c90('0x9b')](_0x1be8b0));}_0x13b1dd=util[_0x6c90('0x9c')](_0x6c90('0x9d'),_0x219499);var _0x4dcfb7={'method':_0x6c90('0x9e'),'uri':_0x6c90('0x9f')+_0x5ccb17[_0x6c90('0x96')]+_0x6c90('0xa0'),'form':{'client_id':_0x5ccb17[_0x6c90('0x97')],'resource':_0x219499,'username':_0x5ccb17[_0x6c90('0xa1')],'password':_0x5ccb17[_0x6c90('0x94')],'grant_type':_0x6c90('0x94'),'client_secret':_0x5ccb17[_0x6c90('0x98')]},'json':!![]};return rp(_0x4dcfb7);}})['then'](function(_0x2f55e8){_0x3ccf59=_0x2f55e8['access_token'];var _0x205680={'method':_0x6c90('0xa2'),'uri':encodeURI(_0x13b1dd+_0x6c90('0xa3')+_0x19003d+'\x27'),'headers':{'Authorization':_0x6c90('0xa4')+_0x3ccf59,'If-None-Match':null,'OData-Version':_0x6c90('0xa5')},'json':!![]};return rp(_0x205680);})['then'](function(_0x478b1f){var _0x4ed34a=_0x478b1f['value'][0x0];var _0x2406c4=_0x4ed34a[_0x6c90('0xa6')];var _0x2df374={'method':_0x6c90('0xa2'),'uri':_0x13b1dd+_0x6c90('0xa7')+_0x2406c4+_0x6c90('0xa8'),'headers':{'Authorization':_0x6c90('0xa4')+_0x3ccf59,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2df374);})['then'](function(_0xa39259){_0x2f1588=_0xa39259;_0x2993b2=_0x2f1588[_0x6c90('0xa9')];_0x2993b2=_[_0x6c90('0xaa')](_0x2993b2,function(_0x34f0c4){return!_0x14117e[_0x6c90('0xab')](_0x34f0c4[_0x6c90('0xac')]);});var _0x481dea=[];var _0x57feeb=[];_0x2993b2['forEach'](function(_0x1837a3){if(_0x1837a3[_0x6c90('0xad')]){var _0x5754ad=_0x1837a3[_0x6c90('0xad')]['substring'](_0x1837a3[_0x6c90('0xad')]['lastIndexOf']('.')+0x1);if(_0x5754ad===_0x6c90('0xae')){_0x481dea[_0x6c90('0xaf')](getSelectList(_0x13b1dd,_0x290e4d,_0x57feeb,_0x2f1588['MetadataId'],_0x1837a3[_0x6c90('0xa6')],_0x3ccf59));}}});return Promise[_0x6c90('0xb0')](_0x481dea);})[_0x6c90('0x24')](function(_0x584c48){_0x1102bb=_0x584c48[0x0];var _0x463183=[];var _0x516a51=[];_0x2993b2[_0x6c90('0xb1')](function(_0x106dc6){if(!_['isNil'](_0x106dc6[_0x6c90('0xad')])){var _0x140f63=_0x106dc6[_0x6c90('0xad')]['substring'](_0x106dc6[_0x6c90('0xad')][_0x6c90('0x9b')]('.')+0x1);if(_0x140f63===_0x6c90('0xb2')){_0x463183[_0x6c90('0xaf')](getBooleanList(_0x13b1dd,_0x290e4d,_0x516a51,_0x2f1588['MetadataId'],_0x106dc6['MetadataId'],_0x3ccf59));}}});return Promise[_0x6c90('0xb0')](_0x463183);})[_0x6c90('0x24')](function(_0x525855){_0x3010a2=_0x525855[0x0];var _0x1c3055=[];var _0x50c3af=[];_0x2993b2[_0x6c90('0xb1')](function(_0x48467e){if(_0x48467e[_0x6c90('0xad')]){var _0x23b47c=_0x48467e['@odata.type'][_0x6c90('0x9a')](_0x48467e[_0x6c90('0xad')]['lastIndexOf']('.')+0x1);if(_0x23b47c===_0x6c90('0xb3')||_0x23b47c===_0x6c90('0xb4')||_0x23b47c===_0x6c90('0xb5')||_0x23b47c===_0x6c90('0xb6')||_0x23b47c===_0x6c90('0xb7')||_0x23b47c===_0x6c90('0xb8')||_0x23b47c===_0x6c90('0xb9')||_0x23b47c===_0x6c90('0xba')||_0x23b47c===_0x6c90('0xbb')||_0x23b47c===_0x6c90('0xbc')){_0x1c3055[_0x6c90('0xaf')](getInputList(_0x13b1dd,_0x290e4d,_0x23b47c,_0x50c3af,_0x2f1588['MetadataId'],_0x48467e[_0x6c90('0xa6')],_0x3ccf59));}}});return Promise[_0x6c90('0xb0')](_0x1c3055);})[_0x6c90('0x24')](function(_0x32695c){_0x53d81d=_0x32695c[0x0];var _0x295766=_0x1102bb[_0x6c90('0x93')](_0x3010a2)[_0x6c90('0x93')](_0x53d81d);var _0x2d7f6b={'count':_0x295766[_0x6c90('0x48')],'rows':_0x295766};return _0x2d7f6b;})[_0x6c90('0x24')](respondWithResult(_0x2f380c,null))[_0x6c90('0x43')](function(_0x176189){var _0x5c1d75=_0x14da42[_0x6c90('0x31')][_0x6c90('0xbd')]?0x1f4:_0x176189['statusCode']||0x1f4;logger['error'](_0x176189['stack']);delete _0x176189[_0x6c90('0x28')];if(_0x5c1d75===0x191){_0x5c1d75=0x190;}_0x2f380c[_0x6c90('0x1a')](_0x5c1d75)['send'](_0x14da42[_0x6c90('0x31')][_0x6c90('0xbd')]?{'message':_0x6c90('0xbe'),'statusCode':_0x176189[_0x6c90('0xbf')]}:_0x176189);});};function getSelectList(_0xab7ae0,_0x4a3f7b,_0x34d996,_0xde4411,_0x4d690c,_0x219e85){var _0x385e5c={'method':'GET','uri':_0xab7ae0+_0x6c90('0xa7')+_0xde4411+_0x6c90('0xc0')+_0x4d690c+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x6c90('0xc1'),'headers':{'Authorization':'Bearer\x20'+_0x219e85,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x385e5c)['then'](function(_0x26ddac){var _0x32bebf=[];var _0xc746ab=_0x26ddac['OptionSet']['Options'];_0xc746ab['forEach'](function(_0x21a2a0){_0x32bebf[_0x6c90('0xaf')]({'name':_0x21a2a0[_0x6c90('0xc2')][_0x6c90('0xc3')][_0x6c90('0xc2')],'value':String(_0x21a2a0[_0x6c90('0xc4')])});});var _0x40160e={'id':_0x4a3f7b+'_'+_0x26ddac[_0x6c90('0xac')],'name':_0x26ddac[_0x6c90('0xc5')]['UserLocalizedLabel'][_0x6c90('0xc2')],'custom':![],'options':_0x32bebf};_0x34d996[_0x6c90('0xaf')](_0x40160e);return _0x34d996;});}function getBooleanList(_0x53b3e7,_0x3d774e,_0x725cdc,_0x58c461,_0x18670e,_0x4f5e0e){var _0x1359a1={'method':_0x6c90('0xa2'),'uri':_0x53b3e7+_0x6c90('0xa7')+_0x58c461+_0x6c90('0xc0')+_0x18670e+_0x6c90('0xc6'),'headers':{'Authorization':_0x6c90('0xa4')+_0x4f5e0e,'If-None-Match':null,'OData-Version':_0x6c90('0xa5')},'json':!![]};return rp(_0x1359a1)[_0x6c90('0x24')](function(_0x548f49){var _0x48113d=[];_0x48113d[_0x6c90('0xaf')]({'name':_0x548f49[_0x6c90('0xc7')][_0x6c90('0xc8')][_0x6c90('0xc2')]['UserLocalizedLabel']['Label'],'value':'true'},{'name':_0x548f49[_0x6c90('0xc7')]['FalseOption'][_0x6c90('0xc2')][_0x6c90('0xc3')]['Label'],'value':_0x6c90('0xc9')});var _0x3a48b6={'id':_0x3d774e+'_'+_0x548f49[_0x6c90('0xac')],'name':_0x548f49[_0x6c90('0xc5')][_0x6c90('0xc3')]['Label'],'custom':![],'options':_0x48113d};_0x725cdc[_0x6c90('0xaf')](_0x3a48b6);return _0x725cdc;});}function getInputList(_0x25a946,_0x312085,_0x13a1f1,_0x22dda2,_0x29e5c6,_0x1033f0,_0x2277a9){var _0x4a3d0b={'method':_0x6c90('0xa2'),'uri':_0x25a946+_0x6c90('0xa7')+_0x29e5c6+_0x6c90('0xc0')+_0x1033f0+_0x6c90('0xca')+_0x13a1f1+_0x6c90('0xcb'),'headers':{'Authorization':_0x6c90('0xa4')+_0x2277a9,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4a3d0b)[_0x6c90('0x24')](function(_0x15c29d){var _0x167b79={'id':_0x312085+'_'+_0x15c29d[_0x6c90('0xac')],'name':_0x15c29d['DisplayName']['UserLocalizedLabel']?_0x15c29d['DisplayName'][_0x6c90('0xc3')][_0x6c90('0xc2')]:_0x15c29d['LogicalName'],'custom':![],'options':[]};_0x22dda2[_0x6c90('0xaf')](_0x167b79);return _0x22dda2;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 08ccd1e..5a3799c 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 _0xa9e0=['define','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x1a445a,_0x1ab424){var _0x5822a9=function(_0x4ce042){while(--_0x4ce042){_0x1a445a['push'](_0x1a445a['shift']());}};_0x5822a9(++_0x1ab424);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));var integrations=require(_0x0a9e('0x8'));module['exports']=function(_0x219af0,_0x441e3a){return _0x219af0[_0x0a9e('0x9')]('Dynamics365Account',attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x5086d7,_0x56530e){var _0x3cd289=function(_0x2ae3e1){while(--_0x2ae3e1){_0x5086d7['push'](_0x5086d7['shift']());}};_0x3cd289(++_0x56530e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 3e1afa1..41a3a4c 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 _0xca55=['ShowDynamics365Account','where','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','result','GetDynamics365Account','Dynamics365Account','findAll','options','raw','attributes','include','model','map','then','stringify','catch'];(function(_0x37ae2e,_0x35be3a){var _0x19c50f=function(_0x49732a){while(--_0x49732a){_0x37ae2e['push'](_0x37ae2e['shift']());}};_0x19c50f(++_0x35be3a);}(_0xca55,0x10a));var _0x5ca5=function(_0x1b346a,_0x3474da){_0x1b346a=_0x1b346a-0x0;var _0x2f5c0e=_0xca55[_0x1b346a];return _0x2f5c0e;};'use strict';var _=require(_0x5ca5('0x0'));var util=require(_0x5ca5('0x1'));var moment=require(_0x5ca5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ca5('0x3'));var db=require(_0x5ca5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5ca5('0x5'))(_0x5ca5('0x6'));var config=require(_0x5ca5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5ca5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d0171,_0x385aa3,_0x28cea9){return new BPromise(function(_0x29a6aa,_0x1b6d26){return client[_0x5ca5('0x9')](_0x4d0171,_0x28cea9)['then'](function(_0x127802){logger[_0x5ca5('0xa')](_0x5ca5('0xb'),_0x385aa3,_0x5ca5('0xc'));logger[_0x5ca5('0xd')](_0x5ca5('0xe'),_0x385aa3,_0x5ca5('0xc'),JSON['stringify'](_0x127802));if(_0x127802[_0x5ca5('0xf')]){if(_0x127802['error'][_0x5ca5('0x10')]===0x1f4){logger['error'](_0x5ca5('0xb'),_0x385aa3,_0x127802['error']['message']);return _0x1b6d26(_0x127802[_0x5ca5('0xf')]['message']);}logger[_0x5ca5('0xf')]('Dynamics365Account,\x20%s,\x20%s',_0x385aa3,_0x127802[_0x5ca5('0xf')][_0x5ca5('0x11')]);return _0x29a6aa(_0x127802[_0x5ca5('0xf')]['message']);}else{logger[_0x5ca5('0xa')](_0x5ca5('0xb'),_0x385aa3,_0x5ca5('0xc'));_0x29a6aa(_0x127802[_0x5ca5('0x12')][_0x5ca5('0x11')]);}})['catch'](function(_0x12bf33){logger[_0x5ca5('0xf')]('Dynamics365Account,\x20%s,\x20%s',_0x385aa3,_0x12bf33);_0x1b6d26(_0x12bf33);});});}exports[_0x5ca5('0x13')]=function(_0x5e50a8){var _0x49687d=this;return new Promise(function(_0x4d9fcb,_0x269f65){return db[_0x5ca5('0x14')][_0x5ca5('0x15')]({'raw':_0x5e50a8[_0x5ca5('0x16')]?_0x5e50a8[_0x5ca5('0x16')][_0x5ca5('0x17')]===undefined?!![]:![]:!![],'where':_0x5e50a8[_0x5ca5('0x16')]?_0x5e50a8[_0x5ca5('0x16')]['where']||null:null,'attributes':_0x5e50a8[_0x5ca5('0x16')]?_0x5e50a8[_0x5ca5('0x16')][_0x5ca5('0x18')]||null:null,'limit':_0x5e50a8['options']?_0x5e50a8['options']['limit']||null:null,'include':_0x5e50a8[_0x5ca5('0x16')]?_0x5e50a8[_0x5ca5('0x16')][_0x5ca5('0x19')]?_['map'](_0x5e50a8[_0x5ca5('0x16')]['include'],function(_0xd780c7){return{'model':db[_0xd780c7[_0x5ca5('0x1a')]],'as':_0xd780c7['as'],'attributes':_0xd780c7[_0x5ca5('0x18')],'include':_0xd780c7['include']?_[_0x5ca5('0x1b')](_0xd780c7['include'],function(_0x40de62){return{'model':db[_0x40de62[_0x5ca5('0x1a')]],'as':_0x40de62['as'],'attributes':_0x40de62['attributes'],'include':_0x40de62['include']?_['map'](_0x40de62['include'],function(_0x249893){return{'model':db[_0x249893[_0x5ca5('0x1a')]],'as':_0x249893['as'],'attributes':_0x249893[_0x5ca5('0x18')]};}):[]};}):[]};}):[]:[]})[_0x5ca5('0x1c')](function(_0x14c177){logger[_0x5ca5('0xa')]('GetDynamics365Account',_0x5e50a8);logger[_0x5ca5('0xd')](_0x5ca5('0x13'),_0x5e50a8,JSON[_0x5ca5('0x1d')](_0x14c177));_0x4d9fcb(_0x14c177);})[_0x5ca5('0x1e')](function(_0x3319ae){logger['error'](_0x5ca5('0x13'),_0x3319ae[_0x5ca5('0x11')],_0x5e50a8);_0x269f65(_0x49687d['error'](0x1f4,_0x3319ae[_0x5ca5('0x11')]));});});};exports[_0x5ca5('0x1f')]=function(_0x39a2a5){var _0x5b3513=this;return new Promise(function(_0x87cef5,_0x408dd4){return db[_0x5ca5('0x14')]['find']({'raw':_0x39a2a5['options']?_0x39a2a5[_0x5ca5('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x39a2a5[_0x5ca5('0x16')]?_0x39a2a5[_0x5ca5('0x16')][_0x5ca5('0x20')]||null:null,'attributes':_0x39a2a5[_0x5ca5('0x16')]?_0x39a2a5[_0x5ca5('0x16')][_0x5ca5('0x18')]||null:null,'include':_0x39a2a5[_0x5ca5('0x16')]?_0x39a2a5[_0x5ca5('0x16')][_0x5ca5('0x19')]?_[_0x5ca5('0x1b')](_0x39a2a5[_0x5ca5('0x16')]['include'],function(_0x2a96b4){return{'model':db[_0x2a96b4[_0x5ca5('0x1a')]],'as':_0x2a96b4['as'],'attributes':_0x2a96b4['attributes'],'include':_0x2a96b4[_0x5ca5('0x19')]?_[_0x5ca5('0x1b')](_0x2a96b4['include'],function(_0x3e0fd8){return{'model':db[_0x3e0fd8[_0x5ca5('0x1a')]],'as':_0x3e0fd8['as'],'attributes':_0x3e0fd8[_0x5ca5('0x18')],'include':_0x3e0fd8[_0x5ca5('0x19')]?_[_0x5ca5('0x1b')](_0x3e0fd8[_0x5ca5('0x19')],function(_0x1e27bb){return{'model':db[_0x1e27bb[_0x5ca5('0x1a')]],'as':_0x1e27bb['as'],'attributes':_0x1e27bb[_0x5ca5('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x274b34){logger[_0x5ca5('0xa')](_0x5ca5('0x1f'),_0x39a2a5);logger[_0x5ca5('0xd')]('ShowDynamics365Account',_0x39a2a5,JSON[_0x5ca5('0x1d')](_0x274b34));_0x87cef5(_0x274b34);})[_0x5ca5('0x1e')](function(_0x72404e){logger[_0x5ca5('0xf')](_0x5ca5('0x1f'),_0x72404e[_0x5ca5('0x11')],_0x39a2a5);_0x408dd4(_0x5b3513[_0x5ca5('0xf')](0x1f4,_0x72404e[_0x5ca5('0x11')]));});});}; \ No newline at end of file +var _0x76f2=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Dynamics365Account','findAll','options','raw','attributes','limit','map','model','include','GetDynamics365Account','find','where','ShowDynamics365Account','lodash','util','moment','bluebird','randomstring'];(function(_0x390c03,_0x204164){var _0x44ff67=function(_0x27a809){while(--_0x27a809){_0x390c03['push'](_0x390c03['shift']());}};_0x44ff67(++_0x204164);}(_0x76f2,0x8b));var _0x276f=function(_0x104d54,_0x1d7e6d){_0x104d54=_0x104d54-0x0;var _0x53321f=_0x76f2[_0x104d54];return _0x53321f;};'use strict';var _=require(_0x276f('0x0'));var util=require(_0x276f('0x1'));var moment=require(_0x276f('0x2'));var BPromise=require(_0x276f('0x3'));var rs=require(_0x276f('0x4'));var fs=require('fs');var Redis=require(_0x276f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x276f('0x6'))(_0x276f('0x7'));var config=require(_0x276f('0x8'));var jayson=require(_0x276f('0x9'));var client=jayson['client'][_0x276f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57001c,_0x1d6ae2,_0x100503){return new BPromise(function(_0x5362b3,_0x3c8919){return client[_0x276f('0xb')](_0x57001c,_0x100503)[_0x276f('0xc')](function(_0x378fdf){logger[_0x276f('0xd')](_0x276f('0xe'),_0x1d6ae2,_0x276f('0xf'));logger[_0x276f('0x10')](_0x276f('0x11'),_0x1d6ae2,'request\x20sent',JSON[_0x276f('0x12')](_0x378fdf));if(_0x378fdf['error']){if(_0x378fdf['error']['code']===0x1f4){logger[_0x276f('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x1d6ae2,_0x378fdf[_0x276f('0x13')][_0x276f('0x14')]);return _0x3c8919(_0x378fdf[_0x276f('0x13')][_0x276f('0x14')]);}logger[_0x276f('0x13')](_0x276f('0xe'),_0x1d6ae2,_0x378fdf['error']['message']);return _0x5362b3(_0x378fdf[_0x276f('0x13')][_0x276f('0x14')]);}else{logger['info'](_0x276f('0xe'),_0x1d6ae2,'request\x20sent');_0x5362b3(_0x378fdf[_0x276f('0x15')][_0x276f('0x14')]);}})[_0x276f('0x16')](function(_0x1f1edf){logger[_0x276f('0x13')](_0x276f('0xe'),_0x1d6ae2,_0x1f1edf);_0x3c8919(_0x1f1edf);});});}exports['GetDynamics365Account']=function(_0x413fd2){var _0x4d6cac=this;return new Promise(function(_0x3b65d0,_0x3cf54f){return db[_0x276f('0x17')][_0x276f('0x18')]({'raw':_0x413fd2[_0x276f('0x19')]?_0x413fd2[_0x276f('0x19')][_0x276f('0x1a')]===undefined?!![]:![]:!![],'where':_0x413fd2['options']?_0x413fd2[_0x276f('0x19')]['where']||null:null,'attributes':_0x413fd2['options']?_0x413fd2[_0x276f('0x19')][_0x276f('0x1b')]||null:null,'limit':_0x413fd2[_0x276f('0x19')]?_0x413fd2['options'][_0x276f('0x1c')]||null:null,'include':_0x413fd2[_0x276f('0x19')]?_0x413fd2['options']['include']?_[_0x276f('0x1d')](_0x413fd2[_0x276f('0x19')]['include'],function(_0x50a243){return{'model':db[_0x50a243[_0x276f('0x1e')]],'as':_0x50a243['as'],'attributes':_0x50a243[_0x276f('0x1b')],'include':_0x50a243[_0x276f('0x1f')]?_[_0x276f('0x1d')](_0x50a243['include'],function(_0xbbb7f9){return{'model':db[_0xbbb7f9[_0x276f('0x1e')]],'as':_0xbbb7f9['as'],'attributes':_0xbbb7f9[_0x276f('0x1b')],'include':_0xbbb7f9[_0x276f('0x1f')]?_['map'](_0xbbb7f9[_0x276f('0x1f')],function(_0x580d17){return{'model':db[_0x580d17[_0x276f('0x1e')]],'as':_0x580d17['as'],'attributes':_0x580d17['attributes']};}):[]};}):[]};}):[]:[]})[_0x276f('0xc')](function(_0x549094){logger[_0x276f('0xd')]('GetDynamics365Account',_0x413fd2);logger[_0x276f('0x10')](_0x276f('0x20'),_0x413fd2,JSON['stringify'](_0x549094));_0x3b65d0(_0x549094);})[_0x276f('0x16')](function(_0x583b4c){logger['error'](_0x276f('0x20'),_0x583b4c['message'],_0x413fd2);_0x3cf54f(_0x4d6cac[_0x276f('0x13')](0x1f4,_0x583b4c[_0x276f('0x14')]));});});};exports['ShowDynamics365Account']=function(_0x497794){var _0x4239f6=this;return new Promise(function(_0x1099ca,_0x34a5b6){return db[_0x276f('0x17')][_0x276f('0x21')]({'raw':_0x497794['options']?_0x497794[_0x276f('0x19')][_0x276f('0x1a')]===undefined?!![]:![]:!![],'where':_0x497794[_0x276f('0x19')]?_0x497794[_0x276f('0x19')][_0x276f('0x22')]||null:null,'attributes':_0x497794[_0x276f('0x19')]?_0x497794['options'][_0x276f('0x1b')]||null:null,'include':_0x497794[_0x276f('0x19')]?_0x497794[_0x276f('0x19')][_0x276f('0x1f')]?_[_0x276f('0x1d')](_0x497794[_0x276f('0x19')][_0x276f('0x1f')],function(_0x344b86){return{'model':db[_0x344b86[_0x276f('0x1e')]],'as':_0x344b86['as'],'attributes':_0x344b86[_0x276f('0x1b')],'include':_0x344b86[_0x276f('0x1f')]?_['map'](_0x344b86[_0x276f('0x1f')],function(_0x5ed6a5){return{'model':db[_0x5ed6a5[_0x276f('0x1e')]],'as':_0x5ed6a5['as'],'attributes':_0x5ed6a5[_0x276f('0x1b')],'include':_0x5ed6a5['include']?_[_0x276f('0x1d')](_0x5ed6a5[_0x276f('0x1f')],function(_0x5cb02e){return{'model':db[_0x5cb02e[_0x276f('0x1e')]],'as':_0x5cb02e['as'],'attributes':_0x5cb02e[_0x276f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x276f('0xc')](function(_0x2082d5){logger[_0x276f('0xd')](_0x276f('0x23'),_0x497794);logger[_0x276f('0x10')](_0x276f('0x23'),_0x497794,JSON[_0x276f('0x12')](_0x2082d5));_0x1099ca(_0x2082d5);})[_0x276f('0x16')](function(_0x208e05){logger['error'](_0x276f('0x23'),_0x208e05[_0x276f('0x14')],_0x497794);_0x34a5b6(_0x4239f6['error'](0x1f4,_0x208e05[_0x276f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index d18d99c..83b0bab 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 _0x69c5=['path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','getSubjects','getDescriptions','post','create','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x5bf80e,_0x3120e2){var _0xd5da57=function(_0x40d795){while(--_0x40d795){_0x5bf80e['push'](_0x5bf80e['shift']());}};_0xd5da57(++_0x3120e2);}(_0x69c5,0xad));var _0x569c=function(_0x3aa16a,_0x433af5){_0x3aa16a=_0x3aa16a-0x0;var _0x5bbd6f=_0x69c5[_0x3aa16a];return _0x5bbd6f;};'use strict';var multer=require(_0x569c('0x0'));var util=require(_0x569c('0x1'));var path=require(_0x569c('0x2'));var timeout=require(_0x569c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x569c('0x4'));var auth=require(_0x569c('0x5'));var interaction=require(_0x569c('0x6'));var config=require(_0x569c('0x7'));var controller=require(_0x569c('0x8'));router[_0x569c('0x9')]('/',auth[_0x569c('0xa')](),controller[_0x569c('0xb')]);router[_0x569c('0x9')]('/:id',auth[_0x569c('0xa')](),controller[_0x569c('0xc')]);router[_0x569c('0x9')](_0x569c('0xd'),auth[_0x569c('0xa')](),controller[_0x569c('0xe')]);router[_0x569c('0x9')]('/:id/subjects',auth[_0x569c('0xa')](),controller[_0x569c('0xf')]);router[_0x569c('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x569c('0x10')]);router[_0x569c('0x11')]('/',auth[_0x569c('0xa')](),controller[_0x569c('0x12')]);router[_0x569c('0x13')](_0x569c('0x14'),auth['isAuthenticated'](),controller[_0x569c('0x15')]);router[_0x569c('0x16')](_0x569c('0x14'),auth['isAuthenticated'](),controller[_0x569c('0x17')]);module[_0x569c('0x18')]=router; \ No newline at end of file +var _0x37e9=['/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index'];(function(_0x3ac438,_0x13c8c1){var _0x49c9ee=function(_0x46b4eb){while(--_0x46b4eb){_0x3ac438['push'](_0x3ac438['shift']());}};_0x49c9ee(++_0x13c8c1);}(_0x37e9,0x1e7));var _0x937e=function(_0x524712,_0x4d30aa){_0x524712=_0x524712-0x0;var _0x2b25cc=_0x37e9[_0x524712];return _0x2b25cc;};'use strict';var multer=require(_0x937e('0x0'));var util=require(_0x937e('0x1'));var path=require(_0x937e('0x2'));var timeout=require(_0x937e('0x3'));var express=require(_0x937e('0x4'));var router=express[_0x937e('0x5')]();var fs_extra=require(_0x937e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x937e('0x7'));var config=require(_0x937e('0x8'));var controller=require(_0x937e('0x9'));router[_0x937e('0xa')]('/',auth[_0x937e('0xb')](),controller[_0x937e('0xc')]);router['get'](_0x937e('0xd'),auth[_0x937e('0xb')](),controller[_0x937e('0xe')]);router[_0x937e('0xa')](_0x937e('0xf'),auth[_0x937e('0xb')](),controller['getFields']);router['get'](_0x937e('0x10'),auth[_0x937e('0xb')](),controller[_0x937e('0x11')]);router[_0x937e('0xa')](_0x937e('0x12'),auth[_0x937e('0xb')](),controller['getDescriptions']);router['post']('/',auth['isAuthenticated'](),controller[_0x937e('0x13')]);router[_0x937e('0x14')]('/:id',auth[_0x937e('0xb')](),controller[_0x937e('0x15')]);router[_0x937e('0x16')](_0x937e('0xd'),auth['isAuthenticated'](),controller[_0x937e('0x17')]);module[_0x937e('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index c4a82b1..f82a1e0 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 _0x91fd=['sequelize','exports','STRING','ENUM','phonecall','incident','nothing','contact'];(function(_0x3b9398,_0x2b384a){var _0x43511d=function(_0x3e8eb2){while(--_0x3e8eb2){_0x3b9398['push'](_0x3b9398['shift']());}};_0x43511d(++_0x2b384a);}(_0x91fd,0x1f0));var _0xd91f=function(_0x552d65,_0xaed719){_0x552d65=_0x552d65-0x0;var _0x52d97c=_0x91fd[_0x552d65];return _0x52d97c;};'use strict';var Sequelize=require(_0xd91f('0x0'));module[_0xd91f('0x1')]={'name':{'type':Sequelize[_0xd91f('0x2')]},'description':{'type':Sequelize[_0xd91f('0x2')]},'ticketType':{'type':Sequelize[_0xd91f('0x3')]('incident',_0xd91f('0x4')),'defaultValue':_0xd91f('0x5')},'moduleCreate':{'type':Sequelize[_0xd91f('0x3')]('contact',_0xd91f('0x6')),'defaultValue':_0xd91f('0x7'),'allowNull':![]}}; \ No newline at end of file +var _0xdb1b=['ENUM','phonecall','incident','contact','nothing','sequelize','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdb1b,0x85));var _0xbdb1=function(_0x5b26d1,_0x4e8a5c){_0x5b26d1=_0x5b26d1-0x0;var _0x313432=_0xdb1b[_0x5b26d1];return _0x313432;};'use strict';var Sequelize=require(_0xbdb1('0x0'));module[_0xbdb1('0x1')]={'name':{'type':Sequelize[_0xbdb1('0x2')]},'description':{'type':Sequelize[_0xbdb1('0x2')]},'ticketType':{'type':Sequelize[_0xbdb1('0x3')]('incident',_0xbdb1('0x4')),'defaultValue':_0xbdb1('0x5')},'moduleCreate':{'type':Sequelize[_0xbdb1('0x3')](_0xbdb1('0x6'),_0xbdb1('0x7')),'defaultValue':'contact','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index fcf65f5..1218645 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 _0xbcb0=['attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','params','find','update','body','getFields','nolimit','getSubjects','findOne','Dynamics365Field','getDescriptions','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','set','apply','reject','save','then','destroy','status','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','key','model','query','keys','intersection'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbcb0,0xb5));var _0x0bcb=function(_0x1886c2,_0x60e968){_0x1886c2=_0x1886c2-0x0;var _0x38d30d=_0xbcb0[_0x1886c2];return _0x38d30d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0bcb('0x0'));var zipdir=require(_0x0bcb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0bcb('0x2'));var moment=require(_0x0bcb('0x3'));var BPromise=require(_0x0bcb('0x4'));var Mustache=require(_0x0bcb('0x5'));var util=require('util');var path=require(_0x0bcb('0x6'));var sox=require(_0x0bcb('0x7'));var csv=require(_0x0bcb('0x8'));var ejs=require(_0x0bcb('0x9'));var fs=require('fs');var fs_extra=require(_0x0bcb('0xa'));var _=require('lodash');var squel=require(_0x0bcb('0xb'));var crypto=require(_0x0bcb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0bcb('0xd'));var toCsv=require(_0x0bcb('0x8'));var querystring=require(_0x0bcb('0xe'));var Papa=require(_0x0bcb('0xf'));var Redis=require(_0x0bcb('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('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0bcb('0x11'));var licenseUtil=require(_0x0bcb('0x12'));var db=require(_0x0bcb('0x13'))['db'];function respondWithStatusCode(_0x31ab25,_0x4e5016){_0x4e5016=_0x4e5016||0xcc;return function(_0x25a998){if(_0x25a998){return _0x31ab25[_0x0bcb('0x14')](_0x4e5016);}return _0x31ab25['status'](_0x4e5016)[_0x0bcb('0x15')]();};}function respondWithResult(_0x165369,_0x1a38c4){_0x1a38c4=_0x1a38c4||0xc8;return function(_0x3a500e){if(_0x3a500e){return _0x165369['status'](_0x1a38c4)[_0x0bcb('0x16')](_0x3a500e);}};}function respondWithFilteredResult(_0x2f3bec,_0x356a48){return function(_0x2a136d){if(_0x2a136d){var _0x36d82a=typeof _0x356a48[_0x0bcb('0x17')]===_0x0bcb('0x18')&&typeof _0x356a48['limit']===_0x0bcb('0x18');var _0x5e0a16=_0x2a136d['count'];var _0x357c8a=_0x36d82a?0x0:_0x356a48[_0x0bcb('0x17')];var _0x3ce7c3=_0x36d82a?_0x2a136d[_0x0bcb('0x19')]:_0x356a48['offset']+_0x356a48['limit'];var _0x55397f;if(_0x3ce7c3>=_0x5e0a16){_0x3ce7c3=_0x5e0a16;_0x55397f=0xc8;}else{_0x55397f=0xce;}_0x2f3bec['status'](_0x55397f);return _0x2f3bec[_0x0bcb('0x1a')]('Content-Range',_0x357c8a+'-'+_0x3ce7c3+'/'+_0x5e0a16)[_0x0bcb('0x16')](_0x2a136d);}return null;};}function patchUpdates(_0xd6a403){return function(_0x358f66){try{jsonpatch[_0x0bcb('0x1b')](_0x358f66,_0xd6a403,!![]);}catch(_0x165f1f){return BPromise[_0x0bcb('0x1c')](_0x165f1f);}return _0x358f66[_0x0bcb('0x1d')]();};}function saveUpdates(_0x76bc80,_0x263f96){return function(_0x49f68e){if(_0x49f68e){return _0x49f68e['update'](_0x76bc80)[_0x0bcb('0x1e')](function(_0x36d76b){return _0x36d76b;});}return null;};}function removeEntity(_0x2c61b1,_0x586f22){return function(_0x4f2e38){if(_0x4f2e38){return _0x4f2e38[_0x0bcb('0x1f')]()['then'](function(){_0x2c61b1[_0x0bcb('0x20')](0xcc)[_0x0bcb('0x15')]();});}};}function handleEntityNotFound(_0x50d4b2,_0x432113){return function(_0x572a08){if(!_0x572a08){_0x50d4b2[_0x0bcb('0x14')](0x194);}return _0x572a08;};}function handleError(_0x3f32c5,_0x4a73e6){_0x4a73e6=_0x4a73e6||0x1f4;return function(_0x3596ff){logger[_0x0bcb('0x21')](_0x3596ff[_0x0bcb('0x22')]);if(_0x3596ff['name']){delete _0x3596ff[_0x0bcb('0x23')];}_0x3f32c5['status'](_0x4a73e6)[_0x0bcb('0x24')](_0x3596ff);};}exports[_0x0bcb('0x25')]=function(_0x3d1d9c,_0x19b2e4){var _0x4e9c2={},_0x337f3d={},_0x2b008a={'count':0x0,'rows':[]};var _0x464611=_[_0x0bcb('0x26')](db[_0x0bcb('0x27')][_0x0bcb('0x28')],function(_0x18166e){return{'name':_0x18166e[_0x0bcb('0x29')],'type':_0x18166e['type'][_0x0bcb('0x2a')]};});_0x337f3d[_0x0bcb('0x2b')]=_['map'](_0x464611,_0x0bcb('0x23'));_0x337f3d[_0x0bcb('0x2c')]=_[_0x0bcb('0x2d')](_0x3d1d9c['query']);_0x337f3d['filters']=_[_0x0bcb('0x2e')](_0x337f3d['model'],_0x337f3d[_0x0bcb('0x2c')]);_0x4e9c2[_0x0bcb('0x2f')]=_['intersection'](_0x337f3d['model'],qs[_0x0bcb('0x30')](_0x3d1d9c[_0x0bcb('0x2c')][_0x0bcb('0x30')]));_0x4e9c2[_0x0bcb('0x2f')]=_0x4e9c2[_0x0bcb('0x2f')][_0x0bcb('0x31')]?_0x4e9c2[_0x0bcb('0x2f')]:_0x337f3d[_0x0bcb('0x2b')];if(!_0x3d1d9c[_0x0bcb('0x2c')][_0x0bcb('0x32')]('nolimit')){_0x4e9c2[_0x0bcb('0x33')]=qs[_0x0bcb('0x33')](_0x3d1d9c[_0x0bcb('0x2c')][_0x0bcb('0x33')]);_0x4e9c2['offset']=qs[_0x0bcb('0x17')](_0x3d1d9c[_0x0bcb('0x2c')][_0x0bcb('0x17')]);}_0x4e9c2[_0x0bcb('0x34')]=qs[_0x0bcb('0x35')](_0x3d1d9c[_0x0bcb('0x2c')][_0x0bcb('0x35')]);_0x4e9c2[_0x0bcb('0x36')]=qs[_0x0bcb('0x37')](_[_0x0bcb('0x38')](_0x3d1d9c[_0x0bcb('0x2c')],_0x337f3d[_0x0bcb('0x37')]),_0x464611);if(_0x3d1d9c['query'][_0x0bcb('0x39')]){_0x4e9c2['where']=_[_0x0bcb('0x3a')](_0x4e9c2[_0x0bcb('0x36')],{'$or':_['map'](_0x464611,function(_0x31a730){if(_0x31a730[_0x0bcb('0x3b')]!==_0x0bcb('0x3c')){var _0x337e8b={};_0x337e8b[_0x31a730[_0x0bcb('0x23')]]={'$like':'%'+_0x3d1d9c['query']['filter']+'%'};return _0x337e8b;}})});}_0x4e9c2=_[_0x0bcb('0x3a')]({},_0x4e9c2,_0x3d1d9c[_0x0bcb('0x3d')]);var _0x52d944={'where':_0x4e9c2[_0x0bcb('0x36')]};return db['Dynamics365Configuration'][_0x0bcb('0x19')](_0x52d944)[_0x0bcb('0x1e')](function(_0x2ddfef){_0x2b008a['count']=_0x2ddfef;if(_0x3d1d9c[_0x0bcb('0x2c')][_0x0bcb('0x3e')]){_0x4e9c2[_0x0bcb('0x3f')]=[{'all':!![]}];}return db[_0x0bcb('0x27')]['findAll'](_0x4e9c2);})['then'](function(_0x39e513){_0x2b008a[_0x0bcb('0x40')]=_0x39e513;return _0x2b008a;})[_0x0bcb('0x1e')](respondWithFilteredResult(_0x19b2e4,_0x4e9c2))[_0x0bcb('0x41')](handleError(_0x19b2e4,null));};exports['show']=function(_0xe80f30,_0x2394f9){var _0x630858={'raw':![],'where':{'id':_0xe80f30[_0x0bcb('0x42')]['id']}},_0x3edcda={};_0x3edcda[_0x0bcb('0x2b')]=_[_0x0bcb('0x2d')](db['Dynamics365Configuration'][_0x0bcb('0x28')]);_0x3edcda['query']=_['keys'](_0xe80f30[_0x0bcb('0x2c')]);_0x3edcda['filters']=_[_0x0bcb('0x2e')](_0x3edcda[_0x0bcb('0x2b')],_0x3edcda['query']);_0x630858[_0x0bcb('0x2f')]=_[_0x0bcb('0x2e')](_0x3edcda['model'],qs[_0x0bcb('0x30')](_0xe80f30['query']['fields']));_0x630858[_0x0bcb('0x2f')]=_0x630858[_0x0bcb('0x2f')]['length']?_0x630858[_0x0bcb('0x2f')]:_0x3edcda[_0x0bcb('0x2b')];if(_0xe80f30['query'][_0x0bcb('0x3e')]){_0x630858['include']=[{'all':!![]}];}_0x630858=_[_0x0bcb('0x3a')]({},_0x630858,_0xe80f30['options']);return db['Dynamics365Configuration'][_0x0bcb('0x43')](_0x630858)[_0x0bcb('0x1e')](handleEntityNotFound(_0x2394f9,null))[_0x0bcb('0x1e')](respondWithResult(_0x2394f9,null))[_0x0bcb('0x41')](handleError(_0x2394f9,null));};exports['create']=function(_0x50a526,_0x225352){return db[_0x0bcb('0x27')]['create'](_0x50a526['body'],{})['then'](respondWithResult(_0x225352,0xc9))[_0x0bcb('0x41')](handleError(_0x225352,null));};exports[_0x0bcb('0x44')]=function(_0x2c7a4c,_0xdf9518){if(_0x2c7a4c[_0x0bcb('0x45')]['id']){delete _0x2c7a4c[_0x0bcb('0x45')]['id'];}return db[_0x0bcb('0x27')][_0x0bcb('0x43')]({'where':{'id':_0x2c7a4c[_0x0bcb('0x42')]['id']}})[_0x0bcb('0x1e')](handleEntityNotFound(_0xdf9518,null))[_0x0bcb('0x1e')](saveUpdates(_0x2c7a4c[_0x0bcb('0x45')],null))[_0x0bcb('0x1e')](respondWithResult(_0xdf9518,null))['catch'](handleError(_0xdf9518,null));};exports[_0x0bcb('0x1f')]=function(_0x5a32e9,_0x5c542a){return db['Dynamics365Configuration'][_0x0bcb('0x43')]({'where':{'id':_0x5a32e9[_0x0bcb('0x42')]['id']}})['then'](handleEntityNotFound(_0x5c542a,null))[_0x0bcb('0x1e')](removeEntity(_0x5c542a,null))[_0x0bcb('0x41')](handleError(_0x5c542a,null));};exports['getFields']=function(_0x337820,_0x3733a8,_0x5c40a8){var _0x472bba={};var _0x55b52d={};var _0x4e9f41;var _0x355286;return db[_0x0bcb('0x27')]['findOne']({'where':{'id':_0x337820[_0x0bcb('0x42')]['id']}})['then'](handleEntityNotFound(_0x3733a8,null))['then'](function(_0x171fe7){if(_0x171fe7){_0x4e9f41=_0x171fe7;_0x55b52d['model']=_[_0x0bcb('0x2d')](db['Dynamics365Field'][_0x0bcb('0x28')]);_0x55b52d[_0x0bcb('0x2c')]=_['keys'](_0x337820[_0x0bcb('0x2c')]);_0x55b52d[_0x0bcb('0x37')]=_[_0x0bcb('0x2e')](_0x55b52d[_0x0bcb('0x2b')],_0x55b52d[_0x0bcb('0x2c')]);_0x472bba[_0x0bcb('0x2f')]=_['intersection'](_0x55b52d[_0x0bcb('0x2b')],qs[_0x0bcb('0x30')](_0x337820[_0x0bcb('0x2c')][_0x0bcb('0x30')]));_0x472bba[_0x0bcb('0x2f')]=_0x472bba[_0x0bcb('0x2f')][_0x0bcb('0x31')]?_0x472bba[_0x0bcb('0x2f')]:_0x55b52d[_0x0bcb('0x2b')];_0x472bba[_0x0bcb('0x34')]=qs['sort'](_0x337820['query']['sort']);_0x472bba[_0x0bcb('0x36')]=qs[_0x0bcb('0x37')](_[_0x0bcb('0x38')](_0x337820['query'],_0x55b52d[_0x0bcb('0x37')]));if(_0x337820[_0x0bcb('0x2c')]['filter']){_0x472bba[_0x0bcb('0x36')]=_[_0x0bcb('0x3a')](_0x472bba['where'],{'$or':_[_0x0bcb('0x26')](_0x472bba[_0x0bcb('0x2f')],function(_0x59f897){var _0x3b62ea={};_0x3b62ea[_0x59f897]={'$like':'%'+_0x337820[_0x0bcb('0x2c')][_0x0bcb('0x39')]+'%'};return _0x3b62ea;})});}_0x472bba=_[_0x0bcb('0x3a')]({},_0x472bba,_0x337820[_0x0bcb('0x3d')]);return _0x4e9f41[_0x0bcb('0x46')](_0x472bba);}})[_0x0bcb('0x1e')](function(_0x3d42e6){if(_0x3d42e6){_0x355286=_0x3d42e6[_0x0bcb('0x31')];if(!_0x337820[_0x0bcb('0x2c')][_0x0bcb('0x32')](_0x0bcb('0x47'))){_0x472bba[_0x0bcb('0x33')]=qs[_0x0bcb('0x33')](_0x337820[_0x0bcb('0x2c')][_0x0bcb('0x33')]);_0x472bba[_0x0bcb('0x17')]=qs[_0x0bcb('0x17')](_0x337820['query'][_0x0bcb('0x17')]);}return _0x4e9f41[_0x0bcb('0x46')](_0x472bba);}})[_0x0bcb('0x1e')](function(_0x35d8bb){if(_0x35d8bb){return _0x35d8bb?{'count':_0x355286,'rows':_0x35d8bb}:null;}})[_0x0bcb('0x1e')](respondWithResult(_0x3733a8,null))[_0x0bcb('0x41')](handleError(_0x3733a8,null));};exports[_0x0bcb('0x48')]=function(_0x39ee06,_0x7b6d74,_0x25a3d1){var _0xedb4b6={};var _0x54238c={};var _0x3a411d;var _0x4fdc6c;return db['Dynamics365Configuration'][_0x0bcb('0x49')]({'where':{'id':_0x39ee06[_0x0bcb('0x42')]['id']}})[_0x0bcb('0x1e')](handleEntityNotFound(_0x7b6d74,null))['then'](function(_0xda39f8){if(_0xda39f8){_0x3a411d=_0xda39f8;_0x54238c['model']=_[_0x0bcb('0x2d')](db[_0x0bcb('0x4a')][_0x0bcb('0x28')]);_0x54238c['query']=_[_0x0bcb('0x2d')](_0x39ee06[_0x0bcb('0x2c')]);_0x54238c['filters']=_['intersection'](_0x54238c[_0x0bcb('0x2b')],_0x54238c[_0x0bcb('0x2c')]);_0xedb4b6['attributes']=_[_0x0bcb('0x2e')](_0x54238c['model'],qs[_0x0bcb('0x30')](_0x39ee06['query']['fields']));_0xedb4b6[_0x0bcb('0x2f')]=_0xedb4b6[_0x0bcb('0x2f')][_0x0bcb('0x31')]?_0xedb4b6[_0x0bcb('0x2f')]:_0x54238c['model'];_0xedb4b6[_0x0bcb('0x34')]=qs[_0x0bcb('0x35')](_0x39ee06[_0x0bcb('0x2c')]['sort']);_0xedb4b6['where']=qs[_0x0bcb('0x37')](_['pick'](_0x39ee06[_0x0bcb('0x2c')],_0x54238c[_0x0bcb('0x37')]));if(_0x39ee06['query']['filter']){_0xedb4b6[_0x0bcb('0x36')]=_[_0x0bcb('0x3a')](_0xedb4b6[_0x0bcb('0x36')],{'$or':_[_0x0bcb('0x26')](_0xedb4b6[_0x0bcb('0x2f')],function(_0x49d595){var _0xeb794e={};_0xeb794e[_0x49d595]={'$like':'%'+_0x39ee06[_0x0bcb('0x2c')][_0x0bcb('0x39')]+'%'};return _0xeb794e;})});}_0xedb4b6=_[_0x0bcb('0x3a')]({},_0xedb4b6,_0x39ee06[_0x0bcb('0x3d')]);return _0x3a411d['getSubjects'](_0xedb4b6);}})[_0x0bcb('0x1e')](function(_0x275d1e){if(_0x275d1e){_0x4fdc6c=_0x275d1e[_0x0bcb('0x31')];if(!_0x39ee06[_0x0bcb('0x2c')][_0x0bcb('0x32')]('nolimit')){_0xedb4b6[_0x0bcb('0x33')]=qs[_0x0bcb('0x33')](_0x39ee06[_0x0bcb('0x2c')][_0x0bcb('0x33')]);_0xedb4b6[_0x0bcb('0x17')]=qs[_0x0bcb('0x17')](_0x39ee06[_0x0bcb('0x2c')][_0x0bcb('0x17')]);}return _0x3a411d[_0x0bcb('0x48')](_0xedb4b6);}})[_0x0bcb('0x1e')](function(_0x1f2e50){if(_0x1f2e50){return _0x1f2e50?{'count':_0x4fdc6c,'rows':_0x1f2e50}:null;}})[_0x0bcb('0x1e')](respondWithResult(_0x7b6d74,null))[_0x0bcb('0x41')](handleError(_0x7b6d74,null));};exports[_0x0bcb('0x4b')]=function(_0x3a80a9,_0x2250a5,_0x1433b0){var _0x1bc6f1={};var _0x6bccb7={};var _0x5a604f;var _0x34bdc7;return db[_0x0bcb('0x27')][_0x0bcb('0x49')]({'where':{'id':_0x3a80a9[_0x0bcb('0x42')]['id']}})[_0x0bcb('0x1e')](handleEntityNotFound(_0x2250a5,null))[_0x0bcb('0x1e')](function(_0x2f9a78){if(_0x2f9a78){_0x5a604f=_0x2f9a78;_0x6bccb7[_0x0bcb('0x2b')]=_[_0x0bcb('0x2d')](db[_0x0bcb('0x4a')][_0x0bcb('0x28')]);_0x6bccb7[_0x0bcb('0x2c')]=_[_0x0bcb('0x2d')](_0x3a80a9[_0x0bcb('0x2c')]);_0x6bccb7[_0x0bcb('0x37')]=_['intersection'](_0x6bccb7[_0x0bcb('0x2b')],_0x6bccb7[_0x0bcb('0x2c')]);_0x1bc6f1[_0x0bcb('0x2f')]=_['intersection'](_0x6bccb7[_0x0bcb('0x2b')],qs[_0x0bcb('0x30')](_0x3a80a9[_0x0bcb('0x2c')][_0x0bcb('0x30')]));_0x1bc6f1[_0x0bcb('0x2f')]=_0x1bc6f1['attributes'][_0x0bcb('0x31')]?_0x1bc6f1[_0x0bcb('0x2f')]:_0x6bccb7[_0x0bcb('0x2b')];_0x1bc6f1[_0x0bcb('0x34')]=qs[_0x0bcb('0x35')](_0x3a80a9[_0x0bcb('0x2c')]['sort']);_0x1bc6f1[_0x0bcb('0x36')]=qs[_0x0bcb('0x37')](_['pick'](_0x3a80a9[_0x0bcb('0x2c')],_0x6bccb7[_0x0bcb('0x37')]));if(_0x3a80a9[_0x0bcb('0x2c')][_0x0bcb('0x39')]){_0x1bc6f1[_0x0bcb('0x36')]=_[_0x0bcb('0x3a')](_0x1bc6f1[_0x0bcb('0x36')],{'$or':_[_0x0bcb('0x26')](_0x1bc6f1[_0x0bcb('0x2f')],function(_0xe0749b){var _0xc39034={};_0xc39034[_0xe0749b]={'$like':'%'+_0x3a80a9['query'][_0x0bcb('0x39')]+'%'};return _0xc39034;})});}_0x1bc6f1=_[_0x0bcb('0x3a')]({},_0x1bc6f1,_0x3a80a9[_0x0bcb('0x3d')]);return _0x5a604f[_0x0bcb('0x4b')](_0x1bc6f1);}})[_0x0bcb('0x1e')](function(_0x7d721b){if(_0x7d721b){_0x34bdc7=_0x7d721b[_0x0bcb('0x31')];if(!_0x3a80a9[_0x0bcb('0x2c')][_0x0bcb('0x32')](_0x0bcb('0x47'))){_0x1bc6f1[_0x0bcb('0x33')]=qs[_0x0bcb('0x33')](_0x3a80a9['query'][_0x0bcb('0x33')]);_0x1bc6f1['offset']=qs[_0x0bcb('0x17')](_0x3a80a9[_0x0bcb('0x2c')]['offset']);}return _0x5a604f[_0x0bcb('0x4b')](_0x1bc6f1);}})[_0x0bcb('0x1e')](function(_0x377793){if(_0x377793){return _0x377793?{'count':_0x34bdc7,'rows':_0x377793}:null;}})[_0x0bcb('0x1e')](respondWithResult(_0x2250a5,null))[_0x0bcb('0x41')](handleError(_0x2250a5,null));}; \ No newline at end of file +var _0xc040=['pick','filter','merge','VIRTUAL','include','findAll','rows','show','params','includeAll','options','find','catch','create','body','destroy','getFields','Dynamics365Field','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','mustache','util','to-csv','ejs','fs-extra','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x3f5d96,_0x34ab59){var _0xf3b0c9=function(_0x53de03){while(--_0x53de03){_0x3f5d96['push'](_0x3f5d96['shift']());}};_0xf3b0c9(++_0x34ab59);}(_0xc040,0x14d));var _0x0c04=function(_0x1658e9,_0x96f17d){_0x1658e9=_0x1658e9-0x0;var _0x588280=_0xc040[_0x1658e9];return _0x588280;};'use strict';var emlformat=require(_0x0c04('0x0'));var rimraf=require(_0x0c04('0x1'));var zipdir=require(_0x0c04('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0c04('0x3'));var util=require(_0x0c04('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x0c04('0x5'));var ejs=require(_0x0c04('0x6'));var fs=require('fs');var fs_extra=require(_0x0c04('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0c04('0x8'));var jsforce=require(_0x0c04('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x0c04('0x5'));var querystring=require('querystring');var Papa=require(_0x0c04('0xa'));var Redis=require(_0x0c04('0xb'));var authService=require(_0x0c04('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0c04('0xd'));var logger=require(_0x0c04('0xe'))(_0x0c04('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0c04('0x10'));var db=require(_0x0c04('0x11'))['db'];function respondWithStatusCode(_0x2a0274,_0x2d9eb6){_0x2d9eb6=_0x2d9eb6||0xcc;return function(_0x43ba75){if(_0x43ba75){return _0x2a0274[_0x0c04('0x12')](_0x2d9eb6);}return _0x2a0274[_0x0c04('0x13')](_0x2d9eb6)[_0x0c04('0x14')]();};}function respondWithResult(_0x238d02,_0x4f129b){_0x4f129b=_0x4f129b||0xc8;return function(_0x18f7e4){if(_0x18f7e4){return _0x238d02[_0x0c04('0x13')](_0x4f129b)[_0x0c04('0x15')](_0x18f7e4);}};}function respondWithFilteredResult(_0xac5743,_0x1e033b){return function(_0x44d442){if(_0x44d442){var _0x92d5d7=typeof _0x1e033b[_0x0c04('0x16')]===_0x0c04('0x17')&&typeof _0x1e033b[_0x0c04('0x18')]===_0x0c04('0x17');var _0x24d8b2=_0x44d442[_0x0c04('0x19')];var _0x1977df=_0x92d5d7?0x0:_0x1e033b[_0x0c04('0x16')];var _0xcc86cc=_0x92d5d7?_0x44d442['count']:_0x1e033b['offset']+_0x1e033b[_0x0c04('0x18')];var _0x561be9;if(_0xcc86cc>=_0x24d8b2){_0xcc86cc=_0x24d8b2;_0x561be9=0xc8;}else{_0x561be9=0xce;}_0xac5743['status'](_0x561be9);return _0xac5743[_0x0c04('0x1a')](_0x0c04('0x1b'),_0x1977df+'-'+_0xcc86cc+'/'+_0x24d8b2)[_0x0c04('0x15')](_0x44d442);}return null;};}function patchUpdates(_0x480bac){return function(_0x15c139){try{jsonpatch[_0x0c04('0x1c')](_0x15c139,_0x480bac,!![]);}catch(_0x25d4d2){return BPromise[_0x0c04('0x1d')](_0x25d4d2);}return _0x15c139[_0x0c04('0x1e')]();};}function saveUpdates(_0x4bc1fa,_0x4b9759){return function(_0x5a2042){if(_0x5a2042){return _0x5a2042[_0x0c04('0x1f')](_0x4bc1fa)['then'](function(_0x2a7768){return _0x2a7768;});}return null;};}function removeEntity(_0x1ceb81,_0x17456a){return function(_0x5c4c19){if(_0x5c4c19){return _0x5c4c19['destroy']()[_0x0c04('0x20')](function(){_0x1ceb81['status'](0xcc)[_0x0c04('0x14')]();});}};}function handleEntityNotFound(_0x14366d,_0x5223de){return function(_0x33fe26){if(!_0x33fe26){_0x14366d[_0x0c04('0x12')](0x194);}return _0x33fe26;};}function handleError(_0x38ec37,_0x4dfc4a){_0x4dfc4a=_0x4dfc4a||0x1f4;return function(_0x1ede97){logger[_0x0c04('0x21')](_0x1ede97[_0x0c04('0x22')]);if(_0x1ede97[_0x0c04('0x23')]){delete _0x1ede97[_0x0c04('0x23')];}_0x38ec37[_0x0c04('0x13')](_0x4dfc4a)[_0x0c04('0x24')](_0x1ede97);};}exports[_0x0c04('0x25')]=function(_0x3e36a0,_0x3c80b2){var _0x58da4d={},_0xa4a85d={},_0x122f69={'count':0x0,'rows':[]};var _0x472a97=_[_0x0c04('0x26')](db[_0x0c04('0x27')][_0x0c04('0x28')],function(_0x1129ec){return{'name':_0x1129ec[_0x0c04('0x29')],'type':_0x1129ec[_0x0c04('0x2a')][_0x0c04('0x2b')]};});_0xa4a85d['model']=_[_0x0c04('0x26')](_0x472a97,_0x0c04('0x23'));_0xa4a85d['query']=_[_0x0c04('0x2c')](_0x3e36a0['query']);_0xa4a85d[_0x0c04('0x2d')]=_[_0x0c04('0x2e')](_0xa4a85d[_0x0c04('0x2f')],_0xa4a85d[_0x0c04('0x30')]);_0x58da4d['attributes']=_['intersection'](_0xa4a85d[_0x0c04('0x2f')],qs[_0x0c04('0x31')](_0x3e36a0[_0x0c04('0x30')][_0x0c04('0x31')]));_0x58da4d[_0x0c04('0x32')]=_0x58da4d[_0x0c04('0x32')][_0x0c04('0x33')]?_0x58da4d[_0x0c04('0x32')]:_0xa4a85d[_0x0c04('0x2f')];if(!_0x3e36a0[_0x0c04('0x30')][_0x0c04('0x34')](_0x0c04('0x35'))){_0x58da4d[_0x0c04('0x18')]=qs[_0x0c04('0x18')](_0x3e36a0[_0x0c04('0x30')][_0x0c04('0x18')]);_0x58da4d[_0x0c04('0x16')]=qs[_0x0c04('0x16')](_0x3e36a0['query'][_0x0c04('0x16')]);}_0x58da4d[_0x0c04('0x36')]=qs[_0x0c04('0x37')](_0x3e36a0['query'][_0x0c04('0x37')]);_0x58da4d[_0x0c04('0x38')]=qs[_0x0c04('0x2d')](_[_0x0c04('0x39')](_0x3e36a0[_0x0c04('0x30')],_0xa4a85d[_0x0c04('0x2d')]),_0x472a97);if(_0x3e36a0['query'][_0x0c04('0x3a')]){_0x58da4d[_0x0c04('0x38')]=_[_0x0c04('0x3b')](_0x58da4d[_0x0c04('0x38')],{'$or':_[_0x0c04('0x26')](_0x472a97,function(_0x524b71){if(_0x524b71['type']!==_0x0c04('0x3c')){var _0x1aae57={};_0x1aae57[_0x524b71[_0x0c04('0x23')]]={'$like':'%'+_0x3e36a0[_0x0c04('0x30')]['filter']+'%'};return _0x1aae57;}})});}_0x58da4d=_['merge']({},_0x58da4d,_0x3e36a0['options']);var _0x1203d4={'where':_0x58da4d[_0x0c04('0x38')]};return db[_0x0c04('0x27')][_0x0c04('0x19')](_0x1203d4)[_0x0c04('0x20')](function(_0x494889){_0x122f69[_0x0c04('0x19')]=_0x494889;if(_0x3e36a0['query']['includeAll']){_0x58da4d[_0x0c04('0x3d')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x0c04('0x3e')](_0x58da4d);})[_0x0c04('0x20')](function(_0x4e72c5){_0x122f69[_0x0c04('0x3f')]=_0x4e72c5;return _0x122f69;})[_0x0c04('0x20')](respondWithFilteredResult(_0x3c80b2,_0x58da4d))['catch'](handleError(_0x3c80b2,null));};exports[_0x0c04('0x40')]=function(_0x36ef95,_0x27ccf7){var _0x1f6c00={'raw':![],'where':{'id':_0x36ef95[_0x0c04('0x41')]['id']}},_0x58ed01={};_0x58ed01[_0x0c04('0x2f')]=_['keys'](db[_0x0c04('0x27')][_0x0c04('0x28')]);_0x58ed01[_0x0c04('0x30')]=_[_0x0c04('0x2c')](_0x36ef95[_0x0c04('0x30')]);_0x58ed01['filters']=_['intersection'](_0x58ed01['model'],_0x58ed01[_0x0c04('0x30')]);_0x1f6c00['attributes']=_[_0x0c04('0x2e')](_0x58ed01[_0x0c04('0x2f')],qs[_0x0c04('0x31')](_0x36ef95[_0x0c04('0x30')]['fields']));_0x1f6c00[_0x0c04('0x32')]=_0x1f6c00[_0x0c04('0x32')]['length']?_0x1f6c00['attributes']:_0x58ed01[_0x0c04('0x2f')];if(_0x36ef95[_0x0c04('0x30')][_0x0c04('0x42')]){_0x1f6c00[_0x0c04('0x3d')]=[{'all':!![]}];}_0x1f6c00=_['merge']({},_0x1f6c00,_0x36ef95[_0x0c04('0x43')]);return db['Dynamics365Configuration'][_0x0c04('0x44')](_0x1f6c00)[_0x0c04('0x20')](handleEntityNotFound(_0x27ccf7,null))[_0x0c04('0x20')](respondWithResult(_0x27ccf7,null))[_0x0c04('0x45')](handleError(_0x27ccf7,null));};exports[_0x0c04('0x46')]=function(_0x3f13f5,_0x1161a4){return db[_0x0c04('0x27')][_0x0c04('0x46')](_0x3f13f5[_0x0c04('0x47')],{})[_0x0c04('0x20')](respondWithResult(_0x1161a4,0xc9))[_0x0c04('0x45')](handleError(_0x1161a4,null));};exports['update']=function(_0x173af4,_0x32ccb3){if(_0x173af4[_0x0c04('0x47')]['id']){delete _0x173af4[_0x0c04('0x47')]['id'];}return db[_0x0c04('0x27')]['find']({'where':{'id':_0x173af4[_0x0c04('0x41')]['id']}})[_0x0c04('0x20')](handleEntityNotFound(_0x32ccb3,null))[_0x0c04('0x20')](saveUpdates(_0x173af4['body'],null))[_0x0c04('0x20')](respondWithResult(_0x32ccb3,null))[_0x0c04('0x45')](handleError(_0x32ccb3,null));};exports[_0x0c04('0x48')]=function(_0x15769b,_0x6796a2){return db[_0x0c04('0x27')][_0x0c04('0x44')]({'where':{'id':_0x15769b['params']['id']}})[_0x0c04('0x20')](handleEntityNotFound(_0x6796a2,null))[_0x0c04('0x20')](removeEntity(_0x6796a2,null))[_0x0c04('0x45')](handleError(_0x6796a2,null));};exports[_0x0c04('0x49')]=function(_0x4105f1,_0x38d87e,_0x3f53b4){var _0x25872d={};var _0x955dbd={};var _0x1b1ef4;var _0x1bcbe9;return db[_0x0c04('0x27')]['findOne']({'where':{'id':_0x4105f1[_0x0c04('0x41')]['id']}})['then'](handleEntityNotFound(_0x38d87e,null))[_0x0c04('0x20')](function(_0x211804){if(_0x211804){_0x1b1ef4=_0x211804;_0x955dbd[_0x0c04('0x2f')]=_[_0x0c04('0x2c')](db[_0x0c04('0x4a')][_0x0c04('0x28')]);_0x955dbd[_0x0c04('0x30')]=_[_0x0c04('0x2c')](_0x4105f1[_0x0c04('0x30')]);_0x955dbd[_0x0c04('0x2d')]=_[_0x0c04('0x2e')](_0x955dbd['model'],_0x955dbd[_0x0c04('0x30')]);_0x25872d['attributes']=_[_0x0c04('0x2e')](_0x955dbd[_0x0c04('0x2f')],qs[_0x0c04('0x31')](_0x4105f1['query'][_0x0c04('0x31')]));_0x25872d[_0x0c04('0x32')]=_0x25872d[_0x0c04('0x32')][_0x0c04('0x33')]?_0x25872d[_0x0c04('0x32')]:_0x955dbd['model'];_0x25872d[_0x0c04('0x36')]=qs[_0x0c04('0x37')](_0x4105f1[_0x0c04('0x30')]['sort']);_0x25872d[_0x0c04('0x38')]=qs['filters'](_['pick'](_0x4105f1[_0x0c04('0x30')],_0x955dbd[_0x0c04('0x2d')]));if(_0x4105f1[_0x0c04('0x30')][_0x0c04('0x3a')]){_0x25872d[_0x0c04('0x38')]=_['merge'](_0x25872d[_0x0c04('0x38')],{'$or':_[_0x0c04('0x26')](_0x25872d[_0x0c04('0x32')],function(_0x4eb54e){var _0x556d5c={};_0x556d5c[_0x4eb54e]={'$like':'%'+_0x4105f1['query'][_0x0c04('0x3a')]+'%'};return _0x556d5c;})});}_0x25872d=_['merge']({},_0x25872d,_0x4105f1[_0x0c04('0x43')]);return _0x1b1ef4['getFields'](_0x25872d);}})[_0x0c04('0x20')](function(_0x550488){if(_0x550488){_0x1bcbe9=_0x550488[_0x0c04('0x33')];if(!_0x4105f1[_0x0c04('0x30')]['hasOwnProperty'](_0x0c04('0x35'))){_0x25872d[_0x0c04('0x18')]=qs[_0x0c04('0x18')](_0x4105f1['query']['limit']);_0x25872d['offset']=qs[_0x0c04('0x16')](_0x4105f1[_0x0c04('0x30')][_0x0c04('0x16')]);}return _0x1b1ef4['getFields'](_0x25872d);}})[_0x0c04('0x20')](function(_0x4b73ee){if(_0x4b73ee){return _0x4b73ee?{'count':_0x1bcbe9,'rows':_0x4b73ee}:null;}})[_0x0c04('0x20')](respondWithResult(_0x38d87e,null))['catch'](handleError(_0x38d87e,null));};exports[_0x0c04('0x4b')]=function(_0x346829,_0xf0bd4e,_0x10b023){var _0x11737b={};var _0x4993f9={};var _0x294d6f;var _0x1d676b;return db[_0x0c04('0x27')][_0x0c04('0x4c')]({'where':{'id':_0x346829[_0x0c04('0x41')]['id']}})['then'](handleEntityNotFound(_0xf0bd4e,null))[_0x0c04('0x20')](function(_0x380b9f){if(_0x380b9f){_0x294d6f=_0x380b9f;_0x4993f9[_0x0c04('0x2f')]=_[_0x0c04('0x2c')](db[_0x0c04('0x4a')]['rawAttributes']);_0x4993f9[_0x0c04('0x30')]=_[_0x0c04('0x2c')](_0x346829[_0x0c04('0x30')]);_0x4993f9['filters']=_[_0x0c04('0x2e')](_0x4993f9['model'],_0x4993f9[_0x0c04('0x30')]);_0x11737b[_0x0c04('0x32')]=_['intersection'](_0x4993f9[_0x0c04('0x2f')],qs['fields'](_0x346829[_0x0c04('0x30')][_0x0c04('0x31')]));_0x11737b['attributes']=_0x11737b['attributes'][_0x0c04('0x33')]?_0x11737b['attributes']:_0x4993f9[_0x0c04('0x2f')];_0x11737b[_0x0c04('0x36')]=qs['sort'](_0x346829[_0x0c04('0x30')]['sort']);_0x11737b[_0x0c04('0x38')]=qs[_0x0c04('0x2d')](_[_0x0c04('0x39')](_0x346829[_0x0c04('0x30')],_0x4993f9[_0x0c04('0x2d')]));if(_0x346829['query'][_0x0c04('0x3a')]){_0x11737b[_0x0c04('0x38')]=_[_0x0c04('0x3b')](_0x11737b[_0x0c04('0x38')],{'$or':_[_0x0c04('0x26')](_0x11737b['attributes'],function(_0x5def41){var _0x46a401={};_0x46a401[_0x5def41]={'$like':'%'+_0x346829[_0x0c04('0x30')][_0x0c04('0x3a')]+'%'};return _0x46a401;})});}_0x11737b=_[_0x0c04('0x3b')]({},_0x11737b,_0x346829[_0x0c04('0x43')]);return _0x294d6f[_0x0c04('0x4b')](_0x11737b);}})[_0x0c04('0x20')](function(_0x15d1a3){if(_0x15d1a3){_0x1d676b=_0x15d1a3[_0x0c04('0x33')];if(!_0x346829[_0x0c04('0x30')][_0x0c04('0x34')](_0x0c04('0x35'))){_0x11737b['limit']=qs[_0x0c04('0x18')](_0x346829[_0x0c04('0x30')][_0x0c04('0x18')]);_0x11737b[_0x0c04('0x16')]=qs[_0x0c04('0x16')](_0x346829[_0x0c04('0x30')][_0x0c04('0x16')]);}return _0x294d6f[_0x0c04('0x4b')](_0x11737b);}})['then'](function(_0x30246d){if(_0x30246d){return _0x30246d?{'count':_0x1d676b,'rows':_0x30246d}:null;}})['then'](respondWithResult(_0xf0bd4e,null))[_0x0c04('0x45')](handleError(_0xf0bd4e,null));};exports[_0x0c04('0x4d')]=function(_0x4f4d19,_0x5de6ed,_0xc4503b){var _0x632314={};var _0x49653b={};var _0x2676e1;var _0x376bfa;return db[_0x0c04('0x27')][_0x0c04('0x4c')]({'where':{'id':_0x4f4d19[_0x0c04('0x41')]['id']}})[_0x0c04('0x20')](handleEntityNotFound(_0x5de6ed,null))['then'](function(_0x5ede2e){if(_0x5ede2e){_0x2676e1=_0x5ede2e;_0x49653b[_0x0c04('0x2f')]=_['keys'](db[_0x0c04('0x4a')][_0x0c04('0x28')]);_0x49653b[_0x0c04('0x30')]=_[_0x0c04('0x2c')](_0x4f4d19[_0x0c04('0x30')]);_0x49653b[_0x0c04('0x2d')]=_[_0x0c04('0x2e')](_0x49653b[_0x0c04('0x2f')],_0x49653b[_0x0c04('0x30')]);_0x632314[_0x0c04('0x32')]=_[_0x0c04('0x2e')](_0x49653b[_0x0c04('0x2f')],qs[_0x0c04('0x31')](_0x4f4d19['query'][_0x0c04('0x31')]));_0x632314['attributes']=_0x632314['attributes'][_0x0c04('0x33')]?_0x632314[_0x0c04('0x32')]:_0x49653b[_0x0c04('0x2f')];_0x632314['order']=qs['sort'](_0x4f4d19[_0x0c04('0x30')][_0x0c04('0x37')]);_0x632314[_0x0c04('0x38')]=qs[_0x0c04('0x2d')](_[_0x0c04('0x39')](_0x4f4d19[_0x0c04('0x30')],_0x49653b[_0x0c04('0x2d')]));if(_0x4f4d19[_0x0c04('0x30')][_0x0c04('0x3a')]){_0x632314[_0x0c04('0x38')]=_[_0x0c04('0x3b')](_0x632314[_0x0c04('0x38')],{'$or':_[_0x0c04('0x26')](_0x632314[_0x0c04('0x32')],function(_0x2d1179){var _0x164aa4={};_0x164aa4[_0x2d1179]={'$like':'%'+_0x4f4d19[_0x0c04('0x30')][_0x0c04('0x3a')]+'%'};return _0x164aa4;})});}_0x632314=_[_0x0c04('0x3b')]({},_0x632314,_0x4f4d19[_0x0c04('0x43')]);return _0x2676e1[_0x0c04('0x4d')](_0x632314);}})[_0x0c04('0x20')](function(_0x1513c8){if(_0x1513c8){_0x376bfa=_0x1513c8[_0x0c04('0x33')];if(!_0x4f4d19[_0x0c04('0x30')][_0x0c04('0x34')](_0x0c04('0x35'))){_0x632314[_0x0c04('0x18')]=qs[_0x0c04('0x18')](_0x4f4d19[_0x0c04('0x30')][_0x0c04('0x18')]);_0x632314[_0x0c04('0x16')]=qs['offset'](_0x4f4d19[_0x0c04('0x30')]['offset']);}return _0x2676e1['getDescriptions'](_0x632314);}})[_0x0c04('0x20')](function(_0x42ac5f){if(_0x42ac5f){return _0x42ac5f?{'count':_0x376bfa,'rows':_0x42ac5f}:null;}})[_0x0c04('0x20')](respondWithResult(_0x5de6ed,null))[_0x0c04('0x45')](handleError(_0x5de6ed,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index fc5a2e8..a0af52d 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 _0xf3cd=['path','rimraf','../../config/environment','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x34aaa8,_0x266a37){var _0x1fc9ce=function(_0x5b0475){while(--_0x5b0475){_0x34aaa8['push'](_0x34aaa8['shift']());}};_0x1fc9ce(++_0x266a37);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x31c3be,_0x5e540f){_0x31c3be=_0x31c3be-0x0;var _0x48314d=_0xf3cd[_0x31c3be];return _0x48314d;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var logger=require(_0xdf3c('0x2'))(_0xdf3c('0x3'));var moment=require(_0xdf3c('0x4'));var BPromise=require(_0xdf3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf3c('0x6'));var rimraf=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xdf3c('0x9')]=function(_0x17d42a,_0x1313d5){return _0x17d42a[_0xdf3c('0xa')](_0xdf3c('0xb'),attributes,{'tableName':_0xdf3c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['request-promise','path','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','../../config/logger','api','moment','bluebird'];(function(_0x38c07f,_0x287ae3){var _0x4eef3a=function(_0x48e052){while(--_0x48e052){_0x38c07f['push'](_0x38c07f['shift']());}};_0x4eef3a(++_0x287ae3);}(_0x9c44,0x178));var _0x49c4=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x9c44[_0x2dea24];return _0x309d58;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 64061f1..a1ec5f3 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 _0xb958=['../../config/environment','jayson/promise','client','http','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x30dfa4,_0x1a6275){var _0x185b37=function(_0x1a8025){while(--_0x1a8025){_0x30dfa4['push'](_0x30dfa4['shift']());}};_0x185b37(++_0x1a6275);}(_0xb958,0xb0));var _0x8b95=function(_0xf55e73,_0x3fecc5){_0xf55e73=_0xf55e73-0x0;var _0x116b99=_0xb958[_0xf55e73];return _0x116b99;};'use strict';var _=require(_0x8b95('0x0'));var util=require('util');var moment=require(_0x8b95('0x1'));var BPromise=require(_0x8b95('0x2'));var rs=require(_0x8b95('0x3'));var fs=require('fs');var Redis=require(_0x8b95('0x4'));var db=require(_0x8b95('0x5'))['db'];var utils=require(_0x8b95('0x6'));var logger=require(_0x8b95('0x7'))('rpc');var config=require(_0x8b95('0x8'));var jayson=require(_0x8b95('0x9'));var client=jayson[_0x8b95('0xa')][_0x8b95('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x202588,_0x5c86e3,_0x209cf4){return new BPromise(function(_0x14f2af,_0x49b3fb){return client['request'](_0x202588,_0x209cf4)[_0x8b95('0xc')](function(_0x672f2c){logger[_0x8b95('0xd')](_0x8b95('0xe'),_0x5c86e3,'request\x20sent');logger[_0x8b95('0xf')](_0x8b95('0x10'),_0x5c86e3,_0x8b95('0x11'),JSON[_0x8b95('0x12')](_0x672f2c));if(_0x672f2c['error']){if(_0x672f2c[_0x8b95('0x13')][_0x8b95('0x14')]===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x5c86e3,_0x672f2c['error'][_0x8b95('0x15')]);return _0x49b3fb(_0x672f2c['error'][_0x8b95('0x15')]);}logger[_0x8b95('0x13')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5c86e3,_0x672f2c['error'][_0x8b95('0x15')]);return _0x14f2af(_0x672f2c[_0x8b95('0x13')][_0x8b95('0x15')]);}else{logger[_0x8b95('0xd')](_0x8b95('0xe'),_0x5c86e3,_0x8b95('0x11'));_0x14f2af(_0x672f2c['result'][_0x8b95('0x15')]);}})[_0x8b95('0x16')](function(_0x181f91){logger[_0x8b95('0x13')](_0x8b95('0xe'),_0x5c86e3,_0x181f91);_0x49b3fb(_0x181f91);});});} \ No newline at end of file +var _0xd312=['rpc','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x1841b9,_0x173b39){var _0x2de1a7=function(_0x4cdfec){while(--_0x4cdfec){_0x1841b9['push'](_0x1841b9['shift']());}};_0x2de1a7(++_0x173b39);}(_0xd312,0x1db));var _0x2d31=function(_0x499e51,_0x33af70){_0x499e51=_0x499e51-0x0;var _0x1fd7d6=_0xd312[_0x499e51];return _0x1fd7d6;};'use strict';var _=require(_0x2d31('0x0'));var util=require(_0x2d31('0x1'));var moment=require(_0x2d31('0x2'));var BPromise=require(_0x2d31('0x3'));var rs=require(_0x2d31('0x4'));var fs=require('fs');var Redis=require(_0x2d31('0x5'));var db=require(_0x2d31('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2d31('0x7'))(_0x2d31('0x8'));var config=require('../../config/environment');var jayson=require(_0x2d31('0x9'));var client=jayson[_0x2d31('0xa')][_0x2d31('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11c199,_0x4e6f65,_0xd7cd13){return new BPromise(function(_0xfec46e,_0x2761e5){return client[_0x2d31('0xc')](_0x11c199,_0xd7cd13)[_0x2d31('0xd')](function(_0x175b4f){logger[_0x2d31('0xe')](_0x2d31('0xf'),_0x4e6f65,_0x2d31('0x10'));logger[_0x2d31('0x11')](_0x2d31('0x12'),_0x4e6f65,_0x2d31('0x10'),JSON['stringify'](_0x175b4f));if(_0x175b4f[_0x2d31('0x13')]){if(_0x175b4f['error'][_0x2d31('0x14')]===0x1f4){logger[_0x2d31('0x13')](_0x2d31('0xf'),_0x4e6f65,_0x175b4f[_0x2d31('0x13')][_0x2d31('0x15')]);return _0x2761e5(_0x175b4f[_0x2d31('0x13')][_0x2d31('0x15')]);}logger[_0x2d31('0x13')](_0x2d31('0xf'),_0x4e6f65,_0x175b4f['error'][_0x2d31('0x15')]);return _0xfec46e(_0x175b4f[_0x2d31('0x13')][_0x2d31('0x15')]);}else{logger[_0x2d31('0xe')](_0x2d31('0xf'),_0x4e6f65,_0x2d31('0x10'));_0xfec46e(_0x175b4f[_0x2d31('0x16')][_0x2d31('0x15')]);}})['catch'](function(_0x5ad885){logger['error'](_0x2d31('0xf'),_0x4e6f65,_0x5ad885);_0x2761e5(_0x5ad885);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 2849616..01446cd 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 _0x25ca=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','index','/:id','show','isAuthenticated','create','destroy','exports','multer'];(function(_0x4814d6,_0xd078e6){var _0x46d6f1=function(_0x4e875b){while(--_0x4e875b){_0x4814d6['push'](_0x4814d6['shift']());}};_0x46d6f1(++_0xd078e6);}(_0x25ca,0x143));var _0xa25c=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x25ca[_0x1beef3];return _0x5af964;};'use strict';var multer=require(_0xa25c('0x0'));var util=require(_0xa25c('0x1'));var path=require(_0xa25c('0x2'));var timeout=require(_0xa25c('0x3'));var express=require(_0xa25c('0x4'));var router=express['Router']();var fs_extra=require(_0xa25c('0x5'));var auth=require(_0xa25c('0x6'));var interaction=require(_0xa25c('0x7'));var config=require(_0xa25c('0x8'));var controller=require(_0xa25c('0x9'));router[_0xa25c('0xa')]('/',auth['isAuthenticated'](),controller[_0xa25c('0xb')]);router[_0xa25c('0xa')](_0xa25c('0xc'),auth['isAuthenticated'](),controller[_0xa25c('0xd')]);router['post']('/',auth[_0xa25c('0xe')](),controller[_0xa25c('0xf')]);router['put']('/:id',auth[_0xa25c('0xe')](),controller['update']);router['delete'](_0xa25c('0xc'),auth['isAuthenticated'](),controller[_0xa25c('0x10')]);module[_0xa25c('0x11')]=router; \ No newline at end of file +var _0xee05=['index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','get','isAuthenticated'];(function(_0xa3591,_0x4c9afa){var _0x2ca46d=function(_0x420145){while(--_0x420145){_0xa3591['push'](_0xa3591['shift']());}};_0x2ca46d(++_0x4c9afa);}(_0xee05,0x17f));var _0x5ee0=function(_0x9fc094,_0x581d11){_0x9fc094=_0x9fc094-0x0;var _0x1a1228=_0xee05[_0x9fc094];return _0x1a1228;};'use strict';var multer=require(_0x5ee0('0x0'));var util=require(_0x5ee0('0x1'));var path=require(_0x5ee0('0x2'));var timeout=require(_0x5ee0('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5ee0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5ee0('0x5'));var config=require('../../config/environment');var controller=require('./intDynamics365Field.controller');router[_0x5ee0('0x6')]('/',auth[_0x5ee0('0x7')](),controller[_0x5ee0('0x8')]);router[_0x5ee0('0x6')](_0x5ee0('0x9'),auth[_0x5ee0('0x7')](),controller[_0x5ee0('0xa')]);router[_0x5ee0('0xb')]('/',auth['isAuthenticated'](),controller[_0x5ee0('0xc')]);router[_0x5ee0('0xd')](_0x5ee0('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x5ee0('0xe')](_0x5ee0('0x9'),auth[_0x5ee0('0x7')](),controller[_0x5ee0('0xf')]);module[_0x5ee0('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index f73eba3..d5dc7b3 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 _0x7b40=['string','variable','customVariable','keyValue','STRING','exports','ENUM'];(function(_0x46feab,_0x151ef7){var _0xef099a=function(_0x3a19ed){while(--_0x3a19ed){_0x46feab['push'](_0x46feab['shift']());}};_0xef099a(++_0x151ef7);}(_0x7b40,0x1a2));var _0x07b4=function(_0x204a7e,_0x580a50){_0x204a7e=_0x204a7e-0x0;var _0x1c0e97=_0x7b40[_0x204a7e];return _0x1c0e97;};'use strict';var Sequelize=require('sequelize');module[_0x07b4('0x0')]={'type':{'type':Sequelize[_0x07b4('0x1')](_0x07b4('0x2'),_0x07b4('0x3'),_0x07b4('0x4'),_0x07b4('0x5'),'picklist'),'defaultValue':_0x07b4('0x2')},'content':{'type':Sequelize[_0x07b4('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x07b4('0x1')](_0x07b4('0x2'),_0x07b4('0x3'),_0x07b4('0x4'))},'keyContent':{'type':Sequelize[_0x07b4('0x6')]},'idField':{'type':Sequelize[_0x07b4('0x6')]},'nameField':{'type':Sequelize[_0x07b4('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x07b4('0x6')]}}; \ No newline at end of file +var _0x604e=['exports','variable','customVariable','keyValue','string','STRING','BOOLEAN'];(function(_0xa54503,_0x1cd0c0){var _0x832ec6=function(_0x25755f){while(--_0x25755f){_0xa54503['push'](_0xa54503['shift']());}};_0x832ec6(++_0x1cd0c0);}(_0x604e,0x173));var _0xe604=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x604e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xe604('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0xe604('0x1'),_0xe604('0x2'),_0xe604('0x3'),'picklist'),'defaultValue':_0xe604('0x4')},'content':{'type':Sequelize[_0xe604('0x5')]},'key':{'type':Sequelize[_0xe604('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xe604('0x4'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xe604('0x5')]},'nameField':{'type':Sequelize[_0xe604('0x5')]},'customField':{'type':Sequelize[_0xe604('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe604('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index d9ebd04..81976b1 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 _0x499e=['include','options','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','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','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','count','limit','status','set','json','apply','reject','update','then','destroy','error','name','send','index','map','Dynamics365Field','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','keys'];(function(_0x9abc2a,_0x27d8dc){var _0x1647f8=function(_0x86be55){while(--_0x86be55){_0x9abc2a['push'](_0x9abc2a['shift']());}};_0x1647f8(++_0x27d8dc);}(_0x499e,0x9e));var _0xe499=function(_0xda8dcb,_0x34e606){_0xda8dcb=_0xda8dcb-0x0;var _0xe5f278=_0x499e[_0xda8dcb];return _0xe5f278;};'use strict';var emlformat=require(_0xe499('0x0'));var rimraf=require(_0xe499('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe499('0x2'));var rp=require(_0xe499('0x3'));var moment=require(_0xe499('0x4'));var BPromise=require(_0xe499('0x5'));var Mustache=require(_0xe499('0x6'));var util=require('util');var path=require(_0xe499('0x7'));var sox=require(_0xe499('0x8'));var csv=require(_0xe499('0x9'));var ejs=require(_0xe499('0xa'));var fs=require('fs');var fs_extra=require(_0xe499('0xb'));var _=require(_0xe499('0xc'));var squel=require(_0xe499('0xd'));var crypto=require(_0xe499('0xe'));var jsforce=require(_0xe499('0xf'));var deskjs=require(_0xe499('0x10'));var toCsv=require(_0xe499('0x9'));var querystring=require(_0xe499('0x11'));var Papa=require('papaparse');var Redis=require(_0xe499('0x12'));var authService=require(_0xe499('0x13'));var qs=require(_0xe499('0x14'));var as=require(_0xe499('0x15'));var hardwareService=require(_0xe499('0x16'));var logger=require('../../config/logger')(_0xe499('0x17'));var utils=require(_0xe499('0x18'));var config=require(_0xe499('0x19'));var licenseUtil=require(_0xe499('0x1a'));var db=require(_0xe499('0x1b'))['db'];function respondWithStatusCode(_0x4345f1,_0x51ab89){_0x51ab89=_0x51ab89||0xcc;return function(_0xb89322){if(_0xb89322){return _0x4345f1[_0xe499('0x1c')](_0x51ab89);}return _0x4345f1['status'](_0x51ab89)[_0xe499('0x1d')]();};}function respondWithResult(_0x276c0c,_0x445e29){_0x445e29=_0x445e29||0xc8;return function(_0x45eb93){if(_0x45eb93){return _0x276c0c['status'](_0x445e29)['json'](_0x45eb93);}};}function respondWithFilteredResult(_0x3ef5e5,_0x1d97c7){return function(_0x53f3d6){if(_0x53f3d6){var _0x47ba0c=typeof _0x1d97c7[_0xe499('0x1e')]===_0xe499('0x1f')&&typeof _0x1d97c7['limit']===_0xe499('0x1f');var _0x33c907=_0x53f3d6[_0xe499('0x20')];var _0x9f065=_0x47ba0c?0x0:_0x1d97c7[_0xe499('0x1e')];var _0x2fc842=_0x47ba0c?_0x53f3d6[_0xe499('0x20')]:_0x1d97c7[_0xe499('0x1e')]+_0x1d97c7[_0xe499('0x21')];var _0x29664f;if(_0x2fc842>=_0x33c907){_0x2fc842=_0x33c907;_0x29664f=0xc8;}else{_0x29664f=0xce;}_0x3ef5e5[_0xe499('0x22')](_0x29664f);return _0x3ef5e5[_0xe499('0x23')]('Content-Range',_0x9f065+'-'+_0x2fc842+'/'+_0x33c907)[_0xe499('0x24')](_0x53f3d6);}return null;};}function patchUpdates(_0x89e11a){return function(_0x269c44){try{jsonpatch[_0xe499('0x25')](_0x269c44,_0x89e11a,!![]);}catch(_0x2d2fbe){return BPromise[_0xe499('0x26')](_0x2d2fbe);}return _0x269c44['save']();};}function saveUpdates(_0x1fee3b,_0x4bf495){return function(_0x2c7822){if(_0x2c7822){return _0x2c7822[_0xe499('0x27')](_0x1fee3b)[_0xe499('0x28')](function(_0xd86492){return _0xd86492;});}return null;};}function removeEntity(_0x58c59b,_0x2e7baf){return function(_0x20d498){if(_0x20d498){return _0x20d498[_0xe499('0x29')]()[_0xe499('0x28')](function(){_0x58c59b[_0xe499('0x22')](0xcc)[_0xe499('0x1d')]();});}};}function handleEntityNotFound(_0x4ddce8,_0x48606b){return function(_0x1514fb){if(!_0x1514fb){_0x4ddce8['sendStatus'](0x194);}return _0x1514fb;};}function handleError(_0x1e7e20,_0x4ffd8c){_0x4ffd8c=_0x4ffd8c||0x1f4;return function(_0x4c4700){logger[_0xe499('0x2a')](_0x4c4700['stack']);if(_0x4c4700[_0xe499('0x2b')]){delete _0x4c4700[_0xe499('0x2b')];}_0x1e7e20[_0xe499('0x22')](_0x4ffd8c)[_0xe499('0x2c')](_0x4c4700);};}exports[_0xe499('0x2d')]=function(_0x2be85c,_0x1fc8eb){var _0x804d77={},_0x55726c={},_0x128881={'count':0x0,'rows':[]};var _0x51265e=_[_0xe499('0x2e')](db[_0xe499('0x2f')][_0xe499('0x30')],function(_0x2e6666){return{'name':_0x2e6666['fieldName'],'type':_0x2e6666[_0xe499('0x31')][_0xe499('0x32')]};});_0x55726c[_0xe499('0x33')]=_['map'](_0x51265e,_0xe499('0x2b'));_0x55726c[_0xe499('0x34')]=_['keys'](_0x2be85c[_0xe499('0x34')]);_0x55726c['filters']=_[_0xe499('0x35')](_0x55726c[_0xe499('0x33')],_0x55726c['query']);_0x804d77[_0xe499('0x36')]=_[_0xe499('0x35')](_0x55726c[_0xe499('0x33')],qs[_0xe499('0x37')](_0x2be85c[_0xe499('0x34')][_0xe499('0x37')]));_0x804d77[_0xe499('0x36')]=_0x804d77['attributes'][_0xe499('0x38')]?_0x804d77[_0xe499('0x36')]:_0x55726c[_0xe499('0x33')];if(!_0x2be85c[_0xe499('0x34')][_0xe499('0x39')](_0xe499('0x3a'))){_0x804d77[_0xe499('0x21')]=qs[_0xe499('0x21')](_0x2be85c[_0xe499('0x34')]['limit']);_0x804d77[_0xe499('0x1e')]=qs[_0xe499('0x1e')](_0x2be85c[_0xe499('0x34')][_0xe499('0x1e')]);}_0x804d77[_0xe499('0x3b')]=qs[_0xe499('0x3c')](_0x2be85c[_0xe499('0x34')][_0xe499('0x3c')]);_0x804d77[_0xe499('0x3d')]=qs[_0xe499('0x3e')](_[_0xe499('0x3f')](_0x2be85c[_0xe499('0x34')],_0x55726c[_0xe499('0x3e')]),_0x51265e);if(_0x2be85c[_0xe499('0x34')][_0xe499('0x40')]){_0x804d77['where']=_[_0xe499('0x41')](_0x804d77[_0xe499('0x3d')],{'$or':_['map'](_0x51265e,function(_0x5e30a1){if(_0x5e30a1[_0xe499('0x31')]!==_0xe499('0x42')){var _0x72ca26={};_0x72ca26[_0x5e30a1[_0xe499('0x2b')]]={'$like':'%'+_0x2be85c[_0xe499('0x34')][_0xe499('0x40')]+'%'};return _0x72ca26;}})});}_0x804d77=_[_0xe499('0x41')]({},_0x804d77,_0x2be85c['options']);var _0x47510a={'where':_0x804d77['where']};return db[_0xe499('0x2f')]['count'](_0x47510a)['then'](function(_0x5457bb){_0x128881[_0xe499('0x20')]=_0x5457bb;if(_0x2be85c[_0xe499('0x34')][_0xe499('0x43')]){_0x804d77['include']=[{'all':!![]}];}return db[_0xe499('0x2f')][_0xe499('0x44')](_0x804d77);})['then'](function(_0x333583){_0x128881['rows']=_0x333583;return _0x128881;})[_0xe499('0x28')](respondWithFilteredResult(_0x1fc8eb,_0x804d77))[_0xe499('0x45')](handleError(_0x1fc8eb,null));};exports[_0xe499('0x46')]=function(_0x2f12d3,_0x5981c7){var _0x433008={'raw':!![],'where':{'id':_0x2f12d3[_0xe499('0x47')]['id']}},_0x1bd532={};_0x1bd532[_0xe499('0x33')]=_[_0xe499('0x48')](db[_0xe499('0x2f')][_0xe499('0x30')]);_0x1bd532[_0xe499('0x34')]=_['keys'](_0x2f12d3[_0xe499('0x34')]);_0x1bd532[_0xe499('0x3e')]=_[_0xe499('0x35')](_0x1bd532[_0xe499('0x33')],_0x1bd532[_0xe499('0x34')]);_0x433008[_0xe499('0x36')]=_[_0xe499('0x35')](_0x1bd532[_0xe499('0x33')],qs[_0xe499('0x37')](_0x2f12d3[_0xe499('0x34')][_0xe499('0x37')]));_0x433008[_0xe499('0x36')]=_0x433008[_0xe499('0x36')][_0xe499('0x38')]?_0x433008[_0xe499('0x36')]:_0x1bd532[_0xe499('0x33')];if(_0x2f12d3[_0xe499('0x34')][_0xe499('0x43')]){_0x433008[_0xe499('0x49')]=[{'all':!![]}];}_0x433008=_[_0xe499('0x41')]({},_0x433008,_0x2f12d3[_0xe499('0x4a')]);return db[_0xe499('0x2f')]['find'](_0x433008)[_0xe499('0x28')](handleEntityNotFound(_0x5981c7,null))['then'](respondWithResult(_0x5981c7,null))[_0xe499('0x45')](handleError(_0x5981c7,null));};exports['create']=function(_0x346f3c,_0x20ab39){return db[_0xe499('0x2f')][_0xe499('0x4b')](_0x346f3c[_0xe499('0x4c')],{})['then'](respondWithResult(_0x20ab39,0xc9))['catch'](handleError(_0x20ab39,null));};exports[_0xe499('0x27')]=function(_0x42b832,_0x45334f){if(_0x42b832[_0xe499('0x4c')]['id']){delete _0x42b832[_0xe499('0x4c')]['id'];}return db[_0xe499('0x2f')]['find']({'where':{'id':_0x42b832[_0xe499('0x47')]['id']}})[_0xe499('0x28')](handleEntityNotFound(_0x45334f,null))[_0xe499('0x28')](saveUpdates(_0x42b832[_0xe499('0x4c')],null))['then'](respondWithResult(_0x45334f,null))[_0xe499('0x45')](handleError(_0x45334f,null));};exports[_0xe499('0x29')]=function(_0x4237a6,_0x3c2c90){return db['Dynamics365Field']['find']({'where':{'id':_0x4237a6[_0xe499('0x47')]['id']}})['then'](handleEntityNotFound(_0x3c2c90,null))['then'](removeEntity(_0x3c2c90,null))['catch'](handleError(_0x3c2c90,null));}; \ No newline at end of file +var _0xe967=['keys','intersection','fields','attributes','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','include','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','apply','save','then','destroy','end','sendStatus','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','type','key','model','query'];(function(_0x5cc58c,_0x1395d0){var _0x1f6f17=function(_0x2fcdf5){while(--_0x2fcdf5){_0x5cc58c['push'](_0x5cc58c['shift']());}};_0x1f6f17(++_0x1395d0);}(_0xe967,0xa3));var _0x7e96=function(_0x85fbb2,_0x55d447){_0x85fbb2=_0x85fbb2-0x0;var _0x2c94e5=_0xe967[_0x85fbb2];return _0x2c94e5;};'use strict';var emlformat=require(_0x7e96('0x0'));var rimraf=require(_0x7e96('0x1'));var zipdir=require(_0x7e96('0x2'));var jsonpatch=require(_0x7e96('0x3'));var rp=require(_0x7e96('0x4'));var moment=require(_0x7e96('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7e96('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x7e96('0x7'));var ejs=require(_0x7e96('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7e96('0x9'));var squel=require(_0x7e96('0xa'));var crypto=require(_0x7e96('0xb'));var jsforce=require(_0x7e96('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7e96('0x7'));var querystring=require(_0x7e96('0xd'));var Papa=require('papaparse');var Redis=require(_0x7e96('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7e96('0xf'));var as=require(_0x7e96('0x10'));var hardwareService=require(_0x7e96('0x11'));var logger=require(_0x7e96('0x12'))('api');var utils=require(_0x7e96('0x13'));var config=require(_0x7e96('0x14'));var licenseUtil=require(_0x7e96('0x15'));var db=require(_0x7e96('0x16'))['db'];function respondWithStatusCode(_0x7051d9,_0x5ce4aa){_0x5ce4aa=_0x5ce4aa||0xcc;return function(_0x59ca75){if(_0x59ca75){return _0x7051d9['sendStatus'](_0x5ce4aa);}return _0x7051d9[_0x7e96('0x17')](_0x5ce4aa)['end']();};}function respondWithResult(_0x5352d8,_0x27b896){_0x27b896=_0x27b896||0xc8;return function(_0x5d3ec8){if(_0x5d3ec8){return _0x5352d8['status'](_0x27b896)['json'](_0x5d3ec8);}};}function respondWithFilteredResult(_0x51f010,_0x4a0510){return function(_0x4f0478){if(_0x4f0478){var _0x5778aa=typeof _0x4a0510[_0x7e96('0x18')]===_0x7e96('0x19')&&typeof _0x4a0510[_0x7e96('0x1a')]===_0x7e96('0x19');var _0x407039=_0x4f0478['count'];var _0x32e91b=_0x5778aa?0x0:_0x4a0510[_0x7e96('0x18')];var _0x3d6f09=_0x5778aa?_0x4f0478[_0x7e96('0x1b')]:_0x4a0510['offset']+_0x4a0510['limit'];var _0x39b82b;if(_0x3d6f09>=_0x407039){_0x3d6f09=_0x407039;_0x39b82b=0xc8;}else{_0x39b82b=0xce;}_0x51f010['status'](_0x39b82b);return _0x51f010[_0x7e96('0x1c')]('Content-Range',_0x32e91b+'-'+_0x3d6f09+'/'+_0x407039)['json'](_0x4f0478);}return null;};}function patchUpdates(_0x125121){return function(_0x32015e){try{jsonpatch[_0x7e96('0x1d')](_0x32015e,_0x125121,!![]);}catch(_0x2f01d7){return BPromise['reject'](_0x2f01d7);}return _0x32015e[_0x7e96('0x1e')]();};}function saveUpdates(_0x3ed023,_0x59fb99){return function(_0x44f29c){if(_0x44f29c){return _0x44f29c['update'](_0x3ed023)[_0x7e96('0x1f')](function(_0x2255be){return _0x2255be;});}return null;};}function removeEntity(_0x58dc05,_0x3d3800){return function(_0x1d894d){if(_0x1d894d){return _0x1d894d[_0x7e96('0x20')]()['then'](function(){_0x58dc05[_0x7e96('0x17')](0xcc)[_0x7e96('0x21')]();});}};}function handleEntityNotFound(_0xa04d72,_0x41a83d){return function(_0x11dc04){if(!_0x11dc04){_0xa04d72[_0x7e96('0x22')](0x194);}return _0x11dc04;};}function handleError(_0x5b6017,_0x1a2e52){_0x1a2e52=_0x1a2e52||0x1f4;return function(_0x2131b9){logger[_0x7e96('0x23')](_0x2131b9[_0x7e96('0x24')]);if(_0x2131b9['name']){delete _0x2131b9[_0x7e96('0x25')];}_0x5b6017[_0x7e96('0x17')](_0x1a2e52)[_0x7e96('0x26')](_0x2131b9);};}exports[_0x7e96('0x27')]=function(_0x1b1ede,_0x3aa481){var _0x463b0c={},_0x1e8210={},_0x16fc7d={'count':0x0,'rows':[]};var _0x536b94=_[_0x7e96('0x28')](db[_0x7e96('0x29')][_0x7e96('0x2a')],function(_0x2e3dfb){return{'name':_0x2e3dfb['fieldName'],'type':_0x2e3dfb[_0x7e96('0x2b')][_0x7e96('0x2c')]};});_0x1e8210[_0x7e96('0x2d')]=_[_0x7e96('0x28')](_0x536b94,'name');_0x1e8210[_0x7e96('0x2e')]=_[_0x7e96('0x2f')](_0x1b1ede['query']);_0x1e8210['filters']=_[_0x7e96('0x30')](_0x1e8210[_0x7e96('0x2d')],_0x1e8210[_0x7e96('0x2e')]);_0x463b0c['attributes']=_[_0x7e96('0x30')](_0x1e8210[_0x7e96('0x2d')],qs[_0x7e96('0x31')](_0x1b1ede[_0x7e96('0x2e')][_0x7e96('0x31')]));_0x463b0c[_0x7e96('0x32')]=_0x463b0c[_0x7e96('0x32')][_0x7e96('0x33')]?_0x463b0c[_0x7e96('0x32')]:_0x1e8210[_0x7e96('0x2d')];if(!_0x1b1ede['query']['hasOwnProperty'](_0x7e96('0x34'))){_0x463b0c[_0x7e96('0x1a')]=qs[_0x7e96('0x1a')](_0x1b1ede[_0x7e96('0x2e')][_0x7e96('0x1a')]);_0x463b0c[_0x7e96('0x18')]=qs['offset'](_0x1b1ede[_0x7e96('0x2e')][_0x7e96('0x18')]);}_0x463b0c['order']=qs[_0x7e96('0x35')](_0x1b1ede['query'][_0x7e96('0x35')]);_0x463b0c[_0x7e96('0x36')]=qs[_0x7e96('0x37')](_[_0x7e96('0x38')](_0x1b1ede[_0x7e96('0x2e')],_0x1e8210[_0x7e96('0x37')]),_0x536b94);if(_0x1b1ede[_0x7e96('0x2e')][_0x7e96('0x39')]){_0x463b0c[_0x7e96('0x36')]=_[_0x7e96('0x3a')](_0x463b0c[_0x7e96('0x36')],{'$or':_[_0x7e96('0x28')](_0x536b94,function(_0x2fe8bc){if(_0x2fe8bc[_0x7e96('0x2b')]!==_0x7e96('0x3b')){var _0x51008d={};_0x51008d[_0x2fe8bc[_0x7e96('0x25')]]={'$like':'%'+_0x1b1ede[_0x7e96('0x2e')][_0x7e96('0x39')]+'%'};return _0x51008d;}})});}_0x463b0c=_[_0x7e96('0x3a')]({},_0x463b0c,_0x1b1ede[_0x7e96('0x3c')]);var _0x4ba487={'where':_0x463b0c[_0x7e96('0x36')]};return db[_0x7e96('0x29')]['count'](_0x4ba487)[_0x7e96('0x1f')](function(_0x1f307e){_0x16fc7d[_0x7e96('0x1b')]=_0x1f307e;if(_0x1b1ede['query'][_0x7e96('0x3d')]){_0x463b0c['include']=[{'all':!![]}];}return db[_0x7e96('0x29')]['findAll'](_0x463b0c);})[_0x7e96('0x1f')](function(_0x5081e8){_0x16fc7d[_0x7e96('0x3e')]=_0x5081e8;return _0x16fc7d;})[_0x7e96('0x1f')](respondWithFilteredResult(_0x3aa481,_0x463b0c))[_0x7e96('0x3f')](handleError(_0x3aa481,null));};exports[_0x7e96('0x40')]=function(_0x23c8d9,_0x22e588){var _0x3fa7bb={'raw':!![],'where':{'id':_0x23c8d9[_0x7e96('0x41')]['id']}},_0x3eff30={};_0x3eff30[_0x7e96('0x2d')]=_[_0x7e96('0x2f')](db['Dynamics365Field']['rawAttributes']);_0x3eff30[_0x7e96('0x2e')]=_[_0x7e96('0x2f')](_0x23c8d9[_0x7e96('0x2e')]);_0x3eff30[_0x7e96('0x37')]=_[_0x7e96('0x30')](_0x3eff30[_0x7e96('0x2d')],_0x3eff30['query']);_0x3fa7bb[_0x7e96('0x32')]=_[_0x7e96('0x30')](_0x3eff30[_0x7e96('0x2d')],qs[_0x7e96('0x31')](_0x23c8d9['query'][_0x7e96('0x31')]));_0x3fa7bb[_0x7e96('0x32')]=_0x3fa7bb['attributes'][_0x7e96('0x33')]?_0x3fa7bb[_0x7e96('0x32')]:_0x3eff30[_0x7e96('0x2d')];if(_0x23c8d9['query']['includeAll']){_0x3fa7bb[_0x7e96('0x42')]=[{'all':!![]}];}_0x3fa7bb=_[_0x7e96('0x3a')]({},_0x3fa7bb,_0x23c8d9[_0x7e96('0x3c')]);return db['Dynamics365Field']['find'](_0x3fa7bb)[_0x7e96('0x1f')](handleEntityNotFound(_0x22e588,null))[_0x7e96('0x1f')](respondWithResult(_0x22e588,null))['catch'](handleError(_0x22e588,null));};exports[_0x7e96('0x43')]=function(_0x393203,_0x59e9c4){return db[_0x7e96('0x29')][_0x7e96('0x43')](_0x393203[_0x7e96('0x44')],{})[_0x7e96('0x1f')](respondWithResult(_0x59e9c4,0xc9))[_0x7e96('0x3f')](handleError(_0x59e9c4,null));};exports['update']=function(_0x3f0cdd,_0x10fa48){if(_0x3f0cdd[_0x7e96('0x44')]['id']){delete _0x3f0cdd[_0x7e96('0x44')]['id'];}return db[_0x7e96('0x29')][_0x7e96('0x45')]({'where':{'id':_0x3f0cdd['params']['id']}})[_0x7e96('0x1f')](handleEntityNotFound(_0x10fa48,null))[_0x7e96('0x1f')](saveUpdates(_0x3f0cdd[_0x7e96('0x44')],null))[_0x7e96('0x1f')](respondWithResult(_0x10fa48,null))[_0x7e96('0x3f')](handleError(_0x10fa48,null));};exports[_0x7e96('0x20')]=function(_0x5ed16f,_0x2513cf){return db[_0x7e96('0x29')][_0x7e96('0x45')]({'where':{'id':_0x5ed16f[_0x7e96('0x41')]['id']}})[_0x7e96('0x1f')](handleEntityNotFound(_0x2513cf,null))['then'](removeEntity(_0x2513cf,null))[_0x7e96('0x3f')](handleError(_0x2513cf,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index c978098..27663b3 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 _0x253a=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','idField','FieldId','lodash'];(function(_0x40c5f5,_0x1cfc46){var _0x64d316=function(_0xe1406e){while(--_0xe1406e){_0x40c5f5['push'](_0x40c5f5['shift']());}};_0x64d316(++_0x1cfc46);}(_0x253a,0x117));var _0xa253=function(_0x4244b1,_0x555b5c){_0x4244b1=_0x4244b1-0x0;var _0x25cfac=_0x253a[_0x4244b1];return _0x25cfac;};'use strict';var _=require(_0xa253('0x0'));var util=require('util');var logger=require(_0xa253('0x1'))(_0xa253('0x2'));var moment=require(_0xa253('0x3'));var BPromise=require(_0xa253('0x4'));var rp=require(_0xa253('0x5'));var fs=require('fs');var path=require(_0xa253('0x6'));var rimraf=require('rimraf');var config=require(_0xa253('0x7'));var attributes=require(_0xa253('0x8'));module[_0xa253('0x9')]=function(_0x192e07,_0x5855c2){return _0x192e07[_0xa253('0xa')](_0xa253('0xb'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0xa253('0xc'),_0xa253('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0811=['../../config/logger','api','moment','bluebird','rimraf','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','lodash','util'];(function(_0x813d0a,_0x4fd3d7){var _0x241352=function(_0x3ca375){while(--_0x3ca375){_0x813d0a['push'](_0x813d0a['shift']());}};_0x241352(++_0x4fd3d7);}(_0x0811,0x11c));var _0x1081=function(_0x5a56cc,_0x29650c){_0x5a56cc=_0x5a56cc-0x0;var _0x589caa=_0x0811[_0x5a56cc];return _0x589caa;};'use strict';var _=require(_0x1081('0x0'));var util=require(_0x1081('0x1'));var logger=require(_0x1081('0x2'))(_0x1081('0x3'));var moment=require(_0x1081('0x4'));var BPromise=require(_0x1081('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1081('0x6'));var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module['exports']=function(_0x3ef570,_0x55e25d){return _0x3ef570[_0x1081('0x7')](_0x1081('0x8'),attributes,{'tableName':_0x1081('0x9'),'paranoid':![],'indexes':[{'name':_0x1081('0xa'),'fields':['idField','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 6bfb2d9..bc4a1fa 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 _0x348d=['code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x482b6c,_0xdf3672){var _0x177bc6=function(_0x18d261){while(--_0x18d261){_0x482b6c['push'](_0x482b6c['shift']());}};_0x177bc6(++_0xdf3672);}(_0x348d,0x15d));var _0xd348=function(_0x3f2fea,_0x3c4ea8){_0x3f2fea=_0x3f2fea-0x0;var _0x69a4d5=_0x348d[_0x3f2fea];return _0x69a4d5;};'use strict';var _=require(_0xd348('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd348('0x1'));var rs=require(_0xd348('0x2'));var fs=require('fs');var Redis=require(_0xd348('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd348('0x4'));var logger=require(_0xd348('0x5'))(_0xd348('0x6'));var config=require(_0xd348('0x7'));var jayson=require(_0xd348('0x8'));var client=jayson[_0xd348('0x9')][_0xd348('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x367504,_0x10b7df,_0x566ae7){return new BPromise(function(_0x28641c,_0x5c99a7){return client[_0xd348('0xb')](_0x367504,_0x566ae7)[_0xd348('0xc')](function(_0x30b08c){logger[_0xd348('0xd')](_0xd348('0xe'),_0x10b7df,_0xd348('0xf'));logger['debug'](_0xd348('0x10'),_0x10b7df,_0xd348('0xf'),JSON[_0xd348('0x11')](_0x30b08c));if(_0x30b08c['error']){if(_0x30b08c[_0xd348('0x12')][_0xd348('0x13')]===0x1f4){logger[_0xd348('0x12')](_0xd348('0xe'),_0x10b7df,_0x30b08c[_0xd348('0x12')][_0xd348('0x14')]);return _0x5c99a7(_0x30b08c[_0xd348('0x12')]['message']);}logger[_0xd348('0x12')](_0xd348('0xe'),_0x10b7df,_0x30b08c[_0xd348('0x12')][_0xd348('0x14')]);return _0x28641c(_0x30b08c[_0xd348('0x12')][_0xd348('0x14')]);}else{logger['info'](_0xd348('0xe'),_0x10b7df,_0xd348('0xf'));_0x28641c(_0x30b08c[_0xd348('0x15')][_0xd348('0x14')]);}})[_0xd348('0x16')](function(_0x578959){logger[_0xd348('0x12')](_0xd348('0xe'),_0x10b7df,_0x578959);_0x5c99a7(_0x578959);});});} \ No newline at end of file +var _0x7674=['lodash','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','client','request','info','Dynamics365Field,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch'];(function(_0x11f238,_0x418d9f){var _0x201974=function(_0x4bb85d){while(--_0x4bb85d){_0x11f238['push'](_0x11f238['shift']());}};_0x201974(++_0x418d9f);}(_0x7674,0x7e));var _0x4767=function(_0x461467,_0x81d0dd){_0x461467=_0x461467-0x0;var _0x5c47da=_0x7674[_0x461467];return _0x5c47da;};'use strict';var _=require(_0x4767('0x0'));var util=require(_0x4767('0x1'));var moment=require(_0x4767('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4767('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4767('0x4'));var logger=require(_0x4767('0x5'))('rpc');var config=require(_0x4767('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4767('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x444304,_0x19a6fc,_0x105e01){return new BPromise(function(_0x3e629e,_0x33d2c6){return client[_0x4767('0x8')](_0x444304,_0x105e01)['then'](function(_0xf3e103){logger[_0x4767('0x9')](_0x4767('0xa'),_0x19a6fc,'request\x20sent');logger[_0x4767('0xb')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x19a6fc,_0x4767('0xc'),JSON[_0x4767('0xd')](_0xf3e103));if(_0xf3e103[_0x4767('0xe')]){if(_0xf3e103[_0x4767('0xe')][_0x4767('0xf')]===0x1f4){logger[_0x4767('0xe')](_0x4767('0xa'),_0x19a6fc,_0xf3e103[_0x4767('0xe')]['message']);return _0x33d2c6(_0xf3e103[_0x4767('0xe')][_0x4767('0x10')]);}logger[_0x4767('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x19a6fc,_0xf3e103[_0x4767('0xe')][_0x4767('0x10')]);return _0x3e629e(_0xf3e103[_0x4767('0xe')][_0x4767('0x10')]);}else{logger[_0x4767('0x9')](_0x4767('0xa'),_0x19a6fc,_0x4767('0xc'));_0x3e629e(_0xf3e103['result'][_0x4767('0x10')]);}})[_0x4767('0x11')](function(_0x53eee7){logger[_0x4767('0xe')](_0x4767('0xa'),_0x19a6fc,_0x53eee7);_0x33d2c6(_0x53eee7);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 2c98e52..9fd1e16 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 _0x3acc=['path','express','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','delete','destroy','exports','multer','util'];(function(_0x197234,_0x3d2e7b){var _0xa65185=function(_0x56af94){while(--_0x56af94){_0x197234['push'](_0x197234['shift']());}};_0xa65185(++_0x3d2e7b);}(_0x3acc,0xc6));var _0xc3ac=function(_0x2cc294,_0x17e7cc){_0x2cc294=_0x2cc294-0x0;var _0x39246c=_0x3acc[_0x2cc294];return _0x39246c;};'use strict';var multer=require(_0xc3ac('0x0'));var util=require(_0xc3ac('0x1'));var path=require(_0xc3ac('0x2'));var timeout=require('connect-timeout');var express=require(_0xc3ac('0x3'));var router=express['Router']();var fs_extra=require(_0xc3ac('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc3ac('0x5'));var controller=require('./intFreshdeskAccount.controller');router[_0xc3ac('0x6')]('/',auth[_0xc3ac('0x7')](),controller[_0xc3ac('0x8')]);router[_0xc3ac('0x6')](_0xc3ac('0x9'),auth[_0xc3ac('0x7')](),controller[_0xc3ac('0xa')]);router[_0xc3ac('0x6')](_0xc3ac('0xb'),auth[_0xc3ac('0x7')](),controller['getConfigurations']);router['get'](_0xc3ac('0xc'),auth[_0xc3ac('0x7')](),controller[_0xc3ac('0xd')]);router[_0xc3ac('0xe')]('/',auth[_0xc3ac('0x7')](),controller[_0xc3ac('0xf')]);router[_0xc3ac('0xe')](_0xc3ac('0xb'),auth['isAuthenticated'](),controller[_0xc3ac('0x10')]);router['put'](_0xc3ac('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xc3ac('0x11')](_0xc3ac('0x9'),auth[_0xc3ac('0x7')](),controller[_0xc3ac('0x12')]);module[_0xc3ac('0x13')]=router; \ No newline at end of file +var _0x7edd=['../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3fca50,_0x46005d){var _0x386d17=function(_0x313ccc){while(--_0x313ccc){_0x3fca50['push'](_0x3fca50['shift']());}};_0x386d17(++_0x46005d);}(_0x7edd,0x84));var _0xd7ed=function(_0x5f4409,_0x20b8b8){_0x5f4409=_0x5f4409-0x0;var _0x2a232e=_0x7edd[_0x5f4409];return _0x2a232e;};'use strict';var multer=require(_0xd7ed('0x0'));var util=require('util');var path=require(_0xd7ed('0x1'));var timeout=require('connect-timeout');var express=require(_0xd7ed('0x2'));var router=express[_0xd7ed('0x3')]();var fs_extra=require(_0xd7ed('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd7ed('0x5'));var config=require(_0xd7ed('0x6'));var controller=require(_0xd7ed('0x7'));router[_0xd7ed('0x8')]('/',auth[_0xd7ed('0x9')](),controller['index']);router[_0xd7ed('0x8')](_0xd7ed('0xa'),auth[_0xd7ed('0x9')](),controller[_0xd7ed('0xb')]);router['get'](_0xd7ed('0xc'),auth[_0xd7ed('0x9')](),controller[_0xd7ed('0xd')]);router[_0xd7ed('0x8')](_0xd7ed('0xe'),auth[_0xd7ed('0x9')](),controller[_0xd7ed('0xf')]);router[_0xd7ed('0x10')]('/',auth[_0xd7ed('0x9')](),controller[_0xd7ed('0x11')]);router[_0xd7ed('0x10')](_0xd7ed('0xc'),auth['isAuthenticated'](),controller[_0xd7ed('0x12')]);router[_0xd7ed('0x13')](_0xd7ed('0xa'),auth[_0xd7ed('0x9')](),controller[_0xd7ed('0x14')]);router[_0xd7ed('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xd7ed('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index bad64b4..ce02aa4 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 _0x781d=['sequelize','exports','STRING','username','remoteUri'];(function(_0x12ad1b,_0x106d01){var _0x22efbb=function(_0x468f70){while(--_0x468f70){_0x12ad1b['push'](_0x12ad1b['shift']());}};_0x22efbb(++_0x106d01);}(_0x781d,0x14a));var _0xd781=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x781d[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0xd781('0x0'));module[_0xd781('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd781('0x2')],'unique':_0xd781('0x3')},'apiKey':{'type':Sequelize[_0xd781('0x2')]},'remoteUri':{'type':Sequelize[_0xd781('0x2')],'unique':_0xd781('0x4')},'serverUrl':{'type':Sequelize[_0xd781('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x8e3f=['STRING','username','remoteUri','sequelize','exports'];(function(_0x399411,_0x13738a){var _0x13f906=function(_0x285b58){while(--_0x285b58){_0x399411['push'](_0x399411['shift']());}};_0x13f906(++_0x13738a);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x8e3f[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0xf8e3('0x0'));module[_0xf8e3('0x1')]={'name':{'type':Sequelize[_0xf8e3('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf8e3('0x2')],'unique':_0xf8e3('0x3')},'apiKey':{'type':Sequelize[_0xf8e3('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xf8e3('0x4')},'serverUrl':{'type':Sequelize[_0xf8e3('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 d2f4a31..0a1eb98 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 _0x153c=['Descriptions','remoteUri','apiKey','slice','substring','lastIndexOf','format','%s/%s','toString','base64','subject','agent','description','priority','group','source','ticket_type','company','remove','custom_text','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','name','send','index','map','FreshdeskAccount','fieldName','type','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','options','create','body','find','getConfigurations','findOne','AccountId','getSubjects','channel','getDescriptions','FreshdeskConfiguration','FreshdeskField'];(function(_0x308ca4,_0x57770b){var _0x4086a9=function(_0x31014b){while(--_0x31014b){_0x308ca4['push'](_0x308ca4['shift']());}};_0x4086a9(++_0x57770b);}(_0x153c,0x8c));var _0xc153=function(_0x24b2d2,_0x22fd7e){_0x24b2d2=_0x24b2d2-0x0;var _0x14c929=_0x153c[_0x24b2d2];return _0x14c929;};'use strict';var emlformat=require(_0xc153('0x0'));var rimraf=require(_0xc153('0x1'));var zipdir=require(_0xc153('0x2'));var jsonpatch=require(_0xc153('0x3'));var rp=require('request-promise');var moment=require(_0xc153('0x4'));var BPromise=require(_0xc153('0x5'));var Mustache=require(_0xc153('0x6'));var util=require(_0xc153('0x7'));var path=require(_0xc153('0x8'));var sox=require(_0xc153('0x9'));var csv=require(_0xc153('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc153('0xb'));var _=require(_0xc153('0xc'));var squel=require(_0xc153('0xd'));var crypto=require(_0xc153('0xe'));var jsforce=require(_0xc153('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc153('0x10'));var Redis=require(_0xc153('0x11'));var authService=require(_0xc153('0x12'));var qs=require(_0xc153('0x13'));var as=require(_0xc153('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc153('0x15'));var utils=require(_0xc153('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc153('0x17'));var db=require(_0xc153('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x49286f,_0x1c9d09){_0x1c9d09=_0x1c9d09||0xcc;return function(_0x1f7c65){if(_0x1f7c65){return _0x49286f[_0xc153('0x19')](_0x1c9d09);}return _0x49286f['status'](_0x1c9d09)[_0xc153('0x1a')]();};}function respondWithResult(_0xaa835a,_0x1c7d6c){_0x1c7d6c=_0x1c7d6c||0xc8;return function(_0x4e4a09){if(_0x4e4a09){return _0xaa835a[_0xc153('0x1b')](_0x1c7d6c)[_0xc153('0x1c')](_0x4e4a09);}};}function respondWithFilteredResult(_0x5b74a2,_0x51a814){return function(_0x41c1a3){if(_0x41c1a3){var _0x12d901=typeof _0x51a814[_0xc153('0x1d')]===_0xc153('0x1e')&&typeof _0x51a814[_0xc153('0x1f')]===_0xc153('0x1e');var _0x4804bc=_0x41c1a3[_0xc153('0x20')];var _0x54466a=_0x12d901?0x0:_0x51a814[_0xc153('0x1d')];var _0x16cfce=_0x12d901?_0x41c1a3[_0xc153('0x20')]:_0x51a814['offset']+_0x51a814[_0xc153('0x1f')];var _0x4aa563;if(_0x16cfce>=_0x4804bc){_0x16cfce=_0x4804bc;_0x4aa563=0xc8;}else{_0x4aa563=0xce;}_0x5b74a2['status'](_0x4aa563);return _0x5b74a2[_0xc153('0x21')](_0xc153('0x22'),_0x54466a+'-'+_0x16cfce+'/'+_0x4804bc)[_0xc153('0x1c')](_0x41c1a3);}return null;};}function patchUpdates(_0x95a64c){return function(_0x23fbb7){try{jsonpatch[_0xc153('0x23')](_0x23fbb7,_0x95a64c,!![]);}catch(_0x5e858d){return BPromise[_0xc153('0x24')](_0x5e858d);}return _0x23fbb7['save']();};}function saveUpdates(_0x458593,_0x1442a6){return function(_0x35335c){if(_0x35335c){return _0x35335c[_0xc153('0x25')](_0x458593)['then'](function(_0x4ac708){return _0x4ac708;});}return null;};}function removeEntity(_0x166f62,_0x4b20e0){return function(_0x22fa39){if(_0x22fa39){return _0x22fa39[_0xc153('0x26')]()[_0xc153('0x27')](function(){_0x166f62[_0xc153('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47915b,_0x39bbdb){return function(_0x401487){if(!_0x401487){_0x47915b[_0xc153('0x19')](0x194);}return _0x401487;};}function handleError(_0x159823,_0x13c7ff){_0x13c7ff=_0x13c7ff||0x1f4;return function(_0x50ff30){logger[_0xc153('0x28')](_0x50ff30['stack']);if(_0x50ff30[_0xc153('0x29')]){delete _0x50ff30[_0xc153('0x29')];}_0x159823['status'](_0x13c7ff)[_0xc153('0x2a')](_0x50ff30);};}exports[_0xc153('0x2b')]=function(_0x4c0882,_0xec10bf){var _0x919f0a={},_0x27315f={},_0x502182={'count':0x0,'rows':[]};var _0x66e9f6=_[_0xc153('0x2c')](db[_0xc153('0x2d')]['rawAttributes'],function(_0x42da38){return{'name':_0x42da38[_0xc153('0x2e')],'type':_0x42da38[_0xc153('0x2f')][_0xc153('0x30')]};});_0x27315f['model']=_[_0xc153('0x2c')](_0x66e9f6,'name');_0x27315f[_0xc153('0x31')]=_['keys'](_0x4c0882[_0xc153('0x31')]);_0x27315f[_0xc153('0x32')]=_['intersection'](_0x27315f[_0xc153('0x33')],_0x27315f['query']);_0x919f0a['attributes']=_[_0xc153('0x34')](_0x27315f[_0xc153('0x33')],qs[_0xc153('0x35')](_0x4c0882[_0xc153('0x31')][_0xc153('0x35')]));_0x919f0a['attributes']=_0x919f0a[_0xc153('0x36')][_0xc153('0x37')]?_0x919f0a[_0xc153('0x36')]:_0x27315f[_0xc153('0x33')];if(!_0x4c0882[_0xc153('0x31')][_0xc153('0x38')](_0xc153('0x39'))){_0x919f0a[_0xc153('0x1f')]=qs[_0xc153('0x1f')](_0x4c0882[_0xc153('0x31')]['limit']);_0x919f0a['offset']=qs[_0xc153('0x1d')](_0x4c0882['query'][_0xc153('0x1d')]);}_0x919f0a[_0xc153('0x3a')]=qs[_0xc153('0x3b')](_0x4c0882['query'][_0xc153('0x3b')]);_0x919f0a[_0xc153('0x3c')]=qs[_0xc153('0x32')](_[_0xc153('0x3d')](_0x4c0882[_0xc153('0x31')],_0x27315f[_0xc153('0x32')]),_0x66e9f6);if(_0x4c0882[_0xc153('0x31')][_0xc153('0x3e')]){_0x919f0a['where']=_['merge'](_0x919f0a[_0xc153('0x3c')],{'$or':_[_0xc153('0x2c')](_0x66e9f6,function(_0x30017d){if(_0x30017d[_0xc153('0x2f')]!==_0xc153('0x3f')){var _0x226a9e={};_0x226a9e[_0x30017d['name']]={'$like':'%'+_0x4c0882[_0xc153('0x31')][_0xc153('0x3e')]+'%'};return _0x226a9e;}})});}_0x919f0a=_[_0xc153('0x40')]({},_0x919f0a,_0x4c0882['options']);var _0x90a67={'where':_0x919f0a[_0xc153('0x3c')]};return db[_0xc153('0x2d')]['count'](_0x90a67)['then'](function(_0x52d318){_0x502182['count']=_0x52d318;if(_0x4c0882['query'][_0xc153('0x41')]){_0x919f0a['include']=[{'all':!![]}];}return db[_0xc153('0x2d')][_0xc153('0x42')](_0x919f0a);})[_0xc153('0x27')](function(_0x381722){_0x502182[_0xc153('0x43')]=_0x381722;return _0x502182;})[_0xc153('0x27')](respondWithFilteredResult(_0xec10bf,_0x919f0a))[_0xc153('0x44')](handleError(_0xec10bf,null));};exports[_0xc153('0x45')]=function(_0x46b245,_0x711bd0){var _0x34a3b2={'raw':![],'where':{'id':_0x46b245[_0xc153('0x46')]['id']}},_0x1893a1={};_0x1893a1['model']=_[_0xc153('0x47')](db[_0xc153('0x2d')][_0xc153('0x48')]);_0x1893a1[_0xc153('0x31')]=_[_0xc153('0x47')](_0x46b245['query']);_0x1893a1[_0xc153('0x32')]=_[_0xc153('0x34')](_0x1893a1['model'],_0x1893a1['query']);_0x34a3b2[_0xc153('0x36')]=_['intersection'](_0x1893a1['model'],qs['fields'](_0x46b245[_0xc153('0x31')]['fields']));_0x34a3b2[_0xc153('0x36')]=_0x34a3b2[_0xc153('0x36')][_0xc153('0x37')]?_0x34a3b2['attributes']:_0x1893a1['model'];if(_0x46b245[_0xc153('0x31')][_0xc153('0x41')]){_0x34a3b2[_0xc153('0x49')]=[{'all':!![]}];}_0x34a3b2=_[_0xc153('0x40')]({},_0x34a3b2,_0x46b245[_0xc153('0x4a')]);return db['FreshdeskAccount']['find'](_0x34a3b2)[_0xc153('0x27')](handleEntityNotFound(_0x711bd0,null))['then'](respondWithResult(_0x711bd0,null))['catch'](handleError(_0x711bd0,null));};exports['create']=function(_0x5bfb6f,_0x3c5f0c){return db['FreshdeskAccount'][_0xc153('0x4b')](_0x5bfb6f[_0xc153('0x4c')],{})[_0xc153('0x27')](respondWithResult(_0x3c5f0c,0xc9))[_0xc153('0x44')](handleError(_0x3c5f0c,null));};exports[_0xc153('0x25')]=function(_0x4bceb0,_0x101f91){if(_0x4bceb0[_0xc153('0x4c')]['id']){delete _0x4bceb0[_0xc153('0x4c')]['id'];}return db[_0xc153('0x2d')][_0xc153('0x4d')]({'where':{'id':_0x4bceb0['params']['id']}})['then'](handleEntityNotFound(_0x101f91,null))[_0xc153('0x27')](saveUpdates(_0x4bceb0['body'],null))[_0xc153('0x27')](respondWithResult(_0x101f91,null))[_0xc153('0x44')](handleError(_0x101f91,null));};exports[_0xc153('0x26')]=function(_0x41fe1d,_0x89aae1){return db[_0xc153('0x2d')][_0xc153('0x4d')]({'where':{'id':_0x41fe1d['params']['id']}})[_0xc153('0x27')](handleEntityNotFound(_0x89aae1,null))['then'](removeEntity(_0x89aae1,null))['catch'](handleError(_0x89aae1,null));};exports[_0xc153('0x4e')]=function(_0x12bdbc,_0x8b6ec0,_0x35a019){var _0x31c237={};var _0xec4375={};var _0x3aae8f;var _0x39e810;return db[_0xc153('0x2d')][_0xc153('0x4f')]({'where':{'id':_0x12bdbc[_0xc153('0x46')]['id']}})[_0xc153('0x27')](handleEntityNotFound(_0x8b6ec0,null))[_0xc153('0x27')](function(_0x188f75){if(_0x188f75){_0x3aae8f=_0x188f75;_0xec4375[_0xc153('0x33')]=_[_0xc153('0x47')](db['FreshdeskConfiguration'][_0xc153('0x48')]);_0xec4375[_0xc153('0x31')]=_[_0xc153('0x47')](_0x12bdbc[_0xc153('0x31')]);_0xec4375[_0xc153('0x32')]=_[_0xc153('0x34')](_0xec4375[_0xc153('0x33')],_0xec4375[_0xc153('0x31')]);_0x31c237[_0xc153('0x36')]=_[_0xc153('0x34')](_0xec4375['model'],qs['fields'](_0x12bdbc['query'][_0xc153('0x35')]));_0x31c237[_0xc153('0x36')]=_0x31c237[_0xc153('0x36')][_0xc153('0x37')]?_0x31c237['attributes']:_0xec4375[_0xc153('0x33')];_0x31c237[_0xc153('0x3a')]=qs[_0xc153('0x3b')](_0x12bdbc[_0xc153('0x31')][_0xc153('0x3b')]);_0x31c237[_0xc153('0x3c')]=qs[_0xc153('0x32')](_[_0xc153('0x3d')](_0x12bdbc['query'],_0xec4375[_0xc153('0x32')]));if(_0x12bdbc[_0xc153('0x31')][_0xc153('0x3e')]){_0x31c237[_0xc153('0x3c')]=_[_0xc153('0x40')](_0x31c237[_0xc153('0x3c')],{'$or':_[_0xc153('0x2c')](_0x31c237['attributes'],function(_0x2e385e){var _0x7d722={};_0x7d722[_0x2e385e]={'$like':'%'+_0x12bdbc[_0xc153('0x31')][_0xc153('0x3e')]+'%'};return _0x7d722;})});}_0x31c237=_[_0xc153('0x40')]({},_0x31c237,_0x12bdbc[_0xc153('0x4a')]);return _0x3aae8f['getConfigurations'](_0x31c237);}})[_0xc153('0x27')](function(_0x38f484){if(_0x38f484){_0x39e810=_0x38f484[_0xc153('0x37')];if(!_0x12bdbc['query'][_0xc153('0x38')](_0xc153('0x39'))){_0x31c237[_0xc153('0x1f')]=qs[_0xc153('0x1f')](_0x12bdbc[_0xc153('0x31')][_0xc153('0x1f')]);_0x31c237[_0xc153('0x1d')]=qs[_0xc153('0x1d')](_0x12bdbc[_0xc153('0x31')][_0xc153('0x1d')]);}return _0x3aae8f[_0xc153('0x4e')](_0x31c237);}})[_0xc153('0x27')](function(_0x523218){if(_0x523218){return _0x523218?{'count':_0x39e810,'rows':_0x523218}:null;}})[_0xc153('0x27')](respondWithResult(_0x8b6ec0,null))[_0xc153('0x44')](handleError(_0x8b6ec0,null));};exports['addConfiguration']=function(_0x426f91,_0x19ec78,_0xe59c72){if(_0x426f91[_0xc153('0x4c')]['id']){delete _0x426f91[_0xc153('0x4c')]['id'];}return db[_0xc153('0x2d')]['findOne']({'where':{'id':_0x426f91['params']['id']}})[_0xc153('0x27')](handleEntityNotFound(_0x19ec78,null))[_0xc153('0x27')](function(_0x56031f){if(_0x56031f){_0x426f91['body'][_0xc153('0x50')]=_0x56031f['id'];_0x426f91[_0xc153('0x4c')]['Subjects']=integrations[_0xc153('0x51')](_0x426f91[_0xc153('0x4c')][_0xc153('0x52')],_0x426f91['body'][_0xc153('0x2f')]);_0x426f91[_0xc153('0x4c')]['Descriptions']=integrations[_0xc153('0x53')](_0x426f91[_0xc153('0x4c')]['channel'],_0x426f91[_0xc153('0x4c')][_0xc153('0x2f')]);return db[_0xc153('0x54')]['create'](_0x426f91['body'],{'include':[{'model':db[_0xc153('0x55')],'as':'Subjects'},{'model':db[_0xc153('0x55')],'as':_0xc153('0x56')}]});}return null;})[_0xc153('0x27')](respondWithResult(_0x19ec78,null))[_0xc153('0x44')](handleError(_0x19ec78,null));};exports['getFields']=function(_0x5270a0,_0x25c87f,_0x2a1d7c){var _0x251bbd='';return db[_0xc153('0x2d')][_0xc153('0x4f')]({'where':{'id':_0x5270a0[_0xc153('0x46')]['id']},'attributes':['id',_0xc153('0x57'),_0xc153('0x58')]})[_0xc153('0x27')](handleEntityNotFound(_0x25c87f,null))['then'](function(_0xed4a50){if(_0xed4a50){_0x251bbd=_0xed4a50['remoteUri'];var _0xa3886d=_0x251bbd[_0xc153('0x59')](-0x1);if(_0xa3886d==='/'){_0x251bbd=_0x251bbd[_0xc153('0x5a')](0x0,_0x251bbd[_0xc153('0x5b')](_0xa3886d));}return rp({'method':'GET','uri':util[_0xc153('0x5c')](_0xc153('0x5d'),_0x251bbd,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xc153('0x5c')]('Basic\x20%s',new Buffer(util[_0xc153('0x5c')]('%s:X',_0xed4a50[_0xc153('0x58')]))[_0xc153('0x5e')](_0xc153('0x5f')))},'json':!![]});}})[_0xc153('0x27')](function(_0x4104b3){if(_0x4104b3){var _0x3ab4c2=['requester',_0xc153('0x60'),_0xc153('0x61'),_0xc153('0x62'),_0xc153('0x1b'),_0xc153('0x63'),_0xc153('0x64'),_0xc153('0x65'),_0xc153('0x66'),_0xc153('0x64'),_0xc153('0x67')];_[_0xc153('0x68')](_0x4104b3,function(_0x1c4529){return _0x3ab4c2['includes'](_0x1c4529['name'])||!_0x1c4529['default']&&_0x1c4529[_0xc153('0x2f')]!==_0xc153('0x69')&&_0x1c4529[_0xc153('0x2f')]!=='custom_dropdown';});return{'count':_0x4104b3[_0xc153('0x37')],'rows':_[_0xc153('0x2c')](_0x4104b3,function(_0x5c4c3c){return{'id':_0x5c4c3c[_0xc153('0x29')],'name':_0x5c4c3c['label'],'custom':!_0x5c4c3c['default'],'options':_0x5c4c3c[_0xc153('0x6a')]?_[_0xc153('0x2c')](_0x5c4c3c['choices'],function(_0x1c2174){return{'name':_[_0xc153('0x6b')](_0x1c2174),'value':_0x1c2174};}):[]};})};}})[_0xc153('0x27')](respondWithResult(_0x25c87f,null))[_0xc153('0x44')](function(_0x459eeb){var _0xeaaba3=_0x5270a0[_0xc153('0x31')][_0xc153('0x6c')]?0x1f4:_0x459eeb[_0xc153('0x6d')]||0x1f4;logger['error'](_0xc153('0x6e'),'getFields',_0xeaaba3,JSON[_0xc153('0x6f')](_0x459eeb));delete _0x459eeb[_0xc153('0x29')];if(_0xeaaba3===0x191){_0xeaaba3=0x190;}_0x25c87f[_0xc153('0x1b')](_0xeaaba3)[_0xc153('0x2a')](_0x5270a0[_0xc153('0x31')][_0xc153('0x6c')]?{'message':_0xc153('0x70'),'statusCode':_0x459eeb['statusCode']}:_0x459eeb);});}; \ No newline at end of file +var _0x131e=['VIRTUAL','filter','include','findAll','catch','show','params','keys','rawAttributes','includeAll','options','find','create','body','destroy','findOne','FreshdeskConfiguration','pick','getConfigurations','nolimit','AccountId','Subjects','getSubjects','Descriptions','channel','FreshdeskField','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','toString','subject','agent','description','priority','group','source','ticket_type','company','remove','includes','default','label','choices','capitalize','test','statusCode','getFields','stringify','Wrong\x20credentials','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','error','stack','name','send','index','FreshdeskAccount','type','model','map','query','filters','intersection','attributes','fields','length','order','sort','where','merge'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x131e,0x1ec));var _0xe131=function(_0x4d98cc,_0x157083){_0x4d98cc=_0x4d98cc-0x0;var _0x52a86c=_0x131e[_0x4d98cc];return _0x52a86c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe131('0x0'));var rp=require(_0xe131('0x1'));var moment=require(_0xe131('0x2'));var BPromise=require(_0xe131('0x3'));var Mustache=require(_0xe131('0x4'));var util=require(_0xe131('0x5'));var path=require('path');var sox=require(_0xe131('0x6'));var csv=require(_0xe131('0x7'));var ejs=require(_0xe131('0x8'));var fs=require('fs');var fs_extra=require(_0xe131('0x9'));var _=require(_0xe131('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe131('0x7'));var querystring=require(_0xe131('0xb'));var Papa=require('papaparse');var Redis=require(_0xe131('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xe131('0xd'));var as=require(_0xe131('0xe'));var hardwareService=require(_0xe131('0xf'));var logger=require(_0xe131('0x10'))(_0xe131('0x11'));var utils=require(_0xe131('0x12'));var config=require(_0xe131('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5f0434,_0x14ed9a){_0x14ed9a=_0x14ed9a||0xcc;return function(_0x1714db){if(_0x1714db){return _0x5f0434[_0xe131('0x14')](_0x14ed9a);}return _0x5f0434[_0xe131('0x15')](_0x14ed9a)[_0xe131('0x16')]();};}function respondWithResult(_0x420cc2,_0x436549){_0x436549=_0x436549||0xc8;return function(_0x27120f){if(_0x27120f){return _0x420cc2[_0xe131('0x15')](_0x436549)['json'](_0x27120f);}};}function respondWithFilteredResult(_0x4aa1bf,_0x4dfbdf){return function(_0x5a6ca9){if(_0x5a6ca9){var _0x4987dc=typeof _0x4dfbdf[_0xe131('0x17')]===_0xe131('0x18')&&typeof _0x4dfbdf[_0xe131('0x19')]==='undefined';var _0x503e86=_0x5a6ca9[_0xe131('0x1a')];var _0x2e2bf8=_0x4987dc?0x0:_0x4dfbdf[_0xe131('0x17')];var _0x1a1e03=_0x4987dc?_0x5a6ca9[_0xe131('0x1a')]:_0x4dfbdf[_0xe131('0x17')]+_0x4dfbdf['limit'];var _0x4690b0;if(_0x1a1e03>=_0x503e86){_0x1a1e03=_0x503e86;_0x4690b0=0xc8;}else{_0x4690b0=0xce;}_0x4aa1bf[_0xe131('0x15')](_0x4690b0);return _0x4aa1bf[_0xe131('0x1b')](_0xe131('0x1c'),_0x2e2bf8+'-'+_0x1a1e03+'/'+_0x503e86)[_0xe131('0x1d')](_0x5a6ca9);}return null;};}function patchUpdates(_0x49b19e){return function(_0x4c24e5){try{jsonpatch[_0xe131('0x1e')](_0x4c24e5,_0x49b19e,!![]);}catch(_0x41c4e1){return BPromise['reject'](_0x41c4e1);}return _0x4c24e5[_0xe131('0x1f')]();};}function saveUpdates(_0x55b0c5,_0x49f304){return function(_0x19d141){if(_0x19d141){return _0x19d141[_0xe131('0x20')](_0x55b0c5)[_0xe131('0x21')](function(_0xecb533){return _0xecb533;});}return null;};}function removeEntity(_0x166409,_0x225278){return function(_0x2bcb68){if(_0x2bcb68){return _0x2bcb68['destroy']()[_0xe131('0x21')](function(){_0x166409[_0xe131('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e7cb8,_0x330638){return function(_0x5b2f47){if(!_0x5b2f47){_0x4e7cb8[_0xe131('0x14')](0x194);}return _0x5b2f47;};}function handleError(_0x3b95bf,_0x51e109){_0x51e109=_0x51e109||0x1f4;return function(_0x44935b){logger[_0xe131('0x22')](_0x44935b[_0xe131('0x23')]);if(_0x44935b['name']){delete _0x44935b[_0xe131('0x24')];}_0x3b95bf[_0xe131('0x15')](_0x51e109)[_0xe131('0x25')](_0x44935b);};}exports[_0xe131('0x26')]=function(_0xb306b4,_0x2fce8c){var _0x1ff557={},_0x3414f1={},_0x9f8c66={'count':0x0,'rows':[]};var _0x341294=_['map'](db[_0xe131('0x27')]['rawAttributes'],function(_0x155c67){return{'name':_0x155c67['fieldName'],'type':_0x155c67[_0xe131('0x28')]['key']};});_0x3414f1[_0xe131('0x29')]=_[_0xe131('0x2a')](_0x341294,_0xe131('0x24'));_0x3414f1['query']=_['keys'](_0xb306b4[_0xe131('0x2b')]);_0x3414f1[_0xe131('0x2c')]=_[_0xe131('0x2d')](_0x3414f1[_0xe131('0x29')],_0x3414f1[_0xe131('0x2b')]);_0x1ff557[_0xe131('0x2e')]=_[_0xe131('0x2d')](_0x3414f1[_0xe131('0x29')],qs['fields'](_0xb306b4['query'][_0xe131('0x2f')]));_0x1ff557[_0xe131('0x2e')]=_0x1ff557[_0xe131('0x2e')][_0xe131('0x30')]?_0x1ff557[_0xe131('0x2e')]:_0x3414f1[_0xe131('0x29')];if(!_0xb306b4[_0xe131('0x2b')]['hasOwnProperty']('nolimit')){_0x1ff557[_0xe131('0x19')]=qs['limit'](_0xb306b4[_0xe131('0x2b')]['limit']);_0x1ff557[_0xe131('0x17')]=qs['offset'](_0xb306b4[_0xe131('0x2b')]['offset']);}_0x1ff557[_0xe131('0x31')]=qs[_0xe131('0x32')](_0xb306b4[_0xe131('0x2b')][_0xe131('0x32')]);_0x1ff557[_0xe131('0x33')]=qs[_0xe131('0x2c')](_['pick'](_0xb306b4[_0xe131('0x2b')],_0x3414f1['filters']),_0x341294);if(_0xb306b4[_0xe131('0x2b')]['filter']){_0x1ff557[_0xe131('0x33')]=_[_0xe131('0x34')](_0x1ff557[_0xe131('0x33')],{'$or':_[_0xe131('0x2a')](_0x341294,function(_0xd8cf9d){if(_0xd8cf9d[_0xe131('0x28')]!==_0xe131('0x35')){var _0x5a5498={};_0x5a5498[_0xd8cf9d[_0xe131('0x24')]]={'$like':'%'+_0xb306b4['query'][_0xe131('0x36')]+'%'};return _0x5a5498;}})});}_0x1ff557=_[_0xe131('0x34')]({},_0x1ff557,_0xb306b4['options']);var _0x5a9a34={'where':_0x1ff557[_0xe131('0x33')]};return db['FreshdeskAccount']['count'](_0x5a9a34)[_0xe131('0x21')](function(_0x5b82e5){_0x9f8c66[_0xe131('0x1a')]=_0x5b82e5;if(_0xb306b4[_0xe131('0x2b')]['includeAll']){_0x1ff557[_0xe131('0x37')]=[{'all':!![]}];}return db[_0xe131('0x27')][_0xe131('0x38')](_0x1ff557);})[_0xe131('0x21')](function(_0xa077dd){_0x9f8c66['rows']=_0xa077dd;return _0x9f8c66;})['then'](respondWithFilteredResult(_0x2fce8c,_0x1ff557))[_0xe131('0x39')](handleError(_0x2fce8c,null));};exports[_0xe131('0x3a')]=function(_0x2a9a07,_0x58fe5c){var _0x34f5ae={'raw':![],'where':{'id':_0x2a9a07[_0xe131('0x3b')]['id']}},_0x112e78={};_0x112e78['model']=_[_0xe131('0x3c')](db[_0xe131('0x27')][_0xe131('0x3d')]);_0x112e78['query']=_[_0xe131('0x3c')](_0x2a9a07[_0xe131('0x2b')]);_0x112e78[_0xe131('0x2c')]=_['intersection'](_0x112e78[_0xe131('0x29')],_0x112e78[_0xe131('0x2b')]);_0x34f5ae[_0xe131('0x2e')]=_[_0xe131('0x2d')](_0x112e78[_0xe131('0x29')],qs[_0xe131('0x2f')](_0x2a9a07[_0xe131('0x2b')]['fields']));_0x34f5ae['attributes']=_0x34f5ae[_0xe131('0x2e')][_0xe131('0x30')]?_0x34f5ae[_0xe131('0x2e')]:_0x112e78[_0xe131('0x29')];if(_0x2a9a07[_0xe131('0x2b')][_0xe131('0x3e')]){_0x34f5ae['include']=[{'all':!![]}];}_0x34f5ae=_[_0xe131('0x34')]({},_0x34f5ae,_0x2a9a07[_0xe131('0x3f')]);return db[_0xe131('0x27')][_0xe131('0x40')](_0x34f5ae)[_0xe131('0x21')](handleEntityNotFound(_0x58fe5c,null))[_0xe131('0x21')](respondWithResult(_0x58fe5c,null))['catch'](handleError(_0x58fe5c,null));};exports[_0xe131('0x41')]=function(_0x1ce9b7,_0x173a71){return db[_0xe131('0x27')][_0xe131('0x41')](_0x1ce9b7[_0xe131('0x42')],{})[_0xe131('0x21')](respondWithResult(_0x173a71,0xc9))[_0xe131('0x39')](handleError(_0x173a71,null));};exports[_0xe131('0x20')]=function(_0x320699,_0x442f06){if(_0x320699['body']['id']){delete _0x320699[_0xe131('0x42')]['id'];}return db['FreshdeskAccount']['find']({'where':{'id':_0x320699[_0xe131('0x3b')]['id']}})[_0xe131('0x21')](handleEntityNotFound(_0x442f06,null))[_0xe131('0x21')](saveUpdates(_0x320699[_0xe131('0x42')],null))[_0xe131('0x21')](respondWithResult(_0x442f06,null))[_0xe131('0x39')](handleError(_0x442f06,null));};exports[_0xe131('0x43')]=function(_0x398c39,_0x81206e){return db[_0xe131('0x27')][_0xe131('0x40')]({'where':{'id':_0x398c39['params']['id']}})['then'](handleEntityNotFound(_0x81206e,null))[_0xe131('0x21')](removeEntity(_0x81206e,null))[_0xe131('0x39')](handleError(_0x81206e,null));};exports['getConfigurations']=function(_0x56893d,_0x2b934b,_0x564a29){var _0x5b0ab5={};var _0xe0d786={};var _0x34404e;var _0x32e45d;return db[_0xe131('0x27')][_0xe131('0x44')]({'where':{'id':_0x56893d[_0xe131('0x3b')]['id']}})['then'](handleEntityNotFound(_0x2b934b,null))['then'](function(_0x40d0cb){if(_0x40d0cb){_0x34404e=_0x40d0cb;_0xe0d786[_0xe131('0x29')]=_['keys'](db[_0xe131('0x45')][_0xe131('0x3d')]);_0xe0d786[_0xe131('0x2b')]=_[_0xe131('0x3c')](_0x56893d[_0xe131('0x2b')]);_0xe0d786[_0xe131('0x2c')]=_['intersection'](_0xe0d786[_0xe131('0x29')],_0xe0d786['query']);_0x5b0ab5['attributes']=_[_0xe131('0x2d')](_0xe0d786[_0xe131('0x29')],qs['fields'](_0x56893d['query'][_0xe131('0x2f')]));_0x5b0ab5[_0xe131('0x2e')]=_0x5b0ab5[_0xe131('0x2e')]['length']?_0x5b0ab5[_0xe131('0x2e')]:_0xe0d786[_0xe131('0x29')];_0x5b0ab5[_0xe131('0x31')]=qs[_0xe131('0x32')](_0x56893d[_0xe131('0x2b')]['sort']);_0x5b0ab5[_0xe131('0x33')]=qs['filters'](_[_0xe131('0x46')](_0x56893d[_0xe131('0x2b')],_0xe0d786[_0xe131('0x2c')]));if(_0x56893d[_0xe131('0x2b')]['filter']){_0x5b0ab5['where']=_['merge'](_0x5b0ab5[_0xe131('0x33')],{'$or':_['map'](_0x5b0ab5[_0xe131('0x2e')],function(_0x44f69f){var _0x413b70={};_0x413b70[_0x44f69f]={'$like':'%'+_0x56893d[_0xe131('0x2b')][_0xe131('0x36')]+'%'};return _0x413b70;})});}_0x5b0ab5=_[_0xe131('0x34')]({},_0x5b0ab5,_0x56893d[_0xe131('0x3f')]);return _0x34404e[_0xe131('0x47')](_0x5b0ab5);}})[_0xe131('0x21')](function(_0x14d4b5){if(_0x14d4b5){_0x32e45d=_0x14d4b5['length'];if(!_0x56893d['query']['hasOwnProperty'](_0xe131('0x48'))){_0x5b0ab5[_0xe131('0x19')]=qs[_0xe131('0x19')](_0x56893d[_0xe131('0x2b')]['limit']);_0x5b0ab5[_0xe131('0x17')]=qs[_0xe131('0x17')](_0x56893d[_0xe131('0x2b')][_0xe131('0x17')]);}return _0x34404e[_0xe131('0x47')](_0x5b0ab5);}})[_0xe131('0x21')](function(_0x52143e){if(_0x52143e){return _0x52143e?{'count':_0x32e45d,'rows':_0x52143e}:null;}})['then'](respondWithResult(_0x2b934b,null))[_0xe131('0x39')](handleError(_0x2b934b,null));};exports['addConfiguration']=function(_0x484a2e,_0x537d66,_0x1c194a){if(_0x484a2e['body']['id']){delete _0x484a2e[_0xe131('0x42')]['id'];}return db['FreshdeskAccount'][_0xe131('0x44')]({'where':{'id':_0x484a2e[_0xe131('0x3b')]['id']}})[_0xe131('0x21')](handleEntityNotFound(_0x537d66,null))[_0xe131('0x21')](function(_0x47d96b){if(_0x47d96b){_0x484a2e[_0xe131('0x42')][_0xe131('0x49')]=_0x47d96b['id'];_0x484a2e[_0xe131('0x42')][_0xe131('0x4a')]=integrations[_0xe131('0x4b')](_0x484a2e[_0xe131('0x42')]['channel'],_0x484a2e[_0xe131('0x42')][_0xe131('0x28')]);_0x484a2e['body'][_0xe131('0x4c')]=integrations['getDescriptions'](_0x484a2e['body'][_0xe131('0x4d')],_0x484a2e['body'][_0xe131('0x28')]);return db[_0xe131('0x45')][_0xe131('0x41')](_0x484a2e['body'],{'include':[{'model':db[_0xe131('0x4e')],'as':_0xe131('0x4a')},{'model':db[_0xe131('0x4e')],'as':_0xe131('0x4c')}]});}return null;})[_0xe131('0x21')](respondWithResult(_0x537d66,null))[_0xe131('0x39')](handleError(_0x537d66,null));};exports['getFields']=function(_0x592750,_0x68f7c3,_0x50725b){var _0x10b7b9='';return db['FreshdeskAccount'][_0xe131('0x44')]({'where':{'id':_0x592750[_0xe131('0x3b')]['id']},'attributes':['id',_0xe131('0x4f'),_0xe131('0x50')]})[_0xe131('0x21')](handleEntityNotFound(_0x68f7c3,null))[_0xe131('0x21')](function(_0x59beee){if(_0x59beee){_0x10b7b9=_0x59beee[_0xe131('0x4f')];var _0x1a4bf2=_0x10b7b9[_0xe131('0x51')](-0x1);if(_0x1a4bf2==='/'){_0x10b7b9=_0x10b7b9[_0xe131('0x52')](0x0,_0x10b7b9[_0xe131('0x53')](_0x1a4bf2));}return rp({'method':_0xe131('0x54'),'uri':util[_0xe131('0x55')](_0xe131('0x56'),_0x10b7b9,_0xe131('0x57')),'headers':{'Authorization':util[_0xe131('0x55')](_0xe131('0x58'),new Buffer(util[_0xe131('0x55')]('%s:X',_0x59beee[_0xe131('0x50')]))[_0xe131('0x59')]('base64'))},'json':!![]});}})[_0xe131('0x21')](function(_0x34d77b){if(_0x34d77b){var _0x216901=['requester',_0xe131('0x5a'),_0xe131('0x5b'),_0xe131('0x5c'),_0xe131('0x15'),_0xe131('0x5d'),_0xe131('0x5e'),_0xe131('0x5f'),_0xe131('0x60'),_0xe131('0x5e'),_0xe131('0x61')];_[_0xe131('0x62')](_0x34d77b,function(_0xcc8cd7){return _0x216901[_0xe131('0x63')](_0xcc8cd7[_0xe131('0x24')])||!_0xcc8cd7[_0xe131('0x64')]&&_0xcc8cd7['type']!=='custom_text'&&_0xcc8cd7[_0xe131('0x28')]!=='custom_dropdown';});return{'count':_0x34d77b[_0xe131('0x30')],'rows':_[_0xe131('0x2a')](_0x34d77b,function(_0x885ea7){return{'id':_0x885ea7[_0xe131('0x24')],'name':_0x885ea7[_0xe131('0x65')],'custom':!_0x885ea7['default'],'options':_0x885ea7[_0xe131('0x66')]?_['map'](_0x885ea7[_0xe131('0x66')],function(_0x23f9a8){return{'name':_[_0xe131('0x67')](_0x23f9a8),'value':_0x23f9a8};}):[]};})};}})[_0xe131('0x21')](respondWithResult(_0x68f7c3,null))['catch'](function(_0x1642d6){var _0x2df523=_0x592750[_0xe131('0x2b')][_0xe131('0x68')]?0x1f4:_0x1642d6[_0xe131('0x69')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xe131('0x6a'),_0x2df523,JSON[_0xe131('0x6b')](_0x1642d6));delete _0x1642d6[_0xe131('0x24')];if(_0x2df523===0x191){_0x2df523=0x190;}_0x68f7c3['status'](_0x2df523)['send'](_0x592750[_0xe131('0x2b')][_0xe131('0x68')]?{'message':_0xe131('0x6c'),'statusCode':_0x1642d6[_0xe131('0x69')]}:_0x1642d6);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index a11221a..0b1d11f 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 _0x7966=['int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intFreshdeskAccount.attributes','exports'];(function(_0x254936,_0x1d1a75){var _0xd81b6e=function(_0x27a8d8){while(--_0x27a8d8){_0x254936['push'](_0x254936['shift']());}};_0xd81b6e(++_0x1d1a75);}(_0x7966,0x9b));var _0x6796=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x7966[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x6796('0x0'));var util=require(_0x6796('0x1'));var logger=require(_0x6796('0x2'))(_0x6796('0x3'));var moment=require(_0x6796('0x4'));var BPromise=require(_0x6796('0x5'));var rp=require(_0x6796('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6796('0x7'));var config=require('../../config/environment');var attributes=require(_0x6796('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x6796('0x9')]=function(_0x590564,_0x2e2809){return _0x590564['define']('FreshdeskAccount',attributes,{'tableName':_0x6796('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ac5=['bluebird','request-promise','path','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','moment'];(function(_0x18577c,_0x522ffe){var _0x4bd49c=function(_0x41e1d0){while(--_0x41e1d0){_0x18577c['push'](_0x18577c['shift']());}};_0x4bd49c(++_0x522ffe);}(_0x0ac5,0x182));var _0x50ac=function(_0x510e44,_0x560ff7){_0x510e44=_0x510e44-0x0;var _0x487623=_0x0ac5[_0x510e44];return _0x487623;};'use strict';var _=require(_0x50ac('0x0'));var util=require(_0x50ac('0x1'));var logger=require(_0x50ac('0x2'))('api');var moment=require(_0x50ac('0x3'));var BPromise=require(_0x50ac('0x4'));var rp=require(_0x50ac('0x5'));var fs=require('fs');var path=require(_0x50ac('0x6'));var rimraf=require('rimraf');var config=require(_0x50ac('0x7'));var attributes=require(_0x50ac('0x8'));var integrations=require(_0x50ac('0x9'));module[_0x50ac('0xa')]=function(_0x1306e9,_0x1f2825){return _0x1306e9['define'](_0x50ac('0xb'),attributes,{'tableName':_0x50ac('0xc'),'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 82fb50c..c55d1c2 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 _0xd4de=['request\x20sent','debug','stringify','error','code','message','FreshdeskAccount,\x20%s,\x20%s','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','include','map','model','attributes','ShowFreshdeskAccount','find','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x17e3cf,_0x1103e1){var _0xfecb59=function(_0x4bdda8){while(--_0x4bdda8){_0x17e3cf['push'](_0x17e3cf['shift']());}};_0xfecb59(++_0x1103e1);}(_0xd4de,0x1ac));var _0xed4d=function(_0xd85435,_0x4b5280){_0xd85435=_0xd85435-0x0;var _0x12c20a=_0xd4de[_0xd85435];return _0x12c20a;};'use strict';var _=require(_0xed4d('0x0'));var util=require(_0xed4d('0x1'));var moment=require(_0xed4d('0x2'));var BPromise=require(_0xed4d('0x3'));var rs=require(_0xed4d('0x4'));var fs=require('fs');var Redis=require(_0xed4d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xed4d('0x6'));var logger=require(_0xed4d('0x7'))(_0xed4d('0x8'));var config=require(_0xed4d('0x9'));var jayson=require(_0xed4d('0xa'));var client=jayson[_0xed4d('0xb')][_0xed4d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1362cc,_0x3b9e70,_0x36ec65){return new BPromise(function(_0xa852ce,_0x2ab2f7){return client[_0xed4d('0xd')](_0x1362cc,_0x36ec65)[_0xed4d('0xe')](function(_0x162f54){logger[_0xed4d('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x3b9e70,_0xed4d('0x10'));logger[_0xed4d('0x11')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x3b9e70,_0xed4d('0x10'),JSON[_0xed4d('0x12')](_0x162f54));if(_0x162f54[_0xed4d('0x13')]){if(_0x162f54[_0xed4d('0x13')][_0xed4d('0x14')]===0x1f4){logger[_0xed4d('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x3b9e70,_0x162f54[_0xed4d('0x13')][_0xed4d('0x15')]);return _0x2ab2f7(_0x162f54[_0xed4d('0x13')][_0xed4d('0x15')]);}logger[_0xed4d('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x3b9e70,_0x162f54['error'][_0xed4d('0x15')]);return _0xa852ce(_0x162f54[_0xed4d('0x13')][_0xed4d('0x15')]);}else{logger[_0xed4d('0xf')](_0xed4d('0x16'),_0x3b9e70,_0xed4d('0x10'));_0xa852ce(_0x162f54[_0xed4d('0x17')]['message']);}})[_0xed4d('0x18')](function(_0x2bd685){logger[_0xed4d('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x3b9e70,_0x2bd685);_0x2ab2f7(_0x2bd685);});});}exports[_0xed4d('0x19')]=function(_0x4d1a69){var _0x3fe721=this;return new Promise(function(_0x483799,_0x1f5751){return db[_0xed4d('0x1a')][_0xed4d('0x1b')]({'raw':_0x4d1a69[_0xed4d('0x1c')]?_0x4d1a69[_0xed4d('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4d1a69[_0xed4d('0x1c')]?_0x4d1a69[_0xed4d('0x1c')]['where']||null:null,'attributes':_0x4d1a69[_0xed4d('0x1c')]?_0x4d1a69[_0xed4d('0x1c')]['attributes']||null:null,'limit':_0x4d1a69[_0xed4d('0x1c')]?_0x4d1a69[_0xed4d('0x1c')]['limit']||null:null,'include':_0x4d1a69[_0xed4d('0x1c')]?_0x4d1a69['options'][_0xed4d('0x1d')]?_[_0xed4d('0x1e')](_0x4d1a69[_0xed4d('0x1c')]['include'],function(_0x5d63f4){return{'model':db[_0x5d63f4[_0xed4d('0x1f')]],'as':_0x5d63f4['as'],'attributes':_0x5d63f4['attributes'],'include':_0x5d63f4[_0xed4d('0x1d')]?_['map'](_0x5d63f4['include'],function(_0x2a6dde){return{'model':db[_0x2a6dde[_0xed4d('0x1f')]],'as':_0x2a6dde['as'],'attributes':_0x2a6dde['attributes'],'include':_0x2a6dde['include']?_['map'](_0x2a6dde[_0xed4d('0x1d')],function(_0x94c929){return{'model':db[_0x94c929[_0xed4d('0x1f')]],'as':_0x94c929['as'],'attributes':_0x94c929[_0xed4d('0x20')]};}):[]};}):[]};}):[]:[]})[_0xed4d('0xe')](function(_0x59f167){logger[_0xed4d('0xf')](_0xed4d('0x19'),_0x4d1a69);logger[_0xed4d('0x11')](_0xed4d('0x19'),_0x4d1a69,JSON[_0xed4d('0x12')](_0x59f167));_0x483799(_0x59f167);})['catch'](function(_0xaef631){logger[_0xed4d('0x13')]('GetFreshdeskAccount',_0xaef631[_0xed4d('0x15')],_0x4d1a69);_0x1f5751(_0x3fe721[_0xed4d('0x13')](0x1f4,_0xaef631[_0xed4d('0x15')]));});});};exports[_0xed4d('0x21')]=function(_0x576982){var _0x5764c5=this;return new Promise(function(_0x5e4e50,_0x4da1b8){return db[_0xed4d('0x1a')][_0xed4d('0x22')]({'raw':_0x576982[_0xed4d('0x1c')]?_0x576982['options'][_0xed4d('0x23')]===undefined?!![]:![]:!![],'where':_0x576982['options']?_0x576982['options'][_0xed4d('0x24')]||null:null,'attributes':_0x576982[_0xed4d('0x1c')]?_0x576982['options'][_0xed4d('0x20')]||null:null,'include':_0x576982[_0xed4d('0x1c')]?_0x576982[_0xed4d('0x1c')]['include']?_[_0xed4d('0x1e')](_0x576982[_0xed4d('0x1c')][_0xed4d('0x1d')],function(_0x206837){return{'model':db[_0x206837[_0xed4d('0x1f')]],'as':_0x206837['as'],'attributes':_0x206837[_0xed4d('0x20')],'include':_0x206837[_0xed4d('0x1d')]?_[_0xed4d('0x1e')](_0x206837['include'],function(_0x28b6ff){return{'model':db[_0x28b6ff[_0xed4d('0x1f')]],'as':_0x28b6ff['as'],'attributes':_0x28b6ff['attributes'],'include':_0x28b6ff[_0xed4d('0x1d')]?_[_0xed4d('0x1e')](_0x28b6ff['include'],function(_0x2d6289){return{'model':db[_0x2d6289[_0xed4d('0x1f')]],'as':_0x2d6289['as'],'attributes':_0x2d6289['attributes']};}):[]};}):[]};}):[]:[]})[_0xed4d('0xe')](function(_0x531e9b){logger[_0xed4d('0xf')](_0xed4d('0x21'),_0x576982);logger[_0xed4d('0x11')](_0xed4d('0x21'),_0x576982,JSON[_0xed4d('0x12')](_0x531e9b));_0x5e4e50(_0x531e9b);})['catch'](function(_0x25f553){logger[_0xed4d('0x13')]('ShowFreshdeskAccount',_0x25f553['message'],_0x576982);_0x4da1b8(_0x5764c5[_0xed4d('0x13')](0x1f4,_0x25f553[_0xed4d('0x15')]));});});}; \ No newline at end of file +var _0x1ddc=['jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','error','code','message','catch','FreshdeskAccount','options','raw','where','limit','include','map','attributes','model','GetFreshdeskAccount','ShowFreshdeskAccount','debug','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x1f2a92,_0x263981){var _0xd56c39=function(_0x4f0860){while(--_0x4f0860){_0x1f2a92['push'](_0x1f2a92['shift']());}};_0xd56c39(++_0x263981);}(_0x1ddc,0x7f));var _0xc1dd=function(_0x5d0079,_0x5d9237){_0x5d0079=_0x5d0079-0x0;var _0x5896ec=_0x1ddc[_0x5d0079];return _0x5896ec;};'use strict';var _=require(_0xc1dd('0x0'));var util=require(_0xc1dd('0x1'));var moment=require('moment');var BPromise=require(_0xc1dd('0x2'));var rs=require(_0xc1dd('0x3'));var fs=require('fs');var Redis=require(_0xc1dd('0x4'));var db=require(_0xc1dd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc1dd('0x6'))(_0xc1dd('0x7'));var config=require(_0xc1dd('0x8'));var jayson=require(_0xc1dd('0x9'));var client=jayson[_0xc1dd('0xa')][_0xc1dd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4729b7,_0x43e35c,_0x3585bf){return new BPromise(function(_0x278383,_0x5739e5){return client[_0xc1dd('0xc')](_0x4729b7,_0x3585bf)[_0xc1dd('0xd')](function(_0x9bb60a){logger[_0xc1dd('0xe')](_0xc1dd('0xf'),_0x43e35c,_0xc1dd('0x10'));logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x43e35c,_0xc1dd('0x10'),JSON['stringify'](_0x9bb60a));if(_0x9bb60a[_0xc1dd('0x11')]){if(_0x9bb60a['error'][_0xc1dd('0x12')]===0x1f4){logger[_0xc1dd('0x11')](_0xc1dd('0xf'),_0x43e35c,_0x9bb60a[_0xc1dd('0x11')][_0xc1dd('0x13')]);return _0x5739e5(_0x9bb60a[_0xc1dd('0x11')]['message']);}logger[_0xc1dd('0x11')](_0xc1dd('0xf'),_0x43e35c,_0x9bb60a[_0xc1dd('0x11')]['message']);return _0x278383(_0x9bb60a['error']['message']);}else{logger[_0xc1dd('0xe')](_0xc1dd('0xf'),_0x43e35c,'request\x20sent');_0x278383(_0x9bb60a['result'][_0xc1dd('0x13')]);}})[_0xc1dd('0x14')](function(_0x435cd1){logger[_0xc1dd('0x11')](_0xc1dd('0xf'),_0x43e35c,_0x435cd1);_0x5739e5(_0x435cd1);});});}exports['GetFreshdeskAccount']=function(_0x37bdc4){var _0x2b5f96=this;return new Promise(function(_0x2d8f34,_0x1517ad){return db[_0xc1dd('0x15')]['findAll']({'raw':_0x37bdc4['options']?_0x37bdc4[_0xc1dd('0x16')][_0xc1dd('0x17')]===undefined?!![]:![]:!![],'where':_0x37bdc4[_0xc1dd('0x16')]?_0x37bdc4[_0xc1dd('0x16')][_0xc1dd('0x18')]||null:null,'attributes':_0x37bdc4['options']?_0x37bdc4[_0xc1dd('0x16')]['attributes']||null:null,'limit':_0x37bdc4[_0xc1dd('0x16')]?_0x37bdc4[_0xc1dd('0x16')][_0xc1dd('0x19')]||null:null,'include':_0x37bdc4[_0xc1dd('0x16')]?_0x37bdc4[_0xc1dd('0x16')][_0xc1dd('0x1a')]?_[_0xc1dd('0x1b')](_0x37bdc4['options'][_0xc1dd('0x1a')],function(_0x43ed59){return{'model':db[_0x43ed59['model']],'as':_0x43ed59['as'],'attributes':_0x43ed59[_0xc1dd('0x1c')],'include':_0x43ed59[_0xc1dd('0x1a')]?_[_0xc1dd('0x1b')](_0x43ed59[_0xc1dd('0x1a')],function(_0x538198){return{'model':db[_0x538198['model']],'as':_0x538198['as'],'attributes':_0x538198[_0xc1dd('0x1c')],'include':_0x538198[_0xc1dd('0x1a')]?_[_0xc1dd('0x1b')](_0x538198['include'],function(_0x2583f1){return{'model':db[_0x2583f1[_0xc1dd('0x1d')]],'as':_0x2583f1['as'],'attributes':_0x2583f1[_0xc1dd('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57dda4){logger[_0xc1dd('0xe')](_0xc1dd('0x1e'),_0x37bdc4);logger['debug'](_0xc1dd('0x1e'),_0x37bdc4,JSON['stringify'](_0x57dda4));_0x2d8f34(_0x57dda4);})['catch'](function(_0x2da1f0){logger[_0xc1dd('0x11')](_0xc1dd('0x1e'),_0x2da1f0[_0xc1dd('0x13')],_0x37bdc4);_0x1517ad(_0x2b5f96[_0xc1dd('0x11')](0x1f4,_0x2da1f0[_0xc1dd('0x13')]));});});};exports[_0xc1dd('0x1f')]=function(_0x315d22){var _0x43eb48=this;return new Promise(function(_0x306760,_0x3bc26b){return db[_0xc1dd('0x15')]['find']({'raw':_0x315d22['options']?_0x315d22[_0xc1dd('0x16')][_0xc1dd('0x17')]===undefined?!![]:![]:!![],'where':_0x315d22['options']?_0x315d22[_0xc1dd('0x16')][_0xc1dd('0x18')]||null:null,'attributes':_0x315d22[_0xc1dd('0x16')]?_0x315d22[_0xc1dd('0x16')]['attributes']||null:null,'include':_0x315d22['options']?_0x315d22[_0xc1dd('0x16')][_0xc1dd('0x1a')]?_['map'](_0x315d22[_0xc1dd('0x16')][_0xc1dd('0x1a')],function(_0x2b043f){return{'model':db[_0x2b043f['model']],'as':_0x2b043f['as'],'attributes':_0x2b043f[_0xc1dd('0x1c')],'include':_0x2b043f[_0xc1dd('0x1a')]?_[_0xc1dd('0x1b')](_0x2b043f[_0xc1dd('0x1a')],function(_0x479795){return{'model':db[_0x479795['model']],'as':_0x479795['as'],'attributes':_0x479795[_0xc1dd('0x1c')],'include':_0x479795[_0xc1dd('0x1a')]?_[_0xc1dd('0x1b')](_0x479795[_0xc1dd('0x1a')],function(_0x1048fb){return{'model':db[_0x1048fb[_0xc1dd('0x1d')]],'as':_0x1048fb['as'],'attributes':_0x1048fb['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x37786c){logger['info'](_0xc1dd('0x1f'),_0x315d22);logger[_0xc1dd('0x20')]('ShowFreshdeskAccount',_0x315d22,JSON[_0xc1dd('0x21')](_0x37786c));_0x306760(_0x37786c);})[_0xc1dd('0x14')](function(_0x307cb9){logger[_0xc1dd('0x11')]('ShowFreshdeskAccount',_0x307cb9[_0xc1dd('0x13')],_0x315d22);_0x3bc26b(_0x43eb48[_0xc1dd('0x11')](0x1f4,_0x307cb9[_0xc1dd('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 394489a..6c77dbd 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 _0x5286=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','/:id','show','getFields','/:id/subjects','getSubjects','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x13883a,_0x59edcf){var _0x2ddd44=function(_0x5561d5){while(--_0x5561d5){_0x13883a['push'](_0x13883a['shift']());}};_0x2ddd44(++_0x59edcf);}(_0x5286,0x172));var _0x6528=function(_0x49a354,_0x5297d4){_0x49a354=_0x49a354-0x0;var _0x4cdf0b=_0x5286[_0x49a354];return _0x4cdf0b;};'use strict';var multer=require(_0x6528('0x0'));var util=require(_0x6528('0x1'));var path=require(_0x6528('0x2'));var timeout=require(_0x6528('0x3'));var express=require(_0x6528('0x4'));var router=express[_0x6528('0x5')]();var fs_extra=require(_0x6528('0x6'));var auth=require(_0x6528('0x7'));var interaction=require(_0x6528('0x8'));var config=require(_0x6528('0x9'));var controller=require(_0x6528('0xa'));router['get']('/',auth[_0x6528('0xb')](),controller[_0x6528('0xc')]);router[_0x6528('0xd')](_0x6528('0xe'),auth[_0x6528('0xb')](),controller[_0x6528('0xf')]);router[_0x6528('0xd')]('/:id/fields',auth[_0x6528('0xb')](),controller[_0x6528('0x10')]);router[_0x6528('0xd')](_0x6528('0x11'),auth[_0x6528('0xb')](),controller[_0x6528('0x12')]);router[_0x6528('0xd')]('/:id/descriptions',auth[_0x6528('0xb')](),controller[_0x6528('0x13')]);router['get']('/:id/tags',auth['isAuthenticated'](),controller[_0x6528('0x14')]);router[_0x6528('0x15')]('/',auth[_0x6528('0xb')](),controller[_0x6528('0x16')]);router['post'](_0x6528('0x17'),auth[_0x6528('0xb')](),controller[_0x6528('0x18')]);router[_0x6528('0x19')](_0x6528('0xe'),auth[_0x6528('0xb')](),controller[_0x6528('0x1a')]);router[_0x6528('0x1b')]('/:id',auth[_0x6528('0xb')](),controller['destroy']);module[_0x6528('0x1c')]=router; \ No newline at end of file +var _0xcaac=['isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','create','put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0xcaac,0x1d6));var _0xccaa=function(_0x9f2f05,_0xd70a9d){_0x9f2f05=_0x9f2f05-0x0;var _0x459ad4=_0xcaac[_0x9f2f05];return _0x459ad4;};'use strict';var multer=require(_0xccaa('0x0'));var util=require(_0xccaa('0x1'));var path=require(_0xccaa('0x2'));var timeout=require('connect-timeout');var express=require(_0xccaa('0x3'));var router=express[_0xccaa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xccaa('0x5'));var interaction=require(_0xccaa('0x6'));var config=require(_0xccaa('0x7'));var controller=require(_0xccaa('0x8'));router[_0xccaa('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xccaa('0x9')]('/:id',auth[_0xccaa('0xa')](),controller['show']);router[_0xccaa('0x9')](_0xccaa('0xb'),auth[_0xccaa('0xa')](),controller[_0xccaa('0xc')]);router[_0xccaa('0x9')](_0xccaa('0xd'),auth[_0xccaa('0xa')](),controller[_0xccaa('0xe')]);router[_0xccaa('0x9')](_0xccaa('0xf'),auth[_0xccaa('0xa')](),controller['getDescriptions']);router[_0xccaa('0x9')](_0xccaa('0x10'),auth[_0xccaa('0xa')](),controller[_0xccaa('0x11')]);router[_0xccaa('0x12')]('/',auth[_0xccaa('0xa')](),controller[_0xccaa('0x13')]);router[_0xccaa('0x12')](_0xccaa('0x10'),auth[_0xccaa('0xa')](),controller['setTags']);router[_0xccaa('0x14')]('/:id',auth[_0xccaa('0xa')](),controller['update']);router[_0xccaa('0x15')]('/:id',auth[_0xccaa('0xa')](),controller[_0xccaa('0x16')]);module[_0xccaa('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 12960de..eba0548 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 _0x51d5=['STRING','exports'];(function(_0xc2dde6,_0x1cccc9){var _0x9fc29c=function(_0x54ba28){while(--_0x54ba28){_0xc2dde6['push'](_0xc2dde6['shift']());}};_0x9fc29c(++_0x1cccc9);}(_0x51d5,0xa9));var _0x551d=function(_0x1e72ba,_0x327a82){_0x1e72ba=_0x1e72ba-0x0;var _0x58f79=_0x51d5[_0x1e72ba];return _0x58f79;};'use strict';var Sequelize=require('sequelize');module[_0x551d('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x551d('0x1')]}}; \ No newline at end of file +var _0xa8e9=['exports','STRING','sequelize'];(function(_0x2334ea,_0x9d2b7){var _0x5372af=function(_0x49f205){while(--_0x49f205){_0x2334ea['push'](_0x2334ea['shift']());}};_0x5372af(++_0x9d2b7);}(_0xa8e9,0x16a));var _0x9a8e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa8e9[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9a8e('0x0'));module[_0x9a8e('0x1')]={'name':{'type':Sequelize[_0x9a8e('0x2')]},'description':{'type':Sequelize[_0x9a8e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index e1ebac7..4903edd 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 _0x55eb=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','FreshdeskConfiguration','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','getSubjects','getDescriptions','FreshdeskField','getTags','Tag','setTags','eml-format','zip-dir','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x55eb,0xec));var _0xb55e=function(_0x55938a,_0x311fa0){_0x55938a=_0x55938a-0x0;var _0x348fb9=_0x55eb[_0x55938a];return _0x348fb9;};'use strict';var emlformat=require(_0xb55e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb55e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb55e('0x2'));var moment=require(_0xb55e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb55e('0x4'));var path=require(_0xb55e('0x5'));var sox=require(_0xb55e('0x6'));var csv=require('to-csv');var ejs=require(_0xb55e('0x7'));var fs=require('fs');var fs_extra=require(_0xb55e('0x8'));var _=require(_0xb55e('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb55e('0xa'));var deskjs=require(_0xb55e('0xb'));var toCsv=require(_0xb55e('0xc'));var querystring=require(_0xb55e('0xd'));var Papa=require(_0xb55e('0xe'));var Redis=require('ioredis');var authService=require(_0xb55e('0xf'));var qs=require(_0xb55e('0x10'));var as=require(_0xb55e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb55e('0x12'))(_0xb55e('0x13'));var utils=require(_0xb55e('0x14'));var config=require(_0xb55e('0x15'));var licenseUtil=require(_0xb55e('0x16'));var db=require(_0xb55e('0x17'))['db'];function respondWithStatusCode(_0x4af3e0,_0x3f2d9a){_0x3f2d9a=_0x3f2d9a||0xcc;return function(_0x59a783){if(_0x59a783){return _0x4af3e0[_0xb55e('0x18')](_0x3f2d9a);}return _0x4af3e0[_0xb55e('0x19')](_0x3f2d9a)[_0xb55e('0x1a')]();};}function respondWithResult(_0x4a6a49,_0x18ab27){_0x18ab27=_0x18ab27||0xc8;return function(_0x58c2bd){if(_0x58c2bd){return _0x4a6a49['status'](_0x18ab27)[_0xb55e('0x1b')](_0x58c2bd);}};}function respondWithFilteredResult(_0x29eaf3,_0x42bf33){return function(_0x3a59e0){if(_0x3a59e0){var _0x3bc24f=typeof _0x42bf33[_0xb55e('0x1c')]===_0xb55e('0x1d')&&typeof _0x42bf33[_0xb55e('0x1e')]===_0xb55e('0x1d');var _0x32f264=_0x3a59e0['count'];var _0x645037=_0x3bc24f?0x0:_0x42bf33[_0xb55e('0x1c')];var _0x8815f8=_0x3bc24f?_0x3a59e0[_0xb55e('0x1f')]:_0x42bf33[_0xb55e('0x1c')]+_0x42bf33[_0xb55e('0x1e')];var _0x4acd45;if(_0x8815f8>=_0x32f264){_0x8815f8=_0x32f264;_0x4acd45=0xc8;}else{_0x4acd45=0xce;}_0x29eaf3[_0xb55e('0x19')](_0x4acd45);return _0x29eaf3[_0xb55e('0x20')](_0xb55e('0x21'),_0x645037+'-'+_0x8815f8+'/'+_0x32f264)['json'](_0x3a59e0);}return null;};}function patchUpdates(_0x4ab8cd){return function(_0x2c6bd1){try{jsonpatch[_0xb55e('0x22')](_0x2c6bd1,_0x4ab8cd,!![]);}catch(_0x26fa2b){return BPromise['reject'](_0x26fa2b);}return _0x2c6bd1[_0xb55e('0x23')]();};}function saveUpdates(_0x160bad,_0x27bae8){return function(_0x1513c6){if(_0x1513c6){return _0x1513c6[_0xb55e('0x24')](_0x160bad)[_0xb55e('0x25')](function(_0x4a090d){return _0x4a090d;});}return null;};}function removeEntity(_0x5b9ede,_0x4ecb75){return function(_0x2f4310){if(_0x2f4310){return _0x2f4310['destroy']()['then'](function(){_0x5b9ede['status'](0xcc)[_0xb55e('0x1a')]();});}};}function handleEntityNotFound(_0xd6e782,_0x476cfa){return function(_0x238754){if(!_0x238754){_0xd6e782[_0xb55e('0x18')](0x194);}return _0x238754;};}function handleError(_0x1555c9,_0x3b83d2){_0x3b83d2=_0x3b83d2||0x1f4;return function(_0xe0a5db){logger[_0xb55e('0x26')](_0xe0a5db[_0xb55e('0x27')]);if(_0xe0a5db[_0xb55e('0x28')]){delete _0xe0a5db['name'];}_0x1555c9[_0xb55e('0x19')](_0x3b83d2)[_0xb55e('0x29')](_0xe0a5db);};}exports[_0xb55e('0x2a')]=function(_0x1bf5ec,_0x20b72d){var _0x249ca4={},_0x1dfa8c={},_0x126b70={'count':0x0,'rows':[]};var _0x4486f1=_[_0xb55e('0x2b')](db['FreshdeskConfiguration'][_0xb55e('0x2c')],function(_0x271305){return{'name':_0x271305[_0xb55e('0x2d')],'type':_0x271305['type'][_0xb55e('0x2e')]};});_0x1dfa8c[_0xb55e('0x2f')]=_[_0xb55e('0x2b')](_0x4486f1,_0xb55e('0x28'));_0x1dfa8c['query']=_[_0xb55e('0x30')](_0x1bf5ec[_0xb55e('0x31')]);_0x1dfa8c[_0xb55e('0x32')]=_[_0xb55e('0x33')](_0x1dfa8c[_0xb55e('0x2f')],_0x1dfa8c[_0xb55e('0x31')]);_0x249ca4[_0xb55e('0x34')]=_['intersection'](_0x1dfa8c[_0xb55e('0x2f')],qs[_0xb55e('0x35')](_0x1bf5ec[_0xb55e('0x31')][_0xb55e('0x35')]));_0x249ca4['attributes']=_0x249ca4[_0xb55e('0x34')][_0xb55e('0x36')]?_0x249ca4['attributes']:_0x1dfa8c[_0xb55e('0x2f')];if(!_0x1bf5ec[_0xb55e('0x31')][_0xb55e('0x37')](_0xb55e('0x38'))){_0x249ca4['limit']=qs[_0xb55e('0x1e')](_0x1bf5ec[_0xb55e('0x31')][_0xb55e('0x1e')]);_0x249ca4['offset']=qs['offset'](_0x1bf5ec[_0xb55e('0x31')][_0xb55e('0x1c')]);}_0x249ca4[_0xb55e('0x39')]=qs['sort'](_0x1bf5ec[_0xb55e('0x31')][_0xb55e('0x3a')]);_0x249ca4[_0xb55e('0x3b')]=qs[_0xb55e('0x32')](_[_0xb55e('0x3c')](_0x1bf5ec[_0xb55e('0x31')],_0x1dfa8c[_0xb55e('0x32')]),_0x4486f1);if(_0x1bf5ec[_0xb55e('0x31')]['filter']){_0x249ca4[_0xb55e('0x3b')]=_[_0xb55e('0x3d')](_0x249ca4[_0xb55e('0x3b')],{'$or':_[_0xb55e('0x2b')](_0x4486f1,function(_0x437723){if(_0x437723[_0xb55e('0x3e')]!==_0xb55e('0x3f')){var _0xb77ef7={};_0xb77ef7[_0x437723[_0xb55e('0x28')]]={'$like':'%'+_0x1bf5ec[_0xb55e('0x31')][_0xb55e('0x40')]+'%'};return _0xb77ef7;}})});}_0x249ca4=_[_0xb55e('0x3d')]({},_0x249ca4,_0x1bf5ec[_0xb55e('0x41')]);var _0x55cf1a={'where':_0x249ca4[_0xb55e('0x3b')]};return db[_0xb55e('0x42')][_0xb55e('0x1f')](_0x55cf1a)[_0xb55e('0x25')](function(_0x4d3698){_0x126b70[_0xb55e('0x1f')]=_0x4d3698;if(_0x1bf5ec['query'][_0xb55e('0x43')]){_0x249ca4[_0xb55e('0x44')]=[{'all':!![]}];}return db[_0xb55e('0x42')][_0xb55e('0x45')](_0x249ca4);})[_0xb55e('0x25')](function(_0xf6e202){_0x126b70[_0xb55e('0x46')]=_0xf6e202;return _0x126b70;})[_0xb55e('0x25')](respondWithFilteredResult(_0x20b72d,_0x249ca4))[_0xb55e('0x47')](handleError(_0x20b72d,null));};exports[_0xb55e('0x48')]=function(_0x5dbb8f,_0x2d4c3a){var _0x323281={'raw':![],'where':{'id':_0x5dbb8f[_0xb55e('0x49')]['id']}},_0x281c9a={};_0x281c9a[_0xb55e('0x2f')]=_[_0xb55e('0x30')](db[_0xb55e('0x42')]['rawAttributes']);_0x281c9a[_0xb55e('0x31')]=_[_0xb55e('0x30')](_0x5dbb8f[_0xb55e('0x31')]);_0x281c9a[_0xb55e('0x32')]=_['intersection'](_0x281c9a['model'],_0x281c9a[_0xb55e('0x31')]);_0x323281['attributes']=_[_0xb55e('0x33')](_0x281c9a[_0xb55e('0x2f')],qs['fields'](_0x5dbb8f['query']['fields']));_0x323281[_0xb55e('0x34')]=_0x323281[_0xb55e('0x34')][_0xb55e('0x36')]?_0x323281[_0xb55e('0x34')]:_0x281c9a[_0xb55e('0x2f')];if(_0x5dbb8f[_0xb55e('0x31')][_0xb55e('0x43')]){_0x323281[_0xb55e('0x44')]=[{'all':!![]}];}_0x323281=_[_0xb55e('0x3d')]({},_0x323281,_0x5dbb8f['options']);return db[_0xb55e('0x42')][_0xb55e('0x4a')](_0x323281)['then'](handleEntityNotFound(_0x2d4c3a,null))[_0xb55e('0x25')](respondWithResult(_0x2d4c3a,null))[_0xb55e('0x47')](handleError(_0x2d4c3a,null));};exports[_0xb55e('0x4b')]=function(_0x44f952,_0x4d11f2){return db[_0xb55e('0x42')]['create'](_0x44f952[_0xb55e('0x4c')],{})[_0xb55e('0x25')](respondWithResult(_0x4d11f2,0xc9))['catch'](handleError(_0x4d11f2,null));};exports[_0xb55e('0x24')]=function(_0x1aa6c4,_0x101957){if(_0x1aa6c4[_0xb55e('0x4c')]['id']){delete _0x1aa6c4[_0xb55e('0x4c')]['id'];}return db[_0xb55e('0x42')][_0xb55e('0x4a')]({'where':{'id':_0x1aa6c4[_0xb55e('0x49')]['id']}})['then'](handleEntityNotFound(_0x101957,null))[_0xb55e('0x25')](saveUpdates(_0x1aa6c4[_0xb55e('0x4c')],null))[_0xb55e('0x25')](respondWithResult(_0x101957,null))['catch'](handleError(_0x101957,null));};exports['destroy']=function(_0x4a3901,_0x11dc23){return db[_0xb55e('0x42')][_0xb55e('0x4a')]({'where':{'id':_0x4a3901[_0xb55e('0x49')]['id']}})['then'](handleEntityNotFound(_0x11dc23,null))[_0xb55e('0x25')](removeEntity(_0x11dc23,null))[_0xb55e('0x47')](handleError(_0x11dc23,null));};exports[_0xb55e('0x4d')]=function(_0x4a2129,_0x1de8f7,_0x25137b){var _0x1ea461={};var _0x284b81={};var _0x22ca6f;var _0x1cac77;return db['FreshdeskConfiguration'][_0xb55e('0x4e')]({'where':{'id':_0x4a2129[_0xb55e('0x49')]['id']}})[_0xb55e('0x25')](handleEntityNotFound(_0x1de8f7,null))[_0xb55e('0x25')](function(_0xfb10a){if(_0xfb10a){_0x22ca6f=_0xfb10a;_0x284b81[_0xb55e('0x2f')]=_[_0xb55e('0x30')](db['FreshdeskField'][_0xb55e('0x2c')]);_0x284b81[_0xb55e('0x31')]=_[_0xb55e('0x30')](_0x4a2129['query']);_0x284b81['filters']=_[_0xb55e('0x33')](_0x284b81[_0xb55e('0x2f')],_0x284b81['query']);_0x1ea461[_0xb55e('0x34')]=_[_0xb55e('0x33')](_0x284b81[_0xb55e('0x2f')],qs[_0xb55e('0x35')](_0x4a2129[_0xb55e('0x31')][_0xb55e('0x35')]));_0x1ea461['attributes']=_0x1ea461[_0xb55e('0x34')]['length']?_0x1ea461[_0xb55e('0x34')]:_0x284b81['model'];_0x1ea461[_0xb55e('0x39')]=qs[_0xb55e('0x3a')](_0x4a2129['query'][_0xb55e('0x3a')]);_0x1ea461[_0xb55e('0x3b')]=qs[_0xb55e('0x32')](_[_0xb55e('0x3c')](_0x4a2129[_0xb55e('0x31')],_0x284b81['filters']));if(_0x4a2129[_0xb55e('0x31')][_0xb55e('0x40')]){_0x1ea461[_0xb55e('0x3b')]=_['merge'](_0x1ea461[_0xb55e('0x3b')],{'$or':_[_0xb55e('0x2b')](_0x1ea461[_0xb55e('0x34')],function(_0x3111cd){var _0x5e460d={};_0x5e460d[_0x3111cd]={'$like':'%'+_0x4a2129[_0xb55e('0x31')]['filter']+'%'};return _0x5e460d;})});}_0x1ea461=_[_0xb55e('0x3d')]({},_0x1ea461,_0x4a2129[_0xb55e('0x41')]);return _0x22ca6f[_0xb55e('0x4d')](_0x1ea461);}})[_0xb55e('0x25')](function(_0x54bf57){if(_0x54bf57){_0x1cac77=_0x54bf57[_0xb55e('0x36')];if(!_0x4a2129['query'][_0xb55e('0x37')](_0xb55e('0x38'))){_0x1ea461['limit']=qs['limit'](_0x4a2129[_0xb55e('0x31')][_0xb55e('0x1e')]);_0x1ea461[_0xb55e('0x1c')]=qs['offset'](_0x4a2129['query'][_0xb55e('0x1c')]);}return _0x22ca6f[_0xb55e('0x4d')](_0x1ea461);}})[_0xb55e('0x25')](function(_0xfaf351){if(_0xfaf351){return _0xfaf351?{'count':_0x1cac77,'rows':_0xfaf351}:null;}})[_0xb55e('0x25')](respondWithResult(_0x1de8f7,null))[_0xb55e('0x47')](handleError(_0x1de8f7,null));};exports[_0xb55e('0x4f')]=function(_0x55f5f9,_0x1d6bb4,_0x1fedd8){var _0x2c276b={};var _0x4ff9e8={};var _0x31f45d;var _0x15fae6;return db[_0xb55e('0x42')][_0xb55e('0x4e')]({'where':{'id':_0x55f5f9['params']['id']}})[_0xb55e('0x25')](handleEntityNotFound(_0x1d6bb4,null))[_0xb55e('0x25')](function(_0x5e988b){if(_0x5e988b){_0x31f45d=_0x5e988b;_0x4ff9e8[_0xb55e('0x2f')]=_[_0xb55e('0x30')](db['FreshdeskField']['rawAttributes']);_0x4ff9e8['query']=_[_0xb55e('0x30')](_0x55f5f9['query']);_0x4ff9e8[_0xb55e('0x32')]=_[_0xb55e('0x33')](_0x4ff9e8[_0xb55e('0x2f')],_0x4ff9e8[_0xb55e('0x31')]);_0x2c276b[_0xb55e('0x34')]=_[_0xb55e('0x33')](_0x4ff9e8[_0xb55e('0x2f')],qs[_0xb55e('0x35')](_0x55f5f9[_0xb55e('0x31')][_0xb55e('0x35')]));_0x2c276b['attributes']=_0x2c276b[_0xb55e('0x34')][_0xb55e('0x36')]?_0x2c276b[_0xb55e('0x34')]:_0x4ff9e8[_0xb55e('0x2f')];_0x2c276b['order']=qs[_0xb55e('0x3a')](_0x55f5f9[_0xb55e('0x31')][_0xb55e('0x3a')]);_0x2c276b[_0xb55e('0x3b')]=qs['filters'](_[_0xb55e('0x3c')](_0x55f5f9[_0xb55e('0x31')],_0x4ff9e8[_0xb55e('0x32')]));if(_0x55f5f9[_0xb55e('0x31')][_0xb55e('0x40')]){_0x2c276b[_0xb55e('0x3b')]=_['merge'](_0x2c276b[_0xb55e('0x3b')],{'$or':_[_0xb55e('0x2b')](_0x2c276b['attributes'],function(_0x20b14a){var _0x550153={};_0x550153[_0x20b14a]={'$like':'%'+_0x55f5f9[_0xb55e('0x31')]['filter']+'%'};return _0x550153;})});}_0x2c276b=_[_0xb55e('0x3d')]({},_0x2c276b,_0x55f5f9[_0xb55e('0x41')]);return _0x31f45d[_0xb55e('0x4f')](_0x2c276b);}})[_0xb55e('0x25')](function(_0x38dd52){if(_0x38dd52){_0x15fae6=_0x38dd52[_0xb55e('0x36')];if(!_0x55f5f9[_0xb55e('0x31')][_0xb55e('0x37')](_0xb55e('0x38'))){_0x2c276b['limit']=qs['limit'](_0x55f5f9[_0xb55e('0x31')]['limit']);_0x2c276b['offset']=qs['offset'](_0x55f5f9[_0xb55e('0x31')][_0xb55e('0x1c')]);}return _0x31f45d[_0xb55e('0x4f')](_0x2c276b);}})[_0xb55e('0x25')](function(_0x1afea3){if(_0x1afea3){return _0x1afea3?{'count':_0x15fae6,'rows':_0x1afea3}:null;}})[_0xb55e('0x25')](respondWithResult(_0x1d6bb4,null))[_0xb55e('0x47')](handleError(_0x1d6bb4,null));};exports[_0xb55e('0x50')]=function(_0x533849,_0x41cf52,_0xcbf73e){var _0x103c0e={};var _0x645da9={};var _0x56a3ec;var _0x158fe1;return db['FreshdeskConfiguration'][_0xb55e('0x4e')]({'where':{'id':_0x533849[_0xb55e('0x49')]['id']}})['then'](handleEntityNotFound(_0x41cf52,null))[_0xb55e('0x25')](function(_0x43c150){if(_0x43c150){_0x56a3ec=_0x43c150;_0x645da9[_0xb55e('0x2f')]=_[_0xb55e('0x30')](db[_0xb55e('0x51')][_0xb55e('0x2c')]);_0x645da9['query']=_[_0xb55e('0x30')](_0x533849[_0xb55e('0x31')]);_0x645da9['filters']=_[_0xb55e('0x33')](_0x645da9[_0xb55e('0x2f')],_0x645da9['query']);_0x103c0e[_0xb55e('0x34')]=_[_0xb55e('0x33')](_0x645da9[_0xb55e('0x2f')],qs[_0xb55e('0x35')](_0x533849[_0xb55e('0x31')][_0xb55e('0x35')]));_0x103c0e[_0xb55e('0x34')]=_0x103c0e[_0xb55e('0x34')][_0xb55e('0x36')]?_0x103c0e[_0xb55e('0x34')]:_0x645da9[_0xb55e('0x2f')];_0x103c0e['order']=qs[_0xb55e('0x3a')](_0x533849[_0xb55e('0x31')][_0xb55e('0x3a')]);_0x103c0e['where']=qs['filters'](_[_0xb55e('0x3c')](_0x533849[_0xb55e('0x31')],_0x645da9[_0xb55e('0x32')]));if(_0x533849[_0xb55e('0x31')][_0xb55e('0x40')]){_0x103c0e[_0xb55e('0x3b')]=_['merge'](_0x103c0e['where'],{'$or':_[_0xb55e('0x2b')](_0x103c0e[_0xb55e('0x34')],function(_0x95cfc1){var _0x11209c={};_0x11209c[_0x95cfc1]={'$like':'%'+_0x533849[_0xb55e('0x31')][_0xb55e('0x40')]+'%'};return _0x11209c;})});}_0x103c0e=_[_0xb55e('0x3d')]({},_0x103c0e,_0x533849[_0xb55e('0x41')]);return _0x56a3ec['getDescriptions'](_0x103c0e);}})[_0xb55e('0x25')](function(_0x39b51e){if(_0x39b51e){_0x158fe1=_0x39b51e['length'];if(!_0x533849[_0xb55e('0x31')][_0xb55e('0x37')](_0xb55e('0x38'))){_0x103c0e[_0xb55e('0x1e')]=qs[_0xb55e('0x1e')](_0x533849[_0xb55e('0x31')][_0xb55e('0x1e')]);_0x103c0e[_0xb55e('0x1c')]=qs['offset'](_0x533849['query']['offset']);}return _0x56a3ec['getDescriptions'](_0x103c0e);}})['then'](function(_0x337adf){if(_0x337adf){return _0x337adf?{'count':_0x158fe1,'rows':_0x337adf}:null;}})['then'](respondWithResult(_0x41cf52,null))[_0xb55e('0x47')](handleError(_0x41cf52,null));};exports[_0xb55e('0x52')]=function(_0x4cc5a0,_0x222772,_0x2d1673){var _0x4c1923={};var _0x6f4471={};var _0x5ce36e;var _0x982f75;return db[_0xb55e('0x42')][_0xb55e('0x4e')]({'where':{'id':_0x4cc5a0['params']['id']}})['then'](handleEntityNotFound(_0x222772,null))[_0xb55e('0x25')](function(_0x3d20a0){if(_0x3d20a0){_0x5ce36e=_0x3d20a0;_0x6f4471['model']=_[_0xb55e('0x30')](db[_0xb55e('0x53')][_0xb55e('0x2c')]);_0x6f4471['query']=_[_0xb55e('0x30')](_0x4cc5a0[_0xb55e('0x31')]);_0x6f4471[_0xb55e('0x32')]=_[_0xb55e('0x33')](_0x6f4471[_0xb55e('0x2f')],_0x6f4471[_0xb55e('0x31')]);_0x4c1923['attributes']=_[_0xb55e('0x33')](_0x6f4471[_0xb55e('0x2f')],qs[_0xb55e('0x35')](_0x4cc5a0['query']['fields']));_0x4c1923['attributes']=_0x4c1923['attributes'][_0xb55e('0x36')]?_0x4c1923['attributes']:_0x6f4471[_0xb55e('0x2f')];_0x4c1923[_0xb55e('0x39')]=qs['sort'](_0x4cc5a0['query'][_0xb55e('0x3a')]);_0x4c1923[_0xb55e('0x3b')]=qs[_0xb55e('0x32')](_[_0xb55e('0x3c')](_0x4cc5a0['query'],_0x6f4471[_0xb55e('0x32')]));if(_0x4cc5a0[_0xb55e('0x31')][_0xb55e('0x40')]){_0x4c1923[_0xb55e('0x3b')]=_[_0xb55e('0x3d')](_0x4c1923[_0xb55e('0x3b')],{'$or':_[_0xb55e('0x2b')](_0x4c1923[_0xb55e('0x34')],function(_0x102702){var _0x54fb83={};_0x54fb83[_0x102702]={'$like':'%'+_0x4cc5a0[_0xb55e('0x31')]['filter']+'%'};return _0x54fb83;})});}_0x4c1923=_[_0xb55e('0x3d')]({},_0x4c1923,_0x4cc5a0['options']);return _0x5ce36e[_0xb55e('0x52')](_0x4c1923);}})[_0xb55e('0x25')](function(_0x835ef3){if(_0x835ef3){_0x982f75=_0x835ef3['length'];if(!_0x4cc5a0[_0xb55e('0x31')][_0xb55e('0x37')](_0xb55e('0x38'))){_0x4c1923[_0xb55e('0x1e')]=qs['limit'](_0x4cc5a0['query'][_0xb55e('0x1e')]);_0x4c1923[_0xb55e('0x1c')]=qs['offset'](_0x4cc5a0[_0xb55e('0x31')]['offset']);}return _0x5ce36e['getTags'](_0x4c1923);}})[_0xb55e('0x25')](function(_0x1b1413){if(_0x1b1413){return _0x1b1413?{'count':_0x982f75,'rows':_0x1b1413}:null;}})['then'](respondWithResult(_0x222772,null))[_0xb55e('0x47')](handleError(_0x222772,null));};exports[_0xb55e('0x54')]=function(_0x529b6c,_0x2895d2,_0x53477f){if(_0x529b6c[_0xb55e('0x4c')]['id']){delete _0x529b6c[_0xb55e('0x4c')]['id'];}return db[_0xb55e('0x42')][_0xb55e('0x4e')]({'where':{'id':_0x529b6c[_0xb55e('0x49')]['id']}})[_0xb55e('0x25')](handleEntityNotFound(_0x2895d2,null))[_0xb55e('0x25')](function(_0x4372ee){if(_0x4372ee){return _0x4372ee[_0xb55e('0x54')](_0x529b6c[_0xb55e('0x4c')]['ids']||[]);}return null;})[_0xb55e('0x25')](respondWithResult(_0x2895d2,null))[_0xb55e('0x47')](handleError(_0x2895d2,null));}; \ No newline at end of file +var _0xd02c=['json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','nolimit','order','where','pick','filters','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','length','find','catch','create','body','params','findOne','sort','options','getFields','hasOwnProperty','getSubjects','keys','FreshdeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status'];(function(_0x51069f,_0x5f4cfa){var _0x39c2d0=function(_0x717c28){while(--_0x717c28){_0x51069f['push'](_0x51069f['shift']());}};_0x39c2d0(++_0x5f4cfa);}(_0xd02c,0xe2));var _0xcd02=function(_0x457476,_0x21aecc){_0x457476=_0x457476-0x0;var _0x2fd27b=_0xd02c[_0x457476];return _0x2fd27b;};'use strict';var emlformat=require(_0xcd02('0x0'));var rimraf=require(_0xcd02('0x1'));var zipdir=require(_0xcd02('0x2'));var jsonpatch=require(_0xcd02('0x3'));var rp=require('request-promise');var moment=require(_0xcd02('0x4'));var BPromise=require(_0xcd02('0x5'));var Mustache=require('mustache');var util=require(_0xcd02('0x6'));var path=require(_0xcd02('0x7'));var sox=require(_0xcd02('0x8'));var csv=require(_0xcd02('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xcd02('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcd02('0x9'));var querystring=require('querystring');var Papa=require(_0xcd02('0xb'));var Redis=require(_0xcd02('0xc'));var authService=require(_0xcd02('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xcd02('0xe'));var hardwareService=require(_0xcd02('0xf'));var logger=require(_0xcd02('0x10'))(_0xcd02('0x11'));var utils=require(_0xcd02('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcd02('0x13'))['db'];function respondWithStatusCode(_0x125a21,_0x35d73e){_0x35d73e=_0x35d73e||0xcc;return function(_0x688f01){if(_0x688f01){return _0x125a21[_0xcd02('0x14')](_0x35d73e);}return _0x125a21['status'](_0x35d73e)[_0xcd02('0x15')]();};}function respondWithResult(_0x58bda5,_0x59fd4e){_0x59fd4e=_0x59fd4e||0xc8;return function(_0x5a2575){if(_0x5a2575){return _0x58bda5[_0xcd02('0x16')](_0x59fd4e)[_0xcd02('0x17')](_0x5a2575);}};}function respondWithFilteredResult(_0x483365,_0x577104){return function(_0x9d8ae1){if(_0x9d8ae1){var _0x3d3f1d=typeof _0x577104[_0xcd02('0x18')]===_0xcd02('0x19')&&typeof _0x577104['limit']==='undefined';var _0x2cdfcb=_0x9d8ae1[_0xcd02('0x1a')];var _0x4b302c=_0x3d3f1d?0x0:_0x577104['offset'];var _0x3c5586=_0x3d3f1d?_0x9d8ae1['count']:_0x577104[_0xcd02('0x18')]+_0x577104[_0xcd02('0x1b')];var _0x4bdbf2;if(_0x3c5586>=_0x2cdfcb){_0x3c5586=_0x2cdfcb;_0x4bdbf2=0xc8;}else{_0x4bdbf2=0xce;}_0x483365['status'](_0x4bdbf2);return _0x483365['set'](_0xcd02('0x1c'),_0x4b302c+'-'+_0x3c5586+'/'+_0x2cdfcb)[_0xcd02('0x17')](_0x9d8ae1);}return null;};}function patchUpdates(_0x12957a){return function(_0x452efa){try{jsonpatch[_0xcd02('0x1d')](_0x452efa,_0x12957a,!![]);}catch(_0x31416d){return BPromise[_0xcd02('0x1e')](_0x31416d);}return _0x452efa[_0xcd02('0x1f')]();};}function saveUpdates(_0x5251e5,_0x574d7c){return function(_0x388943){if(_0x388943){return _0x388943[_0xcd02('0x20')](_0x5251e5)['then'](function(_0x1270aa){return _0x1270aa;});}return null;};}function removeEntity(_0xd6c9ab,_0x3a4094){return function(_0x461b7c){if(_0x461b7c){return _0x461b7c[_0xcd02('0x21')]()[_0xcd02('0x22')](function(){_0xd6c9ab['status'](0xcc)[_0xcd02('0x15')]();});}};}function handleEntityNotFound(_0x4ed999,_0x5eb544){return function(_0x41b0eb){if(!_0x41b0eb){_0x4ed999['sendStatus'](0x194);}return _0x41b0eb;};}function handleError(_0x33daae,_0x3c1a54){_0x3c1a54=_0x3c1a54||0x1f4;return function(_0x45837a){logger[_0xcd02('0x23')](_0x45837a[_0xcd02('0x24')]);if(_0x45837a[_0xcd02('0x25')]){delete _0x45837a[_0xcd02('0x25')];}_0x33daae['status'](_0x3c1a54)[_0xcd02('0x26')](_0x45837a);};}exports[_0xcd02('0x27')]=function(_0x43a309,_0x174d25){var _0x2fa729={},_0x4c83de={},_0x41e603={'count':0x0,'rows':[]};var _0x1d9a86=_[_0xcd02('0x28')](db[_0xcd02('0x29')][_0xcd02('0x2a')],function(_0x455f9e){return{'name':_0x455f9e[_0xcd02('0x2b')],'type':_0x455f9e[_0xcd02('0x2c')][_0xcd02('0x2d')]};});_0x4c83de[_0xcd02('0x2e')]=_['map'](_0x1d9a86,_0xcd02('0x25'));_0x4c83de[_0xcd02('0x2f')]=_['keys'](_0x43a309[_0xcd02('0x2f')]);_0x4c83de['filters']=_[_0xcd02('0x30')](_0x4c83de[_0xcd02('0x2e')],_0x4c83de[_0xcd02('0x2f')]);_0x2fa729['attributes']=_[_0xcd02('0x30')](_0x4c83de[_0xcd02('0x2e')],qs[_0xcd02('0x31')](_0x43a309[_0xcd02('0x2f')][_0xcd02('0x31')]));_0x2fa729[_0xcd02('0x32')]=_0x2fa729['attributes']['length']?_0x2fa729['attributes']:_0x4c83de[_0xcd02('0x2e')];if(!_0x43a309[_0xcd02('0x2f')]['hasOwnProperty'](_0xcd02('0x33'))){_0x2fa729[_0xcd02('0x1b')]=qs[_0xcd02('0x1b')](_0x43a309[_0xcd02('0x2f')][_0xcd02('0x1b')]);_0x2fa729[_0xcd02('0x18')]=qs[_0xcd02('0x18')](_0x43a309[_0xcd02('0x2f')][_0xcd02('0x18')]);}_0x2fa729[_0xcd02('0x34')]=qs['sort'](_0x43a309[_0xcd02('0x2f')]['sort']);_0x2fa729[_0xcd02('0x35')]=qs['filters'](_[_0xcd02('0x36')](_0x43a309[_0xcd02('0x2f')],_0x4c83de[_0xcd02('0x37')]),_0x1d9a86);if(_0x43a309[_0xcd02('0x2f')][_0xcd02('0x38')]){_0x2fa729[_0xcd02('0x35')]=_['merge'](_0x2fa729[_0xcd02('0x35')],{'$or':_[_0xcd02('0x28')](_0x1d9a86,function(_0x1b751c){if(_0x1b751c[_0xcd02('0x2c')]!==_0xcd02('0x39')){var _0x4d7798={};_0x4d7798[_0x1b751c[_0xcd02('0x25')]]={'$like':'%'+_0x43a309['query'][_0xcd02('0x38')]+'%'};return _0x4d7798;}})});}_0x2fa729=_[_0xcd02('0x3a')]({},_0x2fa729,_0x43a309['options']);var _0x486857={'where':_0x2fa729[_0xcd02('0x35')]};return db[_0xcd02('0x29')][_0xcd02('0x1a')](_0x486857)[_0xcd02('0x22')](function(_0x247416){_0x41e603[_0xcd02('0x1a')]=_0x247416;if(_0x43a309[_0xcd02('0x2f')][_0xcd02('0x3b')]){_0x2fa729[_0xcd02('0x3c')]=[{'all':!![]}];}return db[_0xcd02('0x29')][_0xcd02('0x3d')](_0x2fa729);})[_0xcd02('0x22')](function(_0xa97d8f){_0x41e603[_0xcd02('0x3e')]=_0xa97d8f;return _0x41e603;})[_0xcd02('0x22')](respondWithFilteredResult(_0x174d25,_0x2fa729))['catch'](handleError(_0x174d25,null));};exports[_0xcd02('0x3f')]=function(_0x3dcdee,_0x168231){var _0x3907c0={'raw':![],'where':{'id':_0x3dcdee['params']['id']}},_0x3f9f35={};_0x3f9f35[_0xcd02('0x2e')]=_['keys'](db['FreshdeskConfiguration'][_0xcd02('0x2a')]);_0x3f9f35['query']=_['keys'](_0x3dcdee[_0xcd02('0x2f')]);_0x3f9f35[_0xcd02('0x37')]=_[_0xcd02('0x30')](_0x3f9f35[_0xcd02('0x2e')],_0x3f9f35['query']);_0x3907c0[_0xcd02('0x32')]=_[_0xcd02('0x30')](_0x3f9f35[_0xcd02('0x2e')],qs[_0xcd02('0x31')](_0x3dcdee[_0xcd02('0x2f')][_0xcd02('0x31')]));_0x3907c0[_0xcd02('0x32')]=_0x3907c0[_0xcd02('0x32')][_0xcd02('0x40')]?_0x3907c0[_0xcd02('0x32')]:_0x3f9f35[_0xcd02('0x2e')];if(_0x3dcdee[_0xcd02('0x2f')][_0xcd02('0x3b')]){_0x3907c0[_0xcd02('0x3c')]=[{'all':!![]}];}_0x3907c0=_[_0xcd02('0x3a')]({},_0x3907c0,_0x3dcdee['options']);return db['FreshdeskConfiguration'][_0xcd02('0x41')](_0x3907c0)[_0xcd02('0x22')](handleEntityNotFound(_0x168231,null))['then'](respondWithResult(_0x168231,null))[_0xcd02('0x42')](handleError(_0x168231,null));};exports[_0xcd02('0x43')]=function(_0xa95563,_0x317876){return db[_0xcd02('0x29')][_0xcd02('0x43')](_0xa95563[_0xcd02('0x44')],{})[_0xcd02('0x22')](respondWithResult(_0x317876,0xc9))[_0xcd02('0x42')](handleError(_0x317876,null));};exports['update']=function(_0x1531e3,_0x2ff0a8){if(_0x1531e3[_0xcd02('0x44')]['id']){delete _0x1531e3[_0xcd02('0x44')]['id'];}return db['FreshdeskConfiguration']['find']({'where':{'id':_0x1531e3[_0xcd02('0x45')]['id']}})[_0xcd02('0x22')](handleEntityNotFound(_0x2ff0a8,null))[_0xcd02('0x22')](saveUpdates(_0x1531e3[_0xcd02('0x44')],null))[_0xcd02('0x22')](respondWithResult(_0x2ff0a8,null))[_0xcd02('0x42')](handleError(_0x2ff0a8,null));};exports[_0xcd02('0x21')]=function(_0x5756b0,_0x2e30fe){return db[_0xcd02('0x29')][_0xcd02('0x41')]({'where':{'id':_0x5756b0[_0xcd02('0x45')]['id']}})[_0xcd02('0x22')](handleEntityNotFound(_0x2e30fe,null))[_0xcd02('0x22')](removeEntity(_0x2e30fe,null))['catch'](handleError(_0x2e30fe,null));};exports['getFields']=function(_0x29f8ad,_0x5d284d,_0x4f3b59){var _0x225eff={};var _0x53ef1e={};var _0x241791;var _0x4f5264;return db[_0xcd02('0x29')][_0xcd02('0x46')]({'where':{'id':_0x29f8ad[_0xcd02('0x45')]['id']}})[_0xcd02('0x22')](handleEntityNotFound(_0x5d284d,null))['then'](function(_0xb17d35){if(_0xb17d35){_0x241791=_0xb17d35;_0x53ef1e['model']=_['keys'](db['FreshdeskField'][_0xcd02('0x2a')]);_0x53ef1e['query']=_['keys'](_0x29f8ad[_0xcd02('0x2f')]);_0x53ef1e[_0xcd02('0x37')]=_[_0xcd02('0x30')](_0x53ef1e[_0xcd02('0x2e')],_0x53ef1e['query']);_0x225eff['attributes']=_['intersection'](_0x53ef1e['model'],qs[_0xcd02('0x31')](_0x29f8ad[_0xcd02('0x2f')][_0xcd02('0x31')]));_0x225eff[_0xcd02('0x32')]=_0x225eff['attributes'][_0xcd02('0x40')]?_0x225eff['attributes']:_0x53ef1e['model'];_0x225eff[_0xcd02('0x34')]=qs['sort'](_0x29f8ad[_0xcd02('0x2f')][_0xcd02('0x47')]);_0x225eff['where']=qs['filters'](_[_0xcd02('0x36')](_0x29f8ad['query'],_0x53ef1e[_0xcd02('0x37')]));if(_0x29f8ad[_0xcd02('0x2f')]['filter']){_0x225eff[_0xcd02('0x35')]=_[_0xcd02('0x3a')](_0x225eff['where'],{'$or':_[_0xcd02('0x28')](_0x225eff[_0xcd02('0x32')],function(_0x4f4c59){var _0x2240f0={};_0x2240f0[_0x4f4c59]={'$like':'%'+_0x29f8ad[_0xcd02('0x2f')][_0xcd02('0x38')]+'%'};return _0x2240f0;})});}_0x225eff=_['merge']({},_0x225eff,_0x29f8ad[_0xcd02('0x48')]);return _0x241791[_0xcd02('0x49')](_0x225eff);}})['then'](function(_0x57b1ee){if(_0x57b1ee){_0x4f5264=_0x57b1ee[_0xcd02('0x40')];if(!_0x29f8ad['query'][_0xcd02('0x4a')](_0xcd02('0x33'))){_0x225eff['limit']=qs['limit'](_0x29f8ad[_0xcd02('0x2f')][_0xcd02('0x1b')]);_0x225eff['offset']=qs['offset'](_0x29f8ad['query']['offset']);}return _0x241791[_0xcd02('0x49')](_0x225eff);}})[_0xcd02('0x22')](function(_0x23f7a1){if(_0x23f7a1){return _0x23f7a1?{'count':_0x4f5264,'rows':_0x23f7a1}:null;}})[_0xcd02('0x22')](respondWithResult(_0x5d284d,null))['catch'](handleError(_0x5d284d,null));};exports[_0xcd02('0x4b')]=function(_0x339a2d,_0x2fbaac,_0x440d51){var _0x3a24d3={};var _0x115696={};var _0x4d49c1;var _0x27a5c0;return db[_0xcd02('0x29')][_0xcd02('0x46')]({'where':{'id':_0x339a2d['params']['id']}})[_0xcd02('0x22')](handleEntityNotFound(_0x2fbaac,null))[_0xcd02('0x22')](function(_0x11dc43){if(_0x11dc43){_0x4d49c1=_0x11dc43;_0x115696['model']=_[_0xcd02('0x4c')](db[_0xcd02('0x4d')][_0xcd02('0x2a')]);_0x115696[_0xcd02('0x2f')]=_['keys'](_0x339a2d[_0xcd02('0x2f')]);_0x115696[_0xcd02('0x37')]=_[_0xcd02('0x30')](_0x115696[_0xcd02('0x2e')],_0x115696[_0xcd02('0x2f')]);_0x3a24d3['attributes']=_[_0xcd02('0x30')](_0x115696[_0xcd02('0x2e')],qs[_0xcd02('0x31')](_0x339a2d['query']['fields']));_0x3a24d3[_0xcd02('0x32')]=_0x3a24d3[_0xcd02('0x32')][_0xcd02('0x40')]?_0x3a24d3[_0xcd02('0x32')]:_0x115696[_0xcd02('0x2e')];_0x3a24d3[_0xcd02('0x34')]=qs['sort'](_0x339a2d[_0xcd02('0x2f')][_0xcd02('0x47')]);_0x3a24d3['where']=qs[_0xcd02('0x37')](_[_0xcd02('0x36')](_0x339a2d['query'],_0x115696[_0xcd02('0x37')]));if(_0x339a2d['query'][_0xcd02('0x38')]){_0x3a24d3[_0xcd02('0x35')]=_[_0xcd02('0x3a')](_0x3a24d3[_0xcd02('0x35')],{'$or':_[_0xcd02('0x28')](_0x3a24d3[_0xcd02('0x32')],function(_0x2daf7e){var _0x3c5437={};_0x3c5437[_0x2daf7e]={'$like':'%'+_0x339a2d[_0xcd02('0x2f')]['filter']+'%'};return _0x3c5437;})});}_0x3a24d3=_[_0xcd02('0x3a')]({},_0x3a24d3,_0x339a2d[_0xcd02('0x48')]);return _0x4d49c1['getSubjects'](_0x3a24d3);}})['then'](function(_0x54c059){if(_0x54c059){_0x27a5c0=_0x54c059[_0xcd02('0x40')];if(!_0x339a2d[_0xcd02('0x2f')][_0xcd02('0x4a')]('nolimit')){_0x3a24d3[_0xcd02('0x1b')]=qs[_0xcd02('0x1b')](_0x339a2d[_0xcd02('0x2f')]['limit']);_0x3a24d3['offset']=qs[_0xcd02('0x18')](_0x339a2d[_0xcd02('0x2f')]['offset']);}return _0x4d49c1['getSubjects'](_0x3a24d3);}})[_0xcd02('0x22')](function(_0x14e055){if(_0x14e055){return _0x14e055?{'count':_0x27a5c0,'rows':_0x14e055}:null;}})[_0xcd02('0x22')](respondWithResult(_0x2fbaac,null))[_0xcd02('0x42')](handleError(_0x2fbaac,null));};exports[_0xcd02('0x4e')]=function(_0x5a0811,_0x28a29e,_0x3d54fb){var _0x7c8984={};var _0x4ab8ec={};var _0x5de568;var _0x56a30e;return db[_0xcd02('0x29')]['findOne']({'where':{'id':_0x5a0811['params']['id']}})['then'](handleEntityNotFound(_0x28a29e,null))[_0xcd02('0x22')](function(_0x147165){if(_0x147165){_0x5de568=_0x147165;_0x4ab8ec['model']=_[_0xcd02('0x4c')](db[_0xcd02('0x4d')][_0xcd02('0x2a')]);_0x4ab8ec['query']=_['keys'](_0x5a0811[_0xcd02('0x2f')]);_0x4ab8ec[_0xcd02('0x37')]=_['intersection'](_0x4ab8ec['model'],_0x4ab8ec[_0xcd02('0x2f')]);_0x7c8984['attributes']=_[_0xcd02('0x30')](_0x4ab8ec[_0xcd02('0x2e')],qs[_0xcd02('0x31')](_0x5a0811[_0xcd02('0x2f')][_0xcd02('0x31')]));_0x7c8984['attributes']=_0x7c8984[_0xcd02('0x32')][_0xcd02('0x40')]?_0x7c8984[_0xcd02('0x32')]:_0x4ab8ec[_0xcd02('0x2e')];_0x7c8984['order']=qs[_0xcd02('0x47')](_0x5a0811[_0xcd02('0x2f')][_0xcd02('0x47')]);_0x7c8984[_0xcd02('0x35')]=qs['filters'](_[_0xcd02('0x36')](_0x5a0811[_0xcd02('0x2f')],_0x4ab8ec['filters']));if(_0x5a0811[_0xcd02('0x2f')][_0xcd02('0x38')]){_0x7c8984['where']=_[_0xcd02('0x3a')](_0x7c8984[_0xcd02('0x35')],{'$or':_['map'](_0x7c8984[_0xcd02('0x32')],function(_0x519cbf){var _0x37b1e2={};_0x37b1e2[_0x519cbf]={'$like':'%'+_0x5a0811[_0xcd02('0x2f')][_0xcd02('0x38')]+'%'};return _0x37b1e2;})});}_0x7c8984=_[_0xcd02('0x3a')]({},_0x7c8984,_0x5a0811[_0xcd02('0x48')]);return _0x5de568[_0xcd02('0x4e')](_0x7c8984);}})[_0xcd02('0x22')](function(_0x2d4fc1){if(_0x2d4fc1){_0x56a30e=_0x2d4fc1[_0xcd02('0x40')];if(!_0x5a0811[_0xcd02('0x2f')][_0xcd02('0x4a')]('nolimit')){_0x7c8984[_0xcd02('0x1b')]=qs['limit'](_0x5a0811['query'][_0xcd02('0x1b')]);_0x7c8984['offset']=qs[_0xcd02('0x18')](_0x5a0811[_0xcd02('0x2f')]['offset']);}return _0x5de568[_0xcd02('0x4e')](_0x7c8984);}})['then'](function(_0x59b2cf){if(_0x59b2cf){return _0x59b2cf?{'count':_0x56a30e,'rows':_0x59b2cf}:null;}})[_0xcd02('0x22')](respondWithResult(_0x28a29e,null))[_0xcd02('0x42')](handleError(_0x28a29e,null));};exports[_0xcd02('0x4f')]=function(_0x3c2651,_0x1fae70,_0x530435){var _0x543f59={};var _0x2d347c={};var _0x151c82;var _0x403612;return db['FreshdeskConfiguration'][_0xcd02('0x46')]({'where':{'id':_0x3c2651['params']['id']}})[_0xcd02('0x22')](handleEntityNotFound(_0x1fae70,null))[_0xcd02('0x22')](function(_0x1b0de7){if(_0x1b0de7){_0x151c82=_0x1b0de7;_0x2d347c[_0xcd02('0x2e')]=_['keys'](db[_0xcd02('0x50')][_0xcd02('0x2a')]);_0x2d347c[_0xcd02('0x2f')]=_[_0xcd02('0x4c')](_0x3c2651[_0xcd02('0x2f')]);_0x2d347c[_0xcd02('0x37')]=_[_0xcd02('0x30')](_0x2d347c[_0xcd02('0x2e')],_0x2d347c[_0xcd02('0x2f')]);_0x543f59[_0xcd02('0x32')]=_[_0xcd02('0x30')](_0x2d347c[_0xcd02('0x2e')],qs['fields'](_0x3c2651[_0xcd02('0x2f')][_0xcd02('0x31')]));_0x543f59[_0xcd02('0x32')]=_0x543f59[_0xcd02('0x32')][_0xcd02('0x40')]?_0x543f59[_0xcd02('0x32')]:_0x2d347c[_0xcd02('0x2e')];_0x543f59[_0xcd02('0x34')]=qs[_0xcd02('0x47')](_0x3c2651[_0xcd02('0x2f')][_0xcd02('0x47')]);_0x543f59[_0xcd02('0x35')]=qs[_0xcd02('0x37')](_['pick'](_0x3c2651[_0xcd02('0x2f')],_0x2d347c[_0xcd02('0x37')]));if(_0x3c2651[_0xcd02('0x2f')][_0xcd02('0x38')]){_0x543f59[_0xcd02('0x35')]=_[_0xcd02('0x3a')](_0x543f59['where'],{'$or':_[_0xcd02('0x28')](_0x543f59[_0xcd02('0x32')],function(_0x294976){var _0x504cdf={};_0x504cdf[_0x294976]={'$like':'%'+_0x3c2651[_0xcd02('0x2f')]['filter']+'%'};return _0x504cdf;})});}_0x543f59=_[_0xcd02('0x3a')]({},_0x543f59,_0x3c2651['options']);return _0x151c82['getTags'](_0x543f59);}})[_0xcd02('0x22')](function(_0x264409){if(_0x264409){_0x403612=_0x264409[_0xcd02('0x40')];if(!_0x3c2651[_0xcd02('0x2f')]['hasOwnProperty'](_0xcd02('0x33'))){_0x543f59[_0xcd02('0x1b')]=qs['limit'](_0x3c2651[_0xcd02('0x2f')][_0xcd02('0x1b')]);_0x543f59['offset']=qs['offset'](_0x3c2651[_0xcd02('0x2f')][_0xcd02('0x18')]);}return _0x151c82[_0xcd02('0x4f')](_0x543f59);}})[_0xcd02('0x22')](function(_0xc6dd45){if(_0xc6dd45){return _0xc6dd45?{'count':_0x403612,'rows':_0xc6dd45}:null;}})[_0xcd02('0x22')](respondWithResult(_0x1fae70,null))[_0xcd02('0x42')](handleError(_0x1fae70,null));};exports[_0xcd02('0x51')]=function(_0x15e224,_0x55e3b1,_0x3e0fe2){if(_0x15e224[_0xcd02('0x44')]['id']){delete _0x15e224['body']['id'];}return db[_0xcd02('0x29')]['findOne']({'where':{'id':_0x15e224[_0xcd02('0x45')]['id']}})[_0xcd02('0x22')](handleEntityNotFound(_0x55e3b1,null))[_0xcd02('0x22')](function(_0x208022){if(_0x208022){return _0x208022['setTags'](_0x15e224[_0xcd02('0x44')][_0xcd02('0x52')]||[]);}return null;})['then'](respondWithResult(_0x55e3b1,null))[_0xcd02('0x42')](handleError(_0x55e3b1,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index f47aa61..aefd829 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 _0xddb1=['lodash','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations'];(function(_0x24cdda,_0x299ba0){var _0x5f0e0d=function(_0x5e5bc8){while(--_0x5e5bc8){_0x24cdda['push'](_0x24cdda['shift']());}};_0x5f0e0d(++_0x299ba0);}(_0xddb1,0x118));var _0x1ddb=function(_0x42e4ca,_0x10313b){_0x42e4ca=_0x42e4ca-0x0;var _0x2585bb=_0xddb1[_0x42e4ca];return _0x2585bb;};'use strict';var _=require(_0x1ddb('0x0'));var util=require('util');var logger=require(_0x1ddb('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1ddb('0x2'));var rp=require(_0x1ddb('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1ddb('0x4'));var config=require(_0x1ddb('0x5'));var attributes=require(_0x1ddb('0x6'));module[_0x1ddb('0x7')]=function(_0x366eed,_0x35c591){return _0x366eed[_0x1ddb('0x8')]('FreshdeskConfiguration',attributes,{'tableName':_0x1ddb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa4be=['moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','util','../../config/logger','api'];(function(_0x274ee7,_0x1a7941){var _0x430c79=function(_0x39cb6b){while(--_0x39cb6b){_0x274ee7['push'](_0x274ee7['shift']());}};_0x430c79(++_0x1a7941);}(_0xa4be,0x126));var _0xea4b=function(_0x40d5b9,_0x377df5){_0x40d5b9=_0x40d5b9-0x0;var _0xdfce37=_0xa4be[_0x40d5b9];return _0xdfce37;};'use strict';var _=require('lodash');var util=require(_0xea4b('0x0'));var logger=require(_0xea4b('0x1'))(_0xea4b('0x2'));var moment=require(_0xea4b('0x3'));var BPromise=require(_0xea4b('0x4'));var rp=require(_0xea4b('0x5'));var fs=require('fs');var path=require(_0xea4b('0x6'));var rimraf=require('rimraf');var config=require(_0xea4b('0x7'));var attributes=require(_0xea4b('0x8'));module['exports']=function(_0x3bd208,_0x1f31fd){return _0x3bd208[_0xea4b('0x9')](_0xea4b('0xa'),attributes,{'tableName':'int_freshdesk_configurations','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 686c09f..59b9a25 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 _0x9a1a=['ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','catch','util','bluebird','randomstring'];(function(_0x14c4ba,_0x3b159d){var _0xed71c5=function(_0x5af030){while(--_0x5af030){_0x14c4ba['push'](_0x14c4ba['shift']());}};_0xed71c5(++_0x3b159d);}(_0x9a1a,0x1b5));var _0xa9a1=function(_0x7729f1,_0x3bd1ab){_0x7729f1=_0x7729f1-0x0;var _0x40faf3=_0x9a1a[_0x7729f1];return _0x40faf3;};'use strict';var _=require('lodash');var util=require(_0xa9a1('0x0'));var moment=require('moment');var BPromise=require(_0xa9a1('0x1'));var rs=require(_0xa9a1('0x2'));var fs=require('fs');var Redis=require(_0xa9a1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa9a1('0x4'));var logger=require(_0xa9a1('0x5'))('rpc');var config=require(_0xa9a1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa9a1('0x7')][_0xa9a1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2bcfdc,_0x255d6b,_0x309267){return new BPromise(function(_0x566e11,_0x4193d8){return client[_0xa9a1('0x9')](_0x2bcfdc,_0x309267)[_0xa9a1('0xa')](function(_0xb7cdf){logger[_0xa9a1('0xb')](_0xa9a1('0xc'),_0x255d6b,'request\x20sent');logger[_0xa9a1('0xd')](_0xa9a1('0xe'),_0x255d6b,'request\x20sent',JSON[_0xa9a1('0xf')](_0xb7cdf));if(_0xb7cdf['error']){if(_0xb7cdf['error'][_0xa9a1('0x10')]===0x1f4){logger[_0xa9a1('0x11')](_0xa9a1('0xc'),_0x255d6b,_0xb7cdf[_0xa9a1('0x11')][_0xa9a1('0x12')]);return _0x4193d8(_0xb7cdf['error'][_0xa9a1('0x12')]);}logger[_0xa9a1('0x11')](_0xa9a1('0xc'),_0x255d6b,_0xb7cdf[_0xa9a1('0x11')][_0xa9a1('0x12')]);return _0x566e11(_0xb7cdf['error'][_0xa9a1('0x12')]);}else{logger['info'](_0xa9a1('0xc'),_0x255d6b,_0xa9a1('0x13'));_0x566e11(_0xb7cdf[_0xa9a1('0x14')][_0xa9a1('0x12')]);}})[_0xa9a1('0x15')](function(_0x195210){logger[_0xa9a1('0x11')](_0xa9a1('0xc'),_0x255d6b,_0x195210);_0x4193d8(_0x195210);});});} \ No newline at end of file +var _0x9671=['bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result'];(function(_0x4934f1,_0x41bbd4){var _0x429ed8=function(_0x4a1514){while(--_0x4a1514){_0x4934f1['push'](_0x4934f1['shift']());}};_0x429ed8(++_0x41bbd4);}(_0x9671,0x1db));var _0x1967=function(_0x1e830f,_0x5990ad){_0x1e830f=_0x1e830f-0x0;var _0x3312c1=_0x9671[_0x1e830f];return _0x3312c1;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x1967('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1967('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x1967('0x2'));var logger=require('../../config/logger')(_0x1967('0x3'));var config=require(_0x1967('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x1967('0x5')][_0x1967('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1c599e,_0x28a18b,_0x253c9a){return new BPromise(function(_0xcf2c29,_0x25b2b6){return client[_0x1967('0x7')](_0x1c599e,_0x253c9a)[_0x1967('0x8')](function(_0x4dfd2a){logger[_0x1967('0x9')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x28a18b,_0x1967('0xa'));logger[_0x1967('0xb')](_0x1967('0xc'),_0x28a18b,'request\x20sent',JSON[_0x1967('0xd')](_0x4dfd2a));if(_0x4dfd2a[_0x1967('0xe')]){if(_0x4dfd2a[_0x1967('0xe')][_0x1967('0xf')]===0x1f4){logger[_0x1967('0xe')](_0x1967('0x10'),_0x28a18b,_0x4dfd2a[_0x1967('0xe')][_0x1967('0x11')]);return _0x25b2b6(_0x4dfd2a[_0x1967('0xe')][_0x1967('0x11')]);}logger[_0x1967('0xe')](_0x1967('0x10'),_0x28a18b,_0x4dfd2a[_0x1967('0xe')]['message']);return _0xcf2c29(_0x4dfd2a[_0x1967('0xe')]['message']);}else{logger[_0x1967('0x9')](_0x1967('0x10'),_0x28a18b,_0x1967('0xa'));_0xcf2c29(_0x4dfd2a[_0x1967('0x12')][_0x1967('0x11')]);}})['catch'](function(_0x1c2ff5){logger[_0x1967('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x28a18b,_0x1c2ff5);_0x25b2b6(_0x1c2ff5);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index d314d6b..a62282f 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 _0x0833=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','create','put','update','exports','multer'];(function(_0x1e7c62,_0x4e8449){var _0x517f43=function(_0x1a5a24){while(--_0x1a5a24){_0x1e7c62['push'](_0x1e7c62['shift']());}};_0x517f43(++_0x4e8449);}(_0x0833,0x1e5));var _0x3083=function(_0x2486c7,_0x1be0ac){_0x2486c7=_0x2486c7-0x0;var _0x4a9e0f=_0x0833[_0x2486c7];return _0x4a9e0f;};'use strict';var multer=require(_0x3083('0x0'));var util=require(_0x3083('0x1'));var path=require(_0x3083('0x2'));var timeout=require(_0x3083('0x3'));var express=require(_0x3083('0x4'));var router=express[_0x3083('0x5')]();var fs_extra=require(_0x3083('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3083('0x7'));var config=require(_0x3083('0x8'));var controller=require(_0x3083('0x9'));router[_0x3083('0xa')]('/',auth[_0x3083('0xb')](),controller[_0x3083('0xc')]);router[_0x3083('0xa')](_0x3083('0xd'),auth[_0x3083('0xb')](),controller['show']);router['post']('/',auth[_0x3083('0xb')](),controller[_0x3083('0xe')]);router[_0x3083('0xf')](_0x3083('0xd'),auth['isAuthenticated'](),controller[_0x3083('0x10')]);router['delete'](_0x3083('0xd'),auth[_0x3083('0xb')](),controller['destroy']);module[_0x3083('0x11')]=router; \ No newline at end of file +var _0xc68c=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','util'];(function(_0x21dda1,_0xa7ec61){var _0x478ee5=function(_0x3a862b){while(--_0x3a862b){_0x21dda1['push'](_0x21dda1['shift']());}};_0x478ee5(++_0xa7ec61);}(_0xc68c,0x1a8));var _0xcc68=function(_0x3d79eb,_0x579f87){_0x3d79eb=_0x3d79eb-0x0;var _0x37b77a=_0xc68c[_0x3d79eb];return _0x37b77a;};'use strict';var multer=require('multer');var util=require(_0xcc68('0x0'));var path=require(_0xcc68('0x1'));var timeout=require(_0xcc68('0x2'));var express=require('express');var router=express[_0xcc68('0x3')]();var fs_extra=require(_0xcc68('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xcc68('0x5'));var config=require(_0xcc68('0x6'));var controller=require('./intFreshdeskField.controller');router[_0xcc68('0x7')]('/',auth[_0xcc68('0x8')](),controller[_0xcc68('0x9')]);router[_0xcc68('0x7')](_0xcc68('0xa'),auth[_0xcc68('0x8')](),controller[_0xcc68('0xb')]);router[_0xcc68('0xc')]('/',auth['isAuthenticated'](),controller[_0xcc68('0xd')]);router['put'](_0xcc68('0xa'),auth[_0xcc68('0x8')](),controller[_0xcc68('0xe')]);router[_0xcc68('0xf')](_0xcc68('0xa'),auth[_0xcc68('0x8')](),controller[_0xcc68('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 0eb16f6..777f2c6 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 _0xfa8d=['sequelize','exports','ENUM','string','variable','customVariable','picklist','STRING'];(function(_0x4d039c,_0x3d6309){var _0x51aec3=function(_0x31424d){while(--_0x31424d){_0x4d039c['push'](_0x4d039c['shift']());}};_0x51aec3(++_0x3d6309);}(_0xfa8d,0x1a0));var _0xdfa8=function(_0x893dd7,_0x4117ec){_0x893dd7=_0x893dd7-0x0;var _0x38e4b8=_0xfa8d[_0x893dd7];return _0x38e4b8;};'use strict';var Sequelize=require(_0xdfa8('0x0'));module[_0xdfa8('0x1')]={'type':{'type':Sequelize[_0xdfa8('0x2')](_0xdfa8('0x3'),_0xdfa8('0x4'),_0xdfa8('0x5'),'keyValue',_0xdfa8('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xdfa8('0x7')]},'key':{'type':Sequelize[_0xdfa8('0x7')]},'keyType':{'type':Sequelize[_0xdfa8('0x2')]('string',_0xdfa8('0x4'),_0xdfa8('0x5'))},'keyContent':{'type':Sequelize[_0xdfa8('0x7')]},'idField':{'type':Sequelize[_0xdfa8('0x7')]},'nameField':{'type':Sequelize[_0xdfa8('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdfa8('0x7')]}}; \ No newline at end of file +var _0x551c=['sequelize','exports','ENUM','variable','keyValue','string','STRING','customVariable','BOOLEAN'];(function(_0x23c6f2,_0x4e033c){var _0x4c270b=function(_0x4913f0){while(--_0x4913f0){_0x23c6f2['push'](_0x23c6f2['shift']());}};_0x4c270b(++_0x4e033c);}(_0x551c,0x14d));var _0xc551=function(_0x4f433c,_0x5a9a55){_0x4f433c=_0x4f433c-0x0;var _0x47dc21=_0x551c[_0x4f433c];return _0x47dc21;};'use strict';var Sequelize=require(_0xc551('0x0'));module[_0xc551('0x1')]={'type':{'type':Sequelize[_0xc551('0x2')]('string',_0xc551('0x3'),'customVariable',_0xc551('0x4'),'picklist'),'defaultValue':_0xc551('0x5')},'content':{'type':Sequelize[_0xc551('0x6')]},'key':{'type':Sequelize[_0xc551('0x6')]},'keyType':{'type':Sequelize[_0xc551('0x2')](_0xc551('0x5'),_0xc551('0x3'),_0xc551('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc551('0x6')]},'customField':{'type':Sequelize[_0xc551('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc551('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index f2a493c..ed27a77 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 _0xc6d8=['params','find','create','body','update','eml-format','zip-dir','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','destroy','error','stack','name','index','map','FreshdeskField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','then','includeAll','include','findAll','catch','show'];(function(_0x551723,_0x2c1d4d){var _0x489ad7=function(_0x4f0298){while(--_0x4f0298){_0x551723['push'](_0x551723['shift']());}};_0x489ad7(++_0x2c1d4d);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x57b4cc,_0x2ae50e){_0x57b4cc=_0x57b4cc-0x0;var _0x45ba9d=_0xc6d8[_0x57b4cc];return _0x45ba9d;};'use strict';var emlformat=require(_0x8c6d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8c6d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c6d('0x2'));var moment=require('moment');var BPromise=require(_0x8c6d('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8c6d('0x4'));var sox=require(_0x8c6d('0x5'));var csv=require(_0x8c6d('0x6'));var ejs=require(_0x8c6d('0x7'));var fs=require('fs');var fs_extra=require(_0x8c6d('0x8'));var _=require(_0x8c6d('0x9'));var squel=require(_0x8c6d('0xa'));var crypto=require('crypto');var jsforce=require(_0x8c6d('0xb'));var deskjs=require(_0x8c6d('0xc'));var toCsv=require(_0x8c6d('0x6'));var querystring=require('querystring');var Papa=require(_0x8c6d('0xd'));var Redis=require(_0x8c6d('0xe'));var authService=require(_0x8c6d('0xf'));var qs=require(_0x8c6d('0x10'));var as=require(_0x8c6d('0x11'));var hardwareService=require(_0x8c6d('0x12'));var logger=require(_0x8c6d('0x13'))(_0x8c6d('0x14'));var utils=require('../../config/utils');var config=require(_0x8c6d('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22d0fb,_0x890e85){_0x890e85=_0x890e85||0xcc;return function(_0x131d97){if(_0x131d97){return _0x22d0fb[_0x8c6d('0x16')](_0x890e85);}return _0x22d0fb[_0x8c6d('0x17')](_0x890e85)[_0x8c6d('0x18')]();};}function respondWithResult(_0x42d746,_0x103699){_0x103699=_0x103699||0xc8;return function(_0x14c1ee){if(_0x14c1ee){return _0x42d746[_0x8c6d('0x17')](_0x103699)['json'](_0x14c1ee);}};}function respondWithFilteredResult(_0x16c6b5,_0x4b2bb1){return function(_0x16af06){if(_0x16af06){var _0x4dd4b6=typeof _0x4b2bb1[_0x8c6d('0x19')]===_0x8c6d('0x1a')&&typeof _0x4b2bb1['limit']===_0x8c6d('0x1a');var _0x2b8a26=_0x16af06['count'];var _0x3e5495=_0x4dd4b6?0x0:_0x4b2bb1['offset'];var _0x4c2f8d=_0x4dd4b6?_0x16af06[_0x8c6d('0x1b')]:_0x4b2bb1['offset']+_0x4b2bb1[_0x8c6d('0x1c')];var _0x174a4f;if(_0x4c2f8d>=_0x2b8a26){_0x4c2f8d=_0x2b8a26;_0x174a4f=0xc8;}else{_0x174a4f=0xce;}_0x16c6b5[_0x8c6d('0x17')](_0x174a4f);return _0x16c6b5[_0x8c6d('0x1d')](_0x8c6d('0x1e'),_0x3e5495+'-'+_0x4c2f8d+'/'+_0x2b8a26)['json'](_0x16af06);}return null;};}function patchUpdates(_0x5512be){return function(_0x550079){try{jsonpatch[_0x8c6d('0x1f')](_0x550079,_0x5512be,!![]);}catch(_0x507e0c){return BPromise[_0x8c6d('0x20')](_0x507e0c);}return _0x550079['save']();};}function saveUpdates(_0x4c378b,_0x37fd7c){return function(_0x8cebeb){if(_0x8cebeb){return _0x8cebeb['update'](_0x4c378b)['then'](function(_0x51bb08){return _0x51bb08;});}return null;};}function removeEntity(_0x47d3a0,_0x2a85b5){return function(_0xd16c91){if(_0xd16c91){return _0xd16c91[_0x8c6d('0x21')]()['then'](function(){_0x47d3a0[_0x8c6d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15a9c4,_0x490b46){return function(_0x23c893){if(!_0x23c893){_0x15a9c4[_0x8c6d('0x16')](0x194);}return _0x23c893;};}function handleError(_0x353ba5,_0x2b6d18){_0x2b6d18=_0x2b6d18||0x1f4;return function(_0x1e6755){logger[_0x8c6d('0x22')](_0x1e6755[_0x8c6d('0x23')]);if(_0x1e6755[_0x8c6d('0x24')]){delete _0x1e6755[_0x8c6d('0x24')];}_0x353ba5['status'](_0x2b6d18)['send'](_0x1e6755);};}exports[_0x8c6d('0x25')]=function(_0x93a094,_0xfc6000){var _0x42a7db={},_0x370626={},_0x316ca7={'count':0x0,'rows':[]};var _0x2bc94a=_[_0x8c6d('0x26')](db[_0x8c6d('0x27')][_0x8c6d('0x28')],function(_0x3375dd){return{'name':_0x3375dd[_0x8c6d('0x29')],'type':_0x3375dd['type'][_0x8c6d('0x2a')]};});_0x370626[_0x8c6d('0x2b')]=_[_0x8c6d('0x26')](_0x2bc94a,_0x8c6d('0x24'));_0x370626[_0x8c6d('0x2c')]=_[_0x8c6d('0x2d')](_0x93a094[_0x8c6d('0x2c')]);_0x370626[_0x8c6d('0x2e')]=_[_0x8c6d('0x2f')](_0x370626['model'],_0x370626[_0x8c6d('0x2c')]);_0x42a7db['attributes']=_[_0x8c6d('0x2f')](_0x370626[_0x8c6d('0x2b')],qs[_0x8c6d('0x30')](_0x93a094[_0x8c6d('0x2c')][_0x8c6d('0x30')]));_0x42a7db[_0x8c6d('0x31')]=_0x42a7db['attributes']['length']?_0x42a7db[_0x8c6d('0x31')]:_0x370626[_0x8c6d('0x2b')];if(!_0x93a094[_0x8c6d('0x2c')][_0x8c6d('0x32')]('nolimit')){_0x42a7db[_0x8c6d('0x1c')]=qs[_0x8c6d('0x1c')](_0x93a094[_0x8c6d('0x2c')][_0x8c6d('0x1c')]);_0x42a7db[_0x8c6d('0x19')]=qs[_0x8c6d('0x19')](_0x93a094['query'][_0x8c6d('0x19')]);}_0x42a7db[_0x8c6d('0x33')]=qs[_0x8c6d('0x34')](_0x93a094[_0x8c6d('0x2c')][_0x8c6d('0x34')]);_0x42a7db[_0x8c6d('0x35')]=qs[_0x8c6d('0x2e')](_[_0x8c6d('0x36')](_0x93a094[_0x8c6d('0x2c')],_0x370626[_0x8c6d('0x2e')]),_0x2bc94a);if(_0x93a094[_0x8c6d('0x2c')][_0x8c6d('0x37')]){_0x42a7db['where']=_[_0x8c6d('0x38')](_0x42a7db[_0x8c6d('0x35')],{'$or':_[_0x8c6d('0x26')](_0x2bc94a,function(_0x454e96){if(_0x454e96[_0x8c6d('0x39')]!=='VIRTUAL'){var _0x26027f={};_0x26027f[_0x454e96[_0x8c6d('0x24')]]={'$like':'%'+_0x93a094['query'][_0x8c6d('0x37')]+'%'};return _0x26027f;}})});}_0x42a7db=_[_0x8c6d('0x38')]({},_0x42a7db,_0x93a094[_0x8c6d('0x3a')]);var _0x4869dc={'where':_0x42a7db[_0x8c6d('0x35')]};return db[_0x8c6d('0x27')][_0x8c6d('0x1b')](_0x4869dc)[_0x8c6d('0x3b')](function(_0x2f54a2){_0x316ca7[_0x8c6d('0x1b')]=_0x2f54a2;if(_0x93a094[_0x8c6d('0x2c')][_0x8c6d('0x3c')]){_0x42a7db[_0x8c6d('0x3d')]=[{'all':!![]}];}return db[_0x8c6d('0x27')][_0x8c6d('0x3e')](_0x42a7db);})['then'](function(_0x58af06){_0x316ca7['rows']=_0x58af06;return _0x316ca7;})[_0x8c6d('0x3b')](respondWithFilteredResult(_0xfc6000,_0x42a7db))[_0x8c6d('0x3f')](handleError(_0xfc6000,null));};exports[_0x8c6d('0x40')]=function(_0x3d69c3,_0x3409eb){var _0x546f04={'raw':!![],'where':{'id':_0x3d69c3[_0x8c6d('0x41')]['id']}},_0x274d01={};_0x274d01[_0x8c6d('0x2b')]=_['keys'](db[_0x8c6d('0x27')][_0x8c6d('0x28')]);_0x274d01['query']=_['keys'](_0x3d69c3['query']);_0x274d01['filters']=_['intersection'](_0x274d01[_0x8c6d('0x2b')],_0x274d01[_0x8c6d('0x2c')]);_0x546f04[_0x8c6d('0x31')]=_[_0x8c6d('0x2f')](_0x274d01[_0x8c6d('0x2b')],qs['fields'](_0x3d69c3['query']['fields']));_0x546f04['attributes']=_0x546f04[_0x8c6d('0x31')]['length']?_0x546f04[_0x8c6d('0x31')]:_0x274d01[_0x8c6d('0x2b')];if(_0x3d69c3[_0x8c6d('0x2c')][_0x8c6d('0x3c')]){_0x546f04[_0x8c6d('0x3d')]=[{'all':!![]}];}_0x546f04=_[_0x8c6d('0x38')]({},_0x546f04,_0x3d69c3['options']);return db[_0x8c6d('0x27')][_0x8c6d('0x42')](_0x546f04)['then'](handleEntityNotFound(_0x3409eb,null))[_0x8c6d('0x3b')](respondWithResult(_0x3409eb,null))[_0x8c6d('0x3f')](handleError(_0x3409eb,null));};exports['create']=function(_0x2fd4ea,_0xb6e94){return db[_0x8c6d('0x27')][_0x8c6d('0x43')](_0x2fd4ea[_0x8c6d('0x44')],{})[_0x8c6d('0x3b')](respondWithResult(_0xb6e94,0xc9))[_0x8c6d('0x3f')](handleError(_0xb6e94,null));};exports[_0x8c6d('0x45')]=function(_0x1f1609,_0x1d6c29){if(_0x1f1609[_0x8c6d('0x44')]['id']){delete _0x1f1609[_0x8c6d('0x44')]['id'];}return db[_0x8c6d('0x27')][_0x8c6d('0x42')]({'where':{'id':_0x1f1609[_0x8c6d('0x41')]['id']}})[_0x8c6d('0x3b')](handleEntityNotFound(_0x1d6c29,null))['then'](saveUpdates(_0x1f1609['body'],null))['then'](respondWithResult(_0x1d6c29,null))[_0x8c6d('0x3f')](handleError(_0x1d6c29,null));};exports[_0x8c6d('0x21')]=function(_0x4919b8,_0x574b08){return db['FreshdeskField'][_0x8c6d('0x42')]({'where':{'id':_0x4919b8['params']['id']}})[_0x8c6d('0x3b')](handleEntityNotFound(_0x574b08,null))[_0x8c6d('0x3b')](removeEntity(_0x574b08,null))[_0x8c6d('0x3f')](handleError(_0x574b08,null));}; \ No newline at end of file +var _0x13f6=['filter','options','includeAll','findAll','rows','catch','params','rawAttributes','intersection','create','body','find','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','name','send','map','FreshdeskField','fieldName','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL'];(function(_0x15e38b,_0x4a065e){var _0x3e08b1=function(_0x2792d3){while(--_0x2792d3){_0x15e38b['push'](_0x15e38b['shift']());}};_0x3e08b1(++_0x4a065e);}(_0x13f6,0x124));var _0x613f=function(_0x385d3e,_0x12b9ae){_0x385d3e=_0x385d3e-0x0;var _0x3ab84f=_0x13f6[_0x385d3e];return _0x3ab84f;};'use strict';var emlformat=require(_0x613f('0x0'));var rimraf=require(_0x613f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x613f('0x2'));var moment=require(_0x613f('0x3'));var BPromise=require(_0x613f('0x4'));var Mustache=require('mustache');var util=require(_0x613f('0x5'));var path=require(_0x613f('0x6'));var sox=require(_0x613f('0x7'));var csv=require('to-csv');var ejs=require(_0x613f('0x8'));var fs=require('fs');var fs_extra=require(_0x613f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x613f('0xa'));var toCsv=require(_0x613f('0xb'));var querystring=require(_0x613f('0xc'));var Papa=require(_0x613f('0xd'));var Redis=require('ioredis');var authService=require(_0x613f('0xe'));var qs=require(_0x613f('0xf'));var as=require(_0x613f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x613f('0x11'))(_0x613f('0x12'));var utils=require(_0x613f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x613f('0x14'));var db=require(_0x613f('0x15'))['db'];function respondWithStatusCode(_0x542230,_0x4c2a85){_0x4c2a85=_0x4c2a85||0xcc;return function(_0x517f57){if(_0x517f57){return _0x542230[_0x613f('0x16')](_0x4c2a85);}return _0x542230[_0x613f('0x17')](_0x4c2a85)[_0x613f('0x18')]();};}function respondWithResult(_0x375db1,_0x329fcf){_0x329fcf=_0x329fcf||0xc8;return function(_0x4a6fc){if(_0x4a6fc){return _0x375db1[_0x613f('0x17')](_0x329fcf)[_0x613f('0x19')](_0x4a6fc);}};}function respondWithFilteredResult(_0x2eee4d,_0x1d68fd){return function(_0x548218){if(_0x548218){var _0x3c9edf=typeof _0x1d68fd['offset']==='undefined'&&typeof _0x1d68fd[_0x613f('0x1a')]===_0x613f('0x1b');var _0x544eca=_0x548218[_0x613f('0x1c')];var _0x4f9dae=_0x3c9edf?0x0:_0x1d68fd[_0x613f('0x1d')];var _0x1e5a11=_0x3c9edf?_0x548218[_0x613f('0x1c')]:_0x1d68fd[_0x613f('0x1d')]+_0x1d68fd[_0x613f('0x1a')];var _0x1ba35f;if(_0x1e5a11>=_0x544eca){_0x1e5a11=_0x544eca;_0x1ba35f=0xc8;}else{_0x1ba35f=0xce;}_0x2eee4d['status'](_0x1ba35f);return _0x2eee4d['set'](_0x613f('0x1e'),_0x4f9dae+'-'+_0x1e5a11+'/'+_0x544eca)['json'](_0x548218);}return null;};}function patchUpdates(_0x48493c){return function(_0x3c9b58){try{jsonpatch[_0x613f('0x1f')](_0x3c9b58,_0x48493c,!![]);}catch(_0x4f5a5a){return BPromise[_0x613f('0x20')](_0x4f5a5a);}return _0x3c9b58[_0x613f('0x21')]();};}function saveUpdates(_0x2aa14b,_0x48b28a){return function(_0x5401c2){if(_0x5401c2){return _0x5401c2[_0x613f('0x22')](_0x2aa14b)[_0x613f('0x23')](function(_0x2acfcf){return _0x2acfcf;});}return null;};}function removeEntity(_0x51f376,_0x41104e){return function(_0x33e0c6){if(_0x33e0c6){return _0x33e0c6[_0x613f('0x24')]()[_0x613f('0x23')](function(){_0x51f376[_0x613f('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30fb15,_0x204185){return function(_0x51bba1){if(!_0x51bba1){_0x30fb15[_0x613f('0x16')](0x194);}return _0x51bba1;};}function handleError(_0x5d4ff6,_0x32e747){_0x32e747=_0x32e747||0x1f4;return function(_0x4a878d){logger['error'](_0x4a878d['stack']);if(_0x4a878d[_0x613f('0x25')]){delete _0x4a878d['name'];}_0x5d4ff6[_0x613f('0x17')](_0x32e747)[_0x613f('0x26')](_0x4a878d);};}exports['index']=function(_0x121241,_0x2551c1){var _0x4c8aa1={},_0x4cff5d={},_0x4f892d={'count':0x0,'rows':[]};var _0x24be7c=_[_0x613f('0x27')](db[_0x613f('0x28')]['rawAttributes'],function(_0x23eda8){return{'name':_0x23eda8[_0x613f('0x29')],'type':_0x23eda8[_0x613f('0x2a')][_0x613f('0x2b')]};});_0x4cff5d['model']=_[_0x613f('0x27')](_0x24be7c,_0x613f('0x25'));_0x4cff5d[_0x613f('0x2c')]=_[_0x613f('0x2d')](_0x121241[_0x613f('0x2c')]);_0x4cff5d[_0x613f('0x2e')]=_['intersection'](_0x4cff5d[_0x613f('0x2f')],_0x4cff5d[_0x613f('0x2c')]);_0x4c8aa1[_0x613f('0x30')]=_['intersection'](_0x4cff5d[_0x613f('0x2f')],qs['fields'](_0x121241[_0x613f('0x2c')][_0x613f('0x31')]));_0x4c8aa1[_0x613f('0x30')]=_0x4c8aa1[_0x613f('0x30')][_0x613f('0x32')]?_0x4c8aa1[_0x613f('0x30')]:_0x4cff5d['model'];if(!_0x121241[_0x613f('0x2c')][_0x613f('0x33')](_0x613f('0x34'))){_0x4c8aa1[_0x613f('0x1a')]=qs[_0x613f('0x1a')](_0x121241['query']['limit']);_0x4c8aa1['offset']=qs[_0x613f('0x1d')](_0x121241[_0x613f('0x2c')][_0x613f('0x1d')]);}_0x4c8aa1[_0x613f('0x35')]=qs['sort'](_0x121241[_0x613f('0x2c')][_0x613f('0x36')]);_0x4c8aa1['where']=qs[_0x613f('0x2e')](_['pick'](_0x121241[_0x613f('0x2c')],_0x4cff5d['filters']),_0x24be7c);if(_0x121241[_0x613f('0x2c')]['filter']){_0x4c8aa1[_0x613f('0x37')]=_[_0x613f('0x38')](_0x4c8aa1[_0x613f('0x37')],{'$or':_['map'](_0x24be7c,function(_0x36eaa0){if(_0x36eaa0[_0x613f('0x2a')]!==_0x613f('0x39')){var _0x2fb3a6={};_0x2fb3a6[_0x36eaa0[_0x613f('0x25')]]={'$like':'%'+_0x121241[_0x613f('0x2c')][_0x613f('0x3a')]+'%'};return _0x2fb3a6;}})});}_0x4c8aa1=_[_0x613f('0x38')]({},_0x4c8aa1,_0x121241[_0x613f('0x3b')]);var _0x3313c1={'where':_0x4c8aa1['where']};return db[_0x613f('0x28')][_0x613f('0x1c')](_0x3313c1)[_0x613f('0x23')](function(_0x1e5af0){_0x4f892d[_0x613f('0x1c')]=_0x1e5af0;if(_0x121241[_0x613f('0x2c')][_0x613f('0x3c')]){_0x4c8aa1['include']=[{'all':!![]}];}return db[_0x613f('0x28')][_0x613f('0x3d')](_0x4c8aa1);})[_0x613f('0x23')](function(_0x3d2d7b){_0x4f892d[_0x613f('0x3e')]=_0x3d2d7b;return _0x4f892d;})[_0x613f('0x23')](respondWithFilteredResult(_0x2551c1,_0x4c8aa1))[_0x613f('0x3f')](handleError(_0x2551c1,null));};exports['show']=function(_0x343a59,_0x18f427){var _0x3bb605={'raw':!![],'where':{'id':_0x343a59[_0x613f('0x40')]['id']}},_0x2f584e={};_0x2f584e[_0x613f('0x2f')]=_[_0x613f('0x2d')](db[_0x613f('0x28')][_0x613f('0x41')]);_0x2f584e[_0x613f('0x2c')]=_[_0x613f('0x2d')](_0x343a59[_0x613f('0x2c')]);_0x2f584e[_0x613f('0x2e')]=_['intersection'](_0x2f584e[_0x613f('0x2f')],_0x2f584e[_0x613f('0x2c')]);_0x3bb605[_0x613f('0x30')]=_[_0x613f('0x42')](_0x2f584e['model'],qs[_0x613f('0x31')](_0x343a59[_0x613f('0x2c')][_0x613f('0x31')]));_0x3bb605[_0x613f('0x30')]=_0x3bb605[_0x613f('0x30')][_0x613f('0x32')]?_0x3bb605[_0x613f('0x30')]:_0x2f584e[_0x613f('0x2f')];if(_0x343a59[_0x613f('0x2c')][_0x613f('0x3c')]){_0x3bb605['include']=[{'all':!![]}];}_0x3bb605=_['merge']({},_0x3bb605,_0x343a59[_0x613f('0x3b')]);return db[_0x613f('0x28')]['find'](_0x3bb605)[_0x613f('0x23')](handleEntityNotFound(_0x18f427,null))[_0x613f('0x23')](respondWithResult(_0x18f427,null))[_0x613f('0x3f')](handleError(_0x18f427,null));};exports[_0x613f('0x43')]=function(_0x39b8b2,_0x1c0b07){return db[_0x613f('0x28')][_0x613f('0x43')](_0x39b8b2[_0x613f('0x44')],{})[_0x613f('0x23')](respondWithResult(_0x1c0b07,0xc9))[_0x613f('0x3f')](handleError(_0x1c0b07,null));};exports[_0x613f('0x22')]=function(_0x174e22,_0x17f8e5){if(_0x174e22[_0x613f('0x44')]['id']){delete _0x174e22[_0x613f('0x44')]['id'];}return db[_0x613f('0x28')][_0x613f('0x45')]({'where':{'id':_0x174e22['params']['id']}})['then'](handleEntityNotFound(_0x17f8e5,null))[_0x613f('0x23')](saveUpdates(_0x174e22[_0x613f('0x44')],null))['then'](respondWithResult(_0x17f8e5,null))['catch'](handleError(_0x17f8e5,null));};exports[_0x613f('0x24')]=function(_0x51729a,_0x513bf1){return db[_0x613f('0x28')][_0x613f('0x45')]({'where':{'id':_0x51729a[_0x613f('0x40')]['id']}})['then'](handleEntityNotFound(_0x513bf1,null))[_0x613f('0x23')](removeEntity(_0x513bf1,null))[_0x613f('0x3f')](handleError(_0x513bf1,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 475ed7b..60703d7 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 _0x0160=['exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes'];(function(_0x58af7f,_0x52d3fb){var _0x19d9e6=function(_0xb7a635){while(--_0xb7a635){_0x58af7f['push'](_0x58af7f['shift']());}};_0x19d9e6(++_0x52d3fb);}(_0x0160,0x16c));var _0x0016=function(_0x199c03,_0x3254aa){_0x199c03=_0x199c03-0x0;var _0x11a7d4=_0x0160[_0x199c03];return _0x11a7d4;};'use strict';var _=require('lodash');var util=require(_0x0016('0x0'));var logger=require(_0x0016('0x1'))(_0x0016('0x2'));var moment=require(_0x0016('0x3'));var BPromise=require(_0x0016('0x4'));var rp=require(_0x0016('0x5'));var fs=require('fs');var path=require(_0x0016('0x6'));var rimraf=require(_0x0016('0x7'));var config=require(_0x0016('0x8'));var attributes=require(_0x0016('0x9'));module[_0x0016('0xa')]=function(_0x20ffe3,_0x5e54a2){return _0x20ffe3[_0x0016('0xb')](_0x0016('0xc'),attributes,{'tableName':_0x0016('0xd'),'paranoid':![],'indexes':[{'name':_0x0016('0xe'),'fields':[_0x0016('0xf'),_0x0016('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x83f1=['../../config/logger','api','moment','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','freshdesk_unique_index','FieldId','lodash','util'];(function(_0x1a8bbc,_0x17a086){var _0x212fc2=function(_0x55c718){while(--_0x55c718){_0x1a8bbc['push'](_0x1a8bbc['shift']());}};_0x212fc2(++_0x17a086);}(_0x83f1,0x1cc));var _0x183f=function(_0x532382,_0x42949f){_0x532382=_0x532382-0x0;var _0x2f7b66=_0x83f1[_0x532382];return _0x2f7b66;};'use strict';var _=require(_0x183f('0x0'));var util=require(_0x183f('0x1'));var logger=require(_0x183f('0x2'))(_0x183f('0x3'));var moment=require(_0x183f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x183f('0x5'));var rimraf=require(_0x183f('0x6'));var config=require(_0x183f('0x7'));var attributes=require(_0x183f('0x8'));module[_0x183f('0x9')]=function(_0x5381b2,_0x5c1cbd){return _0x5381b2[_0x183f('0xa')](_0x183f('0xb'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x183f('0xc'),'fields':['idField',_0x183f('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 601dcb4..de74401 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 _0x9f6a=['FreshdeskField,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9f6a,0x1e4));var _0xa9f6=function(_0x1fc4e2,_0x493c3b){_0x1fc4e2=_0x1fc4e2-0x0;var _0x2ba184=_0x9f6a[_0x1fc4e2];return _0x2ba184;};'use strict';var _=require('lodash');var util=require(_0xa9f6('0x0'));var moment=require(_0xa9f6('0x1'));var BPromise=require(_0xa9f6('0x2'));var rs=require(_0xa9f6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa9f6('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa9f6('0x5'));var config=require(_0xa9f6('0x6'));var jayson=require(_0xa9f6('0x7'));var client=jayson[_0xa9f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39c59f,_0x595e80,_0xef9e48){return new BPromise(function(_0x3303a1,_0x5a2ffe){return client[_0xa9f6('0x9')](_0x39c59f,_0xef9e48)[_0xa9f6('0xa')](function(_0x39022e){logger[_0xa9f6('0xb')]('FreshdeskField,\x20%s,\x20%s',_0x595e80,'request\x20sent');logger['debug'](_0xa9f6('0xc'),_0x595e80,'request\x20sent',JSON[_0xa9f6('0xd')](_0x39022e));if(_0x39022e['error']){if(_0x39022e[_0xa9f6('0xe')][_0xa9f6('0xf')]===0x1f4){logger[_0xa9f6('0xe')](_0xa9f6('0x10'),_0x595e80,_0x39022e[_0xa9f6('0xe')]['message']);return _0x5a2ffe(_0x39022e[_0xa9f6('0xe')][_0xa9f6('0x11')]);}logger[_0xa9f6('0xe')](_0xa9f6('0x10'),_0x595e80,_0x39022e[_0xa9f6('0xe')]['message']);return _0x3303a1(_0x39022e[_0xa9f6('0xe')]['message']);}else{logger[_0xa9f6('0xb')](_0xa9f6('0x10'),_0x595e80,'request\x20sent');_0x3303a1(_0x39022e[_0xa9f6('0x12')][_0xa9f6('0x11')]);}})[_0xa9f6('0x13')](function(_0x394203){logger[_0xa9f6('0xe')](_0xa9f6('0x10'),_0x595e80,_0x394203);_0x5a2ffe(_0x394203);});});} \ No newline at end of file +var _0xcb14=['debug','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x104f0e,_0x207f2d){var _0x322790=function(_0x42c6ce){while(--_0x42c6ce){_0x104f0e['push'](_0x104f0e['shift']());}};_0x322790(++_0x207f2d);}(_0xcb14,0x6b));var _0x4cb1=function(_0x1ea3b9,_0x3c6b2c){_0x1ea3b9=_0x1ea3b9-0x0;var _0x206d41=_0xcb14[_0x1ea3b9];return _0x206d41;};'use strict';var _=require('lodash');var util=require(_0x4cb1('0x0'));var moment=require('moment');var BPromise=require(_0x4cb1('0x1'));var rs=require(_0x4cb1('0x2'));var fs=require('fs');var Redis=require(_0x4cb1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4cb1('0x4'));var logger=require('../../config/logger')(_0x4cb1('0x5'));var config=require('../../config/environment');var jayson=require(_0x4cb1('0x6'));var client=jayson['client'][_0x4cb1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x11f73b,_0x35c385,_0x245293){return new BPromise(function(_0x3381a3,_0x3565b0){return client[_0x4cb1('0x8')](_0x11f73b,_0x245293)[_0x4cb1('0x9')](function(_0x34b2fd){logger[_0x4cb1('0xa')](_0x4cb1('0xb'),_0x35c385,_0x4cb1('0xc'));logger[_0x4cb1('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x35c385,'request\x20sent',JSON[_0x4cb1('0xe')](_0x34b2fd));if(_0x34b2fd[_0x4cb1('0xf')]){if(_0x34b2fd['error'][_0x4cb1('0x10')]===0x1f4){logger[_0x4cb1('0xf')](_0x4cb1('0xb'),_0x35c385,_0x34b2fd[_0x4cb1('0xf')][_0x4cb1('0x11')]);return _0x3565b0(_0x34b2fd[_0x4cb1('0xf')][_0x4cb1('0x11')]);}logger[_0x4cb1('0xf')]('FreshdeskField,\x20%s,\x20%s',_0x35c385,_0x34b2fd['error'][_0x4cb1('0x11')]);return _0x3381a3(_0x34b2fd[_0x4cb1('0xf')][_0x4cb1('0x11')]);}else{logger[_0x4cb1('0xa')]('FreshdeskField,\x20%s,\x20%s',_0x35c385,_0x4cb1('0xc'));_0x3381a3(_0x34b2fd[_0x4cb1('0x12')][_0x4cb1('0x11')]);}})[_0x4cb1('0x13')](function(_0x55bc1a){logger['error'](_0x4cb1('0xb'),_0x35c385,_0x55bc1a);_0x3565b0(_0x55bc1a);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 0dccae1..d308011 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 _0x16d2=['./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x13843f,_0x50422d){var _0x1063ae=function(_0x12fd6b){while(--_0x12fd6b){_0x13843f['push'](_0x13843f['shift']());}};_0x1063ae(++_0x50422d);}(_0x16d2,0x123));var _0x216d=function(_0x4fe4c0,_0xb0c00d){_0x4fe4c0=_0x4fe4c0-0x0;var _0x435df4=_0x16d2[_0x4fe4c0];return _0x435df4;};'use strict';var multer=require(_0x216d('0x0'));var util=require(_0x216d('0x1'));var path=require(_0x216d('0x2'));var timeout=require(_0x216d('0x3'));var express=require(_0x216d('0x4'));var router=express[_0x216d('0x5')]();var fs_extra=require(_0x216d('0x6'));var auth=require(_0x216d('0x7'));var interaction=require(_0x216d('0x8'));var config=require('../../config/environment');var controller=require(_0x216d('0x9'));router[_0x216d('0xa')]('/',auth[_0x216d('0xb')](),controller[_0x216d('0xc')]);router[_0x216d('0xa')](_0x216d('0xd'),auth[_0x216d('0xb')](),controller[_0x216d('0xe')]);router['get'](_0x216d('0xf'),auth[_0x216d('0xb')](),controller[_0x216d('0x10')]);router[_0x216d('0xa')](_0x216d('0x11'),auth[_0x216d('0xb')](),controller['getFields']);router[_0x216d('0x12')]('/',auth['isAuthenticated'](),controller[_0x216d('0x13')]);router[_0x216d('0x12')](_0x216d('0xf'),auth[_0x216d('0xb')](),controller[_0x216d('0x14')]);router[_0x216d('0x15')]('/:id',auth[_0x216d('0xb')](),controller['update']);router[_0x216d('0x16')](_0x216d('0xd'),auth['isAuthenticated'](),controller[_0x216d('0x17')]);module[_0x216d('0x18')]=router; \ No newline at end of file +var _0x91a7=['Router','../../components/auth/service','./intFreshsalesAccount.controller','get','index','/:id','isAuthenticated','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','update','exports','util','path','connect-timeout'];(function(_0x18ffa4,_0x4d7ddf){var _0x179648=function(_0x434824){while(--_0x434824){_0x18ffa4['push'](_0x18ffa4['shift']());}};_0x179648(++_0x4d7ddf);}(_0x91a7,0xe7));var _0x791a=function(_0x53405b,_0xf55649){_0x53405b=_0x53405b-0x0;var _0x423b2c=_0x91a7[_0x53405b];return _0x423b2c;};'use strict';var multer=require('multer');var util=require(_0x791a('0x0'));var path=require(_0x791a('0x1'));var timeout=require(_0x791a('0x2'));var express=require('express');var router=express[_0x791a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x791a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x791a('0x5'));router[_0x791a('0x6')]('/',auth['isAuthenticated'](),controller[_0x791a('0x7')]);router['get'](_0x791a('0x8'),auth[_0x791a('0x9')](),controller['show']);router[_0x791a('0x6')](_0x791a('0xa'),auth[_0x791a('0x9')](),controller[_0x791a('0xb')]);router[_0x791a('0x6')]('/:id/fields',auth[_0x791a('0x9')](),controller[_0x791a('0xc')]);router['post']('/',auth[_0x791a('0x9')](),controller[_0x791a('0xd')]);router[_0x791a('0xe')](_0x791a('0xa'),auth[_0x791a('0x9')](),controller[_0x791a('0xf')]);router['put']('/:id',auth[_0x791a('0x9')](),controller[_0x791a('0x10')]);router['delete'](_0x791a('0x8'),auth[_0x791a('0x9')](),controller['destroy']);module[_0x791a('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index c3e4313..3615c0c 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 _0xb03e=['STRING','username','remoteUri','exports'];(function(_0x2d884b,_0x200fc2){var _0x319eb4=function(_0x5cfa65){while(--_0x5cfa65){_0x2d884b['push'](_0x2d884b['shift']());}};_0x319eb4(++_0x200fc2);}(_0xb03e,0x1eb));var _0xeb03=function(_0x2e757c,_0x280863){_0x2e757c=_0x2e757c-0x0;var _0x4a3ca6=_0xb03e[_0x2e757c];return _0x4a3ca6;};'use strict';var Sequelize=require('sequelize');module[_0xeb03('0x0')]={'name':{'type':Sequelize[_0xeb03('0x1')]},'description':{'type':Sequelize[_0xeb03('0x1')]},'username':{'type':Sequelize[_0xeb03('0x1')],'unique':_0xeb03('0x2')},'apiKey':{'type':Sequelize[_0xeb03('0x1')]},'remoteUri':{'type':Sequelize[_0xeb03('0x1')],'unique':_0xeb03('0x3')},'serverUrl':{'type':Sequelize[_0xeb03('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xdb28=['username','remoteUri','sequelize','exports','STRING'];(function(_0x46a223,_0x4cb90b){var _0x16d045=function(_0x123fe4){while(--_0x123fe4){_0x46a223['push'](_0x46a223['shift']());}};_0x16d045(++_0x4cb90b);}(_0xdb28,0x106));var _0x8db2=function(_0x4d07a9,_0x2dc348){_0x4d07a9=_0x4d07a9-0x0;var _0x18392e=_0xdb28[_0x4d07a9];return _0x18392e;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'name':{'type':Sequelize[_0x8db2('0x2')]},'description':{'type':Sequelize[_0x8db2('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x8db2('0x3')},'apiKey':{'type':Sequelize[_0x8db2('0x2')]},'remoteUri':{'type':Sequelize[_0x8db2('0x2')],'unique':_0x8db2('0x4')},'serverUrl':{'type':Sequelize[_0x8db2('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 f71fc7d..4924929 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 _0x3d72=['body','params','getConfigurations','findOne','FreshsalesConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','substring','lastIndexOf','GET','format','%s%s','Token\x20token=','apiKey','users','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','rows','include','find','catch','create'];(function(_0x1a6644,_0x927428){var _0x4f419a=function(_0x13217f){while(--_0x13217f){_0x1a6644['push'](_0x1a6644['shift']());}};_0x4f419a(++_0x927428);}(_0x3d72,0x1c5));var _0x23d7=function(_0x55eb7f,_0x5b2e14){_0x55eb7f=_0x55eb7f-0x0;var _0x132c3d=_0x3d72[_0x55eb7f];return _0x132c3d;};'use strict';var emlformat=require(_0x23d7('0x0'));var rimraf=require(_0x23d7('0x1'));var zipdir=require(_0x23d7('0x2'));var jsonpatch=require(_0x23d7('0x3'));var rp=require(_0x23d7('0x4'));var moment=require(_0x23d7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x23d7('0x6'));var util=require('util');var path=require(_0x23d7('0x7'));var sox=require(_0x23d7('0x8'));var csv=require(_0x23d7('0x9'));var ejs=require(_0x23d7('0xa'));var fs=require('fs');var fs_extra=require(_0x23d7('0xb'));var _=require('lodash');var squel=require(_0x23d7('0xc'));var crypto=require(_0x23d7('0xd'));var jsforce=require(_0x23d7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x23d7('0x9'));var querystring=require(_0x23d7('0xf'));var Papa=require(_0x23d7('0x10'));var Redis=require(_0x23d7('0x11'));var authService=require(_0x23d7('0x12'));var qs=require(_0x23d7('0x13'));var as=require(_0x23d7('0x14'));var hardwareService=require(_0x23d7('0x15'));var logger=require(_0x23d7('0x16'))(_0x23d7('0x17'));var utils=require('../../config/utils');var config=require(_0x23d7('0x18'));var licenseUtil=require(_0x23d7('0x19'));var db=require(_0x23d7('0x1a'))['db'];var integrations=require(_0x23d7('0x1b'));function respondWithStatusCode(_0x4436b6,_0x53331e){_0x53331e=_0x53331e||0xcc;return function(_0x195886){if(_0x195886){return _0x4436b6[_0x23d7('0x1c')](_0x53331e);}return _0x4436b6[_0x23d7('0x1d')](_0x53331e)[_0x23d7('0x1e')]();};}function respondWithResult(_0x287d10,_0x4c094c){_0x4c094c=_0x4c094c||0xc8;return function(_0x4eb0eb){if(_0x4eb0eb){return _0x287d10[_0x23d7('0x1d')](_0x4c094c)[_0x23d7('0x1f')](_0x4eb0eb);}};}function respondWithFilteredResult(_0x32fe17,_0xfd1bba){return function(_0x368e9c){if(_0x368e9c){var _0x4012b2=typeof _0xfd1bba['offset']===_0x23d7('0x20')&&typeof _0xfd1bba[_0x23d7('0x21')]==='undefined';var _0xcfbdd0=_0x368e9c[_0x23d7('0x22')];var _0x59d88d=_0x4012b2?0x0:_0xfd1bba[_0x23d7('0x23')];var _0x57b6b7=_0x4012b2?_0x368e9c[_0x23d7('0x22')]:_0xfd1bba['offset']+_0xfd1bba[_0x23d7('0x21')];var _0x576b83;if(_0x57b6b7>=_0xcfbdd0){_0x57b6b7=_0xcfbdd0;_0x576b83=0xc8;}else{_0x576b83=0xce;}_0x32fe17['status'](_0x576b83);return _0x32fe17[_0x23d7('0x24')](_0x23d7('0x25'),_0x59d88d+'-'+_0x57b6b7+'/'+_0xcfbdd0)[_0x23d7('0x1f')](_0x368e9c);}return null;};}function patchUpdates(_0x47e0dc){return function(_0x1de479){try{jsonpatch[_0x23d7('0x26')](_0x1de479,_0x47e0dc,!![]);}catch(_0x356b98){return BPromise['reject'](_0x356b98);}return _0x1de479[_0x23d7('0x27')]();};}function saveUpdates(_0x102a12,_0x16e138){return function(_0x2bce1e){if(_0x2bce1e){return _0x2bce1e[_0x23d7('0x28')](_0x102a12)['then'](function(_0x58d2f0){return _0x58d2f0;});}return null;};}function removeEntity(_0xa4c3bf,_0x32ce98){return function(_0x2f60a4){if(_0x2f60a4){return _0x2f60a4[_0x23d7('0x29')]()[_0x23d7('0x2a')](function(){_0xa4c3bf[_0x23d7('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f0eb2,_0x3357d5){return function(_0x3dea9b){if(!_0x3dea9b){_0x5f0eb2['sendStatus'](0x194);}return _0x3dea9b;};}function handleError(_0x1ee196,_0x8307da){_0x8307da=_0x8307da||0x1f4;return function(_0x4b8474){logger[_0x23d7('0x2b')](_0x4b8474[_0x23d7('0x2c')]);if(_0x4b8474[_0x23d7('0x2d')]){delete _0x4b8474['name'];}_0x1ee196[_0x23d7('0x1d')](_0x8307da)[_0x23d7('0x2e')](_0x4b8474);};}exports[_0x23d7('0x2f')]=function(_0x17b01a,_0x548c17){var _0x4221b4={},_0x4b5579={},_0x408aa0={'count':0x0,'rows':[]};var _0x2b0f40=_[_0x23d7('0x30')](db[_0x23d7('0x31')][_0x23d7('0x32')],function(_0x126d63){return{'name':_0x126d63[_0x23d7('0x33')],'type':_0x126d63['type'][_0x23d7('0x34')]};});_0x4b5579[_0x23d7('0x35')]=_[_0x23d7('0x30')](_0x2b0f40,_0x23d7('0x2d'));_0x4b5579[_0x23d7('0x36')]=_[_0x23d7('0x37')](_0x17b01a[_0x23d7('0x36')]);_0x4b5579['filters']=_[_0x23d7('0x38')](_0x4b5579[_0x23d7('0x35')],_0x4b5579[_0x23d7('0x36')]);_0x4221b4['attributes']=_['intersection'](_0x4b5579[_0x23d7('0x35')],qs['fields'](_0x17b01a[_0x23d7('0x36')][_0x23d7('0x39')]));_0x4221b4[_0x23d7('0x3a')]=_0x4221b4['attributes'][_0x23d7('0x3b')]?_0x4221b4['attributes']:_0x4b5579[_0x23d7('0x35')];if(!_0x17b01a[_0x23d7('0x36')][_0x23d7('0x3c')](_0x23d7('0x3d'))){_0x4221b4['limit']=qs[_0x23d7('0x21')](_0x17b01a['query'][_0x23d7('0x21')]);_0x4221b4[_0x23d7('0x23')]=qs[_0x23d7('0x23')](_0x17b01a['query']['offset']);}_0x4221b4[_0x23d7('0x3e')]=qs[_0x23d7('0x3f')](_0x17b01a[_0x23d7('0x36')][_0x23d7('0x3f')]);_0x4221b4[_0x23d7('0x40')]=qs['filters'](_['pick'](_0x17b01a['query'],_0x4b5579[_0x23d7('0x41')]),_0x2b0f40);if(_0x17b01a[_0x23d7('0x36')][_0x23d7('0x42')]){_0x4221b4[_0x23d7('0x40')]=_[_0x23d7('0x43')](_0x4221b4[_0x23d7('0x40')],{'$or':_[_0x23d7('0x30')](_0x2b0f40,function(_0x1dddef){if(_0x1dddef[_0x23d7('0x44')]!==_0x23d7('0x45')){var _0x4e3ca2={};_0x4e3ca2[_0x1dddef[_0x23d7('0x2d')]]={'$like':'%'+_0x17b01a[_0x23d7('0x36')]['filter']+'%'};return _0x4e3ca2;}})});}_0x4221b4=_[_0x23d7('0x43')]({},_0x4221b4,_0x17b01a[_0x23d7('0x46')]);var _0x18d9d5={'where':_0x4221b4[_0x23d7('0x40')]};return db[_0x23d7('0x31')][_0x23d7('0x22')](_0x18d9d5)[_0x23d7('0x2a')](function(_0x32bde3){_0x408aa0[_0x23d7('0x22')]=_0x32bde3;if(_0x17b01a[_0x23d7('0x36')][_0x23d7('0x47')]){_0x4221b4['include']=[{'all':!![]}];}return db[_0x23d7('0x31')]['findAll'](_0x4221b4);})[_0x23d7('0x2a')](function(_0x28972b){_0x408aa0[_0x23d7('0x48')]=_0x28972b;return _0x408aa0;})[_0x23d7('0x2a')](respondWithFilteredResult(_0x548c17,_0x4221b4))['catch'](handleError(_0x548c17,null));};exports['show']=function(_0x25a4de,_0x30f2a9){var _0xaffc0b={'raw':![],'where':{'id':_0x25a4de['params']['id']}},_0x1720e3={};_0x1720e3['model']=_[_0x23d7('0x37')](db['FreshsalesAccount'][_0x23d7('0x32')]);_0x1720e3['query']=_[_0x23d7('0x37')](_0x25a4de['query']);_0x1720e3['filters']=_['intersection'](_0x1720e3[_0x23d7('0x35')],_0x1720e3['query']);_0xaffc0b[_0x23d7('0x3a')]=_[_0x23d7('0x38')](_0x1720e3['model'],qs[_0x23d7('0x39')](_0x25a4de[_0x23d7('0x36')][_0x23d7('0x39')]));_0xaffc0b[_0x23d7('0x3a')]=_0xaffc0b[_0x23d7('0x3a')][_0x23d7('0x3b')]?_0xaffc0b[_0x23d7('0x3a')]:_0x1720e3[_0x23d7('0x35')];if(_0x25a4de[_0x23d7('0x36')][_0x23d7('0x47')]){_0xaffc0b[_0x23d7('0x49')]=[{'all':!![]}];}_0xaffc0b=_['merge']({},_0xaffc0b,_0x25a4de[_0x23d7('0x46')]);return db['FreshsalesAccount'][_0x23d7('0x4a')](_0xaffc0b)[_0x23d7('0x2a')](handleEntityNotFound(_0x30f2a9,null))[_0x23d7('0x2a')](respondWithResult(_0x30f2a9,null))[_0x23d7('0x4b')](handleError(_0x30f2a9,null));};exports[_0x23d7('0x4c')]=function(_0x570e33,_0x3e6213){return db['FreshsalesAccount'][_0x23d7('0x4c')](_0x570e33[_0x23d7('0x4d')],{})[_0x23d7('0x2a')](respondWithResult(_0x3e6213,0xc9))['catch'](handleError(_0x3e6213,null));};exports[_0x23d7('0x28')]=function(_0x3fa839,_0x27f5e1){if(_0x3fa839[_0x23d7('0x4d')]['id']){delete _0x3fa839['body']['id'];}return db['FreshsalesAccount']['find']({'where':{'id':_0x3fa839[_0x23d7('0x4e')]['id']}})[_0x23d7('0x2a')](handleEntityNotFound(_0x27f5e1,null))[_0x23d7('0x2a')](saveUpdates(_0x3fa839[_0x23d7('0x4d')],null))[_0x23d7('0x2a')](respondWithResult(_0x27f5e1,null))['catch'](handleError(_0x27f5e1,null));};exports[_0x23d7('0x29')]=function(_0x481a9e,_0x54e3c9){return db[_0x23d7('0x31')][_0x23d7('0x4a')]({'where':{'id':_0x481a9e[_0x23d7('0x4e')]['id']}})[_0x23d7('0x2a')](handleEntityNotFound(_0x54e3c9,null))[_0x23d7('0x2a')](removeEntity(_0x54e3c9,null))[_0x23d7('0x4b')](handleError(_0x54e3c9,null));};exports[_0x23d7('0x4f')]=function(_0x31cb52,_0xaaaf7f,_0x2519aa){var _0x401613={};var _0x4d9981={};var _0x472cab;var _0x73eb47;return db['FreshsalesAccount'][_0x23d7('0x50')]({'where':{'id':_0x31cb52['params']['id']}})[_0x23d7('0x2a')](handleEntityNotFound(_0xaaaf7f,null))['then'](function(_0x6fc94c){if(_0x6fc94c){_0x472cab=_0x6fc94c;_0x4d9981[_0x23d7('0x35')]=_[_0x23d7('0x37')](db[_0x23d7('0x51')][_0x23d7('0x32')]);_0x4d9981[_0x23d7('0x36')]=_[_0x23d7('0x37')](_0x31cb52[_0x23d7('0x36')]);_0x4d9981[_0x23d7('0x41')]=_[_0x23d7('0x38')](_0x4d9981[_0x23d7('0x35')],_0x4d9981['query']);_0x401613[_0x23d7('0x3a')]=_[_0x23d7('0x38')](_0x4d9981[_0x23d7('0x35')],qs['fields'](_0x31cb52['query'][_0x23d7('0x39')]));_0x401613['attributes']=_0x401613[_0x23d7('0x3a')][_0x23d7('0x3b')]?_0x401613['attributes']:_0x4d9981[_0x23d7('0x35')];_0x401613['order']=qs[_0x23d7('0x3f')](_0x31cb52[_0x23d7('0x36')][_0x23d7('0x3f')]);_0x401613[_0x23d7('0x40')]=qs[_0x23d7('0x41')](_[_0x23d7('0x52')](_0x31cb52[_0x23d7('0x36')],_0x4d9981['filters']));if(_0x31cb52[_0x23d7('0x36')][_0x23d7('0x42')]){_0x401613[_0x23d7('0x40')]=_[_0x23d7('0x43')](_0x401613[_0x23d7('0x40')],{'$or':_[_0x23d7('0x30')](_0x401613[_0x23d7('0x3a')],function(_0x28251c){var _0x5bed5d={};_0x5bed5d[_0x28251c]={'$like':'%'+_0x31cb52[_0x23d7('0x36')]['filter']+'%'};return _0x5bed5d;})});}_0x401613=_[_0x23d7('0x43')]({},_0x401613,_0x31cb52[_0x23d7('0x46')]);return _0x472cab['getConfigurations'](_0x401613);}})[_0x23d7('0x2a')](function(_0x24de5b){if(_0x24de5b){_0x73eb47=_0x24de5b[_0x23d7('0x3b')];if(!_0x31cb52[_0x23d7('0x36')][_0x23d7('0x3c')](_0x23d7('0x3d'))){_0x401613['limit']=qs[_0x23d7('0x21')](_0x31cb52[_0x23d7('0x36')][_0x23d7('0x21')]);_0x401613[_0x23d7('0x23')]=qs['offset'](_0x31cb52['query']['offset']);}return _0x472cab['getConfigurations'](_0x401613);}})[_0x23d7('0x2a')](function(_0x5f4ef1){if(_0x5f4ef1){return _0x5f4ef1?{'count':_0x73eb47,'rows':_0x5f4ef1}:null;}})['then'](respondWithResult(_0xaaaf7f,null))[_0x23d7('0x4b')](handleError(_0xaaaf7f,null));};exports[_0x23d7('0x53')]=function(_0x4ca5ef,_0x95b4b,_0x2676ef){if(_0x4ca5ef[_0x23d7('0x4d')]['id']){delete _0x4ca5ef['body']['id'];}return db[_0x23d7('0x31')][_0x23d7('0x50')]({'where':{'id':_0x4ca5ef[_0x23d7('0x4e')]['id']}})['then'](handleEntityNotFound(_0x95b4b,null))[_0x23d7('0x2a')](function(_0x169674){if(_0x169674){_0x4ca5ef['body'][_0x23d7('0x54')]=_0x169674['id'];_0x4ca5ef[_0x23d7('0x4d')][_0x23d7('0x55')]=integrations[_0x23d7('0x56')](_0x4ca5ef['body'][_0x23d7('0x57')],_0x4ca5ef[_0x23d7('0x4d')][_0x23d7('0x44')]);_0x4ca5ef[_0x23d7('0x4d')][_0x23d7('0x58')]=integrations[_0x23d7('0x59')](_0x4ca5ef[_0x23d7('0x4d')][_0x23d7('0x57')],_0x4ca5ef[_0x23d7('0x4d')][_0x23d7('0x44')]);return db[_0x23d7('0x51')]['create'](_0x4ca5ef[_0x23d7('0x4d')],{'include':[{'model':db['FreshsalesField'],'as':_0x23d7('0x55')},{'model':db[_0x23d7('0x5a')],'as':_0x23d7('0x58')}]});}return null;})[_0x23d7('0x2a')](respondWithResult(_0x95b4b,null))['catch'](handleError(_0x95b4b,null));};exports[_0x23d7('0x5b')]=function(_0x117e25,_0x4c9ca4,_0x472289){var _0xa66531='';var _0xd29e72='';return db[_0x23d7('0x31')][_0x23d7('0x50')]({'where':{'id':_0x117e25[_0x23d7('0x4e')]['id']},'attributes':['id',_0x23d7('0x5c'),_0x23d7('0x5d'),'apiKey']})[_0x23d7('0x2a')](handleEntityNotFound(_0x4c9ca4,null))[_0x23d7('0x2a')](function(_0x2753aa){if(_0x2753aa){_0xd29e72=_0x2753aa['username'];_0xa66531=_0x2753aa['remoteUri'];var _0xebeda2=_0x2753aa['remoteUri']['slice'](-0x1);if(_0xebeda2==='/'){_0xa66531=_0xa66531[_0x23d7('0x5e')](0x0,_0xa66531[_0x23d7('0x5f')](_0xebeda2));}return rp({'method':_0x23d7('0x60'),'uri':util[_0x23d7('0x61')](_0x23d7('0x62'),_0xa66531,'/api/selector/owners'),'headers':{'Authorization':_0x23d7('0x63')+_0x2753aa[_0x23d7('0x64')]},'json':!![]});}})['then'](function(_0x3d52b0){if(_0x3d52b0){var _0xcd020a=_0x3d52b0[_0x23d7('0x65')];var _0x5d8e5e=![];var _0x1cc66c=null;for(_0x1cc66c=0x0;_0x1cc66c<_0xcd020a[_0x23d7('0x3b')];_0x1cc66c++){if(_0xcd020a[_0x1cc66c]['email']===_0xd29e72){_0x5d8e5e=!![];}}if(_0x5d8e5e){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x4c9ca4,null))[_0x23d7('0x4b')](function(_0x4107c1){var _0x3c8203=_0x117e25['query'][_0x23d7('0x66')]?0x1f4:_0x4107c1[_0x23d7('0x67')]||0x1f4;logger[_0x23d7('0x2b')](_0x23d7('0x68'),_0x23d7('0x5b'),_0x3c8203,JSON['stringify'](_0x4107c1));delete _0x4107c1[_0x23d7('0x2d')];if(_0x3c8203===0x191){_0x3c8203=0x190;}_0x4c9ca4[_0x23d7('0x1d')](_0x3c8203)[_0x23d7('0x2e')](_0x117e25['query']['test']?{'message':_0x23d7('0x69'),'statusCode':_0x4107c1[_0x23d7('0x67')]}:_0x4107c1);});}; \ No newline at end of file +var _0xd4ad=['getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','FreshsalesAccount','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','findOne','FreshsalesConfiguration','order','pick','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','remoteUri','username','slice','substring','lastIndexOf','GET','format','Token\x20token=','apiKey','users','test'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0xd4ad,0x6f));var _0xdd4a=function(_0xf59bbd,_0x53eed0){_0xf59bbd=_0xf59bbd-0x0;var _0x595892=_0xd4ad[_0xf59bbd];return _0x595892;};'use strict';var emlformat=require(_0xdd4a('0x0'));var rimraf=require(_0xdd4a('0x1'));var zipdir=require(_0xdd4a('0x2'));var jsonpatch=require(_0xdd4a('0x3'));var rp=require(_0xdd4a('0x4'));var moment=require(_0xdd4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdd4a('0x6'));var path=require(_0xdd4a('0x7'));var sox=require('sox');var csv=require(_0xdd4a('0x8'));var ejs=require(_0xdd4a('0x9'));var fs=require('fs');var fs_extra=require(_0xdd4a('0xa'));var _=require(_0xdd4a('0xb'));var squel=require('squel');var crypto=require(_0xdd4a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xdd4a('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdd4a('0xe'));var Papa=require(_0xdd4a('0xf'));var Redis=require(_0xdd4a('0x10'));var authService=require(_0xdd4a('0x11'));var qs=require(_0xdd4a('0x12'));var as=require(_0xdd4a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdd4a('0x14'))(_0xdd4a('0x15'));var utils=require(_0xdd4a('0x16'));var config=require(_0xdd4a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xdd4a('0x18'))['db'];var integrations=require(_0xdd4a('0x19'));function respondWithStatusCode(_0x11ec8f,_0x8d59d5){_0x8d59d5=_0x8d59d5||0xcc;return function(_0x2b0c65){if(_0x2b0c65){return _0x11ec8f[_0xdd4a('0x1a')](_0x8d59d5);}return _0x11ec8f['status'](_0x8d59d5)[_0xdd4a('0x1b')]();};}function respondWithResult(_0x28ed38,_0x16b5d5){_0x16b5d5=_0x16b5d5||0xc8;return function(_0x2094ab){if(_0x2094ab){return _0x28ed38[_0xdd4a('0x1c')](_0x16b5d5)[_0xdd4a('0x1d')](_0x2094ab);}};}function respondWithFilteredResult(_0x3a031c,_0x3d4c71){return function(_0x4cba14){if(_0x4cba14){var _0x3330ca=typeof _0x3d4c71[_0xdd4a('0x1e')]==='undefined'&&typeof _0x3d4c71[_0xdd4a('0x1f')]===_0xdd4a('0x20');var _0x2859c0=_0x4cba14[_0xdd4a('0x21')];var _0x481bd4=_0x3330ca?0x0:_0x3d4c71[_0xdd4a('0x1e')];var _0x56fe96=_0x3330ca?_0x4cba14[_0xdd4a('0x21')]:_0x3d4c71['offset']+_0x3d4c71[_0xdd4a('0x1f')];var _0x2e5110;if(_0x56fe96>=_0x2859c0){_0x56fe96=_0x2859c0;_0x2e5110=0xc8;}else{_0x2e5110=0xce;}_0x3a031c[_0xdd4a('0x1c')](_0x2e5110);return _0x3a031c[_0xdd4a('0x22')](_0xdd4a('0x23'),_0x481bd4+'-'+_0x56fe96+'/'+_0x2859c0)[_0xdd4a('0x1d')](_0x4cba14);}return null;};}function patchUpdates(_0x4597cb){return function(_0x173061){try{jsonpatch[_0xdd4a('0x24')](_0x173061,_0x4597cb,!![]);}catch(_0x217507){return BPromise[_0xdd4a('0x25')](_0x217507);}return _0x173061[_0xdd4a('0x26')]();};}function saveUpdates(_0x56ce31,_0x1cefc5){return function(_0x2a9134){if(_0x2a9134){return _0x2a9134[_0xdd4a('0x27')](_0x56ce31)['then'](function(_0x2352c2){return _0x2352c2;});}return null;};}function removeEntity(_0x385b9a,_0x448cbe){return function(_0x2c270c){if(_0x2c270c){return _0x2c270c[_0xdd4a('0x28')]()[_0xdd4a('0x29')](function(){_0x385b9a[_0xdd4a('0x1c')](0xcc)[_0xdd4a('0x1b')]();});}};}function handleEntityNotFound(_0x5c337f,_0x57b75d){return function(_0x2fef03){if(!_0x2fef03){_0x5c337f[_0xdd4a('0x1a')](0x194);}return _0x2fef03;};}function handleError(_0x92b04b,_0x4ecfad){_0x4ecfad=_0x4ecfad||0x1f4;return function(_0x1eea9e){logger[_0xdd4a('0x2a')](_0x1eea9e[_0xdd4a('0x2b')]);if(_0x1eea9e[_0xdd4a('0x2c')]){delete _0x1eea9e[_0xdd4a('0x2c')];}_0x92b04b[_0xdd4a('0x1c')](_0x4ecfad)[_0xdd4a('0x2d')](_0x1eea9e);};}exports['index']=function(_0x3211d3,_0x4345a8){var _0x282acb={},_0x406d29={},_0x518514={'count':0x0,'rows':[]};var _0x181f88=_[_0xdd4a('0x2e')](db[_0xdd4a('0x2f')]['rawAttributes'],function(_0x25f5ec){return{'name':_0x25f5ec[_0xdd4a('0x30')],'type':_0x25f5ec[_0xdd4a('0x31')][_0xdd4a('0x32')]};});_0x406d29[_0xdd4a('0x33')]=_[_0xdd4a('0x2e')](_0x181f88,_0xdd4a('0x2c'));_0x406d29['query']=_[_0xdd4a('0x34')](_0x3211d3[_0xdd4a('0x35')]);_0x406d29[_0xdd4a('0x36')]=_[_0xdd4a('0x37')](_0x406d29['model'],_0x406d29[_0xdd4a('0x35')]);_0x282acb['attributes']=_[_0xdd4a('0x37')](_0x406d29[_0xdd4a('0x33')],qs[_0xdd4a('0x38')](_0x3211d3[_0xdd4a('0x35')]['fields']));_0x282acb[_0xdd4a('0x39')]=_0x282acb[_0xdd4a('0x39')][_0xdd4a('0x3a')]?_0x282acb[_0xdd4a('0x39')]:_0x406d29[_0xdd4a('0x33')];if(!_0x3211d3[_0xdd4a('0x35')][_0xdd4a('0x3b')](_0xdd4a('0x3c'))){_0x282acb['limit']=qs[_0xdd4a('0x1f')](_0x3211d3['query'][_0xdd4a('0x1f')]);_0x282acb[_0xdd4a('0x1e')]=qs[_0xdd4a('0x1e')](_0x3211d3[_0xdd4a('0x35')][_0xdd4a('0x1e')]);}_0x282acb['order']=qs[_0xdd4a('0x3d')](_0x3211d3[_0xdd4a('0x35')][_0xdd4a('0x3d')]);_0x282acb[_0xdd4a('0x3e')]=qs[_0xdd4a('0x36')](_['pick'](_0x3211d3[_0xdd4a('0x35')],_0x406d29[_0xdd4a('0x36')]),_0x181f88);if(_0x3211d3[_0xdd4a('0x35')][_0xdd4a('0x3f')]){_0x282acb['where']=_['merge'](_0x282acb['where'],{'$or':_[_0xdd4a('0x2e')](_0x181f88,function(_0x1b6525){if(_0x1b6525[_0xdd4a('0x31')]!==_0xdd4a('0x40')){var _0x397b65={};_0x397b65[_0x1b6525[_0xdd4a('0x2c')]]={'$like':'%'+_0x3211d3[_0xdd4a('0x35')][_0xdd4a('0x3f')]+'%'};return _0x397b65;}})});}_0x282acb=_[_0xdd4a('0x41')]({},_0x282acb,_0x3211d3['options']);var _0x1b2e54={'where':_0x282acb[_0xdd4a('0x3e')]};return db['FreshsalesAccount']['count'](_0x1b2e54)[_0xdd4a('0x29')](function(_0x4404ee){_0x518514[_0xdd4a('0x21')]=_0x4404ee;if(_0x3211d3[_0xdd4a('0x35')][_0xdd4a('0x42')]){_0x282acb['include']=[{'all':!![]}];}return db[_0xdd4a('0x2f')][_0xdd4a('0x43')](_0x282acb);})[_0xdd4a('0x29')](function(_0x5e6ccc){_0x518514[_0xdd4a('0x44')]=_0x5e6ccc;return _0x518514;})[_0xdd4a('0x29')](respondWithFilteredResult(_0x4345a8,_0x282acb))[_0xdd4a('0x45')](handleError(_0x4345a8,null));};exports[_0xdd4a('0x46')]=function(_0x989534,_0x4cceb5){var _0x2a14ec={'raw':![],'where':{'id':_0x989534[_0xdd4a('0x47')]['id']}},_0x3fcb5f={};_0x3fcb5f['model']=_[_0xdd4a('0x34')](db[_0xdd4a('0x2f')][_0xdd4a('0x48')]);_0x3fcb5f[_0xdd4a('0x35')]=_[_0xdd4a('0x34')](_0x989534[_0xdd4a('0x35')]);_0x3fcb5f['filters']=_[_0xdd4a('0x37')](_0x3fcb5f['model'],_0x3fcb5f[_0xdd4a('0x35')]);_0x2a14ec['attributes']=_[_0xdd4a('0x37')](_0x3fcb5f['model'],qs['fields'](_0x989534[_0xdd4a('0x35')][_0xdd4a('0x38')]));_0x2a14ec[_0xdd4a('0x39')]=_0x2a14ec[_0xdd4a('0x39')][_0xdd4a('0x3a')]?_0x2a14ec[_0xdd4a('0x39')]:_0x3fcb5f[_0xdd4a('0x33')];if(_0x989534[_0xdd4a('0x35')][_0xdd4a('0x42')]){_0x2a14ec[_0xdd4a('0x49')]=[{'all':!![]}];}_0x2a14ec=_[_0xdd4a('0x41')]({},_0x2a14ec,_0x989534[_0xdd4a('0x4a')]);return db['FreshsalesAccount'][_0xdd4a('0x4b')](_0x2a14ec)[_0xdd4a('0x29')](handleEntityNotFound(_0x4cceb5,null))[_0xdd4a('0x29')](respondWithResult(_0x4cceb5,null))[_0xdd4a('0x45')](handleError(_0x4cceb5,null));};exports[_0xdd4a('0x4c')]=function(_0x4c9f77,_0x185810){return db['FreshsalesAccount'][_0xdd4a('0x4c')](_0x4c9f77[_0xdd4a('0x4d')],{})[_0xdd4a('0x29')](respondWithResult(_0x185810,0xc9))[_0xdd4a('0x45')](handleError(_0x185810,null));};exports[_0xdd4a('0x27')]=function(_0x4c3877,_0x1104c2){if(_0x4c3877[_0xdd4a('0x4d')]['id']){delete _0x4c3877[_0xdd4a('0x4d')]['id'];}return db['FreshsalesAccount']['find']({'where':{'id':_0x4c3877[_0xdd4a('0x47')]['id']}})['then'](handleEntityNotFound(_0x1104c2,null))['then'](saveUpdates(_0x4c3877[_0xdd4a('0x4d')],null))['then'](respondWithResult(_0x1104c2,null))[_0xdd4a('0x45')](handleError(_0x1104c2,null));};exports[_0xdd4a('0x28')]=function(_0x33270a,_0x153ba2){return db[_0xdd4a('0x2f')]['find']({'where':{'id':_0x33270a[_0xdd4a('0x47')]['id']}})[_0xdd4a('0x29')](handleEntityNotFound(_0x153ba2,null))[_0xdd4a('0x29')](removeEntity(_0x153ba2,null))['catch'](handleError(_0x153ba2,null));};exports['getConfigurations']=function(_0x433a3c,_0x5c7dec,_0x739787){var _0x39563b={};var _0x1aa387={};var _0x220523;var _0xfe4421;return db[_0xdd4a('0x2f')][_0xdd4a('0x4e')]({'where':{'id':_0x433a3c[_0xdd4a('0x47')]['id']}})[_0xdd4a('0x29')](handleEntityNotFound(_0x5c7dec,null))[_0xdd4a('0x29')](function(_0x2741f4){if(_0x2741f4){_0x220523=_0x2741f4;_0x1aa387['model']=_[_0xdd4a('0x34')](db[_0xdd4a('0x4f')]['rawAttributes']);_0x1aa387[_0xdd4a('0x35')]=_[_0xdd4a('0x34')](_0x433a3c['query']);_0x1aa387['filters']=_['intersection'](_0x1aa387[_0xdd4a('0x33')],_0x1aa387[_0xdd4a('0x35')]);_0x39563b['attributes']=_[_0xdd4a('0x37')](_0x1aa387[_0xdd4a('0x33')],qs[_0xdd4a('0x38')](_0x433a3c[_0xdd4a('0x35')]['fields']));_0x39563b[_0xdd4a('0x39')]=_0x39563b[_0xdd4a('0x39')][_0xdd4a('0x3a')]?_0x39563b[_0xdd4a('0x39')]:_0x1aa387[_0xdd4a('0x33')];_0x39563b[_0xdd4a('0x50')]=qs['sort'](_0x433a3c['query'][_0xdd4a('0x3d')]);_0x39563b[_0xdd4a('0x3e')]=qs['filters'](_[_0xdd4a('0x51')](_0x433a3c[_0xdd4a('0x35')],_0x1aa387[_0xdd4a('0x36')]));if(_0x433a3c[_0xdd4a('0x35')][_0xdd4a('0x3f')]){_0x39563b[_0xdd4a('0x3e')]=_[_0xdd4a('0x41')](_0x39563b[_0xdd4a('0x3e')],{'$or':_[_0xdd4a('0x2e')](_0x39563b['attributes'],function(_0x3df319){var _0x3ee9ce={};_0x3ee9ce[_0x3df319]={'$like':'%'+_0x433a3c[_0xdd4a('0x35')][_0xdd4a('0x3f')]+'%'};return _0x3ee9ce;})});}_0x39563b=_[_0xdd4a('0x41')]({},_0x39563b,_0x433a3c[_0xdd4a('0x4a')]);return _0x220523[_0xdd4a('0x52')](_0x39563b);}})[_0xdd4a('0x29')](function(_0x14969d){if(_0x14969d){_0xfe4421=_0x14969d['length'];if(!_0x433a3c[_0xdd4a('0x35')][_0xdd4a('0x3b')](_0xdd4a('0x3c'))){_0x39563b[_0xdd4a('0x1f')]=qs[_0xdd4a('0x1f')](_0x433a3c[_0xdd4a('0x35')]['limit']);_0x39563b[_0xdd4a('0x1e')]=qs[_0xdd4a('0x1e')](_0x433a3c[_0xdd4a('0x35')][_0xdd4a('0x1e')]);}return _0x220523[_0xdd4a('0x52')](_0x39563b);}})['then'](function(_0x3e472e){if(_0x3e472e){return _0x3e472e?{'count':_0xfe4421,'rows':_0x3e472e}:null;}})[_0xdd4a('0x29')](respondWithResult(_0x5c7dec,null))[_0xdd4a('0x45')](handleError(_0x5c7dec,null));};exports[_0xdd4a('0x53')]=function(_0x15456f,_0x41f4b1,_0x30f183){if(_0x15456f[_0xdd4a('0x4d')]['id']){delete _0x15456f[_0xdd4a('0x4d')]['id'];}return db[_0xdd4a('0x2f')][_0xdd4a('0x4e')]({'where':{'id':_0x15456f[_0xdd4a('0x47')]['id']}})[_0xdd4a('0x29')](handleEntityNotFound(_0x41f4b1,null))[_0xdd4a('0x29')](function(_0x1f577a){if(_0x1f577a){_0x15456f['body'][_0xdd4a('0x54')]=_0x1f577a['id'];_0x15456f['body'][_0xdd4a('0x55')]=integrations[_0xdd4a('0x56')](_0x15456f[_0xdd4a('0x4d')][_0xdd4a('0x57')],_0x15456f['body'][_0xdd4a('0x31')]);_0x15456f[_0xdd4a('0x4d')][_0xdd4a('0x58')]=integrations[_0xdd4a('0x59')](_0x15456f['body']['channel'],_0x15456f[_0xdd4a('0x4d')]['type']);return db['FreshsalesConfiguration'][_0xdd4a('0x4c')](_0x15456f[_0xdd4a('0x4d')],{'include':[{'model':db[_0xdd4a('0x5a')],'as':_0xdd4a('0x55')},{'model':db[_0xdd4a('0x5a')],'as':_0xdd4a('0x58')}]});}return null;})['then'](respondWithResult(_0x41f4b1,null))[_0xdd4a('0x45')](handleError(_0x41f4b1,null));};exports[_0xdd4a('0x5b')]=function(_0x3c8cf0,_0x19c464,_0x59e1f7){var _0x2c84b7='';var _0x2a8262='';return db[_0xdd4a('0x2f')][_0xdd4a('0x4e')]({'where':{'id':_0x3c8cf0[_0xdd4a('0x47')]['id']},'attributes':['id','username',_0xdd4a('0x5c'),'apiKey']})[_0xdd4a('0x29')](handleEntityNotFound(_0x19c464,null))['then'](function(_0x2d9d18){if(_0x2d9d18){_0x2a8262=_0x2d9d18[_0xdd4a('0x5d')];_0x2c84b7=_0x2d9d18['remoteUri'];var _0x4717cf=_0x2d9d18['remoteUri'][_0xdd4a('0x5e')](-0x1);if(_0x4717cf==='/'){_0x2c84b7=_0x2c84b7[_0xdd4a('0x5f')](0x0,_0x2c84b7[_0xdd4a('0x60')](_0x4717cf));}return rp({'method':_0xdd4a('0x61'),'uri':util[_0xdd4a('0x62')]('%s%s',_0x2c84b7,'/api/selector/owners'),'headers':{'Authorization':_0xdd4a('0x63')+_0x2d9d18[_0xdd4a('0x64')]},'json':!![]});}})[_0xdd4a('0x29')](function(_0x4139f9){if(_0x4139f9){var _0x5316ba=_0x4139f9[_0xdd4a('0x65')];var _0x3a6be5=![];var _0x376358=null;for(_0x376358=0x0;_0x376358<_0x5316ba[_0xdd4a('0x3a')];_0x376358++){if(_0x5316ba[_0x376358]['email']===_0x2a8262){_0x3a6be5=!![];}}if(_0x3a6be5){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xdd4a('0x29')](respondWithResult(_0x19c464,null))[_0xdd4a('0x45')](function(_0x400317){var _0x4c8d40=_0x3c8cf0[_0xdd4a('0x35')][_0xdd4a('0x66')]?0x1f4:_0x400317['statusCode']||0x1f4;logger[_0xdd4a('0x2a')](_0xdd4a('0x67'),_0xdd4a('0x5b'),_0x4c8d40,JSON[_0xdd4a('0x68')](_0x400317));delete _0x400317[_0xdd4a('0x2c')];if(_0x4c8d40===0x191){_0x4c8d40=0x190;}_0x19c464[_0xdd4a('0x1c')](_0x4c8d40)[_0xdd4a('0x2d')](_0x3c8cf0[_0xdd4a('0x35')][_0xdd4a('0x66')]?{'message':_0xdd4a('0x69'),'statusCode':_0x400317[_0xdd4a('0x6a')]}:_0x400317);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index fe27b03..01f0896 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 _0x3f8a=['exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x45bfdb,_0x409458){_0x45bfdb=_0x45bfdb-0x0;var _0x529185=_0x3f8a[_0x45bfdb];return _0x529185;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var logger=require(_0xa3f8('0x2'))(_0xa3f8('0x3'));var moment=require('moment');var BPromise=require(_0xa3f8('0x4'));var rp=require(_0xa3f8('0x5'));var fs=require('fs');var path=require(_0xa3f8('0x6'));var rimraf=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var attributes=require(_0xa3f8('0x9'));var integrations=require(_0xa3f8('0xa'));module[_0xa3f8('0xb')]=function(_0x1f160a,_0xf895d9){return _0x1f160a[_0xa3f8('0xc')](_0xa3f8('0xd'),attributes,{'tableName':_0xa3f8('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fdc=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','lodash','util','../../config/logger','api'];(function(_0x4ad088,_0x5698a9){var _0x495de9=function(_0x147d06){while(--_0x147d06){_0x4ad088['push'](_0x4ad088['shift']());}};_0x495de9(++_0x5698a9);}(_0x5fdc,0x127));var _0xc5fd=function(_0x238c8a,_0x37c161){_0x238c8a=_0x238c8a-0x0;var _0x320602=_0x5fdc[_0x238c8a];return _0x320602;};'use strict';var _=require(_0xc5fd('0x0'));var util=require(_0xc5fd('0x1'));var logger=require(_0xc5fd('0x2'))(_0xc5fd('0x3'));var moment=require(_0xc5fd('0x4'));var BPromise=require(_0xc5fd('0x5'));var rp=require(_0xc5fd('0x6'));var fs=require('fs');var path=require(_0xc5fd('0x7'));var rimraf=require(_0xc5fd('0x8'));var config=require(_0xc5fd('0x9'));var attributes=require(_0xc5fd('0xa'));var integrations=require(_0xc5fd('0xb'));module[_0xc5fd('0xc')]=function(_0x216902,_0x15ffe7){return _0x216902['define']('FreshsalesAccount',attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 0950c0c..dfb4a48 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 _0x4975=['jayson/promise','http','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','FreshsalesAccount','findAll','options','raw','where','attributes','include','map','model','GetFreshsalesAccount','ShowFreshsalesAccount','find','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4975,0x86));var _0x5497=function(_0x1a58d1,_0x2a4ac0){_0x1a58d1=_0x1a58d1-0x0;var _0x2b9a86=_0x4975[_0x1a58d1];return _0x2b9a86;};'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')]('FreshsalesAccount,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});}exports['GetFreshsalesAccount']=function(_0x3f4d20){var _0x1bf442=this;return new Promise(function(_0x3a47fd,_0x5d9e24){return db[_0x5497('0x17')][_0x5497('0x18')]({'raw':_0x3f4d20[_0x5497('0x19')]?_0x3f4d20[_0x5497('0x19')][_0x5497('0x1a')]===undefined?!![]:![]:!![],'where':_0x3f4d20[_0x5497('0x19')]?_0x3f4d20[_0x5497('0x19')][_0x5497('0x1b')]||null:null,'attributes':_0x3f4d20[_0x5497('0x19')]?_0x3f4d20[_0x5497('0x19')][_0x5497('0x1c')]||null:null,'limit':_0x3f4d20['options']?_0x3f4d20[_0x5497('0x19')]['limit']||null:null,'include':_0x3f4d20[_0x5497('0x19')]?_0x3f4d20[_0x5497('0x19')][_0x5497('0x1d')]?_[_0x5497('0x1e')](_0x3f4d20[_0x5497('0x19')][_0x5497('0x1d')],function(_0x5018fa){return{'model':db[_0x5018fa['model']],'as':_0x5018fa['as'],'attributes':_0x5018fa[_0x5497('0x1c')],'include':_0x5018fa[_0x5497('0x1d')]?_[_0x5497('0x1e')](_0x5018fa[_0x5497('0x1d')],function(_0x5223b5){return{'model':db[_0x5223b5[_0x5497('0x1f')]],'as':_0x5223b5['as'],'attributes':_0x5223b5['attributes'],'include':_0x5223b5[_0x5497('0x1d')]?_[_0x5497('0x1e')](_0x5223b5[_0x5497('0x1d')],function(_0x34a1a5){return{'model':db[_0x34a1a5[_0x5497('0x1f')]],'as':_0x34a1a5['as'],'attributes':_0x34a1a5[_0x5497('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4af5f4){logger['info']('GetFreshsalesAccount',_0x3f4d20);logger['debug'](_0x5497('0x20'),_0x3f4d20,JSON['stringify'](_0x4af5f4));_0x3a47fd(_0x4af5f4);})['catch'](function(_0xc3465){logger[_0x5497('0x13')](_0x5497('0x20'),_0xc3465['message'],_0x3f4d20);_0x5d9e24(_0x1bf442['error'](0x1f4,_0xc3465['message']));});});};exports[_0x5497('0x21')]=function(_0x471e0b){var _0xf4c117=this;return new Promise(function(_0x5b8f79,_0x489f71){return db['FreshsalesAccount'][_0x5497('0x22')]({'raw':_0x471e0b['options']?_0x471e0b[_0x5497('0x19')][_0x5497('0x1a')]===undefined?!![]:![]:!![],'where':_0x471e0b[_0x5497('0x19')]?_0x471e0b['options'][_0x5497('0x1b')]||null:null,'attributes':_0x471e0b[_0x5497('0x19')]?_0x471e0b['options'][_0x5497('0x1c')]||null:null,'include':_0x471e0b[_0x5497('0x19')]?_0x471e0b[_0x5497('0x19')]['include']?_[_0x5497('0x1e')](_0x471e0b[_0x5497('0x19')][_0x5497('0x1d')],function(_0x362b96){return{'model':db[_0x362b96[_0x5497('0x1f')]],'as':_0x362b96['as'],'attributes':_0x362b96['attributes'],'include':_0x362b96[_0x5497('0x1d')]?_[_0x5497('0x1e')](_0x362b96['include'],function(_0x1ffc9b){return{'model':db[_0x1ffc9b[_0x5497('0x1f')]],'as':_0x1ffc9b['as'],'attributes':_0x1ffc9b[_0x5497('0x1c')],'include':_0x1ffc9b[_0x5497('0x1d')]?_[_0x5497('0x1e')](_0x1ffc9b[_0x5497('0x1d')],function(_0x580e86){return{'model':db[_0x580e86[_0x5497('0x1f')]],'as':_0x580e86['as'],'attributes':_0x580e86['attributes']};}):[]};}):[]};}):[]:[]})[_0x5497('0x23')](function(_0x212199){logger[_0x5497('0xd')]('ShowFreshsalesAccount',_0x471e0b);logger['debug'](_0x5497('0x21'),_0x471e0b,JSON[_0x5497('0x12')](_0x212199));_0x5b8f79(_0x212199);})[_0x5497('0x16')](function(_0x429cbf){logger[_0x5497('0x13')](_0x5497('0x21'),_0x429cbf['message'],_0x471e0b);_0x489f71(_0xf4c117[_0x5497('0x13')](0x1f4,_0x429cbf[_0x5497('0x14')]));});});}; \ No newline at end of file +var _0x1623=['../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','limit','include','map','model','attributes','find','ShowFreshsalesAccount','lodash','bluebird','randomstring','ioredis'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x1623,0xab));var _0x3162=function(_0x150dd8,_0x532f22){_0x150dd8=_0x150dd8-0x0;var _0x1cd2af=_0x1623[_0x150dd8];return _0x1cd2af;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3162('0x1'));var rs=require(_0x3162('0x2'));var fs=require('fs');var Redis=require(_0x3162('0x3'));var db=require(_0x3162('0x4'))['db'];var utils=require(_0x3162('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3162('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3162('0x7')][_0x3162('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53260d,_0xffe9b6,_0x2dc07e){return new BPromise(function(_0x26ee32,_0x36609e){return client[_0x3162('0x9')](_0x53260d,_0x2dc07e)[_0x3162('0xa')](function(_0xe43099){logger[_0x3162('0xb')]('FreshsalesAccount,\x20%s,\x20%s',_0xffe9b6,'request\x20sent');logger[_0x3162('0xc')](_0x3162('0xd'),_0xffe9b6,_0x3162('0xe'),JSON[_0x3162('0xf')](_0xe43099));if(_0xe43099[_0x3162('0x10')]){if(_0xe43099[_0x3162('0x10')][_0x3162('0x11')]===0x1f4){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x36609e(_0xe43099['error'][_0x3162('0x13')]);}logger[_0x3162('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x26ee32(_0xe43099[_0x3162('0x10')][_0x3162('0x13')]);}else{logger['info'](_0x3162('0x12'),_0xffe9b6,_0x3162('0xe'));_0x26ee32(_0xe43099[_0x3162('0x14')]['message']);}})[_0x3162('0x15')](function(_0x42cf7d){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0x42cf7d);_0x36609e(_0x42cf7d);});});}exports[_0x3162('0x16')]=function(_0x1eed46){var _0x391d97=this;return new Promise(function(_0x4b2bf3,_0x42f283){return db[_0x3162('0x17')][_0x3162('0x18')]({'raw':_0x1eed46[_0x3162('0x19')]?_0x1eed46['options'][_0x3162('0x1a')]===undefined?!![]:![]:!![],'where':_0x1eed46['options']?_0x1eed46['options'][_0x3162('0x1b')]||null:null,'attributes':_0x1eed46[_0x3162('0x19')]?_0x1eed46[_0x3162('0x19')]['attributes']||null:null,'limit':_0x1eed46['options']?_0x1eed46[_0x3162('0x19')][_0x3162('0x1c')]||null:null,'include':_0x1eed46[_0x3162('0x19')]?_0x1eed46[_0x3162('0x19')][_0x3162('0x1d')]?_[_0x3162('0x1e')](_0x1eed46[_0x3162('0x19')][_0x3162('0x1d')],function(_0x5a4994){return{'model':db[_0x5a4994[_0x3162('0x1f')]],'as':_0x5a4994['as'],'attributes':_0x5a4994[_0x3162('0x20')],'include':_0x5a4994[_0x3162('0x1d')]?_[_0x3162('0x1e')](_0x5a4994[_0x3162('0x1d')],function(_0x3c543e){return{'model':db[_0x3c543e[_0x3162('0x1f')]],'as':_0x3c543e['as'],'attributes':_0x3c543e[_0x3162('0x20')],'include':_0x3c543e[_0x3162('0x1d')]?_[_0x3162('0x1e')](_0x3c543e[_0x3162('0x1d')],function(_0x2f62d7){return{'model':db[_0x2f62d7[_0x3162('0x1f')]],'as':_0x2f62d7['as'],'attributes':_0x2f62d7['attributes']};}):[]};}):[]};}):[]:[]})[_0x3162('0xa')](function(_0x552469){logger[_0x3162('0xb')](_0x3162('0x16'),_0x1eed46);logger[_0x3162('0xc')]('GetFreshsalesAccount',_0x1eed46,JSON['stringify'](_0x552469));_0x4b2bf3(_0x552469);})[_0x3162('0x15')](function(_0xaa1f35){logger[_0x3162('0x10')](_0x3162('0x16'),_0xaa1f35[_0x3162('0x13')],_0x1eed46);_0x42f283(_0x391d97['error'](0x1f4,_0xaa1f35[_0x3162('0x13')]));});});};exports['ShowFreshsalesAccount']=function(_0xf11765){var _0x3a188e=this;return new Promise(function(_0x41e933,_0x221b38){return db[_0x3162('0x17')][_0x3162('0x21')]({'raw':_0xf11765[_0x3162('0x19')]?_0xf11765[_0x3162('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xf11765[_0x3162('0x19')]?_0xf11765[_0x3162('0x19')]['where']||null:null,'attributes':_0xf11765[_0x3162('0x19')]?_0xf11765[_0x3162('0x19')]['attributes']||null:null,'include':_0xf11765['options']?_0xf11765[_0x3162('0x19')]['include']?_[_0x3162('0x1e')](_0xf11765[_0x3162('0x19')][_0x3162('0x1d')],function(_0x551442){return{'model':db[_0x551442['model']],'as':_0x551442['as'],'attributes':_0x551442[_0x3162('0x20')],'include':_0x551442[_0x3162('0x1d')]?_['map'](_0x551442[_0x3162('0x1d')],function(_0x4d4f74){return{'model':db[_0x4d4f74[_0x3162('0x1f')]],'as':_0x4d4f74['as'],'attributes':_0x4d4f74[_0x3162('0x20')],'include':_0x4d4f74[_0x3162('0x1d')]?_[_0x3162('0x1e')](_0x4d4f74[_0x3162('0x1d')],function(_0x3b6c91){return{'model':db[_0x3b6c91[_0x3162('0x1f')]],'as':_0x3b6c91['as'],'attributes':_0x3b6c91[_0x3162('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3162('0xa')](function(_0x16c5d6){logger[_0x3162('0xb')]('ShowFreshsalesAccount',_0xf11765);logger[_0x3162('0xc')](_0x3162('0x22'),_0xf11765,JSON[_0x3162('0xf')](_0x16c5d6));_0x41e933(_0x16c5d6);})['catch'](function(_0x59759d){logger[_0x3162('0x10')](_0x3162('0x22'),_0x59759d[_0x3162('0x13')],_0xf11765);_0x221b38(_0x3a188e[_0x3162('0x10')](0x1f4,_0x59759d['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 704bdea..b8366d1 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 _0x8946=['../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','getDescriptions','/:id/fields','post','create','put','update','delete','exports','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x461bd9,_0x4f1606){var _0x23152f=function(_0x383468){while(--_0x383468){_0x461bd9['push'](_0x461bd9['shift']());}};_0x23152f(++_0x4f1606);}(_0x8946,0x172));var _0x6894=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x8946[_0x2555d0];return _0x3bb486;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x6894('0x0'));var express=require(_0x6894('0x1'));var router=express['Router']();var fs_extra=require(_0x6894('0x2'));var auth=require(_0x6894('0x3'));var interaction=require(_0x6894('0x4'));var config=require(_0x6894('0x5'));var controller=require(_0x6894('0x6'));router[_0x6894('0x7')]('/',auth[_0x6894('0x8')](),controller[_0x6894('0x9')]);router['get'](_0x6894('0xa'),auth[_0x6894('0x8')](),controller[_0x6894('0xb')]);router[_0x6894('0x7')](_0x6894('0xc'),auth[_0x6894('0x8')](),controller[_0x6894('0xd')]);router[_0x6894('0x7')]('/:id/descriptions',auth[_0x6894('0x8')](),controller[_0x6894('0xe')]);router[_0x6894('0x7')](_0x6894('0xf'),auth[_0x6894('0x8')](),controller['getFields']);router[_0x6894('0x10')]('/',auth[_0x6894('0x8')](),controller[_0x6894('0x11')]);router[_0x6894('0x12')](_0x6894('0xa'),auth[_0x6894('0x8')](),controller[_0x6894('0x13')]);router[_0x6894('0x14')](_0x6894('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x6894('0x15')]=router; \ No newline at end of file +var _0x6cf5=['../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','create','put','update','delete','destroy','multer','util','path','express','Router'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x6cf5,0xd7));var _0x56cf=function(_0x19b130,_0x2db835){_0x19b130=_0x19b130-0x0;var _0x421e9f=_0x6cf5[_0x19b130];return _0x421e9f;};'use strict';var multer=require(_0x56cf('0x0'));var util=require(_0x56cf('0x1'));var path=require(_0x56cf('0x2'));var timeout=require('connect-timeout');var express=require(_0x56cf('0x3'));var router=express[_0x56cf('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x56cf('0x5'));var config=require('../../config/environment');var controller=require('./intFreshsalesConfiguration.controller');router[_0x56cf('0x6')]('/',auth[_0x56cf('0x7')](),controller[_0x56cf('0x8')]);router[_0x56cf('0x6')](_0x56cf('0x9'),auth[_0x56cf('0x7')](),controller[_0x56cf('0xa')]);router[_0x56cf('0x6')](_0x56cf('0xb'),auth[_0x56cf('0x7')](),controller[_0x56cf('0xc')]);router[_0x56cf('0x6')](_0x56cf('0xd'),auth[_0x56cf('0x7')](),controller[_0x56cf('0xe')]);router['get'](_0x56cf('0xf'),auth[_0x56cf('0x7')](),controller[_0x56cf('0x10')]);router['post']('/',auth[_0x56cf('0x7')](),controller[_0x56cf('0x11')]);router[_0x56cf('0x12')]('/:id',auth[_0x56cf('0x7')](),controller[_0x56cf('0x13')]);router[_0x56cf('0x14')](_0x56cf('0x9'),auth[_0x56cf('0x7')](),controller[_0x56cf('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 881642e..28e9e24 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 _0xa430=['exports','STRING'];(function(_0x5a6ee4,_0x2e1727){var _0x5906fa=function(_0x3aacb5){while(--_0x3aacb5){_0x5a6ee4['push'](_0x5a6ee4['shift']());}};_0x5906fa(++_0x2e1727);}(_0xa430,0x1ec));var _0x0a43=function(_0xd888f0,_0x23f066){_0xd888f0=_0xd888f0-0x0;var _0x362f6c=_0xa430[_0xd888f0];return _0x362f6c;};'use strict';var Sequelize=require('sequelize');module[_0x0a43('0x0')]={'name':{'type':Sequelize[_0x0a43('0x1')]},'description':{'type':Sequelize[_0x0a43('0x1')]}}; \ No newline at end of file +var _0x2998=['sequelize','exports','STRING'];(function(_0x573c86,_0x1026b8){var _0xb06f66=function(_0x5600cc){while(--_0x5600cc){_0x573c86['push'](_0x573c86['shift']());}};_0xb06f66(++_0x1026b8);}(_0x2998,0x159));var _0x8299=function(_0x38297a,_0x363ffc){_0x38297a=_0x38297a-0x0;var _0x310e61=_0x2998[_0x38297a];return _0x310e61;};'use strict';var Sequelize=require(_0x8299('0x0'));module[_0x8299('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8299('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index ba64ebc..5acb5b3 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 _0x963a=['rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','update','params','getSubjects','findOne','FreshsalesField','nolimit','getDescriptions','getFields','eml-format','rimraf','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','FreshsalesConfiguration'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x963a,0x1c1));var _0xa963=function(_0x2f4223,_0x12ae51){_0x2f4223=_0x2f4223-0x0;var _0xa53d6d=_0x963a[_0x2f4223];return _0xa53d6d;};'use strict';var emlformat=require(_0xa963('0x0'));var rimraf=require(_0xa963('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa963('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xa963('0x3'));var util=require(_0xa963('0x4'));var path=require(_0xa963('0x5'));var sox=require(_0xa963('0x6'));var csv=require('to-csv');var ejs=require(_0xa963('0x7'));var fs=require('fs');var fs_extra=require(_0xa963('0x8'));var _=require(_0xa963('0x9'));var squel=require(_0xa963('0xa'));var crypto=require('crypto');var jsforce=require(_0xa963('0xb'));var deskjs=require(_0xa963('0xc'));var toCsv=require(_0xa963('0xd'));var querystring=require(_0xa963('0xe'));var Papa=require(_0xa963('0xf'));var Redis=require(_0xa963('0x10'));var authService=require(_0xa963('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa963('0x12'));var hardwareService=require(_0xa963('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xa963('0x14'));var config=require(_0xa963('0x15'));var licenseUtil=require(_0xa963('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5056a0,_0x66ea75){_0x66ea75=_0x66ea75||0xcc;return function(_0x4c209a){if(_0x4c209a){return _0x5056a0[_0xa963('0x17')](_0x66ea75);}return _0x5056a0[_0xa963('0x18')](_0x66ea75)[_0xa963('0x19')]();};}function respondWithResult(_0x1bcb06,_0x29ebfe){_0x29ebfe=_0x29ebfe||0xc8;return function(_0x22886e){if(_0x22886e){return _0x1bcb06[_0xa963('0x18')](_0x29ebfe)[_0xa963('0x1a')](_0x22886e);}};}function respondWithFilteredResult(_0x4f54c1,_0x133ac9){return function(_0x3e7e7c){if(_0x3e7e7c){var _0x10ff21=typeof _0x133ac9[_0xa963('0x1b')]===_0xa963('0x1c')&&typeof _0x133ac9[_0xa963('0x1d')]===_0xa963('0x1c');var _0x3194ec=_0x3e7e7c[_0xa963('0x1e')];var _0x505be2=_0x10ff21?0x0:_0x133ac9[_0xa963('0x1b')];var _0x5662f2=_0x10ff21?_0x3e7e7c[_0xa963('0x1e')]:_0x133ac9[_0xa963('0x1b')]+_0x133ac9[_0xa963('0x1d')];var _0x46750e;if(_0x5662f2>=_0x3194ec){_0x5662f2=_0x3194ec;_0x46750e=0xc8;}else{_0x46750e=0xce;}_0x4f54c1['status'](_0x46750e);return _0x4f54c1[_0xa963('0x1f')](_0xa963('0x20'),_0x505be2+'-'+_0x5662f2+'/'+_0x3194ec)[_0xa963('0x1a')](_0x3e7e7c);}return null;};}function patchUpdates(_0xe8a2a7){return function(_0x470a84){try{jsonpatch[_0xa963('0x21')](_0x470a84,_0xe8a2a7,!![]);}catch(_0x51328d){return BPromise['reject'](_0x51328d);}return _0x470a84[_0xa963('0x22')]();};}function saveUpdates(_0x32310e,_0x429661){return function(_0x33a28d){if(_0x33a28d){return _0x33a28d['update'](_0x32310e)[_0xa963('0x23')](function(_0x3c3e26){return _0x3c3e26;});}return null;};}function removeEntity(_0x33955d,_0x29dc16){return function(_0x206dd8){if(_0x206dd8){return _0x206dd8[_0xa963('0x24')]()['then'](function(){_0x33955d[_0xa963('0x18')](0xcc)[_0xa963('0x19')]();});}};}function handleEntityNotFound(_0x5f0bbc,_0x1414a9){return function(_0x35f302){if(!_0x35f302){_0x5f0bbc[_0xa963('0x17')](0x194);}return _0x35f302;};}function handleError(_0x222baa,_0x331d4e){_0x331d4e=_0x331d4e||0x1f4;return function(_0x12db3c){logger[_0xa963('0x25')](_0x12db3c[_0xa963('0x26')]);if(_0x12db3c[_0xa963('0x27')]){delete _0x12db3c[_0xa963('0x27')];}_0x222baa[_0xa963('0x18')](_0x331d4e)[_0xa963('0x28')](_0x12db3c);};}exports[_0xa963('0x29')]=function(_0x4d945f,_0x6177c9){var _0x578a8={},_0x4c69ed={},_0xba5afa={'count':0x0,'rows':[]};var _0x539f6a=_['map'](db[_0xa963('0x2a')][_0xa963('0x2b')],function(_0x51f294){return{'name':_0x51f294[_0xa963('0x2c')],'type':_0x51f294[_0xa963('0x2d')][_0xa963('0x2e')]};});_0x4c69ed['model']=_[_0xa963('0x2f')](_0x539f6a,_0xa963('0x27'));_0x4c69ed[_0xa963('0x30')]=_[_0xa963('0x31')](_0x4d945f[_0xa963('0x30')]);_0x4c69ed[_0xa963('0x32')]=_[_0xa963('0x33')](_0x4c69ed[_0xa963('0x34')],_0x4c69ed[_0xa963('0x30')]);_0x578a8[_0xa963('0x35')]=_['intersection'](_0x4c69ed[_0xa963('0x34')],qs['fields'](_0x4d945f[_0xa963('0x30')][_0xa963('0x36')]));_0x578a8['attributes']=_0x578a8[_0xa963('0x35')]['length']?_0x578a8[_0xa963('0x35')]:_0x4c69ed[_0xa963('0x34')];if(!_0x4d945f['query'][_0xa963('0x37')]('nolimit')){_0x578a8['limit']=qs[_0xa963('0x1d')](_0x4d945f['query'][_0xa963('0x1d')]);_0x578a8[_0xa963('0x1b')]=qs['offset'](_0x4d945f[_0xa963('0x30')][_0xa963('0x1b')]);}_0x578a8[_0xa963('0x38')]=qs[_0xa963('0x39')](_0x4d945f[_0xa963('0x30')][_0xa963('0x39')]);_0x578a8[_0xa963('0x3a')]=qs['filters'](_[_0xa963('0x3b')](_0x4d945f[_0xa963('0x30')],_0x4c69ed['filters']),_0x539f6a);if(_0x4d945f[_0xa963('0x30')][_0xa963('0x3c')]){_0x578a8[_0xa963('0x3a')]=_[_0xa963('0x3d')](_0x578a8[_0xa963('0x3a')],{'$or':_[_0xa963('0x2f')](_0x539f6a,function(_0x4e4ebd){if(_0x4e4ebd[_0xa963('0x2d')]!==_0xa963('0x3e')){var _0xfd7001={};_0xfd7001[_0x4e4ebd[_0xa963('0x27')]]={'$like':'%'+_0x4d945f[_0xa963('0x30')][_0xa963('0x3c')]+'%'};return _0xfd7001;}})});}_0x578a8=_[_0xa963('0x3d')]({},_0x578a8,_0x4d945f[_0xa963('0x3f')]);var _0x4117cd={'where':_0x578a8[_0xa963('0x3a')]};return db[_0xa963('0x2a')][_0xa963('0x1e')](_0x4117cd)[_0xa963('0x23')](function(_0x4f9952){_0xba5afa[_0xa963('0x1e')]=_0x4f9952;if(_0x4d945f[_0xa963('0x30')][_0xa963('0x40')]){_0x578a8[_0xa963('0x41')]=[{'all':!![]}];}return db[_0xa963('0x2a')][_0xa963('0x42')](_0x578a8);})[_0xa963('0x23')](function(_0x2899ff){_0xba5afa[_0xa963('0x43')]=_0x2899ff;return _0xba5afa;})[_0xa963('0x23')](respondWithFilteredResult(_0x6177c9,_0x578a8))[_0xa963('0x44')](handleError(_0x6177c9,null));};exports[_0xa963('0x45')]=function(_0x4c2c6b,_0x114636){var _0x362f03={'raw':![],'where':{'id':_0x4c2c6b['params']['id']}},_0xb67af6={};_0xb67af6[_0xa963('0x34')]=_[_0xa963('0x31')](db['FreshsalesConfiguration'][_0xa963('0x2b')]);_0xb67af6[_0xa963('0x30')]=_[_0xa963('0x31')](_0x4c2c6b['query']);_0xb67af6[_0xa963('0x32')]=_[_0xa963('0x33')](_0xb67af6[_0xa963('0x34')],_0xb67af6['query']);_0x362f03[_0xa963('0x35')]=_[_0xa963('0x33')](_0xb67af6['model'],qs[_0xa963('0x36')](_0x4c2c6b[_0xa963('0x30')][_0xa963('0x36')]));_0x362f03[_0xa963('0x35')]=_0x362f03[_0xa963('0x35')][_0xa963('0x46')]?_0x362f03[_0xa963('0x35')]:_0xb67af6[_0xa963('0x34')];if(_0x4c2c6b['query']['includeAll']){_0x362f03['include']=[{'all':!![]}];}_0x362f03=_[_0xa963('0x3d')]({},_0x362f03,_0x4c2c6b['options']);return db[_0xa963('0x2a')][_0xa963('0x47')](_0x362f03)[_0xa963('0x23')](handleEntityNotFound(_0x114636,null))[_0xa963('0x23')](respondWithResult(_0x114636,null))[_0xa963('0x44')](handleError(_0x114636,null));};exports[_0xa963('0x48')]=function(_0x479593,_0x41eea6){return db[_0xa963('0x2a')][_0xa963('0x48')](_0x479593[_0xa963('0x49')],{})[_0xa963('0x23')](respondWithResult(_0x41eea6,0xc9))[_0xa963('0x44')](handleError(_0x41eea6,null));};exports[_0xa963('0x4a')]=function(_0x10c93c,_0x2a1eff){if(_0x10c93c['body']['id']){delete _0x10c93c[_0xa963('0x49')]['id'];}return db['FreshsalesConfiguration'][_0xa963('0x47')]({'where':{'id':_0x10c93c[_0xa963('0x4b')]['id']}})[_0xa963('0x23')](handleEntityNotFound(_0x2a1eff,null))[_0xa963('0x23')](saveUpdates(_0x10c93c[_0xa963('0x49')],null))['then'](respondWithResult(_0x2a1eff,null))['catch'](handleError(_0x2a1eff,null));};exports[_0xa963('0x24')]=function(_0x1b79ce,_0x1bb4f6){return db[_0xa963('0x2a')][_0xa963('0x47')]({'where':{'id':_0x1b79ce['params']['id']}})[_0xa963('0x23')](handleEntityNotFound(_0x1bb4f6,null))[_0xa963('0x23')](removeEntity(_0x1bb4f6,null))[_0xa963('0x44')](handleError(_0x1bb4f6,null));};exports[_0xa963('0x4c')]=function(_0x1747db,_0x2b9744,_0x507c34){var _0xe0a6b1={};var _0x3be0f9={};var _0x521a0d;var _0x194119;return db['FreshsalesConfiguration'][_0xa963('0x4d')]({'where':{'id':_0x1747db[_0xa963('0x4b')]['id']}})[_0xa963('0x23')](handleEntityNotFound(_0x2b9744,null))[_0xa963('0x23')](function(_0x194547){if(_0x194547){_0x521a0d=_0x194547;_0x3be0f9[_0xa963('0x34')]=_[_0xa963('0x31')](db[_0xa963('0x4e')][_0xa963('0x2b')]);_0x3be0f9[_0xa963('0x30')]=_[_0xa963('0x31')](_0x1747db[_0xa963('0x30')]);_0x3be0f9[_0xa963('0x32')]=_['intersection'](_0x3be0f9[_0xa963('0x34')],_0x3be0f9[_0xa963('0x30')]);_0xe0a6b1['attributes']=_[_0xa963('0x33')](_0x3be0f9[_0xa963('0x34')],qs['fields'](_0x1747db[_0xa963('0x30')][_0xa963('0x36')]));_0xe0a6b1[_0xa963('0x35')]=_0xe0a6b1['attributes']['length']?_0xe0a6b1[_0xa963('0x35')]:_0x3be0f9[_0xa963('0x34')];_0xe0a6b1[_0xa963('0x38')]=qs['sort'](_0x1747db[_0xa963('0x30')][_0xa963('0x39')]);_0xe0a6b1[_0xa963('0x3a')]=qs[_0xa963('0x32')](_[_0xa963('0x3b')](_0x1747db[_0xa963('0x30')],_0x3be0f9[_0xa963('0x32')]));if(_0x1747db[_0xa963('0x30')][_0xa963('0x3c')]){_0xe0a6b1[_0xa963('0x3a')]=_[_0xa963('0x3d')](_0xe0a6b1[_0xa963('0x3a')],{'$or':_[_0xa963('0x2f')](_0xe0a6b1[_0xa963('0x35')],function(_0x4fe2c2){var _0x1636da={};_0x1636da[_0x4fe2c2]={'$like':'%'+_0x1747db[_0xa963('0x30')][_0xa963('0x3c')]+'%'};return _0x1636da;})});}_0xe0a6b1=_[_0xa963('0x3d')]({},_0xe0a6b1,_0x1747db['options']);return _0x521a0d[_0xa963('0x4c')](_0xe0a6b1);}})[_0xa963('0x23')](function(_0x20bde8){if(_0x20bde8){_0x194119=_0x20bde8[_0xa963('0x46')];if(!_0x1747db[_0xa963('0x30')][_0xa963('0x37')](_0xa963('0x4f'))){_0xe0a6b1['limit']=qs[_0xa963('0x1d')](_0x1747db[_0xa963('0x30')][_0xa963('0x1d')]);_0xe0a6b1[_0xa963('0x1b')]=qs[_0xa963('0x1b')](_0x1747db[_0xa963('0x30')][_0xa963('0x1b')]);}return _0x521a0d[_0xa963('0x4c')](_0xe0a6b1);}})[_0xa963('0x23')](function(_0x30dbc9){if(_0x30dbc9){return _0x30dbc9?{'count':_0x194119,'rows':_0x30dbc9}:null;}})[_0xa963('0x23')](respondWithResult(_0x2b9744,null))['catch'](handleError(_0x2b9744,null));};exports[_0xa963('0x50')]=function(_0x5b2e5f,_0x5ee3bc,_0xa7f665){var _0x5b9af2={};var _0x147516={};var _0xb3d775;var _0xa47e30;return db['FreshsalesConfiguration'][_0xa963('0x4d')]({'where':{'id':_0x5b2e5f['params']['id']}})['then'](handleEntityNotFound(_0x5ee3bc,null))[_0xa963('0x23')](function(_0x5f0ce){if(_0x5f0ce){_0xb3d775=_0x5f0ce;_0x147516[_0xa963('0x34')]=_[_0xa963('0x31')](db[_0xa963('0x4e')][_0xa963('0x2b')]);_0x147516['query']=_[_0xa963('0x31')](_0x5b2e5f[_0xa963('0x30')]);_0x147516['filters']=_[_0xa963('0x33')](_0x147516[_0xa963('0x34')],_0x147516[_0xa963('0x30')]);_0x5b9af2['attributes']=_['intersection'](_0x147516[_0xa963('0x34')],qs[_0xa963('0x36')](_0x5b2e5f['query'][_0xa963('0x36')]));_0x5b9af2[_0xa963('0x35')]=_0x5b9af2['attributes']['length']?_0x5b9af2[_0xa963('0x35')]:_0x147516[_0xa963('0x34')];_0x5b9af2[_0xa963('0x38')]=qs[_0xa963('0x39')](_0x5b2e5f['query'][_0xa963('0x39')]);_0x5b9af2[_0xa963('0x3a')]=qs[_0xa963('0x32')](_[_0xa963('0x3b')](_0x5b2e5f[_0xa963('0x30')],_0x147516[_0xa963('0x32')]));if(_0x5b2e5f['query'][_0xa963('0x3c')]){_0x5b9af2['where']=_['merge'](_0x5b9af2[_0xa963('0x3a')],{'$or':_[_0xa963('0x2f')](_0x5b9af2[_0xa963('0x35')],function(_0x1efedd){var _0x2d8b82={};_0x2d8b82[_0x1efedd]={'$like':'%'+_0x5b2e5f['query'][_0xa963('0x3c')]+'%'};return _0x2d8b82;})});}_0x5b9af2=_[_0xa963('0x3d')]({},_0x5b9af2,_0x5b2e5f[_0xa963('0x3f')]);return _0xb3d775['getDescriptions'](_0x5b9af2);}})[_0xa963('0x23')](function(_0x5c5f53){if(_0x5c5f53){_0xa47e30=_0x5c5f53['length'];if(!_0x5b2e5f['query']['hasOwnProperty'](_0xa963('0x4f'))){_0x5b9af2[_0xa963('0x1d')]=qs[_0xa963('0x1d')](_0x5b2e5f[_0xa963('0x30')][_0xa963('0x1d')]);_0x5b9af2['offset']=qs['offset'](_0x5b2e5f[_0xa963('0x30')][_0xa963('0x1b')]);}return _0xb3d775['getDescriptions'](_0x5b9af2);}})[_0xa963('0x23')](function(_0xa2795b){if(_0xa2795b){return _0xa2795b?{'count':_0xa47e30,'rows':_0xa2795b}:null;}})[_0xa963('0x23')](respondWithResult(_0x5ee3bc,null))[_0xa963('0x44')](handleError(_0x5ee3bc,null));};exports[_0xa963('0x51')]=function(_0x5b7d82,_0x20a453,_0x25771c){var _0x134594={};var _0xe69fee={};var _0x298995;var _0x55f530;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x5b7d82['params']['id']}})[_0xa963('0x23')](handleEntityNotFound(_0x20a453,null))[_0xa963('0x23')](function(_0x51172b){if(_0x51172b){_0x298995=_0x51172b;_0xe69fee[_0xa963('0x34')]=_['keys'](db[_0xa963('0x4e')][_0xa963('0x2b')]);_0xe69fee['query']=_[_0xa963('0x31')](_0x5b7d82[_0xa963('0x30')]);_0xe69fee[_0xa963('0x32')]=_['intersection'](_0xe69fee[_0xa963('0x34')],_0xe69fee[_0xa963('0x30')]);_0x134594[_0xa963('0x35')]=_[_0xa963('0x33')](_0xe69fee[_0xa963('0x34')],qs['fields'](_0x5b7d82[_0xa963('0x30')]['fields']));_0x134594[_0xa963('0x35')]=_0x134594[_0xa963('0x35')][_0xa963('0x46')]?_0x134594[_0xa963('0x35')]:_0xe69fee[_0xa963('0x34')];_0x134594[_0xa963('0x38')]=qs[_0xa963('0x39')](_0x5b7d82[_0xa963('0x30')][_0xa963('0x39')]);_0x134594[_0xa963('0x3a')]=qs[_0xa963('0x32')](_[_0xa963('0x3b')](_0x5b7d82[_0xa963('0x30')],_0xe69fee['filters']));if(_0x5b7d82[_0xa963('0x30')]['filter']){_0x134594[_0xa963('0x3a')]=_[_0xa963('0x3d')](_0x134594['where'],{'$or':_[_0xa963('0x2f')](_0x134594['attributes'],function(_0x342c81){var _0x309296={};_0x309296[_0x342c81]={'$like':'%'+_0x5b7d82['query']['filter']+'%'};return _0x309296;})});}_0x134594=_[_0xa963('0x3d')]({},_0x134594,_0x5b7d82[_0xa963('0x3f')]);return _0x298995[_0xa963('0x51')](_0x134594);}})[_0xa963('0x23')](function(_0x472e91){if(_0x472e91){_0x55f530=_0x472e91[_0xa963('0x46')];if(!_0x5b7d82[_0xa963('0x30')][_0xa963('0x37')](_0xa963('0x4f'))){_0x134594[_0xa963('0x1d')]=qs['limit'](_0x5b7d82[_0xa963('0x30')][_0xa963('0x1d')]);_0x134594[_0xa963('0x1b')]=qs['offset'](_0x5b7d82[_0xa963('0x30')]['offset']);}return _0x298995[_0xa963('0x51')](_0x134594);}})[_0xa963('0x23')](function(_0x3936be){if(_0x3936be){return _0x3936be?{'count':_0x55f530,'rows':_0x3936be}:null;}})[_0xa963('0x23')](respondWithResult(_0x20a453,null))[_0xa963('0x44')](handleError(_0x20a453,null));}; \ No newline at end of file +var _0xa506=['filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','intersection','find','create','body','update','destroy','getSubjects','findOne','FreshsalesField','getDescriptions','hasOwnProperty','getFields','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','offset','undefined','count','status','set','Content-Range','json','save','then','end','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','keys','query','model','attributes','fields','length','nolimit','limit','order','sort'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xa506,0x1f3));var _0x6a50=function(_0x365d2c,_0x36187f){_0x365d2c=_0x365d2c-0x0;var _0x30e099=_0xa506[_0x365d2c];return _0x30e099;};'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(_0x6a50('0x0'));var moment=require(_0x6a50('0x1'));var BPromise=require(_0x6a50('0x2'));var Mustache=require(_0x6a50('0x3'));var util=require(_0x6a50('0x4'));var path=require(_0x6a50('0x5'));var sox=require(_0x6a50('0x6'));var csv=require(_0x6a50('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6a50('0x8'));var _=require(_0x6a50('0x9'));var squel=require(_0x6a50('0xa'));var crypto=require(_0x6a50('0xb'));var jsforce=require(_0x6a50('0xc'));var deskjs=require(_0x6a50('0xd'));var toCsv=require(_0x6a50('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6a50('0xe'));var authService=require(_0x6a50('0xf'));var qs=require(_0x6a50('0x10'));var as=require(_0x6a50('0x11'));var hardwareService=require(_0x6a50('0x12'));var logger=require('../../config/logger')(_0x6a50('0x13'));var utils=require(_0x6a50('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6a50('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c602e,_0x23572d){_0x23572d=_0x23572d||0xcc;return function(_0x22cdb3){if(_0x22cdb3){return _0x3c602e[_0x6a50('0x16')](_0x23572d);}return _0x3c602e['status'](_0x23572d)['end']();};}function respondWithResult(_0x5ada98,_0x169f7e){_0x169f7e=_0x169f7e||0xc8;return function(_0x266c14){if(_0x266c14){return _0x5ada98['status'](_0x169f7e)['json'](_0x266c14);}};}function respondWithFilteredResult(_0x10fabf,_0x2ccded){return function(_0x5e737e){if(_0x5e737e){var _0x29197f=typeof _0x2ccded[_0x6a50('0x17')]==='undefined'&&typeof _0x2ccded['limit']===_0x6a50('0x18');var _0x1294f7=_0x5e737e[_0x6a50('0x19')];var _0x646b93=_0x29197f?0x0:_0x2ccded['offset'];var _0x17da24=_0x29197f?_0x5e737e[_0x6a50('0x19')]:_0x2ccded[_0x6a50('0x17')]+_0x2ccded['limit'];var _0x578b52;if(_0x17da24>=_0x1294f7){_0x17da24=_0x1294f7;_0x578b52=0xc8;}else{_0x578b52=0xce;}_0x10fabf[_0x6a50('0x1a')](_0x578b52);return _0x10fabf[_0x6a50('0x1b')](_0x6a50('0x1c'),_0x646b93+'-'+_0x17da24+'/'+_0x1294f7)[_0x6a50('0x1d')](_0x5e737e);}return null;};}function patchUpdates(_0x257958){return function(_0x3c8319){try{jsonpatch['apply'](_0x3c8319,_0x257958,!![]);}catch(_0x14fe45){return BPromise['reject'](_0x14fe45);}return _0x3c8319[_0x6a50('0x1e')]();};}function saveUpdates(_0x4949d6,_0x1e7596){return function(_0xe2f4d4){if(_0xe2f4d4){return _0xe2f4d4['update'](_0x4949d6)[_0x6a50('0x1f')](function(_0x1b3660){return _0x1b3660;});}return null;};}function removeEntity(_0x3580c9,_0x123fb0){return function(_0x5ebc82){if(_0x5ebc82){return _0x5ebc82['destroy']()[_0x6a50('0x1f')](function(){_0x3580c9[_0x6a50('0x1a')](0xcc)[_0x6a50('0x20')]();});}};}function handleEntityNotFound(_0xcd0a0d,_0x1ecdca){return function(_0x888286){if(!_0x888286){_0xcd0a0d[_0x6a50('0x16')](0x194);}return _0x888286;};}function handleError(_0x9d428f,_0x3b6415){_0x3b6415=_0x3b6415||0x1f4;return function(_0x4377c4){logger[_0x6a50('0x21')](_0x4377c4[_0x6a50('0x22')]);if(_0x4377c4['name']){delete _0x4377c4[_0x6a50('0x23')];}_0x9d428f[_0x6a50('0x1a')](_0x3b6415)[_0x6a50('0x24')](_0x4377c4);};}exports[_0x6a50('0x25')]=function(_0x4fa585,_0x2da7d2){var _0x4e8eae={},_0xce3702={},_0x145e47={'count':0x0,'rows':[]};var _0x453be9=_[_0x6a50('0x26')](db[_0x6a50('0x27')][_0x6a50('0x28')],function(_0x232537){return{'name':_0x232537[_0x6a50('0x29')],'type':_0x232537[_0x6a50('0x2a')][_0x6a50('0x2b')]};});_0xce3702['model']=_[_0x6a50('0x26')](_0x453be9,_0x6a50('0x23'));_0xce3702['query']=_[_0x6a50('0x2c')](_0x4fa585[_0x6a50('0x2d')]);_0xce3702['filters']=_['intersection'](_0xce3702[_0x6a50('0x2e')],_0xce3702[_0x6a50('0x2d')]);_0x4e8eae[_0x6a50('0x2f')]=_['intersection'](_0xce3702['model'],qs[_0x6a50('0x30')](_0x4fa585[_0x6a50('0x2d')][_0x6a50('0x30')]));_0x4e8eae[_0x6a50('0x2f')]=_0x4e8eae[_0x6a50('0x2f')][_0x6a50('0x31')]?_0x4e8eae[_0x6a50('0x2f')]:_0xce3702[_0x6a50('0x2e')];if(!_0x4fa585['query']['hasOwnProperty'](_0x6a50('0x32'))){_0x4e8eae[_0x6a50('0x33')]=qs['limit'](_0x4fa585['query'][_0x6a50('0x33')]);_0x4e8eae[_0x6a50('0x17')]=qs[_0x6a50('0x17')](_0x4fa585[_0x6a50('0x2d')][_0x6a50('0x17')]);}_0x4e8eae[_0x6a50('0x34')]=qs[_0x6a50('0x35')](_0x4fa585['query'][_0x6a50('0x35')]);_0x4e8eae['where']=qs[_0x6a50('0x36')](_[_0x6a50('0x37')](_0x4fa585[_0x6a50('0x2d')],_0xce3702[_0x6a50('0x36')]),_0x453be9);if(_0x4fa585[_0x6a50('0x2d')][_0x6a50('0x38')]){_0x4e8eae[_0x6a50('0x39')]=_[_0x6a50('0x3a')](_0x4e8eae[_0x6a50('0x39')],{'$or':_['map'](_0x453be9,function(_0x52af6f){if(_0x52af6f[_0x6a50('0x2a')]!==_0x6a50('0x3b')){var _0x34cfbe={};_0x34cfbe[_0x52af6f[_0x6a50('0x23')]]={'$like':'%'+_0x4fa585['query'][_0x6a50('0x38')]+'%'};return _0x34cfbe;}})});}_0x4e8eae=_['merge']({},_0x4e8eae,_0x4fa585[_0x6a50('0x3c')]);var _0x1aced7={'where':_0x4e8eae[_0x6a50('0x39')]};return db[_0x6a50('0x27')][_0x6a50('0x19')](_0x1aced7)[_0x6a50('0x1f')](function(_0x42a735){_0x145e47[_0x6a50('0x19')]=_0x42a735;if(_0x4fa585[_0x6a50('0x2d')][_0x6a50('0x3d')]){_0x4e8eae[_0x6a50('0x3e')]=[{'all':!![]}];}return db[_0x6a50('0x27')]['findAll'](_0x4e8eae);})[_0x6a50('0x1f')](function(_0xf3c412){_0x145e47[_0x6a50('0x3f')]=_0xf3c412;return _0x145e47;})['then'](respondWithFilteredResult(_0x2da7d2,_0x4e8eae))[_0x6a50('0x40')](handleError(_0x2da7d2,null));};exports[_0x6a50('0x41')]=function(_0x3e2a01,_0x53de58){var _0x284be3={'raw':![],'where':{'id':_0x3e2a01[_0x6a50('0x42')]['id']}},_0xeaf85f={};_0xeaf85f[_0x6a50('0x2e')]=_[_0x6a50('0x2c')](db[_0x6a50('0x27')][_0x6a50('0x28')]);_0xeaf85f[_0x6a50('0x2d')]=_[_0x6a50('0x2c')](_0x3e2a01[_0x6a50('0x2d')]);_0xeaf85f[_0x6a50('0x36')]=_[_0x6a50('0x43')](_0xeaf85f[_0x6a50('0x2e')],_0xeaf85f[_0x6a50('0x2d')]);_0x284be3[_0x6a50('0x2f')]=_['intersection'](_0xeaf85f[_0x6a50('0x2e')],qs['fields'](_0x3e2a01[_0x6a50('0x2d')][_0x6a50('0x30')]));_0x284be3['attributes']=_0x284be3['attributes'][_0x6a50('0x31')]?_0x284be3[_0x6a50('0x2f')]:_0xeaf85f[_0x6a50('0x2e')];if(_0x3e2a01[_0x6a50('0x2d')][_0x6a50('0x3d')]){_0x284be3[_0x6a50('0x3e')]=[{'all':!![]}];}_0x284be3=_[_0x6a50('0x3a')]({},_0x284be3,_0x3e2a01[_0x6a50('0x3c')]);return db[_0x6a50('0x27')][_0x6a50('0x44')](_0x284be3)[_0x6a50('0x1f')](handleEntityNotFound(_0x53de58,null))[_0x6a50('0x1f')](respondWithResult(_0x53de58,null))[_0x6a50('0x40')](handleError(_0x53de58,null));};exports[_0x6a50('0x45')]=function(_0x55b930,_0x33a031){return db[_0x6a50('0x27')][_0x6a50('0x45')](_0x55b930[_0x6a50('0x46')],{})['then'](respondWithResult(_0x33a031,0xc9))[_0x6a50('0x40')](handleError(_0x33a031,null));};exports[_0x6a50('0x47')]=function(_0xde3a8,_0x264679){if(_0xde3a8['body']['id']){delete _0xde3a8['body']['id'];}return db[_0x6a50('0x27')][_0x6a50('0x44')]({'where':{'id':_0xde3a8[_0x6a50('0x42')]['id']}})[_0x6a50('0x1f')](handleEntityNotFound(_0x264679,null))['then'](saveUpdates(_0xde3a8['body'],null))[_0x6a50('0x1f')](respondWithResult(_0x264679,null))[_0x6a50('0x40')](handleError(_0x264679,null));};exports[_0x6a50('0x48')]=function(_0x5e6f7e,_0x32f30a){return db[_0x6a50('0x27')][_0x6a50('0x44')]({'where':{'id':_0x5e6f7e['params']['id']}})[_0x6a50('0x1f')](handleEntityNotFound(_0x32f30a,null))[_0x6a50('0x1f')](removeEntity(_0x32f30a,null))[_0x6a50('0x40')](handleError(_0x32f30a,null));};exports[_0x6a50('0x49')]=function(_0x150f0e,_0x5b9956,_0x4cd3b7){var _0x343440={};var _0x592dd6={};var _0x52ba32;var _0x1edc9c;return db[_0x6a50('0x27')][_0x6a50('0x4a')]({'where':{'id':_0x150f0e[_0x6a50('0x42')]['id']}})[_0x6a50('0x1f')](handleEntityNotFound(_0x5b9956,null))['then'](function(_0x1ee27a){if(_0x1ee27a){_0x52ba32=_0x1ee27a;_0x592dd6[_0x6a50('0x2e')]=_[_0x6a50('0x2c')](db[_0x6a50('0x4b')][_0x6a50('0x28')]);_0x592dd6[_0x6a50('0x2d')]=_[_0x6a50('0x2c')](_0x150f0e[_0x6a50('0x2d')]);_0x592dd6[_0x6a50('0x36')]=_['intersection'](_0x592dd6[_0x6a50('0x2e')],_0x592dd6['query']);_0x343440['attributes']=_[_0x6a50('0x43')](_0x592dd6[_0x6a50('0x2e')],qs['fields'](_0x150f0e[_0x6a50('0x2d')][_0x6a50('0x30')]));_0x343440[_0x6a50('0x2f')]=_0x343440[_0x6a50('0x2f')]['length']?_0x343440['attributes']:_0x592dd6[_0x6a50('0x2e')];_0x343440[_0x6a50('0x34')]=qs[_0x6a50('0x35')](_0x150f0e[_0x6a50('0x2d')][_0x6a50('0x35')]);_0x343440[_0x6a50('0x39')]=qs[_0x6a50('0x36')](_[_0x6a50('0x37')](_0x150f0e[_0x6a50('0x2d')],_0x592dd6[_0x6a50('0x36')]));if(_0x150f0e['query']['filter']){_0x343440[_0x6a50('0x39')]=_['merge'](_0x343440[_0x6a50('0x39')],{'$or':_[_0x6a50('0x26')](_0x343440['attributes'],function(_0x590d12){var _0x5b0b17={};_0x5b0b17[_0x590d12]={'$like':'%'+_0x150f0e[_0x6a50('0x2d')][_0x6a50('0x38')]+'%'};return _0x5b0b17;})});}_0x343440=_[_0x6a50('0x3a')]({},_0x343440,_0x150f0e[_0x6a50('0x3c')]);return _0x52ba32[_0x6a50('0x49')](_0x343440);}})['then'](function(_0x39ada3){if(_0x39ada3){_0x1edc9c=_0x39ada3['length'];if(!_0x150f0e['query']['hasOwnProperty']('nolimit')){_0x343440['limit']=qs[_0x6a50('0x33')](_0x150f0e[_0x6a50('0x2d')][_0x6a50('0x33')]);_0x343440['offset']=qs[_0x6a50('0x17')](_0x150f0e[_0x6a50('0x2d')]['offset']);}return _0x52ba32[_0x6a50('0x49')](_0x343440);}})[_0x6a50('0x1f')](function(_0xcc2f0){if(_0xcc2f0){return _0xcc2f0?{'count':_0x1edc9c,'rows':_0xcc2f0}:null;}})[_0x6a50('0x1f')](respondWithResult(_0x5b9956,null))[_0x6a50('0x40')](handleError(_0x5b9956,null));};exports[_0x6a50('0x4c')]=function(_0x2d7f2a,_0x10e4ce,_0x44d3fa){var _0x2990cf={};var _0x2a7b85={};var _0x262576;var _0x328a4a;return db[_0x6a50('0x27')]['findOne']({'where':{'id':_0x2d7f2a[_0x6a50('0x42')]['id']}})[_0x6a50('0x1f')](handleEntityNotFound(_0x10e4ce,null))['then'](function(_0x29c2d8){if(_0x29c2d8){_0x262576=_0x29c2d8;_0x2a7b85[_0x6a50('0x2e')]=_[_0x6a50('0x2c')](db[_0x6a50('0x4b')][_0x6a50('0x28')]);_0x2a7b85[_0x6a50('0x2d')]=_[_0x6a50('0x2c')](_0x2d7f2a['query']);_0x2a7b85[_0x6a50('0x36')]=_[_0x6a50('0x43')](_0x2a7b85[_0x6a50('0x2e')],_0x2a7b85['query']);_0x2990cf[_0x6a50('0x2f')]=_[_0x6a50('0x43')](_0x2a7b85['model'],qs[_0x6a50('0x30')](_0x2d7f2a[_0x6a50('0x2d')]['fields']));_0x2990cf[_0x6a50('0x2f')]=_0x2990cf[_0x6a50('0x2f')][_0x6a50('0x31')]?_0x2990cf['attributes']:_0x2a7b85[_0x6a50('0x2e')];_0x2990cf[_0x6a50('0x34')]=qs['sort'](_0x2d7f2a[_0x6a50('0x2d')][_0x6a50('0x35')]);_0x2990cf[_0x6a50('0x39')]=qs[_0x6a50('0x36')](_[_0x6a50('0x37')](_0x2d7f2a[_0x6a50('0x2d')],_0x2a7b85['filters']));if(_0x2d7f2a[_0x6a50('0x2d')]['filter']){_0x2990cf[_0x6a50('0x39')]=_[_0x6a50('0x3a')](_0x2990cf[_0x6a50('0x39')],{'$or':_[_0x6a50('0x26')](_0x2990cf[_0x6a50('0x2f')],function(_0x52c3a2){var _0x187461={};_0x187461[_0x52c3a2]={'$like':'%'+_0x2d7f2a['query'][_0x6a50('0x38')]+'%'};return _0x187461;})});}_0x2990cf=_[_0x6a50('0x3a')]({},_0x2990cf,_0x2d7f2a[_0x6a50('0x3c')]);return _0x262576[_0x6a50('0x4c')](_0x2990cf);}})['then'](function(_0x3ea7f4){if(_0x3ea7f4){_0x328a4a=_0x3ea7f4[_0x6a50('0x31')];if(!_0x2d7f2a[_0x6a50('0x2d')][_0x6a50('0x4d')]('nolimit')){_0x2990cf[_0x6a50('0x33')]=qs[_0x6a50('0x33')](_0x2d7f2a[_0x6a50('0x2d')][_0x6a50('0x33')]);_0x2990cf[_0x6a50('0x17')]=qs[_0x6a50('0x17')](_0x2d7f2a[_0x6a50('0x2d')][_0x6a50('0x17')]);}return _0x262576[_0x6a50('0x4c')](_0x2990cf);}})[_0x6a50('0x1f')](function(_0x41b3b3){if(_0x41b3b3){return _0x41b3b3?{'count':_0x328a4a,'rows':_0x41b3b3}:null;}})['then'](respondWithResult(_0x10e4ce,null))[_0x6a50('0x40')](handleError(_0x10e4ce,null));};exports[_0x6a50('0x4e')]=function(_0x1f4774,_0x564351,_0x44155b){var _0x506a37={};var _0x4e36d9={};var _0x3aaa84;var _0x3e2b17;return db[_0x6a50('0x27')][_0x6a50('0x4a')]({'where':{'id':_0x1f4774[_0x6a50('0x42')]['id']}})[_0x6a50('0x1f')](handleEntityNotFound(_0x564351,null))['then'](function(_0x8395bd){if(_0x8395bd){_0x3aaa84=_0x8395bd;_0x4e36d9['model']=_['keys'](db['FreshsalesField'][_0x6a50('0x28')]);_0x4e36d9[_0x6a50('0x2d')]=_[_0x6a50('0x2c')](_0x1f4774[_0x6a50('0x2d')]);_0x4e36d9[_0x6a50('0x36')]=_['intersection'](_0x4e36d9[_0x6a50('0x2e')],_0x4e36d9[_0x6a50('0x2d')]);_0x506a37['attributes']=_['intersection'](_0x4e36d9['model'],qs[_0x6a50('0x30')](_0x1f4774[_0x6a50('0x2d')][_0x6a50('0x30')]));_0x506a37[_0x6a50('0x2f')]=_0x506a37['attributes'][_0x6a50('0x31')]?_0x506a37[_0x6a50('0x2f')]:_0x4e36d9[_0x6a50('0x2e')];_0x506a37[_0x6a50('0x34')]=qs['sort'](_0x1f4774['query']['sort']);_0x506a37[_0x6a50('0x39')]=qs[_0x6a50('0x36')](_['pick'](_0x1f4774[_0x6a50('0x2d')],_0x4e36d9[_0x6a50('0x36')]));if(_0x1f4774[_0x6a50('0x2d')]['filter']){_0x506a37['where']=_[_0x6a50('0x3a')](_0x506a37[_0x6a50('0x39')],{'$or':_['map'](_0x506a37[_0x6a50('0x2f')],function(_0x282acb){var _0x57ca92={};_0x57ca92[_0x282acb]={'$like':'%'+_0x1f4774[_0x6a50('0x2d')][_0x6a50('0x38')]+'%'};return _0x57ca92;})});}_0x506a37=_['merge']({},_0x506a37,_0x1f4774[_0x6a50('0x3c')]);return _0x3aaa84[_0x6a50('0x4e')](_0x506a37);}})['then'](function(_0x4211e9){if(_0x4211e9){_0x3e2b17=_0x4211e9[_0x6a50('0x31')];if(!_0x1f4774[_0x6a50('0x2d')][_0x6a50('0x4d')](_0x6a50('0x32'))){_0x506a37[_0x6a50('0x33')]=qs['limit'](_0x1f4774[_0x6a50('0x2d')]['limit']);_0x506a37[_0x6a50('0x17')]=qs[_0x6a50('0x17')](_0x1f4774[_0x6a50('0x2d')][_0x6a50('0x17')]);}return _0x3aaa84[_0x6a50('0x4e')](_0x506a37);}})[_0x6a50('0x1f')](function(_0x1ee716){if(_0x1ee716){return _0x1ee716?{'count':_0x3e2b17,'rows':_0x1ee716}:null;}})[_0x6a50('0x1f')](respondWithResult(_0x564351,null))[_0x6a50('0x40')](handleError(_0x564351,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 9f63673..089b4ee 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 _0x0214=['rimraf','../../config/environment','exports','define','lodash','util','api','moment','bluebird','path'];(function(_0x3093fe,_0x5a0cff){var _0x31517d=function(_0x4a6eba){while(--_0x4a6eba){_0x3093fe['push'](_0x3093fe['shift']());}};_0x31517d(++_0x5a0cff);}(_0x0214,0x144));var _0x4021=function(_0x5223bf,_0x109da4){_0x5223bf=_0x5223bf-0x0;var _0x181da4=_0x0214[_0x5223bf];return _0x181da4;};'use strict';var _=require(_0x4021('0x0'));var util=require(_0x4021('0x1'));var logger=require('../../config/logger')(_0x4021('0x2'));var moment=require(_0x4021('0x3'));var BPromise=require(_0x4021('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4021('0x5'));var rimraf=require(_0x4021('0x6'));var config=require(_0x4021('0x7'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x4021('0x8')]=function(_0x438dc5,_0x49719d){return _0x438dc5[_0x4021('0x9')]('FreshsalesConfiguration',attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x94c0=['define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./intFreshsalesConfiguration.attributes','exports'];(function(_0x153393,_0x47a58d){var _0x7bf913=function(_0x327dcf){while(--_0x327dcf){_0x153393['push'](_0x153393['shift']());}};_0x7bf913(++_0x47a58d);}(_0x94c0,0x162));var _0x094c=function(_0x282530,_0x5a31b2){_0x282530=_0x282530-0x0;var _0x266c57=_0x94c0[_0x282530];return _0x266c57;};'use strict';var _=require(_0x094c('0x0'));var util=require(_0x094c('0x1'));var logger=require(_0x094c('0x2'))(_0x094c('0x3'));var moment=require(_0x094c('0x4'));var BPromise=require('bluebird');var rp=require(_0x094c('0x5'));var fs=require('fs');var path=require(_0x094c('0x6'));var rimraf=require(_0x094c('0x7'));var config=require('../../config/environment');var attributes=require(_0x094c('0x8'));module[_0x094c('0x9')]=function(_0x1f55e7,_0x187d3e){return _0x1f55e7[_0x094c('0xa')](_0x094c('0xb'),attributes,{'tableName':_0x094c('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 99bf67a..d10b34a 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 _0x31ba=['http','request','info','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','FreshsalesConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','ioredis','rpc','client'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x31ba,0x9a));var _0xa31b=function(_0x55f122,_0x56edaf){_0x55f122=_0x55f122-0x0;var _0x1a28d6=_0x31ba[_0x55f122];return _0x1a28d6;};'use strict';var _=require(_0xa31b('0x0'));var util=require(_0xa31b('0x1'));var moment=require(_0xa31b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa31b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa31b('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa31b('0x5')][_0xa31b('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4a69e3,_0x4154bd,_0x24c2da){return new BPromise(function(_0x24102e,_0x43f346){return client[_0xa31b('0x7')](_0x4a69e3,_0x24c2da)['then'](function(_0x181de5){logger[_0xa31b('0x8')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4154bd,'request\x20sent');logger[_0xa31b('0x9')](_0xa31b('0xa'),_0x4154bd,_0xa31b('0xb'),JSON['stringify'](_0x181de5));if(_0x181de5[_0xa31b('0xc')]){if(_0x181de5[_0xa31b('0xc')]['code']===0x1f4){logger[_0xa31b('0xc')](_0xa31b('0xd'),_0x4154bd,_0x181de5[_0xa31b('0xc')][_0xa31b('0xe')]);return _0x43f346(_0x181de5['error'][_0xa31b('0xe')]);}logger[_0xa31b('0xc')](_0xa31b('0xd'),_0x4154bd,_0x181de5[_0xa31b('0xc')][_0xa31b('0xe')]);return _0x24102e(_0x181de5[_0xa31b('0xc')][_0xa31b('0xe')]);}else{logger[_0xa31b('0x8')](_0xa31b('0xd'),_0x4154bd,'request\x20sent');_0x24102e(_0x181de5[_0xa31b('0xf')][_0xa31b('0xe')]);}})['catch'](function(_0x3e9aa3){logger[_0xa31b('0xc')](_0xa31b('0xd'),_0x4154bd,_0x3e9aa3);_0x43f346(_0x3e9aa3);});});} \ No newline at end of file +var _0x3098=['stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x516e37,_0x311238){var _0x4dbaa8=function(_0x1b427f){while(--_0x1b427f){_0x516e37['push'](_0x516e37['shift']());}};_0x4dbaa8(++_0x311238);}(_0x3098,0x191));var _0x8309=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x3098[_0x24237f];return _0x48298e;};'use strict';var _=require(_0x8309('0x0'));var util=require(_0x8309('0x1'));var moment=require('moment');var BPromise=require(_0x8309('0x2'));var rs=require(_0x8309('0x3'));var fs=require('fs');var Redis=require(_0x8309('0x4'));var db=require(_0x8309('0x5'))['db'];var utils=require(_0x8309('0x6'));var logger=require(_0x8309('0x7'))(_0x8309('0x8'));var config=require(_0x8309('0x9'));var jayson=require(_0x8309('0xa'));var client=jayson['client'][_0x8309('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x505c3e,_0x5ecbe8,_0x13d190){return new BPromise(function(_0x3edc16,_0x122492){return client['request'](_0x505c3e,_0x13d190)['then'](function(_0x1b600a){logger[_0x8309('0xc')](_0x8309('0xd'),_0x5ecbe8,_0x8309('0xe'));logger[_0x8309('0xf')](_0x8309('0x10'),_0x5ecbe8,_0x8309('0xe'),JSON[_0x8309('0x11')](_0x1b600a));if(_0x1b600a[_0x8309('0x12')]){if(_0x1b600a[_0x8309('0x12')][_0x8309('0x13')]===0x1f4){logger[_0x8309('0x12')](_0x8309('0xd'),_0x5ecbe8,_0x1b600a[_0x8309('0x12')][_0x8309('0x14')]);return _0x122492(_0x1b600a['error'][_0x8309('0x14')]);}logger['error'](_0x8309('0xd'),_0x5ecbe8,_0x1b600a[_0x8309('0x12')][_0x8309('0x14')]);return _0x3edc16(_0x1b600a[_0x8309('0x12')][_0x8309('0x14')]);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x5ecbe8,_0x8309('0xe'));_0x3edc16(_0x1b600a[_0x8309('0x15')][_0x8309('0x14')]);}})['catch'](function(_0x7a3ba3){logger[_0x8309('0x12')](_0x8309('0xd'),_0x5ecbe8,_0x7a3ba3);_0x122492(_0x7a3ba3);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index d2ebbd9..ee3604d 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 _0x2bdb=['../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','path','express','Router','fs-extra'];(function(_0x2188de,_0x20febe){var _0x39500c=function(_0x594a35){while(--_0x594a35){_0x2188de['push'](_0x2188de['shift']());}};_0x39500c(++_0x20febe);}(_0x2bdb,0x105));var _0xb2bd=function(_0x507ba1,_0x57b3c1){_0x507ba1=_0x507ba1-0x0;var _0x5ab818=_0x2bdb[_0x507ba1];return _0x5ab818;};'use strict';var multer=require(_0xb2bd('0x0'));var util=require('util');var path=require(_0xb2bd('0x1'));var timeout=require('connect-timeout');var express=require(_0xb2bd('0x2'));var router=express[_0xb2bd('0x3')]();var fs_extra=require(_0xb2bd('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb2bd('0x5'));var config=require(_0xb2bd('0x6'));var controller=require(_0xb2bd('0x7'));router[_0xb2bd('0x8')]('/',auth[_0xb2bd('0x9')](),controller[_0xb2bd('0xa')]);router[_0xb2bd('0x8')]('/:id',auth[_0xb2bd('0x9')](),controller['show']);router[_0xb2bd('0xb')]('/',auth[_0xb2bd('0x9')](),controller[_0xb2bd('0xc')]);router[_0xb2bd('0xd')](_0xb2bd('0xe'),auth[_0xb2bd('0x9')](),controller[_0xb2bd('0xf')]);router[_0xb2bd('0x10')](_0xb2bd('0xe'),auth['isAuthenticated'](),controller[_0xb2bd('0x11')]);module[_0xb2bd('0x12')]=router; \ No newline at end of file +var _0x8a9c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete'];(function(_0x177bc3,_0x153644){var _0x1cc29d=function(_0x5e230f){while(--_0x5e230f){_0x177bc3['push'](_0x177bc3['shift']());}};_0x1cc29d(++_0x153644);}(_0x8a9c,0x12d));var _0xc8a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a9c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc8a9('0x0'));var util=require(_0xc8a9('0x1'));var path=require(_0xc8a9('0x2'));var timeout=require(_0xc8a9('0x3'));var express=require(_0xc8a9('0x4'));var router=express['Router']();var fs_extra=require(_0xc8a9('0x5'));var auth=require(_0xc8a9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc8a9('0x7'));var controller=require(_0xc8a9('0x8'));router[_0xc8a9('0x9')]('/',auth['isAuthenticated'](),controller[_0xc8a9('0xa')]);router[_0xc8a9('0x9')](_0xc8a9('0xb'),auth[_0xc8a9('0xc')](),controller[_0xc8a9('0xd')]);router[_0xc8a9('0xe')]('/',auth[_0xc8a9('0xc')](),controller[_0xc8a9('0xf')]);router[_0xc8a9('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xc8a9('0x11')]);router[_0xc8a9('0x12')]('/:id',auth[_0xc8a9('0xc')](),controller['destroy']);module[_0xc8a9('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 9968d43..833c36e 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 _0x64a9=['BOOLEAN','sequelize','ENUM','variable','customVariable','string','STRING'];(function(_0x6b1743,_0x1aede4){var _0x8e5295=function(_0x3f4fcf){while(--_0x3f4fcf){_0x6b1743['push'](_0x6b1743['shift']());}};_0x8e5295(++_0x1aede4);}(_0x64a9,0x7f));var _0x964a=function(_0x1f2748,_0x1ffe79){_0x1f2748=_0x1f2748-0x0;var _0x3e9ccf=_0x64a9[_0x1f2748];return _0x3e9ccf;};'use strict';var Sequelize=require(_0x964a('0x0'));module['exports']={'type':{'type':Sequelize[_0x964a('0x1')]('string',_0x964a('0x2'),_0x964a('0x3'),'keyValue','picklist'),'defaultValue':_0x964a('0x4')},'content':{'type':Sequelize[_0x964a('0x5')]},'key':{'type':Sequelize[_0x964a('0x5')]},'keyType':{'type':Sequelize[_0x964a('0x1')](_0x964a('0x4'),_0x964a('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x964a('0x5')]},'idField':{'type':Sequelize[_0x964a('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x964a('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x964a('0x5')]}}; \ No newline at end of file +var _0xbdf0=['variable','keyValue','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xbdf0,0xc1));var _0x0bdf=function(_0xbb02a6,_0x2b3f2c){_0xbb02a6=_0xbb02a6-0x0;var _0x4d7739=_0xbdf0[_0xbb02a6];return _0x4d7739;};'use strict';var Sequelize=require(_0x0bdf('0x0'));module['exports']={'type':{'type':Sequelize[_0x0bdf('0x1')](_0x0bdf('0x2'),_0x0bdf('0x3'),'customVariable',_0x0bdf('0x4'),'picklist'),'defaultValue':_0x0bdf('0x2')},'content':{'type':Sequelize[_0x0bdf('0x5')]},'key':{'type':Sequelize[_0x0bdf('0x5')]},'keyType':{'type':Sequelize[_0x0bdf('0x1')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x0bdf('0x5')]},'idField':{'type':Sequelize[_0x0bdf('0x5')]},'nameField':{'type':Sequelize[_0x0bdf('0x5')]},'customField':{'type':Sequelize[_0x0bdf('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0bdf('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 1f8feaa..70f4e02 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 _0x534d=['offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','index','FreshsalesField','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','body','catch','find','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x1dfe96,_0xacd7bf){var _0x23bb8a=function(_0x2f9f1a){while(--_0x2f9f1a){_0x1dfe96['push'](_0x1dfe96['shift']());}};_0x23bb8a(++_0xacd7bf);}(_0x534d,0x115));var _0xd534=function(_0x5aa564,_0x1d2d2e){_0x5aa564=_0x5aa564-0x0;var _0x50fb7c=_0x534d[_0x5aa564];return _0x50fb7c;};'use strict';var emlformat=require(_0xd534('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd534('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd534('0x2'));var moment=require(_0xd534('0x3'));var BPromise=require(_0xd534('0x4'));var Mustache=require(_0xd534('0x5'));var util=require(_0xd534('0x6'));var path=require(_0xd534('0x7'));var sox=require(_0xd534('0x8'));var csv=require('to-csv');var ejs=require(_0xd534('0x9'));var fs=require('fs');var fs_extra=require(_0xd534('0xa'));var _=require(_0xd534('0xb'));var squel=require(_0xd534('0xc'));var crypto=require(_0xd534('0xd'));var jsforce=require(_0xd534('0xe'));var deskjs=require(_0xd534('0xf'));var toCsv=require(_0xd534('0x10'));var querystring=require(_0xd534('0x11'));var Papa=require(_0xd534('0x12'));var Redis=require(_0xd534('0x13'));var authService=require(_0xd534('0x14'));var qs=require(_0xd534('0x15'));var as=require(_0xd534('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd534('0x17'))(_0xd534('0x18'));var utils=require(_0xd534('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xd534('0x1a'));var db=require(_0xd534('0x1b'))['db'];function respondWithStatusCode(_0x50a891,_0x56a972){_0x56a972=_0x56a972||0xcc;return function(_0x2a6a34){if(_0x2a6a34){return _0x50a891[_0xd534('0x1c')](_0x56a972);}return _0x50a891[_0xd534('0x1d')](_0x56a972)['end']();};}function respondWithResult(_0x1e5975,_0xbbf37d){_0xbbf37d=_0xbbf37d||0xc8;return function(_0x2ea306){if(_0x2ea306){return _0x1e5975[_0xd534('0x1d')](_0xbbf37d)[_0xd534('0x1e')](_0x2ea306);}};}function respondWithFilteredResult(_0x41a5e8,_0x18a069){return function(_0x3086b8){if(_0x3086b8){var _0x2430ac=typeof _0x18a069[_0xd534('0x1f')]===_0xd534('0x20')&&typeof _0x18a069[_0xd534('0x21')]===_0xd534('0x20');var _0x2320c4=_0x3086b8['count'];var _0x2cc699=_0x2430ac?0x0:_0x18a069[_0xd534('0x1f')];var _0xfe3dfd=_0x2430ac?_0x3086b8[_0xd534('0x22')]:_0x18a069['offset']+_0x18a069[_0xd534('0x21')];var _0x2926d5;if(_0xfe3dfd>=_0x2320c4){_0xfe3dfd=_0x2320c4;_0x2926d5=0xc8;}else{_0x2926d5=0xce;}_0x41a5e8['status'](_0x2926d5);return _0x41a5e8[_0xd534('0x23')](_0xd534('0x24'),_0x2cc699+'-'+_0xfe3dfd+'/'+_0x2320c4)[_0xd534('0x1e')](_0x3086b8);}return null;};}function patchUpdates(_0x6ce7cd){return function(_0x22443f){try{jsonpatch[_0xd534('0x25')](_0x22443f,_0x6ce7cd,!![]);}catch(_0x23fff2){return BPromise['reject'](_0x23fff2);}return _0x22443f['save']();};}function saveUpdates(_0x39d519,_0x1dfa0f){return function(_0x4488c5){if(_0x4488c5){return _0x4488c5[_0xd534('0x26')](_0x39d519)[_0xd534('0x27')](function(_0x295f4a){return _0x295f4a;});}return null;};}function removeEntity(_0x276ea5,_0x104009){return function(_0x2da2df){if(_0x2da2df){return _0x2da2df[_0xd534('0x28')]()['then'](function(){_0x276ea5[_0xd534('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x320953,_0x4c1fb5){return function(_0x1ba12c){if(!_0x1ba12c){_0x320953['sendStatus'](0x194);}return _0x1ba12c;};}function handleError(_0x23121f,_0x2c10fa){_0x2c10fa=_0x2c10fa||0x1f4;return function(_0x14690c){logger[_0xd534('0x29')](_0x14690c[_0xd534('0x2a')]);if(_0x14690c[_0xd534('0x2b')]){delete _0x14690c[_0xd534('0x2b')];}_0x23121f['status'](_0x2c10fa)['send'](_0x14690c);};}exports[_0xd534('0x2c')]=function(_0x5ec7ef,_0x318efb){var _0x116b5e={},_0x2ee99b={},_0x40a4f1={'count':0x0,'rows':[]};var _0xe4b5b0=_['map'](db[_0xd534('0x2d')][_0xd534('0x2e')],function(_0x3b5d4f){return{'name':_0x3b5d4f[_0xd534('0x2f')],'type':_0x3b5d4f[_0xd534('0x30')][_0xd534('0x31')]};});_0x2ee99b[_0xd534('0x32')]=_[_0xd534('0x33')](_0xe4b5b0,_0xd534('0x2b'));_0x2ee99b[_0xd534('0x34')]=_[_0xd534('0x35')](_0x5ec7ef['query']);_0x2ee99b['filters']=_['intersection'](_0x2ee99b[_0xd534('0x32')],_0x2ee99b[_0xd534('0x34')]);_0x116b5e[_0xd534('0x36')]=_[_0xd534('0x37')](_0x2ee99b['model'],qs[_0xd534('0x38')](_0x5ec7ef[_0xd534('0x34')][_0xd534('0x38')]));_0x116b5e[_0xd534('0x36')]=_0x116b5e['attributes'][_0xd534('0x39')]?_0x116b5e[_0xd534('0x36')]:_0x2ee99b['model'];if(!_0x5ec7ef[_0xd534('0x34')][_0xd534('0x3a')]('nolimit')){_0x116b5e[_0xd534('0x21')]=qs['limit'](_0x5ec7ef[_0xd534('0x34')][_0xd534('0x21')]);_0x116b5e['offset']=qs[_0xd534('0x1f')](_0x5ec7ef[_0xd534('0x34')][_0xd534('0x1f')]);}_0x116b5e['order']=qs['sort'](_0x5ec7ef[_0xd534('0x34')][_0xd534('0x3b')]);_0x116b5e[_0xd534('0x3c')]=qs['filters'](_[_0xd534('0x3d')](_0x5ec7ef[_0xd534('0x34')],_0x2ee99b[_0xd534('0x3e')]),_0xe4b5b0);if(_0x5ec7ef[_0xd534('0x34')][_0xd534('0x3f')]){_0x116b5e[_0xd534('0x3c')]=_[_0xd534('0x40')](_0x116b5e[_0xd534('0x3c')],{'$or':_['map'](_0xe4b5b0,function(_0x6e264){if(_0x6e264[_0xd534('0x30')]!==_0xd534('0x41')){var _0x43ffac={};_0x43ffac[_0x6e264[_0xd534('0x2b')]]={'$like':'%'+_0x5ec7ef[_0xd534('0x34')][_0xd534('0x3f')]+'%'};return _0x43ffac;}})});}_0x116b5e=_[_0xd534('0x40')]({},_0x116b5e,_0x5ec7ef[_0xd534('0x42')]);var _0x557aa7={'where':_0x116b5e[_0xd534('0x3c')]};return db['FreshsalesField'][_0xd534('0x22')](_0x557aa7)[_0xd534('0x27')](function(_0x384863){_0x40a4f1[_0xd534('0x22')]=_0x384863;if(_0x5ec7ef['query'][_0xd534('0x43')]){_0x116b5e[_0xd534('0x44')]=[{'all':!![]}];}return db[_0xd534('0x2d')][_0xd534('0x45')](_0x116b5e);})[_0xd534('0x27')](function(_0x52dbca){_0x40a4f1[_0xd534('0x46')]=_0x52dbca;return _0x40a4f1;})['then'](respondWithFilteredResult(_0x318efb,_0x116b5e))['catch'](handleError(_0x318efb,null));};exports[_0xd534('0x47')]=function(_0x4858c1,_0x379be5){var _0x21e070={'raw':!![],'where':{'id':_0x4858c1[_0xd534('0x48')]['id']}},_0xac3a46={};_0xac3a46['model']=_[_0xd534('0x35')](db[_0xd534('0x2d')][_0xd534('0x2e')]);_0xac3a46[_0xd534('0x34')]=_['keys'](_0x4858c1[_0xd534('0x34')]);_0xac3a46[_0xd534('0x3e')]=_[_0xd534('0x37')](_0xac3a46[_0xd534('0x32')],_0xac3a46[_0xd534('0x34')]);_0x21e070[_0xd534('0x36')]=_['intersection'](_0xac3a46['model'],qs[_0xd534('0x38')](_0x4858c1[_0xd534('0x34')][_0xd534('0x38')]));_0x21e070[_0xd534('0x36')]=_0x21e070[_0xd534('0x36')][_0xd534('0x39')]?_0x21e070['attributes']:_0xac3a46[_0xd534('0x32')];if(_0x4858c1['query'][_0xd534('0x43')]){_0x21e070[_0xd534('0x44')]=[{'all':!![]}];}_0x21e070=_[_0xd534('0x40')]({},_0x21e070,_0x4858c1[_0xd534('0x42')]);return db['FreshsalesField']['find'](_0x21e070)[_0xd534('0x27')](handleEntityNotFound(_0x379be5,null))[_0xd534('0x27')](respondWithResult(_0x379be5,null))['catch'](handleError(_0x379be5,null));};exports[_0xd534('0x49')]=function(_0x6062a4,_0x59f2a4){return db[_0xd534('0x2d')][_0xd534('0x49')](_0x6062a4[_0xd534('0x4a')],{})[_0xd534('0x27')](respondWithResult(_0x59f2a4,0xc9))[_0xd534('0x4b')](handleError(_0x59f2a4,null));};exports['update']=function(_0x5cb2a1,_0x5006eb){if(_0x5cb2a1['body']['id']){delete _0x5cb2a1[_0xd534('0x4a')]['id'];}return db[_0xd534('0x2d')][_0xd534('0x4c')]({'where':{'id':_0x5cb2a1[_0xd534('0x48')]['id']}})[_0xd534('0x27')](handleEntityNotFound(_0x5006eb,null))['then'](saveUpdates(_0x5cb2a1[_0xd534('0x4a')],null))[_0xd534('0x27')](respondWithResult(_0x5006eb,null))[_0xd534('0x4b')](handleError(_0x5006eb,null));};exports[_0xd534('0x28')]=function(_0x17c055,_0x4f9ba6){return db[_0xd534('0x2d')]['find']({'where':{'id':_0x17c055['params']['id']}})['then'](handleEntityNotFound(_0x4f9ba6,null))['then'](removeEntity(_0x4f9ba6,null))[_0xd534('0x4b')](handleError(_0x4f9ba6,null));}; \ No newline at end of file +var _0x6b65=['params','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','count','status','apply','reject','save','update','then','destroy','error','name','send','index','map','FreshsalesField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','findAll','rows','catch','length','includeAll','include','create','body','find'];(function(_0x33c761,_0x4facb3){var _0x322a4f=function(_0x164fc5){while(--_0x164fc5){_0x33c761['push'](_0x33c761['shift']());}};_0x322a4f(++_0x4facb3);}(_0x6b65,0x11d));var _0x56b6=function(_0x525a1a,_0x5f1ef9){_0x525a1a=_0x525a1a-0x0;var _0xbaa3e1=_0x6b65[_0x525a1a];return _0xbaa3e1;};'use strict';var emlformat=require(_0x56b6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x56b6('0x1'));var jsonpatch=require(_0x56b6('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x56b6('0x3'));var Mustache=require(_0x56b6('0x4'));var util=require(_0x56b6('0x5'));var path=require(_0x56b6('0x6'));var sox=require(_0x56b6('0x7'));var csv=require(_0x56b6('0x8'));var ejs=require(_0x56b6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x56b6('0xa'));var squel=require(_0x56b6('0xb'));var crypto=require(_0x56b6('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x56b6('0xd'));var Redis=require(_0x56b6('0xe'));var authService=require(_0x56b6('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x56b6('0x10'));var hardwareService=require(_0x56b6('0x11'));var logger=require(_0x56b6('0x12'))('api');var utils=require(_0x56b6('0x13'));var config=require(_0x56b6('0x14'));var licenseUtil=require(_0x56b6('0x15'));var db=require(_0x56b6('0x16'))['db'];function respondWithStatusCode(_0x5ad563,_0x3ee9a6){_0x3ee9a6=_0x3ee9a6||0xcc;return function(_0x5b3740){if(_0x5b3740){return _0x5ad563['sendStatus'](_0x3ee9a6);}return _0x5ad563['status'](_0x3ee9a6)[_0x56b6('0x17')]();};}function respondWithResult(_0x2bfc57,_0x3894df){_0x3894df=_0x3894df||0xc8;return function(_0x44c68c){if(_0x44c68c){return _0x2bfc57['status'](_0x3894df)[_0x56b6('0x18')](_0x44c68c);}};}function respondWithFilteredResult(_0x3849bd,_0x5ba3c4){return function(_0x1b33cb){if(_0x1b33cb){var _0x590a42=typeof _0x5ba3c4[_0x56b6('0x19')]===_0x56b6('0x1a')&&typeof _0x5ba3c4['limit']===_0x56b6('0x1a');var _0x4ed1ea=_0x1b33cb[_0x56b6('0x1b')];var _0x163d6d=_0x590a42?0x0:_0x5ba3c4['offset'];var _0x178838=_0x590a42?_0x1b33cb[_0x56b6('0x1b')]:_0x5ba3c4['offset']+_0x5ba3c4['limit'];var _0xa2a9dc;if(_0x178838>=_0x4ed1ea){_0x178838=_0x4ed1ea;_0xa2a9dc=0xc8;}else{_0xa2a9dc=0xce;}_0x3849bd[_0x56b6('0x1c')](_0xa2a9dc);return _0x3849bd['set']('Content-Range',_0x163d6d+'-'+_0x178838+'/'+_0x4ed1ea)[_0x56b6('0x18')](_0x1b33cb);}return null;};}function patchUpdates(_0x16c489){return function(_0x104086){try{jsonpatch[_0x56b6('0x1d')](_0x104086,_0x16c489,!![]);}catch(_0x418e96){return BPromise[_0x56b6('0x1e')](_0x418e96);}return _0x104086[_0x56b6('0x1f')]();};}function saveUpdates(_0x1da0ab,_0x470607){return function(_0x35648c){if(_0x35648c){return _0x35648c[_0x56b6('0x20')](_0x1da0ab)[_0x56b6('0x21')](function(_0x17b857){return _0x17b857;});}return null;};}function removeEntity(_0x220646,_0x4ee4ea){return function(_0x3dcfa8){if(_0x3dcfa8){return _0x3dcfa8[_0x56b6('0x22')]()[_0x56b6('0x21')](function(){_0x220646[_0x56b6('0x1c')](0xcc)[_0x56b6('0x17')]();});}};}function handleEntityNotFound(_0x2572ed,_0x4f899b){return function(_0x100670){if(!_0x100670){_0x2572ed['sendStatus'](0x194);}return _0x100670;};}function handleError(_0x3536fc,_0x72dac5){_0x72dac5=_0x72dac5||0x1f4;return function(_0x572468){logger[_0x56b6('0x23')](_0x572468['stack']);if(_0x572468[_0x56b6('0x24')]){delete _0x572468['name'];}_0x3536fc['status'](_0x72dac5)[_0x56b6('0x25')](_0x572468);};}exports[_0x56b6('0x26')]=function(_0xac8642,_0x4a52c0){var _0x3e86b0={},_0x4b5ecf={},_0xa4cce={'count':0x0,'rows':[]};var _0x228681=_[_0x56b6('0x27')](db[_0x56b6('0x28')][_0x56b6('0x29')],function(_0x130ea8){return{'name':_0x130ea8['fieldName'],'type':_0x130ea8[_0x56b6('0x2a')][_0x56b6('0x2b')]};});_0x4b5ecf[_0x56b6('0x2c')]=_['map'](_0x228681,_0x56b6('0x24'));_0x4b5ecf[_0x56b6('0x2d')]=_[_0x56b6('0x2e')](_0xac8642[_0x56b6('0x2d')]);_0x4b5ecf[_0x56b6('0x2f')]=_[_0x56b6('0x30')](_0x4b5ecf['model'],_0x4b5ecf[_0x56b6('0x2d')]);_0x3e86b0[_0x56b6('0x31')]=_['intersection'](_0x4b5ecf[_0x56b6('0x2c')],qs[_0x56b6('0x32')](_0xac8642[_0x56b6('0x2d')][_0x56b6('0x32')]));_0x3e86b0[_0x56b6('0x31')]=_0x3e86b0[_0x56b6('0x31')]['length']?_0x3e86b0[_0x56b6('0x31')]:_0x4b5ecf['model'];if(!_0xac8642[_0x56b6('0x2d')][_0x56b6('0x33')](_0x56b6('0x34'))){_0x3e86b0[_0x56b6('0x35')]=qs['limit'](_0xac8642[_0x56b6('0x2d')][_0x56b6('0x35')]);_0x3e86b0[_0x56b6('0x19')]=qs['offset'](_0xac8642[_0x56b6('0x2d')]['offset']);}_0x3e86b0[_0x56b6('0x36')]=qs[_0x56b6('0x37')](_0xac8642[_0x56b6('0x2d')]['sort']);_0x3e86b0[_0x56b6('0x38')]=qs[_0x56b6('0x2f')](_['pick'](_0xac8642[_0x56b6('0x2d')],_0x4b5ecf[_0x56b6('0x2f')]),_0x228681);if(_0xac8642[_0x56b6('0x2d')][_0x56b6('0x39')]){_0x3e86b0[_0x56b6('0x38')]=_[_0x56b6('0x3a')](_0x3e86b0['where'],{'$or':_[_0x56b6('0x27')](_0x228681,function(_0x137498){if(_0x137498[_0x56b6('0x2a')]!==_0x56b6('0x3b')){var _0x30b3db={};_0x30b3db[_0x137498[_0x56b6('0x24')]]={'$like':'%'+_0xac8642['query'][_0x56b6('0x39')]+'%'};return _0x30b3db;}})});}_0x3e86b0=_[_0x56b6('0x3a')]({},_0x3e86b0,_0xac8642[_0x56b6('0x3c')]);var _0x19e5b4={'where':_0x3e86b0['where']};return db[_0x56b6('0x28')][_0x56b6('0x1b')](_0x19e5b4)[_0x56b6('0x21')](function(_0x2e53aa){_0xa4cce[_0x56b6('0x1b')]=_0x2e53aa;if(_0xac8642[_0x56b6('0x2d')]['includeAll']){_0x3e86b0['include']=[{'all':!![]}];}return db[_0x56b6('0x28')][_0x56b6('0x3d')](_0x3e86b0);})[_0x56b6('0x21')](function(_0x4f96d3){_0xa4cce[_0x56b6('0x3e')]=_0x4f96d3;return _0xa4cce;})['then'](respondWithFilteredResult(_0x4a52c0,_0x3e86b0))[_0x56b6('0x3f')](handleError(_0x4a52c0,null));};exports['show']=function(_0x4c57cb,_0x343150){var _0x1afdd3={'raw':!![],'where':{'id':_0x4c57cb['params']['id']}},_0x3c0412={};_0x3c0412[_0x56b6('0x2c')]=_[_0x56b6('0x2e')](db[_0x56b6('0x28')][_0x56b6('0x29')]);_0x3c0412['query']=_['keys'](_0x4c57cb[_0x56b6('0x2d')]);_0x3c0412[_0x56b6('0x2f')]=_['intersection'](_0x3c0412['model'],_0x3c0412[_0x56b6('0x2d')]);_0x1afdd3[_0x56b6('0x31')]=_[_0x56b6('0x30')](_0x3c0412['model'],qs[_0x56b6('0x32')](_0x4c57cb[_0x56b6('0x2d')][_0x56b6('0x32')]));_0x1afdd3[_0x56b6('0x31')]=_0x1afdd3[_0x56b6('0x31')][_0x56b6('0x40')]?_0x1afdd3['attributes']:_0x3c0412[_0x56b6('0x2c')];if(_0x4c57cb[_0x56b6('0x2d')][_0x56b6('0x41')]){_0x1afdd3[_0x56b6('0x42')]=[{'all':!![]}];}_0x1afdd3=_[_0x56b6('0x3a')]({},_0x1afdd3,_0x4c57cb['options']);return db[_0x56b6('0x28')]['find'](_0x1afdd3)['then'](handleEntityNotFound(_0x343150,null))['then'](respondWithResult(_0x343150,null))[_0x56b6('0x3f')](handleError(_0x343150,null));};exports['create']=function(_0x338321,_0x1417b0){return db[_0x56b6('0x28')][_0x56b6('0x43')](_0x338321['body'],{})[_0x56b6('0x21')](respondWithResult(_0x1417b0,0xc9))[_0x56b6('0x3f')](handleError(_0x1417b0,null));};exports[_0x56b6('0x20')]=function(_0x539421,_0x2f46ac){if(_0x539421[_0x56b6('0x44')]['id']){delete _0x539421[_0x56b6('0x44')]['id'];}return db[_0x56b6('0x28')][_0x56b6('0x45')]({'where':{'id':_0x539421['params']['id']}})[_0x56b6('0x21')](handleEntityNotFound(_0x2f46ac,null))[_0x56b6('0x21')](saveUpdates(_0x539421['body'],null))[_0x56b6('0x21')](respondWithResult(_0x2f46ac,null))['catch'](handleError(_0x2f46ac,null));};exports[_0x56b6('0x22')]=function(_0x17695b,_0x14e5fe){return db['FreshsalesField'][_0x56b6('0x45')]({'where':{'id':_0x17695b[_0x56b6('0x46')]['id']}})[_0x56b6('0x21')](handleEntityNotFound(_0x14e5fe,null))[_0x56b6('0x21')](removeEntity(_0x14e5fe,null))['catch'](handleError(_0x14e5fe,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 27a8720..4acb78f 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 _0xab75=['idField','FieldId','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index'];(function(_0x10e840,_0x5b3935){var _0x405caa=function(_0x46b707){while(--_0x46b707){_0x10e840['push'](_0x10e840['shift']());}};_0x405caa(++_0x5b3935);}(_0xab75,0x11f));var _0x5ab7=function(_0xa49388,_0x10ee55){_0xa49388=_0xa49388-0x0;var _0x3fd080=_0xab75[_0xa49388];return _0x3fd080;};'use strict';var _=require(_0x5ab7('0x0'));var util=require(_0x5ab7('0x1'));var logger=require(_0x5ab7('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5ab7('0x3'));var rp=require(_0x5ab7('0x4'));var fs=require('fs');var path=require(_0x5ab7('0x5'));var rimraf=require('rimraf');var config=require(_0x5ab7('0x6'));var attributes=require(_0x5ab7('0x7'));module[_0x5ab7('0x8')]=function(_0x3e1c7e,_0x406ca2){return _0x3e1c7e[_0x5ab7('0x9')](_0x5ab7('0xa'),attributes,{'tableName':_0x5ab7('0xb'),'paranoid':![],'indexes':[{'name':_0x5ab7('0xc'),'fields':[_0x5ab7('0xd'),_0x5ab7('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x119c=['util','api','moment','bluebird','path','rimraf','../../config/environment','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x119c,0xea));var _0xc119=function(_0x21353c,_0x2ea587){_0x21353c=_0x21353c-0x0;var _0xa99120=_0x119c[_0x21353c];return _0xa99120;};'use strict';var _=require('lodash');var util=require(_0xc119('0x0'));var logger=require('../../config/logger')(_0xc119('0x1'));var moment=require(_0xc119('0x2'));var BPromise=require(_0xc119('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc119('0x4'));var rimraf=require(_0xc119('0x5'));var config=require(_0xc119('0x6'));var attributes=require('./intFreshsalesField.attributes');module[_0xc119('0x7')]=function(_0x55a01a,_0x38be76){return _0x55a01a['define'](_0xc119('0x8'),attributes,{'tableName':_0xc119('0x9'),'paranoid':![],'indexes':[{'name':_0xc119('0xa'),'fields':[_0xc119('0xb'),_0xc119('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 397e8ae..353702f 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 _0xdbf5=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesField,\x20%s,\x20%s','debug','stringify','code','error','message','request\x20sent','result','catch'];(function(_0x20299d,_0xa4c6bc){var _0x15176e=function(_0xa61da0){while(--_0xa61da0){_0x20299d['push'](_0x20299d['shift']());}};_0x15176e(++_0xa4c6bc);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x39317f,_0x3d03ba){_0x39317f=_0x39317f-0x0;var _0x259bb2=_0xdbf5[_0x39317f];return _0x259bb2;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5dbf('0x1'));var fs=require('fs');var Redis=require(_0x5dbf('0x2'));var db=require(_0x5dbf('0x3'))['db'];var utils=require(_0x5dbf('0x4'));var logger=require(_0x5dbf('0x5'))(_0x5dbf('0x6'));var config=require(_0x5dbf('0x7'));var jayson=require(_0x5dbf('0x8'));var client=jayson[_0x5dbf('0x9')][_0x5dbf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x209b7d,_0x88128e,_0x93e657){return new BPromise(function(_0x52b039,_0x134810){return client['request'](_0x209b7d,_0x93e657)[_0x5dbf('0xb')](function(_0x3bec50){logger[_0x5dbf('0xc')](_0x5dbf('0xd'),_0x88128e,'request\x20sent');logger[_0x5dbf('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x88128e,'request\x20sent',JSON[_0x5dbf('0xf')](_0x3bec50));if(_0x3bec50['error']){if(_0x3bec50['error'][_0x5dbf('0x10')]===0x1f4){logger['error'](_0x5dbf('0xd'),_0x88128e,_0x3bec50[_0x5dbf('0x11')][_0x5dbf('0x12')]);return _0x134810(_0x3bec50[_0x5dbf('0x11')][_0x5dbf('0x12')]);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0x88128e,_0x3bec50[_0x5dbf('0x11')][_0x5dbf('0x12')]);return _0x52b039(_0x3bec50['error'][_0x5dbf('0x12')]);}else{logger[_0x5dbf('0xc')](_0x5dbf('0xd'),_0x88128e,_0x5dbf('0x13'));_0x52b039(_0x3bec50[_0x5dbf('0x14')][_0x5dbf('0x12')]);}})[_0x5dbf('0x15')](function(_0x50ef1d){logger['error'](_0x5dbf('0xd'),_0x88128e,_0x50ef1d);_0x134810(_0x50ef1d);});});} \ No newline at end of file +var _0xd117=['request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshsalesField,\x20%s,\x20%s','debug','stringify','code','error','message'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xd117,0x182));var _0x7d11=function(_0x5d3903,_0x3d6c3e){_0x5d3903=_0x5d3903-0x0;var _0x4b8bc9=_0xd117[_0x5d3903];return _0x4b8bc9;};'use strict';var _=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var moment=require(_0x7d11('0x2'));var BPromise=require(_0x7d11('0x3'));var rs=require(_0x7d11('0x4'));var fs=require('fs');var Redis=require(_0x7d11('0x5'));var db=require(_0x7d11('0x6'))['db'];var utils=require(_0x7d11('0x7'));var logger=require(_0x7d11('0x8'))(_0x7d11('0x9'));var config=require(_0x7d11('0xa'));var jayson=require(_0x7d11('0xb'));var client=jayson[_0x7d11('0xc')][_0x7d11('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x345602,_0x3c8d66,_0x47b5e6){return new BPromise(function(_0x3803b5,_0xffd020){return client[_0x7d11('0xe')](_0x345602,_0x47b5e6)['then'](function(_0x305eef){logger[_0x7d11('0xf')](_0x7d11('0x10'),_0x3c8d66,'request\x20sent');logger[_0x7d11('0x11')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x3c8d66,'request\x20sent',JSON[_0x7d11('0x12')](_0x305eef));if(_0x305eef['error']){if(_0x305eef['error'][_0x7d11('0x13')]===0x1f4){logger['error'](_0x7d11('0x10'),_0x3c8d66,_0x305eef[_0x7d11('0x14')]['message']);return _0xffd020(_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);}logger['error'](_0x7d11('0x10'),_0x3c8d66,_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);return _0x3803b5(_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);}else{logger[_0x7d11('0xf')](_0x7d11('0x10'),_0x3c8d66,_0x7d11('0x16'));_0x3803b5(_0x305eef['result'][_0x7d11('0x15')]);}})[_0x7d11('0x17')](function(_0x169733){logger[_0x7d11('0x14')](_0x7d11('0x10'),_0x3c8d66,_0x169733);_0xffd020(_0x169733);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 736d7ca..b3754e5 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x695ac0,_0x2dd007){var _0x241f9e=function(_0x5ec1f7){while(--_0x5ec1f7){_0x695ac0['push'](_0x695ac0['shift']());}};_0x241f9e(++_0x2dd007);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x9c068d,_0x1e241b){var _0xb2ebc6=function(_0xac4ec5){while(--_0xac4ec5){_0x9c068d['push'](_0x9c068d['shift']());}};_0xb2ebc6(++_0x1e241b);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index cb6da01..cf18d34 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 _0x94ff=['sequelize','STRING','username','ENUM','newTab'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x94ff,0xc3));var _0xf94f=function(_0x3d5fa3,_0x101bc3){_0x3d5fa3=_0x3d5fa3-0x0;var _0x47bc57=_0x94ff[_0x3d5fa3];return _0x47bc57;};'use strict';var Sequelize=require(_0xf94f('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf94f('0x1')],'unique':_0xf94f('0x2')},'remoteUri':{'type':Sequelize[_0xf94f('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xf94f('0x1')]},'clientSecret':{'type':Sequelize[_0xf94f('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xf94f('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xf94f('0x3')]('integrationTab',_0xf94f('0x4')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x2cc4=['exports','STRING','username','ENUM','integrationTab','newTab','sequelize'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x2cc4,0x1f0));var _0x42cc=function(_0x3a3c17,_0x5b7b7e){_0x3a3c17=_0x3a3c17-0x0;var _0xd07f21=_0x2cc4[_0x3a3c17];return _0xd07f21;};'use strict';var Sequelize=require(_0x42cc('0x0'));module[_0x42cc('0x1')]={'name':{'type':Sequelize[_0x42cc('0x2')]},'description':{'type':Sequelize[_0x42cc('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x42cc('0x3')},'remoteUri':{'type':Sequelize[_0x42cc('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x42cc('0x2')]},'serverUrl':{'type':Sequelize[_0x42cc('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x42cc('0x4')](_0x42cc('0x5'),_0x42cc('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 012f0fa..9395672 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 _0x49cb=['map','SalesforceAccount','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','then','rows','catch','show','params','find','create','body','getConfigurations','findOne','SalesforceConfiguration','filters','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','Subjects','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','Connection','login','isNil','ticketType','sobject','describe','ActivityDate','IsReminderSet','IsRecurrence','string','int','picklist','email','textarea','phone','remove','includes','label','custom','picklistValues','boolean','True','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','end','error','name','send'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x49cb,0x1c3));var _0xb49c=function(_0x11e7b5,_0x43842b){_0x11e7b5=_0x11e7b5-0x0;var _0x16b415=_0x49cb[_0x11e7b5];return _0x16b415;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb49c('0x0'));var zipdir=require(_0xb49c('0x1'));var jsonpatch=require(_0xb49c('0x2'));var rp=require(_0xb49c('0x3'));var moment=require(_0xb49c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb49c('0x5'));var util=require(_0xb49c('0x6'));var path=require(_0xb49c('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb49c('0x8'));var fs=require('fs');var fs_extra=require(_0xb49c('0x9'));var _=require('lodash');var squel=require(_0xb49c('0xa'));var crypto=require(_0xb49c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb49c('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb49c('0xd'));var Papa=require(_0xb49c('0xe'));var Redis=require(_0xb49c('0xf'));var authService=require(_0xb49c('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb49c('0x11'))(_0xb49c('0x12'));var utils=require(_0xb49c('0x13'));var config=require(_0xb49c('0x14'));var licenseUtil=require(_0xb49c('0x15'));var db=require(_0xb49c('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xcb4104,_0x3a2e48){_0x3a2e48=_0x3a2e48||0xcc;return function(_0xc49015){if(_0xc49015){return _0xcb4104[_0xb49c('0x17')](_0x3a2e48);}return _0xcb4104[_0xb49c('0x18')](_0x3a2e48)['end']();};}function respondWithResult(_0x497171,_0x4a0a0c){_0x4a0a0c=_0x4a0a0c||0xc8;return function(_0x4bfda5){if(_0x4bfda5){return _0x497171['status'](_0x4a0a0c)['json'](_0x4bfda5);}};}function respondWithFilteredResult(_0x391fca,_0xbf89d9){return function(_0x2dca9a){if(_0x2dca9a){var _0x1381f6=typeof _0xbf89d9[_0xb49c('0x19')]==='undefined'&&typeof _0xbf89d9[_0xb49c('0x1a')]===_0xb49c('0x1b');var _0x393dc9=_0x2dca9a[_0xb49c('0x1c')];var _0x105f03=_0x1381f6?0x0:_0xbf89d9['offset'];var _0x425b20=_0x1381f6?_0x2dca9a[_0xb49c('0x1c')]:_0xbf89d9[_0xb49c('0x19')]+_0xbf89d9['limit'];var _0x2354c5;if(_0x425b20>=_0x393dc9){_0x425b20=_0x393dc9;_0x2354c5=0xc8;}else{_0x2354c5=0xce;}_0x391fca[_0xb49c('0x18')](_0x2354c5);return _0x391fca[_0xb49c('0x1d')](_0xb49c('0x1e'),_0x105f03+'-'+_0x425b20+'/'+_0x393dc9)[_0xb49c('0x1f')](_0x2dca9a);}return null;};}function patchUpdates(_0x28b4de){return function(_0x17b756){try{jsonpatch[_0xb49c('0x20')](_0x17b756,_0x28b4de,!![]);}catch(_0x14c839){return BPromise[_0xb49c('0x21')](_0x14c839);}return _0x17b756[_0xb49c('0x22')]();};}function saveUpdates(_0x138000,_0x400fe1){return function(_0x39f753){if(_0x39f753){return _0x39f753[_0xb49c('0x23')](_0x138000)['then'](function(_0x4c4a60){return _0x4c4a60;});}return null;};}function removeEntity(_0x1519ea,_0x1bcddd){return function(_0x51871e){if(_0x51871e){return _0x51871e[_0xb49c('0x24')]()['then'](function(){_0x1519ea['status'](0xcc)[_0xb49c('0x25')]();});}};}function handleEntityNotFound(_0x40d76b,_0x385040){return function(_0x209c74){if(!_0x209c74){_0x40d76b[_0xb49c('0x17')](0x194);}return _0x209c74;};}function handleError(_0x399df2,_0x52304f){_0x52304f=_0x52304f||0x1f4;return function(_0x1b6e98){logger[_0xb49c('0x26')](_0x1b6e98['stack']);if(_0x1b6e98['name']){delete _0x1b6e98[_0xb49c('0x27')];}_0x399df2[_0xb49c('0x18')](_0x52304f)[_0xb49c('0x28')](_0x1b6e98);};}exports['index']=function(_0x49ec20,_0x4b4e3b){var _0x480ea4={},_0x2b2ee2={},_0x54cb22={'count':0x0,'rows':[]};var _0x1d0018=_[_0xb49c('0x29')](db[_0xb49c('0x2a')][_0xb49c('0x2b')],function(_0x1b8c4f){return{'name':_0x1b8c4f[_0xb49c('0x2c')],'type':_0x1b8c4f[_0xb49c('0x2d')][_0xb49c('0x2e')]};});_0x2b2ee2['model']=_[_0xb49c('0x29')](_0x1d0018,_0xb49c('0x27'));_0x2b2ee2[_0xb49c('0x2f')]=_[_0xb49c('0x30')](_0x49ec20['query']);_0x2b2ee2['filters']=_[_0xb49c('0x31')](_0x2b2ee2[_0xb49c('0x32')],_0x2b2ee2[_0xb49c('0x2f')]);_0x480ea4[_0xb49c('0x33')]=_[_0xb49c('0x31')](_0x2b2ee2[_0xb49c('0x32')],qs[_0xb49c('0x34')](_0x49ec20[_0xb49c('0x2f')][_0xb49c('0x34')]));_0x480ea4[_0xb49c('0x33')]=_0x480ea4['attributes'][_0xb49c('0x35')]?_0x480ea4['attributes']:_0x2b2ee2['model'];if(!_0x49ec20[_0xb49c('0x2f')][_0xb49c('0x36')](_0xb49c('0x37'))){_0x480ea4[_0xb49c('0x1a')]=qs[_0xb49c('0x1a')](_0x49ec20['query'][_0xb49c('0x1a')]);_0x480ea4[_0xb49c('0x19')]=qs[_0xb49c('0x19')](_0x49ec20[_0xb49c('0x2f')][_0xb49c('0x19')]);}_0x480ea4[_0xb49c('0x38')]=qs[_0xb49c('0x39')](_0x49ec20[_0xb49c('0x2f')][_0xb49c('0x39')]);_0x480ea4[_0xb49c('0x3a')]=qs['filters'](_[_0xb49c('0x3b')](_0x49ec20[_0xb49c('0x2f')],_0x2b2ee2['filters']),_0x1d0018);if(_0x49ec20[_0xb49c('0x2f')][_0xb49c('0x3c')]){_0x480ea4[_0xb49c('0x3a')]=_['merge'](_0x480ea4[_0xb49c('0x3a')],{'$or':_[_0xb49c('0x29')](_0x1d0018,function(_0x11400a){if(_0x11400a[_0xb49c('0x2d')]!==_0xb49c('0x3d')){var _0x5bbaeb={};_0x5bbaeb[_0x11400a[_0xb49c('0x27')]]={'$like':'%'+_0x49ec20[_0xb49c('0x2f')]['filter']+'%'};return _0x5bbaeb;}})});}_0x480ea4=_[_0xb49c('0x3e')]({},_0x480ea4,_0x49ec20[_0xb49c('0x3f')]);var _0x29ff35={'where':_0x480ea4['where']};return db[_0xb49c('0x2a')][_0xb49c('0x1c')](_0x29ff35)['then'](function(_0x48a821){_0x54cb22[_0xb49c('0x1c')]=_0x48a821;if(_0x49ec20[_0xb49c('0x2f')][_0xb49c('0x40')]){_0x480ea4[_0xb49c('0x41')]=[{'all':!![]}];}return db[_0xb49c('0x2a')]['findAll'](_0x480ea4);})[_0xb49c('0x42')](function(_0x34df10){_0x54cb22[_0xb49c('0x43')]=_0x34df10;return _0x54cb22;})[_0xb49c('0x42')](respondWithFilteredResult(_0x4b4e3b,_0x480ea4))[_0xb49c('0x44')](handleError(_0x4b4e3b,null));};exports[_0xb49c('0x45')]=function(_0xf3b59d,_0x1241a7){var _0x29ced3={'raw':![],'where':{'id':_0xf3b59d[_0xb49c('0x46')]['id']}},_0x23d1c9={};_0x23d1c9[_0xb49c('0x32')]=_[_0xb49c('0x30')](db[_0xb49c('0x2a')][_0xb49c('0x2b')]);_0x23d1c9[_0xb49c('0x2f')]=_[_0xb49c('0x30')](_0xf3b59d[_0xb49c('0x2f')]);_0x23d1c9['filters']=_[_0xb49c('0x31')](_0x23d1c9[_0xb49c('0x32')],_0x23d1c9['query']);_0x29ced3[_0xb49c('0x33')]=_['intersection'](_0x23d1c9[_0xb49c('0x32')],qs['fields'](_0xf3b59d[_0xb49c('0x2f')]['fields']));_0x29ced3['attributes']=_0x29ced3['attributes'][_0xb49c('0x35')]?_0x29ced3[_0xb49c('0x33')]:_0x23d1c9['model'];if(_0xf3b59d['query'][_0xb49c('0x40')]){_0x29ced3[_0xb49c('0x41')]=[{'all':!![]}];}_0x29ced3=_[_0xb49c('0x3e')]({},_0x29ced3,_0xf3b59d[_0xb49c('0x3f')]);return db[_0xb49c('0x2a')][_0xb49c('0x47')](_0x29ced3)[_0xb49c('0x42')](handleEntityNotFound(_0x1241a7,null))[_0xb49c('0x42')](respondWithResult(_0x1241a7,null))[_0xb49c('0x44')](handleError(_0x1241a7,null));};exports[_0xb49c('0x48')]=function(_0x2357b5,_0x156450){return db['SalesforceAccount'][_0xb49c('0x48')](_0x2357b5[_0xb49c('0x49')],{})[_0xb49c('0x42')](respondWithResult(_0x156450,0xc9))[_0xb49c('0x44')](handleError(_0x156450,null));};exports[_0xb49c('0x23')]=function(_0x10f3cd,_0x3f59e6){if(_0x10f3cd[_0xb49c('0x49')]['id']){delete _0x10f3cd['body']['id'];}return db[_0xb49c('0x2a')][_0xb49c('0x47')]({'where':{'id':_0x10f3cd[_0xb49c('0x46')]['id']}})[_0xb49c('0x42')](handleEntityNotFound(_0x3f59e6,null))[_0xb49c('0x42')](saveUpdates(_0x10f3cd['body'],null))[_0xb49c('0x42')](respondWithResult(_0x3f59e6,null))[_0xb49c('0x44')](handleError(_0x3f59e6,null));};exports[_0xb49c('0x24')]=function(_0x6a8873,_0x5f1b00){return db[_0xb49c('0x2a')][_0xb49c('0x47')]({'where':{'id':_0x6a8873[_0xb49c('0x46')]['id']}})[_0xb49c('0x42')](handleEntityNotFound(_0x5f1b00,null))['then'](removeEntity(_0x5f1b00,null))[_0xb49c('0x44')](handleError(_0x5f1b00,null));};exports[_0xb49c('0x4a')]=function(_0x3af717,_0x42be83,_0x373ecf){var _0x15dea7={};var _0x512bd4={};var _0x21d175;var _0x3dd7ce;return db['SalesforceAccount'][_0xb49c('0x4b')]({'where':{'id':_0x3af717[_0xb49c('0x46')]['id']}})[_0xb49c('0x42')](handleEntityNotFound(_0x42be83,null))[_0xb49c('0x42')](function(_0x3d6cd9){if(_0x3d6cd9){_0x21d175=_0x3d6cd9;_0x512bd4['model']=_[_0xb49c('0x30')](db[_0xb49c('0x4c')][_0xb49c('0x2b')]);_0x512bd4['query']=_[_0xb49c('0x30')](_0x3af717[_0xb49c('0x2f')]);_0x512bd4['filters']=_['intersection'](_0x512bd4['model'],_0x512bd4[_0xb49c('0x2f')]);_0x15dea7[_0xb49c('0x33')]=_[_0xb49c('0x31')](_0x512bd4[_0xb49c('0x32')],qs[_0xb49c('0x34')](_0x3af717[_0xb49c('0x2f')][_0xb49c('0x34')]));_0x15dea7[_0xb49c('0x33')]=_0x15dea7['attributes'][_0xb49c('0x35')]?_0x15dea7[_0xb49c('0x33')]:_0x512bd4[_0xb49c('0x32')];_0x15dea7['order']=qs[_0xb49c('0x39')](_0x3af717[_0xb49c('0x2f')]['sort']);_0x15dea7[_0xb49c('0x3a')]=qs[_0xb49c('0x4d')](_[_0xb49c('0x3b')](_0x3af717[_0xb49c('0x2f')],_0x512bd4[_0xb49c('0x4d')]));if(_0x3af717[_0xb49c('0x2f')][_0xb49c('0x3c')]){_0x15dea7[_0xb49c('0x3a')]=_['merge'](_0x15dea7[_0xb49c('0x3a')],{'$or':_['map'](_0x15dea7[_0xb49c('0x33')],function(_0x45dc52){var _0xb8113b={};_0xb8113b[_0x45dc52]={'$like':'%'+_0x3af717[_0xb49c('0x2f')][_0xb49c('0x3c')]+'%'};return _0xb8113b;})});}_0x15dea7=_[_0xb49c('0x3e')]({},_0x15dea7,_0x3af717[_0xb49c('0x3f')]);return _0x21d175['getConfigurations'](_0x15dea7);}})['then'](function(_0x10ce40){if(_0x10ce40){_0x3dd7ce=_0x10ce40[_0xb49c('0x35')];if(!_0x3af717[_0xb49c('0x2f')]['hasOwnProperty'](_0xb49c('0x37'))){_0x15dea7[_0xb49c('0x1a')]=qs[_0xb49c('0x1a')](_0x3af717[_0xb49c('0x2f')]['limit']);_0x15dea7[_0xb49c('0x19')]=qs[_0xb49c('0x19')](_0x3af717[_0xb49c('0x2f')][_0xb49c('0x19')]);}return _0x21d175[_0xb49c('0x4a')](_0x15dea7);}})[_0xb49c('0x42')](function(_0x403c77){if(_0x403c77){return _0x403c77?{'count':_0x3dd7ce,'rows':_0x403c77}:null;}})[_0xb49c('0x42')](respondWithResult(_0x42be83,null))[_0xb49c('0x44')](handleError(_0x42be83,null));};exports[_0xb49c('0x4e')]=function(_0x3ff239,_0x48a466,_0x31dbc2){if(_0x3ff239[_0xb49c('0x49')]['id']){delete _0x3ff239[_0xb49c('0x49')]['id'];}return db[_0xb49c('0x2a')]['findOne']({'where':{'id':_0x3ff239[_0xb49c('0x46')]['id']}})['then'](handleEntityNotFound(_0x48a466,null))[_0xb49c('0x42')](function(_0x149b2a){if(_0x149b2a){_0x3ff239[_0xb49c('0x49')]['AccountId']=_0x149b2a['id'];_0x3ff239['body']['Subjects']=integrations[_0xb49c('0x4f')](_0x3ff239[_0xb49c('0x49')][_0xb49c('0x50')],_0x3ff239[_0xb49c('0x49')][_0xb49c('0x2d')]);_0x3ff239[_0xb49c('0x49')][_0xb49c('0x51')]=integrations[_0xb49c('0x52')](_0x3ff239[_0xb49c('0x49')][_0xb49c('0x50')],_0x3ff239[_0xb49c('0x49')][_0xb49c('0x2d')]);return db[_0xb49c('0x4c')]['create'](_0x3ff239[_0xb49c('0x49')],{'include':[{'model':db['SalesforceField'],'as':_0xb49c('0x53')},{'model':db[_0xb49c('0x54')],'as':_0xb49c('0x51')}]});}return null;})[_0xb49c('0x42')](respondWithResult(_0x48a466,null))[_0xb49c('0x44')](handleError(_0x48a466,null));};exports[_0xb49c('0x55')]=function(_0x20a50d,_0x14daf0,_0x4535c5){var _0x11f3bb;var _0x5a316b='';var _0x46d6ab=_0xb49c('0x56');return db[_0xb49c('0x2a')][_0xb49c('0x4b')]({'where':{'id':_0x20a50d[_0xb49c('0x46')]['id']},'attributes':['id',_0xb49c('0x57'),_0xb49c('0x58'),_0xb49c('0x59'),_0xb49c('0x5a'),_0xb49c('0x5b'),_0xb49c('0x5c')]})[_0xb49c('0x42')](handleEntityNotFound(_0x14daf0,null))[_0xb49c('0x42')](function(_0x3d048b){if(_0x3d048b){_0x5a316b=_0x3d048b[_0xb49c('0x57')];var _0x3d0e13=_0x5a316b[_0xb49c('0x5d')](-0x1);if(_0x3d0e13==='/'){_0x5a316b=_0x5a316b[_0xb49c('0x5e')](0x0,_0x5a316b['lastIndexOf'](_0x3d0e13));}_0x11f3bb=new jsforce[(_0xb49c('0x5f'))]({'oauth2':{'loginUrl':_0x5a316b,'clientId':_0x3d048b[_0xb49c('0x58')],'clientSecret':_0x3d048b['clientSecret']}});return _0x11f3bb[_0xb49c('0x60')](_0x3d048b[_0xb49c('0x5a')],_0x3d048b[_0xb49c('0x5b')]['concat'](_0x3d048b[_0xb49c('0x5c')]));}})[_0xb49c('0x42')](function(_0x298d6f){if(_0x298d6f){if(!_[_0xb49c('0x61')](_0x20a50d['query']['ticketType'])){_0x46d6ab=_0x20a50d[_0xb49c('0x2f')][_0xb49c('0x62')];}return _0x11f3bb[_0xb49c('0x63')](_0x46d6ab)[_0xb49c('0x64')]();}})['then'](function(_0x42dcab){var _0x263753=['OwnerId',_0xb49c('0x65'),_0xb49c('0x66'),_0xb49c('0x67'),'Subject','Description'];var _0x4191e4=[_0xb49c('0x68'),_0xb49c('0x69'),_0xb49c('0x6a'),'boolean',_0xb49c('0x6b'),_0xb49c('0x6c'),_0xb49c('0x6d')];if(_0x42dcab){_[_0xb49c('0x6e')](_0x42dcab['fields'],function(_0x2b9033){return _0x263753['includes'](_0x2b9033['name'])||!_0x4191e4[_0xb49c('0x6f')](_0x2b9033[_0xb49c('0x2d')]);});return{'count':_0x42dcab[_0xb49c('0x34')][_0xb49c('0x35')],'rows':_['map'](_0x42dcab[_0xb49c('0x34')],function(_0x121cc7){return{'id':_0x121cc7[_0xb49c('0x27')],'name':_0x121cc7[_0xb49c('0x70')],'custom':_0x121cc7[_0xb49c('0x71')],'options':_0x121cc7['picklistValues'][_0xb49c('0x35')]>0x0?_['map'](_0x121cc7[_0xb49c('0x72')],function(_0x41a2ec){return{'name':_0x41a2ec[_0xb49c('0x70')],'value':_0x41a2ec['value']};}):_0x121cc7['type']==_0xb49c('0x73')?[{'name':_0xb49c('0x74'),'value':'true'},{'name':_0xb49c('0x75'),'value':_0xb49c('0x76')}]:[]};})};}})['then'](respondWithResult(_0x14daf0,null))[_0xb49c('0x44')](function(_0x5e1e8f){var _0x105587=_0x20a50d[_0xb49c('0x2f')][_0xb49c('0x77')]?0x1f4:_0x5e1e8f[_0xb49c('0x78')]||0x1f4;logger['error'](_0xb49c('0x79'),_0xb49c('0x55'),_0x105587,JSON['stringify'](_0x5e1e8f));delete _0x5e1e8f[_0xb49c('0x27')];if(_0x105587===0x191){_0x105587=0x190;}_0x14daf0[_0xb49c('0x18')](_0x105587)[_0xb49c('0x28')](_0x20a50d[_0xb49c('0x2f')][_0xb49c('0x77')]?{'message':_0xb49c('0x7a'),'statusCode':_0x5e1e8f[_0xb49c('0x78')]}:_0x5e1e8f);});}; \ No newline at end of file +var _0xf987=['includes','label','custom','picklistValues','value','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','zip-dir','fast-json-patch','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/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','SalesforceAccount','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','rows','catch','show','params','rawAttributes','keys','include','find','create','body','update','getConfigurations','findOne','SalesforceConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','SalesforceField','getFields','Task','remoteUri','clientSecret','username','securityToken','slice','substring','lastIndexOf','Connection','clientId','password','isNil','ticketType','sobject','describe','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','textarea','phone'];(function(_0x3f9c27,_0x154424){var _0x3ce18d=function(_0x27ccc4){while(--_0x27ccc4){_0x3f9c27['push'](_0x3f9c27['shift']());}};_0x3ce18d(++_0x154424);}(_0xf987,0x18a));var _0x7f98=function(_0x386854,_0x2e7449){_0x386854=_0x386854-0x0;var _0x402c28=_0xf987[_0x386854];return _0x402c28;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7f98('0x0'));var jsonpatch=require(_0x7f98('0x1'));var rp=require('request-promise');var moment=require(_0x7f98('0x2'));var BPromise=require(_0x7f98('0x3'));var Mustache=require(_0x7f98('0x4'));var util=require(_0x7f98('0x5'));var path=require(_0x7f98('0x6'));var sox=require(_0x7f98('0x7'));var csv=require(_0x7f98('0x8'));var ejs=require(_0x7f98('0x9'));var fs=require('fs');var fs_extra=require(_0x7f98('0xa'));var _=require(_0x7f98('0xb'));var squel=require(_0x7f98('0xc'));var crypto=require(_0x7f98('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7f98('0xe'));var toCsv=require(_0x7f98('0x8'));var querystring=require(_0x7f98('0xf'));var Papa=require(_0x7f98('0x10'));var Redis=require(_0x7f98('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7f98('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7f98('0x13'))(_0x7f98('0x14'));var utils=require(_0x7f98('0x15'));var config=require(_0x7f98('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7f98('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x9c2633,_0x2c26d8){_0x2c26d8=_0x2c26d8||0xcc;return function(_0x40ca0a){if(_0x40ca0a){return _0x9c2633[_0x7f98('0x18')](_0x2c26d8);}return _0x9c2633[_0x7f98('0x19')](_0x2c26d8)[_0x7f98('0x1a')]();};}function respondWithResult(_0x33108e,_0x3044d4){_0x3044d4=_0x3044d4||0xc8;return function(_0x2336cc){if(_0x2336cc){return _0x33108e[_0x7f98('0x19')](_0x3044d4)[_0x7f98('0x1b')](_0x2336cc);}};}function respondWithFilteredResult(_0x1fa829,_0x5e3bb5){return function(_0xcab406){if(_0xcab406){var _0x4de314=typeof _0x5e3bb5['offset']===_0x7f98('0x1c')&&typeof _0x5e3bb5[_0x7f98('0x1d')]==='undefined';var _0x51e810=_0xcab406['count'];var _0x54e6aa=_0x4de314?0x0:_0x5e3bb5[_0x7f98('0x1e')];var _0x1ab371=_0x4de314?_0xcab406['count']:_0x5e3bb5['offset']+_0x5e3bb5['limit'];var _0x364377;if(_0x1ab371>=_0x51e810){_0x1ab371=_0x51e810;_0x364377=0xc8;}else{_0x364377=0xce;}_0x1fa829['status'](_0x364377);return _0x1fa829[_0x7f98('0x1f')](_0x7f98('0x20'),_0x54e6aa+'-'+_0x1ab371+'/'+_0x51e810)[_0x7f98('0x1b')](_0xcab406);}return null;};}function patchUpdates(_0x446dd5){return function(_0x2dc650){try{jsonpatch[_0x7f98('0x21')](_0x2dc650,_0x446dd5,!![]);}catch(_0x40fe78){return BPromise[_0x7f98('0x22')](_0x40fe78);}return _0x2dc650[_0x7f98('0x23')]();};}function saveUpdates(_0x53c1ef,_0x55189b){return function(_0x12567f){if(_0x12567f){return _0x12567f['update'](_0x53c1ef)[_0x7f98('0x24')](function(_0x2d9e09){return _0x2d9e09;});}return null;};}function removeEntity(_0x51eca3,_0x417ad4){return function(_0xe03ec4){if(_0xe03ec4){return _0xe03ec4['destroy']()[_0x7f98('0x24')](function(){_0x51eca3[_0x7f98('0x19')](0xcc)[_0x7f98('0x1a')]();});}};}function handleEntityNotFound(_0x1a5788,_0x3e1cd5){return function(_0x9f366b){if(!_0x9f366b){_0x1a5788[_0x7f98('0x18')](0x194);}return _0x9f366b;};}function handleError(_0x8b27a4,_0x1d086f){_0x1d086f=_0x1d086f||0x1f4;return function(_0x12378f){logger[_0x7f98('0x25')](_0x12378f[_0x7f98('0x26')]);if(_0x12378f[_0x7f98('0x27')]){delete _0x12378f['name'];}_0x8b27a4['status'](_0x1d086f)[_0x7f98('0x28')](_0x12378f);};}exports[_0x7f98('0x29')]=function(_0x186519,_0x1dd8d5){var _0xc8f69f={},_0x16a8cb={},_0x20ff8d={'count':0x0,'rows':[]};var _0x115b45=_[_0x7f98('0x2a')](db[_0x7f98('0x2b')]['rawAttributes'],function(_0x99a891){return{'name':_0x99a891[_0x7f98('0x2c')],'type':_0x99a891['type'][_0x7f98('0x2d')]};});_0x16a8cb[_0x7f98('0x2e')]=_[_0x7f98('0x2a')](_0x115b45,'name');_0x16a8cb[_0x7f98('0x2f')]=_['keys'](_0x186519[_0x7f98('0x2f')]);_0x16a8cb['filters']=_[_0x7f98('0x30')](_0x16a8cb[_0x7f98('0x2e')],_0x16a8cb[_0x7f98('0x2f')]);_0xc8f69f[_0x7f98('0x31')]=_[_0x7f98('0x30')](_0x16a8cb[_0x7f98('0x2e')],qs[_0x7f98('0x32')](_0x186519['query']['fields']));_0xc8f69f[_0x7f98('0x31')]=_0xc8f69f[_0x7f98('0x31')][_0x7f98('0x33')]?_0xc8f69f[_0x7f98('0x31')]:_0x16a8cb[_0x7f98('0x2e')];if(!_0x186519[_0x7f98('0x2f')][_0x7f98('0x34')]('nolimit')){_0xc8f69f['limit']=qs[_0x7f98('0x1d')](_0x186519['query'][_0x7f98('0x1d')]);_0xc8f69f['offset']=qs[_0x7f98('0x1e')](_0x186519[_0x7f98('0x2f')][_0x7f98('0x1e')]);}_0xc8f69f[_0x7f98('0x35')]=qs[_0x7f98('0x36')](_0x186519[_0x7f98('0x2f')][_0x7f98('0x36')]);_0xc8f69f[_0x7f98('0x37')]=qs[_0x7f98('0x38')](_[_0x7f98('0x39')](_0x186519[_0x7f98('0x2f')],_0x16a8cb[_0x7f98('0x38')]),_0x115b45);if(_0x186519[_0x7f98('0x2f')][_0x7f98('0x3a')]){_0xc8f69f[_0x7f98('0x37')]=_[_0x7f98('0x3b')](_0xc8f69f[_0x7f98('0x37')],{'$or':_[_0x7f98('0x2a')](_0x115b45,function(_0x18198a){if(_0x18198a[_0x7f98('0x3c')]!==_0x7f98('0x3d')){var _0x3e520f={};_0x3e520f[_0x18198a[_0x7f98('0x27')]]={'$like':'%'+_0x186519['query'][_0x7f98('0x3a')]+'%'};return _0x3e520f;}})});}_0xc8f69f=_[_0x7f98('0x3b')]({},_0xc8f69f,_0x186519[_0x7f98('0x3e')]);var _0x31bed1={'where':_0xc8f69f['where']};return db['SalesforceAccount'][_0x7f98('0x3f')](_0x31bed1)[_0x7f98('0x24')](function(_0x491cba){_0x20ff8d[_0x7f98('0x3f')]=_0x491cba;if(_0x186519['query']['includeAll']){_0xc8f69f['include']=[{'all':!![]}];}return db[_0x7f98('0x2b')]['findAll'](_0xc8f69f);})[_0x7f98('0x24')](function(_0x4a7599){_0x20ff8d[_0x7f98('0x40')]=_0x4a7599;return _0x20ff8d;})[_0x7f98('0x24')](respondWithFilteredResult(_0x1dd8d5,_0xc8f69f))[_0x7f98('0x41')](handleError(_0x1dd8d5,null));};exports[_0x7f98('0x42')]=function(_0x48ede9,_0x55a8cc){var _0x5b8fef={'raw':![],'where':{'id':_0x48ede9[_0x7f98('0x43')]['id']}},_0x71bfb={};_0x71bfb['model']=_['keys'](db[_0x7f98('0x2b')][_0x7f98('0x44')]);_0x71bfb[_0x7f98('0x2f')]=_[_0x7f98('0x45')](_0x48ede9[_0x7f98('0x2f')]);_0x71bfb[_0x7f98('0x38')]=_['intersection'](_0x71bfb[_0x7f98('0x2e')],_0x71bfb[_0x7f98('0x2f')]);_0x5b8fef[_0x7f98('0x31')]=_[_0x7f98('0x30')](_0x71bfb[_0x7f98('0x2e')],qs[_0x7f98('0x32')](_0x48ede9[_0x7f98('0x2f')][_0x7f98('0x32')]));_0x5b8fef[_0x7f98('0x31')]=_0x5b8fef[_0x7f98('0x31')][_0x7f98('0x33')]?_0x5b8fef[_0x7f98('0x31')]:_0x71bfb['model'];if(_0x48ede9['query']['includeAll']){_0x5b8fef[_0x7f98('0x46')]=[{'all':!![]}];}_0x5b8fef=_[_0x7f98('0x3b')]({},_0x5b8fef,_0x48ede9['options']);return db[_0x7f98('0x2b')][_0x7f98('0x47')](_0x5b8fef)[_0x7f98('0x24')](handleEntityNotFound(_0x55a8cc,null))[_0x7f98('0x24')](respondWithResult(_0x55a8cc,null))[_0x7f98('0x41')](handleError(_0x55a8cc,null));};exports[_0x7f98('0x48')]=function(_0x157723,_0xdbd22d){return db[_0x7f98('0x2b')]['create'](_0x157723[_0x7f98('0x49')],{})[_0x7f98('0x24')](respondWithResult(_0xdbd22d,0xc9))[_0x7f98('0x41')](handleError(_0xdbd22d,null));};exports[_0x7f98('0x4a')]=function(_0x3396a7,_0x5008ff){if(_0x3396a7[_0x7f98('0x49')]['id']){delete _0x3396a7[_0x7f98('0x49')]['id'];}return db['SalesforceAccount'][_0x7f98('0x47')]({'where':{'id':_0x3396a7[_0x7f98('0x43')]['id']}})[_0x7f98('0x24')](handleEntityNotFound(_0x5008ff,null))[_0x7f98('0x24')](saveUpdates(_0x3396a7['body'],null))[_0x7f98('0x24')](respondWithResult(_0x5008ff,null))['catch'](handleError(_0x5008ff,null));};exports['destroy']=function(_0x3467ad,_0xb38a55){return db[_0x7f98('0x2b')][_0x7f98('0x47')]({'where':{'id':_0x3467ad[_0x7f98('0x43')]['id']}})[_0x7f98('0x24')](handleEntityNotFound(_0xb38a55,null))[_0x7f98('0x24')](removeEntity(_0xb38a55,null))[_0x7f98('0x41')](handleError(_0xb38a55,null));};exports[_0x7f98('0x4b')]=function(_0x203a53,_0x53433a,_0x1196b3){var _0x1453a7={};var _0x2eabb8={};var _0x2d4bac;var _0x23aeed;return db[_0x7f98('0x2b')][_0x7f98('0x4c')]({'where':{'id':_0x203a53[_0x7f98('0x43')]['id']}})[_0x7f98('0x24')](handleEntityNotFound(_0x53433a,null))[_0x7f98('0x24')](function(_0x2d5836){if(_0x2d5836){_0x2d4bac=_0x2d5836;_0x2eabb8['model']=_[_0x7f98('0x45')](db[_0x7f98('0x4d')][_0x7f98('0x44')]);_0x2eabb8['query']=_['keys'](_0x203a53['query']);_0x2eabb8['filters']=_['intersection'](_0x2eabb8[_0x7f98('0x2e')],_0x2eabb8[_0x7f98('0x2f')]);_0x1453a7[_0x7f98('0x31')]=_[_0x7f98('0x30')](_0x2eabb8['model'],qs[_0x7f98('0x32')](_0x203a53[_0x7f98('0x2f')]['fields']));_0x1453a7[_0x7f98('0x31')]=_0x1453a7[_0x7f98('0x31')]['length']?_0x1453a7[_0x7f98('0x31')]:_0x2eabb8[_0x7f98('0x2e')];_0x1453a7[_0x7f98('0x35')]=qs[_0x7f98('0x36')](_0x203a53[_0x7f98('0x2f')]['sort']);_0x1453a7['where']=qs[_0x7f98('0x38')](_['pick'](_0x203a53['query'],_0x2eabb8[_0x7f98('0x38')]));if(_0x203a53[_0x7f98('0x2f')]['filter']){_0x1453a7['where']=_['merge'](_0x1453a7['where'],{'$or':_['map'](_0x1453a7[_0x7f98('0x31')],function(_0x4c5fc6){var _0x5bc4e3={};_0x5bc4e3[_0x4c5fc6]={'$like':'%'+_0x203a53[_0x7f98('0x2f')][_0x7f98('0x3a')]+'%'};return _0x5bc4e3;})});}_0x1453a7=_[_0x7f98('0x3b')]({},_0x1453a7,_0x203a53[_0x7f98('0x3e')]);return _0x2d4bac[_0x7f98('0x4b')](_0x1453a7);}})[_0x7f98('0x24')](function(_0x44d29b){if(_0x44d29b){_0x23aeed=_0x44d29b[_0x7f98('0x33')];if(!_0x203a53[_0x7f98('0x2f')]['hasOwnProperty'](_0x7f98('0x4e'))){_0x1453a7[_0x7f98('0x1d')]=qs[_0x7f98('0x1d')](_0x203a53['query'][_0x7f98('0x1d')]);_0x1453a7[_0x7f98('0x1e')]=qs[_0x7f98('0x1e')](_0x203a53[_0x7f98('0x2f')][_0x7f98('0x1e')]);}return _0x2d4bac[_0x7f98('0x4b')](_0x1453a7);}})[_0x7f98('0x24')](function(_0x10a5f0){if(_0x10a5f0){return _0x10a5f0?{'count':_0x23aeed,'rows':_0x10a5f0}:null;}})[_0x7f98('0x24')](respondWithResult(_0x53433a,null))[_0x7f98('0x41')](handleError(_0x53433a,null));};exports[_0x7f98('0x4f')]=function(_0x1520c9,_0x3cb03a,_0x1570a9){if(_0x1520c9['body']['id']){delete _0x1520c9[_0x7f98('0x49')]['id'];}return db[_0x7f98('0x2b')][_0x7f98('0x4c')]({'where':{'id':_0x1520c9['params']['id']}})['then'](handleEntityNotFound(_0x3cb03a,null))[_0x7f98('0x24')](function(_0x2eacc4){if(_0x2eacc4){_0x1520c9[_0x7f98('0x49')][_0x7f98('0x50')]=_0x2eacc4['id'];_0x1520c9[_0x7f98('0x49')][_0x7f98('0x51')]=integrations[_0x7f98('0x52')](_0x1520c9[_0x7f98('0x49')]['channel'],_0x1520c9[_0x7f98('0x49')][_0x7f98('0x3c')]);_0x1520c9[_0x7f98('0x49')]['Descriptions']=integrations[_0x7f98('0x53')](_0x1520c9[_0x7f98('0x49')][_0x7f98('0x54')],_0x1520c9['body'][_0x7f98('0x3c')]);return db[_0x7f98('0x4d')][_0x7f98('0x48')](_0x1520c9[_0x7f98('0x49')],{'include':[{'model':db[_0x7f98('0x55')],'as':_0x7f98('0x51')},{'model':db[_0x7f98('0x55')],'as':'Descriptions'}]});}return null;})[_0x7f98('0x24')](respondWithResult(_0x3cb03a,null))[_0x7f98('0x41')](handleError(_0x3cb03a,null));};exports[_0x7f98('0x56')]=function(_0x2229cb,_0x3b82c3,_0x279c40){var _0x2626b4;var _0x3abf17='';var _0x18f3ae=_0x7f98('0x57');return db['SalesforceAccount'][_0x7f98('0x4c')]({'where':{'id':_0x2229cb['params']['id']},'attributes':['id',_0x7f98('0x58'),'clientId',_0x7f98('0x59'),_0x7f98('0x5a'),'password',_0x7f98('0x5b')]})[_0x7f98('0x24')](handleEntityNotFound(_0x3b82c3,null))['then'](function(_0x2e369e){if(_0x2e369e){_0x3abf17=_0x2e369e[_0x7f98('0x58')];var _0x59bd7=_0x3abf17[_0x7f98('0x5c')](-0x1);if(_0x59bd7==='/'){_0x3abf17=_0x3abf17[_0x7f98('0x5d')](0x0,_0x3abf17[_0x7f98('0x5e')](_0x59bd7));}_0x2626b4=new jsforce[(_0x7f98('0x5f'))]({'oauth2':{'loginUrl':_0x3abf17,'clientId':_0x2e369e[_0x7f98('0x60')],'clientSecret':_0x2e369e[_0x7f98('0x59')]}});return _0x2626b4['login'](_0x2e369e[_0x7f98('0x5a')],_0x2e369e[_0x7f98('0x61')]['concat'](_0x2e369e[_0x7f98('0x5b')]));}})[_0x7f98('0x24')](function(_0x2f2f04){if(_0x2f2f04){if(!_[_0x7f98('0x62')](_0x2229cb[_0x7f98('0x2f')][_0x7f98('0x63')])){_0x18f3ae=_0x2229cb[_0x7f98('0x2f')][_0x7f98('0x63')];}return _0x2626b4[_0x7f98('0x64')](_0x18f3ae)[_0x7f98('0x65')]();}})['then'](function(_0x309eac){var _0x240f5a=['OwnerId',_0x7f98('0x66'),_0x7f98('0x67'),_0x7f98('0x68'),_0x7f98('0x69'),_0x7f98('0x6a')];var _0x36e927=[_0x7f98('0x6b'),_0x7f98('0x6c'),_0x7f98('0x6d'),_0x7f98('0x6e'),_0x7f98('0x6f'),_0x7f98('0x70'),_0x7f98('0x71')];if(_0x309eac){_['remove'](_0x309eac[_0x7f98('0x32')],function(_0x196b28){return _0x240f5a[_0x7f98('0x72')](_0x196b28[_0x7f98('0x27')])||!_0x36e927[_0x7f98('0x72')](_0x196b28['type']);});return{'count':_0x309eac['fields'][_0x7f98('0x33')],'rows':_[_0x7f98('0x2a')](_0x309eac[_0x7f98('0x32')],function(_0x35c7ab){return{'id':_0x35c7ab[_0x7f98('0x27')],'name':_0x35c7ab[_0x7f98('0x73')],'custom':_0x35c7ab[_0x7f98('0x74')],'options':_0x35c7ab[_0x7f98('0x75')][_0x7f98('0x33')]>0x0?_[_0x7f98('0x2a')](_0x35c7ab[_0x7f98('0x75')],function(_0x7e1378){return{'name':_0x7e1378[_0x7f98('0x73')],'value':_0x7e1378[_0x7f98('0x76')]};}):_0x35c7ab['type']=='boolean'?[{'name':'True','value':_0x7f98('0x77')},{'name':_0x7f98('0x78'),'value':_0x7f98('0x79')}]:[]};})};}})[_0x7f98('0x24')](respondWithResult(_0x3b82c3,null))[_0x7f98('0x41')](function(_0x196481){var _0x48be69=_0x2229cb[_0x7f98('0x2f')][_0x7f98('0x7a')]?0x1f4:_0x196481[_0x7f98('0x7b')]||0x1f4;logger[_0x7f98('0x25')](_0x7f98('0x7c'),'getFields',_0x48be69,JSON[_0x7f98('0x7d')](_0x196481));delete _0x196481[_0x7f98('0x27')];if(_0x48be69===0x191){_0x48be69=0x190;}_0x3b82c3[_0x7f98('0x19')](_0x48be69)[_0x7f98('0x28')](_0x2229cb[_0x7f98('0x2f')]['test']?{'message':_0x7f98('0x7e'),'statusCode':_0x196481[_0x7f98('0x7b')]}:_0x196481);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index b4635ff..011ebd8 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 _0x5216=['path','rimraf','../../config/environment','./intSalesforceAccount.attributes','exports','SalesforceAccount','int_salesforce_accounts','util','../../config/logger','api','request-promise'];(function(_0x4ceafd,_0x51639a){var _0x358c5c=function(_0x1245bd){while(--_0x1245bd){_0x4ceafd['push'](_0x4ceafd['shift']());}};_0x358c5c(++_0x51639a);}(_0x5216,0x146));var _0x6521=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5216[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x6521('0x0'));var logger=require(_0x6521('0x1'))(_0x6521('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6521('0x3'));var fs=require('fs');var path=require(_0x6521('0x4'));var rimraf=require(_0x6521('0x5'));var config=require(_0x6521('0x6'));var attributes=require(_0x6521('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x6521('0x8')]=function(_0x2ccd16,_0x5ea58a){return _0x2ccd16['define'](_0x6521('0x9'),attributes,{'tableName':_0x6521('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3222=['./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x369ebe,_0x12d0b9){var _0x4c6a77=function(_0x26f998){while(--_0x26f998){_0x369ebe['push'](_0x369ebe['shift']());}};_0x4c6a77(++_0x12d0b9);}(_0x3222,0x101));var _0x2322=function(_0x49aeec,_0x4d9a92){_0x49aeec=_0x49aeec-0x0;var _0x40886f=_0x3222[_0x49aeec];return _0x40886f;};'use strict';var _=require(_0x2322('0x0'));var util=require(_0x2322('0x1'));var logger=require(_0x2322('0x2'))(_0x2322('0x3'));var moment=require(_0x2322('0x4'));var BPromise=require(_0x2322('0x5'));var rp=require(_0x2322('0x6'));var fs=require('fs');var path=require(_0x2322('0x7'));var rimraf=require('rimraf');var config=require(_0x2322('0x8'));var attributes=require(_0x2322('0x9'));var integrations=require(_0x2322('0xa'));module[_0x2322('0xb')]=function(_0xf33115,_0x355205){return _0xf33115['define'](_0x2322('0xc'),attributes,{'tableName':_0x2322('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 0b86e24..8a7d32f 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 _0x8bdc=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','SalesforceAccount','findAll','options','raw','limit','include','attributes','map','model','GetSalesforceAccount','find','where','ShowSalesforceAccount','stringify','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8bdc,0x17a));var _0xc8bd=function(_0x19722,_0x4c7b5a){_0x19722=_0x19722-0x0;var _0x2368ef=_0x8bdc[_0x19722];return _0x2368ef;};'use strict';var _=require('lodash');var util=require(_0xc8bd('0x0'));var moment=require(_0xc8bd('0x1'));var BPromise=require(_0xc8bd('0x2'));var rs=require(_0xc8bd('0x3'));var fs=require('fs');var Redis=require(_0xc8bd('0x4'));var db=require(_0xc8bd('0x5'))['db'];var utils=require(_0xc8bd('0x6'));var logger=require(_0xc8bd('0x7'))(_0xc8bd('0x8'));var config=require(_0xc8bd('0x9'));var jayson=require(_0xc8bd('0xa'));var client=jayson[_0xc8bd('0xb')][_0xc8bd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x41ba4c,_0x451f3f,_0x490a7b){return new BPromise(function(_0x3459c0,_0x40f1d6){return client[_0xc8bd('0xd')](_0x41ba4c,_0x490a7b)[_0xc8bd('0xe')](function(_0x227e28){logger[_0xc8bd('0xf')](_0xc8bd('0x10'),_0x451f3f,'request\x20sent');logger[_0xc8bd('0x11')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x451f3f,_0xc8bd('0x12'),JSON['stringify'](_0x227e28));if(_0x227e28['error']){if(_0x227e28[_0xc8bd('0x13')][_0xc8bd('0x14')]===0x1f4){logger['error'](_0xc8bd('0x10'),_0x451f3f,_0x227e28['error'][_0xc8bd('0x15')]);return _0x40f1d6(_0x227e28[_0xc8bd('0x13')]['message']);}logger[_0xc8bd('0x13')](_0xc8bd('0x10'),_0x451f3f,_0x227e28['error'][_0xc8bd('0x15')]);return _0x3459c0(_0x227e28[_0xc8bd('0x13')][_0xc8bd('0x15')]);}else{logger[_0xc8bd('0xf')](_0xc8bd('0x10'),_0x451f3f,_0xc8bd('0x12'));_0x3459c0(_0x227e28[_0xc8bd('0x16')][_0xc8bd('0x15')]);}})[_0xc8bd('0x17')](function(_0x16ba70){logger[_0xc8bd('0x13')](_0xc8bd('0x10'),_0x451f3f,_0x16ba70);_0x40f1d6(_0x16ba70);});});}exports['GetSalesforceAccount']=function(_0x4b01c7){var _0x3a391b=this;return new Promise(function(_0x1887ab,_0x57fd8d){return db[_0xc8bd('0x18')][_0xc8bd('0x19')]({'raw':_0x4b01c7[_0xc8bd('0x1a')]?_0x4b01c7[_0xc8bd('0x1a')][_0xc8bd('0x1b')]===undefined?!![]:![]:!![],'where':_0x4b01c7[_0xc8bd('0x1a')]?_0x4b01c7[_0xc8bd('0x1a')]['where']||null:null,'attributes':_0x4b01c7[_0xc8bd('0x1a')]?_0x4b01c7[_0xc8bd('0x1a')]['attributes']||null:null,'limit':_0x4b01c7[_0xc8bd('0x1a')]?_0x4b01c7[_0xc8bd('0x1a')][_0xc8bd('0x1c')]||null:null,'include':_0x4b01c7['options']?_0x4b01c7[_0xc8bd('0x1a')][_0xc8bd('0x1d')]?_['map'](_0x4b01c7['options'][_0xc8bd('0x1d')],function(_0x1fdc7f){return{'model':db[_0x1fdc7f['model']],'as':_0x1fdc7f['as'],'attributes':_0x1fdc7f[_0xc8bd('0x1e')],'include':_0x1fdc7f[_0xc8bd('0x1d')]?_[_0xc8bd('0x1f')](_0x1fdc7f[_0xc8bd('0x1d')],function(_0x38462a){return{'model':db[_0x38462a[_0xc8bd('0x20')]],'as':_0x38462a['as'],'attributes':_0x38462a['attributes'],'include':_0x38462a[_0xc8bd('0x1d')]?_[_0xc8bd('0x1f')](_0x38462a[_0xc8bd('0x1d')],function(_0x4ecfb9){return{'model':db[_0x4ecfb9[_0xc8bd('0x20')]],'as':_0x4ecfb9['as'],'attributes':_0x4ecfb9[_0xc8bd('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc8bd('0xe')](function(_0x311637){logger[_0xc8bd('0xf')]('GetSalesforceAccount',_0x4b01c7);logger[_0xc8bd('0x11')](_0xc8bd('0x21'),_0x4b01c7,JSON['stringify'](_0x311637));_0x1887ab(_0x311637);})[_0xc8bd('0x17')](function(_0x157be6){logger[_0xc8bd('0x13')](_0xc8bd('0x21'),_0x157be6['message'],_0x4b01c7);_0x57fd8d(_0x3a391b[_0xc8bd('0x13')](0x1f4,_0x157be6['message']));});});};exports['ShowSalesforceAccount']=function(_0x13c476){var _0x50b46f=this;return new Promise(function(_0x65ea4b,_0x2e3b32){return db[_0xc8bd('0x18')][_0xc8bd('0x22')]({'raw':_0x13c476['options']?_0x13c476[_0xc8bd('0x1a')][_0xc8bd('0x1b')]===undefined?!![]:![]:!![],'where':_0x13c476['options']?_0x13c476['options'][_0xc8bd('0x23')]||null:null,'attributes':_0x13c476[_0xc8bd('0x1a')]?_0x13c476[_0xc8bd('0x1a')][_0xc8bd('0x1e')]||null:null,'include':_0x13c476[_0xc8bd('0x1a')]?_0x13c476[_0xc8bd('0x1a')]['include']?_['map'](_0x13c476[_0xc8bd('0x1a')][_0xc8bd('0x1d')],function(_0x1cfcc6){return{'model':db[_0x1cfcc6['model']],'as':_0x1cfcc6['as'],'attributes':_0x1cfcc6[_0xc8bd('0x1e')],'include':_0x1cfcc6[_0xc8bd('0x1d')]?_[_0xc8bd('0x1f')](_0x1cfcc6[_0xc8bd('0x1d')],function(_0x379eb7){return{'model':db[_0x379eb7[_0xc8bd('0x20')]],'as':_0x379eb7['as'],'attributes':_0x379eb7['attributes'],'include':_0x379eb7[_0xc8bd('0x1d')]?_[_0xc8bd('0x1f')](_0x379eb7[_0xc8bd('0x1d')],function(_0x4aad41){return{'model':db[_0x4aad41['model']],'as':_0x4aad41['as'],'attributes':_0x4aad41[_0xc8bd('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14d333){logger[_0xc8bd('0xf')](_0xc8bd('0x24'),_0x13c476);logger[_0xc8bd('0x11')]('ShowSalesforceAccount',_0x13c476,JSON[_0xc8bd('0x25')](_0x14d333));_0x65ea4b(_0x14d333);})[_0xc8bd('0x17')](function(_0x4e75cd){logger[_0xc8bd('0x13')]('ShowSalesforceAccount',_0x4e75cd[_0xc8bd('0x15')],_0x13c476);_0x2e3b32(_0x50b46f[_0xc8bd('0x13')](0x1f4,_0x4e75cd[_0xc8bd('0x15')]));});});}; \ No newline at end of file +var _0xbc12=['stringify','error','code','message','catch','GetSalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowSalesforceAccount','SalesforceAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0xbc12,0x1da));var _0x2bc1=function(_0x5ba2c8,_0x5826ef){_0x5ba2c8=_0x5ba2c8-0x0;var _0x6c177f=_0xbc12[_0x5ba2c8];return _0x6c177f;};'use strict';var _=require(_0x2bc1('0x0'));var util=require(_0x2bc1('0x1'));var moment=require(_0x2bc1('0x2'));var BPromise=require(_0x2bc1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2bc1('0x4'));var db=require(_0x2bc1('0x5'))['db'];var utils=require(_0x2bc1('0x6'));var logger=require(_0x2bc1('0x7'))(_0x2bc1('0x8'));var config=require(_0x2bc1('0x9'));var jayson=require(_0x2bc1('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4c2c43,_0x563d39,_0x592e6a){return new BPromise(function(_0x49b0be,_0x131ac8){return client[_0x2bc1('0xb')](_0x4c2c43,_0x592e6a)[_0x2bc1('0xc')](function(_0x4384c3){logger[_0x2bc1('0xd')](_0x2bc1('0xe'),_0x563d39,_0x2bc1('0xf'));logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x563d39,_0x2bc1('0xf'),JSON[_0x2bc1('0x10')](_0x4384c3));if(_0x4384c3[_0x2bc1('0x11')]){if(_0x4384c3[_0x2bc1('0x11')][_0x2bc1('0x12')]===0x1f4){logger['error'](_0x2bc1('0xe'),_0x563d39,_0x4384c3[_0x2bc1('0x11')][_0x2bc1('0x13')]);return _0x131ac8(_0x4384c3[_0x2bc1('0x11')]['message']);}logger[_0x2bc1('0x11')](_0x2bc1('0xe'),_0x563d39,_0x4384c3['error'][_0x2bc1('0x13')]);return _0x49b0be(_0x4384c3['error'][_0x2bc1('0x13')]);}else{logger['info'](_0x2bc1('0xe'),_0x563d39,'request\x20sent');_0x49b0be(_0x4384c3['result']['message']);}})[_0x2bc1('0x14')](function(_0x53bb15){logger[_0x2bc1('0x11')](_0x2bc1('0xe'),_0x563d39,_0x53bb15);_0x131ac8(_0x53bb15);});});}exports[_0x2bc1('0x15')]=function(_0x1e72b8){var _0x5d1191=this;return new Promise(function(_0xb7ad4c,_0x1d39b0){return db['SalesforceAccount'][_0x2bc1('0x16')]({'raw':_0x1e72b8['options']?_0x1e72b8[_0x2bc1('0x17')][_0x2bc1('0x18')]===undefined?!![]:![]:!![],'where':_0x1e72b8[_0x2bc1('0x17')]?_0x1e72b8[_0x2bc1('0x17')][_0x2bc1('0x19')]||null:null,'attributes':_0x1e72b8['options']?_0x1e72b8['options'][_0x2bc1('0x1a')]||null:null,'limit':_0x1e72b8['options']?_0x1e72b8[_0x2bc1('0x17')][_0x2bc1('0x1b')]||null:null,'include':_0x1e72b8['options']?_0x1e72b8['options'][_0x2bc1('0x1c')]?_[_0x2bc1('0x1d')](_0x1e72b8[_0x2bc1('0x17')][_0x2bc1('0x1c')],function(_0x4b9c60){return{'model':db[_0x4b9c60[_0x2bc1('0x1e')]],'as':_0x4b9c60['as'],'attributes':_0x4b9c60[_0x2bc1('0x1a')],'include':_0x4b9c60[_0x2bc1('0x1c')]?_[_0x2bc1('0x1d')](_0x4b9c60[_0x2bc1('0x1c')],function(_0x5b8bde){return{'model':db[_0x5b8bde['model']],'as':_0x5b8bde['as'],'attributes':_0x5b8bde[_0x2bc1('0x1a')],'include':_0x5b8bde['include']?_[_0x2bc1('0x1d')](_0x5b8bde[_0x2bc1('0x1c')],function(_0x251fbf){return{'model':db[_0x251fbf['model']],'as':_0x251fbf['as'],'attributes':_0x251fbf[_0x2bc1('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2bc1('0xc')](function(_0x183f4c){logger[_0x2bc1('0xd')](_0x2bc1('0x15'),_0x1e72b8);logger[_0x2bc1('0x1f')](_0x2bc1('0x15'),_0x1e72b8,JSON[_0x2bc1('0x10')](_0x183f4c));_0xb7ad4c(_0x183f4c);})[_0x2bc1('0x14')](function(_0x348654){logger[_0x2bc1('0x11')](_0x2bc1('0x15'),_0x348654[_0x2bc1('0x13')],_0x1e72b8);_0x1d39b0(_0x5d1191[_0x2bc1('0x11')](0x1f4,_0x348654[_0x2bc1('0x13')]));});});};exports[_0x2bc1('0x20')]=function(_0x486d4c){var _0x4d956a=this;return new Promise(function(_0x1cbc76,_0x388dcd){return db[_0x2bc1('0x21')][_0x2bc1('0x22')]({'raw':_0x486d4c['options']?_0x486d4c[_0x2bc1('0x17')][_0x2bc1('0x18')]===undefined?!![]:![]:!![],'where':_0x486d4c[_0x2bc1('0x17')]?_0x486d4c['options'][_0x2bc1('0x19')]||null:null,'attributes':_0x486d4c[_0x2bc1('0x17')]?_0x486d4c[_0x2bc1('0x17')]['attributes']||null:null,'include':_0x486d4c[_0x2bc1('0x17')]?_0x486d4c[_0x2bc1('0x17')][_0x2bc1('0x1c')]?_[_0x2bc1('0x1d')](_0x486d4c[_0x2bc1('0x17')][_0x2bc1('0x1c')],function(_0x3fa8f8){return{'model':db[_0x3fa8f8[_0x2bc1('0x1e')]],'as':_0x3fa8f8['as'],'attributes':_0x3fa8f8[_0x2bc1('0x1a')],'include':_0x3fa8f8['include']?_[_0x2bc1('0x1d')](_0x3fa8f8['include'],function(_0x1d8421){return{'model':db[_0x1d8421[_0x2bc1('0x1e')]],'as':_0x1d8421['as'],'attributes':_0x1d8421[_0x2bc1('0x1a')],'include':_0x1d8421[_0x2bc1('0x1c')]?_[_0x2bc1('0x1d')](_0x1d8421[_0x2bc1('0x1c')],function(_0xba626c){return{'model':db[_0xba626c['model']],'as':_0xba626c['as'],'attributes':_0xba626c[_0x2bc1('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2bc1('0xc')](function(_0x2746ed){logger[_0x2bc1('0xd')](_0x2bc1('0x20'),_0x486d4c);logger['debug'](_0x2bc1('0x20'),_0x486d4c,JSON[_0x2bc1('0x10')](_0x2746ed));_0x1cbc76(_0x2746ed);})['catch'](function(_0x3c22de){logger['error'](_0x2bc1('0x20'),_0x3c22de[_0x2bc1('0x13')],_0x486d4c);_0x388dcd(_0x4d956a[_0x2bc1('0x11')](0x1f4,_0x3c22de[_0x2bc1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index c2a73ce..72ed962 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1db831,_0x42b7b5){_0x1db831=_0x1db831-0x0;var _0x39ba56=_0x0b0e[_0x1db831];return _0x39ba56;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file +var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x16e07b,_0x1086ae){var _0x229df6=function(_0x52d2a2){while(--_0x52d2a2){_0x16e07b['push'](_0x16e07b['shift']());}};_0x229df6(++_0x1086ae);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x5f66[_0x4cf98e];return _0x1623ac;};'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 c643542..5e31483 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 _0x9901=['contact','lead','account_contact_lead','account','nothing','sequelize','exports','STRING','ENUM','Task','Case','contact_lead'];(function(_0x1cab41,_0x4bfa57){var _0x511deb=function(_0x3d1a43){while(--_0x3d1a43){_0x1cab41['push'](_0x1cab41['shift']());}};_0x511deb(++_0x4bfa57);}(_0x9901,0x191));var _0x1990=function(_0x2050f7,_0x3833c6){_0x2050f7=_0x2050f7-0x0;var _0x219da1=_0x9901[_0x2050f7];return _0x219da1;};'use strict';var Sequelize=require(_0x1990('0x0'));module[_0x1990('0x1')]={'name':{'type':Sequelize[_0x1990('0x2')]},'description':{'type':Sequelize[_0x1990('0x2')]},'ticketType':{'type':Sequelize[_0x1990('0x3')](_0x1990('0x4'),_0x1990('0x5')),'defaultValue':_0x1990('0x4')},'moduleSearch':{'type':Sequelize[_0x1990('0x3')](_0x1990('0x6'),_0x1990('0x7'),_0x1990('0x8'),_0x1990('0x9'),_0x1990('0xa')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x1990('0x3')](_0x1990('0xb'),_0x1990('0x7'),_0x1990('0x8'),'account'),'defaultValue':_0x1990('0x8')},'leadId':{'type':Sequelize[_0x1990('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x1990('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x1990('0x2')]}}; \ No newline at end of file +var _0x6416=['Task','contact_lead','contact','lead','account','sequelize','exports','STRING','ENUM'];(function(_0x415976,_0x3546f2){var _0x1f9a34=function(_0x57e8e2){while(--_0x57e8e2){_0x415976['push'](_0x415976['shift']());}};_0x1f9a34(++_0x3546f2);}(_0x6416,0x10a));var _0x6641=function(_0x406227,_0x3ab53e){_0x406227=_0x406227-0x0;var _0x12c759=_0x6416[_0x406227];return _0x12c759;};'use strict';var Sequelize=require(_0x6641('0x0'));module[_0x6641('0x1')]={'name':{'type':Sequelize[_0x6641('0x2')]},'description':{'type':Sequelize[_0x6641('0x2')]},'ticketType':{'type':Sequelize[_0x6641('0x3')](_0x6641('0x4'),'Case'),'defaultValue':_0x6641('0x4')},'moduleSearch':{'type':Sequelize[_0x6641('0x3')](_0x6641('0x5'),_0x6641('0x6'),_0x6641('0x7'),'account_contact_lead',_0x6641('0x8')),'defaultValue':_0x6641('0x5')},'moduleCreate':{'type':Sequelize[_0x6641('0x3')]('nothing',_0x6641('0x6'),_0x6641('0x7'),'account'),'defaultValue':'lead'},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x6641('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x6641('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index dd440ca..f95a914 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 _0x693d=['params','findOne','pick','getFields','getSubjects','SalesforceField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','include','findAll','rows','catch','length','includeAll','find','body'];(function(_0x3e349c,_0x19ea72){var _0x56b281=function(_0x49757a){while(--_0x49757a){_0x3e349c['push'](_0x3e349c['shift']());}};_0x56b281(++_0x19ea72);}(_0x693d,0x153));var _0xd693=function(_0x2181d2,_0x33ff0e){_0x2181d2=_0x2181d2-0x0;var _0x52e2bb=_0x693d[_0x2181d2];return _0x52e2bb;};'use strict';var emlformat=require(_0xd693('0x0'));var rimraf=require(_0xd693('0x1'));var zipdir=require(_0xd693('0x2'));var jsonpatch=require(_0xd693('0x3'));var rp=require(_0xd693('0x4'));var moment=require(_0xd693('0x5'));var BPromise=require(_0xd693('0x6'));var Mustache=require(_0xd693('0x7'));var util=require(_0xd693('0x8'));var path=require('path');var sox=require(_0xd693('0x9'));var csv=require(_0xd693('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd693('0xb'));var squel=require(_0xd693('0xc'));var crypto=require(_0xd693('0xd'));var jsforce=require(_0xd693('0xe'));var deskjs=require(_0xd693('0xf'));var toCsv=require(_0xd693('0xa'));var querystring=require(_0xd693('0x10'));var Papa=require(_0xd693('0x11'));var Redis=require(_0xd693('0x12'));var authService=require(_0xd693('0x13'));var qs=require(_0xd693('0x14'));var as=require(_0xd693('0x15'));var hardwareService=require(_0xd693('0x16'));var logger=require(_0xd693('0x17'))(_0xd693('0x18'));var utils=require(_0xd693('0x19'));var config=require(_0xd693('0x1a'));var licenseUtil=require(_0xd693('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f6b98,_0x1f436e){_0x1f436e=_0x1f436e||0xcc;return function(_0x511be5){if(_0x511be5){return _0x4f6b98[_0xd693('0x1c')](_0x1f436e);}return _0x4f6b98[_0xd693('0x1d')](_0x1f436e)[_0xd693('0x1e')]();};}function respondWithResult(_0x53b9f1,_0x4b1d5c){_0x4b1d5c=_0x4b1d5c||0xc8;return function(_0x2eac81){if(_0x2eac81){return _0x53b9f1[_0xd693('0x1d')](_0x4b1d5c)[_0xd693('0x1f')](_0x2eac81);}};}function respondWithFilteredResult(_0x1452da,_0x1e3486){return function(_0xc87778){if(_0xc87778){var _0x4241db=typeof _0x1e3486[_0xd693('0x20')]===_0xd693('0x21')&&typeof _0x1e3486[_0xd693('0x22')]==='undefined';var _0x13d16a=_0xc87778[_0xd693('0x23')];var _0x4dca92=_0x4241db?0x0:_0x1e3486[_0xd693('0x20')];var _0x40b3b1=_0x4241db?_0xc87778['count']:_0x1e3486[_0xd693('0x20')]+_0x1e3486[_0xd693('0x22')];var _0x4eac2c;if(_0x40b3b1>=_0x13d16a){_0x40b3b1=_0x13d16a;_0x4eac2c=0xc8;}else{_0x4eac2c=0xce;}_0x1452da[_0xd693('0x1d')](_0x4eac2c);return _0x1452da['set'](_0xd693('0x24'),_0x4dca92+'-'+_0x40b3b1+'/'+_0x13d16a)['json'](_0xc87778);}return null;};}function patchUpdates(_0x5eb350){return function(_0x5ebd13){try{jsonpatch[_0xd693('0x25')](_0x5ebd13,_0x5eb350,!![]);}catch(_0x52e1ee){return BPromise[_0xd693('0x26')](_0x52e1ee);}return _0x5ebd13['save']();};}function saveUpdates(_0x57ba51,_0x51c1b7){return function(_0x5286f5){if(_0x5286f5){return _0x5286f5[_0xd693('0x27')](_0x57ba51)[_0xd693('0x28')](function(_0x17180b){return _0x17180b;});}return null;};}function removeEntity(_0x53fe43,_0x3b847e){return function(_0x479820){if(_0x479820){return _0x479820[_0xd693('0x29')]()[_0xd693('0x28')](function(){_0x53fe43[_0xd693('0x1d')](0xcc)[_0xd693('0x1e')]();});}};}function handleEntityNotFound(_0x272bb4,_0x5f153a){return function(_0x3bb656){if(!_0x3bb656){_0x272bb4['sendStatus'](0x194);}return _0x3bb656;};}function handleError(_0x1b87eb,_0x325845){_0x325845=_0x325845||0x1f4;return function(_0x192fd3){logger[_0xd693('0x2a')](_0x192fd3[_0xd693('0x2b')]);if(_0x192fd3[_0xd693('0x2c')]){delete _0x192fd3[_0xd693('0x2c')];}_0x1b87eb[_0xd693('0x1d')](_0x325845)[_0xd693('0x2d')](_0x192fd3);};}exports[_0xd693('0x2e')]=function(_0x1875f1,_0x2814a8){var _0x5776d4={},_0x2ee501={},_0x44dd4b={'count':0x0,'rows':[]};var _0x57490f=_[_0xd693('0x2f')](db[_0xd693('0x30')][_0xd693('0x31')],function(_0x2106cd){return{'name':_0x2106cd[_0xd693('0x32')],'type':_0x2106cd[_0xd693('0x33')][_0xd693('0x34')]};});_0x2ee501[_0xd693('0x35')]=_[_0xd693('0x2f')](_0x57490f,_0xd693('0x2c'));_0x2ee501[_0xd693('0x36')]=_[_0xd693('0x37')](_0x1875f1[_0xd693('0x36')]);_0x2ee501[_0xd693('0x38')]=_[_0xd693('0x39')](_0x2ee501[_0xd693('0x35')],_0x2ee501[_0xd693('0x36')]);_0x5776d4['attributes']=_[_0xd693('0x39')](_0x2ee501[_0xd693('0x35')],qs['fields'](_0x1875f1[_0xd693('0x36')][_0xd693('0x3a')]));_0x5776d4[_0xd693('0x3b')]=_0x5776d4['attributes']['length']?_0x5776d4[_0xd693('0x3b')]:_0x2ee501[_0xd693('0x35')];if(!_0x1875f1[_0xd693('0x36')][_0xd693('0x3c')](_0xd693('0x3d'))){_0x5776d4[_0xd693('0x22')]=qs[_0xd693('0x22')](_0x1875f1['query'][_0xd693('0x22')]);_0x5776d4[_0xd693('0x20')]=qs[_0xd693('0x20')](_0x1875f1[_0xd693('0x36')][_0xd693('0x20')]);}_0x5776d4[_0xd693('0x3e')]=qs['sort'](_0x1875f1[_0xd693('0x36')][_0xd693('0x3f')]);_0x5776d4['where']=qs['filters'](_['pick'](_0x1875f1[_0xd693('0x36')],_0x2ee501['filters']),_0x57490f);if(_0x1875f1[_0xd693('0x36')][_0xd693('0x40')]){_0x5776d4[_0xd693('0x41')]=_[_0xd693('0x42')](_0x5776d4[_0xd693('0x41')],{'$or':_[_0xd693('0x2f')](_0x57490f,function(_0x6b9a6d){if(_0x6b9a6d[_0xd693('0x33')]!=='VIRTUAL'){var _0x2a024e={};_0x2a024e[_0x6b9a6d[_0xd693('0x2c')]]={'$like':'%'+_0x1875f1['query'][_0xd693('0x40')]+'%'};return _0x2a024e;}})});}_0x5776d4=_['merge']({},_0x5776d4,_0x1875f1[_0xd693('0x43')]);var _0x2514c2={'where':_0x5776d4[_0xd693('0x41')]};return db[_0xd693('0x30')][_0xd693('0x23')](_0x2514c2)[_0xd693('0x28')](function(_0x110de3){_0x44dd4b[_0xd693('0x23')]=_0x110de3;if(_0x1875f1[_0xd693('0x36')]['includeAll']){_0x5776d4[_0xd693('0x44')]=[{'all':!![]}];}return db[_0xd693('0x30')][_0xd693('0x45')](_0x5776d4);})[_0xd693('0x28')](function(_0x30ee49){_0x44dd4b[_0xd693('0x46')]=_0x30ee49;return _0x44dd4b;})[_0xd693('0x28')](respondWithFilteredResult(_0x2814a8,_0x5776d4))[_0xd693('0x47')](handleError(_0x2814a8,null));};exports['show']=function(_0x48e43f,_0x3bf16b){var _0x506c9e={'raw':![],'where':{'id':_0x48e43f['params']['id']}},_0x28397b={};_0x28397b[_0xd693('0x35')]=_[_0xd693('0x37')](db[_0xd693('0x30')][_0xd693('0x31')]);_0x28397b[_0xd693('0x36')]=_[_0xd693('0x37')](_0x48e43f[_0xd693('0x36')]);_0x28397b[_0xd693('0x38')]=_[_0xd693('0x39')](_0x28397b[_0xd693('0x35')],_0x28397b[_0xd693('0x36')]);_0x506c9e[_0xd693('0x3b')]=_['intersection'](_0x28397b[_0xd693('0x35')],qs[_0xd693('0x3a')](_0x48e43f[_0xd693('0x36')][_0xd693('0x3a')]));_0x506c9e[_0xd693('0x3b')]=_0x506c9e[_0xd693('0x3b')][_0xd693('0x48')]?_0x506c9e[_0xd693('0x3b')]:_0x28397b[_0xd693('0x35')];if(_0x48e43f[_0xd693('0x36')][_0xd693('0x49')]){_0x506c9e[_0xd693('0x44')]=[{'all':!![]}];}_0x506c9e=_[_0xd693('0x42')]({},_0x506c9e,_0x48e43f[_0xd693('0x43')]);return db[_0xd693('0x30')][_0xd693('0x4a')](_0x506c9e)['then'](handleEntityNotFound(_0x3bf16b,null))['then'](respondWithResult(_0x3bf16b,null))['catch'](handleError(_0x3bf16b,null));};exports['create']=function(_0x38524b,_0x57333c){return db[_0xd693('0x30')]['create'](_0x38524b['body'],{})[_0xd693('0x28')](respondWithResult(_0x57333c,0xc9))[_0xd693('0x47')](handleError(_0x57333c,null));};exports['update']=function(_0x531a9d,_0x1d1ff4){if(_0x531a9d[_0xd693('0x4b')]['id']){delete _0x531a9d[_0xd693('0x4b')]['id'];}return db['SalesforceConfiguration'][_0xd693('0x4a')]({'where':{'id':_0x531a9d['params']['id']}})['then'](handleEntityNotFound(_0x1d1ff4,null))[_0xd693('0x28')](saveUpdates(_0x531a9d[_0xd693('0x4b')],null))[_0xd693('0x28')](respondWithResult(_0x1d1ff4,null))[_0xd693('0x47')](handleError(_0x1d1ff4,null));};exports[_0xd693('0x29')]=function(_0x590452,_0x567a24){return db['SalesforceConfiguration'][_0xd693('0x4a')]({'where':{'id':_0x590452[_0xd693('0x4c')]['id']}})['then'](handleEntityNotFound(_0x567a24,null))[_0xd693('0x28')](removeEntity(_0x567a24,null))[_0xd693('0x47')](handleError(_0x567a24,null));};exports['getFields']=function(_0x28bd7b,_0x3fac33,_0x557682){var _0x1efdda={};var _0x4dc090={};var _0x244d25;var _0x3e4d92;return db['SalesforceConfiguration'][_0xd693('0x4d')]({'where':{'id':_0x28bd7b[_0xd693('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3fac33,null))[_0xd693('0x28')](function(_0x155c2d){if(_0x155c2d){_0x244d25=_0x155c2d;_0x4dc090[_0xd693('0x35')]=_['keys'](db['SalesforceField'][_0xd693('0x31')]);_0x4dc090[_0xd693('0x36')]=_[_0xd693('0x37')](_0x28bd7b['query']);_0x4dc090[_0xd693('0x38')]=_['intersection'](_0x4dc090[_0xd693('0x35')],_0x4dc090[_0xd693('0x36')]);_0x1efdda[_0xd693('0x3b')]=_[_0xd693('0x39')](_0x4dc090[_0xd693('0x35')],qs[_0xd693('0x3a')](_0x28bd7b[_0xd693('0x36')][_0xd693('0x3a')]));_0x1efdda[_0xd693('0x3b')]=_0x1efdda[_0xd693('0x3b')][_0xd693('0x48')]?_0x1efdda['attributes']:_0x4dc090[_0xd693('0x35')];_0x1efdda[_0xd693('0x3e')]=qs[_0xd693('0x3f')](_0x28bd7b[_0xd693('0x36')][_0xd693('0x3f')]);_0x1efdda['where']=qs[_0xd693('0x38')](_[_0xd693('0x4e')](_0x28bd7b['query'],_0x4dc090['filters']));if(_0x28bd7b[_0xd693('0x36')]['filter']){_0x1efdda[_0xd693('0x41')]=_[_0xd693('0x42')](_0x1efdda['where'],{'$or':_['map'](_0x1efdda[_0xd693('0x3b')],function(_0x56b304){var _0x5c1d47={};_0x5c1d47[_0x56b304]={'$like':'%'+_0x28bd7b[_0xd693('0x36')]['filter']+'%'};return _0x5c1d47;})});}_0x1efdda=_[_0xd693('0x42')]({},_0x1efdda,_0x28bd7b[_0xd693('0x43')]);return _0x244d25[_0xd693('0x4f')](_0x1efdda);}})[_0xd693('0x28')](function(_0x454e21){if(_0x454e21){_0x3e4d92=_0x454e21['length'];if(!_0x28bd7b['query']['hasOwnProperty'](_0xd693('0x3d'))){_0x1efdda[_0xd693('0x22')]=qs[_0xd693('0x22')](_0x28bd7b['query']['limit']);_0x1efdda[_0xd693('0x20')]=qs[_0xd693('0x20')](_0x28bd7b[_0xd693('0x36')][_0xd693('0x20')]);}return _0x244d25[_0xd693('0x4f')](_0x1efdda);}})['then'](function(_0x431c7f){if(_0x431c7f){return _0x431c7f?{'count':_0x3e4d92,'rows':_0x431c7f}:null;}})[_0xd693('0x28')](respondWithResult(_0x3fac33,null))[_0xd693('0x47')](handleError(_0x3fac33,null));};exports['getSubjects']=function(_0x41af01,_0x5974af,_0x468dec){var _0x1ceb55={};var _0x4a66da={};var _0x24ed7a;var _0x42f5cc;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x41af01[_0xd693('0x4c')]['id']}})[_0xd693('0x28')](handleEntityNotFound(_0x5974af,null))[_0xd693('0x28')](function(_0x284ab2){if(_0x284ab2){_0x24ed7a=_0x284ab2;_0x4a66da[_0xd693('0x35')]=_[_0xd693('0x37')](db['SalesforceField'][_0xd693('0x31')]);_0x4a66da[_0xd693('0x36')]=_[_0xd693('0x37')](_0x41af01[_0xd693('0x36')]);_0x4a66da[_0xd693('0x38')]=_[_0xd693('0x39')](_0x4a66da[_0xd693('0x35')],_0x4a66da[_0xd693('0x36')]);_0x1ceb55[_0xd693('0x3b')]=_[_0xd693('0x39')](_0x4a66da[_0xd693('0x35')],qs[_0xd693('0x3a')](_0x41af01[_0xd693('0x36')][_0xd693('0x3a')]));_0x1ceb55[_0xd693('0x3b')]=_0x1ceb55['attributes'][_0xd693('0x48')]?_0x1ceb55[_0xd693('0x3b')]:_0x4a66da[_0xd693('0x35')];_0x1ceb55[_0xd693('0x3e')]=qs[_0xd693('0x3f')](_0x41af01[_0xd693('0x36')][_0xd693('0x3f')]);_0x1ceb55['where']=qs[_0xd693('0x38')](_[_0xd693('0x4e')](_0x41af01[_0xd693('0x36')],_0x4a66da[_0xd693('0x38')]));if(_0x41af01['query'][_0xd693('0x40')]){_0x1ceb55[_0xd693('0x41')]=_['merge'](_0x1ceb55['where'],{'$or':_[_0xd693('0x2f')](_0x1ceb55[_0xd693('0x3b')],function(_0xf32c91){var _0x1259b2={};_0x1259b2[_0xf32c91]={'$like':'%'+_0x41af01['query'][_0xd693('0x40')]+'%'};return _0x1259b2;})});}_0x1ceb55=_[_0xd693('0x42')]({},_0x1ceb55,_0x41af01['options']);return _0x24ed7a[_0xd693('0x50')](_0x1ceb55);}})[_0xd693('0x28')](function(_0x8348fc){if(_0x8348fc){_0x42f5cc=_0x8348fc['length'];if(!_0x41af01[_0xd693('0x36')]['hasOwnProperty'](_0xd693('0x3d'))){_0x1ceb55[_0xd693('0x22')]=qs[_0xd693('0x22')](_0x41af01['query']['limit']);_0x1ceb55[_0xd693('0x20')]=qs[_0xd693('0x20')](_0x41af01[_0xd693('0x36')][_0xd693('0x20')]);}return _0x24ed7a[_0xd693('0x50')](_0x1ceb55);}})['then'](function(_0x649af9){if(_0x649af9){return _0x649af9?{'count':_0x42f5cc,'rows':_0x649af9}:null;}})[_0xd693('0x28')](respondWithResult(_0x5974af,null))[_0xd693('0x47')](handleError(_0x5974af,null));};exports['getDescriptions']=function(_0x23cd37,_0x5281a5,_0x56bebe){var _0xe02841={};var _0xd033cd={};var _0x17775c;var _0x17ae53;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x23cd37['params']['id']}})[_0xd693('0x28')](handleEntityNotFound(_0x5281a5,null))[_0xd693('0x28')](function(_0x58da5f){if(_0x58da5f){_0x17775c=_0x58da5f;_0xd033cd[_0xd693('0x35')]=_[_0xd693('0x37')](db[_0xd693('0x51')][_0xd693('0x31')]);_0xd033cd[_0xd693('0x36')]=_[_0xd693('0x37')](_0x23cd37[_0xd693('0x36')]);_0xd033cd[_0xd693('0x38')]=_[_0xd693('0x39')](_0xd033cd[_0xd693('0x35')],_0xd033cd[_0xd693('0x36')]);_0xe02841[_0xd693('0x3b')]=_['intersection'](_0xd033cd[_0xd693('0x35')],qs[_0xd693('0x3a')](_0x23cd37[_0xd693('0x36')][_0xd693('0x3a')]));_0xe02841[_0xd693('0x3b')]=_0xe02841[_0xd693('0x3b')][_0xd693('0x48')]?_0xe02841[_0xd693('0x3b')]:_0xd033cd['model'];_0xe02841[_0xd693('0x3e')]=qs[_0xd693('0x3f')](_0x23cd37[_0xd693('0x36')][_0xd693('0x3f')]);_0xe02841['where']=qs[_0xd693('0x38')](_[_0xd693('0x4e')](_0x23cd37[_0xd693('0x36')],_0xd033cd[_0xd693('0x38')]));if(_0x23cd37[_0xd693('0x36')][_0xd693('0x40')]){_0xe02841[_0xd693('0x41')]=_[_0xd693('0x42')](_0xe02841[_0xd693('0x41')],{'$or':_[_0xd693('0x2f')](_0xe02841[_0xd693('0x3b')],function(_0x32f7e0){var _0x4b6c9a={};_0x4b6c9a[_0x32f7e0]={'$like':'%'+_0x23cd37['query'][_0xd693('0x40')]+'%'};return _0x4b6c9a;})});}_0xe02841=_[_0xd693('0x42')]({},_0xe02841,_0x23cd37['options']);return _0x17775c[_0xd693('0x52')](_0xe02841);}})[_0xd693('0x28')](function(_0x4a3668){if(_0x4a3668){_0x17ae53=_0x4a3668['length'];if(!_0x23cd37[_0xd693('0x36')][_0xd693('0x3c')](_0xd693('0x3d'))){_0xe02841['limit']=qs[_0xd693('0x22')](_0x23cd37[_0xd693('0x36')]['limit']);_0xe02841['offset']=qs[_0xd693('0x20')](_0x23cd37[_0xd693('0x36')][_0xd693('0x20')]);}return _0x17775c['getDescriptions'](_0xe02841);}})[_0xd693('0x28')](function(_0x2ab139){if(_0x2ab139){return _0x2ab139?{'count':_0x17ae53,'rows':_0x2ab139}:null;}})[_0xd693('0x28')](respondWithResult(_0x5281a5,null))['catch'](handleError(_0x5281a5,null));}; \ No newline at end of file +var _0xed1c=['body','destroy','getFields','findOne','pick','getSubjects','SalesforceField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','then','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','show','params','length','find','create','catch'];(function(_0x5498eb,_0x3eb318){var _0x60ee32=function(_0x34fb0f){while(--_0x34fb0f){_0x5498eb['push'](_0x5498eb['shift']());}};_0x60ee32(++_0x3eb318);}(_0xed1c,0xf5));var _0xced1=function(_0x2979d3,_0x54ff61){_0x2979d3=_0x2979d3-0x0;var _0x2a9a36=_0xed1c[_0x2979d3];return _0x2a9a36;};'use strict';var emlformat=require(_0xced1('0x0'));var rimraf=require(_0xced1('0x1'));var zipdir=require(_0xced1('0x2'));var jsonpatch=require(_0xced1('0x3'));var rp=require(_0xced1('0x4'));var moment=require(_0xced1('0x5'));var BPromise=require(_0xced1('0x6'));var Mustache=require(_0xced1('0x7'));var util=require(_0xced1('0x8'));var path=require(_0xced1('0x9'));var sox=require('sox');var csv=require(_0xced1('0xa'));var ejs=require(_0xced1('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xced1('0xc'));var squel=require(_0xced1('0xd'));var crypto=require('crypto');var jsforce=require(_0xced1('0xe'));var deskjs=require(_0xced1('0xf'));var toCsv=require(_0xced1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xced1('0x10'));var authService=require(_0xced1('0x11'));var qs=require(_0xced1('0x12'));var as=require(_0xced1('0x13'));var hardwareService=require(_0xced1('0x14'));var logger=require('../../config/logger')(_0xced1('0x15'));var utils=require(_0xced1('0x16'));var config=require(_0xced1('0x17'));var licenseUtil=require(_0xced1('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c9d2e,_0x2d27e0){_0x2d27e0=_0x2d27e0||0xcc;return function(_0x1c8780){if(_0x1c8780){return _0x3c9d2e[_0xced1('0x19')](_0x2d27e0);}return _0x3c9d2e[_0xced1('0x1a')](_0x2d27e0)[_0xced1('0x1b')]();};}function respondWithResult(_0x2b06ce,_0x3be893){_0x3be893=_0x3be893||0xc8;return function(_0x2b2999){if(_0x2b2999){return _0x2b06ce[_0xced1('0x1a')](_0x3be893)[_0xced1('0x1c')](_0x2b2999);}};}function respondWithFilteredResult(_0x487de1,_0x1f2f86){return function(_0x3e7991){if(_0x3e7991){var _0x1bb554=typeof _0x1f2f86[_0xced1('0x1d')]===_0xced1('0x1e')&&typeof _0x1f2f86['limit']===_0xced1('0x1e');var _0x44afb0=_0x3e7991[_0xced1('0x1f')];var _0x369b58=_0x1bb554?0x0:_0x1f2f86[_0xced1('0x1d')];var _0x3c1893=_0x1bb554?_0x3e7991[_0xced1('0x1f')]:_0x1f2f86[_0xced1('0x1d')]+_0x1f2f86[_0xced1('0x20')];var _0x3d4a5b;if(_0x3c1893>=_0x44afb0){_0x3c1893=_0x44afb0;_0x3d4a5b=0xc8;}else{_0x3d4a5b=0xce;}_0x487de1[_0xced1('0x1a')](_0x3d4a5b);return _0x487de1['set']('Content-Range',_0x369b58+'-'+_0x3c1893+'/'+_0x44afb0)[_0xced1('0x1c')](_0x3e7991);}return null;};}function patchUpdates(_0x4256be){return function(_0x1a3d63){try{jsonpatch[_0xced1('0x21')](_0x1a3d63,_0x4256be,!![]);}catch(_0x29a7c5){return BPromise[_0xced1('0x22')](_0x29a7c5);}return _0x1a3d63[_0xced1('0x23')]();};}function saveUpdates(_0x23928a,_0x200849){return function(_0x3014b4){if(_0x3014b4){return _0x3014b4[_0xced1('0x24')](_0x23928a)[_0xced1('0x25')](function(_0x207cb6){return _0x207cb6;});}return null;};}function removeEntity(_0x89a833,_0x3bd498){return function(_0x4864a2){if(_0x4864a2){return _0x4864a2['destroy']()[_0xced1('0x25')](function(){_0x89a833[_0xced1('0x1a')](0xcc)[_0xced1('0x1b')]();});}};}function handleEntityNotFound(_0x148d44,_0x43d488){return function(_0x4bee42){if(!_0x4bee42){_0x148d44['sendStatus'](0x194);}return _0x4bee42;};}function handleError(_0x26ce27,_0x4701a2){_0x4701a2=_0x4701a2||0x1f4;return function(_0x103112){logger['error'](_0x103112[_0xced1('0x26')]);if(_0x103112['name']){delete _0x103112[_0xced1('0x27')];}_0x26ce27['status'](_0x4701a2)[_0xced1('0x28')](_0x103112);};}exports[_0xced1('0x29')]=function(_0x1e8464,_0x4480ef){var _0x542c67={},_0x570aae={},_0x536877={'count':0x0,'rows':[]};var _0x5e9586=_[_0xced1('0x2a')](db[_0xced1('0x2b')][_0xced1('0x2c')],function(_0x29b022){return{'name':_0x29b022['fieldName'],'type':_0x29b022[_0xced1('0x2d')][_0xced1('0x2e')]};});_0x570aae[_0xced1('0x2f')]=_[_0xced1('0x2a')](_0x5e9586,_0xced1('0x27'));_0x570aae[_0xced1('0x30')]=_[_0xced1('0x31')](_0x1e8464[_0xced1('0x30')]);_0x570aae[_0xced1('0x32')]=_[_0xced1('0x33')](_0x570aae[_0xced1('0x2f')],_0x570aae[_0xced1('0x30')]);_0x542c67[_0xced1('0x34')]=_[_0xced1('0x33')](_0x570aae['model'],qs[_0xced1('0x35')](_0x1e8464[_0xced1('0x30')][_0xced1('0x35')]));_0x542c67[_0xced1('0x34')]=_0x542c67[_0xced1('0x34')]['length']?_0x542c67[_0xced1('0x34')]:_0x570aae[_0xced1('0x2f')];if(!_0x1e8464['query'][_0xced1('0x36')](_0xced1('0x37'))){_0x542c67[_0xced1('0x20')]=qs[_0xced1('0x20')](_0x1e8464['query'][_0xced1('0x20')]);_0x542c67[_0xced1('0x1d')]=qs[_0xced1('0x1d')](_0x1e8464[_0xced1('0x30')][_0xced1('0x1d')]);}_0x542c67[_0xced1('0x38')]=qs['sort'](_0x1e8464[_0xced1('0x30')][_0xced1('0x39')]);_0x542c67[_0xced1('0x3a')]=qs[_0xced1('0x32')](_['pick'](_0x1e8464[_0xced1('0x30')],_0x570aae[_0xced1('0x32')]),_0x5e9586);if(_0x1e8464['query'][_0xced1('0x3b')]){_0x542c67[_0xced1('0x3a')]=_['merge'](_0x542c67['where'],{'$or':_['map'](_0x5e9586,function(_0x1f6d6b){if(_0x1f6d6b['type']!=='VIRTUAL'){var _0x587921={};_0x587921[_0x1f6d6b[_0xced1('0x27')]]={'$like':'%'+_0x1e8464['query'][_0xced1('0x3b')]+'%'};return _0x587921;}})});}_0x542c67=_[_0xced1('0x3c')]({},_0x542c67,_0x1e8464[_0xced1('0x3d')]);var _0x3f32b8={'where':_0x542c67['where']};return db[_0xced1('0x2b')]['count'](_0x3f32b8)[_0xced1('0x25')](function(_0x365831){_0x536877[_0xced1('0x1f')]=_0x365831;if(_0x1e8464[_0xced1('0x30')][_0xced1('0x3e')]){_0x542c67[_0xced1('0x3f')]=[{'all':!![]}];}return db['SalesforceConfiguration']['findAll'](_0x542c67);})['then'](function(_0x220d93){_0x536877[_0xced1('0x40')]=_0x220d93;return _0x536877;})[_0xced1('0x25')](respondWithFilteredResult(_0x4480ef,_0x542c67))['catch'](handleError(_0x4480ef,null));};exports[_0xced1('0x41')]=function(_0x10f71d,_0x4b0bde){var _0x13ddab={'raw':![],'where':{'id':_0x10f71d[_0xced1('0x42')]['id']}},_0xb8f747={};_0xb8f747['model']=_[_0xced1('0x31')](db[_0xced1('0x2b')]['rawAttributes']);_0xb8f747[_0xced1('0x30')]=_[_0xced1('0x31')](_0x10f71d[_0xced1('0x30')]);_0xb8f747[_0xced1('0x32')]=_[_0xced1('0x33')](_0xb8f747[_0xced1('0x2f')],_0xb8f747[_0xced1('0x30')]);_0x13ddab['attributes']=_[_0xced1('0x33')](_0xb8f747[_0xced1('0x2f')],qs[_0xced1('0x35')](_0x10f71d[_0xced1('0x30')][_0xced1('0x35')]));_0x13ddab[_0xced1('0x34')]=_0x13ddab[_0xced1('0x34')][_0xced1('0x43')]?_0x13ddab[_0xced1('0x34')]:_0xb8f747[_0xced1('0x2f')];if(_0x10f71d['query']['includeAll']){_0x13ddab['include']=[{'all':!![]}];}_0x13ddab=_['merge']({},_0x13ddab,_0x10f71d[_0xced1('0x3d')]);return db[_0xced1('0x2b')][_0xced1('0x44')](_0x13ddab)[_0xced1('0x25')](handleEntityNotFound(_0x4b0bde,null))['then'](respondWithResult(_0x4b0bde,null))['catch'](handleError(_0x4b0bde,null));};exports['create']=function(_0xf95521,_0x47c272){return db['SalesforceConfiguration'][_0xced1('0x45')](_0xf95521['body'],{})[_0xced1('0x25')](respondWithResult(_0x47c272,0xc9))[_0xced1('0x46')](handleError(_0x47c272,null));};exports[_0xced1('0x24')]=function(_0x11393d,_0x9ab938){if(_0x11393d[_0xced1('0x47')]['id']){delete _0x11393d[_0xced1('0x47')]['id'];}return db[_0xced1('0x2b')]['find']({'where':{'id':_0x11393d[_0xced1('0x42')]['id']}})[_0xced1('0x25')](handleEntityNotFound(_0x9ab938,null))[_0xced1('0x25')](saveUpdates(_0x11393d[_0xced1('0x47')],null))[_0xced1('0x25')](respondWithResult(_0x9ab938,null))['catch'](handleError(_0x9ab938,null));};exports[_0xced1('0x48')]=function(_0x29fd1d,_0x2aa2a0){return db[_0xced1('0x2b')][_0xced1('0x44')]({'where':{'id':_0x29fd1d['params']['id']}})[_0xced1('0x25')](handleEntityNotFound(_0x2aa2a0,null))[_0xced1('0x25')](removeEntity(_0x2aa2a0,null))['catch'](handleError(_0x2aa2a0,null));};exports[_0xced1('0x49')]=function(_0x496510,_0x53cf0a,_0x4cdee0){var _0x3d0da5={};var _0x296e2c={};var _0x23968d;var _0x4dc986;return db[_0xced1('0x2b')][_0xced1('0x4a')]({'where':{'id':_0x496510[_0xced1('0x42')]['id']}})[_0xced1('0x25')](handleEntityNotFound(_0x53cf0a,null))[_0xced1('0x25')](function(_0x725e50){if(_0x725e50){_0x23968d=_0x725e50;_0x296e2c['model']=_[_0xced1('0x31')](db['SalesforceField'][_0xced1('0x2c')]);_0x296e2c[_0xced1('0x30')]=_[_0xced1('0x31')](_0x496510[_0xced1('0x30')]);_0x296e2c[_0xced1('0x32')]=_[_0xced1('0x33')](_0x296e2c[_0xced1('0x2f')],_0x296e2c[_0xced1('0x30')]);_0x3d0da5['attributes']=_[_0xced1('0x33')](_0x296e2c[_0xced1('0x2f')],qs[_0xced1('0x35')](_0x496510[_0xced1('0x30')][_0xced1('0x35')]));_0x3d0da5[_0xced1('0x34')]=_0x3d0da5['attributes'][_0xced1('0x43')]?_0x3d0da5[_0xced1('0x34')]:_0x296e2c[_0xced1('0x2f')];_0x3d0da5['order']=qs[_0xced1('0x39')](_0x496510[_0xced1('0x30')][_0xced1('0x39')]);_0x3d0da5[_0xced1('0x3a')]=qs[_0xced1('0x32')](_[_0xced1('0x4b')](_0x496510['query'],_0x296e2c[_0xced1('0x32')]));if(_0x496510['query'][_0xced1('0x3b')]){_0x3d0da5[_0xced1('0x3a')]=_[_0xced1('0x3c')](_0x3d0da5[_0xced1('0x3a')],{'$or':_[_0xced1('0x2a')](_0x3d0da5[_0xced1('0x34')],function(_0x4384ec){var _0x4327ef={};_0x4327ef[_0x4384ec]={'$like':'%'+_0x496510['query'][_0xced1('0x3b')]+'%'};return _0x4327ef;})});}_0x3d0da5=_[_0xced1('0x3c')]({},_0x3d0da5,_0x496510[_0xced1('0x3d')]);return _0x23968d[_0xced1('0x49')](_0x3d0da5);}})[_0xced1('0x25')](function(_0x3d82bf){if(_0x3d82bf){_0x4dc986=_0x3d82bf['length'];if(!_0x496510[_0xced1('0x30')][_0xced1('0x36')](_0xced1('0x37'))){_0x3d0da5['limit']=qs[_0xced1('0x20')](_0x496510[_0xced1('0x30')][_0xced1('0x20')]);_0x3d0da5[_0xced1('0x1d')]=qs[_0xced1('0x1d')](_0x496510[_0xced1('0x30')][_0xced1('0x1d')]);}return _0x23968d['getFields'](_0x3d0da5);}})[_0xced1('0x25')](function(_0x40d3c5){if(_0x40d3c5){return _0x40d3c5?{'count':_0x4dc986,'rows':_0x40d3c5}:null;}})['then'](respondWithResult(_0x53cf0a,null))[_0xced1('0x46')](handleError(_0x53cf0a,null));};exports[_0xced1('0x4c')]=function(_0x144af2,_0x32e706,_0x461732){var _0x621522={};var _0x35dbf={};var _0x2d2b4b;var _0x3f93d2;return db[_0xced1('0x2b')]['findOne']({'where':{'id':_0x144af2['params']['id']}})[_0xced1('0x25')](handleEntityNotFound(_0x32e706,null))['then'](function(_0x179926){if(_0x179926){_0x2d2b4b=_0x179926;_0x35dbf[_0xced1('0x2f')]=_[_0xced1('0x31')](db[_0xced1('0x4d')]['rawAttributes']);_0x35dbf['query']=_['keys'](_0x144af2[_0xced1('0x30')]);_0x35dbf['filters']=_['intersection'](_0x35dbf[_0xced1('0x2f')],_0x35dbf['query']);_0x621522[_0xced1('0x34')]=_[_0xced1('0x33')](_0x35dbf[_0xced1('0x2f')],qs[_0xced1('0x35')](_0x144af2[_0xced1('0x30')][_0xced1('0x35')]));_0x621522[_0xced1('0x34')]=_0x621522[_0xced1('0x34')][_0xced1('0x43')]?_0x621522[_0xced1('0x34')]:_0x35dbf[_0xced1('0x2f')];_0x621522[_0xced1('0x38')]=qs[_0xced1('0x39')](_0x144af2[_0xced1('0x30')]['sort']);_0x621522[_0xced1('0x3a')]=qs[_0xced1('0x32')](_['pick'](_0x144af2[_0xced1('0x30')],_0x35dbf[_0xced1('0x32')]));if(_0x144af2['query']['filter']){_0x621522[_0xced1('0x3a')]=_[_0xced1('0x3c')](_0x621522[_0xced1('0x3a')],{'$or':_[_0xced1('0x2a')](_0x621522[_0xced1('0x34')],function(_0x312ec6){var _0x569a1={};_0x569a1[_0x312ec6]={'$like':'%'+_0x144af2[_0xced1('0x30')][_0xced1('0x3b')]+'%'};return _0x569a1;})});}_0x621522=_[_0xced1('0x3c')]({},_0x621522,_0x144af2['options']);return _0x2d2b4b[_0xced1('0x4c')](_0x621522);}})[_0xced1('0x25')](function(_0x54e0f2){if(_0x54e0f2){_0x3f93d2=_0x54e0f2[_0xced1('0x43')];if(!_0x144af2['query']['hasOwnProperty'](_0xced1('0x37'))){_0x621522[_0xced1('0x20')]=qs[_0xced1('0x20')](_0x144af2[_0xced1('0x30')]['limit']);_0x621522[_0xced1('0x1d')]=qs[_0xced1('0x1d')](_0x144af2['query'][_0xced1('0x1d')]);}return _0x2d2b4b[_0xced1('0x4c')](_0x621522);}})[_0xced1('0x25')](function(_0xdeab9){if(_0xdeab9){return _0xdeab9?{'count':_0x3f93d2,'rows':_0xdeab9}:null;}})[_0xced1('0x25')](respondWithResult(_0x32e706,null))['catch'](handleError(_0x32e706,null));};exports[_0xced1('0x4e')]=function(_0x1d62c4,_0x5706da,_0x211bb7){var _0x5de710={};var _0x5628ec={};var _0x85a4cc;var _0x496219;return db[_0xced1('0x2b')]['findOne']({'where':{'id':_0x1d62c4[_0xced1('0x42')]['id']}})['then'](handleEntityNotFound(_0x5706da,null))[_0xced1('0x25')](function(_0x212372){if(_0x212372){_0x85a4cc=_0x212372;_0x5628ec[_0xced1('0x2f')]=_[_0xced1('0x31')](db[_0xced1('0x4d')][_0xced1('0x2c')]);_0x5628ec['query']=_[_0xced1('0x31')](_0x1d62c4[_0xced1('0x30')]);_0x5628ec['filters']=_[_0xced1('0x33')](_0x5628ec[_0xced1('0x2f')],_0x5628ec[_0xced1('0x30')]);_0x5de710['attributes']=_[_0xced1('0x33')](_0x5628ec[_0xced1('0x2f')],qs[_0xced1('0x35')](_0x1d62c4[_0xced1('0x30')][_0xced1('0x35')]));_0x5de710[_0xced1('0x34')]=_0x5de710[_0xced1('0x34')][_0xced1('0x43')]?_0x5de710[_0xced1('0x34')]:_0x5628ec[_0xced1('0x2f')];_0x5de710[_0xced1('0x38')]=qs['sort'](_0x1d62c4['query'][_0xced1('0x39')]);_0x5de710['where']=qs[_0xced1('0x32')](_[_0xced1('0x4b')](_0x1d62c4['query'],_0x5628ec[_0xced1('0x32')]));if(_0x1d62c4[_0xced1('0x30')][_0xced1('0x3b')]){_0x5de710[_0xced1('0x3a')]=_[_0xced1('0x3c')](_0x5de710['where'],{'$or':_[_0xced1('0x2a')](_0x5de710[_0xced1('0x34')],function(_0x1714d3){var _0x36b89c={};_0x36b89c[_0x1714d3]={'$like':'%'+_0x1d62c4[_0xced1('0x30')]['filter']+'%'};return _0x36b89c;})});}_0x5de710=_[_0xced1('0x3c')]({},_0x5de710,_0x1d62c4[_0xced1('0x3d')]);return _0x85a4cc['getDescriptions'](_0x5de710);}})[_0xced1('0x25')](function(_0x540404){if(_0x540404){_0x496219=_0x540404['length'];if(!_0x1d62c4[_0xced1('0x30')][_0xced1('0x36')](_0xced1('0x37'))){_0x5de710[_0xced1('0x20')]=qs[_0xced1('0x20')](_0x1d62c4['query']['limit']);_0x5de710[_0xced1('0x1d')]=qs[_0xced1('0x1d')](_0x1d62c4[_0xced1('0x30')][_0xced1('0x1d')]);}return _0x85a4cc[_0xced1('0x4e')](_0x5de710);}})[_0xced1('0x25')](function(_0x230c5f){if(_0x230c5f){return _0x230c5f?{'count':_0x496219,'rows':_0x230c5f}:null;}})['then'](respondWithResult(_0x5706da,null))['catch'](handleError(_0x5706da,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index b064bd4..ed651dc 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 _0x3c1a=['lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration'];(function(_0x26eb4b,_0x18fdbf){var _0x27c89b=function(_0x5087b9){while(--_0x5087b9){_0x26eb4b['push'](_0x26eb4b['shift']());}};_0x27c89b(++_0x18fdbf);}(_0x3c1a,0x1b8));var _0xa3c1=function(_0x6e1239,_0x3562ac){_0x6e1239=_0x6e1239-0x0;var _0x418150=_0x3c1a[_0x6e1239];return _0x418150;};'use strict';var _=require(_0xa3c1('0x0'));var util=require(_0xa3c1('0x1'));var logger=require(_0xa3c1('0x2'))(_0xa3c1('0x3'));var moment=require(_0xa3c1('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa3c1('0x5'));var rimraf=require(_0xa3c1('0x6'));var config=require(_0xa3c1('0x7'));var attributes=require(_0xa3c1('0x8'));module[_0xa3c1('0x9')]=function(_0x2c39a2,_0x295b89){return _0x2c39a2['define'](_0xa3c1('0xa'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4932=['./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4be641,_0x287c36){var _0x5139d1=function(_0x44b1b0){while(--_0x44b1b0){_0x4be641['push'](_0x4be641['shift']());}};_0x5139d1(++_0x287c36);}(_0x4932,0x88));var _0x2493=function(_0x583c99,_0x4b9160){_0x583c99=_0x583c99-0x0;var _0x9fe52c=_0x4932[_0x583c99];return _0x9fe52c;};'use strict';var _=require(_0x2493('0x0'));var util=require(_0x2493('0x1'));var logger=require('../../config/logger')(_0x2493('0x2'));var moment=require('moment');var BPromise=require(_0x2493('0x3'));var rp=require(_0x2493('0x4'));var fs=require('fs');var path=require(_0x2493('0x5'));var rimraf=require(_0x2493('0x6'));var config=require(_0x2493('0x7'));var attributes=require(_0x2493('0x8'));module[_0x2493('0x9')]=function(_0x27a817,_0x404baf){return _0x27a817[_0x2493('0xa')]('SalesforceConfiguration',attributes,{'tableName':_0x2493('0xb'),'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 91f07e1..2e036dc 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 _0x1ea2=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SalesforceConfiguration,\x20%s,\x20%s','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x1ae46e,_0x55dd9e){var _0x208f0d=function(_0x498133){while(--_0x498133){_0x1ae46e['push'](_0x1ae46e['shift']());}};_0x208f0d(++_0x55dd9e);}(_0x1ea2,0x160));var _0x21ea=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x1ea2[_0x24f31b];return _0x488401;};'use strict';var _=require(_0x21ea('0x0'));var util=require('util');var moment=require(_0x21ea('0x1'));var BPromise=require(_0x21ea('0x2'));var rs=require(_0x21ea('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x21ea('0x4'))['db'];var utils=require(_0x21ea('0x5'));var logger=require(_0x21ea('0x6'))(_0x21ea('0x7'));var config=require(_0x21ea('0x8'));var jayson=require(_0x21ea('0x9'));var client=jayson[_0x21ea('0xa')][_0x21ea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d58d5,_0x59d0bf,_0x381a5e){return new BPromise(function(_0x3f7bb3,_0x105344){return client['request'](_0x2d58d5,_0x381a5e)['then'](function(_0x35443a){logger[_0x21ea('0xc')](_0x21ea('0xd'),_0x59d0bf,'request\x20sent');logger['debug'](_0x21ea('0xe'),_0x59d0bf,_0x21ea('0xf'),JSON[_0x21ea('0x10')](_0x35443a));if(_0x35443a[_0x21ea('0x11')]){if(_0x35443a[_0x21ea('0x11')][_0x21ea('0x12')]===0x1f4){logger[_0x21ea('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x59d0bf,_0x35443a['error'][_0x21ea('0x13')]);return _0x105344(_0x35443a[_0x21ea('0x11')][_0x21ea('0x13')]);}logger[_0x21ea('0x11')](_0x21ea('0xd'),_0x59d0bf,_0x35443a[_0x21ea('0x11')][_0x21ea('0x13')]);return _0x3f7bb3(_0x35443a[_0x21ea('0x11')][_0x21ea('0x13')]);}else{logger[_0x21ea('0xc')](_0x21ea('0xd'),_0x59d0bf,_0x21ea('0xf'));_0x3f7bb3(_0x35443a[_0x21ea('0x14')]['message']);}})[_0x21ea('0x15')](function(_0x88708f){logger[_0x21ea('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x59d0bf,_0x88708f);_0x105344(_0x88708f);});});} \ No newline at end of file +var _0x6ab4=['result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','jayson/promise','client','then','info','debug','request\x20sent','stringify','code','error','message','SalesforceConfiguration,\x20%s,\x20%s'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x6ab4,0x145));var _0x46ab=function(_0xf89c3,_0x351bf1){_0xf89c3=_0xf89c3-0x0;var _0x274fc8=_0x6ab4[_0xf89c3];return _0x274fc8;};'use strict';var _=require(_0x46ab('0x0'));var util=require(_0x46ab('0x1'));var moment=require(_0x46ab('0x2'));var BPromise=require('bluebird');var rs=require(_0x46ab('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x46ab('0x4'));var logger=require(_0x46ab('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x46ab('0x6'));var client=jayson[_0x46ab('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52063a,_0x3e62db,_0xf66f26){return new BPromise(function(_0x367da3,_0x18a3ea){return client['request'](_0x52063a,_0xf66f26)[_0x46ab('0x8')](function(_0x3ee1b4){logger[_0x46ab('0x9')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3e62db,'request\x20sent');logger[_0x46ab('0xa')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x3e62db,_0x46ab('0xb'),JSON[_0x46ab('0xc')](_0x3ee1b4));if(_0x3ee1b4['error']){if(_0x3ee1b4['error'][_0x46ab('0xd')]===0x1f4){logger[_0x46ab('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3e62db,_0x3ee1b4['error'][_0x46ab('0xf')]);return _0x18a3ea(_0x3ee1b4[_0x46ab('0xe')][_0x46ab('0xf')]);}logger[_0x46ab('0xe')](_0x46ab('0x10'),_0x3e62db,_0x3ee1b4['error'][_0x46ab('0xf')]);return _0x367da3(_0x3ee1b4[_0x46ab('0xe')][_0x46ab('0xf')]);}else{logger[_0x46ab('0x9')](_0x46ab('0x10'),_0x3e62db,_0x46ab('0xb'));_0x367da3(_0x3ee1b4[_0x46ab('0x11')][_0x46ab('0xf')]);}})[_0x46ab('0x12')](function(_0x334b5b){logger['error'](_0x46ab('0x10'),_0x3e62db,_0x334b5b);_0x18a3ea(_0x334b5b);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 0d9c27f..dcac92e 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 _0xbec1=['multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','show','create','put','/:id','exports'];(function(_0x3ea022,_0x2d5328){var _0x3b97a2=function(_0x351179){while(--_0x351179){_0x3ea022['push'](_0x3ea022['shift']());}};_0x3b97a2(++_0x2d5328);}(_0xbec1,0x110));var _0x1bec=function(_0x567f89,_0x3db9e3){_0x567f89=_0x567f89-0x0;var _0x124393=_0xbec1[_0x567f89];return _0x124393;};'use strict';var multer=require(_0x1bec('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1bec('0x1'));var express=require(_0x1bec('0x2'));var router=express[_0x1bec('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1bec('0x4'));var interaction=require(_0x1bec('0x5'));var config=require(_0x1bec('0x6'));var controller=require(_0x1bec('0x7'));router[_0x1bec('0x8')]('/',auth[_0x1bec('0x9')](),controller[_0x1bec('0xa')]);router[_0x1bec('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1bec('0xb')]);router['post']('/',auth[_0x1bec('0x9')](),controller[_0x1bec('0xc')]);router[_0x1bec('0xd')](_0x1bec('0xe'),auth[_0x1bec('0x9')](),controller['update']);router['delete'](_0x1bec('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x1bec('0xf')]=router; \ No newline at end of file +var _0x7f1a=['get','index','/:id','isAuthenticated','post','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intSalesforceField.controller'];(function(_0x4bc65f,_0x39ec43){var _0x44f85f=function(_0x175343){while(--_0x175343){_0x4bc65f['push'](_0x4bc65f['shift']());}};_0x44f85f(++_0x39ec43);}(_0x7f1a,0x88));var _0xa7f1=function(_0x4ac60,_0x4638e6){_0x4ac60=_0x4ac60-0x0;var _0x266fa3=_0x7f1a[_0x4ac60];return _0x266fa3;};'use strict';var multer=require(_0xa7f1('0x0'));var util=require('util');var path=require(_0xa7f1('0x1'));var timeout=require(_0xa7f1('0x2'));var express=require(_0xa7f1('0x3'));var router=express[_0xa7f1('0x4')]();var fs_extra=require(_0xa7f1('0x5'));var auth=require(_0xa7f1('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa7f1('0x7'));router[_0xa7f1('0x8')]('/',auth['isAuthenticated'](),controller[_0xa7f1('0x9')]);router[_0xa7f1('0x8')](_0xa7f1('0xa'),auth[_0xa7f1('0xb')](),controller['show']);router[_0xa7f1('0xc')]('/',auth[_0xa7f1('0xb')](),controller[_0xa7f1('0xd')]);router[_0xa7f1('0xe')](_0xa7f1('0xa'),auth[_0xa7f1('0xb')](),controller[_0xa7f1('0xf')]);router[_0xa7f1('0x10')](_0xa7f1('0xa'),auth[_0xa7f1('0xb')](),controller[_0xa7f1('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 4263d49..83b3d28 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 _0xd5d0=['picklist','STRING','ENUM','string','variable','customVariable'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0xd5d0,0x1dc));var _0x0d5d=function(_0x5c0c0c,_0x3ff3d6){_0x5c0c0c=_0x5c0c0c-0x0;var _0x17ac13=_0xd5d0[_0x5c0c0c];return _0x17ac13;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x0d5d('0x0')](_0x0d5d('0x1'),_0x0d5d('0x2'),_0x0d5d('0x3'),'keyValue',_0x0d5d('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x0d5d('0x5')]},'keyType':{'type':Sequelize[_0x0d5d('0x0')]('string',_0x0d5d('0x2'),_0x0d5d('0x3'))},'keyContent':{'type':Sequelize[_0x0d5d('0x5')]},'idField':{'type':Sequelize[_0x0d5d('0x5')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3c4c=['picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x3f1d11,_0x5e3836){var _0x38755f=function(_0x2d3dfe){while(--_0x2d3dfe){_0x3f1d11['push'](_0x3f1d11['shift']());}};_0x38755f(++_0x5e3836);}(_0x3c4c,0x1a9));var _0xc3c4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3c4c[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0xc3c4('0x0'));module[_0xc3c4('0x1')]={'type':{'type':Sequelize[_0xc3c4('0x2')](_0xc3c4('0x3'),_0xc3c4('0x4'),_0xc3c4('0x5'),_0xc3c4('0x6'),_0xc3c4('0x7')),'defaultValue':_0xc3c4('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc3c4('0x8')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0xc3c4('0x5'))},'keyContent':{'type':Sequelize[_0xc3c4('0x8')]},'idField':{'type':Sequelize[_0xc3c4('0x8')]},'variableName':{'type':Sequelize[_0xc3c4('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index b9f62ec..ec0b5bc 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 _0xc332=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','offset','limit','undefined','count','set','apply','reject','save','update','then','stack','name','send','index','SalesforceField','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox'];(function(_0x374c68,_0x2b7657){var _0x422141=function(_0x846e89){while(--_0x846e89){_0x374c68['push'](_0x374c68['shift']());}};_0x422141(++_0x2b7657);}(_0xc332,0x123));var _0x2c33=function(_0x504765,_0x5bba77){_0x504765=_0x504765-0x0;var _0x2a192b=_0xc332[_0x504765];return _0x2a192b;};'use strict';var emlformat=require(_0x2c33('0x0'));var rimraf=require(_0x2c33('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2c33('0x2'));var rp=require(_0x2c33('0x3'));var moment=require(_0x2c33('0x4'));var BPromise=require(_0x2c33('0x5'));var Mustache=require(_0x2c33('0x6'));var util=require('util');var path=require(_0x2c33('0x7'));var sox=require(_0x2c33('0x8'));var csv=require(_0x2c33('0x9'));var ejs=require(_0x2c33('0xa'));var fs=require('fs');var fs_extra=require(_0x2c33('0xb'));var _=require(_0x2c33('0xc'));var squel=require(_0x2c33('0xd'));var crypto=require(_0x2c33('0xe'));var jsforce=require(_0x2c33('0xf'));var deskjs=require(_0x2c33('0x10'));var toCsv=require(_0x2c33('0x9'));var querystring=require(_0x2c33('0x11'));var Papa=require('papaparse');var Redis=require(_0x2c33('0x12'));var authService=require(_0x2c33('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2c33('0x14'));var hardwareService=require(_0x2c33('0x15'));var logger=require('../../config/logger')(_0x2c33('0x16'));var utils=require(_0x2c33('0x17'));var config=require(_0x2c33('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2c33('0x19'))['db'];function respondWithStatusCode(_0x292b5b,_0xd188e6){_0xd188e6=_0xd188e6||0xcc;return function(_0x312704){if(_0x312704){return _0x292b5b['sendStatus'](_0xd188e6);}return _0x292b5b[_0x2c33('0x1a')](_0xd188e6)['end']();};}function respondWithResult(_0x3f2e04,_0x285430){_0x285430=_0x285430||0xc8;return function(_0x4a39c0){if(_0x4a39c0){return _0x3f2e04[_0x2c33('0x1a')](_0x285430)['json'](_0x4a39c0);}};}function respondWithFilteredResult(_0x2040dd,_0x40b107){return function(_0x48ca25){if(_0x48ca25){var _0x4ef84a=typeof _0x40b107[_0x2c33('0x1b')]==='undefined'&&typeof _0x40b107[_0x2c33('0x1c')]===_0x2c33('0x1d');var _0x4dcfd7=_0x48ca25[_0x2c33('0x1e')];var _0x23ac94=_0x4ef84a?0x0:_0x40b107[_0x2c33('0x1b')];var _0x592519=_0x4ef84a?_0x48ca25[_0x2c33('0x1e')]:_0x40b107[_0x2c33('0x1b')]+_0x40b107[_0x2c33('0x1c')];var _0x79a48a;if(_0x592519>=_0x4dcfd7){_0x592519=_0x4dcfd7;_0x79a48a=0xc8;}else{_0x79a48a=0xce;}_0x2040dd['status'](_0x79a48a);return _0x2040dd[_0x2c33('0x1f')]('Content-Range',_0x23ac94+'-'+_0x592519+'/'+_0x4dcfd7)['json'](_0x48ca25);}return null;};}function patchUpdates(_0x443a41){return function(_0x4a1cd4){try{jsonpatch[_0x2c33('0x20')](_0x4a1cd4,_0x443a41,!![]);}catch(_0x4211b5){return BPromise[_0x2c33('0x21')](_0x4211b5);}return _0x4a1cd4[_0x2c33('0x22')]();};}function saveUpdates(_0x20540e,_0x24c055){return function(_0xa71229){if(_0xa71229){return _0xa71229[_0x2c33('0x23')](_0x20540e)[_0x2c33('0x24')](function(_0x5f2c42){return _0x5f2c42;});}return null;};}function removeEntity(_0x837ab,_0x3bd892){return function(_0x45df38){if(_0x45df38){return _0x45df38['destroy']()[_0x2c33('0x24')](function(){_0x837ab[_0x2c33('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x339a2a,_0x168351){return function(_0x5d5c2a){if(!_0x5d5c2a){_0x339a2a['sendStatus'](0x194);}return _0x5d5c2a;};}function handleError(_0x1d1d19,_0x4b49f6){_0x4b49f6=_0x4b49f6||0x1f4;return function(_0x164061){logger['error'](_0x164061[_0x2c33('0x25')]);if(_0x164061[_0x2c33('0x26')]){delete _0x164061[_0x2c33('0x26')];}_0x1d1d19[_0x2c33('0x1a')](_0x4b49f6)[_0x2c33('0x27')](_0x164061);};}exports[_0x2c33('0x28')]=function(_0x4b6742,_0x1a5e01){var _0x2434aa={},_0x5e2db8={},_0x11d482={'count':0x0,'rows':[]};var _0x176d35=_['map'](db[_0x2c33('0x29')][_0x2c33('0x2a')],function(_0x5f352c){return{'name':_0x5f352c[_0x2c33('0x2b')],'type':_0x5f352c[_0x2c33('0x2c')][_0x2c33('0x2d')]};});_0x5e2db8['model']=_[_0x2c33('0x2e')](_0x176d35,_0x2c33('0x26'));_0x5e2db8[_0x2c33('0x2f')]=_[_0x2c33('0x30')](_0x4b6742[_0x2c33('0x2f')]);_0x5e2db8['filters']=_[_0x2c33('0x31')](_0x5e2db8[_0x2c33('0x32')],_0x5e2db8['query']);_0x2434aa['attributes']=_[_0x2c33('0x31')](_0x5e2db8['model'],qs[_0x2c33('0x33')](_0x4b6742[_0x2c33('0x2f')][_0x2c33('0x33')]));_0x2434aa[_0x2c33('0x34')]=_0x2434aa[_0x2c33('0x34')]['length']?_0x2434aa[_0x2c33('0x34')]:_0x5e2db8[_0x2c33('0x32')];if(!_0x4b6742[_0x2c33('0x2f')][_0x2c33('0x35')](_0x2c33('0x36'))){_0x2434aa[_0x2c33('0x1c')]=qs[_0x2c33('0x1c')](_0x4b6742['query']['limit']);_0x2434aa[_0x2c33('0x1b')]=qs['offset'](_0x4b6742['query'][_0x2c33('0x1b')]);}_0x2434aa[_0x2c33('0x37')]=qs['sort'](_0x4b6742[_0x2c33('0x2f')][_0x2c33('0x38')]);_0x2434aa['where']=qs[_0x2c33('0x39')](_[_0x2c33('0x3a')](_0x4b6742[_0x2c33('0x2f')],_0x5e2db8[_0x2c33('0x39')]),_0x176d35);if(_0x4b6742[_0x2c33('0x2f')][_0x2c33('0x3b')]){_0x2434aa[_0x2c33('0x3c')]=_[_0x2c33('0x3d')](_0x2434aa[_0x2c33('0x3c')],{'$or':_['map'](_0x176d35,function(_0x597cfa){if(_0x597cfa[_0x2c33('0x2c')]!==_0x2c33('0x3e')){var _0x5a449c={};_0x5a449c[_0x597cfa[_0x2c33('0x26')]]={'$like':'%'+_0x4b6742['query'][_0x2c33('0x3b')]+'%'};return _0x5a449c;}})});}_0x2434aa=_[_0x2c33('0x3d')]({},_0x2434aa,_0x4b6742[_0x2c33('0x3f')]);var _0x4da981={'where':_0x2434aa[_0x2c33('0x3c')]};return db[_0x2c33('0x29')][_0x2c33('0x1e')](_0x4da981)[_0x2c33('0x24')](function(_0x37cf55){_0x11d482[_0x2c33('0x1e')]=_0x37cf55;if(_0x4b6742[_0x2c33('0x2f')][_0x2c33('0x40')]){_0x2434aa[_0x2c33('0x41')]=[{'all':!![]}];}return db['SalesforceField'][_0x2c33('0x42')](_0x2434aa);})[_0x2c33('0x24')](function(_0xcb5b76){_0x11d482[_0x2c33('0x43')]=_0xcb5b76;return _0x11d482;})['then'](respondWithFilteredResult(_0x1a5e01,_0x2434aa))[_0x2c33('0x44')](handleError(_0x1a5e01,null));};exports['show']=function(_0x2dbdde,_0x2dcb7b){var _0x45a60e={'raw':!![],'where':{'id':_0x2dbdde[_0x2c33('0x45')]['id']}},_0x37e497={};_0x37e497[_0x2c33('0x32')]=_[_0x2c33('0x30')](db[_0x2c33('0x29')][_0x2c33('0x2a')]);_0x37e497['query']=_['keys'](_0x2dbdde[_0x2c33('0x2f')]);_0x37e497[_0x2c33('0x39')]=_['intersection'](_0x37e497[_0x2c33('0x32')],_0x37e497[_0x2c33('0x2f')]);_0x45a60e[_0x2c33('0x34')]=_[_0x2c33('0x31')](_0x37e497[_0x2c33('0x32')],qs['fields'](_0x2dbdde['query']['fields']));_0x45a60e[_0x2c33('0x34')]=_0x45a60e[_0x2c33('0x34')][_0x2c33('0x46')]?_0x45a60e[_0x2c33('0x34')]:_0x37e497[_0x2c33('0x32')];if(_0x2dbdde[_0x2c33('0x2f')][_0x2c33('0x40')]){_0x45a60e[_0x2c33('0x41')]=[{'all':!![]}];}_0x45a60e=_[_0x2c33('0x3d')]({},_0x45a60e,_0x2dbdde[_0x2c33('0x3f')]);return db[_0x2c33('0x29')][_0x2c33('0x47')](_0x45a60e)[_0x2c33('0x24')](handleEntityNotFound(_0x2dcb7b,null))[_0x2c33('0x24')](respondWithResult(_0x2dcb7b,null))[_0x2c33('0x44')](handleError(_0x2dcb7b,null));};exports[_0x2c33('0x48')]=function(_0x3aa80b,_0x2ff05a){return db[_0x2c33('0x29')][_0x2c33('0x48')](_0x3aa80b[_0x2c33('0x49')],{})[_0x2c33('0x24')](respondWithResult(_0x2ff05a,0xc9))[_0x2c33('0x44')](handleError(_0x2ff05a,null));};exports['update']=function(_0x3b66f2,_0x15202d){if(_0x3b66f2[_0x2c33('0x49')]['id']){delete _0x3b66f2['body']['id'];}return db['SalesforceField'][_0x2c33('0x47')]({'where':{'id':_0x3b66f2[_0x2c33('0x45')]['id']}})[_0x2c33('0x24')](handleEntityNotFound(_0x15202d,null))[_0x2c33('0x24')](saveUpdates(_0x3b66f2[_0x2c33('0x49')],null))[_0x2c33('0x24')](respondWithResult(_0x15202d,null))[_0x2c33('0x44')](handleError(_0x15202d,null));};exports[_0x2c33('0x4a')]=function(_0x5c1f41,_0x1d321e){return db[_0x2c33('0x29')]['find']({'where':{'id':_0x5c1f41[_0x2c33('0x45')]['id']}})[_0x2c33('0x24')](handleEntityNotFound(_0x1d321e,null))[_0x2c33('0x24')](removeEntity(_0x1d321e,null))[_0x2c33('0x44')](handleError(_0x1d321e,null));}; \ No newline at end of file +var _0x645d=['sendStatus','end','status','json','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','map','SalesforceField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','find','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x645d,0xc3));var _0xd645=function(_0x1ef911,_0x32a38b){_0x1ef911=_0x1ef911-0x0;var _0x5297f4=_0x645d[_0x1ef911];return _0x5297f4;};'use strict';var emlformat=require(_0xd645('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd645('0x1'));var rp=require('request-promise');var moment=require(_0xd645('0x2'));var BPromise=require(_0xd645('0x3'));var Mustache=require(_0xd645('0x4'));var util=require(_0xd645('0x5'));var path=require(_0xd645('0x6'));var sox=require(_0xd645('0x7'));var csv=require(_0xd645('0x8'));var ejs=require(_0xd645('0x9'));var fs=require('fs');var fs_extra=require(_0xd645('0xa'));var _=require(_0xd645('0xb'));var squel=require(_0xd645('0xc'));var crypto=require('crypto');var jsforce=require(_0xd645('0xd'));var deskjs=require(_0xd645('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd645('0xf'));var Papa=require(_0xd645('0x10'));var Redis=require(_0xd645('0x11'));var authService=require(_0xd645('0x12'));var qs=require(_0xd645('0x13'));var as=require(_0xd645('0x14'));var hardwareService=require(_0xd645('0x15'));var logger=require(_0xd645('0x16'))(_0xd645('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3241bd,_0x4a9ee2){_0x4a9ee2=_0x4a9ee2||0xcc;return function(_0x295619){if(_0x295619){return _0x3241bd[_0xd645('0x18')](_0x4a9ee2);}return _0x3241bd['status'](_0x4a9ee2)[_0xd645('0x19')]();};}function respondWithResult(_0xfd8962,_0x2b03d7){_0x2b03d7=_0x2b03d7||0xc8;return function(_0x49cf69){if(_0x49cf69){return _0xfd8962[_0xd645('0x1a')](_0x2b03d7)[_0xd645('0x1b')](_0x49cf69);}};}function respondWithFilteredResult(_0x5a2c6c,_0x3c7cf5){return function(_0x50883b){if(_0x50883b){var _0x4dfbb1=typeof _0x3c7cf5['offset']==='undefined'&&typeof _0x3c7cf5[_0xd645('0x1c')]==='undefined';var _0x35c97b=_0x50883b[_0xd645('0x1d')];var _0x528d77=_0x4dfbb1?0x0:_0x3c7cf5[_0xd645('0x1e')];var _0x132ac9=_0x4dfbb1?_0x50883b[_0xd645('0x1d')]:_0x3c7cf5[_0xd645('0x1e')]+_0x3c7cf5['limit'];var _0x1b813e;if(_0x132ac9>=_0x35c97b){_0x132ac9=_0x35c97b;_0x1b813e=0xc8;}else{_0x1b813e=0xce;}_0x5a2c6c[_0xd645('0x1a')](_0x1b813e);return _0x5a2c6c[_0xd645('0x1f')](_0xd645('0x20'),_0x528d77+'-'+_0x132ac9+'/'+_0x35c97b)[_0xd645('0x1b')](_0x50883b);}return null;};}function patchUpdates(_0x48f1dd){return function(_0x5204e2){try{jsonpatch[_0xd645('0x21')](_0x5204e2,_0x48f1dd,!![]);}catch(_0x3f7a55){return BPromise[_0xd645('0x22')](_0x3f7a55);}return _0x5204e2[_0xd645('0x23')]();};}function saveUpdates(_0x36cb09,_0x614dad){return function(_0x367a64){if(_0x367a64){return _0x367a64[_0xd645('0x24')](_0x36cb09)['then'](function(_0x414aae){return _0x414aae;});}return null;};}function removeEntity(_0x2c9efa,_0x4e1174){return function(_0x10f244){if(_0x10f244){return _0x10f244[_0xd645('0x25')]()[_0xd645('0x26')](function(){_0x2c9efa[_0xd645('0x1a')](0xcc)[_0xd645('0x19')]();});}};}function handleEntityNotFound(_0x3e30a8,_0x32a9d9){return function(_0x3e5b48){if(!_0x3e5b48){_0x3e30a8['sendStatus'](0x194);}return _0x3e5b48;};}function handleError(_0x349b66,_0x5f56f0){_0x5f56f0=_0x5f56f0||0x1f4;return function(_0x42178c){logger[_0xd645('0x27')](_0x42178c['stack']);if(_0x42178c[_0xd645('0x28')]){delete _0x42178c[_0xd645('0x28')];}_0x349b66[_0xd645('0x1a')](_0x5f56f0)[_0xd645('0x29')](_0x42178c);};}exports['index']=function(_0x576154,_0x58b225){var _0x427771={},_0x32f7ab={},_0x70158={'count':0x0,'rows':[]};var _0xbcf00f=_[_0xd645('0x2a')](db[_0xd645('0x2b')][_0xd645('0x2c')],function(_0x4f06cf){return{'name':_0x4f06cf[_0xd645('0x2d')],'type':_0x4f06cf[_0xd645('0x2e')]['key']};});_0x32f7ab[_0xd645('0x2f')]=_['map'](_0xbcf00f,_0xd645('0x28'));_0x32f7ab[_0xd645('0x30')]=_[_0xd645('0x31')](_0x576154['query']);_0x32f7ab[_0xd645('0x32')]=_[_0xd645('0x33')](_0x32f7ab[_0xd645('0x2f')],_0x32f7ab[_0xd645('0x30')]);_0x427771[_0xd645('0x34')]=_[_0xd645('0x33')](_0x32f7ab[_0xd645('0x2f')],qs[_0xd645('0x35')](_0x576154[_0xd645('0x30')][_0xd645('0x35')]));_0x427771[_0xd645('0x34')]=_0x427771[_0xd645('0x34')][_0xd645('0x36')]?_0x427771[_0xd645('0x34')]:_0x32f7ab['model'];if(!_0x576154['query']['hasOwnProperty'](_0xd645('0x37'))){_0x427771[_0xd645('0x1c')]=qs[_0xd645('0x1c')](_0x576154[_0xd645('0x30')]['limit']);_0x427771[_0xd645('0x1e')]=qs[_0xd645('0x1e')](_0x576154[_0xd645('0x30')][_0xd645('0x1e')]);}_0x427771[_0xd645('0x38')]=qs[_0xd645('0x39')](_0x576154[_0xd645('0x30')][_0xd645('0x39')]);_0x427771[_0xd645('0x3a')]=qs['filters'](_[_0xd645('0x3b')](_0x576154[_0xd645('0x30')],_0x32f7ab['filters']),_0xbcf00f);if(_0x576154[_0xd645('0x30')][_0xd645('0x3c')]){_0x427771['where']=_[_0xd645('0x3d')](_0x427771['where'],{'$or':_[_0xd645('0x2a')](_0xbcf00f,function(_0x440175){if(_0x440175[_0xd645('0x2e')]!==_0xd645('0x3e')){var _0x9ea533={};_0x9ea533[_0x440175[_0xd645('0x28')]]={'$like':'%'+_0x576154['query'][_0xd645('0x3c')]+'%'};return _0x9ea533;}})});}_0x427771=_[_0xd645('0x3d')]({},_0x427771,_0x576154[_0xd645('0x3f')]);var _0x4a8b01={'where':_0x427771[_0xd645('0x3a')]};return db[_0xd645('0x2b')]['count'](_0x4a8b01)[_0xd645('0x26')](function(_0x18af53){_0x70158[_0xd645('0x1d')]=_0x18af53;if(_0x576154[_0xd645('0x30')][_0xd645('0x40')]){_0x427771[_0xd645('0x41')]=[{'all':!![]}];}return db['SalesforceField'][_0xd645('0x42')](_0x427771);})[_0xd645('0x26')](function(_0x1642a6){_0x70158['rows']=_0x1642a6;return _0x70158;})[_0xd645('0x26')](respondWithFilteredResult(_0x58b225,_0x427771))[_0xd645('0x43')](handleError(_0x58b225,null));};exports[_0xd645('0x44')]=function(_0x13c0bd,_0x4d9e2c){var _0x2e89f5={'raw':!![],'where':{'id':_0x13c0bd[_0xd645('0x45')]['id']}},_0x18f100={};_0x18f100[_0xd645('0x2f')]=_['keys'](db['SalesforceField'][_0xd645('0x2c')]);_0x18f100[_0xd645('0x30')]=_[_0xd645('0x31')](_0x13c0bd[_0xd645('0x30')]);_0x18f100[_0xd645('0x32')]=_[_0xd645('0x33')](_0x18f100[_0xd645('0x2f')],_0x18f100[_0xd645('0x30')]);_0x2e89f5[_0xd645('0x34')]=_[_0xd645('0x33')](_0x18f100[_0xd645('0x2f')],qs[_0xd645('0x35')](_0x13c0bd[_0xd645('0x30')][_0xd645('0x35')]));_0x2e89f5[_0xd645('0x34')]=_0x2e89f5['attributes']['length']?_0x2e89f5['attributes']:_0x18f100[_0xd645('0x2f')];if(_0x13c0bd[_0xd645('0x30')][_0xd645('0x40')]){_0x2e89f5['include']=[{'all':!![]}];}_0x2e89f5=_[_0xd645('0x3d')]({},_0x2e89f5,_0x13c0bd[_0xd645('0x3f')]);return db[_0xd645('0x2b')]['find'](_0x2e89f5)['then'](handleEntityNotFound(_0x4d9e2c,null))[_0xd645('0x26')](respondWithResult(_0x4d9e2c,null))[_0xd645('0x43')](handleError(_0x4d9e2c,null));};exports[_0xd645('0x46')]=function(_0xd09120,_0x3ffba0){return db[_0xd645('0x2b')][_0xd645('0x46')](_0xd09120[_0xd645('0x47')],{})['then'](respondWithResult(_0x3ffba0,0xc9))[_0xd645('0x43')](handleError(_0x3ffba0,null));};exports[_0xd645('0x24')]=function(_0x53e6ee,_0x126c50){if(_0x53e6ee[_0xd645('0x47')]['id']){delete _0x53e6ee[_0xd645('0x47')]['id'];}return db[_0xd645('0x2b')]['find']({'where':{'id':_0x53e6ee['params']['id']}})[_0xd645('0x26')](handleEntityNotFound(_0x126c50,null))['then'](saveUpdates(_0x53e6ee[_0xd645('0x47')],null))[_0xd645('0x26')](respondWithResult(_0x126c50,null))[_0xd645('0x43')](handleError(_0x126c50,null));};exports[_0xd645('0x25')]=function(_0x1c2999,_0x857020){return db[_0xd645('0x2b')][_0xd645('0x48')]({'where':{'id':_0x1c2999[_0xd645('0x45')]['id']}})[_0xd645('0x26')](handleEntityNotFound(_0x857020,null))[_0xd645('0x26')](removeEntity(_0x857020,null))['catch'](handleError(_0x857020,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 7499a78..e09df49 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 _0xfafd=['./intSalesforceField.attributes','exports','SalesforceField','salesforce_unique_index','FieldId','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x1e06f1,_0x59d7e1){var _0x34f77e=function(_0x4f9f26){while(--_0x4f9f26){_0x1e06f1['push'](_0x1e06f1['shift']());}};_0x34f77e(++_0x59d7e1);}(_0xfafd,0x19d));var _0xdfaf=function(_0x14e6cb,_0x2d1471){_0x14e6cb=_0x14e6cb-0x0;var _0x5fa827=_0xfafd[_0x14e6cb];return _0x5fa827;};'use strict';var _=require(_0xdfaf('0x0'));var util=require('util');var logger=require(_0xdfaf('0x1'))('api');var moment=require(_0xdfaf('0x2'));var BPromise=require(_0xdfaf('0x3'));var rp=require(_0xdfaf('0x4'));var fs=require('fs');var path=require(_0xdfaf('0x5'));var rimraf=require('rimraf');var config=require(_0xdfaf('0x6'));var attributes=require(_0xdfaf('0x7'));module[_0xdfaf('0x8')]=function(_0x35d91b,_0x5a6075){return _0x35d91b['define'](_0xdfaf('0x9'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0xdfaf('0xa'),'fields':['idField',_0xdfaf('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x47f8=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','salesforce_unique_index','idField','FieldId','lodash'];(function(_0x1efae0,_0x5534cd){var _0x8d8a5b=function(_0x4b9872){while(--_0x4b9872){_0x1efae0['push'](_0x1efae0['shift']());}};_0x8d8a5b(++_0x5534cd);}(_0x47f8,0xe0));var _0x847f=function(_0xe65c52,_0x314b5c){_0xe65c52=_0xe65c52-0x0;var _0x44cf34=_0x47f8[_0xe65c52];return _0x44cf34;};'use strict';var _=require(_0x847f('0x0'));var util=require(_0x847f('0x1'));var logger=require(_0x847f('0x2'))(_0x847f('0x3'));var moment=require(_0x847f('0x4'));var BPromise=require('bluebird');var rp=require(_0x847f('0x5'));var fs=require('fs');var path=require(_0x847f('0x6'));var rimraf=require('rimraf');var config=require(_0x847f('0x7'));var attributes=require(_0x847f('0x8'));module[_0x847f('0x9')]=function(_0x312c1d,_0x47afb3){return _0x312c1d[_0x847f('0xa')](_0x847f('0xb'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x847f('0xc'),'fields':[_0x847f('0xd'),_0x847f('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 131bcee..7a4a392 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 _0xd766=['message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x46b236,_0x89c2f0){var _0x327855=function(_0x4a612c){while(--_0x4a612c){_0x46b236['push'](_0x46b236['shift']());}};_0x327855(++_0x89c2f0);}(_0xd766,0x17f));var _0x6d76=function(_0x5db313,_0x3c8f0c){_0x5db313=_0x5db313-0x0;var _0x36d503=_0xd766[_0x5db313];return _0x36d503;};'use strict';var _=require(_0x6d76('0x0'));var util=require(_0x6d76('0x1'));var moment=require(_0x6d76('0x2'));var BPromise=require(_0x6d76('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d76('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6d76('0x5'))(_0x6d76('0x6'));var config=require(_0x6d76('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6d76('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32651d,_0x5afdc8,_0x5a4b4b){return new BPromise(function(_0x4b8013,_0xa22d6a){return client['request'](_0x32651d,_0x5a4b4b)['then'](function(_0x10b24d){logger['info'](_0x6d76('0x9'),_0x5afdc8,_0x6d76('0xa'));logger[_0x6d76('0xb')](_0x6d76('0xc'),_0x5afdc8,_0x6d76('0xa'),JSON[_0x6d76('0xd')](_0x10b24d));if(_0x10b24d['error']){if(_0x10b24d[_0x6d76('0xe')][_0x6d76('0xf')]===0x1f4){logger[_0x6d76('0xe')]('SalesforceField,\x20%s,\x20%s',_0x5afdc8,_0x10b24d[_0x6d76('0xe')][_0x6d76('0x10')]);return _0xa22d6a(_0x10b24d[_0x6d76('0xe')][_0x6d76('0x10')]);}logger[_0x6d76('0xe')](_0x6d76('0x9'),_0x5afdc8,_0x10b24d['error']['message']);return _0x4b8013(_0x10b24d[_0x6d76('0xe')]['message']);}else{logger[_0x6d76('0x11')](_0x6d76('0x9'),_0x5afdc8,_0x6d76('0xa'));_0x4b8013(_0x10b24d['result'][_0x6d76('0x10')]);}})[_0x6d76('0x12')](function(_0x1ed1d6){logger[_0x6d76('0xe')](_0x6d76('0x9'),_0x5afdc8,_0x1ed1d6);_0xa22d6a(_0x1ed1d6);});});} \ No newline at end of file +var _0x5087=['client','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x45aa9b,_0x4e9148){var _0x1ef1f9=function(_0x4d4754){while(--_0x4d4754){_0x45aa9b['push'](_0x45aa9b['shift']());}};_0x1ef1f9(++_0x4e9148);}(_0x5087,0x89));var _0x7508=function(_0x1344d6,_0x2181e6){_0x1344d6=_0x1344d6-0x0;var _0xf45b24=_0x5087[_0x1344d6];return _0xf45b24;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x7508('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7508('0x1'));var db=require(_0x7508('0x2'))['db'];var utils=require(_0x7508('0x3'));var logger=require(_0x7508('0x4'))(_0x7508('0x5'));var config=require(_0x7508('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7508('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x349f2c,_0x20dbb2,_0x500340){return new BPromise(function(_0x4718c9,_0x456f45){return client['request'](_0x349f2c,_0x500340)['then'](function(_0x33c21a){logger['info'](_0x7508('0x8'),_0x20dbb2,_0x7508('0x9'));logger[_0x7508('0xa')](_0x7508('0xb'),_0x20dbb2,'request\x20sent',JSON[_0x7508('0xc')](_0x33c21a));if(_0x33c21a[_0x7508('0xd')]){if(_0x33c21a[_0x7508('0xd')][_0x7508('0xe')]===0x1f4){logger['error'](_0x7508('0x8'),_0x20dbb2,_0x33c21a[_0x7508('0xd')][_0x7508('0xf')]);return _0x456f45(_0x33c21a[_0x7508('0xd')][_0x7508('0xf')]);}logger[_0x7508('0xd')](_0x7508('0x8'),_0x20dbb2,_0x33c21a[_0x7508('0xd')][_0x7508('0xf')]);return _0x4718c9(_0x33c21a[_0x7508('0xd')]['message']);}else{logger[_0x7508('0x10')](_0x7508('0x8'),_0x20dbb2,'request\x20sent');_0x4718c9(_0x33c21a['result']['message']);}})[_0x7508('0x11')](function(_0x5be71f){logger[_0x7508('0xd')](_0x7508('0x8'),_0x20dbb2,_0x5be71f);_0x456f45(_0x5be71f);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 2234702..e68de17 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 _0x0a67=['get','isAuthenticated','/:id','/:id/configurations','getConfigurations','getFields','post','addConfiguration','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x25236c,_0x361f4a){var _0x5b070e=function(_0x2d2408){while(--_0x2d2408){_0x25236c['push'](_0x25236c['shift']());}};_0x5b070e(++_0x361f4a);}(_0x0a67,0x1c4));var _0x70a6=function(_0x2b5128,_0x4b18a5){_0x2b5128=_0x2b5128-0x0;var _0x1ed530=_0x0a67[_0x2b5128];return _0x1ed530;};'use strict';var multer=require(_0x70a6('0x0'));var util=require(_0x70a6('0x1'));var path=require(_0x70a6('0x2'));var timeout=require(_0x70a6('0x3'));var express=require('express');var router=express[_0x70a6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x70a6('0x5'));var interaction=require(_0x70a6('0x6'));var config=require('../../config/environment');var controller=require('./intServicenowAccount.controller');router[_0x70a6('0x7')]('/',auth[_0x70a6('0x8')](),controller['index']);router[_0x70a6('0x7')](_0x70a6('0x9'),auth[_0x70a6('0x8')](),controller['show']);router[_0x70a6('0x7')](_0x70a6('0xa'),auth[_0x70a6('0x8')](),controller[_0x70a6('0xb')]);router['get']('/:id/fields',auth[_0x70a6('0x8')](),controller[_0x70a6('0xc')]);router[_0x70a6('0xd')]('/',auth[_0x70a6('0x8')](),controller['create']);router[_0x70a6('0xd')](_0x70a6('0xa'),auth[_0x70a6('0x8')](),controller[_0x70a6('0xe')]);router['put'](_0x70a6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x70a6('0xf')](_0x70a6('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x70a6('0x10')]=router; \ No newline at end of file +var _0x138d=['getConfigurations','/:id/fields','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','get','isAuthenticated','/:id','/:id/configurations'];(function(_0x1220ff,_0xbdde2b){var _0x483115=function(_0x336f34){while(--_0x336f34){_0x1220ff['push'](_0x1220ff['shift']());}};_0x483115(++_0xbdde2b);}(_0x138d,0x1ab));var _0xd138=function(_0x9be28f,_0x231334){_0x9be28f=_0x9be28f-0x0;var _0xa9f52d=_0x138d[_0x9be28f];return _0xa9f52d;};'use strict';var multer=require(_0xd138('0x0'));var util=require(_0xd138('0x1'));var path=require('path');var timeout=require(_0xd138('0x2'));var express=require(_0xd138('0x3'));var router=express[_0xd138('0x4')]();var fs_extra=require(_0xd138('0x5'));var auth=require(_0xd138('0x6'));var interaction=require(_0xd138('0x7'));var config=require('../../config/environment');var controller=require(_0xd138('0x8'));router[_0xd138('0x9')]('/',auth[_0xd138('0xa')](),controller['index']);router[_0xd138('0x9')](_0xd138('0xb'),auth[_0xd138('0xa')](),controller['show']);router['get'](_0xd138('0xc'),auth[_0xd138('0xa')](),controller[_0xd138('0xd')]);router['get'](_0xd138('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0xd138('0xf')]('/',auth[_0xd138('0xa')](),controller[_0xd138('0x10')]);router[_0xd138('0xf')]('/:id/configurations',auth[_0xd138('0xa')](),controller['addConfiguration']);router[_0xd138('0x11')](_0xd138('0xb'),auth[_0xd138('0xa')](),controller[_0xd138('0x12')]);router[_0xd138('0x13')](_0xd138('0xb'),auth[_0xd138('0xa')](),controller[_0xd138('0x14')]);module[_0xd138('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 1232293..c48e19d 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 _0x734e=['sequelize','STRING','username','remoteUri'];(function(_0x47375b,_0x41d61c){var _0x3cde7f=function(_0x350c3c){while(--_0x350c3c){_0x47375b['push'](_0x47375b['shift']());}};_0x3cde7f(++_0x41d61c);}(_0x734e,0x184));var _0xe734=function(_0x25662e,_0x4cec68){_0x25662e=_0x25662e-0x0;var _0x59b7bc=_0x734e[_0x25662e];return _0x59b7bc;};'use strict';var Sequelize=require(_0xe734('0x0'));module['exports']={'name':{'type':Sequelize[_0xe734('0x1')]},'description':{'type':Sequelize[_0xe734('0x1')]},'username':{'type':Sequelize[_0xe734('0x1')],'unique':_0xe734('0x2')},'password':{'type':Sequelize[_0xe734('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xe734('0x1')],'unique':_0xe734('0x3')},'serverUrl':{'type':Sequelize[_0xe734('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xd2ce=['username','sequelize','exports','STRING'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xd2ce,0x161));var _0xed2c=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xd2ce[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0xed2c('0x0'));module[_0xed2c('0x1')]={'name':{'type':Sequelize[_0xed2c('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0xed2c('0x3')},'password':{'type':Sequelize[_0xed2c('0x2')]},'email':{'type':Sequelize[_0xed2c('0x2')]},'remoteUri':{'type':Sequelize[_0xed2c('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xed2c('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 e576c2a..b563ed1 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 _0xb752=['sla_due','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','location','category','username','password','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','concat','ServiceNow\x20error:\x20','statusCode','send','test','boolean','True','true','sys_choice?sysparm_query=name=incident^element=','inactive','false','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','undefined','offset','count','limit','set','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','ServicenowAccount','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','getConfigurations','findOne','order','pick','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','Subjects','made_sla','hold_reason','knowledge','close_code','severity','parent','caused_by','upon_reject','child_incidents','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','business_service','priority','sys_domain_path','time_worked','expected_start','opened_at','business_duration','group_list','reopened_time','resolved_at','caller_id','approval_set','subcategory','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','notify','sys_class_name','close_notes','parent_incident','contact_type','reopened_by','incident_state','problem_id','company','reassignment_count','activity_due'];(function(_0xbf2a7a,_0x4d86fb){var _0x491a4a=function(_0x5c4635){while(--_0x5c4635){_0xbf2a7a['push'](_0xbf2a7a['shift']());}};_0x491a4a(++_0x4d86fb);}(_0xb752,0xf3));var _0x2b75=function(_0x38d9fe,_0x38e50e){_0x38d9fe=_0x38d9fe-0x0;var _0x92ed0a=_0xb752[_0x38d9fe];return _0x92ed0a;};'use strict';var emlformat=require(_0x2b75('0x0'));var rimraf=require(_0x2b75('0x1'));var zipdir=require(_0x2b75('0x2'));var jsonpatch=require(_0x2b75('0x3'));var rp=require(_0x2b75('0x4'));var moment=require(_0x2b75('0x5'));var BPromise=require(_0x2b75('0x6'));var Mustache=require(_0x2b75('0x7'));var util=require(_0x2b75('0x8'));var path=require('path');var sox=require(_0x2b75('0x9'));var csv=require(_0x2b75('0xa'));var ejs=require(_0x2b75('0xb'));var fs=require('fs');var fs_extra=require(_0x2b75('0xc'));var _=require(_0x2b75('0xd'));var squel=require(_0x2b75('0xe'));var crypto=require('crypto');var jsforce=require(_0x2b75('0xf'));var deskjs=require(_0x2b75('0x10'));var toCsv=require(_0x2b75('0xa'));var querystring=require(_0x2b75('0x11'));var Papa=require(_0x2b75('0x12'));var Redis=require(_0x2b75('0x13'));var authService=require(_0x2b75('0x14'));var qs=require(_0x2b75('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2b75('0x16'));var logger=require(_0x2b75('0x17'))(_0x2b75('0x18'));var utils=require(_0x2b75('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x2b75('0x1a'));var db=require(_0x2b75('0x1b'))['db'];var integrations=require(_0x2b75('0x1c'));function respondWithStatusCode(_0x5e0300,_0x335fda){_0x335fda=_0x335fda||0xcc;return function(_0x564160){if(_0x564160){return _0x5e0300[_0x2b75('0x1d')](_0x335fda);}return _0x5e0300[_0x2b75('0x1e')](_0x335fda)['end']();};}function respondWithResult(_0x397adf,_0x42f75e){_0x42f75e=_0x42f75e||0xc8;return function(_0x2c1341){if(_0x2c1341){return _0x397adf[_0x2b75('0x1e')](_0x42f75e)[_0x2b75('0x1f')](_0x2c1341);}};}function respondWithFilteredResult(_0x404818,_0x58c596){return function(_0x5b496c){if(_0x5b496c){var _0x45cce4=typeof _0x58c596['offset']===_0x2b75('0x20')&&typeof _0x58c596['limit']===_0x2b75('0x20');var _0x4d9f10=_0x5b496c['count'];var _0x2f2a84=_0x45cce4?0x0:_0x58c596[_0x2b75('0x21')];var _0x3b9e56=_0x45cce4?_0x5b496c[_0x2b75('0x22')]:_0x58c596[_0x2b75('0x21')]+_0x58c596[_0x2b75('0x23')];var _0x4e9c77;if(_0x3b9e56>=_0x4d9f10){_0x3b9e56=_0x4d9f10;_0x4e9c77=0xc8;}else{_0x4e9c77=0xce;}_0x404818['status'](_0x4e9c77);return _0x404818[_0x2b75('0x24')]('Content-Range',_0x2f2a84+'-'+_0x3b9e56+'/'+_0x4d9f10)[_0x2b75('0x1f')](_0x5b496c);}return null;};}function patchUpdates(_0xe5aec0){return function(_0x460d49){try{jsonpatch[_0x2b75('0x25')](_0x460d49,_0xe5aec0,!![]);}catch(_0xac334b){return BPromise[_0x2b75('0x26')](_0xac334b);}return _0x460d49[_0x2b75('0x27')]();};}function saveUpdates(_0x18e12b,_0x2ffe9c){return function(_0xd2a1e9){if(_0xd2a1e9){return _0xd2a1e9[_0x2b75('0x28')](_0x18e12b)[_0x2b75('0x29')](function(_0x3c800f){return _0x3c800f;});}return null;};}function removeEntity(_0x31b9cc,_0x1be16a){return function(_0x36b528){if(_0x36b528){return _0x36b528[_0x2b75('0x2a')]()[_0x2b75('0x29')](function(){_0x31b9cc[_0x2b75('0x1e')](0xcc)[_0x2b75('0x2b')]();});}};}function handleEntityNotFound(_0x2a73d9,_0x3688ab){return function(_0x49e987){if(!_0x49e987){_0x2a73d9['sendStatus'](0x194);}return _0x49e987;};}function handleError(_0x59df06,_0x48a427){_0x48a427=_0x48a427||0x1f4;return function(_0x43e0a0){logger[_0x2b75('0x2c')](_0x43e0a0[_0x2b75('0x2d')]);if(_0x43e0a0[_0x2b75('0x2e')]){delete _0x43e0a0[_0x2b75('0x2e')];}_0x59df06[_0x2b75('0x1e')](_0x48a427)['send'](_0x43e0a0);};}exports[_0x2b75('0x2f')]=function(_0x304fed,_0x21d43f){var _0x100dbf={},_0x49e6bd={},_0x384b71={'count':0x0,'rows':[]};var _0x5ea031=_[_0x2b75('0x30')](db[_0x2b75('0x31')]['rawAttributes'],function(_0x32adfd){return{'name':_0x32adfd[_0x2b75('0x32')],'type':_0x32adfd[_0x2b75('0x33')][_0x2b75('0x34')]};});_0x49e6bd[_0x2b75('0x35')]=_[_0x2b75('0x30')](_0x5ea031,_0x2b75('0x2e'));_0x49e6bd['query']=_['keys'](_0x304fed[_0x2b75('0x36')]);_0x49e6bd['filters']=_[_0x2b75('0x37')](_0x49e6bd[_0x2b75('0x35')],_0x49e6bd['query']);_0x100dbf[_0x2b75('0x38')]=_[_0x2b75('0x37')](_0x49e6bd[_0x2b75('0x35')],qs[_0x2b75('0x39')](_0x304fed[_0x2b75('0x36')][_0x2b75('0x39')]));_0x100dbf[_0x2b75('0x38')]=_0x100dbf[_0x2b75('0x38')][_0x2b75('0x3a')]?_0x100dbf[_0x2b75('0x38')]:_0x49e6bd[_0x2b75('0x35')];if(!_0x304fed[_0x2b75('0x36')][_0x2b75('0x3b')](_0x2b75('0x3c'))){_0x100dbf['limit']=qs[_0x2b75('0x23')](_0x304fed[_0x2b75('0x36')][_0x2b75('0x23')]);_0x100dbf[_0x2b75('0x21')]=qs['offset'](_0x304fed[_0x2b75('0x36')][_0x2b75('0x21')]);}_0x100dbf['order']=qs[_0x2b75('0x3d')](_0x304fed[_0x2b75('0x36')][_0x2b75('0x3d')]);_0x100dbf[_0x2b75('0x3e')]=qs[_0x2b75('0x3f')](_['pick'](_0x304fed[_0x2b75('0x36')],_0x49e6bd[_0x2b75('0x3f')]),_0x5ea031);if(_0x304fed['query'][_0x2b75('0x40')]){_0x100dbf['where']=_[_0x2b75('0x41')](_0x100dbf[_0x2b75('0x3e')],{'$or':_[_0x2b75('0x30')](_0x5ea031,function(_0x407c9d){if(_0x407c9d['type']!==_0x2b75('0x42')){var _0x5e20e6={};_0x5e20e6[_0x407c9d[_0x2b75('0x2e')]]={'$like':'%'+_0x304fed[_0x2b75('0x36')][_0x2b75('0x40')]+'%'};return _0x5e20e6;}})});}_0x100dbf=_[_0x2b75('0x41')]({},_0x100dbf,_0x304fed[_0x2b75('0x43')]);var _0x5dabf2={'where':_0x100dbf['where']};return db[_0x2b75('0x31')][_0x2b75('0x22')](_0x5dabf2)[_0x2b75('0x29')](function(_0x5bf705){_0x384b71[_0x2b75('0x22')]=_0x5bf705;if(_0x304fed['query'][_0x2b75('0x44')]){_0x100dbf[_0x2b75('0x45')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x2b75('0x46')](_0x100dbf);})['then'](function(_0x25f791){_0x384b71[_0x2b75('0x47')]=_0x25f791;return _0x384b71;})[_0x2b75('0x29')](respondWithFilteredResult(_0x21d43f,_0x100dbf))[_0x2b75('0x48')](handleError(_0x21d43f,null));};exports[_0x2b75('0x49')]=function(_0x39220d,_0x381012){var _0x3e99f6={'raw':![],'where':{'id':_0x39220d[_0x2b75('0x4a')]['id']}},_0x4fd44e={};_0x4fd44e[_0x2b75('0x35')]=_[_0x2b75('0x4b')](db[_0x2b75('0x31')][_0x2b75('0x4c')]);_0x4fd44e[_0x2b75('0x36')]=_[_0x2b75('0x4b')](_0x39220d[_0x2b75('0x36')]);_0x4fd44e['filters']=_['intersection'](_0x4fd44e['model'],_0x4fd44e[_0x2b75('0x36')]);_0x3e99f6[_0x2b75('0x38')]=_[_0x2b75('0x37')](_0x4fd44e['model'],qs[_0x2b75('0x39')](_0x39220d[_0x2b75('0x36')][_0x2b75('0x39')]));_0x3e99f6[_0x2b75('0x38')]=_0x3e99f6[_0x2b75('0x38')]['length']?_0x3e99f6[_0x2b75('0x38')]:_0x4fd44e['model'];if(_0x39220d[_0x2b75('0x36')]['includeAll']){_0x3e99f6[_0x2b75('0x45')]=[{'all':!![]}];}_0x3e99f6=_['merge']({},_0x3e99f6,_0x39220d['options']);return db[_0x2b75('0x31')][_0x2b75('0x4d')](_0x3e99f6)[_0x2b75('0x29')](handleEntityNotFound(_0x381012,null))[_0x2b75('0x29')](respondWithResult(_0x381012,null))['catch'](handleError(_0x381012,null));};exports['create']=function(_0x20b74d,_0x28be8c){return db['ServicenowAccount'][_0x2b75('0x4e')](_0x20b74d[_0x2b75('0x4f')],{})[_0x2b75('0x29')](respondWithResult(_0x28be8c,0xc9))[_0x2b75('0x48')](handleError(_0x28be8c,null));};exports[_0x2b75('0x28')]=function(_0x5ce606,_0x45e468){if(_0x5ce606['body']['id']){delete _0x5ce606[_0x2b75('0x4f')]['id'];}return db[_0x2b75('0x31')][_0x2b75('0x4d')]({'where':{'id':_0x5ce606['params']['id']}})[_0x2b75('0x29')](handleEntityNotFound(_0x45e468,null))[_0x2b75('0x29')](saveUpdates(_0x5ce606[_0x2b75('0x4f')],null))['then'](respondWithResult(_0x45e468,null))[_0x2b75('0x48')](handleError(_0x45e468,null));};exports['destroy']=function(_0x2bab2c,_0x4aefba){return db['ServicenowAccount'][_0x2b75('0x4d')]({'where':{'id':_0x2bab2c[_0x2b75('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4aefba,null))[_0x2b75('0x29')](removeEntity(_0x4aefba,null))['catch'](handleError(_0x4aefba,null));};exports[_0x2b75('0x50')]=function(_0x341c9a,_0x288b33,_0x2ae3f3){var _0x567c9e={};var _0x4a46f9={};var _0x4c0f0f;var _0x1ba0a7;return db[_0x2b75('0x31')][_0x2b75('0x51')]({'where':{'id':_0x341c9a[_0x2b75('0x4a')]['id']}})[_0x2b75('0x29')](handleEntityNotFound(_0x288b33,null))['then'](function(_0x2e9b52){if(_0x2e9b52){_0x4c0f0f=_0x2e9b52;_0x4a46f9[_0x2b75('0x35')]=_[_0x2b75('0x4b')](db['ServicenowConfiguration']['rawAttributes']);_0x4a46f9[_0x2b75('0x36')]=_[_0x2b75('0x4b')](_0x341c9a['query']);_0x4a46f9['filters']=_[_0x2b75('0x37')](_0x4a46f9['model'],_0x4a46f9[_0x2b75('0x36')]);_0x567c9e[_0x2b75('0x38')]=_[_0x2b75('0x37')](_0x4a46f9['model'],qs[_0x2b75('0x39')](_0x341c9a[_0x2b75('0x36')]['fields']));_0x567c9e[_0x2b75('0x38')]=_0x567c9e[_0x2b75('0x38')][_0x2b75('0x3a')]?_0x567c9e[_0x2b75('0x38')]:_0x4a46f9[_0x2b75('0x35')];_0x567c9e[_0x2b75('0x52')]=qs['sort'](_0x341c9a['query'][_0x2b75('0x3d')]);_0x567c9e[_0x2b75('0x3e')]=qs['filters'](_[_0x2b75('0x53')](_0x341c9a[_0x2b75('0x36')],_0x4a46f9[_0x2b75('0x3f')]));if(_0x341c9a[_0x2b75('0x36')][_0x2b75('0x40')]){_0x567c9e[_0x2b75('0x3e')]=_[_0x2b75('0x41')](_0x567c9e['where'],{'$or':_[_0x2b75('0x30')](_0x567c9e[_0x2b75('0x38')],function(_0x5339b3){var _0x33e1bc={};_0x33e1bc[_0x5339b3]={'$like':'%'+_0x341c9a[_0x2b75('0x36')][_0x2b75('0x40')]+'%'};return _0x33e1bc;})});}_0x567c9e=_[_0x2b75('0x41')]({},_0x567c9e,_0x341c9a[_0x2b75('0x43')]);return _0x4c0f0f['getConfigurations'](_0x567c9e);}})[_0x2b75('0x29')](function(_0x7cc98d){if(_0x7cc98d){_0x1ba0a7=_0x7cc98d[_0x2b75('0x3a')];if(!_0x341c9a[_0x2b75('0x36')][_0x2b75('0x3b')](_0x2b75('0x3c'))){_0x567c9e['limit']=qs[_0x2b75('0x23')](_0x341c9a['query']['limit']);_0x567c9e[_0x2b75('0x21')]=qs[_0x2b75('0x21')](_0x341c9a['query'][_0x2b75('0x21')]);}return _0x4c0f0f['getConfigurations'](_0x567c9e);}})['then'](function(_0x4ec9c1){if(_0x4ec9c1){return _0x4ec9c1?{'count':_0x1ba0a7,'rows':_0x4ec9c1}:null;}})['then'](respondWithResult(_0x288b33,null))['catch'](handleError(_0x288b33,null));};exports[_0x2b75('0x54')]=function(_0x1608d3,_0x2478d3,_0x46e973){if(_0x1608d3[_0x2b75('0x4f')]['id']){delete _0x1608d3[_0x2b75('0x4f')]['id'];}return db['ServicenowAccount'][_0x2b75('0x51')]({'where':{'id':_0x1608d3[_0x2b75('0x4a')]['id']}})[_0x2b75('0x29')](handleEntityNotFound(_0x2478d3,null))[_0x2b75('0x29')](function(_0x422e71){if(_0x422e71){_0x1608d3['body'][_0x2b75('0x55')]=_0x422e71['id'];_0x1608d3['body']['Subjects']=integrations[_0x2b75('0x56')](_0x1608d3[_0x2b75('0x4f')][_0x2b75('0x57')],_0x1608d3[_0x2b75('0x4f')][_0x2b75('0x33')]);_0x1608d3[_0x2b75('0x4f')][_0x2b75('0x58')]=integrations[_0x2b75('0x59')](_0x1608d3[_0x2b75('0x4f')][_0x2b75('0x57')],_0x1608d3[_0x2b75('0x4f')][_0x2b75('0x33')]);return db[_0x2b75('0x5a')][_0x2b75('0x4e')](_0x1608d3[_0x2b75('0x4f')],{'include':[{'model':db[_0x2b75('0x5b')],'as':_0x2b75('0x5c')},{'model':db[_0x2b75('0x5b')],'as':_0x2b75('0x58')}]});}return null;})[_0x2b75('0x29')](respondWithResult(_0x2478d3,null))[_0x2b75('0x48')](handleError(_0x2478d3,null));};exports['getFields']=function(_0x3418f4,_0x28cfc0,_0xe44816){var _0xcb697d=[_0x2b75('0x5d'),_0x2b75('0x5e'),_0x2b75('0x5f'),'subcategory',_0x2b75('0x60'),'notify','incident_state',_0x2b75('0x61'),'category'];var _0x918db1=[_0x2b75('0x62'),_0x2b75('0x5d'),_0x2b75('0x63'),'watch_list',_0x2b75('0x64'),'sys_updated_on',_0x2b75('0x65'),_0x2b75('0x5e'),'approval_history','number',_0x2b75('0x66'),_0x2b75('0x67'),_0x2b75('0x68'),_0x2b75('0x69'),_0x2b75('0x6a'),_0x2b75('0x6b'),_0x2b75('0x6c'),_0x2b75('0x6d'),_0x2b75('0x5f'),_0x2b75('0x52'),_0x2b75('0x6e'),_0x2b75('0x6f'),_0x2b75('0x70'),_0x2b75('0x71'),_0x2b75('0x72'),'active','work_notes_list',_0x2b75('0x73'),_0x2b75('0x74'),_0x2b75('0x75'),'rfc',_0x2b75('0x76'),_0x2b75('0x77'),_0x2b75('0x78'),_0x2b75('0x79'),_0x2b75('0x7a'),'work_end',_0x2b75('0x7b'),_0x2b75('0x7c'),_0x2b75('0x7d'),_0x2b75('0x7e'),_0x2b75('0x7f'),_0x2b75('0x80'),_0x2b75('0x81'),'close_code',_0x2b75('0x82'),_0x2b75('0x83'),_0x2b75('0x84'),_0x2b75('0x85'),_0x2b75('0x86'),_0x2b75('0x87'),_0x2b75('0x88'),_0x2b75('0x89'),_0x2b75('0x8a'),_0x2b75('0x8b'),_0x2b75('0x8c'),'closed_by','follow_up',_0x2b75('0x8d'),'sys_id',_0x2b75('0x8e'),_0x2b75('0x8f'),_0x2b75('0x90'),'urgency',_0x2b75('0x91'),_0x2b75('0x92'),_0x2b75('0x93'),_0x2b75('0x94'),'assigned_to',_0x2b75('0x61'),'comments',_0x2b75('0x95'),'approval',_0x2b75('0x96'),_0x2b75('0x97'),_0x2b75('0x98'),_0x2b75('0x99'),_0x2b75('0x9a'),_0x2b75('0x9b'),_0x2b75('0x9c'),'correlation_id',_0x2b75('0x9d'),_0x2b75('0x9e')];var _0x5895bf='';var _0x3cbd2f='';var _0x37f4ca=[];var _0x2652af='';var _0x2ab79e='';var _0x3466b5=[];var _0x27beca='';var _0x370fae='';var _0x24267f={};var _0x38ea3e='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x3418f4[_0x2b75('0x4a')]['id']},'attributes':['id',_0x2b75('0x9f'),_0x2b75('0xa0'),'email',_0x2b75('0xa1'),_0x2b75('0xa2')]})['then'](handleEntityNotFound(_0x28cfc0,null))[_0x2b75('0x29')](function(_0x54714e){if(_0x54714e){_0x38ea3e=_0x54714e[_0x2b75('0xa1')];var _0x549289=_0x38ea3e[_0x2b75('0xa3')](-0x1);if(_0x549289==='/'){_0x38ea3e=_0x38ea3e[_0x2b75('0xa4')](0x0,_0x38ea3e[_0x2b75('0xa5')](_0x549289));}_0x370fae=util[_0x2b75('0xa6')](_0x2b75('0xa7'),_0x38ea3e);_0x27beca=util[_0x2b75('0xa6')](_0x2b75('0xa8'),_0x38ea3e);_0x24267f={'user':_0x54714e[_0x2b75('0x9f')],'pass':_0x54714e[_0x2b75('0xa0')]};var _0x54c426={'method':_0x2b75('0xa9'),'uri':_0x370fae+_0x2b75('0xaa'),'auth':_0x24267f,'json':!![]};return rp(_0x54c426);}})['then'](function(_0x523ee1){if(_0x523ee1[_0x2b75('0xab')]['length']>0x0){_0x5895bf=_0x523ee1['result'];}console[_0x2b75('0xac')](_0x2b75('0xad'),_0x5895bf);_0x3466b5=[];_0x3cbd2f=Object[_0x2b75('0xae')]([],_0x5895bf);_[_0x2b75('0xaf')](_0x3cbd2f,function(_0x1c53c2){return!_0xcb697d[_0x2b75('0xb0')](_0x1c53c2['name']);});_0x3cbd2f[_0x2b75('0xb1')](function(_0x1c964b){var _0x272715=createFieldObject(_0x27beca,_0x24267f,_0x1c964b[_0x2b75('0xb2')],_0x1c964b[_0x2b75('0x2e')],_0x1c964b['label'],![]);_0x3466b5[_0x2b75('0xb3')](_0x272715);});return Promise[_0x2b75('0xb4')](_0x3466b5);})[_0x2b75('0x29')](function(_0xdd85f6){_0x37f4ca=_0xdd85f6;_0x2652af=Object[_0x2b75('0xae')]([],_0x5895bf);console[_0x2b75('0xac')](_0x2b75('0xb5'),_0x5895bf);_['remove'](_0x2652af,function(_0x1e7ecb){return _0x918db1[_0x2b75('0xb0')](_0x1e7ecb['name']);});console['log'](_0x2b75('0xb6'),_0x2652af);_0x3466b5=[];_0x2652af[_0x2b75('0xb1')](function(_0x23a82a){var _0x8667df=createFieldObject(_0x27beca,_0x24267f,_0x23a82a[_0x2b75('0xb2')],_0x23a82a['name'],_0x23a82a[_0x2b75('0xb7')],!![]);_0x3466b5[_0x2b75('0xb3')](_0x8667df);});return Promise['all'](_0x3466b5);})['then'](function(_0x4bef2e){_0x2ab79e=_0x4bef2e;var _0x2b28ad=_0x37f4ca[_0x2b75('0xb8')](_0x2ab79e);return{'count':_0x2b28ad[_0x2b75('0x3a')],'rows':_0x2b28ad};})[_0x2b75('0x29')](respondWithResult(_0x28cfc0,null))[_0x2b75('0x48')](function(_0x6d71d1){console['log'](_0x2b75('0xb9')+_0x6d71d1);var _0x480c92=_0x3418f4['query']['test']?0x1f4:_0x6d71d1[_0x2b75('0xba')]||0x1f4;logger['error'](_0x6d71d1['stack']);delete _0x6d71d1['name'];if(_0x480c92===0x191){_0x480c92=0x190;}_0x28cfc0[_0x2b75('0x1e')](_0x480c92)[_0x2b75('0xbb')](_0x3418f4[_0x2b75('0x36')][_0x2b75('0xbc')]?{'message':'Wrong\x20credentials','statusCode':_0x6d71d1[_0x2b75('0xba')]}:_0x6d71d1);});};function createFieldObject(_0x1cb80d,_0x7f16d7,_0x50d426,_0x547335,_0x1f452c,_0x336cee){return new Promise(function(_0x14f477,_0x538d48){var _0x41e318={'id':_0x547335,'name':_0x1f452c,'custom':_0x336cee};if(_0x50d426===_0x2b75('0xbd')){_0x41e318[_0x2b75('0x43')]=[{'name':_0x2b75('0xbe'),'value':_0x2b75('0xbf')},{'name':'False','value':'false'}];_0x14f477(_0x41e318);}else{var _0x196792={'method':_0x2b75('0xa9'),'uri':_0x1cb80d+_0x2b75('0xc0')+_0x547335,'auth':_0x7f16d7,'json':!![]};return rp(_0x196792)[_0x2b75('0x29')](function(_0x3cdf4d){var _0x588b4f=[];if(_0x3cdf4d[_0x2b75('0xab')][_0x2b75('0x3a')]>0x0){_0x3cdf4d['result'][_0x2b75('0xb1')](function(_0x2ea486){if(_0x2ea486[_0x2b75('0xc1')]===_0x2b75('0xc2')){var _0x9264d5={'name':_0x2ea486[_0x2b75('0xb7')],'value':_0x2ea486[_0x2b75('0xc3')]};_0x588b4f[_0x2b75('0xb3')](_0x9264d5);}});}_0x41e318[_0x2b75('0x43')]=_0x588b4f;if(_0x41e318['options'][_0x2b75('0x3a')]>0x0){_0x14f477(_0x41e318);}else{if(_0x336cee==![]){_0x14f477();}else{_0x14f477(_0x41e318);}}});}});} \ No newline at end of file +var _0xcd81=['business_duration','group_list','work_end','reopened_time','resolved_at','approval_set','work_notes','short_description','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','parent_incident','sys_id','contact_type','reopened_by','company','reassignment_count','activity_due','assigned_to','comments','approval','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','category','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/table/','username','GET','incident?sysparm_display_value=all','result','log','assign','remove','includes','forEach','internalType','label','push','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','true','False','sys_choice?sysparm_query=name=incident^element=','false','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','limit','undefined','count','offset','set','Content-Range','json','apply','reject','update','then','destroy','end','error','stack','name','send','index','ServicenowAccount','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','options','includeAll','include','findAll','rows','params','create','catch','body','find','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','ServicenowField','getFields','made_sla','subcategory','notify','incident_state','severity','parent','caused_by','watch_list','sys_updated_on','child_incidents','hold_reason','approval_history','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','knowledge','calendar_stc','cmdb_ci','impact','active','work_notes_list','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at'];(function(_0x25f0d5,_0xc2dbf1){var _0x3dac6b=function(_0x6906e9){while(--_0x6906e9){_0x25f0d5['push'](_0x25f0d5['shift']());}};_0x3dac6b(++_0xc2dbf1);}(_0xcd81,0x1c6));var _0x1cd8=function(_0x519ca6,_0x47f77a){_0x519ca6=_0x519ca6-0x0;var _0x1b6861=_0xcd81[_0x519ca6];return _0x1b6861;};'use strict';var emlformat=require(_0x1cd8('0x0'));var rimraf=require(_0x1cd8('0x1'));var zipdir=require(_0x1cd8('0x2'));var jsonpatch=require(_0x1cd8('0x3'));var rp=require(_0x1cd8('0x4'));var moment=require('moment');var BPromise=require(_0x1cd8('0x5'));var Mustache=require(_0x1cd8('0x6'));var util=require(_0x1cd8('0x7'));var path=require(_0x1cd8('0x8'));var sox=require(_0x1cd8('0x9'));var csv=require(_0x1cd8('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cd8('0xb'));var _=require(_0x1cd8('0xc'));var squel=require('squel');var crypto=require(_0x1cd8('0xd'));var jsforce=require(_0x1cd8('0xe'));var deskjs=require(_0x1cd8('0xf'));var toCsv=require(_0x1cd8('0xa'));var querystring=require(_0x1cd8('0x10'));var Papa=require(_0x1cd8('0x11'));var Redis=require('ioredis');var authService=require(_0x1cd8('0x12'));var qs=require(_0x1cd8('0x13'));var as=require(_0x1cd8('0x14'));var hardwareService=require(_0x1cd8('0x15'));var logger=require(_0x1cd8('0x16'))(_0x1cd8('0x17'));var utils=require('../../config/utils');var config=require(_0x1cd8('0x18'));var licenseUtil=require(_0x1cd8('0x19'));var db=require(_0x1cd8('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x49bd4a,_0x3e9ee8){_0x3e9ee8=_0x3e9ee8||0xcc;return function(_0x5c0998){if(_0x5c0998){return _0x49bd4a[_0x1cd8('0x1b')](_0x3e9ee8);}return _0x49bd4a[_0x1cd8('0x1c')](_0x3e9ee8)['end']();};}function respondWithResult(_0x4ce961,_0x922b7e){_0x922b7e=_0x922b7e||0xc8;return function(_0x18d5f6){if(_0x18d5f6){return _0x4ce961['status'](_0x922b7e)['json'](_0x18d5f6);}};}function respondWithFilteredResult(_0x37cf59,_0x3e26a5){return function(_0x245ca3){if(_0x245ca3){var _0x388dd5=typeof _0x3e26a5['offset']==='undefined'&&typeof _0x3e26a5[_0x1cd8('0x1d')]===_0x1cd8('0x1e');var _0x49c89a=_0x245ca3[_0x1cd8('0x1f')];var _0x41a22d=_0x388dd5?0x0:_0x3e26a5[_0x1cd8('0x20')];var _0x4fead3=_0x388dd5?_0x245ca3[_0x1cd8('0x1f')]:_0x3e26a5[_0x1cd8('0x20')]+_0x3e26a5[_0x1cd8('0x1d')];var _0x153b8d;if(_0x4fead3>=_0x49c89a){_0x4fead3=_0x49c89a;_0x153b8d=0xc8;}else{_0x153b8d=0xce;}_0x37cf59['status'](_0x153b8d);return _0x37cf59[_0x1cd8('0x21')](_0x1cd8('0x22'),_0x41a22d+'-'+_0x4fead3+'/'+_0x49c89a)[_0x1cd8('0x23')](_0x245ca3);}return null;};}function patchUpdates(_0x4a9a97){return function(_0x2d58c7){try{jsonpatch[_0x1cd8('0x24')](_0x2d58c7,_0x4a9a97,!![]);}catch(_0x464d4b){return BPromise[_0x1cd8('0x25')](_0x464d4b);}return _0x2d58c7['save']();};}function saveUpdates(_0xf2e676,_0x470a88){return function(_0x4981bf){if(_0x4981bf){return _0x4981bf[_0x1cd8('0x26')](_0xf2e676)[_0x1cd8('0x27')](function(_0x26e3e8){return _0x26e3e8;});}return null;};}function removeEntity(_0x5c5080,_0x501353){return function(_0x2b83a0){if(_0x2b83a0){return _0x2b83a0[_0x1cd8('0x28')]()[_0x1cd8('0x27')](function(){_0x5c5080[_0x1cd8('0x1c')](0xcc)[_0x1cd8('0x29')]();});}};}function handleEntityNotFound(_0x43b5b4,_0x1c58a9){return function(_0x5ac2d8){if(!_0x5ac2d8){_0x43b5b4[_0x1cd8('0x1b')](0x194);}return _0x5ac2d8;};}function handleError(_0x270135,_0x2f1fab){_0x2f1fab=_0x2f1fab||0x1f4;return function(_0x15c990){logger[_0x1cd8('0x2a')](_0x15c990[_0x1cd8('0x2b')]);if(_0x15c990[_0x1cd8('0x2c')]){delete _0x15c990[_0x1cd8('0x2c')];}_0x270135['status'](_0x2f1fab)[_0x1cd8('0x2d')](_0x15c990);};}exports[_0x1cd8('0x2e')]=function(_0x35f532,_0x14b03f){var _0x68f1fb={},_0xd413a1={},_0x19e003={'count':0x0,'rows':[]};var _0x39d792=_['map'](db[_0x1cd8('0x2f')][_0x1cd8('0x30')],function(_0xae9158){return{'name':_0xae9158[_0x1cd8('0x31')],'type':_0xae9158[_0x1cd8('0x32')][_0x1cd8('0x33')]};});_0xd413a1['model']=_[_0x1cd8('0x34')](_0x39d792,_0x1cd8('0x2c'));_0xd413a1[_0x1cd8('0x35')]=_[_0x1cd8('0x36')](_0x35f532[_0x1cd8('0x35')]);_0xd413a1[_0x1cd8('0x37')]=_[_0x1cd8('0x38')](_0xd413a1[_0x1cd8('0x39')],_0xd413a1[_0x1cd8('0x35')]);_0x68f1fb[_0x1cd8('0x3a')]=_[_0x1cd8('0x38')](_0xd413a1[_0x1cd8('0x39')],qs['fields'](_0x35f532['query'][_0x1cd8('0x3b')]));_0x68f1fb[_0x1cd8('0x3a')]=_0x68f1fb[_0x1cd8('0x3a')][_0x1cd8('0x3c')]?_0x68f1fb[_0x1cd8('0x3a')]:_0xd413a1[_0x1cd8('0x39')];if(!_0x35f532[_0x1cd8('0x35')][_0x1cd8('0x3d')](_0x1cd8('0x3e'))){_0x68f1fb[_0x1cd8('0x1d')]=qs[_0x1cd8('0x1d')](_0x35f532[_0x1cd8('0x35')]['limit']);_0x68f1fb[_0x1cd8('0x20')]=qs[_0x1cd8('0x20')](_0x35f532[_0x1cd8('0x35')][_0x1cd8('0x20')]);}_0x68f1fb[_0x1cd8('0x3f')]=qs[_0x1cd8('0x40')](_0x35f532[_0x1cd8('0x35')][_0x1cd8('0x40')]);_0x68f1fb['where']=qs['filters'](_[_0x1cd8('0x41')](_0x35f532[_0x1cd8('0x35')],_0xd413a1['filters']),_0x39d792);if(_0x35f532[_0x1cd8('0x35')]['filter']){_0x68f1fb[_0x1cd8('0x42')]=_[_0x1cd8('0x43')](_0x68f1fb[_0x1cd8('0x42')],{'$or':_[_0x1cd8('0x34')](_0x39d792,function(_0x3c49d9){if(_0x3c49d9[_0x1cd8('0x32')]!=='VIRTUAL'){var _0x4e2db6={};_0x4e2db6[_0x3c49d9[_0x1cd8('0x2c')]]={'$like':'%'+_0x35f532['query'][_0x1cd8('0x44')]+'%'};return _0x4e2db6;}})});}_0x68f1fb=_[_0x1cd8('0x43')]({},_0x68f1fb,_0x35f532[_0x1cd8('0x45')]);var _0xc42f65={'where':_0x68f1fb[_0x1cd8('0x42')]};return db[_0x1cd8('0x2f')][_0x1cd8('0x1f')](_0xc42f65)['then'](function(_0x874428){_0x19e003[_0x1cd8('0x1f')]=_0x874428;if(_0x35f532[_0x1cd8('0x35')][_0x1cd8('0x46')]){_0x68f1fb[_0x1cd8('0x47')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x1cd8('0x48')](_0x68f1fb);})[_0x1cd8('0x27')](function(_0x99ff82){_0x19e003[_0x1cd8('0x49')]=_0x99ff82;return _0x19e003;})[_0x1cd8('0x27')](respondWithFilteredResult(_0x14b03f,_0x68f1fb))['catch'](handleError(_0x14b03f,null));};exports['show']=function(_0x453541,_0xc873b2){var _0x494bf5={'raw':![],'where':{'id':_0x453541[_0x1cd8('0x4a')]['id']}},_0x5b1a13={};_0x5b1a13[_0x1cd8('0x39')]=_['keys'](db[_0x1cd8('0x2f')][_0x1cd8('0x30')]);_0x5b1a13[_0x1cd8('0x35')]=_[_0x1cd8('0x36')](_0x453541['query']);_0x5b1a13['filters']=_[_0x1cd8('0x38')](_0x5b1a13['model'],_0x5b1a13[_0x1cd8('0x35')]);_0x494bf5[_0x1cd8('0x3a')]=_[_0x1cd8('0x38')](_0x5b1a13[_0x1cd8('0x39')],qs[_0x1cd8('0x3b')](_0x453541['query'][_0x1cd8('0x3b')]));_0x494bf5[_0x1cd8('0x3a')]=_0x494bf5[_0x1cd8('0x3a')][_0x1cd8('0x3c')]?_0x494bf5[_0x1cd8('0x3a')]:_0x5b1a13['model'];if(_0x453541[_0x1cd8('0x35')][_0x1cd8('0x46')]){_0x494bf5['include']=[{'all':!![]}];}_0x494bf5=_[_0x1cd8('0x43')]({},_0x494bf5,_0x453541['options']);return db[_0x1cd8('0x2f')]['find'](_0x494bf5)['then'](handleEntityNotFound(_0xc873b2,null))['then'](respondWithResult(_0xc873b2,null))['catch'](handleError(_0xc873b2,null));};exports[_0x1cd8('0x4b')]=function(_0x4be0c4,_0x135e1d){return db[_0x1cd8('0x2f')]['create'](_0x4be0c4['body'],{})[_0x1cd8('0x27')](respondWithResult(_0x135e1d,0xc9))[_0x1cd8('0x4c')](handleError(_0x135e1d,null));};exports[_0x1cd8('0x26')]=function(_0x48ecab,_0x2ad402){if(_0x48ecab[_0x1cd8('0x4d')]['id']){delete _0x48ecab[_0x1cd8('0x4d')]['id'];}return db[_0x1cd8('0x2f')][_0x1cd8('0x4e')]({'where':{'id':_0x48ecab[_0x1cd8('0x4a')]['id']}})[_0x1cd8('0x27')](handleEntityNotFound(_0x2ad402,null))['then'](saveUpdates(_0x48ecab[_0x1cd8('0x4d')],null))['then'](respondWithResult(_0x2ad402,null))[_0x1cd8('0x4c')](handleError(_0x2ad402,null));};exports[_0x1cd8('0x28')]=function(_0x122c9b,_0x2d08d9){return db['ServicenowAccount'][_0x1cd8('0x4e')]({'where':{'id':_0x122c9b[_0x1cd8('0x4a')]['id']}})[_0x1cd8('0x27')](handleEntityNotFound(_0x2d08d9,null))[_0x1cd8('0x27')](removeEntity(_0x2d08d9,null))[_0x1cd8('0x4c')](handleError(_0x2d08d9,null));};exports[_0x1cd8('0x4f')]=function(_0x392be8,_0x1e49f9,_0x382de2){var _0x31e1f3={};var _0x48747a={};var _0x8adbd3;var _0x3612cc;return db['ServicenowAccount'][_0x1cd8('0x50')]({'where':{'id':_0x392be8[_0x1cd8('0x4a')]['id']}})[_0x1cd8('0x27')](handleEntityNotFound(_0x1e49f9,null))[_0x1cd8('0x27')](function(_0x49e097){if(_0x49e097){_0x8adbd3=_0x49e097;_0x48747a[_0x1cd8('0x39')]=_[_0x1cd8('0x36')](db[_0x1cd8('0x51')]['rawAttributes']);_0x48747a[_0x1cd8('0x35')]=_[_0x1cd8('0x36')](_0x392be8['query']);_0x48747a[_0x1cd8('0x37')]=_[_0x1cd8('0x38')](_0x48747a['model'],_0x48747a[_0x1cd8('0x35')]);_0x31e1f3[_0x1cd8('0x3a')]=_[_0x1cd8('0x38')](_0x48747a[_0x1cd8('0x39')],qs[_0x1cd8('0x3b')](_0x392be8[_0x1cd8('0x35')][_0x1cd8('0x3b')]));_0x31e1f3[_0x1cd8('0x3a')]=_0x31e1f3[_0x1cd8('0x3a')][_0x1cd8('0x3c')]?_0x31e1f3[_0x1cd8('0x3a')]:_0x48747a[_0x1cd8('0x39')];_0x31e1f3[_0x1cd8('0x3f')]=qs[_0x1cd8('0x40')](_0x392be8[_0x1cd8('0x35')][_0x1cd8('0x40')]);_0x31e1f3[_0x1cd8('0x42')]=qs['filters'](_['pick'](_0x392be8[_0x1cd8('0x35')],_0x48747a[_0x1cd8('0x37')]));if(_0x392be8[_0x1cd8('0x35')]['filter']){_0x31e1f3['where']=_[_0x1cd8('0x43')](_0x31e1f3[_0x1cd8('0x42')],{'$or':_[_0x1cd8('0x34')](_0x31e1f3['attributes'],function(_0x419cff){var _0x4d2548={};_0x4d2548[_0x419cff]={'$like':'%'+_0x392be8[_0x1cd8('0x35')][_0x1cd8('0x44')]+'%'};return _0x4d2548;})});}_0x31e1f3=_[_0x1cd8('0x43')]({},_0x31e1f3,_0x392be8[_0x1cd8('0x45')]);return _0x8adbd3[_0x1cd8('0x4f')](_0x31e1f3);}})[_0x1cd8('0x27')](function(_0x3e9bf9){if(_0x3e9bf9){_0x3612cc=_0x3e9bf9[_0x1cd8('0x3c')];if(!_0x392be8['query']['hasOwnProperty'](_0x1cd8('0x3e'))){_0x31e1f3[_0x1cd8('0x1d')]=qs[_0x1cd8('0x1d')](_0x392be8[_0x1cd8('0x35')][_0x1cd8('0x1d')]);_0x31e1f3['offset']=qs[_0x1cd8('0x20')](_0x392be8[_0x1cd8('0x35')]['offset']);}return _0x8adbd3['getConfigurations'](_0x31e1f3);}})['then'](function(_0x53a20f){if(_0x53a20f){return _0x53a20f?{'count':_0x3612cc,'rows':_0x53a20f}:null;}})['then'](respondWithResult(_0x1e49f9,null))[_0x1cd8('0x4c')](handleError(_0x1e49f9,null));};exports[_0x1cd8('0x52')]=function(_0x446f9c,_0x35efd9,_0x4ef945){if(_0x446f9c['body']['id']){delete _0x446f9c['body']['id'];}return db[_0x1cd8('0x2f')][_0x1cd8('0x50')]({'where':{'id':_0x446f9c['params']['id']}})[_0x1cd8('0x27')](handleEntityNotFound(_0x35efd9,null))[_0x1cd8('0x27')](function(_0x1f35fa){if(_0x1f35fa){_0x446f9c['body'][_0x1cd8('0x53')]=_0x1f35fa['id'];_0x446f9c[_0x1cd8('0x4d')][_0x1cd8('0x54')]=integrations['getSubjects'](_0x446f9c[_0x1cd8('0x4d')]['channel'],_0x446f9c['body'][_0x1cd8('0x32')]);_0x446f9c[_0x1cd8('0x4d')][_0x1cd8('0x55')]=integrations[_0x1cd8('0x56')](_0x446f9c[_0x1cd8('0x4d')][_0x1cd8('0x57')],_0x446f9c['body'][_0x1cd8('0x32')]);return db[_0x1cd8('0x51')][_0x1cd8('0x4b')](_0x446f9c['body'],{'include':[{'model':db['ServicenowField'],'as':'Subjects'},{'model':db[_0x1cd8('0x58')],'as':_0x1cd8('0x55')}]});}return null;})[_0x1cd8('0x27')](respondWithResult(_0x35efd9,null))['catch'](handleError(_0x35efd9,null));};exports[_0x1cd8('0x59')]=function(_0x4e0d56,_0x3cb2e0,_0x412f91){var _0x1cd86e=[_0x1cd8('0x5a'),'hold_reason','knowledge',_0x1cd8('0x5b'),'close_code',_0x1cd8('0x5c'),_0x1cd8('0x5d'),_0x1cd8('0x5e'),'category'];var _0x1f3f03=[_0x1cd8('0x5f'),'made_sla',_0x1cd8('0x60'),_0x1cd8('0x61'),'upon_reject',_0x1cd8('0x62'),_0x1cd8('0x63'),_0x1cd8('0x64'),_0x1cd8('0x65'),'number',_0x1cd8('0x66'),_0x1cd8('0x67'),_0x1cd8('0x68'),_0x1cd8('0x69'),_0x1cd8('0x6a'),_0x1cd8('0x6b'),_0x1cd8('0x6c'),_0x1cd8('0x6d'),_0x1cd8('0x6e'),_0x1cd8('0x3f'),_0x1cd8('0x6f'),'closed_at',_0x1cd8('0x70'),'delivery_plan',_0x1cd8('0x71'),_0x1cd8('0x72'),_0x1cd8('0x73'),'business_service',_0x1cd8('0x74'),_0x1cd8('0x75'),_0x1cd8('0x76'),_0x1cd8('0x77'),_0x1cd8('0x78'),_0x1cd8('0x79'),_0x1cd8('0x7a'),_0x1cd8('0x7b'),_0x1cd8('0x7c'),_0x1cd8('0x7d'),_0x1cd8('0x7e'),'caller_id',_0x1cd8('0x7f'),'subcategory',_0x1cd8('0x80'),_0x1cd8('0x81'),'close_code','correlation_display','delivery_task','work_start',_0x1cd8('0x82'),_0x1cd8('0x83'),_0x1cd8('0x84'),_0x1cd8('0x85'),_0x1cd8('0x86'),_0x1cd8('0x5c'),_0x1cd8('0x87'),_0x1cd8('0x88'),_0x1cd8('0x89'),'follow_up',_0x1cd8('0x8a'),_0x1cd8('0x8b'),_0x1cd8('0x8c'),_0x1cd8('0x8d'),_0x1cd8('0x5d'),'urgency','problem_id',_0x1cd8('0x8e'),_0x1cd8('0x8f'),_0x1cd8('0x90'),_0x1cd8('0x91'),'severity',_0x1cd8('0x92'),'sla_due',_0x1cd8('0x93'),'comments_and_work_notes',_0x1cd8('0x94'),_0x1cd8('0x95'),_0x1cd8('0x96'),_0x1cd8('0x97'),_0x1cd8('0x98'),_0x1cd8('0x99'),_0x1cd8('0x9a'),_0x1cd8('0x9b'),_0x1cd8('0x9c')];var _0x333a50='';var _0x28bf9a='';var _0x33c117=[];var _0x2101e0='';var _0x4e6969='';var _0x11606e=[];var _0x163dd6='';var _0x49192b='';var _0x19fe33={};var _0x31ef5a='';return db[_0x1cd8('0x2f')][_0x1cd8('0x50')]({'where':{'id':_0x4e0d56['params']['id']},'attributes':['id','username',_0x1cd8('0x9d'),_0x1cd8('0x9e'),_0x1cd8('0x9f'),_0x1cd8('0xa0')]})['then'](handleEntityNotFound(_0x3cb2e0,null))[_0x1cd8('0x27')](function(_0x31d6f3){if(_0x31d6f3){_0x31ef5a=_0x31d6f3['remoteUri'];var _0x50b85d=_0x31ef5a[_0x1cd8('0xa1')](-0x1);if(_0x50b85d==='/'){_0x31ef5a=_0x31ef5a[_0x1cd8('0xa2')](0x0,_0x31ef5a[_0x1cd8('0xa3')](_0x50b85d));}_0x49192b=util['format']('%s/api/now/doc/table/schema/',_0x31ef5a);_0x163dd6=util[_0x1cd8('0xa4')](_0x1cd8('0xa5'),_0x31ef5a);_0x19fe33={'user':_0x31d6f3[_0x1cd8('0xa6')],'pass':_0x31d6f3['password']};var _0x4996b8={'method':_0x1cd8('0xa7'),'uri':_0x49192b+_0x1cd8('0xa8'),'auth':_0x19fe33,'json':!![]};return rp(_0x4996b8);}})[_0x1cd8('0x27')](function(_0x259eac){if(_0x259eac[_0x1cd8('0xa9')][_0x1cd8('0x3c')]>0x0){_0x333a50=_0x259eac['result'];}console[_0x1cd8('0xaa')]('incident\x20table\x20objects',_0x333a50);_0x11606e=[];_0x28bf9a=Object[_0x1cd8('0xab')]([],_0x333a50);_[_0x1cd8('0xac')](_0x28bf9a,function(_0x22edb1){return!_0x1cd86e[_0x1cd8('0xad')](_0x22edb1[_0x1cd8('0x2c')]);});_0x28bf9a[_0x1cd8('0xae')](function(_0x2fc601){var _0x56970b=createFieldObject(_0x163dd6,_0x19fe33,_0x2fc601[_0x1cd8('0xaf')],_0x2fc601['name'],_0x2fc601[_0x1cd8('0xb0')],![]);_0x11606e[_0x1cd8('0xb1')](_0x56970b);});return Promise['all'](_0x11606e);})[_0x1cd8('0x27')](function(_0x13e6ae){_0x33c117=_0x13e6ae;_0x2101e0=Object[_0x1cd8('0xab')]([],_0x333a50);console[_0x1cd8('0xaa')](_0x1cd8('0xb2'),_0x333a50);_[_0x1cd8('0xac')](_0x2101e0,function(_0x412e5b){return _0x1f3f03[_0x1cd8('0xad')](_0x412e5b[_0x1cd8('0x2c')]);});console[_0x1cd8('0xaa')](_0x1cd8('0xb3'),_0x2101e0);_0x11606e=[];_0x2101e0[_0x1cd8('0xae')](function(_0x56a26c){var _0x5d1767=createFieldObject(_0x163dd6,_0x19fe33,_0x56a26c['internalType'],_0x56a26c[_0x1cd8('0x2c')],_0x56a26c[_0x1cd8('0xb0')],!![]);_0x11606e[_0x1cd8('0xb1')](_0x5d1767);});return Promise['all'](_0x11606e);})[_0x1cd8('0x27')](function(_0x374445){_0x4e6969=_0x374445;var _0x57439a=_0x33c117[_0x1cd8('0xb4')](_0x4e6969);return{'count':_0x57439a[_0x1cd8('0x3c')],'rows':_0x57439a};})[_0x1cd8('0x27')](respondWithResult(_0x3cb2e0,null))[_0x1cd8('0x4c')](function(_0x32d832){console['log'](_0x1cd8('0xb5')+_0x32d832);var _0x46b106=_0x4e0d56[_0x1cd8('0x35')][_0x1cd8('0xb6')]?0x1f4:_0x32d832[_0x1cd8('0xb7')]||0x1f4;logger[_0x1cd8('0x2a')](_0x32d832[_0x1cd8('0x2b')]);delete _0x32d832[_0x1cd8('0x2c')];if(_0x46b106===0x191){_0x46b106=0x190;}_0x3cb2e0[_0x1cd8('0x1c')](_0x46b106)[_0x1cd8('0x2d')](_0x4e0d56['query'][_0x1cd8('0xb6')]?{'message':_0x1cd8('0xb8'),'statusCode':_0x32d832[_0x1cd8('0xb7')]}:_0x32d832);});};function createFieldObject(_0xecaff6,_0x1cc199,_0x5e9a61,_0x3ab309,_0x147660,_0x1e907e){return new Promise(function(_0x2aba13,_0x58001d){var _0x192393={'id':_0x3ab309,'name':_0x147660,'custom':_0x1e907e};if(_0x5e9a61===_0x1cd8('0xb9')){_0x192393[_0x1cd8('0x45')]=[{'name':_0x1cd8('0xba'),'value':_0x1cd8('0xbb')},{'name':_0x1cd8('0xbc'),'value':'false'}];_0x2aba13(_0x192393);}else{var _0x424441={'method':'GET','uri':_0xecaff6+_0x1cd8('0xbd')+_0x3ab309,'auth':_0x1cc199,'json':!![]};return rp(_0x424441)[_0x1cd8('0x27')](function(_0x17473e){var _0xb0ca54=[];if(_0x17473e[_0x1cd8('0xa9')][_0x1cd8('0x3c')]>0x0){_0x17473e[_0x1cd8('0xa9')]['forEach'](function(_0x4685f0){if(_0x4685f0['inactive']===_0x1cd8('0xbe')){var _0x58f400={'name':_0x4685f0['label'],'value':_0x4685f0[_0x1cd8('0xbf')]};_0xb0ca54[_0x1cd8('0xb1')](_0x58f400);}});}_0x192393[_0x1cd8('0x45')]=_0xb0ca54;if(_0x192393[_0x1cd8('0x45')]['length']>0x0){_0x2aba13(_0x192393);}else{if(_0x1e907e==![]){_0x2aba13();}else{_0x2aba13(_0x192393);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index e6b42c4..ad27c85 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 _0x5496=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','ServicenowAccount','int_servicenow_accounts','lodash'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x5496,0x175));var _0x6549=function(_0x509353,_0x43c577){_0x509353=_0x509353-0x0;var _0x10bb59=_0x5496[_0x509353];return _0x10bb59;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x43cb17,_0x1d8cea){return _0x43cb17['define'](_0x6549('0x9'),attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeff8=['rimraf','../../config/environment','./intServicenowAccount.attributes','exports','define','int_servicenow_accounts','lodash','util','api','moment','bluebird','path'];(function(_0x96a2cb,_0x51f751){var _0x4bccfa=function(_0x175691){while(--_0x175691){_0x96a2cb['push'](_0x96a2cb['shift']());}};_0x4bccfa(++_0x51f751);}(_0xeff8,0x186));var _0x8eff=function(_0x5c2c7c,_0xa7d3b1){_0x5c2c7c=_0x5c2c7c-0x0;var _0xea7ffe=_0xeff8[_0x5c2c7c];return _0xea7ffe;};'use strict';var _=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var logger=require('../../config/logger')(_0x8eff('0x2'));var moment=require(_0x8eff('0x3'));var BPromise=require(_0x8eff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8eff('0x5'));var rimraf=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var attributes=require(_0x8eff('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x8eff('0x9')]=function(_0xb54063,_0x3409bc){return _0xb54063[_0x8eff('0xa')]('ServicenowAccount',attributes,{'tableName':_0x8eff('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 88ee9c5..b93175a 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 _0xef55=['result','ServicenowAccount','findAll','raw','options','where','attributes','limit','include','map','model','GetServicenowAccount','stringify','catch','ShowServicenowAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x2de56a,_0x2a0373){var _0x39cfab=function(_0x1b3441){while(--_0x1b3441){_0x2de56a['push'](_0x2de56a['shift']());}};_0x39cfab(++_0x2a0373);}(_0xef55,0xa0));var _0x5ef5=function(_0x17d095,_0x281068){_0x17d095=_0x17d095-0x0;var _0x3a51e2=_0xef55[_0x17d095];return _0x3a51e2;};'use strict';var _=require(_0x5ef5('0x0'));var util=require(_0x5ef5('0x1'));var moment=require('moment');var BPromise=require(_0x5ef5('0x2'));var rs=require(_0x5ef5('0x3'));var fs=require('fs');var Redis=require(_0x5ef5('0x4'));var db=require(_0x5ef5('0x5'))['db'];var utils=require(_0x5ef5('0x6'));var logger=require(_0x5ef5('0x7'))(_0x5ef5('0x8'));var config=require(_0x5ef5('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5ef5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x412b6f,_0x158e93,_0x53f655){return new BPromise(function(_0x4a4b29,_0x134aba){return client[_0x5ef5('0xb')](_0x412b6f,_0x53f655)[_0x5ef5('0xc')](function(_0x500899){logger[_0x5ef5('0xd')](_0x5ef5('0xe'),_0x158e93,'request\x20sent');logger['debug'](_0x5ef5('0xf'),_0x158e93,_0x5ef5('0x10'),JSON['stringify'](_0x500899));if(_0x500899[_0x5ef5('0x11')]){if(_0x500899[_0x5ef5('0x11')][_0x5ef5('0x12')]===0x1f4){logger[_0x5ef5('0x11')](_0x5ef5('0xe'),_0x158e93,_0x500899[_0x5ef5('0x11')][_0x5ef5('0x13')]);return _0x134aba(_0x500899[_0x5ef5('0x11')][_0x5ef5('0x13')]);}logger['error'](_0x5ef5('0xe'),_0x158e93,_0x500899[_0x5ef5('0x11')][_0x5ef5('0x13')]);return _0x4a4b29(_0x500899[_0x5ef5('0x11')][_0x5ef5('0x13')]);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x158e93,'request\x20sent');_0x4a4b29(_0x500899[_0x5ef5('0x14')][_0x5ef5('0x13')]);}})['catch'](function(_0x2d87d5){logger[_0x5ef5('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x158e93,_0x2d87d5);_0x134aba(_0x2d87d5);});});}exports['GetServicenowAccount']=function(_0x249f67){var _0x45f1db=this;return new Promise(function(_0x40d5dc,_0xb4e734){return db[_0x5ef5('0x15')][_0x5ef5('0x16')]({'raw':_0x249f67['options']?_0x249f67['options'][_0x5ef5('0x17')]===undefined?!![]:![]:!![],'where':_0x249f67[_0x5ef5('0x18')]?_0x249f67[_0x5ef5('0x18')][_0x5ef5('0x19')]||null:null,'attributes':_0x249f67[_0x5ef5('0x18')]?_0x249f67[_0x5ef5('0x18')][_0x5ef5('0x1a')]||null:null,'limit':_0x249f67[_0x5ef5('0x18')]?_0x249f67[_0x5ef5('0x18')][_0x5ef5('0x1b')]||null:null,'include':_0x249f67[_0x5ef5('0x18')]?_0x249f67[_0x5ef5('0x18')][_0x5ef5('0x1c')]?_[_0x5ef5('0x1d')](_0x249f67[_0x5ef5('0x18')][_0x5ef5('0x1c')],function(_0x53e1b1){return{'model':db[_0x53e1b1[_0x5ef5('0x1e')]],'as':_0x53e1b1['as'],'attributes':_0x53e1b1[_0x5ef5('0x1a')],'include':_0x53e1b1[_0x5ef5('0x1c')]?_['map'](_0x53e1b1[_0x5ef5('0x1c')],function(_0x2966fc){return{'model':db[_0x2966fc[_0x5ef5('0x1e')]],'as':_0x2966fc['as'],'attributes':_0x2966fc[_0x5ef5('0x1a')],'include':_0x2966fc[_0x5ef5('0x1c')]?_[_0x5ef5('0x1d')](_0x2966fc[_0x5ef5('0x1c')],function(_0x4c3ce7){return{'model':db[_0x4c3ce7[_0x5ef5('0x1e')]],'as':_0x4c3ce7['as'],'attributes':_0x4c3ce7[_0x5ef5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5ef5('0xc')](function(_0x1b2e80){logger['info'](_0x5ef5('0x1f'),_0x249f67);logger['debug'](_0x5ef5('0x1f'),_0x249f67,JSON[_0x5ef5('0x20')](_0x1b2e80));_0x40d5dc(_0x1b2e80);})[_0x5ef5('0x21')](function(_0x1f785e){logger[_0x5ef5('0x11')](_0x5ef5('0x1f'),_0x1f785e[_0x5ef5('0x13')],_0x249f67);_0xb4e734(_0x45f1db[_0x5ef5('0x11')](0x1f4,_0x1f785e[_0x5ef5('0x13')]));});});};exports[_0x5ef5('0x22')]=function(_0xc9ba05){var _0x20dee3=this;return new Promise(function(_0x17cf07,_0x3f362b){return db[_0x5ef5('0x15')][_0x5ef5('0x23')]({'raw':_0xc9ba05['options']?_0xc9ba05['options'][_0x5ef5('0x17')]===undefined?!![]:![]:!![],'where':_0xc9ba05[_0x5ef5('0x18')]?_0xc9ba05[_0x5ef5('0x18')]['where']||null:null,'attributes':_0xc9ba05[_0x5ef5('0x18')]?_0xc9ba05[_0x5ef5('0x18')][_0x5ef5('0x1a')]||null:null,'include':_0xc9ba05[_0x5ef5('0x18')]?_0xc9ba05[_0x5ef5('0x18')][_0x5ef5('0x1c')]?_['map'](_0xc9ba05[_0x5ef5('0x18')]['include'],function(_0x342470){return{'model':db[_0x342470['model']],'as':_0x342470['as'],'attributes':_0x342470['attributes'],'include':_0x342470['include']?_['map'](_0x342470['include'],function(_0x36054f){return{'model':db[_0x36054f['model']],'as':_0x36054f['as'],'attributes':_0x36054f[_0x5ef5('0x1a')],'include':_0x36054f[_0x5ef5('0x1c')]?_['map'](_0x36054f[_0x5ef5('0x1c')],function(_0x45181d){return{'model':db[_0x45181d[_0x5ef5('0x1e')]],'as':_0x45181d['as'],'attributes':_0x45181d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c5b79){logger[_0x5ef5('0xd')](_0x5ef5('0x22'),_0xc9ba05);logger['debug'](_0x5ef5('0x22'),_0xc9ba05,JSON['stringify'](_0x5c5b79));_0x17cf07(_0x5c5b79);})['catch'](function(_0x3fb7c1){logger[_0x5ef5('0x11')](_0x5ef5('0x22'),_0x3fb7c1[_0x5ef5('0x13')],_0xc9ba05);_0x3f362b(_0x20dee3[_0x5ef5('0x11')](0x1f4,_0x3fb7c1['message']));});});}; \ No newline at end of file +var _0xe4fd=['include','map','model','info','GetServicenowAccount','find','raw','ShowServicenowAccount','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ServicenowAccount','options','where','attributes','limit'];(function(_0x5cc694,_0x5dbdc7){var _0x6b87fb=function(_0x252a8e){while(--_0x252a8e){_0x5cc694['push'](_0x5cc694['shift']());}};_0x6b87fb(++_0x5dbdc7);}(_0xe4fd,0x118));var _0xde4f=function(_0x3f40ef,_0x2af55e){_0x3f40ef=_0x3f40ef-0x0;var _0xb12f1=_0xe4fd[_0x3f40ef];return _0xb12f1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xde4f('0x0'));var BPromise=require(_0xde4f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde4f('0x2'));var db=require(_0xde4f('0x3'))['db'];var utils=require(_0xde4f('0x4'));var logger=require('../../config/logger')(_0xde4f('0x5'));var config=require(_0xde4f('0x6'));var jayson=require(_0xde4f('0x7'));var client=jayson[_0xde4f('0x8')][_0xde4f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3782ba,_0x244f3b,_0x144a6a){return new BPromise(function(_0x40f6ec,_0x485850){return client['request'](_0x3782ba,_0x144a6a)[_0xde4f('0xa')](function(_0x51d66c){logger['info'](_0xde4f('0xb'),_0x244f3b,_0xde4f('0xc'));logger[_0xde4f('0xd')](_0xde4f('0xe'),_0x244f3b,_0xde4f('0xc'),JSON[_0xde4f('0xf')](_0x51d66c));if(_0x51d66c[_0xde4f('0x10')]){if(_0x51d66c['error'][_0xde4f('0x11')]===0x1f4){logger[_0xde4f('0x10')](_0xde4f('0xb'),_0x244f3b,_0x51d66c[_0xde4f('0x10')]['message']);return _0x485850(_0x51d66c[_0xde4f('0x10')][_0xde4f('0x12')]);}logger[_0xde4f('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x244f3b,_0x51d66c['error'][_0xde4f('0x12')]);return _0x40f6ec(_0x51d66c[_0xde4f('0x10')][_0xde4f('0x12')]);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x244f3b,_0xde4f('0xc'));_0x40f6ec(_0x51d66c[_0xde4f('0x13')]['message']);}})[_0xde4f('0x14')](function(_0x4920a7){logger[_0xde4f('0x10')](_0xde4f('0xb'),_0x244f3b,_0x4920a7);_0x485850(_0x4920a7);});});}exports['GetServicenowAccount']=function(_0x5c6023){var _0x33c4eb=this;return new Promise(function(_0x1f3a15,_0x31dbfb){return db[_0xde4f('0x15')]['findAll']({'raw':_0x5c6023[_0xde4f('0x16')]?_0x5c6023[_0xde4f('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5c6023['options']?_0x5c6023[_0xde4f('0x16')][_0xde4f('0x17')]||null:null,'attributes':_0x5c6023[_0xde4f('0x16')]?_0x5c6023[_0xde4f('0x16')][_0xde4f('0x18')]||null:null,'limit':_0x5c6023[_0xde4f('0x16')]?_0x5c6023['options'][_0xde4f('0x19')]||null:null,'include':_0x5c6023['options']?_0x5c6023['options'][_0xde4f('0x1a')]?_[_0xde4f('0x1b')](_0x5c6023['options'][_0xde4f('0x1a')],function(_0x6b89db){return{'model':db[_0x6b89db['model']],'as':_0x6b89db['as'],'attributes':_0x6b89db[_0xde4f('0x18')],'include':_0x6b89db['include']?_[_0xde4f('0x1b')](_0x6b89db[_0xde4f('0x1a')],function(_0x2aa709){return{'model':db[_0x2aa709[_0xde4f('0x1c')]],'as':_0x2aa709['as'],'attributes':_0x2aa709[_0xde4f('0x18')],'include':_0x2aa709['include']?_[_0xde4f('0x1b')](_0x2aa709[_0xde4f('0x1a')],function(_0x140dd4){return{'model':db[_0x140dd4[_0xde4f('0x1c')]],'as':_0x140dd4['as'],'attributes':_0x140dd4[_0xde4f('0x18')]};}):[]};}):[]};}):[]:[]})[_0xde4f('0xa')](function(_0x2f4a6e){logger[_0xde4f('0x1d')](_0xde4f('0x1e'),_0x5c6023);logger[_0xde4f('0xd')](_0xde4f('0x1e'),_0x5c6023,JSON[_0xde4f('0xf')](_0x2f4a6e));_0x1f3a15(_0x2f4a6e);})[_0xde4f('0x14')](function(_0x420d3e){logger[_0xde4f('0x10')]('GetServicenowAccount',_0x420d3e[_0xde4f('0x12')],_0x5c6023);_0x31dbfb(_0x33c4eb['error'](0x1f4,_0x420d3e[_0xde4f('0x12')]));});});};exports['ShowServicenowAccount']=function(_0x38f010){var _0x4fcf48=this;return new Promise(function(_0x4d893e,_0x5ee4da){return db[_0xde4f('0x15')][_0xde4f('0x1f')]({'raw':_0x38f010['options']?_0x38f010[_0xde4f('0x16')][_0xde4f('0x20')]===undefined?!![]:![]:!![],'where':_0x38f010[_0xde4f('0x16')]?_0x38f010[_0xde4f('0x16')][_0xde4f('0x17')]||null:null,'attributes':_0x38f010[_0xde4f('0x16')]?_0x38f010[_0xde4f('0x16')][_0xde4f('0x18')]||null:null,'include':_0x38f010[_0xde4f('0x16')]?_0x38f010[_0xde4f('0x16')][_0xde4f('0x1a')]?_[_0xde4f('0x1b')](_0x38f010[_0xde4f('0x16')][_0xde4f('0x1a')],function(_0x1c5c02){return{'model':db[_0x1c5c02[_0xde4f('0x1c')]],'as':_0x1c5c02['as'],'attributes':_0x1c5c02[_0xde4f('0x18')],'include':_0x1c5c02[_0xde4f('0x1a')]?_[_0xde4f('0x1b')](_0x1c5c02[_0xde4f('0x1a')],function(_0x4f106c){return{'model':db[_0x4f106c[_0xde4f('0x1c')]],'as':_0x4f106c['as'],'attributes':_0x4f106c[_0xde4f('0x18')],'include':_0x4f106c[_0xde4f('0x1a')]?_[_0xde4f('0x1b')](_0x4f106c[_0xde4f('0x1a')],function(_0x2a5e83){return{'model':db[_0x2a5e83[_0xde4f('0x1c')]],'as':_0x2a5e83['as'],'attributes':_0x2a5e83[_0xde4f('0x18')]};}):[]};}):[]};}):[]:[]})[_0xde4f('0xa')](function(_0x851fcd){logger[_0xde4f('0x1d')](_0xde4f('0x21'),_0x38f010);logger[_0xde4f('0xd')]('ShowServicenowAccount',_0x38f010,JSON['stringify'](_0x851fcd));_0x4d893e(_0x851fcd);})[_0xde4f('0x14')](function(_0x6a27aa){logger[_0xde4f('0x10')](_0xde4f('0x21'),_0x6a27aa['message'],_0x38f010);_0x5ee4da(_0x4fcf48['error'](0x1f4,_0x6a27aa[_0xde4f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index fc7be22..e35b4b1 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 _0xc777=['exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','put','update','delete','destroy'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc777,0x1e1));var _0x7c77=function(_0x5cf64f,_0x107ea5){_0x5cf64f=_0x5cf64f-0x0;var _0x137066=_0xc777[_0x5cf64f];return _0x137066;};'use strict';var multer=require(_0x7c77('0x0'));var util=require(_0x7c77('0x1'));var path=require(_0x7c77('0x2'));var timeout=require(_0x7c77('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7c77('0x4'));var auth=require(_0x7c77('0x5'));var interaction=require(_0x7c77('0x6'));var config=require(_0x7c77('0x7'));var controller=require(_0x7c77('0x8'));router[_0x7c77('0x9')]('/',auth[_0x7c77('0xa')](),controller['index']);router[_0x7c77('0x9')](_0x7c77('0xb'),auth['isAuthenticated'](),controller[_0x7c77('0xc')]);router[_0x7c77('0x9')](_0x7c77('0xd'),auth[_0x7c77('0xa')](),controller[_0x7c77('0xe')]);router['get'](_0x7c77('0xf'),auth[_0x7c77('0xa')](),controller[_0x7c77('0x10')]);router['get'](_0x7c77('0x11'),auth[_0x7c77('0xa')](),controller['getDescriptions']);router[_0x7c77('0x12')]('/',auth[_0x7c77('0xa')](),controller['create']);router[_0x7c77('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x7c77('0x14')]);router[_0x7c77('0x15')](_0x7c77('0xb'),auth['isAuthenticated'](),controller[_0x7c77('0x16')]);module[_0x7c77('0x17')]=router; \ No newline at end of file +var _0xc260=['isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','get'];(function(_0x4cbaec,_0x26ec11){var _0xba34a3=function(_0x280dcc){while(--_0x280dcc){_0x4cbaec['push'](_0x4cbaec['shift']());}};_0xba34a3(++_0x26ec11);}(_0xc260,0x1c6));var _0x0c26=function(_0x1d54de,_0x16b5a8){_0x1d54de=_0x1d54de-0x0;var _0x521d25=_0xc260[_0x1d54de];return _0x521d25;};'use strict';var multer=require(_0x0c26('0x0'));var util=require(_0x0c26('0x1'));var path=require('path');var timeout=require(_0x0c26('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0c26('0x3'));var auth=require(_0x0c26('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0c26('0x5'));var controller=require(_0x0c26('0x6'));router[_0x0c26('0x7')]('/',auth[_0x0c26('0x8')](),controller['index']);router[_0x0c26('0x7')](_0x0c26('0x9'),auth['isAuthenticated'](),controller[_0x0c26('0xa')]);router[_0x0c26('0x7')](_0x0c26('0xb'),auth[_0x0c26('0x8')](),controller['getFields']);router[_0x0c26('0x7')](_0x0c26('0xc'),auth[_0x0c26('0x8')](),controller[_0x0c26('0xd')]);router[_0x0c26('0x7')](_0x0c26('0xe'),auth['isAuthenticated'](),controller[_0x0c26('0xf')]);router[_0x0c26('0x10')]('/',auth[_0x0c26('0x8')](),controller[_0x0c26('0x11')]);router[_0x0c26('0x12')](_0x0c26('0x9'),auth[_0x0c26('0x8')](),controller[_0x0c26('0x13')]);router[_0x0c26('0x14')](_0x0c26('0x9'),auth[_0x0c26('0x8')](),controller['destroy']);module[_0x0c26('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 3b79a3f..db0b4f0 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 _0x36d1=['STRING','sequelize'];(function(_0x12f0fd,_0x108a2f){var _0x52542f=function(_0xf20b6f){while(--_0xf20b6f){_0x12f0fd['push'](_0x12f0fd['shift']());}};_0x52542f(++_0x108a2f);}(_0x36d1,0x163));var _0x136d=function(_0x13e2de,_0x1d4869){_0x13e2de=_0x13e2de-0x0;var _0x1d3a0a=_0x36d1[_0x13e2de];return _0x1d3a0a;};'use strict';var Sequelize=require(_0x136d('0x0'));module['exports']={'name':{'type':Sequelize[_0x136d('0x1')]},'description':{'type':Sequelize[_0x136d('0x1')]}}; \ No newline at end of file +var _0x18bf=['exports','STRING'];(function(_0x44e08d,_0x8cb7bc){var _0x1763b6=function(_0x3622b3){while(--_0x3622b3){_0x44e08d['push'](_0x44e08d['shift']());}};_0x1763b6(++_0x8cb7bc);}(_0x18bf,0x174));var _0xf18b=function(_0x3b1c75,_0x1bf5d2){_0x3b1c75=_0x3b1c75-0x0;var _0x477978=_0x18bf[_0x3b1c75];return _0x477978;};'use strict';var Sequelize=require('sequelize');module[_0xf18b('0x0')]={'name':{'type':Sequelize[_0xf18b('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 1138c89..f8e1af1 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 _0x1f24=['reject','save','destroy','then','error','stack','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','filter','options','includeAll','include','rows','catch','show','params','find','create','body','getFields','findOne','getSubjects','ServicenowField','order','getDescriptions','eml-format','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1f24,0x1cd));var _0x41f2=function(_0x50890a,_0x14522a){_0x50890a=_0x50890a-0x0;var _0x1fec19=_0x1f24[_0x50890a];return _0x1fec19;};'use strict';var emlformat=require(_0x41f2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x41f2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x41f2('0x2'));var moment=require(_0x41f2('0x3'));var BPromise=require(_0x41f2('0x4'));var Mustache=require('mustache');var util=require(_0x41f2('0x5'));var path=require('path');var sox=require(_0x41f2('0x6'));var csv=require(_0x41f2('0x7'));var ejs=require(_0x41f2('0x8'));var fs=require('fs');var fs_extra=require(_0x41f2('0x9'));var _=require(_0x41f2('0xa'));var squel=require('squel');var crypto=require(_0x41f2('0xb'));var jsforce=require(_0x41f2('0xc'));var deskjs=require(_0x41f2('0xd'));var toCsv=require(_0x41f2('0x7'));var querystring=require(_0x41f2('0xe'));var Papa=require(_0x41f2('0xf'));var Redis=require(_0x41f2('0x10'));var authService=require(_0x41f2('0x11'));var qs=require(_0x41f2('0x12'));var as=require(_0x41f2('0x13'));var hardwareService=require(_0x41f2('0x14'));var logger=require(_0x41f2('0x15'))(_0x41f2('0x16'));var utils=require(_0x41f2('0x17'));var config=require(_0x41f2('0x18'));var licenseUtil=require(_0x41f2('0x19'));var db=require(_0x41f2('0x1a'))['db'];function respondWithStatusCode(_0xa8fb21,_0x22d3b8){_0x22d3b8=_0x22d3b8||0xcc;return function(_0x5e5843){if(_0x5e5843){return _0xa8fb21[_0x41f2('0x1b')](_0x22d3b8);}return _0xa8fb21[_0x41f2('0x1c')](_0x22d3b8)[_0x41f2('0x1d')]();};}function respondWithResult(_0x547440,_0x28d91a){_0x28d91a=_0x28d91a||0xc8;return function(_0x33d399){if(_0x33d399){return _0x547440['status'](_0x28d91a)['json'](_0x33d399);}};}function respondWithFilteredResult(_0x48ddee,_0x1d5445){return function(_0x36cc68){if(_0x36cc68){var _0x2b9f84=typeof _0x1d5445[_0x41f2('0x1e')]===_0x41f2('0x1f')&&typeof _0x1d5445[_0x41f2('0x20')]===_0x41f2('0x1f');var _0x4a7ac0=_0x36cc68[_0x41f2('0x21')];var _0x46a1a8=_0x2b9f84?0x0:_0x1d5445[_0x41f2('0x1e')];var _0x5f1674=_0x2b9f84?_0x36cc68[_0x41f2('0x21')]:_0x1d5445[_0x41f2('0x1e')]+_0x1d5445[_0x41f2('0x20')];var _0x3b08a0;if(_0x5f1674>=_0x4a7ac0){_0x5f1674=_0x4a7ac0;_0x3b08a0=0xc8;}else{_0x3b08a0=0xce;}_0x48ddee[_0x41f2('0x1c')](_0x3b08a0);return _0x48ddee['set'](_0x41f2('0x22'),_0x46a1a8+'-'+_0x5f1674+'/'+_0x4a7ac0)[_0x41f2('0x23')](_0x36cc68);}return null;};}function patchUpdates(_0x4e31bc){return function(_0x3e4afb){try{jsonpatch[_0x41f2('0x24')](_0x3e4afb,_0x4e31bc,!![]);}catch(_0x903a80){return BPromise[_0x41f2('0x25')](_0x903a80);}return _0x3e4afb[_0x41f2('0x26')]();};}function saveUpdates(_0x3a255f,_0x3086c5){return function(_0x1a2563){if(_0x1a2563){return _0x1a2563['update'](_0x3a255f)['then'](function(_0x71851f){return _0x71851f;});}return null;};}function removeEntity(_0x3a07b5,_0x581b7d){return function(_0x397704){if(_0x397704){return _0x397704[_0x41f2('0x27')]()[_0x41f2('0x28')](function(){_0x3a07b5[_0x41f2('0x1c')](0xcc)[_0x41f2('0x1d')]();});}};}function handleEntityNotFound(_0x404059,_0xb3ef60){return function(_0x3c4b64){if(!_0x3c4b64){_0x404059['sendStatus'](0x194);}return _0x3c4b64;};}function handleError(_0xda48e0,_0x30e214){_0x30e214=_0x30e214||0x1f4;return function(_0x3b2ddb){logger[_0x41f2('0x29')](_0x3b2ddb[_0x41f2('0x2a')]);if(_0x3b2ddb[_0x41f2('0x2b')]){delete _0x3b2ddb['name'];}_0xda48e0[_0x41f2('0x1c')](_0x30e214)[_0x41f2('0x2c')](_0x3b2ddb);};}exports[_0x41f2('0x2d')]=function(_0x44695a,_0x24a1e6){var _0x540e6a={},_0x268bb2={},_0x47f7d9={'count':0x0,'rows':[]};var _0x432fd1=_['map'](db[_0x41f2('0x2e')][_0x41f2('0x2f')],function(_0x1b3e03){return{'name':_0x1b3e03[_0x41f2('0x30')],'type':_0x1b3e03[_0x41f2('0x31')][_0x41f2('0x32')]};});_0x268bb2[_0x41f2('0x33')]=_[_0x41f2('0x34')](_0x432fd1,_0x41f2('0x2b'));_0x268bb2['query']=_[_0x41f2('0x35')](_0x44695a[_0x41f2('0x36')]);_0x268bb2[_0x41f2('0x37')]=_[_0x41f2('0x38')](_0x268bb2[_0x41f2('0x33')],_0x268bb2[_0x41f2('0x36')]);_0x540e6a[_0x41f2('0x39')]=_['intersection'](_0x268bb2[_0x41f2('0x33')],qs[_0x41f2('0x3a')](_0x44695a[_0x41f2('0x36')][_0x41f2('0x3a')]));_0x540e6a['attributes']=_0x540e6a[_0x41f2('0x39')][_0x41f2('0x3b')]?_0x540e6a[_0x41f2('0x39')]:_0x268bb2[_0x41f2('0x33')];if(!_0x44695a[_0x41f2('0x36')][_0x41f2('0x3c')](_0x41f2('0x3d'))){_0x540e6a[_0x41f2('0x20')]=qs[_0x41f2('0x20')](_0x44695a[_0x41f2('0x36')]['limit']);_0x540e6a[_0x41f2('0x1e')]=qs['offset'](_0x44695a[_0x41f2('0x36')][_0x41f2('0x1e')]);}_0x540e6a['order']=qs[_0x41f2('0x3e')](_0x44695a[_0x41f2('0x36')]['sort']);_0x540e6a['where']=qs[_0x41f2('0x37')](_[_0x41f2('0x3f')](_0x44695a[_0x41f2('0x36')],_0x268bb2['filters']),_0x432fd1);if(_0x44695a['query']['filter']){_0x540e6a[_0x41f2('0x40')]=_[_0x41f2('0x41')](_0x540e6a[_0x41f2('0x40')],{'$or':_['map'](_0x432fd1,function(_0xe81a74){if(_0xe81a74[_0x41f2('0x31')]!=='VIRTUAL'){var _0x27a9f4={};_0x27a9f4[_0xe81a74[_0x41f2('0x2b')]]={'$like':'%'+_0x44695a[_0x41f2('0x36')][_0x41f2('0x42')]+'%'};return _0x27a9f4;}})});}_0x540e6a=_[_0x41f2('0x41')]({},_0x540e6a,_0x44695a[_0x41f2('0x43')]);var _0x2bc340={'where':_0x540e6a['where']};return db[_0x41f2('0x2e')][_0x41f2('0x21')](_0x2bc340)['then'](function(_0x2fd85d){_0x47f7d9[_0x41f2('0x21')]=_0x2fd85d;if(_0x44695a[_0x41f2('0x36')][_0x41f2('0x44')]){_0x540e6a[_0x41f2('0x45')]=[{'all':!![]}];}return db[_0x41f2('0x2e')]['findAll'](_0x540e6a);})[_0x41f2('0x28')](function(_0x487ba4){_0x47f7d9[_0x41f2('0x46')]=_0x487ba4;return _0x47f7d9;})[_0x41f2('0x28')](respondWithFilteredResult(_0x24a1e6,_0x540e6a))[_0x41f2('0x47')](handleError(_0x24a1e6,null));};exports[_0x41f2('0x48')]=function(_0x3a61b6,_0xa63e2c){var _0x1e74b7={'raw':![],'where':{'id':_0x3a61b6[_0x41f2('0x49')]['id']}},_0x5ea025={};_0x5ea025['model']=_[_0x41f2('0x35')](db[_0x41f2('0x2e')][_0x41f2('0x2f')]);_0x5ea025[_0x41f2('0x36')]=_[_0x41f2('0x35')](_0x3a61b6[_0x41f2('0x36')]);_0x5ea025[_0x41f2('0x37')]=_[_0x41f2('0x38')](_0x5ea025[_0x41f2('0x33')],_0x5ea025[_0x41f2('0x36')]);_0x1e74b7[_0x41f2('0x39')]=_[_0x41f2('0x38')](_0x5ea025[_0x41f2('0x33')],qs['fields'](_0x3a61b6[_0x41f2('0x36')]['fields']));_0x1e74b7['attributes']=_0x1e74b7[_0x41f2('0x39')]['length']?_0x1e74b7[_0x41f2('0x39')]:_0x5ea025['model'];if(_0x3a61b6[_0x41f2('0x36')]['includeAll']){_0x1e74b7[_0x41f2('0x45')]=[{'all':!![]}];}_0x1e74b7=_[_0x41f2('0x41')]({},_0x1e74b7,_0x3a61b6[_0x41f2('0x43')]);return db[_0x41f2('0x2e')][_0x41f2('0x4a')](_0x1e74b7)['then'](handleEntityNotFound(_0xa63e2c,null))['then'](respondWithResult(_0xa63e2c,null))[_0x41f2('0x47')](handleError(_0xa63e2c,null));};exports[_0x41f2('0x4b')]=function(_0x238c6c,_0x1cc316){return db[_0x41f2('0x2e')][_0x41f2('0x4b')](_0x238c6c[_0x41f2('0x4c')],{})[_0x41f2('0x28')](respondWithResult(_0x1cc316,0xc9))[_0x41f2('0x47')](handleError(_0x1cc316,null));};exports['update']=function(_0x423fb2,_0x3c8648){if(_0x423fb2[_0x41f2('0x4c')]['id']){delete _0x423fb2[_0x41f2('0x4c')]['id'];}return db[_0x41f2('0x2e')][_0x41f2('0x4a')]({'where':{'id':_0x423fb2[_0x41f2('0x49')]['id']}})[_0x41f2('0x28')](handleEntityNotFound(_0x3c8648,null))[_0x41f2('0x28')](saveUpdates(_0x423fb2[_0x41f2('0x4c')],null))[_0x41f2('0x28')](respondWithResult(_0x3c8648,null))[_0x41f2('0x47')](handleError(_0x3c8648,null));};exports[_0x41f2('0x27')]=function(_0x5c7223,_0x5938ec){return db[_0x41f2('0x2e')][_0x41f2('0x4a')]({'where':{'id':_0x5c7223[_0x41f2('0x49')]['id']}})[_0x41f2('0x28')](handleEntityNotFound(_0x5938ec,null))[_0x41f2('0x28')](removeEntity(_0x5938ec,null))[_0x41f2('0x47')](handleError(_0x5938ec,null));};exports[_0x41f2('0x4d')]=function(_0x4afffb,_0x4ea831,_0x555bf9){var _0x5ea600={};var _0x42a50d={};var _0x48120f;var _0x3de83f;return db[_0x41f2('0x2e')][_0x41f2('0x4e')]({'where':{'id':_0x4afffb[_0x41f2('0x49')]['id']}})[_0x41f2('0x28')](handleEntityNotFound(_0x4ea831,null))[_0x41f2('0x28')](function(_0x490eee){if(_0x490eee){_0x48120f=_0x490eee;_0x42a50d[_0x41f2('0x33')]=_['keys'](db['ServicenowField'][_0x41f2('0x2f')]);_0x42a50d[_0x41f2('0x36')]=_[_0x41f2('0x35')](_0x4afffb['query']);_0x42a50d[_0x41f2('0x37')]=_[_0x41f2('0x38')](_0x42a50d[_0x41f2('0x33')],_0x42a50d[_0x41f2('0x36')]);_0x5ea600[_0x41f2('0x39')]=_[_0x41f2('0x38')](_0x42a50d[_0x41f2('0x33')],qs[_0x41f2('0x3a')](_0x4afffb['query']['fields']));_0x5ea600[_0x41f2('0x39')]=_0x5ea600[_0x41f2('0x39')][_0x41f2('0x3b')]?_0x5ea600[_0x41f2('0x39')]:_0x42a50d[_0x41f2('0x33')];_0x5ea600['order']=qs['sort'](_0x4afffb[_0x41f2('0x36')]['sort']);_0x5ea600[_0x41f2('0x40')]=qs['filters'](_['pick'](_0x4afffb[_0x41f2('0x36')],_0x42a50d[_0x41f2('0x37')]));if(_0x4afffb[_0x41f2('0x36')]['filter']){_0x5ea600[_0x41f2('0x40')]=_[_0x41f2('0x41')](_0x5ea600[_0x41f2('0x40')],{'$or':_['map'](_0x5ea600['attributes'],function(_0x1bea45){var _0x5970e1={};_0x5970e1[_0x1bea45]={'$like':'%'+_0x4afffb[_0x41f2('0x36')][_0x41f2('0x42')]+'%'};return _0x5970e1;})});}_0x5ea600=_[_0x41f2('0x41')]({},_0x5ea600,_0x4afffb[_0x41f2('0x43')]);return _0x48120f['getFields'](_0x5ea600);}})[_0x41f2('0x28')](function(_0x4dfb4c){if(_0x4dfb4c){_0x3de83f=_0x4dfb4c[_0x41f2('0x3b')];if(!_0x4afffb[_0x41f2('0x36')][_0x41f2('0x3c')]('nolimit')){_0x5ea600[_0x41f2('0x20')]=qs[_0x41f2('0x20')](_0x4afffb['query']['limit']);_0x5ea600[_0x41f2('0x1e')]=qs[_0x41f2('0x1e')](_0x4afffb[_0x41f2('0x36')][_0x41f2('0x1e')]);}return _0x48120f['getFields'](_0x5ea600);}})[_0x41f2('0x28')](function(_0x416ad1){if(_0x416ad1){return _0x416ad1?{'count':_0x3de83f,'rows':_0x416ad1}:null;}})[_0x41f2('0x28')](respondWithResult(_0x4ea831,null))['catch'](handleError(_0x4ea831,null));};exports[_0x41f2('0x4f')]=function(_0x503e2a,_0x527fd0,_0x403f59){var _0x245867={};var _0x40bf77={};var _0x2a3bc4;var _0x11e6e2;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x503e2a[_0x41f2('0x49')]['id']}})[_0x41f2('0x28')](handleEntityNotFound(_0x527fd0,null))['then'](function(_0xc16125){if(_0xc16125){_0x2a3bc4=_0xc16125;_0x40bf77['model']=_['keys'](db[_0x41f2('0x50')][_0x41f2('0x2f')]);_0x40bf77[_0x41f2('0x36')]=_[_0x41f2('0x35')](_0x503e2a['query']);_0x40bf77[_0x41f2('0x37')]=_[_0x41f2('0x38')](_0x40bf77[_0x41f2('0x33')],_0x40bf77[_0x41f2('0x36')]);_0x245867[_0x41f2('0x39')]=_[_0x41f2('0x38')](_0x40bf77['model'],qs[_0x41f2('0x3a')](_0x503e2a['query'][_0x41f2('0x3a')]));_0x245867[_0x41f2('0x39')]=_0x245867['attributes']['length']?_0x245867[_0x41f2('0x39')]:_0x40bf77[_0x41f2('0x33')];_0x245867[_0x41f2('0x51')]=qs[_0x41f2('0x3e')](_0x503e2a['query']['sort']);_0x245867['where']=qs[_0x41f2('0x37')](_[_0x41f2('0x3f')](_0x503e2a[_0x41f2('0x36')],_0x40bf77['filters']));if(_0x503e2a[_0x41f2('0x36')][_0x41f2('0x42')]){_0x245867[_0x41f2('0x40')]=_[_0x41f2('0x41')](_0x245867[_0x41f2('0x40')],{'$or':_[_0x41f2('0x34')](_0x245867[_0x41f2('0x39')],function(_0x581d30){var _0x707a6c={};_0x707a6c[_0x581d30]={'$like':'%'+_0x503e2a[_0x41f2('0x36')][_0x41f2('0x42')]+'%'};return _0x707a6c;})});}_0x245867=_[_0x41f2('0x41')]({},_0x245867,_0x503e2a[_0x41f2('0x43')]);return _0x2a3bc4[_0x41f2('0x4f')](_0x245867);}})['then'](function(_0x289390){if(_0x289390){_0x11e6e2=_0x289390['length'];if(!_0x503e2a[_0x41f2('0x36')]['hasOwnProperty'](_0x41f2('0x3d'))){_0x245867['limit']=qs[_0x41f2('0x20')](_0x503e2a[_0x41f2('0x36')]['limit']);_0x245867[_0x41f2('0x1e')]=qs[_0x41f2('0x1e')](_0x503e2a[_0x41f2('0x36')][_0x41f2('0x1e')]);}return _0x2a3bc4[_0x41f2('0x4f')](_0x245867);}})[_0x41f2('0x28')](function(_0x571e36){if(_0x571e36){return _0x571e36?{'count':_0x11e6e2,'rows':_0x571e36}:null;}})['then'](respondWithResult(_0x527fd0,null))[_0x41f2('0x47')](handleError(_0x527fd0,null));};exports[_0x41f2('0x52')]=function(_0x5dff5c,_0x57a7f1,_0x1047be){var _0x5c7018={};var _0x20289a={};var _0x1c9bef;var _0x3391dc;return db['ServicenowConfiguration'][_0x41f2('0x4e')]({'where':{'id':_0x5dff5c[_0x41f2('0x49')]['id']}})['then'](handleEntityNotFound(_0x57a7f1,null))[_0x41f2('0x28')](function(_0x566502){if(_0x566502){_0x1c9bef=_0x566502;_0x20289a['model']=_[_0x41f2('0x35')](db['ServicenowField'][_0x41f2('0x2f')]);_0x20289a[_0x41f2('0x36')]=_[_0x41f2('0x35')](_0x5dff5c['query']);_0x20289a['filters']=_[_0x41f2('0x38')](_0x20289a[_0x41f2('0x33')],_0x20289a['query']);_0x5c7018[_0x41f2('0x39')]=_[_0x41f2('0x38')](_0x20289a[_0x41f2('0x33')],qs[_0x41f2('0x3a')](_0x5dff5c[_0x41f2('0x36')][_0x41f2('0x3a')]));_0x5c7018[_0x41f2('0x39')]=_0x5c7018[_0x41f2('0x39')][_0x41f2('0x3b')]?_0x5c7018[_0x41f2('0x39')]:_0x20289a[_0x41f2('0x33')];_0x5c7018[_0x41f2('0x51')]=qs[_0x41f2('0x3e')](_0x5dff5c[_0x41f2('0x36')]['sort']);_0x5c7018[_0x41f2('0x40')]=qs[_0x41f2('0x37')](_[_0x41f2('0x3f')](_0x5dff5c[_0x41f2('0x36')],_0x20289a['filters']));if(_0x5dff5c[_0x41f2('0x36')][_0x41f2('0x42')]){_0x5c7018['where']=_[_0x41f2('0x41')](_0x5c7018[_0x41f2('0x40')],{'$or':_[_0x41f2('0x34')](_0x5c7018[_0x41f2('0x39')],function(_0xf7e90b){var _0x20e43e={};_0x20e43e[_0xf7e90b]={'$like':'%'+_0x5dff5c['query']['filter']+'%'};return _0x20e43e;})});}_0x5c7018=_[_0x41f2('0x41')]({},_0x5c7018,_0x5dff5c[_0x41f2('0x43')]);return _0x1c9bef[_0x41f2('0x52')](_0x5c7018);}})[_0x41f2('0x28')](function(_0x3ea762){if(_0x3ea762){_0x3391dc=_0x3ea762[_0x41f2('0x3b')];if(!_0x5dff5c[_0x41f2('0x36')][_0x41f2('0x3c')]('nolimit')){_0x5c7018[_0x41f2('0x20')]=qs['limit'](_0x5dff5c[_0x41f2('0x36')][_0x41f2('0x20')]);_0x5c7018[_0x41f2('0x1e')]=qs[_0x41f2('0x1e')](_0x5dff5c[_0x41f2('0x36')][_0x41f2('0x1e')]);}return _0x1c9bef[_0x41f2('0x52')](_0x5c7018);}})[_0x41f2('0x28')](function(_0x4462c4){if(_0x4462c4){return _0x4462c4?{'count':_0x3391dc,'rows':_0x4462c4}:null;}})['then'](respondWithResult(_0x57a7f1,null))['catch'](handleError(_0x57a7f1,null));}; \ No newline at end of file +var _0x9897=['mustache','util','path','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','then','destroy','error','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','findAll','catch','show','includeAll','include','create','body','update','find','params','getFields','order','findOne','getSubjects','getDescriptions','ServicenowField','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0xfac3e6,_0x21b254){var _0x3768d0=function(_0x3a85ee){while(--_0x3a85ee){_0xfac3e6['push'](_0xfac3e6['shift']());}};_0x3768d0(++_0x21b254);}(_0x9897,0x9f));var _0x7989=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x9897[_0x16d10f];return _0x50c823;};'use strict';var emlformat=require(_0x7989('0x0'));var rimraf=require(_0x7989('0x1'));var zipdir=require(_0x7989('0x2'));var jsonpatch=require(_0x7989('0x3'));var rp=require(_0x7989('0x4'));var moment=require(_0x7989('0x5'));var BPromise=require(_0x7989('0x6'));var Mustache=require(_0x7989('0x7'));var util=require(_0x7989('0x8'));var path=require(_0x7989('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7989('0xa'));var _=require(_0x7989('0xb'));var squel=require(_0x7989('0xc'));var crypto=require(_0x7989('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7989('0xe'));var toCsv=require(_0x7989('0xf'));var querystring=require(_0x7989('0x10'));var Papa=require(_0x7989('0x11'));var Redis=require(_0x7989('0x12'));var authService=require(_0x7989('0x13'));var qs=require(_0x7989('0x14'));var as=require(_0x7989('0x15'));var hardwareService=require(_0x7989('0x16'));var logger=require('../../config/logger')(_0x7989('0x17'));var utils=require(_0x7989('0x18'));var config=require(_0x7989('0x19'));var licenseUtil=require(_0x7989('0x1a'));var db=require(_0x7989('0x1b'))['db'];function respondWithStatusCode(_0x1521cc,_0x1626e3){_0x1626e3=_0x1626e3||0xcc;return function(_0x4e0e25){if(_0x4e0e25){return _0x1521cc[_0x7989('0x1c')](_0x1626e3);}return _0x1521cc['status'](_0x1626e3)[_0x7989('0x1d')]();};}function respondWithResult(_0x11c329,_0x3d2fc7){_0x3d2fc7=_0x3d2fc7||0xc8;return function(_0x1b5940){if(_0x1b5940){return _0x11c329['status'](_0x3d2fc7)[_0x7989('0x1e')](_0x1b5940);}};}function respondWithFilteredResult(_0x5da315,_0x36c6fd){return function(_0x104673){if(_0x104673){var _0x15bdef=typeof _0x36c6fd[_0x7989('0x1f')]===_0x7989('0x20')&&typeof _0x36c6fd[_0x7989('0x21')]==='undefined';var _0x432fe2=_0x104673['count'];var _0x491c30=_0x15bdef?0x0:_0x36c6fd[_0x7989('0x1f')];var _0x53273c=_0x15bdef?_0x104673[_0x7989('0x22')]:_0x36c6fd['offset']+_0x36c6fd[_0x7989('0x21')];var _0x357453;if(_0x53273c>=_0x432fe2){_0x53273c=_0x432fe2;_0x357453=0xc8;}else{_0x357453=0xce;}_0x5da315[_0x7989('0x23')](_0x357453);return _0x5da315[_0x7989('0x24')](_0x7989('0x25'),_0x491c30+'-'+_0x53273c+'/'+_0x432fe2)['json'](_0x104673);}return null;};}function patchUpdates(_0x530cda){return function(_0x264873){try{jsonpatch[_0x7989('0x26')](_0x264873,_0x530cda,!![]);}catch(_0x208561){return BPromise['reject'](_0x208561);}return _0x264873['save']();};}function saveUpdates(_0x3e23f1,_0x261378){return function(_0x3eef6a){if(_0x3eef6a){return _0x3eef6a['update'](_0x3e23f1)[_0x7989('0x27')](function(_0x5e2e04){return _0x5e2e04;});}return null;};}function removeEntity(_0x4c036a,_0xcc196b){return function(_0x3228ba){if(_0x3228ba){return _0x3228ba[_0x7989('0x28')]()[_0x7989('0x27')](function(){_0x4c036a[_0x7989('0x23')](0xcc)[_0x7989('0x1d')]();});}};}function handleEntityNotFound(_0x1b92e6,_0x242725){return function(_0x407a9e){if(!_0x407a9e){_0x1b92e6[_0x7989('0x1c')](0x194);}return _0x407a9e;};}function handleError(_0x2923e7,_0x2c1c2c){_0x2c1c2c=_0x2c1c2c||0x1f4;return function(_0x4362a3){logger[_0x7989('0x29')](_0x4362a3['stack']);if(_0x4362a3[_0x7989('0x2a')]){delete _0x4362a3[_0x7989('0x2a')];}_0x2923e7['status'](_0x2c1c2c)[_0x7989('0x2b')](_0x4362a3);};}exports[_0x7989('0x2c')]=function(_0x2aea6b,_0x3520c3){var _0x2f6fc9={},_0x459280={},_0x28b07e={'count':0x0,'rows':[]};var _0x502914=_['map'](db[_0x7989('0x2d')][_0x7989('0x2e')],function(_0x43dfea){return{'name':_0x43dfea[_0x7989('0x2f')],'type':_0x43dfea['type'][_0x7989('0x30')]};});_0x459280[_0x7989('0x31')]=_[_0x7989('0x32')](_0x502914,'name');_0x459280[_0x7989('0x33')]=_[_0x7989('0x34')](_0x2aea6b['query']);_0x459280[_0x7989('0x35')]=_[_0x7989('0x36')](_0x459280[_0x7989('0x31')],_0x459280['query']);_0x2f6fc9[_0x7989('0x37')]=_[_0x7989('0x36')](_0x459280[_0x7989('0x31')],qs[_0x7989('0x38')](_0x2aea6b[_0x7989('0x33')][_0x7989('0x38')]));_0x2f6fc9[_0x7989('0x37')]=_0x2f6fc9[_0x7989('0x37')][_0x7989('0x39')]?_0x2f6fc9[_0x7989('0x37')]:_0x459280[_0x7989('0x31')];if(!_0x2aea6b[_0x7989('0x33')][_0x7989('0x3a')](_0x7989('0x3b'))){_0x2f6fc9['limit']=qs[_0x7989('0x21')](_0x2aea6b[_0x7989('0x33')][_0x7989('0x21')]);_0x2f6fc9[_0x7989('0x1f')]=qs[_0x7989('0x1f')](_0x2aea6b[_0x7989('0x33')][_0x7989('0x1f')]);}_0x2f6fc9['order']=qs[_0x7989('0x3c')](_0x2aea6b[_0x7989('0x33')][_0x7989('0x3c')]);_0x2f6fc9[_0x7989('0x3d')]=qs[_0x7989('0x35')](_[_0x7989('0x3e')](_0x2aea6b[_0x7989('0x33')],_0x459280[_0x7989('0x35')]),_0x502914);if(_0x2aea6b['query']['filter']){_0x2f6fc9[_0x7989('0x3d')]=_[_0x7989('0x3f')](_0x2f6fc9[_0x7989('0x3d')],{'$or':_[_0x7989('0x32')](_0x502914,function(_0x501cc7){if(_0x501cc7['type']!==_0x7989('0x40')){var _0x4b4fe0={};_0x4b4fe0[_0x501cc7[_0x7989('0x2a')]]={'$like':'%'+_0x2aea6b[_0x7989('0x33')][_0x7989('0x41')]+'%'};return _0x4b4fe0;}})});}_0x2f6fc9=_[_0x7989('0x3f')]({},_0x2f6fc9,_0x2aea6b[_0x7989('0x42')]);var _0x41e2d8={'where':_0x2f6fc9[_0x7989('0x3d')]};return db['ServicenowConfiguration'][_0x7989('0x22')](_0x41e2d8)['then'](function(_0x270c3b){_0x28b07e['count']=_0x270c3b;if(_0x2aea6b[_0x7989('0x33')]['includeAll']){_0x2f6fc9['include']=[{'all':!![]}];}return db[_0x7989('0x2d')][_0x7989('0x43')](_0x2f6fc9);})[_0x7989('0x27')](function(_0x21d1a3){_0x28b07e['rows']=_0x21d1a3;return _0x28b07e;})['then'](respondWithFilteredResult(_0x3520c3,_0x2f6fc9))[_0x7989('0x44')](handleError(_0x3520c3,null));};exports[_0x7989('0x45')]=function(_0x3c00e3,_0x3b418d){var _0xa792d1={'raw':![],'where':{'id':_0x3c00e3['params']['id']}},_0x41987f={};_0x41987f['model']=_[_0x7989('0x34')](db[_0x7989('0x2d')][_0x7989('0x2e')]);_0x41987f[_0x7989('0x33')]=_[_0x7989('0x34')](_0x3c00e3[_0x7989('0x33')]);_0x41987f['filters']=_[_0x7989('0x36')](_0x41987f[_0x7989('0x31')],_0x41987f[_0x7989('0x33')]);_0xa792d1[_0x7989('0x37')]=_['intersection'](_0x41987f['model'],qs[_0x7989('0x38')](_0x3c00e3[_0x7989('0x33')]['fields']));_0xa792d1[_0x7989('0x37')]=_0xa792d1['attributes'][_0x7989('0x39')]?_0xa792d1[_0x7989('0x37')]:_0x41987f[_0x7989('0x31')];if(_0x3c00e3['query'][_0x7989('0x46')]){_0xa792d1[_0x7989('0x47')]=[{'all':!![]}];}_0xa792d1=_[_0x7989('0x3f')]({},_0xa792d1,_0x3c00e3[_0x7989('0x42')]);return db[_0x7989('0x2d')]['find'](_0xa792d1)[_0x7989('0x27')](handleEntityNotFound(_0x3b418d,null))[_0x7989('0x27')](respondWithResult(_0x3b418d,null))['catch'](handleError(_0x3b418d,null));};exports[_0x7989('0x48')]=function(_0x202662,_0x4bff61){return db[_0x7989('0x2d')]['create'](_0x202662[_0x7989('0x49')],{})[_0x7989('0x27')](respondWithResult(_0x4bff61,0xc9))['catch'](handleError(_0x4bff61,null));};exports[_0x7989('0x4a')]=function(_0x502471,_0x5806b8){if(_0x502471[_0x7989('0x49')]['id']){delete _0x502471[_0x7989('0x49')]['id'];}return db[_0x7989('0x2d')][_0x7989('0x4b')]({'where':{'id':_0x502471[_0x7989('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5806b8,null))[_0x7989('0x27')](saveUpdates(_0x502471['body'],null))['then'](respondWithResult(_0x5806b8,null))[_0x7989('0x44')](handleError(_0x5806b8,null));};exports[_0x7989('0x28')]=function(_0x3998ad,_0x2bfc22){return db[_0x7989('0x2d')][_0x7989('0x4b')]({'where':{'id':_0x3998ad[_0x7989('0x4c')]['id']}})[_0x7989('0x27')](handleEntityNotFound(_0x2bfc22,null))['then'](removeEntity(_0x2bfc22,null))['catch'](handleError(_0x2bfc22,null));};exports[_0x7989('0x4d')]=function(_0x1b991b,_0x20a639,_0x521af9){var _0x3aa314={};var _0x290d8a={};var _0xc40c68;var _0x2a701c;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x1b991b[_0x7989('0x4c')]['id']}})[_0x7989('0x27')](handleEntityNotFound(_0x20a639,null))[_0x7989('0x27')](function(_0x354ed4){if(_0x354ed4){_0xc40c68=_0x354ed4;_0x290d8a['model']=_[_0x7989('0x34')](db['ServicenowField']['rawAttributes']);_0x290d8a['query']=_[_0x7989('0x34')](_0x1b991b['query']);_0x290d8a['filters']=_[_0x7989('0x36')](_0x290d8a[_0x7989('0x31')],_0x290d8a[_0x7989('0x33')]);_0x3aa314[_0x7989('0x37')]=_['intersection'](_0x290d8a['model'],qs[_0x7989('0x38')](_0x1b991b['query'][_0x7989('0x38')]));_0x3aa314['attributes']=_0x3aa314['attributes'][_0x7989('0x39')]?_0x3aa314['attributes']:_0x290d8a[_0x7989('0x31')];_0x3aa314[_0x7989('0x4e')]=qs['sort'](_0x1b991b['query'][_0x7989('0x3c')]);_0x3aa314[_0x7989('0x3d')]=qs[_0x7989('0x35')](_[_0x7989('0x3e')](_0x1b991b['query'],_0x290d8a[_0x7989('0x35')]));if(_0x1b991b[_0x7989('0x33')][_0x7989('0x41')]){_0x3aa314['where']=_[_0x7989('0x3f')](_0x3aa314['where'],{'$or':_['map'](_0x3aa314[_0x7989('0x37')],function(_0x24edf8){var _0xc20279={};_0xc20279[_0x24edf8]={'$like':'%'+_0x1b991b[_0x7989('0x33')][_0x7989('0x41')]+'%'};return _0xc20279;})});}_0x3aa314=_[_0x7989('0x3f')]({},_0x3aa314,_0x1b991b[_0x7989('0x42')]);return _0xc40c68[_0x7989('0x4d')](_0x3aa314);}})['then'](function(_0x12f7a4){if(_0x12f7a4){_0x2a701c=_0x12f7a4[_0x7989('0x39')];if(!_0x1b991b[_0x7989('0x33')][_0x7989('0x3a')](_0x7989('0x3b'))){_0x3aa314['limit']=qs[_0x7989('0x21')](_0x1b991b['query'][_0x7989('0x21')]);_0x3aa314['offset']=qs[_0x7989('0x1f')](_0x1b991b[_0x7989('0x33')][_0x7989('0x1f')]);}return _0xc40c68[_0x7989('0x4d')](_0x3aa314);}})['then'](function(_0x6714c5){if(_0x6714c5){return _0x6714c5?{'count':_0x2a701c,'rows':_0x6714c5}:null;}})['then'](respondWithResult(_0x20a639,null))[_0x7989('0x44')](handleError(_0x20a639,null));};exports['getSubjects']=function(_0x29239d,_0xf5edba,_0x39c3b9){var _0x10ba61={};var _0x149b93={};var _0x206daa;var _0x30bf7c;return db[_0x7989('0x2d')][_0x7989('0x4f')]({'where':{'id':_0x29239d[_0x7989('0x4c')]['id']}})[_0x7989('0x27')](handleEntityNotFound(_0xf5edba,null))[_0x7989('0x27')](function(_0x324f5e){if(_0x324f5e){_0x206daa=_0x324f5e;_0x149b93[_0x7989('0x31')]=_[_0x7989('0x34')](db['ServicenowField'][_0x7989('0x2e')]);_0x149b93['query']=_['keys'](_0x29239d[_0x7989('0x33')]);_0x149b93[_0x7989('0x35')]=_[_0x7989('0x36')](_0x149b93[_0x7989('0x31')],_0x149b93[_0x7989('0x33')]);_0x10ba61['attributes']=_[_0x7989('0x36')](_0x149b93[_0x7989('0x31')],qs[_0x7989('0x38')](_0x29239d['query'][_0x7989('0x38')]));_0x10ba61[_0x7989('0x37')]=_0x10ba61['attributes'][_0x7989('0x39')]?_0x10ba61[_0x7989('0x37')]:_0x149b93[_0x7989('0x31')];_0x10ba61['order']=qs['sort'](_0x29239d[_0x7989('0x33')]['sort']);_0x10ba61[_0x7989('0x3d')]=qs[_0x7989('0x35')](_[_0x7989('0x3e')](_0x29239d[_0x7989('0x33')],_0x149b93[_0x7989('0x35')]));if(_0x29239d[_0x7989('0x33')]['filter']){_0x10ba61[_0x7989('0x3d')]=_['merge'](_0x10ba61[_0x7989('0x3d')],{'$or':_[_0x7989('0x32')](_0x10ba61['attributes'],function(_0x483b34){var _0x3bbfc8={};_0x3bbfc8[_0x483b34]={'$like':'%'+_0x29239d[_0x7989('0x33')][_0x7989('0x41')]+'%'};return _0x3bbfc8;})});}_0x10ba61=_['merge']({},_0x10ba61,_0x29239d['options']);return _0x206daa['getSubjects'](_0x10ba61);}})['then'](function(_0xb720b7){if(_0xb720b7){_0x30bf7c=_0xb720b7[_0x7989('0x39')];if(!_0x29239d[_0x7989('0x33')][_0x7989('0x3a')](_0x7989('0x3b'))){_0x10ba61[_0x7989('0x21')]=qs[_0x7989('0x21')](_0x29239d['query'][_0x7989('0x21')]);_0x10ba61[_0x7989('0x1f')]=qs[_0x7989('0x1f')](_0x29239d['query'][_0x7989('0x1f')]);}return _0x206daa[_0x7989('0x50')](_0x10ba61);}})[_0x7989('0x27')](function(_0x20e73b){if(_0x20e73b){return _0x20e73b?{'count':_0x30bf7c,'rows':_0x20e73b}:null;}})[_0x7989('0x27')](respondWithResult(_0xf5edba,null))[_0x7989('0x44')](handleError(_0xf5edba,null));};exports[_0x7989('0x51')]=function(_0x1e1fb0,_0x149c3c,_0x1a4563){var _0x2676ee={};var _0x8a16bf={};var _0x348b4c;var _0x2abd12;return db[_0x7989('0x2d')][_0x7989('0x4f')]({'where':{'id':_0x1e1fb0[_0x7989('0x4c')]['id']}})[_0x7989('0x27')](handleEntityNotFound(_0x149c3c,null))[_0x7989('0x27')](function(_0x57f2e4){if(_0x57f2e4){_0x348b4c=_0x57f2e4;_0x8a16bf[_0x7989('0x31')]=_['keys'](db[_0x7989('0x52')]['rawAttributes']);_0x8a16bf[_0x7989('0x33')]=_[_0x7989('0x34')](_0x1e1fb0[_0x7989('0x33')]);_0x8a16bf[_0x7989('0x35')]=_[_0x7989('0x36')](_0x8a16bf[_0x7989('0x31')],_0x8a16bf[_0x7989('0x33')]);_0x2676ee[_0x7989('0x37')]=_[_0x7989('0x36')](_0x8a16bf[_0x7989('0x31')],qs[_0x7989('0x38')](_0x1e1fb0['query'][_0x7989('0x38')]));_0x2676ee[_0x7989('0x37')]=_0x2676ee['attributes']['length']?_0x2676ee[_0x7989('0x37')]:_0x8a16bf['model'];_0x2676ee[_0x7989('0x4e')]=qs[_0x7989('0x3c')](_0x1e1fb0[_0x7989('0x33')][_0x7989('0x3c')]);_0x2676ee[_0x7989('0x3d')]=qs['filters'](_[_0x7989('0x3e')](_0x1e1fb0['query'],_0x8a16bf['filters']));if(_0x1e1fb0[_0x7989('0x33')][_0x7989('0x41')]){_0x2676ee[_0x7989('0x3d')]=_[_0x7989('0x3f')](_0x2676ee[_0x7989('0x3d')],{'$or':_[_0x7989('0x32')](_0x2676ee['attributes'],function(_0x234dc8){var _0x265484={};_0x265484[_0x234dc8]={'$like':'%'+_0x1e1fb0[_0x7989('0x33')]['filter']+'%'};return _0x265484;})});}_0x2676ee=_[_0x7989('0x3f')]({},_0x2676ee,_0x1e1fb0['options']);return _0x348b4c[_0x7989('0x51')](_0x2676ee);}})['then'](function(_0x19aafb){if(_0x19aafb){_0x2abd12=_0x19aafb['length'];if(!_0x1e1fb0[_0x7989('0x33')][_0x7989('0x3a')](_0x7989('0x3b'))){_0x2676ee['limit']=qs[_0x7989('0x21')](_0x1e1fb0[_0x7989('0x33')][_0x7989('0x21')]);_0x2676ee[_0x7989('0x1f')]=qs[_0x7989('0x1f')](_0x1e1fb0[_0x7989('0x33')][_0x7989('0x1f')]);}return _0x348b4c[_0x7989('0x51')](_0x2676ee);}})[_0x7989('0x27')](function(_0x394c89){if(_0x394c89){return _0x394c89?{'count':_0x2abd12,'rows':_0x394c89}:null;}})[_0x7989('0x27')](respondWithResult(_0x149c3c,null))[_0x7989('0x44')](handleError(_0x149c3c,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index f0900af..8ea353a 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 _0xf65d=['../../config/logger','api','moment','bluebird','request-promise','path','exports','define','int_servicenow_configurations','lodash'];(function(_0x353904,_0x5e57c3){var _0x3d1870=function(_0x258b82){while(--_0x258b82){_0x353904['push'](_0x353904['shift']());}};_0x3d1870(++_0x5e57c3);}(_0xf65d,0x9f));var _0xdf65=function(_0x3938d2,_0x8e9793){_0x3938d2=_0x3938d2-0x0;var _0x45513c=_0xf65d[_0x3938d2];return _0x45513c;};'use strict';var _=require(_0xdf65('0x0'));var util=require('util');var logger=require(_0xdf65('0x1'))(_0xdf65('0x2'));var moment=require(_0xdf65('0x3'));var BPromise=require(_0xdf65('0x4'));var rp=require(_0xdf65('0x5'));var fs=require('fs');var path=require(_0xdf65('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intServicenowConfiguration.attributes');module[_0xdf65('0x7')]=function(_0x4ac44a,_0x254ddf){return _0x4ac44a[_0xdf65('0x8')]('ServicenowConfiguration',attributes,{'tableName':_0xdf65('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6372=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','lodash'];(function(_0x973724,_0xc542cb){var _0x129af3=function(_0x155560){while(--_0x155560){_0x973724['push'](_0x973724['shift']());}};_0x129af3(++_0xc542cb);}(_0x6372,0x1b8));var _0x2637=function(_0xed08c5,_0x1751ef){_0xed08c5=_0xed08c5-0x0;var _0x4b0f5b=_0x6372[_0xed08c5];return _0x4b0f5b;};'use strict';var _=require(_0x2637('0x0'));var util=require('util');var logger=require(_0x2637('0x1'))('api');var moment=require(_0x2637('0x2'));var BPromise=require(_0x2637('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2637('0x4'));var rimraf=require(_0x2637('0x5'));var config=require(_0x2637('0x6'));var attributes=require(_0x2637('0x7'));module[_0x2637('0x8')]=function(_0x5da891,_0x33d56c){return _0x5da891['define']('ServicenowConfiguration',attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index e05a580..3dc4db0 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 _0x1279=['moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x1279,0x1b9));var _0x9127=function(_0x3b57ed,_0x23679f){_0x3b57ed=_0x3b57ed-0x0;var _0x197a5a=_0x1279[_0x3b57ed];return _0x197a5a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9127('0x0'));var BPromise=require(_0x9127('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9127('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x9127('0x3'));var logger=require(_0x9127('0x4'))(_0x9127('0x5'));var config=require(_0x9127('0x6'));var jayson=require(_0x9127('0x7'));var client=jayson[_0x9127('0x8')][_0x9127('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x837d13,_0x5ce665,_0x4fb892){return new BPromise(function(_0x4be4e9,_0x23f7b0){return client[_0x9127('0xa')](_0x837d13,_0x4fb892)[_0x9127('0xb')](function(_0x39f174){logger[_0x9127('0xc')](_0x9127('0xd'),_0x5ce665,_0x9127('0xe'));logger[_0x9127('0xf')](_0x9127('0x10'),_0x5ce665,_0x9127('0xe'),JSON['stringify'](_0x39f174));if(_0x39f174[_0x9127('0x11')]){if(_0x39f174[_0x9127('0x11')][_0x9127('0x12')]===0x1f4){logger[_0x9127('0x11')](_0x9127('0xd'),_0x5ce665,_0x39f174[_0x9127('0x11')][_0x9127('0x13')]);return _0x23f7b0(_0x39f174[_0x9127('0x11')][_0x9127('0x13')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x5ce665,_0x39f174[_0x9127('0x11')][_0x9127('0x13')]);return _0x4be4e9(_0x39f174[_0x9127('0x11')][_0x9127('0x13')]);}else{logger[_0x9127('0xc')](_0x9127('0xd'),_0x5ce665,_0x9127('0xe'));_0x4be4e9(_0x39f174['result'][_0x9127('0x13')]);}})[_0x9127('0x14')](function(_0x246f56){logger[_0x9127('0x11')](_0x9127('0xd'),_0x5ce665,_0x246f56);_0x23f7b0(_0x246f56);});});} \ No newline at end of file +var _0x3432=['ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','request','then','info'];(function(_0x2f6d02,_0x3dbbe1){var _0x30d98f=function(_0x2786ab){while(--_0x2786ab){_0x2f6d02['push'](_0x2f6d02['shift']());}};_0x30d98f(++_0x3dbbe1);}(_0x3432,0x199));var _0x2343=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3432[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x2343('0x0'));var moment=require('moment');var BPromise=require(_0x2343('0x1'));var rs=require(_0x2343('0x2'));var fs=require('fs');var Redis=require(_0x2343('0x3'));var db=require(_0x2343('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2343('0x5'))('rpc');var config=require(_0x2343('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2343('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6a99bc,_0xe21769,_0x512b7e){return new BPromise(function(_0x1e6a71,_0x35c655){return client[_0x2343('0x8')](_0x6a99bc,_0x512b7e)[_0x2343('0x9')](function(_0x49dba9){logger[_0x2343('0xa')](_0x2343('0xb'),_0xe21769,_0x2343('0xc'));logger[_0x2343('0xd')](_0x2343('0xe'),_0xe21769,_0x2343('0xc'),JSON['stringify'](_0x49dba9));if(_0x49dba9['error']){if(_0x49dba9[_0x2343('0xf')][_0x2343('0x10')]===0x1f4){logger[_0x2343('0xf')](_0x2343('0xb'),_0xe21769,_0x49dba9[_0x2343('0xf')][_0x2343('0x11')]);return _0x35c655(_0x49dba9['error'][_0x2343('0x11')]);}logger['error'](_0x2343('0xb'),_0xe21769,_0x49dba9[_0x2343('0xf')][_0x2343('0x11')]);return _0x1e6a71(_0x49dba9[_0x2343('0xf')][_0x2343('0x11')]);}else{logger[_0x2343('0xa')](_0x2343('0xb'),_0xe21769,_0x2343('0xc'));_0x1e6a71(_0x49dba9[_0x2343('0x12')]['message']);}})[_0x2343('0x13')](function(_0x4e9dde){logger[_0x2343('0xf')](_0x2343('0xb'),_0xe21769,_0x4e9dde);_0x35c655(_0x4e9dde);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index a4c6244..7ca0e1a 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 _0xdcf7=['../../components/auth/service','./intServicenowField.controller','isAuthenticated','index','get','/:id','show','post','create','destroy','exports','multer','path','connect-timeout','express','fs-extra'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xdcf7,0x16b));var _0x7dcf=function(_0x576d1d,_0x44b457){_0x576d1d=_0x576d1d-0x0;var _0x56ad86=_0xdcf7[_0x576d1d];return _0x56ad86;};'use strict';var multer=require(_0x7dcf('0x0'));var util=require('util');var path=require(_0x7dcf('0x1'));var timeout=require(_0x7dcf('0x2'));var express=require(_0x7dcf('0x3'));var router=express['Router']();var fs_extra=require(_0x7dcf('0x4'));var auth=require(_0x7dcf('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7dcf('0x6'));router['get']('/',auth[_0x7dcf('0x7')](),controller[_0x7dcf('0x8')]);router[_0x7dcf('0x9')](_0x7dcf('0xa'),auth['isAuthenticated'](),controller[_0x7dcf('0xb')]);router[_0x7dcf('0xc')]('/',auth[_0x7dcf('0x7')](),controller[_0x7dcf('0xd')]);router['put'](_0x7dcf('0xa'),auth[_0x7dcf('0x7')](),controller['update']);router['delete'](_0x7dcf('0xa'),auth[_0x7dcf('0x7')](),controller[_0x7dcf('0xe')]);module[_0x7dcf('0xf')]=router; \ No newline at end of file +var _0xba05=['../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xba05,0x190));var _0x5ba0=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xba05[_0xc4001c];return _0x49f7bc;};'use strict';var multer=require('multer');var util=require(_0x5ba0('0x0'));var path=require(_0x5ba0('0x1'));var timeout=require(_0x5ba0('0x2'));var express=require(_0x5ba0('0x3'));var router=express[_0x5ba0('0x4')]();var fs_extra=require(_0x5ba0('0x5'));var auth=require(_0x5ba0('0x6'));var interaction=require(_0x5ba0('0x7'));var config=require(_0x5ba0('0x8'));var controller=require(_0x5ba0('0x9'));router[_0x5ba0('0xa')]('/',auth[_0x5ba0('0xb')](),controller[_0x5ba0('0xc')]);router['get'](_0x5ba0('0xd'),auth[_0x5ba0('0xb')](),controller['show']);router['post']('/',auth[_0x5ba0('0xb')](),controller['create']);router['put'](_0x5ba0('0xd'),auth[_0x5ba0('0xb')](),controller[_0x5ba0('0xe')]);router['delete'](_0x5ba0('0xd'),auth['isAuthenticated'](),controller[_0x5ba0('0xf')]);module[_0x5ba0('0x10')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index b2627d6..9c3f2f1 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 _0x73e5=['exports','ENUM','variable','keyValue','picklist','customVariable','STRING','BOOLEAN','sequelize'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x73e5,0x1d3));var _0x573e=function(_0x38f86b,_0x45b662){_0x38f86b=_0x38f86b-0x0;var _0x10832f=_0x73e5[_0x38f86b];return _0x10832f;};'use strict';var Sequelize=require(_0x573e('0x0'));module[_0x573e('0x1')]={'type':{'type':Sequelize[_0x573e('0x2')]('string',_0x573e('0x3'),'customVariable',_0x573e('0x4'),_0x573e('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0x573e('0x3'),_0x573e('0x6'))},'keyContent':{'type':Sequelize[_0x573e('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x573e('0x7')]},'customField':{'type':Sequelize[_0x573e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x573e('0x7')]}}; \ No newline at end of file +var _0x1121=['variable','sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING'];(function(_0x22cb2f,_0x2e7067){var _0x2626f5=function(_0x174ce9){while(--_0x174ce9){_0x22cb2f['push'](_0x22cb2f['shift']());}};_0x2626f5(++_0x2e7067);}(_0x1121,0x88));var _0x1112=function(_0x3bc798,_0x1dd55f){_0x3bc798=_0x3bc798-0x0;var _0x3f78b3=_0x1121[_0x3bc798];return _0x3f78b3;};'use strict';var Sequelize=require(_0x1112('0x0'));module[_0x1112('0x1')]={'type':{'type':Sequelize[_0x1112('0x2')](_0x1112('0x3'),'variable',_0x1112('0x4'),_0x1112('0x5'),_0x1112('0x6')),'defaultValue':_0x1112('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1112('0x7')]},'keyType':{'type':Sequelize[_0x1112('0x2')](_0x1112('0x3'),_0x1112('0x8'),_0x1112('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1112('0x7')]},'nameField':{'type':Sequelize[_0x1112('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1112('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index d9ef009..a7e2b4c 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 _0xdcc5=['include','findAll','catch','show','params','rawAttributes','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','then','sendStatus','error','stack','name','send','map','ServicenowField','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0xdcc5,0x121));var _0x5dcc=function(_0x528ca6,_0x19d493){_0x528ca6=_0x528ca6-0x0;var _0x44f41c=_0xdcc5[_0x528ca6];return _0x44f41c;};'use strict';var emlformat=require(_0x5dcc('0x0'));var rimraf=require(_0x5dcc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5dcc('0x2'));var rp=require(_0x5dcc('0x3'));var moment=require(_0x5dcc('0x4'));var BPromise=require(_0x5dcc('0x5'));var Mustache=require(_0x5dcc('0x6'));var util=require(_0x5dcc('0x7'));var path=require('path');var sox=require(_0x5dcc('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5dcc('0x9'));var squel=require(_0x5dcc('0xa'));var crypto=require(_0x5dcc('0xb'));var jsforce=require(_0x5dcc('0xc'));var deskjs=require(_0x5dcc('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5dcc('0xe'));var Papa=require(_0x5dcc('0xf'));var Redis=require(_0x5dcc('0x10'));var authService=require(_0x5dcc('0x11'));var qs=require(_0x5dcc('0x12'));var as=require(_0x5dcc('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5dcc('0x14'))(_0x5dcc('0x15'));var utils=require('../../config/utils');var config=require(_0x5dcc('0x16'));var licenseUtil=require(_0x5dcc('0x17'));var db=require(_0x5dcc('0x18'))['db'];function respondWithStatusCode(_0x2280c2,_0x5b5d27){_0x5b5d27=_0x5b5d27||0xcc;return function(_0x29fc6f){if(_0x29fc6f){return _0x2280c2['sendStatus'](_0x5b5d27);}return _0x2280c2[_0x5dcc('0x19')](_0x5b5d27)[_0x5dcc('0x1a')]();};}function respondWithResult(_0x3c1d69,_0x56a12f){_0x56a12f=_0x56a12f||0xc8;return function(_0x1915ed){if(_0x1915ed){return _0x3c1d69[_0x5dcc('0x19')](_0x56a12f)[_0x5dcc('0x1b')](_0x1915ed);}};}function respondWithFilteredResult(_0x5b241e,_0x28f6a9){return function(_0x3fa20a){if(_0x3fa20a){var _0x1218ce=typeof _0x28f6a9['offset']===_0x5dcc('0x1c')&&typeof _0x28f6a9[_0x5dcc('0x1d')]==='undefined';var _0x1b0e9f=_0x3fa20a[_0x5dcc('0x1e')];var _0x59f779=_0x1218ce?0x0:_0x28f6a9[_0x5dcc('0x1f')];var _0x27277f=_0x1218ce?_0x3fa20a['count']:_0x28f6a9[_0x5dcc('0x1f')]+_0x28f6a9[_0x5dcc('0x1d')];var _0x9b9d17;if(_0x27277f>=_0x1b0e9f){_0x27277f=_0x1b0e9f;_0x9b9d17=0xc8;}else{_0x9b9d17=0xce;}_0x5b241e[_0x5dcc('0x19')](_0x9b9d17);return _0x5b241e[_0x5dcc('0x20')](_0x5dcc('0x21'),_0x59f779+'-'+_0x27277f+'/'+_0x1b0e9f)[_0x5dcc('0x1b')](_0x3fa20a);}return null;};}function patchUpdates(_0x4f5922){return function(_0x424e0c){try{jsonpatch[_0x5dcc('0x22')](_0x424e0c,_0x4f5922,!![]);}catch(_0x4254d6){return BPromise['reject'](_0x4254d6);}return _0x424e0c['save']();};}function saveUpdates(_0x34698b,_0x4c7df2){return function(_0x2d9405){if(_0x2d9405){return _0x2d9405['update'](_0x34698b)[_0x5dcc('0x23')](function(_0x1f5f22){return _0x1f5f22;});}return null;};}function removeEntity(_0x6955f6,_0xe621f3){return function(_0x17dcd3){if(_0x17dcd3){return _0x17dcd3['destroy']()[_0x5dcc('0x23')](function(){_0x6955f6[_0x5dcc('0x19')](0xcc)[_0x5dcc('0x1a')]();});}};}function handleEntityNotFound(_0xfa19d7,_0x1fb430){return function(_0x12f4c8){if(!_0x12f4c8){_0xfa19d7[_0x5dcc('0x24')](0x194);}return _0x12f4c8;};}function handleError(_0x305c13,_0x198688){_0x198688=_0x198688||0x1f4;return function(_0x5aaae2){logger[_0x5dcc('0x25')](_0x5aaae2[_0x5dcc('0x26')]);if(_0x5aaae2['name']){delete _0x5aaae2[_0x5dcc('0x27')];}_0x305c13[_0x5dcc('0x19')](_0x198688)[_0x5dcc('0x28')](_0x5aaae2);};}exports['index']=function(_0x5b157e,_0x4d9202){var _0x3f8739={},_0x3dacbd={},_0xcd65d3={'count':0x0,'rows':[]};var _0x18458f=_[_0x5dcc('0x29')](db[_0x5dcc('0x2a')]['rawAttributes'],function(_0x40351c){return{'name':_0x40351c[_0x5dcc('0x2b')],'type':_0x40351c[_0x5dcc('0x2c')]['key']};});_0x3dacbd[_0x5dcc('0x2d')]=_['map'](_0x18458f,_0x5dcc('0x27'));_0x3dacbd[_0x5dcc('0x2e')]=_[_0x5dcc('0x2f')](_0x5b157e[_0x5dcc('0x2e')]);_0x3dacbd[_0x5dcc('0x30')]=_[_0x5dcc('0x31')](_0x3dacbd[_0x5dcc('0x2d')],_0x3dacbd[_0x5dcc('0x2e')]);_0x3f8739[_0x5dcc('0x32')]=_['intersection'](_0x3dacbd[_0x5dcc('0x2d')],qs[_0x5dcc('0x33')](_0x5b157e[_0x5dcc('0x2e')][_0x5dcc('0x33')]));_0x3f8739[_0x5dcc('0x32')]=_0x3f8739[_0x5dcc('0x32')][_0x5dcc('0x34')]?_0x3f8739[_0x5dcc('0x32')]:_0x3dacbd[_0x5dcc('0x2d')];if(!_0x5b157e[_0x5dcc('0x2e')][_0x5dcc('0x35')](_0x5dcc('0x36'))){_0x3f8739[_0x5dcc('0x1d')]=qs[_0x5dcc('0x1d')](_0x5b157e['query'][_0x5dcc('0x1d')]);_0x3f8739['offset']=qs[_0x5dcc('0x1f')](_0x5b157e['query'][_0x5dcc('0x1f')]);}_0x3f8739['order']=qs[_0x5dcc('0x37')](_0x5b157e[_0x5dcc('0x2e')]['sort']);_0x3f8739[_0x5dcc('0x38')]=qs['filters'](_['pick'](_0x5b157e[_0x5dcc('0x2e')],_0x3dacbd['filters']),_0x18458f);if(_0x5b157e['query'][_0x5dcc('0x39')]){_0x3f8739[_0x5dcc('0x38')]=_[_0x5dcc('0x3a')](_0x3f8739[_0x5dcc('0x38')],{'$or':_[_0x5dcc('0x29')](_0x18458f,function(_0x431b21){if(_0x431b21[_0x5dcc('0x2c')]!=='VIRTUAL'){var _0xbc76bd={};_0xbc76bd[_0x431b21[_0x5dcc('0x27')]]={'$like':'%'+_0x5b157e['query'][_0x5dcc('0x39')]+'%'};return _0xbc76bd;}})});}_0x3f8739=_[_0x5dcc('0x3a')]({},_0x3f8739,_0x5b157e[_0x5dcc('0x3b')]);var _0x18b477={'where':_0x3f8739[_0x5dcc('0x38')]};return db[_0x5dcc('0x2a')][_0x5dcc('0x1e')](_0x18b477)[_0x5dcc('0x23')](function(_0x419e05){_0xcd65d3[_0x5dcc('0x1e')]=_0x419e05;if(_0x5b157e[_0x5dcc('0x2e')][_0x5dcc('0x3c')]){_0x3f8739[_0x5dcc('0x3d')]=[{'all':!![]}];}return db[_0x5dcc('0x2a')][_0x5dcc('0x3e')](_0x3f8739);})[_0x5dcc('0x23')](function(_0x83ad5d){_0xcd65d3['rows']=_0x83ad5d;return _0xcd65d3;})[_0x5dcc('0x23')](respondWithFilteredResult(_0x4d9202,_0x3f8739))[_0x5dcc('0x3f')](handleError(_0x4d9202,null));};exports[_0x5dcc('0x40')]=function(_0x207ae8,_0x2e1778){var _0x34d615={'raw':!![],'where':{'id':_0x207ae8[_0x5dcc('0x41')]['id']}},_0x40b8e={};_0x40b8e[_0x5dcc('0x2d')]=_[_0x5dcc('0x2f')](db[_0x5dcc('0x2a')][_0x5dcc('0x42')]);_0x40b8e[_0x5dcc('0x2e')]=_[_0x5dcc('0x2f')](_0x207ae8[_0x5dcc('0x2e')]);_0x40b8e[_0x5dcc('0x30')]=_['intersection'](_0x40b8e[_0x5dcc('0x2d')],_0x40b8e[_0x5dcc('0x2e')]);_0x34d615[_0x5dcc('0x32')]=_[_0x5dcc('0x31')](_0x40b8e[_0x5dcc('0x2d')],qs[_0x5dcc('0x33')](_0x207ae8[_0x5dcc('0x2e')]['fields']));_0x34d615[_0x5dcc('0x32')]=_0x34d615[_0x5dcc('0x32')]['length']?_0x34d615[_0x5dcc('0x32')]:_0x40b8e[_0x5dcc('0x2d')];if(_0x207ae8[_0x5dcc('0x2e')][_0x5dcc('0x3c')]){_0x34d615[_0x5dcc('0x3d')]=[{'all':!![]}];}_0x34d615=_[_0x5dcc('0x3a')]({},_0x34d615,_0x207ae8[_0x5dcc('0x3b')]);return db[_0x5dcc('0x2a')]['find'](_0x34d615)[_0x5dcc('0x23')](handleEntityNotFound(_0x2e1778,null))[_0x5dcc('0x23')](respondWithResult(_0x2e1778,null))['catch'](handleError(_0x2e1778,null));};exports[_0x5dcc('0x43')]=function(_0xeef390,_0x2d2ed3){return db[_0x5dcc('0x2a')][_0x5dcc('0x43')](_0xeef390[_0x5dcc('0x44')],{})[_0x5dcc('0x23')](respondWithResult(_0x2d2ed3,0xc9))['catch'](handleError(_0x2d2ed3,null));};exports['update']=function(_0x2fb3dd,_0x1fedc5){if(_0x2fb3dd[_0x5dcc('0x44')]['id']){delete _0x2fb3dd[_0x5dcc('0x44')]['id'];}return db['ServicenowField']['find']({'where':{'id':_0x2fb3dd[_0x5dcc('0x41')]['id']}})[_0x5dcc('0x23')](handleEntityNotFound(_0x1fedc5,null))[_0x5dcc('0x23')](saveUpdates(_0x2fb3dd[_0x5dcc('0x44')],null))['then'](respondWithResult(_0x1fedc5,null))['catch'](handleError(_0x1fedc5,null));};exports[_0x5dcc('0x45')]=function(_0x14bc5f,_0xe7c336){return db[_0x5dcc('0x2a')]['find']({'where':{'id':_0x14bc5f['params']['id']}})[_0x5dcc('0x23')](handleEntityNotFound(_0xe7c336,null))[_0x5dcc('0x23')](removeEntity(_0xe7c336,null))[_0x5dcc('0x3f')](handleError(_0xe7c336,null));}; \ No newline at end of file +var _0x9caf=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','json','reject','save','update','then','destroy','error','stack','name','send','index','map','ServicenowField','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','include','rows','catch','show','params','includeAll','find','create','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0x3db4e6,_0x11d718){var _0x2699d8=function(_0x29b8a3){while(--_0x29b8a3){_0x3db4e6['push'](_0x3db4e6['shift']());}};_0x2699d8(++_0x11d718);}(_0x9caf,0x11b));var _0xf9ca=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9caf[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xf9ca('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf9ca('0x1'));var jsonpatch=require(_0xf9ca('0x2'));var rp=require(_0xf9ca('0x3'));var moment=require(_0xf9ca('0x4'));var BPromise=require(_0xf9ca('0x5'));var Mustache=require(_0xf9ca('0x6'));var util=require(_0xf9ca('0x7'));var path=require(_0xf9ca('0x8'));var sox=require(_0xf9ca('0x9'));var csv=require('to-csv');var ejs=require(_0xf9ca('0xa'));var fs=require('fs');var fs_extra=require(_0xf9ca('0xb'));var _=require(_0xf9ca('0xc'));var squel=require(_0xf9ca('0xd'));var crypto=require(_0xf9ca('0xe'));var jsforce=require(_0xf9ca('0xf'));var deskjs=require(_0xf9ca('0x10'));var toCsv=require(_0xf9ca('0x11'));var querystring=require(_0xf9ca('0x12'));var Papa=require(_0xf9ca('0x13'));var Redis=require(_0xf9ca('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xf9ca('0x15'));var as=require(_0xf9ca('0x16'));var hardwareService=require(_0xf9ca('0x17'));var logger=require(_0xf9ca('0x18'))(_0xf9ca('0x19'));var utils=require(_0xf9ca('0x1a'));var config=require(_0xf9ca('0x1b'));var licenseUtil=require(_0xf9ca('0x1c'));var db=require(_0xf9ca('0x1d'))['db'];function respondWithStatusCode(_0x57bab1,_0x5ea719){_0x5ea719=_0x5ea719||0xcc;return function(_0x2db47a){if(_0x2db47a){return _0x57bab1[_0xf9ca('0x1e')](_0x5ea719);}return _0x57bab1[_0xf9ca('0x1f')](_0x5ea719)[_0xf9ca('0x20')]();};}function respondWithResult(_0x1ee65c,_0x41fc1e){_0x41fc1e=_0x41fc1e||0xc8;return function(_0x1495ca){if(_0x1495ca){return _0x1ee65c[_0xf9ca('0x1f')](_0x41fc1e)['json'](_0x1495ca);}};}function respondWithFilteredResult(_0x492d17,_0x2ddf58){return function(_0x32e36d){if(_0x32e36d){var _0x3438c4=typeof _0x2ddf58[_0xf9ca('0x21')]===_0xf9ca('0x22')&&typeof _0x2ddf58['limit']===_0xf9ca('0x22');var _0xa6c59d=_0x32e36d['count'];var _0x597810=_0x3438c4?0x0:_0x2ddf58[_0xf9ca('0x21')];var _0x29ff7b=_0x3438c4?_0x32e36d[_0xf9ca('0x23')]:_0x2ddf58[_0xf9ca('0x21')]+_0x2ddf58[_0xf9ca('0x24')];var _0x2c1d6f;if(_0x29ff7b>=_0xa6c59d){_0x29ff7b=_0xa6c59d;_0x2c1d6f=0xc8;}else{_0x2c1d6f=0xce;}_0x492d17[_0xf9ca('0x1f')](_0x2c1d6f);return _0x492d17[_0xf9ca('0x25')]('Content-Range',_0x597810+'-'+_0x29ff7b+'/'+_0xa6c59d)[_0xf9ca('0x26')](_0x32e36d);}return null;};}function patchUpdates(_0x1ebf3f){return function(_0x1e902e){try{jsonpatch['apply'](_0x1e902e,_0x1ebf3f,!![]);}catch(_0x3c75b3){return BPromise[_0xf9ca('0x27')](_0x3c75b3);}return _0x1e902e[_0xf9ca('0x28')]();};}function saveUpdates(_0x168011,_0x503ad0){return function(_0x616ad){if(_0x616ad){return _0x616ad[_0xf9ca('0x29')](_0x168011)[_0xf9ca('0x2a')](function(_0x4ed8fc){return _0x4ed8fc;});}return null;};}function removeEntity(_0x14963f,_0x5b7da5){return function(_0x34dc5b){if(_0x34dc5b){return _0x34dc5b[_0xf9ca('0x2b')]()['then'](function(){_0x14963f['status'](0xcc)[_0xf9ca('0x20')]();});}};}function handleEntityNotFound(_0x1f0772,_0xb48b34){return function(_0x1c84a0){if(!_0x1c84a0){_0x1f0772[_0xf9ca('0x1e')](0x194);}return _0x1c84a0;};}function handleError(_0x3d67f6,_0xbf43ee){_0xbf43ee=_0xbf43ee||0x1f4;return function(_0xfe12f8){logger[_0xf9ca('0x2c')](_0xfe12f8[_0xf9ca('0x2d')]);if(_0xfe12f8['name']){delete _0xfe12f8[_0xf9ca('0x2e')];}_0x3d67f6[_0xf9ca('0x1f')](_0xbf43ee)[_0xf9ca('0x2f')](_0xfe12f8);};}exports[_0xf9ca('0x30')]=function(_0x466e11,_0x535b95){var _0x338889={},_0x1d5898={},_0x4c4728={'count':0x0,'rows':[]};var _0x5657ea=_[_0xf9ca('0x31')](db[_0xf9ca('0x32')]['rawAttributes'],function(_0x438b23){return{'name':_0x438b23['fieldName'],'type':_0x438b23[_0xf9ca('0x33')]['key']};});_0x1d5898['model']=_[_0xf9ca('0x31')](_0x5657ea,'name');_0x1d5898[_0xf9ca('0x34')]=_[_0xf9ca('0x35')](_0x466e11[_0xf9ca('0x34')]);_0x1d5898[_0xf9ca('0x36')]=_[_0xf9ca('0x37')](_0x1d5898[_0xf9ca('0x38')],_0x1d5898[_0xf9ca('0x34')]);_0x338889[_0xf9ca('0x39')]=_[_0xf9ca('0x37')](_0x1d5898[_0xf9ca('0x38')],qs[_0xf9ca('0x3a')](_0x466e11[_0xf9ca('0x34')][_0xf9ca('0x3a')]));_0x338889[_0xf9ca('0x39')]=_0x338889['attributes'][_0xf9ca('0x3b')]?_0x338889[_0xf9ca('0x39')]:_0x1d5898[_0xf9ca('0x38')];if(!_0x466e11[_0xf9ca('0x34')][_0xf9ca('0x3c')](_0xf9ca('0x3d'))){_0x338889['limit']=qs[_0xf9ca('0x24')](_0x466e11[_0xf9ca('0x34')][_0xf9ca('0x24')]);_0x338889[_0xf9ca('0x21')]=qs[_0xf9ca('0x21')](_0x466e11[_0xf9ca('0x34')]['offset']);}_0x338889['order']=qs[_0xf9ca('0x3e')](_0x466e11['query']['sort']);_0x338889[_0xf9ca('0x3f')]=qs['filters'](_[_0xf9ca('0x40')](_0x466e11['query'],_0x1d5898['filters']),_0x5657ea);if(_0x466e11['query']['filter']){_0x338889[_0xf9ca('0x3f')]=_[_0xf9ca('0x41')](_0x338889[_0xf9ca('0x3f')],{'$or':_[_0xf9ca('0x31')](_0x5657ea,function(_0x4411e9){if(_0x4411e9[_0xf9ca('0x33')]!=='VIRTUAL'){var _0x522066={};_0x522066[_0x4411e9[_0xf9ca('0x2e')]]={'$like':'%'+_0x466e11['query'][_0xf9ca('0x42')]+'%'};return _0x522066;}})});}_0x338889=_[_0xf9ca('0x41')]({},_0x338889,_0x466e11[_0xf9ca('0x43')]);var _0x3a96cf={'where':_0x338889[_0xf9ca('0x3f')]};return db[_0xf9ca('0x32')][_0xf9ca('0x23')](_0x3a96cf)[_0xf9ca('0x2a')](function(_0x3c6903){_0x4c4728[_0xf9ca('0x23')]=_0x3c6903;if(_0x466e11[_0xf9ca('0x34')]['includeAll']){_0x338889[_0xf9ca('0x44')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x338889);})[_0xf9ca('0x2a')](function(_0x3b33b5){_0x4c4728[_0xf9ca('0x45')]=_0x3b33b5;return _0x4c4728;})[_0xf9ca('0x2a')](respondWithFilteredResult(_0x535b95,_0x338889))[_0xf9ca('0x46')](handleError(_0x535b95,null));};exports[_0xf9ca('0x47')]=function(_0x2b4cbb,_0x770d04){var _0x24bd5e={'raw':!![],'where':{'id':_0x2b4cbb[_0xf9ca('0x48')]['id']}},_0x148d93={};_0x148d93[_0xf9ca('0x38')]=_[_0xf9ca('0x35')](db['ServicenowField']['rawAttributes']);_0x148d93[_0xf9ca('0x34')]=_[_0xf9ca('0x35')](_0x2b4cbb[_0xf9ca('0x34')]);_0x148d93[_0xf9ca('0x36')]=_[_0xf9ca('0x37')](_0x148d93[_0xf9ca('0x38')],_0x148d93[_0xf9ca('0x34')]);_0x24bd5e[_0xf9ca('0x39')]=_[_0xf9ca('0x37')](_0x148d93[_0xf9ca('0x38')],qs[_0xf9ca('0x3a')](_0x2b4cbb[_0xf9ca('0x34')][_0xf9ca('0x3a')]));_0x24bd5e['attributes']=_0x24bd5e[_0xf9ca('0x39')]['length']?_0x24bd5e[_0xf9ca('0x39')]:_0x148d93[_0xf9ca('0x38')];if(_0x2b4cbb[_0xf9ca('0x34')][_0xf9ca('0x49')]){_0x24bd5e['include']=[{'all':!![]}];}_0x24bd5e=_[_0xf9ca('0x41')]({},_0x24bd5e,_0x2b4cbb['options']);return db[_0xf9ca('0x32')][_0xf9ca('0x4a')](_0x24bd5e)[_0xf9ca('0x2a')](handleEntityNotFound(_0x770d04,null))['then'](respondWithResult(_0x770d04,null))[_0xf9ca('0x46')](handleError(_0x770d04,null));};exports['create']=function(_0x30b5f7,_0x5e7c04){return db[_0xf9ca('0x32')][_0xf9ca('0x4b')](_0x30b5f7['body'],{})[_0xf9ca('0x2a')](respondWithResult(_0x5e7c04,0xc9))[_0xf9ca('0x46')](handleError(_0x5e7c04,null));};exports[_0xf9ca('0x29')]=function(_0x41e26a,_0x44a20f){if(_0x41e26a['body']['id']){delete _0x41e26a['body']['id'];}return db[_0xf9ca('0x32')][_0xf9ca('0x4a')]({'where':{'id':_0x41e26a[_0xf9ca('0x48')]['id']}})[_0xf9ca('0x2a')](handleEntityNotFound(_0x44a20f,null))['then'](saveUpdates(_0x41e26a['body'],null))[_0xf9ca('0x2a')](respondWithResult(_0x44a20f,null))[_0xf9ca('0x46')](handleError(_0x44a20f,null));};exports['destroy']=function(_0x400e37,_0xdd120){return db[_0xf9ca('0x32')]['find']({'where':{'id':_0x400e37[_0xf9ca('0x48')]['id']}})[_0xf9ca('0x2a')](handleEntityNotFound(_0xdd120,null))[_0xf9ca('0x2a')](removeEntity(_0xdd120,null))[_0xf9ca('0x46')](handleError(_0xdd120,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index fc2776c..dc9dcf6 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 _0x74c9=['define','ServicenowField','int_servicenow_fields','servicenow_unique_index','FieldId','lodash','api','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports'];(function(_0x273061,_0x3502f2){var _0x420c22=function(_0x4697c0){while(--_0x4697c0){_0x273061['push'](_0x273061['shift']());}};_0x420c22(++_0x3502f2);}(_0x74c9,0x157));var _0x974c=function(_0x302ce4,_0x53f6d7){_0x302ce4=_0x302ce4-0x0;var _0x4a1c0d=_0x74c9[_0x302ce4];return _0x4a1c0d;};'use strict';var _=require(_0x974c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x974c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x974c('0x2'));var fs=require('fs');var path=require(_0x974c('0x3'));var rimraf=require(_0x974c('0x4'));var config=require(_0x974c('0x5'));var attributes=require(_0x974c('0x6'));module[_0x974c('0x7')]=function(_0x78da32,_0x288410){return _0x78da32[_0x974c('0x8')](_0x974c('0x9'),attributes,{'tableName':_0x974c('0xa'),'paranoid':![],'indexes':[{'name':_0x974c('0xb'),'fields':['idField',_0x974c('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xce77=['idField','FieldId','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','./intServicenowField.attributes','exports','define','int_servicenow_fields'];(function(_0x5a2c3d,_0x39b944){var _0x3e799a=function(_0x4d6b40){while(--_0x4d6b40){_0x5a2c3d['push'](_0x5a2c3d['shift']());}};_0x3e799a(++_0x39b944);}(_0xce77,0x13a));var _0x7ce7=function(_0x1eed06,_0x40738c){_0x1eed06=_0x1eed06-0x0;var _0x56c40f=_0xce77[_0x1eed06];return _0x56c40f;};'use strict';var _=require(_0x7ce7('0x0'));var util=require('util');var logger=require(_0x7ce7('0x1'))('api');var moment=require(_0x7ce7('0x2'));var BPromise=require(_0x7ce7('0x3'));var rp=require(_0x7ce7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7ce7('0x5'));var config=require('../../config/environment');var attributes=require(_0x7ce7('0x6'));module[_0x7ce7('0x7')]=function(_0xe4414e,_0x2a386b){return _0xe4414e[_0x7ce7('0x8')]('ServicenowField',attributes,{'tableName':_0x7ce7('0x9'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x7ce7('0xa'),_0x7ce7('0xb')],'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 36cd7d6..db536d2 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda3f=['rpc','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x3d27a,_0x31311d){var _0x314fd7=function(_0x20ac55){while(--_0x20ac55){_0x3d27a['push'](_0x3d27a['shift']());}};_0x314fd7(++_0x31311d);}(_0xda3f,0xec));var _0xfda3=function(_0x15e493,_0x3fdc9a){_0x15e493=_0x15e493-0x0;var _0x46d28c=_0xda3f[_0x15e493];return _0x46d28c;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file +var _0xbdb7=['request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','ServicenowField,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x4c2af0,_0x40921a){_0x4c2af0=_0x4c2af0-0x0;var _0x259f2c=_0xbdb7[_0x4c2af0];return _0x259f2c;};'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 0854e78..5b18591 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x12ffd6,_0x4763ee){var _0x230d47=function(_0x39069e){while(--_0x39069e){_0x12ffd6['push'](_0x12ffd6['shift']());}};_0x230d47(++_0x4763ee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x2d6aed,_0x232776){var _0x300ea7=function(_0x9dd9c6){while(--_0x9dd9c6){_0x2d6aed['push'](_0x2d6aed['shift']());}};_0x300ea7(++_0x232776);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index b43805a..ca27fd0 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(_0x430b7c,_0x3e73e0){var _0x5e7226=function(_0xa18ff6){while(--_0xa18ff6){_0x430b7c['push'](_0x430b7c['shift']());}};_0x5e7226(++_0x3e73e0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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(_0xb052a1,_0x5409cf){var _0xade248=function(_0xbb0cdb){while(--_0xbb0cdb){_0xb052a1['push'](_0xb052a1['shift']());}};_0xade248(++_0x5409cf);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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 636951f..03a5761 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 _0xb1d2=['get_module_fields','Calls','values','remove','label','endsWith','value','statusCode','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','SugarcrmAccount','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','create','body','update','find','getConfigurations','findOne','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SugarcrmField','getFields','assigned_user_id','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','POST','format','%s%s','/service/v4_1/rest.php','JSON','stringify','PLAIN','Password\x20Expired'];(function(_0xe61ebf,_0x5719b4){var _0x4203b4=function(_0x113831){while(--_0x113831){_0xe61ebf['push'](_0xe61ebf['shift']());}};_0x4203b4(++_0x5719b4);}(_0xb1d2,0x87));var _0x2b1d=function(_0x54c350,_0x2a05d0){_0x54c350=_0x54c350-0x0;var _0x30237e=_0xb1d2[_0x54c350];return _0x30237e;};'use strict';var emlformat=require(_0x2b1d('0x0'));var rimraf=require(_0x2b1d('0x1'));var zipdir=require(_0x2b1d('0x2'));var jsonpatch=require(_0x2b1d('0x3'));var rp=require(_0x2b1d('0x4'));var moment=require(_0x2b1d('0x5'));var BPromise=require(_0x2b1d('0x6'));var Mustache=require(_0x2b1d('0x7'));var util=require(_0x2b1d('0x8'));var path=require(_0x2b1d('0x9'));var sox=require(_0x2b1d('0xa'));var csv=require(_0x2b1d('0xb'));var ejs=require(_0x2b1d('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2b1d('0xd'));var squel=require(_0x2b1d('0xe'));var crypto=require(_0x2b1d('0xf'));var jsforce=require(_0x2b1d('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x2b1d('0xb'));var querystring=require('querystring');var Papa=require(_0x2b1d('0x11'));var Redis=require(_0x2b1d('0x12'));var authService=require(_0x2b1d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2b1d('0x14'));var hardwareService=require(_0x2b1d('0x15'));var logger=require(_0x2b1d('0x16'))(_0x2b1d('0x17'));var utils=require(_0x2b1d('0x18'));var config=require(_0x2b1d('0x19'));var licenseUtil=require(_0x2b1d('0x1a'));var db=require(_0x2b1d('0x1b'))['db'];var integrations=require(_0x2b1d('0x1c'));function respondWithStatusCode(_0x261849,_0x3e02d0){_0x3e02d0=_0x3e02d0||0xcc;return function(_0x37b60b){if(_0x37b60b){return _0x261849[_0x2b1d('0x1d')](_0x3e02d0);}return _0x261849[_0x2b1d('0x1e')](_0x3e02d0)['end']();};}function respondWithResult(_0x1a7c27,_0x51cc72){_0x51cc72=_0x51cc72||0xc8;return function(_0x5673f8){if(_0x5673f8){return _0x1a7c27[_0x2b1d('0x1e')](_0x51cc72)[_0x2b1d('0x1f')](_0x5673f8);}};}function respondWithFilteredResult(_0x375ef9,_0x329a16){return function(_0x11f806){if(_0x11f806){var _0x2809a0=typeof _0x329a16[_0x2b1d('0x20')]===_0x2b1d('0x21')&&typeof _0x329a16[_0x2b1d('0x22')]===_0x2b1d('0x21');var _0x61ff9f=_0x11f806[_0x2b1d('0x23')];var _0x206b5a=_0x2809a0?0x0:_0x329a16['offset'];var _0x37b300=_0x2809a0?_0x11f806[_0x2b1d('0x23')]:_0x329a16[_0x2b1d('0x20')]+_0x329a16['limit'];var _0x4243d9;if(_0x37b300>=_0x61ff9f){_0x37b300=_0x61ff9f;_0x4243d9=0xc8;}else{_0x4243d9=0xce;}_0x375ef9[_0x2b1d('0x1e')](_0x4243d9);return _0x375ef9['set'](_0x2b1d('0x24'),_0x206b5a+'-'+_0x37b300+'/'+_0x61ff9f)[_0x2b1d('0x1f')](_0x11f806);}return null;};}function patchUpdates(_0x2eaf26){return function(_0x3aebb1){try{jsonpatch[_0x2b1d('0x25')](_0x3aebb1,_0x2eaf26,!![]);}catch(_0x11af33){return BPromise[_0x2b1d('0x26')](_0x11af33);}return _0x3aebb1[_0x2b1d('0x27')]();};}function saveUpdates(_0x281f86,_0x5bd0f8){return function(_0x40332b){if(_0x40332b){return _0x40332b['update'](_0x281f86)[_0x2b1d('0x28')](function(_0x51ea7){return _0x51ea7;});}return null;};}function removeEntity(_0x1b1db3,_0x221dd1){return function(_0x4c7c3f){if(_0x4c7c3f){return _0x4c7c3f[_0x2b1d('0x29')]()[_0x2b1d('0x28')](function(){_0x1b1db3['status'](0xcc)[_0x2b1d('0x2a')]();});}};}function handleEntityNotFound(_0x38ac81,_0x5ebf97){return function(_0x4c060a){if(!_0x4c060a){_0x38ac81[_0x2b1d('0x1d')](0x194);}return _0x4c060a;};}function handleError(_0x5f34ae,_0x945e5e){_0x945e5e=_0x945e5e||0x1f4;return function(_0x1a3c6f){logger[_0x2b1d('0x2b')](_0x1a3c6f[_0x2b1d('0x2c')]);if(_0x1a3c6f['name']){delete _0x1a3c6f[_0x2b1d('0x2d')];}_0x5f34ae[_0x2b1d('0x1e')](_0x945e5e)[_0x2b1d('0x2e')](_0x1a3c6f);};}exports[_0x2b1d('0x2f')]=function(_0x599939,_0x4ed990){var _0xa2d7a1={},_0x16fa9f={},_0x525cd3={'count':0x0,'rows':[]};var _0x488a56=_['map'](db[_0x2b1d('0x30')][_0x2b1d('0x31')],function(_0x327c6f){return{'name':_0x327c6f[_0x2b1d('0x32')],'type':_0x327c6f[_0x2b1d('0x33')][_0x2b1d('0x34')]};});_0x16fa9f[_0x2b1d('0x35')]=_[_0x2b1d('0x36')](_0x488a56,_0x2b1d('0x2d'));_0x16fa9f[_0x2b1d('0x37')]=_[_0x2b1d('0x38')](_0x599939['query']);_0x16fa9f['filters']=_[_0x2b1d('0x39')](_0x16fa9f[_0x2b1d('0x35')],_0x16fa9f[_0x2b1d('0x37')]);_0xa2d7a1['attributes']=_[_0x2b1d('0x39')](_0x16fa9f[_0x2b1d('0x35')],qs[_0x2b1d('0x3a')](_0x599939['query'][_0x2b1d('0x3a')]));_0xa2d7a1[_0x2b1d('0x3b')]=_0xa2d7a1[_0x2b1d('0x3b')][_0x2b1d('0x3c')]?_0xa2d7a1[_0x2b1d('0x3b')]:_0x16fa9f[_0x2b1d('0x35')];if(!_0x599939[_0x2b1d('0x37')][_0x2b1d('0x3d')](_0x2b1d('0x3e'))){_0xa2d7a1[_0x2b1d('0x22')]=qs[_0x2b1d('0x22')](_0x599939[_0x2b1d('0x37')][_0x2b1d('0x22')]);_0xa2d7a1['offset']=qs[_0x2b1d('0x20')](_0x599939[_0x2b1d('0x37')][_0x2b1d('0x20')]);}_0xa2d7a1[_0x2b1d('0x3f')]=qs[_0x2b1d('0x40')](_0x599939[_0x2b1d('0x37')][_0x2b1d('0x40')]);_0xa2d7a1[_0x2b1d('0x41')]=qs[_0x2b1d('0x42')](_['pick'](_0x599939['query'],_0x16fa9f[_0x2b1d('0x42')]),_0x488a56);if(_0x599939['query'][_0x2b1d('0x43')]){_0xa2d7a1['where']=_[_0x2b1d('0x44')](_0xa2d7a1['where'],{'$or':_[_0x2b1d('0x36')](_0x488a56,function(_0xb78518){if(_0xb78518[_0x2b1d('0x33')]!==_0x2b1d('0x45')){var _0x2b5832={};_0x2b5832[_0xb78518[_0x2b1d('0x2d')]]={'$like':'%'+_0x599939[_0x2b1d('0x37')]['filter']+'%'};return _0x2b5832;}})});}_0xa2d7a1=_[_0x2b1d('0x44')]({},_0xa2d7a1,_0x599939['options']);var _0x525412={'where':_0xa2d7a1[_0x2b1d('0x41')]};return db['SugarcrmAccount']['count'](_0x525412)[_0x2b1d('0x28')](function(_0x2f32e8){_0x525cd3['count']=_0x2f32e8;if(_0x599939[_0x2b1d('0x37')][_0x2b1d('0x46')]){_0xa2d7a1[_0x2b1d('0x47')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x2b1d('0x48')](_0xa2d7a1);})[_0x2b1d('0x28')](function(_0x51a475){_0x525cd3[_0x2b1d('0x49')]=_0x51a475;return _0x525cd3;})[_0x2b1d('0x28')](respondWithFilteredResult(_0x4ed990,_0xa2d7a1))[_0x2b1d('0x4a')](handleError(_0x4ed990,null));};exports[_0x2b1d('0x4b')]=function(_0x199eb1,_0x101739){var _0x3935ac={'raw':![],'where':{'id':_0x199eb1[_0x2b1d('0x4c')]['id']}},_0x4adb42={};_0x4adb42[_0x2b1d('0x35')]=_[_0x2b1d('0x38')](db[_0x2b1d('0x30')][_0x2b1d('0x31')]);_0x4adb42[_0x2b1d('0x37')]=_[_0x2b1d('0x38')](_0x199eb1[_0x2b1d('0x37')]);_0x4adb42[_0x2b1d('0x42')]=_[_0x2b1d('0x39')](_0x4adb42[_0x2b1d('0x35')],_0x4adb42[_0x2b1d('0x37')]);_0x3935ac[_0x2b1d('0x3b')]=_[_0x2b1d('0x39')](_0x4adb42[_0x2b1d('0x35')],qs[_0x2b1d('0x3a')](_0x199eb1['query']['fields']));_0x3935ac[_0x2b1d('0x3b')]=_0x3935ac[_0x2b1d('0x3b')][_0x2b1d('0x3c')]?_0x3935ac['attributes']:_0x4adb42['model'];if(_0x199eb1[_0x2b1d('0x37')][_0x2b1d('0x46')]){_0x3935ac['include']=[{'all':!![]}];}_0x3935ac=_[_0x2b1d('0x44')]({},_0x3935ac,_0x199eb1[_0x2b1d('0x4d')]);return db[_0x2b1d('0x30')]['find'](_0x3935ac)['then'](handleEntityNotFound(_0x101739,null))[_0x2b1d('0x28')](respondWithResult(_0x101739,null))[_0x2b1d('0x4a')](handleError(_0x101739,null));};exports[_0x2b1d('0x4e')]=function(_0x2378e7,_0x40dd89){return db['SugarcrmAccount'][_0x2b1d('0x4e')](_0x2378e7[_0x2b1d('0x4f')],{})['then'](respondWithResult(_0x40dd89,0xc9))[_0x2b1d('0x4a')](handleError(_0x40dd89,null));};exports[_0x2b1d('0x50')]=function(_0x5167f4,_0xe5a1c4){if(_0x5167f4['body']['id']){delete _0x5167f4['body']['id'];}return db[_0x2b1d('0x30')][_0x2b1d('0x51')]({'where':{'id':_0x5167f4['params']['id']}})[_0x2b1d('0x28')](handleEntityNotFound(_0xe5a1c4,null))[_0x2b1d('0x28')](saveUpdates(_0x5167f4[_0x2b1d('0x4f')],null))['then'](respondWithResult(_0xe5a1c4,null))[_0x2b1d('0x4a')](handleError(_0xe5a1c4,null));};exports[_0x2b1d('0x29')]=function(_0x1034b7,_0x2e3f25){return db['SugarcrmAccount'][_0x2b1d('0x51')]({'where':{'id':_0x1034b7['params']['id']}})[_0x2b1d('0x28')](handleEntityNotFound(_0x2e3f25,null))['then'](removeEntity(_0x2e3f25,null))[_0x2b1d('0x4a')](handleError(_0x2e3f25,null));};exports[_0x2b1d('0x52')]=function(_0x47bfb3,_0x26756,_0x10278a){var _0x2ff627={};var _0xa78f2={};var _0x56f593;var _0x5c5711;return db[_0x2b1d('0x30')][_0x2b1d('0x53')]({'where':{'id':_0x47bfb3[_0x2b1d('0x4c')]['id']}})[_0x2b1d('0x28')](handleEntityNotFound(_0x26756,null))['then'](function(_0x6e5d7b){if(_0x6e5d7b){_0x56f593=_0x6e5d7b;_0xa78f2[_0x2b1d('0x35')]=_[_0x2b1d('0x38')](db['SugarcrmConfiguration'][_0x2b1d('0x31')]);_0xa78f2[_0x2b1d('0x37')]=_['keys'](_0x47bfb3[_0x2b1d('0x37')]);_0xa78f2[_0x2b1d('0x42')]=_['intersection'](_0xa78f2[_0x2b1d('0x35')],_0xa78f2[_0x2b1d('0x37')]);_0x2ff627[_0x2b1d('0x3b')]=_[_0x2b1d('0x39')](_0xa78f2[_0x2b1d('0x35')],qs[_0x2b1d('0x3a')](_0x47bfb3[_0x2b1d('0x37')][_0x2b1d('0x3a')]));_0x2ff627[_0x2b1d('0x3b')]=_0x2ff627[_0x2b1d('0x3b')][_0x2b1d('0x3c')]?_0x2ff627[_0x2b1d('0x3b')]:_0xa78f2['model'];_0x2ff627[_0x2b1d('0x3f')]=qs[_0x2b1d('0x40')](_0x47bfb3[_0x2b1d('0x37')][_0x2b1d('0x40')]);_0x2ff627[_0x2b1d('0x41')]=qs[_0x2b1d('0x42')](_[_0x2b1d('0x54')](_0x47bfb3['query'],_0xa78f2[_0x2b1d('0x42')]));if(_0x47bfb3[_0x2b1d('0x37')][_0x2b1d('0x43')]){_0x2ff627[_0x2b1d('0x41')]=_[_0x2b1d('0x44')](_0x2ff627[_0x2b1d('0x41')],{'$or':_[_0x2b1d('0x36')](_0x2ff627[_0x2b1d('0x3b')],function(_0x14c925){var _0x2ee493={};_0x2ee493[_0x14c925]={'$like':'%'+_0x47bfb3['query']['filter']+'%'};return _0x2ee493;})});}_0x2ff627=_['merge']({},_0x2ff627,_0x47bfb3[_0x2b1d('0x4d')]);return _0x56f593[_0x2b1d('0x52')](_0x2ff627);}})['then'](function(_0x4c31f8){if(_0x4c31f8){_0x5c5711=_0x4c31f8[_0x2b1d('0x3c')];if(!_0x47bfb3[_0x2b1d('0x37')][_0x2b1d('0x3d')](_0x2b1d('0x3e'))){_0x2ff627['limit']=qs[_0x2b1d('0x22')](_0x47bfb3[_0x2b1d('0x37')]['limit']);_0x2ff627['offset']=qs[_0x2b1d('0x20')](_0x47bfb3[_0x2b1d('0x37')][_0x2b1d('0x20')]);}return _0x56f593[_0x2b1d('0x52')](_0x2ff627);}})[_0x2b1d('0x28')](function(_0xcae9c0){if(_0xcae9c0){return _0xcae9c0?{'count':_0x5c5711,'rows':_0xcae9c0}:null;}})[_0x2b1d('0x28')](respondWithResult(_0x26756,null))['catch'](handleError(_0x26756,null));};exports[_0x2b1d('0x55')]=function(_0x58e62e,_0xd00252,_0x5550a0){if(_0x58e62e[_0x2b1d('0x4f')]['id']){delete _0x58e62e[_0x2b1d('0x4f')]['id'];}return db[_0x2b1d('0x30')][_0x2b1d('0x53')]({'where':{'id':_0x58e62e['params']['id']}})[_0x2b1d('0x28')](handleEntityNotFound(_0xd00252,null))[_0x2b1d('0x28')](function(_0x8f2b32){if(_0x8f2b32){_0x58e62e[_0x2b1d('0x4f')][_0x2b1d('0x56')]=_0x8f2b32['id'];_0x58e62e[_0x2b1d('0x4f')][_0x2b1d('0x57')]=integrations[_0x2b1d('0x58')](_0x58e62e[_0x2b1d('0x4f')][_0x2b1d('0x59')],_0x58e62e[_0x2b1d('0x4f')][_0x2b1d('0x33')]);_0x58e62e['body'][_0x2b1d('0x5a')]=integrations['getDescriptions'](_0x58e62e['body'][_0x2b1d('0x59')],_0x58e62e[_0x2b1d('0x4f')][_0x2b1d('0x33')]);return db['SugarcrmConfiguration']['create'](_0x58e62e['body'],{'include':[{'model':db[_0x2b1d('0x5b')],'as':'Subjects'},{'model':db[_0x2b1d('0x5b')],'as':_0x2b1d('0x5a')}]});}return null;})['then'](respondWithResult(_0xd00252,null))[_0x2b1d('0x4a')](handleError(_0xd00252,null));};exports[_0x2b1d('0x5c')]=function(_0x5260d1,_0x4d7b00,_0x1ea629){var _0x234618='';var _0x199c32=['id','name',_0x2b1d('0x5d'),'created_by',_0x2b1d('0x5e'),_0x2b1d('0x5f'),_0x2b1d('0x60'),_0x2b1d('0x61'),_0x2b1d('0x62'),_0x2b1d('0x63'),_0x2b1d('0x64'),_0x2b1d('0x65')];return db[_0x2b1d('0x30')][_0x2b1d('0x53')]({'where':{'id':_0x5260d1[_0x2b1d('0x4c')]['id']},'attributes':['id',_0x2b1d('0x66'),_0x2b1d('0x67'),_0x2b1d('0x68')]})['then'](handleEntityNotFound(_0x4d7b00,null))[_0x2b1d('0x28')](function(_0x38c615){if(_0x38c615){_0x234618=_0x38c615[_0x2b1d('0x68')];var _0x967623=_0x234618[_0x2b1d('0x69')](-0x1);if(_0x967623==='/'){_0x234618=_0x234618[_0x2b1d('0x6a')](0x0,_0x234618['lastIndexOf'](_0x967623));}return rp({'method':_0x2b1d('0x6b'),'uri':util[_0x2b1d('0x6c')](_0x2b1d('0x6d'),_0x234618,_0x2b1d('0x6e')),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':_0x2b1d('0x6f'),'rest_data':JSON[_0x2b1d('0x70')]({'user_auth':{'user_name':_0x38c615['username'],'password':_0x38c615[_0x2b1d('0x67')],'encryption':_0x2b1d('0x71')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x2b1d('0x28')](function(_0x514197){if(_0x514197&&_0x514197[_0x2b1d('0x2d')]!=='Invalid\x20Login'&&_0x514197[_0x2b1d('0x2d')]!==_0x2b1d('0x72')){return rp({'method':_0x2b1d('0x6b'),'uri':util[_0x2b1d('0x6c')](_0x2b1d('0x6d'),_0x234618,_0x2b1d('0x6e')),'json':!![],'form':{'method':_0x2b1d('0x73'),'input_type':'JSON','response_type':_0x2b1d('0x6f'),'rest_data':JSON[_0x2b1d('0x70')]({'session':_0x514197['id'],'module_name':_0x2b1d('0x74')})}})['then'](function(_0x1143d5){if(_0x1143d5){var _0x43c27f=_[_0x2b1d('0x75')](_0x1143d5['module_fields']);_[_0x2b1d('0x76')](_0x43c27f,function(_0x21c757){return _0x199c32['includes'](_0x21c757['name']);});return{'count':_0x43c27f['length'],'rows':_['map'](_0x43c27f,function(_0x233daa){return{'id':_0x233daa[_0x2b1d('0x2d')],'name':_0x233daa[_0x2b1d('0x77')],'custom':_[_0x2b1d('0x78')](_0x233daa['name'],'_c')?!![]:![],'options':_0x233daa[_0x2b1d('0x4d')]?_[_0x2b1d('0x36')](_[_0x2b1d('0x75')](_0x233daa[_0x2b1d('0x4d')]),function(_0x503f80){return{'name':_0x503f80[_0x2b1d('0x79')],'value':_0x503f80[_0x2b1d('0x2d')]};}):[]};})};}})['then'](respondWithResult(_0x4d7b00,null))[_0x2b1d('0x4a')](function(_0x4dfa46){var _0x1e5fa0=_0x5260d1[_0x2b1d('0x37')]['test']?0x1f4:_0x4dfa46[_0x2b1d('0x7a')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x2b1d('0x5c'),_0x1e5fa0,JSON[_0x2b1d('0x70')](_0x4dfa46));delete _0x4dfa46[_0x2b1d('0x2d')];if(_0x1e5fa0===0x191){_0x1e5fa0=0x190;}_0x4d7b00['status'](_0x1e5fa0)[_0x2b1d('0x2e')](_0x5260d1[_0x2b1d('0x37')][_0x2b1d('0x7b')]?{'message':_0x2b1d('0x7c'),'statusCode':_0x4dfa46['statusCode']}:_0x4dfa46);});}else{var _0x168d5a=0x1f4;_0x4d7b00[_0x2b1d('0x1e')](_0x168d5a)['send']({'message':_0x2b1d('0x7c'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x8151=['limit','count','offset','Content-Range','json','apply','reject','save','then','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','options','SugarcrmAccount','rows','catch','show','params','includeAll','include','merge','find','create','update','body','destroy','getConfigurations','SugarcrmConfiguration','order','addConfiguration','getSubjects','channel','getDescriptions','SugarcrmField','Subjects','Descriptions','getFields','assigned_user_id','created_by','date_start','duration_hours','parent_id','parent_type','findOne','username','remoteUri','slice','substring','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','login','JSON','stringify','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','get_module_fields','values','module_fields','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','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','../../components/integrations/configuration','status','end','undefined'];(function(_0x1b24e4,_0x51977b){var _0x1573fe=function(_0x3eb377){while(--_0x3eb377){_0x1b24e4['push'](_0x1b24e4['shift']());}};_0x1573fe(++_0x51977b);}(_0x8151,0xd5));var _0x1815=function(_0x505b9d,_0x14bcf4){_0x505b9d=_0x505b9d-0x0;var _0x491990=_0x8151[_0x505b9d];return _0x491990;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1815('0x0'));var jsonpatch=require(_0x1815('0x1'));var rp=require(_0x1815('0x2'));var moment=require(_0x1815('0x3'));var BPromise=require(_0x1815('0x4'));var Mustache=require(_0x1815('0x5'));var util=require(_0x1815('0x6'));var path=require('path');var sox=require(_0x1815('0x7'));var csv=require(_0x1815('0x8'));var ejs=require(_0x1815('0x9'));var fs=require('fs');var fs_extra=require(_0x1815('0xa'));var _=require('lodash');var squel=require(_0x1815('0xb'));var crypto=require(_0x1815('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1815('0xd'));var toCsv=require(_0x1815('0x8'));var querystring=require(_0x1815('0xe'));var Papa=require(_0x1815('0xf'));var Redis=require(_0x1815('0x10'));var authService=require(_0x1815('0x11'));var qs=require(_0x1815('0x12'));var as=require(_0x1815('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1815('0x14'))(_0x1815('0x15'));var utils=require(_0x1815('0x16'));var config=require(_0x1815('0x17'));var licenseUtil=require(_0x1815('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x1815('0x19'));function respondWithStatusCode(_0x74454d,_0xcdd8af){_0xcdd8af=_0xcdd8af||0xcc;return function(_0x2ccab8){if(_0x2ccab8){return _0x74454d['sendStatus'](_0xcdd8af);}return _0x74454d[_0x1815('0x1a')](_0xcdd8af)[_0x1815('0x1b')]();};}function respondWithResult(_0x273530,_0x41c47b){_0x41c47b=_0x41c47b||0xc8;return function(_0x412c7a){if(_0x412c7a){return _0x273530[_0x1815('0x1a')](_0x41c47b)['json'](_0x412c7a);}};}function respondWithFilteredResult(_0x222cee,_0x4f9a52){return function(_0x21fe7c){if(_0x21fe7c){var _0xd41a8c=typeof _0x4f9a52['offset']===_0x1815('0x1c')&&typeof _0x4f9a52[_0x1815('0x1d')]==='undefined';var _0x3a6623=_0x21fe7c[_0x1815('0x1e')];var _0xa930aa=_0xd41a8c?0x0:_0x4f9a52[_0x1815('0x1f')];var _0x52cc42=_0xd41a8c?_0x21fe7c[_0x1815('0x1e')]:_0x4f9a52['offset']+_0x4f9a52[_0x1815('0x1d')];var _0x1a7ea3;if(_0x52cc42>=_0x3a6623){_0x52cc42=_0x3a6623;_0x1a7ea3=0xc8;}else{_0x1a7ea3=0xce;}_0x222cee[_0x1815('0x1a')](_0x1a7ea3);return _0x222cee['set'](_0x1815('0x20'),_0xa930aa+'-'+_0x52cc42+'/'+_0x3a6623)[_0x1815('0x21')](_0x21fe7c);}return null;};}function patchUpdates(_0x222b98){return function(_0x3bd42a){try{jsonpatch[_0x1815('0x22')](_0x3bd42a,_0x222b98,!![]);}catch(_0x77af79){return BPromise[_0x1815('0x23')](_0x77af79);}return _0x3bd42a[_0x1815('0x24')]();};}function saveUpdates(_0x506819,_0x3c8454){return function(_0x2253c3){if(_0x2253c3){return _0x2253c3['update'](_0x506819)['then'](function(_0x115747){return _0x115747;});}return null;};}function removeEntity(_0x496583,_0x15819c){return function(_0x315fc4){if(_0x315fc4){return _0x315fc4['destroy']()[_0x1815('0x25')](function(){_0x496583[_0x1815('0x1a')](0xcc)[_0x1815('0x1b')]();});}};}function handleEntityNotFound(_0x59c7b4,_0x4a3274){return function(_0x47be58){if(!_0x47be58){_0x59c7b4[_0x1815('0x26')](0x194);}return _0x47be58;};}function handleError(_0x2a445e,_0x234bd9){_0x234bd9=_0x234bd9||0x1f4;return function(_0x52ccfb){logger[_0x1815('0x27')](_0x52ccfb[_0x1815('0x28')]);if(_0x52ccfb[_0x1815('0x29')]){delete _0x52ccfb['name'];}_0x2a445e[_0x1815('0x1a')](_0x234bd9)[_0x1815('0x2a')](_0x52ccfb);};}exports[_0x1815('0x2b')]=function(_0x154336,_0x89db09){var _0x5e9d6a={},_0x2e243b={},_0x567848={'count':0x0,'rows':[]};var _0x16d3b1=_[_0x1815('0x2c')](db['SugarcrmAccount'][_0x1815('0x2d')],function(_0x5ec840){return{'name':_0x5ec840['fieldName'],'type':_0x5ec840[_0x1815('0x2e')][_0x1815('0x2f')]};});_0x2e243b[_0x1815('0x30')]=_[_0x1815('0x2c')](_0x16d3b1,_0x1815('0x29'));_0x2e243b[_0x1815('0x31')]=_[_0x1815('0x32')](_0x154336[_0x1815('0x31')]);_0x2e243b['filters']=_[_0x1815('0x33')](_0x2e243b['model'],_0x2e243b[_0x1815('0x31')]);_0x5e9d6a['attributes']=_[_0x1815('0x33')](_0x2e243b[_0x1815('0x30')],qs[_0x1815('0x34')](_0x154336[_0x1815('0x31')][_0x1815('0x34')]));_0x5e9d6a[_0x1815('0x35')]=_0x5e9d6a['attributes'][_0x1815('0x36')]?_0x5e9d6a[_0x1815('0x35')]:_0x2e243b[_0x1815('0x30')];if(!_0x154336[_0x1815('0x31')][_0x1815('0x37')](_0x1815('0x38'))){_0x5e9d6a['limit']=qs[_0x1815('0x1d')](_0x154336[_0x1815('0x31')]['limit']);_0x5e9d6a[_0x1815('0x1f')]=qs[_0x1815('0x1f')](_0x154336[_0x1815('0x31')][_0x1815('0x1f')]);}_0x5e9d6a['order']=qs[_0x1815('0x39')](_0x154336['query'][_0x1815('0x39')]);_0x5e9d6a[_0x1815('0x3a')]=qs[_0x1815('0x3b')](_[_0x1815('0x3c')](_0x154336[_0x1815('0x31')],_0x2e243b[_0x1815('0x3b')]),_0x16d3b1);if(_0x154336[_0x1815('0x31')][_0x1815('0x3d')]){_0x5e9d6a[_0x1815('0x3a')]=_['merge'](_0x5e9d6a[_0x1815('0x3a')],{'$or':_[_0x1815('0x2c')](_0x16d3b1,function(_0x9449b6){if(_0x9449b6[_0x1815('0x2e')]!==_0x1815('0x3e')){var _0xcda9b2={};_0xcda9b2[_0x9449b6[_0x1815('0x29')]]={'$like':'%'+_0x154336[_0x1815('0x31')]['filter']+'%'};return _0xcda9b2;}})});}_0x5e9d6a=_['merge']({},_0x5e9d6a,_0x154336[_0x1815('0x3f')]);var _0xbd1e64={'where':_0x5e9d6a[_0x1815('0x3a')]};return db[_0x1815('0x40')][_0x1815('0x1e')](_0xbd1e64)[_0x1815('0x25')](function(_0x269bed){_0x567848[_0x1815('0x1e')]=_0x269bed;if(_0x154336[_0x1815('0x31')]['includeAll']){_0x5e9d6a['include']=[{'all':!![]}];}return db[_0x1815('0x40')]['findAll'](_0x5e9d6a);})[_0x1815('0x25')](function(_0x831b09){_0x567848[_0x1815('0x41')]=_0x831b09;return _0x567848;})[_0x1815('0x25')](respondWithFilteredResult(_0x89db09,_0x5e9d6a))[_0x1815('0x42')](handleError(_0x89db09,null));};exports[_0x1815('0x43')]=function(_0x207ccf,_0x26a848){var _0x58da02={'raw':![],'where':{'id':_0x207ccf[_0x1815('0x44')]['id']}},_0x233af1={};_0x233af1[_0x1815('0x30')]=_[_0x1815('0x32')](db[_0x1815('0x40')]['rawAttributes']);_0x233af1['query']=_['keys'](_0x207ccf[_0x1815('0x31')]);_0x233af1[_0x1815('0x3b')]=_['intersection'](_0x233af1['model'],_0x233af1['query']);_0x58da02['attributes']=_[_0x1815('0x33')](_0x233af1['model'],qs[_0x1815('0x34')](_0x207ccf[_0x1815('0x31')]['fields']));_0x58da02[_0x1815('0x35')]=_0x58da02[_0x1815('0x35')][_0x1815('0x36')]?_0x58da02[_0x1815('0x35')]:_0x233af1[_0x1815('0x30')];if(_0x207ccf[_0x1815('0x31')][_0x1815('0x45')]){_0x58da02[_0x1815('0x46')]=[{'all':!![]}];}_0x58da02=_[_0x1815('0x47')]({},_0x58da02,_0x207ccf[_0x1815('0x3f')]);return db[_0x1815('0x40')][_0x1815('0x48')](_0x58da02)[_0x1815('0x25')](handleEntityNotFound(_0x26a848,null))[_0x1815('0x25')](respondWithResult(_0x26a848,null))[_0x1815('0x42')](handleError(_0x26a848,null));};exports[_0x1815('0x49')]=function(_0x597427,_0x47c60a){return db[_0x1815('0x40')]['create'](_0x597427['body'],{})['then'](respondWithResult(_0x47c60a,0xc9))[_0x1815('0x42')](handleError(_0x47c60a,null));};exports[_0x1815('0x4a')]=function(_0x4307ad,_0x3eea29){if(_0x4307ad[_0x1815('0x4b')]['id']){delete _0x4307ad['body']['id'];}return db['SugarcrmAccount'][_0x1815('0x48')]({'where':{'id':_0x4307ad[_0x1815('0x44')]['id']}})[_0x1815('0x25')](handleEntityNotFound(_0x3eea29,null))[_0x1815('0x25')](saveUpdates(_0x4307ad[_0x1815('0x4b')],null))[_0x1815('0x25')](respondWithResult(_0x3eea29,null))[_0x1815('0x42')](handleError(_0x3eea29,null));};exports[_0x1815('0x4c')]=function(_0x202322,_0x1f7317){return db[_0x1815('0x40')][_0x1815('0x48')]({'where':{'id':_0x202322[_0x1815('0x44')]['id']}})['then'](handleEntityNotFound(_0x1f7317,null))['then'](removeEntity(_0x1f7317,null))['catch'](handleError(_0x1f7317,null));};exports[_0x1815('0x4d')]=function(_0x5bb6b6,_0x10a241,_0x40638f){var _0x3360ca={};var _0x567906={};var _0x3e8ea6;var _0x2bf481;return db[_0x1815('0x40')]['findOne']({'where':{'id':_0x5bb6b6[_0x1815('0x44')]['id']}})[_0x1815('0x25')](handleEntityNotFound(_0x10a241,null))[_0x1815('0x25')](function(_0x33fe0d){if(_0x33fe0d){_0x3e8ea6=_0x33fe0d;_0x567906[_0x1815('0x30')]=_['keys'](db[_0x1815('0x4e')]['rawAttributes']);_0x567906['query']=_['keys'](_0x5bb6b6[_0x1815('0x31')]);_0x567906[_0x1815('0x3b')]=_['intersection'](_0x567906[_0x1815('0x30')],_0x567906['query']);_0x3360ca[_0x1815('0x35')]=_[_0x1815('0x33')](_0x567906[_0x1815('0x30')],qs[_0x1815('0x34')](_0x5bb6b6[_0x1815('0x31')]['fields']));_0x3360ca[_0x1815('0x35')]=_0x3360ca[_0x1815('0x35')][_0x1815('0x36')]?_0x3360ca[_0x1815('0x35')]:_0x567906[_0x1815('0x30')];_0x3360ca[_0x1815('0x4f')]=qs['sort'](_0x5bb6b6['query'][_0x1815('0x39')]);_0x3360ca[_0x1815('0x3a')]=qs[_0x1815('0x3b')](_[_0x1815('0x3c')](_0x5bb6b6[_0x1815('0x31')],_0x567906['filters']));if(_0x5bb6b6[_0x1815('0x31')][_0x1815('0x3d')]){_0x3360ca[_0x1815('0x3a')]=_[_0x1815('0x47')](_0x3360ca['where'],{'$or':_['map'](_0x3360ca[_0x1815('0x35')],function(_0x27d2f0){var _0xd7d5d6={};_0xd7d5d6[_0x27d2f0]={'$like':'%'+_0x5bb6b6[_0x1815('0x31')]['filter']+'%'};return _0xd7d5d6;})});}_0x3360ca=_[_0x1815('0x47')]({},_0x3360ca,_0x5bb6b6[_0x1815('0x3f')]);return _0x3e8ea6['getConfigurations'](_0x3360ca);}})[_0x1815('0x25')](function(_0x612b4f){if(_0x612b4f){_0x2bf481=_0x612b4f['length'];if(!_0x5bb6b6[_0x1815('0x31')][_0x1815('0x37')](_0x1815('0x38'))){_0x3360ca[_0x1815('0x1d')]=qs['limit'](_0x5bb6b6[_0x1815('0x31')][_0x1815('0x1d')]);_0x3360ca[_0x1815('0x1f')]=qs[_0x1815('0x1f')](_0x5bb6b6[_0x1815('0x31')][_0x1815('0x1f')]);}return _0x3e8ea6[_0x1815('0x4d')](_0x3360ca);}})[_0x1815('0x25')](function(_0x5d0b79){if(_0x5d0b79){return _0x5d0b79?{'count':_0x2bf481,'rows':_0x5d0b79}:null;}})[_0x1815('0x25')](respondWithResult(_0x10a241,null))['catch'](handleError(_0x10a241,null));};exports[_0x1815('0x50')]=function(_0x45df4f,_0x2d53e8,_0x42801f){if(_0x45df4f['body']['id']){delete _0x45df4f[_0x1815('0x4b')]['id'];}return db[_0x1815('0x40')]['findOne']({'where':{'id':_0x45df4f[_0x1815('0x44')]['id']}})[_0x1815('0x25')](handleEntityNotFound(_0x2d53e8,null))[_0x1815('0x25')](function(_0x5ac175){if(_0x5ac175){_0x45df4f[_0x1815('0x4b')]['AccountId']=_0x5ac175['id'];_0x45df4f['body']['Subjects']=integrations[_0x1815('0x51')](_0x45df4f[_0x1815('0x4b')][_0x1815('0x52')],_0x45df4f[_0x1815('0x4b')][_0x1815('0x2e')]);_0x45df4f[_0x1815('0x4b')]['Descriptions']=integrations[_0x1815('0x53')](_0x45df4f[_0x1815('0x4b')][_0x1815('0x52')],_0x45df4f['body'][_0x1815('0x2e')]);return db[_0x1815('0x4e')][_0x1815('0x49')](_0x45df4f[_0x1815('0x4b')],{'include':[{'model':db[_0x1815('0x54')],'as':_0x1815('0x55')},{'model':db[_0x1815('0x54')],'as':_0x1815('0x56')}]});}return null;})[_0x1815('0x25')](respondWithResult(_0x2d53e8,null))[_0x1815('0x42')](handleError(_0x2d53e8,null));};exports[_0x1815('0x57')]=function(_0x3a258e,_0x146962,_0x2c85e4){var _0x5e852d='';var _0x2419e0=['id',_0x1815('0x29'),_0x1815('0x58'),_0x1815('0x59'),'description',_0x1815('0x5a'),_0x1815('0x5b'),'duration_minutes',_0x1815('0x5c'),_0x1815('0x5d'),'parent_name','direction'];return db[_0x1815('0x40')][_0x1815('0x5e')]({'where':{'id':_0x3a258e[_0x1815('0x44')]['id']},'attributes':['id',_0x1815('0x5f'),'password',_0x1815('0x60')]})[_0x1815('0x25')](handleEntityNotFound(_0x146962,null))[_0x1815('0x25')](function(_0x12928a){if(_0x12928a){_0x5e852d=_0x12928a[_0x1815('0x60')];var _0x3fc06d=_0x5e852d[_0x1815('0x61')](-0x1);if(_0x3fc06d==='/'){_0x5e852d=_0x5e852d[_0x1815('0x62')](0x0,_0x5e852d[_0x1815('0x63')](_0x3fc06d));}return rp({'method':_0x1815('0x64'),'uri':util['format'](_0x1815('0x65'),_0x5e852d,_0x1815('0x66')),'json':!![],'form':{'method':_0x1815('0x67'),'input_type':_0x1815('0x68'),'response_type':_0x1815('0x68'),'rest_data':JSON[_0x1815('0x69')]({'user_auth':{'user_name':_0x12928a[_0x1815('0x5f')],'password':_0x12928a[_0x1815('0x6a')],'encryption':_0x1815('0x6b')},'application':_0x1815('0x6c')})}});}})[_0x1815('0x25')](function(_0x346bb3){if(_0x346bb3&&_0x346bb3['name']!==_0x1815('0x6d')&&_0x346bb3[_0x1815('0x29')]!=='Password\x20Expired'){return rp({'method':'POST','uri':util['format'](_0x1815('0x65'),_0x5e852d,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x1815('0x6e'),'input_type':_0x1815('0x68'),'response_type':_0x1815('0x68'),'rest_data':JSON['stringify']({'session':_0x346bb3['id'],'module_name':'Calls'})}})['then'](function(_0x27d1ba){if(_0x27d1ba){var _0x5eaaec=_[_0x1815('0x6f')](_0x27d1ba[_0x1815('0x70')]);_['remove'](_0x5eaaec,function(_0x473bc6){return _0x2419e0[_0x1815('0x71')](_0x473bc6[_0x1815('0x29')]);});return{'count':_0x5eaaec[_0x1815('0x36')],'rows':_[_0x1815('0x2c')](_0x5eaaec,function(_0x1cfc91){return{'id':_0x1cfc91[_0x1815('0x29')],'name':_0x1cfc91[_0x1815('0x72')],'custom':_[_0x1815('0x73')](_0x1cfc91[_0x1815('0x29')],'_c')?!![]:![],'options':_0x1cfc91['options']?_['map'](_['values'](_0x1cfc91[_0x1815('0x3f')]),function(_0x86e8ea){return{'name':_0x86e8ea[_0x1815('0x74')],'value':_0x86e8ea[_0x1815('0x29')]};}):[]};})};}})[_0x1815('0x25')](respondWithResult(_0x146962,null))['catch'](function(_0x302a96){var _0x129bdc=_0x3a258e[_0x1815('0x31')][_0x1815('0x75')]?0x1f4:_0x302a96[_0x1815('0x76')]||0x1f4;logger[_0x1815('0x27')](_0x1815('0x77'),_0x1815('0x57'),_0x129bdc,JSON[_0x1815('0x69')](_0x302a96));delete _0x302a96[_0x1815('0x29')];if(_0x129bdc===0x191){_0x129bdc=0x190;}_0x146962[_0x1815('0x1a')](_0x129bdc)['send'](_0x3a258e[_0x1815('0x31')][_0x1815('0x75')]?{'message':_0x1815('0x78'),'statusCode':_0x302a96[_0x1815('0x76')]}:_0x302a96);});}else{var _0x36dbbf=0x1f4;_0x146962['status'](_0x36dbbf)[_0x1815('0x2a')]({'message':_0x1815('0x78'),'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 5a7181d..52d68b5 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 _0xbd1c=['./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x1ef179,_0x4fac6a){var _0x5923ad=function(_0x5ae6d4){while(--_0x5ae6d4){_0x1ef179['push'](_0x1ef179['shift']());}};_0x5923ad(++_0x4fac6a);}(_0xbd1c,0x144));var _0xcbd1=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xbd1c[_0x4b055c];return _0x4b62bb;};'use strict';var _=require('lodash');var util=require(_0xcbd1('0x0'));var logger=require(_0xcbd1('0x1'))(_0xcbd1('0x2'));var moment=require('moment');var BPromise=require(_0xcbd1('0x3'));var rp=require(_0xcbd1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcbd1('0x5'));var config=require('../../config/environment');var attributes=require(_0xcbd1('0x6'));var integrations=require('../../components/integrations/configuration');module[_0xcbd1('0x7')]=function(_0x47b36f,_0x22b9e5){return _0x47b36f[_0xcbd1('0x8')](_0xcbd1('0x9'),attributes,{'tableName':_0xcbd1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa35e=['rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','int_sugarcrm_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x17c64b,_0x38ae9c){var _0x5ca37f=function(_0x5c32d1){while(--_0x5c32d1){_0x17c64b['push'](_0x17c64b['shift']());}};_0x5ca37f(++_0x38ae9c);}(_0xa35e,0x111));var _0xea35=function(_0x3f7a85,_0x165430){_0x3f7a85=_0x3f7a85-0x0;var _0x3bddbd=_0xa35e[_0x3f7a85];return _0x3bddbd;};'use strict';var _=require(_0xea35('0x0'));var util=require('util');var logger=require(_0xea35('0x1'))(_0xea35('0x2'));var moment=require(_0xea35('0x3'));var BPromise=require(_0xea35('0x4'));var rp=require(_0xea35('0x5'));var fs=require('fs');var path=require(_0xea35('0x6'));var rimraf=require(_0xea35('0x7'));var config=require(_0xea35('0x8'));var attributes=require(_0xea35('0x9'));var integrations=require(_0xea35('0xa'));module[_0xea35('0xb')]=function(_0x3dc645,_0x35d34b){return _0x3dc645[_0xea35('0xc')]('SugarcrmAccount',attributes,{'tableName':_0xea35('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index a9102cf..42f0c58 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 _0xebe4=['info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','code','message','error','catch','GetSugarcrmAccount','SugarcrmAccount','options','raw','where','attributes','limit','include','map','model','ShowSugarcrmAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x5ce4f8,_0x1dca0b){var _0x156126=function(_0x1abf41){while(--_0x1abf41){_0x5ce4f8['push'](_0x5ce4f8['shift']());}};_0x156126(++_0x1dca0b);}(_0xebe4,0x12d));var _0x4ebe=function(_0x357708,_0x372ca2){_0x357708=_0x357708-0x0;var _0x55b071=_0xebe4[_0x357708];return _0x55b071;};'use strict';var _=require('lodash');var util=require(_0x4ebe('0x0'));var moment=require(_0x4ebe('0x1'));var BPromise=require(_0x4ebe('0x2'));var rs=require(_0x4ebe('0x3'));var fs=require('fs');var Redis=require(_0x4ebe('0x4'));var db=require(_0x4ebe('0x5'))['db'];var utils=require(_0x4ebe('0x6'));var logger=require(_0x4ebe('0x7'))(_0x4ebe('0x8'));var config=require(_0x4ebe('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4ebe('0xa')][_0x4ebe('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa107a1,_0x2592bc,_0x4fa4ef){return new BPromise(function(_0x582b55,_0x4f5486){return client[_0x4ebe('0xc')](_0xa107a1,_0x4fa4ef)[_0x4ebe('0xd')](function(_0xf8bfea){logger[_0x4ebe('0xe')](_0x4ebe('0xf'),_0x2592bc,_0x4ebe('0x10'));logger[_0x4ebe('0x11')](_0x4ebe('0x12'),_0x2592bc,_0x4ebe('0x10'),JSON[_0x4ebe('0x13')](_0xf8bfea));if(_0xf8bfea['error']){if(_0xf8bfea['error'][_0x4ebe('0x14')]===0x1f4){logger['error'](_0x4ebe('0xf'),_0x2592bc,_0xf8bfea['error'][_0x4ebe('0x15')]);return _0x4f5486(_0xf8bfea[_0x4ebe('0x16')]['message']);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x2592bc,_0xf8bfea[_0x4ebe('0x16')]['message']);return _0x582b55(_0xf8bfea['error'][_0x4ebe('0x15')]);}else{logger[_0x4ebe('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x2592bc,_0x4ebe('0x10'));_0x582b55(_0xf8bfea['result'][_0x4ebe('0x15')]);}})[_0x4ebe('0x17')](function(_0x50de8f){logger['error'](_0x4ebe('0xf'),_0x2592bc,_0x50de8f);_0x4f5486(_0x50de8f);});});}exports[_0x4ebe('0x18')]=function(_0x484df3){var _0x5a5017=this;return new Promise(function(_0x13cabf,_0x1d86bb){return db[_0x4ebe('0x19')]['findAll']({'raw':_0x484df3[_0x4ebe('0x1a')]?_0x484df3[_0x4ebe('0x1a')][_0x4ebe('0x1b')]===undefined?!![]:![]:!![],'where':_0x484df3[_0x4ebe('0x1a')]?_0x484df3[_0x4ebe('0x1a')][_0x4ebe('0x1c')]||null:null,'attributes':_0x484df3[_0x4ebe('0x1a')]?_0x484df3[_0x4ebe('0x1a')][_0x4ebe('0x1d')]||null:null,'limit':_0x484df3[_0x4ebe('0x1a')]?_0x484df3['options'][_0x4ebe('0x1e')]||null:null,'include':_0x484df3[_0x4ebe('0x1a')]?_0x484df3[_0x4ebe('0x1a')][_0x4ebe('0x1f')]?_[_0x4ebe('0x20')](_0x484df3[_0x4ebe('0x1a')][_0x4ebe('0x1f')],function(_0x84e76b){return{'model':db[_0x84e76b[_0x4ebe('0x21')]],'as':_0x84e76b['as'],'attributes':_0x84e76b[_0x4ebe('0x1d')],'include':_0x84e76b[_0x4ebe('0x1f')]?_[_0x4ebe('0x20')](_0x84e76b[_0x4ebe('0x1f')],function(_0x2c1489){return{'model':db[_0x2c1489[_0x4ebe('0x21')]],'as':_0x2c1489['as'],'attributes':_0x2c1489[_0x4ebe('0x1d')],'include':_0x2c1489[_0x4ebe('0x1f')]?_[_0x4ebe('0x20')](_0x2c1489['include'],function(_0x51ae49){return{'model':db[_0x51ae49[_0x4ebe('0x21')]],'as':_0x51ae49['as'],'attributes':_0x51ae49[_0x4ebe('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4ebe('0xd')](function(_0x251250){logger['info']('GetSugarcrmAccount',_0x484df3);logger[_0x4ebe('0x11')](_0x4ebe('0x18'),_0x484df3,JSON['stringify'](_0x251250));_0x13cabf(_0x251250);})['catch'](function(_0x183421){logger['error'](_0x4ebe('0x18'),_0x183421[_0x4ebe('0x15')],_0x484df3);_0x1d86bb(_0x5a5017[_0x4ebe('0x16')](0x1f4,_0x183421[_0x4ebe('0x15')]));});});};exports[_0x4ebe('0x22')]=function(_0x25c7ec){var _0x4f2127=this;return new Promise(function(_0x5e4adc,_0xdfefd4){return db['SugarcrmAccount']['find']({'raw':_0x25c7ec['options']?_0x25c7ec['options'][_0x4ebe('0x1b')]===undefined?!![]:![]:!![],'where':_0x25c7ec['options']?_0x25c7ec['options']['where']||null:null,'attributes':_0x25c7ec[_0x4ebe('0x1a')]?_0x25c7ec[_0x4ebe('0x1a')]['attributes']||null:null,'include':_0x25c7ec['options']?_0x25c7ec[_0x4ebe('0x1a')][_0x4ebe('0x1f')]?_[_0x4ebe('0x20')](_0x25c7ec[_0x4ebe('0x1a')][_0x4ebe('0x1f')],function(_0x10cabc){return{'model':db[_0x10cabc['model']],'as':_0x10cabc['as'],'attributes':_0x10cabc[_0x4ebe('0x1d')],'include':_0x10cabc[_0x4ebe('0x1f')]?_[_0x4ebe('0x20')](_0x10cabc[_0x4ebe('0x1f')],function(_0x1593f0){return{'model':db[_0x1593f0['model']],'as':_0x1593f0['as'],'attributes':_0x1593f0[_0x4ebe('0x1d')],'include':_0x1593f0[_0x4ebe('0x1f')]?_[_0x4ebe('0x20')](_0x1593f0[_0x4ebe('0x1f')],function(_0x4b04cc){return{'model':db[_0x4b04cc[_0x4ebe('0x21')]],'as':_0x4b04cc['as'],'attributes':_0x4b04cc['attributes']};}):[]};}):[]};}):[]:[]})[_0x4ebe('0xd')](function(_0x40c2ff){logger[_0x4ebe('0xe')](_0x4ebe('0x22'),_0x25c7ec);logger[_0x4ebe('0x11')]('ShowSugarcrmAccount',_0x25c7ec,JSON[_0x4ebe('0x13')](_0x40c2ff));_0x5e4adc(_0x40c2ff);})['catch'](function(_0xa829d6){logger['error'](_0x4ebe('0x22'),_0xa829d6[_0x4ebe('0x15')],_0x25c7ec);_0xdfefd4(_0x4f2127['error'](0x1f4,_0xa829d6['message']));});});}; \ No newline at end of file +var _0x4a21=['SugarcrmAccount','findAll','options','raw','where','attributes','map','model','include','GetSugarcrmAccount','debug','message','find','ShowSugarcrmAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','result','catch'];(function(_0x4670b5,_0x541d69){var _0x1414be=function(_0x107217){while(--_0x107217){_0x4670b5['push'](_0x4670b5['shift']());}};_0x1414be(++_0x541d69);}(_0x4a21,0x80));var _0x14a2=function(_0x484ad6,_0x4efaee){_0x484ad6=_0x484ad6-0x0;var _0x4950d0=_0x4a21[_0x484ad6];return _0x4950d0;};'use strict';var _=require(_0x14a2('0x0'));var util=require(_0x14a2('0x1'));var moment=require(_0x14a2('0x2'));var BPromise=require(_0x14a2('0x3'));var rs=require(_0x14a2('0x4'));var fs=require('fs');var Redis=require(_0x14a2('0x5'));var db=require(_0x14a2('0x6'))['db'];var utils=require(_0x14a2('0x7'));var logger=require(_0x14a2('0x8'))(_0x14a2('0x9'));var config=require(_0x14a2('0xa'));var jayson=require(_0x14a2('0xb'));var client=jayson[_0x14a2('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4bc9f5,_0x8aef2b,_0x375027){return new BPromise(function(_0xbb7b23,_0x56e78f){return client[_0x14a2('0xd')](_0x4bc9f5,_0x375027)[_0x14a2('0xe')](function(_0x490303){logger[_0x14a2('0xf')](_0x14a2('0x10'),_0x8aef2b,_0x14a2('0x11'));logger['debug'](_0x14a2('0x12'),_0x8aef2b,_0x14a2('0x11'),JSON[_0x14a2('0x13')](_0x490303));if(_0x490303[_0x14a2('0x14')]){if(_0x490303['error'][_0x14a2('0x15')]===0x1f4){logger[_0x14a2('0x14')](_0x14a2('0x10'),_0x8aef2b,_0x490303[_0x14a2('0x14')]['message']);return _0x56e78f(_0x490303[_0x14a2('0x14')]['message']);}logger[_0x14a2('0x14')](_0x14a2('0x10'),_0x8aef2b,_0x490303[_0x14a2('0x14')]['message']);return _0xbb7b23(_0x490303[_0x14a2('0x14')]['message']);}else{logger[_0x14a2('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x8aef2b,'request\x20sent');_0xbb7b23(_0x490303[_0x14a2('0x16')]['message']);}})[_0x14a2('0x17')](function(_0x41cfff){logger[_0x14a2('0x14')](_0x14a2('0x10'),_0x8aef2b,_0x41cfff);_0x56e78f(_0x41cfff);});});}exports['GetSugarcrmAccount']=function(_0x3c764c){var _0x3f96a9=this;return new Promise(function(_0x965758,_0x17b12f){return db[_0x14a2('0x18')][_0x14a2('0x19')]({'raw':_0x3c764c['options']?_0x3c764c[_0x14a2('0x1a')][_0x14a2('0x1b')]===undefined?!![]:![]:!![],'where':_0x3c764c[_0x14a2('0x1a')]?_0x3c764c[_0x14a2('0x1a')][_0x14a2('0x1c')]||null:null,'attributes':_0x3c764c[_0x14a2('0x1a')]?_0x3c764c[_0x14a2('0x1a')][_0x14a2('0x1d')]||null:null,'limit':_0x3c764c[_0x14a2('0x1a')]?_0x3c764c[_0x14a2('0x1a')]['limit']||null:null,'include':_0x3c764c[_0x14a2('0x1a')]?_0x3c764c[_0x14a2('0x1a')]['include']?_[_0x14a2('0x1e')](_0x3c764c[_0x14a2('0x1a')]['include'],function(_0x579551){return{'model':db[_0x579551[_0x14a2('0x1f')]],'as':_0x579551['as'],'attributes':_0x579551[_0x14a2('0x1d')],'include':_0x579551[_0x14a2('0x20')]?_['map'](_0x579551['include'],function(_0x6878b6){return{'model':db[_0x6878b6['model']],'as':_0x6878b6['as'],'attributes':_0x6878b6['attributes'],'include':_0x6878b6[_0x14a2('0x20')]?_[_0x14a2('0x1e')](_0x6878b6[_0x14a2('0x20')],function(_0x1b8800){return{'model':db[_0x1b8800['model']],'as':_0x1b8800['as'],'attributes':_0x1b8800[_0x14a2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x14a2('0xe')](function(_0x5e0cc2){logger['info'](_0x14a2('0x21'),_0x3c764c);logger[_0x14a2('0x22')](_0x14a2('0x21'),_0x3c764c,JSON[_0x14a2('0x13')](_0x5e0cc2));_0x965758(_0x5e0cc2);})[_0x14a2('0x17')](function(_0x168e3b){logger[_0x14a2('0x14')](_0x14a2('0x21'),_0x168e3b[_0x14a2('0x23')],_0x3c764c);_0x17b12f(_0x3f96a9['error'](0x1f4,_0x168e3b[_0x14a2('0x23')]));});});};exports['ShowSugarcrmAccount']=function(_0x3a50a4){var _0x5070f5=this;return new Promise(function(_0x37cc3d,_0x8b5338){return db['SugarcrmAccount'][_0x14a2('0x24')]({'raw':_0x3a50a4['options']?_0x3a50a4['options'][_0x14a2('0x1b')]===undefined?!![]:![]:!![],'where':_0x3a50a4[_0x14a2('0x1a')]?_0x3a50a4[_0x14a2('0x1a')][_0x14a2('0x1c')]||null:null,'attributes':_0x3a50a4[_0x14a2('0x1a')]?_0x3a50a4[_0x14a2('0x1a')][_0x14a2('0x1d')]||null:null,'include':_0x3a50a4['options']?_0x3a50a4['options'][_0x14a2('0x20')]?_[_0x14a2('0x1e')](_0x3a50a4['options']['include'],function(_0x3e989a){return{'model':db[_0x3e989a['model']],'as':_0x3e989a['as'],'attributes':_0x3e989a['attributes'],'include':_0x3e989a['include']?_[_0x14a2('0x1e')](_0x3e989a[_0x14a2('0x20')],function(_0x3eb2c0){return{'model':db[_0x3eb2c0['model']],'as':_0x3eb2c0['as'],'attributes':_0x3eb2c0[_0x14a2('0x1d')],'include':_0x3eb2c0[_0x14a2('0x20')]?_[_0x14a2('0x1e')](_0x3eb2c0[_0x14a2('0x20')],function(_0x11a2dc){return{'model':db[_0x11a2dc[_0x14a2('0x1f')]],'as':_0x11a2dc['as'],'attributes':_0x11a2dc[_0x14a2('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x250bb2){logger[_0x14a2('0xf')](_0x14a2('0x25'),_0x3a50a4);logger['debug']('ShowSugarcrmAccount',_0x3a50a4,JSON['stringify'](_0x250bb2));_0x37cc3d(_0x250bb2);})['catch'](function(_0x51f987){logger[_0x14a2('0x14')](_0x14a2('0x25'),_0x51f987[_0x14a2('0x23')],_0x3a50a4);_0x8b5338(_0x5070f5['error'](0x1f4,_0x51f987[_0x14a2('0x23')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 7d9ed94..d17093c 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 _0xd400=['delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','update'];(function(_0x51d4db,_0x10908c){var _0x2e4eaf=function(_0x256caa){while(--_0x256caa){_0x51d4db['push'](_0x51d4db['shift']());}};_0x2e4eaf(++_0x10908c);}(_0xd400,0x15b));var _0x0d40=function(_0x13bea0,_0x210a0c){_0x13bea0=_0x13bea0-0x0;var _0x3f12df=_0xd400[_0x13bea0];return _0x3f12df;};'use strict';var multer=require(_0x0d40('0x0'));var util=require(_0x0d40('0x1'));var path=require(_0x0d40('0x2'));var timeout=require(_0x0d40('0x3'));var express=require(_0x0d40('0x4'));var router=express['Router']();var fs_extra=require(_0x0d40('0x5'));var auth=require(_0x0d40('0x6'));var interaction=require(_0x0d40('0x7'));var config=require(_0x0d40('0x8'));var controller=require(_0x0d40('0x9'));router[_0x0d40('0xa')]('/',auth['isAuthenticated'](),controller[_0x0d40('0xb')]);router['get'](_0x0d40('0xc'),auth[_0x0d40('0xd')](),controller['show']);router[_0x0d40('0xa')](_0x0d40('0xe'),auth[_0x0d40('0xd')](),controller[_0x0d40('0xf')]);router[_0x0d40('0xa')](_0x0d40('0x10'),auth[_0x0d40('0xd')](),controller[_0x0d40('0x11')]);router[_0x0d40('0xa')]('/:id/descriptions',auth[_0x0d40('0xd')](),controller[_0x0d40('0x12')]);router['post']('/',auth[_0x0d40('0xd')](),controller[_0x0d40('0x13')]);router['put'](_0x0d40('0xc'),auth[_0x0d40('0xd')](),controller[_0x0d40('0x14')]);router[_0x0d40('0x15')](_0x0d40('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x0d40('0x16')]=router; \ No newline at end of file +var _0x6e7c=['index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6e7c,0x8e));var _0xc6e7=function(_0x319304,_0x2ddfd5){_0x319304=_0x319304-0x0;var _0x325afd=_0x6e7c[_0x319304];return _0x325afd;};'use strict';var multer=require('multer');var util=require(_0xc6e7('0x0'));var path=require('path');var timeout=require(_0xc6e7('0x1'));var express=require('express');var router=express[_0xc6e7('0x2')]();var fs_extra=require(_0xc6e7('0x3'));var auth=require(_0xc6e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc6e7('0x5'));var controller=require(_0xc6e7('0x6'));router['get']('/',auth[_0xc6e7('0x7')](),controller[_0xc6e7('0x8')]);router[_0xc6e7('0x9')](_0xc6e7('0xa'),auth[_0xc6e7('0x7')](),controller[_0xc6e7('0xb')]);router[_0xc6e7('0x9')](_0xc6e7('0xc'),auth['isAuthenticated'](),controller[_0xc6e7('0xd')]);router[_0xc6e7('0x9')](_0xc6e7('0xe'),auth[_0xc6e7('0x7')](),controller[_0xc6e7('0xf')]);router[_0xc6e7('0x9')](_0xc6e7('0x10'),auth[_0xc6e7('0x7')](),controller[_0xc6e7('0x11')]);router[_0xc6e7('0x12')]('/',auth[_0xc6e7('0x7')](),controller[_0xc6e7('0x13')]);router[_0xc6e7('0x14')]('/:id',auth[_0xc6e7('0x7')](),controller[_0xc6e7('0x15')]);router[_0xc6e7('0x16')](_0xc6e7('0xa'),auth[_0xc6e7('0x7')](),controller[_0xc6e7('0x17')]);module[_0xc6e7('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 5a0f094..996ac09 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 _0x550b=['sequelize','exports','STRING'];(function(_0x31dff4,_0x206ac7){var _0x1a3245=function(_0xe70c42){while(--_0xe70c42){_0x31dff4['push'](_0x31dff4['shift']());}};_0x1a3245(++_0x206ac7);}(_0x550b,0x189));var _0xb550=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x550b[_0x4a7631];return _0x1a5a6f;};'use strict';var Sequelize=require(_0xb550('0x0'));module[_0xb550('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb550('0x2')]}}; \ No newline at end of file +var _0x0b8d=['sequelize','exports','STRING'];(function(_0x3035d7,_0x1e2613){var _0x1f7460=function(_0x515d59){while(--_0x515d59){_0x3035d7['push'](_0x3035d7['shift']());}};_0x1f7460(++_0x1e2613);}(_0x0b8d,0x1b0));var _0xd0b8=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x0b8d[_0x1928c9];return _0x51b5fb;};'use strict';var Sequelize=require(_0xd0b8('0x0'));module[_0xd0b8('0x1')]={'name':{'type':Sequelize[_0xd0b8('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index de56ce5..49dd845 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 _0xab66=['sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','save','destroy','then','error','stack','name','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','update','getFields','findOne','SugarcrmField','nolimit','getSubjects','getDescriptions','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../mysqldb'];(function(_0x4eab24,_0x3caaaa){var _0x5ec681=function(_0x3fa917){while(--_0x3fa917){_0x4eab24['push'](_0x4eab24['shift']());}};_0x5ec681(++_0x3caaaa);}(_0xab66,0x135));var _0x6ab6=function(_0x17ed7f,_0x5af127){_0x17ed7f=_0x17ed7f-0x0;var _0x285e03=_0xab66[_0x17ed7f];return _0x285e03;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6ab6('0x0'));var jsonpatch=require(_0x6ab6('0x1'));var rp=require(_0x6ab6('0x2'));var moment=require(_0x6ab6('0x3'));var BPromise=require(_0x6ab6('0x4'));var Mustache=require(_0x6ab6('0x5'));var util=require(_0x6ab6('0x6'));var path=require('path');var sox=require(_0x6ab6('0x7'));var csv=require(_0x6ab6('0x8'));var ejs=require(_0x6ab6('0x9'));var fs=require('fs');var fs_extra=require(_0x6ab6('0xa'));var _=require(_0x6ab6('0xb'));var squel=require(_0x6ab6('0xc'));var crypto=require(_0x6ab6('0xd'));var jsforce=require(_0x6ab6('0xe'));var deskjs=require(_0x6ab6('0xf'));var toCsv=require(_0x6ab6('0x8'));var querystring=require(_0x6ab6('0x10'));var Papa=require(_0x6ab6('0x11'));var Redis=require('ioredis');var authService=require(_0x6ab6('0x12'));var qs=require(_0x6ab6('0x13'));var as=require(_0x6ab6('0x14'));var hardwareService=require(_0x6ab6('0x15'));var logger=require(_0x6ab6('0x16'))(_0x6ab6('0x17'));var utils=require(_0x6ab6('0x18'));var config=require(_0x6ab6('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x6ab6('0x1a'))['db'];function respondWithStatusCode(_0x53af22,_0x4eb35d){_0x4eb35d=_0x4eb35d||0xcc;return function(_0x1427bc){if(_0x1427bc){return _0x53af22[_0x6ab6('0x1b')](_0x4eb35d);}return _0x53af22[_0x6ab6('0x1c')](_0x4eb35d)[_0x6ab6('0x1d')]();};}function respondWithResult(_0x334527,_0x1ccec2){_0x1ccec2=_0x1ccec2||0xc8;return function(_0x320512){if(_0x320512){return _0x334527['status'](_0x1ccec2)[_0x6ab6('0x1e')](_0x320512);}};}function respondWithFilteredResult(_0x47d917,_0x26b7ae){return function(_0xc500d4){if(_0xc500d4){var _0x308cc7=typeof _0x26b7ae['offset']===_0x6ab6('0x1f')&&typeof _0x26b7ae['limit']===_0x6ab6('0x1f');var _0x2faf27=_0xc500d4[_0x6ab6('0x20')];var _0x56d532=_0x308cc7?0x0:_0x26b7ae[_0x6ab6('0x21')];var _0x1a66f7=_0x308cc7?_0xc500d4[_0x6ab6('0x20')]:_0x26b7ae[_0x6ab6('0x21')]+_0x26b7ae[_0x6ab6('0x22')];var _0x3f88b5;if(_0x1a66f7>=_0x2faf27){_0x1a66f7=_0x2faf27;_0x3f88b5=0xc8;}else{_0x3f88b5=0xce;}_0x47d917[_0x6ab6('0x1c')](_0x3f88b5);return _0x47d917['set'](_0x6ab6('0x23'),_0x56d532+'-'+_0x1a66f7+'/'+_0x2faf27)[_0x6ab6('0x1e')](_0xc500d4);}return null;};}function patchUpdates(_0x27de4f){return function(_0x2037f8){try{jsonpatch[_0x6ab6('0x24')](_0x2037f8,_0x27de4f,!![]);}catch(_0x4ee125){return BPromise['reject'](_0x4ee125);}return _0x2037f8[_0x6ab6('0x25')]();};}function saveUpdates(_0x2d954f,_0x517b34){return function(_0x3b8856){if(_0x3b8856){return _0x3b8856['update'](_0x2d954f)['then'](function(_0x4552c6){return _0x4552c6;});}return null;};}function removeEntity(_0x3f845f,_0x26ecbb){return function(_0x17e950){if(_0x17e950){return _0x17e950[_0x6ab6('0x26')]()[_0x6ab6('0x27')](function(){_0x3f845f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x324c82,_0x496ca8){return function(_0x2ddd06){if(!_0x2ddd06){_0x324c82['sendStatus'](0x194);}return _0x2ddd06;};}function handleError(_0x59ff4a,_0x2ec880){_0x2ec880=_0x2ec880||0x1f4;return function(_0xdbffab){logger[_0x6ab6('0x28')](_0xdbffab[_0x6ab6('0x29')]);if(_0xdbffab[_0x6ab6('0x2a')]){delete _0xdbffab[_0x6ab6('0x2a')];}_0x59ff4a[_0x6ab6('0x1c')](_0x2ec880)['send'](_0xdbffab);};}exports[_0x6ab6('0x2b')]=function(_0x94304c,_0x49e5f9){var _0x3b68d8={},_0x3be55a={},_0x13316d={'count':0x0,'rows':[]};var _0x1949d6=_[_0x6ab6('0x2c')](db[_0x6ab6('0x2d')][_0x6ab6('0x2e')],function(_0x5121b5){return{'name':_0x5121b5[_0x6ab6('0x2f')],'type':_0x5121b5[_0x6ab6('0x30')][_0x6ab6('0x31')]};});_0x3be55a[_0x6ab6('0x32')]=_[_0x6ab6('0x2c')](_0x1949d6,_0x6ab6('0x2a'));_0x3be55a[_0x6ab6('0x33')]=_['keys'](_0x94304c[_0x6ab6('0x33')]);_0x3be55a['filters']=_[_0x6ab6('0x34')](_0x3be55a['model'],_0x3be55a[_0x6ab6('0x33')]);_0x3b68d8[_0x6ab6('0x35')]=_[_0x6ab6('0x34')](_0x3be55a[_0x6ab6('0x32')],qs[_0x6ab6('0x36')](_0x94304c['query'][_0x6ab6('0x36')]));_0x3b68d8[_0x6ab6('0x35')]=_0x3b68d8[_0x6ab6('0x35')]['length']?_0x3b68d8[_0x6ab6('0x35')]:_0x3be55a['model'];if(!_0x94304c['query'][_0x6ab6('0x37')]('nolimit')){_0x3b68d8[_0x6ab6('0x22')]=qs[_0x6ab6('0x22')](_0x94304c[_0x6ab6('0x33')][_0x6ab6('0x22')]);_0x3b68d8[_0x6ab6('0x21')]=qs['offset'](_0x94304c['query'][_0x6ab6('0x21')]);}_0x3b68d8[_0x6ab6('0x38')]=qs['sort'](_0x94304c[_0x6ab6('0x33')][_0x6ab6('0x39')]);_0x3b68d8[_0x6ab6('0x3a')]=qs[_0x6ab6('0x3b')](_[_0x6ab6('0x3c')](_0x94304c[_0x6ab6('0x33')],_0x3be55a['filters']),_0x1949d6);if(_0x94304c[_0x6ab6('0x33')][_0x6ab6('0x3d')]){_0x3b68d8[_0x6ab6('0x3a')]=_['merge'](_0x3b68d8[_0x6ab6('0x3a')],{'$or':_['map'](_0x1949d6,function(_0x30dc43){if(_0x30dc43[_0x6ab6('0x30')]!==_0x6ab6('0x3e')){var _0x28fd65={};_0x28fd65[_0x30dc43['name']]={'$like':'%'+_0x94304c[_0x6ab6('0x33')][_0x6ab6('0x3d')]+'%'};return _0x28fd65;}})});}_0x3b68d8=_[_0x6ab6('0x3f')]({},_0x3b68d8,_0x94304c[_0x6ab6('0x40')]);var _0x6cece7={'where':_0x3b68d8[_0x6ab6('0x3a')]};return db[_0x6ab6('0x2d')]['count'](_0x6cece7)[_0x6ab6('0x27')](function(_0x3d07f4){_0x13316d[_0x6ab6('0x20')]=_0x3d07f4;if(_0x94304c[_0x6ab6('0x33')][_0x6ab6('0x41')]){_0x3b68d8[_0x6ab6('0x42')]=[{'all':!![]}];}return db[_0x6ab6('0x2d')][_0x6ab6('0x43')](_0x3b68d8);})[_0x6ab6('0x27')](function(_0x5d05db){_0x13316d[_0x6ab6('0x44')]=_0x5d05db;return _0x13316d;})[_0x6ab6('0x27')](respondWithFilteredResult(_0x49e5f9,_0x3b68d8))[_0x6ab6('0x45')](handleError(_0x49e5f9,null));};exports[_0x6ab6('0x46')]=function(_0x29154e,_0x5f376f){var _0x16adb8={'raw':![],'where':{'id':_0x29154e[_0x6ab6('0x47')]['id']}},_0x5886dd={};_0x5886dd[_0x6ab6('0x32')]=_[_0x6ab6('0x48')](db[_0x6ab6('0x2d')][_0x6ab6('0x2e')]);_0x5886dd[_0x6ab6('0x33')]=_[_0x6ab6('0x48')](_0x29154e[_0x6ab6('0x33')]);_0x5886dd['filters']=_[_0x6ab6('0x34')](_0x5886dd['model'],_0x5886dd[_0x6ab6('0x33')]);_0x16adb8['attributes']=_[_0x6ab6('0x34')](_0x5886dd['model'],qs[_0x6ab6('0x36')](_0x29154e[_0x6ab6('0x33')][_0x6ab6('0x36')]));_0x16adb8['attributes']=_0x16adb8[_0x6ab6('0x35')][_0x6ab6('0x49')]?_0x16adb8[_0x6ab6('0x35')]:_0x5886dd[_0x6ab6('0x32')];if(_0x29154e[_0x6ab6('0x33')][_0x6ab6('0x41')]){_0x16adb8['include']=[{'all':!![]}];}_0x16adb8=_[_0x6ab6('0x3f')]({},_0x16adb8,_0x29154e[_0x6ab6('0x40')]);return db[_0x6ab6('0x2d')][_0x6ab6('0x4a')](_0x16adb8)[_0x6ab6('0x27')](handleEntityNotFound(_0x5f376f,null))[_0x6ab6('0x27')](respondWithResult(_0x5f376f,null))['catch'](handleError(_0x5f376f,null));};exports[_0x6ab6('0x4b')]=function(_0x129fca,_0x671468){return db[_0x6ab6('0x2d')][_0x6ab6('0x4b')](_0x129fca[_0x6ab6('0x4c')],{})[_0x6ab6('0x27')](respondWithResult(_0x671468,0xc9))[_0x6ab6('0x45')](handleError(_0x671468,null));};exports[_0x6ab6('0x4d')]=function(_0x2487b9,_0x8fd074){if(_0x2487b9[_0x6ab6('0x4c')]['id']){delete _0x2487b9[_0x6ab6('0x4c')]['id'];}return db[_0x6ab6('0x2d')][_0x6ab6('0x4a')]({'where':{'id':_0x2487b9['params']['id']}})['then'](handleEntityNotFound(_0x8fd074,null))['then'](saveUpdates(_0x2487b9[_0x6ab6('0x4c')],null))['then'](respondWithResult(_0x8fd074,null))[_0x6ab6('0x45')](handleError(_0x8fd074,null));};exports['destroy']=function(_0x4ff1aa,_0xedafdf){return db[_0x6ab6('0x2d')][_0x6ab6('0x4a')]({'where':{'id':_0x4ff1aa[_0x6ab6('0x47')]['id']}})[_0x6ab6('0x27')](handleEntityNotFound(_0xedafdf,null))['then'](removeEntity(_0xedafdf,null))[_0x6ab6('0x45')](handleError(_0xedafdf,null));};exports[_0x6ab6('0x4e')]=function(_0x58faae,_0x39c512,_0x490103){var _0x391c2b={};var _0x2e1490={};var _0x596c9f;var _0x72011a;return db['SugarcrmConfiguration'][_0x6ab6('0x4f')]({'where':{'id':_0x58faae[_0x6ab6('0x47')]['id']}})[_0x6ab6('0x27')](handleEntityNotFound(_0x39c512,null))[_0x6ab6('0x27')](function(_0x3df2c8){if(_0x3df2c8){_0x596c9f=_0x3df2c8;_0x2e1490['model']=_['keys'](db[_0x6ab6('0x50')][_0x6ab6('0x2e')]);_0x2e1490['query']=_[_0x6ab6('0x48')](_0x58faae[_0x6ab6('0x33')]);_0x2e1490[_0x6ab6('0x3b')]=_[_0x6ab6('0x34')](_0x2e1490[_0x6ab6('0x32')],_0x2e1490['query']);_0x391c2b['attributes']=_[_0x6ab6('0x34')](_0x2e1490[_0x6ab6('0x32')],qs[_0x6ab6('0x36')](_0x58faae[_0x6ab6('0x33')]['fields']));_0x391c2b['attributes']=_0x391c2b[_0x6ab6('0x35')][_0x6ab6('0x49')]?_0x391c2b[_0x6ab6('0x35')]:_0x2e1490['model'];_0x391c2b['order']=qs[_0x6ab6('0x39')](_0x58faae[_0x6ab6('0x33')][_0x6ab6('0x39')]);_0x391c2b[_0x6ab6('0x3a')]=qs['filters'](_[_0x6ab6('0x3c')](_0x58faae[_0x6ab6('0x33')],_0x2e1490[_0x6ab6('0x3b')]));if(_0x58faae[_0x6ab6('0x33')][_0x6ab6('0x3d')]){_0x391c2b['where']=_[_0x6ab6('0x3f')](_0x391c2b[_0x6ab6('0x3a')],{'$or':_[_0x6ab6('0x2c')](_0x391c2b[_0x6ab6('0x35')],function(_0x58b6ea){var _0x300060={};_0x300060[_0x58b6ea]={'$like':'%'+_0x58faae[_0x6ab6('0x33')][_0x6ab6('0x3d')]+'%'};return _0x300060;})});}_0x391c2b=_[_0x6ab6('0x3f')]({},_0x391c2b,_0x58faae[_0x6ab6('0x40')]);return _0x596c9f[_0x6ab6('0x4e')](_0x391c2b);}})[_0x6ab6('0x27')](function(_0x1c7ba0){if(_0x1c7ba0){_0x72011a=_0x1c7ba0[_0x6ab6('0x49')];if(!_0x58faae[_0x6ab6('0x33')][_0x6ab6('0x37')](_0x6ab6('0x51'))){_0x391c2b[_0x6ab6('0x22')]=qs[_0x6ab6('0x22')](_0x58faae[_0x6ab6('0x33')][_0x6ab6('0x22')]);_0x391c2b[_0x6ab6('0x21')]=qs[_0x6ab6('0x21')](_0x58faae[_0x6ab6('0x33')][_0x6ab6('0x21')]);}return _0x596c9f[_0x6ab6('0x4e')](_0x391c2b);}})[_0x6ab6('0x27')](function(_0x358ccb){if(_0x358ccb){return _0x358ccb?{'count':_0x72011a,'rows':_0x358ccb}:null;}})[_0x6ab6('0x27')](respondWithResult(_0x39c512,null))['catch'](handleError(_0x39c512,null));};exports[_0x6ab6('0x52')]=function(_0x4240c9,_0xc1ff45,_0x385be3){var _0x5e7091={};var _0x17495c={};var _0x18e566;var _0x2766c2;return db['SugarcrmConfiguration'][_0x6ab6('0x4f')]({'where':{'id':_0x4240c9[_0x6ab6('0x47')]['id']}})[_0x6ab6('0x27')](handleEntityNotFound(_0xc1ff45,null))[_0x6ab6('0x27')](function(_0x1f4753){if(_0x1f4753){_0x18e566=_0x1f4753;_0x17495c['model']=_[_0x6ab6('0x48')](db[_0x6ab6('0x50')]['rawAttributes']);_0x17495c[_0x6ab6('0x33')]=_[_0x6ab6('0x48')](_0x4240c9['query']);_0x17495c[_0x6ab6('0x3b')]=_[_0x6ab6('0x34')](_0x17495c[_0x6ab6('0x32')],_0x17495c[_0x6ab6('0x33')]);_0x5e7091['attributes']=_[_0x6ab6('0x34')](_0x17495c['model'],qs[_0x6ab6('0x36')](_0x4240c9['query'][_0x6ab6('0x36')]));_0x5e7091[_0x6ab6('0x35')]=_0x5e7091[_0x6ab6('0x35')][_0x6ab6('0x49')]?_0x5e7091[_0x6ab6('0x35')]:_0x17495c[_0x6ab6('0x32')];_0x5e7091['order']=qs['sort'](_0x4240c9[_0x6ab6('0x33')][_0x6ab6('0x39')]);_0x5e7091[_0x6ab6('0x3a')]=qs['filters'](_[_0x6ab6('0x3c')](_0x4240c9['query'],_0x17495c[_0x6ab6('0x3b')]));if(_0x4240c9[_0x6ab6('0x33')][_0x6ab6('0x3d')]){_0x5e7091[_0x6ab6('0x3a')]=_[_0x6ab6('0x3f')](_0x5e7091[_0x6ab6('0x3a')],{'$or':_['map'](_0x5e7091['attributes'],function(_0x16ea37){var _0x3776ff={};_0x3776ff[_0x16ea37]={'$like':'%'+_0x4240c9['query'][_0x6ab6('0x3d')]+'%'};return _0x3776ff;})});}_0x5e7091=_[_0x6ab6('0x3f')]({},_0x5e7091,_0x4240c9['options']);return _0x18e566['getSubjects'](_0x5e7091);}})['then'](function(_0x5f50d1){if(_0x5f50d1){_0x2766c2=_0x5f50d1['length'];if(!_0x4240c9[_0x6ab6('0x33')][_0x6ab6('0x37')](_0x6ab6('0x51'))){_0x5e7091[_0x6ab6('0x22')]=qs['limit'](_0x4240c9[_0x6ab6('0x33')][_0x6ab6('0x22')]);_0x5e7091['offset']=qs[_0x6ab6('0x21')](_0x4240c9[_0x6ab6('0x33')]['offset']);}return _0x18e566[_0x6ab6('0x52')](_0x5e7091);}})[_0x6ab6('0x27')](function(_0xce1987){if(_0xce1987){return _0xce1987?{'count':_0x2766c2,'rows':_0xce1987}:null;}})[_0x6ab6('0x27')](respondWithResult(_0xc1ff45,null))['catch'](handleError(_0xc1ff45,null));};exports[_0x6ab6('0x53')]=function(_0x5866a4,_0x53162c,_0xe0661d){var _0x5395a7={};var _0x1a188e={};var _0x550b96;var _0x19eae7;return db[_0x6ab6('0x2d')][_0x6ab6('0x4f')]({'where':{'id':_0x5866a4[_0x6ab6('0x47')]['id']}})[_0x6ab6('0x27')](handleEntityNotFound(_0x53162c,null))[_0x6ab6('0x27')](function(_0x28f3c5){if(_0x28f3c5){_0x550b96=_0x28f3c5;_0x1a188e[_0x6ab6('0x32')]=_[_0x6ab6('0x48')](db[_0x6ab6('0x50')][_0x6ab6('0x2e')]);_0x1a188e[_0x6ab6('0x33')]=_[_0x6ab6('0x48')](_0x5866a4[_0x6ab6('0x33')]);_0x1a188e[_0x6ab6('0x3b')]=_['intersection'](_0x1a188e['model'],_0x1a188e[_0x6ab6('0x33')]);_0x5395a7['attributes']=_[_0x6ab6('0x34')](_0x1a188e[_0x6ab6('0x32')],qs[_0x6ab6('0x36')](_0x5866a4[_0x6ab6('0x33')][_0x6ab6('0x36')]));_0x5395a7[_0x6ab6('0x35')]=_0x5395a7[_0x6ab6('0x35')][_0x6ab6('0x49')]?_0x5395a7[_0x6ab6('0x35')]:_0x1a188e[_0x6ab6('0x32')];_0x5395a7[_0x6ab6('0x38')]=qs[_0x6ab6('0x39')](_0x5866a4['query'][_0x6ab6('0x39')]);_0x5395a7[_0x6ab6('0x3a')]=qs[_0x6ab6('0x3b')](_['pick'](_0x5866a4[_0x6ab6('0x33')],_0x1a188e[_0x6ab6('0x3b')]));if(_0x5866a4[_0x6ab6('0x33')][_0x6ab6('0x3d')]){_0x5395a7[_0x6ab6('0x3a')]=_[_0x6ab6('0x3f')](_0x5395a7[_0x6ab6('0x3a')],{'$or':_[_0x6ab6('0x2c')](_0x5395a7[_0x6ab6('0x35')],function(_0x309d0a){var _0x591a43={};_0x591a43[_0x309d0a]={'$like':'%'+_0x5866a4[_0x6ab6('0x33')][_0x6ab6('0x3d')]+'%'};return _0x591a43;})});}_0x5395a7=_[_0x6ab6('0x3f')]({},_0x5395a7,_0x5866a4['options']);return _0x550b96['getDescriptions'](_0x5395a7);}})['then'](function(_0x3814ce){if(_0x3814ce){_0x19eae7=_0x3814ce[_0x6ab6('0x49')];if(!_0x5866a4[_0x6ab6('0x33')]['hasOwnProperty'](_0x6ab6('0x51'))){_0x5395a7[_0x6ab6('0x22')]=qs[_0x6ab6('0x22')](_0x5866a4[_0x6ab6('0x33')][_0x6ab6('0x22')]);_0x5395a7[_0x6ab6('0x21')]=qs['offset'](_0x5866a4[_0x6ab6('0x33')][_0x6ab6('0x21')]);}return _0x550b96[_0x6ab6('0x53')](_0x5395a7);}})['then'](function(_0x3581e1){if(_0x3581e1){return _0x3581e1?{'count':_0x19eae7,'rows':_0x3581e1}:null;}})[_0x6ab6('0x27')](respondWithResult(_0x53162c,null))[_0x6ab6('0x45')](handleError(_0x53162c,null));}; \ No newline at end of file +var _0x0b3c=['limit','count','set','Content-Range','apply','reject','update','destroy','then','end','name','index','map','SugarcrmConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','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','sendStatus','status','json','offset','undefined'];(function(_0x31445b,_0x4bd23e){var _0xa0eae4=function(_0x3d9baa){while(--_0x3d9baa){_0x31445b['push'](_0x31445b['shift']());}};_0xa0eae4(++_0x4bd23e);}(_0x0b3c,0x84));var _0xc0b3=function(_0x491091,_0x5220bd){_0x491091=_0x491091-0x0;var _0x37eb35=_0x0b3c[_0x491091];return _0x37eb35;};'use strict';var emlformat=require(_0xc0b3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc0b3('0x1'));var jsonpatch=require(_0xc0b3('0x2'));var rp=require('request-promise');var moment=require(_0xc0b3('0x3'));var BPromise=require(_0xc0b3('0x4'));var Mustache=require(_0xc0b3('0x5'));var util=require(_0xc0b3('0x6'));var path=require(_0xc0b3('0x7'));var sox=require(_0xc0b3('0x8'));var csv=require(_0xc0b3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc0b3('0xa'));var _=require(_0xc0b3('0xb'));var squel=require(_0xc0b3('0xc'));var crypto=require(_0xc0b3('0xd'));var jsforce=require(_0xc0b3('0xe'));var deskjs=require(_0xc0b3('0xf'));var toCsv=require(_0xc0b3('0x9'));var querystring=require(_0xc0b3('0x10'));var Papa=require(_0xc0b3('0x11'));var Redis=require('ioredis');var authService=require(_0xc0b3('0x12'));var qs=require(_0xc0b3('0x13'));var as=require(_0xc0b3('0x14'));var hardwareService=require(_0xc0b3('0x15'));var logger=require(_0xc0b3('0x16'))(_0xc0b3('0x17'));var utils=require(_0xc0b3('0x18'));var config=require(_0xc0b3('0x19'));var licenseUtil=require(_0xc0b3('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f5dd7,_0x2cce53){_0x2cce53=_0x2cce53||0xcc;return function(_0x21e846){if(_0x21e846){return _0x2f5dd7[_0xc0b3('0x1b')](_0x2cce53);}return _0x2f5dd7[_0xc0b3('0x1c')](_0x2cce53)['end']();};}function respondWithResult(_0x55b607,_0x48bd54){_0x48bd54=_0x48bd54||0xc8;return function(_0x2431d2){if(_0x2431d2){return _0x55b607[_0xc0b3('0x1c')](_0x48bd54)[_0xc0b3('0x1d')](_0x2431d2);}};}function respondWithFilteredResult(_0x509400,_0x1e82a6){return function(_0x3ccb0d){if(_0x3ccb0d){var _0x564626=typeof _0x1e82a6[_0xc0b3('0x1e')]===_0xc0b3('0x1f')&&typeof _0x1e82a6[_0xc0b3('0x20')]===_0xc0b3('0x1f');var _0x34078d=_0x3ccb0d[_0xc0b3('0x21')];var _0x4c7dcc=_0x564626?0x0:_0x1e82a6[_0xc0b3('0x1e')];var _0x4b2937=_0x564626?_0x3ccb0d[_0xc0b3('0x21')]:_0x1e82a6[_0xc0b3('0x1e')]+_0x1e82a6['limit'];var _0x18bc0b;if(_0x4b2937>=_0x34078d){_0x4b2937=_0x34078d;_0x18bc0b=0xc8;}else{_0x18bc0b=0xce;}_0x509400[_0xc0b3('0x1c')](_0x18bc0b);return _0x509400[_0xc0b3('0x22')](_0xc0b3('0x23'),_0x4c7dcc+'-'+_0x4b2937+'/'+_0x34078d)[_0xc0b3('0x1d')](_0x3ccb0d);}return null;};}function patchUpdates(_0x2b2b1f){return function(_0x26103e){try{jsonpatch[_0xc0b3('0x24')](_0x26103e,_0x2b2b1f,!![]);}catch(_0x3a346a){return BPromise[_0xc0b3('0x25')](_0x3a346a);}return _0x26103e['save']();};}function saveUpdates(_0x4f22e9,_0x4a5b64){return function(_0x48c182){if(_0x48c182){return _0x48c182[_0xc0b3('0x26')](_0x4f22e9)['then'](function(_0x41d129){return _0x41d129;});}return null;};}function removeEntity(_0x2a0793,_0x5d54b2){return function(_0x5c21b4){if(_0x5c21b4){return _0x5c21b4[_0xc0b3('0x27')]()[_0xc0b3('0x28')](function(){_0x2a0793[_0xc0b3('0x1c')](0xcc)[_0xc0b3('0x29')]();});}};}function handleEntityNotFound(_0x468cbc,_0x33733d){return function(_0x21a752){if(!_0x21a752){_0x468cbc['sendStatus'](0x194);}return _0x21a752;};}function handleError(_0x3e0a0b,_0x4bf68a){_0x4bf68a=_0x4bf68a||0x1f4;return function(_0x453f84){logger['error'](_0x453f84['stack']);if(_0x453f84[_0xc0b3('0x2a')]){delete _0x453f84[_0xc0b3('0x2a')];}_0x3e0a0b['status'](_0x4bf68a)['send'](_0x453f84);};}exports[_0xc0b3('0x2b')]=function(_0x1d30a6,_0x339e93){var _0x50a1a8={},_0x139332={},_0x35ab17={'count':0x0,'rows':[]};var _0x2d40f7=_[_0xc0b3('0x2c')](db[_0xc0b3('0x2d')][_0xc0b3('0x2e')],function(_0x117499){return{'name':_0x117499[_0xc0b3('0x2f')],'type':_0x117499['type'][_0xc0b3('0x30')]};});_0x139332[_0xc0b3('0x31')]=_['map'](_0x2d40f7,_0xc0b3('0x2a'));_0x139332[_0xc0b3('0x32')]=_[_0xc0b3('0x33')](_0x1d30a6[_0xc0b3('0x32')]);_0x139332[_0xc0b3('0x34')]=_[_0xc0b3('0x35')](_0x139332[_0xc0b3('0x31')],_0x139332['query']);_0x50a1a8['attributes']=_[_0xc0b3('0x35')](_0x139332[_0xc0b3('0x31')],qs[_0xc0b3('0x36')](_0x1d30a6['query'][_0xc0b3('0x36')]));_0x50a1a8[_0xc0b3('0x37')]=_0x50a1a8[_0xc0b3('0x37')][_0xc0b3('0x38')]?_0x50a1a8[_0xc0b3('0x37')]:_0x139332[_0xc0b3('0x31')];if(!_0x1d30a6['query'][_0xc0b3('0x39')](_0xc0b3('0x3a'))){_0x50a1a8[_0xc0b3('0x20')]=qs[_0xc0b3('0x20')](_0x1d30a6[_0xc0b3('0x32')][_0xc0b3('0x20')]);_0x50a1a8[_0xc0b3('0x1e')]=qs['offset'](_0x1d30a6[_0xc0b3('0x32')][_0xc0b3('0x1e')]);}_0x50a1a8['order']=qs['sort'](_0x1d30a6[_0xc0b3('0x32')][_0xc0b3('0x3b')]);_0x50a1a8[_0xc0b3('0x3c')]=qs[_0xc0b3('0x34')](_[_0xc0b3('0x3d')](_0x1d30a6[_0xc0b3('0x32')],_0x139332[_0xc0b3('0x34')]),_0x2d40f7);if(_0x1d30a6[_0xc0b3('0x32')][_0xc0b3('0x3e')]){_0x50a1a8[_0xc0b3('0x3c')]=_[_0xc0b3('0x3f')](_0x50a1a8[_0xc0b3('0x3c')],{'$or':_['map'](_0x2d40f7,function(_0x58f5eb){if(_0x58f5eb[_0xc0b3('0x40')]!==_0xc0b3('0x41')){var _0x3cd318={};_0x3cd318[_0x58f5eb['name']]={'$like':'%'+_0x1d30a6[_0xc0b3('0x32')]['filter']+'%'};return _0x3cd318;}})});}_0x50a1a8=_[_0xc0b3('0x3f')]({},_0x50a1a8,_0x1d30a6[_0xc0b3('0x42')]);var _0x20af6a={'where':_0x50a1a8[_0xc0b3('0x3c')]};return db['SugarcrmConfiguration']['count'](_0x20af6a)[_0xc0b3('0x28')](function(_0x574732){_0x35ab17['count']=_0x574732;if(_0x1d30a6['query'][_0xc0b3('0x43')]){_0x50a1a8[_0xc0b3('0x44')]=[{'all':!![]}];}return db[_0xc0b3('0x2d')][_0xc0b3('0x45')](_0x50a1a8);})[_0xc0b3('0x28')](function(_0x126fe5){_0x35ab17[_0xc0b3('0x46')]=_0x126fe5;return _0x35ab17;})['then'](respondWithFilteredResult(_0x339e93,_0x50a1a8))[_0xc0b3('0x47')](handleError(_0x339e93,null));};exports[_0xc0b3('0x48')]=function(_0x4af0ce,_0x3380b0){var _0x4c2bce={'raw':![],'where':{'id':_0x4af0ce[_0xc0b3('0x49')]['id']}},_0x3c5ab3={};_0x3c5ab3[_0xc0b3('0x31')]=_[_0xc0b3('0x33')](db[_0xc0b3('0x2d')]['rawAttributes']);_0x3c5ab3['query']=_[_0xc0b3('0x33')](_0x4af0ce[_0xc0b3('0x32')]);_0x3c5ab3['filters']=_[_0xc0b3('0x35')](_0x3c5ab3[_0xc0b3('0x31')],_0x3c5ab3[_0xc0b3('0x32')]);_0x4c2bce[_0xc0b3('0x37')]=_[_0xc0b3('0x35')](_0x3c5ab3[_0xc0b3('0x31')],qs[_0xc0b3('0x36')](_0x4af0ce[_0xc0b3('0x32')][_0xc0b3('0x36')]));_0x4c2bce[_0xc0b3('0x37')]=_0x4c2bce['attributes'][_0xc0b3('0x38')]?_0x4c2bce[_0xc0b3('0x37')]:_0x3c5ab3['model'];if(_0x4af0ce['query'][_0xc0b3('0x43')]){_0x4c2bce['include']=[{'all':!![]}];}_0x4c2bce=_[_0xc0b3('0x3f')]({},_0x4c2bce,_0x4af0ce[_0xc0b3('0x42')]);return db['SugarcrmConfiguration'][_0xc0b3('0x4a')](_0x4c2bce)[_0xc0b3('0x28')](handleEntityNotFound(_0x3380b0,null))[_0xc0b3('0x28')](respondWithResult(_0x3380b0,null))[_0xc0b3('0x47')](handleError(_0x3380b0,null));};exports[_0xc0b3('0x4b')]=function(_0x37f82d,_0x5ec01c){return db['SugarcrmConfiguration'][_0xc0b3('0x4b')](_0x37f82d[_0xc0b3('0x4c')],{})[_0xc0b3('0x28')](respondWithResult(_0x5ec01c,0xc9))['catch'](handleError(_0x5ec01c,null));};exports['update']=function(_0x3171e8,_0x26021c){if(_0x3171e8[_0xc0b3('0x4c')]['id']){delete _0x3171e8[_0xc0b3('0x4c')]['id'];}return db[_0xc0b3('0x2d')]['find']({'where':{'id':_0x3171e8[_0xc0b3('0x49')]['id']}})[_0xc0b3('0x28')](handleEntityNotFound(_0x26021c,null))['then'](saveUpdates(_0x3171e8['body'],null))[_0xc0b3('0x28')](respondWithResult(_0x26021c,null))[_0xc0b3('0x47')](handleError(_0x26021c,null));};exports[_0xc0b3('0x27')]=function(_0x3181af,_0x2fe1de){return db[_0xc0b3('0x2d')][_0xc0b3('0x4a')]({'where':{'id':_0x3181af[_0xc0b3('0x49')]['id']}})[_0xc0b3('0x28')](handleEntityNotFound(_0x2fe1de,null))[_0xc0b3('0x28')](removeEntity(_0x2fe1de,null))[_0xc0b3('0x47')](handleError(_0x2fe1de,null));};exports[_0xc0b3('0x4d')]=function(_0x13ede7,_0x2e37d8,_0x163dd5){var _0x1cb0a1={};var _0x311cb2={};var _0x35ed42;var _0x2ad5ea;return db[_0xc0b3('0x2d')][_0xc0b3('0x4e')]({'where':{'id':_0x13ede7[_0xc0b3('0x49')]['id']}})[_0xc0b3('0x28')](handleEntityNotFound(_0x2e37d8,null))[_0xc0b3('0x28')](function(_0x16fec7){if(_0x16fec7){_0x35ed42=_0x16fec7;_0x311cb2['model']=_['keys'](db[_0xc0b3('0x4f')][_0xc0b3('0x2e')]);_0x311cb2['query']=_[_0xc0b3('0x33')](_0x13ede7['query']);_0x311cb2[_0xc0b3('0x34')]=_[_0xc0b3('0x35')](_0x311cb2[_0xc0b3('0x31')],_0x311cb2[_0xc0b3('0x32')]);_0x1cb0a1[_0xc0b3('0x37')]=_[_0xc0b3('0x35')](_0x311cb2[_0xc0b3('0x31')],qs['fields'](_0x13ede7['query'][_0xc0b3('0x36')]));_0x1cb0a1[_0xc0b3('0x37')]=_0x1cb0a1[_0xc0b3('0x37')][_0xc0b3('0x38')]?_0x1cb0a1[_0xc0b3('0x37')]:_0x311cb2[_0xc0b3('0x31')];_0x1cb0a1['order']=qs[_0xc0b3('0x3b')](_0x13ede7[_0xc0b3('0x32')]['sort']);_0x1cb0a1['where']=qs['filters'](_[_0xc0b3('0x3d')](_0x13ede7[_0xc0b3('0x32')],_0x311cb2[_0xc0b3('0x34')]));if(_0x13ede7['query'][_0xc0b3('0x3e')]){_0x1cb0a1[_0xc0b3('0x3c')]=_[_0xc0b3('0x3f')](_0x1cb0a1[_0xc0b3('0x3c')],{'$or':_[_0xc0b3('0x2c')](_0x1cb0a1[_0xc0b3('0x37')],function(_0x47ae86){var _0x455560={};_0x455560[_0x47ae86]={'$like':'%'+_0x13ede7[_0xc0b3('0x32')][_0xc0b3('0x3e')]+'%'};return _0x455560;})});}_0x1cb0a1=_['merge']({},_0x1cb0a1,_0x13ede7[_0xc0b3('0x42')]);return _0x35ed42['getFields'](_0x1cb0a1);}})[_0xc0b3('0x28')](function(_0x107b9f){if(_0x107b9f){_0x2ad5ea=_0x107b9f[_0xc0b3('0x38')];if(!_0x13ede7[_0xc0b3('0x32')][_0xc0b3('0x39')]('nolimit')){_0x1cb0a1[_0xc0b3('0x20')]=qs[_0xc0b3('0x20')](_0x13ede7[_0xc0b3('0x32')]['limit']);_0x1cb0a1['offset']=qs[_0xc0b3('0x1e')](_0x13ede7['query'][_0xc0b3('0x1e')]);}return _0x35ed42[_0xc0b3('0x4d')](_0x1cb0a1);}})[_0xc0b3('0x28')](function(_0x3aa727){if(_0x3aa727){return _0x3aa727?{'count':_0x2ad5ea,'rows':_0x3aa727}:null;}})['then'](respondWithResult(_0x2e37d8,null))[_0xc0b3('0x47')](handleError(_0x2e37d8,null));};exports[_0xc0b3('0x50')]=function(_0x526cc5,_0x3e12e1,_0x4bbd86){var _0x3270e8={};var _0x477ff9={};var _0x17e525;var _0x526b23;return db[_0xc0b3('0x2d')][_0xc0b3('0x4e')]({'where':{'id':_0x526cc5[_0xc0b3('0x49')]['id']}})['then'](handleEntityNotFound(_0x3e12e1,null))['then'](function(_0x570c4e){if(_0x570c4e){_0x17e525=_0x570c4e;_0x477ff9['model']=_['keys'](db['SugarcrmField'][_0xc0b3('0x2e')]);_0x477ff9[_0xc0b3('0x32')]=_[_0xc0b3('0x33')](_0x526cc5[_0xc0b3('0x32')]);_0x477ff9[_0xc0b3('0x34')]=_[_0xc0b3('0x35')](_0x477ff9[_0xc0b3('0x31')],_0x477ff9[_0xc0b3('0x32')]);_0x3270e8[_0xc0b3('0x37')]=_[_0xc0b3('0x35')](_0x477ff9[_0xc0b3('0x31')],qs[_0xc0b3('0x36')](_0x526cc5['query'][_0xc0b3('0x36')]));_0x3270e8[_0xc0b3('0x37')]=_0x3270e8[_0xc0b3('0x37')][_0xc0b3('0x38')]?_0x3270e8[_0xc0b3('0x37')]:_0x477ff9['model'];_0x3270e8['order']=qs['sort'](_0x526cc5[_0xc0b3('0x32')][_0xc0b3('0x3b')]);_0x3270e8[_0xc0b3('0x3c')]=qs[_0xc0b3('0x34')](_[_0xc0b3('0x3d')](_0x526cc5[_0xc0b3('0x32')],_0x477ff9['filters']));if(_0x526cc5[_0xc0b3('0x32')][_0xc0b3('0x3e')]){_0x3270e8['where']=_[_0xc0b3('0x3f')](_0x3270e8[_0xc0b3('0x3c')],{'$or':_[_0xc0b3('0x2c')](_0x3270e8[_0xc0b3('0x37')],function(_0x2020fd){var _0x55a82d={};_0x55a82d[_0x2020fd]={'$like':'%'+_0x526cc5[_0xc0b3('0x32')][_0xc0b3('0x3e')]+'%'};return _0x55a82d;})});}_0x3270e8=_[_0xc0b3('0x3f')]({},_0x3270e8,_0x526cc5[_0xc0b3('0x42')]);return _0x17e525[_0xc0b3('0x50')](_0x3270e8);}})['then'](function(_0x2af9a6){if(_0x2af9a6){_0x526b23=_0x2af9a6['length'];if(!_0x526cc5['query']['hasOwnProperty'](_0xc0b3('0x3a'))){_0x3270e8[_0xc0b3('0x20')]=qs['limit'](_0x526cc5[_0xc0b3('0x32')]['limit']);_0x3270e8['offset']=qs[_0xc0b3('0x1e')](_0x526cc5[_0xc0b3('0x32')][_0xc0b3('0x1e')]);}return _0x17e525['getSubjects'](_0x3270e8);}})['then'](function(_0xe583f7){if(_0xe583f7){return _0xe583f7?{'count':_0x526b23,'rows':_0xe583f7}:null;}})['then'](respondWithResult(_0x3e12e1,null))[_0xc0b3('0x47')](handleError(_0x3e12e1,null));};exports[_0xc0b3('0x51')]=function(_0x521167,_0x5c6734,_0x50d5de){var _0x24bc70={};var _0x4a62ff={};var _0x38d580;var _0x1a9df8;return db[_0xc0b3('0x2d')][_0xc0b3('0x4e')]({'where':{'id':_0x521167[_0xc0b3('0x49')]['id']}})[_0xc0b3('0x28')](handleEntityNotFound(_0x5c6734,null))['then'](function(_0x82ee62){if(_0x82ee62){_0x38d580=_0x82ee62;_0x4a62ff[_0xc0b3('0x31')]=_['keys'](db[_0xc0b3('0x4f')][_0xc0b3('0x2e')]);_0x4a62ff['query']=_[_0xc0b3('0x33')](_0x521167[_0xc0b3('0x32')]);_0x4a62ff[_0xc0b3('0x34')]=_[_0xc0b3('0x35')](_0x4a62ff[_0xc0b3('0x31')],_0x4a62ff['query']);_0x24bc70[_0xc0b3('0x37')]=_['intersection'](_0x4a62ff[_0xc0b3('0x31')],qs[_0xc0b3('0x36')](_0x521167[_0xc0b3('0x32')][_0xc0b3('0x36')]));_0x24bc70['attributes']=_0x24bc70[_0xc0b3('0x37')]['length']?_0x24bc70[_0xc0b3('0x37')]:_0x4a62ff[_0xc0b3('0x31')];_0x24bc70['order']=qs[_0xc0b3('0x3b')](_0x521167[_0xc0b3('0x32')]['sort']);_0x24bc70['where']=qs[_0xc0b3('0x34')](_['pick'](_0x521167['query'],_0x4a62ff[_0xc0b3('0x34')]));if(_0x521167['query'][_0xc0b3('0x3e')]){_0x24bc70['where']=_[_0xc0b3('0x3f')](_0x24bc70['where'],{'$or':_[_0xc0b3('0x2c')](_0x24bc70[_0xc0b3('0x37')],function(_0x17f095){var _0x1d3b9c={};_0x1d3b9c[_0x17f095]={'$like':'%'+_0x521167[_0xc0b3('0x32')][_0xc0b3('0x3e')]+'%'};return _0x1d3b9c;})});}_0x24bc70=_['merge']({},_0x24bc70,_0x521167['options']);return _0x38d580[_0xc0b3('0x51')](_0x24bc70);}})[_0xc0b3('0x28')](function(_0xa7fb97){if(_0xa7fb97){_0x1a9df8=_0xa7fb97[_0xc0b3('0x38')];if(!_0x521167[_0xc0b3('0x32')][_0xc0b3('0x39')](_0xc0b3('0x3a'))){_0x24bc70[_0xc0b3('0x20')]=qs[_0xc0b3('0x20')](_0x521167[_0xc0b3('0x32')][_0xc0b3('0x20')]);_0x24bc70[_0xc0b3('0x1e')]=qs[_0xc0b3('0x1e')](_0x521167[_0xc0b3('0x32')][_0xc0b3('0x1e')]);}return _0x38d580[_0xc0b3('0x51')](_0x24bc70);}})[_0xc0b3('0x28')](function(_0x3f7149){if(_0x3f7149){return _0x3f7149?{'count':_0x1a9df8,'rows':_0x3f7149}:null;}})[_0xc0b3('0x28')](respondWithResult(_0x5c6734,null))['catch'](handleError(_0x5c6734,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index d6f9df7..953a108 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 _0xbe98=['lodash','util','api','bluebird','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations'];(function(_0x1536af,_0x4225d3){var _0x5482ee=function(_0x4a6a7c){while(--_0x4a6a7c){_0x1536af['push'](_0x1536af['shift']());}};_0x5482ee(++_0x4225d3);}(_0xbe98,0x174));var _0x8be9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbe98[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8be9('0x0'));var util=require(_0x8be9('0x1'));var logger=require('../../config/logger')(_0x8be9('0x2'));var moment=require('moment');var BPromise=require(_0x8be9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8be9('0x4'));var rimraf=require(_0x8be9('0x5'));var config=require(_0x8be9('0x6'));var attributes=require(_0x8be9('0x7'));module[_0x8be9('0x8')]=function(_0x5a4148,_0x4636bf){return _0x5a4148[_0x8be9('0x9')](_0x8be9('0xa'),attributes,{'tableName':_0x8be9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7870=['request-promise','path','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x4d5645,_0x3cb8a5){var _0x2c5bd3=function(_0xbe99bc){while(--_0xbe99bc){_0x4d5645['push'](_0x4d5645['shift']());}};_0x2c5bd3(++_0x3cb8a5);}(_0x7870,0x15b));var _0x0787=function(_0x11c38a,_0x128af5){_0x11c38a=_0x11c38a-0x0;var _0x3432bb=_0x7870[_0x11c38a];return _0x3432bb;};'use strict';var _=require(_0x0787('0x0'));var util=require(_0x0787('0x1'));var logger=require(_0x0787('0x2'))(_0x0787('0x3'));var moment=require(_0x0787('0x4'));var BPromise=require('bluebird');var rp=require(_0x0787('0x5'));var fs=require('fs');var path=require(_0x0787('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0787('0x7'));module['exports']=function(_0x504d04,_0x5e3f18){return _0x504d04[_0x0787('0x8')](_0x0787('0x9'),attributes,{'tableName':_0x0787('0xa'),'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 099e410..f9fe154 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 _0x65a7=['request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0x110f37,_0x26d87c){var _0x3bc183=function(_0x576f30){while(--_0x576f30){_0x110f37['push'](_0x110f37['shift']());}};_0x3bc183(++_0x26d87c);}(_0x65a7,0x8b));var _0x765a=function(_0x14f1d2,_0x6d19b1){_0x14f1d2=_0x14f1d2-0x0;var _0x35a261=_0x65a7[_0x14f1d2];return _0x35a261;};'use strict';var _=require(_0x765a('0x0'));var util=require(_0x765a('0x1'));var moment=require(_0x765a('0x2'));var BPromise=require('bluebird');var rs=require(_0x765a('0x3'));var fs=require('fs');var Redis=require(_0x765a('0x4'));var db=require(_0x765a('0x5'))['db'];var utils=require(_0x765a('0x6'));var logger=require(_0x765a('0x7'))(_0x765a('0x8'));var config=require(_0x765a('0x9'));var jayson=require(_0x765a('0xa'));var client=jayson[_0x765a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3820bd,_0x5d5229,_0x5702b0){return new BPromise(function(_0x167fe8,_0x4d6ae6){return client['request'](_0x3820bd,_0x5702b0)[_0x765a('0xc')](function(_0x30e985){logger[_0x765a('0xd')](_0x765a('0xe'),_0x5d5229,_0x765a('0xf'));logger[_0x765a('0x10')](_0x765a('0x11'),_0x5d5229,'request\x20sent',JSON['stringify'](_0x30e985));if(_0x30e985[_0x765a('0x12')]){if(_0x30e985[_0x765a('0x12')]['code']===0x1f4){logger[_0x765a('0x12')](_0x765a('0xe'),_0x5d5229,_0x30e985[_0x765a('0x12')][_0x765a('0x13')]);return _0x4d6ae6(_0x30e985[_0x765a('0x12')][_0x765a('0x13')]);}logger[_0x765a('0x12')](_0x765a('0xe'),_0x5d5229,_0x30e985[_0x765a('0x12')][_0x765a('0x13')]);return _0x167fe8(_0x30e985['error']['message']);}else{logger['info'](_0x765a('0xe'),_0x5d5229,'request\x20sent');_0x167fe8(_0x30e985[_0x765a('0x14')]['message']);}})[_0x765a('0x15')](function(_0x4402b7){logger[_0x765a('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5d5229,_0x4402b7);_0x4d6ae6(_0x4402b7);});});} \ No newline at end of file +var _0xef21=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x172c61,_0x58a8e5){var _0x4355c7=function(_0xa7f63f){while(--_0xa7f63f){_0x172c61['push'](_0x172c61['shift']());}};_0x4355c7(++_0x58a8e5);}(_0xef21,0x157));var _0x1ef2=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0xef21[_0x39c734];return _0xb2a2f9;};'use strict';var _=require(_0x1ef2('0x0'));var util=require(_0x1ef2('0x1'));var moment=require(_0x1ef2('0x2'));var BPromise=require(_0x1ef2('0x3'));var rs=require(_0x1ef2('0x4'));var fs=require('fs');var Redis=require(_0x1ef2('0x5'));var db=require(_0x1ef2('0x6'))['db'];var utils=require(_0x1ef2('0x7'));var logger=require(_0x1ef2('0x8'))(_0x1ef2('0x9'));var config=require(_0x1ef2('0xa'));var jayson=require(_0x1ef2('0xb'));var client=jayson[_0x1ef2('0xc')][_0x1ef2('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2e1f17,_0x5c8470,_0x2650c1){return new BPromise(function(_0x14b4de,_0xffa38){return client[_0x1ef2('0xe')](_0x2e1f17,_0x2650c1)[_0x1ef2('0xf')](function(_0x146c1a){logger[_0x1ef2('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5c8470,_0x1ef2('0x11'));logger['debug'](_0x1ef2('0x12'),_0x5c8470,_0x1ef2('0x11'),JSON[_0x1ef2('0x13')](_0x146c1a));if(_0x146c1a['error']){if(_0x146c1a[_0x1ef2('0x14')]['code']===0x1f4){logger[_0x1ef2('0x14')](_0x1ef2('0x15'),_0x5c8470,_0x146c1a[_0x1ef2('0x14')]['message']);return _0xffa38(_0x146c1a['error']['message']);}logger['error'](_0x1ef2('0x15'),_0x5c8470,_0x146c1a[_0x1ef2('0x14')][_0x1ef2('0x16')]);return _0x14b4de(_0x146c1a[_0x1ef2('0x14')][_0x1ef2('0x16')]);}else{logger['info'](_0x1ef2('0x15'),_0x5c8470,'request\x20sent');_0x14b4de(_0x146c1a[_0x1ef2('0x17')]['message']);}})[_0x1ef2('0x18')](function(_0xddbb17){logger[_0x1ef2('0x14')](_0x1ef2('0x15'),_0x5c8470,_0xddbb17);_0xffa38(_0xddbb17);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 4389e37..a68371a 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 _0x2d1f=['Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','index','get','/:id','show','create','put','update','exports','multer','util','connect-timeout'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x2d1f,0x85));var _0xf2d1=function(_0x31f3dd,_0x10b12e){_0x31f3dd=_0x31f3dd-0x0;var _0x3c1194=_0x2d1f[_0x31f3dd];return _0x3c1194;};'use strict';var multer=require(_0xf2d1('0x0'));var util=require(_0xf2d1('0x1'));var path=require('path');var timeout=require(_0xf2d1('0x2'));var express=require('express');var router=express[_0xf2d1('0x3')]();var fs_extra=require(_0xf2d1('0x4'));var auth=require(_0xf2d1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf2d1('0x6'));var controller=require(_0xf2d1('0x7'));router['get']('/',auth[_0xf2d1('0x8')](),controller[_0xf2d1('0x9')]);router[_0xf2d1('0xa')](_0xf2d1('0xb'),auth[_0xf2d1('0x8')](),controller[_0xf2d1('0xc')]);router['post']('/',auth[_0xf2d1('0x8')](),controller[_0xf2d1('0xd')]);router[_0xf2d1('0xe')](_0xf2d1('0xb'),auth[_0xf2d1('0x8')](),controller[_0xf2d1('0xf')]);router['delete'](_0xf2d1('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xf2d1('0x10')]=router; \ No newline at end of file +var _0x818a=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x216468,_0x31ca91){var _0x2d63c8=function(_0x367685){while(--_0x367685){_0x216468['push'](_0x216468['shift']());}};_0x2d63c8(++_0x31ca91);}(_0x818a,0x9a));var _0xa818=function(_0x59eefb,_0x2151ce){_0x59eefb=_0x59eefb-0x0;var _0x1a49e8=_0x818a[_0x59eefb];return _0x1a49e8;};'use strict';var multer=require(_0xa818('0x0'));var util=require(_0xa818('0x1'));var path=require(_0xa818('0x2'));var timeout=require(_0xa818('0x3'));var express=require(_0xa818('0x4'));var router=express[_0xa818('0x5')]();var fs_extra=require(_0xa818('0x6'));var auth=require(_0xa818('0x7'));var interaction=require(_0xa818('0x8'));var config=require(_0xa818('0x9'));var controller=require(_0xa818('0xa'));router[_0xa818('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa818('0xb')]('/:id',auth[_0xa818('0xc')](),controller[_0xa818('0xd')]);router[_0xa818('0xe')]('/',auth[_0xa818('0xc')](),controller[_0xa818('0xf')]);router[_0xa818('0x10')](_0xa818('0x11'),auth['isAuthenticated'](),controller[_0xa818('0x12')]);router[_0xa818('0x13')](_0xa818('0x11'),auth['isAuthenticated'](),controller[_0xa818('0x14')]);module[_0xa818('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index e4f09d9..d4844d7 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 _0xd5b9=['variable','keyValue','picklist','STRING','sequelize','exports','string'];(function(_0x44edc5,_0x167cf9){var _0xade2cd=function(_0x258898){while(--_0x258898){_0x44edc5['push'](_0x44edc5['shift']());}};_0xade2cd(++_0x167cf9);}(_0xd5b9,0x115));var _0x9d5b=function(_0x27fe69,_0xf607f1){_0x27fe69=_0x27fe69-0x0;var _0x5b3537=_0xd5b9[_0x27fe69];return _0x5b3537;};'use strict';var Sequelize=require(_0x9d5b('0x0'));module[_0x9d5b('0x1')]={'type':{'type':Sequelize['ENUM'](_0x9d5b('0x2'),_0x9d5b('0x3'),'customVariable',_0x9d5b('0x4'),_0x9d5b('0x5')),'defaultValue':_0x9d5b('0x2')},'content':{'type':Sequelize[_0x9d5b('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x9d5b('0x2'),_0x9d5b('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x9d5b('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1f8f=['BOOLEAN','sequelize','exports','ENUM','string','keyValue','STRING','variable','customVariable'];(function(_0x13c4b5,_0x1e2b80){var _0xab5f07=function(_0xb4d71b){while(--_0xb4d71b){_0x13c4b5['push'](_0x13c4b5['shift']());}};_0xab5f07(++_0x1e2b80);}(_0x1f8f,0x169));var _0xf1f8=function(_0x465ab4,_0x3fa61c){_0x465ab4=_0x465ab4-0x0;var _0x2cf4ae=_0x1f8f[_0x465ab4];return _0x2cf4ae;};'use strict';var Sequelize=require(_0xf1f8('0x0'));module[_0xf1f8('0x1')]={'type':{'type':Sequelize[_0xf1f8('0x2')](_0xf1f8('0x3'),'variable','customVariable',_0xf1f8('0x4'),'picklist'),'defaultValue':_0xf1f8('0x3')},'content':{'type':Sequelize[_0xf1f8('0x5')]},'key':{'type':Sequelize[_0xf1f8('0x5')]},'keyType':{'type':Sequelize[_0xf1f8('0x2')](_0xf1f8('0x3'),_0xf1f8('0x6'),_0xf1f8('0x7'))},'keyContent':{'type':Sequelize[_0xf1f8('0x5')]},'idField':{'type':Sequelize[_0xf1f8('0x5')]},'nameField':{'type':Sequelize[_0xf1f8('0x5')]},'customField':{'type':Sequelize[_0xf1f8('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf1f8('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index e677584..5477b8d 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 _0x1b59=['desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','then','error','name','send','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','merge','where','VIRTUAL','options','findAll','catch','params','includeAll','include','find','create','body','update','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce'];(function(_0x51c4f3,_0x1ce048){var _0x2d46be=function(_0x2f2163){while(--_0x2f2163){_0x51c4f3['push'](_0x51c4f3['shift']());}};_0x2d46be(++_0x1ce048);}(_0x1b59,0x19b));var _0x91b5=function(_0x2d1451,_0x5c5cf9){_0x2d1451=_0x2d1451-0x0;var _0x231908=_0x1b59[_0x2d1451];return _0x231908;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x91b5('0x0'));var zipdir=require(_0x91b5('0x1'));var jsonpatch=require(_0x91b5('0x2'));var rp=require(_0x91b5('0x3'));var moment=require(_0x91b5('0x4'));var BPromise=require(_0x91b5('0x5'));var Mustache=require(_0x91b5('0x6'));var util=require(_0x91b5('0x7'));var path=require(_0x91b5('0x8'));var sox=require(_0x91b5('0x9'));var csv=require(_0x91b5('0xa'));var ejs=require(_0x91b5('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x91b5('0xc'));var squel=require('squel');var crypto=require(_0x91b5('0xd'));var jsforce=require(_0x91b5('0xe'));var deskjs=require(_0x91b5('0xf'));var toCsv=require(_0x91b5('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x91b5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x91b5('0x11'));var hardwareService=require(_0x91b5('0x12'));var logger=require(_0x91b5('0x13'))(_0x91b5('0x14'));var utils=require(_0x91b5('0x15'));var config=require(_0x91b5('0x16'));var licenseUtil=require(_0x91b5('0x17'));var db=require(_0x91b5('0x18'))['db'];function respondWithStatusCode(_0x27d150,_0x55bd5a){_0x55bd5a=_0x55bd5a||0xcc;return function(_0x5baea6){if(_0x5baea6){return _0x27d150[_0x91b5('0x19')](_0x55bd5a);}return _0x27d150[_0x91b5('0x1a')](_0x55bd5a)[_0x91b5('0x1b')]();};}function respondWithResult(_0x4a2600,_0x3aa417){_0x3aa417=_0x3aa417||0xc8;return function(_0xb3e1da){if(_0xb3e1da){return _0x4a2600[_0x91b5('0x1a')](_0x3aa417)[_0x91b5('0x1c')](_0xb3e1da);}};}function respondWithFilteredResult(_0x13854c,_0x52e20a){return function(_0x52df06){if(_0x52df06){var _0x376991=typeof _0x52e20a[_0x91b5('0x1d')]==='undefined'&&typeof _0x52e20a['limit']===_0x91b5('0x1e');var _0x51b79a=_0x52df06[_0x91b5('0x1f')];var _0x58583e=_0x376991?0x0:_0x52e20a[_0x91b5('0x1d')];var _0x14fee0=_0x376991?_0x52df06[_0x91b5('0x1f')]:_0x52e20a[_0x91b5('0x1d')]+_0x52e20a[_0x91b5('0x20')];var _0xd03d0;if(_0x14fee0>=_0x51b79a){_0x14fee0=_0x51b79a;_0xd03d0=0xc8;}else{_0xd03d0=0xce;}_0x13854c[_0x91b5('0x1a')](_0xd03d0);return _0x13854c[_0x91b5('0x21')]('Content-Range',_0x58583e+'-'+_0x14fee0+'/'+_0x51b79a)[_0x91b5('0x1c')](_0x52df06);}return null;};}function patchUpdates(_0x1e9520){return function(_0xff2010){try{jsonpatch[_0x91b5('0x22')](_0xff2010,_0x1e9520,!![]);}catch(_0x218129){return BPromise[_0x91b5('0x23')](_0x218129);}return _0xff2010[_0x91b5('0x24')]();};}function saveUpdates(_0x378919,_0x3c32e3){return function(_0xc9f16){if(_0xc9f16){return _0xc9f16['update'](_0x378919)[_0x91b5('0x25')](function(_0x5b1058){return _0x5b1058;});}return null;};}function removeEntity(_0x42f0b0,_0x5c1a08){return function(_0x2bfe0d){if(_0x2bfe0d){return _0x2bfe0d['destroy']()[_0x91b5('0x25')](function(){_0x42f0b0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x52230f,_0x14fcb8){return function(_0x17c885){if(!_0x17c885){_0x52230f[_0x91b5('0x19')](0x194);}return _0x17c885;};}function handleError(_0x2fc599,_0x5f0171){_0x5f0171=_0x5f0171||0x1f4;return function(_0x3ee54c){logger[_0x91b5('0x26')](_0x3ee54c['stack']);if(_0x3ee54c[_0x91b5('0x27')]){delete _0x3ee54c[_0x91b5('0x27')];}_0x2fc599[_0x91b5('0x1a')](_0x5f0171)[_0x91b5('0x28')](_0x3ee54c);};}exports['index']=function(_0x60c7b7,_0x586f70){var _0x570a0c={},_0x52b865={},_0x5a345d={'count':0x0,'rows':[]};var _0x555990=_[_0x91b5('0x29')](db[_0x91b5('0x2a')][_0x91b5('0x2b')],function(_0x16e28e){return{'name':_0x16e28e[_0x91b5('0x2c')],'type':_0x16e28e[_0x91b5('0x2d')][_0x91b5('0x2e')]};});_0x52b865[_0x91b5('0x2f')]=_['map'](_0x555990,'name');_0x52b865[_0x91b5('0x30')]=_[_0x91b5('0x31')](_0x60c7b7[_0x91b5('0x30')]);_0x52b865[_0x91b5('0x32')]=_[_0x91b5('0x33')](_0x52b865[_0x91b5('0x2f')],_0x52b865[_0x91b5('0x30')]);_0x570a0c['attributes']=_[_0x91b5('0x33')](_0x52b865[_0x91b5('0x2f')],qs['fields'](_0x60c7b7[_0x91b5('0x30')][_0x91b5('0x34')]));_0x570a0c[_0x91b5('0x35')]=_0x570a0c[_0x91b5('0x35')][_0x91b5('0x36')]?_0x570a0c[_0x91b5('0x35')]:_0x52b865[_0x91b5('0x2f')];if(!_0x60c7b7[_0x91b5('0x30')]['hasOwnProperty'](_0x91b5('0x37'))){_0x570a0c[_0x91b5('0x20')]=qs[_0x91b5('0x20')](_0x60c7b7[_0x91b5('0x30')][_0x91b5('0x20')]);_0x570a0c[_0x91b5('0x1d')]=qs[_0x91b5('0x1d')](_0x60c7b7['query'][_0x91b5('0x1d')]);}_0x570a0c['order']=qs['sort'](_0x60c7b7[_0x91b5('0x30')][_0x91b5('0x38')]);_0x570a0c['where']=qs[_0x91b5('0x32')](_['pick'](_0x60c7b7[_0x91b5('0x30')],_0x52b865[_0x91b5('0x32')]),_0x555990);if(_0x60c7b7['query']['filter']){_0x570a0c['where']=_[_0x91b5('0x39')](_0x570a0c[_0x91b5('0x3a')],{'$or':_[_0x91b5('0x29')](_0x555990,function(_0xbe9751){if(_0xbe9751['type']!==_0x91b5('0x3b')){var _0x3f9b63={};_0x3f9b63[_0xbe9751[_0x91b5('0x27')]]={'$like':'%'+_0x60c7b7[_0x91b5('0x30')]['filter']+'%'};return _0x3f9b63;}})});}_0x570a0c=_[_0x91b5('0x39')]({},_0x570a0c,_0x60c7b7[_0x91b5('0x3c')]);var _0x4f8808={'where':_0x570a0c[_0x91b5('0x3a')]};return db[_0x91b5('0x2a')][_0x91b5('0x1f')](_0x4f8808)[_0x91b5('0x25')](function(_0x2036f0){_0x5a345d[_0x91b5('0x1f')]=_0x2036f0;if(_0x60c7b7['query']['includeAll']){_0x570a0c['include']=[{'all':!![]}];}return db[_0x91b5('0x2a')][_0x91b5('0x3d')](_0x570a0c);})[_0x91b5('0x25')](function(_0x4070cb){_0x5a345d['rows']=_0x4070cb;return _0x5a345d;})[_0x91b5('0x25')](respondWithFilteredResult(_0x586f70,_0x570a0c))[_0x91b5('0x3e')](handleError(_0x586f70,null));};exports['show']=function(_0x9bd416,_0x368a4c){var _0x59da37={'raw':!![],'where':{'id':_0x9bd416[_0x91b5('0x3f')]['id']}},_0x4c8ccb={};_0x4c8ccb[_0x91b5('0x2f')]=_[_0x91b5('0x31')](db['SugarcrmField'][_0x91b5('0x2b')]);_0x4c8ccb[_0x91b5('0x30')]=_[_0x91b5('0x31')](_0x9bd416[_0x91b5('0x30')]);_0x4c8ccb['filters']=_[_0x91b5('0x33')](_0x4c8ccb['model'],_0x4c8ccb[_0x91b5('0x30')]);_0x59da37[_0x91b5('0x35')]=_['intersection'](_0x4c8ccb[_0x91b5('0x2f')],qs['fields'](_0x9bd416[_0x91b5('0x30')][_0x91b5('0x34')]));_0x59da37[_0x91b5('0x35')]=_0x59da37['attributes'][_0x91b5('0x36')]?_0x59da37['attributes']:_0x4c8ccb[_0x91b5('0x2f')];if(_0x9bd416['query'][_0x91b5('0x40')]){_0x59da37[_0x91b5('0x41')]=[{'all':!![]}];}_0x59da37=_[_0x91b5('0x39')]({},_0x59da37,_0x9bd416[_0x91b5('0x3c')]);return db['SugarcrmField'][_0x91b5('0x42')](_0x59da37)['then'](handleEntityNotFound(_0x368a4c,null))['then'](respondWithResult(_0x368a4c,null))[_0x91b5('0x3e')](handleError(_0x368a4c,null));};exports[_0x91b5('0x43')]=function(_0x1b2353,_0x247ea7){return db['SugarcrmField']['create'](_0x1b2353[_0x91b5('0x44')],{})['then'](respondWithResult(_0x247ea7,0xc9))[_0x91b5('0x3e')](handleError(_0x247ea7,null));};exports[_0x91b5('0x45')]=function(_0x473ae3,_0x574131){if(_0x473ae3['body']['id']){delete _0x473ae3[_0x91b5('0x44')]['id'];}return db['SugarcrmField'][_0x91b5('0x42')]({'where':{'id':_0x473ae3['params']['id']}})[_0x91b5('0x25')](handleEntityNotFound(_0x574131,null))[_0x91b5('0x25')](saveUpdates(_0x473ae3[_0x91b5('0x44')],null))['then'](respondWithResult(_0x574131,null))[_0x91b5('0x3e')](handleError(_0x574131,null));};exports[_0x91b5('0x46')]=function(_0x81906c,_0x4dc3e7){return db[_0x91b5('0x2a')][_0x91b5('0x42')]({'where':{'id':_0x81906c[_0x91b5('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4dc3e7,null))[_0x91b5('0x25')](removeEntity(_0x4dc3e7,null))[_0x91b5('0x3e')](handleError(_0x4dc3e7,null));}; \ No newline at end of file +var _0xb019=['type','key','map','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','SugarcrmField','count','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','status','json','offset','undefined','limit','set','apply','save','update','destroy','then','end','sendStatus','stack','name','index','rawAttributes','fieldName'];(function(_0x4116ae,_0x17607f){var _0x1d6e48=function(_0x272192){while(--_0x272192){_0x4116ae['push'](_0x4116ae['shift']());}};_0x1d6e48(++_0x17607f);}(_0xb019,0x65));var _0x9b01=function(_0x23bf6f,_0x1b25f1){_0x23bf6f=_0x23bf6f-0x0;var _0x49c0f4=_0xb019[_0x23bf6f];return _0x49c0f4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9b01('0x0'));var zipdir=require(_0x9b01('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9b01('0x2'));var moment=require(_0x9b01('0x3'));var BPromise=require(_0x9b01('0x4'));var Mustache=require('mustache');var util=require(_0x9b01('0x5'));var path=require(_0x9b01('0x6'));var sox=require(_0x9b01('0x7'));var csv=require(_0x9b01('0x8'));var ejs=require(_0x9b01('0x9'));var fs=require('fs');var fs_extra=require(_0x9b01('0xa'));var _=require(_0x9b01('0xb'));var squel=require(_0x9b01('0xc'));var crypto=require(_0x9b01('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9b01('0xe'));var Papa=require(_0x9b01('0xf'));var Redis=require(_0x9b01('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9b01('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9b01('0x12'))('api');var utils=require(_0x9b01('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9b01('0x14'))['db'];function respondWithStatusCode(_0x5d9c4e,_0x2f3edc){_0x2f3edc=_0x2f3edc||0xcc;return function(_0x3734ef){if(_0x3734ef){return _0x5d9c4e['sendStatus'](_0x2f3edc);}return _0x5d9c4e[_0x9b01('0x15')](_0x2f3edc)['end']();};}function respondWithResult(_0x32fa04,_0x257b31){_0x257b31=_0x257b31||0xc8;return function(_0x18f514){if(_0x18f514){return _0x32fa04[_0x9b01('0x15')](_0x257b31)[_0x9b01('0x16')](_0x18f514);}};}function respondWithFilteredResult(_0x500143,_0xce357){return function(_0x3e1c31){if(_0x3e1c31){var _0x1750b9=typeof _0xce357[_0x9b01('0x17')]===_0x9b01('0x18')&&typeof _0xce357['limit']===_0x9b01('0x18');var _0x45f3f5=_0x3e1c31['count'];var _0x2cc7c5=_0x1750b9?0x0:_0xce357[_0x9b01('0x17')];var _0x3798a9=_0x1750b9?_0x3e1c31['count']:_0xce357[_0x9b01('0x17')]+_0xce357[_0x9b01('0x19')];var _0x2f7089;if(_0x3798a9>=_0x45f3f5){_0x3798a9=_0x45f3f5;_0x2f7089=0xc8;}else{_0x2f7089=0xce;}_0x500143[_0x9b01('0x15')](_0x2f7089);return _0x500143[_0x9b01('0x1a')]('Content-Range',_0x2cc7c5+'-'+_0x3798a9+'/'+_0x45f3f5)['json'](_0x3e1c31);}return null;};}function patchUpdates(_0xd4df54){return function(_0x5447c7){try{jsonpatch[_0x9b01('0x1b')](_0x5447c7,_0xd4df54,!![]);}catch(_0x19a7cf){return BPromise['reject'](_0x19a7cf);}return _0x5447c7[_0x9b01('0x1c')]();};}function saveUpdates(_0x41c3e4,_0x396199){return function(_0x6242c5){if(_0x6242c5){return _0x6242c5[_0x9b01('0x1d')](_0x41c3e4)['then'](function(_0x2be87c){return _0x2be87c;});}return null;};}function removeEntity(_0x40848f,_0x306a42){return function(_0x56ce74){if(_0x56ce74){return _0x56ce74[_0x9b01('0x1e')]()[_0x9b01('0x1f')](function(){_0x40848f[_0x9b01('0x15')](0xcc)[_0x9b01('0x20')]();});}};}function handleEntityNotFound(_0x3d2139,_0x1a41ea){return function(_0x568993){if(!_0x568993){_0x3d2139[_0x9b01('0x21')](0x194);}return _0x568993;};}function handleError(_0x4304c6,_0x1345f7){_0x1345f7=_0x1345f7||0x1f4;return function(_0x387e3d){logger['error'](_0x387e3d[_0x9b01('0x22')]);if(_0x387e3d[_0x9b01('0x23')]){delete _0x387e3d['name'];}_0x4304c6['status'](_0x1345f7)['send'](_0x387e3d);};}exports[_0x9b01('0x24')]=function(_0x1e52dd,_0x129890){var _0x450419={},_0xb372c9={},_0x417f06={'count':0x0,'rows':[]};var _0x142f8f=_['map'](db['SugarcrmField'][_0x9b01('0x25')],function(_0x309e56){return{'name':_0x309e56[_0x9b01('0x26')],'type':_0x309e56[_0x9b01('0x27')][_0x9b01('0x28')]};});_0xb372c9['model']=_[_0x9b01('0x29')](_0x142f8f,_0x9b01('0x23'));_0xb372c9[_0x9b01('0x2a')]=_['keys'](_0x1e52dd[_0x9b01('0x2a')]);_0xb372c9[_0x9b01('0x2b')]=_[_0x9b01('0x2c')](_0xb372c9[_0x9b01('0x2d')],_0xb372c9[_0x9b01('0x2a')]);_0x450419[_0x9b01('0x2e')]=_['intersection'](_0xb372c9[_0x9b01('0x2d')],qs[_0x9b01('0x2f')](_0x1e52dd[_0x9b01('0x2a')][_0x9b01('0x2f')]));_0x450419[_0x9b01('0x2e')]=_0x450419[_0x9b01('0x2e')]['length']?_0x450419['attributes']:_0xb372c9[_0x9b01('0x2d')];if(!_0x1e52dd[_0x9b01('0x2a')][_0x9b01('0x30')](_0x9b01('0x31'))){_0x450419[_0x9b01('0x19')]=qs[_0x9b01('0x19')](_0x1e52dd[_0x9b01('0x2a')][_0x9b01('0x19')]);_0x450419['offset']=qs[_0x9b01('0x17')](_0x1e52dd[_0x9b01('0x2a')][_0x9b01('0x17')]);}_0x450419[_0x9b01('0x32')]=qs[_0x9b01('0x33')](_0x1e52dd[_0x9b01('0x2a')][_0x9b01('0x33')]);_0x450419['where']=qs[_0x9b01('0x2b')](_['pick'](_0x1e52dd[_0x9b01('0x2a')],_0xb372c9['filters']),_0x142f8f);if(_0x1e52dd[_0x9b01('0x2a')]['filter']){_0x450419[_0x9b01('0x34')]=_[_0x9b01('0x35')](_0x450419[_0x9b01('0x34')],{'$or':_['map'](_0x142f8f,function(_0x37b0c7){if(_0x37b0c7[_0x9b01('0x27')]!==_0x9b01('0x36')){var _0x5703d8={};_0x5703d8[_0x37b0c7[_0x9b01('0x23')]]={'$like':'%'+_0x1e52dd[_0x9b01('0x2a')]['filter']+'%'};return _0x5703d8;}})});}_0x450419=_[_0x9b01('0x35')]({},_0x450419,_0x1e52dd[_0x9b01('0x37')]);var _0x721016={'where':_0x450419[_0x9b01('0x34')]};return db[_0x9b01('0x38')][_0x9b01('0x39')](_0x721016)[_0x9b01('0x1f')](function(_0x48291e){_0x417f06[_0x9b01('0x39')]=_0x48291e;if(_0x1e52dd['query'][_0x9b01('0x3a')]){_0x450419[_0x9b01('0x3b')]=[{'all':!![]}];}return db['SugarcrmField'][_0x9b01('0x3c')](_0x450419);})[_0x9b01('0x1f')](function(_0x13673a){_0x417f06[_0x9b01('0x3d')]=_0x13673a;return _0x417f06;})['then'](respondWithFilteredResult(_0x129890,_0x450419))[_0x9b01('0x3e')](handleError(_0x129890,null));};exports[_0x9b01('0x3f')]=function(_0x406367,_0x2c677d){var _0x133a63={'raw':!![],'where':{'id':_0x406367[_0x9b01('0x40')]['id']}},_0x283a9a={};_0x283a9a['model']=_[_0x9b01('0x41')](db[_0x9b01('0x38')][_0x9b01('0x25')]);_0x283a9a[_0x9b01('0x2a')]=_['keys'](_0x406367['query']);_0x283a9a[_0x9b01('0x2b')]=_[_0x9b01('0x2c')](_0x283a9a[_0x9b01('0x2d')],_0x283a9a[_0x9b01('0x2a')]);_0x133a63[_0x9b01('0x2e')]=_['intersection'](_0x283a9a['model'],qs[_0x9b01('0x2f')](_0x406367[_0x9b01('0x2a')][_0x9b01('0x2f')]));_0x133a63['attributes']=_0x133a63['attributes'][_0x9b01('0x42')]?_0x133a63[_0x9b01('0x2e')]:_0x283a9a[_0x9b01('0x2d')];if(_0x406367['query'][_0x9b01('0x3a')]){_0x133a63[_0x9b01('0x3b')]=[{'all':!![]}];}_0x133a63=_[_0x9b01('0x35')]({},_0x133a63,_0x406367['options']);return db[_0x9b01('0x38')][_0x9b01('0x43')](_0x133a63)['then'](handleEntityNotFound(_0x2c677d,null))[_0x9b01('0x1f')](respondWithResult(_0x2c677d,null))['catch'](handleError(_0x2c677d,null));};exports[_0x9b01('0x44')]=function(_0x573d39,_0x46ec42){return db[_0x9b01('0x38')]['create'](_0x573d39[_0x9b01('0x45')],{})[_0x9b01('0x1f')](respondWithResult(_0x46ec42,0xc9))[_0x9b01('0x3e')](handleError(_0x46ec42,null));};exports[_0x9b01('0x1d')]=function(_0x3ca2b2,_0x512b03){if(_0x3ca2b2[_0x9b01('0x45')]['id']){delete _0x3ca2b2[_0x9b01('0x45')]['id'];}return db['SugarcrmField']['find']({'where':{'id':_0x3ca2b2['params']['id']}})[_0x9b01('0x1f')](handleEntityNotFound(_0x512b03,null))[_0x9b01('0x1f')](saveUpdates(_0x3ca2b2[_0x9b01('0x45')],null))[_0x9b01('0x1f')](respondWithResult(_0x512b03,null))[_0x9b01('0x3e')](handleError(_0x512b03,null));};exports[_0x9b01('0x1e')]=function(_0x4ee4f3,_0x4756f2){return db[_0x9b01('0x38')][_0x9b01('0x43')]({'where':{'id':_0x4ee4f3[_0x9b01('0x40')]['id']}})[_0x9b01('0x1f')](handleEntityNotFound(_0x4756f2,null))[_0x9b01('0x1f')](removeEntity(_0x4756f2,null))[_0x9b01('0x3e')](handleError(_0x4756f2,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 3064dd3..38f1b0d 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 _0x5e65=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','SugarcrmField','idField','util'];(function(_0x2cac2e,_0x59d4c3){var _0x19ffe8=function(_0x5c52b1){while(--_0x5c52b1){_0x2cac2e['push'](_0x2cac2e['shift']());}};_0x19ffe8(++_0x59d4c3);}(_0x5e65,0xf1));var _0x55e6=function(_0x4dd4cc,_0x1c0a8f){_0x4dd4cc=_0x4dd4cc-0x0;var _0x3fe24a=_0x5e65[_0x4dd4cc];return _0x3fe24a;};'use strict';var _=require('lodash');var util=require(_0x55e6('0x0'));var logger=require(_0x55e6('0x1'))('api');var moment=require(_0x55e6('0x2'));var BPromise=require(_0x55e6('0x3'));var rp=require(_0x55e6('0x4'));var fs=require('fs');var path=require(_0x55e6('0x5'));var rimraf=require(_0x55e6('0x6'));var config=require(_0x55e6('0x7'));var attributes=require('./intSugarcrmField.attributes');module[_0x55e6('0x8')]=function(_0x3f23e,_0xbef612){return _0x3f23e['define'](_0x55e6('0x9'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x55e6('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1368=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','sugarcrm_unique_index','idField','FieldId','lodash','../../config/logger'];(function(_0x1432b5,_0x1a11bb){var _0x4d15bd=function(_0x349510){while(--_0x349510){_0x1432b5['push'](_0x1432b5['shift']());}};_0x4d15bd(++_0x1a11bb);}(_0x1368,0x14e));var _0x8136=function(_0x323235,_0xed3e5a){_0x323235=_0x323235-0x0;var _0x3f1f0c=_0x1368[_0x323235];return _0x3f1f0c;};'use strict';var _=require(_0x8136('0x0'));var util=require('util');var logger=require(_0x8136('0x1'))(_0x8136('0x2'));var moment=require(_0x8136('0x3'));var BPromise=require(_0x8136('0x4'));var rp=require(_0x8136('0x5'));var fs=require('fs');var path=require(_0x8136('0x6'));var rimraf=require(_0x8136('0x7'));var config=require(_0x8136('0x8'));var attributes=require(_0x8136('0x9'));module[_0x8136('0xa')]=function(_0xc8b124,_0x2ab338){return _0xc8b124[_0x8136('0xb')](_0x8136('0xc'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x8136('0xd'),'fields':[_0x8136('0xe'),_0x8136('0xf')],'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 1108cef..1761890 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 _0xf437=['SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2db267,_0x26998e){var _0x3ee03a=function(_0xe6001d){while(--_0xe6001d){_0x2db267['push'](_0x2db267['shift']());}};_0x3ee03a(++_0x26998e);}(_0xf437,0x129));var _0x7f43=function(_0x205e56,_0x366e77){_0x205e56=_0x205e56-0x0;var _0x489d5d=_0xf437[_0x205e56];return _0x489d5d;};'use strict';var _=require(_0x7f43('0x0'));var util=require(_0x7f43('0x1'));var moment=require('moment');var BPromise=require(_0x7f43('0x2'));var rs=require(_0x7f43('0x3'));var fs=require('fs');var Redis=require(_0x7f43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f43('0x5'));var logger=require(_0x7f43('0x6'))(_0x7f43('0x7'));var config=require(_0x7f43('0x8'));var jayson=require(_0x7f43('0x9'));var client=jayson[_0x7f43('0xa')][_0x7f43('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x201a55,_0x1eb8f2,_0xdfd238){return new BPromise(function(_0x56dfa9,_0x9c6743){return client[_0x7f43('0xc')](_0x201a55,_0xdfd238)[_0x7f43('0xd')](function(_0x212d03){logger[_0x7f43('0xe')](_0x7f43('0xf'),_0x1eb8f2,'request\x20sent');logger[_0x7f43('0x10')](_0x7f43('0x11'),_0x1eb8f2,'request\x20sent',JSON[_0x7f43('0x12')](_0x212d03));if(_0x212d03[_0x7f43('0x13')]){if(_0x212d03[_0x7f43('0x13')][_0x7f43('0x14')]===0x1f4){logger[_0x7f43('0x13')](_0x7f43('0xf'),_0x1eb8f2,_0x212d03[_0x7f43('0x13')]['message']);return _0x9c6743(_0x212d03[_0x7f43('0x13')][_0x7f43('0x15')]);}logger[_0x7f43('0x13')](_0x7f43('0xf'),_0x1eb8f2,_0x212d03['error'][_0x7f43('0x15')]);return _0x56dfa9(_0x212d03[_0x7f43('0x13')][_0x7f43('0x15')]);}else{logger[_0x7f43('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x1eb8f2,_0x7f43('0x16'));_0x56dfa9(_0x212d03['result'][_0x7f43('0x15')]);}})[_0x7f43('0x17')](function(_0x295bee){logger[_0x7f43('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x1eb8f2,_0x295bee);_0x9c6743(_0x295bee);});});} \ No newline at end of file +var _0x2cce=['rpc','../../config/environment','jayson/promise','client','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1bbb61,_0x8eb054){var _0x260172=function(_0x44ba03){while(--_0x44ba03){_0x1bbb61['push'](_0x1bbb61['shift']());}};_0x260172(++_0x8eb054);}(_0x2cce,0x1a1));var _0xe2cc=function(_0x1de2a9,_0x23b34e){_0x1de2a9=_0x1de2a9-0x0;var _0x262bc9=_0x2cce[_0x1de2a9];return _0x262bc9;};'use strict';var _=require(_0xe2cc('0x0'));var util=require(_0xe2cc('0x1'));var moment=require(_0xe2cc('0x2'));var BPromise=require(_0xe2cc('0x3'));var rs=require(_0xe2cc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe2cc('0x5'))['db'];var utils=require(_0xe2cc('0x6'));var logger=require(_0xe2cc('0x7'))(_0xe2cc('0x8'));var config=require(_0xe2cc('0x9'));var jayson=require(_0xe2cc('0xa'));var client=jayson[_0xe2cc('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a3365,_0x16a986,_0x4e0110){return new BPromise(function(_0x48d582,_0x2930e6){return client[_0xe2cc('0xc')](_0x3a3365,_0x4e0110)[_0xe2cc('0xd')](function(_0xf6d1a2){logger['info'](_0xe2cc('0xe'),_0x16a986,_0xe2cc('0xf'));logger[_0xe2cc('0x10')](_0xe2cc('0x11'),_0x16a986,_0xe2cc('0xf'),JSON[_0xe2cc('0x12')](_0xf6d1a2));if(_0xf6d1a2[_0xe2cc('0x13')]){if(_0xf6d1a2[_0xe2cc('0x13')][_0xe2cc('0x14')]===0x1f4){logger['error'](_0xe2cc('0xe'),_0x16a986,_0xf6d1a2[_0xe2cc('0x13')]['message']);return _0x2930e6(_0xf6d1a2[_0xe2cc('0x13')][_0xe2cc('0x15')]);}logger[_0xe2cc('0x13')](_0xe2cc('0xe'),_0x16a986,_0xf6d1a2[_0xe2cc('0x13')][_0xe2cc('0x15')]);return _0x48d582(_0xf6d1a2[_0xe2cc('0x13')][_0xe2cc('0x15')]);}else{logger[_0xe2cc('0x16')](_0xe2cc('0xe'),_0x16a986,'request\x20sent');_0x48d582(_0xf6d1a2[_0xe2cc('0x17')][_0xe2cc('0x15')]);}})[_0xe2cc('0x18')](function(_0x21f8de){logger['error'](_0xe2cc('0xe'),_0x16a986,_0x21f8de);_0x2930e6(_0x21f8de);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 4f4b83a..4b8ec9a 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 _0x207c=['addConfiguration','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','isAuthenticated','getFields','post'];(function(_0x4a82ed,_0x5a6aeb){var _0x528635=function(_0x4d75eb){while(--_0x4d75eb){_0x4a82ed['push'](_0x4a82ed['shift']());}};_0x528635(++_0x5a6aeb);}(_0x207c,0x1e8));var _0xc207=function(_0x3c0cd6,_0x5ba428){_0x3c0cd6=_0x3c0cd6-0x0;var _0x4381ec=_0x207c[_0x3c0cd6];return _0x4381ec;};'use strict';var multer=require('multer');var util=require(_0xc207('0x0'));var path=require(_0xc207('0x1'));var timeout=require(_0xc207('0x2'));var express=require(_0xc207('0x3'));var router=express[_0xc207('0x4')]();var fs_extra=require(_0xc207('0x5'));var auth=require(_0xc207('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc207('0x7'));var controller=require('./intVtigerAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc207('0x8')]);router[_0xc207('0x9')](_0xc207('0xa'),auth['isAuthenticated'](),controller[_0xc207('0xb')]);router[_0xc207('0x9')](_0xc207('0xc'),auth['isAuthenticated'](),controller[_0xc207('0xd')]);router[_0xc207('0x9')](_0xc207('0xe'),auth[_0xc207('0xf')](),controller[_0xc207('0x10')]);router[_0xc207('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xc207('0xc'),auth['isAuthenticated'](),controller[_0xc207('0x12')]);router[_0xc207('0x13')]('/:id',auth[_0xc207('0xf')](),controller[_0xc207('0x14')]);router[_0xc207('0x15')](_0xc207('0xa'),auth[_0xc207('0xf')](),controller['destroy']);module[_0xc207('0x16')]=router; \ No newline at end of file +var _0xde50=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','index','get','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put','isAuthenticated','update','delete'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xde50,0x140));var _0x0de5=function(_0x110b51,_0x23981a){_0x110b51=_0x110b51-0x0;var _0x4e45a3=_0xde50[_0x110b51];return _0x4e45a3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0de5('0x0'));var timeout=require(_0x0de5('0x1'));var express=require(_0x0de5('0x2'));var router=express[_0x0de5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0de5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0de5('0x5'));var controller=require('./intVtigerAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0de5('0x6')]);router[_0x0de5('0x7')](_0x0de5('0x8'),auth['isAuthenticated'](),controller[_0x0de5('0x9')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0x0de5('0xa')]);router[_0x0de5('0x7')](_0x0de5('0xb'),auth['isAuthenticated'](),controller[_0x0de5('0xc')]);router[_0x0de5('0xd')]('/',auth['isAuthenticated'](),controller[_0x0de5('0xe')]);router[_0x0de5('0xd')](_0x0de5('0xf'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x0de5('0x10')](_0x0de5('0x8'),auth[_0x0de5('0x11')](),controller[_0x0de5('0x12')]);router[_0x0de5('0x13')]('/:id',auth[_0x0de5('0x11')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 196dbba..3a2b0c9 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 _0xb134=['sequelize','STRING','HelpDesk'];(function(_0x47f5e8,_0x3e460d){var _0x482ae7=function(_0x5c41e4){while(--_0x5c41e4){_0x47f5e8['push'](_0x47f5e8['shift']());}};_0x482ae7(++_0x3e460d);}(_0xb134,0x126));var _0x4b13=function(_0x4bc4c8,_0x3139d3){_0x4bc4c8=_0x4bc4c8-0x0;var _0x3bb121=_0xb134[_0x4bc4c8];return _0x3bb121;};'use strict';var Sequelize=require(_0x4b13('0x0'));module['exports']={'name':{'type':Sequelize[_0x4b13('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x4b13('0x1')]},'username':{'type':Sequelize[_0x4b13('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x4b13('0x1')],'allowNull':![],'defaultValue':_0x4b13('0x2')},'remoteUri':{'type':Sequelize[_0x4b13('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x4b13('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x4b13('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x5cf3=['HelpDesk','exports','STRING'];(function(_0x4bfe24,_0x4d9402){var _0x18b70e=function(_0x1f4aa3){while(--_0x1f4aa3){_0x4bfe24['push'](_0x4bfe24['shift']());}};_0x18b70e(++_0x4d9402);}(_0x5cf3,0xf4));var _0x35cf=function(_0x487524,_0x292ba6){_0x487524=_0x487524-0x0;var _0x3f3543=_0x5cf3[_0x487524];return _0x3f3543;};'use strict';var Sequelize=require('sequelize');module[_0x35cf('0x0')]={'name':{'type':Sequelize[_0x35cf('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x35cf('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x35cf('0x1')],'allowNull':![],'defaultValue':_0x35cf('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x35cf('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x35cf('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index fbea171..dfc9c96 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 _0xd9c6=['ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','limit','set','Content-Range','reject','update','then','destroy','sendStatus','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','VtigerAccount','count','include','findAll','rows','catch','params','includeAll','create','body','find','getConfigurations','findOne','VtigerConfiguration','pick','addConfiguration','AccountId','getSubjects','channel','getDescriptions','VtigerField','Subjects','Descriptions','md5','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','format','GET','getchallenge','login','token','describe','result','sessionName','success','autogenerated','remove','includes','editable','false','label','cf_','picklist','picklistValues','log','test','statusCode','error','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x30186f,_0x4ff4c2){var _0x276b91=function(_0x2456a9){while(--_0x2456a9){_0x30186f['push'](_0x30186f['shift']());}};_0x276b91(++_0x4ff4c2);}(_0xd9c6,0xe4));var _0x6d9c=function(_0x3d57df,_0x39ca35){_0x3d57df=_0x3d57df-0x0;var _0x50bb75=_0xd9c6[_0x3d57df];return _0x50bb75;};'use strict';var emlformat=require(_0x6d9c('0x0'));var rimraf=require(_0x6d9c('0x1'));var zipdir=require(_0x6d9c('0x2'));var jsonpatch=require(_0x6d9c('0x3'));var rp=require(_0x6d9c('0x4'));var moment=require(_0x6d9c('0x5'));var BPromise=require(_0x6d9c('0x6'));var Mustache=require(_0x6d9c('0x7'));var util=require(_0x6d9c('0x8'));var path=require(_0x6d9c('0x9'));var sox=require(_0x6d9c('0xa'));var csv=require(_0x6d9c('0xb'));var ejs=require(_0x6d9c('0xc'));var fs=require('fs');var fs_extra=require(_0x6d9c('0xd'));var _=require(_0x6d9c('0xe'));var squel=require(_0x6d9c('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6d9c('0x10'));var toCsv=require(_0x6d9c('0xb'));var querystring=require('querystring');var Papa=require(_0x6d9c('0x11'));var Redis=require(_0x6d9c('0x12'));var authService=require(_0x6d9c('0x13'));var qs=require(_0x6d9c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6d9c('0x15'))(_0x6d9c('0x16'));var utils=require(_0x6d9c('0x17'));var config=require(_0x6d9c('0x18'));var licenseUtil=require(_0x6d9c('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x6d9c('0x1a'));function respondWithStatusCode(_0x8325e,_0x5859bd){_0x5859bd=_0x5859bd||0xcc;return function(_0x530060){if(_0x530060){return _0x8325e['sendStatus'](_0x5859bd);}return _0x8325e[_0x6d9c('0x1b')](_0x5859bd)[_0x6d9c('0x1c')]();};}function respondWithResult(_0x3a605c,_0xd680be){_0xd680be=_0xd680be||0xc8;return function(_0x1d43c4){if(_0x1d43c4){return _0x3a605c[_0x6d9c('0x1b')](_0xd680be)[_0x6d9c('0x1d')](_0x1d43c4);}};}function respondWithFilteredResult(_0x5dfdd0,_0x5522c6){return function(_0x845cb3){if(_0x845cb3){var _0x187d31=typeof _0x5522c6[_0x6d9c('0x1e')]===_0x6d9c('0x1f')&&typeof _0x5522c6[_0x6d9c('0x20')]===_0x6d9c('0x1f');var _0x12d52a=_0x845cb3['count'];var _0x5a53b0=_0x187d31?0x0:_0x5522c6[_0x6d9c('0x1e')];var _0x3bd33e=_0x187d31?_0x845cb3['count']:_0x5522c6[_0x6d9c('0x1e')]+_0x5522c6['limit'];var _0x4620ff;if(_0x3bd33e>=_0x12d52a){_0x3bd33e=_0x12d52a;_0x4620ff=0xc8;}else{_0x4620ff=0xce;}_0x5dfdd0[_0x6d9c('0x1b')](_0x4620ff);return _0x5dfdd0[_0x6d9c('0x21')](_0x6d9c('0x22'),_0x5a53b0+'-'+_0x3bd33e+'/'+_0x12d52a)['json'](_0x845cb3);}return null;};}function patchUpdates(_0xf9512e){return function(_0x1e4c18){try{jsonpatch['apply'](_0x1e4c18,_0xf9512e,!![]);}catch(_0x708c0){return BPromise[_0x6d9c('0x23')](_0x708c0);}return _0x1e4c18['save']();};}function saveUpdates(_0x21120b,_0x656188){return function(_0x1e8f21){if(_0x1e8f21){return _0x1e8f21[_0x6d9c('0x24')](_0x21120b)[_0x6d9c('0x25')](function(_0x47ac2e){return _0x47ac2e;});}return null;};}function removeEntity(_0x5f3278,_0x20eaf0){return function(_0x5952eb){if(_0x5952eb){return _0x5952eb[_0x6d9c('0x26')]()[_0x6d9c('0x25')](function(){_0x5f3278[_0x6d9c('0x1b')](0xcc)[_0x6d9c('0x1c')]();});}};}function handleEntityNotFound(_0x920b23,_0x256aea){return function(_0x52a1b5){if(!_0x52a1b5){_0x920b23[_0x6d9c('0x27')](0x194);}return _0x52a1b5;};}function handleError(_0x3ae432,_0x1b322c){_0x1b322c=_0x1b322c||0x1f4;return function(_0x46151a){logger['error'](_0x46151a['stack']);if(_0x46151a[_0x6d9c('0x28')]){delete _0x46151a['name'];}_0x3ae432['status'](_0x1b322c)[_0x6d9c('0x29')](_0x46151a);};}exports['index']=function(_0x186fe2,_0x49ba79){var _0x16137b={},_0x54e8ea={},_0x1a890e={'count':0x0,'rows':[]};var _0x4fb9bc=_[_0x6d9c('0x2a')](db['VtigerAccount'][_0x6d9c('0x2b')],function(_0x4923eb){return{'name':_0x4923eb[_0x6d9c('0x2c')],'type':_0x4923eb[_0x6d9c('0x2d')][_0x6d9c('0x2e')]};});_0x54e8ea[_0x6d9c('0x2f')]=_[_0x6d9c('0x2a')](_0x4fb9bc,'name');_0x54e8ea[_0x6d9c('0x30')]=_[_0x6d9c('0x31')](_0x186fe2['query']);_0x54e8ea[_0x6d9c('0x32')]=_[_0x6d9c('0x33')](_0x54e8ea[_0x6d9c('0x2f')],_0x54e8ea[_0x6d9c('0x30')]);_0x16137b[_0x6d9c('0x34')]=_['intersection'](_0x54e8ea[_0x6d9c('0x2f')],qs['fields'](_0x186fe2['query'][_0x6d9c('0x35')]));_0x16137b[_0x6d9c('0x34')]=_0x16137b[_0x6d9c('0x34')][_0x6d9c('0x36')]?_0x16137b[_0x6d9c('0x34')]:_0x54e8ea[_0x6d9c('0x2f')];if(!_0x186fe2[_0x6d9c('0x30')][_0x6d9c('0x37')](_0x6d9c('0x38'))){_0x16137b['limit']=qs[_0x6d9c('0x20')](_0x186fe2[_0x6d9c('0x30')][_0x6d9c('0x20')]);_0x16137b['offset']=qs[_0x6d9c('0x1e')](_0x186fe2[_0x6d9c('0x30')][_0x6d9c('0x1e')]);}_0x16137b[_0x6d9c('0x39')]=qs[_0x6d9c('0x3a')](_0x186fe2['query']['sort']);_0x16137b[_0x6d9c('0x3b')]=qs[_0x6d9c('0x32')](_['pick'](_0x186fe2[_0x6d9c('0x30')],_0x54e8ea[_0x6d9c('0x32')]),_0x4fb9bc);if(_0x186fe2[_0x6d9c('0x30')][_0x6d9c('0x3c')]){_0x16137b['where']=_['merge'](_0x16137b[_0x6d9c('0x3b')],{'$or':_[_0x6d9c('0x2a')](_0x4fb9bc,function(_0x29f3ea){if(_0x29f3ea['type']!=='VIRTUAL'){var _0x154ba0={};_0x154ba0[_0x29f3ea[_0x6d9c('0x28')]]={'$like':'%'+_0x186fe2[_0x6d9c('0x30')][_0x6d9c('0x3c')]+'%'};return _0x154ba0;}})});}_0x16137b=_[_0x6d9c('0x3d')]({},_0x16137b,_0x186fe2[_0x6d9c('0x3e')]);var _0x429106={'where':_0x16137b[_0x6d9c('0x3b')]};return db[_0x6d9c('0x3f')][_0x6d9c('0x40')](_0x429106)['then'](function(_0x3b5981){_0x1a890e[_0x6d9c('0x40')]=_0x3b5981;if(_0x186fe2[_0x6d9c('0x30')]['includeAll']){_0x16137b[_0x6d9c('0x41')]=[{'all':!![]}];}return db[_0x6d9c('0x3f')][_0x6d9c('0x42')](_0x16137b);})[_0x6d9c('0x25')](function(_0x116c72){_0x1a890e[_0x6d9c('0x43')]=_0x116c72;return _0x1a890e;})[_0x6d9c('0x25')](respondWithFilteredResult(_0x49ba79,_0x16137b))[_0x6d9c('0x44')](handleError(_0x49ba79,null));};exports['show']=function(_0x3f561a,_0x164071){var _0xcbf591={'raw':![],'where':{'id':_0x3f561a[_0x6d9c('0x45')]['id']}},_0x34bce0={};_0x34bce0[_0x6d9c('0x2f')]=_[_0x6d9c('0x31')](db[_0x6d9c('0x3f')][_0x6d9c('0x2b')]);_0x34bce0[_0x6d9c('0x30')]=_['keys'](_0x3f561a[_0x6d9c('0x30')]);_0x34bce0['filters']=_[_0x6d9c('0x33')](_0x34bce0[_0x6d9c('0x2f')],_0x34bce0[_0x6d9c('0x30')]);_0xcbf591[_0x6d9c('0x34')]=_[_0x6d9c('0x33')](_0x34bce0[_0x6d9c('0x2f')],qs[_0x6d9c('0x35')](_0x3f561a[_0x6d9c('0x30')][_0x6d9c('0x35')]));_0xcbf591['attributes']=_0xcbf591[_0x6d9c('0x34')][_0x6d9c('0x36')]?_0xcbf591[_0x6d9c('0x34')]:_0x34bce0['model'];if(_0x3f561a[_0x6d9c('0x30')][_0x6d9c('0x46')]){_0xcbf591[_0x6d9c('0x41')]=[{'all':!![]}];}_0xcbf591=_[_0x6d9c('0x3d')]({},_0xcbf591,_0x3f561a['options']);return db[_0x6d9c('0x3f')]['find'](_0xcbf591)[_0x6d9c('0x25')](handleEntityNotFound(_0x164071,null))[_0x6d9c('0x25')](respondWithResult(_0x164071,null))[_0x6d9c('0x44')](handleError(_0x164071,null));};exports[_0x6d9c('0x47')]=function(_0x223cc,_0x1d7595){return db[_0x6d9c('0x3f')][_0x6d9c('0x47')](_0x223cc[_0x6d9c('0x48')],{})[_0x6d9c('0x25')](respondWithResult(_0x1d7595,0xc9))[_0x6d9c('0x44')](handleError(_0x1d7595,null));};exports[_0x6d9c('0x24')]=function(_0x339bd6,_0x161254){if(_0x339bd6[_0x6d9c('0x48')]['id']){delete _0x339bd6[_0x6d9c('0x48')]['id'];}return db[_0x6d9c('0x3f')][_0x6d9c('0x49')]({'where':{'id':_0x339bd6[_0x6d9c('0x45')]['id']}})[_0x6d9c('0x25')](handleEntityNotFound(_0x161254,null))[_0x6d9c('0x25')](saveUpdates(_0x339bd6[_0x6d9c('0x48')],null))[_0x6d9c('0x25')](respondWithResult(_0x161254,null))[_0x6d9c('0x44')](handleError(_0x161254,null));};exports[_0x6d9c('0x26')]=function(_0x473943,_0x4032cd){return db[_0x6d9c('0x3f')]['find']({'where':{'id':_0x473943[_0x6d9c('0x45')]['id']}})['then'](handleEntityNotFound(_0x4032cd,null))[_0x6d9c('0x25')](removeEntity(_0x4032cd,null))[_0x6d9c('0x44')](handleError(_0x4032cd,null));};exports[_0x6d9c('0x4a')]=function(_0x2526e5,_0x2b0a4e,_0x32f1a0){var _0x4d750c={};var _0x2df285={};var _0x4d82f6;var _0x43873a;return db[_0x6d9c('0x3f')][_0x6d9c('0x4b')]({'where':{'id':_0x2526e5[_0x6d9c('0x45')]['id']}})['then'](handleEntityNotFound(_0x2b0a4e,null))[_0x6d9c('0x25')](function(_0x4ced50){if(_0x4ced50){_0x4d82f6=_0x4ced50;_0x2df285[_0x6d9c('0x2f')]=_[_0x6d9c('0x31')](db[_0x6d9c('0x4c')][_0x6d9c('0x2b')]);_0x2df285[_0x6d9c('0x30')]=_[_0x6d9c('0x31')](_0x2526e5['query']);_0x2df285['filters']=_['intersection'](_0x2df285['model'],_0x2df285[_0x6d9c('0x30')]);_0x4d750c['attributes']=_[_0x6d9c('0x33')](_0x2df285[_0x6d9c('0x2f')],qs['fields'](_0x2526e5[_0x6d9c('0x30')]['fields']));_0x4d750c['attributes']=_0x4d750c[_0x6d9c('0x34')][_0x6d9c('0x36')]?_0x4d750c[_0x6d9c('0x34')]:_0x2df285[_0x6d9c('0x2f')];_0x4d750c[_0x6d9c('0x39')]=qs[_0x6d9c('0x3a')](_0x2526e5[_0x6d9c('0x30')][_0x6d9c('0x3a')]);_0x4d750c['where']=qs[_0x6d9c('0x32')](_[_0x6d9c('0x4d')](_0x2526e5[_0x6d9c('0x30')],_0x2df285[_0x6d9c('0x32')]));if(_0x2526e5[_0x6d9c('0x30')][_0x6d9c('0x3c')]){_0x4d750c[_0x6d9c('0x3b')]=_[_0x6d9c('0x3d')](_0x4d750c['where'],{'$or':_['map'](_0x4d750c[_0x6d9c('0x34')],function(_0x1f6a29){var _0x17327e={};_0x17327e[_0x1f6a29]={'$like':'%'+_0x2526e5[_0x6d9c('0x30')]['filter']+'%'};return _0x17327e;})});}_0x4d750c=_[_0x6d9c('0x3d')]({},_0x4d750c,_0x2526e5[_0x6d9c('0x3e')]);return _0x4d82f6[_0x6d9c('0x4a')](_0x4d750c);}})[_0x6d9c('0x25')](function(_0x421222){if(_0x421222){_0x43873a=_0x421222['length'];if(!_0x2526e5[_0x6d9c('0x30')]['hasOwnProperty'](_0x6d9c('0x38'))){_0x4d750c[_0x6d9c('0x20')]=qs[_0x6d9c('0x20')](_0x2526e5[_0x6d9c('0x30')][_0x6d9c('0x20')]);_0x4d750c['offset']=qs[_0x6d9c('0x1e')](_0x2526e5[_0x6d9c('0x30')][_0x6d9c('0x1e')]);}return _0x4d82f6['getConfigurations'](_0x4d750c);}})['then'](function(_0x1277f1){if(_0x1277f1){return _0x1277f1?{'count':_0x43873a,'rows':_0x1277f1}:null;}})[_0x6d9c('0x25')](respondWithResult(_0x2b0a4e,null))['catch'](handleError(_0x2b0a4e,null));};exports[_0x6d9c('0x4e')]=function(_0x4ac04f,_0x294b83,_0x44aa72){if(_0x4ac04f['body']['id']){delete _0x4ac04f['body']['id'];}return db[_0x6d9c('0x3f')][_0x6d9c('0x4b')]({'where':{'id':_0x4ac04f[_0x6d9c('0x45')]['id']}})[_0x6d9c('0x25')](handleEntityNotFound(_0x294b83,null))[_0x6d9c('0x25')](function(_0x32b1d4){if(_0x32b1d4){_0x4ac04f[_0x6d9c('0x48')][_0x6d9c('0x4f')]=_0x32b1d4['id'];_0x4ac04f[_0x6d9c('0x48')]['Subjects']=integrations[_0x6d9c('0x50')](_0x4ac04f['body'][_0x6d9c('0x51')],_0x4ac04f[_0x6d9c('0x48')]['type']);_0x4ac04f[_0x6d9c('0x48')]['Descriptions']=integrations[_0x6d9c('0x52')](_0x4ac04f[_0x6d9c('0x48')][_0x6d9c('0x51')],_0x4ac04f[_0x6d9c('0x48')]['type']);return db[_0x6d9c('0x4c')][_0x6d9c('0x47')](_0x4ac04f[_0x6d9c('0x48')],{'include':[{'model':db[_0x6d9c('0x53')],'as':_0x6d9c('0x54')},{'model':db[_0x6d9c('0x53')],'as':_0x6d9c('0x55')}]});}return null;})[_0x6d9c('0x25')](respondWithResult(_0x294b83,null))[_0x6d9c('0x44')](handleError(_0x294b83,null));};var md5=require(_0x6d9c('0x56'));exports['getFields']=function(_0x3b8925,_0x16b412,_0x86086a){var _0x58881c=null;var _0x58e09c=null;var _0x1fc600=null;var _0x587a3b=null;var _0x17293f='';return db[_0x6d9c('0x3f')][_0x6d9c('0x4b')]({'where':{'id':_0x3b8925[_0x6d9c('0x45')]['id']},'attributes':['id',_0x6d9c('0x28'),_0x6d9c('0x57'),_0x6d9c('0x58'),_0x6d9c('0x59'),_0x6d9c('0x5a'),_0x6d9c('0x5b'),_0x6d9c('0x5c')]})[_0x6d9c('0x25')](handleEntityNotFound(_0x16b412,null))[_0x6d9c('0x25')](function(_0x1cd20f){if(_0x1cd20f){_0x58881c=_0x1cd20f[_0x6d9c('0x57')];_0x58e09c=_0x1cd20f[_0x6d9c('0x5c')];_0x1fc600=_0x1cd20f['moduleName'];_0x17293f=_0x1cd20f[_0x6d9c('0x5a')];var _0x22b220=_0x17293f[_0x6d9c('0x5d')](-0x1);if(_0x22b220==='/'){_0x17293f=_0x17293f[_0x6d9c('0x5e')](0x0,_0x17293f['lastIndexOf'](_0x22b220));}_0x587a3b=util[_0x6d9c('0x5f')]('%s/webservice.php',_0x17293f);var _0x17e098={'method':_0x6d9c('0x60'),'uri':_0x587a3b,'qs':{'operation':_0x6d9c('0x61'),'username':_0x1cd20f[_0x6d9c('0x57')]},'json':!![]};return rp(_0x17e098);}})[_0x6d9c('0x25')](function(_0x3254ef){if(_0x3254ef['success']){var _0x5705d1={'method':'POST','uri':_0x587a3b,'form':{'operation':_0x6d9c('0x62'),'username':_0x58881c,'accessKey':md5(_0x3254ef['result'][_0x6d9c('0x63')]+_0x58e09c)},'json':!![]};return rp(_0x5705d1);}})[_0x6d9c('0x25')](function(_0x2f18ed){if(_0x2f18ed['success']){var _0x16976a={'method':_0x6d9c('0x60'),'uri':_0x587a3b,'qs':{'operation':_0x6d9c('0x64'),'username':_0x58881c,'sessionName':_0x2f18ed[_0x6d9c('0x65')][_0x6d9c('0x66')],'elementType':_0x1fc600},'json':!![]};return rp(_0x16976a);}})[_0x6d9c('0x25')](function(_0x453bd1){if(_0x453bd1[_0x6d9c('0x67')]){var _0x1e008a=[_0x6d9c('0x68'),'reference','owner'];_[_0x6d9c('0x69')](_0x453bd1[_0x6d9c('0x65')][_0x6d9c('0x35')],function(_0x6da60){return _0x1e008a[_0x6d9c('0x6a')](_0x6da60['type'][_0x6d9c('0x28')]);});_[_0x6d9c('0x69')](_0x453bd1['result'][_0x6d9c('0x35')],function(_0x3ade87){return _0x3ade87[_0x6d9c('0x6b')]===_0x6d9c('0x6c');});return{'count':_0x453bd1['result']['fields'][_0x6d9c('0x36')],'rows':_[_0x6d9c('0x2a')](_0x453bd1[_0x6d9c('0x65')][_0x6d9c('0x35')],function(_0x4563e7){return{'id':_0x4563e7[_0x6d9c('0x28')],'name':_0x4563e7[_0x6d9c('0x6d')],'custom':_['startsWith'](_0x4563e7[_0x6d9c('0x28')],_0x6d9c('0x6e'))?!![]:![],'options':_0x4563e7[_0x6d9c('0x2d')]['name']===_0x6d9c('0x6f')&&_0x4563e7[_0x6d9c('0x2d')][_0x6d9c('0x70')]['length']>0x0?_[_0x6d9c('0x2a')](_0x4563e7['type'][_0x6d9c('0x70')],function(_0x5c27b0){return{'name':_0x5c27b0[_0x6d9c('0x6d')],'value':_0x5c27b0['value']};}):[]};})};}})[_0x6d9c('0x25')](respondWithResult(_0x16b412,null))[_0x6d9c('0x44')](function(_0x316d65){console[_0x6d9c('0x71')]('vTiger\x20error:\x20'+_0x316d65);var _0x4534c7=_0x3b8925[_0x6d9c('0x30')][_0x6d9c('0x72')]?0x1f4:_0x316d65[_0x6d9c('0x73')]||0x1f4;logger[_0x6d9c('0x74')]('getFields,\x20%s,\x20%s,\x20%s',_0x6d9c('0x75'),_0x4534c7,JSON[_0x6d9c('0x76')](_0x316d65));delete _0x316d65[_0x6d9c('0x28')];if(_0x4534c7===0x191){_0x4534c7=0x190;}_0x16b412['status'](_0x4534c7)['send'](_0x3b8925[_0x6d9c('0x30')][_0x6d9c('0x72')]?{'message':_0x6d9c('0x77'),'statusCode':_0x316d65[_0x6d9c('0x73')]}:_0x316d65);});}; \ No newline at end of file +var _0xac23=['Subjects','md5','getFields','username','description','remoteUri','serverUrl','accessKey','moduleName','slice','substring','format','GET','success','POST','describe','autogenerated','owner','remove','result','includes','false','label','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','zip-dir','fast-json-patch','bluebird','mustache','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','end','error','stack','name','index','map','VtigerAccount','rawAttributes','fieldName','key','query','keys','filters','intersection','fields','attributes','model','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','catch','destroy','getConfigurations','findOne','VtigerConfiguration','length','order','pick','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','VtigerField'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac23,0x97));var _0x3ac2=function(_0x5ee1ef,_0x8d83d5){_0x5ee1ef=_0x5ee1ef-0x0;var _0x601cdc=_0xac23[_0x5ee1ef];return _0x601cdc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3ac2('0x0'));var jsonpatch=require(_0x3ac2('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3ac2('0x2'));var Mustache=require(_0x3ac2('0x3'));var util=require('util');var path=require('path');var sox=require(_0x3ac2('0x4'));var csv=require(_0x3ac2('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3ac2('0x6'));var squel=require(_0x3ac2('0x7'));var crypto=require(_0x3ac2('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x3ac2('0x9'));var toCsv=require('to-csv');var querystring=require(_0x3ac2('0xa'));var Papa=require(_0x3ac2('0xb'));var Redis=require(_0x3ac2('0xc'));var authService=require(_0x3ac2('0xd'));var qs=require(_0x3ac2('0xe'));var as=require(_0x3ac2('0xf'));var hardwareService=require(_0x3ac2('0x10'));var logger=require(_0x3ac2('0x11'))('api');var utils=require(_0x3ac2('0x12'));var config=require(_0x3ac2('0x13'));var licenseUtil=require(_0x3ac2('0x14'));var db=require(_0x3ac2('0x15'))['db'];var integrations=require(_0x3ac2('0x16'));function respondWithStatusCode(_0x2f2e28,_0x57e956){_0x57e956=_0x57e956||0xcc;return function(_0x584b74){if(_0x584b74){return _0x2f2e28[_0x3ac2('0x17')](_0x57e956);}return _0x2f2e28['status'](_0x57e956)['end']();};}function respondWithResult(_0x4c57b8,_0x3bc64b){_0x3bc64b=_0x3bc64b||0xc8;return function(_0x23a806){if(_0x23a806){return _0x4c57b8[_0x3ac2('0x18')](_0x3bc64b)['json'](_0x23a806);}};}function respondWithFilteredResult(_0x33a6ec,_0x249c77){return function(_0x53c9e0){if(_0x53c9e0){var _0x95574f=typeof _0x249c77[_0x3ac2('0x19')]==='undefined'&&typeof _0x249c77[_0x3ac2('0x1a')]===_0x3ac2('0x1b');var _0x1bc8e6=_0x53c9e0[_0x3ac2('0x1c')];var _0x291528=_0x95574f?0x0:_0x249c77[_0x3ac2('0x19')];var _0x891421=_0x95574f?_0x53c9e0['count']:_0x249c77['offset']+_0x249c77[_0x3ac2('0x1a')];var _0x3cbe83;if(_0x891421>=_0x1bc8e6){_0x891421=_0x1bc8e6;_0x3cbe83=0xc8;}else{_0x3cbe83=0xce;}_0x33a6ec['status'](_0x3cbe83);return _0x33a6ec[_0x3ac2('0x1d')](_0x3ac2('0x1e'),_0x291528+'-'+_0x891421+'/'+_0x1bc8e6)['json'](_0x53c9e0);}return null;};}function patchUpdates(_0x56f1a5){return function(_0x9e5ad6){try{jsonpatch[_0x3ac2('0x1f')](_0x9e5ad6,_0x56f1a5,!![]);}catch(_0x107f85){return BPromise['reject'](_0x107f85);}return _0x9e5ad6[_0x3ac2('0x20')]();};}function saveUpdates(_0x478578,_0x15ea23){return function(_0x1b7ab9){if(_0x1b7ab9){return _0x1b7ab9[_0x3ac2('0x21')](_0x478578)[_0x3ac2('0x22')](function(_0x4be753){return _0x4be753;});}return null;};}function removeEntity(_0x300183,_0x5f034e){return function(_0x366493){if(_0x366493){return _0x366493['destroy']()[_0x3ac2('0x22')](function(){_0x300183['status'](0xcc)[_0x3ac2('0x23')]();});}};}function handleEntityNotFound(_0xc48623,_0xbdf77){return function(_0x543e86){if(!_0x543e86){_0xc48623[_0x3ac2('0x17')](0x194);}return _0x543e86;};}function handleError(_0x5e5333,_0x16351d){_0x16351d=_0x16351d||0x1f4;return function(_0x249699){logger[_0x3ac2('0x24')](_0x249699[_0x3ac2('0x25')]);if(_0x249699[_0x3ac2('0x26')]){delete _0x249699[_0x3ac2('0x26')];}_0x5e5333[_0x3ac2('0x18')](_0x16351d)['send'](_0x249699);};}exports[_0x3ac2('0x27')]=function(_0x7bb21d,_0x45ae86){var _0x7038b1={},_0x411ac9={},_0x3653b9={'count':0x0,'rows':[]};var _0x28ddbe=_[_0x3ac2('0x28')](db[_0x3ac2('0x29')][_0x3ac2('0x2a')],function(_0x49337e){return{'name':_0x49337e[_0x3ac2('0x2b')],'type':_0x49337e['type'][_0x3ac2('0x2c')]};});_0x411ac9['model']=_[_0x3ac2('0x28')](_0x28ddbe,_0x3ac2('0x26'));_0x411ac9[_0x3ac2('0x2d')]=_[_0x3ac2('0x2e')](_0x7bb21d[_0x3ac2('0x2d')]);_0x411ac9[_0x3ac2('0x2f')]=_['intersection'](_0x411ac9['model'],_0x411ac9[_0x3ac2('0x2d')]);_0x7038b1['attributes']=_[_0x3ac2('0x30')](_0x411ac9['model'],qs[_0x3ac2('0x31')](_0x7bb21d[_0x3ac2('0x2d')][_0x3ac2('0x31')]));_0x7038b1[_0x3ac2('0x32')]=_0x7038b1[_0x3ac2('0x32')]['length']?_0x7038b1[_0x3ac2('0x32')]:_0x411ac9[_0x3ac2('0x33')];if(!_0x7bb21d[_0x3ac2('0x2d')][_0x3ac2('0x34')](_0x3ac2('0x35'))){_0x7038b1[_0x3ac2('0x1a')]=qs[_0x3ac2('0x1a')](_0x7bb21d[_0x3ac2('0x2d')][_0x3ac2('0x1a')]);_0x7038b1[_0x3ac2('0x19')]=qs[_0x3ac2('0x19')](_0x7bb21d[_0x3ac2('0x2d')][_0x3ac2('0x19')]);}_0x7038b1['order']=qs['sort'](_0x7bb21d[_0x3ac2('0x2d')][_0x3ac2('0x36')]);_0x7038b1[_0x3ac2('0x37')]=qs[_0x3ac2('0x2f')](_['pick'](_0x7bb21d[_0x3ac2('0x2d')],_0x411ac9[_0x3ac2('0x2f')]),_0x28ddbe);if(_0x7bb21d[_0x3ac2('0x2d')][_0x3ac2('0x38')]){_0x7038b1[_0x3ac2('0x37')]=_[_0x3ac2('0x39')](_0x7038b1['where'],{'$or':_['map'](_0x28ddbe,function(_0x22a438){if(_0x22a438[_0x3ac2('0x3a')]!==_0x3ac2('0x3b')){var _0xc8417b={};_0xc8417b[_0x22a438['name']]={'$like':'%'+_0x7bb21d['query']['filter']+'%'};return _0xc8417b;}})});}_0x7038b1=_[_0x3ac2('0x39')]({},_0x7038b1,_0x7bb21d[_0x3ac2('0x3c')]);var _0x3b62be={'where':_0x7038b1[_0x3ac2('0x37')]};return db['VtigerAccount'][_0x3ac2('0x1c')](_0x3b62be)['then'](function(_0x2541f0){_0x3653b9[_0x3ac2('0x1c')]=_0x2541f0;if(_0x7bb21d[_0x3ac2('0x2d')][_0x3ac2('0x3d')]){_0x7038b1[_0x3ac2('0x3e')]=[{'all':!![]}];}return db[_0x3ac2('0x29')][_0x3ac2('0x3f')](_0x7038b1);})[_0x3ac2('0x22')](function(_0x32f1be){_0x3653b9[_0x3ac2('0x40')]=_0x32f1be;return _0x3653b9;})[_0x3ac2('0x22')](respondWithFilteredResult(_0x45ae86,_0x7038b1))['catch'](handleError(_0x45ae86,null));};exports[_0x3ac2('0x41')]=function(_0x555b1a,_0x230949){var _0x3ceb71={'raw':![],'where':{'id':_0x555b1a[_0x3ac2('0x42')]['id']}},_0x11406c={};_0x11406c['model']=_[_0x3ac2('0x2e')](db['VtigerAccount'][_0x3ac2('0x2a')]);_0x11406c[_0x3ac2('0x2d')]=_[_0x3ac2('0x2e')](_0x555b1a[_0x3ac2('0x2d')]);_0x11406c[_0x3ac2('0x2f')]=_[_0x3ac2('0x30')](_0x11406c[_0x3ac2('0x33')],_0x11406c['query']);_0x3ceb71[_0x3ac2('0x32')]=_[_0x3ac2('0x30')](_0x11406c['model'],qs[_0x3ac2('0x31')](_0x555b1a['query'][_0x3ac2('0x31')]));_0x3ceb71['attributes']=_0x3ceb71[_0x3ac2('0x32')]['length']?_0x3ceb71[_0x3ac2('0x32')]:_0x11406c[_0x3ac2('0x33')];if(_0x555b1a[_0x3ac2('0x2d')][_0x3ac2('0x3d')]){_0x3ceb71['include']=[{'all':!![]}];}_0x3ceb71=_['merge']({},_0x3ceb71,_0x555b1a['options']);return db['VtigerAccount'][_0x3ac2('0x43')](_0x3ceb71)[_0x3ac2('0x22')](handleEntityNotFound(_0x230949,null))['then'](respondWithResult(_0x230949,null))['catch'](handleError(_0x230949,null));};exports['create']=function(_0x528939,_0x1b076b){return db['VtigerAccount'][_0x3ac2('0x44')](_0x528939[_0x3ac2('0x45')],{})[_0x3ac2('0x22')](respondWithResult(_0x1b076b,0xc9))[_0x3ac2('0x46')](handleError(_0x1b076b,null));};exports['update']=function(_0x3a087e,_0x2eccaf){if(_0x3a087e[_0x3ac2('0x45')]['id']){delete _0x3a087e[_0x3ac2('0x45')]['id'];}return db[_0x3ac2('0x29')][_0x3ac2('0x43')]({'where':{'id':_0x3a087e['params']['id']}})[_0x3ac2('0x22')](handleEntityNotFound(_0x2eccaf,null))['then'](saveUpdates(_0x3a087e[_0x3ac2('0x45')],null))[_0x3ac2('0x22')](respondWithResult(_0x2eccaf,null))[_0x3ac2('0x46')](handleError(_0x2eccaf,null));};exports[_0x3ac2('0x47')]=function(_0x323e6e,_0x3898c5){return db['VtigerAccount'][_0x3ac2('0x43')]({'where':{'id':_0x323e6e[_0x3ac2('0x42')]['id']}})[_0x3ac2('0x22')](handleEntityNotFound(_0x3898c5,null))[_0x3ac2('0x22')](removeEntity(_0x3898c5,null))[_0x3ac2('0x46')](handleError(_0x3898c5,null));};exports[_0x3ac2('0x48')]=function(_0xdfffb7,_0x4fc64b,_0x109b83){var _0x363ae6={};var _0xbe6318={};var _0x2c1097;var _0x3ca804;return db['VtigerAccount'][_0x3ac2('0x49')]({'where':{'id':_0xdfffb7['params']['id']}})['then'](handleEntityNotFound(_0x4fc64b,null))[_0x3ac2('0x22')](function(_0x1f30fa){if(_0x1f30fa){_0x2c1097=_0x1f30fa;_0xbe6318[_0x3ac2('0x33')]=_[_0x3ac2('0x2e')](db[_0x3ac2('0x4a')][_0x3ac2('0x2a')]);_0xbe6318[_0x3ac2('0x2d')]=_['keys'](_0xdfffb7[_0x3ac2('0x2d')]);_0xbe6318[_0x3ac2('0x2f')]=_[_0x3ac2('0x30')](_0xbe6318[_0x3ac2('0x33')],_0xbe6318[_0x3ac2('0x2d')]);_0x363ae6[_0x3ac2('0x32')]=_[_0x3ac2('0x30')](_0xbe6318[_0x3ac2('0x33')],qs[_0x3ac2('0x31')](_0xdfffb7[_0x3ac2('0x2d')][_0x3ac2('0x31')]));_0x363ae6[_0x3ac2('0x32')]=_0x363ae6[_0x3ac2('0x32')][_0x3ac2('0x4b')]?_0x363ae6[_0x3ac2('0x32')]:_0xbe6318['model'];_0x363ae6[_0x3ac2('0x4c')]=qs[_0x3ac2('0x36')](_0xdfffb7[_0x3ac2('0x2d')][_0x3ac2('0x36')]);_0x363ae6[_0x3ac2('0x37')]=qs[_0x3ac2('0x2f')](_[_0x3ac2('0x4d')](_0xdfffb7['query'],_0xbe6318['filters']));if(_0xdfffb7['query'][_0x3ac2('0x38')]){_0x363ae6[_0x3ac2('0x37')]=_[_0x3ac2('0x39')](_0x363ae6[_0x3ac2('0x37')],{'$or':_[_0x3ac2('0x28')](_0x363ae6[_0x3ac2('0x32')],function(_0xe0b17e){var _0x20a7d3={};_0x20a7d3[_0xe0b17e]={'$like':'%'+_0xdfffb7['query']['filter']+'%'};return _0x20a7d3;})});}_0x363ae6=_[_0x3ac2('0x39')]({},_0x363ae6,_0xdfffb7[_0x3ac2('0x3c')]);return _0x2c1097['getConfigurations'](_0x363ae6);}})[_0x3ac2('0x22')](function(_0x2c89b8){if(_0x2c89b8){_0x3ca804=_0x2c89b8[_0x3ac2('0x4b')];if(!_0xdfffb7['query']['hasOwnProperty'](_0x3ac2('0x35'))){_0x363ae6[_0x3ac2('0x1a')]=qs[_0x3ac2('0x1a')](_0xdfffb7[_0x3ac2('0x2d')][_0x3ac2('0x1a')]);_0x363ae6[_0x3ac2('0x19')]=qs[_0x3ac2('0x19')](_0xdfffb7[_0x3ac2('0x2d')][_0x3ac2('0x19')]);}return _0x2c1097[_0x3ac2('0x48')](_0x363ae6);}})[_0x3ac2('0x22')](function(_0x54c61a){if(_0x54c61a){return _0x54c61a?{'count':_0x3ca804,'rows':_0x54c61a}:null;}})[_0x3ac2('0x22')](respondWithResult(_0x4fc64b,null))[_0x3ac2('0x46')](handleError(_0x4fc64b,null));};exports[_0x3ac2('0x4e')]=function(_0x1980c9,_0x4dc6fb,_0x46ea9b){if(_0x1980c9['body']['id']){delete _0x1980c9[_0x3ac2('0x45')]['id'];}return db[_0x3ac2('0x29')]['findOne']({'where':{'id':_0x1980c9[_0x3ac2('0x42')]['id']}})[_0x3ac2('0x22')](handleEntityNotFound(_0x4dc6fb,null))[_0x3ac2('0x22')](function(_0x9aaf37){if(_0x9aaf37){_0x1980c9['body'][_0x3ac2('0x4f')]=_0x9aaf37['id'];_0x1980c9[_0x3ac2('0x45')]['Subjects']=integrations[_0x3ac2('0x50')](_0x1980c9['body'][_0x3ac2('0x51')],_0x1980c9['body'][_0x3ac2('0x3a')]);_0x1980c9[_0x3ac2('0x45')][_0x3ac2('0x52')]=integrations[_0x3ac2('0x53')](_0x1980c9[_0x3ac2('0x45')][_0x3ac2('0x51')],_0x1980c9['body'][_0x3ac2('0x3a')]);return db[_0x3ac2('0x4a')][_0x3ac2('0x44')](_0x1980c9['body'],{'include':[{'model':db[_0x3ac2('0x54')],'as':_0x3ac2('0x55')},{'model':db[_0x3ac2('0x54')],'as':_0x3ac2('0x52')}]});}return null;})[_0x3ac2('0x22')](respondWithResult(_0x4dc6fb,null))['catch'](handleError(_0x4dc6fb,null));};var md5=require(_0x3ac2('0x56'));exports[_0x3ac2('0x57')]=function(_0x33b5d8,_0x4b4962,_0x53f013){var _0x43ef84=null;var _0x2ca6e2=null;var _0x14d55f=null;var _0x16862c=null;var _0x47420a='';return db[_0x3ac2('0x29')][_0x3ac2('0x49')]({'where':{'id':_0x33b5d8[_0x3ac2('0x42')]['id']},'attributes':['id',_0x3ac2('0x26'),_0x3ac2('0x58'),_0x3ac2('0x59'),'moduleName',_0x3ac2('0x5a'),_0x3ac2('0x5b'),_0x3ac2('0x5c')]})['then'](handleEntityNotFound(_0x4b4962,null))[_0x3ac2('0x22')](function(_0x4b5d3b){if(_0x4b5d3b){_0x43ef84=_0x4b5d3b['username'];_0x2ca6e2=_0x4b5d3b['accessKey'];_0x14d55f=_0x4b5d3b[_0x3ac2('0x5d')];_0x47420a=_0x4b5d3b[_0x3ac2('0x5a')];var _0x29da08=_0x47420a[_0x3ac2('0x5e')](-0x1);if(_0x29da08==='/'){_0x47420a=_0x47420a[_0x3ac2('0x5f')](0x0,_0x47420a['lastIndexOf'](_0x29da08));}_0x16862c=util[_0x3ac2('0x60')]('%s/webservice.php',_0x47420a);var _0x1356d7={'method':_0x3ac2('0x61'),'uri':_0x16862c,'qs':{'operation':'getchallenge','username':_0x4b5d3b[_0x3ac2('0x58')]},'json':!![]};return rp(_0x1356d7);}})[_0x3ac2('0x22')](function(_0x451657){if(_0x451657[_0x3ac2('0x62')]){var _0x43fbc9={'method':_0x3ac2('0x63'),'uri':_0x16862c,'form':{'operation':'login','username':_0x43ef84,'accessKey':md5(_0x451657['result']['token']+_0x2ca6e2)},'json':!![]};return rp(_0x43fbc9);}})[_0x3ac2('0x22')](function(_0x4ab9ed){if(_0x4ab9ed['success']){var _0x57d4d8={'method':_0x3ac2('0x61'),'uri':_0x16862c,'qs':{'operation':_0x3ac2('0x64'),'username':_0x43ef84,'sessionName':_0x4ab9ed['result']['sessionName'],'elementType':_0x14d55f},'json':!![]};return rp(_0x57d4d8);}})[_0x3ac2('0x22')](function(_0x4270fe){if(_0x4270fe[_0x3ac2('0x62')]){var _0x23fd3a=[_0x3ac2('0x65'),'reference',_0x3ac2('0x66')];_[_0x3ac2('0x67')](_0x4270fe[_0x3ac2('0x68')][_0x3ac2('0x31')],function(_0x33b729){return _0x23fd3a[_0x3ac2('0x69')](_0x33b729[_0x3ac2('0x3a')]['name']);});_['remove'](_0x4270fe[_0x3ac2('0x68')][_0x3ac2('0x31')],function(_0xc3aea5){return _0xc3aea5['editable']===_0x3ac2('0x6a');});return{'count':_0x4270fe[_0x3ac2('0x68')]['fields']['length'],'rows':_[_0x3ac2('0x28')](_0x4270fe[_0x3ac2('0x68')]['fields'],function(_0x57c319){return{'id':_0x57c319[_0x3ac2('0x26')],'name':_0x57c319[_0x3ac2('0x6b')],'custom':_['startsWith'](_0x57c319[_0x3ac2('0x26')],_0x3ac2('0x6c'))?!![]:![],'options':_0x57c319['type'][_0x3ac2('0x26')]===_0x3ac2('0x6d')&&_0x57c319[_0x3ac2('0x3a')]['picklistValues'][_0x3ac2('0x4b')]>0x0?_[_0x3ac2('0x28')](_0x57c319[_0x3ac2('0x3a')][_0x3ac2('0x6e')],function(_0x1a53aa){return{'name':_0x1a53aa[_0x3ac2('0x6b')],'value':_0x1a53aa[_0x3ac2('0x6f')]};}):[]};})};}})[_0x3ac2('0x22')](respondWithResult(_0x4b4962,null))['catch'](function(_0x55db1a){console[_0x3ac2('0x70')](_0x3ac2('0x71')+_0x55db1a);var _0x54aa6c=_0x33b5d8[_0x3ac2('0x2d')][_0x3ac2('0x72')]?0x1f4:_0x55db1a[_0x3ac2('0x73')]||0x1f4;logger['error'](_0x3ac2('0x74'),_0x3ac2('0x57'),_0x54aa6c,JSON['stringify'](_0x55db1a));delete _0x55db1a[_0x3ac2('0x26')];if(_0x54aa6c===0x191){_0x54aa6c=0x190;}_0x4b4962[_0x3ac2('0x18')](_0x54aa6c)['send'](_0x33b5d8[_0x3ac2('0x2d')][_0x3ac2('0x72')]?{'message':_0x3ac2('0x75'),'statusCode':_0x55db1a['statusCode']}:_0x55db1a);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 43e21cb..d671269 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 _0x2e17=['util','api','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','define','lodash'];(function(_0xc2fc17,_0x2b78be){var _0x5b4fe0=function(_0x5f1e00){while(--_0x5f1e00){_0xc2fc17['push'](_0xc2fc17['shift']());}};_0x5b4fe0(++_0x2b78be);}(_0x2e17,0x98));var _0x72e1=function(_0x2601b4,_0x315e78){_0x2601b4=_0x2601b4-0x0;var _0x3e3661=_0x2e17[_0x2601b4];return _0x3e3661;};'use strict';var _=require(_0x72e1('0x0'));var util=require(_0x72e1('0x1'));var logger=require('../../config/logger')(_0x72e1('0x2'));var moment=require('moment');var BPromise=require(_0x72e1('0x3'));var rp=require(_0x72e1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x72e1('0x5'));var config=require(_0x72e1('0x6'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x72e1('0x7'));module['exports']=function(_0x26f444,_0x2fe2f1){return _0x26f444[_0x72e1('0x8')]('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x338b=['request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes','exports','define','int_vtiger_accounts','lodash','util','api','moment'];(function(_0x1dccea,_0x52c8b6){var _0x2a3c3f=function(_0x331ab7){while(--_0x331ab7){_0x1dccea['push'](_0x1dccea['shift']());}};_0x2a3c3f(++_0x52c8b6);}(_0x338b,0x8b));var _0xb338=function(_0x3331b,_0x33cadc){_0x3331b=_0x3331b-0x0;var _0x13fce8=_0x338b[_0x3331b];return _0x13fce8;};'use strict';var _=require(_0xb338('0x0'));var util=require(_0xb338('0x1'));var logger=require('../../config/logger')(_0xb338('0x2'));var moment=require(_0xb338('0x3'));var BPromise=require('bluebird');var rp=require(_0xb338('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb338('0x5'));var config=require(_0xb338('0x6'));var attributes=require(_0xb338('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xb338('0x8')]=function(_0xeaca15,_0x189e2f){return _0xeaca15[_0xb338('0x9')]('VtigerAccount',attributes,{'tableName':_0xb338('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 39722c9..c9e2ea9 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 _0x593e=['findAll','options','raw','where','attributes','limit','include','model','map','stringify','ShowVtigerAccount','VtigerAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','GetVtigerAccount'];(function(_0x4839d0,_0x1f5c36){var _0xefa7c4=function(_0x37c902){while(--_0x37c902){_0x4839d0['push'](_0x4839d0['shift']());}};_0xefa7c4(++_0x1f5c36);}(_0x593e,0xcb));var _0xe593=function(_0x56d3ea,_0x723b5b){_0x56d3ea=_0x56d3ea-0x0;var _0x5ab25a=_0x593e[_0x56d3ea];return _0x5ab25a;};'use strict';var _=require(_0xe593('0x0'));var util=require(_0xe593('0x1'));var moment=require(_0xe593('0x2'));var BPromise=require(_0xe593('0x3'));var rs=require(_0xe593('0x4'));var fs=require('fs');var Redis=require(_0xe593('0x5'));var db=require(_0xe593('0x6'))['db'];var utils=require(_0xe593('0x7'));var logger=require('../../config/logger')(_0xe593('0x8'));var config=require(_0xe593('0x9'));var jayson=require(_0xe593('0xa'));var client=jayson[_0xe593('0xb')][_0xe593('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14cff3,_0x1cda29,_0x307dad){return new BPromise(function(_0x169c08,_0x265099){return client['request'](_0x14cff3,_0x307dad)[_0xe593('0xd')](function(_0x4091db){logger[_0xe593('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x1cda29,'request\x20sent');logger[_0xe593('0xf')](_0xe593('0x10'),_0x1cda29,_0xe593('0x11'),JSON['stringify'](_0x4091db));if(_0x4091db[_0xe593('0x12')]){if(_0x4091db[_0xe593('0x12')][_0xe593('0x13')]===0x1f4){logger[_0xe593('0x12')](_0xe593('0x14'),_0x1cda29,_0x4091db[_0xe593('0x12')][_0xe593('0x15')]);return _0x265099(_0x4091db[_0xe593('0x12')][_0xe593('0x15')]);}logger[_0xe593('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x1cda29,_0x4091db[_0xe593('0x12')][_0xe593('0x15')]);return _0x169c08(_0x4091db['error'][_0xe593('0x15')]);}else{logger[_0xe593('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x1cda29,_0xe593('0x11'));_0x169c08(_0x4091db[_0xe593('0x16')][_0xe593('0x15')]);}})[_0xe593('0x17')](function(_0x3408ec){logger[_0xe593('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x1cda29,_0x3408ec);_0x265099(_0x3408ec);});});}exports[_0xe593('0x18')]=function(_0x470d07){var _0x5f57ce=this;return new Promise(function(_0xd1020e,_0x28b5ed){return db['VtigerAccount'][_0xe593('0x19')]({'raw':_0x470d07[_0xe593('0x1a')]?_0x470d07[_0xe593('0x1a')][_0xe593('0x1b')]===undefined?!![]:![]:!![],'where':_0x470d07[_0xe593('0x1a')]?_0x470d07[_0xe593('0x1a')][_0xe593('0x1c')]||null:null,'attributes':_0x470d07['options']?_0x470d07['options'][_0xe593('0x1d')]||null:null,'limit':_0x470d07['options']?_0x470d07['options'][_0xe593('0x1e')]||null:null,'include':_0x470d07[_0xe593('0x1a')]?_0x470d07['options'][_0xe593('0x1f')]?_['map'](_0x470d07[_0xe593('0x1a')][_0xe593('0x1f')],function(_0x185cea){return{'model':db[_0x185cea[_0xe593('0x20')]],'as':_0x185cea['as'],'attributes':_0x185cea[_0xe593('0x1d')],'include':_0x185cea[_0xe593('0x1f')]?_[_0xe593('0x21')](_0x185cea[_0xe593('0x1f')],function(_0x4fc483){return{'model':db[_0x4fc483[_0xe593('0x20')]],'as':_0x4fc483['as'],'attributes':_0x4fc483[_0xe593('0x1d')],'include':_0x4fc483['include']?_['map'](_0x4fc483[_0xe593('0x1f')],function(_0x25238f){return{'model':db[_0x25238f[_0xe593('0x20')]],'as':_0x25238f['as'],'attributes':_0x25238f[_0xe593('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe593('0xd')](function(_0x27a3d2){logger['info'](_0xe593('0x18'),_0x470d07);logger['debug'](_0xe593('0x18'),_0x470d07,JSON[_0xe593('0x22')](_0x27a3d2));_0xd1020e(_0x27a3d2);})['catch'](function(_0x337ee0){logger['error'](_0xe593('0x18'),_0x337ee0[_0xe593('0x15')],_0x470d07);_0x28b5ed(_0x5f57ce[_0xe593('0x12')](0x1f4,_0x337ee0['message']));});});};exports[_0xe593('0x23')]=function(_0x13f44){var _0x3066ed=this;return new Promise(function(_0x338222,_0x2588be){return db[_0xe593('0x24')][_0xe593('0x25')]({'raw':_0x13f44['options']?_0x13f44[_0xe593('0x1a')][_0xe593('0x1b')]===undefined?!![]:![]:!![],'where':_0x13f44['options']?_0x13f44[_0xe593('0x1a')]['where']||null:null,'attributes':_0x13f44[_0xe593('0x1a')]?_0x13f44[_0xe593('0x1a')][_0xe593('0x1d')]||null:null,'include':_0x13f44[_0xe593('0x1a')]?_0x13f44[_0xe593('0x1a')][_0xe593('0x1f')]?_[_0xe593('0x21')](_0x13f44[_0xe593('0x1a')][_0xe593('0x1f')],function(_0x4305de){return{'model':db[_0x4305de['model']],'as':_0x4305de['as'],'attributes':_0x4305de[_0xe593('0x1d')],'include':_0x4305de[_0xe593('0x1f')]?_[_0xe593('0x21')](_0x4305de['include'],function(_0x4fefb3){return{'model':db[_0x4fefb3[_0xe593('0x20')]],'as':_0x4fefb3['as'],'attributes':_0x4fefb3['attributes'],'include':_0x4fefb3[_0xe593('0x1f')]?_[_0xe593('0x21')](_0x4fefb3[_0xe593('0x1f')],function(_0x30511c){return{'model':db[_0x30511c[_0xe593('0x20')]],'as':_0x30511c['as'],'attributes':_0x30511c[_0xe593('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe593('0xd')](function(_0x4889cc){logger['info'](_0xe593('0x23'),_0x13f44);logger['debug'](_0xe593('0x23'),_0x13f44,JSON['stringify'](_0x4889cc));_0x338222(_0x4889cc);})[_0xe593('0x17')](function(_0x5b9589){logger['error'](_0xe593('0x23'),_0x5b9589[_0xe593('0x15')],_0x13f44);_0x2588be(_0x3066ed[_0xe593('0x12')](0x1f4,_0x5b9589['message']));});});}; \ No newline at end of file +var _0x58a4=['include','model','then','VtigerAccount','find','ShowVtigerAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVtigerAccount','options','raw','where','attributes','limit','map'];(function(_0x22e130,_0x575ae3){var _0x547590=function(_0x3a1e29){while(--_0x3a1e29){_0x22e130['push'](_0x22e130['shift']());}};_0x547590(++_0x575ae3);}(_0x58a4,0xbf));var _0x458a=function(_0x1ce3cc,_0x4f0bfa){_0x1ce3cc=_0x1ce3cc-0x0;var _0x1de825=_0x58a4[_0x1ce3cc];return _0x1de825;};'use strict';var _=require(_0x458a('0x0'));var util=require(_0x458a('0x1'));var moment=require(_0x458a('0x2'));var BPromise=require(_0x458a('0x3'));var rs=require(_0x458a('0x4'));var fs=require('fs');var Redis=require(_0x458a('0x5'));var db=require(_0x458a('0x6'))['db'];var utils=require(_0x458a('0x7'));var logger=require(_0x458a('0x8'))(_0x458a('0x9'));var config=require(_0x458a('0xa'));var jayson=require(_0x458a('0xb'));var client=jayson[_0x458a('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5358c2,_0x30b095,_0x11fcaa){return new BPromise(function(_0x2029bc,_0x1e658e){return client[_0x458a('0xd')](_0x5358c2,_0x11fcaa)['then'](function(_0x4bedce){logger[_0x458a('0xe')](_0x458a('0xf'),_0x30b095,_0x458a('0x10'));logger[_0x458a('0x11')](_0x458a('0x12'),_0x30b095,'request\x20sent',JSON[_0x458a('0x13')](_0x4bedce));if(_0x4bedce[_0x458a('0x14')]){if(_0x4bedce['error'][_0x458a('0x15')]===0x1f4){logger[_0x458a('0x14')](_0x458a('0xf'),_0x30b095,_0x4bedce[_0x458a('0x14')][_0x458a('0x16')]);return _0x1e658e(_0x4bedce['error']['message']);}logger[_0x458a('0x14')]('VtigerAccount,\x20%s,\x20%s',_0x30b095,_0x4bedce[_0x458a('0x14')][_0x458a('0x16')]);return _0x2029bc(_0x4bedce[_0x458a('0x14')][_0x458a('0x16')]);}else{logger[_0x458a('0xe')](_0x458a('0xf'),_0x30b095,'request\x20sent');_0x2029bc(_0x4bedce['result']['message']);}})[_0x458a('0x17')](function(_0x3fd6d4){logger[_0x458a('0x14')]('VtigerAccount,\x20%s,\x20%s',_0x30b095,_0x3fd6d4);_0x1e658e(_0x3fd6d4);});});}exports[_0x458a('0x18')]=function(_0x260c87){var _0x18504d=this;return new Promise(function(_0x392986,_0xa91473){return db['VtigerAccount']['findAll']({'raw':_0x260c87[_0x458a('0x19')]?_0x260c87['options'][_0x458a('0x1a')]===undefined?!![]:![]:!![],'where':_0x260c87[_0x458a('0x19')]?_0x260c87['options'][_0x458a('0x1b')]||null:null,'attributes':_0x260c87['options']?_0x260c87[_0x458a('0x19')][_0x458a('0x1c')]||null:null,'limit':_0x260c87['options']?_0x260c87[_0x458a('0x19')][_0x458a('0x1d')]||null:null,'include':_0x260c87['options']?_0x260c87[_0x458a('0x19')]['include']?_[_0x458a('0x1e')](_0x260c87['options'][_0x458a('0x1f')],function(_0x5dfc6c){return{'model':db[_0x5dfc6c[_0x458a('0x20')]],'as':_0x5dfc6c['as'],'attributes':_0x5dfc6c[_0x458a('0x1c')],'include':_0x5dfc6c[_0x458a('0x1f')]?_[_0x458a('0x1e')](_0x5dfc6c[_0x458a('0x1f')],function(_0x19bd5){return{'model':db[_0x19bd5[_0x458a('0x20')]],'as':_0x19bd5['as'],'attributes':_0x19bd5[_0x458a('0x1c')],'include':_0x19bd5[_0x458a('0x1f')]?_[_0x458a('0x1e')](_0x19bd5[_0x458a('0x1f')],function(_0x327fcb){return{'model':db[_0x327fcb[_0x458a('0x20')]],'as':_0x327fcb['as'],'attributes':_0x327fcb['attributes']};}):[]};}):[]};}):[]:[]})[_0x458a('0x21')](function(_0x112fa6){logger['info']('GetVtigerAccount',_0x260c87);logger[_0x458a('0x11')]('GetVtigerAccount',_0x260c87,JSON[_0x458a('0x13')](_0x112fa6));_0x392986(_0x112fa6);})[_0x458a('0x17')](function(_0x223f73){logger['error'](_0x458a('0x18'),_0x223f73[_0x458a('0x16')],_0x260c87);_0xa91473(_0x18504d[_0x458a('0x14')](0x1f4,_0x223f73['message']));});});};exports['ShowVtigerAccount']=function(_0x18c890){var _0x4cf059=this;return new Promise(function(_0x185f1c,_0x56e0b9){return db[_0x458a('0x22')][_0x458a('0x23')]({'raw':_0x18c890['options']?_0x18c890[_0x458a('0x19')][_0x458a('0x1a')]===undefined?!![]:![]:!![],'where':_0x18c890[_0x458a('0x19')]?_0x18c890['options'][_0x458a('0x1b')]||null:null,'attributes':_0x18c890[_0x458a('0x19')]?_0x18c890[_0x458a('0x19')][_0x458a('0x1c')]||null:null,'include':_0x18c890[_0x458a('0x19')]?_0x18c890['options'][_0x458a('0x1f')]?_[_0x458a('0x1e')](_0x18c890[_0x458a('0x19')][_0x458a('0x1f')],function(_0x35ec8f){return{'model':db[_0x35ec8f[_0x458a('0x20')]],'as':_0x35ec8f['as'],'attributes':_0x35ec8f['attributes'],'include':_0x35ec8f[_0x458a('0x1f')]?_[_0x458a('0x1e')](_0x35ec8f[_0x458a('0x1f')],function(_0x2f9b7b){return{'model':db[_0x2f9b7b[_0x458a('0x20')]],'as':_0x2f9b7b['as'],'attributes':_0x2f9b7b[_0x458a('0x1c')],'include':_0x2f9b7b[_0x458a('0x1f')]?_[_0x458a('0x1e')](_0x2f9b7b[_0x458a('0x1f')],function(_0x4cb8be){return{'model':db[_0x4cb8be[_0x458a('0x20')]],'as':_0x4cb8be['as'],'attributes':_0x4cb8be[_0x458a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x458a('0x21')](function(_0x101ece){logger[_0x458a('0xe')](_0x458a('0x24'),_0x18c890);logger[_0x458a('0x11')](_0x458a('0x24'),_0x18c890,JSON[_0x458a('0x13')](_0x101ece));_0x185f1c(_0x101ece);})[_0x458a('0x17')](function(_0x1a4011){logger[_0x458a('0x14')](_0x458a('0x24'),_0x1a4011[_0x458a('0x16')],_0x18c890);_0x56e0b9(_0x4cf059[_0x458a('0x14')](0x1f4,_0x1a4011['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 7d26fbe..404e297 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 _0x8a18=['isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','create','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get'];(function(_0x2efc5b,_0x2c9384){var _0x5f49c6=function(_0x26ce5b){while(--_0x26ce5b){_0x2efc5b['push'](_0x2efc5b['shift']());}};_0x5f49c6(++_0x2c9384);}(_0x8a18,0x70));var _0x88a1=function(_0x3d7608,_0x3d61a4){_0x3d7608=_0x3d7608-0x0;var _0x49303b=_0x8a18[_0x3d7608];return _0x49303b;};'use strict';var multer=require('multer');var util=require(_0x88a1('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x88a1('0x1'));var router=express[_0x88a1('0x2')]();var fs_extra=require(_0x88a1('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x88a1('0x4'));var config=require(_0x88a1('0x5'));var controller=require(_0x88a1('0x6'));router[_0x88a1('0x7')]('/',auth[_0x88a1('0x8')](),controller['index']);router[_0x88a1('0x7')](_0x88a1('0x9'),auth[_0x88a1('0x8')](),controller[_0x88a1('0xa')]);router[_0x88a1('0x7')](_0x88a1('0xb'),auth[_0x88a1('0x8')](),controller[_0x88a1('0xc')]);router[_0x88a1('0x7')](_0x88a1('0xd'),auth[_0x88a1('0x8')](),controller['getSubjects']);router[_0x88a1('0x7')](_0x88a1('0xe'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0x88a1('0x8')](),controller[_0x88a1('0xf')]);router['put'](_0x88a1('0x9'),auth[_0x88a1('0x8')](),controller[_0x88a1('0x10')]);router[_0x88a1('0x11')](_0x88a1('0x9'),auth['isAuthenticated'](),controller[_0x88a1('0x12')]);module[_0x88a1('0x13')]=router; \ No newline at end of file +var _0x2cce=['path','connect-timeout','fs-extra','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','post','create','/:id','update','delete','destroy','exports','multer'];(function(_0x3ae2a9,_0x5ac0d6){var _0x31f787=function(_0x36de9f){while(--_0x36de9f){_0x3ae2a9['push'](_0x3ae2a9['shift']());}};_0x31f787(++_0x5ac0d6);}(_0x2cce,0x7d));var _0xe2cc=function(_0x1e965d,_0x5d97a5){_0x1e965d=_0x1e965d-0x0;var _0x306ca5=_0x2cce[_0x1e965d];return _0x306ca5;};'use strict';var multer=require(_0xe2cc('0x0'));var util=require('util');var path=require(_0xe2cc('0x1'));var timeout=require(_0xe2cc('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe2cc('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe2cc('0x4'));var controller=require(_0xe2cc('0x5'));router[_0xe2cc('0x6')]('/',auth[_0xe2cc('0x7')](),controller[_0xe2cc('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xe2cc('0x9')]);router[_0xe2cc('0x6')](_0xe2cc('0xa'),auth['isAuthenticated'](),controller[_0xe2cc('0xb')]);router[_0xe2cc('0x6')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xe2cc('0x6')](_0xe2cc('0xc'),auth['isAuthenticated'](),controller[_0xe2cc('0xd')]);router[_0xe2cc('0xe')]('/',auth[_0xe2cc('0x7')](),controller[_0xe2cc('0xf')]);router['put'](_0xe2cc('0x10'),auth[_0xe2cc('0x7')](),controller[_0xe2cc('0x11')]);router[_0xe2cc('0x12')]('/:id',auth[_0xe2cc('0x7')](),controller[_0xe2cc('0x13')]);module[_0xe2cc('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 78cf753..d944ea4 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 _0x9d2c=['sequelize','exports','STRING'];(function(_0x5c7158,_0x40146f){var _0x526bc4=function(_0x58260f){while(--_0x58260f){_0x5c7158['push'](_0x5c7158['shift']());}};_0x526bc4(++_0x40146f);}(_0x9d2c,0x6c));var _0xc9d2=function(_0xa91256,_0x35e0dc){_0xa91256=_0xa91256-0x0;var _0x8661cb=_0x9d2c[_0xa91256];return _0x8661cb;};'use strict';var Sequelize=require(_0xc9d2('0x0'));module[_0xc9d2('0x1')]={'name':{'type':Sequelize[_0xc9d2('0x2')]},'description':{'type':Sequelize[_0xc9d2('0x2')]}}; \ No newline at end of file +var _0xc68c=['exports','STRING','sequelize'];(function(_0x4d6d4b,_0x585234){var _0x35e511=function(_0x6cc666){while(--_0x6cc666){_0x4d6d4b['push'](_0x4d6d4b['shift']());}};_0x35e511(++_0x585234);}(_0xc68c,0x1d3));var _0xcc68=function(_0x29ad6e,_0x2dad73){_0x29ad6e=_0x29ad6e-0x0;var _0x3f1013=_0xc68c[_0x29ad6e];return _0x3f1013;};'use strict';var Sequelize=require(_0xcc68('0x0'));module[_0xcc68('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xcc68('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 8ad0471..6429ea8 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 _0x5fb0=['mustache','path','fs-extra','lodash','squel','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','VtigerConfiguration','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','getFields','findOne','pick','getSubjects','VtigerField','getDescriptions','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x290c43,_0x3764d6){var _0x3155bc=function(_0x2f4919){while(--_0x2f4919){_0x290c43['push'](_0x290c43['shift']());}};_0x3155bc(++_0x3764d6);}(_0x5fb0,0x134));var _0x05fb=function(_0x5232bb,_0x4fcb6c){_0x5232bb=_0x5232bb-0x0;var _0x2ba6d1=_0x5fb0[_0x5232bb];return _0x2ba6d1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x05fb('0x0'));var jsonpatch=require(_0x05fb('0x1'));var rp=require(_0x05fb('0x2'));var moment=require('moment');var BPromise=require(_0x05fb('0x3'));var Mustache=require(_0x05fb('0x4'));var util=require('util');var path=require(_0x05fb('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x05fb('0x6'));var _=require(_0x05fb('0x7'));var squel=require(_0x05fb('0x8'));var crypto=require('crypto');var jsforce=require(_0x05fb('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x05fb('0xa'));var querystring=require(_0x05fb('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x05fb('0xc'));var qs=require(_0x05fb('0xd'));var as=require(_0x05fb('0xe'));var hardwareService=require(_0x05fb('0xf'));var logger=require('../../config/logger')(_0x05fb('0x10'));var utils=require(_0x05fb('0x11'));var config=require(_0x05fb('0x12'));var licenseUtil=require(_0x05fb('0x13'));var db=require(_0x05fb('0x14'))['db'];function respondWithStatusCode(_0x35749a,_0x2b7794){_0x2b7794=_0x2b7794||0xcc;return function(_0x30f52d){if(_0x30f52d){return _0x35749a[_0x05fb('0x15')](_0x2b7794);}return _0x35749a['status'](_0x2b7794)[_0x05fb('0x16')]();};}function respondWithResult(_0x293a77,_0xf12952){_0xf12952=_0xf12952||0xc8;return function(_0x58625f){if(_0x58625f){return _0x293a77[_0x05fb('0x17')](_0xf12952)[_0x05fb('0x18')](_0x58625f);}};}function respondWithFilteredResult(_0x1eeef2,_0x570d23){return function(_0x514709){if(_0x514709){var _0x1e89e7=typeof _0x570d23[_0x05fb('0x19')]===_0x05fb('0x1a')&&typeof _0x570d23['limit']===_0x05fb('0x1a');var _0x5ed2b1=_0x514709[_0x05fb('0x1b')];var _0x35bdba=_0x1e89e7?0x0:_0x570d23[_0x05fb('0x19')];var _0xd59cb8=_0x1e89e7?_0x514709['count']:_0x570d23[_0x05fb('0x19')]+_0x570d23[_0x05fb('0x1c')];var _0x1d2187;if(_0xd59cb8>=_0x5ed2b1){_0xd59cb8=_0x5ed2b1;_0x1d2187=0xc8;}else{_0x1d2187=0xce;}_0x1eeef2['status'](_0x1d2187);return _0x1eeef2[_0x05fb('0x1d')](_0x05fb('0x1e'),_0x35bdba+'-'+_0xd59cb8+'/'+_0x5ed2b1)[_0x05fb('0x18')](_0x514709);}return null;};}function patchUpdates(_0x356e55){return function(_0xf50d4){try{jsonpatch['apply'](_0xf50d4,_0x356e55,!![]);}catch(_0xe3e9cc){return BPromise[_0x05fb('0x1f')](_0xe3e9cc);}return _0xf50d4[_0x05fb('0x20')]();};}function saveUpdates(_0x3924b,_0x3b02f9){return function(_0x57cd80){if(_0x57cd80){return _0x57cd80[_0x05fb('0x21')](_0x3924b)[_0x05fb('0x22')](function(_0x218862){return _0x218862;});}return null;};}function removeEntity(_0x631d95,_0x45bdc7){return function(_0x5d99f3){if(_0x5d99f3){return _0x5d99f3[_0x05fb('0x23')]()['then'](function(){_0x631d95[_0x05fb('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x616311,_0x4e855d){return function(_0x5b94ef){if(!_0x5b94ef){_0x616311[_0x05fb('0x15')](0x194);}return _0x5b94ef;};}function handleError(_0x1b7e9a,_0x4b53ef){_0x4b53ef=_0x4b53ef||0x1f4;return function(_0x3c1913){logger[_0x05fb('0x24')](_0x3c1913[_0x05fb('0x25')]);if(_0x3c1913['name']){delete _0x3c1913[_0x05fb('0x26')];}_0x1b7e9a[_0x05fb('0x17')](_0x4b53ef)[_0x05fb('0x27')](_0x3c1913);};}exports['index']=function(_0x4df881,_0x563bf9){var _0x47d1ae={},_0x19d710={},_0x4e9a4c={'count':0x0,'rows':[]};var _0x476ea1=_[_0x05fb('0x28')](db[_0x05fb('0x29')][_0x05fb('0x2a')],function(_0x47488e){return{'name':_0x47488e[_0x05fb('0x2b')],'type':_0x47488e[_0x05fb('0x2c')]['key']};});_0x19d710[_0x05fb('0x2d')]=_['map'](_0x476ea1,_0x05fb('0x26'));_0x19d710['query']=_[_0x05fb('0x2e')](_0x4df881[_0x05fb('0x2f')]);_0x19d710[_0x05fb('0x30')]=_['intersection'](_0x19d710[_0x05fb('0x2d')],_0x19d710[_0x05fb('0x2f')]);_0x47d1ae[_0x05fb('0x31')]=_[_0x05fb('0x32')](_0x19d710['model'],qs[_0x05fb('0x33')](_0x4df881[_0x05fb('0x2f')][_0x05fb('0x33')]));_0x47d1ae[_0x05fb('0x31')]=_0x47d1ae[_0x05fb('0x31')][_0x05fb('0x34')]?_0x47d1ae[_0x05fb('0x31')]:_0x19d710[_0x05fb('0x2d')];if(!_0x4df881['query'][_0x05fb('0x35')](_0x05fb('0x36'))){_0x47d1ae['limit']=qs[_0x05fb('0x1c')](_0x4df881[_0x05fb('0x2f')][_0x05fb('0x1c')]);_0x47d1ae[_0x05fb('0x19')]=qs[_0x05fb('0x19')](_0x4df881[_0x05fb('0x2f')][_0x05fb('0x19')]);}_0x47d1ae[_0x05fb('0x37')]=qs[_0x05fb('0x38')](_0x4df881[_0x05fb('0x2f')][_0x05fb('0x38')]);_0x47d1ae[_0x05fb('0x39')]=qs['filters'](_['pick'](_0x4df881['query'],_0x19d710['filters']),_0x476ea1);if(_0x4df881[_0x05fb('0x2f')][_0x05fb('0x3a')]){_0x47d1ae[_0x05fb('0x39')]=_[_0x05fb('0x3b')](_0x47d1ae['where'],{'$or':_[_0x05fb('0x28')](_0x476ea1,function(_0x52754f){if(_0x52754f['type']!==_0x05fb('0x3c')){var _0x38ba17={};_0x38ba17[_0x52754f[_0x05fb('0x26')]]={'$like':'%'+_0x4df881[_0x05fb('0x2f')]['filter']+'%'};return _0x38ba17;}})});}_0x47d1ae=_['merge']({},_0x47d1ae,_0x4df881['options']);var _0x3e0299={'where':_0x47d1ae[_0x05fb('0x39')]};return db[_0x05fb('0x29')][_0x05fb('0x1b')](_0x3e0299)['then'](function(_0x461253){_0x4e9a4c[_0x05fb('0x1b')]=_0x461253;if(_0x4df881[_0x05fb('0x2f')][_0x05fb('0x3d')]){_0x47d1ae[_0x05fb('0x3e')]=[{'all':!![]}];}return db[_0x05fb('0x29')][_0x05fb('0x3f')](_0x47d1ae);})[_0x05fb('0x22')](function(_0x16ed09){_0x4e9a4c[_0x05fb('0x40')]=_0x16ed09;return _0x4e9a4c;})[_0x05fb('0x22')](respondWithFilteredResult(_0x563bf9,_0x47d1ae))[_0x05fb('0x41')](handleError(_0x563bf9,null));};exports[_0x05fb('0x42')]=function(_0x232fca,_0x3545cf){var _0x3f56f8={'raw':![],'where':{'id':_0x232fca[_0x05fb('0x43')]['id']}},_0x4db1c0={};_0x4db1c0[_0x05fb('0x2d')]=_[_0x05fb('0x2e')](db[_0x05fb('0x29')]['rawAttributes']);_0x4db1c0[_0x05fb('0x2f')]=_[_0x05fb('0x2e')](_0x232fca[_0x05fb('0x2f')]);_0x4db1c0['filters']=_[_0x05fb('0x32')](_0x4db1c0[_0x05fb('0x2d')],_0x4db1c0['query']);_0x3f56f8[_0x05fb('0x31')]=_[_0x05fb('0x32')](_0x4db1c0[_0x05fb('0x2d')],qs['fields'](_0x232fca[_0x05fb('0x2f')]['fields']));_0x3f56f8[_0x05fb('0x31')]=_0x3f56f8['attributes'][_0x05fb('0x34')]?_0x3f56f8[_0x05fb('0x31')]:_0x4db1c0[_0x05fb('0x2d')];if(_0x232fca[_0x05fb('0x2f')][_0x05fb('0x3d')]){_0x3f56f8['include']=[{'all':!![]}];}_0x3f56f8=_[_0x05fb('0x3b')]({},_0x3f56f8,_0x232fca[_0x05fb('0x44')]);return db[_0x05fb('0x29')][_0x05fb('0x45')](_0x3f56f8)[_0x05fb('0x22')](handleEntityNotFound(_0x3545cf,null))[_0x05fb('0x22')](respondWithResult(_0x3545cf,null))[_0x05fb('0x41')](handleError(_0x3545cf,null));};exports[_0x05fb('0x46')]=function(_0x3eff24,_0x3bc1fa){return db[_0x05fb('0x29')][_0x05fb('0x46')](_0x3eff24[_0x05fb('0x47')],{})['then'](respondWithResult(_0x3bc1fa,0xc9))[_0x05fb('0x41')](handleError(_0x3bc1fa,null));};exports[_0x05fb('0x21')]=function(_0x7b6b5d,_0xdb5adb){if(_0x7b6b5d[_0x05fb('0x47')]['id']){delete _0x7b6b5d[_0x05fb('0x47')]['id'];}return db[_0x05fb('0x29')][_0x05fb('0x45')]({'where':{'id':_0x7b6b5d[_0x05fb('0x43')]['id']}})[_0x05fb('0x22')](handleEntityNotFound(_0xdb5adb,null))['then'](saveUpdates(_0x7b6b5d[_0x05fb('0x47')],null))[_0x05fb('0x22')](respondWithResult(_0xdb5adb,null))[_0x05fb('0x41')](handleError(_0xdb5adb,null));};exports[_0x05fb('0x23')]=function(_0x52c5fe,_0x5993ad){return db[_0x05fb('0x29')][_0x05fb('0x45')]({'where':{'id':_0x52c5fe[_0x05fb('0x43')]['id']}})[_0x05fb('0x22')](handleEntityNotFound(_0x5993ad,null))[_0x05fb('0x22')](removeEntity(_0x5993ad,null))[_0x05fb('0x41')](handleError(_0x5993ad,null));};exports[_0x05fb('0x48')]=function(_0x189caf,_0x423fec,_0x2e6602){var _0x4bc480={};var _0x3d6729={};var _0x170797;var _0x37f321;return db[_0x05fb('0x29')][_0x05fb('0x49')]({'where':{'id':_0x189caf[_0x05fb('0x43')]['id']}})[_0x05fb('0x22')](handleEntityNotFound(_0x423fec,null))[_0x05fb('0x22')](function(_0x50f71d){if(_0x50f71d){_0x170797=_0x50f71d;_0x3d6729['model']=_['keys'](db['VtigerField'][_0x05fb('0x2a')]);_0x3d6729[_0x05fb('0x2f')]=_['keys'](_0x189caf[_0x05fb('0x2f')]);_0x3d6729[_0x05fb('0x30')]=_['intersection'](_0x3d6729[_0x05fb('0x2d')],_0x3d6729['query']);_0x4bc480['attributes']=_['intersection'](_0x3d6729[_0x05fb('0x2d')],qs[_0x05fb('0x33')](_0x189caf[_0x05fb('0x2f')][_0x05fb('0x33')]));_0x4bc480['attributes']=_0x4bc480[_0x05fb('0x31')]['length']?_0x4bc480['attributes']:_0x3d6729['model'];_0x4bc480[_0x05fb('0x37')]=qs[_0x05fb('0x38')](_0x189caf[_0x05fb('0x2f')]['sort']);_0x4bc480[_0x05fb('0x39')]=qs['filters'](_[_0x05fb('0x4a')](_0x189caf['query'],_0x3d6729['filters']));if(_0x189caf[_0x05fb('0x2f')][_0x05fb('0x3a')]){_0x4bc480[_0x05fb('0x39')]=_[_0x05fb('0x3b')](_0x4bc480['where'],{'$or':_[_0x05fb('0x28')](_0x4bc480['attributes'],function(_0x48ae50){var _0x438fe5={};_0x438fe5[_0x48ae50]={'$like':'%'+_0x189caf[_0x05fb('0x2f')]['filter']+'%'};return _0x438fe5;})});}_0x4bc480=_['merge']({},_0x4bc480,_0x189caf[_0x05fb('0x44')]);return _0x170797[_0x05fb('0x48')](_0x4bc480);}})['then'](function(_0x84472f){if(_0x84472f){_0x37f321=_0x84472f['length'];if(!_0x189caf[_0x05fb('0x2f')][_0x05fb('0x35')]('nolimit')){_0x4bc480[_0x05fb('0x1c')]=qs[_0x05fb('0x1c')](_0x189caf[_0x05fb('0x2f')][_0x05fb('0x1c')]);_0x4bc480[_0x05fb('0x19')]=qs['offset'](_0x189caf[_0x05fb('0x2f')][_0x05fb('0x19')]);}return _0x170797[_0x05fb('0x48')](_0x4bc480);}})[_0x05fb('0x22')](function(_0xb693b4){if(_0xb693b4){return _0xb693b4?{'count':_0x37f321,'rows':_0xb693b4}:null;}})['then'](respondWithResult(_0x423fec,null))[_0x05fb('0x41')](handleError(_0x423fec,null));};exports[_0x05fb('0x4b')]=function(_0x4ab56f,_0xe33f4d,_0xfb9a65){var _0x300f2d={};var _0x4c0986={};var _0x12ea63;var _0x49f6db;return db['VtigerConfiguration'][_0x05fb('0x49')]({'where':{'id':_0x4ab56f[_0x05fb('0x43')]['id']}})[_0x05fb('0x22')](handleEntityNotFound(_0xe33f4d,null))[_0x05fb('0x22')](function(_0x53b071){if(_0x53b071){_0x12ea63=_0x53b071;_0x4c0986[_0x05fb('0x2d')]=_[_0x05fb('0x2e')](db[_0x05fb('0x4c')]['rawAttributes']);_0x4c0986[_0x05fb('0x2f')]=_[_0x05fb('0x2e')](_0x4ab56f[_0x05fb('0x2f')]);_0x4c0986[_0x05fb('0x30')]=_[_0x05fb('0x32')](_0x4c0986[_0x05fb('0x2d')],_0x4c0986[_0x05fb('0x2f')]);_0x300f2d['attributes']=_[_0x05fb('0x32')](_0x4c0986[_0x05fb('0x2d')],qs[_0x05fb('0x33')](_0x4ab56f[_0x05fb('0x2f')][_0x05fb('0x33')]));_0x300f2d['attributes']=_0x300f2d[_0x05fb('0x31')]['length']?_0x300f2d[_0x05fb('0x31')]:_0x4c0986[_0x05fb('0x2d')];_0x300f2d['order']=qs[_0x05fb('0x38')](_0x4ab56f['query'][_0x05fb('0x38')]);_0x300f2d['where']=qs[_0x05fb('0x30')](_['pick'](_0x4ab56f['query'],_0x4c0986[_0x05fb('0x30')]));if(_0x4ab56f['query'][_0x05fb('0x3a')]){_0x300f2d[_0x05fb('0x39')]=_[_0x05fb('0x3b')](_0x300f2d[_0x05fb('0x39')],{'$or':_[_0x05fb('0x28')](_0x300f2d[_0x05fb('0x31')],function(_0x2ea6fe){var _0x244d7e={};_0x244d7e[_0x2ea6fe]={'$like':'%'+_0x4ab56f[_0x05fb('0x2f')][_0x05fb('0x3a')]+'%'};return _0x244d7e;})});}_0x300f2d=_[_0x05fb('0x3b')]({},_0x300f2d,_0x4ab56f['options']);return _0x12ea63[_0x05fb('0x4b')](_0x300f2d);}})[_0x05fb('0x22')](function(_0x3c7a2c){if(_0x3c7a2c){_0x49f6db=_0x3c7a2c['length'];if(!_0x4ab56f[_0x05fb('0x2f')][_0x05fb('0x35')](_0x05fb('0x36'))){_0x300f2d[_0x05fb('0x1c')]=qs[_0x05fb('0x1c')](_0x4ab56f[_0x05fb('0x2f')][_0x05fb('0x1c')]);_0x300f2d[_0x05fb('0x19')]=qs[_0x05fb('0x19')](_0x4ab56f[_0x05fb('0x2f')][_0x05fb('0x19')]);}return _0x12ea63[_0x05fb('0x4b')](_0x300f2d);}})[_0x05fb('0x22')](function(_0xf23c68){if(_0xf23c68){return _0xf23c68?{'count':_0x49f6db,'rows':_0xf23c68}:null;}})['then'](respondWithResult(_0xe33f4d,null))[_0x05fb('0x41')](handleError(_0xe33f4d,null));};exports[_0x05fb('0x4d')]=function(_0x30a0c4,_0x25bc39,_0x395f80){var _0x16c462={};var _0x41d857={};var _0xff0a6d;var _0x2725ab;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x30a0c4[_0x05fb('0x43')]['id']}})['then'](handleEntityNotFound(_0x25bc39,null))[_0x05fb('0x22')](function(_0x5c50ee){if(_0x5c50ee){_0xff0a6d=_0x5c50ee;_0x41d857[_0x05fb('0x2d')]=_[_0x05fb('0x2e')](db[_0x05fb('0x4c')][_0x05fb('0x2a')]);_0x41d857[_0x05fb('0x2f')]=_['keys'](_0x30a0c4[_0x05fb('0x2f')]);_0x41d857[_0x05fb('0x30')]=_[_0x05fb('0x32')](_0x41d857[_0x05fb('0x2d')],_0x41d857[_0x05fb('0x2f')]);_0x16c462[_0x05fb('0x31')]=_[_0x05fb('0x32')](_0x41d857[_0x05fb('0x2d')],qs[_0x05fb('0x33')](_0x30a0c4[_0x05fb('0x2f')][_0x05fb('0x33')]));_0x16c462[_0x05fb('0x31')]=_0x16c462[_0x05fb('0x31')]['length']?_0x16c462[_0x05fb('0x31')]:_0x41d857[_0x05fb('0x2d')];_0x16c462[_0x05fb('0x37')]=qs[_0x05fb('0x38')](_0x30a0c4[_0x05fb('0x2f')][_0x05fb('0x38')]);_0x16c462[_0x05fb('0x39')]=qs[_0x05fb('0x30')](_['pick'](_0x30a0c4[_0x05fb('0x2f')],_0x41d857['filters']));if(_0x30a0c4[_0x05fb('0x2f')][_0x05fb('0x3a')]){_0x16c462[_0x05fb('0x39')]=_[_0x05fb('0x3b')](_0x16c462['where'],{'$or':_[_0x05fb('0x28')](_0x16c462[_0x05fb('0x31')],function(_0x387462){var _0x3568de={};_0x3568de[_0x387462]={'$like':'%'+_0x30a0c4['query'][_0x05fb('0x3a')]+'%'};return _0x3568de;})});}_0x16c462=_['merge']({},_0x16c462,_0x30a0c4[_0x05fb('0x44')]);return _0xff0a6d[_0x05fb('0x4d')](_0x16c462);}})[_0x05fb('0x22')](function(_0x444259){if(_0x444259){_0x2725ab=_0x444259[_0x05fb('0x34')];if(!_0x30a0c4['query']['hasOwnProperty'](_0x05fb('0x36'))){_0x16c462['limit']=qs[_0x05fb('0x1c')](_0x30a0c4[_0x05fb('0x2f')]['limit']);_0x16c462[_0x05fb('0x19')]=qs[_0x05fb('0x19')](_0x30a0c4['query'][_0x05fb('0x19')]);}return _0xff0a6d[_0x05fb('0x4d')](_0x16c462);}})[_0x05fb('0x22')](function(_0x3cfb7b){if(_0x3cfb7b){return _0x3cfb7b?{'count':_0x2725ab,'rows':_0x3cfb7b}:null;}})['then'](respondWithResult(_0x25bc39,null))[_0x05fb('0x41')](handleError(_0x25bc39,null));}; \ No newline at end of file +var _0xd851=['includeAll','include','rows','show','find','catch','create','body','params','getFields','findOne','VtigerField','sort','pick','getSubjects','getDescriptions','eml-format','rimraf','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','merge','filter','options'];(function(_0x18969c,_0x215d22){var _0x18dba8=function(_0x11fb9c){while(--_0x11fb9c){_0x18969c['push'](_0x18969c['shift']());}};_0x18dba8(++_0x215d22);}(_0xd851,0x148));var _0x1d85=function(_0x44dba1,_0x270ad5){_0x44dba1=_0x44dba1-0x0;var _0x2fbd3f=_0xd851[_0x44dba1];return _0x2fbd3f;};'use strict';var emlformat=require(_0x1d85('0x0'));var rimraf=require(_0x1d85('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1d85('0x2'));var moment=require(_0x1d85('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1d85('0x4'));var util=require('util');var path=require(_0x1d85('0x5'));var sox=require(_0x1d85('0x6'));var csv=require(_0x1d85('0x7'));var ejs=require(_0x1d85('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1d85('0x9'));var squel=require(_0x1d85('0xa'));var crypto=require(_0x1d85('0xb'));var jsforce=require(_0x1d85('0xc'));var deskjs=require(_0x1d85('0xd'));var toCsv=require(_0x1d85('0x7'));var querystring=require(_0x1d85('0xe'));var Papa=require(_0x1d85('0xf'));var Redis=require(_0x1d85('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1d85('0x11'));var hardwareService=require(_0x1d85('0x12'));var logger=require(_0x1d85('0x13'))(_0x1d85('0x14'));var utils=require(_0x1d85('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1d85('0x16'));var db=require(_0x1d85('0x17'))['db'];function respondWithStatusCode(_0x2ff94a,_0x171ecc){_0x171ecc=_0x171ecc||0xcc;return function(_0x3f2d4c){if(_0x3f2d4c){return _0x2ff94a['sendStatus'](_0x171ecc);}return _0x2ff94a[_0x1d85('0x18')](_0x171ecc)[_0x1d85('0x19')]();};}function respondWithResult(_0x432b02,_0x584679){_0x584679=_0x584679||0xc8;return function(_0x1cd936){if(_0x1cd936){return _0x432b02['status'](_0x584679)[_0x1d85('0x1a')](_0x1cd936);}};}function respondWithFilteredResult(_0x5c9d65,_0x27a826){return function(_0x1c8759){if(_0x1c8759){var _0x462129=typeof _0x27a826[_0x1d85('0x1b')]===_0x1d85('0x1c')&&typeof _0x27a826['limit']===_0x1d85('0x1c');var _0x1cd315=_0x1c8759[_0x1d85('0x1d')];var _0x13ac67=_0x462129?0x0:_0x27a826[_0x1d85('0x1b')];var _0x59ccd8=_0x462129?_0x1c8759[_0x1d85('0x1d')]:_0x27a826[_0x1d85('0x1b')]+_0x27a826[_0x1d85('0x1e')];var _0x2b658e;if(_0x59ccd8>=_0x1cd315){_0x59ccd8=_0x1cd315;_0x2b658e=0xc8;}else{_0x2b658e=0xce;}_0x5c9d65[_0x1d85('0x18')](_0x2b658e);return _0x5c9d65['set'](_0x1d85('0x1f'),_0x13ac67+'-'+_0x59ccd8+'/'+_0x1cd315)[_0x1d85('0x1a')](_0x1c8759);}return null;};}function patchUpdates(_0x23d9cf){return function(_0x2301b0){try{jsonpatch[_0x1d85('0x20')](_0x2301b0,_0x23d9cf,!![]);}catch(_0x11d60f){return BPromise[_0x1d85('0x21')](_0x11d60f);}return _0x2301b0[_0x1d85('0x22')]();};}function saveUpdates(_0x2a97b6,_0xd7a290){return function(_0x132062){if(_0x132062){return _0x132062['update'](_0x2a97b6)['then'](function(_0x51af9d){return _0x51af9d;});}return null;};}function removeEntity(_0x32f3d1,_0x47fd20){return function(_0x2e1643){if(_0x2e1643){return _0x2e1643['destroy']()[_0x1d85('0x23')](function(){_0x32f3d1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x334e1d,_0x2c3b15){return function(_0x4a59bf){if(!_0x4a59bf){_0x334e1d['sendStatus'](0x194);}return _0x4a59bf;};}function handleError(_0x4acc1c,_0x8e3458){_0x8e3458=_0x8e3458||0x1f4;return function(_0x3d41db){logger[_0x1d85('0x24')](_0x3d41db[_0x1d85('0x25')]);if(_0x3d41db[_0x1d85('0x26')]){delete _0x3d41db[_0x1d85('0x26')];}_0x4acc1c[_0x1d85('0x18')](_0x8e3458)[_0x1d85('0x27')](_0x3d41db);};}exports[_0x1d85('0x28')]=function(_0x55983a,_0x501cda){var _0x1d9d9a={},_0x2d003e={},_0x51066a={'count':0x0,'rows':[]};var _0x37bba0=_[_0x1d85('0x29')](db[_0x1d85('0x2a')][_0x1d85('0x2b')],function(_0x1bdb3f){return{'name':_0x1bdb3f[_0x1d85('0x2c')],'type':_0x1bdb3f[_0x1d85('0x2d')][_0x1d85('0x2e')]};});_0x2d003e[_0x1d85('0x2f')]=_[_0x1d85('0x29')](_0x37bba0,_0x1d85('0x26'));_0x2d003e[_0x1d85('0x30')]=_[_0x1d85('0x31')](_0x55983a[_0x1d85('0x30')]);_0x2d003e[_0x1d85('0x32')]=_[_0x1d85('0x33')](_0x2d003e[_0x1d85('0x2f')],_0x2d003e[_0x1d85('0x30')]);_0x1d9d9a[_0x1d85('0x34')]=_['intersection'](_0x2d003e[_0x1d85('0x2f')],qs[_0x1d85('0x35')](_0x55983a[_0x1d85('0x30')]['fields']));_0x1d9d9a['attributes']=_0x1d9d9a[_0x1d85('0x34')][_0x1d85('0x36')]?_0x1d9d9a[_0x1d85('0x34')]:_0x2d003e[_0x1d85('0x2f')];if(!_0x55983a[_0x1d85('0x30')][_0x1d85('0x37')](_0x1d85('0x38'))){_0x1d9d9a[_0x1d85('0x1e')]=qs[_0x1d85('0x1e')](_0x55983a['query'][_0x1d85('0x1e')]);_0x1d9d9a[_0x1d85('0x1b')]=qs[_0x1d85('0x1b')](_0x55983a[_0x1d85('0x30')]['offset']);}_0x1d9d9a[_0x1d85('0x39')]=qs['sort'](_0x55983a['query']['sort']);_0x1d9d9a[_0x1d85('0x3a')]=qs[_0x1d85('0x32')](_['pick'](_0x55983a[_0x1d85('0x30')],_0x2d003e[_0x1d85('0x32')]),_0x37bba0);if(_0x55983a[_0x1d85('0x30')]['filter']){_0x1d9d9a[_0x1d85('0x3a')]=_[_0x1d85('0x3b')](_0x1d9d9a[_0x1d85('0x3a')],{'$or':_[_0x1d85('0x29')](_0x37bba0,function(_0x5f41a4){if(_0x5f41a4[_0x1d85('0x2d')]!=='VIRTUAL'){var _0x452c7c={};_0x452c7c[_0x5f41a4[_0x1d85('0x26')]]={'$like':'%'+_0x55983a[_0x1d85('0x30')][_0x1d85('0x3c')]+'%'};return _0x452c7c;}})});}_0x1d9d9a=_[_0x1d85('0x3b')]({},_0x1d9d9a,_0x55983a[_0x1d85('0x3d')]);var _0x4dee22={'where':_0x1d9d9a[_0x1d85('0x3a')]};return db[_0x1d85('0x2a')][_0x1d85('0x1d')](_0x4dee22)[_0x1d85('0x23')](function(_0x30c44b){_0x51066a['count']=_0x30c44b;if(_0x55983a[_0x1d85('0x30')][_0x1d85('0x3e')]){_0x1d9d9a[_0x1d85('0x3f')]=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x1d9d9a);})[_0x1d85('0x23')](function(_0x52b6a9){_0x51066a[_0x1d85('0x40')]=_0x52b6a9;return _0x51066a;})[_0x1d85('0x23')](respondWithFilteredResult(_0x501cda,_0x1d9d9a))['catch'](handleError(_0x501cda,null));};exports[_0x1d85('0x41')]=function(_0x2293f1,_0x5bc37a){var _0x3cf79b={'raw':![],'where':{'id':_0x2293f1['params']['id']}},_0xdf9ed3={};_0xdf9ed3[_0x1d85('0x2f')]=_['keys'](db['VtigerConfiguration'][_0x1d85('0x2b')]);_0xdf9ed3[_0x1d85('0x30')]=_[_0x1d85('0x31')](_0x2293f1['query']);_0xdf9ed3[_0x1d85('0x32')]=_[_0x1d85('0x33')](_0xdf9ed3[_0x1d85('0x2f')],_0xdf9ed3[_0x1d85('0x30')]);_0x3cf79b[_0x1d85('0x34')]=_[_0x1d85('0x33')](_0xdf9ed3['model'],qs[_0x1d85('0x35')](_0x2293f1[_0x1d85('0x30')]['fields']));_0x3cf79b[_0x1d85('0x34')]=_0x3cf79b[_0x1d85('0x34')]['length']?_0x3cf79b[_0x1d85('0x34')]:_0xdf9ed3[_0x1d85('0x2f')];if(_0x2293f1[_0x1d85('0x30')][_0x1d85('0x3e')]){_0x3cf79b['include']=[{'all':!![]}];}_0x3cf79b=_[_0x1d85('0x3b')]({},_0x3cf79b,_0x2293f1[_0x1d85('0x3d')]);return db[_0x1d85('0x2a')][_0x1d85('0x42')](_0x3cf79b)[_0x1d85('0x23')](handleEntityNotFound(_0x5bc37a,null))[_0x1d85('0x23')](respondWithResult(_0x5bc37a,null))[_0x1d85('0x43')](handleError(_0x5bc37a,null));};exports[_0x1d85('0x44')]=function(_0x489c90,_0x1f3e03){return db[_0x1d85('0x2a')]['create'](_0x489c90[_0x1d85('0x45')],{})[_0x1d85('0x23')](respondWithResult(_0x1f3e03,0xc9))[_0x1d85('0x43')](handleError(_0x1f3e03,null));};exports['update']=function(_0x337239,_0xc6def1){if(_0x337239[_0x1d85('0x45')]['id']){delete _0x337239[_0x1d85('0x45')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x337239[_0x1d85('0x46')]['id']}})['then'](handleEntityNotFound(_0xc6def1,null))['then'](saveUpdates(_0x337239['body'],null))[_0x1d85('0x23')](respondWithResult(_0xc6def1,null))[_0x1d85('0x43')](handleError(_0xc6def1,null));};exports['destroy']=function(_0x5a2b44,_0x29928e){return db[_0x1d85('0x2a')][_0x1d85('0x42')]({'where':{'id':_0x5a2b44['params']['id']}})[_0x1d85('0x23')](handleEntityNotFound(_0x29928e,null))[_0x1d85('0x23')](removeEntity(_0x29928e,null))[_0x1d85('0x43')](handleError(_0x29928e,null));};exports[_0x1d85('0x47')]=function(_0x56e3de,_0x1babd2,_0x1edf01){var _0x342261={};var _0x2460e7={};var _0x378bf7;var _0x5f2ab6;return db[_0x1d85('0x2a')][_0x1d85('0x48')]({'where':{'id':_0x56e3de[_0x1d85('0x46')]['id']}})['then'](handleEntityNotFound(_0x1babd2,null))['then'](function(_0x1a3f8f){if(_0x1a3f8f){_0x378bf7=_0x1a3f8f;_0x2460e7[_0x1d85('0x2f')]=_[_0x1d85('0x31')](db[_0x1d85('0x49')]['rawAttributes']);_0x2460e7[_0x1d85('0x30')]=_[_0x1d85('0x31')](_0x56e3de[_0x1d85('0x30')]);_0x2460e7[_0x1d85('0x32')]=_[_0x1d85('0x33')](_0x2460e7[_0x1d85('0x2f')],_0x2460e7[_0x1d85('0x30')]);_0x342261['attributes']=_[_0x1d85('0x33')](_0x2460e7[_0x1d85('0x2f')],qs[_0x1d85('0x35')](_0x56e3de[_0x1d85('0x30')][_0x1d85('0x35')]));_0x342261[_0x1d85('0x34')]=_0x342261[_0x1d85('0x34')][_0x1d85('0x36')]?_0x342261[_0x1d85('0x34')]:_0x2460e7[_0x1d85('0x2f')];_0x342261[_0x1d85('0x39')]=qs[_0x1d85('0x4a')](_0x56e3de[_0x1d85('0x30')]['sort']);_0x342261[_0x1d85('0x3a')]=qs[_0x1d85('0x32')](_[_0x1d85('0x4b')](_0x56e3de[_0x1d85('0x30')],_0x2460e7['filters']));if(_0x56e3de[_0x1d85('0x30')][_0x1d85('0x3c')]){_0x342261[_0x1d85('0x3a')]=_['merge'](_0x342261[_0x1d85('0x3a')],{'$or':_[_0x1d85('0x29')](_0x342261[_0x1d85('0x34')],function(_0x3ea3b2){var _0x5bf86d={};_0x5bf86d[_0x3ea3b2]={'$like':'%'+_0x56e3de[_0x1d85('0x30')][_0x1d85('0x3c')]+'%'};return _0x5bf86d;})});}_0x342261=_[_0x1d85('0x3b')]({},_0x342261,_0x56e3de['options']);return _0x378bf7[_0x1d85('0x47')](_0x342261);}})[_0x1d85('0x23')](function(_0x130207){if(_0x130207){_0x5f2ab6=_0x130207['length'];if(!_0x56e3de[_0x1d85('0x30')][_0x1d85('0x37')](_0x1d85('0x38'))){_0x342261[_0x1d85('0x1e')]=qs[_0x1d85('0x1e')](_0x56e3de[_0x1d85('0x30')][_0x1d85('0x1e')]);_0x342261[_0x1d85('0x1b')]=qs[_0x1d85('0x1b')](_0x56e3de[_0x1d85('0x30')][_0x1d85('0x1b')]);}return _0x378bf7[_0x1d85('0x47')](_0x342261);}})[_0x1d85('0x23')](function(_0x2e6326){if(_0x2e6326){return _0x2e6326?{'count':_0x5f2ab6,'rows':_0x2e6326}:null;}})[_0x1d85('0x23')](respondWithResult(_0x1babd2,null))['catch'](handleError(_0x1babd2,null));};exports['getSubjects']=function(_0x1e0071,_0x2954df,_0x560eb4){var _0x493300={};var _0x3bf75b={};var _0x1c5027;var _0x1c401c;return db[_0x1d85('0x2a')][_0x1d85('0x48')]({'where':{'id':_0x1e0071[_0x1d85('0x46')]['id']}})[_0x1d85('0x23')](handleEntityNotFound(_0x2954df,null))[_0x1d85('0x23')](function(_0x44a4e5){if(_0x44a4e5){_0x1c5027=_0x44a4e5;_0x3bf75b[_0x1d85('0x2f')]=_['keys'](db[_0x1d85('0x49')][_0x1d85('0x2b')]);_0x3bf75b['query']=_['keys'](_0x1e0071['query']);_0x3bf75b['filters']=_['intersection'](_0x3bf75b['model'],_0x3bf75b['query']);_0x493300[_0x1d85('0x34')]=_[_0x1d85('0x33')](_0x3bf75b[_0x1d85('0x2f')],qs[_0x1d85('0x35')](_0x1e0071[_0x1d85('0x30')][_0x1d85('0x35')]));_0x493300[_0x1d85('0x34')]=_0x493300[_0x1d85('0x34')][_0x1d85('0x36')]?_0x493300[_0x1d85('0x34')]:_0x3bf75b[_0x1d85('0x2f')];_0x493300[_0x1d85('0x39')]=qs[_0x1d85('0x4a')](_0x1e0071[_0x1d85('0x30')][_0x1d85('0x4a')]);_0x493300[_0x1d85('0x3a')]=qs['filters'](_['pick'](_0x1e0071[_0x1d85('0x30')],_0x3bf75b['filters']));if(_0x1e0071[_0x1d85('0x30')][_0x1d85('0x3c')]){_0x493300['where']=_['merge'](_0x493300[_0x1d85('0x3a')],{'$or':_[_0x1d85('0x29')](_0x493300['attributes'],function(_0x4973c3){var _0x54bcee={};_0x54bcee[_0x4973c3]={'$like':'%'+_0x1e0071[_0x1d85('0x30')]['filter']+'%'};return _0x54bcee;})});}_0x493300=_[_0x1d85('0x3b')]({},_0x493300,_0x1e0071[_0x1d85('0x3d')]);return _0x1c5027[_0x1d85('0x4c')](_0x493300);}})[_0x1d85('0x23')](function(_0x244b0b){if(_0x244b0b){_0x1c401c=_0x244b0b['length'];if(!_0x1e0071['query'][_0x1d85('0x37')]('nolimit')){_0x493300[_0x1d85('0x1e')]=qs['limit'](_0x1e0071[_0x1d85('0x30')][_0x1d85('0x1e')]);_0x493300[_0x1d85('0x1b')]=qs[_0x1d85('0x1b')](_0x1e0071[_0x1d85('0x30')][_0x1d85('0x1b')]);}return _0x1c5027[_0x1d85('0x4c')](_0x493300);}})['then'](function(_0x4f5236){if(_0x4f5236){return _0x4f5236?{'count':_0x1c401c,'rows':_0x4f5236}:null;}})['then'](respondWithResult(_0x2954df,null))[_0x1d85('0x43')](handleError(_0x2954df,null));};exports['getDescriptions']=function(_0x1d38aa,_0x30b38b,_0x5df528){var _0x54c96a={};var _0x2ab4ee={};var _0x1e2e44;var _0x2761ea;return db['VtigerConfiguration'][_0x1d85('0x48')]({'where':{'id':_0x1d38aa[_0x1d85('0x46')]['id']}})['then'](handleEntityNotFound(_0x30b38b,null))['then'](function(_0x2f4314){if(_0x2f4314){_0x1e2e44=_0x2f4314;_0x2ab4ee[_0x1d85('0x2f')]=_[_0x1d85('0x31')](db[_0x1d85('0x49')]['rawAttributes']);_0x2ab4ee[_0x1d85('0x30')]=_[_0x1d85('0x31')](_0x1d38aa[_0x1d85('0x30')]);_0x2ab4ee[_0x1d85('0x32')]=_[_0x1d85('0x33')](_0x2ab4ee[_0x1d85('0x2f')],_0x2ab4ee[_0x1d85('0x30')]);_0x54c96a['attributes']=_[_0x1d85('0x33')](_0x2ab4ee[_0x1d85('0x2f')],qs[_0x1d85('0x35')](_0x1d38aa[_0x1d85('0x30')][_0x1d85('0x35')]));_0x54c96a['attributes']=_0x54c96a['attributes']['length']?_0x54c96a[_0x1d85('0x34')]:_0x2ab4ee['model'];_0x54c96a['order']=qs[_0x1d85('0x4a')](_0x1d38aa[_0x1d85('0x30')][_0x1d85('0x4a')]);_0x54c96a['where']=qs['filters'](_[_0x1d85('0x4b')](_0x1d38aa[_0x1d85('0x30')],_0x2ab4ee[_0x1d85('0x32')]));if(_0x1d38aa[_0x1d85('0x30')][_0x1d85('0x3c')]){_0x54c96a[_0x1d85('0x3a')]=_[_0x1d85('0x3b')](_0x54c96a['where'],{'$or':_['map'](_0x54c96a[_0x1d85('0x34')],function(_0x205844){var _0x56ffcb={};_0x56ffcb[_0x205844]={'$like':'%'+_0x1d38aa[_0x1d85('0x30')][_0x1d85('0x3c')]+'%'};return _0x56ffcb;})});}_0x54c96a=_[_0x1d85('0x3b')]({},_0x54c96a,_0x1d38aa[_0x1d85('0x3d')]);return _0x1e2e44[_0x1d85('0x4d')](_0x54c96a);}})[_0x1d85('0x23')](function(_0x2d5e8b){if(_0x2d5e8b){_0x2761ea=_0x2d5e8b[_0x1d85('0x36')];if(!_0x1d38aa[_0x1d85('0x30')][_0x1d85('0x37')](_0x1d85('0x38'))){_0x54c96a[_0x1d85('0x1e')]=qs[_0x1d85('0x1e')](_0x1d38aa['query'][_0x1d85('0x1e')]);_0x54c96a[_0x1d85('0x1b')]=qs['offset'](_0x1d38aa[_0x1d85('0x30')][_0x1d85('0x1b')]);}return _0x1e2e44[_0x1d85('0x4d')](_0x54c96a);}})[_0x1d85('0x23')](function(_0x14720c){if(_0x14720c){return _0x14720c?{'count':_0x2761ea,'rows':_0x14720c}:null;}})[_0x1d85('0x23')](respondWithResult(_0x30b38b,null))[_0x1d85('0x43')](handleError(_0x30b38b,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 4037ab4..95283c7 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 _0x1b07=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','define','int_vtiger_configurations','lodash'];(function(_0x5282cd,_0xb65881){var _0xe5b28e=function(_0x2882d9){while(--_0x2882d9){_0x5282cd['push'](_0x5282cd['shift']());}};_0xe5b28e(++_0xb65881);}(_0x1b07,0x153));var _0x71b0=function(_0x26f1b2,_0x33d843){_0x26f1b2=_0x26f1b2-0x0;var _0x1624a4=_0x1b07[_0x26f1b2];return _0x1624a4;};'use strict';var _=require(_0x71b0('0x0'));var util=require('util');var logger=require(_0x71b0('0x1'))('api');var moment=require(_0x71b0('0x2'));var BPromise=require(_0x71b0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x71b0('0x4'));var rimraf=require(_0x71b0('0x5'));var config=require(_0x71b0('0x6'));var attributes=require(_0x71b0('0x7'));module['exports']=function(_0x25518e,_0x6578ca){return _0x25518e[_0x71b0('0x8')]('VtigerConfiguration',attributes,{'tableName':_0x71b0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x404c=['moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','lodash','util','../../config/logger','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x404c,0x1c4));var _0xc404=function(_0x1e132d,_0xc4bc18){_0x1e132d=_0x1e132d-0x0;var _0x596b2a=_0x404c[_0x1e132d];return _0x596b2a;};'use strict';var _=require(_0xc404('0x0'));var util=require(_0xc404('0x1'));var logger=require(_0xc404('0x2'))(_0xc404('0x3'));var moment=require(_0xc404('0x4'));var BPromise=require(_0xc404('0x5'));var rp=require(_0xc404('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc404('0x7'));var config=require(_0xc404('0x8'));var attributes=require(_0xc404('0x9'));module[_0xc404('0xa')]=function(_0x432e68,_0x3dc000){return _0x432e68['define'](_0xc404('0xb'),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 b2822c2..1ed370a 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 _0xa92d=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','VtigerConfiguration,\x20%s,\x20%s','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x4ed1d4,_0x512d9a){var _0x28e363=function(_0x2bdfb7){while(--_0x2bdfb7){_0x4ed1d4['push'](_0x4ed1d4['shift']());}};_0x28e363(++_0x512d9a);}(_0xa92d,0x1c7));var _0xda92=function(_0xd684fd,_0x62eef1){_0xd684fd=_0xd684fd-0x0;var _0x2cb8eb=_0xa92d[_0xd684fd];return _0x2cb8eb;};'use strict';var _=require(_0xda92('0x0'));var util=require(_0xda92('0x1'));var moment=require(_0xda92('0x2'));var BPromise=require(_0xda92('0x3'));var rs=require(_0xda92('0x4'));var fs=require('fs');var Redis=require(_0xda92('0x5'));var db=require(_0xda92('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xda92('0x7'))('rpc');var config=require(_0xda92('0x8'));var jayson=require(_0xda92('0x9'));var client=jayson[_0xda92('0xa')][_0xda92('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b2219,_0x49d386,_0x52131d){return new BPromise(function(_0x34d4e6,_0x176529){return client[_0xda92('0xc')](_0x4b2219,_0x52131d)['then'](function(_0x27f622){logger[_0xda92('0xd')](_0xda92('0xe'),_0x49d386,'request\x20sent');logger['debug'](_0xda92('0xf'),_0x49d386,_0xda92('0x10'),JSON[_0xda92('0x11')](_0x27f622));if(_0x27f622[_0xda92('0x12')]){if(_0x27f622['error'][_0xda92('0x13')]===0x1f4){logger[_0xda92('0x12')](_0xda92('0xe'),_0x49d386,_0x27f622[_0xda92('0x12')]['message']);return _0x176529(_0x27f622[_0xda92('0x12')][_0xda92('0x14')]);}logger[_0xda92('0x12')](_0xda92('0xe'),_0x49d386,_0x27f622['error'][_0xda92('0x14')]);return _0x34d4e6(_0x27f622[_0xda92('0x12')][_0xda92('0x14')]);}else{logger['info'](_0xda92('0xe'),_0x49d386,_0xda92('0x10'));_0x34d4e6(_0x27f622[_0xda92('0x15')][_0xda92('0x14')]);}})[_0xda92('0x16')](function(_0x1a7a7f){logger[_0xda92('0x12')](_0xda92('0xe'),_0x49d386,_0x1a7a7f);_0x176529(_0x1a7a7f);});});} \ No newline at end of file +var _0xc04f=['ioredis','../../mysqldb','../../config/logger','jayson/promise','request','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','VtigerConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0xb4788,_0x1efb8d){var _0xd49d21=function(_0x2b2a2b){while(--_0x2b2a2b){_0xb4788['push'](_0xb4788['shift']());}};_0xd49d21(++_0x1efb8d);}(_0xc04f,0x1b3));var _0xfc04=function(_0x191f9d,_0x21976f){_0x191f9d=_0x191f9d-0x0;var _0x58e60d=_0xc04f[_0x191f9d];return _0x58e60d;};'use strict';var _=require(_0xfc04('0x0'));var util=require(_0xfc04('0x1'));var moment=require(_0xfc04('0x2'));var BPromise=require(_0xfc04('0x3'));var rs=require(_0xfc04('0x4'));var fs=require('fs');var Redis=require(_0xfc04('0x5'));var db=require(_0xfc04('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xfc04('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfc04('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4f7d81,_0x1b0510,_0x3cb39d){return new BPromise(function(_0x27abaa,_0x178973){return client[_0xfc04('0x9')](_0x4f7d81,_0x3cb39d)[_0xfc04('0xa')](function(_0x29626d){logger[_0xfc04('0xb')]('VtigerConfiguration,\x20%s,\x20%s',_0x1b0510,_0xfc04('0xc'));logger[_0xfc04('0xd')](_0xfc04('0xe'),_0x1b0510,_0xfc04('0xc'),JSON['stringify'](_0x29626d));if(_0x29626d[_0xfc04('0xf')]){if(_0x29626d[_0xfc04('0xf')][_0xfc04('0x10')]===0x1f4){logger[_0xfc04('0xf')](_0xfc04('0x11'),_0x1b0510,_0x29626d[_0xfc04('0xf')]['message']);return _0x178973(_0x29626d['error']['message']);}logger['error'](_0xfc04('0x11'),_0x1b0510,_0x29626d['error'][_0xfc04('0x12')]);return _0x27abaa(_0x29626d['error'][_0xfc04('0x12')]);}else{logger[_0xfc04('0xb')](_0xfc04('0x11'),_0x1b0510,_0xfc04('0xc'));_0x27abaa(_0x29626d['result'][_0xfc04('0x12')]);}})[_0xfc04('0x13')](function(_0x5d007a){logger[_0xfc04('0xf')](_0xfc04('0x11'),_0x1b0510,_0x5d007a);_0x178973(_0x5d007a);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 234ccf0..513ec57 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 _0xaa5f=['get','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','util','path','express','../../components/auth/service','../../config/environment','./intVtigerField.controller'];(function(_0x5d7299,_0x544bc0){var _0x3125ea=function(_0x464bbd){while(--_0x464bbd){_0x5d7299['push'](_0x5d7299['shift']());}};_0x3125ea(++_0x544bc0);}(_0xaa5f,0x1ba));var _0xfaa5=function(_0x4b97da,_0x2ea8c4){_0x4b97da=_0x4b97da-0x0;var _0x32457c=_0xaa5f[_0x4b97da];return _0x32457c;};'use strict';var multer=require('multer');var util=require(_0xfaa5('0x0'));var path=require(_0xfaa5('0x1'));var timeout=require('connect-timeout');var express=require(_0xfaa5('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfaa5('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xfaa5('0x4'));var controller=require(_0xfaa5('0x5'));router[_0xfaa5('0x6')]('/',auth[_0xfaa5('0x7')](),controller[_0xfaa5('0x8')]);router['get'](_0xfaa5('0x9'),auth['isAuthenticated'](),controller[_0xfaa5('0xa')]);router[_0xfaa5('0xb')]('/',auth[_0xfaa5('0x7')](),controller['create']);router['put'](_0xfaa5('0x9'),auth['isAuthenticated'](),controller[_0xfaa5('0xc')]);router[_0xfaa5('0xd')](_0xfaa5('0x9'),auth['isAuthenticated'](),controller[_0xfaa5('0xe')]);module[_0xfaa5('0xf')]=router; \ No newline at end of file +var _0x1a57=['connect-timeout','Router','fs-extra','../../components/interaction/service','./intVtigerField.controller','isAuthenticated','get','/:id','post','create','put','update','destroy','exports','multer','util','path'];(function(_0x514c15,_0x486901){var _0x16283e=function(_0x53b7d0){while(--_0x53b7d0){_0x514c15['push'](_0x514c15['shift']());}};_0x16283e(++_0x486901);}(_0x1a57,0x1ea));var _0x71a5=function(_0x498c2b,_0x34b13e){_0x498c2b=_0x498c2b-0x0;var _0x1b9b6f=_0x1a57[_0x498c2b];return _0x1b9b6f;};'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('../../config/environment');var controller=require(_0x71a5('0x7'));router['get']('/',auth[_0x71a5('0x8')](),controller['index']);router[_0x71a5('0x9')](_0x71a5('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x71a5('0xb')]('/',auth[_0x71a5('0x8')](),controller[_0x71a5('0xc')]);router[_0x71a5('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x71a5('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x71a5('0xf')]);module[_0x71a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 32945cf..ec42e6a 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 _0x84c7=['exports','variable','customVariable','picklist','string','STRING','ENUM','sequelize'];(function(_0x43379c,_0x271d36){var _0x495648=function(_0x3f4652){while(--_0x3f4652){_0x43379c['push'](_0x43379c['shift']());}};_0x495648(++_0x271d36);}(_0x84c7,0x14f));var _0x784c=function(_0x2c5f35,_0x52cfec){_0x2c5f35=_0x2c5f35-0x0;var _0x537dcd=_0x84c7[_0x2c5f35];return _0x537dcd;};'use strict';var Sequelize=require(_0x784c('0x0'));module[_0x784c('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x784c('0x2'),_0x784c('0x3'),'keyValue',_0x784c('0x4')),'defaultValue':_0x784c('0x5')},'content':{'type':Sequelize[_0x784c('0x6')]},'key':{'type':Sequelize[_0x784c('0x6')]},'keyType':{'type':Sequelize[_0x784c('0x7')](_0x784c('0x5'),_0x784c('0x2'),_0x784c('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x784c('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc7c6=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x25b022,_0x394a08){var _0x2e13a5=function(_0xe9495d){while(--_0xe9495d){_0x25b022['push'](_0x25b022['shift']());}};_0x2e13a5(++_0x394a08);}(_0xc7c6,0xc0));var _0x6c7c=function(_0x5d502f,_0x52b214){_0x5d502f=_0x5d502f-0x0;var _0x1c965b=_0xc7c6[_0x5d502f];return _0x1c965b;};'use strict';var Sequelize=require(_0x6c7c('0x0'));module[_0x6c7c('0x1')]={'type':{'type':Sequelize[_0x6c7c('0x2')](_0x6c7c('0x3'),_0x6c7c('0x4'),_0x6c7c('0x5'),_0x6c7c('0x6'),_0x6c7c('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x6c7c('0x8')]},'key':{'type':Sequelize[_0x6c7c('0x8')]},'keyType':{'type':Sequelize[_0x6c7c('0x2')](_0x6c7c('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x6c7c('0x8')]},'idField':{'type':Sequelize[_0x6c7c('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6c7c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6c7c('0x8')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 2cbb49b..218c79a 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 _0x3024=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','VtigerField','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','find','body','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x45c981,_0x2ad2d4){var _0x4f62c8=function(_0x55209b){while(--_0x55209b){_0x45c981['push'](_0x45c981['shift']());}};_0x4f62c8(++_0x2ad2d4);}(_0x3024,0x1ec));var _0x4302=function(_0x4f58c7,_0x5317df){_0x4f58c7=_0x4f58c7-0x0;var _0x1ef57c=_0x3024[_0x4f58c7];return _0x1ef57c;};'use strict';var emlformat=require(_0x4302('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4302('0x1'));var rp=require(_0x4302('0x2'));var moment=require(_0x4302('0x3'));var BPromise=require(_0x4302('0x4'));var Mustache=require(_0x4302('0x5'));var util=require(_0x4302('0x6'));var path=require('path');var sox=require(_0x4302('0x7'));var csv=require(_0x4302('0x8'));var ejs=require(_0x4302('0x9'));var fs=require('fs');var fs_extra=require(_0x4302('0xa'));var _=require(_0x4302('0xb'));var squel=require(_0x4302('0xc'));var crypto=require(_0x4302('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4302('0x8'));var querystring=require(_0x4302('0xe'));var Papa=require(_0x4302('0xf'));var Redis=require(_0x4302('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4302('0x11'));var as=require(_0x4302('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4302('0x13'))('api');var utils=require(_0x4302('0x14'));var config=require(_0x4302('0x15'));var licenseUtil=require(_0x4302('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1967df,_0x480b37){_0x480b37=_0x480b37||0xcc;return function(_0x2f87e5){if(_0x2f87e5){return _0x1967df[_0x4302('0x17')](_0x480b37);}return _0x1967df['status'](_0x480b37)['end']();};}function respondWithResult(_0x168609,_0x25c93b){_0x25c93b=_0x25c93b||0xc8;return function(_0xa9f1b9){if(_0xa9f1b9){return _0x168609[_0x4302('0x18')](_0x25c93b)[_0x4302('0x19')](_0xa9f1b9);}};}function respondWithFilteredResult(_0x6a339d,_0x4428aa){return function(_0x485a7f){if(_0x485a7f){var _0x1b4f9b=typeof _0x4428aa[_0x4302('0x1a')]===_0x4302('0x1b')&&typeof _0x4428aa[_0x4302('0x1c')]===_0x4302('0x1b');var _0x41eff9=_0x485a7f['count'];var _0x3d0116=_0x1b4f9b?0x0:_0x4428aa[_0x4302('0x1a')];var _0x34914b=_0x1b4f9b?_0x485a7f['count']:_0x4428aa[_0x4302('0x1a')]+_0x4428aa[_0x4302('0x1c')];var _0x5247be;if(_0x34914b>=_0x41eff9){_0x34914b=_0x41eff9;_0x5247be=0xc8;}else{_0x5247be=0xce;}_0x6a339d[_0x4302('0x18')](_0x5247be);return _0x6a339d[_0x4302('0x1d')](_0x4302('0x1e'),_0x3d0116+'-'+_0x34914b+'/'+_0x41eff9)[_0x4302('0x19')](_0x485a7f);}return null;};}function patchUpdates(_0x17544a){return function(_0x9a9266){try{jsonpatch[_0x4302('0x1f')](_0x9a9266,_0x17544a,!![]);}catch(_0x5a4f5b){return BPromise[_0x4302('0x20')](_0x5a4f5b);}return _0x9a9266[_0x4302('0x21')]();};}function saveUpdates(_0x270d64,_0x5d98bc){return function(_0xf2e875){if(_0xf2e875){return _0xf2e875[_0x4302('0x22')](_0x270d64)[_0x4302('0x23')](function(_0x535669){return _0x535669;});}return null;};}function removeEntity(_0x38962d,_0x229ecc){return function(_0x3c4fdb){if(_0x3c4fdb){return _0x3c4fdb['destroy']()[_0x4302('0x23')](function(){_0x38962d[_0x4302('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x137e59,_0x290403){return function(_0x152f0b){if(!_0x152f0b){_0x137e59[_0x4302('0x17')](0x194);}return _0x152f0b;};}function handleError(_0x17e257,_0x39c10f){_0x39c10f=_0x39c10f||0x1f4;return function(_0x4d18c2){logger[_0x4302('0x24')](_0x4d18c2[_0x4302('0x25')]);if(_0x4d18c2[_0x4302('0x26')]){delete _0x4d18c2[_0x4302('0x26')];}_0x17e257[_0x4302('0x18')](_0x39c10f)['send'](_0x4d18c2);};}exports[_0x4302('0x27')]=function(_0x528ae8,_0x2ac4ca){var _0x556cf5={},_0x16d7e7={},_0x4eebf0={'count':0x0,'rows':[]};var _0x324db2=_[_0x4302('0x28')](db[_0x4302('0x29')][_0x4302('0x2a')],function(_0x104583){return{'name':_0x104583[_0x4302('0x2b')],'type':_0x104583[_0x4302('0x2c')]['key']};});_0x16d7e7[_0x4302('0x2d')]=_[_0x4302('0x28')](_0x324db2,_0x4302('0x26'));_0x16d7e7['query']=_[_0x4302('0x2e')](_0x528ae8[_0x4302('0x2f')]);_0x16d7e7[_0x4302('0x30')]=_[_0x4302('0x31')](_0x16d7e7[_0x4302('0x2d')],_0x16d7e7['query']);_0x556cf5[_0x4302('0x32')]=_[_0x4302('0x31')](_0x16d7e7[_0x4302('0x2d')],qs[_0x4302('0x33')](_0x528ae8[_0x4302('0x2f')]['fields']));_0x556cf5['attributes']=_0x556cf5[_0x4302('0x32')][_0x4302('0x34')]?_0x556cf5[_0x4302('0x32')]:_0x16d7e7[_0x4302('0x2d')];if(!_0x528ae8['query'][_0x4302('0x35')](_0x4302('0x36'))){_0x556cf5[_0x4302('0x1c')]=qs[_0x4302('0x1c')](_0x528ae8['query']['limit']);_0x556cf5['offset']=qs[_0x4302('0x1a')](_0x528ae8['query'][_0x4302('0x1a')]);}_0x556cf5[_0x4302('0x37')]=qs[_0x4302('0x38')](_0x528ae8[_0x4302('0x2f')][_0x4302('0x38')]);_0x556cf5[_0x4302('0x39')]=qs[_0x4302('0x30')](_[_0x4302('0x3a')](_0x528ae8['query'],_0x16d7e7[_0x4302('0x30')]),_0x324db2);if(_0x528ae8[_0x4302('0x2f')][_0x4302('0x3b')]){_0x556cf5[_0x4302('0x39')]=_[_0x4302('0x3c')](_0x556cf5[_0x4302('0x39')],{'$or':_['map'](_0x324db2,function(_0x479e1b){if(_0x479e1b['type']!==_0x4302('0x3d')){var _0x5c3afc={};_0x5c3afc[_0x479e1b['name']]={'$like':'%'+_0x528ae8[_0x4302('0x2f')][_0x4302('0x3b')]+'%'};return _0x5c3afc;}})});}_0x556cf5=_[_0x4302('0x3c')]({},_0x556cf5,_0x528ae8[_0x4302('0x3e')]);var _0x1fa4e3={'where':_0x556cf5[_0x4302('0x39')]};return db[_0x4302('0x29')][_0x4302('0x3f')](_0x1fa4e3)[_0x4302('0x23')](function(_0x48f994){_0x4eebf0[_0x4302('0x3f')]=_0x48f994;if(_0x528ae8[_0x4302('0x2f')][_0x4302('0x40')]){_0x556cf5[_0x4302('0x41')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x556cf5);})[_0x4302('0x23')](function(_0x36c135){_0x4eebf0[_0x4302('0x42')]=_0x36c135;return _0x4eebf0;})[_0x4302('0x23')](respondWithFilteredResult(_0x2ac4ca,_0x556cf5))[_0x4302('0x43')](handleError(_0x2ac4ca,null));};exports[_0x4302('0x44')]=function(_0x5393c9,_0x377d97){var _0x4142b4={'raw':!![],'where':{'id':_0x5393c9[_0x4302('0x45')]['id']}},_0x59f00e={};_0x59f00e['model']=_[_0x4302('0x2e')](db['VtigerField'][_0x4302('0x2a')]);_0x59f00e['query']=_['keys'](_0x5393c9[_0x4302('0x2f')]);_0x59f00e[_0x4302('0x30')]=_['intersection'](_0x59f00e['model'],_0x59f00e[_0x4302('0x2f')]);_0x4142b4[_0x4302('0x32')]=_['intersection'](_0x59f00e[_0x4302('0x2d')],qs[_0x4302('0x33')](_0x5393c9[_0x4302('0x2f')][_0x4302('0x33')]));_0x4142b4['attributes']=_0x4142b4[_0x4302('0x32')][_0x4302('0x34')]?_0x4142b4[_0x4302('0x32')]:_0x59f00e['model'];if(_0x5393c9[_0x4302('0x2f')][_0x4302('0x40')]){_0x4142b4[_0x4302('0x41')]=[{'all':!![]}];}_0x4142b4=_[_0x4302('0x3c')]({},_0x4142b4,_0x5393c9[_0x4302('0x3e')]);return db[_0x4302('0x29')][_0x4302('0x46')](_0x4142b4)[_0x4302('0x23')](handleEntityNotFound(_0x377d97,null))[_0x4302('0x23')](respondWithResult(_0x377d97,null))[_0x4302('0x43')](handleError(_0x377d97,null));};exports['create']=function(_0x261d9b,_0x428dbb){return db[_0x4302('0x29')]['create'](_0x261d9b['body'],{})['then'](respondWithResult(_0x428dbb,0xc9))[_0x4302('0x43')](handleError(_0x428dbb,null));};exports[_0x4302('0x22')]=function(_0x355d68,_0x563980){if(_0x355d68[_0x4302('0x47')]['id']){delete _0x355d68['body']['id'];}return db['VtigerField'][_0x4302('0x46')]({'where':{'id':_0x355d68[_0x4302('0x45')]['id']}})[_0x4302('0x23')](handleEntityNotFound(_0x563980,null))[_0x4302('0x23')](saveUpdates(_0x355d68[_0x4302('0x47')],null))[_0x4302('0x23')](respondWithResult(_0x563980,null))[_0x4302('0x43')](handleError(_0x563980,null));};exports[_0x4302('0x48')]=function(_0x1a5f6f,_0x47c8e3){return db[_0x4302('0x29')]['find']({'where':{'id':_0x1a5f6f[_0x4302('0x45')]['id']}})[_0x4302('0x23')](handleEntityNotFound(_0x47c8e3,null))[_0x4302('0x23')](removeEntity(_0x47c8e3,null))[_0x4302('0x43')](handleError(_0x47c8e3,null));}; \ No newline at end of file +var _0x21cb=['set','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','VtigerField','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','count'];(function(_0x239b31,_0x44a64d){var _0x41c8be=function(_0x27f031){while(--_0x27f031){_0x239b31['push'](_0x239b31['shift']());}};_0x41c8be(++_0x44a64d);}(_0x21cb,0xc4));var _0xb21c=function(_0x19b710,_0x27697a){_0x19b710=_0x19b710-0x0;var _0xd0b3b6=_0x21cb[_0x19b710];return _0xd0b3b6;};'use strict';var emlformat=require(_0xb21c('0x0'));var rimraf=require(_0xb21c('0x1'));var zipdir=require(_0xb21c('0x2'));var jsonpatch=require(_0xb21c('0x3'));var rp=require('request-promise');var moment=require(_0xb21c('0x4'));var BPromise=require(_0xb21c('0x5'));var Mustache=require(_0xb21c('0x6'));var util=require('util');var path=require(_0xb21c('0x7'));var sox=require('sox');var csv=require(_0xb21c('0x8'));var ejs=require(_0xb21c('0x9'));var fs=require('fs');var fs_extra=require(_0xb21c('0xa'));var _=require(_0xb21c('0xb'));var squel=require('squel');var crypto=require(_0xb21c('0xc'));var jsforce=require(_0xb21c('0xd'));var deskjs=require(_0xb21c('0xe'));var toCsv=require(_0xb21c('0x8'));var querystring=require(_0xb21c('0xf'));var Papa=require(_0xb21c('0x10'));var Redis=require(_0xb21c('0x11'));var authService=require(_0xb21c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb21c('0x13'));var hardwareService=require(_0xb21c('0x14'));var logger=require(_0xb21c('0x15'))(_0xb21c('0x16'));var utils=require(_0xb21c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xb21c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x576554,_0x2435f5){_0x2435f5=_0x2435f5||0xcc;return function(_0x1340f3){if(_0x1340f3){return _0x576554[_0xb21c('0x19')](_0x2435f5);}return _0x576554[_0xb21c('0x1a')](_0x2435f5)[_0xb21c('0x1b')]();};}function respondWithResult(_0x2a0aee,_0x446db5){_0x446db5=_0x446db5||0xc8;return function(_0x280ee7){if(_0x280ee7){return _0x2a0aee[_0xb21c('0x1a')](_0x446db5)[_0xb21c('0x1c')](_0x280ee7);}};}function respondWithFilteredResult(_0x489c2c,_0x2bec12){return function(_0x4a67c8){if(_0x4a67c8){var _0x5dce1a=typeof _0x2bec12[_0xb21c('0x1d')]==='undefined'&&typeof _0x2bec12[_0xb21c('0x1e')]==='undefined';var _0x43060f=_0x4a67c8['count'];var _0x1fd7be=_0x5dce1a?0x0:_0x2bec12['offset'];var _0x226844=_0x5dce1a?_0x4a67c8[_0xb21c('0x1f')]:_0x2bec12[_0xb21c('0x1d')]+_0x2bec12[_0xb21c('0x1e')];var _0x155fa7;if(_0x226844>=_0x43060f){_0x226844=_0x43060f;_0x155fa7=0xc8;}else{_0x155fa7=0xce;}_0x489c2c['status'](_0x155fa7);return _0x489c2c[_0xb21c('0x20')](_0xb21c('0x21'),_0x1fd7be+'-'+_0x226844+'/'+_0x43060f)['json'](_0x4a67c8);}return null;};}function patchUpdates(_0x3717c6){return function(_0x2b6daf){try{jsonpatch[_0xb21c('0x22')](_0x2b6daf,_0x3717c6,!![]);}catch(_0x138ec0){return BPromise[_0xb21c('0x23')](_0x138ec0);}return _0x2b6daf[_0xb21c('0x24')]();};}function saveUpdates(_0x59bf7e,_0x2b5d31){return function(_0x4d1ec8){if(_0x4d1ec8){return _0x4d1ec8[_0xb21c('0x25')](_0x59bf7e)[_0xb21c('0x26')](function(_0x1ef3be){return _0x1ef3be;});}return null;};}function removeEntity(_0x2474f2,_0x507331){return function(_0x340fd9){if(_0x340fd9){return _0x340fd9['destroy']()[_0xb21c('0x26')](function(){_0x2474f2[_0xb21c('0x1a')](0xcc)[_0xb21c('0x1b')]();});}};}function handleEntityNotFound(_0x150c33,_0x3055e8){return function(_0x3e39f1){if(!_0x3e39f1){_0x150c33[_0xb21c('0x19')](0x194);}return _0x3e39f1;};}function handleError(_0x17aa39,_0x20dcfc){_0x20dcfc=_0x20dcfc||0x1f4;return function(_0x888cf8){logger[_0xb21c('0x27')](_0x888cf8[_0xb21c('0x28')]);if(_0x888cf8[_0xb21c('0x29')]){delete _0x888cf8['name'];}_0x17aa39[_0xb21c('0x1a')](_0x20dcfc)[_0xb21c('0x2a')](_0x888cf8);};}exports['index']=function(_0x57b097,_0x2081b1){var _0xe5080e={},_0x3c8e7b={},_0x3c6d86={'count':0x0,'rows':[]};var _0x223813=_[_0xb21c('0x2b')](db['VtigerField']['rawAttributes'],function(_0x5d0d13){return{'name':_0x5d0d13[_0xb21c('0x2c')],'type':_0x5d0d13[_0xb21c('0x2d')]['key']};});_0x3c8e7b[_0xb21c('0x2e')]=_[_0xb21c('0x2b')](_0x223813,_0xb21c('0x29'));_0x3c8e7b[_0xb21c('0x2f')]=_['keys'](_0x57b097[_0xb21c('0x2f')]);_0x3c8e7b[_0xb21c('0x30')]=_[_0xb21c('0x31')](_0x3c8e7b['model'],_0x3c8e7b[_0xb21c('0x2f')]);_0xe5080e['attributes']=_[_0xb21c('0x31')](_0x3c8e7b[_0xb21c('0x2e')],qs['fields'](_0x57b097['query'][_0xb21c('0x32')]));_0xe5080e[_0xb21c('0x33')]=_0xe5080e[_0xb21c('0x33')][_0xb21c('0x34')]?_0xe5080e[_0xb21c('0x33')]:_0x3c8e7b[_0xb21c('0x2e')];if(!_0x57b097[_0xb21c('0x2f')][_0xb21c('0x35')](_0xb21c('0x36'))){_0xe5080e[_0xb21c('0x1e')]=qs['limit'](_0x57b097['query']['limit']);_0xe5080e[_0xb21c('0x1d')]=qs[_0xb21c('0x1d')](_0x57b097['query'][_0xb21c('0x1d')]);}_0xe5080e[_0xb21c('0x37')]=qs[_0xb21c('0x38')](_0x57b097[_0xb21c('0x2f')][_0xb21c('0x38')]);_0xe5080e[_0xb21c('0x39')]=qs[_0xb21c('0x30')](_['pick'](_0x57b097[_0xb21c('0x2f')],_0x3c8e7b['filters']),_0x223813);if(_0x57b097[_0xb21c('0x2f')][_0xb21c('0x3a')]){_0xe5080e['where']=_[_0xb21c('0x3b')](_0xe5080e[_0xb21c('0x39')],{'$or':_[_0xb21c('0x2b')](_0x223813,function(_0x4f50ae){if(_0x4f50ae[_0xb21c('0x2d')]!==_0xb21c('0x3c')){var _0x46ba2d={};_0x46ba2d[_0x4f50ae[_0xb21c('0x29')]]={'$like':'%'+_0x57b097['query'][_0xb21c('0x3a')]+'%'};return _0x46ba2d;}})});}_0xe5080e=_['merge']({},_0xe5080e,_0x57b097[_0xb21c('0x3d')]);var _0x4c693d={'where':_0xe5080e[_0xb21c('0x39')]};return db[_0xb21c('0x3e')][_0xb21c('0x1f')](_0x4c693d)['then'](function(_0xe6cc89){_0x3c6d86[_0xb21c('0x1f')]=_0xe6cc89;if(_0x57b097[_0xb21c('0x2f')][_0xb21c('0x3f')]){_0xe5080e[_0xb21c('0x40')]=[{'all':!![]}];}return db[_0xb21c('0x3e')][_0xb21c('0x41')](_0xe5080e);})[_0xb21c('0x26')](function(_0xf08ec0){_0x3c6d86[_0xb21c('0x42')]=_0xf08ec0;return _0x3c6d86;})[_0xb21c('0x26')](respondWithFilteredResult(_0x2081b1,_0xe5080e))[_0xb21c('0x43')](handleError(_0x2081b1,null));};exports[_0xb21c('0x44')]=function(_0x82fc1d,_0x9298e3){var _0x42f837={'raw':!![],'where':{'id':_0x82fc1d[_0xb21c('0x45')]['id']}},_0x37acff={};_0x37acff['model']=_[_0xb21c('0x46')](db[_0xb21c('0x3e')][_0xb21c('0x47')]);_0x37acff[_0xb21c('0x2f')]=_[_0xb21c('0x46')](_0x82fc1d[_0xb21c('0x2f')]);_0x37acff[_0xb21c('0x30')]=_[_0xb21c('0x31')](_0x37acff[_0xb21c('0x2e')],_0x37acff[_0xb21c('0x2f')]);_0x42f837['attributes']=_['intersection'](_0x37acff[_0xb21c('0x2e')],qs['fields'](_0x82fc1d[_0xb21c('0x2f')]['fields']));_0x42f837[_0xb21c('0x33')]=_0x42f837[_0xb21c('0x33')]['length']?_0x42f837[_0xb21c('0x33')]:_0x37acff[_0xb21c('0x2e')];if(_0x82fc1d[_0xb21c('0x2f')][_0xb21c('0x3f')]){_0x42f837['include']=[{'all':!![]}];}_0x42f837=_[_0xb21c('0x3b')]({},_0x42f837,_0x82fc1d[_0xb21c('0x3d')]);return db['VtigerField']['find'](_0x42f837)[_0xb21c('0x26')](handleEntityNotFound(_0x9298e3,null))['then'](respondWithResult(_0x9298e3,null))[_0xb21c('0x43')](handleError(_0x9298e3,null));};exports[_0xb21c('0x48')]=function(_0x3665d3,_0x188da2){return db[_0xb21c('0x3e')][_0xb21c('0x48')](_0x3665d3['body'],{})[_0xb21c('0x26')](respondWithResult(_0x188da2,0xc9))['catch'](handleError(_0x188da2,null));};exports[_0xb21c('0x25')]=function(_0x336806,_0x5d63d9){if(_0x336806['body']['id']){delete _0x336806[_0xb21c('0x49')]['id'];}return db[_0xb21c('0x3e')][_0xb21c('0x4a')]({'where':{'id':_0x336806['params']['id']}})[_0xb21c('0x26')](handleEntityNotFound(_0x5d63d9,null))[_0xb21c('0x26')](saveUpdates(_0x336806['body'],null))[_0xb21c('0x26')](respondWithResult(_0x5d63d9,null))['catch'](handleError(_0x5d63d9,null));};exports[_0xb21c('0x4b')]=function(_0x52763b,_0x2da23f){return db[_0xb21c('0x3e')][_0xb21c('0x4a')]({'where':{'id':_0x52763b['params']['id']}})[_0xb21c('0x26')](handleEntityNotFound(_0x2da23f,null))['then'](removeEntity(_0x2da23f,null))['catch'](handleError(_0x2da23f,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 65fa91f..6dee1dc 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 _0x0940=['bluebird','request-promise','path','exports','vtiger_unique_index','idField','lodash','util','../../config/logger','moment'];(function(_0x1a8891,_0xebc65){var _0x71ddf=function(_0x5427e4){while(--_0x5427e4){_0x1a8891['push'](_0x1a8891['shift']());}};_0x71ddf(++_0xebc65);}(_0x0940,0x88));var _0x0094=function(_0x3e93c1,_0x30839b){_0x3e93c1=_0x3e93c1-0x0;var _0x1c29f7=_0x0940[_0x3e93c1];return _0x1c29f7;};'use strict';var _=require(_0x0094('0x0'));var util=require(_0x0094('0x1'));var logger=require(_0x0094('0x2'))('api');var moment=require(_0x0094('0x3'));var BPromise=require(_0x0094('0x4'));var rp=require(_0x0094('0x5'));var fs=require('fs');var path=require(_0x0094('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intVtigerField.attributes');module[_0x0094('0x7')]=function(_0x20504d,_0x368cd5){return _0x20504d['define']('VtigerField',attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x0094('0x8'),'fields':[_0x0094('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x03e4=['../../config/environment','exports','int_vtiger_fields','idField','FieldId','../../config/logger','api','rimraf'];(function(_0x28447c,_0x27b96e){var _0x2a9fef=function(_0x223557){while(--_0x223557){_0x28447c['push'](_0x28447c['shift']());}};_0x2a9fef(++_0x27b96e);}(_0x03e4,0x185));var _0x403e=function(_0x4cd690,_0x4797cc){_0x4cd690=_0x4cd690-0x0;var _0x4a74a9=_0x03e4[_0x4cd690];return _0x4a74a9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x403e('0x0'))(_0x403e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x403e('0x2'));var config=require(_0x403e('0x3'));var attributes=require('./intVtigerField.attributes');module[_0x403e('0x4')]=function(_0xaa3f37,_0x72bceb){return _0xaa3f37['define']('VtigerField',attributes,{'tableName':_0x403e('0x5'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x403e('0x6'),_0x403e('0x7')],'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 fd491b6..1e89d85 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 _0x09d8=['debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','error','VtigerField,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x4fcb16,_0xb47497){var _0x5c0ff5=function(_0x211392){while(--_0x211392){_0x4fcb16['push'](_0x4fcb16['shift']());}};_0x5c0ff5(++_0xb47497);}(_0x09d8,0xe4));var _0x809d=function(_0x57a668,_0x85bfaf){_0x57a668=_0x57a668-0x0;var _0x33ce1e=_0x09d8[_0x57a668];return _0x33ce1e;};'use strict';var _=require(_0x809d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x809d('0x1'));var rs=require(_0x809d('0x2'));var fs=require('fs');var Redis=require(_0x809d('0x3'));var db=require(_0x809d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x809d('0x5'))(_0x809d('0x6'));var config=require(_0x809d('0x7'));var jayson=require(_0x809d('0x8'));var client=jayson[_0x809d('0x9')][_0x809d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fde82,_0x40742f,_0x262599){return new BPromise(function(_0x51a6b3,_0x1dbad3){return client[_0x809d('0xb')](_0x1fde82,_0x262599)[_0x809d('0xc')](function(_0x41b026){logger[_0x809d('0xd')]('VtigerField,\x20%s,\x20%s',_0x40742f,'request\x20sent');logger[_0x809d('0xe')](_0x809d('0xf'),_0x40742f,_0x809d('0x10'),JSON['stringify'](_0x41b026));if(_0x41b026[_0x809d('0x11')]){if(_0x41b026[_0x809d('0x11')]['code']===0x1f4){logger[_0x809d('0x11')](_0x809d('0x12'),_0x40742f,_0x41b026[_0x809d('0x11')][_0x809d('0x13')]);return _0x1dbad3(_0x41b026[_0x809d('0x11')][_0x809d('0x13')]);}logger[_0x809d('0x11')](_0x809d('0x12'),_0x40742f,_0x41b026[_0x809d('0x11')][_0x809d('0x13')]);return _0x51a6b3(_0x41b026['error']['message']);}else{logger['info']('VtigerField,\x20%s,\x20%s',_0x40742f,_0x809d('0x10'));_0x51a6b3(_0x41b026[_0x809d('0x14')][_0x809d('0x13')]);}})[_0x809d('0x15')](function(_0x71d0c0){logger[_0x809d('0x11')](_0x809d('0x12'),_0x40742f,_0x71d0c0);_0x1dbad3(_0x71d0c0);});});} \ No newline at end of file +var _0x8046=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x2a1295,_0x1bf359){var _0x5a7b08=function(_0x3edbb0){while(--_0x3edbb0){_0x2a1295['push'](_0x2a1295['shift']());}};_0x5a7b08(++_0x1bf359);}(_0x8046,0x70));var _0x6804=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x8046[_0x1d24eb];return _0x1dc576;};'use strict';var _=require(_0x6804('0x0'));var util=require(_0x6804('0x1'));var moment=require(_0x6804('0x2'));var BPromise=require(_0x6804('0x3'));var rs=require(_0x6804('0x4'));var fs=require('fs');var Redis=require(_0x6804('0x5'));var db=require(_0x6804('0x6'))['db'];var utils=require(_0x6804('0x7'));var logger=require(_0x6804('0x8'))('rpc');var config=require(_0x6804('0x9'));var jayson=require(_0x6804('0xa'));var client=jayson[_0x6804('0xb')][_0x6804('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x441e35,_0x1cc827,_0x1e4688){return new BPromise(function(_0x33acb6,_0x11b92b){return client['request'](_0x441e35,_0x1e4688)['then'](function(_0x5e6bd0){logger[_0x6804('0xd')](_0x6804('0xe'),_0x1cc827,_0x6804('0xf'));logger['debug'](_0x6804('0x10'),_0x1cc827,_0x6804('0xf'),JSON[_0x6804('0x11')](_0x5e6bd0));if(_0x5e6bd0[_0x6804('0x12')]){if(_0x5e6bd0[_0x6804('0x12')][_0x6804('0x13')]===0x1f4){logger['error'](_0x6804('0xe'),_0x1cc827,_0x5e6bd0['error'][_0x6804('0x14')]);return _0x11b92b(_0x5e6bd0[_0x6804('0x12')][_0x6804('0x14')]);}logger[_0x6804('0x12')](_0x6804('0xe'),_0x1cc827,_0x5e6bd0[_0x6804('0x12')][_0x6804('0x14')]);return _0x33acb6(_0x5e6bd0[_0x6804('0x12')][_0x6804('0x14')]);}else{logger[_0x6804('0xd')](_0x6804('0xe'),_0x1cc827,_0x6804('0xf'));_0x33acb6(_0x5e6bd0[_0x6804('0x15')][_0x6804('0x14')]);}})[_0x6804('0x16')](function(_0x1be7ef){logger[_0x6804('0x12')]('VtigerField,\x20%s,\x20%s',_0x1cc827,_0x1be7ef);_0x11b92b(_0x1be7ef);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 757911a..221fe2c 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 _0x0221=['/:id/fields','getFields','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','./intZendeskAccount.controller','isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0221,0xc5));var _0x1022=function(_0x14031e,_0x2f33aa){_0x14031e=_0x14031e-0x0;var _0x22d420=_0x0221[_0x14031e];return _0x22d420;};'use strict';var multer=require(_0x1022('0x0'));var util=require(_0x1022('0x1'));var path=require(_0x1022('0x2'));var timeout=require(_0x1022('0x3'));var express=require('express');var router=express[_0x1022('0x4')]();var fs_extra=require(_0x1022('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1022('0x6'));router['get']('/',auth[_0x1022('0x7')](),controller[_0x1022('0x8')]);router[_0x1022('0x9')](_0x1022('0xa'),auth[_0x1022('0x7')](),controller['show']);router[_0x1022('0x9')](_0x1022('0xb'),auth[_0x1022('0x7')](),controller[_0x1022('0xc')]);router[_0x1022('0x9')](_0x1022('0xd'),auth['isAuthenticated'](),controller[_0x1022('0xe')]);router[_0x1022('0xf')]('/',auth[_0x1022('0x7')](),controller[_0x1022('0x10')]);router[_0x1022('0xf')](_0x1022('0xb'),auth[_0x1022('0x7')](),controller['addConfiguration']);router[_0x1022('0x11')](_0x1022('0xa'),auth['isAuthenticated'](),controller[_0x1022('0x12')]);router[_0x1022('0x13')](_0x1022('0xa'),auth['isAuthenticated'](),controller[_0x1022('0x14')]);module['exports']=router; \ No newline at end of file +var _0xd08d=['index','get','/:id','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','isAuthenticated'];(function(_0x3c6c4d,_0x3b3c92){var _0x3bea7c=function(_0x298c23){while(--_0x298c23){_0x3c6c4d['push'](_0x3c6c4d['shift']());}};_0x3bea7c(++_0x3b3c92);}(_0xd08d,0x81));var _0xdd08=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0xd08d[_0x468b0f];return _0x3e74d9;};'use strict';var multer=require('multer');var util=require(_0xdd08('0x0'));var path=require(_0xdd08('0x1'));var timeout=require('connect-timeout');var express=require(_0xdd08('0x2'));var router=express[_0xdd08('0x3')]();var fs_extra=require(_0xdd08('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdd08('0x5'));var config=require(_0xdd08('0x6'));var controller=require(_0xdd08('0x7'));router['get']('/',auth[_0xdd08('0x8')](),controller[_0xdd08('0x9')]);router[_0xdd08('0xa')](_0xdd08('0xb'),auth[_0xdd08('0x8')](),controller['show']);router[_0xdd08('0xa')](_0xdd08('0xc'),auth[_0xdd08('0x8')](),controller['getConfigurations']);router[_0xdd08('0xa')](_0xdd08('0xd'),auth[_0xdd08('0x8')](),controller[_0xdd08('0xe')]);router[_0xdd08('0xf')]('/',auth[_0xdd08('0x8')](),controller[_0xdd08('0x10')]);router[_0xdd08('0xf')](_0xdd08('0xc'),auth[_0xdd08('0x8')](),controller[_0xdd08('0x11')]);router[_0xdd08('0x12')]('/:id',auth[_0xdd08('0x8')](),controller[_0xdd08('0x13')]);router[_0xdd08('0x14')](_0xdd08('0xb'),auth[_0xdd08('0x8')](),controller[_0xdd08('0x15')]);module[_0xdd08('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index c06fce6..edb2daf 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 _0x7bd0=['password','token','newTab','sequelize','exports','STRING','username','remoteUri','ENUM'];(function(_0x137e07,_0x440f1e){var _0x584972=function(_0x16932f){while(--_0x16932f){_0x137e07['push'](_0x137e07['shift']());}};_0x584972(++_0x440f1e);}(_0x7bd0,0x111));var _0x07bd=function(_0x21cb7f,_0x48cd16){_0x21cb7f=_0x21cb7f-0x0;var _0x5a079a=_0x7bd0[_0x21cb7f];return _0x5a079a;};'use strict';var Sequelize=require(_0x07bd('0x0'));module[_0x07bd('0x1')]={'name':{'type':Sequelize[_0x07bd('0x2')]},'description':{'type':Sequelize[_0x07bd('0x2')]},'username':{'type':Sequelize[_0x07bd('0x2')],'unique':_0x07bd('0x3')},'password':{'type':Sequelize[_0x07bd('0x2')]},'token':{'type':Sequelize[_0x07bd('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x07bd('0x4')},'authType':{'type':Sequelize[_0x07bd('0x5')](_0x07bd('0x6'),_0x07bd('0x7')),'defaultValue':_0x07bd('0x6')},'serverUrl':{'type':Sequelize[_0x07bd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x07bd('0x5')]('integrationTab',_0x07bd('0x8')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x0120=['password','integrationTab','newTab','sequelize','exports','STRING','username','remoteUri','ENUM'];(function(_0x5837b1,_0x54229a){var _0x490d8b=function(_0x3af82d){while(--_0x3af82d){_0x5837b1['push'](_0x5837b1['shift']());}};_0x490d8b(++_0x54229a);}(_0x0120,0x6f));var _0x0012=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0120[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x0012('0x0'));module[_0x0012('0x1')]={'name':{'type':Sequelize[_0x0012('0x2')]},'description':{'type':Sequelize[_0x0012('0x2')]},'username':{'type':Sequelize[_0x0012('0x2')],'unique':_0x0012('0x3')},'password':{'type':Sequelize[_0x0012('0x2')]},'token':{'type':Sequelize[_0x0012('0x2')]},'remoteUri':{'type':Sequelize[_0x0012('0x2')],'unique':_0x0012('0x4')},'authType':{'type':Sequelize[_0x0012('0x5')](_0x0012('0x6'),'token'),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x0012('0x5')](_0x0012('0x7'),_0x0012('0x8')),'defaultValue':_0x0012('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 66df80b..0375141 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 _0xcb91=['ZendeskAccount','rawAttributes','fieldName','key','map','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','findAll','rows','show','includeAll','include','find','create','body','params','catch','destroy','getConfigurations','keys','ZendeskConfiguration','addConfiguration','AccountId','channel','getDescriptions','ZendeskField','Subjects','Descriptions','getFields','findOne','username','password','token','remoteUri','slice','substring','GET','format','%s/%s','ticket_fields','authType','headers','Basic\x20%s','%s:%s','toString','%s/token:%s','base64','ValidationError','subject','group','assignee','remove','includes','position','system_field_options','custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','update','then','error','stack','name','send','index'];(function(_0x141380,_0x39a064){var _0x184ed8=function(_0x3d0dee){while(--_0x3d0dee){_0x141380['push'](_0x141380['shift']());}};_0x184ed8(++_0x39a064);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2d994d,_0x168a27){_0x2d994d=_0x2d994d-0x0;var _0xd54be4=_0xcb91[_0x2d994d];return _0xd54be4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cb9('0x0'));var jsonpatch=require(_0x1cb9('0x1'));var rp=require(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cb9('0x4'));var util=require(_0x1cb9('0x5'));var path=require('path');var sox=require(_0x1cb9('0x6'));var csv=require(_0x1cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb9('0x8'));var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xc'));var authService=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var as=require(_0x1cb9('0xf'));var hardwareService=require(_0x1cb9('0x10'));var logger=require('../../config/logger')(_0x1cb9('0x11'));var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var licenseUtil=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5e3c19,_0x59dec3){_0x59dec3=_0x59dec3||0xcc;return function(_0x358866){if(_0x358866){return _0x5e3c19[_0x1cb9('0x16')](_0x59dec3);}return _0x5e3c19[_0x1cb9('0x17')](_0x59dec3)[_0x1cb9('0x18')]();};}function respondWithResult(_0x56884d,_0x397727){_0x397727=_0x397727||0xc8;return function(_0x6ef389){if(_0x6ef389){return _0x56884d[_0x1cb9('0x17')](_0x397727)[_0x1cb9('0x19')](_0x6ef389);}};}function respondWithFilteredResult(_0x3e2d11,_0x5806d8){return function(_0x5572cb){if(_0x5572cb){var _0xd446a3=typeof _0x5806d8[_0x1cb9('0x1a')]===_0x1cb9('0x1b')&&typeof _0x5806d8[_0x1cb9('0x1c')]===_0x1cb9('0x1b');var _0xf22920=_0x5572cb[_0x1cb9('0x1d')];var _0x4e1340=_0xd446a3?0x0:_0x5806d8['offset'];var _0x1b2fa6=_0xd446a3?_0x5572cb[_0x1cb9('0x1d')]:_0x5806d8[_0x1cb9('0x1a')]+_0x5806d8[_0x1cb9('0x1c')];var _0x280a84;if(_0x1b2fa6>=_0xf22920){_0x1b2fa6=_0xf22920;_0x280a84=0xc8;}else{_0x280a84=0xce;}_0x3e2d11[_0x1cb9('0x17')](_0x280a84);return _0x3e2d11[_0x1cb9('0x1e')]('Content-Range',_0x4e1340+'-'+_0x1b2fa6+'/'+_0xf22920)['json'](_0x5572cb);}return null;};}function patchUpdates(_0x1a5a72){return function(_0x5dbfae){try{jsonpatch[_0x1cb9('0x1f')](_0x5dbfae,_0x1a5a72,!![]);}catch(_0x2265ea){return BPromise['reject'](_0x2265ea);}return _0x5dbfae['save']();};}function saveUpdates(_0x2e3854,_0x325637){return function(_0x103a63){if(_0x103a63){return _0x103a63[_0x1cb9('0x20')](_0x2e3854)[_0x1cb9('0x21')](function(_0x27db16){return _0x27db16;});}return null;};}function removeEntity(_0x59ebea,_0x55b232){return function(_0x6c6f61){if(_0x6c6f61){return _0x6c6f61['destroy']()[_0x1cb9('0x21')](function(){_0x59ebea[_0x1cb9('0x17')](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x44d3c4,_0x43a100){return function(_0x53f9fa){if(!_0x53f9fa){_0x44d3c4[_0x1cb9('0x16')](0x194);}return _0x53f9fa;};}function handleError(_0x9df250,_0x4c8d76){_0x4c8d76=_0x4c8d76||0x1f4;return function(_0xd6891c){logger[_0x1cb9('0x22')](_0xd6891c[_0x1cb9('0x23')]);if(_0xd6891c[_0x1cb9('0x24')]){delete _0xd6891c[_0x1cb9('0x24')];}_0x9df250[_0x1cb9('0x17')](_0x4c8d76)[_0x1cb9('0x25')](_0xd6891c);};}exports[_0x1cb9('0x26')]=function(_0x41e5c2,_0x9de64b){var _0x48888d={},_0x405a2f={},_0x536635={'count':0x0,'rows':[]};var _0x110282=_['map'](db[_0x1cb9('0x27')][_0x1cb9('0x28')],function(_0x3cd7f5){return{'name':_0x3cd7f5[_0x1cb9('0x29')],'type':_0x3cd7f5['type'][_0x1cb9('0x2a')]};});_0x405a2f['model']=_[_0x1cb9('0x2b')](_0x110282,_0x1cb9('0x24'));_0x405a2f[_0x1cb9('0x2c')]=_['keys'](_0x41e5c2[_0x1cb9('0x2c')]);_0x405a2f['filters']=_[_0x1cb9('0x2d')](_0x405a2f['model'],_0x405a2f[_0x1cb9('0x2c')]);_0x48888d[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x405a2f[_0x1cb9('0x2f')],qs['fields'](_0x41e5c2[_0x1cb9('0x2c')][_0x1cb9('0x30')]));_0x48888d[_0x1cb9('0x2e')]=_0x48888d[_0x1cb9('0x2e')][_0x1cb9('0x31')]?_0x48888d[_0x1cb9('0x2e')]:_0x405a2f[_0x1cb9('0x2f')];if(!_0x41e5c2[_0x1cb9('0x2c')][_0x1cb9('0x32')](_0x1cb9('0x33'))){_0x48888d[_0x1cb9('0x1c')]=qs[_0x1cb9('0x1c')](_0x41e5c2[_0x1cb9('0x2c')]['limit']);_0x48888d['offset']=qs[_0x1cb9('0x1a')](_0x41e5c2[_0x1cb9('0x2c')][_0x1cb9('0x1a')]);}_0x48888d[_0x1cb9('0x34')]=qs[_0x1cb9('0x35')](_0x41e5c2[_0x1cb9('0x2c')][_0x1cb9('0x35')]);_0x48888d[_0x1cb9('0x36')]=qs['filters'](_[_0x1cb9('0x37')](_0x41e5c2[_0x1cb9('0x2c')],_0x405a2f[_0x1cb9('0x38')]),_0x110282);if(_0x41e5c2['query'][_0x1cb9('0x39')]){_0x48888d['where']=_[_0x1cb9('0x3a')](_0x48888d['where'],{'$or':_[_0x1cb9('0x2b')](_0x110282,function(_0x13d4fd){if(_0x13d4fd[_0x1cb9('0x3b')]!==_0x1cb9('0x3c')){var _0x34ada2={};_0x34ada2[_0x13d4fd[_0x1cb9('0x24')]]={'$like':'%'+_0x41e5c2[_0x1cb9('0x2c')]['filter']+'%'};return _0x34ada2;}})});}_0x48888d=_['merge']({},_0x48888d,_0x41e5c2[_0x1cb9('0x3d')]);var _0x1d2723={'where':_0x48888d[_0x1cb9('0x36')]};return db[_0x1cb9('0x27')][_0x1cb9('0x1d')](_0x1d2723)[_0x1cb9('0x21')](function(_0x32130b){_0x536635['count']=_0x32130b;if(_0x41e5c2[_0x1cb9('0x2c')]['includeAll']){_0x48888d['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0x1cb9('0x3e')](_0x48888d);})[_0x1cb9('0x21')](function(_0x1bf51c){_0x536635[_0x1cb9('0x3f')]=_0x1bf51c;return _0x536635;})[_0x1cb9('0x21')](respondWithFilteredResult(_0x9de64b,_0x48888d))['catch'](handleError(_0x9de64b,null));};exports[_0x1cb9('0x40')]=function(_0x523866,_0x91121){var _0x71db9d={'raw':![],'where':{'id':_0x523866['params']['id']}},_0x38d973={};_0x38d973[_0x1cb9('0x2f')]=_['keys'](db[_0x1cb9('0x27')][_0x1cb9('0x28')]);_0x38d973['query']=_['keys'](_0x523866[_0x1cb9('0x2c')]);_0x38d973[_0x1cb9('0x38')]=_[_0x1cb9('0x2d')](_0x38d973[_0x1cb9('0x2f')],_0x38d973[_0x1cb9('0x2c')]);_0x71db9d['attributes']=_[_0x1cb9('0x2d')](_0x38d973['model'],qs['fields'](_0x523866['query'][_0x1cb9('0x30')]));_0x71db9d[_0x1cb9('0x2e')]=_0x71db9d[_0x1cb9('0x2e')][_0x1cb9('0x31')]?_0x71db9d[_0x1cb9('0x2e')]:_0x38d973[_0x1cb9('0x2f')];if(_0x523866[_0x1cb9('0x2c')][_0x1cb9('0x41')]){_0x71db9d[_0x1cb9('0x42')]=[{'all':!![]}];}_0x71db9d=_[_0x1cb9('0x3a')]({},_0x71db9d,_0x523866[_0x1cb9('0x3d')]);return db['ZendeskAccount'][_0x1cb9('0x43')](_0x71db9d)[_0x1cb9('0x21')](handleEntityNotFound(_0x91121,null))[_0x1cb9('0x21')](respondWithResult(_0x91121,null))['catch'](handleError(_0x91121,null));};exports[_0x1cb9('0x44')]=function(_0x57251,_0x3c6044){return db[_0x1cb9('0x27')][_0x1cb9('0x44')](_0x57251['body'],{})[_0x1cb9('0x21')](respondWithResult(_0x3c6044,0xc9))['catch'](handleError(_0x3c6044,null));};exports[_0x1cb9('0x20')]=function(_0x4ac483,_0x1cf2ee){if(_0x4ac483[_0x1cb9('0x45')]['id']){delete _0x4ac483[_0x1cb9('0x45')]['id'];}return db[_0x1cb9('0x27')]['find']({'where':{'id':_0x4ac483[_0x1cb9('0x46')]['id']}})[_0x1cb9('0x21')](handleEntityNotFound(_0x1cf2ee,null))[_0x1cb9('0x21')](saveUpdates(_0x4ac483[_0x1cb9('0x45')],null))[_0x1cb9('0x21')](respondWithResult(_0x1cf2ee,null))[_0x1cb9('0x47')](handleError(_0x1cf2ee,null));};exports[_0x1cb9('0x48')]=function(_0x3b6a92,_0xbb500e){return db[_0x1cb9('0x27')]['find']({'where':{'id':_0x3b6a92['params']['id']}})[_0x1cb9('0x21')](handleEntityNotFound(_0xbb500e,null))[_0x1cb9('0x21')](removeEntity(_0xbb500e,null))[_0x1cb9('0x47')](handleError(_0xbb500e,null));};exports[_0x1cb9('0x49')]=function(_0x20b253,_0x2d076b,_0x367dd7){var _0x1c4ff6={};var _0x36c53a={};var _0x166ca2;var _0x4a4b87;return db[_0x1cb9('0x27')]['findOne']({'where':{'id':_0x20b253[_0x1cb9('0x46')]['id']}})['then'](handleEntityNotFound(_0x2d076b,null))[_0x1cb9('0x21')](function(_0x53c002){if(_0x53c002){_0x166ca2=_0x53c002;_0x36c53a['model']=_[_0x1cb9('0x4a')](db[_0x1cb9('0x4b')][_0x1cb9('0x28')]);_0x36c53a['query']=_[_0x1cb9('0x4a')](_0x20b253[_0x1cb9('0x2c')]);_0x36c53a['filters']=_['intersection'](_0x36c53a[_0x1cb9('0x2f')],_0x36c53a[_0x1cb9('0x2c')]);_0x1c4ff6[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x36c53a[_0x1cb9('0x2f')],qs[_0x1cb9('0x30')](_0x20b253[_0x1cb9('0x2c')]['fields']));_0x1c4ff6[_0x1cb9('0x2e')]=_0x1c4ff6[_0x1cb9('0x2e')][_0x1cb9('0x31')]?_0x1c4ff6['attributes']:_0x36c53a[_0x1cb9('0x2f')];_0x1c4ff6[_0x1cb9('0x34')]=qs[_0x1cb9('0x35')](_0x20b253[_0x1cb9('0x2c')][_0x1cb9('0x35')]);_0x1c4ff6[_0x1cb9('0x36')]=qs['filters'](_[_0x1cb9('0x37')](_0x20b253[_0x1cb9('0x2c')],_0x36c53a[_0x1cb9('0x38')]));if(_0x20b253[_0x1cb9('0x2c')][_0x1cb9('0x39')]){_0x1c4ff6[_0x1cb9('0x36')]=_[_0x1cb9('0x3a')](_0x1c4ff6[_0x1cb9('0x36')],{'$or':_[_0x1cb9('0x2b')](_0x1c4ff6[_0x1cb9('0x2e')],function(_0x370c97){var _0x55fb51={};_0x55fb51[_0x370c97]={'$like':'%'+_0x20b253[_0x1cb9('0x2c')][_0x1cb9('0x39')]+'%'};return _0x55fb51;})});}_0x1c4ff6=_[_0x1cb9('0x3a')]({},_0x1c4ff6,_0x20b253[_0x1cb9('0x3d')]);return _0x166ca2['getConfigurations'](_0x1c4ff6);}})['then'](function(_0x319358){if(_0x319358){_0x4a4b87=_0x319358[_0x1cb9('0x31')];if(!_0x20b253[_0x1cb9('0x2c')][_0x1cb9('0x32')](_0x1cb9('0x33'))){_0x1c4ff6[_0x1cb9('0x1c')]=qs[_0x1cb9('0x1c')](_0x20b253[_0x1cb9('0x2c')]['limit']);_0x1c4ff6['offset']=qs[_0x1cb9('0x1a')](_0x20b253['query']['offset']);}return _0x166ca2['getConfigurations'](_0x1c4ff6);}})['then'](function(_0x5d349b){if(_0x5d349b){return _0x5d349b?{'count':_0x4a4b87,'rows':_0x5d349b}:null;}})[_0x1cb9('0x21')](respondWithResult(_0x2d076b,null))[_0x1cb9('0x47')](handleError(_0x2d076b,null));};exports[_0x1cb9('0x4c')]=function(_0x43bafc,_0x23d435,_0xccbee3){if(_0x43bafc['body']['id']){delete _0x43bafc[_0x1cb9('0x45')]['id'];}return db[_0x1cb9('0x27')]['findOne']({'where':{'id':_0x43bafc['params']['id']}})[_0x1cb9('0x21')](handleEntityNotFound(_0x23d435,null))[_0x1cb9('0x21')](function(_0x2e818f){if(_0x2e818f){_0x43bafc[_0x1cb9('0x45')][_0x1cb9('0x4d')]=_0x2e818f['id'];_0x43bafc['body']['Subjects']=integrations['getSubjects'](_0x43bafc[_0x1cb9('0x45')][_0x1cb9('0x4e')],_0x43bafc[_0x1cb9('0x45')][_0x1cb9('0x3b')]);_0x43bafc[_0x1cb9('0x45')]['Descriptions']=integrations[_0x1cb9('0x4f')](_0x43bafc[_0x1cb9('0x45')]['channel'],_0x43bafc['body'][_0x1cb9('0x3b')]);return db['ZendeskConfiguration'][_0x1cb9('0x44')](_0x43bafc[_0x1cb9('0x45')],{'include':[{'model':db[_0x1cb9('0x50')],'as':_0x1cb9('0x51')},{'model':db[_0x1cb9('0x50')],'as':_0x1cb9('0x52')}]});}return null;})['then'](respondWithResult(_0x23d435,null))[_0x1cb9('0x47')](handleError(_0x23d435,null));};exports[_0x1cb9('0x53')]=function(_0x330fc1,_0x17c361,_0x5b5f0d){var _0x520d98='';return db[_0x1cb9('0x27')][_0x1cb9('0x54')]({'where':{'id':_0x330fc1[_0x1cb9('0x46')]['id']},'attributes':['id',_0x1cb9('0x55'),_0x1cb9('0x56'),_0x1cb9('0x57'),'authType',_0x1cb9('0x58')]})['then'](handleEntityNotFound(_0x17c361,null))[_0x1cb9('0x21')](function(_0x26dae9){if(_0x26dae9){_0x520d98=_0x26dae9['remoteUri'];var _0xf5b006=_0x520d98[_0x1cb9('0x59')](-0x1);if(_0xf5b006==='/'){_0x520d98=_0x520d98[_0x1cb9('0x5a')](0x0,_0x520d98['lastIndexOf'](_0xf5b006));}var _0x1b4878={'method':_0x1cb9('0x5b'),'uri':util[_0x1cb9('0x5c')](_0x1cb9('0x5d'),_0x520d98,_0x1cb9('0x5e')),'json':!![]};switch(_0x26dae9[_0x1cb9('0x5f')]){case'password':_0x1b4878[_0x1cb9('0x60')]={'Authorization':util[_0x1cb9('0x5c')](_0x1cb9('0x61'),new Buffer(util[_0x1cb9('0x5c')](_0x1cb9('0x62'),_0x26dae9[_0x1cb9('0x55')],_0x26dae9[_0x1cb9('0x56')]))[_0x1cb9('0x63')]('base64'))};break;case _0x1cb9('0x57'):_0x1b4878[_0x1cb9('0x60')]={'Authorization':util['format'](_0x1cb9('0x61'),new Buffer(util['format'](_0x1cb9('0x64'),_0x26dae9['username'],_0x26dae9['token']))[_0x1cb9('0x63')](_0x1cb9('0x65')))};break;default:throw new db['Sequelize'][(_0x1cb9('0x66'))]('Unknown\x20authentication\x20type');}return rp(_0x1b4878);}})[_0x1cb9('0x21')](function(_0x7ecb4e){if(_0x7ecb4e){var _0x399986=[_0x1cb9('0x67'),'description',_0x1cb9('0x68'),_0x1cb9('0x69')];_[_0x1cb9('0x6a')](_0x7ecb4e[_0x1cb9('0x5e')],function(_0x4f8d74){return _0x399986[_0x1cb9('0x6b')](_0x4f8d74['type']);});return{'count':_0x7ecb4e[_0x1cb9('0x5e')][_0x1cb9('0x31')],'rows':_[_0x1cb9('0x2b')](_0x7ecb4e[_0x1cb9('0x5e')],function(_0x102f2c){return{'id':_0x102f2c['id'],'name':_0x102f2c[_0x1cb9('0x6c')]>0x7?_0x102f2c['title']:_0x102f2c[_0x1cb9('0x3b')],'custom':_0x102f2c[_0x1cb9('0x6c')]>0x7?!![]:![],'options':_0x102f2c['system_field_options']?_0x102f2c[_0x1cb9('0x6d')]:_0x102f2c[_0x1cb9('0x6e')]?_0x102f2c[_0x1cb9('0x6e')]:[]};})};}})[_0x1cb9('0x21')](respondWithResult(_0x17c361,null))[_0x1cb9('0x47')](function(_0x209dc7){var _0x423aae=_0x330fc1['query'][_0x1cb9('0x6f')]?0x1f4:_0x209dc7['statusCode']||0x1f4;logger[_0x1cb9('0x22')](_0x1cb9('0x70'),'getFields',_0x423aae,JSON[_0x1cb9('0x71')](_0x209dc7));delete _0x209dc7[_0x1cb9('0x24')];if(_0x423aae===0x191){_0x423aae=0x190;}_0x17c361[_0x1cb9('0x17')](_0x423aae)[_0x1cb9('0x25')](_0x330fc1['query'][_0x1cb9('0x6f')]?{'message':_0x1cb9('0x72'),'statusCode':_0x209dc7[_0x1cb9('0x73')]}:_0x209dc7);});}; \ No newline at end of file +var _0x04b8=['lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','send','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','includeAll','ZendeskAccount','findAll','rows','catch','keys','include','find','create','body','params','getConfigurations','findOne','ZendeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','getFields','username','password','token','remoteUri','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','authType','headers','Basic\x20%s','%s:%s','toString','base64','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','custom_field_options','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra'];(function(_0x369e67,_0x35df9a){var _0x97cd1b=function(_0x2dcb49){while(--_0x2dcb49){_0x369e67['push'](_0x369e67['shift']());}};_0x97cd1b(++_0x35df9a);}(_0x04b8,0x159));var _0x804b=function(_0x47d949,_0x43e42e){_0x47d949=_0x47d949-0x0;var _0x23dbe6=_0x04b8[_0x47d949];return _0x23dbe6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x804b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x804b('0x1'));var rp=require(_0x804b('0x2'));var moment=require('moment');var BPromise=require(_0x804b('0x3'));var Mustache=require(_0x804b('0x4'));var util=require('util');var path=require(_0x804b('0x5'));var sox=require(_0x804b('0x6'));var csv=require(_0x804b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x804b('0x8'));var _=require(_0x804b('0x9'));var squel=require(_0x804b('0xa'));var crypto=require('crypto');var jsforce=require(_0x804b('0xb'));var deskjs=require(_0x804b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x804b('0xd'));var Papa=require(_0x804b('0xe'));var Redis=require(_0x804b('0xf'));var authService=require(_0x804b('0x10'));var qs=require(_0x804b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x804b('0x12'));var logger=require(_0x804b('0x13'))(_0x804b('0x14'));var utils=require(_0x804b('0x15'));var config=require(_0x804b('0x16'));var licenseUtil=require(_0x804b('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x804b('0x18'));function respondWithStatusCode(_0x5303cc,_0x23ee57){_0x23ee57=_0x23ee57||0xcc;return function(_0x3a2702){if(_0x3a2702){return _0x5303cc[_0x804b('0x19')](_0x23ee57);}return _0x5303cc[_0x804b('0x1a')](_0x23ee57)['end']();};}function respondWithResult(_0x215825,_0x1b01a7){_0x1b01a7=_0x1b01a7||0xc8;return function(_0x274bb8){if(_0x274bb8){return _0x215825[_0x804b('0x1a')](_0x1b01a7)['json'](_0x274bb8);}};}function respondWithFilteredResult(_0x2fd593,_0x8ccbe0){return function(_0x5e1cfe){if(_0x5e1cfe){var _0x3c5986=typeof _0x8ccbe0['offset']===_0x804b('0x1b')&&typeof _0x8ccbe0[_0x804b('0x1c')]===_0x804b('0x1b');var _0x1760f8=_0x5e1cfe[_0x804b('0x1d')];var _0x5a0a82=_0x3c5986?0x0:_0x8ccbe0[_0x804b('0x1e')];var _0x50b4fe=_0x3c5986?_0x5e1cfe[_0x804b('0x1d')]:_0x8ccbe0[_0x804b('0x1e')]+_0x8ccbe0[_0x804b('0x1c')];var _0x469251;if(_0x50b4fe>=_0x1760f8){_0x50b4fe=_0x1760f8;_0x469251=0xc8;}else{_0x469251=0xce;}_0x2fd593['status'](_0x469251);return _0x2fd593[_0x804b('0x1f')](_0x804b('0x20'),_0x5a0a82+'-'+_0x50b4fe+'/'+_0x1760f8)[_0x804b('0x21')](_0x5e1cfe);}return null;};}function patchUpdates(_0x11eaf6){return function(_0x27844b){try{jsonpatch[_0x804b('0x22')](_0x27844b,_0x11eaf6,!![]);}catch(_0x3241a0){return BPromise[_0x804b('0x23')](_0x3241a0);}return _0x27844b[_0x804b('0x24')]();};}function saveUpdates(_0x2b7271,_0x1acc48){return function(_0x5a968b){if(_0x5a968b){return _0x5a968b[_0x804b('0x25')](_0x2b7271)[_0x804b('0x26')](function(_0x5585f8){return _0x5585f8;});}return null;};}function removeEntity(_0x44a921,_0x367024){return function(_0x115b8f){if(_0x115b8f){return _0x115b8f[_0x804b('0x27')]()[_0x804b('0x26')](function(){_0x44a921['status'](0xcc)[_0x804b('0x28')]();});}};}function handleEntityNotFound(_0x7d9c33,_0x4e7266){return function(_0x12b6a6){if(!_0x12b6a6){_0x7d9c33[_0x804b('0x19')](0x194);}return _0x12b6a6;};}function handleError(_0x1117a5,_0x27d5ec){_0x27d5ec=_0x27d5ec||0x1f4;return function(_0x2d88da){logger['error'](_0x2d88da[_0x804b('0x29')]);if(_0x2d88da[_0x804b('0x2a')]){delete _0x2d88da[_0x804b('0x2a')];}_0x1117a5[_0x804b('0x1a')](_0x27d5ec)[_0x804b('0x2b')](_0x2d88da);};}exports['index']=function(_0x3eb531,_0x2931ff){var _0x410871={},_0x5c7026={},_0x3dbd41={'count':0x0,'rows':[]};var _0x407357=_[_0x804b('0x2c')](db['ZendeskAccount'][_0x804b('0x2d')],function(_0x471c04){return{'name':_0x471c04['fieldName'],'type':_0x471c04[_0x804b('0x2e')][_0x804b('0x2f')]};});_0x5c7026[_0x804b('0x30')]=_[_0x804b('0x2c')](_0x407357,_0x804b('0x2a'));_0x5c7026[_0x804b('0x31')]=_['keys'](_0x3eb531[_0x804b('0x31')]);_0x5c7026[_0x804b('0x32')]=_[_0x804b('0x33')](_0x5c7026[_0x804b('0x30')],_0x5c7026[_0x804b('0x31')]);_0x410871[_0x804b('0x34')]=_[_0x804b('0x33')](_0x5c7026[_0x804b('0x30')],qs[_0x804b('0x35')](_0x3eb531[_0x804b('0x31')][_0x804b('0x35')]));_0x410871[_0x804b('0x34')]=_0x410871[_0x804b('0x34')][_0x804b('0x36')]?_0x410871[_0x804b('0x34')]:_0x5c7026[_0x804b('0x30')];if(!_0x3eb531[_0x804b('0x31')][_0x804b('0x37')](_0x804b('0x38'))){_0x410871[_0x804b('0x1c')]=qs[_0x804b('0x1c')](_0x3eb531[_0x804b('0x31')][_0x804b('0x1c')]);_0x410871[_0x804b('0x1e')]=qs[_0x804b('0x1e')](_0x3eb531['query']['offset']);}_0x410871['order']=qs[_0x804b('0x39')](_0x3eb531[_0x804b('0x31')][_0x804b('0x39')]);_0x410871['where']=qs['filters'](_['pick'](_0x3eb531[_0x804b('0x31')],_0x5c7026[_0x804b('0x32')]),_0x407357);if(_0x3eb531[_0x804b('0x31')][_0x804b('0x3a')]){_0x410871[_0x804b('0x3b')]=_[_0x804b('0x3c')](_0x410871[_0x804b('0x3b')],{'$or':_[_0x804b('0x2c')](_0x407357,function(_0x27ba88){if(_0x27ba88[_0x804b('0x2e')]!==_0x804b('0x3d')){var _0x22a3fa={};_0x22a3fa[_0x27ba88[_0x804b('0x2a')]]={'$like':'%'+_0x3eb531['query'][_0x804b('0x3a')]+'%'};return _0x22a3fa;}})});}_0x410871=_[_0x804b('0x3c')]({},_0x410871,_0x3eb531[_0x804b('0x3e')]);var _0x3d6d8a={'where':_0x410871[_0x804b('0x3b')]};return db['ZendeskAccount']['count'](_0x3d6d8a)[_0x804b('0x26')](function(_0x2afafd){_0x3dbd41[_0x804b('0x1d')]=_0x2afafd;if(_0x3eb531['query'][_0x804b('0x3f')]){_0x410871['include']=[{'all':!![]}];}return db[_0x804b('0x40')][_0x804b('0x41')](_0x410871);})[_0x804b('0x26')](function(_0x304710){_0x3dbd41[_0x804b('0x42')]=_0x304710;return _0x3dbd41;})[_0x804b('0x26')](respondWithFilteredResult(_0x2931ff,_0x410871))[_0x804b('0x43')](handleError(_0x2931ff,null));};exports['show']=function(_0x17972a,_0x1c0363){var _0x1dcec8={'raw':![],'where':{'id':_0x17972a['params']['id']}},_0x1d25f6={};_0x1d25f6[_0x804b('0x30')]=_[_0x804b('0x44')](db[_0x804b('0x40')][_0x804b('0x2d')]);_0x1d25f6[_0x804b('0x31')]=_[_0x804b('0x44')](_0x17972a[_0x804b('0x31')]);_0x1d25f6[_0x804b('0x32')]=_['intersection'](_0x1d25f6[_0x804b('0x30')],_0x1d25f6['query']);_0x1dcec8['attributes']=_['intersection'](_0x1d25f6[_0x804b('0x30')],qs['fields'](_0x17972a[_0x804b('0x31')][_0x804b('0x35')]));_0x1dcec8[_0x804b('0x34')]=_0x1dcec8[_0x804b('0x34')]['length']?_0x1dcec8[_0x804b('0x34')]:_0x1d25f6[_0x804b('0x30')];if(_0x17972a[_0x804b('0x31')]['includeAll']){_0x1dcec8[_0x804b('0x45')]=[{'all':!![]}];}_0x1dcec8=_[_0x804b('0x3c')]({},_0x1dcec8,_0x17972a[_0x804b('0x3e')]);return db['ZendeskAccount'][_0x804b('0x46')](_0x1dcec8)[_0x804b('0x26')](handleEntityNotFound(_0x1c0363,null))[_0x804b('0x26')](respondWithResult(_0x1c0363,null))[_0x804b('0x43')](handleError(_0x1c0363,null));};exports[_0x804b('0x47')]=function(_0x3a39f5,_0x392bc0){return db[_0x804b('0x40')][_0x804b('0x47')](_0x3a39f5[_0x804b('0x48')],{})[_0x804b('0x26')](respondWithResult(_0x392bc0,0xc9))[_0x804b('0x43')](handleError(_0x392bc0,null));};exports[_0x804b('0x25')]=function(_0x2c1796,_0x578e92){if(_0x2c1796['body']['id']){delete _0x2c1796[_0x804b('0x48')]['id'];}return db[_0x804b('0x40')][_0x804b('0x46')]({'where':{'id':_0x2c1796[_0x804b('0x49')]['id']}})[_0x804b('0x26')](handleEntityNotFound(_0x578e92,null))['then'](saveUpdates(_0x2c1796[_0x804b('0x48')],null))[_0x804b('0x26')](respondWithResult(_0x578e92,null))[_0x804b('0x43')](handleError(_0x578e92,null));};exports[_0x804b('0x27')]=function(_0x47247c,_0x111e3f){return db['ZendeskAccount']['find']({'where':{'id':_0x47247c[_0x804b('0x49')]['id']}})[_0x804b('0x26')](handleEntityNotFound(_0x111e3f,null))['then'](removeEntity(_0x111e3f,null))['catch'](handleError(_0x111e3f,null));};exports[_0x804b('0x4a')]=function(_0x3d56bb,_0x4a5068,_0x4efe2a){var _0x164c5d={};var _0x38c2c0={};var _0x54cc99;var _0x2756de;return db['ZendeskAccount'][_0x804b('0x4b')]({'where':{'id':_0x3d56bb['params']['id']}})[_0x804b('0x26')](handleEntityNotFound(_0x4a5068,null))[_0x804b('0x26')](function(_0x47c835){if(_0x47c835){_0x54cc99=_0x47c835;_0x38c2c0[_0x804b('0x30')]=_['keys'](db[_0x804b('0x4c')][_0x804b('0x2d')]);_0x38c2c0[_0x804b('0x31')]=_[_0x804b('0x44')](_0x3d56bb[_0x804b('0x31')]);_0x38c2c0[_0x804b('0x32')]=_[_0x804b('0x33')](_0x38c2c0[_0x804b('0x30')],_0x38c2c0[_0x804b('0x31')]);_0x164c5d[_0x804b('0x34')]=_['intersection'](_0x38c2c0['model'],qs[_0x804b('0x35')](_0x3d56bb['query']['fields']));_0x164c5d[_0x804b('0x34')]=_0x164c5d[_0x804b('0x34')][_0x804b('0x36')]?_0x164c5d[_0x804b('0x34')]:_0x38c2c0['model'];_0x164c5d['order']=qs[_0x804b('0x39')](_0x3d56bb[_0x804b('0x31')][_0x804b('0x39')]);_0x164c5d[_0x804b('0x3b')]=qs[_0x804b('0x32')](_[_0x804b('0x4d')](_0x3d56bb[_0x804b('0x31')],_0x38c2c0[_0x804b('0x32')]));if(_0x3d56bb[_0x804b('0x31')][_0x804b('0x3a')]){_0x164c5d[_0x804b('0x3b')]=_[_0x804b('0x3c')](_0x164c5d[_0x804b('0x3b')],{'$or':_[_0x804b('0x2c')](_0x164c5d[_0x804b('0x34')],function(_0x3d98a2){var _0x524291={};_0x524291[_0x3d98a2]={'$like':'%'+_0x3d56bb[_0x804b('0x31')][_0x804b('0x3a')]+'%'};return _0x524291;})});}_0x164c5d=_['merge']({},_0x164c5d,_0x3d56bb[_0x804b('0x3e')]);return _0x54cc99[_0x804b('0x4a')](_0x164c5d);}})[_0x804b('0x26')](function(_0x2576a4){if(_0x2576a4){_0x2756de=_0x2576a4['length'];if(!_0x3d56bb[_0x804b('0x31')][_0x804b('0x37')]('nolimit')){_0x164c5d[_0x804b('0x1c')]=qs[_0x804b('0x1c')](_0x3d56bb[_0x804b('0x31')]['limit']);_0x164c5d[_0x804b('0x1e')]=qs[_0x804b('0x1e')](_0x3d56bb[_0x804b('0x31')][_0x804b('0x1e')]);}return _0x54cc99[_0x804b('0x4a')](_0x164c5d);}})['then'](function(_0xb08c4e){if(_0xb08c4e){return _0xb08c4e?{'count':_0x2756de,'rows':_0xb08c4e}:null;}})[_0x804b('0x26')](respondWithResult(_0x4a5068,null))[_0x804b('0x43')](handleError(_0x4a5068,null));};exports[_0x804b('0x4e')]=function(_0x5dcc63,_0x4f8a81,_0x183796){if(_0x5dcc63['body']['id']){delete _0x5dcc63[_0x804b('0x48')]['id'];}return db[_0x804b('0x40')][_0x804b('0x4b')]({'where':{'id':_0x5dcc63[_0x804b('0x49')]['id']}})[_0x804b('0x26')](handleEntityNotFound(_0x4f8a81,null))['then'](function(_0x27f06c){if(_0x27f06c){_0x5dcc63[_0x804b('0x48')][_0x804b('0x4f')]=_0x27f06c['id'];_0x5dcc63['body'][_0x804b('0x50')]=integrations[_0x804b('0x51')](_0x5dcc63['body'][_0x804b('0x52')],_0x5dcc63['body'][_0x804b('0x2e')]);_0x5dcc63[_0x804b('0x48')]['Descriptions']=integrations[_0x804b('0x53')](_0x5dcc63[_0x804b('0x48')][_0x804b('0x52')],_0x5dcc63['body'][_0x804b('0x2e')]);return db['ZendeskConfiguration'][_0x804b('0x47')](_0x5dcc63[_0x804b('0x48')],{'include':[{'model':db[_0x804b('0x54')],'as':_0x804b('0x50')},{'model':db['ZendeskField'],'as':_0x804b('0x55')}]});}return null;})[_0x804b('0x26')](respondWithResult(_0x4f8a81,null))[_0x804b('0x43')](handleError(_0x4f8a81,null));};exports[_0x804b('0x56')]=function(_0x17e21c,_0x1bb4ec,_0x5b3b79){var _0x39ed3c='';return db[_0x804b('0x40')]['findOne']({'where':{'id':_0x17e21c[_0x804b('0x49')]['id']},'attributes':['id',_0x804b('0x57'),_0x804b('0x58'),_0x804b('0x59'),'authType',_0x804b('0x5a')]})[_0x804b('0x26')](handleEntityNotFound(_0x1bb4ec,null))['then'](function(_0x2541cd){if(_0x2541cd){_0x39ed3c=_0x2541cd[_0x804b('0x5a')];var _0x549504=_0x39ed3c[_0x804b('0x5b')](-0x1);if(_0x549504==='/'){_0x39ed3c=_0x39ed3c['substring'](0x0,_0x39ed3c[_0x804b('0x5c')](_0x549504));}var _0x3e2813={'method':_0x804b('0x5d'),'uri':util[_0x804b('0x5e')](_0x804b('0x5f'),_0x39ed3c,_0x804b('0x60')),'json':!![]};switch(_0x2541cd[_0x804b('0x61')]){case'password':_0x3e2813[_0x804b('0x62')]={'Authorization':util['format'](_0x804b('0x63'),new Buffer(util[_0x804b('0x5e')](_0x804b('0x64'),_0x2541cd[_0x804b('0x57')],_0x2541cd[_0x804b('0x58')]))[_0x804b('0x65')](_0x804b('0x66')))};break;case _0x804b('0x59'):_0x3e2813[_0x804b('0x62')]={'Authorization':util[_0x804b('0x5e')](_0x804b('0x63'),new Buffer(util['format']('%s/token:%s',_0x2541cd[_0x804b('0x57')],_0x2541cd[_0x804b('0x59')]))[_0x804b('0x65')](_0x804b('0x66')))};break;default:throw new db['Sequelize'][(_0x804b('0x67'))](_0x804b('0x68'));}return rp(_0x3e2813);}})[_0x804b('0x26')](function(_0x3dda89){if(_0x3dda89){var _0x260419=[_0x804b('0x69'),_0x804b('0x6a'),_0x804b('0x6b'),_0x804b('0x6c')];_[_0x804b('0x6d')](_0x3dda89['ticket_fields'],function(_0x5a6661){return _0x260419[_0x804b('0x6e')](_0x5a6661[_0x804b('0x2e')]);});return{'count':_0x3dda89['ticket_fields'][_0x804b('0x36')],'rows':_[_0x804b('0x2c')](_0x3dda89['ticket_fields'],function(_0x345bf7){return{'id':_0x345bf7['id'],'name':_0x345bf7['position']>0x7?_0x345bf7['title']:_0x345bf7[_0x804b('0x2e')],'custom':_0x345bf7[_0x804b('0x6f')]>0x7?!![]:![],'options':_0x345bf7['system_field_options']?_0x345bf7['system_field_options']:_0x345bf7[_0x804b('0x70')]?_0x345bf7[_0x804b('0x70')]:[]};})};}})['then'](respondWithResult(_0x1bb4ec,null))[_0x804b('0x43')](function(_0x5e2756){var _0x42dfc3=_0x17e21c[_0x804b('0x31')][_0x804b('0x71')]?0x1f4:_0x5e2756['statusCode']||0x1f4;logger[_0x804b('0x72')](_0x804b('0x73'),_0x804b('0x56'),_0x42dfc3,JSON[_0x804b('0x74')](_0x5e2756));delete _0x5e2756[_0x804b('0x2a')];if(_0x42dfc3===0x191){_0x42dfc3=0x190;}_0x1bb4ec[_0x804b('0x1a')](_0x42dfc3)[_0x804b('0x2b')](_0x17e21c[_0x804b('0x31')][_0x804b('0x71')]?{'message':_0x804b('0x75'),'statusCode':_0x5e2756['statusCode']}:_0x5e2756);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index e792945..58d90e0 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 _0x4524=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','lodash'];(function(_0xc355,_0xba7c6f){var _0x395931=function(_0xd3777a){while(--_0xd3777a){_0xc355['push'](_0xc355['shift']());}};_0x395931(++_0xba7c6f);}(_0x4524,0x11d));var _0x4452=function(_0xc02e1d,_0x37520d){_0xc02e1d=_0xc02e1d-0x0;var _0xe460e4=_0x4524[_0xc02e1d];return _0xe460e4;};'use strict';var _=require(_0x4452('0x0'));var util=require(_0x4452('0x1'));var logger=require(_0x4452('0x2'))(_0x4452('0x3'));var moment=require(_0x4452('0x4'));var BPromise=require(_0x4452('0x5'));var rp=require(_0x4452('0x6'));var fs=require('fs');var path=require(_0x4452('0x7'));var rimraf=require('rimraf');var config=require(_0x4452('0x8'));var attributes=require(_0x4452('0x9'));var integrations=require(_0x4452('0xa'));module[_0x4452('0xb')]=function(_0x4d045b,_0x35fbac){return _0x4d045b[_0x4452('0xc')]('ZendeskAccount',attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35e5=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x35e5,0xc4));var _0x535e=function(_0x5ce2ec,_0x4e1ca6){_0x5ce2ec=_0x5ce2ec-0x0;var _0x268082=_0x35e5[_0x5ce2ec];return _0x268082;};'use strict';var _=require(_0x535e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x535e('0x1'));var moment=require(_0x535e('0x2'));var BPromise=require(_0x535e('0x3'));var rp=require(_0x535e('0x4'));var fs=require('fs');var path=require(_0x535e('0x5'));var rimraf=require(_0x535e('0x6'));var config=require(_0x535e('0x7'));var attributes=require(_0x535e('0x8'));var integrations=require(_0x535e('0x9'));module[_0x535e('0xa')]=function(_0x3fdc43,_0x1d5f08){return _0x3fdc43[_0x535e('0xb')](_0x535e('0xc'),attributes,{'tableName':_0x535e('0xd'),'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 dd6df92..7e6363a 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 _0x855e=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','include','map','model','attributes','catch','ShowZendeskAccount','lodash'];(function(_0xce0b2b,_0x355d55){var _0x4ebc58=function(_0x205a0f){while(--_0x205a0f){_0xce0b2b['push'](_0xce0b2b['shift']());}};_0x4ebc58(++_0x355d55);}(_0x855e,0x1af));var _0xe855=function(_0x8b8564,_0x162976){_0x8b8564=_0x8b8564-0x0;var _0x360c61=_0x855e[_0x8b8564];return _0x360c61;};'use strict';var _=require(_0xe855('0x0'));var util=require(_0xe855('0x1'));var moment=require(_0xe855('0x2'));var BPromise=require(_0xe855('0x3'));var rs=require(_0xe855('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe855('0x5'))['db'];var utils=require(_0xe855('0x6'));var logger=require(_0xe855('0x7'))(_0xe855('0x8'));var config=require(_0xe855('0x9'));var jayson=require(_0xe855('0xa'));var client=jayson[_0xe855('0xb')][_0xe855('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x58be7e,_0x3a598e,_0x127739){return new BPromise(function(_0x812b79,_0x3cf2b2){return client[_0xe855('0xd')](_0x58be7e,_0x127739)[_0xe855('0xe')](function(_0x27b04c){logger[_0xe855('0xf')](_0xe855('0x10'),_0x3a598e,_0xe855('0x11'));logger[_0xe855('0x12')](_0xe855('0x13'),_0x3a598e,_0xe855('0x11'),JSON[_0xe855('0x14')](_0x27b04c));if(_0x27b04c[_0xe855('0x15')]){if(_0x27b04c[_0xe855('0x15')][_0xe855('0x16')]===0x1f4){logger[_0xe855('0x15')](_0xe855('0x10'),_0x3a598e,_0x27b04c[_0xe855('0x15')]['message']);return _0x3cf2b2(_0x27b04c[_0xe855('0x15')][_0xe855('0x17')]);}logger[_0xe855('0x15')](_0xe855('0x10'),_0x3a598e,_0x27b04c['error']['message']);return _0x812b79(_0x27b04c[_0xe855('0x15')]['message']);}else{logger[_0xe855('0xf')](_0xe855('0x10'),_0x3a598e,_0xe855('0x11'));_0x812b79(_0x27b04c['result']['message']);}})['catch'](function(_0x312920){logger[_0xe855('0x15')](_0xe855('0x10'),_0x3a598e,_0x312920);_0x3cf2b2(_0x312920);});});}exports[_0xe855('0x18')]=function(_0xfca61b){var _0x3a96ac=this;return new Promise(function(_0x4e25db,_0x9c91e2){return db[_0xe855('0x19')][_0xe855('0x1a')]({'raw':_0xfca61b['options']?_0xfca61b[_0xe855('0x1b')][_0xe855('0x1c')]===undefined?!![]:![]:!![],'where':_0xfca61b[_0xe855('0x1b')]?_0xfca61b['options'][_0xe855('0x1d')]||null:null,'attributes':_0xfca61b[_0xe855('0x1b')]?_0xfca61b['options']['attributes']||null:null,'limit':_0xfca61b[_0xe855('0x1b')]?_0xfca61b[_0xe855('0x1b')]['limit']||null:null,'include':_0xfca61b[_0xe855('0x1b')]?_0xfca61b[_0xe855('0x1b')][_0xe855('0x1e')]?_[_0xe855('0x1f')](_0xfca61b[_0xe855('0x1b')]['include'],function(_0x1600b9){return{'model':db[_0x1600b9[_0xe855('0x20')]],'as':_0x1600b9['as'],'attributes':_0x1600b9[_0xe855('0x21')],'include':_0x1600b9['include']?_[_0xe855('0x1f')](_0x1600b9['include'],function(_0x21779b){return{'model':db[_0x21779b[_0xe855('0x20')]],'as':_0x21779b['as'],'attributes':_0x21779b[_0xe855('0x21')],'include':_0x21779b[_0xe855('0x1e')]?_[_0xe855('0x1f')](_0x21779b[_0xe855('0x1e')],function(_0x4bf7ee){return{'model':db[_0x4bf7ee[_0xe855('0x20')]],'as':_0x4bf7ee['as'],'attributes':_0x4bf7ee[_0xe855('0x21')]};}):[]};}):[]};}):[]:[]})[_0xe855('0xe')](function(_0x22f43b){logger[_0xe855('0xf')](_0xe855('0x18'),_0xfca61b);logger[_0xe855('0x12')](_0xe855('0x18'),_0xfca61b,JSON['stringify'](_0x22f43b));_0x4e25db(_0x22f43b);})[_0xe855('0x22')](function(_0x24c5a7){logger[_0xe855('0x15')](_0xe855('0x18'),_0x24c5a7[_0xe855('0x17')],_0xfca61b);_0x9c91e2(_0x3a96ac[_0xe855('0x15')](0x1f4,_0x24c5a7[_0xe855('0x17')]));});});};exports[_0xe855('0x23')]=function(_0x3cd756){var _0x558bdf=this;return new Promise(function(_0xabbe95,_0x53dfd5){return db['ZendeskAccount']['find']({'raw':_0x3cd756['options']?_0x3cd756[_0xe855('0x1b')][_0xe855('0x1c')]===undefined?!![]:![]:!![],'where':_0x3cd756[_0xe855('0x1b')]?_0x3cd756[_0xe855('0x1b')][_0xe855('0x1d')]||null:null,'attributes':_0x3cd756[_0xe855('0x1b')]?_0x3cd756[_0xe855('0x1b')][_0xe855('0x21')]||null:null,'include':_0x3cd756[_0xe855('0x1b')]?_0x3cd756['options']['include']?_['map'](_0x3cd756['options']['include'],function(_0x5d1223){return{'model':db[_0x5d1223[_0xe855('0x20')]],'as':_0x5d1223['as'],'attributes':_0x5d1223[_0xe855('0x21')],'include':_0x5d1223[_0xe855('0x1e')]?_[_0xe855('0x1f')](_0x5d1223[_0xe855('0x1e')],function(_0x5f448d){return{'model':db[_0x5f448d[_0xe855('0x20')]],'as':_0x5f448d['as'],'attributes':_0x5f448d[_0xe855('0x21')],'include':_0x5f448d[_0xe855('0x1e')]?_[_0xe855('0x1f')](_0x5f448d[_0xe855('0x1e')],function(_0x473b5a){return{'model':db[_0x473b5a['model']],'as':_0x473b5a['as'],'attributes':_0x473b5a[_0xe855('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1619c7){logger['info']('ShowZendeskAccount',_0x3cd756);logger[_0xe855('0x12')](_0xe855('0x23'),_0x3cd756,JSON[_0xe855('0x14')](_0x1619c7));_0xabbe95(_0x1619c7);})[_0xe855('0x22')](function(_0x55b9a0){logger[_0xe855('0x15')](_0xe855('0x23'),_0x55b9a0['message'],_0x3cd756);_0x53dfd5(_0x558bdf[_0xe855('0x15')](0x1f4,_0x55b9a0['message']));});});}; \ No newline at end of file +var _0xc5b9=['request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','limit','include','model','map','attributes','then','ShowZendeskAccount','find','catch','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','ZendeskAccount,\x20%s,\x20%s'];(function(_0x43b487,_0x21893a){var _0x2f707a=function(_0x477ee0){while(--_0x477ee0){_0x43b487['push'](_0x43b487['shift']());}};_0x2f707a(++_0x21893a);}(_0xc5b9,0x16a));var _0x9c5b=function(_0x184e92,_0x25c2c5){_0x184e92=_0x184e92-0x0;var _0x26151a=_0xc5b9[_0x184e92];return _0x26151a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x9c5b('0x0'));var rs=require(_0x9c5b('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9c5b('0x2'))['db'];var utils=require(_0x9c5b('0x3'));var logger=require(_0x9c5b('0x4'))('rpc');var config=require(_0x9c5b('0x5'));var jayson=require(_0x9c5b('0x6'));var client=jayson[_0x9c5b('0x7')][_0x9c5b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x10e2ba,_0xd738e6,_0x5e335e){return new BPromise(function(_0x4ede6f,_0x445fe9){return client[_0x9c5b('0x9')](_0x10e2ba,_0x5e335e)['then'](function(_0x2d7051){logger[_0x9c5b('0xa')](_0x9c5b('0xb'),_0xd738e6,_0x9c5b('0xc'));logger[_0x9c5b('0xd')](_0x9c5b('0xe'),_0xd738e6,_0x9c5b('0xc'),JSON[_0x9c5b('0xf')](_0x2d7051));if(_0x2d7051[_0x9c5b('0x10')]){if(_0x2d7051[_0x9c5b('0x10')]['code']===0x1f4){logger['error'](_0x9c5b('0xb'),_0xd738e6,_0x2d7051[_0x9c5b('0x10')][_0x9c5b('0x11')]);return _0x445fe9(_0x2d7051['error'][_0x9c5b('0x11')]);}logger[_0x9c5b('0x10')](_0x9c5b('0xb'),_0xd738e6,_0x2d7051[_0x9c5b('0x10')][_0x9c5b('0x11')]);return _0x4ede6f(_0x2d7051[_0x9c5b('0x10')][_0x9c5b('0x11')]);}else{logger['info'](_0x9c5b('0xb'),_0xd738e6,_0x9c5b('0xc'));_0x4ede6f(_0x2d7051[_0x9c5b('0x12')][_0x9c5b('0x11')]);}})['catch'](function(_0xa96570){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0xd738e6,_0xa96570);_0x445fe9(_0xa96570);});});}exports[_0x9c5b('0x13')]=function(_0x3abe10){var _0x310758=this;return new Promise(function(_0x1162d9,_0x109b37){return db[_0x9c5b('0x14')][_0x9c5b('0x15')]({'raw':_0x3abe10[_0x9c5b('0x16')]?_0x3abe10[_0x9c5b('0x16')][_0x9c5b('0x17')]===undefined?!![]:![]:!![],'where':_0x3abe10['options']?_0x3abe10[_0x9c5b('0x16')][_0x9c5b('0x18')]||null:null,'attributes':_0x3abe10[_0x9c5b('0x16')]?_0x3abe10[_0x9c5b('0x16')]['attributes']||null:null,'limit':_0x3abe10[_0x9c5b('0x16')]?_0x3abe10[_0x9c5b('0x16')][_0x9c5b('0x19')]||null:null,'include':_0x3abe10[_0x9c5b('0x16')]?_0x3abe10[_0x9c5b('0x16')][_0x9c5b('0x1a')]?_['map'](_0x3abe10[_0x9c5b('0x16')]['include'],function(_0x54cc2b){return{'model':db[_0x54cc2b[_0x9c5b('0x1b')]],'as':_0x54cc2b['as'],'attributes':_0x54cc2b['attributes'],'include':_0x54cc2b[_0x9c5b('0x1a')]?_[_0x9c5b('0x1c')](_0x54cc2b['include'],function(_0x246e3c){return{'model':db[_0x246e3c[_0x9c5b('0x1b')]],'as':_0x246e3c['as'],'attributes':_0x246e3c[_0x9c5b('0x1d')],'include':_0x246e3c['include']?_[_0x9c5b('0x1c')](_0x246e3c[_0x9c5b('0x1a')],function(_0x262f7d){return{'model':db[_0x262f7d[_0x9c5b('0x1b')]],'as':_0x262f7d['as'],'attributes':_0x262f7d[_0x9c5b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9c5b('0x1e')](function(_0x56c328){logger[_0x9c5b('0xa')](_0x9c5b('0x13'),_0x3abe10);logger[_0x9c5b('0xd')](_0x9c5b('0x13'),_0x3abe10,JSON[_0x9c5b('0xf')](_0x56c328));_0x1162d9(_0x56c328);})['catch'](function(_0x3e501c){logger[_0x9c5b('0x10')](_0x9c5b('0x13'),_0x3e501c[_0x9c5b('0x11')],_0x3abe10);_0x109b37(_0x310758[_0x9c5b('0x10')](0x1f4,_0x3e501c[_0x9c5b('0x11')]));});});};exports[_0x9c5b('0x1f')]=function(_0xf1cdb8){var _0x587991=this;return new Promise(function(_0x126a73,_0xe71355){return db[_0x9c5b('0x14')][_0x9c5b('0x20')]({'raw':_0xf1cdb8['options']?_0xf1cdb8[_0x9c5b('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0xf1cdb8[_0x9c5b('0x16')]?_0xf1cdb8[_0x9c5b('0x16')][_0x9c5b('0x18')]||null:null,'attributes':_0xf1cdb8['options']?_0xf1cdb8['options'][_0x9c5b('0x1d')]||null:null,'include':_0xf1cdb8[_0x9c5b('0x16')]?_0xf1cdb8[_0x9c5b('0x16')][_0x9c5b('0x1a')]?_['map'](_0xf1cdb8[_0x9c5b('0x16')]['include'],function(_0x2e036b){return{'model':db[_0x2e036b[_0x9c5b('0x1b')]],'as':_0x2e036b['as'],'attributes':_0x2e036b[_0x9c5b('0x1d')],'include':_0x2e036b[_0x9c5b('0x1a')]?_['map'](_0x2e036b[_0x9c5b('0x1a')],function(_0x1380f7){return{'model':db[_0x1380f7[_0x9c5b('0x1b')]],'as':_0x1380f7['as'],'attributes':_0x1380f7['attributes'],'include':_0x1380f7[_0x9c5b('0x1a')]?_[_0x9c5b('0x1c')](_0x1380f7['include'],function(_0x12afb9){return{'model':db[_0x12afb9[_0x9c5b('0x1b')]],'as':_0x12afb9['as'],'attributes':_0x12afb9[_0x9c5b('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x39dd87){logger['info'](_0x9c5b('0x1f'),_0xf1cdb8);logger[_0x9c5b('0xd')](_0x9c5b('0x1f'),_0xf1cdb8,JSON[_0x9c5b('0xf')](_0x39dd87));_0x126a73(_0x39dd87);})[_0x9c5b('0x21')](function(_0x106c2f){logger[_0x9c5b('0x10')]('ShowZendeskAccount',_0x106c2f[_0x9c5b('0x11')],_0xf1cdb8);_0xe71355(_0x587991[_0x9c5b('0x10')](0x1f4,_0x106c2f[_0x9c5b('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 8f8d81c..9b01392 100644 --- a/server/api/intZendeskConfiguration/index.js +++ b/server/api/intZendeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x36ee=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','update','delete','destroy','exports','path','express'];(function(_0x18abd2,_0x22d4b3){var _0x1dcad6=function(_0xcc08c4){while(--_0xcc08c4){_0x18abd2['push'](_0x18abd2['shift']());}};_0x1dcad6(++_0x22d4b3);}(_0x36ee,0xe8));var _0xe36e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x36ee[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe36e('0x0'));var timeout=require('connect-timeout');var express=require(_0xe36e('0x1'));var router=express[_0xe36e('0x2')]();var fs_extra=require(_0xe36e('0x3'));var auth=require(_0xe36e('0x4'));var interaction=require(_0xe36e('0x5'));var config=require(_0xe36e('0x6'));var controller=require(_0xe36e('0x7'));router[_0xe36e('0x8')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0xa')]);router[_0xe36e('0x8')](_0xe36e('0xb'),auth['isAuthenticated'](),controller[_0xe36e('0xc')]);router['get'](_0xe36e('0xd'),auth[_0xe36e('0x9')](),controller[_0xe36e('0xe')]);router['get'](_0xe36e('0xf'),auth['isAuthenticated'](),controller[_0xe36e('0x10')]);router[_0xe36e('0x8')](_0xe36e('0x11'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x12')]);router[_0xe36e('0x8')](_0xe36e('0x13'),auth[_0xe36e('0x9')](),controller['getTags']);router[_0xe36e('0x14')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0x15')]);router[_0xe36e('0x14')]('/:id/tags',auth[_0xe36e('0x9')](),controller['setTags']);router['put'](_0xe36e('0xb'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x16')]);router[_0xe36e('0x17')](_0xe36e('0xb'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x18')]);module[_0xe36e('0x19')]=router; \ No newline at end of file +var _0xe5b5=['../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x42269b,_0x3bd006){var _0x25f892=function(_0x2d72be){while(--_0x2d72be){_0x42269b['push'](_0x42269b['shift']());}};_0x25f892(++_0x3bd006);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x219fa0,_0x18b239){_0x219fa0=_0x219fa0-0x0;var _0xc603fb=_0xe5b5[_0x219fa0];return _0xc603fb;};'use strict';var multer=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var timeout=require(_0x5e5b('0x3'));var express=require(_0x5e5b('0x4'));var router=express[_0x5e5b('0x5')]();var fs_extra=require(_0x5e5b('0x6'));var auth=require(_0x5e5b('0x7'));var interaction=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var controller=require(_0x5e5b('0xa'));router[_0x5e5b('0xb')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xd')]);router[_0x5e5b('0xb')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xf')]);router[_0x5e5b('0xb')](_0x5e5b('0x10'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x11')]);router[_0x5e5b('0xb')]('/:id/subjects',auth[_0x5e5b('0xc')](),controller['getSubjects']);router[_0x5e5b('0xb')](_0x5e5b('0x12'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x13')]);router['get']('/:id/tags',auth['isAuthenticated'](),controller[_0x5e5b('0x14')]);router[_0x5e5b('0x15')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x16')]);router[_0x5e5b('0x15')](_0x5e5b('0x17'),auth[_0x5e5b('0xc')](),controller['setTags']);router[_0x5e5b('0x18')](_0x5e5b('0xe'),auth['isAuthenticated'](),controller[_0x5e5b('0x19')]);router['delete']('/:id',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x1a')]);module[_0x5e5b('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index dcbf8df..e031d36 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 _0xabc9=['STRING','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabc9,0x153));var _0x9abc=function(_0x394c84,_0x52270e){_0x394c84=_0x394c84-0x0;var _0x43c051=_0xabc9[_0x394c84];return _0x43c051;};'use strict';var Sequelize=require('sequelize');module[_0x9abc('0x0')]={'name':{'type':Sequelize[_0x9abc('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4da8=['STRING','sequelize','exports'];(function(_0x56e0e8,_0x16ef91){var _0x2dab50=function(_0x4fe720){while(--_0x4fe720){_0x56e0e8['push'](_0x56e0e8['shift']());}};_0x2dab50(++_0x16ef91);}(_0x4da8,0x139));var _0x84da=function(_0x3a028f,_0x41d439){_0x3a028f=_0x3a028f-0x0;var _0x159843=_0x4da8[_0x3a028f];return _0x159843;};'use strict';var Sequelize=require(_0x84da('0x0'));module[_0x84da('0x1')]={'name':{'type':Sequelize[_0x84da('0x2')]},'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 f9c579f..c387c39 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 _0x9272=['ZendeskConfiguration','include','findAll','rows','show','rawAttributes','includeAll','find','create','body','catch','destroy','params','getFields','findOne','ZendeskField','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','error','stack','name','send','index','map','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x9272,0xbd));var _0x2927=function(_0x30f3d7,_0x3848a7){_0x30f3d7=_0x30f3d7-0x0;var _0x5db7d6=_0x9272[_0x30f3d7];return _0x5db7d6;};'use strict';var emlformat=require(_0x2927('0x0'));var rimraf=require(_0x2927('0x1'));var zipdir=require(_0x2927('0x2'));var jsonpatch=require(_0x2927('0x3'));var rp=require(_0x2927('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2927('0x5'));var util=require(_0x2927('0x6'));var path=require('path');var sox=require(_0x2927('0x7'));var csv=require(_0x2927('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2927('0x9'));var _=require(_0x2927('0xa'));var squel=require(_0x2927('0xb'));var crypto=require(_0x2927('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2927('0xd'));var toCsv=require(_0x2927('0x8'));var querystring=require('querystring');var Papa=require(_0x2927('0xe'));var Redis=require(_0x2927('0xf'));var authService=require(_0x2927('0x10'));var qs=require(_0x2927('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2927('0x12'));var logger=require(_0x2927('0x13'))(_0x2927('0x14'));var utils=require('../../config/utils');var config=require(_0x2927('0x15'));var licenseUtil=require(_0x2927('0x16'));var db=require(_0x2927('0x17'))['db'];function respondWithStatusCode(_0x4f2313,_0xb417a0){_0xb417a0=_0xb417a0||0xcc;return function(_0x58ef90){if(_0x58ef90){return _0x4f2313[_0x2927('0x18')](_0xb417a0);}return _0x4f2313[_0x2927('0x19')](_0xb417a0)[_0x2927('0x1a')]();};}function respondWithResult(_0x374cdb,_0x48cd5c){_0x48cd5c=_0x48cd5c||0xc8;return function(_0x16221c){if(_0x16221c){return _0x374cdb[_0x2927('0x19')](_0x48cd5c)[_0x2927('0x1b')](_0x16221c);}};}function respondWithFilteredResult(_0x17ea84,_0x397754){return function(_0x25ecd6){if(_0x25ecd6){var _0x39a570=typeof _0x397754[_0x2927('0x1c')]===_0x2927('0x1d')&&typeof _0x397754[_0x2927('0x1e')]===_0x2927('0x1d');var _0x482a33=_0x25ecd6['count'];var _0x1569c8=_0x39a570?0x0:_0x397754[_0x2927('0x1c')];var _0x5bdaa8=_0x39a570?_0x25ecd6[_0x2927('0x1f')]:_0x397754[_0x2927('0x1c')]+_0x397754['limit'];var _0x2e23f0;if(_0x5bdaa8>=_0x482a33){_0x5bdaa8=_0x482a33;_0x2e23f0=0xc8;}else{_0x2e23f0=0xce;}_0x17ea84[_0x2927('0x19')](_0x2e23f0);return _0x17ea84[_0x2927('0x20')](_0x2927('0x21'),_0x1569c8+'-'+_0x5bdaa8+'/'+_0x482a33)[_0x2927('0x1b')](_0x25ecd6);}return null;};}function patchUpdates(_0x4b754d){return function(_0x5d9ef4){try{jsonpatch['apply'](_0x5d9ef4,_0x4b754d,!![]);}catch(_0x39965a){return BPromise[_0x2927('0x22')](_0x39965a);}return _0x5d9ef4['save']();};}function saveUpdates(_0x5439f7,_0x1abea3){return function(_0x57aa1d){if(_0x57aa1d){return _0x57aa1d[_0x2927('0x23')](_0x5439f7)['then'](function(_0x42176a){return _0x42176a;});}return null;};}function removeEntity(_0x3c553f,_0x25226f){return function(_0x786441){if(_0x786441){return _0x786441['destroy']()[_0x2927('0x24')](function(){_0x3c553f['status'](0xcc)[_0x2927('0x1a')]();});}};}function handleEntityNotFound(_0x4991df,_0x340321){return function(_0x4b360b){if(!_0x4b360b){_0x4991df[_0x2927('0x18')](0x194);}return _0x4b360b;};}function handleError(_0x511b5c,_0x3e6565){_0x3e6565=_0x3e6565||0x1f4;return function(_0x237ec2){logger[_0x2927('0x25')](_0x237ec2[_0x2927('0x26')]);if(_0x237ec2['name']){delete _0x237ec2[_0x2927('0x27')];}_0x511b5c[_0x2927('0x19')](_0x3e6565)[_0x2927('0x28')](_0x237ec2);};}exports[_0x2927('0x29')]=function(_0x79161c,_0x3929c5){var _0x43b23a={},_0xfdd52e={},_0x3cc455={'count':0x0,'rows':[]};var _0x4efdd4=_[_0x2927('0x2a')](db['ZendeskConfiguration']['rawAttributes'],function(_0x10fbad){return{'name':_0x10fbad['fieldName'],'type':_0x10fbad['type'][_0x2927('0x2b')]};});_0xfdd52e[_0x2927('0x2c')]=_[_0x2927('0x2a')](_0x4efdd4,_0x2927('0x27'));_0xfdd52e[_0x2927('0x2d')]=_[_0x2927('0x2e')](_0x79161c[_0x2927('0x2d')]);_0xfdd52e['filters']=_[_0x2927('0x2f')](_0xfdd52e[_0x2927('0x2c')],_0xfdd52e[_0x2927('0x2d')]);_0x43b23a[_0x2927('0x30')]=_[_0x2927('0x2f')](_0xfdd52e[_0x2927('0x2c')],qs[_0x2927('0x31')](_0x79161c[_0x2927('0x2d')][_0x2927('0x31')]));_0x43b23a[_0x2927('0x30')]=_0x43b23a[_0x2927('0x30')][_0x2927('0x32')]?_0x43b23a[_0x2927('0x30')]:_0xfdd52e[_0x2927('0x2c')];if(!_0x79161c[_0x2927('0x2d')]['hasOwnProperty'](_0x2927('0x33'))){_0x43b23a['limit']=qs[_0x2927('0x1e')](_0x79161c[_0x2927('0x2d')][_0x2927('0x1e')]);_0x43b23a['offset']=qs[_0x2927('0x1c')](_0x79161c[_0x2927('0x2d')][_0x2927('0x1c')]);}_0x43b23a[_0x2927('0x34')]=qs[_0x2927('0x35')](_0x79161c['query'][_0x2927('0x35')]);_0x43b23a[_0x2927('0x36')]=qs[_0x2927('0x37')](_[_0x2927('0x38')](_0x79161c[_0x2927('0x2d')],_0xfdd52e[_0x2927('0x37')]),_0x4efdd4);if(_0x79161c[_0x2927('0x2d')][_0x2927('0x39')]){_0x43b23a['where']=_[_0x2927('0x3a')](_0x43b23a[_0x2927('0x36')],{'$or':_[_0x2927('0x2a')](_0x4efdd4,function(_0x22ee24){if(_0x22ee24['type']!=='VIRTUAL'){var _0x4854fa={};_0x4854fa[_0x22ee24[_0x2927('0x27')]]={'$like':'%'+_0x79161c[_0x2927('0x2d')][_0x2927('0x39')]+'%'};return _0x4854fa;}})});}_0x43b23a=_['merge']({},_0x43b23a,_0x79161c[_0x2927('0x3b')]);var _0x3b2541={'where':_0x43b23a[_0x2927('0x36')]};return db[_0x2927('0x3c')][_0x2927('0x1f')](_0x3b2541)[_0x2927('0x24')](function(_0x41ee55){_0x3cc455[_0x2927('0x1f')]=_0x41ee55;if(_0x79161c[_0x2927('0x2d')]['includeAll']){_0x43b23a[_0x2927('0x3d')]=[{'all':!![]}];}return db[_0x2927('0x3c')][_0x2927('0x3e')](_0x43b23a);})[_0x2927('0x24')](function(_0x106469){_0x3cc455[_0x2927('0x3f')]=_0x106469;return _0x3cc455;})[_0x2927('0x24')](respondWithFilteredResult(_0x3929c5,_0x43b23a))['catch'](handleError(_0x3929c5,null));};exports[_0x2927('0x40')]=function(_0x252d54,_0x51f4aa){var _0x142b5b={'raw':![],'where':{'id':_0x252d54['params']['id']}},_0xf31bca={};_0xf31bca[_0x2927('0x2c')]=_[_0x2927('0x2e')](db[_0x2927('0x3c')][_0x2927('0x41')]);_0xf31bca[_0x2927('0x2d')]=_['keys'](_0x252d54[_0x2927('0x2d')]);_0xf31bca[_0x2927('0x37')]=_[_0x2927('0x2f')](_0xf31bca[_0x2927('0x2c')],_0xf31bca[_0x2927('0x2d')]);_0x142b5b[_0x2927('0x30')]=_[_0x2927('0x2f')](_0xf31bca['model'],qs['fields'](_0x252d54[_0x2927('0x2d')][_0x2927('0x31')]));_0x142b5b['attributes']=_0x142b5b[_0x2927('0x30')][_0x2927('0x32')]?_0x142b5b['attributes']:_0xf31bca[_0x2927('0x2c')];if(_0x252d54['query'][_0x2927('0x42')]){_0x142b5b[_0x2927('0x3d')]=[{'all':!![]}];}_0x142b5b=_[_0x2927('0x3a')]({},_0x142b5b,_0x252d54[_0x2927('0x3b')]);return db[_0x2927('0x3c')][_0x2927('0x43')](_0x142b5b)['then'](handleEntityNotFound(_0x51f4aa,null))[_0x2927('0x24')](respondWithResult(_0x51f4aa,null))['catch'](handleError(_0x51f4aa,null));};exports[_0x2927('0x44')]=function(_0x4eaff6,_0x47e49b){return db[_0x2927('0x3c')][_0x2927('0x44')](_0x4eaff6[_0x2927('0x45')],{})[_0x2927('0x24')](respondWithResult(_0x47e49b,0xc9))[_0x2927('0x46')](handleError(_0x47e49b,null));};exports['update']=function(_0x4025a0,_0x487f4a){if(_0x4025a0[_0x2927('0x45')]['id']){delete _0x4025a0[_0x2927('0x45')]['id'];}return db[_0x2927('0x3c')][_0x2927('0x43')]({'where':{'id':_0x4025a0['params']['id']}})['then'](handleEntityNotFound(_0x487f4a,null))['then'](saveUpdates(_0x4025a0[_0x2927('0x45')],null))[_0x2927('0x24')](respondWithResult(_0x487f4a,null))[_0x2927('0x46')](handleError(_0x487f4a,null));};exports[_0x2927('0x47')]=function(_0x3b6286,_0x2f949e){return db[_0x2927('0x3c')][_0x2927('0x43')]({'where':{'id':_0x3b6286[_0x2927('0x48')]['id']}})[_0x2927('0x24')](handleEntityNotFound(_0x2f949e,null))[_0x2927('0x24')](removeEntity(_0x2f949e,null))[_0x2927('0x46')](handleError(_0x2f949e,null));};exports[_0x2927('0x49')]=function(_0x3badf9,_0x4e3663,_0x5eecf6){var _0x79b8dd={};var _0x5c187a={};var _0x59e2e7;var _0x1b9960;return db[_0x2927('0x3c')][_0x2927('0x4a')]({'where':{'id':_0x3badf9['params']['id']}})[_0x2927('0x24')](handleEntityNotFound(_0x4e3663,null))[_0x2927('0x24')](function(_0x5d4c40){if(_0x5d4c40){_0x59e2e7=_0x5d4c40;_0x5c187a[_0x2927('0x2c')]=_['keys'](db[_0x2927('0x4b')]['rawAttributes']);_0x5c187a[_0x2927('0x2d')]=_[_0x2927('0x2e')](_0x3badf9[_0x2927('0x2d')]);_0x5c187a[_0x2927('0x37')]=_[_0x2927('0x2f')](_0x5c187a[_0x2927('0x2c')],_0x5c187a['query']);_0x79b8dd['attributes']=_[_0x2927('0x2f')](_0x5c187a[_0x2927('0x2c')],qs[_0x2927('0x31')](_0x3badf9[_0x2927('0x2d')][_0x2927('0x31')]));_0x79b8dd[_0x2927('0x30')]=_0x79b8dd[_0x2927('0x30')]['length']?_0x79b8dd['attributes']:_0x5c187a[_0x2927('0x2c')];_0x79b8dd[_0x2927('0x34')]=qs[_0x2927('0x35')](_0x3badf9['query'][_0x2927('0x35')]);_0x79b8dd['where']=qs[_0x2927('0x37')](_[_0x2927('0x38')](_0x3badf9['query'],_0x5c187a[_0x2927('0x37')]));if(_0x3badf9['query']['filter']){_0x79b8dd['where']=_['merge'](_0x79b8dd[_0x2927('0x36')],{'$or':_[_0x2927('0x2a')](_0x79b8dd[_0x2927('0x30')],function(_0x2cd399){var _0x39d939={};_0x39d939[_0x2cd399]={'$like':'%'+_0x3badf9[_0x2927('0x2d')][_0x2927('0x39')]+'%'};return _0x39d939;})});}_0x79b8dd=_[_0x2927('0x3a')]({},_0x79b8dd,_0x3badf9[_0x2927('0x3b')]);return _0x59e2e7['getFields'](_0x79b8dd);}})[_0x2927('0x24')](function(_0xab7b60){if(_0xab7b60){_0x1b9960=_0xab7b60[_0x2927('0x32')];if(!_0x3badf9['query'][_0x2927('0x4c')](_0x2927('0x33'))){_0x79b8dd[_0x2927('0x1e')]=qs['limit'](_0x3badf9['query'][_0x2927('0x1e')]);_0x79b8dd['offset']=qs['offset'](_0x3badf9[_0x2927('0x2d')][_0x2927('0x1c')]);}return _0x59e2e7[_0x2927('0x49')](_0x79b8dd);}})[_0x2927('0x24')](function(_0x36d368){if(_0x36d368){return _0x36d368?{'count':_0x1b9960,'rows':_0x36d368}:null;}})[_0x2927('0x24')](respondWithResult(_0x4e3663,null))[_0x2927('0x46')](handleError(_0x4e3663,null));};exports[_0x2927('0x4d')]=function(_0x1e0925,_0x2cbd84,_0x2b214e){var _0x3504db={};var _0x2e59f7={};var _0x40b394;var _0x22e182;return db['ZendeskConfiguration'][_0x2927('0x4a')]({'where':{'id':_0x1e0925[_0x2927('0x48')]['id']}})['then'](handleEntityNotFound(_0x2cbd84,null))['then'](function(_0x5dd783){if(_0x5dd783){_0x40b394=_0x5dd783;_0x2e59f7[_0x2927('0x2c')]=_[_0x2927('0x2e')](db[_0x2927('0x4b')][_0x2927('0x41')]);_0x2e59f7[_0x2927('0x2d')]=_[_0x2927('0x2e')](_0x1e0925['query']);_0x2e59f7[_0x2927('0x37')]=_[_0x2927('0x2f')](_0x2e59f7[_0x2927('0x2c')],_0x2e59f7[_0x2927('0x2d')]);_0x3504db['attributes']=_[_0x2927('0x2f')](_0x2e59f7[_0x2927('0x2c')],qs[_0x2927('0x31')](_0x1e0925['query']['fields']));_0x3504db[_0x2927('0x30')]=_0x3504db[_0x2927('0x30')][_0x2927('0x32')]?_0x3504db[_0x2927('0x30')]:_0x2e59f7[_0x2927('0x2c')];_0x3504db[_0x2927('0x34')]=qs[_0x2927('0x35')](_0x1e0925['query'][_0x2927('0x35')]);_0x3504db[_0x2927('0x36')]=qs[_0x2927('0x37')](_[_0x2927('0x38')](_0x1e0925[_0x2927('0x2d')],_0x2e59f7[_0x2927('0x37')]));if(_0x1e0925[_0x2927('0x2d')][_0x2927('0x39')]){_0x3504db[_0x2927('0x36')]=_[_0x2927('0x3a')](_0x3504db[_0x2927('0x36')],{'$or':_[_0x2927('0x2a')](_0x3504db[_0x2927('0x30')],function(_0x5f5d6c){var _0x17bad0={};_0x17bad0[_0x5f5d6c]={'$like':'%'+_0x1e0925[_0x2927('0x2d')]['filter']+'%'};return _0x17bad0;})});}_0x3504db=_['merge']({},_0x3504db,_0x1e0925[_0x2927('0x3b')]);return _0x40b394[_0x2927('0x4d')](_0x3504db);}})[_0x2927('0x24')](function(_0xafe105){if(_0xafe105){_0x22e182=_0xafe105['length'];if(!_0x1e0925[_0x2927('0x2d')]['hasOwnProperty'](_0x2927('0x33'))){_0x3504db[_0x2927('0x1e')]=qs[_0x2927('0x1e')](_0x1e0925[_0x2927('0x2d')][_0x2927('0x1e')]);_0x3504db['offset']=qs[_0x2927('0x1c')](_0x1e0925[_0x2927('0x2d')]['offset']);}return _0x40b394[_0x2927('0x4d')](_0x3504db);}})['then'](function(_0x4bacc1){if(_0x4bacc1){return _0x4bacc1?{'count':_0x22e182,'rows':_0x4bacc1}:null;}})[_0x2927('0x24')](respondWithResult(_0x2cbd84,null))[_0x2927('0x46')](handleError(_0x2cbd84,null));};exports[_0x2927('0x4e')]=function(_0x55561e,_0x31b075,_0x393e08){var _0x34e998={};var _0x25a881={};var _0x381f4a;var _0xf09bad;return db[_0x2927('0x3c')][_0x2927('0x4a')]({'where':{'id':_0x55561e[_0x2927('0x48')]['id']}})[_0x2927('0x24')](handleEntityNotFound(_0x31b075,null))[_0x2927('0x24')](function(_0x5029cb){if(_0x5029cb){_0x381f4a=_0x5029cb;_0x25a881[_0x2927('0x2c')]=_[_0x2927('0x2e')](db[_0x2927('0x4b')][_0x2927('0x41')]);_0x25a881[_0x2927('0x2d')]=_['keys'](_0x55561e[_0x2927('0x2d')]);_0x25a881[_0x2927('0x37')]=_['intersection'](_0x25a881[_0x2927('0x2c')],_0x25a881[_0x2927('0x2d')]);_0x34e998[_0x2927('0x30')]=_[_0x2927('0x2f')](_0x25a881[_0x2927('0x2c')],qs[_0x2927('0x31')](_0x55561e[_0x2927('0x2d')][_0x2927('0x31')]));_0x34e998[_0x2927('0x30')]=_0x34e998[_0x2927('0x30')][_0x2927('0x32')]?_0x34e998[_0x2927('0x30')]:_0x25a881['model'];_0x34e998[_0x2927('0x34')]=qs['sort'](_0x55561e[_0x2927('0x2d')]['sort']);_0x34e998['where']=qs[_0x2927('0x37')](_['pick'](_0x55561e['query'],_0x25a881[_0x2927('0x37')]));if(_0x55561e['query'][_0x2927('0x39')]){_0x34e998['where']=_[_0x2927('0x3a')](_0x34e998[_0x2927('0x36')],{'$or':_[_0x2927('0x2a')](_0x34e998[_0x2927('0x30')],function(_0x3f324b){var _0x75b74e={};_0x75b74e[_0x3f324b]={'$like':'%'+_0x55561e[_0x2927('0x2d')][_0x2927('0x39')]+'%'};return _0x75b74e;})});}_0x34e998=_['merge']({},_0x34e998,_0x55561e[_0x2927('0x3b')]);return _0x381f4a[_0x2927('0x4e')](_0x34e998);}})[_0x2927('0x24')](function(_0x4a3d37){if(_0x4a3d37){_0xf09bad=_0x4a3d37[_0x2927('0x32')];if(!_0x55561e[_0x2927('0x2d')][_0x2927('0x4c')](_0x2927('0x33'))){_0x34e998[_0x2927('0x1e')]=qs[_0x2927('0x1e')](_0x55561e[_0x2927('0x2d')][_0x2927('0x1e')]);_0x34e998[_0x2927('0x1c')]=qs[_0x2927('0x1c')](_0x55561e[_0x2927('0x2d')]['offset']);}return _0x381f4a[_0x2927('0x4e')](_0x34e998);}})[_0x2927('0x24')](function(_0x3c7dd5){if(_0x3c7dd5){return _0x3c7dd5?{'count':_0xf09bad,'rows':_0x3c7dd5}:null;}})[_0x2927('0x24')](respondWithResult(_0x31b075,null))[_0x2927('0x46')](handleError(_0x31b075,null));};exports[_0x2927('0x4f')]=function(_0x2e86d6,_0x4531a4,_0x30f6ae){var _0x1dea70={};var _0x115292={};var _0x3f6917;var _0x56152c;return db[_0x2927('0x3c')]['findOne']({'where':{'id':_0x2e86d6[_0x2927('0x48')]['id']}})[_0x2927('0x24')](handleEntityNotFound(_0x4531a4,null))['then'](function(_0x27e4c5){if(_0x27e4c5){_0x3f6917=_0x27e4c5;_0x115292['model']=_[_0x2927('0x2e')](db[_0x2927('0x50')][_0x2927('0x41')]);_0x115292[_0x2927('0x2d')]=_[_0x2927('0x2e')](_0x2e86d6[_0x2927('0x2d')]);_0x115292[_0x2927('0x37')]=_[_0x2927('0x2f')](_0x115292[_0x2927('0x2c')],_0x115292[_0x2927('0x2d')]);_0x1dea70[_0x2927('0x30')]=_[_0x2927('0x2f')](_0x115292[_0x2927('0x2c')],qs[_0x2927('0x31')](_0x2e86d6[_0x2927('0x2d')][_0x2927('0x31')]));_0x1dea70['attributes']=_0x1dea70['attributes'][_0x2927('0x32')]?_0x1dea70[_0x2927('0x30')]:_0x115292[_0x2927('0x2c')];_0x1dea70[_0x2927('0x34')]=qs['sort'](_0x2e86d6['query'][_0x2927('0x35')]);_0x1dea70['where']=qs[_0x2927('0x37')](_[_0x2927('0x38')](_0x2e86d6[_0x2927('0x2d')],_0x115292[_0x2927('0x37')]));if(_0x2e86d6[_0x2927('0x2d')]['filter']){_0x1dea70[_0x2927('0x36')]=_[_0x2927('0x3a')](_0x1dea70[_0x2927('0x36')],{'$or':_[_0x2927('0x2a')](_0x1dea70[_0x2927('0x30')],function(_0x576114){var _0x3057c8={};_0x3057c8[_0x576114]={'$like':'%'+_0x2e86d6['query']['filter']+'%'};return _0x3057c8;})});}_0x1dea70=_[_0x2927('0x3a')]({},_0x1dea70,_0x2e86d6['options']);return _0x3f6917[_0x2927('0x4f')](_0x1dea70);}})[_0x2927('0x24')](function(_0x2169bc){if(_0x2169bc){_0x56152c=_0x2169bc[_0x2927('0x32')];if(!_0x2e86d6[_0x2927('0x2d')][_0x2927('0x4c')](_0x2927('0x33'))){_0x1dea70[_0x2927('0x1e')]=qs[_0x2927('0x1e')](_0x2e86d6[_0x2927('0x2d')][_0x2927('0x1e')]);_0x1dea70[_0x2927('0x1c')]=qs['offset'](_0x2e86d6[_0x2927('0x2d')][_0x2927('0x1c')]);}return _0x3f6917[_0x2927('0x4f')](_0x1dea70);}})[_0x2927('0x24')](function(_0x323e38){if(_0x323e38){return _0x323e38?{'count':_0x56152c,'rows':_0x323e38}:null;}})[_0x2927('0x24')](respondWithResult(_0x4531a4,null))[_0x2927('0x46')](handleError(_0x4531a4,null));};exports[_0x2927('0x51')]=function(_0x4abcb6,_0x3f9a3a,_0x2f1158){if(_0x4abcb6[_0x2927('0x45')]['id']){delete _0x4abcb6[_0x2927('0x45')]['id'];}return db[_0x2927('0x3c')]['findOne']({'where':{'id':_0x4abcb6[_0x2927('0x48')]['id']}})[_0x2927('0x24')](handleEntityNotFound(_0x3f9a3a,null))[_0x2927('0x24')](function(_0x32027c){if(_0x32027c){return _0x32027c['setTags'](_0x4abcb6['body'][_0x2927('0x52')]||[]);}return null;})['then'](respondWithResult(_0x3f9a3a,null))[_0x2927('0x46')](handleError(_0x3f9a3a,null));}; \ No newline at end of file +var _0x367d=['model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','create','body','find','params','getFields','findOne','ZendeskField','getSubjects','getDescriptions','Tag','getTags','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type'];(function(_0x32c3c2,_0x42a5bf){var _0x43070a=function(_0x12d21d){while(--_0x12d21d){_0x32c3c2['push'](_0x32c3c2['shift']());}};_0x43070a(++_0x42a5bf);}(_0x367d,0x1c7));var _0xd367=function(_0x46d0fb,_0x538343){_0x46d0fb=_0x46d0fb-0x0;var _0x5b68b9=_0x367d[_0x46d0fb];return _0x5b68b9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd367('0x0'));var zipdir=require(_0xd367('0x1'));var jsonpatch=require(_0xd367('0x2'));var rp=require(_0xd367('0x3'));var moment=require('moment');var BPromise=require(_0xd367('0x4'));var Mustache=require(_0xd367('0x5'));var util=require('util');var path=require(_0xd367('0x6'));var sox=require('sox');var csv=require(_0xd367('0x7'));var ejs=require(_0xd367('0x8'));var fs=require('fs');var fs_extra=require(_0xd367('0x9'));var _=require(_0xd367('0xa'));var squel=require('squel');var crypto=require(_0xd367('0xb'));var jsforce=require(_0xd367('0xc'));var deskjs=require(_0xd367('0xd'));var toCsv=require(_0xd367('0x7'));var querystring=require(_0xd367('0xe'));var Papa=require('papaparse');var Redis=require(_0xd367('0xf'));var authService=require(_0xd367('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd367('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd367('0x12'));var utils=require(_0xd367('0x13'));var config=require(_0xd367('0x14'));var licenseUtil=require(_0xd367('0x15'));var db=require(_0xd367('0x16'))['db'];function respondWithStatusCode(_0x241f80,_0x2ba82c){_0x2ba82c=_0x2ba82c||0xcc;return function(_0x213b81){if(_0x213b81){return _0x241f80[_0xd367('0x17')](_0x2ba82c);}return _0x241f80['status'](_0x2ba82c)[_0xd367('0x18')]();};}function respondWithResult(_0x29605a,_0xf9f5d1){_0xf9f5d1=_0xf9f5d1||0xc8;return function(_0x221f7e){if(_0x221f7e){return _0x29605a[_0xd367('0x19')](_0xf9f5d1)[_0xd367('0x1a')](_0x221f7e);}};}function respondWithFilteredResult(_0x368b34,_0x3a7803){return function(_0x463dee){if(_0x463dee){var _0x46b0c3=typeof _0x3a7803[_0xd367('0x1b')]===_0xd367('0x1c')&&typeof _0x3a7803[_0xd367('0x1d')]===_0xd367('0x1c');var _0x2d20df=_0x463dee[_0xd367('0x1e')];var _0x749c04=_0x46b0c3?0x0:_0x3a7803[_0xd367('0x1b')];var _0x54499e=_0x46b0c3?_0x463dee[_0xd367('0x1e')]:_0x3a7803['offset']+_0x3a7803[_0xd367('0x1d')];var _0x3354ef;if(_0x54499e>=_0x2d20df){_0x54499e=_0x2d20df;_0x3354ef=0xc8;}else{_0x3354ef=0xce;}_0x368b34[_0xd367('0x19')](_0x3354ef);return _0x368b34[_0xd367('0x1f')](_0xd367('0x20'),_0x749c04+'-'+_0x54499e+'/'+_0x2d20df)[_0xd367('0x1a')](_0x463dee);}return null;};}function patchUpdates(_0xc9859f){return function(_0x514e21){try{jsonpatch[_0xd367('0x21')](_0x514e21,_0xc9859f,!![]);}catch(_0x1d159d){return BPromise[_0xd367('0x22')](_0x1d159d);}return _0x514e21[_0xd367('0x23')]();};}function saveUpdates(_0x2707fc,_0x3c79b5){return function(_0x3ce43f){if(_0x3ce43f){return _0x3ce43f[_0xd367('0x24')](_0x2707fc)[_0xd367('0x25')](function(_0x4dc316){return _0x4dc316;});}return null;};}function removeEntity(_0x2d4737,_0x3b230a){return function(_0x371e30){if(_0x371e30){return _0x371e30[_0xd367('0x26')]()['then'](function(){_0x2d4737[_0xd367('0x19')](0xcc)[_0xd367('0x18')]();});}};}function handleEntityNotFound(_0x1f5a95,_0x4b2733){return function(_0x1b5080){if(!_0x1b5080){_0x1f5a95['sendStatus'](0x194);}return _0x1b5080;};}function handleError(_0x307bfe,_0x1dbbc6){_0x1dbbc6=_0x1dbbc6||0x1f4;return function(_0x26484b){logger[_0xd367('0x27')](_0x26484b[_0xd367('0x28')]);if(_0x26484b[_0xd367('0x29')]){delete _0x26484b[_0xd367('0x29')];}_0x307bfe['status'](_0x1dbbc6)[_0xd367('0x2a')](_0x26484b);};}exports[_0xd367('0x2b')]=function(_0xffd048,_0x5dff18){var _0x484a33={},_0x27447e={},_0x1cc775={'count':0x0,'rows':[]};var _0x33d749=_[_0xd367('0x2c')](db[_0xd367('0x2d')][_0xd367('0x2e')],function(_0x4766fc){return{'name':_0x4766fc[_0xd367('0x2f')],'type':_0x4766fc[_0xd367('0x30')]['key']};});_0x27447e[_0xd367('0x31')]=_[_0xd367('0x2c')](_0x33d749,'name');_0x27447e[_0xd367('0x32')]=_[_0xd367('0x33')](_0xffd048[_0xd367('0x32')]);_0x27447e[_0xd367('0x34')]=_['intersection'](_0x27447e[_0xd367('0x31')],_0x27447e[_0xd367('0x32')]);_0x484a33['attributes']=_[_0xd367('0x35')](_0x27447e['model'],qs[_0xd367('0x36')](_0xffd048[_0xd367('0x32')][_0xd367('0x36')]));_0x484a33['attributes']=_0x484a33[_0xd367('0x37')][_0xd367('0x38')]?_0x484a33[_0xd367('0x37')]:_0x27447e[_0xd367('0x31')];if(!_0xffd048[_0xd367('0x32')][_0xd367('0x39')](_0xd367('0x3a'))){_0x484a33['limit']=qs[_0xd367('0x1d')](_0xffd048[_0xd367('0x32')]['limit']);_0x484a33[_0xd367('0x1b')]=qs[_0xd367('0x1b')](_0xffd048[_0xd367('0x32')][_0xd367('0x1b')]);}_0x484a33[_0xd367('0x3b')]=qs[_0xd367('0x3c')](_0xffd048[_0xd367('0x32')][_0xd367('0x3c')]);_0x484a33[_0xd367('0x3d')]=qs[_0xd367('0x34')](_[_0xd367('0x3e')](_0xffd048[_0xd367('0x32')],_0x27447e[_0xd367('0x34')]),_0x33d749);if(_0xffd048[_0xd367('0x32')][_0xd367('0x3f')]){_0x484a33[_0xd367('0x3d')]=_[_0xd367('0x40')](_0x484a33[_0xd367('0x3d')],{'$or':_[_0xd367('0x2c')](_0x33d749,function(_0x14f021){if(_0x14f021[_0xd367('0x30')]!=='VIRTUAL'){var _0x551aaf={};_0x551aaf[_0x14f021['name']]={'$like':'%'+_0xffd048[_0xd367('0x32')][_0xd367('0x3f')]+'%'};return _0x551aaf;}})});}_0x484a33=_[_0xd367('0x40')]({},_0x484a33,_0xffd048[_0xd367('0x41')]);var _0x53ff26={'where':_0x484a33['where']};return db[_0xd367('0x2d')][_0xd367('0x1e')](_0x53ff26)[_0xd367('0x25')](function(_0x5a2924){_0x1cc775[_0xd367('0x1e')]=_0x5a2924;if(_0xffd048[_0xd367('0x32')]['includeAll']){_0x484a33[_0xd367('0x42')]=[{'all':!![]}];}return db[_0xd367('0x2d')][_0xd367('0x43')](_0x484a33);})[_0xd367('0x25')](function(_0x3e9516){_0x1cc775[_0xd367('0x44')]=_0x3e9516;return _0x1cc775;})['then'](respondWithFilteredResult(_0x5dff18,_0x484a33))[_0xd367('0x45')](handleError(_0x5dff18,null));};exports[_0xd367('0x46')]=function(_0x1a0aed,_0x1959c1){var _0x2eb52f={'raw':![],'where':{'id':_0x1a0aed['params']['id']}},_0x2cba3f={};_0x2cba3f[_0xd367('0x31')]=_[_0xd367('0x33')](db['ZendeskConfiguration']['rawAttributes']);_0x2cba3f[_0xd367('0x32')]=_[_0xd367('0x33')](_0x1a0aed['query']);_0x2cba3f['filters']=_[_0xd367('0x35')](_0x2cba3f[_0xd367('0x31')],_0x2cba3f[_0xd367('0x32')]);_0x2eb52f[_0xd367('0x37')]=_[_0xd367('0x35')](_0x2cba3f[_0xd367('0x31')],qs[_0xd367('0x36')](_0x1a0aed[_0xd367('0x32')][_0xd367('0x36')]));_0x2eb52f[_0xd367('0x37')]=_0x2eb52f[_0xd367('0x37')]['length']?_0x2eb52f[_0xd367('0x37')]:_0x2cba3f[_0xd367('0x31')];if(_0x1a0aed['query']['includeAll']){_0x2eb52f[_0xd367('0x42')]=[{'all':!![]}];}_0x2eb52f=_['merge']({},_0x2eb52f,_0x1a0aed[_0xd367('0x41')]);return db['ZendeskConfiguration']['find'](_0x2eb52f)['then'](handleEntityNotFound(_0x1959c1,null))['then'](respondWithResult(_0x1959c1,null))[_0xd367('0x45')](handleError(_0x1959c1,null));};exports[_0xd367('0x47')]=function(_0x25972f,_0x998690){return db[_0xd367('0x2d')][_0xd367('0x47')](_0x25972f[_0xd367('0x48')],{})[_0xd367('0x25')](respondWithResult(_0x998690,0xc9))['catch'](handleError(_0x998690,null));};exports[_0xd367('0x24')]=function(_0x5a1414,_0x647e89){if(_0x5a1414['body']['id']){delete _0x5a1414[_0xd367('0x48')]['id'];}return db[_0xd367('0x2d')][_0xd367('0x49')]({'where':{'id':_0x5a1414[_0xd367('0x4a')]['id']}})[_0xd367('0x25')](handleEntityNotFound(_0x647e89,null))[_0xd367('0x25')](saveUpdates(_0x5a1414[_0xd367('0x48')],null))[_0xd367('0x25')](respondWithResult(_0x647e89,null))['catch'](handleError(_0x647e89,null));};exports[_0xd367('0x26')]=function(_0x4eee40,_0x24b819){return db[_0xd367('0x2d')]['find']({'where':{'id':_0x4eee40['params']['id']}})[_0xd367('0x25')](handleEntityNotFound(_0x24b819,null))['then'](removeEntity(_0x24b819,null))[_0xd367('0x45')](handleError(_0x24b819,null));};exports[_0xd367('0x4b')]=function(_0x2551a0,_0x5df2b1,_0x1ddbed){var _0x281980={};var _0x201c77={};var _0x5e04a5;var _0x5840b0;return db[_0xd367('0x2d')][_0xd367('0x4c')]({'where':{'id':_0x2551a0[_0xd367('0x4a')]['id']}})[_0xd367('0x25')](handleEntityNotFound(_0x5df2b1,null))['then'](function(_0x1e62fc){if(_0x1e62fc){_0x5e04a5=_0x1e62fc;_0x201c77[_0xd367('0x31')]=_[_0xd367('0x33')](db[_0xd367('0x4d')]['rawAttributes']);_0x201c77[_0xd367('0x32')]=_['keys'](_0x2551a0[_0xd367('0x32')]);_0x201c77['filters']=_['intersection'](_0x201c77[_0xd367('0x31')],_0x201c77['query']);_0x281980[_0xd367('0x37')]=_[_0xd367('0x35')](_0x201c77[_0xd367('0x31')],qs[_0xd367('0x36')](_0x2551a0[_0xd367('0x32')]['fields']));_0x281980[_0xd367('0x37')]=_0x281980[_0xd367('0x37')][_0xd367('0x38')]?_0x281980['attributes']:_0x201c77[_0xd367('0x31')];_0x281980[_0xd367('0x3b')]=qs['sort'](_0x2551a0[_0xd367('0x32')][_0xd367('0x3c')]);_0x281980[_0xd367('0x3d')]=qs[_0xd367('0x34')](_[_0xd367('0x3e')](_0x2551a0[_0xd367('0x32')],_0x201c77[_0xd367('0x34')]));if(_0x2551a0[_0xd367('0x32')][_0xd367('0x3f')]){_0x281980[_0xd367('0x3d')]=_[_0xd367('0x40')](_0x281980[_0xd367('0x3d')],{'$or':_[_0xd367('0x2c')](_0x281980['attributes'],function(_0x53d9cb){var _0x34722b={};_0x34722b[_0x53d9cb]={'$like':'%'+_0x2551a0['query'][_0xd367('0x3f')]+'%'};return _0x34722b;})});}_0x281980=_['merge']({},_0x281980,_0x2551a0[_0xd367('0x41')]);return _0x5e04a5[_0xd367('0x4b')](_0x281980);}})[_0xd367('0x25')](function(_0x589354){if(_0x589354){_0x5840b0=_0x589354['length'];if(!_0x2551a0[_0xd367('0x32')]['hasOwnProperty'](_0xd367('0x3a'))){_0x281980['limit']=qs[_0xd367('0x1d')](_0x2551a0[_0xd367('0x32')][_0xd367('0x1d')]);_0x281980[_0xd367('0x1b')]=qs['offset'](_0x2551a0['query'][_0xd367('0x1b')]);}return _0x5e04a5['getFields'](_0x281980);}})[_0xd367('0x25')](function(_0x5689e7){if(_0x5689e7){return _0x5689e7?{'count':_0x5840b0,'rows':_0x5689e7}:null;}})[_0xd367('0x25')](respondWithResult(_0x5df2b1,null))['catch'](handleError(_0x5df2b1,null));};exports[_0xd367('0x4e')]=function(_0x413cec,_0x2a519f,_0xb83b29){var _0x129233={};var _0x31347c={};var _0x2e369c;var _0x36d76f;return db['ZendeskConfiguration'][_0xd367('0x4c')]({'where':{'id':_0x413cec[_0xd367('0x4a')]['id']}})[_0xd367('0x25')](handleEntityNotFound(_0x2a519f,null))[_0xd367('0x25')](function(_0x2cca9a){if(_0x2cca9a){_0x2e369c=_0x2cca9a;_0x31347c[_0xd367('0x31')]=_[_0xd367('0x33')](db['ZendeskField'][_0xd367('0x2e')]);_0x31347c[_0xd367('0x32')]=_[_0xd367('0x33')](_0x413cec[_0xd367('0x32')]);_0x31347c['filters']=_[_0xd367('0x35')](_0x31347c[_0xd367('0x31')],_0x31347c[_0xd367('0x32')]);_0x129233[_0xd367('0x37')]=_[_0xd367('0x35')](_0x31347c[_0xd367('0x31')],qs[_0xd367('0x36')](_0x413cec['query'][_0xd367('0x36')]));_0x129233['attributes']=_0x129233[_0xd367('0x37')][_0xd367('0x38')]?_0x129233[_0xd367('0x37')]:_0x31347c['model'];_0x129233[_0xd367('0x3b')]=qs[_0xd367('0x3c')](_0x413cec[_0xd367('0x32')]['sort']);_0x129233['where']=qs[_0xd367('0x34')](_[_0xd367('0x3e')](_0x413cec[_0xd367('0x32')],_0x31347c['filters']));if(_0x413cec[_0xd367('0x32')][_0xd367('0x3f')]){_0x129233['where']=_[_0xd367('0x40')](_0x129233[_0xd367('0x3d')],{'$or':_[_0xd367('0x2c')](_0x129233[_0xd367('0x37')],function(_0x2ee66c){var _0x23bd01={};_0x23bd01[_0x2ee66c]={'$like':'%'+_0x413cec[_0xd367('0x32')][_0xd367('0x3f')]+'%'};return _0x23bd01;})});}_0x129233=_[_0xd367('0x40')]({},_0x129233,_0x413cec[_0xd367('0x41')]);return _0x2e369c['getSubjects'](_0x129233);}})[_0xd367('0x25')](function(_0x5b2aa6){if(_0x5b2aa6){_0x36d76f=_0x5b2aa6[_0xd367('0x38')];if(!_0x413cec[_0xd367('0x32')]['hasOwnProperty']('nolimit')){_0x129233[_0xd367('0x1d')]=qs[_0xd367('0x1d')](_0x413cec[_0xd367('0x32')][_0xd367('0x1d')]);_0x129233[_0xd367('0x1b')]=qs[_0xd367('0x1b')](_0x413cec[_0xd367('0x32')][_0xd367('0x1b')]);}return _0x2e369c['getSubjects'](_0x129233);}})[_0xd367('0x25')](function(_0x40efb1){if(_0x40efb1){return _0x40efb1?{'count':_0x36d76f,'rows':_0x40efb1}:null;}})['then'](respondWithResult(_0x2a519f,null))[_0xd367('0x45')](handleError(_0x2a519f,null));};exports[_0xd367('0x4f')]=function(_0x24ce4b,_0x136267,_0x294058){var _0x38f130={};var _0x586a33={};var _0x419c2e;var _0x2fb994;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x24ce4b[_0xd367('0x4a')]['id']}})[_0xd367('0x25')](handleEntityNotFound(_0x136267,null))[_0xd367('0x25')](function(_0x1ef26e){if(_0x1ef26e){_0x419c2e=_0x1ef26e;_0x586a33[_0xd367('0x31')]=_[_0xd367('0x33')](db[_0xd367('0x4d')]['rawAttributes']);_0x586a33['query']=_['keys'](_0x24ce4b[_0xd367('0x32')]);_0x586a33[_0xd367('0x34')]=_['intersection'](_0x586a33['model'],_0x586a33[_0xd367('0x32')]);_0x38f130[_0xd367('0x37')]=_['intersection'](_0x586a33[_0xd367('0x31')],qs[_0xd367('0x36')](_0x24ce4b[_0xd367('0x32')]['fields']));_0x38f130[_0xd367('0x37')]=_0x38f130[_0xd367('0x37')][_0xd367('0x38')]?_0x38f130[_0xd367('0x37')]:_0x586a33[_0xd367('0x31')];_0x38f130[_0xd367('0x3b')]=qs[_0xd367('0x3c')](_0x24ce4b[_0xd367('0x32')][_0xd367('0x3c')]);_0x38f130['where']=qs[_0xd367('0x34')](_['pick'](_0x24ce4b['query'],_0x586a33[_0xd367('0x34')]));if(_0x24ce4b[_0xd367('0x32')][_0xd367('0x3f')]){_0x38f130['where']=_[_0xd367('0x40')](_0x38f130[_0xd367('0x3d')],{'$or':_[_0xd367('0x2c')](_0x38f130[_0xd367('0x37')],function(_0x3d5076){var _0x39f84b={};_0x39f84b[_0x3d5076]={'$like':'%'+_0x24ce4b[_0xd367('0x32')][_0xd367('0x3f')]+'%'};return _0x39f84b;})});}_0x38f130=_['merge']({},_0x38f130,_0x24ce4b['options']);return _0x419c2e[_0xd367('0x4f')](_0x38f130);}})[_0xd367('0x25')](function(_0x1dbfa0){if(_0x1dbfa0){_0x2fb994=_0x1dbfa0[_0xd367('0x38')];if(!_0x24ce4b[_0xd367('0x32')][_0xd367('0x39')](_0xd367('0x3a'))){_0x38f130[_0xd367('0x1d')]=qs[_0xd367('0x1d')](_0x24ce4b[_0xd367('0x32')]['limit']);_0x38f130[_0xd367('0x1b')]=qs[_0xd367('0x1b')](_0x24ce4b[_0xd367('0x32')]['offset']);}return _0x419c2e[_0xd367('0x4f')](_0x38f130);}})['then'](function(_0x36d6a5){if(_0x36d6a5){return _0x36d6a5?{'count':_0x2fb994,'rows':_0x36d6a5}:null;}})['then'](respondWithResult(_0x136267,null))['catch'](handleError(_0x136267,null));};exports['getTags']=function(_0x38c88f,_0x514b63,_0xaf2f6e){var _0x3e0b05={};var _0x82698e={};var _0x4a3a99;var _0x18be2f;return db['ZendeskConfiguration'][_0xd367('0x4c')]({'where':{'id':_0x38c88f[_0xd367('0x4a')]['id']}})[_0xd367('0x25')](handleEntityNotFound(_0x514b63,null))[_0xd367('0x25')](function(_0x5759a){if(_0x5759a){_0x4a3a99=_0x5759a;_0x82698e['model']=_['keys'](db[_0xd367('0x50')][_0xd367('0x2e')]);_0x82698e[_0xd367('0x32')]=_[_0xd367('0x33')](_0x38c88f[_0xd367('0x32')]);_0x82698e[_0xd367('0x34')]=_[_0xd367('0x35')](_0x82698e[_0xd367('0x31')],_0x82698e[_0xd367('0x32')]);_0x3e0b05[_0xd367('0x37')]=_[_0xd367('0x35')](_0x82698e[_0xd367('0x31')],qs[_0xd367('0x36')](_0x38c88f[_0xd367('0x32')][_0xd367('0x36')]));_0x3e0b05['attributes']=_0x3e0b05[_0xd367('0x37')]['length']?_0x3e0b05[_0xd367('0x37')]:_0x82698e[_0xd367('0x31')];_0x3e0b05[_0xd367('0x3b')]=qs['sort'](_0x38c88f['query'][_0xd367('0x3c')]);_0x3e0b05[_0xd367('0x3d')]=qs[_0xd367('0x34')](_[_0xd367('0x3e')](_0x38c88f[_0xd367('0x32')],_0x82698e[_0xd367('0x34')]));if(_0x38c88f['query']['filter']){_0x3e0b05['where']=_[_0xd367('0x40')](_0x3e0b05['where'],{'$or':_[_0xd367('0x2c')](_0x3e0b05[_0xd367('0x37')],function(_0x1d26ce){var _0x383a59={};_0x383a59[_0x1d26ce]={'$like':'%'+_0x38c88f[_0xd367('0x32')][_0xd367('0x3f')]+'%'};return _0x383a59;})});}_0x3e0b05=_[_0xd367('0x40')]({},_0x3e0b05,_0x38c88f[_0xd367('0x41')]);return _0x4a3a99[_0xd367('0x51')](_0x3e0b05);}})[_0xd367('0x25')](function(_0x2d180a){if(_0x2d180a){_0x18be2f=_0x2d180a[_0xd367('0x38')];if(!_0x38c88f[_0xd367('0x32')][_0xd367('0x39')](_0xd367('0x3a'))){_0x3e0b05[_0xd367('0x1d')]=qs[_0xd367('0x1d')](_0x38c88f['query'][_0xd367('0x1d')]);_0x3e0b05[_0xd367('0x1b')]=qs[_0xd367('0x1b')](_0x38c88f['query'][_0xd367('0x1b')]);}return _0x4a3a99['getTags'](_0x3e0b05);}})[_0xd367('0x25')](function(_0x21036a){if(_0x21036a){return _0x21036a?{'count':_0x18be2f,'rows':_0x21036a}:null;}})[_0xd367('0x25')](respondWithResult(_0x514b63,null))[_0xd367('0x45')](handleError(_0x514b63,null));};exports[_0xd367('0x52')]=function(_0x5dd326,_0x3ce3e5,_0x4eec8c){if(_0x5dd326[_0xd367('0x48')]['id']){delete _0x5dd326['body']['id'];}return db['ZendeskConfiguration'][_0xd367('0x4c')]({'where':{'id':_0x5dd326[_0xd367('0x4a')]['id']}})[_0xd367('0x25')](handleEntityNotFound(_0x3ce3e5,null))[_0xd367('0x25')](function(_0x55aaa7){if(_0x55aaa7){return _0x55aaa7['setTags'](_0x5dd326[_0xd367('0x48')][_0xd367('0x53')]||[]);}return null;})[_0xd367('0x25')](respondWithResult(_0x3ce3e5,null))['catch'](handleError(_0x3ce3e5,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index bea0f6e..31b6c82 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 _0xdb94=['lodash','util','../../config/logger','api','moment','request-promise','path','./intZendeskConfiguration.attributes','ZendeskConfiguration'];(function(_0x4aacc7,_0x3e3ea7){var _0x2758ea=function(_0x5ad1b3){while(--_0x5ad1b3){_0x4aacc7['push'](_0x4aacc7['shift']());}};_0x2758ea(++_0x3e3ea7);}(_0xdb94,0xab));var _0x4db9=function(_0x17d96b,_0x346ba7){_0x17d96b=_0x17d96b-0x0;var _0x949d6f=_0xdb94[_0x17d96b];return _0x949d6f;};'use strict';var _=require(_0x4db9('0x0'));var util=require(_0x4db9('0x1'));var logger=require(_0x4db9('0x2'))(_0x4db9('0x3'));var moment=require(_0x4db9('0x4'));var BPromise=require('bluebird');var rp=require(_0x4db9('0x5'));var fs=require('fs');var path=require(_0x4db9('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4db9('0x7'));module['exports']=function(_0x47a3f5,_0x31dd9f){return _0x47a3f5['define'](_0x4db9('0x8'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab40=['rimraf','../../config/environment','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','bluebird','request-promise','path'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xab40,0xcd));var _0x0ab4=function(_0x390bc4,_0x4262a3){_0x390bc4=_0x390bc4-0x0;var _0x3daa6b=_0xab40[_0x390bc4];return _0x3daa6b;};'use strict';var _=require(_0x0ab4('0x0'));var util=require(_0x0ab4('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0ab4('0x2'));var rp=require(_0x0ab4('0x3'));var fs=require('fs');var path=require(_0x0ab4('0x4'));var rimraf=require(_0x0ab4('0x5'));var config=require(_0x0ab4('0x6'));var attributes=require('./intZendeskConfiguration.attributes');module['exports']=function(_0x28b17a,_0x4ba9d2){return _0x28b17a[_0x0ab4('0x7')](_0x0ab4('0x8'),attributes,{'tableName':_0x0ab4('0x9'),'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 36f7c8c..1d2252e 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 _0x5e5d=['ZendeskConfiguration,\x20%s,\x20%s','message','catch','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x36a204,_0x286bde){var _0x2a95a9=function(_0x4eea48){while(--_0x4eea48){_0x36a204['push'](_0x36a204['shift']());}};_0x2a95a9(++_0x286bde);}(_0x5e5d,0x1bb));var _0xd5e5=function(_0x16756f,_0xee4f17){_0x16756f=_0x16756f-0x0;var _0x4942ec=_0x5e5d[_0x16756f];return _0x4942ec;};'use strict';var _=require(_0xd5e5('0x0'));var util=require(_0xd5e5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd5e5('0x2'));var fs=require('fs');var Redis=require(_0xd5e5('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd5e5('0x4'))(_0xd5e5('0x5'));var config=require(_0xd5e5('0x6'));var jayson=require(_0xd5e5('0x7'));var client=jayson[_0xd5e5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36c57b,_0x238f4a,_0x3745f8){return new BPromise(function(_0x4f9ab8,_0xf8b1f1){return client[_0xd5e5('0x9')](_0x36c57b,_0x3745f8)[_0xd5e5('0xa')](function(_0x3d245a){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x238f4a,_0xd5e5('0xb'));logger[_0xd5e5('0xc')](_0xd5e5('0xd'),_0x238f4a,'request\x20sent',JSON[_0xd5e5('0xe')](_0x3d245a));if(_0x3d245a['error']){if(_0x3d245a[_0xd5e5('0xf')][_0xd5e5('0x10')]===0x1f4){logger[_0xd5e5('0xf')](_0xd5e5('0x11'),_0x238f4a,_0x3d245a[_0xd5e5('0xf')]['message']);return _0xf8b1f1(_0x3d245a[_0xd5e5('0xf')]['message']);}logger['error'](_0xd5e5('0x11'),_0x238f4a,_0x3d245a['error']['message']);return _0x4f9ab8(_0x3d245a[_0xd5e5('0xf')]['message']);}else{logger['info'](_0xd5e5('0x11'),_0x238f4a,_0xd5e5('0xb'));_0x4f9ab8(_0x3d245a['result'][_0xd5e5('0x12')]);}})[_0xd5e5('0x13')](function(_0x153997){logger[_0xd5e5('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x238f4a,_0x153997);_0xf8b1f1(_0x153997);});});} \ No newline at end of file +var _0x7615=['moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x2ae03a,_0x1674ed){var _0x464453=function(_0x45e7e1){while(--_0x45e7e1){_0x2ae03a['push'](_0x2ae03a['shift']());}};_0x464453(++_0x1674ed);}(_0x7615,0x14f));var _0x5761=function(_0x6d6a66,_0x2924af){_0x6d6a66=_0x6d6a66-0x0;var _0x11eb6e=_0x7615[_0x6d6a66];return _0x11eb6e;};'use strict';var _=require('lodash');var util=require(_0x5761('0x0'));var moment=require(_0x5761('0x1'));var BPromise=require(_0x5761('0x2'));var rs=require(_0x5761('0x3'));var fs=require('fs');var Redis=require(_0x5761('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5761('0x5'));var logger=require('../../config/logger')(_0x5761('0x6'));var config=require(_0x5761('0x7'));var jayson=require(_0x5761('0x8'));var client=jayson[_0x5761('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a0e68,_0x354c24,_0x55a5ab){return new BPromise(function(_0x5847f4,_0x1c1ada){return client[_0x5761('0xa')](_0x5a0e68,_0x55a5ab)['then'](function(_0x167824){logger['info'](_0x5761('0xb'),_0x354c24,_0x5761('0xc'));logger[_0x5761('0xd')](_0x5761('0xe'),_0x354c24,_0x5761('0xc'),JSON[_0x5761('0xf')](_0x167824));if(_0x167824[_0x5761('0x10')]){if(_0x167824['error'][_0x5761('0x11')]===0x1f4){logger[_0x5761('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x354c24,_0x167824[_0x5761('0x10')]['message']);return _0x1c1ada(_0x167824['error'][_0x5761('0x12')]);}logger[_0x5761('0x10')](_0x5761('0xb'),_0x354c24,_0x167824[_0x5761('0x10')][_0x5761('0x12')]);return _0x5847f4(_0x167824[_0x5761('0x10')][_0x5761('0x12')]);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x354c24,'request\x20sent');_0x5847f4(_0x167824[_0x5761('0x13')][_0x5761('0x12')]);}})[_0x5761('0x14')](function(_0x366acb){logger[_0x5761('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x354c24,_0x366acb);_0x1c1ada(_0x366acb);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index ffeaf00..aee4e09 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 _0x2250=['create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x28237e,_0x2a7f11){var _0x1c014b=function(_0xaa0d6d){while(--_0xaa0d6d){_0x28237e['push'](_0x28237e['shift']());}};_0x1c014b(++_0x2a7f11);}(_0x2250,0xec));var _0x0225=function(_0x44ae0b,_0x3e9865){_0x44ae0b=_0x44ae0b-0x0;var _0x69232a=_0x2250[_0x44ae0b];return _0x69232a;};'use strict';var multer=require(_0x0225('0x0'));var util=require(_0x0225('0x1'));var path=require(_0x0225('0x2'));var timeout=require(_0x0225('0x3'));var express=require(_0x0225('0x4'));var router=express[_0x0225('0x5')]();var fs_extra=require(_0x0225('0x6'));var auth=require(_0x0225('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x0225('0x8'));var controller=require(_0x0225('0x9'));router[_0x0225('0xa')]('/',auth[_0x0225('0xb')](),controller[_0x0225('0xc')]);router['get'](_0x0225('0xd'),auth[_0x0225('0xb')](),controller[_0x0225('0xe')]);router[_0x0225('0xf')]('/',auth['isAuthenticated'](),controller[_0x0225('0x10')]);router[_0x0225('0x11')]('/:id',auth[_0x0225('0xb')](),controller[_0x0225('0x12')]);router['delete'](_0x0225('0xd'),auth[_0x0225('0xb')](),controller[_0x0225('0x13')]);module[_0x0225('0x14')]=router; \ No newline at end of file +var _0xf8b6=['get','isAuthenticated','index','post','create','put','update','delete','/:id','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller'];(function(_0x541ea6,_0x51cab6){var _0x3c3e84=function(_0xc06bed){while(--_0xc06bed){_0x541ea6['push'](_0x541ea6['shift']());}};_0x3c3e84(++_0x51cab6);}(_0xf8b6,0x1d7));var _0x6f8b=function(_0x5275b0,_0x4718b2){_0x5275b0=_0x5275b0-0x0;var _0x3170fa=_0xf8b6[_0x5275b0];return _0x3170fa;};'use strict';var multer=require('multer');var util=require(_0x6f8b('0x0'));var path=require(_0x6f8b('0x1'));var timeout=require(_0x6f8b('0x2'));var express=require('express');var router=express[_0x6f8b('0x3')]();var fs_extra=require(_0x6f8b('0x4'));var auth=require(_0x6f8b('0x5'));var interaction=require(_0x6f8b('0x6'));var config=require(_0x6f8b('0x7'));var controller=require(_0x6f8b('0x8'));router[_0x6f8b('0x9')]('/',auth[_0x6f8b('0xa')](),controller[_0x6f8b('0xb')]);router[_0x6f8b('0x9')]('/:id',auth[_0x6f8b('0xa')](),controller['show']);router[_0x6f8b('0xc')]('/',auth['isAuthenticated'](),controller[_0x6f8b('0xd')]);router[_0x6f8b('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x6f8b('0xf')]);router[_0x6f8b('0x10')](_0x6f8b('0x11'),auth[_0x6f8b('0xa')](),controller[_0x6f8b('0x12')]);module[_0x6f8b('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 7bb7735..4054816 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 _0x3a84=['STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','variable','keyValue','picklist','string'];(function(_0x5d365d,_0x479ca2){var _0x220ba4=function(_0x36e328){while(--_0x36e328){_0x5d365d['push'](_0x5d365d['shift']());}};_0x220ba4(++_0x479ca2);}(_0x3a84,0x12f));var _0x43a8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a84[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x43a8('0x0'));module[_0x43a8('0x1')]={'type':{'type':Sequelize[_0x43a8('0x2')]('string',_0x43a8('0x3'),'customVariable',_0x43a8('0x4'),_0x43a8('0x5')),'defaultValue':_0x43a8('0x6')},'content':{'type':Sequelize[_0x43a8('0x7')]},'key':{'type':Sequelize[_0x43a8('0x7')]},'keyType':{'type':Sequelize[_0x43a8('0x2')](_0x43a8('0x6'),_0x43a8('0x3'),_0x43a8('0x8'))},'keyContent':{'type':Sequelize[_0x43a8('0x7')]},'idField':{'type':Sequelize[_0x43a8('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x43a8('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x43a8('0x7')]}}; \ No newline at end of file +var _0x2f69=['sequelize','exports','string','keyValue','picklist','STRING','ENUM'];(function(_0x12c764,_0x2a4393){var _0x2fac9f=function(_0x2b979f){while(--_0x2b979f){_0x12c764['push'](_0x12c764['shift']());}};_0x2fac9f(++_0x2a4393);}(_0x2f69,0x157));var _0x92f6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2f69[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x92f6('0x0'));module[_0x92f6('0x1')]={'type':{'type':Sequelize['ENUM'](_0x92f6('0x2'),'variable','customVariable',_0x92f6('0x3'),_0x92f6('0x4')),'defaultValue':_0x92f6('0x2')},'content':{'type':Sequelize[_0x92f6('0x5')]},'key':{'type':Sequelize[_0x92f6('0x5')]},'keyType':{'type':Sequelize[_0x92f6('0x6')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x92f6('0x5')]},'idField':{'type':Sequelize[_0x92f6('0x5')]},'nameField':{'type':Sequelize[_0x92f6('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x92f6('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 8f66ca8..f5af0cf 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 _0x9ef1=['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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','name','send','ZendeskField','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','then','includeAll','include','findAll','rows','show','params','options','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','squel','crypto','jsforce'];(function(_0x40e3f7,_0x361929){var _0x457173=function(_0x5d8158){while(--_0x5d8158){_0x40e3f7['push'](_0x40e3f7['shift']());}};_0x457173(++_0x361929);}(_0x9ef1,0x1b4));var _0x19ef=function(_0x4c9858,_0x1c1118){_0x4c9858=_0x4c9858-0x0;var _0x3dbcb3=_0x9ef1[_0x4c9858];return _0x3dbcb3;};'use strict';var emlformat=require(_0x19ef('0x0'));var rimraf=require(_0x19ef('0x1'));var zipdir=require(_0x19ef('0x2'));var jsonpatch=require(_0x19ef('0x3'));var rp=require(_0x19ef('0x4'));var moment=require(_0x19ef('0x5'));var BPromise=require(_0x19ef('0x6'));var Mustache=require(_0x19ef('0x7'));var util=require(_0x19ef('0x8'));var path=require(_0x19ef('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x19ef('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x19ef('0xb'));var crypto=require(_0x19ef('0xc'));var jsforce=require(_0x19ef('0xd'));var deskjs=require(_0x19ef('0xe'));var toCsv=require(_0x19ef('0xf'));var querystring=require(_0x19ef('0x10'));var Papa=require(_0x19ef('0x11'));var Redis=require(_0x19ef('0x12'));var authService=require(_0x19ef('0x13'));var qs=require(_0x19ef('0x14'));var as=require(_0x19ef('0x15'));var hardwareService=require(_0x19ef('0x16'));var logger=require(_0x19ef('0x17'))(_0x19ef('0x18'));var utils=require(_0x19ef('0x19'));var config=require(_0x19ef('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x19ef('0x1b'))['db'];function respondWithStatusCode(_0x2a3187,_0x2eb849){_0x2eb849=_0x2eb849||0xcc;return function(_0x4c5cab){if(_0x4c5cab){return _0x2a3187[_0x19ef('0x1c')](_0x2eb849);}return _0x2a3187[_0x19ef('0x1d')](_0x2eb849)[_0x19ef('0x1e')]();};}function respondWithResult(_0x5dfbe9,_0x36804e){_0x36804e=_0x36804e||0xc8;return function(_0x4b9aba){if(_0x4b9aba){return _0x5dfbe9['status'](_0x36804e)[_0x19ef('0x1f')](_0x4b9aba);}};}function respondWithFilteredResult(_0x5b7a48,_0x171638){return function(_0x2bc7c1){if(_0x2bc7c1){var _0x5df50d=typeof _0x171638[_0x19ef('0x20')]===_0x19ef('0x21')&&typeof _0x171638[_0x19ef('0x22')]===_0x19ef('0x21');var _0x3c93e0=_0x2bc7c1[_0x19ef('0x23')];var _0x29ea78=_0x5df50d?0x0:_0x171638['offset'];var _0x184691=_0x5df50d?_0x2bc7c1[_0x19ef('0x23')]:_0x171638[_0x19ef('0x20')]+_0x171638[_0x19ef('0x22')];var _0x321152;if(_0x184691>=_0x3c93e0){_0x184691=_0x3c93e0;_0x321152=0xc8;}else{_0x321152=0xce;}_0x5b7a48[_0x19ef('0x1d')](_0x321152);return _0x5b7a48[_0x19ef('0x24')]('Content-Range',_0x29ea78+'-'+_0x184691+'/'+_0x3c93e0)[_0x19ef('0x1f')](_0x2bc7c1);}return null;};}function patchUpdates(_0x51317d){return function(_0x87a2d9){try{jsonpatch[_0x19ef('0x25')](_0x87a2d9,_0x51317d,!![]);}catch(_0x4129e2){return BPromise[_0x19ef('0x26')](_0x4129e2);}return _0x87a2d9[_0x19ef('0x27')]();};}function saveUpdates(_0x4bbc8d,_0x4e6d5a){return function(_0xf76242){if(_0xf76242){return _0xf76242[_0x19ef('0x28')](_0x4bbc8d)['then'](function(_0x35cbc2){return _0x35cbc2;});}return null;};}function removeEntity(_0x159e6d,_0x31a915){return function(_0x26abbf){if(_0x26abbf){return _0x26abbf[_0x19ef('0x29')]()['then'](function(){_0x159e6d[_0x19ef('0x1d')](0xcc)[_0x19ef('0x1e')]();});}};}function handleEntityNotFound(_0x558c31,_0x215991){return function(_0x2899e3){if(!_0x2899e3){_0x558c31[_0x19ef('0x1c')](0x194);}return _0x2899e3;};}function handleError(_0x2fe0fd,_0x4eca1b){_0x4eca1b=_0x4eca1b||0x1f4;return function(_0x262085){logger['error'](_0x262085['stack']);if(_0x262085[_0x19ef('0x2a')]){delete _0x262085[_0x19ef('0x2a')];}_0x2fe0fd['status'](_0x4eca1b)[_0x19ef('0x2b')](_0x262085);};}exports['index']=function(_0x3d8e81,_0x3c26b1){var _0x4b5fd2={},_0x17ffe5={},_0x510750={'count':0x0,'rows':[]};var _0x9719e0=_['map'](db[_0x19ef('0x2c')][_0x19ef('0x2d')],function(_0x52efdb){return{'name':_0x52efdb['fieldName'],'type':_0x52efdb[_0x19ef('0x2e')][_0x19ef('0x2f')]};});_0x17ffe5[_0x19ef('0x30')]=_[_0x19ef('0x31')](_0x9719e0,_0x19ef('0x2a'));_0x17ffe5[_0x19ef('0x32')]=_[_0x19ef('0x33')](_0x3d8e81[_0x19ef('0x32')]);_0x17ffe5[_0x19ef('0x34')]=_[_0x19ef('0x35')](_0x17ffe5['model'],_0x17ffe5[_0x19ef('0x32')]);_0x4b5fd2[_0x19ef('0x36')]=_[_0x19ef('0x35')](_0x17ffe5['model'],qs[_0x19ef('0x37')](_0x3d8e81['query'][_0x19ef('0x37')]));_0x4b5fd2[_0x19ef('0x36')]=_0x4b5fd2[_0x19ef('0x36')][_0x19ef('0x38')]?_0x4b5fd2[_0x19ef('0x36')]:_0x17ffe5[_0x19ef('0x30')];if(!_0x3d8e81[_0x19ef('0x32')][_0x19ef('0x39')](_0x19ef('0x3a'))){_0x4b5fd2['limit']=qs[_0x19ef('0x22')](_0x3d8e81[_0x19ef('0x32')][_0x19ef('0x22')]);_0x4b5fd2[_0x19ef('0x20')]=qs[_0x19ef('0x20')](_0x3d8e81[_0x19ef('0x32')][_0x19ef('0x20')]);}_0x4b5fd2[_0x19ef('0x3b')]=qs[_0x19ef('0x3c')](_0x3d8e81[_0x19ef('0x32')][_0x19ef('0x3c')]);_0x4b5fd2['where']=qs[_0x19ef('0x34')](_['pick'](_0x3d8e81[_0x19ef('0x32')],_0x17ffe5[_0x19ef('0x34')]),_0x9719e0);if(_0x3d8e81[_0x19ef('0x32')][_0x19ef('0x3d')]){_0x4b5fd2[_0x19ef('0x3e')]=_[_0x19ef('0x3f')](_0x4b5fd2['where'],{'$or':_[_0x19ef('0x31')](_0x9719e0,function(_0x147bee){if(_0x147bee['type']!=='VIRTUAL'){var _0x13b98a={};_0x13b98a[_0x147bee['name']]={'$like':'%'+_0x3d8e81['query'][_0x19ef('0x3d')]+'%'};return _0x13b98a;}})});}_0x4b5fd2=_['merge']({},_0x4b5fd2,_0x3d8e81['options']);var _0x321e98={'where':_0x4b5fd2[_0x19ef('0x3e')]};return db['ZendeskField'][_0x19ef('0x23')](_0x321e98)[_0x19ef('0x40')](function(_0x4c0a10){_0x510750[_0x19ef('0x23')]=_0x4c0a10;if(_0x3d8e81[_0x19ef('0x32')][_0x19ef('0x41')]){_0x4b5fd2[_0x19ef('0x42')]=[{'all':!![]}];}return db[_0x19ef('0x2c')][_0x19ef('0x43')](_0x4b5fd2);})[_0x19ef('0x40')](function(_0x410e73){_0x510750[_0x19ef('0x44')]=_0x410e73;return _0x510750;})[_0x19ef('0x40')](respondWithFilteredResult(_0x3c26b1,_0x4b5fd2))['catch'](handleError(_0x3c26b1,null));};exports[_0x19ef('0x45')]=function(_0xca1105,_0x7b44e1){var _0x157a91={'raw':!![],'where':{'id':_0xca1105[_0x19ef('0x46')]['id']}},_0x12463d={};_0x12463d[_0x19ef('0x30')]=_[_0x19ef('0x33')](db[_0x19ef('0x2c')]['rawAttributes']);_0x12463d[_0x19ef('0x32')]=_['keys'](_0xca1105[_0x19ef('0x32')]);_0x12463d['filters']=_['intersection'](_0x12463d[_0x19ef('0x30')],_0x12463d[_0x19ef('0x32')]);_0x157a91[_0x19ef('0x36')]=_['intersection'](_0x12463d[_0x19ef('0x30')],qs['fields'](_0xca1105[_0x19ef('0x32')]['fields']));_0x157a91[_0x19ef('0x36')]=_0x157a91[_0x19ef('0x36')][_0x19ef('0x38')]?_0x157a91[_0x19ef('0x36')]:_0x12463d[_0x19ef('0x30')];if(_0xca1105[_0x19ef('0x32')]['includeAll']){_0x157a91[_0x19ef('0x42')]=[{'all':!![]}];}_0x157a91=_[_0x19ef('0x3f')]({},_0x157a91,_0xca1105[_0x19ef('0x47')]);return db[_0x19ef('0x2c')][_0x19ef('0x48')](_0x157a91)[_0x19ef('0x40')](handleEntityNotFound(_0x7b44e1,null))['then'](respondWithResult(_0x7b44e1,null))[_0x19ef('0x49')](handleError(_0x7b44e1,null));};exports['create']=function(_0x8879d5,_0x3c591e){return db[_0x19ef('0x2c')]['create'](_0x8879d5[_0x19ef('0x4a')],{})[_0x19ef('0x40')](respondWithResult(_0x3c591e,0xc9))[_0x19ef('0x49')](handleError(_0x3c591e,null));};exports['update']=function(_0x365e9d,_0x491377){if(_0x365e9d[_0x19ef('0x4a')]['id']){delete _0x365e9d[_0x19ef('0x4a')]['id'];}return db[_0x19ef('0x2c')]['find']({'where':{'id':_0x365e9d[_0x19ef('0x46')]['id']}})['then'](handleEntityNotFound(_0x491377,null))[_0x19ef('0x40')](saveUpdates(_0x365e9d['body'],null))[_0x19ef('0x40')](respondWithResult(_0x491377,null))[_0x19ef('0x49')](handleError(_0x491377,null));};exports['destroy']=function(_0x4ae674,_0x2da5ff){return db[_0x19ef('0x2c')][_0x19ef('0x48')]({'where':{'id':_0x4ae674[_0x19ef('0x46')]['id']}})[_0x19ef('0x40')](handleEntityNotFound(_0x2da5ff,null))['then'](removeEntity(_0x2da5ff,null))[_0x19ef('0x49')](handleError(_0x2da5ff,null));}; \ No newline at end of file +var _0x752f=['then','error','stack','name','send','index','ZendeskField','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','catch','create','body','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','end','status','offset','count','set','json','apply','save'];(function(_0x510354,_0x56cf30){var _0x1ab274=function(_0x455f7c){while(--_0x455f7c){_0x510354['push'](_0x510354['shift']());}};_0x1ab274(++_0x56cf30);}(_0x752f,0x6a));var _0xf752=function(_0x27b92a,_0x4e9aa5){_0x27b92a=_0x27b92a-0x0;var _0x2c5e24=_0x752f[_0x27b92a];return _0x2c5e24;};'use strict';var emlformat=require(_0xf752('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf752('0x1'));var rp=require(_0xf752('0x2'));var moment=require(_0xf752('0x3'));var BPromise=require(_0xf752('0x4'));var Mustache=require(_0xf752('0x5'));var util=require('util');var path=require('path');var sox=require(_0xf752('0x6'));var csv=require('to-csv');var ejs=require(_0xf752('0x7'));var fs=require('fs');var fs_extra=require(_0xf752('0x8'));var _=require(_0xf752('0x9'));var squel=require(_0xf752('0xa'));var crypto=require(_0xf752('0xb'));var jsforce=require(_0xf752('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf752('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf752('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf752('0xf'));var logger=require('../../config/logger')(_0xf752('0x10'));var utils=require(_0xf752('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xf752('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x582871,_0x5df0c1){_0x5df0c1=_0x5df0c1||0xcc;return function(_0xae3b55){if(_0xae3b55){return _0x582871[_0xf752('0x13')](_0x5df0c1);}return _0x582871['status'](_0x5df0c1)[_0xf752('0x14')]();};}function respondWithResult(_0x4ba961,_0x4e6f86){_0x4e6f86=_0x4e6f86||0xc8;return function(_0x346f94){if(_0x346f94){return _0x4ba961[_0xf752('0x15')](_0x4e6f86)['json'](_0x346f94);}};}function respondWithFilteredResult(_0x22ba53,_0x27df27){return function(_0x27b236){if(_0x27b236){var _0x8420de=typeof _0x27df27[_0xf752('0x16')]==='undefined'&&typeof _0x27df27['limit']==='undefined';var _0x312dec=_0x27b236[_0xf752('0x17')];var _0x222d8e=_0x8420de?0x0:_0x27df27[_0xf752('0x16')];var _0x26e3bc=_0x8420de?_0x27b236[_0xf752('0x17')]:_0x27df27['offset']+_0x27df27['limit'];var _0x59f14c;if(_0x26e3bc>=_0x312dec){_0x26e3bc=_0x312dec;_0x59f14c=0xc8;}else{_0x59f14c=0xce;}_0x22ba53['status'](_0x59f14c);return _0x22ba53[_0xf752('0x18')]('Content-Range',_0x222d8e+'-'+_0x26e3bc+'/'+_0x312dec)[_0xf752('0x19')](_0x27b236);}return null;};}function patchUpdates(_0x1a6456){return function(_0x50d3f7){try{jsonpatch[_0xf752('0x1a')](_0x50d3f7,_0x1a6456,!![]);}catch(_0x21c8b5){return BPromise['reject'](_0x21c8b5);}return _0x50d3f7[_0xf752('0x1b')]();};}function saveUpdates(_0x3abc43,_0x4772c4){return function(_0x2f1564){if(_0x2f1564){return _0x2f1564['update'](_0x3abc43)[_0xf752('0x1c')](function(_0x539832){return _0x539832;});}return null;};}function removeEntity(_0x79aae2,_0x24bad3){return function(_0x38f743){if(_0x38f743){return _0x38f743['destroy']()[_0xf752('0x1c')](function(){_0x79aae2[_0xf752('0x15')](0xcc)[_0xf752('0x14')]();});}};}function handleEntityNotFound(_0x2b37f3,_0x18f600){return function(_0x3349f3){if(!_0x3349f3){_0x2b37f3[_0xf752('0x13')](0x194);}return _0x3349f3;};}function handleError(_0x47fbe1,_0x4be999){_0x4be999=_0x4be999||0x1f4;return function(_0x4a7059){logger[_0xf752('0x1d')](_0x4a7059[_0xf752('0x1e')]);if(_0x4a7059['name']){delete _0x4a7059[_0xf752('0x1f')];}_0x47fbe1['status'](_0x4be999)[_0xf752('0x20')](_0x4a7059);};}exports[_0xf752('0x21')]=function(_0x45085c,_0x501e61){var _0x1fbd02={},_0x4a3550={},_0x1f5992={'count':0x0,'rows':[]};var _0x39a4a2=_['map'](db[_0xf752('0x22')][_0xf752('0x23')],function(_0x387fae){return{'name':_0x387fae['fieldName'],'type':_0x387fae[_0xf752('0x24')][_0xf752('0x25')]};});_0x4a3550[_0xf752('0x26')]=_[_0xf752('0x27')](_0x39a4a2,'name');_0x4a3550[_0xf752('0x28')]=_[_0xf752('0x29')](_0x45085c[_0xf752('0x28')]);_0x4a3550[_0xf752('0x2a')]=_[_0xf752('0x2b')](_0x4a3550[_0xf752('0x26')],_0x4a3550[_0xf752('0x28')]);_0x1fbd02[_0xf752('0x2c')]=_['intersection'](_0x4a3550['model'],qs[_0xf752('0x2d')](_0x45085c[_0xf752('0x28')]['fields']));_0x1fbd02[_0xf752('0x2c')]=_0x1fbd02[_0xf752('0x2c')][_0xf752('0x2e')]?_0x1fbd02[_0xf752('0x2c')]:_0x4a3550['model'];if(!_0x45085c[_0xf752('0x28')][_0xf752('0x2f')](_0xf752('0x30'))){_0x1fbd02[_0xf752('0x31')]=qs[_0xf752('0x31')](_0x45085c[_0xf752('0x28')][_0xf752('0x31')]);_0x1fbd02[_0xf752('0x16')]=qs['offset'](_0x45085c[_0xf752('0x28')][_0xf752('0x16')]);}_0x1fbd02[_0xf752('0x32')]=qs['sort'](_0x45085c['query'][_0xf752('0x33')]);_0x1fbd02[_0xf752('0x34')]=qs[_0xf752('0x2a')](_[_0xf752('0x35')](_0x45085c['query'],_0x4a3550[_0xf752('0x2a')]),_0x39a4a2);if(_0x45085c[_0xf752('0x28')]['filter']){_0x1fbd02[_0xf752('0x34')]=_[_0xf752('0x36')](_0x1fbd02[_0xf752('0x34')],{'$or':_['map'](_0x39a4a2,function(_0x4ceab4){if(_0x4ceab4[_0xf752('0x24')]!==_0xf752('0x37')){var _0x33a90e={};_0x33a90e[_0x4ceab4[_0xf752('0x1f')]]={'$like':'%'+_0x45085c[_0xf752('0x28')][_0xf752('0x38')]+'%'};return _0x33a90e;}})});}_0x1fbd02=_['merge']({},_0x1fbd02,_0x45085c[_0xf752('0x39')]);var _0x2e9101={'where':_0x1fbd02['where']};return db[_0xf752('0x22')][_0xf752('0x17')](_0x2e9101)[_0xf752('0x1c')](function(_0x4f978f){_0x1f5992[_0xf752('0x17')]=_0x4f978f;if(_0x45085c[_0xf752('0x28')][_0xf752('0x3a')]){_0x1fbd02[_0xf752('0x3b')]=[{'all':!![]}];}return db[_0xf752('0x22')][_0xf752('0x3c')](_0x1fbd02);})[_0xf752('0x1c')](function(_0x18179e){_0x1f5992[_0xf752('0x3d')]=_0x18179e;return _0x1f5992;})[_0xf752('0x1c')](respondWithFilteredResult(_0x501e61,_0x1fbd02))['catch'](handleError(_0x501e61,null));};exports['show']=function(_0x4c8e23,_0x450b15){var _0xdfc0dd={'raw':!![],'where':{'id':_0x4c8e23[_0xf752('0x3e')]['id']}},_0x7c5b3c={};_0x7c5b3c['model']=_['keys'](db['ZendeskField']['rawAttributes']);_0x7c5b3c['query']=_[_0xf752('0x29')](_0x4c8e23['query']);_0x7c5b3c['filters']=_[_0xf752('0x2b')](_0x7c5b3c[_0xf752('0x26')],_0x7c5b3c[_0xf752('0x28')]);_0xdfc0dd[_0xf752('0x2c')]=_[_0xf752('0x2b')](_0x7c5b3c[_0xf752('0x26')],qs[_0xf752('0x2d')](_0x4c8e23[_0xf752('0x28')]['fields']));_0xdfc0dd[_0xf752('0x2c')]=_0xdfc0dd[_0xf752('0x2c')][_0xf752('0x2e')]?_0xdfc0dd[_0xf752('0x2c')]:_0x7c5b3c[_0xf752('0x26')];if(_0x4c8e23[_0xf752('0x28')][_0xf752('0x3a')]){_0xdfc0dd[_0xf752('0x3b')]=[{'all':!![]}];}_0xdfc0dd=_[_0xf752('0x36')]({},_0xdfc0dd,_0x4c8e23['options']);return db['ZendeskField']['find'](_0xdfc0dd)[_0xf752('0x1c')](handleEntityNotFound(_0x450b15,null))[_0xf752('0x1c')](respondWithResult(_0x450b15,null))[_0xf752('0x3f')](handleError(_0x450b15,null));};exports['create']=function(_0x5cd54a,_0x483f3e){return db[_0xf752('0x22')][_0xf752('0x40')](_0x5cd54a[_0xf752('0x41')],{})['then'](respondWithResult(_0x483f3e,0xc9))[_0xf752('0x3f')](handleError(_0x483f3e,null));};exports['update']=function(_0x33c462,_0x82e3eb){if(_0x33c462['body']['id']){delete _0x33c462[_0xf752('0x41')]['id'];}return db['ZendeskField']['find']({'where':{'id':_0x33c462['params']['id']}})[_0xf752('0x1c')](handleEntityNotFound(_0x82e3eb,null))['then'](saveUpdates(_0x33c462[_0xf752('0x41')],null))['then'](respondWithResult(_0x82e3eb,null))[_0xf752('0x3f')](handleError(_0x82e3eb,null));};exports[_0xf752('0x42')]=function(_0x21a272,_0x281470){return db[_0xf752('0x22')]['find']({'where':{'id':_0x21a272[_0xf752('0x3e')]['id']}})[_0xf752('0x1c')](handleEntityNotFound(_0x281470,null))['then'](removeEntity(_0x281470,null))['catch'](handleError(_0x281470,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 76ed5e8..2d05289 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 _0xb259=['FieldId','lodash','api','bluebird','path','rimraf','../../config/environment','exports','define','ZendeskField','zendesk_unique_index','idField'];(function(_0x4410e8,_0x45a516){var _0x5b7b19=function(_0x228d54){while(--_0x228d54){_0x4410e8['push'](_0x4410e8['shift']());}};_0x5b7b19(++_0x45a516);}(_0xb259,0xc1));var _0x9b25=function(_0x47041d,_0x42153f){_0x47041d=_0x47041d-0x0;var _0x5022bd=_0xb259[_0x47041d];return _0x5022bd;};'use strict';var _=require(_0x9b25('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9b25('0x1'));var moment=require('moment');var BPromise=require(_0x9b25('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9b25('0x3'));var rimraf=require(_0x9b25('0x4'));var config=require(_0x9b25('0x5'));var attributes=require('./intZendeskField.attributes');module[_0x9b25('0x6')]=function(_0xe419d,_0x382add){return _0xe419d[_0x9b25('0x7')](_0x9b25('0x8'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x9b25('0x9'),'fields':[_0x9b25('0xa'),_0x9b25('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x69dd=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','FieldId','lodash','util','../../config/logger'];(function(_0x39ee19,_0x2364b7){var _0x5a359f=function(_0x306c6d){while(--_0x306c6d){_0x39ee19['push'](_0x39ee19['shift']());}};_0x5a359f(++_0x2364b7);}(_0x69dd,0x147));var _0xd69d=function(_0x16da8f,_0x4ddb80){_0x16da8f=_0x16da8f-0x0;var _0xd5dca8=_0x69dd[_0x16da8f];return _0xd5dca8;};'use strict';var _=require(_0xd69d('0x0'));var util=require(_0xd69d('0x1'));var logger=require(_0xd69d('0x2'))(_0xd69d('0x3'));var moment=require(_0xd69d('0x4'));var BPromise=require(_0xd69d('0x5'));var rp=require(_0xd69d('0x6'));var fs=require('fs');var path=require(_0xd69d('0x7'));var rimraf=require(_0xd69d('0x8'));var config=require(_0xd69d('0x9'));var attributes=require(_0xd69d('0xa'));module[_0xd69d('0xb')]=function(_0x42244f,_0x2f506){return _0x42244f[_0xd69d('0xc')](_0xd69d('0xd'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField',_0xd69d('0xe')],'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 e58be2b..288a938 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 _0xf06f=['rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','stringify','error','code','ZendeskField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf06f,0x67));var _0xff06=function(_0x37244c,_0x372877){_0x37244c=_0x37244c-0x0;var _0x445fff=_0xf06f[_0x37244c];return _0x445fff;};'use strict';var _=require(_0xff06('0x0'));var util=require(_0xff06('0x1'));var moment=require(_0xff06('0x2'));var BPromise=require(_0xff06('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff06('0x4'));var db=require(_0xff06('0x5'))['db'];var utils=require(_0xff06('0x6'));var logger=require('../../config/logger')(_0xff06('0x7'));var config=require(_0xff06('0x8'));var jayson=require(_0xff06('0x9'));var client=jayson[_0xff06('0xa')][_0xff06('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3958a4,_0x533261,_0x54cbaa){return new BPromise(function(_0x17f212,_0x455674){return client[_0xff06('0xc')](_0x3958a4,_0x54cbaa)['then'](function(_0x34f1c3){logger[_0xff06('0xd')]('ZendeskField,\x20%s,\x20%s',_0x533261,_0xff06('0xe'));logger['debug']('ZendeskField,\x20%s,\x20%s,\x20%s',_0x533261,_0xff06('0xe'),JSON[_0xff06('0xf')](_0x34f1c3));if(_0x34f1c3[_0xff06('0x10')]){if(_0x34f1c3[_0xff06('0x10')][_0xff06('0x11')]===0x1f4){logger[_0xff06('0x10')](_0xff06('0x12'),_0x533261,_0x34f1c3['error'][_0xff06('0x13')]);return _0x455674(_0x34f1c3[_0xff06('0x10')][_0xff06('0x13')]);}logger['error']('ZendeskField,\x20%s,\x20%s',_0x533261,_0x34f1c3['error'][_0xff06('0x13')]);return _0x17f212(_0x34f1c3[_0xff06('0x10')][_0xff06('0x13')]);}else{logger['info'](_0xff06('0x12'),_0x533261,_0xff06('0xe'));_0x17f212(_0x34f1c3[_0xff06('0x14')][_0xff06('0x13')]);}})[_0xff06('0x15')](function(_0x229130){logger['error']('ZendeskField,\x20%s,\x20%s',_0x533261,_0x229130);_0x455674(_0x229130);});});} \ No newline at end of file +var _0x77d1=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','randomstring'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x77d1,0xf9));var _0x177d=function(_0x385eb1,_0x497a94){_0x385eb1=_0x385eb1-0x0;var _0x5d40eb=_0x77d1[_0x385eb1];return _0x5d40eb;};'use strict';var _=require(_0x177d('0x0'));var util=require(_0x177d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x177d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x177d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x177d('0x4'))('rpc');var config=require(_0x177d('0x5'));var jayson=require(_0x177d('0x6'));var client=jayson[_0x177d('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56b163,_0xeec4de,_0x3875fa){return new BPromise(function(_0x5f2d6a,_0x5e3c11){return client['request'](_0x56b163,_0x3875fa)[_0x177d('0x8')](function(_0x145206){logger[_0x177d('0x9')](_0x177d('0xa'),_0xeec4de,_0x177d('0xb'));logger[_0x177d('0xc')](_0x177d('0xd'),_0xeec4de,_0x177d('0xb'),JSON['stringify'](_0x145206));if(_0x145206['error']){if(_0x145206['error']['code']===0x1f4){logger[_0x177d('0xe')]('ZendeskField,\x20%s,\x20%s',_0xeec4de,_0x145206['error'][_0x177d('0xf')]);return _0x5e3c11(_0x145206[_0x177d('0xe')][_0x177d('0xf')]);}logger[_0x177d('0xe')]('ZendeskField,\x20%s,\x20%s',_0xeec4de,_0x145206[_0x177d('0xe')][_0x177d('0xf')]);return _0x5f2d6a(_0x145206[_0x177d('0xe')]['message']);}else{logger[_0x177d('0x9')](_0x177d('0xa'),_0xeec4de,_0x177d('0xb'));_0x5f2d6a(_0x145206[_0x177d('0x10')][_0x177d('0xf')]);}})[_0x177d('0x11')](function(_0x150d06){logger['error'](_0x177d('0xa'),_0xeec4de,_0x150d06);_0x5e3c11(_0x150d06);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 70f4ef1..22cad9b 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 _0x12bf=['delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','./intZohoAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','update'];(function(_0xc14a52,_0x5b84b9){var _0x2e5227=function(_0x580348){while(--_0x580348){_0xc14a52['push'](_0xc14a52['shift']());}};_0x2e5227(++_0x5b84b9);}(_0x12bf,0x1e7));var _0xf12b=function(_0x3d8288,_0x1060d8){_0x3d8288=_0x3d8288-0x0;var _0x2fca2f=_0x12bf[_0x3d8288];return _0x2fca2f;};'use strict';var multer=require(_0xf12b('0x0'));var util=require(_0xf12b('0x1'));var path=require(_0xf12b('0x2'));var timeout=require('connect-timeout');var express=require(_0xf12b('0x3'));var router=express[_0xf12b('0x4')]();var fs_extra=require(_0xf12b('0x5'));var auth=require(_0xf12b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf12b('0x7'));router[_0xf12b('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf12b('0x8')](_0xf12b('0x9'),auth[_0xf12b('0xa')](),controller[_0xf12b('0xb')]);router['get'](_0xf12b('0xc'),auth[_0xf12b('0xa')](),controller[_0xf12b('0xd')]);router[_0xf12b('0x8')](_0xf12b('0xe'),auth[_0xf12b('0xa')](),controller[_0xf12b('0xf')]);router[_0xf12b('0x10')]('/',auth[_0xf12b('0xa')](),controller[_0xf12b('0x11')]);router[_0xf12b('0x10')](_0xf12b('0xc'),auth[_0xf12b('0xa')](),controller['addConfiguration']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xf12b('0x12')]);router[_0xf12b('0x13')](_0xf12b('0x9'),auth[_0xf12b('0xa')](),controller[_0xf12b('0x14')]);module[_0xf12b('0x15')]=router; \ No newline at end of file +var _0x7736=['multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','create','/:id','update','delete','destroy','exports'];(function(_0x58ff8e,_0x39fe0d){var _0x701683=function(_0x163930){while(--_0x163930){_0x58ff8e['push'](_0x58ff8e['shift']());}};_0x701683(++_0x39fe0d);}(_0x7736,0x84));var _0x6773=function(_0x295b4f,_0xcb4199){_0x295b4f=_0x295b4f-0x0;var _0x2aa765=_0x7736[_0x295b4f];return _0x2aa765;};'use strict';var multer=require(_0x6773('0x0'));var util=require(_0x6773('0x1'));var path=require(_0x6773('0x2'));var timeout=require(_0x6773('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6773('0x4'));var auth=require(_0x6773('0x5'));var interaction=require(_0x6773('0x6'));var config=require(_0x6773('0x7'));var controller=require(_0x6773('0x8'));router[_0x6773('0x9')]('/',auth[_0x6773('0xa')](),controller['index']);router[_0x6773('0x9')]('/:id',auth[_0x6773('0xa')](),controller[_0x6773('0xb')]);router[_0x6773('0x9')](_0x6773('0xc'),auth[_0x6773('0xa')](),controller[_0x6773('0xd')]);router[_0x6773('0x9')]('/:id/fields',auth[_0x6773('0xa')](),controller[_0x6773('0xe')]);router[_0x6773('0xf')]('/',auth[_0x6773('0xa')](),controller[_0x6773('0x10')]);router[_0x6773('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0x6773('0x11'),auth[_0x6773('0xa')](),controller[_0x6773('0x12')]);router[_0x6773('0x13')](_0x6773('0x11'),auth['isAuthenticated'](),controller[_0x6773('0x14')]);module[_0x6773('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 26fd75e..8893a75 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 _0xa8a8=['exports','STRING','sequelize'];(function(_0xb1aeb,_0x2ec92d){var _0x2d1e43=function(_0x4087bf){while(--_0x4087bf){_0xb1aeb['push'](_0xb1aeb['shift']());}};_0x2d1e43(++_0x2ec92d);}(_0xa8a8,0xec));var _0x8a8a=function(_0x3e4aaa,_0x26075c){_0x3e4aaa=_0x3e4aaa-0x0;var _0x19387e=_0xa8a8[_0x3e4aaa];return _0x19387e;};'use strict';var Sequelize=require(_0x8a8a('0x0'));module[_0x8a8a('0x1')]={'name':{'type':Sequelize[_0x8a8a('0x2')]},'description':{'type':Sequelize[_0x8a8a('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x8a8a('0x2')]},'clientId':{'type':Sequelize[_0x8a8a('0x2')]},'clientSecret':{'type':Sequelize[_0x8a8a('0x2')]},'serverUrl':{'type':Sequelize[_0x8a8a('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x8a8a('0x2')]},'refreshToken':{'type':Sequelize[_0x8a8a('0x2')]}}; \ No newline at end of file +var _0xa75b=['sequelize','STRING'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xa75b,0x170));var _0xba75=function(_0x3ae676,_0x3b75cb){_0x3ae676=_0x3ae676-0x0;var _0x215741=_0xa75b[_0x3ae676];return _0x215741;};'use strict';var Sequelize=require(_0xba75('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xba75('0x1')]},'host':{'type':Sequelize[_0xba75('0x1')]},'zone':{'type':Sequelize[_0xba75('0x1')]},'clientId':{'type':Sequelize[_0xba75('0x1')]},'clientSecret':{'type':Sequelize[_0xba75('0x1')]},'serverUrl':{'type':Sequelize[_0xba75('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xba75('0x1')]},'refreshToken':{'type':Sequelize[_0xba75('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 7b80012..7f0651e 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 _0xe799=['getConfigurations','findOne','keys','addConfiguration','body','AccountId','Subjects','getSubjects','channel','Descriptions','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientId','refresh_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','serverUrl','code','zoho.eu','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','response','message','Subject','WhoId','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields','stringify','send','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','path','sox','ejs','fs-extra','lodash','jsforce','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','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','sendStatus','error','stack','name','index','map','ZohoAccount','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','find','create','params'];(function(_0x168b3c,_0x28e65e){var _0x4de1f3=function(_0x134360){while(--_0x134360){_0x168b3c['push'](_0x168b3c['shift']());}};_0x4de1f3(++_0x28e65e);}(_0xe799,0x131));var _0x9e79=function(_0x59debc,_0x1aac5c){_0x59debc=_0x59debc-0x0;var _0x57c910=_0xe799[_0x59debc];return _0x57c910;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9e79('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9e79('0x1'));var rp=require(_0x9e79('0x2'));var moment=require(_0x9e79('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x9e79('0x4'));var sox=require(_0x9e79('0x5'));var csv=require('to-csv');var ejs=require(_0x9e79('0x6'));var fs=require('fs');var fs_extra=require(_0x9e79('0x7'));var _=require(_0x9e79('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9e79('0x9'));var deskjs=require(_0x9e79('0xa'));var toCsv=require(_0x9e79('0xb'));var querystring=require(_0x9e79('0xc'));var Papa=require(_0x9e79('0xd'));var Redis=require(_0x9e79('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9e79('0xf'));var as=require(_0x9e79('0x10'));var hardwareService=require(_0x9e79('0x11'));var logger=require(_0x9e79('0x12'))(_0x9e79('0x13'));var utils=require(_0x9e79('0x14'));var config=require(_0x9e79('0x15'));var licenseUtil=require(_0x9e79('0x16'));var db=require(_0x9e79('0x17'))['db'];var integrations=require(_0x9e79('0x18'));function respondWithStatusCode(_0x2c991e,_0x2a9065){_0x2a9065=_0x2a9065||0xcc;return function(_0x2a7888){if(_0x2a7888){return _0x2c991e['sendStatus'](_0x2a9065);}return _0x2c991e[_0x9e79('0x19')](_0x2a9065)[_0x9e79('0x1a')]();};}function respondWithResult(_0x4033b5,_0x53b9a1){_0x53b9a1=_0x53b9a1||0xc8;return function(_0x579bbd){if(_0x579bbd){return _0x4033b5['status'](_0x53b9a1)[_0x9e79('0x1b')](_0x579bbd);}};}function respondWithFilteredResult(_0x45f351,_0x2b3c96){return function(_0x2cbe9f){if(_0x2cbe9f){var _0x106ff6=typeof _0x2b3c96[_0x9e79('0x1c')]===_0x9e79('0x1d')&&typeof _0x2b3c96['limit']===_0x9e79('0x1d');var _0x5c119e=_0x2cbe9f['count'];var _0x4f1d1e=_0x106ff6?0x0:_0x2b3c96[_0x9e79('0x1c')];var _0x232ede=_0x106ff6?_0x2cbe9f[_0x9e79('0x1e')]:_0x2b3c96[_0x9e79('0x1c')]+_0x2b3c96[_0x9e79('0x1f')];var _0x1b37d6;if(_0x232ede>=_0x5c119e){_0x232ede=_0x5c119e;_0x1b37d6=0xc8;}else{_0x1b37d6=0xce;}_0x45f351[_0x9e79('0x19')](_0x1b37d6);return _0x45f351[_0x9e79('0x20')]('Content-Range',_0x4f1d1e+'-'+_0x232ede+'/'+_0x5c119e)[_0x9e79('0x1b')](_0x2cbe9f);}return null;};}function patchUpdates(_0x3a9325){return function(_0x3e5cd7){try{jsonpatch[_0x9e79('0x21')](_0x3e5cd7,_0x3a9325,!![]);}catch(_0x363951){return BPromise[_0x9e79('0x22')](_0x363951);}return _0x3e5cd7[_0x9e79('0x23')]();};}function saveUpdates(_0x18d518,_0x492bf6){return function(_0x580dfd){if(_0x580dfd){return _0x580dfd[_0x9e79('0x24')](_0x18d518)[_0x9e79('0x25')](function(_0x506ab2){return _0x506ab2;});}return null;};}function removeEntity(_0x7b8807,_0x1bc7fc){return function(_0x3ca653){if(_0x3ca653){return _0x3ca653['destroy']()['then'](function(){_0x7b8807['status'](0xcc)[_0x9e79('0x1a')]();});}};}function handleEntityNotFound(_0x1ff656,_0x2f15dd){return function(_0x2c9629){if(!_0x2c9629){_0x1ff656[_0x9e79('0x26')](0x194);}return _0x2c9629;};}function handleError(_0x15a9b0,_0x7cf80d){_0x7cf80d=_0x7cf80d||0x1f4;return function(_0x38a147){logger[_0x9e79('0x27')](_0x38a147[_0x9e79('0x28')]);if(_0x38a147[_0x9e79('0x29')]){delete _0x38a147['name'];}_0x15a9b0['status'](_0x7cf80d)['send'](_0x38a147);};}exports[_0x9e79('0x2a')]=function(_0x3ef563,_0xcf914a){var _0x5c01fd={},_0x14f5e5={},_0x3be46={'count':0x0,'rows':[]};var _0x4f8d24=_[_0x9e79('0x2b')](db[_0x9e79('0x2c')][_0x9e79('0x2d')],function(_0x335a77){return{'name':_0x335a77[_0x9e79('0x2e')],'type':_0x335a77[_0x9e79('0x2f')]['key']};});_0x14f5e5[_0x9e79('0x30')]=_[_0x9e79('0x2b')](_0x4f8d24,'name');_0x14f5e5[_0x9e79('0x31')]=_['keys'](_0x3ef563[_0x9e79('0x31')]);_0x14f5e5[_0x9e79('0x32')]=_[_0x9e79('0x33')](_0x14f5e5[_0x9e79('0x30')],_0x14f5e5[_0x9e79('0x31')]);_0x5c01fd['attributes']=_[_0x9e79('0x33')](_0x14f5e5[_0x9e79('0x30')],qs[_0x9e79('0x34')](_0x3ef563['query'][_0x9e79('0x34')]));_0x5c01fd[_0x9e79('0x35')]=_0x5c01fd[_0x9e79('0x35')][_0x9e79('0x36')]?_0x5c01fd['attributes']:_0x14f5e5[_0x9e79('0x30')];if(!_0x3ef563[_0x9e79('0x31')][_0x9e79('0x37')](_0x9e79('0x38'))){_0x5c01fd['limit']=qs['limit'](_0x3ef563[_0x9e79('0x31')][_0x9e79('0x1f')]);_0x5c01fd['offset']=qs[_0x9e79('0x1c')](_0x3ef563['query'][_0x9e79('0x1c')]);}_0x5c01fd[_0x9e79('0x39')]=qs['sort'](_0x3ef563[_0x9e79('0x31')][_0x9e79('0x3a')]);_0x5c01fd[_0x9e79('0x3b')]=qs[_0x9e79('0x32')](_[_0x9e79('0x3c')](_0x3ef563[_0x9e79('0x31')],_0x14f5e5[_0x9e79('0x32')]),_0x4f8d24);if(_0x3ef563[_0x9e79('0x31')][_0x9e79('0x3d')]){_0x5c01fd['where']=_['merge'](_0x5c01fd[_0x9e79('0x3b')],{'$or':_[_0x9e79('0x2b')](_0x4f8d24,function(_0x26a9d5){if(_0x26a9d5[_0x9e79('0x2f')]!==_0x9e79('0x3e')){var _0x33caa0={};_0x33caa0[_0x26a9d5[_0x9e79('0x29')]]={'$like':'%'+_0x3ef563[_0x9e79('0x31')]['filter']+'%'};return _0x33caa0;}})});}_0x5c01fd=_[_0x9e79('0x3f')]({},_0x5c01fd,_0x3ef563[_0x9e79('0x40')]);var _0x59368b={'where':_0x5c01fd[_0x9e79('0x3b')]};return db[_0x9e79('0x2c')][_0x9e79('0x1e')](_0x59368b)['then'](function(_0x86540f){_0x3be46[_0x9e79('0x1e')]=_0x86540f;if(_0x3ef563[_0x9e79('0x31')]['includeAll']){_0x5c01fd[_0x9e79('0x41')]=[{'all':!![]}];}return db[_0x9e79('0x2c')][_0x9e79('0x42')](_0x5c01fd);})['then'](function(_0x51685d){_0x3be46[_0x9e79('0x43')]=_0x51685d;return _0x3be46;})[_0x9e79('0x25')](respondWithFilteredResult(_0xcf914a,_0x5c01fd))[_0x9e79('0x44')](handleError(_0xcf914a,null));};exports[_0x9e79('0x45')]=function(_0x15d640,_0x5dc6b1){var _0x51a88e={'raw':![],'where':{'id':_0x15d640['params']['id']}},_0x2f33a9={};_0x2f33a9[_0x9e79('0x30')]=_['keys'](db[_0x9e79('0x2c')][_0x9e79('0x2d')]);_0x2f33a9['query']=_['keys'](_0x15d640[_0x9e79('0x31')]);_0x2f33a9[_0x9e79('0x32')]=_[_0x9e79('0x33')](_0x2f33a9[_0x9e79('0x30')],_0x2f33a9[_0x9e79('0x31')]);_0x51a88e[_0x9e79('0x35')]=_['intersection'](_0x2f33a9[_0x9e79('0x30')],qs[_0x9e79('0x34')](_0x15d640[_0x9e79('0x31')][_0x9e79('0x34')]));_0x51a88e[_0x9e79('0x35')]=_0x51a88e['attributes']['length']?_0x51a88e['attributes']:_0x2f33a9[_0x9e79('0x30')];if(_0x15d640[_0x9e79('0x31')]['includeAll']){_0x51a88e[_0x9e79('0x41')]=[{'all':!![]}];}_0x51a88e=_[_0x9e79('0x3f')]({},_0x51a88e,_0x15d640[_0x9e79('0x40')]);return db[_0x9e79('0x2c')][_0x9e79('0x46')](_0x51a88e)[_0x9e79('0x25')](handleEntityNotFound(_0x5dc6b1,null))[_0x9e79('0x25')](respondWithResult(_0x5dc6b1,null))[_0x9e79('0x44')](handleError(_0x5dc6b1,null));};exports[_0x9e79('0x47')]=function(_0x5dc08e,_0x3b2eae){return db[_0x9e79('0x2c')][_0x9e79('0x47')](_0x5dc08e['body'],{})[_0x9e79('0x25')](respondWithResult(_0x3b2eae,0xc9))['catch'](handleError(_0x3b2eae,null));};exports['update']=function(_0x537bd8,_0x53252b){if(_0x537bd8['body']['id']){delete _0x537bd8['body']['id'];}return db[_0x9e79('0x2c')][_0x9e79('0x46')]({'where':{'id':_0x537bd8[_0x9e79('0x48')]['id']}})['then'](handleEntityNotFound(_0x53252b,null))[_0x9e79('0x25')](saveUpdates(_0x537bd8['body'],null))[_0x9e79('0x25')](respondWithResult(_0x53252b,null))['catch'](handleError(_0x53252b,null));};exports['destroy']=function(_0x402e0b,_0x3d252c){return db[_0x9e79('0x2c')]['find']({'where':{'id':_0x402e0b[_0x9e79('0x48')]['id']}})[_0x9e79('0x25')](handleEntityNotFound(_0x3d252c,null))['then'](removeEntity(_0x3d252c,null))[_0x9e79('0x44')](handleError(_0x3d252c,null));};exports[_0x9e79('0x49')]=function(_0x3c7f80,_0xfff6ca,_0x50dcab){var _0xcedc0d={};var _0x312897={};var _0x24c56e;var _0x2a60e6;return db[_0x9e79('0x2c')][_0x9e79('0x4a')]({'where':{'id':_0x3c7f80[_0x9e79('0x48')]['id']}})['then'](handleEntityNotFound(_0xfff6ca,null))[_0x9e79('0x25')](function(_0x99d8e0){if(_0x99d8e0){_0x24c56e=_0x99d8e0;_0x312897[_0x9e79('0x30')]=_[_0x9e79('0x4b')](db['ZohoConfiguration'][_0x9e79('0x2d')]);_0x312897[_0x9e79('0x31')]=_[_0x9e79('0x4b')](_0x3c7f80['query']);_0x312897[_0x9e79('0x32')]=_[_0x9e79('0x33')](_0x312897[_0x9e79('0x30')],_0x312897['query']);_0xcedc0d[_0x9e79('0x35')]=_[_0x9e79('0x33')](_0x312897[_0x9e79('0x30')],qs[_0x9e79('0x34')](_0x3c7f80['query'][_0x9e79('0x34')]));_0xcedc0d['attributes']=_0xcedc0d[_0x9e79('0x35')]['length']?_0xcedc0d[_0x9e79('0x35')]:_0x312897[_0x9e79('0x30')];_0xcedc0d[_0x9e79('0x39')]=qs[_0x9e79('0x3a')](_0x3c7f80[_0x9e79('0x31')][_0x9e79('0x3a')]);_0xcedc0d[_0x9e79('0x3b')]=qs[_0x9e79('0x32')](_['pick'](_0x3c7f80['query'],_0x312897['filters']));if(_0x3c7f80[_0x9e79('0x31')]['filter']){_0xcedc0d[_0x9e79('0x3b')]=_[_0x9e79('0x3f')](_0xcedc0d['where'],{'$or':_[_0x9e79('0x2b')](_0xcedc0d['attributes'],function(_0x50e2c3){var _0x13c654={};_0x13c654[_0x50e2c3]={'$like':'%'+_0x3c7f80[_0x9e79('0x31')]['filter']+'%'};return _0x13c654;})});}_0xcedc0d=_[_0x9e79('0x3f')]({},_0xcedc0d,_0x3c7f80['options']);return _0x24c56e['getConfigurations'](_0xcedc0d);}})[_0x9e79('0x25')](function(_0x12c9e1){if(_0x12c9e1){_0x2a60e6=_0x12c9e1[_0x9e79('0x36')];if(!_0x3c7f80[_0x9e79('0x31')]['hasOwnProperty'](_0x9e79('0x38'))){_0xcedc0d[_0x9e79('0x1f')]=qs[_0x9e79('0x1f')](_0x3c7f80[_0x9e79('0x31')]['limit']);_0xcedc0d['offset']=qs[_0x9e79('0x1c')](_0x3c7f80['query'][_0x9e79('0x1c')]);}return _0x24c56e[_0x9e79('0x49')](_0xcedc0d);}})[_0x9e79('0x25')](function(_0x464eb7){if(_0x464eb7){return _0x464eb7?{'count':_0x2a60e6,'rows':_0x464eb7}:null;}})[_0x9e79('0x25')](respondWithResult(_0xfff6ca,null))[_0x9e79('0x44')](handleError(_0xfff6ca,null));};exports[_0x9e79('0x4c')]=function(_0x8a9f3a,_0x3c19a8,_0x5a25c8){if(_0x8a9f3a[_0x9e79('0x4d')]['id']){delete _0x8a9f3a['body']['id'];}return db[_0x9e79('0x2c')][_0x9e79('0x4a')]({'where':{'id':_0x8a9f3a['params']['id']}})[_0x9e79('0x25')](handleEntityNotFound(_0x3c19a8,null))['then'](function(_0x19ec83){if(_0x19ec83){_0x8a9f3a[_0x9e79('0x4d')][_0x9e79('0x4e')]=_0x19ec83['id'];_0x8a9f3a[_0x9e79('0x4d')][_0x9e79('0x4f')]=integrations[_0x9e79('0x50')](_0x8a9f3a[_0x9e79('0x4d')][_0x9e79('0x51')],_0x8a9f3a[_0x9e79('0x4d')][_0x9e79('0x2f')]);_0x8a9f3a['body'][_0x9e79('0x52')]=integrations['getDescriptions'](_0x8a9f3a[_0x9e79('0x4d')][_0x9e79('0x51')],_0x8a9f3a[_0x9e79('0x4d')][_0x9e79('0x2f')]);return db[_0x9e79('0x53')][_0x9e79('0x47')](_0x8a9f3a['body'],{'include':[{'model':db[_0x9e79('0x54')],'as':'Subjects'},{'model':db[_0x9e79('0x54')],'as':_0x9e79('0x52')}]});}return null;})['then'](respondWithResult(_0x3c19a8,null))[_0x9e79('0x44')](handleError(_0x3c19a8,null));};function getAccessToken(_0x32fa6f){return new Promise(function(_0x42bec4,_0x1865c9){var _0x2c2b06;switch(_0x32fa6f[_0x9e79('0x55')]){case'US':_0x2c2b06=_0x9e79('0x56');break;case'AU':_0x2c2b06=_0x9e79('0x57');break;case'EU':_0x2c2b06='https://accounts.zoho.eu';break;case'IN':_0x2c2b06=_0x9e79('0x58');break;case'CN':_0x2c2b06='https://accounts.zoho.com.cn';break;default:_0x2c2b06=_0x9e79('0x59');break;}var _0x3a971d={'method':'POST','uri':_0x2c2b06+_0x9e79('0x5a'),'qs':{'refresh_token':_0x32fa6f[_0x9e79('0x5b')],'client_id':_0x32fa6f[_0x9e79('0x5c')],'client_secret':_0x32fa6f['clientSecret'],'grant_type':_0x9e79('0x5d')},'json':!![]};return rp(_0x3a971d)[_0x9e79('0x25')](function(_0x56fef5){if(_0x56fef5['access_token']){_0x42bec4(_0x56fef5['access_token']);}else{_0x1865c9(_0x9e79('0x5e'));}})[_0x9e79('0x44')](function(_0x3dd00a){_0x1865c9(_0x3dd00a);});});}exports['getFields']=function(_0x4e016e,_0x281194,_0xf32223){var _0xb00821,_0x22eeeb,_0x5e367a,_0x345af9,_0x1c6598;return db[_0x9e79('0x2c')]['findOne']({'where':{'id':_0x4e016e[_0x9e79('0x48')]['id']},'attributes':['id',_0x9e79('0x5f'),_0x9e79('0x55'),_0x9e79('0x5c'),'clientSecret',_0x9e79('0x60'),_0x9e79('0x61'),_0x9e79('0x5b')]})['then'](handleEntityNotFound(_0x281194,null))[_0x9e79('0x25')](function(_0x311236){_0x1c6598=_0x311236;_0xb00821=_0x1c6598['host'];_0x22eeeb=_0xb00821===_0x9e79('0x62')?'eu':'com';_0x5e367a=_0x1c6598[_0x9e79('0x60')];var _0x55ee49=_0x5e367a[_0x9e79('0x63')](-0x1);if(_0x55ee49==='/'||_0x55ee49==='\x5c'||_0x55ee49===':'){_0x5e367a=_0x5e367a[_0x9e79('0x64')](0x0,_0x5e367a[_0x9e79('0x65')](_0x55ee49));}if(!_0x1c6598['refreshToken']){throw new Error(_0x9e79('0x66'));}return getAccessToken(_0x1c6598);})['then'](function(_0x45917f){if(_0x45917f){return rp({'method':_0x9e79('0x67'),'uri':util['format'](_0x9e79('0x68'),_0x22eeeb),'qs':{'module':'Calls'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x45917f},'json':!![]});}})['then'](function(_0x409358){if(_0x409358){if(_0x409358[_0x9e79('0x69')]&&_0x409358[_0x9e79('0x69')][_0x9e79('0x27')]){throw new Error(_0x409358[_0x9e79('0x69')][_0x9e79('0x27')][_0x9e79('0x6a')]);}var _0x3b9bfc=[];var _0x2eb6f1=[];var _0x2a51e8=['Owner',_0x9e79('0x6b'),'Description',_0x9e79('0x6c'),'Call_Duration','Call_Result','Call_Start_Time',_0x9e79('0x6d')];_0x2eb6f1=_[_0x9e79('0x6e')](_0x409358[_0x9e79('0x34')],function(_0x4129a3){return _0x2a51e8[_0x9e79('0x6f')](_0x4129a3[_0x9e79('0x70')]);});for(var _0x5cee7b=0x0;_0x5cee7b<_0x2eb6f1[_0x9e79('0x36')];_0x5cee7b++){if(_0x2eb6f1[_0x5cee7b][_0x9e79('0x71')]===![]){_0x3b9bfc[_0x9e79('0x72')]({'id':_0x2eb6f1[_0x5cee7b]['id'],'name':_0x2eb6f1[_0x5cee7b][_0x9e79('0x73')],'custom':_0x2eb6f1[_0x5cee7b][_0x9e79('0x74')],'options':_0x2eb6f1[_0x5cee7b][_0x9e79('0x75')]===_0x9e79('0x76')&&_0x2eb6f1[_0x5cee7b][_0x9e79('0x77')][_0x9e79('0x36')]>-0x1?_[_0x9e79('0x2b')](_0x2eb6f1[_0x5cee7b][_0x9e79('0x77')],function(_0x3c1eec){return{'name':_0x3c1eec,'value':_0x3c1eec};}):[]});}}return{'count':_0x3b9bfc[_0x9e79('0x36')],'rows':_0x3b9bfc};}else{return{'count':0x0,'rows':[]};}})[_0x9e79('0x25')](respondWithResult(_0x281194,null))['catch'](function(_0x3c6cf5){var _0x44c17e=_0x4e016e[_0x9e79('0x31')][_0x9e79('0x78')]?0x1f4:_0x3c6cf5[_0x9e79('0x79')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x9e79('0x7a'),_0x44c17e,JSON[_0x9e79('0x7b')](_0x3c6cf5));delete _0x3c6cf5[_0x9e79('0x29')];if(_0x44c17e===0x191){_0x44c17e=0x190;}_0x281194[_0x9e79('0x19')](_0x44c17e)[_0x9e79('0x7c')](_0x4e016e[_0x9e79('0x31')]['test']?{'message':_0x9e79('0x7d'),'statusCode':_0x3c6cf5[_0x9e79('0x79')]}:_0x3c6cf5);});}; \ No newline at end of file +var _0x7c2a=['fields','attributes','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','include','findAll','rows','catch','length','options','find','body','params','getConfigurations','findOne','filters','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','create','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','POST','/oauth/v2/token','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','clientId','serverUrl','code','host','zoho.eu','com','refreshToken','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','response','error','Owner','Subject','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','statusCode','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','Content-Range','json','reject','save','update','then','destroy','sendStatus','stack','name','index','map','ZohoAccount','rawAttributes','fieldName','type','key','query','keys','intersection','model'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c2a,0x13e));var _0xa7c2=function(_0x1b001a,_0x448e53){_0x1b001a=_0x1b001a-0x0;var _0x390f3c=_0x7c2a[_0x1b001a];return _0x390f3c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa7c2('0x0'));var rp=require(_0xa7c2('0x1'));var moment=require(_0xa7c2('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xa7c2('0x3'));var util=require(_0xa7c2('0x4'));var path=require(_0xa7c2('0x5'));var sox=require(_0xa7c2('0x6'));var csv=require(_0xa7c2('0x7'));var ejs=require(_0xa7c2('0x8'));var fs=require('fs');var fs_extra=require(_0xa7c2('0x9'));var _=require(_0xa7c2('0xa'));var squel=require(_0xa7c2('0xb'));var crypto=require(_0xa7c2('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa7c2('0x7'));var querystring=require(_0xa7c2('0xd'));var Papa=require(_0xa7c2('0xe'));var Redis=require(_0xa7c2('0xf'));var authService=require(_0xa7c2('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa7c2('0x11'));var logger=require(_0xa7c2('0x12'))(_0xa7c2('0x13'));var utils=require(_0xa7c2('0x14'));var config=require(_0xa7c2('0x15'));var licenseUtil=require(_0xa7c2('0x16'));var db=require(_0xa7c2('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x59b973,_0x27676b){_0x27676b=_0x27676b||0xcc;return function(_0x3d6da4){if(_0x3d6da4){return _0x59b973['sendStatus'](_0x27676b);}return _0x59b973[_0xa7c2('0x18')](_0x27676b)[_0xa7c2('0x19')]();};}function respondWithResult(_0x4ed3b2,_0x141a33){_0x141a33=_0x141a33||0xc8;return function(_0x56dfa9){if(_0x56dfa9){return _0x4ed3b2[_0xa7c2('0x18')](_0x141a33)['json'](_0x56dfa9);}};}function respondWithFilteredResult(_0x4222a8,_0x3d7f3a){return function(_0x523331){if(_0x523331){var _0x10f29d=typeof _0x3d7f3a[_0xa7c2('0x1a')]===_0xa7c2('0x1b')&&typeof _0x3d7f3a['limit']===_0xa7c2('0x1b');var _0x392f60=_0x523331['count'];var _0x34e430=_0x10f29d?0x0:_0x3d7f3a[_0xa7c2('0x1a')];var _0x4dbcd0=_0x10f29d?_0x523331[_0xa7c2('0x1c')]:_0x3d7f3a[_0xa7c2('0x1a')]+_0x3d7f3a[_0xa7c2('0x1d')];var _0x5b1076;if(_0x4dbcd0>=_0x392f60){_0x4dbcd0=_0x392f60;_0x5b1076=0xc8;}else{_0x5b1076=0xce;}_0x4222a8[_0xa7c2('0x18')](_0x5b1076);return _0x4222a8['set'](_0xa7c2('0x1e'),_0x34e430+'-'+_0x4dbcd0+'/'+_0x392f60)[_0xa7c2('0x1f')](_0x523331);}return null;};}function patchUpdates(_0x10d24a){return function(_0x3e5e6f){try{jsonpatch['apply'](_0x3e5e6f,_0x10d24a,!![]);}catch(_0xb12106){return BPromise[_0xa7c2('0x20')](_0xb12106);}return _0x3e5e6f[_0xa7c2('0x21')]();};}function saveUpdates(_0x41c245,_0x493044){return function(_0x36ed6d){if(_0x36ed6d){return _0x36ed6d[_0xa7c2('0x22')](_0x41c245)[_0xa7c2('0x23')](function(_0x2ded48){return _0x2ded48;});}return null;};}function removeEntity(_0x4bf677,_0x5b7646){return function(_0x3e2a4c){if(_0x3e2a4c){return _0x3e2a4c[_0xa7c2('0x24')]()[_0xa7c2('0x23')](function(){_0x4bf677[_0xa7c2('0x18')](0xcc)[_0xa7c2('0x19')]();});}};}function handleEntityNotFound(_0x579c98,_0xab21c4){return function(_0x1e245e){if(!_0x1e245e){_0x579c98[_0xa7c2('0x25')](0x194);}return _0x1e245e;};}function handleError(_0x41dae3,_0x166ac4){_0x166ac4=_0x166ac4||0x1f4;return function(_0x2ab988){logger['error'](_0x2ab988[_0xa7c2('0x26')]);if(_0x2ab988[_0xa7c2('0x27')]){delete _0x2ab988[_0xa7c2('0x27')];}_0x41dae3[_0xa7c2('0x18')](_0x166ac4)['send'](_0x2ab988);};}exports[_0xa7c2('0x28')]=function(_0x470a1b,_0x326a21){var _0x2e5428={},_0x76be57={},_0x2543a4={'count':0x0,'rows':[]};var _0x39ca35=_[_0xa7c2('0x29')](db[_0xa7c2('0x2a')][_0xa7c2('0x2b')],function(_0x5c2aca){return{'name':_0x5c2aca[_0xa7c2('0x2c')],'type':_0x5c2aca[_0xa7c2('0x2d')][_0xa7c2('0x2e')]};});_0x76be57['model']=_[_0xa7c2('0x29')](_0x39ca35,_0xa7c2('0x27'));_0x76be57[_0xa7c2('0x2f')]=_[_0xa7c2('0x30')](_0x470a1b['query']);_0x76be57['filters']=_[_0xa7c2('0x31')](_0x76be57[_0xa7c2('0x32')],_0x76be57[_0xa7c2('0x2f')]);_0x2e5428['attributes']=_[_0xa7c2('0x31')](_0x76be57[_0xa7c2('0x32')],qs[_0xa7c2('0x33')](_0x470a1b[_0xa7c2('0x2f')][_0xa7c2('0x33')]));_0x2e5428[_0xa7c2('0x34')]=_0x2e5428[_0xa7c2('0x34')]['length']?_0x2e5428[_0xa7c2('0x34')]:_0x76be57[_0xa7c2('0x32')];if(!_0x470a1b[_0xa7c2('0x2f')][_0xa7c2('0x35')](_0xa7c2('0x36'))){_0x2e5428[_0xa7c2('0x1d')]=qs[_0xa7c2('0x1d')](_0x470a1b[_0xa7c2('0x2f')]['limit']);_0x2e5428['offset']=qs['offset'](_0x470a1b[_0xa7c2('0x2f')]['offset']);}_0x2e5428[_0xa7c2('0x37')]=qs[_0xa7c2('0x38')](_0x470a1b[_0xa7c2('0x2f')][_0xa7c2('0x38')]);_0x2e5428['where']=qs['filters'](_['pick'](_0x470a1b[_0xa7c2('0x2f')],_0x76be57['filters']),_0x39ca35);if(_0x470a1b[_0xa7c2('0x2f')][_0xa7c2('0x39')]){_0x2e5428[_0xa7c2('0x3a')]=_[_0xa7c2('0x3b')](_0x2e5428[_0xa7c2('0x3a')],{'$or':_[_0xa7c2('0x29')](_0x39ca35,function(_0x46209d){if(_0x46209d[_0xa7c2('0x2d')]!==_0xa7c2('0x3c')){var _0x817c34={};_0x817c34[_0x46209d[_0xa7c2('0x27')]]={'$like':'%'+_0x470a1b['query'][_0xa7c2('0x39')]+'%'};return _0x817c34;}})});}_0x2e5428=_[_0xa7c2('0x3b')]({},_0x2e5428,_0x470a1b['options']);var _0x4e2785={'where':_0x2e5428[_0xa7c2('0x3a')]};return db[_0xa7c2('0x2a')][_0xa7c2('0x1c')](_0x4e2785)[_0xa7c2('0x23')](function(_0x1342fa){_0x2543a4[_0xa7c2('0x1c')]=_0x1342fa;if(_0x470a1b['query']['includeAll']){_0x2e5428[_0xa7c2('0x3d')]=[{'all':!![]}];}return db[_0xa7c2('0x2a')][_0xa7c2('0x3e')](_0x2e5428);})[_0xa7c2('0x23')](function(_0x428208){_0x2543a4[_0xa7c2('0x3f')]=_0x428208;return _0x2543a4;})[_0xa7c2('0x23')](respondWithFilteredResult(_0x326a21,_0x2e5428))[_0xa7c2('0x40')](handleError(_0x326a21,null));};exports['show']=function(_0x625dcd,_0x30f045){var _0x1b2947={'raw':![],'where':{'id':_0x625dcd['params']['id']}},_0x1270dd={};_0x1270dd[_0xa7c2('0x32')]=_[_0xa7c2('0x30')](db['ZohoAccount'][_0xa7c2('0x2b')]);_0x1270dd['query']=_[_0xa7c2('0x30')](_0x625dcd[_0xa7c2('0x2f')]);_0x1270dd['filters']=_[_0xa7c2('0x31')](_0x1270dd['model'],_0x1270dd[_0xa7c2('0x2f')]);_0x1b2947[_0xa7c2('0x34')]=_['intersection'](_0x1270dd['model'],qs[_0xa7c2('0x33')](_0x625dcd['query'][_0xa7c2('0x33')]));_0x1b2947[_0xa7c2('0x34')]=_0x1b2947[_0xa7c2('0x34')][_0xa7c2('0x41')]?_0x1b2947[_0xa7c2('0x34')]:_0x1270dd['model'];if(_0x625dcd['query']['includeAll']){_0x1b2947[_0xa7c2('0x3d')]=[{'all':!![]}];}_0x1b2947=_['merge']({},_0x1b2947,_0x625dcd[_0xa7c2('0x42')]);return db[_0xa7c2('0x2a')][_0xa7c2('0x43')](_0x1b2947)[_0xa7c2('0x23')](handleEntityNotFound(_0x30f045,null))['then'](respondWithResult(_0x30f045,null))[_0xa7c2('0x40')](handleError(_0x30f045,null));};exports['create']=function(_0x3bf24b,_0x27dc0f){return db['ZohoAccount']['create'](_0x3bf24b[_0xa7c2('0x44')],{})[_0xa7c2('0x23')](respondWithResult(_0x27dc0f,0xc9))[_0xa7c2('0x40')](handleError(_0x27dc0f,null));};exports[_0xa7c2('0x22')]=function(_0x1161aa,_0x150ac1){if(_0x1161aa[_0xa7c2('0x44')]['id']){delete _0x1161aa[_0xa7c2('0x44')]['id'];}return db['ZohoAccount'][_0xa7c2('0x43')]({'where':{'id':_0x1161aa['params']['id']}})[_0xa7c2('0x23')](handleEntityNotFound(_0x150ac1,null))[_0xa7c2('0x23')](saveUpdates(_0x1161aa['body'],null))[_0xa7c2('0x23')](respondWithResult(_0x150ac1,null))[_0xa7c2('0x40')](handleError(_0x150ac1,null));};exports['destroy']=function(_0x24ebf7,_0x10b142){return db['ZohoAccount'][_0xa7c2('0x43')]({'where':{'id':_0x24ebf7[_0xa7c2('0x45')]['id']}})[_0xa7c2('0x23')](handleEntityNotFound(_0x10b142,null))[_0xa7c2('0x23')](removeEntity(_0x10b142,null))[_0xa7c2('0x40')](handleError(_0x10b142,null));};exports[_0xa7c2('0x46')]=function(_0x9736d2,_0x519f9e,_0xe5808a){var _0xf51f94={};var _0x1a4d24={};var _0x2f6412;var _0x4a5288;return db[_0xa7c2('0x2a')][_0xa7c2('0x47')]({'where':{'id':_0x9736d2[_0xa7c2('0x45')]['id']}})[_0xa7c2('0x23')](handleEntityNotFound(_0x519f9e,null))[_0xa7c2('0x23')](function(_0x563f4a){if(_0x563f4a){_0x2f6412=_0x563f4a;_0x1a4d24[_0xa7c2('0x32')]=_[_0xa7c2('0x30')](db['ZohoConfiguration']['rawAttributes']);_0x1a4d24[_0xa7c2('0x2f')]=_['keys'](_0x9736d2['query']);_0x1a4d24['filters']=_[_0xa7c2('0x31')](_0x1a4d24[_0xa7c2('0x32')],_0x1a4d24[_0xa7c2('0x2f')]);_0xf51f94['attributes']=_[_0xa7c2('0x31')](_0x1a4d24['model'],qs['fields'](_0x9736d2[_0xa7c2('0x2f')][_0xa7c2('0x33')]));_0xf51f94['attributes']=_0xf51f94[_0xa7c2('0x34')][_0xa7c2('0x41')]?_0xf51f94[_0xa7c2('0x34')]:_0x1a4d24['model'];_0xf51f94[_0xa7c2('0x37')]=qs[_0xa7c2('0x38')](_0x9736d2[_0xa7c2('0x2f')][_0xa7c2('0x38')]);_0xf51f94['where']=qs[_0xa7c2('0x48')](_['pick'](_0x9736d2[_0xa7c2('0x2f')],_0x1a4d24[_0xa7c2('0x48')]));if(_0x9736d2[_0xa7c2('0x2f')][_0xa7c2('0x39')]){_0xf51f94[_0xa7c2('0x3a')]=_[_0xa7c2('0x3b')](_0xf51f94[_0xa7c2('0x3a')],{'$or':_[_0xa7c2('0x29')](_0xf51f94[_0xa7c2('0x34')],function(_0x4cd004){var _0x4e1c57={};_0x4e1c57[_0x4cd004]={'$like':'%'+_0x9736d2[_0xa7c2('0x2f')]['filter']+'%'};return _0x4e1c57;})});}_0xf51f94=_['merge']({},_0xf51f94,_0x9736d2[_0xa7c2('0x42')]);return _0x2f6412['getConfigurations'](_0xf51f94);}})[_0xa7c2('0x23')](function(_0x11b12c){if(_0x11b12c){_0x4a5288=_0x11b12c[_0xa7c2('0x41')];if(!_0x9736d2[_0xa7c2('0x2f')][_0xa7c2('0x35')]('nolimit')){_0xf51f94[_0xa7c2('0x1d')]=qs[_0xa7c2('0x1d')](_0x9736d2[_0xa7c2('0x2f')][_0xa7c2('0x1d')]);_0xf51f94[_0xa7c2('0x1a')]=qs[_0xa7c2('0x1a')](_0x9736d2[_0xa7c2('0x2f')][_0xa7c2('0x1a')]);}return _0x2f6412[_0xa7c2('0x46')](_0xf51f94);}})[_0xa7c2('0x23')](function(_0x53e665){if(_0x53e665){return _0x53e665?{'count':_0x4a5288,'rows':_0x53e665}:null;}})[_0xa7c2('0x23')](respondWithResult(_0x519f9e,null))['catch'](handleError(_0x519f9e,null));};exports[_0xa7c2('0x49')]=function(_0x34cfaa,_0xc36d72,_0x387a64){if(_0x34cfaa[_0xa7c2('0x44')]['id']){delete _0x34cfaa[_0xa7c2('0x44')]['id'];}return db[_0xa7c2('0x2a')][_0xa7c2('0x47')]({'where':{'id':_0x34cfaa['params']['id']}})['then'](handleEntityNotFound(_0xc36d72,null))['then'](function(_0x14da42){if(_0x14da42){_0x34cfaa[_0xa7c2('0x44')][_0xa7c2('0x4a')]=_0x14da42['id'];_0x34cfaa['body'][_0xa7c2('0x4b')]=integrations['getSubjects'](_0x34cfaa[_0xa7c2('0x44')][_0xa7c2('0x4c')],_0x34cfaa['body'][_0xa7c2('0x2d')]);_0x34cfaa['body'][_0xa7c2('0x4d')]=integrations[_0xa7c2('0x4e')](_0x34cfaa['body'][_0xa7c2('0x4c')],_0x34cfaa[_0xa7c2('0x44')][_0xa7c2('0x2d')]);return db['ZohoConfiguration'][_0xa7c2('0x4f')](_0x34cfaa[_0xa7c2('0x44')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db['ZohoField'],'as':_0xa7c2('0x4d')}]});}return null;})[_0xa7c2('0x23')](respondWithResult(_0xc36d72,null))[_0xa7c2('0x40')](handleError(_0xc36d72,null));};function getAccessToken(_0x226d1d){return new Promise(function(_0x35bae2,_0x3a9195){var _0x104da8;switch(_0x226d1d[_0xa7c2('0x50')]){case'US':_0x104da8=_0xa7c2('0x51');break;case'AU':_0x104da8=_0xa7c2('0x52');break;case'EU':_0x104da8='https://accounts.zoho.eu';break;case'IN':_0x104da8='https://accounts.zoho.in';break;case'CN':_0x104da8='https://accounts.zoho.com.cn';break;default:_0x104da8='https://accounts.zoho.eu';break;}var _0x5d2ec9={'method':_0xa7c2('0x53'),'uri':_0x104da8+_0xa7c2('0x54'),'qs':{'refresh_token':_0x226d1d['refreshToken'],'client_id':_0x226d1d['clientId'],'client_secret':_0x226d1d[_0xa7c2('0x55')],'grant_type':_0xa7c2('0x56')},'json':!![]};return rp(_0x5d2ec9)[_0xa7c2('0x23')](function(_0x9e06a7){if(_0x9e06a7[_0xa7c2('0x57')]){_0x35bae2(_0x9e06a7['access_token']);}else{_0x3a9195(_0xa7c2('0x58'));}})[_0xa7c2('0x40')](function(_0x559a7d){_0x3a9195(_0x559a7d);});});}exports[_0xa7c2('0x59')]=function(_0x441887,_0x58e776,_0x5c2ae0){var _0x3876d0,_0x50d11f,_0x378789,_0x229a20,_0x75bf;return db['ZohoAccount']['findOne']({'where':{'id':_0x441887[_0xa7c2('0x45')]['id']},'attributes':['id','host','zone',_0xa7c2('0x5a'),_0xa7c2('0x55'),_0xa7c2('0x5b'),_0xa7c2('0x5c'),'refreshToken']})['then'](handleEntityNotFound(_0x58e776,null))['then'](function(_0x2975ad){_0x75bf=_0x2975ad;_0x3876d0=_0x75bf[_0xa7c2('0x5d')];_0x50d11f=_0x3876d0===_0xa7c2('0x5e')?'eu':_0xa7c2('0x5f');_0x378789=_0x75bf[_0xa7c2('0x5b')];var _0xdd28cb=_0x378789['slice'](-0x1);if(_0xdd28cb==='/'||_0xdd28cb==='\x5c'||_0xdd28cb===':'){_0x378789=_0x378789['substring'](0x0,_0x378789['lastIndexOf'](_0xdd28cb));}if(!_0x75bf[_0xa7c2('0x60')]){throw new Error(_0xa7c2('0x61'));}return getAccessToken(_0x75bf);})[_0xa7c2('0x23')](function(_0x47d6ad){if(_0x47d6ad){return rp({'method':_0xa7c2('0x62'),'uri':util[_0xa7c2('0x63')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x50d11f),'qs':{'module':_0xa7c2('0x64')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x47d6ad},'json':!![]});}})[_0xa7c2('0x23')](function(_0x3011cf){if(_0x3011cf){if(_0x3011cf[_0xa7c2('0x65')]&&_0x3011cf[_0xa7c2('0x65')][_0xa7c2('0x66')]){throw new Error(_0x3011cf[_0xa7c2('0x65')][_0xa7c2('0x66')]['message']);}var _0x128cdc=[];var _0x3ae828=[];var _0x4603d1=[_0xa7c2('0x67'),_0xa7c2('0x68'),'Description','WhoId','Call_Duration',_0xa7c2('0x69'),_0xa7c2('0x6a'),_0xa7c2('0x6b')];_0x3ae828=_[_0xa7c2('0x6c')](_0x3011cf[_0xa7c2('0x33')],function(_0x308c67){return _0x4603d1[_0xa7c2('0x6d')](_0x308c67[_0xa7c2('0x6e')]);});for(var _0x5d7a3f=0x0;_0x5d7a3f<_0x3ae828[_0xa7c2('0x41')];_0x5d7a3f++){if(_0x3ae828[_0x5d7a3f][_0xa7c2('0x6f')]===![]){_0x128cdc[_0xa7c2('0x70')]({'id':_0x3ae828[_0x5d7a3f]['id'],'name':_0x3ae828[_0x5d7a3f][_0xa7c2('0x71')],'custom':_0x3ae828[_0x5d7a3f][_0xa7c2('0x72')],'options':_0x3ae828[_0x5d7a3f]['data_type']===_0xa7c2('0x73')&&_0x3ae828[_0x5d7a3f][_0xa7c2('0x74')]['length']>-0x1?_['map'](_0x3ae828[_0x5d7a3f][_0xa7c2('0x74')],function(_0x3b7afb){return{'name':_0x3b7afb,'value':_0x3b7afb};}):[]});}}return{'count':_0x128cdc[_0xa7c2('0x41')],'rows':_0x128cdc};}else{return{'count':0x0,'rows':[]};}})[_0xa7c2('0x23')](respondWithResult(_0x58e776,null))[_0xa7c2('0x40')](function(_0x12006c){var _0x1ad84b=_0x441887[_0xa7c2('0x2f')][_0xa7c2('0x75')]?0x1f4:_0x12006c['statusCode']||0x1f4;logger[_0xa7c2('0x66')](_0xa7c2('0x76'),_0xa7c2('0x59'),_0x1ad84b,JSON[_0xa7c2('0x77')](_0x12006c));delete _0x12006c[_0xa7c2('0x27')];if(_0x1ad84b===0x191){_0x1ad84b=0x190;}_0x58e776[_0xa7c2('0x18')](_0x1ad84b)[_0xa7c2('0x78')](_0x441887[_0xa7c2('0x2f')][_0xa7c2('0x75')]?{'message':_0xa7c2('0x79'),'statusCode':_0x12006c[_0xa7c2('0x7a')]}:_0x12006c);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index aed67f0..44a03b8 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 _0xa7af=['refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','format','inspect','https://accounts.zoho.com','https://accounts.zoho.eu','POST','name','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','int_zoho_accounts','changed','serverUrl','clientSecret','code','host','slice','substring','lastIndexOf','zone','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','/oauth/v2/token','authorization_code','clientId','application/x-www-form-urlencoded','then','refresh_token'];(function(_0x5d76e0,_0x5621c3){var _0x646f77=function(_0x453870){while(--_0x453870){_0x5d76e0['push'](_0x5d76e0['shift']());}};_0x646f77(++_0x5621c3);}(_0xa7af,0x1a6));var _0xfa7a=function(_0x203b5c,_0x2384f1){_0x203b5c=_0x203b5c-0x0;var _0x20a057=_0xa7af[_0x203b5c];return _0x20a057;};'use strict';var _=require(_0xfa7a('0x0'));var util=require(_0xfa7a('0x1'));var logger=require(_0xfa7a('0x2'))(_0xfa7a('0x3'));var moment=require(_0xfa7a('0x4'));var BPromise=require(_0xfa7a('0x5'));var rp=require(_0xfa7a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfa7a('0x7'));var integrations=require(_0xfa7a('0x8'));module[_0xfa7a('0x9')]=function(_0x159a3b,_0x5d7694){return _0x159a3b[_0xfa7a('0xa')]('ZohoAccount',attributes,{'tableName':_0xfa7a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5ef398,_0x2c7893,_0x5a029b){if(_0x5ef398[_0xfa7a('0xc')]('zone')||_0x5ef398[_0xfa7a('0xc')](_0xfa7a('0xd'))||_0x5ef398[_0xfa7a('0xc')]('clientId')||_0x5ef398['changed'](_0xfa7a('0xe'))||_0x5ef398['changed'](_0xfa7a('0xf'))||_0x5ef398['changed'](_0xfa7a('0x10'))){var _0x33ec1c,_0x2a9506;_0x33ec1c=_0x5ef398['serverUrl'];var _0x351aab=_0x33ec1c[_0xfa7a('0x11')](-0x1);if(_0x351aab==='/'||_0x351aab==='\x5c'||_0x351aab===':'){_0x33ec1c=_0x33ec1c[_0xfa7a('0x12')](0x0,_0x33ec1c[_0xfa7a('0x13')](_0x351aab));}switch(_0x5ef398[_0xfa7a('0x14')]){case'US':_0x2a9506='https://accounts.zoho.com';break;case'AU':_0x2a9506=_0xfa7a('0x15');break;case'IN':_0x2a9506='https://accounts.zoho.in';break;case'CN':_0x2a9506=_0xfa7a('0x16');break;default:_0x2a9506='https://accounts.zoho.eu';break;}var _0x38ef9d={'method':'POST','uri':_0x2a9506+_0xfa7a('0x17'),'form':{'grant_type':_0xfa7a('0x18'),'client_id':_0x5ef398[_0xfa7a('0x19')],'client_secret':_0x5ef398[_0xfa7a('0xe')],'redirect_uri':_0x5ef398[_0xfa7a('0xd')],'code':_0x5ef398[_0xfa7a('0xf')]},'headers':{'Content-Type':_0xfa7a('0x1a')}};return rp(_0x38ef9d)[_0xfa7a('0x1b')](function(_0x42d6ae){var _0x3faf9e=JSON['parse'](_0x42d6ae);if(_0x3faf9e[_0xfa7a('0x1c')]){_0x5ef398[_0xfa7a('0x1d')]=_0x3faf9e[_0xfa7a('0x1c')];logger[_0xfa7a('0x1e')](util['format'](_0xfa7a('0x1f'),_0x5ef398['name'],_0x5ef398['id']));}else{logger[_0xfa7a('0x20')](util['format'](_0xfa7a('0x21'),_0x5ef398['name'],_0x5ef398['id']),util['inspect'](_0x3faf9e,{'showHidden':![],'depth':null}));}return _0x5a029b(null,_0x2c7893);})[_0xfa7a('0x22')](function(_0x2d0b1b){logger[_0xfa7a('0x20')](util[_0xfa7a('0x23')](_0xfa7a('0x21'),_0x5ef398['name'],_0x5ef398['id']),util[_0xfa7a('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x5a029b(_0x2d0b1b);});}else{return _0x5a029b(null,_0x2c7893);}},'beforeUpdate':function(_0x56bf80,_0x622c2b,_0x55eb38){if(_0x56bf80[_0xfa7a('0xc')](_0xfa7a('0x14'))||_0x56bf80[_0xfa7a('0xc')](_0xfa7a('0xd'))||_0x56bf80[_0xfa7a('0xc')](_0xfa7a('0x19'))||_0x56bf80[_0xfa7a('0xc')](_0xfa7a('0xe'))||_0x56bf80['changed']('code')||_0x56bf80[_0xfa7a('0xc')]('host')){var _0x134fdc,_0x439ecd;_0x134fdc=_0x56bf80['serverUrl'];var _0x122255=_0x134fdc[_0xfa7a('0x11')](-0x1);if(_0x122255==='/'||_0x122255==='\x5c'||_0x122255===':'){_0x134fdc=_0x134fdc[_0xfa7a('0x12')](0x0,_0x134fdc['lastIndexOf'](_0x122255));}switch(_0x56bf80['zone']){case'US':_0x439ecd=_0xfa7a('0x25');break;case'AU':_0x439ecd='https://accounts.zoho.com.au';break;case'IN':_0x439ecd='https://accounts.zoho.in';break;case'CN':_0x439ecd='https://accounts.zoho.com.cn';break;default:_0x439ecd=_0xfa7a('0x26');break;}var _0x323b59={'method':_0xfa7a('0x27'),'uri':_0x439ecd+_0xfa7a('0x17'),'form':{'grant_type':'authorization_code','client_id':_0x56bf80[_0xfa7a('0x19')],'client_secret':_0x56bf80[_0xfa7a('0xe')],'redirect_uri':_0x56bf80[_0xfa7a('0xd')],'code':_0x56bf80[_0xfa7a('0xf')]},'headers':{'Content-Type':_0xfa7a('0x1a')}};return rp(_0x323b59)['then'](function(_0x465ef1){var _0x3e0e2a=JSON['parse'](_0x465ef1);if(_0x3e0e2a[_0xfa7a('0x1c')]){_0x56bf80['refreshToken']=_0x3e0e2a[_0xfa7a('0x1c')];logger[_0xfa7a('0x1e')](util[_0xfa7a('0x23')](_0xfa7a('0x1f'),_0x56bf80['name'],_0x56bf80['id']));}else{logger['error'](util[_0xfa7a('0x23')](_0xfa7a('0x21'),_0x56bf80[_0xfa7a('0x28')],_0x56bf80['id']),util[_0xfa7a('0x24')](_0x3e0e2a,{'showHidden':![],'depth':null}));}return _0x55eb38(null,_0x622c2b);})[_0xfa7a('0x22')](function(_0x13cc31){logger['error'](util[_0xfa7a('0x23')](_0xfa7a('0x21'),_0x56bf80['name'],_0x56bf80['id']),util[_0xfa7a('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x55eb38(_0x13cc31);});}else{return _0x55eb38(null,_0x622c2b);}}}});}; \ No newline at end of file +var _0x3ccf=['https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','refresh_token','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','https://accounts.zoho.in','refreshToken','info','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','zone','changed','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au'];(function(_0x4f1b36,_0x511442){var _0x4d9eb1=function(_0x261304){while(--_0x261304){_0x4f1b36['push'](_0x4f1b36['shift']());}};_0x4d9eb1(++_0x511442);}(_0x3ccf,0x66));var _0xf3cc=function(_0xe0c3e,_0x555de3){_0xe0c3e=_0xe0c3e-0x0;var _0x3d232f=_0x3ccf[_0xe0c3e];return _0x3d232f;};'use strict';var _=require('lodash');var util=require(_0xf3cc('0x0'));var logger=require(_0xf3cc('0x1'))('api');var moment=require(_0xf3cc('0x2'));var BPromise=require(_0xf3cc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf3cc('0x4'));var rimraf=require(_0xf3cc('0x5'));var config=require(_0xf3cc('0x6'));var attributes=require(_0xf3cc('0x7'));var integrations=require(_0xf3cc('0x8'));module[_0xf3cc('0x9')]=function(_0x24fc62,_0x4fefc6){return _0x24fc62[_0xf3cc('0xa')](_0xf3cc('0xb'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4861c7,_0x511ccc,_0x2e54b0){if(_0x4861c7['changed'](_0xf3cc('0xc'))||_0x4861c7[_0xf3cc('0xd')](_0xf3cc('0xe'))||_0x4861c7['changed'](_0xf3cc('0xf'))||_0x4861c7[_0xf3cc('0xd')](_0xf3cc('0x10'))||_0x4861c7['changed'](_0xf3cc('0x11'))||_0x4861c7[_0xf3cc('0xd')](_0xf3cc('0x12'))){var _0x29fecd,_0x57c968;_0x29fecd=_0x4861c7['serverUrl'];var _0x3de035=_0x29fecd[_0xf3cc('0x13')](-0x1);if(_0x3de035==='/'||_0x3de035==='\x5c'||_0x3de035===':'){_0x29fecd=_0x29fecd[_0xf3cc('0x14')](0x0,_0x29fecd[_0xf3cc('0x15')](_0x3de035));}switch(_0x4861c7[_0xf3cc('0xc')]){case'US':_0x57c968=_0xf3cc('0x16');break;case'AU':_0x57c968=_0xf3cc('0x17');break;case'IN':_0x57c968='https://accounts.zoho.in';break;case'CN':_0x57c968=_0xf3cc('0x18');break;default:_0x57c968=_0xf3cc('0x19');break;}var _0x21ee7e={'method':_0xf3cc('0x1a'),'uri':_0x57c968+_0xf3cc('0x1b'),'form':{'grant_type':_0xf3cc('0x1c'),'client_id':_0x4861c7['clientId'],'client_secret':_0x4861c7[_0xf3cc('0x10')],'redirect_uri':_0x4861c7[_0xf3cc('0xe')],'code':_0x4861c7[_0xf3cc('0x11')]},'headers':{'Content-Type':_0xf3cc('0x1d')}};return rp(_0x21ee7e)[_0xf3cc('0x1e')](function(_0x559c36){var _0xebb0aa=JSON['parse'](_0x559c36);if(_0xebb0aa[_0xf3cc('0x1f')]){_0x4861c7['refreshToken']=_0xebb0aa['refresh_token'];logger['info'](util[_0xf3cc('0x20')](_0xf3cc('0x21'),_0x4861c7[_0xf3cc('0x22')],_0x4861c7['id']));}else{logger[_0xf3cc('0x23')](util[_0xf3cc('0x20')](_0xf3cc('0x24'),_0x4861c7['name'],_0x4861c7['id']),util[_0xf3cc('0x25')](_0xebb0aa,{'showHidden':![],'depth':null}));}return _0x2e54b0(null,_0x511ccc);})[_0xf3cc('0x26')](function(_0xf9943b){logger[_0xf3cc('0x23')](util['format'](_0xf3cc('0x24'),_0x4861c7[_0xf3cc('0x22')],_0x4861c7['id']),util[_0xf3cc('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x2e54b0(_0xf9943b);});}else{return _0x2e54b0(null,_0x511ccc);}},'beforeUpdate':function(_0x76f34,_0xef726c,_0x4fb6f7){if(_0x76f34[_0xf3cc('0xd')]('zone')||_0x76f34[_0xf3cc('0xd')](_0xf3cc('0xe'))||_0x76f34[_0xf3cc('0xd')](_0xf3cc('0xf'))||_0x76f34[_0xf3cc('0xd')]('clientSecret')||_0x76f34['changed'](_0xf3cc('0x11'))||_0x76f34[_0xf3cc('0xd')](_0xf3cc('0x12'))){var _0x488e24,_0x10f759;_0x488e24=_0x76f34['serverUrl'];var _0x3d99e2=_0x488e24['slice'](-0x1);if(_0x3d99e2==='/'||_0x3d99e2==='\x5c'||_0x3d99e2===':'){_0x488e24=_0x488e24['substring'](0x0,_0x488e24['lastIndexOf'](_0x3d99e2));}switch(_0x76f34[_0xf3cc('0xc')]){case'US':_0x10f759=_0xf3cc('0x16');break;case'AU':_0x10f759=_0xf3cc('0x17');break;case'IN':_0x10f759=_0xf3cc('0x27');break;case'CN':_0x10f759='https://accounts.zoho.com.cn';break;default:_0x10f759='https://accounts.zoho.eu';break;}var _0x3c50db={'method':'POST','uri':_0x10f759+'/oauth/v2/token','form':{'grant_type':_0xf3cc('0x1c'),'client_id':_0x76f34['clientId'],'client_secret':_0x76f34[_0xf3cc('0x10')],'redirect_uri':_0x76f34[_0xf3cc('0xe')],'code':_0x76f34[_0xf3cc('0x11')]},'headers':{'Content-Type':_0xf3cc('0x1d')}};return rp(_0x3c50db)['then'](function(_0x477804){var _0x787dd6=JSON['parse'](_0x477804);if(_0x787dd6[_0xf3cc('0x1f')]){_0x76f34[_0xf3cc('0x28')]=_0x787dd6[_0xf3cc('0x1f')];logger[_0xf3cc('0x29')](util[_0xf3cc('0x20')](_0xf3cc('0x21'),_0x76f34[_0xf3cc('0x22')],_0x76f34['id']));}else{logger[_0xf3cc('0x23')](util[_0xf3cc('0x20')](_0xf3cc('0x24'),_0x76f34[_0xf3cc('0x22')],_0x76f34['id']),util[_0xf3cc('0x25')](_0x787dd6,{'showHidden':![],'depth':null}));}return _0x4fb6f7(null,_0xef726c);})['catch'](function(_0x32cd1f){logger[_0xf3cc('0x23')](util[_0xf3cc('0x20')](_0xf3cc('0x24'),_0x76f34['name'],_0x76f34['id']),util[_0xf3cc('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x4fb6f7(_0x32cd1f);});}else{return _0x4fb6f7(null,_0xef726c);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index c42c7c9..d817617 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 _0x14a0=['limit','include','model','map','find','ShowZohoAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','info','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes'];(function(_0x123876,_0x322dc8){var _0xefb957=function(_0x5582cc){while(--_0x5582cc){_0x123876['push'](_0x123876['shift']());}};_0xefb957(++_0x322dc8);}(_0x14a0,0x8e));var _0x014a=function(_0x561025,_0xa3e8d2){_0x561025=_0x561025-0x0;var _0x162c11=_0x14a0[_0x561025];return _0x162c11;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('ZohoAccount,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});}exports[_0x014a('0x15')]=function(_0x12d339){var _0x61ec9f=this;return new Promise(function(_0x263b07,_0x16490a){return db[_0x014a('0x16')][_0x014a('0x17')]({'raw':_0x12d339[_0x014a('0x18')]?_0x12d339[_0x014a('0x18')][_0x014a('0x19')]===undefined?!![]:![]:!![],'where':_0x12d339['options']?_0x12d339[_0x014a('0x18')][_0x014a('0x1a')]||null:null,'attributes':_0x12d339[_0x014a('0x18')]?_0x12d339[_0x014a('0x18')][_0x014a('0x1b')]||null:null,'limit':_0x12d339[_0x014a('0x18')]?_0x12d339[_0x014a('0x18')][_0x014a('0x1c')]||null:null,'include':_0x12d339[_0x014a('0x18')]?_0x12d339['options'][_0x014a('0x1d')]?_['map'](_0x12d339[_0x014a('0x18')][_0x014a('0x1d')],function(_0x44d921){return{'model':db[_0x44d921[_0x014a('0x1e')]],'as':_0x44d921['as'],'attributes':_0x44d921[_0x014a('0x1b')],'include':_0x44d921[_0x014a('0x1d')]?_[_0x014a('0x1f')](_0x44d921[_0x014a('0x1d')],function(_0x165a42){return{'model':db[_0x165a42['model']],'as':_0x165a42['as'],'attributes':_0x165a42[_0x014a('0x1b')],'include':_0x165a42['include']?_[_0x014a('0x1f')](_0x165a42[_0x014a('0x1d')],function(_0x4f1c44){return{'model':db[_0x4f1c44['model']],'as':_0x4f1c44['as'],'attributes':_0x4f1c44[_0x014a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x014a('0xa')](function(_0x143346){logger['info'](_0x014a('0x15'),_0x12d339);logger[_0x014a('0xb')]('GetZohoAccount',_0x12d339,JSON[_0x014a('0xd')](_0x143346));_0x263b07(_0x143346);})[_0x014a('0x14')](function(_0x496040){logger['error'](_0x014a('0x15'),_0x496040[_0x014a('0x11')],_0x12d339);_0x16490a(_0x61ec9f[_0x014a('0xe')](0x1f4,_0x496040[_0x014a('0x11')]));});});};exports['ShowZohoAccount']=function(_0x434038){var _0x147e7e=this;return new Promise(function(_0x15af07,_0x402d3b){return db[_0x014a('0x16')][_0x014a('0x20')]({'raw':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')][_0x014a('0x19')]===undefined?!![]:![]:!![],'where':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')]['where']||null:null,'attributes':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')][_0x014a('0x1b')]||null:null,'include':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')][_0x014a('0x1d')]?_[_0x014a('0x1f')](_0x434038['options'][_0x014a('0x1d')],function(_0x325b3c){return{'model':db[_0x325b3c['model']],'as':_0x325b3c['as'],'attributes':_0x325b3c[_0x014a('0x1b')],'include':_0x325b3c[_0x014a('0x1d')]?_[_0x014a('0x1f')](_0x325b3c[_0x014a('0x1d')],function(_0x329136){return{'model':db[_0x329136[_0x014a('0x1e')]],'as':_0x329136['as'],'attributes':_0x329136[_0x014a('0x1b')],'include':_0x329136[_0x014a('0x1d')]?_['map'](_0x329136[_0x014a('0x1d')],function(_0x1dfe6e){return{'model':db[_0x1dfe6e[_0x014a('0x1e')]],'as':_0x1dfe6e['as'],'attributes':_0x1dfe6e[_0x014a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x427c7a){logger[_0x014a('0x12')](_0x014a('0x21'),_0x434038);logger[_0x014a('0xb')](_0x014a('0x21'),_0x434038,JSON[_0x014a('0xd')](_0x427c7a));_0x15af07(_0x427c7a);})[_0x014a('0x14')](function(_0x36187b){logger[_0x014a('0xe')]('ShowZohoAccount',_0x36187b[_0x014a('0x11')],_0x434038);_0x402d3b(_0x147e7e['error'](0x1f4,_0x36187b[_0x014a('0x11')]));});});}; \ No newline at end of file +var _0x6829=['client','http','then','ZohoAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','ZohoAccount','findAll','options','raw','attributes','limit','include','map','model','GetZohoAccount','catch','ShowZohoAccount','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x69f703,_0x1a80b9){var _0x23901c=function(_0x430114){while(--_0x430114){_0x69f703['push'](_0x69f703['shift']());}};_0x23901c(++_0x1a80b9);}(_0x6829,0x14c));var _0x9682=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x6829[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x9682('0x0'));var util=require(_0x9682('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9682('0x2'));var db=require(_0x9682('0x3'))['db'];var utils=require(_0x9682('0x4'));var logger=require(_0x9682('0x5'))(_0x9682('0x6'));var config=require(_0x9682('0x7'));var jayson=require(_0x9682('0x8'));var client=jayson[_0x9682('0x9')][_0x9682('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4cec91,_0x37ab0a,_0x1cca2f){return new BPromise(function(_0x576a39,_0x519138){return client['request'](_0x4cec91,_0x1cca2f)[_0x9682('0xb')](function(_0x1b27c2){logger['info'](_0x9682('0xc'),_0x37ab0a,'request\x20sent');logger[_0x9682('0xd')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x37ab0a,_0x9682('0xe'),JSON[_0x9682('0xf')](_0x1b27c2));if(_0x1b27c2[_0x9682('0x10')]){if(_0x1b27c2['error']['code']===0x1f4){logger[_0x9682('0x10')](_0x9682('0xc'),_0x37ab0a,_0x1b27c2['error'][_0x9682('0x11')]);return _0x519138(_0x1b27c2['error'][_0x9682('0x11')]);}logger[_0x9682('0x10')](_0x9682('0xc'),_0x37ab0a,_0x1b27c2[_0x9682('0x10')][_0x9682('0x11')]);return _0x576a39(_0x1b27c2[_0x9682('0x10')][_0x9682('0x11')]);}else{logger[_0x9682('0x12')](_0x9682('0xc'),_0x37ab0a,_0x9682('0xe'));_0x576a39(_0x1b27c2['result'][_0x9682('0x11')]);}})['catch'](function(_0x23eef6){logger[_0x9682('0x10')](_0x9682('0xc'),_0x37ab0a,_0x23eef6);_0x519138(_0x23eef6);});});}exports['GetZohoAccount']=function(_0x1c73ee){var _0x4e0dfb=this;return new Promise(function(_0x107291,_0x51c1a8){return db[_0x9682('0x13')][_0x9682('0x14')]({'raw':_0x1c73ee[_0x9682('0x15')]?_0x1c73ee[_0x9682('0x15')][_0x9682('0x16')]===undefined?!![]:![]:!![],'where':_0x1c73ee['options']?_0x1c73ee['options']['where']||null:null,'attributes':_0x1c73ee[_0x9682('0x15')]?_0x1c73ee['options'][_0x9682('0x17')]||null:null,'limit':_0x1c73ee[_0x9682('0x15')]?_0x1c73ee['options'][_0x9682('0x18')]||null:null,'include':_0x1c73ee[_0x9682('0x15')]?_0x1c73ee[_0x9682('0x15')][_0x9682('0x19')]?_[_0x9682('0x1a')](_0x1c73ee[_0x9682('0x15')][_0x9682('0x19')],function(_0x40e927){return{'model':db[_0x40e927[_0x9682('0x1b')]],'as':_0x40e927['as'],'attributes':_0x40e927[_0x9682('0x17')],'include':_0x40e927['include']?_[_0x9682('0x1a')](_0x40e927[_0x9682('0x19')],function(_0x88419f){return{'model':db[_0x88419f[_0x9682('0x1b')]],'as':_0x88419f['as'],'attributes':_0x88419f[_0x9682('0x17')],'include':_0x88419f['include']?_[_0x9682('0x1a')](_0x88419f[_0x9682('0x19')],function(_0x44808c){return{'model':db[_0x44808c[_0x9682('0x1b')]],'as':_0x44808c['as'],'attributes':_0x44808c[_0x9682('0x17')]};}):[]};}):[]};}):[]:[]})[_0x9682('0xb')](function(_0x48e821){logger[_0x9682('0x12')](_0x9682('0x1c'),_0x1c73ee);logger[_0x9682('0xd')](_0x9682('0x1c'),_0x1c73ee,JSON[_0x9682('0xf')](_0x48e821));_0x107291(_0x48e821);})[_0x9682('0x1d')](function(_0x176624){logger[_0x9682('0x10')]('GetZohoAccount',_0x176624[_0x9682('0x11')],_0x1c73ee);_0x51c1a8(_0x4e0dfb['error'](0x1f4,_0x176624[_0x9682('0x11')]));});});};exports[_0x9682('0x1e')]=function(_0x598248){var _0x54c860=this;return new Promise(function(_0x4b4c5d,_0x5a2ad3){return db[_0x9682('0x13')]['find']({'raw':_0x598248[_0x9682('0x15')]?_0x598248[_0x9682('0x15')][_0x9682('0x16')]===undefined?!![]:![]:!![],'where':_0x598248[_0x9682('0x15')]?_0x598248['options']['where']||null:null,'attributes':_0x598248[_0x9682('0x15')]?_0x598248[_0x9682('0x15')][_0x9682('0x17')]||null:null,'include':_0x598248[_0x9682('0x15')]?_0x598248[_0x9682('0x15')]['include']?_['map'](_0x598248[_0x9682('0x15')][_0x9682('0x19')],function(_0x76f489){return{'model':db[_0x76f489[_0x9682('0x1b')]],'as':_0x76f489['as'],'attributes':_0x76f489[_0x9682('0x17')],'include':_0x76f489[_0x9682('0x19')]?_[_0x9682('0x1a')](_0x76f489['include'],function(_0x27c9dd){return{'model':db[_0x27c9dd[_0x9682('0x1b')]],'as':_0x27c9dd['as'],'attributes':_0x27c9dd[_0x9682('0x17')],'include':_0x27c9dd[_0x9682('0x19')]?_[_0x9682('0x1a')](_0x27c9dd['include'],function(_0x194bda){return{'model':db[_0x194bda['model']],'as':_0x194bda['as'],'attributes':_0x194bda[_0x9682('0x17')]};}):[]};}):[]};}):[]:[]})[_0x9682('0xb')](function(_0x43d782){logger[_0x9682('0x12')](_0x9682('0x1e'),_0x598248);logger[_0x9682('0xd')](_0x9682('0x1e'),_0x598248,JSON['stringify'](_0x43d782));_0x4b4c5d(_0x43d782);})[_0x9682('0x1d')](function(_0x555634){logger[_0x9682('0x10')]('ShowZohoAccount',_0x555634[_0x9682('0x11')],_0x598248);_0x5a2ad3(_0x54c860[_0x9682('0x10')](0x1f4,_0x555634[_0x9682('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 30b74c4..cf6e405 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 _0x9ca7=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','post','create','delete','destroy','exports'];(function(_0x381d3c,_0x4bc7d0){var _0x12542e=function(_0xc3e0c7){while(--_0xc3e0c7){_0x381d3c['push'](_0x381d3c['shift']());}};_0x12542e(++_0x4bc7d0);}(_0x9ca7,0x93));var _0x79ca=function(_0x37f5e4,_0xc6e1d6){_0x37f5e4=_0x37f5e4-0x0;var _0x463310=_0x9ca7[_0x37f5e4];return _0x463310;};'use strict';var multer=require('multer');var util=require(_0x79ca('0x0'));var path=require(_0x79ca('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x79ca('0x2')]();var fs_extra=require(_0x79ca('0x3'));var auth=require(_0x79ca('0x4'));var interaction=require(_0x79ca('0x5'));var config=require(_0x79ca('0x6'));var controller=require(_0x79ca('0x7'));router[_0x79ca('0x8')]('/',auth[_0x79ca('0x9')](),controller[_0x79ca('0xa')]);router['get'](_0x79ca('0xb'),auth[_0x79ca('0x9')](),controller['show']);router[_0x79ca('0x8')](_0x79ca('0xc'),auth[_0x79ca('0x9')](),controller[_0x79ca('0xd')]);router[_0x79ca('0x8')]('/:id/subjects',auth[_0x79ca('0x9')](),controller[_0x79ca('0xe')]);router['get'](_0x79ca('0xf'),auth[_0x79ca('0x9')](),controller['getDescriptions']);router[_0x79ca('0x10')]('/',auth[_0x79ca('0x9')](),controller[_0x79ca('0x11')]);router['put'](_0x79ca('0xb'),auth[_0x79ca('0x9')](),controller['update']);router[_0x79ca('0x12')](_0x79ca('0xb'),auth[_0x79ca('0x9')](),controller[_0x79ca('0x13')]);module[_0x79ca('0x14')]=router; \ No newline at end of file +var _0xbd0c=['index','/:id','getFields','/:id/subjects','getDescriptions','create','put','delete','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','./intZohoConfiguration.controller','get','isAuthenticated'];(function(_0x3c28b3,_0x595478){var _0x317ef6=function(_0x17187e){while(--_0x17187e){_0x3c28b3['push'](_0x3c28b3['shift']());}};_0x317ef6(++_0x595478);}(_0xbd0c,0x105));var _0xcbd0=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbd0c[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xcbd0('0x0'));var util=require('util');var path=require(_0xcbd0('0x1'));var timeout=require(_0xcbd0('0x2'));var express=require(_0xcbd0('0x3'));var router=express[_0xcbd0('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcbd0('0x5'));var config=require('../../config/environment');var controller=require(_0xcbd0('0x6'));router[_0xcbd0('0x7')]('/',auth[_0xcbd0('0x8')](),controller[_0xcbd0('0x9')]);router[_0xcbd0('0x7')](_0xcbd0('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xcbd0('0x7')]('/:id/fields',auth[_0xcbd0('0x8')](),controller[_0xcbd0('0xb')]);router[_0xcbd0('0x7')](_0xcbd0('0xc'),auth[_0xcbd0('0x8')](),controller['getSubjects']);router[_0xcbd0('0x7')]('/:id/descriptions',auth[_0xcbd0('0x8')](),controller[_0xcbd0('0xd')]);router['post']('/',auth[_0xcbd0('0x8')](),controller[_0xcbd0('0xe')]);router[_0xcbd0('0xf')](_0xcbd0('0xa'),auth[_0xcbd0('0x8')](),controller['update']);router[_0xcbd0('0x10')](_0xcbd0('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xcbd0('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index be0a055..73d51f3 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 _0xadb8=['ENUM','contact_lead','STRING','lead','contact','nothing'];(function(_0x51be34,_0x24e7d6){var _0x12a2a8=function(_0x571b95){while(--_0x571b95){_0x51be34['push'](_0x51be34['shift']());}};_0x12a2a8(++_0x24e7d6);}(_0xadb8,0x1d0));var _0x8adb=function(_0x358806,_0x322b66){_0x358806=_0x358806-0x0;var _0x19fdcb=_0xadb8[_0x358806];return _0x19fdcb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8adb('0x0')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x8adb('0x1'),_0x8adb('0x2'),_0x8adb('0x3')),'defaultValue':_0x8adb('0x1')},'moduleSearch':{'type':Sequelize[_0x8adb('0x4')](_0x8adb('0x5'),_0x8adb('0x2'),'lead'),'defaultValue':_0x8adb('0x5')},'description':{'type':Sequelize[_0x8adb('0x0')]}}; \ No newline at end of file +var _0x2c22=['ENUM','lead','contact','nothing','contact_lead','exports','STRING'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x2c22,0x1cc));var _0x22c2=function(_0xd348b7,_0x32ac90){_0xd348b7=_0xd348b7-0x0;var _0x27862f=_0x2c22[_0xd348b7];return _0x27862f;};'use strict';var Sequelize=require('sequelize');module[_0x22c2('0x0')]={'name':{'type':Sequelize[_0x22c2('0x1')]},'moduleCreate':{'type':Sequelize[_0x22c2('0x2')](_0x22c2('0x3'),_0x22c2('0x4'),_0x22c2('0x5')),'defaultValue':_0x22c2('0x3')},'moduleSearch':{'type':Sequelize[_0x22c2('0x2')](_0x22c2('0x6'),_0x22c2('0x4'),'lead'),'defaultValue':'contact_lead'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 00432e0..7dbf28c 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 _0xd116=['../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','key','query','filters','attributes','intersection','model','fields','length','nolimit','order','sort','pick','where','merge','filter','options','include','ZohoConfiguration','rows','show','keys','rawAttributes','includeAll','find','create','catch','body','params','getFields','findOne','ZohoField','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xd116,0x165));var _0x6d11=function(_0xcbbe61,_0x4e3a05){_0xcbbe61=_0xcbbe61-0x0;var _0x3ce57e=_0xd116[_0xcbbe61];return _0x3ce57e;};'use strict';var emlformat=require(_0x6d11('0x0'));var rimraf=require(_0x6d11('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6d11('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6d11('0x3'));var Mustache=require(_0x6d11('0x4'));var util=require('util');var path=require(_0x6d11('0x5'));var sox=require(_0x6d11('0x6'));var csv=require('to-csv');var ejs=require(_0x6d11('0x7'));var fs=require('fs');var fs_extra=require(_0x6d11('0x8'));var _=require(_0x6d11('0x9'));var squel=require(_0x6d11('0xa'));var crypto=require(_0x6d11('0xb'));var jsforce=require(_0x6d11('0xc'));var deskjs=require(_0x6d11('0xd'));var toCsv=require(_0x6d11('0xe'));var querystring=require(_0x6d11('0xf'));var Papa=require(_0x6d11('0x10'));var Redis=require(_0x6d11('0x11'));var authService=require(_0x6d11('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6d11('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6d11('0x14'))(_0x6d11('0x15'));var utils=require('../../config/utils');var config=require(_0x6d11('0x16'));var licenseUtil=require(_0x6d11('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a08af,_0x2025ef){_0x2025ef=_0x2025ef||0xcc;return function(_0x3113f2){if(_0x3113f2){return _0x4a08af[_0x6d11('0x18')](_0x2025ef);}return _0x4a08af[_0x6d11('0x19')](_0x2025ef)['end']();};}function respondWithResult(_0x95be08,_0x156b80){_0x156b80=_0x156b80||0xc8;return function(_0x20da04){if(_0x20da04){return _0x95be08[_0x6d11('0x19')](_0x156b80)[_0x6d11('0x1a')](_0x20da04);}};}function respondWithFilteredResult(_0x48f4a1,_0x117b3d){return function(_0x10328f){if(_0x10328f){var _0x1e5d6d=typeof _0x117b3d['offset']===_0x6d11('0x1b')&&typeof _0x117b3d[_0x6d11('0x1c')]==='undefined';var _0x290601=_0x10328f[_0x6d11('0x1d')];var _0x3a63c3=_0x1e5d6d?0x0:_0x117b3d[_0x6d11('0x1e')];var _0x1b33c0=_0x1e5d6d?_0x10328f[_0x6d11('0x1d')]:_0x117b3d[_0x6d11('0x1e')]+_0x117b3d[_0x6d11('0x1c')];var _0x25b90c;if(_0x1b33c0>=_0x290601){_0x1b33c0=_0x290601;_0x25b90c=0xc8;}else{_0x25b90c=0xce;}_0x48f4a1[_0x6d11('0x19')](_0x25b90c);return _0x48f4a1['set'](_0x6d11('0x1f'),_0x3a63c3+'-'+_0x1b33c0+'/'+_0x290601)['json'](_0x10328f);}return null;};}function patchUpdates(_0x295756){return function(_0x171563){try{jsonpatch[_0x6d11('0x20')](_0x171563,_0x295756,!![]);}catch(_0x6a72b4){return BPromise['reject'](_0x6a72b4);}return _0x171563[_0x6d11('0x21')]();};}function saveUpdates(_0x4f2dab,_0xfb77db){return function(_0x34548b){if(_0x34548b){return _0x34548b[_0x6d11('0x22')](_0x4f2dab)[_0x6d11('0x23')](function(_0x4dc623){return _0x4dc623;});}return null;};}function removeEntity(_0x45375f,_0x24cc26){return function(_0x5831c2){if(_0x5831c2){return _0x5831c2[_0x6d11('0x24')]()['then'](function(){_0x45375f[_0x6d11('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x159302,_0x3c9309){return function(_0xf5bba1){if(!_0xf5bba1){_0x159302[_0x6d11('0x18')](0x194);}return _0xf5bba1;};}function handleError(_0x14559a,_0x260502){_0x260502=_0x260502||0x1f4;return function(_0x3f314c){logger[_0x6d11('0x25')](_0x3f314c[_0x6d11('0x26')]);if(_0x3f314c[_0x6d11('0x27')]){delete _0x3f314c['name'];}_0x14559a[_0x6d11('0x19')](_0x260502)['send'](_0x3f314c);};}exports[_0x6d11('0x28')]=function(_0x335b2d,_0x1fa758){var _0x37a40e={},_0x299178={},_0x4e75cf={'count':0x0,'rows':[]};var _0x35bd5e=_[_0x6d11('0x29')](db['ZohoConfiguration']['rawAttributes'],function(_0x2c59f7){return{'name':_0x2c59f7['fieldName'],'type':_0x2c59f7['type'][_0x6d11('0x2a')]};});_0x299178['model']=_['map'](_0x35bd5e,'name');_0x299178[_0x6d11('0x2b')]=_['keys'](_0x335b2d[_0x6d11('0x2b')]);_0x299178[_0x6d11('0x2c')]=_['intersection'](_0x299178['model'],_0x299178[_0x6d11('0x2b')]);_0x37a40e[_0x6d11('0x2d')]=_[_0x6d11('0x2e')](_0x299178[_0x6d11('0x2f')],qs[_0x6d11('0x30')](_0x335b2d[_0x6d11('0x2b')]['fields']));_0x37a40e[_0x6d11('0x2d')]=_0x37a40e[_0x6d11('0x2d')][_0x6d11('0x31')]?_0x37a40e['attributes']:_0x299178[_0x6d11('0x2f')];if(!_0x335b2d[_0x6d11('0x2b')]['hasOwnProperty'](_0x6d11('0x32'))){_0x37a40e[_0x6d11('0x1c')]=qs[_0x6d11('0x1c')](_0x335b2d['query'][_0x6d11('0x1c')]);_0x37a40e[_0x6d11('0x1e')]=qs[_0x6d11('0x1e')](_0x335b2d[_0x6d11('0x2b')]['offset']);}_0x37a40e[_0x6d11('0x33')]=qs[_0x6d11('0x34')](_0x335b2d[_0x6d11('0x2b')]['sort']);_0x37a40e['where']=qs[_0x6d11('0x2c')](_[_0x6d11('0x35')](_0x335b2d[_0x6d11('0x2b')],_0x299178[_0x6d11('0x2c')]),_0x35bd5e);if(_0x335b2d[_0x6d11('0x2b')]['filter']){_0x37a40e[_0x6d11('0x36')]=_[_0x6d11('0x37')](_0x37a40e[_0x6d11('0x36')],{'$or':_[_0x6d11('0x29')](_0x35bd5e,function(_0x257033){if(_0x257033['type']!=='VIRTUAL'){var _0x426065={};_0x426065[_0x257033[_0x6d11('0x27')]]={'$like':'%'+_0x335b2d[_0x6d11('0x2b')][_0x6d11('0x38')]+'%'};return _0x426065;}})});}_0x37a40e=_[_0x6d11('0x37')]({},_0x37a40e,_0x335b2d[_0x6d11('0x39')]);var _0x514bb1={'where':_0x37a40e[_0x6d11('0x36')]};return db['ZohoConfiguration']['count'](_0x514bb1)['then'](function(_0x47e303){_0x4e75cf[_0x6d11('0x1d')]=_0x47e303;if(_0x335b2d['query']['includeAll']){_0x37a40e[_0x6d11('0x3a')]=[{'all':!![]}];}return db[_0x6d11('0x3b')]['findAll'](_0x37a40e);})[_0x6d11('0x23')](function(_0x5cf10b){_0x4e75cf[_0x6d11('0x3c')]=_0x5cf10b;return _0x4e75cf;})[_0x6d11('0x23')](respondWithFilteredResult(_0x1fa758,_0x37a40e))['catch'](handleError(_0x1fa758,null));};exports[_0x6d11('0x3d')]=function(_0x1c005e,_0x4562e5){var _0xb1fa91={'raw':![],'where':{'id':_0x1c005e['params']['id']}},_0x1b6b19={};_0x1b6b19[_0x6d11('0x2f')]=_[_0x6d11('0x3e')](db[_0x6d11('0x3b')][_0x6d11('0x3f')]);_0x1b6b19[_0x6d11('0x2b')]=_[_0x6d11('0x3e')](_0x1c005e['query']);_0x1b6b19[_0x6d11('0x2c')]=_[_0x6d11('0x2e')](_0x1b6b19[_0x6d11('0x2f')],_0x1b6b19[_0x6d11('0x2b')]);_0xb1fa91['attributes']=_[_0x6d11('0x2e')](_0x1b6b19[_0x6d11('0x2f')],qs[_0x6d11('0x30')](_0x1c005e['query']['fields']));_0xb1fa91[_0x6d11('0x2d')]=_0xb1fa91[_0x6d11('0x2d')][_0x6d11('0x31')]?_0xb1fa91[_0x6d11('0x2d')]:_0x1b6b19[_0x6d11('0x2f')];if(_0x1c005e[_0x6d11('0x2b')][_0x6d11('0x40')]){_0xb1fa91['include']=[{'all':!![]}];}_0xb1fa91=_['merge']({},_0xb1fa91,_0x1c005e[_0x6d11('0x39')]);return db[_0x6d11('0x3b')][_0x6d11('0x41')](_0xb1fa91)[_0x6d11('0x23')](handleEntityNotFound(_0x4562e5,null))[_0x6d11('0x23')](respondWithResult(_0x4562e5,null))['catch'](handleError(_0x4562e5,null));};exports[_0x6d11('0x42')]=function(_0x9bc79,_0x5df1c4){return db[_0x6d11('0x3b')][_0x6d11('0x42')](_0x9bc79['body'],{})[_0x6d11('0x23')](respondWithResult(_0x5df1c4,0xc9))[_0x6d11('0x43')](handleError(_0x5df1c4,null));};exports[_0x6d11('0x22')]=function(_0x46e46b,_0x3b218b){if(_0x46e46b[_0x6d11('0x44')]['id']){delete _0x46e46b[_0x6d11('0x44')]['id'];}return db[_0x6d11('0x3b')][_0x6d11('0x41')]({'where':{'id':_0x46e46b[_0x6d11('0x45')]['id']}})['then'](handleEntityNotFound(_0x3b218b,null))['then'](saveUpdates(_0x46e46b[_0x6d11('0x44')],null))[_0x6d11('0x23')](respondWithResult(_0x3b218b,null))[_0x6d11('0x43')](handleError(_0x3b218b,null));};exports[_0x6d11('0x24')]=function(_0x1f37b4,_0x55dfa2){return db['ZohoConfiguration']['find']({'where':{'id':_0x1f37b4[_0x6d11('0x45')]['id']}})['then'](handleEntityNotFound(_0x55dfa2,null))[_0x6d11('0x23')](removeEntity(_0x55dfa2,null))[_0x6d11('0x43')](handleError(_0x55dfa2,null));};exports[_0x6d11('0x46')]=function(_0x5336c9,_0x13cf80,_0x1c9c53){var _0x8a62ac={};var _0x1be78e={};var _0x4e1965;var _0x16d48a;return db[_0x6d11('0x3b')][_0x6d11('0x47')]({'where':{'id':_0x5336c9[_0x6d11('0x45')]['id']}})[_0x6d11('0x23')](handleEntityNotFound(_0x13cf80,null))[_0x6d11('0x23')](function(_0xf5d8c4){if(_0xf5d8c4){_0x4e1965=_0xf5d8c4;_0x1be78e[_0x6d11('0x2f')]=_[_0x6d11('0x3e')](db[_0x6d11('0x48')]['rawAttributes']);_0x1be78e[_0x6d11('0x2b')]=_[_0x6d11('0x3e')](_0x5336c9[_0x6d11('0x2b')]);_0x1be78e[_0x6d11('0x2c')]=_[_0x6d11('0x2e')](_0x1be78e['model'],_0x1be78e[_0x6d11('0x2b')]);_0x8a62ac[_0x6d11('0x2d')]=_[_0x6d11('0x2e')](_0x1be78e[_0x6d11('0x2f')],qs[_0x6d11('0x30')](_0x5336c9[_0x6d11('0x2b')]['fields']));_0x8a62ac['attributes']=_0x8a62ac['attributes']['length']?_0x8a62ac['attributes']:_0x1be78e[_0x6d11('0x2f')];_0x8a62ac[_0x6d11('0x33')]=qs[_0x6d11('0x34')](_0x5336c9[_0x6d11('0x2b')][_0x6d11('0x34')]);_0x8a62ac[_0x6d11('0x36')]=qs['filters'](_['pick'](_0x5336c9[_0x6d11('0x2b')],_0x1be78e[_0x6d11('0x2c')]));if(_0x5336c9[_0x6d11('0x2b')][_0x6d11('0x38')]){_0x8a62ac[_0x6d11('0x36')]=_[_0x6d11('0x37')](_0x8a62ac[_0x6d11('0x36')],{'$or':_['map'](_0x8a62ac[_0x6d11('0x2d')],function(_0x21e195){var _0x5e1555={};_0x5e1555[_0x21e195]={'$like':'%'+_0x5336c9[_0x6d11('0x2b')][_0x6d11('0x38')]+'%'};return _0x5e1555;})});}_0x8a62ac=_[_0x6d11('0x37')]({},_0x8a62ac,_0x5336c9[_0x6d11('0x39')]);return _0x4e1965['getFields'](_0x8a62ac);}})[_0x6d11('0x23')](function(_0x202c84){if(_0x202c84){_0x16d48a=_0x202c84[_0x6d11('0x31')];if(!_0x5336c9[_0x6d11('0x2b')][_0x6d11('0x49')](_0x6d11('0x32'))){_0x8a62ac[_0x6d11('0x1c')]=qs[_0x6d11('0x1c')](_0x5336c9[_0x6d11('0x2b')][_0x6d11('0x1c')]);_0x8a62ac[_0x6d11('0x1e')]=qs[_0x6d11('0x1e')](_0x5336c9[_0x6d11('0x2b')][_0x6d11('0x1e')]);}return _0x4e1965[_0x6d11('0x46')](_0x8a62ac);}})[_0x6d11('0x23')](function(_0x2450d3){if(_0x2450d3){return _0x2450d3?{'count':_0x16d48a,'rows':_0x2450d3}:null;}})[_0x6d11('0x23')](respondWithResult(_0x13cf80,null))[_0x6d11('0x43')](handleError(_0x13cf80,null));};exports['getSubjects']=function(_0x17ec1f,_0x358ff2,_0x103537){var _0x294c6c={};var _0x5085bb={};var _0x3ccf2e;var _0x14fd7d;return db[_0x6d11('0x3b')][_0x6d11('0x47')]({'where':{'id':_0x17ec1f[_0x6d11('0x45')]['id']}})[_0x6d11('0x23')](handleEntityNotFound(_0x358ff2,null))['then'](function(_0x52efe2){if(_0x52efe2){_0x3ccf2e=_0x52efe2;_0x5085bb['model']=_[_0x6d11('0x3e')](db[_0x6d11('0x48')][_0x6d11('0x3f')]);_0x5085bb[_0x6d11('0x2b')]=_['keys'](_0x17ec1f[_0x6d11('0x2b')]);_0x5085bb[_0x6d11('0x2c')]=_[_0x6d11('0x2e')](_0x5085bb[_0x6d11('0x2f')],_0x5085bb['query']);_0x294c6c[_0x6d11('0x2d')]=_[_0x6d11('0x2e')](_0x5085bb[_0x6d11('0x2f')],qs[_0x6d11('0x30')](_0x17ec1f[_0x6d11('0x2b')][_0x6d11('0x30')]));_0x294c6c['attributes']=_0x294c6c['attributes'][_0x6d11('0x31')]?_0x294c6c[_0x6d11('0x2d')]:_0x5085bb[_0x6d11('0x2f')];_0x294c6c[_0x6d11('0x33')]=qs['sort'](_0x17ec1f[_0x6d11('0x2b')][_0x6d11('0x34')]);_0x294c6c[_0x6d11('0x36')]=qs[_0x6d11('0x2c')](_[_0x6d11('0x35')](_0x17ec1f[_0x6d11('0x2b')],_0x5085bb[_0x6d11('0x2c')]));if(_0x17ec1f[_0x6d11('0x2b')][_0x6d11('0x38')]){_0x294c6c[_0x6d11('0x36')]=_[_0x6d11('0x37')](_0x294c6c[_0x6d11('0x36')],{'$or':_['map'](_0x294c6c['attributes'],function(_0x29c694){var _0x4faea4={};_0x4faea4[_0x29c694]={'$like':'%'+_0x17ec1f[_0x6d11('0x2b')][_0x6d11('0x38')]+'%'};return _0x4faea4;})});}_0x294c6c=_[_0x6d11('0x37')]({},_0x294c6c,_0x17ec1f[_0x6d11('0x39')]);return _0x3ccf2e['getSubjects'](_0x294c6c);}})[_0x6d11('0x23')](function(_0x516205){if(_0x516205){_0x14fd7d=_0x516205[_0x6d11('0x31')];if(!_0x17ec1f[_0x6d11('0x2b')][_0x6d11('0x49')](_0x6d11('0x32'))){_0x294c6c['limit']=qs[_0x6d11('0x1c')](_0x17ec1f[_0x6d11('0x2b')]['limit']);_0x294c6c[_0x6d11('0x1e')]=qs[_0x6d11('0x1e')](_0x17ec1f[_0x6d11('0x2b')]['offset']);}return _0x3ccf2e[_0x6d11('0x4a')](_0x294c6c);}})['then'](function(_0x53fd7b){if(_0x53fd7b){return _0x53fd7b?{'count':_0x14fd7d,'rows':_0x53fd7b}:null;}})['then'](respondWithResult(_0x358ff2,null))[_0x6d11('0x43')](handleError(_0x358ff2,null));};exports[_0x6d11('0x4b')]=function(_0x56f319,_0x2992a2,_0x591703){var _0x4b51bb={};var _0x4682ee={};var _0xe71cc0;var _0x779a7f;return db[_0x6d11('0x3b')]['findOne']({'where':{'id':_0x56f319[_0x6d11('0x45')]['id']}})[_0x6d11('0x23')](handleEntityNotFound(_0x2992a2,null))[_0x6d11('0x23')](function(_0x56fd12){if(_0x56fd12){_0xe71cc0=_0x56fd12;_0x4682ee[_0x6d11('0x2f')]=_[_0x6d11('0x3e')](db['ZohoField'][_0x6d11('0x3f')]);_0x4682ee[_0x6d11('0x2b')]=_[_0x6d11('0x3e')](_0x56f319['query']);_0x4682ee[_0x6d11('0x2c')]=_[_0x6d11('0x2e')](_0x4682ee[_0x6d11('0x2f')],_0x4682ee[_0x6d11('0x2b')]);_0x4b51bb['attributes']=_[_0x6d11('0x2e')](_0x4682ee['model'],qs[_0x6d11('0x30')](_0x56f319[_0x6d11('0x2b')][_0x6d11('0x30')]));_0x4b51bb[_0x6d11('0x2d')]=_0x4b51bb[_0x6d11('0x2d')][_0x6d11('0x31')]?_0x4b51bb['attributes']:_0x4682ee['model'];_0x4b51bb[_0x6d11('0x33')]=qs['sort'](_0x56f319[_0x6d11('0x2b')][_0x6d11('0x34')]);_0x4b51bb[_0x6d11('0x36')]=qs[_0x6d11('0x2c')](_[_0x6d11('0x35')](_0x56f319[_0x6d11('0x2b')],_0x4682ee['filters']));if(_0x56f319['query'][_0x6d11('0x38')]){_0x4b51bb[_0x6d11('0x36')]=_[_0x6d11('0x37')](_0x4b51bb[_0x6d11('0x36')],{'$or':_['map'](_0x4b51bb[_0x6d11('0x2d')],function(_0x477174){var _0x5aa48e={};_0x5aa48e[_0x477174]={'$like':'%'+_0x56f319[_0x6d11('0x2b')][_0x6d11('0x38')]+'%'};return _0x5aa48e;})});}_0x4b51bb=_['merge']({},_0x4b51bb,_0x56f319[_0x6d11('0x39')]);return _0xe71cc0[_0x6d11('0x4b')](_0x4b51bb);}})[_0x6d11('0x23')](function(_0x432a5b){if(_0x432a5b){_0x779a7f=_0x432a5b['length'];if(!_0x56f319[_0x6d11('0x2b')][_0x6d11('0x49')](_0x6d11('0x32'))){_0x4b51bb[_0x6d11('0x1c')]=qs[_0x6d11('0x1c')](_0x56f319[_0x6d11('0x2b')]['limit']);_0x4b51bb[_0x6d11('0x1e')]=qs['offset'](_0x56f319[_0x6d11('0x2b')][_0x6d11('0x1e')]);}return _0xe71cc0[_0x6d11('0x4b')](_0x4b51bb);}})[_0x6d11('0x23')](function(_0x33704a){if(_0x33704a){return _0x33704a?{'count':_0x779a7f,'rows':_0x33704a}:null;}})[_0x6d11('0x23')](respondWithResult(_0x2992a2,null))[_0x6d11('0x43')](handleError(_0x2992a2,null));}; \ No newline at end of file +var _0x7bb7=['ZohoField','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','then','stack','name','send','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','catch','show','params','includeAll','find','create','body','destroy','findOne'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x7bb7,0xa6));var _0x77bb=function(_0x53a607,_0x5bc07d){_0x53a607=_0x53a607-0x0;var _0x5287c9=_0x7bb7[_0x53a607];return _0x5287c9;};'use strict';var emlformat=require(_0x77bb('0x0'));var rimraf=require(_0x77bb('0x1'));var zipdir=require(_0x77bb('0x2'));var jsonpatch=require(_0x77bb('0x3'));var rp=require(_0x77bb('0x4'));var moment=require(_0x77bb('0x5'));var BPromise=require(_0x77bb('0x6'));var Mustache=require('mustache');var util=require(_0x77bb('0x7'));var path=require('path');var sox=require(_0x77bb('0x8'));var csv=require(_0x77bb('0x9'));var ejs=require(_0x77bb('0xa'));var fs=require('fs');var fs_extra=require(_0x77bb('0xb'));var _=require(_0x77bb('0xc'));var squel=require('squel');var crypto=require(_0x77bb('0xd'));var jsforce=require(_0x77bb('0xe'));var deskjs=require(_0x77bb('0xf'));var toCsv=require('to-csv');var querystring=require(_0x77bb('0x10'));var Papa=require(_0x77bb('0x11'));var Redis=require(_0x77bb('0x12'));var authService=require(_0x77bb('0x13'));var qs=require(_0x77bb('0x14'));var as=require(_0x77bb('0x15'));var hardwareService=require(_0x77bb('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x77bb('0x17'));var config=require(_0x77bb('0x18'));var licenseUtil=require(_0x77bb('0x19'));var db=require(_0x77bb('0x1a'))['db'];function respondWithStatusCode(_0x2e414b,_0x331585){_0x331585=_0x331585||0xcc;return function(_0xaae9e7){if(_0xaae9e7){return _0x2e414b[_0x77bb('0x1b')](_0x331585);}return _0x2e414b[_0x77bb('0x1c')](_0x331585)[_0x77bb('0x1d')]();};}function respondWithResult(_0x5cf531,_0x18e87b){_0x18e87b=_0x18e87b||0xc8;return function(_0x356203){if(_0x356203){return _0x5cf531[_0x77bb('0x1c')](_0x18e87b)['json'](_0x356203);}};}function respondWithFilteredResult(_0x5caeec,_0x2af91b){return function(_0x2f70eb){if(_0x2f70eb){var _0xce8ed8=typeof _0x2af91b[_0x77bb('0x1e')]===_0x77bb('0x1f')&&typeof _0x2af91b[_0x77bb('0x20')]===_0x77bb('0x1f');var _0x44c2bc=_0x2f70eb[_0x77bb('0x21')];var _0x9acf1d=_0xce8ed8?0x0:_0x2af91b[_0x77bb('0x1e')];var _0xc62404=_0xce8ed8?_0x2f70eb['count']:_0x2af91b['offset']+_0x2af91b[_0x77bb('0x20')];var _0xe5c109;if(_0xc62404>=_0x44c2bc){_0xc62404=_0x44c2bc;_0xe5c109=0xc8;}else{_0xe5c109=0xce;}_0x5caeec['status'](_0xe5c109);return _0x5caeec[_0x77bb('0x22')]('Content-Range',_0x9acf1d+'-'+_0xc62404+'/'+_0x44c2bc)[_0x77bb('0x23')](_0x2f70eb);}return null;};}function patchUpdates(_0x5cc35f){return function(_0xa1211){try{jsonpatch[_0x77bb('0x24')](_0xa1211,_0x5cc35f,!![]);}catch(_0x48db80){return BPromise[_0x77bb('0x25')](_0x48db80);}return _0xa1211[_0x77bb('0x26')]();};}function saveUpdates(_0x3348c2,_0x225f29){return function(_0x66efaa){if(_0x66efaa){return _0x66efaa['update'](_0x3348c2)[_0x77bb('0x27')](function(_0x1f78ff){return _0x1f78ff;});}return null;};}function removeEntity(_0xbe3a86,_0x652e00){return function(_0x354c11){if(_0x354c11){return _0x354c11['destroy']()[_0x77bb('0x27')](function(){_0xbe3a86[_0x77bb('0x1c')](0xcc)[_0x77bb('0x1d')]();});}};}function handleEntityNotFound(_0x50b314,_0x212847){return function(_0x29242a){if(!_0x29242a){_0x50b314[_0x77bb('0x1b')](0x194);}return _0x29242a;};}function handleError(_0x2c4eea,_0x10c6dd){_0x10c6dd=_0x10c6dd||0x1f4;return function(_0x6441c5){logger['error'](_0x6441c5[_0x77bb('0x28')]);if(_0x6441c5[_0x77bb('0x29')]){delete _0x6441c5[_0x77bb('0x29')];}_0x2c4eea[_0x77bb('0x1c')](_0x10c6dd)[_0x77bb('0x2a')](_0x6441c5);};}exports['index']=function(_0x7561c9,_0x2d4bde){var _0x4a779d={},_0x2abd26={},_0x4e44b4={'count':0x0,'rows':[]};var _0x86fd9c=_[_0x77bb('0x2b')](db[_0x77bb('0x2c')][_0x77bb('0x2d')],function(_0x4c47e8){return{'name':_0x4c47e8[_0x77bb('0x2e')],'type':_0x4c47e8[_0x77bb('0x2f')][_0x77bb('0x30')]};});_0x2abd26[_0x77bb('0x31')]=_[_0x77bb('0x2b')](_0x86fd9c,_0x77bb('0x29'));_0x2abd26[_0x77bb('0x32')]=_[_0x77bb('0x33')](_0x7561c9[_0x77bb('0x32')]);_0x2abd26[_0x77bb('0x34')]=_[_0x77bb('0x35')](_0x2abd26[_0x77bb('0x31')],_0x2abd26[_0x77bb('0x32')]);_0x4a779d[_0x77bb('0x36')]=_[_0x77bb('0x35')](_0x2abd26[_0x77bb('0x31')],qs[_0x77bb('0x37')](_0x7561c9[_0x77bb('0x32')]['fields']));_0x4a779d[_0x77bb('0x36')]=_0x4a779d[_0x77bb('0x36')][_0x77bb('0x38')]?_0x4a779d[_0x77bb('0x36')]:_0x2abd26['model'];if(!_0x7561c9[_0x77bb('0x32')][_0x77bb('0x39')](_0x77bb('0x3a'))){_0x4a779d['limit']=qs[_0x77bb('0x20')](_0x7561c9[_0x77bb('0x32')][_0x77bb('0x20')]);_0x4a779d[_0x77bb('0x1e')]=qs['offset'](_0x7561c9[_0x77bb('0x32')][_0x77bb('0x1e')]);}_0x4a779d[_0x77bb('0x3b')]=qs['sort'](_0x7561c9['query'][_0x77bb('0x3c')]);_0x4a779d[_0x77bb('0x3d')]=qs[_0x77bb('0x34')](_[_0x77bb('0x3e')](_0x7561c9[_0x77bb('0x32')],_0x2abd26[_0x77bb('0x34')]),_0x86fd9c);if(_0x7561c9[_0x77bb('0x32')][_0x77bb('0x3f')]){_0x4a779d['where']=_[_0x77bb('0x40')](_0x4a779d[_0x77bb('0x3d')],{'$or':_['map'](_0x86fd9c,function(_0x2809fd){if(_0x2809fd[_0x77bb('0x2f')]!==_0x77bb('0x41')){var _0x172b09={};_0x172b09[_0x2809fd['name']]={'$like':'%'+_0x7561c9[_0x77bb('0x32')][_0x77bb('0x3f')]+'%'};return _0x172b09;}})});}_0x4a779d=_[_0x77bb('0x40')]({},_0x4a779d,_0x7561c9[_0x77bb('0x42')]);var _0x17c240={'where':_0x4a779d[_0x77bb('0x3d')]};return db[_0x77bb('0x2c')][_0x77bb('0x21')](_0x17c240)[_0x77bb('0x27')](function(_0x57679a){_0x4e44b4['count']=_0x57679a;if(_0x7561c9['query']['includeAll']){_0x4a779d[_0x77bb('0x43')]=[{'all':!![]}];}return db['ZohoConfiguration']['findAll'](_0x4a779d);})[_0x77bb('0x27')](function(_0x36cf93){_0x4e44b4['rows']=_0x36cf93;return _0x4e44b4;})['then'](respondWithFilteredResult(_0x2d4bde,_0x4a779d))[_0x77bb('0x44')](handleError(_0x2d4bde,null));};exports[_0x77bb('0x45')]=function(_0x58b056,_0x235494){var _0xf0adeb={'raw':![],'where':{'id':_0x58b056[_0x77bb('0x46')]['id']}},_0x2f8065={};_0x2f8065['model']=_[_0x77bb('0x33')](db['ZohoConfiguration'][_0x77bb('0x2d')]);_0x2f8065[_0x77bb('0x32')]=_[_0x77bb('0x33')](_0x58b056[_0x77bb('0x32')]);_0x2f8065[_0x77bb('0x34')]=_['intersection'](_0x2f8065['model'],_0x2f8065[_0x77bb('0x32')]);_0xf0adeb['attributes']=_[_0x77bb('0x35')](_0x2f8065[_0x77bb('0x31')],qs['fields'](_0x58b056['query'][_0x77bb('0x37')]));_0xf0adeb['attributes']=_0xf0adeb[_0x77bb('0x36')][_0x77bb('0x38')]?_0xf0adeb[_0x77bb('0x36')]:_0x2f8065['model'];if(_0x58b056[_0x77bb('0x32')][_0x77bb('0x47')]){_0xf0adeb[_0x77bb('0x43')]=[{'all':!![]}];}_0xf0adeb=_['merge']({},_0xf0adeb,_0x58b056[_0x77bb('0x42')]);return db[_0x77bb('0x2c')][_0x77bb('0x48')](_0xf0adeb)[_0x77bb('0x27')](handleEntityNotFound(_0x235494,null))[_0x77bb('0x27')](respondWithResult(_0x235494,null))['catch'](handleError(_0x235494,null));};exports[_0x77bb('0x49')]=function(_0x4c776d,_0x91c811){return db['ZohoConfiguration'][_0x77bb('0x49')](_0x4c776d[_0x77bb('0x4a')],{})['then'](respondWithResult(_0x91c811,0xc9))['catch'](handleError(_0x91c811,null));};exports['update']=function(_0x1eda57,_0x580d4d){if(_0x1eda57[_0x77bb('0x4a')]['id']){delete _0x1eda57[_0x77bb('0x4a')]['id'];}return db[_0x77bb('0x2c')]['find']({'where':{'id':_0x1eda57[_0x77bb('0x46')]['id']}})['then'](handleEntityNotFound(_0x580d4d,null))[_0x77bb('0x27')](saveUpdates(_0x1eda57[_0x77bb('0x4a')],null))[_0x77bb('0x27')](respondWithResult(_0x580d4d,null))[_0x77bb('0x44')](handleError(_0x580d4d,null));};exports[_0x77bb('0x4b')]=function(_0x138c90,_0x253c92){return db[_0x77bb('0x2c')]['find']({'where':{'id':_0x138c90[_0x77bb('0x46')]['id']}})[_0x77bb('0x27')](handleEntityNotFound(_0x253c92,null))[_0x77bb('0x27')](removeEntity(_0x253c92,null))[_0x77bb('0x44')](handleError(_0x253c92,null));};exports['getFields']=function(_0x1bf991,_0x484dde,_0x50ee37){var _0xb76654={};var _0x5a75eb={};var _0x21a1be;var _0x8e60c7;return db[_0x77bb('0x2c')][_0x77bb('0x4c')]({'where':{'id':_0x1bf991['params']['id']}})['then'](handleEntityNotFound(_0x484dde,null))[_0x77bb('0x27')](function(_0x51d756){if(_0x51d756){_0x21a1be=_0x51d756;_0x5a75eb[_0x77bb('0x31')]=_['keys'](db[_0x77bb('0x4d')]['rawAttributes']);_0x5a75eb['query']=_[_0x77bb('0x33')](_0x1bf991[_0x77bb('0x32')]);_0x5a75eb[_0x77bb('0x34')]=_[_0x77bb('0x35')](_0x5a75eb[_0x77bb('0x31')],_0x5a75eb['query']);_0xb76654[_0x77bb('0x36')]=_[_0x77bb('0x35')](_0x5a75eb['model'],qs['fields'](_0x1bf991['query'][_0x77bb('0x37')]));_0xb76654['attributes']=_0xb76654['attributes'][_0x77bb('0x38')]?_0xb76654[_0x77bb('0x36')]:_0x5a75eb['model'];_0xb76654[_0x77bb('0x3b')]=qs[_0x77bb('0x3c')](_0x1bf991['query'][_0x77bb('0x3c')]);_0xb76654[_0x77bb('0x3d')]=qs[_0x77bb('0x34')](_[_0x77bb('0x3e')](_0x1bf991[_0x77bb('0x32')],_0x5a75eb['filters']));if(_0x1bf991[_0x77bb('0x32')][_0x77bb('0x3f')]){_0xb76654[_0x77bb('0x3d')]=_[_0x77bb('0x40')](_0xb76654[_0x77bb('0x3d')],{'$or':_[_0x77bb('0x2b')](_0xb76654['attributes'],function(_0x433cde){var _0x451040={};_0x451040[_0x433cde]={'$like':'%'+_0x1bf991[_0x77bb('0x32')][_0x77bb('0x3f')]+'%'};return _0x451040;})});}_0xb76654=_[_0x77bb('0x40')]({},_0xb76654,_0x1bf991['options']);return _0x21a1be[_0x77bb('0x4e')](_0xb76654);}})[_0x77bb('0x27')](function(_0xc71e1){if(_0xc71e1){_0x8e60c7=_0xc71e1[_0x77bb('0x38')];if(!_0x1bf991[_0x77bb('0x32')][_0x77bb('0x39')]('nolimit')){_0xb76654[_0x77bb('0x20')]=qs[_0x77bb('0x20')](_0x1bf991['query'][_0x77bb('0x20')]);_0xb76654[_0x77bb('0x1e')]=qs[_0x77bb('0x1e')](_0x1bf991[_0x77bb('0x32')][_0x77bb('0x1e')]);}return _0x21a1be[_0x77bb('0x4e')](_0xb76654);}})[_0x77bb('0x27')](function(_0x29943f){if(_0x29943f){return _0x29943f?{'count':_0x8e60c7,'rows':_0x29943f}:null;}})[_0x77bb('0x27')](respondWithResult(_0x484dde,null))[_0x77bb('0x44')](handleError(_0x484dde,null));};exports['getSubjects']=function(_0x1bc9ee,_0x155b0a,_0xf73c97){var _0x14e424={};var _0x4bf57a={};var _0x369edc;var _0x142cc5;return db[_0x77bb('0x2c')]['findOne']({'where':{'id':_0x1bc9ee['params']['id']}})[_0x77bb('0x27')](handleEntityNotFound(_0x155b0a,null))[_0x77bb('0x27')](function(_0x4227a5){if(_0x4227a5){_0x369edc=_0x4227a5;_0x4bf57a['model']=_[_0x77bb('0x33')](db[_0x77bb('0x4d')][_0x77bb('0x2d')]);_0x4bf57a[_0x77bb('0x32')]=_['keys'](_0x1bc9ee[_0x77bb('0x32')]);_0x4bf57a[_0x77bb('0x34')]=_[_0x77bb('0x35')](_0x4bf57a[_0x77bb('0x31')],_0x4bf57a['query']);_0x14e424['attributes']=_[_0x77bb('0x35')](_0x4bf57a['model'],qs[_0x77bb('0x37')](_0x1bc9ee[_0x77bb('0x32')][_0x77bb('0x37')]));_0x14e424['attributes']=_0x14e424[_0x77bb('0x36')]['length']?_0x14e424[_0x77bb('0x36')]:_0x4bf57a[_0x77bb('0x31')];_0x14e424[_0x77bb('0x3b')]=qs[_0x77bb('0x3c')](_0x1bc9ee['query'][_0x77bb('0x3c')]);_0x14e424[_0x77bb('0x3d')]=qs[_0x77bb('0x34')](_[_0x77bb('0x3e')](_0x1bc9ee[_0x77bb('0x32')],_0x4bf57a[_0x77bb('0x34')]));if(_0x1bc9ee[_0x77bb('0x32')]['filter']){_0x14e424[_0x77bb('0x3d')]=_[_0x77bb('0x40')](_0x14e424['where'],{'$or':_[_0x77bb('0x2b')](_0x14e424['attributes'],function(_0x57826e){var _0xc7655e={};_0xc7655e[_0x57826e]={'$like':'%'+_0x1bc9ee[_0x77bb('0x32')][_0x77bb('0x3f')]+'%'};return _0xc7655e;})});}_0x14e424=_[_0x77bb('0x40')]({},_0x14e424,_0x1bc9ee[_0x77bb('0x42')]);return _0x369edc[_0x77bb('0x4f')](_0x14e424);}})[_0x77bb('0x27')](function(_0x43886b){if(_0x43886b){_0x142cc5=_0x43886b['length'];if(!_0x1bc9ee[_0x77bb('0x32')][_0x77bb('0x39')]('nolimit')){_0x14e424['limit']=qs[_0x77bb('0x20')](_0x1bc9ee[_0x77bb('0x32')][_0x77bb('0x20')]);_0x14e424[_0x77bb('0x1e')]=qs['offset'](_0x1bc9ee[_0x77bb('0x32')][_0x77bb('0x1e')]);}return _0x369edc[_0x77bb('0x4f')](_0x14e424);}})[_0x77bb('0x27')](function(_0x3ca681){if(_0x3ca681){return _0x3ca681?{'count':_0x142cc5,'rows':_0x3ca681}:null;}})['then'](respondWithResult(_0x155b0a,null))[_0x77bb('0x44')](handleError(_0x155b0a,null));};exports[_0x77bb('0x50')]=function(_0x3b30fe,_0xe4a645,_0x5cd27c){var _0x5b45f9={};var _0x2982e8={};var _0x3cfd91;var _0xd09125;return db[_0x77bb('0x2c')][_0x77bb('0x4c')]({'where':{'id':_0x3b30fe[_0x77bb('0x46')]['id']}})[_0x77bb('0x27')](handleEntityNotFound(_0xe4a645,null))[_0x77bb('0x27')](function(_0x34186e){if(_0x34186e){_0x3cfd91=_0x34186e;_0x2982e8[_0x77bb('0x31')]=_['keys'](db[_0x77bb('0x4d')][_0x77bb('0x2d')]);_0x2982e8[_0x77bb('0x32')]=_[_0x77bb('0x33')](_0x3b30fe[_0x77bb('0x32')]);_0x2982e8[_0x77bb('0x34')]=_['intersection'](_0x2982e8[_0x77bb('0x31')],_0x2982e8[_0x77bb('0x32')]);_0x5b45f9[_0x77bb('0x36')]=_[_0x77bb('0x35')](_0x2982e8[_0x77bb('0x31')],qs[_0x77bb('0x37')](_0x3b30fe['query'][_0x77bb('0x37')]));_0x5b45f9[_0x77bb('0x36')]=_0x5b45f9[_0x77bb('0x36')]['length']?_0x5b45f9['attributes']:_0x2982e8['model'];_0x5b45f9[_0x77bb('0x3b')]=qs[_0x77bb('0x3c')](_0x3b30fe['query'][_0x77bb('0x3c')]);_0x5b45f9[_0x77bb('0x3d')]=qs[_0x77bb('0x34')](_[_0x77bb('0x3e')](_0x3b30fe[_0x77bb('0x32')],_0x2982e8[_0x77bb('0x34')]));if(_0x3b30fe['query']['filter']){_0x5b45f9['where']=_['merge'](_0x5b45f9[_0x77bb('0x3d')],{'$or':_[_0x77bb('0x2b')](_0x5b45f9['attributes'],function(_0x41fef1){var _0x48021c={};_0x48021c[_0x41fef1]={'$like':'%'+_0x3b30fe[_0x77bb('0x32')][_0x77bb('0x3f')]+'%'};return _0x48021c;})});}_0x5b45f9=_[_0x77bb('0x40')]({},_0x5b45f9,_0x3b30fe[_0x77bb('0x42')]);return _0x3cfd91[_0x77bb('0x50')](_0x5b45f9);}})['then'](function(_0x336908){if(_0x336908){_0xd09125=_0x336908[_0x77bb('0x38')];if(!_0x3b30fe[_0x77bb('0x32')]['hasOwnProperty']('nolimit')){_0x5b45f9['limit']=qs[_0x77bb('0x20')](_0x3b30fe['query']['limit']);_0x5b45f9[_0x77bb('0x1e')]=qs[_0x77bb('0x1e')](_0x3b30fe['query'][_0x77bb('0x1e')]);}return _0x3cfd91[_0x77bb('0x50')](_0x5b45f9);}})[_0x77bb('0x27')](function(_0x2ef5c9){if(_0x2ef5c9){return _0x2ef5c9?{'count':_0xd09125,'rows':_0x2ef5c9}:null;}})[_0x77bb('0x27')](respondWithResult(_0xe4a645,null))['catch'](handleError(_0xe4a645,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index be2c449..b0df230 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 _0x1425=['int_zoho_configurations','lodash','../../config/logger','bluebird','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration'];(function(_0x5bca59,_0x18a7bf){var _0x2fe97e=function(_0x390a1b){while(--_0x390a1b){_0x5bca59['push'](_0x5bca59['shift']());}};_0x2fe97e(++_0x18a7bf);}(_0x1425,0x90));var _0x5142=function(_0x10d570,_0x1012dd){_0x10d570=_0x10d570-0x0;var _0x46e8a0=_0x1425[_0x10d570];return _0x46e8a0;};'use strict';var _=require(_0x5142('0x0'));var util=require('util');var logger=require(_0x5142('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5142('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5142('0x3'));var rimraf=require(_0x5142('0x4'));var config=require(_0x5142('0x5'));var attributes=require(_0x5142('0x6'));module[_0x5142('0x7')]=function(_0x36a8d5,_0x38d75c){return _0x36a8d5[_0x5142('0x8')](_0x5142('0x9'),attributes,{'tableName':_0x5142('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c5c=['api','moment','bluebird','request-promise','path','../../config/environment','exports','int_zoho_configurations','lodash','util','../../config/logger'];(function(_0x5d127a,_0x416d16){var _0x364997=function(_0x34a70f){while(--_0x34a70f){_0x5d127a['push'](_0x5d127a['shift']());}};_0x364997(++_0x416d16);}(_0x5c5c,0xfa));var _0xc5c5=function(_0x206f20,_0x104f3b){_0x206f20=_0x206f20-0x0;var _0x26baca=_0x5c5c[_0x206f20];return _0x26baca;};'use strict';var _=require(_0xc5c5('0x0'));var util=require(_0xc5c5('0x1'));var logger=require(_0xc5c5('0x2'))(_0xc5c5('0x3'));var moment=require(_0xc5c5('0x4'));var BPromise=require(_0xc5c5('0x5'));var rp=require(_0xc5c5('0x6'));var fs=require('fs');var path=require(_0xc5c5('0x7'));var rimraf=require('rimraf');var config=require(_0xc5c5('0x8'));var attributes=require('./intZohoConfiguration.attributes');module[_0xc5c5('0x9')]=function(_0x30fa3c,_0x2aedb4){return _0x30fa3c['define']('ZohoConfiguration',attributes,{'tableName':_0xc5c5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 31216d5..a5d971a 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 _0xecf9=['../../config/environment','jayson/promise','http','info','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ZohoConfiguration,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x2822c3,_0x4adbd8){var _0x263e6e=function(_0x213e8a){while(--_0x213e8a){_0x2822c3['push'](_0x2822c3['shift']());}};_0x263e6e(++_0x4adbd8);}(_0xecf9,0x185));var _0x9ecf=function(_0x36e37c,_0x234700){_0x36e37c=_0x36e37c-0x0;var _0x198565=_0xecf9[_0x36e37c];return _0x198565;};'use strict';var _=require(_0x9ecf('0x0'));var util=require(_0x9ecf('0x1'));var moment=require('moment');var BPromise=require(_0x9ecf('0x2'));var rs=require(_0x9ecf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9ecf('0x4'))['db'];var utils=require(_0x9ecf('0x5'));var logger=require('../../config/logger')(_0x9ecf('0x6'));var config=require(_0x9ecf('0x7'));var jayson=require(_0x9ecf('0x8'));var client=jayson['client'][_0x9ecf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d6bc2,_0x5c78bb,_0x46b80a){return new BPromise(function(_0x4f06d7,_0xdfcf7c){return client['request'](_0x4d6bc2,_0x46b80a)['then'](function(_0x4f0d8c){logger[_0x9ecf('0xa')]('ZohoConfiguration,\x20%s,\x20%s',_0x5c78bb,_0x9ecf('0xb'));logger['debug'](_0x9ecf('0xc'),_0x5c78bb,'request\x20sent',JSON[_0x9ecf('0xd')](_0x4f0d8c));if(_0x4f0d8c[_0x9ecf('0xe')]){if(_0x4f0d8c[_0x9ecf('0xe')]['code']===0x1f4){logger['error'](_0x9ecf('0xf'),_0x5c78bb,_0x4f0d8c[_0x9ecf('0xe')]['message']);return _0xdfcf7c(_0x4f0d8c[_0x9ecf('0xe')][_0x9ecf('0x10')]);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x5c78bb,_0x4f0d8c[_0x9ecf('0xe')]['message']);return _0x4f06d7(_0x4f0d8c[_0x9ecf('0xe')][_0x9ecf('0x10')]);}else{logger[_0x9ecf('0xa')]('ZohoConfiguration,\x20%s,\x20%s',_0x5c78bb,_0x9ecf('0xb'));_0x4f06d7(_0x4f0d8c['result'][_0x9ecf('0x10')]);}})[_0x9ecf('0x11')](function(_0x180748){logger[_0x9ecf('0xe')](_0x9ecf('0xf'),_0x5c78bb,_0x180748);_0xdfcf7c(_0x180748);});});} \ No newline at end of file +var _0x560c=['info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x5005ce,_0x59876b){var _0x42f3fb=function(_0x3bead6){while(--_0x3bead6){_0x5005ce['push'](_0x5005ce['shift']());}};_0x42f3fb(++_0x59876b);}(_0x560c,0x1c0));var _0xc560=function(_0x29503c,_0x36af97){_0x29503c=_0x29503c-0x0;var _0x406cf5=_0x560c[_0x29503c];return _0x406cf5;};'use strict';var _=require(_0xc560('0x0'));var util=require('util');var moment=require(_0xc560('0x1'));var BPromise=require(_0xc560('0x2'));var rs=require(_0xc560('0x3'));var fs=require('fs');var Redis=require(_0xc560('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc560('0x5'))(_0xc560('0x6'));var config=require(_0xc560('0x7'));var jayson=require(_0xc560('0x8'));var client=jayson[_0xc560('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35f7d2,_0x1c71ec,_0x17a517){return new BPromise(function(_0x2065f2,_0x94d15f){return client[_0xc560('0xa')](_0x35f7d2,_0x17a517)[_0xc560('0xb')](function(_0x54f993){logger[_0xc560('0xc')](_0xc560('0xd'),_0x1c71ec,_0xc560('0xe'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x1c71ec,_0xc560('0xe'),JSON['stringify'](_0x54f993));if(_0x54f993['error']){if(_0x54f993[_0xc560('0xf')][_0xc560('0x10')]===0x1f4){logger['error'](_0xc560('0xd'),_0x1c71ec,_0x54f993[_0xc560('0xf')][_0xc560('0x11')]);return _0x94d15f(_0x54f993[_0xc560('0xf')][_0xc560('0x11')]);}logger['error'](_0xc560('0xd'),_0x1c71ec,_0x54f993[_0xc560('0xf')][_0xc560('0x11')]);return _0x2065f2(_0x54f993[_0xc560('0xf')][_0xc560('0x11')]);}else{logger[_0xc560('0xc')](_0xc560('0xd'),_0x1c71ec,_0xc560('0xe'));_0x2065f2(_0x54f993[_0xc560('0x12')]['message']);}})[_0xc560('0x13')](function(_0x4b793d){logger[_0xc560('0xf')](_0xc560('0xd'),_0x1c71ec,_0x4b793d);_0x94d15f(_0x4b793d);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 98c15af..b2ade7d 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 _0x4b66=['/:id','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./intZohoField.controller','get','isAuthenticated','index','show','create'];(function(_0x142f9b,_0x904a81){var _0x57eba6=function(_0xcfe723){while(--_0xcfe723){_0x142f9b['push'](_0x142f9b['shift']());}};_0x57eba6(++_0x904a81);}(_0x4b66,0x1c3));var _0x64b6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4b66[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x64b6('0x0'));var util=require(_0x64b6('0x1'));var path=require(_0x64b6('0x2'));var timeout=require(_0x64b6('0x3'));var express=require(_0x64b6('0x4'));var router=express[_0x64b6('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x64b6('0x6'));var config=require('../../config/environment');var controller=require(_0x64b6('0x7'));router[_0x64b6('0x8')]('/',auth[_0x64b6('0x9')](),controller[_0x64b6('0xa')]);router[_0x64b6('0x8')]('/:id',auth[_0x64b6('0x9')](),controller[_0x64b6('0xb')]);router['post']('/',auth[_0x64b6('0x9')](),controller[_0x64b6('0xc')]);router['put'](_0x64b6('0xd'),auth[_0x64b6('0x9')](),controller[_0x64b6('0xe')]);router['delete'](_0x64b6('0xd'),auth['isAuthenticated'](),controller[_0x64b6('0xf')]);module['exports']=router; \ No newline at end of file +var _0x20b3=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','put','delete','destroy','exports','multer','util'];(function(_0x5c3584,_0x3d3da8){var _0x53a427=function(_0x1bc51a){while(--_0x1bc51a){_0x5c3584['push'](_0x5c3584['shift']());}};_0x53a427(++_0x3d3da8);}(_0x20b3,0xd6));var _0x320b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x20b3[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x320b('0x0'));var util=require(_0x320b('0x1'));var path=require('path');var timeout=require(_0x320b('0x2'));var express=require(_0x320b('0x3'));var router=express[_0x320b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x320b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x320b('0x6'));var controller=require(_0x320b('0x7'));router[_0x320b('0x8')]('/',auth[_0x320b('0x9')](),controller[_0x320b('0xa')]);router[_0x320b('0x8')](_0x320b('0xb'),auth['isAuthenticated'](),controller[_0x320b('0xc')]);router[_0x320b('0xd')]('/',auth[_0x320b('0x9')](),controller['create']);router[_0x320b('0xe')](_0x320b('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x320b('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x320b('0x10')]);module[_0x320b('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 671c7dd..1d96e75 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 _0xf503=['STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','string'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0xf503,0xc8));var _0x3f50=function(_0x536595,_0x10ebd2){_0x536595=_0x536595-0x0;var _0x24fc8e=_0xf503[_0x536595];return _0x24fc8e;};'use strict';var Sequelize=require(_0x3f50('0x0'));module[_0x3f50('0x1')]={'type':{'type':Sequelize[_0x3f50('0x2')]('string',_0x3f50('0x3'),_0x3f50('0x4'),_0x3f50('0x5'),'picklist'),'defaultValue':_0x3f50('0x6')},'content':{'type':Sequelize[_0x3f50('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3f50('0x2')](_0x3f50('0x6'),_0x3f50('0x3'),_0x3f50('0x4'))},'keyContent':{'type':Sequelize[_0x3f50('0x7')]},'idField':{'type':Sequelize[_0x3f50('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3f50('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3f50('0x7')]}}; \ No newline at end of file +var _0x54d8=['keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string','customVariable'];(function(_0x52924d,_0x354435){var _0xddd920=function(_0x2ed110){while(--_0x2ed110){_0x52924d['push'](_0x52924d['shift']());}};_0xddd920(++_0x354435);}(_0x54d8,0x164));var _0x854d=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x54d8[_0x2d2c16];return _0x53f2fb;};'use strict';var Sequelize=require('sequelize');module[_0x854d('0x0')]={'type':{'type':Sequelize[_0x854d('0x1')](_0x854d('0x2'),'variable',_0x854d('0x3'),_0x854d('0x4'),_0x854d('0x5')),'defaultValue':_0x854d('0x2')},'content':{'type':Sequelize[_0x854d('0x6')]},'key':{'type':Sequelize[_0x854d('0x6')]},'keyType':{'type':Sequelize[_0x854d('0x1')](_0x854d('0x2'),'variable',_0x854d('0x3'))},'keyContent':{'type':Sequelize[_0x854d('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x854d('0x6')]},'customField':{'type':Sequelize[_0x854d('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index c3b2b41..708409d 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 _0x5b53=['set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','ZohoField','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit'];(function(_0x318256,_0xa773f3){var _0xb1e352=function(_0x4bb14e){while(--_0x4bb14e){_0x318256['push'](_0x318256['shift']());}};_0xb1e352(++_0xa773f3);}(_0x5b53,0x1a2));var _0x35b5=function(_0xda3f86,_0x32c86c){_0xda3f86=_0xda3f86-0x0;var _0x1bcc40=_0x5b53[_0xda3f86];return _0x1bcc40;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x35b5('0x0'));var zipdir=require(_0x35b5('0x1'));var jsonpatch=require(_0x35b5('0x2'));var rp=require(_0x35b5('0x3'));var moment=require(_0x35b5('0x4'));var BPromise=require(_0x35b5('0x5'));var Mustache=require(_0x35b5('0x6'));var util=require(_0x35b5('0x7'));var path=require(_0x35b5('0x8'));var sox=require('sox');var csv=require(_0x35b5('0x9'));var ejs=require(_0x35b5('0xa'));var fs=require('fs');var fs_extra=require(_0x35b5('0xb'));var _=require(_0x35b5('0xc'));var squel=require(_0x35b5('0xd'));var crypto=require(_0x35b5('0xe'));var jsforce=require(_0x35b5('0xf'));var deskjs=require(_0x35b5('0x10'));var toCsv=require(_0x35b5('0x9'));var querystring=require(_0x35b5('0x11'));var Papa=require(_0x35b5('0x12'));var Redis=require(_0x35b5('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x35b5('0x14'));var hardwareService=require(_0x35b5('0x15'));var logger=require(_0x35b5('0x16'))(_0x35b5('0x17'));var utils=require(_0x35b5('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x35b5('0x19'));var db=require(_0x35b5('0x1a'))['db'];function respondWithStatusCode(_0x6c1e92,_0x5d3ae6){_0x5d3ae6=_0x5d3ae6||0xcc;return function(_0x3bb799){if(_0x3bb799){return _0x6c1e92['sendStatus'](_0x5d3ae6);}return _0x6c1e92[_0x35b5('0x1b')](_0x5d3ae6)[_0x35b5('0x1c')]();};}function respondWithResult(_0x215583,_0x8c9739){_0x8c9739=_0x8c9739||0xc8;return function(_0x269e17){if(_0x269e17){return _0x215583[_0x35b5('0x1b')](_0x8c9739)['json'](_0x269e17);}};}function respondWithFilteredResult(_0x4ca74c,_0x55b44e){return function(_0x5c6ff3){if(_0x5c6ff3){var _0x106c01=typeof _0x55b44e[_0x35b5('0x1d')]===_0x35b5('0x1e')&&typeof _0x55b44e[_0x35b5('0x1f')]===_0x35b5('0x1e');var _0x4abd0c=_0x5c6ff3['count'];var _0x510ec2=_0x106c01?0x0:_0x55b44e[_0x35b5('0x1d')];var _0x2e3513=_0x106c01?_0x5c6ff3['count']:_0x55b44e['offset']+_0x55b44e['limit'];var _0x27f315;if(_0x2e3513>=_0x4abd0c){_0x2e3513=_0x4abd0c;_0x27f315=0xc8;}else{_0x27f315=0xce;}_0x4ca74c['status'](_0x27f315);return _0x4ca74c[_0x35b5('0x20')](_0x35b5('0x21'),_0x510ec2+'-'+_0x2e3513+'/'+_0x4abd0c)['json'](_0x5c6ff3);}return null;};}function patchUpdates(_0x2d36aa){return function(_0x5aa98c){try{jsonpatch[_0x35b5('0x22')](_0x5aa98c,_0x2d36aa,!![]);}catch(_0x2f8259){return BPromise[_0x35b5('0x23')](_0x2f8259);}return _0x5aa98c[_0x35b5('0x24')]();};}function saveUpdates(_0x440b1e,_0x4d2f4d){return function(_0x3bb552){if(_0x3bb552){return _0x3bb552[_0x35b5('0x25')](_0x440b1e)[_0x35b5('0x26')](function(_0x1c43cc){return _0x1c43cc;});}return null;};}function removeEntity(_0x3111d4,_0x5b3dd7){return function(_0x28f71d){if(_0x28f71d){return _0x28f71d[_0x35b5('0x27')]()[_0x35b5('0x26')](function(){_0x3111d4[_0x35b5('0x1b')](0xcc)[_0x35b5('0x1c')]();});}};}function handleEntityNotFound(_0x370cb4,_0x1b5382){return function(_0x482801){if(!_0x482801){_0x370cb4['sendStatus'](0x194);}return _0x482801;};}function handleError(_0x5d0c14,_0x5e9ced){_0x5e9ced=_0x5e9ced||0x1f4;return function(_0x40f65e){logger['error'](_0x40f65e[_0x35b5('0x28')]);if(_0x40f65e[_0x35b5('0x29')]){delete _0x40f65e['name'];}_0x5d0c14['status'](_0x5e9ced)['send'](_0x40f65e);};}exports[_0x35b5('0x2a')]=function(_0x3da7a4,_0x5e0b1a){var _0x1032c9={},_0x181e1d={},_0x4f92dd={'count':0x0,'rows':[]};var _0x214606=_[_0x35b5('0x2b')](db[_0x35b5('0x2c')][_0x35b5('0x2d')],function(_0x4f23a6){return{'name':_0x4f23a6['fieldName'],'type':_0x4f23a6[_0x35b5('0x2e')]['key']};});_0x181e1d[_0x35b5('0x2f')]=_['map'](_0x214606,_0x35b5('0x29'));_0x181e1d[_0x35b5('0x30')]=_[_0x35b5('0x31')](_0x3da7a4[_0x35b5('0x30')]);_0x181e1d[_0x35b5('0x32')]=_[_0x35b5('0x33')](_0x181e1d['model'],_0x181e1d[_0x35b5('0x30')]);_0x1032c9['attributes']=_[_0x35b5('0x33')](_0x181e1d[_0x35b5('0x2f')],qs['fields'](_0x3da7a4['query'][_0x35b5('0x34')]));_0x1032c9[_0x35b5('0x35')]=_0x1032c9[_0x35b5('0x35')][_0x35b5('0x36')]?_0x1032c9[_0x35b5('0x35')]:_0x181e1d[_0x35b5('0x2f')];if(!_0x3da7a4[_0x35b5('0x30')][_0x35b5('0x37')](_0x35b5('0x38'))){_0x1032c9[_0x35b5('0x1f')]=qs[_0x35b5('0x1f')](_0x3da7a4[_0x35b5('0x30')][_0x35b5('0x1f')]);_0x1032c9['offset']=qs[_0x35b5('0x1d')](_0x3da7a4['query']['offset']);}_0x1032c9[_0x35b5('0x39')]=qs[_0x35b5('0x3a')](_0x3da7a4[_0x35b5('0x30')]['sort']);_0x1032c9[_0x35b5('0x3b')]=qs['filters'](_[_0x35b5('0x3c')](_0x3da7a4[_0x35b5('0x30')],_0x181e1d['filters']),_0x214606);if(_0x3da7a4[_0x35b5('0x30')][_0x35b5('0x3d')]){_0x1032c9[_0x35b5('0x3b')]=_[_0x35b5('0x3e')](_0x1032c9[_0x35b5('0x3b')],{'$or':_[_0x35b5('0x2b')](_0x214606,function(_0x4f6bca){if(_0x4f6bca[_0x35b5('0x2e')]!==_0x35b5('0x3f')){var _0x11fc41={};_0x11fc41[_0x4f6bca[_0x35b5('0x29')]]={'$like':'%'+_0x3da7a4['query']['filter']+'%'};return _0x11fc41;}})});}_0x1032c9=_[_0x35b5('0x3e')]({},_0x1032c9,_0x3da7a4[_0x35b5('0x40')]);var _0x4b814d={'where':_0x1032c9[_0x35b5('0x3b')]};return db[_0x35b5('0x2c')][_0x35b5('0x41')](_0x4b814d)[_0x35b5('0x26')](function(_0x4a3ca5){_0x4f92dd[_0x35b5('0x41')]=_0x4a3ca5;if(_0x3da7a4['query'][_0x35b5('0x42')]){_0x1032c9[_0x35b5('0x43')]=[{'all':!![]}];}return db['ZohoField'][_0x35b5('0x44')](_0x1032c9);})['then'](function(_0x361fa2){_0x4f92dd[_0x35b5('0x45')]=_0x361fa2;return _0x4f92dd;})[_0x35b5('0x26')](respondWithFilteredResult(_0x5e0b1a,_0x1032c9))[_0x35b5('0x46')](handleError(_0x5e0b1a,null));};exports['show']=function(_0x2da7d3,_0x347a5c){var _0x41403a={'raw':!![],'where':{'id':_0x2da7d3[_0x35b5('0x47')]['id']}},_0x19d5a8={};_0x19d5a8[_0x35b5('0x2f')]=_['keys'](db[_0x35b5('0x2c')][_0x35b5('0x2d')]);_0x19d5a8[_0x35b5('0x30')]=_['keys'](_0x2da7d3[_0x35b5('0x30')]);_0x19d5a8[_0x35b5('0x32')]=_[_0x35b5('0x33')](_0x19d5a8[_0x35b5('0x2f')],_0x19d5a8[_0x35b5('0x30')]);_0x41403a[_0x35b5('0x35')]=_['intersection'](_0x19d5a8[_0x35b5('0x2f')],qs[_0x35b5('0x34')](_0x2da7d3[_0x35b5('0x30')][_0x35b5('0x34')]));_0x41403a[_0x35b5('0x35')]=_0x41403a[_0x35b5('0x35')][_0x35b5('0x36')]?_0x41403a[_0x35b5('0x35')]:_0x19d5a8[_0x35b5('0x2f')];if(_0x2da7d3[_0x35b5('0x30')][_0x35b5('0x42')]){_0x41403a['include']=[{'all':!![]}];}_0x41403a=_[_0x35b5('0x3e')]({},_0x41403a,_0x2da7d3[_0x35b5('0x40')]);return db[_0x35b5('0x2c')][_0x35b5('0x48')](_0x41403a)[_0x35b5('0x26')](handleEntityNotFound(_0x347a5c,null))['then'](respondWithResult(_0x347a5c,null))[_0x35b5('0x46')](handleError(_0x347a5c,null));};exports[_0x35b5('0x49')]=function(_0x15a4af,_0x2cc93f){return db[_0x35b5('0x2c')][_0x35b5('0x49')](_0x15a4af[_0x35b5('0x4a')],{})[_0x35b5('0x26')](respondWithResult(_0x2cc93f,0xc9))[_0x35b5('0x46')](handleError(_0x2cc93f,null));};exports[_0x35b5('0x25')]=function(_0x130a5f,_0x3996db){if(_0x130a5f['body']['id']){delete _0x130a5f[_0x35b5('0x4a')]['id'];}return db['ZohoField']['find']({'where':{'id':_0x130a5f['params']['id']}})[_0x35b5('0x26')](handleEntityNotFound(_0x3996db,null))[_0x35b5('0x26')](saveUpdates(_0x130a5f[_0x35b5('0x4a')],null))[_0x35b5('0x26')](respondWithResult(_0x3996db,null))[_0x35b5('0x46')](handleError(_0x3996db,null));};exports['destroy']=function(_0x5853de,_0x1914af){return db[_0x35b5('0x2c')][_0x35b5('0x48')]({'where':{'id':_0x5853de['params']['id']}})[_0x35b5('0x26')](handleEntityNotFound(_0x1914af,null))['then'](removeEntity(_0x1914af,null))['catch'](handleError(_0x1914af,null));}; \ No newline at end of file +var _0x8f37=['set','Content-Range','reject','update','then','destroy','error','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','params','keys','find','create','body','eml-format','rimraf','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x551975,_0x37fa3a){var _0x3e9cdb=function(_0x35ed84){while(--_0x35ed84){_0x551975['push'](_0x551975['shift']());}};_0x3e9cdb(++_0x37fa3a);}(_0x8f37,0x100));var _0x78f3=function(_0x1afc88,_0x28c4a8){_0x1afc88=_0x1afc88-0x0;var _0x4aebff=_0x8f37[_0x1afc88];return _0x4aebff;};'use strict';var emlformat=require(_0x78f3('0x0'));var rimraf=require(_0x78f3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x78f3('0x2'));var moment=require(_0x78f3('0x3'));var BPromise=require(_0x78f3('0x4'));var Mustache=require('mustache');var util=require(_0x78f3('0x5'));var path=require('path');var sox=require(_0x78f3('0x6'));var csv=require('to-csv');var ejs=require(_0x78f3('0x7'));var fs=require('fs');var fs_extra=require(_0x78f3('0x8'));var _=require(_0x78f3('0x9'));var squel=require('squel');var crypto=require(_0x78f3('0xa'));var jsforce=require(_0x78f3('0xb'));var deskjs=require(_0x78f3('0xc'));var toCsv=require(_0x78f3('0xd'));var querystring=require(_0x78f3('0xe'));var Papa=require(_0x78f3('0xf'));var Redis=require('ioredis');var authService=require(_0x78f3('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x78f3('0x11'));var hardwareService=require(_0x78f3('0x12'));var logger=require(_0x78f3('0x13'))('api');var utils=require(_0x78f3('0x14'));var config=require(_0x78f3('0x15'));var licenseUtil=require(_0x78f3('0x16'));var db=require(_0x78f3('0x17'))['db'];function respondWithStatusCode(_0x481086,_0x3d7f76){_0x3d7f76=_0x3d7f76||0xcc;return function(_0x41b530){if(_0x41b530){return _0x481086[_0x78f3('0x18')](_0x3d7f76);}return _0x481086[_0x78f3('0x19')](_0x3d7f76)[_0x78f3('0x1a')]();};}function respondWithResult(_0x511192,_0xd6a1f1){_0xd6a1f1=_0xd6a1f1||0xc8;return function(_0x5e3327){if(_0x5e3327){return _0x511192[_0x78f3('0x19')](_0xd6a1f1)[_0x78f3('0x1b')](_0x5e3327);}};}function respondWithFilteredResult(_0x21d3bb,_0x5d4123){return function(_0x539d2d){if(_0x539d2d){var _0x3931fd=typeof _0x5d4123[_0x78f3('0x1c')]===_0x78f3('0x1d')&&typeof _0x5d4123['limit']==='undefined';var _0x3d9ff6=_0x539d2d[_0x78f3('0x1e')];var _0x28f5e5=_0x3931fd?0x0:_0x5d4123['offset'];var _0x53f4d6=_0x3931fd?_0x539d2d[_0x78f3('0x1e')]:_0x5d4123['offset']+_0x5d4123[_0x78f3('0x1f')];var _0x4bda7f;if(_0x53f4d6>=_0x3d9ff6){_0x53f4d6=_0x3d9ff6;_0x4bda7f=0xc8;}else{_0x4bda7f=0xce;}_0x21d3bb[_0x78f3('0x19')](_0x4bda7f);return _0x21d3bb[_0x78f3('0x20')](_0x78f3('0x21'),_0x28f5e5+'-'+_0x53f4d6+'/'+_0x3d9ff6)[_0x78f3('0x1b')](_0x539d2d);}return null;};}function patchUpdates(_0x69ad4){return function(_0x502a53){try{jsonpatch['apply'](_0x502a53,_0x69ad4,!![]);}catch(_0x117337){return BPromise[_0x78f3('0x22')](_0x117337);}return _0x502a53['save']();};}function saveUpdates(_0x18afa6,_0x5c7adb){return function(_0x2350ce){if(_0x2350ce){return _0x2350ce[_0x78f3('0x23')](_0x18afa6)[_0x78f3('0x24')](function(_0x55582e){return _0x55582e;});}return null;};}function removeEntity(_0x4708c9,_0xb889bc){return function(_0x22d100){if(_0x22d100){return _0x22d100[_0x78f3('0x25')]()[_0x78f3('0x24')](function(){_0x4708c9[_0x78f3('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43efd9,_0x3c0d76){return function(_0xa8595a){if(!_0xa8595a){_0x43efd9[_0x78f3('0x18')](0x194);}return _0xa8595a;};}function handleError(_0x50560b,_0x58b8d1){_0x58b8d1=_0x58b8d1||0x1f4;return function(_0x4eb1aa){logger[_0x78f3('0x26')](_0x4eb1aa['stack']);if(_0x4eb1aa['name']){delete _0x4eb1aa[_0x78f3('0x27')];}_0x50560b[_0x78f3('0x19')](_0x58b8d1)[_0x78f3('0x28')](_0x4eb1aa);};}exports[_0x78f3('0x29')]=function(_0x3f069e,_0x331574){var _0x18d6e6={},_0x50704d={},_0x1f1ad7={'count':0x0,'rows':[]};var _0x5bf18f=_[_0x78f3('0x2a')](db[_0x78f3('0x2b')][_0x78f3('0x2c')],function(_0x2b77fa){return{'name':_0x2b77fa[_0x78f3('0x2d')],'type':_0x2b77fa[_0x78f3('0x2e')][_0x78f3('0x2f')]};});_0x50704d[_0x78f3('0x30')]=_[_0x78f3('0x2a')](_0x5bf18f,'name');_0x50704d[_0x78f3('0x31')]=_['keys'](_0x3f069e['query']);_0x50704d[_0x78f3('0x32')]=_[_0x78f3('0x33')](_0x50704d[_0x78f3('0x30')],_0x50704d[_0x78f3('0x31')]);_0x18d6e6[_0x78f3('0x34')]=_[_0x78f3('0x33')](_0x50704d[_0x78f3('0x30')],qs[_0x78f3('0x35')](_0x3f069e[_0x78f3('0x31')][_0x78f3('0x35')]));_0x18d6e6[_0x78f3('0x34')]=_0x18d6e6['attributes'][_0x78f3('0x36')]?_0x18d6e6[_0x78f3('0x34')]:_0x50704d[_0x78f3('0x30')];if(!_0x3f069e[_0x78f3('0x31')][_0x78f3('0x37')](_0x78f3('0x38'))){_0x18d6e6[_0x78f3('0x1f')]=qs[_0x78f3('0x1f')](_0x3f069e[_0x78f3('0x31')][_0x78f3('0x1f')]);_0x18d6e6['offset']=qs[_0x78f3('0x1c')](_0x3f069e[_0x78f3('0x31')][_0x78f3('0x1c')]);}_0x18d6e6[_0x78f3('0x39')]=qs[_0x78f3('0x3a')](_0x3f069e['query']['sort']);_0x18d6e6[_0x78f3('0x3b')]=qs[_0x78f3('0x32')](_['pick'](_0x3f069e[_0x78f3('0x31')],_0x50704d[_0x78f3('0x32')]),_0x5bf18f);if(_0x3f069e[_0x78f3('0x31')]['filter']){_0x18d6e6['where']=_[_0x78f3('0x3c')](_0x18d6e6['where'],{'$or':_['map'](_0x5bf18f,function(_0x1ea0ac){if(_0x1ea0ac['type']!==_0x78f3('0x3d')){var _0x3478c6={};_0x3478c6[_0x1ea0ac[_0x78f3('0x27')]]={'$like':'%'+_0x3f069e[_0x78f3('0x31')][_0x78f3('0x3e')]+'%'};return _0x3478c6;}})});}_0x18d6e6=_['merge']({},_0x18d6e6,_0x3f069e['options']);var _0x23808b={'where':_0x18d6e6[_0x78f3('0x3b')]};return db['ZohoField'][_0x78f3('0x1e')](_0x23808b)[_0x78f3('0x24')](function(_0x25eba0){_0x1f1ad7[_0x78f3('0x1e')]=_0x25eba0;if(_0x3f069e[_0x78f3('0x31')][_0x78f3('0x3f')]){_0x18d6e6['include']=[{'all':!![]}];}return db['ZohoField'][_0x78f3('0x40')](_0x18d6e6);})[_0x78f3('0x24')](function(_0x5aab54){_0x1f1ad7[_0x78f3('0x41')]=_0x5aab54;return _0x1f1ad7;})['then'](respondWithFilteredResult(_0x331574,_0x18d6e6))[_0x78f3('0x42')](handleError(_0x331574,null));};exports['show']=function(_0x1cdf7c,_0x5db806){var _0x40df9e={'raw':!![],'where':{'id':_0x1cdf7c[_0x78f3('0x43')]['id']}},_0x18a667={};_0x18a667[_0x78f3('0x30')]=_[_0x78f3('0x44')](db[_0x78f3('0x2b')]['rawAttributes']);_0x18a667['query']=_['keys'](_0x1cdf7c[_0x78f3('0x31')]);_0x18a667[_0x78f3('0x32')]=_[_0x78f3('0x33')](_0x18a667['model'],_0x18a667['query']);_0x40df9e[_0x78f3('0x34')]=_[_0x78f3('0x33')](_0x18a667['model'],qs[_0x78f3('0x35')](_0x1cdf7c[_0x78f3('0x31')][_0x78f3('0x35')]));_0x40df9e['attributes']=_0x40df9e[_0x78f3('0x34')]['length']?_0x40df9e['attributes']:_0x18a667[_0x78f3('0x30')];if(_0x1cdf7c[_0x78f3('0x31')]['includeAll']){_0x40df9e['include']=[{'all':!![]}];}_0x40df9e=_['merge']({},_0x40df9e,_0x1cdf7c['options']);return db['ZohoField'][_0x78f3('0x45')](_0x40df9e)['then'](handleEntityNotFound(_0x5db806,null))[_0x78f3('0x24')](respondWithResult(_0x5db806,null))['catch'](handleError(_0x5db806,null));};exports[_0x78f3('0x46')]=function(_0x1c4b43,_0x4c6b82){return db['ZohoField'][_0x78f3('0x46')](_0x1c4b43[_0x78f3('0x47')],{})['then'](respondWithResult(_0x4c6b82,0xc9))[_0x78f3('0x42')](handleError(_0x4c6b82,null));};exports[_0x78f3('0x23')]=function(_0xc12910,_0x45b36e){if(_0xc12910['body']['id']){delete _0xc12910[_0x78f3('0x47')]['id'];}return db[_0x78f3('0x2b')]['find']({'where':{'id':_0xc12910[_0x78f3('0x43')]['id']}})[_0x78f3('0x24')](handleEntityNotFound(_0x45b36e,null))[_0x78f3('0x24')](saveUpdates(_0xc12910[_0x78f3('0x47')],null))[_0x78f3('0x24')](respondWithResult(_0x45b36e,null))['catch'](handleError(_0x45b36e,null));};exports['destroy']=function(_0x3fee98,_0x85e994){return db[_0x78f3('0x2b')][_0x78f3('0x45')]({'where':{'id':_0x3fee98[_0x78f3('0x43')]['id']}})[_0x78f3('0x24')](handleEntityNotFound(_0x85e994,null))[_0x78f3('0x24')](removeEntity(_0x85e994,null))[_0x78f3('0x42')](handleError(_0x85e994,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index a1ab83d..7a7aa64 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 _0x4137=['path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5c3107,_0x3d1516){var _0x4773b8=function(_0x508ef1){while(--_0x508ef1){_0x5c3107['push'](_0x5c3107['shift']());}};_0x4773b8(++_0x3d1516);}(_0x4137,0xf8));var _0x7413=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x4137[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var logger=require(_0x7413('0x2'))(_0x7413('0x3'));var moment=require(_0x7413('0x4'));var BPromise=require(_0x7413('0x5'));var rp=require(_0x7413('0x6'));var fs=require('fs');var path=require(_0x7413('0x7'));var rimraf=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var attributes=require(_0x7413('0xa'));module[_0x7413('0xb')]=function(_0x4fbade,_0xc808cd){return _0x4fbade[_0x7413('0xc')](_0x7413('0xd'),attributes,{'tableName':_0x7413('0xe'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x7413('0xf'),_0x7413('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcaf2=['rimraf','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x3850f2,_0x2e4e83){var _0xcfc360=function(_0x2ef6c6){while(--_0x2ef6c6){_0x3850f2['push'](_0x3850f2['shift']());}};_0xcfc360(++_0x2e4e83);}(_0xcaf2,0x8a));var _0x2caf=function(_0x4745d9,_0x411b00){_0x4745d9=_0x4745d9-0x0;var _0x38f2ac=_0xcaf2[_0x4745d9];return _0x38f2ac;};'use strict';var _=require(_0x2caf('0x0'));var util=require('util');var logger=require(_0x2caf('0x1'))(_0x2caf('0x2'));var moment=require('moment');var BPromise=require(_0x2caf('0x3'));var rp=require(_0x2caf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2caf('0x5'));var config=require('../../config/environment');var attributes=require(_0x2caf('0x6'));module[_0x2caf('0x7')]=function(_0x249a4b,_0x599ce7){return _0x249a4b[_0x2caf('0x8')](_0x2caf('0x9'),attributes,{'tableName':_0x2caf('0xa'),'paranoid':![],'indexes':[{'name':_0x2caf('0xb'),'fields':['idField',_0x2caf('0xc')],'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 7fd8963..7645d72 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 _0xa348=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0x3ace3d,_0x371b58){var _0x490103=function(_0x43aca0){while(--_0x43aca0){_0x3ace3d['push'](_0x3ace3d['shift']());}};_0x490103(++_0x371b58);}(_0xa348,0x1b8));var _0x8a34=function(_0x2a9787,_0xa6645d){_0x2a9787=_0x2a9787-0x0;var _0x3a0ba6=_0xa348[_0x2a9787];return _0x3a0ba6;};'use strict';var _=require('lodash');var util=require(_0x8a34('0x0'));var moment=require(_0x8a34('0x1'));var BPromise=require(_0x8a34('0x2'));var rs=require(_0x8a34('0x3'));var fs=require('fs');var Redis=require(_0x8a34('0x4'));var db=require(_0x8a34('0x5'))['db'];var utils=require(_0x8a34('0x6'));var logger=require(_0x8a34('0x7'))(_0x8a34('0x8'));var config=require('../../config/environment');var jayson=require(_0x8a34('0x9'));var client=jayson[_0x8a34('0xa')][_0x8a34('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2be307,_0x1e45a6,_0x3e8d5c){return new BPromise(function(_0x574597,_0x5428c9){return client[_0x8a34('0xc')](_0x2be307,_0x3e8d5c)['then'](function(_0x37f0a1){logger[_0x8a34('0xd')](_0x8a34('0xe'),_0x1e45a6,_0x8a34('0xf'));logger[_0x8a34('0x10')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x1e45a6,'request\x20sent',JSON[_0x8a34('0x11')](_0x37f0a1));if(_0x37f0a1[_0x8a34('0x12')]){if(_0x37f0a1[_0x8a34('0x12')]['code']===0x1f4){logger[_0x8a34('0x12')](_0x8a34('0xe'),_0x1e45a6,_0x37f0a1[_0x8a34('0x12')][_0x8a34('0x13')]);return _0x5428c9(_0x37f0a1['error']['message']);}logger['error'](_0x8a34('0xe'),_0x1e45a6,_0x37f0a1[_0x8a34('0x12')][_0x8a34('0x13')]);return _0x574597(_0x37f0a1['error'][_0x8a34('0x13')]);}else{logger[_0x8a34('0xd')](_0x8a34('0xe'),_0x1e45a6,_0x8a34('0xf'));_0x574597(_0x37f0a1[_0x8a34('0x14')][_0x8a34('0x13')]);}})[_0x8a34('0x15')](function(_0x413ad8){logger[_0x8a34('0x12')](_0x8a34('0xe'),_0x1e45a6,_0x413ad8);_0x5428c9(_0x413ad8);});});} \ No newline at end of file +var _0xc2cf=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird'];(function(_0x20a457,_0x3d866b){var _0x1a5293=function(_0x1d8b93){while(--_0x1d8b93){_0x20a457['push'](_0x20a457['shift']());}};_0x1a5293(++_0x3d866b);}(_0xc2cf,0x1a1));var _0xfc2c=function(_0x613c62,_0x523ae7){_0x613c62=_0x613c62-0x0;var _0x39a9f4=_0xc2cf[_0x613c62];return _0x39a9f4;};'use strict';var _=require(_0xfc2c('0x0'));var util=require('util');var moment=require(_0xfc2c('0x1'));var BPromise=require(_0xfc2c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc2c('0x3'));var db=require(_0xfc2c('0x4'))['db'];var utils=require(_0xfc2c('0x5'));var logger=require('../../config/logger')(_0xfc2c('0x6'));var config=require(_0xfc2c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfc2c('0x8')][_0xfc2c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x453ba4,_0x568a42,_0x43ed70){return new BPromise(function(_0x27eaa1,_0x1bf841){return client[_0xfc2c('0xa')](_0x453ba4,_0x43ed70)[_0xfc2c('0xb')](function(_0x2e1c60){logger[_0xfc2c('0xc')](_0xfc2c('0xd'),_0x568a42,_0xfc2c('0xe'));logger['debug'](_0xfc2c('0xf'),_0x568a42,_0xfc2c('0xe'),JSON[_0xfc2c('0x10')](_0x2e1c60));if(_0x2e1c60[_0xfc2c('0x11')]){if(_0x2e1c60['error'][_0xfc2c('0x12')]===0x1f4){logger[_0xfc2c('0x11')](_0xfc2c('0xd'),_0x568a42,_0x2e1c60[_0xfc2c('0x11')][_0xfc2c('0x13')]);return _0x1bf841(_0x2e1c60[_0xfc2c('0x11')]['message']);}logger[_0xfc2c('0x11')](_0xfc2c('0xd'),_0x568a42,_0x2e1c60[_0xfc2c('0x11')][_0xfc2c('0x13')]);return _0x27eaa1(_0x2e1c60['error'][_0xfc2c('0x13')]);}else{logger[_0xfc2c('0xc')](_0xfc2c('0xd'),_0x568a42,_0xfc2c('0xe'));_0x27eaa1(_0x2e1c60[_0xfc2c('0x14')][_0xfc2c('0x13')]);}})['catch'](function(_0x5b0633){logger['error'](_0xfc2c('0xd'),_0x568a42,_0x5b0633);_0x1bf841(_0x5b0633);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 542fa69..6a6f564 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x48fec7,_0x30b839){var _0x4f43de=function(_0xe29b75){while(--_0xe29b75){_0x48fec7['push'](_0x48fec7['shift']());}};_0x4f43de(++_0x30b839);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x37976f,_0x3576d8){var _0x69294e=function(_0x50c352){while(--_0x50c352){_0x37976f['push'](_0x37976f['shift']());}};_0x69294e(++_0x3576d8);}(_0xedd9,0xfc));var _0x9edd=function(_0xc2668a,_0x5ec14a){_0xc2668a=_0xc2668a-0x0;var _0x2b0c27=_0xedd9[_0xc2668a];return _0x2b0c27;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index c5dbdbe..de3b9df 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 _0x20ff=['BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0x59c185,_0x590908){var _0x3bdb89=function(_0x47559f){while(--_0x47559f){_0x59c185['push'](_0x59c185['shift']());}};_0x3bdb89(++_0x590908);}(_0x20ff,0x16e));var _0xf20f=function(_0x5dc62d,_0x2e71c7){_0x5dc62d=_0x5dc62d-0x0;var _0x4ef393=_0x20ff[_0x5dc62d];return _0x4ef393;};'use strict';var Sequelize=require(_0xf20f('0x0'));module[_0xf20f('0x1')]={'name':{'type':Sequelize[_0xf20f('0x2')],'allowNull':![],'unique':_0xf20f('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xf20f('0x2')],'defaultValue':_0xf20f('0x4')},'filename':{'type':Sequelize[_0xf20f('0x2')]},'path':{'type':Sequelize[_0xf20f('0x2')]},'type':{'type':Sequelize[_0xf20f('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xf20f('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xf20f('0x2')]},'state':{'type':Sequelize[_0xf20f('0x2')],'unique':_0xf20f('0x6')},'description':{'type':Sequelize[_0xf20f('0x2')]},'title':{'type':Sequelize[_0xf20f('0x2')]},'remoteUri':{'type':Sequelize[_0xf20f('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x4380=['unique_name_and_version','STRING','INTEGER','BOOLEAN','state','sequelize','exports'];(function(_0x5b1d8d,_0x3cb2da){var _0x52ae5f=function(_0x5e4854){while(--_0x5e4854){_0x5b1d8d['push'](_0x5b1d8d['shift']());}};_0x52ae5f(++_0x3cb2da);}(_0x4380,0x186));var _0x0438=function(_0x243d10,_0x5c586c){_0x243d10=_0x243d10-0x0;var _0x2d1d9e=_0x4380[_0x243d10];return _0x2d1d9e;};'use strict';var Sequelize=require(_0x0438('0x0'));module[_0x0438('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0438('0x2')},'version':{'type':Sequelize[_0x0438('0x3')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x0438('0x3')],'defaultValue':'app.js'},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x0438('0x3')]},'type':{'type':Sequelize[_0x0438('0x3')]},'size':{'type':Sequelize[_0x0438('0x4')]},'active':{'type':Sequelize[_0x0438('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x0438('0x3')]},'state':{'type':Sequelize[_0x0438('0x3')],'unique':_0x0438('0x6')},'description':{'type':Sequelize[_0x0438('0x3')]},'title':{'type':Sequelize[_0x0438('0x3')]},'remoteUri':{'type':Sequelize[_0x0438('0x3')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index b029da3..85dcccb 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 _0x1883=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Integration','includeAll','include','findAll','params','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','apply','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x3a7d0b,_0x5afcb0){var _0x251fe2=function(_0x3026f7){while(--_0x3026f7){_0x3a7d0b['push'](_0x3a7d0b['shift']());}};_0x251fe2(++_0x5afcb0);}(_0x1883,0xab));var _0x3188=function(_0x5c9f40,_0x19203f){_0x5c9f40=_0x5c9f40-0x0;var _0x51f8ea=_0x1883[_0x5c9f40];return _0x51f8ea;};'use strict';var emlformat=require(_0x3188('0x0'));var rimraf=require(_0x3188('0x1'));var zipdir=require(_0x3188('0x2'));var jsonpatch=require(_0x3188('0x3'));var rp=require(_0x3188('0x4'));var moment=require(_0x3188('0x5'));var BPromise=require(_0x3188('0x6'));var Mustache=require(_0x3188('0x7'));var util=require(_0x3188('0x8'));var path=require(_0x3188('0x9'));var sox=require(_0x3188('0xa'));var csv=require(_0x3188('0xb'));var ejs=require(_0x3188('0xc'));var fs=require('fs');var fs_extra=require(_0x3188('0xd'));var _=require(_0x3188('0xe'));var squel=require(_0x3188('0xf'));var crypto=require(_0x3188('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x3188('0x11'));var toCsv=require(_0x3188('0xb'));var querystring=require('querystring');var Papa=require(_0x3188('0x12'));var Redis=require('ioredis');var authService=require(_0x3188('0x13'));var qs=require(_0x3188('0x14'));var as=require(_0x3188('0x15'));var hardwareService=require(_0x3188('0x16'));var logger=require('../../config/logger')(_0x3188('0x17'));var utils=require(_0x3188('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3188('0x19'))['db'];function respondWithStatusCode(_0x45e94e,_0x20fef6){_0x20fef6=_0x20fef6||0xcc;return function(_0x3ae228){if(_0x3ae228){return _0x45e94e[_0x3188('0x1a')](_0x20fef6);}return _0x45e94e[_0x3188('0x1b')](_0x20fef6)['end']();};}function respondWithResult(_0x276d69,_0x5e0044){_0x5e0044=_0x5e0044||0xc8;return function(_0x4a2f36){if(_0x4a2f36){return _0x276d69[_0x3188('0x1b')](_0x5e0044)['json'](_0x4a2f36);}};}function respondWithFilteredResult(_0x54a87f,_0x32c239){return function(_0x1beead){if(_0x1beead){var _0xa2269=typeof _0x32c239[_0x3188('0x1c')]===_0x3188('0x1d')&&typeof _0x32c239[_0x3188('0x1e')]==='undefined';var _0x19cc72=_0x1beead[_0x3188('0x1f')];var _0x3f5b35=_0xa2269?0x0:_0x32c239[_0x3188('0x1c')];var _0x18a71a=_0xa2269?_0x1beead[_0x3188('0x1f')]:_0x32c239[_0x3188('0x1c')]+_0x32c239[_0x3188('0x1e')];var _0x5bcbba;if(_0x18a71a>=_0x19cc72){_0x18a71a=_0x19cc72;_0x5bcbba=0xc8;}else{_0x5bcbba=0xce;}_0x54a87f[_0x3188('0x1b')](_0x5bcbba);return _0x54a87f[_0x3188('0x20')]('Content-Range',_0x3f5b35+'-'+_0x18a71a+'/'+_0x19cc72)['json'](_0x1beead);}return null;};}function patchUpdates(_0x5d8d62){return function(_0x46a318){try{jsonpatch[_0x3188('0x21')](_0x46a318,_0x5d8d62,!![]);}catch(_0xd292b5){return BPromise['reject'](_0xd292b5);}return _0x46a318['save']();};}function saveUpdates(_0x266260,_0x461286){return function(_0x375077){if(_0x375077){return _0x375077[_0x3188('0x22')](_0x266260)[_0x3188('0x23')](function(_0x4bd5ee){return _0x4bd5ee;});}return null;};}function removeEntity(_0x30cf2c,_0x33f882){return function(_0x5a2e67){if(_0x5a2e67){return _0x5a2e67[_0x3188('0x24')]()['then'](function(){_0x30cf2c['status'](0xcc)[_0x3188('0x25')]();});}};}function handleEntityNotFound(_0x129bd7,_0x87d5a3){return function(_0x1aeaba){if(!_0x1aeaba){_0x129bd7[_0x3188('0x1a')](0x194);}return _0x1aeaba;};}function handleError(_0x2cd060,_0xe57f73){_0xe57f73=_0xe57f73||0x1f4;return function(_0x11021c){logger['error'](_0x11021c[_0x3188('0x26')]);if(_0x11021c[_0x3188('0x27')]){delete _0x11021c['name'];}_0x2cd060[_0x3188('0x1b')](_0xe57f73)[_0x3188('0x28')](_0x11021c);};}exports[_0x3188('0x29')]=function(_0x44db9a,_0x20e6aa){var _0x1f1c6f={},_0x8f810f={},_0x472926={'count':0x0,'rows':[]};var _0x57c21c=_[_0x3188('0x2a')](db['Integration'][_0x3188('0x2b')],function(_0x5623f1){return{'name':_0x5623f1[_0x3188('0x2c')],'type':_0x5623f1[_0x3188('0x2d')][_0x3188('0x2e')]};});_0x8f810f[_0x3188('0x2f')]=_[_0x3188('0x2a')](_0x57c21c,_0x3188('0x27'));_0x8f810f[_0x3188('0x30')]=_[_0x3188('0x31')](_0x44db9a[_0x3188('0x30')]);_0x8f810f[_0x3188('0x32')]=_[_0x3188('0x33')](_0x8f810f[_0x3188('0x2f')],_0x8f810f[_0x3188('0x30')]);_0x1f1c6f[_0x3188('0x34')]=_[_0x3188('0x33')](_0x8f810f[_0x3188('0x2f')],qs[_0x3188('0x35')](_0x44db9a[_0x3188('0x30')]['fields']));_0x1f1c6f[_0x3188('0x34')]=_0x1f1c6f['attributes'][_0x3188('0x36')]?_0x1f1c6f[_0x3188('0x34')]:_0x8f810f['model'];if(!_0x44db9a[_0x3188('0x30')][_0x3188('0x37')](_0x3188('0x38'))){_0x1f1c6f[_0x3188('0x1e')]=qs[_0x3188('0x1e')](_0x44db9a[_0x3188('0x30')][_0x3188('0x1e')]);_0x1f1c6f['offset']=qs['offset'](_0x44db9a[_0x3188('0x30')][_0x3188('0x1c')]);}_0x1f1c6f[_0x3188('0x39')]=qs[_0x3188('0x3a')](_0x44db9a['query'][_0x3188('0x3a')]);_0x1f1c6f[_0x3188('0x3b')]=qs[_0x3188('0x32')](_[_0x3188('0x3c')](_0x44db9a['query'],_0x8f810f[_0x3188('0x32')]),_0x57c21c);if(_0x44db9a['query'][_0x3188('0x3d')]){_0x1f1c6f['where']=_[_0x3188('0x3e')](_0x1f1c6f[_0x3188('0x3b')],{'$or':_[_0x3188('0x2a')](_0x57c21c,function(_0x2990c4){if(_0x2990c4[_0x3188('0x2d')]!==_0x3188('0x3f')){var _0x4666b2={};_0x4666b2[_0x2990c4[_0x3188('0x27')]]={'$like':'%'+_0x44db9a[_0x3188('0x30')][_0x3188('0x3d')]+'%'};return _0x4666b2;}})});}_0x1f1c6f=_['merge']({},_0x1f1c6f,_0x44db9a[_0x3188('0x40')]);var _0x2bad0f={'where':_0x1f1c6f[_0x3188('0x3b')]};return db[_0x3188('0x41')][_0x3188('0x1f')](_0x2bad0f)[_0x3188('0x23')](function(_0x5a815d){_0x472926[_0x3188('0x1f')]=_0x5a815d;if(_0x44db9a['query'][_0x3188('0x42')]){_0x1f1c6f[_0x3188('0x43')]=[{'all':!![]}];}return db[_0x3188('0x41')][_0x3188('0x44')](_0x1f1c6f);})[_0x3188('0x23')](function(_0x549ab2){_0x472926['rows']=_0x549ab2;return _0x472926;})['then'](respondWithFilteredResult(_0x20e6aa,_0x1f1c6f))['catch'](handleError(_0x20e6aa,null));};exports['show']=function(_0x763943,_0x28c224){var _0x3e5f90={'raw':![],'where':{'id':_0x763943[_0x3188('0x45')]['id']}},_0x1b40b1={};_0x1b40b1['model']=_[_0x3188('0x31')](db['Integration'][_0x3188('0x2b')]);_0x1b40b1[_0x3188('0x30')]=_[_0x3188('0x31')](_0x763943[_0x3188('0x30')]);_0x1b40b1['filters']=_[_0x3188('0x33')](_0x1b40b1[_0x3188('0x2f')],_0x1b40b1[_0x3188('0x30')]);_0x3e5f90[_0x3188('0x34')]=_[_0x3188('0x33')](_0x1b40b1['model'],qs['fields'](_0x763943[_0x3188('0x30')][_0x3188('0x35')]));_0x3e5f90['attributes']=_0x3e5f90[_0x3188('0x34')][_0x3188('0x36')]?_0x3e5f90['attributes']:_0x1b40b1[_0x3188('0x2f')];if(_0x763943[_0x3188('0x30')][_0x3188('0x42')]){_0x3e5f90[_0x3188('0x43')]=[{'all':!![]}];}_0x3e5f90=_[_0x3188('0x3e')]({},_0x3e5f90,_0x763943['options']);return db[_0x3188('0x41')]['find'](_0x3e5f90)[_0x3188('0x23')](handleEntityNotFound(_0x28c224,null))[_0x3188('0x23')](respondWithResult(_0x28c224,null))[_0x3188('0x46')](handleError(_0x28c224,null));};exports[_0x3188('0x47')]=function(_0xe4cbb0,_0x315524){return db[_0x3188('0x41')][_0x3188('0x47')](_0xe4cbb0[_0x3188('0x48')],{})[_0x3188('0x23')](respondWithResult(_0x315524,0xc9))[_0x3188('0x46')](handleError(_0x315524,null));};exports['update']=function(_0x50fd56,_0x1b012d){if(_0x50fd56['body']['id']){delete _0x50fd56[_0x3188('0x48')]['id'];}return db[_0x3188('0x41')]['find']({'where':{'id':_0x50fd56[_0x3188('0x45')]['id']}})[_0x3188('0x23')](handleEntityNotFound(_0x1b012d,null))[_0x3188('0x23')](saveUpdates(_0x50fd56[_0x3188('0x48')],null))[_0x3188('0x23')](respondWithResult(_0x1b012d,null))[_0x3188('0x46')](handleError(_0x1b012d,null));};exports[_0x3188('0x24')]=function(_0x1e3592,_0x59a177){return db[_0x3188('0x41')][_0x3188('0x49')]({'where':{'id':_0x1e3592['params']['id']}})[_0x3188('0x23')](handleEntityNotFound(_0x59a177,null))['then'](removeEntity(_0x59a177,null))[_0x3188('0x46')](handleError(_0x59a177,null));}; \ No newline at end of file +var _0xc1c6=['type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','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','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','Integration','rawAttributes'];(function(_0x28171e,_0xc97520){var _0x4c7664=function(_0x3b9281){while(--_0x3b9281){_0x28171e['push'](_0x28171e['shift']());}};_0x4c7664(++_0xc97520);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x3b0928,_0x25acd9){_0x3b0928=_0x3b0928-0x0;var _0xd375e2=_0xc1c6[_0x3b0928];return _0xd375e2;};'use strict';var emlformat=require(_0x6c1c('0x0'));var rimraf=require(_0x6c1c('0x1'));var zipdir=require(_0x6c1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c1c('0x3'));var moment=require('moment');var BPromise=require(_0x6c1c('0x4'));var Mustache=require(_0x6c1c('0x5'));var util=require(_0x6c1c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6c1c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c1c('0x8'));var _=require('lodash');var squel=require(_0x6c1c('0x9'));var crypto=require(_0x6c1c('0xa'));var jsforce=require(_0x6c1c('0xb'));var deskjs=require(_0x6c1c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6c1c('0xd'));var Papa=require(_0x6c1c('0xe'));var Redis=require('ioredis');var authService=require(_0x6c1c('0xf'));var qs=require(_0x6c1c('0x10'));var as=require(_0x6c1c('0x11'));var hardwareService=require(_0x6c1c('0x12'));var logger=require('../../config/logger')(_0x6c1c('0x13'));var utils=require(_0x6c1c('0x14'));var config=require(_0x6c1c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c1c('0x16'))['db'];function respondWithStatusCode(_0x12a9e6,_0x2067bd){_0x2067bd=_0x2067bd||0xcc;return function(_0x49304f){if(_0x49304f){return _0x12a9e6[_0x6c1c('0x17')](_0x2067bd);}return _0x12a9e6['status'](_0x2067bd)[_0x6c1c('0x18')]();};}function respondWithResult(_0x15a1fc,_0x2d279e){_0x2d279e=_0x2d279e||0xc8;return function(_0x154107){if(_0x154107){return _0x15a1fc[_0x6c1c('0x19')](_0x2d279e)[_0x6c1c('0x1a')](_0x154107);}};}function respondWithFilteredResult(_0x297c33,_0x41aa74){return function(_0x448f35){if(_0x448f35){var _0x5f3758=typeof _0x41aa74[_0x6c1c('0x1b')]===_0x6c1c('0x1c')&&typeof _0x41aa74['limit']===_0x6c1c('0x1c');var _0x237cac=_0x448f35['count'];var _0x137770=_0x5f3758?0x0:_0x41aa74['offset'];var _0x338dc2=_0x5f3758?_0x448f35[_0x6c1c('0x1d')]:_0x41aa74['offset']+_0x41aa74[_0x6c1c('0x1e')];var _0x59ab38;if(_0x338dc2>=_0x237cac){_0x338dc2=_0x237cac;_0x59ab38=0xc8;}else{_0x59ab38=0xce;}_0x297c33[_0x6c1c('0x19')](_0x59ab38);return _0x297c33[_0x6c1c('0x1f')](_0x6c1c('0x20'),_0x137770+'-'+_0x338dc2+'/'+_0x237cac)[_0x6c1c('0x1a')](_0x448f35);}return null;};}function patchUpdates(_0x1acf7f){return function(_0x1efb19){try{jsonpatch[_0x6c1c('0x21')](_0x1efb19,_0x1acf7f,!![]);}catch(_0x2ed830){return BPromise[_0x6c1c('0x22')](_0x2ed830);}return _0x1efb19[_0x6c1c('0x23')]();};}function saveUpdates(_0x3d2bf3,_0x450b1f){return function(_0x2382c0){if(_0x2382c0){return _0x2382c0[_0x6c1c('0x24')](_0x3d2bf3)[_0x6c1c('0x25')](function(_0x19c269){return _0x19c269;});}return null;};}function removeEntity(_0x2319d3,_0x12c638){return function(_0x3a3f13){if(_0x3a3f13){return _0x3a3f13[_0x6c1c('0x26')]()[_0x6c1c('0x25')](function(){_0x2319d3[_0x6c1c('0x19')](0xcc)[_0x6c1c('0x18')]();});}};}function handleEntityNotFound(_0x7ff10d,_0x18452d){return function(_0x80bc05){if(!_0x80bc05){_0x7ff10d[_0x6c1c('0x17')](0x194);}return _0x80bc05;};}function handleError(_0x1b9d7d,_0x2feaf4){_0x2feaf4=_0x2feaf4||0x1f4;return function(_0x5f4568){logger[_0x6c1c('0x27')](_0x5f4568['stack']);if(_0x5f4568[_0x6c1c('0x28')]){delete _0x5f4568['name'];}_0x1b9d7d[_0x6c1c('0x19')](_0x2feaf4)['send'](_0x5f4568);};}exports[_0x6c1c('0x29')]=function(_0xf557ba,_0x504348){var _0x3b1a4f={},_0x24da4c={},_0x4e13e3={'count':0x0,'rows':[]};var _0x3b319a=_[_0x6c1c('0x2a')](db[_0x6c1c('0x2b')][_0x6c1c('0x2c')],function(_0x4fc279){return{'name':_0x4fc279['fieldName'],'type':_0x4fc279[_0x6c1c('0x2d')][_0x6c1c('0x2e')]};});_0x24da4c[_0x6c1c('0x2f')]=_[_0x6c1c('0x2a')](_0x3b319a,_0x6c1c('0x28'));_0x24da4c[_0x6c1c('0x30')]=_['keys'](_0xf557ba[_0x6c1c('0x30')]);_0x24da4c[_0x6c1c('0x31')]=_['intersection'](_0x24da4c[_0x6c1c('0x2f')],_0x24da4c[_0x6c1c('0x30')]);_0x3b1a4f[_0x6c1c('0x32')]=_[_0x6c1c('0x33')](_0x24da4c['model'],qs[_0x6c1c('0x34')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x3b1a4f['attributes']=_0x3b1a4f[_0x6c1c('0x32')]['length']?_0x3b1a4f[_0x6c1c('0x32')]:_0x24da4c['model'];if(!_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x35')](_0x6c1c('0x36'))){_0x3b1a4f['limit']=qs['limit'](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x1e')]);_0x3b1a4f[_0x6c1c('0x1b')]=qs['offset'](_0xf557ba[_0x6c1c('0x30')]['offset']);}_0x3b1a4f['order']=qs[_0x6c1c('0x37')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x37')]);_0x3b1a4f[_0x6c1c('0x38')]=qs['filters'](_[_0x6c1c('0x39')](_0xf557ba[_0x6c1c('0x30')],_0x24da4c[_0x6c1c('0x31')]),_0x3b319a);if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]){_0x3b1a4f[_0x6c1c('0x38')]=_[_0x6c1c('0x3b')](_0x3b1a4f[_0x6c1c('0x38')],{'$or':_[_0x6c1c('0x2a')](_0x3b319a,function(_0x232508){if(_0x232508['type']!==_0x6c1c('0x3c')){var _0x464549={};_0x464549[_0x232508[_0x6c1c('0x28')]]={'$like':'%'+_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]+'%'};return _0x464549;}})});}_0x3b1a4f=_['merge']({},_0x3b1a4f,_0xf557ba['options']);var _0x549db1={'where':_0x3b1a4f[_0x6c1c('0x38')]};return db['Integration']['count'](_0x549db1)[_0x6c1c('0x25')](function(_0x37244e){_0x4e13e3['count']=_0x37244e;if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x3b1a4f[_0x6c1c('0x3e')]=[{'all':!![]}];}return db['Integration'][_0x6c1c('0x3f')](_0x3b1a4f);})[_0x6c1c('0x25')](function(_0x502e75){_0x4e13e3[_0x6c1c('0x40')]=_0x502e75;return _0x4e13e3;})['then'](respondWithFilteredResult(_0x504348,_0x3b1a4f))[_0x6c1c('0x41')](handleError(_0x504348,null));};exports[_0x6c1c('0x42')]=function(_0x16a389,_0x174f2c){var _0x10764a={'raw':![],'where':{'id':_0x16a389[_0x6c1c('0x43')]['id']}},_0x595ba2={};_0x595ba2[_0x6c1c('0x2f')]=_[_0x6c1c('0x44')](db['Integration'][_0x6c1c('0x2c')]);_0x595ba2[_0x6c1c('0x30')]=_[_0x6c1c('0x44')](_0x16a389[_0x6c1c('0x30')]);_0x595ba2[_0x6c1c('0x31')]=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],_0x595ba2['query']);_0x10764a['attributes']=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],qs[_0x6c1c('0x34')](_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x10764a[_0x6c1c('0x32')]=_0x10764a[_0x6c1c('0x32')][_0x6c1c('0x45')]?_0x10764a[_0x6c1c('0x32')]:_0x595ba2['model'];if(_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x10764a['include']=[{'all':!![]}];}_0x10764a=_[_0x6c1c('0x3b')]({},_0x10764a,_0x16a389['options']);return db[_0x6c1c('0x2b')][_0x6c1c('0x46')](_0x10764a)[_0x6c1c('0x25')](handleEntityNotFound(_0x174f2c,null))[_0x6c1c('0x25')](respondWithResult(_0x174f2c,null))[_0x6c1c('0x41')](handleError(_0x174f2c,null));};exports['create']=function(_0x1fe6e8,_0x58d075){return db[_0x6c1c('0x2b')][_0x6c1c('0x47')](_0x1fe6e8[_0x6c1c('0x48')],{})[_0x6c1c('0x25')](respondWithResult(_0x58d075,0xc9))[_0x6c1c('0x41')](handleError(_0x58d075,null));};exports[_0x6c1c('0x24')]=function(_0x52c14d,_0xa9889a){if(_0x52c14d[_0x6c1c('0x48')]['id']){delete _0x52c14d['body']['id'];}return db[_0x6c1c('0x2b')][_0x6c1c('0x46')]({'where':{'id':_0x52c14d[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0xa9889a,null))['then'](saveUpdates(_0x52c14d[_0x6c1c('0x48')],null))[_0x6c1c('0x25')](respondWithResult(_0xa9889a,null))[_0x6c1c('0x41')](handleError(_0xa9889a,null));};exports['destroy']=function(_0x5b8d69,_0x56b367){return db['Integration']['find']({'where':{'id':_0x5b8d69[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0x56b367,null))['then'](removeEntity(_0x56b367,null))[_0x6c1c('0x41')](handleError(_0x56b367,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 59a7019..0b3a514 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 _0x2a51=['../../config/environment','./integration.attributes','define','Integration','integrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a51,0x7a));var _0x12a5=function(_0x59ba9a,_0x3c0ca2){_0x59ba9a=_0x59ba9a-0x0;var _0x4de024=_0x2a51[_0x59ba9a];return _0x4de024;};'use strict';var _=require(_0x12a5('0x0'));var util=require(_0x12a5('0x1'));var logger=require(_0x12a5('0x2'))(_0x12a5('0x3'));var moment=require(_0x12a5('0x4'));var BPromise=require(_0x12a5('0x5'));var rp=require(_0x12a5('0x6'));var fs=require('fs');var path=require(_0x12a5('0x7'));var rimraf=require('rimraf');var config=require(_0x12a5('0x8'));var attributes=require(_0x12a5('0x9'));module['exports']=function(_0xf2e3ad,_0x3fd909){return _0xf2e3ad[_0x12a5('0xa')](_0x12a5('0xb'),attributes,{'tableName':_0x12a5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c22=['api','bluebird','path','rimraf','./integration.attributes','define','Integration','integrations','lodash','../../config/logger'];(function(_0x1b8c54,_0x10c6cc){var _0x59932a=function(_0x5af27f){while(--_0x5af27f){_0x1b8c54['push'](_0x1b8c54['shift']());}};_0x59932a(++_0x10c6cc);}(_0x7c22,0xa8));var _0x27c2=function(_0x539bf4,_0xc6b29a){_0x539bf4=_0x539bf4-0x0;var _0x3afade=_0x7c22[_0x539bf4];return _0x3afade;};'use strict';var _=require(_0x27c2('0x0'));var util=require('util');var logger=require(_0x27c2('0x1'))(_0x27c2('0x2'));var moment=require('moment');var BPromise=require(_0x27c2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x27c2('0x4'));var rimraf=require(_0x27c2('0x5'));var config=require('../../config/environment');var attributes=require(_0x27c2('0x6'));module['exports']=function(_0x73105d,_0x2adc1c){return _0x73105d[_0x27c2('0x7')](_0x27c2('0x8'),attributes,{'tableName':_0x27c2('0x9'),'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 37f6b49..8ad8666 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 _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(_0x537501,_0x1509e4){var _0x54bfc2=function(_0x29bd68){while(--_0x29bd68){_0x537501['push'](_0x537501['shift']());}};_0x54bfc2(++_0x1509e4);}(_0xadb5,0xad));var _0x5adb=function(_0x4b8d56,_0x3e56d9){_0x4b8d56=_0x4b8d56-0x0;var _0x554063=_0xadb5[_0x4b8d56];return _0x554063;};'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 +var _0xba34=['../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc'];(function(_0x49a2e2,_0x20f893){var _0x2de4e7=function(_0x4a89c5){while(--_0x4a89c5){_0x49a2e2['push'](_0x49a2e2['shift']());}};_0x2de4e7(++_0x20f893);}(_0xba34,0x119));var _0x4ba3=function(_0x215796,_0x576967){_0x215796=_0x215796-0x0;var _0x5d002c=_0xba34[_0x215796];return _0x5d002c;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5f99a,_0x585f2d,_0x6254fb){return new BPromise(function(_0x368eee,_0x2df7f3){return client[_0x4ba3('0xb')](_0xe5f99a,_0x6254fb)[_0x4ba3('0xc')](function(_0xcf1ec3){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0x585f2d,'request\x20sent',JSON[_0x4ba3('0x12')](_0xcf1ec3));if(_0xcf1ec3[_0x4ba3('0x13')]){if(_0xcf1ec3['error'][_0x4ba3('0x14')]===0x1f4){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3['error'][_0x4ba3('0x15')]);return _0x2df7f3(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}logger[_0x4ba3('0x13')](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);return _0x368eee(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}else{logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));_0x368eee(_0xcf1ec3[_0x4ba3('0x16')][_0x4ba3('0x15')]);}})[_0x4ba3('0x17')](function(_0x1b7776){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0x1b7776);_0x2df7f3(_0x1b7776);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 213ff6a..eaab1a4 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 _0x1261=['create','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','index','get','isAuthenticated','describe','/:id','post'];(function(_0x57225c,_0x30e251){var _0x3065a5=function(_0x1a686e){while(--_0x1a686e){_0x57225c['push'](_0x57225c['shift']());}};_0x3065a5(++_0x30e251);}(_0x1261,0x144));var _0x1126=function(_0x4ec3ab,_0x50a5de){_0x4ec3ab=_0x4ec3ab-0x0;var _0x229613=_0x1261[_0x4ec3ab];return _0x229613;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/describe',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['show']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x11')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x12')]);module[_0x1126('0x13')]=router; \ No newline at end of file +var _0x4137=['show','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','/:id'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x4137,0xf8));var _0x7413=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x4137[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var path=require(_0x7413('0x2'));var timeout=require(_0x7413('0x3'));var express=require(_0x7413('0x4'));var router=express[_0x7413('0x5')]();var fs_extra=require(_0x7413('0x6'));var auth=require(_0x7413('0x7'));var interaction=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var controller=require(_0x7413('0xa'));router[_0x7413('0xb')]('/',auth['isAuthenticated'](),controller[_0x7413('0xc')]);router[_0x7413('0xb')](_0x7413('0xd'),auth[_0x7413('0xe')](),controller['describe']);router[_0x7413('0xb')](_0x7413('0xf'),auth['isAuthenticated'](),controller[_0x7413('0x10')]);router[_0x7413('0x11')]('/',auth['isAuthenticated'](),controller[_0x7413('0x12')]);router[_0x7413('0x13')](_0x7413('0xf'),auth[_0x7413('0xe')](),controller[_0x7413('0x14')]);router['delete'](_0x7413('0xf'),auth[_0x7413('0xe')](),controller['destroy']);module[_0x7413('0x15')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index b7cbbfb..c116dab 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 _0x52b6=['sequelize','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','FAILED'];(function(_0x28f296,_0x3f7820){var _0x439cb7=function(_0x42d1fc){while(--_0x42d1fc){_0x28f296['push'](_0x28f296['shift']());}};_0x439cb7(++_0x3f7820);}(_0x52b6,0xd2));var _0x652b=function(_0x59943d,_0x2e751b){_0x59943d=_0x59943d-0x0;var _0x46ace9=_0x52b6[_0x59943d];return _0x46ace9;};'use strict';var Sequelize=require(_0x652b('0x0'));module['exports']={'integration':{'type':Sequelize[_0x652b('0x1')]},'eventChannel':{'type':Sequelize[_0x652b('0x1')]},'exitStatus':{'type':Sequelize[_0x652b('0x1')]},'ticketId':{'type':Sequelize[_0x652b('0x1')]},'integrationId':{'type':Sequelize[_0x652b('0x2')]},'contacts':{'type':Sequelize[_0x652b('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x652b('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x652b('0x1')]},'membername':{'type':Sequelize[_0x652b('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x652b('0x3')]},'holdtime':{'type':Sequelize[_0x652b('0x2')]},'agentcomplete':{'type':Sequelize[_0x652b('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x652b('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x652b('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x652b('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x652b('0x3')]},'agentdump':{'type':Sequelize[_0x652b('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x652b('0x3')]},'lastevent':{'type':Sequelize[_0x652b('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x652b('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x652b('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x652b('0x1')]},'exten':{'type':Sequelize[_0x652b('0x1')]},'priority':{'type':Sequelize[_0x652b('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x652b('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x652b('0x1')]},'destcalleridnum':{'type':Sequelize[_0x652b('0x1')]},'destcalleridname':{'type':Sequelize[_0x652b('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x652b('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x652b('0x1')]},'destaccountcode':{'type':Sequelize[_0x652b('0x1')]},'destcontext':{'type':Sequelize[_0x652b('0x1')]},'destexten':{'type':Sequelize[_0x652b('0x1')]},'destpriority':{'type':Sequelize[_0x652b('0x1')]},'destuniqueid':{'type':Sequelize[_0x652b('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x652b('0x1')]},'subject':{'type':Sequelize[_0x652b('0x1')]},'from':{'type':Sequelize[_0x652b('0x1')]},'to':{'type':Sequelize[_0x652b('0x1')]},'cc':{'type':Sequelize[_0x652b('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x652b('0x5')]},'text':{'type':Sequelize[_0x652b('0x5')]},'status':{'type':Sequelize[_0x652b('0x6')](_0x652b('0x7'),_0x652b('0x8'),'RECEIVED',_0x652b('0x9'))},'url':{'type':Sequelize[_0x652b('0x1')]},'app':{'type':Sequelize[_0x652b('0x1')]},'appdata':{'type':Sequelize[_0x652b('0x1')]},'projectId':{'type':Sequelize[_0x652b('0x2')]}}; \ No newline at end of file +var _0xa1cd=['SENT','SENDING','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0x185388,_0x524af0){var _0xde6e57=function(_0x391231){while(--_0x391231){_0x185388['push'](_0x185388['shift']());}};_0xde6e57(++_0x524af0);}(_0xa1cd,0x13d));var _0xda1c=function(_0x336f25,_0x4f1055){_0x336f25=_0x336f25-0x0;var _0x290e8f=_0xa1cd[_0x336f25];return _0x290e8f;};'use strict';var Sequelize=require('sequelize');module['exports']={'integration':{'type':Sequelize[_0xda1c('0x0')]},'eventChannel':{'type':Sequelize[_0xda1c('0x0')]},'exitStatus':{'type':Sequelize[_0xda1c('0x0')]},'ticketId':{'type':Sequelize[_0xda1c('0x0')]},'integrationId':{'type':Sequelize[_0xda1c('0x1')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xda1c('0x0')]},'calleridnum':{'type':Sequelize[_0xda1c('0x0')]},'calleridname':{'type':Sequelize[_0xda1c('0x0')]},'queue':{'type':Sequelize[_0xda1c('0x0')]},'interface':{'type':Sequelize[_0xda1c('0x0')]},'membername':{'type':Sequelize[_0xda1c('0x0')]},'agentcalledAt':{'type':Sequelize[_0xda1c('0x2')]},'agentconnectAt':{'type':Sequelize[_0xda1c('0x2')]},'holdtime':{'type':Sequelize[_0xda1c('0x1')]},'agentcomplete':{'type':Sequelize[_0xda1c('0x3')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0xda1c('0x1')]},'agentacw':{'type':Sequelize[_0xda1c('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xda1c('0x3')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xda1c('0x2')]},'agentdump':{'type':Sequelize[_0xda1c('0x3')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xda1c('0x0')]},'channelstate':{'type':Sequelize[_0xda1c('0x1')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xda1c('0x0')]},'connectedlinename':{'type':Sequelize[_0xda1c('0x0')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xda1c('0x0')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xda1c('0x0')]},'priority':{'type':Sequelize[_0xda1c('0x0')]},'destchannel':{'type':Sequelize[_0xda1c('0x0')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xda1c('0x0')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xda1c('0x0')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xda1c('0x0')]},'destlanguage':{'type':Sequelize[_0xda1c('0x0')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xda1c('0x0')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xda1c('0x0')]},'destuniqueid':{'type':Sequelize[_0xda1c('0x0')]},'messageId':{'type':Sequelize[_0xda1c('0x0')]},'inReplyTo':{'type':Sequelize[_0xda1c('0x0')]},'subject':{'type':Sequelize[_0xda1c('0x0')]},'from':{'type':Sequelize[_0xda1c('0x0')]},'to':{'type':Sequelize[_0xda1c('0x0')]},'cc':{'type':Sequelize[_0xda1c('0x0')]},'attachment':{'type':Sequelize[_0xda1c('0x4')]},'html':{'type':Sequelize[_0xda1c('0x4')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize['ENUM'](_0xda1c('0x5'),_0xda1c('0x6'),'RECEIVED','FAILED')},'url':{'type':Sequelize[_0xda1c('0x0')]},'app':{'type':Sequelize[_0xda1c('0x0')]},'appdata':{'type':Sequelize[_0xda1c('0x0')]},'projectId':{'type':Sequelize[_0xda1c('0x1')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 4862a59..90f6292 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 _0x1747=['../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error','name','send','index','map','IntegrationReport','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','show','keys','create','body','params','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils'];(function(_0x504df1,_0x289598){var _0x1063b5=function(_0x627abd){while(--_0x627abd){_0x504df1['push'](_0x504df1['shift']());}};_0x1063b5(++_0x289598);}(_0x1747,0x157));var _0x7174=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x1747[_0x1e4360];return _0x31e6b4;};'use strict';var emlformat=require(_0x7174('0x0'));var rimraf=require(_0x7174('0x1'));var zipdir=require(_0x7174('0x2'));var jsonpatch=require(_0x7174('0x3'));var rp=require(_0x7174('0x4'));var moment=require(_0x7174('0x5'));var BPromise=require(_0x7174('0x6'));var Mustache=require(_0x7174('0x7'));var util=require(_0x7174('0x8'));var path=require(_0x7174('0x9'));var sox=require('sox');var csv=require(_0x7174('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7174('0xb'));var squel=require(_0x7174('0xc'));var crypto=require('crypto');var jsforce=require(_0x7174('0xd'));var deskjs=require(_0x7174('0xe'));var toCsv=require(_0x7174('0xa'));var querystring=require(_0x7174('0xf'));var Papa=require('papaparse');var Redis=require(_0x7174('0x10'));var authService=require(_0x7174('0x11'));var qs=require(_0x7174('0x12'));var as=require(_0x7174('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7174('0x14'))('api');var utils=require(_0x7174('0x15'));var config=require(_0x7174('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7174('0x17'))['db'];function respondWithStatusCode(_0x1f50e7,_0x4d2eda){_0x4d2eda=_0x4d2eda||0xcc;return function(_0x497734){if(_0x497734){return _0x1f50e7[_0x7174('0x18')](_0x4d2eda);}return _0x1f50e7[_0x7174('0x19')](_0x4d2eda)[_0x7174('0x1a')]();};}function respondWithResult(_0x3a7033,_0x3b0751){_0x3b0751=_0x3b0751||0xc8;return function(_0x37e3f2){if(_0x37e3f2){return _0x3a7033['status'](_0x3b0751)[_0x7174('0x1b')](_0x37e3f2);}};}function respondWithFilteredResult(_0x3100df,_0x2ff80b){return function(_0x395f86){if(_0x395f86){var _0xfb5250=typeof _0x2ff80b[_0x7174('0x1c')]===_0x7174('0x1d')&&typeof _0x2ff80b[_0x7174('0x1e')]==='undefined';var _0x4878dc=_0x395f86[_0x7174('0x1f')];var _0x27b746=_0xfb5250?0x0:_0x2ff80b[_0x7174('0x1c')];var _0x437615=_0xfb5250?_0x395f86[_0x7174('0x1f')]:_0x2ff80b[_0x7174('0x1c')]+_0x2ff80b[_0x7174('0x1e')];var _0x4cade9;if(_0x437615>=_0x4878dc){_0x437615=_0x4878dc;_0x4cade9=0xc8;}else{_0x4cade9=0xce;}_0x3100df[_0x7174('0x19')](_0x4cade9);return _0x3100df[_0x7174('0x20')](_0x7174('0x21'),_0x27b746+'-'+_0x437615+'/'+_0x4878dc)['json'](_0x395f86);}return null;};}function patchUpdates(_0x568a83){return function(_0x38ff87){try{jsonpatch['apply'](_0x38ff87,_0x568a83,!![]);}catch(_0x1ae035){return BPromise['reject'](_0x1ae035);}return _0x38ff87[_0x7174('0x22')]();};}function saveUpdates(_0x3cb54f,_0x4076e0){return function(_0x2897d0){if(_0x2897d0){return _0x2897d0[_0x7174('0x23')](_0x3cb54f)[_0x7174('0x24')](function(_0x4f7f4a){return _0x4f7f4a;});}return null;};}function removeEntity(_0x5eec1d,_0x20c525){return function(_0x3fbe87){if(_0x3fbe87){return _0x3fbe87[_0x7174('0x25')]()[_0x7174('0x24')](function(){_0x5eec1d[_0x7174('0x19')](0xcc)[_0x7174('0x1a')]();});}};}function handleEntityNotFound(_0x568f00,_0x33881e){return function(_0x3e7e1f){if(!_0x3e7e1f){_0x568f00['sendStatus'](0x194);}return _0x3e7e1f;};}function handleError(_0x1a15e3,_0x17f012){_0x17f012=_0x17f012||0x1f4;return function(_0x1b1502){logger[_0x7174('0x26')](_0x1b1502['stack']);if(_0x1b1502[_0x7174('0x27')]){delete _0x1b1502[_0x7174('0x27')];}_0x1a15e3['status'](_0x17f012)[_0x7174('0x28')](_0x1b1502);};}exports[_0x7174('0x29')]=function(_0x133a67,_0x45db91){var _0x5ac78a={},_0x4fa4bf={},_0x5aeaa3={'count':0x0,'rows':[]};var _0x5c4bc0=_[_0x7174('0x2a')](db[_0x7174('0x2b')][_0x7174('0x2c')],function(_0x3dcd56){return{'name':_0x3dcd56[_0x7174('0x2d')],'type':_0x3dcd56['type'][_0x7174('0x2e')]};});_0x4fa4bf['model']=_[_0x7174('0x2a')](_0x5c4bc0,_0x7174('0x27'));_0x4fa4bf[_0x7174('0x2f')]=_['keys'](_0x133a67['query']);_0x4fa4bf[_0x7174('0x30')]=_[_0x7174('0x31')](_0x4fa4bf['model'],_0x4fa4bf[_0x7174('0x2f')]);_0x5ac78a['attributes']=_[_0x7174('0x31')](_0x4fa4bf[_0x7174('0x32')],qs[_0x7174('0x33')](_0x133a67[_0x7174('0x2f')]['fields']));_0x5ac78a[_0x7174('0x34')]=_0x5ac78a['attributes']['length']?_0x5ac78a[_0x7174('0x34')]:_0x4fa4bf[_0x7174('0x32')];if(!_0x133a67[_0x7174('0x2f')][_0x7174('0x35')](_0x7174('0x36'))){_0x5ac78a[_0x7174('0x1e')]=qs[_0x7174('0x1e')](_0x133a67['query'][_0x7174('0x1e')]);_0x5ac78a[_0x7174('0x1c')]=qs['offset'](_0x133a67[_0x7174('0x2f')][_0x7174('0x1c')]);}_0x5ac78a[_0x7174('0x37')]=qs[_0x7174('0x38')](_0x133a67[_0x7174('0x2f')][_0x7174('0x38')]);_0x5ac78a[_0x7174('0x39')]=qs[_0x7174('0x30')](_[_0x7174('0x3a')](_0x133a67[_0x7174('0x2f')],_0x4fa4bf[_0x7174('0x30')]),_0x5c4bc0);if(_0x133a67[_0x7174('0x2f')]['filter']){_0x5ac78a['where']=_[_0x7174('0x3b')](_0x5ac78a['where'],{'$or':_[_0x7174('0x2a')](_0x5c4bc0,function(_0x4e7352){if(_0x4e7352['type']!==_0x7174('0x3c')){var _0x4b575c={};_0x4b575c[_0x4e7352[_0x7174('0x27')]]={'$like':'%'+_0x133a67[_0x7174('0x2f')]['filter']+'%'};return _0x4b575c;}})});}_0x5ac78a=_[_0x7174('0x3b')]({},_0x5ac78a,_0x133a67[_0x7174('0x3d')]);var _0x564113={'where':_0x5ac78a[_0x7174('0x39')]};return db[_0x7174('0x2b')]['count'](_0x564113)[_0x7174('0x24')](function(_0x1ac300){_0x5aeaa3[_0x7174('0x1f')]=_0x1ac300;if(_0x133a67[_0x7174('0x2f')][_0x7174('0x3e')]){_0x5ac78a[_0x7174('0x3f')]=[{'all':!![]}];}return db['IntegrationReport']['findAll'](_0x5ac78a);})[_0x7174('0x24')](function(_0xc1b028){_0x5aeaa3[_0x7174('0x40')]=_0xc1b028;return _0x5aeaa3;})['then'](respondWithFilteredResult(_0x45db91,_0x5ac78a))[_0x7174('0x41')](handleError(_0x45db91,null));};exports[_0x7174('0x42')]=function(_0x45e871,_0xbc27b8){var _0x1ddf19={'raw':![],'where':{'id':_0x45e871['params']['id']}},_0x4e7c3d={};_0x4e7c3d[_0x7174('0x32')]=_[_0x7174('0x43')](db[_0x7174('0x2b')]['rawAttributes']);_0x4e7c3d[_0x7174('0x2f')]=_[_0x7174('0x43')](_0x45e871['query']);_0x4e7c3d[_0x7174('0x30')]=_[_0x7174('0x31')](_0x4e7c3d['model'],_0x4e7c3d['query']);_0x1ddf19[_0x7174('0x34')]=_[_0x7174('0x31')](_0x4e7c3d[_0x7174('0x32')],qs['fields'](_0x45e871[_0x7174('0x2f')]['fields']));_0x1ddf19[_0x7174('0x34')]=_0x1ddf19[_0x7174('0x34')]['length']?_0x1ddf19['attributes']:_0x4e7c3d[_0x7174('0x32')];if(_0x45e871[_0x7174('0x2f')]['includeAll']){_0x1ddf19['include']=[{'all':!![]}];}_0x1ddf19=_[_0x7174('0x3b')]({},_0x1ddf19,_0x45e871[_0x7174('0x3d')]);return db[_0x7174('0x2b')]['find'](_0x1ddf19)[_0x7174('0x24')](handleEntityNotFound(_0xbc27b8,null))[_0x7174('0x24')](respondWithResult(_0xbc27b8,null))[_0x7174('0x41')](handleError(_0xbc27b8,null));};exports[_0x7174('0x44')]=function(_0x164d38,_0x29b47f){return db[_0x7174('0x2b')][_0x7174('0x44')](_0x164d38[_0x7174('0x45')],{})['then'](respondWithResult(_0x29b47f,0xc9))[_0x7174('0x41')](handleError(_0x29b47f,null));};exports[_0x7174('0x23')]=function(_0x388514,_0xd7db6){if(_0x388514[_0x7174('0x45')]['id']){delete _0x388514[_0x7174('0x45')]['id'];}return db[_0x7174('0x2b')]['find']({'where':{'id':_0x388514[_0x7174('0x46')]['id']}})['then'](handleEntityNotFound(_0xd7db6,null))[_0x7174('0x24')](saveUpdates(_0x388514[_0x7174('0x45')],null))[_0x7174('0x24')](respondWithResult(_0xd7db6,null))[_0x7174('0x41')](handleError(_0xd7db6,null));};exports['destroy']=function(_0x5b6945,_0x310869){return db[_0x7174('0x2b')][_0x7174('0x47')]({'where':{'id':_0x5b6945[_0x7174('0x46')]['id']}})[_0x7174('0x24')](handleEntityNotFound(_0x310869,null))[_0x7174('0x24')](removeEntity(_0x310869,null))[_0x7174('0x41')](handleError(_0x310869,null));};exports[_0x7174('0x48')]=function(_0x197781,_0x133d07){return db[_0x7174('0x2b')]['describe']()[_0x7174('0x24')](respondWithResult(_0x133d07,null))['catch'](handleError(_0x133d07,null));}; \ No newline at end of file +var _0xb5cd=['querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','apply','update','then','destroy','stack','name','send','index','map','IntegrationReport','fieldName','type','key','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','show','params','rawAttributes','fields','length','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js'];(function(_0x3738bc,_0x5b90f9){var _0x1dc436=function(_0x435a20){while(--_0x435a20){_0x3738bc['push'](_0x3738bc['shift']());}};_0x1dc436(++_0x5b90f9);}(_0xb5cd,0x82));var _0xdb5c=function(_0x573a84,_0x500a32){_0x573a84=_0x573a84-0x0;var _0x1321c1=_0xb5cd[_0x573a84];return _0x1321c1;};'use strict';var emlformat=require(_0xdb5c('0x0'));var rimraf=require(_0xdb5c('0x1'));var zipdir=require(_0xdb5c('0x2'));var jsonpatch=require(_0xdb5c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdb5c('0x4'));var Mustache=require(_0xdb5c('0x5'));var util=require(_0xdb5c('0x6'));var path=require(_0xdb5c('0x7'));var sox=require(_0xdb5c('0x8'));var csv=require(_0xdb5c('0x9'));var ejs=require(_0xdb5c('0xa'));var fs=require('fs');var fs_extra=require(_0xdb5c('0xb'));var _=require(_0xdb5c('0xc'));var squel=require(_0xdb5c('0xd'));var crypto=require(_0xdb5c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdb5c('0xf'));var toCsv=require(_0xdb5c('0x9'));var querystring=require(_0xdb5c('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdb5c('0x11'));var qs=require(_0xdb5c('0x12'));var as=require(_0xdb5c('0x13'));var hardwareService=require(_0xdb5c('0x14'));var logger=require(_0xdb5c('0x15'))(_0xdb5c('0x16'));var utils=require(_0xdb5c('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdb5c('0x18'))['db'];function respondWithStatusCode(_0x23511f,_0x4eebaa){_0x4eebaa=_0x4eebaa||0xcc;return function(_0x41dbc9){if(_0x41dbc9){return _0x23511f[_0xdb5c('0x19')](_0x4eebaa);}return _0x23511f[_0xdb5c('0x1a')](_0x4eebaa)[_0xdb5c('0x1b')]();};}function respondWithResult(_0x484a16,_0x49e056){_0x49e056=_0x49e056||0xc8;return function(_0x26c3f3){if(_0x26c3f3){return _0x484a16[_0xdb5c('0x1a')](_0x49e056)['json'](_0x26c3f3);}};}function respondWithFilteredResult(_0x515178,_0x57dacb){return function(_0x2763e9){if(_0x2763e9){var _0x4dd98a=typeof _0x57dacb[_0xdb5c('0x1c')]==='undefined'&&typeof _0x57dacb[_0xdb5c('0x1d')]===_0xdb5c('0x1e');var _0x41748d=_0x2763e9[_0xdb5c('0x1f')];var _0x280f62=_0x4dd98a?0x0:_0x57dacb['offset'];var _0x265131=_0x4dd98a?_0x2763e9[_0xdb5c('0x1f')]:_0x57dacb[_0xdb5c('0x1c')]+_0x57dacb[_0xdb5c('0x1d')];var _0x541cdb;if(_0x265131>=_0x41748d){_0x265131=_0x41748d;_0x541cdb=0xc8;}else{_0x541cdb=0xce;}_0x515178[_0xdb5c('0x1a')](_0x541cdb);return _0x515178['set'](_0xdb5c('0x20'),_0x280f62+'-'+_0x265131+'/'+_0x41748d)['json'](_0x2763e9);}return null;};}function patchUpdates(_0x337397){return function(_0x56e905){try{jsonpatch[_0xdb5c('0x21')](_0x56e905,_0x337397,!![]);}catch(_0x171f25){return BPromise['reject'](_0x171f25);}return _0x56e905['save']();};}function saveUpdates(_0x34eeeb,_0xb83fc0){return function(_0x5eb4e8){if(_0x5eb4e8){return _0x5eb4e8[_0xdb5c('0x22')](_0x34eeeb)[_0xdb5c('0x23')](function(_0x12c5e3){return _0x12c5e3;});}return null;};}function removeEntity(_0x25f9e9,_0x43378c){return function(_0x54fee2){if(_0x54fee2){return _0x54fee2[_0xdb5c('0x24')]()[_0xdb5c('0x23')](function(){_0x25f9e9[_0xdb5c('0x1a')](0xcc)[_0xdb5c('0x1b')]();});}};}function handleEntityNotFound(_0x1b954d,_0x4fb676){return function(_0x391439){if(!_0x391439){_0x1b954d[_0xdb5c('0x19')](0x194);}return _0x391439;};}function handleError(_0x2d9027,_0xdccb3f){_0xdccb3f=_0xdccb3f||0x1f4;return function(_0x385724){logger['error'](_0x385724[_0xdb5c('0x25')]);if(_0x385724[_0xdb5c('0x26')]){delete _0x385724[_0xdb5c('0x26')];}_0x2d9027[_0xdb5c('0x1a')](_0xdccb3f)[_0xdb5c('0x27')](_0x385724);};}exports[_0xdb5c('0x28')]=function(_0x12e9ad,_0x29696b){var _0x2a0099={},_0x2c89c8={},_0x28f31c={'count':0x0,'rows':[]};var _0x3ff4cc=_[_0xdb5c('0x29')](db[_0xdb5c('0x2a')]['rawAttributes'],function(_0x2b0f43){return{'name':_0x2b0f43[_0xdb5c('0x2b')],'type':_0x2b0f43[_0xdb5c('0x2c')][_0xdb5c('0x2d')]};});_0x2c89c8['model']=_[_0xdb5c('0x29')](_0x3ff4cc,_0xdb5c('0x26'));_0x2c89c8[_0xdb5c('0x2e')]=_[_0xdb5c('0x2f')](_0x12e9ad[_0xdb5c('0x2e')]);_0x2c89c8[_0xdb5c('0x30')]=_[_0xdb5c('0x31')](_0x2c89c8[_0xdb5c('0x32')],_0x2c89c8[_0xdb5c('0x2e')]);_0x2a0099[_0xdb5c('0x33')]=_[_0xdb5c('0x31')](_0x2c89c8['model'],qs['fields'](_0x12e9ad[_0xdb5c('0x2e')]['fields']));_0x2a0099[_0xdb5c('0x33')]=_0x2a0099[_0xdb5c('0x33')]['length']?_0x2a0099['attributes']:_0x2c89c8['model'];if(!_0x12e9ad[_0xdb5c('0x2e')][_0xdb5c('0x34')](_0xdb5c('0x35'))){_0x2a0099['limit']=qs[_0xdb5c('0x1d')](_0x12e9ad[_0xdb5c('0x2e')][_0xdb5c('0x1d')]);_0x2a0099[_0xdb5c('0x1c')]=qs['offset'](_0x12e9ad['query'][_0xdb5c('0x1c')]);}_0x2a0099[_0xdb5c('0x36')]=qs[_0xdb5c('0x37')](_0x12e9ad[_0xdb5c('0x2e')][_0xdb5c('0x37')]);_0x2a0099[_0xdb5c('0x38')]=qs[_0xdb5c('0x30')](_[_0xdb5c('0x39')](_0x12e9ad[_0xdb5c('0x2e')],_0x2c89c8[_0xdb5c('0x30')]),_0x3ff4cc);if(_0x12e9ad[_0xdb5c('0x2e')][_0xdb5c('0x3a')]){_0x2a0099['where']=_[_0xdb5c('0x3b')](_0x2a0099[_0xdb5c('0x38')],{'$or':_[_0xdb5c('0x29')](_0x3ff4cc,function(_0x5e0daf){if(_0x5e0daf[_0xdb5c('0x2c')]!=='VIRTUAL'){var _0x205070={};_0x205070[_0x5e0daf[_0xdb5c('0x26')]]={'$like':'%'+_0x12e9ad[_0xdb5c('0x2e')]['filter']+'%'};return _0x205070;}})});}_0x2a0099=_[_0xdb5c('0x3b')]({},_0x2a0099,_0x12e9ad[_0xdb5c('0x3c')]);var _0x8bfe5c={'where':_0x2a0099[_0xdb5c('0x38')]};return db[_0xdb5c('0x2a')][_0xdb5c('0x1f')](_0x8bfe5c)[_0xdb5c('0x23')](function(_0x466de6){_0x28f31c[_0xdb5c('0x1f')]=_0x466de6;if(_0x12e9ad['query'][_0xdb5c('0x3d')]){_0x2a0099[_0xdb5c('0x3e')]=[{'all':!![]}];}return db['IntegrationReport']['findAll'](_0x2a0099);})[_0xdb5c('0x23')](function(_0x3833f2){_0x28f31c['rows']=_0x3833f2;return _0x28f31c;})['then'](respondWithFilteredResult(_0x29696b,_0x2a0099))['catch'](handleError(_0x29696b,null));};exports[_0xdb5c('0x3f')]=function(_0x413a4b,_0x4fa955){var _0x4eec01={'raw':![],'where':{'id':_0x413a4b[_0xdb5c('0x40')]['id']}},_0x4941cc={};_0x4941cc['model']=_[_0xdb5c('0x2f')](db['IntegrationReport'][_0xdb5c('0x41')]);_0x4941cc['query']=_['keys'](_0x413a4b[_0xdb5c('0x2e')]);_0x4941cc[_0xdb5c('0x30')]=_['intersection'](_0x4941cc[_0xdb5c('0x32')],_0x4941cc[_0xdb5c('0x2e')]);_0x4eec01[_0xdb5c('0x33')]=_[_0xdb5c('0x31')](_0x4941cc[_0xdb5c('0x32')],qs[_0xdb5c('0x42')](_0x413a4b['query']['fields']));_0x4eec01[_0xdb5c('0x33')]=_0x4eec01[_0xdb5c('0x33')][_0xdb5c('0x43')]?_0x4eec01['attributes']:_0x4941cc[_0xdb5c('0x32')];if(_0x413a4b[_0xdb5c('0x2e')]['includeAll']){_0x4eec01[_0xdb5c('0x3e')]=[{'all':!![]}];}_0x4eec01=_['merge']({},_0x4eec01,_0x413a4b[_0xdb5c('0x3c')]);return db[_0xdb5c('0x2a')]['find'](_0x4eec01)[_0xdb5c('0x23')](handleEntityNotFound(_0x4fa955,null))[_0xdb5c('0x23')](respondWithResult(_0x4fa955,null))[_0xdb5c('0x44')](handleError(_0x4fa955,null));};exports[_0xdb5c('0x45')]=function(_0x28c5a8,_0x60c43e){return db[_0xdb5c('0x2a')][_0xdb5c('0x45')](_0x28c5a8[_0xdb5c('0x46')],{})[_0xdb5c('0x23')](respondWithResult(_0x60c43e,0xc9))[_0xdb5c('0x44')](handleError(_0x60c43e,null));};exports[_0xdb5c('0x22')]=function(_0x22f838,_0x2a0cf2){if(_0x22f838['body']['id']){delete _0x22f838[_0xdb5c('0x46')]['id'];}return db[_0xdb5c('0x2a')][_0xdb5c('0x47')]({'where':{'id':_0x22f838[_0xdb5c('0x40')]['id']}})['then'](handleEntityNotFound(_0x2a0cf2,null))['then'](saveUpdates(_0x22f838[_0xdb5c('0x46')],null))[_0xdb5c('0x23')](respondWithResult(_0x2a0cf2,null))[_0xdb5c('0x44')](handleError(_0x2a0cf2,null));};exports[_0xdb5c('0x24')]=function(_0x42ddaa,_0x44b046){return db['IntegrationReport']['find']({'where':{'id':_0x42ddaa[_0xdb5c('0x40')]['id']}})[_0xdb5c('0x23')](handleEntityNotFound(_0x44b046,null))[_0xdb5c('0x23')](removeEntity(_0x44b046,null))[_0xdb5c('0x44')](handleError(_0x44b046,null));};exports['describe']=function(_0x28e2d9,_0x4459b1){return db[_0xdb5c('0x2a')][_0xdb5c('0x48')]()['then'](respondWithResult(_0x4459b1,null))[_0xdb5c('0x44')](handleError(_0x4459b1,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 3567799..88cca57 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 _0x92f0=['rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2532a3,_0x1d1fac){var _0x53e3e2=function(_0xb8a9ed){while(--_0xb8a9ed){_0x2532a3['push'](_0x2532a3['shift']());}};_0x53e3e2(++_0x1d1fac);}(_0x92f0,0x173));var _0x092f=function(_0x5c4178,_0x11471c){_0x5c4178=_0x5c4178-0x0;var _0x384e71=_0x92f0[_0x5c4178];return _0x384e71;};'use strict';var _=require(_0x092f('0x0'));var util=require(_0x092f('0x1'));var logger=require(_0x092f('0x2'))(_0x092f('0x3'));var moment=require('moment');var BPromise=require(_0x092f('0x4'));var rp=require(_0x092f('0x5'));var fs=require('fs');var path=require(_0x092f('0x6'));var rimraf=require(_0x092f('0x7'));var config=require(_0x092f('0x8'));var attributes=require(_0x092f('0x9'));module[_0x092f('0xa')]=function(_0x1e5195,_0x27623f){return _0x1e5195[_0x092f('0xb')](_0x092f('0xc'),attributes,{'tableName':_0x092f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x87c6=['bluebird','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','util','../../config/logger','api','moment'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x87c6,0xf9));var _0x687c=function(_0x3c9920,_0x6abc8c){_0x3c9920=_0x3c9920-0x0;var _0x487e20=_0x87c6[_0x3c9920];return _0x487e20;};'use strict';var _=require('lodash');var util=require(_0x687c('0x0'));var logger=require(_0x687c('0x1'))(_0x687c('0x2'));var moment=require(_0x687c('0x3'));var BPromise=require(_0x687c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x687c('0x5'));var config=require(_0x687c('0x6'));var attributes=require(_0x687c('0x7'));module[_0x687c('0x8')]=function(_0x50b2f6,_0x45fded){return _0x50b2f6[_0x687c('0x9')](_0x687c('0xa'),attributes,{'tableName':'report_integration','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 8492425..d7c7805 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 _0xc6ac=['http','request','then','info','IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3627de,_0x3e3cb6){var _0x873f81=function(_0x51f7ee){while(--_0x51f7ee){_0x3627de['push'](_0x3627de['shift']());}};_0x873f81(++_0x3e3cb6);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x17ea3f,_0x739ac5){_0x17ea3f=_0x17ea3f-0x0;var _0x4164a8=_0xc6ac[_0x17ea3f];return _0x4164a8;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var moment=require(_0xcc6a('0x2'));var BPromise=require(_0xcc6a('0x3'));var rs=require(_0xcc6a('0x4'));var fs=require('fs');var Redis=require(_0xcc6a('0x5'));var db=require(_0xcc6a('0x6'))['db'];var utils=require(_0xcc6a('0x7'));var logger=require(_0xcc6a('0x8'))(_0xcc6a('0x9'));var config=require(_0xcc6a('0xa'));var jayson=require(_0xcc6a('0xb'));var client=jayson[_0xcc6a('0xc')][_0xcc6a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5f3887,_0x3dd497,_0x11b919){return new BPromise(function(_0xf02261,_0x560cc4){return client[_0xcc6a('0xe')](_0x5f3887,_0x11b919)[_0xcc6a('0xf')](function(_0x7806a0){logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,'request\x20sent');logger[_0xcc6a('0x12')](_0xcc6a('0x13'),_0x3dd497,_0xcc6a('0x14'),JSON['stringify'](_0x7806a0));if(_0x7806a0[_0xcc6a('0x15')]){if(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x16')]===0x1f4){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0x560cc4(_0x7806a0[_0xcc6a('0x15')]['message']);}logger['error'](_0xcc6a('0x11'),_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0xf02261(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);}else{logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,_0xcc6a('0x14'));_0xf02261(_0x7806a0['result']['message']);}})['catch'](function(_0x395a55){logger[_0xcc6a('0x15')](_0xcc6a('0x11'),_0x3dd497,_0x395a55);_0x560cc4(_0x395a55);});});} \ No newline at end of file +var _0x57ca=['client','http','request','info','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error','code','IntegrationReport,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x521c1c,_0x56c047){var _0x195403=function(_0x27154b){while(--_0x27154b){_0x521c1c['push'](_0x521c1c['shift']());}};_0x195403(++_0x56c047);}(_0x57ca,0x108));var _0xa57c=function(_0x244adc,_0x13b703){_0x244adc=_0x244adc-0x0;var _0xbf9e01=_0x57ca[_0x244adc];return _0xbf9e01;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index afdf071..3522981 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 _0x42b0=['create','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','delete','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','/:id','/:id/sub_intervals','getIntervals'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x42b0,0xbc));var _0x042b=function(_0x44a59b,_0x18f8a5){_0x44a59b=_0x44a59b-0x0;var _0x5382c5=_0x42b0[_0x44a59b];return _0x5382c5;};'use strict';var multer=require(_0x042b('0x0'));var util=require(_0x042b('0x1'));var path=require('path');var timeout=require(_0x042b('0x2'));var express=require('express');var router=express[_0x042b('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x042b('0x4'));var config=require(_0x042b('0x5'));var controller=require(_0x042b('0x6'));router[_0x042b('0x7')]('/',auth[_0x042b('0x8')](),controller['index']);router['get'](_0x042b('0x9'),auth[_0x042b('0x8')](),controller['show']);router['get'](_0x042b('0xa'),auth['isAuthenticated'](),controller[_0x042b('0xb')]);router['post']('/',auth[_0x042b('0x8')](),controller[_0x042b('0xc')]);router[_0x042b('0xd')](_0x042b('0xa'),auth[_0x042b('0x8')](),controller[_0x042b('0xe')]);router[_0x042b('0xd')](_0x042b('0xf'),auth[_0x042b('0x8')](),controller[_0x042b('0x10')]);router[_0x042b('0x11')](_0x042b('0x9'),auth[_0x042b('0x8')](),controller['update']);router[_0x042b('0x12')]('/:id',auth[_0x042b('0x8')](),controller['destroy']);module[_0x042b('0x13')]=router; \ No newline at end of file +var _0x8098=['post','create','addInterval','/:id/sub_intervals/create_many','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./interval.controller','get','index','isAuthenticated','show','/:id/sub_intervals','getIntervals'];(function(_0x5752f1,_0x3c9165){var _0x3c3ef1=function(_0x2c2f96){while(--_0x2c2f96){_0x5752f1['push'](_0x5752f1['shift']());}};_0x3c3ef1(++_0x3c9165);}(_0x8098,0x1ba));var _0x8809=function(_0x4c9930,_0x2bdad7){_0x4c9930=_0x4c9930-0x0;var _0x1e5eeb=_0x8098[_0x4c9930];return _0x1e5eeb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8809('0x0'));var timeout=require(_0x8809('0x1'));var express=require(_0x8809('0x2'));var router=express[_0x8809('0x3')]();var fs_extra=require(_0x8809('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8809('0x5'));var config=require(_0x8809('0x6'));var controller=require(_0x8809('0x7'));router[_0x8809('0x8')]('/',auth['isAuthenticated'](),controller[_0x8809('0x9')]);router[_0x8809('0x8')]('/:id',auth[_0x8809('0xa')](),controller[_0x8809('0xb')]);router[_0x8809('0x8')](_0x8809('0xc'),auth[_0x8809('0xa')](),controller[_0x8809('0xd')]);router[_0x8809('0xe')]('/',auth[_0x8809('0xa')](),controller[_0x8809('0xf')]);router[_0x8809('0xe')](_0x8809('0xc'),auth[_0x8809('0xa')](),controller[_0x8809('0x10')]);router[_0x8809('0xe')](_0x8809('0x11'),auth[_0x8809('0xa')](),controller['addIntervals']);router[_0x8809('0x12')](_0x8809('0x13'),auth['isAuthenticated'](),controller[_0x8809('0x14')]);router[_0x8809('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x8809('0x16')]);module[_0x8809('0x17')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index db9d8ef..31fb5f3 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 _0xb905=['STRING','sequelize'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xb905,0x6d));var _0x5b90=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xb905[_0x16b9ed];return _0x66b1f8;};'use strict';var Sequelize=require(_0x5b90('0x0'));module['exports']={'name':{'type':Sequelize[_0x5b90('0x1')]},'description':{'type':Sequelize[_0x5b90('0x1')]},'interval':{'type':Sequelize[_0x5b90('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x5c3c=['STRING','sequelize'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5c3c,0x71));var _0xc5c3=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x5c3c[_0x1e3c16];return _0x47a0c9;};'use strict';var Sequelize=require(_0xc5c3('0x0'));module['exports']={'name':{'type':Sequelize[_0xc5c3('0x1')]},'description':{'type':Sequelize[_0xc5c3('0x1')]},'interval':{'type':Sequelize[_0xc5c3('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 9de78ff..2198c0f 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 _0x4b9f=['find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','findOne','pick','getIntervals','sequelize','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','update','then','destroy','get','Intervals','UserProfileResource','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','options','includeAll','include','findAll','rows','catch','show','params','merge'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x4b9f,0xc2));var _0xf4b9=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4b9f[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0xf4b9('0x0'));var rimraf=require(_0xf4b9('0x1'));var zipdir=require(_0xf4b9('0x2'));var jsonpatch=require(_0xf4b9('0x3'));var rp=require(_0xf4b9('0x4'));var moment=require(_0xf4b9('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf4b9('0x6'));var path=require(_0xf4b9('0x7'));var sox=require(_0xf4b9('0x8'));var csv=require(_0xf4b9('0x9'));var ejs=require(_0xf4b9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf4b9('0xb'));var jsforce=require(_0xf4b9('0xc'));var deskjs=require(_0xf4b9('0xd'));var toCsv=require(_0xf4b9('0x9'));var querystring=require('querystring');var Papa=require(_0xf4b9('0xe'));var Redis=require('ioredis');var authService=require(_0xf4b9('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf4b9('0x10'));var logger=require('../../config/logger')(_0xf4b9('0x11'));var utils=require(_0xf4b9('0x12'));var config=require(_0xf4b9('0x13'));var licenseUtil=require(_0xf4b9('0x14'));var db=require(_0xf4b9('0x15'))['db'];var extensions=require(_0xf4b9('0x16'));function respondWithStatusCode(_0x148c30,_0x5aaa98){_0x5aaa98=_0x5aaa98||0xcc;return function(_0x3fe9d7){if(_0x3fe9d7){return _0x148c30[_0xf4b9('0x17')](_0x5aaa98);}return _0x148c30['status'](_0x5aaa98)[_0xf4b9('0x18')]();};}function respondWithResult(_0x44b621,_0x598383){_0x598383=_0x598383||0xc8;return function(_0x4c908a){if(_0x4c908a){return _0x44b621['status'](_0x598383)[_0xf4b9('0x19')](_0x4c908a);}};}function respondWithFilteredResult(_0x1e344b,_0x34d204){return function(_0x38818a){if(_0x38818a){var _0x56197a=typeof _0x34d204[_0xf4b9('0x1a')]===_0xf4b9('0x1b')&&typeof _0x34d204[_0xf4b9('0x1c')]===_0xf4b9('0x1b');var _0x10e50c=_0x38818a[_0xf4b9('0x1d')];var _0xdb8ac8=_0x56197a?0x0:_0x34d204['offset'];var _0x1f5e68=_0x56197a?_0x38818a[_0xf4b9('0x1d')]:_0x34d204[_0xf4b9('0x1a')]+_0x34d204[_0xf4b9('0x1c')];var _0x495d29;if(_0x1f5e68>=_0x10e50c){_0x1f5e68=_0x10e50c;_0x495d29=0xc8;}else{_0x495d29=0xce;}_0x1e344b[_0xf4b9('0x1e')](_0x495d29);return _0x1e344b['set'](_0xf4b9('0x1f'),_0xdb8ac8+'-'+_0x1f5e68+'/'+_0x10e50c)[_0xf4b9('0x19')](_0x38818a);}return null;};}function patchUpdates(_0x27af55){return function(_0x115808){try{jsonpatch[_0xf4b9('0x20')](_0x115808,_0x27af55,!![]);}catch(_0x1d599e){return BPromise[_0xf4b9('0x21')](_0x1d599e);}return _0x115808['save']();};}function saveUpdates(_0x44f677,_0x331ab5){return function(_0x54b4a6){if(_0x54b4a6){return _0x54b4a6[_0xf4b9('0x22')](_0x44f677)[_0xf4b9('0x23')](function(_0xb9ce1b){return _0xb9ce1b;});}return null;};}function removeEntity(_0x2d61e3,_0x294693){return function(_0x24c7c8){if(_0x24c7c8){return _0x24c7c8[_0xf4b9('0x24')]()[_0xf4b9('0x23')](function(){var _0x1c05f0=_0x24c7c8[_0xf4b9('0x25')]({'plain':!![]});var _0xe6c9b2=_0xf4b9('0x26');return db[_0xf4b9('0x27')]['destroy']({'where':{'type':_0xe6c9b2,'resourceId':_0x1c05f0['id']}})[_0xf4b9('0x23')](function(){return _0x24c7c8;});})[_0xf4b9('0x23')](function(){_0x2d61e3['status'](0xcc)[_0xf4b9('0x18')]();});}};}function handleEntityNotFound(_0x3c2728,_0x3795f4){return function(_0x2b6b1f){if(!_0x2b6b1f){_0x3c2728[_0xf4b9('0x17')](0x194);}return _0x2b6b1f;};}function handleError(_0x4a4731,_0x28cf9f){_0x28cf9f=_0x28cf9f||0x1f4;return function(_0x177b2c){logger[_0xf4b9('0x28')](_0x177b2c[_0xf4b9('0x29')]);if(_0x177b2c[_0xf4b9('0x2a')]){delete _0x177b2c['name'];}_0x4a4731[_0xf4b9('0x1e')](_0x28cf9f)[_0xf4b9('0x2b')](_0x177b2c);};}exports[_0xf4b9('0x2c')]=function(_0x10fcdd,_0x23d155){var _0x38d1bf={},_0x296a9c={},_0xa96ec0={'count':0x0,'rows':[]};var _0x312c5d=_[_0xf4b9('0x2d')](db[_0xf4b9('0x2e')][_0xf4b9('0x2f')],function(_0x37186b){return{'name':_0x37186b[_0xf4b9('0x30')],'type':_0x37186b[_0xf4b9('0x31')]['key']};});_0x296a9c['model']=_['map'](_0x312c5d,_0xf4b9('0x2a'));_0x296a9c['query']=_[_0xf4b9('0x32')](_0x10fcdd[_0xf4b9('0x33')]);_0x296a9c[_0xf4b9('0x34')]=_[_0xf4b9('0x35')](_0x296a9c[_0xf4b9('0x36')],_0x296a9c[_0xf4b9('0x33')]);_0x38d1bf[_0xf4b9('0x37')]=_[_0xf4b9('0x35')](_0x296a9c[_0xf4b9('0x36')],qs['fields'](_0x10fcdd['query'][_0xf4b9('0x38')]));_0x38d1bf[_0xf4b9('0x37')]=_0x38d1bf[_0xf4b9('0x37')][_0xf4b9('0x39')]?_0x38d1bf[_0xf4b9('0x37')]:_0x296a9c[_0xf4b9('0x36')];if(!_0x10fcdd[_0xf4b9('0x33')][_0xf4b9('0x3a')](_0xf4b9('0x3b'))){_0x38d1bf['limit']=qs[_0xf4b9('0x1c')](_0x10fcdd[_0xf4b9('0x33')][_0xf4b9('0x1c')]);_0x38d1bf['offset']=qs[_0xf4b9('0x1a')](_0x10fcdd[_0xf4b9('0x33')]['offset']);}_0x38d1bf[_0xf4b9('0x3c')]=qs['sort'](_0x10fcdd[_0xf4b9('0x33')][_0xf4b9('0x3d')]);_0x38d1bf[_0xf4b9('0x3e')]=qs[_0xf4b9('0x34')](_['pick'](_0x10fcdd['query'],_0x296a9c[_0xf4b9('0x34')]),_0x312c5d);if(_0x10fcdd[_0xf4b9('0x33')][_0xf4b9('0x3f')]){_0x38d1bf['where']=_['merge'](_0x38d1bf[_0xf4b9('0x3e')],{'$or':_[_0xf4b9('0x2d')](_0x312c5d,function(_0x1e52d4){if(_0x1e52d4[_0xf4b9('0x31')]!=='VIRTUAL'){var _0x2a63aa={};_0x2a63aa[_0x1e52d4[_0xf4b9('0x2a')]]={'$like':'%'+_0x10fcdd[_0xf4b9('0x33')][_0xf4b9('0x3f')]+'%'};return _0x2a63aa;}})});}_0x38d1bf=_['merge']({},_0x38d1bf,_0x10fcdd[_0xf4b9('0x40')]);var _0x279dc2={'where':_0x38d1bf[_0xf4b9('0x3e')]};return db[_0xf4b9('0x2e')][_0xf4b9('0x1d')](_0x279dc2)[_0xf4b9('0x23')](function(_0x182fb2){_0xa96ec0[_0xf4b9('0x1d')]=_0x182fb2;if(_0x10fcdd[_0xf4b9('0x33')][_0xf4b9('0x41')]){_0x38d1bf[_0xf4b9('0x42')]=[{'all':!![]}];}return db[_0xf4b9('0x2e')][_0xf4b9('0x43')](_0x38d1bf);})['then'](function(_0x5d74a){_0xa96ec0[_0xf4b9('0x44')]=_0x5d74a;return _0xa96ec0;})[_0xf4b9('0x23')](respondWithFilteredResult(_0x23d155,_0x38d1bf))[_0xf4b9('0x45')](handleError(_0x23d155,null));};exports[_0xf4b9('0x46')]=function(_0x1a8223,_0x5f284e){var _0x2b611d={'raw':!![],'where':{'id':_0x1a8223[_0xf4b9('0x47')]['id']}},_0x287a51={};_0x287a51['model']=_[_0xf4b9('0x32')](db[_0xf4b9('0x2e')][_0xf4b9('0x2f')]);_0x287a51[_0xf4b9('0x33')]=_['keys'](_0x1a8223[_0xf4b9('0x33')]);_0x287a51[_0xf4b9('0x34')]=_[_0xf4b9('0x35')](_0x287a51[_0xf4b9('0x36')],_0x287a51[_0xf4b9('0x33')]);_0x2b611d['attributes']=_[_0xf4b9('0x35')](_0x287a51[_0xf4b9('0x36')],qs[_0xf4b9('0x38')](_0x1a8223[_0xf4b9('0x33')][_0xf4b9('0x38')]));_0x2b611d[_0xf4b9('0x37')]=_0x2b611d[_0xf4b9('0x37')][_0xf4b9('0x39')]?_0x2b611d[_0xf4b9('0x37')]:_0x287a51[_0xf4b9('0x36')];if(_0x1a8223[_0xf4b9('0x33')][_0xf4b9('0x41')]){_0x2b611d[_0xf4b9('0x42')]=[{'all':!![]}];}_0x2b611d=_[_0xf4b9('0x48')]({},_0x2b611d,_0x1a8223[_0xf4b9('0x40')]);return db['Interval'][_0xf4b9('0x49')](_0x2b611d)[_0xf4b9('0x23')](handleEntityNotFound(_0x5f284e,null))[_0xf4b9('0x23')](respondWithResult(_0x5f284e,null))[_0xf4b9('0x45')](handleError(_0x5f284e,null));};exports[_0xf4b9('0x4a')]=function(_0x13ae85,_0x21a8a6){return db[_0xf4b9('0x2e')][_0xf4b9('0x4a')](_0x13ae85[_0xf4b9('0x4b')],{})['then'](function(_0x2fff52){var _0x2b502e=_0x13ae85[_0xf4b9('0x4c')][_0xf4b9('0x25')]({'plain':!![]});if(!_0x2b502e)throw new Error(_0xf4b9('0x4d'));if(_0x2b502e['role']===_0xf4b9('0x4c')){var _0x139ed6=_0x2fff52[_0xf4b9('0x25')]({'plain':!![]});var _0x2dde80=_0xf4b9('0x26');return db[_0xf4b9('0x4e')][_0xf4b9('0x49')]({'where':{'name':_0x2dde80,'userProfileId':_0x2b502e[_0xf4b9('0x4f')]},'raw':!![]})['then'](function(_0x175965){if(_0x175965&&_0x175965[_0xf4b9('0x50')]===0x0){return db[_0xf4b9('0x27')]['create']({'name':_0x139ed6[_0xf4b9('0x2a')],'resourceId':_0x139ed6['id'],'type':_0x175965[_0xf4b9('0x2a')],'sectionId':_0x175965['id']},{})[_0xf4b9('0x23')](function(){return _0x2fff52;});}else{return _0x2fff52;}})[_0xf4b9('0x45')](function(_0x1204ea){logger[_0xf4b9('0x28')](_0xf4b9('0x51'),_0x1204ea);throw _0x1204ea;});}return _0x2fff52;})[_0xf4b9('0x23')](respondWithResult(_0x21a8a6,0xc9))[_0xf4b9('0x45')](handleError(_0x21a8a6,null));};exports[_0xf4b9('0x22')]=function(_0x30622b,_0x4ff42b){if(_0x30622b[_0xf4b9('0x4b')]['id']){delete _0x30622b[_0xf4b9('0x4b')]['id'];}return db[_0xf4b9('0x2e')]['find']({'where':{'id':_0x30622b[_0xf4b9('0x47')]['id']}})[_0xf4b9('0x23')](handleEntityNotFound(_0x4ff42b,null))[_0xf4b9('0x23')](saveUpdates(_0x30622b[_0xf4b9('0x4b')],null))[_0xf4b9('0x23')](respondWithResult(_0x4ff42b,null))[_0xf4b9('0x45')](handleError(_0x4ff42b,null));};exports[_0xf4b9('0x24')]=function(_0x4dd1b9,_0x378e40){return db[_0xf4b9('0x2e')][_0xf4b9('0x49')]({'where':{'id':_0x4dd1b9[_0xf4b9('0x47')]['id']}})[_0xf4b9('0x23')](handleEntityNotFound(_0x378e40,null))[_0xf4b9('0x23')](removeEntity(_0x378e40,null))['catch'](handleError(_0x378e40,null));};exports[_0xf4b9('0x52')]=function(_0x2792f9,_0x513f7c,_0x105f09){if(_0x2792f9[_0xf4b9('0x4b')]['id']){delete _0x2792f9['body']['id'];}return db[_0xf4b9('0x2e')]['find']({'where':{'id':_0x2792f9[_0xf4b9('0x47')]['id']}})[_0xf4b9('0x23')](handleEntityNotFound(_0x513f7c,null))[_0xf4b9('0x23')](function(_0x4f37be){if(_0x4f37be){_0x2792f9['body'][_0xf4b9('0x53')]=_0x4f37be['id'];return db[_0xf4b9('0x2e')][_0xf4b9('0x4a')](_0x2792f9[_0xf4b9('0x4b')]);}})[_0xf4b9('0x23')](respondWithResult(_0x513f7c,null))[_0xf4b9('0x45')](handleError(_0x513f7c,null));};exports['getIntervals']=function(_0x320cce,_0x321c6c,_0x1305a0){var _0x462979={};var _0x414033={};var _0x4dba7b;var _0x32b10c;return db['Interval'][_0xf4b9('0x54')]({'where':{'id':_0x320cce[_0xf4b9('0x47')]['id']}})['then'](handleEntityNotFound(_0x321c6c,null))[_0xf4b9('0x23')](function(_0xee1404){if(_0xee1404){_0x4dba7b=_0xee1404;_0x414033[_0xf4b9('0x36')]=_[_0xf4b9('0x32')](db[_0xf4b9('0x2e')][_0xf4b9('0x2f')]);_0x414033[_0xf4b9('0x33')]=_[_0xf4b9('0x32')](_0x320cce['query']);_0x414033[_0xf4b9('0x34')]=_['intersection'](_0x414033[_0xf4b9('0x36')],_0x414033[_0xf4b9('0x33')]);_0x462979[_0xf4b9('0x37')]=_[_0xf4b9('0x35')](_0x414033['model'],qs[_0xf4b9('0x38')](_0x320cce[_0xf4b9('0x33')][_0xf4b9('0x38')]));_0x462979[_0xf4b9('0x37')]=_0x462979[_0xf4b9('0x37')][_0xf4b9('0x39')]?_0x462979[_0xf4b9('0x37')]:_0x414033['model'];_0x462979[_0xf4b9('0x3c')]=qs[_0xf4b9('0x3d')](_0x320cce[_0xf4b9('0x33')][_0xf4b9('0x3d')]);_0x462979['where']=qs[_0xf4b9('0x34')](_[_0xf4b9('0x55')](_0x320cce[_0xf4b9('0x33')],_0x414033['filters']));if(_0x320cce[_0xf4b9('0x33')][_0xf4b9('0x3f')]){_0x462979[_0xf4b9('0x3e')]=_[_0xf4b9('0x48')](_0x462979[_0xf4b9('0x3e')],{'$or':_[_0xf4b9('0x2d')](_0x462979[_0xf4b9('0x37')],function(_0x306dd4){var _0x39d442={};_0x39d442[_0x306dd4]={'$like':'%'+_0x320cce[_0xf4b9('0x33')][_0xf4b9('0x3f')]+'%'};return _0x39d442;})});}_0x462979=_['merge']({},_0x462979,_0x320cce[_0xf4b9('0x40')]);return _0x4dba7b[_0xf4b9('0x56')](_0x462979);}})[_0xf4b9('0x23')](function(_0x26c24a){if(_0x26c24a){_0x32b10c=_0x26c24a['length'];if(!_0x320cce[_0xf4b9('0x33')][_0xf4b9('0x3a')](_0xf4b9('0x3b'))){_0x462979[_0xf4b9('0x1c')]=qs[_0xf4b9('0x1c')](_0x320cce[_0xf4b9('0x33')][_0xf4b9('0x1c')]);_0x462979[_0xf4b9('0x1a')]=qs[_0xf4b9('0x1a')](_0x320cce[_0xf4b9('0x33')][_0xf4b9('0x1a')]);}return _0x4dba7b['getIntervals'](_0x462979);}})[_0xf4b9('0x23')](function(_0x5ca525){if(_0x5ca525){return _0x5ca525?{'count':_0x32b10c,'rows':_0x5ca525}:null;}})[_0xf4b9('0x23')](respondWithResult(_0x321c6c,null))[_0xf4b9('0x45')](handleError(_0x321c6c,null));};exports['addIntervals']=function(_0x2b94d5,_0x5a052e,_0x5c84f6){return db['Interval'][_0xf4b9('0x54')]({'where':{'id':_0x2b94d5['params']['id']}})[_0xf4b9('0x23')](handleEntityNotFound(_0x5a052e,null))[_0xf4b9('0x23')](function(_0x5a73ef){if(_0x5a73ef){return db[_0xf4b9('0x57')]['transaction'](function(_0x2d7752){return db[_0xf4b9('0x2e')][_0xf4b9('0x24')]({'where':{'IntervalId':_0x2b94d5[_0xf4b9('0x47')]['id']},'transaction':_0x2d7752})[_0xf4b9('0x23')](function(_0x14c411){var _0x2be81b=_[_0xf4b9('0x2d')](_0x2b94d5[_0xf4b9('0x4b')],function(_0x1b5f00){delete _0x1b5f00['id'];_0x1b5f00['IntervalId']=_0x2b94d5[_0xf4b9('0x47')]['id'];return _0x1b5f00;});return db['Interval'][_0xf4b9('0x58')](_0x2be81b,{'transaction':_0x2d7752});});})['then'](function(){return db[_0xf4b9('0x2e')][_0xf4b9('0x43')]({'where':{'IntervalId':_0x2b94d5[_0xf4b9('0x47')]['id']}});});}})[_0xf4b9('0x23')](respondWithResult(_0x5a052e,null))[_0xf4b9('0x45')](handleError(_0x5a052e,null));}; \ No newline at end of file +var _0xa6bf=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','params','addInterval','IntervalId','getIntervals','findOne','sequelize','transaction','bulkCreate','zip-dir','fast-json-patch','moment','bluebird','mustache','util','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','sendStatus','status','end','undefined','offset','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','get','Intervals','error','stack','name','index','map','Interval','rawAttributes','fieldName','type','key','model'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa6bf,0x83));var _0xfa6b=function(_0x5e176c,_0x1e8d00){_0x5e176c=_0x5e176c-0x0;var _0x14fb33=_0xa6bf[_0x5e176c];return _0x14fb33;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfa6b('0x0'));var jsonpatch=require(_0xfa6b('0x1'));var rp=require('request-promise');var moment=require(_0xfa6b('0x2'));var BPromise=require(_0xfa6b('0x3'));var Mustache=require(_0xfa6b('0x4'));var util=require(_0xfa6b('0x5'));var path=require('path');var sox=require(_0xfa6b('0x6'));var csv=require(_0xfa6b('0x7'));var ejs=require(_0xfa6b('0x8'));var fs=require('fs');var fs_extra=require(_0xfa6b('0x9'));var _=require(_0xfa6b('0xa'));var squel=require(_0xfa6b('0xb'));var crypto=require('crypto');var jsforce=require(_0xfa6b('0xc'));var deskjs=require(_0xfa6b('0xd'));var toCsv=require(_0xfa6b('0x7'));var querystring=require(_0xfa6b('0xe'));var Papa=require('papaparse');var Redis=require(_0xfa6b('0xf'));var authService=require(_0xfa6b('0x10'));var qs=require(_0xfa6b('0x11'));var as=require(_0xfa6b('0x12'));var hardwareService=require(_0xfa6b('0x13'));var logger=require(_0xfa6b('0x14'))(_0xfa6b('0x15'));var utils=require(_0xfa6b('0x16'));var config=require(_0xfa6b('0x17'));var licenseUtil=require(_0xfa6b('0x18'));var db=require(_0xfa6b('0x19'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x1e7601,_0x12eef0){_0x12eef0=_0x12eef0||0xcc;return function(_0xad7aa3){if(_0xad7aa3){return _0x1e7601[_0xfa6b('0x1a')](_0x12eef0);}return _0x1e7601[_0xfa6b('0x1b')](_0x12eef0)[_0xfa6b('0x1c')]();};}function respondWithResult(_0x3f8367,_0x502ced){_0x502ced=_0x502ced||0xc8;return function(_0x4a8dbe){if(_0x4a8dbe){return _0x3f8367[_0xfa6b('0x1b')](_0x502ced)['json'](_0x4a8dbe);}};}function respondWithFilteredResult(_0x682e11,_0x397164){return function(_0x523ff3){if(_0x523ff3){var _0x425a22=typeof _0x397164['offset']===_0xfa6b('0x1d')&&typeof _0x397164['limit']===_0xfa6b('0x1d');var _0x189f5f=_0x523ff3['count'];var _0xca4677=_0x425a22?0x0:_0x397164[_0xfa6b('0x1e')];var _0x46b3ec=_0x425a22?_0x523ff3[_0xfa6b('0x1f')]:_0x397164['offset']+_0x397164[_0xfa6b('0x20')];var _0x284e8d;if(_0x46b3ec>=_0x189f5f){_0x46b3ec=_0x189f5f;_0x284e8d=0xc8;}else{_0x284e8d=0xce;}_0x682e11[_0xfa6b('0x1b')](_0x284e8d);return _0x682e11[_0xfa6b('0x21')](_0xfa6b('0x22'),_0xca4677+'-'+_0x46b3ec+'/'+_0x189f5f)[_0xfa6b('0x23')](_0x523ff3);}return null;};}function patchUpdates(_0x1951f1){return function(_0x4d61ba){try{jsonpatch[_0xfa6b('0x24')](_0x4d61ba,_0x1951f1,!![]);}catch(_0x633a79){return BPromise[_0xfa6b('0x25')](_0x633a79);}return _0x4d61ba[_0xfa6b('0x26')]();};}function saveUpdates(_0x281cbe,_0x34347b){return function(_0x328f83){if(_0x328f83){return _0x328f83[_0xfa6b('0x27')](_0x281cbe)['then'](function(_0x3d7167){return _0x3d7167;});}return null;};}function removeEntity(_0x47533d,_0x2adb98){return function(_0x1d8c2d){if(_0x1d8c2d){return _0x1d8c2d[_0xfa6b('0x28')]()[_0xfa6b('0x29')](function(){var _0x3f2a0c=_0x1d8c2d[_0xfa6b('0x2a')]({'plain':!![]});var _0x56b66c=_0xfa6b('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x56b66c,'resourceId':_0x3f2a0c['id']}})['then'](function(){return _0x1d8c2d;});})[_0xfa6b('0x29')](function(){_0x47533d[_0xfa6b('0x1b')](0xcc)[_0xfa6b('0x1c')]();});}};}function handleEntityNotFound(_0x388c96,_0x353eb1){return function(_0x7d25a7){if(!_0x7d25a7){_0x388c96[_0xfa6b('0x1a')](0x194);}return _0x7d25a7;};}function handleError(_0x40000e,_0x51882a){_0x51882a=_0x51882a||0x1f4;return function(_0x4565da){logger[_0xfa6b('0x2c')](_0x4565da[_0xfa6b('0x2d')]);if(_0x4565da[_0xfa6b('0x2e')]){delete _0x4565da[_0xfa6b('0x2e')];}_0x40000e[_0xfa6b('0x1b')](_0x51882a)['send'](_0x4565da);};}exports[_0xfa6b('0x2f')]=function(_0x1ad0d6,_0x168494){var _0x5d272b={},_0xb909ba={},_0x4321c3={'count':0x0,'rows':[]};var _0x3fe802=_[_0xfa6b('0x30')](db[_0xfa6b('0x31')][_0xfa6b('0x32')],function(_0x5d1383){return{'name':_0x5d1383[_0xfa6b('0x33')],'type':_0x5d1383[_0xfa6b('0x34')][_0xfa6b('0x35')]};});_0xb909ba[_0xfa6b('0x36')]=_[_0xfa6b('0x30')](_0x3fe802,_0xfa6b('0x2e'));_0xb909ba[_0xfa6b('0x37')]=_[_0xfa6b('0x38')](_0x1ad0d6[_0xfa6b('0x37')]);_0xb909ba[_0xfa6b('0x39')]=_[_0xfa6b('0x3a')](_0xb909ba[_0xfa6b('0x36')],_0xb909ba[_0xfa6b('0x37')]);_0x5d272b[_0xfa6b('0x3b')]=_['intersection'](_0xb909ba[_0xfa6b('0x36')],qs[_0xfa6b('0x3c')](_0x1ad0d6[_0xfa6b('0x37')][_0xfa6b('0x3c')]));_0x5d272b[_0xfa6b('0x3b')]=_0x5d272b[_0xfa6b('0x3b')][_0xfa6b('0x3d')]?_0x5d272b[_0xfa6b('0x3b')]:_0xb909ba[_0xfa6b('0x36')];if(!_0x1ad0d6[_0xfa6b('0x37')][_0xfa6b('0x3e')](_0xfa6b('0x3f'))){_0x5d272b[_0xfa6b('0x20')]=qs[_0xfa6b('0x20')](_0x1ad0d6[_0xfa6b('0x37')][_0xfa6b('0x20')]);_0x5d272b[_0xfa6b('0x1e')]=qs[_0xfa6b('0x1e')](_0x1ad0d6[_0xfa6b('0x37')][_0xfa6b('0x1e')]);}_0x5d272b[_0xfa6b('0x40')]=qs[_0xfa6b('0x41')](_0x1ad0d6[_0xfa6b('0x37')][_0xfa6b('0x41')]);_0x5d272b[_0xfa6b('0x42')]=qs[_0xfa6b('0x39')](_['pick'](_0x1ad0d6[_0xfa6b('0x37')],_0xb909ba['filters']),_0x3fe802);if(_0x1ad0d6[_0xfa6b('0x37')]['filter']){_0x5d272b['where']=_[_0xfa6b('0x43')](_0x5d272b[_0xfa6b('0x42')],{'$or':_[_0xfa6b('0x30')](_0x3fe802,function(_0xefe34d){if(_0xefe34d[_0xfa6b('0x34')]!==_0xfa6b('0x44')){var _0x17d1b5={};_0x17d1b5[_0xefe34d['name']]={'$like':'%'+_0x1ad0d6[_0xfa6b('0x37')][_0xfa6b('0x45')]+'%'};return _0x17d1b5;}})});}_0x5d272b=_[_0xfa6b('0x43')]({},_0x5d272b,_0x1ad0d6[_0xfa6b('0x46')]);var _0x53b188={'where':_0x5d272b[_0xfa6b('0x42')]};return db[_0xfa6b('0x31')][_0xfa6b('0x1f')](_0x53b188)['then'](function(_0x4451d6){_0x4321c3[_0xfa6b('0x1f')]=_0x4451d6;if(_0x1ad0d6[_0xfa6b('0x37')]['includeAll']){_0x5d272b[_0xfa6b('0x47')]=[{'all':!![]}];}return db[_0xfa6b('0x31')][_0xfa6b('0x48')](_0x5d272b);})[_0xfa6b('0x29')](function(_0x354217){_0x4321c3[_0xfa6b('0x49')]=_0x354217;return _0x4321c3;})['then'](respondWithFilteredResult(_0x168494,_0x5d272b))[_0xfa6b('0x4a')](handleError(_0x168494,null));};exports['show']=function(_0x46217b,_0x499b85){var _0x5c509a={'raw':!![],'where':{'id':_0x46217b['params']['id']}},_0x44ab1c={};_0x44ab1c[_0xfa6b('0x36')]=_[_0xfa6b('0x38')](db[_0xfa6b('0x31')][_0xfa6b('0x32')]);_0x44ab1c['query']=_[_0xfa6b('0x38')](_0x46217b[_0xfa6b('0x37')]);_0x44ab1c[_0xfa6b('0x39')]=_['intersection'](_0x44ab1c[_0xfa6b('0x36')],_0x44ab1c[_0xfa6b('0x37')]);_0x5c509a[_0xfa6b('0x3b')]=_[_0xfa6b('0x3a')](_0x44ab1c[_0xfa6b('0x36')],qs[_0xfa6b('0x3c')](_0x46217b[_0xfa6b('0x37')][_0xfa6b('0x3c')]));_0x5c509a[_0xfa6b('0x3b')]=_0x5c509a[_0xfa6b('0x3b')]['length']?_0x5c509a[_0xfa6b('0x3b')]:_0x44ab1c[_0xfa6b('0x36')];if(_0x46217b['query']['includeAll']){_0x5c509a[_0xfa6b('0x47')]=[{'all':!![]}];}_0x5c509a=_[_0xfa6b('0x43')]({},_0x5c509a,_0x46217b[_0xfa6b('0x46')]);return db['Interval'][_0xfa6b('0x4b')](_0x5c509a)[_0xfa6b('0x29')](handleEntityNotFound(_0x499b85,null))[_0xfa6b('0x29')](respondWithResult(_0x499b85,null))['catch'](handleError(_0x499b85,null));};exports['create']=function(_0x2c6bb5,_0x3d9c36){return db[_0xfa6b('0x31')]['create'](_0x2c6bb5[_0xfa6b('0x4c')],{})[_0xfa6b('0x29')](function(_0x5c5834){var _0x20b678=_0x2c6bb5[_0xfa6b('0x4d')]['get']({'plain':!![]});if(!_0x20b678)throw new Error(_0xfa6b('0x4e'));if(_0x20b678[_0xfa6b('0x4f')]===_0xfa6b('0x4d')){var _0x8a815a=_0x5c5834[_0xfa6b('0x2a')]({'plain':!![]});var _0x18cd84=_0xfa6b('0x2b');return db[_0xfa6b('0x50')][_0xfa6b('0x4b')]({'where':{'name':_0x18cd84,'userProfileId':_0x20b678[_0xfa6b('0x51')]},'raw':!![]})[_0xfa6b('0x29')](function(_0x30a02a){if(_0x30a02a&&_0x30a02a[_0xfa6b('0x52')]===0x0){return db[_0xfa6b('0x53')][_0xfa6b('0x54')]({'name':_0x8a815a[_0xfa6b('0x2e')],'resourceId':_0x8a815a['id'],'type':_0x30a02a['name'],'sectionId':_0x30a02a['id']},{})[_0xfa6b('0x29')](function(){return _0x5c5834;});}else{return _0x5c5834;}})[_0xfa6b('0x4a')](function(_0x310cbc){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x310cbc);throw _0x310cbc;});}return _0x5c5834;})['then'](respondWithResult(_0x3d9c36,0xc9))['catch'](handleError(_0x3d9c36,null));};exports[_0xfa6b('0x27')]=function(_0x21b791,_0x38422b){if(_0x21b791['body']['id']){delete _0x21b791['body']['id'];}return db[_0xfa6b('0x31')][_0xfa6b('0x4b')]({'where':{'id':_0x21b791[_0xfa6b('0x55')]['id']}})[_0xfa6b('0x29')](handleEntityNotFound(_0x38422b,null))[_0xfa6b('0x29')](saveUpdates(_0x21b791[_0xfa6b('0x4c')],null))[_0xfa6b('0x29')](respondWithResult(_0x38422b,null))[_0xfa6b('0x4a')](handleError(_0x38422b,null));};exports['destroy']=function(_0x391efb,_0x5e4015){return db[_0xfa6b('0x31')]['find']({'where':{'id':_0x391efb[_0xfa6b('0x55')]['id']}})[_0xfa6b('0x29')](handleEntityNotFound(_0x5e4015,null))[_0xfa6b('0x29')](removeEntity(_0x5e4015,null))[_0xfa6b('0x4a')](handleError(_0x5e4015,null));};exports[_0xfa6b('0x56')]=function(_0x14ff36,_0x18f0a3,_0x49cd3b){if(_0x14ff36[_0xfa6b('0x4c')]['id']){delete _0x14ff36[_0xfa6b('0x4c')]['id'];}return db['Interval'][_0xfa6b('0x4b')]({'where':{'id':_0x14ff36[_0xfa6b('0x55')]['id']}})[_0xfa6b('0x29')](handleEntityNotFound(_0x18f0a3,null))[_0xfa6b('0x29')](function(_0x480ba5){if(_0x480ba5){_0x14ff36[_0xfa6b('0x4c')][_0xfa6b('0x57')]=_0x480ba5['id'];return db[_0xfa6b('0x31')][_0xfa6b('0x54')](_0x14ff36[_0xfa6b('0x4c')]);}})['then'](respondWithResult(_0x18f0a3,null))['catch'](handleError(_0x18f0a3,null));};exports[_0xfa6b('0x58')]=function(_0x3884f0,_0x109ce5,_0x467896){var _0x5716ce={};var _0x29d6c0={};var _0x7bf0a8;var _0x49b44c;return db[_0xfa6b('0x31')]['findOne']({'where':{'id':_0x3884f0['params']['id']}})[_0xfa6b('0x29')](handleEntityNotFound(_0x109ce5,null))['then'](function(_0x586629){if(_0x586629){_0x7bf0a8=_0x586629;_0x29d6c0[_0xfa6b('0x36')]=_[_0xfa6b('0x38')](db[_0xfa6b('0x31')][_0xfa6b('0x32')]);_0x29d6c0[_0xfa6b('0x37')]=_[_0xfa6b('0x38')](_0x3884f0['query']);_0x29d6c0[_0xfa6b('0x39')]=_['intersection'](_0x29d6c0[_0xfa6b('0x36')],_0x29d6c0[_0xfa6b('0x37')]);_0x5716ce['attributes']=_['intersection'](_0x29d6c0[_0xfa6b('0x36')],qs[_0xfa6b('0x3c')](_0x3884f0[_0xfa6b('0x37')][_0xfa6b('0x3c')]));_0x5716ce[_0xfa6b('0x3b')]=_0x5716ce[_0xfa6b('0x3b')][_0xfa6b('0x3d')]?_0x5716ce['attributes']:_0x29d6c0[_0xfa6b('0x36')];_0x5716ce[_0xfa6b('0x40')]=qs[_0xfa6b('0x41')](_0x3884f0[_0xfa6b('0x37')][_0xfa6b('0x41')]);_0x5716ce[_0xfa6b('0x42')]=qs[_0xfa6b('0x39')](_['pick'](_0x3884f0[_0xfa6b('0x37')],_0x29d6c0['filters']));if(_0x3884f0['query'][_0xfa6b('0x45')]){_0x5716ce[_0xfa6b('0x42')]=_[_0xfa6b('0x43')](_0x5716ce[_0xfa6b('0x42')],{'$or':_['map'](_0x5716ce['attributes'],function(_0x397021){var _0x1d678f={};_0x1d678f[_0x397021]={'$like':'%'+_0x3884f0[_0xfa6b('0x37')][_0xfa6b('0x45')]+'%'};return _0x1d678f;})});}_0x5716ce=_[_0xfa6b('0x43')]({},_0x5716ce,_0x3884f0[_0xfa6b('0x46')]);return _0x7bf0a8[_0xfa6b('0x58')](_0x5716ce);}})[_0xfa6b('0x29')](function(_0x387da0){if(_0x387da0){_0x49b44c=_0x387da0[_0xfa6b('0x3d')];if(!_0x3884f0[_0xfa6b('0x37')][_0xfa6b('0x3e')](_0xfa6b('0x3f'))){_0x5716ce[_0xfa6b('0x20')]=qs[_0xfa6b('0x20')](_0x3884f0['query'][_0xfa6b('0x20')]);_0x5716ce[_0xfa6b('0x1e')]=qs['offset'](_0x3884f0['query'][_0xfa6b('0x1e')]);}return _0x7bf0a8['getIntervals'](_0x5716ce);}})['then'](function(_0x39ff54){if(_0x39ff54){return _0x39ff54?{'count':_0x49b44c,'rows':_0x39ff54}:null;}})[_0xfa6b('0x29')](respondWithResult(_0x109ce5,null))[_0xfa6b('0x4a')](handleError(_0x109ce5,null));};exports['addIntervals']=function(_0x40764d,_0x25deca,_0x2808c8){return db[_0xfa6b('0x31')][_0xfa6b('0x59')]({'where':{'id':_0x40764d['params']['id']}})['then'](handleEntityNotFound(_0x25deca,null))[_0xfa6b('0x29')](function(_0x2e7398){if(_0x2e7398){return db[_0xfa6b('0x5a')][_0xfa6b('0x5b')](function(_0x3da910){return db[_0xfa6b('0x31')]['destroy']({'where':{'IntervalId':_0x40764d[_0xfa6b('0x55')]['id']},'transaction':_0x3da910})[_0xfa6b('0x29')](function(_0x5925dc){var _0x10b7e7=_[_0xfa6b('0x30')](_0x40764d[_0xfa6b('0x4c')],function(_0x49eb05){delete _0x49eb05['id'];_0x49eb05[_0xfa6b('0x57')]=_0x40764d[_0xfa6b('0x55')]['id'];return _0x49eb05;});return db[_0xfa6b('0x31')][_0xfa6b('0x5c')](_0x10b7e7,{'transaction':_0x3da910});});})[_0xfa6b('0x29')](function(){return db['Interval'][_0xfa6b('0x48')]({'where':{'IntervalId':_0x40764d[_0xfa6b('0x55')]['id']}});});}})[_0xfa6b('0x29')](respondWithResult(_0x25deca,null))[_0xfa6b('0x4a')](handleError(_0x25deca,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 23026a4..bfc7a3c 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 _0xe4e2=['define','rewrite','lodash','api','moment','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe4e2,0x65));var _0x2e4e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xe4e2[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x2e4e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2e4e('0x1'));var moment=require(_0x2e4e('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2e4e('0x3'));var rimraf=require(_0x2e4e('0x4'));var config=require(_0x2e4e('0x5'));var attributes=require(_0x2e4e('0x6'));var extensions=require(_0x2e4e('0x7'));module[_0x2e4e('0x8')]=function(_0x2a77ca,_0x566be6){return _0x2a77ca[_0x2e4e('0x9')]('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c5b74,_0x58102c){extensions[_0x2e4e('0xa')](_0x2a77ca,_0x2c5b74);},'afterBulkCreate':function(_0x4fcc73,_0x488844,_0x3199bc){_0x3199bc();extensions[_0x2e4e('0xa')](_0x2a77ca,_0x4fcc73[0x0]);},'afterUpdate':function(_0x20abe7,_0x1f5b88){extensions['rewrite'](_0x2a77ca,_0x20abe7);},'afterDestroy':function(_0x4ec192,_0x1762a8){extensions[_0x2e4e('0xa')](_0x2a77ca,_0x4ec192);}}});}; \ No newline at end of file +var _0xe81e=['tools_intervals','rewrite','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xe81e,0xb6));var _0xee81=function(_0x333f2f,_0x44b8e9){_0x333f2f=_0x333f2f-0x0;var _0x1246ec=_0xe81e[_0x333f2f];return _0x1246ec;};'use strict';var _=require(_0xee81('0x0'));var util=require(_0xee81('0x1'));var logger=require(_0xee81('0x2'))('api');var moment=require(_0xee81('0x3'));var BPromise=require(_0xee81('0x4'));var rp=require(_0xee81('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xee81('0x6'));var config=require(_0xee81('0x7'));var attributes=require(_0xee81('0x8'));var extensions=require(_0xee81('0x9'));module[_0xee81('0xa')]=function(_0x51bd0f,_0x27a465){return _0x51bd0f[_0xee81('0xb')](_0xee81('0xc'),attributes,{'tableName':_0xee81('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xdde81d,_0x80bd29){extensions[_0xee81('0xe')](_0x51bd0f,_0xdde81d);},'afterBulkCreate':function(_0x29c197,_0x4ad906,_0x22afc2){_0x22afc2();extensions[_0xee81('0xe')](_0x51bd0f,_0x29c197[0x0]);},'afterUpdate':function(_0x425922,_0x3930ac){extensions[_0xee81('0xe')](_0x51bd0f,_0x425922);},'afterDestroy':function(_0x5208de,_0x15bb4c){extensions['rewrite'](_0x51bd0f,_0x5208de);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index b127eb3..af83c35 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x25701b,_0x2a6976){var _0x3a8a2c=function(_0x1a5e78){while(--_0x1a5e78){_0x25701b['push'](_0x25701b['shift']());}};_0x3a8a2c(++_0x2a6976);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x295a3d,_0x56d487){var _0x23a732=function(_0x15cfc2){while(--_0x15cfc2){_0x295a3d['push'](_0x295a3d['shift']());}};_0x23a732(++_0x56d487);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 82b0f40..409f30e 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 _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x4e6b5e,_0x17b2f1){var _0x4c9460=function(_0x3cf400){while(--_0x3cf400){_0x4e6b5e['push'](_0x4e6b5e['shift']());}};_0x4c9460(++_0x17b2f1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x128633,_0x25c545){_0x128633=_0x128633-0x0;var _0x3e3923=_0x5f2f[_0x128633];return _0x3e3923;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file +var _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3328b4,_0x403a24){_0x3328b4=_0x3328b4-0x0;var _0x530143=_0x0b0e[_0x3328b4];return _0x530143;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 226caa9..f9a12ac 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 _0xe71c=['api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','name','customfield_11504','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','toString','base64','request','utf8','data','status','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','end','openIssue','send','headers','x-forwarded-for','connection','remoteAddress','socket','body','bluebird','../../config/logger'];(function(_0x1d49d2,_0x4ab5b5){var _0x106fbf=function(_0x1ae539){while(--_0x1ae539){_0x1d49d2['push'](_0x1d49d2['shift']());}};_0x106fbf(++_0x4ab5b5);}(_0xe71c,0x1b6));var _0xce71=function(_0xadde88,_0x58ad47){_0xadde88=_0xadde88-0x0;var _0x3b8eb6=_0xe71c[_0xadde88];return _0x3b8eb6;};'use strict';var BPromise=require(_0xce71('0x0'));var https=require('https');var logger=require(_0xce71('0x1'))(_0xce71('0x2'));var USERNAME=_0xce71('0x3');var PASSWORD=_0xce71('0x4');function openIssue(_0x5e87b4,_0x26e5fc){var _0x2e1174={'fields':{'project':{'key':_0x5e87b4[_0xce71('0x5')]||_0xce71('0x6')},'summary':(_0x5e87b4[_0xce71('0x7')]||_0xce71('0x8'))+'\x20from\x20'+_0x5e87b4['ip'],'description':_0x5e87b4[_0xce71('0x9')]||JSON[_0xce71('0xa')](_0x5e87b4),'issuetype':{'name':_0x5e87b4[_0xce71('0xb')]||_0xce71('0xc')}}};_0x2e1174[_0xce71('0xd')][_0xce71('0xe')]=_0x5e87b4[_0xce71('0xf')];_0x2e1174[_0xce71('0xd')][_0xce71('0x10')]=_0x5e87b4[_0xce71('0x11')];_0x2e1174[_0xce71('0xd')][_0xce71('0x12')]=_0x5e87b4['newToken'];_0x2e1174[_0xce71('0xd')]['customfield_11503']=_0x5e87b4[_0xce71('0x13')];_0x2e1174[_0xce71('0xd')][_0xce71('0x14')]=_0x5e87b4['reason'];_0x2e1174[_0xce71('0xd')][_0xce71('0x15')]=_0x5e87b4['ip'];var _0x36ae87={'host':_0xce71('0x16'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0xce71('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0xce71('0x18'),'Authorization':_0xce71('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0xce71('0x1a')](_0xce71('0x1b'))}};var _0x46482b=JSON['stringify'](_0x2e1174);var _0x541004=https[_0xce71('0x1c')](_0x36ae87,function(_0x43450c){_0x43450c['setEncoding'](_0xce71('0x1d'));var _0xf333c8='';_0x43450c['on'](_0xce71('0x1e'),function(_0x542070){_0xf333c8+=_0x542070;});_0x43450c['on']('end',function(){if(_0x26e5fc){return _0x26e5fc[_0xce71('0x1f')](_0x43450c['statusCode'])[_0xce71('0x20')](JSON['parse'](_0xf333c8));}});});_0x541004['on']('error',function(_0x2656d8){if(_0x26e5fc){return _0x26e5fc[_0xce71('0x1f')](0x1f4)[_0xce71('0x20')]({'errors':[{'message':_0xce71('0x21'),'type':'api.jira'}]});}});_0x541004[_0xce71('0x22')](_0x46482b);_0x541004[_0xce71('0x23')]();}exports[_0xce71('0x24')]=openIssue;exports[_0xce71('0x25')]=function(_0x1af25a,_0x30168a){_0x1af25a['body']['ip']=_0x1af25a[_0xce71('0x26')][_0xce71('0x27')]||_0x1af25a[_0xce71('0x28')][_0xce71('0x29')]||_0x1af25a[_0xce71('0x2a')][_0xce71('0x29')]||_0x1af25a[_0xce71('0x28')][_0xce71('0x2a')][_0xce71('0x29')];return openIssue(_0x1af25a[_0xce71('0x2b')],_0x30168a);}; \ No newline at end of file +var _0x7f16=['oldToken','newToken','customfield_11503','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','base64','utf8','end','status','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','api','support','3eAmWpBVP0','MOTGUI','summary','\x20from\x20','description','stringify','issuetype','fields'];(function(_0x2d5558,_0x498a79){var _0x552ab=function(_0x5ec717){while(--_0x5ec717){_0x2d5558['push'](_0x2d5558['shift']());}};_0x552ab(++_0x498a79);}(_0x7f16,0x1bc));var _0x67f1=function(_0x1272d7,_0x5245a1){_0x1272d7=_0x1272d7-0x0;var _0x59c93e=_0x7f16[_0x1272d7];return _0x59c93e;};'use strict';var BPromise=require(_0x67f1('0x0'));var https=require(_0x67f1('0x1'));var logger=require('../../config/logger')(_0x67f1('0x2'));var USERNAME=_0x67f1('0x3');var PASSWORD=_0x67f1('0x4');function openIssue(_0x3e80cc,_0x2c39d6){var _0x41ef41={'fields':{'project':{'key':_0x3e80cc['key']||_0x67f1('0x5')},'summary':(_0x3e80cc[_0x67f1('0x6')]||'Report')+_0x67f1('0x7')+_0x3e80cc['ip'],'description':_0x3e80cc[_0x67f1('0x8')]||JSON[_0x67f1('0x9')](_0x3e80cc),'issuetype':{'name':_0x3e80cc[_0x67f1('0xa')]||'Bug'}}};_0x41ef41[_0x67f1('0xb')]['customfield_11500']=_0x3e80cc['email'];_0x41ef41[_0x67f1('0xb')]['customfield_11501']=_0x3e80cc[_0x67f1('0xc')];_0x41ef41[_0x67f1('0xb')]['customfield_11502']=_0x3e80cc[_0x67f1('0xd')];_0x41ef41[_0x67f1('0xb')][_0x67f1('0xe')]=_0x3e80cc['name'];_0x41ef41[_0x67f1('0xb')]['customfield_11504']=_0x3e80cc['reason'];_0x41ef41[_0x67f1('0xb')][_0x67f1('0xf')]=_0x3e80cc['ip'];var _0x90bf10={'host':_0x67f1('0x10'),'port':0x1bb,'path':_0x67f1('0x11'),'method':_0x67f1('0x12'),'timeout':0x4e20,'headers':{'Content-Type':_0x67f1('0x13'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x67f1('0x14'))}};var _0x1e2f0a=JSON[_0x67f1('0x9')](_0x41ef41);var _0xb01418=https['request'](_0x90bf10,function(_0x2c4678){_0x2c4678['setEncoding'](_0x67f1('0x15'));var _0x4228e8='';_0x2c4678['on']('data',function(_0x5b3e7e){_0x4228e8+=_0x5b3e7e;});_0x2c4678['on'](_0x67f1('0x16'),function(){if(_0x2c39d6){return _0x2c39d6[_0x67f1('0x17')](_0x2c4678['statusCode'])[_0x67f1('0x18')](JSON[_0x67f1('0x19')](_0x4228e8));}});});_0xb01418['on'](_0x67f1('0x1a'),function(_0xe875ae){if(_0x2c39d6){return _0x2c39d6[_0x67f1('0x17')](0x1f4)['json']({'errors':[{'message':_0x67f1('0x1b'),'type':_0x67f1('0x1c')}]});}});_0xb01418[_0x67f1('0x1d')](_0x1e2f0a);_0xb01418[_0x67f1('0x16')]();}exports[_0x67f1('0x1e')]=openIssue;exports[_0x67f1('0x1f')]=function(_0x1250b9,_0x639528){_0x1250b9[_0x67f1('0x20')]['ip']=_0x1250b9[_0x67f1('0x21')][_0x67f1('0x22')]||_0x1250b9[_0x67f1('0x23')][_0x67f1('0x24')]||_0x1250b9[_0x67f1('0x25')][_0x67f1('0x24')]||_0x1250b9[_0x67f1('0x23')][_0x67f1('0x25')][_0x67f1('0x24')];return openIssue(_0x1250b9[_0x67f1('0x20')],_0x639528);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index d4281b3..8366398 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 _0x99e9=['update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put'];(function(_0x42200d,_0x3609d4){var _0x1162ad=function(_0x5e6001){while(--_0x5e6001){_0x42200d['push'](_0x42200d['shift']());}};_0x1162ad(++_0x3609d4);}(_0x99e9,0xb4));var _0x999e=function(_0x2be104,_0x4bf5d0){_0x2be104=_0x2be104-0x0;var _0x31c115=_0x99e9[_0x2be104];return _0x31c115;};'use strict';var multer=require('multer');var util=require(_0x999e('0x0'));var path=require(_0x999e('0x1'));var timeout=require(_0x999e('0x2'));var express=require(_0x999e('0x3'));var router=express['Router']();var fs_extra=require(_0x999e('0x4'));var auth=require(_0x999e('0x5'));var interaction=require(_0x999e('0x6'));var config=require('../../config/environment');var controller=require(_0x999e('0x7'));router['get']('/',auth[_0x999e('0x8')](),controller[_0x999e('0x9')]);router[_0x999e('0xa')](_0x999e('0xb'),auth['isAuthenticated'](),controller[_0x999e('0xc')]);router[_0x999e('0xa')](_0x999e('0xd'),auth[_0x999e('0x8')](),controller[_0x999e('0xe')]);router[_0x999e('0xf')]('/',auth[_0x999e('0x8')](),controller[_0x999e('0x10')]);router[_0x999e('0x11')](_0x999e('0xd'),auth[_0x999e('0x8')](),controller[_0x999e('0x12')]);router[_0x999e('0x13')](_0x999e('0xd'),auth[_0x999e('0x8')](),controller[_0x999e('0x14')]);module[_0x999e('0x15')]=router; \ No newline at end of file +var _0x70e0=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','isAuthenticated','describe','get','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x324775,_0x439255){var _0x22dda4=function(_0x1e3368){while(--_0x1e3368){_0x324775['push'](_0x324775['shift']());}};_0x22dda4(++_0x439255);}(_0x70e0,0x17b));var _0x070e=function(_0x1e9fa6,_0x47b817){_0x1e9fa6=_0x1e9fa6-0x0;var _0x7aff=_0x70e0[_0x1e9fa6];return _0x7aff;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x070e('0xe')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xf')]);router[_0x070e('0x10')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x11')]);module[_0x070e('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 87f2225..ffbfe48 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(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x7a54,0x106));var _0x47a5=function(_0x1e616b,_0x3915ce){_0x1e616b=_0x1e616b-0x0;var _0x30eab7=_0x7a54[_0x1e616b];return _0x30eab7;};'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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x7a54,0x106));var _0x47a5=function(_0x28b100,_0x334797){_0x28b100=_0x28b100-0x0;var _0x3c2c01=_0x7a54[_0x28b100];return _0x3c2c01;};'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 3aab0a9..babb4b3 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 _0x294b=['intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','JscriptyAnswerReport','includeAll','include','catch','params','rawAttributes','find','create','body','update','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','apply','save','then','sendStatus','error','name','send','index','fieldName','type','key','model','map','query','keys','filters'];(function(_0x297916,_0x354444){var _0x2b1b09=function(_0x349061){while(--_0x349061){_0x297916['push'](_0x297916['shift']());}};_0x2b1b09(++_0x354444);}(_0x294b,0xea));var _0xb294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x294b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb294('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb294('0x1'));var jsonpatch=require(_0xb294('0x2'));var rp=require(_0xb294('0x3'));var moment=require(_0xb294('0x4'));var BPromise=require(_0xb294('0x5'));var Mustache=require(_0xb294('0x6'));var util=require('util');var path=require('path');var sox=require(_0xb294('0x7'));var csv=require(_0xb294('0x8'));var ejs=require(_0xb294('0x9'));var fs=require('fs');var fs_extra=require(_0xb294('0xa'));var _=require(_0xb294('0xb'));var squel=require('squel');var crypto=require(_0xb294('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb294('0xd'));var Papa=require(_0xb294('0xe'));var Redis=require(_0xb294('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb294('0x10'));var logger=require(_0xb294('0x11'))(_0xb294('0x12'));var utils=require(_0xb294('0x13'));var config=require(_0xb294('0x14'));var licenseUtil=require(_0xb294('0x15'));var db=require(_0xb294('0x16'))['db'];function respondWithStatusCode(_0x13a3fc,_0x2b2bb5){_0x2b2bb5=_0x2b2bb5||0xcc;return function(_0x3e0fe5){if(_0x3e0fe5){return _0x13a3fc['sendStatus'](_0x2b2bb5);}return _0x13a3fc['status'](_0x2b2bb5)[_0xb294('0x17')]();};}function respondWithResult(_0x4c0959,_0x4b5996){_0x4b5996=_0x4b5996||0xc8;return function(_0x22beca){if(_0x22beca){return _0x4c0959[_0xb294('0x18')](_0x4b5996)[_0xb294('0x19')](_0x22beca);}};}function respondWithFilteredResult(_0x366f8f,_0x3f7323){return function(_0x2f3b62){if(_0x2f3b62){var _0x1a4089=typeof _0x3f7323[_0xb294('0x1a')]===_0xb294('0x1b')&&typeof _0x3f7323[_0xb294('0x1c')]===_0xb294('0x1b');var _0x51110b=_0x2f3b62[_0xb294('0x1d')];var _0x1ecc68=_0x1a4089?0x0:_0x3f7323['offset'];var _0x5e8ce6=_0x1a4089?_0x2f3b62[_0xb294('0x1d')]:_0x3f7323[_0xb294('0x1a')]+_0x3f7323[_0xb294('0x1c')];var _0x449e81;if(_0x5e8ce6>=_0x51110b){_0x5e8ce6=_0x51110b;_0x449e81=0xc8;}else{_0x449e81=0xce;}_0x366f8f[_0xb294('0x18')](_0x449e81);return _0x366f8f['set']('Content-Range',_0x1ecc68+'-'+_0x5e8ce6+'/'+_0x51110b)[_0xb294('0x19')](_0x2f3b62);}return null;};}function patchUpdates(_0x46b2ac){return function(_0x526914){try{jsonpatch[_0xb294('0x1e')](_0x526914,_0x46b2ac,!![]);}catch(_0x18e7dd){return BPromise['reject'](_0x18e7dd);}return _0x526914[_0xb294('0x1f')]();};}function saveUpdates(_0x21b9b2,_0x33c416){return function(_0x4afd48){if(_0x4afd48){return _0x4afd48['update'](_0x21b9b2)[_0xb294('0x20')](function(_0x5bdc68){return _0x5bdc68;});}return null;};}function removeEntity(_0x36b173,_0x5be6d5){return function(_0x101339){if(_0x101339){return _0x101339['destroy']()[_0xb294('0x20')](function(){_0x36b173['status'](0xcc)[_0xb294('0x17')]();});}};}function handleEntityNotFound(_0x405b66,_0x2d0c62){return function(_0xabcb26){if(!_0xabcb26){_0x405b66[_0xb294('0x21')](0x194);}return _0xabcb26;};}function handleError(_0x469647,_0x2fe3a9){_0x2fe3a9=_0x2fe3a9||0x1f4;return function(_0x52853){logger[_0xb294('0x22')](_0x52853['stack']);if(_0x52853['name']){delete _0x52853[_0xb294('0x23')];}_0x469647[_0xb294('0x18')](_0x2fe3a9)[_0xb294('0x24')](_0x52853);};}exports[_0xb294('0x25')]=function(_0x47fca9,_0x59fbde){var _0x1167e5={},_0x3c2aa5={},_0x1efdb6={'count':0x0,'rows':[]};var _0x127ddd=_['map'](db['JscriptyAnswerReport']['rawAttributes'],function(_0xbb4a10){return{'name':_0xbb4a10[_0xb294('0x26')],'type':_0xbb4a10[_0xb294('0x27')][_0xb294('0x28')]};});_0x3c2aa5[_0xb294('0x29')]=_[_0xb294('0x2a')](_0x127ddd,_0xb294('0x23'));_0x3c2aa5[_0xb294('0x2b')]=_[_0xb294('0x2c')](_0x47fca9[_0xb294('0x2b')]);_0x3c2aa5[_0xb294('0x2d')]=_[_0xb294('0x2e')](_0x3c2aa5[_0xb294('0x29')],_0x3c2aa5['query']);_0x1167e5['attributes']=_[_0xb294('0x2e')](_0x3c2aa5['model'],qs[_0xb294('0x2f')](_0x47fca9[_0xb294('0x2b')][_0xb294('0x2f')]));_0x1167e5[_0xb294('0x30')]=_0x1167e5['attributes'][_0xb294('0x31')]?_0x1167e5[_0xb294('0x30')]:_0x3c2aa5[_0xb294('0x29')];if(!_0x47fca9[_0xb294('0x2b')][_0xb294('0x32')]('nolimit')){_0x1167e5['limit']=qs['limit'](_0x47fca9[_0xb294('0x2b')][_0xb294('0x1c')]);_0x1167e5[_0xb294('0x1a')]=qs[_0xb294('0x1a')](_0x47fca9[_0xb294('0x2b')][_0xb294('0x1a')]);}_0x1167e5[_0xb294('0x33')]=qs['sort'](_0x47fca9[_0xb294('0x2b')][_0xb294('0x34')]);_0x1167e5[_0xb294('0x35')]=qs[_0xb294('0x2d')](_[_0xb294('0x36')](_0x47fca9[_0xb294('0x2b')],_0x3c2aa5[_0xb294('0x2d')]),_0x127ddd);if(_0x47fca9[_0xb294('0x2b')]['filter']){_0x1167e5['where']=_[_0xb294('0x37')](_0x1167e5['where'],{'$or':_[_0xb294('0x2a')](_0x127ddd,function(_0x565546){if(_0x565546[_0xb294('0x27')]!==_0xb294('0x38')){var _0x2c92cb={};_0x2c92cb[_0x565546[_0xb294('0x23')]]={'$like':'%'+_0x47fca9[_0xb294('0x2b')]['filter']+'%'};return _0x2c92cb;}})});}_0x1167e5=_['merge']({},_0x1167e5,_0x47fca9[_0xb294('0x39')]);var _0x2693ec={'where':_0x1167e5[_0xb294('0x35')]};return db[_0xb294('0x3a')][_0xb294('0x1d')](_0x2693ec)[_0xb294('0x20')](function(_0x4ef87e){_0x1efdb6['count']=_0x4ef87e;if(_0x47fca9[_0xb294('0x2b')][_0xb294('0x3b')]){_0x1167e5[_0xb294('0x3c')]=[{'all':!![]}];}return db[_0xb294('0x3a')]['findAll'](_0x1167e5);})['then'](function(_0x1da557){_0x1efdb6['rows']=_0x1da557;return _0x1efdb6;})[_0xb294('0x20')](respondWithFilteredResult(_0x59fbde,_0x1167e5))[_0xb294('0x3d')](handleError(_0x59fbde,null));};exports['show']=function(_0x572e98,_0x4c1f43){var _0x20b1a2={'raw':!![],'where':{'id':_0x572e98[_0xb294('0x3e')]['id']}},_0x164556={};_0x164556['model']=_[_0xb294('0x2c')](db[_0xb294('0x3a')][_0xb294('0x3f')]);_0x164556[_0xb294('0x2b')]=_[_0xb294('0x2c')](_0x572e98[_0xb294('0x2b')]);_0x164556[_0xb294('0x2d')]=_['intersection'](_0x164556['model'],_0x164556[_0xb294('0x2b')]);_0x20b1a2[_0xb294('0x30')]=_['intersection'](_0x164556['model'],qs[_0xb294('0x2f')](_0x572e98[_0xb294('0x2b')][_0xb294('0x2f')]));_0x20b1a2[_0xb294('0x30')]=_0x20b1a2['attributes'][_0xb294('0x31')]?_0x20b1a2['attributes']:_0x164556['model'];if(_0x572e98[_0xb294('0x2b')][_0xb294('0x3b')]){_0x20b1a2[_0xb294('0x3c')]=[{'all':!![]}];}_0x20b1a2=_[_0xb294('0x37')]({},_0x20b1a2,_0x572e98[_0xb294('0x39')]);return db['JscriptyAnswerReport'][_0xb294('0x40')](_0x20b1a2)[_0xb294('0x20')](handleEntityNotFound(_0x4c1f43,null))[_0xb294('0x20')](respondWithResult(_0x4c1f43,null))['catch'](handleError(_0x4c1f43,null));};exports['create']=function(_0xce4f4,_0x3cdc29){return db[_0xb294('0x3a')][_0xb294('0x41')](_0xce4f4[_0xb294('0x42')],{})['then'](respondWithResult(_0x3cdc29,0xc9))[_0xb294('0x3d')](handleError(_0x3cdc29,null));};exports[_0xb294('0x43')]=function(_0x459a69,_0x3156e2){if(_0x459a69[_0xb294('0x42')]['id']){delete _0x459a69[_0xb294('0x42')]['id'];}return db[_0xb294('0x3a')][_0xb294('0x40')]({'where':{'id':_0x459a69[_0xb294('0x3e')]['id']}})[_0xb294('0x20')](handleEntityNotFound(_0x3156e2,null))['then'](saveUpdates(_0x459a69[_0xb294('0x42')],null))['then'](respondWithResult(_0x3156e2,null))[_0xb294('0x3d')](handleError(_0x3156e2,null));};exports[_0xb294('0x44')]=function(_0x249b59,_0xd64380){return db[_0xb294('0x3a')]['find']({'where':{'id':_0x249b59['params']['id']}})[_0xb294('0x20')](handleEntityNotFound(_0xd64380,null))[_0xb294('0x20')](removeEntity(_0xd64380,null))[_0xb294('0x3d')](handleError(_0xd64380,null));};exports[_0xb294('0x45')]=function(_0x5589c3,_0x10b068){return db[_0xb294('0x3a')][_0xb294('0x45')]()[_0xb294('0x20')](respondWithResult(_0x10b068,null))[_0xb294('0x3d')](handleError(_0x10b068,null));}; \ No newline at end of file +var _0x1d7e=['sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','JscriptyAnswerReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','rows','catch','show','params','keys','options','create','update','body','find','describe','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x55f9aa,_0x4ac90c){var _0x208f96=function(_0x42840a){while(--_0x42840a){_0x55f9aa['push'](_0x55f9aa['shift']());}};_0x208f96(++_0x4ac90c);}(_0x1d7e,0x7d));var _0xe1d7=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x1d7e[_0x487b0c];return _0x1adbdc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe1d7('0x0'));var zipdir=require(_0xe1d7('0x1'));var jsonpatch=require(_0xe1d7('0x2'));var rp=require('request-promise');var moment=require(_0xe1d7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe1d7('0x4'));var util=require(_0xe1d7('0x5'));var path=require(_0xe1d7('0x6'));var sox=require(_0xe1d7('0x7'));var csv=require(_0xe1d7('0x8'));var ejs=require(_0xe1d7('0x9'));var fs=require('fs');var fs_extra=require(_0xe1d7('0xa'));var _=require(_0xe1d7('0xb'));var squel=require(_0xe1d7('0xc'));var crypto=require(_0xe1d7('0xd'));var jsforce=require(_0xe1d7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe1d7('0x8'));var querystring=require(_0xe1d7('0xf'));var Papa=require('papaparse');var Redis=require(_0xe1d7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe1d7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe1d7('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xe1d7('0x13'));var config=require(_0xe1d7('0x14'));var licenseUtil=require(_0xe1d7('0x15'));var db=require(_0xe1d7('0x16'))['db'];function respondWithStatusCode(_0x207502,_0x455a7a){_0x455a7a=_0x455a7a||0xcc;return function(_0x445994){if(_0x445994){return _0x207502[_0xe1d7('0x17')](_0x455a7a);}return _0x207502['status'](_0x455a7a)[_0xe1d7('0x18')]();};}function respondWithResult(_0x247286,_0x156a3f){_0x156a3f=_0x156a3f||0xc8;return function(_0x3d3d8d){if(_0x3d3d8d){return _0x247286[_0xe1d7('0x19')](_0x156a3f)[_0xe1d7('0x1a')](_0x3d3d8d);}};}function respondWithFilteredResult(_0x3c1923,_0x565278){return function(_0x391f55){if(_0x391f55){var _0x328898=typeof _0x565278[_0xe1d7('0x1b')]==='undefined'&&typeof _0x565278[_0xe1d7('0x1c')]===_0xe1d7('0x1d');var _0x800c15=_0x391f55[_0xe1d7('0x1e')];var _0x1dc61f=_0x328898?0x0:_0x565278[_0xe1d7('0x1b')];var _0xdad949=_0x328898?_0x391f55[_0xe1d7('0x1e')]:_0x565278[_0xe1d7('0x1b')]+_0x565278[_0xe1d7('0x1c')];var _0x2035e7;if(_0xdad949>=_0x800c15){_0xdad949=_0x800c15;_0x2035e7=0xc8;}else{_0x2035e7=0xce;}_0x3c1923[_0xe1d7('0x19')](_0x2035e7);return _0x3c1923['set'](_0xe1d7('0x1f'),_0x1dc61f+'-'+_0xdad949+'/'+_0x800c15)[_0xe1d7('0x1a')](_0x391f55);}return null;};}function patchUpdates(_0x1e9a1e){return function(_0x3e25e8){try{jsonpatch[_0xe1d7('0x20')](_0x3e25e8,_0x1e9a1e,!![]);}catch(_0x5f2053){return BPromise[_0xe1d7('0x21')](_0x5f2053);}return _0x3e25e8[_0xe1d7('0x22')]();};}function saveUpdates(_0x111e52,_0x13867a){return function(_0x33ac20){if(_0x33ac20){return _0x33ac20['update'](_0x111e52)[_0xe1d7('0x23')](function(_0x370c92){return _0x370c92;});}return null;};}function removeEntity(_0x2572ec,_0x3bc5c1){return function(_0x25e3c9){if(_0x25e3c9){return _0x25e3c9[_0xe1d7('0x24')]()[_0xe1d7('0x23')](function(){_0x2572ec[_0xe1d7('0x19')](0xcc)[_0xe1d7('0x18')]();});}};}function handleEntityNotFound(_0x2e47f7,_0x55446d){return function(_0x672bed){if(!_0x672bed){_0x2e47f7[_0xe1d7('0x17')](0x194);}return _0x672bed;};}function handleError(_0x3abcb3,_0x4fea12){_0x4fea12=_0x4fea12||0x1f4;return function(_0x11dde2){logger[_0xe1d7('0x25')](_0x11dde2[_0xe1d7('0x26')]);if(_0x11dde2[_0xe1d7('0x27')]){delete _0x11dde2[_0xe1d7('0x27')];}_0x3abcb3[_0xe1d7('0x19')](_0x4fea12)[_0xe1d7('0x28')](_0x11dde2);};}exports['index']=function(_0x3e8ca3,_0x4a3344){var _0xbc38f3={},_0x264481={},_0x48d17e={'count':0x0,'rows':[]};var _0x565f3a=_[_0xe1d7('0x29')](db[_0xe1d7('0x2a')][_0xe1d7('0x2b')],function(_0x329506){return{'name':_0x329506[_0xe1d7('0x2c')],'type':_0x329506['type'][_0xe1d7('0x2d')]};});_0x264481[_0xe1d7('0x2e')]=_[_0xe1d7('0x29')](_0x565f3a,_0xe1d7('0x27'));_0x264481[_0xe1d7('0x2f')]=_['keys'](_0x3e8ca3[_0xe1d7('0x2f')]);_0x264481[_0xe1d7('0x30')]=_[_0xe1d7('0x31')](_0x264481[_0xe1d7('0x2e')],_0x264481[_0xe1d7('0x2f')]);_0xbc38f3[_0xe1d7('0x32')]=_[_0xe1d7('0x31')](_0x264481[_0xe1d7('0x2e')],qs['fields'](_0x3e8ca3[_0xe1d7('0x2f')][_0xe1d7('0x33')]));_0xbc38f3[_0xe1d7('0x32')]=_0xbc38f3['attributes'][_0xe1d7('0x34')]?_0xbc38f3[_0xe1d7('0x32')]:_0x264481[_0xe1d7('0x2e')];if(!_0x3e8ca3[_0xe1d7('0x2f')][_0xe1d7('0x35')](_0xe1d7('0x36'))){_0xbc38f3['limit']=qs[_0xe1d7('0x1c')](_0x3e8ca3[_0xe1d7('0x2f')][_0xe1d7('0x1c')]);_0xbc38f3[_0xe1d7('0x1b')]=qs[_0xe1d7('0x1b')](_0x3e8ca3[_0xe1d7('0x2f')]['offset']);}_0xbc38f3[_0xe1d7('0x37')]=qs[_0xe1d7('0x38')](_0x3e8ca3[_0xe1d7('0x2f')]['sort']);_0xbc38f3[_0xe1d7('0x39')]=qs[_0xe1d7('0x30')](_[_0xe1d7('0x3a')](_0x3e8ca3['query'],_0x264481[_0xe1d7('0x30')]),_0x565f3a);if(_0x3e8ca3['query'][_0xe1d7('0x3b')]){_0xbc38f3[_0xe1d7('0x39')]=_['merge'](_0xbc38f3[_0xe1d7('0x39')],{'$or':_[_0xe1d7('0x29')](_0x565f3a,function(_0x412688){if(_0x412688['type']!==_0xe1d7('0x3c')){var _0xcf5b78={};_0xcf5b78[_0x412688['name']]={'$like':'%'+_0x3e8ca3[_0xe1d7('0x2f')]['filter']+'%'};return _0xcf5b78;}})});}_0xbc38f3=_[_0xe1d7('0x3d')]({},_0xbc38f3,_0x3e8ca3['options']);var _0x637d0e={'where':_0xbc38f3[_0xe1d7('0x39')]};return db[_0xe1d7('0x2a')][_0xe1d7('0x1e')](_0x637d0e)[_0xe1d7('0x23')](function(_0x285cc8){_0x48d17e[_0xe1d7('0x1e')]=_0x285cc8;if(_0x3e8ca3[_0xe1d7('0x2f')][_0xe1d7('0x3e')]){_0xbc38f3['include']=[{'all':!![]}];}return db[_0xe1d7('0x2a')]['findAll'](_0xbc38f3);})[_0xe1d7('0x23')](function(_0xf92029){_0x48d17e[_0xe1d7('0x3f')]=_0xf92029;return _0x48d17e;})[_0xe1d7('0x23')](respondWithFilteredResult(_0x4a3344,_0xbc38f3))[_0xe1d7('0x40')](handleError(_0x4a3344,null));};exports[_0xe1d7('0x41')]=function(_0x12eeb1,_0x5c9bb3){var _0x26d1b0={'raw':!![],'where':{'id':_0x12eeb1[_0xe1d7('0x42')]['id']}},_0x2841ce={};_0x2841ce[_0xe1d7('0x2e')]=_[_0xe1d7('0x43')](db[_0xe1d7('0x2a')]['rawAttributes']);_0x2841ce[_0xe1d7('0x2f')]=_[_0xe1d7('0x43')](_0x12eeb1[_0xe1d7('0x2f')]);_0x2841ce['filters']=_[_0xe1d7('0x31')](_0x2841ce[_0xe1d7('0x2e')],_0x2841ce[_0xe1d7('0x2f')]);_0x26d1b0[_0xe1d7('0x32')]=_[_0xe1d7('0x31')](_0x2841ce['model'],qs[_0xe1d7('0x33')](_0x12eeb1[_0xe1d7('0x2f')][_0xe1d7('0x33')]));_0x26d1b0[_0xe1d7('0x32')]=_0x26d1b0[_0xe1d7('0x32')][_0xe1d7('0x34')]?_0x26d1b0[_0xe1d7('0x32')]:_0x2841ce[_0xe1d7('0x2e')];if(_0x12eeb1[_0xe1d7('0x2f')][_0xe1d7('0x3e')]){_0x26d1b0['include']=[{'all':!![]}];}_0x26d1b0=_[_0xe1d7('0x3d')]({},_0x26d1b0,_0x12eeb1[_0xe1d7('0x44')]);return db[_0xe1d7('0x2a')]['find'](_0x26d1b0)['then'](handleEntityNotFound(_0x5c9bb3,null))[_0xe1d7('0x23')](respondWithResult(_0x5c9bb3,null))[_0xe1d7('0x40')](handleError(_0x5c9bb3,null));};exports[_0xe1d7('0x45')]=function(_0x3310fe,_0x21ac67){return db['JscriptyAnswerReport'][_0xe1d7('0x45')](_0x3310fe['body'],{})[_0xe1d7('0x23')](respondWithResult(_0x21ac67,0xc9))[_0xe1d7('0x40')](handleError(_0x21ac67,null));};exports[_0xe1d7('0x46')]=function(_0x32e4a3,_0xd48848){if(_0x32e4a3['body']['id']){delete _0x32e4a3[_0xe1d7('0x47')]['id'];}return db[_0xe1d7('0x2a')][_0xe1d7('0x48')]({'where':{'id':_0x32e4a3['params']['id']}})[_0xe1d7('0x23')](handleEntityNotFound(_0xd48848,null))[_0xe1d7('0x23')](saveUpdates(_0x32e4a3[_0xe1d7('0x47')],null))['then'](respondWithResult(_0xd48848,null))[_0xe1d7('0x40')](handleError(_0xd48848,null));};exports['destroy']=function(_0x3bbbb0,_0x2b53e1){return db[_0xe1d7('0x2a')]['find']({'where':{'id':_0x3bbbb0['params']['id']}})[_0xe1d7('0x23')](handleEntityNotFound(_0x2b53e1,null))[_0xe1d7('0x23')](removeEntity(_0x2b53e1,null))[_0xe1d7('0x40')](handleError(_0x2b53e1,null));};exports[_0xe1d7('0x49')]=function(_0x51184f,_0x166ffd){return db[_0xe1d7('0x2a')][_0xe1d7('0x49')]()[_0xe1d7('0x23')](respondWithResult(_0x166ffd,null))['catch'](handleError(_0x166ffd,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 96324d5..54e6e53 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 _0x7b50=['report_jscripty_answers','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport'];(function(_0x284190,_0x13ed15){var _0x2ee544=function(_0x4bd36a){while(--_0x4bd36a){_0x284190['push'](_0x284190['shift']());}};_0x2ee544(++_0x13ed15);}(_0x7b50,0x151));var _0x07b5=function(_0x2ed7c2,_0x17d15b){_0x2ed7c2=_0x2ed7c2-0x0;var _0x3dc111=_0x7b50[_0x2ed7c2];return _0x3dc111;};'use strict';var _=require(_0x07b5('0x0'));var util=require(_0x07b5('0x1'));var logger=require(_0x07b5('0x2'))(_0x07b5('0x3'));var moment=require(_0x07b5('0x4'));var BPromise=require(_0x07b5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x07b5('0x6'));var config=require(_0x07b5('0x7'));var attributes=require(_0x07b5('0x8'));module[_0x07b5('0x9')]=function(_0x3f9422,_0x28b7b5){return _0x3f9422['define'](_0x07b5('0xa'),attributes,{'tableName':_0x07b5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb70e=['exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','path','./jscriptyAnswerReport.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb70e,0x1ee));var _0xeb70=function(_0x6b225c,_0x4e2da1){_0x6b225c=_0x6b225c-0x0;var _0x13ab9c=_0xb70e[_0x6b225c];return _0x13ab9c;};'use strict';var _=require(_0xeb70('0x0'));var util=require(_0xeb70('0x1'));var logger=require(_0xeb70('0x2'))(_0xeb70('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeb70('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xeb70('0x5'));module[_0xeb70('0x6')]=function(_0x5ac807,_0x55cfa9){return _0x5ac807[_0xeb70('0x7')](_0xeb70('0x8'),attributes,{'tableName':_0xeb70('0x9'),'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 039d606..f317cd7 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 _0x721b=['stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x721b,0x18d));var _0xb721=function(_0x4a070c,_0x55d6d5){_0x4a070c=_0x4a070c-0x0;var _0x169426=_0x721b[_0x4a070c];return _0x169426;};'use strict';var _=require(_0xb721('0x0'));var util=require('util');var moment=require(_0xb721('0x1'));var BPromise=require(_0xb721('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb721('0x3'));var db=require(_0xb721('0x4'))['db'];var utils=require(_0xb721('0x5'));var logger=require(_0xb721('0x6'))(_0xb721('0x7'));var config=require(_0xb721('0x8'));var jayson=require(_0xb721('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d064c,_0x2e8463,_0x31134d){return new BPromise(function(_0x5ee34a,_0x215a9d){return client[_0xb721('0xa')](_0x1d064c,_0x31134d)[_0xb721('0xb')](function(_0x4f468b){logger[_0xb721('0xc')](_0xb721('0xd'),_0x2e8463,_0xb721('0xe'));logger[_0xb721('0xf')](_0xb721('0x10'),_0x2e8463,_0xb721('0xe'),JSON[_0xb721('0x11')](_0x4f468b));if(_0x4f468b[_0xb721('0x12')]){if(_0x4f468b[_0xb721('0x12')][_0xb721('0x13')]===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x2e8463,_0x4f468b[_0xb721('0x12')][_0xb721('0x14')]);return _0x215a9d(_0x4f468b['error'][_0xb721('0x14')]);}logger['error'](_0xb721('0xd'),_0x2e8463,_0x4f468b[_0xb721('0x12')][_0xb721('0x14')]);return _0x5ee34a(_0x4f468b[_0xb721('0x12')][_0xb721('0x14')]);}else{logger['info'](_0xb721('0xd'),_0x2e8463,_0xb721('0xe'));_0x5ee34a(_0x4f468b[_0xb721('0x15')][_0xb721('0x14')]);}})[_0xb721('0x16')](function(_0xdb60f3){logger[_0xb721('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2e8463,_0xdb60f3);_0x215a9d(_0xdb60f3);});});} \ No newline at end of file +var _0x3e13=['jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x43ab62,_0x3b79a6){var _0x393905=function(_0x378129){while(--_0x378129){_0x43ab62['push'](_0x43ab62['shift']());}};_0x393905(++_0x3b79a6);}(_0x3e13,0x15f));var _0x33e1=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x3e13[_0x44bcb0];return _0xfaf881;};'use strict';var _=require('lodash');var util=require(_0x33e1('0x0'));var moment=require(_0x33e1('0x1'));var BPromise=require('bluebird');var rs=require(_0x33e1('0x2'));var fs=require('fs');var Redis=require(_0x33e1('0x3'));var db=require(_0x33e1('0x4'))['db'];var utils=require(_0x33e1('0x5'));var logger=require(_0x33e1('0x6'))(_0x33e1('0x7'));var config=require(_0x33e1('0x8'));var jayson=require(_0x33e1('0x9'));var client=jayson[_0x33e1('0xa')][_0x33e1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c786e,_0x499040,_0x39e903){return new BPromise(function(_0x1dbb36,_0x14c49f){return client[_0x33e1('0xc')](_0x2c786e,_0x39e903)[_0x33e1('0xd')](function(_0x365a9d){logger[_0x33e1('0xe')](_0x33e1('0xf'),_0x499040,_0x33e1('0x10'));logger[_0x33e1('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x499040,_0x33e1('0x10'),JSON[_0x33e1('0x12')](_0x365a9d));if(_0x365a9d[_0x33e1('0x13')]){if(_0x365a9d[_0x33e1('0x13')][_0x33e1('0x14')]===0x1f4){logger[_0x33e1('0x13')](_0x33e1('0xf'),_0x499040,_0x365a9d[_0x33e1('0x13')][_0x33e1('0x15')]);return _0x14c49f(_0x365a9d[_0x33e1('0x13')]['message']);}logger['error'](_0x33e1('0xf'),_0x499040,_0x365a9d[_0x33e1('0x13')][_0x33e1('0x15')]);return _0x1dbb36(_0x365a9d[_0x33e1('0x13')][_0x33e1('0x15')]);}else{logger['info'](_0x33e1('0xf'),_0x499040,_0x33e1('0x10'));_0x1dbb36(_0x365a9d[_0x33e1('0x16')][_0x33e1('0x15')]);}})[_0x33e1('0x17')](function(_0x4bde00){logger[_0x33e1('0x13')](_0x33e1('0xf'),_0x499040,_0x4bde00);_0x14c49f(_0x4bde00);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 50a7d59..adc4e56 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 _0xb285=['getSessions','/:id/summary','post','create','clone','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../config/environment','./jscriptyProject.controller','index','get','isAuthenticated','show','/:id/sessions'];(function(_0xf5535c,_0x53e0f6){var _0x5b28d8=function(_0x444569){while(--_0x444569){_0xf5535c['push'](_0xf5535c['shift']());}};_0x5b28d8(++_0x53e0f6);}(_0xb285,0xe6));var _0x5b28=function(_0x59bcb1,_0x5a4b6c){_0x59bcb1=_0x59bcb1-0x0;var _0x4a737f=_0xb285[_0x59bcb1];return _0x4a737f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5b28('0x0'));var timeout=require(_0x5b28('0x1'));var express=require(_0x5b28('0x2'));var router=express[_0x5b28('0x3')]();var fs_extra=require(_0x5b28('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5b28('0x5'));var controller=require(_0x5b28('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x5b28('0x7')]);router[_0x5b28('0x8')]('/:id',auth[_0x5b28('0x9')](),controller[_0x5b28('0xa')]);router[_0x5b28('0x8')](_0x5b28('0xb'),auth[_0x5b28('0x9')](),controller[_0x5b28('0xc')]);router[_0x5b28('0x8')]('/:id/answers',auth[_0x5b28('0x9')](),controller['getAnswers']);router[_0x5b28('0x8')](_0x5b28('0xd'),auth[_0x5b28('0x9')](),timeout('30s'),controller['getSummary']);router[_0x5b28('0xe')]('/',auth[_0x5b28('0x9')](),controller[_0x5b28('0xf')]);router[_0x5b28('0xe')]('/:id/clone',auth[_0x5b28('0x9')](),controller[_0x5b28('0x10')]);router['put'](_0x5b28('0x11'),auth[_0x5b28('0x9')](),controller[_0x5b28('0x12')]);router[_0x5b28('0x13')](_0x5b28('0x11'),auth['isAuthenticated'](),controller[_0x5b28('0x14')]);module[_0x5b28('0x15')]=router; \ No newline at end of file +var _0x0177=['/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','clone','put','/:id','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','index','isAuthenticated','/:id/sessions','getSessions'];(function(_0x3f7ed5,_0x2356d8){var _0x3b54a2=function(_0x5c094f){while(--_0x5c094f){_0x3f7ed5['push'](_0x3f7ed5['shift']());}};_0x3b54a2(++_0x2356d8);}(_0x0177,0x110));var _0x7017=function(_0x396f51,_0x5929c5){_0x396f51=_0x396f51-0x0;var _0x4e2da9=_0x0177[_0x396f51];return _0x4e2da9;};'use strict';var multer=require('multer');var util=require(_0x7017('0x0'));var path=require(_0x7017('0x1'));var timeout=require(_0x7017('0x2'));var express=require(_0x7017('0x3'));var router=express[_0x7017('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7017('0x5'));var interaction=require(_0x7017('0x6'));var config=require(_0x7017('0x7'));var controller=require(_0x7017('0x8'));router[_0x7017('0x9')]('/',auth['isAuthenticated'](),controller[_0x7017('0xa')]);router[_0x7017('0x9')]('/:id',auth[_0x7017('0xb')](),controller['show']);router[_0x7017('0x9')](_0x7017('0xc'),auth[_0x7017('0xb')](),controller[_0x7017('0xd')]);router[_0x7017('0x9')](_0x7017('0xe'),auth[_0x7017('0xb')](),controller[_0x7017('0xf')]);router[_0x7017('0x9')](_0x7017('0x10'),auth[_0x7017('0xb')](),timeout(_0x7017('0x11')),controller[_0x7017('0x12')]);router[_0x7017('0x13')]('/',auth[_0x7017('0xb')](),controller['create']);router['post']('/:id/clone',auth['isAuthenticated'](),controller[_0x7017('0x14')]);router[_0x7017('0x15')](_0x7017('0x16'),auth[_0x7017('0xb')](),controller[_0x7017('0x17')]);router['delete'](_0x7017('0x16'),auth['isAuthenticated'](),controller[_0x7017('0x18')]);module[_0x7017('0x19')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 98bdde4..f0d0c97 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 _0xf572=['formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','lodash','util','exports','STRING','name','long','isObjectLike','setDataValue'];(function(_0x52a1c3,_0x2e34a0){var _0x43c896=function(_0x2fc232){while(--_0x2fc232){_0x52a1c3['push'](_0x52a1c3['shift']());}};_0x43c896(++_0x2e34a0);}(_0xf572,0x1b7));var _0x2f57=function(_0x4d78b4,_0x591ac0){_0x4d78b4=_0x4d78b4-0x0;var _0x1316f2=_0xf572[_0x4d78b4];return _0x1316f2;};'use strict';var Sequelize=require(_0x2f57('0x0'));var _=require(_0x2f57('0x1'));var util=require(_0x2f57('0x2'));module[_0x2f57('0x3')]={'name':{'type':Sequelize[_0x2f57('0x4')],'unique':_0x2f57('0x5')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0x2f57('0x6')),'set':function(_0x31b420){if(_[_0x2f57('0x7')](_0x31b420)){this[_0x2f57('0x8')](_0x2f57('0x9'),JSON[_0x2f57('0xa')](_0x31b420));}else if(_[_0x2f57('0xb')](_0x31b420)){this[_0x2f57('0x8')](_0x2f57('0x9'),_0x31b420);}else{this[_0x2f57('0x8')](_0x2f57('0x9'),util[_0x2f57('0xc')](_0x2f57('0xd'),this[_0x2f57('0xe')](_0x2f57('0x5'))||'',this[_0x2f57('0xe')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x2f57('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x2f57('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0x9b65=['TEXT','long','isObjectLike','setDataValue','formData','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','lodash','util','exports','STRING','name'];(function(_0x32c304,_0x3268e2){var _0x49e957=function(_0xa67b4c){while(--_0xa67b4c){_0x32c304['push'](_0x32c304['shift']());}};_0x49e957(++_0x3268e2);}(_0x9b65,0xbe));var _0x59b6=function(_0x1cc4d9,_0x15074a){_0x1cc4d9=_0x1cc4d9-0x0;var _0x559e03=_0x9b65[_0x1cc4d9];return _0x559e03;};'use strict';var Sequelize=require('sequelize');var _=require(_0x59b6('0x0'));var util=require(_0x59b6('0x1'));module[_0x59b6('0x2')]={'name':{'type':Sequelize[_0x59b6('0x3')],'unique':_0x59b6('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x59b6('0x5')](_0x59b6('0x6')),'set':function(_0x579faf){if(_[_0x59b6('0x7')](_0x579faf)){this[_0x59b6('0x8')](_0x59b6('0x9'),JSON['stringify'](_0x579faf));}else if(_[_0x59b6('0xa')](_0x579faf)){this[_0x59b6('0x8')](_0x59b6('0x9'),_0x579faf);}else{this[_0x59b6('0x8')](_0x59b6('0x9'),util['format'](_0x59b6('0xb'),this[_0x59b6('0xc')](_0x59b6('0x4'))||'',this[_0x59b6('0xc')](_0x59b6('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x59b6('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index d8a3d07..62b0ec2 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 _0xfc61=['download','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','Projects','UserProfileResource','sendStatus','error','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','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','length','includeAll','omit','createdAt','updatedAt','body','findOne','JscriptySessionReport','ProjectId','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','startTime','parse','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv'];(function(_0x18fbaa,_0x26e6bd){var _0x30688e=function(_0x5da6a4){while(--_0x5da6a4){_0x18fbaa['push'](_0x18fbaa['shift']());}};_0x30688e(++_0x26e6bd);}(_0xfc61,0x78));var _0x1fc6=function(_0x4dbc10,_0x3abbf3){_0x4dbc10=_0x4dbc10-0x0;var _0x511d83=_0xfc61[_0x4dbc10];return _0x511d83;};'use strict';var emlformat=require(_0x1fc6('0x0'));var rimraf=require(_0x1fc6('0x1'));var zipdir=require(_0x1fc6('0x2'));var jsonpatch=require(_0x1fc6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1fc6('0x4'));var util=require(_0x1fc6('0x5'));var path=require(_0x1fc6('0x6'));var sox=require(_0x1fc6('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1fc6('0x8'));var _=require(_0x1fc6('0x9'));var squel=require(_0x1fc6('0xa'));var crypto=require(_0x1fc6('0xb'));var jsforce=require(_0x1fc6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1fc6('0xd'));var querystring=require(_0x1fc6('0xe'));var Papa=require(_0x1fc6('0xf'));var Redis=require(_0x1fc6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1fc6('0x11'));var as=require(_0x1fc6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1fc6('0x13'))(_0x1fc6('0x14'));var utils=require(_0x1fc6('0x15'));var config=require(_0x1fc6('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a1b5b,_0x475b16){_0x475b16=_0x475b16||0xcc;return function(_0xa08740){if(_0xa08740){return _0x2a1b5b['sendStatus'](_0x475b16);}return _0x2a1b5b['status'](_0x475b16)[_0x1fc6('0x17')]();};}function respondWithResult(_0x55da92,_0x2833ef){_0x2833ef=_0x2833ef||0xc8;return function(_0x35ecb5){if(_0x35ecb5){return _0x55da92[_0x1fc6('0x18')](_0x2833ef)[_0x1fc6('0x19')](_0x35ecb5);}};}function respondWithFilteredResult(_0x2bcb91,_0x624be2){return function(_0x324fa7){if(_0x324fa7){var _0x141d3e=typeof _0x624be2['offset']===_0x1fc6('0x1a')&&typeof _0x624be2[_0x1fc6('0x1b')]===_0x1fc6('0x1a');var _0xcde85e=_0x324fa7[_0x1fc6('0x1c')];var _0x2b0294=_0x141d3e?0x0:_0x624be2[_0x1fc6('0x1d')];var _0x5f3b49=_0x141d3e?_0x324fa7[_0x1fc6('0x1c')]:_0x624be2[_0x1fc6('0x1d')]+_0x624be2[_0x1fc6('0x1b')];var _0x3d4fd8;if(_0x5f3b49>=_0xcde85e){_0x5f3b49=_0xcde85e;_0x3d4fd8=0xc8;}else{_0x3d4fd8=0xce;}_0x2bcb91[_0x1fc6('0x18')](_0x3d4fd8);return _0x2bcb91[_0x1fc6('0x1e')](_0x1fc6('0x1f'),_0x2b0294+'-'+_0x5f3b49+'/'+_0xcde85e)['json'](_0x324fa7);}return null;};}function patchUpdates(_0x56a853){return function(_0x53b17d){try{jsonpatch[_0x1fc6('0x20')](_0x53b17d,_0x56a853,!![]);}catch(_0x3ae4a3){return BPromise['reject'](_0x3ae4a3);}return _0x53b17d[_0x1fc6('0x21')]();};}function saveUpdates(_0x2b7acb,_0x2d0fe0){return function(_0x38a792){if(_0x38a792){return _0x38a792[_0x1fc6('0x22')](_0x2b7acb)[_0x1fc6('0x23')](function(_0x1209a4){return _0x1209a4;});}return null;};}function removeEntity(_0x3fc788,_0x891eba){return function(_0xc6965f){if(_0xc6965f){return _0xc6965f[_0x1fc6('0x24')]()[_0x1fc6('0x23')](function(){var _0x358d3a=_0xc6965f['get']({'plain':!![]});var _0x2975ca=_0x1fc6('0x25');return db[_0x1fc6('0x26')][_0x1fc6('0x24')]({'where':{'type':_0x2975ca,'resourceId':_0x358d3a['id']}})[_0x1fc6('0x23')](function(){return _0xc6965f;});})[_0x1fc6('0x23')](function(){_0x3fc788[_0x1fc6('0x18')](0xcc)[_0x1fc6('0x17')]();});}};}function handleEntityNotFound(_0x343b89,_0x3de90e){return function(_0x1dc319){if(!_0x1dc319){_0x343b89[_0x1fc6('0x27')](0x194);}return _0x1dc319;};}function handleError(_0x2be9f8,_0xeda672){_0xeda672=_0xeda672||0x1f4;return function(_0x481c38){logger[_0x1fc6('0x28')](_0x481c38[_0x1fc6('0x29')]);if(_0x481c38[_0x1fc6('0x2a')]){delete _0x481c38['name'];}_0x2be9f8[_0x1fc6('0x18')](_0xeda672)[_0x1fc6('0x2b')](_0x481c38);};}exports[_0x1fc6('0x2c')]=function(_0x730883,_0x1ff069){var _0x41886c={},_0x39612c={},_0x37cc93={'count':0x0,'rows':[]};var _0x56720a=_[_0x1fc6('0x2d')](db[_0x1fc6('0x2e')][_0x1fc6('0x2f')],function(_0x45ec08){return{'name':_0x45ec08[_0x1fc6('0x30')],'type':_0x45ec08[_0x1fc6('0x31')][_0x1fc6('0x32')]};});_0x39612c['model']=_[_0x1fc6('0x2d')](_0x56720a,_0x1fc6('0x2a'));_0x39612c[_0x1fc6('0x33')]=_[_0x1fc6('0x34')](_0x730883[_0x1fc6('0x33')]);_0x39612c['filters']=_['intersection'](_0x39612c[_0x1fc6('0x35')],_0x39612c[_0x1fc6('0x33')]);_0x41886c[_0x1fc6('0x36')]=_[_0x1fc6('0x37')](_0x39612c['model'],qs[_0x1fc6('0x38')](_0x730883[_0x1fc6('0x33')][_0x1fc6('0x38')]));_0x41886c[_0x1fc6('0x36')]=_0x41886c[_0x1fc6('0x36')]['length']?_0x41886c[_0x1fc6('0x36')]:_0x39612c[_0x1fc6('0x35')];if(!_0x730883[_0x1fc6('0x33')][_0x1fc6('0x39')](_0x1fc6('0x3a'))){_0x41886c[_0x1fc6('0x1b')]=qs[_0x1fc6('0x1b')](_0x730883[_0x1fc6('0x33')][_0x1fc6('0x1b')]);_0x41886c[_0x1fc6('0x1d')]=qs[_0x1fc6('0x1d')](_0x730883[_0x1fc6('0x33')][_0x1fc6('0x1d')]);}_0x41886c[_0x1fc6('0x3b')]=qs[_0x1fc6('0x3c')](_0x730883[_0x1fc6('0x33')][_0x1fc6('0x3c')]);_0x41886c[_0x1fc6('0x3d')]=qs[_0x1fc6('0x3e')](_['pick'](_0x730883[_0x1fc6('0x33')],_0x39612c[_0x1fc6('0x3e')]),_0x56720a);if(_0x730883[_0x1fc6('0x33')][_0x1fc6('0x3f')]){_0x41886c['where']=_[_0x1fc6('0x40')](_0x41886c[_0x1fc6('0x3d')],{'$or':_[_0x1fc6('0x2d')](_0x56720a,function(_0x374b51){if(_0x374b51[_0x1fc6('0x31')]!==_0x1fc6('0x41')){var _0x51dc5b={};_0x51dc5b[_0x374b51[_0x1fc6('0x2a')]]={'$like':'%'+_0x730883['query'][_0x1fc6('0x3f')]+'%'};return _0x51dc5b;}})});}_0x41886c=_[_0x1fc6('0x40')]({},_0x41886c,_0x730883[_0x1fc6('0x42')]);var _0x22ca27={'where':_0x41886c[_0x1fc6('0x3d')]};return db['JscriptyProject'][_0x1fc6('0x1c')](_0x22ca27)[_0x1fc6('0x23')](function(_0x29e2be){_0x37cc93[_0x1fc6('0x1c')]=_0x29e2be;if(_0x730883[_0x1fc6('0x33')]['includeAll']){_0x41886c[_0x1fc6('0x43')]=[{'all':!![]}];}return db[_0x1fc6('0x2e')][_0x1fc6('0x44')](_0x41886c);})[_0x1fc6('0x23')](function(_0x49f335){_0x37cc93[_0x1fc6('0x45')]=_0x49f335;return _0x37cc93;})[_0x1fc6('0x23')](respondWithFilteredResult(_0x1ff069,_0x41886c))[_0x1fc6('0x46')](handleError(_0x1ff069,null));};exports[_0x1fc6('0x47')]=function(_0x4248d8,_0x44ab2b){var _0x13e630={'raw':![],'where':{'id':_0x4248d8[_0x1fc6('0x48')]['id']}},_0x18db1a={};_0x18db1a[_0x1fc6('0x35')]=_[_0x1fc6('0x34')](db['JscriptyProject'][_0x1fc6('0x2f')]);_0x18db1a[_0x1fc6('0x33')]=_[_0x1fc6('0x34')](_0x4248d8[_0x1fc6('0x33')]);_0x18db1a['filters']=_['intersection'](_0x18db1a[_0x1fc6('0x35')],_0x18db1a[_0x1fc6('0x33')]);_0x13e630[_0x1fc6('0x36')]=_[_0x1fc6('0x37')](_0x18db1a['model'],qs['fields'](_0x4248d8[_0x1fc6('0x33')]['fields']));_0x13e630[_0x1fc6('0x36')]=_0x13e630[_0x1fc6('0x36')]['length']?_0x13e630[_0x1fc6('0x36')]:_0x18db1a[_0x1fc6('0x35')];if(_0x4248d8['query']['includeAll']){_0x13e630[_0x1fc6('0x43')]=[{'all':!![]}];}_0x13e630=_['merge']({},_0x13e630,_0x4248d8['options']);return db[_0x1fc6('0x2e')][_0x1fc6('0x49')](_0x13e630)[_0x1fc6('0x23')](handleEntityNotFound(_0x44ab2b,null))[_0x1fc6('0x23')](respondWithResult(_0x44ab2b,null))['catch'](handleError(_0x44ab2b,null));};exports[_0x1fc6('0x4a')]=function(_0xa849a4,_0x48062c){return db['JscriptyProject'][_0x1fc6('0x4a')](_0xa849a4['body'],{})[_0x1fc6('0x23')](function(_0x28af6f){var _0x4ed3ae=_0xa849a4[_0x1fc6('0x4b')][_0x1fc6('0x4c')]({'plain':!![]});if(!_0x4ed3ae)throw new Error(_0x1fc6('0x4d'));if(_0x4ed3ae[_0x1fc6('0x4e')]==='user'){var _0x45a8fc=_0x28af6f['get']({'plain':!![]});var _0x7a66ba='Projects';return db[_0x1fc6('0x4f')][_0x1fc6('0x49')]({'where':{'name':_0x7a66ba,'userProfileId':_0x4ed3ae[_0x1fc6('0x50')]},'raw':!![]})['then'](function(_0x214ee3){if(_0x214ee3&&_0x214ee3[_0x1fc6('0x51')]===0x0){return db[_0x1fc6('0x26')]['create']({'name':_0x45a8fc[_0x1fc6('0x2a')],'resourceId':_0x45a8fc['id'],'type':_0x214ee3['name'],'sectionId':_0x214ee3['id']},{})[_0x1fc6('0x23')](function(){return _0x28af6f;});}else{return _0x28af6f;}})['catch'](function(_0x5790a9){logger[_0x1fc6('0x28')](_0x1fc6('0x52'),_0x5790a9);throw _0x5790a9;});}return _0x28af6f;})['then'](respondWithResult(_0x48062c,0xc9))['catch'](handleError(_0x48062c,null));};exports['clone']=function(_0x2f203c,_0x2478fd){var _0x331634={'where':{'id':_0x2f203c[_0x1fc6('0x48')]['id']}},_0x28f058={};_0x28f058[_0x1fc6('0x35')]=_[_0x1fc6('0x34')](db[_0x1fc6('0x2e')][_0x1fc6('0x2f')]);_0x331634[_0x1fc6('0x36')]=_[_0x1fc6('0x37')](_0x28f058['model'],qs[_0x1fc6('0x38')](_0x2f203c[_0x1fc6('0x33')][_0x1fc6('0x38')]));_0x331634[_0x1fc6('0x36')]=_0x331634[_0x1fc6('0x36')][_0x1fc6('0x53')]?_0x331634[_0x1fc6('0x36')]:_0x28f058[_0x1fc6('0x35')];if(_0x2f203c[_0x1fc6('0x33')][_0x1fc6('0x54')]){_0x331634[_0x1fc6('0x43')]=[{'all':!![]}];}_0x331634=_[_0x1fc6('0x40')]({},_0x331634,_0x2f203c['options']);return db[_0x1fc6('0x2e')][_0x1fc6('0x49')](_0x331634)[_0x1fc6('0x23')](handleEntityNotFound(_0x2478fd,null))[_0x1fc6('0x23')](function(_0x4b5f29){if(_0x4b5f29){var _0x403a7b=_0x4b5f29[_0x1fc6('0x4c')]({'plain':!![]});_0x403a7b=qs[_0x1fc6('0x55')](_0x403a7b,['id',_0x1fc6('0x56'),_0x1fc6('0x57')]);_0x2f203c[_0x1fc6('0x58')]=_['omit'](_0x2f203c[_0x1fc6('0x58')],['id','createdAt',_0x1fc6('0x57')]);return db[_0x1fc6('0x2e')][_0x1fc6('0x4a')](_[_0x1fc6('0x40')](_0x403a7b,_0x2f203c[_0x1fc6('0x58')]),{'include':_0x2f203c[_0x1fc6('0x33')]['includeAll']?[{'all':!![]}]:undefined})[_0x1fc6('0x23')](function(_0x706f1f){var _0x33b08c=_0x2f203c[_0x1fc6('0x4b')][_0x1fc6('0x4c')]({'plain':!![]});if(!_0x33b08c)throw new Error(_0x1fc6('0x4d'));if(_0x33b08c[_0x1fc6('0x4e')]===_0x1fc6('0x4b')){var _0x40349b=_0x706f1f[_0x1fc6('0x4c')]({'plain':!![]});var _0x229338=_0x1fc6('0x25');return db['UserProfileSection'][_0x1fc6('0x49')]({'where':{'name':_0x229338,'userProfileId':_0x33b08c[_0x1fc6('0x50')]},'raw':!![]})[_0x1fc6('0x23')](function(_0x1c34ef){if(_0x1c34ef&&_0x1c34ef['autoAssociation']===0x0){return db[_0x1fc6('0x26')][_0x1fc6('0x4a')]({'name':_0x40349b[_0x1fc6('0x2a')],'resourceId':_0x40349b['id'],'type':_0x1c34ef[_0x1fc6('0x2a')],'sectionId':_0x1c34ef['id']},{})[_0x1fc6('0x23')](function(){return _0x706f1f;});}else{return _0x706f1f;}})[_0x1fc6('0x46')](function(_0x2e81cf){logger[_0x1fc6('0x28')](_0x1fc6('0x52'),_0x2e81cf);throw _0x2e81cf;});}return _0x706f1f;});}})[_0x1fc6('0x23')](respondWithResult(_0x2478fd,0xc9))[_0x1fc6('0x46')](handleError(_0x2478fd,null));};exports[_0x1fc6('0x22')]=function(_0x52d8b0,_0x53301a){if(_0x52d8b0[_0x1fc6('0x58')]['id']){delete _0x52d8b0[_0x1fc6('0x58')]['id'];}return db['JscriptyProject'][_0x1fc6('0x49')]({'where':{'id':_0x52d8b0['params']['id']}})[_0x1fc6('0x23')](handleEntityNotFound(_0x53301a,null))[_0x1fc6('0x23')](saveUpdates(_0x52d8b0['body'],null))[_0x1fc6('0x23')](respondWithResult(_0x53301a,null))[_0x1fc6('0x46')](handleError(_0x53301a,null));};exports[_0x1fc6('0x24')]=function(_0x1d1afc,_0x5e354f){return db[_0x1fc6('0x2e')]['find']({'where':{'id':_0x1d1afc[_0x1fc6('0x48')]['id']}})[_0x1fc6('0x23')](handleEntityNotFound(_0x5e354f,null))['then'](removeEntity(_0x5e354f,null))[_0x1fc6('0x46')](handleError(_0x5e354f,null));};exports['getSessions']=function(_0x3c6ae6,_0x5646ef,_0x28ecaa){var _0x10b8da={'raw':!![],'where':{}};var _0x3700db={};var _0x1abb38={'count':0x0,'rows':[]};return db[_0x1fc6('0x2e')][_0x1fc6('0x59')]({'where':{'id':_0x3c6ae6[_0x1fc6('0x48')]['id']}})[_0x1fc6('0x23')](handleEntityNotFound(_0x5646ef,null))[_0x1fc6('0x23')](function(_0x24e94f){if(_0x24e94f){_0x3700db['model']=_[_0x1fc6('0x34')](db[_0x1fc6('0x5a')][_0x1fc6('0x2f')]);_0x3700db[_0x1fc6('0x33')]=_['keys'](_0x3c6ae6[_0x1fc6('0x33')]);_0x3700db[_0x1fc6('0x3e')]=_[_0x1fc6('0x37')](_0x3700db['model'],_0x3700db[_0x1fc6('0x33')]);_0x10b8da[_0x1fc6('0x36')]=_[_0x1fc6('0x37')](_0x3700db[_0x1fc6('0x35')],qs[_0x1fc6('0x38')](_0x3c6ae6['query'][_0x1fc6('0x38')]));_0x10b8da[_0x1fc6('0x36')]=_0x10b8da[_0x1fc6('0x36')][_0x1fc6('0x53')]?_0x10b8da[_0x1fc6('0x36')]:_0x3700db[_0x1fc6('0x35')];if(!_0x3c6ae6[_0x1fc6('0x33')][_0x1fc6('0x39')]('nolimit')){_0x10b8da['limit']=qs[_0x1fc6('0x1b')](_0x3c6ae6[_0x1fc6('0x33')]['limit']);_0x10b8da[_0x1fc6('0x1d')]=qs[_0x1fc6('0x1d')](_0x3c6ae6['query'][_0x1fc6('0x1d')]);}_0x10b8da[_0x1fc6('0x3b')]=qs[_0x1fc6('0x3c')](_0x3c6ae6[_0x1fc6('0x33')][_0x1fc6('0x3c')]);_0x10b8da['where']=qs[_0x1fc6('0x3e')](_['pick'](_0x3c6ae6[_0x1fc6('0x33')],_0x3700db[_0x1fc6('0x3e')]));_0x10b8da['where'][_0x1fc6('0x5b')]=_0x24e94f['id'];if(_0x3c6ae6['query'][_0x1fc6('0x3f')]){_0x10b8da[_0x1fc6('0x3d')]=_[_0x1fc6('0x40')](_0x10b8da['where'],{'$or':_[_0x1fc6('0x2d')](_0x10b8da['attributes'],function(_0x3ab90d){var _0x1719f2={};_0x1719f2[_0x3ab90d]={'$like':'%'+_0x3c6ae6['query'][_0x1fc6('0x3f')]+'%'};return _0x1719f2;})});}_0x10b8da=_[_0x1fc6('0x40')]({},_0x10b8da,_0x3c6ae6[_0x1fc6('0x42')]);return db['JscriptySessionReport']['count']({'where':_0x10b8da[_0x1fc6('0x3d')]})[_0x1fc6('0x23')](function(_0x4266c1){_0x1abb38[_0x1fc6('0x1c')]=_0x4266c1;if(_0x3c6ae6[_0x1fc6('0x33')][_0x1fc6('0x54')]){_0x10b8da[_0x1fc6('0x43')]=[{'all':!![]}];}return db[_0x1fc6('0x5a')][_0x1fc6('0x44')](_0x10b8da);})['then'](function(_0x76ae9d){_0x1abb38['rows']=_0x76ae9d;return _0x1abb38;});}})['then'](respondWithFilteredResult(_0x5646ef,_0x10b8da))[_0x1fc6('0x46')](handleError(_0x5646ef,null));};exports[_0x1fc6('0x5c')]=function(_0x5e8a5c,_0x30b2b5,_0x1c0dd2){var _0x33a6fc={'raw':!![],'where':{}};var _0x13aa81={};var _0x5d0197={'count':0x0,'rows':[]};return db[_0x1fc6('0x2e')][_0x1fc6('0x59')]({'where':{'id':_0x5e8a5c[_0x1fc6('0x48')]['id']}})[_0x1fc6('0x23')](handleEntityNotFound(_0x30b2b5,null))['then'](function(_0x58ac6d){if(_0x58ac6d){_0x13aa81['model']=_['keys'](db[_0x1fc6('0x5d')][_0x1fc6('0x2f')]);_0x13aa81[_0x1fc6('0x33')]=_['keys'](_0x5e8a5c['query']);_0x13aa81['filters']=_[_0x1fc6('0x37')](_0x13aa81[_0x1fc6('0x35')],_0x13aa81[_0x1fc6('0x33')]);_0x33a6fc['attributes']=_['intersection'](_0x13aa81[_0x1fc6('0x35')],qs[_0x1fc6('0x38')](_0x5e8a5c[_0x1fc6('0x33')][_0x1fc6('0x38')]));_0x33a6fc['attributes']=_0x33a6fc[_0x1fc6('0x36')][_0x1fc6('0x53')]?_0x33a6fc['attributes']:_0x13aa81[_0x1fc6('0x35')];if(!_0x5e8a5c['query'][_0x1fc6('0x39')]('nolimit')){_0x33a6fc['limit']=qs[_0x1fc6('0x1b')](_0x5e8a5c['query'][_0x1fc6('0x1b')]);_0x33a6fc[_0x1fc6('0x1d')]=qs[_0x1fc6('0x1d')](_0x5e8a5c['query'][_0x1fc6('0x1d')]);}_0x33a6fc[_0x1fc6('0x3b')]=qs['sort'](_0x5e8a5c[_0x1fc6('0x33')][_0x1fc6('0x3c')]);_0x33a6fc['where']=qs[_0x1fc6('0x3e')](_['pick'](_0x5e8a5c[_0x1fc6('0x33')],_0x13aa81[_0x1fc6('0x3e')]));_0x33a6fc[_0x1fc6('0x3d')]['ProjectId']=_0x58ac6d['id'];if(_0x5e8a5c[_0x1fc6('0x33')]['filter']){_0x33a6fc[_0x1fc6('0x3d')]=_[_0x1fc6('0x40')](_0x33a6fc[_0x1fc6('0x3d')],{'$or':_['map'](_0x33a6fc[_0x1fc6('0x36')],function(_0x28cefa){var _0x1c59e9={};_0x1c59e9[_0x28cefa]={'$like':'%'+_0x5e8a5c['query'][_0x1fc6('0x3f')]+'%'};return _0x1c59e9;})});}_0x33a6fc=_[_0x1fc6('0x40')]({},_0x33a6fc,_0x5e8a5c[_0x1fc6('0x42')]);return db[_0x1fc6('0x5d')][_0x1fc6('0x1c')]({'where':_0x33a6fc['where']})[_0x1fc6('0x23')](function(_0x2cb884){_0x5d0197[_0x1fc6('0x1c')]=_0x2cb884;if(_0x5e8a5c[_0x1fc6('0x33')][_0x1fc6('0x54')]){_0x33a6fc['include']=[{'all':!![]}];}return db[_0x1fc6('0x5d')]['findAll'](_0x33a6fc);})['then'](function(_0x3da6dc){_0x5d0197[_0x1fc6('0x45')]=_0x3da6dc;return _0x5d0197;});}})['then'](respondWithFilteredResult(_0x30b2b5,_0x33a6fc))[_0x1fc6('0x46')](handleError(_0x30b2b5,null));};function char(_0x1f7eb1){return _0x1fc6('0x5e')===typeof _0x1f7eb1?String[_0x1fc6('0x5f')][_0x1fc6('0x20')](null,arguments):_0x1f7eb1;}function needsEncapsulation(_0x2b054e){return!!_0x2b054e&&(_0x2b054e[_0x1fc6('0x60')]()[_0x1fc6('0x61')](char(0xd))>=0x0||_0x2b054e[_0x1fc6('0x60')]()[_0x1fc6('0x61')](char(0xa))>=0x0||_0x2b054e[_0x1fc6('0x60')]()[_0x1fc6('0x61')](char(0x2c))>=0x0||_0x2b054e[_0x1fc6('0x60')]()[_0x1fc6('0x61')](char(0x22))>=0x0);}function encapsulate(_0x5505ca){var _0xe5aefe=char(0x22),_0x37e144='\x5c'+char(0x22),_0x397362=_0x5505ca[_0x1fc6('0x60')]()[_0x1fc6('0x62')](new RegExp(_0xe5aefe,'g'),_0x37e144);return _0xe5aefe+_0x397362+_0xe5aefe;}exports['getSummary']=function(_0x583a30,_0x222bb7,_0x173d1e){var _0x5dfe61,_0x3ee757;var _0x3df03d={'where':{'ProjectId':_0x583a30[_0x1fc6('0x48')]['id']}};if(_0x583a30[_0x1fc6('0x33')][_0x1fc6('0x63')]){_0x3df03d[_0x1fc6('0x3d')]['starttime']=JSON[_0x1fc6('0x64')](_0x583a30[_0x1fc6('0x33')][_0x1fc6('0x63')]);}return db['JscriptySessionReport'][_0x1fc6('0x44')](_0x3df03d)[_0x1fc6('0x23')](handleEntityNotFound(_0x222bb7,null))['then'](function(_0x26b14f){if(_0x26b14f){_0x5dfe61=_0x26b14f;return db['JscriptyQuestionReport'][_0x1fc6('0x44')]({'where':{'SessionId':{'$in':_[_0x1fc6('0x2d')](_0x5dfe61,'id')},'ProjectId':_0x583a30[_0x1fc6('0x48')]['id']},'order':_0x1fc6('0x65')});}})[_0x1fc6('0x23')](handleEntityNotFound(_0x222bb7,null))[_0x1fc6('0x23')](function(_0x4e09a1){if(_0x4e09a1){_0x3ee757=_0x4e09a1;var _0x1c01a6={};for(var _0x305437=0x0,_0x4746e0=_0x3ee757[_0x1fc6('0x53')];_0x305437<_0x4746e0;_0x305437++){if(!_0x1c01a6[_0x1fc6('0x39')](_0x3ee757[_0x305437][_0x1fc6('0x66')])){_0x1c01a6[_0x3ee757[_0x305437][_0x1fc6('0x66')]]=needsEncapsulation(_0x3ee757[_0x305437][_0x1fc6('0x67')])?encapsulate(_0x3ee757[_0x305437]['question']):_0x3ee757[_0x305437]['question'];}}var _0x153e9d=[],_0x4c1226={};for(var _0x2a9db9=0x0,_0x5ccb33=_0x5dfe61[_0x1fc6('0x53')];_0x2a9db9<_0x5ccb33;_0x2a9db9++){_0x4c1226={'ProjectId':_0x583a30[_0x1fc6('0x48')]['id'],'SessionId':_0x5dfe61[_0x2a9db9]['id'],'StartTime':moment(_0x5dfe61[_0x2a9db9]['starttime'])[_0x1fc6('0x68')](_0x1fc6('0x69'))};for(var _0x282e5d=0x0,_0x427e93=_0x3ee757[_0x1fc6('0x53')];_0x282e5d<_0x427e93;_0x282e5d++){if(_0x3ee757[_0x282e5d]['SessionId']==_0x5dfe61[_0x2a9db9]['id']&&_0x1c01a6[_0x1fc6('0x39')](_0x3ee757[_0x282e5d][_0x1fc6('0x66')])){_0x4c1226[_0x1c01a6[_0x3ee757[_0x282e5d][_0x1fc6('0x66')]]]=_0x3ee757[_0x282e5d][_0x1fc6('0x6a')];}}for(var _0x280170 in _0x1c01a6){if(!_0x4c1226['hasOwnProperty'](_0x1c01a6[_0x280170])){_0x4c1226[_0x1c01a6[_0x280170]]=null;}}_0x153e9d[_0x1fc6('0x6b')](_0x4c1226);}return _0x153e9d;}})[_0x1fc6('0x23')](function(_0x215dd0){if(!_[_0x1fc6('0x6c')](_0x215dd0)){var _0x43a282=toCsv(_0x215dd0);var _0x1ca20c=Date[_0x1fc6('0x6d')]();fs[_0x1fc6('0x6e')](util['format'](_0x1fc6('0x6f'),_0x583a30[_0x1fc6('0x48')]['id'],_0x1ca20c),_0x43a282);_0x222bb7[_0x1fc6('0x70')](_0x1fc6('0x71'),_0x1fc6('0x72')+util[_0x1fc6('0x68')](_0x1fc6('0x73'),_0x583a30[_0x1fc6('0x48')]['id'],_0x1ca20c));_0x222bb7['setHeader'](_0x1fc6('0x74'),_0x1fc6('0x75'));return _0x222bb7[_0x1fc6('0x76')](util['format'](_0x1fc6('0x6f'),_0x583a30[_0x1fc6('0x48')]['id'],_0x1ca20c));}else{return _0x222bb7[_0x1fc6('0x27')](0xcc);}})[_0x1fc6('0x46')](handleError(_0x222bb7,null));}; \ No newline at end of file +var _0x280b=['/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','rimraf','zip-dir','moment','bluebird','sox','to-csv','fs-extra','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','JscriptyProject','rawAttributes','fieldName','type','query','keys','filters','attributes','intersection','fields','length','model','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','rows','show','params','include','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','body','user','UserProfileSection','autoAssociation','getSessions','JscriptySessionReport','nolimit','ProjectId','getAnswers','findOne','hasOwnProperty','JscriptyAnswerReport','findAll','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','format','SessionId','answer','writeFileSync'];(function(_0x5c6022,_0x5cd10b){var _0x4ab5af=function(_0x988aff){while(--_0x988aff){_0x5c6022['push'](_0x5c6022['shift']());}};_0x4ab5af(++_0x5cd10b);}(_0x280b,0x1bf));var _0xb280=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x280b[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb280('0x0'));var zipdir=require(_0xb280('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb280('0x2'));var BPromise=require(_0xb280('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xb280('0x4'));var csv=require(_0xb280('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb280('0x6'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb280('0x7'));var deskjs=require('desk.js');var toCsv=require(_0xb280('0x5'));var querystring=require('querystring');var Papa=require(_0xb280('0x8'));var Redis=require(_0xb280('0x9'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb280('0xa'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb280('0xb'))('api');var utils=require(_0xb280('0xc'));var config=require('../../config/environment');var licenseUtil=require(_0xb280('0xd'));var db=require(_0xb280('0xe'))['db'];function respondWithStatusCode(_0xa0fe52,_0xd1a2c5){_0xd1a2c5=_0xd1a2c5||0xcc;return function(_0x5d40b8){if(_0x5d40b8){return _0xa0fe52['sendStatus'](_0xd1a2c5);}return _0xa0fe52[_0xb280('0xf')](_0xd1a2c5)[_0xb280('0x10')]();};}function respondWithResult(_0x543a4d,_0x42df7f){_0x42df7f=_0x42df7f||0xc8;return function(_0x429899){if(_0x429899){return _0x543a4d[_0xb280('0xf')](_0x42df7f)[_0xb280('0x11')](_0x429899);}};}function respondWithFilteredResult(_0x729571,_0xe4dc32){return function(_0x3eb853){if(_0x3eb853){var _0x106274=typeof _0xe4dc32['offset']===_0xb280('0x12')&&typeof _0xe4dc32[_0xb280('0x13')]===_0xb280('0x12');var _0x5e51d5=_0x3eb853['count'];var _0x53a82c=_0x106274?0x0:_0xe4dc32[_0xb280('0x14')];var _0x1a7cc1=_0x106274?_0x3eb853[_0xb280('0x15')]:_0xe4dc32[_0xb280('0x14')]+_0xe4dc32[_0xb280('0x13')];var _0x337b02;if(_0x1a7cc1>=_0x5e51d5){_0x1a7cc1=_0x5e51d5;_0x337b02=0xc8;}else{_0x337b02=0xce;}_0x729571[_0xb280('0xf')](_0x337b02);return _0x729571[_0xb280('0x16')](_0xb280('0x17'),_0x53a82c+'-'+_0x1a7cc1+'/'+_0x5e51d5)[_0xb280('0x11')](_0x3eb853);}return null;};}function patchUpdates(_0x52cc87){return function(_0x4570fc){try{jsonpatch[_0xb280('0x18')](_0x4570fc,_0x52cc87,!![]);}catch(_0xe2c5a9){return BPromise['reject'](_0xe2c5a9);}return _0x4570fc[_0xb280('0x19')]();};}function saveUpdates(_0x336088,_0x19214b){return function(_0x1bf60b){if(_0x1bf60b){return _0x1bf60b[_0xb280('0x1a')](_0x336088)[_0xb280('0x1b')](function(_0x760e2){return _0x760e2;});}return null;};}function removeEntity(_0x145c92,_0xd7a11d){return function(_0x2a54e7){if(_0x2a54e7){return _0x2a54e7[_0xb280('0x1c')]()[_0xb280('0x1b')](function(){var _0x3a7b1d=_0x2a54e7[_0xb280('0x1d')]({'plain':!![]});var _0x4d01d1='Projects';return db[_0xb280('0x1e')][_0xb280('0x1c')]({'where':{'type':_0x4d01d1,'resourceId':_0x3a7b1d['id']}})[_0xb280('0x1b')](function(){return _0x2a54e7;});})['then'](function(){_0x145c92['status'](0xcc)[_0xb280('0x10')]();});}};}function handleEntityNotFound(_0x42979e,_0x1ceef6){return function(_0x19e8f4){if(!_0x19e8f4){_0x42979e[_0xb280('0x1f')](0x194);}return _0x19e8f4;};}function handleError(_0x1efb1a,_0x3fb03c){_0x3fb03c=_0x3fb03c||0x1f4;return function(_0x4942ee){logger[_0xb280('0x20')](_0x4942ee[_0xb280('0x21')]);if(_0x4942ee[_0xb280('0x22')]){delete _0x4942ee[_0xb280('0x22')];}_0x1efb1a[_0xb280('0xf')](_0x3fb03c)[_0xb280('0x23')](_0x4942ee);};}exports[_0xb280('0x24')]=function(_0x111783,_0x10867c){var _0x5e8ea5={},_0x2cb950={},_0x538c4f={'count':0x0,'rows':[]};var _0x5466a4=_['map'](db[_0xb280('0x25')][_0xb280('0x26')],function(_0x1b37e9){return{'name':_0x1b37e9[_0xb280('0x27')],'type':_0x1b37e9[_0xb280('0x28')]['key']};});_0x2cb950['model']=_['map'](_0x5466a4,'name');_0x2cb950[_0xb280('0x29')]=_[_0xb280('0x2a')](_0x111783[_0xb280('0x29')]);_0x2cb950[_0xb280('0x2b')]=_['intersection'](_0x2cb950['model'],_0x2cb950['query']);_0x5e8ea5[_0xb280('0x2c')]=_[_0xb280('0x2d')](_0x2cb950['model'],qs[_0xb280('0x2e')](_0x111783[_0xb280('0x29')][_0xb280('0x2e')]));_0x5e8ea5[_0xb280('0x2c')]=_0x5e8ea5[_0xb280('0x2c')][_0xb280('0x2f')]?_0x5e8ea5['attributes']:_0x2cb950[_0xb280('0x30')];if(!_0x111783[_0xb280('0x29')]['hasOwnProperty']('nolimit')){_0x5e8ea5[_0xb280('0x13')]=qs[_0xb280('0x13')](_0x111783[_0xb280('0x29')][_0xb280('0x13')]);_0x5e8ea5['offset']=qs['offset'](_0x111783[_0xb280('0x29')][_0xb280('0x14')]);}_0x5e8ea5[_0xb280('0x31')]=qs[_0xb280('0x32')](_0x111783[_0xb280('0x29')]['sort']);_0x5e8ea5[_0xb280('0x33')]=qs['filters'](_[_0xb280('0x34')](_0x111783[_0xb280('0x29')],_0x2cb950[_0xb280('0x2b')]),_0x5466a4);if(_0x111783['query'][_0xb280('0x35')]){_0x5e8ea5['where']=_[_0xb280('0x36')](_0x5e8ea5[_0xb280('0x33')],{'$or':_[_0xb280('0x37')](_0x5466a4,function(_0x37e95b){if(_0x37e95b[_0xb280('0x28')]!==_0xb280('0x38')){var _0x29de7b={};_0x29de7b[_0x37e95b[_0xb280('0x22')]]={'$like':'%'+_0x111783[_0xb280('0x29')][_0xb280('0x35')]+'%'};return _0x29de7b;}})});}_0x5e8ea5=_[_0xb280('0x36')]({},_0x5e8ea5,_0x111783[_0xb280('0x39')]);var _0x161eeb={'where':_0x5e8ea5['where']};return db[_0xb280('0x25')]['count'](_0x161eeb)['then'](function(_0x3732e4){_0x538c4f[_0xb280('0x15')]=_0x3732e4;if(_0x111783['query'][_0xb280('0x3a')]){_0x5e8ea5['include']=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0x5e8ea5);})[_0xb280('0x1b')](function(_0x36e71a){_0x538c4f[_0xb280('0x3b')]=_0x36e71a;return _0x538c4f;})['then'](respondWithFilteredResult(_0x10867c,_0x5e8ea5))['catch'](handleError(_0x10867c,null));};exports[_0xb280('0x3c')]=function(_0x5f44a2,_0x322a0e){var _0x504609={'raw':![],'where':{'id':_0x5f44a2[_0xb280('0x3d')]['id']}},_0x74457d={};_0x74457d[_0xb280('0x30')]=_['keys'](db['JscriptyProject']['rawAttributes']);_0x74457d[_0xb280('0x29')]=_[_0xb280('0x2a')](_0x5f44a2[_0xb280('0x29')]);_0x74457d[_0xb280('0x2b')]=_['intersection'](_0x74457d['model'],_0x74457d[_0xb280('0x29')]);_0x504609[_0xb280('0x2c')]=_['intersection'](_0x74457d[_0xb280('0x30')],qs[_0xb280('0x2e')](_0x5f44a2['query'][_0xb280('0x2e')]));_0x504609['attributes']=_0x504609[_0xb280('0x2c')]['length']?_0x504609['attributes']:_0x74457d[_0xb280('0x30')];if(_0x5f44a2[_0xb280('0x29')][_0xb280('0x3a')]){_0x504609[_0xb280('0x3e')]=[{'all':!![]}];}_0x504609=_[_0xb280('0x36')]({},_0x504609,_0x5f44a2['options']);return db[_0xb280('0x25')]['find'](_0x504609)[_0xb280('0x1b')](handleEntityNotFound(_0x322a0e,null))['then'](respondWithResult(_0x322a0e,null))[_0xb280('0x3f')](handleError(_0x322a0e,null));};exports[_0xb280('0x40')]=function(_0x15ed29,_0x42a228){return db[_0xb280('0x25')][_0xb280('0x40')](_0x15ed29['body'],{})['then'](function(_0x22b6af){var _0x2c01a=_0x15ed29['user'][_0xb280('0x1d')]({'plain':!![]});if(!_0x2c01a)throw new Error(_0xb280('0x41'));if(_0x2c01a[_0xb280('0x42')]==='user'){var _0x3f0178=_0x22b6af[_0xb280('0x1d')]({'plain':!![]});var _0x3b7396='Projects';return db['UserProfileSection'][_0xb280('0x43')]({'where':{'name':_0x3b7396,'userProfileId':_0x2c01a[_0xb280('0x44')]},'raw':!![]})[_0xb280('0x1b')](function(_0x3fdd2e){if(_0x3fdd2e&&_0x3fdd2e['autoAssociation']===0x0){return db[_0xb280('0x1e')][_0xb280('0x40')]({'name':_0x3f0178[_0xb280('0x22')],'resourceId':_0x3f0178['id'],'type':_0x3fdd2e[_0xb280('0x22')],'sectionId':_0x3fdd2e['id']},{})[_0xb280('0x1b')](function(){return _0x22b6af;});}else{return _0x22b6af;}})[_0xb280('0x3f')](function(_0x4cf5e5){logger[_0xb280('0x20')](_0xb280('0x45'),_0x4cf5e5);throw _0x4cf5e5;});}return _0x22b6af;})[_0xb280('0x1b')](respondWithResult(_0x42a228,0xc9))[_0xb280('0x3f')](handleError(_0x42a228,null));};exports[_0xb280('0x46')]=function(_0x4a38f9,_0x8d1b78){var _0x4d051b={'where':{'id':_0x4a38f9[_0xb280('0x3d')]['id']}},_0x33f58b={};_0x33f58b[_0xb280('0x30')]=_[_0xb280('0x2a')](db[_0xb280('0x25')][_0xb280('0x26')]);_0x4d051b['attributes']=_['intersection'](_0x33f58b[_0xb280('0x30')],qs[_0xb280('0x2e')](_0x4a38f9['query']['fields']));_0x4d051b[_0xb280('0x2c')]=_0x4d051b[_0xb280('0x2c')][_0xb280('0x2f')]?_0x4d051b[_0xb280('0x2c')]:_0x33f58b['model'];if(_0x4a38f9[_0xb280('0x29')][_0xb280('0x3a')]){_0x4d051b[_0xb280('0x3e')]=[{'all':!![]}];}_0x4d051b=_[_0xb280('0x36')]({},_0x4d051b,_0x4a38f9['options']);return db[_0xb280('0x25')][_0xb280('0x43')](_0x4d051b)['then'](handleEntityNotFound(_0x8d1b78,null))['then'](function(_0x2d348e){if(_0x2d348e){var _0x484999=_0x2d348e['get']({'plain':!![]});_0x484999=qs['omit'](_0x484999,['id',_0xb280('0x47'),_0xb280('0x48')]);_0x4a38f9['body']=_[_0xb280('0x49')](_0x4a38f9[_0xb280('0x4a')],['id',_0xb280('0x47'),_0xb280('0x48')]);return db[_0xb280('0x25')][_0xb280('0x40')](_[_0xb280('0x36')](_0x484999,_0x4a38f9[_0xb280('0x4a')]),{'include':_0x4a38f9[_0xb280('0x29')][_0xb280('0x3a')]?[{'all':!![]}]:undefined})[_0xb280('0x1b')](function(_0x412d1d){var _0x428561=_0x4a38f9['user'][_0xb280('0x1d')]({'plain':!![]});if(!_0x428561)throw new Error(_0xb280('0x41'));if(_0x428561[_0xb280('0x42')]===_0xb280('0x4b')){var _0x13ab58=_0x412d1d[_0xb280('0x1d')]({'plain':!![]});var _0x30c64c='Projects';return db[_0xb280('0x4c')][_0xb280('0x43')]({'where':{'name':_0x30c64c,'userProfileId':_0x428561[_0xb280('0x44')]},'raw':!![]})[_0xb280('0x1b')](function(_0x43d1a0){if(_0x43d1a0&&_0x43d1a0[_0xb280('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x13ab58[_0xb280('0x22')],'resourceId':_0x13ab58['id'],'type':_0x43d1a0['name'],'sectionId':_0x43d1a0['id']},{})['then'](function(){return _0x412d1d;});}else{return _0x412d1d;}})[_0xb280('0x3f')](function(_0x19fbbe){logger['error'](_0xb280('0x45'),_0x19fbbe);throw _0x19fbbe;});}return _0x412d1d;});}})[_0xb280('0x1b')](respondWithResult(_0x8d1b78,0xc9))[_0xb280('0x3f')](handleError(_0x8d1b78,null));};exports[_0xb280('0x1a')]=function(_0x326b51,_0x6bd81d){if(_0x326b51['body']['id']){delete _0x326b51[_0xb280('0x4a')]['id'];}return db[_0xb280('0x25')][_0xb280('0x43')]({'where':{'id':_0x326b51['params']['id']}})['then'](handleEntityNotFound(_0x6bd81d,null))['then'](saveUpdates(_0x326b51['body'],null))[_0xb280('0x1b')](respondWithResult(_0x6bd81d,null))[_0xb280('0x3f')](handleError(_0x6bd81d,null));};exports[_0xb280('0x1c')]=function(_0x7a2a54,_0x93c94e){return db[_0xb280('0x25')]['find']({'where':{'id':_0x7a2a54[_0xb280('0x3d')]['id']}})['then'](handleEntityNotFound(_0x93c94e,null))['then'](removeEntity(_0x93c94e,null))[_0xb280('0x3f')](handleError(_0x93c94e,null));};exports[_0xb280('0x4e')]=function(_0x4cc30a,_0x3d3b82,_0x2acedc){var _0x5b5340={'raw':!![],'where':{}};var _0x313cbe={};var _0x1c5064={'count':0x0,'rows':[]};return db[_0xb280('0x25')]['findOne']({'where':{'id':_0x4cc30a[_0xb280('0x3d')]['id']}})[_0xb280('0x1b')](handleEntityNotFound(_0x3d3b82,null))[_0xb280('0x1b')](function(_0x4dc4d2){if(_0x4dc4d2){_0x313cbe[_0xb280('0x30')]=_[_0xb280('0x2a')](db[_0xb280('0x4f')][_0xb280('0x26')]);_0x313cbe[_0xb280('0x29')]=_[_0xb280('0x2a')](_0x4cc30a[_0xb280('0x29')]);_0x313cbe[_0xb280('0x2b')]=_[_0xb280('0x2d')](_0x313cbe['model'],_0x313cbe[_0xb280('0x29')]);_0x5b5340[_0xb280('0x2c')]=_['intersection'](_0x313cbe[_0xb280('0x30')],qs[_0xb280('0x2e')](_0x4cc30a[_0xb280('0x29')][_0xb280('0x2e')]));_0x5b5340['attributes']=_0x5b5340[_0xb280('0x2c')][_0xb280('0x2f')]?_0x5b5340[_0xb280('0x2c')]:_0x313cbe[_0xb280('0x30')];if(!_0x4cc30a['query']['hasOwnProperty'](_0xb280('0x50'))){_0x5b5340['limit']=qs[_0xb280('0x13')](_0x4cc30a[_0xb280('0x29')][_0xb280('0x13')]);_0x5b5340[_0xb280('0x14')]=qs[_0xb280('0x14')](_0x4cc30a[_0xb280('0x29')][_0xb280('0x14')]);}_0x5b5340[_0xb280('0x31')]=qs[_0xb280('0x32')](_0x4cc30a['query'][_0xb280('0x32')]);_0x5b5340[_0xb280('0x33')]=qs[_0xb280('0x2b')](_[_0xb280('0x34')](_0x4cc30a[_0xb280('0x29')],_0x313cbe[_0xb280('0x2b')]));_0x5b5340['where'][_0xb280('0x51')]=_0x4dc4d2['id'];if(_0x4cc30a['query'][_0xb280('0x35')]){_0x5b5340[_0xb280('0x33')]=_[_0xb280('0x36')](_0x5b5340[_0xb280('0x33')],{'$or':_[_0xb280('0x37')](_0x5b5340[_0xb280('0x2c')],function(_0x3e8859){var _0x2e047d={};_0x2e047d[_0x3e8859]={'$like':'%'+_0x4cc30a[_0xb280('0x29')][_0xb280('0x35')]+'%'};return _0x2e047d;})});}_0x5b5340=_[_0xb280('0x36')]({},_0x5b5340,_0x4cc30a[_0xb280('0x39')]);return db[_0xb280('0x4f')][_0xb280('0x15')]({'where':_0x5b5340[_0xb280('0x33')]})[_0xb280('0x1b')](function(_0x17d272){_0x1c5064['count']=_0x17d272;if(_0x4cc30a[_0xb280('0x29')][_0xb280('0x3a')]){_0x5b5340[_0xb280('0x3e')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x5b5340);})[_0xb280('0x1b')](function(_0x13500f){_0x1c5064[_0xb280('0x3b')]=_0x13500f;return _0x1c5064;});}})[_0xb280('0x1b')](respondWithFilteredResult(_0x3d3b82,_0x5b5340))[_0xb280('0x3f')](handleError(_0x3d3b82,null));};exports[_0xb280('0x52')]=function(_0x13f604,_0x43589f,_0x4e5bcf){var _0x252237={'raw':!![],'where':{}};var _0x19b6c8={};var _0x268a6e={'count':0x0,'rows':[]};return db[_0xb280('0x25')][_0xb280('0x53')]({'where':{'id':_0x13f604[_0xb280('0x3d')]['id']}})[_0xb280('0x1b')](handleEntityNotFound(_0x43589f,null))[_0xb280('0x1b')](function(_0x30d405){if(_0x30d405){_0x19b6c8[_0xb280('0x30')]=_['keys'](db['JscriptyAnswerReport'][_0xb280('0x26')]);_0x19b6c8[_0xb280('0x29')]=_[_0xb280('0x2a')](_0x13f604['query']);_0x19b6c8[_0xb280('0x2b')]=_[_0xb280('0x2d')](_0x19b6c8[_0xb280('0x30')],_0x19b6c8[_0xb280('0x29')]);_0x252237[_0xb280('0x2c')]=_[_0xb280('0x2d')](_0x19b6c8['model'],qs[_0xb280('0x2e')](_0x13f604['query'][_0xb280('0x2e')]));_0x252237[_0xb280('0x2c')]=_0x252237[_0xb280('0x2c')][_0xb280('0x2f')]?_0x252237[_0xb280('0x2c')]:_0x19b6c8[_0xb280('0x30')];if(!_0x13f604[_0xb280('0x29')][_0xb280('0x54')]('nolimit')){_0x252237[_0xb280('0x13')]=qs['limit'](_0x13f604[_0xb280('0x29')][_0xb280('0x13')]);_0x252237[_0xb280('0x14')]=qs[_0xb280('0x14')](_0x13f604[_0xb280('0x29')][_0xb280('0x14')]);}_0x252237[_0xb280('0x31')]=qs[_0xb280('0x32')](_0x13f604['query'][_0xb280('0x32')]);_0x252237['where']=qs[_0xb280('0x2b')](_[_0xb280('0x34')](_0x13f604['query'],_0x19b6c8[_0xb280('0x2b')]));_0x252237[_0xb280('0x33')]['ProjectId']=_0x30d405['id'];if(_0x13f604['query']['filter']){_0x252237[_0xb280('0x33')]=_[_0xb280('0x36')](_0x252237[_0xb280('0x33')],{'$or':_[_0xb280('0x37')](_0x252237[_0xb280('0x2c')],function(_0x3f9f8d){var _0xf3f366={};_0xf3f366[_0x3f9f8d]={'$like':'%'+_0x13f604[_0xb280('0x29')][_0xb280('0x35')]+'%'};return _0xf3f366;})});}_0x252237=_[_0xb280('0x36')]({},_0x252237,_0x13f604[_0xb280('0x39')]);return db[_0xb280('0x55')][_0xb280('0x15')]({'where':_0x252237[_0xb280('0x33')]})[_0xb280('0x1b')](function(_0xb8a08c){_0x268a6e[_0xb280('0x15')]=_0xb8a08c;if(_0x13f604[_0xb280('0x29')][_0xb280('0x3a')]){_0x252237[_0xb280('0x3e')]=[{'all':!![]}];}return db[_0xb280('0x55')][_0xb280('0x56')](_0x252237);})[_0xb280('0x1b')](function(_0x427695){_0x268a6e[_0xb280('0x3b')]=_0x427695;return _0x268a6e;});}})[_0xb280('0x1b')](respondWithFilteredResult(_0x43589f,_0x252237))['catch'](handleError(_0x43589f,null));};function char(_0x37080c){return _0xb280('0x57')===typeof _0x37080c?String[_0xb280('0x58')][_0xb280('0x18')](null,arguments):_0x37080c;}function needsEncapsulation(_0x289b1e){return!!_0x289b1e&&(_0x289b1e[_0xb280('0x59')]()[_0xb280('0x5a')](char(0xd))>=0x0||_0x289b1e['toString']()[_0xb280('0x5a')](char(0xa))>=0x0||_0x289b1e[_0xb280('0x59')]()[_0xb280('0x5a')](char(0x2c))>=0x0||_0x289b1e['toString']()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x2950c2){var _0x22dd99=char(0x22),_0x4614d0='\x5c'+char(0x22),_0x2b9af1=_0x2950c2[_0xb280('0x59')]()[_0xb280('0x5b')](new RegExp(_0x22dd99,'g'),_0x4614d0);return _0x22dd99+_0x2b9af1+_0x22dd99;}exports[_0xb280('0x5c')]=function(_0x3d1d39,_0x5859e9,_0x290a6d){var _0x19fa7b,_0x1ac593;var _0x46ca5b={'where':{'ProjectId':_0x3d1d39[_0xb280('0x3d')]['id']}};if(_0x3d1d39[_0xb280('0x29')][_0xb280('0x5d')]){_0x46ca5b[_0xb280('0x33')][_0xb280('0x5e')]=JSON[_0xb280('0x5f')](_0x3d1d39[_0xb280('0x29')]['startTime']);}return db[_0xb280('0x4f')]['findAll'](_0x46ca5b)['then'](handleEntityNotFound(_0x5859e9,null))[_0xb280('0x1b')](function(_0x4f2156){if(_0x4f2156){_0x19fa7b=_0x4f2156;return db[_0xb280('0x60')][_0xb280('0x56')]({'where':{'SessionId':{'$in':_[_0xb280('0x37')](_0x19fa7b,'id')},'ProjectId':_0x3d1d39['params']['id']},'order':'-createdAt'});}})[_0xb280('0x1b')](handleEntityNotFound(_0x5859e9,null))[_0xb280('0x1b')](function(_0xc61af7){if(_0xc61af7){_0x1ac593=_0xc61af7;var _0xdd14ac={};for(var _0x181fc5=0x0,_0x39ddeb=_0x1ac593[_0xb280('0x2f')];_0x181fc5<_0x39ddeb;_0x181fc5++){if(!_0xdd14ac[_0xb280('0x54')](_0x1ac593[_0x181fc5][_0xb280('0x61')])){_0xdd14ac[_0x1ac593[_0x181fc5][_0xb280('0x61')]]=needsEncapsulation(_0x1ac593[_0x181fc5][_0xb280('0x62')])?encapsulate(_0x1ac593[_0x181fc5]['question']):_0x1ac593[_0x181fc5][_0xb280('0x62')];}}var _0x3d2a4b=[],_0x1136d8={};for(var _0x413d4c=0x0,_0xeb71af=_0x19fa7b[_0xb280('0x2f')];_0x413d4c<_0xeb71af;_0x413d4c++){_0x1136d8={'ProjectId':_0x3d1d39[_0xb280('0x3d')]['id'],'SessionId':_0x19fa7b[_0x413d4c]['id'],'StartTime':moment(_0x19fa7b[_0x413d4c][_0xb280('0x5e')])[_0xb280('0x63')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0xf2b988=0x0,_0x2998a6=_0x1ac593[_0xb280('0x2f')];_0xf2b988<_0x2998a6;_0xf2b988++){if(_0x1ac593[_0xf2b988][_0xb280('0x64')]==_0x19fa7b[_0x413d4c]['id']&&_0xdd14ac[_0xb280('0x54')](_0x1ac593[_0xf2b988][_0xb280('0x61')])){_0x1136d8[_0xdd14ac[_0x1ac593[_0xf2b988][_0xb280('0x61')]]]=_0x1ac593[_0xf2b988][_0xb280('0x65')];}}for(var _0x357b64 in _0xdd14ac){if(!_0x1136d8[_0xb280('0x54')](_0xdd14ac[_0x357b64])){_0x1136d8[_0xdd14ac[_0x357b64]]=null;}}_0x3d2a4b['push'](_0x1136d8);}return _0x3d2a4b;}})['then'](function(_0x5bfe77){if(!_['isEmpty'](_0x5bfe77)){var _0x1ae14d=toCsv(_0x5bfe77);var _0x5683cd=Date['now']();fs[_0xb280('0x66')](util[_0xb280('0x63')](_0xb280('0x67'),_0x3d1d39[_0xb280('0x3d')]['id'],_0x5683cd),_0x1ae14d);_0x5859e9[_0xb280('0x68')](_0xb280('0x69'),_0xb280('0x6a')+util['format'](_0xb280('0x6b'),_0x3d1d39[_0xb280('0x3d')]['id'],_0x5683cd));_0x5859e9[_0xb280('0x68')]('Content-type',_0xb280('0x6c'));return _0x5859e9[_0xb280('0x6d')](util['format'](_0xb280('0x67'),_0x3d1d39[_0xb280('0x3d')]['id'],_0x5683cd));}else{return _0x5859e9[_0xb280('0x1f')](0xcc);}})[_0xb280('0x3f')](handleError(_0x5859e9,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index b5d5f53..3949031 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 _0x16d8=['path','rimraf','../../config/environment','exports','define','JscriptyProject','jscripty_projects','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x45b1aa,_0x5e290d){var _0x218b80=function(_0x26909b){while(--_0x26909b){_0x45b1aa['push'](_0x45b1aa['shift']());}};_0x218b80(++_0x5e290d);}(_0x16d8,0xa3));var _0x816d=function(_0x257ad7,_0x1c2ed8){_0x257ad7=_0x257ad7-0x0;var _0x437174=_0x16d8[_0x257ad7];return _0x437174;};'use strict';var _=require('lodash');var util=require(_0x816d('0x0'));var logger=require(_0x816d('0x1'))(_0x816d('0x2'));var moment=require(_0x816d('0x3'));var BPromise=require(_0x816d('0x4'));var rp=require(_0x816d('0x5'));var fs=require('fs');var path=require(_0x816d('0x6'));var rimraf=require(_0x816d('0x7'));var config=require(_0x816d('0x8'));var attributes=require('./jscriptyProject.attributes');module[_0x816d('0x9')]=function(_0x58d744,_0x39c8dc){return _0x58d744[_0x816d('0xa')](_0x816d('0xb'),attributes,{'tableName':_0x816d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa23f=['../../config/environment','exports','define','jscripty_projects','lodash','util','moment','bluebird','request-promise','path'];(function(_0x1562a9,_0x358875){var _0x29e945=function(_0x535cac){while(--_0x535cac){_0x1562a9['push'](_0x1562a9['shift']());}};_0x29e945(++_0x358875);}(_0xa23f,0x7c));var _0xfa23=function(_0x5976a0,_0x37db98){_0x5976a0=_0x5976a0-0x0;var _0x16762b=_0xa23f[_0x5976a0];return _0x16762b;};'use strict';var _=require(_0xfa23('0x0'));var util=require(_0xfa23('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfa23('0x2'));var BPromise=require(_0xfa23('0x3'));var rp=require(_0xfa23('0x4'));var fs=require('fs');var path=require(_0xfa23('0x5'));var rimraf=require('rimraf');var config=require(_0xfa23('0x6'));var attributes=require('./jscriptyProject.attributes');module[_0xfa23('0x7')]=function(_0x2df2f5,_0x4c3f4){return _0x2df2f5[_0xfa23('0x8')]('JscriptyProject',attributes,{'tableName':_0xfa23('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 2da664b..04f2f8f 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 _0x70e0=['code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3987ed,_0x2c7c9d){var _0x4ce590=function(_0x48a1bc){while(--_0x48a1bc){_0x3987ed['push'](_0x3987ed['shift']());}};_0x4ce590(++_0x2c7c9d);}(_0x70e0,0x17b));var _0x070e=function(_0xefa64b,_0x394b8a){_0xefa64b=_0xefa64b-0x0;var _0x2e4901=_0x70e0[_0xefa64b];return _0x2e4901;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','JscriptyProject,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x1cadee,_0x3d2e16){var _0x26e110=function(_0x1df133){while(--_0x1df133){_0x1cadee['push'](_0x1cadee['shift']());}};_0x26e110(++_0x3d2e16);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'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']('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('JscriptyProject,\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')]('JscriptyProject,\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')]('JscriptyProject,\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/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 19c2543..c18a223 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 _0xa993=['post','create','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','get','/describe'];(function(_0x1308d4,_0x459abf){var _0x143718=function(_0x5f0478){while(--_0x5f0478){_0x1308d4['push'](_0x1308d4['shift']());}};_0x143718(++_0x459abf);}(_0xa993,0x142));var _0x3a99=function(_0x2c5d2b,_0x3067e0){_0x2c5d2b=_0x2c5d2b-0x0;var _0x4fedd3=_0xa993[_0x2c5d2b];return _0x4fedd3;};'use strict';var multer=require(_0x3a99('0x0'));var util=require(_0x3a99('0x1'));var path=require(_0x3a99('0x2'));var timeout=require(_0x3a99('0x3'));var express=require(_0x3a99('0x4'));var router=express[_0x3a99('0x5')]();var fs_extra=require(_0x3a99('0x6'));var auth=require(_0x3a99('0x7'));var interaction=require(_0x3a99('0x8'));var config=require(_0x3a99('0x9'));var controller=require(_0x3a99('0xa'));router['get']('/',auth[_0x3a99('0xb')](),controller['index']);router[_0x3a99('0xc')](_0x3a99('0xd'),auth[_0x3a99('0xb')](),controller['describe']);router['get']('/:id',auth[_0x3a99('0xb')](),controller['show']);router[_0x3a99('0xe')]('/',auth[_0x3a99('0xb')](),controller[_0x3a99('0xf')]);router['put']('/:id',auth[_0x3a99('0xb')](),controller[_0x3a99('0x10')]);router[_0x3a99('0x11')](_0x3a99('0x12'),auth['isAuthenticated'](),controller[_0x3a99('0x13')]);module[_0x3a99('0x14')]=router; \ No newline at end of file +var _0x086e=['../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','index','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x17c1da,_0x36ecce){var _0x5552f5=function(_0x1cfc88){while(--_0x1cfc88){_0x17c1da['push'](_0x17c1da['shift']());}};_0x5552f5(++_0x36ecce);}(_0x086e,0x127));var _0xe086=function(_0x7cf8eb,_0x5a470e){_0x7cf8eb=_0x7cf8eb-0x0;var _0x24e417=_0x086e[_0x7cf8eb];return _0x24e417;};'use strict';var multer=require(_0xe086('0x0'));var util=require('util');var path=require(_0xe086('0x1'));var timeout=require(_0xe086('0x2'));var express=require(_0xe086('0x3'));var router=express[_0xe086('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe086('0x5'));var config=require(_0xe086('0x6'));var controller=require(_0xe086('0x7'));router[_0xe086('0x8')]('/',auth['isAuthenticated'](),controller[_0xe086('0x9')]);router['get']('/describe',auth[_0xe086('0xa')](),controller[_0xe086('0xb')]);router[_0xe086('0x8')](_0xe086('0xc'),auth['isAuthenticated'](),controller[_0xe086('0xd')]);router[_0xe086('0xe')]('/',auth[_0xe086('0xa')](),controller[_0xe086('0xf')]);router[_0xe086('0x10')](_0xe086('0xc'),auth['isAuthenticated'](),controller[_0xe086('0x11')]);router['delete'](_0xe086('0xc'),auth[_0xe086('0xa')](),controller[_0xe086('0x12')]);module[_0xe086('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 264db30..9654d19 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(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x7a54,0x106));var _0x47a5=function(_0x1a854f,_0xe870ee){_0x1a854f=_0x1a854f-0x0;var _0x5e3743=_0x7a54[_0x1a854f];return _0x5e3743;};'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(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7a54,0x106));var _0x47a5=function(_0x7d888d,_0x6fecb2){_0x7d888d=_0x7d888d-0x0;var _0x30c06a=_0x7a54[_0x7d888d];return _0x30c06a;};'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 97f15b0..56b22cf 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 _0xe787=['update','destroy','error','stack','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','merge','name','filter','options','then','includeAll','include','findAll','rows','find','create','body','params','describe','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','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','offset','undefined','count','limit','set','Content-Range','apply','reject','save'];(function(_0x4e4a9c,_0x425697){var _0x3405c7=function(_0x2a5d61){while(--_0x2a5d61){_0x4e4a9c['push'](_0x4e4a9c['shift']());}};_0x3405c7(++_0x425697);}(_0xe787,0x153));var _0x7e78=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xe787[_0x2d2c16];return _0x53f2fb;};'use strict';var emlformat=require(_0x7e78('0x0'));var rimraf=require(_0x7e78('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7e78('0x2'));var rp=require(_0x7e78('0x3'));var moment=require(_0x7e78('0x4'));var BPromise=require(_0x7e78('0x5'));var Mustache=require('mustache');var util=require(_0x7e78('0x6'));var path=require('path');var sox=require(_0x7e78('0x7'));var csv=require(_0x7e78('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7e78('0x9'));var _=require(_0x7e78('0xa'));var squel=require(_0x7e78('0xb'));var crypto=require(_0x7e78('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7e78('0xd'));var toCsv=require(_0x7e78('0x8'));var querystring=require(_0x7e78('0xe'));var Papa=require(_0x7e78('0xf'));var Redis=require('ioredis');var authService=require(_0x7e78('0x10'));var qs=require(_0x7e78('0x11'));var as=require(_0x7e78('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7e78('0x13'))(_0x7e78('0x14'));var utils=require(_0x7e78('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7e78('0x16'));var db=require(_0x7e78('0x17'))['db'];function respondWithStatusCode(_0x282c15,_0x1dd9ba){_0x1dd9ba=_0x1dd9ba||0xcc;return function(_0x2d0840){if(_0x2d0840){return _0x282c15[_0x7e78('0x18')](_0x1dd9ba);}return _0x282c15[_0x7e78('0x19')](_0x1dd9ba)[_0x7e78('0x1a')]();};}function respondWithResult(_0x47db97,_0x1d5e95){_0x1d5e95=_0x1d5e95||0xc8;return function(_0x6259a6){if(_0x6259a6){return _0x47db97[_0x7e78('0x19')](_0x1d5e95)['json'](_0x6259a6);}};}function respondWithFilteredResult(_0x4286e9,_0x53e22c){return function(_0x4b6f77){if(_0x4b6f77){var _0x4ff55e=typeof _0x53e22c[_0x7e78('0x1b')]==='undefined'&&typeof _0x53e22c['limit']===_0x7e78('0x1c');var _0x1b0322=_0x4b6f77['count'];var _0x5c2558=_0x4ff55e?0x0:_0x53e22c[_0x7e78('0x1b')];var _0x541572=_0x4ff55e?_0x4b6f77[_0x7e78('0x1d')]:_0x53e22c[_0x7e78('0x1b')]+_0x53e22c[_0x7e78('0x1e')];var _0x4f381f;if(_0x541572>=_0x1b0322){_0x541572=_0x1b0322;_0x4f381f=0xc8;}else{_0x4f381f=0xce;}_0x4286e9[_0x7e78('0x19')](_0x4f381f);return _0x4286e9[_0x7e78('0x1f')](_0x7e78('0x20'),_0x5c2558+'-'+_0x541572+'/'+_0x1b0322)['json'](_0x4b6f77);}return null;};}function patchUpdates(_0xbd5a53){return function(_0x5077cd){try{jsonpatch[_0x7e78('0x21')](_0x5077cd,_0xbd5a53,!![]);}catch(_0x164c63){return BPromise[_0x7e78('0x22')](_0x164c63);}return _0x5077cd[_0x7e78('0x23')]();};}function saveUpdates(_0x8a4a76,_0x1333c2){return function(_0x4f6ba3){if(_0x4f6ba3){return _0x4f6ba3[_0x7e78('0x24')](_0x8a4a76)['then'](function(_0x11be76){return _0x11be76;});}return null;};}function removeEntity(_0x5274c2,_0x4fd7be){return function(_0x5efc4b){if(_0x5efc4b){return _0x5efc4b[_0x7e78('0x25')]()['then'](function(){_0x5274c2[_0x7e78('0x19')](0xcc)[_0x7e78('0x1a')]();});}};}function handleEntityNotFound(_0x149d87,_0x529035){return function(_0x21abf9){if(!_0x21abf9){_0x149d87['sendStatus'](0x194);}return _0x21abf9;};}function handleError(_0x4566ad,_0x13cba6){_0x13cba6=_0x13cba6||0x1f4;return function(_0x5d7f4e){logger[_0x7e78('0x26')](_0x5d7f4e[_0x7e78('0x27')]);if(_0x5d7f4e['name']){delete _0x5d7f4e['name'];}_0x4566ad[_0x7e78('0x19')](_0x13cba6)[_0x7e78('0x28')](_0x5d7f4e);};}exports[_0x7e78('0x29')]=function(_0x16e19d,_0x115851){var _0x36e2ae={},_0x1ee59d={},_0x313f7a={'count':0x0,'rows':[]};var _0x424d07=_[_0x7e78('0x2a')](db[_0x7e78('0x2b')][_0x7e78('0x2c')],function(_0x4b44be){return{'name':_0x4b44be[_0x7e78('0x2d')],'type':_0x4b44be[_0x7e78('0x2e')][_0x7e78('0x2f')]};});_0x1ee59d[_0x7e78('0x30')]=_[_0x7e78('0x2a')](_0x424d07,'name');_0x1ee59d[_0x7e78('0x31')]=_[_0x7e78('0x32')](_0x16e19d[_0x7e78('0x31')]);_0x1ee59d[_0x7e78('0x33')]=_[_0x7e78('0x34')](_0x1ee59d[_0x7e78('0x30')],_0x1ee59d['query']);_0x36e2ae['attributes']=_[_0x7e78('0x34')](_0x1ee59d[_0x7e78('0x30')],qs['fields'](_0x16e19d['query'][_0x7e78('0x35')]));_0x36e2ae['attributes']=_0x36e2ae[_0x7e78('0x36')][_0x7e78('0x37')]?_0x36e2ae[_0x7e78('0x36')]:_0x1ee59d[_0x7e78('0x30')];if(!_0x16e19d[_0x7e78('0x31')]['hasOwnProperty'](_0x7e78('0x38'))){_0x36e2ae[_0x7e78('0x1e')]=qs[_0x7e78('0x1e')](_0x16e19d[_0x7e78('0x31')]['limit']);_0x36e2ae['offset']=qs[_0x7e78('0x1b')](_0x16e19d['query'][_0x7e78('0x1b')]);}_0x36e2ae[_0x7e78('0x39')]=qs[_0x7e78('0x3a')](_0x16e19d[_0x7e78('0x31')][_0x7e78('0x3a')]);_0x36e2ae[_0x7e78('0x3b')]=qs['filters'](_['pick'](_0x16e19d['query'],_0x1ee59d[_0x7e78('0x33')]),_0x424d07);if(_0x16e19d[_0x7e78('0x31')]['filter']){_0x36e2ae[_0x7e78('0x3b')]=_[_0x7e78('0x3c')](_0x36e2ae[_0x7e78('0x3b')],{'$or':_[_0x7e78('0x2a')](_0x424d07,function(_0x3fa492){if(_0x3fa492['type']!=='VIRTUAL'){var _0x4230bd={};_0x4230bd[_0x3fa492[_0x7e78('0x3d')]]={'$like':'%'+_0x16e19d[_0x7e78('0x31')][_0x7e78('0x3e')]+'%'};return _0x4230bd;}})});}_0x36e2ae=_[_0x7e78('0x3c')]({},_0x36e2ae,_0x16e19d[_0x7e78('0x3f')]);var _0x52bc15={'where':_0x36e2ae[_0x7e78('0x3b')]};return db[_0x7e78('0x2b')][_0x7e78('0x1d')](_0x52bc15)[_0x7e78('0x40')](function(_0x1cc69a){_0x313f7a[_0x7e78('0x1d')]=_0x1cc69a;if(_0x16e19d['query'][_0x7e78('0x41')]){_0x36e2ae[_0x7e78('0x42')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x7e78('0x43')](_0x36e2ae);})['then'](function(_0x5a77b6){_0x313f7a[_0x7e78('0x44')]=_0x5a77b6;return _0x313f7a;})[_0x7e78('0x40')](respondWithFilteredResult(_0x115851,_0x36e2ae))['catch'](handleError(_0x115851,null));};exports['show']=function(_0x552c8e,_0x69b233){var _0x5219ab={'raw':!![],'where':{'id':_0x552c8e['params']['id']}},_0x1ab118={};_0x1ab118['model']=_[_0x7e78('0x32')](db[_0x7e78('0x2b')][_0x7e78('0x2c')]);_0x1ab118[_0x7e78('0x31')]=_[_0x7e78('0x32')](_0x552c8e['query']);_0x1ab118[_0x7e78('0x33')]=_['intersection'](_0x1ab118[_0x7e78('0x30')],_0x1ab118['query']);_0x5219ab[_0x7e78('0x36')]=_['intersection'](_0x1ab118[_0x7e78('0x30')],qs[_0x7e78('0x35')](_0x552c8e[_0x7e78('0x31')][_0x7e78('0x35')]));_0x5219ab[_0x7e78('0x36')]=_0x5219ab[_0x7e78('0x36')][_0x7e78('0x37')]?_0x5219ab[_0x7e78('0x36')]:_0x1ab118[_0x7e78('0x30')];if(_0x552c8e[_0x7e78('0x31')]['includeAll']){_0x5219ab[_0x7e78('0x42')]=[{'all':!![]}];}_0x5219ab=_[_0x7e78('0x3c')]({},_0x5219ab,_0x552c8e[_0x7e78('0x3f')]);return db[_0x7e78('0x2b')][_0x7e78('0x45')](_0x5219ab)[_0x7e78('0x40')](handleEntityNotFound(_0x69b233,null))['then'](respondWithResult(_0x69b233,null))['catch'](handleError(_0x69b233,null));};exports[_0x7e78('0x46')]=function(_0x119df6,_0x3f8922){return db['JscriptyQuestionReport'][_0x7e78('0x46')](_0x119df6[_0x7e78('0x47')],{})[_0x7e78('0x40')](respondWithResult(_0x3f8922,0xc9))['catch'](handleError(_0x3f8922,null));};exports[_0x7e78('0x24')]=function(_0x27a80a,_0x28e07e){if(_0x27a80a[_0x7e78('0x47')]['id']){delete _0x27a80a[_0x7e78('0x47')]['id'];}return db[_0x7e78('0x2b')]['find']({'where':{'id':_0x27a80a[_0x7e78('0x48')]['id']}})[_0x7e78('0x40')](handleEntityNotFound(_0x28e07e,null))[_0x7e78('0x40')](saveUpdates(_0x27a80a[_0x7e78('0x47')],null))[_0x7e78('0x40')](respondWithResult(_0x28e07e,null))['catch'](handleError(_0x28e07e,null));};exports[_0x7e78('0x25')]=function(_0x1509ff,_0x2b4aac){return db[_0x7e78('0x2b')][_0x7e78('0x45')]({'where':{'id':_0x1509ff[_0x7e78('0x48')]['id']}})['then'](handleEntityNotFound(_0x2b4aac,null))[_0x7e78('0x40')](removeEntity(_0x2b4aac,null))['catch'](handleError(_0x2b4aac,null));};exports[_0x7e78('0x49')]=function(_0x428575,_0xf8d57b){return db['JscriptyQuestionReport'][_0x7e78('0x49')]()['then'](respondWithResult(_0xf8d57b,null))[_0x7e78('0x4a')](handleError(_0xf8d57b,null));}; \ No newline at end of file +var _0x74fa=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','JscriptyQuestionReport','rawAttributes','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','include','rows','catch','params','includeAll','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x33d338,_0x4e8514){var _0x1c8966=function(_0x1ae1df){while(--_0x1ae1df){_0x33d338['push'](_0x33d338['shift']());}};_0x1c8966(++_0x4e8514);}(_0x74fa,0x85));var _0xa74f=function(_0x13cf90,_0x2ce220){_0x13cf90=_0x13cf90-0x0;var _0x5ad3bf=_0x74fa[_0x13cf90];return _0x5ad3bf;};'use strict';var emlformat=require(_0xa74f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa74f('0x1'));var rp=require(_0xa74f('0x2'));var moment=require(_0xa74f('0x3'));var BPromise=require(_0xa74f('0x4'));var Mustache=require(_0xa74f('0x5'));var util=require(_0xa74f('0x6'));var path=require('path');var sox=require(_0xa74f('0x7'));var csv=require(_0xa74f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa74f('0x9'));var _=require(_0xa74f('0xa'));var squel=require(_0xa74f('0xb'));var crypto=require(_0xa74f('0xc'));var jsforce=require(_0xa74f('0xd'));var deskjs=require(_0xa74f('0xe'));var toCsv=require(_0xa74f('0x8'));var querystring=require(_0xa74f('0xf'));var Papa=require(_0xa74f('0x10'));var Redis=require(_0xa74f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa74f('0x12'));var as=require(_0xa74f('0x13'));var hardwareService=require(_0xa74f('0x14'));var logger=require(_0xa74f('0x15'))(_0xa74f('0x16'));var utils=require(_0xa74f('0x17'));var config=require(_0xa74f('0x18'));var licenseUtil=require(_0xa74f('0x19'));var db=require(_0xa74f('0x1a'))['db'];function respondWithStatusCode(_0x416042,_0x2a577d){_0x2a577d=_0x2a577d||0xcc;return function(_0x502e79){if(_0x502e79){return _0x416042[_0xa74f('0x1b')](_0x2a577d);}return _0x416042[_0xa74f('0x1c')](_0x2a577d)[_0xa74f('0x1d')]();};}function respondWithResult(_0x345743,_0x564355){_0x564355=_0x564355||0xc8;return function(_0x478455){if(_0x478455){return _0x345743['status'](_0x564355)['json'](_0x478455);}};}function respondWithFilteredResult(_0x5235c1,_0x26a590){return function(_0x266534){if(_0x266534){var _0x238887=typeof _0x26a590[_0xa74f('0x1e')]===_0xa74f('0x1f')&&typeof _0x26a590['limit']===_0xa74f('0x1f');var _0x2794fa=_0x266534['count'];var _0x5006df=_0x238887?0x0:_0x26a590['offset'];var _0x359bdf=_0x238887?_0x266534[_0xa74f('0x20')]:_0x26a590[_0xa74f('0x1e')]+_0x26a590[_0xa74f('0x21')];var _0x519fb3;if(_0x359bdf>=_0x2794fa){_0x359bdf=_0x2794fa;_0x519fb3=0xc8;}else{_0x519fb3=0xce;}_0x5235c1[_0xa74f('0x1c')](_0x519fb3);return _0x5235c1['set'](_0xa74f('0x22'),_0x5006df+'-'+_0x359bdf+'/'+_0x2794fa)[_0xa74f('0x23')](_0x266534);}return null;};}function patchUpdates(_0x2d0221){return function(_0x5a14a7){try{jsonpatch['apply'](_0x5a14a7,_0x2d0221,!![]);}catch(_0x55c5ca){return BPromise[_0xa74f('0x24')](_0x55c5ca);}return _0x5a14a7[_0xa74f('0x25')]();};}function saveUpdates(_0x1d2c08,_0x1fa5b9){return function(_0x3984d1){if(_0x3984d1){return _0x3984d1[_0xa74f('0x26')](_0x1d2c08)[_0xa74f('0x27')](function(_0xd03d80){return _0xd03d80;});}return null;};}function removeEntity(_0x32557e,_0x2e21a7){return function(_0x4c626e){if(_0x4c626e){return _0x4c626e[_0xa74f('0x28')]()[_0xa74f('0x27')](function(){_0x32557e[_0xa74f('0x1c')](0xcc)[_0xa74f('0x1d')]();});}};}function handleEntityNotFound(_0x2cd931,_0x4ce8aa){return function(_0x43289e){if(!_0x43289e){_0x2cd931['sendStatus'](0x194);}return _0x43289e;};}function handleError(_0x4452e1,_0x429327){_0x429327=_0x429327||0x1f4;return function(_0x5b2372){logger[_0xa74f('0x29')](_0x5b2372[_0xa74f('0x2a')]);if(_0x5b2372['name']){delete _0x5b2372[_0xa74f('0x2b')];}_0x4452e1[_0xa74f('0x1c')](_0x429327)[_0xa74f('0x2c')](_0x5b2372);};}exports['index']=function(_0x3d137d,_0x23d371){var _0x61304d={},_0x45bce3={},_0x5e336d={'count':0x0,'rows':[]};var _0x53db66=_['map'](db[_0xa74f('0x2d')][_0xa74f('0x2e')],function(_0x4f2a53){return{'name':_0x4f2a53['fieldName'],'type':_0x4f2a53[_0xa74f('0x2f')][_0xa74f('0x30')]};});_0x45bce3[_0xa74f('0x31')]=_[_0xa74f('0x32')](_0x53db66,'name');_0x45bce3['query']=_[_0xa74f('0x33')](_0x3d137d[_0xa74f('0x34')]);_0x45bce3[_0xa74f('0x35')]=_['intersection'](_0x45bce3[_0xa74f('0x31')],_0x45bce3['query']);_0x61304d[_0xa74f('0x36')]=_[_0xa74f('0x37')](_0x45bce3['model'],qs['fields'](_0x3d137d[_0xa74f('0x34')][_0xa74f('0x38')]));_0x61304d[_0xa74f('0x36')]=_0x61304d[_0xa74f('0x36')][_0xa74f('0x39')]?_0x61304d[_0xa74f('0x36')]:_0x45bce3[_0xa74f('0x31')];if(!_0x3d137d['query']['hasOwnProperty'](_0xa74f('0x3a'))){_0x61304d[_0xa74f('0x21')]=qs[_0xa74f('0x21')](_0x3d137d[_0xa74f('0x34')][_0xa74f('0x21')]);_0x61304d[_0xa74f('0x1e')]=qs[_0xa74f('0x1e')](_0x3d137d[_0xa74f('0x34')]['offset']);}_0x61304d['order']=qs['sort'](_0x3d137d[_0xa74f('0x34')][_0xa74f('0x3b')]);_0x61304d[_0xa74f('0x3c')]=qs[_0xa74f('0x35')](_[_0xa74f('0x3d')](_0x3d137d['query'],_0x45bce3['filters']),_0x53db66);if(_0x3d137d[_0xa74f('0x34')]['filter']){_0x61304d['where']=_[_0xa74f('0x3e')](_0x61304d[_0xa74f('0x3c')],{'$or':_[_0xa74f('0x32')](_0x53db66,function(_0x5a1034){if(_0x5a1034[_0xa74f('0x2f')]!==_0xa74f('0x3f')){var _0x3d569a={};_0x3d569a[_0x5a1034[_0xa74f('0x2b')]]={'$like':'%'+_0x3d137d[_0xa74f('0x34')][_0xa74f('0x40')]+'%'};return _0x3d569a;}})});}_0x61304d=_['merge']({},_0x61304d,_0x3d137d['options']);var _0xf61694={'where':_0x61304d['where']};return db[_0xa74f('0x2d')][_0xa74f('0x20')](_0xf61694)[_0xa74f('0x27')](function(_0x1de982){_0x5e336d[_0xa74f('0x20')]=_0x1de982;if(_0x3d137d[_0xa74f('0x34')]['includeAll']){_0x61304d[_0xa74f('0x41')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x61304d);})['then'](function(_0x36c121){_0x5e336d[_0xa74f('0x42')]=_0x36c121;return _0x5e336d;})[_0xa74f('0x27')](respondWithFilteredResult(_0x23d371,_0x61304d))[_0xa74f('0x43')](handleError(_0x23d371,null));};exports['show']=function(_0x2e63bf,_0x3e1eb2){var _0x21bd46={'raw':!![],'where':{'id':_0x2e63bf[_0xa74f('0x44')]['id']}},_0x36ca76={};_0x36ca76[_0xa74f('0x31')]=_['keys'](db[_0xa74f('0x2d')][_0xa74f('0x2e')]);_0x36ca76[_0xa74f('0x34')]=_[_0xa74f('0x33')](_0x2e63bf['query']);_0x36ca76[_0xa74f('0x35')]=_['intersection'](_0x36ca76[_0xa74f('0x31')],_0x36ca76[_0xa74f('0x34')]);_0x21bd46['attributes']=_[_0xa74f('0x37')](_0x36ca76[_0xa74f('0x31')],qs['fields'](_0x2e63bf[_0xa74f('0x34')][_0xa74f('0x38')]));_0x21bd46[_0xa74f('0x36')]=_0x21bd46['attributes']['length']?_0x21bd46[_0xa74f('0x36')]:_0x36ca76[_0xa74f('0x31')];if(_0x2e63bf[_0xa74f('0x34')][_0xa74f('0x45')]){_0x21bd46['include']=[{'all':!![]}];}_0x21bd46=_[_0xa74f('0x3e')]({},_0x21bd46,_0x2e63bf['options']);return db[_0xa74f('0x2d')][_0xa74f('0x46')](_0x21bd46)[_0xa74f('0x27')](handleEntityNotFound(_0x3e1eb2,null))['then'](respondWithResult(_0x3e1eb2,null))['catch'](handleError(_0x3e1eb2,null));};exports[_0xa74f('0x47')]=function(_0x160661,_0x46f235){return db[_0xa74f('0x2d')]['create'](_0x160661[_0xa74f('0x48')],{})[_0xa74f('0x27')](respondWithResult(_0x46f235,0xc9))[_0xa74f('0x43')](handleError(_0x46f235,null));};exports[_0xa74f('0x26')]=function(_0x4cd12b,_0x26b336){if(_0x4cd12b[_0xa74f('0x48')]['id']){delete _0x4cd12b[_0xa74f('0x48')]['id'];}return db[_0xa74f('0x2d')][_0xa74f('0x46')]({'where':{'id':_0x4cd12b[_0xa74f('0x44')]['id']}})[_0xa74f('0x27')](handleEntityNotFound(_0x26b336,null))[_0xa74f('0x27')](saveUpdates(_0x4cd12b[_0xa74f('0x48')],null))['then'](respondWithResult(_0x26b336,null))[_0xa74f('0x43')](handleError(_0x26b336,null));};exports[_0xa74f('0x28')]=function(_0x5de12e,_0x85326e){return db[_0xa74f('0x2d')]['find']({'where':{'id':_0x5de12e['params']['id']}})[_0xa74f('0x27')](handleEntityNotFound(_0x85326e,null))[_0xa74f('0x27')](removeEntity(_0x85326e,null))[_0xa74f('0x43')](handleError(_0x85326e,null));};exports[_0xa74f('0x49')]=function(_0x13f17a,_0x156e6d){return db[_0xa74f('0x2d')]['describe']()['then'](respondWithResult(_0x156e6d,null))[_0xa74f('0x43')](handleError(_0x156e6d,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 9cf3f1a..6cffeb3 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 _0x8732=['report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','path','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport'];(function(_0x1857d0,_0x6eade0){var _0x3e3c46=function(_0x3915b8){while(--_0x3915b8){_0x1857d0['push'](_0x1857d0['shift']());}};_0x3e3c46(++_0x6eade0);}(_0x8732,0x181));var _0x2873=function(_0x2f8125,_0x260435){_0x2f8125=_0x2f8125-0x0;var _0x332dfb=_0x8732[_0x2f8125];return _0x332dfb;};'use strict';var _=require(_0x2873('0x0'));var util=require(_0x2873('0x1'));var logger=require(_0x2873('0x2'))(_0x2873('0x3'));var moment=require(_0x2873('0x4'));var BPromise=require(_0x2873('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2873('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2873('0x7'));module[_0x2873('0x8')]=function(_0x6a7c6a,_0x59d16c){return _0x6a7c6a[_0x2873('0x9')](_0x2873('0xa'),attributes,{'tableName':_0x2873('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x62f7=['rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','util','../../config/logger','api','path'];(function(_0x152fc4,_0x3147cc){var _0x38cf4f=function(_0x1f567b){while(--_0x1f567b){_0x152fc4['push'](_0x152fc4['shift']());}};_0x38cf4f(++_0x3147cc);}(_0x62f7,0x1ac));var _0x762f=function(_0x180a35,_0x5b71c9){_0x180a35=_0x180a35-0x0;var _0x2faffb=_0x62f7[_0x180a35];return _0x2faffb;};'use strict';var _=require('lodash');var util=require(_0x762f('0x0'));var logger=require(_0x762f('0x1'))(_0x762f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x762f('0x3'));var rimraf=require(_0x762f('0x4'));var config=require(_0x762f('0x5'));var attributes=require(_0x762f('0x6'));module[_0x762f('0x7')]=function(_0x48523c,_0x52e4d9){return _0x48523c['define'](_0x762f('0x8'),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 d13df0c..56fb8b3 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 _0x91e2=['JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x91e2,0x1e6));var _0x291e=function(_0x1ee942,_0x819591){_0x1ee942=_0x1ee942-0x0;var _0x6b6770=_0x91e2[_0x1ee942];return _0x6b6770;};'use strict';var _=require(_0x291e('0x0'));var util=require(_0x291e('0x1'));var moment=require('moment');var BPromise=require(_0x291e('0x2'));var rs=require(_0x291e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x291e('0x4'));var logger=require(_0x291e('0x5'))(_0x291e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x291e('0x7')][_0x291e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3b0360,_0x42cd45,_0x2aadb0){return new BPromise(function(_0x5e1de4,_0x1670af){return client[_0x291e('0x9')](_0x3b0360,_0x2aadb0)[_0x291e('0xa')](function(_0xbc49a9){logger['info'](_0x291e('0xb'),_0x42cd45,_0x291e('0xc'));logger[_0x291e('0xd')](_0x291e('0xe'),_0x42cd45,'request\x20sent',JSON[_0x291e('0xf')](_0xbc49a9));if(_0xbc49a9[_0x291e('0x10')]){if(_0xbc49a9[_0x291e('0x10')]['code']===0x1f4){logger[_0x291e('0x10')](_0x291e('0xb'),_0x42cd45,_0xbc49a9['error'][_0x291e('0x11')]);return _0x1670af(_0xbc49a9['error'][_0x291e('0x11')]);}logger['error'](_0x291e('0xb'),_0x42cd45,_0xbc49a9[_0x291e('0x10')][_0x291e('0x11')]);return _0x5e1de4(_0xbc49a9['error'][_0x291e('0x11')]);}else{logger[_0x291e('0x12')](_0x291e('0xb'),_0x42cd45,'request\x20sent');_0x5e1de4(_0xbc49a9['result'][_0x291e('0x11')]);}})[_0x291e('0x13')](function(_0x83225c){logger['error'](_0x291e('0xb'),_0x42cd45,_0x83225c);_0x1670af(_0x83225c);});});} \ No newline at end of file +var _0xdfaf=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','result','lodash'];(function(_0x395bfe,_0x4db521){var _0x35c81c=function(_0x484a1b){while(--_0x484a1b){_0x395bfe['push'](_0x395bfe['shift']());}};_0x35c81c(++_0x4db521);}(_0xdfaf,0x1b8));var _0xfdfa=function(_0x4259eb,_0x19fa09){_0x4259eb=_0x4259eb-0x0;var _0x3cb67a=_0xdfaf[_0x4259eb];return _0x3cb67a;};'use strict';var _=require(_0xfdfa('0x0'));var util=require('util');var moment=require(_0xfdfa('0x1'));var BPromise=require(_0xfdfa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfdfa('0x3'));var db=require(_0xfdfa('0x4'))['db'];var utils=require(_0xfdfa('0x5'));var logger=require(_0xfdfa('0x6'))(_0xfdfa('0x7'));var config=require(_0xfdfa('0x8'));var jayson=require(_0xfdfa('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x45c55e,_0x8d1844,_0x5b5511){return new BPromise(function(_0x1eae66,_0x391539){return client[_0xfdfa('0xa')](_0x45c55e,_0x5b5511)[_0xfdfa('0xb')](function(_0x133237){logger[_0xfdfa('0xc')](_0xfdfa('0xd'),_0x8d1844,'request\x20sent');logger[_0xfdfa('0xe')](_0xfdfa('0xf'),_0x8d1844,_0xfdfa('0x10'),JSON[_0xfdfa('0x11')](_0x133237));if(_0x133237[_0xfdfa('0x12')]){if(_0x133237[_0xfdfa('0x12')][_0xfdfa('0x13')]===0x1f4){logger[_0xfdfa('0x12')](_0xfdfa('0xd'),_0x8d1844,_0x133237[_0xfdfa('0x12')]['message']);return _0x391539(_0x133237[_0xfdfa('0x12')]['message']);}logger[_0xfdfa('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x8d1844,_0x133237[_0xfdfa('0x12')]['message']);return _0x1eae66(_0x133237['error']['message']);}else{logger[_0xfdfa('0xc')](_0xfdfa('0xd'),_0x8d1844,_0xfdfa('0x10'));_0x1eae66(_0x133237[_0xfdfa('0x14')]['message']);}})['catch'](function(_0x2e3f84){logger['error'](_0xfdfa('0xd'),_0x8d1844,_0x2e3f84);_0x391539(_0x2e3f84);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 871fd0f..d3ac3d0 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 _0x449d=['util','express','fs-extra','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/describe','describe','/:id','/:id/questions','create','put','delete','destroy','exports','multer'];(function(_0x43a341,_0x51f9ef){var _0x48234e=function(_0xe5176b){while(--_0xe5176b){_0x43a341['push'](_0x43a341['shift']());}};_0x48234e(++_0x51f9ef);}(_0x449d,0x1d3));var _0xd449=function(_0x5c2eac,_0x566843){_0x5c2eac=_0x5c2eac-0x0;var _0x7f47f9=_0x449d[_0x5c2eac];return _0x7f47f9;};'use strict';var multer=require(_0xd449('0x0'));var util=require(_0xd449('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd449('0x2'));var router=express['Router']();var fs_extra=require(_0xd449('0x3'));var auth=require(_0xd449('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd449('0x5'));var controller=require(_0xd449('0x6'));router[_0xd449('0x7')]('/',auth[_0xd449('0x8')](),controller['index']);router[_0xd449('0x7')](_0xd449('0x9'),auth[_0xd449('0x8')](),controller[_0xd449('0xa')]);router[_0xd449('0x7')](_0xd449('0xb'),auth[_0xd449('0x8')](),controller['show']);router['get'](_0xd449('0xc'),auth['isAuthenticated'](),controller['getQuestions']);router['post']('/',auth['isAuthenticated'](),controller[_0xd449('0xd')]);router[_0xd449('0xe')](_0xd449('0xb'),auth[_0xd449('0x8')](),controller['update']);router[_0xd449('0xf')](_0xd449('0xb'),auth[_0xd449('0x8')](),controller[_0xd449('0x10')]);module[_0xd449('0x11')]=router; \ No newline at end of file +var _0x1c46=['path','express','Router','../../components/interaction/service','./jscriptySessionReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','multer','util'];(function(_0xb7b878,_0x5c3b92){var _0x3c84b9=function(_0x21d5a2){while(--_0x21d5a2){_0xb7b878['push'](_0xb7b878['shift']());}};_0x3c84b9(++_0x5c3b92);}(_0x1c46,0x82));var _0x61c4=function(_0x3d09db,_0x40700c){_0x3d09db=_0x3d09db-0x0;var _0x400be2=_0x1c46[_0x3d09db];return _0x400be2;};'use strict';var multer=require(_0x61c4('0x0'));var util=require(_0x61c4('0x1'));var path=require(_0x61c4('0x2'));var timeout=require('connect-timeout');var express=require(_0x61c4('0x3'));var router=express[_0x61c4('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x61c4('0x5'));var config=require('../../config/environment');var controller=require(_0x61c4('0x6'));router['get']('/',auth[_0x61c4('0x7')](),controller[_0x61c4('0x8')]);router[_0x61c4('0x9')](_0x61c4('0xa'),auth[_0x61c4('0x7')](),controller[_0x61c4('0xb')]);router[_0x61c4('0x9')](_0x61c4('0xc'),auth[_0x61c4('0x7')](),controller[_0x61c4('0xd')]);router['get'](_0x61c4('0xe'),auth[_0x61c4('0x7')](),controller[_0x61c4('0xf')]);router[_0x61c4('0x10')]('/',auth[_0x61c4('0x7')](),controller[_0x61c4('0x11')]);router[_0x61c4('0x12')]('/:id',auth[_0x61c4('0x7')](),controller[_0x61c4('0x13')]);router[_0x61c4('0x14')]('/:id',auth[_0x61c4('0x7')](),controller[_0x61c4('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index de462ac..c3417f8 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 _0x5b0a=['exports','DATE','setDataValue','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize'];(function(_0x20dc17,_0xa28a0f){var _0x1260c5=function(_0x2d0fad){while(--_0x2d0fad){_0x20dc17['push'](_0x20dc17['shift']());}};_0x1260c5(++_0xa28a0f);}(_0x5b0a,0xcd));var _0xa5b0=function(_0x5c9eb9,_0x310556){_0x5c9eb9=_0x5c9eb9-0x0;var _0x4a983f=_0x5b0a[_0x5c9eb9];return _0x4a983f;};'use strict';var moment=require(_0xa5b0('0x0'));var Sequelize=require(_0xa5b0('0x1'));module[_0xa5b0('0x2')]={'starttime':{'type':Sequelize[_0xa5b0('0x3')],'set':function(_0x243b81){this[_0xa5b0('0x4')]('starttime',_0x243b81);this[_0xa5b0('0x4')]('endtime',moment()[_0xa5b0('0x5')](_0xa5b0('0x6')));}},'endtime':{'type':Sequelize[_0xa5b0('0x3')]},'membername':{'type':Sequelize[_0xa5b0('0x7')]},'projectname':{'type':Sequelize[_0xa5b0('0x7')]},'queue':{'type':Sequelize[_0xa5b0('0x7')]},'uniqueid':{'type':Sequelize[_0xa5b0('0x7')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xa5b0('0x7')]},'completed':{'type':Sequelize[_0xa5b0('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0xe136=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','DATE','setDataValue','starttime'];(function(_0x5db3c3,_0x9b77be){var _0x34a8ca=function(_0xa70cb1){while(--_0xa70cb1){_0x5db3c3['push'](_0x5db3c3['shift']());}};_0x34a8ca(++_0x9b77be);}(_0xe136,0xaf));var _0x6e13=function(_0x4c0155,_0x4b631d){_0x4c0155=_0x4c0155-0x0;var _0x5e5136=_0xe136[_0x4c0155];return _0x5e5136;};'use strict';var moment=require(_0x6e13('0x0'));var Sequelize=require(_0x6e13('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x6e13('0x2')],'set':function(_0x1cbc26){this[_0x6e13('0x3')](_0x6e13('0x4'),_0x1cbc26);this[_0x6e13('0x3')](_0x6e13('0x5'),moment()[_0x6e13('0x6')](_0x6e13('0x7')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x6e13('0x8')]},'projectname':{'type':Sequelize[_0x6e13('0x8')]},'queue':{'type':Sequelize[_0x6e13('0x8')]},'uniqueid':{'type':Sequelize[_0x6e13('0x8')]},'calleridname':{'type':Sequelize[_0x6e13('0x8')]},'calleridnum':{'type':Sequelize[_0x6e13('0x8')]},'completed':{'type':Sequelize[_0x6e13('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 21816eb..d1c32c0 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 _0xcc23=['fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','filter','VIRTUAL','options','JscriptySessionReport','includeAll','rows','show','params','length','include','merge','catch','create','body','find','describe','getQuestions','findOne','pick','JscriptyQuestionReport','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs'];(function(_0xc3887d,_0x2e4625){var _0x56cc94=function(_0x2bc252){while(--_0x2bc252){_0xc3887d['push'](_0xc3887d['shift']());}};_0x56cc94(++_0x2e4625);}(_0xcc23,0x94));var _0x3cc2=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xcc23[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x3cc2('0x0'));var rimraf=require(_0x3cc2('0x1'));var zipdir=require(_0x3cc2('0x2'));var jsonpatch=require(_0x3cc2('0x3'));var rp=require(_0x3cc2('0x4'));var moment=require(_0x3cc2('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x3cc2('0x6'));var sox=require(_0x3cc2('0x7'));var csv=require(_0x3cc2('0x8'));var ejs=require(_0x3cc2('0x9'));var fs=require('fs');var fs_extra=require(_0x3cc2('0xa'));var _=require(_0x3cc2('0xb'));var squel=require(_0x3cc2('0xc'));var crypto=require(_0x3cc2('0xd'));var jsforce=require(_0x3cc2('0xe'));var deskjs=require(_0x3cc2('0xf'));var toCsv=require(_0x3cc2('0x8'));var querystring=require('querystring');var Papa=require(_0x3cc2('0x10'));var Redis=require(_0x3cc2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3cc2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3cc2('0x13'))(_0x3cc2('0x14'));var utils=require(_0x3cc2('0x15'));var config=require(_0x3cc2('0x16'));var licenseUtil=require(_0x3cc2('0x17'));var db=require(_0x3cc2('0x18'))['db'];function respondWithStatusCode(_0x4dab21,_0x4f45d0){_0x4f45d0=_0x4f45d0||0xcc;return function(_0x706cb7){if(_0x706cb7){return _0x4dab21[_0x3cc2('0x19')](_0x4f45d0);}return _0x4dab21[_0x3cc2('0x1a')](_0x4f45d0)[_0x3cc2('0x1b')]();};}function respondWithResult(_0x52a262,_0x57db15){_0x57db15=_0x57db15||0xc8;return function(_0x4f974){if(_0x4f974){return _0x52a262['status'](_0x57db15)[_0x3cc2('0x1c')](_0x4f974);}};}function respondWithFilteredResult(_0xcd7652,_0x5857e6){return function(_0x1e1a70){if(_0x1e1a70){var _0x37945f=typeof _0x5857e6[_0x3cc2('0x1d')]===_0x3cc2('0x1e')&&typeof _0x5857e6[_0x3cc2('0x1f')]===_0x3cc2('0x1e');var _0x6bcaf=_0x1e1a70[_0x3cc2('0x20')];var _0x911d81=_0x37945f?0x0:_0x5857e6[_0x3cc2('0x1d')];var _0x17e4d8=_0x37945f?_0x1e1a70['count']:_0x5857e6['offset']+_0x5857e6[_0x3cc2('0x1f')];var _0x2a94b4;if(_0x17e4d8>=_0x6bcaf){_0x17e4d8=_0x6bcaf;_0x2a94b4=0xc8;}else{_0x2a94b4=0xce;}_0xcd7652[_0x3cc2('0x1a')](_0x2a94b4);return _0xcd7652['set'](_0x3cc2('0x21'),_0x911d81+'-'+_0x17e4d8+'/'+_0x6bcaf)[_0x3cc2('0x1c')](_0x1e1a70);}return null;};}function patchUpdates(_0xe4e93){return function(_0x54ace7){try{jsonpatch['apply'](_0x54ace7,_0xe4e93,!![]);}catch(_0x22e255){return BPromise[_0x3cc2('0x22')](_0x22e255);}return _0x54ace7['save']();};}function saveUpdates(_0x14785f,_0xdfcd46){return function(_0x462daf){if(_0x462daf){return _0x462daf[_0x3cc2('0x23')](_0x14785f)[_0x3cc2('0x24')](function(_0x139c1d){return _0x139c1d;});}return null;};}function removeEntity(_0x153e21,_0x29676d){return function(_0xa367f5){if(_0xa367f5){return _0xa367f5[_0x3cc2('0x25')]()[_0x3cc2('0x24')](function(){_0x153e21[_0x3cc2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x430e2c,_0x2cc04a){return function(_0x41e52b){if(!_0x41e52b){_0x430e2c['sendStatus'](0x194);}return _0x41e52b;};}function handleError(_0x5a40a8,_0x44f6fa){_0x44f6fa=_0x44f6fa||0x1f4;return function(_0x2bca6a){logger[_0x3cc2('0x26')](_0x2bca6a[_0x3cc2('0x27')]);if(_0x2bca6a[_0x3cc2('0x28')]){delete _0x2bca6a[_0x3cc2('0x28')];}_0x5a40a8[_0x3cc2('0x1a')](_0x44f6fa)[_0x3cc2('0x29')](_0x2bca6a);};}exports['index']=function(_0xa7fd53,_0x26a083){var _0x377ca7={},_0x4f54fd={},_0x366289={'count':0x0,'rows':[]};var _0x5df6d7=_[_0x3cc2('0x2a')](db['JscriptySessionReport'][_0x3cc2('0x2b')],function(_0x32638c){return{'name':_0x32638c[_0x3cc2('0x2c')],'type':_0x32638c[_0x3cc2('0x2d')][_0x3cc2('0x2e')]};});_0x4f54fd[_0x3cc2('0x2f')]=_[_0x3cc2('0x2a')](_0x5df6d7,'name');_0x4f54fd[_0x3cc2('0x30')]=_[_0x3cc2('0x31')](_0xa7fd53[_0x3cc2('0x30')]);_0x4f54fd[_0x3cc2('0x32')]=_[_0x3cc2('0x33')](_0x4f54fd[_0x3cc2('0x2f')],_0x4f54fd[_0x3cc2('0x30')]);_0x377ca7['attributes']=_[_0x3cc2('0x33')](_0x4f54fd[_0x3cc2('0x2f')],qs[_0x3cc2('0x34')](_0xa7fd53['query']['fields']));_0x377ca7['attributes']=_0x377ca7['attributes']['length']?_0x377ca7[_0x3cc2('0x35')]:_0x4f54fd[_0x3cc2('0x2f')];if(!_0xa7fd53['query']['hasOwnProperty'](_0x3cc2('0x36'))){_0x377ca7[_0x3cc2('0x1f')]=qs[_0x3cc2('0x1f')](_0xa7fd53['query'][_0x3cc2('0x1f')]);_0x377ca7[_0x3cc2('0x1d')]=qs['offset'](_0xa7fd53['query'][_0x3cc2('0x1d')]);}_0x377ca7[_0x3cc2('0x37')]=qs[_0x3cc2('0x38')](_0xa7fd53['query'][_0x3cc2('0x38')]);_0x377ca7[_0x3cc2('0x39')]=qs['filters'](_['pick'](_0xa7fd53[_0x3cc2('0x30')],_0x4f54fd[_0x3cc2('0x32')]),_0x5df6d7);if(_0xa7fd53[_0x3cc2('0x30')][_0x3cc2('0x3a')]){_0x377ca7['where']=_['merge'](_0x377ca7[_0x3cc2('0x39')],{'$or':_['map'](_0x5df6d7,function(_0x5cfe95){if(_0x5cfe95[_0x3cc2('0x2d')]!==_0x3cc2('0x3b')){var _0x1329f6={};_0x1329f6[_0x5cfe95[_0x3cc2('0x28')]]={'$like':'%'+_0xa7fd53[_0x3cc2('0x30')][_0x3cc2('0x3a')]+'%'};return _0x1329f6;}})});}_0x377ca7=_['merge']({},_0x377ca7,_0xa7fd53[_0x3cc2('0x3c')]);var _0xfc18bf={'where':_0x377ca7['where']};return db[_0x3cc2('0x3d')][_0x3cc2('0x20')](_0xfc18bf)['then'](function(_0x3a4a96){_0x366289['count']=_0x3a4a96;if(_0xa7fd53[_0x3cc2('0x30')][_0x3cc2('0x3e')]){_0x377ca7['include']=[{'all':!![]}];}return db[_0x3cc2('0x3d')]['findAll'](_0x377ca7);})[_0x3cc2('0x24')](function(_0x1fab44){_0x366289[_0x3cc2('0x3f')]=_0x1fab44;return _0x366289;})[_0x3cc2('0x24')](respondWithFilteredResult(_0x26a083,_0x377ca7))['catch'](handleError(_0x26a083,null));};exports[_0x3cc2('0x40')]=function(_0x366f95,_0x20f0e8){var _0x287ff0={'raw':!![],'where':{'id':_0x366f95[_0x3cc2('0x41')]['id']}},_0xccf982={};_0xccf982['model']=_[_0x3cc2('0x31')](db['JscriptySessionReport'][_0x3cc2('0x2b')]);_0xccf982[_0x3cc2('0x30')]=_[_0x3cc2('0x31')](_0x366f95['query']);_0xccf982[_0x3cc2('0x32')]=_[_0x3cc2('0x33')](_0xccf982[_0x3cc2('0x2f')],_0xccf982[_0x3cc2('0x30')]);_0x287ff0['attributes']=_[_0x3cc2('0x33')](_0xccf982[_0x3cc2('0x2f')],qs[_0x3cc2('0x34')](_0x366f95['query']['fields']));_0x287ff0[_0x3cc2('0x35')]=_0x287ff0[_0x3cc2('0x35')][_0x3cc2('0x42')]?_0x287ff0[_0x3cc2('0x35')]:_0xccf982[_0x3cc2('0x2f')];if(_0x366f95[_0x3cc2('0x30')][_0x3cc2('0x3e')]){_0x287ff0[_0x3cc2('0x43')]=[{'all':!![]}];}_0x287ff0=_[_0x3cc2('0x44')]({},_0x287ff0,_0x366f95[_0x3cc2('0x3c')]);return db['JscriptySessionReport']['find'](_0x287ff0)[_0x3cc2('0x24')](handleEntityNotFound(_0x20f0e8,null))[_0x3cc2('0x24')](respondWithResult(_0x20f0e8,null))[_0x3cc2('0x45')](handleError(_0x20f0e8,null));};exports[_0x3cc2('0x46')]=function(_0x31a105,_0x13512d){return db[_0x3cc2('0x3d')][_0x3cc2('0x46')](_0x31a105[_0x3cc2('0x47')],{})['then'](respondWithResult(_0x13512d,0xc9))[_0x3cc2('0x45')](handleError(_0x13512d,null));};exports['update']=function(_0x4b77e4,_0x1989dc){if(_0x4b77e4['body']['id']){delete _0x4b77e4[_0x3cc2('0x47')]['id'];}return db[_0x3cc2('0x3d')]['find']({'where':{'id':_0x4b77e4['params']['id']}})[_0x3cc2('0x24')](handleEntityNotFound(_0x1989dc,null))[_0x3cc2('0x24')](saveUpdates(_0x4b77e4['body'],null))[_0x3cc2('0x24')](respondWithResult(_0x1989dc,null))['catch'](handleError(_0x1989dc,null));};exports[_0x3cc2('0x25')]=function(_0x2478ab,_0x26dd95){return db[_0x3cc2('0x3d')][_0x3cc2('0x48')]({'where':{'id':_0x2478ab[_0x3cc2('0x41')]['id']}})[_0x3cc2('0x24')](handleEntityNotFound(_0x26dd95,null))['then'](removeEntity(_0x26dd95,null))[_0x3cc2('0x45')](handleError(_0x26dd95,null));};exports[_0x3cc2('0x49')]=function(_0x2c94bc,_0x3c2224){return db['JscriptySessionReport'][_0x3cc2('0x49')]()['then'](respondWithResult(_0x3c2224,null))[_0x3cc2('0x45')](handleError(_0x3c2224,null));};exports[_0x3cc2('0x4a')]=function(_0x56e872,_0x3038f0,_0x482dcb){var _0x2e0b34={'raw':!![],'where':{}};var _0x3fa52c={};var _0x18bc1d={'count':0x0,'rows':[]};return db[_0x3cc2('0x3d')][_0x3cc2('0x4b')]({'where':{'id':_0x56e872[_0x3cc2('0x41')]['id']}})[_0x3cc2('0x24')](handleEntityNotFound(_0x3038f0,null))['then'](function(_0x242b97){if(_0x242b97){_0x3fa52c[_0x3cc2('0x2f')]=_['keys'](db['JscriptyQuestionReport'][_0x3cc2('0x2b')]);_0x3fa52c[_0x3cc2('0x30')]=_['keys'](_0x56e872[_0x3cc2('0x30')]);_0x3fa52c['filters']=_['intersection'](_0x3fa52c[_0x3cc2('0x2f')],_0x3fa52c[_0x3cc2('0x30')]);_0x2e0b34[_0x3cc2('0x35')]=_[_0x3cc2('0x33')](_0x3fa52c[_0x3cc2('0x2f')],qs[_0x3cc2('0x34')](_0x56e872[_0x3cc2('0x30')]['fields']));_0x2e0b34[_0x3cc2('0x35')]=_0x2e0b34[_0x3cc2('0x35')][_0x3cc2('0x42')]?_0x2e0b34[_0x3cc2('0x35')]:_0x3fa52c[_0x3cc2('0x2f')];if(!_0x56e872[_0x3cc2('0x30')]['hasOwnProperty'](_0x3cc2('0x36'))){_0x2e0b34['limit']=qs[_0x3cc2('0x1f')](_0x56e872[_0x3cc2('0x30')][_0x3cc2('0x1f')]);_0x2e0b34[_0x3cc2('0x1d')]=qs['offset'](_0x56e872['query'][_0x3cc2('0x1d')]);}_0x2e0b34[_0x3cc2('0x37')]=qs[_0x3cc2('0x38')](_0x56e872[_0x3cc2('0x30')]['sort']);_0x2e0b34[_0x3cc2('0x39')]=qs[_0x3cc2('0x32')](_[_0x3cc2('0x4c')](_0x56e872[_0x3cc2('0x30')],_0x3fa52c['filters']));_0x2e0b34[_0x3cc2('0x39')]['SessionId']=_0x242b97['id'];if(_0x56e872[_0x3cc2('0x30')][_0x3cc2('0x3a')]){_0x2e0b34[_0x3cc2('0x39')]=_[_0x3cc2('0x44')](_0x2e0b34[_0x3cc2('0x39')],{'$or':_['map'](_0x2e0b34[_0x3cc2('0x35')],function(_0x71b7ff){var _0x4f8bd0={};_0x4f8bd0[_0x71b7ff]={'$like':'%'+_0x56e872[_0x3cc2('0x30')][_0x3cc2('0x3a')]+'%'};return _0x4f8bd0;})});}_0x2e0b34=_['merge']({},_0x2e0b34,_0x56e872[_0x3cc2('0x3c')]);return db['JscriptyQuestionReport']['count']({'where':_0x2e0b34[_0x3cc2('0x39')]})['then'](function(_0x311c4b){_0x18bc1d[_0x3cc2('0x20')]=_0x311c4b;if(_0x56e872[_0x3cc2('0x30')][_0x3cc2('0x3e')]){_0x2e0b34['include']=[{'all':!![]}];}return db[_0x3cc2('0x4d')][_0x3cc2('0x4e')](_0x2e0b34);})['then'](function(_0x378158){_0x18bc1d[_0x3cc2('0x3f')]=_0x378158;return _0x18bc1d;});}})['then'](respondWithFilteredResult(_0x3038f0,_0x2e0b34))['catch'](handleError(_0x3038f0,null));}; \ No newline at end of file +var _0xca24=['name','send','index','map','JscriptySessionReport','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','show','params','rawAttributes','length','find','catch','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','order','findAll','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','stack'];(function(_0x245926,_0x5967f8){var _0x10e24d=function(_0xe84896){while(--_0xe84896){_0x245926['push'](_0x245926['shift']());}};_0x10e24d(++_0x5967f8);}(_0xca24,0x160));var _0x4ca2=function(_0x1761aa,_0x2581cf){_0x1761aa=_0x1761aa-0x0;var _0x232c08=_0xca24[_0x1761aa];return _0x232c08;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4ca2('0x0'));var jsonpatch=require(_0x4ca2('0x1'));var rp=require('request-promise');var moment=require(_0x4ca2('0x2'));var BPromise=require(_0x4ca2('0x3'));var Mustache=require('mustache');var util=require(_0x4ca2('0x4'));var path=require(_0x4ca2('0x5'));var sox=require(_0x4ca2('0x6'));var csv=require(_0x4ca2('0x7'));var ejs=require(_0x4ca2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ca2('0x9'));var squel=require(_0x4ca2('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4ca2('0x7'));var querystring=require('querystring');var Papa=require(_0x4ca2('0xb'));var Redis=require(_0x4ca2('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x4ca2('0xd'));var as=require(_0x4ca2('0xe'));var hardwareService=require(_0x4ca2('0xf'));var logger=require(_0x4ca2('0x10'))(_0x4ca2('0x11'));var utils=require('../../config/utils');var config=require(_0x4ca2('0x12'));var licenseUtil=require(_0x4ca2('0x13'));var db=require(_0x4ca2('0x14'))['db'];function respondWithStatusCode(_0x7d1ac3,_0x21bcf4){_0x21bcf4=_0x21bcf4||0xcc;return function(_0x55fed6){if(_0x55fed6){return _0x7d1ac3[_0x4ca2('0x15')](_0x21bcf4);}return _0x7d1ac3['status'](_0x21bcf4)[_0x4ca2('0x16')]();};}function respondWithResult(_0x345832,_0x5ada7a){_0x5ada7a=_0x5ada7a||0xc8;return function(_0x3d15a7){if(_0x3d15a7){return _0x345832[_0x4ca2('0x17')](_0x5ada7a)[_0x4ca2('0x18')](_0x3d15a7);}};}function respondWithFilteredResult(_0x4a19c0,_0x29ec42){return function(_0x2fe087){if(_0x2fe087){var _0xd9082d=typeof _0x29ec42[_0x4ca2('0x19')]===_0x4ca2('0x1a')&&typeof _0x29ec42['limit']===_0x4ca2('0x1a');var _0x594973=_0x2fe087['count'];var _0x5a73e8=_0xd9082d?0x0:_0x29ec42[_0x4ca2('0x19')];var _0x324502=_0xd9082d?_0x2fe087[_0x4ca2('0x1b')]:_0x29ec42['offset']+_0x29ec42[_0x4ca2('0x1c')];var _0x3d6db7;if(_0x324502>=_0x594973){_0x324502=_0x594973;_0x3d6db7=0xc8;}else{_0x3d6db7=0xce;}_0x4a19c0[_0x4ca2('0x17')](_0x3d6db7);return _0x4a19c0[_0x4ca2('0x1d')]('Content-Range',_0x5a73e8+'-'+_0x324502+'/'+_0x594973)[_0x4ca2('0x18')](_0x2fe087);}return null;};}function patchUpdates(_0xd6a8eb){return function(_0x27cd3c){try{jsonpatch[_0x4ca2('0x1e')](_0x27cd3c,_0xd6a8eb,!![]);}catch(_0x3875c8){return BPromise[_0x4ca2('0x1f')](_0x3875c8);}return _0x27cd3c[_0x4ca2('0x20')]();};}function saveUpdates(_0x158787,_0x3745ec){return function(_0x31d21c){if(_0x31d21c){return _0x31d21c[_0x4ca2('0x21')](_0x158787)[_0x4ca2('0x22')](function(_0x2f3846){return _0x2f3846;});}return null;};}function removeEntity(_0x5e7245,_0x37d900){return function(_0xe3f118){if(_0xe3f118){return _0xe3f118[_0x4ca2('0x23')]()[_0x4ca2('0x22')](function(){_0x5e7245['status'](0xcc)[_0x4ca2('0x16')]();});}};}function handleEntityNotFound(_0x330f7f,_0x487ad8){return function(_0x4fe31d){if(!_0x4fe31d){_0x330f7f[_0x4ca2('0x15')](0x194);}return _0x4fe31d;};}function handleError(_0xafcb87,_0x17ef33){_0x17ef33=_0x17ef33||0x1f4;return function(_0x30ef28){logger[_0x4ca2('0x24')](_0x30ef28[_0x4ca2('0x25')]);if(_0x30ef28['name']){delete _0x30ef28[_0x4ca2('0x26')];}_0xafcb87['status'](_0x17ef33)[_0x4ca2('0x27')](_0x30ef28);};}exports[_0x4ca2('0x28')]=function(_0xc071cd,_0x47a4ed){var _0x448111={},_0x12997e={},_0x70a4af={'count':0x0,'rows':[]};var _0x29bd73=_[_0x4ca2('0x29')](db[_0x4ca2('0x2a')]['rawAttributes'],function(_0x22be00){return{'name':_0x22be00[_0x4ca2('0x2b')],'type':_0x22be00[_0x4ca2('0x2c')][_0x4ca2('0x2d')]};});_0x12997e[_0x4ca2('0x2e')]=_[_0x4ca2('0x29')](_0x29bd73,_0x4ca2('0x26'));_0x12997e[_0x4ca2('0x2f')]=_[_0x4ca2('0x30')](_0xc071cd[_0x4ca2('0x2f')]);_0x12997e['filters']=_['intersection'](_0x12997e[_0x4ca2('0x2e')],_0x12997e['query']);_0x448111[_0x4ca2('0x31')]=_[_0x4ca2('0x32')](_0x12997e[_0x4ca2('0x2e')],qs[_0x4ca2('0x33')](_0xc071cd[_0x4ca2('0x2f')][_0x4ca2('0x33')]));_0x448111[_0x4ca2('0x31')]=_0x448111[_0x4ca2('0x31')]['length']?_0x448111[_0x4ca2('0x31')]:_0x12997e[_0x4ca2('0x2e')];if(!_0xc071cd[_0x4ca2('0x2f')][_0x4ca2('0x34')](_0x4ca2('0x35'))){_0x448111[_0x4ca2('0x1c')]=qs[_0x4ca2('0x1c')](_0xc071cd[_0x4ca2('0x2f')][_0x4ca2('0x1c')]);_0x448111[_0x4ca2('0x19')]=qs['offset'](_0xc071cd[_0x4ca2('0x2f')][_0x4ca2('0x19')]);}_0x448111['order']=qs['sort'](_0xc071cd[_0x4ca2('0x2f')][_0x4ca2('0x36')]);_0x448111[_0x4ca2('0x37')]=qs[_0x4ca2('0x38')](_[_0x4ca2('0x39')](_0xc071cd['query'],_0x12997e[_0x4ca2('0x38')]),_0x29bd73);if(_0xc071cd[_0x4ca2('0x2f')][_0x4ca2('0x3a')]){_0x448111[_0x4ca2('0x37')]=_['merge'](_0x448111[_0x4ca2('0x37')],{'$or':_[_0x4ca2('0x29')](_0x29bd73,function(_0x1c67ae){if(_0x1c67ae[_0x4ca2('0x2c')]!==_0x4ca2('0x3b')){var _0x1b17a2={};_0x1b17a2[_0x1c67ae[_0x4ca2('0x26')]]={'$like':'%'+_0xc071cd[_0x4ca2('0x2f')][_0x4ca2('0x3a')]+'%'};return _0x1b17a2;}})});}_0x448111=_[_0x4ca2('0x3c')]({},_0x448111,_0xc071cd[_0x4ca2('0x3d')]);var _0x43f5fb={'where':_0x448111[_0x4ca2('0x37')]};return db[_0x4ca2('0x2a')][_0x4ca2('0x1b')](_0x43f5fb)[_0x4ca2('0x22')](function(_0x56d9f4){_0x70a4af[_0x4ca2('0x1b')]=_0x56d9f4;if(_0xc071cd['query'][_0x4ca2('0x3e')]){_0x448111[_0x4ca2('0x3f')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x448111);})[_0x4ca2('0x22')](function(_0x3f4463){_0x70a4af['rows']=_0x3f4463;return _0x70a4af;})[_0x4ca2('0x22')](respondWithFilteredResult(_0x47a4ed,_0x448111))['catch'](handleError(_0x47a4ed,null));};exports[_0x4ca2('0x40')]=function(_0x138625,_0x5a3d30){var _0xbf43d8={'raw':!![],'where':{'id':_0x138625[_0x4ca2('0x41')]['id']}},_0x1c2942={};_0x1c2942[_0x4ca2('0x2e')]=_[_0x4ca2('0x30')](db[_0x4ca2('0x2a')][_0x4ca2('0x42')]);_0x1c2942[_0x4ca2('0x2f')]=_['keys'](_0x138625[_0x4ca2('0x2f')]);_0x1c2942['filters']=_[_0x4ca2('0x32')](_0x1c2942[_0x4ca2('0x2e')],_0x1c2942['query']);_0xbf43d8[_0x4ca2('0x31')]=_[_0x4ca2('0x32')](_0x1c2942[_0x4ca2('0x2e')],qs[_0x4ca2('0x33')](_0x138625['query']['fields']));_0xbf43d8[_0x4ca2('0x31')]=_0xbf43d8[_0x4ca2('0x31')][_0x4ca2('0x43')]?_0xbf43d8[_0x4ca2('0x31')]:_0x1c2942[_0x4ca2('0x2e')];if(_0x138625[_0x4ca2('0x2f')][_0x4ca2('0x3e')]){_0xbf43d8['include']=[{'all':!![]}];}_0xbf43d8=_[_0x4ca2('0x3c')]({},_0xbf43d8,_0x138625[_0x4ca2('0x3d')]);return db[_0x4ca2('0x2a')][_0x4ca2('0x44')](_0xbf43d8)['then'](handleEntityNotFound(_0x5a3d30,null))[_0x4ca2('0x22')](respondWithResult(_0x5a3d30,null))[_0x4ca2('0x45')](handleError(_0x5a3d30,null));};exports[_0x4ca2('0x46')]=function(_0x4f3ec0,_0x233235){return db['JscriptySessionReport'][_0x4ca2('0x46')](_0x4f3ec0[_0x4ca2('0x47')],{})[_0x4ca2('0x22')](respondWithResult(_0x233235,0xc9))[_0x4ca2('0x45')](handleError(_0x233235,null));};exports['update']=function(_0x3c3235,_0x207431){if(_0x3c3235['body']['id']){delete _0x3c3235[_0x4ca2('0x47')]['id'];}return db['JscriptySessionReport'][_0x4ca2('0x44')]({'where':{'id':_0x3c3235[_0x4ca2('0x41')]['id']}})[_0x4ca2('0x22')](handleEntityNotFound(_0x207431,null))[_0x4ca2('0x22')](saveUpdates(_0x3c3235[_0x4ca2('0x47')],null))[_0x4ca2('0x22')](respondWithResult(_0x207431,null))[_0x4ca2('0x45')](handleError(_0x207431,null));};exports[_0x4ca2('0x23')]=function(_0xbc6e40,_0x656fe3){return db[_0x4ca2('0x2a')][_0x4ca2('0x44')]({'where':{'id':_0xbc6e40[_0x4ca2('0x41')]['id']}})['then'](handleEntityNotFound(_0x656fe3,null))['then'](removeEntity(_0x656fe3,null))[_0x4ca2('0x45')](handleError(_0x656fe3,null));};exports['describe']=function(_0x48f7ff,_0x4bd1ad){return db['JscriptySessionReport'][_0x4ca2('0x48')]()[_0x4ca2('0x22')](respondWithResult(_0x4bd1ad,null))['catch'](handleError(_0x4bd1ad,null));};exports[_0x4ca2('0x49')]=function(_0x4c644a,_0x37aacd,_0xa3f569){var _0x150e4a={'raw':!![],'where':{}};var _0x269f56={};var _0x2ea9e5={'count':0x0,'rows':[]};return db[_0x4ca2('0x2a')][_0x4ca2('0x4a')]({'where':{'id':_0x4c644a[_0x4ca2('0x41')]['id']}})['then'](handleEntityNotFound(_0x37aacd,null))[_0x4ca2('0x22')](function(_0x40e5e8){if(_0x40e5e8){_0x269f56[_0x4ca2('0x2e')]=_[_0x4ca2('0x30')](db[_0x4ca2('0x4b')][_0x4ca2('0x42')]);_0x269f56['query']=_[_0x4ca2('0x30')](_0x4c644a[_0x4ca2('0x2f')]);_0x269f56['filters']=_['intersection'](_0x269f56[_0x4ca2('0x2e')],_0x269f56['query']);_0x150e4a[_0x4ca2('0x31')]=_[_0x4ca2('0x32')](_0x269f56['model'],qs[_0x4ca2('0x33')](_0x4c644a[_0x4ca2('0x2f')]['fields']));_0x150e4a[_0x4ca2('0x31')]=_0x150e4a['attributes'][_0x4ca2('0x43')]?_0x150e4a[_0x4ca2('0x31')]:_0x269f56[_0x4ca2('0x2e')];if(!_0x4c644a[_0x4ca2('0x2f')][_0x4ca2('0x34')](_0x4ca2('0x35'))){_0x150e4a[_0x4ca2('0x1c')]=qs[_0x4ca2('0x1c')](_0x4c644a[_0x4ca2('0x2f')][_0x4ca2('0x1c')]);_0x150e4a['offset']=qs[_0x4ca2('0x19')](_0x4c644a[_0x4ca2('0x2f')][_0x4ca2('0x19')]);}_0x150e4a[_0x4ca2('0x4c')]=qs[_0x4ca2('0x36')](_0x4c644a[_0x4ca2('0x2f')][_0x4ca2('0x36')]);_0x150e4a[_0x4ca2('0x37')]=qs[_0x4ca2('0x38')](_[_0x4ca2('0x39')](_0x4c644a['query'],_0x269f56[_0x4ca2('0x38')]));_0x150e4a[_0x4ca2('0x37')]['SessionId']=_0x40e5e8['id'];if(_0x4c644a[_0x4ca2('0x2f')][_0x4ca2('0x3a')]){_0x150e4a[_0x4ca2('0x37')]=_[_0x4ca2('0x3c')](_0x150e4a[_0x4ca2('0x37')],{'$or':_[_0x4ca2('0x29')](_0x150e4a[_0x4ca2('0x31')],function(_0x544932){var _0x400e5f={};_0x400e5f[_0x544932]={'$like':'%'+_0x4c644a['query']['filter']+'%'};return _0x400e5f;})});}_0x150e4a=_[_0x4ca2('0x3c')]({},_0x150e4a,_0x4c644a['options']);return db[_0x4ca2('0x4b')]['count']({'where':_0x150e4a['where']})[_0x4ca2('0x22')](function(_0x44a07b){_0x2ea9e5[_0x4ca2('0x1b')]=_0x44a07b;if(_0x4c644a[_0x4ca2('0x2f')][_0x4ca2('0x3e')]){_0x150e4a[_0x4ca2('0x3f')]=[{'all':!![]}];}return db[_0x4ca2('0x4b')][_0x4ca2('0x4d')](_0x150e4a);})[_0x4ca2('0x22')](function(_0xf822a3){_0x2ea9e5['rows']=_0xf822a3;return _0x2ea9e5;});}})[_0x4ca2('0x22')](respondWithFilteredResult(_0x37aacd,_0x150e4a))[_0x4ca2('0x45')](handleError(_0x37aacd,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 80125cb..1ab980b 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 _0x723e=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','define','JscriptySessionReport','report_jscripty_sessions'];(function(_0x1f75e8,_0x7fa97f){var _0x120699=function(_0x4d817b){while(--_0x4d817b){_0x1f75e8['push'](_0x1f75e8['shift']());}};_0x120699(++_0x7fa97f);}(_0x723e,0x179));var _0xe723=function(_0x24df34,_0x50aa1a){_0x24df34=_0x24df34-0x0;var _0x3980e8=_0x723e[_0x24df34];return _0x3980e8;};'use strict';var _=require('lodash');var util=require(_0xe723('0x0'));var logger=require(_0xe723('0x1'))(_0xe723('0x2'));var moment=require(_0xe723('0x3'));var BPromise=require(_0xe723('0x4'));var rp=require(_0xe723('0x5'));var fs=require('fs');var path=require(_0xe723('0x6'));var rimraf=require(_0xe723('0x7'));var config=require(_0xe723('0x8'));var attributes=require(_0xe723('0x9'));module['exports']=function(_0x32d689,_0x20c13b){return _0x32d689[_0xe723('0xa')](_0xe723('0xb'),attributes,{'tableName':_0xe723('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x687b=['rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x597646,_0x3b7fa5){var _0x3d2ee8=function(_0x8fe622){while(--_0x8fe622){_0x597646['push'](_0x597646['shift']());}};_0x3d2ee8(++_0x3b7fa5);}(_0x687b,0x14a));var _0xb687=function(_0x3c28c0,_0x1cb29d){_0x3c28c0=_0x3c28c0-0x0;var _0x12cc9f=_0x687b[_0x3c28c0];return _0x12cc9f;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require(_0xb687('0x2'))(_0xb687('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));module[_0xb687('0x9')]=function(_0x16ccf3,_0xf43a1f){return _0x16ccf3[_0xb687('0xa')](_0xb687('0xb'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index d2fe15d..42d04da 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(_0x37d894,_0xb55bf9){var _0x58c2e6=function(_0x129166){while(--_0x129166){_0x37d894['push'](_0x37d894['shift']());}};_0x58c2e6(++_0xb55bf9);}(_0xf2e3,0x9b));var _0x3f2e=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0xf2e3[_0xfa634c];return _0x73e478;};'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 _0x9536=['request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','JscriptySessionReport,\x20%s,\x20%s'];(function(_0x848511,_0x449dee){var _0x1c0daa=function(_0x2523cb){while(--_0x2523cb){_0x848511['push'](_0x848511['shift']());}};_0x1c0daa(++_0x449dee);}(_0x9536,0x179));var _0x6953=function(_0x1d3577,_0x17a32e){_0x1d3577=_0x1d3577-0x0;var _0x277d9a=_0x9536[_0x1d3577];return _0x277d9a;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var moment=require(_0x6953('0x2'));var BPromise=require(_0x6953('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6953('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6953('0x5'));var logger=require(_0x6953('0x6'))(_0x6953('0x7'));var config=require(_0x6953('0x8'));var jayson=require(_0x6953('0x9'));var client=jayson['client'][_0x6953('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bb026,_0x385f2d,_0x3e1aff){return new BPromise(function(_0x1c8225,_0x58ac30){return client[_0x6953('0xb')](_0x2bb026,_0x3e1aff)[_0x6953('0xc')](function(_0x449acb){logger['info'](_0x6953('0xd'),_0x385f2d,_0x6953('0xe'));logger[_0x6953('0xf')](_0x6953('0x10'),_0x385f2d,_0x6953('0xe'),JSON[_0x6953('0x11')](_0x449acb));if(_0x449acb[_0x6953('0x12')]){if(_0x449acb[_0x6953('0x12')][_0x6953('0x13')]===0x1f4){logger['error'](_0x6953('0xd'),_0x385f2d,_0x449acb['error'][_0x6953('0x14')]);return _0x58ac30(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}logger[_0x6953('0x12')](_0x6953('0xd'),_0x385f2d,_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);return _0x1c8225(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}else{logger[_0x6953('0x15')](_0x6953('0xd'),_0x385f2d,'request\x20sent');_0x1c8225(_0x449acb['result'][_0x6953('0x14')]);}})[_0x6953('0x16')](function(_0x16b79b){logger[_0x6953('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x385f2d,_0x16b79b);_0x58ac30(_0x16b79b);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 9879d65..0c37b33 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 _0x849d=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','update','/download_log_file','isAuthenticated','downloadLogFile','exports','multer'];(function(_0x10bf3f,_0x370961){var _0x1fb0b6=function(_0x17794c){while(--_0x17794c){_0x10bf3f['push'](_0x10bf3f['shift']());}};_0x1fb0b6(++_0x370961);}(_0x849d,0x11f));var _0xd849=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x849d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd849('0x0'));var util=require(_0xd849('0x1'));var path=require(_0xd849('0x2'));var timeout=require(_0xd849('0x3'));var express=require(_0xd849('0x4'));var router=express['Router']();var fs_extra=require(_0xd849('0x5'));var auth=require(_0xd849('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd849('0x7'));var controller=require('./license.controller');router[_0xd849('0x8')]('/',controller[_0xd849('0x9')]);router['put'](_0xd849('0xa'),auth['isAuthenticated'](),controller[_0xd849('0xb')]);router[_0xd849('0x8')](_0xd849('0xc'),auth[_0xd849('0xd')](),controller[_0xd849('0xe')]);module[_0xd849('0xf')]=router; \ No newline at end of file +var _0x0bcf=['/:id','update','/download_log_file','isAuthenticated','downloadLogFile','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./license.controller','get','put'];(function(_0xa656ef,_0x3d31df){var _0x20e81=function(_0x128119){while(--_0x128119){_0xa656ef['push'](_0xa656ef['shift']());}};_0x20e81(++_0x3d31df);}(_0x0bcf,0x114));var _0xf0bc=function(_0x235ab5,_0x35f786){_0x235ab5=_0x235ab5-0x0;var _0x2030fb=_0x0bcf[_0x235ab5];return _0x2030fb;};'use strict';var multer=require(_0xf0bc('0x0'));var util=require(_0xf0bc('0x1'));var path=require(_0xf0bc('0x2'));var timeout=require(_0xf0bc('0x3'));var express=require(_0xf0bc('0x4'));var router=express[_0xf0bc('0x5')]();var fs_extra=require(_0xf0bc('0x6'));var auth=require(_0xf0bc('0x7'));var interaction=require(_0xf0bc('0x8'));var config=require('../../config/environment');var controller=require(_0xf0bc('0x9'));router[_0xf0bc('0xa')]('/',controller['index']);router[_0xf0bc('0xb')](_0xf0bc('0xc'),auth['isAuthenticated'](),controller[_0xf0bc('0xd')]);router['get'](_0xf0bc('0xe'),auth[_0xf0bc('0xf')](),controller[_0xf0bc('0x10')]);module[_0xf0bc('0x11')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index fdfdfb4..ff7c739 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 _0xb329=['exports','TEXT','sequelize'];(function(_0x17b736,_0x40ce0f){var _0x147c4c=function(_0x2970c9){while(--_0x2970c9){_0x17b736['push'](_0x17b736['shift']());}};_0x147c4c(++_0x40ce0f);}(_0xb329,0x98));var _0x9b32=function(_0x28669c,_0x1f62c4){_0x28669c=_0x28669c-0x0;var _0x4a3af6=_0xb329[_0x28669c];return _0x4a3af6;};'use strict';var Sequelize=require(_0x9b32('0x0'));module[_0x9b32('0x1')]={'license':{'type':Sequelize[_0x9b32('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xb8b7=['sequelize','exports','TEXT','STRING','INTEGER'];(function(_0x523fb1,_0x9f885d){var _0x3efb00=function(_0x86370f){while(--_0x86370f){_0x523fb1['push'](_0x523fb1['shift']());}};_0x3efb00(++_0x9f885d);}(_0xb8b7,0xa0));var _0x7b8b=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xb8b7[_0x13b8f3];return _0x1a6d06;};'use strict';var Sequelize=require(_0x7b8b('0x0'));module[_0x7b8b('0x1')]={'license':{'type':Sequelize[_0x7b8b('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x7b8b('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x7b8b('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 1744db1..3db4c3e 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 _0xe103=['query','filters','intersection','attributes','fields','length','options','getLicense','update','body','find','get','key','demo','catch','downloadLogFile','license-info.log','join','/var','log','xcally','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','model','keys','License','rawAttributes'];(function(_0x3e1226,_0x4199d6){var _0x1ff634=function(_0x4dbed0){while(--_0x4dbed0){_0x3e1226['push'](_0x3e1226['shift']());}};_0x1ff634(++_0x4199d6);}(_0xe103,0x191));var _0x3e10=function(_0x1d75bd,_0x17c831){_0x1d75bd=_0x1d75bd-0x0;var _0x16028f=_0xe103[_0x1d75bd];return _0x16028f;};'use strict';var emlformat=require(_0x3e10('0x0'));var rimraf=require(_0x3e10('0x1'));var zipdir=require(_0x3e10('0x2'));var jsonpatch=require(_0x3e10('0x3'));var rp=require(_0x3e10('0x4'));var moment=require(_0x3e10('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3e10('0x6'));var util=require('util');var path=require(_0x3e10('0x7'));var sox=require('sox');var csv=require(_0x3e10('0x8'));var ejs=require(_0x3e10('0x9'));var fs=require('fs');var fs_extra=require(_0x3e10('0xa'));var _=require('lodash');var squel=require(_0x3e10('0xb'));var crypto=require(_0x3e10('0xc'));var jsforce=require(_0x3e10('0xd'));var deskjs=require(_0x3e10('0xe'));var toCsv=require(_0x3e10('0x8'));var querystring=require('querystring');var Papa=require(_0x3e10('0xf'));var Redis=require(_0x3e10('0x10'));var authService=require(_0x3e10('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3e10('0x12'));var hardwareService=require(_0x3e10('0x13'));var logger=require(_0x3e10('0x14'))(_0x3e10('0x15'));var utils=require('../../config/utils');var config=require(_0x3e10('0x16'));var licenseUtil=require(_0x3e10('0x17'));var db=require(_0x3e10('0x18'))['db'];function respondWithStatusCode(_0x21f573,_0x5171d9){_0x5171d9=_0x5171d9||0xcc;return function(_0x2e68c0){if(_0x2e68c0){return _0x21f573[_0x3e10('0x19')](_0x5171d9);}return _0x21f573[_0x3e10('0x1a')](_0x5171d9)[_0x3e10('0x1b')]();};}function respondWithResult(_0x33af43,_0x1e856a){_0x1e856a=_0x1e856a||0xc8;return function(_0x11bc34){if(_0x11bc34){return _0x33af43['status'](_0x1e856a)['json'](_0x11bc34);}};}function respondWithFilteredResult(_0x3e1cef,_0x268e9b){return function(_0x3db73c){if(_0x3db73c){var _0x32bdd6=typeof _0x268e9b[_0x3e10('0x1c')]==='undefined'&&typeof _0x268e9b[_0x3e10('0x1d')]===_0x3e10('0x1e');var _0x1fe6b8=_0x3db73c['count'];var _0x14a9a0=_0x32bdd6?0x0:_0x268e9b['offset'];var _0x5bc07a=_0x32bdd6?_0x3db73c[_0x3e10('0x1f')]:_0x268e9b[_0x3e10('0x1c')]+_0x268e9b[_0x3e10('0x1d')];var _0x563217;if(_0x5bc07a>=_0x1fe6b8){_0x5bc07a=_0x1fe6b8;_0x563217=0xc8;}else{_0x563217=0xce;}_0x3e1cef[_0x3e10('0x1a')](_0x563217);return _0x3e1cef[_0x3e10('0x20')](_0x3e10('0x21'),_0x14a9a0+'-'+_0x5bc07a+'/'+_0x1fe6b8)[_0x3e10('0x22')](_0x3db73c);}return null;};}function patchUpdates(_0x113657){return function(_0x5db31e){try{jsonpatch[_0x3e10('0x23')](_0x5db31e,_0x113657,!![]);}catch(_0x57e88d){return BPromise[_0x3e10('0x24')](_0x57e88d);}return _0x5db31e[_0x3e10('0x25')]();};}function saveUpdates(_0x324185,_0x3716ff){return function(_0x269c95){if(_0x269c95){return _0x269c95['update'](_0x324185)[_0x3e10('0x26')](function(_0x5ca1a4){return _0x5ca1a4;});}return null;};}function removeEntity(_0x5202d4,_0x1179cd){return function(_0x2667dc){if(_0x2667dc){return _0x2667dc[_0x3e10('0x27')]()['then'](function(){_0x5202d4['status'](0xcc)[_0x3e10('0x1b')]();});}};}function handleEntityNotFound(_0x1519c0,_0x28d9a3){return function(_0x27d5e2){if(!_0x27d5e2){_0x1519c0['sendStatus'](0x194);}return _0x27d5e2;};}function handleError(_0x8e0bb3,_0x54cd14){_0x54cd14=_0x54cd14||0x1f4;return function(_0x51cb3d){logger[_0x3e10('0x28')](_0x51cb3d[_0x3e10('0x29')]);if(_0x51cb3d['name']){delete _0x51cb3d[_0x3e10('0x2a')];}_0x8e0bb3[_0x3e10('0x1a')](_0x54cd14)[_0x3e10('0x2b')](_0x51cb3d);};}var utilLicense=require('../../config/license/util');exports[_0x3e10('0x2c')]=function(_0x463f32,_0x4f4ae2){var _0x53652f={'raw':!![],'where':{'id':0x1}},_0x47556b={};_0x47556b[_0x3e10('0x2d')]=_[_0x3e10('0x2e')](db[_0x3e10('0x2f')][_0x3e10('0x30')]);_0x47556b[_0x3e10('0x31')]=_[_0x3e10('0x2e')](_0x463f32['query']);_0x47556b[_0x3e10('0x32')]=_[_0x3e10('0x33')](_0x47556b[_0x3e10('0x2d')],_0x47556b[_0x3e10('0x31')]);_0x53652f[_0x3e10('0x34')]=_[_0x3e10('0x33')](_0x47556b[_0x3e10('0x2d')],qs[_0x3e10('0x35')](_0x463f32[_0x3e10('0x31')][_0x3e10('0x35')]));_0x53652f[_0x3e10('0x34')]=_0x53652f[_0x3e10('0x34')][_0x3e10('0x36')]?_0x53652f['attributes']:_0x47556b['model'];_0x53652f=_['merge']({},_0x53652f,_0x463f32[_0x3e10('0x37')]);return utilLicense[_0x3e10('0x38')](_0x53652f)[_0x3e10('0x26')](respondWithResult(_0x4f4ae2,null))['catch'](handleError(_0x4f4ae2,null));};exports[_0x3e10('0x39')]=function(_0x502cd1,_0x5d0b7b){if(_0x502cd1[_0x3e10('0x3a')]['id']){delete _0x502cd1[_0x3e10('0x3a')]['id'];}return db[_0x3e10('0x2f')][_0x3e10('0x3b')]({'where':{'id':_0x502cd1['params']['id']}})[_0x3e10('0x26')](handleEntityNotFound(_0x5d0b7b,null))['then'](function(_0x280b7b){var _0x4e6075=_0x280b7b[_0x3e10('0x3c')]({'plain':!![]});return utilLicense['checkLicense'](_0x4e6075,_0x502cd1[_0x3e10('0x3a')][_0x3e10('0x3d')]);})[_0x3e10('0x26')](function(_0x49257e){if(!_0x49257e[_0x3e10('0x3e')]){return saveUpdates(_0x502cd1[_0x3e10('0x3a')],null);}return _0x49257e;})[_0x3e10('0x26')](respondWithResult(_0x5d0b7b,null))[_0x3e10('0x3f')](handleError(_0x5d0b7b,null));};exports[_0x3e10('0x40')]=function(_0xa75a9d,_0x1919fa){var _0x21a25e=_0x3e10('0x41');var _0x54915b=path[_0x3e10('0x42')](_0x3e10('0x43'),_0x3e10('0x44'),_0x3e10('0x45'),_0x21a25e);_0x1919fa['setHeader'](_0x3e10('0x46'),_0x3e10('0x47')+_0x21a25e);_0x1919fa['set'](_0x3e10('0x48'),_0x3e10('0x49'));_0x1919fa[_0x3e10('0x4a')](_0x54915b);}; \ No newline at end of file +var _0x50a2=['moment','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','body','License','find','params','get','checkLicense','key','downloadLogFile','license-info.log','join','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','download','eml-format','zip-dir','fast-json-patch'];(function(_0x3980b4,_0x4dab3c){var _0xc10171=function(_0x261fb1){while(--_0x261fb1){_0x3980b4['push'](_0x3980b4['shift']());}};_0xc10171(++_0x4dab3c);}(_0x50a2,0x15b));var _0x250a=function(_0x26baac,_0x2f8b0d){_0x26baac=_0x26baac-0x0;var _0x415d25=_0x50a2[_0x26baac];return _0x415d25;};'use strict';var emlformat=require(_0x250a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x250a('0x1'));var jsonpatch=require(_0x250a('0x2'));var rp=require('request-promise');var moment=require(_0x250a('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x250a('0x4'));var path=require('path');var sox=require(_0x250a('0x5'));var csv=require(_0x250a('0x6'));var ejs=require(_0x250a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x250a('0x8'));var crypto=require(_0x250a('0x9'));var jsforce=require(_0x250a('0xa'));var deskjs=require(_0x250a('0xb'));var toCsv=require(_0x250a('0x6'));var querystring=require(_0x250a('0xc'));var Papa=require(_0x250a('0xd'));var Redis=require(_0x250a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x250a('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x250a('0x10'));var logger=require(_0x250a('0x11'))(_0x250a('0x12'));var utils=require(_0x250a('0x13'));var config=require(_0x250a('0x14'));var licenseUtil=require(_0x250a('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e6e2e,_0x566042){_0x566042=_0x566042||0xcc;return function(_0x27fee3){if(_0x27fee3){return _0x5e6e2e[_0x250a('0x16')](_0x566042);}return _0x5e6e2e[_0x250a('0x17')](_0x566042)[_0x250a('0x18')]();};}function respondWithResult(_0x4f8fba,_0x1aa71a){_0x1aa71a=_0x1aa71a||0xc8;return function(_0x4afd49){if(_0x4afd49){return _0x4f8fba['status'](_0x1aa71a)[_0x250a('0x19')](_0x4afd49);}};}function respondWithFilteredResult(_0x4f46bc,_0x22725f){return function(_0x5c3d6d){if(_0x5c3d6d){var _0x5132bf=typeof _0x22725f[_0x250a('0x1a')]===_0x250a('0x1b')&&typeof _0x22725f[_0x250a('0x1c')]===_0x250a('0x1b');var _0x6a831e=_0x5c3d6d[_0x250a('0x1d')];var _0x4ce723=_0x5132bf?0x0:_0x22725f[_0x250a('0x1a')];var _0x239d35=_0x5132bf?_0x5c3d6d[_0x250a('0x1d')]:_0x22725f[_0x250a('0x1a')]+_0x22725f['limit'];var _0x2b69e9;if(_0x239d35>=_0x6a831e){_0x239d35=_0x6a831e;_0x2b69e9=0xc8;}else{_0x2b69e9=0xce;}_0x4f46bc[_0x250a('0x17')](_0x2b69e9);return _0x4f46bc[_0x250a('0x1e')](_0x250a('0x1f'),_0x4ce723+'-'+_0x239d35+'/'+_0x6a831e)[_0x250a('0x19')](_0x5c3d6d);}return null;};}function patchUpdates(_0x1520cb){return function(_0x2f013d){try{jsonpatch[_0x250a('0x20')](_0x2f013d,_0x1520cb,!![]);}catch(_0x54dcac){return BPromise[_0x250a('0x21')](_0x54dcac);}return _0x2f013d['save']();};}function saveUpdates(_0xe4ada2,_0x4f510f){return function(_0x5e945f){if(_0x5e945f){return _0x5e945f[_0x250a('0x22')](_0xe4ada2)[_0x250a('0x23')](function(_0x151a20){return _0x151a20;});}return null;};}function removeEntity(_0x546257,_0x522134){return function(_0x334f23){if(_0x334f23){return _0x334f23[_0x250a('0x24')]()['then'](function(){_0x546257[_0x250a('0x17')](0xcc)[_0x250a('0x18')]();});}};}function handleEntityNotFound(_0x3f9072,_0x1f9c4e){return function(_0x460f4f){if(!_0x460f4f){_0x3f9072[_0x250a('0x16')](0x194);}return _0x460f4f;};}function handleError(_0x4b916c,_0x31eb9a){_0x31eb9a=_0x31eb9a||0x1f4;return function(_0x3ff222){logger['error'](_0x3ff222[_0x250a('0x25')]);if(_0x3ff222[_0x250a('0x26')]){delete _0x3ff222[_0x250a('0x26')];}_0x4b916c['status'](_0x31eb9a)[_0x250a('0x27')](_0x3ff222);};}var utilLicense=require(_0x250a('0x15'));exports[_0x250a('0x28')]=function(_0x419e5e,_0x4917bb){var _0x256044={'raw':!![],'where':{'id':0x1}},_0x468f9d={};_0x468f9d[_0x250a('0x29')]=_[_0x250a('0x2a')](db['License'][_0x250a('0x2b')]);_0x468f9d['query']=_[_0x250a('0x2a')](_0x419e5e[_0x250a('0x2c')]);_0x468f9d[_0x250a('0x2d')]=_[_0x250a('0x2e')](_0x468f9d[_0x250a('0x29')],_0x468f9d['query']);_0x256044[_0x250a('0x2f')]=_[_0x250a('0x2e')](_0x468f9d[_0x250a('0x29')],qs['fields'](_0x419e5e['query'][_0x250a('0x30')]));_0x256044['attributes']=_0x256044[_0x250a('0x2f')][_0x250a('0x31')]?_0x256044[_0x250a('0x2f')]:_0x468f9d['model'];_0x256044=_[_0x250a('0x32')]({},_0x256044,_0x419e5e[_0x250a('0x33')]);return utilLicense[_0x250a('0x34')](_0x256044)[_0x250a('0x23')](respondWithResult(_0x4917bb,null))[_0x250a('0x35')](handleError(_0x4917bb,null));};exports[_0x250a('0x22')]=function(_0x1a8631,_0x42f346){if(_0x1a8631[_0x250a('0x36')]['id']){delete _0x1a8631[_0x250a('0x36')]['id'];}return db[_0x250a('0x37')][_0x250a('0x38')]({'where':{'id':_0x1a8631[_0x250a('0x39')]['id']}})[_0x250a('0x23')](handleEntityNotFound(_0x42f346,null))[_0x250a('0x23')](function(_0x2c851c){var _0x551d51=_0x2c851c[_0x250a('0x3a')]({'plain':!![]});return utilLicense[_0x250a('0x3b')](_0x551d51,_0x1a8631[_0x250a('0x36')][_0x250a('0x3c')]);})[_0x250a('0x23')](function(_0x59fc85){if(!_0x59fc85['demo']){return saveUpdates(_0x1a8631[_0x250a('0x36')],null);}return _0x59fc85;})['then'](respondWithResult(_0x42f346,null))[_0x250a('0x35')](handleError(_0x42f346,null));};exports[_0x250a('0x3d')]=function(_0x1b50c5,_0x108383){var _0x19a145=_0x250a('0x3e');var _0xb825d=path[_0x250a('0x3f')]('/var',_0x250a('0x40'),_0x250a('0x41'),_0x19a145);_0x108383[_0x250a('0x42')](_0x250a('0x43'),_0x250a('0x44')+_0x19a145);_0x108383[_0x250a('0x1e')]('Content-Type','text/plain');_0x108383[_0x250a('0x45')](_0xb825d);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index ed28a41..bf575b3 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 _0x8cfe=['request-promise','rimraf','./license.attributes','exports','License','license','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1bc40c,_0x520d21){var _0x4e33b9=function(_0xaf99a5){while(--_0xaf99a5){_0x1bc40c['push'](_0x1bc40c['shift']());}};_0x4e33b9(++_0x520d21);}(_0x8cfe,0x16e));var _0xe8cf=function(_0x37b6e4,_0x1ee0f2){_0x37b6e4=_0x37b6e4-0x0;var _0x54f442=_0x8cfe[_0x37b6e4];return _0x54f442;};'use strict';var _=require(_0xe8cf('0x0'));var util=require(_0xe8cf('0x1'));var logger=require(_0xe8cf('0x2'))(_0xe8cf('0x3'));var moment=require(_0xe8cf('0x4'));var BPromise=require(_0xe8cf('0x5'));var rp=require(_0xe8cf('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe8cf('0x7'));var config=require('../../config/environment');var attributes=require(_0xe8cf('0x8'));module[_0xe8cf('0x9')]=function(_0x2873cc,_0x495074){return _0x2873cc['define'](_0xe8cf('0xa'),attributes,{'tableName':_0xe8cf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55b8=['moment','bluebird','request-promise','path','rimraf','./license.attributes','exports','define','License','license','lodash','util','../../config/logger','api'];(function(_0x2f37e0,_0x393ef9){var _0x43ccce=function(_0x318b51){while(--_0x318b51){_0x2f37e0['push'](_0x2f37e0['shift']());}};_0x43ccce(++_0x393ef9);}(_0x55b8,0x15a));var _0x855b=function(_0x4800c9,_0x55e919){_0x4800c9=_0x4800c9-0x0;var _0x575384=_0x55b8[_0x4800c9];return _0x575384;};'use strict';var _=require(_0x855b('0x0'));var util=require(_0x855b('0x1'));var logger=require(_0x855b('0x2'))(_0x855b('0x3'));var moment=require(_0x855b('0x4'));var BPromise=require(_0x855b('0x5'));var rp=require(_0x855b('0x6'));var fs=require('fs');var path=require(_0x855b('0x7'));var rimraf=require(_0x855b('0x8'));var config=require('../../config/environment');var attributes=require(_0x855b('0x9'));module[_0x855b('0xa')]=function(_0x298e26,_0x5cf3af){return _0x298e26[_0x855b('0xb')](_0x855b('0xc'),attributes,{'tableName':_0x855b('0xd'),'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 2ad1964..9afc3d0 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 _0xba3c=['http','request','then','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','code','License,\x20%s,\x20%s','message','error','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x13573c,_0x585238){var _0x37bc6e=function(_0x3e5a4f){while(--_0x3e5a4f){_0x13573c['push'](_0x13573c['shift']());}};_0x37bc6e(++_0x585238);}(_0xba3c,0x175));var _0xcba3=function(_0x174301,_0xf474a){_0x174301=_0x174301-0x0;var _0xa39294=_0xba3c[_0x174301];return _0xa39294;};'use strict';var _=require(_0xcba3('0x0'));var util=require('util');var moment=require(_0xcba3('0x1'));var BPromise=require(_0xcba3('0x2'));var rs=require(_0xcba3('0x3'));var fs=require('fs');var Redis=require(_0xcba3('0x4'));var db=require(_0xcba3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcba3('0x6'))(_0xcba3('0x7'));var config=require(_0xcba3('0x8'));var jayson=require(_0xcba3('0x9'));var client=jayson[_0xcba3('0xa')][_0xcba3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a9ed5,_0x511fa5,_0x2c4503){return new BPromise(function(_0x7facf1,_0x3b4f66){return client[_0xcba3('0xc')](_0x5a9ed5,_0x2c4503)[_0xcba3('0xd')](function(_0x4c2f24){logger[_0xcba3('0xe')]('License,\x20%s,\x20%s',_0x511fa5,_0xcba3('0xf'));logger[_0xcba3('0x10')](_0xcba3('0x11'),_0x511fa5,_0xcba3('0xf'),JSON['stringify'](_0x4c2f24));if(_0x4c2f24['error']){if(_0x4c2f24['error'][_0xcba3('0x12')]===0x1f4){logger['error'](_0xcba3('0x13'),_0x511fa5,_0x4c2f24['error'][_0xcba3('0x14')]);return _0x3b4f66(_0x4c2f24[_0xcba3('0x15')][_0xcba3('0x14')]);}logger[_0xcba3('0x15')]('License,\x20%s,\x20%s',_0x511fa5,_0x4c2f24[_0xcba3('0x15')]['message']);return _0x7facf1(_0x4c2f24[_0xcba3('0x15')][_0xcba3('0x14')]);}else{logger[_0xcba3('0xe')]('License,\x20%s,\x20%s',_0x511fa5,'request\x20sent');_0x7facf1(_0x4c2f24[_0xcba3('0x16')][_0xcba3('0x14')]);}})[_0xcba3('0x17')](function(_0x8ad9d8){logger[_0xcba3('0x15')]('License,\x20%s,\x20%s',_0x511fa5,_0x8ad9d8);_0x3b4f66(_0x8ad9d8);});});} \ No newline at end of file +var _0xddb9=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','code','error','License,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring'];(function(_0x3e1054,_0x345ece){var _0xa74ef6=function(_0x2312e1){while(--_0x2312e1){_0x3e1054['push'](_0x3e1054['shift']());}};_0xa74ef6(++_0x345ece);}(_0xddb9,0x104));var _0x9ddb=function(_0x50d363,_0x5eb02a){_0x50d363=_0x50d363-0x0;var _0x15f8ea=_0xddb9[_0x50d363];return _0x15f8ea;};'use strict';var _=require(_0x9ddb('0x0'));var util=require(_0x9ddb('0x1'));var moment=require('moment');var BPromise=require(_0x9ddb('0x2'));var rs=require(_0x9ddb('0x3'));var fs=require('fs');var Redis=require(_0x9ddb('0x4'));var db=require(_0x9ddb('0x5'))['db'];var utils=require(_0x9ddb('0x6'));var logger=require('../../config/logger')(_0x9ddb('0x7'));var config=require(_0x9ddb('0x8'));var jayson=require(_0x9ddb('0x9'));var client=jayson[_0x9ddb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42e540,_0x15ec48,_0x83c52){return new BPromise(function(_0x214876,_0x123de8){return client[_0x9ddb('0xb')](_0x42e540,_0x83c52)[_0x9ddb('0xc')](function(_0x467d8c){logger['info']('License,\x20%s,\x20%s',_0x15ec48,_0x9ddb('0xd'));logger[_0x9ddb('0xe')](_0x9ddb('0xf'),_0x15ec48,_0x9ddb('0xd'),JSON[_0x9ddb('0x10')](_0x467d8c));if(_0x467d8c['error']){if(_0x467d8c['error'][_0x9ddb('0x11')]===0x1f4){logger[_0x9ddb('0x12')](_0x9ddb('0x13'),_0x15ec48,_0x467d8c[_0x9ddb('0x12')][_0x9ddb('0x14')]);return _0x123de8(_0x467d8c['error'][_0x9ddb('0x14')]);}logger[_0x9ddb('0x12')](_0x9ddb('0x13'),_0x15ec48,_0x467d8c['error'][_0x9ddb('0x14')]);return _0x214876(_0x467d8c[_0x9ddb('0x12')][_0x9ddb('0x14')]);}else{logger['info']('License,\x20%s,\x20%s',_0x15ec48,'request\x20sent');_0x214876(_0x467d8c[_0x9ddb('0x15')][_0x9ddb('0x14')]);}})['catch'](function(_0x3f5383){logger[_0x9ddb('0x12')](_0x9ddb('0x13'),_0x15ec48,_0x3f5383);_0x123de8(_0x3f5383);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 039ddd6..f724bfd 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 _0x6434=['/:id/in_servers','getImap','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','verifySmtp','/:id/users','post','addDisposition','addImap','addSmtp','/:id/interactions','addInteraction','addApplications','addAgents','put','update','delete','removeDispositions','removeSmtp','destroy','removeAgents','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./mailAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers'];(function(_0x113828,_0x377874){var _0x3a930a=function(_0x4fa6a5){while(--_0x4fa6a5){_0x113828['push'](_0x113828['shift']());}};_0x3a930a(++_0x377874);}(_0x6434,0xf0));var _0x4643=function(_0x331faf,_0x5d2471){_0x331faf=_0x331faf-0x0;var _0x1f65f0=_0x6434[_0x331faf];return _0x1f65f0;};'use strict';var multer=require(_0x4643('0x0'));var util=require(_0x4643('0x1'));var path=require('path');var timeout=require(_0x4643('0x2'));var express=require(_0x4643('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4643('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4643('0x5'));var controller=require(_0x4643('0x6'));router['get']('/',auth[_0x4643('0x7')](),controller[_0x4643('0x8')]);router[_0x4643('0x9')](_0x4643('0xa'),auth[_0x4643('0x7')](),controller[_0x4643('0xb')]);router['get'](_0x4643('0xc'),auth[_0x4643('0x7')](),controller[_0x4643('0xd')]);router[_0x4643('0x9')](_0x4643('0xe'),auth['isAuthenticated'](),controller[_0x4643('0xf')]);router[_0x4643('0x9')](_0x4643('0x10'),auth['isAuthenticated'](),controller[_0x4643('0x11')]);router[_0x4643('0x9')](_0x4643('0x12'),auth['isAuthenticated'](),controller[_0x4643('0x13')]);router[_0x4643('0x9')]('/:id/out_servers',auth[_0x4643('0x7')](),controller[_0x4643('0x14')]);router['get']('/:id/interactions',auth['isAuthenticated'](),controller[_0x4643('0x15')]);router[_0x4643('0x9')](_0x4643('0x16'),auth[_0x4643('0x7')](),controller[_0x4643('0x17')]);router[_0x4643('0x9')](_0x4643('0x18'),auth['isAuthenticated'](),controller[_0x4643('0x19')]);router[_0x4643('0x9')]('/:id/verify',auth[_0x4643('0x7')](),controller[_0x4643('0x1a')]);router['get'](_0x4643('0x1b'),auth[_0x4643('0x7')](),controller['getAgents']);router[_0x4643('0x1c')]('/:id/dispositions',auth[_0x4643('0x7')](),controller[_0x4643('0x1d')]);router[_0x4643('0x1c')](_0x4643('0x10'),auth[_0x4643('0x7')](),controller['addAnswer']);router[_0x4643('0x1c')]('/',auth[_0x4643('0x7')](),controller['create']);router[_0x4643('0x1c')](_0x4643('0x12'),auth[_0x4643('0x7')](),controller[_0x4643('0x1e')]);router['post']('/:id/out_servers',auth[_0x4643('0x7')](),controller[_0x4643('0x1f')]);router[_0x4643('0x1c')](_0x4643('0x20'),auth[_0x4643('0x7')](),controller[_0x4643('0x21')]);router['post'](_0x4643('0x16'),auth[_0x4643('0x7')](),controller[_0x4643('0x22')]);router[_0x4643('0x1c')]('/:id/send',auth[_0x4643('0x7')](),controller['send']);router[_0x4643('0x1c')]('/:id/users',auth[_0x4643('0x7')](),controller[_0x4643('0x23')]);router[_0x4643('0x24')](_0x4643('0xc'),auth[_0x4643('0x7')](),controller[_0x4643('0x25')]);router[_0x4643('0x26')](_0x4643('0xe'),auth[_0x4643('0x7')](),controller[_0x4643('0x27')]);router[_0x4643('0x26')]('/:id/canned_answers',auth[_0x4643('0x7')](),controller['removeAnswers']);router[_0x4643('0x26')](_0x4643('0x12'),auth['isAuthenticated'](),controller['removeImap']);router[_0x4643('0x26')]('/:id/out_servers',auth[_0x4643('0x7')](),controller[_0x4643('0x28')]);router[_0x4643('0x26')]('/:id',auth[_0x4643('0x7')](),controller[_0x4643('0x29')]);router[_0x4643('0x26')](_0x4643('0x1b'),auth['isAuthenticated'](),controller[_0x4643('0x2a')]);module['exports']=router; \ No newline at end of file +var _0xe1e0=['/:id','show','/:id/dispositions','getDispositions','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','/:id/verify','verifySmtp','/:id/users','getAgents','post','/:id/canned_answers','create','/:id/in_servers','addImap','addInteraction','addApplications','/:id/send','addAgents','put','delete','removeDispositions','removeAnswers','removeImap','destroy','removeAgents','exports','multer','util','path','express','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x725a4c,_0x102507){var _0x37b2cc=function(_0x505fc9){while(--_0x505fc9){_0x725a4c['push'](_0x725a4c['shift']());}};_0x37b2cc(++_0x102507);}(_0xe1e0,0x75));var _0x0e1e=function(_0x43226c,_0x4a1798){_0x43226c=_0x43226c-0x0;var _0x42edde=_0xe1e0[_0x43226c];return _0x42edde;};'use strict';var multer=require(_0x0e1e('0x0'));var util=require(_0x0e1e('0x1'));var path=require(_0x0e1e('0x2'));var timeout=require('connect-timeout');var express=require(_0x0e1e('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0e1e('0x4'));var config=require(_0x0e1e('0x5'));var controller=require(_0x0e1e('0x6'));router[_0x0e1e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0e1e('0x8')]);router[_0x0e1e('0x7')](_0x0e1e('0x9'),auth[_0x0e1e('0xa')](),controller[_0x0e1e('0xb')]);router[_0x0e1e('0x7')](_0x0e1e('0xc'),auth[_0x0e1e('0xa')](),controller[_0x0e1e('0xd')]);router[_0x0e1e('0x7')](_0x0e1e('0xe'),auth[_0x0e1e('0xa')](),controller[_0x0e1e('0xf')]);router[_0x0e1e('0x7')]('/:id/canned_answers',auth[_0x0e1e('0xa')](),controller['getAnswers']);router['get']('/:id/in_servers',auth[_0x0e1e('0xa')](),controller[_0x0e1e('0x10')]);router['get']('/:id/out_servers',auth['isAuthenticated'](),controller[_0x0e1e('0x11')]);router[_0x0e1e('0x7')](_0x0e1e('0x12'),auth[_0x0e1e('0xa')](),controller[_0x0e1e('0x13')]);router[_0x0e1e('0x7')](_0x0e1e('0x14'),auth[_0x0e1e('0xa')](),controller['getApplications']);router[_0x0e1e('0x7')](_0x0e1e('0x15'),auth[_0x0e1e('0xa')](),controller['getMessages']);router[_0x0e1e('0x7')](_0x0e1e('0x16'),auth[_0x0e1e('0xa')](),controller[_0x0e1e('0x17')]);router[_0x0e1e('0x7')](_0x0e1e('0x18'),auth[_0x0e1e('0xa')](),controller[_0x0e1e('0x19')]);router[_0x0e1e('0x1a')](_0x0e1e('0xe'),auth[_0x0e1e('0xa')](),controller['addDisposition']);router['post'](_0x0e1e('0x1b'),auth[_0x0e1e('0xa')](),controller['addAnswer']);router['post']('/',auth[_0x0e1e('0xa')](),controller[_0x0e1e('0x1c')]);router[_0x0e1e('0x1a')](_0x0e1e('0x1d'),auth['isAuthenticated'](),controller[_0x0e1e('0x1e')]);router[_0x0e1e('0x1a')]('/:id/out_servers',auth['isAuthenticated'](),controller['addSmtp']);router[_0x0e1e('0x1a')](_0x0e1e('0x12'),auth[_0x0e1e('0xa')](),controller[_0x0e1e('0x1f')]);router[_0x0e1e('0x1a')](_0x0e1e('0x14'),auth[_0x0e1e('0xa')](),controller[_0x0e1e('0x20')]);router[_0x0e1e('0x1a')](_0x0e1e('0x21'),auth[_0x0e1e('0xa')](),controller['send']);router[_0x0e1e('0x1a')](_0x0e1e('0x18'),auth[_0x0e1e('0xa')](),controller[_0x0e1e('0x22')]);router[_0x0e1e('0x23')](_0x0e1e('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x0e1e('0x24')](_0x0e1e('0xe'),auth[_0x0e1e('0xa')](),controller[_0x0e1e('0x25')]);router[_0x0e1e('0x24')](_0x0e1e('0x1b'),auth[_0x0e1e('0xa')](),controller[_0x0e1e('0x26')]);router[_0x0e1e('0x24')](_0x0e1e('0x1d'),auth[_0x0e1e('0xa')](),controller[_0x0e1e('0x27')]);router['delete']('/:id/out_servers',auth[_0x0e1e('0xa')](),controller['removeSmtp']);router[_0x0e1e('0x24')](_0x0e1e('0xc'),auth['isAuthenticated'](),controller[_0x0e1e('0x28')]);router[_0x0e1e('0x24')](_0x0e1e('0x18'),auth[_0x0e1e('0xa')](),controller[_0x0e1e('0x29')]);module[_0x0e1e('0x2a')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 66f1e3c..c6bf404 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 _0x2ff5=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','ENUM','gmail','hotmail','provider','getDataValue','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x50e6f2,_0x2eee84){var _0x35b544=function(_0xec6d84){while(--_0xec6d84){_0x50e6f2['push'](_0x50e6f2['shift']());}};_0x35b544(++_0x2eee84);}(_0x2ff5,0xed));var _0x52ff=function(_0x25f2d0,_0x3106c5){_0x25f2d0=_0x25f2d0-0x0;var _0x3b9544=_0x2ff5[_0x25f2d0];return _0x3b9544;};'use strict';var Sequelize=require(_0x52ff('0x0'));module[_0x52ff('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x52ff('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x52ff('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x52ff('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x52ff('0x4')]},'markAsUnread':{'type':Sequelize[_0x52ff('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x52ff('0x2')],'allowNull':![],'defaultValue':_0x52ff('0x5')},'fontSize':{'type':Sequelize[_0x52ff('0x6')](0x2)[_0x52ff('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x52ff('0x4')],'defaultValue':function(){return _0x52ff('0x8');}},'notificationSound':{'type':Sequelize[_0x52ff('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x52ff('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x52ff('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x52ff('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x52ff('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x52ff('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x52ff('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x52ff('0x3')],'defaultValue':![],'comment':_0x52ff('0xa'),'set':function(_0x1f8710){if(!_0x1f8710)this['setDataValue'](_0x52ff('0xb'),null);this[_0x52ff('0xc')]('mandatoryDisposition',_0x1f8710);}},'provider':{'type':Sequelize[_0x52ff('0xd')](_0x52ff('0xe'),_0x52ff('0xf'),'yahoo','outlook365'),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0x52ff('0x10')))return'custom';return this[_0x52ff('0x11')](_0x52ff('0x10'));},'set':function(_0x182eb8){if(_0x182eb8===_0x52ff('0x12'))_0x182eb8=null;return this[_0x52ff('0xc')]('provider',_0x182eb8);}}}; \ No newline at end of file +var _0x6e7e=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','ENUM','hotmail','yahoo','outlook365','provider','custom','sequelize','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}'];(function(_0x5bf46c,_0x1fe508){var _0x5a37c4=function(_0x2cf2c3){while(--_0x2cf2c3){_0x5bf46c['push'](_0x5bf46c['shift']());}};_0x5a37c4(++_0x1fe508);}(_0x6e7e,0xf9));var _0xe6e7=function(_0xb4f240,_0x15f734){_0xb4f240=_0xb4f240-0x0;var _0x30682a=_0x6e7e[_0xb4f240];return _0x30682a;};'use strict';var Sequelize=require(_0xe6e7('0x0'));module['exports']={'description':{'type':Sequelize[_0xe6e7('0x1')]},'name':{'type':Sequelize[_0xe6e7('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0xe6e7('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xe6e7('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xe6e7('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xe6e7('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xe6e7('0x3')]},'markAsUnread':{'type':Sequelize[_0xe6e7('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xe6e7('0x1')],'allowNull':![],'defaultValue':_0xe6e7('0x4')},'fontSize':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xe6e7('0x3')],'defaultValue':function(){return _0xe6e7('0x5');}},'notificationSound':{'type':Sequelize[_0xe6e7('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe6e7('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe6e7('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe6e7('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xe6e7('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xe6e7('0x2')],'defaultValue':![],'comment':_0xe6e7('0x8'),'set':function(_0x27a3a0){if(!_0x27a3a0)this[_0xe6e7('0x9')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xe6e7('0xa'),_0x27a3a0);}},'provider':{'type':Sequelize[_0xe6e7('0xb')]('gmail',_0xe6e7('0xc'),_0xe6e7('0xd'),_0xe6e7('0xe')),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0xe6e7('0xf')))return'custom';return this['getDataValue'](_0xe6e7('0xf'));},'set':function(_0x196294){if(_0x196294===_0xe6e7('0x10'))_0x196294=null;return this[_0xe6e7('0x9')](_0xe6e7('0xf'),_0x196294);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index c94d2c8..829d398 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 _0xcd00=['email','ListId','isNil','active','description','user','password','pass','service','host','port','authentication','username','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tags','color','tag','addApplications','transaction','sequelize','Transaction','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','getMessages','MailMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','true','split','CmList','Contacts','updatedAt','from','format','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','List','CmContact','messageId','subject','out','Interaction','Messages','CloudProvider','OAuth2','data5','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','./mailAccount.socket','jayson/promise','client','http','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','MailAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','get','MailAccounts','UserProfileResource','destroy','stack','name','send','MailServerIn','MailServerOut','Pause','MailAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','catch','show','params','Imap','mandatoryDispositionPause','find','body','modernAuthentication','Smtp','CloudProviderId','describe','addDisposition','Disposition','getDispositions','findOne','pick','MailAccountId','rows','removeDispositions','ids','addAnswer','create','getAnswers','CannedAnswer','removeAnswers','key','provider','custom'];(function(_0x33a40f,_0x55a84e){var _0x7ebcd2=function(_0x4669dd){while(--_0x4669dd){_0x33a40f['push'](_0x33a40f['shift']());}};_0x7ebcd2(++_0x55a84e);}(_0xcd00,0x1d3));var _0x0cd0=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xcd00[_0x19950b];return _0x3c6b41;};'use strict';var moment=require(_0x0cd0('0x0'));var BPromise=require(_0x0cd0('0x1'));var util=require(_0x0cd0('0x2'));var path=require(_0x0cd0('0x3'));var _=require(_0x0cd0('0x4'));var juice=require(_0x0cd0('0x5'));var Redis=require('ioredis');var qs=require(_0x0cd0('0x6'));var logger=require(_0x0cd0('0x7'))(_0x0cd0('0x8'));var config=require(_0x0cd0('0x9'));var db=require('../../mysqldb')['db'];config[_0x0cd0('0xa')]=_[_0x0cd0('0xb')](config['redis'],{'host':_0x0cd0('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0cd0('0xa')]));require(_0x0cd0('0xd'))['register'](socket);var jayson=require(_0x0cd0('0xe'));var client=jayson[_0x0cd0('0xf')][_0x0cd0('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x386b5d,_0x36b10e,_0x4d9129,_0x42e33f){return new BPromise(function(_0x3bb808,_0x459935){var _0x27818c=_0x42e33f||client;return _0x27818c['request'](_0x386b5d,_0x4d9129)[_0x0cd0('0x11')](function(_0x509d90){logger[_0x0cd0('0x12')]('MailAccount,\x20%s,\x20%s',_0x36b10e,_0x0cd0('0x13'));logger[_0x0cd0('0x14')](_0x0cd0('0x15'),_0x36b10e,_0x0cd0('0x13'),JSON['stringify'](_0x509d90));if(_0x509d90[_0x0cd0('0x16')]){if(_0x509d90[_0x0cd0('0x16')][_0x0cd0('0x17')]===0x1f4){logger[_0x0cd0('0x16')](_0x0cd0('0x18'),_0x36b10e,_0x509d90[_0x0cd0('0x16')]['message']);return _0x459935(_0x509d90[_0x0cd0('0x16')]['message']);}logger['error'](_0x0cd0('0x18'),_0x36b10e,_0x509d90[_0x0cd0('0x16')][_0x0cd0('0x19')]);return _0x3bb808(_0x509d90[_0x0cd0('0x16')][_0x0cd0('0x19')]);}else{logger[_0x0cd0('0x12')](_0x0cd0('0x18'),_0x36b10e,_0x0cd0('0x13'));_0x3bb808(_0x509d90[_0x0cd0('0x1a')]['message']);}})['catch'](function(_0x237168){logger[_0x0cd0('0x16')](_0x0cd0('0x18'),_0x36b10e,_0x237168);_0x459935(_0x237168);});});}function respondWithStatusCode(_0x2d3d5d,_0x27f7b5){_0x27f7b5=_0x27f7b5||0xcc;return function(_0xf1f91d){if(_0xf1f91d){return _0x2d3d5d[_0x0cd0('0x1b')](_0x27f7b5);}return _0x2d3d5d[_0x0cd0('0x1c')](_0x27f7b5)[_0x0cd0('0x1d')]();};}function respondWithResult(_0x182ea3,_0x508f00){_0x508f00=_0x508f00||0xc8;return function(_0x1b20d0){if(_0x1b20d0){return _0x182ea3[_0x0cd0('0x1c')](_0x508f00)[_0x0cd0('0x1e')](_0x1b20d0);}};}function respondWithFilteredResult(_0x30a18b,_0x37eeae){return function(_0x6f8e1d){if(_0x6f8e1d){var _0x18f284=typeof _0x37eeae[_0x0cd0('0x1f')]==='undefined'&&typeof _0x37eeae[_0x0cd0('0x20')]===_0x0cd0('0x21');var _0x1a6084=_0x6f8e1d[_0x0cd0('0x22')];var _0x246303=_0x18f284?0x0:_0x37eeae['offset'];var _0x118e8a=_0x18f284?_0x6f8e1d[_0x0cd0('0x22')]:_0x37eeae[_0x0cd0('0x1f')]+_0x37eeae[_0x0cd0('0x20')];var _0x2731b3;if(_0x118e8a>=_0x1a6084){_0x118e8a=_0x1a6084;_0x2731b3=0xc8;}else{_0x2731b3=0xce;}_0x30a18b['status'](_0x2731b3);return _0x30a18b[_0x0cd0('0x23')](_0x0cd0('0x24'),_0x246303+'-'+_0x118e8a+'/'+_0x1a6084)[_0x0cd0('0x1e')](_0x6f8e1d);}return null;};}function saveUpdates(_0x19caa5){return function(_0x260ef3){if(_0x260ef3){return _0x260ef3[_0x0cd0('0x25')](_0x19caa5)[_0x0cd0('0x11')](function(_0x244413){return _0x244413;});}return null;};}function removeEntity(_0x2f7c6e){return function(_0x9db4e0){if(_0x9db4e0){return _0x9db4e0['destroy']()[_0x0cd0('0x11')](function(){var _0x2b5289=_0x9db4e0[_0x0cd0('0x26')]({'plain':!![]});var _0xbdb67a=_0x0cd0('0x27');return db[_0x0cd0('0x28')][_0x0cd0('0x29')]({'where':{'type':_0xbdb67a,'resourceId':_0x2b5289['id']}})[_0x0cd0('0x11')](function(){return _0x9db4e0;});})[_0x0cd0('0x11')](function(){_0x2f7c6e[_0x0cd0('0x1c')](0xcc)[_0x0cd0('0x1d')]();});}};}function handleEntityNotFound(_0x294eaf){return function(_0x538405){if(!_0x538405){_0x294eaf['sendStatus'](0x194);}return _0x538405;};}function handleError(_0x227034,_0x5a2591){_0x5a2591=_0x5a2591||0x1f4;return function(_0x1ff61f){logger['error'](_0x1ff61f[_0x0cd0('0x2a')]);if(_0x1ff61f[_0x0cd0('0x2b')]){delete _0x1ff61f[_0x0cd0('0x2b')];}_0x227034[_0x0cd0('0x1c')](_0x5a2591)[_0x0cd0('0x2c')](_0x1ff61f);};}exports['index']=function(_0x5388ff,_0xd9687c){var _0x30691a={'include':[{'model':db[_0x0cd0('0x2d')],'as':'Imap'},{'model':db[_0x0cd0('0x2e')],'as':'Smtp'},{'model':db[_0x0cd0('0x2f')],'as':'mandatoryDispositionPause'}]},_0x1e2286={},_0x578758={'count':0x0,'rows':[]};var _0x5cde77=_['map'](db[_0x0cd0('0x30')][_0x0cd0('0x31')],function(_0x33b61c){return{'name':_0x33b61c[_0x0cd0('0x32')],'type':_0x33b61c[_0x0cd0('0x33')]['key']};});_0x1e2286[_0x0cd0('0x34')]=_[_0x0cd0('0x35')](_0x5cde77,_0x0cd0('0x2b'));_0x1e2286[_0x0cd0('0x36')]=_[_0x0cd0('0x37')](_0x5388ff[_0x0cd0('0x36')]);_0x1e2286[_0x0cd0('0x38')]=_[_0x0cd0('0x39')](_0x1e2286[_0x0cd0('0x34')],_0x1e2286['query']);_0x30691a[_0x0cd0('0x3a')]=_[_0x0cd0('0x39')](_0x1e2286[_0x0cd0('0x34')],qs[_0x0cd0('0x3b')](_0x5388ff[_0x0cd0('0x36')]['fields']));_0x30691a[_0x0cd0('0x3a')]=_0x30691a['attributes'][_0x0cd0('0x3c')]?_0x30691a['attributes']:_0x1e2286[_0x0cd0('0x34')];if(!_0x5388ff[_0x0cd0('0x36')][_0x0cd0('0x3d')](_0x0cd0('0x3e'))){_0x30691a['limit']=qs['limit'](_0x5388ff['query']['limit']);_0x30691a[_0x0cd0('0x1f')]=qs[_0x0cd0('0x1f')](_0x5388ff['query']['offset']);}_0x30691a[_0x0cd0('0x3f')]=qs['sort'](_0x5388ff[_0x0cd0('0x36')][_0x0cd0('0x40')]);_0x30691a[_0x0cd0('0x41')]=qs['filters'](_['pick'](_0x5388ff[_0x0cd0('0x36')],_0x1e2286['filters']),_0x5cde77);if(_0x5388ff[_0x0cd0('0x36')][_0x0cd0('0x42')]){_0x30691a[_0x0cd0('0x41')]=_['merge'](_0x30691a[_0x0cd0('0x41')],{'$or':_[_0x0cd0('0x35')](_0x5cde77,function(_0x55d2f7){if(_0x55d2f7[_0x0cd0('0x33')]!=='VIRTUAL'){var _0x4f5366={};_0x4f5366[_0x55d2f7[_0x0cd0('0x2b')]]={'$like':'%'+_0x5388ff['query']['filter']+'%'};return _0x4f5366;}})});}_0x30691a=_[_0x0cd0('0x43')]({},_0x30691a,_0x5388ff[_0x0cd0('0x44')]);var _0x3bbe19={'where':_0x30691a['where']};return db['MailAccount']['count'](_0x3bbe19)[_0x0cd0('0x11')](function(_0x532bb7){_0x578758[_0x0cd0('0x22')]=_0x532bb7;if(_0x5388ff['query'][_0x0cd0('0x45')]){_0x30691a[_0x0cd0('0x46')]=[{'all':!![]}];}return db[_0x0cd0('0x30')][_0x0cd0('0x47')](_0x30691a);})['then'](function(_0x19493c){_0x578758['rows']=_0x19493c;return _0x578758;})[_0x0cd0('0x11')](respondWithFilteredResult(_0xd9687c,_0x30691a))[_0x0cd0('0x48')](handleError(_0xd9687c,null));};exports[_0x0cd0('0x49')]=function(_0xc5233d,_0x47291f){var _0xfa86c9={'raw':![],'where':{'id':_0xc5233d[_0x0cd0('0x4a')]['id']},'include':[{'model':db[_0x0cd0('0x2d')],'as':_0x0cd0('0x4b')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x0cd0('0x2f')],'as':_0x0cd0('0x4c')}]},_0x500806={};_0x500806[_0x0cd0('0x34')]=_[_0x0cd0('0x37')](db['MailAccount'][_0x0cd0('0x31')]);_0x500806[_0x0cd0('0x36')]=_[_0x0cd0('0x37')](_0xc5233d['query']);_0x500806[_0x0cd0('0x38')]=_[_0x0cd0('0x39')](_0x500806[_0x0cd0('0x34')],_0x500806[_0x0cd0('0x36')]);_0xfa86c9[_0x0cd0('0x3a')]=_[_0x0cd0('0x39')](_0x500806[_0x0cd0('0x34')],qs['fields'](_0xc5233d[_0x0cd0('0x36')][_0x0cd0('0x3b')]));_0xfa86c9[_0x0cd0('0x3a')]=_0xfa86c9[_0x0cd0('0x3a')]['length']?_0xfa86c9[_0x0cd0('0x3a')]:_0x500806['model'];if(_0xc5233d['query'][_0x0cd0('0x45')]){_0xfa86c9['include']=[{'all':!![]}];}_0xfa86c9=_[_0x0cd0('0x43')]({},_0xfa86c9,_0xc5233d['options']);return db[_0x0cd0('0x30')][_0x0cd0('0x4d')](_0xfa86c9)[_0x0cd0('0x11')](handleEntityNotFound(_0x47291f,null))[_0x0cd0('0x11')](respondWithResult(_0x47291f,null))['catch'](handleError(_0x47291f,null));};exports[_0x0cd0('0x25')]=function(_0x396d1d,_0x318546){if(_0x396d1d[_0x0cd0('0x4e')]['id']){delete _0x396d1d[_0x0cd0('0x4e')]['id'];}if(_0x396d1d['body'][_0x0cd0('0x4b')]){if(!_0x396d1d['body'][_0x0cd0('0x4b')][_0x0cd0('0x4f')]){_0x396d1d[_0x0cd0('0x4e')][_0x0cd0('0x4b')]['CloudProviderId']=null;}}if(_0x396d1d['body'][_0x0cd0('0x50')]){if(!_0x396d1d[_0x0cd0('0x4e')]['Smtp'][_0x0cd0('0x4f')]){_0x396d1d[_0x0cd0('0x4e')][_0x0cd0('0x50')][_0x0cd0('0x51')]=null;}}return db[_0x0cd0('0x30')][_0x0cd0('0x4d')]({'where':{'id':_0x396d1d['params']['id']},'include':[{'model':db[_0x0cd0('0x2d')],'as':_0x0cd0('0x4b')},{'model':db[_0x0cd0('0x2e')],'as':'Smtp'},{'model':db[_0x0cd0('0x2f')],'as':_0x0cd0('0x4c')}]})['then'](handleEntityNotFound(_0x318546,null))[_0x0cd0('0x11')](saveUpdates(_0x396d1d['body'],null))[_0x0cd0('0x11')](function(_0x137fde){if(_0x137fde&&_0x396d1d[_0x0cd0('0x4e')][_0x0cd0('0x4b')]){return db[_0x0cd0('0x2d')][_0x0cd0('0x25')](_0x396d1d[_0x0cd0('0x4e')][_0x0cd0('0x4b')],{'where':{'MailAccountId':_0x137fde['id']}})[_0x0cd0('0x11')](function(){return _0x137fde;});}return _0x137fde;})['then'](function(_0x5a766f){if(_0x5a766f&&_0x396d1d['body'][_0x0cd0('0x50')]){return db[_0x0cd0('0x2e')][_0x0cd0('0x25')](_0x396d1d['body']['Smtp'],{'where':{'MailAccountId':_0x5a766f['id']}})[_0x0cd0('0x11')](function(){return _0x5a766f;});}return _0x5a766f;})[_0x0cd0('0x11')](respondWithResult(_0x318546,null))[_0x0cd0('0x48')](handleError(_0x318546,null));};exports[_0x0cd0('0x52')]=function(_0x5d4885,_0x1ead78){return db[_0x0cd0('0x30')]['describe']()[_0x0cd0('0x11')](respondWithResult(_0x1ead78,null))[_0x0cd0('0x48')](handleError(_0x1ead78,null));};exports[_0x0cd0('0x53')]=function(_0x6b4c20,_0x32fd41){if(_0x6b4c20['body']['id']){delete _0x6b4c20['body']['id'];}return db['MailAccount'][_0x0cd0('0x4d')]({'where':{'id':_0x6b4c20['params']['id']}})[_0x0cd0('0x11')](handleEntityNotFound(_0x32fd41,null))[_0x0cd0('0x11')](function(_0x29398c){if(_0x29398c){_0x6b4c20[_0x0cd0('0x4e')]['MailAccountId']=_0x29398c['id'];return db[_0x0cd0('0x54')]['create'](_0x6b4c20[_0x0cd0('0x4e')]);}})[_0x0cd0('0x11')](respondWithResult(_0x32fd41,null))[_0x0cd0('0x48')](handleError(_0x32fd41,null));};exports[_0x0cd0('0x55')]=function(_0x370047,_0x83e309){var _0x563fc5={'raw':![],'where':{}};var _0x5e20e4={};var _0x424bca={'count':0x0,'rows':[]};return db[_0x0cd0('0x30')][_0x0cd0('0x56')]({'where':{'id':_0x370047[_0x0cd0('0x4a')]['id']}})[_0x0cd0('0x11')](handleEntityNotFound(_0x83e309,null))[_0x0cd0('0x11')](function(_0x416eaf){if(_0x416eaf){_0x5e20e4[_0x0cd0('0x34')]=_[_0x0cd0('0x37')](db[_0x0cd0('0x54')][_0x0cd0('0x31')]);_0x5e20e4['query']=_[_0x0cd0('0x37')](_0x370047[_0x0cd0('0x36')]);_0x5e20e4[_0x0cd0('0x38')]=_[_0x0cd0('0x39')](_0x5e20e4[_0x0cd0('0x34')],_0x5e20e4['query']);_0x563fc5[_0x0cd0('0x3a')]=_['intersection'](_0x5e20e4[_0x0cd0('0x34')],qs[_0x0cd0('0x3b')](_0x370047['query'][_0x0cd0('0x3b')]));_0x563fc5[_0x0cd0('0x3a')]=_0x563fc5[_0x0cd0('0x3a')][_0x0cd0('0x3c')]?_0x563fc5[_0x0cd0('0x3a')]:_0x5e20e4[_0x0cd0('0x34')];if(!_0x370047[_0x0cd0('0x36')]['hasOwnProperty']('nolimit')){_0x563fc5[_0x0cd0('0x20')]=qs[_0x0cd0('0x20')](_0x370047[_0x0cd0('0x36')][_0x0cd0('0x20')]);_0x563fc5[_0x0cd0('0x1f')]=qs[_0x0cd0('0x1f')](_0x370047[_0x0cd0('0x36')]['offset']);}_0x563fc5[_0x0cd0('0x3f')]=qs['sort'](_0x370047[_0x0cd0('0x36')][_0x0cd0('0x40')]);_0x563fc5[_0x0cd0('0x41')]=qs['filters'](_[_0x0cd0('0x57')](_0x370047[_0x0cd0('0x36')],_0x5e20e4['filters']));_0x563fc5[_0x0cd0('0x41')][_0x0cd0('0x58')]=_0x416eaf['id'];if(_0x370047[_0x0cd0('0x36')][_0x0cd0('0x42')]){_0x563fc5[_0x0cd0('0x41')]=_[_0x0cd0('0x43')](_0x563fc5['where'],{'$or':_['map'](_0x563fc5[_0x0cd0('0x3a')],function(_0x5df713){var _0x525f72={};_0x525f72[_0x5df713]={'$like':'%'+_0x370047[_0x0cd0('0x36')][_0x0cd0('0x42')]+'%'};return _0x525f72;})});}_0x563fc5=_[_0x0cd0('0x43')]({},_0x563fc5,_0x370047[_0x0cd0('0x44')]);return db['Disposition'][_0x0cd0('0x22')]({'where':_0x563fc5[_0x0cd0('0x41')]})[_0x0cd0('0x11')](function(_0x78310e){_0x424bca[_0x0cd0('0x22')]=_0x78310e;if(_0x370047[_0x0cd0('0x36')][_0x0cd0('0x45')]){_0x563fc5['include']=[{'all':!![]}];}return db[_0x0cd0('0x54')][_0x0cd0('0x47')](_0x563fc5);})[_0x0cd0('0x11')](function(_0x238726){_0x424bca[_0x0cd0('0x59')]=_0x238726;return _0x424bca;});}})['then'](respondWithFilteredResult(_0x83e309,_0x563fc5))['catch'](handleError(_0x83e309,null));};exports[_0x0cd0('0x5a')]=function(_0x192abb,_0x31f4fc){return db[_0x0cd0('0x30')][_0x0cd0('0x4d')]({'where':{'id':_0x192abb['params']['id']}})['then'](handleEntityNotFound(_0x31f4fc,null))[_0x0cd0('0x11')](function(_0xb915ef){if(_0xb915ef){return _0xb915ef[_0x0cd0('0x5a')](_0x192abb[_0x0cd0('0x36')][_0x0cd0('0x5b')]);}})[_0x0cd0('0x11')](respondWithStatusCode(_0x31f4fc,null))[_0x0cd0('0x48')](handleError(_0x31f4fc,null));};exports[_0x0cd0('0x5c')]=function(_0x56a5ee,_0x558948){if(_0x56a5ee[_0x0cd0('0x4e')]['id']){delete _0x56a5ee[_0x0cd0('0x4e')]['id'];}return db[_0x0cd0('0x30')][_0x0cd0('0x4d')]({'where':{'id':_0x56a5ee[_0x0cd0('0x4a')]['id']}})[_0x0cd0('0x11')](handleEntityNotFound(_0x558948,null))[_0x0cd0('0x11')](function(_0x26eb1d){if(_0x26eb1d){_0x56a5ee[_0x0cd0('0x4e')][_0x0cd0('0x58')]=_0x26eb1d['id'];return db['CannedAnswer'][_0x0cd0('0x5d')](_0x56a5ee[_0x0cd0('0x4e')]);}})[_0x0cd0('0x11')](respondWithResult(_0x558948,null))[_0x0cd0('0x48')](handleError(_0x558948,null));};exports[_0x0cd0('0x5e')]=function(_0x400572,_0x25c929){var _0x5c5cd7={'raw':![],'where':{}};var _0x4ae2ea={};var _0x1ecbe6={'count':0x0,'rows':[]};return db[_0x0cd0('0x30')][_0x0cd0('0x56')]({'where':{'id':_0x400572[_0x0cd0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x25c929,null))[_0x0cd0('0x11')](function(_0x28068b){if(_0x28068b){_0x4ae2ea['model']=_[_0x0cd0('0x37')](db[_0x0cd0('0x5f')][_0x0cd0('0x31')]);_0x4ae2ea[_0x0cd0('0x36')]=_[_0x0cd0('0x37')](_0x400572[_0x0cd0('0x36')]);_0x4ae2ea[_0x0cd0('0x38')]=_[_0x0cd0('0x39')](_0x4ae2ea[_0x0cd0('0x34')],_0x4ae2ea[_0x0cd0('0x36')]);_0x5c5cd7['attributes']=_[_0x0cd0('0x39')](_0x4ae2ea[_0x0cd0('0x34')],qs[_0x0cd0('0x3b')](_0x400572[_0x0cd0('0x36')][_0x0cd0('0x3b')]));_0x5c5cd7['attributes']=_0x5c5cd7['attributes'][_0x0cd0('0x3c')]?_0x5c5cd7[_0x0cd0('0x3a')]:_0x4ae2ea[_0x0cd0('0x34')];if(!_0x400572['query'][_0x0cd0('0x3d')](_0x0cd0('0x3e'))){_0x5c5cd7[_0x0cd0('0x20')]=qs[_0x0cd0('0x20')](_0x400572[_0x0cd0('0x36')]['limit']);_0x5c5cd7['offset']=qs[_0x0cd0('0x1f')](_0x400572[_0x0cd0('0x36')][_0x0cd0('0x1f')]);}_0x5c5cd7[_0x0cd0('0x3f')]=qs[_0x0cd0('0x40')](_0x400572['query'][_0x0cd0('0x40')]);_0x5c5cd7['where']=qs[_0x0cd0('0x38')](_[_0x0cd0('0x57')](_0x400572[_0x0cd0('0x36')],_0x4ae2ea[_0x0cd0('0x38')]));_0x5c5cd7[_0x0cd0('0x41')][_0x0cd0('0x58')]=_0x28068b['id'];if(_0x400572[_0x0cd0('0x36')]['filter']){_0x5c5cd7[_0x0cd0('0x41')]=_['merge'](_0x5c5cd7[_0x0cd0('0x41')],{'$or':_[_0x0cd0('0x35')](_0x5c5cd7[_0x0cd0('0x3a')],function(_0x1559f1){var _0x142b87={};_0x142b87[_0x1559f1]={'$like':'%'+_0x400572[_0x0cd0('0x36')][_0x0cd0('0x42')]+'%'};return _0x142b87;})});}_0x5c5cd7=_[_0x0cd0('0x43')]({},_0x5c5cd7,_0x400572[_0x0cd0('0x44')]);return db[_0x0cd0('0x5f')][_0x0cd0('0x22')]({'where':_0x5c5cd7[_0x0cd0('0x41')]})[_0x0cd0('0x11')](function(_0x7cfbf0){_0x1ecbe6[_0x0cd0('0x22')]=_0x7cfbf0;if(_0x400572['query']['includeAll']){_0x5c5cd7[_0x0cd0('0x46')]=[{'all':!![]}];}return db[_0x0cd0('0x5f')][_0x0cd0('0x47')](_0x5c5cd7);})[_0x0cd0('0x11')](function(_0x57bf92){_0x1ecbe6['rows']=_0x57bf92;return _0x1ecbe6;});}})[_0x0cd0('0x11')](respondWithFilteredResult(_0x25c929,_0x5c5cd7))['catch'](handleError(_0x25c929,null));};exports[_0x0cd0('0x60')]=function(_0x209df3,_0x2e9d9e){return db[_0x0cd0('0x30')][_0x0cd0('0x4d')]({'where':{'id':_0x209df3['params']['id']}})[_0x0cd0('0x11')](handleEntityNotFound(_0x2e9d9e,null))[_0x0cd0('0x11')](function(_0x13c451){if(_0x13c451){return _0x13c451['removeAnswers'](_0x209df3[_0x0cd0('0x36')][_0x0cd0('0x5b')]);}})['then'](respondWithStatusCode(_0x2e9d9e,null))['catch'](handleError(_0x2e9d9e,null));};exports[_0x0cd0('0x5d')]=function(_0x2bd78c,_0x3a2a92){var _0xe599b9={'name':_0x2bd78c[_0x0cd0('0x4e')][_0x0cd0('0x2b')],'key':_0x2bd78c[_0x0cd0('0x4e')][_0x0cd0('0x61')],'provider':_0x2bd78c[_0x0cd0('0x4e')][_0x0cd0('0x62')]===_0x0cd0('0x63')?null:_0x2bd78c[_0x0cd0('0x4e')][_0x0cd0('0x62')],'email':_0x2bd78c[_0x0cd0('0x4e')][_0x0cd0('0x64')],'ListId':_0x2bd78c[_0x0cd0('0x4e')][_0x0cd0('0x65')],'active':!_[_0x0cd0('0x66')](_0x2bd78c[_0x0cd0('0x4e')][_0x0cd0('0x67')])?_0x2bd78c[_0x0cd0('0x4e')][_0x0cd0('0x67')]:!![],'description':_0x2bd78c[_0x0cd0('0x4e')][_0x0cd0('0x68')]||null,'Imap':{},'Smtp':{}};if(_0xe599b9[_0x0cd0('0x62')]){_0xe599b9[_0x0cd0('0x4b')][_0x0cd0('0x69')]=_0xe599b9[_0x0cd0('0x50')][_0x0cd0('0x69')]=_0x2bd78c[_0x0cd0('0x4e')]['username'];_0xe599b9['Imap'][_0x0cd0('0x6a')]=_0xe599b9[_0x0cd0('0x50')]['pass']=_0x2bd78c['body']['password'];if(_0x2bd78c[_0x0cd0('0x4e')][_0x0cd0('0x4f')]){_0xe599b9[_0x0cd0('0x4b')][_0x0cd0('0x4f')]=_0xe599b9[_0x0cd0('0x50')][_0x0cd0('0x4f')]=!![];_0xe599b9[_0x0cd0('0x4b')][_0x0cd0('0x51')]=_0xe599b9[_0x0cd0('0x50')]['CloudProviderId']=_0x2bd78c[_0x0cd0('0x4e')][_0x0cd0('0x51')];_0xe599b9[_0x0cd0('0x4b')][_0x0cd0('0x6a')]=_0xe599b9[_0x0cd0('0x50')][_0x0cd0('0x6b')]=null;}else{_0xe599b9[_0x0cd0('0x4b')][_0x0cd0('0x51')]=_0xe599b9[_0x0cd0('0x50')][_0x0cd0('0x51')]=null;}_0xe599b9['Imap'][_0x0cd0('0x6c')]=_0xe599b9['Smtp'][_0x0cd0('0x6c')]=null;_0xe599b9[_0x0cd0('0x4b')][_0x0cd0('0x6d')]=_0xe599b9[_0x0cd0('0x50')]['host']=null;_0xe599b9[_0x0cd0('0x4b')][_0x0cd0('0x6e')]=_0xe599b9[_0x0cd0('0x50')][_0x0cd0('0x6e')]=null;}else{if(_0x2bd78c[_0x0cd0('0x4e')][_0x0cd0('0x6f')]){_0xe599b9[_0x0cd0('0x4b')][_0x0cd0('0x69')]=_0xe599b9['Smtp'][_0x0cd0('0x69')]=_0x2bd78c[_0x0cd0('0x4e')][_0x0cd0('0x70')];_0xe599b9[_0x0cd0('0x4b')][_0x0cd0('0x6a')]=_0xe599b9[_0x0cd0('0x50')][_0x0cd0('0x6b')]=_0x2bd78c[_0x0cd0('0x4e')][_0x0cd0('0x6a')];}else{_0xe599b9[_0x0cd0('0x4b')]['authentication']=_0xe599b9['Smtp'][_0x0cd0('0x6f')]=![];_0xe599b9[_0x0cd0('0x4b')][_0x0cd0('0x69')]=_0xe599b9[_0x0cd0('0x50')][_0x0cd0('0x69')]=null;_0xe599b9[_0x0cd0('0x4b')][_0x0cd0('0x6a')]=_0xe599b9[_0x0cd0('0x50')]['pass']=null;}_0xe599b9[_0x0cd0('0x4b')]['host']=_0x2bd78c['body']['Imap'][_0x0cd0('0x6d')];_0xe599b9[_0x0cd0('0x4b')][_0x0cd0('0x6e')]=_0x2bd78c[_0x0cd0('0x4e')][_0x0cd0('0x4b')]['port'];_0xe599b9[_0x0cd0('0x50')]['host']=_0x2bd78c['body'][_0x0cd0('0x50')][_0x0cd0('0x6d')];_0xe599b9['Smtp'][_0x0cd0('0x6e')]=_0x2bd78c['body'][_0x0cd0('0x50')]['port'];}return db[_0x0cd0('0x30')][_0x0cd0('0x5d')](_0xe599b9,{'include':[{'model':db[_0x0cd0('0x2e')],'as':'Smtp'},{'model':db[_0x0cd0('0x2d')],'as':_0x0cd0('0x4b')}]})[_0x0cd0('0x11')](function(_0x416a15){var _0x34794e=_0x2bd78c['user'][_0x0cd0('0x26')]({'plain':!![]});if(!_0x34794e)throw new Error(_0x0cd0('0x71'));if(_0x34794e[_0x0cd0('0x72')]===_0x0cd0('0x69')){var _0x39e091=_0x416a15[_0x0cd0('0x26')]({'plain':!![]});return db[_0x0cd0('0x73')][_0x0cd0('0x4d')]({'where':{'name':'MailAccounts','userProfileId':_0x34794e['userProfileId']},'raw':!![]})[_0x0cd0('0x11')](function(_0xd8129e){if(_0xd8129e&&_0xd8129e[_0x0cd0('0x74')]===0x0){return db['UserProfileResource'][_0x0cd0('0x5d')]({'name':_0x39e091['name'],'resourceId':_0x39e091['id'],'type':_0xd8129e[_0x0cd0('0x2b')],'sectionId':_0xd8129e['id']},{})[_0x0cd0('0x11')](function(){return _0x416a15;});}else{return _0x416a15;}})[_0x0cd0('0x48')](function(_0x5b175b){logger[_0x0cd0('0x16')](_0x0cd0('0x75'),_0x5b175b);throw _0x5b175b;});}return _0x416a15;})[_0x0cd0('0x11')](respondWithResult(_0x3a2a92,0xc9))[_0x0cd0('0x48')](handleError(_0x3a2a92,null));};exports['getImap']=function(_0x49342f,_0xc819b4){return db[_0x0cd0('0x30')][_0x0cd0('0x56')]({'where':{'id':_0x49342f[_0x0cd0('0x4a')]['id']}})[_0x0cd0('0x11')](handleEntityNotFound(_0xc819b4,null))[_0x0cd0('0x11')](function(_0x2db46b){if(_0x2db46b){return _0x2db46b['getImap']();}return null;})['then'](respondWithResult(_0xc819b4,null))[_0x0cd0('0x48')](handleError(_0xc819b4,null));};exports[_0x0cd0('0x76')]=function(_0x2d34de,_0x244e82){if(_0x2d34de[_0x0cd0('0x4e')]['id']){delete _0x2d34de['body']['id'];}return db[_0x0cd0('0x30')][_0x0cd0('0x4d')]({'where':{'id':_0x2d34de[_0x0cd0('0x4a')]['id']}})[_0x0cd0('0x11')](handleEntityNotFound(_0x244e82,null))['then'](function(_0x36d733){if(_0x36d733){_0x2d34de[_0x0cd0('0x4e')]['MailAccountId']=_0x36d733['id'];return db[_0x0cd0('0x2d')][_0x0cd0('0x5d')](_0x2d34de['body']);}})[_0x0cd0('0x11')](respondWithResult(_0x244e82,null))['catch'](handleError(_0x244e82,null));};exports[_0x0cd0('0x77')]=function(_0x507d70,_0x2bb321){return db[_0x0cd0('0x30')][_0x0cd0('0x56')]({'where':{'id':_0x507d70['params']['id']}})[_0x0cd0('0x11')](handleEntityNotFound(_0x2bb321,null))[_0x0cd0('0x11')](function(_0x4fd0dc){if(_0x4fd0dc){return _0x4fd0dc[_0x0cd0('0x78')](null);}return null;})[_0x0cd0('0x11')](respondWithStatusCode(_0x2bb321,null))[_0x0cd0('0x48')](handleError(_0x2bb321,null));};exports[_0x0cd0('0x79')]=function(_0x488a26,_0x443551){return db[_0x0cd0('0x30')]['findOne']({'where':{'id':_0x488a26['params']['id']}})[_0x0cd0('0x11')](handleEntityNotFound(_0x443551,null))[_0x0cd0('0x11')](function(_0x336835){if(_0x336835){return _0x336835[_0x0cd0('0x79')]();}return null;})[_0x0cd0('0x11')](respondWithResult(_0x443551,null))[_0x0cd0('0x48')](handleError(_0x443551,null));};exports[_0x0cd0('0x7a')]=function(_0x2ed04,_0x62882d){if(_0x2ed04[_0x0cd0('0x4e')]['id']){delete _0x2ed04[_0x0cd0('0x4e')]['id'];}return db[_0x0cd0('0x30')][_0x0cd0('0x4d')]({'where':{'id':_0x2ed04[_0x0cd0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x62882d,null))[_0x0cd0('0x11')](function(_0x168346){if(_0x168346){_0x2ed04[_0x0cd0('0x4e')][_0x0cd0('0x58')]=_0x168346['id'];return db[_0x0cd0('0x2e')][_0x0cd0('0x5d')](_0x2ed04[_0x0cd0('0x4e')]);}})[_0x0cd0('0x11')](respondWithResult(_0x62882d,null))['catch'](handleError(_0x62882d,null));};exports[_0x0cd0('0x7b')]=function(_0xa85ccb,_0x1d6e63){return db[_0x0cd0('0x30')]['findOne']({'where':{'id':_0xa85ccb['params']['id']}})[_0x0cd0('0x11')](handleEntityNotFound(_0x1d6e63,null))[_0x0cd0('0x11')](function(_0x1216db){if(_0x1216db){return _0x1216db[_0x0cd0('0x7c')](null);}return null;})['then'](respondWithStatusCode(_0x1d6e63,null))['catch'](handleError(_0x1d6e63,null));};exports[_0x0cd0('0x7d')]=function(_0x41dd05,_0x4e3be5){return db[_0x0cd0('0x7e')][_0x0cd0('0x4d')]({'where':{'id':_0x41dd05[_0x0cd0('0x4a')]['id']}})[_0x0cd0('0x11')](handleEntityNotFound(_0x4e3be5,null))['then'](function(_0x3eecc1){if(_0x3eecc1){return _0x3eecc1[_0x0cd0('0x7d')](_0x41dd05[_0x0cd0('0x4e')][_0x0cd0('0x5b')],_[_0x0cd0('0x7f')](_0x41dd05[_0x0cd0('0x4e')],['ids','id'])||{});}})['then'](respondWithResult(_0x4e3be5,null))[_0x0cd0('0x48')](handleError(_0x4e3be5,null));};exports[_0x0cd0('0x80')]=function(_0x58d8e3,_0x38c06e){var _0x138155={'raw':![],'where':{}};var _0x14c212={};var _0x11edbb={'count':0x0,'rows':[]};return db['MailAccount'][_0x0cd0('0x56')]({'where':{'id':_0x58d8e3[_0x0cd0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x38c06e,null))[_0x0cd0('0x11')](function(_0x2f65eb){if(_0x2f65eb){_0x14c212[_0x0cd0('0x34')]=_[_0x0cd0('0x37')](db[_0x0cd0('0x7e')][_0x0cd0('0x31')]);_0x14c212['query']=_['keys'](_0x58d8e3['query']);_0x14c212[_0x0cd0('0x38')]=_[_0x0cd0('0x39')](_0x14c212[_0x0cd0('0x34')],_0x14c212[_0x0cd0('0x36')]);_0x138155[_0x0cd0('0x3a')]=_[_0x0cd0('0x39')](_0x14c212[_0x0cd0('0x34')],qs[_0x0cd0('0x3b')](_0x58d8e3[_0x0cd0('0x36')][_0x0cd0('0x3b')]));_0x138155[_0x0cd0('0x3a')]=_0x138155[_0x0cd0('0x3a')]['length']?_0x138155[_0x0cd0('0x3a')]:_0x14c212[_0x0cd0('0x34')];if(!_0x58d8e3[_0x0cd0('0x36')][_0x0cd0('0x3d')](_0x0cd0('0x3e'))){_0x138155[_0x0cd0('0x20')]=qs[_0x0cd0('0x20')](_0x58d8e3['query']['limit']);_0x138155[_0x0cd0('0x1f')]=qs[_0x0cd0('0x1f')](_0x58d8e3[_0x0cd0('0x36')][_0x0cd0('0x1f')]);}_0x138155['order']=qs[_0x0cd0('0x40')](_0x58d8e3[_0x0cd0('0x36')][_0x0cd0('0x40')]);_0x138155[_0x0cd0('0x41')]=qs[_0x0cd0('0x38')](_['pick'](_0x58d8e3[_0x0cd0('0x36')],_0x14c212[_0x0cd0('0x38')]));_0x138155['where'][_0x0cd0('0x58')]=_0x2f65eb['id'];if(_0x58d8e3[_0x0cd0('0x36')]['filter']){_0x138155[_0x0cd0('0x41')]=_[_0x0cd0('0x43')](_0x138155[_0x0cd0('0x41')],{'$or':_[_0x0cd0('0x35')](_0x138155['attributes'],function(_0x5c47bf){var _0x2f94b3={};_0x2f94b3[_0x5c47bf]={'$like':'%'+_0x58d8e3[_0x0cd0('0x36')]['filter']+'%'};return _0x2f94b3;})});}_0x138155=_[_0x0cd0('0x43')]({},_0x138155,_0x58d8e3[_0x0cd0('0x44')]);return db[_0x0cd0('0x7e')]['count']({'where':_0x138155[_0x0cd0('0x41')]})[_0x0cd0('0x11')](function(_0x43d979){_0x11edbb[_0x0cd0('0x22')]=_0x43d979;if(_0x58d8e3[_0x0cd0('0x36')][_0x0cd0('0x45')]){_0x138155[_0x0cd0('0x46')]=[{'model':db['CmContact'],'as':_0x0cd0('0x81'),'required':![]},{'model':db[_0x0cd0('0x82')],'as':_0x0cd0('0x83'),'attributes':['name',_0x0cd0('0x84'),_0x0cd0('0x85')],'required':![]},{'model':db['Tag'],'as':_0x0cd0('0x86'),'attributes':['id',_0x0cd0('0x2b'),_0x0cd0('0x87')],'where':_0x58d8e3['query'][_0x0cd0('0x88')]?{'id':_0x58d8e3[_0x0cd0('0x36')][_0x0cd0('0x88')]}:undefined,'required':_0x58d8e3[_0x0cd0('0x36')][_0x0cd0('0x88')]?!![]:![]}];}return db[_0x0cd0('0x7e')][_0x0cd0('0x47')](_0x138155);})['then'](function(_0x10c12f){_0x11edbb[_0x0cd0('0x59')]=_0x10c12f;return _0x11edbb;});}})[_0x0cd0('0x11')](respondWithFilteredResult(_0x38c06e,_0x138155))[_0x0cd0('0x48')](handleError(_0x38c06e,null));};exports[_0x0cd0('0x89')]=function addApplications(_0x34d534,_0x41a466){var _0x1addd7=_0x34d534['params']['id'];var _0x57f312=_0x34d534[_0x0cd0('0x4e')];var _0x27d97d=0xc8;var _0x279ca0=null;return db['sequelize'][_0x0cd0('0x8a')]({'isolationLevel':db[_0x0cd0('0x8b')][_0x0cd0('0x8c')]['ISOLATION_LEVELS'][_0x0cd0('0x8d')]},function(_0x3f3fa7){return db[_0x0cd0('0x30')][_0x0cd0('0x56')]({'where':{'id':_0x1addd7},'transaction':_0x3f3fa7})[_0x0cd0('0x11')](function(_0x75b272){if(_0x75b272){return db[_0x0cd0('0x8e')][_0x0cd0('0x29')]({'where':{'MailAccountId':_0x1addd7},'transaction':_0x3f3fa7})[_0x0cd0('0x11')](function(){var _0x150c44=_[_0x0cd0('0x35')](_0x57f312,function(_0x2a83d9){_0x2a83d9[_0x0cd0('0x58')]=_0x1addd7;return _0x2a83d9;});return db[_0x0cd0('0x8e')][_0x0cd0('0x8f')](_0x150c44,{'transaction':_0x3f3fa7});});}else{_0x27d97d=0x194;_0x279ca0=[];}});})['then'](function(){if(_0x27d97d!==0x194){return db[_0x0cd0('0x8e')][_0x0cd0('0x90')]({'where':{'MailAccountId':_0x1addd7},'order':_0x0cd0('0x91')})[_0x0cd0('0x11')](function(_0x5b4163){_0x279ca0=_0x5b4163;});}})['catch'](function(_0x42ab22){_0x27d97d=0x1f4;logger['error'](_0x42ab22[_0x0cd0('0x2a')]);if(_0x42ab22['name']){delete _0x42ab22[_0x0cd0('0x2b')];}_0x279ca0=_0x42ab22;})[_0x0cd0('0x92')](function(){if(_0x279ca0===null){_0x41a466[_0x0cd0('0x1b')](_0x27d97d);}else{if(_0x27d97d===0x1f4){_0x41a466[_0x0cd0('0x1c')](_0x27d97d)[_0x0cd0('0x2c')](_0x279ca0);}else{_0x41a466[_0x0cd0('0x1c')](_0x27d97d)[_0x0cd0('0x1e')](_0x279ca0);}}});};exports[_0x0cd0('0x93')]=function(_0x259d9b,_0x3237b6){var _0x1df975={};var _0x347117={};var _0x575a9f;var _0x19bc53;return db[_0x0cd0('0x30')][_0x0cd0('0x56')]({'where':{'id':_0x259d9b['params']['id']}})[_0x0cd0('0x11')](handleEntityNotFound(_0x3237b6,null))['then'](function(_0x524446){if(_0x524446){_0x575a9f=_0x524446;_0x347117[_0x0cd0('0x34')]=_[_0x0cd0('0x37')](db[_0x0cd0('0x8e')]['rawAttributes']);_0x347117['query']=_[_0x0cd0('0x37')](_0x259d9b['query']);_0x347117[_0x0cd0('0x38')]=_['intersection'](_0x347117[_0x0cd0('0x34')],_0x347117[_0x0cd0('0x36')]);_0x1df975['attributes']=_[_0x0cd0('0x39')](_0x347117[_0x0cd0('0x34')],qs[_0x0cd0('0x3b')](_0x259d9b[_0x0cd0('0x36')][_0x0cd0('0x3b')]));_0x1df975[_0x0cd0('0x3a')]=_0x1df975[_0x0cd0('0x3a')][_0x0cd0('0x3c')]?_0x1df975[_0x0cd0('0x3a')]:_0x347117['model'];_0x1df975[_0x0cd0('0x3f')]=qs[_0x0cd0('0x40')](_0x259d9b[_0x0cd0('0x36')][_0x0cd0('0x40')]);_0x1df975['where']=qs[_0x0cd0('0x38')](_[_0x0cd0('0x57')](_0x259d9b[_0x0cd0('0x36')],_0x347117['filters']));if(_0x259d9b[_0x0cd0('0x36')][_0x0cd0('0x42')]){_0x1df975[_0x0cd0('0x41')]=_[_0x0cd0('0x43')](_0x1df975[_0x0cd0('0x41')],{'$or':_[_0x0cd0('0x35')](_0x1df975['attributes'],function(_0x245ed8){var _0x3e6cfb={};_0x3e6cfb[_0x245ed8]={'$like':'%'+_0x259d9b['query'][_0x0cd0('0x42')]+'%'};return _0x3e6cfb;})});}_0x1df975=_[_0x0cd0('0x43')]({},_0x1df975,_0x259d9b['options']);return _0x575a9f[_0x0cd0('0x93')](_0x1df975);}})[_0x0cd0('0x11')](function(_0x1ba3af){if(_0x1ba3af){_0x19bc53=_0x1ba3af[_0x0cd0('0x3c')];if(!_0x259d9b[_0x0cd0('0x36')]['hasOwnProperty'](_0x0cd0('0x3e'))){_0x1df975[_0x0cd0('0x20')]=qs['limit'](_0x259d9b[_0x0cd0('0x36')][_0x0cd0('0x20')]);_0x1df975[_0x0cd0('0x1f')]=qs['offset'](_0x259d9b['query']['offset']);}return _0x575a9f[_0x0cd0('0x93')](_0x1df975);}})[_0x0cd0('0x11')](function(_0x344954){if(_0x344954){return _0x344954?{'count':_0x19bc53,'rows':_0x344954}:null;}})['then'](respondWithResult(_0x3237b6,null))[_0x0cd0('0x48')](handleError(_0x3237b6,null));};exports[_0x0cd0('0x94')]=function(_0x275994,_0x357054){var _0x4fd0ca={'raw':!![],'where':{}};var _0x463bfd={};var _0x476fc5={'count':0x0,'rows':[]};return db[_0x0cd0('0x30')][_0x0cd0('0x56')]({'where':{'id':_0x275994[_0x0cd0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x357054,null))[_0x0cd0('0x11')](function(_0x4f15d1){if(_0x4f15d1){_0x463bfd[_0x0cd0('0x34')]=_[_0x0cd0('0x37')](db[_0x0cd0('0x95')][_0x0cd0('0x31')]);_0x463bfd[_0x0cd0('0x36')]=_[_0x0cd0('0x37')](_0x275994['query']);_0x463bfd[_0x0cd0('0x38')]=_[_0x0cd0('0x39')](_0x463bfd[_0x0cd0('0x34')],_0x463bfd[_0x0cd0('0x36')]);_0x4fd0ca[_0x0cd0('0x3a')]=_[_0x0cd0('0x39')](_0x463bfd[_0x0cd0('0x34')],qs[_0x0cd0('0x3b')](_0x275994[_0x0cd0('0x36')]['fields']));_0x4fd0ca[_0x0cd0('0x3a')]=_0x4fd0ca[_0x0cd0('0x3a')][_0x0cd0('0x3c')]?_0x4fd0ca[_0x0cd0('0x3a')]:_0x463bfd[_0x0cd0('0x34')];if(!_0x275994[_0x0cd0('0x36')][_0x0cd0('0x3d')]('nolimit')){_0x4fd0ca[_0x0cd0('0x20')]=qs[_0x0cd0('0x20')](_0x275994[_0x0cd0('0x36')][_0x0cd0('0x20')]);_0x4fd0ca[_0x0cd0('0x1f')]=qs[_0x0cd0('0x1f')](_0x275994[_0x0cd0('0x36')]['offset']);}_0x4fd0ca[_0x0cd0('0x3f')]=qs[_0x0cd0('0x40')](_0x275994[_0x0cd0('0x36')][_0x0cd0('0x40')]);_0x4fd0ca[_0x0cd0('0x41')]=qs[_0x0cd0('0x38')](_[_0x0cd0('0x57')](_0x275994[_0x0cd0('0x36')],_0x463bfd[_0x0cd0('0x38')]));_0x4fd0ca[_0x0cd0('0x41')][_0x0cd0('0x58')]=_0x4f15d1['id'];if(_0x275994[_0x0cd0('0x36')][_0x0cd0('0x42')]){_0x4fd0ca[_0x0cd0('0x41')]=_[_0x0cd0('0x43')](_0x4fd0ca[_0x0cd0('0x41')],{'$or':_['map'](_0x4fd0ca[_0x0cd0('0x3a')],function(_0x1e122f){var _0x4158c6={};_0x4158c6[_0x1e122f]={'$like':'%'+_0x275994['query']['filter']+'%'};return _0x4158c6;})});}if(_0x275994[_0x0cd0('0x36')][_0x0cd0('0x96')]){var _0x5b5fff=_0x275994[_0x0cd0('0x36')][_0x0cd0('0x96')]['split'](',');var _0x28bc70={};_0x28bc70[_0x5b5fff[0x0]]={'$gte':moment(_0x5b5fff[0x1])['format'](_0x0cd0('0x97'))};_0x4fd0ca[_0x0cd0('0x41')]=_[_0x0cd0('0x43')](_0x4fd0ca[_0x0cd0('0x41')],_0x28bc70);}_0x4fd0ca=_[_0x0cd0('0x43')]({},_0x4fd0ca,_0x275994['options']);return db[_0x0cd0('0x95')][_0x0cd0('0x22')]({'where':_0x4fd0ca['where']})[_0x0cd0('0x11')](function(_0x3beb5e){_0x476fc5[_0x0cd0('0x22')]=_0x3beb5e;if(_0x275994[_0x0cd0('0x36')][_0x0cd0('0x45')]){_0x4fd0ca[_0x0cd0('0x46')]=[{'all':!![]}];}return db[_0x0cd0('0x95')][_0x0cd0('0x47')](_0x4fd0ca);})[_0x0cd0('0x11')](function(_0x5ae6a8){if(_0x275994[_0x0cd0('0x36')]['inlineCss']===_0x0cd0('0x98')){for(var _0x107503=0x0;_0x107503<_0x5ae6a8[_0x0cd0('0x3c')];_0x107503++){_0x5ae6a8[_0x107503][_0x0cd0('0x4e')]=juice(_0x5ae6a8[_0x107503][_0x0cd0('0x4e')]);}}_0x476fc5['rows']=_0x5ae6a8;return _0x476fc5;});}})['then'](respondWithFilteredResult(_0x357054,_0x4fd0ca))[_0x0cd0('0x48')](handleError(_0x357054,null));};exports['send']=function(_0x3fd06a,_0x248584){var _0x48d682,_0x18fbbd={},_0x40d610;if(_0x3fd06a['body']['to']){_0x40d610=_0x3fd06a[_0x0cd0('0x4e')]['to'][_0x0cd0('0x99')](',')[0x0];}return db[_0x0cd0('0x30')][_0x0cd0('0x4d')]({'where':{'id':_0x3fd06a[_0x0cd0('0x4a')]['id']},'include':[{'model':db[_0x0cd0('0x9a')],'as':'List','include':[{'model':db['CmContact'],'as':_0x0cd0('0x9b'),'where':{'email':_0x40d610},'limit':0x1,'order':[[_0x0cd0('0x9c'),'DESC']]}]},{'model':db[_0x0cd0('0x2e')],'as':_0x0cd0('0x50'),'raw':!![]}]})[_0x0cd0('0x11')](handleEntityNotFound(_0x248584,null))[_0x0cd0('0x11')](function(_0x4f9f15){if(_0x4f9f15){_0x48d682=_0x4f9f15;if(_0x4f9f15[_0x0cd0('0x50')]){if(_[_0x0cd0('0x66')](_0x3fd06a[_0x0cd0('0x4e')][_0x0cd0('0x9d')])){_0x3fd06a['body'][_0x0cd0('0x9d')]=util[_0x0cd0('0x9e')]('%s\x20<%s>',_0x4f9f15[_0x0cd0('0x2b')],_0x4f9f15[_0x0cd0('0x64')]||_0x4f9f15['Smtp'][_0x0cd0('0x69')]);}if(_0x3fd06a[_0x0cd0('0x4e')]['attachments']&&_0x3fd06a['body'][_0x0cd0('0x9f')][_0x0cd0('0x3c')]){for(var _0x424a87=0x0;_0x424a87<_0x3fd06a[_0x0cd0('0x4e')][_0x0cd0('0x9f')][_0x0cd0('0x3c')];_0x424a87+=0x1){_0x3fd06a['body'][_0x0cd0('0x9f')][_0x424a87]={'filename':_0x3fd06a[_0x0cd0('0x4e')][_0x0cd0('0x9f')][_0x424a87][_0x0cd0('0x2b')],'path':path[_0x0cd0('0xa0')](config[_0x0cd0('0xa1')],_0x0cd0('0xa2'),_0x3fd06a[_0x0cd0('0x4e')][_0x0cd0('0x9f')][_0x424a87][_0x0cd0('0xa3')])};}}var _0x51cebe={'tls':{'rejectUnauthorized':![]}};if(_[_0x0cd0('0x66')](_0x4f9f15[_0x0cd0('0x50')][_0x0cd0('0x6c')])){if(_0x4f9f15['Smtp']['authentication']){_0x51cebe[_0x0cd0('0xa4')]={'user':_0x4f9f15['Smtp'][_0x0cd0('0x69')],'pass':_0x4f9f15[_0x0cd0('0x50')]['pass']};}_0x51cebe[_0x0cd0('0x6d')]=_0x4f9f15[_0x0cd0('0x50')]['host'];_0x51cebe[_0x0cd0('0x6e')]=_0x4f9f15[_0x0cd0('0x50')][_0x0cd0('0x6e')];_0x51cebe[_0x0cd0('0xa5')]=_0x4f9f15[_0x0cd0('0x50')][_0x0cd0('0xa5')];}else{_0x51cebe['service']=_0x4f9f15['Smtp'][_0x0cd0('0x6c')];_0x51cebe[_0x0cd0('0xa4')]={'user':_0x4f9f15[_0x0cd0('0x50')][_0x0cd0('0x69')],'pass':_0x4f9f15[_0x0cd0('0x50')]['pass']};}return respondWithRpcPromise(_0x0cd0('0xa6'),_0x0cd0('0xa7'),{'account':_0x51cebe,'message':_0x3fd06a['body']});}else{throw new Error(_0x0cd0('0xa8'));}}})[_0x0cd0('0x11')](function(_0x174d63){if(_0x174d63){_0x18fbbd=_0x174d63;if(_0x48d682[_0x0cd0('0xa9')]){if(_0x48d682[_0x0cd0('0xa9')][_0x0cd0('0x9b')][_0x0cd0('0x3c')]){return _0x48d682[_0x0cd0('0xa9')][_0x0cd0('0x9b')][0x0];}else{return db[_0x0cd0('0xaa')][_0x0cd0('0x5d')](_['defaults'](_0x3fd06a['body'],{'firstName':_0x3fd06a[_0x0cd0('0x4e')]['to'],'email':_0x3fd06a[_0x0cd0('0x4e')]['to'],'phone':_0x3fd06a[_0x0cd0('0x4e')]['to'],'ListId':_0x48d682[_0x0cd0('0x65')]}));}}else{throw new Error(_0x0cd0('0xa8'));}}})[_0x0cd0('0x11')](function(_0x293dd){if(_0x293dd){var _0x4385c8={'UserId':_0x3fd06a[_0x0cd0('0x69')]['id'],'ContactId':_0x293dd['id'],'MailAccountId':_0x48d682['id'],'inReplyTo':_0x18fbbd[_0x0cd0('0xab')],'to':_0x3fd06a[_0x0cd0('0x4e')][_0x0cd0('0x9d')],'cc':_0x3fd06a[_0x0cd0('0x4e')]['cc'],'subject':_0x3fd06a[_0x0cd0('0x4e')][_0x0cd0('0xac')],'attach':_0x3fd06a[_0x0cd0('0x4e')]['attach'],'firstMsgDirection':'out','lastMsgAt':moment()[_0x0cd0('0x9e')](_0x0cd0('0x97')),'lastMsgDirection':_0x0cd0('0xad'),'Messages':[_[_0x0cd0('0x43')](_0x3fd06a[_0x0cd0('0x4e')],{'messageId':_0x18fbbd[_0x0cd0('0xab')],'sentAt':moment()[_0x0cd0('0x9e')](_0x0cd0('0x97')),'read':!![],'MailAccountId':_0x48d682['id'],'UserId':_0x3fd06a['user']['id'],'ContactId':_0x293dd['id']})]};if(_0x3fd06a[_0x0cd0('0x4e')][_0x0cd0('0xae')]){_0x4385c8=_[_0x0cd0('0x43')](_0x4385c8,_0x3fd06a['body']['Interaction']);}return db[_0x0cd0('0x7e')]['create'](_0x4385c8,{'include':[{'model':db[_0x0cd0('0x95')],'as':_0x0cd0('0xaf')}]});}})[_0x0cd0('0x11')](respondWithResult(_0x248584,null))['catch'](handleError(_0x248584,null));};exports['verifySmtp']=function(_0x45e9df,_0x57afaf){return db['MailAccount'][_0x0cd0('0x4d')]({'where':{'id':_0x45e9df[_0x0cd0('0x4a')]['id']},'include':[{'model':db[_0x0cd0('0x2e')],'as':_0x0cd0('0x50'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x0cd0('0xb0'),'raw':!![]}]}]})[_0x0cd0('0x11')](handleEntityNotFound(_0x57afaf,null))[_0x0cd0('0x11')](function(_0x3b2e0c){if(!_0x3b2e0c[_0x0cd0('0x50')])return;var _0x5a15f5={'id':_0x3b2e0c['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3b2e0c[_0x0cd0('0x62')]!==_0x0cd0('0x63')){_0x5a15f5[_0x0cd0('0x6c')]=_0x3b2e0c[_0x0cd0('0x62')];}else{_0x5a15f5['host']=_0x3b2e0c[_0x0cd0('0x50')][_0x0cd0('0x6d')];_0x5a15f5[_0x0cd0('0x6e')]=_0x3b2e0c['Smtp'][_0x0cd0('0x6e')];_0x5a15f5[_0x0cd0('0xa5')]=_0x3b2e0c[_0x0cd0('0x50')][_0x0cd0('0xa5')];}if(_0x3b2e0c['Smtp']['authentication']){if(_0x3b2e0c[_0x0cd0('0x50')][_0x0cd0('0x4f')]){_0x5a15f5['auth']={'type':_0x0cd0('0xb1'),'user':_0x3b2e0c[_0x0cd0('0x50')][_0x0cd0('0x69')],'accessToken':_0x3b2e0c[_0x0cd0('0x50')][_0x0cd0('0xb0')][_0x0cd0('0xb2')]};}else{_0x5a15f5['auth']={'user':_0x3b2e0c[_0x0cd0('0x50')][_0x0cd0('0x69')],'pass':_0x3b2e0c[_0x0cd0('0x50')]['pass']};}}return respondWithRpcPromise('VerifySmtp','verifySmtp',{'account':_0x5a15f5});})[_0x0cd0('0x11')](respondWithResult(_0x57afaf,null))[_0x0cd0('0x48')](handleError(_0x57afaf,null));};exports[_0x0cd0('0x29')]=function(_0x466761,_0x2c44bc){return db['MailAccount'][_0x0cd0('0x4d')]({'where':{'id':_0x466761[_0x0cd0('0x4a')]['id']}})[_0x0cd0('0x11')](handleEntityNotFound(_0x2c44bc,null))[_0x0cd0('0x11')](function(_0x4d8c7a){if(_0x4d8c7a&&_0x4d8c7a[_0x0cd0('0x6c')]){throw new db[(_0x0cd0('0xb3'))][(_0x0cd0('0xb4'))](_0x0cd0('0xb5'));}return _0x4d8c7a;})['then'](removeEntity(_0x2c44bc,null))[_0x0cd0('0x48')](handleError(_0x2c44bc,null));};exports[_0x0cd0('0xb6')]=function(_0x1247de,_0x2a0146){return db[_0x0cd0('0x30')]['find']({'where':{'id':_0x1247de[_0x0cd0('0x4a')]['id']}})[_0x0cd0('0x11')](handleEntityNotFound(_0x2a0146,null))[_0x0cd0('0x11')](function(_0x2b9365){if(_0x2b9365){return _0x2b9365[_0x0cd0('0xb6')](_0x1247de[_0x0cd0('0x4e')][_0x0cd0('0x5b')],_[_0x0cd0('0x7f')](_0x1247de[_0x0cd0('0x4e')],[_0x0cd0('0x5b'),'id'])||{})[_0x0cd0('0xb7')](function(_0x1fcbda){for(var _0x396e6a=0x0;_0x396e6a<_0x1247de[_0x0cd0('0x4e')][_0x0cd0('0x5b')][_0x0cd0('0x3c')];_0x396e6a+=0x1){socket[_0x0cd0('0xb8')](_0x0cd0('0xb9'),{'UserId':Number(_0x1247de['body'][_0x0cd0('0x5b')][_0x396e6a]),'MailAccountId':Number(_0x1247de[_0x0cd0('0x4a')]['id'])});}return _0x1fcbda;});}})['then'](respondWithResult(_0x2a0146,null))[_0x0cd0('0x48')](handleError(_0x2a0146,null));};exports[_0x0cd0('0xba')]=function(_0x178912,_0xb06b2a){return db['MailAccount'][_0x0cd0('0x4d')]({'where':{'id':_0x178912[_0x0cd0('0x4a')]['id']}})[_0x0cd0('0x11')](handleEntityNotFound(_0xb06b2a,null))[_0x0cd0('0x11')](function(_0x12b2b5){if(_0x12b2b5){return _0x12b2b5['removeAgents'](_0x178912[_0x0cd0('0x36')][_0x0cd0('0x5b')])[_0x0cd0('0x11')](function(){if(_['isArray'](_0x178912['query'][_0x0cd0('0x5b')])){for(var _0x166956=0x0;_0x166956<_0x178912[_0x0cd0('0x36')][_0x0cd0('0x5b')][_0x0cd0('0x3c')];_0x166956+=0x1){socket['emit'](_0x0cd0('0xbb'),{'UserId':Number(_0x178912['query']['ids'][_0x166956]),'MailAccountId':Number(_0x178912[_0x0cd0('0x4a')]['id'])});}}else{socket[_0x0cd0('0xb8')](_0x0cd0('0xbb'),{'UserId':Number(_0x178912[_0x0cd0('0x36')][_0x0cd0('0x5b')]),'MailAccountId':Number(_0x178912[_0x0cd0('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0xb06b2a,null))[_0x0cd0('0x48')](handleError(_0xb06b2a,null));};exports[_0x0cd0('0xbc')]=function(_0x42b25,_0x4abb21){var _0x3178a5={};var _0x394ab8={};var _0x493bf5;var _0x124a26;return db[_0x0cd0('0x30')][_0x0cd0('0x56')]({'where':{'id':_0x42b25['params']['id']}})[_0x0cd0('0x11')](handleEntityNotFound(_0x4abb21,null))['then'](function(_0x1da35c){if(_0x1da35c){_0x493bf5=_0x1da35c;_0x394ab8[_0x0cd0('0x34')]=_[_0x0cd0('0x37')](db[_0x0cd0('0x82')][_0x0cd0('0x31')]);_0x394ab8[_0x0cd0('0x36')]=_[_0x0cd0('0x37')](_0x42b25[_0x0cd0('0x36')]);_0x394ab8['filters']=_[_0x0cd0('0x39')](_0x394ab8[_0x0cd0('0x34')],_0x394ab8[_0x0cd0('0x36')]);_0x3178a5['attributes']=_['intersection'](_0x394ab8[_0x0cd0('0x34')],qs[_0x0cd0('0x3b')](_0x42b25[_0x0cd0('0x36')][_0x0cd0('0x3b')]));_0x3178a5['attributes']=_0x3178a5['attributes'][_0x0cd0('0x3c')]?_0x3178a5[_0x0cd0('0x3a')]:_0x394ab8[_0x0cd0('0x34')];_0x3178a5[_0x0cd0('0x3f')]=qs[_0x0cd0('0x40')](_0x42b25[_0x0cd0('0x36')][_0x0cd0('0x40')]);_0x3178a5[_0x0cd0('0x41')]=qs['filters'](_[_0x0cd0('0x57')](_0x42b25[_0x0cd0('0x36')],_0x394ab8[_0x0cd0('0x38')]));if(_0x42b25[_0x0cd0('0x36')][_0x0cd0('0x42')]){_0x3178a5[_0x0cd0('0x41')]=_[_0x0cd0('0x43')](_0x3178a5[_0x0cd0('0x41')],{'$or':_[_0x0cd0('0x35')](_0x3178a5[_0x0cd0('0x3a')],function(_0x194833){var _0x50b75a={};_0x50b75a[_0x194833]={'$like':'%'+_0x42b25[_0x0cd0('0x36')][_0x0cd0('0x42')]+'%'};return _0x50b75a;})});}_0x3178a5=_[_0x0cd0('0x43')]({},_0x3178a5,_0x42b25[_0x0cd0('0x44')]);return _0x493bf5[_0x0cd0('0xbc')](_0x3178a5);}})[_0x0cd0('0x11')](function(_0x4bbeb5){if(_0x4bbeb5){_0x124a26=_0x4bbeb5[_0x0cd0('0x3c')];if(!_0x42b25[_0x0cd0('0x36')][_0x0cd0('0x3d')](_0x0cd0('0x3e'))){_0x3178a5[_0x0cd0('0x20')]=qs[_0x0cd0('0x20')](_0x42b25[_0x0cd0('0x36')][_0x0cd0('0x20')]);_0x3178a5['offset']=qs['offset'](_0x42b25['query']['offset']);}return _0x493bf5[_0x0cd0('0xbc')](_0x3178a5);}})[_0x0cd0('0x11')](function(_0x24f4f7){if(_0x24f4f7){return _0x24f4f7?{'count':_0x124a26,'rows':_0x24f4f7}:null;}})[_0x0cd0('0x11')](respondWithResult(_0x4abb21,null))[_0x0cd0('0x48')](handleError(_0x4abb21,null));}; \ No newline at end of file +var _0xc2dd=['catch','show','params','Smtp','find','body','modernAuthentication','CloudProviderId','describe','addDisposition','Disposition','getDispositions','nolimit','MailAccountId','removeDispositions','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','create','key','custom','provider','email','ListId','isNil','active','user','username','password','pass','service','host','authentication','port','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','findOne','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','ids','omit','getInteractions','MailInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','from','attachments','join','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','subject','attach','out','Interaction','verifySmtp','CloudProvider','OAuth2','data5','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','moment','bluebird','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','update','destroy','MailAccounts','UserProfileResource','stack','name','send','MailServerIn','Imap','MailServerOut','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','type','map','keys','query','filters','model','intersection','fields','attributes','length','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows'];(function(_0x4099ee,_0x38495a){var _0x1b7bfc=function(_0x5f5388){while(--_0x5f5388){_0x4099ee['push'](_0x4099ee['shift']());}};_0x1b7bfc(++_0x38495a);}(_0xc2dd,0x1ee));var _0xdc2d=function(_0x1689b0,_0x560f91){_0x1689b0=_0x1689b0-0x0;var _0x11178b=_0xc2dd[_0x1689b0];return _0x11178b;};'use strict';var moment=require(_0xdc2d('0x0'));var BPromise=require(_0xdc2d('0x1'));var util=require('util');var path=require('path');var _=require(_0xdc2d('0x2'));var juice=require(_0xdc2d('0x3'));var Redis=require(_0xdc2d('0x4'));var qs=require(_0xdc2d('0x5'));var logger=require(_0xdc2d('0x6'))(_0xdc2d('0x7'));var config=require(_0xdc2d('0x8'));var db=require(_0xdc2d('0x9'))['db'];config[_0xdc2d('0xa')]=_['defaults'](config['redis'],{'host':_0xdc2d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdc2d('0xa')]));require('./mailAccount.socket')[_0xdc2d('0xc')](socket);var jayson=require(_0xdc2d('0xd'));var client=jayson[_0xdc2d('0xe')][_0xdc2d('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x399f4a,_0x3d038d,_0xa748e7,_0x288057){return new BPromise(function(_0xa1ad17,_0x1a5160){var _0x213b2b=_0x288057||client;return _0x213b2b[_0xdc2d('0x10')](_0x399f4a,_0xa748e7)[_0xdc2d('0x11')](function(_0x4751c){logger[_0xdc2d('0x12')](_0xdc2d('0x13'),_0x3d038d,_0xdc2d('0x14'));logger[_0xdc2d('0x15')](_0xdc2d('0x16'),_0x3d038d,_0xdc2d('0x14'),JSON[_0xdc2d('0x17')](_0x4751c));if(_0x4751c[_0xdc2d('0x18')]){if(_0x4751c[_0xdc2d('0x18')][_0xdc2d('0x19')]===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x3d038d,_0x4751c['error']['message']);return _0x1a5160(_0x4751c[_0xdc2d('0x18')]['message']);}logger[_0xdc2d('0x18')](_0xdc2d('0x13'),_0x3d038d,_0x4751c[_0xdc2d('0x18')][_0xdc2d('0x1a')]);return _0xa1ad17(_0x4751c[_0xdc2d('0x18')][_0xdc2d('0x1a')]);}else{logger[_0xdc2d('0x12')]('MailAccount,\x20%s,\x20%s',_0x3d038d,_0xdc2d('0x14'));_0xa1ad17(_0x4751c[_0xdc2d('0x1b')]['message']);}})['catch'](function(_0x38f35d){logger['error'](_0xdc2d('0x13'),_0x3d038d,_0x38f35d);_0x1a5160(_0x38f35d);});});}function respondWithStatusCode(_0x2a5e01,_0x13bc77){_0x13bc77=_0x13bc77||0xcc;return function(_0x2d6386){if(_0x2d6386){return _0x2a5e01[_0xdc2d('0x1c')](_0x13bc77);}return _0x2a5e01[_0xdc2d('0x1d')](_0x13bc77)['end']();};}function respondWithResult(_0x32e8d5,_0x2eaa21){_0x2eaa21=_0x2eaa21||0xc8;return function(_0x329aef){if(_0x329aef){return _0x32e8d5[_0xdc2d('0x1d')](_0x2eaa21)['json'](_0x329aef);}};}function respondWithFilteredResult(_0x136eba,_0xa503f4){return function(_0x460caa){if(_0x460caa){var _0x53d6dd=typeof _0xa503f4[_0xdc2d('0x1e')]===_0xdc2d('0x1f')&&typeof _0xa503f4[_0xdc2d('0x20')]==='undefined';var _0x4ed28e=_0x460caa[_0xdc2d('0x21')];var _0x72ac71=_0x53d6dd?0x0:_0xa503f4[_0xdc2d('0x1e')];var _0x21e95a=_0x53d6dd?_0x460caa[_0xdc2d('0x21')]:_0xa503f4['offset']+_0xa503f4[_0xdc2d('0x20')];var _0x16a185;if(_0x21e95a>=_0x4ed28e){_0x21e95a=_0x4ed28e;_0x16a185=0xc8;}else{_0x16a185=0xce;}_0x136eba[_0xdc2d('0x1d')](_0x16a185);return _0x136eba[_0xdc2d('0x22')](_0xdc2d('0x23'),_0x72ac71+'-'+_0x21e95a+'/'+_0x4ed28e)[_0xdc2d('0x24')](_0x460caa);}return null;};}function saveUpdates(_0x3dd355){return function(_0x41c2bf){if(_0x41c2bf){return _0x41c2bf[_0xdc2d('0x25')](_0x3dd355)[_0xdc2d('0x11')](function(_0xddfe7b){return _0xddfe7b;});}return null;};}function removeEntity(_0x4142e8){return function(_0x5d43b1){if(_0x5d43b1){return _0x5d43b1[_0xdc2d('0x26')]()['then'](function(){var _0x59d7e8=_0x5d43b1['get']({'plain':!![]});var _0x2df7c6=_0xdc2d('0x27');return db[_0xdc2d('0x28')]['destroy']({'where':{'type':_0x2df7c6,'resourceId':_0x59d7e8['id']}})[_0xdc2d('0x11')](function(){return _0x5d43b1;});})[_0xdc2d('0x11')](function(){_0x4142e8[_0xdc2d('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43cd3f){return function(_0x28499f){if(!_0x28499f){_0x43cd3f[_0xdc2d('0x1c')](0x194);}return _0x28499f;};}function handleError(_0x4acf01,_0x567ebf){_0x567ebf=_0x567ebf||0x1f4;return function(_0x4c8d63){logger['error'](_0x4c8d63[_0xdc2d('0x29')]);if(_0x4c8d63[_0xdc2d('0x2a')]){delete _0x4c8d63[_0xdc2d('0x2a')];}_0x4acf01[_0xdc2d('0x1d')](_0x567ebf)[_0xdc2d('0x2b')](_0x4c8d63);};}exports['index']=function(_0x2f0aca,_0x575f2c){var _0x310945={'include':[{'model':db[_0xdc2d('0x2c')],'as':_0xdc2d('0x2d')},{'model':db[_0xdc2d('0x2e')],'as':'Smtp'},{'model':db[_0xdc2d('0x2f')],'as':_0xdc2d('0x30')}]},_0xc93156={},_0xacc221={'count':0x0,'rows':[]};var _0x3f8d37=_['map'](db[_0xdc2d('0x31')][_0xdc2d('0x32')],function(_0x4f6923){return{'name':_0x4f6923['fieldName'],'type':_0x4f6923[_0xdc2d('0x33')]['key']};});_0xc93156['model']=_[_0xdc2d('0x34')](_0x3f8d37,_0xdc2d('0x2a'));_0xc93156['query']=_[_0xdc2d('0x35')](_0x2f0aca[_0xdc2d('0x36')]);_0xc93156[_0xdc2d('0x37')]=_['intersection'](_0xc93156[_0xdc2d('0x38')],_0xc93156['query']);_0x310945['attributes']=_[_0xdc2d('0x39')](_0xc93156[_0xdc2d('0x38')],qs[_0xdc2d('0x3a')](_0x2f0aca[_0xdc2d('0x36')]['fields']));_0x310945['attributes']=_0x310945[_0xdc2d('0x3b')][_0xdc2d('0x3c')]?_0x310945[_0xdc2d('0x3b')]:_0xc93156[_0xdc2d('0x38')];if(!_0x2f0aca[_0xdc2d('0x36')]['hasOwnProperty']('nolimit')){_0x310945['limit']=qs[_0xdc2d('0x20')](_0x2f0aca[_0xdc2d('0x36')]['limit']);_0x310945['offset']=qs['offset'](_0x2f0aca[_0xdc2d('0x36')][_0xdc2d('0x1e')]);}_0x310945[_0xdc2d('0x3d')]=qs[_0xdc2d('0x3e')](_0x2f0aca['query'][_0xdc2d('0x3e')]);_0x310945[_0xdc2d('0x3f')]=qs[_0xdc2d('0x37')](_[_0xdc2d('0x40')](_0x2f0aca[_0xdc2d('0x36')],_0xc93156[_0xdc2d('0x37')]),_0x3f8d37);if(_0x2f0aca[_0xdc2d('0x36')]['filter']){_0x310945[_0xdc2d('0x3f')]=_['merge'](_0x310945['where'],{'$or':_[_0xdc2d('0x34')](_0x3f8d37,function(_0x4a9c8c){if(_0x4a9c8c[_0xdc2d('0x33')]!==_0xdc2d('0x41')){var _0x2563df={};_0x2563df[_0x4a9c8c[_0xdc2d('0x2a')]]={'$like':'%'+_0x2f0aca['query'][_0xdc2d('0x42')]+'%'};return _0x2563df;}})});}_0x310945=_[_0xdc2d('0x43')]({},_0x310945,_0x2f0aca[_0xdc2d('0x44')]);var _0x2253c2={'where':_0x310945[_0xdc2d('0x3f')]};return db['MailAccount']['count'](_0x2253c2)[_0xdc2d('0x11')](function(_0x3d84ee){_0xacc221[_0xdc2d('0x21')]=_0x3d84ee;if(_0x2f0aca[_0xdc2d('0x36')][_0xdc2d('0x45')]){_0x310945[_0xdc2d('0x46')]=[{'all':!![]}];}return db['MailAccount'][_0xdc2d('0x47')](_0x310945);})[_0xdc2d('0x11')](function(_0x3a33f3){_0xacc221[_0xdc2d('0x48')]=_0x3a33f3;return _0xacc221;})[_0xdc2d('0x11')](respondWithFilteredResult(_0x575f2c,_0x310945))[_0xdc2d('0x49')](handleError(_0x575f2c,null));};exports[_0xdc2d('0x4a')]=function(_0x4850fd,_0x4709c7){var _0x261f36={'raw':![],'where':{'id':_0x4850fd[_0xdc2d('0x4b')]['id']},'include':[{'model':db[_0xdc2d('0x2c')],'as':_0xdc2d('0x2d')},{'model':db[_0xdc2d('0x2e')],'as':_0xdc2d('0x4c')},{'model':db[_0xdc2d('0x2f')],'as':_0xdc2d('0x30')}]},_0x482b24={};_0x482b24['model']=_[_0xdc2d('0x35')](db['MailAccount'][_0xdc2d('0x32')]);_0x482b24[_0xdc2d('0x36')]=_[_0xdc2d('0x35')](_0x4850fd[_0xdc2d('0x36')]);_0x482b24['filters']=_[_0xdc2d('0x39')](_0x482b24[_0xdc2d('0x38')],_0x482b24[_0xdc2d('0x36')]);_0x261f36[_0xdc2d('0x3b')]=_['intersection'](_0x482b24[_0xdc2d('0x38')],qs[_0xdc2d('0x3a')](_0x4850fd[_0xdc2d('0x36')][_0xdc2d('0x3a')]));_0x261f36[_0xdc2d('0x3b')]=_0x261f36['attributes'][_0xdc2d('0x3c')]?_0x261f36[_0xdc2d('0x3b')]:_0x482b24[_0xdc2d('0x38')];if(_0x4850fd[_0xdc2d('0x36')]['includeAll']){_0x261f36['include']=[{'all':!![]}];}_0x261f36=_['merge']({},_0x261f36,_0x4850fd[_0xdc2d('0x44')]);return db[_0xdc2d('0x31')][_0xdc2d('0x4d')](_0x261f36)[_0xdc2d('0x11')](handleEntityNotFound(_0x4709c7,null))[_0xdc2d('0x11')](respondWithResult(_0x4709c7,null))['catch'](handleError(_0x4709c7,null));};exports[_0xdc2d('0x25')]=function(_0x269dae,_0x504584){if(_0x269dae[_0xdc2d('0x4e')]['id']){delete _0x269dae[_0xdc2d('0x4e')]['id'];}if(_0x269dae['body']['Imap']){if(!_0x269dae[_0xdc2d('0x4e')][_0xdc2d('0x2d')][_0xdc2d('0x4f')]){_0x269dae[_0xdc2d('0x4e')]['Imap']['CloudProviderId']=null;}}if(_0x269dae['body']['Smtp']){if(!_0x269dae['body'][_0xdc2d('0x4c')][_0xdc2d('0x4f')]){_0x269dae['body']['Smtp'][_0xdc2d('0x50')]=null;}}return db[_0xdc2d('0x31')][_0xdc2d('0x4d')]({'where':{'id':_0x269dae['params']['id']},'include':[{'model':db[_0xdc2d('0x2c')],'as':_0xdc2d('0x2d')},{'model':db[_0xdc2d('0x2e')],'as':'Smtp'},{'model':db[_0xdc2d('0x2f')],'as':'mandatoryDispositionPause'}]})[_0xdc2d('0x11')](handleEntityNotFound(_0x504584,null))[_0xdc2d('0x11')](saveUpdates(_0x269dae['body'],null))[_0xdc2d('0x11')](function(_0x14ac38){if(_0x14ac38&&_0x269dae[_0xdc2d('0x4e')][_0xdc2d('0x2d')]){return db['MailServerIn'][_0xdc2d('0x25')](_0x269dae[_0xdc2d('0x4e')][_0xdc2d('0x2d')],{'where':{'MailAccountId':_0x14ac38['id']}})[_0xdc2d('0x11')](function(){return _0x14ac38;});}return _0x14ac38;})[_0xdc2d('0x11')](function(_0x52384c){if(_0x52384c&&_0x269dae[_0xdc2d('0x4e')][_0xdc2d('0x4c')]){return db[_0xdc2d('0x2e')][_0xdc2d('0x25')](_0x269dae['body']['Smtp'],{'where':{'MailAccountId':_0x52384c['id']}})[_0xdc2d('0x11')](function(){return _0x52384c;});}return _0x52384c;})['then'](respondWithResult(_0x504584,null))[_0xdc2d('0x49')](handleError(_0x504584,null));};exports[_0xdc2d('0x51')]=function(_0x2fe1d0,_0x2e3150){return db[_0xdc2d('0x31')][_0xdc2d('0x51')]()[_0xdc2d('0x11')](respondWithResult(_0x2e3150,null))[_0xdc2d('0x49')](handleError(_0x2e3150,null));};exports[_0xdc2d('0x52')]=function(_0x412513,_0x141fe5){if(_0x412513['body']['id']){delete _0x412513[_0xdc2d('0x4e')]['id'];}return db[_0xdc2d('0x31')][_0xdc2d('0x4d')]({'where':{'id':_0x412513['params']['id']}})[_0xdc2d('0x11')](handleEntityNotFound(_0x141fe5,null))[_0xdc2d('0x11')](function(_0x2108bd){if(_0x2108bd){_0x412513[_0xdc2d('0x4e')]['MailAccountId']=_0x2108bd['id'];return db[_0xdc2d('0x53')]['create'](_0x412513['body']);}})[_0xdc2d('0x11')](respondWithResult(_0x141fe5,null))[_0xdc2d('0x49')](handleError(_0x141fe5,null));};exports[_0xdc2d('0x54')]=function(_0x13ba11,_0x512216){var _0x15e18d={'raw':![],'where':{}};var _0x1804ed={};var _0x261385={'count':0x0,'rows':[]};return db[_0xdc2d('0x31')]['findOne']({'where':{'id':_0x13ba11[_0xdc2d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x512216,null))[_0xdc2d('0x11')](function(_0x5071fe){if(_0x5071fe){_0x1804ed[_0xdc2d('0x38')]=_[_0xdc2d('0x35')](db[_0xdc2d('0x53')][_0xdc2d('0x32')]);_0x1804ed['query']=_[_0xdc2d('0x35')](_0x13ba11[_0xdc2d('0x36')]);_0x1804ed[_0xdc2d('0x37')]=_[_0xdc2d('0x39')](_0x1804ed[_0xdc2d('0x38')],_0x1804ed['query']);_0x15e18d['attributes']=_[_0xdc2d('0x39')](_0x1804ed[_0xdc2d('0x38')],qs['fields'](_0x13ba11[_0xdc2d('0x36')][_0xdc2d('0x3a')]));_0x15e18d[_0xdc2d('0x3b')]=_0x15e18d['attributes']['length']?_0x15e18d[_0xdc2d('0x3b')]:_0x1804ed[_0xdc2d('0x38')];if(!_0x13ba11[_0xdc2d('0x36')]['hasOwnProperty'](_0xdc2d('0x55'))){_0x15e18d[_0xdc2d('0x20')]=qs[_0xdc2d('0x20')](_0x13ba11[_0xdc2d('0x36')][_0xdc2d('0x20')]);_0x15e18d[_0xdc2d('0x1e')]=qs[_0xdc2d('0x1e')](_0x13ba11[_0xdc2d('0x36')][_0xdc2d('0x1e')]);}_0x15e18d['order']=qs['sort'](_0x13ba11[_0xdc2d('0x36')][_0xdc2d('0x3e')]);_0x15e18d[_0xdc2d('0x3f')]=qs[_0xdc2d('0x37')](_[_0xdc2d('0x40')](_0x13ba11['query'],_0x1804ed[_0xdc2d('0x37')]));_0x15e18d[_0xdc2d('0x3f')][_0xdc2d('0x56')]=_0x5071fe['id'];if(_0x13ba11[_0xdc2d('0x36')][_0xdc2d('0x42')]){_0x15e18d[_0xdc2d('0x3f')]=_[_0xdc2d('0x43')](_0x15e18d[_0xdc2d('0x3f')],{'$or':_[_0xdc2d('0x34')](_0x15e18d['attributes'],function(_0x3a501d){var _0x3bb4af={};_0x3bb4af[_0x3a501d]={'$like':'%'+_0x13ba11[_0xdc2d('0x36')][_0xdc2d('0x42')]+'%'};return _0x3bb4af;})});}_0x15e18d=_['merge']({},_0x15e18d,_0x13ba11['options']);return db[_0xdc2d('0x53')][_0xdc2d('0x21')]({'where':_0x15e18d[_0xdc2d('0x3f')]})[_0xdc2d('0x11')](function(_0x3825ba){_0x261385[_0xdc2d('0x21')]=_0x3825ba;if(_0x13ba11[_0xdc2d('0x36')][_0xdc2d('0x45')]){_0x15e18d[_0xdc2d('0x46')]=[{'all':!![]}];}return db[_0xdc2d('0x53')][_0xdc2d('0x47')](_0x15e18d);})[_0xdc2d('0x11')](function(_0x2607ee){_0x261385[_0xdc2d('0x48')]=_0x2607ee;return _0x261385;});}})['then'](respondWithFilteredResult(_0x512216,_0x15e18d))['catch'](handleError(_0x512216,null));};exports[_0xdc2d('0x57')]=function(_0x3bccb3,_0x5e76da){return db[_0xdc2d('0x31')]['find']({'where':{'id':_0x3bccb3[_0xdc2d('0x4b')]['id']}})[_0xdc2d('0x11')](handleEntityNotFound(_0x5e76da,null))['then'](function(_0xc3bd91){if(_0xc3bd91){return _0xc3bd91[_0xdc2d('0x57')](_0x3bccb3['query']['ids']);}})[_0xdc2d('0x11')](respondWithStatusCode(_0x5e76da,null))[_0xdc2d('0x49')](handleError(_0x5e76da,null));};exports['addAnswer']=function(_0x597d40,_0x46fcec){if(_0x597d40[_0xdc2d('0x4e')]['id']){delete _0x597d40[_0xdc2d('0x4e')]['id'];}return db[_0xdc2d('0x31')][_0xdc2d('0x4d')]({'where':{'id':_0x597d40[_0xdc2d('0x4b')]['id']}})[_0xdc2d('0x11')](handleEntityNotFound(_0x46fcec,null))[_0xdc2d('0x11')](function(_0x3e29a1){if(_0x3e29a1){_0x597d40[_0xdc2d('0x4e')][_0xdc2d('0x56')]=_0x3e29a1['id'];return db[_0xdc2d('0x58')]['create'](_0x597d40[_0xdc2d('0x4e')]);}})[_0xdc2d('0x11')](respondWithResult(_0x46fcec,null))[_0xdc2d('0x49')](handleError(_0x46fcec,null));};exports[_0xdc2d('0x59')]=function(_0x4f820b,_0x8918fd){var _0x3d555f={'raw':![],'where':{}};var _0x52126f={};var _0x4e9918={'count':0x0,'rows':[]};return db[_0xdc2d('0x31')]['findOne']({'where':{'id':_0x4f820b[_0xdc2d('0x4b')]['id']}})[_0xdc2d('0x11')](handleEntityNotFound(_0x8918fd,null))['then'](function(_0x17febf){if(_0x17febf){_0x52126f['model']=_[_0xdc2d('0x35')](db[_0xdc2d('0x58')][_0xdc2d('0x32')]);_0x52126f['query']=_['keys'](_0x4f820b[_0xdc2d('0x36')]);_0x52126f['filters']=_[_0xdc2d('0x39')](_0x52126f[_0xdc2d('0x38')],_0x52126f[_0xdc2d('0x36')]);_0x3d555f['attributes']=_['intersection'](_0x52126f[_0xdc2d('0x38')],qs[_0xdc2d('0x3a')](_0x4f820b[_0xdc2d('0x36')][_0xdc2d('0x3a')]));_0x3d555f['attributes']=_0x3d555f[_0xdc2d('0x3b')][_0xdc2d('0x3c')]?_0x3d555f[_0xdc2d('0x3b')]:_0x52126f[_0xdc2d('0x38')];if(!_0x4f820b[_0xdc2d('0x36')][_0xdc2d('0x5a')](_0xdc2d('0x55'))){_0x3d555f[_0xdc2d('0x20')]=qs[_0xdc2d('0x20')](_0x4f820b['query'][_0xdc2d('0x20')]);_0x3d555f[_0xdc2d('0x1e')]=qs[_0xdc2d('0x1e')](_0x4f820b[_0xdc2d('0x36')]['offset']);}_0x3d555f['order']=qs[_0xdc2d('0x3e')](_0x4f820b[_0xdc2d('0x36')][_0xdc2d('0x3e')]);_0x3d555f[_0xdc2d('0x3f')]=qs[_0xdc2d('0x37')](_['pick'](_0x4f820b[_0xdc2d('0x36')],_0x52126f['filters']));_0x3d555f[_0xdc2d('0x3f')][_0xdc2d('0x56')]=_0x17febf['id'];if(_0x4f820b[_0xdc2d('0x36')][_0xdc2d('0x42')]){_0x3d555f[_0xdc2d('0x3f')]=_['merge'](_0x3d555f[_0xdc2d('0x3f')],{'$or':_[_0xdc2d('0x34')](_0x3d555f[_0xdc2d('0x3b')],function(_0x3758d3){var _0x2dadcf={};_0x2dadcf[_0x3758d3]={'$like':'%'+_0x4f820b['query'][_0xdc2d('0x42')]+'%'};return _0x2dadcf;})});}_0x3d555f=_['merge']({},_0x3d555f,_0x4f820b[_0xdc2d('0x44')]);return db[_0xdc2d('0x58')][_0xdc2d('0x21')]({'where':_0x3d555f['where']})[_0xdc2d('0x11')](function(_0x48f3b7){_0x4e9918[_0xdc2d('0x21')]=_0x48f3b7;if(_0x4f820b['query']['includeAll']){_0x3d555f[_0xdc2d('0x46')]=[{'all':!![]}];}return db[_0xdc2d('0x58')][_0xdc2d('0x47')](_0x3d555f);})[_0xdc2d('0x11')](function(_0x5cb1c3){_0x4e9918['rows']=_0x5cb1c3;return _0x4e9918;});}})[_0xdc2d('0x11')](respondWithFilteredResult(_0x8918fd,_0x3d555f))[_0xdc2d('0x49')](handleError(_0x8918fd,null));};exports[_0xdc2d('0x5b')]=function(_0xfa67e0,_0x25bf8a){return db[_0xdc2d('0x31')][_0xdc2d('0x4d')]({'where':{'id':_0xfa67e0[_0xdc2d('0x4b')]['id']}})[_0xdc2d('0x11')](handleEntityNotFound(_0x25bf8a,null))[_0xdc2d('0x11')](function(_0x3862ee){if(_0x3862ee){return _0x3862ee['removeAnswers'](_0xfa67e0[_0xdc2d('0x36')]['ids']);}})[_0xdc2d('0x11')](respondWithStatusCode(_0x25bf8a,null))[_0xdc2d('0x49')](handleError(_0x25bf8a,null));};exports[_0xdc2d('0x5c')]=function(_0xc9599a,_0x3b59bb){var _0x234b66={'name':_0xc9599a['body'][_0xdc2d('0x2a')],'key':_0xc9599a['body'][_0xdc2d('0x5d')],'provider':_0xc9599a['body']['provider']===_0xdc2d('0x5e')?null:_0xc9599a[_0xdc2d('0x4e')][_0xdc2d('0x5f')],'email':_0xc9599a[_0xdc2d('0x4e')][_0xdc2d('0x60')],'ListId':_0xc9599a[_0xdc2d('0x4e')][_0xdc2d('0x61')],'active':!_[_0xdc2d('0x62')](_0xc9599a[_0xdc2d('0x4e')]['active'])?_0xc9599a['body'][_0xdc2d('0x63')]:!![],'description':_0xc9599a[_0xdc2d('0x4e')]['description']||null,'Imap':{},'Smtp':{}};if(_0x234b66[_0xdc2d('0x5f')]){_0x234b66['Imap']['user']=_0x234b66[_0xdc2d('0x4c')][_0xdc2d('0x64')]=_0xc9599a[_0xdc2d('0x4e')][_0xdc2d('0x65')];_0x234b66[_0xdc2d('0x2d')][_0xdc2d('0x66')]=_0x234b66[_0xdc2d('0x4c')][_0xdc2d('0x67')]=_0xc9599a['body']['password'];if(_0xc9599a[_0xdc2d('0x4e')][_0xdc2d('0x4f')]){_0x234b66[_0xdc2d('0x2d')][_0xdc2d('0x4f')]=_0x234b66['Smtp'][_0xdc2d('0x4f')]=!![];_0x234b66[_0xdc2d('0x2d')]['CloudProviderId']=_0x234b66[_0xdc2d('0x4c')]['CloudProviderId']=_0xc9599a['body']['CloudProviderId'];_0x234b66[_0xdc2d('0x2d')][_0xdc2d('0x66')]=_0x234b66['Smtp']['pass']=null;}else{_0x234b66[_0xdc2d('0x2d')]['CloudProviderId']=_0x234b66[_0xdc2d('0x4c')][_0xdc2d('0x50')]=null;}_0x234b66[_0xdc2d('0x2d')][_0xdc2d('0x68')]=_0x234b66[_0xdc2d('0x4c')][_0xdc2d('0x68')]=null;_0x234b66['Imap']['host']=_0x234b66[_0xdc2d('0x4c')][_0xdc2d('0x69')]=null;_0x234b66['Imap']['port']=_0x234b66['Smtp']['port']=null;}else{if(_0xc9599a['body'][_0xdc2d('0x6a')]){_0x234b66[_0xdc2d('0x2d')][_0xdc2d('0x64')]=_0x234b66[_0xdc2d('0x4c')][_0xdc2d('0x64')]=_0xc9599a[_0xdc2d('0x4e')][_0xdc2d('0x65')];_0x234b66['Imap'][_0xdc2d('0x66')]=_0x234b66[_0xdc2d('0x4c')][_0xdc2d('0x67')]=_0xc9599a[_0xdc2d('0x4e')]['password'];}else{_0x234b66[_0xdc2d('0x2d')][_0xdc2d('0x6a')]=_0x234b66[_0xdc2d('0x4c')][_0xdc2d('0x6a')]=![];_0x234b66[_0xdc2d('0x2d')][_0xdc2d('0x64')]=_0x234b66[_0xdc2d('0x4c')][_0xdc2d('0x64')]=null;_0x234b66[_0xdc2d('0x2d')][_0xdc2d('0x66')]=_0x234b66[_0xdc2d('0x4c')][_0xdc2d('0x67')]=null;}_0x234b66[_0xdc2d('0x2d')][_0xdc2d('0x69')]=_0xc9599a[_0xdc2d('0x4e')]['Imap'][_0xdc2d('0x69')];_0x234b66[_0xdc2d('0x2d')][_0xdc2d('0x6b')]=_0xc9599a[_0xdc2d('0x4e')][_0xdc2d('0x2d')][_0xdc2d('0x6b')];_0x234b66['Smtp'][_0xdc2d('0x69')]=_0xc9599a[_0xdc2d('0x4e')][_0xdc2d('0x4c')]['host'];_0x234b66[_0xdc2d('0x4c')][_0xdc2d('0x6b')]=_0xc9599a[_0xdc2d('0x4e')][_0xdc2d('0x4c')][_0xdc2d('0x6b')];}return db[_0xdc2d('0x31')]['create'](_0x234b66,{'include':[{'model':db[_0xdc2d('0x2e')],'as':_0xdc2d('0x4c')},{'model':db[_0xdc2d('0x2c')],'as':'Imap'}]})['then'](function(_0x51147b){var _0x493f57=_0xc9599a[_0xdc2d('0x64')][_0xdc2d('0x6c')]({'plain':!![]});if(!_0x493f57)throw new Error(_0xdc2d('0x6d'));if(_0x493f57[_0xdc2d('0x6e')]==='user'){var _0x5a2ef3=_0x51147b['get']({'plain':!![]});return db[_0xdc2d('0x6f')][_0xdc2d('0x4d')]({'where':{'name':_0xdc2d('0x27'),'userProfileId':_0x493f57[_0xdc2d('0x70')]},'raw':!![]})[_0xdc2d('0x11')](function(_0x1bc61f){if(_0x1bc61f&&_0x1bc61f['autoAssociation']===0x0){return db[_0xdc2d('0x28')][_0xdc2d('0x5c')]({'name':_0x5a2ef3[_0xdc2d('0x2a')],'resourceId':_0x5a2ef3['id'],'type':_0x1bc61f['name'],'sectionId':_0x1bc61f['id']},{})[_0xdc2d('0x11')](function(){return _0x51147b;});}else{return _0x51147b;}})[_0xdc2d('0x49')](function(_0x23ea2b){logger['error'](_0xdc2d('0x71'),_0x23ea2b);throw _0x23ea2b;});}return _0x51147b;})[_0xdc2d('0x11')](respondWithResult(_0x3b59bb,0xc9))['catch'](handleError(_0x3b59bb,null));};exports[_0xdc2d('0x72')]=function(_0x238a11,_0x5cb614){return db[_0xdc2d('0x31')]['findOne']({'where':{'id':_0x238a11['params']['id']}})[_0xdc2d('0x11')](handleEntityNotFound(_0x5cb614,null))[_0xdc2d('0x11')](function(_0x2596a5){if(_0x2596a5){return _0x2596a5['getImap']();}return null;})[_0xdc2d('0x11')](respondWithResult(_0x5cb614,null))[_0xdc2d('0x49')](handleError(_0x5cb614,null));};exports[_0xdc2d('0x73')]=function(_0x25febd,_0x2eaa60){if(_0x25febd[_0xdc2d('0x4e')]['id']){delete _0x25febd[_0xdc2d('0x4e')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x25febd[_0xdc2d('0x4b')]['id']}})[_0xdc2d('0x11')](handleEntityNotFound(_0x2eaa60,null))[_0xdc2d('0x11')](function(_0x1bddb6){if(_0x1bddb6){_0x25febd[_0xdc2d('0x4e')]['MailAccountId']=_0x1bddb6['id'];return db[_0xdc2d('0x2c')][_0xdc2d('0x5c')](_0x25febd[_0xdc2d('0x4e')]);}})[_0xdc2d('0x11')](respondWithResult(_0x2eaa60,null))[_0xdc2d('0x49')](handleError(_0x2eaa60,null));};exports[_0xdc2d('0x74')]=function(_0x36791a,_0x57738b){return db[_0xdc2d('0x31')][_0xdc2d('0x75')]({'where':{'id':_0x36791a[_0xdc2d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x57738b,null))['then'](function(_0x394214){if(_0x394214){return _0x394214[_0xdc2d('0x76')](null);}return null;})[_0xdc2d('0x11')](respondWithStatusCode(_0x57738b,null))[_0xdc2d('0x49')](handleError(_0x57738b,null));};exports[_0xdc2d('0x77')]=function(_0x1105a9,_0x119fae){return db[_0xdc2d('0x31')][_0xdc2d('0x75')]({'where':{'id':_0x1105a9[_0xdc2d('0x4b')]['id']}})[_0xdc2d('0x11')](handleEntityNotFound(_0x119fae,null))[_0xdc2d('0x11')](function(_0x3c3f94){if(_0x3c3f94){return _0x3c3f94[_0xdc2d('0x77')]();}return null;})[_0xdc2d('0x11')](respondWithResult(_0x119fae,null))[_0xdc2d('0x49')](handleError(_0x119fae,null));};exports[_0xdc2d('0x78')]=function(_0x29d735,_0x4f714b){if(_0x29d735[_0xdc2d('0x4e')]['id']){delete _0x29d735[_0xdc2d('0x4e')]['id'];}return db[_0xdc2d('0x31')]['find']({'where':{'id':_0x29d735[_0xdc2d('0x4b')]['id']}})[_0xdc2d('0x11')](handleEntityNotFound(_0x4f714b,null))[_0xdc2d('0x11')](function(_0x37bfc7){if(_0x37bfc7){_0x29d735[_0xdc2d('0x4e')][_0xdc2d('0x56')]=_0x37bfc7['id'];return db[_0xdc2d('0x2e')][_0xdc2d('0x5c')](_0x29d735[_0xdc2d('0x4e')]);}})[_0xdc2d('0x11')](respondWithResult(_0x4f714b,null))['catch'](handleError(_0x4f714b,null));};exports[_0xdc2d('0x79')]=function(_0x524ec3,_0x1f92d5){return db['MailAccount'][_0xdc2d('0x75')]({'where':{'id':_0x524ec3[_0xdc2d('0x4b')]['id']}})[_0xdc2d('0x11')](handleEntityNotFound(_0x1f92d5,null))[_0xdc2d('0x11')](function(_0x40a5b8){if(_0x40a5b8){return _0x40a5b8[_0xdc2d('0x7a')](null);}return null;})[_0xdc2d('0x11')](respondWithStatusCode(_0x1f92d5,null))[_0xdc2d('0x49')](handleError(_0x1f92d5,null));};exports[_0xdc2d('0x7b')]=function(_0x45f238,_0x1ea1aa){return db['MailInteraction']['find']({'where':{'id':_0x45f238[_0xdc2d('0x4b')]['id']}})[_0xdc2d('0x11')](handleEntityNotFound(_0x1ea1aa,null))[_0xdc2d('0x11')](function(_0x7e203d){if(_0x7e203d){return _0x7e203d['addInteraction'](_0x45f238[_0xdc2d('0x4e')][_0xdc2d('0x7c')],_[_0xdc2d('0x7d')](_0x45f238[_0xdc2d('0x4e')],[_0xdc2d('0x7c'),'id'])||{});}})[_0xdc2d('0x11')](respondWithResult(_0x1ea1aa,null))[_0xdc2d('0x49')](handleError(_0x1ea1aa,null));};exports[_0xdc2d('0x7e')]=function(_0x4cd436,_0x1ed640){var _0x1f64f6={'raw':![],'where':{}};var _0x594a75={};var _0xf3186b={'count':0x0,'rows':[]};return db[_0xdc2d('0x31')]['findOne']({'where':{'id':_0x4cd436[_0xdc2d('0x4b')]['id']}})[_0xdc2d('0x11')](handleEntityNotFound(_0x1ed640,null))[_0xdc2d('0x11')](function(_0x38d8a3){if(_0x38d8a3){_0x594a75[_0xdc2d('0x38')]=_[_0xdc2d('0x35')](db[_0xdc2d('0x7f')][_0xdc2d('0x32')]);_0x594a75['query']=_[_0xdc2d('0x35')](_0x4cd436[_0xdc2d('0x36')]);_0x594a75[_0xdc2d('0x37')]=_[_0xdc2d('0x39')](_0x594a75[_0xdc2d('0x38')],_0x594a75[_0xdc2d('0x36')]);_0x1f64f6[_0xdc2d('0x3b')]=_[_0xdc2d('0x39')](_0x594a75[_0xdc2d('0x38')],qs[_0xdc2d('0x3a')](_0x4cd436[_0xdc2d('0x36')]['fields']));_0x1f64f6[_0xdc2d('0x3b')]=_0x1f64f6['attributes']['length']?_0x1f64f6['attributes']:_0x594a75[_0xdc2d('0x38')];if(!_0x4cd436['query'][_0xdc2d('0x5a')]('nolimit')){_0x1f64f6[_0xdc2d('0x20')]=qs[_0xdc2d('0x20')](_0x4cd436[_0xdc2d('0x36')][_0xdc2d('0x20')]);_0x1f64f6[_0xdc2d('0x1e')]=qs[_0xdc2d('0x1e')](_0x4cd436[_0xdc2d('0x36')][_0xdc2d('0x1e')]);}_0x1f64f6[_0xdc2d('0x3d')]=qs[_0xdc2d('0x3e')](_0x4cd436['query'][_0xdc2d('0x3e')]);_0x1f64f6[_0xdc2d('0x3f')]=qs['filters'](_['pick'](_0x4cd436[_0xdc2d('0x36')],_0x594a75[_0xdc2d('0x37')]));_0x1f64f6['where']['MailAccountId']=_0x38d8a3['id'];if(_0x4cd436['query'][_0xdc2d('0x42')]){_0x1f64f6['where']=_[_0xdc2d('0x43')](_0x1f64f6['where'],{'$or':_[_0xdc2d('0x34')](_0x1f64f6[_0xdc2d('0x3b')],function(_0x12eb11){var _0x25048c={};_0x25048c[_0x12eb11]={'$like':'%'+_0x4cd436[_0xdc2d('0x36')][_0xdc2d('0x42')]+'%'};return _0x25048c;})});}_0x1f64f6=_[_0xdc2d('0x43')]({},_0x1f64f6,_0x4cd436['options']);return db[_0xdc2d('0x7f')][_0xdc2d('0x21')]({'where':_0x1f64f6[_0xdc2d('0x3f')]})[_0xdc2d('0x11')](function(_0xb77f4b){_0xf3186b[_0xdc2d('0x21')]=_0xb77f4b;if(_0x4cd436[_0xdc2d('0x36')][_0xdc2d('0x45')]){_0x1f64f6['include']=[{'model':db[_0xdc2d('0x80')],'as':_0xdc2d('0x81'),'required':![]},{'model':db[_0xdc2d('0x82')],'as':_0xdc2d('0x83'),'attributes':[_0xdc2d('0x2a'),_0xdc2d('0x84'),_0xdc2d('0x85')],'required':![]},{'model':db[_0xdc2d('0x86')],'as':_0xdc2d('0x87'),'attributes':['id',_0xdc2d('0x2a'),_0xdc2d('0x88')],'where':_0x4cd436[_0xdc2d('0x36')][_0xdc2d('0x89')]?{'id':_0x4cd436['query'][_0xdc2d('0x89')]}:undefined,'required':_0x4cd436[_0xdc2d('0x36')][_0xdc2d('0x89')]?!![]:![]}];}return db[_0xdc2d('0x7f')][_0xdc2d('0x47')](_0x1f64f6);})[_0xdc2d('0x11')](function(_0x6f7d65){_0xf3186b[_0xdc2d('0x48')]=_0x6f7d65;return _0xf3186b;});}})[_0xdc2d('0x11')](respondWithFilteredResult(_0x1ed640,_0x1f64f6))[_0xdc2d('0x49')](handleError(_0x1ed640,null));};exports['addApplications']=function addApplications(_0x38124c,_0x1e46cb){var _0x4a3e6b=_0x38124c['params']['id'];var _0x3797a7=_0x38124c[_0xdc2d('0x4e')];var _0x38b48f=0xc8;var _0x637bb1=null;return db[_0xdc2d('0x8a')][_0xdc2d('0x8b')]({'isolationLevel':db[_0xdc2d('0x8a')][_0xdc2d('0x8c')][_0xdc2d('0x8d')]['READ_COMMITTED']},function(_0x2042fe){return db['MailAccount'][_0xdc2d('0x75')]({'where':{'id':_0x4a3e6b},'transaction':_0x2042fe})['then'](function(_0x3c3a20){if(_0x3c3a20){return db[_0xdc2d('0x8e')][_0xdc2d('0x26')]({'where':{'MailAccountId':_0x4a3e6b},'transaction':_0x2042fe})[_0xdc2d('0x11')](function(){var _0x196a3d=_['map'](_0x3797a7,function(_0x458269){_0x458269[_0xdc2d('0x56')]=_0x4a3e6b;return _0x458269;});return db[_0xdc2d('0x8e')][_0xdc2d('0x8f')](_0x196a3d,{'transaction':_0x2042fe});});}else{_0x38b48f=0x194;_0x637bb1=[];}});})[_0xdc2d('0x11')](function(){if(_0x38b48f!==0x194){return db['MailApplication'][_0xdc2d('0x90')]({'where':{'MailAccountId':_0x4a3e6b},'order':_0xdc2d('0x91')})[_0xdc2d('0x11')](function(_0x1c63f1){_0x637bb1=_0x1c63f1;});}})['catch'](function(_0x5ceb4c){_0x38b48f=0x1f4;logger['error'](_0x5ceb4c[_0xdc2d('0x29')]);if(_0x5ceb4c[_0xdc2d('0x2a')]){delete _0x5ceb4c[_0xdc2d('0x2a')];}_0x637bb1=_0x5ceb4c;})['finally'](function(){if(_0x637bb1===null){_0x1e46cb['sendStatus'](_0x38b48f);}else{if(_0x38b48f===0x1f4){_0x1e46cb[_0xdc2d('0x1d')](_0x38b48f)['send'](_0x637bb1);}else{_0x1e46cb['status'](_0x38b48f)['json'](_0x637bb1);}}});};exports[_0xdc2d('0x92')]=function(_0x3fe0c4,_0x3e2a62){var _0x48b8f1={};var _0x5c1d0b={};var _0x2f9abd;var _0xc3e1b4;return db[_0xdc2d('0x31')][_0xdc2d('0x75')]({'where':{'id':_0x3fe0c4[_0xdc2d('0x4b')]['id']}})[_0xdc2d('0x11')](handleEntityNotFound(_0x3e2a62,null))[_0xdc2d('0x11')](function(_0x6d0235){if(_0x6d0235){_0x2f9abd=_0x6d0235;_0x5c1d0b['model']=_[_0xdc2d('0x35')](db[_0xdc2d('0x8e')][_0xdc2d('0x32')]);_0x5c1d0b[_0xdc2d('0x36')]=_[_0xdc2d('0x35')](_0x3fe0c4['query']);_0x5c1d0b[_0xdc2d('0x37')]=_[_0xdc2d('0x39')](_0x5c1d0b[_0xdc2d('0x38')],_0x5c1d0b[_0xdc2d('0x36')]);_0x48b8f1[_0xdc2d('0x3b')]=_[_0xdc2d('0x39')](_0x5c1d0b[_0xdc2d('0x38')],qs[_0xdc2d('0x3a')](_0x3fe0c4[_0xdc2d('0x36')][_0xdc2d('0x3a')]));_0x48b8f1[_0xdc2d('0x3b')]=_0x48b8f1[_0xdc2d('0x3b')][_0xdc2d('0x3c')]?_0x48b8f1[_0xdc2d('0x3b')]:_0x5c1d0b[_0xdc2d('0x38')];_0x48b8f1[_0xdc2d('0x3d')]=qs[_0xdc2d('0x3e')](_0x3fe0c4[_0xdc2d('0x36')][_0xdc2d('0x3e')]);_0x48b8f1[_0xdc2d('0x3f')]=qs[_0xdc2d('0x37')](_[_0xdc2d('0x40')](_0x3fe0c4['query'],_0x5c1d0b[_0xdc2d('0x37')]));if(_0x3fe0c4[_0xdc2d('0x36')][_0xdc2d('0x42')]){_0x48b8f1[_0xdc2d('0x3f')]=_[_0xdc2d('0x43')](_0x48b8f1[_0xdc2d('0x3f')],{'$or':_['map'](_0x48b8f1['attributes'],function(_0x12d4fc){var _0x1cd4bb={};_0x1cd4bb[_0x12d4fc]={'$like':'%'+_0x3fe0c4[_0xdc2d('0x36')][_0xdc2d('0x42')]+'%'};return _0x1cd4bb;})});}_0x48b8f1=_['merge']({},_0x48b8f1,_0x3fe0c4[_0xdc2d('0x44')]);return _0x2f9abd[_0xdc2d('0x92')](_0x48b8f1);}})[_0xdc2d('0x11')](function(_0x41c950){if(_0x41c950){_0xc3e1b4=_0x41c950[_0xdc2d('0x3c')];if(!_0x3fe0c4[_0xdc2d('0x36')][_0xdc2d('0x5a')](_0xdc2d('0x55'))){_0x48b8f1[_0xdc2d('0x20')]=qs[_0xdc2d('0x20')](_0x3fe0c4[_0xdc2d('0x36')]['limit']);_0x48b8f1[_0xdc2d('0x1e')]=qs['offset'](_0x3fe0c4[_0xdc2d('0x36')]['offset']);}return _0x2f9abd[_0xdc2d('0x92')](_0x48b8f1);}})[_0xdc2d('0x11')](function(_0x5724e9){if(_0x5724e9){return _0x5724e9?{'count':_0xc3e1b4,'rows':_0x5724e9}:null;}})[_0xdc2d('0x11')](respondWithResult(_0x3e2a62,null))[_0xdc2d('0x49')](handleError(_0x3e2a62,null));};exports['getMessages']=function(_0x3b4b3a,_0x140151){var _0x350d0e={'raw':!![],'where':{}};var _0x588d47={};var _0x4108f9={'count':0x0,'rows':[]};return db[_0xdc2d('0x31')][_0xdc2d('0x75')]({'where':{'id':_0x3b4b3a[_0xdc2d('0x4b')]['id']}})[_0xdc2d('0x11')](handleEntityNotFound(_0x140151,null))[_0xdc2d('0x11')](function(_0x4a4da9){if(_0x4a4da9){_0x588d47['model']=_[_0xdc2d('0x35')](db[_0xdc2d('0x93')][_0xdc2d('0x32')]);_0x588d47[_0xdc2d('0x36')]=_['keys'](_0x3b4b3a[_0xdc2d('0x36')]);_0x588d47[_0xdc2d('0x37')]=_[_0xdc2d('0x39')](_0x588d47[_0xdc2d('0x38')],_0x588d47[_0xdc2d('0x36')]);_0x350d0e['attributes']=_[_0xdc2d('0x39')](_0x588d47['model'],qs[_0xdc2d('0x3a')](_0x3b4b3a[_0xdc2d('0x36')][_0xdc2d('0x3a')]));_0x350d0e[_0xdc2d('0x3b')]=_0x350d0e[_0xdc2d('0x3b')][_0xdc2d('0x3c')]?_0x350d0e[_0xdc2d('0x3b')]:_0x588d47[_0xdc2d('0x38')];if(!_0x3b4b3a[_0xdc2d('0x36')]['hasOwnProperty'](_0xdc2d('0x55'))){_0x350d0e[_0xdc2d('0x20')]=qs['limit'](_0x3b4b3a['query']['limit']);_0x350d0e['offset']=qs[_0xdc2d('0x1e')](_0x3b4b3a[_0xdc2d('0x36')][_0xdc2d('0x1e')]);}_0x350d0e['order']=qs[_0xdc2d('0x3e')](_0x3b4b3a['query']['sort']);_0x350d0e[_0xdc2d('0x3f')]=qs['filters'](_[_0xdc2d('0x40')](_0x3b4b3a[_0xdc2d('0x36')],_0x588d47[_0xdc2d('0x37')]));_0x350d0e[_0xdc2d('0x3f')]['MailAccountId']=_0x4a4da9['id'];if(_0x3b4b3a[_0xdc2d('0x36')][_0xdc2d('0x42')]){_0x350d0e[_0xdc2d('0x3f')]=_[_0xdc2d('0x43')](_0x350d0e[_0xdc2d('0x3f')],{'$or':_[_0xdc2d('0x34')](_0x350d0e[_0xdc2d('0x3b')],function(_0x4c4ed3){var _0x43695e={};_0x43695e[_0x4c4ed3]={'$like':'%'+_0x3b4b3a['query'][_0xdc2d('0x42')]+'%'};return _0x43695e;})});}if(_0x3b4b3a[_0xdc2d('0x36')][_0xdc2d('0x94')]){var _0xd2777d=_0x3b4b3a[_0xdc2d('0x36')][_0xdc2d('0x94')][_0xdc2d('0x95')](',');var _0x17ec4e={};_0x17ec4e[_0xd2777d[0x0]]={'$gte':moment(_0xd2777d[0x1])[_0xdc2d('0x96')](_0xdc2d('0x97'))};_0x350d0e[_0xdc2d('0x3f')]=_[_0xdc2d('0x43')](_0x350d0e['where'],_0x17ec4e);}_0x350d0e=_[_0xdc2d('0x43')]({},_0x350d0e,_0x3b4b3a[_0xdc2d('0x44')]);return db[_0xdc2d('0x93')][_0xdc2d('0x21')]({'where':_0x350d0e[_0xdc2d('0x3f')]})[_0xdc2d('0x11')](function(_0x440de4){_0x4108f9[_0xdc2d('0x21')]=_0x440de4;if(_0x3b4b3a[_0xdc2d('0x36')][_0xdc2d('0x45')]){_0x350d0e['include']=[{'all':!![]}];}return db[_0xdc2d('0x93')][_0xdc2d('0x47')](_0x350d0e);})[_0xdc2d('0x11')](function(_0x392fa0){if(_0x3b4b3a[_0xdc2d('0x36')][_0xdc2d('0x98')]===_0xdc2d('0x99')){for(var _0x22ff46=0x0;_0x22ff46<_0x392fa0[_0xdc2d('0x3c')];_0x22ff46++){_0x392fa0[_0x22ff46][_0xdc2d('0x4e')]=juice(_0x392fa0[_0x22ff46][_0xdc2d('0x4e')]);}}_0x4108f9[_0xdc2d('0x48')]=_0x392fa0;return _0x4108f9;});}})[_0xdc2d('0x11')](respondWithFilteredResult(_0x140151,_0x350d0e))[_0xdc2d('0x49')](handleError(_0x140151,null));};exports[_0xdc2d('0x2b')]=function(_0x3c606d,_0x45523e){var _0x2e01fa,_0x24279e={},_0x2e8206;if(_0x3c606d[_0xdc2d('0x4e')]['to']){_0x2e8206=_0x3c606d[_0xdc2d('0x4e')]['to'][_0xdc2d('0x95')](',')[0x0];}return db[_0xdc2d('0x31')][_0xdc2d('0x4d')]({'where':{'id':_0x3c606d['params']['id']},'include':[{'model':db[_0xdc2d('0x9a')],'as':_0xdc2d('0x9b'),'include':[{'model':db['CmContact'],'as':_0xdc2d('0x9c'),'where':{'email':_0x2e8206},'limit':0x1,'order':[[_0xdc2d('0x9d'),_0xdc2d('0x9e')]]}]},{'model':db['MailServerOut'],'as':_0xdc2d('0x4c'),'raw':!![]}]})[_0xdc2d('0x11')](handleEntityNotFound(_0x45523e,null))[_0xdc2d('0x11')](function(_0x2e163b){if(_0x2e163b){_0x2e01fa=_0x2e163b;if(_0x2e163b[_0xdc2d('0x4c')]){if(_[_0xdc2d('0x62')](_0x3c606d['body'][_0xdc2d('0x9f')])){_0x3c606d[_0xdc2d('0x4e')][_0xdc2d('0x9f')]=util[_0xdc2d('0x96')]('%s\x20<%s>',_0x2e163b[_0xdc2d('0x2a')],_0x2e163b[_0xdc2d('0x60')]||_0x2e163b[_0xdc2d('0x4c')][_0xdc2d('0x64')]);}if(_0x3c606d['body'][_0xdc2d('0xa0')]&&_0x3c606d[_0xdc2d('0x4e')][_0xdc2d('0xa0')][_0xdc2d('0x3c')]){for(var _0x46b7b3=0x0;_0x46b7b3<_0x3c606d[_0xdc2d('0x4e')][_0xdc2d('0xa0')]['length'];_0x46b7b3+=0x1){_0x3c606d[_0xdc2d('0x4e')]['attachments'][_0x46b7b3]={'filename':_0x3c606d[_0xdc2d('0x4e')][_0xdc2d('0xa0')][_0x46b7b3][_0xdc2d('0x2a')],'path':path[_0xdc2d('0xa1')](config['root'],_0xdc2d('0xa2'),_0x3c606d[_0xdc2d('0x4e')]['attachments'][_0x46b7b3][_0xdc2d('0xa3')])};}}var _0x59aec3={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x2e163b[_0xdc2d('0x4c')][_0xdc2d('0x68')])){if(_0x2e163b[_0xdc2d('0x4c')][_0xdc2d('0x6a')]){_0x59aec3[_0xdc2d('0xa4')]={'user':_0x2e163b['Smtp'][_0xdc2d('0x64')],'pass':_0x2e163b[_0xdc2d('0x4c')][_0xdc2d('0x67')]};}_0x59aec3[_0xdc2d('0x69')]=_0x2e163b[_0xdc2d('0x4c')]['host'];_0x59aec3['port']=_0x2e163b[_0xdc2d('0x4c')][_0xdc2d('0x6b')];_0x59aec3[_0xdc2d('0xa5')]=_0x2e163b['Smtp']['secure'];}else{_0x59aec3['service']=_0x2e163b['Smtp'][_0xdc2d('0x68')];_0x59aec3[_0xdc2d('0xa4')]={'user':_0x2e163b['Smtp']['user'],'pass':_0x2e163b[_0xdc2d('0x4c')]['pass']};}return respondWithRpcPromise(_0xdc2d('0xa6'),_0xdc2d('0xa7'),{'account':_0x59aec3,'message':_0x3c606d[_0xdc2d('0x4e')]});}else{throw new Error('List\x20not\x20found');}}})[_0xdc2d('0x11')](function(_0x54a55f){if(_0x54a55f){_0x24279e=_0x54a55f;if(_0x2e01fa[_0xdc2d('0x9b')]){if(_0x2e01fa[_0xdc2d('0x9b')][_0xdc2d('0x9c')][_0xdc2d('0x3c')]){return _0x2e01fa['List'][_0xdc2d('0x9c')][0x0];}else{return db[_0xdc2d('0x80')][_0xdc2d('0x5c')](_['defaults'](_0x3c606d['body'],{'firstName':_0x3c606d[_0xdc2d('0x4e')]['to'],'email':_0x3c606d[_0xdc2d('0x4e')]['to'],'phone':_0x3c606d[_0xdc2d('0x4e')]['to'],'ListId':_0x2e01fa[_0xdc2d('0x61')]}));}}else{throw new Error(_0xdc2d('0xa8'));}}})[_0xdc2d('0x11')](function(_0x1e1973){if(_0x1e1973){var _0x3247c9={'UserId':_0x3c606d[_0xdc2d('0x64')]['id'],'ContactId':_0x1e1973['id'],'MailAccountId':_0x2e01fa['id'],'inReplyTo':_0x24279e['messageId'],'to':_0x3c606d[_0xdc2d('0x4e')][_0xdc2d('0x9f')],'cc':_0x3c606d[_0xdc2d('0x4e')]['cc'],'subject':_0x3c606d[_0xdc2d('0x4e')][_0xdc2d('0xa9')],'attach':_0x3c606d[_0xdc2d('0x4e')][_0xdc2d('0xaa')],'firstMsgDirection':'out','lastMsgAt':moment()[_0xdc2d('0x96')](_0xdc2d('0x97')),'lastMsgDirection':_0xdc2d('0xab'),'Messages':[_[_0xdc2d('0x43')](_0x3c606d[_0xdc2d('0x4e')],{'messageId':_0x24279e['messageId'],'sentAt':moment()[_0xdc2d('0x96')](_0xdc2d('0x97')),'read':!![],'MailAccountId':_0x2e01fa['id'],'UserId':_0x3c606d[_0xdc2d('0x64')]['id'],'ContactId':_0x1e1973['id']})]};if(_0x3c606d[_0xdc2d('0x4e')][_0xdc2d('0xac')]){_0x3247c9=_[_0xdc2d('0x43')](_0x3247c9,_0x3c606d['body'][_0xdc2d('0xac')]);}return db[_0xdc2d('0x7f')][_0xdc2d('0x5c')](_0x3247c9,{'include':[{'model':db[_0xdc2d('0x93')],'as':'Messages'}]});}})[_0xdc2d('0x11')](respondWithResult(_0x45523e,null))[_0xdc2d('0x49')](handleError(_0x45523e,null));};exports[_0xdc2d('0xad')]=function(_0x365ae1,_0x391c58){return db[_0xdc2d('0x31')][_0xdc2d('0x4d')]({'where':{'id':_0x365ae1[_0xdc2d('0x4b')]['id']},'include':[{'model':db[_0xdc2d('0x2e')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xdc2d('0xae')],'as':_0xdc2d('0xae'),'raw':!![]}]}]})[_0xdc2d('0x11')](handleEntityNotFound(_0x391c58,null))[_0xdc2d('0x11')](function(_0x4dab31){if(!_0x4dab31[_0xdc2d('0x4c')])return;var _0x4d76df={'id':_0x4dab31['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4dab31[_0xdc2d('0x5f')]!=='custom'){_0x4d76df[_0xdc2d('0x68')]=_0x4dab31[_0xdc2d('0x5f')];}else{_0x4d76df[_0xdc2d('0x69')]=_0x4dab31[_0xdc2d('0x4c')][_0xdc2d('0x69')];_0x4d76df[_0xdc2d('0x6b')]=_0x4dab31['Smtp'][_0xdc2d('0x6b')];_0x4d76df[_0xdc2d('0xa5')]=_0x4dab31[_0xdc2d('0x4c')][_0xdc2d('0xa5')];}if(_0x4dab31['Smtp'][_0xdc2d('0x6a')]){if(_0x4dab31[_0xdc2d('0x4c')][_0xdc2d('0x4f')]){_0x4d76df[_0xdc2d('0xa4')]={'type':_0xdc2d('0xaf'),'user':_0x4dab31[_0xdc2d('0x4c')]['user'],'accessToken':_0x4dab31[_0xdc2d('0x4c')]['CloudProvider'][_0xdc2d('0xb0')]};}else{_0x4d76df[_0xdc2d('0xa4')]={'user':_0x4dab31[_0xdc2d('0x4c')]['user'],'pass':_0x4dab31[_0xdc2d('0x4c')][_0xdc2d('0x67')]};}}return respondWithRpcPromise(_0xdc2d('0xb1'),_0xdc2d('0xad'),{'account':_0x4d76df});})[_0xdc2d('0x11')](respondWithResult(_0x391c58,null))[_0xdc2d('0x49')](handleError(_0x391c58,null));};exports['destroy']=function(_0x23d48b,_0x57b737){return db['MailAccount'][_0xdc2d('0x4d')]({'where':{'id':_0x23d48b[_0xdc2d('0x4b')]['id']}})[_0xdc2d('0x11')](handleEntityNotFound(_0x57b737,null))[_0xdc2d('0x11')](function(_0x418a91){if(_0x418a91&&_0x418a91['service']){throw new db[(_0xdc2d('0xb2'))][(_0xdc2d('0xb3'))](_0xdc2d('0xb4'));}return _0x418a91;})[_0xdc2d('0x11')](removeEntity(_0x57b737,null))[_0xdc2d('0x49')](handleError(_0x57b737,null));};exports[_0xdc2d('0xb5')]=function(_0x14a888,_0x2a55e6){return db['MailAccount']['find']({'where':{'id':_0x14a888['params']['id']}})[_0xdc2d('0x11')](handleEntityNotFound(_0x2a55e6,null))[_0xdc2d('0x11')](function(_0x336241){if(_0x336241){return _0x336241['addAgents'](_0x14a888['body'][_0xdc2d('0x7c')],_[_0xdc2d('0x7d')](_0x14a888[_0xdc2d('0x4e')],[_0xdc2d('0x7c'),'id'])||{})[_0xdc2d('0xb6')](function(_0x5d3ce7){for(var _0x2f1dd6=0x0;_0x2f1dd6<_0x14a888[_0xdc2d('0x4e')]['ids']['length'];_0x2f1dd6+=0x1){socket['emit'](_0xdc2d('0xb7'),{'UserId':Number(_0x14a888[_0xdc2d('0x4e')][_0xdc2d('0x7c')][_0x2f1dd6]),'MailAccountId':Number(_0x14a888['params']['id'])});}return _0x5d3ce7;});}})['then'](respondWithResult(_0x2a55e6,null))[_0xdc2d('0x49')](handleError(_0x2a55e6,null));};exports[_0xdc2d('0xb8')]=function(_0x3c5316,_0x2e98c8){return db['MailAccount']['find']({'where':{'id':_0x3c5316[_0xdc2d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2e98c8,null))[_0xdc2d('0x11')](function(_0xb34d88){if(_0xb34d88){return _0xb34d88[_0xdc2d('0xb8')](_0x3c5316[_0xdc2d('0x36')]['ids'])[_0xdc2d('0x11')](function(){if(_[_0xdc2d('0xb9')](_0x3c5316[_0xdc2d('0x36')][_0xdc2d('0x7c')])){for(var _0x2fce7b=0x0;_0x2fce7b<_0x3c5316[_0xdc2d('0x36')]['ids'][_0xdc2d('0x3c')];_0x2fce7b+=0x1){socket[_0xdc2d('0xba')](_0xdc2d('0xbb'),{'UserId':Number(_0x3c5316[_0xdc2d('0x36')][_0xdc2d('0x7c')][_0x2fce7b]),'MailAccountId':Number(_0x3c5316[_0xdc2d('0x4b')]['id'])});}}else{socket[_0xdc2d('0xba')](_0xdc2d('0xbb'),{'UserId':Number(_0x3c5316['query']['ids']),'MailAccountId':Number(_0x3c5316[_0xdc2d('0x4b')]['id'])});}});}})[_0xdc2d('0x11')](respondWithStatusCode(_0x2e98c8,null))[_0xdc2d('0x49')](handleError(_0x2e98c8,null));};exports['getAgents']=function(_0x196f7f,_0x236c4a){var _0x49939f={};var _0x4a125f={};var _0x15636c;var _0x377b0f;return db['MailAccount'][_0xdc2d('0x75')]({'where':{'id':_0x196f7f[_0xdc2d('0x4b')]['id']}})[_0xdc2d('0x11')](handleEntityNotFound(_0x236c4a,null))[_0xdc2d('0x11')](function(_0x32fa06){if(_0x32fa06){_0x15636c=_0x32fa06;_0x4a125f[_0xdc2d('0x38')]=_[_0xdc2d('0x35')](db[_0xdc2d('0x82')]['rawAttributes']);_0x4a125f['query']=_[_0xdc2d('0x35')](_0x196f7f[_0xdc2d('0x36')]);_0x4a125f[_0xdc2d('0x37')]=_[_0xdc2d('0x39')](_0x4a125f[_0xdc2d('0x38')],_0x4a125f['query']);_0x49939f[_0xdc2d('0x3b')]=_['intersection'](_0x4a125f['model'],qs[_0xdc2d('0x3a')](_0x196f7f[_0xdc2d('0x36')][_0xdc2d('0x3a')]));_0x49939f['attributes']=_0x49939f[_0xdc2d('0x3b')][_0xdc2d('0x3c')]?_0x49939f[_0xdc2d('0x3b')]:_0x4a125f['model'];_0x49939f[_0xdc2d('0x3d')]=qs[_0xdc2d('0x3e')](_0x196f7f[_0xdc2d('0x36')][_0xdc2d('0x3e')]);_0x49939f[_0xdc2d('0x3f')]=qs[_0xdc2d('0x37')](_[_0xdc2d('0x40')](_0x196f7f[_0xdc2d('0x36')],_0x4a125f[_0xdc2d('0x37')]));if(_0x196f7f[_0xdc2d('0x36')][_0xdc2d('0x42')]){_0x49939f[_0xdc2d('0x3f')]=_[_0xdc2d('0x43')](_0x49939f[_0xdc2d('0x3f')],{'$or':_[_0xdc2d('0x34')](_0x49939f[_0xdc2d('0x3b')],function(_0x3af005){var _0x56be97={};_0x56be97[_0x3af005]={'$like':'%'+_0x196f7f[_0xdc2d('0x36')][_0xdc2d('0x42')]+'%'};return _0x56be97;})});}_0x49939f=_[_0xdc2d('0x43')]({},_0x49939f,_0x196f7f[_0xdc2d('0x44')]);return _0x15636c[_0xdc2d('0xbc')](_0x49939f);}})[_0xdc2d('0x11')](function(_0x270233){if(_0x270233){_0x377b0f=_0x270233['length'];if(!_0x196f7f[_0xdc2d('0x36')][_0xdc2d('0x5a')](_0xdc2d('0x55'))){_0x49939f[_0xdc2d('0x20')]=qs['limit'](_0x196f7f[_0xdc2d('0x36')][_0xdc2d('0x20')]);_0x49939f[_0xdc2d('0x1e')]=qs[_0xdc2d('0x1e')](_0x196f7f[_0xdc2d('0x36')]['offset']);}return _0x15636c[_0xdc2d('0xbc')](_0x49939f);}})['then'](function(_0x561edc){if(_0x561edc){return _0x561edc?{'count':_0x377b0f,'rows':_0x561edc}:null;}})[_0xdc2d('0x11')](respondWithResult(_0x236c4a,null))[_0xdc2d('0x49')](handleError(_0x236c4a,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 10a30df..5c940eb 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 _0x9aac=['hook','events','MailAccount','setMaxListeners','update','emit','hasOwnProperty'];(function(_0xd2a568,_0x4e8606){var _0x4cf0ba=function(_0x1f9dfc){while(--_0x1f9dfc){_0xd2a568['push'](_0xd2a568['shift']());}};_0x4cf0ba(++_0x4e8606);}(_0x9aac,0x135));var _0xc9aa=function(_0x5d6ecc,_0x3b77ee){_0x5d6ecc=_0x5d6ecc-0x0;var _0x1e0aab=_0x9aac[_0x5d6ecc];return _0x1e0aab;};'use strict';var EventEmitter=require(_0xc9aa('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xc9aa('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xc9aa('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc9aa('0x3'),'afterDestroy':'remove'};function emitEvent(_0x8ca086){return function(_0x5c8ce2,_0x28c49c,_0x267772){MailAccountEvents['emit'](_0x8ca086+':'+_0x5c8ce2['id'],_0x5c8ce2);MailAccountEvents[_0xc9aa('0x4')](_0x8ca086,_0x5c8ce2);_0x267772(null);};}for(var e in events){if(events[_0xc9aa('0x5')](e)){var event=events[e];MailAccount[_0xc9aa('0x6')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0x0760=['exports','events','MailAccount','remove','emit','hasOwnProperty','hook'];(function(_0x58394b,_0x43796d){var _0x531cbc=function(_0xabc32a){while(--_0xabc32a){_0x58394b['push'](_0x58394b['shift']());}};_0x531cbc(++_0x43796d);}(_0x0760,0xa9));var _0x0076=function(_0x22653b,_0x5969a7){_0x22653b=_0x22653b-0x0;var _0x48da0d=_0x0760[_0x22653b];return _0x48da0d;};'use strict';var EventEmitter=require(_0x0076('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x0076('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0076('0x2')};function emitEvent(_0xaf526){return function(_0x2ae1d3,_0x156fa4,_0x12533d){MailAccountEvents['emit'](_0xaf526+':'+_0x2ae1d3['id'],_0x2ae1d3);MailAccountEvents[_0x0076('0x3')](_0xaf526,_0x2ae1d3);_0x12533d(null);};}for(var e in events){if(events[_0x0076('0x4')](e)){var event=events[e];MailAccount[_0x0076('0x5')](e,emitEvent(event));}}module[_0x0076('0x6')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 0c64d9a..1f41f88 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 _0x7cda=['../../config/environment','define','MailAccount','mail_accounts','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x257017,_0x330627){var _0x38536d=function(_0xdf92e){while(--_0xdf92e){_0x257017['push'](_0x257017['shift']());}};_0x38536d(++_0x330627);}(_0x7cda,0x7c));var _0xa7cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7cda[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa7cd('0x0'));var util=require(_0xa7cd('0x1'));var logger=require(_0xa7cd('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa7cd('0x3'));var rp=require(_0xa7cd('0x4'));var fs=require('fs');var path=require(_0xa7cd('0x5'));var rimraf=require('rimraf');var config=require(_0xa7cd('0x6'));var attributes=require('./mailAccount.attributes');module['exports']=function(_0x29155d,_0x4cd399){return _0x29155d[_0xa7cd('0x7')](_0xa7cd('0x8'),attributes,{'tableName':_0xa7cd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b6d=['moment','bluebird','../../config/environment','./mailAccount.attributes','define','MailAccount','lodash','util','../../config/logger','api'];(function(_0x19e711,_0x3eda7e){var _0x4b4260=function(_0x4857cc){while(--_0x4857cc){_0x19e711['push'](_0x19e711['shift']());}};_0x4b4260(++_0x3eda7e);}(_0x3b6d,0x146));var _0xd3b6=function(_0x502d68,_0x26689f){_0x502d68=_0x502d68-0x0;var _0x3b5280=_0x3b6d[_0x502d68];return _0x3b5280;};'use strict';var _=require(_0xd3b6('0x0'));var util=require(_0xd3b6('0x1'));var logger=require(_0xd3b6('0x2'))(_0xd3b6('0x3'));var moment=require(_0xd3b6('0x4'));var BPromise=require(_0xd3b6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd3b6('0x6'));var attributes=require(_0xd3b6('0x7'));module['exports']=function(_0x528afa,_0x1c4770){return _0x528afa[_0xd3b6('0x8')](_0xd3b6('0x9'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 9cb0e76..e06b583 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 _0x041e=['create','List\x20not\x20found','contact','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','format','interaction','created','attachments','originTo','bcc','ChatWebsiteId','originChannel','ChatOfflineMessageId','Attachment','Attachments','UserId','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','code','error','message','catch','GetMailAccount','findAll','options','raw','attributes','limit','include','model','map','stringify','ShowMailAccount','MailAccount','where','NotifyMailAccount','body','mail','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','DESC','Smtp','get','omit','Applications','applications','list','orderBy','priority','asc','autoclose','push','length','close','*,*,*,*','Contacts'];(function(_0xf8a82b,_0x35ae8d){var _0x2ca34d=function(_0x21e754){while(--_0x21e754){_0xf8a82b['push'](_0xf8a82b['shift']());}};_0x2ca34d(++_0x35ae8d);}(_0x041e,0xfb));var _0xe041=function(_0x1341b0,_0x4ca920){_0x1341b0=_0x1341b0-0x0;var _0x2bcfc3=_0x041e[_0x1341b0];return _0x2bcfc3;};'use strict';var _=require('lodash');var util=require(_0xe041('0x0'));var moment=require(_0xe041('0x1'));var BPromise=require('bluebird');var rs=require(_0xe041('0x2'));var fs=require('fs');var Redis=require(_0xe041('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe041('0x4'));var logger=require(_0xe041('0x5'))(_0xe041('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe041('0x7')][_0xe041('0x8')]({'port':0x232c});config[_0xe041('0x9')]=_[_0xe041('0xa')](config['redis'],{'host':_0xe041('0xb'),'port':0x18eb});var socket=require(_0xe041('0xc'))(new Redis(config[_0xe041('0x9')]));require(_0xe041('0xd'))[_0xe041('0xe')](socket);function respondWithRpcPromise(_0x2467cd,_0x5cc12b,_0x1b6e0f){return new BPromise(function(_0x2be40e,_0xe32a06){return client[_0xe041('0xf')](_0x2467cd,_0x1b6e0f)[_0xe041('0x10')](function(_0x22e245){logger[_0xe041('0x11')](_0xe041('0x12'),_0x5cc12b,_0xe041('0x13'));logger[_0xe041('0x14')](_0xe041('0x15'),_0x5cc12b,_0xe041('0x13'),JSON['stringify'](_0x22e245));if(_0x22e245['error']){if(_0x22e245['error'][_0xe041('0x16')]===0x1f4){logger[_0xe041('0x17')]('MailAccount,\x20%s,\x20%s',_0x5cc12b,_0x22e245[_0xe041('0x17')][_0xe041('0x18')]);return _0xe32a06(_0x22e245[_0xe041('0x17')]['message']);}logger['error'](_0xe041('0x12'),_0x5cc12b,_0x22e245[_0xe041('0x17')][_0xe041('0x18')]);return _0x2be40e(_0x22e245[_0xe041('0x17')][_0xe041('0x18')]);}else{logger['info'](_0xe041('0x12'),_0x5cc12b,'request\x20sent');_0x2be40e(_0x22e245['result'][_0xe041('0x18')]);}})[_0xe041('0x19')](function(_0x40c62d){logger[_0xe041('0x17')]('MailAccount,\x20%s,\x20%s',_0x5cc12b,_0x40c62d);_0xe32a06(_0x40c62d);});});}exports[_0xe041('0x1a')]=function(_0x272f48){var _0x55bdfe=this;return new Promise(function(_0x5c9bbc,_0x367c7a){return db['MailAccount'][_0xe041('0x1b')]({'raw':_0x272f48['options']?_0x272f48[_0xe041('0x1c')][_0xe041('0x1d')]===undefined?!![]:![]:!![],'where':_0x272f48[_0xe041('0x1c')]?_0x272f48[_0xe041('0x1c')]['where']||null:null,'attributes':_0x272f48[_0xe041('0x1c')]?_0x272f48[_0xe041('0x1c')][_0xe041('0x1e')]||null:null,'limit':_0x272f48[_0xe041('0x1c')]?_0x272f48[_0xe041('0x1c')][_0xe041('0x1f')]||null:null,'include':_0x272f48[_0xe041('0x1c')]?_0x272f48[_0xe041('0x1c')][_0xe041('0x20')]?_['map'](_0x272f48[_0xe041('0x1c')]['include'],function(_0x5996a7){return{'model':db[_0x5996a7[_0xe041('0x21')]],'as':_0x5996a7['as'],'attributes':_0x5996a7['attributes'],'include':_0x5996a7['include']?_['map'](_0x5996a7[_0xe041('0x20')],function(_0x388d01){return{'model':db[_0x388d01['model']],'as':_0x388d01['as'],'attributes':_0x388d01[_0xe041('0x1e')],'include':_0x388d01['include']?_[_0xe041('0x22')](_0x388d01[_0xe041('0x20')],function(_0x14c34c){return{'model':db[_0x14c34c['model']],'as':_0x14c34c['as'],'attributes':_0x14c34c['attributes']};}):[]};}):[]};}):[]:[]})[_0xe041('0x10')](function(_0x2d27f3){logger[_0xe041('0x11')](_0xe041('0x1a'),_0x272f48);logger[_0xe041('0x14')](_0xe041('0x1a'),_0x272f48,JSON[_0xe041('0x23')](_0x2d27f3));_0x5c9bbc(_0x2d27f3);})[_0xe041('0x19')](function(_0x28d963){logger[_0xe041('0x17')](_0xe041('0x1a'),_0x28d963[_0xe041('0x18')],_0x272f48);_0x367c7a(_0x55bdfe[_0xe041('0x17')](0x1f4,_0x28d963['message']));});});};exports[_0xe041('0x24')]=function(_0x306c46){var _0xd5edf3=this;return new Promise(function(_0x4a4901,_0xb0bb09){return db[_0xe041('0x25')]['find']({'raw':_0x306c46[_0xe041('0x1c')]?_0x306c46['options']['raw']===undefined?!![]:![]:!![],'where':_0x306c46[_0xe041('0x1c')]?_0x306c46[_0xe041('0x1c')][_0xe041('0x26')]||null:null,'attributes':_0x306c46[_0xe041('0x1c')]?_0x306c46['options'][_0xe041('0x1e')]||null:null,'include':_0x306c46['options']?_0x306c46[_0xe041('0x1c')]['include']?_[_0xe041('0x22')](_0x306c46[_0xe041('0x1c')][_0xe041('0x20')],function(_0x50ff91){return{'model':db[_0x50ff91[_0xe041('0x21')]],'as':_0x50ff91['as'],'attributes':_0x50ff91['attributes'],'include':_0x50ff91[_0xe041('0x20')]?_['map'](_0x50ff91['include'],function(_0x332d51){return{'model':db[_0x332d51[_0xe041('0x21')]],'as':_0x332d51['as'],'attributes':_0x332d51[_0xe041('0x1e')],'include':_0x332d51[_0xe041('0x20')]?_['map'](_0x332d51[_0xe041('0x20')],function(_0xa3bb81){return{'model':db[_0xa3bb81['model']],'as':_0xa3bb81['as'],'attributes':_0xa3bb81[_0xe041('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe041('0x10')](function(_0x3ac88a){logger[_0xe041('0x11')](_0xe041('0x24'),_0x306c46);logger[_0xe041('0x14')]('ShowMailAccount',_0x306c46,JSON[_0xe041('0x23')](_0x3ac88a));_0x4a4901(_0x3ac88a);})[_0xe041('0x19')](function(_0x1d605a){logger[_0xe041('0x17')](_0xe041('0x24'),_0x1d605a[_0xe041('0x18')],_0x306c46);_0xb0bb09(_0xd5edf3[_0xe041('0x17')](0x1f4,_0x1d605a[_0xe041('0x18')]));});});};exports[_0xe041('0x27')]=function(_0x318897){var _0x45cffb=this;return new Promise(function(_0x3e99ea,_0x42a356){var _0x5e5743={'body':_0x318897[_0xe041('0x28')],'channel':_0xe041('0x29')};var _0x54c359=_['difference'](_[_0xe041('0x2a')](db[_0xe041('0x2b')][_0xe041('0x2c')]),[_0xe041('0x2d'),_0xe041('0x2e'),_0xe041('0x2f'),_0xe041('0x30')]);var _0x2eb863=![];if(_0x318897[_0xe041('0x28')]['id']){delete _0x318897[_0xe041('0x28')]['id'];}if(_[_0xe041('0x31')](_0x318897['body'][_0xe041('0x32')])){return _0x42a356(_0x45cffb[_0xe041('0x17')](0x1f4,_0xe041('0x33')));}if(_[_0xe041('0x31')](_0x318897[_0xe041('0x28')][_0xe041('0x28')])||_0x318897[_0xe041('0x28')][_0xe041('0x28')]===''){return _0x42a356(_0x45cffb[_0xe041('0x17')](0x1f4,_0xe041('0x34')));}if(_[_0xe041('0x31')](_0x318897['body']['mapKey'])){return _0x42a356(_0x45cffb[_0xe041('0x17')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x54c359));}if(!_[_0xe041('0x35')](_0x54c359,_0x318897[_0xe041('0x28')][_0xe041('0x36')])){return _0x42a356(_0x45cffb[_0xe041('0x17')](0x1f4,_0xe041('0x37')+_0x54c359));}var _0x431234={};_0x431234[_0x318897['body'][_0xe041('0x36')]]=_0x318897[_0xe041('0x28')][_0xe041('0x32')];return db[_0xe041('0x25')][_0xe041('0x38')]({'where':{'id':_0x318897[_0xe041('0x39')]['id']},'include':[{'model':db[_0xe041('0x3a')],'as':_0xe041('0x3b'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x431234,'limit':0x1,'order':[[_0xe041('0x2e'),_0xe041('0x3c')]]}]},{'model':db['MailApplication'],'as':'Applications'},{'model':db['MailServerOut'],'as':_0xe041('0x3d')}]})['then'](function(_0x316180){if(_0x316180&&_0x316180[_0xe041('0x3b')]){var _0x4cfff3=_0x316180[_0xe041('0x3e')]({'plain':!![]});_0x5e5743['account']=_[_0xe041('0x3f')](_0x4cfff3,[_0xe041('0x40'),_0xe041('0x3b')]);_0x5e5743[_0xe041('0x41')]=_0x4cfff3[_0xe041('0x40')];_0x5e5743[_0xe041('0x42')]=_0x4cfff3[_0xe041('0x3b')];_0x5e5743[_0xe041('0x41')]=_[_0xe041('0x43')](_0x5e5743[_0xe041('0x41')],[_0xe041('0x44')],[_0xe041('0x45')]);if(_0x5e5743[_0xe041('0x39')]&&_0x5e5743[_0xe041('0x39')][_0xe041('0x46')]){_0x5e5743['applications'][_0xe041('0x47')]({'id':0x0,'priority':_0x5e5743[_0xe041('0x41')][_0xe041('0x48')]+0x1,'app':_0xe041('0x49'),'appdata':_0xe041('0x46'),'interval':_0xe041('0x4a')});}if(_0x5e5743[_0xe041('0x39')][_0xe041('0x40')]){delete _0x5e5743['account'][_0xe041('0x40')];}if(_0x5e5743[_0xe041('0x39')][_0xe041('0x3b')]){delete _0x5e5743[_0xe041('0x39')][_0xe041('0x3b')];}if(_0x4cfff3[_0xe041('0x3b')][_0xe041('0x4b')][_0xe041('0x48')]){return _0x4cfff3['List'][_0xe041('0x4b')][0x0];}var _0x55435e=_[_0xe041('0xa')](_0x318897['body'],{'firstName':_0x318897[_0xe041('0x28')][_0xe041('0x32')],'ListId':_0x4cfff3['ListId']});_0x55435e[_0x318897[_0xe041('0x28')][_0xe041('0x36')]]=_0x318897['body'][_0xe041('0x32')];return db[_0xe041('0x2b')][_0xe041('0x4c')](_0x55435e);}else{throw new Error(_0xe041('0x4d'));}})[_0xe041('0x10')](function(_0x20addb){_0x5e5743[_0xe041('0x4e')]=_0x20addb;if(_0x20addb){if(!_0x318897['body'][_0xe041('0x18')][_0xe041('0x4f')]){_0x318897['body']['message'][_0xe041('0x4f')]=rs[_0xe041('0x50')]()+'\x20'+_0x318897[_0xe041('0x28')][_0xe041('0x18')][_0xe041('0x32')];}var _0x213f85={'ContactId':_0x20addb['id'],'MailAccountId':_0x318897[_0xe041('0x39')]['id'],'inReplyTo':_0x318897[_0xe041('0x28')][_0xe041('0x18')][_0xe041('0x4f')],'to':_0x318897[_0xe041('0x28')][_0xe041('0x18')]['from'],'cc':_0x318897[_0xe041('0x28')][_0xe041('0x18')]['cc'],'subject':_0x318897['body']['message'][_0xe041('0x51')],'attach':_0x318897[_0xe041('0x28')][_0xe041('0x18')][_0xe041('0x52')],'lastMsgAt':moment()['format'](_0xe041('0x53')),'lastMsgDirection':'in'};return db[_0xe041('0x54')][_0xe041('0x38')]({'where':{'closed':![],'MailAccountId':_0x318897['account']['id']},'include':[{'model':db[_0xe041('0x55')],'as':_0xe041('0x56'),'attributes':[_0xe041('0x4f')],'where':{'messageId':_0x318897[_0xe041('0x28')][_0xe041('0x18')][_0xe041('0x57')]}}]})[_0xe041('0x10')](function(_0x3f4d51){if(_0x3f4d51){return[_0x3f4d51,![]];}return db['MailInteraction'][_0xe041('0x4c')](_0x213f85)[_0xe041('0x10')](function(_0x390658){return[_0x390658,!![]];});});}else{throw new Error(_0xe041('0x58'));}})[_0xe041('0x59')](function(_0xd6fc85,_0x2ec85e){if(_0xd6fc85){_0x2eb863=_0x2ec85e;if(!_0x2ec85e){return _0xd6fc85[_0xe041('0x5a')]({'inReplyTo':_0x318897[_0xe041('0x28')][_0xe041('0x18')][_0xe041('0x4f')],'to':_0x318897['body']['message'][_0xe041('0x32')],'cc':_0x318897['body']['message']['cc'],'subject':_0x318897[_0xe041('0x28')][_0xe041('0x18')][_0xe041('0x51')],'attach':_0xd6fc85[_0xe041('0x52')]?_0xd6fc85[_0xe041('0x52')]:_0x318897['body']['message']['attach'],'substatus':null,'substatusAt':moment()[_0xe041('0x5b')](_0xe041('0x53')),'lastMsgAt':moment()[_0xe041('0x5b')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0xd6fc85;}}})[_0xe041('0x10')](function(_0x42134b){_0x5e5743[_0xe041('0x5c')]=_0x42134b[_0xe041('0x3e')]({'plain':!![]});_0x5e5743[_0xe041('0x5c')][_0xe041('0x5d')]=_0x2eb863;return db[_0xe041('0x55')][_0xe041('0x4c')]({'body':_0x318897['body'][_0xe041('0x28')],'MailAccountId':_0x318897[_0xe041('0x39')]['id'],'MailInteractionId':_0x42134b['id'],'direction':'in','ContactId':_0x5e5743['contact']['id'],'messageId':_0x318897['body'][_0xe041('0x18')]['messageId'],'from':_0x318897[_0xe041('0x28')][_0xe041('0x18')][_0xe041('0x32')],'to':_0x318897[_0xe041('0x28')][_0xe041('0x18')]['to'],'cc':_0x318897[_0xe041('0x28')][_0xe041('0x18')]['cc'],'subject':_0x318897['body'][_0xe041('0x18')]['subject'],'attach':_0x318897[_0xe041('0x28')]['message'][_0xe041('0x52')],'Attachments':_0x318897[_0xe041('0x28')][_0xe041('0x18')][_0xe041('0x5e')],'originTo':_0x318897['body']['message'][_0xe041('0x5f')],'originCc':_0x318897['body'][_0xe041('0x18')]['originCc'],'bcc':_0x318897['body'][_0xe041('0x18')][_0xe041('0x60')],'ChatWebsiteId':_0x318897[_0xe041('0x28')]['message'][_0xe041('0x61')]||null,'originChannel':_0x318897[_0xe041('0x28')][_0xe041('0x18')][_0xe041('0x62')]||'Email','ChatOfflineMessageId':_0x318897[_0xe041('0x28')][_0xe041('0x18')][_0xe041('0x63')]||null},{'include':[{'model':db[_0xe041('0x64')],'as':_0xe041('0x65')}]});})['then'](function(_0x36066e){_0x5e5743[_0xe041('0x18')]=_0x36066e;if(_0x5e5743['interaction'][_0xe041('0x66')]){return db['User'][_0xe041('0x38')]({'attributes':['id','name'],'where':{'id':_0x5e5743[_0xe041('0x5c')][_0xe041('0x66')]}})[_0xe041('0x10')](function(_0x131a59){if(_0x131a59){_0x5e5743[_0xe041('0x41')][_0xe041('0x67')]({'id':0x0,'priority':0x0,'app':_0xe041('0x68'),'appdata':_0x131a59[_0xe041('0x69')]+','+(_0x5e5743[_0xe041('0x39')][_0xe041('0x6a')]||0xa),'interval':_0xe041('0x4a')});}return respondWithRpcPromise(_0xe041('0x6b'),_0xe041('0x6c'),_0x5e5743);});}return respondWithRpcPromise(_0xe041('0x6b'),_0xe041('0x6c'),_0x5e5743);})[_0xe041('0x10')](function(_0x3a4a77){_0x3e99ea(_0x3a4a77);})['catch'](function(_0x36161e){_0x42a356(_0x45cffb[_0xe041('0x17')](0x1f4,_0x36161e[_0xe041('0x18')]));});});}; \ No newline at end of file +var _0xa811=['list','orderBy','length','autoclose','*,*,*,*','ListId','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','MailInteraction','Messages','inReplyTo','Contact\x20not\x20found','update','YYYY-MM-DD\x20HH:mm:ss','interaction','created','MailMessage','attachments','originTo','originCc','bcc','ChatWebsiteId','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','request','then','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','MailAccount,\x20%s,\x20%s','message','info','result','catch','MailAccount','findAll','options','raw','where','include','map','model','attributes','GetMailAccount','ShowMailAccount','find','NotifyMailAccount','body','mail','difference','CmContact','rawAttributes','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','from','CmList','List','Contacts','updatedAt','MailApplication','Applications','MailServerOut','Smtp','get','account','omit','applications'];(function(_0x3a7303,_0x1d50c4){var _0x290027=function(_0x1ef203){while(--_0x1ef203){_0x3a7303['push'](_0x3a7303['shift']());}};_0x290027(++_0x1d50c4);}(_0xa811,0x1d0));var _0x1a81=function(_0x5aaaf8,_0x15aee4){_0x5aaaf8=_0x5aaaf8-0x0;var _0xf31eec=_0xa811[_0x5aaaf8];return _0xf31eec;};'use strict';var _=require(_0x1a81('0x0'));var util=require('util');var moment=require(_0x1a81('0x1'));var BPromise=require(_0x1a81('0x2'));var rs=require(_0x1a81('0x3'));var fs=require('fs');var Redis=require(_0x1a81('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1a81('0x5'))(_0x1a81('0x6'));var config=require('../../config/environment');var jayson=require(_0x1a81('0x7'));var client=jayson[_0x1a81('0x8')][_0x1a81('0x9')]({'port':0x232c});config['redis']=_[_0x1a81('0xa')](config[_0x1a81('0xb')],{'host':_0x1a81('0xc'),'port':0x18eb});var socket=require(_0x1a81('0xd'))(new Redis(config[_0x1a81('0xb')]));require(_0x1a81('0xe'))['register'](socket);function respondWithRpcPromise(_0x2132bd,_0x54057b,_0x46edc5){return new BPromise(function(_0x3c5b27,_0x24d2ab){return client[_0x1a81('0xf')](_0x2132bd,_0x46edc5)[_0x1a81('0x10')](function(_0xd379b8){logger['info']('MailAccount,\x20%s,\x20%s',_0x54057b,_0x1a81('0x11'));logger[_0x1a81('0x12')](_0x1a81('0x13'),_0x54057b,_0x1a81('0x11'),JSON[_0x1a81('0x14')](_0xd379b8));if(_0xd379b8[_0x1a81('0x15')]){if(_0xd379b8['error']['code']===0x1f4){logger[_0x1a81('0x15')](_0x1a81('0x16'),_0x54057b,_0xd379b8['error'][_0x1a81('0x17')]);return _0x24d2ab(_0xd379b8[_0x1a81('0x15')]['message']);}logger[_0x1a81('0x15')]('MailAccount,\x20%s,\x20%s',_0x54057b,_0xd379b8['error'][_0x1a81('0x17')]);return _0x3c5b27(_0xd379b8['error']['message']);}else{logger[_0x1a81('0x18')](_0x1a81('0x16'),_0x54057b,_0x1a81('0x11'));_0x3c5b27(_0xd379b8[_0x1a81('0x19')][_0x1a81('0x17')]);}})[_0x1a81('0x1a')](function(_0x42f408){logger[_0x1a81('0x15')](_0x1a81('0x16'),_0x54057b,_0x42f408);_0x24d2ab(_0x42f408);});});}exports['GetMailAccount']=function(_0x3609ed){var _0x336d3d=this;return new Promise(function(_0x46795f,_0x3cc08b){return db[_0x1a81('0x1b')][_0x1a81('0x1c')]({'raw':_0x3609ed[_0x1a81('0x1d')]?_0x3609ed[_0x1a81('0x1d')][_0x1a81('0x1e')]===undefined?!![]:![]:!![],'where':_0x3609ed[_0x1a81('0x1d')]?_0x3609ed[_0x1a81('0x1d')][_0x1a81('0x1f')]||null:null,'attributes':_0x3609ed[_0x1a81('0x1d')]?_0x3609ed['options']['attributes']||null:null,'limit':_0x3609ed['options']?_0x3609ed['options']['limit']||null:null,'include':_0x3609ed[_0x1a81('0x1d')]?_0x3609ed['options'][_0x1a81('0x20')]?_[_0x1a81('0x21')](_0x3609ed[_0x1a81('0x1d')][_0x1a81('0x20')],function(_0x591319){return{'model':db[_0x591319[_0x1a81('0x22')]],'as':_0x591319['as'],'attributes':_0x591319[_0x1a81('0x23')],'include':_0x591319[_0x1a81('0x20')]?_[_0x1a81('0x21')](_0x591319[_0x1a81('0x20')],function(_0xb79ef1){return{'model':db[_0xb79ef1[_0x1a81('0x22')]],'as':_0xb79ef1['as'],'attributes':_0xb79ef1[_0x1a81('0x23')],'include':_0xb79ef1[_0x1a81('0x20')]?_[_0x1a81('0x21')](_0xb79ef1['include'],function(_0x557178){return{'model':db[_0x557178['model']],'as':_0x557178['as'],'attributes':_0x557178['attributes']};}):[]};}):[]};}):[]:[]})[_0x1a81('0x10')](function(_0x1bcf44){logger['info'](_0x1a81('0x24'),_0x3609ed);logger[_0x1a81('0x12')](_0x1a81('0x24'),_0x3609ed,JSON[_0x1a81('0x14')](_0x1bcf44));_0x46795f(_0x1bcf44);})['catch'](function(_0x55b310){logger[_0x1a81('0x15')](_0x1a81('0x24'),_0x55b310[_0x1a81('0x17')],_0x3609ed);_0x3cc08b(_0x336d3d['error'](0x1f4,_0x55b310[_0x1a81('0x17')]));});});};exports[_0x1a81('0x25')]=function(_0x1c9c54){var _0x23210c=this;return new Promise(function(_0x4fe4ff,_0x2dc58d){return db[_0x1a81('0x1b')][_0x1a81('0x26')]({'raw':_0x1c9c54[_0x1a81('0x1d')]?_0x1c9c54[_0x1a81('0x1d')][_0x1a81('0x1e')]===undefined?!![]:![]:!![],'where':_0x1c9c54['options']?_0x1c9c54[_0x1a81('0x1d')]['where']||null:null,'attributes':_0x1c9c54['options']?_0x1c9c54[_0x1a81('0x1d')][_0x1a81('0x23')]||null:null,'include':_0x1c9c54[_0x1a81('0x1d')]?_0x1c9c54['options'][_0x1a81('0x20')]?_['map'](_0x1c9c54['options'][_0x1a81('0x20')],function(_0x3006e6){return{'model':db[_0x3006e6[_0x1a81('0x22')]],'as':_0x3006e6['as'],'attributes':_0x3006e6[_0x1a81('0x23')],'include':_0x3006e6['include']?_['map'](_0x3006e6[_0x1a81('0x20')],function(_0x4916ae){return{'model':db[_0x4916ae[_0x1a81('0x22')]],'as':_0x4916ae['as'],'attributes':_0x4916ae[_0x1a81('0x23')],'include':_0x4916ae[_0x1a81('0x20')]?_[_0x1a81('0x21')](_0x4916ae[_0x1a81('0x20')],function(_0x33c5ff){return{'model':db[_0x33c5ff['model']],'as':_0x33c5ff['as'],'attributes':_0x33c5ff[_0x1a81('0x23')]};}):[]};}):[]};}):[]:[]})[_0x1a81('0x10')](function(_0x51c9fa){logger[_0x1a81('0x18')](_0x1a81('0x25'),_0x1c9c54);logger[_0x1a81('0x12')](_0x1a81('0x25'),_0x1c9c54,JSON[_0x1a81('0x14')](_0x51c9fa));_0x4fe4ff(_0x51c9fa);})[_0x1a81('0x1a')](function(_0x27f31e){logger['error'](_0x1a81('0x25'),_0x27f31e['message'],_0x1c9c54);_0x2dc58d(_0x23210c[_0x1a81('0x15')](0x1f4,_0x27f31e[_0x1a81('0x17')]));});});};exports[_0x1a81('0x27')]=function(_0x4c64a4){var _0x1dcd6b=this;return new Promise(function(_0x5a316f,_0x379fef){var _0x3e042e={'body':_0x4c64a4[_0x1a81('0x28')],'channel':_0x1a81('0x29')};var _0x226600=_[_0x1a81('0x2a')](_['keys'](db[_0x1a81('0x2b')][_0x1a81('0x2c')]),['createdAt','updatedAt',_0x1a81('0x2d'),'ListId']);var _0x106e28=![];if(_0x4c64a4['body']['id']){delete _0x4c64a4[_0x1a81('0x28')]['id'];}if(_[_0x1a81('0x2e')](_0x4c64a4[_0x1a81('0x28')]['from'])){return _0x379fef(_0x1dcd6b[_0x1a81('0x15')](0x1f4,_0x1a81('0x2f')));}if(_['isNil'](_0x4c64a4[_0x1a81('0x28')]['body'])||_0x4c64a4['body'][_0x1a81('0x28')]===''){return _0x379fef(_0x1dcd6b[_0x1a81('0x15')](0x1f4,_0x1a81('0x30')));}if(_[_0x1a81('0x2e')](_0x4c64a4[_0x1a81('0x28')][_0x1a81('0x31')])){return _0x379fef(_0x1dcd6b[_0x1a81('0x15')](0x1f4,_0x1a81('0x32')+_0x226600));}if(!_[_0x1a81('0x33')](_0x226600,_0x4c64a4[_0x1a81('0x28')][_0x1a81('0x31')])){return _0x379fef(_0x1dcd6b[_0x1a81('0x15')](0x1f4,_0x1a81('0x34')+_0x226600));}var _0x4b28f2={};_0x4b28f2[_0x4c64a4[_0x1a81('0x28')][_0x1a81('0x31')]]=_0x4c64a4[_0x1a81('0x28')][_0x1a81('0x35')];return db[_0x1a81('0x1b')][_0x1a81('0x26')]({'where':{'id':_0x4c64a4['account']['id']},'include':[{'model':db[_0x1a81('0x36')],'as':_0x1a81('0x37'),'include':[{'model':db[_0x1a81('0x2b')],'as':_0x1a81('0x38'),'where':_0x4b28f2,'limit':0x1,'order':[[_0x1a81('0x39'),'DESC']]}]},{'model':db[_0x1a81('0x3a')],'as':_0x1a81('0x3b')},{'model':db[_0x1a81('0x3c')],'as':_0x1a81('0x3d')}]})['then'](function(_0x5314ab){if(_0x5314ab&&_0x5314ab[_0x1a81('0x37')]){var _0x2e3f89=_0x5314ab[_0x1a81('0x3e')]({'plain':!![]});_0x3e042e[_0x1a81('0x3f')]=_[_0x1a81('0x40')](_0x2e3f89,['Applications','List']);_0x3e042e[_0x1a81('0x41')]=_0x2e3f89[_0x1a81('0x3b')];_0x3e042e[_0x1a81('0x42')]=_0x2e3f89['List'];_0x3e042e[_0x1a81('0x41')]=_[_0x1a81('0x43')](_0x3e042e['applications'],['priority'],['asc']);if(_0x3e042e[_0x1a81('0x3f')]&&_0x3e042e[_0x1a81('0x3f')]['autoclose']){_0x3e042e[_0x1a81('0x41')]['push']({'id':0x0,'priority':_0x3e042e[_0x1a81('0x41')][_0x1a81('0x44')]+0x1,'app':'close','appdata':_0x1a81('0x45'),'interval':_0x1a81('0x46')});}if(_0x3e042e[_0x1a81('0x3f')]['Applications']){delete _0x3e042e[_0x1a81('0x3f')][_0x1a81('0x3b')];}if(_0x3e042e[_0x1a81('0x3f')]['List']){delete _0x3e042e[_0x1a81('0x3f')][_0x1a81('0x37')];}if(_0x2e3f89['List'][_0x1a81('0x38')][_0x1a81('0x44')]){return _0x2e3f89[_0x1a81('0x37')][_0x1a81('0x38')][0x0];}var _0x4f85b7=_[_0x1a81('0xa')](_0x4c64a4[_0x1a81('0x28')],{'firstName':_0x4c64a4[_0x1a81('0x28')][_0x1a81('0x35')],'ListId':_0x2e3f89[_0x1a81('0x47')]});_0x4f85b7[_0x4c64a4[_0x1a81('0x28')][_0x1a81('0x31')]]=_0x4c64a4[_0x1a81('0x28')][_0x1a81('0x35')];return db[_0x1a81('0x2b')][_0x1a81('0x48')](_0x4f85b7);}else{throw new Error(_0x1a81('0x49'));}})[_0x1a81('0x10')](function(_0x18316a){_0x3e042e[_0x1a81('0x4a')]=_0x18316a;if(_0x18316a){if(!_0x4c64a4[_0x1a81('0x28')]['message'][_0x1a81('0x4b')]){_0x4c64a4[_0x1a81('0x28')][_0x1a81('0x17')]['messageId']=rs[_0x1a81('0x4c')]()+'\x20'+_0x4c64a4['body'][_0x1a81('0x17')][_0x1a81('0x35')];}var _0x47b80d={'ContactId':_0x18316a['id'],'MailAccountId':_0x4c64a4[_0x1a81('0x3f')]['id'],'inReplyTo':_0x4c64a4[_0x1a81('0x28')]['message'][_0x1a81('0x4b')],'to':_0x4c64a4['body'][_0x1a81('0x17')][_0x1a81('0x35')],'cc':_0x4c64a4[_0x1a81('0x28')][_0x1a81('0x17')]['cc'],'subject':_0x4c64a4[_0x1a81('0x28')][_0x1a81('0x17')][_0x1a81('0x4d')],'attach':_0x4c64a4[_0x1a81('0x28')][_0x1a81('0x17')][_0x1a81('0x4e')],'lastMsgAt':moment()[_0x1a81('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x1a81('0x50')][_0x1a81('0x26')]({'where':{'closed':![],'MailAccountId':_0x4c64a4['account']['id']},'include':[{'model':db['MailMessage'],'as':_0x1a81('0x51'),'attributes':[_0x1a81('0x4b')],'where':{'messageId':_0x4c64a4[_0x1a81('0x28')][_0x1a81('0x17')][_0x1a81('0x52')]}}]})['then'](function(_0x3314ea){if(_0x3314ea){return[_0x3314ea,![]];}return db[_0x1a81('0x50')][_0x1a81('0x48')](_0x47b80d)[_0x1a81('0x10')](function(_0x1bbbdf){return[_0x1bbbdf,!![]];});});}else{throw new Error(_0x1a81('0x53'));}})['spread'](function(_0x4cf245,_0x6c0c48){if(_0x4cf245){_0x106e28=_0x6c0c48;if(!_0x6c0c48){return _0x4cf245[_0x1a81('0x54')]({'inReplyTo':_0x4c64a4[_0x1a81('0x28')][_0x1a81('0x17')]['messageId'],'to':_0x4c64a4['body']['message'][_0x1a81('0x35')],'cc':_0x4c64a4[_0x1a81('0x28')][_0x1a81('0x17')]['cc'],'subject':_0x4c64a4[_0x1a81('0x28')][_0x1a81('0x17')]['subject'],'attach':_0x4cf245[_0x1a81('0x4e')]?_0x4cf245[_0x1a81('0x4e')]:_0x4c64a4[_0x1a81('0x28')][_0x1a81('0x17')][_0x1a81('0x4e')],'substatus':null,'substatusAt':moment()[_0x1a81('0x4f')](_0x1a81('0x55')),'lastMsgAt':moment()[_0x1a81('0x4f')](_0x1a81('0x55')),'lastMsgDirection':'in'});}else{return _0x4cf245;}}})[_0x1a81('0x10')](function(_0x466e0f){_0x3e042e[_0x1a81('0x56')]=_0x466e0f[_0x1a81('0x3e')]({'plain':!![]});_0x3e042e[_0x1a81('0x56')][_0x1a81('0x57')]=_0x106e28;return db[_0x1a81('0x58')]['create']({'body':_0x4c64a4[_0x1a81('0x28')][_0x1a81('0x28')],'MailAccountId':_0x4c64a4[_0x1a81('0x3f')]['id'],'MailInteractionId':_0x466e0f['id'],'direction':'in','ContactId':_0x3e042e[_0x1a81('0x4a')]['id'],'messageId':_0x4c64a4[_0x1a81('0x28')][_0x1a81('0x17')]['messageId'],'from':_0x4c64a4[_0x1a81('0x28')][_0x1a81('0x17')]['from'],'to':_0x4c64a4[_0x1a81('0x28')][_0x1a81('0x17')]['to'],'cc':_0x4c64a4['body'][_0x1a81('0x17')]['cc'],'subject':_0x4c64a4[_0x1a81('0x28')][_0x1a81('0x17')][_0x1a81('0x4d')],'attach':_0x4c64a4[_0x1a81('0x28')]['message'][_0x1a81('0x4e')],'Attachments':_0x4c64a4['body'][_0x1a81('0x17')][_0x1a81('0x59')],'originTo':_0x4c64a4[_0x1a81('0x28')][_0x1a81('0x17')][_0x1a81('0x5a')],'originCc':_0x4c64a4[_0x1a81('0x28')][_0x1a81('0x17')][_0x1a81('0x5b')],'bcc':_0x4c64a4[_0x1a81('0x28')]['message'][_0x1a81('0x5c')],'ChatWebsiteId':_0x4c64a4[_0x1a81('0x28')][_0x1a81('0x17')][_0x1a81('0x5d')]||null,'originChannel':_0x4c64a4[_0x1a81('0x28')][_0x1a81('0x17')]['originChannel']||_0x1a81('0x5e'),'ChatOfflineMessageId':_0x4c64a4[_0x1a81('0x28')][_0x1a81('0x17')][_0x1a81('0x5f')]||null},{'include':[{'model':db[_0x1a81('0x60')],'as':_0x1a81('0x61')}]});})[_0x1a81('0x10')](function(_0x1df18b){_0x3e042e[_0x1a81('0x17')]=_0x1df18b;if(_0x3e042e[_0x1a81('0x56')][_0x1a81('0x62')]){return db[_0x1a81('0x63')]['find']({'attributes':['id',_0x1a81('0x64')],'where':{'id':_0x3e042e[_0x1a81('0x56')][_0x1a81('0x62')]}})['then'](function(_0x52b189){if(_0x52b189){_0x3e042e[_0x1a81('0x41')][_0x1a81('0x65')]({'id':0x0,'priority':0x0,'app':_0x1a81('0x66'),'appdata':_0x52b189[_0x1a81('0x64')]+','+(_0x3e042e[_0x1a81('0x3f')][_0x1a81('0x67')]||0xa),'interval':_0x1a81('0x46')});}return respondWithRpcPromise(_0x1a81('0x68'),'startRouting',_0x3e042e);});}return respondWithRpcPromise(_0x1a81('0x68'),_0x1a81('0x69'),_0x3e042e);})[_0x1a81('0x10')](function(_0x1cd4ac){_0x5a316f(_0x1cd4ac);})[_0x1a81('0x1a')](function(_0x528db7){_0x379fef(_0x1dcd6b[_0x1a81('0x15')](0x1f4,_0x528db7[_0x1a81('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 5764619..8674c8d 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 _0xe265=['emit','removeListener','mailAccount:','./mailAccount.events','save','update'];(function(_0x2b0d57,_0x5706e6){var _0x56556d=function(_0x43b89f){while(--_0x43b89f){_0x2b0d57['push'](_0x2b0d57['shift']());}};_0x56556d(++_0x5706e6);}(_0xe265,0x111));var _0x5e26=function(_0x55ee65,_0x1d32a0){_0x55ee65=_0x55ee65-0x0;var _0x28bf74=_0xe265[_0x55ee65];return _0x28bf74;};'use strict';var MailAccountEvents=require(_0x5e26('0x0'));var events=[_0x5e26('0x1'),'remove',_0x5e26('0x2')];function createListener(_0x328c0f,_0xcc77d7){return function(_0x19cb33){_0xcc77d7[_0x5e26('0x3')](_0x328c0f,_0x19cb33);};}function removeListener(_0x59e306,_0x244ea1){return function(){MailAccountEvents[_0x5e26('0x4')](_0x59e306,_0x244ea1);};}exports['register']=function(_0x1067a){for(var _0x4999f4=0x0,_0x1d4b28=events['length'];_0x4999f4<_0x1d4b28;_0x4999f4++){var _0x11b07=events[_0x4999f4];var _0x423519=createListener(_0x5e26('0x5')+_0x11b07,_0x1067a);MailAccountEvents['on'](_0x11b07,_0x423519);}}; \ No newline at end of file +var _0xe56e=['./mailAccount.events','remove','removeListener','register','length','mailAccount:'];(function(_0x3fbd3c,_0x88a11a){var _0x3ca11b=function(_0x346ad5){while(--_0x346ad5){_0x3fbd3c['push'](_0x3fbd3c['shift']());}};_0x3ca11b(++_0x88a11a);}(_0xe56e,0xd8));var _0xee56=function(_0x11cd96,_0x544170){_0x11cd96=_0x11cd96-0x0;var _0x4b3a50=_0xe56e[_0x11cd96];return _0x4b3a50;};'use strict';var MailAccountEvents=require(_0xee56('0x0'));var events=['save',_0xee56('0x1'),'update'];function createListener(_0x87414c,_0x2349fb){return function(_0x4591b4){_0x2349fb['emit'](_0x87414c,_0x4591b4);};}function removeListener(_0x10faf5,_0x46a61d){return function(){MailAccountEvents[_0xee56('0x2')](_0x10faf5,_0x46a61d);};}exports[_0xee56('0x3')]=function(_0x42d373){for(var _0x59712f=0x0,_0x3abfd3=events[_0xee56('0x4')];_0x59712f<_0x3abfd3;_0x59712f++){var _0x1f14de=events[_0x59712f];var _0x184899=createListener(_0xee56('0x5')+_0x1f14de,_0x42d373);MailAccountEvents['on'](_0x1f14de,_0x184899);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 8b981a6..eb73808 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 _0x0293=['show','put','update','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','/:id','isAuthenticated'];(function(_0x25d68d,_0x69adf9){var _0x3f5c89=function(_0x27791a){while(--_0x27791a){_0x25d68d['push'](_0x25d68d['shift']());}};_0x3f5c89(++_0x69adf9);}(_0x0293,0x86));var _0x3029=function(_0x3cba86,_0x543b89){_0x3cba86=_0x3cba86-0x0;var _0x349320=_0x0293[_0x3cba86];return _0x349320;};'use strict';var multer=require(_0x3029('0x0'));var util=require(_0x3029('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3029('0x2')]();var fs_extra=require(_0x3029('0x3'));var auth=require(_0x3029('0x4'));var interaction=require(_0x3029('0x5'));var config=require('../../config/environment');var controller=require(_0x3029('0x6'));router[_0x3029('0x7')](_0x3029('0x8'),auth[_0x3029('0x9')](),controller[_0x3029('0xa')]);router[_0x3029('0xb')](_0x3029('0x8'),auth[_0x3029('0x9')](),controller[_0x3029('0xc')]);router[_0x3029('0xd')]('/:id',auth[_0x3029('0x9')](),controller[_0x3029('0xe')]);module[_0x3029('0xf')]=router; \ No newline at end of file +var _0xe411=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./mailApplication.controller','get','/:id','isAuthenticated','show','update','delete','destroy','exports','multer','util'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xe411,0xec));var _0x1e41=function(_0x44e909,_0x10cfa2){_0x44e909=_0x44e909-0x0;var _0x577f09=_0xe411[_0x44e909];return _0x577f09;};'use strict';var multer=require(_0x1e41('0x0'));var util=require(_0x1e41('0x1'));var path=require(_0x1e41('0x2'));var timeout=require(_0x1e41('0x3'));var express=require(_0x1e41('0x4'));var router=express[_0x1e41('0x5')]();var fs_extra=require(_0x1e41('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1e41('0x7'));var config=require('../../config/environment');var controller=require(_0x1e41('0x8'));router[_0x1e41('0x9')](_0x1e41('0xa'),auth[_0x1e41('0xb')](),controller[_0x1e41('0xc')]);router['put'](_0x1e41('0xa'),auth[_0x1e41('0xb')](),controller[_0x1e41('0xd')]);router[_0x1e41('0xe')](_0x1e41('0xa'),auth['isAuthenticated'](),controller[_0x1e41('0xf')]);module[_0x1e41('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 66846c2..07a76e3 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 _0xdcc6=['exports','INTEGER','noop','STRING','sequelize'];(function(_0x28b371,_0x1504e5){var _0x4e3740=function(_0x598035){while(--_0x598035){_0x28b371['push'](_0x28b371['shift']());}};_0x4e3740(++_0x1504e5);}(_0xdcc6,0x6d));var _0x6dcc=function(_0x15d6de,_0x5807c6){_0x15d6de=_0x15d6de-0x0;var _0x51e84a=_0xdcc6[_0x15d6de];return _0x51e84a;};'use strict';var Sequelize=require(_0x6dcc('0x0'));module[_0x6dcc('0x1')]={'priority':{'type':Sequelize[_0x6dcc('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6dcc('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x6dcc('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x2505=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x2989ef,_0x353d45){var _0x25c7dd=function(_0x10eca4){while(--_0x10eca4){_0x2989ef['push'](_0x2989ef['shift']());}};_0x25c7dd(++_0x353d45);}(_0x2505,0x76));var _0x5250=function(_0x57d108,_0x30c478){_0x57d108=_0x57d108-0x0;var _0x29e91c=_0x2505[_0x57d108];return _0x29e91c;};'use strict';var Sequelize=require(_0x5250('0x0'));module[_0x5250('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x5250('0x2')],'allowNull':![],'defaultValue':_0x5250('0x3')},'appdata':{'type':Sequelize[_0x5250('0x4')]()},'description':{'type':Sequelize[_0x5250('0x2')]},'interval':{'type':Sequelize[_0x5250('0x2')],'defaultValue':_0x5250('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index e93e96b..90aee80 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 _0xcb91=['send','show','params','keys','rawAttributes','query','intersection','attributes','fields','length','model','includeAll','include','merge','options','MailApplication','find','catch','body','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name'];(function(_0x21004b,_0x588678){var _0x5f4088=function(_0x230e9d){while(--_0x230e9d){_0x21004b['push'](_0x21004b['shift']());}};_0x5f4088(++_0x588678);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4c4037,_0x15054b){_0x4c4037=_0x4c4037-0x0;var _0x357862=_0xcb91[_0x4c4037];return _0x357862;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cb9('0x0'));var jsonpatch=require(_0x1cb9('0x1'));var rp=require(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cb9('0x4'));var util=require(_0x1cb9('0x5'));var path=require('path');var sox=require(_0x1cb9('0x6'));var csv=require(_0x1cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb9('0x8'));var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xc'));var authService=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var as=require(_0x1cb9('0xf'));var hardwareService=require(_0x1cb9('0x10'));var logger=require('../../config/logger')(_0x1cb9('0x11'));var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var licenseUtil=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x5445e1,_0x5e3c19){_0x5e3c19=_0x5e3c19||0xcc;return function(_0x59dec3){if(_0x59dec3){return _0x5445e1[_0x1cb9('0x16')](_0x5e3c19);}return _0x5445e1[_0x1cb9('0x17')](_0x5e3c19)[_0x1cb9('0x18')]();};}function respondWithResult(_0x1c714f,_0x56884d){_0x56884d=_0x56884d||0xc8;return function(_0x397727){if(_0x397727){return _0x1c714f[_0x1cb9('0x17')](_0x56884d)[_0x1cb9('0x19')](_0x397727);}};}function respondWithFilteredResult(_0x8dfa55,_0x3e2d11){return function(_0x5806d8){if(_0x5806d8){var _0x5572cb=typeof _0x3e2d11[_0x1cb9('0x1a')]===_0x1cb9('0x1b')&&typeof _0x3e2d11[_0x1cb9('0x1c')]===_0x1cb9('0x1b');var _0x3e21e0=_0x5806d8[_0x1cb9('0x1d')];var _0x23d3a9=_0x5572cb?0x0:_0x3e2d11['offset'];var _0x479d43=_0x5572cb?_0x5806d8[_0x1cb9('0x1d')]:_0x3e2d11[_0x1cb9('0x1a')]+_0x3e2d11[_0x1cb9('0x1c')];var _0x31481a;if(_0x479d43>=_0x3e21e0){_0x479d43=_0x3e21e0;_0x31481a=0xc8;}else{_0x31481a=0xce;}_0x8dfa55[_0x1cb9('0x17')](_0x31481a);return _0x8dfa55[_0x1cb9('0x1e')](_0x1cb9('0x1f'),_0x23d3a9+'-'+_0x479d43+'/'+_0x3e21e0)['json'](_0x5806d8);}return null;};}function patchUpdates(_0x559bcc){return function(_0x1a5a72){try{jsonpatch['apply'](_0x1a5a72,_0x559bcc,!![]);}catch(_0x4750b1){return BPromise[_0x1cb9('0x20')](_0x4750b1);}return _0x1a5a72['save']();};}function saveUpdates(_0x599275,_0x2e3854){return function(_0x325637){if(_0x325637){return _0x325637[_0x1cb9('0x21')](_0x599275)[_0x1cb9('0x22')](function(_0x45b8d3){return _0x45b8d3;});}return null;};}function removeEntity(_0x27db16,_0x59ebea){return function(_0x55b232){if(_0x55b232){return _0x55b232[_0x1cb9('0x23')]()['then'](function(){_0x27db16[_0x1cb9('0x17')](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x69b4c8,_0x44d3c4){return function(_0x43a100){if(!_0x43a100){_0x69b4c8['sendStatus'](0x194);}return _0x43a100;};}function handleError(_0x195f16,_0x9df250){_0x9df250=_0x9df250||0x1f4;return function(_0x4c8d76){logger[_0x1cb9('0x24')](_0x4c8d76[_0x1cb9('0x25')]);if(_0x4c8d76[_0x1cb9('0x26')]){delete _0x4c8d76[_0x1cb9('0x26')];}_0x195f16[_0x1cb9('0x17')](_0x9df250)[_0x1cb9('0x27')](_0x4c8d76);};}exports[_0x1cb9('0x28')]=function(_0xb644b3,_0x41e5c2){var _0x9de64b={'raw':!![],'where':{'id':_0xb644b3[_0x1cb9('0x29')]['id']}},_0x48888d={};_0x48888d['model']=_[_0x1cb9('0x2a')](db['MailApplication'][_0x1cb9('0x2b')]);_0x48888d[_0x1cb9('0x2c')]=_[_0x1cb9('0x2a')](_0xb644b3[_0x1cb9('0x2c')]);_0x48888d['filters']=_[_0x1cb9('0x2d')](_0x48888d['model'],_0x48888d[_0x1cb9('0x2c')]);_0x9de64b[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x48888d['model'],qs[_0x1cb9('0x2f')](_0xb644b3['query'][_0x1cb9('0x2f')]));_0x9de64b['attributes']=_0x9de64b[_0x1cb9('0x2e')][_0x1cb9('0x30')]?_0x9de64b[_0x1cb9('0x2e')]:_0x48888d[_0x1cb9('0x31')];if(_0xb644b3['query'][_0x1cb9('0x32')]){_0x9de64b[_0x1cb9('0x33')]=[{'all':!![]}];}_0x9de64b=_[_0x1cb9('0x34')]({},_0x9de64b,_0xb644b3[_0x1cb9('0x35')]);return db[_0x1cb9('0x36')][_0x1cb9('0x37')](_0x9de64b)[_0x1cb9('0x22')](handleEntityNotFound(_0x41e5c2,null))[_0x1cb9('0x22')](respondWithResult(_0x41e5c2,null))[_0x1cb9('0x38')](handleError(_0x41e5c2,null));};exports[_0x1cb9('0x21')]=function(_0x294eec,_0x26b950){if(_0x294eec[_0x1cb9('0x39')]['id']){delete _0x294eec['body']['id'];}return db['MailApplication'][_0x1cb9('0x37')]({'where':{'id':_0x294eec[_0x1cb9('0x29')]['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x26b950,null))[_0x1cb9('0x22')](saveUpdates(_0x294eec[_0x1cb9('0x39')],null))[_0x1cb9('0x22')](respondWithResult(_0x26b950,null))[_0x1cb9('0x38')](handleError(_0x26b950,null));};exports[_0x1cb9('0x23')]=function(_0x4d3e39,_0x2aa59b){return db[_0x1cb9('0x36')][_0x1cb9('0x37')]({'where':{'id':_0x4d3e39['params']['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x2aa59b,null))['then'](removeEntity(_0x2aa59b,null))[_0x1cb9('0x38')](handleError(_0x2aa59b,null));}; \ No newline at end of file +var _0xbdb7=['update','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','attributes','length','includeAll','merge','find','then','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save'];(function(_0x235482,_0x14b833){var _0x5f5bea=function(_0x17a254){while(--_0x17a254){_0x235482['push'](_0x235482['shift']());}};_0x5f5bea(++_0x14b833);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x266da8,_0x47419a){_0x266da8=_0x266da8-0x0;var _0x5cdbe0=_0xbdb7[_0x266da8];return _0x5cdbe0;};'use strict';var emlformat=require(_0x7bdb('0x0'));var rimraf=require(_0x7bdb('0x1'));var zipdir=require(_0x7bdb('0x2'));var jsonpatch=require(_0x7bdb('0x3'));var rp=require(_0x7bdb('0x4'));var moment=require(_0x7bdb('0x5'));var BPromise=require(_0x7bdb('0x6'));var Mustache=require(_0x7bdb('0x7'));var util=require(_0x7bdb('0x8'));var path=require('path');var sox=require(_0x7bdb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bdb('0xa'));var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x16'))['db'];function respondWithStatusCode(_0x25e3cb,_0x496613){_0x496613=_0x496613||0xcc;return function(_0x8d74ff){if(_0x8d74ff){return _0x25e3cb['sendStatus'](_0x496613);}return _0x25e3cb['status'](_0x496613)[_0x7bdb('0x17')]();};}function respondWithResult(_0x46dd4a,_0x4fd91a){_0x4fd91a=_0x4fd91a||0xc8;return function(_0x50eeca){if(_0x50eeca){return _0x46dd4a['status'](_0x4fd91a)[_0x7bdb('0x18')](_0x50eeca);}};}function respondWithFilteredResult(_0x195b2e,_0xe9919f){return function(_0x25d417){if(_0x25d417){var _0x31c909=typeof _0xe9919f[_0x7bdb('0x19')]===_0x7bdb('0x1a')&&typeof _0xe9919f[_0x7bdb('0x1b')]==='undefined';var _0x1c5750=_0x25d417[_0x7bdb('0x1c')];var _0x5723f4=_0x31c909?0x0:_0xe9919f[_0x7bdb('0x19')];var _0x4ffd4b=_0x31c909?_0x25d417[_0x7bdb('0x1c')]:_0xe9919f[_0x7bdb('0x19')]+_0xe9919f['limit'];var _0x3e5f8e;if(_0x4ffd4b>=_0x1c5750){_0x4ffd4b=_0x1c5750;_0x3e5f8e=0xc8;}else{_0x3e5f8e=0xce;}_0x195b2e[_0x7bdb('0x1d')](_0x3e5f8e);return _0x195b2e[_0x7bdb('0x1e')](_0x7bdb('0x1f'),_0x5723f4+'-'+_0x4ffd4b+'/'+_0x1c5750)[_0x7bdb('0x18')](_0x25d417);}return null;};}function patchUpdates(_0x5bfc35){return function(_0x49f353){try{jsonpatch[_0x7bdb('0x20')](_0x49f353,_0x5bfc35,!![]);}catch(_0xcb25f2){return BPromise['reject'](_0xcb25f2);}return _0x49f353[_0x7bdb('0x21')]();};}function saveUpdates(_0x118ea1,_0x346c72){return function(_0x3f53e7){if(_0x3f53e7){return _0x3f53e7[_0x7bdb('0x22')](_0x118ea1)['then'](function(_0x1d37ac){return _0x1d37ac;});}return null;};}function removeEntity(_0xdad53d,_0x40c447){return function(_0x3a456f){if(_0x3a456f){return _0x3a456f['destroy']()['then'](function(){_0xdad53d[_0x7bdb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47abaf,_0x4a9e02){return function(_0x2abef6){if(!_0x2abef6){_0x47abaf['sendStatus'](0x194);}return _0x2abef6;};}function handleError(_0x2b14bc,_0x72ba69){_0x72ba69=_0x72ba69||0x1f4;return function(_0x3ec129){logger[_0x7bdb('0x23')](_0x3ec129[_0x7bdb('0x24')]);if(_0x3ec129['name']){delete _0x3ec129[_0x7bdb('0x25')];}_0x2b14bc[_0x7bdb('0x1d')](_0x72ba69)[_0x7bdb('0x26')](_0x3ec129);};}exports[_0x7bdb('0x27')]=function(_0x371e8a,_0x2e8e65){var _0x1e9996={'raw':!![],'where':{'id':_0x371e8a[_0x7bdb('0x28')]['id']}},_0xd2d7be={};_0xd2d7be[_0x7bdb('0x29')]=_[_0x7bdb('0x2a')](db[_0x7bdb('0x2b')]['rawAttributes']);_0xd2d7be[_0x7bdb('0x2c')]=_[_0x7bdb('0x2a')](_0x371e8a[_0x7bdb('0x2c')]);_0xd2d7be[_0x7bdb('0x2d')]=_[_0x7bdb('0x2e')](_0xd2d7be['model'],_0xd2d7be[_0x7bdb('0x2c')]);_0x1e9996[_0x7bdb('0x2f')]=_[_0x7bdb('0x2e')](_0xd2d7be[_0x7bdb('0x29')],qs['fields'](_0x371e8a['query']['fields']));_0x1e9996[_0x7bdb('0x2f')]=_0x1e9996['attributes'][_0x7bdb('0x30')]?_0x1e9996['attributes']:_0xd2d7be[_0x7bdb('0x29')];if(_0x371e8a[_0x7bdb('0x2c')][_0x7bdb('0x31')]){_0x1e9996['include']=[{'all':!![]}];}_0x1e9996=_[_0x7bdb('0x32')]({},_0x1e9996,_0x371e8a['options']);return db['MailApplication'][_0x7bdb('0x33')](_0x1e9996)['then'](handleEntityNotFound(_0x2e8e65,null))[_0x7bdb('0x34')](respondWithResult(_0x2e8e65,null))['catch'](handleError(_0x2e8e65,null));};exports['update']=function(_0x206c26,_0x353b26){if(_0x206c26[_0x7bdb('0x35')]['id']){delete _0x206c26[_0x7bdb('0x35')]['id'];}return db[_0x7bdb('0x2b')][_0x7bdb('0x33')]({'where':{'id':_0x206c26['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x353b26,null))[_0x7bdb('0x34')](saveUpdates(_0x206c26[_0x7bdb('0x35')],null))[_0x7bdb('0x34')](respondWithResult(_0x353b26,null))[_0x7bdb('0x36')](handleError(_0x353b26,null));};exports[_0x7bdb('0x37')]=function(_0x228340,_0x2587af){return db[_0x7bdb('0x2b')]['find']({'where':{'id':_0x228340['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x2587af,null))[_0x7bdb('0x34')](removeEntity(_0x2587af,null))[_0x7bdb('0x36')](handleError(_0x2587af,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 6f76766..928401e 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 _0x59da=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','mail_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0xc0e537,_0x3c0cff){var _0x263cd9=function(_0x41774d){while(--_0x41774d){_0xc0e537['push'](_0xc0e537['shift']());}};_0x263cd9(++_0x3c0cff);}(_0x59da,0x1c8));var _0xa59d=function(_0x34d5d9,_0x2572f5){_0x34d5d9=_0x34d5d9-0x0;var _0xd7b3c0=_0x59da[_0x34d5d9];return _0xd7b3c0;};'use strict';var _=require(_0xa59d('0x0'));var util=require(_0xa59d('0x1'));var logger=require(_0xa59d('0x2'))(_0xa59d('0x3'));var moment=require(_0xa59d('0x4'));var BPromise=require(_0xa59d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa59d('0x6'));var rimraf=require('rimraf');var config=require(_0xa59d('0x7'));var attributes=require('./mailApplication.attributes');module[_0xa59d('0x8')]=function(_0x1deb73,_0x1b9ea2){return _0x1deb73['define']('MailApplication',attributes,{'tableName':_0xa59d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa59d('0xa'),'collate':_0xa59d('0xb')});}; \ No newline at end of file +var _0xe1e5=['moment','bluebird','path','rimraf','./mailApplication.attributes','mail_applications','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe1e5,0x1ab));var _0x5e1e=function(_0x4b5f91,_0x26c295){_0x4b5f91=_0x4b5f91-0x0;var _0x3c3a04=_0xe1e5[_0x4b5f91];return _0x3c3a04;};'use strict';var _=require('lodash');var util=require(_0x5e1e('0x0'));var logger=require(_0x5e1e('0x1'))(_0x5e1e('0x2'));var moment=require(_0x5e1e('0x3'));var BPromise=require(_0x5e1e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e1e('0x5'));var rimraf=require(_0x5e1e('0x6'));var config=require('../../config/environment');var attributes=require(_0x5e1e('0x7'));module['exports']=function(_0xae287e,_0x556059){return _0xae287e['define']('MailApplication',attributes,{'tableName':_0x5e1e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x5e1e('0x9')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 43613db..6a5af45 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 _0xeb4c=['message','result','catch','UpdateMailApplication','update','body','options','raw','where','attributes','limit','then','stringify','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code'];(function(_0xca1091,_0x539dbf){var _0xd3019c=function(_0xd629e0){while(--_0xd629e0){_0xca1091['push'](_0xca1091['shift']());}};_0xd3019c(++_0x539dbf);}(_0xeb4c,0xc1));var _0xceb4=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xeb4c[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xceb4('0x0'));var util=require(_0xceb4('0x1'));var moment=require(_0xceb4('0x2'));var BPromise=require(_0xceb4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xceb4('0x4'))['db'];var utils=require(_0xceb4('0x5'));var logger=require('../../config/logger')(_0xceb4('0x6'));var config=require(_0xceb4('0x7'));var jayson=require(_0xceb4('0x8'));var client=jayson[_0xceb4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10b147,_0x105e50,_0x41a06c){return new BPromise(function(_0x80f169,_0x3ea3db){return client['request'](_0x10b147,_0x41a06c)['then'](function(_0x1cc98e){logger[_0xceb4('0xa')](_0xceb4('0xb'),_0x105e50,_0xceb4('0xc'));logger[_0xceb4('0xd')](_0xceb4('0xe'),_0x105e50,_0xceb4('0xc'),JSON['stringify'](_0x1cc98e));if(_0x1cc98e[_0xceb4('0xf')]){if(_0x1cc98e[_0xceb4('0xf')][_0xceb4('0x10')]===0x1f4){logger[_0xceb4('0xf')]('MailApplication,\x20%s,\x20%s',_0x105e50,_0x1cc98e[_0xceb4('0xf')][_0xceb4('0x11')]);return _0x3ea3db(_0x1cc98e[_0xceb4('0xf')][_0xceb4('0x11')]);}logger[_0xceb4('0xf')](_0xceb4('0xb'),_0x105e50,_0x1cc98e[_0xceb4('0xf')][_0xceb4('0x11')]);return _0x80f169(_0x1cc98e[_0xceb4('0xf')][_0xceb4('0x11')]);}else{logger[_0xceb4('0xa')](_0xceb4('0xb'),_0x105e50,_0xceb4('0xc'));_0x80f169(_0x1cc98e[_0xceb4('0x12')][_0xceb4('0x11')]);}})[_0xceb4('0x13')](function(_0x5cc4ff){logger[_0xceb4('0xf')](_0xceb4('0xb'),_0x105e50,_0x5cc4ff);_0x3ea3db(_0x5cc4ff);});});}exports[_0xceb4('0x14')]=function(_0x4baa5a){var _0x23ebd8=this;return new Promise(function(_0x1c95b8,_0x5b1ca6){return db['MailApplication'][_0xceb4('0x15')](_0x4baa5a[_0xceb4('0x16')],{'raw':_0x4baa5a[_0xceb4('0x17')]?_0x4baa5a[_0xceb4('0x17')][_0xceb4('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4baa5a[_0xceb4('0x17')]?_0x4baa5a[_0xceb4('0x17')][_0xceb4('0x19')]||null:null,'attributes':_0x4baa5a[_0xceb4('0x17')]?_0x4baa5a['options'][_0xceb4('0x1a')]||null:null,'limit':_0x4baa5a['options']?_0x4baa5a[_0xceb4('0x17')][_0xceb4('0x1b')]||null:null})[_0xceb4('0x1c')](function(_0x57dc62){logger[_0xceb4('0xa')](_0xceb4('0x14'),_0x4baa5a);logger[_0xceb4('0xd')](_0xceb4('0x14'),_0x4baa5a,JSON[_0xceb4('0x1d')](_0x57dc62));_0x1c95b8(_0x57dc62);})[_0xceb4('0x13')](function(_0x5bd9c0){logger[_0xceb4('0xf')]('UpdateMailApplication',_0x5bd9c0['message'],_0x4baa5a);_0x5b1ca6(_0x23ebd8['error'](0x1f4,_0x5bd9c0['message']));});});}; \ No newline at end of file +var _0xee76=['options','raw','where','attributes','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateMailApplication','MailApplication','update'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xee76,0xb9));var _0x6ee7=function(_0x1bda6c,_0x5440b1){_0x1bda6c=_0x1bda6c-0x0;var _0x501a86=_0xee76[_0x1bda6c];return _0x501a86;};'use strict';var _=require(_0x6ee7('0x0'));var util=require(_0x6ee7('0x1'));var moment=require(_0x6ee7('0x2'));var BPromise=require(_0x6ee7('0x3'));var rs=require(_0x6ee7('0x4'));var fs=require('fs');var Redis=require(_0x6ee7('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6ee7('0x6'))('rpc');var config=require(_0x6ee7('0x7'));var jayson=require(_0x6ee7('0x8'));var client=jayson['client'][_0x6ee7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b0283,_0x4225ba,_0x1d19b1){return new BPromise(function(_0x4f1c4e,_0x1184c9){return client[_0x6ee7('0xa')](_0x1b0283,_0x1d19b1)[_0x6ee7('0xb')](function(_0x2e0e24){logger[_0x6ee7('0xc')](_0x6ee7('0xd'),_0x4225ba,_0x6ee7('0xe'));logger[_0x6ee7('0xf')](_0x6ee7('0x10'),_0x4225ba,'request\x20sent',JSON[_0x6ee7('0x11')](_0x2e0e24));if(_0x2e0e24['error']){if(_0x2e0e24[_0x6ee7('0x12')][_0x6ee7('0x13')]===0x1f4){logger[_0x6ee7('0x12')](_0x6ee7('0xd'),_0x4225ba,_0x2e0e24[_0x6ee7('0x12')][_0x6ee7('0x14')]);return _0x1184c9(_0x2e0e24['error'][_0x6ee7('0x14')]);}logger[_0x6ee7('0x12')](_0x6ee7('0xd'),_0x4225ba,_0x2e0e24['error'][_0x6ee7('0x14')]);return _0x4f1c4e(_0x2e0e24['error'][_0x6ee7('0x14')]);}else{logger[_0x6ee7('0xc')](_0x6ee7('0xd'),_0x4225ba,_0x6ee7('0xe'));_0x4f1c4e(_0x2e0e24[_0x6ee7('0x15')][_0x6ee7('0x14')]);}})['catch'](function(_0x5b4e0d){logger[_0x6ee7('0x12')]('MailApplication,\x20%s,\x20%s',_0x4225ba,_0x5b4e0d);_0x1184c9(_0x5b4e0d);});});}exports[_0x6ee7('0x16')]=function(_0x545c32){var _0x5718c0=this;return new Promise(function(_0x4b1531,_0x15e22e){return db[_0x6ee7('0x17')][_0x6ee7('0x18')](_0x545c32['body'],{'raw':_0x545c32[_0x6ee7('0x19')]?_0x545c32['options'][_0x6ee7('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x545c32[_0x6ee7('0x19')]?_0x545c32[_0x6ee7('0x19')][_0x6ee7('0x1b')]||null:null,'attributes':_0x545c32[_0x6ee7('0x19')]?_0x545c32['options'][_0x6ee7('0x1c')]||null:null,'limit':_0x545c32[_0x6ee7('0x19')]?_0x545c32['options']['limit']||null:null})['then'](function(_0x246082){logger[_0x6ee7('0xc')]('UpdateMailApplication',_0x545c32);logger[_0x6ee7('0xf')](_0x6ee7('0x16'),_0x545c32,JSON[_0x6ee7('0x11')](_0x246082));_0x4b1531(_0x246082);})[_0x6ee7('0x1d')](function(_0x153ade){logger['error']('UpdateMailApplication',_0x153ade['message'],_0x545c32);_0x15e22e(_0x5718c0[_0x6ee7('0x12')](0x1f4,_0x153ade[_0x6ee7('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index a1c7779..f933175 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 _0x686b=['/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','express','../../components/auth/service','../../components/interaction/service','index','get','/describe','isAuthenticated','/:id','/:id/messages','getMessages','/:id/download','download','post','create'];(function(_0x18e9a3,_0x276495){var _0x214569=function(_0x16ba45){while(--_0x16ba45){_0x18e9a3['push'](_0x18e9a3['shift']());}};_0x214569(++_0x276495);}(_0x686b,0xc2));var _0xb686=function(_0x46917f,_0x746c06){_0x46917f=_0x46917f-0x0;var _0x49b6fb=_0x686b[_0x46917f];return _0x49b6fb;};'use strict';var express=require(_0xb686('0x0'));var router=express['Router']();var auth=require(_0xb686('0x1'));var interaction=require(_0xb686('0x2'));var controller=require('./mailInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb686('0x3')]);router[_0xb686('0x4')](_0xb686('0x5'),auth[_0xb686('0x6')](),controller['describe']);router['get'](_0xb686('0x7'),auth[_0xb686('0x6')](),controller['show']);router[_0xb686('0x4')](_0xb686('0x8'),auth['isAuthenticated'](),controller[_0xb686('0x9')]);router[_0xb686('0x4')](_0xb686('0xa'),auth[_0xb686('0x6')](),controller[_0xb686('0xb')]);router[_0xb686('0xc')]('/',auth['isAuthenticated'](),controller[_0xb686('0xd')]);router[_0xb686('0xc')](_0xb686('0x8'),auth[_0xb686('0x6')](),controller['addMessage']);router[_0xb686('0xc')](_0xb686('0xe'),auth[_0xb686('0x6')](),interaction[_0xb686('0xf')](_0xb686('0x10'),_0xb686('0x11')),controller[_0xb686('0x12')]);router[_0xb686('0x13')](_0xb686('0x7'),auth[_0xb686('0x6')](),interaction['tracked'](_0xb686('0x10'),_0xb686('0x14')),controller[_0xb686('0x15')]);router[_0xb686('0x16')]('/:id',auth[_0xb686('0x6')](),interaction[_0xb686('0xf')](_0xb686('0x10'),_0xb686('0x17')),controller[_0xb686('0x18')]);router['delete']('/:id/tags',auth[_0xb686('0x6')](),controller[_0xb686('0x19')]);module['exports']=router; \ No newline at end of file +var _0x086e=['update','delete','mailinteraction:destroy','/:id/tags','removeTags','exports','express','Router','../../components/auth/service','./mailInteraction.controller','get','isAuthenticated','index','show','/:id/messages','/:id/download','download','post','create','addMessage','tracked','mail','mailinteraction:addtags','put','/:id','mailinteraction:update'];(function(_0x2c89e6,_0x2dd85a){var _0x11aa71=function(_0x1dd765){while(--_0x1dd765){_0x2c89e6['push'](_0x2c89e6['shift']());}};_0x11aa71(++_0x2dd85a);}(_0x086e,0x88));var _0xe086=function(_0x2b7868,_0x3c7807){_0x2b7868=_0x2b7868-0x0;var _0x1d66f3=_0x086e[_0x2b7868];return _0x1d66f3;};'use strict';var express=require(_0xe086('0x0'));var router=express[_0xe086('0x1')]();var auth=require(_0xe086('0x2'));var interaction=require('../../components/interaction/service');var controller=require(_0xe086('0x3'));router[_0xe086('0x4')]('/',auth[_0xe086('0x5')](),controller[_0xe086('0x6')]);router[_0xe086('0x4')]('/describe',auth[_0xe086('0x5')](),controller['describe']);router[_0xe086('0x4')]('/:id',auth[_0xe086('0x5')](),controller[_0xe086('0x7')]);router['get'](_0xe086('0x8'),auth[_0xe086('0x5')](),controller['getMessages']);router[_0xe086('0x4')](_0xe086('0x9'),auth['isAuthenticated'](),controller[_0xe086('0xa')]);router[_0xe086('0xb')]('/',auth[_0xe086('0x5')](),controller[_0xe086('0xc')]);router[_0xe086('0xb')](_0xe086('0x8'),auth[_0xe086('0x5')](),controller[_0xe086('0xd')]);router['post']('/:id/tags',auth[_0xe086('0x5')](),interaction[_0xe086('0xe')](_0xe086('0xf'),_0xe086('0x10')),controller['addTags']);router[_0xe086('0x11')](_0xe086('0x12'),auth['isAuthenticated'](),interaction['tracked'](_0xe086('0xf'),_0xe086('0x13')),controller[_0xe086('0x14')]);router[_0xe086('0x15')](_0xe086('0x12'),auth[_0xe086('0x5')](),interaction[_0xe086('0xe')](_0xe086('0xf'),_0xe086('0x16')),controller['destroy']);router[_0xe086('0x15')](_0xe086('0x17'),auth[_0xe086('0x5')](),controller[_0xe086('0x18')]);module[_0xe086('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index e171397..71f47ca 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 _0x63be=['BOOLEAN','STRING','TEXT','long','DATE','ENUM','out','exports'];(function(_0x38c18b,_0x2871fe){var _0x32ff9a=function(_0x408252){while(--_0x408252){_0x38c18b['push'](_0x38c18b['shift']());}};_0x32ff9a(++_0x2871fe);}(_0x63be,0xd7));var _0xe63b=function(_0xef073e,_0x3d69c7){_0xef073e=_0xef073e-0x0;var _0x56ddf9=_0x63be[_0xef073e];return _0x56ddf9;};'use strict';var Sequelize=require('sequelize');var iconv=require('iconv');module[_0xe63b('0x0')]={'closed':{'type':Sequelize[_0xe63b('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xe63b('0x2')]},'secondDisposition':{'type':Sequelize[_0xe63b('0x2')]},'thirdDisposition':{'type':Sequelize[_0xe63b('0x2')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xe63b('0x2')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xe63b('0x3')](_0xe63b('0x4'))},'subject':{'type':Sequelize[_0xe63b('0x3')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xe63b('0x5')]},'substatus':{'type':Sequelize[_0xe63b('0x2')](0x3c)},'substatusAt':{'type':Sequelize[_0xe63b('0x5')]},'firstMsgDirection':{'type':Sequelize[_0xe63b('0x6')]('in',_0xe63b('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe63b('0x5')]},'lastMsgDirection':{'type':Sequelize[_0xe63b('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe63b('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x8b3d=['out','sequelize','iconv','exports','DATE','STRING','long','TEXT','BOOLEAN','ENUM'];(function(_0x4cedd1,_0x4fb446){var _0x414983=function(_0x5a07c5){while(--_0x5a07c5){_0x4cedd1['push'](_0x4cedd1['shift']());}};_0x414983(++_0x4fb446);}(_0x8b3d,0x1af));var _0xd8b3=function(_0x4f9e0b,_0x54a637){_0x4f9e0b=_0x4f9e0b-0x0;var _0x3b10c9=_0x8b3d[_0x4f9e0b];return _0x3b10c9;};'use strict';var Sequelize=require(_0xd8b3('0x0'));var iconv=require(_0xd8b3('0x1'));module[_0xd8b3('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd8b3('0x3')]},'disposition':{'type':Sequelize[_0xd8b3('0x4')]},'secondDisposition':{'type':Sequelize[_0xd8b3('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xd8b3('0x4')]},'inReplyTo':{'type':Sequelize[_0xd8b3('0x4')](0x1fe)},'to':{'type':Sequelize[_0xd8b3('0x4')]},'cc':{'type':Sequelize['TEXT'](_0xd8b3('0x5'))},'subject':{'type':Sequelize[_0xd8b3('0x6')]()},'attach':{'type':Sequelize[_0xd8b3('0x7')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xd8b3('0x3')]},'substatus':{'type':Sequelize[_0xd8b3('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xd8b3('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd8b3('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xd8b3('0x8')]('in',_0xd8b3('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xd8b3('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index acbe5d6..a7c6b65 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 _0x9b09=['TagIds','Tags','split','forEach','push','MailMessage','findOne','plainBody','-id','lastMsgText','catch','answered','unmanaged','closed','waiting','UserId','talking','fieldName','type','filters','intersection','query','model','fields','length','attributes','sort','select','field','tools_tags','u.id','u.fullname','user_has_mail_interactions','users','u.id\x20=\x20ui.UserId','from','mail_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','find','ContactId','buildExpression','text','Tag','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','some','compact','MailAccountId','i.MailAccountId\x20IN\x20?','concat','parse','$gte','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','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)','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','agent','i.MailAccountId\x20IS\x20NULL','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closed','i.lastMsgAt','i.subject','i.disposition','i.secondDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','c.lastName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','Setting','enableEmailPreview','all','rows','show','params','keys','MailInteraction','rawAttributes','includeAll','options','create','body','describe','addMessage','getMessages','nolimit','MailInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','true','addTags','setTags','ids','omit','spread','color','emit','mailInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachments','Messages','bcc','subject','createdAt','get','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','message%d.eml','download','unlinkSync','eml-format','rimraf','moment','bluebird','path','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','html-entities','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','map','fullname'];(function(_0x4eb4ad,_0x183488){var _0x1312b2=function(_0x19aabe){while(--_0x19aabe){_0x4eb4ad['push'](_0x4eb4ad['shift']());}};_0x1312b2(++_0x183488);}(_0x9b09,0x1ad));var _0x99b0=function(_0x5cca9f,_0x154684){_0x5cca9f=_0x5cca9f-0x0;var _0x55edda=_0x9b09[_0x5cca9f];return _0x55edda;};'use strict';var emlformat=require(_0x99b0('0x0'));var rimraf=require(_0x99b0('0x1'));var zipdir=require('zip-dir');var moment=require(_0x99b0('0x2'));var BPromise=require(_0x99b0('0x3'));var util=require('util');var path=require(_0x99b0('0x4'));var fs=require('fs');var _=require('lodash');var squel=require(_0x99b0('0x5'));var juice=require('juice');var Redis=require(_0x99b0('0x6'));var qs=require(_0x99b0('0x7'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0x99b0('0x8'))(_0x99b0('0x9'));var config=require('../../config/environment');var db=require(_0x99b0('0xa'))['db'];var htmlEntities=require(_0x99b0('0xb'));config[_0x99b0('0xc')]=_[_0x99b0('0xd')](config[_0x99b0('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x99b0('0xe'))(new Redis(config[_0x99b0('0xc')]));require(_0x99b0('0xf'))[_0x99b0('0x10')](socket);function respondWithStatusCode(_0xff8662,_0x521de5){_0x521de5=_0x521de5||0xcc;return function(_0x1ce363){if(_0x1ce363){return _0xff8662[_0x99b0('0x11')](_0x521de5);}return _0xff8662[_0x99b0('0x12')](_0x521de5)[_0x99b0('0x13')]();};}function respondWithResult(_0x415ff4,_0x42be76){_0x42be76=_0x42be76||0xc8;return function(_0x57d64d){if(_0x57d64d){return _0x415ff4[_0x99b0('0x12')](_0x42be76)['json'](_0x57d64d);}};}function respondWithFilteredResult(_0x46e300,_0x2f93e7){return function(_0x5baf0c){if(_0x5baf0c){var _0x5bba73=typeof _0x2f93e7[_0x99b0('0x14')]===_0x99b0('0x15')&&typeof _0x2f93e7[_0x99b0('0x16')]==='undefined';var _0x4cfd10=_0x5baf0c['count'];var _0x2e176f=_0x5bba73?0x0:_0x2f93e7[_0x99b0('0x14')];var _0x4d40ea=_0x5bba73?_0x5baf0c[_0x99b0('0x17')]:_0x2f93e7[_0x99b0('0x14')]+_0x2f93e7[_0x99b0('0x16')];var _0x7bbb89;if(_0x4d40ea>=_0x4cfd10){_0x4d40ea=_0x4cfd10;_0x7bbb89=0xc8;}else{_0x7bbb89=0xce;}_0x46e300[_0x99b0('0x12')](_0x7bbb89);return _0x46e300[_0x99b0('0x18')](_0x99b0('0x19'),_0x2e176f+'-'+_0x4d40ea+'/'+_0x4cfd10)['json'](_0x5baf0c);}return null;};}function saveUpdates(_0x1a2521){return function(_0x3a7529){if(_0x3a7529){return _0x3a7529[_0x99b0('0x1a')](_0x1a2521)[_0x99b0('0x1b')](function(_0x1a5863){return _0x1a5863;});}return null;};}function removeEntity(_0x15b7fd){return function(_0x3b303b){if(_0x3b303b){return _0x3b303b[_0x99b0('0x1c')]()[_0x99b0('0x1b')](function(){_0x15b7fd[_0x99b0('0x12')](0xcc)[_0x99b0('0x13')]();});}};}function handleEntityNotFound(_0x2b27ac){return function(_0x44c5ae){if(!_0x44c5ae){_0x2b27ac[_0x99b0('0x11')](0x194);}return _0x44c5ae;};}function handleError(_0x462af1,_0x93dcb1){_0x93dcb1=_0x93dcb1||0x1f4;return function(_0xa469fa){logger[_0x99b0('0x1d')](_0xa469fa[_0x99b0('0x1e')]);if(_0xa469fa[_0x99b0('0x1f')]){delete _0xa469fa[_0x99b0('0x1f')];}_0x462af1[_0x99b0('0x12')](_0x93dcb1)[_0x99b0('0x20')](_0xa469fa);};}function getInteractionUsers(_0x21e7e3,_0x4b2aa4){return new BPromise(function(_0x299cbf,_0x4a6c0f){try{if(_0x4b2aa4[_0x21e7e3['id']]){_0x21e7e3['Users']=_[_0x99b0('0x21')](_0x4b2aa4[_0x21e7e3['id']],function(_0x3efaab){return{'id':_0x3efaab['id'],'fullname':_0x3efaab[_0x99b0('0x22')]};});}}catch(_0x8df666){_0x4a6c0f(_0x8df666);}_0x299cbf(_0x21e7e3);});}function getInteractionTags(_0x3ba9c1,_0x5ebaa5){return new BPromise(function(_0x128b0e,_0x154dec){try{if(_0x3ba9c1[_0x99b0('0x23')]){_0x3ba9c1[_0x99b0('0x24')]=[];_0x3ba9c1['TagIds'][_0x99b0('0x25')](',')[_0x99b0('0x26')](function(_0x5429cd){_0x3ba9c1[_0x99b0('0x24')][_0x99b0('0x27')](_0x5ebaa5[_0x5429cd]);});}delete _0x3ba9c1[_0x99b0('0x23')];}catch(_0x22a098){_0x154dec(_0x22a098);}_0x128b0e(_0x3ba9c1);});}function getLastMessageText(_0x5de317){return new BPromise(function(_0x2a282e,_0x233eb6){return db[_0x99b0('0x28')][_0x99b0('0x29')]({'where':{'$and':[{'MailInteractionId':_0x5de317['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x99b0('0x2a')],'order':_0x99b0('0x2b'),'raw':!![]})[_0x99b0('0x1b')](function(_0x334b6d){if(_0x334b6d&&_0x334b6d[_0x99b0('0x2a')]){_0x5de317[_0x99b0('0x2c')]=_['trimStart'](_0x334b6d[_0x99b0('0x2a')]);}_0x2a282e(_0x5de317);})[_0x99b0('0x2d')](function(_0x4426a3){_0x233eb6(_0x4426a3);});});}function updateMailInteraction(_0x78f028,_0x2ed0a5,_0x1a524e,_0x402b11){return new BPromise(function(_0x2b249e,_0x56c3e5){return getInteractionUsers(_0x78f028,_0x1a524e)[_0x99b0('0x1b')](function(_0x4a296b){return getInteractionTags(_0x4a296b,_0x2ed0a5);})[_0x99b0('0x1b')](function(_0x3f1c4c){return getStateInteraction(_0x3f1c4c);})['then'](function(_0x421be7){if(_0x402b11){_0x2b249e(getLastMessageText(_0x421be7));}else{_0x2b249e(_0x421be7);}})['catch'](function(_0x4e32b2){_0x56c3e5(_0x4e32b2);});});}function getStateInteraction(_0x3c7cbf){return new BPromise(function(_0x42648d){_0x3c7cbf['waiting']=0x0;_0x3c7cbf['talking']=0x0;_0x3c7cbf[_0x99b0('0x2e')]=0x0;_0x3c7cbf[_0x99b0('0x2f')]=0x0;_0x3c7cbf['total']=0x0;if(!_0x3c7cbf[_0x99b0('0x30')]&&!_0x3c7cbf['UserId']){_0x3c7cbf[_0x99b0('0x31')]+=0x1;}if(!_0x3c7cbf['closed']&&_0x3c7cbf[_0x99b0('0x32')]){_0x3c7cbf[_0x99b0('0x33')]+=0x1;if(_0x3c7cbf[_0x99b0('0x31')]){_0x3c7cbf['waiting']-=0x1;}}if(_0x3c7cbf[_0x99b0('0x30')]&&_0x3c7cbf['UserId']){_0x3c7cbf[_0x99b0('0x2e')]+=0x1;if(_0x3c7cbf['talking']){_0x3c7cbf[_0x99b0('0x33')]-=0x1;}}if(_0x3c7cbf[_0x99b0('0x30')]&&!_0x3c7cbf[_0x99b0('0x32')]){_0x3c7cbf[_0x99b0('0x2f')]+=0x1;if(_0x3c7cbf[_0x99b0('0x31')]){_0x3c7cbf[_0x99b0('0x31')]-=0x1;}}_0x3c7cbf['total']+=0x1;_0x42648d(_0x3c7cbf);});}exports['index']=function(_0xb9e8a9,_0x21636c){var _0x28278b={},_0x3ecb5c={},_0x24a060={'count':0x0,'rows':[]};var _0x4f2762=_[_0x99b0('0x21')](db['MailInteraction']['rawAttributes'],function(_0xc01419){return{'name':_0xc01419[_0x99b0('0x34')],'type':_0xc01419[_0x99b0('0x35')]['key']};});_0x3ecb5c['model']=_[_0x99b0('0x21')](_0x4f2762,'name');_0x3ecb5c['query']=_['keys'](_0xb9e8a9['query']);_0x3ecb5c[_0x99b0('0x36')]=_[_0x99b0('0x37')](_0x3ecb5c['model'],_0x3ecb5c[_0x99b0('0x38')]);_0x28278b['attributes']=_[_0x99b0('0x37')](_0x3ecb5c[_0x99b0('0x39')],qs[_0x99b0('0x3a')](_0xb9e8a9[_0x99b0('0x38')]['fields']));_0x28278b['attributes']=_0x28278b['attributes'][_0x99b0('0x3b')]?_0x28278b[_0x99b0('0x3c')]:_0x3ecb5c[_0x99b0('0x39')];if(!_0xb9e8a9[_0x99b0('0x38')]['hasOwnProperty']('nolimit')){_0x28278b[_0x99b0('0x16')]=qs[_0x99b0('0x16')](_0xb9e8a9[_0x99b0('0x38')][_0x99b0('0x16')]);_0x28278b['offset']=qs[_0x99b0('0x14')](_0xb9e8a9[_0x99b0('0x38')][_0x99b0('0x14')]);}_0x28278b['order']=qs[_0x99b0('0x3d')](_0xb9e8a9[_0x99b0('0x38')]['sort']);_0x28278b['where']=qs[_0x99b0('0x36')](_['pick'](_0xb9e8a9[_0x99b0('0x38')],_0x3ecb5c[_0x99b0('0x36')]),_0x4f2762);var _0x2fca57=[];var _0x48ca98=squel[_0x99b0('0x3e')]()[_0x99b0('0x3f')]('id')[_0x99b0('0x3f')](_0x99b0('0x1f'))['field']('color')['from'](_0x99b0('0x40'));var _0x5f0f4c=squel[_0x99b0('0x3e')]()[_0x99b0('0x3f')](_0x99b0('0x41'))[_0x99b0('0x3f')](_0x99b0('0x42'))[_0x99b0('0x3f')]('ui.MailInteractionId')['from'](_0x99b0('0x43'),'ui')['left_join'](_0x99b0('0x44'),'u',_0x99b0('0x45'));var _0x2000b6=squel[_0x99b0('0x3e')]()[_0x99b0('0x46')](_0x99b0('0x47'),'i')[_0x99b0('0x48')](_0x99b0('0x49'),'c',_0x99b0('0x4a'))['left_join'](_0x99b0('0x44'),'o',_0x99b0('0x4b'))[_0x99b0('0x48')](_0x99b0('0x4c'),'a',_0x99b0('0x4d'))[_0x99b0('0x48')](_0x99b0('0x4e'),'me',_0x99b0('0x4f'))[_0x99b0('0x48')](_0x99b0('0x50'),'it',_0x99b0('0x51'))[_0x99b0('0x48')](_0x99b0('0x40'),'t',_0x99b0('0x52'));var _0x4be973=squel[_0x99b0('0x53')]();var _0x25d9d0=[];var _0x5c95fa=squel[_0x99b0('0x53')]();var _0x36679b;if(_0xb9e8a9[_0x99b0('0x38')]['search']){_0x36679b=as[_0x99b0('0x54')](_0xb9e8a9['query']['search']);var _0x15acd2=_0x36679b['sqlOperator'];for(var _0x5ee59c=0x0;_0x5ee59c<_0x36679b[_0x99b0('0x55')]['length'];_0x5ee59c++){var _0x5caa94=_0x36679b[_0x99b0('0x55')][_0x5ee59c];var _0x39108d='i';var _0x2424e1=_['find'](_0x4f2762,[_0x99b0('0x1f'),_0x5caa94[_0x99b0('0x3f')]]);if(!_0x2424e1){switch(_0x5caa94[_0x99b0('0x3f')]){case _0x99b0('0x56'):if(_0x5caa94[_0x99b0('0x57')]==0x1){_0x2000b6[_0x99b0('0x58')]('`'+_0x5caa94[_0x99b0('0x3f')]+_0x99b0('0x59'));}else{_0x2000b6[_0x99b0('0x58')]('`'+_0x5caa94[_0x99b0('0x3f')]+_0x99b0('0x5a'));}break;case _0x99b0('0x5b'):if(_0x5caa94[_0x99b0('0x5c')]===_0x99b0('0x5d')){if(_0x5caa94[_0x99b0('0x57')]['split']('\x20')['length']>0x1){_0x4be973[_0x15acd2](_0x99b0('0x5e'),qs[_0x99b0('0x5f')](_0x5caa94['value']),null);}else{var _0x5af9ee='%'+_0x5caa94[_0x99b0('0x57')]+'%';_0x4be973[_0x15acd2]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5af9ee,_0x5af9ee,_0x5af9ee);}}else{_0x2424e1=_[_0x99b0('0x60')](_0x4f2762,[_0x99b0('0x1f'),_0x99b0('0x61')]);_0x5caa94[_0x99b0('0x3f')]=_0x99b0('0x61');_0x4ad131=as[_0x99b0('0x62')](_0x39108d,_0x2424e1['type'],_0x5caa94);_0x4be973[_0x15acd2](_0x4ad131[_0x99b0('0x63')],_0x4ad131[_0x99b0('0x57')]['start'],_0x4ad131[_0x99b0('0x57')][_0x99b0('0x13')]);}break;case _0x99b0('0x64'):var _0x5be8ca=_0x5caa94[_0x99b0('0x57')][_0x99b0('0x25')](',')['map'](function(_0x462348){return Number(_0x462348);});_0x5be8ca[_0x99b0('0x26')](function(_0x2989c6){_0x5c95fa['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2989c6+',%');});_0x25d9d0=_['union'](_0x25d9d0,_0x5be8ca);break;case _0x99b0('0x65'):if(_0x5caa94[_0x99b0('0x5c')]===_0x99b0('0x5d')){_0x4be973[_0x15acd2](_0x99b0('0x66'),'%'+_0x5caa94[_0x99b0('0x57')]+'%',null);}else{_0x2424e1=_['find'](_0x4f2762,[_0x99b0('0x1f'),'UserId']);_0x5caa94[_0x99b0('0x3f')]='UserId';_0x4ad131=as[_0x99b0('0x62')](_0x39108d,_0x2424e1[_0x99b0('0x35')],_0x5caa94);_0x4be973[_0x15acd2](_0x4ad131[_0x99b0('0x63')],_0x4ad131['value'][_0x99b0('0x67')],_0x4ad131[_0x99b0('0x57')][_0x99b0('0x13')]);}break;case _0x99b0('0x2a'):_0x4ad131=as[_0x99b0('0x62')]('me',null,_0x5caa94);_0x4be973[_0x15acd2](_0x4ad131[_0x99b0('0x63')],_0x4ad131[_0x99b0('0x57')][_0x99b0('0x67')],_0x4ad131[_0x99b0('0x57')][_0x99b0('0x13')]);break;}}else{var _0x4ad131=as[_0x99b0('0x62')](_0x39108d,_0x2424e1[_0x99b0('0x35')],_0x5caa94);_0x4be973[_0x15acd2](_0x4ad131[_0x99b0('0x63')],_0x4ad131[_0x99b0('0x57')]['start'],_0x4ad131[_0x99b0('0x57')]['end']);}}}else{var _0x5ae1ae=_(_0xb9e8a9[_0x99b0('0x38')])['keys']()[_0x99b0('0x21')](function(_0x33bbf6){return _[_0x99b0('0x68')](_0x4f2762,['name',_0x33bbf6])?_0x33bbf6:undefined;})[_0x99b0('0x69')]()[_0x99b0('0x57')]();if(!_['isEmpty'](_0x5ae1ae)){_0x5ae1ae[_0x99b0('0x26')](function(_0x169d87){if(_0x169d87===_0x99b0('0x6a')){_0x2000b6['where'](_0x99b0('0x6b'),[][_0x99b0('0x6c')](_0xb9e8a9[_0x99b0('0x38')][_0x169d87]));}else if(_0x169d87==='createdAt'){var _0x333de5=JSON[_0x99b0('0x6d')](_0xb9e8a9['query'][_0x169d87])[_0x99b0('0x6e')];var _0x2bd6bf=JSON['parse'](_0xb9e8a9[_0x99b0('0x38')][_0x169d87])[_0x99b0('0x6f')];_0x2000b6[_0x99b0('0x70')](_0x99b0('0x71'),_0x333de5,_0x2bd6bf);}else{if(_0xb9e8a9[_0x99b0('0x38')][_0x169d87]===_0x99b0('0x72')){_0x2000b6[_0x99b0('0x70')]('i.'+_0x169d87+_0x99b0('0x73'));}else{_0x2000b6[_0x99b0('0x70')]('i.'+_0x169d87+_0x99b0('0x74'),_0xb9e8a9[_0x99b0('0x38')][_0x169d87]);}}});}if(_0xb9e8a9['query']['read']){if(_0xb9e8a9[_0x99b0('0x38')][_0x99b0('0x75')]==0x1){_0x2000b6[_0x99b0('0x58')](_0x99b0('0x76'));}else{_0x2000b6[_0x99b0('0x58')](_0x99b0('0x77'));}}if(_0xb9e8a9[_0x99b0('0x38')]['tag']){_0x25d9d0=_[_0x99b0('0x78')](_0xb9e8a9[_0x99b0('0x38')]['tag'])?_0xb9e8a9['query'][_0x99b0('0x79')]:new Array(_0xb9e8a9[_0x99b0('0x38')][_0x99b0('0x79')]);_0x25d9d0['forEach'](function(_0x3caebc){_0x5c95fa['or'](_0x99b0('0x7a'),'%,'+_0x3caebc+',%');});}if(_0xb9e8a9[_0x99b0('0x38')]['filter']){var _0x2942d1=_0xb9e8a9[_0x99b0('0x38')][_0x99b0('0x7b')][_0x99b0('0x7c')]('\x5c','\x5c\x5c')[_0x99b0('0x7c')](/'/g,'\x27\x27');if(qs[_0x99b0('0x7d')](_0x2942d1)){_0x4be973['or']('i.id\x20LIKE\x20?',_0x2942d1+'%');}else if(qs[_0x99b0('0x7e')](_0x2942d1)){_0x4be973['or'](_0x99b0('0x7f'),_0x2942d1+'%');}else{_0x4be973['or'](_0x99b0('0x80'),qs[_0x99b0('0x5f')](_0x2942d1))['or'](_0x99b0('0x81'),qs[_0x99b0('0x5f')](_0x2942d1));}}}_0x2000b6[_0x99b0('0x70')](_0x4be973);_0x2000b6[_0x99b0('0x82')](_0x99b0('0x83'));var _0x7bc896={'type':db[_0x99b0('0x84')][_0x99b0('0x85')][_0x99b0('0x86')],'raw':!![]};var _0x123867=_0x2000b6['clone']();_0x123867[_0x99b0('0x3f')](_0x99b0('0x83'));_0x123867[_0x99b0('0x3f')](_0x99b0('0x87'),'unreadMessages');if(_0x28278b[_0x99b0('0x88')]){_0x28278b['order'][_0x99b0('0x26')](function(_0x495384){var _0x25f9de=_0x495384[0x0]===_0x99b0('0x89')?_0x495384[0x0]:'i.'+_0x495384[0x0];_0x2000b6[_0x99b0('0x88')](_0x25f9de,_0x495384[0x1]===_0x99b0('0x8a')?![]:!![]);});}if(!_[_0x99b0('0x8b')](_0x25d9d0)){_0x2000b6[_0x99b0('0x58')](_0x5c95fa);_0x123867['where'](_0x99b0('0x8c'),_0x25d9d0);}BPromise[_0x99b0('0x8d')]()['then'](function(){if(!_0x36679b){if(_0xb9e8a9[_0x99b0('0x38')][_0x99b0('0x6a')])return;_0x123867['where'](_0x99b0('0x8e'));_0x2000b6[_0x99b0('0x70')](_0x99b0('0x8e'));return;}if(_0xb9e8a9[_0x99b0('0x8f')]['role']!==_0x99b0('0x90'))return;return _0xb9e8a9[_0x99b0('0x8f')]['getMailAccounts']({'attributes':['id'],'raw':!![]})[_0x99b0('0x1b')](function(_0x41cb4d){if(_[_0x99b0('0x8b')](_0x41cb4d)){_0x123867[_0x99b0('0x70')](_0x99b0('0x91'));_0x2000b6[_0x99b0('0x70')](_0x99b0('0x91'));}else{_0x123867[_0x99b0('0x70')](_0x99b0('0x6b'),_[_0x99b0('0x21')](_0x41cb4d,'id'));_0x2000b6['where'](_0x99b0('0x6b'),_['map'](_0x41cb4d,'id'));}});})[_0x99b0('0x1b')](function(){if(_0xb9e8a9['user']['role']===_0x99b0('0x90')&&!_0x36679b&&!_0xb9e8a9['query']['MailAccountId'])return[];return db['sequelize'][_0x99b0('0x38')](_0x123867[_0x99b0('0x92')](),_0x7bc896);})[_0x99b0('0x1b')](function(_0x2556a3){_0x24a060['count']=_0x2556a3[_0x99b0('0x3b')];if(_0x24a060[_0x99b0('0x17')]===0x0)return[];return db['sequelize'][_0x99b0('0x38')](_0x48ca98[_0x99b0('0x92')](),_0x7bc896)[_0x99b0('0x1b')](function(_0x478a30){_0x2fca57=_[_0x99b0('0x93')](_0x478a30,'id');_0x7bc896=_[_0x99b0('0x94')](_0x7bc896,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xb9e8a9[_0x99b0('0x38')][_0x99b0('0x3a')]){_0x28278b['attributes'][_0x99b0('0x26')](function(_0x27ad92){_0x2000b6['field']('i.'+_0x27ad92);});}else{_0x2000b6['field'](_0x99b0('0x87'),_0x99b0('0x56'));_0x2000b6[_0x99b0('0x3f')](_0x99b0('0x95'),_0x99b0('0x96'));_0x2000b6[_0x99b0('0x3f')](_0x99b0('0x97'),_0x99b0('0x98'));_0x2000b6[_0x99b0('0x3f')](_0x99b0('0x99'),_0x99b0('0x89'));_0x2000b6[_0x99b0('0x3f')](_0x99b0('0x83'));_0x2000b6[_0x99b0('0x3f')](_0x99b0('0x9a'));_0x2000b6[_0x99b0('0x3f')](_0x99b0('0x9b'));_0x2000b6[_0x99b0('0x3f')](_0x99b0('0x9c'));_0x2000b6[_0x99b0('0x3f')]('i.closedAt');_0x2000b6['field']('i.attach');_0x2000b6[_0x99b0('0x3f')](_0x99b0('0x9d'));_0x2000b6[_0x99b0('0x3f')]('i.lastMsgDirection');_0x2000b6['field'](_0x99b0('0x9e'));_0x2000b6['field'](_0x99b0('0x9f'));_0x2000b6[_0x99b0('0x3f')](_0x99b0('0xa0'));_0x2000b6[_0x99b0('0x3f')]('i.thirdDisposition');_0x2000b6['field']('i.substatus');_0x2000b6[_0x99b0('0x3f')](_0x99b0('0xa1'));_0x2000b6[_0x99b0('0x3f')](_0x99b0('0xa2'));_0x2000b6[_0x99b0('0x3f')](_0x99b0('0xa3'));_0x2000b6['field'](_0x99b0('0xa4'));_0x2000b6[_0x99b0('0x3f')]('c.firstName','Contact.firstName');_0x2000b6[_0x99b0('0x3f')](_0x99b0('0xa5'),_0x99b0('0xa6'));_0x2000b6[_0x99b0('0x3f')]('c.email',_0x99b0('0xa7'));_0x2000b6['field']('c.phone',_0x99b0('0xa8'));_0x2000b6[_0x99b0('0x3f')](_0x99b0('0xa9'),_0x99b0('0xaa'));_0x2000b6[_0x99b0('0x3f')](_0x99b0('0xab'),'Contact.fax');_0x2000b6[_0x99b0('0x3f')]('o.fullname','Owner.fullname');_0x2000b6[_0x99b0('0x3f')](_0x99b0('0xac'),_0x99b0('0xad'));_0x2000b6[_0x99b0('0x3f')](_0x99b0('0xae'),_0x99b0('0x23'));}if(_0x28278b[_0x99b0('0x16')])_0x2000b6[_0x99b0('0x16')](_0x28278b[_0x99b0('0x16')]);if(_0x28278b[_0x99b0('0x14')])_0x2000b6['offset'](_0x28278b[_0x99b0('0x14')]);return db[_0x99b0('0xaf')][_0x99b0('0x38')](_0x2000b6['toString'](),_0x7bc896);})[_0x99b0('0x1b')](function(_0x28ae03){if(_0x28ae03['length']>0x0)_0x5f0f4c[_0x99b0('0x70')]('ui.MailInteractionId\x20IN\x20?',_['map'](_0x28ae03,'id'));return db[_0x99b0('0xaf')][_0x99b0('0x38')](_0x5f0f4c[_0x99b0('0x92')](),_0x7bc896)[_0x99b0('0x1b')](function(_0x2a6b2e){var _0x1e56f9=_['groupBy'](_0x2a6b2e,'MailInteractionId');var _0x25d10f=[];return db[_0x99b0('0xb0')][_0x99b0('0x29')]({'attributes':[_0x99b0('0xb1')],'raw':!![]})[_0x99b0('0x1b')](function(_0x206bc4){var _0x1f9fa6=_0x206bc4[_0x99b0('0xb1')];_0x28ae03[_0x99b0('0x26')](function(_0x4b00da){_0x25d10f[_0x99b0('0x27')](updateMailInteraction(_0x4b00da,_0x2fca57,_0x1e56f9,_0x1f9fa6));});return BPromise[_0x99b0('0xb2')](_0x25d10f);});});});})[_0x99b0('0x1b')](function(_0x4cc801){_0x24a060[_0x99b0('0xb3')]=_0x4cc801;return _0x24a060;})[_0x99b0('0x1b')](respondWithFilteredResult(_0x21636c,_0x28278b))[_0x99b0('0x2d')](handleError(_0x21636c,null));};exports[_0x99b0('0xb4')]=function(_0xd0f1cb,_0x3e748c){var _0x1f3f0d={'raw':![],'where':{'id':_0xd0f1cb[_0x99b0('0xb5')]['id']}},_0x403e91={};_0x403e91[_0x99b0('0x39')]=_[_0x99b0('0xb6')](db[_0x99b0('0xb7')][_0x99b0('0xb8')]);_0x403e91['query']=_[_0x99b0('0xb6')](_0xd0f1cb[_0x99b0('0x38')]);_0x403e91[_0x99b0('0x36')]=_[_0x99b0('0x37')](_0x403e91[_0x99b0('0x39')],_0x403e91[_0x99b0('0x38')]);_0x1f3f0d['attributes']=_[_0x99b0('0x37')](_0x403e91[_0x99b0('0x39')],qs[_0x99b0('0x3a')](_0xd0f1cb[_0x99b0('0x38')][_0x99b0('0x3a')]));_0x1f3f0d[_0x99b0('0x3c')]=_0x1f3f0d[_0x99b0('0x3c')][_0x99b0('0x3b')]?_0x1f3f0d[_0x99b0('0x3c')]:_0x403e91[_0x99b0('0x39')];if(_0xd0f1cb[_0x99b0('0x38')][_0x99b0('0xb9')]){_0x1f3f0d['include']=[{'all':!![]}];}_0x1f3f0d=_[_0x99b0('0x94')]({},_0x1f3f0d,_0xd0f1cb[_0x99b0('0xba')]);return db['MailInteraction']['find'](_0x1f3f0d)[_0x99b0('0x1b')](handleEntityNotFound(_0x3e748c,null))[_0x99b0('0x1b')](respondWithResult(_0x3e748c,null))[_0x99b0('0x2d')](handleError(_0x3e748c,null));};exports[_0x99b0('0xbb')]=function(_0x520a99,_0x415f0b){return db[_0x99b0('0xb7')][_0x99b0('0xbb')](_0x520a99['body'],{})['then'](respondWithResult(_0x415f0b,0xc9))[_0x99b0('0x2d')](handleError(_0x415f0b,null));};exports['update']=function(_0x136cab,_0x32e40f){if(_0x136cab[_0x99b0('0xbc')]['id']){delete _0x136cab[_0x99b0('0xbc')]['id'];}return db[_0x99b0('0xb7')][_0x99b0('0x60')]({'where':{'id':_0x136cab[_0x99b0('0xb5')]['id']}})[_0x99b0('0x1b')](handleEntityNotFound(_0x32e40f,null))['then'](saveUpdates(_0x136cab['body'],null))[_0x99b0('0x1b')](respondWithResult(_0x32e40f,null))[_0x99b0('0x2d')](handleError(_0x32e40f,null));};exports[_0x99b0('0x1c')]=function(_0x54be6e,_0x5cc51f){return db[_0x99b0('0xb7')]['find']({'where':{'id':_0x54be6e[_0x99b0('0xb5')]['id']}})['then'](handleEntityNotFound(_0x5cc51f,null))[_0x99b0('0x1b')](removeEntity(_0x5cc51f,null))[_0x99b0('0x2d')](handleError(_0x5cc51f,null));};exports['describe']=function(_0x155095,_0x46c315){return db[_0x99b0('0xb7')][_0x99b0('0xbd')]()[_0x99b0('0x1b')](respondWithResult(_0x46c315,null))[_0x99b0('0x2d')](handleError(_0x46c315,null));};exports[_0x99b0('0xbe')]=function(_0x418ac0,_0x23e1f6){return db[_0x99b0('0x28')][_0x99b0('0x60')]({'where':{'id':_0x418ac0[_0x99b0('0xb5')]['id']}})['then'](handleEntityNotFound(_0x23e1f6,null))['then'](function(_0x352b44){if(_0x352b44){return _0x352b44[_0x99b0('0xbe')](_0x418ac0['body']['ids'],_['omit'](_0x418ac0['body'],['ids','id'])||{});}})[_0x99b0('0x1b')](respondWithResult(_0x23e1f6,null))[_0x99b0('0x2d')](handleError(_0x23e1f6,null));};exports[_0x99b0('0xbf')]=function(_0x3b82b5,_0x3440f5){var _0xb1cef6={'raw':![],'where':{}};var _0x2949ee={};var _0x47b830={'count':0x0,'rows':[]};return db[_0x99b0('0xb7')][_0x99b0('0x29')]({'where':{'id':_0x3b82b5[_0x99b0('0xb5')]['id']}})['then'](handleEntityNotFound(_0x3440f5,null))[_0x99b0('0x1b')](function(_0x3df711){if(_0x3df711){_0x2949ee[_0x99b0('0x39')]=_[_0x99b0('0xb6')](db[_0x99b0('0x28')]['rawAttributes']);_0x2949ee[_0x99b0('0x38')]=_['keys'](_0x3b82b5[_0x99b0('0x38')]);_0x2949ee[_0x99b0('0x36')]=_[_0x99b0('0x37')](_0x2949ee[_0x99b0('0x39')],_0x2949ee[_0x99b0('0x38')]);_0xb1cef6[_0x99b0('0x3c')]=_[_0x99b0('0x37')](_0x2949ee[_0x99b0('0x39')],qs['fields'](_0x3b82b5[_0x99b0('0x38')][_0x99b0('0x3a')]));_0xb1cef6[_0x99b0('0x3c')]=_0xb1cef6[_0x99b0('0x3c')][_0x99b0('0x3b')]?_0xb1cef6[_0x99b0('0x3c')]:_0x2949ee[_0x99b0('0x39')];if(!_0x3b82b5['query']['hasOwnProperty'](_0x99b0('0xc0'))){_0xb1cef6[_0x99b0('0x16')]=qs[_0x99b0('0x16')](_0x3b82b5[_0x99b0('0x38')][_0x99b0('0x16')]);_0xb1cef6[_0x99b0('0x14')]=qs[_0x99b0('0x14')](_0x3b82b5[_0x99b0('0x38')]['offset']);}_0xb1cef6[_0x99b0('0x88')]=qs[_0x99b0('0x3d')](_0x3b82b5[_0x99b0('0x38')][_0x99b0('0x3d')]);_0xb1cef6[_0x99b0('0x70')]=qs['filters'](_['pick'](_0x3b82b5[_0x99b0('0x38')],_0x2949ee[_0x99b0('0x36')]));_0xb1cef6[_0x99b0('0x70')][_0x99b0('0xc1')]=_0x3df711['id'];if(_0x3b82b5['query'][_0x99b0('0x7b')]){_0xb1cef6[_0x99b0('0x70')]=_[_0x99b0('0x94')](_0xb1cef6[_0x99b0('0x70')],{'$or':_['map'](_0xb1cef6['attributes'],function(_0x4f2b89){var _0x17073e={};_0x17073e[_0x4f2b89]={'$like':'%'+_0x3b82b5[_0x99b0('0x38')][_0x99b0('0x7b')]+'%'};return _0x17073e;})});}if(_0x3b82b5['query'][_0x99b0('0x6e')]){var _0x406f16=_0x3b82b5['query'][_0x99b0('0x6e')][_0x99b0('0x25')](',');var _0x4f4295={};_0x4f4295[_0x406f16[0x0]]={'$gte':moment(_0x406f16[0x1])[_0x99b0('0xc2')](_0x99b0('0xc3'))};_0xb1cef6[_0x99b0('0x70')]=_[_0x99b0('0x94')](_0xb1cef6[_0x99b0('0x70')],_0x4f4295);}_0xb1cef6=_[_0x99b0('0x94')]({},_0xb1cef6,_0x3b82b5[_0x99b0('0xba')]);return db[_0x99b0('0x28')]['count']({'where':_0xb1cef6[_0x99b0('0x70')]})[_0x99b0('0x1b')](function(_0x17f64f){_0x47b830[_0x99b0('0x17')]=_0x17f64f;if(_0x3b82b5[_0x99b0('0x38')]['includeAll']){_0xb1cef6[_0x99b0('0xc4')]=[{'all':!![]}];}return db[_0x99b0('0x28')][_0x99b0('0xc5')](_0xb1cef6);})['then'](function(_0x2ea722){if(_0x3b82b5[_0x99b0('0x38')]['inlineCss']===_0x99b0('0xc6')){for(var _0x268565=0x0;_0x268565<_0x2ea722[_0x99b0('0x3b')];_0x268565++){_0x2ea722[_0x268565]['body']=juice(_0x2ea722[_0x268565]['body']);}}_0x47b830[_0x99b0('0xb3')]=_0x2ea722;return _0x47b830;});}})[_0x99b0('0x1b')](respondWithFilteredResult(_0x3440f5,_0xb1cef6))[_0x99b0('0x2d')](handleError(_0x3440f5,null));};exports[_0x99b0('0xc7')]=function(_0x40ea41,_0x30fb68){return db['MailInteraction'][_0x99b0('0x60')]({'where':{'id':_0x40ea41['params']['id']}})[_0x99b0('0x1b')](handleEntityNotFound(_0x30fb68,null))['then'](function(_0x33a043){if(_0x33a043){return _0x33a043[_0x99b0('0xc8')](_0x40ea41[_0x99b0('0xbc')][_0x99b0('0xc9')],_[_0x99b0('0xca')](_0x40ea41['body'],[_0x99b0('0xc9'),'id'])||{})[_0x99b0('0xcb')](function(){return db[_0x99b0('0x64')][_0x99b0('0xc5')]({'attributes':['id',_0x99b0('0x1f'),_0x99b0('0xcc')],'where':{'id':_0x40ea41[_0x99b0('0xbc')][_0x99b0('0xc9')]}});})[_0x99b0('0x1b')](function(_0x4392f3){socket[_0x99b0('0xcd')](_0x99b0('0xce'),{'id':Number(_0x40ea41[_0x99b0('0xb5')]['id']),'tags':_0x4392f3||[]});return{'id':Number(_0x40ea41[_0x99b0('0xb5')]['id']),'tags':_0x4392f3||[]};});}})[_0x99b0('0x1b')](respondWithResult(_0x30fb68,null))[_0x99b0('0x2d')](handleError(_0x30fb68,null));};exports['removeTags']=function(_0x15acaa,_0x109c9a){return db[_0x99b0('0xb7')][_0x99b0('0x60')]({'where':{'id':_0x15acaa[_0x99b0('0xb5')]['id']}})[_0x99b0('0x1b')](handleEntityNotFound(_0x109c9a,null))[_0x99b0('0x1b')](function(_0x483965){if(_0x483965){return _0x483965[_0x99b0('0xcf')](_0x15acaa[_0x99b0('0x38')][_0x99b0('0xc9')]);}})[_0x99b0('0x1b')](respondWithStatusCode(_0x109c9a,null))[_0x99b0('0x2d')](handleError(_0x109c9a,null));};exports['download']=function(_0x3b7533,_0x5220bc){var _0x29211f=moment()[_0x99b0('0xd0')]()[_0x99b0('0x92')]();var _0x2675a0=path[_0x99b0('0xd1')](config[_0x99b0('0xd2')],_0x99b0('0xd3'),_0x99b0('0xd4'),_0x99b0('0xd5'));var _0x2be2bd=path[_0x99b0('0xd1')](config[_0x99b0('0xd2')],'server',_0x99b0('0xd4'),_0x99b0('0xd6'));var _0x5cc012=path[_0x99b0('0xd1')](_0x2675a0,_0x29211f);var _0x6dd15b=util['format'](_0x99b0('0xd7'),_0x3b7533[_0x99b0('0xb5')]['id'],_0x29211f);var _0x534c52=path['join'](_0x2675a0,_0x6dd15b);var _0x40bb30=[];if(_0x3b7533[_0x99b0('0x38')][_0x99b0('0xd6')]){_0x40bb30[_0x99b0('0x27')]({'model':db['Attachment'],'as':_0x99b0('0xd8'),'raw':!![]});}var _0x4f585c=[{'model':db[_0x99b0('0x28')],'as':_0x99b0('0xd9'),'attributes':['id',_0x99b0('0xbc'),_0x99b0('0x46'),'to','cc',_0x99b0('0xda'),_0x99b0('0xdb'),_0x99b0('0xdc')],'where':{'secret':![]},'order':qs[_0x99b0('0x3d')]('id'),'include':_0x40bb30}];return db['MailInteraction'][_0x99b0('0x60')]({'where':{'id':_0x3b7533[_0x99b0('0xb5')]['id']},'include':_0x4f585c})[_0x99b0('0x1b')](handleEntityNotFound(_0x5220bc,null))[_0x99b0('0x1b')](function(_0x3510e3){if(_0x3510e3&&_0x3510e3[_0x99b0('0xd9')]){var _0x103075=_0x3510e3[_0x99b0('0xdd')]({'plain':!![]});fs[_0x99b0('0xde')](_0x5cc012);return BPromise[_0x99b0('0xdf')](_0x103075[_0x99b0('0xd9')],function(_0xd3b410,_0x10ac00){var _0x4eaff5={'from':_0xd3b410[_0x99b0('0x46')],'to':_0xd3b410['to'],'subject':_0xd3b410[_0x99b0('0xdb')],'html':htmlEntities[_0x99b0('0xe0')](_0xd3b410[_0x99b0('0xbc')]),'headers':{'Date':moment(_0xd3b410['createdAt'])[_0x99b0('0xc2')](_0x99b0('0xe1'))},'attachments':[]};if(_0xd3b410['cc']){_0x4eaff5[_0x99b0('0xe2')]['Cc']=_0xd3b410['cc'];}if(_0xd3b410[_0x99b0('0xda')]){_0x4eaff5[_0x99b0('0xe2')][_0x99b0('0xe3')]=_0xd3b410['bcc'];}return new BPromise(function(_0x3176e9,_0x5e05cf){if(_0xd3b410[_0x99b0('0xd8')]){for(var _0x276c63=0x0;_0x276c63<_0xd3b410[_0x99b0('0xd8')][_0x99b0('0x3b')];_0x276c63++){var _0xe7d3be=_0xd3b410[_0x99b0('0xd8')][_0x276c63];var _0x5786a4=path[_0x99b0('0xd1')](_0x2be2bd,_0xe7d3be['basename']);if(fs[_0x99b0('0xe4')](_0x5786a4)){_0x4eaff5[_0x99b0('0xd6')]['push']({'name':_0xe7d3be[_0x99b0('0x1f')],'contentType':_0xe7d3be['type'],'data':fs['readFileSync'](_0x5786a4)});}}}emlformat['build'](_0x4eaff5,function(_0xf06c04,_0x5903a9){if(_0xf06c04)return _0x5e05cf(_0xf06c04);fs['writeFileSync'](path[_0x99b0('0xd1')](_0x5cc012,util['format'](_0x99b0('0xe5'),_0x10ac00)),_0x5903a9);return _0x3176e9(_0x5903a9);});});})[_0x99b0('0x1b')](function(){return new BPromise(function(_0x16738e,_0x3f0265){zipdir(_0x5cc012,{'saveTo':_0x534c52},function(_0x36f1be,_0x47d338){if(_0x36f1be)return _0x3f0265(_0x36f1be);return _0x16738e(_0x47d338);});})[_0x99b0('0x1b')](function(){return new BPromise(function(_0x297ca0,_0x2a791b){rimraf(_0x5cc012,function(_0x3b3de7){if(_0x3b3de7)_0x2a791b(_0x3b3de7);return _0x297ca0();});});})[_0x99b0('0x1b')](function(){return _0x5220bc[_0x99b0('0xe6')](_0x534c52,_0x6dd15b,function(_0x5116aa){if(!_0x5116aa)fs[_0x99b0('0xe7')](_0x534c52);});});});}else{return _0x5220bc[_0x99b0('0x11')](0xc8);}})[_0x99b0('0x2d')](handleError(_0x5220bc,null));}; \ No newline at end of file +var _0xc21e=['moment','bluebird','util','path','squel','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','html-entities','redis','defaults','localhost','./mailInteraction.socket','register','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','update','then','destroy','stack','name','send','map','fullname','TagIds','Tags','split','push','MailMessage','findOne','out','plainBody','-id','trimStart','catch','waiting','talking','unmanaged','total','UserId','closed','index','rawAttributes','fieldName','type','key','query','keys','intersection','fields','attributes','model','hasOwnProperty','nolimit','order','sort','where','filters','select','field','color','from','tools_tags','u.id','ui.MailInteractionId','u.id\x20=\x20ui.UserId','mail_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','length','conditions','unreadMessages','value','having','`\x20=\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','find','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','compact','isEmpty','concat','createdAt','$gte','$lte','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','forEach','contactName','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','toString','keyBy','merge','MailInteraction','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.lastMsgDirection','i.disposition','i.secondDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.mobile','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.MailInteractionId\x20IN\x20?','MailInteractionId','enableEmailPreview','all','rows','includeAll','create','body','params','addMessage','ids','omit','pick','format','include','findAll','inlineCss','addTags','setTags','spread','emit','removeTags','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachments','bcc','subject','Messages','get','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','existsSync','readFileSync','writeFileSync','message%d.eml','download','unlinkSync','rimraf','zip-dir'];(function(_0x339129,_0x86dcc6){var _0x1570df=function(_0x3b537e){while(--_0x3b537e){_0x339129['push'](_0x339129['shift']());}};_0x1570df(++_0x86dcc6);}(_0xc21e,0x1ca));var _0xec21=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xc21e[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xec21('0x0'));var zipdir=require(_0xec21('0x1'));var moment=require(_0xec21('0x2'));var BPromise=require(_0xec21('0x3'));var util=require(_0xec21('0x4'));var path=require(_0xec21('0x5'));var fs=require('fs');var _=require('lodash');var squel=require(_0xec21('0x6'));var juice=require(_0xec21('0x7'));var Redis=require(_0xec21('0x8'));var qs=require(_0xec21('0x9'));var as=require(_0xec21('0xa'));var logger=require(_0xec21('0xb'))(_0xec21('0xc'));var config=require(_0xec21('0xd'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0xec21('0xe'));config[_0xec21('0xf')]=_[_0xec21('0x10')](config[_0xec21('0xf')],{'host':_0xec21('0x11'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xec21('0xf')]));require(_0xec21('0x12'))[_0xec21('0x13')](socket);function respondWithStatusCode(_0x4d13f0,_0x5f059d){_0x5f059d=_0x5f059d||0xcc;return function(_0x35d669){if(_0x35d669){return _0x4d13f0[_0xec21('0x14')](_0x5f059d);}return _0x4d13f0['status'](_0x5f059d)[_0xec21('0x15')]();};}function respondWithResult(_0x2efc12,_0xd9232e){_0xd9232e=_0xd9232e||0xc8;return function(_0x3a6e6a){if(_0x3a6e6a){return _0x2efc12[_0xec21('0x16')](_0xd9232e)['json'](_0x3a6e6a);}};}function respondWithFilteredResult(_0x179b89,_0x55e74e){return function(_0x3ea83f){if(_0x3ea83f){var _0x1987f4=typeof _0x55e74e[_0xec21('0x17')]==='undefined'&&typeof _0x55e74e[_0xec21('0x18')]===_0xec21('0x19');var _0x3838c3=_0x3ea83f[_0xec21('0x1a')];var _0x324853=_0x1987f4?0x0:_0x55e74e[_0xec21('0x17')];var _0x3e538c=_0x1987f4?_0x3ea83f[_0xec21('0x1a')]:_0x55e74e['offset']+_0x55e74e[_0xec21('0x18')];var _0x2f805b;if(_0x3e538c>=_0x3838c3){_0x3e538c=_0x3838c3;_0x2f805b=0xc8;}else{_0x2f805b=0xce;}_0x179b89[_0xec21('0x16')](_0x2f805b);return _0x179b89[_0xec21('0x1b')](_0xec21('0x1c'),_0x324853+'-'+_0x3e538c+'/'+_0x3838c3)[_0xec21('0x1d')](_0x3ea83f);}return null;};}function saveUpdates(_0x90c3f5){return function(_0x2aff55){if(_0x2aff55){return _0x2aff55[_0xec21('0x1e')](_0x90c3f5)[_0xec21('0x1f')](function(_0x4f4b12){return _0x4f4b12;});}return null;};}function removeEntity(_0x4c244b){return function(_0x127afa){if(_0x127afa){return _0x127afa[_0xec21('0x20')]()['then'](function(){_0x4c244b['status'](0xcc)[_0xec21('0x15')]();});}};}function handleEntityNotFound(_0xa3d694){return function(_0x2235bd){if(!_0x2235bd){_0xa3d694['sendStatus'](0x194);}return _0x2235bd;};}function handleError(_0x17d1ac,_0x1f86d2){_0x1f86d2=_0x1f86d2||0x1f4;return function(_0x139309){logger['error'](_0x139309[_0xec21('0x21')]);if(_0x139309[_0xec21('0x22')]){delete _0x139309[_0xec21('0x22')];}_0x17d1ac[_0xec21('0x16')](_0x1f86d2)[_0xec21('0x23')](_0x139309);};}function getInteractionUsers(_0x29ac7,_0x5692b0){return new BPromise(function(_0x3563dc,_0x26cdae){try{if(_0x5692b0[_0x29ac7['id']]){_0x29ac7['Users']=_[_0xec21('0x24')](_0x5692b0[_0x29ac7['id']],function(_0x5bfe85){return{'id':_0x5bfe85['id'],'fullname':_0x5bfe85[_0xec21('0x25')]};});}}catch(_0x49fd27){_0x26cdae(_0x49fd27);}_0x3563dc(_0x29ac7);});}function getInteractionTags(_0x4ef840,_0x1f398f){return new BPromise(function(_0x199974,_0x39154a){try{if(_0x4ef840[_0xec21('0x26')]){_0x4ef840[_0xec21('0x27')]=[];_0x4ef840['TagIds'][_0xec21('0x28')](',')['forEach'](function(_0x343f4f){_0x4ef840[_0xec21('0x27')][_0xec21('0x29')](_0x1f398f[_0x343f4f]);});}delete _0x4ef840[_0xec21('0x26')];}catch(_0x4dd56b){_0x39154a(_0x4dd56b);}_0x199974(_0x4ef840);});}function getLastMessageText(_0x1eb6de){return new BPromise(function(_0x1a7ea2,_0x215f14){return db[_0xec21('0x2a')][_0xec21('0x2b')]({'where':{'$and':[{'MailInteractionId':_0x1eb6de['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xec21('0x2c')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xec21('0x2d')],'order':_0xec21('0x2e'),'raw':!![]})[_0xec21('0x1f')](function(_0x1bfc3c){if(_0x1bfc3c&&_0x1bfc3c[_0xec21('0x2d')]){_0x1eb6de['lastMsgText']=_[_0xec21('0x2f')](_0x1bfc3c[_0xec21('0x2d')]);}_0x1a7ea2(_0x1eb6de);})[_0xec21('0x30')](function(_0x3b099f){_0x215f14(_0x3b099f);});});}function updateMailInteraction(_0x4742ee,_0x5d1f9d,_0x4323cf,_0x5dfc34){return new BPromise(function(_0x528061,_0x5269c3){return getInteractionUsers(_0x4742ee,_0x4323cf)[_0xec21('0x1f')](function(_0x374f62){return getInteractionTags(_0x374f62,_0x5d1f9d);})[_0xec21('0x1f')](function(_0x12fbf2){return getStateInteraction(_0x12fbf2);})[_0xec21('0x1f')](function(_0x1ce6ca){if(_0x5dfc34){_0x528061(getLastMessageText(_0x1ce6ca));}else{_0x528061(_0x1ce6ca);}})[_0xec21('0x30')](function(_0xf45c9b){_0x5269c3(_0xf45c9b);});});}function getStateInteraction(_0xaac2cc){return new BPromise(function(_0x1a7586){_0xaac2cc[_0xec21('0x31')]=0x0;_0xaac2cc[_0xec21('0x32')]=0x0;_0xaac2cc['answered']=0x0;_0xaac2cc[_0xec21('0x33')]=0x0;_0xaac2cc[_0xec21('0x34')]=0x0;if(!_0xaac2cc['closed']&&!_0xaac2cc[_0xec21('0x35')]){_0xaac2cc['waiting']+=0x1;}if(!_0xaac2cc['closed']&&_0xaac2cc[_0xec21('0x35')]){_0xaac2cc['talking']+=0x1;if(_0xaac2cc[_0xec21('0x31')]){_0xaac2cc['waiting']-=0x1;}}if(_0xaac2cc[_0xec21('0x36')]&&_0xaac2cc[_0xec21('0x35')]){_0xaac2cc['answered']+=0x1;if(_0xaac2cc[_0xec21('0x32')]){_0xaac2cc[_0xec21('0x32')]-=0x1;}}if(_0xaac2cc[_0xec21('0x36')]&&!_0xaac2cc['UserId']){_0xaac2cc[_0xec21('0x33')]+=0x1;if(_0xaac2cc[_0xec21('0x31')]){_0xaac2cc[_0xec21('0x31')]-=0x1;}}_0xaac2cc['total']+=0x1;_0x1a7586(_0xaac2cc);});}exports[_0xec21('0x37')]=function(_0x2cf43b,_0x14a42b){var _0x154b8b={},_0x14cd36={},_0x49b429={'count':0x0,'rows':[]};var _0x28558f=_[_0xec21('0x24')](db['MailInteraction'][_0xec21('0x38')],function(_0x54e642){return{'name':_0x54e642[_0xec21('0x39')],'type':_0x54e642[_0xec21('0x3a')][_0xec21('0x3b')]};});_0x14cd36['model']=_[_0xec21('0x24')](_0x28558f,_0xec21('0x22'));_0x14cd36[_0xec21('0x3c')]=_[_0xec21('0x3d')](_0x2cf43b['query']);_0x14cd36['filters']=_[_0xec21('0x3e')](_0x14cd36['model'],_0x14cd36[_0xec21('0x3c')]);_0x154b8b['attributes']=_[_0xec21('0x3e')](_0x14cd36['model'],qs[_0xec21('0x3f')](_0x2cf43b[_0xec21('0x3c')]['fields']));_0x154b8b[_0xec21('0x40')]=_0x154b8b[_0xec21('0x40')]['length']?_0x154b8b[_0xec21('0x40')]:_0x14cd36[_0xec21('0x41')];if(!_0x2cf43b[_0xec21('0x3c')][_0xec21('0x42')](_0xec21('0x43'))){_0x154b8b[_0xec21('0x18')]=qs[_0xec21('0x18')](_0x2cf43b[_0xec21('0x3c')][_0xec21('0x18')]);_0x154b8b['offset']=qs['offset'](_0x2cf43b[_0xec21('0x3c')][_0xec21('0x17')]);}_0x154b8b[_0xec21('0x44')]=qs['sort'](_0x2cf43b[_0xec21('0x3c')][_0xec21('0x45')]);_0x154b8b[_0xec21('0x46')]=qs['filters'](_['pick'](_0x2cf43b['query'],_0x14cd36[_0xec21('0x47')]),_0x28558f);var _0x1b518a=[];var _0x276e70=squel[_0xec21('0x48')]()[_0xec21('0x49')]('id')[_0xec21('0x49')](_0xec21('0x22'))['field'](_0xec21('0x4a'))[_0xec21('0x4b')](_0xec21('0x4c'));var _0x14a346=squel[_0xec21('0x48')]()[_0xec21('0x49')](_0xec21('0x4d'))[_0xec21('0x49')]('u.fullname')[_0xec21('0x49')](_0xec21('0x4e'))[_0xec21('0x4b')]('user_has_mail_interactions','ui')['left_join']('users','u',_0xec21('0x4f'));var _0x1bf6a3=squel['select']()[_0xec21('0x4b')](_0xec21('0x50'),'i')[_0xec21('0x51')]('cm_contacts','c',_0xec21('0x52'))['left_join'](_0xec21('0x53'),'o','o.id\x20=\x20i.UserId')[_0xec21('0x51')](_0xec21('0x54'),'a',_0xec21('0x55'))[_0xec21('0x51')](_0xec21('0x56'),'me','me.MailInteractionId\x20=\x20i.id')[_0xec21('0x51')]('mail_interaction_has_tags','it',_0xec21('0x57'))['left_join'](_0xec21('0x4c'),'t',_0xec21('0x58'));var _0x77a177=squel[_0xec21('0x59')]();var _0x37c44c=[];var _0x32e3e9=squel['expr']();var _0x23ea8b;if(_0x2cf43b[_0xec21('0x3c')][_0xec21('0x5a')]){_0x23ea8b=as[_0xec21('0x5b')](_0x2cf43b['query'][_0xec21('0x5a')]);var _0x1813b6=_0x23ea8b[_0xec21('0x5c')];for(var _0x4fd819=0x0;_0x4fd819<_0x23ea8b['conditions'][_0xec21('0x5d')];_0x4fd819++){var _0x547111=_0x23ea8b[_0xec21('0x5e')][_0x4fd819];var _0x74ce7c='i';var _0x50a471=_['find'](_0x28558f,[_0xec21('0x22'),_0x547111[_0xec21('0x49')]]);if(!_0x50a471){switch(_0x547111[_0xec21('0x49')]){case _0xec21('0x5f'):if(_0x547111[_0xec21('0x60')]==0x1){_0x1bf6a3[_0xec21('0x61')]('`'+_0x547111[_0xec21('0x49')]+_0xec21('0x62'));}else{_0x1bf6a3['having']('`'+_0x547111[_0xec21('0x49')]+'`\x20>\x200');}break;case _0xec21('0x63'):if(_0x547111['operator']===_0xec21('0x64')){if(_0x547111[_0xec21('0x60')][_0xec21('0x28')]('\x20')[_0xec21('0x5d')]>0x1){_0x77a177[_0x1813b6](_0xec21('0x65'),qs['getFullTextValue'](_0x547111['value']),null);}else{var _0x49cd02='%'+_0x547111[_0xec21('0x60')]+'%';_0x77a177[_0x1813b6]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x49cd02,_0x49cd02,_0x49cd02);}}else{_0x50a471=_[_0xec21('0x66')](_0x28558f,[_0xec21('0x22'),_0xec21('0x67')]);_0x547111[_0xec21('0x49')]=_0xec21('0x67');_0x169ce9=as[_0xec21('0x68')](_0x74ce7c,_0x50a471[_0xec21('0x3a')],_0x547111);_0x77a177[_0x1813b6](_0x169ce9[_0xec21('0x69')],_0x169ce9[_0xec21('0x60')]['start'],_0x169ce9[_0xec21('0x60')]['end']);}break;case _0xec21('0x6a'):var _0x235ab4=_0x547111[_0xec21('0x60')]['split'](',')['map'](function(_0x286d4b){return Number(_0x286d4b);});_0x235ab4['forEach'](function(_0x52fe2c){_0x32e3e9['or'](_0xec21('0x6b'),'%,'+_0x52fe2c+',%');});_0x37c44c=_[_0xec21('0x6c')](_0x37c44c,_0x235ab4);break;case _0xec21('0x6d'):if(_0x547111['operator']===_0xec21('0x64')){_0x77a177[_0x1813b6](_0xec21('0x6e'),'%'+_0x547111[_0xec21('0x60')]+'%',null);}else{_0x50a471=_[_0xec21('0x66')](_0x28558f,[_0xec21('0x22'),_0xec21('0x35')]);_0x547111['field']=_0xec21('0x35');_0x169ce9=as[_0xec21('0x68')](_0x74ce7c,_0x50a471[_0xec21('0x3a')],_0x547111);_0x77a177[_0x1813b6](_0x169ce9[_0xec21('0x69')],_0x169ce9['value']['start'],_0x169ce9['value'][_0xec21('0x15')]);}break;case _0xec21('0x2d'):_0x169ce9=as[_0xec21('0x68')]('me',null,_0x547111);_0x77a177[_0x1813b6](_0x169ce9[_0xec21('0x69')],_0x169ce9[_0xec21('0x60')][_0xec21('0x6f')],_0x169ce9[_0xec21('0x60')][_0xec21('0x15')]);break;}}else{var _0x169ce9=as[_0xec21('0x68')](_0x74ce7c,_0x50a471[_0xec21('0x3a')],_0x547111);_0x77a177[_0x1813b6](_0x169ce9[_0xec21('0x69')],_0x169ce9[_0xec21('0x60')][_0xec21('0x6f')],_0x169ce9[_0xec21('0x60')]['end']);}}}else{var _0x18113b=_(_0x2cf43b[_0xec21('0x3c')])[_0xec21('0x3d')]()[_0xec21('0x24')](function(_0x512588){return _['some'](_0x28558f,[_0xec21('0x22'),_0x512588])?_0x512588:undefined;})[_0xec21('0x70')]()[_0xec21('0x60')]();if(!_[_0xec21('0x71')](_0x18113b)){_0x18113b['forEach'](function(_0x3e4b39){if(_0x3e4b39==='MailAccountId'){_0x1bf6a3[_0xec21('0x46')]('i.MailAccountId\x20IN\x20?',[][_0xec21('0x72')](_0x2cf43b[_0xec21('0x3c')][_0x3e4b39]));}else if(_0x3e4b39===_0xec21('0x73')){var _0x5ed61d=JSON['parse'](_0x2cf43b[_0xec21('0x3c')][_0x3e4b39])[_0xec21('0x74')];var _0x5f1b99=JSON['parse'](_0x2cf43b[_0xec21('0x3c')][_0x3e4b39])[_0xec21('0x75')];_0x1bf6a3['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5ed61d,_0x5f1b99);}else{if(_0x2cf43b[_0xec21('0x3c')][_0x3e4b39]===_0xec21('0x76')){_0x1bf6a3['where']('i.'+_0x3e4b39+_0xec21('0x77'));}else{_0x1bf6a3['where']('i.'+_0x3e4b39+'\x20=\x20?',_0x2cf43b[_0xec21('0x3c')][_0x3e4b39]);}}});}if(_0x2cf43b[_0xec21('0x3c')]['read']){if(_0x2cf43b[_0xec21('0x3c')][_0xec21('0x78')]==0x1){_0x1bf6a3['having'](_0xec21('0x79'));}else{_0x1bf6a3['having']('`unreadMessages`\x20>\x200');}}if(_0x2cf43b[_0xec21('0x3c')][_0xec21('0x7a')]){_0x37c44c=_[_0xec21('0x7b')](_0x2cf43b[_0xec21('0x3c')][_0xec21('0x7a')])?_0x2cf43b[_0xec21('0x3c')][_0xec21('0x7a')]:new Array(_0x2cf43b[_0xec21('0x3c')][_0xec21('0x7a')]);_0x37c44c['forEach'](function(_0x46f1f8){_0x32e3e9['or'](_0xec21('0x6b'),'%,'+_0x46f1f8+',%');});}if(_0x2cf43b['query']['filter']){var _0x2d1f83=_0x2cf43b[_0xec21('0x3c')][_0xec21('0x7c')][_0xec21('0x7d')]('\x5c','\x5c\x5c')[_0xec21('0x7d')](/'/g,'\x27\x27');if(qs[_0xec21('0x7e')](_0x2d1f83)){_0x77a177['or']('i.id\x20LIKE\x20?',_0x2d1f83+'%');}else if(qs[_0xec21('0x7f')](_0x2d1f83)){_0x77a177['or'](_0xec21('0x80'),_0x2d1f83+'%');}else{_0x77a177['or'](_0xec21('0x81'),qs[_0xec21('0x82')](_0x2d1f83))['or'](_0xec21('0x83'),qs[_0xec21('0x82')](_0x2d1f83));}}}_0x1bf6a3[_0xec21('0x46')](_0x77a177);_0x1bf6a3[_0xec21('0x84')](_0xec21('0x85'));var _0xe45274={'type':db[_0xec21('0x86')][_0xec21('0x87')][_0xec21('0x88')],'raw':!![]};var _0x50d547=_0x1bf6a3['clone']();_0x50d547[_0xec21('0x49')]('i.id');_0x50d547[_0xec21('0x49')](_0xec21('0x89'),_0xec21('0x5f'));if(_0x154b8b[_0xec21('0x44')]){_0x154b8b[_0xec21('0x44')][_0xec21('0x8a')](function(_0x1bbc1d){var _0x90381d=_0x1bbc1d[0x0]===_0xec21('0x8b')?_0x1bbc1d[0x0]:'i.'+_0x1bbc1d[0x0];_0x1bf6a3['order'](_0x90381d,_0x1bbc1d[0x1]===_0xec21('0x8c')?![]:!![]);});}if(!_[_0xec21('0x71')](_0x37c44c)){_0x1bf6a3['having'](_0x32e3e9);_0x50d547[_0xec21('0x46')](_0xec21('0x8d'),_0x37c44c);}BPromise[_0xec21('0x8e')]()[_0xec21('0x1f')](function(){if(!_0x23ea8b){if(_0x2cf43b[_0xec21('0x3c')][_0xec21('0x8f')])return;_0x50d547[_0xec21('0x46')](_0xec21('0x90'));_0x1bf6a3[_0xec21('0x46')](_0xec21('0x90'));return;}if(_0x2cf43b[_0xec21('0x91')][_0xec21('0x92')]!==_0xec21('0x93'))return;return _0x2cf43b[_0xec21('0x91')][_0xec21('0x94')]({'attributes':['id'],'raw':!![]})['then'](function(_0x138d1c){if(_[_0xec21('0x71')](_0x138d1c)){_0x50d547[_0xec21('0x46')](_0xec21('0x95'));_0x1bf6a3[_0xec21('0x46')](_0xec21('0x95'));}else{_0x50d547[_0xec21('0x46')]('i.MailAccountId\x20IN\x20?',_[_0xec21('0x24')](_0x138d1c,'id'));_0x1bf6a3[_0xec21('0x46')](_0xec21('0x96'),_[_0xec21('0x24')](_0x138d1c,'id'));}});})['then'](function(){if(_0x2cf43b[_0xec21('0x91')]['role']===_0xec21('0x93')&&!_0x23ea8b&&!_0x2cf43b['query'][_0xec21('0x8f')])return[];return db['sequelize']['query'](_0x50d547[_0xec21('0x97')](),_0xe45274);})[_0xec21('0x1f')](function(_0x402936){_0x49b429[_0xec21('0x1a')]=_0x402936[_0xec21('0x5d')];if(_0x49b429[_0xec21('0x1a')]===0x0)return[];return db['sequelize'][_0xec21('0x3c')](_0x276e70[_0xec21('0x97')](),_0xe45274)['then'](function(_0x4e4a2f){_0x1b518a=_[_0xec21('0x98')](_0x4e4a2f,'id');_0xe45274=_[_0xec21('0x99')](_0xe45274,{'model':db[_0xec21('0x9a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2cf43b['query'][_0xec21('0x3f')]){_0x154b8b[_0xec21('0x40')]['forEach'](function(_0x22aef5){_0x1bf6a3[_0xec21('0x49')]('i.'+_0x22aef5);});}else{_0x1bf6a3[_0xec21('0x49')](_0xec21('0x89'),'unreadMessages');_0x1bf6a3[_0xec21('0x49')](_0xec21('0x9b'),_0xec21('0x9c'));_0x1bf6a3[_0xec21('0x49')](_0xec21('0x9d'),'Account.mandatoryDisposition');_0x1bf6a3['field'](_0xec21('0x9e'),'contactName');_0x1bf6a3[_0xec21('0x49')](_0xec21('0x85'));_0x1bf6a3[_0xec21('0x49')](_0xec21('0x9f'));_0x1bf6a3[_0xec21('0x49')](_0xec21('0xa0'));_0x1bf6a3[_0xec21('0x49')](_0xec21('0xa1'));_0x1bf6a3[_0xec21('0x49')]('i.closedAt');_0x1bf6a3[_0xec21('0x49')](_0xec21('0xa2'));_0x1bf6a3[_0xec21('0x49')](_0xec21('0xa3'));_0x1bf6a3[_0xec21('0x49')](_0xec21('0xa4'));_0x1bf6a3[_0xec21('0x49')]('i.subject');_0x1bf6a3['field'](_0xec21('0xa5'));_0x1bf6a3[_0xec21('0x49')](_0xec21('0xa6'));_0x1bf6a3[_0xec21('0x49')]('i.thirdDisposition');_0x1bf6a3[_0xec21('0x49')](_0xec21('0xa7'));_0x1bf6a3[_0xec21('0x49')](_0xec21('0xa8'));_0x1bf6a3[_0xec21('0x49')](_0xec21('0xa9'));_0x1bf6a3[_0xec21('0x49')](_0xec21('0xaa'));_0x1bf6a3['field'](_0xec21('0xab'));_0x1bf6a3[_0xec21('0x49')](_0xec21('0xac'),_0xec21('0xad'));_0x1bf6a3[_0xec21('0x49')](_0xec21('0xae'),_0xec21('0xaf'));_0x1bf6a3[_0xec21('0x49')](_0xec21('0xb0'),_0xec21('0xb1'));_0x1bf6a3[_0xec21('0x49')](_0xec21('0xb2'),'Contact.phone');_0x1bf6a3['field']('c.mobile',_0xec21('0xb3'));_0x1bf6a3[_0xec21('0x49')]('c.fax',_0xec21('0xb4'));_0x1bf6a3[_0xec21('0x49')](_0xec21('0xb5'),'Owner.fullname');_0x1bf6a3[_0xec21('0x49')](_0xec21('0xb6'),_0xec21('0xb7'));_0x1bf6a3[_0xec21('0x49')](_0xec21('0xb8'),_0xec21('0x26'));}if(_0x154b8b[_0xec21('0x18')])_0x1bf6a3[_0xec21('0x18')](_0x154b8b['limit']);if(_0x154b8b['offset'])_0x1bf6a3[_0xec21('0x17')](_0x154b8b[_0xec21('0x17')]);return db[_0xec21('0xb9')]['query'](_0x1bf6a3[_0xec21('0x97')](),_0xe45274);})['then'](function(_0x2bfd56){if(_0x2bfd56[_0xec21('0x5d')]>0x0)_0x14a346[_0xec21('0x46')](_0xec21('0xba'),_[_0xec21('0x24')](_0x2bfd56,'id'));return db[_0xec21('0xb9')]['query'](_0x14a346[_0xec21('0x97')](),_0xe45274)[_0xec21('0x1f')](function(_0x32294c){var _0x1a43a7=_['groupBy'](_0x32294c,_0xec21('0xbb'));var _0x12b89a=[];return db['Setting'][_0xec21('0x2b')]({'attributes':[_0xec21('0xbc')],'raw':!![]})['then'](function(_0x46c942){var _0x189342=_0x46c942[_0xec21('0xbc')];_0x2bfd56[_0xec21('0x8a')](function(_0x38fc39){_0x12b89a['push'](updateMailInteraction(_0x38fc39,_0x1b518a,_0x1a43a7,_0x189342));});return BPromise[_0xec21('0xbd')](_0x12b89a);});});});})[_0xec21('0x1f')](function(_0x49fc61){_0x49b429[_0xec21('0xbe')]=_0x49fc61;return _0x49b429;})['then'](respondWithFilteredResult(_0x14a42b,_0x154b8b))[_0xec21('0x30')](handleError(_0x14a42b,null));};exports['show']=function(_0xdc8c59,_0x5e9356){var _0x3ab583={'raw':![],'where':{'id':_0xdc8c59['params']['id']}},_0x4bb1ba={};_0x4bb1ba[_0xec21('0x41')]=_['keys'](db[_0xec21('0x9a')]['rawAttributes']);_0x4bb1ba[_0xec21('0x3c')]=_['keys'](_0xdc8c59[_0xec21('0x3c')]);_0x4bb1ba[_0xec21('0x47')]=_[_0xec21('0x3e')](_0x4bb1ba[_0xec21('0x41')],_0x4bb1ba['query']);_0x3ab583[_0xec21('0x40')]=_['intersection'](_0x4bb1ba['model'],qs['fields'](_0xdc8c59['query']['fields']));_0x3ab583[_0xec21('0x40')]=_0x3ab583[_0xec21('0x40')]['length']?_0x3ab583[_0xec21('0x40')]:_0x4bb1ba[_0xec21('0x41')];if(_0xdc8c59[_0xec21('0x3c')][_0xec21('0xbf')]){_0x3ab583['include']=[{'all':!![]}];}_0x3ab583=_[_0xec21('0x99')]({},_0x3ab583,_0xdc8c59['options']);return db['MailInteraction'][_0xec21('0x66')](_0x3ab583)[_0xec21('0x1f')](handleEntityNotFound(_0x5e9356,null))['then'](respondWithResult(_0x5e9356,null))[_0xec21('0x30')](handleError(_0x5e9356,null));};exports[_0xec21('0xc0')]=function(_0x401401,_0x4776eb){return db['MailInteraction']['create'](_0x401401[_0xec21('0xc1')],{})[_0xec21('0x1f')](respondWithResult(_0x4776eb,0xc9))[_0xec21('0x30')](handleError(_0x4776eb,null));};exports[_0xec21('0x1e')]=function(_0x5142e9,_0x7112c){if(_0x5142e9[_0xec21('0xc1')]['id']){delete _0x5142e9[_0xec21('0xc1')]['id'];}return db[_0xec21('0x9a')][_0xec21('0x66')]({'where':{'id':_0x5142e9[_0xec21('0xc2')]['id']}})['then'](handleEntityNotFound(_0x7112c,null))[_0xec21('0x1f')](saveUpdates(_0x5142e9[_0xec21('0xc1')],null))[_0xec21('0x1f')](respondWithResult(_0x7112c,null))[_0xec21('0x30')](handleError(_0x7112c,null));};exports[_0xec21('0x20')]=function(_0xf6184f,_0x298610){return db[_0xec21('0x9a')][_0xec21('0x66')]({'where':{'id':_0xf6184f[_0xec21('0xc2')]['id']}})[_0xec21('0x1f')](handleEntityNotFound(_0x298610,null))['then'](removeEntity(_0x298610,null))[_0xec21('0x30')](handleError(_0x298610,null));};exports['describe']=function(_0x2d9528,_0x21167c){return db[_0xec21('0x9a')]['describe']()[_0xec21('0x1f')](respondWithResult(_0x21167c,null))['catch'](handleError(_0x21167c,null));};exports[_0xec21('0xc3')]=function(_0x1a8268,_0x46ada4){return db[_0xec21('0x2a')][_0xec21('0x66')]({'where':{'id':_0x1a8268[_0xec21('0xc2')]['id']}})[_0xec21('0x1f')](handleEntityNotFound(_0x46ada4,null))[_0xec21('0x1f')](function(_0x334b4e){if(_0x334b4e){return _0x334b4e['addMessage'](_0x1a8268[_0xec21('0xc1')][_0xec21('0xc4')],_[_0xec21('0xc5')](_0x1a8268[_0xec21('0xc1')],[_0xec21('0xc4'),'id'])||{});}})['then'](respondWithResult(_0x46ada4,null))[_0xec21('0x30')](handleError(_0x46ada4,null));};exports['getMessages']=function(_0x36ee2e,_0x5af495){var _0x2baa34={'raw':![],'where':{}};var _0x3c1eed={};var _0x534ab7={'count':0x0,'rows':[]};return db[_0xec21('0x9a')][_0xec21('0x2b')]({'where':{'id':_0x36ee2e[_0xec21('0xc2')]['id']}})['then'](handleEntityNotFound(_0x5af495,null))[_0xec21('0x1f')](function(_0x357a60){if(_0x357a60){_0x3c1eed[_0xec21('0x41')]=_[_0xec21('0x3d')](db[_0xec21('0x2a')][_0xec21('0x38')]);_0x3c1eed['query']=_[_0xec21('0x3d')](_0x36ee2e[_0xec21('0x3c')]);_0x3c1eed[_0xec21('0x47')]=_[_0xec21('0x3e')](_0x3c1eed[_0xec21('0x41')],_0x3c1eed[_0xec21('0x3c')]);_0x2baa34['attributes']=_[_0xec21('0x3e')](_0x3c1eed[_0xec21('0x41')],qs[_0xec21('0x3f')](_0x36ee2e[_0xec21('0x3c')][_0xec21('0x3f')]));_0x2baa34[_0xec21('0x40')]=_0x2baa34[_0xec21('0x40')][_0xec21('0x5d')]?_0x2baa34['attributes']:_0x3c1eed['model'];if(!_0x36ee2e[_0xec21('0x3c')][_0xec21('0x42')](_0xec21('0x43'))){_0x2baa34[_0xec21('0x18')]=qs[_0xec21('0x18')](_0x36ee2e[_0xec21('0x3c')][_0xec21('0x18')]);_0x2baa34[_0xec21('0x17')]=qs[_0xec21('0x17')](_0x36ee2e[_0xec21('0x3c')][_0xec21('0x17')]);}_0x2baa34[_0xec21('0x44')]=qs['sort'](_0x36ee2e['query'][_0xec21('0x45')]);_0x2baa34[_0xec21('0x46')]=qs[_0xec21('0x47')](_[_0xec21('0xc6')](_0x36ee2e['query'],_0x3c1eed[_0xec21('0x47')]));_0x2baa34['where'][_0xec21('0xbb')]=_0x357a60['id'];if(_0x36ee2e[_0xec21('0x3c')]['filter']){_0x2baa34[_0xec21('0x46')]=_['merge'](_0x2baa34['where'],{'$or':_['map'](_0x2baa34[_0xec21('0x40')],function(_0x1bd3d1){var _0xffe99a={};_0xffe99a[_0x1bd3d1]={'$like':'%'+_0x36ee2e[_0xec21('0x3c')][_0xec21('0x7c')]+'%'};return _0xffe99a;})});}if(_0x36ee2e['query'][_0xec21('0x74')]){var _0x603f04=_0x36ee2e['query'][_0xec21('0x74')]['split'](',');var _0x1813b0={};_0x1813b0[_0x603f04[0x0]]={'$gte':moment(_0x603f04[0x1])[_0xec21('0xc7')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2baa34[_0xec21('0x46')]=_[_0xec21('0x99')](_0x2baa34['where'],_0x1813b0);}_0x2baa34=_[_0xec21('0x99')]({},_0x2baa34,_0x36ee2e['options']);return db['MailMessage'][_0xec21('0x1a')]({'where':_0x2baa34[_0xec21('0x46')]})['then'](function(_0x48d896){_0x534ab7[_0xec21('0x1a')]=_0x48d896;if(_0x36ee2e[_0xec21('0x3c')][_0xec21('0xbf')]){_0x2baa34[_0xec21('0xc8')]=[{'all':!![]}];}return db['MailMessage'][_0xec21('0xc9')](_0x2baa34);})[_0xec21('0x1f')](function(_0x336ac0){if(_0x36ee2e['query'][_0xec21('0xca')]==='true'){for(var _0xb4b520=0x0;_0xb4b520<_0x336ac0[_0xec21('0x5d')];_0xb4b520++){_0x336ac0[_0xb4b520][_0xec21('0xc1')]=juice(_0x336ac0[_0xb4b520][_0xec21('0xc1')]);}}_0x534ab7[_0xec21('0xbe')]=_0x336ac0;return _0x534ab7;});}})[_0xec21('0x1f')](respondWithFilteredResult(_0x5af495,_0x2baa34))[_0xec21('0x30')](handleError(_0x5af495,null));};exports[_0xec21('0xcb')]=function(_0x35bdd2,_0x588c33){return db['MailInteraction']['find']({'where':{'id':_0x35bdd2[_0xec21('0xc2')]['id']}})[_0xec21('0x1f')](handleEntityNotFound(_0x588c33,null))['then'](function(_0x477b57){if(_0x477b57){return _0x477b57[_0xec21('0xcc')](_0x35bdd2[_0xec21('0xc1')]['ids'],_['omit'](_0x35bdd2['body'],[_0xec21('0xc4'),'id'])||{})[_0xec21('0xcd')](function(){return db[_0xec21('0x6a')][_0xec21('0xc9')]({'attributes':['id',_0xec21('0x22'),_0xec21('0x4a')],'where':{'id':_0x35bdd2['body'][_0xec21('0xc4')]}});})[_0xec21('0x1f')](function(_0x3153a5){socket[_0xec21('0xce')]('mailInteractionTags:save',{'id':Number(_0x35bdd2['params']['id']),'tags':_0x3153a5||[]});return{'id':Number(_0x35bdd2[_0xec21('0xc2')]['id']),'tags':_0x3153a5||[]};});}})[_0xec21('0x1f')](respondWithResult(_0x588c33,null))['catch'](handleError(_0x588c33,null));};exports['removeTags']=function(_0x5af621,_0x225e43){return db[_0xec21('0x9a')]['find']({'where':{'id':_0x5af621[_0xec21('0xc2')]['id']}})[_0xec21('0x1f')](handleEntityNotFound(_0x225e43,null))[_0xec21('0x1f')](function(_0xf3a9c8){if(_0xf3a9c8){return _0xf3a9c8[_0xec21('0xcf')](_0x5af621['query'][_0xec21('0xc4')]);}})['then'](respondWithStatusCode(_0x225e43,null))[_0xec21('0x30')](handleError(_0x225e43,null));};exports['download']=function(_0x2a336e,_0xd83fb3){var _0x118490=moment()['unix']()[_0xec21('0x97')]();var _0x1363b9=path[_0xec21('0xd0')](config[_0xec21('0xd1')],_0xec21('0xd2'),_0xec21('0xd3'),_0xec21('0xd4'));var _0x670c75=path[_0xec21('0xd0')](config[_0xec21('0xd1')],_0xec21('0xd2'),_0xec21('0xd3'),_0xec21('0xd5'));var _0x1cdbbe=path[_0xec21('0xd0')](_0x1363b9,_0x118490);var _0x2a9a2d=util[_0xec21('0xc7')](_0xec21('0xd6'),_0x2a336e[_0xec21('0xc2')]['id'],_0x118490);var _0x175ee7=path['join'](_0x1363b9,_0x2a9a2d);var _0x49a40b=[];if(_0x2a336e['query']['attachments']){_0x49a40b[_0xec21('0x29')]({'model':db['Attachment'],'as':_0xec21('0xd7'),'raw':!![]});}var _0x31df0d=[{'model':db[_0xec21('0x2a')],'as':'Messages','attributes':['id','body','from','to','cc',_0xec21('0xd8'),_0xec21('0xd9'),'createdAt'],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x49a40b}];return db[_0xec21('0x9a')][_0xec21('0x66')]({'where':{'id':_0x2a336e[_0xec21('0xc2')]['id']},'include':_0x31df0d})[_0xec21('0x1f')](handleEntityNotFound(_0xd83fb3,null))[_0xec21('0x1f')](function(_0x436f20){if(_0x436f20&&_0x436f20[_0xec21('0xda')]){var _0x4beef1=_0x436f20[_0xec21('0xdb')]({'plain':!![]});fs[_0xec21('0xdc')](_0x1cdbbe);return BPromise[_0xec21('0xdd')](_0x4beef1['Messages'],function(_0x621e64,_0x3e8031){var _0x1a58d5={'from':_0x621e64[_0xec21('0x4b')],'to':_0x621e64['to'],'subject':_0x621e64[_0xec21('0xd9')],'html':htmlEntities[_0xec21('0xde')](_0x621e64['body']),'headers':{'Date':moment(_0x621e64[_0xec21('0x73')])[_0xec21('0xc7')](_0xec21('0xdf'))},'attachments':[]};if(_0x621e64['cc']){_0x1a58d5['headers']['Cc']=_0x621e64['cc'];}if(_0x621e64['bcc']){_0x1a58d5['headers']['Bcc']=_0x621e64[_0xec21('0xd8')];}return new BPromise(function(_0x13c941,_0x4337e7){if(_0x621e64[_0xec21('0xd7')]){for(var _0x4d7e84=0x0;_0x4d7e84<_0x621e64[_0xec21('0xd7')]['length'];_0x4d7e84++){var _0x17f1c2=_0x621e64[_0xec21('0xd7')][_0x4d7e84];var _0x5e82a3=path[_0xec21('0xd0')](_0x670c75,_0x17f1c2['basename']);if(fs[_0xec21('0xe0')](_0x5e82a3)){_0x1a58d5[_0xec21('0xd5')][_0xec21('0x29')]({'name':_0x17f1c2['name'],'contentType':_0x17f1c2[_0xec21('0x3a')],'data':fs[_0xec21('0xe1')](_0x5e82a3)});}}}emlformat['build'](_0x1a58d5,function(_0x4d6604,_0x23a74d){if(_0x4d6604)return _0x4337e7(_0x4d6604);fs[_0xec21('0xe2')](path[_0xec21('0xd0')](_0x1cdbbe,util['format'](_0xec21('0xe3'),_0x3e8031)),_0x23a74d);return _0x13c941(_0x23a74d);});});})['then'](function(){return new BPromise(function(_0x4aeebd,_0x23a914){zipdir(_0x1cdbbe,{'saveTo':_0x175ee7},function(_0x1814ec,_0x382468){if(_0x1814ec)return _0x23a914(_0x1814ec);return _0x4aeebd(_0x382468);});})[_0xec21('0x1f')](function(){return new BPromise(function(_0x42f3ea,_0x1c702c){rimraf(_0x1cdbbe,function(_0x159e29){if(_0x159e29)_0x1c702c(_0x159e29);return _0x42f3ea();});});})[_0xec21('0x1f')](function(){return _0xd83fb3[_0xec21('0xe4')](_0x175ee7,_0x2a9a2d,function(_0x53457a){if(!_0x53457a)fs[_0xec21('0xe5')](_0x175ee7);});});});}else{return _0xd83fb3['sendStatus'](0xc8);}})['catch'](handleError(_0xd83fb3,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 3b2310b..89a6904 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 _0x27c5=['save','update','remove','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','MailInteraction','../../mysqldb','MailMessage'];(function(_0x21cfe4,_0x5ff11d){var _0x43834d=function(_0x26ec9d){while(--_0x26ec9d){_0x21cfe4['push'](_0x21cfe4['shift']());}};_0x43834d(++_0x5ff11d);}(_0x27c5,0x173));var _0x527c=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0x27c5[_0x556927];return _0x5f1235;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db'][_0x527c('0x0')];var MailMessage=require(_0x527c('0x1'))['db'][_0x527c('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x527c('0x3'),'afterUpdate':_0x527c('0x4'),'afterDestroy':_0x527c('0x5')};function emitEvent(_0x45478a){return function(_0x5164a0,_0x2bb668,_0x37bd95){_0x5164a0['getUsers']({'attributes':['id'],'raw':!![]})[_0x527c('0x6')](function(_0x5a68e8){_0x5164a0[_0x527c('0x7')]('Users',_0x5a68e8[_0x527c('0x8')](function(_0x38f876){return{'id':_0x38f876['id']};}));return MailMessage[_0x527c('0x9')]({'where':{'MailInteractionId':_0x5164a0['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x36be3a){_0x5164a0[_0x527c('0x7')](_0x527c('0xa'),_0x36be3a[_0x527c('0xb')]);MailInteractionEvents[_0x527c('0xc')](_0x45478a+':'+_0x5164a0['id'],_0x5164a0);MailInteractionEvents[_0x527c('0xc')](_0x45478a,_0x5164a0);_0x37bd95(null);})[_0x527c('0xd')](_0x37bd95(null));};}for(var e in events){if(events[_0x527c('0xe')](e)){var event=events[e];MailInteraction[_0x527c('0xf')](e,emitEvent(event));}}module[_0x527c('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0xcffc=['length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','update','getUsers','setDataValue','Users','map','findAll'];(function(_0x151381,_0x97b314){var _0x2afab6=function(_0x4b3941){while(--_0x4b3941){_0x151381['push'](_0x151381['shift']());}};_0x2afab6(++_0x97b314);}(_0xcffc,0x1d1));var _0xccff=function(_0x48de71,_0x41608f){_0x48de71=_0x48de71-0x0;var _0x410151=_0xcffc[_0x48de71];return _0x410151;};'use strict';var EventEmitter=require(_0xccff('0x0'));var MailInteraction=require(_0xccff('0x1'))['db'][_0xccff('0x2')];var MailMessage=require(_0xccff('0x1'))['db'][_0xccff('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xccff('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xccff('0x5'),'afterDestroy':'remove'};function emitEvent(_0x17e9fd){return function(_0x478196,_0x115183,_0x5c5f8c){_0x478196[_0xccff('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x208bbe){_0x478196[_0xccff('0x7')](_0xccff('0x8'),_0x208bbe[_0xccff('0x9')](function(_0x5e3787){return{'id':_0x5e3787['id']};}));return MailMessage[_0xccff('0xa')]({'where':{'MailInteractionId':_0x478196['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4214e9){_0x478196[_0xccff('0x7')]('unreadMessages',_0x4214e9[_0xccff('0xb')]);MailInteractionEvents[_0xccff('0xc')](_0x17e9fd+':'+_0x478196['id'],_0x478196);MailInteractionEvents[_0xccff('0xc')](_0x17e9fd,_0x478196);_0x5c5f8c(null);})[_0xccff('0xd')](_0x5c5f8c(null));};}for(var e in events){if(events[_0xccff('0xe')](e)){var event=events[e];MailInteraction[_0xccff('0xf')](e,emitEvent(event));}}module[_0xccff('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 707af2f..d19b7dd 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 _0x2336=['subject','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','substatus','closedAt','get','MailMessage','then','catch','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x2336,0x160));var _0x6233=function(_0x27fedb,_0x31c693){_0x27fedb=_0x27fedb-0x0;var _0x58ab78=_0x2336[_0x27fedb];return _0x58ab78;};'use strict';var _=require(_0x6233('0x0'));var util=require(_0x6233('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6233('0x2'));var BPromise=require(_0x6233('0x3'));var rp=require(_0x6233('0x4'));var fs=require('fs');var path=require(_0x6233('0x5'));var rimraf=require(_0x6233('0x6'));var config=require('../../config/environment');var attributes=require(_0x6233('0x7'));module[_0x6233('0x8')]=function(_0x36b8ad,_0x3491bd){return _0x36b8ad[_0x6233('0x9')](_0x6233('0xa'),attributes,{'tableName':_0x6233('0xb'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x6233('0xc'),'to'],'type':_0x6233('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x39bf22,_0x4fba5c,_0x560708){if(_0x39bf22['substatus']){_0x39bf22[_0x6233('0xe')]=moment()[_0x6233('0xf')](_0x6233('0x10'));}if(_0x39bf22[_0x6233('0x11')]){_0x39bf22['closedAt']=moment()[_0x6233('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x560708(null,_0x4fba5c);},'beforeUpdate':function(_0x2ae774,_0x402e5a,_0x3638b2){if(_0x2ae774[_0x6233('0x12')](_0x6233('0x13'))){_0x2ae774[_0x6233('0xe')]=_0x2ae774[_0x6233('0x13')]?moment()[_0x6233('0xf')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x2ae774[_0x6233('0x12')]('closed')){_0x2ae774[_0x6233('0x14')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2ae774[_0x6233('0x13')]=null;_0x2ae774[_0x6233('0xe')]=null;}_0x3638b2(null,_0x2ae774);},'afterUpdate':function(_0x5e8fe3,_0x172d05,_0xc36a69){var _0x31e091=_0x36b8ad['models'];var _0xe6b49e=_0x5e8fe3[_0x6233('0x15')]({'plain':!![]});if(_0xe6b49e[_0x6233('0x11')]){return _0x31e091[_0x6233('0x16')]['update']({'read':!![]},{'where':{'MailInteractionId':_0xe6b49e['id']}})[_0x6233('0x17')](function(){_0xc36a69();})[_0x6233('0x18')](function(_0x582544){_0xc36a69(_0x582544);});}else{_0xc36a69();}}},'charset':'utf8mb4','collate':_0x6233('0x19')});}; \ No newline at end of file +var _0xfecb=['define','MailInteraction','fti_mail_interactions','subject','FULLTEXT','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','closed','get','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailInteraction.attributes'];(function(_0x25d0fd,_0x5f1a37){var _0xbcf3e8=function(_0x36b3eb){while(--_0x36b3eb){_0x25d0fd['push'](_0x25d0fd['shift']());}};_0xbcf3e8(++_0x5f1a37);}(_0xfecb,0x155));var _0xbfec=function(_0x44f177,_0x255e9f){_0x44f177=_0x44f177-0x0;var _0x290f94=_0xfecb[_0x44f177];return _0x290f94;};'use strict';var _=require(_0xbfec('0x0'));var util=require('util');var logger=require(_0xbfec('0x1'))(_0xbfec('0x2'));var moment=require(_0xbfec('0x3'));var BPromise=require(_0xbfec('0x4'));var rp=require(_0xbfec('0x5'));var fs=require('fs');var path=require(_0xbfec('0x6'));var rimraf=require('rimraf');var config=require(_0xbfec('0x7'));var attributes=require(_0xbfec('0x8'));module['exports']=function(_0x12fc85,_0x3581fe){return _0x12fc85[_0xbfec('0x9')](_0xbfec('0xa'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0xbfec('0xb'),'fields':[_0xbfec('0xc'),'to'],'type':_0xbfec('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x47923d,_0x5b2025,_0x374c3b){if(_0x47923d[_0xbfec('0xe')]){_0x47923d['substatusAt']=moment()[_0xbfec('0xf')](_0xbfec('0x10'));}if(_0x47923d['closed']){_0x47923d[_0xbfec('0x11')]=moment()['format'](_0xbfec('0x10'));}_0x374c3b(null,_0x5b2025);},'beforeUpdate':function(_0x14c558,_0xa012a4,_0x2117f8){if(_0x14c558[_0xbfec('0x12')](_0xbfec('0xe'))){_0x14c558['substatusAt']=_0x14c558[_0xbfec('0xe')]?moment()[_0xbfec('0xf')](_0xbfec('0x10')):null;}if(_0x14c558[_0xbfec('0x12')](_0xbfec('0x13'))){_0x14c558[_0xbfec('0x11')]=moment()[_0xbfec('0xf')](_0xbfec('0x10'));_0x14c558[_0xbfec('0xe')]=null;_0x14c558['substatusAt']=null;}_0x2117f8(null,_0x14c558);},'afterUpdate':function(_0x144ef9,_0x37bfb2,_0x32d05d){var _0x2d90ce=_0x12fc85['models'];var _0x51f8fb=_0x144ef9[_0xbfec('0x14')]({'plain':!![]});if(_0x51f8fb[_0xbfec('0x13')]){return _0x2d90ce['MailMessage'][_0xbfec('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x51f8fb['id']}})['then'](function(){_0x32d05d();})[_0xbfec('0x16')](function(_0x4170b4){_0x32d05d(_0x4170b4);});}else{_0x32d05d();}}},'charset':_0xbfec('0x17'),'collate':_0xbfec('0x18')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 8210ad8..c776cb4 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 _0x0810=['update','body','options','raw','where','attributes','debug','AddTagsToMailInteraction','ids','AddTags','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./mailInteraction.socket','then','info','request\x20sent','stringify','error','MailInteraction,\x20%s,\x20%s','message','result','catch','UpdateMailInteraction','MailInteraction'];(function(_0x3ddbcc,_0x54be6b){var _0x381b48=function(_0x467e7d){while(--_0x467e7d){_0x3ddbcc['push'](_0x3ddbcc['shift']());}};_0x381b48(++_0x54be6b);}(_0x0810,0x1e6));var _0x0081=function(_0x51c0f1,_0x41cc0f){_0x51c0f1=_0x51c0f1-0x0;var _0x5134b1=_0x0810[_0x51c0f1];return _0x5134b1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0081('0x0'));var BPromise=require('bluebird');var rs=require(_0x0081('0x1'));var fs=require('fs');var Redis=require(_0x0081('0x2'));var db=require(_0x0081('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0081('0x4'))(_0x0081('0x5'));var config=require(_0x0081('0x6'));var jayson=require(_0x0081('0x7'));var client=jayson[_0x0081('0x8')][_0x0081('0x9')]({'port':0x232a});config[_0x0081('0xa')]=_[_0x0081('0xb')](config[_0x0081('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0081('0xc'))['register'](socket);function respondWithRpcPromise(_0xc05d42,_0x5f171e,_0x2fe57d){return new BPromise(function(_0x752491,_0x3e6229){return client['request'](_0xc05d42,_0x2fe57d)[_0x0081('0xd')](function(_0x4610a7){logger[_0x0081('0xe')]('MailInteraction,\x20%s,\x20%s',_0x5f171e,_0x0081('0xf'));logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x5f171e,'request\x20sent',JSON[_0x0081('0x10')](_0x4610a7));if(_0x4610a7[_0x0081('0x11')]){if(_0x4610a7['error']['code']===0x1f4){logger[_0x0081('0x11')](_0x0081('0x12'),_0x5f171e,_0x4610a7[_0x0081('0x11')]['message']);return _0x3e6229(_0x4610a7[_0x0081('0x11')]['message']);}logger[_0x0081('0x11')](_0x0081('0x12'),_0x5f171e,_0x4610a7['error']['message']);return _0x752491(_0x4610a7[_0x0081('0x11')][_0x0081('0x13')]);}else{logger[_0x0081('0xe')](_0x0081('0x12'),_0x5f171e,_0x0081('0xf'));_0x752491(_0x4610a7[_0x0081('0x14')][_0x0081('0x13')]);}})[_0x0081('0x15')](function(_0x100564){logger['error']('MailInteraction,\x20%s,\x20%s',_0x5f171e,_0x100564);_0x3e6229(_0x100564);});});}exports[_0x0081('0x16')]=function(_0xeff3d){var _0x1a6732=this;return new Promise(function(_0x2ffaf2,_0x78abe5){return db[_0x0081('0x17')][_0x0081('0x18')](_0xeff3d[_0x0081('0x19')],{'raw':_0xeff3d[_0x0081('0x1a')]?_0xeff3d[_0x0081('0x1a')][_0x0081('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xeff3d[_0x0081('0x1a')]?_0xeff3d['options'][_0x0081('0x1c')]||null:null,'attributes':_0xeff3d['options']?_0xeff3d[_0x0081('0x1a')][_0x0081('0x1d')]||null:null,'limit':_0xeff3d['options']?_0xeff3d[_0x0081('0x1a')]['limit']||null:null})[_0x0081('0xd')](function(_0x29fbc4){logger['info']('UpdateMailInteraction',_0xeff3d);logger[_0x0081('0x1e')](_0x0081('0x16'),_0xeff3d,JSON[_0x0081('0x10')](_0x29fbc4));_0x2ffaf2(_0x29fbc4);})[_0x0081('0x15')](function(_0x2d6a54){logger[_0x0081('0x11')](_0x0081('0x16'),_0x2d6a54[_0x0081('0x13')],_0xeff3d);_0x78abe5(_0x1a6732[_0x0081('0x11')](0x1f4,_0x2d6a54[_0x0081('0x13')]));});});};exports[_0x0081('0x1f')]=function(_0x3c2758){return new Promise(function(_0xc278f9,_0x19ec78){return db[_0x0081('0x17')]['find']({'where':_0x3c2758[_0x0081('0x1a')]?_0x3c2758[_0x0081('0x1a')][_0x0081('0x1c')]||null:null})['then'](function(_0xc5edbd){if(_0xc5edbd){return _0xc5edbd['addTags'](_0x3c2758[_0x0081('0x19')][_0x0081('0x20')],_['omit'](_0x3c2758[_0x0081('0x19')],[_0x0081('0x20'),'id'])||{});}})['spread'](function(_0x34c2dc){logger[_0x0081('0xe')](_0x0081('0x21'),_0x3c2758);logger[_0x0081('0x1e')]('AddTags',_0x3c2758,JSON['stringify'](_0x34c2dc));_0xc278f9(_0x34c2dc);})[_0x0081('0x15')](function(_0x51f912){logger[_0x0081('0x11')](_0x0081('0x21'),_0x51f912[_0x0081('0x13')],_0x3c2758);_0x19ec78(_this[_0x0081('0x11')](0x1f4,_0x51f912[_0x0081('0x13')]));});});}; \ No newline at end of file +var _0x2b47=['redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailInteraction','body','options','attributes','limit','UpdateMailInteraction','AddTagsToMailInteraction','find','where','addTags','omit','spread','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults'];(function(_0x56a286,_0x1c8a66){var _0x8ff478=function(_0x38ff9b){while(--_0x38ff9b){_0x56a286['push'](_0x56a286['shift']());}};_0x8ff478(++_0x1c8a66);}(_0x2b47,0x177));var _0x72b4=function(_0x18b160,_0x39412e){_0x18b160=_0x18b160-0x0;var _0x58486e=_0x2b47[_0x18b160];return _0x58486e;};'use strict';var _=require(_0x72b4('0x0'));var util=require('util');var moment=require(_0x72b4('0x1'));var BPromise=require(_0x72b4('0x2'));var rs=require(_0x72b4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72b4('0x4'))['db'];var utils=require(_0x72b4('0x5'));var logger=require(_0x72b4('0x6'))(_0x72b4('0x7'));var config=require(_0x72b4('0x8'));var jayson=require(_0x72b4('0x9'));var client=jayson['client'][_0x72b4('0xa')]({'port':0x232a});config['redis']=_[_0x72b4('0xb')](config[_0x72b4('0xc')],{'host':_0x72b4('0xd'),'port':0x18eb});var socket=require(_0x72b4('0xe'))(new Redis(config[_0x72b4('0xc')]));require(_0x72b4('0xf'))[_0x72b4('0x10')](socket);function respondWithRpcPromise(_0x165537,_0x3d2504,_0x438e61){return new BPromise(function(_0x26d199,_0x4dee4e){return client[_0x72b4('0x11')](_0x165537,_0x438e61)[_0x72b4('0x12')](function(_0x2c1fc0){logger[_0x72b4('0x13')](_0x72b4('0x14'),_0x3d2504,_0x72b4('0x15'));logger[_0x72b4('0x16')](_0x72b4('0x17'),_0x3d2504,_0x72b4('0x15'),JSON[_0x72b4('0x18')](_0x2c1fc0));if(_0x2c1fc0[_0x72b4('0x19')]){if(_0x2c1fc0['error'][_0x72b4('0x1a')]===0x1f4){logger[_0x72b4('0x19')](_0x72b4('0x14'),_0x3d2504,_0x2c1fc0[_0x72b4('0x19')]['message']);return _0x4dee4e(_0x2c1fc0['error'][_0x72b4('0x1b')]);}logger['error'](_0x72b4('0x14'),_0x3d2504,_0x2c1fc0[_0x72b4('0x19')]['message']);return _0x26d199(_0x2c1fc0[_0x72b4('0x19')][_0x72b4('0x1b')]);}else{logger[_0x72b4('0x13')](_0x72b4('0x14'),_0x3d2504,_0x72b4('0x15'));_0x26d199(_0x2c1fc0[_0x72b4('0x1c')][_0x72b4('0x1b')]);}})[_0x72b4('0x1d')](function(_0x1a1543){logger['error'](_0x72b4('0x14'),_0x3d2504,_0x1a1543);_0x4dee4e(_0x1a1543);});});}exports['UpdateMailInteraction']=function(_0x22dab0){var _0x161e90=this;return new Promise(function(_0x518fda,_0x13d8d1){return db[_0x72b4('0x1e')]['update'](_0x22dab0[_0x72b4('0x1f')],{'raw':_0x22dab0['options']?_0x22dab0[_0x72b4('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22dab0['options']?_0x22dab0[_0x72b4('0x20')]['where']||null:null,'attributes':_0x22dab0[_0x72b4('0x20')]?_0x22dab0[_0x72b4('0x20')][_0x72b4('0x21')]||null:null,'limit':_0x22dab0['options']?_0x22dab0[_0x72b4('0x20')][_0x72b4('0x22')]||null:null})[_0x72b4('0x12')](function(_0x48f8e0){logger[_0x72b4('0x13')](_0x72b4('0x23'),_0x22dab0);logger[_0x72b4('0x16')](_0x72b4('0x23'),_0x22dab0,JSON[_0x72b4('0x18')](_0x48f8e0));_0x518fda(_0x48f8e0);})[_0x72b4('0x1d')](function(_0x245ed0){logger['error'](_0x72b4('0x23'),_0x245ed0['message'],_0x22dab0);_0x13d8d1(_0x161e90[_0x72b4('0x19')](0x1f4,_0x245ed0[_0x72b4('0x1b')]));});});};exports[_0x72b4('0x24')]=function(_0x464a4d){return new Promise(function(_0x4785b9,_0x3c7167){return db['MailInteraction'][_0x72b4('0x25')]({'where':_0x464a4d[_0x72b4('0x20')]?_0x464a4d[_0x72b4('0x20')][_0x72b4('0x26')]||null:null})[_0x72b4('0x12')](function(_0x155198){if(_0x155198){return _0x155198[_0x72b4('0x27')](_0x464a4d[_0x72b4('0x1f')]['ids'],_[_0x72b4('0x28')](_0x464a4d[_0x72b4('0x1f')],['ids','id'])||{});}})[_0x72b4('0x29')](function(_0x2c5d1a){logger[_0x72b4('0x13')](_0x72b4('0x2a'),_0x464a4d);logger[_0x72b4('0x16')](_0x72b4('0x2a'),_0x464a4d,JSON[_0x72b4('0x18')](_0x2c5d1a));_0x4785b9(_0x2c5d1a);})[_0x72b4('0x1d')](function(_0x29ecd7){logger[_0x72b4('0x19')](_0x72b4('0x2a'),_0x29ecd7[_0x72b4('0x1b')],_0x464a4d);_0x3c7167(_this[_0x72b4('0x19')](0x1f4,_0x29ecd7[_0x72b4('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index d9efa56..07aa4ce 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 _0x417e=['length','mailInteraction:','./mailInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x15dbca,_0x1d7c3c){var _0x326533=function(_0x507ee2){while(--_0x507ee2){_0x15dbca['push'](_0x15dbca['shift']());}};_0x326533(++_0x1d7c3c);}(_0x417e,0x134));var _0xe417=function(_0x118139,_0x7ce965){_0x118139=_0x118139-0x0;var _0x2fece9=_0x417e[_0x118139];return _0x2fece9;};'use strict';var MailInteractionEvents=require(_0xe417('0x0'));var events=[_0xe417('0x1'),_0xe417('0x2'),_0xe417('0x3')];function createListener(_0x525b2c,_0x158b81){return function(_0x1d5ee2){_0x158b81[_0xe417('0x4')](_0x525b2c,_0x1d5ee2);};}function removeListener(_0x3d5e7f,_0x562f00){return function(){MailInteractionEvents[_0xe417('0x5')](_0x3d5e7f,_0x562f00);};}exports[_0xe417('0x6')]=function(_0x2876bf){for(var _0x2b0d29=0x0,_0x15b745=events[_0xe417('0x7')];_0x2b0d29<_0x15b745;_0x2b0d29++){var _0x4af204=events[_0x2b0d29];var _0x128867=createListener(_0xe417('0x8')+_0x4af204,_0x2876bf);MailInteractionEvents['on'](_0x4af204,_0x128867);}}; \ No newline at end of file +var _0xac62=['./mailInteraction.events','save','remove','update','removeListener','register','length'];(function(_0x22fac2,_0xca7153){var _0x323e2b=function(_0x43e907){while(--_0x43e907){_0x22fac2['push'](_0x22fac2['shift']());}};_0x323e2b(++_0xca7153);}(_0xac62,0xbd));var _0x2ac6=function(_0x273422,_0x11abe1){_0x273422=_0x273422-0x0;var _0x144440=_0xac62[_0x273422];return _0x144440;};'use strict';var MailInteractionEvents=require(_0x2ac6('0x0'));var events=[_0x2ac6('0x1'),_0x2ac6('0x2'),_0x2ac6('0x3')];function createListener(_0x5e321e,_0x432544){return function(_0x487a21){_0x432544['emit'](_0x5e321e,_0x487a21);};}function removeListener(_0xa258ff,_0x2d4ecb){return function(){MailInteractionEvents[_0x2ac6('0x4')](_0xa258ff,_0x2d4ecb);};}exports[_0x2ac6('0x5')]=function(_0x11ffe5){for(var _0x5b59f6=0x0,_0x20a8c2=events[_0x2ac6('0x6')];_0x5b59f6<_0x20a8c2;_0x5b59f6++){var _0x3a3de7=events[_0x5b59f6];var _0x42dc39=createListener('mailInteraction:'+_0x3a3de7,_0x11ffe5);MailInteractionEvents['on'](_0x3a3de7,_0x42dc39);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 1a56a12..f1e6d46 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 _0xb5f8=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./mailMessage.controller','isAuthenticated','index','describe','get','/:id','/:id/download','post','tracked','mail','mailmessage:create','create','put','update','accept','reject','delete','destroy'];(function(_0x2796b2,_0x35c20b){var _0x10f065=function(_0x36f182){while(--_0x36f182){_0x2796b2['push'](_0x2796b2['shift']());}};_0x10f065(++_0x35c20b);}(_0xb5f8,0x88));var _0x8b5f=function(_0x28ab1e,_0x2de7fd){_0x28ab1e=_0x28ab1e-0x0;var _0xdda130=_0xb5f8[_0x28ab1e];return _0xdda130;};'use strict';var multer=require(_0x8b5f('0x0'));var util=require(_0x8b5f('0x1'));var path=require(_0x8b5f('0x2'));var timeout=require(_0x8b5f('0x3'));var express=require(_0x8b5f('0x4'));var router=express['Router']();var fs_extra=require(_0x8b5f('0x5'));var auth=require(_0x8b5f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8b5f('0x7'));var controller=require(_0x8b5f('0x8'));router['get']('/',auth[_0x8b5f('0x9')](),controller[_0x8b5f('0xa')]);router['get']('/describe',auth[_0x8b5f('0x9')](),controller[_0x8b5f('0xb')]);router[_0x8b5f('0xc')](_0x8b5f('0xd'),auth[_0x8b5f('0x9')](),controller['show']);router[_0x8b5f('0xc')](_0x8b5f('0xe'),auth[_0x8b5f('0x9')](),controller['download']);router[_0x8b5f('0xf')]('/',auth[_0x8b5f('0x9')](),interaction[_0x8b5f('0x10')](_0x8b5f('0x11'),_0x8b5f('0x12')),controller[_0x8b5f('0x13')]);router[_0x8b5f('0x14')](_0x8b5f('0xd'),auth[_0x8b5f('0x9')](),controller[_0x8b5f('0x15')]);router[_0x8b5f('0x14')]('/:id/accept',auth[_0x8b5f('0x9')](),controller[_0x8b5f('0x16')]);router['put']('/:id/reject',auth[_0x8b5f('0x9')](),controller[_0x8b5f('0x17')]);router[_0x8b5f('0x18')](_0x8b5f('0xd'),auth['isAuthenticated'](),controller[_0x8b5f('0x19')]);module[_0x8b5f('0x1a')]=router; \ No newline at end of file +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(_0x2ea5dd,_0xcaacf5){var _0x2035cd=function(_0xc3f4ed){while(--_0xc3f4ed){_0x2ea5dd['push'](_0x2ea5dd['shift']());}};_0x2035cd(++_0xcaacf5);}(_0x4d4b,0xf5));var _0xb4d4=function(_0x5d54ca,_0x26a981){_0x5d54ca=_0x5d54ca-0x0;var _0x5d30ab=_0x4d4b[_0x5d54ca];return _0x5d30ab;};'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 diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index b3bc5eb..293bda8 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 _0x9ec9=['ENUM','STRING','long','DATE','INTEGER','Email','lodash','TEXT','BOOLEAN'];(function(_0x267208,_0x461c7d){var _0x369452=function(_0x50f9e1){while(--_0x50f9e1){_0x267208['push'](_0x267208['shift']());}};_0x369452(++_0x461c7d);}(_0x9ec9,0x8d));var _0x99ec=function(_0x3f096b,_0x1a864f){_0x3f096b=_0x3f096b-0x0;var _0x204ba4=_0x9ec9[_0x3f096b];return _0x204ba4;};'use strict';var Sequelize=require('sequelize');var _=require(_0x99ec('0x0'));module['exports']={'body':{'type':Sequelize[_0x99ec('0x1')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x99ec('0x1')]('medium')},'read':{'type':Sequelize[_0x99ec('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x99ec('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x99ec('0x4')](0x1fe)},'from':{'type':Sequelize[_0x99ec('0x4')]},'to':{'type':Sequelize[_0x99ec('0x1')]('long')},'cc':{'type':Sequelize[_0x99ec('0x1')]('long')},'bcc':{'type':Sequelize[_0x99ec('0x1')](_0x99ec('0x5'))},'subject':{'type':Sequelize[_0x99ec('0x1')]},'sentAt':{'type':Sequelize[_0x99ec('0x6')]},'attach':{'type':Sequelize[_0x99ec('0x7')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x99ec('0x2')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x99ec('0x1')](_0x99ec('0x5'))},'originCc':{'type':Sequelize['TEXT'](_0x99ec('0x5'))},'originChannel':{'type':Sequelize[_0x99ec('0x3')](_0x99ec('0x8'),'Chat'),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0x4e55=['ENUM','STRING','INTEGER','DATE','Email','lodash','TEXT','long','medium','BOOLEAN'];(function(_0x33a152,_0x26ab81){var _0x3b7c10=function(_0x151ac6){while(--_0x151ac6){_0x33a152['push'](_0x33a152['shift']());}};_0x3b7c10(++_0x26ab81);}(_0x4e55,0x69));var _0x54e5=function(_0x36c900,_0x3ffa9b){_0x36c900=_0x36c900-0x0;var _0x7a97=_0x4e55[_0x36c900];return _0x7a97;};'use strict';var Sequelize=require('sequelize');var _=require(_0x54e5('0x0'));module['exports']={'body':{'type':Sequelize[_0x54e5('0x1')](_0x54e5('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x54e5('0x1')](_0x54e5('0x3'))},'read':{'type':Sequelize[_0x54e5('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x54e5('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x54e5('0x6')](0x1fe)},'from':{'type':Sequelize[_0x54e5('0x6')]},'to':{'type':Sequelize[_0x54e5('0x1')]('long')},'cc':{'type':Sequelize[_0x54e5('0x1')]('long')},'bcc':{'type':Sequelize[_0x54e5('0x1')](_0x54e5('0x2'))},'subject':{'type':Sequelize[_0x54e5('0x1')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x54e5('0x7')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x54e5('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x54e5('0x8')]},'originTo':{'type':Sequelize[_0x54e5('0x1')]('long')},'originCc':{'type':Sequelize[_0x54e5('0x1')](_0x54e5('0x2'))},'originChannel':{'type':Sequelize[_0x54e5('0x5')](_0x54e5('0x9'),'Chat'),'defaultValue':_0x54e5('0x9'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 5e260fb..1eaf1fb 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 _0x493c=['error','message','result','status','offset','count','limit','set','Content-Range','json','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','MailMessage','findAll','show','params','find','catch','body','destroy','describe','create','direction','out','secret','split','findOne','MailAccountId','List','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','root','server/files/attachments','basename','ListId','List\x20not\x20found','SendMail','sendMail','update','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','read','readAt','UserId','agent','get','MailInteraction','MailInteractionId','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','mail','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','internal','interface','rejectmessage','download','join','server','files','tmp','message-%s.eml','bcc','subject','createdAt','Attachment','from','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Attachments','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','bluebird','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','redis','defaults','localhost','register','jayson/promise','http','client','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x52c167,_0x195e96){var _0x3d1e3f=function(_0x5d3f61){while(--_0x5d3f61){_0x52c167['push'](_0x52c167['shift']());}};_0x3d1e3f(++_0x195e96);}(_0x493c,0x8b));var _0xc493=function(_0x15730a,_0x232a9e){_0x15730a=_0x15730a-0x0;var _0xc9030d=_0x493c[_0x15730a];return _0xc9030d;};'use strict';var emlformat=require(_0xc493('0x0'));var moment=require('moment');var BPromise=require(_0xc493('0x1'));var util=require(_0xc493('0x2'));var path=require(_0xc493('0x3'));var fs=require('fs');var _=require(_0xc493('0x4'));var Redis=require(_0xc493('0x5'));var htmlToText=require(_0xc493('0x6'));var qs=require(_0xc493('0x7'));var logger=require(_0xc493('0x8'))(_0xc493('0x9'));var interaction_log=require(_0xc493('0x8'))(_0xc493('0xa'));var config=require(_0xc493('0xb'));var db=require('../../mysqldb')['db'];config[_0xc493('0xc')]=_[_0xc493('0xd')](config['redis'],{'host':_0xc493('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var htmlEntities=require('html-entities');require('./mailMessage.socket')[_0xc493('0xf')](socket);var jayson=require(_0xc493('0x10'));var client=jayson['client'][_0xc493('0x11')]({'port':0x232c});var client9003=jayson[_0xc493('0x12')]['http']({'port':0x232b});var client9002=jayson[_0xc493('0x12')][_0xc493('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x4d396f,_0x409b8b,_0x56dc1b,_0x2ca966){return new BPromise(function(_0xef4f8b,_0x27a28e){var _0x9ebc39=_0x2ca966||client;return _0x9ebc39['request'](_0x4d396f,_0x56dc1b)[_0xc493('0x13')](function(_0xe7bc4){logger[_0xc493('0x14')](_0xc493('0x15'),_0x409b8b,_0xc493('0x16'));logger['debug'](_0xc493('0x17'),_0x409b8b,_0xc493('0x16'),JSON[_0xc493('0x18')](_0xe7bc4));if(_0xe7bc4[_0xc493('0x19')]){if(_0xe7bc4[_0xc493('0x19')]['code']===0x1f4){logger['error'](_0xc493('0x15'),_0x409b8b,_0xe7bc4['error'][_0xc493('0x1a')]);return _0x27a28e(_0xe7bc4[_0xc493('0x19')][_0xc493('0x1a')]);}logger[_0xc493('0x19')](_0xc493('0x15'),_0x409b8b,_0xe7bc4[_0xc493('0x19')][_0xc493('0x1a')]);return _0xef4f8b(_0xe7bc4[_0xc493('0x19')][_0xc493('0x1a')]);}else{logger[_0xc493('0x14')](_0xc493('0x15'),_0x409b8b,'request\x20sent');_0xef4f8b(_0xe7bc4[_0xc493('0x1b')][_0xc493('0x1a')]);}})['catch'](function(_0x455117){logger[_0xc493('0x19')]('MailMessage,\x20%s,\x20%s',_0x409b8b,_0x455117);_0x27a28e(_0x455117);});});}function respondWithResult(_0xaa91cd,_0x320f29){_0x320f29=_0x320f29||0xc8;return function(_0x247823){if(_0x247823){return _0xaa91cd[_0xc493('0x1c')](_0x320f29)['json'](_0x247823);}};}function respondWithFilteredResult(_0x655e13,_0x1999b2){return function(_0x549df4){if(_0x549df4){var _0x3eae2f=typeof _0x1999b2[_0xc493('0x1d')]==='undefined'&&typeof _0x1999b2['limit']==='undefined';var _0x39fa2b=_0x549df4[_0xc493('0x1e')];var _0x8bb747=_0x3eae2f?0x0:_0x1999b2[_0xc493('0x1d')];var _0x3fdbee=_0x3eae2f?_0x549df4['count']:_0x1999b2[_0xc493('0x1d')]+_0x1999b2[_0xc493('0x1f')];var _0x2bd3ef;if(_0x3fdbee>=_0x39fa2b){_0x3fdbee=_0x39fa2b;_0x2bd3ef=0xc8;}else{_0x2bd3ef=0xce;}_0x655e13[_0xc493('0x1c')](_0x2bd3ef);return _0x655e13[_0xc493('0x20')](_0xc493('0x21'),_0x8bb747+'-'+_0x3fdbee+'/'+_0x39fa2b)[_0xc493('0x22')](_0x549df4);}return null;};}function saveUpdates(_0x271794){return function(_0x291bba){if(_0x291bba){return _0x291bba['update'](_0x271794)[_0xc493('0x13')](function(_0x1fbf58){return _0x1fbf58;});}return null;};}function removeEntity(_0x1332db){return function(_0x1978f1){if(_0x1978f1){return _0x1978f1['destroy']()[_0xc493('0x13')](function(){_0x1332db[_0xc493('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf18444){return function(_0x4ee280){if(!_0x4ee280){_0xf18444['sendStatus'](0x194);}return _0x4ee280;};}function handleError(_0x204c13,_0x499c7c){_0x499c7c=_0x499c7c||0x1f4;return function(_0x3a7a7e){logger[_0xc493('0x19')](_0x3a7a7e[_0xc493('0x23')]);if(_0x3a7a7e[_0xc493('0x24')]){delete _0x3a7a7e[_0xc493('0x24')];}_0x204c13[_0xc493('0x1c')](_0x499c7c)[_0xc493('0x25')](_0x3a7a7e);};}exports[_0xc493('0x26')]=function(_0x2a5bfc,_0x2e0df0){var _0x54a614={},_0x3f53ef={},_0x5021d6={'count':0x0,'rows':[]};var _0x2d71da=_[_0xc493('0x27')](db['MailMessage'][_0xc493('0x28')],function(_0x2b246a){return{'name':_0x2b246a[_0xc493('0x29')],'type':_0x2b246a['type']['key']};});_0x3f53ef[_0xc493('0x2a')]=_[_0xc493('0x27')](_0x2d71da,_0xc493('0x24'));_0x3f53ef[_0xc493('0x2b')]=_[_0xc493('0x2c')](_0x2a5bfc[_0xc493('0x2b')]);_0x3f53ef[_0xc493('0x2d')]=_['intersection'](_0x3f53ef['model'],_0x3f53ef['query']);_0x54a614[_0xc493('0x2e')]=_[_0xc493('0x2f')](_0x3f53ef[_0xc493('0x2a')],qs[_0xc493('0x30')](_0x2a5bfc['query'][_0xc493('0x30')]));_0x54a614['attributes']=_0x54a614['attributes'][_0xc493('0x31')]?_0x54a614[_0xc493('0x2e')]:_0x3f53ef[_0xc493('0x2a')];if(!_0x2a5bfc[_0xc493('0x2b')][_0xc493('0x32')](_0xc493('0x33'))){_0x54a614[_0xc493('0x1f')]=qs[_0xc493('0x1f')](_0x2a5bfc['query'][_0xc493('0x1f')]);_0x54a614[_0xc493('0x1d')]=qs[_0xc493('0x1d')](_0x2a5bfc[_0xc493('0x2b')][_0xc493('0x1d')]);}_0x54a614[_0xc493('0x34')]=qs['sort'](_0x2a5bfc['query'][_0xc493('0x35')]);_0x54a614['where']=qs[_0xc493('0x2d')](_[_0xc493('0x36')](_0x2a5bfc['query'],_0x3f53ef[_0xc493('0x2d')]),_0x2d71da);if(_0x2a5bfc[_0xc493('0x2b')][_0xc493('0x37')]){_0x54a614['where']=_[_0xc493('0x38')](_0x54a614[_0xc493('0x39')],{'$or':_['map'](_0x2d71da,function(_0xbcb9b5){if(_0xbcb9b5[_0xc493('0x3a')]!==_0xc493('0x3b')){var _0x39873c={};_0x39873c[_0xbcb9b5['name']]={'$like':'%'+_0x2a5bfc['query'][_0xc493('0x37')]+'%'};return _0x39873c;}})});}_0x54a614=_[_0xc493('0x38')]({},_0x54a614,_0x2a5bfc[_0xc493('0x3c')]);var _0x11c728={'where':_0x54a614[_0xc493('0x39')]};return db['MailMessage'][_0xc493('0x1e')](_0x11c728)['then'](function(_0x311192){_0x5021d6[_0xc493('0x1e')]=_0x311192;if(_0x2a5bfc[_0xc493('0x2b')][_0xc493('0x3d')]){_0x54a614[_0xc493('0x3e')]=[{'all':!![]}];}return db[_0xc493('0x3f')][_0xc493('0x40')](_0x54a614);})[_0xc493('0x13')](function(_0x16b224){_0x5021d6['rows']=_0x16b224;return _0x5021d6;})[_0xc493('0x13')](respondWithFilteredResult(_0x2e0df0,_0x54a614))['catch'](handleError(_0x2e0df0,null));};exports[_0xc493('0x41')]=function(_0x4011e1,_0x345976){var _0x5c66e5={'raw':!![],'where':{'id':_0x4011e1[_0xc493('0x42')]['id']}},_0x2dcbd8={};_0x2dcbd8[_0xc493('0x2a')]=_['keys'](db[_0xc493('0x3f')][_0xc493('0x28')]);_0x2dcbd8[_0xc493('0x2b')]=_['keys'](_0x4011e1[_0xc493('0x2b')]);_0x2dcbd8[_0xc493('0x2d')]=_[_0xc493('0x2f')](_0x2dcbd8['model'],_0x2dcbd8['query']);_0x5c66e5['attributes']=_['intersection'](_0x2dcbd8['model'],qs[_0xc493('0x30')](_0x4011e1['query'][_0xc493('0x30')]));_0x5c66e5[_0xc493('0x2e')]=_0x5c66e5[_0xc493('0x2e')][_0xc493('0x31')]?_0x5c66e5['attributes']:_0x2dcbd8[_0xc493('0x2a')];if(_0x4011e1['query'][_0xc493('0x3d')]){_0x5c66e5[_0xc493('0x3e')]=[{'all':!![]}];}_0x5c66e5=_[_0xc493('0x38')]({},_0x5c66e5,_0x4011e1[_0xc493('0x3c')]);return db[_0xc493('0x3f')][_0xc493('0x43')](_0x5c66e5)[_0xc493('0x13')](handleEntityNotFound(_0x345976,null))['then'](respondWithResult(_0x345976,null))[_0xc493('0x44')](handleError(_0x345976,null));};exports['update']=function(_0x2c6f2f,_0x2be73f){if(_0x2c6f2f['body']['id']){delete _0x2c6f2f[_0xc493('0x45')]['id'];}return db['MailMessage'][_0xc493('0x43')]({'where':{'id':_0x2c6f2f[_0xc493('0x42')]['id']}})[_0xc493('0x13')](handleEntityNotFound(_0x2be73f,null))[_0xc493('0x13')](saveUpdates(_0x2c6f2f[_0xc493('0x45')],null))['then'](respondWithResult(_0x2be73f,null))[_0xc493('0x44')](handleError(_0x2be73f,null));};exports[_0xc493('0x46')]=function(_0x59b7bf,_0x1c6221){return db[_0xc493('0x3f')][_0xc493('0x43')]({'where':{'id':_0x59b7bf[_0xc493('0x42')]['id']}})[_0xc493('0x13')](handleEntityNotFound(_0x1c6221,null))[_0xc493('0x13')](removeEntity(_0x1c6221,null))['catch'](handleError(_0x1c6221,null));};exports[_0xc493('0x47')]=function(_0x573bde,_0xebb0fa){return db[_0xc493('0x3f')][_0xc493('0x47')]()[_0xc493('0x13')](respondWithResult(_0xebb0fa,null))[_0xc493('0x44')](handleError(_0xebb0fa,null));};exports[_0xc493('0x48')]=function(_0x301252,_0x3f73c2){return db['MailMessage'][_0xc493('0x48')](_0x301252[_0xc493('0x45')])[_0xc493('0x13')](function(_0x95f5b9){if(_0x95f5b9){if(_0x95f5b9[_0xc493('0x49')]===_0xc493('0x4a')&&!_0x95f5b9[_0xc493('0x4b')]){var _0x147e9f,_0x21b02c,_0x4d64c6;if(_0x301252[_0xc493('0x45')]['to']){_0x21b02c=_0x301252['body']['to'][_0xc493('0x4c')](',')[0x0];}return db['MailAccount'][_0xc493('0x4d')]({'where':{'id':_0x95f5b9[_0xc493('0x4e')]},'include':[{'model':db['CmList'],'as':_0xc493('0x4f'),'include':[{'model':db['CmContact'],'as':_0xc493('0x50'),'where':{'email':_0x21b02c},'limit':0x1,'order':[[_0xc493('0x51'),_0xc493('0x52')]]}]},{'model':db[_0xc493('0x53')],'as':_0xc493('0x54'),'raw':!![]}]})[_0xc493('0x13')](function(_0x1b94d1){_0x147e9f=_0x1b94d1;if(_0x147e9f&&_0x147e9f[_0xc493('0x54')]){var _0x4cc2bb={'tls':{'rejectUnauthorized':![]}};if(_[_0xc493('0x55')](_0x147e9f[_0xc493('0x54')][_0xc493('0x56')])){_0x4cc2bb['host']=_0x147e9f['Smtp'][_0xc493('0x57')];_0x4cc2bb[_0xc493('0x58')]=_0x147e9f[_0xc493('0x54')][_0xc493('0x58')];_0x4cc2bb[_0xc493('0x59')]=_0x147e9f['Smtp'][_0xc493('0x59')];if(_0x147e9f['Smtp'][_0xc493('0x5a')]){_0x4cc2bb[_0xc493('0x5b')]={'user':_0x147e9f[_0xc493('0x54')][_0xc493('0x5c')],'pass':_0x147e9f[_0xc493('0x54')][_0xc493('0x5d')]};}}else{_0x4cc2bb[_0xc493('0x56')]=_0x147e9f[_0xc493('0x54')][_0xc493('0x56')];_0x4cc2bb[_0xc493('0x5b')]={'user':_0x147e9f['Smtp']['user'],'pass':_0x147e9f[_0xc493('0x54')][_0xc493('0x5d')]};_0x4cc2bb[_0xc493('0x59')]=_0x147e9f[_0xc493('0x54')]['secure'];}if(_0x301252[_0xc493('0x45')][_0xc493('0x5e')]&&_0x301252['body'][_0xc493('0x5e')]['length']){for(var _0x2370e1=0x0;_0x2370e1<_0x301252[_0xc493('0x45')][_0xc493('0x5e')][_0xc493('0x31')];_0x2370e1+=0x1){_0x301252[_0xc493('0x45')][_0xc493('0x5e')][_0x2370e1]={'filename':_0x301252[_0xc493('0x45')][_0xc493('0x5e')][_0x2370e1][_0xc493('0x24')],'path':path['join'](config[_0xc493('0x5f')],_0xc493('0x60'),_0x301252[_0xc493('0x45')][_0xc493('0x5e')][_0x2370e1][_0xc493('0x61')])};}}_0x4d64c6={'account':_0x4cc2bb,'message':_0x301252[_0xc493('0x45')]};return;}})[_0xc493('0x13')](function(){if(_0x147e9f[_0xc493('0x4f')]){if(_0x147e9f[_0xc493('0x4f')][_0xc493('0x50')][_0xc493('0x31')]){return _0x147e9f[_0xc493('0x4f')][_0xc493('0x50')][0x0];}else{return db['CmContact']['create'](_[_0xc493('0xd')](_0x301252[_0xc493('0x45')],{'firstName':_0x301252[_0xc493('0x45')]['to'],'email':_0x301252['body']['to'],'phone':_0x301252['body']['to'],'ListId':_0x147e9f[_0xc493('0x62')]}));}}else{throw new Error(_0xc493('0x63'));}})[_0xc493('0x13')](function(){if(_0x4d64c6){return respondWithRpcPromise(_0xc493('0x64'),_0xc493('0x65'),_0x4d64c6,client9003)[_0xc493('0x13')](function(_0x369d77){return _0x95f5b9[_0xc493('0x66')]({'read':!![],'messageId':_0x369d77[_0xc493('0x67')],'sentAt':moment()[_0xc493('0x68')](_0xc493('0x69'))});})[_0xc493('0x44')](function(_0x278050){logger[_0xc493('0x19')]('%s',JSON[_0xc493('0x18')](_0x278050));return _0x95f5b9;});}return _0x95f5b9;});}return _0x95f5b9;}})[_0xc493('0x13')](respondWithResult(_0x3f73c2,0xc9))[_0xc493('0x44')](handleError(_0x3f73c2,null));};exports[_0xc493('0x6a')]=function(_0x37bb00,_0x3f4d88){var _0x1041c6={'agent':{},'channel':'mail'};if(_0x37bb00[_0xc493('0x45')]['id']){delete _0x37bb00['body']['id'];}_0x37bb00['body'][_0xc493('0x6b')]=!![];_0x37bb00[_0xc493('0x45')][_0xc493('0x6c')]=moment()['format'](_0xc493('0x69'));_0x37bb00['body'][_0xc493('0x6d')]=_0x37bb00['body'][_0xc493('0x6d')]||_0x37bb00[_0xc493('0x5c')]['id'];_0x1041c6[_0xc493('0x6e')]['id']=_0x37bb00[_0xc493('0x45')]['UserId'];return db[_0xc493('0x3f')][_0xc493('0x43')]({'where':{'id':_0x37bb00[_0xc493('0x42')]['id'],'UserId':null}})[_0xc493('0x13')](handleEntityNotFound(_0x3f4d88,null))[_0xc493('0x13')](saveUpdates(_0x37bb00[_0xc493('0x45')],null))[_0xc493('0x13')](function(_0x33d713){if(_0x33d713){_0x1041c6['message']=_0x33d713[_0xc493('0x6f')]({'plain':!![]});return db[_0xc493('0x70')][_0xc493('0x43')]({'where':{'id':_0x33d713[_0xc493('0x71')]}});}return null;})[_0xc493('0x13')](handleEntityNotFound(_0x3f4d88,null))[_0xc493('0x13')](function(_0x3af029){if(_0x3af029){return _0x3af029[_0xc493('0x66')]({'UserId':_0x37bb00[_0xc493('0x45')][_0xc493('0x6d')],'read1stAt':_[_0xc493('0x55')](_0x3af029['read1stAt'])?moment()[_0xc493('0x68')](_0xc493('0x69')):undefined});}return null;})[_0xc493('0x13')](function(_0x1631ae){if(_0x1631ae){_0x1041c6[_0xc493('0x72')]=_0x1631ae['get']({'plain':!![]});interaction_log[_0xc493('0x14')](_0xc493('0x73'),_0x37bb00[_0xc493('0x5c')]['id'],_0x37bb00[_0xc493('0x5c')][_0xc493('0x24')],_0x37bb00[_0xc493('0x5c')]['role'],_0x1041c6[_0xc493('0x72')]['id'],_0x37bb00[_0xc493('0x45')]?JSON[_0xc493('0x18')](_0x37bb00[_0xc493('0x45')]):'null');return respondWithRpcPromise(_0xc493('0x74'),_0xc493('0x75'),_0x1041c6);}return null;})[_0xc493('0x13')](function(_0x1b6c8d){var _0x388622=_0xc493('0x76')+_0x1b6c8d[_0xc493('0x1a')][_0xc493('0x77')];return db[_0xc493('0x78')][_0xc493('0x2b')](_0x388622,{'type':db[_0xc493('0x79')][_0xc493('0x7a')][_0xc493('0x7b')],'raw':!![]})[_0xc493('0x13')](function(_0x18aae0){return _0x18aae0;});})[_0xc493('0x13')](function(_0xc2a5e2){if(_0xc2a5e2){_0x1041c6[_0xc493('0x1a')][_0xc493('0x7c')]=_0xc2a5e2[0x0];if(!_0x37bb00[_0xc493('0x45')][_0xc493('0x6d')])return;return db[_0xc493('0x7d')][_0xc493('0x43')]({'where':{'id':_0x37bb00[_0xc493('0x45')]['UserId'],'role':_0xc493('0x6e')},'attributes':['id',_0xc493('0x24'),_0xc493('0x7e'),_0xc493('0x7f'),'internal'],'raw':!![]});}return null;})[_0xc493('0x13')](function(_0x186979){if(!_0x186979)return null;_0x1041c6['message'][_0xc493('0x6e')]=_0x186979;return _0x1041c6;})['then'](function(_0x3c30ac){if(_0x3c30ac){if(_0x37bb00[_0xc493('0x45')]['manual']){_0x1041c6[_0xc493('0x1a')]['interface']=util[_0xc493('0x68')](_0xc493('0x80'),_0x37bb00[_0xc493('0x5c')][_0xc493('0x24')]);_0x1041c6[_0xc493('0x1a')][_0xc493('0x81')]=_0x1041c6['channel'];_0x1041c6[_0xc493('0x1a')][_0xc493('0x82')]=_0x1041c6[_0xc493('0x81')];_0x1041c6[_0xc493('0x1a')][_0xc493('0x83')]=_0xc493('0x6a');_0x1041c6['message'][_0xc493('0x45')]=htmlToText[_0xc493('0x84')](_0x1041c6['message'][_0xc493('0x45')]);return respondWithRpcPromise(_0xc493('0x85'),_0xc493('0x85'),{'event':_0xc493('0x86'),'message':_0x1041c6[_0xc493('0x1a')]},client9002)[_0xc493('0x13')](function(){return _0x1041c6;});}return _0x1041c6;}return null;})[_0xc493('0x13')](respondWithResult(_0x3f4d88,null))['catch'](handleError(_0x3f4d88,null));};exports[_0xc493('0x87')]=function(_0x4a065f,_0x1ded54){var _0x141e75={'agent':{},'channel':_0xc493('0x88')};if(_0x4a065f['body']['id']){delete _0x4a065f[_0xc493('0x45')]['id'];}_0x4a065f['body']['UserId']=_0x4a065f[_0xc493('0x45')]['UserId']||_0x4a065f[_0xc493('0x5c')]['id'];_0x141e75[_0xc493('0x6e')]['id']=_0x4a065f['body'][_0xc493('0x6d')];return db[_0xc493('0x3f')]['find']({'where':{'id':_0x4a065f[_0xc493('0x42')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1ded54,null))[_0xc493('0x13')](function(_0x48b6d6){if(_0x48b6d6){_0x141e75[_0xc493('0x1a')]=_0x48b6d6['get']({'plain':!![]});return db['MailInteraction'][_0xc493('0x43')]({'where':{'id':_0x48b6d6[_0xc493('0x71')]}});}return null;})[_0xc493('0x13')](handleEntityNotFound(_0x1ded54,null))[_0xc493('0x13')](function(_0x43a383){if(_0x43a383){_0x141e75[_0xc493('0x72')]=_0x43a383[_0xc493('0x6f')]({'plain':!![]});interaction_log[_0xc493('0x14')](_0xc493('0x89'),_0x4a065f[_0xc493('0x5c')]['id'],_0x4a065f['user'][_0xc493('0x24')],_0x4a065f[_0xc493('0x5c')]['role'],_0x141e75[_0xc493('0x72')]['id'],_0x4a065f[_0xc493('0x45')]?JSON[_0xc493('0x18')](_0x4a065f['body']):_0xc493('0x8a'));return respondWithRpcPromise(_0xc493('0x8b'),'rejectMessage',_0x141e75);}return null;})['then'](function(_0x2f3ac7){var _0x21ebe1=_0xc493('0x76')+_0x2f3ac7[_0xc493('0x1a')][_0xc493('0x77')];return db[_0xc493('0x78')]['query'](_0x21ebe1,{'type':db[_0xc493('0x79')][_0xc493('0x7a')][_0xc493('0x7b')],'raw':!![]})['then'](function(_0x1854ab){return _0x1854ab;});})[_0xc493('0x13')](function(_0x50f431){if(_0x50f431){_0x141e75[_0xc493('0x1a')]['contact']=_0x50f431[0x0];if(!_0x4a065f[_0xc493('0x45')][_0xc493('0x6d')])return;return db[_0xc493('0x7d')]['find']({'where':{'id':_0x4a065f[_0xc493('0x45')][_0xc493('0x6d')],'role':_0xc493('0x6e')},'attributes':['id','name','fullname',_0xc493('0x7f'),_0xc493('0x8c')],'raw':!![]});}return null;})['then'](function(_0x54d8a0){if(!_0x54d8a0)return null;_0x141e75[_0xc493('0x1a')]['agent']=_0x54d8a0;return _0x141e75;})['then'](function(_0x38c5a8){if(_0x38c5a8){_0x38c5a8[_0xc493('0x1a')][_0xc493('0x8d')]=util[_0xc493('0x68')](_0xc493('0x80'),_0x4a065f[_0xc493('0x5c')]['name']);_0x38c5a8['message'][_0xc493('0x81')]=_0x141e75[_0xc493('0x81')];_0x38c5a8[_0xc493('0x1a')]['motionChannel']=_0x141e75[_0xc493('0x81')];_0x38c5a8[_0xc493('0x1a')][_0xc493('0x83')]='reject';_0x38c5a8[_0xc493('0x1a')]['body']=htmlToText['fromString'](_0x141e75[_0xc493('0x1a')][_0xc493('0x45')]);respondWithRpcPromise(_0xc493('0x85'),_0xc493('0x85'),{'event':_0xc493('0x8e'),'message':_0x38c5a8['message']},client9002);return _0x141e75;}return null;})['then'](respondWithResult(_0x1ded54,null))[_0xc493('0x44')](handleError(_0x1ded54,null));};exports[_0xc493('0x8f')]=function(_0x11e2e9,_0x2d4b88){var _0x45f41b=moment()['unix']()['toString']();var _0x2adb6f=path[_0xc493('0x90')](config[_0xc493('0x5f')],_0xc493('0x91'),_0xc493('0x92'),_0xc493('0x93'));var _0x401d12=path['join'](config[_0xc493('0x5f')],_0xc493('0x91'),_0xc493('0x92'),'attachments');var _0x2e8d3b=util[_0xc493('0x68')](_0xc493('0x94'),_0x45f41b);return db[_0xc493('0x3f')][_0xc493('0x43')]({'where':{'id':_0x11e2e9['params']['id']},'attributes':['id','body','from','to','cc',_0xc493('0x95'),_0xc493('0x96'),_0xc493('0x97')],'include':_0x11e2e9[_0xc493('0x2b')][_0xc493('0x5e')]?[{'model':db[_0xc493('0x98')],'as':'Attachments'}]:undefined})[_0xc493('0x13')](handleEntityNotFound(_0x2d4b88,null))[_0xc493('0x13')](function(_0x26c34b){if(_0x26c34b){var _0x48a2af=_0x26c34b;var _0x1891ea={'from':_0x48a2af[_0xc493('0x99')],'to':_0x48a2af['to'],'subject':_0x48a2af['subject'],'html':htmlEntities[_0xc493('0x9a')](_0x48a2af['body']),'headers':{'Date':moment(_0x48a2af[_0xc493('0x97')])[_0xc493('0x68')](_0xc493('0x9b'))},'attachments':[]};if(_0x26c34b['cc']){_0x1891ea[_0xc493('0x9c')]['Cc']=_0x26c34b['cc'];}if(_0x26c34b[_0xc493('0x95')]){_0x1891ea['headers']['Bcc']=_0x26c34b[_0xc493('0x95')];}return new BPromise(function(_0x5ce58a,_0xbd9ecd){if(_0x26c34b['Attachments']){for(var _0x1f3dff=0x0;_0x1f3dff<_0x26c34b[_0xc493('0x9d')][_0xc493('0x31')];_0x1f3dff++){var _0x282f0f=_0x26c34b[_0xc493('0x9d')][_0x1f3dff];var _0x228fd0=path[_0xc493('0x90')](_0x401d12,_0x282f0f['basename']);if(fs[_0xc493('0x9e')](_0x228fd0)){_0x1891ea[_0xc493('0x5e')][_0xc493('0x9f')]({'name':_0x282f0f[_0xc493('0x24')],'contentType':_0x282f0f[_0xc493('0x3a')],'data':fs[_0xc493('0xa0')](_0x228fd0)});}}}emlformat[_0xc493('0xa1')](_0x1891ea,function(_0x3e66ab,_0x5e7872){if(_0x3e66ab)return _0xbd9ecd(_0x3e66ab);fs[_0xc493('0xa2')](path[_0xc493('0x90')](_0x2adb6f,_0x2e8d3b),_0x5e7872);return _0x5ce58a(_0x5e7872);});});}})[_0xc493('0x13')](function(_0x1dff26){if(_0x1dff26){return _0x2d4b88[_0xc493('0x8f')](path[_0xc493('0x90')](_0x2adb6f,_0x2e8d3b),_0x2e8d3b,function(_0x2971fc){if(!_0x2971fc)fs[_0xc493('0xa3')](path[_0xc493('0x90')](_0x2adb6f,_0x2e8d3b));});}})['catch'](handleError(_0x2d4b88,null));}; \ No newline at end of file +var _0x4380=['port','secure','authentication','auth','user','pass','attachments','join','root','server/files/attachments','basename','Contacts','ListId','List\x20not\x20found','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','read','readAt','UserId','agent','get','MailInteraction','MailInteractionId','isNil','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','channel','motionChannel','event','fromString','acceptmessage','reject','mail','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','rejectMessage','ContactId','SELECT','SIP/%s','EventManager','download','unix','toString','server','files','tmp','message-%s.eml','from','subject','createdAt','Attachment','Attachments','decode','headers','Bcc','bcc','push','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','offset','undefined','count','limit','set','Content-Range','json','update','destroy','sendStatus','stack','name','send','index','fieldName','model','map','query','keys','intersection','attributes','fields','length','nolimit','sort','where','pick','filters','filter','merge','options','MailMessage','includeAll','include','findAll','rows','show','params','rawAttributes','find','body','describe','create','out','secret','split','findOne','MailAccountId','CmList','List','CmContact','updatedAt','MailServerOut','Smtp','service','host'];(function(_0x4fe29e,_0x155953){var _0x4fce08=function(_0x219301){while(--_0x219301){_0x4fe29e['push'](_0x4fe29e['shift']());}};_0x4fce08(++_0x155953);}(_0x4380,0xee));var _0x0438=function(_0x3c77dc,_0x3854ef){_0x3c77dc=_0x3c77dc-0x0;var _0x1e4888=_0x4380[_0x3c77dc];return _0x1e4888;};'use strict';var emlformat=require(_0x0438('0x0'));var moment=require(_0x0438('0x1'));var BPromise=require(_0x0438('0x2'));var util=require('util');var path=require(_0x0438('0x3'));var fs=require('fs');var _=require(_0x0438('0x4'));var Redis=require(_0x0438('0x5'));var htmlToText=require(_0x0438('0x6'));var qs=require(_0x0438('0x7'));var logger=require(_0x0438('0x8'))(_0x0438('0x9'));var interaction_log=require(_0x0438('0x8'))(_0x0438('0xa'));var config=require('../../config/environment');var db=require(_0x0438('0xb'))['db'];config[_0x0438('0xc')]=_[_0x0438('0xd')](config[_0x0438('0xc')],{'host':_0x0438('0xe'),'port':0x18eb});var socket=require(_0x0438('0xf'))(new Redis(config[_0x0438('0xc')]));var htmlEntities=require('html-entities');require(_0x0438('0x10'))['register'](socket);var jayson=require(_0x0438('0x11'));var client=jayson[_0x0438('0x12')][_0x0438('0x13')]({'port':0x232c});var client9003=jayson['client'][_0x0438('0x13')]({'port':0x232b});var client9002=jayson[_0x0438('0x12')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38d25f,_0x5a658b,_0x5d82cf,_0x4332a6){return new BPromise(function(_0x37f5f2,_0x4eb1c5){var _0x401988=_0x4332a6||client;return _0x401988[_0x0438('0x14')](_0x38d25f,_0x5d82cf)[_0x0438('0x15')](function(_0x71d797){logger[_0x0438('0x16')](_0x0438('0x17'),_0x5a658b,_0x0438('0x18'));logger['debug'](_0x0438('0x19'),_0x5a658b,'request\x20sent',JSON[_0x0438('0x1a')](_0x71d797));if(_0x71d797[_0x0438('0x1b')]){if(_0x71d797[_0x0438('0x1b')]['code']===0x1f4){logger['error'](_0x0438('0x17'),_0x5a658b,_0x71d797[_0x0438('0x1b')][_0x0438('0x1c')]);return _0x4eb1c5(_0x71d797[_0x0438('0x1b')][_0x0438('0x1c')]);}logger[_0x0438('0x1b')]('MailMessage,\x20%s,\x20%s',_0x5a658b,_0x71d797[_0x0438('0x1b')][_0x0438('0x1c')]);return _0x37f5f2(_0x71d797['error'][_0x0438('0x1c')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x5a658b,_0x0438('0x18'));_0x37f5f2(_0x71d797[_0x0438('0x1d')][_0x0438('0x1c')]);}})[_0x0438('0x1e')](function(_0xda91c0){logger[_0x0438('0x1b')](_0x0438('0x17'),_0x5a658b,_0xda91c0);_0x4eb1c5(_0xda91c0);});});}function respondWithResult(_0xbc396f,_0x1ab323){_0x1ab323=_0x1ab323||0xc8;return function(_0x516756){if(_0x516756){return _0xbc396f[_0x0438('0x1f')](_0x1ab323)['json'](_0x516756);}};}function respondWithFilteredResult(_0x4c2aa2,_0x402fdc){return function(_0x563de5){if(_0x563de5){var _0x4cd7e8=typeof _0x402fdc[_0x0438('0x20')]==='undefined'&&typeof _0x402fdc['limit']===_0x0438('0x21');var _0x34ede4=_0x563de5[_0x0438('0x22')];var _0x38a125=_0x4cd7e8?0x0:_0x402fdc[_0x0438('0x20')];var _0x90282e=_0x4cd7e8?_0x563de5[_0x0438('0x22')]:_0x402fdc[_0x0438('0x20')]+_0x402fdc[_0x0438('0x23')];var _0x56ccd4;if(_0x90282e>=_0x34ede4){_0x90282e=_0x34ede4;_0x56ccd4=0xc8;}else{_0x56ccd4=0xce;}_0x4c2aa2[_0x0438('0x1f')](_0x56ccd4);return _0x4c2aa2[_0x0438('0x24')](_0x0438('0x25'),_0x38a125+'-'+_0x90282e+'/'+_0x34ede4)[_0x0438('0x26')](_0x563de5);}return null;};}function saveUpdates(_0x134b55){return function(_0x4dd01b){if(_0x4dd01b){return _0x4dd01b[_0x0438('0x27')](_0x134b55)['then'](function(_0x476478){return _0x476478;});}return null;};}function removeEntity(_0x3a7b91){return function(_0x9e013b){if(_0x9e013b){return _0x9e013b[_0x0438('0x28')]()[_0x0438('0x15')](function(){_0x3a7b91[_0x0438('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5491db){return function(_0x46b29c){if(!_0x46b29c){_0x5491db[_0x0438('0x29')](0x194);}return _0x46b29c;};}function handleError(_0x588ca7,_0x31e495){_0x31e495=_0x31e495||0x1f4;return function(_0x596d69){logger[_0x0438('0x1b')](_0x596d69[_0x0438('0x2a')]);if(_0x596d69['name']){delete _0x596d69[_0x0438('0x2b')];}_0x588ca7[_0x0438('0x1f')](_0x31e495)[_0x0438('0x2c')](_0x596d69);};}exports[_0x0438('0x2d')]=function(_0x12a49d,_0x59f50b){var _0x41f8f8={},_0x4736ef={},_0x11eeb3={'count':0x0,'rows':[]};var _0x4a5bd2=_['map'](db['MailMessage']['rawAttributes'],function(_0x5e02fd){return{'name':_0x5e02fd[_0x0438('0x2e')],'type':_0x5e02fd['type']['key']};});_0x4736ef[_0x0438('0x2f')]=_[_0x0438('0x30')](_0x4a5bd2,'name');_0x4736ef[_0x0438('0x31')]=_[_0x0438('0x32')](_0x12a49d['query']);_0x4736ef['filters']=_[_0x0438('0x33')](_0x4736ef['model'],_0x4736ef[_0x0438('0x31')]);_0x41f8f8[_0x0438('0x34')]=_[_0x0438('0x33')](_0x4736ef[_0x0438('0x2f')],qs['fields'](_0x12a49d[_0x0438('0x31')][_0x0438('0x35')]));_0x41f8f8[_0x0438('0x34')]=_0x41f8f8['attributes'][_0x0438('0x36')]?_0x41f8f8['attributes']:_0x4736ef[_0x0438('0x2f')];if(!_0x12a49d['query']['hasOwnProperty'](_0x0438('0x37'))){_0x41f8f8[_0x0438('0x23')]=qs[_0x0438('0x23')](_0x12a49d[_0x0438('0x31')][_0x0438('0x23')]);_0x41f8f8[_0x0438('0x20')]=qs['offset'](_0x12a49d['query'][_0x0438('0x20')]);}_0x41f8f8['order']=qs['sort'](_0x12a49d[_0x0438('0x31')][_0x0438('0x38')]);_0x41f8f8[_0x0438('0x39')]=qs['filters'](_[_0x0438('0x3a')](_0x12a49d['query'],_0x4736ef[_0x0438('0x3b')]),_0x4a5bd2);if(_0x12a49d[_0x0438('0x31')][_0x0438('0x3c')]){_0x41f8f8[_0x0438('0x39')]=_[_0x0438('0x3d')](_0x41f8f8[_0x0438('0x39')],{'$or':_['map'](_0x4a5bd2,function(_0x125d70){if(_0x125d70['type']!=='VIRTUAL'){var _0x4fb49f={};_0x4fb49f[_0x125d70[_0x0438('0x2b')]]={'$like':'%'+_0x12a49d['query']['filter']+'%'};return _0x4fb49f;}})});}_0x41f8f8=_[_0x0438('0x3d')]({},_0x41f8f8,_0x12a49d[_0x0438('0x3e')]);var _0x30e3a3={'where':_0x41f8f8[_0x0438('0x39')]};return db[_0x0438('0x3f')][_0x0438('0x22')](_0x30e3a3)[_0x0438('0x15')](function(_0x3ca6fe){_0x11eeb3[_0x0438('0x22')]=_0x3ca6fe;if(_0x12a49d['query'][_0x0438('0x40')]){_0x41f8f8[_0x0438('0x41')]=[{'all':!![]}];}return db[_0x0438('0x3f')][_0x0438('0x42')](_0x41f8f8);})[_0x0438('0x15')](function(_0x196cdc){_0x11eeb3[_0x0438('0x43')]=_0x196cdc;return _0x11eeb3;})[_0x0438('0x15')](respondWithFilteredResult(_0x59f50b,_0x41f8f8))[_0x0438('0x1e')](handleError(_0x59f50b,null));};exports[_0x0438('0x44')]=function(_0x508275,_0x1803bb){var _0x5bf0c6={'raw':!![],'where':{'id':_0x508275[_0x0438('0x45')]['id']}},_0x371b91={};_0x371b91['model']=_['keys'](db[_0x0438('0x3f')][_0x0438('0x46')]);_0x371b91[_0x0438('0x31')]=_[_0x0438('0x32')](_0x508275[_0x0438('0x31')]);_0x371b91[_0x0438('0x3b')]=_[_0x0438('0x33')](_0x371b91[_0x0438('0x2f')],_0x371b91['query']);_0x5bf0c6[_0x0438('0x34')]=_['intersection'](_0x371b91['model'],qs[_0x0438('0x35')](_0x508275[_0x0438('0x31')]['fields']));_0x5bf0c6[_0x0438('0x34')]=_0x5bf0c6[_0x0438('0x34')][_0x0438('0x36')]?_0x5bf0c6[_0x0438('0x34')]:_0x371b91['model'];if(_0x508275['query']['includeAll']){_0x5bf0c6['include']=[{'all':!![]}];}_0x5bf0c6=_[_0x0438('0x3d')]({},_0x5bf0c6,_0x508275['options']);return db[_0x0438('0x3f')][_0x0438('0x47')](_0x5bf0c6)[_0x0438('0x15')](handleEntityNotFound(_0x1803bb,null))[_0x0438('0x15')](respondWithResult(_0x1803bb,null))[_0x0438('0x1e')](handleError(_0x1803bb,null));};exports[_0x0438('0x27')]=function(_0x19283c,_0x354da8){if(_0x19283c['body']['id']){delete _0x19283c[_0x0438('0x48')]['id'];}return db[_0x0438('0x3f')][_0x0438('0x47')]({'where':{'id':_0x19283c[_0x0438('0x45')]['id']}})[_0x0438('0x15')](handleEntityNotFound(_0x354da8,null))['then'](saveUpdates(_0x19283c[_0x0438('0x48')],null))[_0x0438('0x15')](respondWithResult(_0x354da8,null))[_0x0438('0x1e')](handleError(_0x354da8,null));};exports[_0x0438('0x28')]=function(_0x46e73e,_0x17e382){return db[_0x0438('0x3f')][_0x0438('0x47')]({'where':{'id':_0x46e73e[_0x0438('0x45')]['id']}})[_0x0438('0x15')](handleEntityNotFound(_0x17e382,null))[_0x0438('0x15')](removeEntity(_0x17e382,null))[_0x0438('0x1e')](handleError(_0x17e382,null));};exports[_0x0438('0x49')]=function(_0x247fb7,_0x2316c0){return db['MailMessage'][_0x0438('0x49')]()[_0x0438('0x15')](respondWithResult(_0x2316c0,null))[_0x0438('0x1e')](handleError(_0x2316c0,null));};exports[_0x0438('0x4a')]=function(_0x1985b3,_0x435c16){return db['MailMessage']['create'](_0x1985b3[_0x0438('0x48')])[_0x0438('0x15')](function(_0x53b86e){if(_0x53b86e){if(_0x53b86e['direction']===_0x0438('0x4b')&&!_0x53b86e[_0x0438('0x4c')]){var _0x38ebcb,_0x2f0ca5,_0x305cbf;if(_0x1985b3[_0x0438('0x48')]['to']){_0x2f0ca5=_0x1985b3[_0x0438('0x48')]['to'][_0x0438('0x4d')](',')[0x0];}return db['MailAccount'][_0x0438('0x4e')]({'where':{'id':_0x53b86e[_0x0438('0x4f')]},'include':[{'model':db[_0x0438('0x50')],'as':_0x0438('0x51'),'include':[{'model':db[_0x0438('0x52')],'as':'Contacts','where':{'email':_0x2f0ca5},'limit':0x1,'order':[[_0x0438('0x53'),'DESC']]}]},{'model':db[_0x0438('0x54')],'as':_0x0438('0x55'),'raw':!![]}]})[_0x0438('0x15')](function(_0x1e8bb1){_0x38ebcb=_0x1e8bb1;if(_0x38ebcb&&_0x38ebcb['Smtp']){var _0x3c9e4b={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x38ebcb['Smtp'][_0x0438('0x56')])){_0x3c9e4b[_0x0438('0x57')]=_0x38ebcb[_0x0438('0x55')][_0x0438('0x57')];_0x3c9e4b[_0x0438('0x58')]=_0x38ebcb[_0x0438('0x55')][_0x0438('0x58')];_0x3c9e4b[_0x0438('0x59')]=_0x38ebcb[_0x0438('0x55')][_0x0438('0x59')];if(_0x38ebcb[_0x0438('0x55')][_0x0438('0x5a')]){_0x3c9e4b[_0x0438('0x5b')]={'user':_0x38ebcb[_0x0438('0x55')][_0x0438('0x5c')],'pass':_0x38ebcb[_0x0438('0x55')][_0x0438('0x5d')]};}}else{_0x3c9e4b[_0x0438('0x56')]=_0x38ebcb['Smtp'][_0x0438('0x56')];_0x3c9e4b[_0x0438('0x5b')]={'user':_0x38ebcb[_0x0438('0x55')]['user'],'pass':_0x38ebcb[_0x0438('0x55')]['pass']};_0x3c9e4b['secure']=_0x38ebcb['Smtp'][_0x0438('0x59')];}if(_0x1985b3[_0x0438('0x48')][_0x0438('0x5e')]&&_0x1985b3['body']['attachments']['length']){for(var _0x2d73b7=0x0;_0x2d73b7<_0x1985b3['body'][_0x0438('0x5e')]['length'];_0x2d73b7+=0x1){_0x1985b3[_0x0438('0x48')][_0x0438('0x5e')][_0x2d73b7]={'filename':_0x1985b3[_0x0438('0x48')][_0x0438('0x5e')][_0x2d73b7][_0x0438('0x2b')],'path':path[_0x0438('0x5f')](config[_0x0438('0x60')],_0x0438('0x61'),_0x1985b3[_0x0438('0x48')][_0x0438('0x5e')][_0x2d73b7][_0x0438('0x62')])};}}_0x305cbf={'account':_0x3c9e4b,'message':_0x1985b3[_0x0438('0x48')]};return;}})[_0x0438('0x15')](function(){if(_0x38ebcb[_0x0438('0x51')]){if(_0x38ebcb['List']['Contacts'][_0x0438('0x36')]){return _0x38ebcb[_0x0438('0x51')][_0x0438('0x63')][0x0];}else{return db[_0x0438('0x52')][_0x0438('0x4a')](_[_0x0438('0xd')](_0x1985b3['body'],{'firstName':_0x1985b3['body']['to'],'email':_0x1985b3['body']['to'],'phone':_0x1985b3['body']['to'],'ListId':_0x38ebcb[_0x0438('0x64')]}));}}else{throw new Error(_0x0438('0x65'));}})[_0x0438('0x15')](function(){if(_0x305cbf){return respondWithRpcPromise(_0x0438('0x66'),'sendMail',_0x305cbf,client9003)[_0x0438('0x15')](function(_0x1c9298){return _0x53b86e[_0x0438('0x27')]({'read':!![],'messageId':_0x1c9298[_0x0438('0x67')],'sentAt':moment()[_0x0438('0x68')](_0x0438('0x69'))});})[_0x0438('0x1e')](function(_0x5b7dcf){logger[_0x0438('0x1b')]('%s',JSON['stringify'](_0x5b7dcf));return _0x53b86e;});}return _0x53b86e;});}return _0x53b86e;}})[_0x0438('0x15')](respondWithResult(_0x435c16,0xc9))[_0x0438('0x1e')](handleError(_0x435c16,null));};exports[_0x0438('0x6a')]=function(_0x4df59e,_0x3d81da){var _0x27426e={'agent':{},'channel':'mail'};if(_0x4df59e['body']['id']){delete _0x4df59e[_0x0438('0x48')]['id'];}_0x4df59e[_0x0438('0x48')][_0x0438('0x6b')]=!![];_0x4df59e['body'][_0x0438('0x6c')]=moment()[_0x0438('0x68')](_0x0438('0x69'));_0x4df59e[_0x0438('0x48')]['UserId']=_0x4df59e[_0x0438('0x48')][_0x0438('0x6d')]||_0x4df59e['user']['id'];_0x27426e[_0x0438('0x6e')]['id']=_0x4df59e[_0x0438('0x48')][_0x0438('0x6d')];return db[_0x0438('0x3f')][_0x0438('0x47')]({'where':{'id':_0x4df59e[_0x0438('0x45')]['id'],'UserId':null}})[_0x0438('0x15')](handleEntityNotFound(_0x3d81da,null))[_0x0438('0x15')](saveUpdates(_0x4df59e['body'],null))[_0x0438('0x15')](function(_0x2da7e6){if(_0x2da7e6){_0x27426e['message']=_0x2da7e6[_0x0438('0x6f')]({'plain':!![]});return db[_0x0438('0x70')]['find']({'where':{'id':_0x2da7e6[_0x0438('0x71')]}});}return null;})[_0x0438('0x15')](handleEntityNotFound(_0x3d81da,null))[_0x0438('0x15')](function(_0x33d48d){if(_0x33d48d){return _0x33d48d[_0x0438('0x27')]({'UserId':_0x4df59e[_0x0438('0x48')][_0x0438('0x6d')],'read1stAt':_[_0x0438('0x72')](_0x33d48d['read1stAt'])?moment()[_0x0438('0x68')](_0x0438('0x69')):undefined});}return null;})[_0x0438('0x15')](function(_0x100aa8){if(_0x100aa8){_0x27426e[_0x0438('0x73')]=_0x100aa8[_0x0438('0x6f')]({'plain':!![]});interaction_log[_0x0438('0x16')](_0x0438('0x74'),_0x4df59e[_0x0438('0x5c')]['id'],_0x4df59e[_0x0438('0x5c')][_0x0438('0x2b')],_0x4df59e[_0x0438('0x5c')]['role'],_0x27426e['interaction']['id'],_0x4df59e['body']?JSON[_0x0438('0x1a')](_0x4df59e[_0x0438('0x48')]):'null');return respondWithRpcPromise(_0x0438('0x75'),'acceptMessage',_0x27426e);}return null;})[_0x0438('0x15')](function(_0x5a8a1a){var _0x30ccfe=_0x0438('0x76')+_0x5a8a1a[_0x0438('0x1c')]['ContactId'];return db['sequelize']['query'](_0x30ccfe,{'type':db[_0x0438('0x77')][_0x0438('0x78')]['SELECT'],'raw':!![]})[_0x0438('0x15')](function(_0x1c3795){return _0x1c3795;});})[_0x0438('0x15')](function(_0x12cb5a){if(_0x12cb5a){_0x27426e['message'][_0x0438('0x79')]=_0x12cb5a[0x0];if(!_0x4df59e['body'][_0x0438('0x6d')])return;return db[_0x0438('0x7a')]['find']({'where':{'id':_0x4df59e[_0x0438('0x48')]['UserId'],'role':'agent'},'attributes':['id',_0x0438('0x2b'),_0x0438('0x7b'),_0x0438('0x7c'),_0x0438('0x7d')],'raw':!![]});}return null;})[_0x0438('0x15')](function(_0x3e520b){if(!_0x3e520b)return null;_0x27426e[_0x0438('0x1c')][_0x0438('0x6e')]=_0x3e520b;return _0x27426e;})[_0x0438('0x15')](function(_0x16d011){if(_0x16d011){if(_0x4df59e[_0x0438('0x48')][_0x0438('0x7e')]){_0x27426e[_0x0438('0x1c')][_0x0438('0x7f')]=util[_0x0438('0x68')]('SIP/%s',_0x4df59e['user']['name']);_0x27426e['message'][_0x0438('0x80')]=_0x27426e[_0x0438('0x80')];_0x27426e[_0x0438('0x1c')][_0x0438('0x81')]=_0x27426e[_0x0438('0x80')];_0x27426e[_0x0438('0x1c')][_0x0438('0x82')]='accept';_0x27426e[_0x0438('0x1c')][_0x0438('0x48')]=htmlToText[_0x0438('0x83')](_0x27426e[_0x0438('0x1c')][_0x0438('0x48')]);return respondWithRpcPromise('EventManager','EventManager',{'event':_0x0438('0x84'),'message':_0x27426e['message']},client9002)[_0x0438('0x15')](function(){return _0x27426e;});}return _0x27426e;}return null;})['then'](respondWithResult(_0x3d81da,null))[_0x0438('0x1e')](handleError(_0x3d81da,null));};exports[_0x0438('0x85')]=function(_0xbdf964,_0x5412f5){var _0x4cf57e={'agent':{},'channel':_0x0438('0x86')};if(_0xbdf964[_0x0438('0x48')]['id']){delete _0xbdf964[_0x0438('0x48')]['id'];}_0xbdf964['body'][_0x0438('0x6d')]=_0xbdf964[_0x0438('0x48')][_0x0438('0x6d')]||_0xbdf964[_0x0438('0x5c')]['id'];_0x4cf57e[_0x0438('0x6e')]['id']=_0xbdf964['body'][_0x0438('0x6d')];return db[_0x0438('0x3f')][_0x0438('0x47')]({'where':{'id':_0xbdf964['params']['id'],'UserId':null}})[_0x0438('0x15')](handleEntityNotFound(_0x5412f5,null))[_0x0438('0x15')](function(_0xd2f365){if(_0xd2f365){_0x4cf57e[_0x0438('0x1c')]=_0xd2f365['get']({'plain':!![]});return db['MailInteraction'][_0x0438('0x47')]({'where':{'id':_0xd2f365[_0x0438('0x71')]}});}return null;})[_0x0438('0x15')](handleEntityNotFound(_0x5412f5,null))['then'](function(_0x5e8435){if(_0x5e8435){_0x4cf57e[_0x0438('0x73')]=_0x5e8435['get']({'plain':!![]});interaction_log[_0x0438('0x16')](_0x0438('0x87'),_0xbdf964['user']['id'],_0xbdf964['user']['name'],_0xbdf964[_0x0438('0x5c')][_0x0438('0x88')],_0x4cf57e[_0x0438('0x73')]['id'],_0xbdf964[_0x0438('0x48')]?JSON[_0x0438('0x1a')](_0xbdf964['body']):_0x0438('0x89'));return respondWithRpcPromise('RejectMessage',_0x0438('0x8a'),_0x4cf57e);}return null;})[_0x0438('0x15')](function(_0x1cc20c){var _0x34f2be=_0x0438('0x76')+_0x1cc20c[_0x0438('0x1c')][_0x0438('0x8b')];return db['sequelize'][_0x0438('0x31')](_0x34f2be,{'type':db[_0x0438('0x77')][_0x0438('0x78')][_0x0438('0x8c')],'raw':!![]})[_0x0438('0x15')](function(_0x15af81){return _0x15af81;});})['then'](function(_0x2edffb){if(_0x2edffb){_0x4cf57e[_0x0438('0x1c')][_0x0438('0x79')]=_0x2edffb[0x0];if(!_0xbdf964['body']['UserId'])return;return db[_0x0438('0x7a')][_0x0438('0x47')]({'where':{'id':_0xbdf964[_0x0438('0x48')][_0x0438('0x6d')],'role':'agent'},'attributes':['id',_0x0438('0x2b'),_0x0438('0x7b'),_0x0438('0x7c'),_0x0438('0x7d')],'raw':!![]});}return null;})[_0x0438('0x15')](function(_0xa0a02f){if(!_0xa0a02f)return null;_0x4cf57e[_0x0438('0x1c')][_0x0438('0x6e')]=_0xa0a02f;return _0x4cf57e;})['then'](function(_0x2c0a38){if(_0x2c0a38){_0x2c0a38[_0x0438('0x1c')][_0x0438('0x7f')]=util[_0x0438('0x68')](_0x0438('0x8d'),_0xbdf964[_0x0438('0x5c')][_0x0438('0x2b')]);_0x2c0a38[_0x0438('0x1c')][_0x0438('0x80')]=_0x4cf57e[_0x0438('0x80')];_0x2c0a38[_0x0438('0x1c')][_0x0438('0x81')]=_0x4cf57e['channel'];_0x2c0a38[_0x0438('0x1c')][_0x0438('0x82')]=_0x0438('0x85');_0x2c0a38[_0x0438('0x1c')][_0x0438('0x48')]=htmlToText[_0x0438('0x83')](_0x4cf57e[_0x0438('0x1c')]['body']);respondWithRpcPromise(_0x0438('0x8e'),_0x0438('0x8e'),{'event':'rejectmessage','message':_0x2c0a38[_0x0438('0x1c')]},client9002);return _0x4cf57e;}return null;})[_0x0438('0x15')](respondWithResult(_0x5412f5,null))[_0x0438('0x1e')](handleError(_0x5412f5,null));};exports[_0x0438('0x8f')]=function(_0x1e5dc3,_0x5c3195){var _0x4a8068=moment()[_0x0438('0x90')]()[_0x0438('0x91')]();var _0x4c996a=path[_0x0438('0x5f')](config[_0x0438('0x60')],_0x0438('0x92'),_0x0438('0x93'),_0x0438('0x94'));var _0x4afd39=path[_0x0438('0x5f')](config[_0x0438('0x60')],_0x0438('0x92'),_0x0438('0x93'),'attachments');var _0x134a72=util[_0x0438('0x68')](_0x0438('0x95'),_0x4a8068);return db[_0x0438('0x3f')][_0x0438('0x47')]({'where':{'id':_0x1e5dc3[_0x0438('0x45')]['id']},'attributes':['id',_0x0438('0x48'),_0x0438('0x96'),'to','cc','bcc',_0x0438('0x97'),_0x0438('0x98')],'include':_0x1e5dc3[_0x0438('0x31')][_0x0438('0x5e')]?[{'model':db[_0x0438('0x99')],'as':_0x0438('0x9a')}]:undefined})[_0x0438('0x15')](handleEntityNotFound(_0x5c3195,null))[_0x0438('0x15')](function(_0x488ceb){if(_0x488ceb){var _0x128f86=_0x488ceb;var _0x593859={'from':_0x128f86[_0x0438('0x96')],'to':_0x128f86['to'],'subject':_0x128f86['subject'],'html':htmlEntities[_0x0438('0x9b')](_0x128f86[_0x0438('0x48')]),'headers':{'Date':moment(_0x128f86[_0x0438('0x98')])[_0x0438('0x68')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x488ceb['cc']){_0x593859['headers']['Cc']=_0x488ceb['cc'];}if(_0x488ceb['bcc']){_0x593859[_0x0438('0x9c')][_0x0438('0x9d')]=_0x488ceb[_0x0438('0x9e')];}return new BPromise(function(_0x3a9dbf,_0x5bffb3){if(_0x488ceb[_0x0438('0x9a')]){for(var _0x3f4c1e=0x0;_0x3f4c1e<_0x488ceb[_0x0438('0x9a')]['length'];_0x3f4c1e++){var _0x418d75=_0x488ceb[_0x0438('0x9a')][_0x3f4c1e];var _0x2b1dc8=path[_0x0438('0x5f')](_0x4afd39,_0x418d75[_0x0438('0x62')]);if(fs['existsSync'](_0x2b1dc8)){_0x593859[_0x0438('0x5e')][_0x0438('0x9f')]({'name':_0x418d75[_0x0438('0x2b')],'contentType':_0x418d75['type'],'data':fs['readFileSync'](_0x2b1dc8)});}}}emlformat[_0x0438('0xa0')](_0x593859,function(_0x429897,_0x50228e){if(_0x429897)return _0x5bffb3(_0x429897);fs[_0x0438('0xa1')](path[_0x0438('0x5f')](_0x4c996a,_0x134a72),_0x50228e);return _0x3a9dbf(_0x50228e);});});}})[_0x0438('0x15')](function(_0x1e1044){if(_0x1e1044){return _0x5c3195[_0x0438('0x8f')](path[_0x0438('0x5f')](_0x4c996a,_0x134a72),_0x134a72,function(_0xaecb1){if(!_0xaecb1)fs[_0x0438('0xa2')](path[_0x0438('0x5f')](_0x4c996a,_0x134a72));});}})[_0x0438('0x1e')](handleError(_0x5c3195,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index b87634f..a1f6876 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 _0xdfd4=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x285c85,_0x132c21){var _0x2f81cd=function(_0x9b9962){while(--_0x9b9962){_0x285c85['push'](_0x285c85['shift']());}};_0x2f81cd(++_0x132c21);}(_0xdfd4,0x147));var _0x4dfd=function(_0x7c85a,_0x276371){_0x7c85a=_0x7c85a-0x0;var _0x17822a=_0xdfd4[_0x7c85a];return _0x17822a;};'use strict';var EventEmitter=require(_0x4dfd('0x0'));var MailMessage=require(_0x4dfd('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4dfd('0x2'),'afterDestroy':'remove'};function emitEvent(_0x40e70d){return function(_0x2ac37a,_0x11a019,_0x54cd1d){MailMessageEvents[_0x4dfd('0x3')](_0x40e70d+':'+_0x2ac37a['id'],_0x2ac37a);MailMessageEvents[_0x4dfd('0x3')](_0x40e70d,_0x2ac37a);_0x54cd1d(null);};}for(var e in events){if(events[_0x4dfd('0x4')](e)){var event=events[e];MailMessage[_0x4dfd('0x5')](e,emitEvent(event));}}module[_0x4dfd('0x6')]=MailMessageEvents; \ No newline at end of file +var _0x6ec2=['hook','update','remove','emit','hasOwnProperty'];(function(_0x222054,_0x45620f){var _0x5de492=function(_0x8ee7b4){while(--_0x8ee7b4){_0x222054['push'](_0x222054['shift']());}};_0x5de492(++_0x45620f);}(_0x6ec2,0xce));var _0x26ec=function(_0x57bc99,_0x39e6cd){_0x57bc99=_0x57bc99-0x0;var _0x54c1e0=_0x6ec2[_0x57bc99];return _0x54c1e0;};'use strict';var EventEmitter=require('events');var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x26ec('0x0'),'afterDestroy':_0x26ec('0x1')};function emitEvent(_0x4ea3c6){return function(_0x177fd3,_0x357a6d,_0x564785){MailMessageEvents[_0x26ec('0x2')](_0x4ea3c6+':'+_0x177fd3['id'],_0x177fd3);MailMessageEvents[_0x26ec('0x2')](_0x4ea3c6,_0x177fd3);_0x564785(null);};}for(var e in events){if(events[_0x26ec('0x3')](e)){var event=events[e];MailMessage[_0x26ec('0x4')](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 11f4dd3..7ef3976 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 _0x1043=['../../config/logger','api','moment','bluebird','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','toLowerCase','direction','out','secret','isNil','UserId','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x2c22af,_0x2eb697){var _0x152f58=function(_0x4d61ac){while(--_0x4d61ac){_0x2c22af['push'](_0x2c22af['shift']());}};_0x152f58(++_0x2eb697);}(_0x1043,0x108));var _0x3104=function(_0x1ae532,_0x258187){_0x1ae532=_0x1ae532-0x0;var _0x4aa099=_0x1043[_0x1ae532];return _0x4aa099;};'use strict';var _=require(_0x3104('0x0'));var util=require(_0x3104('0x1'));var logger=require(_0x3104('0x2'))(_0x3104('0x3'));var moment=require(_0x3104('0x4'));var BPromise=require(_0x3104('0x5'));var rp=require('request-promise');var htmlToText=require(_0x3104('0x6'));var fs=require('fs');var path=require(_0x3104('0x7'));var rimraf=require(_0x3104('0x8'));var config=require(_0x3104('0x9'));var attributes=require(_0x3104('0xa'));module['exports']=function(_0x34d9fb,_0x151e6e){return _0x34d9fb[_0x3104('0xb')](_0x3104('0xc'),attributes,{'tableName':_0x3104('0xd'),'paranoid':![],'indexes':[{'name':_0x3104('0xe'),'fields':[_0x3104('0xe')]},{'name':_0x3104('0xf'),'fields':[_0x3104('0x10'),_0x3104('0x11')],'type':_0x3104('0x12')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3cc962,_0x50738f,_0x2d7a25){if(_0x3cc962[_0x3104('0x13')]){_0x3cc962[_0x3104('0x10')]=htmlToText[_0x3104('0x14')](_0x3cc962['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2d7a25(null,_0x50738f);},'afterCreate':function(_0x34354e,_0x4c8095,_0x54b7f1){var _0x321199=_0x34d9fb[_0x3104('0x15')];var _0x4b9cb4=_0x34354e[_0x3104('0x16')]({'plain':!![]});if(_0x4b9cb4['direction'][_0x3104('0x17')]()==='in'||_0x4b9cb4[_0x3104('0x18')][_0x3104('0x17')]()===_0x3104('0x19')&&!_0x4b9cb4[_0x3104('0x1a')]&&!_[_0x3104('0x1b')](_0x4b9cb4[_0x3104('0x1c')])){_0x321199['MailInteraction'][_0x3104('0x1d')]({'where':{'id':_0x4b9cb4[_0x3104('0x1e')]}})[_0x3104('0x1f')](function(_0x3b3d7a){if(_0x3b3d7a){_0x3b3d7a[_0x3104('0x20')]({'lastMsgAt':_0x4b9cb4[_0x3104('0x21')],'lastMsgDirection':_0x4b9cb4[_0x3104('0x18')][_0x3104('0x17')]()});}})[_0x3104('0x22')](function(_0x4b9a69){console[_0x3104('0x23')](_0x4b9a69);});}_0x54b7f1();}},'charset':_0x3104('0x24'),'collate':_0x3104('0x25')});}; \ No newline at end of file +var _0xbb87=['rimraf','./mailMessage.attributes','exports','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','toLowerCase','direction','out','isNil','MailInteraction','findOne','MailInteractionId','update','createdAt','error','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','html-to-text'];(function(_0x3a99f4,_0x2a81c1){var _0xea0b42=function(_0x41f533){while(--_0x41f533){_0x3a99f4['push'](_0x3a99f4['shift']());}};_0xea0b42(++_0x2a81c1);}(_0xbb87,0x1bd));var _0x7bb8=function(_0x3823fe,_0x2684c9){_0x3823fe=_0x3823fe-0x0;var _0x555d30=_0xbb87[_0x3823fe];return _0x555d30;};'use strict';var _=require('lodash');var util=require(_0x7bb8('0x0'));var logger=require(_0x7bb8('0x1'))('api');var moment=require(_0x7bb8('0x2'));var BPromise=require(_0x7bb8('0x3'));var rp=require('request-promise');var htmlToText=require(_0x7bb8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7bb8('0x5'));var config=require('../../config/environment');var attributes=require(_0x7bb8('0x6'));module[_0x7bb8('0x7')]=function(_0x455c45,_0x4bf320){return _0x455c45['define'](_0x7bb8('0x8'),attributes,{'tableName':_0x7bb8('0x9'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x7bb8('0xa')]},{'name':_0x7bb8('0xb'),'fields':[_0x7bb8('0xc'),_0x7bb8('0xd')],'type':_0x7bb8('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x342544,_0x319657,_0x13377d){if(_0x342544[_0x7bb8('0xf')]){_0x342544['plainBody']=htmlToText[_0x7bb8('0x10')](_0x342544[_0x7bb8('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x13377d(null,_0x319657);},'afterCreate':function(_0xb897e2,_0x3503d2,_0x268342){var _0x12cc62=_0x455c45[_0x7bb8('0x11')];var _0x24ffb1=_0xb897e2[_0x7bb8('0x12')]({'plain':!![]});if(_0x24ffb1['direction'][_0x7bb8('0x13')]()==='in'||_0x24ffb1[_0x7bb8('0x14')][_0x7bb8('0x13')]()===_0x7bb8('0x15')&&!_0x24ffb1['secret']&&!_[_0x7bb8('0x16')](_0x24ffb1['UserId'])){_0x12cc62[_0x7bb8('0x17')][_0x7bb8('0x18')]({'where':{'id':_0x24ffb1[_0x7bb8('0x19')]}})['then'](function(_0x3e38d5){if(_0x3e38d5){_0x3e38d5[_0x7bb8('0x1a')]({'lastMsgAt':_0x24ffb1[_0x7bb8('0x1b')],'lastMsgDirection':_0x24ffb1[_0x7bb8('0x14')]['toLowerCase']()});}})['catch'](function(_0xc420b9){console[_0x7bb8('0x1c')](_0xc420b9);});}_0x268342();}},'charset':'utf8mb4','collate':_0x7bb8('0x1d')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index a546dde..8cd5599 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 _0xf2e3=['info','request\x20sent','debug','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','MailMessage','create','body','options','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then'];(function(_0x375f9e,_0x2217c7){var _0x4a0e71=function(_0x166af5){while(--_0x166af5){_0x375f9e['push'](_0x375f9e['shift']());}};_0x4a0e71(++_0x2217c7);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xf2e3[_0x7e2eb0];return _0xd92de4;};'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});config[_0x3f2e('0xc')]=_[_0x3f2e('0xd')](config[_0x3f2e('0xc')],{'host':_0x3f2e('0xe'),'port':0x18eb});var socket=require(_0x3f2e('0xf'))(new Redis(config[_0x3f2e('0xc')]));require(_0x3f2e('0x10'))[_0x3f2e('0x11')](socket);function respondWithRpcPromise(_0x21f22b,_0x32902a,_0x1dd9d0){return new BPromise(function(_0x10a392,_0x1bb1dd){return client[_0x3f2e('0x12')](_0x21f22b,_0x1dd9d0)[_0x3f2e('0x13')](function(_0x475cd2){logger[_0x3f2e('0x14')]('MailMessage,\x20%s,\x20%s',_0x32902a,_0x3f2e('0x15'));logger[_0x3f2e('0x16')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x32902a,_0x3f2e('0x15'),JSON[_0x3f2e('0x17')](_0x475cd2));if(_0x475cd2[_0x3f2e('0x18')]){if(_0x475cd2[_0x3f2e('0x18')][_0x3f2e('0x19')]===0x1f4){logger['error'](_0x3f2e('0x1a'),_0x32902a,_0x475cd2[_0x3f2e('0x18')][_0x3f2e('0x1b')]);return _0x1bb1dd(_0x475cd2['error'][_0x3f2e('0x1b')]);}logger[_0x3f2e('0x18')](_0x3f2e('0x1a'),_0x32902a,_0x475cd2[_0x3f2e('0x18')][_0x3f2e('0x1b')]);return _0x10a392(_0x475cd2[_0x3f2e('0x18')][_0x3f2e('0x1b')]);}else{logger[_0x3f2e('0x14')](_0x3f2e('0x1a'),_0x32902a,_0x3f2e('0x15'));_0x10a392(_0x475cd2[_0x3f2e('0x1c')]['message']);}})[_0x3f2e('0x1d')](function(_0x243822){logger[_0x3f2e('0x18')](_0x3f2e('0x1a'),_0x32902a,_0x243822);_0x1bb1dd(_0x243822);});});}exports[_0x3f2e('0x1e')]=function(_0x4eb1e7){var _0x4ba868=this;return new Promise(function(_0x904d94,_0x11f84c){return db[_0x3f2e('0x1f')][_0x3f2e('0x20')](_0x4eb1e7[_0x3f2e('0x21')],{'raw':_0x4eb1e7[_0x3f2e('0x22')]?_0x4eb1e7['options']['raw']===undefined?!![]:![]:!![]})[_0x3f2e('0x13')](function(_0x37dab2){logger['info']('CreateMailMessage',_0x4eb1e7);logger[_0x3f2e('0x16')]('CreateMailMessage',_0x4eb1e7,JSON[_0x3f2e('0x17')](_0x37dab2));_0x904d94(_0x37dab2);})[_0x3f2e('0x1d')](function(_0x515e32){logger['error']('CreateMailMessage',_0x515e32[_0x3f2e('0x1b')],_0x4eb1e7);_0x11f84c(_0x4ba868[_0x3f2e('0x18')](0x1f4,_0x515e32['message']));});});}; \ No newline at end of file +var _0x8f4c=['body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','defaults','localhost','socket.io-emitter','redis','./mailMessage.socket','register','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','create'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x8f4c,0x113));var _0xc8f4=function(_0x25c9ce,_0x10152a){_0x25c9ce=_0x25c9ce-0x0;var _0xcc7ac0=_0x8f4c[_0x25c9ce];return _0xcc7ac0;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var moment=require(_0xc8f4('0x2'));var BPromise=require(_0xc8f4('0x3'));var rs=require(_0xc8f4('0x4'));var fs=require('fs');var Redis=require(_0xc8f4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8f4('0x6'));var logger=require(_0xc8f4('0x7'))(_0xc8f4('0x8'));var config=require('../../config/environment');var jayson=require(_0xc8f4('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xc8f4('0xa')](config['redis'],{'host':_0xc8f4('0xb'),'port':0x18eb});var socket=require(_0xc8f4('0xc'))(new Redis(config[_0xc8f4('0xd')]));require(_0xc8f4('0xe'))[_0xc8f4('0xf')](socket);function respondWithRpcPromise(_0x599de3,_0x38c41b,_0x191b92){return new BPromise(function(_0x2fba62,_0x3a2f8a){return client['request'](_0x599de3,_0x191b92)[_0xc8f4('0x10')](function(_0x52c699){logger[_0xc8f4('0x11')](_0xc8f4('0x12'),_0x38c41b,_0xc8f4('0x13'));logger[_0xc8f4('0x14')](_0xc8f4('0x15'),_0x38c41b,'request\x20sent',JSON[_0xc8f4('0x16')](_0x52c699));if(_0x52c699[_0xc8f4('0x17')]){if(_0x52c699[_0xc8f4('0x17')][_0xc8f4('0x18')]===0x1f4){logger[_0xc8f4('0x17')](_0xc8f4('0x12'),_0x38c41b,_0x52c699['error'][_0xc8f4('0x19')]);return _0x3a2f8a(_0x52c699[_0xc8f4('0x17')][_0xc8f4('0x19')]);}logger[_0xc8f4('0x17')](_0xc8f4('0x12'),_0x38c41b,_0x52c699['error'][_0xc8f4('0x19')]);return _0x2fba62(_0x52c699['error']['message']);}else{logger[_0xc8f4('0x11')](_0xc8f4('0x12'),_0x38c41b,_0xc8f4('0x13'));_0x2fba62(_0x52c699[_0xc8f4('0x1a')][_0xc8f4('0x19')]);}})[_0xc8f4('0x1b')](function(_0x2459ac){logger[_0xc8f4('0x17')](_0xc8f4('0x12'),_0x38c41b,_0x2459ac);_0x3a2f8a(_0x2459ac);});});}exports[_0xc8f4('0x1c')]=function(_0x3cd90c){var _0x3126e5=this;return new Promise(function(_0x22236c,_0x5f3264){return db[_0xc8f4('0x1d')][_0xc8f4('0x1e')](_0x3cd90c[_0xc8f4('0x1f')],{'raw':_0x3cd90c[_0xc8f4('0x20')]?_0x3cd90c[_0xc8f4('0x20')][_0xc8f4('0x21')]===undefined?!![]:![]:!![]})[_0xc8f4('0x10')](function(_0x43eb57){logger['info'](_0xc8f4('0x1c'),_0x3cd90c);logger[_0xc8f4('0x14')](_0xc8f4('0x1c'),_0x3cd90c,JSON[_0xc8f4('0x16')](_0x43eb57));_0x22236c(_0x43eb57);})['catch'](function(_0x39174f){logger['error'](_0xc8f4('0x1c'),_0x39174f['message'],_0x3cd90c);_0x5f3264(_0x3126e5[_0xc8f4('0x17')](0x1f4,_0x39174f[_0xc8f4('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 04dea0f..131486e 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 _0x7399=['./mailMessage.events','save','remove','update','emit','removeListener'];(function(_0x378fc7,_0x5181a3){var _0x44dfec=function(_0x2e0f62){while(--_0x2e0f62){_0x378fc7['push'](_0x378fc7['shift']());}};_0x44dfec(++_0x5181a3);}(_0x7399,0x13e));var _0x9739=function(_0x2a0ad3,_0x3e5795){_0x2a0ad3=_0x2a0ad3-0x0;var _0x1e501b=_0x7399[_0x2a0ad3];return _0x1e501b;};'use strict';var MailMessageEvents=require(_0x9739('0x0'));var events=[_0x9739('0x1'),_0x9739('0x2'),_0x9739('0x3')];function createListener(_0x1f5f1d,_0x14164e){return function(_0x25ead4){_0x14164e[_0x9739('0x4')](_0x1f5f1d,_0x25ead4);};}function removeListener(_0x1fdd94,_0x22b083){return function(){MailMessageEvents[_0x9739('0x5')](_0x1fdd94,_0x22b083);};}exports['register']=function(_0x5f4e38){for(var _0x4eb9a2=0x0,_0x352b32=events['length'];_0x4eb9a2<_0x352b32;_0x4eb9a2++){var _0x31ed10=events[_0x4eb9a2];var _0x5b3564=createListener('mailMessage:'+_0x31ed10,_0x5f4e38);MailMessageEvents['on'](_0x31ed10,_0x5b3564);}}; \ No newline at end of file +var _0xe85b=['update','removeListener','mailMessage:','./mailMessage.events','remove'];(function(_0x41790d,_0x5dff6b){var _0x2de133=function(_0x25f2d0){while(--_0x25f2d0){_0x41790d['push'](_0x41790d['shift']());}};_0x2de133(++_0x5dff6b);}(_0xe85b,0xa3));var _0xbe85=function(_0x232046,_0x575366){_0x232046=_0x232046-0x0;var _0x35059f=_0xe85b[_0x232046];return _0x35059f;};'use strict';var MailMessageEvents=require(_0xbe85('0x0'));var events=['save',_0xbe85('0x1'),_0xbe85('0x2')];function createListener(_0x4a7c95,_0x225093){return function(_0x45ca55){_0x225093['emit'](_0x4a7c95,_0x45ca55);};}function removeListener(_0x30eae7,_0x1830a0){return function(){MailMessageEvents[_0xbe85('0x3')](_0x30eae7,_0x1830a0);};}exports['register']=function(_0x43817f){for(var _0x4e69fc=0x0,_0x22bbe9=events['length'];_0x4e69fc<_0x22bbe9;_0x4e69fc++){var _0x11a52e=events[_0x4e69fc];var _0x512528=createListener(_0xbe85('0x4')+_0x11a52e,_0x43817f);MailMessageEvents['on'](_0x11a52e,_0x512528);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index fb1f145..39f54b5 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 _0xaea8=['multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','/describe','describe','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports'];(function(_0x119055,_0x2a0dc6){var _0x4de03e=function(_0x2031e4){while(--_0x2031e4){_0x119055['push'](_0x119055['shift']());}};_0x4de03e(++_0x2a0dc6);}(_0xaea8,0x134));var _0x8aea=function(_0x40ee65,_0x2bee9d){_0x40ee65=_0x40ee65-0x0;var _0x3355d6=_0xaea8[_0x40ee65];return _0x3355d6;};'use strict';var multer=require(_0x8aea('0x0'));var util=require('util');var path=require(_0x8aea('0x1'));var timeout=require('connect-timeout');var express=require(_0x8aea('0x2'));var router=express['Router']();var fs_extra=require(_0x8aea('0x3'));var auth=require(_0x8aea('0x4'));var interaction=require(_0x8aea('0x5'));var config=require(_0x8aea('0x6'));var controller=require(_0x8aea('0x7'));router[_0x8aea('0x8')]('/',auth[_0x8aea('0x9')](),controller['index']);router['get'](_0x8aea('0xa'),auth['isAuthenticated'](),controller[_0x8aea('0xb')]);router['get']('/:id',auth[_0x8aea('0x9')](),controller[_0x8aea('0xc')]);router['get']('/:id/members',auth[_0x8aea('0x9')](),controller[_0x8aea('0xd')]);router[_0x8aea('0x8')](_0x8aea('0xe'),auth['isAuthenticated'](),controller[_0x8aea('0xf')]);router[_0x8aea('0x8')](_0x8aea('0x10'),auth[_0x8aea('0x9')](),controller[_0x8aea('0x11')]);router[_0x8aea('0x12')]('/',auth[_0x8aea('0x9')](),controller[_0x8aea('0x13')]);router[_0x8aea('0x12')]('/:id/teams',auth[_0x8aea('0x9')](),controller['addTeams']);router[_0x8aea('0x12')](_0x8aea('0x10'),auth['isAuthenticated'](),controller['addAgents']);router[_0x8aea('0x14')](_0x8aea('0x15'),auth['isAuthenticated'](),controller[_0x8aea('0x16')]);router[_0x8aea('0x17')](_0x8aea('0x15'),auth[_0x8aea('0x9')](),controller[_0x8aea('0x18')]);router[_0x8aea('0x17')]('/:id/teams',auth[_0x8aea('0x9')](),controller[_0x8aea('0x19')]);router[_0x8aea('0x17')](_0x8aea('0x10'),auth[_0x8aea('0x9')](),controller[_0x8aea('0x1a')]);module[_0x8aea('0x1b')]=router; \ No newline at end of file +var _0x23b0=['util','path','connect-timeout','express','Router','fs-extra','./mailQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','delete','removeAgents'];(function(_0x585cd8,_0x2882f9){var _0x2e02e8=function(_0x5c35f6){while(--_0x5c35f6){_0x585cd8['push'](_0x585cd8['shift']());}};_0x2e02e8(++_0x2882f9);}(_0x23b0,0x1a9));var _0x023b=function(_0x561b9c,_0x1508fd){_0x561b9c=_0x561b9c-0x0;var _0x1310a5=_0x23b0[_0x561b9c];return _0x1310a5;};'use strict';var multer=require('multer');var util=require(_0x023b('0x0'));var path=require(_0x023b('0x1'));var timeout=require(_0x023b('0x2'));var express=require(_0x023b('0x3'));var router=express[_0x023b('0x4')]();var fs_extra=require(_0x023b('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x023b('0x6'));router['get']('/',auth[_0x023b('0x7')](),controller[_0x023b('0x8')]);router[_0x023b('0x9')](_0x023b('0xa'),auth[_0x023b('0x7')](),controller[_0x023b('0xb')]);router[_0x023b('0x9')](_0x023b('0xc'),auth[_0x023b('0x7')](),controller[_0x023b('0xd')]);router[_0x023b('0x9')]('/:id/members',auth[_0x023b('0x7')](),controller[_0x023b('0xe')]);router[_0x023b('0x9')](_0x023b('0xf'),auth[_0x023b('0x7')](),controller[_0x023b('0x10')]);router[_0x023b('0x9')](_0x023b('0x11'),auth[_0x023b('0x7')](),controller[_0x023b('0x12')]);router[_0x023b('0x13')]('/',auth[_0x023b('0x7')](),controller[_0x023b('0x14')]);router['post']('/:id/teams',auth[_0x023b('0x7')](),controller['addTeams']);router[_0x023b('0x13')](_0x023b('0x11'),auth[_0x023b('0x7')](),controller[_0x023b('0x15')]);router[_0x023b('0x16')](_0x023b('0xc'),auth[_0x023b('0x7')](),controller['update']);router['delete'](_0x023b('0xc'),auth[_0x023b('0x7')](),controller['destroy']);router[_0x023b('0x17')]('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0x023b('0x11'),auth[_0x023b('0x7')](),controller[_0x023b('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index ad25c86..e944309 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 _0xbe6b=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x590b63,_0x14debb){var _0x3c9380=function(_0x58fc67){while(--_0x58fc67){_0x590b63['push'](_0x590b63['shift']());}};_0x3c9380(++_0x14debb);}(_0xbe6b,0xa3));var _0xbbe6=function(_0x570510,_0x29ce42){_0x570510=_0x570510-0x0;var _0x5390be=_0xbe6b[_0x570510];return _0x5390be;};'use strict';var Sequelize=require(_0xbbe6('0x0'));module[_0xbbe6('0x1')]={'name':{'type':Sequelize[_0xbbe6('0x2')],'unique':_0xbbe6('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbbe6('0x2')]},'timeout':{'type':Sequelize[_0xbbe6('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbbe6('0x5')](_0xbbe6('0x6'),_0xbbe6('0x7'),_0xbbe6('0x8'))}}; \ No newline at end of file +var _0x6f02=['roundrobin','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x2ff828,_0x39c817){var _0x1cf996=function(_0x26156){while(--_0x26156){_0x2ff828['push'](_0x2ff828['shift']());}};_0x1cf996(++_0x39c817);}(_0x6f02,0x1c9));var _0x26f0=function(_0x329ba1,_0x3e3c6e){_0x329ba1=_0x329ba1-0x0;var _0x31dc98=_0x6f02[_0x329ba1];return _0x31dc98;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x26f0('0x0')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x26f0('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x26f0('0x2')](_0x26f0('0x3'),_0x26f0('0x4'),_0x26f0('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 66383aa..217a8c0 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 _0x1271=['field','tq.TeamId','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','union','value','removeTeams','removeAgents','userMailQueue:remove','addAgents','ids','omit','getAgents','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','localhost','socket.io-emitter','./mailQueue.socket','register','status','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','MailQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','count','includeAll','findAll','params','keys','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserMailQueue','order','User','agent','mailPause','updatedAt','createdAt','SIP','Team','getTeams','addTeams','Agents','online','voicePause','interface','sequelize','transaction','each','forEach','emit','userMailQueue:save','select'];(function(_0x6196c7,_0x1ec1c4){var _0x5e4b71=function(_0x33b326){while(--_0x33b326){_0x6196c7['push'](_0x6196c7['shift']());}};_0x5e4b71(++_0x1ec1c4);}(_0x1271,0x9a));var _0x1127=function(_0x5ad455,_0x232e39){_0x5ad455=_0x5ad455-0x0;var _0x3e7efe=_0x1271[_0x5ad455];return _0x3e7efe;};'use strict';var emlformat=require(_0x1127('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1127('0x1'));var jsonpatch=require(_0x1127('0x2'));var rp=require(_0x1127('0x3'));var moment=require(_0x1127('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1127('0x5'));var util=require('util');var path=require(_0x1127('0x6'));var sox=require(_0x1127('0x7'));var csv=require('to-csv');var ejs=require(_0x1127('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1127('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1127('0xa'));var deskjs=require(_0x1127('0xb'));var toCsv=require('to-csv');var querystring=require(_0x1127('0xc'));var Papa=require('papaparse');var Redis=require(_0x1127('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x1127('0xe'));var as=require(_0x1127('0xf'));var hardwareService=require(_0x1127('0x10'));var logger=require(_0x1127('0x11'))(_0x1127('0x12'));var utils=require(_0x1127('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x1127('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x1127('0x15'),'port':0x18eb});var socket=require(_0x1127('0x16'))(new Redis(config['redis']));require(_0x1127('0x17'))[_0x1127('0x18')](socket);function respondWithStatusCode(_0x51b315,_0x207eff){_0x207eff=_0x207eff||0xcc;return function(_0x396aa7){if(_0x396aa7){return _0x51b315['sendStatus'](_0x207eff);}return _0x51b315[_0x1127('0x19')](_0x207eff)['end']();};}function respondWithResult(_0x3fdeb8,_0x4ff890){_0x4ff890=_0x4ff890||0xc8;return function(_0xe42d18){if(_0xe42d18){return _0x3fdeb8['status'](_0x4ff890)['json'](_0xe42d18);}};}function respondWithFilteredResult(_0x554717,_0x1fcc62){return function(_0x5dd9e7){if(_0x5dd9e7){var _0x1123ab=typeof _0x1fcc62[_0x1127('0x1a')]===_0x1127('0x1b')&&typeof _0x1fcc62['limit']===_0x1127('0x1b');var _0xd089d8=_0x5dd9e7['count'];var _0xb808ac=_0x1123ab?0x0:_0x1fcc62[_0x1127('0x1a')];var _0x908741=_0x1123ab?_0x5dd9e7['count']:_0x1fcc62['offset']+_0x1fcc62[_0x1127('0x1c')];var _0xde501d;if(_0x908741>=_0xd089d8){_0x908741=_0xd089d8;_0xde501d=0xc8;}else{_0xde501d=0xce;}_0x554717[_0x1127('0x19')](_0xde501d);return _0x554717[_0x1127('0x1d')](_0x1127('0x1e'),_0xb808ac+'-'+_0x908741+'/'+_0xd089d8)['json'](_0x5dd9e7);}return null;};}function patchUpdates(_0x4ef9c4){return function(_0x4d45d9){try{jsonpatch[_0x1127('0x1f')](_0x4d45d9,_0x4ef9c4,!![]);}catch(_0x110113){return BPromise[_0x1127('0x20')](_0x110113);}return _0x4d45d9[_0x1127('0x21')]();};}function saveUpdates(_0x5ddc1e,_0x271eca){return function(_0x49a835){if(_0x49a835){return _0x49a835[_0x1127('0x22')](_0x5ddc1e)[_0x1127('0x23')](function(_0x56506a){return _0x56506a;});}return null;};}function removeEntity(_0x214714,_0x5a2518){return function(_0x74d474){if(_0x74d474){return _0x74d474[_0x1127('0x24')]()['then'](function(){var _0x1bced4=_0x74d474[_0x1127('0x25')]({'plain':!![]});var _0x11a320=_0x1127('0x26');return db[_0x1127('0x27')][_0x1127('0x24')]({'where':{'type':_0x11a320,'resourceId':_0x1bced4['id']}})[_0x1127('0x23')](function(){return _0x74d474;});})[_0x1127('0x23')](function(){_0x214714['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3876fe,_0x2b5175){return function(_0x3d0290){if(!_0x3d0290){_0x3876fe[_0x1127('0x28')](0x194);}return _0x3d0290;};}function handleError(_0x503151,_0x2d44e5){_0x2d44e5=_0x2d44e5||0x1f4;return function(_0x5bb4c7){logger[_0x1127('0x29')](_0x5bb4c7[_0x1127('0x2a')]);if(_0x5bb4c7[_0x1127('0x2b')]){delete _0x5bb4c7[_0x1127('0x2b')];}_0x503151['status'](_0x2d44e5)[_0x1127('0x2c')](_0x5bb4c7);};}exports[_0x1127('0x2d')]=function(_0x27494f,_0x5c0e10){var _0x23c0b4={},_0x3ca19e={},_0x4e8bcd={'count':0x0,'rows':[]};var _0x1a44a1=_[_0x1127('0x2e')](db[_0x1127('0x2f')][_0x1127('0x30')],function(_0xe14a28){return{'name':_0xe14a28[_0x1127('0x31')],'type':_0xe14a28[_0x1127('0x32')][_0x1127('0x33')]};});_0x3ca19e['model']=_[_0x1127('0x2e')](_0x1a44a1,'name');_0x3ca19e[_0x1127('0x34')]=_['keys'](_0x27494f[_0x1127('0x34')]);_0x3ca19e['filters']=_[_0x1127('0x35')](_0x3ca19e[_0x1127('0x36')],_0x3ca19e[_0x1127('0x34')]);_0x23c0b4['attributes']=_[_0x1127('0x35')](_0x3ca19e[_0x1127('0x36')],qs['fields'](_0x27494f['query'][_0x1127('0x37')]));_0x23c0b4['attributes']=_0x23c0b4[_0x1127('0x38')][_0x1127('0x39')]?_0x23c0b4[_0x1127('0x38')]:_0x3ca19e[_0x1127('0x36')];if(!_0x27494f['query'][_0x1127('0x3a')](_0x1127('0x3b'))){_0x23c0b4[_0x1127('0x1c')]=qs['limit'](_0x27494f[_0x1127('0x34')][_0x1127('0x1c')]);_0x23c0b4[_0x1127('0x1a')]=qs[_0x1127('0x1a')](_0x27494f[_0x1127('0x34')][_0x1127('0x1a')]);}_0x23c0b4['order']=qs[_0x1127('0x3c')](_0x27494f[_0x1127('0x34')][_0x1127('0x3c')]);_0x23c0b4[_0x1127('0x3d')]=qs[_0x1127('0x3e')](_[_0x1127('0x3f')](_0x27494f[_0x1127('0x34')],_0x3ca19e[_0x1127('0x3e')]),_0x1a44a1);if(_0x27494f[_0x1127('0x34')][_0x1127('0x40')]){_0x23c0b4[_0x1127('0x3d')]=_[_0x1127('0x41')](_0x23c0b4['where'],{'$or':_[_0x1127('0x2e')](_0x1a44a1,function(_0x23551b){if(_0x23551b[_0x1127('0x32')]!=='VIRTUAL'){var _0x3fe002={};_0x3fe002[_0x23551b[_0x1127('0x2b')]]={'$like':'%'+_0x27494f[_0x1127('0x34')][_0x1127('0x40')]+'%'};return _0x3fe002;}})});}_0x23c0b4=_[_0x1127('0x41')]({},_0x23c0b4,_0x27494f[_0x1127('0x42')]);var _0x4e8196={'where':_0x23c0b4[_0x1127('0x3d')]};return db['MailQueue'][_0x1127('0x43')](_0x4e8196)['then'](function(_0x37db08){_0x4e8bcd[_0x1127('0x43')]=_0x37db08;if(_0x27494f[_0x1127('0x34')][_0x1127('0x44')]){_0x23c0b4['include']=[{'all':!![]}];}return db['MailQueue'][_0x1127('0x45')](_0x23c0b4);})[_0x1127('0x23')](function(_0x2c9da2){_0x4e8bcd['rows']=_0x2c9da2;return _0x4e8bcd;})[_0x1127('0x23')](respondWithFilteredResult(_0x5c0e10,_0x23c0b4))['catch'](handleError(_0x5c0e10,null));};exports['show']=function(_0x550060,_0x2c757a){var _0x12b73f={'raw':!![],'where':{'id':_0x550060[_0x1127('0x46')]['id']}},_0x1dab42={};_0x1dab42[_0x1127('0x36')]=_[_0x1127('0x47')](db[_0x1127('0x2f')][_0x1127('0x30')]);_0x1dab42[_0x1127('0x34')]=_[_0x1127('0x47')](_0x550060[_0x1127('0x34')]);_0x1dab42[_0x1127('0x3e')]=_[_0x1127('0x35')](_0x1dab42[_0x1127('0x36')],_0x1dab42[_0x1127('0x34')]);_0x12b73f[_0x1127('0x38')]=_[_0x1127('0x35')](_0x1dab42[_0x1127('0x36')],qs[_0x1127('0x37')](_0x550060['query']['fields']));_0x12b73f['attributes']=_0x12b73f[_0x1127('0x38')][_0x1127('0x39')]?_0x12b73f['attributes']:_0x1dab42[_0x1127('0x36')];if(_0x550060[_0x1127('0x34')][_0x1127('0x44')]){_0x12b73f[_0x1127('0x48')]=[{'all':!![]}];}_0x12b73f=_[_0x1127('0x41')]({},_0x12b73f,_0x550060[_0x1127('0x42')]);return db[_0x1127('0x2f')]['find'](_0x12b73f)[_0x1127('0x23')](handleEntityNotFound(_0x2c757a,null))['then'](respondWithResult(_0x2c757a,null))['catch'](handleError(_0x2c757a,null));};exports[_0x1127('0x49')]=function(_0x6c8a4f,_0x11f242){return db[_0x1127('0x2f')]['create'](_0x6c8a4f[_0x1127('0x4a')],{})[_0x1127('0x23')](function(_0x35024a){var _0x508b94=_0x6c8a4f['user'][_0x1127('0x25')]({'plain':!![]});if(!_0x508b94)throw new Error(_0x1127('0x4b'));if(_0x508b94[_0x1127('0x4c')]==='user'){var _0x296e0a=_0x35024a[_0x1127('0x25')]({'plain':!![]});var _0x26211b=_0x1127('0x26');return db[_0x1127('0x4d')][_0x1127('0x4e')]({'where':{'name':_0x26211b,'userProfileId':_0x508b94['userProfileId']},'raw':!![]})[_0x1127('0x23')](function(_0x100cae){if(_0x100cae&&_0x100cae[_0x1127('0x4f')]===0x0){return db['UserProfileResource'][_0x1127('0x49')]({'name':_0x296e0a[_0x1127('0x2b')],'resourceId':_0x296e0a['id'],'type':_0x100cae[_0x1127('0x2b')],'sectionId':_0x100cae['id']},{})[_0x1127('0x23')](function(){return _0x35024a;});}else{return _0x35024a;}})[_0x1127('0x50')](function(_0x23f0d4){logger[_0x1127('0x29')](_0x1127('0x51'),_0x23f0d4);throw _0x23f0d4;});}return _0x35024a;})[_0x1127('0x23')](respondWithResult(_0x11f242,0xc9))['catch'](handleError(_0x11f242,null));};exports[_0x1127('0x22')]=function(_0xf3c5dd,_0x42a1e6){if(_0xf3c5dd[_0x1127('0x4a')]['id']){delete _0xf3c5dd[_0x1127('0x4a')]['id'];}return db[_0x1127('0x2f')]['find']({'where':{'id':_0xf3c5dd[_0x1127('0x46')]['id']}})[_0x1127('0x23')](handleEntityNotFound(_0x42a1e6,null))['then'](saveUpdates(_0xf3c5dd[_0x1127('0x4a')],null))[_0x1127('0x23')](respondWithResult(_0x42a1e6,null))[_0x1127('0x50')](handleError(_0x42a1e6,null));};exports[_0x1127('0x24')]=function(_0x5c2c4e,_0x3bad59){return db[_0x1127('0x2f')][_0x1127('0x4e')]({'where':{'id':_0x5c2c4e['params']['id']}})[_0x1127('0x23')](handleEntityNotFound(_0x3bad59,null))[_0x1127('0x23')](removeEntity(_0x3bad59,null))[_0x1127('0x50')](handleError(_0x3bad59,null));};exports[_0x1127('0x52')]=function(_0x42b2ad,_0x1a98b7){return db[_0x1127('0x2f')][_0x1127('0x52')]()[_0x1127('0x23')](respondWithResult(_0x1a98b7,null))[_0x1127('0x50')](handleError(_0x1a98b7,null));};exports[_0x1127('0x53')]=function(_0x4ef71a,_0x18386b,_0x41f095){var _0x14c3a0={'raw':!![],'where':{}},_0x2581e1={},_0x14152c;return db[_0x1127('0x2f')]['findOne']({'where':{'id':_0x4ef71a[_0x1127('0x46')]['id']}})[_0x1127('0x23')](handleEntityNotFound(_0x18386b,null))[_0x1127('0x23')](function(_0x3f2c9c){if(_0x3f2c9c){_0x14152c=_0x3f2c9c[_0x1127('0x25')]({'plain':!![]});_0x2581e1['model']=_[_0x1127('0x47')](db[_0x1127('0x54')]['rawAttributes']);_0x2581e1['query']=_[_0x1127('0x47')](_0x4ef71a[_0x1127('0x34')]);_0x2581e1[_0x1127('0x3e')]=_['intersection'](_0x2581e1[_0x1127('0x36')],_0x2581e1[_0x1127('0x34')]);_0x14c3a0[_0x1127('0x38')]=_[_0x1127('0x35')](_0x2581e1[_0x1127('0x36')],qs[_0x1127('0x37')](_0x4ef71a[_0x1127('0x34')][_0x1127('0x37')]));_0x14c3a0[_0x1127('0x38')]=_0x14c3a0[_0x1127('0x38')][_0x1127('0x39')]?_0x14c3a0[_0x1127('0x38')]:_0x2581e1[_0x1127('0x36')];if(!_0x4ef71a[_0x1127('0x34')][_0x1127('0x3a')](_0x1127('0x3b'))){_0x14c3a0[_0x1127('0x1c')]=qs[_0x1127('0x1c')](_0x4ef71a['query'][_0x1127('0x1c')]);_0x14c3a0[_0x1127('0x1a')]=qs[_0x1127('0x1a')](_0x4ef71a[_0x1127('0x34')]['offset']);}_0x14c3a0[_0x1127('0x55')]=qs['sort'](_0x4ef71a[_0x1127('0x34')][_0x1127('0x3c')]);_0x14c3a0[_0x1127('0x3d')]=qs[_0x1127('0x3e')](_['pick'](_0x4ef71a[_0x1127('0x34')],_0x2581e1['filters']));_0x14c3a0[_0x1127('0x3d')]['MailQueueId']=_0x3f2c9c['id'];if(_0x4ef71a[_0x1127('0x34')][_0x1127('0x40')]){_0x14c3a0['where']=_['merge'](_0x14c3a0[_0x1127('0x3d')],{'$or':_[_0x1127('0x2e')](_0x14c3a0[_0x1127('0x38')],function(_0x1fc5e5){var _0x243e41={};_0x243e41[_0x1fc5e5]={'$like':'%'+_0x4ef71a[_0x1127('0x34')]['filter']+'%'};return _0x243e41;})});}_0x14c3a0=_[_0x1127('0x41')]({},_0x14c3a0,_0x4ef71a[_0x1127('0x42')]);return db[_0x1127('0x54')]['findAll'](_0x14c3a0);}})[_0x1127('0x23')](function(_0x1a73f3){if(_0x1a73f3){return db[_0x1127('0x56')]['findAndCountAll']({'where':{'id':_[_0x1127('0x2e')](_0x1a73f3,'UserId'),'role':_0x1127('0x57')},'attributes':['id',_0x1127('0x2b'),_0x1127('0x58'),_0x1127('0x59'),_0x1127('0x5a')]});}})['then'](function(_0x1e6b1f){if(_0x1e6b1f){return{'count':_0x1e6b1f[_0x1127('0x43')],'rows':_[_0x1127('0x2e')](_0x1e6b1f['rows'],function(_0x53ac01){return{'membername':_0x53ac01[_0x1127('0x2b')],'UserId':_0x53ac01['id'],'queue_name':_0x14152c[_0x1127('0x2b')],'MailQueueId':_0x14152c['id'],'interface':util['format']('%s/%s',_0x1127('0x5b'),_0x53ac01['name']),'penalty':0x0,'paused':_0x53ac01[_0x1127('0x58')],'createdAt':_0x53ac01[_0x1127('0x5a')],'updatedAt':_0x53ac01[_0x1127('0x59')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x18386b,_0x14c3a0))[_0x1127('0x50')](handleError(_0x18386b,null));};exports['getTeams']=function(_0x790ff3,_0x30fc3e,_0x18454d){var _0x486d6e={};var _0x162540={};var _0x7b52e6;var _0x790cf5;return db[_0x1127('0x2f')]['findOne']({'where':{'id':_0x790ff3[_0x1127('0x46')]['id']}})[_0x1127('0x23')](handleEntityNotFound(_0x30fc3e,null))[_0x1127('0x23')](function(_0x4b8fa6){if(_0x4b8fa6){_0x7b52e6=_0x4b8fa6;_0x162540[_0x1127('0x36')]=_[_0x1127('0x47')](db[_0x1127('0x5c')][_0x1127('0x30')]);_0x162540[_0x1127('0x34')]=_[_0x1127('0x47')](_0x790ff3[_0x1127('0x34')]);_0x162540['filters']=_['intersection'](_0x162540[_0x1127('0x36')],_0x162540[_0x1127('0x34')]);_0x486d6e[_0x1127('0x38')]=_['intersection'](_0x162540[_0x1127('0x36')],qs[_0x1127('0x37')](_0x790ff3[_0x1127('0x34')][_0x1127('0x37')]));_0x486d6e[_0x1127('0x38')]=_0x486d6e[_0x1127('0x38')][_0x1127('0x39')]?_0x486d6e[_0x1127('0x38')]:_0x162540[_0x1127('0x36')];_0x486d6e[_0x1127('0x55')]=qs[_0x1127('0x3c')](_0x790ff3[_0x1127('0x34')][_0x1127('0x3c')]);_0x486d6e[_0x1127('0x3d')]=qs['filters'](_[_0x1127('0x3f')](_0x790ff3[_0x1127('0x34')],_0x162540['filters']));if(_0x790ff3[_0x1127('0x34')][_0x1127('0x40')]){_0x486d6e['where']=_[_0x1127('0x41')](_0x486d6e[_0x1127('0x3d')],{'$or':_[_0x1127('0x2e')](_0x486d6e['attributes'],function(_0x7e5700){var _0x3cbcf2={};_0x3cbcf2[_0x7e5700]={'$like':'%'+_0x790ff3['query'][_0x1127('0x40')]+'%'};return _0x3cbcf2;})});}_0x486d6e=_[_0x1127('0x41')]({},_0x486d6e,_0x790ff3[_0x1127('0x42')]);return _0x7b52e6[_0x1127('0x5d')](_0x486d6e);}})[_0x1127('0x23')](function(_0x494eca){if(_0x494eca){_0x790cf5=_0x494eca['length'];if(!_0x790ff3[_0x1127('0x34')][_0x1127('0x3a')]('nolimit')){_0x486d6e[_0x1127('0x1c')]=qs[_0x1127('0x1c')](_0x790ff3[_0x1127('0x34')]['limit']);_0x486d6e[_0x1127('0x1a')]=qs[_0x1127('0x1a')](_0x790ff3[_0x1127('0x34')][_0x1127('0x1a')]);}return _0x7b52e6[_0x1127('0x5d')](_0x486d6e);}})[_0x1127('0x23')](function(_0x177fac){if(_0x177fac){return _0x177fac?{'count':_0x790cf5,'rows':_0x177fac}:null;}})[_0x1127('0x23')](respondWithResult(_0x30fc3e,null))[_0x1127('0x50')](handleError(_0x30fc3e,null));};exports[_0x1127('0x5e')]=function(_0x216253,_0x163b3d,_0x4edd77){var _0x45c1ac=_0x216253[_0x1127('0x4a')]['ids'];return db[_0x1127('0x5c')][_0x1127('0x45')]({'where':{'id':_0x45c1ac},'attributes':['id'],'include':[{'model':db[_0x1127('0x56')],'as':_0x1127('0x5f'),'attributes':['id',_0x1127('0x2b'),_0x1127('0x60'),_0x1127('0x61'),_0x1127('0x62')],'raw':!![]}]})[_0x1127('0x23')](function(_0x46622d){if(_0x46622d){var _0x40e07f=_['flatMap'](_0x46622d,function(_0xd7a358){var _0x3f26bf=_0xd7a358[_0x1127('0x25')]({'plain':!![]});return _0x3f26bf['Agents'];});return db[_0x1127('0x2f')][_0x1127('0x4e')]({'where':{'id':_0x216253[_0x1127('0x46')]['id']}})[_0x1127('0x23')](function(_0x588862){return db[_0x1127('0x63')][_0x1127('0x64')](function(_0x3115a2){return _0x588862[_0x1127('0x5e')](_0x45c1ac,{'transaction':_0x3115a2})[_0x1127('0x23')](function(){return BPromise[_0x1127('0x65')](_0x40e07f,function(_0x1f1f0a){return db[_0x1127('0x54')]['findOrCreate']({'where':{'UserId':_0x1f1f0a['id'],'MailQueueId':_0x216253[_0x1127('0x46')]['id']},'transaction':_0x3115a2});});})['then'](function(){_0x40e07f[_0x1127('0x66')](function(_0x126a9c){socket[_0x1127('0x67')](_0x1127('0x68'),{'UserId':_0x126a9c['id'],'MailQueueId':_0x588862['id']});});});});});}})[_0x1127('0x23')](respondWithStatusCode(_0x163b3d,null))['catch'](handleError(_0x163b3d,null));};exports['removeTeams']=function(_0x4f74fc,_0x22d56e,_0x2490f9){return db[_0x1127('0x5c')][_0x1127('0x45')]({'where':{'id':_0x4f74fc[_0x1127('0x34')]['ids']},'attributes':['id'],'include':[{'model':db[_0x1127('0x56')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x1127('0x23')](handleEntityNotFound(_0x22d56e,null))[_0x1127('0x23')](function(_0x3aae52){var _0x1d69fb=_[_0x1127('0x2e')](_0x3aae52,'id');var _0x9c6b74=[];var _0x5083bd=[];var _0x22fcf8=squel[_0x1127('0x69')]();_0x22fcf8[_0x1127('0x6a')](_0x1127('0x6b'))['from'](_0x1127('0x6c'),'tq')[_0x1127('0x6d')]('user_has_teams','ut',_0x1127('0x6e'))['where'](_0x1127('0x6f'),_0x4f74fc[_0x1127('0x46')]['id']);for(var _0x8084e8=0x0;_0x8084e8<_0x3aae52['length'];_0x8084e8+=0x1){let _0xdde129=_0x3aae52[_0x8084e8];for(var _0x2b3912=0x0;_0x2b3912<_0xdde129[_0x1127('0x5f')]['length'];_0x2b3912+=0x1){let _0x53efa2=_0xdde129['Agents'][_0x2b3912];var _0x34c950=_0x22fcf8[_0x1127('0x70')]();_0x34c950[_0x1127('0x3d')](_0x1127('0x71'),_0x53efa2['id']);_0x5083bd[_0x1127('0x72')](db['sequelize']['query'](_0x34c950[_0x1127('0x73')](),{'type':db[_0x1127('0x63')][_0x1127('0x74')][_0x1127('0x75')]})[_0x1127('0x23')](function(_0x19efb8){if(_0x19efb8[_0x1127('0x39')]===0x1){return _0x53efa2['id'];}else{var _0x355185=_['every'](_[_0x1127('0x2e')](_0x19efb8,_0x1127('0x76')),function(_0xdff4be){return _['includes'](_0x1d69fb,_0xdff4be);});if(_0x355185){return _0x53efa2['id'];}}}));}}return BPromise[_0x1127('0x77')](_0x5083bd)[_0x1127('0x23')](function(_0x44dffd){_0x9c6b74=_(_0x9c6b74)[_0x1127('0x78')](_0x44dffd)['compact']()[_0x1127('0x79')]();return db[_0x1127('0x2f')][_0x1127('0x4e')]({'where':{'id':_0x4f74fc[_0x1127('0x46')]['id']}})['then'](function(_0x3e1ccb){return db[_0x1127('0x63')][_0x1127('0x64')](function(_0x9c6fc2){return _0x3e1ccb[_0x1127('0x7a')](_0x4f74fc['query']['ids'],{'transaction':_0x9c6fc2})[_0x1127('0x23')](function(){if(!_['isEmpty'](_0x9c6b74)){return _0x3e1ccb[_0x1127('0x7b')](_0x9c6b74,{'transaction':_0x9c6fc2});}})['then'](function(){_0x9c6b74[_0x1127('0x66')](function(_0x3cabde){socket[_0x1127('0x67')](_0x1127('0x7c'),{'UserId':_0x3cabde,'MailQueueId':_0x3e1ccb['id']});});});});});});})[_0x1127('0x23')](respondWithStatusCode(_0x22d56e,null))['catch'](handleError(_0x22d56e,null));};exports['addAgents']=function(_0x3d9aae,_0xb5a1d2,_0x3b4685){return db['MailQueue'][_0x1127('0x4e')]({'where':{'id':_0x3d9aae[_0x1127('0x46')]['id']}})[_0x1127('0x23')](handleEntityNotFound(_0xb5a1d2,null))[_0x1127('0x23')](function(_0xf4f872){if(_0xf4f872){return _0xf4f872[_0x1127('0x7d')](_0x3d9aae['body'][_0x1127('0x7e')],_[_0x1127('0x7f')](_0x3d9aae[_0x1127('0x4a')],[_0x1127('0x7e'),'id'])||{})['spread'](function(_0x1c8867){for(var _0x351e6c=0x0;_0x351e6c<_0x3d9aae[_0x1127('0x4a')][_0x1127('0x7e')]['length'];_0x351e6c+=0x1){socket[_0x1127('0x67')](_0x1127('0x68'),{'UserId':Number(_0x3d9aae['body'][_0x1127('0x7e')][_0x351e6c]),'MailQueueId':Number(_0x3d9aae[_0x1127('0x46')]['id'])});}return _0x1c8867;});}})[_0x1127('0x23')](respondWithResult(_0xb5a1d2,null))[_0x1127('0x50')](handleError(_0xb5a1d2,null));};exports['removeAgents']=function(_0x31a971,_0x44a3d9,_0x246fb7){return db[_0x1127('0x2f')][_0x1127('0x4e')]({'where':{'id':_0x31a971[_0x1127('0x46')]['id']}})[_0x1127('0x23')](handleEntityNotFound(_0x44a3d9,null))[_0x1127('0x23')](function(_0x173bd4){if(_0x173bd4){return _0x173bd4['removeAgents'](_0x31a971[_0x1127('0x34')][_0x1127('0x7e')])[_0x1127('0x23')](function(){if(_['isArray'](_0x31a971[_0x1127('0x34')][_0x1127('0x7e')])){for(var _0x48d37b=0x0;_0x48d37b<_0x31a971[_0x1127('0x34')][_0x1127('0x7e')][_0x1127('0x39')];_0x48d37b+=0x1){socket[_0x1127('0x67')](_0x1127('0x7c'),{'UserId':Number(_0x31a971[_0x1127('0x34')][_0x1127('0x7e')][_0x48d37b]),'MailQueueId':Number(_0x31a971[_0x1127('0x46')]['id'])});}}else{socket['emit'](_0x1127('0x7c'),{'UserId':Number(_0x31a971[_0x1127('0x34')][_0x1127('0x7e')]),'MailQueueId':Number(_0x31a971['params']['id'])});}});}})[_0x1127('0x23')](respondWithStatusCode(_0x44a3d9,null))['catch'](handleError(_0x44a3d9,null));};exports[_0x1127('0x80')]=function(_0x57d110,_0x2e99d2,_0x306c13){var _0x910404={};var _0x3656a5={};var _0xdd40b2;var _0x4e8bae;return db[_0x1127('0x2f')][_0x1127('0x81')]({'where':{'id':_0x57d110[_0x1127('0x46')]['id']}})[_0x1127('0x23')](handleEntityNotFound(_0x2e99d2,null))['then'](function(_0x4e95fb){if(_0x4e95fb){_0xdd40b2=_0x4e95fb;_0x3656a5[_0x1127('0x36')]=_['keys'](db[_0x1127('0x56')][_0x1127('0x30')]);_0x3656a5['query']=_['keys'](_0x57d110[_0x1127('0x34')]);_0x3656a5[_0x1127('0x3e')]=_[_0x1127('0x35')](_0x3656a5[_0x1127('0x36')],_0x3656a5[_0x1127('0x34')]);_0x910404[_0x1127('0x38')]=_['intersection'](_0x3656a5['model'],qs['fields'](_0x57d110[_0x1127('0x34')]['fields']));_0x910404[_0x1127('0x38')]=_0x910404[_0x1127('0x38')]['length']?_0x910404[_0x1127('0x38')]:_0x3656a5[_0x1127('0x36')];_0x910404[_0x1127('0x55')]=qs['sort'](_0x57d110[_0x1127('0x34')][_0x1127('0x3c')]);_0x910404[_0x1127('0x3d')]=qs['filters'](_['pick'](_0x57d110['query'],_0x3656a5[_0x1127('0x3e')]));if(_0x57d110['query'][_0x1127('0x40')]){_0x910404[_0x1127('0x3d')]=_[_0x1127('0x41')](_0x910404['where'],{'$or':_[_0x1127('0x2e')](_0x910404[_0x1127('0x38')],function(_0x251d09){var _0x423739={};_0x423739[_0x251d09]={'$like':'%'+_0x57d110[_0x1127('0x34')][_0x1127('0x40')]+'%'};return _0x423739;})});}_0x910404=_[_0x1127('0x41')]({},_0x910404,_0x57d110[_0x1127('0x42')]);return _0xdd40b2[_0x1127('0x80')](_0x910404);}})['then'](function(_0x2228aa){if(_0x2228aa){_0x4e8bae=_0x2228aa['length'];if(!_0x57d110[_0x1127('0x34')][_0x1127('0x3a')](_0x1127('0x3b'))){_0x910404[_0x1127('0x1c')]=qs[_0x1127('0x1c')](_0x57d110['query'][_0x1127('0x1c')]);_0x910404[_0x1127('0x1a')]=qs[_0x1127('0x1a')](_0x57d110[_0x1127('0x34')]['offset']);}return _0xdd40b2['getAgents'](_0x910404);}})[_0x1127('0x23')](function(_0xa04a8e){if(_0xa04a8e){return _0xa04a8e?{'count':_0x4e8bae,'rows':_0xa04a8e}:null;}})[_0x1127('0x23')](respondWithResult(_0x2e99d2,null))[_0x1127('0x50')](handleError(_0x2e99d2,null));}; \ No newline at end of file +var _0xfb00=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','catch','show','params','keys','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserMailQueue','sort','UserId','mailPause','updatedAt','rows','format','%s/%s','SIP','createdAt','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','union','compact','isEmpty','forEach','addAgents','omit','spread','removeAgents','isArray','userMailQueue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','MailQueues','UserProfileResource','error','stack','name','index','MailQueue','rawAttributes','fieldName','type','key','query','filters'];(function(_0x2d5e3f,_0x3805b9){var _0x24a3e3=function(_0x38b804){while(--_0x38b804){_0x2d5e3f['push'](_0x2d5e3f['shift']());}};_0x24a3e3(++_0x3805b9);}(_0xfb00,0x167));var _0x0fb0=function(_0x57e7f8,_0x328bcd){_0x57e7f8=_0x57e7f8-0x0;var _0x39f93b=_0xfb00[_0x57e7f8];return _0x39f93b;};'use strict';var emlformat=require(_0x0fb0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0fb0('0x1'));var jsonpatch=require(_0x0fb0('0x2'));var rp=require(_0x0fb0('0x3'));var moment=require(_0x0fb0('0x4'));var BPromise=require(_0x0fb0('0x5'));var Mustache=require(_0x0fb0('0x6'));var util=require('util');var path=require(_0x0fb0('0x7'));var sox=require(_0x0fb0('0x8'));var csv=require('to-csv');var ejs=require(_0x0fb0('0x9'));var fs=require('fs');var fs_extra=require(_0x0fb0('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0fb0('0xb'));var toCsv=require(_0x0fb0('0xc'));var querystring=require('querystring');var Papa=require(_0x0fb0('0xd'));var Redis=require(_0x0fb0('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0fb0('0xf'));var hardwareService=require(_0x0fb0('0x10'));var logger=require(_0x0fb0('0x11'))(_0x0fb0('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0fb0('0x13'))['db'];config[_0x0fb0('0x14')]=_[_0x0fb0('0x15')](config[_0x0fb0('0x14')],{'host':_0x0fb0('0x16'),'port':0x18eb});var socket=require(_0x0fb0('0x17'))(new Redis(config['redis']));require(_0x0fb0('0x18'))[_0x0fb0('0x19')](socket);function respondWithStatusCode(_0x152bd8,_0x210a73){_0x210a73=_0x210a73||0xcc;return function(_0x156ba2){if(_0x156ba2){return _0x152bd8[_0x0fb0('0x1a')](_0x210a73);}return _0x152bd8[_0x0fb0('0x1b')](_0x210a73)[_0x0fb0('0x1c')]();};}function respondWithResult(_0x3a0248,_0x4747e9){_0x4747e9=_0x4747e9||0xc8;return function(_0x2febef){if(_0x2febef){return _0x3a0248['status'](_0x4747e9)[_0x0fb0('0x1d')](_0x2febef);}};}function respondWithFilteredResult(_0x158397,_0x11c529){return function(_0x2d911a){if(_0x2d911a){var _0x266334=typeof _0x11c529[_0x0fb0('0x1e')]===_0x0fb0('0x1f')&&typeof _0x11c529['limit']===_0x0fb0('0x1f');var _0x55512e=_0x2d911a[_0x0fb0('0x20')];var _0x352587=_0x266334?0x0:_0x11c529[_0x0fb0('0x1e')];var _0x48a360=_0x266334?_0x2d911a['count']:_0x11c529[_0x0fb0('0x1e')]+_0x11c529[_0x0fb0('0x21')];var _0x50f93d;if(_0x48a360>=_0x55512e){_0x48a360=_0x55512e;_0x50f93d=0xc8;}else{_0x50f93d=0xce;}_0x158397[_0x0fb0('0x1b')](_0x50f93d);return _0x158397[_0x0fb0('0x22')](_0x0fb0('0x23'),_0x352587+'-'+_0x48a360+'/'+_0x55512e)[_0x0fb0('0x1d')](_0x2d911a);}return null;};}function patchUpdates(_0x1ac214){return function(_0x8980c){try{jsonpatch[_0x0fb0('0x24')](_0x8980c,_0x1ac214,!![]);}catch(_0x8358ef){return BPromise[_0x0fb0('0x25')](_0x8358ef);}return _0x8980c[_0x0fb0('0x26')]();};}function saveUpdates(_0x47994a,_0x3b2e0a){return function(_0x222081){if(_0x222081){return _0x222081[_0x0fb0('0x27')](_0x47994a)[_0x0fb0('0x28')](function(_0x25f4cd){return _0x25f4cd;});}return null;};}function removeEntity(_0x2ec1f7,_0xed5a56){return function(_0x29e849){if(_0x29e849){return _0x29e849[_0x0fb0('0x29')]()['then'](function(){var _0x21cb89=_0x29e849['get']({'plain':!![]});var _0xa2619a=_0x0fb0('0x2a');return db[_0x0fb0('0x2b')][_0x0fb0('0x29')]({'where':{'type':_0xa2619a,'resourceId':_0x21cb89['id']}})[_0x0fb0('0x28')](function(){return _0x29e849;});})[_0x0fb0('0x28')](function(){_0x2ec1f7['status'](0xcc)[_0x0fb0('0x1c')]();});}};}function handleEntityNotFound(_0x2a5873,_0xd3caf1){return function(_0x21a76d){if(!_0x21a76d){_0x2a5873[_0x0fb0('0x1a')](0x194);}return _0x21a76d;};}function handleError(_0x49b493,_0x496982){_0x496982=_0x496982||0x1f4;return function(_0x5f0b44){logger[_0x0fb0('0x2c')](_0x5f0b44[_0x0fb0('0x2d')]);if(_0x5f0b44[_0x0fb0('0x2e')]){delete _0x5f0b44[_0x0fb0('0x2e')];}_0x49b493['status'](_0x496982)['send'](_0x5f0b44);};}exports[_0x0fb0('0x2f')]=function(_0xa2714c,_0x3e8fd5){var _0x5dc42b={},_0xff2b9a={},_0x1ed651={'count':0x0,'rows':[]};var _0xca48f8=_['map'](db[_0x0fb0('0x30')][_0x0fb0('0x31')],function(_0x43d61d){return{'name':_0x43d61d[_0x0fb0('0x32')],'type':_0x43d61d[_0x0fb0('0x33')][_0x0fb0('0x34')]};});_0xff2b9a['model']=_['map'](_0xca48f8,'name');_0xff2b9a[_0x0fb0('0x35')]=_['keys'](_0xa2714c['query']);_0xff2b9a[_0x0fb0('0x36')]=_[_0x0fb0('0x37')](_0xff2b9a[_0x0fb0('0x38')],_0xff2b9a['query']);_0x5dc42b[_0x0fb0('0x39')]=_[_0x0fb0('0x37')](_0xff2b9a[_0x0fb0('0x38')],qs[_0x0fb0('0x3a')](_0xa2714c[_0x0fb0('0x35')][_0x0fb0('0x3a')]));_0x5dc42b['attributes']=_0x5dc42b[_0x0fb0('0x39')][_0x0fb0('0x3b')]?_0x5dc42b[_0x0fb0('0x39')]:_0xff2b9a[_0x0fb0('0x38')];if(!_0xa2714c[_0x0fb0('0x35')][_0x0fb0('0x3c')](_0x0fb0('0x3d'))){_0x5dc42b[_0x0fb0('0x21')]=qs['limit'](_0xa2714c['query'][_0x0fb0('0x21')]);_0x5dc42b[_0x0fb0('0x1e')]=qs[_0x0fb0('0x1e')](_0xa2714c['query'][_0x0fb0('0x1e')]);}_0x5dc42b[_0x0fb0('0x3e')]=qs['sort'](_0xa2714c[_0x0fb0('0x35')]['sort']);_0x5dc42b[_0x0fb0('0x3f')]=qs[_0x0fb0('0x36')](_[_0x0fb0('0x40')](_0xa2714c[_0x0fb0('0x35')],_0xff2b9a[_0x0fb0('0x36')]),_0xca48f8);if(_0xa2714c['query'][_0x0fb0('0x41')]){_0x5dc42b['where']=_[_0x0fb0('0x42')](_0x5dc42b[_0x0fb0('0x3f')],{'$or':_[_0x0fb0('0x43')](_0xca48f8,function(_0x57461c){if(_0x57461c[_0x0fb0('0x33')]!==_0x0fb0('0x44')){var _0x3e102f={};_0x3e102f[_0x57461c[_0x0fb0('0x2e')]]={'$like':'%'+_0xa2714c[_0x0fb0('0x35')][_0x0fb0('0x41')]+'%'};return _0x3e102f;}})});}_0x5dc42b=_[_0x0fb0('0x42')]({},_0x5dc42b,_0xa2714c[_0x0fb0('0x45')]);var _0x4bf6df={'where':_0x5dc42b['where']};return db[_0x0fb0('0x30')][_0x0fb0('0x20')](_0x4bf6df)['then'](function(_0x430e53){_0x1ed651['count']=_0x430e53;if(_0xa2714c[_0x0fb0('0x35')]['includeAll']){_0x5dc42b[_0x0fb0('0x46')]=[{'all':!![]}];}return db['MailQueue'][_0x0fb0('0x47')](_0x5dc42b);})[_0x0fb0('0x28')](function(_0x10680a){_0x1ed651['rows']=_0x10680a;return _0x1ed651;})[_0x0fb0('0x28')](respondWithFilteredResult(_0x3e8fd5,_0x5dc42b))[_0x0fb0('0x48')](handleError(_0x3e8fd5,null));};exports[_0x0fb0('0x49')]=function(_0x757b7d,_0x26ea0c){var _0x5553d2={'raw':!![],'where':{'id':_0x757b7d[_0x0fb0('0x4a')]['id']}},_0x1ae094={};_0x1ae094[_0x0fb0('0x38')]=_[_0x0fb0('0x4b')](db[_0x0fb0('0x30')][_0x0fb0('0x31')]);_0x1ae094[_0x0fb0('0x35')]=_['keys'](_0x757b7d[_0x0fb0('0x35')]);_0x1ae094['filters']=_[_0x0fb0('0x37')](_0x1ae094[_0x0fb0('0x38')],_0x1ae094[_0x0fb0('0x35')]);_0x5553d2[_0x0fb0('0x39')]=_[_0x0fb0('0x37')](_0x1ae094[_0x0fb0('0x38')],qs[_0x0fb0('0x3a')](_0x757b7d[_0x0fb0('0x35')][_0x0fb0('0x3a')]));_0x5553d2[_0x0fb0('0x39')]=_0x5553d2['attributes'][_0x0fb0('0x3b')]?_0x5553d2['attributes']:_0x1ae094[_0x0fb0('0x38')];if(_0x757b7d[_0x0fb0('0x35')]['includeAll']){_0x5553d2[_0x0fb0('0x46')]=[{'all':!![]}];}_0x5553d2=_['merge']({},_0x5553d2,_0x757b7d[_0x0fb0('0x45')]);return db['MailQueue'][_0x0fb0('0x4c')](_0x5553d2)[_0x0fb0('0x28')](handleEntityNotFound(_0x26ea0c,null))[_0x0fb0('0x28')](respondWithResult(_0x26ea0c,null))[_0x0fb0('0x48')](handleError(_0x26ea0c,null));};exports[_0x0fb0('0x4d')]=function(_0x37b8cf,_0x5ad8e5){return db['MailQueue']['create'](_0x37b8cf['body'],{})[_0x0fb0('0x28')](function(_0x5b2671){var _0x58afd0=_0x37b8cf[_0x0fb0('0x4e')][_0x0fb0('0x4f')]({'plain':!![]});if(!_0x58afd0)throw new Error(_0x0fb0('0x50'));if(_0x58afd0[_0x0fb0('0x51')]===_0x0fb0('0x4e')){var _0x5bbf56=_0x5b2671[_0x0fb0('0x4f')]({'plain':!![]});var _0x172e62=_0x0fb0('0x2a');return db['UserProfileSection'][_0x0fb0('0x4c')]({'where':{'name':_0x172e62,'userProfileId':_0x58afd0['userProfileId']},'raw':!![]})[_0x0fb0('0x28')](function(_0x23e16c){if(_0x23e16c&&_0x23e16c['autoAssociation']===0x0){return db[_0x0fb0('0x2b')]['create']({'name':_0x5bbf56[_0x0fb0('0x2e')],'resourceId':_0x5bbf56['id'],'type':_0x23e16c[_0x0fb0('0x2e')],'sectionId':_0x23e16c['id']},{})[_0x0fb0('0x28')](function(){return _0x5b2671;});}else{return _0x5b2671;}})[_0x0fb0('0x48')](function(_0x53fd34){logger[_0x0fb0('0x2c')](_0x0fb0('0x52'),_0x53fd34);throw _0x53fd34;});}return _0x5b2671;})[_0x0fb0('0x28')](respondWithResult(_0x5ad8e5,0xc9))[_0x0fb0('0x48')](handleError(_0x5ad8e5,null));};exports[_0x0fb0('0x27')]=function(_0x305d6b,_0x33e878){if(_0x305d6b[_0x0fb0('0x53')]['id']){delete _0x305d6b[_0x0fb0('0x53')]['id'];}return db['MailQueue'][_0x0fb0('0x4c')]({'where':{'id':_0x305d6b[_0x0fb0('0x4a')]['id']}})[_0x0fb0('0x28')](handleEntityNotFound(_0x33e878,null))['then'](saveUpdates(_0x305d6b[_0x0fb0('0x53')],null))['then'](respondWithResult(_0x33e878,null))['catch'](handleError(_0x33e878,null));};exports['destroy']=function(_0x136cd5,_0x3e0f61){return db[_0x0fb0('0x30')][_0x0fb0('0x4c')]({'where':{'id':_0x136cd5[_0x0fb0('0x4a')]['id']}})[_0x0fb0('0x28')](handleEntityNotFound(_0x3e0f61,null))[_0x0fb0('0x28')](removeEntity(_0x3e0f61,null))[_0x0fb0('0x48')](handleError(_0x3e0f61,null));};exports['describe']=function(_0x577727,_0x33802f){return db[_0x0fb0('0x30')][_0x0fb0('0x54')]()[_0x0fb0('0x28')](respondWithResult(_0x33802f,null))[_0x0fb0('0x48')](handleError(_0x33802f,null));};exports[_0x0fb0('0x55')]=function(_0x3fa17c,_0x59b32a,_0x1f53f4){var _0x5b967d={'raw':!![],'where':{}},_0x90d475={},_0x2ab6d6;return db[_0x0fb0('0x30')][_0x0fb0('0x56')]({'where':{'id':_0x3fa17c['params']['id']}})[_0x0fb0('0x28')](handleEntityNotFound(_0x59b32a,null))[_0x0fb0('0x28')](function(_0x2b0b38){if(_0x2b0b38){_0x2ab6d6=_0x2b0b38[_0x0fb0('0x4f')]({'plain':!![]});_0x90d475[_0x0fb0('0x38')]=_[_0x0fb0('0x4b')](db[_0x0fb0('0x57')][_0x0fb0('0x31')]);_0x90d475['query']=_[_0x0fb0('0x4b')](_0x3fa17c['query']);_0x90d475[_0x0fb0('0x36')]=_[_0x0fb0('0x37')](_0x90d475[_0x0fb0('0x38')],_0x90d475[_0x0fb0('0x35')]);_0x5b967d['attributes']=_[_0x0fb0('0x37')](_0x90d475['model'],qs[_0x0fb0('0x3a')](_0x3fa17c[_0x0fb0('0x35')][_0x0fb0('0x3a')]));_0x5b967d['attributes']=_0x5b967d[_0x0fb0('0x39')][_0x0fb0('0x3b')]?_0x5b967d[_0x0fb0('0x39')]:_0x90d475[_0x0fb0('0x38')];if(!_0x3fa17c[_0x0fb0('0x35')]['hasOwnProperty'](_0x0fb0('0x3d'))){_0x5b967d[_0x0fb0('0x21')]=qs[_0x0fb0('0x21')](_0x3fa17c[_0x0fb0('0x35')][_0x0fb0('0x21')]);_0x5b967d['offset']=qs[_0x0fb0('0x1e')](_0x3fa17c[_0x0fb0('0x35')][_0x0fb0('0x1e')]);}_0x5b967d[_0x0fb0('0x3e')]=qs[_0x0fb0('0x58')](_0x3fa17c[_0x0fb0('0x35')]['sort']);_0x5b967d[_0x0fb0('0x3f')]=qs['filters'](_[_0x0fb0('0x40')](_0x3fa17c[_0x0fb0('0x35')],_0x90d475[_0x0fb0('0x36')]));_0x5b967d[_0x0fb0('0x3f')]['MailQueueId']=_0x2b0b38['id'];if(_0x3fa17c[_0x0fb0('0x35')][_0x0fb0('0x41')]){_0x5b967d[_0x0fb0('0x3f')]=_['merge'](_0x5b967d[_0x0fb0('0x3f')],{'$or':_['map'](_0x5b967d[_0x0fb0('0x39')],function(_0x797700){var _0x3ebec8={};_0x3ebec8[_0x797700]={'$like':'%'+_0x3fa17c['query'][_0x0fb0('0x41')]+'%'};return _0x3ebec8;})});}_0x5b967d=_[_0x0fb0('0x42')]({},_0x5b967d,_0x3fa17c['options']);return db[_0x0fb0('0x57')][_0x0fb0('0x47')](_0x5b967d);}})[_0x0fb0('0x28')](function(_0x3e9c9e){if(_0x3e9c9e){return db['User']['findAndCountAll']({'where':{'id':_[_0x0fb0('0x43')](_0x3e9c9e,_0x0fb0('0x59')),'role':'agent'},'attributes':['id','name',_0x0fb0('0x5a'),_0x0fb0('0x5b'),'createdAt']});}})['then'](function(_0x190c82){if(_0x190c82){return{'count':_0x190c82[_0x0fb0('0x20')],'rows':_[_0x0fb0('0x43')](_0x190c82[_0x0fb0('0x5c')],function(_0x132ffb){return{'membername':_0x132ffb[_0x0fb0('0x2e')],'UserId':_0x132ffb['id'],'queue_name':_0x2ab6d6[_0x0fb0('0x2e')],'MailQueueId':_0x2ab6d6['id'],'interface':util[_0x0fb0('0x5d')](_0x0fb0('0x5e'),_0x0fb0('0x5f'),_0x132ffb['name']),'penalty':0x0,'paused':_0x132ffb[_0x0fb0('0x5a')],'createdAt':_0x132ffb[_0x0fb0('0x60')],'updatedAt':_0x132ffb[_0x0fb0('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0fb0('0x28')](respondWithFilteredResult(_0x59b32a,_0x5b967d))[_0x0fb0('0x48')](handleError(_0x59b32a,null));};exports[_0x0fb0('0x61')]=function(_0x46612c,_0x3a6238,_0x1a65c1){var _0x213aa2={};var _0x2c1d93={};var _0x1e6ac0;var _0x12301a;return db['MailQueue'][_0x0fb0('0x56')]({'where':{'id':_0x46612c[_0x0fb0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3a6238,null))[_0x0fb0('0x28')](function(_0x27ce75){if(_0x27ce75){_0x1e6ac0=_0x27ce75;_0x2c1d93['model']=_[_0x0fb0('0x4b')](db[_0x0fb0('0x62')]['rawAttributes']);_0x2c1d93['query']=_[_0x0fb0('0x4b')](_0x46612c['query']);_0x2c1d93[_0x0fb0('0x36')]=_[_0x0fb0('0x37')](_0x2c1d93[_0x0fb0('0x38')],_0x2c1d93['query']);_0x213aa2[_0x0fb0('0x39')]=_[_0x0fb0('0x37')](_0x2c1d93[_0x0fb0('0x38')],qs[_0x0fb0('0x3a')](_0x46612c[_0x0fb0('0x35')][_0x0fb0('0x3a')]));_0x213aa2[_0x0fb0('0x39')]=_0x213aa2[_0x0fb0('0x39')]['length']?_0x213aa2[_0x0fb0('0x39')]:_0x2c1d93[_0x0fb0('0x38')];_0x213aa2[_0x0fb0('0x3e')]=qs[_0x0fb0('0x58')](_0x46612c['query'][_0x0fb0('0x58')]);_0x213aa2['where']=qs[_0x0fb0('0x36')](_[_0x0fb0('0x40')](_0x46612c['query'],_0x2c1d93['filters']));if(_0x46612c[_0x0fb0('0x35')][_0x0fb0('0x41')]){_0x213aa2[_0x0fb0('0x3f')]=_['merge'](_0x213aa2['where'],{'$or':_[_0x0fb0('0x43')](_0x213aa2[_0x0fb0('0x39')],function(_0x264146){var _0xe5dff5={};_0xe5dff5[_0x264146]={'$like':'%'+_0x46612c[_0x0fb0('0x35')][_0x0fb0('0x41')]+'%'};return _0xe5dff5;})});}_0x213aa2=_['merge']({},_0x213aa2,_0x46612c[_0x0fb0('0x45')]);return _0x1e6ac0['getTeams'](_0x213aa2);}})[_0x0fb0('0x28')](function(_0x5a5bad){if(_0x5a5bad){_0x12301a=_0x5a5bad[_0x0fb0('0x3b')];if(!_0x46612c['query']['hasOwnProperty']('nolimit')){_0x213aa2['limit']=qs[_0x0fb0('0x21')](_0x46612c[_0x0fb0('0x35')][_0x0fb0('0x21')]);_0x213aa2[_0x0fb0('0x1e')]=qs[_0x0fb0('0x1e')](_0x46612c['query'][_0x0fb0('0x1e')]);}return _0x1e6ac0['getTeams'](_0x213aa2);}})['then'](function(_0x4f4e67){if(_0x4f4e67){return _0x4f4e67?{'count':_0x12301a,'rows':_0x4f4e67}:null;}})[_0x0fb0('0x28')](respondWithResult(_0x3a6238,null))[_0x0fb0('0x48')](handleError(_0x3a6238,null));};exports[_0x0fb0('0x63')]=function(_0x494ac8,_0x587e1e,_0x5e9643){var _0x2783b7=_0x494ac8['body'][_0x0fb0('0x64')];return db[_0x0fb0('0x62')][_0x0fb0('0x47')]({'where':{'id':_0x2783b7},'attributes':['id'],'include':[{'model':db[_0x0fb0('0x65')],'as':_0x0fb0('0x66'),'attributes':['id',_0x0fb0('0x2e'),_0x0fb0('0x67'),_0x0fb0('0x68'),'interface'],'raw':!![]}]})[_0x0fb0('0x28')](function(_0x110fb0){if(_0x110fb0){var _0x3a87ca=_[_0x0fb0('0x69')](_0x110fb0,function(_0x6aa9f4){var _0x3ba0d6=_0x6aa9f4['get']({'plain':!![]});return _0x3ba0d6[_0x0fb0('0x66')];});return db[_0x0fb0('0x30')][_0x0fb0('0x4c')]({'where':{'id':_0x494ac8[_0x0fb0('0x4a')]['id']}})[_0x0fb0('0x28')](function(_0x4d3bb0){return db[_0x0fb0('0x6a')][_0x0fb0('0x6b')](function(_0x4f25ee){return _0x4d3bb0[_0x0fb0('0x63')](_0x2783b7,{'transaction':_0x4f25ee})[_0x0fb0('0x28')](function(){return BPromise[_0x0fb0('0x6c')](_0x3a87ca,function(_0x19160a){return db[_0x0fb0('0x57')][_0x0fb0('0x6d')]({'where':{'UserId':_0x19160a['id'],'MailQueueId':_0x494ac8[_0x0fb0('0x4a')]['id']},'transaction':_0x4f25ee});});})['then'](function(){_0x3a87ca['forEach'](function(_0x5b8d6a){socket[_0x0fb0('0x6e')](_0x0fb0('0x6f'),{'UserId':_0x5b8d6a['id'],'MailQueueId':_0x4d3bb0['id']});});});});});}})[_0x0fb0('0x28')](respondWithStatusCode(_0x587e1e,null))[_0x0fb0('0x48')](handleError(_0x587e1e,null));};exports[_0x0fb0('0x70')]=function(_0x23836a,_0x59fb58,_0x24b6df){return db[_0x0fb0('0x62')][_0x0fb0('0x47')]({'where':{'id':_0x23836a[_0x0fb0('0x35')]['ids']},'attributes':['id'],'include':[{'model':db[_0x0fb0('0x65')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0fb0('0x28')](handleEntityNotFound(_0x59fb58,null))['then'](function(_0x2c037d){var _0x3b5317=_[_0x0fb0('0x43')](_0x2c037d,'id');var _0x3c49e2=[];var _0x10f750=[];var _0x2c0803=squel[_0x0fb0('0x71')]();_0x2c0803[_0x0fb0('0x72')](_0x0fb0('0x73'))[_0x0fb0('0x74')]('team_has_mail_queues','tq')[_0x0fb0('0x75')]('user_has_teams','ut',_0x0fb0('0x76'))[_0x0fb0('0x3f')]('MailQueueId\x20=\x20?',_0x23836a[_0x0fb0('0x4a')]['id']);for(var _0xbf6ad=0x0;_0xbf6ad<_0x2c037d[_0x0fb0('0x3b')];_0xbf6ad+=0x1){let _0x1683b1=_0x2c037d[_0xbf6ad];for(var _0x2247ea=0x0;_0x2247ea<_0x1683b1[_0x0fb0('0x66')]['length'];_0x2247ea+=0x1){let _0x38c28e=_0x1683b1[_0x0fb0('0x66')][_0x2247ea];var _0x75c2ca=_0x2c0803[_0x0fb0('0x77')]();_0x75c2ca[_0x0fb0('0x3f')](_0x0fb0('0x78'),_0x38c28e['id']);_0x10f750[_0x0fb0('0x79')](db[_0x0fb0('0x6a')][_0x0fb0('0x35')](_0x75c2ca[_0x0fb0('0x7a')](),{'type':db[_0x0fb0('0x6a')][_0x0fb0('0x7b')][_0x0fb0('0x7c')]})['then'](function(_0x15ad7c){if(_0x15ad7c[_0x0fb0('0x3b')]===0x1){return _0x38c28e['id'];}else{var _0x2da8b3=_[_0x0fb0('0x7d')](_[_0x0fb0('0x43')](_0x15ad7c,'TeamId'),function(_0x46ae85){return _[_0x0fb0('0x7e')](_0x3b5317,_0x46ae85);});if(_0x2da8b3){return _0x38c28e['id'];}}}));}}return BPromise['all'](_0x10f750)[_0x0fb0('0x28')](function(_0x405563){_0x3c49e2=_(_0x3c49e2)[_0x0fb0('0x7f')](_0x405563)[_0x0fb0('0x80')]()['value']();return db[_0x0fb0('0x30')][_0x0fb0('0x4c')]({'where':{'id':_0x23836a[_0x0fb0('0x4a')]['id']}})[_0x0fb0('0x28')](function(_0xb809ec){return db['sequelize']['transaction'](function(_0xf3c23e){return _0xb809ec[_0x0fb0('0x70')](_0x23836a[_0x0fb0('0x35')][_0x0fb0('0x64')],{'transaction':_0xf3c23e})[_0x0fb0('0x28')](function(){if(!_[_0x0fb0('0x81')](_0x3c49e2)){return _0xb809ec['removeAgents'](_0x3c49e2,{'transaction':_0xf3c23e});}})['then'](function(){_0x3c49e2[_0x0fb0('0x82')](function(_0x2b1c05){socket[_0x0fb0('0x6e')]('userMailQueue:remove',{'UserId':_0x2b1c05,'MailQueueId':_0xb809ec['id']});});});});});});})[_0x0fb0('0x28')](respondWithStatusCode(_0x59fb58,null))['catch'](handleError(_0x59fb58,null));};exports[_0x0fb0('0x83')]=function(_0x3da85d,_0x2166ef,_0x2fd147){return db['MailQueue'][_0x0fb0('0x4c')]({'where':{'id':_0x3da85d[_0x0fb0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2166ef,null))[_0x0fb0('0x28')](function(_0x51a595){if(_0x51a595){return _0x51a595[_0x0fb0('0x83')](_0x3da85d[_0x0fb0('0x53')][_0x0fb0('0x64')],_[_0x0fb0('0x84')](_0x3da85d[_0x0fb0('0x53')],[_0x0fb0('0x64'),'id'])||{})[_0x0fb0('0x85')](function(_0x3fa8dd){for(var _0x4710d2=0x0;_0x4710d2<_0x3da85d[_0x0fb0('0x53')][_0x0fb0('0x64')][_0x0fb0('0x3b')];_0x4710d2+=0x1){socket[_0x0fb0('0x6e')](_0x0fb0('0x6f'),{'UserId':Number(_0x3da85d[_0x0fb0('0x53')]['ids'][_0x4710d2]),'MailQueueId':Number(_0x3da85d[_0x0fb0('0x4a')]['id'])});}return _0x3fa8dd;});}})['then'](respondWithResult(_0x2166ef,null))[_0x0fb0('0x48')](handleError(_0x2166ef,null));};exports[_0x0fb0('0x86')]=function(_0x5f2d08,_0x50c810,_0x3ab885){return db[_0x0fb0('0x30')]['find']({'where':{'id':_0x5f2d08[_0x0fb0('0x4a')]['id']}})[_0x0fb0('0x28')](handleEntityNotFound(_0x50c810,null))['then'](function(_0x20fc41){if(_0x20fc41){return _0x20fc41[_0x0fb0('0x86')](_0x5f2d08[_0x0fb0('0x35')][_0x0fb0('0x64')])[_0x0fb0('0x28')](function(){if(_[_0x0fb0('0x87')](_0x5f2d08[_0x0fb0('0x35')][_0x0fb0('0x64')])){for(var _0x1841c0=0x0;_0x1841c0<_0x5f2d08['query'][_0x0fb0('0x64')][_0x0fb0('0x3b')];_0x1841c0+=0x1){socket[_0x0fb0('0x6e')](_0x0fb0('0x88'),{'UserId':Number(_0x5f2d08[_0x0fb0('0x35')][_0x0fb0('0x64')][_0x1841c0]),'MailQueueId':Number(_0x5f2d08[_0x0fb0('0x4a')]['id'])});}}else{socket[_0x0fb0('0x6e')]('userMailQueue:remove',{'UserId':Number(_0x5f2d08[_0x0fb0('0x35')][_0x0fb0('0x64')]),'MailQueueId':Number(_0x5f2d08[_0x0fb0('0x4a')]['id'])});}});}})[_0x0fb0('0x28')](respondWithStatusCode(_0x50c810,null))[_0x0fb0('0x48')](handleError(_0x50c810,null));};exports[_0x0fb0('0x89')]=function(_0x3c6597,_0x5ce294,_0x893d70){var _0x9832f9={};var _0x194068={};var _0x16b1b6;var _0x252026;return db[_0x0fb0('0x30')][_0x0fb0('0x56')]({'where':{'id':_0x3c6597[_0x0fb0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5ce294,null))[_0x0fb0('0x28')](function(_0x34c5eb){if(_0x34c5eb){_0x16b1b6=_0x34c5eb;_0x194068['model']=_['keys'](db[_0x0fb0('0x65')][_0x0fb0('0x31')]);_0x194068[_0x0fb0('0x35')]=_[_0x0fb0('0x4b')](_0x3c6597[_0x0fb0('0x35')]);_0x194068['filters']=_[_0x0fb0('0x37')](_0x194068[_0x0fb0('0x38')],_0x194068[_0x0fb0('0x35')]);_0x9832f9[_0x0fb0('0x39')]=_['intersection'](_0x194068['model'],qs[_0x0fb0('0x3a')](_0x3c6597[_0x0fb0('0x35')]['fields']));_0x9832f9[_0x0fb0('0x39')]=_0x9832f9[_0x0fb0('0x39')][_0x0fb0('0x3b')]?_0x9832f9[_0x0fb0('0x39')]:_0x194068[_0x0fb0('0x38')];_0x9832f9['order']=qs[_0x0fb0('0x58')](_0x3c6597[_0x0fb0('0x35')][_0x0fb0('0x58')]);_0x9832f9[_0x0fb0('0x3f')]=qs[_0x0fb0('0x36')](_['pick'](_0x3c6597[_0x0fb0('0x35')],_0x194068[_0x0fb0('0x36')]));if(_0x3c6597[_0x0fb0('0x35')]['filter']){_0x9832f9['where']=_[_0x0fb0('0x42')](_0x9832f9[_0x0fb0('0x3f')],{'$or':_[_0x0fb0('0x43')](_0x9832f9['attributes'],function(_0x6e0d02){var _0x43752c={};_0x43752c[_0x6e0d02]={'$like':'%'+_0x3c6597[_0x0fb0('0x35')]['filter']+'%'};return _0x43752c;})});}_0x9832f9=_['merge']({},_0x9832f9,_0x3c6597[_0x0fb0('0x45')]);return _0x16b1b6['getAgents'](_0x9832f9);}})[_0x0fb0('0x28')](function(_0x255322){if(_0x255322){_0x252026=_0x255322[_0x0fb0('0x3b')];if(!_0x3c6597[_0x0fb0('0x35')]['hasOwnProperty'](_0x0fb0('0x3d'))){_0x9832f9['limit']=qs['limit'](_0x3c6597['query']['limit']);_0x9832f9['offset']=qs[_0x0fb0('0x1e')](_0x3c6597[_0x0fb0('0x35')][_0x0fb0('0x1e')]);}return _0x16b1b6[_0x0fb0('0x89')](_0x9832f9);}})[_0x0fb0('0x28')](function(_0x310c97){if(_0x310c97){return _0x310c97?{'count':_0x252026,'rows':_0x310c97}:null;}})[_0x0fb0('0x28')](respondWithResult(_0x5ce294,null))['catch'](handleError(_0x5ce294,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index b6d01e6..1ed47a6 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 _0x16dd=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0xa902cb,_0x26f055){var _0x301a0c=function(_0x45f23c){while(--_0x45f23c){_0xa902cb['push'](_0xa902cb['shift']());}};_0x301a0c(++_0x26f055);}(_0x16dd,0xf6));var _0xd16d=function(_0x1677cc,_0x2cf11c){_0x1677cc=_0x1677cc-0x0;var _0x24ed92=_0x16dd[_0x1677cc];return _0x24ed92;};'use strict';var EventEmitter=require(_0xd16d('0x0'));var MailQueue=require(_0xd16d('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xd16d('0x2')](0x0);var events={'afterCreate':_0xd16d('0x3'),'afterUpdate':'update','afterDestroy':_0xd16d('0x4')};function emitEvent(_0x2a0c77){return function(_0x3f41d0,_0x7a7da8,_0x144136){MailQueueEvents[_0xd16d('0x5')](_0x2a0c77+':'+_0x3f41d0['id'],_0x3f41d0);MailQueueEvents[_0xd16d('0x5')](_0x2a0c77,_0x3f41d0);_0x144136(null);};}for(var e in events){if(events[_0xd16d('0x6')](e)){var event=events[e];MailQueue[_0xd16d('0x7')](e,emitEvent(event));}}module[_0xd16d('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x39a1=['events','MailQueue','update','emit','hasOwnProperty','hook'];(function(_0x53eeac,_0x1babff){var _0x41dddf=function(_0x2e8176){while(--_0x2e8176){_0x53eeac['push'](_0x53eeac['shift']());}};_0x41dddf(++_0x1babff);}(_0x39a1,0x1aa));var _0x139a=function(_0xfa5cfc,_0x5ba4a1){_0xfa5cfc=_0xfa5cfc-0x0;var _0x3fe22a=_0x39a1[_0xfa5cfc];return _0x3fe22a;};'use strict';var EventEmitter=require(_0x139a('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x139a('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x139a('0x2'),'afterDestroy':'remove'};function emitEvent(_0x4a271f){return function(_0x202961,_0x250bea,_0x5b96ee){MailQueueEvents[_0x139a('0x3')](_0x4a271f+':'+_0x202961['id'],_0x202961);MailQueueEvents[_0x139a('0x3')](_0x4a271f,_0x202961);_0x5b96ee(null);};}for(var e in events){if(events[_0x139a('0x4')](e)){var event=events[e];MailQueue[_0x139a('0x5')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 38c03f8..95c21b5 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 _0xabd5=['rimraf','../../config/environment','exports','define','MailQueue','mail_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2d0a4f,_0x88c2f9){var _0x6abede=function(_0x1a7b8f){while(--_0x1a7b8f){_0x2d0a4f['push'](_0x2d0a4f['shift']());}};_0x6abede(++_0x88c2f9);}(_0xabd5,0x6e));var _0x5abd=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xabd5[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0x5abd('0x0'));var util=require('util');var logger=require(_0x5abd('0x1'))(_0x5abd('0x2'));var moment=require(_0x5abd('0x3'));var BPromise=require(_0x5abd('0x4'));var rp=require(_0x5abd('0x5'));var fs=require('fs');var path=require(_0x5abd('0x6'));var rimraf=require(_0x5abd('0x7'));var config=require(_0x5abd('0x8'));var attributes=require('./mailQueue.attributes');module[_0x5abd('0x9')]=function(_0x24bfa0,_0x41693c){return _0x24bfa0[_0x5abd('0xa')](_0x5abd('0xb'),attributes,{'tableName':_0x5abd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b2d=['define','MailQueue','lodash','util','moment','bluebird','rimraf','../../config/environment','exports'];(function(_0x15c0e5,_0x14c1d9){var _0x349ba2=function(_0x3619d2){while(--_0x3619d2){_0x15c0e5['push'](_0x15c0e5['shift']());}};_0x349ba2(++_0x14c1d9);}(_0x9b2d,0x173));var _0xd9b2=function(_0x352695,_0x5b5a67){_0x352695=_0x352695-0x0;var _0x4bbcdf=_0x9b2d[_0x352695];return _0x4bbcdf;};'use strict';var _=require(_0xd9b2('0x0'));var util=require(_0xd9b2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd9b2('0x2'));var BPromise=require(_0xd9b2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd9b2('0x4'));var config=require(_0xd9b2('0x5'));var attributes=require('./mailQueue.attributes');module[_0xd9b2('0x6')]=function(_0x1dbaa3,_0x195825){return _0x1dbaa3[_0xd9b2('0x7')](_0xd9b2('0x8'),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 9b079f5..879eca8 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 _0x767e=['attributes','limit','include','model','map','GetMailQueue','ShowMailQueue','where','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','MailQueue','options','raw'];(function(_0x20e79f,_0x1633b6){var _0x1a846b=function(_0x1d9320){while(--_0x1d9320){_0x20e79f['push'](_0x20e79f['shift']());}};_0x1a846b(++_0x1633b6);}(_0x767e,0x9c));var _0xe767=function(_0x21e0d0,_0x1e0369){_0x21e0d0=_0x21e0d0-0x0;var _0x31a5de=_0x767e[_0x21e0d0];return _0x31a5de;};'use strict';var _=require(_0xe767('0x0'));var util=require(_0xe767('0x1'));var moment=require('moment');var BPromise=require(_0xe767('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe767('0x3'))['db'];var utils=require(_0xe767('0x4'));var logger=require(_0xe767('0x5'))(_0xe767('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe767('0x7')][_0xe767('0x8')]({'port':0x232a});config[_0xe767('0x9')]=_[_0xe767('0xa')](config[_0xe767('0x9')],{'host':_0xe767('0xb'),'port':0x18eb});var socket=require(_0xe767('0xc'))(new Redis(config[_0xe767('0x9')]));require(_0xe767('0xd'))[_0xe767('0xe')](socket);function respondWithRpcPromise(_0x2077bf,_0x73f215,_0x5a2941){return new BPromise(function(_0x499695,_0xe47f98){return client[_0xe767('0xf')](_0x2077bf,_0x5a2941)[_0xe767('0x10')](function(_0xae464){logger[_0xe767('0x11')](_0xe767('0x12'),_0x73f215,'request\x20sent');logger[_0xe767('0x13')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x73f215,_0xe767('0x14'),JSON[_0xe767('0x15')](_0xae464));if(_0xae464[_0xe767('0x16')]){if(_0xae464[_0xe767('0x16')][_0xe767('0x17')]===0x1f4){logger['error']('MailQueue,\x20%s,\x20%s',_0x73f215,_0xae464['error']['message']);return _0xe47f98(_0xae464[_0xe767('0x16')]['message']);}logger['error'](_0xe767('0x12'),_0x73f215,_0xae464[_0xe767('0x16')][_0xe767('0x18')]);return _0x499695(_0xae464[_0xe767('0x16')]['message']);}else{logger[_0xe767('0x11')]('MailQueue,\x20%s,\x20%s',_0x73f215,'request\x20sent');_0x499695(_0xae464['result'][_0xe767('0x18')]);}})[_0xe767('0x19')](function(_0x2e8098){logger[_0xe767('0x16')](_0xe767('0x12'),_0x73f215,_0x2e8098);_0xe47f98(_0x2e8098);});});}exports['GetMailQueue']=function(_0x19264c){var _0xd89d41=this;return new Promise(function(_0x40bca4,_0x50006b){return db[_0xe767('0x1a')]['findAll']({'raw':_0x19264c[_0xe767('0x1b')]?_0x19264c[_0xe767('0x1b')][_0xe767('0x1c')]===undefined?!![]:![]:!![],'where':_0x19264c['options']?_0x19264c[_0xe767('0x1b')]['where']||null:null,'attributes':_0x19264c[_0xe767('0x1b')]?_0x19264c[_0xe767('0x1b')][_0xe767('0x1d')]||null:null,'limit':_0x19264c[_0xe767('0x1b')]?_0x19264c[_0xe767('0x1b')][_0xe767('0x1e')]||null:null,'include':_0x19264c['options']?_0x19264c[_0xe767('0x1b')][_0xe767('0x1f')]?_['map'](_0x19264c['options'][_0xe767('0x1f')],function(_0x34594e){return{'model':db[_0x34594e[_0xe767('0x20')]],'as':_0x34594e['as'],'attributes':_0x34594e[_0xe767('0x1d')],'include':_0x34594e[_0xe767('0x1f')]?_[_0xe767('0x21')](_0x34594e[_0xe767('0x1f')],function(_0x8bb552){return{'model':db[_0x8bb552[_0xe767('0x20')]],'as':_0x8bb552['as'],'attributes':_0x8bb552[_0xe767('0x1d')],'include':_0x8bb552['include']?_[_0xe767('0x21')](_0x8bb552[_0xe767('0x1f')],function(_0x37e27d){return{'model':db[_0x37e27d[_0xe767('0x20')]],'as':_0x37e27d['as'],'attributes':_0x37e27d[_0xe767('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe767('0x10')](function(_0x24db09){logger[_0xe767('0x11')](_0xe767('0x22'),_0x19264c);logger[_0xe767('0x13')](_0xe767('0x22'),_0x19264c,JSON[_0xe767('0x15')](_0x24db09));_0x40bca4(_0x24db09);})[_0xe767('0x19')](function(_0x296d7f){logger['error'](_0xe767('0x22'),_0x296d7f[_0xe767('0x18')],_0x19264c);_0x50006b(_0xd89d41[_0xe767('0x16')](0x1f4,_0x296d7f[_0xe767('0x18')]));});});};exports[_0xe767('0x23')]=function(_0x33d0e0){var _0x11fd14=this;return new Promise(function(_0x4cad01,_0x56fae0){return db['MailQueue']['find']({'raw':_0x33d0e0[_0xe767('0x1b')]?_0x33d0e0['options']['raw']===undefined?!![]:![]:!![],'where':_0x33d0e0[_0xe767('0x1b')]?_0x33d0e0['options'][_0xe767('0x24')]||null:null,'attributes':_0x33d0e0['options']?_0x33d0e0[_0xe767('0x1b')]['attributes']||null:null,'include':_0x33d0e0['options']?_0x33d0e0[_0xe767('0x1b')][_0xe767('0x1f')]?_['map'](_0x33d0e0[_0xe767('0x1b')][_0xe767('0x1f')],function(_0x141459){return{'model':db[_0x141459['model']],'as':_0x141459['as'],'attributes':_0x141459[_0xe767('0x1d')],'include':_0x141459[_0xe767('0x1f')]?_[_0xe767('0x21')](_0x141459[_0xe767('0x1f')],function(_0x56176d){return{'model':db[_0x56176d[_0xe767('0x20')]],'as':_0x56176d['as'],'attributes':_0x56176d[_0xe767('0x1d')],'include':_0x56176d[_0xe767('0x1f')]?_[_0xe767('0x21')](_0x56176d['include'],function(_0x5735db){return{'model':db[_0x5735db[_0xe767('0x20')]],'as':_0x5735db['as'],'attributes':_0x5735db[_0xe767('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe767('0x10')](function(_0x3e6885){logger[_0xe767('0x11')](_0xe767('0x23'),_0x33d0e0);logger['debug'](_0xe767('0x23'),_0x33d0e0,JSON[_0xe767('0x15')](_0x3e6885));_0x4cad01(_0x3e6885);})[_0xe767('0x19')](function(_0x441c44){logger[_0xe767('0x16')]('ShowMailQueue',_0x441c44[_0xe767('0x18')],_0x33d0e0);_0x56fae0(_0x11fd14['error'](0x1f4,_0x441c44[_0xe767('0x18')]));});});}; \ No newline at end of file +var _0xae8d=['register','request','then','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','GetMailQueue','options','raw','where','limit','include','map','model','attributes','stringify','catch','ShowMailQueue','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket'];(function(_0x415603,_0x21320c){var _0x131e72=function(_0x50092a){while(--_0x50092a){_0x415603['push'](_0x415603['shift']());}};_0x131e72(++_0x21320c);}(_0xae8d,0x94));var _0xdae8=function(_0x5cf767,_0x3f09d1){_0x5cf767=_0x5cf767-0x0;var _0x41d91c=_0xae8d[_0x5cf767];return _0x41d91c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdae8('0x0'));var BPromise=require(_0xdae8('0x1'));var rs=require(_0xdae8('0x2'));var fs=require('fs');var Redis=require(_0xdae8('0x3'));var db=require(_0xdae8('0x4'))['db'];var utils=require(_0xdae8('0x5'));var logger=require(_0xdae8('0x6'))(_0xdae8('0x7'));var config=require(_0xdae8('0x8'));var jayson=require(_0xdae8('0x9'));var client=jayson['client'][_0xdae8('0xa')]({'port':0x232a});config[_0xdae8('0xb')]=_[_0xdae8('0xc')](config['redis'],{'host':_0xdae8('0xd'),'port':0x18eb});var socket=require(_0xdae8('0xe'))(new Redis(config['redis']));require(_0xdae8('0xf'))[_0xdae8('0x10')](socket);function respondWithRpcPromise(_0x316438,_0x462378,_0x1510ba){return new BPromise(function(_0x3ba452,_0x9d433b){return client[_0xdae8('0x11')](_0x316438,_0x1510ba)[_0xdae8('0x12')](function(_0x38006c){logger['info'](_0xdae8('0x13'),_0x462378,_0xdae8('0x14'));logger[_0xdae8('0x15')](_0xdae8('0x16'),_0x462378,_0xdae8('0x14'),JSON['stringify'](_0x38006c));if(_0x38006c[_0xdae8('0x17')]){if(_0x38006c[_0xdae8('0x17')][_0xdae8('0x18')]===0x1f4){logger[_0xdae8('0x17')](_0xdae8('0x13'),_0x462378,_0x38006c[_0xdae8('0x17')][_0xdae8('0x19')]);return _0x9d433b(_0x38006c[_0xdae8('0x17')][_0xdae8('0x19')]);}logger['error']('MailQueue,\x20%s,\x20%s',_0x462378,_0x38006c[_0xdae8('0x17')][_0xdae8('0x19')]);return _0x3ba452(_0x38006c[_0xdae8('0x17')][_0xdae8('0x19')]);}else{logger[_0xdae8('0x1a')](_0xdae8('0x13'),_0x462378,_0xdae8('0x14'));_0x3ba452(_0x38006c[_0xdae8('0x1b')][_0xdae8('0x19')]);}})['catch'](function(_0x3f80d8){logger['error']('MailQueue,\x20%s,\x20%s',_0x462378,_0x3f80d8);_0x9d433b(_0x3f80d8);});});}exports[_0xdae8('0x1c')]=function(_0x58f929){var _0x1f9f04=this;return new Promise(function(_0x2c9e26,_0x3413c2){return db['MailQueue']['findAll']({'raw':_0x58f929[_0xdae8('0x1d')]?_0x58f929[_0xdae8('0x1d')][_0xdae8('0x1e')]===undefined?!![]:![]:!![],'where':_0x58f929[_0xdae8('0x1d')]?_0x58f929['options'][_0xdae8('0x1f')]||null:null,'attributes':_0x58f929[_0xdae8('0x1d')]?_0x58f929[_0xdae8('0x1d')]['attributes']||null:null,'limit':_0x58f929[_0xdae8('0x1d')]?_0x58f929[_0xdae8('0x1d')][_0xdae8('0x20')]||null:null,'include':_0x58f929['options']?_0x58f929[_0xdae8('0x1d')][_0xdae8('0x21')]?_[_0xdae8('0x22')](_0x58f929[_0xdae8('0x1d')][_0xdae8('0x21')],function(_0xadd91f){return{'model':db[_0xadd91f[_0xdae8('0x23')]],'as':_0xadd91f['as'],'attributes':_0xadd91f[_0xdae8('0x24')],'include':_0xadd91f[_0xdae8('0x21')]?_[_0xdae8('0x22')](_0xadd91f[_0xdae8('0x21')],function(_0x299c50){return{'model':db[_0x299c50[_0xdae8('0x23')]],'as':_0x299c50['as'],'attributes':_0x299c50[_0xdae8('0x24')],'include':_0x299c50[_0xdae8('0x21')]?_[_0xdae8('0x22')](_0x299c50[_0xdae8('0x21')],function(_0x3f9401){return{'model':db[_0x3f9401[_0xdae8('0x23')]],'as':_0x3f9401['as'],'attributes':_0x3f9401[_0xdae8('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x487d24){logger[_0xdae8('0x1a')](_0xdae8('0x1c'),_0x58f929);logger[_0xdae8('0x15')]('GetMailQueue',_0x58f929,JSON[_0xdae8('0x25')](_0x487d24));_0x2c9e26(_0x487d24);})[_0xdae8('0x26')](function(_0x56aaff){logger[_0xdae8('0x17')](_0xdae8('0x1c'),_0x56aaff['message'],_0x58f929);_0x3413c2(_0x1f9f04['error'](0x1f4,_0x56aaff[_0xdae8('0x19')]));});});};exports[_0xdae8('0x27')]=function(_0x3b3a3d){var _0x586bba=this;return new Promise(function(_0x5852b1,_0x621c5d){return db['MailQueue'][_0xdae8('0x28')]({'raw':_0x3b3a3d[_0xdae8('0x1d')]?_0x3b3a3d[_0xdae8('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3b3a3d['options']?_0x3b3a3d[_0xdae8('0x1d')][_0xdae8('0x1f')]||null:null,'attributes':_0x3b3a3d[_0xdae8('0x1d')]?_0x3b3a3d['options']['attributes']||null:null,'include':_0x3b3a3d[_0xdae8('0x1d')]?_0x3b3a3d['options'][_0xdae8('0x21')]?_[_0xdae8('0x22')](_0x3b3a3d['options']['include'],function(_0x272fdd){return{'model':db[_0x272fdd[_0xdae8('0x23')]],'as':_0x272fdd['as'],'attributes':_0x272fdd['attributes'],'include':_0x272fdd[_0xdae8('0x21')]?_[_0xdae8('0x22')](_0x272fdd[_0xdae8('0x21')],function(_0x5eecac){return{'model':db[_0x5eecac[_0xdae8('0x23')]],'as':_0x5eecac['as'],'attributes':_0x5eecac[_0xdae8('0x24')],'include':_0x5eecac['include']?_[_0xdae8('0x22')](_0x5eecac[_0xdae8('0x21')],function(_0x25dcc1){return{'model':db[_0x25dcc1[_0xdae8('0x23')]],'as':_0x25dcc1['as'],'attributes':_0x25dcc1[_0xdae8('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2bf6f8){logger['info'](_0xdae8('0x27'),_0x3b3a3d);logger[_0xdae8('0x15')]('ShowMailQueue',_0x3b3a3d,JSON[_0xdae8('0x25')](_0x2bf6f8));_0x5852b1(_0x2bf6f8);})['catch'](function(_0x340309){logger[_0xdae8('0x17')](_0xdae8('0x27'),_0x340309['message'],_0x3b3a3d);_0x621c5d(_0x586bba[_0xdae8('0x17')](0x1f4,_0x340309['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 9030b27..18c18ee 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 _0xcbf0=['mailQueue:','./mailQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x243172,_0x3386fd){var _0x9ff5ef=function(_0x349dec){while(--_0x349dec){_0x243172['push'](_0x243172['shift']());}};_0x9ff5ef(++_0x3386fd);}(_0xcbf0,0xc1));var _0x0cbf=function(_0x216267,_0x9b0723){_0x216267=_0x216267-0x0;var _0x2d5c07=_0xcbf0[_0x216267];return _0x2d5c07;};'use strict';var MailQueueEvents=require(_0x0cbf('0x0'));var events=[_0x0cbf('0x1'),_0x0cbf('0x2'),_0x0cbf('0x3')];function createListener(_0x507948,_0x55d052){return function(_0x415e3d){_0x55d052[_0x0cbf('0x4')](_0x507948,_0x415e3d);};}function removeListener(_0x116ab1,_0x36cbc9){return function(){MailQueueEvents[_0x0cbf('0x5')](_0x116ab1,_0x36cbc9);};}exports[_0x0cbf('0x6')]=function(_0x45f816){for(var _0x4c97cd=0x0,_0x4996b0=events['length'];_0x4c97cd<_0x4996b0;_0x4c97cd++){var _0x17afd6=events[_0x4c97cd];var _0x4a91d8=createListener(_0x0cbf('0x7')+_0x17afd6,_0x45f816);MailQueueEvents['on'](_0x17afd6,_0x4a91d8);}}; \ No newline at end of file +var _0x6aa4=['length','mailQueue:','./mailQueue.events','save','remove','emit','removeListener','register'];(function(_0x19b3a1,_0x23ae25){var _0x567afb=function(_0x1e40f5){while(--_0x1e40f5){_0x19b3a1['push'](_0x19b3a1['shift']());}};_0x567afb(++_0x23ae25);}(_0x6aa4,0xb2));var _0x46aa=function(_0x3bf214,_0x1e8257){_0x3bf214=_0x3bf214-0x0;var _0x242df0=_0x6aa4[_0x3bf214];return _0x242df0;};'use strict';var MailQueueEvents=require(_0x46aa('0x0'));var events=[_0x46aa('0x1'),_0x46aa('0x2'),'update'];function createListener(_0x25cf6a,_0x598ef0){return function(_0x1242ef){_0x598ef0[_0x46aa('0x3')](_0x25cf6a,_0x1242ef);};}function removeListener(_0x3d4a1e,_0x3b47ba){return function(){MailQueueEvents[_0x46aa('0x4')](_0x3d4a1e,_0x3b47ba);};}exports[_0x46aa('0x5')]=function(_0x290f7d){for(var _0x8d685c=0x0,_0x3a7d40=events[_0x46aa('0x6')];_0x8d685c<_0x3a7d40;_0x8d685c++){var _0x482dfb=events[_0x8d685c];var _0x12ad97=createListener(_0x46aa('0x7')+_0x482dfb,_0x290f7d);MailQueueEvents['on'](_0x482dfb,_0x12ad97);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index eb2213e..ad0bdc4 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 _0xda29=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','put','delete','destroy','exports','multer','util'];(function(_0x3402d1,_0x5e2130){var _0x3822a4=function(_0x52539e){while(--_0x52539e){_0x3402d1['push'](_0x3402d1['shift']());}};_0x3822a4(++_0x5e2130);}(_0xda29,0x116));var _0x9da2=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xda29[_0x1a36a5];return _0x746243;};'use strict';var multer=require(_0x9da2('0x0'));var util=require(_0x9da2('0x1'));var path=require(_0x9da2('0x2'));var timeout=require(_0x9da2('0x3'));var express=require(_0x9da2('0x4'));var router=express[_0x9da2('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9da2('0x6'));var interaction=require(_0x9da2('0x7'));var config=require(_0x9da2('0x8'));var controller=require('./mailQueueReport.controller');router['get']('/',auth[_0x9da2('0x9')](),controller[_0x9da2('0xa')]);router[_0x9da2('0xb')](_0x9da2('0xc'),auth[_0x9da2('0x9')](),controller[_0x9da2('0xd')]);router[_0x9da2('0xb')](_0x9da2('0xe'),auth[_0x9da2('0x9')](),controller[_0x9da2('0xf')]);router['post']('/',auth[_0x9da2('0x9')](),controller['create']);router[_0x9da2('0x10')]('/:id',auth[_0x9da2('0x9')](),controller['update']);router[_0x9da2('0x11')](_0x9da2('0xe'),auth[_0x9da2('0x9')](),controller[_0x9da2('0x12')]);module[_0x9da2('0x13')]=router; \ No newline at end of file +var _0x822a=['index','/describe','describe','/:id','show','post','create','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x18c44d,_0x33976d){var _0x71abcf=function(_0x43072b){while(--_0x43072b){_0x18c44d['push'](_0x18c44d['shift']());}};_0x71abcf(++_0x33976d);}(_0x822a,0x87));var _0xa822=function(_0x16bf05,_0x4f70da){_0x16bf05=_0x16bf05-0x0;var _0xbcf546=_0x822a[_0x16bf05];return _0xbcf546;};'use strict';var multer=require(_0xa822('0x0'));var util=require(_0xa822('0x1'));var path=require(_0xa822('0x2'));var timeout=require(_0xa822('0x3'));var express=require(_0xa822('0x4'));var router=express[_0xa822('0x5')]();var fs_extra=require(_0xa822('0x6'));var auth=require(_0xa822('0x7'));var interaction=require(_0xa822('0x8'));var config=require(_0xa822('0x9'));var controller=require('./mailQueueReport.controller');router[_0xa822('0xa')]('/',auth[_0xa822('0xb')](),controller[_0xa822('0xc')]);router[_0xa822('0xa')](_0xa822('0xd'),auth[_0xa822('0xb')](),controller[_0xa822('0xe')]);router[_0xa822('0xa')](_0xa822('0xf'),auth[_0xa822('0xb')](),controller[_0xa822('0x10')]);router[_0xa822('0x11')]('/',auth[_0xa822('0xb')](),controller[_0xa822('0x12')]);router['put'](_0xa822('0xf'),auth[_0xa822('0xb')](),controller[_0xa822('0x13')]);router[_0xa822('0x14')](_0xa822('0xf'),auth[_0xa822('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index f034eaf..703cefa 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 _0xb06b=['STRING','DATE'];(function(_0x357f27,_0x11288e){var _0x33bb47=function(_0x185ba0){while(--_0x185ba0){_0x357f27['push'](_0x357f27['shift']());}};_0x33bb47(++_0x11288e);}(_0xb06b,0x1be));var _0xbb06=function(_0xbd7604,_0x1da4a1){_0xbd7604=_0xbd7604-0x0;var _0x2030b2=_0xb06b[_0xbd7604];return _0x2030b2;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xbb06('0x0')],'allowNull':![]},'from':{'type':Sequelize[_0xbb06('0x0')]},'joinAt':{'type':Sequelize[_0xbb06('0x1')]},'leaveAt':{'type':Sequelize[_0xbb06('0x1')]},'acceptAt':{'type':Sequelize[_0xbb06('0x1')]},'exitAt':{'type':Sequelize[_0xbb06('0x1')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf1ad=['DATE','moment','STRING'];(function(_0xf34895,_0x21fb70){var _0x143f44=function(_0x2e7730){while(--_0x2e7730){_0xf34895['push'](_0xf34895['shift']());}};_0x143f44(++_0x21fb70);}(_0xf1ad,0xe2));var _0xdf1a=function(_0x195a60,_0x5bc667){_0x195a60=_0x195a60-0x0;var _0x83d2d7=_0xf1ad[_0x195a60];return _0x83d2d7;};'use strict';var moment=require(_0xdf1a('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xdf1a('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xdf1a('0x1')]},'joinAt':{'type':Sequelize[_0xdf1a('0x2')]},'leaveAt':{'type':Sequelize[_0xdf1a('0x2')]},'acceptAt':{'type':Sequelize[_0xdf1a('0x2')]},'exitAt':{'type':Sequelize[_0xdf1a('0x2')]},'reason':{'type':Sequelize[_0xdf1a('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index e578924..e72f6f4 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 _0x323f=['model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','type','options','includeAll','include','rows','catch','show','params','keys','create','body','find','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','key'];(function(_0x4c3533,_0x378f98){var _0x4a60cc=function(_0x199a0d){while(--_0x199a0d){_0x4c3533['push'](_0x4c3533['shift']());}};_0x4a60cc(++_0x378f98);}(_0x323f,0x1ee));var _0xf323=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x323f[_0x110c3d];return _0x226d67;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf323('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf323('0x1'));var rp=require(_0xf323('0x2'));var moment=require(_0xf323('0x3'));var BPromise=require(_0xf323('0x4'));var Mustache=require(_0xf323('0x5'));var util=require(_0xf323('0x6'));var path=require(_0xf323('0x7'));var sox=require(_0xf323('0x8'));var csv=require(_0xf323('0x9'));var ejs=require(_0xf323('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf323('0xb'));var squel=require(_0xf323('0xc'));var crypto=require(_0xf323('0xd'));var jsforce=require(_0xf323('0xe'));var deskjs=require(_0xf323('0xf'));var toCsv=require(_0xf323('0x9'));var querystring=require(_0xf323('0x10'));var Papa=require(_0xf323('0x11'));var Redis=require(_0xf323('0x12'));var authService=require(_0xf323('0x13'));var qs=require(_0xf323('0x14'));var as=require(_0xf323('0x15'));var hardwareService=require(_0xf323('0x16'));var logger=require(_0xf323('0x17'))(_0xf323('0x18'));var utils=require(_0xf323('0x19'));var config=require(_0xf323('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xf323('0x1b'))['db'];function respondWithStatusCode(_0x7dbd26,_0x26eddb){_0x26eddb=_0x26eddb||0xcc;return function(_0x56b916){if(_0x56b916){return _0x7dbd26[_0xf323('0x1c')](_0x26eddb);}return _0x7dbd26[_0xf323('0x1d')](_0x26eddb)[_0xf323('0x1e')]();};}function respondWithResult(_0x3a829f,_0x22672e){_0x22672e=_0x22672e||0xc8;return function(_0x144db9){if(_0x144db9){return _0x3a829f['status'](_0x22672e)['json'](_0x144db9);}};}function respondWithFilteredResult(_0x874219,_0x447517){return function(_0x38fd4c){if(_0x38fd4c){var _0x3858ee=typeof _0x447517[_0xf323('0x1f')]==='undefined'&&typeof _0x447517[_0xf323('0x20')]===_0xf323('0x21');var _0xb9859f=_0x38fd4c[_0xf323('0x22')];var _0x49b115=_0x3858ee?0x0:_0x447517[_0xf323('0x1f')];var _0x272aec=_0x3858ee?_0x38fd4c[_0xf323('0x22')]:_0x447517[_0xf323('0x1f')]+_0x447517['limit'];var _0x409b16;if(_0x272aec>=_0xb9859f){_0x272aec=_0xb9859f;_0x409b16=0xc8;}else{_0x409b16=0xce;}_0x874219[_0xf323('0x1d')](_0x409b16);return _0x874219['set'](_0xf323('0x23'),_0x49b115+'-'+_0x272aec+'/'+_0xb9859f)[_0xf323('0x24')](_0x38fd4c);}return null;};}function patchUpdates(_0x32a942){return function(_0x183ce0){try{jsonpatch['apply'](_0x183ce0,_0x32a942,!![]);}catch(_0xdc7891){return BPromise[_0xf323('0x25')](_0xdc7891);}return _0x183ce0[_0xf323('0x26')]();};}function saveUpdates(_0x52305d,_0x43e467){return function(_0x375473){if(_0x375473){return _0x375473[_0xf323('0x27')](_0x52305d)[_0xf323('0x28')](function(_0x13ec1f){return _0x13ec1f;});}return null;};}function removeEntity(_0xa3362c,_0x189b23){return function(_0x43bc05){if(_0x43bc05){return _0x43bc05[_0xf323('0x29')]()['then'](function(){_0xa3362c[_0xf323('0x1d')](0xcc)[_0xf323('0x1e')]();});}};}function handleEntityNotFound(_0x33dc52,_0x292ce0){return function(_0x87ec45){if(!_0x87ec45){_0x33dc52[_0xf323('0x1c')](0x194);}return _0x87ec45;};}function handleError(_0x4d737d,_0x30ed93){_0x30ed93=_0x30ed93||0x1f4;return function(_0x56ce33){logger[_0xf323('0x2a')](_0x56ce33[_0xf323('0x2b')]);if(_0x56ce33['name']){delete _0x56ce33[_0xf323('0x2c')];}_0x4d737d[_0xf323('0x1d')](_0x30ed93)[_0xf323('0x2d')](_0x56ce33);};}exports[_0xf323('0x2e')]=function(_0x46e3b1,_0x5b8b60){var _0x44c944={},_0x34b536={},_0x12c7d5={'count':0x0,'rows':[]};var _0x30a5d7=_[_0xf323('0x2f')](db[_0xf323('0x30')][_0xf323('0x31')],function(_0x1723b7){return{'name':_0x1723b7[_0xf323('0x32')],'type':_0x1723b7['type'][_0xf323('0x33')]};});_0x34b536[_0xf323('0x34')]=_[_0xf323('0x2f')](_0x30a5d7,_0xf323('0x2c'));_0x34b536[_0xf323('0x35')]=_['keys'](_0x46e3b1[_0xf323('0x35')]);_0x34b536[_0xf323('0x36')]=_[_0xf323('0x37')](_0x34b536[_0xf323('0x34')],_0x34b536[_0xf323('0x35')]);_0x44c944['attributes']=_[_0xf323('0x37')](_0x34b536[_0xf323('0x34')],qs[_0xf323('0x38')](_0x46e3b1[_0xf323('0x35')]['fields']));_0x44c944[_0xf323('0x39')]=_0x44c944['attributes'][_0xf323('0x3a')]?_0x44c944[_0xf323('0x39')]:_0x34b536['model'];if(!_0x46e3b1[_0xf323('0x35')]['hasOwnProperty'](_0xf323('0x3b'))){_0x44c944['limit']=qs[_0xf323('0x20')](_0x46e3b1['query'][_0xf323('0x20')]);_0x44c944[_0xf323('0x1f')]=qs['offset'](_0x46e3b1['query']['offset']);}_0x44c944[_0xf323('0x3c')]=qs[_0xf323('0x3d')](_0x46e3b1[_0xf323('0x35')][_0xf323('0x3d')]);_0x44c944[_0xf323('0x3e')]=qs['filters'](_['pick'](_0x46e3b1['query'],_0x34b536[_0xf323('0x36')]),_0x30a5d7);if(_0x46e3b1['query'][_0xf323('0x3f')]){_0x44c944['where']=_[_0xf323('0x40')](_0x44c944[_0xf323('0x3e')],{'$or':_[_0xf323('0x2f')](_0x30a5d7,function(_0x325fa9){if(_0x325fa9[_0xf323('0x41')]!=='VIRTUAL'){var _0x3d8ddb={};_0x3d8ddb[_0x325fa9[_0xf323('0x2c')]]={'$like':'%'+_0x46e3b1[_0xf323('0x35')][_0xf323('0x3f')]+'%'};return _0x3d8ddb;}})});}_0x44c944=_[_0xf323('0x40')]({},_0x44c944,_0x46e3b1[_0xf323('0x42')]);var _0x288428={'where':_0x44c944[_0xf323('0x3e')]};return db[_0xf323('0x30')][_0xf323('0x22')](_0x288428)[_0xf323('0x28')](function(_0x45287b){_0x12c7d5[_0xf323('0x22')]=_0x45287b;if(_0x46e3b1[_0xf323('0x35')][_0xf323('0x43')]){_0x44c944[_0xf323('0x44')]=[{'all':!![]}];}return db['MailQueueReport']['findAll'](_0x44c944);})[_0xf323('0x28')](function(_0x16ac6d){_0x12c7d5[_0xf323('0x45')]=_0x16ac6d;return _0x12c7d5;})[_0xf323('0x28')](respondWithFilteredResult(_0x5b8b60,_0x44c944))[_0xf323('0x46')](handleError(_0x5b8b60,null));};exports[_0xf323('0x47')]=function(_0x2746e3,_0x125047){var _0x1c0136={'raw':!![],'where':{'id':_0x2746e3[_0xf323('0x48')]['id']}},_0x320592={};_0x320592[_0xf323('0x34')]=_[_0xf323('0x49')](db['MailQueueReport'][_0xf323('0x31')]);_0x320592['query']=_['keys'](_0x2746e3[_0xf323('0x35')]);_0x320592['filters']=_['intersection'](_0x320592[_0xf323('0x34')],_0x320592[_0xf323('0x35')]);_0x1c0136[_0xf323('0x39')]=_[_0xf323('0x37')](_0x320592[_0xf323('0x34')],qs[_0xf323('0x38')](_0x2746e3[_0xf323('0x35')][_0xf323('0x38')]));_0x1c0136[_0xf323('0x39')]=_0x1c0136[_0xf323('0x39')][_0xf323('0x3a')]?_0x1c0136['attributes']:_0x320592[_0xf323('0x34')];if(_0x2746e3['query'][_0xf323('0x43')]){_0x1c0136[_0xf323('0x44')]=[{'all':!![]}];}_0x1c0136=_[_0xf323('0x40')]({},_0x1c0136,_0x2746e3[_0xf323('0x42')]);return db['MailQueueReport']['find'](_0x1c0136)[_0xf323('0x28')](handleEntityNotFound(_0x125047,null))['then'](respondWithResult(_0x125047,null))[_0xf323('0x46')](handleError(_0x125047,null));};exports['create']=function(_0x2204f5,_0x8980f){return db['MailQueueReport'][_0xf323('0x4a')](_0x2204f5[_0xf323('0x4b')],{})[_0xf323('0x28')](respondWithResult(_0x8980f,0xc9))[_0xf323('0x46')](handleError(_0x8980f,null));};exports[_0xf323('0x27')]=function(_0x950009,_0x34268e){if(_0x950009[_0xf323('0x4b')]['id']){delete _0x950009[_0xf323('0x4b')]['id'];}return db[_0xf323('0x30')][_0xf323('0x4c')]({'where':{'id':_0x950009[_0xf323('0x48')]['id']}})[_0xf323('0x28')](handleEntityNotFound(_0x34268e,null))['then'](saveUpdates(_0x950009[_0xf323('0x4b')],null))[_0xf323('0x28')](respondWithResult(_0x34268e,null))[_0xf323('0x46')](handleError(_0x34268e,null));};exports[_0xf323('0x29')]=function(_0x190e85,_0x1288b3){return db['MailQueueReport'][_0xf323('0x4c')]({'where':{'id':_0x190e85[_0xf323('0x48')]['id']}})['then'](handleEntityNotFound(_0x1288b3,null))[_0xf323('0x28')](removeEntity(_0x1288b3,null))[_0xf323('0x46')](handleError(_0x1288b3,null));};exports['describe']=function(_0x55754e,_0x46d8fc){return db[_0xf323('0x30')][_0xf323('0x4d')]()[_0xf323('0x28')](respondWithResult(_0x46d8fc,null))[_0xf323('0x46')](handleError(_0x46d8fc,null));}; \ No newline at end of file +var _0x77d4=['save','update','then','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','filter','options','includeAll','findAll','rows','catch','show','params','include','merge','find','create','body','describe','rimraf','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject'];(function(_0x4d5672,_0x4517e7){var _0x4a7aec=function(_0x29cd05){while(--_0x29cd05){_0x4d5672['push'](_0x4d5672['shift']());}};_0x4a7aec(++_0x4517e7);}(_0x77d4,0x108));var _0x477d=function(_0x1d090a,_0x355f6b){_0x1d090a=_0x1d090a-0x0;var _0x2301a1=_0x77d4[_0x1d090a];return _0x2301a1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x477d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x477d('0x1'));var rp=require('request-promise');var moment=require(_0x477d('0x2'));var BPromise=require(_0x477d('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x477d('0x4'));var sox=require(_0x477d('0x5'));var csv=require(_0x477d('0x6'));var ejs=require(_0x477d('0x7'));var fs=require('fs');var fs_extra=require(_0x477d('0x8'));var _=require(_0x477d('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x477d('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x477d('0xb'));var Papa=require(_0x477d('0xc'));var Redis=require(_0x477d('0xd'));var authService=require(_0x477d('0xe'));var qs=require(_0x477d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x477d('0x10'));var logger=require('../../config/logger')(_0x477d('0x11'));var utils=require(_0x477d('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x477d('0x13'));var db=require(_0x477d('0x14'))['db'];function respondWithStatusCode(_0x5a190c,_0x5dd33c){_0x5dd33c=_0x5dd33c||0xcc;return function(_0x6ff724){if(_0x6ff724){return _0x5a190c[_0x477d('0x15')](_0x5dd33c);}return _0x5a190c['status'](_0x5dd33c)[_0x477d('0x16')]();};}function respondWithResult(_0x1d5699,_0x48c73a){_0x48c73a=_0x48c73a||0xc8;return function(_0x4b2021){if(_0x4b2021){return _0x1d5699[_0x477d('0x17')](_0x48c73a)['json'](_0x4b2021);}};}function respondWithFilteredResult(_0x30481f,_0x234b99){return function(_0x25fc02){if(_0x25fc02){var _0x5985b5=typeof _0x234b99[_0x477d('0x18')]===_0x477d('0x19')&&typeof _0x234b99[_0x477d('0x1a')]===_0x477d('0x19');var _0x57b38e=_0x25fc02[_0x477d('0x1b')];var _0x5d5553=_0x5985b5?0x0:_0x234b99[_0x477d('0x18')];var _0x1399d7=_0x5985b5?_0x25fc02[_0x477d('0x1b')]:_0x234b99[_0x477d('0x18')]+_0x234b99[_0x477d('0x1a')];var _0x2145ce;if(_0x1399d7>=_0x57b38e){_0x1399d7=_0x57b38e;_0x2145ce=0xc8;}else{_0x2145ce=0xce;}_0x30481f['status'](_0x2145ce);return _0x30481f[_0x477d('0x1c')]('Content-Range',_0x5d5553+'-'+_0x1399d7+'/'+_0x57b38e)[_0x477d('0x1d')](_0x25fc02);}return null;};}function patchUpdates(_0x24a6d5){return function(_0x40256e){try{jsonpatch[_0x477d('0x1e')](_0x40256e,_0x24a6d5,!![]);}catch(_0x27b3aa){return BPromise[_0x477d('0x1f')](_0x27b3aa);}return _0x40256e[_0x477d('0x20')]();};}function saveUpdates(_0x17154d,_0x45a8bd){return function(_0x5981a){if(_0x5981a){return _0x5981a[_0x477d('0x21')](_0x17154d)[_0x477d('0x22')](function(_0x43c845){return _0x43c845;});}return null;};}function removeEntity(_0x1f3868,_0x4e6a44){return function(_0x4481b0){if(_0x4481b0){return _0x4481b0['destroy']()[_0x477d('0x22')](function(){_0x1f3868[_0x477d('0x17')](0xcc)[_0x477d('0x16')]();});}};}function handleEntityNotFound(_0x2287b4,_0x4bb50e){return function(_0xd6dca5){if(!_0xd6dca5){_0x2287b4[_0x477d('0x15')](0x194);}return _0xd6dca5;};}function handleError(_0x1ca4fe,_0x48ee5e){_0x48ee5e=_0x48ee5e||0x1f4;return function(_0x585648){logger[_0x477d('0x23')](_0x585648[_0x477d('0x24')]);if(_0x585648[_0x477d('0x25')]){delete _0x585648['name'];}_0x1ca4fe[_0x477d('0x17')](_0x48ee5e)[_0x477d('0x26')](_0x585648);};}exports[_0x477d('0x27')]=function(_0xe4dd40,_0x37b332){var _0x537fc4={},_0x2fc959={},_0xeb02f5={'count':0x0,'rows':[]};var _0x17dd16=_[_0x477d('0x28')](db[_0x477d('0x29')][_0x477d('0x2a')],function(_0x180046){return{'name':_0x180046[_0x477d('0x2b')],'type':_0x180046[_0x477d('0x2c')][_0x477d('0x2d')]};});_0x2fc959[_0x477d('0x2e')]=_[_0x477d('0x28')](_0x17dd16,_0x477d('0x25'));_0x2fc959[_0x477d('0x2f')]=_[_0x477d('0x30')](_0xe4dd40[_0x477d('0x2f')]);_0x2fc959[_0x477d('0x31')]=_[_0x477d('0x32')](_0x2fc959[_0x477d('0x2e')],_0x2fc959[_0x477d('0x2f')]);_0x537fc4['attributes']=_[_0x477d('0x32')](_0x2fc959['model'],qs[_0x477d('0x33')](_0xe4dd40[_0x477d('0x2f')][_0x477d('0x33')]));_0x537fc4['attributes']=_0x537fc4[_0x477d('0x34')][_0x477d('0x35')]?_0x537fc4[_0x477d('0x34')]:_0x2fc959[_0x477d('0x2e')];if(!_0xe4dd40[_0x477d('0x2f')][_0x477d('0x36')](_0x477d('0x37'))){_0x537fc4[_0x477d('0x1a')]=qs[_0x477d('0x1a')](_0xe4dd40[_0x477d('0x2f')]['limit']);_0x537fc4[_0x477d('0x18')]=qs[_0x477d('0x18')](_0xe4dd40[_0x477d('0x2f')]['offset']);}_0x537fc4[_0x477d('0x38')]=qs[_0x477d('0x39')](_0xe4dd40[_0x477d('0x2f')]['sort']);_0x537fc4['where']=qs[_0x477d('0x31')](_[_0x477d('0x3a')](_0xe4dd40[_0x477d('0x2f')],_0x2fc959[_0x477d('0x31')]),_0x17dd16);if(_0xe4dd40[_0x477d('0x2f')]['filter']){_0x537fc4[_0x477d('0x3b')]=_['merge'](_0x537fc4[_0x477d('0x3b')],{'$or':_[_0x477d('0x28')](_0x17dd16,function(_0x356f41){if(_0x356f41['type']!=='VIRTUAL'){var _0x184d50={};_0x184d50[_0x356f41[_0x477d('0x25')]]={'$like':'%'+_0xe4dd40[_0x477d('0x2f')][_0x477d('0x3c')]+'%'};return _0x184d50;}})});}_0x537fc4=_['merge']({},_0x537fc4,_0xe4dd40[_0x477d('0x3d')]);var _0xc091e={'where':_0x537fc4[_0x477d('0x3b')]};return db[_0x477d('0x29')][_0x477d('0x1b')](_0xc091e)['then'](function(_0x472149){_0xeb02f5[_0x477d('0x1b')]=_0x472149;if(_0xe4dd40['query'][_0x477d('0x3e')]){_0x537fc4['include']=[{'all':!![]}];}return db[_0x477d('0x29')][_0x477d('0x3f')](_0x537fc4);})[_0x477d('0x22')](function(_0x335b2a){_0xeb02f5[_0x477d('0x40')]=_0x335b2a;return _0xeb02f5;})[_0x477d('0x22')](respondWithFilteredResult(_0x37b332,_0x537fc4))[_0x477d('0x41')](handleError(_0x37b332,null));};exports[_0x477d('0x42')]=function(_0x43ffd1,_0x4c22f5){var _0x5759f={'raw':!![],'where':{'id':_0x43ffd1[_0x477d('0x43')]['id']}},_0x31c9a1={};_0x31c9a1[_0x477d('0x2e')]=_['keys'](db['MailQueueReport'][_0x477d('0x2a')]);_0x31c9a1[_0x477d('0x2f')]=_['keys'](_0x43ffd1[_0x477d('0x2f')]);_0x31c9a1['filters']=_['intersection'](_0x31c9a1[_0x477d('0x2e')],_0x31c9a1[_0x477d('0x2f')]);_0x5759f[_0x477d('0x34')]=_[_0x477d('0x32')](_0x31c9a1[_0x477d('0x2e')],qs[_0x477d('0x33')](_0x43ffd1['query'][_0x477d('0x33')]));_0x5759f[_0x477d('0x34')]=_0x5759f[_0x477d('0x34')][_0x477d('0x35')]?_0x5759f[_0x477d('0x34')]:_0x31c9a1['model'];if(_0x43ffd1['query'][_0x477d('0x3e')]){_0x5759f[_0x477d('0x44')]=[{'all':!![]}];}_0x5759f=_[_0x477d('0x45')]({},_0x5759f,_0x43ffd1['options']);return db[_0x477d('0x29')][_0x477d('0x46')](_0x5759f)[_0x477d('0x22')](handleEntityNotFound(_0x4c22f5,null))[_0x477d('0x22')](respondWithResult(_0x4c22f5,null))[_0x477d('0x41')](handleError(_0x4c22f5,null));};exports[_0x477d('0x47')]=function(_0x13f606,_0x4d4e19){return db[_0x477d('0x29')][_0x477d('0x47')](_0x13f606[_0x477d('0x48')],{})[_0x477d('0x22')](respondWithResult(_0x4d4e19,0xc9))[_0x477d('0x41')](handleError(_0x4d4e19,null));};exports[_0x477d('0x21')]=function(_0x2aad84,_0x30e474){if(_0x2aad84[_0x477d('0x48')]['id']){delete _0x2aad84[_0x477d('0x48')]['id'];}return db[_0x477d('0x29')][_0x477d('0x46')]({'where':{'id':_0x2aad84[_0x477d('0x43')]['id']}})[_0x477d('0x22')](handleEntityNotFound(_0x30e474,null))[_0x477d('0x22')](saveUpdates(_0x2aad84['body'],null))[_0x477d('0x22')](respondWithResult(_0x30e474,null))[_0x477d('0x41')](handleError(_0x30e474,null));};exports['destroy']=function(_0x566ba0,_0x5cb3ca){return db[_0x477d('0x29')][_0x477d('0x46')]({'where':{'id':_0x566ba0[_0x477d('0x43')]['id']}})[_0x477d('0x22')](handleEntityNotFound(_0x5cb3ca,null))[_0x477d('0x22')](removeEntity(_0x5cb3ca,null))[_0x477d('0x41')](handleError(_0x5cb3ca,null));};exports[_0x477d('0x49')]=function(_0x342f18,_0x593faf){return db[_0x477d('0x29')][_0x477d('0x49')]()[_0x477d('0x22')](respondWithResult(_0x593faf,null))[_0x477d('0x41')](handleError(_0x593faf,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index f8abbee..1728fb9 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 _0xcef8=['util','../../config/logger','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','report_mail_queue','uniqueid','lodash'];(function(_0x20a637,_0x2244bb){var _0x17d7bc=function(_0x2a59bd){while(--_0x2a59bd){_0x20a637['push'](_0x20a637['shift']());}};_0x17d7bc(++_0x2244bb);}(_0xcef8,0x8e));var _0x8cef=function(_0x44c3ee,_0x55a3db){_0x44c3ee=_0x44c3ee-0x0;var _0x37bfbc=_0xcef8[_0x44c3ee];return _0x37bfbc;};'use strict';var _=require(_0x8cef('0x0'));var util=require(_0x8cef('0x1'));var logger=require(_0x8cef('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8cef('0x3'));var fs=require('fs');var path=require(_0x8cef('0x4'));var rimraf=require(_0x8cef('0x5'));var config=require(_0x8cef('0x6'));var attributes=require(_0x8cef('0x7'));module[_0x8cef('0x8')]=function(_0x353cc5,_0x2cc907){return _0x353cc5['define']('MailQueueReport',attributes,{'tableName':_0x8cef('0x9'),'paranoid':![],'indexes':[{'name':_0x8cef('0xa'),'fields':[_0x8cef('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x46c1=['api','moment','bluebird','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','util','../../config/logger'];(function(_0x1607e4,_0x48e777){var _0xa25cac=function(_0x380b7c){while(--_0x380b7c){_0x1607e4['push'](_0x1607e4['shift']());}};_0xa25cac(++_0x48e777);}(_0x46c1,0x7c));var _0x146c=function(_0x1ca12d,_0x2bb976){_0x1ca12d=_0x1ca12d-0x0;var _0x3dc560=_0x46c1[_0x1ca12d];return _0x3dc560;};'use strict';var _=require('lodash');var util=require(_0x146c('0x0'));var logger=require(_0x146c('0x1'))(_0x146c('0x2'));var moment=require(_0x146c('0x3'));var BPromise=require(_0x146c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x146c('0x5'));var rimraf=require(_0x146c('0x6'));var config=require(_0x146c('0x7'));var attributes=require(_0x146c('0x8'));module[_0x146c('0x9')]=function(_0x49f94f,_0x5ae2f3){return _0x49f94f[_0x146c('0xa')](_0x146c('0xb'),attributes,{'tableName':_0x146c('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x146c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 9f572e5..c2c7090 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 _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailQueueReport','body','options','raw','stringify','MailQueueReport','update','where','UpdateMailQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x217ab0,_0x1740b8){var _0x2338e8=function(_0x10805a){while(--_0x10805a){_0x217ab0['push'](_0x217ab0['shift']());}};_0x2338e8(++_0x1740b8);}(_0x1261,0x144));var _0x1126=function(_0x2fb866,_0x59bc0c){_0x2fb866=_0x2fb866-0x0;var _0x5d310f=_0x1261[_0x2fb866];return _0x5d310f;};'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')]('MailQueueReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});}exports[_0x1126('0x15')]=function(_0x4a7b49){var _0x4d2b38=this;return new Promise(function(_0x22ae0b,_0x2b2487){return db['MailQueueReport']['create'](_0x4a7b49[_0x1126('0x16')],{'raw':_0x4a7b49['options']?_0x4a7b49[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![]})[_0x1126('0xc')](function(_0x54400a){logger[_0x1126('0xd')]('CreateMailQueueReport',_0x4a7b49);logger['debug'](_0x1126('0x15'),_0x4a7b49,JSON[_0x1126('0x19')](_0x54400a));_0x22ae0b(_0x54400a);})[_0x1126('0x14')](function(_0x36d254){logger['error'](_0x1126('0x15'),_0x36d254[_0x1126('0x13')],_0x4a7b49);_0x2b2487(_0x4d2b38['error'](0x1f4,_0x36d254[_0x1126('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0x529dd9){var _0x4b57ab=this;return new Promise(function(_0x2199d9,_0x15bcc3){return db[_0x1126('0x1a')][_0x1126('0x1b')](_0x529dd9[_0x1126('0x16')],{'raw':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529dd9['options']?_0x529dd9[_0x1126('0x17')][_0x1126('0x1c')]||null:null,'attributes':_0x529dd9[_0x1126('0x17')]?_0x529dd9['options']['attributes']||null:null,'limit':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')]['limit']||null:null})[_0x1126('0xc')](function(_0x23d2bc){logger['info'](_0x1126('0x1d'),_0x529dd9);logger['debug'](_0x1126('0x1d'),_0x529dd9,JSON['stringify'](_0x23d2bc));_0x2199d9(_0x23d2bc);})[_0x1126('0x14')](function(_0x583ce6){logger[_0x1126('0x11')]('UpdateMailQueueReport',_0x583ce6['message'],_0x529dd9);_0x15bcc3(_0x4b57ab['error'](0x1f4,_0x583ce6[_0x1126('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x274188,_0x49c7c8){var _0x24ee5f=function(_0x11188c){while(--_0x11188c){_0x274188['push'](_0x274188['shift']());}};_0x24ee5f(++_0x49c7c8);}(_0x7a54,0x106));var _0x47a5=function(_0x477abc,_0x43b56e){_0x477abc=_0x477abc-0x0;var _0x4b1950=_0x7a54[_0x477abc];return _0x4b1950;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateMailQueueReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateMailQueueReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 5800066..6bd6a0f 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x16299b,_0x30893c){var _0x49500e=function(_0x1f983d){while(--_0x1f983d){_0x16299b['push'](_0x16299b['shift']());}};_0x49500e(++_0x30893c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2fee96,_0x2f735d){_0x2fee96=_0x2fee96-0x0;var _0x2e6ad1=_0xcb91[_0x2fee96];return _0x2e6ad1;};'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(_0x43ca9d,_0x4a6eaa){var _0x2fca74=function(_0x49ee63){while(--_0x49ee63){_0x43ca9d['push'](_0x43ca9d['shift']());}};_0x2fca74(++_0x4a6eaa);}(_0x70e0,0x17b));var _0x070e=function(_0x2427c5,_0x4dbab5){_0x2427c5=_0x2427c5-0x0;var _0x3246b0=_0x70e0[_0x2427c5];return _0x3246b0;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 4307587..1717faf 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 _0xcfb4=['INTEGER','BOOLEAN','INBOX','exports','STRING'];(function(_0x3042fe,_0x3eb1c6){var _0x40a0dc=function(_0x4e9601){while(--_0x4e9601){_0x3042fe['push'](_0x3042fe['shift']());}};_0x40a0dc(++_0x3eb1c6);}(_0xcfb4,0xe9));var _0x4cfb=function(_0x7e5e6,_0x3e0055){_0x7e5e6=_0x7e5e6-0x0;var _0x1434cb=_0xcfb4[_0x7e5e6];return _0x1434cb;};'use strict';var Sequelize=require('sequelize');module[_0x4cfb('0x0')]={'description':{'type':Sequelize[_0x4cfb('0x1')]},'host':{'type':Sequelize[_0x4cfb('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x4cfb('0x1')]},'password':{'type':Sequelize[_0x4cfb('0x1')]},'port':{'type':Sequelize[_0x4cfb('0x2')]},'tls':{'type':Sequelize[_0x4cfb('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x4cfb('0x1')],'defaultValue':_0x4cfb('0x4')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x4cfb('0x2')],'defaultValue':0x5},'service':{'type':Sequelize[_0x4cfb('0x1')]},'modernAuthentication':{'type':Sequelize[_0x4cfb('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x6ceb=['INBOX','sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x49d4b3,_0x99ff57){var _0xb7d2fc=function(_0x4b6915){while(--_0x4b6915){_0x49d4b3['push'](_0x49d4b3['shift']());}};_0xb7d2fc(++_0x99ff57);}(_0x6ceb,0x91));var _0xb6ce=function(_0x433568,_0xec4765){_0x433568=_0x433568-0x0;var _0x39f4f8=_0x6ceb[_0x433568];return _0x39f4f8;};'use strict';var Sequelize=require(_0xb6ce('0x0'));module[_0xb6ce('0x1')]={'description':{'type':Sequelize[_0xb6ce('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0xb6ce('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xb6ce('0x3')]},'tls':{'type':Sequelize[_0xb6ce('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xb6ce('0x2')],'defaultValue':_0xb6ce('0x5')},'connTimeout':{'type':Sequelize[_0xb6ce('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xb6ce('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0xb6ce('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 1da8ee0..230a48b 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 _0x8398=['rimraf','../../config/environment','./mailServerIn.attributes','exports','define','mail_servers_in','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8398,0x1f2));var _0x8839=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x8398[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0x8839('0x0'));var util=require(_0x8839('0x1'));var logger=require(_0x8839('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8839('0x3'));var rp=require(_0x8839('0x4'));var fs=require('fs');var path=require(_0x8839('0x5'));var rimraf=require(_0x8839('0x6'));var config=require(_0x8839('0x7'));var attributes=require(_0x8839('0x8'));module[_0x8839('0x9')]=function(_0x100823,_0x330073){return _0x100823[_0x8839('0xa')]('MailServerIn',attributes,{'tableName':_0x8839('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb17b=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','util'];(function(_0x58f709,_0x29e543){var _0x432ff9=function(_0x2bb67a){while(--_0x2bb67a){_0x58f709['push'](_0x58f709['shift']());}};_0x432ff9(++_0x29e543);}(_0xb17b,0x83));var _0xbb17=function(_0x3fdb79,_0x310ad4){_0x3fdb79=_0x3fdb79-0x0;var _0x132d1d=_0xb17b[_0x3fdb79];return _0x132d1d;};'use strict';var _=require('lodash');var util=require(_0xbb17('0x0'));var logger=require(_0xbb17('0x1'))(_0xbb17('0x2'));var moment=require('moment');var BPromise=require(_0xbb17('0x3'));var rp=require(_0xbb17('0x4'));var fs=require('fs');var path=require(_0xbb17('0x5'));var rimraf=require('rimraf');var config=require(_0xbb17('0x6'));var attributes=require(_0xbb17('0x7'));module[_0xbb17('0x8')]=function(_0x4bfb97,_0x1a3e5e){return _0x4bfb97[_0xbb17('0x9')](_0xbb17('0xa'),attributes,{'tableName':_0xbb17('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 d8a077d..2135ba9 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 _0x9909=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetMailServerIn','stringify','util','moment'];(function(_0x3bec61,_0x3a04b8){var _0x4bf6d2=function(_0x51e312){while(--_0x51e312){_0x3bec61['push'](_0x3bec61['shift']());}};_0x4bf6d2(++_0x3a04b8);}(_0x9909,0x9e));var _0x9990=function(_0x4f33ff,_0x4cc52d){_0x4f33ff=_0x4f33ff-0x0;var _0x40e19c=_0x9909[_0x4f33ff];return _0x40e19c;};'use strict';var _=require('lodash');var util=require(_0x9990('0x0'));var moment=require(_0x9990('0x1'));var BPromise=require('bluebird');var rs=require(_0x9990('0x2'));var fs=require('fs');var Redis=require(_0x9990('0x3'));var db=require(_0x9990('0x4'))['db'];var utils=require(_0x9990('0x5'));var logger=require('../../config/logger')(_0x9990('0x6'));var config=require(_0x9990('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9990('0x8')][_0x9990('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1cda46,_0x498a28,_0x4595cb){return new BPromise(function(_0x2091a3,_0x24ec8a){return client[_0x9990('0xa')](_0x1cda46,_0x4595cb)[_0x9990('0xb')](function(_0x37c808){logger[_0x9990('0xc')](_0x9990('0xd'),_0x498a28,_0x9990('0xe'));logger[_0x9990('0xf')](_0x9990('0x10'),_0x498a28,_0x9990('0xe'),JSON['stringify'](_0x37c808));if(_0x37c808[_0x9990('0x11')]){if(_0x37c808[_0x9990('0x11')][_0x9990('0x12')]===0x1f4){logger[_0x9990('0x11')]('MailServerIn,\x20%s,\x20%s',_0x498a28,_0x37c808[_0x9990('0x11')][_0x9990('0x13')]);return _0x24ec8a(_0x37c808[_0x9990('0x11')][_0x9990('0x13')]);}logger[_0x9990('0x11')](_0x9990('0xd'),_0x498a28,_0x37c808[_0x9990('0x11')][_0x9990('0x13')]);return _0x2091a3(_0x37c808[_0x9990('0x11')][_0x9990('0x13')]);}else{logger[_0x9990('0xc')](_0x9990('0xd'),_0x498a28,_0x9990('0xe'));_0x2091a3(_0x37c808['result'][_0x9990('0x13')]);}})[_0x9990('0x14')](function(_0x208fc8){logger[_0x9990('0x11')]('MailServerIn,\x20%s,\x20%s',_0x498a28,_0x208fc8);_0x24ec8a(_0x208fc8);});});}exports['GetMailServerIn']=function(_0x2a1f41){var _0xae005a=this;return new Promise(function(_0x254ac9,_0x115252){return db['MailServerIn'][_0x9990('0x15')]({'raw':_0x2a1f41[_0x9990('0x16')]?_0x2a1f41[_0x9990('0x16')][_0x9990('0x17')]===undefined?!![]:![]:!![],'where':_0x2a1f41['options']?_0x2a1f41[_0x9990('0x16')][_0x9990('0x18')]||null:null,'attributes':_0x2a1f41[_0x9990('0x16')]?_0x2a1f41[_0x9990('0x16')][_0x9990('0x19')]||null:null,'limit':_0x2a1f41[_0x9990('0x16')]?_0x2a1f41[_0x9990('0x16')][_0x9990('0x1a')]||null:null,'include':_0x2a1f41['options']?_0x2a1f41[_0x9990('0x16')][_0x9990('0x1b')]?_[_0x9990('0x1c')](_0x2a1f41[_0x9990('0x16')]['include'],function(_0x1d6812){return{'model':db[_0x1d6812[_0x9990('0x1d')]],'as':_0x1d6812['as'],'attributes':_0x1d6812[_0x9990('0x19')],'include':_0x1d6812[_0x9990('0x1b')]?_['map'](_0x1d6812[_0x9990('0x1b')],function(_0x2f7ddb){return{'model':db[_0x2f7ddb[_0x9990('0x1d')]],'as':_0x2f7ddb['as'],'attributes':_0x2f7ddb[_0x9990('0x19')],'include':_0x2f7ddb['include']?_['map'](_0x2f7ddb['include'],function(_0x151d1a){return{'model':db[_0x151d1a[_0x9990('0x1d')]],'as':_0x151d1a['as'],'attributes':_0x151d1a['attributes']};}):[]};}):[]};}):[]:[]})[_0x9990('0xb')](function(_0x4afe82){logger[_0x9990('0xc')](_0x9990('0x1e'),_0x2a1f41);logger[_0x9990('0xf')](_0x9990('0x1e'),_0x2a1f41,JSON[_0x9990('0x1f')](_0x4afe82));_0x254ac9(_0x4afe82);})['catch'](function(_0x301d9f){logger['error'](_0x9990('0x1e'),_0x301d9f['message'],_0x2a1f41);_0x115252(_0xae005a[_0x9990('0x11')](0x1f4,_0x301d9f[_0x9990('0x13')]));});});}; \ No newline at end of file +var _0x92ba=['error','code','message','request\x20sent','result','catch','GetMailServerIn','MailServerIn','options','raw','where','attributes','limit','include','map','model','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','MailServerIn,\x20%s,\x20%s','debug'];(function(_0x496aab,_0x6330f5){var _0x15c51d=function(_0x1a89ed){while(--_0x1a89ed){_0x496aab['push'](_0x496aab['shift']());}};_0x15c51d(++_0x6330f5);}(_0x92ba,0x17c));var _0xa92b=function(_0x26032b,_0xe505){_0x26032b=_0x26032b-0x0;var _0x1b64bd=_0x92ba[_0x26032b];return _0x1b64bd;};'use strict';var _=require(_0xa92b('0x0'));var util=require(_0xa92b('0x1'));var moment=require('moment');var BPromise=require(_0xa92b('0x2'));var rs=require(_0xa92b('0x3'));var fs=require('fs');var Redis=require(_0xa92b('0x4'));var db=require(_0xa92b('0x5'))['db'];var utils=require(_0xa92b('0x6'));var logger=require('../../config/logger')(_0xa92b('0x7'));var config=require(_0xa92b('0x8'));var jayson=require(_0xa92b('0x9'));var client=jayson[_0xa92b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27bb9a,_0x1d3d0a,_0x5d4437){return new BPromise(function(_0x156d6b,_0x156be4){return client[_0xa92b('0xb')](_0x27bb9a,_0x5d4437)[_0xa92b('0xc')](function(_0x376021){logger[_0xa92b('0xd')](_0xa92b('0xe'),_0x1d3d0a,'request\x20sent');logger[_0xa92b('0xf')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x1d3d0a,'request\x20sent',JSON['stringify'](_0x376021));if(_0x376021['error']){if(_0x376021[_0xa92b('0x10')][_0xa92b('0x11')]===0x1f4){logger[_0xa92b('0x10')](_0xa92b('0xe'),_0x1d3d0a,_0x376021[_0xa92b('0x10')][_0xa92b('0x12')]);return _0x156be4(_0x376021[_0xa92b('0x10')][_0xa92b('0x12')]);}logger[_0xa92b('0x10')]('MailServerIn,\x20%s,\x20%s',_0x1d3d0a,_0x376021[_0xa92b('0x10')][_0xa92b('0x12')]);return _0x156d6b(_0x376021[_0xa92b('0x10')][_0xa92b('0x12')]);}else{logger[_0xa92b('0xd')](_0xa92b('0xe'),_0x1d3d0a,_0xa92b('0x13'));_0x156d6b(_0x376021[_0xa92b('0x14')][_0xa92b('0x12')]);}})[_0xa92b('0x15')](function(_0x56d1b9){logger[_0xa92b('0x10')](_0xa92b('0xe'),_0x1d3d0a,_0x56d1b9);_0x156be4(_0x56d1b9);});});}exports[_0xa92b('0x16')]=function(_0x1c26f1){var _0x387ab5=this;return new Promise(function(_0x44512a,_0x5905e4){return db[_0xa92b('0x17')]['findAll']({'raw':_0x1c26f1[_0xa92b('0x18')]?_0x1c26f1[_0xa92b('0x18')][_0xa92b('0x19')]===undefined?!![]:![]:!![],'where':_0x1c26f1[_0xa92b('0x18')]?_0x1c26f1[_0xa92b('0x18')][_0xa92b('0x1a')]||null:null,'attributes':_0x1c26f1['options']?_0x1c26f1[_0xa92b('0x18')][_0xa92b('0x1b')]||null:null,'limit':_0x1c26f1[_0xa92b('0x18')]?_0x1c26f1['options'][_0xa92b('0x1c')]||null:null,'include':_0x1c26f1['options']?_0x1c26f1[_0xa92b('0x18')][_0xa92b('0x1d')]?_[_0xa92b('0x1e')](_0x1c26f1[_0xa92b('0x18')][_0xa92b('0x1d')],function(_0x4c22bc){return{'model':db[_0x4c22bc['model']],'as':_0x4c22bc['as'],'attributes':_0x4c22bc['attributes'],'include':_0x4c22bc['include']?_[_0xa92b('0x1e')](_0x4c22bc[_0xa92b('0x1d')],function(_0x568422){return{'model':db[_0x568422[_0xa92b('0x1f')]],'as':_0x568422['as'],'attributes':_0x568422['attributes'],'include':_0x568422['include']?_[_0xa92b('0x1e')](_0x568422[_0xa92b('0x1d')],function(_0x12d631){return{'model':db[_0x12d631['model']],'as':_0x12d631['as'],'attributes':_0x12d631['attributes']};}):[]};}):[]};}):[]:[]})[_0xa92b('0xc')](function(_0x563527){logger[_0xa92b('0xd')](_0xa92b('0x16'),_0x1c26f1);logger[_0xa92b('0xf')]('GetMailServerIn',_0x1c26f1,JSON[_0xa92b('0x20')](_0x563527));_0x44512a(_0x563527);})[_0xa92b('0x15')](function(_0x14d2f4){logger['error']('GetMailServerIn',_0x14d2f4['message'],_0x1c26f1);_0x5905e4(_0x387ab5[_0xa92b('0x10')](0x1f4,_0x14d2f4['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 87ee0fb..dcf0194 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(_0x24a057,_0x162632){_0x24a057=_0x24a057-0x0;var _0x2ad651=_0x7a54[_0x24a057];return _0x2ad651;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x7a54,0x106));var _0x47a5=function(_0x2f0df8,_0x4a3244){_0x2f0df8=_0x2f0df8-0x0;var _0x4c1cda=_0x7a54[_0x2f0df8];return _0x4c1cda;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index ded48f8..17528fb 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 _0xb58b=['BOOLEAN','exports','STRING','INTEGER'];(function(_0x37fc7c,_0x516442){var _0x49bdf6=function(_0xbf1b20){while(--_0xbf1b20){_0x37fc7c['push'](_0x37fc7c['shift']());}};_0x49bdf6(++_0x516442);}(_0xb58b,0x1f1));var _0xbb58=function(_0x53e94b,_0x10bc88){_0x53e94b=_0x53e94b-0x0;var _0x22a43f=_0xb58b[_0x53e94b];return _0x22a43f;};'use strict';var Sequelize=require('sequelize');module[_0xbb58('0x0')]={'description':{'type':Sequelize[_0xbb58('0x1')]},'host':{'type':Sequelize[_0xbb58('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xbb58('0x1')]},'port':{'type':Sequelize[_0xbb58('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xbb58('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xbb58('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x4213=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x571a17,_0x63fb3d){var _0x3ef337=function(_0x12096b){while(--_0x12096b){_0x571a17['push'](_0x571a17['shift']());}};_0x3ef337(++_0x63fb3d);}(_0x4213,0x77));var _0x3421=function(_0x131e9a,_0xfb3d49){_0x131e9a=_0x131e9a-0x0;var _0x1a5f08=_0x4213[_0x131e9a];return _0x1a5f08;};'use strict';var Sequelize=require(_0x3421('0x0'));module[_0x3421('0x1')]={'description':{'type':Sequelize[_0x3421('0x2')]},'host':{'type':Sequelize[_0x3421('0x2')]},'user':{'type':Sequelize[_0x3421('0x2')]},'pass':{'type':Sequelize[_0x3421('0x2')]},'port':{'type':Sequelize[_0x3421('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x3421('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x3421('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index b6c0a69..3d0307e 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 _0xe258=['type','model','keys','query','filters','intersection','attributes','fields','length','order','where','pick','filter','VIRTUAL','merge','options','MailServerOut','findAll','catch','show','find','create','update','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','set','apply','reject','save','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes'];(function(_0x28c364,_0x172002){var _0x3d5d81=function(_0xfb03e4){while(--_0xfb03e4){_0x28c364['push'](_0x28c364['shift']());}};_0x3d5d81(++_0x172002);}(_0xe258,0xe8));var _0x8e25=function(_0x227319,_0xb6ae4){_0x227319=_0x227319-0x0;var _0x4b6e7a=_0xe258[_0x227319];return _0x4b6e7a;};'use strict';var emlformat=require(_0x8e25('0x0'));var rimraf=require(_0x8e25('0x1'));var zipdir=require(_0x8e25('0x2'));var jsonpatch=require(_0x8e25('0x3'));var rp=require(_0x8e25('0x4'));var moment=require('moment');var BPromise=require(_0x8e25('0x5'));var Mustache=require(_0x8e25('0x6'));var util=require(_0x8e25('0x7'));var path=require('path');var sox=require(_0x8e25('0x8'));var csv=require('to-csv');var ejs=require(_0x8e25('0x9'));var fs=require('fs');var fs_extra=require(_0x8e25('0xa'));var _=require(_0x8e25('0xb'));var squel=require('squel');var crypto=require(_0x8e25('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8e25('0xd'));var querystring=require(_0x8e25('0xe'));var Papa=require('papaparse');var Redis=require(_0x8e25('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8e25('0x10'));var as=require(_0x8e25('0x11'));var hardwareService=require(_0x8e25('0x12'));var logger=require(_0x8e25('0x13'))(_0x8e25('0x14'));var utils=require(_0x8e25('0x15'));var config=require(_0x8e25('0x16'));var licenseUtil=require(_0x8e25('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe2d0cc,_0x85bebc){_0x85bebc=_0x85bebc||0xcc;return function(_0x2928a8){if(_0x2928a8){return _0xe2d0cc['sendStatus'](_0x85bebc);}return _0xe2d0cc[_0x8e25('0x18')](_0x85bebc)[_0x8e25('0x19')]();};}function respondWithResult(_0x572772,_0x5bffed){_0x5bffed=_0x5bffed||0xc8;return function(_0x1bd0fd){if(_0x1bd0fd){return _0x572772[_0x8e25('0x18')](_0x5bffed)[_0x8e25('0x1a')](_0x1bd0fd);}};}function respondWithFilteredResult(_0x5acf03,_0x180cc4){return function(_0x18386e){if(_0x18386e){var _0x4ed7b4=typeof _0x180cc4[_0x8e25('0x1b')]==='undefined'&&typeof _0x180cc4[_0x8e25('0x1c')]===_0x8e25('0x1d');var _0x554d7a=_0x18386e[_0x8e25('0x1e')];var _0x393711=_0x4ed7b4?0x0:_0x180cc4[_0x8e25('0x1b')];var _0x274faa=_0x4ed7b4?_0x18386e[_0x8e25('0x1e')]:_0x180cc4[_0x8e25('0x1b')]+_0x180cc4[_0x8e25('0x1c')];var _0x2fff29;if(_0x274faa>=_0x554d7a){_0x274faa=_0x554d7a;_0x2fff29=0xc8;}else{_0x2fff29=0xce;}_0x5acf03[_0x8e25('0x18')](_0x2fff29);return _0x5acf03[_0x8e25('0x1f')]('Content-Range',_0x393711+'-'+_0x274faa+'/'+_0x554d7a)[_0x8e25('0x1a')](_0x18386e);}return null;};}function patchUpdates(_0x3738d8){return function(_0x1daaa0){try{jsonpatch[_0x8e25('0x20')](_0x1daaa0,_0x3738d8,!![]);}catch(_0x15c0a4){return BPromise[_0x8e25('0x21')](_0x15c0a4);}return _0x1daaa0[_0x8e25('0x22')]();};}function saveUpdates(_0x2c43ae,_0x1ce636){return function(_0x1244ea){if(_0x1244ea){return _0x1244ea['update'](_0x2c43ae)[_0x8e25('0x23')](function(_0x201b21){return _0x201b21;});}return null;};}function removeEntity(_0x56704d,_0xf10f5f){return function(_0x4c6c3b){if(_0x4c6c3b){return _0x4c6c3b[_0x8e25('0x24')]()['then'](function(){_0x56704d[_0x8e25('0x18')](0xcc)[_0x8e25('0x19')]();});}};}function handleEntityNotFound(_0x310c58,_0x2f8f32){return function(_0x7d4326){if(!_0x7d4326){_0x310c58[_0x8e25('0x25')](0x194);}return _0x7d4326;};}function handleError(_0x2d15f8,_0x52f6fd){_0x52f6fd=_0x52f6fd||0x1f4;return function(_0x5e9056){logger['error'](_0x5e9056[_0x8e25('0x26')]);if(_0x5e9056[_0x8e25('0x27')]){delete _0x5e9056['name'];}_0x2d15f8[_0x8e25('0x18')](_0x52f6fd)[_0x8e25('0x28')](_0x5e9056);};}exports[_0x8e25('0x29')]=function(_0x288847,_0x5043b4){var _0x2c077c={},_0x2ff906={},_0x14632b={'count':0x0,'rows':[]};var _0x425404=_[_0x8e25('0x2a')](db['MailServerOut'][_0x8e25('0x2b')],function(_0x17e44d){return{'name':_0x17e44d['fieldName'],'type':_0x17e44d[_0x8e25('0x2c')]['key']};});_0x2ff906[_0x8e25('0x2d')]=_['map'](_0x425404,'name');_0x2ff906['query']=_[_0x8e25('0x2e')](_0x288847[_0x8e25('0x2f')]);_0x2ff906[_0x8e25('0x30')]=_[_0x8e25('0x31')](_0x2ff906['model'],_0x2ff906[_0x8e25('0x2f')]);_0x2c077c[_0x8e25('0x32')]=_[_0x8e25('0x31')](_0x2ff906[_0x8e25('0x2d')],qs[_0x8e25('0x33')](_0x288847['query'][_0x8e25('0x33')]));_0x2c077c['attributes']=_0x2c077c[_0x8e25('0x32')][_0x8e25('0x34')]?_0x2c077c[_0x8e25('0x32')]:_0x2ff906[_0x8e25('0x2d')];if(!_0x288847[_0x8e25('0x2f')]['hasOwnProperty']('nolimit')){_0x2c077c[_0x8e25('0x1c')]=qs['limit'](_0x288847[_0x8e25('0x2f')][_0x8e25('0x1c')]);_0x2c077c[_0x8e25('0x1b')]=qs[_0x8e25('0x1b')](_0x288847[_0x8e25('0x2f')][_0x8e25('0x1b')]);}_0x2c077c[_0x8e25('0x35')]=qs['sort'](_0x288847[_0x8e25('0x2f')]['sort']);_0x2c077c[_0x8e25('0x36')]=qs['filters'](_[_0x8e25('0x37')](_0x288847[_0x8e25('0x2f')],_0x2ff906[_0x8e25('0x30')]),_0x425404);if(_0x288847[_0x8e25('0x2f')][_0x8e25('0x38')]){_0x2c077c[_0x8e25('0x36')]=_['merge'](_0x2c077c[_0x8e25('0x36')],{'$or':_[_0x8e25('0x2a')](_0x425404,function(_0x225cea){if(_0x225cea[_0x8e25('0x2c')]!==_0x8e25('0x39')){var _0x5342f6={};_0x5342f6[_0x225cea[_0x8e25('0x27')]]={'$like':'%'+_0x288847[_0x8e25('0x2f')][_0x8e25('0x38')]+'%'};return _0x5342f6;}})});}_0x2c077c=_[_0x8e25('0x3a')]({},_0x2c077c,_0x288847[_0x8e25('0x3b')]);var _0x4f668b={'where':_0x2c077c['where']};return db[_0x8e25('0x3c')][_0x8e25('0x1e')](_0x4f668b)[_0x8e25('0x23')](function(_0x535729){_0x14632b[_0x8e25('0x1e')]=_0x535729;if(_0x288847[_0x8e25('0x2f')]['includeAll']){_0x2c077c['include']=[{'all':!![]}];}return db[_0x8e25('0x3c')][_0x8e25('0x3d')](_0x2c077c);})['then'](function(_0x435ed2){_0x14632b['rows']=_0x435ed2;return _0x14632b;})['then'](respondWithFilteredResult(_0x5043b4,_0x2c077c))[_0x8e25('0x3e')](handleError(_0x5043b4,null));};exports[_0x8e25('0x3f')]=function(_0x7f3a03,_0x2b1831){var _0x5c51fb={'raw':!![],'where':{'id':_0x7f3a03['params']['id']}},_0x27fa2c={};_0x27fa2c['model']=_['keys'](db[_0x8e25('0x3c')][_0x8e25('0x2b')]);_0x27fa2c[_0x8e25('0x2f')]=_['keys'](_0x7f3a03[_0x8e25('0x2f')]);_0x27fa2c[_0x8e25('0x30')]=_[_0x8e25('0x31')](_0x27fa2c[_0x8e25('0x2d')],_0x27fa2c[_0x8e25('0x2f')]);_0x5c51fb[_0x8e25('0x32')]=_[_0x8e25('0x31')](_0x27fa2c[_0x8e25('0x2d')],qs[_0x8e25('0x33')](_0x7f3a03[_0x8e25('0x2f')][_0x8e25('0x33')]));_0x5c51fb[_0x8e25('0x32')]=_0x5c51fb[_0x8e25('0x32')][_0x8e25('0x34')]?_0x5c51fb[_0x8e25('0x32')]:_0x27fa2c[_0x8e25('0x2d')];if(_0x7f3a03[_0x8e25('0x2f')]['includeAll']){_0x5c51fb['include']=[{'all':!![]}];}_0x5c51fb=_[_0x8e25('0x3a')]({},_0x5c51fb,_0x7f3a03[_0x8e25('0x3b')]);return db[_0x8e25('0x3c')][_0x8e25('0x40')](_0x5c51fb)['then'](handleEntityNotFound(_0x2b1831,null))[_0x8e25('0x23')](respondWithResult(_0x2b1831,null))[_0x8e25('0x3e')](handleError(_0x2b1831,null));};exports['create']=function(_0x1183fe,_0x35204c){return db[_0x8e25('0x3c')][_0x8e25('0x41')](_0x1183fe['body'],{})[_0x8e25('0x23')](respondWithResult(_0x35204c,0xc9))['catch'](handleError(_0x35204c,null));};exports[_0x8e25('0x42')]=function(_0x3ea4bc,_0x409713){if(_0x3ea4bc[_0x8e25('0x43')]['id']){delete _0x3ea4bc[_0x8e25('0x43')]['id'];}return db['MailServerOut'][_0x8e25('0x40')]({'where':{'id':_0x3ea4bc[_0x8e25('0x44')]['id']}})[_0x8e25('0x23')](handleEntityNotFound(_0x409713,null))[_0x8e25('0x23')](saveUpdates(_0x3ea4bc['body'],null))[_0x8e25('0x23')](respondWithResult(_0x409713,null))[_0x8e25('0x3e')](handleError(_0x409713,null));};exports[_0x8e25('0x24')]=function(_0xc8886f,_0x124da2){return db[_0x8e25('0x3c')][_0x8e25('0x40')]({'where':{'id':_0xc8886f['params']['id']}})[_0x8e25('0x23')](handleEntityNotFound(_0x124da2,null))['then'](removeEntity(_0x124da2,null))[_0x8e25('0x3e')](handleError(_0x124da2,null));}; \ No newline at end of file +var _0x273d=['limit','count','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailServerOut','includeAll','rows','show','params','keys','include','find','create','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined'];(function(_0x4754ce,_0x575a54){var _0xff1dcc=function(_0x5efc62){while(--_0x5efc62){_0x4754ce['push'](_0x4754ce['shift']());}};_0xff1dcc(++_0x575a54);}(_0x273d,0x1a5));var _0xd273=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x273d[_0x5608a3];return _0x1ed50a;};'use strict';var emlformat=require(_0xd273('0x0'));var rimraf=require(_0xd273('0x1'));var zipdir=require(_0xd273('0x2'));var jsonpatch=require(_0xd273('0x3'));var rp=require(_0xd273('0x4'));var moment=require(_0xd273('0x5'));var BPromise=require(_0xd273('0x6'));var Mustache=require(_0xd273('0x7'));var util=require(_0xd273('0x8'));var path=require('path');var sox=require(_0xd273('0x9'));var csv=require(_0xd273('0xa'));var ejs=require(_0xd273('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd273('0xc'));var squel=require(_0xd273('0xd'));var crypto=require('crypto');var jsforce=require(_0xd273('0xe'));var deskjs=require(_0xd273('0xf'));var toCsv=require(_0xd273('0xa'));var querystring=require(_0xd273('0x10'));var Papa=require(_0xd273('0x11'));var Redis=require('ioredis');var authService=require(_0xd273('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd273('0x13'));var hardwareService=require(_0xd273('0x14'));var logger=require('../../config/logger')(_0xd273('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd273('0x16'));var db=require(_0xd273('0x17'))['db'];function respondWithStatusCode(_0x24822c,_0x24e0fd){_0x24e0fd=_0x24e0fd||0xcc;return function(_0x55a258){if(_0x55a258){return _0x24822c['sendStatus'](_0x24e0fd);}return _0x24822c[_0xd273('0x18')](_0x24e0fd)[_0xd273('0x19')]();};}function respondWithResult(_0xa787b7,_0x56dc0a){_0x56dc0a=_0x56dc0a||0xc8;return function(_0x2e819c){if(_0x2e819c){return _0xa787b7['status'](_0x56dc0a)[_0xd273('0x1a')](_0x2e819c);}};}function respondWithFilteredResult(_0x250c7f,_0x3d074b){return function(_0x5bdd4f){if(_0x5bdd4f){var _0x46cc5c=typeof _0x3d074b[_0xd273('0x1b')]===_0xd273('0x1c')&&typeof _0x3d074b[_0xd273('0x1d')]==='undefined';var _0x2dd8bb=_0x5bdd4f['count'];var _0x3700c1=_0x46cc5c?0x0:_0x3d074b[_0xd273('0x1b')];var _0x475c89=_0x46cc5c?_0x5bdd4f[_0xd273('0x1e')]:_0x3d074b[_0xd273('0x1b')]+_0x3d074b[_0xd273('0x1d')];var _0x1e77c2;if(_0x475c89>=_0x2dd8bb){_0x475c89=_0x2dd8bb;_0x1e77c2=0xc8;}else{_0x1e77c2=0xce;}_0x250c7f[_0xd273('0x18')](_0x1e77c2);return _0x250c7f[_0xd273('0x1f')]('Content-Range',_0x3700c1+'-'+_0x475c89+'/'+_0x2dd8bb)[_0xd273('0x1a')](_0x5bdd4f);}return null;};}function patchUpdates(_0x319ad1){return function(_0x3dfab6){try{jsonpatch[_0xd273('0x20')](_0x3dfab6,_0x319ad1,!![]);}catch(_0xd4781a){return BPromise[_0xd273('0x21')](_0xd4781a);}return _0x3dfab6[_0xd273('0x22')]();};}function saveUpdates(_0x395a0f,_0x1facfe){return function(_0x104f52){if(_0x104f52){return _0x104f52[_0xd273('0x23')](_0x395a0f)[_0xd273('0x24')](function(_0x506b66){return _0x506b66;});}return null;};}function removeEntity(_0x41a4c0,_0x422c13){return function(_0x10cb09){if(_0x10cb09){return _0x10cb09[_0xd273('0x25')]()[_0xd273('0x24')](function(){_0x41a4c0['status'](0xcc)[_0xd273('0x19')]();});}};}function handleEntityNotFound(_0x5b6fef,_0x23b258){return function(_0x27219e){if(!_0x27219e){_0x5b6fef[_0xd273('0x26')](0x194);}return _0x27219e;};}function handleError(_0x436518,_0x216f15){_0x216f15=_0x216f15||0x1f4;return function(_0x1142d1){logger[_0xd273('0x27')](_0x1142d1[_0xd273('0x28')]);if(_0x1142d1[_0xd273('0x29')]){delete _0x1142d1[_0xd273('0x29')];}_0x436518[_0xd273('0x18')](_0x216f15)[_0xd273('0x2a')](_0x1142d1);};}exports[_0xd273('0x2b')]=function(_0x1ba9dd,_0x2f9c45){var _0x26aad1={},_0x38fcca={},_0x171c77={'count':0x0,'rows':[]};var _0x4d4077=_['map'](db['MailServerOut'][_0xd273('0x2c')],function(_0x1af8d8){return{'name':_0x1af8d8[_0xd273('0x2d')],'type':_0x1af8d8[_0xd273('0x2e')]['key']};});_0x38fcca[_0xd273('0x2f')]=_[_0xd273('0x30')](_0x4d4077,_0xd273('0x29'));_0x38fcca[_0xd273('0x31')]=_['keys'](_0x1ba9dd[_0xd273('0x31')]);_0x38fcca[_0xd273('0x32')]=_[_0xd273('0x33')](_0x38fcca[_0xd273('0x2f')],_0x38fcca[_0xd273('0x31')]);_0x26aad1[_0xd273('0x34')]=_[_0xd273('0x33')](_0x38fcca[_0xd273('0x2f')],qs[_0xd273('0x35')](_0x1ba9dd[_0xd273('0x31')]['fields']));_0x26aad1[_0xd273('0x34')]=_0x26aad1[_0xd273('0x34')]['length']?_0x26aad1[_0xd273('0x34')]:_0x38fcca['model'];if(!_0x1ba9dd[_0xd273('0x31')][_0xd273('0x36')](_0xd273('0x37'))){_0x26aad1[_0xd273('0x1d')]=qs['limit'](_0x1ba9dd[_0xd273('0x31')]['limit']);_0x26aad1['offset']=qs['offset'](_0x1ba9dd[_0xd273('0x31')][_0xd273('0x1b')]);}_0x26aad1[_0xd273('0x38')]=qs[_0xd273('0x39')](_0x1ba9dd[_0xd273('0x31')][_0xd273('0x39')]);_0x26aad1[_0xd273('0x3a')]=qs[_0xd273('0x32')](_[_0xd273('0x3b')](_0x1ba9dd[_0xd273('0x31')],_0x38fcca[_0xd273('0x32')]),_0x4d4077);if(_0x1ba9dd['query'][_0xd273('0x3c')]){_0x26aad1[_0xd273('0x3a')]=_[_0xd273('0x3d')](_0x26aad1['where'],{'$or':_[_0xd273('0x30')](_0x4d4077,function(_0x445974){if(_0x445974['type']!==_0xd273('0x3e')){var _0x1706bf={};_0x1706bf[_0x445974[_0xd273('0x29')]]={'$like':'%'+_0x1ba9dd[_0xd273('0x31')][_0xd273('0x3c')]+'%'};return _0x1706bf;}})});}_0x26aad1=_['merge']({},_0x26aad1,_0x1ba9dd[_0xd273('0x3f')]);var _0x45cdae={'where':_0x26aad1[_0xd273('0x3a')]};return db[_0xd273('0x40')][_0xd273('0x1e')](_0x45cdae)['then'](function(_0x3c9fbf){_0x171c77[_0xd273('0x1e')]=_0x3c9fbf;if(_0x1ba9dd['query'][_0xd273('0x41')]){_0x26aad1['include']=[{'all':!![]}];}return db[_0xd273('0x40')]['findAll'](_0x26aad1);})[_0xd273('0x24')](function(_0x5d7d66){_0x171c77[_0xd273('0x42')]=_0x5d7d66;return _0x171c77;})[_0xd273('0x24')](respondWithFilteredResult(_0x2f9c45,_0x26aad1))['catch'](handleError(_0x2f9c45,null));};exports[_0xd273('0x43')]=function(_0x46019e,_0x5c2c48){var _0x400256={'raw':!![],'where':{'id':_0x46019e[_0xd273('0x44')]['id']}},_0x4b5012={};_0x4b5012[_0xd273('0x2f')]=_[_0xd273('0x45')](db[_0xd273('0x40')]['rawAttributes']);_0x4b5012['query']=_['keys'](_0x46019e[_0xd273('0x31')]);_0x4b5012[_0xd273('0x32')]=_[_0xd273('0x33')](_0x4b5012[_0xd273('0x2f')],_0x4b5012[_0xd273('0x31')]);_0x400256['attributes']=_['intersection'](_0x4b5012[_0xd273('0x2f')],qs[_0xd273('0x35')](_0x46019e[_0xd273('0x31')][_0xd273('0x35')]));_0x400256[_0xd273('0x34')]=_0x400256[_0xd273('0x34')]['length']?_0x400256[_0xd273('0x34')]:_0x4b5012[_0xd273('0x2f')];if(_0x46019e[_0xd273('0x31')][_0xd273('0x41')]){_0x400256[_0xd273('0x46')]=[{'all':!![]}];}_0x400256=_[_0xd273('0x3d')]({},_0x400256,_0x46019e['options']);return db[_0xd273('0x40')][_0xd273('0x47')](_0x400256)[_0xd273('0x24')](handleEntityNotFound(_0x5c2c48,null))[_0xd273('0x24')](respondWithResult(_0x5c2c48,null))['catch'](handleError(_0x5c2c48,null));};exports[_0xd273('0x48')]=function(_0xcf6cbf,_0x527565){return db['MailServerOut'][_0xd273('0x48')](_0xcf6cbf['body'],{})['then'](respondWithResult(_0x527565,0xc9))[_0xd273('0x49')](handleError(_0x527565,null));};exports[_0xd273('0x23')]=function(_0x4a68cd,_0xf6e14c){if(_0x4a68cd[_0xd273('0x4a')]['id']){delete _0x4a68cd['body']['id'];}return db[_0xd273('0x40')]['find']({'where':{'id':_0x4a68cd[_0xd273('0x44')]['id']}})[_0xd273('0x24')](handleEntityNotFound(_0xf6e14c,null))[_0xd273('0x24')](saveUpdates(_0x4a68cd['body'],null))[_0xd273('0x24')](respondWithResult(_0xf6e14c,null))['catch'](handleError(_0xf6e14c,null));};exports[_0xd273('0x25')]=function(_0x3d6b9,_0x326054){return db[_0xd273('0x40')][_0xd273('0x47')]({'where':{'id':_0x3d6b9[_0xd273('0x44')]['id']}})[_0xd273('0x24')](handleEntityNotFound(_0x326054,null))[_0xd273('0x24')](removeEntity(_0x326054,null))['catch'](handleError(_0x326054,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 26724c1..6b12198 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 _0x2683=['api','moment','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','lodash','util'];(function(_0x549ea1,_0x2cdfbe){var _0x300f94=function(_0x1d34cf){while(--_0x1d34cf){_0x549ea1['push'](_0x549ea1['shift']());}};_0x300f94(++_0x2cdfbe);}(_0x2683,0x76));var _0x3268=function(_0x7457fe,_0x564a5e){_0x7457fe=_0x7457fe-0x0;var _0x57a6e4=_0x2683[_0x7457fe];return _0x57a6e4;};'use strict';var _=require(_0x3268('0x0'));var util=require(_0x3268('0x1'));var logger=require('../../config/logger')(_0x3268('0x2'));var moment=require(_0x3268('0x3'));var BPromise=require('bluebird');var rp=require(_0x3268('0x4'));var fs=require('fs');var path=require(_0x3268('0x5'));var rimraf=require(_0x3268('0x6'));var config=require(_0x3268('0x7'));var attributes=require(_0x3268('0x8'));module[_0x3268('0x9')]=function(_0x1e03f1,_0x4363ce){return _0x1e03f1['define']('MailServerOut',attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c20=['rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1376ed,_0x5abe2c){var _0x16953e=function(_0x33ad18){while(--_0x33ad18){_0x1376ed['push'](_0x1376ed['shift']());}};_0x16953e(++_0x5abe2c);}(_0x5c20,0x124));var _0x05c2=function(_0xec625b,_0x31d6f9){_0xec625b=_0xec625b-0x0;var _0x58c103=_0x5c20[_0xec625b];return _0x58c103;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x05c2('0x0'))(_0x05c2('0x1'));var moment=require(_0x05c2('0x2'));var BPromise=require(_0x05c2('0x3'));var rp=require(_0x05c2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x05c2('0x5'));var config=require(_0x05c2('0x6'));var attributes=require(_0x05c2('0x7'));module[_0x05c2('0x8')]=function(_0x295305,_0x299837){return _0x295305[_0x05c2('0x9')](_0x05c2('0xa'),attributes,{'tableName':'mail_servers_out','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 a59fb9d..89a8734 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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x3bdc78,_0x18cdf9){var _0x54a17a=function(_0x2aba69){while(--_0x2aba69){_0x3bdc78['push'](_0x3bdc78['shift']());}};_0x54a17a(++_0x18cdf9);}(_0x5f2f,0x73));var _0xf5f2=function(_0x378514,_0x47b7af){_0x378514=_0x378514-0x0;var _0x126ca4=_0x5f2f[_0x378514];return _0x126ca4;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +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(_0x5a7e8b,_0x3a6cd8){var _0x5ea69=function(_0x472dd8){while(--_0x472dd8){_0x5a7e8b['push'](_0x5a7e8b['shift']());}};_0x5ea69(++_0x3a6cd8);}(_0x1261,0x144));var _0x1126=function(_0x4ded50,_0x4a6af3){_0x4ded50=_0x4ded50-0x0;var _0xa92135=_0x1261[_0x4ded50];return _0xa92135;};'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 66bf8a2..6c02732 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 _0x5087=['show','post','create','put','delete','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','isAuthenticated','index','get','describe','/:id'];(function(_0x3fa934,_0x10e3b4){var _0x4dcfa8=function(_0xe1c9d0){while(--_0xe1c9d0){_0x3fa934['push'](_0x3fa934['shift']());}};_0x4dcfa8(++_0x10e3b4);}(_0x5087,0x1da));var _0x7508=function(_0xcfe8cc,_0xb83aeb){_0xcfe8cc=_0xcfe8cc-0x0;var _0x55ac53=_0x5087[_0xcfe8cc];return _0x55ac53;};'use strict';var multer=require(_0x7508('0x0'));var util=require('util');var path=require(_0x7508('0x1'));var timeout=require('connect-timeout');var express=require(_0x7508('0x2'));var router=express[_0x7508('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7508('0x4'));var interaction=require(_0x7508('0x5'));var config=require('../../config/environment');var controller=require(_0x7508('0x6'));router['get']('/',auth[_0x7508('0x7')](),controller[_0x7508('0x8')]);router[_0x7508('0x9')]('/describe',auth[_0x7508('0x7')](),controller[_0x7508('0xa')]);router[_0x7508('0x9')](_0x7508('0xb'),auth[_0x7508('0x7')](),controller[_0x7508('0xc')]);router[_0x7508('0xd')]('/',auth[_0x7508('0x7')](),controller[_0x7508('0xe')]);router[_0x7508('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x7508('0x10')](_0x7508('0xb'),auth['isAuthenticated'](),controller[_0x7508('0x11')]);module['exports']=router; \ No newline at end of file +var _0xa407=['get','/describe','describe','/: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','./mailSubstatus.controller','isAuthenticated','index'];(function(_0x2a2140,_0x3a2e01){var _0xea3cd=function(_0x57f32e){while(--_0x57f32e){_0x2a2140['push'](_0x2a2140['shift']());}};_0xea3cd(++_0x3a2e01);}(_0xa407,0x15c));var _0x7a40=function(_0x49f19e,_0x2fca8d){_0x49f19e=_0x49f19e-0x0;var _0x5a13b0=_0xa407[_0x49f19e];return _0x5a13b0;};'use strict';var multer=require(_0x7a40('0x0'));var util=require(_0x7a40('0x1'));var path=require(_0x7a40('0x2'));var timeout=require(_0x7a40('0x3'));var express=require('express');var router=express[_0x7a40('0x4')]();var fs_extra=require(_0x7a40('0x5'));var auth=require(_0x7a40('0x6'));var interaction=require(_0x7a40('0x7'));var config=require(_0x7a40('0x8'));var controller=require(_0x7a40('0x9'));router['get']('/',auth[_0x7a40('0xa')](),controller[_0x7a40('0xb')]);router[_0x7a40('0xc')](_0x7a40('0xd'),auth[_0x7a40('0xa')](),controller[_0x7a40('0xe')]);router[_0x7a40('0xc')](_0x7a40('0xf'),auth['isAuthenticated'](),controller[_0x7a40('0x10')]);router[_0x7a40('0x11')]('/',auth[_0x7a40('0xa')](),controller[_0x7a40('0x12')]);router[_0x7a40('0x13')](_0x7a40('0xf'),auth['isAuthenticated'](),controller[_0x7a40('0x14')]);router[_0x7a40('0x15')](_0x7a40('0xf'),auth[_0x7a40('0xa')](),controller[_0x7a40('0x16')]);module[_0x7a40('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index e6817a9..cfc3015 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 _0x8cad=['STRING','name','sequelize','exports'];(function(_0x1290cb,_0x1fab4e){var _0xa38792=function(_0x1c959a){while(--_0x1c959a){_0x1290cb['push'](_0x1290cb['shift']());}};_0xa38792(++_0x1fab4e);}(_0x8cad,0xfe));var _0xd8ca=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x8cad[_0x2e4e19];return _0x9ba20b;};'use strict';var Sequelize=require(_0xd8ca('0x0'));module[_0xd8ca('0x1')]={'name':{'type':Sequelize[_0xd8ca('0x2')],'unique':_0xd8ca('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd8ca('0x2')]}}; \ No newline at end of file +var _0xe626=['name','sequelize','exports','STRING'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe626,0x9d));var _0x6e62=function(_0x465d3b,_0x3fdbe2){_0x465d3b=_0x465d3b-0x0;var _0xbb089f=_0xe626[_0x465d3b];return _0xbb089f;};'use strict';var Sequelize=require(_0x6e62('0x0'));module[_0x6e62('0x1')]={'name':{'type':Sequelize[_0x6e62('0x2')],'unique':_0x6e62('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index c2c82dc..006bcff 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 _0x4d6b=['api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','update','then','destroy','sendStatus','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','nolimit','sort','where','filters','pick','merge','type','include','rows','catch','show','includeAll','options','find','create','body','params','describe','rimraf','moment','mustache','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'];(function(_0x558e39,_0x3b8d0a){var _0x149b3c=function(_0x4da6cc){while(--_0x4da6cc){_0x558e39['push'](_0x558e39['shift']());}};_0x149b3c(++_0x3b8d0a);}(_0x4d6b,0x192));var _0xb4d6=function(_0x139ff6,_0xddca5){_0x139ff6=_0x139ff6-0x0;var _0x71b083=_0x4d6b[_0x139ff6];return _0x71b083;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb4d6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb4d6('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xb4d6('0x2'));var util=require('util');var path=require('path');var sox=require(_0xb4d6('0x3'));var csv=require(_0xb4d6('0x4'));var ejs=require(_0xb4d6('0x5'));var fs=require('fs');var fs_extra=require(_0xb4d6('0x6'));var _=require(_0xb4d6('0x7'));var squel=require('squel');var crypto=require(_0xb4d6('0x8'));var jsforce=require(_0xb4d6('0x9'));var deskjs=require(_0xb4d6('0xa'));var toCsv=require(_0xb4d6('0x4'));var querystring=require('querystring');var Papa=require(_0xb4d6('0xb'));var Redis=require(_0xb4d6('0xc'));var authService=require(_0xb4d6('0xd'));var qs=require(_0xb4d6('0xe'));var as=require(_0xb4d6('0xf'));var hardwareService=require(_0xb4d6('0x10'));var logger=require(_0xb4d6('0x11'))(_0xb4d6('0x12'));var utils=require(_0xb4d6('0x13'));var config=require(_0xb4d6('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb4d6('0x15'))['db'];function respondWithStatusCode(_0xd98871,_0x18f979){_0x18f979=_0x18f979||0xcc;return function(_0x357f90){if(_0x357f90){return _0xd98871['sendStatus'](_0x18f979);}return _0xd98871[_0xb4d6('0x16')](_0x18f979)[_0xb4d6('0x17')]();};}function respondWithResult(_0x106818,_0x2cc9a9){_0x2cc9a9=_0x2cc9a9||0xc8;return function(_0x90ad4e){if(_0x90ad4e){return _0x106818['status'](_0x2cc9a9)[_0xb4d6('0x18')](_0x90ad4e);}};}function respondWithFilteredResult(_0x279ae5,_0x27a979){return function(_0x4fa704){if(_0x4fa704){var _0x3a26f3=typeof _0x27a979['offset']===_0xb4d6('0x19')&&typeof _0x27a979[_0xb4d6('0x1a')]===_0xb4d6('0x19');var _0x3f05d0=_0x4fa704[_0xb4d6('0x1b')];var _0x2d7902=_0x3a26f3?0x0:_0x27a979[_0xb4d6('0x1c')];var _0x485b42=_0x3a26f3?_0x4fa704['count']:_0x27a979[_0xb4d6('0x1c')]+_0x27a979[_0xb4d6('0x1a')];var _0x1ab28c;if(_0x485b42>=_0x3f05d0){_0x485b42=_0x3f05d0;_0x1ab28c=0xc8;}else{_0x1ab28c=0xce;}_0x279ae5[_0xb4d6('0x16')](_0x1ab28c);return _0x279ae5[_0xb4d6('0x1d')]('Content-Range',_0x2d7902+'-'+_0x485b42+'/'+_0x3f05d0)[_0xb4d6('0x18')](_0x4fa704);}return null;};}function patchUpdates(_0x26f335){return function(_0x3b6eaf){try{jsonpatch[_0xb4d6('0x1e')](_0x3b6eaf,_0x26f335,!![]);}catch(_0x2a1ec6){return BPromise['reject'](_0x2a1ec6);}return _0x3b6eaf['save']();};}function saveUpdates(_0xa7e912,_0x59cc56){return function(_0x13d02f){if(_0x13d02f){return _0x13d02f[_0xb4d6('0x1f')](_0xa7e912)[_0xb4d6('0x20')](function(_0x4e3424){return _0x4e3424;});}return null;};}function removeEntity(_0x4a01c0,_0x278ce2){return function(_0x54164b){if(_0x54164b){return _0x54164b[_0xb4d6('0x21')]()['then'](function(){_0x4a01c0[_0xb4d6('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32099e,_0x3a4cc3){return function(_0x3f5879){if(!_0x3f5879){_0x32099e[_0xb4d6('0x22')](0x194);}return _0x3f5879;};}function handleError(_0x414b4c,_0xbe5435){_0xbe5435=_0xbe5435||0x1f4;return function(_0x467e56){logger[_0xb4d6('0x23')](_0x467e56[_0xb4d6('0x24')]);if(_0x467e56[_0xb4d6('0x25')]){delete _0x467e56[_0xb4d6('0x25')];}_0x414b4c[_0xb4d6('0x16')](_0xbe5435)[_0xb4d6('0x26')](_0x467e56);};}exports[_0xb4d6('0x27')]=function(_0x4db4a4,_0x21dcfb){var _0x3ebf55={},_0x2042dc={},_0x150e14={'count':0x0,'rows':[]};var _0x55e3d9=_[_0xb4d6('0x28')](db[_0xb4d6('0x29')][_0xb4d6('0x2a')],function(_0x28e854){return{'name':_0x28e854[_0xb4d6('0x2b')],'type':_0x28e854['type'][_0xb4d6('0x2c')]};});_0x2042dc[_0xb4d6('0x2d')]=_[_0xb4d6('0x28')](_0x55e3d9,_0xb4d6('0x25'));_0x2042dc[_0xb4d6('0x2e')]=_[_0xb4d6('0x2f')](_0x4db4a4[_0xb4d6('0x2e')]);_0x2042dc['filters']=_['intersection'](_0x2042dc['model'],_0x2042dc[_0xb4d6('0x2e')]);_0x3ebf55['attributes']=_[_0xb4d6('0x30')](_0x2042dc[_0xb4d6('0x2d')],qs[_0xb4d6('0x31')](_0x4db4a4[_0xb4d6('0x2e')][_0xb4d6('0x31')]));_0x3ebf55[_0xb4d6('0x32')]=_0x3ebf55['attributes'][_0xb4d6('0x33')]?_0x3ebf55[_0xb4d6('0x32')]:_0x2042dc[_0xb4d6('0x2d')];if(!_0x4db4a4[_0xb4d6('0x2e')]['hasOwnProperty'](_0xb4d6('0x34'))){_0x3ebf55[_0xb4d6('0x1a')]=qs[_0xb4d6('0x1a')](_0x4db4a4[_0xb4d6('0x2e')][_0xb4d6('0x1a')]);_0x3ebf55[_0xb4d6('0x1c')]=qs[_0xb4d6('0x1c')](_0x4db4a4[_0xb4d6('0x2e')][_0xb4d6('0x1c')]);}_0x3ebf55['order']=qs[_0xb4d6('0x35')](_0x4db4a4[_0xb4d6('0x2e')][_0xb4d6('0x35')]);_0x3ebf55[_0xb4d6('0x36')]=qs[_0xb4d6('0x37')](_[_0xb4d6('0x38')](_0x4db4a4[_0xb4d6('0x2e')],_0x2042dc[_0xb4d6('0x37')]),_0x55e3d9);if(_0x4db4a4[_0xb4d6('0x2e')]['filter']){_0x3ebf55[_0xb4d6('0x36')]=_[_0xb4d6('0x39')](_0x3ebf55[_0xb4d6('0x36')],{'$or':_[_0xb4d6('0x28')](_0x55e3d9,function(_0x405e40){if(_0x405e40[_0xb4d6('0x3a')]!=='VIRTUAL'){var _0x2493c4={};_0x2493c4[_0x405e40[_0xb4d6('0x25')]]={'$like':'%'+_0x4db4a4['query']['filter']+'%'};return _0x2493c4;}})});}_0x3ebf55=_[_0xb4d6('0x39')]({},_0x3ebf55,_0x4db4a4['options']);var _0x308317={'where':_0x3ebf55['where']};return db[_0xb4d6('0x29')][_0xb4d6('0x1b')](_0x308317)['then'](function(_0x4d7a0b){_0x150e14[_0xb4d6('0x1b')]=_0x4d7a0b;if(_0x4db4a4[_0xb4d6('0x2e')]['includeAll']){_0x3ebf55[_0xb4d6('0x3b')]=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x3ebf55);})[_0xb4d6('0x20')](function(_0x3ddec2){_0x150e14[_0xb4d6('0x3c')]=_0x3ddec2;return _0x150e14;})[_0xb4d6('0x20')](respondWithFilteredResult(_0x21dcfb,_0x3ebf55))[_0xb4d6('0x3d')](handleError(_0x21dcfb,null));};exports[_0xb4d6('0x3e')]=function(_0x533934,_0x57a5ee){var _0x5071fb={'raw':!![],'where':{'id':_0x533934['params']['id']}},_0x12a0a9={};_0x12a0a9[_0xb4d6('0x2d')]=_[_0xb4d6('0x2f')](db[_0xb4d6('0x29')][_0xb4d6('0x2a')]);_0x12a0a9['query']=_[_0xb4d6('0x2f')](_0x533934['query']);_0x12a0a9['filters']=_[_0xb4d6('0x30')](_0x12a0a9['model'],_0x12a0a9[_0xb4d6('0x2e')]);_0x5071fb[_0xb4d6('0x32')]=_[_0xb4d6('0x30')](_0x12a0a9['model'],qs[_0xb4d6('0x31')](_0x533934['query'][_0xb4d6('0x31')]));_0x5071fb[_0xb4d6('0x32')]=_0x5071fb['attributes'][_0xb4d6('0x33')]?_0x5071fb['attributes']:_0x12a0a9[_0xb4d6('0x2d')];if(_0x533934[_0xb4d6('0x2e')][_0xb4d6('0x3f')]){_0x5071fb[_0xb4d6('0x3b')]=[{'all':!![]}];}_0x5071fb=_[_0xb4d6('0x39')]({},_0x5071fb,_0x533934[_0xb4d6('0x40')]);return db[_0xb4d6('0x29')][_0xb4d6('0x41')](_0x5071fb)[_0xb4d6('0x20')](handleEntityNotFound(_0x57a5ee,null))['then'](respondWithResult(_0x57a5ee,null))[_0xb4d6('0x3d')](handleError(_0x57a5ee,null));};exports[_0xb4d6('0x42')]=function(_0x5880dd,_0x4beea1){return db[_0xb4d6('0x29')][_0xb4d6('0x42')](_0x5880dd['body'],{})[_0xb4d6('0x20')](respondWithResult(_0x4beea1,0xc9))[_0xb4d6('0x3d')](handleError(_0x4beea1,null));};exports[_0xb4d6('0x1f')]=function(_0x4f6492,_0x2965cf){if(_0x4f6492[_0xb4d6('0x43')]['id']){delete _0x4f6492[_0xb4d6('0x43')]['id'];}return db[_0xb4d6('0x29')]['find']({'where':{'id':_0x4f6492[_0xb4d6('0x44')]['id']}})[_0xb4d6('0x20')](handleEntityNotFound(_0x2965cf,null))[_0xb4d6('0x20')](saveUpdates(_0x4f6492['body'],null))['then'](respondWithResult(_0x2965cf,null))[_0xb4d6('0x3d')](handleError(_0x2965cf,null));};exports[_0xb4d6('0x21')]=function(_0x15dd45,_0x2af6ac){return db[_0xb4d6('0x29')]['find']({'where':{'id':_0x15dd45['params']['id']}})[_0xb4d6('0x20')](handleEntityNotFound(_0x2af6ac,null))[_0xb4d6('0x20')](removeEntity(_0x2af6ac,null))[_0xb4d6('0x3d')](handleError(_0x2af6ac,null));};exports[_0xb4d6('0x45')]=function(_0x3c48ae,_0x416fa5){return db[_0xb4d6('0x29')][_0xb4d6('0x45')]()[_0xb4d6('0x20')](respondWithResult(_0x416fa5,null))[_0xb4d6('0x3d')](handleError(_0x416fa5,null));}; \ No newline at end of file +var _0x7995=['desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x4fd394,_0x34d30f){var _0x10ad9b=function(_0x1843ec){while(--_0x1843ec){_0x4fd394['push'](_0x4fd394['shift']());}};_0x10ad9b(++_0x34d30f);}(_0x7995,0xdd));var _0x5799=function(_0x2794fc,_0x1aff16){_0x2794fc=_0x2794fc-0x0;var _0xff1817=_0x7995[_0x2794fc];return _0xff1817;};'use strict';var emlformat=require(_0x5799('0x0'));var rimraf=require(_0x5799('0x1'));var zipdir=require(_0x5799('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5799('0x3'));var moment=require('moment');var BPromise=require(_0x5799('0x4'));var Mustache=require('mustache');var util=require(_0x5799('0x5'));var path=require('path');var sox=require(_0x5799('0x6'));var csv=require('to-csv');var ejs=require(_0x5799('0x7'));var fs=require('fs');var fs_extra=require(_0x5799('0x8'));var _=require(_0x5799('0x9'));var squel=require(_0x5799('0xa'));var crypto=require(_0x5799('0xb'));var jsforce=require(_0x5799('0xc'));var deskjs=require(_0x5799('0xd'));var toCsv=require(_0x5799('0xe'));var querystring=require('querystring');var Papa=require(_0x5799('0xf'));var Redis=require(_0x5799('0x10'));var authService=require(_0x5799('0x11'));var qs=require(_0x5799('0x12'));var as=require(_0x5799('0x13'));var hardwareService=require(_0x5799('0x14'));var logger=require(_0x5799('0x15'))(_0x5799('0x16'));var utils=require('../../config/utils');var config=require(_0x5799('0x17'));var licenseUtil=require(_0x5799('0x18'));var db=require(_0x5799('0x19'))['db'];function respondWithStatusCode(_0x382511,_0x37c25a){_0x37c25a=_0x37c25a||0xcc;return function(_0x445ad6){if(_0x445ad6){return _0x382511[_0x5799('0x1a')](_0x37c25a);}return _0x382511[_0x5799('0x1b')](_0x37c25a)[_0x5799('0x1c')]();};}function respondWithResult(_0x24d7ef,_0x5d5735){_0x5d5735=_0x5d5735||0xc8;return function(_0x356ce6){if(_0x356ce6){return _0x24d7ef[_0x5799('0x1b')](_0x5d5735)[_0x5799('0x1d')](_0x356ce6);}};}function respondWithFilteredResult(_0x4a88c8,_0x3eaee9){return function(_0x5d9601){if(_0x5d9601){var _0x17265c=typeof _0x3eaee9[_0x5799('0x1e')]===_0x5799('0x1f')&&typeof _0x3eaee9[_0x5799('0x20')]===_0x5799('0x1f');var _0x580990=_0x5d9601[_0x5799('0x21')];var _0x1812be=_0x17265c?0x0:_0x3eaee9[_0x5799('0x1e')];var _0x1fc09b=_0x17265c?_0x5d9601[_0x5799('0x21')]:_0x3eaee9[_0x5799('0x1e')]+_0x3eaee9['limit'];var _0x274a4a;if(_0x1fc09b>=_0x580990){_0x1fc09b=_0x580990;_0x274a4a=0xc8;}else{_0x274a4a=0xce;}_0x4a88c8[_0x5799('0x1b')](_0x274a4a);return _0x4a88c8['set']('Content-Range',_0x1812be+'-'+_0x1fc09b+'/'+_0x580990)['json'](_0x5d9601);}return null;};}function patchUpdates(_0x28290f){return function(_0x55160c){try{jsonpatch[_0x5799('0x22')](_0x55160c,_0x28290f,!![]);}catch(_0x1bb391){return BPromise[_0x5799('0x23')](_0x1bb391);}return _0x55160c[_0x5799('0x24')]();};}function saveUpdates(_0xa478da,_0x4c52ff){return function(_0x11ec53){if(_0x11ec53){return _0x11ec53[_0x5799('0x25')](_0xa478da)['then'](function(_0x7b0244){return _0x7b0244;});}return null;};}function removeEntity(_0x642a7e,_0x3d5130){return function(_0x2bb103){if(_0x2bb103){return _0x2bb103[_0x5799('0x26')]()[_0x5799('0x27')](function(){_0x642a7e[_0x5799('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d400d,_0x57db53){return function(_0x3b8e1d){if(!_0x3b8e1d){_0x1d400d[_0x5799('0x1a')](0x194);}return _0x3b8e1d;};}function handleError(_0x2a439b,_0x2c186e){_0x2c186e=_0x2c186e||0x1f4;return function(_0x19b55f){logger[_0x5799('0x28')](_0x19b55f[_0x5799('0x29')]);if(_0x19b55f[_0x5799('0x2a')]){delete _0x19b55f[_0x5799('0x2a')];}_0x2a439b[_0x5799('0x1b')](_0x2c186e)[_0x5799('0x2b')](_0x19b55f);};}exports[_0x5799('0x2c')]=function(_0x5d3663,_0x4c9a51){var _0x5e352f={},_0x110cb5={},_0x2e1ace={'count':0x0,'rows':[]};var _0x3254de=_[_0x5799('0x2d')](db[_0x5799('0x2e')][_0x5799('0x2f')],function(_0x2b9029){return{'name':_0x2b9029[_0x5799('0x30')],'type':_0x2b9029[_0x5799('0x31')]['key']};});_0x110cb5[_0x5799('0x32')]=_[_0x5799('0x2d')](_0x3254de,'name');_0x110cb5['query']=_[_0x5799('0x33')](_0x5d3663[_0x5799('0x34')]);_0x110cb5[_0x5799('0x35')]=_[_0x5799('0x36')](_0x110cb5[_0x5799('0x32')],_0x110cb5[_0x5799('0x34')]);_0x5e352f[_0x5799('0x37')]=_['intersection'](_0x110cb5[_0x5799('0x32')],qs[_0x5799('0x38')](_0x5d3663['query'][_0x5799('0x38')]));_0x5e352f[_0x5799('0x37')]=_0x5e352f[_0x5799('0x37')][_0x5799('0x39')]?_0x5e352f['attributes']:_0x110cb5['model'];if(!_0x5d3663[_0x5799('0x34')][_0x5799('0x3a')]('nolimit')){_0x5e352f[_0x5799('0x20')]=qs[_0x5799('0x20')](_0x5d3663['query'][_0x5799('0x20')]);_0x5e352f[_0x5799('0x1e')]=qs['offset'](_0x5d3663[_0x5799('0x34')][_0x5799('0x1e')]);}_0x5e352f[_0x5799('0x3b')]=qs[_0x5799('0x3c')](_0x5d3663[_0x5799('0x34')][_0x5799('0x3c')]);_0x5e352f[_0x5799('0x3d')]=qs[_0x5799('0x35')](_[_0x5799('0x3e')](_0x5d3663[_0x5799('0x34')],_0x110cb5['filters']),_0x3254de);if(_0x5d3663['query']['filter']){_0x5e352f['where']=_[_0x5799('0x3f')](_0x5e352f[_0x5799('0x3d')],{'$or':_[_0x5799('0x2d')](_0x3254de,function(_0x1a6d56){if(_0x1a6d56['type']!==_0x5799('0x40')){var _0x15c19b={};_0x15c19b[_0x1a6d56['name']]={'$like':'%'+_0x5d3663[_0x5799('0x34')][_0x5799('0x41')]+'%'};return _0x15c19b;}})});}_0x5e352f=_[_0x5799('0x3f')]({},_0x5e352f,_0x5d3663[_0x5799('0x42')]);var _0x3b9875={'where':_0x5e352f['where']};return db['MailSubstatus'][_0x5799('0x21')](_0x3b9875)[_0x5799('0x27')](function(_0x597723){_0x2e1ace[_0x5799('0x21')]=_0x597723;if(_0x5d3663[_0x5799('0x34')][_0x5799('0x43')]){_0x5e352f[_0x5799('0x44')]=[{'all':!![]}];}return db[_0x5799('0x2e')][_0x5799('0x45')](_0x5e352f);})['then'](function(_0x4d91e8){_0x2e1ace[_0x5799('0x46')]=_0x4d91e8;return _0x2e1ace;})[_0x5799('0x27')](respondWithFilteredResult(_0x4c9a51,_0x5e352f))[_0x5799('0x47')](handleError(_0x4c9a51,null));};exports[_0x5799('0x48')]=function(_0x321c5a,_0x4a4f7c){var _0x19f267={'raw':!![],'where':{'id':_0x321c5a[_0x5799('0x49')]['id']}},_0x1929f3={};_0x1929f3[_0x5799('0x32')]=_[_0x5799('0x33')](db[_0x5799('0x2e')][_0x5799('0x2f')]);_0x1929f3[_0x5799('0x34')]=_[_0x5799('0x33')](_0x321c5a['query']);_0x1929f3[_0x5799('0x35')]=_[_0x5799('0x36')](_0x1929f3[_0x5799('0x32')],_0x1929f3['query']);_0x19f267['attributes']=_[_0x5799('0x36')](_0x1929f3[_0x5799('0x32')],qs[_0x5799('0x38')](_0x321c5a[_0x5799('0x34')][_0x5799('0x38')]));_0x19f267['attributes']=_0x19f267[_0x5799('0x37')][_0x5799('0x39')]?_0x19f267[_0x5799('0x37')]:_0x1929f3[_0x5799('0x32')];if(_0x321c5a[_0x5799('0x34')][_0x5799('0x43')]){_0x19f267[_0x5799('0x44')]=[{'all':!![]}];}_0x19f267=_[_0x5799('0x3f')]({},_0x19f267,_0x321c5a['options']);return db['MailSubstatus'][_0x5799('0x4a')](_0x19f267)[_0x5799('0x27')](handleEntityNotFound(_0x4a4f7c,null))[_0x5799('0x27')](respondWithResult(_0x4a4f7c,null))[_0x5799('0x47')](handleError(_0x4a4f7c,null));};exports[_0x5799('0x4b')]=function(_0x460c39,_0x537789){return db[_0x5799('0x2e')][_0x5799('0x4b')](_0x460c39[_0x5799('0x4c')],{})['then'](respondWithResult(_0x537789,0xc9))[_0x5799('0x47')](handleError(_0x537789,null));};exports[_0x5799('0x25')]=function(_0x1707bd,_0x40f386){if(_0x1707bd[_0x5799('0x4c')]['id']){delete _0x1707bd[_0x5799('0x4c')]['id'];}return db[_0x5799('0x2e')][_0x5799('0x4a')]({'where':{'id':_0x1707bd[_0x5799('0x49')]['id']}})[_0x5799('0x27')](handleEntityNotFound(_0x40f386,null))[_0x5799('0x27')](saveUpdates(_0x1707bd[_0x5799('0x4c')],null))['then'](respondWithResult(_0x40f386,null))[_0x5799('0x47')](handleError(_0x40f386,null));};exports[_0x5799('0x26')]=function(_0x536cdd,_0x3b9a6c){return db[_0x5799('0x2e')][_0x5799('0x4a')]({'where':{'id':_0x536cdd[_0x5799('0x49')]['id']}})[_0x5799('0x27')](handleEntityNotFound(_0x3b9a6c,null))[_0x5799('0x27')](removeEntity(_0x3b9a6c,null))['catch'](handleError(_0x3b9a6c,null));};exports[_0x5799('0x4d')]=function(_0x3f250c,_0x3b35e8){return db[_0x5799('0x2e')][_0x5799('0x4d')]()[_0x5799('0x27')](respondWithResult(_0x3b35e8,null))[_0x5799('0x47')](handleError(_0x3b35e8,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index f7e0001..ea54925 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 _0x99e4=['hasOwnProperty','hook','exports','events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit'];(function(_0x552c8b,_0x2b3b8b){var _0x5302c0=function(_0x480706){while(--_0x480706){_0x552c8b['push'](_0x552c8b['shift']());}};_0x5302c0(++_0x2b3b8b);}(_0x99e4,0xe4));var _0x499e=function(_0x8821ca,_0x243e11){_0x8821ca=_0x8821ca-0x0;var _0x5a6088=_0x99e4[_0x8821ca];return _0x5a6088;};'use strict';var EventEmitter=require(_0x499e('0x0'));var MailSubstatus=require(_0x499e('0x1'))['db'][_0x499e('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x499e('0x3')](0x0);var events={'afterUpdate':_0x499e('0x4')};function emitEvent(_0x18dead){return function(_0x4b25cc,_0x29c629,_0x2f2419){MailSubstatusEvents[_0x499e('0x5')](_0x18dead+':'+_0x4b25cc['id'],_0x4b25cc);MailSubstatusEvents['emit'](_0x18dead,_0x4b25cc);_0x2f2419(null);};}for(var e in events){if(events[_0x499e('0x6')](e)){var event=events[e];MailSubstatus[_0x499e('0x7')](e,emitEvent(event));}}module[_0x499e('0x8')]=MailSubstatusEvents; \ No newline at end of file +var _0x8adf=['events','MailSubstatus','setMaxListeners','emit','hook','exports'];(function(_0x5cc165,_0x53380){var _0x52cfc0=function(_0x249dee){while(--_0x249dee){_0x5cc165['push'](_0x5cc165['shift']());}};_0x52cfc0(++_0x53380);}(_0x8adf,0x144));var _0xf8ad=function(_0x1407ed,_0x223307){_0x1407ed=_0x1407ed-0x0;var _0x2e1af1=_0x8adf[_0x1407ed];return _0x2e1af1;};'use strict';var EventEmitter=require(_0xf8ad('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0xf8ad('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xf8ad('0x2')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x229555){return function(_0x56de6a,_0x4de1e5,_0x1f2013){MailSubstatusEvents[_0xf8ad('0x3')](_0x229555+':'+_0x56de6a['id'],_0x56de6a);MailSubstatusEvents[_0xf8ad('0x3')](_0x229555,_0x56de6a);_0x1f2013(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0xf8ad('0x4')](e,emitEvent(event));}}module[_0xf8ad('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 c32d1c9..3b6f88b 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 _0xa04f=['update','name','mailSubstatus','_previousDataValues','then','catch','exports','models','define','MailSubstatus','mail_substatuses'];(function(_0x37bc7c,_0x192045){var _0x41775a=function(_0x2d8cf0){while(--_0x2d8cf0){_0x37bc7c['push'](_0x37bc7c['shift']());}};_0x41775a(++_0x192045);}(_0xa04f,0xa0));var _0xfa04=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0xa04f[_0x58dc25];return _0x21b0a7;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0xfa04('0x0')]=function(_0x3049af){var _0x4911af=_0x3049af[_0xfa04('0x1')];return _0x3049af[_0xfa04('0x2')](_0xfa04('0x3'),attributes,{'tableName':_0xfa04('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x3da39d,_0x41152a,_0x31c972){return _0x4911af['Condition'][_0xfa04('0x5')]({'value':_0x3da39d[_0xfa04('0x6')]},{'where':{'field':_0xfa04('0x7'),'value':_0x3da39d[_0xfa04('0x8')][_0xfa04('0x6')]}})[_0xfa04('0x9')](function(){_0x31c972();})[_0xfa04('0xa')](function(_0x2c96b6){_0x31c972(_0x2c96b6);});}}});}; \ No newline at end of file +var _0x8c7a=['exports','models','Condition','name','mailSubstatus','_previousDataValues','then','./mailSubstatus.attributes'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x8c7a,0x197));var _0xa8c7=function(_0x4ed9b7,_0x4198bc){_0x4ed9b7=_0x4ed9b7-0x0;var _0x5d56da=_0x8c7a[_0x4ed9b7];return _0x5d56da;};'use strict';var attributes=require(_0xa8c7('0x0'));module[_0xa8c7('0x1')]=function(_0x21b614){var _0x27399f=_0x21b614[_0xa8c7('0x2')];return _0x21b614['define']('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x189754,_0x44d295,_0x40d483){return _0x27399f[_0xa8c7('0x3')]['update']({'value':_0x189754[_0xa8c7('0x4')]},{'where':{'field':_0xa8c7('0x5'),'value':_0x189754[_0xa8c7('0x6')][_0xa8c7('0x4')]}})[_0xa8c7('0x7')](function(){_0x40d483();})['catch'](function(_0xa2cd18){_0x40d483(_0xa2cd18);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index f59c1b6..3ba2ab0 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 _0x3714=['../../config/utils','../../config/logger','rpc','jayson/promise','http','request','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x555132,_0x1b2e95){var _0x2c9499=function(_0x1214ad){while(--_0x1214ad){_0x555132['push'](_0x555132['shift']());}};_0x2c9499(++_0x1b2e95);}(_0x3714,0x95));var _0x4371=function(_0x39c8db,_0x4378b9){_0x39c8db=_0x39c8db-0x0;var _0x1d9407=_0x3714[_0x39c8db];return _0x1d9407;};'use strict';var _=require(_0x4371('0x0'));var util=require(_0x4371('0x1'));var moment=require('moment');var BPromise=require(_0x4371('0x2'));var rs=require(_0x4371('0x3'));var fs=require('fs');var Redis=require(_0x4371('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4371('0x5'));var logger=require(_0x4371('0x6'))(_0x4371('0x7'));var config=require('../../config/environment');var jayson=require(_0x4371('0x8'));var client=jayson['client'][_0x4371('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2280c1,_0x49778e,_0x31a32f){return new BPromise(function(_0x37af33,_0x43a2b4){return client[_0x4371('0xa')](_0x2280c1,_0x31a32f)['then'](function(_0x21fad3){logger['info'](_0x4371('0xb'),_0x49778e,_0x4371('0xc'));logger[_0x4371('0xd')](_0x4371('0xe'),_0x49778e,'request\x20sent',JSON[_0x4371('0xf')](_0x21fad3));if(_0x21fad3[_0x4371('0x10')]){if(_0x21fad3['error'][_0x4371('0x11')]===0x1f4){logger[_0x4371('0x10')](_0x4371('0xb'),_0x49778e,_0x21fad3[_0x4371('0x10')][_0x4371('0x12')]);return _0x43a2b4(_0x21fad3[_0x4371('0x10')][_0x4371('0x12')]);}logger[_0x4371('0x10')](_0x4371('0xb'),_0x49778e,_0x21fad3[_0x4371('0x10')][_0x4371('0x12')]);return _0x37af33(_0x21fad3['error'][_0x4371('0x12')]);}else{logger[_0x4371('0x13')](_0x4371('0xb'),_0x49778e,'request\x20sent');_0x37af33(_0x21fad3[_0x4371('0x14')][_0x4371('0x12')]);}})[_0x4371('0x15')](function(_0xa229c4){logger[_0x4371('0x10')](_0x4371('0xb'),_0x49778e,_0xa229c4);_0x43a2b4(_0xa229c4);});});} \ No newline at end of file +var _0xe797=['jayson/promise','client','http','then','info','MailSubstatus,\x20%s,\x20%s','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x53b199,_0x38ff21){var _0x1ba42d=function(_0x35dc53){while(--_0x35dc53){_0x53b199['push'](_0x53b199['shift']());}};_0x1ba42d(++_0x38ff21);}(_0xe797,0x1c6));var _0x7e79=function(_0x2ed41e,_0x35d56d){_0x2ed41e=_0x2ed41e-0x0;var _0x4655e9=_0xe797[_0x2ed41e];return _0x4655e9;};'use strict';var _=require(_0x7e79('0x0'));var util=require(_0x7e79('0x1'));var moment=require(_0x7e79('0x2'));var BPromise=require(_0x7e79('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7e79('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e79('0x5'));var logger=require('../../config/logger')(_0x7e79('0x6'));var config=require(_0x7e79('0x7'));var jayson=require(_0x7e79('0x8'));var client=jayson[_0x7e79('0x9')][_0x7e79('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b4b02,_0xef1e3d,_0x110c22){return new BPromise(function(_0x26fb2c,_0x5540d8){return client['request'](_0x5b4b02,_0x110c22)[_0x7e79('0xb')](function(_0x2e9454){logger[_0x7e79('0xc')](_0x7e79('0xd'),_0xef1e3d,'request\x20sent');logger['debug'](_0x7e79('0xe'),_0xef1e3d,_0x7e79('0xf'),JSON[_0x7e79('0x10')](_0x2e9454));if(_0x2e9454[_0x7e79('0x11')]){if(_0x2e9454['error'][_0x7e79('0x12')]===0x1f4){logger['error'](_0x7e79('0xd'),_0xef1e3d,_0x2e9454['error']['message']);return _0x5540d8(_0x2e9454[_0x7e79('0x11')]['message']);}logger[_0x7e79('0x11')](_0x7e79('0xd'),_0xef1e3d,_0x2e9454[_0x7e79('0x11')][_0x7e79('0x13')]);return _0x26fb2c(_0x2e9454[_0x7e79('0x11')][_0x7e79('0x13')]);}else{logger[_0x7e79('0xc')]('MailSubstatus,\x20%s,\x20%s',_0xef1e3d,_0x7e79('0xf'));_0x26fb2c(_0x2e9454[_0x7e79('0x14')][_0x7e79('0x13')]);}})[_0x7e79('0x15')](function(_0x335122){logger[_0x7e79('0x11')](_0x7e79('0xd'),_0xef1e3d,_0x335122);_0x5540d8(_0x335122);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index fc58bbd..da01d7d 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 _0x67e9=['util','path','connect-timeout','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','multer'];(function(_0x206a64,_0x508189){var _0x293ceb=function(_0x47f36a){while(--_0x47f36a){_0x206a64['push'](_0x206a64['shift']());}};_0x293ceb(++_0x508189);}(_0x67e9,0x120));var _0x967e=function(_0x48b88f,_0x2e1e94){_0x48b88f=_0x48b88f-0x0;var _0x34d441=_0x67e9[_0x48b88f];return _0x34d441;};'use strict';var multer=require(_0x967e('0x0'));var util=require(_0x967e('0x1'));var path=require(_0x967e('0x2'));var timeout=require(_0x967e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x967e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x967e('0x5'));var controller=require('./mailTransferReport.controller');router[_0x967e('0x6')]('/',auth[_0x967e('0x7')](),controller[_0x967e('0x8')]);router[_0x967e('0x6')]('/describe',auth[_0x967e('0x7')](),controller[_0x967e('0x9')]);router[_0x967e('0x6')](_0x967e('0xa'),auth[_0x967e('0x7')](),controller[_0x967e('0xb')]);router[_0x967e('0xc')]('/',auth[_0x967e('0x7')](),controller[_0x967e('0xd')]);router[_0x967e('0xe')](_0x967e('0xa'),auth[_0x967e('0x7')](),controller[_0x967e('0xf')]);router[_0x967e('0x10')]('/:id',auth[_0x967e('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x49b3=['update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','index','/describe','isAuthenticated','describe','get','/:id','post','create'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x49b3,0x7c));var _0x349b=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0x49b3[_0x266618];return _0x54dbf5;};'use strict';var multer=require(_0x349b('0x0'));var util=require('util');var path=require(_0x349b('0x1'));var timeout=require(_0x349b('0x2'));var express=require('express');var router=express[_0x349b('0x3')]();var fs_extra=require(_0x349b('0x4'));var auth=require(_0x349b('0x5'));var interaction=require(_0x349b('0x6'));var config=require('../../config/environment');var controller=require(_0x349b('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x349b('0x8')]);router['get'](_0x349b('0x9'),auth[_0x349b('0xa')](),controller[_0x349b('0xb')]);router[_0x349b('0xc')](_0x349b('0xd'),auth[_0x349b('0xa')](),controller['show']);router[_0x349b('0xe')]('/',auth[_0x349b('0xa')](),controller[_0x349b('0xf')]);router['put'](_0x349b('0xd'),auth['isAuthenticated'](),controller[_0x349b('0x10')]);router[_0x349b('0x11')]('/:id',auth[_0x349b('0xa')](),controller[_0x349b('0x12')]);module[_0x349b('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 65c49a1..5d97679 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0xdfb3c3,_0x59788d){var _0x4f9a74=function(_0x2f1544){while(--_0x2f1544){_0xdfb3c3['push'](_0xdfb3c3['shift']());}};_0x4f9a74(++_0x59788d);}(_0x54ef,0x112));var _0xf54e=function(_0x234c54,_0x6788d0){_0x234c54=_0x234c54-0x0;var _0x281132=_0x54ef[_0x234c54];return _0x281132;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x5204ca,_0x11ae9b){var _0x287567=function(_0x206bed){while(--_0x206bed){_0x5204ca['push'](_0x5204ca['shift']());}};_0x287567(++_0x11ae9b);}(_0xedd9,0xfc));var _0x9edd=function(_0x1a2b8f,_0x17b6f7){_0x1a2b8f=_0x1a2b8f-0x0;var _0x56f586=_0xedd9[_0x1a2b8f];return _0x56f586;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index da46662..4327e55 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 _0x72b6=['squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','map','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','MailTransferReport','includeAll','findAll','catch','show','rawAttributes','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra'];(function(_0x1cb0ac,_0x2755d7){var _0x3d51d6=function(_0x1dacd5){while(--_0x1dacd5){_0x1cb0ac['push'](_0x1cb0ac['shift']());}};_0x3d51d6(++_0x2755d7);}(_0x72b6,0x15d));var _0x672b=function(_0x22c85e,_0x45d421){_0x22c85e=_0x22c85e-0x0;var _0x3f8d11=_0x72b6[_0x22c85e];return _0x3f8d11;};'use strict';var emlformat=require(_0x672b('0x0'));var rimraf=require(_0x672b('0x1'));var zipdir=require(_0x672b('0x2'));var jsonpatch=require(_0x672b('0x3'));var rp=require('request-promise');var moment=require(_0x672b('0x4'));var BPromise=require(_0x672b('0x5'));var Mustache=require(_0x672b('0x6'));var util=require(_0x672b('0x7'));var path=require(_0x672b('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x672b('0x9'));var fs=require('fs');var fs_extra=require(_0x672b('0xa'));var _=require('lodash');var squel=require(_0x672b('0xb'));var crypto=require(_0x672b('0xc'));var jsforce=require(_0x672b('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x672b('0xe'));var Papa=require(_0x672b('0xf'));var Redis=require(_0x672b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x672b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x672b('0x12'));var logger=require(_0x672b('0x13'))(_0x672b('0x14'));var utils=require('../../config/utils');var config=require(_0x672b('0x15'));var licenseUtil=require(_0x672b('0x16'));var db=require(_0x672b('0x17'))['db'];function respondWithStatusCode(_0x3e64da,_0x2cb302){_0x2cb302=_0x2cb302||0xcc;return function(_0x6c307f){if(_0x6c307f){return _0x3e64da[_0x672b('0x18')](_0x2cb302);}return _0x3e64da[_0x672b('0x19')](_0x2cb302)[_0x672b('0x1a')]();};}function respondWithResult(_0x57b00c,_0x33f3b5){_0x33f3b5=_0x33f3b5||0xc8;return function(_0xeef0f3){if(_0xeef0f3){return _0x57b00c[_0x672b('0x19')](_0x33f3b5)['json'](_0xeef0f3);}};}function respondWithFilteredResult(_0x54771f,_0x4fd7f7){return function(_0x134f23){if(_0x134f23){var _0x447fab=typeof _0x4fd7f7[_0x672b('0x1b')]===_0x672b('0x1c')&&typeof _0x4fd7f7['limit']===_0x672b('0x1c');var _0x13d4d1=_0x134f23[_0x672b('0x1d')];var _0x457876=_0x447fab?0x0:_0x4fd7f7['offset'];var _0x21de31=_0x447fab?_0x134f23['count']:_0x4fd7f7[_0x672b('0x1b')]+_0x4fd7f7[_0x672b('0x1e')];var _0x8e6945;if(_0x21de31>=_0x13d4d1){_0x21de31=_0x13d4d1;_0x8e6945=0xc8;}else{_0x8e6945=0xce;}_0x54771f[_0x672b('0x19')](_0x8e6945);return _0x54771f[_0x672b('0x1f')](_0x672b('0x20'),_0x457876+'-'+_0x21de31+'/'+_0x13d4d1)[_0x672b('0x21')](_0x134f23);}return null;};}function patchUpdates(_0x19d50b){return function(_0x56a2fe){try{jsonpatch[_0x672b('0x22')](_0x56a2fe,_0x19d50b,!![]);}catch(_0x4f57b2){return BPromise[_0x672b('0x23')](_0x4f57b2);}return _0x56a2fe[_0x672b('0x24')]();};}function saveUpdates(_0x278f62,_0x5a87f9){return function(_0x104064){if(_0x104064){return _0x104064[_0x672b('0x25')](_0x278f62)[_0x672b('0x26')](function(_0x228b67){return _0x228b67;});}return null;};}function removeEntity(_0x3f692c,_0x46c2c0){return function(_0x2c0b21){if(_0x2c0b21){return _0x2c0b21[_0x672b('0x27')]()['then'](function(){_0x3f692c[_0x672b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x676fae,_0x55ab45){return function(_0x28c47d){if(!_0x28c47d){_0x676fae['sendStatus'](0x194);}return _0x28c47d;};}function handleError(_0x34c358,_0x4d8f3d){_0x4d8f3d=_0x4d8f3d||0x1f4;return function(_0x1ad8c5){logger[_0x672b('0x28')](_0x1ad8c5['stack']);if(_0x1ad8c5[_0x672b('0x29')]){delete _0x1ad8c5[_0x672b('0x29')];}_0x34c358['status'](_0x4d8f3d)[_0x672b('0x2a')](_0x1ad8c5);};}exports['index']=function(_0x5023f5,_0x13b8ec){var _0x1247af={},_0x17bf65={},_0xfdea0={'count':0x0,'rows':[]};var _0x1660bc=_[_0x672b('0x2b')](db['MailTransferReport']['rawAttributes'],function(_0x39ba84){return{'name':_0x39ba84['fieldName'],'type':_0x39ba84[_0x672b('0x2c')]['key']};});_0x17bf65[_0x672b('0x2d')]=_[_0x672b('0x2b')](_0x1660bc,_0x672b('0x29'));_0x17bf65[_0x672b('0x2e')]=_[_0x672b('0x2f')](_0x5023f5[_0x672b('0x2e')]);_0x17bf65['filters']=_[_0x672b('0x30')](_0x17bf65[_0x672b('0x2d')],_0x17bf65['query']);_0x1247af['attributes']=_['intersection'](_0x17bf65[_0x672b('0x2d')],qs[_0x672b('0x31')](_0x5023f5[_0x672b('0x2e')][_0x672b('0x31')]));_0x1247af[_0x672b('0x32')]=_0x1247af['attributes'][_0x672b('0x33')]?_0x1247af[_0x672b('0x32')]:_0x17bf65[_0x672b('0x2d')];if(!_0x5023f5[_0x672b('0x2e')][_0x672b('0x34')](_0x672b('0x35'))){_0x1247af['limit']=qs[_0x672b('0x1e')](_0x5023f5['query']['limit']);_0x1247af[_0x672b('0x1b')]=qs[_0x672b('0x1b')](_0x5023f5[_0x672b('0x2e')][_0x672b('0x1b')]);}_0x1247af['order']=qs[_0x672b('0x36')](_0x5023f5[_0x672b('0x2e')][_0x672b('0x36')]);_0x1247af[_0x672b('0x37')]=qs['filters'](_['pick'](_0x5023f5[_0x672b('0x2e')],_0x17bf65[_0x672b('0x38')]),_0x1660bc);if(_0x5023f5[_0x672b('0x2e')][_0x672b('0x39')]){_0x1247af[_0x672b('0x37')]=_[_0x672b('0x3a')](_0x1247af['where'],{'$or':_['map'](_0x1660bc,function(_0x3c321d){if(_0x3c321d[_0x672b('0x2c')]!==_0x672b('0x3b')){var _0xab0a9d={};_0xab0a9d[_0x3c321d[_0x672b('0x29')]]={'$like':'%'+_0x5023f5['query'][_0x672b('0x39')]+'%'};return _0xab0a9d;}})});}_0x1247af=_[_0x672b('0x3a')]({},_0x1247af,_0x5023f5[_0x672b('0x3c')]);var _0x477335={'where':_0x1247af[_0x672b('0x37')]};return db[_0x672b('0x3d')][_0x672b('0x1d')](_0x477335)[_0x672b('0x26')](function(_0xd9f2e6){_0xfdea0[_0x672b('0x1d')]=_0xd9f2e6;if(_0x5023f5['query'][_0x672b('0x3e')]){_0x1247af['include']=[{'all':!![]}];}return db[_0x672b('0x3d')][_0x672b('0x3f')](_0x1247af);})[_0x672b('0x26')](function(_0x36005e){_0xfdea0['rows']=_0x36005e;return _0xfdea0;})[_0x672b('0x26')](respondWithFilteredResult(_0x13b8ec,_0x1247af))[_0x672b('0x40')](handleError(_0x13b8ec,null));};exports[_0x672b('0x41')]=function(_0x17e36f,_0x20ac0b){var _0x3dbef3={'raw':!![],'where':{'id':_0x17e36f['params']['id']}},_0x15b232={};_0x15b232[_0x672b('0x2d')]=_[_0x672b('0x2f')](db['MailTransferReport'][_0x672b('0x42')]);_0x15b232[_0x672b('0x2e')]=_['keys'](_0x17e36f['query']);_0x15b232[_0x672b('0x38')]=_[_0x672b('0x30')](_0x15b232[_0x672b('0x2d')],_0x15b232[_0x672b('0x2e')]);_0x3dbef3[_0x672b('0x32')]=_[_0x672b('0x30')](_0x15b232['model'],qs['fields'](_0x17e36f['query'][_0x672b('0x31')]));_0x3dbef3[_0x672b('0x32')]=_0x3dbef3[_0x672b('0x32')][_0x672b('0x33')]?_0x3dbef3[_0x672b('0x32')]:_0x15b232[_0x672b('0x2d')];if(_0x17e36f[_0x672b('0x2e')]['includeAll']){_0x3dbef3[_0x672b('0x43')]=[{'all':!![]}];}_0x3dbef3=_[_0x672b('0x3a')]({},_0x3dbef3,_0x17e36f['options']);return db[_0x672b('0x3d')][_0x672b('0x44')](_0x3dbef3)['then'](handleEntityNotFound(_0x20ac0b,null))['then'](respondWithResult(_0x20ac0b,null))[_0x672b('0x40')](handleError(_0x20ac0b,null));};exports[_0x672b('0x45')]=function(_0x4fd384,_0x361eec){return db[_0x672b('0x3d')][_0x672b('0x45')](_0x4fd384['body'],{})[_0x672b('0x26')](respondWithResult(_0x361eec,0xc9))[_0x672b('0x40')](handleError(_0x361eec,null));};exports[_0x672b('0x25')]=function(_0x2f3277,_0x5ee09a){if(_0x2f3277['body']['id']){delete _0x2f3277[_0x672b('0x46')]['id'];}return db['MailTransferReport'][_0x672b('0x44')]({'where':{'id':_0x2f3277['params']['id']}})[_0x672b('0x26')](handleEntityNotFound(_0x5ee09a,null))['then'](saveUpdates(_0x2f3277[_0x672b('0x46')],null))['then'](respondWithResult(_0x5ee09a,null))[_0x672b('0x40')](handleError(_0x5ee09a,null));};exports[_0x672b('0x27')]=function(_0x3ce607,_0x34b3b9){return db[_0x672b('0x3d')][_0x672b('0x44')]({'where':{'id':_0x3ce607['params']['id']}})['then'](handleEntityNotFound(_0x34b3b9,null))[_0x672b('0x26')](removeEntity(_0x34b3b9,null))[_0x672b('0x40')](handleError(_0x34b3b9,null));};exports[_0x672b('0x47')]=function(_0x16811e,_0x1d8f91){return db[_0x672b('0x3d')][_0x672b('0x47')]()[_0x672b('0x26')](respondWithResult(_0x1d8f91,null))['catch'](handleError(_0x1d8f91,null));}; \ No newline at end of file +var _0xdb0a=['set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','MailTransferReport','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count'];(function(_0xd4151a,_0x76ff1a){var _0x429e1b=function(_0x1db992){while(--_0x1db992){_0xd4151a['push'](_0xd4151a['shift']());}};_0x429e1b(++_0x76ff1a);}(_0xdb0a,0x151));var _0xadb0=function(_0x13d15e,_0x2bc13e){_0x13d15e=_0x13d15e-0x0;var _0x5e2cad=_0xdb0a[_0x13d15e];return _0x5e2cad;};'use strict';var emlformat=require(_0xadb0('0x0'));var rimraf=require(_0xadb0('0x1'));var zipdir=require(_0xadb0('0x2'));var jsonpatch=require(_0xadb0('0x3'));var rp=require(_0xadb0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xadb0('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xadb0('0x6'));var ejs=require(_0xadb0('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xadb0('0x8'));var squel=require(_0xadb0('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xadb0('0xa'));var toCsv=require('to-csv');var querystring=require(_0xadb0('0xb'));var Papa=require(_0xadb0('0xc'));var Redis=require(_0xadb0('0xd'));var authService=require(_0xadb0('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xadb0('0xf'));var hardwareService=require(_0xadb0('0x10'));var logger=require(_0xadb0('0x11'))(_0xadb0('0x12'));var utils=require(_0xadb0('0x13'));var config=require(_0xadb0('0x14'));var licenseUtil=require(_0xadb0('0x15'));var db=require(_0xadb0('0x16'))['db'];function respondWithStatusCode(_0x5ed9de,_0x2faa9e){_0x2faa9e=_0x2faa9e||0xcc;return function(_0x2b2e7d){if(_0x2b2e7d){return _0x5ed9de['sendStatus'](_0x2faa9e);}return _0x5ed9de['status'](_0x2faa9e)['end']();};}function respondWithResult(_0x1c4e05,_0x25219a){_0x25219a=_0x25219a||0xc8;return function(_0x30f037){if(_0x30f037){return _0x1c4e05[_0xadb0('0x17')](_0x25219a)['json'](_0x30f037);}};}function respondWithFilteredResult(_0x1af40c,_0x4fd6d1){return function(_0x55d3f3){if(_0x55d3f3){var _0x5a110b=typeof _0x4fd6d1[_0xadb0('0x18')]===_0xadb0('0x19')&&typeof _0x4fd6d1[_0xadb0('0x1a')]===_0xadb0('0x19');var _0x4f0f43=_0x55d3f3['count'];var _0x455f7c=_0x5a110b?0x0:_0x4fd6d1['offset'];var _0xb1a0c8=_0x5a110b?_0x55d3f3[_0xadb0('0x1b')]:_0x4fd6d1[_0xadb0('0x18')]+_0x4fd6d1[_0xadb0('0x1a')];var _0x2f8e08;if(_0xb1a0c8>=_0x4f0f43){_0xb1a0c8=_0x4f0f43;_0x2f8e08=0xc8;}else{_0x2f8e08=0xce;}_0x1af40c[_0xadb0('0x17')](_0x2f8e08);return _0x1af40c[_0xadb0('0x1c')](_0xadb0('0x1d'),_0x455f7c+'-'+_0xb1a0c8+'/'+_0x4f0f43)[_0xadb0('0x1e')](_0x55d3f3);}return null;};}function patchUpdates(_0xec6da6){return function(_0x22bae9){try{jsonpatch[_0xadb0('0x1f')](_0x22bae9,_0xec6da6,!![]);}catch(_0xb28ca5){return BPromise[_0xadb0('0x20')](_0xb28ca5);}return _0x22bae9[_0xadb0('0x21')]();};}function saveUpdates(_0x13186d,_0x2ba4a4){return function(_0x127cf4){if(_0x127cf4){return _0x127cf4[_0xadb0('0x22')](_0x13186d)[_0xadb0('0x23')](function(_0x239117){return _0x239117;});}return null;};}function removeEntity(_0x91f25a,_0x389dd1){return function(_0x182ca5){if(_0x182ca5){return _0x182ca5[_0xadb0('0x24')]()[_0xadb0('0x23')](function(){_0x91f25a[_0xadb0('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e9b1f,_0x438c96){return function(_0x40195d){if(!_0x40195d){_0x3e9b1f[_0xadb0('0x25')](0x194);}return _0x40195d;};}function handleError(_0x5c839b,_0x56b165){_0x56b165=_0x56b165||0x1f4;return function(_0x21fd96){logger['error'](_0x21fd96[_0xadb0('0x26')]);if(_0x21fd96[_0xadb0('0x27')]){delete _0x21fd96['name'];}_0x5c839b['status'](_0x56b165)[_0xadb0('0x28')](_0x21fd96);};}exports[_0xadb0('0x29')]=function(_0x44cacf,_0x34efa6){var _0x3e1113={},_0xf065b1={},_0x30449e={'count':0x0,'rows':[]};var _0x13c20a=_[_0xadb0('0x2a')](db[_0xadb0('0x2b')]['rawAttributes'],function(_0x18bae8){return{'name':_0x18bae8['fieldName'],'type':_0x18bae8['type']['key']};});_0xf065b1[_0xadb0('0x2c')]=_[_0xadb0('0x2a')](_0x13c20a,'name');_0xf065b1[_0xadb0('0x2d')]=_[_0xadb0('0x2e')](_0x44cacf[_0xadb0('0x2d')]);_0xf065b1[_0xadb0('0x2f')]=_[_0xadb0('0x30')](_0xf065b1['model'],_0xf065b1[_0xadb0('0x2d')]);_0x3e1113[_0xadb0('0x31')]=_[_0xadb0('0x30')](_0xf065b1[_0xadb0('0x2c')],qs['fields'](_0x44cacf['query']['fields']));_0x3e1113[_0xadb0('0x31')]=_0x3e1113[_0xadb0('0x31')]['length']?_0x3e1113[_0xadb0('0x31')]:_0xf065b1[_0xadb0('0x2c')];if(!_0x44cacf[_0xadb0('0x2d')][_0xadb0('0x32')](_0xadb0('0x33'))){_0x3e1113[_0xadb0('0x1a')]=qs[_0xadb0('0x1a')](_0x44cacf[_0xadb0('0x2d')]['limit']);_0x3e1113[_0xadb0('0x18')]=qs[_0xadb0('0x18')](_0x44cacf[_0xadb0('0x2d')][_0xadb0('0x18')]);}_0x3e1113[_0xadb0('0x34')]=qs['sort'](_0x44cacf['query'][_0xadb0('0x35')]);_0x3e1113[_0xadb0('0x36')]=qs[_0xadb0('0x2f')](_[_0xadb0('0x37')](_0x44cacf[_0xadb0('0x2d')],_0xf065b1['filters']),_0x13c20a);if(_0x44cacf[_0xadb0('0x2d')][_0xadb0('0x38')]){_0x3e1113[_0xadb0('0x36')]=_['merge'](_0x3e1113[_0xadb0('0x36')],{'$or':_[_0xadb0('0x2a')](_0x13c20a,function(_0x469ebc){if(_0x469ebc[_0xadb0('0x39')]!==_0xadb0('0x3a')){var _0x589d7f={};_0x589d7f[_0x469ebc[_0xadb0('0x27')]]={'$like':'%'+_0x44cacf[_0xadb0('0x2d')]['filter']+'%'};return _0x589d7f;}})});}_0x3e1113=_['merge']({},_0x3e1113,_0x44cacf[_0xadb0('0x3b')]);var _0x563548={'where':_0x3e1113[_0xadb0('0x36')]};return db['MailTransferReport']['count'](_0x563548)[_0xadb0('0x23')](function(_0x1334ba){_0x30449e[_0xadb0('0x1b')]=_0x1334ba;if(_0x44cacf[_0xadb0('0x2d')][_0xadb0('0x3c')]){_0x3e1113[_0xadb0('0x3d')]=[{'all':!![]}];}return db[_0xadb0('0x2b')][_0xadb0('0x3e')](_0x3e1113);})[_0xadb0('0x23')](function(_0x50d662){_0x30449e[_0xadb0('0x3f')]=_0x50d662;return _0x30449e;})['then'](respondWithFilteredResult(_0x34efa6,_0x3e1113))[_0xadb0('0x40')](handleError(_0x34efa6,null));};exports[_0xadb0('0x41')]=function(_0x36d42e,_0xa2ce92){var _0x4b95c2={'raw':!![],'where':{'id':_0x36d42e[_0xadb0('0x42')]['id']}},_0x57e68a={};_0x57e68a[_0xadb0('0x2c')]=_['keys'](db[_0xadb0('0x2b')][_0xadb0('0x43')]);_0x57e68a['query']=_[_0xadb0('0x2e')](_0x36d42e[_0xadb0('0x2d')]);_0x57e68a[_0xadb0('0x2f')]=_['intersection'](_0x57e68a[_0xadb0('0x2c')],_0x57e68a[_0xadb0('0x2d')]);_0x4b95c2[_0xadb0('0x31')]=_[_0xadb0('0x30')](_0x57e68a[_0xadb0('0x2c')],qs[_0xadb0('0x44')](_0x36d42e[_0xadb0('0x2d')][_0xadb0('0x44')]));_0x4b95c2[_0xadb0('0x31')]=_0x4b95c2[_0xadb0('0x31')]['length']?_0x4b95c2['attributes']:_0x57e68a[_0xadb0('0x2c')];if(_0x36d42e[_0xadb0('0x2d')]['includeAll']){_0x4b95c2[_0xadb0('0x3d')]=[{'all':!![]}];}_0x4b95c2=_['merge']({},_0x4b95c2,_0x36d42e['options']);return db[_0xadb0('0x2b')][_0xadb0('0x45')](_0x4b95c2)[_0xadb0('0x23')](handleEntityNotFound(_0xa2ce92,null))[_0xadb0('0x23')](respondWithResult(_0xa2ce92,null))[_0xadb0('0x40')](handleError(_0xa2ce92,null));};exports[_0xadb0('0x46')]=function(_0x34adef,_0x3279f6){return db[_0xadb0('0x2b')][_0xadb0('0x46')](_0x34adef['body'],{})[_0xadb0('0x23')](respondWithResult(_0x3279f6,0xc9))[_0xadb0('0x40')](handleError(_0x3279f6,null));};exports[_0xadb0('0x22')]=function(_0x33c642,_0x1733f9){if(_0x33c642['body']['id']){delete _0x33c642['body']['id'];}return db['MailTransferReport'][_0xadb0('0x45')]({'where':{'id':_0x33c642[_0xadb0('0x42')]['id']}})['then'](handleEntityNotFound(_0x1733f9,null))[_0xadb0('0x23')](saveUpdates(_0x33c642[_0xadb0('0x47')],null))[_0xadb0('0x23')](respondWithResult(_0x1733f9,null))[_0xadb0('0x40')](handleError(_0x1733f9,null));};exports[_0xadb0('0x24')]=function(_0x2500e6,_0x49ea1c){return db['MailTransferReport'][_0xadb0('0x45')]({'where':{'id':_0x2500e6[_0xadb0('0x42')]['id']}})[_0xadb0('0x23')](handleEntityNotFound(_0x49ea1c,null))[_0xadb0('0x23')](removeEntity(_0x49ea1c,null))[_0xadb0('0x40')](handleError(_0x49ea1c,null));};exports[_0xadb0('0x48')]=function(_0x2c1d4e,_0x22c8a2){return db[_0xadb0('0x2b')][_0xadb0('0x48')]()['then'](respondWithResult(_0x22c8a2,null))[_0xadb0('0x40')](handleError(_0x22c8a2,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 24e8c2b..9da4a6d 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 _0x8fed=['../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x29dc09,_0x4951ba){var _0x4bb079=function(_0xee975e){while(--_0xee975e){_0x29dc09['push'](_0x29dc09['shift']());}};_0x4bb079(++_0x4951ba);}(_0x8fed,0xab));var _0xd8fe=function(_0x5d1216,_0x4a576b){_0x5d1216=_0x5d1216-0x0;var _0x143a48=_0x8fed[_0x5d1216];return _0x143a48;};'use strict';var _=require(_0xd8fe('0x0'));var util=require(_0xd8fe('0x1'));var logger=require(_0xd8fe('0x2'))(_0xd8fe('0x3'));var moment=require(_0xd8fe('0x4'));var BPromise=require(_0xd8fe('0x5'));var rp=require(_0xd8fe('0x6'));var fs=require('fs');var path=require(_0xd8fe('0x7'));var rimraf=require(_0xd8fe('0x8'));var config=require(_0xd8fe('0x9'));var attributes=require(_0xd8fe('0xa'));module[_0xd8fe('0xb')]=function(_0x343d98,_0x143f41){return _0x343d98['define'](_0xd8fe('0xc'),attributes,{'tableName':_0xd8fe('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xd8fe('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x374f=['define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports'];(function(_0x3fd797,_0x4b7c26){var _0x192323=function(_0x5d542c){while(--_0x5d542c){_0x3fd797['push'](_0x3fd797['shift']());}};_0x192323(++_0x4b7c26);}(_0x374f,0x13f));var _0xf374=function(_0x58a6e8,_0x4f6603){_0x58a6e8=_0x58a6e8-0x0;var _0x35ef3e=_0x374f[_0x58a6e8];return _0x35ef3e;};'use strict';var _=require(_0xf374('0x0'));var util=require(_0xf374('0x1'));var logger=require('../../config/logger')(_0xf374('0x2'));var moment=require(_0xf374('0x3'));var BPromise=require(_0xf374('0x4'));var rp=require(_0xf374('0x5'));var fs=require('fs');var path=require(_0xf374('0x6'));var rimraf=require(_0xf374('0x7'));var config=require(_0xf374('0x8'));var attributes=require(_0xf374('0x9'));module[_0xf374('0xa')]=function(_0x35fcaf,_0x45ba3c){return _0x35fcaf[_0xf374('0xb')](_0xf374('0xc'),attributes,{'tableName':_0xf374('0xd'),'paranoid':![],'indexes':[{'name':_0xf374('0xe'),'fields':[_0xf374('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 8a2ec45..c16d099 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 _0x0b2a=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','moment','randomstring','ioredis'];(function(_0x4a4378,_0x1c7b85){var _0x7cc462=function(_0x4b4486){while(--_0x4b4486){_0x4a4378['push'](_0x4a4378['shift']());}};_0x7cc462(++_0x1c7b85);}(_0x0b2a,0x88));var _0xa0b2=function(_0x2b50fa,_0x193c01){_0x2b50fa=_0x2b50fa-0x0;var _0x34ffc2=_0x0b2a[_0x2b50fa];return _0x34ffc2;};'use strict';var _=require(_0xa0b2('0x0'));var util=require('util');var moment=require(_0xa0b2('0x1'));var BPromise=require('bluebird');var rs=require(_0xa0b2('0x2'));var fs=require('fs');var Redis=require(_0xa0b2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa0b2('0x4'));var logger=require(_0xa0b2('0x5'))(_0xa0b2('0x6'));var config=require(_0xa0b2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa0b2('0x8')][_0xa0b2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5937a7,_0x98ef88,_0x146ae9){return new BPromise(function(_0x4553bd,_0xe1082f){return client[_0xa0b2('0xa')](_0x5937a7,_0x146ae9)[_0xa0b2('0xb')](function(_0x50b5dd){logger[_0xa0b2('0xc')](_0xa0b2('0xd'),_0x98ef88,_0xa0b2('0xe'));logger[_0xa0b2('0xf')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x98ef88,_0xa0b2('0xe'),JSON['stringify'](_0x50b5dd));if(_0x50b5dd[_0xa0b2('0x10')]){if(_0x50b5dd['error'][_0xa0b2('0x11')]===0x1f4){logger[_0xa0b2('0x10')](_0xa0b2('0xd'),_0x98ef88,_0x50b5dd[_0xa0b2('0x10')][_0xa0b2('0x12')]);return _0xe1082f(_0x50b5dd['error'][_0xa0b2('0x12')]);}logger[_0xa0b2('0x10')](_0xa0b2('0xd'),_0x98ef88,_0x50b5dd['error']['message']);return _0x4553bd(_0x50b5dd[_0xa0b2('0x10')][_0xa0b2('0x12')]);}else{logger['info'](_0xa0b2('0xd'),_0x98ef88,_0xa0b2('0xe'));_0x4553bd(_0x50b5dd['result']['message']);}})[_0xa0b2('0x13')](function(_0x2506d3){logger[_0xa0b2('0x10')](_0xa0b2('0xd'),_0x98ef88,_0x2506d3);_0xe1082f(_0x2506d3);});});} \ No newline at end of file +var _0x2919=['error','code','message','info','result','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','MailTransferReport,\x20%s,\x20%s','debug','stringify'];(function(_0x386cd0,_0xd35ee3){var _0x41135f=function(_0x2afef6){while(--_0x2afef6){_0x386cd0['push'](_0x386cd0['shift']());}};_0x41135f(++_0xd35ee3);}(_0x2919,0x148));var _0x9291=function(_0x2d2826,_0x3727b1){_0x2d2826=_0x2d2826-0x0;var _0x442a6f=_0x2919[_0x2d2826];return _0x442a6f;};'use strict';var _=require(_0x9291('0x0'));var util=require(_0x9291('0x1'));var moment=require(_0x9291('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9291('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9291('0x4'));var logger=require(_0x9291('0x5'))(_0x9291('0x6'));var config=require(_0x9291('0x7'));var jayson=require(_0x9291('0x8'));var client=jayson[_0x9291('0x9')][_0x9291('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x143028,_0x5db99f,_0x29e057){return new BPromise(function(_0x3c45c6,_0x326332){return client['request'](_0x143028,_0x29e057)['then'](function(_0x3a2ae7){logger['info'](_0x9291('0xb'),_0x5db99f,'request\x20sent');logger[_0x9291('0xc')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x5db99f,'request\x20sent',JSON[_0x9291('0xd')](_0x3a2ae7));if(_0x3a2ae7[_0x9291('0xe')]){if(_0x3a2ae7[_0x9291('0xe')][_0x9291('0xf')]===0x1f4){logger['error'](_0x9291('0xb'),_0x5db99f,_0x3a2ae7[_0x9291('0xe')][_0x9291('0x10')]);return _0x326332(_0x3a2ae7[_0x9291('0xe')][_0x9291('0x10')]);}logger[_0x9291('0xe')](_0x9291('0xb'),_0x5db99f,_0x3a2ae7[_0x9291('0xe')][_0x9291('0x10')]);return _0x3c45c6(_0x3a2ae7['error']['message']);}else{logger[_0x9291('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x5db99f,'request\x20sent');_0x3c45c6(_0x3a2ae7[_0x9291('0x12')][_0x9291('0x10')]);}})['catch'](function(_0x40dae0){logger[_0x9291('0xe')](_0x9291('0xb'),_0x5db99f,_0x40dae0);_0x326332(_0x40dae0);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 1654fca..7906096 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 _0xb67c=['get','isAuthenticated','index','/describe','show','post','create','put','/:id','update','delete','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller'];(function(_0x4be15e,_0x55144f){var _0x1014c6=function(_0x332ffa){while(--_0x332ffa){_0x4be15e['push'](_0x4be15e['shift']());}};_0x1014c6(++_0x55144f);}(_0xb67c,0x1ec));var _0xcb67=function(_0x14363e,_0x4f0e0d){_0x14363e=_0x14363e-0x0;var _0x17c56d=_0xb67c[_0x14363e];return _0x17c56d;};'use strict';var multer=require('multer');var util=require(_0xcb67('0x0'));var path=require('path');var timeout=require(_0xcb67('0x1'));var express=require(_0xcb67('0x2'));var router=express['Router']();var fs_extra=require(_0xcb67('0x3'));var auth=require(_0xcb67('0x4'));var interaction=require(_0xcb67('0x5'));var config=require(_0xcb67('0x6'));var controller=require(_0xcb67('0x7'));router[_0xcb67('0x8')]('/',auth[_0xcb67('0x9')](),controller[_0xcb67('0xa')]);router[_0xcb67('0x8')](_0xcb67('0xb'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xcb67('0xc')]);router[_0xcb67('0xd')]('/',auth[_0xcb67('0x9')](),controller[_0xcb67('0xe')]);router[_0xcb67('0xf')](_0xcb67('0x10'),auth[_0xcb67('0x9')](),controller[_0xcb67('0x11')]);router[_0xcb67('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xcb67('0x13')]=router; \ No newline at end of file +var _0xa0a7=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','index','/describe','isAuthenticated','get','/:id','show','post','create','put','delete','destroy','exports','multer','util'];(function(_0x288f37,_0x8bec16){var _0x2dc328=function(_0x488fba){while(--_0x488fba){_0x288f37['push'](_0x288f37['shift']());}};_0x2dc328(++_0x8bec16);}(_0xa0a7,0x116));var _0x7a0a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa0a7[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x7a0a('0x0'));var util=require(_0x7a0a('0x1'));var path=require('path');var timeout=require(_0x7a0a('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7a0a('0x3'));var auth=require(_0x7a0a('0x4'));var interaction=require(_0x7a0a('0x5'));var config=require(_0x7a0a('0x6'));var controller=require(_0x7a0a('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x7a0a('0x8')]);router['get'](_0x7a0a('0x9'),auth[_0x7a0a('0xa')](),controller['describe']);router[_0x7a0a('0xb')](_0x7a0a('0xc'),auth[_0x7a0a('0xa')](),controller[_0x7a0a('0xd')]);router[_0x7a0a('0xe')]('/',auth[_0x7a0a('0xa')](),controller[_0x7a0a('0xf')]);router[_0x7a0a('0x10')](_0x7a0a('0xc'),auth[_0x7a0a('0xa')](),controller['update']);router[_0x7a0a('0x11')](_0x7a0a('0xc'),auth['isAuthenticated'](),controller[_0x7a0a('0x12')]);module[_0x7a0a('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index e0c0ef8..bcca404 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 _0xc529=['getDataValue','enterAt','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE'];(function(_0x4d110c,_0x41eeb4){var _0x5bdf52=function(_0x5d4fb5){while(--_0x5d4fb5){_0x4d110c['push'](_0x4d110c['shift']());}};_0x5bdf52(++_0x41eeb4);}(_0xc529,0x109));var _0x9c52=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xc529[_0x5b78e8];return _0xf2c321;};'use strict';var Sequelize=require(_0x9c52('0x0'));var moment=require(_0x9c52('0x1'));module[_0x9c52('0x2')]={'channel':{'type':Sequelize[_0x9c52('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x9c52('0x3')]},'type':{'type':Sequelize[_0x9c52('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x9c52('0x4')},'duration':{'type':Sequelize[_0x9c52('0x5')]},'enterAt':{'type':Sequelize[_0x9c52('0x6')]},'exitAt':{'type':Sequelize[_0x9c52('0x6')],'set':function(_0x3d470f){var _0x59fbe2=moment(_0x3d470f);var _0x564844=moment(this[_0x9c52('0x7')](_0x9c52('0x8')));var _0x316c5a=_0x59fbe2['diff'](_0x564844,_0x9c52('0x9'));this[_0x9c52('0xa')](_0x9c52('0xb'),_0x3d470f);this[_0x9c52('0xa')]('duration',_0x316c5a>=0x0?_0x316c5a:null);}},'data1':{'type':Sequelize[_0x9c52('0x3')],'comment':_0x9c52('0xc')},'data2':{'type':Sequelize[_0x9c52('0x3')],'comment':_0x9c52('0xd')},'data3':{'type':Sequelize[_0x9c52('0x3')],'comment':_0x9c52('0xe')},'data4':{'type':Sequelize[_0x9c52('0x3')],'comment':_0x9c52('0xf')},'data5':{'type':Sequelize[_0x9c52('0x3')],'comment':_0x9c52('0x10')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x9c52('0x5')]},'uniqueid':{'type':Sequelize[_0x9c52('0x3')]}}; \ No newline at end of file +var _0xaf7c=['DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING'];(function(_0x2a4e2b,_0x423e6b){var _0x4bb0f0=function(_0x30a0ff){while(--_0x30a0ff){_0x2a4e2b['push'](_0x2a4e2b['shift']());}};_0x4bb0f0(++_0x423e6b);}(_0xaf7c,0x11c));var _0xcaf7=function(_0x5d6238,_0xe6992b){_0x5d6238=_0x5d6238-0x0;var _0x46ac6b=_0xaf7c[_0x5d6238];return _0x46ac6b;};'use strict';var Sequelize=require(_0xcaf7('0x0'));var moment=require(_0xcaf7('0x1'));module[_0xcaf7('0x2')]={'channel':{'type':Sequelize[_0xcaf7('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xcaf7('0x3')]},'type':{'type':Sequelize[_0xcaf7('0x3')],'defaultValue':_0xcaf7('0x4'),'comment':_0xcaf7('0x5')},'duration':{'type':Sequelize[_0xcaf7('0x6')]},'enterAt':{'type':Sequelize[_0xcaf7('0x7')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x3011fd){var _0x4891db=moment(_0x3011fd);var _0xb07a8d=moment(this[_0xcaf7('0x8')]('enterAt'));var _0x34581a=_0x4891db[_0xcaf7('0x9')](_0xb07a8d,_0xcaf7('0xa'));this[_0xcaf7('0xb')](_0xcaf7('0xc'),_0x3011fd);this[_0xcaf7('0xb')](_0xcaf7('0xd'),_0x34581a>=0x0?_0x34581a:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0xcaf7('0xe')},'data2':{'type':Sequelize[_0xcaf7('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xcaf7('0x3')],'comment':_0xcaf7('0xf')},'data4':{'type':Sequelize[_0xcaf7('0x3')],'comment':_0xcaf7('0x10')},'data5':{'type':Sequelize[_0xcaf7('0x3')],'comment':_0xcaf7('0x11')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0xcaf7('0x6')]},'uniqueid':{'type':Sequelize[_0xcaf7('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 007f80e..34e9b29 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 _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x57b5db,_0x1b29e8){var _0x2141e5=function(_0x127576){while(--_0x127576){_0x57b5db['push'](_0x57b5db['shift']());}};_0x2141e5(++_0x1b29e8);}(_0x9c44,0x178));var _0x49c4=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x9c44[_0x1d1779];return _0x2377e9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file +var _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x3c51d4,_0x36ba53){var _0x53c45f=function(_0x3d6683){while(--_0x3d6683){_0x3c51d4['push'](_0x3c51d4['shift']());}};_0x53c45f(++_0x36ba53);}(_0x34e8,0x12c));var _0x834e=function(_0xe25359,_0x45dc66){_0xe25359=_0xe25359-0x0;var _0xe45d8f=_0x34e8[_0xe25359];return _0xe45d8f;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 1f80485..75786b4 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 _0x861a=['request-promise','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','membername_interface','membername','interface','../../config/logger','api','moment'];(function(_0x277a5c,_0x5c8937){var _0x1b7138=function(_0x929069){while(--_0x929069){_0x277a5c['push'](_0x277a5c['shift']());}};_0x1b7138(++_0x5c8937);}(_0x861a,0xcd));var _0xa861=function(_0x36951e,_0x19be68){_0x36951e=_0x36951e-0x0;var _0x11bbd2=_0x861a[_0x36951e];return _0x11bbd2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa861('0x0'))(_0xa861('0x1'));var moment=require(_0xa861('0x2'));var BPromise=require('bluebird');var rp=require(_0xa861('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa861('0x4'));var config=require(_0xa861('0x5'));var attributes=require(_0xa861('0x6'));module[_0xa861('0x7')]=function(_0x5165fe,_0x58e201){return _0x5165fe[_0xa861('0x8')](_0xa861('0x9'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0xa861('0xa'),'fields':[_0xa861('0xb'),_0xa861('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e4=['path','rimraf','../../config/environment','exports','define','membername','interface','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xb7b878,_0x5c3b92){var _0x3c84b9=function(_0x21d5a2){while(--_0x21d5a2){_0xb7b878['push'](_0xb7b878['shift']());}};_0x3c84b9(++_0x5c3b92);}(_0xa9e4,0x89));var _0x4a9e=function(_0x1fb5ad,_0x2a5a7a){_0x1fb5ad=_0x1fb5ad-0x0;var _0xa3565c=_0xa9e4[_0x1fb5ad];return _0xa3565c;};'use strict';var _=require(_0x4a9e('0x0'));var util=require(_0x4a9e('0x1'));var logger=require(_0x4a9e('0x2'))(_0x4a9e('0x3'));var moment=require(_0x4a9e('0x4'));var BPromise=require(_0x4a9e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a9e('0x6'));var rimraf=require(_0x4a9e('0x7'));var config=require(_0x4a9e('0x8'));var attributes=require('./memberReport.attributes');module[_0x4a9e('0x9')]=function(_0xa541ce,_0x2cb9a4){return _0xa541ce[_0x4a9e('0xa')]('MemberReport',attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x4a9e('0xb'),_0x4a9e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 927f927..2337401 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 _0xee3c=['where','attributes','limit','include','model','map','CreateMemberReport','create','update','UpdateMemberReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MemberReport,\x20%s,\x20%s','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw'];(function(_0xaec0f0,_0x40a3b1){var _0x148af9=function(_0x1841fd){while(--_0x1841fd){_0xaec0f0['push'](_0xaec0f0['shift']());}};_0x148af9(++_0x40a3b1);}(_0xee3c,0x14a));var _0xcee3=function(_0x434298,_0x5c1c2c){_0x434298=_0x434298-0x0;var _0x6e2c13=_0xee3c[_0x434298];return _0x6e2c13;};'use strict';var _=require(_0xcee3('0x0'));var util=require(_0xcee3('0x1'));var moment=require(_0xcee3('0x2'));var BPromise=require(_0xcee3('0x3'));var rs=require(_0xcee3('0x4'));var fs=require('fs');var Redis=require(_0xcee3('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcee3('0x6'))(_0xcee3('0x7'));var config=require(_0xcee3('0x8'));var jayson=require(_0xcee3('0x9'));var client=jayson[_0xcee3('0xa')][_0xcee3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b8ffe,_0x97f00e,_0x22953c){return new BPromise(function(_0x364eb2,_0x4770ed){return client[_0xcee3('0xc')](_0x3b8ffe,_0x22953c)[_0xcee3('0xd')](function(_0x81de8e){logger[_0xcee3('0xe')]('MemberReport,\x20%s,\x20%s',_0x97f00e,_0xcee3('0xf'));logger[_0xcee3('0x10')](_0xcee3('0x11'),_0x97f00e,_0xcee3('0xf'),JSON[_0xcee3('0x12')](_0x81de8e));if(_0x81de8e[_0xcee3('0x13')]){if(_0x81de8e['error'][_0xcee3('0x14')]===0x1f4){logger[_0xcee3('0x13')](_0xcee3('0x15'),_0x97f00e,_0x81de8e[_0xcee3('0x13')][_0xcee3('0x16')]);return _0x4770ed(_0x81de8e['error'][_0xcee3('0x16')]);}logger['error']('MemberReport,\x20%s,\x20%s',_0x97f00e,_0x81de8e['error'][_0xcee3('0x16')]);return _0x364eb2(_0x81de8e[_0xcee3('0x13')]['message']);}else{logger['info'](_0xcee3('0x15'),_0x97f00e,'request\x20sent');_0x364eb2(_0x81de8e[_0xcee3('0x17')]['message']);}})[_0xcee3('0x18')](function(_0x952a21){logger['error'](_0xcee3('0x15'),_0x97f00e,_0x952a21);_0x4770ed(_0x952a21);});});}exports[_0xcee3('0x19')]=function(_0x40cb8b){var _0x2295c=this;return new Promise(function(_0x50bf6e,_0x164073){return db[_0xcee3('0x1a')][_0xcee3('0x1b')]({'raw':_0x40cb8b[_0xcee3('0x1c')]?_0x40cb8b['options'][_0xcee3('0x1d')]===undefined?!![]:![]:!![],'where':_0x40cb8b[_0xcee3('0x1c')]?_0x40cb8b[_0xcee3('0x1c')][_0xcee3('0x1e')]||null:null,'attributes':_0x40cb8b[_0xcee3('0x1c')]?_0x40cb8b[_0xcee3('0x1c')][_0xcee3('0x1f')]||null:null,'limit':_0x40cb8b[_0xcee3('0x1c')]?_0x40cb8b[_0xcee3('0x1c')][_0xcee3('0x20')]||null:null,'include':_0x40cb8b[_0xcee3('0x1c')]?_0x40cb8b[_0xcee3('0x1c')][_0xcee3('0x21')]?_['map'](_0x40cb8b[_0xcee3('0x1c')][_0xcee3('0x21')],function(_0x240736){return{'model':db[_0x240736[_0xcee3('0x22')]],'as':_0x240736['as'],'attributes':_0x240736[_0xcee3('0x1f')],'include':_0x240736['include']?_['map'](_0x240736[_0xcee3('0x21')],function(_0x5b92ba){return{'model':db[_0x5b92ba['model']],'as':_0x5b92ba['as'],'attributes':_0x5b92ba[_0xcee3('0x1f')],'include':_0x5b92ba['include']?_[_0xcee3('0x23')](_0x5b92ba[_0xcee3('0x21')],function(_0x19a15e){return{'model':db[_0x19a15e['model']],'as':_0x19a15e['as'],'attributes':_0x19a15e[_0xcee3('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f457d){logger['info'](_0xcee3('0x19'),_0x40cb8b);logger[_0xcee3('0x10')]('GetMemberReport',_0x40cb8b,JSON[_0xcee3('0x12')](_0x4f457d));_0x50bf6e(_0x4f457d);})[_0xcee3('0x18')](function(_0x5c1a32){logger[_0xcee3('0x13')]('GetMemberReport',_0x5c1a32['message'],_0x40cb8b);_0x164073(_0x2295c[_0xcee3('0x13')](0x1f4,_0x5c1a32['message']));});});};exports[_0xcee3('0x24')]=function(_0x1da1e6){var _0x375cab=this;return new Promise(function(_0x1b9087,_0x331290){return db[_0xcee3('0x1a')][_0xcee3('0x25')](_0x1da1e6['body'],{'raw':_0x1da1e6[_0xcee3('0x1c')]?_0x1da1e6['options'][_0xcee3('0x1d')]===undefined?!![]:![]:!![]})[_0xcee3('0xd')](function(_0x272ac8){logger[_0xcee3('0xe')](_0xcee3('0x24'),_0x1da1e6);logger[_0xcee3('0x10')](_0xcee3('0x24'),_0x1da1e6,JSON[_0xcee3('0x12')](_0x272ac8));_0x1b9087(_0x272ac8);})['catch'](function(_0x220867){logger[_0xcee3('0x13')](_0xcee3('0x24'),_0x220867['message'],_0x1da1e6);_0x331290(_0x375cab[_0xcee3('0x13')](0x1f4,_0x220867[_0xcee3('0x16')]));});});};exports['UpdateMemberReport']=function(_0x35c415){var _0x509ca6=this;return new Promise(function(_0x2a4996,_0x4b5c41){return db['MemberReport'][_0xcee3('0x26')](_0x35c415['body'],{'raw':_0x35c415[_0xcee3('0x1c')]?_0x35c415[_0xcee3('0x1c')][_0xcee3('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35c415[_0xcee3('0x1c')]?_0x35c415['options']['where']||null:null,'attributes':_0x35c415[_0xcee3('0x1c')]?_0x35c415[_0xcee3('0x1c')]['attributes']||null:null,'limit':_0x35c415[_0xcee3('0x1c')]?_0x35c415[_0xcee3('0x1c')]['limit']||null:null})[_0xcee3('0xd')](function(_0x20df38){logger[_0xcee3('0xe')](_0xcee3('0x27'),_0x35c415);logger[_0xcee3('0x10')](_0xcee3('0x27'),_0x35c415,JSON['stringify'](_0x20df38));_0x2a4996(_0x20df38);})[_0xcee3('0x18')](function(_0x149b93){logger[_0xcee3('0x13')](_0xcee3('0x27'),_0x149b93[_0xcee3('0x16')],_0x35c415);_0x4b5c41(_0x509ca6[_0xcee3('0x13')](0x1f4,_0x149b93[_0xcee3('0x16')]));});});}; \ No newline at end of file +var _0x7412=['UpdateMemberReport','lodash','bluebird','ioredis','client','http','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw','attributes','limit','include','map','model','CreateMemberReport','create','then','update','body'];(function(_0x20677a,_0x9eac17){var _0x161c0d=function(_0x3cb8e8){while(--_0x3cb8e8){_0x20677a['push'](_0x20677a['shift']());}};_0x161c0d(++_0x9eac17);}(_0x7412,0x161));var _0x2741=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x7412[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0x2741('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2741('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2741('0x2'));var db=require('../../mysqldb')['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[_0x2741('0x3')][_0x2741('0x4')]({'port':0x232a});function respondWithRpcPromise(_0x415623,_0x500ac0,_0x1f1f0d){return new BPromise(function(_0x1f1451,_0x3883ec){return client[_0x2741('0x5')](_0x415623,_0x1f1f0d)['then'](function(_0x35923c){logger[_0x2741('0x6')](_0x2741('0x7'),_0x500ac0,_0x2741('0x8'));logger[_0x2741('0x9')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x500ac0,_0x2741('0x8'),JSON[_0x2741('0xa')](_0x35923c));if(_0x35923c[_0x2741('0xb')]){if(_0x35923c[_0x2741('0xb')][_0x2741('0xc')]===0x1f4){logger[_0x2741('0xb')](_0x2741('0x7'),_0x500ac0,_0x35923c[_0x2741('0xb')]['message']);return _0x3883ec(_0x35923c[_0x2741('0xb')][_0x2741('0xd')]);}logger[_0x2741('0xb')](_0x2741('0x7'),_0x500ac0,_0x35923c[_0x2741('0xb')][_0x2741('0xd')]);return _0x1f1451(_0x35923c[_0x2741('0xb')][_0x2741('0xd')]);}else{logger[_0x2741('0x6')]('MemberReport,\x20%s,\x20%s',_0x500ac0,_0x2741('0x8'));_0x1f1451(_0x35923c[_0x2741('0xe')]['message']);}})[_0x2741('0xf')](function(_0x4537c5){logger['error']('MemberReport,\x20%s,\x20%s',_0x500ac0,_0x4537c5);_0x3883ec(_0x4537c5);});});}exports[_0x2741('0x10')]=function(_0x8fb51f){var _0x14cfa8=this;return new Promise(function(_0x27feb7,_0x32cddc){return db[_0x2741('0x11')][_0x2741('0x12')]({'raw':_0x8fb51f[_0x2741('0x13')]?_0x8fb51f['options'][_0x2741('0x14')]===undefined?!![]:![]:!![],'where':_0x8fb51f['options']?_0x8fb51f[_0x2741('0x13')]['where']||null:null,'attributes':_0x8fb51f['options']?_0x8fb51f[_0x2741('0x13')][_0x2741('0x15')]||null:null,'limit':_0x8fb51f[_0x2741('0x13')]?_0x8fb51f['options'][_0x2741('0x16')]||null:null,'include':_0x8fb51f[_0x2741('0x13')]?_0x8fb51f[_0x2741('0x13')][_0x2741('0x17')]?_['map'](_0x8fb51f[_0x2741('0x13')][_0x2741('0x17')],function(_0x5e54fb){return{'model':db[_0x5e54fb['model']],'as':_0x5e54fb['as'],'attributes':_0x5e54fb[_0x2741('0x15')],'include':_0x5e54fb['include']?_['map'](_0x5e54fb[_0x2741('0x17')],function(_0x4d09c9){return{'model':db[_0x4d09c9['model']],'as':_0x4d09c9['as'],'attributes':_0x4d09c9[_0x2741('0x15')],'include':_0x4d09c9[_0x2741('0x17')]?_[_0x2741('0x18')](_0x4d09c9[_0x2741('0x17')],function(_0x53aab8){return{'model':db[_0x53aab8[_0x2741('0x19')]],'as':_0x53aab8['as'],'attributes':_0x53aab8[_0x2741('0x15')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x355327){logger[_0x2741('0x6')]('GetMemberReport',_0x8fb51f);logger[_0x2741('0x9')]('GetMemberReport',_0x8fb51f,JSON[_0x2741('0xa')](_0x355327));_0x27feb7(_0x355327);})['catch'](function(_0x1440e5){logger['error'](_0x2741('0x10'),_0x1440e5[_0x2741('0xd')],_0x8fb51f);_0x32cddc(_0x14cfa8[_0x2741('0xb')](0x1f4,_0x1440e5[_0x2741('0xd')]));});});};exports[_0x2741('0x1a')]=function(_0x29e4c5){var _0x3c0283=this;return new Promise(function(_0x43eba7,_0x2c1b98){return db[_0x2741('0x11')][_0x2741('0x1b')](_0x29e4c5['body'],{'raw':_0x29e4c5[_0x2741('0x13')]?_0x29e4c5[_0x2741('0x13')][_0x2741('0x14')]===undefined?!![]:![]:!![]})[_0x2741('0x1c')](function(_0x13c809){logger[_0x2741('0x6')]('CreateMemberReport',_0x29e4c5);logger[_0x2741('0x9')]('CreateMemberReport',_0x29e4c5,JSON['stringify'](_0x13c809));_0x43eba7(_0x13c809);})[_0x2741('0xf')](function(_0x4c48e6){logger[_0x2741('0xb')](_0x2741('0x1a'),_0x4c48e6[_0x2741('0xd')],_0x29e4c5);_0x2c1b98(_0x3c0283['error'](0x1f4,_0x4c48e6[_0x2741('0xd')]));});});};exports['UpdateMemberReport']=function(_0x222dbc){var _0x4530ca=this;return new Promise(function(_0x3795e3,_0x489e11){return db['MemberReport'][_0x2741('0x1d')](_0x222dbc[_0x2741('0x1e')],{'raw':_0x222dbc[_0x2741('0x13')]?_0x222dbc[_0x2741('0x13')][_0x2741('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x222dbc['options']?_0x222dbc[_0x2741('0x13')]['where']||null:null,'attributes':_0x222dbc[_0x2741('0x13')]?_0x222dbc[_0x2741('0x13')][_0x2741('0x15')]||null:null,'limit':_0x222dbc[_0x2741('0x13')]?_0x222dbc['options'][_0x2741('0x16')]||null:null})[_0x2741('0x1c')](function(_0x2cf5a0){logger[_0x2741('0x6')](_0x2741('0x1f'),_0x222dbc);logger['debug'](_0x2741('0x1f'),_0x222dbc,JSON[_0x2741('0xa')](_0x2cf5a0));_0x3795e3(_0x2cf5a0);})[_0x2741('0xf')](function(_0x2abf1d){logger['error'](_0x2741('0x1f'),_0x2abf1d[_0x2741('0xd')],_0x222dbc);_0x489e11(_0x4530ca[_0x2741('0xb')](0x1f4,_0x2abf1d[_0x2741('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 7119503..b1e172a 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 _0xec37=['multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','exports'];(function(_0x280f80,_0x57ad7f){var _0x2e7beb=function(_0x67b522){while(--_0x67b522){_0x280f80['push'](_0x280f80['shift']());}};_0x2e7beb(++_0x57ad7f);}(_0xec37,0xd2));var _0x7ec3=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0xec37[_0x1ae5ab];return _0x1ce001;};'use strict';var multer=require(_0x7ec3('0x0'));var util=require(_0x7ec3('0x1'));var path=require('path');var timeout=require(_0x7ec3('0x2'));var express=require('express');var router=express[_0x7ec3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7ec3('0x4'));var interaction=require(_0x7ec3('0x5'));var config=require(_0x7ec3('0x6'));var controller=require('./migration.controller');router[_0x7ec3('0x7')]('/',controller[_0x7ec3('0x8')]);module[_0x7ec3('0x9')]=router; \ No newline at end of file +var _0xa245=['Router','fs-extra','../../components/auth/service','index','exports','multer','util','express'];(function(_0x2cf320,_0x3bf5d3){var _0x2a5f61=function(_0x33c69d){while(--_0x33c69d){_0x2cf320['push'](_0x2cf320['shift']());}};_0x2a5f61(++_0x3bf5d3);}(_0xa245,0x195));var _0x5a24=function(_0x1535a0,_0x11af95){_0x1535a0=_0x1535a0-0x0;var _0x57628e=_0xa245[_0x1535a0];return _0x57628e;};'use strict';var multer=require(_0x5a24('0x0'));var util=require(_0x5a24('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5a24('0x2'));var router=express[_0x5a24('0x3')]();var fs_extra=require(_0x5a24('0x4'));var auth=require(_0x5a24('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./migration.controller');router['get']('/',controller[_0x5a24('0x6')]);module[_0x5a24('0x7')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index d4db341..e69b2a1 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 _0x3b78=['STRING','version','sequelize','exports'];(function(_0x2962b4,_0x4b0786){var _0x411b7d=function(_0x363aad){while(--_0x363aad){_0x2962b4['push'](_0x2962b4['shift']());}};_0x411b7d(++_0x4b0786);}(_0x3b78,0x15e));var _0x83b7=function(_0x3a3500,_0x37c562){_0x3a3500=_0x3a3500-0x0;var _0x84a50d=_0x3b78[_0x3a3500];return _0x84a50d;};'use strict';var Sequelize=require(_0x83b7('0x0'));module[_0x83b7('0x1')]={'version':{'type':Sequelize[_0x83b7('0x2')],'unique':_0x83b7('0x3')}}; \ No newline at end of file +var _0x7d1c=['STRING','exports'];(function(_0x2f6f75,_0x2aaf90){var _0x47ebd1=function(_0x560131){while(--_0x560131){_0x2f6f75['push'](_0x2f6f75['shift']());}};_0x47ebd1(++_0x2aaf90);}(_0x7d1c,0x10f));var _0xc7d1=function(_0x37aed4,_0x254b7d){_0x37aed4=_0x37aed4-0x0;var _0x1ec4f3=_0x7d1c[_0x37aed4];return _0x1ec4f3;};'use strict';var Sequelize=require('sequelize');module[_0xc7d1('0x0')]={'version':{'type':Sequelize[_0xc7d1('0x1')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 9f28b09..4bab792 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 _0xc208=['query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','stack','name','index','map','Migration','fieldName','type','key','model'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0xc208,0x148));var _0x8c20=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc208[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8c20('0x0'));var zipdir=require(_0x8c20('0x1'));var jsonpatch=require(_0x8c20('0x2'));var rp=require(_0x8c20('0x3'));var moment=require(_0x8c20('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8c20('0x5'));var util=require('util');var path=require(_0x8c20('0x6'));var sox=require('sox');var csv=require(_0x8c20('0x7'));var ejs=require(_0x8c20('0x8'));var fs=require('fs');var fs_extra=require(_0x8c20('0x9'));var _=require(_0x8c20('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8c20('0xb'));var toCsv=require('to-csv');var querystring=require(_0x8c20('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8c20('0xd'));var qs=require(_0x8c20('0xe'));var as=require(_0x8c20('0xf'));var hardwareService=require(_0x8c20('0x10'));var logger=require(_0x8c20('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x8c20('0x12'));var licenseUtil=require(_0x8c20('0x13'));var db=require(_0x8c20('0x14'))['db'];function respondWithStatusCode(_0x2ed77e,_0x31eca0){_0x31eca0=_0x31eca0||0xcc;return function(_0x475695){if(_0x475695){return _0x2ed77e[_0x8c20('0x15')](_0x31eca0);}return _0x2ed77e[_0x8c20('0x16')](_0x31eca0)[_0x8c20('0x17')]();};}function respondWithResult(_0x1d375f,_0x33943f){_0x33943f=_0x33943f||0xc8;return function(_0x86c0de){if(_0x86c0de){return _0x1d375f['status'](_0x33943f)[_0x8c20('0x18')](_0x86c0de);}};}function respondWithFilteredResult(_0x53b0ad,_0x523774){return function(_0x51cd9c){if(_0x51cd9c){var _0x293b84=typeof _0x523774['offset']===_0x8c20('0x19')&&typeof _0x523774[_0x8c20('0x1a')]===_0x8c20('0x19');var _0x1a5789=_0x51cd9c[_0x8c20('0x1b')];var _0x12b376=_0x293b84?0x0:_0x523774[_0x8c20('0x1c')];var _0x3dcee0=_0x293b84?_0x51cd9c[_0x8c20('0x1b')]:_0x523774[_0x8c20('0x1c')]+_0x523774[_0x8c20('0x1a')];var _0x34efff;if(_0x3dcee0>=_0x1a5789){_0x3dcee0=_0x1a5789;_0x34efff=0xc8;}else{_0x34efff=0xce;}_0x53b0ad[_0x8c20('0x16')](_0x34efff);return _0x53b0ad['set'](_0x8c20('0x1d'),_0x12b376+'-'+_0x3dcee0+'/'+_0x1a5789)[_0x8c20('0x18')](_0x51cd9c);}return null;};}function patchUpdates(_0x12a4e8){return function(_0x3b939f){try{jsonpatch[_0x8c20('0x1e')](_0x3b939f,_0x12a4e8,!![]);}catch(_0x13cbaf){return BPromise['reject'](_0x13cbaf);}return _0x3b939f[_0x8c20('0x1f')]();};}function saveUpdates(_0x175347,_0x5db8df){return function(_0x89e6f5){if(_0x89e6f5){return _0x89e6f5[_0x8c20('0x20')](_0x175347)[_0x8c20('0x21')](function(_0x3f6d62){return _0x3f6d62;});}return null;};}function removeEntity(_0x5b3a39,_0x17a113){return function(_0x41af6a){if(_0x41af6a){return _0x41af6a[_0x8c20('0x22')]()[_0x8c20('0x21')](function(){_0x5b3a39[_0x8c20('0x16')](0xcc)[_0x8c20('0x17')]();});}};}function handleEntityNotFound(_0x10d1b4,_0x438f62){return function(_0x342dc0){if(!_0x342dc0){_0x10d1b4[_0x8c20('0x15')](0x194);}return _0x342dc0;};}function handleError(_0x4c0343,_0x1c18ab){_0x1c18ab=_0x1c18ab||0x1f4;return function(_0x566d65){logger['error'](_0x566d65[_0x8c20('0x23')]);if(_0x566d65[_0x8c20('0x24')]){delete _0x566d65[_0x8c20('0x24')];}_0x4c0343['status'](_0x1c18ab)['send'](_0x566d65);};}exports[_0x8c20('0x25')]=function(_0x1e2a66,_0x5e0a28){var _0x5aac56={},_0x27b396={},_0xcb2833={'count':0x0,'rows':[]};var _0x31430a=_[_0x8c20('0x26')](db[_0x8c20('0x27')]['rawAttributes'],function(_0x294ae5){return{'name':_0x294ae5[_0x8c20('0x28')],'type':_0x294ae5[_0x8c20('0x29')][_0x8c20('0x2a')]};});_0x27b396[_0x8c20('0x2b')]=_[_0x8c20('0x26')](_0x31430a,_0x8c20('0x24'));_0x27b396[_0x8c20('0x2c')]=_['keys'](_0x1e2a66[_0x8c20('0x2c')]);_0x27b396['filters']=_[_0x8c20('0x2d')](_0x27b396[_0x8c20('0x2b')],_0x27b396[_0x8c20('0x2c')]);_0x5aac56[_0x8c20('0x2e')]=_[_0x8c20('0x2d')](_0x27b396[_0x8c20('0x2b')],qs[_0x8c20('0x2f')](_0x1e2a66[_0x8c20('0x2c')][_0x8c20('0x2f')]));_0x5aac56['attributes']=_0x5aac56[_0x8c20('0x2e')][_0x8c20('0x30')]?_0x5aac56[_0x8c20('0x2e')]:_0x27b396[_0x8c20('0x2b')];if(!_0x1e2a66[_0x8c20('0x2c')]['hasOwnProperty'](_0x8c20('0x31'))){_0x5aac56['limit']=qs[_0x8c20('0x1a')](_0x1e2a66['query']['limit']);_0x5aac56[_0x8c20('0x1c')]=qs[_0x8c20('0x1c')](_0x1e2a66[_0x8c20('0x2c')][_0x8c20('0x1c')]);}_0x5aac56[_0x8c20('0x32')]=qs[_0x8c20('0x33')](_0x1e2a66[_0x8c20('0x2c')][_0x8c20('0x33')]);_0x5aac56[_0x8c20('0x34')]=qs[_0x8c20('0x35')](_[_0x8c20('0x36')](_0x1e2a66[_0x8c20('0x2c')],_0x27b396[_0x8c20('0x35')]),_0x31430a);if(_0x1e2a66['query'][_0x8c20('0x37')]){_0x5aac56[_0x8c20('0x34')]=_[_0x8c20('0x38')](_0x5aac56[_0x8c20('0x34')],{'$or':_[_0x8c20('0x26')](_0x31430a,function(_0x153ea2){if(_0x153ea2[_0x8c20('0x29')]!==_0x8c20('0x39')){var _0x550c20={};_0x550c20[_0x153ea2[_0x8c20('0x24')]]={'$like':'%'+_0x1e2a66[_0x8c20('0x2c')][_0x8c20('0x37')]+'%'};return _0x550c20;}})});}_0x5aac56=_[_0x8c20('0x38')]({},_0x5aac56,_0x1e2a66[_0x8c20('0x3a')]);var _0x365976={'where':_0x5aac56[_0x8c20('0x34')]};return db[_0x8c20('0x27')][_0x8c20('0x1b')](_0x365976)[_0x8c20('0x21')](function(_0x594dc0){_0xcb2833[_0x8c20('0x1b')]=_0x594dc0;if(_0x1e2a66['query'][_0x8c20('0x3b')]){_0x5aac56[_0x8c20('0x3c')]=[{'all':!![]}];}return db['Migration'][_0x8c20('0x3d')](_0x5aac56);})[_0x8c20('0x21')](function(_0x548a7a){_0xcb2833['rows']=_0x548a7a;return _0xcb2833;})[_0x8c20('0x21')](respondWithFilteredResult(_0x5e0a28,_0x5aac56))['catch'](handleError(_0x5e0a28,null));}; \ No newline at end of file +var _0xb5be=['sort','pick','merge','where','type','VIRTUAL','options','includeAll','include','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','error','name','send','index','Migration','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','nolimit'];(function(_0x16e57d,_0x2cb7ba){var _0x40239c=function(_0x3cc8f0){while(--_0x3cc8f0){_0x16e57d['push'](_0x16e57d['shift']());}};_0x40239c(++_0x2cb7ba);}(_0xb5be,0x116));var _0xeb5b=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xb5be[_0x8c43de];return _0xa6591b;};'use strict';var emlformat=require(_0xeb5b('0x0'));var rimraf=require(_0xeb5b('0x1'));var zipdir=require(_0xeb5b('0x2'));var jsonpatch=require(_0xeb5b('0x3'));var rp=require(_0xeb5b('0x4'));var moment=require(_0xeb5b('0x5'));var BPromise=require(_0xeb5b('0x6'));var Mustache=require(_0xeb5b('0x7'));var util=require(_0xeb5b('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xeb5b('0x9'));var ejs=require(_0xeb5b('0xa'));var fs=require('fs');var fs_extra=require(_0xeb5b('0xb'));var _=require(_0xeb5b('0xc'));var squel=require(_0xeb5b('0xd'));var crypto=require(_0xeb5b('0xe'));var jsforce=require(_0xeb5b('0xf'));var deskjs=require(_0xeb5b('0x10'));var toCsv=require(_0xeb5b('0x9'));var querystring=require(_0xeb5b('0x11'));var Papa=require(_0xeb5b('0x12'));var Redis=require(_0xeb5b('0x13'));var authService=require(_0xeb5b('0x14'));var qs=require(_0xeb5b('0x15'));var as=require(_0xeb5b('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xeb5b('0x17'));var utils=require(_0xeb5b('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xeb5b('0x19'))['db'];function respondWithStatusCode(_0x38f17e,_0x23601d){_0x23601d=_0x23601d||0xcc;return function(_0x1a9554){if(_0x1a9554){return _0x38f17e[_0xeb5b('0x1a')](_0x23601d);}return _0x38f17e[_0xeb5b('0x1b')](_0x23601d)[_0xeb5b('0x1c')]();};}function respondWithResult(_0x245444,_0x5b1978){_0x5b1978=_0x5b1978||0xc8;return function(_0x50815f){if(_0x50815f){return _0x245444['status'](_0x5b1978)[_0xeb5b('0x1d')](_0x50815f);}};}function respondWithFilteredResult(_0xea7345,_0x44ffc5){return function(_0x5a2a8c){if(_0x5a2a8c){var _0x30dea4=typeof _0x44ffc5['offset']===_0xeb5b('0x1e')&&typeof _0x44ffc5['limit']===_0xeb5b('0x1e');var _0x54f48a=_0x5a2a8c[_0xeb5b('0x1f')];var _0x38c129=_0x30dea4?0x0:_0x44ffc5[_0xeb5b('0x20')];var _0x49050a=_0x30dea4?_0x5a2a8c[_0xeb5b('0x1f')]:_0x44ffc5['offset']+_0x44ffc5[_0xeb5b('0x21')];var _0x54722d;if(_0x49050a>=_0x54f48a){_0x49050a=_0x54f48a;_0x54722d=0xc8;}else{_0x54722d=0xce;}_0xea7345[_0xeb5b('0x1b')](_0x54722d);return _0xea7345['set'](_0xeb5b('0x22'),_0x38c129+'-'+_0x49050a+'/'+_0x54f48a)[_0xeb5b('0x1d')](_0x5a2a8c);}return null;};}function patchUpdates(_0x5c7bb4){return function(_0x25f5c7){try{jsonpatch[_0xeb5b('0x23')](_0x25f5c7,_0x5c7bb4,!![]);}catch(_0x8aa5c9){return BPromise[_0xeb5b('0x24')](_0x8aa5c9);}return _0x25f5c7[_0xeb5b('0x25')]();};}function saveUpdates(_0x35f633,_0x563b01){return function(_0x313b5e){if(_0x313b5e){return _0x313b5e[_0xeb5b('0x26')](_0x35f633)[_0xeb5b('0x27')](function(_0x167382){return _0x167382;});}return null;};}function removeEntity(_0xf023bc,_0x3a0cf3){return function(_0x7c3bf4){if(_0x7c3bf4){return _0x7c3bf4['destroy']()['then'](function(){_0xf023bc['status'](0xcc)[_0xeb5b('0x1c')]();});}};}function handleEntityNotFound(_0x4c52e6,_0x4e64ae){return function(_0x2f938e){if(!_0x2f938e){_0x4c52e6['sendStatus'](0x194);}return _0x2f938e;};}function handleError(_0x185616,_0x5e1b7d){_0x5e1b7d=_0x5e1b7d||0x1f4;return function(_0x53fc9b){logger[_0xeb5b('0x28')](_0x53fc9b['stack']);if(_0x53fc9b['name']){delete _0x53fc9b[_0xeb5b('0x29')];}_0x185616[_0xeb5b('0x1b')](_0x5e1b7d)[_0xeb5b('0x2a')](_0x53fc9b);};}exports[_0xeb5b('0x2b')]=function(_0x1c3621,_0x355d14){var _0xe408e7={},_0x9b04c1={},_0xfb8f8={'count':0x0,'rows':[]};var _0x5b82cb=_['map'](db[_0xeb5b('0x2c')][_0xeb5b('0x2d')],function(_0x1a6a9b){return{'name':_0x1a6a9b[_0xeb5b('0x2e')],'type':_0x1a6a9b['type'][_0xeb5b('0x2f')]};});_0x9b04c1[_0xeb5b('0x30')]=_[_0xeb5b('0x31')](_0x5b82cb,_0xeb5b('0x29'));_0x9b04c1[_0xeb5b('0x32')]=_['keys'](_0x1c3621['query']);_0x9b04c1[_0xeb5b('0x33')]=_[_0xeb5b('0x34')](_0x9b04c1[_0xeb5b('0x30')],_0x9b04c1[_0xeb5b('0x32')]);_0xe408e7[_0xeb5b('0x35')]=_['intersection'](_0x9b04c1['model'],qs[_0xeb5b('0x36')](_0x1c3621[_0xeb5b('0x32')][_0xeb5b('0x36')]));_0xe408e7['attributes']=_0xe408e7[_0xeb5b('0x35')][_0xeb5b('0x37')]?_0xe408e7[_0xeb5b('0x35')]:_0x9b04c1['model'];if(!_0x1c3621[_0xeb5b('0x32')]['hasOwnProperty'](_0xeb5b('0x38'))){_0xe408e7[_0xeb5b('0x21')]=qs['limit'](_0x1c3621[_0xeb5b('0x32')][_0xeb5b('0x21')]);_0xe408e7[_0xeb5b('0x20')]=qs['offset'](_0x1c3621[_0xeb5b('0x32')][_0xeb5b('0x20')]);}_0xe408e7['order']=qs[_0xeb5b('0x39')](_0x1c3621[_0xeb5b('0x32')]['sort']);_0xe408e7['where']=qs['filters'](_[_0xeb5b('0x3a')](_0x1c3621['query'],_0x9b04c1[_0xeb5b('0x33')]),_0x5b82cb);if(_0x1c3621[_0xeb5b('0x32')]['filter']){_0xe408e7['where']=_[_0xeb5b('0x3b')](_0xe408e7[_0xeb5b('0x3c')],{'$or':_[_0xeb5b('0x31')](_0x5b82cb,function(_0x5c2258){if(_0x5c2258[_0xeb5b('0x3d')]!==_0xeb5b('0x3e')){var _0x588a2a={};_0x588a2a[_0x5c2258['name']]={'$like':'%'+_0x1c3621[_0xeb5b('0x32')]['filter']+'%'};return _0x588a2a;}})});}_0xe408e7=_[_0xeb5b('0x3b')]({},_0xe408e7,_0x1c3621[_0xeb5b('0x3f')]);var _0x214506={'where':_0xe408e7[_0xeb5b('0x3c')]};return db['Migration'][_0xeb5b('0x1f')](_0x214506)[_0xeb5b('0x27')](function(_0x1c856d){_0xfb8f8[_0xeb5b('0x1f')]=_0x1c856d;if(_0x1c3621[_0xeb5b('0x32')][_0xeb5b('0x40')]){_0xe408e7[_0xeb5b('0x41')]=[{'all':!![]}];}return db['Migration']['findAll'](_0xe408e7);})['then'](function(_0x57ca92){_0xfb8f8['rows']=_0x57ca92;return _0xfb8f8;})[_0xeb5b('0x27')](respondWithFilteredResult(_0x355d14,_0xe408e7))[_0xeb5b('0x42')](handleError(_0x355d14,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index a4bd009..fa25ea1 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 _0x03fc=['define','Migration','migrations','util','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x2a40b3,_0xe1c253){var _0x4ac6cb=function(_0x5083fe){while(--_0x5083fe){_0x2a40b3['push'](_0x2a40b3['shift']());}};_0x4ac6cb(++_0xe1c253);}(_0x03fc,0x121));var _0xc03f=function(_0x53dee9,_0x1dc404){_0x53dee9=_0x53dee9-0x0;var _0x4c5da0=_0x03fc[_0x53dee9];return _0x4c5da0;};'use strict';var _=require('lodash');var util=require(_0xc03f('0x0'));var logger=require('../../config/logger')(_0xc03f('0x1'));var moment=require(_0xc03f('0x2'));var BPromise=require(_0xc03f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc03f('0x4'));var rimraf=require(_0xc03f('0x5'));var config=require(_0xc03f('0x6'));var attributes=require('./migration.attributes');module[_0xc03f('0x7')]=function(_0x30218d,_0x4be7af){return _0x30218d[_0xc03f('0x8')](_0xc03f('0x9'),attributes,{'tableName':_0xc03f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa86=['exports','Migration','migrations','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4cd485,_0x5f0ea8){var _0x277c71=function(_0xd99175){while(--_0xd99175){_0x4cd485['push'](_0x4cd485['shift']());}};_0x277c71(++_0x5f0ea8);}(_0xaa86,0x1a5));var _0x6aa8=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xaa86[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6aa8('0x0'))(_0x6aa8('0x1'));var moment=require(_0x6aa8('0x2'));var BPromise=require(_0x6aa8('0x3'));var rp=require(_0x6aa8('0x4'));var fs=require('fs');var path=require(_0x6aa8('0x5'));var rimraf=require(_0x6aa8('0x6'));var config=require(_0x6aa8('0x7'));var attributes=require('./migration.attributes');module[_0x6aa8('0x8')]=function(_0x414d85,_0xa00845){return _0x414d85['define'](_0x6aa8('0x9'),attributes,{'tableName':_0x6aa8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index f02801f..f51e813 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 _0x8aa7=['client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x203dc4,_0x588f8e){var _0x58e84b=function(_0x4d00de){while(--_0x4d00de){_0x203dc4['push'](_0x203dc4['shift']());}};_0x58e84b(++_0x588f8e);}(_0x8aa7,0xb6));var _0x78aa=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x8aa7[_0x3b0731];return _0x4204d7;};'use strict';var _=require('lodash');var util=require(_0x78aa('0x0'));var moment=require(_0x78aa('0x1'));var BPromise=require(_0x78aa('0x2'));var rs=require(_0x78aa('0x3'));var fs=require('fs');var Redis=require(_0x78aa('0x4'));var db=require(_0x78aa('0x5'))['db'];var utils=require(_0x78aa('0x6'));var logger=require('../../config/logger')(_0x78aa('0x7'));var config=require(_0x78aa('0x8'));var jayson=require(_0x78aa('0x9'));var client=jayson[_0x78aa('0xa')][_0x78aa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x369ee7,_0x462a9a,_0xa79008){return new BPromise(function(_0x2368ac,_0x460488){return client[_0x78aa('0xc')](_0x369ee7,_0xa79008)[_0x78aa('0xd')](function(_0x45d377){logger[_0x78aa('0xe')](_0x78aa('0xf'),_0x462a9a,_0x78aa('0x10'));logger[_0x78aa('0x11')](_0x78aa('0x12'),_0x462a9a,_0x78aa('0x10'),JSON['stringify'](_0x45d377));if(_0x45d377['error']){if(_0x45d377[_0x78aa('0x13')][_0x78aa('0x14')]===0x1f4){logger['error'](_0x78aa('0xf'),_0x462a9a,_0x45d377[_0x78aa('0x13')][_0x78aa('0x15')]);return _0x460488(_0x45d377[_0x78aa('0x13')][_0x78aa('0x15')]);}logger['error'](_0x78aa('0xf'),_0x462a9a,_0x45d377[_0x78aa('0x13')][_0x78aa('0x15')]);return _0x2368ac(_0x45d377[_0x78aa('0x13')][_0x78aa('0x15')]);}else{logger['info'](_0x78aa('0xf'),_0x462a9a,_0x78aa('0x10'));_0x2368ac(_0x45d377[_0x78aa('0x16')][_0x78aa('0x15')]);}})[_0x78aa('0x17')](function(_0x2897f8){logger['error']('Migration,\x20%s,\x20%s',_0x462a9a,_0x2897f8);_0x460488(_0x2897f8);});});} \ No newline at end of file +var _0x56dc=['http','request','then','info','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x544099,_0x372b30){var _0x20ab09=function(_0x149613){while(--_0x149613){_0x544099['push'](_0x544099['shift']());}};_0x20ab09(++_0x372b30);}(_0x56dc,0xfd));var _0xc56d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x56dc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc56d('0x0'));var util=require('util');var moment=require(_0xc56d('0x1'));var BPromise=require(_0xc56d('0x2'));var rs=require(_0xc56d('0x3'));var fs=require('fs');var Redis=require(_0xc56d('0x4'));var db=require(_0xc56d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc56d('0x6'))(_0xc56d('0x7'));var config=require(_0xc56d('0x8'));var jayson=require(_0xc56d('0x9'));var client=jayson[_0xc56d('0xa')][_0xc56d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x571341,_0x452715,_0x24b556){return new BPromise(function(_0x3ac7cd,_0x51ca01){return client[_0xc56d('0xc')](_0x571341,_0x24b556)[_0xc56d('0xd')](function(_0x3ff2cb){logger[_0xc56d('0xe')](_0xc56d('0xf'),_0x452715,'request\x20sent');logger[_0xc56d('0x10')](_0xc56d('0x11'),_0x452715,_0xc56d('0x12'),JSON['stringify'](_0x3ff2cb));if(_0x3ff2cb[_0xc56d('0x13')]){if(_0x3ff2cb[_0xc56d('0x13')][_0xc56d('0x14')]===0x1f4){logger[_0xc56d('0x13')]('Migration,\x20%s,\x20%s',_0x452715,_0x3ff2cb[_0xc56d('0x13')][_0xc56d('0x15')]);return _0x51ca01(_0x3ff2cb[_0xc56d('0x13')]['message']);}logger[_0xc56d('0x13')](_0xc56d('0xf'),_0x452715,_0x3ff2cb[_0xc56d('0x13')][_0xc56d('0x15')]);return _0x3ac7cd(_0x3ff2cb['error'][_0xc56d('0x15')]);}else{logger[_0xc56d('0xe')]('Migration,\x20%s,\x20%s',_0x452715,'request\x20sent');_0x3ac7cd(_0x3ff2cb[_0xc56d('0x16')][_0xc56d('0x15')]);}})[_0xc56d('0x17')](function(_0x1d142c){logger['error'](_0xc56d('0xf'),_0x452715,_0x1d142c);_0x51ca01(_0x1d142c);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index f9c31eb..8a3d2b9 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 _0x9906=['exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','update','destroy'];(function(_0x5ae409,_0x133671){var _0x2761a9=function(_0xa0f33b){while(--_0xa0f33b){_0x5ae409['push'](_0x5ae409['shift']());}};_0x2761a9(++_0x133671);}(_0x9906,0x1f1));var _0x6990=function(_0xe8bfe9,_0x54e593){_0xe8bfe9=_0xe8bfe9-0x0;var _0x2781a7=_0x9906[_0xe8bfe9];return _0x2781a7;};'use strict';var multer=require(_0x6990('0x0'));var util=require(_0x6990('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6990('0x2'));var router=express[_0x6990('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6990('0x4'));var interaction=require(_0x6990('0x5'));var config=require(_0x6990('0x6'));var controller=require('./network.controller');router[_0x6990('0x7')]('/',auth[_0x6990('0x8')](),controller[_0x6990('0x9')]);router['get'](_0x6990('0xa'),auth[_0x6990('0x8')](),controller['show']);router[_0x6990('0xb')]('/',auth[_0x6990('0x8')](),controller[_0x6990('0xc')]);router['put'](_0x6990('0xa'),auth['isAuthenticated'](),controller[_0x6990('0xd')]);router['delete'](_0x6990('0xa'),auth[_0x6990('0x8')](),controller[_0x6990('0xe')]);module[_0x6990('0xf')]=router; \ No newline at end of file +var _0xac39=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','show','post','update','destroy','exports','multer'];(function(_0x4b0290,_0x188c34){var _0x4bd9f4=function(_0x357f3f){while(--_0x357f3f){_0x4b0290['push'](_0x4b0290['shift']());}};_0x4bd9f4(++_0x188c34);}(_0xac39,0x11c));var _0x9ac3=function(_0x51dd55,_0x1afa47){_0x51dd55=_0x51dd55-0x0;var _0x498e7b=_0xac39[_0x51dd55];return _0x498e7b;};'use strict';var multer=require(_0x9ac3('0x0'));var util=require(_0x9ac3('0x1'));var path=require(_0x9ac3('0x2'));var timeout=require(_0x9ac3('0x3'));var express=require(_0x9ac3('0x4'));var router=express[_0x9ac3('0x5')]();var fs_extra=require(_0x9ac3('0x6'));var auth=require(_0x9ac3('0x7'));var interaction=require(_0x9ac3('0x8'));var config=require(_0x9ac3('0x9'));var controller=require(_0x9ac3('0xa'));router[_0x9ac3('0xb')]('/',auth[_0x9ac3('0xc')](),controller[_0x9ac3('0xd')]);router[_0x9ac3('0xb')]('/:id',auth[_0x9ac3('0xc')](),controller[_0x9ac3('0xe')]);router[_0x9ac3('0xf')]('/',auth[_0x9ac3('0xc')](),controller['create']);router['put']('/:id',auth[_0x9ac3('0xc')](),controller[_0x9ac3('0x10')]);router['delete']('/:id',auth[_0x9ac3('0xc')](),controller[_0x9ac3('0x11')]);module[_0x9ac3('0x12')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 05ab560..1cb6bf6 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 _0x8e57=['sequelize','exports','STRING'];(function(_0x54ecdb,_0x26d783){var _0x572726=function(_0x8c160){while(--_0x8c160){_0x54ecdb['push'](_0x54ecdb['shift']());}};_0x572726(++_0x26d783);}(_0x8e57,0x171));var _0x78e5=function(_0x262510,_0x484630){_0x262510=_0x262510-0x0;var _0xdb8479=_0x8e57[_0x262510];return _0xdb8479;};'use strict';var Sequelize=require(_0x78e5('0x0'));module[_0x78e5('0x1')]={'type':{'type':Sequelize['ENUM']('localnet','externip','stun','turn')},'value':{'type':Sequelize[_0x78e5('0x2')]},'username':{'type':Sequelize[_0x78e5('0x2')]},'password':{'type':Sequelize[_0x78e5('0x2')]}}; \ No newline at end of file +var _0xd33c=['sequelize','ENUM','localnet','externip','turn','STRING'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xd33c,0x120));var _0xcd33=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xd33c[_0x550d12];return _0x12103d;};'use strict';var Sequelize=require(_0xcd33('0x0'));module['exports']={'type':{'type':Sequelize[_0xcd33('0x1')](_0xcd33('0x2'),_0xcd33('0x3'),'stun',_0xcd33('0x4'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xcd33('0x5')]},'password':{'type':Sequelize[_0xcd33('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index b6645a2..cec0cb8 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 _0x46a7=['jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','Network','fieldName','type','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','rawAttributes','length','create','sequelize','transaction','body','toUpperCase','STUN','join','server/files/templates/stun_multiple.ejs','render','/etc/asterisk/stun_xcally.conf','Reload','TURN','readFileSync','server/files/templates/turn_multiple.ejs','utf8','writeFileSync','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','root','server/files/templates/network.ejs','format','chan_sip.so','find','params','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x30517b,_0x4c9a51){var _0x577725=function(_0x4adee1){while(--_0x4adee1){_0x30517b['push'](_0x30517b['shift']());}};_0x577725(++_0x4c9a51);}(_0x46a7,0x138));var _0x746a=function(_0x31e346,_0x21d10d){_0x31e346=_0x31e346-0x0;var _0x4872be=_0x46a7[_0x31e346];return _0x4872be;};'use strict';var emlformat=require(_0x746a('0x0'));var rimraf=require(_0x746a('0x1'));var zipdir=require(_0x746a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x746a('0x3'));var moment=require(_0x746a('0x4'));var BPromise=require(_0x746a('0x5'));var Mustache=require(_0x746a('0x6'));var util=require(_0x746a('0x7'));var path=require(_0x746a('0x8'));var sox=require(_0x746a('0x9'));var csv=require(_0x746a('0xa'));var ejs=require(_0x746a('0xb'));var fs=require('fs');var fs_extra=require(_0x746a('0xc'));var _=require(_0x746a('0xd'));var squel=require(_0x746a('0xe'));var crypto=require(_0x746a('0xf'));var jsforce=require(_0x746a('0x10'));var deskjs=require(_0x746a('0x11'));var toCsv=require('to-csv');var querystring=require(_0x746a('0x12'));var Papa=require(_0x746a('0x13'));var Redis=require(_0x746a('0x14'));var authService=require(_0x746a('0x15'));var qs=require(_0x746a('0x16'));var as=require(_0x746a('0x17'));var hardwareService=require(_0x746a('0x18'));var logger=require(_0x746a('0x19'))(_0x746a('0x1a'));var utils=require('../../config/utils');var config=require(_0x746a('0x1b'));var licenseUtil=require(_0x746a('0x1c'));var db=require(_0x746a('0x1d'))['db'];var jayson=require(_0x746a('0x1e'));var client=jayson[_0x746a('0x1f')][_0x746a('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x16d0c5,_0x102fa2,_0xed7a4,_0x3b0a40){return new BPromise(function(_0x172f5b,_0x24e56e){var _0x58acd8=_0x3b0a40||client;return _0x58acd8['request'](_0x16d0c5,_0xed7a4)[_0x746a('0x21')](function(_0x3976d2){logger[_0x746a('0x22')](_0x746a('0x23'),_0x102fa2,_0x746a('0x24'));logger[_0x746a('0x25')](_0x746a('0x26'),_0x102fa2,_0x746a('0x24'),JSON[_0x746a('0x27')](_0x3976d2));if(_0x3976d2['error']){if(_0x3976d2['error']['code']===0x1f4){logger[_0x746a('0x28')](_0x746a('0x23'),_0x102fa2,_0x3976d2[_0x746a('0x28')][_0x746a('0x29')]);return _0x24e56e(_0x3976d2[_0x746a('0x28')][_0x746a('0x29')]);}logger['error'](_0x746a('0x23'),_0x102fa2,_0x3976d2['error'][_0x746a('0x29')]);return _0x172f5b(_0x3976d2[_0x746a('0x28')][_0x746a('0x29')]);}else{logger[_0x746a('0x22')]('Network,\x20%s,\x20%s',_0x102fa2,_0x746a('0x24'));_0x172f5b(_0x3976d2[_0x746a('0x2a')][_0x746a('0x29')]);}})[_0x746a('0x2b')](function(_0x4940b3){logger[_0x746a('0x28')](_0x746a('0x23'),_0x102fa2,_0x4940b3);_0x24e56e(_0x4940b3);});});}function respondWithStatusCode(_0x53a44e,_0x4f33cc){_0x4f33cc=_0x4f33cc||0xcc;return function(_0x222edf){if(_0x222edf){return _0x53a44e[_0x746a('0x2c')](_0x4f33cc);}return _0x53a44e['status'](_0x4f33cc)[_0x746a('0x2d')]();};}function respondWithResult(_0xfb318d,_0x10cc56){_0x10cc56=_0x10cc56||0xc8;return function(_0x295752){if(_0x295752){return _0xfb318d[_0x746a('0x2e')](_0x10cc56)[_0x746a('0x2f')](_0x295752);}};}function respondWithFilteredResult(_0x2b91a0,_0x3016b5){return function(_0x46bfc0){if(_0x46bfc0){var _0x3f1bfa=typeof _0x3016b5[_0x746a('0x30')]===_0x746a('0x31')&&typeof _0x3016b5['limit']==='undefined';var _0x2d80a0=_0x46bfc0[_0x746a('0x32')];var _0x491250=_0x3f1bfa?0x0:_0x3016b5[_0x746a('0x30')];var _0x953e4e=_0x3f1bfa?_0x46bfc0[_0x746a('0x32')]:_0x3016b5[_0x746a('0x30')]+_0x3016b5['limit'];var _0x241508;if(_0x953e4e>=_0x2d80a0){_0x953e4e=_0x2d80a0;_0x241508=0xc8;}else{_0x241508=0xce;}_0x2b91a0['status'](_0x241508);return _0x2b91a0[_0x746a('0x33')](_0x746a('0x34'),_0x491250+'-'+_0x953e4e+'/'+_0x2d80a0)[_0x746a('0x2f')](_0x46bfc0);}return null;};}function patchUpdates(_0x17ad36){return function(_0x4d67f9){try{jsonpatch[_0x746a('0x35')](_0x4d67f9,_0x17ad36,!![]);}catch(_0x5bf350){return BPromise[_0x746a('0x36')](_0x5bf350);}return _0x4d67f9['save']();};}function saveUpdates(_0x2e6625,_0x28ea3a){return function(_0x4da4a1){if(_0x4da4a1){return _0x4da4a1[_0x746a('0x37')](_0x2e6625)[_0x746a('0x21')](function(_0x3d8853){return _0x3d8853;});}return null;};}function removeEntity(_0x5643f1,_0x2b4003){return function(_0x19de6e){if(_0x19de6e){return _0x19de6e[_0x746a('0x38')]()[_0x746a('0x21')](function(){_0x5643f1[_0x746a('0x2e')](0xcc)[_0x746a('0x2d')]();});}};}function handleEntityNotFound(_0x9c858e,_0x39044b){return function(_0x1d1ce4){if(!_0x1d1ce4){_0x9c858e[_0x746a('0x2c')](0x194);}return _0x1d1ce4;};}function handleError(_0x3c1173,_0x1b9dc0){_0x1b9dc0=_0x1b9dc0||0x1f4;return function(_0x57e467){logger['error'](_0x57e467[_0x746a('0x39')]);if(_0x57e467[_0x746a('0x3a')]){delete _0x57e467['name'];}_0x3c1173[_0x746a('0x2e')](_0x1b9dc0)[_0x746a('0x3b')](_0x57e467);};}exports[_0x746a('0x3c')]=function(_0x10e97c,_0x4b5bb2){var _0x32e5ee={},_0x157a75={},_0x58a510={'count':0x0,'rows':[]};var _0x3d3f9e=_[_0x746a('0x3d')](db[_0x746a('0x3e')]['rawAttributes'],function(_0x2b02f5){return{'name':_0x2b02f5[_0x746a('0x3f')],'type':_0x2b02f5[_0x746a('0x40')]['key']};});_0x157a75['model']=_[_0x746a('0x3d')](_0x3d3f9e,_0x746a('0x3a'));_0x157a75[_0x746a('0x41')]=_[_0x746a('0x42')](_0x10e97c[_0x746a('0x41')]);_0x157a75['filters']=_['intersection'](_0x157a75['model'],_0x157a75[_0x746a('0x41')]);_0x32e5ee['attributes']=_[_0x746a('0x43')](_0x157a75[_0x746a('0x44')],qs[_0x746a('0x45')](_0x10e97c[_0x746a('0x41')][_0x746a('0x45')]));_0x32e5ee[_0x746a('0x46')]=_0x32e5ee[_0x746a('0x46')]['length']?_0x32e5ee[_0x746a('0x46')]:_0x157a75[_0x746a('0x44')];if(!_0x10e97c[_0x746a('0x41')][_0x746a('0x47')](_0x746a('0x48'))){_0x32e5ee[_0x746a('0x49')]=qs[_0x746a('0x49')](_0x10e97c[_0x746a('0x41')][_0x746a('0x49')]);_0x32e5ee[_0x746a('0x30')]=qs[_0x746a('0x30')](_0x10e97c[_0x746a('0x41')][_0x746a('0x30')]);}_0x32e5ee['order']=qs['sort'](_0x10e97c['query'][_0x746a('0x4a')]);_0x32e5ee[_0x746a('0x4b')]=qs[_0x746a('0x4c')](_[_0x746a('0x4d')](_0x10e97c[_0x746a('0x41')],_0x157a75[_0x746a('0x4c')]),_0x3d3f9e);if(_0x10e97c['query'][_0x746a('0x4e')]){_0x32e5ee[_0x746a('0x4b')]=_[_0x746a('0x4f')](_0x32e5ee[_0x746a('0x4b')],{'$or':_[_0x746a('0x3d')](_0x3d3f9e,function(_0x514390){if(_0x514390[_0x746a('0x40')]!==_0x746a('0x50')){var _0x515263={};_0x515263[_0x514390[_0x746a('0x3a')]]={'$like':'%'+_0x10e97c[_0x746a('0x41')]['filter']+'%'};return _0x515263;}})});}_0x32e5ee=_[_0x746a('0x4f')]({},_0x32e5ee,_0x10e97c[_0x746a('0x51')]);var _0x2b033b={'where':_0x32e5ee[_0x746a('0x4b')]};return db[_0x746a('0x3e')][_0x746a('0x32')](_0x2b033b)[_0x746a('0x21')](function(_0x5290a1){_0x58a510['count']=_0x5290a1;if(_0x10e97c[_0x746a('0x41')][_0x746a('0x52')]){_0x32e5ee[_0x746a('0x53')]=[{'all':!![]}];}return db[_0x746a('0x3e')][_0x746a('0x54')](_0x32e5ee);})[_0x746a('0x21')](function(_0x5f1f89){_0x58a510[_0x746a('0x55')]=_0x5f1f89;return _0x58a510;})['then'](respondWithFilteredResult(_0x4b5bb2,_0x32e5ee))['catch'](handleError(_0x4b5bb2,null));};exports['show']=function(_0x37de8a,_0x306b42){var _0x361f88={'raw':!![],'where':{'id':_0x37de8a['params']['id']}},_0x58cefc={};_0x58cefc[_0x746a('0x44')]=_['keys'](db[_0x746a('0x3e')][_0x746a('0x56')]);_0x58cefc[_0x746a('0x41')]=_[_0x746a('0x42')](_0x37de8a[_0x746a('0x41')]);_0x58cefc['filters']=_[_0x746a('0x43')](_0x58cefc[_0x746a('0x44')],_0x58cefc['query']);_0x361f88[_0x746a('0x46')]=_[_0x746a('0x43')](_0x58cefc[_0x746a('0x44')],qs[_0x746a('0x45')](_0x37de8a[_0x746a('0x41')][_0x746a('0x45')]));_0x361f88[_0x746a('0x46')]=_0x361f88[_0x746a('0x46')][_0x746a('0x57')]?_0x361f88[_0x746a('0x46')]:_0x58cefc[_0x746a('0x44')];if(_0x37de8a[_0x746a('0x41')][_0x746a('0x52')]){_0x361f88[_0x746a('0x53')]=[{'all':!![]}];}_0x361f88=_[_0x746a('0x4f')]({},_0x361f88,_0x37de8a[_0x746a('0x51')]);return db['Network']['find'](_0x361f88)['then'](handleEntityNotFound(_0x306b42,null))['then'](respondWithResult(_0x306b42,null))[_0x746a('0x2b')](handleError(_0x306b42,null));};exports[_0x746a('0x58')]=function(_0x3a377b,_0xf6b8ec,_0x218cd3){var _0xa9e552;return db[_0x746a('0x59')][_0x746a('0x5a')](function(_0x18899c){return db[_0x746a('0x3e')]['create'](_0x3a377b[_0x746a('0x5b')],{'raw':!![]})[_0x746a('0x21')](function(_0x3d1b9d){_0xa9e552=_0x3d1b9d;return db[_0x746a('0x3e')][_0x746a('0x54')]({'where':{'type':_0x3a377b[_0x746a('0x5b')][_0x746a('0x40')]},'raw':!![]});})[_0x746a('0x21')](function(_0x5e870d){if(_0xa9e552['type'][_0x746a('0x5c')]()==_0x746a('0x5d')){var _0x5e8cbe=fs['readFileSync'](path[_0x746a('0x5e')](config['root'],_0x746a('0x5f')),'utf8');var _0x571123=ejs[_0x746a('0x60')](_0x5e8cbe,{'networks':_0x5e870d||[]});fs['writeFileSync'](_0x746a('0x61'),_0x571123);return respondWithRpcPromise(_0x746a('0x62'),'create',{'module':'res_stun_monitor.so'});}else if(_0xa9e552[_0x746a('0x40')][_0x746a('0x5c')]()==_0x746a('0x63')){var _0x2144c4=fs[_0x746a('0x64')](path['join'](config['root'],_0x746a('0x65')),_0x746a('0x66'));var _0x38cd1d=ejs[_0x746a('0x60')](_0x2144c4,{'networks':_0x5e870d||[]});fs[_0x746a('0x67')](_0x746a('0x68'),_0x38cd1d);return respondWithRpcPromise(_0x746a('0x62'),_0x746a('0x58'),{'module':_0x746a('0x69')});}else{var _0x3bb501=fs['readFileSync'](path['join'](config[_0x746a('0x6a')],_0x746a('0x6b')),_0x746a('0x66'));var _0x230fb0=ejs[_0x746a('0x60')](_0x3bb501,{'networks':_0x5e870d||[]});fs[_0x746a('0x67')](util[_0x746a('0x6c')]('/etc/asterisk/sip_xcally_%s.conf',_0x3a377b['body'][_0x746a('0x40')]['toLowerCase']()),_0x230fb0);return respondWithRpcPromise(_0x746a('0x62'),_0x746a('0x58'),{'module':_0x746a('0x6d')});}return null;})[_0x746a('0x21')](function(){return _0xa9e552;});})[_0x746a('0x21')](respondWithResult(_0xf6b8ec,0xc9))[_0x746a('0x2b')](handleError(_0xf6b8ec,null));};exports[_0x746a('0x37')]=function(_0x1d672b,_0xbad13b,_0x213d54){var _0x5b4ff8;return db[_0x746a('0x59')]['transaction'](function(_0x3daa80){return db['Network'][_0x746a('0x6e')]({'where':{'id':_0x1d672b[_0x746a('0x6f')]['id']}})[_0x746a('0x21')](handleEntityNotFound(_0xbad13b,null))[_0x746a('0x21')](saveUpdates(_0x1d672b['body'],null))[_0x746a('0x21')](function(_0x525fe7){if(_0x525fe7){_0x5b4ff8=_0x525fe7;return db[_0x746a('0x3e')][_0x746a('0x54')]({'where':{'type':_0x5b4ff8['type']},'raw':!![]});}return null;})['then'](function(_0x3eb331){if(_0x5b4ff8['type'][_0x746a('0x5c')]()==_0x746a('0x5d')){var _0x567dae=fs[_0x746a('0x64')](path[_0x746a('0x5e')](config[_0x746a('0x6a')],'server/files/templates/stun_multiple.ejs'),_0x746a('0x66'));var _0x43c6c5=ejs[_0x746a('0x60')](_0x567dae,{'networks':_0x3eb331||[]});fs[_0x746a('0x67')]('/etc/asterisk/stun_xcally.conf',_0x43c6c5);return respondWithRpcPromise('Reload',_0x746a('0x37'),{'module':_0x746a('0x69')});}else if(_0x5b4ff8[_0x746a('0x40')][_0x746a('0x5c')]()=='TURN'){var _0x5691d9=fs[_0x746a('0x64')](path[_0x746a('0x5e')](config['root'],_0x746a('0x65')),_0x746a('0x66'));var _0x2ced57=ejs[_0x746a('0x60')](_0x5691d9,{'networks':_0x3eb331||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x2ced57);return respondWithRpcPromise(_0x746a('0x62'),'update',{'module':_0x746a('0x69')});}else{var _0x137833=fs['readFileSync'](path[_0x746a('0x5e')](config[_0x746a('0x6a')],'server/files/templates/network.ejs'),_0x746a('0x66'));var _0x43db13=ejs[_0x746a('0x60')](_0x137833,{'networks':_0x3eb331||[]});fs[_0x746a('0x67')](util['format'](_0x746a('0x70'),_0x1d672b[_0x746a('0x5b')][_0x746a('0x40')][_0x746a('0x71')]()),_0x43db13);return respondWithRpcPromise(_0x746a('0x62'),_0x746a('0x37'),{'module':_0x746a('0x6d')});}return null;})['then'](function(_0x3221a7){if(_0x3221a7){return _0x5b4ff8;}return null;});})[_0x746a('0x21')](respondWithResult(_0xbad13b,null))[_0x746a('0x2b')](handleError(_0xbad13b,null));};exports[_0x746a('0x38')]=function(_0x4a518d,_0x4d4c0f,_0x4afa2b){var _0xeac725;return db[_0x746a('0x3e')]['find']({'where':{'id':_0x4a518d[_0x746a('0x6f')]['id']}})[_0x746a('0x21')](function(_0x2e87ce){_0xeac725=_0x2e87ce;return _0x2e87ce;})[_0x746a('0x21')](handleEntityNotFound(_0x4d4c0f,null))[_0x746a('0x21')](removeEntity(_0x4d4c0f,null))[_0x746a('0x21')](function(){if(_0xeac725){return db['Network']['findAll']({'where':{'type':_0xeac725['type']},'raw':!![]});}})[_0x746a('0x21')](function(_0x160da3){if(_0xeac725[_0x746a('0x40')][_0x746a('0x5c')]()==_0x746a('0x5d')){var _0x78b89a=fs[_0x746a('0x64')](path[_0x746a('0x5e')](config[_0x746a('0x6a')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x40b325=ejs[_0x746a('0x60')](_0x78b89a,{'networks':_0x160da3||[]});fs[_0x746a('0x67')](_0x746a('0x61'),_0x40b325);return respondWithRpcPromise('Reload',_0x746a('0x38'),{'module':_0x746a('0x69')});}else if(_0xeac725['type'][_0x746a('0x5c')]()=='TURN'){var _0x4b4f36=fs[_0x746a('0x64')](path[_0x746a('0x5e')](config[_0x746a('0x6a')],_0x746a('0x65')),_0x746a('0x66'));var _0x4a1515=ejs[_0x746a('0x60')](_0x4b4f36,{'networks':_0x160da3||[]});fs[_0x746a('0x67')](_0x746a('0x68'),_0x4a1515);return respondWithRpcPromise(_0x746a('0x62'),_0x746a('0x38'),{'module':_0x746a('0x69')});}else{var _0x10f2cb=fs[_0x746a('0x64')](path[_0x746a('0x5e')](config[_0x746a('0x6a')],_0x746a('0x6b')),_0x746a('0x66'));var _0x37c6e5=ejs['render'](_0x10f2cb,{'networks':_0x160da3||[]});fs[_0x746a('0x67')](util[_0x746a('0x6c')](_0x746a('0x70'),_0x4a518d[_0x746a('0x5b')]['type'][_0x746a('0x71')]()),_0x37c6e5);return respondWithRpcPromise(_0x746a('0x62'),_0x746a('0x38'),{'module':'chan_sip.so'});}return null;})[_0x746a('0x2b')](handleError(_0x4d4c0f,null));}; \ No newline at end of file +var _0xc185=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','create','sequelize','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','render','writeFileSync','TURN','server/files/templates/turn_multiple.ejs','utf8','/etc/asterisk/turn_xcally.conf','Reload','res_stun_monitor.so','server/files/templates/network.ejs','toLowerCase','chan_sip.so','transaction','format','/etc/asterisk/sip_xcally_%s.conf','/etc/asterisk/stun_xcally.conf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','stack','index','map','Network','fieldName','type','key','model','name','query','keys','filters'];(function(_0x1c23a8,_0x583bc4){var _0x3d58ea=function(_0x415baf){while(--_0x415baf){_0x1c23a8['push'](_0x1c23a8['shift']());}};_0x3d58ea(++_0x583bc4);}(_0xc185,0x96));var _0x5c18=function(_0x53fa5f,_0x7f9b04){_0x53fa5f=_0x53fa5f-0x0;var _0xeec208=_0xc185[_0x53fa5f];return _0xeec208;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5c18('0x0'));var zipdir=require(_0x5c18('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5c18('0x2'));var moment=require(_0x5c18('0x3'));var BPromise=require(_0x5c18('0x4'));var Mustache=require(_0x5c18('0x5'));var util=require(_0x5c18('0x6'));var path=require(_0x5c18('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5c18('0x8'));var _=require(_0x5c18('0x9'));var squel=require('squel');var crypto=require(_0x5c18('0xa'));var jsforce=require(_0x5c18('0xb'));var deskjs=require(_0x5c18('0xc'));var toCsv=require(_0x5c18('0xd'));var querystring=require('querystring');var Papa=require(_0x5c18('0xe'));var Redis=require('ioredis');var authService=require(_0x5c18('0xf'));var qs=require(_0x5c18('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5c18('0x11'))(_0x5c18('0x12'));var utils=require(_0x5c18('0x13'));var config=require(_0x5c18('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x5c18('0x15'))['db'];var jayson=require(_0x5c18('0x16'));var client=jayson[_0x5c18('0x17')][_0x5c18('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x3bcfde,_0xbaa0ed,_0x4b76b8,_0x82904f){return new BPromise(function(_0x350a92,_0x4531a9){var _0x2f4d95=_0x82904f||client;return _0x2f4d95[_0x5c18('0x19')](_0x3bcfde,_0x4b76b8)[_0x5c18('0x1a')](function(_0x48cbc2){logger[_0x5c18('0x1b')](_0x5c18('0x1c'),_0xbaa0ed,_0x5c18('0x1d'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0xbaa0ed,_0x5c18('0x1d'),JSON[_0x5c18('0x1e')](_0x48cbc2));if(_0x48cbc2[_0x5c18('0x1f')]){if(_0x48cbc2['error'][_0x5c18('0x20')]===0x1f4){logger[_0x5c18('0x1f')](_0x5c18('0x1c'),_0xbaa0ed,_0x48cbc2[_0x5c18('0x1f')][_0x5c18('0x21')]);return _0x4531a9(_0x48cbc2[_0x5c18('0x1f')][_0x5c18('0x21')]);}logger[_0x5c18('0x1f')](_0x5c18('0x1c'),_0xbaa0ed,_0x48cbc2[_0x5c18('0x1f')][_0x5c18('0x21')]);return _0x350a92(_0x48cbc2[_0x5c18('0x1f')][_0x5c18('0x21')]);}else{logger['info'](_0x5c18('0x1c'),_0xbaa0ed,_0x5c18('0x1d'));_0x350a92(_0x48cbc2['result'][_0x5c18('0x21')]);}})[_0x5c18('0x22')](function(_0x29afd5){logger[_0x5c18('0x1f')](_0x5c18('0x1c'),_0xbaa0ed,_0x29afd5);_0x4531a9(_0x29afd5);});});}function respondWithStatusCode(_0x427f38,_0x388607){_0x388607=_0x388607||0xcc;return function(_0x3a622a){if(_0x3a622a){return _0x427f38[_0x5c18('0x23')](_0x388607);}return _0x427f38[_0x5c18('0x24')](_0x388607)[_0x5c18('0x25')]();};}function respondWithResult(_0xee0d7e,_0x180100){_0x180100=_0x180100||0xc8;return function(_0x384e03){if(_0x384e03){return _0xee0d7e[_0x5c18('0x24')](_0x180100)[_0x5c18('0x26')](_0x384e03);}};}function respondWithFilteredResult(_0x27db2a,_0x4360d5){return function(_0xea90ad){if(_0xea90ad){var _0x58014b=typeof _0x4360d5[_0x5c18('0x27')]===_0x5c18('0x28')&&typeof _0x4360d5[_0x5c18('0x29')]===_0x5c18('0x28');var _0x5de6a6=_0xea90ad[_0x5c18('0x2a')];var _0x3ffc49=_0x58014b?0x0:_0x4360d5[_0x5c18('0x27')];var _0x5f013b=_0x58014b?_0xea90ad['count']:_0x4360d5[_0x5c18('0x27')]+_0x4360d5[_0x5c18('0x29')];var _0x3dee8b;if(_0x5f013b>=_0x5de6a6){_0x5f013b=_0x5de6a6;_0x3dee8b=0xc8;}else{_0x3dee8b=0xce;}_0x27db2a[_0x5c18('0x24')](_0x3dee8b);return _0x27db2a[_0x5c18('0x2b')](_0x5c18('0x2c'),_0x3ffc49+'-'+_0x5f013b+'/'+_0x5de6a6)[_0x5c18('0x26')](_0xea90ad);}return null;};}function patchUpdates(_0x58e5e7){return function(_0x238036){try{jsonpatch[_0x5c18('0x2d')](_0x238036,_0x58e5e7,!![]);}catch(_0xe62552){return BPromise['reject'](_0xe62552);}return _0x238036['save']();};}function saveUpdates(_0x575818,_0x213f9a){return function(_0x2f50b6){if(_0x2f50b6){return _0x2f50b6[_0x5c18('0x2e')](_0x575818)[_0x5c18('0x1a')](function(_0x2074e1){return _0x2074e1;});}return null;};}function removeEntity(_0x2f10fe,_0x573a4a){return function(_0x5de32e){if(_0x5de32e){return _0x5de32e[_0x5c18('0x2f')]()[_0x5c18('0x1a')](function(){_0x2f10fe['status'](0xcc)[_0x5c18('0x25')]();});}};}function handleEntityNotFound(_0x318eaa,_0xab3787){return function(_0x4fbbad){if(!_0x4fbbad){_0x318eaa[_0x5c18('0x23')](0x194);}return _0x4fbbad;};}function handleError(_0x554ed,_0x200eae){_0x200eae=_0x200eae||0x1f4;return function(_0x539a9b){logger['error'](_0x539a9b[_0x5c18('0x30')]);if(_0x539a9b['name']){delete _0x539a9b['name'];}_0x554ed[_0x5c18('0x24')](_0x200eae)['send'](_0x539a9b);};}exports[_0x5c18('0x31')]=function(_0x43403d,_0x5cca95){var _0x104f56={},_0x2dcfbc={},_0xbf33ad={'count':0x0,'rows':[]};var _0x31de26=_[_0x5c18('0x32')](db[_0x5c18('0x33')]['rawAttributes'],function(_0x1b2aaf){return{'name':_0x1b2aaf[_0x5c18('0x34')],'type':_0x1b2aaf[_0x5c18('0x35')][_0x5c18('0x36')]};});_0x2dcfbc[_0x5c18('0x37')]=_[_0x5c18('0x32')](_0x31de26,_0x5c18('0x38'));_0x2dcfbc[_0x5c18('0x39')]=_[_0x5c18('0x3a')](_0x43403d[_0x5c18('0x39')]);_0x2dcfbc[_0x5c18('0x3b')]=_[_0x5c18('0x3c')](_0x2dcfbc[_0x5c18('0x37')],_0x2dcfbc[_0x5c18('0x39')]);_0x104f56[_0x5c18('0x3d')]=_[_0x5c18('0x3c')](_0x2dcfbc[_0x5c18('0x37')],qs['fields'](_0x43403d[_0x5c18('0x39')][_0x5c18('0x3e')]));_0x104f56['attributes']=_0x104f56[_0x5c18('0x3d')][_0x5c18('0x3f')]?_0x104f56[_0x5c18('0x3d')]:_0x2dcfbc[_0x5c18('0x37')];if(!_0x43403d[_0x5c18('0x39')][_0x5c18('0x40')](_0x5c18('0x41'))){_0x104f56['limit']=qs['limit'](_0x43403d['query'][_0x5c18('0x29')]);_0x104f56[_0x5c18('0x27')]=qs['offset'](_0x43403d['query']['offset']);}_0x104f56[_0x5c18('0x42')]=qs[_0x5c18('0x43')](_0x43403d[_0x5c18('0x39')][_0x5c18('0x43')]);_0x104f56[_0x5c18('0x44')]=qs[_0x5c18('0x3b')](_[_0x5c18('0x45')](_0x43403d[_0x5c18('0x39')],_0x2dcfbc['filters']),_0x31de26);if(_0x43403d[_0x5c18('0x39')]['filter']){_0x104f56[_0x5c18('0x44')]=_[_0x5c18('0x46')](_0x104f56['where'],{'$or':_['map'](_0x31de26,function(_0x166b5a){if(_0x166b5a[_0x5c18('0x35')]!==_0x5c18('0x47')){var _0x2a7417={};_0x2a7417[_0x166b5a['name']]={'$like':'%'+_0x43403d[_0x5c18('0x39')][_0x5c18('0x48')]+'%'};return _0x2a7417;}})});}_0x104f56=_['merge']({},_0x104f56,_0x43403d[_0x5c18('0x49')]);var _0x304aff={'where':_0x104f56[_0x5c18('0x44')]};return db[_0x5c18('0x33')][_0x5c18('0x2a')](_0x304aff)[_0x5c18('0x1a')](function(_0xf7b43a){_0xbf33ad[_0x5c18('0x2a')]=_0xf7b43a;if(_0x43403d[_0x5c18('0x39')][_0x5c18('0x4a')]){_0x104f56[_0x5c18('0x4b')]=[{'all':!![]}];}return db[_0x5c18('0x33')][_0x5c18('0x4c')](_0x104f56);})[_0x5c18('0x1a')](function(_0x6cee9e){_0xbf33ad[_0x5c18('0x4d')]=_0x6cee9e;return _0xbf33ad;})['then'](respondWithFilteredResult(_0x5cca95,_0x104f56))[_0x5c18('0x22')](handleError(_0x5cca95,null));};exports[_0x5c18('0x4e')]=function(_0x29e01b,_0x28196e){var _0x23b984={'raw':!![],'where':{'id':_0x29e01b[_0x5c18('0x4f')]['id']}},_0x4fe921={};_0x4fe921[_0x5c18('0x37')]=_['keys'](db['Network']['rawAttributes']);_0x4fe921[_0x5c18('0x39')]=_['keys'](_0x29e01b['query']);_0x4fe921['filters']=_[_0x5c18('0x3c')](_0x4fe921[_0x5c18('0x37')],_0x4fe921[_0x5c18('0x39')]);_0x23b984['attributes']=_[_0x5c18('0x3c')](_0x4fe921[_0x5c18('0x37')],qs['fields'](_0x29e01b[_0x5c18('0x39')][_0x5c18('0x3e')]));_0x23b984[_0x5c18('0x3d')]=_0x23b984[_0x5c18('0x3d')][_0x5c18('0x3f')]?_0x23b984[_0x5c18('0x3d')]:_0x4fe921[_0x5c18('0x37')];if(_0x29e01b[_0x5c18('0x39')][_0x5c18('0x4a')]){_0x23b984[_0x5c18('0x4b')]=[{'all':!![]}];}_0x23b984=_[_0x5c18('0x46')]({},_0x23b984,_0x29e01b[_0x5c18('0x49')]);return db['Network'][_0x5c18('0x50')](_0x23b984)[_0x5c18('0x1a')](handleEntityNotFound(_0x28196e,null))[_0x5c18('0x1a')](respondWithResult(_0x28196e,null))['catch'](handleError(_0x28196e,null));};exports[_0x5c18('0x51')]=function(_0x5c95e9,_0x5e3541,_0x1af481){var _0x26ea2c;return db[_0x5c18('0x52')]['transaction'](function(_0x419a04){return db[_0x5c18('0x33')][_0x5c18('0x51')](_0x5c95e9[_0x5c18('0x53')],{'raw':!![]})[_0x5c18('0x1a')](function(_0x42e82c){_0x26ea2c=_0x42e82c;return db[_0x5c18('0x33')][_0x5c18('0x4c')]({'where':{'type':_0x5c95e9[_0x5c18('0x53')][_0x5c18('0x35')]},'raw':!![]});})[_0x5c18('0x1a')](function(_0x165497){if(_0x26ea2c[_0x5c18('0x35')][_0x5c18('0x54')]()==_0x5c18('0x55')){var _0x1bafba=fs[_0x5c18('0x56')](path[_0x5c18('0x57')](config[_0x5c18('0x58')],_0x5c18('0x59')),'utf8');var _0x187695=ejs[_0x5c18('0x5a')](_0x1bafba,{'networks':_0x165497||[]});fs[_0x5c18('0x5b')]('/etc/asterisk/stun_xcally.conf',_0x187695);return respondWithRpcPromise('Reload',_0x5c18('0x51'),{'module':'res_stun_monitor.so'});}else if(_0x26ea2c[_0x5c18('0x35')][_0x5c18('0x54')]()==_0x5c18('0x5c')){var _0x1fb50b=fs[_0x5c18('0x56')](path[_0x5c18('0x57')](config['root'],_0x5c18('0x5d')),_0x5c18('0x5e'));var _0x1471bc=ejs[_0x5c18('0x5a')](_0x1fb50b,{'networks':_0x165497||[]});fs[_0x5c18('0x5b')](_0x5c18('0x5f'),_0x1471bc);return respondWithRpcPromise(_0x5c18('0x60'),_0x5c18('0x51'),{'module':_0x5c18('0x61')});}else{var _0x3ebe4e=fs[_0x5c18('0x56')](path[_0x5c18('0x57')](config[_0x5c18('0x58')],_0x5c18('0x62')),_0x5c18('0x5e'));var _0x25be34=ejs[_0x5c18('0x5a')](_0x3ebe4e,{'networks':_0x165497||[]});fs[_0x5c18('0x5b')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x5c95e9[_0x5c18('0x53')][_0x5c18('0x35')][_0x5c18('0x63')]()),_0x25be34);return respondWithRpcPromise(_0x5c18('0x60'),_0x5c18('0x51'),{'module':_0x5c18('0x64')});}return null;})[_0x5c18('0x1a')](function(){return _0x26ea2c;});})[_0x5c18('0x1a')](respondWithResult(_0x5e3541,0xc9))[_0x5c18('0x22')](handleError(_0x5e3541,null));};exports[_0x5c18('0x2e')]=function(_0x4a642a,_0x5f76a8,_0xcb3363){var _0xca6591;return db['sequelize'][_0x5c18('0x65')](function(_0x879f22){return db['Network'][_0x5c18('0x50')]({'where':{'id':_0x4a642a[_0x5c18('0x4f')]['id']}})[_0x5c18('0x1a')](handleEntityNotFound(_0x5f76a8,null))[_0x5c18('0x1a')](saveUpdates(_0x4a642a['body'],null))[_0x5c18('0x1a')](function(_0x38d021){if(_0x38d021){_0xca6591=_0x38d021;return db['Network']['findAll']({'where':{'type':_0xca6591[_0x5c18('0x35')]},'raw':!![]});}return null;})[_0x5c18('0x1a')](function(_0x674c2c){if(_0xca6591[_0x5c18('0x35')][_0x5c18('0x54')]()==_0x5c18('0x55')){var _0x102809=fs['readFileSync'](path[_0x5c18('0x57')](config[_0x5c18('0x58')],'server/files/templates/stun_multiple.ejs'),_0x5c18('0x5e'));var _0x18bf2e=ejs['render'](_0x102809,{'networks':_0x674c2c||[]});fs[_0x5c18('0x5b')]('/etc/asterisk/stun_xcally.conf',_0x18bf2e);return respondWithRpcPromise(_0x5c18('0x60'),_0x5c18('0x2e'),{'module':_0x5c18('0x61')});}else if(_0xca6591[_0x5c18('0x35')][_0x5c18('0x54')]()==_0x5c18('0x5c')){var _0x3353a0=fs[_0x5c18('0x56')](path[_0x5c18('0x57')](config['root'],_0x5c18('0x5d')),'utf8');var _0x3bfb51=ejs[_0x5c18('0x5a')](_0x3353a0,{'networks':_0x674c2c||[]});fs[_0x5c18('0x5b')](_0x5c18('0x5f'),_0x3bfb51);return respondWithRpcPromise(_0x5c18('0x60'),_0x5c18('0x2e'),{'module':_0x5c18('0x61')});}else{var _0x3d5bf6=fs[_0x5c18('0x56')](path['join'](config['root'],'server/files/templates/network.ejs'),_0x5c18('0x5e'));var _0xbf3dcc=ejs[_0x5c18('0x5a')](_0x3d5bf6,{'networks':_0x674c2c||[]});fs[_0x5c18('0x5b')](util[_0x5c18('0x66')](_0x5c18('0x67'),_0x4a642a[_0x5c18('0x53')][_0x5c18('0x35')][_0x5c18('0x63')]()),_0xbf3dcc);return respondWithRpcPromise(_0x5c18('0x60'),_0x5c18('0x2e'),{'module':_0x5c18('0x64')});}return null;})[_0x5c18('0x1a')](function(_0x9a5390){if(_0x9a5390){return _0xca6591;}return null;});})[_0x5c18('0x1a')](respondWithResult(_0x5f76a8,null))[_0x5c18('0x22')](handleError(_0x5f76a8,null));};exports[_0x5c18('0x2f')]=function(_0x213b0a,_0x1041be,_0x38b205){var _0x1aaaec;return db['Network'][_0x5c18('0x50')]({'where':{'id':_0x213b0a['params']['id']}})[_0x5c18('0x1a')](function(_0x5395b5){_0x1aaaec=_0x5395b5;return _0x5395b5;})[_0x5c18('0x1a')](handleEntityNotFound(_0x1041be,null))[_0x5c18('0x1a')](removeEntity(_0x1041be,null))[_0x5c18('0x1a')](function(){if(_0x1aaaec){return db[_0x5c18('0x33')][_0x5c18('0x4c')]({'where':{'type':_0x1aaaec[_0x5c18('0x35')]},'raw':!![]});}})[_0x5c18('0x1a')](function(_0x59ed36){if(_0x1aaaec[_0x5c18('0x35')][_0x5c18('0x54')]()==_0x5c18('0x55')){var _0x30c14c=fs[_0x5c18('0x56')](path['join'](config[_0x5c18('0x58')],_0x5c18('0x59')),'utf8');var _0x416a69=ejs[_0x5c18('0x5a')](_0x30c14c,{'networks':_0x59ed36||[]});fs[_0x5c18('0x5b')](_0x5c18('0x68'),_0x416a69);return respondWithRpcPromise(_0x5c18('0x60'),_0x5c18('0x2f'),{'module':'res_stun_monitor.so'});}else if(_0x1aaaec[_0x5c18('0x35')][_0x5c18('0x54')]()=='TURN'){var _0x11fb1d=fs[_0x5c18('0x56')](path['join'](config[_0x5c18('0x58')],'server/files/templates/turn_multiple.ejs'),_0x5c18('0x5e'));var _0x42ec46=ejs[_0x5c18('0x5a')](_0x11fb1d,{'networks':_0x59ed36||[]});fs[_0x5c18('0x5b')]('/etc/asterisk/turn_xcally.conf',_0x42ec46);return respondWithRpcPromise('Reload',_0x5c18('0x2f'),{'module':'res_stun_monitor.so'});}else{var _0x761904=fs[_0x5c18('0x56')](path['join'](config[_0x5c18('0x58')],_0x5c18('0x62')),'utf8');var _0x59d2ce=ejs['render'](_0x761904,{'networks':_0x59ed36||[]});fs[_0x5c18('0x5b')](util[_0x5c18('0x66')](_0x5c18('0x67'),_0x213b0a[_0x5c18('0x53')][_0x5c18('0x35')][_0x5c18('0x63')]()),_0x59d2ce);return respondWithRpcPromise('Reload','destroy',{'module':_0x5c18('0x64')});}return null;})[_0x5c18('0x22')](handleError(_0x1041be,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 7cfebbf..383b502 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 _0x4746=['rimraf','../../config/environment','exports','define','Network','network','lodash','util','api','bluebird','request-promise','path'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x4746,0xc6));var _0x6474=function(_0xec205f,_0x4387f2){_0xec205f=_0xec205f-0x0;var _0x4fef32=_0x4746[_0xec205f];return _0x4fef32;};'use strict';var _=require(_0x6474('0x0'));var util=require(_0x6474('0x1'));var logger=require('../../config/logger')(_0x6474('0x2'));var moment=require('moment');var BPromise=require(_0x6474('0x3'));var rp=require(_0x6474('0x4'));var fs=require('fs');var path=require(_0x6474('0x5'));var rimraf=require(_0x6474('0x6'));var config=require(_0x6474('0x7'));var attributes=require('./network.attributes');module[_0x6474('0x8')]=function(_0x2bcf7c,_0x4cadd7){return _0x2bcf7c[_0x6474('0x9')](_0x6474('0xa'),attributes,{'tableName':_0x6474('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd757=['./network.attributes','exports','define','Network','network','lodash','util','../../config/logger','api','request-promise','path','../../config/environment'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xd757,0x1e5));var _0x7d75=function(_0x4a11c1,_0x4d812b){_0x4a11c1=_0x4a11c1-0x0;var _0x42582e=_0xd757[_0x4a11c1];return _0x42582e;};'use strict';var _=require(_0x7d75('0x0'));var util=require(_0x7d75('0x1'));var logger=require(_0x7d75('0x2'))(_0x7d75('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7d75('0x4'));var fs=require('fs');var path=require(_0x7d75('0x5'));var rimraf=require('rimraf');var config=require(_0x7d75('0x6'));var attributes=require(_0x7d75('0x7'));module[_0x7d75('0x8')]=function(_0x52bb43,_0x5d6128){return _0x52bb43[_0x7d75('0x9')](_0x7d75('0xa'),attributes,{'tableName':_0x7d75('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index c0efd2d..040f2b4 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4e22c3,_0x39d0a6){var _0x2314ae=function(_0x4c2663){while(--_0x4c2663){_0x4e22c3['push'](_0x4e22c3['shift']());}};_0x2314ae(++_0x39d0a6);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0xd947a1,_0x3cf1d1){_0xd947a1=_0xd947a1-0x0;var _0x186d4a=_0x7a54[_0xd947a1];return _0x186d4a;};'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 8e9fa38..26704aa 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 _0x75c0=['post','addDisposition','/:id/canned_answers','notify','addApplications','addAgents','/:id/send','send','put','/:id','update','delete','removeDispositions','removeAgents','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getInteractions','/:id/users','getAgents'];(function(_0x4fa738,_0x2a491c){var _0x55bf55=function(_0x185d53){while(--_0x185d53){_0x4fa738['push'](_0x4fa738['shift']());}};_0x55bf55(++_0x2a491c);}(_0x75c0,0x16c));var _0x075c=function(_0x89de20,_0x182ee0){_0x89de20=_0x89de20-0x0;var _0x457d64=_0x75c0[_0x89de20];return _0x457d64;};'use strict';var multer=require(_0x075c('0x0'));var util=require(_0x075c('0x1'));var path=require(_0x075c('0x2'));var timeout=require(_0x075c('0x3'));var express=require('express');var router=express[_0x075c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x075c('0x5'));var interaction=require(_0x075c('0x6'));var config=require(_0x075c('0x7'));var controller=require(_0x075c('0x8'));router[_0x075c('0x9')]('/',auth[_0x075c('0xa')](),controller[_0x075c('0xb')]);router[_0x075c('0x9')]('/describe',auth[_0x075c('0xa')](),controller[_0x075c('0xc')]);router[_0x075c('0x9')]('/:id',auth[_0x075c('0xa')](),controller[_0x075c('0xd')]);router['get'](_0x075c('0xe'),auth[_0x075c('0xa')](),controller[_0x075c('0xf')]);router[_0x075c('0x9')]('/:id/canned_answers',auth[_0x075c('0xa')](),controller[_0x075c('0x10')]);router[_0x075c('0x9')](_0x075c('0x11'),auth['isAuthenticated'](),controller['getApplications']);router['get']('/:id/interactions',auth['isAuthenticated'](),controller[_0x075c('0x12')]);router[_0x075c('0x9')](_0x075c('0x13'),auth['isAuthenticated'](),controller[_0x075c('0x14')]);router[_0x075c('0x15')]('/',auth['isAuthenticated'](),controller['create']);router[_0x075c('0x15')]('/:id/dispositions',auth[_0x075c('0xa')](),controller[_0x075c('0x16')]);router[_0x075c('0x15')](_0x075c('0x17'),auth[_0x075c('0xa')](),controller['addAnswer']);router[_0x075c('0x15')]('/:id/notify',controller[_0x075c('0x18')]);router[_0x075c('0x15')](_0x075c('0x11'),auth[_0x075c('0xa')](),controller[_0x075c('0x19')]);router[_0x075c('0x15')](_0x075c('0x13'),auth['isAuthenticated'](),controller[_0x075c('0x1a')]);router[_0x075c('0x15')](_0x075c('0x1b'),auth[_0x075c('0xa')](),controller[_0x075c('0x1c')]);router[_0x075c('0x1d')](_0x075c('0x1e'),auth[_0x075c('0xa')](),controller[_0x075c('0x1f')]);router[_0x075c('0x20')](_0x075c('0x1e'),auth[_0x075c('0xa')](),controller['destroy']);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x075c('0x21')]);router['delete'](_0x075c('0x17'),auth[_0x075c('0xa')](),controller['removeAnswers']);router['delete'](_0x075c('0x13'),auth[_0x075c('0xa')](),controller[_0x075c('0x22')]);module['exports']=router; \ No newline at end of file +var _0xb387=['getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','update','delete','/:id/dispositions','removeDispositions','removeAnswers','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','/:id','show','getDispositions','getAnswers'];(function(_0x27784e,_0x42e65d){var _0x158864=function(_0x295610){while(--_0x295610){_0x27784e['push'](_0x27784e['shift']());}};_0x158864(++_0x42e65d);}(_0xb387,0x156));var _0x7b38=function(_0x313df3,_0x4fca45){_0x313df3=_0x313df3-0x0;var _0x241d59=_0xb387[_0x313df3];return _0x241d59;};'use strict';var multer=require('multer');var util=require(_0x7b38('0x0'));var path=require(_0x7b38('0x1'));var timeout=require(_0x7b38('0x2'));var express=require(_0x7b38('0x3'));var router=express[_0x7b38('0x4')]();var fs_extra=require(_0x7b38('0x5'));var auth=require(_0x7b38('0x6'));var interaction=require(_0x7b38('0x7'));var config=require(_0x7b38('0x8'));var controller=require(_0x7b38('0x9'));router[_0x7b38('0xa')]('/',auth[_0x7b38('0xb')](),controller[_0x7b38('0xc')]);router[_0x7b38('0xa')](_0x7b38('0xd'),auth[_0x7b38('0xb')](),controller['describe']);router['get'](_0x7b38('0xe'),auth[_0x7b38('0xb')](),controller[_0x7b38('0xf')]);router[_0x7b38('0xa')]('/:id/dispositions',auth[_0x7b38('0xb')](),controller[_0x7b38('0x10')]);router[_0x7b38('0xa')]('/:id/canned_answers',auth[_0x7b38('0xb')](),controller[_0x7b38('0x11')]);router[_0x7b38('0xa')]('/:id/applications',auth[_0x7b38('0xb')](),controller[_0x7b38('0x12')]);router[_0x7b38('0xa')](_0x7b38('0x13'),auth[_0x7b38('0xb')](),controller[_0x7b38('0x14')]);router[_0x7b38('0xa')](_0x7b38('0x15'),auth[_0x7b38('0xb')](),controller[_0x7b38('0x16')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7b38('0x17')]);router[_0x7b38('0x18')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x7b38('0x19')]);router[_0x7b38('0x18')](_0x7b38('0x1a'),auth[_0x7b38('0xb')](),controller[_0x7b38('0x1b')]);router[_0x7b38('0x18')](_0x7b38('0x1c'),controller[_0x7b38('0x1d')]);router[_0x7b38('0x18')]('/:id/applications',auth[_0x7b38('0xb')](),controller[_0x7b38('0x1e')]);router[_0x7b38('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0x7b38('0x1f')]);router[_0x7b38('0x18')](_0x7b38('0x20'),auth['isAuthenticated'](),controller[_0x7b38('0x21')]);router['put'](_0x7b38('0xe'),auth[_0x7b38('0xb')](),controller[_0x7b38('0x22')]);router[_0x7b38('0x23')](_0x7b38('0xe'),auth[_0x7b38('0xb')](),controller['destroy']);router[_0x7b38('0x23')](_0x7b38('0x24'),auth[_0x7b38('0xb')](),controller[_0x7b38('0x25')]);router[_0x7b38('0x23')](_0x7b38('0x1a'),auth[_0x7b38('0xb')](),controller[_0x7b38('0x26')]);router[_0x7b38('0x23')](_0x7b38('0x15'),auth[_0x7b38('0xb')](),controller['removeAgents']);module[_0x7b38('0x27')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 2524723..cd6a893 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 _0xbf53=['name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xbf53,0x10d));var _0x3bf5=function(_0x225740,_0x339d2b){_0x225740=_0x225740-0x0;var _0x183a4a=_0xbf53[_0x225740];return _0x183a4a;};'use strict';var Sequelize=require(_0x3bf5('0x0'));var rs=require(_0x3bf5('0x1'));module[_0x3bf5('0x2')]={'name':{'type':Sequelize[_0x3bf5('0x3')],'unique':_0x3bf5('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x3bf5('0x3')]},'token':{'type':Sequelize[_0x3bf5('0x3')],'defaultValue':function(){return rs[_0x3bf5('0x5')]();}},'replyUri':{'type':Sequelize[_0x3bf5('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x3bf5('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x3bf5('0x6')],'defaultValue':function(){return _0x3bf5('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3bf5('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3bf5('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x3bf5('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3bf5('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3bf5('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x3bf5('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x3bf5('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3966c7){if(!_0x3966c7)this[_0x3bf5('0xb')](_0x3bf5('0xc'),null);this['setDataValue']('mandatoryDisposition',_0x3966c7);}}}; \ No newline at end of file +var _0x93f7=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','sequelize','randomstring','exports','STRING','name','generate','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x93f7,0xaf));var _0x793f=function(_0x19e192,_0x3defa2){_0x19e192=_0x19e192-0x0;var _0x40f875=_0x93f7[_0x19e192];return _0x40f875;};'use strict';var Sequelize=require(_0x793f('0x0'));var rs=require(_0x793f('0x1'));module[_0x793f('0x2')]={'name':{'type':Sequelize[_0x793f('0x3')],'unique':_0x793f('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x793f('0x3')]},'token':{'type':Sequelize[_0x793f('0x3')],'defaultValue':function(){return rs[_0x793f('0x5')]();}},'replyUri':{'type':Sequelize[_0x793f('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x793f('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x793f('0x6')],'defaultValue':function(){return _0x793f('0x7');}},'notificationSound':{'type':Sequelize[_0x793f('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x793f('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x793f('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x793f('0x3')]},'queueTransfer':{'type':Sequelize[_0x793f('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x793f('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x793f('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x793f('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x793f('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0x793f('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x793f('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x38a27b){if(!_0x38a27b)this['setDataValue'](_0x793f('0xb'),null);this[_0x793f('0xc')]('mandatoryDisposition',_0x38a27b);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 7701b38..a990f52 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 _0x18dd=['*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','stack','finally','getApplications','getInteractions','Owner','internal','Tag','Tags','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','CmList','Messages','dataValues','push','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','jayson/promise','client','http','request','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','OpenchannelAccounts','UserProfileResource','name','send','Pause','mandatoryDispositionPause','map','OpenchannelAccount','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','params','rawAttributes','length','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','order','removeDispositions','ids','getAnswers','CannedAnswer','notify','openchannel','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','ValidationError','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','List','DESC','OpenchannelApplication','Applications','account','list','applications','orderBy','priority','asc','Contacts','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','update','interaction','created','autoclose','close','unmanaged'];(function(_0x2387ea,_0x3b8f13){var _0x1b053d=function(_0x4c7c70){while(--_0x4c7c70){_0x2387ea['push'](_0x2387ea['shift']());}};_0x1b053d(++_0x3b8f13);}(_0x18dd,0x1a0));var _0xd18d=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x18dd[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0xd18d('0x0'));var rimraf=require(_0xd18d('0x1'));var zipdir=require(_0xd18d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd18d('0x3'));var moment=require(_0xd18d('0x4'));var BPromise=require(_0xd18d('0x5'));var Mustache=require(_0xd18d('0x6'));var util=require('util');var path=require('path');var sox=require(_0xd18d('0x7'));var csv=require(_0xd18d('0x8'));var ejs=require(_0xd18d('0x9'));var fs=require('fs');var fs_extra=require(_0xd18d('0xa'));var _=require(_0xd18d('0xb'));var squel=require(_0xd18d('0xc'));var crypto=require(_0xd18d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd18d('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd18d('0xf'));var authService=require(_0xd18d('0x10'));var qs=require(_0xd18d('0x11'));var as=require(_0xd18d('0x12'));var hardwareService=require(_0xd18d('0x13'));var logger=require(_0xd18d('0x14'))('api');var utils=require(_0xd18d('0x15'));var config=require(_0xd18d('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xd18d('0x17')]=_[_0xd18d('0x18')](config[_0xd18d('0x17')],{'host':_0xd18d('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelAccount.socket')['register'](socket);var jayson=require(_0xd18d('0x1a'));var client=jayson[_0xd18d('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0xd18d('0x1b')][_0xd18d('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x34ce42,_0x582f0e,_0x3b7006,_0x235832){return new BPromise(function(_0x182f8d,_0x4b76fe){var _0x71bf4e=_0x235832||client;return _0x71bf4e[_0xd18d('0x1d')](_0x34ce42,_0x3b7006)['then'](function(_0x48ba88){logger[_0xd18d('0x1e')](_0xd18d('0x1f'),_0x582f0e,'request\x20sent');logger[_0xd18d('0x20')](_0xd18d('0x21'),_0x582f0e,_0xd18d('0x22'),JSON[_0xd18d('0x23')](_0x48ba88));if(_0x48ba88[_0xd18d('0x24')]){if(_0x48ba88[_0xd18d('0x24')][_0xd18d('0x25')]===0x1f4){logger[_0xd18d('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x582f0e,_0x48ba88[_0xd18d('0x24')][_0xd18d('0x26')]);return _0x4b76fe(_0x48ba88[_0xd18d('0x24')][_0xd18d('0x26')]);}logger[_0xd18d('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x582f0e,_0x48ba88['error'][_0xd18d('0x26')]);return _0x182f8d(_0x48ba88['error'][_0xd18d('0x26')]);}else{logger[_0xd18d('0x1e')](_0xd18d('0x1f'),_0x582f0e,_0xd18d('0x22'));_0x182f8d(_0x48ba88[_0xd18d('0x27')][_0xd18d('0x26')]);}})[_0xd18d('0x28')](function(_0x4917d2){logger['error'](_0xd18d('0x1f'),_0x582f0e,_0x4917d2);_0x4b76fe(_0x4917d2);});});}function respondWithStatusCode(_0x462780,_0xc8f862){_0xc8f862=_0xc8f862||0xcc;return function(_0x1d4f25){if(_0x1d4f25){return _0x462780[_0xd18d('0x29')](_0xc8f862);}return _0x462780[_0xd18d('0x2a')](_0xc8f862)[_0xd18d('0x2b')]();};}function respondWithResult(_0x392706,_0x326d22){_0x326d22=_0x326d22||0xc8;return function(_0x3546bc){if(_0x3546bc){return _0x392706[_0xd18d('0x2a')](_0x326d22)[_0xd18d('0x2c')](_0x3546bc);}};}function respondWithFilteredResult(_0xde0533,_0x366cd8){return function(_0x1b83ae){if(_0x1b83ae){var _0x53be64=typeof _0x366cd8[_0xd18d('0x2d')]===_0xd18d('0x2e')&&typeof _0x366cd8['limit']==='undefined';var _0x4b4edf=_0x1b83ae['count'];var _0x37c40f=_0x53be64?0x0:_0x366cd8[_0xd18d('0x2d')];var _0x4971c4=_0x53be64?_0x1b83ae[_0xd18d('0x2f')]:_0x366cd8['offset']+_0x366cd8[_0xd18d('0x30')];var _0x3e5742;if(_0x4971c4>=_0x4b4edf){_0x4971c4=_0x4b4edf;_0x3e5742=0xc8;}else{_0x3e5742=0xce;}_0xde0533[_0xd18d('0x2a')](_0x3e5742);return _0xde0533[_0xd18d('0x31')](_0xd18d('0x32'),_0x37c40f+'-'+_0x4971c4+'/'+_0x4b4edf)['json'](_0x1b83ae);}return null;};}function patchUpdates(_0x4debc1){return function(_0x5cd1b7){try{jsonpatch[_0xd18d('0x33')](_0x5cd1b7,_0x4debc1,!![]);}catch(_0x1abac9){return BPromise[_0xd18d('0x34')](_0x1abac9);}return _0x5cd1b7[_0xd18d('0x35')]();};}function saveUpdates(_0x588886,_0x85b59a){return function(_0x999d34){if(_0x999d34){return _0x999d34['update'](_0x588886)[_0xd18d('0x36')](function(_0x5ccbf0){return _0x5ccbf0;});}return null;};}function removeEntity(_0x158d96,_0x5b148d){return function(_0x1c1f3a){if(_0x1c1f3a){return _0x1c1f3a[_0xd18d('0x37')]()['then'](function(){var _0x1cd640=_0x1c1f3a[_0xd18d('0x38')]({'plain':!![]});var _0x40f68d=_0xd18d('0x39');return db[_0xd18d('0x3a')][_0xd18d('0x37')]({'where':{'type':_0x40f68d,'resourceId':_0x1cd640['id']}})[_0xd18d('0x36')](function(){return _0x1c1f3a;});})[_0xd18d('0x36')](function(){_0x158d96[_0xd18d('0x2a')](0xcc)[_0xd18d('0x2b')]();});}};}function handleEntityNotFound(_0x29da0c,_0xfb1e58){return function(_0xa88bcf){if(!_0xa88bcf){_0x29da0c[_0xd18d('0x29')](0x194);}return _0xa88bcf;};}function handleError(_0x61fc24,_0x9e9237){_0x9e9237=_0x9e9237||0x1f4;return function(_0x37add4){logger[_0xd18d('0x24')](_0x37add4['stack']);if(_0x37add4[_0xd18d('0x3b')]){delete _0x37add4[_0xd18d('0x3b')];}_0x61fc24[_0xd18d('0x2a')](_0x9e9237)[_0xd18d('0x3c')](_0x37add4);};}exports['index']=function(_0x55cc51,_0x3790cd){var _0x1d76de={'include':[{'model':db[_0xd18d('0x3d')],'as':_0xd18d('0x3e')}]},_0x509d17={},_0x47c7c9={'count':0x0,'rows':[]};var _0xf4ad7a=_[_0xd18d('0x3f')](db[_0xd18d('0x40')]['rawAttributes'],function(_0x9d0a1){return{'name':_0x9d0a1['fieldName'],'type':_0x9d0a1[_0xd18d('0x41')][_0xd18d('0x42')]};});_0x509d17[_0xd18d('0x43')]=_[_0xd18d('0x3f')](_0xf4ad7a,'name');_0x509d17[_0xd18d('0x44')]=_[_0xd18d('0x45')](_0x55cc51[_0xd18d('0x44')]);_0x509d17[_0xd18d('0x46')]=_[_0xd18d('0x47')](_0x509d17[_0xd18d('0x43')],_0x509d17['query']);_0x1d76de[_0xd18d('0x48')]=_[_0xd18d('0x47')](_0x509d17['model'],qs[_0xd18d('0x49')](_0x55cc51['query'][_0xd18d('0x49')]));_0x1d76de[_0xd18d('0x48')]=_0x1d76de['attributes']['length']?_0x1d76de[_0xd18d('0x48')]:_0x509d17[_0xd18d('0x43')];if(!_0x55cc51[_0xd18d('0x44')][_0xd18d('0x4a')](_0xd18d('0x4b'))){_0x1d76de[_0xd18d('0x30')]=qs[_0xd18d('0x30')](_0x55cc51[_0xd18d('0x44')]['limit']);_0x1d76de[_0xd18d('0x2d')]=qs[_0xd18d('0x2d')](_0x55cc51[_0xd18d('0x44')][_0xd18d('0x2d')]);}_0x1d76de['order']=qs['sort'](_0x55cc51['query'][_0xd18d('0x4c')]);_0x1d76de[_0xd18d('0x4d')]=qs['filters'](_[_0xd18d('0x4e')](_0x55cc51[_0xd18d('0x44')],_0x509d17[_0xd18d('0x46')]),_0xf4ad7a);if(_0x55cc51['query'][_0xd18d('0x4f')]){_0x1d76de[_0xd18d('0x4d')]=_[_0xd18d('0x50')](_0x1d76de['where'],{'$or':_['map'](_0xf4ad7a,function(_0x296846){if(_0x296846[_0xd18d('0x41')]!=='VIRTUAL'){var _0x2df0db={};_0x2df0db[_0x296846[_0xd18d('0x3b')]]={'$like':'%'+_0x55cc51[_0xd18d('0x44')][_0xd18d('0x4f')]+'%'};return _0x2df0db;}})});}_0x1d76de=_[_0xd18d('0x50')]({},_0x1d76de,_0x55cc51['options']);var _0x262527={'where':_0x1d76de['where']};return db[_0xd18d('0x40')][_0xd18d('0x2f')](_0x262527)['then'](function(_0x5527e1){_0x47c7c9['count']=_0x5527e1;if(_0x55cc51[_0xd18d('0x44')][_0xd18d('0x51')]){_0x1d76de[_0xd18d('0x52')]=[{'all':!![]}];}return db[_0xd18d('0x40')][_0xd18d('0x53')](_0x1d76de);})[_0xd18d('0x36')](function(_0x375a61){_0x47c7c9[_0xd18d('0x54')]=_0x375a61;return _0x47c7c9;})['then'](respondWithFilteredResult(_0x3790cd,_0x1d76de))[_0xd18d('0x28')](handleError(_0x3790cd,null));};exports['show']=function(_0xa55110,_0x53d0e8){var _0x250849={'raw':![],'where':{'id':_0xa55110[_0xd18d('0x55')]['id']},'include':[{'model':db[_0xd18d('0x3d')],'as':'mandatoryDispositionPause'}]},_0x5a7abe={};_0x5a7abe[_0xd18d('0x43')]=_['keys'](db[_0xd18d('0x40')][_0xd18d('0x56')]);_0x5a7abe[_0xd18d('0x44')]=_[_0xd18d('0x45')](_0xa55110[_0xd18d('0x44')]);_0x5a7abe[_0xd18d('0x46')]=_[_0xd18d('0x47')](_0x5a7abe[_0xd18d('0x43')],_0x5a7abe['query']);_0x250849[_0xd18d('0x48')]=_['intersection'](_0x5a7abe[_0xd18d('0x43')],qs[_0xd18d('0x49')](_0xa55110[_0xd18d('0x44')][_0xd18d('0x49')]));_0x250849['attributes']=_0x250849['attributes'][_0xd18d('0x57')]?_0x250849[_0xd18d('0x48')]:_0x5a7abe[_0xd18d('0x43')];if(_0xa55110[_0xd18d('0x44')]['includeAll']){_0x250849[_0xd18d('0x52')]=[{'all':!![]}];}_0x250849=_['merge']({},_0x250849,_0xa55110[_0xd18d('0x58')]);return db[_0xd18d('0x40')]['find'](_0x250849)[_0xd18d('0x36')](handleEntityNotFound(_0x53d0e8,null))[_0xd18d('0x36')](respondWithResult(_0x53d0e8,null))[_0xd18d('0x28')](handleError(_0x53d0e8,null));};exports[_0xd18d('0x59')]=function(_0x814179,_0x5c59db){return db[_0xd18d('0x40')][_0xd18d('0x59')](_0x814179[_0xd18d('0x5a')],{})[_0xd18d('0x36')](function(_0x315f23){var _0x51bb24=_0x814179['user']['get']({'plain':!![]});if(!_0x51bb24)throw new Error(_0xd18d('0x5b'));if(_0x51bb24[_0xd18d('0x5c')]===_0xd18d('0x5d')){var _0x4c1b9a=_0x315f23[_0xd18d('0x38')]({'plain':!![]});var _0x186ea0='OpenchannelAccounts';return db[_0xd18d('0x5e')][_0xd18d('0x5f')]({'where':{'name':_0x186ea0,'userProfileId':_0x51bb24['userProfileId']},'raw':!![]})['then'](function(_0x54e2fe){if(_0x54e2fe&&_0x54e2fe['autoAssociation']===0x0){return db[_0xd18d('0x3a')][_0xd18d('0x59')]({'name':_0x4c1b9a['name'],'resourceId':_0x4c1b9a['id'],'type':_0x54e2fe['name'],'sectionId':_0x54e2fe['id']},{})[_0xd18d('0x36')](function(){return _0x315f23;});}else{return _0x315f23;}})[_0xd18d('0x28')](function(_0x48abbe){logger[_0xd18d('0x24')](_0xd18d('0x60'),_0x48abbe);throw _0x48abbe;});}return _0x315f23;})[_0xd18d('0x36')](respondWithResult(_0x5c59db,0xc9))[_0xd18d('0x28')](handleError(_0x5c59db,null));};exports['update']=function(_0x2f36ed,_0x1deb7f){if(_0x2f36ed['body']['id']){delete _0x2f36ed[_0xd18d('0x5a')]['id'];}return db['OpenchannelAccount'][_0xd18d('0x5f')]({'where':{'id':_0x2f36ed[_0xd18d('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0xd18d('0x3e')}]})[_0xd18d('0x36')](handleEntityNotFound(_0x1deb7f,null))[_0xd18d('0x36')](saveUpdates(_0x2f36ed['body'],null))[_0xd18d('0x36')](respondWithResult(_0x1deb7f,null))['catch'](handleError(_0x1deb7f,null));};exports['destroy']=function(_0x2195ac,_0x38f59c){return db[_0xd18d('0x40')][_0xd18d('0x5f')]({'where':{'id':_0x2195ac[_0xd18d('0x55')]['id']}})[_0xd18d('0x36')](handleEntityNotFound(_0x38f59c,null))[_0xd18d('0x36')](removeEntity(_0x38f59c,null))[_0xd18d('0x28')](handleError(_0x38f59c,null));};exports['describe']=function(_0x331a37,_0x2c640a){return db[_0xd18d('0x40')][_0xd18d('0x61')]()['then'](respondWithResult(_0x2c640a,null))[_0xd18d('0x28')](handleError(_0x2c640a,null));};exports['addDisposition']=function(_0xd93c05,_0x519933,_0x4315fa){if(_0xd93c05['body']['id']){delete _0xd93c05[_0xd18d('0x5a')]['id'];}return db[_0xd18d('0x40')]['find']({'where':{'id':_0xd93c05[_0xd18d('0x55')]['id']}})[_0xd18d('0x36')](handleEntityNotFound(_0x519933,null))[_0xd18d('0x36')](function(_0x439295){if(_0x439295){_0xd93c05[_0xd18d('0x5a')][_0xd18d('0x62')]=_0x439295['id'];return db[_0xd18d('0x63')]['create'](_0xd93c05[_0xd18d('0x5a')]);}})[_0xd18d('0x36')](respondWithResult(_0x519933,null))['catch'](handleError(_0x519933,null));};exports[_0xd18d('0x64')]=function(_0x810ef9,_0x4af5f1,_0x2b0b84){var _0x530e34={'raw':![],'where':{}};var _0x22413f={};var _0x5abfcf={'count':0x0,'rows':[]};return db[_0xd18d('0x40')][_0xd18d('0x65')]({'where':{'id':_0x810ef9[_0xd18d('0x55')]['id']}})['then'](handleEntityNotFound(_0x4af5f1,null))['then'](function(_0x23c6b0){if(_0x23c6b0){_0x22413f[_0xd18d('0x43')]=_['keys'](db[_0xd18d('0x63')][_0xd18d('0x56')]);_0x22413f[_0xd18d('0x44')]=_[_0xd18d('0x45')](_0x810ef9['query']);_0x22413f[_0xd18d('0x46')]=_['intersection'](_0x22413f['model'],_0x22413f[_0xd18d('0x44')]);_0x530e34[_0xd18d('0x48')]=_[_0xd18d('0x47')](_0x22413f[_0xd18d('0x43')],qs[_0xd18d('0x49')](_0x810ef9[_0xd18d('0x44')][_0xd18d('0x49')]));_0x530e34[_0xd18d('0x48')]=_0x530e34[_0xd18d('0x48')][_0xd18d('0x57')]?_0x530e34['attributes']:_0x22413f[_0xd18d('0x43')];if(!_0x810ef9[_0xd18d('0x44')]['hasOwnProperty'](_0xd18d('0x4b'))){_0x530e34['limit']=qs[_0xd18d('0x30')](_0x810ef9['query']['limit']);_0x530e34[_0xd18d('0x2d')]=qs[_0xd18d('0x2d')](_0x810ef9[_0xd18d('0x44')][_0xd18d('0x2d')]);}_0x530e34[_0xd18d('0x66')]=qs[_0xd18d('0x4c')](_0x810ef9[_0xd18d('0x44')][_0xd18d('0x4c')]);_0x530e34[_0xd18d('0x4d')]=qs[_0xd18d('0x46')](_[_0xd18d('0x4e')](_0x810ef9['query'],_0x22413f[_0xd18d('0x46')]));_0x530e34[_0xd18d('0x4d')][_0xd18d('0x62')]=_0x23c6b0['id'];if(_0x810ef9[_0xd18d('0x44')][_0xd18d('0x4f')]){_0x530e34[_0xd18d('0x4d')]=_[_0xd18d('0x50')](_0x530e34[_0xd18d('0x4d')],{'$or':_[_0xd18d('0x3f')](_0x530e34[_0xd18d('0x48')],function(_0x173f33){var _0x2a2933={};_0x2a2933[_0x173f33]={'$like':'%'+_0x810ef9['query'][_0xd18d('0x4f')]+'%'};return _0x2a2933;})});}_0x530e34=_[_0xd18d('0x50')]({},_0x530e34,_0x810ef9[_0xd18d('0x58')]);return db[_0xd18d('0x63')][_0xd18d('0x2f')]({'where':_0x530e34[_0xd18d('0x4d')]})['then'](function(_0x2398d6){_0x5abfcf[_0xd18d('0x2f')]=_0x2398d6;if(_0x810ef9[_0xd18d('0x44')][_0xd18d('0x51')]){_0x530e34[_0xd18d('0x52')]=[{'all':!![]}];}return db[_0xd18d('0x63')][_0xd18d('0x53')](_0x530e34);})[_0xd18d('0x36')](function(_0x3d9367){_0x5abfcf[_0xd18d('0x54')]=_0x3d9367;return _0x5abfcf;});}})[_0xd18d('0x36')](respondWithFilteredResult(_0x4af5f1,_0x530e34))[_0xd18d('0x28')](handleError(_0x4af5f1,null));};exports['removeDispositions']=function(_0x8003a,_0x274c0d,_0x3a1996){return db[_0xd18d('0x40')][_0xd18d('0x5f')]({'where':{'id':_0x8003a[_0xd18d('0x55')]['id']}})[_0xd18d('0x36')](handleEntityNotFound(_0x274c0d,null))['then'](function(_0x1ba2f7){if(_0x1ba2f7){return _0x1ba2f7[_0xd18d('0x67')](_0x8003a[_0xd18d('0x44')][_0xd18d('0x68')]);}})['then'](respondWithStatusCode(_0x274c0d,null))[_0xd18d('0x28')](handleError(_0x274c0d,null));};exports['addAnswer']=function(_0x57566b,_0x2b133b,_0x2da740){if(_0x57566b[_0xd18d('0x5a')]['id']){delete _0x57566b['body']['id'];}return db[_0xd18d('0x40')][_0xd18d('0x5f')]({'where':{'id':_0x57566b[_0xd18d('0x55')]['id']}})['then'](handleEntityNotFound(_0x2b133b,null))[_0xd18d('0x36')](function(_0x318aa1){if(_0x318aa1){_0x57566b[_0xd18d('0x5a')]['OpenchannelAccountId']=_0x318aa1['id'];return db['CannedAnswer']['create'](_0x57566b[_0xd18d('0x5a')]);}})[_0xd18d('0x36')](respondWithResult(_0x2b133b,null))['catch'](handleError(_0x2b133b,null));};exports[_0xd18d('0x69')]=function(_0x14ed4d,_0x137a5c,_0x414711){var _0x569650={'raw':![],'where':{}};var _0x48e5a5={};var _0xef7b71={'count':0x0,'rows':[]};return db[_0xd18d('0x40')]['findOne']({'where':{'id':_0x14ed4d[_0xd18d('0x55')]['id']}})[_0xd18d('0x36')](handleEntityNotFound(_0x137a5c,null))[_0xd18d('0x36')](function(_0x2bdbe2){if(_0x2bdbe2){_0x48e5a5[_0xd18d('0x43')]=_['keys'](db['CannedAnswer'][_0xd18d('0x56')]);_0x48e5a5['query']=_['keys'](_0x14ed4d[_0xd18d('0x44')]);_0x48e5a5['filters']=_[_0xd18d('0x47')](_0x48e5a5[_0xd18d('0x43')],_0x48e5a5[_0xd18d('0x44')]);_0x569650[_0xd18d('0x48')]=_[_0xd18d('0x47')](_0x48e5a5[_0xd18d('0x43')],qs[_0xd18d('0x49')](_0x14ed4d['query']['fields']));_0x569650[_0xd18d('0x48')]=_0x569650[_0xd18d('0x48')]['length']?_0x569650[_0xd18d('0x48')]:_0x48e5a5[_0xd18d('0x43')];if(!_0x14ed4d[_0xd18d('0x44')][_0xd18d('0x4a')](_0xd18d('0x4b'))){_0x569650[_0xd18d('0x30')]=qs['limit'](_0x14ed4d[_0xd18d('0x44')]['limit']);_0x569650['offset']=qs[_0xd18d('0x2d')](_0x14ed4d[_0xd18d('0x44')]['offset']);}_0x569650[_0xd18d('0x66')]=qs[_0xd18d('0x4c')](_0x14ed4d[_0xd18d('0x44')][_0xd18d('0x4c')]);_0x569650[_0xd18d('0x4d')]=qs[_0xd18d('0x46')](_['pick'](_0x14ed4d[_0xd18d('0x44')],_0x48e5a5[_0xd18d('0x46')]));_0x569650[_0xd18d('0x4d')][_0xd18d('0x62')]=_0x2bdbe2['id'];if(_0x14ed4d['query'][_0xd18d('0x4f')]){_0x569650[_0xd18d('0x4d')]=_[_0xd18d('0x50')](_0x569650[_0xd18d('0x4d')],{'$or':_[_0xd18d('0x3f')](_0x569650[_0xd18d('0x48')],function(_0x9b65ab){var _0x4834b4={};_0x4834b4[_0x9b65ab]={'$like':'%'+_0x14ed4d[_0xd18d('0x44')]['filter']+'%'};return _0x4834b4;})});}_0x569650=_[_0xd18d('0x50')]({},_0x569650,_0x14ed4d[_0xd18d('0x58')]);return db[_0xd18d('0x6a')][_0xd18d('0x2f')]({'where':_0x569650[_0xd18d('0x4d')]})['then'](function(_0x5eebfd){_0xef7b71[_0xd18d('0x2f')]=_0x5eebfd;if(_0x14ed4d[_0xd18d('0x44')][_0xd18d('0x51')]){_0x569650['include']=[{'all':!![]}];}return db[_0xd18d('0x6a')][_0xd18d('0x53')](_0x569650);})[_0xd18d('0x36')](function(_0x3ca378){_0xef7b71['rows']=_0x3ca378;return _0xef7b71;});}})[_0xd18d('0x36')](respondWithFilteredResult(_0x137a5c,_0x569650))['catch'](handleError(_0x137a5c,null));};exports['removeAnswers']=function(_0x2f5c30,_0x814154,_0x1bbbb1){return db[_0xd18d('0x40')][_0xd18d('0x5f')]({'where':{'id':_0x2f5c30['params']['id']}})['then'](handleEntityNotFound(_0x814154,null))[_0xd18d('0x36')](function(_0x377fe0){if(_0x377fe0){return _0x377fe0['removeAnswers'](_0x2f5c30[_0xd18d('0x44')][_0xd18d('0x68')]);}})[_0xd18d('0x36')](respondWithStatusCode(_0x814154,null))['catch'](handleError(_0x814154,null));};exports[_0xd18d('0x6b')]=function(_0x54683d,_0x3c776c,_0xaed682){var _0x14f6aa={'body':_0x54683d[_0xd18d('0x5a')],'channel':_0xd18d('0x6c')};var _0x3f16ed=[];var _0x67edc0=[];var _0x51e55a={};var _0x28cc05=![];return db[_0xd18d('0x6d')][_0xd18d('0x61')]()[_0xd18d('0x36')](function(_0x1836d2){if(!_0x1836d2){throw new db['Sequelize']['ValidationError'](_0xd18d('0x6e'));}_0x3f16ed=_[_0xd18d('0x6f')](_[_0xd18d('0x45')](_0x1836d2),[_0xd18d('0x70'),_0xd18d('0x71')]);_0x67edc0=_[_0xd18d('0x6f')](_[_0xd18d('0x45')](_0x1836d2),[_0xd18d('0x70'),_0xd18d('0x71'),_0xd18d('0x72'),_0xd18d('0x73')]);if(_0x54683d[_0xd18d('0x5a')]['id']){delete _0x54683d[_0xd18d('0x5a')]['id'];}if(_[_0xd18d('0x74')](_0x54683d[_0xd18d('0x5a')][_0xd18d('0x75')])){throw new db[(_0xd18d('0x76'))][(_0xd18d('0x77'))](_0xd18d('0x78'));}if(_[_0xd18d('0x74')](_0x54683d[_0xd18d('0x5a')][_0xd18d('0x5a')])||_0x54683d['body']['body']===''){throw new db[(_0xd18d('0x76'))][(_0xd18d('0x77'))](_0xd18d('0x79'));}if(_[_0xd18d('0x74')](_0x54683d[_0xd18d('0x5a')][_0xd18d('0x7a')])){throw new db[(_0xd18d('0x76'))][(_0xd18d('0x77'))](_0xd18d('0x7b')+_0x67edc0);}if(!_[_0xd18d('0x7c')](_0x67edc0,_0x54683d['body'][_0xd18d('0x7a')])){throw new db[(_0xd18d('0x76'))]['ValidationError'](_0xd18d('0x7d')+_0x67edc0);}_0x51e55a[_0x54683d[_0xd18d('0x5a')][_0xd18d('0x7a')]]=_0x54683d['body']['from'];})[_0xd18d('0x36')](function(){return db[_0xd18d('0x40')]['find']({'where':{'id':_0x54683d['params']['id']},'include':[{'model':db['CmList'],'as':_0xd18d('0x7e'),'include':[{'model':db[_0xd18d('0x6d')],'as':'Contacts','where':_0x51e55a,'limit':0x1,'order':[['updatedAt',_0xd18d('0x7f')]]}]},{'model':db[_0xd18d('0x80')],'as':_0xd18d('0x81')}]});})[_0xd18d('0x36')](handleEntityNotFound(_0x3c776c,null))[_0xd18d('0x36')](function(_0x35d91d){if(_0x35d91d&&_0x35d91d['List']){_0x14f6aa[_0xd18d('0x82')]=_0x35d91d;_0x14f6aa['applications']=_0x35d91d[_0xd18d('0x81')];_0x14f6aa[_0xd18d('0x83')]=_0x35d91d[_0xd18d('0x7e')];_0x14f6aa[_0xd18d('0x84')]=_[_0xd18d('0x85')](_0x14f6aa[_0xd18d('0x84')],[_0xd18d('0x86')],[_0xd18d('0x87')]);if(_0x14f6aa[_0xd18d('0x82')][_0xd18d('0x81')]){delete _0x14f6aa[_0xd18d('0x82')]['Applications'];}if(_0x14f6aa[_0xd18d('0x82')][_0xd18d('0x7e')]&&_0x14f6aa[_0xd18d('0x82')][_0xd18d('0x7e')][_0xd18d('0x88')][_0xd18d('0x57')]){return _0x14f6aa[_0xd18d('0x82')][_0xd18d('0x7e')][_0xd18d('0x88')][0x0];}var _0x1592c8=_[_0xd18d('0x18')](_0x54683d[_0xd18d('0x5a')],{'firstName':_0x54683d[_0xd18d('0x5a')]['from'],'ListId':_0x35d91d[_0xd18d('0x73')]});_0x1592c8[_0x54683d[_0xd18d('0x5a')][_0xd18d('0x7a')]]=_0x54683d['body'][_0xd18d('0x75')];return db['CmContact']['create'](_0x1592c8,{'fields':_0x3f16ed,'raw':!![]});}})[_0xd18d('0x36')](handleEntityNotFound(_0x3c776c,null))[_0xd18d('0x36')](function(_0x29f305){_0x14f6aa[_0xd18d('0x89')]=_0x29f305;if(_0x29f305){var _0x43b9cd={'ContactId':_0x29f305['id'],'OpenchannelAccountId':_0x54683d[_0xd18d('0x55')]['id'],'from':(_0x29f305[_0xd18d('0x8a')]||'')+'\x20'+(_0x29f305['lastName']||'')};var _0x35b4a8={'OpenchannelAccountId':_0x54683d[_0xd18d('0x55')]['id'],'closed':![]};if(_0x54683d[_0xd18d('0x5a')][_0xd18d('0x8b')]){_0x35b4a8[_0xd18d('0x8b')]=_0x54683d[_0xd18d('0x5a')][_0xd18d('0x8b')];return db[_0xd18d('0x8c')][_0xd18d('0x5f')]({'where':_0x35b4a8})[_0xd18d('0x36')](function(_0x480d3b){if(_0x480d3b){return[_0x480d3b,![]];}_0x43b9cd[_0xd18d('0x8b')]=_0x54683d[_0xd18d('0x5a')][_0xd18d('0x8b')];_0x43b9cd[_0xd18d('0x8d')]=_0x54683d[_0xd18d('0x5a')][_0xd18d('0x8d')];return db[_0xd18d('0x8c')][_0xd18d('0x59')](_0x43b9cd)[_0xd18d('0x36')](function(_0xadf14){return[_0xadf14,!![]];});});}else{_0x35b4a8['threadId']=null;}_0x35b4a8[_0xd18d('0x8e')]=_0x29f305['id'];return db[_0xd18d('0x8c')][_0xd18d('0x5f')]({'where':_0x35b4a8})['then'](function(_0x2941af){if(_0x2941af){return[_0x2941af,![]];}return db['OpenchannelInteraction'][_0xd18d('0x59')](_0x43b9cd)[_0xd18d('0x36')](function(_0x1237a6){return[_0x1237a6,!![]];});});}})[_0xd18d('0x8f')](function(_0x80ce3c,_0x2fba5b){if(_0x80ce3c){_0x28cc05=_0x2fba5b;if(!_0x2fba5b){var _0x1ba3f2={'from':(_0x14f6aa[_0xd18d('0x89')]['firstName']||'')+'\x20'+(_0x14f6aa[_0xd18d('0x89')]['lastName']||'')};if(_0x54683d['body']['threadId']&&_0x54683d[_0xd18d('0x5a')][_0xd18d('0x90')]&&_0x54683d[_0xd18d('0x5a')]['threadId']!=_0x54683d['body'][_0xd18d('0x90')]){_0x1ba3f2['threadId']=_0x54683d[_0xd18d('0x5a')][_0xd18d('0x90')];}return _0x80ce3c[_0xd18d('0x91')](_0x1ba3f2);}else{return _0x80ce3c;}}})[_0xd18d('0x36')](function(_0x3d5f83){_0x14f6aa[_0xd18d('0x92')]=_0x3d5f83[_0xd18d('0x38')]({'plain':!![]});_0x14f6aa[_0xd18d('0x92')][_0xd18d('0x93')]=_0x28cc05;if(_0x14f6aa[_0xd18d('0x92')][_0xd18d('0x93')]){if(_0x14f6aa[_0xd18d('0x82')][_0xd18d('0x94')]){_0x14f6aa[_0xd18d('0x84')]['push']({'id':0x0,'priority':_0x14f6aa[_0xd18d('0x84')]['length']+0x1,'app':_0xd18d('0x95'),'appdata':_0xd18d('0x96'),'interval':_0xd18d('0x97')});}}return db[_0xd18d('0x98')][_0xd18d('0x59')]({'body':_0x54683d[_0xd18d('0x5a')][_0xd18d('0x5a')],'OpenchannelAccountId':_0x54683d[_0xd18d('0x55')]['id'],'OpenchannelInteractionId':_0x3d5f83['id'],'direction':'in','ContactId':_0x14f6aa[_0xd18d('0x89')]['id'],'AttachmentId':_0x54683d[_0xd18d('0x5a')][_0xd18d('0x99')]});})[_0xd18d('0x36')](function(_0x8b54a7){_0x14f6aa['message']=_0x8b54a7;if(_0x14f6aa[_0xd18d('0x92')][_0xd18d('0x9a')]){return db[_0xd18d('0x9b')][_0xd18d('0x5f')]({'attributes':['id','name'],'where':{'id':_0x14f6aa[_0xd18d('0x92')]['UserId']}})[_0xd18d('0x36')](function(_0x491d98){if(_0x491d98){_0x14f6aa[_0xd18d('0x84')][_0xd18d('0x9c')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x491d98[_0xd18d('0x3b')]+','+(_0x14f6aa['account']['waitForTheAssignedAgent']||0xa),'interval':_0xd18d('0x97')});_0x14f6aa['forcedOwnership']=![];}return respondWithRpcPromise(_0xd18d('0x9d'),_0xd18d('0x9e'),_0x14f6aa);});}return respondWithRpcPromise(_0xd18d('0x9d'),_0xd18d('0x9e'),_0x14f6aa);})['then'](function(_0x3025a3){respondWithRpcPromise(_0xd18d('0x9f'),_0xd18d('0x9f'),{'event':_0xd18d('0x6b'),'message':_0x3025a3},client9002);return _0x3025a3;})[_0xd18d('0x36')](respondWithResult(_0x3c776c,null))[_0xd18d('0x28')](handleError(_0x3c776c,null));};exports[_0xd18d('0xa0')]=function(_0x10c6ba,_0x37bc11){var _0x386eff=_0x10c6ba[_0xd18d('0x55')]['id'];var _0x17bc95=_0x10c6ba['body'];var _0x553857=0xc8;var _0x36af41=null;return db[_0xd18d('0xa1')][_0xd18d('0xa2')]({'isolationLevel':db[_0xd18d('0xa1')][_0xd18d('0xa3')][_0xd18d('0xa4')][_0xd18d('0xa5')]},function(_0x375afd){return db[_0xd18d('0x40')]['findOne']({'where':{'id':_0x386eff},'transaction':_0x375afd})[_0xd18d('0x36')](function(_0x49eb84){if(_0x49eb84){return db[_0xd18d('0x80')][_0xd18d('0x37')]({'where':{'OpenchannelAccountId':_0x386eff},'transaction':_0x375afd})[_0xd18d('0x36')](function(){var _0x3e5806=_[_0xd18d('0x3f')](_0x17bc95,function(_0x1e2776){_0x1e2776['OpenchannelAccountId']=_0x386eff;return _0x1e2776;});return db[_0xd18d('0x80')][_0xd18d('0xa6')](_0x3e5806,{'transaction':_0x375afd});});}else{_0x553857=0x194;_0x36af41=[];}});})[_0xd18d('0x36')](function(){if(_0x553857!==0x194){return db[_0xd18d('0x80')][_0xd18d('0xa7')]({'where':{'OpenchannelAccountId':_0x386eff},'order':_0xd18d('0x86')})['then'](function(_0x49a993){_0x36af41=_0x49a993;});}})['catch'](function(_0x2cabbf){_0x553857=0x1f4;logger[_0xd18d('0x24')](_0x2cabbf[_0xd18d('0xa8')]);if(_0x2cabbf['name']){delete _0x2cabbf[_0xd18d('0x3b')];}_0x36af41=_0x2cabbf;})[_0xd18d('0xa9')](function(){if(_0x36af41===null){_0x37bc11[_0xd18d('0x29')](_0x553857);}else{if(_0x553857===0x1f4){_0x37bc11[_0xd18d('0x2a')](_0x553857)[_0xd18d('0x3c')](_0x36af41);}else{_0x37bc11[_0xd18d('0x2a')](_0x553857)[_0xd18d('0x2c')](_0x36af41);}}});};exports[_0xd18d('0xaa')]=function(_0xd43956,_0x41a3a9,_0x39586a){var _0x3e4276={};var _0x4fad45={};var _0x1eb4d8;var _0x165443;return db[_0xd18d('0x40')]['findOne']({'where':{'id':_0xd43956[_0xd18d('0x55')]['id']}})[_0xd18d('0x36')](handleEntityNotFound(_0x41a3a9,null))[_0xd18d('0x36')](function(_0x15f27a){if(_0x15f27a){_0x1eb4d8=_0x15f27a;_0x4fad45[_0xd18d('0x43')]=_[_0xd18d('0x45')](db[_0xd18d('0x80')][_0xd18d('0x56')]);_0x4fad45[_0xd18d('0x44')]=_[_0xd18d('0x45')](_0xd43956[_0xd18d('0x44')]);_0x4fad45[_0xd18d('0x46')]=_[_0xd18d('0x47')](_0x4fad45[_0xd18d('0x43')],_0x4fad45[_0xd18d('0x44')]);_0x3e4276[_0xd18d('0x48')]=_[_0xd18d('0x47')](_0x4fad45['model'],qs[_0xd18d('0x49')](_0xd43956[_0xd18d('0x44')][_0xd18d('0x49')]));_0x3e4276['attributes']=_0x3e4276[_0xd18d('0x48')][_0xd18d('0x57')]?_0x3e4276[_0xd18d('0x48')]:_0x4fad45[_0xd18d('0x43')];_0x3e4276[_0xd18d('0x66')]=qs[_0xd18d('0x4c')](_0xd43956['query']['sort']);_0x3e4276[_0xd18d('0x4d')]=qs['filters'](_[_0xd18d('0x4e')](_0xd43956[_0xd18d('0x44')],_0x4fad45[_0xd18d('0x46')]));if(_0xd43956[_0xd18d('0x44')][_0xd18d('0x4f')]){_0x3e4276[_0xd18d('0x4d')]=_[_0xd18d('0x50')](_0x3e4276['where'],{'$or':_[_0xd18d('0x3f')](_0x3e4276['attributes'],function(_0x4fa703){var _0x4930c5={};_0x4930c5[_0x4fa703]={'$like':'%'+_0xd43956[_0xd18d('0x44')][_0xd18d('0x4f')]+'%'};return _0x4930c5;})});}_0x3e4276=_[_0xd18d('0x50')]({},_0x3e4276,_0xd43956[_0xd18d('0x58')]);return _0x1eb4d8[_0xd18d('0xaa')](_0x3e4276);}})[_0xd18d('0x36')](function(_0x25fc5a){if(_0x25fc5a){_0x165443=_0x25fc5a['length'];if(!_0xd43956['query']['hasOwnProperty'](_0xd18d('0x4b'))){_0x3e4276[_0xd18d('0x30')]=qs['limit'](_0xd43956[_0xd18d('0x44')][_0xd18d('0x30')]);_0x3e4276[_0xd18d('0x2d')]=qs[_0xd18d('0x2d')](_0xd43956[_0xd18d('0x44')][_0xd18d('0x2d')]);}return _0x1eb4d8[_0xd18d('0xaa')](_0x3e4276);}})['then'](function(_0x22111b){if(_0x22111b){return _0x22111b?{'count':_0x165443,'rows':_0x22111b}:null;}})[_0xd18d('0x36')](respondWithResult(_0x41a3a9,null))[_0xd18d('0x28')](handleError(_0x41a3a9,null));};exports[_0xd18d('0xab')]=function(_0x131ce9,_0x1ed597,_0x3912cf){var _0x3721ee={'raw':![],'where':{}};var _0x4596c1={};var _0x22fbdd={'count':0x0,'rows':[]};return db[_0xd18d('0x40')]['findOne']({'where':{'id':_0x131ce9['params']['id']}})[_0xd18d('0x36')](handleEntityNotFound(_0x1ed597,null))[_0xd18d('0x36')](function(_0x236ba8){if(_0x236ba8){_0x4596c1['model']=_['keys'](db['OpenchannelInteraction'][_0xd18d('0x56')]);_0x4596c1[_0xd18d('0x44')]=_[_0xd18d('0x45')](_0x131ce9[_0xd18d('0x44')]);_0x4596c1[_0xd18d('0x46')]=_[_0xd18d('0x47')](_0x4596c1['model'],_0x4596c1['query']);_0x3721ee['attributes']=_['intersection'](_0x4596c1[_0xd18d('0x43')],qs[_0xd18d('0x49')](_0x131ce9[_0xd18d('0x44')]['fields']));_0x3721ee[_0xd18d('0x48')]=_0x3721ee[_0xd18d('0x48')][_0xd18d('0x57')]?_0x3721ee[_0xd18d('0x48')]:_0x4596c1['model'];if(!_0x131ce9[_0xd18d('0x44')][_0xd18d('0x4a')]('nolimit')){_0x3721ee[_0xd18d('0x30')]=qs[_0xd18d('0x30')](_0x131ce9[_0xd18d('0x44')][_0xd18d('0x30')]);_0x3721ee['offset']=qs[_0xd18d('0x2d')](_0x131ce9[_0xd18d('0x44')][_0xd18d('0x2d')]);}_0x3721ee[_0xd18d('0x66')]=qs[_0xd18d('0x4c')](_0x131ce9['query']['sort']);_0x3721ee[_0xd18d('0x4d')]=qs[_0xd18d('0x46')](_[_0xd18d('0x4e')](_0x131ce9[_0xd18d('0x44')],_0x4596c1['filters']));_0x3721ee[_0xd18d('0x4d')]['OpenchannelAccountId']=_0x236ba8['id'];if(_0x131ce9[_0xd18d('0x44')][_0xd18d('0x4f')]){_0x3721ee['where']=_[_0xd18d('0x50')](_0x3721ee['where'],{'$or':_['map'](_0x3721ee[_0xd18d('0x48')],function(_0x5a46a0){var _0x132b1d={};_0x132b1d[_0x5a46a0]={'$like':'%'+_0x131ce9[_0xd18d('0x44')][_0xd18d('0x4f')]+'%'};return _0x132b1d;})});}_0x3721ee=_['merge']({},_0x3721ee,_0x131ce9[_0xd18d('0x58')]);return db[_0xd18d('0x8c')][_0xd18d('0x2f')]({'where':_0x3721ee['where']})[_0xd18d('0x36')](function(_0x6f8ca2){_0x22fbdd[_0xd18d('0x2f')]=_0x6f8ca2;if(_0x131ce9['query'][_0xd18d('0x51')]){_0x3721ee[_0xd18d('0x52')]=[{'model':db[_0xd18d('0x6d')],'as':'Contact','required':![]},{'model':db[_0xd18d('0x9b')],'as':_0xd18d('0xac'),'attributes':[_0xd18d('0x3b'),'fullname',_0xd18d('0xad')],'required':![]},{'model':db[_0xd18d('0xae')],'as':_0xd18d('0xaf'),'attributes':['id',_0xd18d('0x3b'),_0xd18d('0xb0')],'where':_0x131ce9['query'][_0xd18d('0xb1')]?{'id':_0x131ce9[_0xd18d('0x44')][_0xd18d('0xb1')]}:undefined,'required':_0x131ce9[_0xd18d('0x44')][_0xd18d('0xb1')]?!![]:![]}];}return db[_0xd18d('0x8c')][_0xd18d('0x53')](_0x3721ee);})[_0xd18d('0x36')](function(_0x2bdf2e){_0x22fbdd[_0xd18d('0x54')]=_0x2bdf2e;return _0x22fbdd;});}})[_0xd18d('0x36')](respondWithFilteredResult(_0x1ed597,_0x3721ee))[_0xd18d('0x28')](handleError(_0x1ed597,null));};exports[_0xd18d('0xb2')]=function(_0x5ee8e5,_0x3c2625,_0x24f9ef){return db[_0xd18d('0x40')][_0xd18d('0x5f')]({'where':{'id':_0x5ee8e5[_0xd18d('0x55')]['id']}})[_0xd18d('0x36')](handleEntityNotFound(_0x3c2625,null))[_0xd18d('0x36')](function(_0x20f1ae){if(_0x20f1ae){return _0x20f1ae['addAgents'](_0x5ee8e5[_0xd18d('0x5a')][_0xd18d('0x68')],_[_0xd18d('0xb3')](_0x5ee8e5[_0xd18d('0x5a')],[_0xd18d('0x68'),'id'])||{})[_0xd18d('0x8f')](function(_0x563be5){for(var _0x30f0e9=0x0;_0x30f0e9<_0x5ee8e5['body']['ids'][_0xd18d('0x57')];_0x30f0e9+=0x1){socket[_0xd18d('0xb4')]('userOpenchannelAccount:save',{'UserId':Number(_0x5ee8e5['body'][_0xd18d('0x68')][_0x30f0e9]),'OpenchannelAccountId':Number(_0x5ee8e5[_0xd18d('0x55')]['id'])});}return _0x563be5;});}})[_0xd18d('0x36')](respondWithResult(_0x3c2625,null))[_0xd18d('0x28')](handleError(_0x3c2625,null));};exports[_0xd18d('0xb5')]=function(_0x325642,_0x2c7194,_0x376d52){return db[_0xd18d('0x40')][_0xd18d('0x5f')]({'where':{'id':_0x325642[_0xd18d('0x55')]['id']}})['then'](handleEntityNotFound(_0x2c7194,null))[_0xd18d('0x36')](function(_0x1df12d){if(_0x1df12d){return _0x1df12d['removeAgents'](_0x325642[_0xd18d('0x44')][_0xd18d('0x68')])[_0xd18d('0x36')](function(){if(_[_0xd18d('0xb6')](_0x325642[_0xd18d('0x44')][_0xd18d('0x68')])){for(var _0x2abadc=0x0;_0x2abadc<_0x325642[_0xd18d('0x44')][_0xd18d('0x68')][_0xd18d('0x57')];_0x2abadc+=0x1){socket[_0xd18d('0xb4')](_0xd18d('0xb7'),{'UserId':Number(_0x325642[_0xd18d('0x44')]['ids'][_0x2abadc]),'OpenchannelAccountId':Number(_0x325642['params']['id'])});}}else{socket['emit'](_0xd18d('0xb7'),{'UserId':Number(_0x325642[_0xd18d('0x44')][_0xd18d('0x68')]),'OpenchannelAccountId':Number(_0x325642[_0xd18d('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x2c7194,null))[_0xd18d('0x28')](handleError(_0x2c7194,null));};exports[_0xd18d('0xb8')]=function(_0x3ad62d,_0x2bb348,_0x35f3e3){var _0x256238={};var _0x50e6ce={};var _0xb2f73;var _0x5a00f1;return db[_0xd18d('0x40')][_0xd18d('0x65')]({'where':{'id':_0x3ad62d[_0xd18d('0x55')]['id']}})[_0xd18d('0x36')](handleEntityNotFound(_0x2bb348,null))[_0xd18d('0x36')](function(_0x233571){if(_0x233571){_0xb2f73=_0x233571;_0x50e6ce[_0xd18d('0x43')]=_[_0xd18d('0x45')](db['User'][_0xd18d('0x56')]);_0x50e6ce['query']=_['keys'](_0x3ad62d[_0xd18d('0x44')]);_0x50e6ce[_0xd18d('0x46')]=_[_0xd18d('0x47')](_0x50e6ce[_0xd18d('0x43')],_0x50e6ce[_0xd18d('0x44')]);_0x256238[_0xd18d('0x48')]=_['intersection'](_0x50e6ce[_0xd18d('0x43')],qs[_0xd18d('0x49')](_0x3ad62d[_0xd18d('0x44')][_0xd18d('0x49')]));_0x256238[_0xd18d('0x48')]=_0x256238[_0xd18d('0x48')][_0xd18d('0x57')]?_0x256238[_0xd18d('0x48')]:_0x50e6ce[_0xd18d('0x43')];_0x256238['order']=qs[_0xd18d('0x4c')](_0x3ad62d[_0xd18d('0x44')][_0xd18d('0x4c')]);_0x256238[_0xd18d('0x4d')]=qs['filters'](_[_0xd18d('0x4e')](_0x3ad62d[_0xd18d('0x44')],_0x50e6ce[_0xd18d('0x46')]));if(_0x3ad62d[_0xd18d('0x44')][_0xd18d('0x4f')]){_0x256238[_0xd18d('0x4d')]=_['merge'](_0x256238[_0xd18d('0x4d')],{'$or':_[_0xd18d('0x3f')](_0x256238[_0xd18d('0x48')],function(_0x44914a){var _0x158ecf={};_0x158ecf[_0x44914a]={'$like':'%'+_0x3ad62d[_0xd18d('0x44')][_0xd18d('0x4f')]+'%'};return _0x158ecf;})});}_0x256238=_['merge']({},_0x256238,_0x3ad62d[_0xd18d('0x58')]);return _0xb2f73[_0xd18d('0xb8')](_0x256238);}})[_0xd18d('0x36')](function(_0x50aceb){if(_0x50aceb){_0x5a00f1=_0x50aceb[_0xd18d('0x57')];if(!_0x3ad62d[_0xd18d('0x44')][_0xd18d('0x4a')](_0xd18d('0x4b'))){_0x256238[_0xd18d('0x30')]=qs[_0xd18d('0x30')](_0x3ad62d['query'][_0xd18d('0x30')]);_0x256238[_0xd18d('0x2d')]=qs[_0xd18d('0x2d')](_0x3ad62d[_0xd18d('0x44')][_0xd18d('0x2d')]);}return _0xb2f73[_0xd18d('0xb8')](_0x256238);}})[_0xd18d('0x36')](function(_0x261b92){if(_0x261b92){return _0x261b92?{'count':_0x5a00f1,'rows':_0x261b92}:null;}})[_0xd18d('0x36')](respondWithResult(_0x2bb348,null))[_0xd18d('0x28')](handleError(_0x2bb348,null));};exports[_0xd18d('0x3c')]=function(_0x36f5c7,_0x2209b5,_0x5256cd){var _0x1ee0dd,_0x1ece0a,_0x332f23;if(_[_0xd18d('0x74')](_0x36f5c7[_0xd18d('0x5a')][_0xd18d('0x5a')])||_0x36f5c7['body'][_0xd18d('0x5a')]===''){throw new db[(_0xd18d('0x76'))][(_0xd18d('0x77'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xd18d('0x74')](_0x36f5c7[_0xd18d('0x5a')]['to'])){}_0x1ee0dd=_0x36f5c7[_0xd18d('0x5a')]['to'];return db[_0xd18d('0x40')][_0xd18d('0x65')]({'where':{'id':_0x36f5c7[_0xd18d('0x55')]['id']}})[_0xd18d('0x36')](handleEntityNotFound(_0x2209b5,null))['then'](function(_0x29918e){if(_0x29918e){return db[_0xd18d('0x40')][_0xd18d('0x5f')]({'where':{'id':_0x29918e['id']},'include':[{'model':db[_0xd18d('0xb9')],'as':'List','include':[{'model':db[_0xd18d('0x6d')],'as':_0xd18d('0x88'),'where':{[_0x29918e['mapKey']]:_0x1ee0dd},'limit':0x1,'order':[[_0xd18d('0x71'),_0xd18d('0x7f')]]}]}]})[_0xd18d('0x36')](handleEntityNotFound(_0x2209b5,null))['then'](function(_0xd03ef5){if(_0xd03ef5&&_0xd03ef5['List']){_0x1ece0a=_0xd03ef5[_0xd18d('0x38')]({'plain':!![]});if(_0x1ece0a['List']&&_0x1ece0a[_0xd18d('0x7e')][_0xd18d('0x88')][_0xd18d('0x57')]){return _0x1ece0a[_0xd18d('0x7e')]['Contacts'][0x0];}return db[_0xd18d('0x6d')][_0xd18d('0x59')](_['defaults'](_0x36f5c7[_0xd18d('0x5a')],{'firstName':_0x1ee0dd,[_0xd03ef5['mapKey']]:_0x1ee0dd,'phone':_0x1ee0dd,'ListId':_0x1ece0a['ListId']}));}})[_0xd18d('0x36')](handleEntityNotFound(_0x2209b5,null))[_0xd18d('0x36')](function(_0x1c1d03){if(_0x1c1d03){_0x332f23=_0x1c1d03;return db[_0xd18d('0x8c')][_0xd18d('0x5f')]({'where':{'ContactId':_0x332f23['id'],'closed':![],'OpenchannelAccountId':_0x1ece0a['id']}})[_0xd18d('0x36')](function(_0x4410fe){if(_0x4410fe){return[_0x4410fe,![]];}return db[_0xd18d('0x8c')]['create']({'UserId':_0x36f5c7[_0xd18d('0x5d')]['id'],'ContactId':_0x332f23['id'],'OpenchannelAccountId':_0x1ece0a['id'],'lastMsgDirection':'out','Messages':[_[_0xd18d('0x50')](_0x36f5c7[_0xd18d('0x5a')],{'read':![],'body':_0x36f5c7[_0xd18d('0x5a')]['body'],'OpenchannelAccountId':_0x1ece0a['id'],'UserId':_0x36f5c7[_0xd18d('0x5d')]['id'],'ContactId':_0x332f23['id']})]},{'include':[{'model':db[_0xd18d('0x98')],'as':_0xd18d('0xba')}]})[_0xd18d('0x36')](function(_0x53f205){return[_0x53f205,!![]];});});}})[_0xd18d('0x8f')](function(_0x20b4bd,_0x33b321){if(_0x33b321){return _0x20b4bd;}return db[_0xd18d('0x98')][_0xd18d('0x59')](_[_0xd18d('0x50')](_0x36f5c7[_0xd18d('0x5a')],{'read':![],'body':_0x36f5c7[_0xd18d('0x5a')]['body'],'OpenchannelAccountId':_0x1ece0a['id'],'OpenchannelInteractionId':_0x20b4bd['id'],'UserId':_0x36f5c7[_0xd18d('0x5d')]['id'],'ContactId':_0x332f23['id']}))['then'](function(_0x11c915){_0x20b4bd[_0xd18d('0xbb')]['Messages']=[];_0x20b4bd[_0xd18d('0xbb')][_0xd18d('0xba')][_0xd18d('0xbc')](_0x11c915[_0xd18d('0xbb')]);return _0x20b4bd;});});}})[_0xd18d('0x36')](respondWithResult(_0x2209b5,null))[_0xd18d('0x28')](handleError(_0x2209b5,null));}; \ No newline at end of file +var _0x9abe=['removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','OpenchannelApplication','List','applications','Applications','list','orderBy','priority','asc','account','from','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','findAndCountAll','finally','sendStatus','getApplications','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','DESC','defaults','out','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','client','http','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','end','offset','undefined','count','limit','status','set','json','apply','reject','save','update','destroy','get','OpenchannelAccounts','name','send','index','map','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','OpenchannelAccount','findAll','rows','show','params','mandatoryDispositionPause','filters','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne'];(function(_0x2ca32c,_0x58b88){var _0x46f0c5=function(_0x41f03f){while(--_0x41f03f){_0x2ca32c['push'](_0x2ca32c['shift']());}};_0x46f0c5(++_0x58b88);}(_0x9abe,0x1db));var _0xe9ab=function(_0x4b931c,_0x4b70dc){_0x4b931c=_0x4b931c-0x0;var _0xfc9150=_0x9abe[_0x4b931c];return _0xfc9150;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9ab('0x0'));var zipdir=require(_0xe9ab('0x1'));var jsonpatch=require(_0xe9ab('0x2'));var rp=require(_0xe9ab('0x3'));var moment=require(_0xe9ab('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe9ab('0x5'));var util=require(_0xe9ab('0x6'));var path=require(_0xe9ab('0x7'));var sox=require(_0xe9ab('0x8'));var csv=require(_0xe9ab('0x9'));var ejs=require(_0xe9ab('0xa'));var fs=require('fs');var fs_extra=require(_0xe9ab('0xb'));var _=require(_0xe9ab('0xc'));var squel=require(_0xe9ab('0xd'));var crypto=require('crypto');var jsforce=require(_0xe9ab('0xe'));var deskjs=require(_0xe9ab('0xf'));var toCsv=require(_0xe9ab('0x9'));var querystring=require(_0xe9ab('0x10'));var Papa=require(_0xe9ab('0x11'));var Redis=require(_0xe9ab('0x12'));var authService=require(_0xe9ab('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe9ab('0x14'));var logger=require(_0xe9ab('0x15'))('api');var utils=require(_0xe9ab('0x16'));var config=require(_0xe9ab('0x17'));var licenseUtil=require(_0xe9ab('0x18'));var db=require(_0xe9ab('0x19'))['db'];config[_0xe9ab('0x1a')]=_['defaults'](config[_0xe9ab('0x1a')],{'host':_0xe9ab('0x1b'),'port':0x18eb});var socket=require(_0xe9ab('0x1c'))(new Redis(config[_0xe9ab('0x1a')]));require(_0xe9ab('0x1d'))[_0xe9ab('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xe9ab('0x1f')][_0xe9ab('0x20')]({'port':0x232c});var client9002=jayson[_0xe9ab('0x1f')][_0xe9ab('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x983777,_0x56c11f,_0x3ecb9e,_0x90f91e){return new BPromise(function(_0x36e257,_0x515be5){var _0x2fba46=_0x90f91e||client;return _0x2fba46['request'](_0x983777,_0x3ecb9e)[_0xe9ab('0x21')](function(_0x487a18){logger['info'](_0xe9ab('0x22'),_0x56c11f,_0xe9ab('0x23'));logger[_0xe9ab('0x24')](_0xe9ab('0x25'),_0x56c11f,_0xe9ab('0x23'),JSON[_0xe9ab('0x26')](_0x487a18));if(_0x487a18[_0xe9ab('0x27')]){if(_0x487a18['error'][_0xe9ab('0x28')]===0x1f4){logger[_0xe9ab('0x27')](_0xe9ab('0x22'),_0x56c11f,_0x487a18[_0xe9ab('0x27')][_0xe9ab('0x29')]);return _0x515be5(_0x487a18['error']['message']);}logger[_0xe9ab('0x27')](_0xe9ab('0x22'),_0x56c11f,_0x487a18[_0xe9ab('0x27')]['message']);return _0x36e257(_0x487a18['error'][_0xe9ab('0x29')]);}else{logger[_0xe9ab('0x2a')](_0xe9ab('0x22'),_0x56c11f,'request\x20sent');_0x36e257(_0x487a18[_0xe9ab('0x2b')][_0xe9ab('0x29')]);}})[_0xe9ab('0x2c')](function(_0x4986fd){logger[_0xe9ab('0x27')](_0xe9ab('0x22'),_0x56c11f,_0x4986fd);_0x515be5(_0x4986fd);});});}function respondWithStatusCode(_0x16705c,_0x342bb3){_0x342bb3=_0x342bb3||0xcc;return function(_0x42ef21){if(_0x42ef21){return _0x16705c['sendStatus'](_0x342bb3);}return _0x16705c['status'](_0x342bb3)[_0xe9ab('0x2d')]();};}function respondWithResult(_0xe61db,_0x2d2c02){_0x2d2c02=_0x2d2c02||0xc8;return function(_0x46652c){if(_0x46652c){return _0xe61db['status'](_0x2d2c02)['json'](_0x46652c);}};}function respondWithFilteredResult(_0x530bed,_0x4a0ab5){return function(_0x47c565){if(_0x47c565){var _0x3f65cc=typeof _0x4a0ab5[_0xe9ab('0x2e')]===_0xe9ab('0x2f')&&typeof _0x4a0ab5['limit']===_0xe9ab('0x2f');var _0x22ba71=_0x47c565[_0xe9ab('0x30')];var _0x2737e8=_0x3f65cc?0x0:_0x4a0ab5[_0xe9ab('0x2e')];var _0xf63265=_0x3f65cc?_0x47c565[_0xe9ab('0x30')]:_0x4a0ab5[_0xe9ab('0x2e')]+_0x4a0ab5[_0xe9ab('0x31')];var _0x164463;if(_0xf63265>=_0x22ba71){_0xf63265=_0x22ba71;_0x164463=0xc8;}else{_0x164463=0xce;}_0x530bed[_0xe9ab('0x32')](_0x164463);return _0x530bed[_0xe9ab('0x33')]('Content-Range',_0x2737e8+'-'+_0xf63265+'/'+_0x22ba71)[_0xe9ab('0x34')](_0x47c565);}return null;};}function patchUpdates(_0x498dca){return function(_0x2260ab){try{jsonpatch[_0xe9ab('0x35')](_0x2260ab,_0x498dca,!![]);}catch(_0xbaf875){return BPromise[_0xe9ab('0x36')](_0xbaf875);}return _0x2260ab[_0xe9ab('0x37')]();};}function saveUpdates(_0x5bfbbd,_0xa355ef){return function(_0x458959){if(_0x458959){return _0x458959[_0xe9ab('0x38')](_0x5bfbbd)['then'](function(_0x1c6bb9){return _0x1c6bb9;});}return null;};}function removeEntity(_0x48983a,_0x711404){return function(_0xa1c75f){if(_0xa1c75f){return _0xa1c75f[_0xe9ab('0x39')]()[_0xe9ab('0x21')](function(){var _0x4f082d=_0xa1c75f[_0xe9ab('0x3a')]({'plain':!![]});var _0x133412=_0xe9ab('0x3b');return db['UserProfileResource'][_0xe9ab('0x39')]({'where':{'type':_0x133412,'resourceId':_0x4f082d['id']}})[_0xe9ab('0x21')](function(){return _0xa1c75f;});})[_0xe9ab('0x21')](function(){_0x48983a[_0xe9ab('0x32')](0xcc)[_0xe9ab('0x2d')]();});}};}function handleEntityNotFound(_0x4cb77b,_0x5166ec){return function(_0x3b74de){if(!_0x3b74de){_0x4cb77b['sendStatus'](0x194);}return _0x3b74de;};}function handleError(_0x25a889,_0x28cc3f){_0x28cc3f=_0x28cc3f||0x1f4;return function(_0x36896d){logger[_0xe9ab('0x27')](_0x36896d['stack']);if(_0x36896d[_0xe9ab('0x3c')]){delete _0x36896d[_0xe9ab('0x3c')];}_0x25a889[_0xe9ab('0x32')](_0x28cc3f)[_0xe9ab('0x3d')](_0x36896d);};}exports[_0xe9ab('0x3e')]=function(_0x5d9551,_0x241158){var _0x2d507d={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x1ff2eb={},_0x39135e={'count':0x0,'rows':[]};var _0xe558a5=_[_0xe9ab('0x3f')](db['OpenchannelAccount'][_0xe9ab('0x40')],function(_0x37828d){return{'name':_0x37828d['fieldName'],'type':_0x37828d[_0xe9ab('0x41')]['key']};});_0x1ff2eb[_0xe9ab('0x42')]=_[_0xe9ab('0x3f')](_0xe558a5,_0xe9ab('0x3c'));_0x1ff2eb[_0xe9ab('0x43')]=_[_0xe9ab('0x44')](_0x5d9551[_0xe9ab('0x43')]);_0x1ff2eb['filters']=_[_0xe9ab('0x45')](_0x1ff2eb['model'],_0x1ff2eb[_0xe9ab('0x43')]);_0x2d507d[_0xe9ab('0x46')]=_['intersection'](_0x1ff2eb[_0xe9ab('0x42')],qs[_0xe9ab('0x47')](_0x5d9551[_0xe9ab('0x43')][_0xe9ab('0x47')]));_0x2d507d['attributes']=_0x2d507d[_0xe9ab('0x46')][_0xe9ab('0x48')]?_0x2d507d['attributes']:_0x1ff2eb['model'];if(!_0x5d9551[_0xe9ab('0x43')][_0xe9ab('0x49')](_0xe9ab('0x4a'))){_0x2d507d[_0xe9ab('0x31')]=qs['limit'](_0x5d9551[_0xe9ab('0x43')][_0xe9ab('0x31')]);_0x2d507d[_0xe9ab('0x2e')]=qs['offset'](_0x5d9551['query'][_0xe9ab('0x2e')]);}_0x2d507d[_0xe9ab('0x4b')]=qs[_0xe9ab('0x4c')](_0x5d9551[_0xe9ab('0x43')][_0xe9ab('0x4c')]);_0x2d507d[_0xe9ab('0x4d')]=qs['filters'](_[_0xe9ab('0x4e')](_0x5d9551['query'],_0x1ff2eb['filters']),_0xe558a5);if(_0x5d9551[_0xe9ab('0x43')]['filter']){_0x2d507d[_0xe9ab('0x4d')]=_[_0xe9ab('0x4f')](_0x2d507d[_0xe9ab('0x4d')],{'$or':_[_0xe9ab('0x3f')](_0xe558a5,function(_0x50bb7b){if(_0x50bb7b['type']!==_0xe9ab('0x50')){var _0xadd20f={};_0xadd20f[_0x50bb7b[_0xe9ab('0x3c')]]={'$like':'%'+_0x5d9551['query'][_0xe9ab('0x51')]+'%'};return _0xadd20f;}})});}_0x2d507d=_[_0xe9ab('0x4f')]({},_0x2d507d,_0x5d9551[_0xe9ab('0x52')]);var _0x43d19b={'where':_0x2d507d['where']};return db['OpenchannelAccount'][_0xe9ab('0x30')](_0x43d19b)[_0xe9ab('0x21')](function(_0x46c482){_0x39135e[_0xe9ab('0x30')]=_0x46c482;if(_0x5d9551[_0xe9ab('0x43')][_0xe9ab('0x53')]){_0x2d507d[_0xe9ab('0x54')]=[{'all':!![]}];}return db[_0xe9ab('0x55')][_0xe9ab('0x56')](_0x2d507d);})[_0xe9ab('0x21')](function(_0x4f5a1b){_0x39135e[_0xe9ab('0x57')]=_0x4f5a1b;return _0x39135e;})[_0xe9ab('0x21')](respondWithFilteredResult(_0x241158,_0x2d507d))[_0xe9ab('0x2c')](handleError(_0x241158,null));};exports[_0xe9ab('0x58')]=function(_0x148637,_0x28d4c7){var _0x5a395c={'raw':![],'where':{'id':_0x148637[_0xe9ab('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0xe9ab('0x5a')}]},_0x18baae={};_0x18baae[_0xe9ab('0x42')]=_[_0xe9ab('0x44')](db['OpenchannelAccount'][_0xe9ab('0x40')]);_0x18baae['query']=_[_0xe9ab('0x44')](_0x148637[_0xe9ab('0x43')]);_0x18baae[_0xe9ab('0x5b')]=_[_0xe9ab('0x45')](_0x18baae[_0xe9ab('0x42')],_0x18baae['query']);_0x5a395c[_0xe9ab('0x46')]=_[_0xe9ab('0x45')](_0x18baae[_0xe9ab('0x42')],qs[_0xe9ab('0x47')](_0x148637[_0xe9ab('0x43')][_0xe9ab('0x47')]));_0x5a395c[_0xe9ab('0x46')]=_0x5a395c[_0xe9ab('0x46')][_0xe9ab('0x48')]?_0x5a395c[_0xe9ab('0x46')]:_0x18baae['model'];if(_0x148637['query']['includeAll']){_0x5a395c[_0xe9ab('0x54')]=[{'all':!![]}];}_0x5a395c=_[_0xe9ab('0x4f')]({},_0x5a395c,_0x148637['options']);return db[_0xe9ab('0x55')][_0xe9ab('0x5c')](_0x5a395c)[_0xe9ab('0x21')](handleEntityNotFound(_0x28d4c7,null))[_0xe9ab('0x21')](respondWithResult(_0x28d4c7,null))[_0xe9ab('0x2c')](handleError(_0x28d4c7,null));};exports[_0xe9ab('0x5d')]=function(_0x1e9597,_0x2a0cd5){return db['OpenchannelAccount']['create'](_0x1e9597[_0xe9ab('0x5e')],{})[_0xe9ab('0x21')](function(_0x2b403d){var _0x1be136=_0x1e9597[_0xe9ab('0x5f')][_0xe9ab('0x3a')]({'plain':!![]});if(!_0x1be136)throw new Error(_0xe9ab('0x60'));if(_0x1be136['role']===_0xe9ab('0x5f')){var _0x378f3b=_0x2b403d[_0xe9ab('0x3a')]({'plain':!![]});var _0x464e06=_0xe9ab('0x3b');return db[_0xe9ab('0x61')][_0xe9ab('0x5c')]({'where':{'name':_0x464e06,'userProfileId':_0x1be136[_0xe9ab('0x62')]},'raw':!![]})['then'](function(_0x1a3b17){if(_0x1a3b17&&_0x1a3b17[_0xe9ab('0x63')]===0x0){return db['UserProfileResource'][_0xe9ab('0x5d')]({'name':_0x378f3b[_0xe9ab('0x3c')],'resourceId':_0x378f3b['id'],'type':_0x1a3b17[_0xe9ab('0x3c')],'sectionId':_0x1a3b17['id']},{})['then'](function(){return _0x2b403d;});}else{return _0x2b403d;}})[_0xe9ab('0x2c')](function(_0x158f2b){logger['error'](_0xe9ab('0x64'),_0x158f2b);throw _0x158f2b;});}return _0x2b403d;})[_0xe9ab('0x21')](respondWithResult(_0x2a0cd5,0xc9))['catch'](handleError(_0x2a0cd5,null));};exports['update']=function(_0x4713f9,_0x3de9ff){if(_0x4713f9[_0xe9ab('0x5e')]['id']){delete _0x4713f9[_0xe9ab('0x5e')]['id'];}return db[_0xe9ab('0x55')][_0xe9ab('0x5c')]({'where':{'id':_0x4713f9['params']['id']},'include':[{'model':db['Pause'],'as':_0xe9ab('0x5a')}]})[_0xe9ab('0x21')](handleEntityNotFound(_0x3de9ff,null))[_0xe9ab('0x21')](saveUpdates(_0x4713f9[_0xe9ab('0x5e')],null))['then'](respondWithResult(_0x3de9ff,null))[_0xe9ab('0x2c')](handleError(_0x3de9ff,null));};exports[_0xe9ab('0x39')]=function(_0x3595cd,_0x46373e){return db[_0xe9ab('0x55')][_0xe9ab('0x5c')]({'where':{'id':_0x3595cd[_0xe9ab('0x59')]['id']}})[_0xe9ab('0x21')](handleEntityNotFound(_0x46373e,null))[_0xe9ab('0x21')](removeEntity(_0x46373e,null))[_0xe9ab('0x2c')](handleError(_0x46373e,null));};exports[_0xe9ab('0x65')]=function(_0x41fe7d,_0x555d0c){return db[_0xe9ab('0x55')][_0xe9ab('0x65')]()[_0xe9ab('0x21')](respondWithResult(_0x555d0c,null))['catch'](handleError(_0x555d0c,null));};exports[_0xe9ab('0x66')]=function(_0x5a53a7,_0x4845d0,_0x1a9bde){if(_0x5a53a7[_0xe9ab('0x5e')]['id']){delete _0x5a53a7[_0xe9ab('0x5e')]['id'];}return db[_0xe9ab('0x55')][_0xe9ab('0x5c')]({'where':{'id':_0x5a53a7[_0xe9ab('0x59')]['id']}})[_0xe9ab('0x21')](handleEntityNotFound(_0x4845d0,null))[_0xe9ab('0x21')](function(_0x46f66f){if(_0x46f66f){_0x5a53a7[_0xe9ab('0x5e')][_0xe9ab('0x67')]=_0x46f66f['id'];return db[_0xe9ab('0x68')]['create'](_0x5a53a7[_0xe9ab('0x5e')]);}})[_0xe9ab('0x21')](respondWithResult(_0x4845d0,null))[_0xe9ab('0x2c')](handleError(_0x4845d0,null));};exports[_0xe9ab('0x69')]=function(_0x140393,_0x29acf4,_0x1491c2){var _0x2df6ba={'raw':![],'where':{}};var _0x3c82c8={};var _0x135968={'count':0x0,'rows':[]};return db[_0xe9ab('0x55')][_0xe9ab('0x6a')]({'where':{'id':_0x140393['params']['id']}})[_0xe9ab('0x21')](handleEntityNotFound(_0x29acf4,null))[_0xe9ab('0x21')](function(_0x22627a){if(_0x22627a){_0x3c82c8['model']=_[_0xe9ab('0x44')](db[_0xe9ab('0x68')]['rawAttributes']);_0x3c82c8[_0xe9ab('0x43')]=_['keys'](_0x140393[_0xe9ab('0x43')]);_0x3c82c8[_0xe9ab('0x5b')]=_[_0xe9ab('0x45')](_0x3c82c8[_0xe9ab('0x42')],_0x3c82c8[_0xe9ab('0x43')]);_0x2df6ba['attributes']=_['intersection'](_0x3c82c8[_0xe9ab('0x42')],qs[_0xe9ab('0x47')](_0x140393['query'][_0xe9ab('0x47')]));_0x2df6ba['attributes']=_0x2df6ba[_0xe9ab('0x46')][_0xe9ab('0x48')]?_0x2df6ba[_0xe9ab('0x46')]:_0x3c82c8[_0xe9ab('0x42')];if(!_0x140393['query']['hasOwnProperty'](_0xe9ab('0x4a'))){_0x2df6ba[_0xe9ab('0x31')]=qs[_0xe9ab('0x31')](_0x140393[_0xe9ab('0x43')]['limit']);_0x2df6ba['offset']=qs[_0xe9ab('0x2e')](_0x140393[_0xe9ab('0x43')][_0xe9ab('0x2e')]);}_0x2df6ba[_0xe9ab('0x4b')]=qs['sort'](_0x140393[_0xe9ab('0x43')][_0xe9ab('0x4c')]);_0x2df6ba[_0xe9ab('0x4d')]=qs[_0xe9ab('0x5b')](_[_0xe9ab('0x4e')](_0x140393[_0xe9ab('0x43')],_0x3c82c8[_0xe9ab('0x5b')]));_0x2df6ba[_0xe9ab('0x4d')][_0xe9ab('0x67')]=_0x22627a['id'];if(_0x140393['query'][_0xe9ab('0x51')]){_0x2df6ba[_0xe9ab('0x4d')]=_['merge'](_0x2df6ba[_0xe9ab('0x4d')],{'$or':_[_0xe9ab('0x3f')](_0x2df6ba['attributes'],function(_0x79c8a4){var _0x1ac113={};_0x1ac113[_0x79c8a4]={'$like':'%'+_0x140393[_0xe9ab('0x43')][_0xe9ab('0x51')]+'%'};return _0x1ac113;})});}_0x2df6ba=_[_0xe9ab('0x4f')]({},_0x2df6ba,_0x140393[_0xe9ab('0x52')]);return db[_0xe9ab('0x68')]['count']({'where':_0x2df6ba[_0xe9ab('0x4d')]})[_0xe9ab('0x21')](function(_0x517d50){_0x135968['count']=_0x517d50;if(_0x140393['query'][_0xe9ab('0x53')]){_0x2df6ba[_0xe9ab('0x54')]=[{'all':!![]}];}return db[_0xe9ab('0x68')][_0xe9ab('0x56')](_0x2df6ba);})[_0xe9ab('0x21')](function(_0x1f28bb){_0x135968['rows']=_0x1f28bb;return _0x135968;});}})[_0xe9ab('0x21')](respondWithFilteredResult(_0x29acf4,_0x2df6ba))[_0xe9ab('0x2c')](handleError(_0x29acf4,null));};exports[_0xe9ab('0x6b')]=function(_0x4e5854,_0x157f6c,_0x38b588){return db[_0xe9ab('0x55')][_0xe9ab('0x5c')]({'where':{'id':_0x4e5854['params']['id']}})[_0xe9ab('0x21')](handleEntityNotFound(_0x157f6c,null))[_0xe9ab('0x21')](function(_0x418f17){if(_0x418f17){return _0x418f17[_0xe9ab('0x6b')](_0x4e5854[_0xe9ab('0x43')][_0xe9ab('0x6c')]);}})[_0xe9ab('0x21')](respondWithStatusCode(_0x157f6c,null))[_0xe9ab('0x2c')](handleError(_0x157f6c,null));};exports[_0xe9ab('0x6d')]=function(_0x58dba4,_0x3d98f4,_0x13355c){if(_0x58dba4['body']['id']){delete _0x58dba4[_0xe9ab('0x5e')]['id'];}return db[_0xe9ab('0x55')][_0xe9ab('0x5c')]({'where':{'id':_0x58dba4['params']['id']}})[_0xe9ab('0x21')](handleEntityNotFound(_0x3d98f4,null))[_0xe9ab('0x21')](function(_0x233b23){if(_0x233b23){_0x58dba4[_0xe9ab('0x5e')][_0xe9ab('0x67')]=_0x233b23['id'];return db[_0xe9ab('0x6e')][_0xe9ab('0x5d')](_0x58dba4['body']);}})[_0xe9ab('0x21')](respondWithResult(_0x3d98f4,null))[_0xe9ab('0x2c')](handleError(_0x3d98f4,null));};exports[_0xe9ab('0x6f')]=function(_0x4874c1,_0x2b694e,_0x4662a4){var _0x7298c0={'raw':![],'where':{}};var _0x4c3046={};var _0x3e9b68={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xe9ab('0x6a')]({'where':{'id':_0x4874c1[_0xe9ab('0x59')]['id']}})['then'](handleEntityNotFound(_0x2b694e,null))[_0xe9ab('0x21')](function(_0x233f99){if(_0x233f99){_0x4c3046[_0xe9ab('0x42')]=_[_0xe9ab('0x44')](db[_0xe9ab('0x6e')][_0xe9ab('0x40')]);_0x4c3046[_0xe9ab('0x43')]=_['keys'](_0x4874c1['query']);_0x4c3046[_0xe9ab('0x5b')]=_['intersection'](_0x4c3046[_0xe9ab('0x42')],_0x4c3046['query']);_0x7298c0[_0xe9ab('0x46')]=_[_0xe9ab('0x45')](_0x4c3046[_0xe9ab('0x42')],qs[_0xe9ab('0x47')](_0x4874c1['query'][_0xe9ab('0x47')]));_0x7298c0[_0xe9ab('0x46')]=_0x7298c0['attributes'][_0xe9ab('0x48')]?_0x7298c0[_0xe9ab('0x46')]:_0x4c3046[_0xe9ab('0x42')];if(!_0x4874c1[_0xe9ab('0x43')]['hasOwnProperty'](_0xe9ab('0x4a'))){_0x7298c0[_0xe9ab('0x31')]=qs['limit'](_0x4874c1['query'][_0xe9ab('0x31')]);_0x7298c0['offset']=qs[_0xe9ab('0x2e')](_0x4874c1[_0xe9ab('0x43')][_0xe9ab('0x2e')]);}_0x7298c0[_0xe9ab('0x4b')]=qs[_0xe9ab('0x4c')](_0x4874c1[_0xe9ab('0x43')][_0xe9ab('0x4c')]);_0x7298c0[_0xe9ab('0x4d')]=qs[_0xe9ab('0x5b')](_['pick'](_0x4874c1['query'],_0x4c3046[_0xe9ab('0x5b')]));_0x7298c0['where'][_0xe9ab('0x67')]=_0x233f99['id'];if(_0x4874c1[_0xe9ab('0x43')][_0xe9ab('0x51')]){_0x7298c0[_0xe9ab('0x4d')]=_[_0xe9ab('0x4f')](_0x7298c0[_0xe9ab('0x4d')],{'$or':_[_0xe9ab('0x3f')](_0x7298c0[_0xe9ab('0x46')],function(_0x261de){var _0xee82f9={};_0xee82f9[_0x261de]={'$like':'%'+_0x4874c1['query'][_0xe9ab('0x51')]+'%'};return _0xee82f9;})});}_0x7298c0=_['merge']({},_0x7298c0,_0x4874c1[_0xe9ab('0x52')]);return db[_0xe9ab('0x6e')]['count']({'where':_0x7298c0[_0xe9ab('0x4d')]})[_0xe9ab('0x21')](function(_0x2e92ab){_0x3e9b68[_0xe9ab('0x30')]=_0x2e92ab;if(_0x4874c1[_0xe9ab('0x43')]['includeAll']){_0x7298c0['include']=[{'all':!![]}];}return db[_0xe9ab('0x6e')][_0xe9ab('0x56')](_0x7298c0);})[_0xe9ab('0x21')](function(_0x29a525){_0x3e9b68[_0xe9ab('0x57')]=_0x29a525;return _0x3e9b68;});}})['then'](respondWithFilteredResult(_0x2b694e,_0x7298c0))['catch'](handleError(_0x2b694e,null));};exports[_0xe9ab('0x70')]=function(_0x5eae22,_0x3a60c6,_0x3096c2){return db['OpenchannelAccount'][_0xe9ab('0x5c')]({'where':{'id':_0x5eae22[_0xe9ab('0x59')]['id']}})[_0xe9ab('0x21')](handleEntityNotFound(_0x3a60c6,null))[_0xe9ab('0x21')](function(_0x340be9){if(_0x340be9){return _0x340be9[_0xe9ab('0x70')](_0x5eae22[_0xe9ab('0x43')]['ids']);}})[_0xe9ab('0x21')](respondWithStatusCode(_0x3a60c6,null))[_0xe9ab('0x2c')](handleError(_0x3a60c6,null));};exports[_0xe9ab('0x71')]=function(_0x57cbc3,_0xa436c,_0x3bf63f){var _0x4db678={'body':_0x57cbc3[_0xe9ab('0x5e')],'channel':_0xe9ab('0x72')};var _0x2af73c=[];var _0x447d8d=[];var _0x43a9ec={};var _0x4ddf56=![];return db[_0xe9ab('0x73')][_0xe9ab('0x65')]()['then'](function(_0x10e25a){if(!_0x10e25a){throw new db[(_0xe9ab('0x74'))][(_0xe9ab('0x75'))]('no\x20available\x20attributes');}_0x2af73c=_[_0xe9ab('0x76')](_[_0xe9ab('0x44')](_0x10e25a),[_0xe9ab('0x77'),_0xe9ab('0x78')]);_0x447d8d=_[_0xe9ab('0x76')](_[_0xe9ab('0x44')](_0x10e25a),[_0xe9ab('0x77'),_0xe9ab('0x78'),_0xe9ab('0x79'),_0xe9ab('0x7a')]);if(_0x57cbc3[_0xe9ab('0x5e')]['id']){delete _0x57cbc3[_0xe9ab('0x5e')]['id'];}if(_[_0xe9ab('0x7b')](_0x57cbc3[_0xe9ab('0x5e')]['from'])){throw new db[(_0xe9ab('0x74'))][(_0xe9ab('0x75'))](_0xe9ab('0x7c'));}if(_[_0xe9ab('0x7b')](_0x57cbc3['body'][_0xe9ab('0x5e')])||_0x57cbc3[_0xe9ab('0x5e')][_0xe9ab('0x5e')]===''){throw new db['Sequelize'][(_0xe9ab('0x75'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xe9ab('0x7b')](_0x57cbc3[_0xe9ab('0x5e')][_0xe9ab('0x7d')])){throw new db[(_0xe9ab('0x74'))][(_0xe9ab('0x75'))](_0xe9ab('0x7e')+_0x447d8d);}if(!_['includes'](_0x447d8d,_0x57cbc3[_0xe9ab('0x5e')][_0xe9ab('0x7d')])){throw new db['Sequelize'][(_0xe9ab('0x75'))](_0xe9ab('0x7f')+_0x447d8d);}_0x43a9ec[_0x57cbc3[_0xe9ab('0x5e')][_0xe9ab('0x7d')]]=_0x57cbc3['body']['from'];})['then'](function(){return db['OpenchannelAccount'][_0xe9ab('0x5c')]({'where':{'id':_0x57cbc3[_0xe9ab('0x59')]['id']},'include':[{'model':db[_0xe9ab('0x80')],'as':'List','include':[{'model':db['CmContact'],'as':_0xe9ab('0x81'),'where':_0x43a9ec,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xe9ab('0x82')],'as':'Applications'}]});})[_0xe9ab('0x21')](handleEntityNotFound(_0xa436c,null))[_0xe9ab('0x21')](function(_0x5b1741){if(_0x5b1741&&_0x5b1741[_0xe9ab('0x83')]){_0x4db678['account']=_0x5b1741;_0x4db678[_0xe9ab('0x84')]=_0x5b1741[_0xe9ab('0x85')];_0x4db678[_0xe9ab('0x86')]=_0x5b1741[_0xe9ab('0x83')];_0x4db678['applications']=_[_0xe9ab('0x87')](_0x4db678['applications'],[_0xe9ab('0x88')],[_0xe9ab('0x89')]);if(_0x4db678['account'][_0xe9ab('0x85')]){delete _0x4db678[_0xe9ab('0x8a')][_0xe9ab('0x85')];}if(_0x4db678['account'][_0xe9ab('0x83')]&&_0x4db678[_0xe9ab('0x8a')][_0xe9ab('0x83')][_0xe9ab('0x81')][_0xe9ab('0x48')]){return _0x4db678[_0xe9ab('0x8a')][_0xe9ab('0x83')]['Contacts'][0x0];}var _0x306cb1=_['defaults'](_0x57cbc3['body'],{'firstName':_0x57cbc3[_0xe9ab('0x5e')][_0xe9ab('0x8b')],'ListId':_0x5b1741[_0xe9ab('0x7a')]});_0x306cb1[_0x57cbc3[_0xe9ab('0x5e')]['mapKey']]=_0x57cbc3[_0xe9ab('0x5e')][_0xe9ab('0x8b')];return db[_0xe9ab('0x73')][_0xe9ab('0x5d')](_0x306cb1,{'fields':_0x2af73c,'raw':!![]});}})[_0xe9ab('0x21')](handleEntityNotFound(_0xa436c,null))[_0xe9ab('0x21')](function(_0x595439){_0x4db678[_0xe9ab('0x8c')]=_0x595439;if(_0x595439){var _0x2d4b70={'ContactId':_0x595439['id'],'OpenchannelAccountId':_0x57cbc3[_0xe9ab('0x59')]['id'],'from':(_0x595439['firstName']||'')+'\x20'+(_0x595439[_0xe9ab('0x8d')]||'')};var _0x41bbe5={'OpenchannelAccountId':_0x57cbc3[_0xe9ab('0x59')]['id'],'closed':![]};if(_0x57cbc3[_0xe9ab('0x5e')]['threadId']){_0x41bbe5['threadId']=_0x57cbc3['body'][_0xe9ab('0x8e')];return db[_0xe9ab('0x8f')][_0xe9ab('0x5c')]({'where':_0x41bbe5})[_0xe9ab('0x21')](function(_0x53ed40){if(_0x53ed40){return[_0x53ed40,![]];}_0x2d4b70[_0xe9ab('0x8e')]=_0x57cbc3[_0xe9ab('0x5e')][_0xe9ab('0x8e')];_0x2d4b70[_0xe9ab('0x90')]=_0x57cbc3[_0xe9ab('0x5e')][_0xe9ab('0x90')];return db[_0xe9ab('0x8f')][_0xe9ab('0x5d')](_0x2d4b70)[_0xe9ab('0x21')](function(_0x536c93){return[_0x536c93,!![]];});});}else{_0x41bbe5[_0xe9ab('0x8e')]=null;}_0x41bbe5[_0xe9ab('0x91')]=_0x595439['id'];return db[_0xe9ab('0x8f')][_0xe9ab('0x5c')]({'where':_0x41bbe5})['then'](function(_0x4bdebf){if(_0x4bdebf){return[_0x4bdebf,![]];}return db[_0xe9ab('0x8f')][_0xe9ab('0x5d')](_0x2d4b70)[_0xe9ab('0x21')](function(_0x29df97){return[_0x29df97,!![]];});});}})[_0xe9ab('0x92')](function(_0x5b5d49,_0x2bd667){if(_0x5b5d49){_0x4ddf56=_0x2bd667;if(!_0x2bd667){var _0x5414f3={'from':(_0x4db678['contact']['firstName']||'')+'\x20'+(_0x4db678[_0xe9ab('0x8c')][_0xe9ab('0x8d')]||'')};if(_0x57cbc3[_0xe9ab('0x5e')]['threadId']&&_0x57cbc3[_0xe9ab('0x5e')][_0xe9ab('0x93')]&&_0x57cbc3[_0xe9ab('0x5e')][_0xe9ab('0x8e')]!=_0x57cbc3[_0xe9ab('0x5e')][_0xe9ab('0x93')]){_0x5414f3[_0xe9ab('0x8e')]=_0x57cbc3[_0xe9ab('0x5e')][_0xe9ab('0x93')];}return _0x5b5d49[_0xe9ab('0x38')](_0x5414f3);}else{return _0x5b5d49;}}})[_0xe9ab('0x21')](function(_0x22df33){_0x4db678[_0xe9ab('0x94')]=_0x22df33[_0xe9ab('0x3a')]({'plain':!![]});_0x4db678[_0xe9ab('0x94')]['created']=_0x4ddf56;if(_0x4db678['interaction'][_0xe9ab('0x95')]){if(_0x4db678[_0xe9ab('0x8a')][_0xe9ab('0x96')]){_0x4db678['applications'][_0xe9ab('0x97')]({'id':0x0,'priority':_0x4db678[_0xe9ab('0x84')][_0xe9ab('0x48')]+0x1,'app':'close','appdata':_0xe9ab('0x98'),'interval':_0xe9ab('0x99')});}}return db[_0xe9ab('0x9a')]['create']({'body':_0x57cbc3[_0xe9ab('0x5e')][_0xe9ab('0x5e')],'OpenchannelAccountId':_0x57cbc3['params']['id'],'OpenchannelInteractionId':_0x22df33['id'],'direction':'in','ContactId':_0x4db678[_0xe9ab('0x8c')]['id'],'AttachmentId':_0x57cbc3[_0xe9ab('0x5e')]['AttachmentId']});})[_0xe9ab('0x21')](function(_0x5277bc){_0x4db678['message']=_0x5277bc;if(_0x4db678[_0xe9ab('0x94')][_0xe9ab('0x9b')]){return db[_0xe9ab('0x9c')][_0xe9ab('0x5c')]({'attributes':['id',_0xe9ab('0x3c')],'where':{'id':_0x4db678[_0xe9ab('0x94')][_0xe9ab('0x9b')]}})['then'](function(_0x477517){if(_0x477517){_0x4db678[_0xe9ab('0x84')][_0xe9ab('0x9d')]({'id':0x0,'priority':0x0,'app':_0xe9ab('0x9e'),'appdata':_0x477517[_0xe9ab('0x3c')]+','+(_0x4db678[_0xe9ab('0x8a')][_0xe9ab('0x9f')]||0xa),'interval':_0xe9ab('0x99')});_0x4db678[_0xe9ab('0xa0')]=![];}return respondWithRpcPromise(_0xe9ab('0xa1'),_0xe9ab('0xa2'),_0x4db678);});}return respondWithRpcPromise(_0xe9ab('0xa1'),'startRouting',_0x4db678);})[_0xe9ab('0x21')](function(_0x1b37b7){respondWithRpcPromise(_0xe9ab('0xa3'),_0xe9ab('0xa3'),{'event':_0xe9ab('0x71'),'message':_0x1b37b7},client9002);return _0x1b37b7;})[_0xe9ab('0x21')](respondWithResult(_0xa436c,null))[_0xe9ab('0x2c')](handleError(_0xa436c,null));};exports[_0xe9ab('0xa4')]=function(_0x59183b,_0x742229){var _0x24c384=_0x59183b['params']['id'];var _0x32214d=_0x59183b[_0xe9ab('0x5e')];var _0x2e3fc5=0xc8;var _0x83537f=null;return db[_0xe9ab('0xa5')][_0xe9ab('0xa6')]({'isolationLevel':db['sequelize'][_0xe9ab('0xa7')][_0xe9ab('0xa8')]['READ_COMMITTED']},function(_0x2863d6){return db[_0xe9ab('0x55')][_0xe9ab('0x6a')]({'where':{'id':_0x24c384},'transaction':_0x2863d6})[_0xe9ab('0x21')](function(_0xf932e0){if(_0xf932e0){return db['OpenchannelApplication'][_0xe9ab('0x39')]({'where':{'OpenchannelAccountId':_0x24c384},'transaction':_0x2863d6})[_0xe9ab('0x21')](function(){var _0xcc6543=_[_0xe9ab('0x3f')](_0x32214d,function(_0x14e4ea){_0x14e4ea[_0xe9ab('0x67')]=_0x24c384;return _0x14e4ea;});return db[_0xe9ab('0x82')]['bulkCreate'](_0xcc6543,{'transaction':_0x2863d6});});}else{_0x2e3fc5=0x194;_0x83537f=[];}});})['then'](function(){if(_0x2e3fc5!==0x194){return db['OpenchannelApplication'][_0xe9ab('0xa9')]({'where':{'OpenchannelAccountId':_0x24c384},'order':_0xe9ab('0x88')})['then'](function(_0x332baf){_0x83537f=_0x332baf;});}})['catch'](function(_0x17e7b3){_0x2e3fc5=0x1f4;logger['error'](_0x17e7b3['stack']);if(_0x17e7b3[_0xe9ab('0x3c')]){delete _0x17e7b3[_0xe9ab('0x3c')];}_0x83537f=_0x17e7b3;})[_0xe9ab('0xaa')](function(){if(_0x83537f===null){_0x742229[_0xe9ab('0xab')](_0x2e3fc5);}else{if(_0x2e3fc5===0x1f4){_0x742229[_0xe9ab('0x32')](_0x2e3fc5)[_0xe9ab('0x3d')](_0x83537f);}else{_0x742229[_0xe9ab('0x32')](_0x2e3fc5)[_0xe9ab('0x34')](_0x83537f);}}});};exports[_0xe9ab('0xac')]=function(_0x333846,_0x12e2a3,_0x4eec00){var _0xabcba0={};var _0x1faebc={};var _0x4546d6;var _0x51672c;return db[_0xe9ab('0x55')][_0xe9ab('0x6a')]({'where':{'id':_0x333846[_0xe9ab('0x59')]['id']}})['then'](handleEntityNotFound(_0x12e2a3,null))['then'](function(_0x1b4ddf){if(_0x1b4ddf){_0x4546d6=_0x1b4ddf;_0x1faebc[_0xe9ab('0x42')]=_[_0xe9ab('0x44')](db[_0xe9ab('0x82')][_0xe9ab('0x40')]);_0x1faebc[_0xe9ab('0x43')]=_[_0xe9ab('0x44')](_0x333846[_0xe9ab('0x43')]);_0x1faebc[_0xe9ab('0x5b')]=_[_0xe9ab('0x45')](_0x1faebc[_0xe9ab('0x42')],_0x1faebc[_0xe9ab('0x43')]);_0xabcba0['attributes']=_[_0xe9ab('0x45')](_0x1faebc[_0xe9ab('0x42')],qs[_0xe9ab('0x47')](_0x333846[_0xe9ab('0x43')]['fields']));_0xabcba0[_0xe9ab('0x46')]=_0xabcba0[_0xe9ab('0x46')][_0xe9ab('0x48')]?_0xabcba0[_0xe9ab('0x46')]:_0x1faebc[_0xe9ab('0x42')];_0xabcba0[_0xe9ab('0x4b')]=qs[_0xe9ab('0x4c')](_0x333846['query']['sort']);_0xabcba0[_0xe9ab('0x4d')]=qs[_0xe9ab('0x5b')](_[_0xe9ab('0x4e')](_0x333846[_0xe9ab('0x43')],_0x1faebc['filters']));if(_0x333846[_0xe9ab('0x43')][_0xe9ab('0x51')]){_0xabcba0['where']=_[_0xe9ab('0x4f')](_0xabcba0['where'],{'$or':_[_0xe9ab('0x3f')](_0xabcba0['attributes'],function(_0x1ea252){var _0x5d75b0={};_0x5d75b0[_0x1ea252]={'$like':'%'+_0x333846['query'][_0xe9ab('0x51')]+'%'};return _0x5d75b0;})});}_0xabcba0=_[_0xe9ab('0x4f')]({},_0xabcba0,_0x333846[_0xe9ab('0x52')]);return _0x4546d6[_0xe9ab('0xac')](_0xabcba0);}})[_0xe9ab('0x21')](function(_0x51acea){if(_0x51acea){_0x51672c=_0x51acea[_0xe9ab('0x48')];if(!_0x333846['query']['hasOwnProperty'](_0xe9ab('0x4a'))){_0xabcba0[_0xe9ab('0x31')]=qs[_0xe9ab('0x31')](_0x333846[_0xe9ab('0x43')][_0xe9ab('0x31')]);_0xabcba0[_0xe9ab('0x2e')]=qs[_0xe9ab('0x2e')](_0x333846[_0xe9ab('0x43')]['offset']);}return _0x4546d6[_0xe9ab('0xac')](_0xabcba0);}})[_0xe9ab('0x21')](function(_0xc81173){if(_0xc81173){return _0xc81173?{'count':_0x51672c,'rows':_0xc81173}:null;}})[_0xe9ab('0x21')](respondWithResult(_0x12e2a3,null))[_0xe9ab('0x2c')](handleError(_0x12e2a3,null));};exports[_0xe9ab('0xad')]=function(_0x1b6c59,_0x5828b7,_0x16e415){var _0x345cba={'raw':![],'where':{}};var _0x4b3193={};var _0x40a5e6={'count':0x0,'rows':[]};return db[_0xe9ab('0x55')][_0xe9ab('0x6a')]({'where':{'id':_0x1b6c59[_0xe9ab('0x59')]['id']}})[_0xe9ab('0x21')](handleEntityNotFound(_0x5828b7,null))[_0xe9ab('0x21')](function(_0x414ae2){if(_0x414ae2){_0x4b3193[_0xe9ab('0x42')]=_['keys'](db[_0xe9ab('0x8f')][_0xe9ab('0x40')]);_0x4b3193['query']=_[_0xe9ab('0x44')](_0x1b6c59[_0xe9ab('0x43')]);_0x4b3193[_0xe9ab('0x5b')]=_[_0xe9ab('0x45')](_0x4b3193['model'],_0x4b3193[_0xe9ab('0x43')]);_0x345cba[_0xe9ab('0x46')]=_[_0xe9ab('0x45')](_0x4b3193[_0xe9ab('0x42')],qs[_0xe9ab('0x47')](_0x1b6c59[_0xe9ab('0x43')]['fields']));_0x345cba[_0xe9ab('0x46')]=_0x345cba[_0xe9ab('0x46')]['length']?_0x345cba[_0xe9ab('0x46')]:_0x4b3193[_0xe9ab('0x42')];if(!_0x1b6c59['query'][_0xe9ab('0x49')](_0xe9ab('0x4a'))){_0x345cba[_0xe9ab('0x31')]=qs['limit'](_0x1b6c59['query']['limit']);_0x345cba['offset']=qs[_0xe9ab('0x2e')](_0x1b6c59['query'][_0xe9ab('0x2e')]);}_0x345cba[_0xe9ab('0x4b')]=qs['sort'](_0x1b6c59[_0xe9ab('0x43')]['sort']);_0x345cba['where']=qs[_0xe9ab('0x5b')](_['pick'](_0x1b6c59[_0xe9ab('0x43')],_0x4b3193[_0xe9ab('0x5b')]));_0x345cba['where']['OpenchannelAccountId']=_0x414ae2['id'];if(_0x1b6c59['query']['filter']){_0x345cba['where']=_['merge'](_0x345cba[_0xe9ab('0x4d')],{'$or':_[_0xe9ab('0x3f')](_0x345cba[_0xe9ab('0x46')],function(_0x75de39){var _0x4fdeb2={};_0x4fdeb2[_0x75de39]={'$like':'%'+_0x1b6c59[_0xe9ab('0x43')][_0xe9ab('0x51')]+'%'};return _0x4fdeb2;})});}_0x345cba=_[_0xe9ab('0x4f')]({},_0x345cba,_0x1b6c59[_0xe9ab('0x52')]);return db['OpenchannelInteraction'][_0xe9ab('0x30')]({'where':_0x345cba[_0xe9ab('0x4d')]})['then'](function(_0x17488d){_0x40a5e6[_0xe9ab('0x30')]=_0x17488d;if(_0x1b6c59['query'][_0xe9ab('0x53')]){_0x345cba['include']=[{'model':db[_0xe9ab('0x73')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xe9ab('0xae'),'attributes':[_0xe9ab('0x3c'),_0xe9ab('0xaf'),_0xe9ab('0xb0')],'required':![]},{'model':db[_0xe9ab('0xb1')],'as':_0xe9ab('0xb2'),'attributes':['id',_0xe9ab('0x3c'),_0xe9ab('0xb3')],'where':_0x1b6c59[_0xe9ab('0x43')]['tag']?{'id':_0x1b6c59[_0xe9ab('0x43')]['tag']}:undefined,'required':_0x1b6c59[_0xe9ab('0x43')][_0xe9ab('0xb4')]?!![]:![]}];}return db[_0xe9ab('0x8f')][_0xe9ab('0x56')](_0x345cba);})[_0xe9ab('0x21')](function(_0xf3bb7){_0x40a5e6['rows']=_0xf3bb7;return _0x40a5e6;});}})[_0xe9ab('0x21')](respondWithFilteredResult(_0x5828b7,_0x345cba))[_0xe9ab('0x2c')](handleError(_0x5828b7,null));};exports[_0xe9ab('0xb5')]=function(_0x1b1bc9,_0xd1f505,_0x60d93d){return db[_0xe9ab('0x55')][_0xe9ab('0x5c')]({'where':{'id':_0x1b1bc9[_0xe9ab('0x59')]['id']}})[_0xe9ab('0x21')](handleEntityNotFound(_0xd1f505,null))[_0xe9ab('0x21')](function(_0x14cc6d){if(_0x14cc6d){return _0x14cc6d['addAgents'](_0x1b1bc9['body'][_0xe9ab('0x6c')],_['omit'](_0x1b1bc9[_0xe9ab('0x5e')],[_0xe9ab('0x6c'),'id'])||{})[_0xe9ab('0x92')](function(_0x31d0cb){for(var _0xb73b71=0x0;_0xb73b71<_0x1b1bc9[_0xe9ab('0x5e')][_0xe9ab('0x6c')][_0xe9ab('0x48')];_0xb73b71+=0x1){socket['emit'](_0xe9ab('0xb6'),{'UserId':Number(_0x1b1bc9[_0xe9ab('0x5e')]['ids'][_0xb73b71]),'OpenchannelAccountId':Number(_0x1b1bc9['params']['id'])});}return _0x31d0cb;});}})[_0xe9ab('0x21')](respondWithResult(_0xd1f505,null))[_0xe9ab('0x2c')](handleError(_0xd1f505,null));};exports[_0xe9ab('0xb7')]=function(_0x4ec4aa,_0x207cfd,_0x3b83dd){return db[_0xe9ab('0x55')]['find']({'where':{'id':_0x4ec4aa['params']['id']}})[_0xe9ab('0x21')](handleEntityNotFound(_0x207cfd,null))[_0xe9ab('0x21')](function(_0x5531e7){if(_0x5531e7){return _0x5531e7[_0xe9ab('0xb7')](_0x4ec4aa['query']['ids'])['then'](function(){if(_[_0xe9ab('0xb8')](_0x4ec4aa[_0xe9ab('0x43')][_0xe9ab('0x6c')])){for(var _0x192039=0x0;_0x192039<_0x4ec4aa[_0xe9ab('0x43')][_0xe9ab('0x6c')]['length'];_0x192039+=0x1){socket[_0xe9ab('0xb9')](_0xe9ab('0xba'),{'UserId':Number(_0x4ec4aa[_0xe9ab('0x43')][_0xe9ab('0x6c')][_0x192039]),'OpenchannelAccountId':Number(_0x4ec4aa[_0xe9ab('0x59')]['id'])});}}else{socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x4ec4aa['query'][_0xe9ab('0x6c')]),'OpenchannelAccountId':Number(_0x4ec4aa[_0xe9ab('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x207cfd,null))['catch'](handleError(_0x207cfd,null));};exports['getAgents']=function(_0x118a76,_0x20b07b,_0x3d1e87){var _0x5f3d81={};var _0x2bf5a7={};var _0x1b7ac8;var _0x40f9d1;return db[_0xe9ab('0x55')][_0xe9ab('0x6a')]({'where':{'id':_0x118a76[_0xe9ab('0x59')]['id']}})[_0xe9ab('0x21')](handleEntityNotFound(_0x20b07b,null))[_0xe9ab('0x21')](function(_0x9faccf){if(_0x9faccf){_0x1b7ac8=_0x9faccf;_0x2bf5a7[_0xe9ab('0x42')]=_['keys'](db['User'][_0xe9ab('0x40')]);_0x2bf5a7['query']=_[_0xe9ab('0x44')](_0x118a76[_0xe9ab('0x43')]);_0x2bf5a7['filters']=_[_0xe9ab('0x45')](_0x2bf5a7[_0xe9ab('0x42')],_0x2bf5a7[_0xe9ab('0x43')]);_0x5f3d81[_0xe9ab('0x46')]=_[_0xe9ab('0x45')](_0x2bf5a7[_0xe9ab('0x42')],qs[_0xe9ab('0x47')](_0x118a76[_0xe9ab('0x43')]['fields']));_0x5f3d81[_0xe9ab('0x46')]=_0x5f3d81[_0xe9ab('0x46')][_0xe9ab('0x48')]?_0x5f3d81[_0xe9ab('0x46')]:_0x2bf5a7[_0xe9ab('0x42')];_0x5f3d81[_0xe9ab('0x4b')]=qs[_0xe9ab('0x4c')](_0x118a76[_0xe9ab('0x43')]['sort']);_0x5f3d81['where']=qs[_0xe9ab('0x5b')](_[_0xe9ab('0x4e')](_0x118a76[_0xe9ab('0x43')],_0x2bf5a7[_0xe9ab('0x5b')]));if(_0x118a76[_0xe9ab('0x43')]['filter']){_0x5f3d81[_0xe9ab('0x4d')]=_['merge'](_0x5f3d81[_0xe9ab('0x4d')],{'$or':_[_0xe9ab('0x3f')](_0x5f3d81[_0xe9ab('0x46')],function(_0x288618){var _0x432bf7={};_0x432bf7[_0x288618]={'$like':'%'+_0x118a76[_0xe9ab('0x43')][_0xe9ab('0x51')]+'%'};return _0x432bf7;})});}_0x5f3d81=_[_0xe9ab('0x4f')]({},_0x5f3d81,_0x118a76[_0xe9ab('0x52')]);return _0x1b7ac8[_0xe9ab('0xbb')](_0x5f3d81);}})[_0xe9ab('0x21')](function(_0x54e3c5){if(_0x54e3c5){_0x40f9d1=_0x54e3c5['length'];if(!_0x118a76[_0xe9ab('0x43')][_0xe9ab('0x49')](_0xe9ab('0x4a'))){_0x5f3d81[_0xe9ab('0x31')]=qs[_0xe9ab('0x31')](_0x118a76[_0xe9ab('0x43')][_0xe9ab('0x31')]);_0x5f3d81[_0xe9ab('0x2e')]=qs['offset'](_0x118a76[_0xe9ab('0x43')][_0xe9ab('0x2e')]);}return _0x1b7ac8[_0xe9ab('0xbb')](_0x5f3d81);}})['then'](function(_0x16ee27){if(_0x16ee27){return _0x16ee27?{'count':_0x40f9d1,'rows':_0x16ee27}:null;}})[_0xe9ab('0x21')](respondWithResult(_0x20b07b,null))[_0xe9ab('0x2c')](handleError(_0x20b07b,null));};exports[_0xe9ab('0x3d')]=function(_0x2d2666,_0x2e1e96,_0x105bff){var _0x4abdd1,_0x2a6e5a,_0x53f6fb;if(_[_0xe9ab('0x7b')](_0x2d2666[_0xe9ab('0x5e')][_0xe9ab('0x5e')])||_0x2d2666[_0xe9ab('0x5e')]['body']===''){throw new db['Sequelize'][(_0xe9ab('0x75'))](_0xe9ab('0xbc'));}if(_[_0xe9ab('0x7b')](_0x2d2666['body']['to'])){}_0x4abdd1=_0x2d2666[_0xe9ab('0x5e')]['to'];return db[_0xe9ab('0x55')][_0xe9ab('0x6a')]({'where':{'id':_0x2d2666[_0xe9ab('0x59')]['id']}})[_0xe9ab('0x21')](handleEntityNotFound(_0x2e1e96,null))[_0xe9ab('0x21')](function(_0x504630){if(_0x504630){return db[_0xe9ab('0x55')][_0xe9ab('0x5c')]({'where':{'id':_0x504630['id']},'include':[{'model':db[_0xe9ab('0x80')],'as':'List','include':[{'model':db[_0xe9ab('0x73')],'as':_0xe9ab('0x81'),'where':{[_0x504630[_0xe9ab('0x7d')]]:_0x4abdd1},'limit':0x1,'order':[[_0xe9ab('0x78'),_0xe9ab('0xbd')]]}]}]})[_0xe9ab('0x21')](handleEntityNotFound(_0x2e1e96,null))[_0xe9ab('0x21')](function(_0x59bb8e){if(_0x59bb8e&&_0x59bb8e[_0xe9ab('0x83')]){_0x2a6e5a=_0x59bb8e[_0xe9ab('0x3a')]({'plain':!![]});if(_0x2a6e5a[_0xe9ab('0x83')]&&_0x2a6e5a[_0xe9ab('0x83')]['Contacts'][_0xe9ab('0x48')]){return _0x2a6e5a['List'][_0xe9ab('0x81')][0x0];}return db[_0xe9ab('0x73')][_0xe9ab('0x5d')](_[_0xe9ab('0xbe')](_0x2d2666[_0xe9ab('0x5e')],{'firstName':_0x4abdd1,[_0x59bb8e[_0xe9ab('0x7d')]]:_0x4abdd1,'phone':_0x4abdd1,'ListId':_0x2a6e5a[_0xe9ab('0x7a')]}));}})[_0xe9ab('0x21')](handleEntityNotFound(_0x2e1e96,null))[_0xe9ab('0x21')](function(_0x414d34){if(_0x414d34){_0x53f6fb=_0x414d34;return db[_0xe9ab('0x8f')][_0xe9ab('0x5c')]({'where':{'ContactId':_0x53f6fb['id'],'closed':![],'OpenchannelAccountId':_0x2a6e5a['id']}})[_0xe9ab('0x21')](function(_0x19c8af){if(_0x19c8af){return[_0x19c8af,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x2d2666[_0xe9ab('0x5f')]['id'],'ContactId':_0x53f6fb['id'],'OpenchannelAccountId':_0x2a6e5a['id'],'lastMsgDirection':_0xe9ab('0xbf'),'Messages':[_['merge'](_0x2d2666[_0xe9ab('0x5e')],{'read':![],'body':_0x2d2666[_0xe9ab('0x5e')]['body'],'OpenchannelAccountId':_0x2a6e5a['id'],'UserId':_0x2d2666[_0xe9ab('0x5f')]['id'],'ContactId':_0x53f6fb['id']})]},{'include':[{'model':db[_0xe9ab('0x9a')],'as':_0xe9ab('0xc0')}]})[_0xe9ab('0x21')](function(_0x278d01){return[_0x278d01,!![]];});});}})['spread'](function(_0x553143,_0x58f953){if(_0x58f953){return _0x553143;}return db[_0xe9ab('0x9a')]['create'](_[_0xe9ab('0x4f')](_0x2d2666[_0xe9ab('0x5e')],{'read':![],'body':_0x2d2666[_0xe9ab('0x5e')][_0xe9ab('0x5e')],'OpenchannelAccountId':_0x2a6e5a['id'],'OpenchannelInteractionId':_0x553143['id'],'UserId':_0x2d2666[_0xe9ab('0x5f')]['id'],'ContactId':_0x53f6fb['id']}))[_0xe9ab('0x21')](function(_0x345dbb){_0x553143[_0xe9ab('0xc1')][_0xe9ab('0xc0')]=[];_0x553143[_0xe9ab('0xc1')][_0xe9ab('0xc0')]['push'](_0x345dbb[_0xe9ab('0xc1')]);return _0x553143;});});}})[_0xe9ab('0x21')](respondWithResult(_0x2e1e96,null))[_0xe9ab('0x2c')](handleError(_0x2e1e96,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 320d053..cc3b713 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 _0xda55=['update','remove','emit','hook','exports','events','../../mysqldb','save'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xda55,0x6d));var _0x5da5=function(_0x5c38a2,_0x40e4e4){_0x5c38a2=_0x5c38a2-0x0;var _0x22869c=_0xda55[_0x5c38a2];return _0x22869c;};'use strict';var EventEmitter=require(_0x5da5('0x0'));var OpenchannelAccount=require(_0x5da5('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5da5('0x2'),'afterUpdate':_0x5da5('0x3'),'afterDestroy':_0x5da5('0x4')};function emitEvent(_0x50cf9f){return function(_0x1c3afd,_0x5da254,_0x3400e9){OpenchannelAccountEvents['emit'](_0x50cf9f+':'+_0x1c3afd['id'],_0x1c3afd);OpenchannelAccountEvents[_0x5da5('0x5')](_0x50cf9f,_0x1c3afd);_0x3400e9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x5da5('0x6')](e,emitEvent(event));}}module[_0x5da5('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x878f=['hook','exports','../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit'];(function(_0x5206c2,_0x51cdeb){var _0xfbdd17=function(_0x2ef5b1){while(--_0x2ef5b1){_0x5206c2['push'](_0x5206c2['shift']());}};_0xfbdd17(++_0x51cdeb);}(_0x878f,0x173));var _0xf878=function(_0x371863,_0x5250c1){_0x371863=_0x371863-0x0;var _0xe85b3e=_0x878f[_0x371863];return _0xe85b3e;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xf878('0x0'))['db'][_0xf878('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xf878('0x2')](0x0);var events={'afterCreate':_0xf878('0x3'),'afterUpdate':_0xf878('0x4'),'afterDestroy':_0xf878('0x5')};function emitEvent(_0x9e6783){return function(_0x45a37b,_0x240b48,_0xcf1927){OpenchannelAccountEvents[_0xf878('0x6')](_0x9e6783+':'+_0x45a37b['id'],_0x45a37b);OpenchannelAccountEvents['emit'](_0x9e6783,_0x45a37b);_0xcf1927(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xf878('0x7')](e,emitEvent(event));}}module[_0xf878('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index e099542..d427650 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(_0x482a70,_0x3d475e){var _0x49e568=function(_0x4e47be){while(--_0x4e47be){_0x482a70['push'](_0x482a70['shift']());}};_0x49e568(++_0x3d475e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x46b928,_0x2b50c2){var _0x45a45b=function(_0x3e51c9){while(--_0x3e51c9){_0x46b928['push'](_0x46b928['shift']());}};_0x45a45b(++_0x2b50c2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 48d33cd..d7d700a 100644 --- a/server/api/openchannelAccount/openchannelAccount.rpc.js +++ b/server/api/openchannelAccount/openchannelAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b32=['http','redis','defaults','localhost','register','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4c2417,_0x465c1e){var _0x4a935d=function(_0x4237b6){while(--_0x4237b6){_0x4c2417['push'](_0x4c2417['shift']());}};_0x4a935d(++_0x465c1e);}(_0x1b32,0x85));var _0x21b3=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0x1b32[_0x1a7846];return _0x48049;};'use strict';var _=require('lodash');var util=require(_0x21b3('0x0'));var moment=require(_0x21b3('0x1'));var BPromise=require(_0x21b3('0x2'));var rs=require(_0x21b3('0x3'));var fs=require('fs');var Redis=require(_0x21b3('0x4'));var db=require(_0x21b3('0x5'))['db'];var utils=require(_0x21b3('0x6'));var logger=require(_0x21b3('0x7'))(_0x21b3('0x8'));var config=require(_0x21b3('0x9'));var jayson=require(_0x21b3('0xa'));var client=jayson[_0x21b3('0xb')][_0x21b3('0xc')]({'port':0x232a});config[_0x21b3('0xd')]=_[_0x21b3('0xe')](config['redis'],{'host':_0x21b3('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelAccount.socket')[_0x21b3('0x10')](socket);function respondWithRpcPromise(_0x36b2a1,_0x56009d,_0x4aa0d7){return new BPromise(function(_0x253f2b,_0x270969){return client[_0x21b3('0x11')](_0x36b2a1,_0x4aa0d7)['then'](function(_0x370338){logger[_0x21b3('0x12')](_0x21b3('0x13'),_0x56009d,_0x21b3('0x14'));logger[_0x21b3('0x15')](_0x21b3('0x16'),_0x56009d,_0x21b3('0x14'),JSON[_0x21b3('0x17')](_0x370338));if(_0x370338[_0x21b3('0x18')]){if(_0x370338['error'][_0x21b3('0x19')]===0x1f4){logger[_0x21b3('0x18')](_0x21b3('0x13'),_0x56009d,_0x370338['error'][_0x21b3('0x1a')]);return _0x270969(_0x370338['error'][_0x21b3('0x1a')]);}logger['error'](_0x21b3('0x13'),_0x56009d,_0x370338[_0x21b3('0x18')][_0x21b3('0x1a')]);return _0x253f2b(_0x370338[_0x21b3('0x18')]['message']);}else{logger[_0x21b3('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x56009d,_0x21b3('0x14'));_0x253f2b(_0x370338[_0x21b3('0x1b')][_0x21b3('0x1a')]);}})[_0x21b3('0x1c')](function(_0x513c32){logger[_0x21b3('0x18')](_0x21b3('0x13'),_0x56009d,_0x513c32);_0x270969(_0x513c32);});});} \ No newline at end of file +var _0x878f=['message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x2e53aa,_0x5cfc99){var _0x2fb4ee=function(_0x1f75f1){while(--_0x1f75f1){_0x2e53aa['push'](_0x2e53aa['shift']());}};_0x2fb4ee(++_0x5cfc99);}(_0x878f,0x173));var _0xf878=function(_0x3168e2,_0x4f8013){_0x3168e2=_0x3168e2-0x0;var _0x44d0fc=_0x878f[_0x3168e2];return _0x44d0fc;};'use strict';var _=require('lodash');var util=require(_0xf878('0x0'));var moment=require(_0xf878('0x1'));var BPromise=require(_0xf878('0x2'));var rs=require(_0xf878('0x3'));var fs=require('fs');var Redis=require(_0xf878('0x4'));var db=require(_0xf878('0x5'))['db'];var utils=require(_0xf878('0x6'));var logger=require(_0xf878('0x7'))(_0xf878('0x8'));var config=require(_0xf878('0x9'));var jayson=require(_0xf878('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0xf878('0xb')]=_[_0xf878('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf878('0xb')]));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x307653,_0x2e6931,_0x223504){return new BPromise(function(_0x52edde,_0xb2863e){return client[_0xf878('0xd')](_0x307653,_0x223504)['then'](function(_0xdf76){logger['info'](_0xf878('0xe'),_0x2e6931,_0xf878('0xf'));logger[_0xf878('0x10')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x2e6931,_0xf878('0xf'),JSON[_0xf878('0x11')](_0xdf76));if(_0xdf76[_0xf878('0x12')]){if(_0xdf76['error'][_0xf878('0x13')]===0x1f4){logger[_0xf878('0x12')](_0xf878('0xe'),_0x2e6931,_0xdf76['error']['message']);return _0xb2863e(_0xdf76[_0xf878('0x12')][_0xf878('0x14')]);}logger[_0xf878('0x12')](_0xf878('0xe'),_0x2e6931,_0xdf76[_0xf878('0x12')][_0xf878('0x14')]);return _0x52edde(_0xdf76[_0xf878('0x12')][_0xf878('0x14')]);}else{logger[_0xf878('0x15')](_0xf878('0xe'),_0x2e6931,_0xf878('0xf'));_0x52edde(_0xdf76['result'][_0xf878('0x14')]);}})[_0xf878('0x16')](function(_0x412de1){logger[_0xf878('0x12')](_0xf878('0xe'),_0x2e6931,_0x412de1);_0xb2863e(_0x412de1);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 8e84e8c..e12e76c 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 _0x928c=['emit','register','openchannelAccount:','remove','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x928c,0x17f));var _0xc928=function(_0x5b10d9,_0x41ad7c){_0x5b10d9=_0x5b10d9-0x0;var _0x14d33d=_0x928c[_0x5b10d9];return _0x14d33d;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0xc928('0x0'),_0xc928('0x1')];function createListener(_0x597d43,_0x24354b){return function(_0x29bd30){_0x24354b[_0xc928('0x2')](_0x597d43,_0x29bd30);};}function removeListener(_0x3e4e60,_0x1dd54b){return function(){OpenchannelAccountEvents['removeListener'](_0x3e4e60,_0x1dd54b);};}exports[_0xc928('0x3')]=function(_0x4704bc){for(var _0x8c0fa5=0x0,_0x4ff9e6=events['length'];_0x8c0fa5<_0x4ff9e6;_0x8c0fa5++){var _0x5e433b=events[_0x8c0fa5];var _0x445248=createListener(_0xc928('0x4')+_0x5e433b,_0x4704bc);OpenchannelAccountEvents['on'](_0x5e433b,_0x445248);}}; \ No newline at end of file +var _0x1b73=['openchannelAccount:','save','remove','update','register','length'];(function(_0xb8f835,_0x561feb){var _0xe22ad5=function(_0x44feb1){while(--_0x44feb1){_0xb8f835['push'](_0xb8f835['shift']());}};_0xe22ad5(++_0x561feb);}(_0x1b73,0x1d5));var _0x31b7=function(_0x7f43cd,_0x582812){_0x7f43cd=_0x7f43cd-0x0;var _0x3efc93=_0x1b73[_0x7f43cd];return _0x3efc93;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x31b7('0x0'),_0x31b7('0x1'),_0x31b7('0x2')];function createListener(_0x5c767e,_0x4bf5ae){return function(_0x17c0ef){_0x4bf5ae['emit'](_0x5c767e,_0x17c0ef);};}function removeListener(_0x40fef2,_0x3682cc){return function(){OpenchannelAccountEvents['removeListener'](_0x40fef2,_0x3682cc);};}exports[_0x31b7('0x3')]=function(_0x3d058f){for(var _0x15c31e=0x0,_0x502838=events[_0x31b7('0x4')];_0x15c31e<_0x502838;_0x15c31e++){var _0x1a730f=events[_0x15c31e];var _0x86ef8e=createListener(_0x31b7('0x5')+_0x1a730f,_0x3d058f);OpenchannelAccountEvents['on'](_0x1a730f,_0x86ef8e);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index fa658c7..0f97f69 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 _0x449f=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x39375e,_0x4c171b){var _0x3ff062=function(_0x3a8a7f){while(--_0x3a8a7f){_0x39375e['push'](_0x39375e['shift']());}};_0x3ff062(++_0x4c171b);}(_0x449f,0x7e));var _0xf449=function(_0xae282f,_0x2d9368){_0xae282f=_0xae282f-0x0;var _0x5f46d4=_0x449f[_0xae282f];return _0x5f46d4;};'use strict';var multer=require(_0xf449('0x0'));var util=require(_0xf449('0x1'));var path=require(_0xf449('0x2'));var timeout=require('connect-timeout');var express=require(_0xf449('0x3'));var router=express[_0xf449('0x4')]();var fs_extra=require(_0xf449('0x5'));var auth=require(_0xf449('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf449('0x7'));var controller=require(_0xf449('0x8'));router['get']('/',auth[_0xf449('0x9')](),controller[_0xf449('0xa')]);router[_0xf449('0xb')](_0xf449('0xc'),auth['isAuthenticated'](),controller[_0xf449('0xd')]);router[_0xf449('0xe')]('/',auth[_0xf449('0x9')](),controller[_0xf449('0xf')]);router[_0xf449('0x10')](_0xf449('0xc'),auth[_0xf449('0x9')](),controller[_0xf449('0x11')]);router[_0xf449('0x12')](_0xf449('0xc'),auth[_0xf449('0x9')](),controller[_0xf449('0x13')]);module[_0xf449('0x14')]=router; \ No newline at end of file +var _0x11f6=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','util','path'];(function(_0x292a66,_0x2e1662){var _0xb854fe=function(_0x292b22){while(--_0x292b22){_0x292a66['push'](_0x292a66['shift']());}};_0xb854fe(++_0x2e1662);}(_0x11f6,0xa0));var _0x611f=function(_0x1e89c1,_0x3ef6e1){_0x1e89c1=_0x1e89c1-0x0;var _0xffbc2=_0x11f6[_0x1e89c1];return _0xffbc2;};'use strict';var multer=require('multer');var util=require(_0x611f('0x0'));var path=require(_0x611f('0x1'));var timeout=require(_0x611f('0x2'));var express=require(_0x611f('0x3'));var router=express[_0x611f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x611f('0x5'));var interaction=require(_0x611f('0x6'));var config=require('../../config/environment');var controller=require('./openchannelApplication.controller');router[_0x611f('0x7')]('/',auth[_0x611f('0x8')](),controller[_0x611f('0x9')]);router['get'](_0x611f('0xa'),auth['isAuthenticated'](),controller[_0x611f('0xb')]);router[_0x611f('0xc')]('/',auth[_0x611f('0x8')](),controller[_0x611f('0xd')]);router[_0x611f('0xe')](_0x611f('0xa'),auth[_0x611f('0x8')](),controller[_0x611f('0xf')]);router[_0x611f('0x10')]('/:id',auth[_0x611f('0x8')](),controller[_0x611f('0x11')]);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 ab27286..8b89f0d 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 _0x9f6e=['STRING','noop','TEXT'];(function(_0xb2e3bd,_0x1703c8){var _0x306c02=function(_0x3c00cc){while(--_0x3c00cc){_0xb2e3bd['push'](_0xb2e3bd['shift']());}};_0x306c02(++_0x1703c8);}(_0x9f6e,0x1d4));var _0xe9f6=function(_0x1d52bf,_0x4de8dc){_0x1d52bf=_0x1d52bf-0x0;var _0x229c5e=_0x9f6e[_0x1d52bf];return _0x229c5e;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xe9f6('0x0')],'allowNull':![],'defaultValue':_0xe9f6('0x1')},'appdata':{'type':Sequelize[_0xe9f6('0x2')]()},'description':{'type':Sequelize[_0xe9f6('0x0')]},'interval':{'type':Sequelize[_0xe9f6('0x0')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xfeb0=['*,*,*,*','INTEGER','STRING','noop','TEXT'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xfeb0,0x1e1));var _0x0feb=function(_0x15ad3f,_0x1d6280){_0x15ad3f=_0x15ad3f-0x0;var _0xfb1d10=_0xfeb0[_0x15ad3f];return _0xfb1d10;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x0feb('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x0feb('0x1')],'allowNull':![],'defaultValue':_0x0feb('0x2')},'appdata':{'type':Sequelize[_0x0feb('0x3')]()},'description':{'type':Sequelize[_0x0feb('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x0feb('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 42e0339..299ee63 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 _0x7c9e=['intersection','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../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','destroy','then','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','key','model','query','keys','filters','attributes'];(function(_0xa18665,_0x5d6110){var _0x521a06=function(_0xfc6c56){while(--_0xfc6c56){_0xa18665['push'](_0xa18665['shift']());}};_0x521a06(++_0x5d6110);}(_0x7c9e,0x12b));var _0xe7c9=function(_0x54d3c4,_0x4c172b){_0x54d3c4=_0x54d3c4-0x0;var _0x33d16c=_0x7c9e[_0x54d3c4];return _0x33d16c;};'use strict';var emlformat=require(_0xe7c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe7c9('0x1'));var jsonpatch=require(_0xe7c9('0x2'));var rp=require('request-promise');var moment=require(_0xe7c9('0x3'));var BPromise=require(_0xe7c9('0x4'));var Mustache=require(_0xe7c9('0x5'));var util=require('util');var path=require(_0xe7c9('0x6'));var sox=require(_0xe7c9('0x7'));var csv=require(_0xe7c9('0x8'));var ejs=require(_0xe7c9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe7c9('0xa'));var squel=require('squel');var crypto=require(_0xe7c9('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe7c9('0x8'));var querystring=require('querystring');var Papa=require(_0xe7c9('0xc'));var Redis=require(_0xe7c9('0xd'));var authService=require(_0xe7c9('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe7c9('0xf'));var logger=require(_0xe7c9('0x10'))(_0xe7c9('0x11'));var utils=require(_0xe7c9('0x12'));var config=require(_0xe7c9('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xe7c9('0x14'))['db'];function respondWithStatusCode(_0x585675,_0x56032f){_0x56032f=_0x56032f||0xcc;return function(_0x385901){if(_0x385901){return _0x585675[_0xe7c9('0x15')](_0x56032f);}return _0x585675[_0xe7c9('0x16')](_0x56032f)[_0xe7c9('0x17')]();};}function respondWithResult(_0x50ea03,_0x30b4a6){_0x30b4a6=_0x30b4a6||0xc8;return function(_0x40428f){if(_0x40428f){return _0x50ea03['status'](_0x30b4a6)['json'](_0x40428f);}};}function respondWithFilteredResult(_0x323d36,_0x16e992){return function(_0x396c53){if(_0x396c53){var _0x58bdd9=typeof _0x16e992[_0xe7c9('0x18')]===_0xe7c9('0x19')&&typeof _0x16e992[_0xe7c9('0x1a')]===_0xe7c9('0x19');var _0x4ed399=_0x396c53[_0xe7c9('0x1b')];var _0x45d2b0=_0x58bdd9?0x0:_0x16e992['offset'];var _0x4b4c41=_0x58bdd9?_0x396c53[_0xe7c9('0x1b')]:_0x16e992[_0xe7c9('0x18')]+_0x16e992[_0xe7c9('0x1a')];var _0x196731;if(_0x4b4c41>=_0x4ed399){_0x4b4c41=_0x4ed399;_0x196731=0xc8;}else{_0x196731=0xce;}_0x323d36[_0xe7c9('0x16')](_0x196731);return _0x323d36[_0xe7c9('0x1c')](_0xe7c9('0x1d'),_0x45d2b0+'-'+_0x4b4c41+'/'+_0x4ed399)[_0xe7c9('0x1e')](_0x396c53);}return null;};}function patchUpdates(_0x2e2f3c){return function(_0x5aa0d9){try{jsonpatch[_0xe7c9('0x1f')](_0x5aa0d9,_0x2e2f3c,!![]);}catch(_0x1ab0d7){return BPromise[_0xe7c9('0x20')](_0x1ab0d7);}return _0x5aa0d9[_0xe7c9('0x21')]();};}function saveUpdates(_0x322b7b,_0x266ec3){return function(_0x3d1157){if(_0x3d1157){return _0x3d1157[_0xe7c9('0x22')](_0x322b7b)['then'](function(_0x653d5){return _0x653d5;});}return null;};}function removeEntity(_0x12b1d8,_0x3b35a7){return function(_0x33b9e6){if(_0x33b9e6){return _0x33b9e6[_0xe7c9('0x23')]()[_0xe7c9('0x24')](function(){_0x12b1d8[_0xe7c9('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e2e04,_0x4ed7a0){return function(_0x3d59eb){if(!_0x3d59eb){_0x1e2e04['sendStatus'](0x194);}return _0x3d59eb;};}function handleError(_0x5a9e61,_0x22d639){_0x22d639=_0x22d639||0x1f4;return function(_0x5c0981){logger[_0xe7c9('0x25')](_0x5c0981[_0xe7c9('0x26')]);if(_0x5c0981[_0xe7c9('0x27')]){delete _0x5c0981['name'];}_0x5a9e61[_0xe7c9('0x16')](_0x22d639)[_0xe7c9('0x28')](_0x5c0981);};}exports[_0xe7c9('0x29')]=function(_0x566738,_0x4a6416){var _0x143c96={},_0x5c93d7={},_0x15ccf7={'count':0x0,'rows':[]};var _0x4adf0b=_[_0xe7c9('0x2a')](db[_0xe7c9('0x2b')][_0xe7c9('0x2c')],function(_0xc839c3){return{'name':_0xc839c3['fieldName'],'type':_0xc839c3['type'][_0xe7c9('0x2d')]};});_0x5c93d7[_0xe7c9('0x2e')]=_[_0xe7c9('0x2a')](_0x4adf0b,'name');_0x5c93d7[_0xe7c9('0x2f')]=_[_0xe7c9('0x30')](_0x566738[_0xe7c9('0x2f')]);_0x5c93d7[_0xe7c9('0x31')]=_['intersection'](_0x5c93d7['model'],_0x5c93d7[_0xe7c9('0x2f')]);_0x143c96[_0xe7c9('0x32')]=_[_0xe7c9('0x33')](_0x5c93d7['model'],qs['fields'](_0x566738[_0xe7c9('0x2f')][_0xe7c9('0x34')]));_0x143c96[_0xe7c9('0x32')]=_0x143c96[_0xe7c9('0x32')][_0xe7c9('0x35')]?_0x143c96[_0xe7c9('0x32')]:_0x5c93d7[_0xe7c9('0x2e')];if(!_0x566738['query'][_0xe7c9('0x36')]('nolimit')){_0x143c96[_0xe7c9('0x1a')]=qs[_0xe7c9('0x1a')](_0x566738[_0xe7c9('0x2f')][_0xe7c9('0x1a')]);_0x143c96['offset']=qs[_0xe7c9('0x18')](_0x566738[_0xe7c9('0x2f')][_0xe7c9('0x18')]);}_0x143c96[_0xe7c9('0x37')]=qs[_0xe7c9('0x38')](_0x566738[_0xe7c9('0x2f')][_0xe7c9('0x38')]);_0x143c96[_0xe7c9('0x39')]=qs[_0xe7c9('0x31')](_['pick'](_0x566738[_0xe7c9('0x2f')],_0x5c93d7[_0xe7c9('0x31')]),_0x4adf0b);if(_0x566738[_0xe7c9('0x2f')]['filter']){_0x143c96[_0xe7c9('0x39')]=_[_0xe7c9('0x3a')](_0x143c96[_0xe7c9('0x39')],{'$or':_[_0xe7c9('0x2a')](_0x4adf0b,function(_0x8a07e8){if(_0x8a07e8['type']!==_0xe7c9('0x3b')){var _0x5baf5e={};_0x5baf5e[_0x8a07e8['name']]={'$like':'%'+_0x566738['query']['filter']+'%'};return _0x5baf5e;}})});}_0x143c96=_[_0xe7c9('0x3a')]({},_0x143c96,_0x566738[_0xe7c9('0x3c')]);var _0x3e3f36={'where':_0x143c96[_0xe7c9('0x39')]};return db[_0xe7c9('0x2b')][_0xe7c9('0x1b')](_0x3e3f36)['then'](function(_0x521640){_0x15ccf7['count']=_0x521640;if(_0x566738['query'][_0xe7c9('0x3d')]){_0x143c96[_0xe7c9('0x3e')]=[{'all':!![]}];}return db[_0xe7c9('0x2b')][_0xe7c9('0x3f')](_0x143c96);})[_0xe7c9('0x24')](function(_0x171a40){_0x15ccf7[_0xe7c9('0x40')]=_0x171a40;return _0x15ccf7;})[_0xe7c9('0x24')](respondWithFilteredResult(_0x4a6416,_0x143c96))[_0xe7c9('0x41')](handleError(_0x4a6416,null));};exports['show']=function(_0x4b11c9,_0x50d10d){var _0x180502={'raw':!![],'where':{'id':_0x4b11c9[_0xe7c9('0x42')]['id']}},_0x13ee70={};_0x13ee70[_0xe7c9('0x2e')]=_['keys'](db[_0xe7c9('0x2b')]['rawAttributes']);_0x13ee70[_0xe7c9('0x2f')]=_[_0xe7c9('0x30')](_0x4b11c9[_0xe7c9('0x2f')]);_0x13ee70['filters']=_[_0xe7c9('0x33')](_0x13ee70[_0xe7c9('0x2e')],_0x13ee70[_0xe7c9('0x2f')]);_0x180502[_0xe7c9('0x32')]=_[_0xe7c9('0x33')](_0x13ee70['model'],qs[_0xe7c9('0x34')](_0x4b11c9['query']['fields']));_0x180502[_0xe7c9('0x32')]=_0x180502[_0xe7c9('0x32')][_0xe7c9('0x35')]?_0x180502[_0xe7c9('0x32')]:_0x13ee70[_0xe7c9('0x2e')];if(_0x4b11c9['query'][_0xe7c9('0x3d')]){_0x180502['include']=[{'all':!![]}];}_0x180502=_[_0xe7c9('0x3a')]({},_0x180502,_0x4b11c9[_0xe7c9('0x3c')]);return db['OpenchannelApplication'][_0xe7c9('0x43')](_0x180502)['then'](handleEntityNotFound(_0x50d10d,null))[_0xe7c9('0x24')](respondWithResult(_0x50d10d,null))[_0xe7c9('0x41')](handleError(_0x50d10d,null));};exports[_0xe7c9('0x44')]=function(_0x52e4f8,_0x30d529){return db[_0xe7c9('0x2b')]['create'](_0x52e4f8[_0xe7c9('0x45')],{})[_0xe7c9('0x24')](respondWithResult(_0x30d529,0xc9))[_0xe7c9('0x41')](handleError(_0x30d529,null));};exports[_0xe7c9('0x22')]=function(_0x3a793a,_0x4f73aa){if(_0x3a793a[_0xe7c9('0x45')]['id']){delete _0x3a793a[_0xe7c9('0x45')]['id'];}return db[_0xe7c9('0x2b')][_0xe7c9('0x43')]({'where':{'id':_0x3a793a[_0xe7c9('0x42')]['id']}})[_0xe7c9('0x24')](handleEntityNotFound(_0x4f73aa,null))[_0xe7c9('0x24')](saveUpdates(_0x3a793a[_0xe7c9('0x45')],null))['then'](respondWithResult(_0x4f73aa,null))[_0xe7c9('0x41')](handleError(_0x4f73aa,null));};exports[_0xe7c9('0x23')]=function(_0x56204a,_0x2065f1){return db['OpenchannelApplication']['find']({'where':{'id':_0x56204a['params']['id']}})['then'](handleEntityNotFound(_0x2065f1,null))[_0xe7c9('0x24')](removeEntity(_0x2065f1,null))[_0xe7c9('0x41')](handleError(_0x2065f1,null));}; \ No newline at end of file +var _0x14e3=['OpenchannelApplication','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map'];(function(_0x21090b,_0x39dd3b){var _0x3c68d7=function(_0x28ecd4){while(--_0x28ecd4){_0x21090b['push'](_0x21090b['shift']());}};_0x3c68d7(++_0x39dd3b);}(_0x14e3,0x68));var _0x314e=function(_0x49d668,_0x42bce1){_0x49d668=_0x49d668-0x0;var _0x28707a=_0x14e3[_0x49d668];return _0x28707a;};'use strict';var emlformat=require(_0x314e('0x0'));var rimraf=require(_0x314e('0x1'));var zipdir=require(_0x314e('0x2'));var jsonpatch=require(_0x314e('0x3'));var rp=require(_0x314e('0x4'));var moment=require(_0x314e('0x5'));var BPromise=require(_0x314e('0x6'));var Mustache=require(_0x314e('0x7'));var util=require(_0x314e('0x8'));var path=require(_0x314e('0x9'));var sox=require(_0x314e('0xa'));var csv=require(_0x314e('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x314e('0xc'));var _=require(_0x314e('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x314e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x314e('0xb'));var querystring=require(_0x314e('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x314e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x314e('0x11'));var hardwareService=require(_0x314e('0x12'));var logger=require(_0x314e('0x13'))(_0x314e('0x14'));var utils=require(_0x314e('0x15'));var config=require(_0x314e('0x16'));var licenseUtil=require(_0x314e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x416ff2,_0x12e842){_0x12e842=_0x12e842||0xcc;return function(_0x2b45be){if(_0x2b45be){return _0x416ff2[_0x314e('0x18')](_0x12e842);}return _0x416ff2[_0x314e('0x19')](_0x12e842)[_0x314e('0x1a')]();};}function respondWithResult(_0x236a48,_0xbd686f){_0xbd686f=_0xbd686f||0xc8;return function(_0x19bcde){if(_0x19bcde){return _0x236a48[_0x314e('0x19')](_0xbd686f)[_0x314e('0x1b')](_0x19bcde);}};}function respondWithFilteredResult(_0x3591b1,_0x240f98){return function(_0x39a4ee){if(_0x39a4ee){var _0xe2083b=typeof _0x240f98[_0x314e('0x1c')]===_0x314e('0x1d')&&typeof _0x240f98[_0x314e('0x1e')]===_0x314e('0x1d');var _0x2470dc=_0x39a4ee[_0x314e('0x1f')];var _0x4e8144=_0xe2083b?0x0:_0x240f98[_0x314e('0x1c')];var _0x41043c=_0xe2083b?_0x39a4ee[_0x314e('0x1f')]:_0x240f98[_0x314e('0x1c')]+_0x240f98[_0x314e('0x1e')];var _0x155a99;if(_0x41043c>=_0x2470dc){_0x41043c=_0x2470dc;_0x155a99=0xc8;}else{_0x155a99=0xce;}_0x3591b1['status'](_0x155a99);return _0x3591b1[_0x314e('0x20')](_0x314e('0x21'),_0x4e8144+'-'+_0x41043c+'/'+_0x2470dc)[_0x314e('0x1b')](_0x39a4ee);}return null;};}function patchUpdates(_0x11cd94){return function(_0x283589){try{jsonpatch[_0x314e('0x22')](_0x283589,_0x11cd94,!![]);}catch(_0x2c817e){return BPromise[_0x314e('0x23')](_0x2c817e);}return _0x283589[_0x314e('0x24')]();};}function saveUpdates(_0x517f2e,_0xb60dc9){return function(_0x563fa4){if(_0x563fa4){return _0x563fa4[_0x314e('0x25')](_0x517f2e)[_0x314e('0x26')](function(_0x56cd94){return _0x56cd94;});}return null;};}function removeEntity(_0x306e58,_0x5ee61c){return function(_0x2d725b){if(_0x2d725b){return _0x2d725b[_0x314e('0x27')]()[_0x314e('0x26')](function(){_0x306e58[_0x314e('0x19')](0xcc)[_0x314e('0x1a')]();});}};}function handleEntityNotFound(_0x3c7286,_0x4aaccc){return function(_0x27ed7e){if(!_0x27ed7e){_0x3c7286[_0x314e('0x18')](0x194);}return _0x27ed7e;};}function handleError(_0x372b1d,_0x46bf29){_0x46bf29=_0x46bf29||0x1f4;return function(_0x4fcf46){logger['error'](_0x4fcf46[_0x314e('0x28')]);if(_0x4fcf46[_0x314e('0x29')]){delete _0x4fcf46['name'];}_0x372b1d[_0x314e('0x19')](_0x46bf29)[_0x314e('0x2a')](_0x4fcf46);};}exports['index']=function(_0x3b5762,_0x1b3519){var _0x5688c6={},_0x447ffa={},_0x50af37={'count':0x0,'rows':[]};var _0x2ddb14=_[_0x314e('0x2b')](db[_0x314e('0x2c')][_0x314e('0x2d')],function(_0x508f95){return{'name':_0x508f95[_0x314e('0x2e')],'type':_0x508f95['type'][_0x314e('0x2f')]};});_0x447ffa['model']=_['map'](_0x2ddb14,'name');_0x447ffa['query']=_['keys'](_0x3b5762[_0x314e('0x30')]);_0x447ffa[_0x314e('0x31')]=_[_0x314e('0x32')](_0x447ffa[_0x314e('0x33')],_0x447ffa['query']);_0x5688c6[_0x314e('0x34')]=_[_0x314e('0x32')](_0x447ffa[_0x314e('0x33')],qs[_0x314e('0x35')](_0x3b5762['query'][_0x314e('0x35')]));_0x5688c6['attributes']=_0x5688c6[_0x314e('0x34')][_0x314e('0x36')]?_0x5688c6[_0x314e('0x34')]:_0x447ffa['model'];if(!_0x3b5762[_0x314e('0x30')][_0x314e('0x37')]('nolimit')){_0x5688c6[_0x314e('0x1e')]=qs[_0x314e('0x1e')](_0x3b5762[_0x314e('0x30')][_0x314e('0x1e')]);_0x5688c6[_0x314e('0x1c')]=qs[_0x314e('0x1c')](_0x3b5762[_0x314e('0x30')][_0x314e('0x1c')]);}_0x5688c6[_0x314e('0x38')]=qs[_0x314e('0x39')](_0x3b5762['query'][_0x314e('0x39')]);_0x5688c6[_0x314e('0x3a')]=qs[_0x314e('0x31')](_[_0x314e('0x3b')](_0x3b5762[_0x314e('0x30')],_0x447ffa['filters']),_0x2ddb14);if(_0x3b5762[_0x314e('0x30')][_0x314e('0x3c')]){_0x5688c6[_0x314e('0x3a')]=_['merge'](_0x5688c6[_0x314e('0x3a')],{'$or':_[_0x314e('0x2b')](_0x2ddb14,function(_0x331e32){if(_0x331e32[_0x314e('0x3d')]!==_0x314e('0x3e')){var _0x45c766={};_0x45c766[_0x331e32[_0x314e('0x29')]]={'$like':'%'+_0x3b5762['query']['filter']+'%'};return _0x45c766;}})});}_0x5688c6=_[_0x314e('0x3f')]({},_0x5688c6,_0x3b5762[_0x314e('0x40')]);var _0x2b74bb={'where':_0x5688c6[_0x314e('0x3a')]};return db[_0x314e('0x2c')][_0x314e('0x1f')](_0x2b74bb)[_0x314e('0x26')](function(_0xa5b4a3){_0x50af37[_0x314e('0x1f')]=_0xa5b4a3;if(_0x3b5762[_0x314e('0x30')][_0x314e('0x41')]){_0x5688c6['include']=[{'all':!![]}];}return db[_0x314e('0x2c')]['findAll'](_0x5688c6);})[_0x314e('0x26')](function(_0x57f9a8){_0x50af37[_0x314e('0x42')]=_0x57f9a8;return _0x50af37;})[_0x314e('0x26')](respondWithFilteredResult(_0x1b3519,_0x5688c6))[_0x314e('0x43')](handleError(_0x1b3519,null));};exports[_0x314e('0x44')]=function(_0x548190,_0xe42e13){var _0x254152={'raw':!![],'where':{'id':_0x548190[_0x314e('0x45')]['id']}},_0x38072c={};_0x38072c[_0x314e('0x33')]=_[_0x314e('0x46')](db[_0x314e('0x2c')][_0x314e('0x2d')]);_0x38072c[_0x314e('0x30')]=_['keys'](_0x548190[_0x314e('0x30')]);_0x38072c['filters']=_[_0x314e('0x32')](_0x38072c[_0x314e('0x33')],_0x38072c['query']);_0x254152[_0x314e('0x34')]=_[_0x314e('0x32')](_0x38072c[_0x314e('0x33')],qs[_0x314e('0x35')](_0x548190[_0x314e('0x30')]['fields']));_0x254152[_0x314e('0x34')]=_0x254152[_0x314e('0x34')][_0x314e('0x36')]?_0x254152[_0x314e('0x34')]:_0x38072c[_0x314e('0x33')];if(_0x548190['query'][_0x314e('0x41')]){_0x254152['include']=[{'all':!![]}];}_0x254152=_[_0x314e('0x3f')]({},_0x254152,_0x548190[_0x314e('0x40')]);return db[_0x314e('0x2c')][_0x314e('0x47')](_0x254152)[_0x314e('0x26')](handleEntityNotFound(_0xe42e13,null))[_0x314e('0x26')](respondWithResult(_0xe42e13,null))[_0x314e('0x43')](handleError(_0xe42e13,null));};exports['create']=function(_0x1790da,_0x34b71c){return db[_0x314e('0x2c')][_0x314e('0x48')](_0x1790da['body'],{})['then'](respondWithResult(_0x34b71c,0xc9))['catch'](handleError(_0x34b71c,null));};exports[_0x314e('0x25')]=function(_0x2dfbc1,_0x1f0cdd){if(_0x2dfbc1['body']['id']){delete _0x2dfbc1[_0x314e('0x49')]['id'];}return db[_0x314e('0x2c')][_0x314e('0x47')]({'where':{'id':_0x2dfbc1[_0x314e('0x45')]['id']}})['then'](handleEntityNotFound(_0x1f0cdd,null))[_0x314e('0x26')](saveUpdates(_0x2dfbc1[_0x314e('0x49')],null))[_0x314e('0x26')](respondWithResult(_0x1f0cdd,null))[_0x314e('0x43')](handleError(_0x1f0cdd,null));};exports[_0x314e('0x27')]=function(_0x876b07,_0x1c71b2){return db[_0x314e('0x2c')]['find']({'where':{'id':_0x876b07[_0x314e('0x45')]['id']}})[_0x314e('0x26')](handleEntityNotFound(_0x1c71b2,null))[_0x314e('0x26')](removeEntity(_0x1c71b2,null))[_0x314e('0x43')](handleError(_0x1c71b2,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 0ecee37..a284e9e 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 _0x57a1=['rimraf','../../config/environment','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path'];(function(_0x20554f,_0x249e0f){var _0x1f36b3=function(_0x2fcb98){while(--_0x2fcb98){_0x20554f['push'](_0x20554f['shift']());}};_0x1f36b3(++_0x249e0f);}(_0x57a1,0x1c1));var _0x157a=function(_0x12f59c,_0x13d956){_0x12f59c=_0x12f59c-0x0;var _0x2db43e=_0x57a1[_0x12f59c];return _0x2db43e;};'use strict';var _=require(_0x157a('0x0'));var util=require(_0x157a('0x1'));var logger=require('../../config/logger')(_0x157a('0x2'));var moment=require(_0x157a('0x3'));var BPromise=require('bluebird');var rp=require(_0x157a('0x4'));var fs=require('fs');var path=require(_0x157a('0x5'));var rimraf=require(_0x157a('0x6'));var config=require(_0x157a('0x7'));var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x2e9d67,_0x1554b6){return _0x2e9d67[_0x157a('0x8')](_0x157a('0x9'),attributes,{'tableName':_0x157a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x157a('0xb'),'collate':_0x157a('0xc')});}; \ No newline at end of file +var _0xfbed=['exports','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xfbed,0x1a5));var _0xdfbe=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xfbed[_0x51020b];return _0x371e47;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdfbe('0x0'))('api');var moment=require(_0xdfbe('0x1'));var BPromise=require(_0xdfbe('0x2'));var rp=require(_0xdfbe('0x3'));var fs=require('fs');var path=require(_0xdfbe('0x4'));var rimraf=require(_0xdfbe('0x5'));var config=require(_0xdfbe('0x6'));var attributes=require(_0xdfbe('0x7'));module[_0xdfbe('0x8')]=function(_0x340e59,_0x56078d){return _0x340e59[_0xdfbe('0x9')]('OpenchannelApplication',attributes,{'tableName':_0xdfbe('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdfbe('0xb'),'collate':_0xdfbe('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 7798f92..e6ad717 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 _0xe407=['options','raw','where','attributes','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','UpdateOpenchannelApplication','OpenchannelApplication','body'];(function(_0x3fbb81,_0x2529c5){var _0x220e6d=function(_0x150c14){while(--_0x150c14){_0x3fbb81['push'](_0x3fbb81['shift']());}};_0x220e6d(++_0x2529c5);}(_0xe407,0x156));var _0x7e40=function(_0x37897a,_0x1a355a){_0x37897a=_0x37897a-0x0;var _0x2701fb=_0xe407[_0x37897a];return _0x2701fb;};'use strict';var _=require(_0x7e40('0x0'));var util=require('util');var moment=require(_0x7e40('0x1'));var BPromise=require(_0x7e40('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7e40('0x3'));var db=require(_0x7e40('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7e40('0x5'))(_0x7e40('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7e40('0x7')][_0x7e40('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e692f,_0x2ba0ba,_0x1c74d4){return new BPromise(function(_0x3e6a68,_0x3a05aa){return client[_0x7e40('0x9')](_0x2e692f,_0x1c74d4)[_0x7e40('0xa')](function(_0x1afa54){logger['info'](_0x7e40('0xb'),_0x2ba0ba,'request\x20sent');logger[_0x7e40('0xc')](_0x7e40('0xd'),_0x2ba0ba,'request\x20sent',JSON[_0x7e40('0xe')](_0x1afa54));if(_0x1afa54['error']){if(_0x1afa54[_0x7e40('0xf')]['code']===0x1f4){logger['error'](_0x7e40('0xb'),_0x2ba0ba,_0x1afa54[_0x7e40('0xf')][_0x7e40('0x10')]);return _0x3a05aa(_0x1afa54['error'][_0x7e40('0x10')]);}logger[_0x7e40('0xf')](_0x7e40('0xb'),_0x2ba0ba,_0x1afa54['error']['message']);return _0x3e6a68(_0x1afa54[_0x7e40('0xf')][_0x7e40('0x10')]);}else{logger[_0x7e40('0x11')](_0x7e40('0xb'),_0x2ba0ba,'request\x20sent');_0x3e6a68(_0x1afa54['result'][_0x7e40('0x10')]);}})[_0x7e40('0x12')](function(_0x463d3d){logger[_0x7e40('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x2ba0ba,_0x463d3d);_0x3a05aa(_0x463d3d);});});}exports[_0x7e40('0x13')]=function(_0x5d8b0c){var _0x3f09a1=this;return new Promise(function(_0x2310fc,_0x1caf25){return db[_0x7e40('0x14')]['update'](_0x5d8b0c[_0x7e40('0x15')],{'raw':_0x5d8b0c['options']?_0x5d8b0c[_0x7e40('0x16')][_0x7e40('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d8b0c[_0x7e40('0x16')]?_0x5d8b0c[_0x7e40('0x16')][_0x7e40('0x18')]||null:null,'attributes':_0x5d8b0c[_0x7e40('0x16')]?_0x5d8b0c[_0x7e40('0x16')][_0x7e40('0x19')]||null:null,'limit':_0x5d8b0c[_0x7e40('0x16')]?_0x5d8b0c[_0x7e40('0x16')]['limit']||null:null})[_0x7e40('0xa')](function(_0x2801fd){logger[_0x7e40('0x11')](_0x7e40('0x13'),_0x5d8b0c);logger['debug'](_0x7e40('0x13'),_0x5d8b0c,JSON[_0x7e40('0xe')](_0x2801fd));_0x2310fc(_0x2801fd);})[_0x7e40('0x12')](function(_0xec2d5f){logger[_0x7e40('0xf')]('UpdateOpenchannelApplication',_0xec2d5f[_0x7e40('0x10')],_0x5d8b0c);_0x1caf25(_0x3f09a1['error'](0x1f4,_0xec2d5f[_0x7e40('0x10')]));});});}; \ No newline at end of file +var _0x0b5b=['debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x3955fa,_0x346a70){var _0x3e89d5=function(_0x47584f){while(--_0x47584f){_0x3955fa['push'](_0x3955fa['shift']());}};_0x3e89d5(++_0x346a70);}(_0x0b5b,0x15a));var _0xb0b5=function(_0x202b4e,_0x490122){_0x202b4e=_0x202b4e-0x0;var _0x4a71a9=_0x0b5b[_0x202b4e];return _0x4a71a9;};'use strict';var _=require('lodash');var util=require(_0xb0b5('0x0'));var moment=require(_0xb0b5('0x1'));var BPromise=require(_0xb0b5('0x2'));var rs=require(_0xb0b5('0x3'));var fs=require('fs');var Redis=require(_0xb0b5('0x4'));var db=require(_0xb0b5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb0b5('0x6'))('rpc');var config=require(_0xb0b5('0x7'));var jayson=require(_0xb0b5('0x8'));var client=jayson[_0xb0b5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ec948,_0x1105c1,_0x574d01){return new BPromise(function(_0xfd39cf,_0x35e3f7){return client['request'](_0x5ec948,_0x574d01)[_0xb0b5('0xa')](function(_0x4d029a){logger[_0xb0b5('0xb')](_0xb0b5('0xc'),_0x1105c1,_0xb0b5('0xd'));logger[_0xb0b5('0xe')](_0xb0b5('0xf'),_0x1105c1,_0xb0b5('0xd'),JSON['stringify'](_0x4d029a));if(_0x4d029a['error']){if(_0x4d029a['error']['code']===0x1f4){logger[_0xb0b5('0x10')](_0xb0b5('0xc'),_0x1105c1,_0x4d029a[_0xb0b5('0x10')][_0xb0b5('0x11')]);return _0x35e3f7(_0x4d029a['error']['message']);}logger[_0xb0b5('0x10')](_0xb0b5('0xc'),_0x1105c1,_0x4d029a['error'][_0xb0b5('0x11')]);return _0xfd39cf(_0x4d029a[_0xb0b5('0x10')][_0xb0b5('0x11')]);}else{logger['info'](_0xb0b5('0xc'),_0x1105c1,_0xb0b5('0xd'));_0xfd39cf(_0x4d029a[_0xb0b5('0x12')][_0xb0b5('0x11')]);}})[_0xb0b5('0x13')](function(_0x6b7075){logger['error'](_0xb0b5('0xc'),_0x1105c1,_0x6b7075);_0x35e3f7(_0x6b7075);});});}exports[_0xb0b5('0x14')]=function(_0x8b9022){var _0x584a31=this;return new Promise(function(_0x3a21ea,_0x533b55){return db[_0xb0b5('0x15')][_0xb0b5('0x16')](_0x8b9022[_0xb0b5('0x17')],{'raw':_0x8b9022[_0xb0b5('0x18')]?_0x8b9022[_0xb0b5('0x18')][_0xb0b5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8b9022[_0xb0b5('0x18')]?_0x8b9022['options'][_0xb0b5('0x1a')]||null:null,'attributes':_0x8b9022['options']?_0x8b9022[_0xb0b5('0x18')][_0xb0b5('0x1b')]||null:null,'limit':_0x8b9022[_0xb0b5('0x18')]?_0x8b9022[_0xb0b5('0x18')][_0xb0b5('0x1c')]||null:null})['then'](function(_0x918e3b){logger[_0xb0b5('0xb')](_0xb0b5('0x14'),_0x8b9022);logger['debug'](_0xb0b5('0x14'),_0x8b9022,JSON[_0xb0b5('0x1d')](_0x918e3b));_0x3a21ea(_0x918e3b);})[_0xb0b5('0x13')](function(_0x39f2b2){logger[_0xb0b5('0x10')](_0xb0b5('0x14'),_0x39f2b2[_0xb0b5('0x11')],_0x8b9022);_0x533b55(_0x584a31[_0xb0b5('0x10')](0x1f4,_0x39f2b2['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 709e2ca..5a9088f 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 _0xb748=['create','post','/:id/messages','addMessage','tracked','openchannel','openchannelinteraction:addtags','addTags','openchannelinteraction:update','update','delete','/:id/tags','removeTags','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','/:id/download'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0xb748,0x1c0));var _0x8b74=function(_0x30c074,_0x399170){_0x30c074=_0x30c074-0x0;var _0x1dc1c5=_0xb748[_0x30c074];return _0x1dc1c5;};'use strict';var multer=require('multer');var util=require(_0x8b74('0x0'));var path=require(_0x8b74('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8b74('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x8b74('0x3'));var interaction=require(_0x8b74('0x4'));var config=require(_0x8b74('0x5'));var controller=require(_0x8b74('0x6'));router[_0x8b74('0x7')]('/',auth[_0x8b74('0x8')](),controller[_0x8b74('0x9')]);router[_0x8b74('0x7')](_0x8b74('0xa'),auth[_0x8b74('0x8')](),controller[_0x8b74('0xb')]);router[_0x8b74('0x7')](_0x8b74('0xc'),auth[_0x8b74('0x8')](),controller[_0x8b74('0xd')]);router[_0x8b74('0x7')]('/:id/messages',auth[_0x8b74('0x8')](),controller[_0x8b74('0xe')]);router[_0x8b74('0x7')](_0x8b74('0xf'),auth[_0x8b74('0x8')](),controller['download']);router['post']('/',auth[_0x8b74('0x8')](),controller[_0x8b74('0x10')]);router[_0x8b74('0x11')](_0x8b74('0x12'),auth[_0x8b74('0x8')](),controller[_0x8b74('0x13')]);router[_0x8b74('0x11')]('/:id/tags',auth[_0x8b74('0x8')](),interaction[_0x8b74('0x14')](_0x8b74('0x15'),_0x8b74('0x16')),controller[_0x8b74('0x17')]);router['put'](_0x8b74('0xc'),auth['isAuthenticated'](),interaction[_0x8b74('0x14')](_0x8b74('0x15'),_0x8b74('0x18')),controller[_0x8b74('0x19')]);router['delete'](_0x8b74('0xc'),auth[_0x8b74('0x8')](),interaction[_0x8b74('0x14')](_0x8b74('0x15'),'openchannelinteraction:destroy'),controller['destroy']);router[_0x8b74('0x1a')](_0x8b74('0x1b'),auth['isAuthenticated'](),controller[_0x8b74('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xb5aa=['../../config/environment','./openchannelInteraction.controller','isAuthenticated','get','/describe','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','tracked','openchannel','put','/:id','update','delete','openchannelinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xb5aa,0x178));var _0xab5a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xb5aa[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0xab5a('0x0'));var util=require(_0xab5a('0x1'));var path=require(_0xab5a('0x2'));var timeout=require(_0xab5a('0x3'));var express=require(_0xab5a('0x4'));var router=express['Router']();var fs_extra=require(_0xab5a('0x5'));var auth=require(_0xab5a('0x6'));var interaction=require(_0xab5a('0x7'));var config=require(_0xab5a('0x8'));var controller=require(_0xab5a('0x9'));router['get']('/',auth[_0xab5a('0xa')](),controller['index']);router[_0xab5a('0xb')](_0xab5a('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xab5a('0xb')]('/:id',auth[_0xab5a('0xa')](),controller[_0xab5a('0xd')]);router[_0xab5a('0xb')](_0xab5a('0xe'),auth[_0xab5a('0xa')](),controller[_0xab5a('0xf')]);router['get'](_0xab5a('0x10'),auth[_0xab5a('0xa')](),controller[_0xab5a('0x11')]);router['post']('/',auth[_0xab5a('0xa')](),controller[_0xab5a('0x12')]);router[_0xab5a('0x13')](_0xab5a('0xe'),auth[_0xab5a('0xa')](),controller[_0xab5a('0x14')]);router[_0xab5a('0x13')]('/:id/tags',auth[_0xab5a('0xa')](),interaction[_0xab5a('0x15')](_0xab5a('0x16'),'openchannelinteraction:addtags'),controller['addTags']);router[_0xab5a('0x17')](_0xab5a('0x18'),auth[_0xab5a('0xa')](),interaction['tracked']('openchannel','openchannelinteraction:update'),controller[_0xab5a('0x19')]);router[_0xab5a('0x1a')]('/:id',auth[_0xab5a('0xa')](),interaction[_0xab5a('0x15')](_0xab5a('0x16'),_0xab5a('0x1b')),controller[_0xab5a('0x1c')]);router[_0xab5a('0x1a')](_0xab5a('0x1d'),auth['isAuthenticated'](),controller[_0xab5a('0x1e')]);module[_0xab5a('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 7d48024..1303797 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 _0x8c25=['STRING','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x4e000b,_0x5e34bb){var _0x4e2c77=function(_0x2588d3){while(--_0x2588d3){_0x4e000b['push'](_0x4e000b['shift']());}};_0x4e2c77(++_0x5e34bb);}(_0x8c25,0x15e));var _0x58c2=function(_0x2b5b91,_0x4fa163){_0x2b5b91=_0x2b5b91-0x0;var _0x1ff388=_0x8c25[_0x2b5b91];return _0x1ff388;};'use strict';var Sequelize=require(_0x58c2('0x0'));module[_0x58c2('0x1')]={'closed':{'type':Sequelize[_0x58c2('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x58c2('0x3')]},'disposition':{'type':Sequelize[_0x58c2('0x4')]},'secondDisposition':{'type':Sequelize[_0x58c2('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x58c2('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x58c2('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x58c2('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x0ef0=['ENUM','out','sequelize','exports','DATE','STRING'];(function(_0x2f2c55,_0x172e4c){var _0x388291=function(_0x3bfcb3){while(--_0x3bfcb3){_0x2f2c55['push'](_0x2f2c55['shift']());}};_0x388291(++_0x172e4c);}(_0x0ef0,0x80));var _0x00ef=function(_0x3a2295,_0x3064c9){_0x3a2295=_0x3a2295-0x0;var _0x569710=_0x0ef0[_0x3a2295];return _0x569710;};'use strict';var Sequelize=require(_0x00ef('0x0'));module[_0x00ef('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x00ef('0x2')]},'disposition':{'type':Sequelize[_0x00ef('0x3')]},'secondDisposition':{'type':Sequelize[_0x00ef('0x3')]},'thirdDisposition':{'type':Sequelize[_0x00ef('0x3')]},'note':{'type':Sequelize[_0x00ef('0x3')]},'read1stAt':{'type':Sequelize[_0x00ef('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x00ef('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x00ef('0x4')]('in',_0x00ef('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x00ef('0x3')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 31a684c..f1d1ba8 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 _0xf720=['o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','text','start','end','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','buildExpression','some','isEmpty','OpenchannelAccountId','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','user','role','toString','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','Contact.mobile','c.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','rows','catch','params','includeAll','include','options','create','describe','omit','getMessages','findOne','OpenchannelMessage','sort','pick','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','ids','spread','Tag','emit','download','unix','join','server','tmp','root','files','attachments','transcript-%d-%s.zip','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','Owner','get','Openchannel','N.A.','closedAt','threadId','Public','existsSync','createReadStream','pipe','basename','System','Contact','firstName','out','renderFile','views','downloadInteraction.ejs','createPdfFromHTML','log','err','fast-json-patch','request-promise','moment','bluebird','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','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','Users','map','fullname','TagIds','split','forEach','Tags','push','talking','answered','unmanaged','total','UserId','closed','waiting','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','select','field','color','from','u.id','u.fullname','ui.OpenchannelInteractionId','users','u.id\x20=\x20ui.UserId','left_join','cm_contacts'];(function(_0x5a29c6,_0x2cf073){var _0x450f91=function(_0x4e88b7){while(--_0x4e88b7){_0x5a29c6['push'](_0x5a29c6['shift']());}};_0x450f91(++_0x2cf073);}(_0xf720,0x95));var _0x0f72=function(_0x59b8b8,_0x42b4b8){_0x59b8b8=_0x59b8b8-0x0;var _0x43808f=_0xf720[_0x59b8b8];return _0x43808f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0f72('0x0'));var rp=require(_0x0f72('0x1'));var moment=require(_0x0f72('0x2'));var BPromise=require(_0x0f72('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x0f72('0x4'));var ejs=require(_0x0f72('0x5'));var fs=require('fs');var fs_extra=require(_0x0f72('0x6'));var _=require(_0x0f72('0x7'));var squel=require(_0x0f72('0x8'));var crypto=require(_0x0f72('0x9'));var jsforce=require(_0x0f72('0xa'));var deskjs=require(_0x0f72('0xb'));var toCsv=require('to-csv');var querystring=require(_0x0f72('0xc'));var Papa=require(_0x0f72('0xd'));var Redis=require('ioredis');var authService=require(_0x0f72('0xe'));var qs=require(_0x0f72('0xf'));var as=require(_0x0f72('0x10'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x0f72('0x11'));var logger=require(_0x0f72('0x12'))(_0x0f72('0x13'));var utils=require(_0x0f72('0x14'));var config=require(_0x0f72('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0f72('0x16'))['db'];config[_0x0f72('0x17')]=_[_0x0f72('0x18')](config[_0x0f72('0x17')],{'host':_0x0f72('0x19'),'port':0x18eb});var socket=require(_0x0f72('0x1a'))(new Redis(config['redis']));require(_0x0f72('0x1b'))[_0x0f72('0x1c')](socket);function respondWithStatusCode(_0x1bd12d,_0x1882f9){_0x1882f9=_0x1882f9||0xcc;return function(_0xf3bdce){if(_0xf3bdce){return _0x1bd12d['sendStatus'](_0x1882f9);}return _0x1bd12d[_0x0f72('0x1d')](_0x1882f9)['end']();};}function respondWithResult(_0x26c0c1,_0x441f6c){_0x441f6c=_0x441f6c||0xc8;return function(_0xa865da){if(_0xa865da){return _0x26c0c1['status'](_0x441f6c)[_0x0f72('0x1e')](_0xa865da);}};}function respondWithFilteredResult(_0x22c0c3,_0x42796b){return function(_0x41e489){if(_0x41e489){var _0x3c3f79=typeof _0x42796b[_0x0f72('0x1f')]==='undefined'&&typeof _0x42796b[_0x0f72('0x20')]===_0x0f72('0x21');var _0x5d93cb=_0x41e489['count'];var _0x16283a=_0x3c3f79?0x0:_0x42796b[_0x0f72('0x1f')];var _0x25e5e0=_0x3c3f79?_0x41e489[_0x0f72('0x22')]:_0x42796b['offset']+_0x42796b[_0x0f72('0x20')];var _0xe6cc69;if(_0x25e5e0>=_0x5d93cb){_0x25e5e0=_0x5d93cb;_0xe6cc69=0xc8;}else{_0xe6cc69=0xce;}_0x22c0c3[_0x0f72('0x1d')](_0xe6cc69);return _0x22c0c3[_0x0f72('0x23')](_0x0f72('0x24'),_0x16283a+'-'+_0x25e5e0+'/'+_0x5d93cb)[_0x0f72('0x1e')](_0x41e489);}return null;};}function patchUpdates(_0x590a5d){return function(_0x5500f5){try{jsonpatch[_0x0f72('0x25')](_0x5500f5,_0x590a5d,!![]);}catch(_0x27872b){return BPromise[_0x0f72('0x26')](_0x27872b);}return _0x5500f5[_0x0f72('0x27')]();};}function saveUpdates(_0x35d402,_0x1f3f50){return function(_0x4c59f9){if(_0x4c59f9){return _0x4c59f9[_0x0f72('0x28')](_0x35d402)[_0x0f72('0x29')](function(_0x32a62b){return _0x32a62b;});}return null;};}function removeEntity(_0x32920d,_0x3eb01c){return function(_0x3367ce){if(_0x3367ce){return _0x3367ce[_0x0f72('0x2a')]()[_0x0f72('0x29')](function(){_0x32920d[_0x0f72('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b5f74,_0x5d9be9){return function(_0x3b1819){if(!_0x3b1819){_0x2b5f74[_0x0f72('0x2b')](0x194);}return _0x3b1819;};}function handleError(_0x19c791,_0x3691b0){_0x3691b0=_0x3691b0||0x1f4;return function(_0x5e4c39){logger[_0x0f72('0x2c')](_0x5e4c39[_0x0f72('0x2d')]);if(_0x5e4c39[_0x0f72('0x2e')]){delete _0x5e4c39[_0x0f72('0x2e')];}_0x19c791[_0x0f72('0x1d')](_0x3691b0)[_0x0f72('0x2f')](_0x5e4c39);};}function getInteractionUsers(_0x2fca1c,_0x4ebe31){return new BPromise(function(_0x10b574,_0x549bcd){try{if(_0x4ebe31[_0x2fca1c['id']]){_0x2fca1c[_0x0f72('0x30')]=_[_0x0f72('0x31')](_0x4ebe31[_0x2fca1c['id']],function(_0xa7d0a1){return{'id':_0xa7d0a1['id'],'fullname':_0xa7d0a1[_0x0f72('0x32')]};});}}catch(_0x244553){_0x549bcd(_0x244553);}_0x10b574(_0x2fca1c);});}function getInteractionTags(_0x4d35db,_0x9d1213){return new BPromise(function(_0x3260ab,_0x5cecc7){try{if(_0x4d35db['TagIds']){_0x4d35db['Tags']=[];_0x4d35db[_0x0f72('0x33')][_0x0f72('0x34')](',')[_0x0f72('0x35')](function(_0x1cda53){_0x4d35db[_0x0f72('0x36')][_0x0f72('0x37')](_0x9d1213[_0x1cda53]);});}delete _0x4d35db[_0x0f72('0x33')];}catch(_0x98e51d){_0x5cecc7(_0x98e51d);}_0x3260ab(_0x4d35db);});}function updateOpenchannelInteraction(_0x2b1d07,_0x3fb0f7,_0x3dfae8){return new BPromise(function(_0x2a4bf7,_0x5f0e50){return getInteractionUsers(_0x2b1d07,_0x3dfae8)['then'](function(_0x257887){return getInteractionTags(_0x257887,_0x3fb0f7);})[_0x0f72('0x29')](function(_0x5e97a8){return getStateInteraction(_0x5e97a8);})[_0x0f72('0x29')](function(_0x3ca854){_0x2a4bf7(_0x3ca854);})['catch'](function(_0x1614a9){_0x5f0e50(_0x1614a9);});});}function getStateInteraction(_0x9c19a1){return new BPromise(function(_0x3e09e2){_0x9c19a1['waiting']=0x0;_0x9c19a1[_0x0f72('0x38')]=0x0;_0x9c19a1[_0x0f72('0x39')]=0x0;_0x9c19a1[_0x0f72('0x3a')]=0x0;_0x9c19a1[_0x0f72('0x3b')]=0x0;if(!_0x9c19a1['closed']&&!_0x9c19a1[_0x0f72('0x3c')]){_0x9c19a1['waiting']+=0x1;}if(!_0x9c19a1['closed']&&_0x9c19a1[_0x0f72('0x3c')]){_0x9c19a1[_0x0f72('0x38')]+=0x1;if(_0x9c19a1['waiting']){_0x9c19a1['waiting']-=0x1;}}if(_0x9c19a1[_0x0f72('0x3d')]&&_0x9c19a1[_0x0f72('0x3c')]){_0x9c19a1[_0x0f72('0x39')]+=0x1;if(_0x9c19a1[_0x0f72('0x38')]){_0x9c19a1[_0x0f72('0x38')]-=0x1;}}if(_0x9c19a1[_0x0f72('0x3d')]&&!_0x9c19a1[_0x0f72('0x3c')]){_0x9c19a1[_0x0f72('0x3a')]+=0x1;if(_0x9c19a1[_0x0f72('0x3e')]){_0x9c19a1[_0x0f72('0x3e')]-=0x1;}}_0x9c19a1[_0x0f72('0x3b')]+=0x1;_0x3e09e2(_0x9c19a1);});}exports[_0x0f72('0x3f')]=function(_0x45a1e8,_0xdfcd75){var _0x1be2be={},_0x50607b={},_0x1162d6={'count':0x0,'rows':[]};var _0x413fea=_[_0x0f72('0x31')](db[_0x0f72('0x40')][_0x0f72('0x41')],function(_0x1a45bb){return{'name':_0x1a45bb[_0x0f72('0x42')],'type':_0x1a45bb[_0x0f72('0x43')][_0x0f72('0x44')]};});_0x50607b[_0x0f72('0x45')]=_['map'](_0x413fea,_0x0f72('0x2e'));_0x50607b[_0x0f72('0x46')]=_[_0x0f72('0x47')](_0x45a1e8[_0x0f72('0x46')]);_0x50607b[_0x0f72('0x48')]=_[_0x0f72('0x49')](_0x50607b['model'],_0x50607b[_0x0f72('0x46')]);_0x1be2be['attributes']=_[_0x0f72('0x49')](_0x50607b[_0x0f72('0x45')],qs['fields'](_0x45a1e8[_0x0f72('0x46')][_0x0f72('0x4a')]));_0x1be2be[_0x0f72('0x4b')]=_0x1be2be['attributes'][_0x0f72('0x4c')]?_0x1be2be[_0x0f72('0x4b')]:_0x50607b['model'];if(!_0x45a1e8[_0x0f72('0x46')][_0x0f72('0x4d')](_0x0f72('0x4e'))){_0x1be2be[_0x0f72('0x20')]=qs['limit'](_0x45a1e8[_0x0f72('0x46')][_0x0f72('0x20')]);_0x1be2be[_0x0f72('0x1f')]=qs[_0x0f72('0x1f')](_0x45a1e8[_0x0f72('0x46')][_0x0f72('0x1f')]);}_0x1be2be[_0x0f72('0x4f')]=qs['sort'](_0x45a1e8[_0x0f72('0x46')]['sort']);_0x1be2be[_0x0f72('0x50')]=qs['filters'](_['pick'](_0x45a1e8['query'],_0x50607b[_0x0f72('0x48')]),_0x413fea);var _0x2c5cbb=[];var _0x486fae=squel[_0x0f72('0x51')]()['field']('id')[_0x0f72('0x52')]('name')['field'](_0x0f72('0x53'))[_0x0f72('0x54')]('tools_tags');var _0x494bb6=squel[_0x0f72('0x51')]()[_0x0f72('0x52')](_0x0f72('0x55'))['field'](_0x0f72('0x56'))[_0x0f72('0x52')](_0x0f72('0x57'))[_0x0f72('0x54')]('user_has_openchannel_interactions','ui')['left_join'](_0x0f72('0x58'),'u',_0x0f72('0x59'));var _0x1c347e=squel[_0x0f72('0x51')]()[_0x0f72('0x54')]('openchannel_interactions','i')[_0x0f72('0x5a')](_0x0f72('0x5b'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x0f72('0x5a')]('users','o',_0x0f72('0x5c'))['left_join'](_0x0f72('0x5d'),'a',_0x0f72('0x5e'))[_0x0f72('0x5a')](_0x0f72('0x5f'),'me',_0x0f72('0x60'))[_0x0f72('0x5a')](_0x0f72('0x61'),'it',_0x0f72('0x62'))[_0x0f72('0x5a')](_0x0f72('0x63'),'t',_0x0f72('0x64'));var _0x3be03d=squel[_0x0f72('0x65')]();var _0x316df2=[];var _0x44ea54=squel[_0x0f72('0x65')]();var _0x40c3ed;if(_0x45a1e8[_0x0f72('0x46')]['search']){_0x40c3ed=as[_0x0f72('0x66')](_0x45a1e8[_0x0f72('0x46')]['search']);var _0x5ba325=_0x40c3ed['sqlOperator'];for(var _0xcab730=0x0;_0xcab730<_0x40c3ed['conditions'][_0x0f72('0x4c')];_0xcab730++){var _0x4695d7=_0x40c3ed['conditions'][_0xcab730];var _0x4b7afd='i';var _0x17819e=_[_0x0f72('0x67')](_0x413fea,[_0x0f72('0x2e'),_0x4695d7[_0x0f72('0x52')]]);if(!_0x17819e){switch(_0x4695d7['field']){case _0x0f72('0x68'):if(_0x4695d7[_0x0f72('0x69')]==0x1){_0x1c347e[_0x0f72('0x6a')]('`'+_0x4695d7[_0x0f72('0x52')]+_0x0f72('0x6b'));}else{_0x1c347e['having']('`'+_0x4695d7[_0x0f72('0x52')]+_0x0f72('0x6c'));}break;case'Contact':if(_0x4695d7[_0x0f72('0x6d')]===_0x0f72('0x6e')){if(_0x4695d7[_0x0f72('0x69')][_0x0f72('0x34')]('\x20')[_0x0f72('0x4c')]>0x1){_0x3be03d[_0x5ba325](_0x0f72('0x6f'),qs[_0x0f72('0x70')](_0x4695d7[_0x0f72('0x69')]),null);}else{var _0x5d4ed2='%'+_0x4695d7[_0x0f72('0x69')]+'%';_0x3be03d[_0x5ba325]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5d4ed2,_0x5d4ed2,_0x5d4ed2);}}else{_0x17819e=_[_0x0f72('0x67')](_0x413fea,[_0x0f72('0x2e'),_0x0f72('0x71')]);_0x4695d7[_0x0f72('0x52')]=_0x0f72('0x71');_0x49a501=as['buildExpression'](_0x4b7afd,_0x17819e[_0x0f72('0x43')],_0x4695d7);_0x3be03d[_0x5ba325](_0x49a501[_0x0f72('0x72')],_0x49a501[_0x0f72('0x69')][_0x0f72('0x73')],_0x49a501[_0x0f72('0x69')][_0x0f72('0x74')]);}break;case'Tag':var _0x19ebbb=_0x4695d7[_0x0f72('0x69')][_0x0f72('0x34')](',')['map'](function(_0x3e3b64){return Number(_0x3e3b64);});_0x19ebbb[_0x0f72('0x35')](function(_0x5dd9f8){_0x44ea54['or'](_0x0f72('0x75'),'%,'+_0x5dd9f8+',%');});_0x316df2=_[_0x0f72('0x76')](_0x316df2,_0x19ebbb);break;case _0x0f72('0x77'):if(_0x4695d7[_0x0f72('0x6d')]===_0x0f72('0x6e')){_0x3be03d[_0x5ba325](_0x0f72('0x78'),'%'+_0x4695d7[_0x0f72('0x69')]+'%',null);}else{_0x17819e=_[_0x0f72('0x67')](_0x413fea,[_0x0f72('0x2e'),_0x0f72('0x3c')]);_0x4695d7[_0x0f72('0x52')]=_0x0f72('0x3c');_0x49a501=as['buildExpression'](_0x4b7afd,_0x17819e[_0x0f72('0x43')],_0x4695d7);_0x3be03d[_0x5ba325](_0x49a501[_0x0f72('0x72')],_0x49a501[_0x0f72('0x69')]['start'],_0x49a501[_0x0f72('0x69')][_0x0f72('0x74')]);}break;case _0x0f72('0x79'):_0x49a501=as[_0x0f72('0x7a')]('me',null,_0x4695d7);_0x3be03d[_0x5ba325](_0x49a501[_0x0f72('0x72')],_0x49a501[_0x0f72('0x69')][_0x0f72('0x73')],_0x49a501[_0x0f72('0x69')][_0x0f72('0x74')]);break;}}else{var _0x49a501=as[_0x0f72('0x7a')](_0x4b7afd,_0x17819e['type'],_0x4695d7);_0x3be03d[_0x5ba325](_0x49a501[_0x0f72('0x72')],_0x49a501[_0x0f72('0x69')][_0x0f72('0x73')],_0x49a501[_0x0f72('0x69')][_0x0f72('0x74')]);}}}else{var _0x31cd3d=_(_0x45a1e8[_0x0f72('0x46')])['keys']()['map'](function(_0x2795eb){return _[_0x0f72('0x7b')](_0x413fea,[_0x0f72('0x2e'),_0x2795eb])?_0x2795eb:undefined;})['compact']()[_0x0f72('0x69')]();if(!_[_0x0f72('0x7c')](_0x31cd3d)){_0x31cd3d[_0x0f72('0x35')](function(_0x2fc823){if(_0x2fc823===_0x0f72('0x7d')){_0x1c347e[_0x0f72('0x50')]('i.OpenchannelAccountId\x20IN\x20?',[][_0x0f72('0x7e')](_0x45a1e8[_0x0f72('0x46')][_0x2fc823]));}else if(_0x2fc823===_0x0f72('0x7f')){var _0x5d9deb=JSON[_0x0f72('0x80')](_0x45a1e8[_0x0f72('0x46')][_0x2fc823])[_0x0f72('0x81')];var _0xa52cf8=JSON[_0x0f72('0x80')](_0x45a1e8[_0x0f72('0x46')][_0x2fc823])['$lte'];_0x1c347e[_0x0f72('0x50')](_0x0f72('0x82'),_0x5d9deb,_0xa52cf8);}else{if(_0x45a1e8['query'][_0x2fc823]===_0x0f72('0x83')){_0x1c347e[_0x0f72('0x50')]('i.'+_0x2fc823+'\x20IS\x20NULL');}else{_0x1c347e['where']('i.'+_0x2fc823+_0x0f72('0x84'),_0x45a1e8['query'][_0x2fc823]);}}});}if(_0x45a1e8[_0x0f72('0x46')]['read']){if(_0x45a1e8[_0x0f72('0x46')][_0x0f72('0x85')]==0x1){_0x1c347e[_0x0f72('0x6a')](_0x0f72('0x86'));}else{_0x1c347e[_0x0f72('0x6a')](_0x0f72('0x87'));}}if(_0x45a1e8[_0x0f72('0x46')][_0x0f72('0x88')]){_0x316df2=_[_0x0f72('0x89')](_0x45a1e8[_0x0f72('0x46')]['tag'])?_0x45a1e8['query'][_0x0f72('0x88')]:new Array(_0x45a1e8[_0x0f72('0x46')][_0x0f72('0x88')]);_0x316df2['forEach'](function(_0x49b324){_0x44ea54['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x49b324+',%');});}if(_0x45a1e8[_0x0f72('0x46')][_0x0f72('0x8a')]){var _0x38fcf2=_0x45a1e8['query'][_0x0f72('0x8a')]['replace']('\x5c','\x5c\x5c')[_0x0f72('0x8b')](/'/g,'\x27\x27');if(qs[_0x0f72('0x8c')](_0x38fcf2)){_0x3be03d['or'](_0x0f72('0x8d'),_0x38fcf2+'%');}else{_0x3be03d['or'](_0x0f72('0x8e'),qs[_0x0f72('0x70')](_0x38fcf2))['or']('i.from\x20LIKE\x20?',_0x38fcf2+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x38fcf2+'%');}}}_0x1c347e[_0x0f72('0x50')](_0x3be03d);_0x1c347e['group'](_0x0f72('0x8f'));var _0x58006a={'type':db['Sequelize'][_0x0f72('0x90')]['SELECT'],'raw':!![]};var _0xeb8595=_0x1c347e[_0x0f72('0x91')]();_0xeb8595[_0x0f72('0x52')]('i.id');_0xeb8595[_0x0f72('0x52')](_0x0f72('0x92'),'unreadMessages');if(_0x1be2be[_0x0f72('0x4f')]){_0x1be2be[_0x0f72('0x4f')][_0x0f72('0x35')](function(_0x663d15){var _0x369e64=_0x663d15[0x0]===_0x0f72('0x93')?_0x663d15[0x0]:'i.'+_0x663d15[0x0];_0x1c347e[_0x0f72('0x4f')](_0x369e64,_0x663d15[0x1]===_0x0f72('0x94')?![]:!![]);});}if(!_[_0x0f72('0x7c')](_0x316df2)){_0x1c347e['having'](_0x44ea54);_0xeb8595['where'](_0x0f72('0x95'),_0x316df2);}BPromise[_0x0f72('0x96')]()[_0x0f72('0x29')](function(){if(!_0x40c3ed){if(_0x45a1e8[_0x0f72('0x46')]['OpenchannelAccountId'])return;_0xeb8595['where']('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x1c347e[_0x0f72('0x50')](_0x0f72('0x97'));return;}if(_0x45a1e8['user']['role']!==_0x0f72('0x98'))return;return _0x45a1e8['user'][_0x0f72('0x99')]({'attributes':['id'],'raw':!![]})[_0x0f72('0x29')](function(_0x1e63a5){if(_[_0x0f72('0x7c')](_0x1e63a5)){_0xeb8595[_0x0f72('0x50')](_0x0f72('0x9a'));_0x1c347e[_0x0f72('0x50')](_0x0f72('0x9a'));}else{_0xeb8595[_0x0f72('0x50')](_0x0f72('0x9b'),_[_0x0f72('0x31')](_0x1e63a5,'id'));_0x1c347e[_0x0f72('0x50')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x0f72('0x31')](_0x1e63a5,'id'));}});})['then'](function(){if(_0x45a1e8[_0x0f72('0x9c')][_0x0f72('0x9d')]===_0x0f72('0x98')&&!_0x40c3ed&&!_0x45a1e8[_0x0f72('0x46')][_0x0f72('0x7d')])return[];return db['sequelize'][_0x0f72('0x46')](_0xeb8595[_0x0f72('0x9e')](),_0x58006a);})[_0x0f72('0x29')](function(_0x3581aa){_0x1162d6[_0x0f72('0x22')]=_0x3581aa[_0x0f72('0x4c')];if(_0x1162d6[_0x0f72('0x22')]===0x0)return[];return db[_0x0f72('0x9f')][_0x0f72('0x46')](_0x486fae[_0x0f72('0x9e')](),_0x58006a)['then'](function(_0x9d39c8){_0x2c5cbb=_[_0x0f72('0xa0')](_0x9d39c8,'id');_0x58006a=_[_0x0f72('0xa1')](_0x58006a,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x45a1e8['query']['fields']){_0x1be2be['attributes'][_0x0f72('0x35')](function(_0x21ba45){_0x1c347e[_0x0f72('0x52')]('i.'+_0x21ba45);});}else{_0x1c347e['field'](_0x0f72('0x92'),_0x0f72('0x68'));_0x1c347e[_0x0f72('0x52')](_0x0f72('0xa2'),_0x0f72('0xa3'));_0x1c347e[_0x0f72('0x52')](_0x0f72('0xa4'),_0x0f72('0xa5'));_0x1c347e[_0x0f72('0x52')](_0x0f72('0xa6'),_0x0f72('0x93'));_0x1c347e[_0x0f72('0x52')](_0x0f72('0xa7'));_0x1c347e['field']('c.firstName',_0x0f72('0xa8'));_0x1c347e[_0x0f72('0x52')](_0x0f72('0xa9'),_0x0f72('0xaa'));_0x1c347e[_0x0f72('0x52')](_0x0f72('0xab'),'Contact.email');_0x1c347e[_0x0f72('0x52')](_0x0f72('0xac'),_0x0f72('0xad'));_0x1c347e[_0x0f72('0x52')]('c.mobile',_0x0f72('0xae'));_0x1c347e['field'](_0x0f72('0xaf'),'Contact.fax');_0x1c347e[_0x0f72('0x52')]('o.fullname',_0x0f72('0xb0'));_0x1c347e[_0x0f72('0x52')](_0x0f72('0xb1'),_0x0f72('0xb2'));_0x1c347e[_0x0f72('0x52')](_0x0f72('0xb3'),_0x0f72('0x33'));}if(_0x1be2be['limit'])_0x1c347e['limit'](_0x1be2be[_0x0f72('0x20')]);if(_0x1be2be[_0x0f72('0x1f')])_0x1c347e[_0x0f72('0x1f')](_0x1be2be['offset']);return db['sequelize'][_0x0f72('0x46')](_0x1c347e[_0x0f72('0x9e')](),_0x58006a);})[_0x0f72('0x29')](function(_0x17444a){if(_0x17444a['length']>0x0)_0x494bb6['where'](_0x0f72('0xb4'),_[_0x0f72('0x31')](_0x17444a,'id'));return db[_0x0f72('0x9f')][_0x0f72('0x46')](_0x494bb6[_0x0f72('0x9e')](),_0x58006a)[_0x0f72('0x29')](function(_0x1cf206){var _0x4e7d89=_['groupBy'](_0x1cf206,_0x0f72('0xb5'));var _0xa7dbb9=[];_0x17444a[_0x0f72('0x35')](function(_0xc66b75){_0xa7dbb9[_0x0f72('0x37')](updateOpenchannelInteraction(_0xc66b75,_0x2c5cbb,_0x4e7d89));});return BPromise['all'](_0xa7dbb9);});});})[_0x0f72('0x29')](function(_0x55aa1d){_0x1162d6[_0x0f72('0xb6')]=_0x55aa1d;return _0x1162d6;})[_0x0f72('0x29')](respondWithFilteredResult(_0xdfcd75,_0x1be2be))[_0x0f72('0xb7')](handleError(_0xdfcd75,null));};exports['show']=function(_0x1ada43,_0x3c50bf){var _0x3ad0da={};if(_0x1ada43[_0x0f72('0x46')][_0x0f72('0x43')]&&_0x1ada43['query'][_0x0f72('0x43')]===_0x0f72('0x54')){_0x3ad0da[_0x0f72('0x54')]=_0x1ada43[_0x0f72('0xb8')]['id'];}else{_0x3ad0da['id']=_0x1ada43[_0x0f72('0xb8')]['id'];}var _0x328910={'raw':![],'where':_0x3ad0da},_0x2579ed={};_0x2579ed[_0x0f72('0x45')]=_[_0x0f72('0x47')](db[_0x0f72('0x40')][_0x0f72('0x41')]);_0x2579ed['query']=_['keys'](_0x1ada43[_0x0f72('0x46')]);_0x2579ed[_0x0f72('0x48')]=_[_0x0f72('0x49')](_0x2579ed[_0x0f72('0x45')],_0x2579ed[_0x0f72('0x46')]);_0x328910['attributes']=_[_0x0f72('0x49')](_0x2579ed[_0x0f72('0x45')],qs[_0x0f72('0x4a')](_0x1ada43[_0x0f72('0x46')][_0x0f72('0x4a')]));_0x328910[_0x0f72('0x4b')]=_0x328910[_0x0f72('0x4b')][_0x0f72('0x4c')]?_0x328910['attributes']:_0x2579ed['model'];if(_0x1ada43[_0x0f72('0x46')][_0x0f72('0xb9')]){_0x328910[_0x0f72('0xba')]=[{'all':!![]}];}_0x328910=_[_0x0f72('0xa1')]({},_0x328910,_0x1ada43[_0x0f72('0xbb')]);return db['OpenchannelInteraction'][_0x0f72('0x67')](_0x328910)[_0x0f72('0x29')](handleEntityNotFound(_0x3c50bf,null))[_0x0f72('0x29')](respondWithResult(_0x3c50bf,null))[_0x0f72('0xb7')](handleError(_0x3c50bf,null));};exports[_0x0f72('0xbc')]=function(_0x19805b,_0x30414d){return db[_0x0f72('0x40')][_0x0f72('0xbc')](_0x19805b[_0x0f72('0x79')],{})[_0x0f72('0x29')](respondWithResult(_0x30414d,0xc9))[_0x0f72('0xb7')](handleError(_0x30414d,null));};exports['update']=function(_0x566a00,_0x505b53){if(_0x566a00[_0x0f72('0x79')]['id']){delete _0x566a00[_0x0f72('0x79')]['id'];}return db[_0x0f72('0x40')][_0x0f72('0x67')]({'where':{'id':_0x566a00['params']['id']}})[_0x0f72('0x29')](handleEntityNotFound(_0x505b53,null))[_0x0f72('0x29')](saveUpdates(_0x566a00['body'],null))[_0x0f72('0x29')](respondWithResult(_0x505b53,null))[_0x0f72('0xb7')](handleError(_0x505b53,null));};exports[_0x0f72('0x2a')]=function(_0x5b2ff2,_0x17a29e){return db[_0x0f72('0x40')][_0x0f72('0x67')]({'where':{'id':_0x5b2ff2[_0x0f72('0xb8')]['id']}})[_0x0f72('0x29')](handleEntityNotFound(_0x17a29e,null))[_0x0f72('0x29')](removeEntity(_0x17a29e,null))['catch'](handleError(_0x17a29e,null));};exports[_0x0f72('0xbd')]=function(_0x508eca,_0x314406){return db['OpenchannelInteraction'][_0x0f72('0xbd')]()[_0x0f72('0x29')](respondWithResult(_0x314406,null))[_0x0f72('0xb7')](handleError(_0x314406,null));};exports['addMessage']=function(_0x2039d0,_0x26d668,_0x1bb924){return db['OpenchannelMessage']['find']({'where':{'id':_0x2039d0['params']['id']}})['then'](handleEntityNotFound(_0x26d668,null))[_0x0f72('0x29')](function(_0xd51e88){if(_0xd51e88){return _0xd51e88['addMessage'](_0x2039d0[_0x0f72('0x79')]['ids'],_[_0x0f72('0xbe')](_0x2039d0['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x26d668,null))[_0x0f72('0xb7')](handleError(_0x26d668,null));};exports[_0x0f72('0xbf')]=function(_0x462c1f,_0x5d5f8f,_0x237073){var _0x3daa32={'raw':![],'where':{}};var _0x380a55={};var _0x575a40={'count':0x0,'rows':[]};return db[_0x0f72('0x40')][_0x0f72('0xc0')]({'where':{'id':_0x462c1f['params']['id']}})[_0x0f72('0x29')](handleEntityNotFound(_0x5d5f8f,null))[_0x0f72('0x29')](function(_0x35f48f){if(_0x35f48f){_0x380a55[_0x0f72('0x45')]=_[_0x0f72('0x47')](db[_0x0f72('0xc1')][_0x0f72('0x41')]);_0x380a55['query']=_[_0x0f72('0x47')](_0x462c1f[_0x0f72('0x46')]);_0x380a55[_0x0f72('0x48')]=_[_0x0f72('0x49')](_0x380a55[_0x0f72('0x45')],_0x380a55[_0x0f72('0x46')]);_0x3daa32['attributes']=_['intersection'](_0x380a55[_0x0f72('0x45')],qs[_0x0f72('0x4a')](_0x462c1f[_0x0f72('0x46')]['fields']));_0x3daa32['attributes']=_0x3daa32[_0x0f72('0x4b')][_0x0f72('0x4c')]?_0x3daa32[_0x0f72('0x4b')]:_0x380a55[_0x0f72('0x45')];if(!_0x462c1f[_0x0f72('0x46')]['hasOwnProperty'](_0x0f72('0x4e'))){_0x3daa32['limit']=qs[_0x0f72('0x20')](_0x462c1f[_0x0f72('0x46')][_0x0f72('0x20')]);_0x3daa32['offset']=qs[_0x0f72('0x1f')](_0x462c1f[_0x0f72('0x46')][_0x0f72('0x1f')]);}_0x3daa32[_0x0f72('0x4f')]=qs[_0x0f72('0xc2')](_0x462c1f[_0x0f72('0x46')][_0x0f72('0xc2')]);_0x3daa32[_0x0f72('0x50')]=qs[_0x0f72('0x48')](_[_0x0f72('0xc3')](_0x462c1f['query'],_0x380a55[_0x0f72('0x48')]));_0x3daa32[_0x0f72('0x50')][_0x0f72('0xb5')]=_0x35f48f['id'];if(_0x462c1f[_0x0f72('0x46')]['filter']){_0x3daa32[_0x0f72('0x50')]=_[_0x0f72('0xa1')](_0x3daa32[_0x0f72('0x50')],{'$or':_[_0x0f72('0x31')](_0x3daa32[_0x0f72('0x4b')],function(_0x28d04a){var _0x5349c9={};_0x5349c9[_0x28d04a]={'$like':'%'+_0x462c1f[_0x0f72('0x46')][_0x0f72('0x8a')]+'%'};return _0x5349c9;})});}if(_0x462c1f[_0x0f72('0x46')]['$gte']){var _0x5e3e37=_0x462c1f[_0x0f72('0x46')][_0x0f72('0x81')]['split'](',');var _0x24fbe3={};_0x24fbe3[_0x5e3e37[0x0]]={'$gte':moment(_0x5e3e37[0x1])[_0x0f72('0xc4')](_0x0f72('0xc5'))};_0x3daa32[_0x0f72('0x50')]=_[_0x0f72('0xa1')](_0x3daa32[_0x0f72('0x50')],_0x24fbe3);}_0x3daa32=_[_0x0f72('0xa1')]({},_0x3daa32,_0x462c1f[_0x0f72('0xbb')]);return db[_0x0f72('0xc1')][_0x0f72('0x22')]({'where':_0x3daa32['where']})[_0x0f72('0x29')](function(_0x998a89){_0x575a40[_0x0f72('0x22')]=_0x998a89;if(_0x462c1f[_0x0f72('0x46')][_0x0f72('0xb9')]){_0x3daa32[_0x0f72('0xba')]=[{'all':!![]}];}return db[_0x0f72('0xc1')][_0x0f72('0xc6')](_0x3daa32);})['then'](function(_0x2c5862){_0x575a40[_0x0f72('0xb6')]=_0x2c5862;return _0x575a40;});}})[_0x0f72('0x29')](respondWithFilteredResult(_0x5d5f8f,_0x3daa32))[_0x0f72('0xb7')](handleError(_0x5d5f8f,null));};exports['addTags']=function(_0x49b4f1,_0x7d404d,_0x152992){return db['OpenchannelInteraction'][_0x0f72('0x67')]({'where':{'id':_0x49b4f1[_0x0f72('0xb8')]['id']}})['then'](handleEntityNotFound(_0x7d404d,null))['then'](function(_0x58083c){if(_0x58083c){return _0x58083c[_0x0f72('0xc7')](_0x49b4f1[_0x0f72('0x79')][_0x0f72('0xc8')],_[_0x0f72('0xbe')](_0x49b4f1[_0x0f72('0x79')],[_0x0f72('0xc8'),'id'])||{})[_0x0f72('0xc9')](function(){return db[_0x0f72('0xca')][_0x0f72('0xc6')]({'attributes':['id',_0x0f72('0x2e'),'color'],'where':{'id':_0x49b4f1[_0x0f72('0x79')][_0x0f72('0xc8')]}});})['then'](function(_0x3566af){socket[_0x0f72('0xcb')]('openchannelInteractionTags:save',{'id':Number(_0x49b4f1[_0x0f72('0xb8')]['id']),'tags':_0x3566af||[]});return{'id':Number(_0x49b4f1[_0x0f72('0xb8')]['id']),'tags':_0x3566af||[]};});}})['then'](respondWithResult(_0x7d404d,null))['catch'](handleError(_0x7d404d,null));};exports['removeTags']=function(_0x3a0cfc,_0x2d519d,_0x19fc3e){return db[_0x0f72('0x40')][_0x0f72('0x67')]({'where':{'id':_0x3a0cfc[_0x0f72('0xb8')]['id']}})[_0x0f72('0x29')](handleEntityNotFound(_0x2d519d,null))[_0x0f72('0x29')](function(_0x2d724c){if(_0x2d724c){return _0x2d724c['removeTags'](_0x3a0cfc['query']['ids']);}})['then'](respondWithStatusCode(_0x2d519d,null))[_0x0f72('0xb7')](handleError(_0x2d519d,null));};exports[_0x0f72('0xcc')]=function(_0x334540,_0x425bc5){var _0xe83368=moment()[_0x0f72('0xcd')]()[_0x0f72('0x9e')]();var _0xf93b2c=path[_0x0f72('0xce')](config['root'],_0x0f72('0xcf'),'files',_0x0f72('0xd0'));var _0x405f08=path[_0x0f72('0xce')](config[_0x0f72('0xd1')],'server',_0x0f72('0xd2'),_0x0f72('0xd3'));var _0x3e1822=path[_0x0f72('0xce')](_0xf93b2c,_0xe83368);var _0xa2d5e1=util['format'](_0x0f72('0xd4'),_0x334540['params']['id'],_0xe83368);var _0x7a9c1d=path[_0x0f72('0xce')](_0xf93b2c,_0xa2d5e1);var _0xa99814=[];_0xa99814[_0x0f72('0x37')]({'model':db['User'],'as':'User','attributes':['id','fullname'],'raw':!![]});_0xa99814[_0x0f72('0x37')]({'model':db['CmContact'],'as':'Contact','attributes':['id','firstName',_0x0f72('0xd5')],'raw':!![]});if(_0x334540[_0x0f72('0x46')][_0x0f72('0xd3')]){_0xa99814[_0x0f72('0x37')]({'model':db[_0x0f72('0xd6')],'as':_0x0f72('0xd6'),'raw':!![]});}var _0x53490f=[{'model':db['OpenchannelMessage'],'as':_0x0f72('0xd7'),'attributes':['id',_0x0f72('0x79'),_0x0f72('0x7f'),_0x0f72('0xd8'),_0x0f72('0xd9'),'read'],'include':_0xa99814}];_0x53490f[_0x0f72('0x37')]({'model':db[_0x0f72('0xda')],'as':_0x0f72('0xdb'),'attributes':['id','name']});_0x53490f[_0x0f72('0x37')]({'model':db[_0x0f72('0x77')],'as':_0x0f72('0xdc'),'attributes':['id',_0x0f72('0x32')]});return db[_0x0f72('0x40')][_0x0f72('0x67')]({'where':{'id':_0x334540[_0x0f72('0xb8')]['id']},'include':_0x53490f})[_0x0f72('0x29')](handleEntityNotFound(_0x425bc5,null))[_0x0f72('0x29')](function(_0x145142){if(_0x145142){var _0x43806d=_0x145142[_0x0f72('0xdd')]({'plain':!![]});fs['mkdirSync'](_0x3e1822);var _0xa9be96={'channel':_0x0f72('0xde'),'account':_0x43806d[_0x0f72('0xdb')][_0x0f72('0x2e')],'agent':_0x43806d['Owner']?_0x43806d[_0x0f72('0xdc')][_0x0f72('0x32')]:_0x0f72('0xdf'),'createdAt':moment(_0x43806d[_0x0f72('0x7f')])[_0x0f72('0xc4')](_0x0f72('0xc5'))[_0x0f72('0x9e')](),'closedAt':_0x43806d[_0x0f72('0x3d')]?moment(_0x43806d[_0x0f72('0xe0')])[_0x0f72('0xc4')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0f72('0x9e')]():'','disposition':_0x43806d['disposition'],'visibility':_0x43806d[_0x0f72('0xe1')]?_0x0f72('0xe2'):'Private','messages':_(_0x43806d[_0x0f72('0xd7')])[_0x0f72('0x8a')]({'secret':![]})[_0x0f72('0x31')](function(_0x4efb9b){if(_0x4efb9b[_0x0f72('0xd6')]){var _0x24fad9=path[_0x0f72('0xce')](_0x405f08,_0x4efb9b['Attachment']['basename']);if(fs[_0x0f72('0xe3')](_0x24fad9)){fs[_0x0f72('0xe4')](_0x24fad9)[_0x0f72('0xe5')](fs['createWriteStream'](path['join'](_0x3e1822,_0x4efb9b[_0x0f72('0xd6')][_0x0f72('0xe6')])));}}return{'date':moment(_0x4efb9b['createdAt'])[_0x0f72('0xc4')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0f72('0x9e')](),'sender':_0x4efb9b[_0x0f72('0xd8')]==='out'?_0x4efb9b['User']?_0x4efb9b[_0x0f72('0x77')][_0x0f72('0x32')]:_0x0f72('0xe7'):_0x4efb9b[_0x0f72('0xe8')][_0x0f72('0xe9')]+(_0x4efb9b['Contact'][_0x0f72('0xd5')]?'\x20'+_0x4efb9b[_0x0f72('0xe8')][_0x0f72('0xd5')]:''),'body':_0x4efb9b[_0x0f72('0xd6')]?_0x4efb9b[_0x0f72('0xd6')][_0x0f72('0xe6')]:_0x4efb9b['body'],'direction':_0x4efb9b[_0x0f72('0xd8')]===_0x0f72('0xea')?'A':'C','secret':_0x4efb9b[_0x0f72('0xd9')],'read':_0x4efb9b[_0x0f72('0x85')],'attachment':_0x4efb9b[_0x0f72('0xd6')]};})[_0x0f72('0x69')]()};return ejs[_0x0f72('0xeb')](path['join'](config[_0x0f72('0xd1')],_0x0f72('0xcf'),_0x0f72('0xec'),_0x0f72('0xed')),{'interaction':_0xa9be96})[_0x0f72('0x29')](function(_0x5ae601){var _0x17a79f=path[_0x0f72('0xce')](_0x3e1822,'transcript-'+_0x43806d['id']+'-'+_0xe83368+'.pdf');var _0x29aaca={'path':_0x17a79f,'channel':_0x0f72('0xde'),'interactionId':_0x43806d['id']};return pdf[_0x0f72('0xee')](_0x5ae601,_0x29aaca);})[_0x0f72('0x29')](function(){return new BPromise(function(_0x411570,_0x50683a){zipdir(_0x3e1822,{'saveTo':_0x7a9c1d},function(_0x54a593,_0xe6275e){if(_0x54a593)return _0x50683a(_0x54a593);return _0x411570(_0xe6275e);});})[_0x0f72('0x29')](function(){return new BPromise(function(_0x1f5515,_0x346a68){rimraf(_0x3e1822,function(_0x575c39){if(_0x575c39)_0x346a68(_0x575c39);return _0x1f5515();});});})[_0x0f72('0x29')](function(){return _0x425bc5[_0x0f72('0xcc')](_0x7a9c1d,_0xa2d5e1,function(_0x3cb3d6){if(_0x3cb3d6){console[_0x0f72('0xef')](_0x0f72('0xf0'),_0x3cb3d6);}else{fs['unlinkSync'](_0x7a9c1d);}});});});}else{return _0x425bc5[_0x0f72('0x2b')](0xc8);}})['catch'](handleError(_0x425bc5,null));}; \ No newline at end of file +var _0x0be7=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','error','stack','Users','map','fullname','split','forEach','Tags','TagIds','then','catch','talking','answered','total','closed','UserId','waiting','unmanaged','OpenchannelInteraction','fieldName','type','key','model','name','query','filters','intersection','length','hasOwnProperty','nolimit','sort','where','pick','select','field','from','tools_tags','u.id','u.fullname','user_has_openchannel_interactions','left_join','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','find','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','body','keys','compact','isEmpty','concat','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','order','contactName','t.id\x20IN\x20?','resolve','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','fields','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','push','rows','show','params','rawAttributes','includeAll','include','create','update','describe','addMessage','ids','omit','getMessages','findOne','OpenchannelMessage','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','color','emit','removeTags','download','unix','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','CmContact','firstName','Attachment','Messages','direction','Account','Owner','mkdirSync','Openchannel','N.A.','createdAt','disposition','threadId','Public','Private','createReadStream','pipe','createWriteStream','basename','out','System','lastName','secret','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js'];(function(_0x10433c,_0x2e0af3){var _0x1c8836=function(_0x1c4046){while(--_0x1c4046){_0x10433c['push'](_0x10433c['shift']());}};_0x1c8836(++_0x2e0af3);}(_0x0be7,0xee));var _0x70be=function(_0x2fd50d,_0x451276){_0x2fd50d=_0x2fd50d-0x0;var _0x4b161b=_0x0be7[_0x2fd50d];return _0x4b161b;};'use strict';var emlformat=require(_0x70be('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x70be('0x1'));var jsonpatch=require(_0x70be('0x2'));var rp=require(_0x70be('0x3'));var moment=require('moment');var BPromise=require(_0x70be('0x4'));var Mustache=require(_0x70be('0x5'));var util=require(_0x70be('0x6'));var path=require('path');var sox=require(_0x70be('0x7'));var csv=require(_0x70be('0x8'));var ejs=require(_0x70be('0x9'));var fs=require('fs');var fs_extra=require(_0x70be('0xa'));var _=require(_0x70be('0xb'));var squel=require(_0x70be('0xc'));var crypto=require(_0x70be('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x70be('0xe'));var toCsv=require(_0x70be('0x8'));var querystring=require(_0x70be('0xf'));var Papa=require(_0x70be('0x10'));var Redis=require(_0x70be('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x70be('0x12'));var as=require(_0x70be('0x13'));var pdf=require(_0x70be('0x14'));var hardwareService=require(_0x70be('0x15'));var logger=require(_0x70be('0x16'))(_0x70be('0x17'));var utils=require('../../config/utils');var config=require(_0x70be('0x18'));var licenseUtil=require(_0x70be('0x19'));var db=require('../../mysqldb')['db'];config[_0x70be('0x1a')]=_[_0x70be('0x1b')](config[_0x70be('0x1a')],{'host':_0x70be('0x1c'),'port':0x18eb});var socket=require(_0x70be('0x1d'))(new Redis(config[_0x70be('0x1a')]));require(_0x70be('0x1e'))[_0x70be('0x1f')](socket);function respondWithStatusCode(_0xb0338a,_0x1c8fe9){_0x1c8fe9=_0x1c8fe9||0xcc;return function(_0xf798e3){if(_0xf798e3){return _0xb0338a[_0x70be('0x20')](_0x1c8fe9);}return _0xb0338a[_0x70be('0x21')](_0x1c8fe9)[_0x70be('0x22')]();};}function respondWithResult(_0x1e3677,_0x1af172){_0x1af172=_0x1af172||0xc8;return function(_0x185e64){if(_0x185e64){return _0x1e3677['status'](_0x1af172)[_0x70be('0x23')](_0x185e64);}};}function respondWithFilteredResult(_0x5124f4,_0x22e277){return function(_0xeadaa5){if(_0xeadaa5){var _0x1a3051=typeof _0x22e277['offset']===_0x70be('0x24')&&typeof _0x22e277['limit']===_0x70be('0x24');var _0x2e189e=_0xeadaa5['count'];var _0xc032a1=_0x1a3051?0x0:_0x22e277['offset'];var _0x25031c=_0x1a3051?_0xeadaa5[_0x70be('0x25')]:_0x22e277[_0x70be('0x26')]+_0x22e277[_0x70be('0x27')];var _0x5b2c1d;if(_0x25031c>=_0x2e189e){_0x25031c=_0x2e189e;_0x5b2c1d=0xc8;}else{_0x5b2c1d=0xce;}_0x5124f4[_0x70be('0x21')](_0x5b2c1d);return _0x5124f4[_0x70be('0x28')](_0x70be('0x29'),_0xc032a1+'-'+_0x25031c+'/'+_0x2e189e)[_0x70be('0x23')](_0xeadaa5);}return null;};}function patchUpdates(_0x241194){return function(_0x5915ad){try{jsonpatch[_0x70be('0x2a')](_0x5915ad,_0x241194,!![]);}catch(_0x18a184){return BPromise[_0x70be('0x2b')](_0x18a184);}return _0x5915ad[_0x70be('0x2c')]();};}function saveUpdates(_0x168fe0,_0x261048){return function(_0x229e44){if(_0x229e44){return _0x229e44['update'](_0x168fe0)['then'](function(_0x50842b){return _0x50842b;});}return null;};}function removeEntity(_0x279884,_0x519c06){return function(_0x128609){if(_0x128609){return _0x128609[_0x70be('0x2d')]()['then'](function(){_0x279884['status'](0xcc)[_0x70be('0x22')]();});}};}function handleEntityNotFound(_0x172547,_0x94091a){return function(_0x2b147d){if(!_0x2b147d){_0x172547[_0x70be('0x20')](0x194);}return _0x2b147d;};}function handleError(_0x4efd0f,_0x1d951c){_0x1d951c=_0x1d951c||0x1f4;return function(_0x1eb0be){logger[_0x70be('0x2e')](_0x1eb0be[_0x70be('0x2f')]);if(_0x1eb0be['name']){delete _0x1eb0be['name'];}_0x4efd0f[_0x70be('0x21')](_0x1d951c)['send'](_0x1eb0be);};}function getInteractionUsers(_0x54fde0,_0x310f57){return new BPromise(function(_0x58c6c4,_0x1c3ead){try{if(_0x310f57[_0x54fde0['id']]){_0x54fde0[_0x70be('0x30')]=_[_0x70be('0x31')](_0x310f57[_0x54fde0['id']],function(_0x227652){return{'id':_0x227652['id'],'fullname':_0x227652[_0x70be('0x32')]};});}}catch(_0x1c9fdd){_0x1c3ead(_0x1c9fdd);}_0x58c6c4(_0x54fde0);});}function getInteractionTags(_0x175d2e,_0x4af09a){return new BPromise(function(_0x4629be,_0x4a91b3){try{if(_0x175d2e['TagIds']){_0x175d2e['Tags']=[];_0x175d2e['TagIds'][_0x70be('0x33')](',')[_0x70be('0x34')](function(_0x2c1636){_0x175d2e[_0x70be('0x35')]['push'](_0x4af09a[_0x2c1636]);});}delete _0x175d2e[_0x70be('0x36')];}catch(_0x457bc1){_0x4a91b3(_0x457bc1);}_0x4629be(_0x175d2e);});}function updateOpenchannelInteraction(_0x274784,_0x50ff0c,_0x4e4580){return new BPromise(function(_0x491a28,_0x10042f){return getInteractionUsers(_0x274784,_0x4e4580)[_0x70be('0x37')](function(_0x22a2d8){return getInteractionTags(_0x22a2d8,_0x50ff0c);})['then'](function(_0x2e16c1){return getStateInteraction(_0x2e16c1);})[_0x70be('0x37')](function(_0x1919c4){_0x491a28(_0x1919c4);})[_0x70be('0x38')](function(_0x4445bd){_0x10042f(_0x4445bd);});});}function getStateInteraction(_0xb966d4){return new BPromise(function(_0x3650c9){_0xb966d4['waiting']=0x0;_0xb966d4[_0x70be('0x39')]=0x0;_0xb966d4[_0x70be('0x3a')]=0x0;_0xb966d4['unmanaged']=0x0;_0xb966d4[_0x70be('0x3b')]=0x0;if(!_0xb966d4[_0x70be('0x3c')]&&!_0xb966d4['UserId']){_0xb966d4['waiting']+=0x1;}if(!_0xb966d4[_0x70be('0x3c')]&&_0xb966d4[_0x70be('0x3d')]){_0xb966d4['talking']+=0x1;if(_0xb966d4[_0x70be('0x3e')]){_0xb966d4[_0x70be('0x3e')]-=0x1;}}if(_0xb966d4['closed']&&_0xb966d4[_0x70be('0x3d')]){_0xb966d4[_0x70be('0x3a')]+=0x1;if(_0xb966d4[_0x70be('0x39')]){_0xb966d4['talking']-=0x1;}}if(_0xb966d4[_0x70be('0x3c')]&&!_0xb966d4[_0x70be('0x3d')]){_0xb966d4[_0x70be('0x3f')]+=0x1;if(_0xb966d4[_0x70be('0x3e')]){_0xb966d4[_0x70be('0x3e')]-=0x1;}}_0xb966d4['total']+=0x1;_0x3650c9(_0xb966d4);});}exports['index']=function(_0x1fd97e,_0x5f19e2){var _0x2cbdf9={},_0x32294e={},_0x19ae48={'count':0x0,'rows':[]};var _0xcb614a=_[_0x70be('0x31')](db[_0x70be('0x40')]['rawAttributes'],function(_0x38b67e){return{'name':_0x38b67e[_0x70be('0x41')],'type':_0x38b67e[_0x70be('0x42')][_0x70be('0x43')]};});_0x32294e[_0x70be('0x44')]=_[_0x70be('0x31')](_0xcb614a,_0x70be('0x45'));_0x32294e[_0x70be('0x46')]=_['keys'](_0x1fd97e[_0x70be('0x46')]);_0x32294e[_0x70be('0x47')]=_[_0x70be('0x48')](_0x32294e[_0x70be('0x44')],_0x32294e[_0x70be('0x46')]);_0x2cbdf9['attributes']=_[_0x70be('0x48')](_0x32294e[_0x70be('0x44')],qs['fields'](_0x1fd97e[_0x70be('0x46')]['fields']));_0x2cbdf9['attributes']=_0x2cbdf9['attributes'][_0x70be('0x49')]?_0x2cbdf9['attributes']:_0x32294e['model'];if(!_0x1fd97e[_0x70be('0x46')][_0x70be('0x4a')](_0x70be('0x4b'))){_0x2cbdf9[_0x70be('0x27')]=qs[_0x70be('0x27')](_0x1fd97e[_0x70be('0x46')]['limit']);_0x2cbdf9[_0x70be('0x26')]=qs['offset'](_0x1fd97e[_0x70be('0x46')][_0x70be('0x26')]);}_0x2cbdf9['order']=qs['sort'](_0x1fd97e[_0x70be('0x46')][_0x70be('0x4c')]);_0x2cbdf9[_0x70be('0x4d')]=qs[_0x70be('0x47')](_[_0x70be('0x4e')](_0x1fd97e[_0x70be('0x46')],_0x32294e[_0x70be('0x47')]),_0xcb614a);var _0x60570d=[];var _0x47b5b1=squel[_0x70be('0x4f')]()[_0x70be('0x50')]('id')['field'](_0x70be('0x45'))[_0x70be('0x50')]('color')[_0x70be('0x51')](_0x70be('0x52'));var _0x3a38e5=squel['select']()[_0x70be('0x50')](_0x70be('0x53'))[_0x70be('0x50')](_0x70be('0x54'))[_0x70be('0x50')]('ui.OpenchannelInteractionId')['from'](_0x70be('0x55'),'ui')[_0x70be('0x56')]('users','u',_0x70be('0x57'));var _0x52a06a=squel[_0x70be('0x4f')]()[_0x70be('0x51')](_0x70be('0x58'),'i')[_0x70be('0x56')](_0x70be('0x59'),'c',_0x70be('0x5a'))['left_join'](_0x70be('0x5b'),'o',_0x70be('0x5c'))['left_join'](_0x70be('0x5d'),'a',_0x70be('0x5e'))[_0x70be('0x56')](_0x70be('0x5f'),'me',_0x70be('0x60'))['left_join'](_0x70be('0x61'),'it',_0x70be('0x62'))[_0x70be('0x56')](_0x70be('0x52'),'t',_0x70be('0x63'));var _0x2591c8=squel[_0x70be('0x64')]();var _0x36f855=[];var _0x503c07=squel[_0x70be('0x64')]();var _0x4c36d9;if(_0x1fd97e[_0x70be('0x46')][_0x70be('0x65')]){_0x4c36d9=as[_0x70be('0x66')](_0x1fd97e['query'][_0x70be('0x65')]);var _0x27e74e=_0x4c36d9['sqlOperator'];for(var _0x20ce8c=0x0;_0x20ce8c<_0x4c36d9[_0x70be('0x67')]['length'];_0x20ce8c++){var _0x5cb51f=_0x4c36d9[_0x70be('0x67')][_0x20ce8c];var _0x4ed2d3='i';var _0x2c11ec=_['find'](_0xcb614a,['name',_0x5cb51f[_0x70be('0x50')]]);if(!_0x2c11ec){switch(_0x5cb51f[_0x70be('0x50')]){case _0x70be('0x68'):if(_0x5cb51f[_0x70be('0x69')]==0x1){_0x52a06a[_0x70be('0x6a')]('`'+_0x5cb51f['field']+'`\x20=\x200');}else{_0x52a06a[_0x70be('0x6a')]('`'+_0x5cb51f[_0x70be('0x50')]+_0x70be('0x6b'));}break;case _0x70be('0x6c'):if(_0x5cb51f[_0x70be('0x6d')]===_0x70be('0x6e')){if(_0x5cb51f[_0x70be('0x69')][_0x70be('0x33')]('\x20')[_0x70be('0x49')]>0x1){_0x2591c8[_0x27e74e](_0x70be('0x6f'),qs[_0x70be('0x70')](_0x5cb51f[_0x70be('0x69')]),null);}else{var _0xbffb66='%'+_0x5cb51f['value']+'%';_0x2591c8[_0x27e74e]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0xbffb66,_0xbffb66,_0xbffb66);}}else{_0x2c11ec=_[_0x70be('0x71')](_0xcb614a,[_0x70be('0x45'),_0x70be('0x72')]);_0x5cb51f['field']='ContactId';_0x5d94a7=as['buildExpression'](_0x4ed2d3,_0x2c11ec['type'],_0x5cb51f);_0x2591c8[_0x27e74e](_0x5d94a7[_0x70be('0x73')],_0x5d94a7[_0x70be('0x69')][_0x70be('0x74')],_0x5d94a7[_0x70be('0x69')][_0x70be('0x22')]);}break;case _0x70be('0x75'):var _0x4d5d6f=_0x5cb51f['value'][_0x70be('0x33')](',')['map'](function(_0x49d9df){return Number(_0x49d9df);});_0x4d5d6f[_0x70be('0x34')](function(_0x371b15){_0x503c07['or'](_0x70be('0x76'),'%,'+_0x371b15+',%');});_0x36f855=_[_0x70be('0x77')](_0x36f855,_0x4d5d6f);break;case _0x70be('0x78'):if(_0x5cb51f[_0x70be('0x6d')]===_0x70be('0x6e')){_0x2591c8[_0x27e74e](_0x70be('0x79'),'%'+_0x5cb51f[_0x70be('0x69')]+'%',null);}else{_0x2c11ec=_['find'](_0xcb614a,['name',_0x70be('0x3d')]);_0x5cb51f[_0x70be('0x50')]=_0x70be('0x3d');_0x5d94a7=as[_0x70be('0x7a')](_0x4ed2d3,_0x2c11ec[_0x70be('0x42')],_0x5cb51f);_0x2591c8[_0x27e74e](_0x5d94a7[_0x70be('0x73')],_0x5d94a7['value'][_0x70be('0x74')],_0x5d94a7[_0x70be('0x69')][_0x70be('0x22')]);}break;case _0x70be('0x7b'):_0x5d94a7=as[_0x70be('0x7a')]('me',null,_0x5cb51f);_0x2591c8[_0x27e74e](_0x5d94a7[_0x70be('0x73')],_0x5d94a7[_0x70be('0x69')][_0x70be('0x74')],_0x5d94a7['value'][_0x70be('0x22')]);break;}}else{var _0x5d94a7=as[_0x70be('0x7a')](_0x4ed2d3,_0x2c11ec['type'],_0x5cb51f);_0x2591c8[_0x27e74e](_0x5d94a7[_0x70be('0x73')],_0x5d94a7[_0x70be('0x69')][_0x70be('0x74')],_0x5d94a7[_0x70be('0x69')][_0x70be('0x22')]);}}}else{var _0x38b69f=_(_0x1fd97e[_0x70be('0x46')])[_0x70be('0x7c')]()[_0x70be('0x31')](function(_0x79e018){return _['some'](_0xcb614a,[_0x70be('0x45'),_0x79e018])?_0x79e018:undefined;})[_0x70be('0x7d')]()[_0x70be('0x69')]();if(!_[_0x70be('0x7e')](_0x38b69f)){_0x38b69f[_0x70be('0x34')](function(_0x122624){if(_0x122624==='OpenchannelAccountId'){_0x52a06a[_0x70be('0x4d')]('i.OpenchannelAccountId\x20IN\x20?',[][_0x70be('0x7f')](_0x1fd97e[_0x70be('0x46')][_0x122624]));}else if(_0x122624==='createdAt'){var _0x39010d=JSON[_0x70be('0x80')](_0x1fd97e[_0x70be('0x46')][_0x122624])[_0x70be('0x81')];var _0x29bdf7=JSON['parse'](_0x1fd97e[_0x70be('0x46')][_0x122624])[_0x70be('0x82')];_0x52a06a[_0x70be('0x4d')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x39010d,_0x29bdf7);}else{if(_0x1fd97e[_0x70be('0x46')][_0x122624]===_0x70be('0x83')){_0x52a06a[_0x70be('0x4d')]('i.'+_0x122624+_0x70be('0x84'));}else{_0x52a06a[_0x70be('0x4d')]('i.'+_0x122624+_0x70be('0x85'),_0x1fd97e[_0x70be('0x46')][_0x122624]);}}});}if(_0x1fd97e['query']['read']){if(_0x1fd97e[_0x70be('0x46')][_0x70be('0x86')]==0x1){_0x52a06a[_0x70be('0x6a')]('`unreadMessages`\x20=\x200');}else{_0x52a06a[_0x70be('0x6a')](_0x70be('0x87'));}}if(_0x1fd97e[_0x70be('0x46')][_0x70be('0x88')]){_0x36f855=_[_0x70be('0x89')](_0x1fd97e[_0x70be('0x46')][_0x70be('0x88')])?_0x1fd97e[_0x70be('0x46')][_0x70be('0x88')]:new Array(_0x1fd97e[_0x70be('0x46')][_0x70be('0x88')]);_0x36f855[_0x70be('0x34')](function(_0x432edf){_0x503c07['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x432edf+',%');});}if(_0x1fd97e['query'][_0x70be('0x8a')]){var _0x473260=_0x1fd97e['query'][_0x70be('0x8a')][_0x70be('0x8b')]('\x5c','\x5c\x5c')[_0x70be('0x8b')](/'/g,'\x27\x27');if(qs[_0x70be('0x8c')](_0x473260)){_0x2591c8['or'](_0x70be('0x8d'),_0x473260+'%');}else{_0x2591c8['or'](_0x70be('0x8e'),qs['getFullTextValue'](_0x473260))['or'](_0x70be('0x8f'),_0x473260+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x473260+'%');}}}_0x52a06a[_0x70be('0x4d')](_0x2591c8);_0x52a06a[_0x70be('0x90')](_0x70be('0x91'));var _0x87be15={'type':db[_0x70be('0x92')][_0x70be('0x93')][_0x70be('0x94')],'raw':!![]};var _0x222823=_0x52a06a[_0x70be('0x95')]();_0x222823[_0x70be('0x50')]('i.id');_0x222823[_0x70be('0x50')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x70be('0x68'));if(_0x2cbdf9[_0x70be('0x96')]){_0x2cbdf9['order'][_0x70be('0x34')](function(_0x1ec107){var _0xe7548e=_0x1ec107[0x0]===_0x70be('0x97')?_0x1ec107[0x0]:'i.'+_0x1ec107[0x0];_0x52a06a[_0x70be('0x96')](_0xe7548e,_0x1ec107[0x1]==='DESC'?![]:!![]);});}if(!_[_0x70be('0x7e')](_0x36f855)){_0x52a06a['having'](_0x503c07);_0x222823[_0x70be('0x4d')](_0x70be('0x98'),_0x36f855);}BPromise[_0x70be('0x99')]()['then'](function(){if(!_0x4c36d9){if(_0x1fd97e[_0x70be('0x46')][_0x70be('0x9a')])return;_0x222823[_0x70be('0x4d')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x52a06a[_0x70be('0x4d')](_0x70be('0x9b'));return;}if(_0x1fd97e['user'][_0x70be('0x9c')]!==_0x70be('0x9d'))return;return _0x1fd97e[_0x70be('0x9e')][_0x70be('0x9f')]({'attributes':['id'],'raw':!![]})[_0x70be('0x37')](function(_0x424a73){if(_['isEmpty'](_0x424a73)){_0x222823[_0x70be('0x4d')](_0x70be('0xa0'));_0x52a06a[_0x70be('0x4d')](_0x70be('0xa0'));}else{_0x222823['where']('i.OpenchannelAccountId\x20IN\x20?',_[_0x70be('0x31')](_0x424a73,'id'));_0x52a06a[_0x70be('0x4d')](_0x70be('0xa1'),_[_0x70be('0x31')](_0x424a73,'id'));}});})[_0x70be('0x37')](function(){if(_0x1fd97e[_0x70be('0x9e')][_0x70be('0x9c')]==='agent'&&!_0x4c36d9&&!_0x1fd97e['query'][_0x70be('0x9a')])return[];return db['sequelize']['query'](_0x222823['toString'](),_0x87be15);})['then'](function(_0x556492){_0x19ae48[_0x70be('0x25')]=_0x556492['length'];if(_0x19ae48['count']===0x0)return[];return db[_0x70be('0xa2')][_0x70be('0x46')](_0x47b5b1[_0x70be('0xa3')](),_0x87be15)[_0x70be('0x37')](function(_0x4bb348){_0x60570d=_[_0x70be('0xa4')](_0x4bb348,'id');_0x87be15=_[_0x70be('0xa5')](_0x87be15,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1fd97e[_0x70be('0x46')][_0x70be('0xa6')]){_0x2cbdf9[_0x70be('0xa7')][_0x70be('0x34')](function(_0xeddec0){_0x52a06a[_0x70be('0x50')]('i.'+_0xeddec0);});}else{_0x52a06a['field'](_0x70be('0xa8'),_0x70be('0x68'));_0x52a06a[_0x70be('0x50')]('a.key','Account.key');_0x52a06a[_0x70be('0x50')](_0x70be('0xa9'),_0x70be('0xaa'));_0x52a06a[_0x70be('0x50')](_0x70be('0xab'),'contactName');_0x52a06a[_0x70be('0x50')](_0x70be('0xac'));_0x52a06a['field']('c.firstName','Contact.firstName');_0x52a06a[_0x70be('0x50')](_0x70be('0xad'),_0x70be('0xae'));_0x52a06a['field']('c.email',_0x70be('0xaf'));_0x52a06a[_0x70be('0x50')](_0x70be('0xb0'),_0x70be('0xb1'));_0x52a06a[_0x70be('0x50')](_0x70be('0xb2'),_0x70be('0xb3'));_0x52a06a[_0x70be('0x50')](_0x70be('0xb4'),_0x70be('0xb5'));_0x52a06a[_0x70be('0x50')]('o.fullname',_0x70be('0xb6'));_0x52a06a[_0x70be('0x50')](_0x70be('0xb7'),_0x70be('0xb8'));_0x52a06a['field'](_0x70be('0xb9'),_0x70be('0x36'));}if(_0x2cbdf9['limit'])_0x52a06a[_0x70be('0x27')](_0x2cbdf9[_0x70be('0x27')]);if(_0x2cbdf9[_0x70be('0x26')])_0x52a06a[_0x70be('0x26')](_0x2cbdf9[_0x70be('0x26')]);return db[_0x70be('0xa2')]['query'](_0x52a06a['toString'](),_0x87be15);})[_0x70be('0x37')](function(_0x6e250e){if(_0x6e250e[_0x70be('0x49')]>0x0)_0x3a38e5[_0x70be('0x4d')](_0x70be('0xba'),_[_0x70be('0x31')](_0x6e250e,'id'));return db[_0x70be('0xa2')][_0x70be('0x46')](_0x3a38e5['toString'](),_0x87be15)['then'](function(_0xed8a8c){var _0x16ab0c=_[_0x70be('0xbb')](_0xed8a8c,_0x70be('0xbc'));var _0x26fd71=[];_0x6e250e[_0x70be('0x34')](function(_0x4a6e47){_0x26fd71[_0x70be('0xbd')](updateOpenchannelInteraction(_0x4a6e47,_0x60570d,_0x16ab0c));});return BPromise['all'](_0x26fd71);});});})[_0x70be('0x37')](function(_0x3260ea){_0x19ae48[_0x70be('0xbe')]=_0x3260ea;return _0x19ae48;})['then'](respondWithFilteredResult(_0x5f19e2,_0x2cbdf9))[_0x70be('0x38')](handleError(_0x5f19e2,null));};exports[_0x70be('0xbf')]=function(_0x351122,_0x5d9fda){var _0x53726a={};if(_0x351122[_0x70be('0x46')][_0x70be('0x42')]&&_0x351122[_0x70be('0x46')][_0x70be('0x42')]===_0x70be('0x51')){_0x53726a[_0x70be('0x51')]=_0x351122['params']['id'];}else{_0x53726a['id']=_0x351122[_0x70be('0xc0')]['id'];}var _0x226a2c={'raw':![],'where':_0x53726a},_0x5c8c02={};_0x5c8c02[_0x70be('0x44')]=_['keys'](db['OpenchannelInteraction'][_0x70be('0xc1')]);_0x5c8c02['query']=_['keys'](_0x351122[_0x70be('0x46')]);_0x5c8c02[_0x70be('0x47')]=_[_0x70be('0x48')](_0x5c8c02[_0x70be('0x44')],_0x5c8c02[_0x70be('0x46')]);_0x226a2c[_0x70be('0xa7')]=_['intersection'](_0x5c8c02[_0x70be('0x44')],qs[_0x70be('0xa6')](_0x351122[_0x70be('0x46')][_0x70be('0xa6')]));_0x226a2c[_0x70be('0xa7')]=_0x226a2c['attributes'][_0x70be('0x49')]?_0x226a2c[_0x70be('0xa7')]:_0x5c8c02[_0x70be('0x44')];if(_0x351122[_0x70be('0x46')][_0x70be('0xc2')]){_0x226a2c[_0x70be('0xc3')]=[{'all':!![]}];}_0x226a2c=_[_0x70be('0xa5')]({},_0x226a2c,_0x351122['options']);return db[_0x70be('0x40')][_0x70be('0x71')](_0x226a2c)[_0x70be('0x37')](handleEntityNotFound(_0x5d9fda,null))['then'](respondWithResult(_0x5d9fda,null))[_0x70be('0x38')](handleError(_0x5d9fda,null));};exports['create']=function(_0x356120,_0x576a6b){return db[_0x70be('0x40')][_0x70be('0xc4')](_0x356120['body'],{})[_0x70be('0x37')](respondWithResult(_0x576a6b,0xc9))[_0x70be('0x38')](handleError(_0x576a6b,null));};exports[_0x70be('0xc5')]=function(_0x397372,_0x228040){if(_0x397372[_0x70be('0x7b')]['id']){delete _0x397372[_0x70be('0x7b')]['id'];}return db['OpenchannelInteraction'][_0x70be('0x71')]({'where':{'id':_0x397372[_0x70be('0xc0')]['id']}})['then'](handleEntityNotFound(_0x228040,null))['then'](saveUpdates(_0x397372[_0x70be('0x7b')],null))[_0x70be('0x37')](respondWithResult(_0x228040,null))['catch'](handleError(_0x228040,null));};exports[_0x70be('0x2d')]=function(_0x54cc9c,_0xf6781a){return db[_0x70be('0x40')][_0x70be('0x71')]({'where':{'id':_0x54cc9c[_0x70be('0xc0')]['id']}})[_0x70be('0x37')](handleEntityNotFound(_0xf6781a,null))[_0x70be('0x37')](removeEntity(_0xf6781a,null))[_0x70be('0x38')](handleError(_0xf6781a,null));};exports[_0x70be('0xc6')]=function(_0x459a7e,_0x56f270){return db['OpenchannelInteraction'][_0x70be('0xc6')]()[_0x70be('0x37')](respondWithResult(_0x56f270,null))['catch'](handleError(_0x56f270,null));};exports[_0x70be('0xc7')]=function(_0x105c84,_0x1a2671,_0x5b2928){return db['OpenchannelMessage'][_0x70be('0x71')]({'where':{'id':_0x105c84[_0x70be('0xc0')]['id']}})['then'](handleEntityNotFound(_0x1a2671,null))[_0x70be('0x37')](function(_0xcfd523){if(_0xcfd523){return _0xcfd523[_0x70be('0xc7')](_0x105c84[_0x70be('0x7b')][_0x70be('0xc8')],_[_0x70be('0xc9')](_0x105c84[_0x70be('0x7b')],[_0x70be('0xc8'),'id'])||{});}})['then'](respondWithResult(_0x1a2671,null))[_0x70be('0x38')](handleError(_0x1a2671,null));};exports[_0x70be('0xca')]=function(_0x878546,_0x284c81,_0x24a4f2){var _0x2939a5={'raw':![],'where':{}};var _0x467257={};var _0x3933f0={'count':0x0,'rows':[]};return db[_0x70be('0x40')][_0x70be('0xcb')]({'where':{'id':_0x878546['params']['id']}})[_0x70be('0x37')](handleEntityNotFound(_0x284c81,null))[_0x70be('0x37')](function(_0x3bdc07){if(_0x3bdc07){_0x467257[_0x70be('0x44')]=_[_0x70be('0x7c')](db[_0x70be('0xcc')][_0x70be('0xc1')]);_0x467257[_0x70be('0x46')]=_['keys'](_0x878546[_0x70be('0x46')]);_0x467257[_0x70be('0x47')]=_['intersection'](_0x467257[_0x70be('0x44')],_0x467257[_0x70be('0x46')]);_0x2939a5[_0x70be('0xa7')]=_[_0x70be('0x48')](_0x467257[_0x70be('0x44')],qs[_0x70be('0xa6')](_0x878546['query'][_0x70be('0xa6')]));_0x2939a5['attributes']=_0x2939a5[_0x70be('0xa7')][_0x70be('0x49')]?_0x2939a5['attributes']:_0x467257['model'];if(!_0x878546[_0x70be('0x46')][_0x70be('0x4a')](_0x70be('0x4b'))){_0x2939a5['limit']=qs[_0x70be('0x27')](_0x878546[_0x70be('0x46')][_0x70be('0x27')]);_0x2939a5[_0x70be('0x26')]=qs[_0x70be('0x26')](_0x878546[_0x70be('0x46')][_0x70be('0x26')]);}_0x2939a5['order']=qs[_0x70be('0x4c')](_0x878546[_0x70be('0x46')]['sort']);_0x2939a5[_0x70be('0x4d')]=qs[_0x70be('0x47')](_[_0x70be('0x4e')](_0x878546[_0x70be('0x46')],_0x467257[_0x70be('0x47')]));_0x2939a5[_0x70be('0x4d')]['OpenchannelInteractionId']=_0x3bdc07['id'];if(_0x878546[_0x70be('0x46')][_0x70be('0x8a')]){_0x2939a5[_0x70be('0x4d')]=_[_0x70be('0xa5')](_0x2939a5['where'],{'$or':_['map'](_0x2939a5['attributes'],function(_0x287f8a){var _0x191b38={};_0x191b38[_0x287f8a]={'$like':'%'+_0x878546[_0x70be('0x46')][_0x70be('0x8a')]+'%'};return _0x191b38;})});}if(_0x878546[_0x70be('0x46')][_0x70be('0x81')]){var _0xe03b3b=_0x878546[_0x70be('0x46')][_0x70be('0x81')]['split'](',');var _0x127f6f={};_0x127f6f[_0xe03b3b[0x0]]={'$gte':moment(_0xe03b3b[0x1])[_0x70be('0xcd')](_0x70be('0xce'))};_0x2939a5[_0x70be('0x4d')]=_[_0x70be('0xa5')](_0x2939a5[_0x70be('0x4d')],_0x127f6f);}_0x2939a5=_[_0x70be('0xa5')]({},_0x2939a5,_0x878546['options']);return db[_0x70be('0xcc')][_0x70be('0x25')]({'where':_0x2939a5[_0x70be('0x4d')]})[_0x70be('0x37')](function(_0x176d9a){_0x3933f0[_0x70be('0x25')]=_0x176d9a;if(_0x878546[_0x70be('0x46')][_0x70be('0xc2')]){_0x2939a5[_0x70be('0xc3')]=[{'all':!![]}];}return db[_0x70be('0xcc')][_0x70be('0xcf')](_0x2939a5);})[_0x70be('0x37')](function(_0x76fa79){_0x3933f0[_0x70be('0xbe')]=_0x76fa79;return _0x3933f0;});}})['then'](respondWithFilteredResult(_0x284c81,_0x2939a5))[_0x70be('0x38')](handleError(_0x284c81,null));};exports[_0x70be('0xd0')]=function(_0x5ae418,_0x217b51,_0x13b6e4){return db['OpenchannelInteraction']['find']({'where':{'id':_0x5ae418[_0x70be('0xc0')]['id']}})[_0x70be('0x37')](handleEntityNotFound(_0x217b51,null))[_0x70be('0x37')](function(_0x14e35a){if(_0x14e35a){return _0x14e35a[_0x70be('0xd1')](_0x5ae418[_0x70be('0x7b')][_0x70be('0xc8')],_[_0x70be('0xc9')](_0x5ae418['body'],['ids','id'])||{})[_0x70be('0xd2')](function(){return db[_0x70be('0x75')][_0x70be('0xcf')]({'attributes':['id','name',_0x70be('0xd3')],'where':{'id':_0x5ae418['body']['ids']}});})[_0x70be('0x37')](function(_0x5c94a6){socket[_0x70be('0xd4')]('openchannelInteractionTags:save',{'id':Number(_0x5ae418['params']['id']),'tags':_0x5c94a6||[]});return{'id':Number(_0x5ae418['params']['id']),'tags':_0x5c94a6||[]};});}})[_0x70be('0x37')](respondWithResult(_0x217b51,null))[_0x70be('0x38')](handleError(_0x217b51,null));};exports[_0x70be('0xd5')]=function(_0x25b95d,_0x3d8055,_0x1a4db2){return db[_0x70be('0x40')][_0x70be('0x71')]({'where':{'id':_0x25b95d['params']['id']}})[_0x70be('0x37')](handleEntityNotFound(_0x3d8055,null))['then'](function(_0x4a9375){if(_0x4a9375){return _0x4a9375['removeTags'](_0x25b95d[_0x70be('0x46')][_0x70be('0xc8')]);}})[_0x70be('0x37')](respondWithStatusCode(_0x3d8055,null))[_0x70be('0x38')](handleError(_0x3d8055,null));};exports[_0x70be('0xd6')]=function(_0x5e4415,_0x198657){var _0x4ef685=moment()[_0x70be('0xd7')]()['toString']();var _0x104564=path[_0x70be('0xd8')](config[_0x70be('0xd9')],_0x70be('0xda'),'files',_0x70be('0xdb'));var _0x444dfb=path[_0x70be('0xd8')](config[_0x70be('0xd9')],_0x70be('0xda'),_0x70be('0xdc'),_0x70be('0xdd'));var _0x55ac4c=path['join'](_0x104564,_0x4ef685);var _0x461c55=util['format'](_0x70be('0xde'),_0x5e4415[_0x70be('0xc0')]['id'],_0x4ef685);var _0x5ea30c=path[_0x70be('0xd8')](_0x104564,_0x461c55);var _0x583793=[];_0x583793[_0x70be('0xbd')]({'model':db[_0x70be('0x78')],'as':_0x70be('0x78'),'attributes':['id',_0x70be('0x32')],'raw':!![]});_0x583793[_0x70be('0xbd')]({'model':db[_0x70be('0xdf')],'as':_0x70be('0x6c'),'attributes':['id',_0x70be('0xe0'),'lastName'],'raw':!![]});if(_0x5e4415['query'][_0x70be('0xdd')]){_0x583793[_0x70be('0xbd')]({'model':db[_0x70be('0xe1')],'as':'Attachment','raw':!![]});}var _0x563a8e=[{'model':db[_0x70be('0xcc')],'as':_0x70be('0xe2'),'attributes':['id',_0x70be('0x7b'),'createdAt',_0x70be('0xe3'),'secret','read'],'include':_0x583793}];_0x563a8e[_0x70be('0xbd')]({'model':db['OpenchannelAccount'],'as':_0x70be('0xe4'),'attributes':['id',_0x70be('0x45')]});_0x563a8e[_0x70be('0xbd')]({'model':db[_0x70be('0x78')],'as':_0x70be('0xe5'),'attributes':['id','fullname']});return db[_0x70be('0x40')][_0x70be('0x71')]({'where':{'id':_0x5e4415['params']['id']},'include':_0x563a8e})['then'](handleEntityNotFound(_0x198657,null))[_0x70be('0x37')](function(_0xbc4d08){if(_0xbc4d08){var _0x46fcca=_0xbc4d08['get']({'plain':!![]});fs[_0x70be('0xe6')](_0x55ac4c);var _0x20e2a0={'channel':_0x70be('0xe7'),'account':_0x46fcca['Account'][_0x70be('0x45')],'agent':_0x46fcca[_0x70be('0xe5')]?_0x46fcca[_0x70be('0xe5')][_0x70be('0x32')]:_0x70be('0xe8'),'createdAt':moment(_0x46fcca[_0x70be('0xe9')])[_0x70be('0xcd')](_0x70be('0xce'))[_0x70be('0xa3')](),'closedAt':_0x46fcca[_0x70be('0x3c')]?moment(_0x46fcca['closedAt'])[_0x70be('0xcd')]('YYYY-MM-DD\x20HH:mm:ss')[_0x70be('0xa3')]():'','disposition':_0x46fcca[_0x70be('0xea')],'visibility':_0x46fcca[_0x70be('0xeb')]?_0x70be('0xec'):_0x70be('0xed'),'messages':_(_0x46fcca[_0x70be('0xe2')])[_0x70be('0x8a')]({'secret':![]})['map'](function(_0x1d9664){if(_0x1d9664[_0x70be('0xe1')]){var _0x56a33e=path['join'](_0x444dfb,_0x1d9664[_0x70be('0xe1')]['basename']);if(fs['existsSync'](_0x56a33e)){fs[_0x70be('0xee')](_0x56a33e)[_0x70be('0xef')](fs[_0x70be('0xf0')](path['join'](_0x55ac4c,_0x1d9664['Attachment'][_0x70be('0xf1')])));}}return{'date':moment(_0x1d9664[_0x70be('0xe9')])[_0x70be('0xcd')](_0x70be('0xce'))[_0x70be('0xa3')](),'sender':_0x1d9664[_0x70be('0xe3')]===_0x70be('0xf2')?_0x1d9664[_0x70be('0x78')]?_0x1d9664['User'][_0x70be('0x32')]:_0x70be('0xf3'):_0x1d9664['Contact'][_0x70be('0xe0')]+(_0x1d9664[_0x70be('0x6c')][_0x70be('0xf4')]?'\x20'+_0x1d9664['Contact'][_0x70be('0xf4')]:''),'body':_0x1d9664[_0x70be('0xe1')]?_0x1d9664[_0x70be('0xe1')]['basename']:_0x1d9664[_0x70be('0x7b')],'direction':_0x1d9664[_0x70be('0xe3')]===_0x70be('0xf2')?'A':'C','secret':_0x1d9664[_0x70be('0xf5')],'read':_0x1d9664[_0x70be('0x86')],'attachment':_0x1d9664[_0x70be('0xe1')]};})[_0x70be('0x69')]()};return ejs['renderFile'](path[_0x70be('0xd8')](config[_0x70be('0xd9')],_0x70be('0xda'),_0x70be('0xf6'),_0x70be('0xf7')),{'interaction':_0x20e2a0})['then'](function(_0x2a9f36){var _0x4f8049=path['join'](_0x55ac4c,'transcript-'+_0x46fcca['id']+'-'+_0x4ef685+_0x70be('0xf8'));var _0x299983={'path':_0x4f8049,'channel':_0x70be('0xe7'),'interactionId':_0x46fcca['id']};return pdf[_0x70be('0xf9')](_0x2a9f36,_0x299983);})['then'](function(){return new BPromise(function(_0x5c6406,_0x1ecf29){zipdir(_0x55ac4c,{'saveTo':_0x5ea30c},function(_0x34e2f3,_0x378c63){if(_0x34e2f3)return _0x1ecf29(_0x34e2f3);return _0x5c6406(_0x378c63);});})[_0x70be('0x37')](function(){return new BPromise(function(_0x278bd3,_0x48f37e){rimraf(_0x55ac4c,function(_0x5d5501){if(_0x5d5501)_0x48f37e(_0x5d5501);return _0x278bd3();});});})['then'](function(){return _0x198657[_0x70be('0xd6')](_0x5ea30c,_0x461c55,function(_0x10366c){if(_0x10366c){console[_0x70be('0xfa')](_0x70be('0xfb'),_0x10366c);}else{fs[_0x70be('0xfc')](_0x5ea30c);}});});});}else{return _0x198657[_0x70be('0x20')](0xc8);}})['catch'](handleError(_0x198657,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index cce9d85..895af1a 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 _0xd715=['then','length','emit','catch','hook','exports','events','OpenchannelInteraction','OpenchannelMessage','save','update','remove','setDataValue','Users','findAll'];(function(_0x198987,_0x17bbd7){var _0x5151b0=function(_0x2efea6){while(--_0x2efea6){_0x198987['push'](_0x198987['shift']());}};_0x5151b0(++_0x17bbd7);}(_0xd715,0x132));var _0x5d71=function(_0x228dbc,_0x1474c0){_0x228dbc=_0x228dbc-0x0;var _0x80efa6=_0xd715[_0x228dbc];return _0x80efa6;};'use strict';var EventEmitter=require(_0x5d71('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x5d71('0x1')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x5d71('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5d71('0x3'),'afterUpdate':_0x5d71('0x4'),'afterDestroy':_0x5d71('0x5')};function emitEvent(_0x4b1299){return function(_0xf1fd25,_0x2eb368,_0xaa7056){_0xf1fd25['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x3d7906){_0xf1fd25[_0x5d71('0x6')](_0x5d71('0x7'),_0x3d7906['map'](function(_0x12d66c){return{'id':_0x12d66c['id']};}));return OpenchannelMessage[_0x5d71('0x8')]({'where':{'OpenchannelInteractionId':_0xf1fd25['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5d71('0x9')](function(_0x253147){_0xf1fd25[_0x5d71('0x6')]('unreadMessages',_0x253147[_0x5d71('0xa')]);OpenchannelInteractionEvents[_0x5d71('0xb')](_0x4b1299+':'+_0xf1fd25['id'],_0xf1fd25);OpenchannelInteractionEvents['emit'](_0x4b1299,_0xf1fd25);_0xaa7056(null);})[_0x5d71('0xc')](_0xaa7056(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x5d71('0xd')](e,emitEvent(event));}}module[_0x5d71('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x4c06=['remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','OpenchannelInteraction','../../mysqldb','setMaxListeners','save'];(function(_0x3bc2d2,_0x2859d7){var _0x163ab9=function(_0x1d1eef){while(--_0x1d1eef){_0x3bc2d2['push'](_0x3bc2d2['shift']());}};_0x163ab9(++_0x2859d7);}(_0x4c06,0x1ac));var _0x64c0=function(_0x574159,_0x952110){_0x574159=_0x574159-0x0;var _0x5dd226=_0x4c06[_0x574159];return _0x5dd226;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require('../../mysqldb')['db'][_0x64c0('0x0')];var OpenchannelMessage=require(_0x64c0('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x64c0('0x2')](0x0);var events={'afterCreate':_0x64c0('0x3'),'afterUpdate':'update','afterDestroy':_0x64c0('0x4')};function emitEvent(_0x2cb5c4){return function(_0x4b2a8c,_0x3836c0,_0x114046){_0x4b2a8c[_0x64c0('0x5')]({'attributes':['id'],'raw':!![]})[_0x64c0('0x6')](function(_0x33fc84){_0x4b2a8c[_0x64c0('0x7')](_0x64c0('0x8'),_0x33fc84['map'](function(_0x38f3a8){return{'id':_0x38f3a8['id']};}));return OpenchannelMessage[_0x64c0('0x9')]({'where':{'OpenchannelInteractionId':_0x4b2a8c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x64c0('0x6')](function(_0x511d60){_0x4b2a8c[_0x64c0('0x7')](_0x64c0('0xa'),_0x511d60[_0x64c0('0xb')]);OpenchannelInteractionEvents[_0x64c0('0xc')](_0x2cb5c4+':'+_0x4b2a8c['id'],_0x4b2a8c);OpenchannelInteractionEvents[_0x64c0('0xc')](_0x2cb5c4,_0x4b2a8c);_0x114046(null);})[_0x64c0('0xd')](_0x114046(null));};}for(var e in events){if(events[_0x64c0('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x64c0('0xf')](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 af686e5..eb6223b 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 _0x3ed6=['bluebird','request-promise','path','rimraf','./openchannelInteraction.attributes','exports','define','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment'];(function(_0x5dff26,_0x505dda){var _0x413230=function(_0x3b67fe){while(--_0x3b67fe){_0x5dff26['push'](_0x5dff26['shift']());}};_0x413230(++_0x505dda);}(_0x3ed6,0x12f));var _0x63ed=function(_0x5f22d0,_0x84c069){_0x5f22d0=_0x5f22d0-0x0;var _0xed7d79=_0x3ed6[_0x5f22d0];return _0xed7d79;};'use strict';var _=require('lodash');var util=require(_0x63ed('0x0'));var logger=require(_0x63ed('0x1'))('api');var moment=require(_0x63ed('0x2'));var BPromise=require(_0x63ed('0x3'));var rp=require(_0x63ed('0x4'));var fs=require('fs');var path=require(_0x63ed('0x5'));var rimraf=require(_0x63ed('0x6'));var config=require('../../config/environment');var attributes=require(_0x63ed('0x7'));module[_0x63ed('0x8')]=function(_0xcf72f6,_0x4f15f1){return _0xcf72f6[_0x63ed('0x9')]('OpenchannelInteraction',attributes,{'tableName':_0x63ed('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x63ed('0xb'),'collate':_0x63ed('0xc'),'hooks':{'beforeUpdate':function(_0x534f25,_0x362f54,_0x9ed038){if(_0x534f25[_0x63ed('0xd')](_0x63ed('0xe'))){_0x534f25[_0x63ed('0xf')]=moment()['format'](_0x63ed('0x10'));}_0x9ed038(null,_0x534f25);}}});}; \ No newline at end of file +var _0x19e7=['request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x19e7,0xd7));var _0x719e=function(_0xdd65b,_0x2b4b71){_0xdd65b=_0xdd65b-0x0;var _0x10cb9a=_0x19e7[_0xdd65b];return _0x10cb9a;};'use strict';var _=require('lodash');var util=require(_0x719e('0x0'));var logger=require(_0x719e('0x1'))(_0x719e('0x2'));var moment=require(_0x719e('0x3'));var BPromise=require(_0x719e('0x4'));var rp=require(_0x719e('0x5'));var fs=require('fs');var path=require(_0x719e('0x6'));var rimraf=require(_0x719e('0x7'));var config=require(_0x719e('0x8'));var attributes=require(_0x719e('0x9'));module[_0x719e('0xa')]=function(_0x5bc651,_0x2f2ba8){return _0x5bc651[_0x719e('0xb')](_0x719e('0xc'),attributes,{'tableName':_0x719e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x719e('0xe'),'collate':_0x719e('0xf'),'hooks':{'beforeUpdate':function(_0x517210,_0x58bd05,_0x5a6c81){if(_0x517210['changed'](_0x719e('0x10'))){_0x517210[_0x719e('0x11')]=moment()[_0x719e('0x12')](_0x719e('0x13'));}_0x5a6c81(null,_0x517210);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 7a6116f..3a59b74 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 _0x8319=['rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x1e3e69,_0x15286b){var _0x28ca76=function(_0x2854fb){while(--_0x2854fb){_0x1e3e69['push'](_0x1e3e69['shift']());}};_0x28ca76(++_0x15286b);}(_0x8319,0x6f));var _0x9831=function(_0x805301,_0x3d4f79){_0x805301=_0x805301-0x0;var _0xbbee84=_0x8319[_0x805301];return _0xbbee84;};'use strict';var _=require(_0x9831('0x0'));var util=require('util');var moment=require(_0x9831('0x1'));var BPromise=require(_0x9831('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9831('0x3'));var db=require(_0x9831('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9831('0x5'))(_0x9831('0x6'));var config=require(_0x9831('0x7'));var jayson=require(_0x9831('0x8'));var client=jayson['client'][_0x9831('0x9')]({'port':0x232a});config[_0x9831('0xa')]=_['defaults'](config[_0x9831('0xa')],{'host':_0x9831('0xb'),'port':0x18eb});var socket=require(_0x9831('0xc'))(new Redis(config[_0x9831('0xa')]));require(_0x9831('0xd'))[_0x9831('0xe')](socket);function respondWithRpcPromise(_0x447b7e,_0x28aab3,_0x3c0685){return new BPromise(function(_0x29ee01,_0x393eda){return client['request'](_0x447b7e,_0x3c0685)[_0x9831('0xf')](function(_0x5c4f8b){logger[_0x9831('0x10')](_0x9831('0x11'),_0x28aab3,_0x9831('0x12'));logger[_0x9831('0x13')](_0x9831('0x14'),_0x28aab3,_0x9831('0x12'),JSON[_0x9831('0x15')](_0x5c4f8b));if(_0x5c4f8b[_0x9831('0x16')]){if(_0x5c4f8b[_0x9831('0x16')]['code']===0x1f4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x28aab3,_0x5c4f8b['error'][_0x9831('0x17')]);return _0x393eda(_0x5c4f8b[_0x9831('0x16')]['message']);}logger[_0x9831('0x16')](_0x9831('0x11'),_0x28aab3,_0x5c4f8b['error'][_0x9831('0x17')]);return _0x29ee01(_0x5c4f8b[_0x9831('0x16')][_0x9831('0x17')]);}else{logger[_0x9831('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0x28aab3,_0x9831('0x12'));_0x29ee01(_0x5c4f8b['result'][_0x9831('0x17')]);}})[_0x9831('0x18')](function(_0x292456){logger[_0x9831('0x16')](_0x9831('0x11'),_0x28aab3,_0x292456);_0x393eda(_0x292456);});});}exports[_0x9831('0x19')]=function(_0x4a83b6){var _0x27149f=this;return new Promise(function(_0x252e74,_0x330215){return db[_0x9831('0x1a')][_0x9831('0x1b')](_0x4a83b6[_0x9831('0x1c')],{'raw':_0x4a83b6[_0x9831('0x1d')]?_0x4a83b6[_0x9831('0x1d')][_0x9831('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a83b6[_0x9831('0x1d')]?_0x4a83b6[_0x9831('0x1d')][_0x9831('0x1f')]||null:null,'attributes':_0x4a83b6[_0x9831('0x1d')]?_0x4a83b6['options']['attributes']||null:null,'limit':_0x4a83b6['options']?_0x4a83b6[_0x9831('0x1d')]['limit']||null:null})[_0x9831('0xf')](function(_0x4d4f17){logger[_0x9831('0x10')](_0x9831('0x19'),_0x4a83b6);logger[_0x9831('0x13')]('UpdateOpenchannelInteraction',_0x4a83b6,JSON[_0x9831('0x15')](_0x4d4f17));_0x252e74(_0x4d4f17);})[_0x9831('0x18')](function(_0x50d041){logger[_0x9831('0x16')](_0x9831('0x19'),_0x50d041['message'],_0x4a83b6);_0x330215(_0x27149f['error'](0x1f4,_0x50d041[_0x9831('0x17')]));});});};exports[_0x9831('0x20')]=function(_0x17db4e){return new Promise(function(_0x2c62ce,_0x4720d0){return db['OpenchannelInteraction'][_0x9831('0x21')]({'where':_0x17db4e[_0x9831('0x1d')]?_0x17db4e['options']['where']||null:null})[_0x9831('0xf')](function(_0x32e40a){if(_0x32e40a){return _0x32e40a[_0x9831('0x22')](_0x17db4e[_0x9831('0x1c')][_0x9831('0x23')],_[_0x9831('0x24')](_0x17db4e[_0x9831('0x1c')],[_0x9831('0x23'),'id'])||{});}})[_0x9831('0x25')](function(_0x343e41){logger[_0x9831('0x10')](_0x9831('0x26'),_0x17db4e);logger[_0x9831('0x13')]('AddTags',_0x17db4e,JSON[_0x9831('0x15')](_0x343e41));_0x2c62ce(_0x343e41);})[_0x9831('0x18')](function(_0x4075f9){logger[_0x9831('0x16')](_0x9831('0x26'),_0x4075f9['message'],_0x17db4e);_0x4720d0(_this['error'](0x1f4,_0x4075f9[_0x9831('0x17')]));});});}; \ No newline at end of file +var _0xaa6f=['error','code','message','request\x20sent','result','catch','update','body','options','raw','where','attributes','then','UpdateOpenchannelInteraction','stringify','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','ids','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','register','info','OpenchannelInteraction,\x20%s,\x20%s','debug'];(function(_0x5a64d1,_0x56f37b){var _0x3a4296=function(_0x361687){while(--_0x361687){_0x5a64d1['push'](_0x5a64d1['shift']());}};_0x3a4296(++_0x56f37b);}(_0xaa6f,0xad));var _0xfaa6=function(_0x110a3a,_0x55065a){_0x110a3a=_0x110a3a-0x0;var _0x370a15=_0xaa6f[_0x110a3a];return _0x370a15;};'use strict';var _=require(_0xfaa6('0x0'));var util=require('util');var moment=require(_0xfaa6('0x1'));var BPromise=require(_0xfaa6('0x2'));var rs=require(_0xfaa6('0x3'));var fs=require('fs');var Redis=require(_0xfaa6('0x4'));var db=require(_0xfaa6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfaa6('0x6'))(_0xfaa6('0x7'));var config=require('../../config/environment');var jayson=require(_0xfaa6('0x8'));var client=jayson[_0xfaa6('0x9')]['http']({'port':0x232a});config[_0xfaa6('0xa')]=_[_0xfaa6('0xb')](config[_0xfaa6('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xfaa6('0xc'))(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0xfaa6('0xd')](socket);function respondWithRpcPromise(_0x439baa,_0xb86ca5,_0x4804bd){return new BPromise(function(_0x24ff58,_0x17cecd){return client['request'](_0x439baa,_0x4804bd)['then'](function(_0x1b777a){logger[_0xfaa6('0xe')](_0xfaa6('0xf'),_0xb86ca5,'request\x20sent');logger[_0xfaa6('0x10')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0xb86ca5,'request\x20sent',JSON['stringify'](_0x1b777a));if(_0x1b777a[_0xfaa6('0x11')]){if(_0x1b777a['error'][_0xfaa6('0x12')]===0x1f4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0xb86ca5,_0x1b777a[_0xfaa6('0x11')]['message']);return _0x17cecd(_0x1b777a[_0xfaa6('0x11')][_0xfaa6('0x13')]);}logger[_0xfaa6('0x11')](_0xfaa6('0xf'),_0xb86ca5,_0x1b777a[_0xfaa6('0x11')][_0xfaa6('0x13')]);return _0x24ff58(_0x1b777a[_0xfaa6('0x11')][_0xfaa6('0x13')]);}else{logger[_0xfaa6('0xe')]('OpenchannelInteraction,\x20%s,\x20%s',_0xb86ca5,_0xfaa6('0x14'));_0x24ff58(_0x1b777a[_0xfaa6('0x15')]['message']);}})[_0xfaa6('0x16')](function(_0x495835){logger[_0xfaa6('0x11')](_0xfaa6('0xf'),_0xb86ca5,_0x495835);_0x17cecd(_0x495835);});});}exports['UpdateOpenchannelInteraction']=function(_0x58bf3e){var _0x276b73=this;return new Promise(function(_0x5d6de0,_0x12e613){return db['OpenchannelInteraction'][_0xfaa6('0x17')](_0x58bf3e[_0xfaa6('0x18')],{'raw':_0x58bf3e[_0xfaa6('0x19')]?_0x58bf3e[_0xfaa6('0x19')][_0xfaa6('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58bf3e[_0xfaa6('0x19')]?_0x58bf3e[_0xfaa6('0x19')][_0xfaa6('0x1b')]||null:null,'attributes':_0x58bf3e[_0xfaa6('0x19')]?_0x58bf3e['options'][_0xfaa6('0x1c')]||null:null,'limit':_0x58bf3e[_0xfaa6('0x19')]?_0x58bf3e['options']['limit']||null:null})[_0xfaa6('0x1d')](function(_0x509216){logger[_0xfaa6('0xe')](_0xfaa6('0x1e'),_0x58bf3e);logger['debug']('UpdateOpenchannelInteraction',_0x58bf3e,JSON[_0xfaa6('0x1f')](_0x509216));_0x5d6de0(_0x509216);})[_0xfaa6('0x16')](function(_0x246133){logger['error']('UpdateOpenchannelInteraction',_0x246133['message'],_0x58bf3e);_0x12e613(_0x276b73[_0xfaa6('0x11')](0x1f4,_0x246133[_0xfaa6('0x13')]));});});};exports[_0xfaa6('0x20')]=function(_0x3eb76c){return new Promise(function(_0x3d7d9a,_0x1a065a){return db[_0xfaa6('0x21')][_0xfaa6('0x22')]({'where':_0x3eb76c['options']?_0x3eb76c[_0xfaa6('0x19')][_0xfaa6('0x1b')]||null:null})['then'](function(_0x28cc51){if(_0x28cc51){return _0x28cc51[_0xfaa6('0x23')](_0x3eb76c[_0xfaa6('0x18')]['ids'],_['omit'](_0x3eb76c[_0xfaa6('0x18')],[_0xfaa6('0x24'),'id'])||{});}})['spread'](function(_0x5c8a94){logger[_0xfaa6('0xe')](_0xfaa6('0x25'),_0x3eb76c);logger[_0xfaa6('0x10')](_0xfaa6('0x25'),_0x3eb76c,JSON[_0xfaa6('0x1f')](_0x5c8a94));_0x3d7d9a(_0x5c8a94);})[_0xfaa6('0x16')](function(_0x35525d){logger['error'](_0xfaa6('0x25'),_0x35525d[_0xfaa6('0x13')],_0x3eb76c);_0x1a065a(_this[_0xfaa6('0x11')](0x1f4,_0x35525d[_0xfaa6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index fbbb727..8c2386c 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 _0xc9aa=['register','openchannelInteraction:','./openchannelInteraction.events','save','update','emit','removeListener'];(function(_0x59c9a1,_0x9e4964){var _0x3d3133=function(_0x3482a8){while(--_0x3482a8){_0x59c9a1['push'](_0x59c9a1['shift']());}};_0x3d3133(++_0x9e4964);}(_0xc9aa,0xdb));var _0xac9a=function(_0x3e6729,_0x16d4af){_0x3e6729=_0x3e6729-0x0;var _0x535bcd=_0xc9aa[_0x3e6729];return _0x535bcd;};'use strict';var OpenchannelInteractionEvents=require(_0xac9a('0x0'));var events=[_0xac9a('0x1'),'remove',_0xac9a('0x2')];function createListener(_0x22d713,_0x4b7bc9){return function(_0x4dc324){_0x4b7bc9[_0xac9a('0x3')](_0x22d713,_0x4dc324);};}function removeListener(_0x26c76f,_0x10d672){return function(){OpenchannelInteractionEvents[_0xac9a('0x4')](_0x26c76f,_0x10d672);};}exports[_0xac9a('0x5')]=function(_0x2a1716){for(var _0x5c9f02=0x0,_0xecb9e7=events['length'];_0x5c9f02<_0xecb9e7;_0x5c9f02++){var _0x532b9e=events[_0x5c9f02];var _0x4b0a76=createListener(_0xac9a('0x6')+_0x532b9e,_0x2a1716);OpenchannelInteractionEvents['on'](_0x532b9e,_0x4b0a76);}}; \ No newline at end of file +var _0x175b=['length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x4ca463,_0x1d341d){var _0x11f4bd=function(_0x5de1e5){while(--_0x5de1e5){_0x4ca463['push'](_0x4ca463['shift']());}};_0x11f4bd(++_0x1d341d);}(_0x175b,0x134));var _0xb175=function(_0x455893,_0x909838){_0x455893=_0x455893-0x0;var _0x3851e8=_0x175b[_0x455893];return _0x3851e8;};'use strict';var OpenchannelInteractionEvents=require(_0xb175('0x0'));var events=[_0xb175('0x1'),_0xb175('0x2'),_0xb175('0x3')];function createListener(_0x1fb5b3,_0x72264b){return function(_0x4a6fbf){_0x72264b[_0xb175('0x4')](_0x1fb5b3,_0x4a6fbf);};}function removeListener(_0x3c7698,_0xec188){return function(){OpenchannelInteractionEvents[_0xb175('0x5')](_0x3c7698,_0xec188);};}exports[_0xb175('0x6')]=function(_0x2c7be6){for(var _0x5714a2=0x0,_0x26cc44=events[_0xb175('0x7')];_0x5714a2<_0x26cc44;_0x5714a2++){var _0x4fdcf2=events[_0x5714a2];var _0x4a94ee=createListener(_0xb175('0x8')+_0x4fdcf2,_0x2c7be6);OpenchannelInteractionEvents['on'](_0x4fdcf2,_0x4a94ee);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 905ed97..fa92d02 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x70e0,0x17b));var _0x070e=function(_0x16267e,_0x4bcac0){_0x16267e=_0x16267e-0x0;var _0x148359=_0x70e0[_0x16267e];return _0x148359;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);module['exports']=router; \ No newline at end of file +var _0x0713=['get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelMessage.controller'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_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'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),interaction[_0x3071('0xf')](_0x3071('0x10'),_0x3071('0x11')),controller['create']);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);router[_0x3071('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x3071('0x14')]);router['put'](_0x3071('0x15'),auth[_0x3071('0x9')](),controller['reject']);router[_0x3071('0x16')]('/:id',auth[_0x3071('0x9')](),controller[_0x3071('0x17')]);module[_0x3071('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 628aa9a..a505332 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 _0x1f81=['sequelize','exports','medium','BOOLEAN','ENUM','out','DATE','STRING','TEXT'];(function(_0x5519c3,_0x488174){var _0x922cc7=function(_0x530054){while(--_0x530054){_0x5519c3['push'](_0x5519c3['shift']());}};_0x922cc7(++_0x488174);}(_0x1f81,0xab));var _0x11f8=function(_0x4de586,_0x183427){_0x4de586=_0x4de586-0x0;var _0x46baf5=_0x1f81[_0x4de586];return _0x46baf5;};'use strict';var Sequelize=require(_0x11f8('0x0'));module[_0x11f8('0x1')]={'body':{'type':Sequelize['TEXT'](_0x11f8('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x11f8('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x11f8('0x4')]('in',_0x11f8('0x5')),'defaultValue':_0x11f8('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x11f8('0x6')]},'providerName':{'type':Sequelize[_0x11f8('0x7')]},'providerResponse':{'type':Sequelize[_0x11f8('0x8')]}}; \ No newline at end of file +var _0x88c3=['DATE','STRING','sequelize','TEXT','BOOLEAN','out'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x88c3,0x1ee));var _0x388c=function(_0x5608ad,_0x254224){_0x5608ad=_0x5608ad-0x0;var _0x572b0a=_0x88c3[_0x5608ad];return _0x572b0a;};'use strict';var Sequelize=require(_0x388c('0x0'));module['exports']={'body':{'type':Sequelize[_0x388c('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x388c('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x388c('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0x388c('0x4')]},'providerName':{'type':Sequelize[_0x388c('0x5')]},'providerResponse':{'type':Sequelize[_0x388c('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 16b5efe..f199464 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 _0x1b64=['to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelMessage.socket','register','client','http','request','then','debug','request\x20sent','stringify','error','code','message','OpenchannelMessage,\x20%s,\x20%s','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','findAll','rows','params','include','options','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','OpenchannelInteraction','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','rejectmessage','eml-format','rimraf','fast-json-patch','mustache','util','path','sox','ejs','fs-extra','jsforce','desk.js'];(function(_0x2a58f6,_0x13961e){var _0x37f349=function(_0x3be41c){while(--_0x3be41c){_0x2a58f6['push'](_0x2a58f6['shift']());}};_0x37f349(++_0x13961e);}(_0x1b64,0x76));var _0x41b6=function(_0x58d19c,_0x1612de){_0x58d19c=_0x58d19c-0x0;var _0x19cdb5=_0x1b64[_0x58d19c];return _0x19cdb5;};'use strict';var emlformat=require(_0x41b6('0x0'));var rimraf=require(_0x41b6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x41b6('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x41b6('0x3'));var util=require(_0x41b6('0x4'));var path=require(_0x41b6('0x5'));var sox=require(_0x41b6('0x6'));var csv=require('to-csv');var ejs=require(_0x41b6('0x7'));var fs=require('fs');var fs_extra=require(_0x41b6('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x41b6('0x9'));var deskjs=require(_0x41b6('0xa'));var toCsv=require(_0x41b6('0xb'));var querystring=require(_0x41b6('0xc'));var Papa=require(_0x41b6('0xd'));var Redis=require(_0x41b6('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x41b6('0xf'));var as=require(_0x41b6('0x10'));var hardwareService=require(_0x41b6('0x11'));var logger=require(_0x41b6('0x12'))(_0x41b6('0x13'));var utils=require(_0x41b6('0x14'));var config=require(_0x41b6('0x15'));var licenseUtil=require(_0x41b6('0x16'));var db=require(_0x41b6('0x17'))['db'];config[_0x41b6('0x18')]=_[_0x41b6('0x19')](config[_0x41b6('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x41b6('0x1a'))(new Redis(config[_0x41b6('0x18')]));require(_0x41b6('0x1b'))[_0x41b6('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x41b6('0x1d')][_0x41b6('0x1e')]({'port':0x232c});var client9002=jayson[_0x41b6('0x1d')][_0x41b6('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1d4441,_0x1bd0b0,_0x30f076,_0x4805de){return new BPromise(function(_0x13ce57,_0xf0d6ae){var _0x1b2500=_0x4805de||client;return _0x1b2500[_0x41b6('0x1f')](_0x1d4441,_0x30f076)[_0x41b6('0x20')](function(_0x47feb9){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x1bd0b0,'request\x20sent');logger[_0x41b6('0x21')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x1bd0b0,_0x41b6('0x22'),JSON[_0x41b6('0x23')](_0x47feb9));if(_0x47feb9[_0x41b6('0x24')]){if(_0x47feb9[_0x41b6('0x24')][_0x41b6('0x25')]===0x1f4){logger[_0x41b6('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x1bd0b0,_0x47feb9['error'][_0x41b6('0x26')]);return _0xf0d6ae(_0x47feb9['error'][_0x41b6('0x26')]);}logger[_0x41b6('0x24')](_0x41b6('0x27'),_0x1bd0b0,_0x47feb9[_0x41b6('0x24')][_0x41b6('0x26')]);return _0x13ce57(_0x47feb9[_0x41b6('0x24')][_0x41b6('0x26')]);}else{logger[_0x41b6('0x28')](_0x41b6('0x27'),_0x1bd0b0,_0x41b6('0x22'));_0x13ce57(_0x47feb9[_0x41b6('0x29')]['message']);}})[_0x41b6('0x2a')](function(_0x2c1290){logger['error'](_0x41b6('0x27'),_0x1bd0b0,_0x2c1290);_0xf0d6ae(_0x2c1290);});});}function respondWithStatusCode(_0x358872,_0x4f98de){_0x4f98de=_0x4f98de||0xcc;return function(_0x22d399){if(_0x22d399){return _0x358872[_0x41b6('0x2b')](_0x4f98de);}return _0x358872[_0x41b6('0x2c')](_0x4f98de)['end']();};}function respondWithResult(_0x40a466,_0x5e431d){_0x5e431d=_0x5e431d||0xc8;return function(_0x49142b){if(_0x49142b){return _0x40a466['status'](_0x5e431d)[_0x41b6('0x2d')](_0x49142b);}};}function respondWithFilteredResult(_0x425c16,_0x5b5ca7){return function(_0x2dee1f){if(_0x2dee1f){var _0x45f9e2=typeof _0x5b5ca7[_0x41b6('0x2e')]===_0x41b6('0x2f')&&typeof _0x5b5ca7[_0x41b6('0x30')]==='undefined';var _0x5a0554=_0x2dee1f[_0x41b6('0x31')];var _0x37bd7a=_0x45f9e2?0x0:_0x5b5ca7[_0x41b6('0x2e')];var _0x56b365=_0x45f9e2?_0x2dee1f[_0x41b6('0x31')]:_0x5b5ca7[_0x41b6('0x2e')]+_0x5b5ca7['limit'];var _0x27a737;if(_0x56b365>=_0x5a0554){_0x56b365=_0x5a0554;_0x27a737=0xc8;}else{_0x27a737=0xce;}_0x425c16[_0x41b6('0x2c')](_0x27a737);return _0x425c16[_0x41b6('0x32')](_0x41b6('0x33'),_0x37bd7a+'-'+_0x56b365+'/'+_0x5a0554)[_0x41b6('0x2d')](_0x2dee1f);}return null;};}function patchUpdates(_0x2ac3a7){return function(_0x1c47b1){try{jsonpatch['apply'](_0x1c47b1,_0x2ac3a7,!![]);}catch(_0x13562f){return BPromise['reject'](_0x13562f);}return _0x1c47b1['save']();};}function saveUpdates(_0x2235fd,_0x4cf4d5){return function(_0x207412){if(_0x207412){return _0x207412[_0x41b6('0x34')](_0x2235fd)[_0x41b6('0x20')](function(_0x435639){return _0x435639;});}return null;};}function removeEntity(_0xc97805,_0x3c5141){return function(_0x420e40){if(_0x420e40){return _0x420e40[_0x41b6('0x35')]()['then'](function(){_0xc97805[_0x41b6('0x2c')](0xcc)[_0x41b6('0x36')]();});}};}function handleEntityNotFound(_0x326e10,_0x459186){return function(_0x13f0ad){if(!_0x13f0ad){_0x326e10[_0x41b6('0x2b')](0x194);}return _0x13f0ad;};}function handleError(_0x462340,_0x58112e){_0x58112e=_0x58112e||0x1f4;return function(_0x69277a){logger['error'](_0x69277a['stack']);if(_0x69277a[_0x41b6('0x37')]){delete _0x69277a[_0x41b6('0x37')];}_0x462340[_0x41b6('0x2c')](_0x58112e)[_0x41b6('0x38')](_0x69277a);};}exports[_0x41b6('0x39')]=function(_0x2291ba,_0x5b7e9d){var _0x19a73e={},_0x4313a5={},_0x2c3f43={'count':0x0,'rows':[]};var _0x442ec7=_[_0x41b6('0x3a')](db[_0x41b6('0x3b')][_0x41b6('0x3c')],function(_0x565ff8){return{'name':_0x565ff8[_0x41b6('0x3d')],'type':_0x565ff8[_0x41b6('0x3e')][_0x41b6('0x3f')]};});_0x4313a5[_0x41b6('0x40')]=_[_0x41b6('0x3a')](_0x442ec7,_0x41b6('0x37'));_0x4313a5[_0x41b6('0x41')]=_[_0x41b6('0x42')](_0x2291ba[_0x41b6('0x41')]);_0x4313a5[_0x41b6('0x43')]=_[_0x41b6('0x44')](_0x4313a5[_0x41b6('0x40')],_0x4313a5['query']);_0x19a73e[_0x41b6('0x45')]=_[_0x41b6('0x44')](_0x4313a5[_0x41b6('0x40')],qs[_0x41b6('0x46')](_0x2291ba[_0x41b6('0x41')][_0x41b6('0x46')]));_0x19a73e['attributes']=_0x19a73e['attributes'][_0x41b6('0x47')]?_0x19a73e[_0x41b6('0x45')]:_0x4313a5['model'];if(!_0x2291ba['query'][_0x41b6('0x48')](_0x41b6('0x49'))){_0x19a73e[_0x41b6('0x30')]=qs['limit'](_0x2291ba['query'][_0x41b6('0x30')]);_0x19a73e['offset']=qs[_0x41b6('0x2e')](_0x2291ba[_0x41b6('0x41')][_0x41b6('0x2e')]);}_0x19a73e[_0x41b6('0x4a')]=qs[_0x41b6('0x4b')](_0x2291ba['query'][_0x41b6('0x4b')]);_0x19a73e[_0x41b6('0x4c')]=qs[_0x41b6('0x43')](_[_0x41b6('0x4d')](_0x2291ba['query'],_0x4313a5[_0x41b6('0x43')]),_0x442ec7);if(_0x2291ba[_0x41b6('0x41')][_0x41b6('0x4e')]){_0x19a73e[_0x41b6('0x4c')]=_[_0x41b6('0x4f')](_0x19a73e[_0x41b6('0x4c')],{'$or':_[_0x41b6('0x3a')](_0x442ec7,function(_0x575e7f){if(_0x575e7f[_0x41b6('0x3e')]!=='VIRTUAL'){var _0x2e2764={};_0x2e2764[_0x575e7f[_0x41b6('0x37')]]={'$like':'%'+_0x2291ba['query'][_0x41b6('0x4e')]+'%'};return _0x2e2764;}})});}_0x19a73e=_[_0x41b6('0x4f')]({},_0x19a73e,_0x2291ba['options']);var _0x11c8b5={'where':_0x19a73e[_0x41b6('0x4c')]};return db[_0x41b6('0x3b')][_0x41b6('0x31')](_0x11c8b5)[_0x41b6('0x20')](function(_0x5ac0b2){_0x2c3f43[_0x41b6('0x31')]=_0x5ac0b2;if(_0x2291ba[_0x41b6('0x41')][_0x41b6('0x50')]){_0x19a73e['include']=[{'all':!![]}];}return db[_0x41b6('0x3b')][_0x41b6('0x51')](_0x19a73e);})[_0x41b6('0x20')](function(_0xdc4286){_0x2c3f43[_0x41b6('0x52')]=_0xdc4286;return _0x2c3f43;})[_0x41b6('0x20')](respondWithFilteredResult(_0x5b7e9d,_0x19a73e))[_0x41b6('0x2a')](handleError(_0x5b7e9d,null));};exports['show']=function(_0x565d5d,_0x2384bb){var _0x4eca3a={'raw':!![],'where':{'id':_0x565d5d[_0x41b6('0x53')]['id']}},_0x489186={};_0x489186[_0x41b6('0x40')]=_[_0x41b6('0x42')](db[_0x41b6('0x3b')][_0x41b6('0x3c')]);_0x489186[_0x41b6('0x41')]=_['keys'](_0x565d5d[_0x41b6('0x41')]);_0x489186['filters']=_[_0x41b6('0x44')](_0x489186['model'],_0x489186[_0x41b6('0x41')]);_0x4eca3a[_0x41b6('0x45')]=_['intersection'](_0x489186[_0x41b6('0x40')],qs[_0x41b6('0x46')](_0x565d5d[_0x41b6('0x41')][_0x41b6('0x46')]));_0x4eca3a[_0x41b6('0x45')]=_0x4eca3a[_0x41b6('0x45')][_0x41b6('0x47')]?_0x4eca3a[_0x41b6('0x45')]:_0x489186[_0x41b6('0x40')];if(_0x565d5d[_0x41b6('0x41')][_0x41b6('0x50')]){_0x4eca3a[_0x41b6('0x54')]=[{'all':!![]}];}_0x4eca3a=_[_0x41b6('0x4f')]({},_0x4eca3a,_0x565d5d[_0x41b6('0x55')]);return db[_0x41b6('0x3b')][_0x41b6('0x56')](_0x4eca3a)['then'](handleEntityNotFound(_0x2384bb,null))['then'](respondWithResult(_0x2384bb,null))['catch'](handleError(_0x2384bb,null));};exports[_0x41b6('0x57')]=function(_0x208dd9,_0x1d5dad){return db[_0x41b6('0x3b')][_0x41b6('0x57')](_0x208dd9[_0x41b6('0x58')],{})[_0x41b6('0x20')](respondWithResult(_0x1d5dad,0xc9))[_0x41b6('0x2a')](handleError(_0x1d5dad,null));};exports[_0x41b6('0x34')]=function(_0x1b69e3,_0x4f918c){if(_0x1b69e3['body']['id']){delete _0x1b69e3[_0x41b6('0x58')]['id'];}return db[_0x41b6('0x3b')][_0x41b6('0x56')]({'where':{'id':_0x1b69e3[_0x41b6('0x53')]['id']}})[_0x41b6('0x20')](handleEntityNotFound(_0x4f918c,null))[_0x41b6('0x20')](saveUpdates(_0x1b69e3[_0x41b6('0x58')],null))[_0x41b6('0x20')](respondWithResult(_0x4f918c,null))[_0x41b6('0x2a')](handleError(_0x4f918c,null));};exports[_0x41b6('0x35')]=function(_0x2a5185,_0xea54ab){return db['OpenchannelMessage'][_0x41b6('0x56')]({'where':{'id':_0x2a5185[_0x41b6('0x53')]['id']}})[_0x41b6('0x20')](handleEntityNotFound(_0xea54ab,null))[_0x41b6('0x20')](removeEntity(_0xea54ab,null))['catch'](handleError(_0xea54ab,null));};exports['describe']=function(_0x1e8ddb,_0x575806){return db['OpenchannelMessage'][_0x41b6('0x59')]()[_0x41b6('0x20')](respondWithResult(_0x575806,null))[_0x41b6('0x2a')](handleError(_0x575806,null));};var interaction_log=require(_0x41b6('0x12'))(_0x41b6('0x5a'));exports[_0x41b6('0x5b')]=function(_0x5f033b,_0x2a00b7,_0x3b6854){var _0x4f52fe={'agent':{},'channel':_0x41b6('0x5c')};if(_0x5f033b[_0x41b6('0x58')]['id']){delete _0x5f033b['body']['id'];}_0x5f033b[_0x41b6('0x58')][_0x41b6('0x5d')]=!![];_0x5f033b[_0x41b6('0x58')][_0x41b6('0x5e')]=moment()[_0x41b6('0x5f')](_0x41b6('0x60'));_0x5f033b[_0x41b6('0x58')][_0x41b6('0x61')]=_0x5f033b[_0x41b6('0x58')][_0x41b6('0x61')]||_0x5f033b['user']['id'];_0x4f52fe[_0x41b6('0x62')]['id']=_0x5f033b[_0x41b6('0x58')][_0x41b6('0x61')];return db[_0x41b6('0x3b')][_0x41b6('0x56')]({'where':{'id':_0x5f033b[_0x41b6('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2a00b7,null))[_0x41b6('0x20')](saveUpdates(_0x5f033b[_0x41b6('0x58')],null))[_0x41b6('0x20')](function(_0x5bf8d5){if(_0x5bf8d5){_0x4f52fe['message']=_0x5bf8d5[_0x41b6('0x63')]({'plain':!![]});return db[_0x41b6('0x64')]['find']({'where':{'id':_0x5bf8d5['OpenchannelInteractionId']}});}return null;})[_0x41b6('0x20')](handleEntityNotFound(_0x2a00b7,null))['then'](function(_0x32fa3f){if(_0x32fa3f){return _0x32fa3f[_0x41b6('0x34')]({'UserId':_0x5f033b[_0x41b6('0x58')]['UserId'],'read1stAt':_[_0x41b6('0x65')](_0x32fa3f[_0x41b6('0x66')])?moment()['format'](_0x41b6('0x60')):undefined});}return null;})['then'](function(_0x29863e){if(_0x29863e){_0x4f52fe[_0x41b6('0x67')]=_0x29863e[_0x41b6('0x63')]({'plain':!![]});interaction_log[_0x41b6('0x28')](_0x41b6('0x68'),_0x5f033b[_0x41b6('0x69')]['id'],_0x5f033b['user']['name'],_0x5f033b[_0x41b6('0x69')]['role'],_0x4f52fe[_0x41b6('0x67')]['id'],_0x5f033b[_0x41b6('0x58')]?JSON[_0x41b6('0x23')](_0x5f033b[_0x41b6('0x58')]):'null');return respondWithRpcPromise('AcceptMessage',_0x41b6('0x6a'),_0x4f52fe);}return null;})[_0x41b6('0x20')](function(_0x5c5941){var _0x3c175c=_0x41b6('0x6b')+_0x5c5941['message'][_0x41b6('0x6c')];return db[_0x41b6('0x6d')][_0x41b6('0x41')](_0x3c175c,{'type':db[_0x41b6('0x6e')][_0x41b6('0x6f')][_0x41b6('0x70')],'raw':!![]})[_0x41b6('0x20')](function(_0x4cd1e1){return _0x4cd1e1;});})[_0x41b6('0x20')](function(_0x2f21b5){if(_0x2f21b5){_0x4f52fe[_0x41b6('0x26')][_0x41b6('0x71')]=_0x2f21b5[0x0];if(!_0x5f033b[_0x41b6('0x58')]['UserId'])return;return db[_0x41b6('0x72')][_0x41b6('0x56')]({'where':{'id':_0x5f033b[_0x41b6('0x58')][_0x41b6('0x61')],'role':_0x41b6('0x62')},'attributes':['id',_0x41b6('0x37'),_0x41b6('0x73'),_0x41b6('0x74'),_0x41b6('0x75')],'raw':!![]});}return null;})[_0x41b6('0x20')](function(_0x139c80){if(!_0x139c80)return null;_0x4f52fe[_0x41b6('0x26')][_0x41b6('0x62')]=_0x139c80;return _0x4f52fe;})[_0x41b6('0x20')](function(_0x58bec3){if(_0x58bec3){if(_0x5f033b[_0x41b6('0x58')][_0x41b6('0x76')]){_0x4f52fe['message'][_0x41b6('0x77')]=util[_0x41b6('0x5f')](_0x41b6('0x78'),_0x5f033b['user'][_0x41b6('0x37')]);_0x4f52fe['message'][_0x41b6('0x79')]=_0x4f52fe['channel'];_0x4f52fe[_0x41b6('0x26')][_0x41b6('0x7a')]=_0x4f52fe[_0x41b6('0x79')];_0x4f52fe['message'][_0x41b6('0x7b')]='accept';return respondWithRpcPromise(_0x41b6('0x7c'),_0x41b6('0x7c'),{'event':'acceptmessage','message':_0x4f52fe[_0x41b6('0x26')]},client9002)[_0x41b6('0x20')](function(){return _0x4f52fe;});}return _0x4f52fe;}return null;})[_0x41b6('0x20')](respondWithResult(_0x2a00b7,null))[_0x41b6('0x2a')](handleError(_0x2a00b7,null));};var interaction_log=require(_0x41b6('0x12'))(_0x41b6('0x5a'));exports['reject']=function(_0x4fd1ca,_0xa6a559,_0x5ad34e){var _0x4c866f={'agent':{},'channel':_0x41b6('0x5c')};if(_0x4fd1ca[_0x41b6('0x58')]['id']){delete _0x4fd1ca['body']['id'];}_0x4fd1ca[_0x41b6('0x58')][_0x41b6('0x61')]=_0x4fd1ca[_0x41b6('0x58')][_0x41b6('0x61')]||_0x4fd1ca[_0x41b6('0x69')]['id'];_0x4c866f['agent']['id']=_0x4fd1ca['body'][_0x41b6('0x61')];return db[_0x41b6('0x3b')][_0x41b6('0x56')]({'where':{'id':_0x4fd1ca[_0x41b6('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xa6a559,null))['then'](function(_0x17405a){if(_0x17405a){_0x4c866f[_0x41b6('0x26')]=_0x17405a[_0x41b6('0x63')]({'plain':!![]});return db[_0x41b6('0x64')]['find']({'where':{'id':_0x17405a['OpenchannelInteractionId']}});}return null;})[_0x41b6('0x20')](handleEntityNotFound(_0xa6a559,null))[_0x41b6('0x20')](function(_0x442eaa){if(_0x442eaa){_0x4c866f[_0x41b6('0x67')]=_0x442eaa[_0x41b6('0x63')]({'plain':!![]});interaction_log['info'](_0x41b6('0x7d'),_0x4fd1ca['user']['id'],_0x4fd1ca[_0x41b6('0x69')][_0x41b6('0x37')],_0x4fd1ca[_0x41b6('0x69')]['role'],_0x4c866f['interaction']['id'],_0x4fd1ca[_0x41b6('0x58')]?JSON['stringify'](_0x4fd1ca[_0x41b6('0x58')]):_0x41b6('0x7e'));return respondWithRpcPromise('RejectMessage',_0x41b6('0x7f'),_0x4c866f);}return null;})[_0x41b6('0x20')](function(_0x2919b2){var _0x5d1f05='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2919b2[_0x41b6('0x26')][_0x41b6('0x6c')];return db[_0x41b6('0x6d')][_0x41b6('0x41')](_0x5d1f05,{'type':db[_0x41b6('0x6e')][_0x41b6('0x6f')][_0x41b6('0x70')],'raw':!![]})['then'](function(_0x104edd){return _0x104edd;});})[_0x41b6('0x20')](function(_0x6afdc3){if(_0x6afdc3){_0x4c866f['message'][_0x41b6('0x71')]=_0x6afdc3[0x0];if(!_0x4fd1ca['body'][_0x41b6('0x61')])return;return db[_0x41b6('0x72')][_0x41b6('0x56')]({'where':{'id':_0x4fd1ca['body']['UserId'],'role':_0x41b6('0x62')},'attributes':['id','name',_0x41b6('0x73'),_0x41b6('0x74'),_0x41b6('0x75')],'raw':!![]});}return null;})['then'](function(_0x5851ab){if(!_0x5851ab)return null;_0x4c866f[_0x41b6('0x26')]['agent']=_0x5851ab;return _0x4c866f;})[_0x41b6('0x20')](function(_0x206e03){if(_0x206e03){_0x206e03[_0x41b6('0x26')]['interface']=util[_0x41b6('0x5f')]('SIP/%s',_0x4fd1ca[_0x41b6('0x69')][_0x41b6('0x37')]);_0x206e03[_0x41b6('0x26')][_0x41b6('0x79')]=_0x4c866f['channel'];_0x206e03[_0x41b6('0x26')][_0x41b6('0x7a')]=_0x4c866f[_0x41b6('0x79')];_0x206e03[_0x41b6('0x26')][_0x41b6('0x7b')]='reject';respondWithRpcPromise(_0x41b6('0x7c'),'EventManager',{'event':_0x41b6('0x80'),'message':_0x206e03[_0x41b6('0x26')]},client9002);return _0x4c866f;}return null;})[_0x41b6('0x20')](respondWithResult(_0xa6a559,null))[_0x41b6('0x2a')](handleError(_0xa6a559,null));}; \ No newline at end of file +var _0x5453=['read1stAt','interaction','stringify','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','contact','User','fullname','internal','manual','SIP/%s','channel','event','EventManager','acceptmessage','openchannel-interactions','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','rejectMessage','Sequelize','SELECT','interface','motionChannel','rejectmessage','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','register','jayson/promise','client','http','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','type','key','model','keys','filters','intersection','fields','query','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','OpenchannelMessage','count','includeAll','include','rows','catch','show','params','find','create','body','update','describe','../../config/logger','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil'];(function(_0x553030,_0x2f33f6){var _0xc77570=function(_0x315bf0){while(--_0x315bf0){_0x553030['push'](_0x553030['shift']());}};_0xc77570(++_0x2f33f6);}(_0x5453,0x117));var _0x3545=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x5453[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3545('0x0'));var zipdir=require(_0x3545('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3545('0x2'));var moment=require(_0x3545('0x3'));var BPromise=require(_0x3545('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3545('0x5'));var sox=require(_0x3545('0x6'));var csv=require(_0x3545('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3545('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3545('0x9'));var toCsv=require(_0x3545('0x7'));var querystring=require(_0x3545('0xa'));var Papa=require(_0x3545('0xb'));var Redis=require(_0x3545('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3545('0xd'));var hardwareService=require(_0x3545('0xe'));var logger=require('../../config/logger')(_0x3545('0xf'));var utils=require(_0x3545('0x10'));var config=require(_0x3545('0x11'));var licenseUtil=require(_0x3545('0x12'));var db=require(_0x3545('0x13'))['db'];config['redis']=_[_0x3545('0x14')](config[_0x3545('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3545('0x15')]));require('./openchannelMessage.socket')[_0x3545('0x16')](socket);var jayson=require(_0x3545('0x17'));var client=jayson[_0x3545('0x18')][_0x3545('0x19')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4e47f9,_0x114a31,_0x19fc12,_0x200372){return new BPromise(function(_0xb1a268,_0x2cd494){var _0x141d47=_0x200372||client;return _0x141d47['request'](_0x4e47f9,_0x19fc12)['then'](function(_0xdd14fc){logger[_0x3545('0x1a')](_0x3545('0x1b'),_0x114a31,_0x3545('0x1c'));logger[_0x3545('0x1d')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x114a31,'request\x20sent',JSON['stringify'](_0xdd14fc));if(_0xdd14fc[_0x3545('0x1e')]){if(_0xdd14fc['error'][_0x3545('0x1f')]===0x1f4){logger[_0x3545('0x1e')]('OpenchannelMessage,\x20%s,\x20%s',_0x114a31,_0xdd14fc[_0x3545('0x1e')]['message']);return _0x2cd494(_0xdd14fc[_0x3545('0x1e')][_0x3545('0x20')]);}logger[_0x3545('0x1e')](_0x3545('0x1b'),_0x114a31,_0xdd14fc[_0x3545('0x1e')][_0x3545('0x20')]);return _0xb1a268(_0xdd14fc[_0x3545('0x1e')][_0x3545('0x20')]);}else{logger['info'](_0x3545('0x1b'),_0x114a31,'request\x20sent');_0xb1a268(_0xdd14fc[_0x3545('0x21')]['message']);}})['catch'](function(_0x151e7f){logger[_0x3545('0x1e')](_0x3545('0x1b'),_0x114a31,_0x151e7f);_0x2cd494(_0x151e7f);});});}function respondWithStatusCode(_0x17580e,_0x5453fb){_0x5453fb=_0x5453fb||0xcc;return function(_0x135ecc){if(_0x135ecc){return _0x17580e['sendStatus'](_0x5453fb);}return _0x17580e[_0x3545('0x22')](_0x5453fb)[_0x3545('0x23')]();};}function respondWithResult(_0x526b00,_0x56656f){_0x56656f=_0x56656f||0xc8;return function(_0x4f4db4){if(_0x4f4db4){return _0x526b00['status'](_0x56656f)[_0x3545('0x24')](_0x4f4db4);}};}function respondWithFilteredResult(_0x472d52,_0x2560c3){return function(_0x165b5a){if(_0x165b5a){var _0x298257=typeof _0x2560c3[_0x3545('0x25')]===_0x3545('0x26')&&typeof _0x2560c3['limit']===_0x3545('0x26');var _0x21cf7c=_0x165b5a['count'];var _0x5acde1=_0x298257?0x0:_0x2560c3[_0x3545('0x25')];var _0xcee28a=_0x298257?_0x165b5a['count']:_0x2560c3[_0x3545('0x25')]+_0x2560c3[_0x3545('0x27')];var _0x40ceaa;if(_0xcee28a>=_0x21cf7c){_0xcee28a=_0x21cf7c;_0x40ceaa=0xc8;}else{_0x40ceaa=0xce;}_0x472d52[_0x3545('0x22')](_0x40ceaa);return _0x472d52[_0x3545('0x28')](_0x3545('0x29'),_0x5acde1+'-'+_0xcee28a+'/'+_0x21cf7c)[_0x3545('0x24')](_0x165b5a);}return null;};}function patchUpdates(_0x2dda71){return function(_0x2137eb){try{jsonpatch[_0x3545('0x2a')](_0x2137eb,_0x2dda71,!![]);}catch(_0x12d3dd){return BPromise[_0x3545('0x2b')](_0x12d3dd);}return _0x2137eb[_0x3545('0x2c')]();};}function saveUpdates(_0x2af686,_0x2c4d15){return function(_0xbbbf8c){if(_0xbbbf8c){return _0xbbbf8c['update'](_0x2af686)[_0x3545('0x2d')](function(_0x25f748){return _0x25f748;});}return null;};}function removeEntity(_0x29c317,_0xe14583){return function(_0x476347){if(_0x476347){return _0x476347[_0x3545('0x2e')]()[_0x3545('0x2d')](function(){_0x29c317[_0x3545('0x22')](0xcc)[_0x3545('0x23')]();});}};}function handleEntityNotFound(_0x2912e7,_0x3f9a2a){return function(_0x23e471){if(!_0x23e471){_0x2912e7[_0x3545('0x2f')](0x194);}return _0x23e471;};}function handleError(_0x527cd9,_0x2073c4){_0x2073c4=_0x2073c4||0x1f4;return function(_0x3dc933){logger[_0x3545('0x1e')](_0x3dc933[_0x3545('0x30')]);if(_0x3dc933[_0x3545('0x31')]){delete _0x3dc933['name'];}_0x527cd9['status'](_0x2073c4)[_0x3545('0x32')](_0x3dc933);};}exports[_0x3545('0x33')]=function(_0x260d98,_0x486579){var _0x45b9e4={},_0x16a708={},_0x1c8021={'count':0x0,'rows':[]};var _0x41c738=_[_0x3545('0x34')](db['OpenchannelMessage'][_0x3545('0x35')],function(_0x2de7e5){return{'name':_0x2de7e5['fieldName'],'type':_0x2de7e5[_0x3545('0x36')][_0x3545('0x37')]};});_0x16a708[_0x3545('0x38')]=_[_0x3545('0x34')](_0x41c738,_0x3545('0x31'));_0x16a708['query']=_[_0x3545('0x39')](_0x260d98['query']);_0x16a708[_0x3545('0x3a')]=_[_0x3545('0x3b')](_0x16a708[_0x3545('0x38')],_0x16a708['query']);_0x45b9e4['attributes']=_[_0x3545('0x3b')](_0x16a708[_0x3545('0x38')],qs[_0x3545('0x3c')](_0x260d98[_0x3545('0x3d')][_0x3545('0x3c')]));_0x45b9e4['attributes']=_0x45b9e4['attributes'][_0x3545('0x3e')]?_0x45b9e4[_0x3545('0x3f')]:_0x16a708['model'];if(!_0x260d98[_0x3545('0x3d')][_0x3545('0x40')](_0x3545('0x41'))){_0x45b9e4['limit']=qs[_0x3545('0x27')](_0x260d98[_0x3545('0x3d')]['limit']);_0x45b9e4[_0x3545('0x25')]=qs[_0x3545('0x25')](_0x260d98[_0x3545('0x3d')][_0x3545('0x25')]);}_0x45b9e4[_0x3545('0x42')]=qs['sort'](_0x260d98[_0x3545('0x3d')][_0x3545('0x43')]);_0x45b9e4[_0x3545('0x44')]=qs['filters'](_[_0x3545('0x45')](_0x260d98[_0x3545('0x3d')],_0x16a708[_0x3545('0x3a')]),_0x41c738);if(_0x260d98['query'][_0x3545('0x46')]){_0x45b9e4[_0x3545('0x44')]=_[_0x3545('0x47')](_0x45b9e4[_0x3545('0x44')],{'$or':_[_0x3545('0x34')](_0x41c738,function(_0x420f50){if(_0x420f50['type']!=='VIRTUAL'){var _0x3fae65={};_0x3fae65[_0x420f50['name']]={'$like':'%'+_0x260d98[_0x3545('0x3d')][_0x3545('0x46')]+'%'};return _0x3fae65;}})});}_0x45b9e4=_[_0x3545('0x47')]({},_0x45b9e4,_0x260d98[_0x3545('0x48')]);var _0x2c9916={'where':_0x45b9e4[_0x3545('0x44')]};return db[_0x3545('0x49')][_0x3545('0x4a')](_0x2c9916)['then'](function(_0x2905e4){_0x1c8021[_0x3545('0x4a')]=_0x2905e4;if(_0x260d98[_0x3545('0x3d')][_0x3545('0x4b')]){_0x45b9e4[_0x3545('0x4c')]=[{'all':!![]}];}return db[_0x3545('0x49')]['findAll'](_0x45b9e4);})['then'](function(_0x43eb81){_0x1c8021[_0x3545('0x4d')]=_0x43eb81;return _0x1c8021;})[_0x3545('0x2d')](respondWithFilteredResult(_0x486579,_0x45b9e4))[_0x3545('0x4e')](handleError(_0x486579,null));};exports[_0x3545('0x4f')]=function(_0x4435e4,_0x505e22){var _0x7910d8={'raw':!![],'where':{'id':_0x4435e4[_0x3545('0x50')]['id']}},_0x4606ee={};_0x4606ee[_0x3545('0x38')]=_['keys'](db[_0x3545('0x49')]['rawAttributes']);_0x4606ee[_0x3545('0x3d')]=_[_0x3545('0x39')](_0x4435e4[_0x3545('0x3d')]);_0x4606ee[_0x3545('0x3a')]=_[_0x3545('0x3b')](_0x4606ee['model'],_0x4606ee[_0x3545('0x3d')]);_0x7910d8[_0x3545('0x3f')]=_['intersection'](_0x4606ee[_0x3545('0x38')],qs['fields'](_0x4435e4[_0x3545('0x3d')][_0x3545('0x3c')]));_0x7910d8['attributes']=_0x7910d8['attributes'][_0x3545('0x3e')]?_0x7910d8[_0x3545('0x3f')]:_0x4606ee['model'];if(_0x4435e4[_0x3545('0x3d')][_0x3545('0x4b')]){_0x7910d8[_0x3545('0x4c')]=[{'all':!![]}];}_0x7910d8=_['merge']({},_0x7910d8,_0x4435e4['options']);return db['OpenchannelMessage'][_0x3545('0x51')](_0x7910d8)['then'](handleEntityNotFound(_0x505e22,null))[_0x3545('0x2d')](respondWithResult(_0x505e22,null))[_0x3545('0x4e')](handleError(_0x505e22,null));};exports['create']=function(_0x5b2dca,_0xae94b8){return db[_0x3545('0x49')][_0x3545('0x52')](_0x5b2dca[_0x3545('0x53')],{})[_0x3545('0x2d')](respondWithResult(_0xae94b8,0xc9))[_0x3545('0x4e')](handleError(_0xae94b8,null));};exports[_0x3545('0x54')]=function(_0x1af33f,_0x37ca13){if(_0x1af33f[_0x3545('0x53')]['id']){delete _0x1af33f['body']['id'];}return db[_0x3545('0x49')]['find']({'where':{'id':_0x1af33f['params']['id']}})[_0x3545('0x2d')](handleEntityNotFound(_0x37ca13,null))[_0x3545('0x2d')](saveUpdates(_0x1af33f[_0x3545('0x53')],null))[_0x3545('0x2d')](respondWithResult(_0x37ca13,null))[_0x3545('0x4e')](handleError(_0x37ca13,null));};exports['destroy']=function(_0x3c50b0,_0x47e4da){return db[_0x3545('0x49')][_0x3545('0x51')]({'where':{'id':_0x3c50b0['params']['id']}})['then'](handleEntityNotFound(_0x47e4da,null))[_0x3545('0x2d')](removeEntity(_0x47e4da,null))['catch'](handleError(_0x47e4da,null));};exports[_0x3545('0x55')]=function(_0x40bd6d,_0x3d271b){return db[_0x3545('0x49')][_0x3545('0x55')]()[_0x3545('0x2d')](respondWithResult(_0x3d271b,null))[_0x3545('0x4e')](handleError(_0x3d271b,null));};var interaction_log=require(_0x3545('0x56'))('openchannel-interactions');exports['accept']=function(_0x4e5c46,_0x5221c0,_0x54fa78){var _0xeebd78={'agent':{},'channel':'openchannel'};if(_0x4e5c46[_0x3545('0x53')]['id']){delete _0x4e5c46[_0x3545('0x53')]['id'];}_0x4e5c46['body']['read']=!![];_0x4e5c46[_0x3545('0x53')]['readAt']=moment()[_0x3545('0x57')](_0x3545('0x58'));_0x4e5c46[_0x3545('0x53')][_0x3545('0x59')]=_0x4e5c46['body']['UserId']||_0x4e5c46[_0x3545('0x5a')]['id'];_0xeebd78[_0x3545('0x5b')]['id']=_0x4e5c46[_0x3545('0x53')]['UserId'];return db[_0x3545('0x49')][_0x3545('0x51')]({'where':{'id':_0x4e5c46[_0x3545('0x50')]['id'],'UserId':null}})[_0x3545('0x2d')](handleEntityNotFound(_0x5221c0,null))[_0x3545('0x2d')](saveUpdates(_0x4e5c46[_0x3545('0x53')],null))['then'](function(_0x2fe6f6){if(_0x2fe6f6){_0xeebd78['message']=_0x2fe6f6[_0x3545('0x5c')]({'plain':!![]});return db[_0x3545('0x5d')][_0x3545('0x51')]({'where':{'id':_0x2fe6f6[_0x3545('0x5e')]}});}return null;})[_0x3545('0x2d')](handleEntityNotFound(_0x5221c0,null))[_0x3545('0x2d')](function(_0x3cb4ef){if(_0x3cb4ef){return _0x3cb4ef['update']({'UserId':_0x4e5c46[_0x3545('0x53')][_0x3545('0x59')],'read1stAt':_[_0x3545('0x5f')](_0x3cb4ef[_0x3545('0x60')])?moment()[_0x3545('0x57')](_0x3545('0x58')):undefined});}return null;})[_0x3545('0x2d')](function(_0xbe128a){if(_0xbe128a){_0xeebd78[_0x3545('0x61')]=_0xbe128a[_0x3545('0x5c')]({'plain':!![]});interaction_log[_0x3545('0x1a')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4e5c46[_0x3545('0x5a')]['id'],_0x4e5c46[_0x3545('0x5a')][_0x3545('0x31')],_0x4e5c46[_0x3545('0x5a')]['role'],_0xeebd78['interaction']['id'],_0x4e5c46[_0x3545('0x53')]?JSON[_0x3545('0x62')](_0x4e5c46[_0x3545('0x53')]):'null');return respondWithRpcPromise('AcceptMessage',_0x3545('0x63'),_0xeebd78);}return null;})['then'](function(_0x342078){var _0x8411c2=_0x3545('0x64')+_0x342078['message'][_0x3545('0x65')];return db[_0x3545('0x66')][_0x3545('0x3d')](_0x8411c2,{'type':db['Sequelize'][_0x3545('0x67')]['SELECT'],'raw':!![]})[_0x3545('0x2d')](function(_0x5d4ece){return _0x5d4ece;});})[_0x3545('0x2d')](function(_0xe8bac7){if(_0xe8bac7){_0xeebd78[_0x3545('0x20')][_0x3545('0x68')]=_0xe8bac7[0x0];if(!_0x4e5c46[_0x3545('0x53')]['UserId'])return;return db[_0x3545('0x69')][_0x3545('0x51')]({'where':{'id':_0x4e5c46[_0x3545('0x53')]['UserId'],'role':_0x3545('0x5b')},'attributes':['id','name',_0x3545('0x6a'),'email',_0x3545('0x6b')],'raw':!![]});}return null;})[_0x3545('0x2d')](function(_0x838828){if(!_0x838828)return null;_0xeebd78[_0x3545('0x20')][_0x3545('0x5b')]=_0x838828;return _0xeebd78;})[_0x3545('0x2d')](function(_0x272911){if(_0x272911){if(_0x4e5c46[_0x3545('0x53')][_0x3545('0x6c')]){_0xeebd78[_0x3545('0x20')]['interface']=util['format'](_0x3545('0x6d'),_0x4e5c46['user'][_0x3545('0x31')]);_0xeebd78['message'][_0x3545('0x6e')]=_0xeebd78[_0x3545('0x6e')];_0xeebd78[_0x3545('0x20')]['motionChannel']=_0xeebd78[_0x3545('0x6e')];_0xeebd78[_0x3545('0x20')][_0x3545('0x6f')]='accept';return respondWithRpcPromise(_0x3545('0x70'),_0x3545('0x70'),{'event':_0x3545('0x71'),'message':_0xeebd78[_0x3545('0x20')]},client9002)[_0x3545('0x2d')](function(){return _0xeebd78;});}return _0xeebd78;}return null;})[_0x3545('0x2d')](respondWithResult(_0x5221c0,null))['catch'](handleError(_0x5221c0,null));};var interaction_log=require(_0x3545('0x56'))(_0x3545('0x72'));exports[_0x3545('0x2b')]=function(_0x5030f8,_0x3d9a2,_0x462181){var _0x109973={'agent':{},'channel':_0x3545('0x73')};if(_0x5030f8[_0x3545('0x53')]['id']){delete _0x5030f8['body']['id'];}_0x5030f8['body']['UserId']=_0x5030f8[_0x3545('0x53')][_0x3545('0x59')]||_0x5030f8[_0x3545('0x5a')]['id'];_0x109973[_0x3545('0x5b')]['id']=_0x5030f8[_0x3545('0x53')][_0x3545('0x59')];return db[_0x3545('0x49')][_0x3545('0x51')]({'where':{'id':_0x5030f8[_0x3545('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3d9a2,null))[_0x3545('0x2d')](function(_0x55640a){if(_0x55640a){_0x109973[_0x3545('0x20')]=_0x55640a['get']({'plain':!![]});return db[_0x3545('0x5d')][_0x3545('0x51')]({'where':{'id':_0x55640a['OpenchannelInteractionId']}});}return null;})[_0x3545('0x2d')](handleEntityNotFound(_0x3d9a2,null))[_0x3545('0x2d')](function(_0x2b41cd){if(_0x2b41cd){_0x109973[_0x3545('0x61')]=_0x2b41cd[_0x3545('0x5c')]({'plain':!![]});interaction_log['info'](_0x3545('0x74'),_0x5030f8[_0x3545('0x5a')]['id'],_0x5030f8[_0x3545('0x5a')][_0x3545('0x31')],_0x5030f8[_0x3545('0x5a')][_0x3545('0x75')],_0x109973[_0x3545('0x61')]['id'],_0x5030f8['body']?JSON[_0x3545('0x62')](_0x5030f8[_0x3545('0x53')]):_0x3545('0x76'));return respondWithRpcPromise('RejectMessage',_0x3545('0x77'),_0x109973);}return null;})[_0x3545('0x2d')](function(_0x3d45c6){var _0x10c155=_0x3545('0x64')+_0x3d45c6[_0x3545('0x20')][_0x3545('0x65')];return db[_0x3545('0x66')]['query'](_0x10c155,{'type':db[_0x3545('0x78')][_0x3545('0x67')][_0x3545('0x79')],'raw':!![]})[_0x3545('0x2d')](function(_0x569475){return _0x569475;});})[_0x3545('0x2d')](function(_0x599231){if(_0x599231){_0x109973[_0x3545('0x20')][_0x3545('0x68')]=_0x599231[0x0];if(!_0x5030f8[_0x3545('0x53')]['UserId'])return;return db['User']['find']({'where':{'id':_0x5030f8[_0x3545('0x53')][_0x3545('0x59')],'role':_0x3545('0x5b')},'attributes':['id',_0x3545('0x31'),_0x3545('0x6a'),'email',_0x3545('0x6b')],'raw':!![]});}return null;})[_0x3545('0x2d')](function(_0x26097a){if(!_0x26097a)return null;_0x109973['message'][_0x3545('0x5b')]=_0x26097a;return _0x109973;})[_0x3545('0x2d')](function(_0x1a78ed){if(_0x1a78ed){_0x1a78ed['message'][_0x3545('0x7a')]=util['format'](_0x3545('0x6d'),_0x5030f8[_0x3545('0x5a')]['name']);_0x1a78ed['message']['channel']=_0x109973[_0x3545('0x6e')];_0x1a78ed[_0x3545('0x20')][_0x3545('0x7b')]=_0x109973[_0x3545('0x6e')];_0x1a78ed[_0x3545('0x20')][_0x3545('0x6f')]=_0x3545('0x2b');respondWithRpcPromise('EventManager','EventManager',{'event':_0x3545('0x7c'),'message':_0x1a78ed[_0x3545('0x20')]},client9002);return _0x109973;}return null;})[_0x3545('0x2d')](respondWithResult(_0x3d9a2,null))[_0x3545('0x4e')](handleError(_0x3d9a2,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index f82c1d7..bf873d7 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 _0xf33d=['hasOwnProperty','hook','exports','events','OpenchannelMessage','save','update','emit'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0xf33d,0xa3));var _0xdf33=function(_0x1c979b,_0x3e246d){_0x1c979b=_0x1c979b-0x0;var _0x142b09=_0xf33d[_0x1c979b];return _0x142b09;};'use strict';var EventEmitter=require(_0xdf33('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0xdf33('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdf33('0x2'),'afterUpdate':_0xdf33('0x3'),'afterDestroy':'remove'};function emitEvent(_0x126e7f){return function(_0x792011,_0xb64f7f,_0x354229){OpenchannelMessageEvents['emit'](_0x126e7f+':'+_0x792011['id'],_0x792011);OpenchannelMessageEvents[_0xdf33('0x4')](_0x126e7f,_0x792011);_0x354229(null);};}for(var e in events){if(events[_0xdf33('0x5')](e)){var event=events[e];OpenchannelMessage[_0xdf33('0x6')](e,emitEvent(event));}}module[_0xdf33('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xa5e5=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x516373,_0x35c5a3){var _0x553c26=function(_0x2c6242){while(--_0x2c6242){_0x516373['push'](_0x516373['shift']());}};_0x553c26(++_0x35c5a3);}(_0xa5e5,0x9c));var _0x5a5e=function(_0xd2d54,_0x5329f7){_0xd2d54=_0xd2d54-0x0;var _0x78b113=_0xa5e5[_0xd2d54];return _0x78b113;};'use strict';var EventEmitter=require(_0x5a5e('0x0'));var OpenchannelMessage=require(_0x5a5e('0x1'))['db'][_0x5a5e('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x5a5e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5a5e('0x4'),'afterDestroy':_0x5a5e('0x5')};function emitEvent(_0x37ee05){return function(_0x2aa961,_0x3d965a,_0x3a3477){OpenchannelMessageEvents['emit'](_0x37ee05+':'+_0x2aa961['id'],_0x2aa961);OpenchannelMessageEvents[_0x5a5e('0x6')](_0x37ee05,_0x2aa961);_0x3a3477(null);};}for(var e in events){if(events[_0x5a5e('0x7')](e)){var event=events[e];OpenchannelMessage[_0x5a5e('0x8')](e,emitEvent(event));}}module[_0x5a5e('0x9')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 695cc1f..b7ffcbf 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 _0x5eb8=['OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','omit','POST','method','GET','info','body','Interaction','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','OpenchannelInteraction','then','update','createdAt','catch','error','out','CmContact','OpenchannelAccount','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','Contact','keys'];(function(_0x1ec03d,_0x281710){var _0x2e22d8=function(_0x371302){while(--_0x371302){_0x1ec03d['push'](_0x1ec03d['shift']());}};_0x2e22d8(++_0x281710);}(_0x5eb8,0xb0));var _0x85eb=function(_0x460dae,_0x3a907f){_0x460dae=_0x460dae-0x0;var _0x36e6d0=_0x5eb8[_0x460dae];return _0x36e6d0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x85eb('0x0'))(_0x85eb('0x1'));var moment=require(_0x85eb('0x2'));var BPromise=require(_0x85eb('0x3'));var rp=require(_0x85eb('0x4'));var fs=require('fs');var path=require(_0x85eb('0x5'));var rimraf=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var attributes=require(_0x85eb('0x8'));module[_0x85eb('0x9')]=function(_0x2bf83c,_0x1ba1d8){return _0x2bf83c['define'](_0x85eb('0xa'),attributes,{'tableName':_0x85eb('0xb'),'paranoid':![],'indexes':[{'name':_0x85eb('0xc'),'fields':['body'],'type':_0x85eb('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x50ea77,_0x1f0036,_0x40d6b6){var _0x673228=_0x2bf83c[_0x85eb('0xe')];var _0x1dacf2=_0x50ea77[_0x85eb('0xf')]({'plain':!![]});if(_0x1dacf2[_0x85eb('0x10')]['toLowerCase']()==='in'||_0x1dacf2[_0x85eb('0x10')][_0x85eb('0x11')]()==='out'&&!_0x1dacf2[_0x85eb('0x12')]&&!_[_0x85eb('0x13')](_0x1dacf2[_0x85eb('0x14')])){_0x673228[_0x85eb('0x15')]['findOne']({'where':{'id':_0x1dacf2['OpenchannelInteractionId']}})[_0x85eb('0x16')](function(_0x5c760a){if(_0x5c760a){_0x5c760a[_0x85eb('0x17')]({'lastMsgAt':_0x1dacf2[_0x85eb('0x18')],'lastMsgDirection':_0x1dacf2[_0x85eb('0x10')][_0x85eb('0x11')]()});}})[_0x85eb('0x19')](function(_0x49efdf){console[_0x85eb('0x1a')](_0x49efdf);});}if(_0x1dacf2['direction']===_0x85eb('0x1b')&&!_0x1dacf2[_0x85eb('0x12')]){var _0x3e23e8;_0x673228[_0x85eb('0x1c')]['describe']()['then'](function(_0x50d2a8){return _0x673228[_0x85eb('0x1d')][_0x85eb('0x1e')]({'where':{'id':_0x1dacf2[_0x85eb('0x1f')]},'include':[{'model':_0x673228[_0x85eb('0x15')],'as':_0x85eb('0x20'),'where':{'id':_0x1dacf2[_0x85eb('0x21')]},'limit':0x1,'include':[{'model':_0x673228['CmContact'],'as':_0x85eb('0x22'),'attributes':_[_0x85eb('0x23')](_0x50d2a8)}]}]});})[_0x85eb('0x16')](function(_0x4e8041){_0x3e23e8=_0x4e8041['get']({'plain':!![]});if(_0x3e23e8&&_0x3e23e8['replyUri']){logger['info'](_0x85eb('0x24'),_0x85eb('0x25'),util[_0x85eb('0x26')](_0x85eb('0x27'),_0x1dacf2['id'],_0x3e23e8[_0x85eb('0x28')]));if(_0x3e23e8[_0x85eb('0x20')]&&_0x3e23e8['Interactions']['length']){_0x1dacf2['Interaction']=_[_0x85eb('0x29')](_0x3e23e8[_0x85eb('0x20')][0x0],_0x85eb('0x22'));_0x1dacf2[_0x85eb('0x22')]=_0x3e23e8[_0x85eb('0x20')][0x0][_0x85eb('0x22')];}var _0x1f0036={'method':_0x85eb('0x2a'),'uri':encodeURI(_0x3e23e8[_0x85eb('0x28')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1f0036[_0x85eb('0x2b')]){case _0x85eb('0x2c'):_0x1f0036['qs']=_0x1dacf2;break;case _0x85eb('0x2a'):_0x1f0036['body']=_0x1dacf2;break;}return rp(_0x1f0036)[_0x85eb('0x16')](function(_0x792d3a){logger[_0x85eb('0x2d')](_0x85eb('0x24'),_0x85eb('0x25'),util[_0x85eb('0x26')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x1dacf2['id'],_0x3e23e8['replyUri']));if(_0x792d3a[_0x85eb('0x2e')]['threadId']&&_0x792d3a[_0x85eb('0x2e')]['threadId']!=_0x1dacf2[_0x85eb('0x2f')][_0x85eb('0x30')]){return _0x673228[_0x85eb('0x15')][_0x85eb('0x17')]({'threadId':_0x792d3a[_0x85eb('0x2e')][_0x85eb('0x30')]},{'logging':!![],'where':{'id':_0x1dacf2[_0x85eb('0x2f')]['id']}});}else{return;}})['then'](function(){return _0x50ea77[_0x85eb('0x17')]({'read':!![]});})[_0x85eb('0x19')](function(_0x515ee9){logger[_0x85eb('0x1a')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x85eb('0x31')](_0x515ee9,{'showHidden':![],'depth':null}));_0x40d6b6();});}else{_0x40d6b6();}})[_0x85eb('0x32')](function(){_0x40d6b6();});}else{_0x40d6b6();}}},'charset':_0x85eb('0x33'),'collate':_0x85eb('0x34')});}; \ No newline at end of file +var _0x5eb8=['OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','omit','POST','method','GET','info','body','Interaction','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','OpenchannelInteraction','then','update','createdAt','catch','error','out','CmContact','OpenchannelAccount','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','Contact','keys'];(function(_0x337b1c,_0x46564b){var _0x516f56=function(_0x5a1035){while(--_0x5a1035){_0x337b1c['push'](_0x337b1c['shift']());}};_0x516f56(++_0x46564b);}(_0x5eb8,0xb0));var _0x85eb=function(_0x33c090,_0x184b69){_0x33c090=_0x33c090-0x0;var _0x4081df=_0x5eb8[_0x33c090];return _0x4081df;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x85eb('0x0'))(_0x85eb('0x1'));var moment=require(_0x85eb('0x2'));var BPromise=require(_0x85eb('0x3'));var rp=require(_0x85eb('0x4'));var fs=require('fs');var path=require(_0x85eb('0x5'));var rimraf=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var attributes=require(_0x85eb('0x8'));module[_0x85eb('0x9')]=function(_0x2bf83c,_0x1ba1d8){return _0x2bf83c['define'](_0x85eb('0xa'),attributes,{'tableName':_0x85eb('0xb'),'paranoid':![],'indexes':[{'name':_0x85eb('0xc'),'fields':['body'],'type':_0x85eb('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x50ea77,_0x1f0036,_0x40d6b6){var _0x673228=_0x2bf83c[_0x85eb('0xe')];var _0x1dacf2=_0x50ea77[_0x85eb('0xf')]({'plain':!![]});if(_0x1dacf2[_0x85eb('0x10')]['toLowerCase']()==='in'||_0x1dacf2[_0x85eb('0x10')][_0x85eb('0x11')]()==='out'&&!_0x1dacf2[_0x85eb('0x12')]&&!_[_0x85eb('0x13')](_0x1dacf2[_0x85eb('0x14')])){_0x673228[_0x85eb('0x15')]['findOne']({'where':{'id':_0x1dacf2['OpenchannelInteractionId']}})[_0x85eb('0x16')](function(_0x5c760a){if(_0x5c760a){_0x5c760a[_0x85eb('0x17')]({'lastMsgAt':_0x1dacf2[_0x85eb('0x18')],'lastMsgDirection':_0x1dacf2[_0x85eb('0x10')][_0x85eb('0x11')]()});}})[_0x85eb('0x19')](function(_0x49efdf){console[_0x85eb('0x1a')](_0x49efdf);});}if(_0x1dacf2['direction']===_0x85eb('0x1b')&&!_0x1dacf2[_0x85eb('0x12')]){var _0x3e23e8;_0x673228[_0x85eb('0x1c')]['describe']()['then'](function(_0x50d2a8){return _0x673228[_0x85eb('0x1d')][_0x85eb('0x1e')]({'where':{'id':_0x1dacf2[_0x85eb('0x1f')]},'include':[{'model':_0x673228[_0x85eb('0x15')],'as':_0x85eb('0x20'),'where':{'id':_0x1dacf2[_0x85eb('0x21')]},'limit':0x1,'include':[{'model':_0x673228['CmContact'],'as':_0x85eb('0x22'),'attributes':_[_0x85eb('0x23')](_0x50d2a8)}]}]});})[_0x85eb('0x16')](function(_0x4e8041){_0x3e23e8=_0x4e8041['get']({'plain':!![]});if(_0x3e23e8&&_0x3e23e8['replyUri']){logger['info'](_0x85eb('0x24'),_0x85eb('0x25'),util[_0x85eb('0x26')](_0x85eb('0x27'),_0x1dacf2['id'],_0x3e23e8[_0x85eb('0x28')]));if(_0x3e23e8[_0x85eb('0x20')]&&_0x3e23e8['Interactions']['length']){_0x1dacf2['Interaction']=_[_0x85eb('0x29')](_0x3e23e8[_0x85eb('0x20')][0x0],_0x85eb('0x22'));_0x1dacf2[_0x85eb('0x22')]=_0x3e23e8[_0x85eb('0x20')][0x0][_0x85eb('0x22')];}var _0x1f0036={'method':_0x85eb('0x2a'),'uri':encodeURI(_0x3e23e8[_0x85eb('0x28')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1f0036[_0x85eb('0x2b')]){case _0x85eb('0x2c'):_0x1f0036['qs']=_0x1dacf2;break;case _0x85eb('0x2a'):_0x1f0036['body']=_0x1dacf2;break;}return rp(_0x1f0036)[_0x85eb('0x16')](function(_0x792d3a){logger[_0x85eb('0x2d')](_0x85eb('0x24'),_0x85eb('0x25'),util[_0x85eb('0x26')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x1dacf2['id'],_0x3e23e8['replyUri']));if(_0x792d3a[_0x85eb('0x2e')]['threadId']&&_0x792d3a[_0x85eb('0x2e')]['threadId']!=_0x1dacf2[_0x85eb('0x2f')][_0x85eb('0x30')]){return _0x673228[_0x85eb('0x15')][_0x85eb('0x17')]({'threadId':_0x792d3a[_0x85eb('0x2e')][_0x85eb('0x30')]},{'logging':!![],'where':{'id':_0x1dacf2[_0x85eb('0x2f')]['id']}});}else{return;}})['then'](function(){return _0x50ea77[_0x85eb('0x17')]({'read':!![]});})[_0x85eb('0x19')](function(_0x515ee9){logger[_0x85eb('0x1a')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x85eb('0x31')](_0x515ee9,{'showHidden':![],'depth':null}));_0x40d6b6();});}else{_0x40d6b6();}})[_0x85eb('0x32')](function(){_0x40d6b6();});}else{_0x40d6b6();}}},'charset':_0x85eb('0x33'),'collate':_0x85eb('0x34')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 4e1a0aa..de9d7f3 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x29a6e8,_0x370c7d){var _0x22ddea=function(_0x545e23){while(--_0x545e23){_0x29a6e8['push'](_0x29a6e8['shift']());}};_0x22ddea(++_0x370c7d);}(_0x7a54,0x106));var _0x47a5=function(_0x3614ff,_0x305917){_0x3614ff=_0x3614ff-0x0;var _0x3f1b22=_0x7a54[_0x3614ff];return _0x3f1b22;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file +var _0xdb28=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request'];(function(_0xc82d1a,_0x145c50){var _0x32fad2=function(_0x232731){while(--_0x232731){_0xc82d1a['push'](_0xc82d1a['shift']());}};_0x32fad2(++_0x145c50);}(_0xdb28,0x106));var _0x8db2=function(_0x2871bb,_0x4b9268){_0x2871bb=_0x2871bb-0x0;var _0x2314b2=_0xdb28[_0x2871bb];return _0x2314b2;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateOpenchannelMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateOpenchannelMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 34be2a1..39eb37e 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 _0x9f83=['openchannelMessage:','./openchannelMessage.events','remove','update','emit','removeListener','length'];(function(_0x1e4b82,_0x567a06){var _0x506bf6=function(_0x2ef2e6){while(--_0x2ef2e6){_0x1e4b82['push'](_0x1e4b82['shift']());}};_0x506bf6(++_0x567a06);}(_0x9f83,0x1ac));var _0x39f8=function(_0x4d3d8c,_0x49177c){_0x4d3d8c=_0x4d3d8c-0x0;var _0x956010=_0x9f83[_0x4d3d8c];return _0x956010;};'use strict';var OpenchannelMessageEvents=require(_0x39f8('0x0'));var events=['save',_0x39f8('0x1'),_0x39f8('0x2')];function createListener(_0x512085,_0x5cf0a1){return function(_0x606925){_0x5cf0a1[_0x39f8('0x3')](_0x512085,_0x606925);};}function removeListener(_0x380223,_0x2e80ca){return function(){OpenchannelMessageEvents[_0x39f8('0x4')](_0x380223,_0x2e80ca);};}exports['register']=function(_0x34072a){for(var _0x1202cf=0x0,_0x5832c1=events[_0x39f8('0x5')];_0x1202cf<_0x5832c1;_0x1202cf++){var _0x161f9f=events[_0x1202cf];var _0x2f2121=createListener(_0x39f8('0x6')+_0x161f9f,_0x34072a);OpenchannelMessageEvents['on'](_0x161f9f,_0x2f2121);}}; \ No newline at end of file +var _0x24e9=['./openchannelMessage.events','save','remove','update','emit','removeListener','register','openchannelMessage:'];(function(_0x247201,_0x250e5c){var _0x100619=function(_0x3a763d){while(--_0x3a763d){_0x247201['push'](_0x247201['shift']());}};_0x100619(++_0x250e5c);}(_0x24e9,0x1a8));var _0x924e=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x24e9[_0x32f7d7];return _0x133d09;};'use strict';var OpenchannelMessageEvents=require(_0x924e('0x0'));var events=[_0x924e('0x1'),_0x924e('0x2'),_0x924e('0x3')];function createListener(_0x3089b3,_0x35ba78){return function(_0x19254c){_0x35ba78[_0x924e('0x4')](_0x3089b3,_0x19254c);};}function removeListener(_0x45ee53,_0x5be91d){return function(){OpenchannelMessageEvents[_0x924e('0x5')](_0x45ee53,_0x5be91d);};}exports[_0x924e('0x6')]=function(_0x57a15d){for(var _0x2ae816=0x0,_0x577ea6=events['length'];_0x2ae816<_0x577ea6;_0x2ae816++){var _0x172436=events[_0x2ae816];var _0x6b84c4=createListener(_0x924e('0x7')+_0x172436,_0x57a15d);OpenchannelMessageEvents['on'](_0x172436,_0x6b84c4);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 07ab472..d22804a 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 _0x3033=['/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members'];(function(_0x75eeb1,_0xf52588){var _0x29ff24=function(_0x2c1322){while(--_0x2c1322){_0x75eeb1['push'](_0x75eeb1['shift']());}};_0x29ff24(++_0xf52588);}(_0x3033,0x81));var _0x3303=function(_0x11f69f,_0x1604f6){_0x11f69f=_0x11f69f-0x0;var _0x849d17=_0x3033[_0x11f69f];return _0x849d17;};'use strict';var multer=require(_0x3303('0x0'));var util=require(_0x3303('0x1'));var path=require(_0x3303('0x2'));var timeout=require(_0x3303('0x3'));var express=require(_0x3303('0x4'));var router=express[_0x3303('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3303('0x6'));var interaction=require(_0x3303('0x7'));var config=require('../../config/environment');var controller=require('./openchannelQueue.controller');router[_0x3303('0x8')]('/',auth[_0x3303('0x9')](),controller[_0x3303('0xa')]);router['get'](_0x3303('0xb'),auth['isAuthenticated'](),controller[_0x3303('0xc')]);router[_0x3303('0x8')](_0x3303('0xd'),auth[_0x3303('0x9')](),controller[_0x3303('0xe')]);router[_0x3303('0x8')](_0x3303('0xf'),auth[_0x3303('0x9')](),controller['getMembers']);router[_0x3303('0x8')](_0x3303('0x10'),auth['isAuthenticated'](),controller[_0x3303('0x11')]);router[_0x3303('0x8')]('/:id/users',auth[_0x3303('0x9')](),controller[_0x3303('0x12')]);router[_0x3303('0x13')]('/',auth[_0x3303('0x9')](),controller[_0x3303('0x14')]);router[_0x3303('0x13')]('/:id/teams',auth[_0x3303('0x9')](),controller[_0x3303('0x15')]);router[_0x3303('0x13')](_0x3303('0x16'),auth[_0x3303('0x9')](),controller[_0x3303('0x17')]);router[_0x3303('0x18')](_0x3303('0xd'),auth[_0x3303('0x9')](),controller[_0x3303('0x19')]);router[_0x3303('0x1a')](_0x3303('0xd'),auth[_0x3303('0x9')](),controller['destroy']);router[_0x3303('0x1a')](_0x3303('0x10'),auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0x3303('0x16'),auth['isAuthenticated'](),controller[_0x3303('0x1b')]);module[_0x3303('0x1c')]=router; \ No newline at end of file +var _0xb163=['isAuthenticated','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueue.controller','get'];(function(_0x248d00,_0x1952b1){var _0x274208=function(_0x3ebe8b){while(--_0x3ebe8b){_0x248d00['push'](_0x248d00['shift']());}};_0x274208(++_0x1952b1);}(_0xb163,0x13a));var _0x3b16=function(_0x22146e,_0x2bbbe7){_0x22146e=_0x22146e-0x0;var _0x3f428e=_0xb163[_0x22146e];return _0x3f428e;};'use strict';var multer=require(_0x3b16('0x0'));var util=require(_0x3b16('0x1'));var path=require(_0x3b16('0x2'));var timeout=require(_0x3b16('0x3'));var express=require(_0x3b16('0x4'));var router=express['Router']();var fs_extra=require(_0x3b16('0x5'));var auth=require(_0x3b16('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3b16('0x7'));var controller=require(_0x3b16('0x8'));router[_0x3b16('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3b16('0x9')]('/describe',auth[_0x3b16('0xa')](),controller[_0x3b16('0xb')]);router[_0x3b16('0x9')](_0x3b16('0xc'),auth['isAuthenticated'](),controller[_0x3b16('0xd')]);router[_0x3b16('0x9')]('/:id/members',auth[_0x3b16('0xa')](),controller[_0x3b16('0xe')]);router['get'](_0x3b16('0xf'),auth[_0x3b16('0xa')](),controller[_0x3b16('0x10')]);router[_0x3b16('0x9')](_0x3b16('0x11'),auth[_0x3b16('0xa')](),controller[_0x3b16('0x12')]);router[_0x3b16('0x13')]('/',auth[_0x3b16('0xa')](),controller['create']);router['post']('/:id/teams',auth[_0x3b16('0xa')](),controller[_0x3b16('0x14')]);router[_0x3b16('0x13')](_0x3b16('0x11'),auth[_0x3b16('0xa')](),controller[_0x3b16('0x15')]);router[_0x3b16('0x16')](_0x3b16('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x3b16('0x17')](_0x3b16('0xc'),auth[_0x3b16('0xa')](),controller['destroy']);router[_0x3b16('0x17')]('/:id/teams',auth[_0x3b16('0xa')](),controller[_0x3b16('0x18')]);router['delete'](_0x3b16('0x11'),auth[_0x3b16('0xa')](),controller[_0x3b16('0x19')]);module[_0x3b16('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 517d0d7..b450266 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 _0x55df=['STRING','name','INTEGER','ENUM','rrmemory','sequelize','exports'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x55df,0x12b));var _0xf55d=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x55df[_0x2b7764];return _0x848dcb;};'use strict';var Sequelize=require(_0xf55d('0x0'));module[_0xf55d('0x1')]={'name':{'type':Sequelize[_0xf55d('0x2')],'unique':_0xf55d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf55d('0x2')]},'timeout':{'type':Sequelize[_0xf55d('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf55d('0x5')](_0xf55d('0x6'),'beepall','roundrobin')}}; \ No newline at end of file +var _0x2b80=['sequelize','exports','name','STRING','INTEGER','rrmemory','beepall'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x2b80,0x150));var _0x02b8=function(_0x495ca4,_0x24e8b4){_0x495ca4=_0x495ca4-0x0;var _0x5b734d=_0x2b80[_0x495ca4];return _0x5b734d;};'use strict';var Sequelize=require(_0x02b8('0x0'));module[_0x02b8('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x02b8('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x02b8('0x3')]},'timeout':{'type':Sequelize[_0x02b8('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x02b8('0x5'),_0x02b8('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index de687ae..3e3cbe6 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 _0xf9fa=['filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','catch','show','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','OpenchannelQueueId','UserOpenchannelQueue','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','getTeams','findOne','Team','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','select','field','from','team_has_openchannel_queues','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','compact','value','removeAgents','emit','addAgents','omit','spread','isArray','userOpenchannelQueue:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','get','OpenchannelQueues','UserProfileResource','then','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','key','query','keys'];(function(_0x30f395,_0x3629b5){var _0x2ea0ee=function(_0x35a9af){while(--_0x35a9af){_0x30f395['push'](_0x30f395['shift']());}};_0x2ea0ee(++_0x3629b5);}(_0xf9fa,0xe0));var _0xaf9f=function(_0x306a90,_0x22d045){_0x306a90=_0x306a90-0x0;var _0x33900e=_0xf9fa[_0x306a90];return _0x33900e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaf9f('0x0'));var zipdir=require(_0xaf9f('0x1'));var jsonpatch=require(_0xaf9f('0x2'));var rp=require(_0xaf9f('0x3'));var moment=require(_0xaf9f('0x4'));var BPromise=require(_0xaf9f('0x5'));var Mustache=require(_0xaf9f('0x6'));var util=require(_0xaf9f('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xaf9f('0x8'));var ejs=require(_0xaf9f('0x9'));var fs=require('fs');var fs_extra=require(_0xaf9f('0xa'));var _=require(_0xaf9f('0xb'));var squel=require(_0xaf9f('0xc'));var crypto=require(_0xaf9f('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaf9f('0xe'));var Papa=require(_0xaf9f('0xf'));var Redis=require('ioredis');var authService=require(_0xaf9f('0x10'));var qs=require(_0xaf9f('0x11'));var as=require(_0xaf9f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xaf9f('0x13'));var config=require(_0xaf9f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xaf9f('0x15'))['db'];config[_0xaf9f('0x16')]=_[_0xaf9f('0x17')](config[_0xaf9f('0x16')],{'host':_0xaf9f('0x18'),'port':0x18eb});var socket=require(_0xaf9f('0x19'))(new Redis(config[_0xaf9f('0x16')]));require(_0xaf9f('0x1a'))[_0xaf9f('0x1b')](socket);function respondWithStatusCode(_0x4a4db6,_0x33ecc6){_0x33ecc6=_0x33ecc6||0xcc;return function(_0x2c34be){if(_0x2c34be){return _0x4a4db6[_0xaf9f('0x1c')](_0x33ecc6);}return _0x4a4db6[_0xaf9f('0x1d')](_0x33ecc6)[_0xaf9f('0x1e')]();};}function respondWithResult(_0x3b5a0d,_0x5e442b){_0x5e442b=_0x5e442b||0xc8;return function(_0xe999a4){if(_0xe999a4){return _0x3b5a0d[_0xaf9f('0x1d')](_0x5e442b)[_0xaf9f('0x1f')](_0xe999a4);}};}function respondWithFilteredResult(_0x589d82,_0x4704e7){return function(_0x40e732){if(_0x40e732){var _0x4e10f9=typeof _0x4704e7[_0xaf9f('0x20')]==='undefined'&&typeof _0x4704e7[_0xaf9f('0x21')]===_0xaf9f('0x22');var _0x5067d9=_0x40e732[_0xaf9f('0x23')];var _0x3e2623=_0x4e10f9?0x0:_0x4704e7[_0xaf9f('0x20')];var _0x217ccc=_0x4e10f9?_0x40e732['count']:_0x4704e7[_0xaf9f('0x20')]+_0x4704e7[_0xaf9f('0x21')];var _0xf30ae2;if(_0x217ccc>=_0x5067d9){_0x217ccc=_0x5067d9;_0xf30ae2=0xc8;}else{_0xf30ae2=0xce;}_0x589d82[_0xaf9f('0x1d')](_0xf30ae2);return _0x589d82[_0xaf9f('0x24')](_0xaf9f('0x25'),_0x3e2623+'-'+_0x217ccc+'/'+_0x5067d9)[_0xaf9f('0x1f')](_0x40e732);}return null;};}function patchUpdates(_0x2d1bf4){return function(_0x10ad64){try{jsonpatch[_0xaf9f('0x26')](_0x10ad64,_0x2d1bf4,!![]);}catch(_0x3dafa0){return BPromise[_0xaf9f('0x27')](_0x3dafa0);}return _0x10ad64['save']();};}function saveUpdates(_0x193480,_0x48fcee){return function(_0x2b1a79){if(_0x2b1a79){return _0x2b1a79[_0xaf9f('0x28')](_0x193480)['then'](function(_0x11af3a){return _0x11af3a;});}return null;};}function removeEntity(_0x1b657d,_0x1eb482){return function(_0x5b0a98){if(_0x5b0a98){return _0x5b0a98[_0xaf9f('0x29')]()['then'](function(){var _0x15a8f9=_0x5b0a98[_0xaf9f('0x2a')]({'plain':!![]});var _0x1a6a8c=_0xaf9f('0x2b');return db[_0xaf9f('0x2c')]['destroy']({'where':{'type':_0x1a6a8c,'resourceId':_0x15a8f9['id']}})[_0xaf9f('0x2d')](function(){return _0x5b0a98;});})[_0xaf9f('0x2d')](function(){_0x1b657d[_0xaf9f('0x1d')](0xcc)[_0xaf9f('0x1e')]();});}};}function handleEntityNotFound(_0x3bd65b,_0x14e2f1){return function(_0x4b8cea){if(!_0x4b8cea){_0x3bd65b[_0xaf9f('0x1c')](0x194);}return _0x4b8cea;};}function handleError(_0x50902b,_0xcbe4f2){_0xcbe4f2=_0xcbe4f2||0x1f4;return function(_0x39a892){logger[_0xaf9f('0x2e')](_0x39a892[_0xaf9f('0x2f')]);if(_0x39a892[_0xaf9f('0x30')]){delete _0x39a892['name'];}_0x50902b[_0xaf9f('0x1d')](_0xcbe4f2)[_0xaf9f('0x31')](_0x39a892);};}exports[_0xaf9f('0x32')]=function(_0x964b29,_0x2c4190){var _0x3f2f55={},_0x211e3c={},_0x2ec416={'count':0x0,'rows':[]};var _0x478945=_[_0xaf9f('0x33')](db[_0xaf9f('0x34')][_0xaf9f('0x35')],function(_0x1cf0b3){return{'name':_0x1cf0b3[_0xaf9f('0x36')],'type':_0x1cf0b3['type'][_0xaf9f('0x37')]};});_0x211e3c['model']=_[_0xaf9f('0x33')](_0x478945,'name');_0x211e3c[_0xaf9f('0x38')]=_[_0xaf9f('0x39')](_0x964b29[_0xaf9f('0x38')]);_0x211e3c[_0xaf9f('0x3a')]=_[_0xaf9f('0x3b')](_0x211e3c[_0xaf9f('0x3c')],_0x211e3c[_0xaf9f('0x38')]);_0x3f2f55[_0xaf9f('0x3d')]=_[_0xaf9f('0x3b')](_0x211e3c['model'],qs[_0xaf9f('0x3e')](_0x964b29[_0xaf9f('0x38')][_0xaf9f('0x3e')]));_0x3f2f55[_0xaf9f('0x3d')]=_0x3f2f55[_0xaf9f('0x3d')]['length']?_0x3f2f55[_0xaf9f('0x3d')]:_0x211e3c[_0xaf9f('0x3c')];if(!_0x964b29[_0xaf9f('0x38')][_0xaf9f('0x3f')](_0xaf9f('0x40'))){_0x3f2f55[_0xaf9f('0x21')]=qs[_0xaf9f('0x21')](_0x964b29['query'][_0xaf9f('0x21')]);_0x3f2f55[_0xaf9f('0x20')]=qs[_0xaf9f('0x20')](_0x964b29[_0xaf9f('0x38')][_0xaf9f('0x20')]);}_0x3f2f55[_0xaf9f('0x41')]=qs[_0xaf9f('0x42')](_0x964b29[_0xaf9f('0x38')][_0xaf9f('0x42')]);_0x3f2f55[_0xaf9f('0x43')]=qs[_0xaf9f('0x3a')](_[_0xaf9f('0x44')](_0x964b29['query'],_0x211e3c['filters']),_0x478945);if(_0x964b29[_0xaf9f('0x38')][_0xaf9f('0x45')]){_0x3f2f55[_0xaf9f('0x43')]=_[_0xaf9f('0x46')](_0x3f2f55[_0xaf9f('0x43')],{'$or':_[_0xaf9f('0x33')](_0x478945,function(_0x3dae83){if(_0x3dae83[_0xaf9f('0x47')]!=='VIRTUAL'){var _0x1adbdf={};_0x1adbdf[_0x3dae83['name']]={'$like':'%'+_0x964b29[_0xaf9f('0x38')][_0xaf9f('0x45')]+'%'};return _0x1adbdf;}})});}_0x3f2f55=_[_0xaf9f('0x46')]({},_0x3f2f55,_0x964b29[_0xaf9f('0x48')]);var _0x34541a={'where':_0x3f2f55[_0xaf9f('0x43')]};return db[_0xaf9f('0x34')][_0xaf9f('0x23')](_0x34541a)[_0xaf9f('0x2d')](function(_0x36ba8f){_0x2ec416[_0xaf9f('0x23')]=_0x36ba8f;if(_0x964b29[_0xaf9f('0x38')][_0xaf9f('0x49')]){_0x3f2f55['include']=[{'all':!![]}];}return db[_0xaf9f('0x34')][_0xaf9f('0x4a')](_0x3f2f55);})[_0xaf9f('0x2d')](function(_0x150d21){_0x2ec416[_0xaf9f('0x4b')]=_0x150d21;return _0x2ec416;})['then'](respondWithFilteredResult(_0x2c4190,_0x3f2f55))[_0xaf9f('0x4c')](handleError(_0x2c4190,null));};exports[_0xaf9f('0x4d')]=function(_0x2dcf3e,_0x33cbbf){var _0x49af88={'raw':!![],'where':{'id':_0x2dcf3e['params']['id']}},_0x516ac6={};_0x516ac6[_0xaf9f('0x3c')]=_['keys'](db[_0xaf9f('0x34')]['rawAttributes']);_0x516ac6[_0xaf9f('0x38')]=_[_0xaf9f('0x39')](_0x2dcf3e[_0xaf9f('0x38')]);_0x516ac6[_0xaf9f('0x3a')]=_[_0xaf9f('0x3b')](_0x516ac6[_0xaf9f('0x3c')],_0x516ac6[_0xaf9f('0x38')]);_0x49af88['attributes']=_['intersection'](_0x516ac6[_0xaf9f('0x3c')],qs['fields'](_0x2dcf3e['query'][_0xaf9f('0x3e')]));_0x49af88[_0xaf9f('0x3d')]=_0x49af88[_0xaf9f('0x3d')][_0xaf9f('0x4e')]?_0x49af88[_0xaf9f('0x3d')]:_0x516ac6['model'];if(_0x2dcf3e[_0xaf9f('0x38')][_0xaf9f('0x49')]){_0x49af88['include']=[{'all':!![]}];}_0x49af88=_[_0xaf9f('0x46')]({},_0x49af88,_0x2dcf3e['options']);return db[_0xaf9f('0x34')][_0xaf9f('0x4f')](_0x49af88)['then'](handleEntityNotFound(_0x33cbbf,null))[_0xaf9f('0x2d')](respondWithResult(_0x33cbbf,null))[_0xaf9f('0x4c')](handleError(_0x33cbbf,null));};exports[_0xaf9f('0x50')]=function(_0x271bfb,_0x3720c5){return db[_0xaf9f('0x34')][_0xaf9f('0x50')](_0x271bfb[_0xaf9f('0x51')],{})['then'](function(_0xd68ca9){var _0x336612=_0x271bfb[_0xaf9f('0x52')][_0xaf9f('0x2a')]({'plain':!![]});if(!_0x336612)throw new Error(_0xaf9f('0x53'));if(_0x336612[_0xaf9f('0x54')]===_0xaf9f('0x52')){var _0x5cd0b6=_0xd68ca9[_0xaf9f('0x2a')]({'plain':!![]});var _0x3bae45=_0xaf9f('0x2b');return db[_0xaf9f('0x55')][_0xaf9f('0x4f')]({'where':{'name':_0x3bae45,'userProfileId':_0x336612[_0xaf9f('0x56')]},'raw':!![]})[_0xaf9f('0x2d')](function(_0x4137be){if(_0x4137be&&_0x4137be[_0xaf9f('0x57')]===0x0){return db[_0xaf9f('0x2c')][_0xaf9f('0x50')]({'name':_0x5cd0b6[_0xaf9f('0x30')],'resourceId':_0x5cd0b6['id'],'type':_0x4137be['name'],'sectionId':_0x4137be['id']},{})['then'](function(){return _0xd68ca9;});}else{return _0xd68ca9;}})[_0xaf9f('0x4c')](function(_0x35c84c){logger[_0xaf9f('0x2e')](_0xaf9f('0x58'),_0x35c84c);throw _0x35c84c;});}return _0xd68ca9;})[_0xaf9f('0x2d')](respondWithResult(_0x3720c5,0xc9))[_0xaf9f('0x4c')](handleError(_0x3720c5,null));};exports[_0xaf9f('0x28')]=function(_0xa0c2cc,_0x5c403e){if(_0xa0c2cc['body']['id']){delete _0xa0c2cc['body']['id'];}return db[_0xaf9f('0x34')]['find']({'where':{'id':_0xa0c2cc['params']['id']}})[_0xaf9f('0x2d')](handleEntityNotFound(_0x5c403e,null))['then'](saveUpdates(_0xa0c2cc[_0xaf9f('0x51')],null))[_0xaf9f('0x2d')](respondWithResult(_0x5c403e,null))[_0xaf9f('0x4c')](handleError(_0x5c403e,null));};exports[_0xaf9f('0x29')]=function(_0x58efe7,_0x13f637){return db[_0xaf9f('0x34')][_0xaf9f('0x4f')]({'where':{'id':_0x58efe7[_0xaf9f('0x59')]['id']}})[_0xaf9f('0x2d')](handleEntityNotFound(_0x13f637,null))[_0xaf9f('0x2d')](removeEntity(_0x13f637,null))[_0xaf9f('0x4c')](handleError(_0x13f637,null));};exports[_0xaf9f('0x5a')]=function(_0x2ea3c3,_0x2138ec){return db[_0xaf9f('0x34')]['describe']()[_0xaf9f('0x2d')](respondWithResult(_0x2138ec,null))[_0xaf9f('0x4c')](handleError(_0x2138ec,null));};exports['getMembers']=function(_0x430262,_0x5d5581,_0x47a91b){var _0x24422e={'raw':!![],'where':{}},_0x38d41f={},_0x261fa5;return db[_0xaf9f('0x34')]['findOne']({'where':{'id':_0x430262['params']['id']}})['then'](handleEntityNotFound(_0x5d5581,null))[_0xaf9f('0x2d')](function(_0x4d5ab7){if(_0x4d5ab7){_0x261fa5=_0x4d5ab7[_0xaf9f('0x2a')]({'plain':!![]});_0x38d41f[_0xaf9f('0x3c')]=_[_0xaf9f('0x39')](db['UserOpenchannelQueue'][_0xaf9f('0x35')]);_0x38d41f[_0xaf9f('0x38')]=_['keys'](_0x430262['query']);_0x38d41f[_0xaf9f('0x3a')]=_[_0xaf9f('0x3b')](_0x38d41f[_0xaf9f('0x3c')],_0x38d41f[_0xaf9f('0x38')]);_0x24422e[_0xaf9f('0x3d')]=_[_0xaf9f('0x3b')](_0x38d41f[_0xaf9f('0x3c')],qs['fields'](_0x430262[_0xaf9f('0x38')]['fields']));_0x24422e['attributes']=_0x24422e[_0xaf9f('0x3d')][_0xaf9f('0x4e')]?_0x24422e['attributes']:_0x38d41f[_0xaf9f('0x3c')];if(!_0x430262['query'][_0xaf9f('0x3f')](_0xaf9f('0x40'))){_0x24422e[_0xaf9f('0x21')]=qs['limit'](_0x430262[_0xaf9f('0x38')]['limit']);_0x24422e['offset']=qs[_0xaf9f('0x20')](_0x430262[_0xaf9f('0x38')]['offset']);}_0x24422e['order']=qs[_0xaf9f('0x42')](_0x430262[_0xaf9f('0x38')][_0xaf9f('0x42')]);_0x24422e[_0xaf9f('0x43')]=qs['filters'](_[_0xaf9f('0x44')](_0x430262[_0xaf9f('0x38')],_0x38d41f[_0xaf9f('0x3a')]));_0x24422e[_0xaf9f('0x43')][_0xaf9f('0x5b')]=_0x4d5ab7['id'];if(_0x430262[_0xaf9f('0x38')][_0xaf9f('0x45')]){_0x24422e['where']=_[_0xaf9f('0x46')](_0x24422e[_0xaf9f('0x43')],{'$or':_['map'](_0x24422e[_0xaf9f('0x3d')],function(_0xe7473f){var _0x39983e={};_0x39983e[_0xe7473f]={'$like':'%'+_0x430262[_0xaf9f('0x38')][_0xaf9f('0x45')]+'%'};return _0x39983e;})});}_0x24422e=_[_0xaf9f('0x46')]({},_0x24422e,_0x430262[_0xaf9f('0x48')]);return db[_0xaf9f('0x5c')][_0xaf9f('0x4a')](_0x24422e);}})[_0xaf9f('0x2d')](function(_0xeb6a82){if(_0xeb6a82){return db[_0xaf9f('0x5d')][_0xaf9f('0x5e')]({'where':{'id':_['map'](_0xeb6a82,_0xaf9f('0x5f')),'role':_0xaf9f('0x60')},'attributes':['id','name',_0xaf9f('0x61'),_0xaf9f('0x62'),_0xaf9f('0x63')]});}})[_0xaf9f('0x2d')](function(_0x37ac18){if(_0x37ac18){return{'count':_0x37ac18['count'],'rows':_[_0xaf9f('0x33')](_0x37ac18[_0xaf9f('0x4b')],function(_0x380b7a){return{'membername':_0x380b7a[_0xaf9f('0x30')],'UserId':_0x380b7a['id'],'queue_name':_0x261fa5[_0xaf9f('0x30')],'OpenchannelQueueId':_0x261fa5['id'],'interface':util[_0xaf9f('0x64')](_0xaf9f('0x65'),'SIP',_0x380b7a['name']),'penalty':0x0,'paused':_0x380b7a[_0xaf9f('0x61')],'createdAt':_0x380b7a[_0xaf9f('0x63')],'updatedAt':_0x380b7a[_0xaf9f('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xaf9f('0x2d')](respondWithFilteredResult(_0x5d5581,_0x24422e))[_0xaf9f('0x4c')](handleError(_0x5d5581,null));};exports[_0xaf9f('0x66')]=function(_0x1f6859,_0xfbfb2b,_0x250b7b){var _0x3676d9={};var _0x5ab341={};var _0x17dd4a;var _0x188b16;return db['OpenchannelQueue'][_0xaf9f('0x67')]({'where':{'id':_0x1f6859[_0xaf9f('0x59')]['id']}})[_0xaf9f('0x2d')](handleEntityNotFound(_0xfbfb2b,null))[_0xaf9f('0x2d')](function(_0x124b52){if(_0x124b52){_0x17dd4a=_0x124b52;_0x5ab341[_0xaf9f('0x3c')]=_[_0xaf9f('0x39')](db[_0xaf9f('0x68')]['rawAttributes']);_0x5ab341[_0xaf9f('0x38')]=_['keys'](_0x1f6859[_0xaf9f('0x38')]);_0x5ab341[_0xaf9f('0x3a')]=_['intersection'](_0x5ab341[_0xaf9f('0x3c')],_0x5ab341[_0xaf9f('0x38')]);_0x3676d9[_0xaf9f('0x3d')]=_[_0xaf9f('0x3b')](_0x5ab341['model'],qs[_0xaf9f('0x3e')](_0x1f6859[_0xaf9f('0x38')][_0xaf9f('0x3e')]));_0x3676d9['attributes']=_0x3676d9[_0xaf9f('0x3d')]['length']?_0x3676d9[_0xaf9f('0x3d')]:_0x5ab341['model'];_0x3676d9[_0xaf9f('0x41')]=qs[_0xaf9f('0x42')](_0x1f6859[_0xaf9f('0x38')]['sort']);_0x3676d9[_0xaf9f('0x43')]=qs[_0xaf9f('0x3a')](_['pick'](_0x1f6859[_0xaf9f('0x38')],_0x5ab341[_0xaf9f('0x3a')]));if(_0x1f6859['query'][_0xaf9f('0x45')]){_0x3676d9[_0xaf9f('0x43')]=_[_0xaf9f('0x46')](_0x3676d9['where'],{'$or':_[_0xaf9f('0x33')](_0x3676d9[_0xaf9f('0x3d')],function(_0x1692c7){var _0x59c009={};_0x59c009[_0x1692c7]={'$like':'%'+_0x1f6859[_0xaf9f('0x38')][_0xaf9f('0x45')]+'%'};return _0x59c009;})});}_0x3676d9=_[_0xaf9f('0x46')]({},_0x3676d9,_0x1f6859[_0xaf9f('0x48')]);return _0x17dd4a[_0xaf9f('0x66')](_0x3676d9);}})[_0xaf9f('0x2d')](function(_0x204cb2){if(_0x204cb2){_0x188b16=_0x204cb2[_0xaf9f('0x4e')];if(!_0x1f6859[_0xaf9f('0x38')]['hasOwnProperty'](_0xaf9f('0x40'))){_0x3676d9[_0xaf9f('0x21')]=qs[_0xaf9f('0x21')](_0x1f6859[_0xaf9f('0x38')][_0xaf9f('0x21')]);_0x3676d9[_0xaf9f('0x20')]=qs['offset'](_0x1f6859[_0xaf9f('0x38')][_0xaf9f('0x20')]);}return _0x17dd4a[_0xaf9f('0x66')](_0x3676d9);}})[_0xaf9f('0x2d')](function(_0x79035d){if(_0x79035d){return _0x79035d?{'count':_0x188b16,'rows':_0x79035d}:null;}})['then'](respondWithResult(_0xfbfb2b,null))[_0xaf9f('0x4c')](handleError(_0xfbfb2b,null));};exports['addTeams']=function(_0x9baecd,_0x2577ec,_0x4b0a84){var _0x6e2718=_0x9baecd['body'][_0xaf9f('0x69')];return db[_0xaf9f('0x68')]['findAll']({'where':{'id':_0x6e2718},'attributes':['id'],'include':[{'model':db['User'],'as':_0xaf9f('0x6a'),'attributes':['id',_0xaf9f('0x30'),_0xaf9f('0x6b'),_0xaf9f('0x6c'),_0xaf9f('0x6d')],'raw':!![]}]})[_0xaf9f('0x2d')](function(_0xf7f2cd){if(_0xf7f2cd){var _0x42f0aa=_[_0xaf9f('0x6e')](_0xf7f2cd,function(_0x4b608b){var _0x3f359d=_0x4b608b[_0xaf9f('0x2a')]({'plain':!![]});return _0x3f359d[_0xaf9f('0x6a')];});return db[_0xaf9f('0x34')][_0xaf9f('0x4f')]({'where':{'id':_0x9baecd[_0xaf9f('0x59')]['id']}})['then'](function(_0x1154b7){return db[_0xaf9f('0x6f')][_0xaf9f('0x70')](function(_0x3943aa){return _0x1154b7[_0xaf9f('0x71')](_0x6e2718,{'transaction':_0x3943aa})['then'](function(){return BPromise['each'](_0x42f0aa,function(_0x458bf9){return db[_0xaf9f('0x5c')][_0xaf9f('0x72')]({'where':{'UserId':_0x458bf9['id'],'OpenchannelQueueId':_0x9baecd['params']['id']},'transaction':_0x3943aa});});})[_0xaf9f('0x2d')](function(){_0x42f0aa[_0xaf9f('0x73')](function(_0x41d4d3){socket['emit'](_0xaf9f('0x74'),{'UserId':_0x41d4d3['id'],'OpenchannelQueueId':_0x1154b7['id']});});});});});}})['then'](respondWithStatusCode(_0x2577ec,null))[_0xaf9f('0x4c')](handleError(_0x2577ec,null));};exports[_0xaf9f('0x75')]=function(_0x3e0b9f,_0x132556,_0x29972b){return db[_0xaf9f('0x68')][_0xaf9f('0x4a')]({'where':{'id':_0x3e0b9f[_0xaf9f('0x38')][_0xaf9f('0x69')]},'attributes':['id'],'include':[{'model':db[_0xaf9f('0x5d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xaf9f('0x2d')](handleEntityNotFound(_0x132556,null))[_0xaf9f('0x2d')](function(_0x450090){var _0x88f9b4=_[_0xaf9f('0x33')](_0x450090,'id');var _0x13e059=[];var _0x2caf94=[];var _0x16bd4f=squel[_0xaf9f('0x76')]();_0x16bd4f[_0xaf9f('0x77')]('tq.TeamId')[_0xaf9f('0x78')](_0xaf9f('0x79'),'tq')['join']('user_has_teams','ut',_0xaf9f('0x7a'))[_0xaf9f('0x43')]('OpenchannelQueueId\x20=\x20?',_0x3e0b9f[_0xaf9f('0x59')]['id']);for(var _0xf889f4=0x0;_0xf889f4<_0x450090['length'];_0xf889f4+=0x1){let _0x47ea4b=_0x450090[_0xf889f4];for(var _0x4e557f=0x0;_0x4e557f<_0x47ea4b[_0xaf9f('0x6a')]['length'];_0x4e557f+=0x1){let _0x54b8dd=_0x47ea4b[_0xaf9f('0x6a')][_0x4e557f];var _0x492c50=_0x16bd4f[_0xaf9f('0x7b')]();_0x492c50[_0xaf9f('0x43')](_0xaf9f('0x7c'),_0x54b8dd['id']);_0x2caf94[_0xaf9f('0x7d')](db['sequelize']['query'](_0x492c50[_0xaf9f('0x7e')](),{'type':db[_0xaf9f('0x6f')][_0xaf9f('0x7f')][_0xaf9f('0x80')]})[_0xaf9f('0x2d')](function(_0x5a9e47){if(_0x5a9e47[_0xaf9f('0x4e')]===0x1){return _0x54b8dd['id'];}else{var _0x117cdd=_['every'](_[_0xaf9f('0x33')](_0x5a9e47,_0xaf9f('0x81')),function(_0x45af13){return _['includes'](_0x88f9b4,_0x45af13);});if(_0x117cdd){return _0x54b8dd['id'];}}}));}}return BPromise[_0xaf9f('0x82')](_0x2caf94)[_0xaf9f('0x2d')](function(_0x4da607){_0x13e059=_(_0x13e059)['union'](_0x4da607)[_0xaf9f('0x83')]()[_0xaf9f('0x84')]();return db[_0xaf9f('0x34')][_0xaf9f('0x4f')]({'where':{'id':_0x3e0b9f['params']['id']}})[_0xaf9f('0x2d')](function(_0x51fe80){return db[_0xaf9f('0x6f')]['transaction'](function(_0x1544d4){return _0x51fe80['removeTeams'](_0x3e0b9f[_0xaf9f('0x38')][_0xaf9f('0x69')],{'transaction':_0x1544d4})[_0xaf9f('0x2d')](function(){if(!_['isEmpty'](_0x13e059)){return _0x51fe80[_0xaf9f('0x85')](_0x13e059,{'transaction':_0x1544d4});}})['then'](function(){_0x13e059['forEach'](function(_0x5e6232){socket[_0xaf9f('0x86')]('userOpenchannelQueue:remove',{'UserId':_0x5e6232,'OpenchannelQueueId':_0x51fe80['id']});});});});});});})[_0xaf9f('0x2d')](respondWithStatusCode(_0x132556,null))['catch'](handleError(_0x132556,null));};exports[_0xaf9f('0x87')]=function(_0xbb20da,_0x2be95e,_0x155607){return db[_0xaf9f('0x34')][_0xaf9f('0x4f')]({'where':{'id':_0xbb20da['params']['id']}})['then'](handleEntityNotFound(_0x2be95e,null))[_0xaf9f('0x2d')](function(_0x35d6dd){if(_0x35d6dd){return _0x35d6dd[_0xaf9f('0x87')](_0xbb20da[_0xaf9f('0x51')][_0xaf9f('0x69')],_[_0xaf9f('0x88')](_0xbb20da[_0xaf9f('0x51')],['ids','id'])||{})[_0xaf9f('0x89')](function(_0x32f169){for(var _0x55052e=0x0;_0x55052e<_0xbb20da[_0xaf9f('0x51')]['ids']['length'];_0x55052e+=0x1){socket[_0xaf9f('0x86')](_0xaf9f('0x74'),{'UserId':Number(_0xbb20da['body'][_0xaf9f('0x69')][_0x55052e]),'OpenchannelQueueId':Number(_0xbb20da[_0xaf9f('0x59')]['id'])});}return _0x32f169;});}})[_0xaf9f('0x2d')](respondWithResult(_0x2be95e,null))[_0xaf9f('0x4c')](handleError(_0x2be95e,null));};exports[_0xaf9f('0x85')]=function(_0x5f87dc,_0x3240c2,_0x4da1c9){return db['OpenchannelQueue'][_0xaf9f('0x4f')]({'where':{'id':_0x5f87dc['params']['id']}})['then'](handleEntityNotFound(_0x3240c2,null))['then'](function(_0x101c99){if(_0x101c99){return _0x101c99[_0xaf9f('0x85')](_0x5f87dc[_0xaf9f('0x38')][_0xaf9f('0x69')])['then'](function(){if(_[_0xaf9f('0x8a')](_0x5f87dc[_0xaf9f('0x38')][_0xaf9f('0x69')])){for(var _0x5e0e30=0x0;_0x5e0e30<_0x5f87dc[_0xaf9f('0x38')]['ids'][_0xaf9f('0x4e')];_0x5e0e30+=0x1){socket[_0xaf9f('0x86')](_0xaf9f('0x8b'),{'UserId':Number(_0x5f87dc[_0xaf9f('0x38')][_0xaf9f('0x69')][_0x5e0e30]),'OpenchannelQueueId':Number(_0x5f87dc[_0xaf9f('0x59')]['id'])});}}else{socket[_0xaf9f('0x86')](_0xaf9f('0x8b'),{'UserId':Number(_0x5f87dc[_0xaf9f('0x38')][_0xaf9f('0x69')]),'OpenchannelQueueId':Number(_0x5f87dc['params']['id'])});}});}})[_0xaf9f('0x2d')](respondWithStatusCode(_0x3240c2,null))[_0xaf9f('0x4c')](handleError(_0x3240c2,null));};exports[_0xaf9f('0x8c')]=function(_0x33593d,_0x3d1424,_0xcbf52a){var _0x2889e1={};var _0x4ef5f5={};var _0x5b6e28;var _0x2bca6f;return db['OpenchannelQueue'][_0xaf9f('0x67')]({'where':{'id':_0x33593d['params']['id']}})[_0xaf9f('0x2d')](handleEntityNotFound(_0x3d1424,null))[_0xaf9f('0x2d')](function(_0x27ca23){if(_0x27ca23){_0x5b6e28=_0x27ca23;_0x4ef5f5[_0xaf9f('0x3c')]=_[_0xaf9f('0x39')](db[_0xaf9f('0x5d')]['rawAttributes']);_0x4ef5f5[_0xaf9f('0x38')]=_[_0xaf9f('0x39')](_0x33593d['query']);_0x4ef5f5[_0xaf9f('0x3a')]=_[_0xaf9f('0x3b')](_0x4ef5f5['model'],_0x4ef5f5[_0xaf9f('0x38')]);_0x2889e1[_0xaf9f('0x3d')]=_[_0xaf9f('0x3b')](_0x4ef5f5[_0xaf9f('0x3c')],qs['fields'](_0x33593d[_0xaf9f('0x38')][_0xaf9f('0x3e')]));_0x2889e1[_0xaf9f('0x3d')]=_0x2889e1['attributes'][_0xaf9f('0x4e')]?_0x2889e1[_0xaf9f('0x3d')]:_0x4ef5f5['model'];_0x2889e1['order']=qs[_0xaf9f('0x42')](_0x33593d[_0xaf9f('0x38')][_0xaf9f('0x42')]);_0x2889e1[_0xaf9f('0x43')]=qs[_0xaf9f('0x3a')](_['pick'](_0x33593d[_0xaf9f('0x38')],_0x4ef5f5[_0xaf9f('0x3a')]));if(_0x33593d[_0xaf9f('0x38')][_0xaf9f('0x45')]){_0x2889e1['where']=_['merge'](_0x2889e1[_0xaf9f('0x43')],{'$or':_[_0xaf9f('0x33')](_0x2889e1[_0xaf9f('0x3d')],function(_0x6d9a86){var _0xc0fe5c={};_0xc0fe5c[_0x6d9a86]={'$like':'%'+_0x33593d[_0xaf9f('0x38')][_0xaf9f('0x45')]+'%'};return _0xc0fe5c;})});}_0x2889e1=_['merge']({},_0x2889e1,_0x33593d[_0xaf9f('0x48')]);return _0x5b6e28[_0xaf9f('0x8c')](_0x2889e1);}})['then'](function(_0x2fce1f){if(_0x2fce1f){_0x2bca6f=_0x2fce1f['length'];if(!_0x33593d['query'][_0xaf9f('0x3f')](_0xaf9f('0x40'))){_0x2889e1[_0xaf9f('0x21')]=qs[_0xaf9f('0x21')](_0x33593d[_0xaf9f('0x38')][_0xaf9f('0x21')]);_0x2889e1[_0xaf9f('0x20')]=qs[_0xaf9f('0x20')](_0x33593d[_0xaf9f('0x38')][_0xaf9f('0x20')]);}return _0x5b6e28[_0xaf9f('0x8c')](_0x2889e1);}})['then'](function(_0x51a0a5){if(_0x51a0a5){return _0x51a0a5?{'count':_0x2bca6f,'rows':_0x51a0a5}:null;}})[_0xaf9f('0x2d')](respondWithResult(_0x3d1424,null))[_0xaf9f('0x4c')](handleError(_0x3d1424,null));}; \ No newline at end of file +var _0xe4fb=['OpenchannelQueueId','UserId','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','User','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','ids','select','field','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','addAgents','omit','isArray','userOpenchannelQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','end','status','json','limit','count','offset','Content-Range','save','then','destroy','get','OpenchannelQueues','UserProfileResource','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','where','pick','filter','merge','includeAll','include','OpenchannelQueue','findAll','rows','catch','show','params','length','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','update','find','describe','getMembers','findOne','UserOpenchannelQueue','nolimit','sort'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0xe4fb,0x1d4));var _0xbe4f=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xe4fb[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0xbe4f('0x0'));var rimraf=require(_0xbe4f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbe4f('0x2'));var rp=require(_0xbe4f('0x3'));var moment=require(_0xbe4f('0x4'));var BPromise=require(_0xbe4f('0x5'));var Mustache=require(_0xbe4f('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xbe4f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbe4f('0x8'));var _=require(_0xbe4f('0x9'));var squel=require(_0xbe4f('0xa'));var crypto=require(_0xbe4f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xbe4f('0xc'));var toCsv=require(_0xbe4f('0x7'));var querystring=require(_0xbe4f('0xd'));var Papa=require(_0xbe4f('0xe'));var Redis=require(_0xbe4f('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbe4f('0x10'));var hardwareService=require(_0xbe4f('0x11'));var logger=require(_0xbe4f('0x12'))(_0xbe4f('0x13'));var utils=require(_0xbe4f('0x14'));var config=require(_0xbe4f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xbe4f('0x16'))['db'];config[_0xbe4f('0x17')]=_[_0xbe4f('0x18')](config[_0xbe4f('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xbe4f('0x19'))(new Redis(config[_0xbe4f('0x17')]));require(_0xbe4f('0x1a'))[_0xbe4f('0x1b')](socket);function respondWithStatusCode(_0x132cce,_0x55e526){_0x55e526=_0x55e526||0xcc;return function(_0x561f27){if(_0x561f27){return _0x132cce['sendStatus'](_0x55e526);}return _0x132cce['status'](_0x55e526)[_0xbe4f('0x1c')]();};}function respondWithResult(_0x17358c,_0x534a41){_0x534a41=_0x534a41||0xc8;return function(_0x173ada){if(_0x173ada){return _0x17358c[_0xbe4f('0x1d')](_0x534a41)[_0xbe4f('0x1e')](_0x173ada);}};}function respondWithFilteredResult(_0x37caba,_0x5dc592){return function(_0x135f6d){if(_0x135f6d){var _0x17a80b=typeof _0x5dc592['offset']==='undefined'&&typeof _0x5dc592[_0xbe4f('0x1f')]==='undefined';var _0x3ccb1a=_0x135f6d[_0xbe4f('0x20')];var _0x1ad4fd=_0x17a80b?0x0:_0x5dc592[_0xbe4f('0x21')];var _0x2c5f0b=_0x17a80b?_0x135f6d[_0xbe4f('0x20')]:_0x5dc592[_0xbe4f('0x21')]+_0x5dc592['limit'];var _0x2b3466;if(_0x2c5f0b>=_0x3ccb1a){_0x2c5f0b=_0x3ccb1a;_0x2b3466=0xc8;}else{_0x2b3466=0xce;}_0x37caba[_0xbe4f('0x1d')](_0x2b3466);return _0x37caba['set'](_0xbe4f('0x22'),_0x1ad4fd+'-'+_0x2c5f0b+'/'+_0x3ccb1a)[_0xbe4f('0x1e')](_0x135f6d);}return null;};}function patchUpdates(_0x51f44e){return function(_0x44c059){try{jsonpatch['apply'](_0x44c059,_0x51f44e,!![]);}catch(_0x5ac03d){return BPromise['reject'](_0x5ac03d);}return _0x44c059[_0xbe4f('0x23')]();};}function saveUpdates(_0x21c0ed,_0x3676ad){return function(_0xe129e6){if(_0xe129e6){return _0xe129e6['update'](_0x21c0ed)[_0xbe4f('0x24')](function(_0x78c0d4){return _0x78c0d4;});}return null;};}function removeEntity(_0x4bdc34,_0x318072){return function(_0x4a5547){if(_0x4a5547){return _0x4a5547[_0xbe4f('0x25')]()[_0xbe4f('0x24')](function(){var _0x4c837c=_0x4a5547[_0xbe4f('0x26')]({'plain':!![]});var _0x32cb11=_0xbe4f('0x27');return db[_0xbe4f('0x28')][_0xbe4f('0x25')]({'where':{'type':_0x32cb11,'resourceId':_0x4c837c['id']}})[_0xbe4f('0x24')](function(){return _0x4a5547;});})[_0xbe4f('0x24')](function(){_0x4bdc34[_0xbe4f('0x1d')](0xcc)[_0xbe4f('0x1c')]();});}};}function handleEntityNotFound(_0x3b18e1,_0x4dc627){return function(_0xb0cc11){if(!_0xb0cc11){_0x3b18e1['sendStatus'](0x194);}return _0xb0cc11;};}function handleError(_0x537a02,_0x5c4765){_0x5c4765=_0x5c4765||0x1f4;return function(_0x4011cf){logger['error'](_0x4011cf[_0xbe4f('0x29')]);if(_0x4011cf[_0xbe4f('0x2a')]){delete _0x4011cf['name'];}_0x537a02[_0xbe4f('0x1d')](_0x5c4765)[_0xbe4f('0x2b')](_0x4011cf);};}exports[_0xbe4f('0x2c')]=function(_0x19a610,_0x143231){var _0x358f9d={},_0x92ebe6={},_0x33f11d={'count':0x0,'rows':[]};var _0x127fc3=_[_0xbe4f('0x2d')](db['OpenchannelQueue'][_0xbe4f('0x2e')],function(_0x3fd77e){return{'name':_0x3fd77e['fieldName'],'type':_0x3fd77e[_0xbe4f('0x2f')][_0xbe4f('0x30')]};});_0x92ebe6[_0xbe4f('0x31')]=_[_0xbe4f('0x2d')](_0x127fc3,_0xbe4f('0x2a'));_0x92ebe6[_0xbe4f('0x32')]=_[_0xbe4f('0x33')](_0x19a610[_0xbe4f('0x32')]);_0x92ebe6[_0xbe4f('0x34')]=_[_0xbe4f('0x35')](_0x92ebe6[_0xbe4f('0x31')],_0x92ebe6[_0xbe4f('0x32')]);_0x358f9d[_0xbe4f('0x36')]=_[_0xbe4f('0x35')](_0x92ebe6[_0xbe4f('0x31')],qs[_0xbe4f('0x37')](_0x19a610['query'][_0xbe4f('0x37')]));_0x358f9d[_0xbe4f('0x36')]=_0x358f9d[_0xbe4f('0x36')]['length']?_0x358f9d[_0xbe4f('0x36')]:_0x92ebe6[_0xbe4f('0x31')];if(!_0x19a610['query'][_0xbe4f('0x38')]('nolimit')){_0x358f9d[_0xbe4f('0x1f')]=qs[_0xbe4f('0x1f')](_0x19a610['query'][_0xbe4f('0x1f')]);_0x358f9d[_0xbe4f('0x21')]=qs[_0xbe4f('0x21')](_0x19a610[_0xbe4f('0x32')][_0xbe4f('0x21')]);}_0x358f9d[_0xbe4f('0x39')]=qs['sort'](_0x19a610[_0xbe4f('0x32')]['sort']);_0x358f9d[_0xbe4f('0x3a')]=qs[_0xbe4f('0x34')](_[_0xbe4f('0x3b')](_0x19a610[_0xbe4f('0x32')],_0x92ebe6['filters']),_0x127fc3);if(_0x19a610['query'][_0xbe4f('0x3c')]){_0x358f9d[_0xbe4f('0x3a')]=_[_0xbe4f('0x3d')](_0x358f9d[_0xbe4f('0x3a')],{'$or':_['map'](_0x127fc3,function(_0x4c6f21){if(_0x4c6f21[_0xbe4f('0x2f')]!=='VIRTUAL'){var _0x1cf36b={};_0x1cf36b[_0x4c6f21[_0xbe4f('0x2a')]]={'$like':'%'+_0x19a610[_0xbe4f('0x32')][_0xbe4f('0x3c')]+'%'};return _0x1cf36b;}})});}_0x358f9d=_[_0xbe4f('0x3d')]({},_0x358f9d,_0x19a610['options']);var _0x4853e6={'where':_0x358f9d['where']};return db['OpenchannelQueue']['count'](_0x4853e6)[_0xbe4f('0x24')](function(_0x43fbdf){_0x33f11d[_0xbe4f('0x20')]=_0x43fbdf;if(_0x19a610[_0xbe4f('0x32')][_0xbe4f('0x3e')]){_0x358f9d[_0xbe4f('0x3f')]=[{'all':!![]}];}return db[_0xbe4f('0x40')][_0xbe4f('0x41')](_0x358f9d);})[_0xbe4f('0x24')](function(_0x177b97){_0x33f11d[_0xbe4f('0x42')]=_0x177b97;return _0x33f11d;})[_0xbe4f('0x24')](respondWithFilteredResult(_0x143231,_0x358f9d))[_0xbe4f('0x43')](handleError(_0x143231,null));};exports[_0xbe4f('0x44')]=function(_0x3f894f,_0x28d032){var _0x37f0d8={'raw':!![],'where':{'id':_0x3f894f[_0xbe4f('0x45')]['id']}},_0x2f67f7={};_0x2f67f7['model']=_['keys'](db[_0xbe4f('0x40')][_0xbe4f('0x2e')]);_0x2f67f7[_0xbe4f('0x32')]=_['keys'](_0x3f894f[_0xbe4f('0x32')]);_0x2f67f7[_0xbe4f('0x34')]=_[_0xbe4f('0x35')](_0x2f67f7['model'],_0x2f67f7['query']);_0x37f0d8['attributes']=_[_0xbe4f('0x35')](_0x2f67f7[_0xbe4f('0x31')],qs[_0xbe4f('0x37')](_0x3f894f['query']['fields']));_0x37f0d8[_0xbe4f('0x36')]=_0x37f0d8[_0xbe4f('0x36')][_0xbe4f('0x46')]?_0x37f0d8[_0xbe4f('0x36')]:_0x2f67f7[_0xbe4f('0x31')];if(_0x3f894f[_0xbe4f('0x32')]['includeAll']){_0x37f0d8[_0xbe4f('0x3f')]=[{'all':!![]}];}_0x37f0d8=_[_0xbe4f('0x3d')]({},_0x37f0d8,_0x3f894f[_0xbe4f('0x47')]);return db[_0xbe4f('0x40')]['find'](_0x37f0d8)['then'](handleEntityNotFound(_0x28d032,null))[_0xbe4f('0x24')](respondWithResult(_0x28d032,null))[_0xbe4f('0x43')](handleError(_0x28d032,null));};exports[_0xbe4f('0x48')]=function(_0x1882a5,_0x18ed89){return db[_0xbe4f('0x40')][_0xbe4f('0x48')](_0x1882a5[_0xbe4f('0x49')],{})['then'](function(_0x432444){var _0x417256=_0x1882a5[_0xbe4f('0x4a')][_0xbe4f('0x26')]({'plain':!![]});if(!_0x417256)throw new Error(_0xbe4f('0x4b'));if(_0x417256[_0xbe4f('0x4c')]===_0xbe4f('0x4a')){var _0x55383a=_0x432444['get']({'plain':!![]});var _0x1df1f8='OpenchannelQueues';return db[_0xbe4f('0x4d')]['find']({'where':{'name':_0x1df1f8,'userProfileId':_0x417256[_0xbe4f('0x4e')]},'raw':!![]})[_0xbe4f('0x24')](function(_0x30ac05){if(_0x30ac05&&_0x30ac05['autoAssociation']===0x0){return db[_0xbe4f('0x28')]['create']({'name':_0x55383a['name'],'resourceId':_0x55383a['id'],'type':_0x30ac05['name'],'sectionId':_0x30ac05['id']},{})['then'](function(){return _0x432444;});}else{return _0x432444;}})[_0xbe4f('0x43')](function(_0x21632f){logger[_0xbe4f('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x21632f);throw _0x21632f;});}return _0x432444;})[_0xbe4f('0x24')](respondWithResult(_0x18ed89,0xc9))[_0xbe4f('0x43')](handleError(_0x18ed89,null));};exports[_0xbe4f('0x50')]=function(_0x4a7207,_0x10d730){if(_0x4a7207[_0xbe4f('0x49')]['id']){delete _0x4a7207[_0xbe4f('0x49')]['id'];}return db[_0xbe4f('0x40')][_0xbe4f('0x51')]({'where':{'id':_0x4a7207[_0xbe4f('0x45')]['id']}})['then'](handleEntityNotFound(_0x10d730,null))[_0xbe4f('0x24')](saveUpdates(_0x4a7207[_0xbe4f('0x49')],null))[_0xbe4f('0x24')](respondWithResult(_0x10d730,null))[_0xbe4f('0x43')](handleError(_0x10d730,null));};exports[_0xbe4f('0x25')]=function(_0x16e8a0,_0x23e1bf){return db[_0xbe4f('0x40')][_0xbe4f('0x51')]({'where':{'id':_0x16e8a0[_0xbe4f('0x45')]['id']}})['then'](handleEntityNotFound(_0x23e1bf,null))[_0xbe4f('0x24')](removeEntity(_0x23e1bf,null))[_0xbe4f('0x43')](handleError(_0x23e1bf,null));};exports[_0xbe4f('0x52')]=function(_0x3400d3,_0x3ed979){return db['OpenchannelQueue'][_0xbe4f('0x52')]()[_0xbe4f('0x24')](respondWithResult(_0x3ed979,null))['catch'](handleError(_0x3ed979,null));};exports[_0xbe4f('0x53')]=function(_0x25e6e4,_0x8e7d1a,_0x391915){var _0x60a70f={'raw':!![],'where':{}},_0x166a0b={},_0x4992af;return db[_0xbe4f('0x40')][_0xbe4f('0x54')]({'where':{'id':_0x25e6e4[_0xbe4f('0x45')]['id']}})[_0xbe4f('0x24')](handleEntityNotFound(_0x8e7d1a,null))[_0xbe4f('0x24')](function(_0x1617c0){if(_0x1617c0){_0x4992af=_0x1617c0[_0xbe4f('0x26')]({'plain':!![]});_0x166a0b['model']=_['keys'](db[_0xbe4f('0x55')][_0xbe4f('0x2e')]);_0x166a0b[_0xbe4f('0x32')]=_[_0xbe4f('0x33')](_0x25e6e4[_0xbe4f('0x32')]);_0x166a0b[_0xbe4f('0x34')]=_[_0xbe4f('0x35')](_0x166a0b[_0xbe4f('0x31')],_0x166a0b[_0xbe4f('0x32')]);_0x60a70f['attributes']=_[_0xbe4f('0x35')](_0x166a0b[_0xbe4f('0x31')],qs[_0xbe4f('0x37')](_0x25e6e4[_0xbe4f('0x32')][_0xbe4f('0x37')]));_0x60a70f[_0xbe4f('0x36')]=_0x60a70f[_0xbe4f('0x36')]['length']?_0x60a70f[_0xbe4f('0x36')]:_0x166a0b[_0xbe4f('0x31')];if(!_0x25e6e4[_0xbe4f('0x32')][_0xbe4f('0x38')](_0xbe4f('0x56'))){_0x60a70f[_0xbe4f('0x1f')]=qs[_0xbe4f('0x1f')](_0x25e6e4['query']['limit']);_0x60a70f['offset']=qs['offset'](_0x25e6e4[_0xbe4f('0x32')][_0xbe4f('0x21')]);}_0x60a70f[_0xbe4f('0x39')]=qs[_0xbe4f('0x57')](_0x25e6e4[_0xbe4f('0x32')]['sort']);_0x60a70f[_0xbe4f('0x3a')]=qs[_0xbe4f('0x34')](_['pick'](_0x25e6e4[_0xbe4f('0x32')],_0x166a0b[_0xbe4f('0x34')]));_0x60a70f[_0xbe4f('0x3a')][_0xbe4f('0x58')]=_0x1617c0['id'];if(_0x25e6e4[_0xbe4f('0x32')][_0xbe4f('0x3c')]){_0x60a70f[_0xbe4f('0x3a')]=_[_0xbe4f('0x3d')](_0x60a70f[_0xbe4f('0x3a')],{'$or':_[_0xbe4f('0x2d')](_0x60a70f[_0xbe4f('0x36')],function(_0x4d0f98){var _0x47e451={};_0x47e451[_0x4d0f98]={'$like':'%'+_0x25e6e4[_0xbe4f('0x32')][_0xbe4f('0x3c')]+'%'};return _0x47e451;})});}_0x60a70f=_['merge']({},_0x60a70f,_0x25e6e4[_0xbe4f('0x47')]);return db['UserOpenchannelQueue']['findAll'](_0x60a70f);}})[_0xbe4f('0x24')](function(_0x5daccb){if(_0x5daccb){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0x5daccb,_0xbe4f('0x59')),'role':'agent'},'attributes':['id',_0xbe4f('0x2a'),_0xbe4f('0x5a'),_0xbe4f('0x5b'),_0xbe4f('0x5c')]});}})['then'](function(_0x41415b){if(_0x41415b){return{'count':_0x41415b[_0xbe4f('0x20')],'rows':_['map'](_0x41415b['rows'],function(_0x325fbd){return{'membername':_0x325fbd[_0xbe4f('0x2a')],'UserId':_0x325fbd['id'],'queue_name':_0x4992af['name'],'OpenchannelQueueId':_0x4992af['id'],'interface':util[_0xbe4f('0x5d')](_0xbe4f('0x5e'),_0xbe4f('0x5f'),_0x325fbd[_0xbe4f('0x2a')]),'penalty':0x0,'paused':_0x325fbd[_0xbe4f('0x5a')],'createdAt':_0x325fbd[_0xbe4f('0x5c')],'updatedAt':_0x325fbd[_0xbe4f('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xbe4f('0x24')](respondWithFilteredResult(_0x8e7d1a,_0x60a70f))[_0xbe4f('0x43')](handleError(_0x8e7d1a,null));};exports[_0xbe4f('0x60')]=function(_0x30461b,_0x1fa31b,_0x3ddcd7){var _0xb753b1={};var _0x135466={};var _0x640106;var _0x3cb836;return db[_0xbe4f('0x40')]['findOne']({'where':{'id':_0x30461b[_0xbe4f('0x45')]['id']}})[_0xbe4f('0x24')](handleEntityNotFound(_0x1fa31b,null))[_0xbe4f('0x24')](function(_0x500c30){if(_0x500c30){_0x640106=_0x500c30;_0x135466[_0xbe4f('0x31')]=_['keys'](db[_0xbe4f('0x61')][_0xbe4f('0x2e')]);_0x135466[_0xbe4f('0x32')]=_['keys'](_0x30461b[_0xbe4f('0x32')]);_0x135466[_0xbe4f('0x34')]=_['intersection'](_0x135466['model'],_0x135466[_0xbe4f('0x32')]);_0xb753b1['attributes']=_[_0xbe4f('0x35')](_0x135466['model'],qs[_0xbe4f('0x37')](_0x30461b['query'][_0xbe4f('0x37')]));_0xb753b1['attributes']=_0xb753b1[_0xbe4f('0x36')][_0xbe4f('0x46')]?_0xb753b1['attributes']:_0x135466[_0xbe4f('0x31')];_0xb753b1[_0xbe4f('0x39')]=qs[_0xbe4f('0x57')](_0x30461b[_0xbe4f('0x32')][_0xbe4f('0x57')]);_0xb753b1[_0xbe4f('0x3a')]=qs['filters'](_[_0xbe4f('0x3b')](_0x30461b['query'],_0x135466[_0xbe4f('0x34')]));if(_0x30461b[_0xbe4f('0x32')][_0xbe4f('0x3c')]){_0xb753b1['where']=_['merge'](_0xb753b1[_0xbe4f('0x3a')],{'$or':_[_0xbe4f('0x2d')](_0xb753b1['attributes'],function(_0x4b2e44){var _0x29ccca={};_0x29ccca[_0x4b2e44]={'$like':'%'+_0x30461b[_0xbe4f('0x32')]['filter']+'%'};return _0x29ccca;})});}_0xb753b1=_[_0xbe4f('0x3d')]({},_0xb753b1,_0x30461b[_0xbe4f('0x47')]);return _0x640106['getTeams'](_0xb753b1);}})['then'](function(_0x689eb5){if(_0x689eb5){_0x3cb836=_0x689eb5[_0xbe4f('0x46')];if(!_0x30461b[_0xbe4f('0x32')][_0xbe4f('0x38')]('nolimit')){_0xb753b1[_0xbe4f('0x1f')]=qs[_0xbe4f('0x1f')](_0x30461b['query'][_0xbe4f('0x1f')]);_0xb753b1[_0xbe4f('0x21')]=qs[_0xbe4f('0x21')](_0x30461b[_0xbe4f('0x32')]['offset']);}return _0x640106['getTeams'](_0xb753b1);}})[_0xbe4f('0x24')](function(_0x5e2da2){if(_0x5e2da2){return _0x5e2da2?{'count':_0x3cb836,'rows':_0x5e2da2}:null;}})[_0xbe4f('0x24')](respondWithResult(_0x1fa31b,null))['catch'](handleError(_0x1fa31b,null));};exports[_0xbe4f('0x62')]=function(_0x4200ef,_0x51e2a2,_0xf299e6){var _0x186d76=_0x4200ef['body']['ids'];return db[_0xbe4f('0x61')][_0xbe4f('0x41')]({'where':{'id':_0x186d76},'attributes':['id'],'include':[{'model':db[_0xbe4f('0x63')],'as':_0xbe4f('0x64'),'attributes':['id',_0xbe4f('0x2a'),_0xbe4f('0x65'),_0xbe4f('0x66'),_0xbe4f('0x67')],'raw':!![]}]})[_0xbe4f('0x24')](function(_0x3d31ec){if(_0x3d31ec){var _0x26b5e1=_[_0xbe4f('0x68')](_0x3d31ec,function(_0x4c9b8e){var _0x2e473e=_0x4c9b8e[_0xbe4f('0x26')]({'plain':!![]});return _0x2e473e[_0xbe4f('0x64')];});return db[_0xbe4f('0x40')]['find']({'where':{'id':_0x4200ef['params']['id']}})[_0xbe4f('0x24')](function(_0x57c5c5){return db[_0xbe4f('0x69')]['transaction'](function(_0x3260db){return _0x57c5c5[_0xbe4f('0x62')](_0x186d76,{'transaction':_0x3260db})[_0xbe4f('0x24')](function(){return BPromise[_0xbe4f('0x6a')](_0x26b5e1,function(_0x3b0154){return db[_0xbe4f('0x55')][_0xbe4f('0x6b')]({'where':{'UserId':_0x3b0154['id'],'OpenchannelQueueId':_0x4200ef[_0xbe4f('0x45')]['id']},'transaction':_0x3260db});});})[_0xbe4f('0x24')](function(){_0x26b5e1[_0xbe4f('0x6c')](function(_0x30a6ff){socket[_0xbe4f('0x6d')](_0xbe4f('0x6e'),{'UserId':_0x30a6ff['id'],'OpenchannelQueueId':_0x57c5c5['id']});});});});});}})[_0xbe4f('0x24')](respondWithStatusCode(_0x51e2a2,null))['catch'](handleError(_0x51e2a2,null));};exports[_0xbe4f('0x6f')]=function(_0x1e4b2f,_0x20757f,_0x4765a9){return db[_0xbe4f('0x61')][_0xbe4f('0x41')]({'where':{'id':_0x1e4b2f['query'][_0xbe4f('0x70')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xbe4f('0x64'),'attributes':['id'],'raw':!![]}]})[_0xbe4f('0x24')](handleEntityNotFound(_0x20757f,null))[_0xbe4f('0x24')](function(_0x8be311){var _0x1c4f12=_[_0xbe4f('0x2d')](_0x8be311,'id');var _0x13cec0=[];var _0x474986=[];var _0x246337=squel[_0xbe4f('0x71')]();_0x246337[_0xbe4f('0x72')]('tq.TeamId')['from'](_0xbe4f('0x73'),'tq')[_0xbe4f('0x74')]('user_has_teams','ut',_0xbe4f('0x75'))[_0xbe4f('0x3a')](_0xbe4f('0x76'),_0x1e4b2f[_0xbe4f('0x45')]['id']);for(var _0x2fac75=0x0;_0x2fac75<_0x8be311[_0xbe4f('0x46')];_0x2fac75+=0x1){let _0x253aeb=_0x8be311[_0x2fac75];for(var _0x2e7c30=0x0;_0x2e7c30<_0x253aeb['Agents']['length'];_0x2e7c30+=0x1){let _0x54c7d5=_0x253aeb[_0xbe4f('0x64')][_0x2e7c30];var _0xfa5fab=_0x246337[_0xbe4f('0x77')]();_0xfa5fab[_0xbe4f('0x3a')](_0xbe4f('0x78'),_0x54c7d5['id']);_0x474986[_0xbe4f('0x79')](db['sequelize'][_0xbe4f('0x32')](_0xfa5fab[_0xbe4f('0x7a')](),{'type':db[_0xbe4f('0x69')][_0xbe4f('0x7b')][_0xbe4f('0x7c')]})[_0xbe4f('0x24')](function(_0x150f7e){if(_0x150f7e[_0xbe4f('0x46')]===0x1){return _0x54c7d5['id'];}else{var _0x130270=_['every'](_['map'](_0x150f7e,_0xbe4f('0x7d')),function(_0xae5704){return _[_0xbe4f('0x7e')](_0x1c4f12,_0xae5704);});if(_0x130270){return _0x54c7d5['id'];}}}));}}return BPromise[_0xbe4f('0x7f')](_0x474986)[_0xbe4f('0x24')](function(_0x51b7f1){_0x13cec0=_(_0x13cec0)[_0xbe4f('0x80')](_0x51b7f1)[_0xbe4f('0x81')]()[_0xbe4f('0x82')]();return db[_0xbe4f('0x40')]['find']({'where':{'id':_0x1e4b2f[_0xbe4f('0x45')]['id']}})['then'](function(_0x456043){return db[_0xbe4f('0x69')][_0xbe4f('0x83')](function(_0x1d6816){return _0x456043[_0xbe4f('0x6f')](_0x1e4b2f[_0xbe4f('0x32')][_0xbe4f('0x70')],{'transaction':_0x1d6816})['then'](function(){if(!_[_0xbe4f('0x84')](_0x13cec0)){return _0x456043[_0xbe4f('0x85')](_0x13cec0,{'transaction':_0x1d6816});}})['then'](function(){_0x13cec0[_0xbe4f('0x6c')](function(_0xd807a3){socket[_0xbe4f('0x6d')]('userOpenchannelQueue:remove',{'UserId':_0xd807a3,'OpenchannelQueueId':_0x456043['id']});});});});});});})[_0xbe4f('0x24')](respondWithStatusCode(_0x20757f,null))[_0xbe4f('0x43')](handleError(_0x20757f,null));};exports[_0xbe4f('0x86')]=function(_0x64192,_0x1ad20a,_0x193437){return db[_0xbe4f('0x40')][_0xbe4f('0x51')]({'where':{'id':_0x64192[_0xbe4f('0x45')]['id']}})[_0xbe4f('0x24')](handleEntityNotFound(_0x1ad20a,null))[_0xbe4f('0x24')](function(_0x262117){if(_0x262117){return _0x262117[_0xbe4f('0x86')](_0x64192[_0xbe4f('0x49')][_0xbe4f('0x70')],_[_0xbe4f('0x87')](_0x64192[_0xbe4f('0x49')],[_0xbe4f('0x70'),'id'])||{})['spread'](function(_0x534443){for(var _0x1822a3=0x0;_0x1822a3<_0x64192['body'][_0xbe4f('0x70')]['length'];_0x1822a3+=0x1){socket[_0xbe4f('0x6d')](_0xbe4f('0x6e'),{'UserId':Number(_0x64192['body'][_0xbe4f('0x70')][_0x1822a3]),'OpenchannelQueueId':Number(_0x64192[_0xbe4f('0x45')]['id'])});}return _0x534443;});}})[_0xbe4f('0x24')](respondWithResult(_0x1ad20a,null))[_0xbe4f('0x43')](handleError(_0x1ad20a,null));};exports['removeAgents']=function(_0x5c654d,_0xdeb0ca,_0x553331){return db[_0xbe4f('0x40')]['find']({'where':{'id':_0x5c654d[_0xbe4f('0x45')]['id']}})['then'](handleEntityNotFound(_0xdeb0ca,null))[_0xbe4f('0x24')](function(_0x1c1ecb){if(_0x1c1ecb){return _0x1c1ecb[_0xbe4f('0x85')](_0x5c654d[_0xbe4f('0x32')]['ids'])[_0xbe4f('0x24')](function(){if(_[_0xbe4f('0x88')](_0x5c654d['query'][_0xbe4f('0x70')])){for(var _0xf142cb=0x0;_0xf142cb<_0x5c654d[_0xbe4f('0x32')][_0xbe4f('0x70')][_0xbe4f('0x46')];_0xf142cb+=0x1){socket['emit'](_0xbe4f('0x89'),{'UserId':Number(_0x5c654d[_0xbe4f('0x32')][_0xbe4f('0x70')][_0xf142cb]),'OpenchannelQueueId':Number(_0x5c654d[_0xbe4f('0x45')]['id'])});}}else{socket[_0xbe4f('0x6d')]('userOpenchannelQueue:remove',{'UserId':Number(_0x5c654d[_0xbe4f('0x32')][_0xbe4f('0x70')]),'OpenchannelQueueId':Number(_0x5c654d['params']['id'])});}});}})['then'](respondWithStatusCode(_0xdeb0ca,null))['catch'](handleError(_0xdeb0ca,null));};exports[_0xbe4f('0x8a')]=function(_0xd453b0,_0x104df0,_0x2d0bc4){var _0x20a01a={};var _0xdabc24={};var _0x1dfc78;var _0x1aa47c;return db[_0xbe4f('0x40')][_0xbe4f('0x54')]({'where':{'id':_0xd453b0[_0xbe4f('0x45')]['id']}})['then'](handleEntityNotFound(_0x104df0,null))[_0xbe4f('0x24')](function(_0x36630c){if(_0x36630c){_0x1dfc78=_0x36630c;_0xdabc24[_0xbe4f('0x31')]=_['keys'](db[_0xbe4f('0x63')][_0xbe4f('0x2e')]);_0xdabc24[_0xbe4f('0x32')]=_['keys'](_0xd453b0[_0xbe4f('0x32')]);_0xdabc24[_0xbe4f('0x34')]=_[_0xbe4f('0x35')](_0xdabc24[_0xbe4f('0x31')],_0xdabc24[_0xbe4f('0x32')]);_0x20a01a[_0xbe4f('0x36')]=_[_0xbe4f('0x35')](_0xdabc24['model'],qs['fields'](_0xd453b0[_0xbe4f('0x32')]['fields']));_0x20a01a[_0xbe4f('0x36')]=_0x20a01a[_0xbe4f('0x36')][_0xbe4f('0x46')]?_0x20a01a[_0xbe4f('0x36')]:_0xdabc24['model'];_0x20a01a['order']=qs[_0xbe4f('0x57')](_0xd453b0[_0xbe4f('0x32')][_0xbe4f('0x57')]);_0x20a01a[_0xbe4f('0x3a')]=qs['filters'](_[_0xbe4f('0x3b')](_0xd453b0['query'],_0xdabc24[_0xbe4f('0x34')]));if(_0xd453b0[_0xbe4f('0x32')][_0xbe4f('0x3c')]){_0x20a01a[_0xbe4f('0x3a')]=_['merge'](_0x20a01a[_0xbe4f('0x3a')],{'$or':_[_0xbe4f('0x2d')](_0x20a01a[_0xbe4f('0x36')],function(_0x89bce4){var _0x1d2513={};_0x1d2513[_0x89bce4]={'$like':'%'+_0xd453b0[_0xbe4f('0x32')][_0xbe4f('0x3c')]+'%'};return _0x1d2513;})});}_0x20a01a=_['merge']({},_0x20a01a,_0xd453b0[_0xbe4f('0x47')]);return _0x1dfc78[_0xbe4f('0x8a')](_0x20a01a);}})[_0xbe4f('0x24')](function(_0x2d845d){if(_0x2d845d){_0x1aa47c=_0x2d845d[_0xbe4f('0x46')];if(!_0xd453b0[_0xbe4f('0x32')][_0xbe4f('0x38')]('nolimit')){_0x20a01a[_0xbe4f('0x1f')]=qs[_0xbe4f('0x1f')](_0xd453b0[_0xbe4f('0x32')][_0xbe4f('0x1f')]);_0x20a01a[_0xbe4f('0x21')]=qs[_0xbe4f('0x21')](_0xd453b0[_0xbe4f('0x32')]['offset']);}return _0x1dfc78[_0xbe4f('0x8a')](_0x20a01a);}})['then'](function(_0x284fff){if(_0x284fff){return _0x284fff?{'count':_0x1aa47c,'rows':_0x284fff}:null;}})[_0xbe4f('0x24')](respondWithResult(_0x104df0,null))['catch'](handleError(_0x104df0,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index f70b0e3..1ddf4c6 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 _0x725c=['save','update','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x725c,0x12b));var _0xc725=function(_0xa35408,_0x315f2a){_0xa35408=_0xa35408-0x0;var _0xc71d1b=_0x725c[_0xa35408];return _0xc71d1b;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0xc725('0x0'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xc725('0x1')](0x0);var events={'afterCreate':_0xc725('0x2'),'afterUpdate':_0xc725('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1f1325){return function(_0x4123fd,_0x4ea7c1,_0x2d1c6f){OpenchannelQueueEvents['emit'](_0x1f1325+':'+_0x4123fd['id'],_0x4123fd);OpenchannelQueueEvents['emit'](_0x1f1325,_0x4123fd);_0x2d1c6f(null);};}for(var e in events){if(events[_0xc725('0x4')](e)){var event=events[e];OpenchannelQueue[_0xc725('0x5')](e,emitEvent(event));}}module[_0xc725('0x6')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x832c=['emit','hook','events','../../mysqldb','OpenchannelQueue','update','remove'];(function(_0x33d239,_0x24bb87){var _0x6784c2=function(_0x2d8fb6){while(--_0x2d8fb6){_0x33d239['push'](_0x33d239['shift']());}};_0x6784c2(++_0x24bb87);}(_0x832c,0x16e));var _0xc832=function(_0x5845cd,_0x5b535a){_0x5845cd=_0x5845cd-0x0;var _0x4010cd=_0x832c[_0x5845cd];return _0x4010cd;};'use strict';var EventEmitter=require(_0xc832('0x0'));var OpenchannelQueue=require(_0xc832('0x1'))['db'][_0xc832('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc832('0x3'),'afterDestroy':_0xc832('0x4')};function emitEvent(_0x32e44e){return function(_0x38fe3c,_0x12dd40,_0xd1d303){OpenchannelQueueEvents['emit'](_0x32e44e+':'+_0x38fe3c['id'],_0x38fe3c);OpenchannelQueueEvents[_0xc832('0x5')](_0x32e44e,_0x38fe3c);_0xd1d303(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xc832('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 2151212..22e3488 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 _0xdd8d=['openchannel_queues','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueue.attributes','exports','OpenchannelQueue'];(function(_0x448970,_0x44b9b4){var _0x2fa420=function(_0x10a754){while(--_0x10a754){_0x448970['push'](_0x448970['shift']());}};_0x2fa420(++_0x44b9b4);}(_0xdd8d,0x85));var _0xddd8=function(_0x54fe1c,_0x5d208c){_0x54fe1c=_0x54fe1c-0x0;var _0x460aaa=_0xdd8d[_0x54fe1c];return _0x460aaa;};'use strict';var _=require(_0xddd8('0x0'));var util=require(_0xddd8('0x1'));var logger=require('../../config/logger')(_0xddd8('0x2'));var moment=require(_0xddd8('0x3'));var BPromise=require(_0xddd8('0x4'));var rp=require(_0xddd8('0x5'));var fs=require('fs');var path=require(_0xddd8('0x6'));var rimraf=require('rimraf');var config=require(_0xddd8('0x7'));var attributes=require(_0xddd8('0x8'));module[_0xddd8('0x9')]=function(_0x295194,_0x3fe554){return _0x295194['define'](_0xddd8('0xa'),attributes,{'tableName':_0xddd8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbed9=['bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','../../config/logger','api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbed9,0x1d2));var _0x9bed=function(_0x30ccf9,_0x3528ce){_0x30ccf9=_0x30ccf9-0x0;var _0x48b1af=_0xbed9[_0x30ccf9];return _0x48b1af;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9bed('0x0'))(_0x9bed('0x1'));var moment=require('moment');var BPromise=require(_0x9bed('0x2'));var rp=require(_0x9bed('0x3'));var fs=require('fs');var path=require(_0x9bed('0x4'));var rimraf=require(_0x9bed('0x5'));var config=require(_0x9bed('0x6'));var attributes=require(_0x9bed('0x7'));module[_0x9bed('0x8')]=function(_0x597789,_0x303f95){return _0x597789[_0x9bed('0x9')](_0x9bed('0xa'),attributes,{'tableName':_0x9bed('0xb'),'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 3e617f3..6df986e 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 _0xa503=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetOpenchannelQueue','options','where','attributes','include','map','model','catch','ShowOpenchannelQueue','OpenchannelQueue','find','raw','lodash','moment'];(function(_0x5b16a4,_0x2ca88c){var _0x1cdb2a=function(_0x1b6927){while(--_0x1b6927){_0x5b16a4['push'](_0x5b16a4['shift']());}};_0x1cdb2a(++_0x2ca88c);}(_0xa503,0x1ea));var _0x3a50=function(_0x229d52,_0x385de9){_0x229d52=_0x229d52-0x0;var _0xef6539=_0xa503[_0x229d52];return _0xef6539;};'use strict';var _=require(_0x3a50('0x0'));var util=require('util');var moment=require(_0x3a50('0x1'));var BPromise=require(_0x3a50('0x2'));var rs=require(_0x3a50('0x3'));var fs=require('fs');var Redis=require(_0x3a50('0x4'));var db=require(_0x3a50('0x5'))['db'];var utils=require(_0x3a50('0x6'));var logger=require(_0x3a50('0x7'))('rpc');var config=require(_0x3a50('0x8'));var jayson=require(_0x3a50('0x9'));var client=jayson[_0x3a50('0xa')][_0x3a50('0xb')]({'port':0x232a});config[_0x3a50('0xc')]=_[_0x3a50('0xd')](config[_0x3a50('0xc')],{'host':_0x3a50('0xe'),'port':0x18eb});var socket=require(_0x3a50('0xf'))(new Redis(config[_0x3a50('0xc')]));require(_0x3a50('0x10'))[_0x3a50('0x11')](socket);function respondWithRpcPromise(_0x37b360,_0x4ea0f5,_0x535f73){return new BPromise(function(_0x1f4cd5,_0x2d7df5){return client[_0x3a50('0x12')](_0x37b360,_0x535f73)[_0x3a50('0x13')](function(_0x12d336){logger[_0x3a50('0x14')](_0x3a50('0x15'),_0x4ea0f5,_0x3a50('0x16'));logger[_0x3a50('0x17')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x4ea0f5,_0x3a50('0x16'),JSON[_0x3a50('0x18')](_0x12d336));if(_0x12d336[_0x3a50('0x19')]){if(_0x12d336['error'][_0x3a50('0x1a')]===0x1f4){logger[_0x3a50('0x19')](_0x3a50('0x15'),_0x4ea0f5,_0x12d336['error'][_0x3a50('0x1b')]);return _0x2d7df5(_0x12d336[_0x3a50('0x19')][_0x3a50('0x1b')]);}logger[_0x3a50('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x4ea0f5,_0x12d336[_0x3a50('0x19')]['message']);return _0x1f4cd5(_0x12d336[_0x3a50('0x19')][_0x3a50('0x1b')]);}else{logger[_0x3a50('0x14')](_0x3a50('0x15'),_0x4ea0f5,_0x3a50('0x16'));_0x1f4cd5(_0x12d336[_0x3a50('0x1c')][_0x3a50('0x1b')]);}})['catch'](function(_0x5ebf5f){logger[_0x3a50('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x4ea0f5,_0x5ebf5f);_0x2d7df5(_0x5ebf5f);});});}exports[_0x3a50('0x1d')]=function(_0x3779ef){var _0x5385f7=this;return new Promise(function(_0x5a3e7f,_0x36a971){return db['OpenchannelQueue']['findAll']({'raw':_0x3779ef['options']?_0x3779ef[_0x3a50('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3779ef[_0x3a50('0x1e')]?_0x3779ef[_0x3a50('0x1e')][_0x3a50('0x1f')]||null:null,'attributes':_0x3779ef['options']?_0x3779ef[_0x3a50('0x1e')][_0x3a50('0x20')]||null:null,'limit':_0x3779ef[_0x3a50('0x1e')]?_0x3779ef[_0x3a50('0x1e')]['limit']||null:null,'include':_0x3779ef[_0x3a50('0x1e')]?_0x3779ef[_0x3a50('0x1e')][_0x3a50('0x21')]?_[_0x3a50('0x22')](_0x3779ef[_0x3a50('0x1e')]['include'],function(_0x1bc180){return{'model':db[_0x1bc180[_0x3a50('0x23')]],'as':_0x1bc180['as'],'attributes':_0x1bc180['attributes'],'include':_0x1bc180[_0x3a50('0x21')]?_[_0x3a50('0x22')](_0x1bc180[_0x3a50('0x21')],function(_0x4c0597){return{'model':db[_0x4c0597['model']],'as':_0x4c0597['as'],'attributes':_0x4c0597['attributes'],'include':_0x4c0597['include']?_[_0x3a50('0x22')](_0x4c0597['include'],function(_0x3cebd3){return{'model':db[_0x3cebd3[_0x3a50('0x23')]],'as':_0x3cebd3['as'],'attributes':_0x3cebd3[_0x3a50('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3a50('0x13')](function(_0x52555f){logger['info']('GetOpenchannelQueue',_0x3779ef);logger[_0x3a50('0x17')]('GetOpenchannelQueue',_0x3779ef,JSON[_0x3a50('0x18')](_0x52555f));_0x5a3e7f(_0x52555f);})[_0x3a50('0x24')](function(_0x1e1bf2){logger['error']('GetOpenchannelQueue',_0x1e1bf2[_0x3a50('0x1b')],_0x3779ef);_0x36a971(_0x5385f7[_0x3a50('0x19')](0x1f4,_0x1e1bf2[_0x3a50('0x1b')]));});});};exports[_0x3a50('0x25')]=function(_0x5815b6){var _0x28ca9e=this;return new Promise(function(_0x1baced,_0x3aa8dd){return db[_0x3a50('0x26')][_0x3a50('0x27')]({'raw':_0x5815b6[_0x3a50('0x1e')]?_0x5815b6[_0x3a50('0x1e')][_0x3a50('0x28')]===undefined?!![]:![]:!![],'where':_0x5815b6[_0x3a50('0x1e')]?_0x5815b6[_0x3a50('0x1e')][_0x3a50('0x1f')]||null:null,'attributes':_0x5815b6[_0x3a50('0x1e')]?_0x5815b6[_0x3a50('0x1e')][_0x3a50('0x20')]||null:null,'include':_0x5815b6[_0x3a50('0x1e')]?_0x5815b6[_0x3a50('0x1e')][_0x3a50('0x21')]?_['map'](_0x5815b6['options'][_0x3a50('0x21')],function(_0x5b23b1){return{'model':db[_0x5b23b1['model']],'as':_0x5b23b1['as'],'attributes':_0x5b23b1[_0x3a50('0x20')],'include':_0x5b23b1[_0x3a50('0x21')]?_[_0x3a50('0x22')](_0x5b23b1['include'],function(_0x479cb2){return{'model':db[_0x479cb2['model']],'as':_0x479cb2['as'],'attributes':_0x479cb2['attributes'],'include':_0x479cb2[_0x3a50('0x21')]?_[_0x3a50('0x22')](_0x479cb2['include'],function(_0x3ab110){return{'model':db[_0x3ab110[_0x3a50('0x23')]],'as':_0x3ab110['as'],'attributes':_0x3ab110[_0x3a50('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3a50('0x13')](function(_0x25957b){logger[_0x3a50('0x14')](_0x3a50('0x25'),_0x5815b6);logger['debug']('ShowOpenchannelQueue',_0x5815b6,JSON[_0x3a50('0x18')](_0x25957b));_0x1baced(_0x25957b);})[_0x3a50('0x24')](function(_0x605c9f){logger[_0x3a50('0x19')](_0x3a50('0x25'),_0x605c9f[_0x3a50('0x1b')],_0x5815b6);_0x3aa8dd(_0x28ca9e['error'](0x1f4,_0x605c9f[_0x3a50('0x1b')]));});});}; \ No newline at end of file +var _0xe6f7=['./openchannelQueue.socket','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','OpenchannelQueue','findAll','options','raw','limit','map','model','attributes','include','then','GetOpenchannelQueue','ShowOpenchannelQueue','find','where','stringify','lodash','moment','bluebird','randomstring','../../config/utils','jayson/promise','client','http','defaults','redis'];(function(_0x1b92a6,_0x14444b){var _0x24be5b=function(_0x3a5fb5){while(--_0x3a5fb5){_0x1b92a6['push'](_0x1b92a6['shift']());}};_0x24be5b(++_0x14444b);}(_0xe6f7,0x1f4));var _0x7e6f=function(_0x28578d,_0xcf5cf0){_0x28578d=_0x28578d-0x0;var _0x524826=_0xe6f7[_0x28578d];return _0x524826;};'use strict';var _=require(_0x7e6f('0x0'));var util=require('util');var moment=require(_0x7e6f('0x1'));var BPromise=require(_0x7e6f('0x2'));var rs=require(_0x7e6f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7e6f('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x7e6f('0x5'));var client=jayson[_0x7e6f('0x6')][_0x7e6f('0x7')]({'port':0x232a});config['redis']=_[_0x7e6f('0x8')](config[_0x7e6f('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7e6f('0x9')]));require(_0x7e6f('0xa'))['register'](socket);function respondWithRpcPromise(_0x2c5a0d,_0xbdbe83,_0x2e7efc){return new BPromise(function(_0x3b8809,_0x2fd42c){return client['request'](_0x2c5a0d,_0x2e7efc)['then'](function(_0x499126){logger['info'](_0x7e6f('0xb'),_0xbdbe83,_0x7e6f('0xc'));logger[_0x7e6f('0xd')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0xbdbe83,_0x7e6f('0xc'),JSON['stringify'](_0x499126));if(_0x499126[_0x7e6f('0xe')]){if(_0x499126[_0x7e6f('0xe')]['code']===0x1f4){logger[_0x7e6f('0xe')](_0x7e6f('0xb'),_0xbdbe83,_0x499126['error'][_0x7e6f('0xf')]);return _0x2fd42c(_0x499126[_0x7e6f('0xe')][_0x7e6f('0xf')]);}logger[_0x7e6f('0xe')](_0x7e6f('0xb'),_0xbdbe83,_0x499126['error'][_0x7e6f('0xf')]);return _0x3b8809(_0x499126[_0x7e6f('0xe')][_0x7e6f('0xf')]);}else{logger[_0x7e6f('0x10')](_0x7e6f('0xb'),_0xbdbe83,_0x7e6f('0xc'));_0x3b8809(_0x499126[_0x7e6f('0x11')][_0x7e6f('0xf')]);}})[_0x7e6f('0x12')](function(_0x31619b){logger[_0x7e6f('0xe')]('OpenchannelQueue,\x20%s,\x20%s',_0xbdbe83,_0x31619b);_0x2fd42c(_0x31619b);});});}exports['GetOpenchannelQueue']=function(_0x1c8c48){var _0x1308fc=this;return new Promise(function(_0x1529be,_0x326ae0){return db[_0x7e6f('0x13')][_0x7e6f('0x14')]({'raw':_0x1c8c48[_0x7e6f('0x15')]?_0x1c8c48['options'][_0x7e6f('0x16')]===undefined?!![]:![]:!![],'where':_0x1c8c48[_0x7e6f('0x15')]?_0x1c8c48[_0x7e6f('0x15')]['where']||null:null,'attributes':_0x1c8c48[_0x7e6f('0x15')]?_0x1c8c48[_0x7e6f('0x15')]['attributes']||null:null,'limit':_0x1c8c48[_0x7e6f('0x15')]?_0x1c8c48[_0x7e6f('0x15')][_0x7e6f('0x17')]||null:null,'include':_0x1c8c48['options']?_0x1c8c48[_0x7e6f('0x15')]['include']?_[_0x7e6f('0x18')](_0x1c8c48[_0x7e6f('0x15')]['include'],function(_0x4e1158){return{'model':db[_0x4e1158[_0x7e6f('0x19')]],'as':_0x4e1158['as'],'attributes':_0x4e1158['attributes'],'include':_0x4e1158['include']?_[_0x7e6f('0x18')](_0x4e1158['include'],function(_0x1a42e8){return{'model':db[_0x1a42e8[_0x7e6f('0x19')]],'as':_0x1a42e8['as'],'attributes':_0x1a42e8[_0x7e6f('0x1a')],'include':_0x1a42e8[_0x7e6f('0x1b')]?_[_0x7e6f('0x18')](_0x1a42e8[_0x7e6f('0x1b')],function(_0x7ff379){return{'model':db[_0x7ff379[_0x7e6f('0x19')]],'as':_0x7ff379['as'],'attributes':_0x7ff379[_0x7e6f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7e6f('0x1c')](function(_0x513cb3){logger[_0x7e6f('0x10')](_0x7e6f('0x1d'),_0x1c8c48);logger[_0x7e6f('0xd')](_0x7e6f('0x1d'),_0x1c8c48,JSON['stringify'](_0x513cb3));_0x1529be(_0x513cb3);})[_0x7e6f('0x12')](function(_0x56a740){logger[_0x7e6f('0xe')](_0x7e6f('0x1d'),_0x56a740[_0x7e6f('0xf')],_0x1c8c48);_0x326ae0(_0x1308fc[_0x7e6f('0xe')](0x1f4,_0x56a740[_0x7e6f('0xf')]));});});};exports[_0x7e6f('0x1e')]=function(_0x1bc806){var _0xf6306e=this;return new Promise(function(_0x460717,_0x4cb5ba){return db[_0x7e6f('0x13')][_0x7e6f('0x1f')]({'raw':_0x1bc806[_0x7e6f('0x15')]?_0x1bc806[_0x7e6f('0x15')][_0x7e6f('0x16')]===undefined?!![]:![]:!![],'where':_0x1bc806[_0x7e6f('0x15')]?_0x1bc806['options'][_0x7e6f('0x20')]||null:null,'attributes':_0x1bc806['options']?_0x1bc806[_0x7e6f('0x15')][_0x7e6f('0x1a')]||null:null,'include':_0x1bc806[_0x7e6f('0x15')]?_0x1bc806[_0x7e6f('0x15')][_0x7e6f('0x1b')]?_['map'](_0x1bc806[_0x7e6f('0x15')][_0x7e6f('0x1b')],function(_0x1eb38a){return{'model':db[_0x1eb38a[_0x7e6f('0x19')]],'as':_0x1eb38a['as'],'attributes':_0x1eb38a['attributes'],'include':_0x1eb38a['include']?_[_0x7e6f('0x18')](_0x1eb38a[_0x7e6f('0x1b')],function(_0x69813){return{'model':db[_0x69813['model']],'as':_0x69813['as'],'attributes':_0x69813['attributes'],'include':_0x69813['include']?_['map'](_0x69813['include'],function(_0x1a39f7){return{'model':db[_0x1a39f7[_0x7e6f('0x19')]],'as':_0x1a39f7['as'],'attributes':_0x1a39f7['attributes']};}):[]};}):[]};}):[]:[]})[_0x7e6f('0x1c')](function(_0x18790e){logger[_0x7e6f('0x10')](_0x7e6f('0x1e'),_0x1bc806);logger[_0x7e6f('0xd')](_0x7e6f('0x1e'),_0x1bc806,JSON[_0x7e6f('0x21')](_0x18790e));_0x460717(_0x18790e);})[_0x7e6f('0x12')](function(_0x4ff826){logger['error'](_0x7e6f('0x1e'),_0x4ff826[_0x7e6f('0xf')],_0x1bc806);_0x4cb5ba(_0xf6306e['error'](0x1f4,_0x4ff826[_0x7e6f('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 3ffec90..de8df59 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 _0x0c1a=['update','emit','removeListener','openchannelQueue:','./openchannelQueue.events','save','remove'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x0c1a,0x169));var _0xa0c1=function(_0xedfe21,_0x3d887b){_0xedfe21=_0xedfe21-0x0;var _0x2f7085=_0x0c1a[_0xedfe21];return _0x2f7085;};'use strict';var OpenchannelQueueEvents=require(_0xa0c1('0x0'));var events=[_0xa0c1('0x1'),_0xa0c1('0x2'),_0xa0c1('0x3')];function createListener(_0x3e266a,_0x3b3cf9){return function(_0x1511a7){_0x3b3cf9[_0xa0c1('0x4')](_0x3e266a,_0x1511a7);};}function removeListener(_0x3037d5,_0x4118f0){return function(){OpenchannelQueueEvents[_0xa0c1('0x5')](_0x3037d5,_0x4118f0);};}exports['register']=function(_0x3be00e){for(var _0x3f194b=0x0,_0x305873=events['length'];_0x3f194b<_0x305873;_0x3f194b++){var _0x3295a0=events[_0x3f194b];var _0x303ee1=createListener(_0xa0c1('0x6')+_0x3295a0,_0x3be00e);OpenchannelQueueEvents['on'](_0x3295a0,_0x303ee1);}}; \ No newline at end of file +var _0x3d38=['openchannelQueue:','./openchannelQueue.events','update','removeListener','register','length'];(function(_0x260114,_0x25294d){var _0x19da40=function(_0x163c54){while(--_0x163c54){_0x260114['push'](_0x260114['shift']());}};_0x19da40(++_0x25294d);}(_0x3d38,0xc1));var _0x83d3=function(_0x22b5da,_0x43cf53){_0x22b5da=_0x22b5da-0x0;var _0x46b7da=_0x3d38[_0x22b5da];return _0x46b7da;};'use strict';var OpenchannelQueueEvents=require(_0x83d3('0x0'));var events=['save','remove',_0x83d3('0x1')];function createListener(_0x521954,_0x58090c){return function(_0x48f442){_0x58090c['emit'](_0x521954,_0x48f442);};}function removeListener(_0x344d0b,_0x5bb9b0){return function(){OpenchannelQueueEvents[_0x83d3('0x2')](_0x344d0b,_0x5bb9b0);};}exports[_0x83d3('0x3')]=function(_0x41384f){for(var _0x104e0c=0x0,_0x44d6d6=events[_0x83d3('0x4')];_0x104e0c<_0x44d6d6;_0x104e0c++){var _0x330e80=events[_0x104e0c];var _0x3e2282=createListener(_0x83d3('0x5')+_0x330e80,_0x41384f);OpenchannelQueueEvents['on'](_0x330e80,_0x3e2282);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 11a2b8a..e973f22 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 _0xf2ea=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','index','describe','show','post','create','/:id','exports','path','connect-timeout','express'];(function(_0x2212f2,_0x48f999){var _0x36a343=function(_0x26f6cb){while(--_0x26f6cb){_0x2212f2['push'](_0x2212f2['shift']());}};_0x36a343(++_0x48f999);}(_0xf2ea,0xeb));var _0xaf2e=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xf2ea[_0x42cae2];return _0x5f256f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xaf2e('0x0'));var timeout=require(_0xaf2e('0x1'));var express=require(_0xaf2e('0x2'));var router=express[_0xaf2e('0x3')]();var fs_extra=require(_0xaf2e('0x4'));var auth=require(_0xaf2e('0x5'));var interaction=require(_0xaf2e('0x6'));var config=require('../../config/environment');var controller=require(_0xaf2e('0x7'));router[_0xaf2e('0x8')]('/',auth[_0xaf2e('0x9')](),controller[_0xaf2e('0xa')]);router['get']('/describe',auth[_0xaf2e('0x9')](),controller[_0xaf2e('0xb')]);router[_0xaf2e('0x8')]('/:id',auth[_0xaf2e('0x9')](),controller[_0xaf2e('0xc')]);router[_0xaf2e('0xd')]('/',auth['isAuthenticated'](),controller[_0xaf2e('0xe')]);router['put'](_0xaf2e('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xaf2e('0xf'),auth[_0xaf2e('0x9')](),controller['destroy']);module[_0xaf2e('0x10')]=router; \ No newline at end of file +var _0x93de=['update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','put'];(function(_0x3b1b23,_0x21bccd){var _0x1efc85=function(_0x102a95){while(--_0x102a95){_0x3b1b23['push'](_0x3b1b23['shift']());}};_0x1efc85(++_0x21bccd);}(_0x93de,0x1bb));var _0xe93d=function(_0x5af273,_0x5e1b13){_0x5af273=_0x5af273-0x0;var _0x1b8bf8=_0x93de[_0x5af273];return _0x1b8bf8;};'use strict';var multer=require(_0xe93d('0x0'));var util=require(_0xe93d('0x1'));var path=require(_0xe93d('0x2'));var timeout=require('connect-timeout');var express=require(_0xe93d('0x3'));var router=express[_0xe93d('0x4')]();var fs_extra=require(_0xe93d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe93d('0x6'));var config=require(_0xe93d('0x7'));var controller=require(_0xe93d('0x8'));router['get']('/',auth[_0xe93d('0x9')](),controller['index']);router[_0xe93d('0xa')](_0xe93d('0xb'),auth[_0xe93d('0x9')](),controller[_0xe93d('0xc')]);router[_0xe93d('0xa')](_0xe93d('0xd'),auth[_0xe93d('0x9')](),controller[_0xe93d('0xe')]);router[_0xe93d('0xf')]('/',auth[_0xe93d('0x9')](),controller['create']);router[_0xe93d('0x10')](_0xe93d('0xd'),auth[_0xe93d('0x9')](),controller[_0xe93d('0x11')]);router['delete'](_0xe93d('0xd'),auth[_0xe93d('0x9')](),controller[_0xe93d('0x12')]);module[_0xe93d('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 37ede8f..3d9c9a3 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 _0x26aa=['STRING','DATE','sequelize','exports'];(function(_0x256605,_0x1ac03d){var _0x4fac8a=function(_0xe6a1f2){while(--_0xe6a1f2){_0x256605['push'](_0x256605['shift']());}};_0x4fac8a(++_0x1ac03d);}(_0x26aa,0xa2));var _0xa26a=function(_0x5a5773,_0x44edae){_0x5a5773=_0x5a5773-0x0;var _0x373a26=_0x26aa[_0x5a5773];return _0x373a26;};'use strict';var moment=require('moment');var Sequelize=require(_0xa26a('0x0'));module[_0xa26a('0x1')]={'uniqueid':{'type':Sequelize[_0xa26a('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xa26a('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa26a('0x3')]},'acceptAt':{'type':Sequelize[_0xa26a('0x3')]},'exitAt':{'type':Sequelize[_0xa26a('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xee65=['sequelize','STRING','DATE','moment'];(function(_0x331dfe,_0x13f0fc){var _0x104132=function(_0x41de65){while(--_0x41de65){_0x331dfe['push'](_0x331dfe['shift']());}};_0x104132(++_0x13f0fc);}(_0xee65,0x1bb));var _0x5ee6=function(_0x16294b,_0x4f6067){_0x16294b=_0x16294b-0x0;var _0x3c8e13=_0xee65[_0x16294b];return _0x3c8e13;};'use strict';var moment=require(_0x5ee6('0x0'));var Sequelize=require(_0x5ee6('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x5ee6('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x5ee6('0x2')]},'joinAt':{'type':Sequelize[_0x5ee6('0x3')]},'leaveAt':{'type':Sequelize[_0x5ee6('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x5ee6('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index d0a2d87..a65bb07 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 _0xd54d=['../../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','name','send','map','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelQueueReport','includeAll','include','findAll','catch','params','rawAttributes','find','create','body','describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x2d2317,_0x48c7bc){var _0x158973=function(_0x4845be){while(--_0x4845be){_0x2d2317['push'](_0x2d2317['shift']());}};_0x158973(++_0x48c7bc);}(_0xd54d,0x154));var _0xdd54=function(_0x2b3ba6,_0x6ae989){_0x2b3ba6=_0x2b3ba6-0x0;var _0xfc181=_0xd54d[_0x2b3ba6];return _0xfc181;};'use strict';var emlformat=require(_0xdd54('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdd54('0x1'));var jsonpatch=require(_0xdd54('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdd54('0x3'));var Mustache=require(_0xdd54('0x4'));var util=require(_0xdd54('0x5'));var path=require(_0xdd54('0x6'));var sox=require(_0xdd54('0x7'));var csv=require(_0xdd54('0x8'));var ejs=require(_0xdd54('0x9'));var fs=require('fs');var fs_extra=require(_0xdd54('0xa'));var _=require('lodash');var squel=require(_0xdd54('0xb'));var crypto=require(_0xdd54('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdd54('0x8'));var querystring=require(_0xdd54('0xd'));var Papa=require(_0xdd54('0xe'));var Redis=require('ioredis');var authService=require(_0xdd54('0xf'));var qs=require(_0xdd54('0x10'));var as=require(_0xdd54('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdd54('0x12'))(_0xdd54('0x13'));var utils=require(_0xdd54('0x14'));var config=require(_0xdd54('0x15'));var licenseUtil=require(_0xdd54('0x16'));var db=require(_0xdd54('0x17'))['db'];function respondWithStatusCode(_0x43931e,_0x26d239){_0x26d239=_0x26d239||0xcc;return function(_0x1d24c8){if(_0x1d24c8){return _0x43931e[_0xdd54('0x18')](_0x26d239);}return _0x43931e[_0xdd54('0x19')](_0x26d239)[_0xdd54('0x1a')]();};}function respondWithResult(_0x1ffba6,_0x2e4817){_0x2e4817=_0x2e4817||0xc8;return function(_0x2dbdb6){if(_0x2dbdb6){return _0x1ffba6[_0xdd54('0x19')](_0x2e4817)['json'](_0x2dbdb6);}};}function respondWithFilteredResult(_0x448aff,_0x58cff5){return function(_0x3ebd1a){if(_0x3ebd1a){var _0x4ad1e6=typeof _0x58cff5[_0xdd54('0x1b')]===_0xdd54('0x1c')&&typeof _0x58cff5[_0xdd54('0x1d')]===_0xdd54('0x1c');var _0x1d7896=_0x3ebd1a[_0xdd54('0x1e')];var _0x363b5b=_0x4ad1e6?0x0:_0x58cff5[_0xdd54('0x1b')];var _0x1bd251=_0x4ad1e6?_0x3ebd1a['count']:_0x58cff5['offset']+_0x58cff5['limit'];var _0x4eb313;if(_0x1bd251>=_0x1d7896){_0x1bd251=_0x1d7896;_0x4eb313=0xc8;}else{_0x4eb313=0xce;}_0x448aff[_0xdd54('0x19')](_0x4eb313);return _0x448aff[_0xdd54('0x1f')](_0xdd54('0x20'),_0x363b5b+'-'+_0x1bd251+'/'+_0x1d7896)[_0xdd54('0x21')](_0x3ebd1a);}return null;};}function patchUpdates(_0x17c9b6){return function(_0x4d9168){try{jsonpatch[_0xdd54('0x22')](_0x4d9168,_0x17c9b6,!![]);}catch(_0x271da3){return BPromise[_0xdd54('0x23')](_0x271da3);}return _0x4d9168[_0xdd54('0x24')]();};}function saveUpdates(_0x16d042,_0x4e2142){return function(_0x44e987){if(_0x44e987){return _0x44e987[_0xdd54('0x25')](_0x16d042)[_0xdd54('0x26')](function(_0x5486fd){return _0x5486fd;});}return null;};}function removeEntity(_0x124e69,_0x249539){return function(_0x3a17cc){if(_0x3a17cc){return _0x3a17cc[_0xdd54('0x27')]()['then'](function(){_0x124e69['status'](0xcc)[_0xdd54('0x1a')]();});}};}function handleEntityNotFound(_0x15dade,_0x565edd){return function(_0x217b76){if(!_0x217b76){_0x15dade['sendStatus'](0x194);}return _0x217b76;};}function handleError(_0x367ef6,_0x1aa6f6){_0x1aa6f6=_0x1aa6f6||0x1f4;return function(_0x5df6bd){logger['error'](_0x5df6bd['stack']);if(_0x5df6bd[_0xdd54('0x28')]){delete _0x5df6bd[_0xdd54('0x28')];}_0x367ef6['status'](_0x1aa6f6)[_0xdd54('0x29')](_0x5df6bd);};}exports['index']=function(_0x49d4a1,_0x1552eb){var _0x431abd={},_0x20a85c={},_0x3fc48c={'count':0x0,'rows':[]};var _0xd0a2f5=_[_0xdd54('0x2a')](db['OpenchannelQueueReport']['rawAttributes'],function(_0x49f52b){return{'name':_0x49f52b['fieldName'],'type':_0x49f52b['type']['key']};});_0x20a85c[_0xdd54('0x2b')]=_[_0xdd54('0x2a')](_0xd0a2f5,_0xdd54('0x28'));_0x20a85c[_0xdd54('0x2c')]=_[_0xdd54('0x2d')](_0x49d4a1[_0xdd54('0x2c')]);_0x20a85c[_0xdd54('0x2e')]=_[_0xdd54('0x2f')](_0x20a85c[_0xdd54('0x2b')],_0x20a85c['query']);_0x431abd[_0xdd54('0x30')]=_[_0xdd54('0x2f')](_0x20a85c['model'],qs[_0xdd54('0x31')](_0x49d4a1[_0xdd54('0x2c')][_0xdd54('0x31')]));_0x431abd[_0xdd54('0x30')]=_0x431abd[_0xdd54('0x30')][_0xdd54('0x32')]?_0x431abd['attributes']:_0x20a85c[_0xdd54('0x2b')];if(!_0x49d4a1[_0xdd54('0x2c')][_0xdd54('0x33')](_0xdd54('0x34'))){_0x431abd['limit']=qs[_0xdd54('0x1d')](_0x49d4a1['query'][_0xdd54('0x1d')]);_0x431abd[_0xdd54('0x1b')]=qs[_0xdd54('0x1b')](_0x49d4a1[_0xdd54('0x2c')][_0xdd54('0x1b')]);}_0x431abd[_0xdd54('0x35')]=qs[_0xdd54('0x36')](_0x49d4a1['query'][_0xdd54('0x36')]);_0x431abd[_0xdd54('0x37')]=qs['filters'](_[_0xdd54('0x38')](_0x49d4a1[_0xdd54('0x2c')],_0x20a85c[_0xdd54('0x2e')]),_0xd0a2f5);if(_0x49d4a1[_0xdd54('0x2c')][_0xdd54('0x39')]){_0x431abd[_0xdd54('0x37')]=_[_0xdd54('0x3a')](_0x431abd[_0xdd54('0x37')],{'$or':_[_0xdd54('0x2a')](_0xd0a2f5,function(_0x5aff8f){if(_0x5aff8f['type']!==_0xdd54('0x3b')){var _0x235ede={};_0x235ede[_0x5aff8f[_0xdd54('0x28')]]={'$like':'%'+_0x49d4a1[_0xdd54('0x2c')][_0xdd54('0x39')]+'%'};return _0x235ede;}})});}_0x431abd=_[_0xdd54('0x3a')]({},_0x431abd,_0x49d4a1[_0xdd54('0x3c')]);var _0x355595={'where':_0x431abd[_0xdd54('0x37')]};return db[_0xdd54('0x3d')][_0xdd54('0x1e')](_0x355595)['then'](function(_0x304930){_0x3fc48c[_0xdd54('0x1e')]=_0x304930;if(_0x49d4a1[_0xdd54('0x2c')][_0xdd54('0x3e')]){_0x431abd[_0xdd54('0x3f')]=[{'all':!![]}];}return db[_0xdd54('0x3d')][_0xdd54('0x40')](_0x431abd);})['then'](function(_0x5b025c){_0x3fc48c['rows']=_0x5b025c;return _0x3fc48c;})['then'](respondWithFilteredResult(_0x1552eb,_0x431abd))[_0xdd54('0x41')](handleError(_0x1552eb,null));};exports['show']=function(_0x86eea9,_0x2f76b4){var _0x20a2df={'raw':!![],'where':{'id':_0x86eea9[_0xdd54('0x42')]['id']}},_0x6876f5={};_0x6876f5[_0xdd54('0x2b')]=_[_0xdd54('0x2d')](db['OpenchannelQueueReport'][_0xdd54('0x43')]);_0x6876f5[_0xdd54('0x2c')]=_[_0xdd54('0x2d')](_0x86eea9[_0xdd54('0x2c')]);_0x6876f5[_0xdd54('0x2e')]=_[_0xdd54('0x2f')](_0x6876f5['model'],_0x6876f5[_0xdd54('0x2c')]);_0x20a2df[_0xdd54('0x30')]=_[_0xdd54('0x2f')](_0x6876f5[_0xdd54('0x2b')],qs[_0xdd54('0x31')](_0x86eea9[_0xdd54('0x2c')][_0xdd54('0x31')]));_0x20a2df[_0xdd54('0x30')]=_0x20a2df[_0xdd54('0x30')][_0xdd54('0x32')]?_0x20a2df[_0xdd54('0x30')]:_0x6876f5[_0xdd54('0x2b')];if(_0x86eea9['query'][_0xdd54('0x3e')]){_0x20a2df[_0xdd54('0x3f')]=[{'all':!![]}];}_0x20a2df=_['merge']({},_0x20a2df,_0x86eea9['options']);return db[_0xdd54('0x3d')][_0xdd54('0x44')](_0x20a2df)[_0xdd54('0x26')](handleEntityNotFound(_0x2f76b4,null))[_0xdd54('0x26')](respondWithResult(_0x2f76b4,null))[_0xdd54('0x41')](handleError(_0x2f76b4,null));};exports['create']=function(_0x2bbe86,_0x447bf8){return db[_0xdd54('0x3d')][_0xdd54('0x45')](_0x2bbe86['body'],{})[_0xdd54('0x26')](respondWithResult(_0x447bf8,0xc9))[_0xdd54('0x41')](handleError(_0x447bf8,null));};exports[_0xdd54('0x25')]=function(_0x1d98d1,_0x55a93d){if(_0x1d98d1[_0xdd54('0x46')]['id']){delete _0x1d98d1['body']['id'];}return db[_0xdd54('0x3d')][_0xdd54('0x44')]({'where':{'id':_0x1d98d1[_0xdd54('0x42')]['id']}})[_0xdd54('0x26')](handleEntityNotFound(_0x55a93d,null))[_0xdd54('0x26')](saveUpdates(_0x1d98d1['body'],null))[_0xdd54('0x26')](respondWithResult(_0x55a93d,null))['catch'](handleError(_0x55a93d,null));};exports[_0xdd54('0x27')]=function(_0x6a88df,_0x30f43c){return db['OpenchannelQueueReport'][_0xdd54('0x44')]({'where':{'id':_0x6a88df[_0xdd54('0x42')]['id']}})[_0xdd54('0x26')](handleEntityNotFound(_0x30f43c,null))['then'](removeEntity(_0x30f43c,null))['catch'](handleError(_0x30f43c,null));};exports[_0xdd54('0x47')]=function(_0x2d69bb,_0x37f97d){return db[_0xdd54('0x3d')][_0xdd54('0x47')]()[_0xdd54('0x26')](respondWithResult(_0x37f97d,null))[_0xdd54('0x41')](handleError(_0x37f97d,null));}; \ No newline at end of file +var _0xbb00=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','destroy','then','error','name','index','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','include','options','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x17ff3c,_0x56a536){var _0x5de132=function(_0x376080){while(--_0x376080){_0x17ff3c['push'](_0x17ff3c['shift']());}};_0x5de132(++_0x56a536);}(_0xbb00,0x1b3));var _0x0bb0=function(_0x5e4ada,_0x3747a1){_0x5e4ada=_0x5e4ada-0x0;var _0x998c04=_0xbb00[_0x5e4ada];return _0x998c04;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0bb0('0x0'));var zipdir=require(_0x0bb0('0x1'));var jsonpatch=require(_0x0bb0('0x2'));var rp=require(_0x0bb0('0x3'));var moment=require(_0x0bb0('0x4'));var BPromise=require(_0x0bb0('0x5'));var Mustache=require(_0x0bb0('0x6'));var util=require('util');var path=require(_0x0bb0('0x7'));var sox=require('sox');var csv=require(_0x0bb0('0x8'));var ejs=require(_0x0bb0('0x9'));var fs=require('fs');var fs_extra=require(_0x0bb0('0xa'));var _=require(_0x0bb0('0xb'));var squel=require('squel');var crypto=require(_0x0bb0('0xc'));var jsforce=require(_0x0bb0('0xd'));var deskjs=require(_0x0bb0('0xe'));var toCsv=require(_0x0bb0('0x8'));var querystring=require(_0x0bb0('0xf'));var Papa=require(_0x0bb0('0x10'));var Redis=require('ioredis');var authService=require(_0x0bb0('0x11'));var qs=require(_0x0bb0('0x12'));var as=require(_0x0bb0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0bb0('0x14'))(_0x0bb0('0x15'));var utils=require(_0x0bb0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0bb0('0x17'));var db=require(_0x0bb0('0x18'))['db'];function respondWithStatusCode(_0xa59d12,_0x196ea8){_0x196ea8=_0x196ea8||0xcc;return function(_0x31ce29){if(_0x31ce29){return _0xa59d12[_0x0bb0('0x19')](_0x196ea8);}return _0xa59d12[_0x0bb0('0x1a')](_0x196ea8)[_0x0bb0('0x1b')]();};}function respondWithResult(_0x2933e7,_0x23cf8a){_0x23cf8a=_0x23cf8a||0xc8;return function(_0x15d53a){if(_0x15d53a){return _0x2933e7['status'](_0x23cf8a)[_0x0bb0('0x1c')](_0x15d53a);}};}function respondWithFilteredResult(_0x40e0c4,_0x3f2e0d){return function(_0x5f04c4){if(_0x5f04c4){var _0x3127b6=typeof _0x3f2e0d[_0x0bb0('0x1d')]===_0x0bb0('0x1e')&&typeof _0x3f2e0d['limit']==='undefined';var _0x17d3ff=_0x5f04c4['count'];var _0x6eef2d=_0x3127b6?0x0:_0x3f2e0d[_0x0bb0('0x1d')];var _0x4945ba=_0x3127b6?_0x5f04c4[_0x0bb0('0x1f')]:_0x3f2e0d['offset']+_0x3f2e0d['limit'];var _0x5415fb;if(_0x4945ba>=_0x17d3ff){_0x4945ba=_0x17d3ff;_0x5415fb=0xc8;}else{_0x5415fb=0xce;}_0x40e0c4[_0x0bb0('0x1a')](_0x5415fb);return _0x40e0c4['set'](_0x0bb0('0x20'),_0x6eef2d+'-'+_0x4945ba+'/'+_0x17d3ff)[_0x0bb0('0x1c')](_0x5f04c4);}return null;};}function patchUpdates(_0xcd160a){return function(_0x3e433d){try{jsonpatch[_0x0bb0('0x21')](_0x3e433d,_0xcd160a,!![]);}catch(_0x1ecfb8){return BPromise[_0x0bb0('0x22')](_0x1ecfb8);}return _0x3e433d[_0x0bb0('0x23')]();};}function saveUpdates(_0x166d9f,_0x55c983){return function(_0x354885){if(_0x354885){return _0x354885[_0x0bb0('0x24')](_0x166d9f)['then'](function(_0x47a249){return _0x47a249;});}return null;};}function removeEntity(_0x17a4f4,_0x3bf320){return function(_0x5f52b1){if(_0x5f52b1){return _0x5f52b1[_0x0bb0('0x25')]()[_0x0bb0('0x26')](function(){_0x17a4f4[_0x0bb0('0x1a')](0xcc)[_0x0bb0('0x1b')]();});}};}function handleEntityNotFound(_0x21a306,_0x25acde){return function(_0x3c07db){if(!_0x3c07db){_0x21a306[_0x0bb0('0x19')](0x194);}return _0x3c07db;};}function handleError(_0x3a9934,_0x1bc307){_0x1bc307=_0x1bc307||0x1f4;return function(_0x163ae4){logger[_0x0bb0('0x27')](_0x163ae4['stack']);if(_0x163ae4['name']){delete _0x163ae4[_0x0bb0('0x28')];}_0x3a9934[_0x0bb0('0x1a')](_0x1bc307)['send'](_0x163ae4);};}exports[_0x0bb0('0x29')]=function(_0x1d6ad0,_0x3b2c0b){var _0x3c1b9a={},_0x83dfd0={},_0x3ca0f6={'count':0x0,'rows':[]};var _0x5ee983=_['map'](db[_0x0bb0('0x2a')][_0x0bb0('0x2b')],function(_0x3c840a){return{'name':_0x3c840a[_0x0bb0('0x2c')],'type':_0x3c840a[_0x0bb0('0x2d')][_0x0bb0('0x2e')]};});_0x83dfd0[_0x0bb0('0x2f')]=_[_0x0bb0('0x30')](_0x5ee983,_0x0bb0('0x28'));_0x83dfd0[_0x0bb0('0x31')]=_[_0x0bb0('0x32')](_0x1d6ad0[_0x0bb0('0x31')]);_0x83dfd0[_0x0bb0('0x33')]=_['intersection'](_0x83dfd0[_0x0bb0('0x2f')],_0x83dfd0[_0x0bb0('0x31')]);_0x3c1b9a[_0x0bb0('0x34')]=_[_0x0bb0('0x35')](_0x83dfd0[_0x0bb0('0x2f')],qs['fields'](_0x1d6ad0[_0x0bb0('0x31')][_0x0bb0('0x36')]));_0x3c1b9a[_0x0bb0('0x34')]=_0x3c1b9a[_0x0bb0('0x34')][_0x0bb0('0x37')]?_0x3c1b9a[_0x0bb0('0x34')]:_0x83dfd0[_0x0bb0('0x2f')];if(!_0x1d6ad0[_0x0bb0('0x31')][_0x0bb0('0x38')]('nolimit')){_0x3c1b9a[_0x0bb0('0x39')]=qs[_0x0bb0('0x39')](_0x1d6ad0[_0x0bb0('0x31')]['limit']);_0x3c1b9a[_0x0bb0('0x1d')]=qs[_0x0bb0('0x1d')](_0x1d6ad0['query']['offset']);}_0x3c1b9a['order']=qs[_0x0bb0('0x3a')](_0x1d6ad0[_0x0bb0('0x31')][_0x0bb0('0x3a')]);_0x3c1b9a[_0x0bb0('0x3b')]=qs['filters'](_[_0x0bb0('0x3c')](_0x1d6ad0['query'],_0x83dfd0['filters']),_0x5ee983);if(_0x1d6ad0['query'][_0x0bb0('0x3d')]){_0x3c1b9a['where']=_['merge'](_0x3c1b9a[_0x0bb0('0x3b')],{'$or':_['map'](_0x5ee983,function(_0x5265d4){if(_0x5265d4['type']!==_0x0bb0('0x3e')){var _0x37334a={};_0x37334a[_0x5265d4['name']]={'$like':'%'+_0x1d6ad0[_0x0bb0('0x31')][_0x0bb0('0x3d')]+'%'};return _0x37334a;}})});}_0x3c1b9a=_[_0x0bb0('0x3f')]({},_0x3c1b9a,_0x1d6ad0['options']);var _0x197a33={'where':_0x3c1b9a[_0x0bb0('0x3b')]};return db['OpenchannelQueueReport']['count'](_0x197a33)[_0x0bb0('0x26')](function(_0x407afd){_0x3ca0f6['count']=_0x407afd;if(_0x1d6ad0[_0x0bb0('0x31')][_0x0bb0('0x40')]){_0x3c1b9a['include']=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x0bb0('0x41')](_0x3c1b9a);})[_0x0bb0('0x26')](function(_0x1fec1d){_0x3ca0f6[_0x0bb0('0x42')]=_0x1fec1d;return _0x3ca0f6;})[_0x0bb0('0x26')](respondWithFilteredResult(_0x3b2c0b,_0x3c1b9a))[_0x0bb0('0x43')](handleError(_0x3b2c0b,null));};exports[_0x0bb0('0x44')]=function(_0x1c3708,_0xaf2d36){var _0x51aadb={'raw':!![],'where':{'id':_0x1c3708[_0x0bb0('0x45')]['id']}},_0x29eb7b={};_0x29eb7b['model']=_[_0x0bb0('0x32')](db['OpenchannelQueueReport'][_0x0bb0('0x2b')]);_0x29eb7b[_0x0bb0('0x31')]=_[_0x0bb0('0x32')](_0x1c3708[_0x0bb0('0x31')]);_0x29eb7b[_0x0bb0('0x33')]=_[_0x0bb0('0x35')](_0x29eb7b[_0x0bb0('0x2f')],_0x29eb7b[_0x0bb0('0x31')]);_0x51aadb[_0x0bb0('0x34')]=_[_0x0bb0('0x35')](_0x29eb7b[_0x0bb0('0x2f')],qs[_0x0bb0('0x36')](_0x1c3708['query']['fields']));_0x51aadb[_0x0bb0('0x34')]=_0x51aadb[_0x0bb0('0x34')][_0x0bb0('0x37')]?_0x51aadb[_0x0bb0('0x34')]:_0x29eb7b[_0x0bb0('0x2f')];if(_0x1c3708['query'][_0x0bb0('0x40')]){_0x51aadb[_0x0bb0('0x46')]=[{'all':!![]}];}_0x51aadb=_[_0x0bb0('0x3f')]({},_0x51aadb,_0x1c3708[_0x0bb0('0x47')]);return db[_0x0bb0('0x2a')]['find'](_0x51aadb)[_0x0bb0('0x26')](handleEntityNotFound(_0xaf2d36,null))[_0x0bb0('0x26')](respondWithResult(_0xaf2d36,null))['catch'](handleError(_0xaf2d36,null));};exports[_0x0bb0('0x48')]=function(_0x16febe,_0x56d7b7){return db['OpenchannelQueueReport'][_0x0bb0('0x48')](_0x16febe['body'],{})[_0x0bb0('0x26')](respondWithResult(_0x56d7b7,0xc9))['catch'](handleError(_0x56d7b7,null));};exports[_0x0bb0('0x24')]=function(_0x515af5,_0x5711a1){if(_0x515af5[_0x0bb0('0x49')]['id']){delete _0x515af5['body']['id'];}return db['OpenchannelQueueReport'][_0x0bb0('0x4a')]({'where':{'id':_0x515af5[_0x0bb0('0x45')]['id']}})['then'](handleEntityNotFound(_0x5711a1,null))[_0x0bb0('0x26')](saveUpdates(_0x515af5[_0x0bb0('0x49')],null))[_0x0bb0('0x26')](respondWithResult(_0x5711a1,null))['catch'](handleError(_0x5711a1,null));};exports['destroy']=function(_0x8a2f99,_0x2349c8){return db[_0x0bb0('0x2a')][_0x0bb0('0x4a')]({'where':{'id':_0x8a2f99[_0x0bb0('0x45')]['id']}})['then'](handleEntityNotFound(_0x2349c8,null))[_0x0bb0('0x26')](removeEntity(_0x2349c8,null))['catch'](handleError(_0x2349c8,null));};exports[_0x0bb0('0x4b')]=function(_0x20ef93,_0x48aec1){return db['OpenchannelQueueReport'][_0x0bb0('0x4b')]()[_0x0bb0('0x26')](respondWithResult(_0x48aec1,null))[_0x0bb0('0x43')](handleError(_0x48aec1,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 7d44e43..8983e91 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 _0x2ef3=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelQueueReport.attributes','exports'];(function(_0xaf4b4a,_0x190a02){var _0x6ead88=function(_0x49b7ee){while(--_0x49b7ee){_0xaf4b4a['push'](_0xaf4b4a['shift']());}};_0x6ead88(++_0x190a02);}(_0x2ef3,0xba));var _0x32ef=function(_0x321f93,_0x275a05){_0x321f93=_0x321f93-0x0;var _0xba4680=_0x2ef3[_0x321f93];return _0xba4680;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x2aabc5,_0x1bb9e3){var _0x4cb47f=function(_0x1f82c5){while(--_0x1f82c5){_0x2aabc5['push'](_0x2aabc5['shift']());}};_0x4cb47f(++_0x1bb9e3);}(_0x1261,0x144));var _0x1126=function(_0xe4d35a,_0x4bd94d){_0xe4d35a=_0xe4d35a-0x0;var _0x249363=_0x1261[_0xe4d35a];return _0x249363;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 28d4eba..3f55766 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 _0xe605=['UpdateOpenchannelQueueReport','update','where','attributes','limit','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','stringify'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0xe605,0x92));var _0x5e60=function(_0x3d123b,_0xe8917){_0x3d123b=_0x3d123b-0x0;var _0x178527=_0xe605[_0x3d123b];return _0x178527;};'use strict';var _=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var moment=require('moment');var BPromise=require(_0x5e60('0x2'));var rs=require(_0x5e60('0x3'));var fs=require('fs');var Redis=require(_0x5e60('0x4'));var db=require(_0x5e60('0x5'))['db'];var utils=require(_0x5e60('0x6'));var logger=require(_0x5e60('0x7'))(_0x5e60('0x8'));var config=require(_0x5e60('0x9'));var jayson=require(_0x5e60('0xa'));var client=jayson[_0x5e60('0xb')][_0x5e60('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x168a14,_0x4e3501,_0x1c5a6f){return new BPromise(function(_0x55ff5c,_0x593118){return client['request'](_0x168a14,_0x1c5a6f)[_0x5e60('0xd')](function(_0xe93f9c){logger[_0x5e60('0xe')](_0x5e60('0xf'),_0x4e3501,_0x5e60('0x10'));logger[_0x5e60('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x4e3501,_0x5e60('0x10'),JSON['stringify'](_0xe93f9c));if(_0xe93f9c[_0x5e60('0x12')]){if(_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x13')]===0x1f4){logger['error'](_0x5e60('0xf'),_0x4e3501,_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);return _0x593118(_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);}logger[_0x5e60('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4e3501,_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);return _0x55ff5c(_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);}else{logger['info'](_0x5e60('0xf'),_0x4e3501,'request\x20sent');_0x55ff5c(_0xe93f9c[_0x5e60('0x15')][_0x5e60('0x14')]);}})['catch'](function(_0x39be57){logger[_0x5e60('0x12')](_0x5e60('0xf'),_0x4e3501,_0x39be57);_0x593118(_0x39be57);});});}exports[_0x5e60('0x16')]=function(_0x5c485d){var _0xdd0a71=this;return new Promise(function(_0x22d718,_0x52cc15){return db[_0x5e60('0x17')][_0x5e60('0x18')](_0x5c485d[_0x5e60('0x19')],{'raw':_0x5c485d[_0x5e60('0x1a')]?_0x5c485d[_0x5e60('0x1a')][_0x5e60('0x1b')]===undefined?!![]:![]:!![]})[_0x5e60('0xd')](function(_0x524c93){logger[_0x5e60('0xe')](_0x5e60('0x16'),_0x5c485d);logger[_0x5e60('0x11')]('CreateOpenchannelQueueReport',_0x5c485d,JSON[_0x5e60('0x1c')](_0x524c93));_0x22d718(_0x524c93);})['catch'](function(_0x376069){logger[_0x5e60('0x12')](_0x5e60('0x16'),_0x376069[_0x5e60('0x14')],_0x5c485d);_0x52cc15(_0xdd0a71[_0x5e60('0x12')](0x1f4,_0x376069[_0x5e60('0x14')]));});});};exports[_0x5e60('0x1d')]=function(_0x5d2c03){var _0x18d527=this;return new Promise(function(_0x7dbdb7,_0x19f37b){return db['OpenchannelQueueReport'][_0x5e60('0x1e')](_0x5d2c03[_0x5e60('0x19')],{'raw':_0x5d2c03[_0x5e60('0x1a')]?_0x5d2c03[_0x5e60('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d2c03[_0x5e60('0x1a')]?_0x5d2c03['options'][_0x5e60('0x1f')]||null:null,'attributes':_0x5d2c03[_0x5e60('0x1a')]?_0x5d2c03['options'][_0x5e60('0x20')]||null:null,'limit':_0x5d2c03[_0x5e60('0x1a')]?_0x5d2c03['options'][_0x5e60('0x21')]||null:null})[_0x5e60('0xd')](function(_0x52c97c){logger['info']('UpdateOpenchannelQueueReport',_0x5d2c03);logger[_0x5e60('0x11')](_0x5e60('0x1d'),_0x5d2c03,JSON[_0x5e60('0x1c')](_0x52c97c));_0x7dbdb7(_0x52c97c);})[_0x5e60('0x22')](function(_0x3ccfee){logger['error'](_0x5e60('0x1d'),_0x3ccfee[_0x5e60('0x14')],_0x5d2c03);_0x19f37b(_0x18d527['error'](0x1f4,_0x3ccfee[_0x5e60('0x14')]));});});}; \ No newline at end of file +var _0xd523=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','where','attributes','lodash'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xd523,0x153));var _0x3d52=function(_0x1c29a8,_0x49fed0){_0x1c29a8=_0x1c29a8-0x0;var _0x347f3f=_0xd523[_0x1c29a8];return _0x347f3f;};'use strict';var _=require(_0x3d52('0x0'));var util=require(_0x3d52('0x1'));var moment=require(_0x3d52('0x2'));var BPromise=require(_0x3d52('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d52('0x4'));var db=require(_0x3d52('0x5'))['db'];var utils=require(_0x3d52('0x6'));var logger=require('../../config/logger')(_0x3d52('0x7'));var config=require(_0x3d52('0x8'));var jayson=require(_0x3d52('0x9'));var client=jayson[_0x3d52('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fcc92,_0x189147,_0x2f3ebc){return new BPromise(function(_0x232bd4,_0x2e03c0){return client[_0x3d52('0xb')](_0x4fcc92,_0x2f3ebc)[_0x3d52('0xc')](function(_0x34c184){logger[_0x3d52('0xd')](_0x3d52('0xe'),_0x189147,'request\x20sent');logger[_0x3d52('0xf')](_0x3d52('0x10'),_0x189147,_0x3d52('0x11'),JSON[_0x3d52('0x12')](_0x34c184));if(_0x34c184[_0x3d52('0x13')]){if(_0x34c184['error'][_0x3d52('0x14')]===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x189147,_0x34c184[_0x3d52('0x13')][_0x3d52('0x15')]);return _0x2e03c0(_0x34c184['error']['message']);}logger['error'](_0x3d52('0xe'),_0x189147,_0x34c184[_0x3d52('0x13')][_0x3d52('0x15')]);return _0x232bd4(_0x34c184[_0x3d52('0x13')][_0x3d52('0x15')]);}else{logger[_0x3d52('0xd')](_0x3d52('0xe'),_0x189147,_0x3d52('0x11'));_0x232bd4(_0x34c184[_0x3d52('0x16')][_0x3d52('0x15')]);}})[_0x3d52('0x17')](function(_0x15cc02){logger[_0x3d52('0x13')](_0x3d52('0xe'),_0x189147,_0x15cc02);_0x2e03c0(_0x15cc02);});});}exports[_0x3d52('0x18')]=function(_0x5bce9a){var _0x163d88=this;return new Promise(function(_0x3b3451,_0x386cdb){return db['OpenchannelQueueReport'][_0x3d52('0x19')](_0x5bce9a[_0x3d52('0x1a')],{'raw':_0x5bce9a[_0x3d52('0x1b')]?_0x5bce9a['options'][_0x3d52('0x1c')]===undefined?!![]:![]:!![]})[_0x3d52('0xc')](function(_0x1163c5){logger[_0x3d52('0xd')](_0x3d52('0x18'),_0x5bce9a);logger[_0x3d52('0xf')](_0x3d52('0x18'),_0x5bce9a,JSON[_0x3d52('0x12')](_0x1163c5));_0x3b3451(_0x1163c5);})['catch'](function(_0x419c05){logger[_0x3d52('0x13')](_0x3d52('0x18'),_0x419c05['message'],_0x5bce9a);_0x386cdb(_0x163d88[_0x3d52('0x13')](0x1f4,_0x419c05[_0x3d52('0x15')]));});});};exports[_0x3d52('0x1d')]=function(_0xc6c76){var _0x3816bc=this;return new Promise(function(_0x349b30,_0xdf73cd){return db[_0x3d52('0x1e')][_0x3d52('0x1f')](_0xc6c76[_0x3d52('0x1a')],{'raw':_0xc6c76[_0x3d52('0x1b')]?_0xc6c76['options'][_0x3d52('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc6c76[_0x3d52('0x1b')]?_0xc6c76[_0x3d52('0x1b')][_0x3d52('0x20')]||null:null,'attributes':_0xc6c76['options']?_0xc6c76['options'][_0x3d52('0x21')]||null:null,'limit':_0xc6c76[_0x3d52('0x1b')]?_0xc6c76[_0x3d52('0x1b')]['limit']||null:null})[_0x3d52('0xc')](function(_0x4312a7){logger[_0x3d52('0xd')](_0x3d52('0x1d'),_0xc6c76);logger['debug'](_0x3d52('0x1d'),_0xc6c76,JSON[_0x3d52('0x12')](_0x4312a7));_0x349b30(_0x4312a7);})[_0x3d52('0x17')](function(_0x193bf1){logger['error'](_0x3d52('0x1d'),_0x193bf1['message'],_0xc6c76);_0xdf73cd(_0x3816bc[_0x3d52('0x13')](0x1f4,_0x193bf1[_0x3d52('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index ba68c25..42ebda8 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 _0xe083=['show','post','create','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./openchannelTransferReport.controller','isAuthenticated','get','/describe','describe','/:id'];(function(_0x567b0d,_0x498c8a){var _0x3b223f=function(_0x55ff76){while(--_0x55ff76){_0x567b0d['push'](_0x567b0d['shift']());}};_0x3b223f(++_0x498c8a);}(_0xe083,0x195));var _0x3e08=function(_0x586a76,_0x144520){_0x586a76=_0x586a76-0x0;var _0x193b99=_0xe083[_0x586a76];return _0x193b99;};'use strict';var multer=require('multer');var util=require(_0x3e08('0x0'));var path=require(_0x3e08('0x1'));var timeout=require(_0x3e08('0x2'));var express=require(_0x3e08('0x3'));var router=express[_0x3e08('0x4')]();var fs_extra=require(_0x3e08('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3e08('0x6'));var controller=require(_0x3e08('0x7'));router['get']('/',auth[_0x3e08('0x8')](),controller['index']);router[_0x3e08('0x9')](_0x3e08('0xa'),auth[_0x3e08('0x8')](),controller[_0x3e08('0xb')]);router[_0x3e08('0x9')](_0x3e08('0xc'),auth[_0x3e08('0x8')](),controller[_0x3e08('0xd')]);router[_0x3e08('0xe')]('/',auth['isAuthenticated'](),controller[_0x3e08('0xf')]);router['put'](_0x3e08('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x3e08('0x10')]('/:id',auth[_0x3e08('0x8')](),controller[_0x3e08('0x11')]);module[_0x3e08('0x12')]=router; \ No newline at end of file +var _0x4df5=['Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x20da3f,_0x2f2ca5){var _0xdc99ca=function(_0x24e682){while(--_0x24e682){_0x20da3f['push'](_0x20da3f['shift']());}};_0xdc99ca(++_0x2f2ca5);}(_0x4df5,0x1b3));var _0x54df=function(_0x178f3e,_0x567056){_0x178f3e=_0x178f3e-0x0;var _0x2c73ab=_0x4df5[_0x178f3e];return _0x2c73ab;};'use strict';var multer=require(_0x54df('0x0'));var util=require(_0x54df('0x1'));var path=require(_0x54df('0x2'));var timeout=require(_0x54df('0x3'));var express=require(_0x54df('0x4'));var router=express[_0x54df('0x5')]();var fs_extra=require(_0x54df('0x6'));var auth=require(_0x54df('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x54df('0x8'));var controller=require(_0x54df('0x9'));router[_0x54df('0xa')]('/',auth[_0x54df('0xb')](),controller[_0x54df('0xc')]);router[_0x54df('0xa')](_0x54df('0xd'),auth[_0x54df('0xb')](),controller[_0x54df('0xe')]);router[_0x54df('0xa')](_0x54df('0xf'),auth[_0x54df('0xb')](),controller[_0x54df('0x10')]);router['post']('/',auth[_0x54df('0xb')](),controller['create']);router[_0x54df('0x11')](_0x54df('0xf'),auth['isAuthenticated'](),controller[_0x54df('0x12')]);router[_0x54df('0x13')](_0x54df('0xf'),auth[_0x54df('0xb')](),controller[_0x54df('0x14')]);module[_0x54df('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index f23c13a..829d8af 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x416df5,_0x5cd9e7){var _0x53235b=function(_0xc8811e){while(--_0xc8811e){_0x416df5['push'](_0x416df5['shift']());}};_0x53235b(++_0x5cd9e7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x1e3c04,_0x582efc){var _0x5abbbc=function(_0x4c39d3){while(--_0x4c39d3){_0x1e3c04['push'](_0x1e3c04['shift']());}};_0x5abbbc(++_0x582efc);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xcb91[_0x199572];return _0x13cfa3;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index d296b8d..f3110fc 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 _0xd8c5=['then','destroy','sendStatus','error','stack','name','send','OpenchannelTransferReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','update','describe','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject'];(function(_0x598d0a,_0x483ecf){var _0x511cc2=function(_0x56e864){while(--_0x56e864){_0x598d0a['push'](_0x598d0a['shift']());}};_0x511cc2(++_0x483ecf);}(_0xd8c5,0xff));var _0x5d8c=function(_0x4f1bb7,_0x42a7d1){_0x4f1bb7=_0x4f1bb7-0x0;var _0x4ce414=_0xd8c5[_0x4f1bb7];return _0x4ce414;};'use strict';var emlformat=require(_0x5d8c('0x0'));var rimraf=require(_0x5d8c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5d8c('0x2'));var moment=require('moment');var BPromise=require(_0x5d8c('0x3'));var Mustache=require(_0x5d8c('0x4'));var util=require(_0x5d8c('0x5'));var path=require(_0x5d8c('0x6'));var sox=require(_0x5d8c('0x7'));var csv=require(_0x5d8c('0x8'));var ejs=require(_0x5d8c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5d8c('0xa'));var crypto=require(_0x5d8c('0xb'));var jsforce=require(_0x5d8c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5d8c('0x8'));var querystring=require(_0x5d8c('0xd'));var Papa=require(_0x5d8c('0xe'));var Redis=require('ioredis');var authService=require(_0x5d8c('0xf'));var qs=require(_0x5d8c('0x10'));var as=require(_0x5d8c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d8c('0x12'))('api');var utils=require(_0x5d8c('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x5d8c('0x14'));var db=require(_0x5d8c('0x15'))['db'];function respondWithStatusCode(_0x53f053,_0x3a6933){_0x3a6933=_0x3a6933||0xcc;return function(_0x5e95ac){if(_0x5e95ac){return _0x53f053['sendStatus'](_0x3a6933);}return _0x53f053[_0x5d8c('0x16')](_0x3a6933)[_0x5d8c('0x17')]();};}function respondWithResult(_0x31c5a0,_0x3089d5){_0x3089d5=_0x3089d5||0xc8;return function(_0x1bc3cf){if(_0x1bc3cf){return _0x31c5a0[_0x5d8c('0x16')](_0x3089d5)[_0x5d8c('0x18')](_0x1bc3cf);}};}function respondWithFilteredResult(_0x3a641a,_0xb57160){return function(_0x3b9c76){if(_0x3b9c76){var _0x290dd6=typeof _0xb57160['offset']==='undefined'&&typeof _0xb57160[_0x5d8c('0x19')]===_0x5d8c('0x1a');var _0x2ccaac=_0x3b9c76['count'];var _0x3969f0=_0x290dd6?0x0:_0xb57160[_0x5d8c('0x1b')];var _0x2237e3=_0x290dd6?_0x3b9c76[_0x5d8c('0x1c')]:_0xb57160[_0x5d8c('0x1b')]+_0xb57160[_0x5d8c('0x19')];var _0x1d448c;if(_0x2237e3>=_0x2ccaac){_0x2237e3=_0x2ccaac;_0x1d448c=0xc8;}else{_0x1d448c=0xce;}_0x3a641a[_0x5d8c('0x16')](_0x1d448c);return _0x3a641a[_0x5d8c('0x1d')](_0x5d8c('0x1e'),_0x3969f0+'-'+_0x2237e3+'/'+_0x2ccaac)[_0x5d8c('0x18')](_0x3b9c76);}return null;};}function patchUpdates(_0x5236f0){return function(_0x30ad12){try{jsonpatch[_0x5d8c('0x1f')](_0x30ad12,_0x5236f0,!![]);}catch(_0x13b046){return BPromise[_0x5d8c('0x20')](_0x13b046);}return _0x30ad12['save']();};}function saveUpdates(_0x1f030f,_0x2e5fc1){return function(_0x4c3847){if(_0x4c3847){return _0x4c3847['update'](_0x1f030f)[_0x5d8c('0x21')](function(_0x582c44){return _0x582c44;});}return null;};}function removeEntity(_0x595e64,_0xb7c371){return function(_0x81d279){if(_0x81d279){return _0x81d279[_0x5d8c('0x22')]()[_0x5d8c('0x21')](function(){_0x595e64['status'](0xcc)[_0x5d8c('0x17')]();});}};}function handleEntityNotFound(_0x5183df,_0x259614){return function(_0x17ffac){if(!_0x17ffac){_0x5183df[_0x5d8c('0x23')](0x194);}return _0x17ffac;};}function handleError(_0x20a18c,_0x28e82a){_0x28e82a=_0x28e82a||0x1f4;return function(_0x2c2e9d){logger[_0x5d8c('0x24')](_0x2c2e9d[_0x5d8c('0x25')]);if(_0x2c2e9d[_0x5d8c('0x26')]){delete _0x2c2e9d['name'];}_0x20a18c[_0x5d8c('0x16')](_0x28e82a)[_0x5d8c('0x27')](_0x2c2e9d);};}exports['index']=function(_0xf8c7d1,_0x24f776){var _0xc93f9e={},_0xeda0f1={},_0x162b75={'count':0x0,'rows':[]};var _0x158770=_['map'](db[_0x5d8c('0x28')]['rawAttributes'],function(_0x2cde0f){return{'name':_0x2cde0f[_0x5d8c('0x29')],'type':_0x2cde0f[_0x5d8c('0x2a')][_0x5d8c('0x2b')]};});_0xeda0f1[_0x5d8c('0x2c')]=_[_0x5d8c('0x2d')](_0x158770,'name');_0xeda0f1[_0x5d8c('0x2e')]=_[_0x5d8c('0x2f')](_0xf8c7d1['query']);_0xeda0f1[_0x5d8c('0x30')]=_[_0x5d8c('0x31')](_0xeda0f1['model'],_0xeda0f1[_0x5d8c('0x2e')]);_0xc93f9e[_0x5d8c('0x32')]=_[_0x5d8c('0x31')](_0xeda0f1[_0x5d8c('0x2c')],qs[_0x5d8c('0x33')](_0xf8c7d1['query']['fields']));_0xc93f9e[_0x5d8c('0x32')]=_0xc93f9e[_0x5d8c('0x32')][_0x5d8c('0x34')]?_0xc93f9e[_0x5d8c('0x32')]:_0xeda0f1[_0x5d8c('0x2c')];if(!_0xf8c7d1[_0x5d8c('0x2e')][_0x5d8c('0x35')]('nolimit')){_0xc93f9e[_0x5d8c('0x19')]=qs[_0x5d8c('0x19')](_0xf8c7d1[_0x5d8c('0x2e')][_0x5d8c('0x19')]);_0xc93f9e['offset']=qs['offset'](_0xf8c7d1['query'][_0x5d8c('0x1b')]);}_0xc93f9e['order']=qs[_0x5d8c('0x36')](_0xf8c7d1['query'][_0x5d8c('0x36')]);_0xc93f9e['where']=qs[_0x5d8c('0x30')](_[_0x5d8c('0x37')](_0xf8c7d1[_0x5d8c('0x2e')],_0xeda0f1[_0x5d8c('0x30')]),_0x158770);if(_0xf8c7d1[_0x5d8c('0x2e')][_0x5d8c('0x38')]){_0xc93f9e['where']=_[_0x5d8c('0x39')](_0xc93f9e[_0x5d8c('0x3a')],{'$or':_[_0x5d8c('0x2d')](_0x158770,function(_0xd9551d){if(_0xd9551d['type']!==_0x5d8c('0x3b')){var _0x16c4d9={};_0x16c4d9[_0xd9551d[_0x5d8c('0x26')]]={'$like':'%'+_0xf8c7d1[_0x5d8c('0x2e')][_0x5d8c('0x38')]+'%'};return _0x16c4d9;}})});}_0xc93f9e=_[_0x5d8c('0x39')]({},_0xc93f9e,_0xf8c7d1[_0x5d8c('0x3c')]);var _0x503b82={'where':_0xc93f9e[_0x5d8c('0x3a')]};return db[_0x5d8c('0x28')][_0x5d8c('0x1c')](_0x503b82)[_0x5d8c('0x21')](function(_0x45816b){_0x162b75['count']=_0x45816b;if(_0xf8c7d1[_0x5d8c('0x2e')][_0x5d8c('0x3d')]){_0xc93f9e[_0x5d8c('0x3e')]=[{'all':!![]}];}return db[_0x5d8c('0x28')][_0x5d8c('0x3f')](_0xc93f9e);})[_0x5d8c('0x21')](function(_0x37d4d7){_0x162b75[_0x5d8c('0x40')]=_0x37d4d7;return _0x162b75;})[_0x5d8c('0x21')](respondWithFilteredResult(_0x24f776,_0xc93f9e))[_0x5d8c('0x41')](handleError(_0x24f776,null));};exports['show']=function(_0x2a8abe,_0x222e34){var _0x531553={'raw':!![],'where':{'id':_0x2a8abe[_0x5d8c('0x42')]['id']}},_0x5de939={};_0x5de939['model']=_[_0x5d8c('0x2f')](db['OpenchannelTransferReport']['rawAttributes']);_0x5de939['query']=_[_0x5d8c('0x2f')](_0x2a8abe[_0x5d8c('0x2e')]);_0x5de939[_0x5d8c('0x30')]=_[_0x5d8c('0x31')](_0x5de939[_0x5d8c('0x2c')],_0x5de939['query']);_0x531553[_0x5d8c('0x32')]=_[_0x5d8c('0x31')](_0x5de939[_0x5d8c('0x2c')],qs[_0x5d8c('0x33')](_0x2a8abe['query'][_0x5d8c('0x33')]));_0x531553[_0x5d8c('0x32')]=_0x531553[_0x5d8c('0x32')]['length']?_0x531553[_0x5d8c('0x32')]:_0x5de939[_0x5d8c('0x2c')];if(_0x2a8abe[_0x5d8c('0x2e')][_0x5d8c('0x3d')]){_0x531553[_0x5d8c('0x3e')]=[{'all':!![]}];}_0x531553=_[_0x5d8c('0x39')]({},_0x531553,_0x2a8abe[_0x5d8c('0x3c')]);return db[_0x5d8c('0x28')][_0x5d8c('0x43')](_0x531553)[_0x5d8c('0x21')](handleEntityNotFound(_0x222e34,null))[_0x5d8c('0x21')](respondWithResult(_0x222e34,null))['catch'](handleError(_0x222e34,null));};exports[_0x5d8c('0x44')]=function(_0x13a110,_0x458251){return db[_0x5d8c('0x28')]['create'](_0x13a110[_0x5d8c('0x45')],{})[_0x5d8c('0x21')](respondWithResult(_0x458251,0xc9))[_0x5d8c('0x41')](handleError(_0x458251,null));};exports[_0x5d8c('0x46')]=function(_0x383f33,_0x7966a3){if(_0x383f33[_0x5d8c('0x45')]['id']){delete _0x383f33[_0x5d8c('0x45')]['id'];}return db[_0x5d8c('0x28')][_0x5d8c('0x43')]({'where':{'id':_0x383f33[_0x5d8c('0x42')]['id']}})[_0x5d8c('0x21')](handleEntityNotFound(_0x7966a3,null))[_0x5d8c('0x21')](saveUpdates(_0x383f33[_0x5d8c('0x45')],null))[_0x5d8c('0x21')](respondWithResult(_0x7966a3,null))['catch'](handleError(_0x7966a3,null));};exports['destroy']=function(_0x241136,_0xce5ff8){return db[_0x5d8c('0x28')][_0x5d8c('0x43')]({'where':{'id':_0x241136[_0x5d8c('0x42')]['id']}})[_0x5d8c('0x21')](handleEntityNotFound(_0xce5ff8,null))[_0x5d8c('0x21')](removeEntity(_0xce5ff8,null))['catch'](handleError(_0xce5ff8,null));};exports['describe']=function(_0x46f5ce,_0xde88ac){return db[_0x5d8c('0x28')][_0x5d8c('0x47')]()[_0x5d8c('0x21')](respondWithResult(_0xde88ac,null))[_0x5d8c('0x41')](handleError(_0xde88ac,null));}; \ No newline at end of file +var _0x0844=['rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','end','status','json','undefined','limit','count','offset','Content-Range','save','update','then','sendStatus','name','send','index','map','OpenchannelTransferReport','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','destroy','describe','eml-format'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0844,0x1a9));var _0x4084=function(_0x3fe9d6,_0x5901d0){_0x3fe9d6=_0x3fe9d6-0x0;var _0x42f815=_0x0844[_0x3fe9d6];return _0x42f815;};'use strict';var emlformat=require(_0x4084('0x0'));var rimraf=require(_0x4084('0x1'));var zipdir=require(_0x4084('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4084('0x3'));var moment=require(_0x4084('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4084('0x5'));var util=require(_0x4084('0x6'));var path=require(_0x4084('0x7'));var sox=require('sox');var csv=require(_0x4084('0x8'));var ejs=require(_0x4084('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4084('0xa'));var toCsv=require(_0x4084('0x8'));var querystring=require('querystring');var Papa=require(_0x4084('0xb'));var Redis=require(_0x4084('0xc'));var authService=require(_0x4084('0xd'));var qs=require(_0x4084('0xe'));var as=require(_0x4084('0xf'));var hardwareService=require(_0x4084('0x10'));var logger=require(_0x4084('0x11'))(_0x4084('0x12'));var utils=require(_0x4084('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4084('0x14'))['db'];function respondWithStatusCode(_0x588955,_0x1f476b){_0x1f476b=_0x1f476b||0xcc;return function(_0x23f2de){if(_0x23f2de){return _0x588955['sendStatus'](_0x1f476b);}return _0x588955['status'](_0x1f476b)[_0x4084('0x15')]();};}function respondWithResult(_0x44b090,_0x2781bc){_0x2781bc=_0x2781bc||0xc8;return function(_0x4b3765){if(_0x4b3765){return _0x44b090[_0x4084('0x16')](_0x2781bc)[_0x4084('0x17')](_0x4b3765);}};}function respondWithFilteredResult(_0x5e06f7,_0x173c4f){return function(_0x27397a){if(_0x27397a){var _0x2512ce=typeof _0x173c4f['offset']===_0x4084('0x18')&&typeof _0x173c4f[_0x4084('0x19')]===_0x4084('0x18');var _0x28628b=_0x27397a[_0x4084('0x1a')];var _0x247871=_0x2512ce?0x0:_0x173c4f[_0x4084('0x1b')];var _0x1f6f89=_0x2512ce?_0x27397a[_0x4084('0x1a')]:_0x173c4f[_0x4084('0x1b')]+_0x173c4f[_0x4084('0x19')];var _0x47655d;if(_0x1f6f89>=_0x28628b){_0x1f6f89=_0x28628b;_0x47655d=0xc8;}else{_0x47655d=0xce;}_0x5e06f7[_0x4084('0x16')](_0x47655d);return _0x5e06f7['set'](_0x4084('0x1c'),_0x247871+'-'+_0x1f6f89+'/'+_0x28628b)[_0x4084('0x17')](_0x27397a);}return null;};}function patchUpdates(_0x2ef49a){return function(_0x4a65ed){try{jsonpatch['apply'](_0x4a65ed,_0x2ef49a,!![]);}catch(_0x1fc2ea){return BPromise['reject'](_0x1fc2ea);}return _0x4a65ed[_0x4084('0x1d')]();};}function saveUpdates(_0x2356e1,_0x1244ef){return function(_0x3504df){if(_0x3504df){return _0x3504df[_0x4084('0x1e')](_0x2356e1)[_0x4084('0x1f')](function(_0x10b9f2){return _0x10b9f2;});}return null;};}function removeEntity(_0x3f02b2,_0x4e2da2){return function(_0x57a1cc){if(_0x57a1cc){return _0x57a1cc['destroy']()[_0x4084('0x1f')](function(){_0x3f02b2[_0x4084('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b59ed,_0x29a4e6){return function(_0x195986){if(!_0x195986){_0x5b59ed[_0x4084('0x20')](0x194);}return _0x195986;};}function handleError(_0x26f209,_0x56b035){_0x56b035=_0x56b035||0x1f4;return function(_0x3b3321){logger['error'](_0x3b3321['stack']);if(_0x3b3321['name']){delete _0x3b3321[_0x4084('0x21')];}_0x26f209[_0x4084('0x16')](_0x56b035)[_0x4084('0x22')](_0x3b3321);};}exports[_0x4084('0x23')]=function(_0x1aceda,_0x551862){var _0x400b51={},_0x1be3e2={},_0x2dd5cf={'count':0x0,'rows':[]};var _0x58bf4e=_[_0x4084('0x24')](db[_0x4084('0x25')]['rawAttributes'],function(_0x3511d7){return{'name':_0x3511d7[_0x4084('0x26')],'type':_0x3511d7['type'][_0x4084('0x27')]};});_0x1be3e2[_0x4084('0x28')]=_[_0x4084('0x24')](_0x58bf4e,'name');_0x1be3e2[_0x4084('0x29')]=_['keys'](_0x1aceda[_0x4084('0x29')]);_0x1be3e2[_0x4084('0x2a')]=_[_0x4084('0x2b')](_0x1be3e2[_0x4084('0x28')],_0x1be3e2[_0x4084('0x29')]);_0x400b51[_0x4084('0x2c')]=_['intersection'](_0x1be3e2['model'],qs[_0x4084('0x2d')](_0x1aceda[_0x4084('0x29')][_0x4084('0x2d')]));_0x400b51['attributes']=_0x400b51[_0x4084('0x2c')][_0x4084('0x2e')]?_0x400b51[_0x4084('0x2c')]:_0x1be3e2['model'];if(!_0x1aceda[_0x4084('0x29')][_0x4084('0x2f')](_0x4084('0x30'))){_0x400b51[_0x4084('0x19')]=qs[_0x4084('0x19')](_0x1aceda['query'][_0x4084('0x19')]);_0x400b51[_0x4084('0x1b')]=qs[_0x4084('0x1b')](_0x1aceda[_0x4084('0x29')][_0x4084('0x1b')]);}_0x400b51[_0x4084('0x31')]=qs[_0x4084('0x32')](_0x1aceda['query'][_0x4084('0x32')]);_0x400b51[_0x4084('0x33')]=qs['filters'](_['pick'](_0x1aceda['query'],_0x1be3e2[_0x4084('0x2a')]),_0x58bf4e);if(_0x1aceda[_0x4084('0x29')][_0x4084('0x34')]){_0x400b51[_0x4084('0x33')]=_[_0x4084('0x35')](_0x400b51[_0x4084('0x33')],{'$or':_[_0x4084('0x24')](_0x58bf4e,function(_0x1c375f){if(_0x1c375f[_0x4084('0x36')]!==_0x4084('0x37')){var _0x41cb45={};_0x41cb45[_0x1c375f[_0x4084('0x21')]]={'$like':'%'+_0x1aceda[_0x4084('0x29')][_0x4084('0x34')]+'%'};return _0x41cb45;}})});}_0x400b51=_[_0x4084('0x35')]({},_0x400b51,_0x1aceda[_0x4084('0x38')]);var _0x2600e6={'where':_0x400b51[_0x4084('0x33')]};return db[_0x4084('0x25')][_0x4084('0x1a')](_0x2600e6)[_0x4084('0x1f')](function(_0x355f5a){_0x2dd5cf[_0x4084('0x1a')]=_0x355f5a;if(_0x1aceda['query'][_0x4084('0x39')]){_0x400b51[_0x4084('0x3a')]=[{'all':!![]}];}return db[_0x4084('0x25')][_0x4084('0x3b')](_0x400b51);})[_0x4084('0x1f')](function(_0x185de0){_0x2dd5cf[_0x4084('0x3c')]=_0x185de0;return _0x2dd5cf;})[_0x4084('0x1f')](respondWithFilteredResult(_0x551862,_0x400b51))[_0x4084('0x3d')](handleError(_0x551862,null));};exports[_0x4084('0x3e')]=function(_0x37a809,_0x26ce76){var _0x916bc5={'raw':!![],'where':{'id':_0x37a809[_0x4084('0x3f')]['id']}},_0x382293={};_0x382293[_0x4084('0x28')]=_[_0x4084('0x40')](db[_0x4084('0x25')][_0x4084('0x41')]);_0x382293[_0x4084('0x29')]=_['keys'](_0x37a809['query']);_0x382293[_0x4084('0x2a')]=_[_0x4084('0x2b')](_0x382293[_0x4084('0x28')],_0x382293[_0x4084('0x29')]);_0x916bc5[_0x4084('0x2c')]=_[_0x4084('0x2b')](_0x382293[_0x4084('0x28')],qs[_0x4084('0x2d')](_0x37a809[_0x4084('0x29')][_0x4084('0x2d')]));_0x916bc5[_0x4084('0x2c')]=_0x916bc5[_0x4084('0x2c')][_0x4084('0x2e')]?_0x916bc5[_0x4084('0x2c')]:_0x382293[_0x4084('0x28')];if(_0x37a809[_0x4084('0x29')]['includeAll']){_0x916bc5[_0x4084('0x3a')]=[{'all':!![]}];}_0x916bc5=_[_0x4084('0x35')]({},_0x916bc5,_0x37a809[_0x4084('0x38')]);return db[_0x4084('0x25')][_0x4084('0x42')](_0x916bc5)['then'](handleEntityNotFound(_0x26ce76,null))[_0x4084('0x1f')](respondWithResult(_0x26ce76,null))['catch'](handleError(_0x26ce76,null));};exports[_0x4084('0x43')]=function(_0x3a4a06,_0x2580ed){return db[_0x4084('0x25')][_0x4084('0x43')](_0x3a4a06[_0x4084('0x44')],{})[_0x4084('0x1f')](respondWithResult(_0x2580ed,0xc9))[_0x4084('0x3d')](handleError(_0x2580ed,null));};exports[_0x4084('0x1e')]=function(_0x5c172d,_0x21c69f){if(_0x5c172d[_0x4084('0x44')]['id']){delete _0x5c172d[_0x4084('0x44')]['id'];}return db[_0x4084('0x25')][_0x4084('0x42')]({'where':{'id':_0x5c172d[_0x4084('0x3f')]['id']}})[_0x4084('0x1f')](handleEntityNotFound(_0x21c69f,null))[_0x4084('0x1f')](saveUpdates(_0x5c172d['body'],null))[_0x4084('0x1f')](respondWithResult(_0x21c69f,null))['catch'](handleError(_0x21c69f,null));};exports[_0x4084('0x45')]=function(_0x8f956,_0x240b26){return db[_0x4084('0x25')][_0x4084('0x42')]({'where':{'id':_0x8f956[_0x4084('0x3f')]['id']}})[_0x4084('0x1f')](handleEntityNotFound(_0x240b26,null))[_0x4084('0x1f')](removeEntity(_0x240b26,null))[_0x4084('0x3d')](handleError(_0x240b26,null));};exports[_0x4084('0x46')]=function(_0x3a255c,_0x1ea7b9){return db[_0x4084('0x25')][_0x4084('0x46')]()[_0x4084('0x1f')](respondWithResult(_0x1ea7b9,null))['catch'](handleError(_0x1ea7b9,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 3155cd2..d17dcad 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 _0x3006=['moment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','../../config/logger','api'];(function(_0x4a73f2,_0x352409){var _0x4190ee=function(_0x19603c){while(--_0x19603c){_0x4a73f2['push'](_0x4a73f2['shift']());}};_0x4190ee(++_0x352409);}(_0x3006,0x1bf));var _0x6300=function(_0x3773c0,_0x228151){_0x3773c0=_0x3773c0-0x0;var _0x424184=_0x3006[_0x3773c0];return _0x424184;};'use strict';var _=require(_0x6300('0x0'));var util=require('util');var logger=require(_0x6300('0x1'))(_0x6300('0x2'));var moment=require(_0x6300('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6300('0x4'));module[_0x6300('0x5')]=function(_0x1f06b3,_0x41777e){return _0x1f06b3[_0x6300('0x6')](_0x6300('0x7'),attributes,{'tableName':_0x6300('0x8'),'paranoid':![],'indexes':[{'name':_0x6300('0x9'),'fields':[_0x6300('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3fc0=['exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./openchannelTransferReport.attributes'];(function(_0x4287e1,_0x1efa19){var _0x167d70=function(_0x13a1a9){while(--_0x13a1a9){_0x4287e1['push'](_0x4287e1['shift']());}};_0x167d70(++_0x1efa19);}(_0x3fc0,0x130));var _0x03fc=function(_0x292f93,_0x2c6e8e){_0x292f93=_0x292f93-0x0;var _0x5a94b1=_0x3fc0[_0x292f93];return _0x5a94b1;};'use strict';var _=require(_0x03fc('0x0'));var util=require(_0x03fc('0x1'));var logger=require('../../config/logger')(_0x03fc('0x2'));var moment=require(_0x03fc('0x3'));var BPromise=require(_0x03fc('0x4'));var rp=require(_0x03fc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x03fc('0x6'));var attributes=require(_0x03fc('0x7'));module[_0x03fc('0x8')]=function(_0x159be6,_0x5c41ee){return _0x159be6['define'](_0x03fc('0x9'),attributes,{'tableName':_0x03fc('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x03fc('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 8ea4991..290588c 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 _0x4006=['moment','bluebird','randomstring','../../config/utils','rpc','client','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util'];(function(_0x1556cf,_0x6590e7){var _0x4f2b67=function(_0xb4310e){while(--_0xb4310e){_0x1556cf['push'](_0x1556cf['shift']());}};_0x4f2b67(++_0x6590e7);}(_0x4006,0x1c7));var _0x6400=function(_0x1264b8,_0x1f592c){_0x1264b8=_0x1264b8-0x0;var _0x4ceda7=_0x4006[_0x1264b8];return _0x4ceda7;};'use strict';var _=require('lodash');var util=require(_0x6400('0x0'));var moment=require(_0x6400('0x1'));var BPromise=require(_0x6400('0x2'));var rs=require(_0x6400('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6400('0x4'));var logger=require('../../config/logger')(_0x6400('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6400('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32c0db,_0x2d365b,_0x2bf4f8){return new BPromise(function(_0x250dba,_0x5cbe4f){return client[_0x6400('0x7')](_0x32c0db,_0x2bf4f8)[_0x6400('0x8')](function(_0x31a8d0){logger[_0x6400('0x9')](_0x6400('0xa'),_0x2d365b,_0x6400('0xb'));logger[_0x6400('0xc')](_0x6400('0xd'),_0x2d365b,_0x6400('0xb'),JSON[_0x6400('0xe')](_0x31a8d0));if(_0x31a8d0[_0x6400('0xf')]){if(_0x31a8d0['error'][_0x6400('0x10')]===0x1f4){logger[_0x6400('0xf')](_0x6400('0xa'),_0x2d365b,_0x31a8d0[_0x6400('0xf')]['message']);return _0x5cbe4f(_0x31a8d0[_0x6400('0xf')][_0x6400('0x11')]);}logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x2d365b,_0x31a8d0['error'][_0x6400('0x11')]);return _0x250dba(_0x31a8d0[_0x6400('0xf')]['message']);}else{logger[_0x6400('0x9')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2d365b,_0x6400('0xb'));_0x250dba(_0x31a8d0['result'][_0x6400('0x11')]);}})[_0x6400('0x12')](function(_0x276fb2){logger[_0x6400('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2d365b,_0x276fb2);_0x5cbe4f(_0x276fb2);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5596d6,_0xdd2ef4){var _0x5ba8f7=function(_0x524661){while(--_0x524661){_0x5596d6['push'](_0x5596d6['shift']());}};_0x5ba8f7(++_0xdd2ef4);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 6ff00c8..36a852e 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 _0xd7b2=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','get','show','post','create','put','/:id','update','destroy','exports','multer','util'];(function(_0x22405d,_0x543526){var _0x3636ef=function(_0x121939){while(--_0x121939){_0x22405d['push'](_0x22405d['shift']());}};_0x3636ef(++_0x543526);}(_0xd7b2,0x152));var _0x2d7b=function(_0x524f2b,_0x230050){_0x524f2b=_0x524f2b-0x0;var _0x3493bf=_0xd7b2[_0x524f2b];return _0x3493bf;};'use strict';var multer=require(_0x2d7b('0x0'));var util=require(_0x2d7b('0x1'));var path=require(_0x2d7b('0x2'));var timeout=require('connect-timeout');var express=require(_0x2d7b('0x3'));var router=express[_0x2d7b('0x4')]();var fs_extra=require(_0x2d7b('0x5'));var auth=require(_0x2d7b('0x6'));var interaction=require(_0x2d7b('0x7'));var config=require(_0x2d7b('0x8'));var controller=require(_0x2d7b('0x9'));router['get']('/',auth[_0x2d7b('0xa')](),controller['index']);router[_0x2d7b('0xb')]('/:id',auth[_0x2d7b('0xa')](),controller[_0x2d7b('0xc')]);router[_0x2d7b('0xd')]('/',auth[_0x2d7b('0xa')](),controller[_0x2d7b('0xe')]);router[_0x2d7b('0xf')](_0x2d7b('0x10'),auth['isAuthenticated'](),controller[_0x2d7b('0x11')]);router['delete']('/:id',auth[_0x2d7b('0xa')](),controller[_0x2d7b('0x12')]);module[_0x2d7b('0x13')]=router; \ No newline at end of file +var _0x39aa=['../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','post','create','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x5775f8,_0x2bf37c){var _0x3daee0=function(_0x293d30){while(--_0x293d30){_0x5775f8['push'](_0x5775f8['shift']());}};_0x3daee0(++_0x2bf37c);}(_0x39aa,0x11b));var _0xa39a=function(_0x4dc35f,_0x377c51){_0x4dc35f=_0x4dc35f-0x0;var _0x1f8820=_0x39aa[_0x4dc35f];return _0x1f8820;};'use strict';var multer=require(_0xa39a('0x0'));var util=require(_0xa39a('0x1'));var path=require('path');var timeout=require(_0xa39a('0x2'));var express=require(_0xa39a('0x3'));var router=express[_0xa39a('0x4')]();var fs_extra=require(_0xa39a('0x5'));var auth=require(_0xa39a('0x6'));var interaction=require(_0xa39a('0x7'));var config=require('../../config/environment');var controller=require('./pause.controller');router['get']('/',auth[_0xa39a('0x8')](),controller[_0xa39a('0x9')]);router[_0xa39a('0xa')](_0xa39a('0xb'),auth[_0xa39a('0x8')](),controller[_0xa39a('0xc')]);router[_0xa39a('0xd')]('/',auth['isAuthenticated'](),controller[_0xa39a('0xe')]);router['put']('/:id',auth[_0xa39a('0x8')](),controller['update']);router['delete'](_0xa39a('0xb'),auth[_0xa39a('0x8')](),controller[_0xa39a('0xf')]);module[_0xa39a('0x10')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index ac784b4..02c5fee 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 _0x666f=['name','sequelize','exports'];(function(_0xea35d1,_0x302471){var _0x1d7a7c=function(_0x1bc101){while(--_0x1bc101){_0xea35d1['push'](_0xea35d1['shift']());}};_0x1d7a7c(++_0x302471);}(_0x666f,0x85));var _0xf666=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x666f[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require(_0xf666('0x0'));module[_0xf666('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xf666('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa905=['STRING','name'];(function(_0x40ac63,_0x56d471){var _0x490adc=function(_0xb53ac7){while(--_0xb53ac7){_0x40ac63['push'](_0x40ac63['shift']());}};_0x490adc(++_0x56d471);}(_0xa905,0x104));var _0x5a90=function(_0x7d3462,_0x510bb2){_0x7d3462=_0x7d3462-0x0;var _0x35d6aa=_0xa905[_0x7d3462];return _0x35d6aa;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5a90('0x0')],'unique':_0x5a90('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x5a90('0x0')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 10f1c87..493dbbc 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 _0x6f67=['includeAll','include','findAll','rows','catch','params','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','Pauses','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','Pause'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x6f67,0xfe));var _0x76f6=function(_0x595619,_0x3b7ea6){_0x595619=_0x595619-0x0;var _0x30a1e4=_0x6f67[_0x595619];return _0x30a1e4;};'use strict';var emlformat=require(_0x76f6('0x0'));var rimraf=require(_0x76f6('0x1'));var zipdir=require(_0x76f6('0x2'));var jsonpatch=require(_0x76f6('0x3'));var rp=require('request-promise');var moment=require(_0x76f6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x76f6('0x5'));var path=require(_0x76f6('0x6'));var sox=require(_0x76f6('0x7'));var csv=require('to-csv');var ejs=require(_0x76f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x76f6('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x76f6('0xa'));var toCsv=require('to-csv');var querystring=require(_0x76f6('0xb'));var Papa=require(_0x76f6('0xc'));var Redis=require(_0x76f6('0xd'));var authService=require(_0x76f6('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x76f6('0xf'));var logger=require('../../config/logger')(_0x76f6('0x10'));var utils=require('../../config/utils');var config=require(_0x76f6('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x76f6('0x12'))['db'];function respondWithStatusCode(_0x72e09,_0xd2ec10){_0xd2ec10=_0xd2ec10||0xcc;return function(_0x30aa9b){if(_0x30aa9b){return _0x72e09[_0x76f6('0x13')](_0xd2ec10);}return _0x72e09['status'](_0xd2ec10)['end']();};}function respondWithResult(_0x4a1a28,_0x143ada){_0x143ada=_0x143ada||0xc8;return function(_0x1c8f59){if(_0x1c8f59){return _0x4a1a28[_0x76f6('0x14')](_0x143ada)[_0x76f6('0x15')](_0x1c8f59);}};}function respondWithFilteredResult(_0x25786c,_0x566bd3){return function(_0x3ec6be){if(_0x3ec6be){var _0x44590b=typeof _0x566bd3[_0x76f6('0x16')]===_0x76f6('0x17')&&typeof _0x566bd3[_0x76f6('0x18')]===_0x76f6('0x17');var _0x3a4c23=_0x3ec6be[_0x76f6('0x19')];var _0x1db6f8=_0x44590b?0x0:_0x566bd3[_0x76f6('0x16')];var _0x5cd389=_0x44590b?_0x3ec6be[_0x76f6('0x19')]:_0x566bd3[_0x76f6('0x16')]+_0x566bd3[_0x76f6('0x18')];var _0x5d993c;if(_0x5cd389>=_0x3a4c23){_0x5cd389=_0x3a4c23;_0x5d993c=0xc8;}else{_0x5d993c=0xce;}_0x25786c[_0x76f6('0x14')](_0x5d993c);return _0x25786c[_0x76f6('0x1a')](_0x76f6('0x1b'),_0x1db6f8+'-'+_0x5cd389+'/'+_0x3a4c23)[_0x76f6('0x15')](_0x3ec6be);}return null;};}function patchUpdates(_0x32fcab){return function(_0x297ef5){try{jsonpatch[_0x76f6('0x1c')](_0x297ef5,_0x32fcab,!![]);}catch(_0x125672){return BPromise[_0x76f6('0x1d')](_0x125672);}return _0x297ef5[_0x76f6('0x1e')]();};}function saveUpdates(_0x2ccd65,_0x421fad){return function(_0x111da2){if(_0x111da2){return _0x111da2[_0x76f6('0x1f')](_0x2ccd65)[_0x76f6('0x20')](function(_0x106acc){return _0x106acc;});}return null;};}function removeEntity(_0x14bcb9,_0x7d089f){return function(_0x20cadb){if(_0x20cadb){return _0x20cadb[_0x76f6('0x21')]()[_0x76f6('0x20')](function(){var _0x5c6046=_0x20cadb['get']({'plain':!![]});var _0x41e239=_0x76f6('0x22');return db[_0x76f6('0x23')][_0x76f6('0x21')]({'where':{'type':_0x41e239,'resourceId':_0x5c6046['id']}})['then'](function(){return _0x20cadb;});})[_0x76f6('0x20')](function(){_0x14bcb9[_0x76f6('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44c8ef,_0x482a4){return function(_0x4a7e23){if(!_0x4a7e23){_0x44c8ef[_0x76f6('0x13')](0x194);}return _0x4a7e23;};}function handleError(_0x19b819,_0x52a057){_0x52a057=_0x52a057||0x1f4;return function(_0x269a76){logger[_0x76f6('0x24')](_0x269a76[_0x76f6('0x25')]);if(_0x269a76[_0x76f6('0x26')]){delete _0x269a76[_0x76f6('0x26')];}_0x19b819[_0x76f6('0x14')](_0x52a057)[_0x76f6('0x27')](_0x269a76);};}exports[_0x76f6('0x28')]=function(_0x409d4b,_0x297b20){var _0x443317={},_0x435526={},_0x2b1382={'count':0x0,'rows':[]};var _0x5d2fa8=_[_0x76f6('0x29')](db['Pause'][_0x76f6('0x2a')],function(_0x5bc42e){return{'name':_0x5bc42e[_0x76f6('0x2b')],'type':_0x5bc42e[_0x76f6('0x2c')][_0x76f6('0x2d')]};});_0x435526[_0x76f6('0x2e')]=_[_0x76f6('0x29')](_0x5d2fa8,_0x76f6('0x26'));_0x435526[_0x76f6('0x2f')]=_[_0x76f6('0x30')](_0x409d4b[_0x76f6('0x2f')]);_0x435526[_0x76f6('0x31')]=_[_0x76f6('0x32')](_0x435526['model'],_0x435526[_0x76f6('0x2f')]);_0x443317[_0x76f6('0x33')]=_[_0x76f6('0x32')](_0x435526['model'],qs['fields'](_0x409d4b['query'][_0x76f6('0x34')]));_0x443317['attributes']=_0x443317[_0x76f6('0x33')][_0x76f6('0x35')]?_0x443317[_0x76f6('0x33')]:_0x435526[_0x76f6('0x2e')];if(!_0x409d4b[_0x76f6('0x2f')]['hasOwnProperty']('nolimit')){_0x443317[_0x76f6('0x18')]=qs['limit'](_0x409d4b[_0x76f6('0x2f')]['limit']);_0x443317[_0x76f6('0x16')]=qs[_0x76f6('0x16')](_0x409d4b['query'][_0x76f6('0x16')]);}_0x443317[_0x76f6('0x36')]=qs['sort'](_0x409d4b['query'][_0x76f6('0x37')]);_0x443317[_0x76f6('0x38')]=qs['filters'](_[_0x76f6('0x39')](_0x409d4b[_0x76f6('0x2f')],_0x435526[_0x76f6('0x31')]),_0x5d2fa8);if(_0x409d4b[_0x76f6('0x2f')][_0x76f6('0x3a')]){_0x443317['where']=_[_0x76f6('0x3b')](_0x443317[_0x76f6('0x38')],{'$or':_[_0x76f6('0x29')](_0x5d2fa8,function(_0x6c91de){if(_0x6c91de[_0x76f6('0x2c')]!==_0x76f6('0x3c')){var _0x43e08e={};_0x43e08e[_0x6c91de[_0x76f6('0x26')]]={'$like':'%'+_0x409d4b[_0x76f6('0x2f')][_0x76f6('0x3a')]+'%'};return _0x43e08e;}})});}_0x443317=_[_0x76f6('0x3b')]({},_0x443317,_0x409d4b['options']);var _0x2cf532={'where':_0x443317['where']};return db[_0x76f6('0x3d')][_0x76f6('0x19')](_0x2cf532)['then'](function(_0x3ec2ef){_0x2b1382['count']=_0x3ec2ef;if(_0x409d4b['query'][_0x76f6('0x3e')]){_0x443317[_0x76f6('0x3f')]=[{'all':!![]}];}return db[_0x76f6('0x3d')][_0x76f6('0x40')](_0x443317);})[_0x76f6('0x20')](function(_0x29694b){_0x2b1382[_0x76f6('0x41')]=_0x29694b;return _0x2b1382;})[_0x76f6('0x20')](respondWithFilteredResult(_0x297b20,_0x443317))[_0x76f6('0x42')](handleError(_0x297b20,null));};exports['show']=function(_0x55d7c5,_0x142a87){var _0x39e842={'raw':!![],'where':{'id':_0x55d7c5[_0x76f6('0x43')]['id']}},_0x3ccc53={};_0x3ccc53[_0x76f6('0x2e')]=_[_0x76f6('0x30')](db[_0x76f6('0x3d')][_0x76f6('0x2a')]);_0x3ccc53[_0x76f6('0x2f')]=_[_0x76f6('0x30')](_0x55d7c5['query']);_0x3ccc53[_0x76f6('0x31')]=_[_0x76f6('0x32')](_0x3ccc53['model'],_0x3ccc53[_0x76f6('0x2f')]);_0x39e842[_0x76f6('0x33')]=_['intersection'](_0x3ccc53['model'],qs[_0x76f6('0x34')](_0x55d7c5[_0x76f6('0x2f')][_0x76f6('0x34')]));_0x39e842[_0x76f6('0x33')]=_0x39e842[_0x76f6('0x33')][_0x76f6('0x35')]?_0x39e842[_0x76f6('0x33')]:_0x3ccc53[_0x76f6('0x2e')];if(_0x55d7c5['query'][_0x76f6('0x3e')]){_0x39e842[_0x76f6('0x3f')]=[{'all':!![]}];}_0x39e842=_[_0x76f6('0x3b')]({},_0x39e842,_0x55d7c5[_0x76f6('0x44')]);return db[_0x76f6('0x3d')][_0x76f6('0x45')](_0x39e842)['then'](handleEntityNotFound(_0x142a87,null))[_0x76f6('0x20')](respondWithResult(_0x142a87,null))[_0x76f6('0x42')](handleError(_0x142a87,null));};exports[_0x76f6('0x46')]=function(_0x1232ea,_0x53f4bc){return db['Pause'][_0x76f6('0x46')](_0x1232ea[_0x76f6('0x47')],{})['then'](function(_0x35a79a){var _0x40f394=_0x1232ea[_0x76f6('0x48')][_0x76f6('0x49')]({'plain':!![]});if(!_0x40f394)throw new Error(_0x76f6('0x4a'));if(_0x40f394[_0x76f6('0x4b')]===_0x76f6('0x48')){var _0x3ed792=_0x35a79a[_0x76f6('0x49')]({'plain':!![]});var _0x1fe650=_0x76f6('0x22');return db[_0x76f6('0x4c')][_0x76f6('0x45')]({'where':{'name':_0x1fe650,'userProfileId':_0x40f394[_0x76f6('0x4d')]},'raw':!![]})[_0x76f6('0x20')](function(_0xd566b2){if(_0xd566b2&&_0xd566b2[_0x76f6('0x4e')]===0x0){return db[_0x76f6('0x23')][_0x76f6('0x46')]({'name':_0x3ed792[_0x76f6('0x26')],'resourceId':_0x3ed792['id'],'type':_0xd566b2[_0x76f6('0x26')],'sectionId':_0xd566b2['id']},{})[_0x76f6('0x20')](function(){return _0x35a79a;});}else{return _0x35a79a;}})[_0x76f6('0x42')](function(_0x2b5716){logger[_0x76f6('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b5716);throw _0x2b5716;});}return _0x35a79a;})['then'](respondWithResult(_0x53f4bc,0xc9))['catch'](handleError(_0x53f4bc,null));};exports[_0x76f6('0x1f')]=function(_0xcaefb8,_0x171cd6){if(_0xcaefb8[_0x76f6('0x47')]['id']){delete _0xcaefb8[_0x76f6('0x47')]['id'];}return db[_0x76f6('0x3d')][_0x76f6('0x45')]({'where':{'id':_0xcaefb8[_0x76f6('0x43')]['id']}})[_0x76f6('0x20')](handleEntityNotFound(_0x171cd6,null))[_0x76f6('0x20')](saveUpdates(_0xcaefb8[_0x76f6('0x47')],null))['then'](respondWithResult(_0x171cd6,null))['catch'](handleError(_0x171cd6,null));};exports[_0x76f6('0x21')]=function(_0xd20bcd,_0x1de7dc){return db[_0x76f6('0x3d')][_0x76f6('0x45')]({'where':{'id':_0xd20bcd[_0x76f6('0x43')]['id']}})['then'](handleEntityNotFound(_0x1de7dc,null))[_0x76f6('0x20')](removeEntity(_0x1de7dc,null))[_0x76f6('0x42')](handleError(_0x1de7dc,null));}; \ No newline at end of file +var _0x2f57=['querystring','papaparse','ioredis','../../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','reject','then','destroy','Pauses','UserProfileResource','sendStatus','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x25ccbe,_0xc935c0){var _0x289529=function(_0x478776){while(--_0x478776){_0x25ccbe['push'](_0x25ccbe['shift']());}};_0x289529(++_0xc935c0);}(_0x2f57,0x97));var _0x72f5=function(_0x590580,_0x4b577d){_0x590580=_0x590580-0x0;var _0x3d0c7d=_0x2f57[_0x590580];return _0x3d0c7d;};'use strict';var emlformat=require(_0x72f5('0x0'));var rimraf=require(_0x72f5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x72f5('0x2'));var rp=require('request-promise');var moment=require(_0x72f5('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x72f5('0x4'));var util=require(_0x72f5('0x5'));var path=require(_0x72f5('0x6'));var sox=require('sox');var csv=require(_0x72f5('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x72f5('0x8'));var _=require(_0x72f5('0x9'));var squel=require(_0x72f5('0xa'));var crypto=require('crypto');var jsforce=require(_0x72f5('0xb'));var deskjs=require(_0x72f5('0xc'));var toCsv=require('to-csv');var querystring=require(_0x72f5('0xd'));var Papa=require(_0x72f5('0xe'));var Redis=require(_0x72f5('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x72f5('0x10'));var hardwareService=require(_0x72f5('0x11'));var logger=require(_0x72f5('0x12'))(_0x72f5('0x13'));var utils=require(_0x72f5('0x14'));var config=require(_0x72f5('0x15'));var licenseUtil=require(_0x72f5('0x16'));var db=require(_0x72f5('0x17'))['db'];function respondWithStatusCode(_0x5bda4b,_0x4fdf5d){_0x4fdf5d=_0x4fdf5d||0xcc;return function(_0x5ea462){if(_0x5ea462){return _0x5bda4b['sendStatus'](_0x4fdf5d);}return _0x5bda4b[_0x72f5('0x18')](_0x4fdf5d)[_0x72f5('0x19')]();};}function respondWithResult(_0x55b429,_0x125aa6){_0x125aa6=_0x125aa6||0xc8;return function(_0x446f5e){if(_0x446f5e){return _0x55b429['status'](_0x125aa6)[_0x72f5('0x1a')](_0x446f5e);}};}function respondWithFilteredResult(_0x1efda6,_0x1ead5e){return function(_0x198048){if(_0x198048){var _0xfb62d9=typeof _0x1ead5e[_0x72f5('0x1b')]===_0x72f5('0x1c')&&typeof _0x1ead5e[_0x72f5('0x1d')]==='undefined';var _0x1c3585=_0x198048[_0x72f5('0x1e')];var _0x288bf8=_0xfb62d9?0x0:_0x1ead5e[_0x72f5('0x1b')];var _0x27be63=_0xfb62d9?_0x198048[_0x72f5('0x1e')]:_0x1ead5e[_0x72f5('0x1b')]+_0x1ead5e[_0x72f5('0x1d')];var _0x48babe;if(_0x27be63>=_0x1c3585){_0x27be63=_0x1c3585;_0x48babe=0xc8;}else{_0x48babe=0xce;}_0x1efda6['status'](_0x48babe);return _0x1efda6[_0x72f5('0x1f')]('Content-Range',_0x288bf8+'-'+_0x27be63+'/'+_0x1c3585)[_0x72f5('0x1a')](_0x198048);}return null;};}function patchUpdates(_0x577c2f){return function(_0x643c32){try{jsonpatch['apply'](_0x643c32,_0x577c2f,!![]);}catch(_0x5b46ef){return BPromise[_0x72f5('0x20')](_0x5b46ef);}return _0x643c32['save']();};}function saveUpdates(_0x3c191a,_0x4dbb8a){return function(_0x1549f4){if(_0x1549f4){return _0x1549f4['update'](_0x3c191a)[_0x72f5('0x21')](function(_0xfc1391){return _0xfc1391;});}return null;};}function removeEntity(_0x1e5321,_0x20d089){return function(_0x2168ef){if(_0x2168ef){return _0x2168ef[_0x72f5('0x22')]()[_0x72f5('0x21')](function(){var _0x1d0e65=_0x2168ef['get']({'plain':!![]});var _0x170281=_0x72f5('0x23');return db[_0x72f5('0x24')]['destroy']({'where':{'type':_0x170281,'resourceId':_0x1d0e65['id']}})[_0x72f5('0x21')](function(){return _0x2168ef;});})[_0x72f5('0x21')](function(){_0x1e5321[_0x72f5('0x18')](0xcc)[_0x72f5('0x19')]();});}};}function handleEntityNotFound(_0x440619,_0xcea88f){return function(_0x784388){if(!_0x784388){_0x440619[_0x72f5('0x25')](0x194);}return _0x784388;};}function handleError(_0x118718,_0x21e851){_0x21e851=_0x21e851||0x1f4;return function(_0x1f904a){logger['error'](_0x1f904a[_0x72f5('0x26')]);if(_0x1f904a[_0x72f5('0x27')]){delete _0x1f904a[_0x72f5('0x27')];}_0x118718[_0x72f5('0x18')](_0x21e851)[_0x72f5('0x28')](_0x1f904a);};}exports[_0x72f5('0x29')]=function(_0x253ea1,_0x4707b7){var _0x3e4386={},_0x1084d3={},_0x3e5bae={'count':0x0,'rows':[]};var _0x1f8129=_[_0x72f5('0x2a')](db[_0x72f5('0x2b')][_0x72f5('0x2c')],function(_0x3aa7c4){return{'name':_0x3aa7c4[_0x72f5('0x2d')],'type':_0x3aa7c4[_0x72f5('0x2e')][_0x72f5('0x2f')]};});_0x1084d3[_0x72f5('0x30')]=_[_0x72f5('0x2a')](_0x1f8129,_0x72f5('0x27'));_0x1084d3[_0x72f5('0x31')]=_[_0x72f5('0x32')](_0x253ea1['query']);_0x1084d3[_0x72f5('0x33')]=_['intersection'](_0x1084d3[_0x72f5('0x30')],_0x1084d3['query']);_0x3e4386[_0x72f5('0x34')]=_[_0x72f5('0x35')](_0x1084d3['model'],qs[_0x72f5('0x36')](_0x253ea1[_0x72f5('0x31')][_0x72f5('0x36')]));_0x3e4386[_0x72f5('0x34')]=_0x3e4386[_0x72f5('0x34')][_0x72f5('0x37')]?_0x3e4386['attributes']:_0x1084d3[_0x72f5('0x30')];if(!_0x253ea1[_0x72f5('0x31')]['hasOwnProperty'](_0x72f5('0x38'))){_0x3e4386[_0x72f5('0x1d')]=qs[_0x72f5('0x1d')](_0x253ea1[_0x72f5('0x31')][_0x72f5('0x1d')]);_0x3e4386[_0x72f5('0x1b')]=qs['offset'](_0x253ea1[_0x72f5('0x31')][_0x72f5('0x1b')]);}_0x3e4386['order']=qs[_0x72f5('0x39')](_0x253ea1['query']['sort']);_0x3e4386[_0x72f5('0x3a')]=qs[_0x72f5('0x33')](_[_0x72f5('0x3b')](_0x253ea1[_0x72f5('0x31')],_0x1084d3[_0x72f5('0x33')]),_0x1f8129);if(_0x253ea1[_0x72f5('0x31')][_0x72f5('0x3c')]){_0x3e4386[_0x72f5('0x3a')]=_['merge'](_0x3e4386[_0x72f5('0x3a')],{'$or':_[_0x72f5('0x2a')](_0x1f8129,function(_0x396934){if(_0x396934[_0x72f5('0x2e')]!==_0x72f5('0x3d')){var _0x3a6fa0={};_0x3a6fa0[_0x396934[_0x72f5('0x27')]]={'$like':'%'+_0x253ea1[_0x72f5('0x31')][_0x72f5('0x3c')]+'%'};return _0x3a6fa0;}})});}_0x3e4386=_[_0x72f5('0x3e')]({},_0x3e4386,_0x253ea1[_0x72f5('0x3f')]);var _0xdd0e01={'where':_0x3e4386[_0x72f5('0x3a')]};return db[_0x72f5('0x2b')]['count'](_0xdd0e01)['then'](function(_0x567320){_0x3e5bae[_0x72f5('0x1e')]=_0x567320;if(_0x253ea1[_0x72f5('0x31')][_0x72f5('0x40')]){_0x3e4386[_0x72f5('0x41')]=[{'all':!![]}];}return db[_0x72f5('0x2b')]['findAll'](_0x3e4386);})[_0x72f5('0x21')](function(_0xc7a6b2){_0x3e5bae[_0x72f5('0x42')]=_0xc7a6b2;return _0x3e5bae;})[_0x72f5('0x21')](respondWithFilteredResult(_0x4707b7,_0x3e4386))[_0x72f5('0x43')](handleError(_0x4707b7,null));};exports[_0x72f5('0x44')]=function(_0x32d920,_0x3c0539){var _0x46a59b={'raw':!![],'where':{'id':_0x32d920[_0x72f5('0x45')]['id']}},_0x538fc2={};_0x538fc2[_0x72f5('0x30')]=_[_0x72f5('0x32')](db[_0x72f5('0x2b')][_0x72f5('0x2c')]);_0x538fc2[_0x72f5('0x31')]=_['keys'](_0x32d920[_0x72f5('0x31')]);_0x538fc2[_0x72f5('0x33')]=_[_0x72f5('0x35')](_0x538fc2['model'],_0x538fc2[_0x72f5('0x31')]);_0x46a59b[_0x72f5('0x34')]=_[_0x72f5('0x35')](_0x538fc2['model'],qs['fields'](_0x32d920[_0x72f5('0x31')][_0x72f5('0x36')]));_0x46a59b[_0x72f5('0x34')]=_0x46a59b[_0x72f5('0x34')][_0x72f5('0x37')]?_0x46a59b[_0x72f5('0x34')]:_0x538fc2[_0x72f5('0x30')];if(_0x32d920[_0x72f5('0x31')]['includeAll']){_0x46a59b[_0x72f5('0x41')]=[{'all':!![]}];}_0x46a59b=_[_0x72f5('0x3e')]({},_0x46a59b,_0x32d920[_0x72f5('0x3f')]);return db['Pause']['find'](_0x46a59b)['then'](handleEntityNotFound(_0x3c0539,null))[_0x72f5('0x21')](respondWithResult(_0x3c0539,null))[_0x72f5('0x43')](handleError(_0x3c0539,null));};exports[_0x72f5('0x46')]=function(_0x5a05cf,_0x3bd02e){return db['Pause']['create'](_0x5a05cf[_0x72f5('0x47')],{})[_0x72f5('0x21')](function(_0x1ee8a6){var _0x4a0c92=_0x5a05cf['user']['get']({'plain':!![]});if(!_0x4a0c92)throw new Error(_0x72f5('0x48'));if(_0x4a0c92[_0x72f5('0x49')]===_0x72f5('0x4a')){var _0x39b8fb=_0x1ee8a6[_0x72f5('0x4b')]({'plain':!![]});var _0x21fb83='Pauses';return db[_0x72f5('0x4c')][_0x72f5('0x4d')]({'where':{'name':_0x21fb83,'userProfileId':_0x4a0c92[_0x72f5('0x4e')]},'raw':!![]})[_0x72f5('0x21')](function(_0x538e8a){if(_0x538e8a&&_0x538e8a['autoAssociation']===0x0){return db[_0x72f5('0x24')]['create']({'name':_0x39b8fb[_0x72f5('0x27')],'resourceId':_0x39b8fb['id'],'type':_0x538e8a[_0x72f5('0x27')],'sectionId':_0x538e8a['id']},{})[_0x72f5('0x21')](function(){return _0x1ee8a6;});}else{return _0x1ee8a6;}})[_0x72f5('0x43')](function(_0x957372){logger[_0x72f5('0x4f')](_0x72f5('0x50'),_0x957372);throw _0x957372;});}return _0x1ee8a6;})[_0x72f5('0x21')](respondWithResult(_0x3bd02e,0xc9))[_0x72f5('0x43')](handleError(_0x3bd02e,null));};exports[_0x72f5('0x51')]=function(_0x1e6225,_0xfecbc4){if(_0x1e6225[_0x72f5('0x47')]['id']){delete _0x1e6225[_0x72f5('0x47')]['id'];}return db['Pause'][_0x72f5('0x4d')]({'where':{'id':_0x1e6225[_0x72f5('0x45')]['id']}})[_0x72f5('0x21')](handleEntityNotFound(_0xfecbc4,null))[_0x72f5('0x21')](saveUpdates(_0x1e6225[_0x72f5('0x47')],null))[_0x72f5('0x21')](respondWithResult(_0xfecbc4,null))[_0x72f5('0x43')](handleError(_0xfecbc4,null));};exports['destroy']=function(_0x755b67,_0x46c02a){return db[_0x72f5('0x2b')][_0x72f5('0x4d')]({'where':{'id':_0x755b67[_0x72f5('0x45')]['id']}})[_0x72f5('0x21')](handleEntityNotFound(_0x46c02a,null))[_0x72f5('0x21')](removeEntity(_0x46c02a,null))['catch'](handleError(_0x46c02a,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index dea41ed..9e6cef6 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 _0x6aa7=['Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x6aa7,0x178));var _0x76aa=function(_0x3ff2c2,_0x26b2c2){_0x3ff2c2=_0x3ff2c2-0x0;var _0x2b0979=_0x6aa7[_0x3ff2c2];return _0x2b0979;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var BPromise=require(_0x76aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76aa('0x5'));var rimraf=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1aceaa,_0x4d53f6){return _0x1aceaa[_0x76aa('0x8')](_0x76aa('0x9'),attributes,{'tableName':_0x76aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','tools_pauses','lodash'];(function(_0x25c132,_0x2ae9ae){var _0x5402cc=function(_0x5f3f47){while(--_0x5f3f47){_0x25c132['push'](_0x25c132['shift']());}};_0x5402cc(++_0x2ae9ae);}(_0xabce,0x103));var _0xeabc=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xabce[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('Pause',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 3d4d37d..9b6dcdc 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(_0x2b54c1,_0x54d47e){var _0x2a6176=function(_0x5b34d0){while(--_0x5b34d0){_0x2b54c1['push'](_0x2b54c1['shift']());}};_0x2a6176(++_0x54d47e);}(_0x7a54,0x106));var _0x47a5=function(_0x2bbe21,_0x226876){_0x2bbe21=_0x2bbe21-0x0;var _0x2fec34=_0x7a54[_0x2bbe21];return _0x2fec34;};'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(_0x479558,_0x12a54d){var _0x1bfab8=function(_0x290cc5){while(--_0x290cc5){_0x479558['push'](_0x479558['shift']());}};_0x1bfab8(++_0x12a54d);}(_0x7a54,0x106));var _0x47a5=function(_0x3dca04,_0x4df4bc){_0x3dca04=_0x3dca04-0x0;var _0x3e7572=_0x7a54[_0x3dca04];return _0x3e7572;};'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 540f0a4..88e7556 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 _0x9f62=['extname','now','post','single','file','upload','put','/:id','delete','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','/webhook','webhookGet','/:id/download','isAuthenticated','join','root','originalname','replace','format','%s-%s%s','basename'];(function(_0x3c9e18,_0x171376){var _0x1b0ec6=function(_0x11e30b){while(--_0x11e30b){_0x3c9e18['push'](_0x3c9e18['shift']());}};_0x1b0ec6(++_0x171376);}(_0x9f62,0x154));var _0x29f6=function(_0x301318,_0x4a95e8){_0x301318=_0x301318-0x0;var _0x70d103=_0x9f62[_0x301318];return _0x70d103;};'use strict';var multer=require('multer');var util=require(_0x29f6('0x0'));var path=require('path');var timeout=require(_0x29f6('0x1'));var express=require(_0x29f6('0x2'));var router=express[_0x29f6('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var controller=require(_0x29f6('0x6'));router[_0x29f6('0x7')]('/',auth['isAuthenticated'](),controller[_0x29f6('0x8')]);router[_0x29f6('0x7')](_0x29f6('0x9'),controller[_0x29f6('0xa')]);router[_0x29f6('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x29f6('0xb'),auth[_0x29f6('0xc')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x29b3f5,_0x442623,_0x4909e0){_0x4909e0(null,path[_0x29f6('0xd')](config[_0x29f6('0xe')],'server/files/plugins'));},'filename':function(_0x5b9b6a,_0x559585,_0x57b2d2){_0x559585[_0x29f6('0xf')]=_0x559585[_0x29f6('0xf')][_0x29f6('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x57b2d2(null,util[_0x29f6('0x11')](_0x29f6('0x12'),path[_0x29f6('0x13')](_0x559585[_0x29f6('0xf')],path[_0x29f6('0x14')](_0x559585[_0x29f6('0xf')])),Date[_0x29f6('0x15')](),path[_0x29f6('0x14')](_0x559585[_0x29f6('0xf')])));}})});router[_0x29f6('0x16')]('/',upload[_0x29f6('0x17')](_0x29f6('0x18')),controller[_0x29f6('0x19')]);router[_0x29f6('0x16')]('/webhook',controller['webhookPost']);router[_0x29f6('0x1a')](_0x29f6('0x1b'),auth[_0x29f6('0xc')](),controller['update']);router[_0x29f6('0x1c')](_0x29f6('0x1b'),auth['isAuthenticated'](),controller[_0x29f6('0x1c')]);module[_0x29f6('0x1d')]=router; \ No newline at end of file +var _0x9f62=['extname','now','post','single','file','upload','put','/:id','delete','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','/webhook','webhookGet','/:id/download','isAuthenticated','join','root','originalname','replace','format','%s-%s%s','basename'];(function(_0x2c984e,_0x1b76b3){var _0x2df6f9=function(_0x1cd4d6){while(--_0x1cd4d6){_0x2c984e['push'](_0x2c984e['shift']());}};_0x2df6f9(++_0x1b76b3);}(_0x9f62,0x154));var _0x29f6=function(_0x248338,_0x14dfc1){_0x248338=_0x248338-0x0;var _0x3f4ab0=_0x9f62[_0x248338];return _0x3f4ab0;};'use strict';var multer=require('multer');var util=require(_0x29f6('0x0'));var path=require('path');var timeout=require(_0x29f6('0x1'));var express=require(_0x29f6('0x2'));var router=express[_0x29f6('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var controller=require(_0x29f6('0x6'));router[_0x29f6('0x7')]('/',auth['isAuthenticated'](),controller[_0x29f6('0x8')]);router[_0x29f6('0x7')](_0x29f6('0x9'),controller[_0x29f6('0xa')]);router[_0x29f6('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x29f6('0xb'),auth[_0x29f6('0xc')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x29b3f5,_0x442623,_0x4909e0){_0x4909e0(null,path[_0x29f6('0xd')](config[_0x29f6('0xe')],'server/files/plugins'));},'filename':function(_0x5b9b6a,_0x559585,_0x57b2d2){_0x559585[_0x29f6('0xf')]=_0x559585[_0x29f6('0xf')][_0x29f6('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x57b2d2(null,util[_0x29f6('0x11')](_0x29f6('0x12'),path[_0x29f6('0x13')](_0x559585[_0x29f6('0xf')],path[_0x29f6('0x14')](_0x559585[_0x29f6('0xf')])),Date[_0x29f6('0x15')](),path[_0x29f6('0x14')](_0x559585[_0x29f6('0xf')])));}})});router[_0x29f6('0x16')]('/',upload[_0x29f6('0x17')](_0x29f6('0x18')),controller[_0x29f6('0x19')]);router[_0x29f6('0x16')]('/webhook',controller['webhookPost']);router[_0x29f6('0x1a')](_0x29f6('0x1b'),auth[_0x29f6('0xc')](),controller['update']);router[_0x29f6('0x1c')](_0x29f6('0x1b'),auth['isAuthenticated'](),controller[_0x29f6('0x1c')]);module[_0x29f6('0x1d')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 224349e..c8682b2 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 _0xfbec=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always','never'];(function(_0x5cd1ee,_0x2488d6){var _0x3b63d1=function(_0x5ab880){while(--_0x5ab880){_0x5cd1ee['push'](_0x5cd1ee['shift']());}};_0x3b63d1(++_0x2488d6);}(_0xfbec,0x90));var _0xcfbe=function(_0x41fd8a,_0x51a69e){_0x41fd8a=_0x41fd8a-0x0;var _0x35c435=_0xfbec[_0x41fd8a];return _0x35c435;};'use strict';var Sequelize=require('sequelize');module[_0xcfbe('0x0')]={'name':{'type':Sequelize[_0xcfbe('0x1')]},'type':{'type':Sequelize[_0xcfbe('0x2')](_0xcfbe('0x3'),'script')},'description':{'type':Sequelize[_0xcfbe('0x4')]},'version':{'type':Sequelize[_0xcfbe('0x4')]},'path':{'type':Sequelize[_0xcfbe('0x1')],'comment':_0xcfbe('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xcfbe('0x6')},'sidebar':{'type':Sequelize[_0xcfbe('0x2')]('adminOnly',_0xcfbe('0x7'),_0xcfbe('0x8'),_0xcfbe('0x9')),'defaultValue':'always','comment':_0xcfbe('0xa')},'icon':{'type':Sequelize[_0xcfbe('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xcfbe('0x1')]}}; \ No newline at end of file +var _0x956f=['sequelize','exports','STRING','html','script','TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x3828df,_0x453607){var _0x132d03=function(_0x188a61){while(--_0x188a61){_0x3828df['push'](_0x3828df['shift']());}};_0x132d03(++_0x453607);}(_0x956f,0x198));var _0xf956=function(_0x29bfbe,_0x37060a){_0x29bfbe=_0x29bfbe-0x0;var _0x230663=_0x956f[_0x29bfbe];return _0x230663;};'use strict';var Sequelize=require(_0xf956('0x0'));module[_0xf956('0x1')]={'name':{'type':Sequelize[_0xf956('0x2')]},'type':{'type':Sequelize['ENUM'](_0xf956('0x3'),_0xf956('0x4'))},'description':{'type':Sequelize[_0xf956('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xf956('0x2')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0xf956('0x6')],'defaultValue':0x0,'comment':_0xf956('0x7')},'sidebar':{'type':Sequelize[_0xf956('0x8')]('adminOnly','agentOnly',_0xf956('0x9'),_0xf956('0xa')),'defaultValue':_0xf956('0x9'),'comment':_0xf956('0xb')},'icon':{'type':Sequelize[_0xf956('0x2')]},'adminUrl':{'type':Sequelize[_0xf956('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xf956('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 3f20adb..1c6fd72 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 _0xd7b5=['views','Invalid\x20manifest:\x20views\x20missing','admin','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','sidebar','always','icon','icon-apps','html','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','script','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','body','webhookPost','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','end','offset','limit','count','status','set','Content-Range','json','reject','save','update','then','destroy','get','Plugins','UserProfileResource','sendStatus','error','stack','name','send','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','Plugin','includeAll','findAll','rows','show','length','catch','download','find','params','join','server/files/plugins','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','Error','pipe','glob','**/*','dirname','attachments/**/*','finalize','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','upload','extname','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','undefined','Invalid\x20manifest:\x20name\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing'];(function(_0x325e52,_0x428df9){var _0x5dcf19=function(_0x2ee7e0){while(--_0x2ee7e0){_0x325e52['push'](_0x325e52['shift']());}};_0x5dcf19(++_0x428df9);}(_0xd7b5,0x182));var _0x5d7b=function(_0x2265c1,_0x154ab1){_0x2265c1=_0x2265c1-0x0;var _0x9b0f1e=_0xd7b5[_0x2265c1];return _0x9b0f1e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5d7b('0x0'));var zipdir=require(_0x5d7b('0x1'));var jsonpatch=require(_0x5d7b('0x2'));var rp=require(_0x5d7b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5d7b('0x4'));var util=require(_0x5d7b('0x5'));var path=require(_0x5d7b('0x6'));var sox=require(_0x5d7b('0x7'));var csv=require(_0x5d7b('0x8'));var ejs=require(_0x5d7b('0x9'));var fs=require('fs');var fs_extra=require(_0x5d7b('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5d7b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5d7b('0xc'));var toCsv=require(_0x5d7b('0x8'));var querystring=require('querystring');var Papa=require(_0x5d7b('0xd'));var extract=require(_0x5d7b('0xe'));var rimraf=require(_0x5d7b('0x0'));var archiver=require('archiver');var Redis=require(_0x5d7b('0xf'));var authService=require(_0x5d7b('0x10'));var qs=require(_0x5d7b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5d7b('0x12'));var logger=require('../../config/logger')(_0x5d7b('0x13'));var utils=require(_0x5d7b('0x14'));var config=require(_0x5d7b('0x15'));var licenseUtil=require(_0x5d7b('0x16'));var db=require(_0x5d7b('0x17'))['db'];config['redis']=_['defaults'](config[_0x5d7b('0x18')],{'host':_0x5d7b('0x19'),'port':0x18eb});var socket=require(_0x5d7b('0x1a'))(new Redis(config[_0x5d7b('0x18')]));require('./plugin.socket')[_0x5d7b('0x1b')](socket);function respondWithStatusCode(_0x202c10,_0x471692){_0x471692=_0x471692||0xcc;return function(_0x24981c){if(_0x24981c){return _0x202c10['sendStatus'](_0x471692);}return _0x202c10['status'](_0x471692)[_0x5d7b('0x1c')]();};}function respondWithResult(_0x4c8b2d,_0x2faa31){_0x2faa31=_0x2faa31||0xc8;return function(_0x147524){if(_0x147524){return _0x4c8b2d['status'](_0x2faa31)['json'](_0x147524);}};}function respondWithFilteredResult(_0x4e04ec,_0x166ad9){return function(_0x38ce69){if(_0x38ce69){var _0x5e051b=typeof _0x166ad9[_0x5d7b('0x1d')]==='undefined'&&typeof _0x166ad9[_0x5d7b('0x1e')]==='undefined';var _0x966bc3=_0x38ce69[_0x5d7b('0x1f')];var _0x195d9b=_0x5e051b?0x0:_0x166ad9[_0x5d7b('0x1d')];var _0x33d31b=_0x5e051b?_0x38ce69['count']:_0x166ad9[_0x5d7b('0x1d')]+_0x166ad9[_0x5d7b('0x1e')];var _0x389585;if(_0x33d31b>=_0x966bc3){_0x33d31b=_0x966bc3;_0x389585=0xc8;}else{_0x389585=0xce;}_0x4e04ec[_0x5d7b('0x20')](_0x389585);return _0x4e04ec[_0x5d7b('0x21')](_0x5d7b('0x22'),_0x195d9b+'-'+_0x33d31b+'/'+_0x966bc3)[_0x5d7b('0x23')](_0x38ce69);}return null;};}function patchUpdates(_0x4d3110){return function(_0x43939b){try{jsonpatch['apply'](_0x43939b,_0x4d3110,!![]);}catch(_0x209f31){return BPromise[_0x5d7b('0x24')](_0x209f31);}return _0x43939b[_0x5d7b('0x25')]();};}function saveUpdates(_0x319f68,_0x7ae019){return function(_0x1ee1ac){if(_0x1ee1ac){return _0x1ee1ac[_0x5d7b('0x26')](_0x319f68)[_0x5d7b('0x27')](function(_0x288005){return _0x288005;});}return null;};}function removeEntity(_0x21d940,_0x5bfa93){return function(_0xbe4a0d){if(_0xbe4a0d){return _0xbe4a0d[_0x5d7b('0x28')]()[_0x5d7b('0x27')](function(){var _0x42d6c2=_0xbe4a0d[_0x5d7b('0x29')]({'plain':!![]});var _0x20cddb=_0x5d7b('0x2a');return db[_0x5d7b('0x2b')][_0x5d7b('0x28')]({'where':{'type':_0x20cddb,'resourceId':_0x42d6c2['id']}})[_0x5d7b('0x27')](function(){return _0xbe4a0d;});})[_0x5d7b('0x27')](function(){_0x21d940['status'](0xcc)[_0x5d7b('0x1c')]();});}};}function handleEntityNotFound(_0x518488,_0x20be61){return function(_0x2d601d){if(!_0x2d601d){_0x518488[_0x5d7b('0x2c')](0x194);}return _0x2d601d;};}function handleError(_0x5c2394,_0x5c3fd0){_0x5c3fd0=_0x5c3fd0||0x1f4;return function(_0x31d3e0){logger[_0x5d7b('0x2d')](_0x31d3e0[_0x5d7b('0x2e')]);if(_0x31d3e0['name']){delete _0x31d3e0[_0x5d7b('0x2f')];}_0x5c2394[_0x5d7b('0x20')](_0x5c3fd0)[_0x5d7b('0x30')](_0x31d3e0);};}exports['index']=function(_0x1c5c6c,_0x141b0e){var _0xdb6176={},_0x287ed1={},_0x33b91f={'count':0x0,'rows':[]};var _0x5d9b71=_['map'](db['Plugin'][_0x5d7b('0x31')],function(_0x25f15a){return{'name':_0x25f15a['fieldName'],'type':_0x25f15a[_0x5d7b('0x32')][_0x5d7b('0x33')]};});_0x287ed1[_0x5d7b('0x34')]=_[_0x5d7b('0x35')](_0x5d9b71,_0x5d7b('0x2f'));_0x287ed1['query']=_[_0x5d7b('0x36')](_0x1c5c6c[_0x5d7b('0x37')]);_0x287ed1[_0x5d7b('0x38')]=_[_0x5d7b('0x39')](_0x287ed1[_0x5d7b('0x34')],_0x287ed1[_0x5d7b('0x37')]);_0xdb6176[_0x5d7b('0x3a')]=_['intersection'](_0x287ed1[_0x5d7b('0x34')],qs[_0x5d7b('0x3b')](_0x1c5c6c[_0x5d7b('0x37')][_0x5d7b('0x3b')]));_0xdb6176[_0x5d7b('0x3a')]=_0xdb6176[_0x5d7b('0x3a')]['length']?_0xdb6176[_0x5d7b('0x3a')]:_0x287ed1[_0x5d7b('0x34')];if(!_0x1c5c6c['query'][_0x5d7b('0x3c')](_0x5d7b('0x3d'))){_0xdb6176[_0x5d7b('0x1e')]=qs['limit'](_0x1c5c6c[_0x5d7b('0x37')][_0x5d7b('0x1e')]);_0xdb6176[_0x5d7b('0x1d')]=qs[_0x5d7b('0x1d')](_0x1c5c6c[_0x5d7b('0x37')][_0x5d7b('0x1d')]);}_0xdb6176[_0x5d7b('0x3e')]=qs[_0x5d7b('0x3f')](_0x1c5c6c[_0x5d7b('0x37')][_0x5d7b('0x3f')]);_0xdb6176['where']=qs[_0x5d7b('0x38')](_[_0x5d7b('0x40')](_0x1c5c6c[_0x5d7b('0x37')],_0x287ed1['filters']),_0x5d9b71);if(_0x1c5c6c[_0x5d7b('0x37')][_0x5d7b('0x41')]){_0xdb6176['where']=_[_0x5d7b('0x42')](_0xdb6176[_0x5d7b('0x43')],{'$or':_[_0x5d7b('0x35')](_0x5d9b71,function(_0x326410){if(_0x326410[_0x5d7b('0x32')]!==_0x5d7b('0x44')){var _0x1eb42a={};_0x1eb42a[_0x326410['name']]={'$like':'%'+_0x1c5c6c[_0x5d7b('0x37')][_0x5d7b('0x41')]+'%'};return _0x1eb42a;}})});}_0xdb6176=_['merge']({},_0xdb6176,_0x1c5c6c[_0x5d7b('0x45')]);var _0x20e36e={'where':_0xdb6176[_0x5d7b('0x43')]};return db[_0x5d7b('0x46')][_0x5d7b('0x1f')](_0x20e36e)[_0x5d7b('0x27')](function(_0x56f9c4){_0x33b91f[_0x5d7b('0x1f')]=_0x56f9c4;if(_0x1c5c6c[_0x5d7b('0x37')][_0x5d7b('0x47')]){_0xdb6176['include']=[{'all':!![]}];}return db[_0x5d7b('0x46')][_0x5d7b('0x48')](_0xdb6176);})[_0x5d7b('0x27')](function(_0x3574b7){_0x33b91f[_0x5d7b('0x49')]=_0x3574b7;return _0x33b91f;})['then'](respondWithFilteredResult(_0x141b0e,_0xdb6176))['catch'](handleError(_0x141b0e,null));};exports[_0x5d7b('0x4a')]=function(_0x58835e,_0x84d2d5){var _0x5157c8={'raw':!![],'where':{'id':_0x58835e['params']['id']}},_0xda9fdf={};_0xda9fdf['model']=_['keys'](db[_0x5d7b('0x46')][_0x5d7b('0x31')]);_0xda9fdf['query']=_[_0x5d7b('0x36')](_0x58835e['query']);_0xda9fdf[_0x5d7b('0x38')]=_[_0x5d7b('0x39')](_0xda9fdf['model'],_0xda9fdf[_0x5d7b('0x37')]);_0x5157c8['attributes']=_[_0x5d7b('0x39')](_0xda9fdf['model'],qs[_0x5d7b('0x3b')](_0x58835e[_0x5d7b('0x37')][_0x5d7b('0x3b')]));_0x5157c8[_0x5d7b('0x3a')]=_0x5157c8[_0x5d7b('0x3a')][_0x5d7b('0x4b')]?_0x5157c8[_0x5d7b('0x3a')]:_0xda9fdf['model'];if(_0x58835e[_0x5d7b('0x37')]['includeAll']){_0x5157c8['include']=[{'all':!![]}];}_0x5157c8=_[_0x5d7b('0x42')]({},_0x5157c8,_0x58835e['options']);return db[_0x5d7b('0x46')]['find'](_0x5157c8)[_0x5d7b('0x27')](handleEntityNotFound(_0x84d2d5,null))[_0x5d7b('0x27')](respondWithResult(_0x84d2d5,null))[_0x5d7b('0x4c')](handleError(_0x84d2d5,null));};exports[_0x5d7b('0x4d')]=function(_0x42620d,_0x27ee34,_0x3ec95b){return db[_0x5d7b('0x46')][_0x5d7b('0x4e')]({'where':{'id':_0x42620d[_0x5d7b('0x4f')]['id']},'attributes':[_0x5d7b('0x2f'),_0x5d7b('0x6')],'raw':!![]})['then'](handleEntityNotFound(_0x27ee34,null))[_0x5d7b('0x27')](function(_0x6fafd0){if(_0x6fafd0){var _0x50afaf=path[_0x5d7b('0x50')](config['root'],_0x5d7b('0x51'),util['format'](_0x5d7b('0x52'),path[_0x5d7b('0x53')](_0x6fafd0[_0x5d7b('0x6')])));var _0x5e783c=fs[_0x5d7b('0x54')](_0x50afaf);var _0x5b5a12=archiver(_0x5d7b('0x55'),{'zlib':{'level':0x9}});_0x5b5a12['on'](_0x5d7b('0x56'),function(_0x48cb65){if(_0x48cb65[_0x5d7b('0x57')]===_0x5d7b('0x58')){logger[_0x5d7b('0x2d')](_0x48cb65);}else{throw new db['Sequelize']['Error'](_0x5d7b('0x59'));}});_0x5b5a12['on'](_0x5d7b('0x2d'),function(_0x421625){throw new db[(_0x5d7b('0x5a'))][(_0x5d7b('0x5b'))](_0x5d7b('0x59'));});_0x5b5a12[_0x5d7b('0x5c')](_0x5e783c);_0x5b5a12[_0x5d7b('0x5d')](_0x5d7b('0x5e'),{'cwd':path[_0x5d7b('0x50')](config['root'],_0x5d7b('0x51'),path[_0x5d7b('0x5f')](_0x6fafd0[_0x5d7b('0x6')])),'ignore':[path[_0x5d7b('0x50')](path[_0x5d7b('0x53')](_0x6fafd0['path']),'node_modules/**/*'),path[_0x5d7b('0x50')](path[_0x5d7b('0x53')](_0x6fafd0[_0x5d7b('0x6')]),_0x5d7b('0x60'))],'nodir':!![]})[_0x5d7b('0x61')]();_0x5e783c['on']('close',function(){if(!fs['existsSync'](_0x50afaf)){throw new db[(_0x5d7b('0x5a'))]['Error'](_0x5d7b('0x62'));}return _0x27ee34[_0x5d7b('0x4d')](_0x50afaf,util[_0x5d7b('0x63')]('%s.zip',path[_0x5d7b('0x53')](_0x6fafd0[_0x5d7b('0x6')])),function(_0x13670d){if(_0x13670d){throw new db[(_0x5d7b('0x5a'))][(_0x5d7b('0x5b'))](_0x5d7b('0x64'));}fs[_0x5d7b('0x65')](_0x50afaf);logger[_0x5d7b('0x66')]('Download\x20completed');logger[_0x5d7b('0x66')](_0x5d7b('0x67'));});});}return null;})[_0x5d7b('0x4c')](handleError(_0x27ee34,null));};exports[_0x5d7b('0x68')]=function(_0x4cb7f4,_0x428850,_0x33bd6f){var _0x4a264d=path[_0x5d7b('0x53')](_0x4cb7f4['file']['filename'],path[_0x5d7b('0x69')](_0x4cb7f4[_0x5d7b('0x6a')][_0x5d7b('0x6b')]));var _0x16feee=path['join'](config['root'],_0x5d7b('0x51'),_0x4cb7f4[_0x5d7b('0x6a')][_0x5d7b('0x6b')]);var _0x58f8aa=path[_0x5d7b('0x50')](config['root'],_0x5d7b('0x51'),_0x4a264d);logger[_0x5d7b('0x66')](_0x5d7b('0x6c'),_0x16feee);logger['info'](_0x5d7b('0x6d'),_0x58f8aa);try{fs[_0x5d7b('0x6e')](_0x16feee,parseInt('0777',0x8));extract(_0x16feee,{'dir':_0x58f8aa},function(_0x4d381f){if(_0x4d381f){logger[_0x5d7b('0x2d')](_0x4d381f);handleError(_0x4d381f,!![]);};var _0x30adf6=fs[_0x5d7b('0x6f')](_0x58f8aa);if(_0x30adf6[_0x5d7b('0x4b')]>0x1){removeReferences(_0x16feee,_0x58f8aa);logger[_0x5d7b('0x2d')]('Invalid\x20plugin\x20structure');return _0x33bd6f(new Error(_0x5d7b('0x70')));}var _0x5ac6f1=fs[_0x5d7b('0x71')](path[_0x5d7b('0x50')](_0x58f8aa,_0x30adf6[0x0]));if(_0x5ac6f1[_0x5d7b('0x72')]()){removeReferences(_0x16feee,_0x58f8aa);logger[_0x5d7b('0x2d')](_0x5d7b('0x70'));return _0x33bd6f(new Error(_0x5d7b('0x70')));}if(_0x5ac6f1[_0x5d7b('0x73')]()){var _0x2b9283=fs[_0x5d7b('0x6f')](path[_0x5d7b('0x50')](_0x58f8aa,_0x30adf6[0x0]));if(_0x2b9283[_0x5d7b('0x4b')]===0x0){removeReferences(_0x16feee,_0x58f8aa);logger[_0x5d7b('0x2d')]('Invalid\x20plugin\x20structure');return _0x33bd6f(new Error(_0x5d7b('0x70')));}var _0x24752d=_0x2b9283[_0x5d7b('0x74')](function(_0x40e464){return _0x40e464===_0x5d7b('0x75');});if(!_0x24752d){return _0x33bd6f(new Error(_0x5d7b('0x76')));}var _0x1ab796=fs['readFileSync'](path[_0x5d7b('0x50')](_0x58f8aa,_0x30adf6[0x0],'manifest.json'));var _0x275688=JSON['parse'](_0x1ab796);if(_0x5d7b('0x77')==typeof _0x275688[_0x5d7b('0x2f')]){return _0x33bd6f(new Error(_0x5d7b('0x78')));}if('undefined'==typeof _0x275688[_0x5d7b('0x32')]){return _0x33bd6f(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x5d7b('0x77')==typeof _0x275688[_0x5d7b('0x79')]){return _0x33bd6f(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x275688[_0x5d7b('0x7a')]){return _0x33bd6f(new Error(_0x5d7b('0x7b')));}if(_0x275688[_0x5d7b('0x32')]==='html'){if(_0x5d7b('0x77')==typeof _0x275688['parameters'][_0x5d7b('0x7c')]){return _0x33bd6f(new Error(_0x5d7b('0x7d')));}if(_0x5d7b('0x77')==typeof _0x275688[_0x5d7b('0x7a')][_0x5d7b('0x7c')][_0x5d7b('0x7e')]&&_0x5d7b('0x77')==typeof _0x275688[_0x5d7b('0x7a')][_0x5d7b('0x7c')]['agent']){return _0x33bd6f(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x275688['type']==='script'){if('undefined'==typeof _0x275688['parameters'][_0x5d7b('0x7f')]){return _0x33bd6f(new Error(_0x5d7b('0x80')));}if(_0x5d7b('0x77')==typeof _0x275688[_0x5d7b('0x7a')][_0x5d7b('0x81')]){return _0x33bd6f(new Error(_0x5d7b('0x82')));}}else{return _0x33bd6f(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x22815f=_0x275688[_0x5d7b('0x2f')];var _0x3c2050=_0x275688['description'];var _0x3b9420=_0x275688[_0x5d7b('0x32')];var _0x2bfe88=_0x275688[_0x5d7b('0x83')]?_0x275688[_0x5d7b('0x83')]:_0x5d7b('0x84');var _0x2c3f8d=_0x275688[_0x5d7b('0x85')]?_0x275688[_0x5d7b('0x85')]:_0x5d7b('0x86');var _0x9c28d2='';var _0x53d409='';var _0x44deca='';var _0x5620e0='';var _0x3a0ba1=_0x275688[_0x5d7b('0x79')];if(_0x3b9420===_0x5d7b('0x87')){if('undefined'!=typeof _0x275688[_0x5d7b('0x7a')]['views'][_0x5d7b('0x7e')]){var _0x4bf905=_0x275688[_0x5d7b('0x7a')]['views'][_0x5d7b('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x5d7b('0x88')](_0x4bf905)){_0x9c28d2=path[_0x5d7b('0x50')](_0x5d7b('0x89'),_0x4a264d,_0x30adf6[0x0],_0x4bf905);}else{_0x9c28d2=_0x4bf905;}}else{logger[_0x5d7b('0x66')](_0x5d7b('0x8a'));}if('undefined'!=typeof _0x275688[_0x5d7b('0x7a')][_0x5d7b('0x7c')][_0x5d7b('0x8b')]){var _0x3178a2=_0x275688['parameters'][_0x5d7b('0x7c')][_0x5d7b('0x8b')];if(!/^(f|ht)tps?:\/\//i[_0x5d7b('0x88')](_0x3178a2)){_0x53d409=path[_0x5d7b('0x50')]('plugins',_0x4a264d,_0x30adf6[0x0],_0x3178a2);}else{_0x53d409=_0x3178a2;}}else{logger[_0x5d7b('0x66')](_0x5d7b('0x8c'));}}else if(_0x3b9420===_0x5d7b('0x8d')){_0x44deca=_0x275688[_0x5d7b('0x7a')][_0x5d7b('0x7f')];_0x5620e0=_0x275688[_0x5d7b('0x7a')][_0x5d7b('0x81')];if('undefined'!=typeof _0x275688[_0x5d7b('0x7a')][_0x5d7b('0x7c')]){if(_0x5d7b('0x77')!=typeof _0x275688['parameters']['views']['admin']){var _0x4bf905=_0x275688[_0x5d7b('0x7a')][_0x5d7b('0x7c')][_0x5d7b('0x7e')];if(!/^(f|ht)tps?:\/\//i['test'](_0x4bf905)){_0x9c28d2=path[_0x5d7b('0x50')]('plugins',_0x4a264d,_0x30adf6[0x0],_0x4bf905);}else{_0x9c28d2=_0x4bf905;}}if(_0x5d7b('0x77')!=typeof _0x275688[_0x5d7b('0x7a')][_0x5d7b('0x7c')]['agent']){var _0x3178a2=_0x275688[_0x5d7b('0x7a')]['views'][_0x5d7b('0x8b')];if(!/^(f|ht)tps?:\/\//i[_0x5d7b('0x88')](_0x3178a2)){_0x53d409=path[_0x5d7b('0x50')](_0x5d7b('0x89'),_0x4a264d,_0x30adf6[0x0],_0x3178a2);}else{_0x53d409=_0x3178a2;}}}}var _0x116ba5={'name':_0x22815f,'description':_0x3c2050,'path':path[_0x5d7b('0x50')](_0x4a264d,_0x30adf6[0x0]),'type':_0x3b9420,'sidebar':_0x2bfe88,'icon':_0x2c3f8d,'adminUrl':_0x9c28d2,'agentUrl':_0x53d409,'scriptName':_0x44deca,'scriptPath':_0x5620e0,'version':_0x3a0ba1};removeReferences(_0x16feee,null);return db[_0x5d7b('0x46')]['create'](_0x116ba5)[_0x5d7b('0x27')](function(_0x48e5db){var _0x251d9a={'role':_0x4cb7f4['body']['role'],'userProfileId':_0x4cb7f4['body'][_0x5d7b('0x8e')]};if(!_0x251d9a)throw new Error(_0x5d7b('0x8f'));if(_0x251d9a[_0x5d7b('0x90')]===_0x5d7b('0x91')){var _0x3e5649=_0x48e5db[_0x5d7b('0x29')]({'plain':!![]});return db[_0x5d7b('0x92')][_0x5d7b('0x4e')]({'where':{'name':'Plugins','userProfileId':_0x251d9a['userProfileId']},'raw':!![]})[_0x5d7b('0x27')](function(_0x3460bb){if(_0x3460bb&&_0x3460bb[_0x5d7b('0x93')]===0x0){return db[_0x5d7b('0x2b')][_0x5d7b('0x94')]({'name':_0x3e5649['name'],'resourceId':_0x3e5649['id'],'type':_0x3460bb[_0x5d7b('0x2f')],'sectionId':_0x3460bb['id']},{})[_0x5d7b('0x27')](function(){return _0x48e5db;});}else{return _0x48e5db;}})[_0x5d7b('0x4c')](function(_0x335893){logger[_0x5d7b('0x2d')](_0x5d7b('0x95'),_0x335893);throw _0x335893;});}return _0x48e5db;})[_0x5d7b('0x27')](respondWithResult(_0x428850,null))[_0x5d7b('0x4c')](handleError(_0x428850,null));}});}catch(_0x539afa){_0x428850['status'](0x1f4)[_0x5d7b('0x30')](_0x539afa);}};function removeReferences(_0x38c586,_0x5da458){try{if(_0x38c586){fs[_0x5d7b('0x65')](_0x38c586);logger[_0x5d7b('0x66')](_0x5d7b('0x96'));}if(_0x5da458){rimraf(_0x5da458,function(){});logger[_0x5d7b('0x66')](_0x5d7b('0x97'));}}catch(_0x162ceb){logger['error'](_0x162ceb);}}exports['update']=function(_0x462952,_0x2ba976,_0x166c93){return db[_0x5d7b('0x46')][_0x5d7b('0x4e')]({'where':{'id':_0x462952[_0x5d7b('0x4f')]['id']}})[_0x5d7b('0x27')](handleEntityNotFound(_0x2ba976,null))['then'](saveUpdates(_0x462952['body'],null))[_0x5d7b('0x27')](respondWithResult(_0x2ba976,null))[_0x5d7b('0x4c')](handleError(_0x2ba976,null));};exports[_0x5d7b('0x98')]=function(_0xf694bb,_0x45b6d2,_0x33b8ca){return db[_0x5d7b('0x46')][_0x5d7b('0x4e')]({'where':{'id':_0xf694bb[_0x5d7b('0x4f')]['id']}})[_0x5d7b('0x27')](function(_0x4e9223){if(_0x4e9223){return _0x4e9223['destroy']();}})[_0x5d7b('0x27')](function(_0x5dbcf4){rimraf(path['join'](config['root'],_0x5d7b('0x51'),path[_0x5d7b('0x5f')](_0x5dbcf4[_0x5d7b('0x6')])),function(){});return _0x5dbcf4;})[_0x5d7b('0x27')](handleEntityNotFound(_0x45b6d2,null))[_0x5d7b('0x27')](respondWithStatusCode(_0x45b6d2,null))[_0x5d7b('0x4c')](handleError(_0x45b6d2,null));};exports[_0x5d7b('0x99')]=function(_0x2adcc0,_0x30fc4f,_0x587245){return BPromise[_0x5d7b('0x9a')]()[_0x5d7b('0x27')](function(){if(!_0x2adcc0[_0x5d7b('0x37')][_0x5d7b('0x6')]){throw new Error(_0x5d7b('0x9b'));}if(!_0x2adcc0['query'][_0x5d7b('0x9c')]){throw new Error(_0x5d7b('0x9d'));}var _0x50430c=_0x2adcc0[_0x5d7b('0x37')][_0x5d7b('0x9e')]?_0x2adcc0[_0x5d7b('0x37')][_0x5d7b('0x9e')]+':'+_0x2adcc0[_0x5d7b('0x37')][_0x5d7b('0x9c')]:_0x5d7b('0x9f')+_0x2adcc0[_0x5d7b('0x37')][_0x5d7b('0x9c')];var _0x2622d2=_0x2adcc0[_0x5d7b('0x37')]['json']?_0x2adcc0[_0x5d7b('0x37')]['json']:!![];var _0x38c258=_0x2adcc0['query']['encoding']?_0x2adcc0['query'][_0x5d7b('0xa0')]:null;var _0x1000ae={'method':_0x2adcc0[_0x5d7b('0xa1')],'uri':util[_0x5d7b('0x63')](_0x5d7b('0xa2'),_0x50430c,_0x2adcc0['query'][_0x5d7b('0x6')]),'json':_0x2622d2,'resolveWithFullResponse':!![],'encoding':_0x38c258,'qs':_0x2adcc0[_0x5d7b('0x37')]};if(_0x2adcc0[_0x5d7b('0xa3')]){_0x1000ae[_0x5d7b('0xa3')]=_0x2adcc0[_0x5d7b('0xa3')];if(_0x1000ae[_0x5d7b('0xa3')][_0x5d7b('0xa4')]){delete _0x1000ae['headers']['content-length'];}}if(_0x1000ae[_0x5d7b('0xa3')][_0x5d7b('0xa5')]){delete _0x1000ae[_0x5d7b('0xa3')][_0x5d7b('0xa5')];}return rp(_0x1000ae);})[_0x5d7b('0x27')](function(_0x5946ba){if(_0x5946ba){_0x30fc4f[_0x5d7b('0x21')](_0x5946ba[_0x5d7b('0xa3')]);logger[_0x5d7b('0x66')](_0x5946ba['body']);if(_[_0x5d7b('0xa6')](_0x2adcc0[_0x5d7b('0x37')]['path'],_0x5d7b('0x4d'))&&_0x5946ba[_0x5d7b('0xa7')]==0x1f4){return _0x30fc4f['sendStatus'](_0x5946ba[_0x5d7b('0xa7')]);}else{return _0x30fc4f['status'](_0x5946ba[_0x5d7b('0xa7')])['send'](_0x5946ba[_0x5d7b('0xa8')]);}}else{return _0x30fc4f[_0x5d7b('0x2c')](0xc8);}})['catch'](handleError(_0x30fc4f,null));};exports[_0x5d7b('0xa9')]=function(_0x4cfc10,_0x479645,_0x5602f4){return BPromise[_0x5d7b('0x9a')]()[_0x5d7b('0x27')](function(){if(!_0x4cfc10[_0x5d7b('0x37')][_0x5d7b('0x6')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x4cfc10[_0x5d7b('0x37')][_0x5d7b('0x9c')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x48e2cb=_0x4cfc10[_0x5d7b('0x37')][_0x5d7b('0x9e')]?_0x4cfc10[_0x5d7b('0x37')]['hostname']+':'+_0x4cfc10['query'][_0x5d7b('0x9c')]:'http://localhost:'+_0x4cfc10['query'][_0x5d7b('0x9c')];var _0x49fe54=_0x4cfc10[_0x5d7b('0x37')][_0x5d7b('0x23')]?_0x4cfc10[_0x5d7b('0x37')][_0x5d7b('0x23')]:!![];var _0x147526=_0x4cfc10[_0x5d7b('0x37')][_0x5d7b('0xa0')]?_0x4cfc10[_0x5d7b('0x37')][_0x5d7b('0xa0')]:null;var _0x4a6e3c={'method':_0x4cfc10['method'],'uri':util[_0x5d7b('0x63')](_0x5d7b('0xa2'),_0x48e2cb,_0x4cfc10[_0x5d7b('0x37')][_0x5d7b('0x6')]),'json':_0x49fe54,'resolveWithFullResponse':!![],'encoding':_0x147526,'body':_0x4cfc10[_0x5d7b('0xa8')]};if(_0x4cfc10[_0x5d7b('0xa3')]){_0x4a6e3c[_0x5d7b('0xa3')]=_0x4cfc10[_0x5d7b('0xa3')];if(_0x4a6e3c[_0x5d7b('0xa3')]['content-length']){delete _0x4a6e3c[_0x5d7b('0xa3')][_0x5d7b('0xa4')];}}if(_0x4a6e3c[_0x5d7b('0xa3')][_0x5d7b('0xa5')]){delete _0x4a6e3c[_0x5d7b('0xa3')][_0x5d7b('0xa5')];}return rp(_0x4a6e3c);})[_0x5d7b('0x27')](function(_0x4f21b8){if(_0x4f21b8){_0x479645['set'](_0x4f21b8[_0x5d7b('0xa3')]);logger[_0x5d7b('0x66')](_0x4f21b8[_0x5d7b('0xa8')]);return _0x479645['status'](_0x4f21b8[_0x5d7b('0xa7')])['send'](_0x4f21b8['body']);}else{return _0x479645['sendStatus'](0xc8);}})[_0x5d7b('0x4c')](handleError(_0x479645,null));}; \ No newline at end of file +var _0x283c=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','delete','webhookGet','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','port','encoding','%s%s','headers','content-length','content-type','set','statusCode','sendStatus','webhookPost','method','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','extract-zip','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./plugin.socket','register','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','destroy','get','Plugins','UserProfileResource','end','error','stack','name','send','index','Plugin','fieldName','model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','intersection','length','find','download','params','join','server/files/plugins','%s.zip','basename','path','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','root','node_modules/**/*','finalize','close','existsSync','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','Invalid\x20plugin\x20structure','readdirSync','manifest.json','Plugin\x20manifest\x20missing','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','type','html','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','version','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','test','create','body','role','userProfileId','user'];(function(_0x15273f,_0x477c31){var _0x44ccfa=function(_0xbbdb5a){while(--_0xbbdb5a){_0x15273f['push'](_0x15273f['shift']());}};_0x44ccfa(++_0x477c31);}(_0x283c,0xb8));var _0xc283=function(_0x27fd8e,_0x15ea6b){_0x27fd8e=_0x27fd8e-0x0;var _0x4dec48=_0x283c[_0x27fd8e];return _0x4dec48;};'use strict';var emlformat=require(_0xc283('0x0'));var rimraf=require(_0xc283('0x1'));var zipdir=require(_0xc283('0x2'));var jsonpatch=require(_0xc283('0x3'));var rp=require(_0xc283('0x4'));var moment=require('moment');var BPromise=require(_0xc283('0x5'));var Mustache=require(_0xc283('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc283('0x7'));var squel=require(_0xc283('0x8'));var crypto=require(_0xc283('0x9'));var jsforce=require(_0xc283('0xa'));var deskjs=require(_0xc283('0xb'));var toCsv=require(_0xc283('0xc'));var querystring=require(_0xc283('0xd'));var Papa=require(_0xc283('0xe'));var extract=require(_0xc283('0xf'));var rimraf=require(_0xc283('0x1'));var archiver=require(_0xc283('0x10'));var Redis=require(_0xc283('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc283('0x12'));var as=require(_0xc283('0x13'));var hardwareService=require(_0xc283('0x14'));var logger=require(_0xc283('0x15'))(_0xc283('0x16'));var utils=require(_0xc283('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc283('0x18'));var db=require('../../mysqldb')['db'];config[_0xc283('0x19')]=_['defaults'](config['redis'],{'host':_0xc283('0x1a'),'port':0x18eb});var socket=require(_0xc283('0x1b'))(new Redis(config[_0xc283('0x19')]));require(_0xc283('0x1c'))[_0xc283('0x1d')](socket);function respondWithStatusCode(_0x3cd46b,_0x566509){_0x566509=_0x566509||0xcc;return function(_0x450574){if(_0x450574){return _0x3cd46b['sendStatus'](_0x566509);}return _0x3cd46b[_0xc283('0x1e')](_0x566509)['end']();};}function respondWithResult(_0xcba5df,_0xabdd4a){_0xabdd4a=_0xabdd4a||0xc8;return function(_0x2fbb9e){if(_0x2fbb9e){return _0xcba5df[_0xc283('0x1e')](_0xabdd4a)['json'](_0x2fbb9e);}};}function respondWithFilteredResult(_0x22bf1,_0x1972b2){return function(_0x4fe17a){if(_0x4fe17a){var _0x1c5bc8=typeof _0x1972b2[_0xc283('0x1f')]===_0xc283('0x20')&&typeof _0x1972b2[_0xc283('0x21')]==='undefined';var _0x368199=_0x4fe17a[_0xc283('0x22')];var _0x43490f=_0x1c5bc8?0x0:_0x1972b2[_0xc283('0x1f')];var _0x196b48=_0x1c5bc8?_0x4fe17a[_0xc283('0x22')]:_0x1972b2[_0xc283('0x1f')]+_0x1972b2[_0xc283('0x21')];var _0x34e207;if(_0x196b48>=_0x368199){_0x196b48=_0x368199;_0x34e207=0xc8;}else{_0x34e207=0xce;}_0x22bf1[_0xc283('0x1e')](_0x34e207);return _0x22bf1['set'](_0xc283('0x23'),_0x43490f+'-'+_0x196b48+'/'+_0x368199)[_0xc283('0x24')](_0x4fe17a);}return null;};}function patchUpdates(_0x29384d){return function(_0x4df117){try{jsonpatch[_0xc283('0x25')](_0x4df117,_0x29384d,!![]);}catch(_0x53b065){return BPromise[_0xc283('0x26')](_0x53b065);}return _0x4df117[_0xc283('0x27')]();};}function saveUpdates(_0x124047,_0xd2dd8){return function(_0x32bd72){if(_0x32bd72){return _0x32bd72['update'](_0x124047)[_0xc283('0x28')](function(_0x326683){return _0x326683;});}return null;};}function removeEntity(_0x2761cf,_0x5e771a){return function(_0x325075){if(_0x325075){return _0x325075[_0xc283('0x29')]()[_0xc283('0x28')](function(){var _0x5ee2e3=_0x325075[_0xc283('0x2a')]({'plain':!![]});var _0x507fed=_0xc283('0x2b');return db[_0xc283('0x2c')]['destroy']({'where':{'type':_0x507fed,'resourceId':_0x5ee2e3['id']}})[_0xc283('0x28')](function(){return _0x325075;});})['then'](function(){_0x2761cf['status'](0xcc)[_0xc283('0x2d')]();});}};}function handleEntityNotFound(_0x521a4c,_0x2be6bb){return function(_0x6e52b7){if(!_0x6e52b7){_0x521a4c['sendStatus'](0x194);}return _0x6e52b7;};}function handleError(_0x44d492,_0x140d30){_0x140d30=_0x140d30||0x1f4;return function(_0x6e41b9){logger[_0xc283('0x2e')](_0x6e41b9[_0xc283('0x2f')]);if(_0x6e41b9[_0xc283('0x30')]){delete _0x6e41b9[_0xc283('0x30')];}_0x44d492['status'](_0x140d30)[_0xc283('0x31')](_0x6e41b9);};}exports[_0xc283('0x32')]=function(_0x58bdd3,_0x745511){var _0x44fd45={},_0x4fdab8={},_0x550bf5={'count':0x0,'rows':[]};var _0x462635=_['map'](db[_0xc283('0x33')]['rawAttributes'],function(_0x2f3b1e){return{'name':_0x2f3b1e[_0xc283('0x34')],'type':_0x2f3b1e['type']['key']};});_0x4fdab8[_0xc283('0x35')]=_[_0xc283('0x36')](_0x462635,_0xc283('0x30'));_0x4fdab8[_0xc283('0x37')]=_[_0xc283('0x38')](_0x58bdd3[_0xc283('0x37')]);_0x4fdab8[_0xc283('0x39')]=_['intersection'](_0x4fdab8[_0xc283('0x35')],_0x4fdab8[_0xc283('0x37')]);_0x44fd45[_0xc283('0x3a')]=_['intersection'](_0x4fdab8[_0xc283('0x35')],qs['fields'](_0x58bdd3['query'][_0xc283('0x3b')]));_0x44fd45[_0xc283('0x3a')]=_0x44fd45[_0xc283('0x3a')]['length']?_0x44fd45[_0xc283('0x3a')]:_0x4fdab8['model'];if(!_0x58bdd3[_0xc283('0x37')][_0xc283('0x3c')](_0xc283('0x3d'))){_0x44fd45[_0xc283('0x21')]=qs['limit'](_0x58bdd3[_0xc283('0x37')]['limit']);_0x44fd45[_0xc283('0x1f')]=qs['offset'](_0x58bdd3[_0xc283('0x37')]['offset']);}_0x44fd45[_0xc283('0x3e')]=qs[_0xc283('0x3f')](_0x58bdd3[_0xc283('0x37')]['sort']);_0x44fd45[_0xc283('0x40')]=qs[_0xc283('0x39')](_[_0xc283('0x41')](_0x58bdd3[_0xc283('0x37')],_0x4fdab8[_0xc283('0x39')]),_0x462635);if(_0x58bdd3[_0xc283('0x37')]['filter']){_0x44fd45[_0xc283('0x40')]=_[_0xc283('0x42')](_0x44fd45[_0xc283('0x40')],{'$or':_[_0xc283('0x36')](_0x462635,function(_0x20657e){if(_0x20657e['type']!==_0xc283('0x43')){var _0x172de8={};_0x172de8[_0x20657e[_0xc283('0x30')]]={'$like':'%'+_0x58bdd3['query'][_0xc283('0x44')]+'%'};return _0x172de8;}})});}_0x44fd45=_[_0xc283('0x42')]({},_0x44fd45,_0x58bdd3[_0xc283('0x45')]);var _0x1f3af5={'where':_0x44fd45[_0xc283('0x40')]};return db[_0xc283('0x33')]['count'](_0x1f3af5)['then'](function(_0x1d4967){_0x550bf5['count']=_0x1d4967;if(_0x58bdd3[_0xc283('0x37')][_0xc283('0x46')]){_0x44fd45[_0xc283('0x47')]=[{'all':!![]}];}return db['Plugin'][_0xc283('0x48')](_0x44fd45);})['then'](function(_0x576b8d){_0x550bf5['rows']=_0x576b8d;return _0x550bf5;})[_0xc283('0x28')](respondWithFilteredResult(_0x745511,_0x44fd45))[_0xc283('0x49')](handleError(_0x745511,null));};exports[_0xc283('0x4a')]=function(_0x4c0d02,_0x273edc){var _0x58c60c={'raw':!![],'where':{'id':_0x4c0d02['params']['id']}},_0xcc57af={};_0xcc57af[_0xc283('0x35')]=_['keys'](db['Plugin']['rawAttributes']);_0xcc57af[_0xc283('0x37')]=_[_0xc283('0x38')](_0x4c0d02[_0xc283('0x37')]);_0xcc57af[_0xc283('0x39')]=_[_0xc283('0x4b')](_0xcc57af['model'],_0xcc57af[_0xc283('0x37')]);_0x58c60c['attributes']=_[_0xc283('0x4b')](_0xcc57af[_0xc283('0x35')],qs[_0xc283('0x3b')](_0x4c0d02[_0xc283('0x37')]['fields']));_0x58c60c[_0xc283('0x3a')]=_0x58c60c[_0xc283('0x3a')][_0xc283('0x4c')]?_0x58c60c[_0xc283('0x3a')]:_0xcc57af[_0xc283('0x35')];if(_0x4c0d02[_0xc283('0x37')]['includeAll']){_0x58c60c[_0xc283('0x47')]=[{'all':!![]}];}_0x58c60c=_[_0xc283('0x42')]({},_0x58c60c,_0x4c0d02[_0xc283('0x45')]);return db[_0xc283('0x33')][_0xc283('0x4d')](_0x58c60c)['then'](handleEntityNotFound(_0x273edc,null))[_0xc283('0x28')](respondWithResult(_0x273edc,null))['catch'](handleError(_0x273edc,null));};exports[_0xc283('0x4e')]=function(_0x33109b,_0x92db17,_0x868200){return db[_0xc283('0x33')][_0xc283('0x4d')]({'where':{'id':_0x33109b[_0xc283('0x4f')]['id']},'attributes':['name','path'],'raw':!![]})[_0xc283('0x28')](handleEntityNotFound(_0x92db17,null))[_0xc283('0x28')](function(_0x1d0167){if(_0x1d0167){var _0x26ab65=path[_0xc283('0x50')](config['root'],_0xc283('0x51'),util['format'](_0xc283('0x52'),path[_0xc283('0x53')](_0x1d0167[_0xc283('0x54')])));var _0x2ba948=fs[_0xc283('0x55')](_0x26ab65);var _0x3ea9e8=archiver(_0xc283('0x56'),{'zlib':{'level':0x9}});_0x3ea9e8['on'](_0xc283('0x57'),function(_0xef7d22){if(_0xef7d22[_0xc283('0x58')]===_0xc283('0x59')){logger[_0xc283('0x2e')](_0xef7d22);}else{throw new db[(_0xc283('0x5a'))][(_0xc283('0x5b'))](_0xc283('0x5c'));}});_0x3ea9e8['on'](_0xc283('0x2e'),function(_0xe49900){throw new db[(_0xc283('0x5a'))][(_0xc283('0x5b'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x3ea9e8[_0xc283('0x5d')](_0x2ba948);_0x3ea9e8[_0xc283('0x5e')](_0xc283('0x5f'),{'cwd':path['join'](config[_0xc283('0x60')],_0xc283('0x51'),path['dirname'](_0x1d0167[_0xc283('0x54')])),'ignore':[path[_0xc283('0x50')](path[_0xc283('0x53')](_0x1d0167['path']),_0xc283('0x61')),path[_0xc283('0x50')](path['basename'](_0x1d0167[_0xc283('0x54')]),'attachments/**/*')],'nodir':!![]})[_0xc283('0x62')]();_0x2ba948['on'](_0xc283('0x63'),function(){if(!fs[_0xc283('0x64')](_0x26ab65)){throw new db[(_0xc283('0x5a'))][(_0xc283('0x5b'))](_0xc283('0x65'));}return _0x92db17[_0xc283('0x4e')](_0x26ab65,util[_0xc283('0x66')](_0xc283('0x52'),path[_0xc283('0x53')](_0x1d0167[_0xc283('0x54')])),function(_0x3e47a8){if(_0x3e47a8){throw new db[(_0xc283('0x5a'))][(_0xc283('0x5b'))](_0xc283('0x67'));}fs[_0xc283('0x68')](_0x26ab65);logger[_0xc283('0x69')]('Download\x20completed');logger[_0xc283('0x69')](_0xc283('0x6a'));});});}return null;})[_0xc283('0x49')](handleError(_0x92db17,null));};exports['upload']=function(_0x1b4131,_0x2341db,_0x3ea645){var _0x44f62e=path[_0xc283('0x53')](_0x1b4131[_0xc283('0x6b')][_0xc283('0x6c')],path[_0xc283('0x6d')](_0x1b4131[_0xc283('0x6b')][_0xc283('0x6c')]));var _0x3bcdc3=path[_0xc283('0x50')](config['root'],'server/files/plugins',_0x1b4131[_0xc283('0x6b')]['filename']);var _0x477927=path['join'](config[_0xc283('0x60')],'server/files/plugins',_0x44f62e);logger[_0xc283('0x69')]('Plugin\x20upload\x20filepath:\x20%s',_0x3bcdc3);logger[_0xc283('0x69')](_0xc283('0x6e'),_0x477927);try{fs[_0xc283('0x6f')](_0x3bcdc3,parseInt('0777',0x8));extract(_0x3bcdc3,{'dir':_0x477927},function(_0x462a20){if(_0x462a20){logger[_0xc283('0x2e')](_0x462a20);handleError(_0x462a20,!![]);};var _0x435408=fs['readdirSync'](_0x477927);if(_0x435408[_0xc283('0x4c')]>0x1){removeReferences(_0x3bcdc3,_0x477927);logger['error'](_0xc283('0x70'));return _0x3ea645(new Error(_0xc283('0x70')));}var _0x1ebe1c=fs['lstatSync'](path['join'](_0x477927,_0x435408[0x0]));if(_0x1ebe1c['isFile']()){removeReferences(_0x3bcdc3,_0x477927);logger[_0xc283('0x2e')](_0xc283('0x70'));return _0x3ea645(new Error(_0xc283('0x70')));}if(_0x1ebe1c['isDirectory']()){var _0x270351=fs[_0xc283('0x71')](path[_0xc283('0x50')](_0x477927,_0x435408[0x0]));if(_0x270351[_0xc283('0x4c')]===0x0){removeReferences(_0x3bcdc3,_0x477927);logger[_0xc283('0x2e')]('Invalid\x20plugin\x20structure');return _0x3ea645(new Error(_0xc283('0x70')));}var _0x2c793b=_0x270351['some'](function(_0x3a3e55){return _0x3a3e55===_0xc283('0x72');});if(!_0x2c793b){return _0x3ea645(new Error(_0xc283('0x73')));}var _0x3f8580=fs['readFileSync'](path[_0xc283('0x50')](_0x477927,_0x435408[0x0],_0xc283('0x72')));var _0x50d6c7=JSON['parse'](_0x3f8580);if('undefined'==typeof _0x50d6c7[_0xc283('0x30')]){return _0x3ea645(new Error(_0xc283('0x74')));}if(_0xc283('0x20')==typeof _0x50d6c7['type']){return _0x3ea645(new Error(_0xc283('0x75')));}if(_0xc283('0x20')==typeof _0x50d6c7['version']){return _0x3ea645(new Error(_0xc283('0x76')));}if('undefined'==typeof _0x50d6c7[_0xc283('0x77')]){return _0x3ea645(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x50d6c7[_0xc283('0x78')]===_0xc283('0x79')){if('undefined'==typeof _0x50d6c7['parameters']['views']){return _0x3ea645(new Error(_0xc283('0x7a')));}if(_0xc283('0x20')==typeof _0x50d6c7[_0xc283('0x77')][_0xc283('0x7b')][_0xc283('0x7c')]&&'undefined'==typeof _0x50d6c7[_0xc283('0x77')][_0xc283('0x7b')][_0xc283('0x7d')]){return _0x3ea645(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x50d6c7[_0xc283('0x78')]===_0xc283('0x7e')){if(_0xc283('0x20')==typeof _0x50d6c7['parameters'][_0xc283('0x7f')]){return _0x3ea645(new Error(_0xc283('0x80')));}if(_0xc283('0x20')==typeof _0x50d6c7['parameters']['scriptPath']){return _0x3ea645(new Error(_0xc283('0x81')));}}else{return _0x3ea645(new Error(_0xc283('0x82')));}var _0x20a40f=_0x50d6c7[_0xc283('0x30')];var _0x2c8e6b=_0x50d6c7[_0xc283('0x83')];var _0x26a2bf=_0x50d6c7['type'];var _0x15e32d=_0x50d6c7['sidebar']?_0x50d6c7[_0xc283('0x84')]:'always';var _0x451b41=_0x50d6c7[_0xc283('0x85')]?_0x50d6c7[_0xc283('0x85')]:_0xc283('0x86');var _0x309f4d='';var _0x2773ef='';var _0x24514f='';var _0x2c52fa='';var _0x3c1fea=_0x50d6c7[_0xc283('0x87')];if(_0x26a2bf===_0xc283('0x79')){if(_0xc283('0x20')!=typeof _0x50d6c7['parameters'][_0xc283('0x7b')][_0xc283('0x7c')]){var _0x4dd9d6=_0x50d6c7[_0xc283('0x77')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x4dd9d6)){_0x309f4d=path['join']('plugins',_0x44f62e,_0x435408[0x0],_0x4dd9d6);}else{_0x309f4d=_0x4dd9d6;}}else{logger['info'](_0xc283('0x88'));}if('undefined'!=typeof _0x50d6c7[_0xc283('0x77')][_0xc283('0x7b')][_0xc283('0x7d')]){var _0x27ad06=_0x50d6c7[_0xc283('0x77')]['views'][_0xc283('0x7d')];if(!/^(f|ht)tps?:\/\//i['test'](_0x27ad06)){_0x2773ef=path[_0xc283('0x50')](_0xc283('0x89'),_0x44f62e,_0x435408[0x0],_0x27ad06);}else{_0x2773ef=_0x27ad06;}}else{logger[_0xc283('0x69')](_0xc283('0x8a'));}}else if(_0x26a2bf===_0xc283('0x7e')){_0x24514f=_0x50d6c7[_0xc283('0x77')][_0xc283('0x7f')];_0x2c52fa=_0x50d6c7[_0xc283('0x77')][_0xc283('0x8b')];if('undefined'!=typeof _0x50d6c7[_0xc283('0x77')]['views']){if(_0xc283('0x20')!=typeof _0x50d6c7[_0xc283('0x77')]['views'][_0xc283('0x7c')]){var _0x4dd9d6=_0x50d6c7[_0xc283('0x77')][_0xc283('0x7b')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xc283('0x8c')](_0x4dd9d6)){_0x309f4d=path[_0xc283('0x50')](_0xc283('0x89'),_0x44f62e,_0x435408[0x0],_0x4dd9d6);}else{_0x309f4d=_0x4dd9d6;}}if(_0xc283('0x20')!=typeof _0x50d6c7[_0xc283('0x77')]['views'][_0xc283('0x7d')]){var _0x27ad06=_0x50d6c7[_0xc283('0x77')][_0xc283('0x7b')][_0xc283('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0xc283('0x8c')](_0x27ad06)){_0x2773ef=path['join'](_0xc283('0x89'),_0x44f62e,_0x435408[0x0],_0x27ad06);}else{_0x2773ef=_0x27ad06;}}}}var _0x19ddef={'name':_0x20a40f,'description':_0x2c8e6b,'path':path['join'](_0x44f62e,_0x435408[0x0]),'type':_0x26a2bf,'sidebar':_0x15e32d,'icon':_0x451b41,'adminUrl':_0x309f4d,'agentUrl':_0x2773ef,'scriptName':_0x24514f,'scriptPath':_0x2c52fa,'version':_0x3c1fea};removeReferences(_0x3bcdc3,null);return db[_0xc283('0x33')][_0xc283('0x8d')](_0x19ddef)[_0xc283('0x28')](function(_0xc8b1e8){var _0x393f34={'role':_0x1b4131[_0xc283('0x8e')][_0xc283('0x8f')],'userProfileId':_0x1b4131[_0xc283('0x8e')][_0xc283('0x90')]};if(!_0x393f34)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x393f34['role']===_0xc283('0x91')){var _0x356e35=_0xc8b1e8['get']({'plain':!![]});return db['UserProfileSection'][_0xc283('0x4d')]({'where':{'name':'Plugins','userProfileId':_0x393f34[_0xc283('0x90')]},'raw':!![]})[_0xc283('0x28')](function(_0x5da8cd){if(_0x5da8cd&&_0x5da8cd[_0xc283('0x92')]===0x0){return db[_0xc283('0x2c')]['create']({'name':_0x356e35['name'],'resourceId':_0x356e35['id'],'type':_0x5da8cd[_0xc283('0x30')],'sectionId':_0x5da8cd['id']},{})[_0xc283('0x28')](function(){return _0xc8b1e8;});}else{return _0xc8b1e8;}})[_0xc283('0x49')](function(_0x110726){logger[_0xc283('0x2e')](_0xc283('0x93'),_0x110726);throw _0x110726;});}return _0xc8b1e8;})['then'](respondWithResult(_0x2341db,null))[_0xc283('0x49')](handleError(_0x2341db,null));}});}catch(_0x28676a){_0x2341db['status'](0x1f4)[_0xc283('0x31')](_0x28676a);}};function removeReferences(_0x2e6e99,_0x44bea3){try{if(_0x2e6e99){fs['unlinkSync'](_0x2e6e99);logger[_0xc283('0x69')](_0xc283('0x94'));}if(_0x44bea3){rimraf(_0x44bea3,function(){});logger['info']('Extracted\x20folder\x20removed');}}catch(_0x17a74f){logger[_0xc283('0x2e')](_0x17a74f);}}exports['update']=function(_0x763ba0,_0x94b78d,_0x1eca5c){return db[_0xc283('0x33')]['find']({'where':{'id':_0x763ba0[_0xc283('0x4f')]['id']}})[_0xc283('0x28')](handleEntityNotFound(_0x94b78d,null))['then'](saveUpdates(_0x763ba0[_0xc283('0x8e')],null))[_0xc283('0x28')](respondWithResult(_0x94b78d,null))[_0xc283('0x49')](handleError(_0x94b78d,null));};exports[_0xc283('0x95')]=function(_0x5adcfb,_0x2e74ed,_0x1096d5){return db[_0xc283('0x33')]['find']({'where':{'id':_0x5adcfb[_0xc283('0x4f')]['id']}})[_0xc283('0x28')](function(_0x2a23f8){if(_0x2a23f8){return _0x2a23f8[_0xc283('0x29')]();}})['then'](function(_0x28b5c3){rimraf(path[_0xc283('0x50')](config[_0xc283('0x60')],_0xc283('0x51'),path['dirname'](_0x28b5c3[_0xc283('0x54')])),function(){});return _0x28b5c3;})['then'](handleEntityNotFound(_0x2e74ed,null))[_0xc283('0x28')](respondWithStatusCode(_0x2e74ed,null))[_0xc283('0x49')](handleError(_0x2e74ed,null));};exports[_0xc283('0x96')]=function(_0x282505,_0x5ac1d2,_0x15495b){return BPromise['resolve']()[_0xc283('0x28')](function(){if(!_0x282505[_0xc283('0x37')][_0xc283('0x54')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x282505[_0xc283('0x37')]['port']){throw new Error(_0xc283('0x97'));}var _0xacabe7=_0x282505[_0xc283('0x37')]['hostname']?_0x282505[_0xc283('0x37')][_0xc283('0x98')]+':'+_0x282505['query']['port']:_0xc283('0x99')+_0x282505[_0xc283('0x37')][_0xc283('0x9a')];var _0x5c9131=_0x282505[_0xc283('0x37')][_0xc283('0x24')]?_0x282505[_0xc283('0x37')][_0xc283('0x24')]:!![];var _0x1f1a68=_0x282505[_0xc283('0x37')][_0xc283('0x9b')]?_0x282505[_0xc283('0x37')]['encoding']:null;var _0x1b08cc={'method':_0x282505['method'],'uri':util[_0xc283('0x66')](_0xc283('0x9c'),_0xacabe7,_0x282505[_0xc283('0x37')]['path']),'json':_0x5c9131,'resolveWithFullResponse':!![],'encoding':_0x1f1a68,'qs':_0x282505[_0xc283('0x37')]};if(_0x282505[_0xc283('0x9d')]){_0x1b08cc['headers']=_0x282505['headers'];if(_0x1b08cc[_0xc283('0x9d')]['content-length']){delete _0x1b08cc[_0xc283('0x9d')][_0xc283('0x9e')];}}if(_0x1b08cc[_0xc283('0x9d')][_0xc283('0x9f')]){delete _0x1b08cc[_0xc283('0x9d')][_0xc283('0x9f')];}return rp(_0x1b08cc);})[_0xc283('0x28')](function(_0xc7701f){if(_0xc7701f){_0x5ac1d2[_0xc283('0xa0')](_0xc7701f[_0xc283('0x9d')]);logger['info'](_0xc7701f[_0xc283('0x8e')]);if(_['endsWith'](_0x282505[_0xc283('0x37')][_0xc283('0x54')],'download')&&_0xc7701f[_0xc283('0xa1')]==0x1f4){return _0x5ac1d2[_0xc283('0xa2')](_0xc7701f['statusCode']);}else{return _0x5ac1d2['status'](_0xc7701f['statusCode'])[_0xc283('0x31')](_0xc7701f[_0xc283('0x8e')]);}}else{return _0x5ac1d2[_0xc283('0xa2')](0xc8);}})[_0xc283('0x49')](handleError(_0x5ac1d2,null));};exports[_0xc283('0xa3')]=function(_0x290f1a,_0x404c69,_0x2a431c){return BPromise['resolve']()[_0xc283('0x28')](function(){if(!_0x290f1a[_0xc283('0x37')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x290f1a[_0xc283('0x37')]['port']){throw new Error(_0xc283('0x97'));}var _0x345a77=_0x290f1a[_0xc283('0x37')]['hostname']?_0x290f1a[_0xc283('0x37')]['hostname']+':'+_0x290f1a[_0xc283('0x37')]['port']:_0xc283('0x99')+_0x290f1a[_0xc283('0x37')][_0xc283('0x9a')];var _0x43b206=_0x290f1a[_0xc283('0x37')][_0xc283('0x24')]?_0x290f1a[_0xc283('0x37')][_0xc283('0x24')]:!![];var _0x5d5540=_0x290f1a[_0xc283('0x37')][_0xc283('0x9b')]?_0x290f1a[_0xc283('0x37')]['encoding']:null;var _0x15523e={'method':_0x290f1a[_0xc283('0xa4')],'uri':util['format'](_0xc283('0x9c'),_0x345a77,_0x290f1a[_0xc283('0x37')][_0xc283('0x54')]),'json':_0x43b206,'resolveWithFullResponse':!![],'encoding':_0x5d5540,'body':_0x290f1a[_0xc283('0x8e')]};if(_0x290f1a[_0xc283('0x9d')]){_0x15523e[_0xc283('0x9d')]=_0x290f1a[_0xc283('0x9d')];if(_0x15523e[_0xc283('0x9d')][_0xc283('0x9e')]){delete _0x15523e[_0xc283('0x9d')]['content-length'];}}if(_0x15523e[_0xc283('0x9d')][_0xc283('0x9f')]){delete _0x15523e['headers'][_0xc283('0x9f')];}return rp(_0x15523e);})[_0xc283('0x28')](function(_0xc2044c){if(_0xc2044c){_0x404c69[_0xc283('0xa0')](_0xc2044c[_0xc283('0x9d')]);logger[_0xc283('0x69')](_0xc2044c[_0xc283('0x8e')]);return _0x404c69[_0xc283('0x1e')](_0xc2044c[_0xc283('0xa1')])[_0xc283('0x31')](_0xc2044c[_0xc283('0x8e')]);}else{return _0x404c69[_0xc283('0xa2')](0xc8);}})['catch'](handleError(_0x404c69,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 537925c..c7bdda4 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 _0xdcf6=['setMaxListeners','save','update','remove','emit','hasOwnProperty','../../mysqldb','Plugin'];(function(_0x3ad2e5,_0x94d414){var _0xc4e565=function(_0x2c96e3){while(--_0x2c96e3){_0x3ad2e5['push'](_0x3ad2e5['shift']());}};_0xc4e565(++_0x94d414);}(_0xdcf6,0x1b6));var _0x6dcf=function(_0x22ac5b,_0x2ef85c){_0x22ac5b=_0x22ac5b-0x0;var _0x4b5cc4=_0xdcf6[_0x22ac5b];return _0x4b5cc4;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x6dcf('0x0'))['db'][_0x6dcf('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x6dcf('0x2')](0x0);var events={'afterCreate':_0x6dcf('0x3'),'afterUpdate':_0x6dcf('0x4'),'afterDestroy':_0x6dcf('0x5')};function emitEvent(_0x1320a5){return function(_0x513bcb,_0x69f442,_0x19eeff){PluginEvents['emit'](_0x1320a5+':'+_0x513bcb['id'],_0x513bcb);PluginEvents[_0x6dcf('0x6')](_0x1320a5,_0x513bcb);_0x19eeff(null);};}for(var e in events){if(events[_0x6dcf('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x4300=['hasOwnProperty','exports','events','update','remove','emit'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x4300,0x1a6));var _0x0430=function(_0x218b58,_0x24277a){_0x218b58=_0x218b58-0x0;var _0x2e55bd=_0x4300[_0x218b58];return _0x2e55bd;};'use strict';var EventEmitter=require(_0x0430('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0430('0x1'),'afterDestroy':_0x0430('0x2')};function emitEvent(_0x1c139f){return function(_0x2a1e62,_0x1735aa,_0x5d0aac){PluginEvents[_0x0430('0x3')](_0x1c139f+':'+_0x2a1e62['id'],_0x2a1e62);PluginEvents['emit'](_0x1c139f,_0x2a1e62);_0x5d0aac(null);};}for(var e in events){if(events[_0x0430('0x4')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x0430('0x5')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 15dd891..6ca5a44 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 _0xdb84=['../../config/environment','exports','define','Plugin','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdb84,0x122));var _0x4db8=function(_0x587efb,_0x4f976a){_0x587efb=_0x587efb-0x0;var _0x44c099=_0xdb84[_0x587efb];return _0x44c099;};'use strict';var _=require(_0x4db8('0x0'));var util=require(_0x4db8('0x1'));var logger=require(_0x4db8('0x2'))(_0x4db8('0x3'));var moment=require('moment');var BPromise=require(_0x4db8('0x4'));var rp=require(_0x4db8('0x5'));var fs=require('fs');var path=require(_0x4db8('0x6'));var rimraf=require('rimraf');var config=require(_0x4db8('0x7'));var attributes=require('./plugin.attributes');module[_0x4db8('0x8')]=function(_0x10603d,_0x13b7bc){return _0x10603d[_0x4db8('0x9')](_0x4db8('0xa'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x43f8=['exports','Plugin','plugins','lodash','util','../../config/logger','bluebird','path','rimraf','./plugin.attributes'];(function(_0x31db47,_0x337b4b){var _0x1e87fc=function(_0x120c2e){while(--_0x120c2e){_0x31db47['push'](_0x31db47['shift']());}};_0x1e87fc(++_0x337b4b);}(_0x43f8,0x1bb));var _0x843f=function(_0x3bd891,_0x37be54){_0x3bd891=_0x3bd891-0x0;var _0x7c2ce=_0x43f8[_0x3bd891];return _0x7c2ce;};'use strict';var _=require(_0x843f('0x0'));var util=require(_0x843f('0x1'));var logger=require(_0x843f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x843f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x843f('0x4'));var rimraf=require(_0x843f('0x5'));var config=require('../../config/environment');var attributes=require(_0x843f('0x6'));module[_0x843f('0x7')]=function(_0x3a38cd,_0x4a00b5){return _0x3a38cd['define'](_0x843f('0x8'),attributes,{'tableName':_0x843f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 700af6e..00cc73c 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 _0xcac5=['register','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','Plugin','create','body','options','raw','CreatePlugin','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./plugin.socket'];(function(_0x436b76,_0x44d2c7){var _0x3497bd=function(_0x48315a){while(--_0x48315a){_0x436b76['push'](_0x436b76['shift']());}};_0x3497bd(++_0x44d2c7);}(_0xcac5,0x1cc));var _0x5cac=function(_0x46fea1,_0x10490a){_0x46fea1=_0x46fea1-0x0;var _0x1130a7=_0xcac5[_0x46fea1];return _0x1130a7;};'use strict';var _=require(_0x5cac('0x0'));var util=require(_0x5cac('0x1'));var moment=require(_0x5cac('0x2'));var BPromise=require(_0x5cac('0x3'));var rs=require(_0x5cac('0x4'));var fs=require('fs');var Redis=require(_0x5cac('0x5'));var db=require(_0x5cac('0x6'))['db'];var utils=require(_0x5cac('0x7'));var logger=require(_0x5cac('0x8'))(_0x5cac('0x9'));var config=require(_0x5cac('0xa'));var jayson=require(_0x5cac('0xb'));var client=jayson['client']['http']({'port':0x232a});config[_0x5cac('0xc')]=_['defaults'](config['redis'],{'host':_0x5cac('0xd'),'port':0x18eb});var socket=require(_0x5cac('0xe'))(new Redis(config[_0x5cac('0xc')]));require(_0x5cac('0xf'))[_0x5cac('0x10')](socket);function respondWithRpcPromise(_0x347db1,_0x36bd7a,_0x1138cb){return new BPromise(function(_0x38dd7f,_0x615eb3){return client['request'](_0x347db1,_0x1138cb)[_0x5cac('0x11')](function(_0x736606){logger['info'](_0x5cac('0x12'),_0x36bd7a,_0x5cac('0x13'));logger[_0x5cac('0x14')](_0x5cac('0x15'),_0x36bd7a,_0x5cac('0x13'),JSON[_0x5cac('0x16')](_0x736606));if(_0x736606[_0x5cac('0x17')]){if(_0x736606[_0x5cac('0x17')][_0x5cac('0x18')]===0x1f4){logger[_0x5cac('0x17')](_0x5cac('0x12'),_0x36bd7a,_0x736606[_0x5cac('0x17')][_0x5cac('0x19')]);return _0x615eb3(_0x736606['error'][_0x5cac('0x19')]);}logger[_0x5cac('0x17')](_0x5cac('0x12'),_0x36bd7a,_0x736606[_0x5cac('0x17')]['message']);return _0x38dd7f(_0x736606['error'][_0x5cac('0x19')]);}else{logger[_0x5cac('0x1a')](_0x5cac('0x12'),_0x36bd7a,_0x5cac('0x13'));_0x38dd7f(_0x736606[_0x5cac('0x1b')][_0x5cac('0x19')]);}})['catch'](function(_0x5a723d){logger[_0x5cac('0x17')]('Plugin,\x20%s,\x20%s',_0x36bd7a,_0x5a723d);_0x615eb3(_0x5a723d);});});}exports['CreatePlugin']=function(_0x29dcf8){var _0x271d0d=this;return new Promise(function(_0xbf8b1d,_0x222e02){return db[_0x5cac('0x1c')][_0x5cac('0x1d')](_0x29dcf8[_0x5cac('0x1e')],{'raw':_0x29dcf8[_0x5cac('0x1f')]?_0x29dcf8[_0x5cac('0x1f')][_0x5cac('0x20')]===undefined?!![]:![]:!![]})[_0x5cac('0x11')](function(_0x89bf6){logger['info']('CreatePlugin',_0x29dcf8);logger[_0x5cac('0x14')]('CreatePlugin',_0x29dcf8,JSON[_0x5cac('0x16')](_0x89bf6));_0xbf8b1d(_0x89bf6);})['catch'](function(_0x12bdf1){logger[_0x5cac('0x17')](_0x5cac('0x21'),_0x12bdf1[_0x5cac('0x19')],_0x29dcf8);_0x222e02(_0x271d0d[_0x5cac('0x17')](0x1f4,_0x12bdf1['message']));});});}; \ No newline at end of file +var _0x25e0=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','then','info','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','Plugin','create','body','options','CreatePlugin','stringify','util'];(function(_0x4f7534,_0x25c9d2){var _0x2edcc9=function(_0x321fac){while(--_0x321fac){_0x4f7534['push'](_0x4f7534['shift']());}};_0x2edcc9(++_0x25c9d2);}(_0x25e0,0x19f));var _0x025e=function(_0x7f5123,_0x3062c5){_0x7f5123=_0x7f5123-0x0;var _0x10a02a=_0x25e0[_0x7f5123];return _0x10a02a;};'use strict';var _=require('lodash');var util=require(_0x025e('0x0'));var moment=require('moment');var BPromise=require(_0x025e('0x1'));var rs=require(_0x025e('0x2'));var fs=require('fs');var Redis=require(_0x025e('0x3'));var db=require(_0x025e('0x4'))['db'];var utils=require(_0x025e('0x5'));var logger=require(_0x025e('0x6'))(_0x025e('0x7'));var config=require(_0x025e('0x8'));var jayson=require(_0x025e('0x9'));var client=jayson[_0x025e('0xa')][_0x025e('0xb')]({'port':0x232a});config['redis']=_[_0x025e('0xc')](config[_0x025e('0xd')],{'host':_0x025e('0xe'),'port':0x18eb});var socket=require(_0x025e('0xf'))(new Redis(config[_0x025e('0xd')]));require('./plugin.socket')[_0x025e('0x10')](socket);function respondWithRpcPromise(_0x9f785b,_0x165e6e,_0x1dfb2d){return new BPromise(function(_0x2a8055,_0x496890){return client['request'](_0x9f785b,_0x1dfb2d)[_0x025e('0x11')](function(_0x5f430b){logger[_0x025e('0x12')](_0x025e('0x13'),_0x165e6e,'request\x20sent');logger[_0x025e('0x14')](_0x025e('0x15'),_0x165e6e,_0x025e('0x16'),JSON['stringify'](_0x5f430b));if(_0x5f430b['error']){if(_0x5f430b['error']['code']===0x1f4){logger[_0x025e('0x17')]('Plugin,\x20%s,\x20%s',_0x165e6e,_0x5f430b[_0x025e('0x17')][_0x025e('0x18')]);return _0x496890(_0x5f430b[_0x025e('0x17')][_0x025e('0x18')]);}logger[_0x025e('0x17')]('Plugin,\x20%s,\x20%s',_0x165e6e,_0x5f430b[_0x025e('0x17')][_0x025e('0x18')]);return _0x2a8055(_0x5f430b['error'][_0x025e('0x18')]);}else{logger[_0x025e('0x12')](_0x025e('0x13'),_0x165e6e,_0x025e('0x16'));_0x2a8055(_0x5f430b['result'][_0x025e('0x18')]);}})[_0x025e('0x19')](function(_0x34e9aa){logger[_0x025e('0x17')]('Plugin,\x20%s,\x20%s',_0x165e6e,_0x34e9aa);_0x496890(_0x34e9aa);});});}exports['CreatePlugin']=function(_0x2f4531){var _0x449daf=this;return new Promise(function(_0x141cc2,_0x2527c4){return db[_0x025e('0x1a')][_0x025e('0x1b')](_0x2f4531[_0x025e('0x1c')],{'raw':_0x2f4531[_0x025e('0x1d')]?_0x2f4531[_0x025e('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x025e('0x11')](function(_0x2e4493){logger[_0x025e('0x12')](_0x025e('0x1e'),_0x2f4531);logger[_0x025e('0x14')]('CreatePlugin',_0x2f4531,JSON[_0x025e('0x1f')](_0x2e4493));_0x141cc2(_0x2e4493);})[_0x025e('0x19')](function(_0x454397){logger['error'](_0x025e('0x1e'),_0x454397[_0x025e('0x18')],_0x2f4531);_0x2527c4(_0x449daf['error'](0x1f4,_0x454397['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 49df2b5..2e93b25 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 _0x01c0=['emit','removeListener','register','length','plugin:','./plugin.events','save','remove','update'];(function(_0x416d06,_0x5e7532){var _0x25f7be=function(_0x3d608a){while(--_0x3d608a){_0x416d06['push'](_0x416d06['shift']());}};_0x25f7be(++_0x5e7532);}(_0x01c0,0xdd));var _0x001c=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0x01c0[_0x28aea5];return _0x6a55f9;};'use strict';var PluginEvents=require(_0x001c('0x0'));var events=[_0x001c('0x1'),_0x001c('0x2'),_0x001c('0x3')];function createListener(_0x2ce55c,_0x61beb4){return function(_0x1cf76e){_0x61beb4[_0x001c('0x4')](_0x2ce55c,_0x1cf76e);};}function removeListener(_0x42a0d4,_0x12088c){return function(){PluginEvents[_0x001c('0x5')](_0x42a0d4,_0x12088c);};}exports[_0x001c('0x6')]=function(_0x395ceb){for(var _0x199463=0x0,_0x32b38c=events[_0x001c('0x7')];_0x199463<_0x32b38c;_0x199463++){var _0x83828e=events[_0x199463];var _0x155b14=createListener(_0x001c('0x8')+_0x83828e,_0x395ceb);PluginEvents['on'](_0x83828e,_0x155b14);}}; \ No newline at end of file +var _0x7290=['removeListener','register','length','plugin:','./plugin.events','remove','update','emit'];(function(_0x3f37c8,_0x2de1ad){var _0x1c3bc2=function(_0x45caf0){while(--_0x45caf0){_0x3f37c8['push'](_0x3f37c8['shift']());}};_0x1c3bc2(++_0x2de1ad);}(_0x7290,0x1e4));var _0x0729=function(_0x197043,_0x3ebf47){_0x197043=_0x197043-0x0;var _0x233e33=_0x7290[_0x197043];return _0x233e33;};'use strict';var PluginEvents=require(_0x0729('0x0'));var events=['save',_0x0729('0x1'),_0x0729('0x2')];function createListener(_0x44dd15,_0x278eb0){return function(_0x2e8616){_0x278eb0[_0x0729('0x3')](_0x44dd15,_0x2e8616);};}function removeListener(_0x1ec9e7,_0x1df045){return function(){PluginEvents[_0x0729('0x4')](_0x1ec9e7,_0x1df045);};}exports[_0x0729('0x5')]=function(_0x4ef359){for(var _0x547436=0x0,_0x3c0e85=events[_0x0729('0x6')];_0x547436<_0x3c0e85;_0x547436++){var _0x377347=events[_0x547436];var _0x483733=createListener(_0x0729('0x7')+_0x377347,_0x4ef359);PluginEvents['on'](_0x377347,_0x483733);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 32096f5..10cd07b 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(_0xc2c29c,_0x2a17af){var _0xcb1793=function(_0x5cf048){while(--_0x5cf048){_0xc2c29c['push'](_0xc2c29c['shift']());}};_0xcb1793(++_0x2a17af);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x558261,_0x5b6e0e){var _0x28e696=function(_0x57f50c){while(--_0x57f50c){_0x558261['push'](_0x558261['shift']());}};_0x28e696(++_0x5b6e0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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 6182448..53096e1 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 _0x4fdb=['lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','status','json','error','stack','name','send','npm\x20install','info','index','then','reject','express','motion2','length','catch','show','describe','params','body','script','join','../../files/plugins','cwd','chdir','dump','restart','stop','hasOwnProperty','Unknown\x20status','destroy','Unknown\x20id'];(function(_0x3a2689,_0x1ec923){var _0x1327d1=function(_0x194689){while(--_0x194689){_0x3a2689['push'](_0x3a2689['shift']());}};_0x1327d1(++_0x1ec923);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x1e3328,_0x398856){_0x1e3328=_0x1e3328-0x0;var _0x594e6f=_0x4fdb[_0x1e3328];return _0x594e6f;};'use strict';var _=require(_0xb4fd('0x0'));var pm2=require(_0xb4fd('0x1'));var logger=require(_0xb4fd('0x2'))(_0xb4fd('0x3'));var path=require(_0xb4fd('0x4'));var exec=require(_0xb4fd('0x5'))[_0xb4fd('0x6')];var BPromise=require(_0xb4fd('0x7'));function handleEntityNotFound(_0x1c0b08,_0x5b73bb){return function(_0x308de6){if(!_0x308de6){_0x1c0b08['sendStatus'](0x194);;}return _0x308de6;};}function respondWithResult(_0x14052b,_0x5d8b39){_0x5d8b39=_0x5d8b39||0xc8;return function(_0x53273f){if(_0x53273f){return _0x14052b[_0xb4fd('0x8')](_0x5d8b39)[_0xb4fd('0x9')](_0x53273f);}return null;};}function handleError(_0x1151b5,_0x52dca2){_0x52dca2=_0x52dca2||0x1f4;return function(_0x526d3b){logger[_0xb4fd('0xa')](_0x526d3b[_0xb4fd('0xb')]);if(_0x526d3b[_0xb4fd('0xc')]){delete _0x526d3b['name'];}_0x1151b5[_0xb4fd('0x8')](_0x52dca2)[_0xb4fd('0xd')](_0x526d3b);};}function execChildProcess(){return new BPromise(function(_0x2148db,_0x23b08f){exec(_0xb4fd('0xe'),function(_0x502379,_0xd05458,_0x1f3e30){logger[_0xb4fd('0xf')](_0xd05458);logger[_0xb4fd('0xf')](_0x1f3e30);if(_0x502379){logger['error'](_0x502379);return _0x23b08f(_0x502379);}return _0x2148db(_0xd05458);});});}exports[_0xb4fd('0x10')]=function(_0x65f08a,_0x345d35){return pm2['list']()[_0xb4fd('0x11')](function(_0x1234d7){if(_0x1234d7){var _0xc35d8d=_[_0xb4fd('0x12')](_0x1234d7,function(_0x36e88f){return _0x36e88f[_0xb4fd('0xc')]===_0xb4fd('0x13')||_0x36e88f['name']===_0xb4fd('0x14');});return{'rows':_0xc35d8d,'count':_0xc35d8d[_0xb4fd('0x15')]};}return null;})[_0xb4fd('0x11')](respondWithResult(_0x345d35,null))[_0xb4fd('0x16')](handleError(_0x345d35,null));};exports[_0xb4fd('0x17')]=function(_0x137e51,_0x1d0812){return pm2[_0xb4fd('0x18')](_0x137e51[_0xb4fd('0x19')]['id'])[_0xb4fd('0x11')](respondWithResult(_0x1d0812,null))[_0xb4fd('0x11')](handleEntityNotFound(_0x1d0812,null))['catch'](handleError(_0x1d0812,null));};exports['create']=function(_0x504e80,_0x5c14c0){if(_0x504e80[_0xb4fd('0x1a')][_0xb4fd('0xc')]&&_0x504e80[_0xb4fd('0x1a')][_0xb4fd('0x1b')]){var _0x458133=path[_0xb4fd('0x1c')](__dirname,_0xb4fd('0x1d'),_0x504e80['body']['script']);var _0x216307=process[_0xb4fd('0x1e')]();process[_0xb4fd('0x1f')](path['dirname'](_0x458133));return execChildProcess()[_0xb4fd('0x11')](function(_0x49d42c){process[_0xb4fd('0x1f')](_0x216307);return pm2['start']({'name':_0x504e80[_0xb4fd('0x1a')][_0xb4fd('0xc')],'script':_0x458133});})[_0xb4fd('0x11')](function(_0x261eda){pm2[_0xb4fd('0x20')]();return _0x261eda[0x0];})[_0xb4fd('0x11')](respondWithResult(_0x5c14c0,0xc9))[_0xb4fd('0x16')](handleError(_0x5c14c0,null));}else{return _0x5c14c0[_0xb4fd('0x8')](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports['update']=function(_0x453982,_0x4bad85){if(_0x453982[_0xb4fd('0x1a')]['id']){delete _0x453982['body']['id'];}var _0x5738c2={'online':_0xb4fd('0x21'),'stopped':_0xb4fd('0x22')};if(_0x5738c2[_0xb4fd('0x23')](_0x453982['body'][_0xb4fd('0x8')])){return pm2[_0x5738c2[_0x453982[_0xb4fd('0x1a')][_0xb4fd('0x8')]]](_0x453982[_0xb4fd('0x19')]['id'])['then'](respondWithResult(_0x4bad85,0xc8))[_0xb4fd('0x16')](handleError(_0x4bad85,null));}else{return _0x4bad85[_0xb4fd('0x8')](0x1f4)['send']({'message':_0xb4fd('0x24')});}};exports[_0xb4fd('0x25')]=function(_0xbe7d2c,_0x597874){if(_0xbe7d2c[_0xb4fd('0x1a')]['id']){delete _0xbe7d2c[_0xb4fd('0x1a')]['id'];}if(_0xbe7d2c[_0xb4fd('0x19')]['id']){return pm2['delete'](_0xbe7d2c['params']['id'])['then'](function(_0x5f36e4){pm2[_0xb4fd('0x20')]();return _0x5f36e4[0x0];})[_0xb4fd('0x11')](respondWithResult(_0x597874,null))[_0xb4fd('0x16')](handleError(_0x597874,null));}else{return _0x597874[_0xb4fd('0x8')](0x1f4)[_0xb4fd('0xd')]({'message':_0xb4fd('0x26')});}}; \ No newline at end of file +var _0x16d2=['cwd','chdir','start','dump','update','stop','send','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','npm\x20install','info','index','list','express','motion2','length','then','catch','show','params','create','body','script','join'];(function(_0x470e57,_0x22e0e5){var _0x59d647=function(_0x3a4a59){while(--_0x3a4a59){_0x470e57['push'](_0x470e57['shift']());}};_0x59d647(++_0x22e0e5);}(_0x16d2,0x123));var _0x216d=function(_0x12e073,_0x2a6387){_0x12e073=_0x12e073-0x0;var _0x17e67b=_0x16d2[_0x12e073];return _0x17e67b;};'use strict';var _=require(_0x216d('0x0'));var pm2=require(_0x216d('0x1'));var logger=require(_0x216d('0x2'))(_0x216d('0x3'));var path=require(_0x216d('0x4'));var exec=require(_0x216d('0x5'))[_0x216d('0x6')];var BPromise=require(_0x216d('0x7'));function handleEntityNotFound(_0xfd7306,_0x593bb0){return function(_0x2c662d){if(!_0x2c662d){_0xfd7306[_0x216d('0x8')](0x194);;}return _0x2c662d;};}function respondWithResult(_0xef687c,_0x205101){_0x205101=_0x205101||0xc8;return function(_0x1dd8e2){if(_0x1dd8e2){return _0xef687c[_0x216d('0x9')](_0x205101)[_0x216d('0xa')](_0x1dd8e2);}return null;};}function handleError(_0x28da14,_0x57accc){_0x57accc=_0x57accc||0x1f4;return function(_0x22c7b3){logger[_0x216d('0xb')](_0x22c7b3[_0x216d('0xc')]);if(_0x22c7b3[_0x216d('0xd')]){delete _0x22c7b3[_0x216d('0xd')];}_0x28da14[_0x216d('0x9')](_0x57accc)['send'](_0x22c7b3);};}function execChildProcess(){return new BPromise(function(_0x7ca9c9,_0x50db30){exec(_0x216d('0xe'),function(_0x2e02ce,_0x332e30,_0x398970){logger[_0x216d('0xf')](_0x332e30);logger[_0x216d('0xf')](_0x398970);if(_0x2e02ce){logger['error'](_0x2e02ce);return _0x50db30(_0x2e02ce);}return _0x7ca9c9(_0x332e30);});});}exports[_0x216d('0x10')]=function(_0x4c07d0,_0x271bb1){return pm2[_0x216d('0x11')]()['then'](function(_0x165c19){if(_0x165c19){var _0x322e4b=_['reject'](_0x165c19,function(_0x1b3215){return _0x1b3215['name']===_0x216d('0x12')||_0x1b3215[_0x216d('0xd')]===_0x216d('0x13');});return{'rows':_0x322e4b,'count':_0x322e4b[_0x216d('0x14')]};}return null;})[_0x216d('0x15')](respondWithResult(_0x271bb1,null))[_0x216d('0x16')](handleError(_0x271bb1,null));};exports[_0x216d('0x17')]=function(_0x1496fe,_0x19fdac){return pm2['describe'](_0x1496fe[_0x216d('0x18')]['id'])['then'](respondWithResult(_0x19fdac,null))['then'](handleEntityNotFound(_0x19fdac,null))[_0x216d('0x16')](handleError(_0x19fdac,null));};exports[_0x216d('0x19')]=function(_0x574758,_0x3f32e0){if(_0x574758[_0x216d('0x1a')]['name']&&_0x574758[_0x216d('0x1a')][_0x216d('0x1b')]){var _0x430e81=path[_0x216d('0x1c')](__dirname,'../../files/plugins',_0x574758[_0x216d('0x1a')][_0x216d('0x1b')]);var _0x10f299=process[_0x216d('0x1d')]();process[_0x216d('0x1e')](path['dirname'](_0x430e81));return execChildProcess()[_0x216d('0x15')](function(_0x1bd4db){process[_0x216d('0x1e')](_0x10f299);return pm2[_0x216d('0x1f')]({'name':_0x574758[_0x216d('0x1a')]['name'],'script':_0x430e81});})[_0x216d('0x15')](function(_0xab672){pm2[_0x216d('0x20')]();return _0xab672[0x0];})['then'](respondWithResult(_0x3f32e0,0xc9))['catch'](handleError(_0x3f32e0,null));}else{return _0x3f32e0['status'](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x216d('0x21')]=function(_0x470d8a,_0x189413){if(_0x470d8a[_0x216d('0x1a')]['id']){delete _0x470d8a[_0x216d('0x1a')]['id'];}var _0x47fa6d={'online':'restart','stopped':_0x216d('0x22')};if(_0x47fa6d['hasOwnProperty'](_0x470d8a[_0x216d('0x1a')][_0x216d('0x9')])){return pm2[_0x47fa6d[_0x470d8a[_0x216d('0x1a')][_0x216d('0x9')]]](_0x470d8a[_0x216d('0x18')]['id'])[_0x216d('0x15')](respondWithResult(_0x189413,0xc8))[_0x216d('0x16')](handleError(_0x189413,null));}else{return _0x189413[_0x216d('0x9')](0x1f4)[_0x216d('0x23')]({'message':_0x216d('0x24')});}};exports[_0x216d('0x25')]=function(_0x260134,_0x4537fd){if(_0x260134['body']['id']){delete _0x260134[_0x216d('0x1a')]['id'];}if(_0x260134[_0x216d('0x18')]['id']){return pm2[_0x216d('0x26')](_0x260134['params']['id'])[_0x216d('0x15')](function(_0x1743ee){pm2[_0x216d('0x20')]();return _0x1743ee[0x0];})[_0x216d('0x15')](respondWithResult(_0x4537fd,null))['catch'](handleError(_0x4537fd,null));}else{return _0x4537fd[_0x216d('0x9')](0x1f4)[_0x216d('0x23')]({'message':_0x216d('0x27')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 715aa48..d27162d 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 _0xed8e=['/queues','exports','Router','../../components/auth/service','get','/agents','isAuthenticated','getAgents'];(function(_0x7239de,_0x2e89e3){var _0x525280=function(_0x4d1701){while(--_0x4d1701){_0x7239de['push'](_0x7239de['shift']());}};_0x525280(++_0x2e89e3);}(_0xed8e,0x14a));var _0xeed8=function(_0x2441b0,_0x2e1a34){_0x2441b0=_0x2441b0-0x0;var _0x3ed283=_0xed8e[_0x2441b0];return _0x3ed283;};'use strict';var express=require('express');var router=express[_0xeed8('0x0')]();var auth=require(_0xeed8('0x1'));var controller=require('./realtime.controller');router[_0xeed8('0x2')](_0xeed8('0x3'),auth[_0xeed8('0x4')](),controller[_0xeed8('0x5')]);router['get'](_0xeed8('0x6'),auth[_0xeed8('0x4')](),controller['getQueues']);module[_0xeed8('0x7')]=router; \ No newline at end of file +var _0x1b06=['getQueues','exports','express','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','/queues'];(function(_0x5a7750,_0x5b3b1a){var _0x2c568c=function(_0x2c4970){while(--_0x2c4970){_0x5a7750['push'](_0x5a7750['shift']());}};_0x2c568c(++_0x5b3b1a);}(_0x1b06,0x161));var _0x61b0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1b06[_0x14add3];return _0x4a174f;};'use strict';var express=require(_0x61b0('0x0'));var router=express['Router']();var auth=require(_0x61b0('0x1'));var controller=require(_0x61b0('0x2'));router[_0x61b0('0x3')](_0x61b0('0x4'),auth[_0x61b0('0x5')](),controller['getAgents']);router['get'](_0x61b0('0x6'),auth[_0x61b0('0x5')](),controller[_0x61b0('0x7')]);module[_0x61b0('0x8')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 80ee10a..420f228 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 _0x2a07=['loggedIn','available','waiting','talking','paused','outbound','push','originated','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','map','get','agents','loggedInDb','busy','find','pick','filter','queue','some','connectedlinenum','internal','toString','length','UserId','accountcode','online','voiceStatus','User','Queue','Pause','findAll','idle','unknown','unavailable','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','pause','every','chatStatus','faxStatus','openchannelStatus','smsStatus','*pause','getAgents','userpic','lastLoginAt','lastPauseAt','chatCapacity','smsCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','mailStatus','whatsappStatus','whatsappStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','resolve','rawAttributes','fieldName','query','agent','getOptions','user','role','nolimit','getResources','findAndCountAll','rows','omit','globalStatus','globalStatusFilter','pauseTypeFilter','getQueues','mail','chat','sms','openchannel','fax','channel','includes','toLowerCase','Invalid\x20channel','type','key','userProfileId','QueueCampaigns','all','util','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','../../mysqldb','client','http','offset','undefined','limit','count','status','set','Content-Range','error','stack','name','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','voice','startCase','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x2a07,0x74));var _0x72a0=function(_0x77773a,_0x5a7026){_0x77773a=_0x77773a-0x0;var _0x1091a2=_0x2a07[_0x77773a];return _0x1091a2;};'use strict';var util=require(_0x72a0('0x0'));var _=require(_0x72a0('0x1'));var jayson=require(_0x72a0('0x2'));var qs=require(_0x72a0('0x3'));var logger=require(_0x72a0('0x4'))('api');var db=require(_0x72a0('0x5'))['db'];var amiClient=jayson[_0x72a0('0x6')][_0x72a0('0x7')]({'port':0x232a});var routingClient=jayson[_0x72a0('0x6')][_0x72a0('0x7')]({'port':0x232c});function respondWithFilteredResult(_0xce74c,_0x3ccf6d){return function(_0x20dab9){if(_0x20dab9){var _0x193e3b=typeof _0x3ccf6d[_0x72a0('0x8')]===_0x72a0('0x9')&&typeof _0x3ccf6d[_0x72a0('0xa')]===_0x72a0('0x9');var _0x1d32e9=_0x20dab9[_0x72a0('0xb')];var _0x2bc45b=_0x193e3b?0x0:_0x3ccf6d['offset'];var _0x169dc2=_0x193e3b?_0x20dab9[_0x72a0('0xb')]:_0x3ccf6d['offset']+_0x3ccf6d[_0x72a0('0xa')];var _0x194488;if(_0x169dc2>=_0x1d32e9){_0x169dc2=_0x1d32e9;_0x194488=0xc8;}else{_0x194488=0xce;}_0xce74c[_0x72a0('0xc')](_0x194488);return _0xce74c[_0x72a0('0xd')](_0x72a0('0xe'),_0x2bc45b+'-'+_0x169dc2+'/'+_0x1d32e9)['json'](_0x20dab9);}return null;};}function handleError(_0x130797,_0x335b9f){_0x335b9f=_0x335b9f||0x1f4;return function(_0x123ca4){logger[_0x72a0('0xf')](_0x123ca4[_0x72a0('0x10')]);if(_0x123ca4[_0x72a0('0x11')]){delete _0x123ca4[_0x72a0('0x11')];}_0x130797['status'](_0x335b9f)['send'](_0x123ca4);};}function getRealtimeAgents(){return new Promise(function(_0xe103dc,_0x3cd89f){return amiClient[_0x72a0('0x12')](_0x72a0('0x13'),{})[_0x72a0('0x14')](function(_0x3f3d62){if(_0x3f3d62['error'])throw new Error(_0x72a0('0x15'));var _0x2e7552=_0x3f3d62[_0x72a0('0x16')];return routingClient[_0x72a0('0x12')](_0x72a0('0x13'),{})['then'](function(_0x100d8f){if(_0x100d8f[_0x72a0('0xf')])throw new Error(_0x72a0('0x17'));var _0x5b63c8=_0x100d8f[_0x72a0('0x16')];return _0xe103dc(_[_0x72a0('0x18')]({},_0x2e7552,_0x5b63c8));});})[_0x72a0('0x19')](function(_0x41614d){_0x3cd89f(_0x41614d);});});}function getRealtimeQueues(_0x5437df,_0x3bc78b){return new Promise(function(_0x5b8f2c,_0x3d0607){var _0x315413=_0x3bc78b===_0x72a0('0x1a')?amiClient:routingClient;return _0x315413['request'](_[_0x72a0('0x1b')](_0x3bc78b)+_0x72a0('0x1c'),_0x5437df)[_0x72a0('0x14')](function(_0x3d1965){if(_0x3d1965['error'])throw new Error(util[_0x72a0('0x1d')](_0x72a0('0x1e'),_0x3bc78b));return _0x5b8f2c(_0x3d1965[_0x72a0('0x16')]);})[_0x72a0('0x19')](function(_0x3022b0){_0x3d0607(_0x3022b0);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x174b1b,_0x5c4daf){return amiClient['request'](_0x72a0('0x1f'),{})[_0x72a0('0x14')](function(_0x123df4){if(_0x123df4[_0x72a0('0xf')])throw new Error(_0x72a0('0x20'));return _0x174b1b(_0x123df4[_0x72a0('0x16')]);})[_0x72a0('0x19')](function(_0x15922a){_0x5c4daf(_0x15922a);});});}function initializeQueues(_0xee99e2,_0x12dcc9,_0x4f9718,_0x304b92){var _0x553641=[_0x72a0('0x21'),_0x72a0('0x22'),_0x72a0('0x23'),_0x72a0('0x24'),_0x72a0('0x25')];if(_0x4f9718===_0x72a0('0x1a')&&_0x304b92===_0x72a0('0x26')){_0x553641[_0x72a0('0x27')]('pTalking',_0x72a0('0x28'),_0x72a0('0x29'),_0x72a0('0x2a'),_0x72a0('0x2b'),_0x72a0('0x2c'),_0x72a0('0x2d'),_0x72a0('0x2e'),'erlangCalls',_0x72a0('0x2f'),_0x72a0('0x30'),_0x72a0('0x31'),_0x72a0('0x32'),_0x72a0('0x33'),_0x72a0('0x34'),_0x72a0('0x35'),_0x72a0('0x36'),'predictiveIntervalAnsweredCalls',_0x72a0('0x37'),_0x72a0('0x38'),_0x72a0('0x39'),'predictiveIntervalAvgTalktime');}return _0xee99e2[_0x72a0('0x3a')](function(_0x4ada83){var _0x4b2b44=_0x4ada83[_0x72a0('0x3b')]({'plain':!![]});_0x4b2b44[_0x72a0('0x3c')]=[];_0x4b2b44[_0x72a0('0x25')]=0x0;_0x4b2b44[_0x72a0('0x3d')]=0x0;_0x4b2b44[_0x72a0('0x21')]=0x0;_0x4b2b44[_0x72a0('0x22')]=0x0;_0x4b2b44[_0x72a0('0x23')]=0x0;if(_0x4f9718===_0x72a0('0x1a')){_0x4b2b44[_0x72a0('0x24')]=0x0;_0x4b2b44[_0x72a0('0x3e')]=0x0;if(_0x304b92===_0x72a0('0x26')){_0x4b2b44['pTalking']=0x0;_0x4b2b44[_0x72a0('0x28')]=0x0;}}var _0x5eb8f1=_[_0x72a0('0x3f')](_0x12dcc9,['id',_0x4b2b44['id']]);if(_0x5eb8f1)_[_0x72a0('0x18')](_0x4b2b44,_[_0x72a0('0x40')](_0x5eb8f1,_0x553641));return _0x4b2b44;});}function updateAgentVoiceStatus(_0x1a9597,_0xbb1f4,_0x17dcd8){var _0x90b437=_[_0x72a0('0x41')](_0x17dcd8,[_0x72a0('0x42'),_0xbb1f4['name']]);if(_0x90b437['length']===0x0)return _0x1a9597[_0x72a0('0x3e')]=!![];if(_[_0x72a0('0x43')](_0x90b437,[_0x72a0('0x44'),_0x1a9597[_0x72a0('0x45')][_0x72a0('0x46')]()]))return _0x1a9597['talking']=!![];if(!_0x1a9597[_0x72a0('0x24')])return _0x1a9597[_0x72a0('0x3e')]=!![];}function getVoiceQueueAgents(_0x582c90,_0x21ad08,_0x5cc69b,_0x582c84){var _0x4dee6c=_[_0x72a0('0x3f')](_0x21ad08,['id',_0x582c90['id']]);if(!_0x4dee6c)return _0x582c90;return _0x4dee6c['getMembers']({'raw':!![]})[_0x72a0('0x14')](function(_0x243a6b){for(var _0x1250ac=0x0;_0x1250ac<_0x243a6b[_0x72a0('0x47')];_0x1250ac++){var _0x4bf56e=_['find'](_0x5cc69b,['id',_0x243a6b[_0x1250ac]['UserId']]);if(!_0x4bf56e){_0x4bf56e={'id':_0x243a6b[_0x1250ac]['UserId'],'name':_0x243a6b[_0x1250ac][_0x72a0('0x48')],'accountcode':'','online':![]};}var _0x5784ec={'id':_0x4bf56e['id'],'name':_0x4bf56e['name'],'internal':_0x4bf56e[_0x72a0('0x49')],'online':Boolean(_0x4bf56e[_0x72a0('0x4a')]),'paused':Boolean(_0x243a6b[_0x1250ac]['paused'])};if(_0x4bf56e[_0x72a0('0x4b')]===_0x72a0('0x24'))updateAgentVoiceStatus(_0x5784ec,_0x582c90,_0x582c84);if(_0x5784ec[_0x72a0('0x4a')])_0x582c90[_0x72a0('0x3d')]++;if(_0x5784ec[_0x72a0('0x3e')])_0x582c90[_0x72a0('0x3e')]++;if(_0x5784ec['paused']&&!_0x5784ec[_0x72a0('0x3e')]&&!_0x5784ec['talking'])_0x582c90[_0x72a0('0x25')]++;_0x582c90['agents'][_0x72a0('0x27')](_0x5784ec);}return _0x582c90;});}function getQueueAgents(_0x3bd306,_0x52b575,_0x430178){var _0x506d65=_0x72a0('0x4c')+_[_0x72a0('0x1b')](_0x430178)+_0x72a0('0x4d');var _0x4afdd1=_0x430178+_0x72a0('0x4e');return db[_0x506d65][_0x72a0('0x4f')]({'where':{[_[_0x72a0('0x1b')](_0x430178)+'QueueId']:_0x3bd306['id']},'raw':!![]})['then'](function(_0x117fd3){for(var _0x590572=0x0;_0x590572<_0x117fd3[_0x72a0('0x47')];_0x590572++){var _0x1436f7=_[_0x72a0('0x3f')](_0x52b575,['id',_0x117fd3[_0x590572][_0x72a0('0x48')]]);if(!_0x1436f7){_0x1436f7={'id':_0x117fd3[_0x590572][_0x72a0('0x48')],'name':_0x117fd3[_0x590572][_0x72a0('0x48')],'online':![],['pauseField']:![]};}var _0x451558={'id':_0x1436f7['id'],'name':_0x1436f7[_0x72a0('0x11')],'online':Boolean(_0x1436f7[_0x72a0('0x4a')]),'paused':Boolean(_0x1436f7[_0x4afdd1])};if(_0x451558['online'])_0x3bd306[_0x72a0('0x3d')]++;_0x3bd306[_0x72a0('0x3c')][_0x72a0('0x27')](_0x451558);}return _0x3bd306;});}function isIdle(_0x476e7a){return _0x476e7a===_0x72a0('0x50')||_0x476e7a===_0x72a0('0x51')||_0x476e7a===_0x72a0('0x52')||_0x476e7a==='ringing'||_['isNil'](_0x476e7a);}function isAgentPaused(_0x409095,_0x2161a3){var _0xe38fb3=[_0x409095[_0x72a0('0x53')],_0x409095[_0x72a0('0x54')],_0x409095[_0x72a0('0x55')],_0x409095[_0x72a0('0x56')],_0x409095[_0x72a0('0x57')],_0x409095[_0x72a0('0x58')],_0x409095[_0x72a0('0x59')]];if(!_0x2161a3)return _['every'](_0xe38fb3);var _0x230e2e=_[_0x72a0('0x41')](_0xe38fb3);return _0x230e2e[_0x72a0('0x47')]>0x0&&_0x230e2e[_0x72a0('0x47')]<_0xe38fb3[_0x72a0('0x47')]?!![]:![];}function isAgentIdle(_0x5c1570){if(_0x5c1570[_0x72a0('0x4b')]!=='idle'&&_0x5c1570['voicePause']){_0x5c1570[_0x72a0('0x4b')]=_0x72a0('0x5a');return![];}return _[_0x72a0('0x5b')]([_0x5c1570[_0x72a0('0x5c')],_0x5c1570[_0x72a0('0x5d')],_0x5c1570['mailStatus'],_0x5c1570[_0x72a0('0x5e')],_0x5c1570[_0x72a0('0x5f')],_0x5c1570['voiceStatus'],_0x5c1570['whatsappStatus']],isIdle);}function getAgentStatus(_0x1f698d){var _0x251e08=_0x72a0('0x51');if(isAgentPaused(_0x1f698d))_0x251e08=_0x72a0('0x5a');else if(isAgentPaused(_0x1f698d,!![]))_0x251e08=_0x72a0('0x60');else if(isAgentIdle(_0x1f698d))_0x251e08=_0x72a0('0x50');else _0x251e08=_0x72a0('0x3e');return _0x251e08;}exports[_0x72a0('0x61')]=function(_0x57741b,_0x113eea){var _0x555b14={'count':0x0,'rows':[]},_0x530632={},_0x591dbc,_0x1f30e0,_0x16edb7=[_0x72a0('0x62'),'online',_0x72a0('0x63'),'lastPauseAt','pauseType',_0x72a0('0x64'),_0x72a0('0x45'),'address',_0x72a0('0x53'),'openchannelPause',_0x72a0('0x55'),'smsPause','whatsappPause',_0x72a0('0x54'),_0x72a0('0x58'),_0x72a0('0x65'),'openchannelCapacity','mailCapacity',_0x72a0('0x66'),'whatsappCapacity',_0x72a0('0x67'),_0x72a0('0x68'),_0x72a0('0x69'),_0x72a0('0x6a'),_0x72a0('0x6b'),_0x72a0('0x6c'),_0x72a0('0x6d'),_0x72a0('0x5c'),_0x72a0('0x5e'),_0x72a0('0x6e'),_0x72a0('0x5f'),_0x72a0('0x6f'),'faxStatus',_0x72a0('0x4b'),'chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime',_0x72a0('0x70'),_0x72a0('0x71'),_0x72a0('0x72'),'queue',_0x72a0('0x73'),'screenrecording',_0x72a0('0x74'),_0x72a0('0x75'),'routealias'],_0x583434=[_0x72a0('0x53'),_0x72a0('0x56'),_0x72a0('0x55'),_0x72a0('0x57'),'whatsappPause',_0x72a0('0x54'),'voicePause',_0x72a0('0x4a')];Promise[_0x72a0('0x76')]()[_0x72a0('0x14')](function(){var _0x47fe64=_[_0x72a0('0x3a')](db[_0x72a0('0x4c')][_0x72a0('0x77')],function(_0x154c9d){return{'name':_0x154c9d[_0x72a0('0x78')],'type':_0x154c9d['type']['key']};});_0x57741b[_0x72a0('0x79')]['role']=_0x72a0('0x7a');_0x57741b['query'][_0x72a0('0x4a')]=!![];_0x530632=qs[_0x72a0('0x7b')](_0x47fe64,_0x57741b);_0x530632['raw']=!![];if(_0x57741b[_0x72a0('0x7c')][_0x72a0('0x7d')]===_0x72a0('0x7c')){var _0x55b301={'params':{'id':_0x57741b[_0x72a0('0x7c')]['userProfileId']},'query':{'section':_0x72a0('0x13'),'role':_0x72a0('0x7a'),'online':!![],'nolimit':_0x57741b['query'][_0x72a0('0x7e')],'sort':_0x57741b['query']['sort'],'filter':_0x57741b['query'][_0x72a0('0x41')],'raw':!![]}};return db['UserProfile'][_0x72a0('0x7f')](_0x55b301);}return db['User'][_0x72a0('0x80')](_0x530632);})[_0x72a0('0x14')](function(_0x143ebf){_0x555b14['count']=_0x143ebf[_0x72a0('0xb')];_0x591dbc=_0x143ebf[_0x72a0('0x81')];return getRealtimeAgents();})[_0x72a0('0x14')](function(_0x28551a){_0x1f30e0=_0x28551a[_0x72a0('0x81')];return _0x591dbc['map'](function(_0x54e925){var _0x2d431d=_[_0x72a0('0x3f')](_0x1f30e0,['id',_0x54e925['id']]);if(_0x2d431d)_[_0x72a0('0x18')](_0x54e925,_['pick'](_[_0x72a0('0x82')](_0x2d431d,_0x583434),_0x16edb7));_0x54e925[_0x72a0('0x83')]=getAgentStatus(_0x54e925);return _0x54e925;});})['then'](function(_0xd041ec){if(_0x57741b['query'][_0x72a0('0x84')]){var _0x52f855=_[_0x72a0('0x41')](_0xd041ec,[_0x72a0('0x83'),_0x57741b[_0x72a0('0x79')][_0x72a0('0x84')]]);if(_0x57741b[_0x72a0('0x79')]['pauseTypeFilter']){_0x52f855=_['filter'](_0x52f855,['pauseType',_0x57741b[_0x72a0('0x79')][_0x72a0('0x85')]]);}}_0x555b14[_0x72a0('0x81')]=_0x52f855||_0xd041ec;return _0x555b14;})[_0x72a0('0x14')](respondWithFilteredResult(_0x113eea,_0x530632))[_0x72a0('0x19')](handleError(_0x113eea,null));};exports[_0x72a0('0x86')]=function(_0x5ab97b,_0x2dd438){var _0x1a201a=[_0x72a0('0x87'),_0x72a0('0x88'),_0x72a0('0x89'),_0x72a0('0x8a'),_0x72a0('0x8b'),'whatsapp',_0x72a0('0x1a')];var _0x9fc964={'count':0x0,'rows':[]},_0x130c90={},_0x116493,_0x2e6e32,_0x26e270,_0x5d2de2,_0x3bb322;Promise['resolve']()[_0x72a0('0x14')](function(){if(_0x5ab97b[_0x72a0('0x79')][_0x72a0('0x8c')]){if(!_[_0x72a0('0x8d')](_0x1a201a,_0x5ab97b[_0x72a0('0x79')]['channel'][_0x72a0('0x8e')]()))throw new Error(_0x72a0('0x8f'));_0x116493=_0x5ab97b['query'][_0x72a0('0x8c')][_0x72a0('0x8e')]();}var _0x32ada6=_[_0x72a0('0x1b')](_0x116493)+'Queue';var _0x3b4d55=_[_0x72a0('0x3a')](db[_0x32ada6][_0x72a0('0x77')],function(_0x34a337){return{'name':_0x34a337[_0x72a0('0x78')],'type':_0x34a337[_0x72a0('0x90')][_0x72a0('0x91')]};});_0x130c90=qs[_0x72a0('0x7b')](_0x3b4d55,_0x5ab97b);if(_0x5ab97b[_0x72a0('0x7c')][_0x72a0('0x7d')]===_0x72a0('0x7c')){var _0x109e9e={'params':{'id':_0x5ab97b['user'][_0x72a0('0x92')]},'query':{'section':_0x116493===_0x72a0('0x1a')&&_0x5ab97b[_0x72a0('0x79')][_0x72a0('0x90')]===_0x72a0('0x26')?_0x72a0('0x93'):_[_0x72a0('0x1b')](_0x116493)+_0x72a0('0x1c'),'type':_0x5ab97b['query'][_0x72a0('0x90')],'nolimit':!![],'sort':'name','filter':_0x5ab97b['query'][_0x72a0('0x41')]}};return db['UserProfile']['getResources'](_0x109e9e);}return db[_0x32ada6][_0x72a0('0x80')](_0x130c90);})['then'](function(_0xa89b8d){_0x9fc964[_0x72a0('0xb')]=_0xa89b8d[_0x72a0('0xb')];_0x2e6e32=_0xa89b8d['rows'];return getRealtimeQueues(_0x5ab97b,_0x116493);})[_0x72a0('0x14')](function(_0x179ca2){_0x5d2de2=_0x179ca2[_0x72a0('0x81')];return getRealtimeAgents();})[_0x72a0('0x14')](function(_0x3d3d1f){_0x26e270=_0x3d3d1f['rows'];if(_0x116493!=_0x72a0('0x1a'))return;return getRealtimeVoiceQueueChannels();})[_0x72a0('0x14')](function(_0x38736e){_0x3bb322=_0x38736e?_0x38736e['rows']:[];return initializeQueues(_0x2e6e32,_0x5d2de2,_0x116493,_0x5ab97b[_0x72a0('0x79')][_0x72a0('0x90')]);})[_0x72a0('0x14')](function(_0x56104e){var _0x100f97=_0x56104e[_0x72a0('0x3a')](function(_0x32f2d4){if(_0x116493===_0x72a0('0x1a'))return getVoiceQueueAgents(_0x32f2d4,_0x2e6e32,_0x26e270,_0x3bb322);else return getQueueAgents(_0x32f2d4,_0x26e270,_0x116493);});return Promise[_0x72a0('0x94')](_0x100f97);})[_0x72a0('0x14')](function(_0xff26b1){_0x9fc964[_0x72a0('0x81')]=_0xff26b1;return _0x9fc964;})[_0x72a0('0x14')](respondWithFilteredResult(_0x2dd438,_0x130c90))['catch'](handleError(_0x2dd438,null));}; \ No newline at end of file +var _0xfdbd=['loggedIn','voice','busy','find','pick','filter','queue','length','some','connectedlinenum','internal','toString','getMembers','UserId','accountcode','online','voiceStatus','agents','User','Queue','QueueId','idle','unknown','isNil','chatPause','faxPause','mailPause','openchannelPause','voicePause','whatsappPause','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','*pause','getAgents','userpic','lastLoginAt','lastPauseAt','pauseType','address','smsPause','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','fieldName','query','getOptions','raw','user','userProfileId','agent','nolimit','UserProfile','getResources','findAndCountAll','rows','omit','globalStatus','globalStatusFilter','pauseTypeFilter','mail','chat','sms','resolve','channel','includes','Invalid\x20channel','toLowerCase','rawAttributes','type','QueueCampaigns','all','util','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','limit','undefined','count','offset','status','set','json','error','stack','name','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','catch','startCase','Queues','format','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','available','waiting','talking','outbound','push','pTalking','originated','message','dialActive','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','paused','loggedInDb'];(function(_0x3fe88a,_0x3e2109){var _0x2eebae=function(_0x2c0cef){while(--_0x2c0cef){_0x3fe88a['push'](_0x3fe88a['shift']());}};_0x2eebae(++_0x3e2109);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x184cc6,_0x4961ee){_0x184cc6=_0x184cc6-0x0;var _0x3f7435=_0xfdbd[_0x184cc6];return _0x3f7435;};'use strict';var util=require(_0xdfdb('0x0'));var _=require(_0xdfdb('0x1'));var jayson=require(_0xdfdb('0x2'));var qs=require(_0xdfdb('0x3'));var logger=require(_0xdfdb('0x4'))(_0xdfdb('0x5'));var db=require(_0xdfdb('0x6'))['db'];var amiClient=jayson[_0xdfdb('0x7')][_0xdfdb('0x8')]({'port':0x232a});var routingClient=jayson['client'][_0xdfdb('0x8')]({'port':0x232c});function respondWithFilteredResult(_0x4a4a3f,_0x453ef6){return function(_0x41bd5e){if(_0x41bd5e){var _0x489f19=typeof _0x453ef6['offset']==='undefined'&&typeof _0x453ef6[_0xdfdb('0x9')]===_0xdfdb('0xa');var _0x47c629=_0x41bd5e[_0xdfdb('0xb')];var _0x444c19=_0x489f19?0x0:_0x453ef6[_0xdfdb('0xc')];var _0x27ddcd=_0x489f19?_0x41bd5e[_0xdfdb('0xb')]:_0x453ef6[_0xdfdb('0xc')]+_0x453ef6[_0xdfdb('0x9')];var _0x47dccc;if(_0x27ddcd>=_0x47c629){_0x27ddcd=_0x47c629;_0x47dccc=0xc8;}else{_0x47dccc=0xce;}_0x4a4a3f[_0xdfdb('0xd')](_0x47dccc);return _0x4a4a3f[_0xdfdb('0xe')]('Content-Range',_0x444c19+'-'+_0x27ddcd+'/'+_0x47c629)[_0xdfdb('0xf')](_0x41bd5e);}return null;};}function handleError(_0x33a706,_0x2bee3b){_0x2bee3b=_0x2bee3b||0x1f4;return function(_0x1918c1){logger[_0xdfdb('0x10')](_0x1918c1[_0xdfdb('0x11')]);if(_0x1918c1[_0xdfdb('0x12')]){delete _0x1918c1[_0xdfdb('0x12')];}_0x33a706['status'](_0x2bee3b)['send'](_0x1918c1);};}function getRealtimeAgents(){return new Promise(function(_0x2c44dc,_0x4b1ff7){return amiClient[_0xdfdb('0x13')](_0xdfdb('0x14'),{})[_0xdfdb('0x15')](function(_0x40bc8a){if(_0x40bc8a[_0xdfdb('0x10')])throw new Error(_0xdfdb('0x16'));var _0x54ff23=_0x40bc8a['result'];return routingClient[_0xdfdb('0x13')](_0xdfdb('0x14'),{})[_0xdfdb('0x15')](function(_0x55ab5a){if(_0x55ab5a[_0xdfdb('0x10')])throw new Error(_0xdfdb('0x17'));var _0x467653=_0x55ab5a[_0xdfdb('0x18')];return _0x2c44dc(_[_0xdfdb('0x19')]({},_0x54ff23,_0x467653));});})[_0xdfdb('0x1a')](function(_0x693a2c){_0x4b1ff7(_0x693a2c);});});}function getRealtimeQueues(_0x29a639,_0x5b8cb5){return new Promise(function(_0x14638a,_0xb7417c){var _0x172c63=_0x5b8cb5==='voice'?amiClient:routingClient;return _0x172c63[_0xdfdb('0x13')](_[_0xdfdb('0x1b')](_0x5b8cb5)+_0xdfdb('0x1c'),_0x29a639)['then'](function(_0x280e53){if(_0x280e53[_0xdfdb('0x10')])throw new Error(util[_0xdfdb('0x1d')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x5b8cb5));return _0x14638a(_0x280e53[_0xdfdb('0x18')]);})['catch'](function(_0x2db1c1){_0xb7417c(_0x2db1c1);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x145350,_0x1fa2f3){return amiClient[_0xdfdb('0x13')]('VoiceQueuesChannels',{})[_0xdfdb('0x15')](function(_0x4363d8){if(_0x4363d8[_0xdfdb('0x10')])throw new Error(_0xdfdb('0x1e'));return _0x145350(_0x4363d8[_0xdfdb('0x18')]);})[_0xdfdb('0x1a')](function(_0x57d24f){_0x1fa2f3(_0x57d24f);});});}function initializeQueues(_0xec4d22,_0x2d5fe2,_0xdf3a5c,_0x4f8057){var _0x466932=['loggedIn',_0xdfdb('0x1f'),_0xdfdb('0x20'),_0xdfdb('0x21'),'paused'];if(_0xdf3a5c==='voice'&&_0x4f8057===_0xdfdb('0x22')){_0x466932[_0xdfdb('0x23')](_0xdfdb('0x24'),_0xdfdb('0x25'),_0xdfdb('0x26'),_0xdfdb('0x27'),'dialMethod',_0xdfdb('0x28'),_0xdfdb('0x29'),_0xdfdb('0x2a'),_0xdfdb('0x2b'),_0xdfdb('0x2c'),_0xdfdb('0x2d'),_0xdfdb('0x2e'),_0xdfdb('0x2f'),_0xdfdb('0x30'),_0xdfdb('0x31'),_0xdfdb('0x32'),'predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls',_0xdfdb('0x33'),'predictiveIntervalDroppedCallsCallersExit',_0xdfdb('0x34'),_0xdfdb('0x35'));}return _0xec4d22[_0xdfdb('0x36')](function(_0x36d91f){var _0x514232=_0x36d91f[_0xdfdb('0x37')]({'plain':!![]});_0x514232['agents']=[];_0x514232[_0xdfdb('0x38')]=0x0;_0x514232[_0xdfdb('0x39')]=0x0;_0x514232[_0xdfdb('0x3a')]=0x0;_0x514232[_0xdfdb('0x1f')]=0x0;_0x514232[_0xdfdb('0x20')]=0x0;if(_0xdf3a5c===_0xdfdb('0x3b')){_0x514232['talking']=0x0;_0x514232[_0xdfdb('0x3c')]=0x0;if(_0x4f8057===_0xdfdb('0x22')){_0x514232['pTalking']=0x0;_0x514232[_0xdfdb('0x25')]=0x0;}}var _0x4377d6=_[_0xdfdb('0x3d')](_0x2d5fe2,['id',_0x514232['id']]);if(_0x4377d6)_[_0xdfdb('0x19')](_0x514232,_[_0xdfdb('0x3e')](_0x4377d6,_0x466932));return _0x514232;});}function updateAgentVoiceStatus(_0x286fdb,_0x16d5b8,_0x1d1f4f){var _0x21f4c7=_[_0xdfdb('0x3f')](_0x1d1f4f,[_0xdfdb('0x40'),_0x16d5b8['name']]);if(_0x21f4c7[_0xdfdb('0x41')]===0x0)return _0x286fdb[_0xdfdb('0x3c')]=!![];if(_[_0xdfdb('0x42')](_0x21f4c7,[_0xdfdb('0x43'),_0x286fdb[_0xdfdb('0x44')][_0xdfdb('0x45')]()]))return _0x286fdb[_0xdfdb('0x21')]=!![];if(!_0x286fdb[_0xdfdb('0x21')])return _0x286fdb['busy']=!![];}function getVoiceQueueAgents(_0x55d707,_0x435557,_0x2146b2,_0x16e100){var _0x1e7688=_[_0xdfdb('0x3d')](_0x435557,['id',_0x55d707['id']]);if(!_0x1e7688)return _0x55d707;return _0x1e7688[_0xdfdb('0x46')]({'raw':!![]})[_0xdfdb('0x15')](function(_0x2eb46c){for(var _0xcee274=0x0;_0xcee274<_0x2eb46c['length'];_0xcee274++){var _0x175f57=_[_0xdfdb('0x3d')](_0x2146b2,['id',_0x2eb46c[_0xcee274][_0xdfdb('0x47')]]);if(!_0x175f57){_0x175f57={'id':_0x2eb46c[_0xcee274][_0xdfdb('0x47')],'name':_0x2eb46c[_0xcee274][_0xdfdb('0x47')],'accountcode':'','online':![]};}var _0x5a1bee={'id':_0x175f57['id'],'name':_0x175f57[_0xdfdb('0x12')],'internal':_0x175f57[_0xdfdb('0x48')],'online':Boolean(_0x175f57[_0xdfdb('0x49')]),'paused':Boolean(_0x2eb46c[_0xcee274][_0xdfdb('0x38')])};if(_0x175f57[_0xdfdb('0x4a')]==='talking')updateAgentVoiceStatus(_0x5a1bee,_0x55d707,_0x16e100);if(_0x5a1bee[_0xdfdb('0x49')])_0x55d707[_0xdfdb('0x39')]++;if(_0x5a1bee[_0xdfdb('0x3c')])_0x55d707['busy']++;if(_0x5a1bee[_0xdfdb('0x38')]&&!_0x5a1bee['busy']&&!_0x5a1bee[_0xdfdb('0x21')])_0x55d707['paused']++;_0x55d707[_0xdfdb('0x4b')][_0xdfdb('0x23')](_0x5a1bee);}return _0x55d707;});}function getQueueAgents(_0x5c14a1,_0xc92f82,_0x4e8ead){var _0xfea790=_0xdfdb('0x4c')+_[_0xdfdb('0x1b')](_0x4e8ead)+_0xdfdb('0x4d');var _0x25cc2f=_0x4e8ead+'Pause';return db[_0xfea790]['findAll']({'where':{[_[_0xdfdb('0x1b')](_0x4e8ead)+_0xdfdb('0x4e')]:_0x5c14a1['id']},'raw':!![]})['then'](function(_0x2b0a8b){for(var _0x59d0c3=0x0;_0x59d0c3<_0x2b0a8b[_0xdfdb('0x41')];_0x59d0c3++){var _0x158407=_[_0xdfdb('0x3d')](_0xc92f82,['id',_0x2b0a8b[_0x59d0c3][_0xdfdb('0x47')]]);if(!_0x158407){_0x158407={'id':_0x2b0a8b[_0x59d0c3][_0xdfdb('0x47')],'name':_0x2b0a8b[_0x59d0c3][_0xdfdb('0x47')],'online':![],['pauseField']:![]};}var _0x41701c={'id':_0x158407['id'],'name':_0x158407[_0xdfdb('0x12')],'online':Boolean(_0x158407[_0xdfdb('0x49')]),'paused':Boolean(_0x158407[_0x25cc2f])};if(_0x41701c[_0xdfdb('0x49')])_0x5c14a1[_0xdfdb('0x39')]++;_0x5c14a1[_0xdfdb('0x4b')][_0xdfdb('0x23')](_0x41701c);}return _0x5c14a1;});}function isIdle(_0x202c25){return _0x202c25===_0xdfdb('0x4f')||_0x202c25===_0xdfdb('0x50')||_0x202c25==='unavailable'||_0x202c25==='ringing'||_[_0xdfdb('0x51')](_0x202c25);}function isAgentPaused(_0x1aff71,_0x2f1d06){var _0x4bbb88=[_0x1aff71[_0xdfdb('0x52')],_0x1aff71[_0xdfdb('0x53')],_0x1aff71[_0xdfdb('0x54')],_0x1aff71[_0xdfdb('0x55')],_0x1aff71['smsPause'],_0x1aff71[_0xdfdb('0x56')],_0x1aff71[_0xdfdb('0x57')]];if(!_0x2f1d06)return _['every'](_0x4bbb88);var _0x3a6ce2=_[_0xdfdb('0x3f')](_0x4bbb88);return _0x3a6ce2[_0xdfdb('0x41')]>0x0&&_0x3a6ce2[_0xdfdb('0x41')]<_0x4bbb88[_0xdfdb('0x41')]?!![]:![];}function isAgentIdle(_0x10b490){if(_0x10b490[_0xdfdb('0x4a')]!==_0xdfdb('0x4f')&&_0x10b490[_0xdfdb('0x56')]){_0x10b490['voiceStatus']=_0xdfdb('0x58');return![];}return _['every']([_0x10b490[_0xdfdb('0x59')],_0x10b490[_0xdfdb('0x5a')],_0x10b490[_0xdfdb('0x5b')],_0x10b490[_0xdfdb('0x5c')],_0x10b490[_0xdfdb('0x5d')],_0x10b490[_0xdfdb('0x4a')],_0x10b490[_0xdfdb('0x5e')]],isIdle);}function getAgentStatus(_0x480e98){var _0x2a5803=_0xdfdb('0x50');if(isAgentPaused(_0x480e98))_0x2a5803=_0xdfdb('0x58');else if(isAgentPaused(_0x480e98,!![]))_0x2a5803=_0xdfdb('0x5f');else if(isAgentIdle(_0x480e98))_0x2a5803=_0xdfdb('0x4f');else _0x2a5803='busy';return _0x2a5803;}exports[_0xdfdb('0x60')]=function(_0x4df3b6,_0x9bbf0e){var _0x1331eb={'count':0x0,'rows':[]},_0xdd48cd={},_0x6d7407,_0x3f10fe,_0x5e7388=[_0xdfdb('0x61'),'online',_0xdfdb('0x62'),_0xdfdb('0x63'),_0xdfdb('0x64'),'lastPauseAt',_0xdfdb('0x44'),_0xdfdb('0x65'),_0xdfdb('0x52'),_0xdfdb('0x55'),_0xdfdb('0x54'),_0xdfdb('0x66'),'whatsappPause','faxPause',_0xdfdb('0x56'),'chatCapacity','openchannelCapacity','mailCapacity',_0xdfdb('0x67'),_0xdfdb('0x68'),_0xdfdb('0x69'),_0xdfdb('0x6a'),_0xdfdb('0x6b'),_0xdfdb('0x6c'),_0xdfdb('0x6d'),_0xdfdb('0x6e'),_0xdfdb('0x6f'),'chatStatus','openchannelStatus',_0xdfdb('0x5b'),'smsStatus',_0xdfdb('0x5e'),_0xdfdb('0x5a'),_0xdfdb('0x4a'),'chatStatusTime',_0xdfdb('0x70'),_0xdfdb('0x71'),_0xdfdb('0x72'),_0xdfdb('0x73'),_0xdfdb('0x74'),_0xdfdb('0x75'),_0xdfdb('0x40'),_0xdfdb('0x76'),'screenrecording',_0xdfdb('0x77'),_0xdfdb('0x78'),'routealias'],_0x3fbbb5=[_0xdfdb('0x52'),_0xdfdb('0x55'),_0xdfdb('0x54'),_0xdfdb('0x66'),'whatsappPause','faxPause',_0xdfdb('0x56'),_0xdfdb('0x49')];Promise['resolve']()[_0xdfdb('0x15')](function(){var _0x2b8776=_[_0xdfdb('0x36')](db['User']['rawAttributes'],function(_0x42ad97){return{'name':_0x42ad97[_0xdfdb('0x79')],'type':_0x42ad97['type']['key']};});_0x4df3b6[_0xdfdb('0x7a')]['role']='agent';_0x4df3b6[_0xdfdb('0x7a')]['online']=!![];_0xdd48cd=qs[_0xdfdb('0x7b')](_0x2b8776,_0x4df3b6);_0xdd48cd[_0xdfdb('0x7c')]=!![];if(_0x4df3b6['user']['role']===_0xdfdb('0x7d')){var _0x2a218a={'params':{'id':_0x4df3b6['user'][_0xdfdb('0x7e')]},'query':{'section':_0xdfdb('0x14'),'role':_0xdfdb('0x7f'),'online':!![],'nolimit':_0x4df3b6[_0xdfdb('0x7a')][_0xdfdb('0x80')],'sort':_0x4df3b6['query']['sort'],'filter':_0x4df3b6[_0xdfdb('0x7a')][_0xdfdb('0x3f')],'raw':!![]}};return db[_0xdfdb('0x81')][_0xdfdb('0x82')](_0x2a218a);}return db[_0xdfdb('0x4c')][_0xdfdb('0x83')](_0xdd48cd);})['then'](function(_0xd226af){_0x1331eb[_0xdfdb('0xb')]=_0xd226af[_0xdfdb('0xb')];_0x6d7407=_0xd226af[_0xdfdb('0x84')];return getRealtimeAgents();})[_0xdfdb('0x15')](function(_0x1bcfdd){_0x3f10fe=_0x1bcfdd[_0xdfdb('0x84')];return _0x6d7407[_0xdfdb('0x36')](function(_0x38fa9c){var _0x3eca7f=_['find'](_0x3f10fe,['id',_0x38fa9c['id']]);if(_0x3eca7f)_[_0xdfdb('0x19')](_0x38fa9c,_[_0xdfdb('0x3e')](_[_0xdfdb('0x85')](_0x3eca7f,_0x3fbbb5),_0x5e7388));_0x38fa9c[_0xdfdb('0x86')]=getAgentStatus(_0x38fa9c);return _0x38fa9c;});})[_0xdfdb('0x15')](function(_0x590a16){if(_0x4df3b6[_0xdfdb('0x7a')][_0xdfdb('0x87')]){var _0x234882=_[_0xdfdb('0x3f')](_0x590a16,['globalStatus',_0x4df3b6[_0xdfdb('0x7a')][_0xdfdb('0x87')]]);if(_0x4df3b6[_0xdfdb('0x7a')][_0xdfdb('0x88')]){_0x234882=_[_0xdfdb('0x3f')](_0x234882,[_0xdfdb('0x64'),_0x4df3b6[_0xdfdb('0x7a')][_0xdfdb('0x88')]]);}}_0x1331eb[_0xdfdb('0x84')]=_0x234882||_0x590a16;return _0x1331eb;})[_0xdfdb('0x15')](respondWithFilteredResult(_0x9bbf0e,_0xdd48cd))[_0xdfdb('0x1a')](handleError(_0x9bbf0e,null));};exports['getQueues']=function(_0x1bf0d2,_0x616d29){var _0x5ad38a=[_0xdfdb('0x89'),_0xdfdb('0x8a'),_0xdfdb('0x8b'),'openchannel','fax','whatsapp',_0xdfdb('0x3b')];var _0x465565={'count':0x0,'rows':[]},_0x1c7964={},_0x8e68a8,_0xd4b817,_0x394536,_0xf60176,_0x4b2c31;Promise[_0xdfdb('0x8c')]()[_0xdfdb('0x15')](function(){if(_0x1bf0d2[_0xdfdb('0x7a')][_0xdfdb('0x8d')]){if(!_[_0xdfdb('0x8e')](_0x5ad38a,_0x1bf0d2[_0xdfdb('0x7a')][_0xdfdb('0x8d')]['toLowerCase']()))throw new Error(_0xdfdb('0x8f'));_0x8e68a8=_0x1bf0d2[_0xdfdb('0x7a')][_0xdfdb('0x8d')][_0xdfdb('0x90')]();}var _0x275e5f=_['startCase'](_0x8e68a8)+_0xdfdb('0x4d');var _0x56a633=_[_0xdfdb('0x36')](db[_0x275e5f][_0xdfdb('0x91')],function(_0x18c6d1){return{'name':_0x18c6d1[_0xdfdb('0x79')],'type':_0x18c6d1[_0xdfdb('0x92')]['key']};});_0x1c7964=qs[_0xdfdb('0x7b')](_0x56a633,_0x1bf0d2);if(_0x1bf0d2[_0xdfdb('0x7d')]['role']==='user'){var _0x284439={'params':{'id':_0x1bf0d2['user']['userProfileId']},'query':{'section':_0x8e68a8===_0xdfdb('0x3b')&&_0x1bf0d2[_0xdfdb('0x7a')][_0xdfdb('0x92')]===_0xdfdb('0x22')?_0xdfdb('0x93'):_[_0xdfdb('0x1b')](_0x8e68a8)+_0xdfdb('0x1c'),'type':_0x1bf0d2[_0xdfdb('0x7a')]['type'],'nolimit':!![],'sort':_0xdfdb('0x12'),'filter':_0x1bf0d2['query'][_0xdfdb('0x3f')]}};return db[_0xdfdb('0x81')][_0xdfdb('0x82')](_0x284439);}return db[_0x275e5f][_0xdfdb('0x83')](_0x1c7964);})[_0xdfdb('0x15')](function(_0x52a8a5){_0x465565[_0xdfdb('0xb')]=_0x52a8a5[_0xdfdb('0xb')];_0xd4b817=_0x52a8a5[_0xdfdb('0x84')];return getRealtimeQueues(_0x1bf0d2,_0x8e68a8);})[_0xdfdb('0x15')](function(_0x36241c){_0xf60176=_0x36241c['rows'];return getRealtimeAgents();})['then'](function(_0x231f20){_0x394536=_0x231f20[_0xdfdb('0x84')];if(_0x8e68a8!='voice')return;return getRealtimeVoiceQueueChannels();})[_0xdfdb('0x15')](function(_0x50d5d4){_0x4b2c31=_0x50d5d4?_0x50d5d4[_0xdfdb('0x84')]:[];return initializeQueues(_0xd4b817,_0xf60176,_0x8e68a8,_0x1bf0d2[_0xdfdb('0x7a')][_0xdfdb('0x92')]);})['then'](function(_0x2828a5){var _0x53ca83=_0x2828a5['map'](function(_0x3eb36e){if(_0x8e68a8==='voice')return getVoiceQueueAgents(_0x3eb36e,_0xd4b817,_0x394536,_0x4b2c31);else return getQueueAgents(_0x3eb36e,_0x394536,_0x8e68a8);});return Promise[_0xdfdb('0x94')](_0x53ca83);})[_0xdfdb('0x15')](function(_0x162eeb){_0x465565[_0xdfdb('0x84')]=_0x162eeb;return _0x465565;})[_0xdfdb('0x15')](respondWithFilteredResult(_0x616d29,_0x1c7964))[_0xdfdb('0x1a')](handleError(_0x616d29,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 49379ea..82170a2 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xc04d9b,_0x5a1450){var _0x26691e=function(_0x50daaa){while(--_0x50daaa){_0xc04d9b['push'](_0xc04d9b['shift']());}};_0x26691e(++_0x5a1450);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x597484,_0x199340){_0x597484=_0x597484-0x0;var _0x218e64=_0xcb91[_0x597484];return _0x218e64;};'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(_0x1c7dae,_0x2e6a60){var _0x3a30fa=function(_0x2a1c73){while(--_0x2a1c73){_0x1c7dae['push'](_0x1c7dae['shift']());}};_0x3a30fa(++_0x2e6a60);}(_0x70e0,0x17b));var _0x070e=function(_0x294010,_0x3fad87){_0x294010=_0x294010-0x0;var _0x256af2=_0x70e0[_0x294010];return _0x256af2;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 418027a..ad04f86 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 _0xf9d5=['DATE','STRING','exports','INTEGER'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xf9d5,0x122));var _0x5f9d=function(_0x15ec27,_0x2b9c73){_0x15ec27=_0x15ec27-0x0;var _0x4421f8=_0xf9d5[_0x15ec27];return _0x4421f8;};'use strict';var Sequelize=require('sequelize');module[_0x5f9d('0x0')]={'state':{'type':Sequelize[_0x5f9d('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x5f9d('0x2')]},'uniqueid':{'type':Sequelize[_0x5f9d('0x3')]},'starttime':{'type':Sequelize[_0x5f9d('0x2')]},'responsetime':{'type':Sequelize[_0x5f9d('0x2')]},'ringtime':{'type':Sequelize[_0x5f9d('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x5f9d('0x3')]},'campaigntype':{'type':Sequelize[_0x5f9d('0x3')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1751=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x46a021,_0x38122f){var _0x13e38a=function(_0x3b150b){while(--_0x3b150b){_0x46a021['push'](_0x46a021['shift']());}};_0x13e38a(++_0x38122f);}(_0x1751,0x76));var _0x1175=function(_0xb9dfbb,_0x335f54){_0xb9dfbb=_0xb9dfbb-0x0;var _0x2848d8=_0x1751[_0xb9dfbb];return _0x2848d8;};'use strict';var Sequelize=require(_0x1175('0x0'));module[_0x1175('0x1')]={'state':{'type':Sequelize[_0x1175('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x1175('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x1175('0x3')]},'starttime':{'type':Sequelize[_0x1175('0x4')]},'responsetime':{'type':Sequelize[_0x1175('0x4')]},'ringtime':{'type':Sequelize[_0x1175('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x1175('0x3')]},'campaigntype':{'type':Sequelize[_0x1175('0x3')]},'membername':{'type':Sequelize[_0x1175('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 613015f..d48b21c 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 _0x07ec=['moment','bluebird','request-promise','path','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','api'];(function(_0x4c7317,_0x4c8672){var _0x10cf49=function(_0x5f28d9){while(--_0x5f28d9){_0x4c7317['push'](_0x4c7317['shift']());}};_0x10cf49(++_0x4c8672);}(_0x07ec,0x19f));var _0xc07e=function(_0x3b1e3f,_0xf8826b){_0x3b1e3f=_0x3b1e3f-0x0;var _0x3b1cd3=_0x07ec[_0x3b1e3f];return _0x3b1cd3;};'use strict';var _=require(_0xc07e('0x0'));var util=require(_0xc07e('0x1'));var logger=require('../../config/logger')(_0xc07e('0x2'));var moment=require(_0xc07e('0x3'));var BPromise=require(_0xc07e('0x4'));var rp=require(_0xc07e('0x5'));var fs=require('fs');var path=require(_0xc07e('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./reportAgentPreview.attributes');module[_0xc07e('0x7')]=function(_0x1bff32,_0x42d231){return _0x1bff32[_0xc07e('0x8')](_0xc07e('0x9'),attributes,{'tableName':_0xc07e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0bef=['./reportAgentPreview.attributes','exports','define','report_agent_preview','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0xd299c3,_0x4ba0f1){var _0x376574=function(_0xc585f){while(--_0xc585f){_0xd299c3['push'](_0xd299c3['shift']());}};_0x376574(++_0x4ba0f1);}(_0x0bef,0xca));var _0xf0be=function(_0xf6a61d,_0x4598f4){_0xf6a61d=_0xf6a61d-0x0;var _0xa47f4b=_0x0bef[_0xf6a61d];return _0xa47f4b;};'use strict';var _=require('lodash');var util=require(_0xf0be('0x0'));var logger=require(_0xf0be('0x1'))(_0xf0be('0x2'));var moment=require('moment');var BPromise=require(_0xf0be('0x3'));var rp=require(_0xf0be('0x4'));var fs=require('fs');var path=require(_0xf0be('0x5'));var rimraf=require('rimraf');var config=require(_0xf0be('0x6'));var attributes=require(_0xf0be('0x7'));module[_0xf0be('0x8')]=function(_0x25c475,_0x2fb419){return _0x25c475[_0xf0be('0x9')]('ReportAgentPreview',attributes,{'tableName':_0xf0be('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 45c89c3..061ac54 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 _0x9203=['../../config/utils','../../config/logger','jayson/promise','client','http','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x29ff5e,_0x220788){var _0xd8135a=function(_0x3a0136){while(--_0x3a0136){_0x29ff5e['push'](_0x29ff5e['shift']());}};_0xd8135a(++_0x220788);}(_0x9203,0x183));var _0x3920=function(_0x542d6b,_0x1615bd){_0x542d6b=_0x542d6b-0x0;var _0x22d616=_0x9203[_0x542d6b];return _0x22d616;};'use strict';var _=require(_0x3920('0x0'));var util=require('util');var moment=require(_0x3920('0x1'));var BPromise=require('bluebird');var rs=require(_0x3920('0x2'));var fs=require('fs');var Redis=require(_0x3920('0x3'));var db=require(_0x3920('0x4'))['db'];var utils=require(_0x3920('0x5'));var logger=require(_0x3920('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3920('0x7'));var client=jayson[_0x3920('0x8')][_0x3920('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b6236,_0x3163bf,_0x4f66ec){return new BPromise(function(_0x2e2424,_0x5e1424){return client[_0x3920('0xa')](_0x3b6236,_0x4f66ec)[_0x3920('0xb')](function(_0x3d18a9){logger['info'](_0x3920('0xc'),_0x3163bf,_0x3920('0xd'));logger[_0x3920('0xe')](_0x3920('0xf'),_0x3163bf,'request\x20sent',JSON['stringify'](_0x3d18a9));if(_0x3d18a9[_0x3920('0x10')]){if(_0x3d18a9[_0x3920('0x10')][_0x3920('0x11')]===0x1f4){logger[_0x3920('0x10')](_0x3920('0xc'),_0x3163bf,_0x3d18a9['error'][_0x3920('0x12')]);return _0x5e1424(_0x3d18a9['error'][_0x3920('0x12')]);}logger[_0x3920('0x10')](_0x3920('0xc'),_0x3163bf,_0x3d18a9[_0x3920('0x10')][_0x3920('0x12')]);return _0x2e2424(_0x3d18a9[_0x3920('0x10')][_0x3920('0x12')]);}else{logger[_0x3920('0x13')](_0x3920('0xc'),_0x3163bf,_0x3920('0xd'));_0x2e2424(_0x3d18a9[_0x3920('0x14')][_0x3920('0x12')]);}})[_0x3920('0x15')](function(_0x5b6e06){logger['error'](_0x3920('0xc'),_0x3163bf,_0x5b6e06);_0x5e1424(_0x5b6e06);});});}exports[_0x3920('0x16')]=function(_0x301977){var _0x451ac2=this;return new Promise(function(_0x1ac8e9,_0x29c3e7){return db[_0x3920('0x17')][_0x3920('0x18')](_0x301977[_0x3920('0x19')],{'raw':_0x301977[_0x3920('0x1a')]?_0x301977[_0x3920('0x1a')][_0x3920('0x1b')]===undefined?!![]:![]:!![]})[_0x3920('0xb')](function(_0x17dba6){logger[_0x3920('0x13')](_0x3920('0x16'),_0x301977);logger[_0x3920('0xe')](_0x3920('0x16'),_0x301977,JSON['stringify'](_0x17dba6));_0x1ac8e9(_0x17dba6);})[_0x3920('0x15')](function(_0x32d2b5){logger[_0x3920('0x10')](_0x3920('0x16'),_0x32d2b5[_0x3920('0x12')],_0x301977);_0x29c3e7(_0x451ac2[_0x3920('0x10')](0x1f4,_0x32d2b5[_0x3920('0x12')]));});});}; \ No newline at end of file +var _0xc878=['CreateReportAgentPreview','ReportAgentPreview','body','options','raw','info','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','request\x20sent','debug','stringify','error','code','message','ReportAgentPreview,\x20%s,\x20%s'];(function(_0x45e3d0,_0x354c89){var _0x5a67ad=function(_0xc02054){while(--_0xc02054){_0x45e3d0['push'](_0x45e3d0['shift']());}};_0x5a67ad(++_0x354c89);}(_0xc878,0x10f));var _0x8c87=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc878[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8c87('0x0'));var BPromise=require(_0x8c87('0x1'));var rs=require(_0x8c87('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c87('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8c87('0x4'))(_0x8c87('0x5'));var config=require(_0x8c87('0x6'));var jayson=require(_0x8c87('0x7'));var client=jayson['client'][_0x8c87('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x306936,_0x231b03,_0x257bb5){return new BPromise(function(_0x3896ed,_0x3ed783){return client['request'](_0x306936,_0x257bb5)[_0x8c87('0x9')](function(_0x2387c9){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x231b03,_0x8c87('0xa'));logger[_0x8c87('0xb')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x231b03,_0x8c87('0xa'),JSON[_0x8c87('0xc')](_0x2387c9));if(_0x2387c9[_0x8c87('0xd')]){if(_0x2387c9[_0x8c87('0xd')][_0x8c87('0xe')]===0x1f4){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x231b03,_0x2387c9[_0x8c87('0xd')][_0x8c87('0xf')]);return _0x3ed783(_0x2387c9[_0x8c87('0xd')][_0x8c87('0xf')]);}logger[_0x8c87('0xd')](_0x8c87('0x10'),_0x231b03,_0x2387c9['error'][_0x8c87('0xf')]);return _0x3896ed(_0x2387c9[_0x8c87('0xd')][_0x8c87('0xf')]);}else{logger['info'](_0x8c87('0x10'),_0x231b03,_0x8c87('0xa'));_0x3896ed(_0x2387c9['result']['message']);}})['catch'](function(_0x21d87f){logger['error'](_0x8c87('0x10'),_0x231b03,_0x21d87f);_0x3ed783(_0x21d87f);});});}exports[_0x8c87('0x11')]=function(_0x29efa5){var _0x27d4c7=this;return new Promise(function(_0x28a533,_0x1f372e){return db[_0x8c87('0x12')]['create'](_0x29efa5[_0x8c87('0x13')],{'raw':_0x29efa5[_0x8c87('0x14')]?_0x29efa5['options'][_0x8c87('0x15')]===undefined?!![]:![]:!![]})[_0x8c87('0x9')](function(_0x2f7371){logger[_0x8c87('0x16')](_0x8c87('0x11'),_0x29efa5);logger['debug'](_0x8c87('0x11'),_0x29efa5,JSON[_0x8c87('0xc')](_0x2f7371));_0x28a533(_0x2f7371);})[_0x8c87('0x17')](function(_0x374a0c){logger[_0x8c87('0xd')](_0x8c87('0x11'),_0x374a0c[_0x8c87('0xf')],_0x29efa5);_0x1f372e(_0x27d4c7[_0x8c87('0xd')](0x1f4,_0x374a0c[_0x8c87('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index d598a8d..3fb59df 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 _0x154a=['/mail/accounts','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','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','/mail/queues/:id/notify','queueNotify','showMailQueues','post','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues'];(function(_0x36dc72,_0x41db1e){var _0x1710b5=function(_0x395e5c){while(--_0x395e5c){_0x36dc72['push'](_0x36dc72['shift']());}};_0x1710b5(++_0x41db1e);}(_0x154a,0x19d));var _0xa154=function(_0x8647a7,_0x2cc4c6){_0x8647a7=_0x8647a7-0x0;var _0x266151=_0x154a[_0x8647a7];return _0x266151;};'use strict';var multer=require(_0xa154('0x0'));var util=require(_0xa154('0x1'));var path=require('path');var express=require(_0xa154('0x2'));var router=express[_0xa154('0x3')]();var auth=require(_0xa154('0x4'));var controller=require(_0xa154('0x5'));router[_0xa154('0x6')](_0xa154('0x7'),auth['isAuthenticated'](),controller['voiceChannels']);router[_0xa154('0x6')](_0xa154('0x8'),auth[_0xa154('0x9')](),controller['voiceChannelMixMonitor']);router[_0xa154('0x6')](_0xa154('0xa'),auth['isAuthenticated'](),controller['voiceChannelStopMixMonitor']);router[_0xa154('0x6')](_0xa154('0xb'),auth[_0xa154('0x9')](),controller[_0xa154('0xc')]);router[_0xa154('0x6')](_0xa154('0xd'),auth[_0xa154('0x9')](),controller[_0xa154('0xe')]);router[_0xa154('0x6')](_0xa154('0xf'),auth[_0xa154('0x9')](),controller[_0xa154('0x10')]);router[_0xa154('0x6')](_0xa154('0x11'),auth[_0xa154('0x9')](),controller[_0xa154('0x12')]);router[_0xa154('0x6')](_0xa154('0x13'),auth[_0xa154('0x9')](),controller['openchannelQueues']);router['get'](_0xa154('0x14'),auth[_0xa154('0x9')](),controller[_0xa154('0x15')]);router['get'](_0xa154('0x16'),auth[_0xa154('0x9')](),controller[_0xa154('0x17')]);router['get'](_0xa154('0x18'),auth[_0xa154('0x9')](),controller[_0xa154('0x19')]);router[_0xa154('0x6')](_0xa154('0x1a'),auth['isAuthenticated'](),controller[_0xa154('0x1b')]);router[_0xa154('0x6')](_0xa154('0x1c'),auth[_0xa154('0x9')](),controller[_0xa154('0x1d')]);router[_0xa154('0x6')](_0xa154('0x1e'),auth['isAuthenticated'](),controller['voiceQueuesChannel']);router[_0xa154('0x6')]('/voice/queues/channels/:uniqueid/hangup',auth[_0xa154('0x9')](),controller['voiceQueuesChannelHangup']);router['get'](_0xa154('0x1f'),auth['isAuthenticated'](),controller[_0xa154('0x20')]);router[_0xa154('0x6')](_0xa154('0x21'),auth[_0xa154('0x9')](),controller['showVoiceQueues']);router['put'](_0xa154('0x21'),auth[_0xa154('0x9')](),controller[_0xa154('0x22')]);router['get'](_0xa154('0x23'),auth['isAuthenticated'](),controller[_0xa154('0x24')]);router[_0xa154('0x6')](_0xa154('0x25'),auth[_0xa154('0x9')](),controller[_0xa154('0x26')]);router[_0xa154('0x6')]('/agents',auth[_0xa154('0x9')](),controller[_0xa154('0x27')]);router[_0xa154('0x28')](_0xa154('0x29'),auth['isAuthenticated'](),controller[_0xa154('0x2a')]);router[_0xa154('0x6')](_0xa154('0x2b'),auth[_0xa154('0x9')](),controller[_0xa154('0x2c')]);router[_0xa154('0x6')](_0xa154('0x2d'),auth['isAuthenticated'](),controller[_0xa154('0x2e')]);router[_0xa154('0x6')](_0xa154('0x2f'),auth[_0xa154('0x9')](),controller[_0xa154('0x30')]);router['get'](_0xa154('0x31'),auth['isAuthenticated'](),controller[_0xa154('0x32')]);router[_0xa154('0x6')](_0xa154('0x33'),auth[_0xa154('0x9')](),controller[_0xa154('0x34')]);router[_0xa154('0x6')](_0xa154('0x35'),auth[_0xa154('0x9')](),controller['mailQueuesWaitingInteractions']);router['get'](_0xa154('0x36'),auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router[_0xa154('0x6')](_0xa154('0x37'),auth[_0xa154('0x9')](),controller[_0xa154('0x38')]);router[_0xa154('0x6')](_0xa154('0x39'),auth[_0xa154('0x9')](),controller[_0xa154('0x3a')]);router['get'](_0xa154('0x3b'),auth[_0xa154('0x9')](),controller[_0xa154('0x3c')]);router[_0xa154('0x6')](_0xa154('0x3d'),auth[_0xa154('0x9')](),controller['faxQueuesWaitingInteractions']);router['post'](_0xa154('0x3e'),auth[_0xa154('0x9')](),controller[_0xa154('0x3f')]('mail'));router['get']('/mail/queues/:id',auth[_0xa154('0x9')](),controller[_0xa154('0x40')]);router[_0xa154('0x41')](_0xa154('0x42'),auth[_0xa154('0x9')](),controller[_0xa154('0x3f')]('chat'));router[_0xa154('0x6')](_0xa154('0x43'),auth[_0xa154('0x9')](),controller[_0xa154('0x44')]);router[_0xa154('0x41')](_0xa154('0x45'),auth['isAuthenticated'](),controller[_0xa154('0x3f')]('fax'));router[_0xa154('0x6')](_0xa154('0x46'),auth['isAuthenticated'](),controller[_0xa154('0x47')]);router[_0xa154('0x41')](_0xa154('0x48'),auth[_0xa154('0x9')](),controller[_0xa154('0x3f')](_0xa154('0x49')));router['get'](_0xa154('0x4a'),auth[_0xa154('0x9')](),controller[_0xa154('0x4b')]);router['post'](_0xa154('0x4c'),auth[_0xa154('0x9')](),controller['queueNotify'](_0xa154('0x4d')));router['post'](_0xa154('0x4e'),auth[_0xa154('0x9')](),controller[_0xa154('0x3f')](_0xa154('0x4f')));router[_0xa154('0x6')](_0xa154('0x50'),auth[_0xa154('0x9')](),controller[_0xa154('0x51')]);router['get'](_0xa154('0x52'),auth[_0xa154('0x9')](),controller[_0xa154('0x53')]);router[_0xa154('0x41')](_0xa154('0x54'),auth[_0xa154('0x9')](),controller[_0xa154('0x55')]);module['exports']=router; \ No newline at end of file +var _0x9471=['telephones','trunks','/campaigns','campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','put','updateVoiceQueue','/outbound/channels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x9471,0x1ad));var _0x1947=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9471[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1947('0x0'));var util=require(_0x1947('0x1'));var path=require(_0x1947('0x2'));var express=require(_0x1947('0x3'));var router=express[_0x1947('0x4')]();var auth=require(_0x1947('0x5'));var controller=require(_0x1947('0x6'));router[_0x1947('0x7')](_0x1947('0x8'),auth[_0x1947('0x9')](),controller[_0x1947('0xa')]);router[_0x1947('0x7')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x1947('0x9')](),controller[_0x1947('0xb')]);router[_0x1947('0x7')](_0x1947('0xc'),auth[_0x1947('0x9')](),controller['voiceChannelStopMixMonitor']);router[_0x1947('0x7')](_0x1947('0xd'),auth[_0x1947('0x9')](),controller[_0x1947('0xe')]);router[_0x1947('0x7')](_0x1947('0xf'),auth[_0x1947('0x9')](),controller[_0x1947('0x10')]);router['get']('/mail/queues',auth[_0x1947('0x9')](),controller[_0x1947('0x11')]);router[_0x1947('0x7')](_0x1947('0x12'),auth[_0x1947('0x9')](),controller[_0x1947('0x13')]);router[_0x1947('0x7')](_0x1947('0x14'),auth[_0x1947('0x9')](),controller['openchannelQueues']);router[_0x1947('0x7')](_0x1947('0x15'),auth[_0x1947('0x9')](),controller[_0x1947('0x16')]);router[_0x1947('0x7')]('/whatsapp/queues',auth['isAuthenticated'](),controller[_0x1947('0x17')]);router[_0x1947('0x7')]('/fax/queues',auth[_0x1947('0x9')](),controller[_0x1947('0x18')]);router['get'](_0x1947('0x19'),auth[_0x1947('0x9')](),controller[_0x1947('0x1a')]);router[_0x1947('0x7')]('/voice/queues/channels',auth['isAuthenticated'](),controller[_0x1947('0x1b')]);router[_0x1947('0x7')]('/voice/queues/channels/:uniqueid',auth[_0x1947('0x9')](),controller['voiceQueuesChannel']);router[_0x1947('0x7')]('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller['voiceQueuesChannelHangup']);router[_0x1947('0x7')](_0x1947('0x1c'),auth[_0x1947('0x9')](),controller[_0x1947('0x1d')]);router['get'](_0x1947('0x1e'),auth['isAuthenticated'](),controller['showVoiceQueues']);router[_0x1947('0x1f')]('/voice/queues/:id',auth[_0x1947('0x9')](),controller[_0x1947('0x20')]);router[_0x1947('0x7')]('/outbound',auth[_0x1947('0x9')](),controller['outbound']);router[_0x1947('0x7')](_0x1947('0x21'),auth[_0x1947('0x9')](),controller['outboundChannels']);router['get'](_0x1947('0x22'),auth['isAuthenticated'](),controller[_0x1947('0x23')]);router[_0x1947('0x1f')](_0x1947('0x24'),auth[_0x1947('0x9')](),controller[_0x1947('0x25')]);router[_0x1947('0x7')](_0x1947('0x26'),auth[_0x1947('0x9')](),controller[_0x1947('0x27')]);router[_0x1947('0x7')]('/trunks',auth[_0x1947('0x9')](),controller[_0x1947('0x28')]);router[_0x1947('0x7')](_0x1947('0x29'),auth[_0x1947('0x9')](),controller[_0x1947('0x2a')]);router[_0x1947('0x7')](_0x1947('0x2b'),auth[_0x1947('0x9')](),controller['faxAccounts']);router[_0x1947('0x7')](_0x1947('0x2c'),auth[_0x1947('0x9')](),controller[_0x1947('0x2d')]);router[_0x1947('0x7')](_0x1947('0x2e'),auth[_0x1947('0x9')](),controller[_0x1947('0x2f')]);router[_0x1947('0x7')](_0x1947('0x30'),auth['isAuthenticated'](),controller[_0x1947('0x31')]);router['get']('/openchannel/queues/:id/waitinginteractions',auth[_0x1947('0x9')](),controller[_0x1947('0x32')]);router[_0x1947('0x7')]('/sms/queues/waitinginteractions',auth[_0x1947('0x9')](),controller[_0x1947('0x33')]);router[_0x1947('0x7')](_0x1947('0x34'),auth[_0x1947('0x9')](),controller['whatsappQueuesWaitingInteractions']);router[_0x1947('0x7')](_0x1947('0x35'),auth[_0x1947('0x9')](),controller['faxQueuesWaitingInteractions']);router[_0x1947('0x36')](_0x1947('0x37'),auth[_0x1947('0x9')](),controller[_0x1947('0x38')](_0x1947('0x39')));router[_0x1947('0x7')](_0x1947('0x3a'),auth[_0x1947('0x9')](),controller[_0x1947('0x3b')]);router['post'](_0x1947('0x3c'),auth[_0x1947('0x9')](),controller[_0x1947('0x38')](_0x1947('0x3d')));router['get'](_0x1947('0x3e'),auth[_0x1947('0x9')](),controller['showChatQueues']);router['post']('/fax/queues/:id/notify',auth[_0x1947('0x9')](),controller['queueNotify'](_0x1947('0x3f')));router['get']('/fax/queues/:id',auth[_0x1947('0x9')](),controller[_0x1947('0x40')]);router['post'](_0x1947('0x41'),auth[_0x1947('0x9')](),controller[_0x1947('0x38')](_0x1947('0x42')));router[_0x1947('0x7')](_0x1947('0x43'),auth[_0x1947('0x9')](),controller['showOpenchannelQueues']);router['post']('/sms/queues/:id/notify',auth[_0x1947('0x9')](),controller['queueNotify'](_0x1947('0x44')));router['post'](_0x1947('0x45'),auth[_0x1947('0x9')](),controller[_0x1947('0x38')](_0x1947('0x46')));router[_0x1947('0x7')](_0x1947('0x47'),auth['isAuthenticated'](),controller[_0x1947('0x48')]);router[_0x1947('0x7')](_0x1947('0x49'),auth[_0x1947('0x9')](),controller[_0x1947('0x4a')]);router[_0x1947('0x36')](_0x1947('0x4b'),auth['isAuthenticated'](),controller[_0x1947('0x4c')]);module[_0x1947('0x4d')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 571e9b3..5fe21b8 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 _0xeda8=['TransferReport','agentTransferTimeout','bluebird','moment','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','error','code','result','catch','status','json','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','then','voiceChannelMixMonitor','VoiceChannelMixMonitor','voiceChannelStopMixMonitor','params','voiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','VoiceQueuesPreview','merge','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','outboundChannels','agents','Agents','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','uniq','value','filter','indexOf','queue_id','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','Website','Account','Queue','\x20Queue\x20not\x20found','Message','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','QueueId','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User'];(function(_0x19c4bd,_0x19a00d){var _0x2fc7b5=function(_0x24fdab){while(--_0x24fdab){_0x19c4bd['push'](_0x19c4bd['shift']());}};_0x2fc7b5(++_0x19a00d);}(_0xeda8,0x104));var _0x8eda=function(_0x375d35,_0x49037e){_0x375d35=_0x375d35-0x0;var _0x28d0b8=_0xeda8[_0x375d35];return _0x28d0b8;};'use strict';var BPromise=require(_0x8eda('0x0'));var moment=require(_0x8eda('0x1'));var _=require('lodash');var util=require(_0x8eda('0x2'));var db=require(_0x8eda('0x3'))['db'];var logger=require(_0x8eda('0x4'))(_0x8eda('0x5'));var jayson=require(_0x8eda('0x6'));var amiClient=jayson[_0x8eda('0x7')][_0x8eda('0x8')]({'port':0x232a});var mailClient=jayson[_0x8eda('0x7')][_0x8eda('0x8')]({'port':0x232b});var routingClient=jayson[_0x8eda('0x7')][_0x8eda('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x32abe8,_0x4e2ebb,_0x28b721){return new BPromise(function(_0x1b6a1d,_0x5aa93d){var _0x6b544f=_0x28b721?_0x28b721:amiClient;return _0x6b544f['request'](_0x32abe8,_0x4e2ebb)['then'](function(_0x488849){if(_0x488849['error']){if(_0x488849[_0x8eda('0x9')][_0x8eda('0xa')]===0x1f4){return _0x5aa93d(_0x488849[_0x8eda('0x9')]['message']);}return _0x1b6a1d(_0x488849[_0x8eda('0x9')]['message']);}else{_0x1b6a1d(_0x488849[_0x8eda('0xb')]);}})[_0x8eda('0xc')](function(_0x2fdec0){_0x5aa93d(_0x2fdec0);});});}function respondWithResult(_0x1ad3df,_0x337573){_0x337573=_0x337573||0xc8;return function(_0x3af00c){if(_0x3af00c){return _0x1ad3df[_0x8eda('0xd')](_0x337573)[_0x8eda('0xe')](_0x3af00c);}return _0x1ad3df['sendStatus'](0x194);};}function handleError(_0x500bd4,_0xe04d90){_0xe04d90=_0xe04d90||0x1f4;return function(_0x223dcf){logger['error'](_0x223dcf[_0x8eda('0xf')]);if(_0x223dcf[_0x8eda('0x10')]){delete _0x223dcf[_0x8eda('0x10')];}_0x500bd4['status'](_0xe04d90)[_0x8eda('0x11')](_0x223dcf);};}function findById(_0x5594ad){return function(_0xf7d764){if(!_['isNil'](_0x5594ad)&&!_[_0x8eda('0x12')](_0xf7d764)&&!_['isNil'](_0xf7d764[_0x8eda('0x13')])){return _[_0x8eda('0x14')](_0xf7d764['rows'],function(_0x5e44b7){return _0x5e44b7['id']==_0x5594ad;});}return null;};}exports[_0x8eda('0x15')]=function(_0x1b7e94,_0x1b089d){return respondWithRpcPromise(_0x8eda('0x16'),_0x1b7e94[_0x8eda('0x17')])[_0x8eda('0x18')](respondWithResult(_0x1b089d,null))[_0x8eda('0xc')](handleError(_0x1b089d,null));};exports[_0x8eda('0x19')]=function(_0x850cce,_0x232786){return respondWithRpcPromise(_0x8eda('0x1a'),_['merge'](_0x850cce[_0x8eda('0x17')],_0x850cce['params']))[_0x8eda('0x18')](respondWithResult(_0x232786,null))['catch'](handleError(_0x232786,null));};exports[_0x8eda('0x1b')]=function(_0x2dab25,_0x4f3e0a){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_['merge'](_0x2dab25[_0x8eda('0x17')],_0x2dab25[_0x8eda('0x1c')]))['then'](respondWithResult(_0x4f3e0a,null))[_0x8eda('0xc')](handleError(_0x4f3e0a,null));};exports[_0x8eda('0x1d')]=function(_0x54aa7f,_0x25e955){return respondWithRpcPromise(_0x8eda('0x1e'),_0x54aa7f[_0x8eda('0x17')])[_0x8eda('0x18')](respondWithResult(_0x25e955,null))[_0x8eda('0xc')](handleError(_0x25e955,null));};exports['showVoiceQueues']=function(_0x41b5a9,_0x5a8bed){return respondWithRpcPromise(_0x8eda('0x1e'),_0x41b5a9[_0x8eda('0x17')])[_0x8eda('0x18')](findById(_0x41b5a9['params']['id']))[_0x8eda('0x18')](respondWithResult(_0x5a8bed,null))[_0x8eda('0xc')](handleError(_0x5a8bed,null));};exports[_0x8eda('0x1f')]=function(_0x4cdd2e,_0x1616ea){return respondWithRpcPromise(_0x8eda('0x20'),_['merge'](_0x4cdd2e[_0x8eda('0x21')],_0x4cdd2e[_0x8eda('0x1c')]))[_0x8eda('0x18')](respondWithResult(_0x1616ea,null))[_0x8eda('0xc')](handleError(_0x1616ea,null));};exports['voiceQueuesPreview']=function(_0x58dd55,_0x54513c){return respondWithRpcPromise(_0x8eda('0x22'),_[_0x8eda('0x23')](_0x58dd55[_0x8eda('0x17')],_0x58dd55['params']))['then'](respondWithResult(_0x54513c,null))['catch'](handleError(_0x54513c,null));};exports[_0x8eda('0x24')]=function(_0x48d52d,_0x31aaaf){return respondWithRpcPromise('VoiceQueuesChannels',_0x48d52d['query'])['then'](respondWithResult(_0x31aaaf,null))[_0x8eda('0xc')](handleError(_0x31aaaf,null));};exports[_0x8eda('0x25')]=function(_0x142f67,_0x2a3cdc){return respondWithRpcPromise(_0x8eda('0x26'),_[_0x8eda('0x23')](_0x142f67[_0x8eda('0x17')],_0x142f67[_0x8eda('0x1c')]))[_0x8eda('0x18')](respondWithResult(_0x2a3cdc,null))[_0x8eda('0xc')](handleError(_0x2a3cdc,null));};exports[_0x8eda('0x27')]=function(_0x3132fd,_0xc354d9){return respondWithRpcPromise(_0x8eda('0x28'),_['merge'](_0x3132fd[_0x8eda('0x17')],_0x3132fd[_0x8eda('0x1c')]))[_0x8eda('0x18')](respondWithResult(_0xc354d9,null))['catch'](handleError(_0xc354d9,null));};exports['voiceQueuesChannelRedirect']=function(_0x41c873,_0x36dc26){return respondWithRpcPromise(_0x8eda('0x29'),_[_0x8eda('0x23')](_0x41c873['query'],_0x41c873[_0x8eda('0x1c')]))[_0x8eda('0x18')](respondWithResult(_0x36dc26,null))[_0x8eda('0xc')](handleError(_0x36dc26,null));};exports[_0x8eda('0x2a')]=function(_0x567aa6,_0x29a706){return respondWithRpcPromise('Outbound',_0x567aa6[_0x8eda('0x17')])[_0x8eda('0x18')](respondWithResult(_0x29a706,null))[_0x8eda('0xc')](handleError(_0x29a706,null));};exports[_0x8eda('0x2b')]=function(_0x261e12,_0x32ce09){return respondWithRpcPromise('OutboundChannels',_0x261e12[_0x8eda('0x17')])[_0x8eda('0x18')](respondWithResult(_0x32ce09,null))[_0x8eda('0xc')](handleError(_0x32ce09,null));};exports[_0x8eda('0x2c')]=function(_0xa1e556,_0x5cf565){var _0x17ee80;return respondWithRpcPromise(_0x8eda('0x2d'),_0xa1e556[_0x8eda('0x17')])['then'](function(_0x408e00){_0x17ee80=_0x408e00;return respondWithRpcPromise('Agents',_0xa1e556[_0x8eda('0x17')],routingClient);})[_0x8eda('0x18')](function(_0x42d434){return _[_0x8eda('0x23')]({},_0x42d434,_0x17ee80);})[_0x8eda('0x18')](respondWithResult(_0x5cf565,null))['catch'](handleError(_0x5cf565,null));};exports['agentCapacity']=function(_0xbf14a1,_0xfcb278){if(_0xbf14a1[_0x8eda('0x21')]&&_0xbf14a1[_0x8eda('0x21')][_0x8eda('0x2e')]&&_0xbf14a1[_0x8eda('0x2f')]&&_0xbf14a1[_0x8eda('0x2f')][_0x8eda('0x10')]){for(var _0x184590 in _0xbf14a1[_0x8eda('0x21')][_0x8eda('0x2e')]){if(_0xbf14a1[_0x8eda('0x21')][_0x8eda('0x2e')][_0x8eda('0x30')](_0x184590)){db[_0x8eda('0x31')][_0x8eda('0x32')]({'where':{'channel':_0x184590,'membername':_0xbf14a1[_0x8eda('0x2f')][_0x8eda('0x10')],'type':_0x8eda('0x33'),'exitAt':null,'uniqueid':_0xbf14a1['body'][_0x8eda('0x2e')][_0x184590]&&_0xbf14a1[_0x8eda('0x21')]['interaction'][_0x184590][_0x8eda('0x34')]?{'$notIn':_0xbf14a1[_0x8eda('0x21')]['interaction'][_0x184590]}:{'$ne':null}}})[_0x8eda('0x18')](function(_0x1fff77){var _0x51f2a3=moment()[_0x8eda('0x35')](_0x8eda('0x36'));for(var _0x2a3546=0x0,_0x48ad47=_0x1fff77[_0x8eda('0x34')];_0x2a3546<_0x48ad47;_0x2a3546+=0x1){_0x1fff77[_0x2a3546][_0x8eda('0x37')]({'exitAt':_0x51f2a3});}});for(var _0x3996b7=0x0;_0x3996b7<_0xbf14a1[_0x8eda('0x21')][_0x8eda('0x2e')][_0x184590][_0x8eda('0x34')];_0x3996b7+=0x1){db[_0x8eda('0x31')]['findOrCreate']({'where':{'channel':_0x184590,'membername':_0xbf14a1[_0x8eda('0x2f')]['name'],'type':_0x8eda('0x33'),'uniqueid':_0xbf14a1['body'][_0x8eda('0x2e')][_0x184590][_0x3996b7],'exitAt':null},'defaults':{'channel':_0x184590,'membername':_0xbf14a1['user'][_0x8eda('0x10')],'interface':_['isNil'](_0xbf14a1[_0x8eda('0x2f')][_0x8eda('0x38')])?util[_0x8eda('0x35')](_0x8eda('0x39'),_0xbf14a1[_0x8eda('0x2f')][_0x8eda('0x10')]):_0xbf14a1[_0x8eda('0x2f')][_0x8eda('0x38')],'type':_0x8eda('0x33'),'enterAt':moment()[_0x8eda('0x35')](_0x8eda('0x36')),'role':_0x8eda('0x3a'),'internal':_0xbf14a1['user'][_0x8eda('0x3b')],'uniqueid':_0xbf14a1[_0x8eda('0x21')][_0x8eda('0x2e')][_0x184590][_0x3996b7]}});}}}}return respondWithRpcPromise(_0x8eda('0x3c'),{'id':_0xbf14a1[_0x8eda('0x1c')]['id'],'capacity':_0xbf14a1[_0x8eda('0x21')][_0x8eda('0x3d')]},routingClient)[_0x8eda('0x18')](respondWithResult(_0xfcb278,null))[_0x8eda('0xc')](handleError(_0xfcb278,null));};exports[_0x8eda('0x3e')]=function(_0x3e4242,_0x370ec2){return respondWithRpcPromise(_0x8eda('0x3f'),_0x3e4242[_0x8eda('0x17')])[_0x8eda('0x18')](respondWithResult(_0x370ec2,null))['catch'](handleError(_0x370ec2,null));};exports[_0x8eda('0x40')]=function(_0x142581,_0xabfddb){return respondWithRpcPromise(_0x8eda('0x41'),_0x142581[_0x8eda('0x17')])[_0x8eda('0x18')](respondWithResult(_0xabfddb,null))['catch'](handleError(_0xabfddb,null));};exports[_0x8eda('0x42')]=function(_0x1b4942,_0x68f9cd){return respondWithRpcPromise('Campaigns',_0x1b4942[_0x8eda('0x17')])['then'](respondWithResult(_0x68f9cd,null))[_0x8eda('0xc')](handleError(_0x68f9cd,null));};exports[_0x8eda('0x43')]=function(_0x12ccb4,_0x582e90){return respondWithRpcPromise(_0x8eda('0x44'),_0x12ccb4[_0x8eda('0x17')],routingClient)[_0x8eda('0x18')](respondWithResult(_0x582e90,null))['catch'](handleError(_0x582e90,null));};exports[_0x8eda('0x45')]=function(_0xd8a5ba,_0x3a3c5a){return respondWithRpcPromise(_0x8eda('0x44'),_0xd8a5ba[_0x8eda('0x17')],routingClient)[_0x8eda('0x18')](findById(_0xd8a5ba[_0x8eda('0x1c')]['id']))[_0x8eda('0x18')](respondWithResult(_0x3a3c5a,null))[_0x8eda('0xc')](handleError(_0x3a3c5a,null));};exports[_0x8eda('0x46')]=function(_0x482a40,_0x3a9ffb){return respondWithRpcPromise(_0x8eda('0x47'),_0x482a40['query'],routingClient)[_0x8eda('0x18')](respondWithResult(_0x3a9ffb,null))['catch'](handleError(_0x3a9ffb,null));};exports['showMailQueues']=function(_0x4a3e61,_0x4a26af){return respondWithRpcPromise('MailQueues',_0x4a3e61[_0x8eda('0x17')],routingClient)['then'](findById(_0x4a3e61[_0x8eda('0x1c')]['id']))[_0x8eda('0x18')](respondWithResult(_0x4a26af,null))[_0x8eda('0xc')](handleError(_0x4a26af,null));};exports[_0x8eda('0x48')]=function(_0x21bd2b,_0x302d82){return respondWithRpcPromise(_0x8eda('0x49'),_0x21bd2b['query'],mailClient)[_0x8eda('0x18')](respondWithResult(_0x302d82,null))['catch'](handleError(_0x302d82,null));};exports[_0x8eda('0x4a')]=function(_0x4ba827,_0xfb98bf){return respondWithRpcPromise('OpenchannelQueues',_0x4ba827[_0x8eda('0x17')],routingClient)[_0x8eda('0x18')](respondWithResult(_0xfb98bf,null))[_0x8eda('0xc')](handleError(_0xfb98bf,null));};exports['showOpenchannelQueues']=function(_0x589fbe,_0x55d642){return respondWithRpcPromise(_0x8eda('0x4b'),_0x589fbe[_0x8eda('0x17')],routingClient)['then'](findById(_0x589fbe[_0x8eda('0x1c')]['id']))['then'](respondWithResult(_0x55d642,null))['catch'](handleError(_0x55d642,null));};exports[_0x8eda('0x4c')]=function(_0x375bbe,_0x284065){return respondWithRpcPromise(_0x8eda('0x4d'),_0x375bbe['query'],routingClient)['then'](respondWithResult(_0x284065,null))[_0x8eda('0xc')](handleError(_0x284065,null));};exports[_0x8eda('0x4e')]=function(_0x111177,_0x2119ce){return respondWithRpcPromise('SmsQueues',_0x111177[_0x8eda('0x17')],routingClient)['then'](findById(_0x111177[_0x8eda('0x1c')]['id']))['then'](respondWithResult(_0x2119ce,null))[_0x8eda('0xc')](handleError(_0x2119ce,null));};exports['whatsappQueues']=function(_0x437d35,_0x232e37){return respondWithRpcPromise(_0x8eda('0x4f'),_0x437d35[_0x8eda('0x17')],routingClient)[_0x8eda('0x18')](respondWithResult(_0x232e37,null))[_0x8eda('0xc')](handleError(_0x232e37,null));};exports[_0x8eda('0x50')]=function(_0x1dfb4f,_0xe32385){return respondWithRpcPromise('WhatsappQueues',_0x1dfb4f['query'],routingClient)[_0x8eda('0x18')](findById(_0x1dfb4f['params']['id']))[_0x8eda('0x18')](respondWithResult(_0xe32385,null))[_0x8eda('0xc')](handleError(_0xe32385,null));};exports[_0x8eda('0x51')]=function(_0x2ca608,_0x1729a8){return respondWithRpcPromise('FaxQueues',_0x2ca608['query'],routingClient)[_0x8eda('0x18')](respondWithResult(_0x1729a8,null))[_0x8eda('0xc')](handleError(_0x1729a8,null));};exports[_0x8eda('0x52')]=function(_0xc6a2d8,_0x24953a){return respondWithRpcPromise(_0x8eda('0x53'),_0xc6a2d8[_0x8eda('0x17')],routingClient)['then'](findById(_0xc6a2d8[_0x8eda('0x1c')]['id']))[_0x8eda('0x18')](respondWithResult(_0x24953a,null))['catch'](handleError(_0x24953a,null));};exports[_0x8eda('0x54')]=function(_0x5467e9,_0x47f57c){return respondWithRpcPromise('FaxAccounts',_0x5467e9['query'])[_0x8eda('0x18')](respondWithResult(_0x47f57c,null))[_0x8eda('0xc')](handleError(_0x47f57c,null));};exports[_0x8eda('0x55')]=function(_0xb3bb07,_0xa3e405){return respondWithRpcPromise(_0x8eda('0x56'),_0xb3bb07['query'],routingClient)[_0x8eda('0x18')](respondWithResult(_0xa3e405,null))[_0x8eda('0xc')](handleError(_0xa3e405,null));};exports[_0x8eda('0x57')]=function(_0x3f5d3d,_0x4a1e6c){return respondWithRpcPromise(_0x8eda('0x58'),_0x3f5d3d[_0x8eda('0x17')],routingClient)[_0x8eda('0x18')](respondWithResult(_0x4a1e6c,null))[_0x8eda('0xc')](handleError(_0x4a1e6c,null));};exports[_0x8eda('0x59')]=function(_0x3167e1,_0x4ef854){return respondWithRpcPromise(_0x8eda('0x5a'),_0x3167e1[_0x8eda('0x17')],routingClient)[_0x8eda('0x18')](respondWithResult(_0x4ef854,null))[_0x8eda('0xc')](handleError(_0x4ef854,null));};exports[_0x8eda('0x5b')]=function(_0x34a5c8,_0x127d98){return respondWithRpcPromise(_0x8eda('0x5a'),_0x34a5c8[_0x8eda('0x17')],routingClient)[_0x8eda('0x18')](function(_0x2bdceb){if(_0x34a5c8[_0x8eda('0x17')][_0x8eda('0x5c')]!==undefined){var _0x3d823e=_(_0x2bdceb['rows'])['filter']([_0x34a5c8[_0x8eda('0x17')][_0x8eda('0x5c')],_0x34a5c8[_0x8eda('0x1c')]['id']])[_0x8eda('0x5d')]('queue_id')[_0x8eda('0x5e')]()[_0x8eda('0x5f')]();return _0x2bdceb['rows'][_0x8eda('0x60')](function(_0x5f0d26){return _0x3d823e[_0x8eda('0x61')](_0x5f0d26[_0x8eda('0x62')])>-0x1;});}else{return _0x2bdceb[_0x8eda('0x13')]['filter'](function(_0x1165fc){return _0x1165fc[_0x8eda('0x62')]===parseInt(_0x34a5c8[_0x8eda('0x1c')]['id']);});}})['then'](respondWithResult(_0x127d98,null))[_0x8eda('0xc')](handleError(_0x127d98,null));};exports[_0x8eda('0x63')]=function(_0x10fcab,_0x2f30af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x10fcab['query'],routingClient)[_0x8eda('0x18')](respondWithResult(_0x2f30af,null))[_0x8eda('0xc')](handleError(_0x2f30af,null));};exports[_0x8eda('0x64')]=function(_0xd93d5,_0x49781b){return respondWithRpcPromise(_0x8eda('0x65'),_0xd93d5[_0x8eda('0x17')],routingClient)[_0x8eda('0x18')](respondWithResult(_0x49781b,null))[_0x8eda('0xc')](handleError(_0x49781b,null));};exports[_0x8eda('0x66')]=function(_0x4fb714,_0x2cec88){return respondWithRpcPromise(_0x8eda('0x67'),_0x4fb714[_0x8eda('0x17')],routingClient)['then'](respondWithResult(_0x2cec88,null))['catch'](handleError(_0x2cec88,null));};exports['queueNotify']=function(_0xcf2ef3){return function(_0x327590,_0x362b22){var _0x4751d6,_0x3c9c51;var _0x325adc=_[_0x8eda('0x68')](_0xcf2ef3);var _0x3f700a=_0xcf2ef3==='chat'?_0x8eda('0x69'):_0x8eda('0x6a');return db[_0x325adc+_0x8eda('0x6b')]['findOne']({'raw':!![],'where':{'id':_0x327590[_0x8eda('0x1c')]['id']}})[_0x8eda('0x18')](function(_0x3095bd){if(_[_0x8eda('0x12')](_0x3095bd)){throw new Error(_0x325adc+_0x8eda('0x6c'));}_0x4751d6=_0x3095bd;return db[_0x325adc+_0x8eda('0x6d')][_0x8eda('0x6e')]({'where':{'id':_0x327590[_0x8eda('0x21')][_0x8eda('0x6f')]},'include':[{'model':db[_0x325adc+_0x8eda('0x70')],'as':_0x8eda('0x70')},{'model':db[_0x325adc+_0x3f700a],'as':'Account'}]});})[_0x8eda('0x18')](function(_0x46c155){if(_[_0x8eda('0x12')](_0x46c155)){throw new Error(_0x325adc+_0x8eda('0x71'));}_0x3c9c51=_0x46c155;return _0x46c155[_0x8eda('0x72')]({'read':0x0,'readAt':null,'UserId':null});})[_0x8eda('0x18')](function(){var _0x11cbb1={'uniqueid':_0xcf2ef3+'.'+_0x3c9c51['id']+'.'+_0x3c9c51[_0x8eda('0x70')]['id'],'FromUserId':_0x327590[_0x8eda('0x2f')]['id'],'type':_0x8eda('0x73')};_0x11cbb1[_0x325adc+_0x8eda('0x74')]=_0x3c9c51['id'];_0x11cbb1[_0x325adc+'InteractionId']=_0x3c9c51['Interaction']['id'];_0x11cbb1['From'+_0x325adc+_0x3f700a+'Id']=_0x3c9c51[_0x8eda('0x6a')]['id'];_0x11cbb1['To'+_0x325adc+_0x8eda('0x75')]=_0x4751d6['id'];return db[_0x325adc+'TransferReport'][_0x8eda('0x76')](_0x11cbb1);})[_0x8eda('0x18')](function(){return respondWithRpcPromise(_0x8eda('0x77'),{'channel':_0xcf2ef3,'interaction':_0x3c9c51['Interaction'],'message':_0x3c9c51,'account':_0x3c9c51[_0x8eda('0x6a')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x4751d6[_0x8eda('0x10')]+','+(_0x3c9c51['Account'][_0x8eda('0x78')]||0x12c),'interval':_0x8eda('0x79')}]},routingClient);})['then'](respondWithResult(_0x362b22,null))[_0x8eda('0xc')](handleError(_0x362b22,null));};};exports[_0x8eda('0x7a')]=function(_0x355d61,_0x2a1c43){var _0x128cbd,_0x1bac9f;if(_[_0x8eda('0x12')](_0x355d61[_0x8eda('0x21')][_0x8eda('0x7b')])){throw new Error(_0x8eda('0x7c'));}var _0x5566f2=_0x355d61['body']['channel'];var _0x5b64c8=_[_0x8eda('0x68')](_0x5566f2);var _0x768f3f=_0x5566f2===_0x8eda('0x7d')?'Website':_0x8eda('0x6a');return db[_0x8eda('0x7e')][_0x8eda('0x6e')]({'raw':!![],'where':{'id':_0x355d61[_0x8eda('0x1c')]['id'],'role':_0x8eda('0x3a')}})[_0x8eda('0x18')](function(_0x72184a){if(_[_0x8eda('0x12')](_0x72184a)){throw new Error('Agent\x20not\x20found');}_0x128cbd=_0x72184a;return db[_0x5b64c8+'Message'][_0x8eda('0x6e')]({'where':{'id':_0x355d61[_0x8eda('0x21')]['messageId']},'include':[{'model':db[_0x5b64c8+_0x8eda('0x70')],'as':_0x8eda('0x70')},{'model':db[_0x5b64c8+_0x768f3f],'as':_0x8eda('0x6a')}]});})['then'](function(_0x36926f){if(_[_0x8eda('0x12')](_0x36926f)){throw new Error(_0x5b64c8+_0x8eda('0x71'));}_0x1bac9f=_0x36926f;return _0x36926f[_0x8eda('0x72')]({'read':0x0,'readAt':null,'UserId':null});})[_0x8eda('0x18')](function(){var _0x3c0bc4={'uniqueid':_0x5566f2+'.'+_0x1bac9f['id']+'.'+_0x1bac9f[_0x8eda('0x70')]['id'],'FromUserId':_0x355d61['user']['id'],'type':_0x8eda('0x73'),'ToUserId':_0x128cbd['id']};_0x3c0bc4[_0x5b64c8+_0x8eda('0x74')]=_0x1bac9f['id'];_0x3c0bc4[_0x5b64c8+'InteractionId']=_0x1bac9f['Interaction']['id'];_0x3c0bc4['From'+_0x5b64c8+_0x768f3f+'Id']=_0x1bac9f[_0x8eda('0x6a')]['id'];return db[_0x5b64c8+_0x8eda('0x7f')][_0x8eda('0x76')](_0x3c0bc4);})[_0x8eda('0x18')](function(){return respondWithRpcPromise(_0x8eda('0x77'),{'channel':_0x5566f2,'interaction':_0x1bac9f[_0x8eda('0x70')],'message':_0x1bac9f,'account':_0x1bac9f[_0x8eda('0x6a')],'applications':[{'id':0x0,'priority':0x1,'app':_0x8eda('0x3a'),'appdata':_0x128cbd[_0x8eda('0x10')]+','+(_0x1bac9f[_0x8eda('0x6a')][_0x8eda('0x80')]||0x12c),'interval':_0x8eda('0x79')}]},routingClient);})[_0x8eda('0x18')](respondWithResult(_0x2a1c43,null))[_0x8eda('0xc')](handleError(_0x2a1c43,null));}; \ No newline at end of file +var _0xf494=['WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Queue','findOne','\x20Queue\x20not\x20found','Message','Interaction','Account','\x20Message\x20not\x20found','MessageId','QueueId','TransferReport','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','User','Agent\x20not\x20found','messageId','update','InteractionId','From','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','message','status','json','sendStatus','stack','name','isNil','rows','find','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','catch','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','user','interaction','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','trunks','campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues'];(function(_0x18aaaf,_0x385db6){var _0x52d892=function(_0x1ac6da){while(--_0x1ac6da){_0x18aaaf['push'](_0x18aaaf['shift']());}};_0x52d892(++_0x385db6);}(_0xf494,0x1c6));var _0x4f49=function(_0x401136,_0x3eba33){_0x401136=_0x401136-0x0;var _0x2536c0=_0xf494[_0x401136];return _0x2536c0;};'use strict';var BPromise=require(_0x4f49('0x0'));var moment=require(_0x4f49('0x1'));var _=require(_0x4f49('0x2'));var util=require('util');var db=require(_0x4f49('0x3'))['db'];var logger=require(_0x4f49('0x4'))(_0x4f49('0x5'));var jayson=require(_0x4f49('0x6'));var amiClient=jayson[_0x4f49('0x7')][_0x4f49('0x8')]({'port':0x232a});var mailClient=jayson[_0x4f49('0x7')][_0x4f49('0x8')]({'port':0x232b});var routingClient=jayson[_0x4f49('0x7')][_0x4f49('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){var _0x31a725=_0x58e9a0?_0x58e9a0:amiClient;return _0x31a725[_0x4f49('0x9')](_0x42b0e8,_0x5eb186)[_0x4f49('0xa')](function(_0x174d0d){if(_0x174d0d[_0x4f49('0xb')]){if(_0x174d0d[_0x4f49('0xb')]['code']===0x1f4){return _0x327bd5(_0x174d0d[_0x4f49('0xb')][_0x4f49('0xc')]);}return _0x169c95(_0x174d0d['error'][_0x4f49('0xc')]);}else{_0x169c95(_0x174d0d['result']);}})['catch'](function(_0x4b9cd3){_0x327bd5(_0x4b9cd3);});});}function respondWithResult(_0x12527d,_0x4bf89f){_0x4bf89f=_0x4bf89f||0xc8;return function(_0x1e1c37){if(_0x1e1c37){return _0x12527d[_0x4f49('0xd')](_0x4bf89f)[_0x4f49('0xe')](_0x1e1c37);}return _0x12527d[_0x4f49('0xf')](0x194);};}function handleError(_0x1a0f1e,_0x2f0131){_0x2f0131=_0x2f0131||0x1f4;return function(_0xfdb477){logger['error'](_0xfdb477[_0x4f49('0x10')]);if(_0xfdb477[_0x4f49('0x11')]){delete _0xfdb477[_0x4f49('0x11')];}_0x1a0f1e['status'](_0x2f0131)['send'](_0xfdb477);};}function findById(_0x2f0a0d){return function(_0x2ecaaa){if(!_[_0x4f49('0x12')](_0x2f0a0d)&&!_['isNil'](_0x2ecaaa)&&!_[_0x4f49('0x12')](_0x2ecaaa[_0x4f49('0x13')])){return _[_0x4f49('0x14')](_0x2ecaaa['rows'],function(_0x5bb23b){return _0x5bb23b['id']==_0x2f0a0d;});}return null;};}exports['voiceChannels']=function(_0x47f1e8,_0xb2081a){return respondWithRpcPromise(_0x4f49('0x15'),_0x47f1e8[_0x4f49('0x16')])[_0x4f49('0xa')](respondWithResult(_0xb2081a,null))['catch'](handleError(_0xb2081a,null));};exports[_0x4f49('0x17')]=function(_0x2aed27,_0x197a49){return respondWithRpcPromise(_0x4f49('0x18'),_[_0x4f49('0x19')](_0x2aed27['query'],_0x2aed27[_0x4f49('0x1a')]))[_0x4f49('0xa')](respondWithResult(_0x197a49,null))[_0x4f49('0x1b')](handleError(_0x197a49,null));};exports['voiceChannelStopMixMonitor']=function(_0x40755e,_0x1d70a7){return respondWithRpcPromise(_0x4f49('0x1c'),_[_0x4f49('0x19')](_0x40755e[_0x4f49('0x16')],_0x40755e[_0x4f49('0x1a')]))['then'](respondWithResult(_0x1d70a7,null))['catch'](handleError(_0x1d70a7,null));};exports[_0x4f49('0x1d')]=function(_0x429de7,_0x4fedbb){return respondWithRpcPromise(_0x4f49('0x1e'),_0x429de7[_0x4f49('0x16')])[_0x4f49('0xa')](respondWithResult(_0x4fedbb,null))['catch'](handleError(_0x4fedbb,null));};exports[_0x4f49('0x1f')]=function(_0x2eed1c,_0x298785){return respondWithRpcPromise(_0x4f49('0x1e'),_0x2eed1c[_0x4f49('0x16')])[_0x4f49('0xa')](findById(_0x2eed1c['params']['id']))['then'](respondWithResult(_0x298785,null))[_0x4f49('0x1b')](handleError(_0x298785,null));};exports[_0x4f49('0x20')]=function(_0x605c91,_0x560050){return respondWithRpcPromise(_0x4f49('0x21'),_[_0x4f49('0x19')](_0x605c91[_0x4f49('0x22')],_0x605c91['params']))['then'](respondWithResult(_0x560050,null))[_0x4f49('0x1b')](handleError(_0x560050,null));};exports[_0x4f49('0x23')]=function(_0x7a6ea0,_0x5e7076){return respondWithRpcPromise(_0x4f49('0x24'),_[_0x4f49('0x19')](_0x7a6ea0[_0x4f49('0x16')],_0x7a6ea0[_0x4f49('0x1a')]))[_0x4f49('0xa')](respondWithResult(_0x5e7076,null))[_0x4f49('0x1b')](handleError(_0x5e7076,null));};exports[_0x4f49('0x25')]=function(_0x45ae19,_0x1f38d3){return respondWithRpcPromise(_0x4f49('0x26'),_0x45ae19[_0x4f49('0x16')])[_0x4f49('0xa')](respondWithResult(_0x1f38d3,null))[_0x4f49('0x1b')](handleError(_0x1f38d3,null));};exports[_0x4f49('0x27')]=function(_0x135d17,_0x97ef98){return respondWithRpcPromise(_0x4f49('0x28'),_[_0x4f49('0x19')](_0x135d17[_0x4f49('0x16')],_0x135d17['params']))[_0x4f49('0xa')](respondWithResult(_0x97ef98,null))[_0x4f49('0x1b')](handleError(_0x97ef98,null));};exports[_0x4f49('0x29')]=function(_0x1cb3cc,_0x1c3af8){return respondWithRpcPromise(_0x4f49('0x2a'),_[_0x4f49('0x19')](_0x1cb3cc[_0x4f49('0x16')],_0x1cb3cc[_0x4f49('0x1a')]))[_0x4f49('0xa')](respondWithResult(_0x1c3af8,null))[_0x4f49('0x1b')](handleError(_0x1c3af8,null));};exports[_0x4f49('0x2b')]=function(_0x3ec6c4,_0x4d2d57){return respondWithRpcPromise(_0x4f49('0x2c'),_[_0x4f49('0x19')](_0x3ec6c4[_0x4f49('0x16')],_0x3ec6c4[_0x4f49('0x1a')]))[_0x4f49('0xa')](respondWithResult(_0x4d2d57,null))[_0x4f49('0x1b')](handleError(_0x4d2d57,null));};exports[_0x4f49('0x2d')]=function(_0x25fdf8,_0x10bfc4){return respondWithRpcPromise(_0x4f49('0x2e'),_0x25fdf8[_0x4f49('0x16')])[_0x4f49('0xa')](respondWithResult(_0x10bfc4,null))[_0x4f49('0x1b')](handleError(_0x10bfc4,null));};exports[_0x4f49('0x2f')]=function(_0x4e3f72,_0x802f20){return respondWithRpcPromise(_0x4f49('0x30'),_0x4e3f72['query'])[_0x4f49('0xa')](respondWithResult(_0x802f20,null))[_0x4f49('0x1b')](handleError(_0x802f20,null));};exports['agents']=function(_0x29e762,_0x1dd1a6){var _0x2548ad;return respondWithRpcPromise(_0x4f49('0x31'),_0x29e762[_0x4f49('0x16')])[_0x4f49('0xa')](function(_0x29e910){_0x2548ad=_0x29e910;return respondWithRpcPromise('Agents',_0x29e762['query'],routingClient);})['then'](function(_0x15e4b3){return _[_0x4f49('0x19')]({},_0x15e4b3,_0x2548ad);})[_0x4f49('0xa')](respondWithResult(_0x1dd1a6,null))[_0x4f49('0x1b')](handleError(_0x1dd1a6,null));};exports[_0x4f49('0x32')]=function(_0x1ecf6c,_0x38aff8){if(_0x1ecf6c[_0x4f49('0x22')]&&_0x1ecf6c[_0x4f49('0x22')]['interaction']&&_0x1ecf6c['user']&&_0x1ecf6c[_0x4f49('0x33')][_0x4f49('0x11')]){for(var _0x159642 in _0x1ecf6c['body'][_0x4f49('0x34')]){if(_0x1ecf6c['body']['interaction'][_0x4f49('0x35')](_0x159642)){db[_0x4f49('0x36')][_0x4f49('0x37')]({'where':{'channel':_0x159642,'membername':_0x1ecf6c['user'][_0x4f49('0x11')],'type':_0x4f49('0x38'),'exitAt':null,'uniqueid':_0x1ecf6c['body'][_0x4f49('0x34')][_0x159642]&&_0x1ecf6c['body'][_0x4f49('0x34')][_0x159642][_0x4f49('0x39')]?{'$notIn':_0x1ecf6c[_0x4f49('0x22')]['interaction'][_0x159642]}:{'$ne':null}}})[_0x4f49('0xa')](function(_0x1e5f0b){var _0x33bb04=moment()[_0x4f49('0x3a')](_0x4f49('0x3b'));for(var _0x1c41e4=0x0,_0xe66867=_0x1e5f0b[_0x4f49('0x39')];_0x1c41e4<_0xe66867;_0x1c41e4+=0x1){_0x1e5f0b[_0x1c41e4][_0x4f49('0x3c')]({'exitAt':_0x33bb04});}});for(var _0x157a55=0x0;_0x157a55<_0x1ecf6c['body'][_0x4f49('0x34')][_0x159642][_0x4f49('0x39')];_0x157a55+=0x1){db['MemberReport'][_0x4f49('0x3d')]({'where':{'channel':_0x159642,'membername':_0x1ecf6c['user'][_0x4f49('0x11')],'type':_0x4f49('0x38'),'uniqueid':_0x1ecf6c[_0x4f49('0x22')][_0x4f49('0x34')][_0x159642][_0x157a55],'exitAt':null},'defaults':{'channel':_0x159642,'membername':_0x1ecf6c['user'][_0x4f49('0x11')],'interface':_[_0x4f49('0x12')](_0x1ecf6c[_0x4f49('0x33')][_0x4f49('0x3e')])?util[_0x4f49('0x3a')](_0x4f49('0x3f'),_0x1ecf6c[_0x4f49('0x33')][_0x4f49('0x11')]):_0x1ecf6c[_0x4f49('0x33')][_0x4f49('0x3e')],'type':_0x4f49('0x38'),'enterAt':moment()[_0x4f49('0x3a')](_0x4f49('0x3b')),'role':_0x4f49('0x40'),'internal':_0x1ecf6c[_0x4f49('0x33')][_0x4f49('0x41')],'uniqueid':_0x1ecf6c['body']['interaction'][_0x159642][_0x157a55]}});}}}}return respondWithRpcPromise(_0x4f49('0x42'),{'id':_0x1ecf6c[_0x4f49('0x1a')]['id'],'capacity':_0x1ecf6c[_0x4f49('0x22')][_0x4f49('0x43')]},routingClient)[_0x4f49('0xa')](respondWithResult(_0x38aff8,null))[_0x4f49('0x1b')](handleError(_0x38aff8,null));};exports[_0x4f49('0x44')]=function(_0x51c756,_0x6637f4){return respondWithRpcPromise('Telephones',_0x51c756[_0x4f49('0x16')])[_0x4f49('0xa')](respondWithResult(_0x6637f4,null))[_0x4f49('0x1b')](handleError(_0x6637f4,null));};exports[_0x4f49('0x45')]=function(_0x586095,_0x342980){return respondWithRpcPromise('Trunks',_0x586095['query'])[_0x4f49('0xa')](respondWithResult(_0x342980,null))[_0x4f49('0x1b')](handleError(_0x342980,null));};exports[_0x4f49('0x46')]=function(_0x26ae33,_0x56375a){return respondWithRpcPromise('Campaigns',_0x26ae33[_0x4f49('0x16')])[_0x4f49('0xa')](respondWithResult(_0x56375a,null))['catch'](handleError(_0x56375a,null));};exports[_0x4f49('0x47')]=function(_0x5b50bc,_0x5a929a){return respondWithRpcPromise(_0x4f49('0x48'),_0x5b50bc['query'],routingClient)[_0x4f49('0xa')](respondWithResult(_0x5a929a,null))['catch'](handleError(_0x5a929a,null));};exports[_0x4f49('0x49')]=function(_0x38a640,_0x2472c9){return respondWithRpcPromise(_0x4f49('0x48'),_0x38a640[_0x4f49('0x16')],routingClient)[_0x4f49('0xa')](findById(_0x38a640[_0x4f49('0x1a')]['id']))[_0x4f49('0xa')](respondWithResult(_0x2472c9,null))['catch'](handleError(_0x2472c9,null));};exports[_0x4f49('0x4a')]=function(_0x51f57e,_0x213608){return respondWithRpcPromise(_0x4f49('0x4b'),_0x51f57e[_0x4f49('0x16')],routingClient)[_0x4f49('0xa')](respondWithResult(_0x213608,null))[_0x4f49('0x1b')](handleError(_0x213608,null));};exports[_0x4f49('0x4c')]=function(_0x553981,_0x426c50){return respondWithRpcPromise(_0x4f49('0x4b'),_0x553981['query'],routingClient)['then'](findById(_0x553981[_0x4f49('0x1a')]['id']))[_0x4f49('0xa')](respondWithResult(_0x426c50,null))[_0x4f49('0x1b')](handleError(_0x426c50,null));};exports[_0x4f49('0x4d')]=function(_0x19a788,_0x4af08d){return respondWithRpcPromise(_0x4f49('0x4e'),_0x19a788['query'],mailClient)[_0x4f49('0xa')](respondWithResult(_0x4af08d,null))[_0x4f49('0x1b')](handleError(_0x4af08d,null));};exports[_0x4f49('0x4f')]=function(_0x4aae7c,_0x1dade6){return respondWithRpcPromise(_0x4f49('0x50'),_0x4aae7c[_0x4f49('0x16')],routingClient)[_0x4f49('0xa')](respondWithResult(_0x1dade6,null))['catch'](handleError(_0x1dade6,null));};exports[_0x4f49('0x51')]=function(_0x269564,_0x5e6898){return respondWithRpcPromise(_0x4f49('0x50'),_0x269564[_0x4f49('0x16')],routingClient)[_0x4f49('0xa')](findById(_0x269564[_0x4f49('0x1a')]['id']))[_0x4f49('0xa')](respondWithResult(_0x5e6898,null))[_0x4f49('0x1b')](handleError(_0x5e6898,null));};exports[_0x4f49('0x52')]=function(_0x30fc21,_0x519721){return respondWithRpcPromise(_0x4f49('0x53'),_0x30fc21[_0x4f49('0x16')],routingClient)[_0x4f49('0xa')](respondWithResult(_0x519721,null))[_0x4f49('0x1b')](handleError(_0x519721,null));};exports[_0x4f49('0x54')]=function(_0x26b022,_0x335875){return respondWithRpcPromise('SmsQueues',_0x26b022[_0x4f49('0x16')],routingClient)['then'](findById(_0x26b022[_0x4f49('0x1a')]['id']))[_0x4f49('0xa')](respondWithResult(_0x335875,null))[_0x4f49('0x1b')](handleError(_0x335875,null));};exports[_0x4f49('0x55')]=function(_0xc7743e,_0x3f2f3f){return respondWithRpcPromise(_0x4f49('0x56'),_0xc7743e[_0x4f49('0x16')],routingClient)[_0x4f49('0xa')](respondWithResult(_0x3f2f3f,null))[_0x4f49('0x1b')](handleError(_0x3f2f3f,null));};exports['showWhatsappQueues']=function(_0x2f9f2e,_0x141554){return respondWithRpcPromise(_0x4f49('0x56'),_0x2f9f2e[_0x4f49('0x16')],routingClient)['then'](findById(_0x2f9f2e['params']['id']))[_0x4f49('0xa')](respondWithResult(_0x141554,null))['catch'](handleError(_0x141554,null));};exports[_0x4f49('0x57')]=function(_0x287705,_0x43bdde){return respondWithRpcPromise(_0x4f49('0x58'),_0x287705[_0x4f49('0x16')],routingClient)[_0x4f49('0xa')](respondWithResult(_0x43bdde,null))[_0x4f49('0x1b')](handleError(_0x43bdde,null));};exports[_0x4f49('0x59')]=function(_0x3823f0,_0x3e9b47){return respondWithRpcPromise(_0x4f49('0x58'),_0x3823f0[_0x4f49('0x16')],routingClient)[_0x4f49('0xa')](findById(_0x3823f0[_0x4f49('0x1a')]['id']))[_0x4f49('0xa')](respondWithResult(_0x3e9b47,null))[_0x4f49('0x1b')](handleError(_0x3e9b47,null));};exports[_0x4f49('0x5a')]=function(_0x753863,_0x1f9161){return respondWithRpcPromise(_0x4f49('0x5b'),_0x753863[_0x4f49('0x16')])[_0x4f49('0xa')](respondWithResult(_0x1f9161,null))[_0x4f49('0x1b')](handleError(_0x1f9161,null));};exports[_0x4f49('0x5c')]=function(_0x2d0990,_0x49a79d){return respondWithRpcPromise(_0x4f49('0x5d'),_0x2d0990['query'],routingClient)[_0x4f49('0xa')](respondWithResult(_0x49a79d,null))[_0x4f49('0x1b')](handleError(_0x49a79d,null));};exports[_0x4f49('0x5e')]=function(_0x3c0f69,_0x26de18){return respondWithRpcPromise(_0x4f49('0x5f'),_0x3c0f69[_0x4f49('0x16')],routingClient)[_0x4f49('0xa')](respondWithResult(_0x26de18,null))[_0x4f49('0x1b')](handleError(_0x26de18,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x4b6ef4,_0x539e21){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4b6ef4[_0x4f49('0x16')],routingClient)[_0x4f49('0xa')](respondWithResult(_0x539e21,null))[_0x4f49('0x1b')](handleError(_0x539e21,null));};exports[_0x4f49('0x60')]=function(_0x1fc88a,_0x5a8b1c){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x1fc88a[_0x4f49('0x16')],routingClient)[_0x4f49('0xa')](function(_0x4bdd1b){if(_0x1fc88a[_0x4f49('0x16')][_0x4f49('0x61')]!==undefined){var _0x5c824f=_(_0x4bdd1b[_0x4f49('0x13')])['filter']([_0x1fc88a[_0x4f49('0x16')][_0x4f49('0x61')],_0x1fc88a['params']['id']])[_0x4f49('0x62')](_0x4f49('0x63'))[_0x4f49('0x64')]()[_0x4f49('0x65')]();return _0x4bdd1b[_0x4f49('0x13')][_0x4f49('0x66')](function(_0x5f0dbf){return _0x5c824f[_0x4f49('0x67')](_0x5f0dbf['queue_id'])>-0x1;});}else{return _0x4bdd1b[_0x4f49('0x13')]['filter'](function(_0x50c06e){return _0x50c06e['queue_id']===parseInt(_0x1fc88a[_0x4f49('0x1a')]['id']);});}})[_0x4f49('0xa')](respondWithResult(_0x5a8b1c,null))[_0x4f49('0x1b')](handleError(_0x5a8b1c,null));};exports[_0x4f49('0x68')]=function(_0x47af99,_0x39024d){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x47af99[_0x4f49('0x16')],routingClient)['then'](respondWithResult(_0x39024d,null))[_0x4f49('0x1b')](handleError(_0x39024d,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x4938a6,_0x329a49){return respondWithRpcPromise(_0x4f49('0x69'),_0x4938a6[_0x4f49('0x16')],routingClient)['then'](respondWithResult(_0x329a49,null))[_0x4f49('0x1b')](handleError(_0x329a49,null));};exports[_0x4f49('0x6a')]=function(_0x5c33c9,_0x5d52ae){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x5c33c9[_0x4f49('0x16')],routingClient)[_0x4f49('0xa')](respondWithResult(_0x5d52ae,null))[_0x4f49('0x1b')](handleError(_0x5d52ae,null));};exports[_0x4f49('0x6b')]=function(_0x1643fc){return function(_0x517144,_0x15b7e4){var _0x1b922e,_0x29de92;var _0x58d07e=_[_0x4f49('0x6c')](_0x1643fc);var _0x34843a=_0x1643fc===_0x4f49('0x6d')?_0x4f49('0x6e'):'Account';return db[_0x58d07e+_0x4f49('0x6f')][_0x4f49('0x70')]({'raw':!![],'where':{'id':_0x517144[_0x4f49('0x1a')]['id']}})[_0x4f49('0xa')](function(_0x389679){if(_['isNil'](_0x389679)){throw new Error(_0x58d07e+_0x4f49('0x71'));}_0x1b922e=_0x389679;return db[_0x58d07e+_0x4f49('0x72')]['findOne']({'where':{'id':_0x517144[_0x4f49('0x22')]['messageId']},'include':[{'model':db[_0x58d07e+_0x4f49('0x73')],'as':'Interaction'},{'model':db[_0x58d07e+_0x34843a],'as':_0x4f49('0x74')}]});})[_0x4f49('0xa')](function(_0x2ef19e){if(_[_0x4f49('0x12')](_0x2ef19e)){throw new Error(_0x58d07e+_0x4f49('0x75'));}_0x29de92=_0x2ef19e;return _0x2ef19e['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x4f49('0xa')](function(){var _0x1f3556={'uniqueid':_0x1643fc+'.'+_0x29de92['id']+'.'+_0x29de92[_0x4f49('0x73')]['id'],'FromUserId':_0x517144[_0x4f49('0x33')]['id'],'type':'queue'};_0x1f3556[_0x58d07e+_0x4f49('0x76')]=_0x29de92['id'];_0x1f3556[_0x58d07e+'InteractionId']=_0x29de92[_0x4f49('0x73')]['id'];_0x1f3556['From'+_0x58d07e+_0x34843a+'Id']=_0x29de92[_0x4f49('0x74')]['id'];_0x1f3556['To'+_0x58d07e+_0x4f49('0x77')]=_0x1b922e['id'];return db[_0x58d07e+_0x4f49('0x78')][_0x4f49('0x79')](_0x1f3556);})[_0x4f49('0xa')](function(){return respondWithRpcPromise(_0x4f49('0x7a'),{'channel':_0x1643fc,'interaction':_0x29de92[_0x4f49('0x73')],'message':_0x29de92,'account':_0x29de92[_0x4f49('0x74')],'applications':[{'id':0x0,'priority':0x1,'app':_0x4f49('0x7b'),'appdata':_0x1b922e[_0x4f49('0x11')]+','+(_0x29de92['Account'][_0x4f49('0x7c')]||0x12c),'interval':_0x4f49('0x7d')}]},routingClient);})[_0x4f49('0xa')](respondWithResult(_0x15b7e4,null))[_0x4f49('0x1b')](handleError(_0x15b7e4,null));};};exports[_0x4f49('0x7e')]=function(_0x24b033,_0x55b28b){var _0x2ec42b,_0x20a0d4;if(_[_0x4f49('0x12')](_0x24b033[_0x4f49('0x22')]['channel'])){throw new Error(_0x4f49('0x7f'));}var _0x57567a=_0x24b033[_0x4f49('0x22')][_0x4f49('0x80')];var _0x5c5d2=_[_0x4f49('0x6c')](_0x57567a);var _0x4cfb48=_0x57567a===_0x4f49('0x6d')?_0x4f49('0x6e'):_0x4f49('0x74');return db[_0x4f49('0x81')][_0x4f49('0x70')]({'raw':!![],'where':{'id':_0x24b033[_0x4f49('0x1a')]['id'],'role':_0x4f49('0x40')}})[_0x4f49('0xa')](function(_0x355787){if(_[_0x4f49('0x12')](_0x355787)){throw new Error(_0x4f49('0x82'));}_0x2ec42b=_0x355787;return db[_0x5c5d2+_0x4f49('0x72')][_0x4f49('0x70')]({'where':{'id':_0x24b033[_0x4f49('0x22')][_0x4f49('0x83')]},'include':[{'model':db[_0x5c5d2+_0x4f49('0x73')],'as':_0x4f49('0x73')},{'model':db[_0x5c5d2+_0x4cfb48],'as':_0x4f49('0x74')}]});})['then'](function(_0x1979ef){if(_[_0x4f49('0x12')](_0x1979ef)){throw new Error(_0x5c5d2+_0x4f49('0x75'));}_0x20a0d4=_0x1979ef;return _0x1979ef[_0x4f49('0x84')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x225e63={'uniqueid':_0x57567a+'.'+_0x20a0d4['id']+'.'+_0x20a0d4[_0x4f49('0x73')]['id'],'FromUserId':_0x24b033['user']['id'],'type':_0x4f49('0x7b'),'ToUserId':_0x2ec42b['id']};_0x225e63[_0x5c5d2+'MessageId']=_0x20a0d4['id'];_0x225e63[_0x5c5d2+_0x4f49('0x85')]=_0x20a0d4[_0x4f49('0x73')]['id'];_0x225e63[_0x4f49('0x86')+_0x5c5d2+_0x4cfb48+'Id']=_0x20a0d4[_0x4f49('0x74')]['id'];return db[_0x5c5d2+_0x4f49('0x78')][_0x4f49('0x79')](_0x225e63);})[_0x4f49('0xa')](function(){return respondWithRpcPromise(_0x4f49('0x7a'),{'channel':_0x57567a,'interaction':_0x20a0d4[_0x4f49('0x73')],'message':_0x20a0d4,'account':_0x20a0d4[_0x4f49('0x74')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x2ec42b['name']+','+(_0x20a0d4[_0x4f49('0x74')]['agentTransferTimeout']||0x12c),'interval':_0x4f49('0x7d')}]},routingClient);})[_0x4f49('0xa')](respondWithResult(_0x55b28b,null))['catch'](handleError(_0x55b28b,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index dcc7097..11518a0 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 _0xd95b=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','run','post','create','update','delete','destroy','exports','multer','util'];(function(_0x269c23,_0x289264){var _0x184ecd=function(_0x32756b){while(--_0x32756b){_0x269c23['push'](_0x269c23['shift']());}};_0x184ecd(++_0x289264);}(_0xd95b,0xe5));var _0xbd95=function(_0x59a374,_0x1fd61a){_0x59a374=_0x59a374-0x0;var _0x2b4402=_0xd95b[_0x59a374];return _0x2b4402;};'use strict';var multer=require(_0xbd95('0x0'));var util=require(_0xbd95('0x1'));var path=require(_0xbd95('0x2'));var timeout=require(_0xbd95('0x3'));var express=require(_0xbd95('0x4'));var router=express[_0xbd95('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbd95('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbd95('0x7'));var controller=require(_0xbd95('0x8'));router[_0xbd95('0x9')]('/',auth[_0xbd95('0xa')](),controller[_0xbd95('0xb')]);router[_0xbd95('0x9')](_0xbd95('0xc'),auth[_0xbd95('0xa')](),controller[_0xbd95('0xd')]);router[_0xbd95('0x9')]('/:id/run',auth['isAuthenticated'](),controller[_0xbd95('0xe')]);router[_0xbd95('0xf')]('/',auth[_0xbd95('0xa')](),controller[_0xbd95('0x10')]);router['put'](_0xbd95('0xc'),auth[_0xbd95('0xa')](),controller[_0xbd95('0x11')]);router[_0xbd95('0x12')](_0xbd95('0xc'),auth[_0xbd95('0xa')](),controller[_0xbd95('0x13')]);module[_0xbd95('0x14')]=router; \ No newline at end of file +var _0x28e5=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','delete','destroy','exports','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x28e5,0x18e));var _0x528e=function(_0x383b95,_0x3dcfd2){_0x383b95=_0x383b95-0x0;var _0x445950=_0x28e5[_0x383b95];return _0x445950;};'use strict';var multer=require('multer');var util=require(_0x528e('0x0'));var path=require(_0x528e('0x1'));var timeout=require(_0x528e('0x2'));var express=require(_0x528e('0x3'));var router=express[_0x528e('0x4')]();var fs_extra=require(_0x528e('0x5'));var auth=require(_0x528e('0x6'));var interaction=require(_0x528e('0x7'));var config=require(_0x528e('0x8'));var controller=require(_0x528e('0x9'));router[_0x528e('0xa')]('/',auth[_0x528e('0xb')](),controller[_0x528e('0xc')]);router[_0x528e('0xa')](_0x528e('0xd'),auth[_0x528e('0xb')](),controller[_0x528e('0xe')]);router[_0x528e('0xa')](_0x528e('0xf'),auth[_0x528e('0xb')](),controller['run']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x528e('0xd'),auth[_0x528e('0xb')](),controller['update']);router[_0x528e('0x10')](_0x528e('0xd'),auth['isAuthenticated'](),controller[_0x528e('0x11')]);module[_0x528e('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index c8d9bf4..c05fa08 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 _0x7fbb=['sequelize','exports','STRING','DATE','INTEGER','quarters','months','weeks','hours','minutes','days','csv','pdf','xlsx','ENUM','custom','BOOLEAN','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7fbb,0xea));var _0xb7fb=function(_0x65ecd5,_0x88e4fe){_0x65ecd5=_0x65ecd5-0x0;var _0x6d57e3=_0x7fbb[_0x65ecd5];return _0x6d57e3;};'use strict';var Sequelize=require(_0xb7fb('0x0'));module[_0xb7fb('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xb7fb('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xb7fb('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0xb7fb('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xb7fb('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years',_0xb7fb('0x5'),_0xb7fb('0x6'),_0xb7fb('0x7'),'days',_0xb7fb('0x8'),_0xb7fb('0x9')),'allowNull':![],'defaultValue':_0xb7fb('0xa')},'output':{'type':Sequelize['ENUM'](_0xb7fb('0xb'),_0xb7fb('0xc'),_0xb7fb('0xd')),'allowNull':![],'defaultValue':_0xb7fb('0xb')},'type':{'type':Sequelize[_0xb7fb('0xe')](_0xb7fb('0xf'),'default'),'allowNull':![],'defaultValue':_0xb7fb('0xf')},'sendMail':{'type':Sequelize[_0xb7fb('0x10')],'defaultValue':![]},'email':{'type':Sequelize[_0xb7fb('0x2')]},'cc':{'type':Sequelize[_0xb7fb('0x11')]},'bcc':{'type':Sequelize[_0xb7fb('0x11')]},'sendIfEmpty':{'type':Sequelize[_0xb7fb('0x10')],'defaultValue':!![]}}; \ No newline at end of file +var _0xb45c=['STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','hours','minutes','csv','xlsx','custom','default','TEXT','sequelize','exports'];(function(_0x1aba25,_0x1faed1){var _0x47d997=function(_0x4f9e11){while(--_0x4f9e11){_0x1aba25['push'](_0x1aba25['shift']());}};_0x47d997(++_0x1faed1);}(_0xb45c,0xdb));var _0xcb45=function(_0x15699f,_0x1240ec){_0x15699f=_0x15699f-0x0;var _0xea0d33=_0xb45c[_0x15699f];return _0xea0d33;};'use strict';var Sequelize=require(_0xcb45('0x0'));module[_0xcb45('0x1')]={'name':{'type':Sequelize[_0xcb45('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xcb45('0x2')]},'active':{'type':Sequelize[_0xcb45('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xcb45('0x2')],'allowNull':![],'defaultValue':_0xcb45('0x4')},'startAt':{'type':Sequelize[_0xcb45('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xcb45('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xcb45('0x7')](_0xcb45('0x8'),_0xcb45('0x9'),'months','weeks','days',_0xcb45('0xa'),_0xcb45('0xb')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xcb45('0x7')](_0xcb45('0xc'),'pdf',_0xcb45('0xd')),'allowNull':![],'defaultValue':_0xcb45('0xc')},'type':{'type':Sequelize[_0xcb45('0x7')](_0xcb45('0xe'),_0xcb45('0xf')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xcb45('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xcb45('0x10')]},'sendIfEmpty':{'type':Sequelize[_0xcb45('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 8d64cfc..12dffa7 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 _0x35ab=['intersection','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','destroy','run','../../config/schedule','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','Content-Range','json','apply','save','update','then','Scheduler','UserProfileResource','sendStatus','error','stack','name','send','index','Schedule','rawAttributes','type','key','model','map','query','filters','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','params','keys'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x35ab,0xad));var _0xb35a=function(_0x19cc8f,_0x1a40ea){_0x19cc8f=_0x19cc8f-0x0;var _0x2e3d66=_0x35ab[_0x19cc8f];return _0x2e3d66;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb35a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb35a('0x1'));var rp=require('request-promise');var moment=require(_0xb35a('0x2'));var BPromise=require(_0xb35a('0x3'));var Mustache=require(_0xb35a('0x4'));var util=require(_0xb35a('0x5'));var path=require(_0xb35a('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb35a('0x7'));var fs=require('fs');var fs_extra=require(_0xb35a('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb35a('0x9'));var jsforce=require(_0xb35a('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xb35a('0xb'));var querystring=require(_0xb35a('0xc'));var Papa=require(_0xb35a('0xd'));var Redis=require(_0xb35a('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb35a('0xf'));var hardwareService=require(_0xb35a('0x10'));var logger=require(_0xb35a('0x11'))(_0xb35a('0x12'));var utils=require(_0xb35a('0x13'));var config=require(_0xb35a('0x14'));var licenseUtil=require(_0xb35a('0x15'));var db=require(_0xb35a('0x16'))['db'];function respondWithStatusCode(_0x351ef3,_0x5281a8){_0x5281a8=_0x5281a8||0xcc;return function(_0x3a5c57){if(_0x3a5c57){return _0x351ef3['sendStatus'](_0x5281a8);}return _0x351ef3[_0xb35a('0x17')](_0x5281a8)[_0xb35a('0x18')]();};}function respondWithResult(_0xfbdbd4,_0x2e42fb){_0x2e42fb=_0x2e42fb||0xc8;return function(_0x26b4a6){if(_0x26b4a6){return _0xfbdbd4['status'](_0x2e42fb)['json'](_0x26b4a6);}};}function respondWithFilteredResult(_0x22244c,_0x4c21ad){return function(_0x446d40){if(_0x446d40){var _0x15d275=typeof _0x4c21ad['offset']===_0xb35a('0x19')&&typeof _0x4c21ad[_0xb35a('0x1a')]===_0xb35a('0x19');var _0x33f20a=_0x446d40[_0xb35a('0x1b')];var _0xb3f1b3=_0x15d275?0x0:_0x4c21ad[_0xb35a('0x1c')];var _0x1e61da=_0x15d275?_0x446d40[_0xb35a('0x1b')]:_0x4c21ad['offset']+_0x4c21ad['limit'];var _0x1484d4;if(_0x1e61da>=_0x33f20a){_0x1e61da=_0x33f20a;_0x1484d4=0xc8;}else{_0x1484d4=0xce;}_0x22244c[_0xb35a('0x17')](_0x1484d4);return _0x22244c['set'](_0xb35a('0x1d'),_0xb3f1b3+'-'+_0x1e61da+'/'+_0x33f20a)[_0xb35a('0x1e')](_0x446d40);}return null;};}function patchUpdates(_0x5e6a6c){return function(_0x531690){try{jsonpatch[_0xb35a('0x1f')](_0x531690,_0x5e6a6c,!![]);}catch(_0x1b36e5){return BPromise['reject'](_0x1b36e5);}return _0x531690[_0xb35a('0x20')]();};}function saveUpdates(_0x475fb6,_0x57e15d){return function(_0x19cd10){if(_0x19cd10){return _0x19cd10[_0xb35a('0x21')](_0x475fb6)[_0xb35a('0x22')](function(_0x264282){return _0x264282;});}return null;};}function removeEntity(_0x462345,_0x30242f){return function(_0x286ce0){if(_0x286ce0){return _0x286ce0['destroy']()[_0xb35a('0x22')](function(){var _0x488304=_0x286ce0['get']({'plain':!![]});var _0x1b4557=_0xb35a('0x23');return db[_0xb35a('0x24')]['destroy']({'where':{'type':_0x1b4557,'resourceId':_0x488304['id']}})['then'](function(){return _0x286ce0;});})[_0xb35a('0x22')](function(){_0x462345[_0xb35a('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e54b5,_0x16afeb){return function(_0x18882e){if(!_0x18882e){_0x3e54b5[_0xb35a('0x25')](0x194);}return _0x18882e;};}function handleError(_0x468d89,_0x292907){_0x292907=_0x292907||0x1f4;return function(_0x310eb3){logger[_0xb35a('0x26')](_0x310eb3[_0xb35a('0x27')]);if(_0x310eb3[_0xb35a('0x28')]){delete _0x310eb3[_0xb35a('0x28')];}_0x468d89[_0xb35a('0x17')](_0x292907)[_0xb35a('0x29')](_0x310eb3);};}exports[_0xb35a('0x2a')]=function(_0x22b3be,_0x2cfce5){var _0x25e964={},_0x2edb8d={},_0x1be565={'count':0x0,'rows':[]};var _0x2bd091=_['map'](db[_0xb35a('0x2b')][_0xb35a('0x2c')],function(_0x3bc50a){return{'name':_0x3bc50a['fieldName'],'type':_0x3bc50a[_0xb35a('0x2d')][_0xb35a('0x2e')]};});_0x2edb8d[_0xb35a('0x2f')]=_[_0xb35a('0x30')](_0x2bd091,_0xb35a('0x28'));_0x2edb8d[_0xb35a('0x31')]=_['keys'](_0x22b3be[_0xb35a('0x31')]);_0x2edb8d[_0xb35a('0x32')]=_['intersection'](_0x2edb8d[_0xb35a('0x2f')],_0x2edb8d[_0xb35a('0x31')]);_0x25e964[_0xb35a('0x33')]=_['intersection'](_0x2edb8d[_0xb35a('0x2f')],qs[_0xb35a('0x34')](_0x22b3be[_0xb35a('0x31')][_0xb35a('0x34')]));_0x25e964[_0xb35a('0x33')]=_0x25e964[_0xb35a('0x33')]['length']?_0x25e964['attributes']:_0x2edb8d[_0xb35a('0x2f')];if(!_0x22b3be['query']['hasOwnProperty'](_0xb35a('0x35'))){_0x25e964['limit']=qs['limit'](_0x22b3be[_0xb35a('0x31')][_0xb35a('0x1a')]);_0x25e964[_0xb35a('0x1c')]=qs['offset'](_0x22b3be[_0xb35a('0x31')]['offset']);}_0x25e964[_0xb35a('0x36')]=qs[_0xb35a('0x37')](_0x22b3be[_0xb35a('0x31')][_0xb35a('0x37')]);_0x25e964[_0xb35a('0x38')]=qs[_0xb35a('0x32')](_[_0xb35a('0x39')](_0x22b3be[_0xb35a('0x31')],_0x2edb8d[_0xb35a('0x32')]),_0x2bd091);if(_0x22b3be['query'][_0xb35a('0x3a')]){_0x25e964[_0xb35a('0x38')]=_[_0xb35a('0x3b')](_0x25e964[_0xb35a('0x38')],{'$or':_[_0xb35a('0x30')](_0x2bd091,function(_0x393ba9){if(_0x393ba9[_0xb35a('0x2d')]!==_0xb35a('0x3c')){var _0x311e7c={};_0x311e7c[_0x393ba9[_0xb35a('0x28')]]={'$like':'%'+_0x22b3be[_0xb35a('0x31')]['filter']+'%'};return _0x311e7c;}})});}_0x25e964=_[_0xb35a('0x3b')]({},_0x25e964,_0x22b3be['options']);var _0x3aba21={'where':_0x25e964[_0xb35a('0x38')]};return db[_0xb35a('0x2b')]['count'](_0x3aba21)[_0xb35a('0x22')](function(_0x5530e3){_0x1be565[_0xb35a('0x1b')]=_0x5530e3;if(_0x22b3be[_0xb35a('0x31')][_0xb35a('0x3d')]){_0x25e964[_0xb35a('0x3e')]=[{'all':!![]}];}return db[_0xb35a('0x2b')][_0xb35a('0x3f')](_0x25e964);})[_0xb35a('0x22')](function(_0xe81284){_0x1be565['rows']=_0xe81284;return _0x1be565;})[_0xb35a('0x22')](respondWithFilteredResult(_0x2cfce5,_0x25e964))[_0xb35a('0x40')](handleError(_0x2cfce5,null));};exports['show']=function(_0x7e34d4,_0x33b945){var _0x42723d={'raw':![],'where':{'id':_0x7e34d4[_0xb35a('0x41')]['id']}},_0x3e7088={};_0x3e7088[_0xb35a('0x2f')]=_['keys'](db[_0xb35a('0x2b')][_0xb35a('0x2c')]);_0x3e7088[_0xb35a('0x31')]=_[_0xb35a('0x42')](_0x7e34d4[_0xb35a('0x31')]);_0x3e7088['filters']=_[_0xb35a('0x43')](_0x3e7088[_0xb35a('0x2f')],_0x3e7088[_0xb35a('0x31')]);_0x42723d[_0xb35a('0x33')]=_[_0xb35a('0x43')](_0x3e7088[_0xb35a('0x2f')],qs['fields'](_0x7e34d4[_0xb35a('0x31')][_0xb35a('0x34')]));_0x42723d[_0xb35a('0x33')]=_0x42723d[_0xb35a('0x33')][_0xb35a('0x44')]?_0x42723d[_0xb35a('0x33')]:_0x3e7088[_0xb35a('0x2f')];if(_0x7e34d4['query']['includeAll']){_0x42723d[_0xb35a('0x3e')]=[{'all':!![]}];}_0x42723d=_[_0xb35a('0x3b')]({},_0x42723d,_0x7e34d4['options']);return db[_0xb35a('0x2b')][_0xb35a('0x45')](_0x42723d)[_0xb35a('0x22')](handleEntityNotFound(_0x33b945,null))['then'](respondWithResult(_0x33b945,null))[_0xb35a('0x40')](handleError(_0x33b945,null));};exports[_0xb35a('0x46')]=function(_0x37186f,_0x1a59cc){return db['Schedule']['create'](_0x37186f[_0xb35a('0x47')],{})[_0xb35a('0x22')](function(_0x325cb5){var _0x2a0445=_0x37186f[_0xb35a('0x48')][_0xb35a('0x49')]({'plain':!![]});if(!_0x2a0445)throw new Error(_0xb35a('0x4a'));if(_0x2a0445['role']===_0xb35a('0x48')){var _0x47033=_0x325cb5['get']({'plain':!![]});var _0x5b7952=_0xb35a('0x23');return db['UserProfileSection'][_0xb35a('0x45')]({'where':{'name':_0x5b7952,'userProfileId':_0x2a0445[_0xb35a('0x4b')]},'raw':!![]})[_0xb35a('0x22')](function(_0x4e4bd1){if(_0x4e4bd1&&_0x4e4bd1[_0xb35a('0x4c')]===0x0){return db[_0xb35a('0x24')][_0xb35a('0x46')]({'name':_0x47033[_0xb35a('0x28')],'resourceId':_0x47033['id'],'type':_0x4e4bd1['name'],'sectionId':_0x4e4bd1['id']},{})[_0xb35a('0x22')](function(){return _0x325cb5;});}else{return _0x325cb5;}})[_0xb35a('0x40')](function(_0x167708){logger[_0xb35a('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x167708);throw _0x167708;});}return _0x325cb5;})[_0xb35a('0x22')](respondWithResult(_0x1a59cc,0xc9))['catch'](handleError(_0x1a59cc,null));};exports[_0xb35a('0x21')]=function(_0x22f6e6,_0x2645fe){if(_0x22f6e6[_0xb35a('0x47')]['id']){delete _0x22f6e6[_0xb35a('0x47')]['id'];}return db['Schedule'][_0xb35a('0x45')]({'where':{'id':_0x22f6e6[_0xb35a('0x41')]['id']}})[_0xb35a('0x22')](handleEntityNotFound(_0x2645fe,null))[_0xb35a('0x22')](saveUpdates(_0x22f6e6[_0xb35a('0x47')],null))[_0xb35a('0x22')](respondWithResult(_0x2645fe,null))[_0xb35a('0x40')](handleError(_0x2645fe,null));};exports[_0xb35a('0x4d')]=function(_0x2aa7de,_0x50ba90){return db['Schedule'][_0xb35a('0x45')]({'where':{'id':_0x2aa7de[_0xb35a('0x41')]['id']}})['then'](handleEntityNotFound(_0x50ba90,null))['then'](removeEntity(_0x50ba90,null))[_0xb35a('0x40')](handleError(_0x50ba90,null));};exports[_0xb35a('0x4e')]=function(_0x50dd44,_0x55525c,_0x6343c9){var _0x18fd15=require(_0xb35a('0x4f'));return db[_0xb35a('0x2b')][_0xb35a('0x45')]({'where':{'id':_0x50dd44[_0xb35a('0x41')]['id']},'raw':!![]})[_0xb35a('0x22')](handleEntityNotFound(_0x55525c,null))[_0xb35a('0x22')](function(){_0x18fd15['run'](_0x50dd44['params']['id']);})[_0xb35a('0x22')](respondWithStatusCode(_0x55525c,null))[_0xb35a('0x40')](handleError(_0x55525c,null));}; \ No newline at end of file +var _0x5867=['type','key','query','keys','attributes','intersection','model','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','Schedule','include','rows','catch','rawAttributes','fields','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','params','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','json','undefined','limit','offset','count','status','Content-Range','apply','reject','save','update','then','get','Scheduler','UserProfileResource','destroy','stack','name','send','index','map','fieldName'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x5867,0x12f));var _0x7586=function(_0x2074fb,_0x26707f){_0x2074fb=_0x2074fb-0x0;var _0x4c71d3=_0x5867[_0x2074fb];return _0x4c71d3;};'use strict';var emlformat=require(_0x7586('0x0'));var rimraf=require(_0x7586('0x1'));var zipdir=require(_0x7586('0x2'));var jsonpatch=require(_0x7586('0x3'));var rp=require(_0x7586('0x4'));var moment=require(_0x7586('0x5'));var BPromise=require(_0x7586('0x6'));var Mustache=require('mustache');var util=require(_0x7586('0x7'));var path=require(_0x7586('0x8'));var sox=require(_0x7586('0x9'));var csv=require(_0x7586('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7586('0xb'));var _=require(_0x7586('0xc'));var squel=require(_0x7586('0xd'));var crypto=require(_0x7586('0xe'));var jsforce=require(_0x7586('0xf'));var deskjs=require(_0x7586('0x10'));var toCsv=require(_0x7586('0xa'));var querystring=require(_0x7586('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7586('0x12'));var as=require(_0x7586('0x13'));var hardwareService=require(_0x7586('0x14'));var logger=require(_0x7586('0x15'))(_0x7586('0x16'));var utils=require(_0x7586('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7586('0x18'))['db'];function respondWithStatusCode(_0x363557,_0x590186){_0x590186=_0x590186||0xcc;return function(_0x178e67){if(_0x178e67){return _0x363557[_0x7586('0x19')](_0x590186);}return _0x363557['status'](_0x590186)[_0x7586('0x1a')]();};}function respondWithResult(_0x23c00d,_0x697677){_0x697677=_0x697677||0xc8;return function(_0x41f5f8){if(_0x41f5f8){return _0x23c00d['status'](_0x697677)[_0x7586('0x1b')](_0x41f5f8);}};}function respondWithFilteredResult(_0x35c05e,_0x1c2901){return function(_0x4a0090){if(_0x4a0090){var _0x190fc4=typeof _0x1c2901['offset']===_0x7586('0x1c')&&typeof _0x1c2901[_0x7586('0x1d')]===_0x7586('0x1c');var _0x34feed=_0x4a0090['count'];var _0x222911=_0x190fc4?0x0:_0x1c2901[_0x7586('0x1e')];var _0x5877ef=_0x190fc4?_0x4a0090[_0x7586('0x1f')]:_0x1c2901[_0x7586('0x1e')]+_0x1c2901[_0x7586('0x1d')];var _0x506c4d;if(_0x5877ef>=_0x34feed){_0x5877ef=_0x34feed;_0x506c4d=0xc8;}else{_0x506c4d=0xce;}_0x35c05e[_0x7586('0x20')](_0x506c4d);return _0x35c05e['set'](_0x7586('0x21'),_0x222911+'-'+_0x5877ef+'/'+_0x34feed)[_0x7586('0x1b')](_0x4a0090);}return null;};}function patchUpdates(_0x10cf32){return function(_0x5e7b7f){try{jsonpatch[_0x7586('0x22')](_0x5e7b7f,_0x10cf32,!![]);}catch(_0x31ad0a){return BPromise[_0x7586('0x23')](_0x31ad0a);}return _0x5e7b7f[_0x7586('0x24')]();};}function saveUpdates(_0x535d67,_0x3846f5){return function(_0x385de5){if(_0x385de5){return _0x385de5[_0x7586('0x25')](_0x535d67)[_0x7586('0x26')](function(_0x5c0203){return _0x5c0203;});}return null;};}function removeEntity(_0x36b9e7,_0x5a6a2b){return function(_0x142923){if(_0x142923){return _0x142923['destroy']()['then'](function(){var _0x3b289a=_0x142923[_0x7586('0x27')]({'plain':!![]});var _0xc4623=_0x7586('0x28');return db[_0x7586('0x29')][_0x7586('0x2a')]({'where':{'type':_0xc4623,'resourceId':_0x3b289a['id']}})[_0x7586('0x26')](function(){return _0x142923;});})[_0x7586('0x26')](function(){_0x36b9e7[_0x7586('0x20')](0xcc)[_0x7586('0x1a')]();});}};}function handleEntityNotFound(_0x1a4cdb,_0x3f0ba4){return function(_0x4a1e89){if(!_0x4a1e89){_0x1a4cdb['sendStatus'](0x194);}return _0x4a1e89;};}function handleError(_0x1fd99d,_0x305a01){_0x305a01=_0x305a01||0x1f4;return function(_0x304df1){logger['error'](_0x304df1[_0x7586('0x2b')]);if(_0x304df1[_0x7586('0x2c')]){delete _0x304df1[_0x7586('0x2c')];}_0x1fd99d['status'](_0x305a01)[_0x7586('0x2d')](_0x304df1);};}exports[_0x7586('0x2e')]=function(_0x24394d,_0x2970a8){var _0x2b3717={},_0x469c01={},_0x5e855e={'count':0x0,'rows':[]};var _0x4674a7=_[_0x7586('0x2f')](db['Schedule']['rawAttributes'],function(_0x528e1e){return{'name':_0x528e1e[_0x7586('0x30')],'type':_0x528e1e[_0x7586('0x31')][_0x7586('0x32')]};});_0x469c01['model']=_[_0x7586('0x2f')](_0x4674a7,_0x7586('0x2c'));_0x469c01[_0x7586('0x33')]=_[_0x7586('0x34')](_0x24394d[_0x7586('0x33')]);_0x469c01['filters']=_['intersection'](_0x469c01['model'],_0x469c01[_0x7586('0x33')]);_0x2b3717[_0x7586('0x35')]=_[_0x7586('0x36')](_0x469c01[_0x7586('0x37')],qs['fields'](_0x24394d['query']['fields']));_0x2b3717['attributes']=_0x2b3717['attributes'][_0x7586('0x38')]?_0x2b3717['attributes']:_0x469c01[_0x7586('0x37')];if(!_0x24394d[_0x7586('0x33')][_0x7586('0x39')](_0x7586('0x3a'))){_0x2b3717[_0x7586('0x1d')]=qs[_0x7586('0x1d')](_0x24394d[_0x7586('0x33')]['limit']);_0x2b3717[_0x7586('0x1e')]=qs[_0x7586('0x1e')](_0x24394d[_0x7586('0x33')][_0x7586('0x1e')]);}_0x2b3717[_0x7586('0x3b')]=qs[_0x7586('0x3c')](_0x24394d[_0x7586('0x33')][_0x7586('0x3c')]);_0x2b3717[_0x7586('0x3d')]=qs[_0x7586('0x3e')](_[_0x7586('0x3f')](_0x24394d['query'],_0x469c01[_0x7586('0x3e')]),_0x4674a7);if(_0x24394d[_0x7586('0x33')][_0x7586('0x40')]){_0x2b3717['where']=_[_0x7586('0x41')](_0x2b3717[_0x7586('0x3d')],{'$or':_['map'](_0x4674a7,function(_0x356ba5){if(_0x356ba5[_0x7586('0x31')]!==_0x7586('0x42')){var _0x5240c5={};_0x5240c5[_0x356ba5[_0x7586('0x2c')]]={'$like':'%'+_0x24394d['query'][_0x7586('0x40')]+'%'};return _0x5240c5;}})});}_0x2b3717=_[_0x7586('0x41')]({},_0x2b3717,_0x24394d['options']);var _0x45067a={'where':_0x2b3717[_0x7586('0x3d')]};return db[_0x7586('0x43')][_0x7586('0x1f')](_0x45067a)[_0x7586('0x26')](function(_0x197f6f){_0x5e855e['count']=_0x197f6f;if(_0x24394d[_0x7586('0x33')]['includeAll']){_0x2b3717[_0x7586('0x44')]=[{'all':!![]}];}return db[_0x7586('0x43')]['findAll'](_0x2b3717);})[_0x7586('0x26')](function(_0x216af3){_0x5e855e[_0x7586('0x45')]=_0x216af3;return _0x5e855e;})['then'](respondWithFilteredResult(_0x2970a8,_0x2b3717))[_0x7586('0x46')](handleError(_0x2970a8,null));};exports['show']=function(_0x52c57e,_0x38dbf8){var _0x305528={'raw':![],'where':{'id':_0x52c57e['params']['id']}},_0x30f7fb={};_0x30f7fb[_0x7586('0x37')]=_['keys'](db[_0x7586('0x43')][_0x7586('0x47')]);_0x30f7fb['query']=_[_0x7586('0x34')](_0x52c57e[_0x7586('0x33')]);_0x30f7fb[_0x7586('0x3e')]=_[_0x7586('0x36')](_0x30f7fb['model'],_0x30f7fb[_0x7586('0x33')]);_0x305528['attributes']=_['intersection'](_0x30f7fb[_0x7586('0x37')],qs[_0x7586('0x48')](_0x52c57e[_0x7586('0x33')][_0x7586('0x48')]));_0x305528[_0x7586('0x35')]=_0x305528['attributes'][_0x7586('0x38')]?_0x305528[_0x7586('0x35')]:_0x30f7fb['model'];if(_0x52c57e[_0x7586('0x33')][_0x7586('0x49')]){_0x305528[_0x7586('0x44')]=[{'all':!![]}];}_0x305528=_['merge']({},_0x305528,_0x52c57e[_0x7586('0x4a')]);return db[_0x7586('0x43')]['find'](_0x305528)['then'](handleEntityNotFound(_0x38dbf8,null))[_0x7586('0x26')](respondWithResult(_0x38dbf8,null))[_0x7586('0x46')](handleError(_0x38dbf8,null));};exports[_0x7586('0x4b')]=function(_0x508506,_0x5d88a5){return db[_0x7586('0x43')][_0x7586('0x4b')](_0x508506[_0x7586('0x4c')],{})['then'](function(_0x2bafb9){var _0x26c34c=_0x508506[_0x7586('0x4d')][_0x7586('0x27')]({'plain':!![]});if(!_0x26c34c)throw new Error(_0x7586('0x4e'));if(_0x26c34c[_0x7586('0x4f')]===_0x7586('0x4d')){var _0x505bcc=_0x2bafb9[_0x7586('0x27')]({'plain':!![]});var _0x2ec152='Scheduler';return db[_0x7586('0x50')][_0x7586('0x51')]({'where':{'name':_0x2ec152,'userProfileId':_0x26c34c[_0x7586('0x52')]},'raw':!![]})[_0x7586('0x26')](function(_0x2683a4){if(_0x2683a4&&_0x2683a4[_0x7586('0x53')]===0x0){return db[_0x7586('0x29')]['create']({'name':_0x505bcc[_0x7586('0x2c')],'resourceId':_0x505bcc['id'],'type':_0x2683a4[_0x7586('0x2c')],'sectionId':_0x2683a4['id']},{})[_0x7586('0x26')](function(){return _0x2bafb9;});}else{return _0x2bafb9;}})[_0x7586('0x46')](function(_0x2f7c2a){logger[_0x7586('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f7c2a);throw _0x2f7c2a;});}return _0x2bafb9;})[_0x7586('0x26')](respondWithResult(_0x5d88a5,0xc9))[_0x7586('0x46')](handleError(_0x5d88a5,null));};exports[_0x7586('0x25')]=function(_0x1a37a4,_0x54553c){if(_0x1a37a4[_0x7586('0x4c')]['id']){delete _0x1a37a4[_0x7586('0x4c')]['id'];}return db[_0x7586('0x43')][_0x7586('0x51')]({'where':{'id':_0x1a37a4['params']['id']}})['then'](handleEntityNotFound(_0x54553c,null))[_0x7586('0x26')](saveUpdates(_0x1a37a4[_0x7586('0x4c')],null))[_0x7586('0x26')](respondWithResult(_0x54553c,null))[_0x7586('0x46')](handleError(_0x54553c,null));};exports['destroy']=function(_0x4b6d47,_0x3f8c17){return db['Schedule'][_0x7586('0x51')]({'where':{'id':_0x4b6d47[_0x7586('0x55')]['id']}})[_0x7586('0x26')](handleEntityNotFound(_0x3f8c17,null))['then'](removeEntity(_0x3f8c17,null))['catch'](handleError(_0x3f8c17,null));};exports[_0x7586('0x56')]=function(_0x1a52e3,_0x4145cf,_0x3547a3){var _0x11e714=require(_0x7586('0x57'));return db['Schedule']['find']({'where':{'id':_0x1a52e3['params']['id']},'raw':!![]})[_0x7586('0x26')](handleEntityNotFound(_0x4145cf,null))[_0x7586('0x26')](function(){_0x11e714['run'](_0x1a52e3[_0x7586('0x55')]['id']);})[_0x7586('0x26')](respondWithStatusCode(_0x4145cf,null))[_0x7586('0x46')](handleError(_0x4145cf,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 4620a10..f7ca194 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 _0x755c=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./schedule.attributes','exports','Schedule','tools_schedules','lodash'];(function(_0x36684b,_0x25725f){var _0xdd1f83=function(_0x4b219b){while(--_0x4b219b){_0x36684b['push'](_0x36684b['shift']());}};_0xdd1f83(++_0x25725f);}(_0x755c,0x77));var _0xc755=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x755c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc755('0x0'));var util=require('util');var logger=require(_0xc755('0x1'))(_0xc755('0x2'));var moment=require(_0xc755('0x3'));var BPromise=require(_0xc755('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc755('0x5'));var rimraf=require(_0xc755('0x6'));var config=require(_0xc755('0x7'));var attributes=require(_0xc755('0x8'));module[_0xc755('0x9')]=function(_0x2ca7d2,_0xe5eb77){return _0x2ca7d2['define'](_0xc755('0xa'),attributes,{'tableName':_0xc755('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb64f=['define','Schedule','tools_schedules','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0xb64f,0x137));var _0xfb64=function(_0x18abd2,_0x22d4b3){_0x18abd2=_0x18abd2-0x0;var _0x1dcad6=_0xb64f[_0x18abd2];return _0x1dcad6;};'use strict';var _=require(_0xfb64('0x0'));var util=require(_0xfb64('0x1'));var logger=require(_0xfb64('0x2'))(_0xfb64('0x3'));var moment=require('moment');var BPromise=require(_0xfb64('0x4'));var rp=require(_0xfb64('0x5'));var fs=require('fs');var path=require(_0xfb64('0x6'));var rimraf=require(_0xfb64('0x7'));var config=require(_0xfb64('0x8'));var attributes=require(_0xfb64('0x9'));module[_0xfb64('0xa')]=function(_0x15bbf1,_0x39558f){return _0x15bbf1[_0xfb64('0xb')](_0xfb64('0xc'),attributes,{'tableName':_0xfb64('0xd'),'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 301dd9d..deeb8f6 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 _0xd776=['request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s'];(function(_0xe705ab,_0x1f8b00){var _0x538fa5=function(_0x44fd6e){while(--_0x44fd6e){_0xe705ab['push'](_0xe705ab['shift']());}};_0x538fa5(++_0x1f8b00);}(_0xd776,0x13f));var _0x6d77=function(_0x141307,_0x7694e9){_0x141307=_0x141307-0x0;var _0x32b59e=_0xd776[_0x141307];return _0x32b59e;};'use strict';var _=require(_0x6d77('0x0'));var util=require(_0x6d77('0x1'));var moment=require(_0x6d77('0x2'));var BPromise=require(_0x6d77('0x3'));var rs=require(_0x6d77('0x4'));var fs=require('fs');var Redis=require(_0x6d77('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d77('0x6'));var logger=require('../../config/logger')(_0x6d77('0x7'));var config=require(_0x6d77('0x8'));var jayson=require(_0x6d77('0x9'));var client=jayson[_0x6d77('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32871a,_0xb6b79e,_0x18e14f){return new BPromise(function(_0x5e6407,_0x3d1f47){return client[_0x6d77('0xb')](_0x32871a,_0x18e14f)[_0x6d77('0xc')](function(_0xc48d84){logger[_0x6d77('0xd')](_0x6d77('0xe'),_0xb6b79e,'request\x20sent');logger[_0x6d77('0xf')](_0x6d77('0x10'),_0xb6b79e,_0x6d77('0x11'),JSON[_0x6d77('0x12')](_0xc48d84));if(_0xc48d84[_0x6d77('0x13')]){if(_0xc48d84[_0x6d77('0x13')][_0x6d77('0x14')]===0x1f4){logger['error'](_0x6d77('0xe'),_0xb6b79e,_0xc48d84['error'][_0x6d77('0x15')]);return _0x3d1f47(_0xc48d84['error']['message']);}logger[_0x6d77('0x13')](_0x6d77('0xe'),_0xb6b79e,_0xc48d84['error'][_0x6d77('0x15')]);return _0x5e6407(_0xc48d84[_0x6d77('0x13')][_0x6d77('0x15')]);}else{logger[_0x6d77('0xd')](_0x6d77('0xe'),_0xb6b79e,_0x6d77('0x11'));_0x5e6407(_0xc48d84[_0x6d77('0x16')]['message']);}})[_0x6d77('0x17')](function(_0x11ec1c){logger[_0x6d77('0x13')](_0x6d77('0xe'),_0xb6b79e,_0x11ec1c);_0x3d1f47(_0x11ec1c);});});} \ No newline at end of file +var _0x6604=['randomstring','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','Schedule,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird'];(function(_0x6acb69,_0xd36dbf){var _0x29a021=function(_0x374293){while(--_0x374293){_0x6acb69['push'](_0x6acb69['shift']());}};_0x29a021(++_0xd36dbf);}(_0x6604,0x1b4));var _0x4660=function(_0x367ee6,_0x57bb34){_0x367ee6=_0x367ee6-0x0;var _0x2fecb9=_0x6604[_0x367ee6];return _0x2fecb9;};'use strict';var _=require(_0x4660('0x0'));var util=require(_0x4660('0x1'));var moment=require(_0x4660('0x2'));var BPromise=require(_0x4660('0x3'));var rs=require(_0x4660('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4660('0x5'))(_0x4660('0x6'));var config=require(_0x4660('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4660('0x8')][_0x4660('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3338d0,_0x16909f,_0x2a6497){return new BPromise(function(_0x5715a4,_0x5f2e84){return client[_0x4660('0xa')](_0x3338d0,_0x2a6497)[_0x4660('0xb')](function(_0x31633f){logger[_0x4660('0xc')]('Schedule,\x20%s,\x20%s',_0x16909f,_0x4660('0xd'));logger[_0x4660('0xe')](_0x4660('0xf'),_0x16909f,_0x4660('0xd'),JSON[_0x4660('0x10')](_0x31633f));if(_0x31633f[_0x4660('0x11')]){if(_0x31633f[_0x4660('0x11')][_0x4660('0x12')]===0x1f4){logger[_0x4660('0x11')](_0x4660('0x13'),_0x16909f,_0x31633f[_0x4660('0x11')][_0x4660('0x14')]);return _0x5f2e84(_0x31633f['error'][_0x4660('0x14')]);}logger[_0x4660('0x11')]('Schedule,\x20%s,\x20%s',_0x16909f,_0x31633f['error'][_0x4660('0x14')]);return _0x5715a4(_0x31633f[_0x4660('0x11')]['message']);}else{logger[_0x4660('0xc')](_0x4660('0x13'),_0x16909f,_0x4660('0xd'));_0x5715a4(_0x31633f['result'][_0x4660('0x14')]);}})[_0x4660('0x15')](function(_0x528abc){logger['error'](_0x4660('0x13'),_0x16909f,_0x528abc);_0x5f2e84(_0x528abc);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index f3c9b0e..606e474 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 _0x962a=['/describe','describe','show','get','/:id/download','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./screenRecording.controller','isAuthenticated','index'];(function(_0x395b09,_0x11f392){var _0x2a97e2=function(_0x1d8ab4){while(--_0x1d8ab4){_0x395b09['push'](_0x395b09['shift']());}};_0x2a97e2(++_0x11f392);}(_0x962a,0x14f));var _0xa962=function(_0x398157,_0x1953ab){_0x398157=_0x398157-0x0;var _0x356075=_0x962a[_0x398157];return _0x356075;};'use strict';var multer=require(_0xa962('0x0'));var util=require(_0xa962('0x1'));var path=require(_0xa962('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa962('0x3')]();var fs_extra=require(_0xa962('0x4'));var auth=require(_0xa962('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa962('0x6'));var controller=require(_0xa962('0x7'));router['get']('/',auth[_0xa962('0x8')](),controller[_0xa962('0x9')]);router['get'](_0xa962('0xa'),auth['isAuthenticated'](),controller[_0xa962('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa962('0xc')]);router[_0xa962('0xd')](_0xa962('0xe'),auth[_0xa962('0x8')](),controller['download']);router[_0xa962('0xf')]('/',auth[_0xa962('0x8')](),controller[_0xa962('0x10')]);router[_0xa962('0x11')](_0xa962('0x12'),auth['isAuthenticated'](),controller[_0xa962('0x13')]);router[_0xa962('0x14')](_0xa962('0x12'),auth[_0xa962('0x8')](),controller[_0xa962('0x15')]);module[_0xa962('0x16')]=router; \ No newline at end of file +var _0x8455=['../../config/environment','./screenRecording.controller','get','isAuthenticated','/describe','describe','/:id','/:id/download','download','create','update','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x4686cc,_0x505193){var _0x5ea695=function(_0x31f9aa){while(--_0x31f9aa){_0x4686cc['push'](_0x4686cc['shift']());}};_0x5ea695(++_0x505193);}(_0x8455,0x104));var _0x5845=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8455[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x5845('0x0'));var util=require('util');var path=require(_0x5845('0x1'));var timeout=require(_0x5845('0x2'));var express=require('express');var router=express[_0x5845('0x3')]();var fs_extra=require(_0x5845('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5845('0x5'));var config=require(_0x5845('0x6'));var controller=require(_0x5845('0x7'));router[_0x5845('0x8')]('/',auth[_0x5845('0x9')](),controller['index']);router['get'](_0x5845('0xa'),auth['isAuthenticated'](),controller[_0x5845('0xb')]);router[_0x5845('0x8')](_0x5845('0xc'),auth[_0x5845('0x9')](),controller['show']);router[_0x5845('0x8')](_0x5845('0xd'),auth[_0x5845('0x9')](),controller[_0x5845('0xe')]);router['post']('/',auth[_0x5845('0x9')](),controller[_0x5845('0xf')]);router['put'](_0x5845('0xc'),auth[_0x5845('0x9')](),controller[_0x5845('0x10')]);router[_0x5845('0x11')](_0x5845('0xc'),auth[_0x5845('0x9')](),controller[_0x5845('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index e78ce91..7b635c3 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 _0x3cae=['toString','closedAt','MM-DD-YYYY\x20HH:mm','createdAt','format','updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','extname','STRING','setDataValue','value','INTEGER','startedAt','duration','DATE'];(function(_0x23e207,_0x34850b){var _0x2e25fa=function(_0x41bf81){while(--_0x41bf81){_0x23e207['push'](_0x23e207['shift']());}};_0x2e25fa(++_0x34850b);}(_0x3cae,0x117));var _0xe3ca=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x3cae[_0x38a7ac];return _0x53061a;};'use strict';var Sequelize=require(_0xe3ca('0x0'));var moment=require(_0xe3ca('0x1'));var path=require(_0xe3ca('0x2'));var config=require(_0xe3ca('0x3'));module[_0xe3ca('0x4')]={'format':{'type':Sequelize[_0xe3ca('0x5')],'get':function(){return this[_0xe3ca('0x6')]('value')?path[_0xe3ca('0x7')](this[_0xe3ca('0x6')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0xe3ca('0x8')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xe3ca('0x8')],'set':function(_0x7fafb4){var _0x36d17a=_0x7fafb4['replace'](/\\/g,'/');this[_0xe3ca('0x9')](_0xe3ca('0xa'),_0x36d17a);}},'rating':{'type':Sequelize[_0xe3ca('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xe3ca('0xb')],'set':function(_0x1ae7bf){this[_0xe3ca('0x9')](_0xe3ca('0xc'),moment()['subtract'](_0x1ae7bf,'ms'));this[_0xe3ca('0x9')]('closedAt',moment());this[_0xe3ca('0x9')](_0xe3ca('0xd'),_0x1ae7bf);}},'startedAt':{'type':Sequelize[_0xe3ca('0xe')],'get':function(){return moment(this[_0xe3ca('0x6')](_0xe3ca('0xc')))['format']('MM-DD-YYYY\x20HH:mm')[_0xe3ca('0xf')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xe3ca('0x6')](_0xe3ca('0x10')))['format'](_0xe3ca('0x11'))[_0xe3ca('0xf')]();}},'createdAt':{'type':Sequelize[_0xe3ca('0xe')],'get':function(){return moment(this[_0xe3ca('0x6')](_0xe3ca('0x12')))[_0xe3ca('0x13')](_0xe3ca('0x11'))[_0xe3ca('0xf')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xe3ca('0x14')))[_0xe3ca('0x13')](_0xe3ca('0x11'))[_0xe3ca('0xf')]();}}}; \ No newline at end of file +var _0x94ff=['format','toString','MM-DD-YYYY\x20HH:mm','createdAt','updatedAt','sequelize','exports','VIRTUAL','getDataValue','extname','STRING','replace','setDataValue','INTEGER','subtract','closedAt','duration','DATE','startedAt'];(function(_0x46f418,_0x48067a){var _0x56869c=function(_0x3cf576){while(--_0x3cf576){_0x46f418['push'](_0x46f418['shift']());}};_0x56869c(++_0x48067a);}(_0x94ff,0xc3));var _0xf94f=function(_0x2004c1,_0x43828d){_0x2004c1=_0x2004c1-0x0;var _0x342e0f=_0x94ff[_0x2004c1];return _0x342e0f;};'use strict';var Sequelize=require(_0xf94f('0x0'));var moment=require('moment');var path=require('path');var config=require('../../config/environment');module[_0xf94f('0x1')]={'format':{'type':Sequelize[_0xf94f('0x2')],'get':function(){return this[_0xf94f('0x3')]('value')?path[_0xf94f('0x4')](this[_0xf94f('0x3')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0xf94f('0x5')]},'channel':{'type':Sequelize[_0xf94f('0x5')]},'value':{'type':Sequelize['STRING'],'set':function(_0x18919a){var _0x5e3f9c=_0x18919a[_0xf94f('0x6')](/\\/g,'/');this[_0xf94f('0x7')]('value',_0x5e3f9c);}},'rating':{'type':Sequelize[_0xf94f('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xf94f('0x8')],'set':function(_0x123003){this['setDataValue']('startedAt',moment()[_0xf94f('0x9')](_0x123003,'ms'));this[_0xf94f('0x7')](_0xf94f('0xa'),moment());this[_0xf94f('0x7')](_0xf94f('0xb'),_0x123003);}},'startedAt':{'type':Sequelize[_0xf94f('0xc')],'get':function(){return moment(this[_0xf94f('0x3')](_0xf94f('0xd')))[_0xf94f('0xe')]('MM-DD-YYYY\x20HH:mm')[_0xf94f('0xf')]();}},'closedAt':{'type':Sequelize[_0xf94f('0xc')],'get':function(){return moment(this[_0xf94f('0x3')](_0xf94f('0xa')))['format'](_0xf94f('0x10'))[_0xf94f('0xf')]();}},'createdAt':{'type':Sequelize[_0xf94f('0xc')],'get':function(){return moment(this[_0xf94f('0x3')](_0xf94f('0x11')))[_0xf94f('0xe')]('MM-DD-YYYY\x20HH:mm')[_0xf94f('0xf')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xf94f('0x3')](_0xf94f('0x12')))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 34ea203..83cccf1 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 _0x8958=['pick','merge','VIRTUAL','filter','options','ScreenRecording','include','findAll','params','rawAttributes','includeAll','create','catch','body','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','find','value','join','root','server/files/screen_recordings','%s.cypher','decryptFile','secrets','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','destroy','rimraf','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','error','name','send','index','map','fieldName','type','key','model','format','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x5c85fd,_0x1cf78d){var _0x4c4e96=function(_0x56bd77){while(--_0x56bd77){_0x5c85fd['push'](_0x5c85fd['shift']());}};_0x4c4e96(++_0x1cf78d);}(_0x8958,0x93));var _0x8895=function(_0x212f65,_0x4f7a57){_0x212f65=_0x212f65-0x0;var _0x2bd077=_0x8958[_0x212f65];return _0x2bd077;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8895('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8895('0x1'));var Mustache=require('mustache');var util=require(_0x8895('0x2'));var path=require(_0x8895('0x3'));var sox=require(_0x8895('0x4'));var csv=require('to-csv');var ejs=require(_0x8895('0x5'));var fs=require('fs');var fs_extra=require(_0x8895('0x6'));var _=require(_0x8895('0x7'));var squel=require(_0x8895('0x8'));var crypto=require(_0x8895('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8895('0xa'));var toCsv=require(_0x8895('0xb'));var querystring=require(_0x8895('0xc'));var Papa=require(_0x8895('0xd'));var Redis=require(_0x8895('0xe'));var authService=require(_0x8895('0xf'));var qs=require(_0x8895('0x10'));var as=require(_0x8895('0x11'));var hardwareService=require(_0x8895('0x12'));var logger=require(_0x8895('0x13'))('api');var utils=require(_0x8895('0x14'));var config=require(_0x8895('0x15'));var licenseUtil=require(_0x8895('0x16'));var db=require(_0x8895('0x17'))['db'];function respondWithStatusCode(_0x446e1a,_0xaf93bc){_0xaf93bc=_0xaf93bc||0xcc;return function(_0x5af0ef){if(_0x5af0ef){return _0x446e1a[_0x8895('0x18')](_0xaf93bc);}return _0x446e1a[_0x8895('0x19')](_0xaf93bc)[_0x8895('0x1a')]();};}function respondWithResult(_0x57d40a,_0x47b9fe){_0x47b9fe=_0x47b9fe||0xc8;return function(_0x9191b8){if(_0x9191b8){return _0x57d40a['status'](_0x47b9fe)[_0x8895('0x1b')](_0x9191b8);}};}function respondWithFilteredResult(_0x337101,_0x195789){return function(_0x3d7b59){if(_0x3d7b59){var _0x2c9d40=typeof _0x195789['offset']===_0x8895('0x1c')&&typeof _0x195789[_0x8895('0x1d')]===_0x8895('0x1c');var _0xcdd661=_0x3d7b59[_0x8895('0x1e')];var _0x1b5c82=_0x2c9d40?0x0:_0x195789[_0x8895('0x1f')];var _0x26cee0=_0x2c9d40?_0x3d7b59[_0x8895('0x1e')]:_0x195789[_0x8895('0x1f')]+_0x195789[_0x8895('0x1d')];var _0x6b8a16;if(_0x26cee0>=_0xcdd661){_0x26cee0=_0xcdd661;_0x6b8a16=0xc8;}else{_0x6b8a16=0xce;}_0x337101[_0x8895('0x19')](_0x6b8a16);return _0x337101['set']('Content-Range',_0x1b5c82+'-'+_0x26cee0+'/'+_0xcdd661)['json'](_0x3d7b59);}return null;};}function patchUpdates(_0x3daf43){return function(_0x456282){try{jsonpatch[_0x8895('0x20')](_0x456282,_0x3daf43,!![]);}catch(_0x29449a){return BPromise[_0x8895('0x21')](_0x29449a);}return _0x456282[_0x8895('0x22')]();};}function saveUpdates(_0x461346,_0xc1ce17){return function(_0x5219ca){if(_0x5219ca){return _0x5219ca[_0x8895('0x23')](_0x461346)[_0x8895('0x24')](function(_0x2a403){return _0x2a403;});}return null;};}function removeEntity(_0x1f71f3,_0x29223d){return function(_0x4d092d){if(_0x4d092d){return _0x4d092d['destroy']()[_0x8895('0x24')](function(){_0x1f71f3[_0x8895('0x19')](0xcc)[_0x8895('0x1a')]();});}};}function handleEntityNotFound(_0x24a376,_0x4fc150){return function(_0x25da11){if(!_0x25da11){_0x24a376[_0x8895('0x18')](0x194);}return _0x25da11;};}function handleError(_0x187a15,_0x5486a6){_0x5486a6=_0x5486a6||0x1f4;return function(_0x4aee03){logger[_0x8895('0x25')](_0x4aee03['stack']);if(_0x4aee03[_0x8895('0x26')]){delete _0x4aee03[_0x8895('0x26')];}_0x187a15[_0x8895('0x19')](_0x5486a6)[_0x8895('0x27')](_0x4aee03);};}exports[_0x8895('0x28')]=function(_0x5c03ea,_0x4d567a){var _0x6e449d={},_0x37ac3a={},_0x3fc4cc={'count':0x0,'rows':[]};var _0x16b65b=_[_0x8895('0x29')](db['ScreenRecording']['rawAttributes'],function(_0x46ae32){return{'name':_0x46ae32[_0x8895('0x2a')],'type':_0x46ae32[_0x8895('0x2b')][_0x8895('0x2c')]};});_0x37ac3a[_0x8895('0x2d')]=_['differenceBy'](_[_0x8895('0x29')](_0x16b65b,'name'),[_0x8895('0x2e')]);_0x37ac3a['query']=_[_0x8895('0x2f')](_0x5c03ea[_0x8895('0x30')]);_0x37ac3a[_0x8895('0x31')]=_[_0x8895('0x32')](_0x37ac3a[_0x8895('0x2d')],_0x37ac3a['query']);_0x6e449d[_0x8895('0x33')]=_[_0x8895('0x32')](_0x37ac3a[_0x8895('0x2d')],qs[_0x8895('0x34')](_0x5c03ea[_0x8895('0x30')]['fields']));_0x6e449d[_0x8895('0x33')]=_0x6e449d['attributes'][_0x8895('0x35')]?_0x6e449d['attributes']:_0x37ac3a[_0x8895('0x2d')];if(!_0x5c03ea[_0x8895('0x30')][_0x8895('0x36')](_0x8895('0x37'))){_0x6e449d[_0x8895('0x1d')]=qs['limit'](_0x5c03ea[_0x8895('0x30')]['limit']);_0x6e449d[_0x8895('0x1f')]=qs[_0x8895('0x1f')](_0x5c03ea[_0x8895('0x30')][_0x8895('0x1f')]);}_0x6e449d[_0x8895('0x38')]=qs[_0x8895('0x39')](_0x5c03ea['query'][_0x8895('0x39')]);_0x6e449d[_0x8895('0x3a')]=qs['filters'](_[_0x8895('0x3b')](_0x5c03ea['query'],_0x37ac3a[_0x8895('0x31')]),_0x16b65b);if(_0x5c03ea[_0x8895('0x30')]['filter']){_0x6e449d[_0x8895('0x3a')]=_[_0x8895('0x3c')](_0x6e449d['where'],{'$or':_['map'](_0x16b65b,function(_0x202130){if(_0x202130[_0x8895('0x2b')]!==_0x8895('0x3d')){var _0x331a9e={};_0x331a9e[_0x202130[_0x8895('0x26')]]={'$like':'%'+_0x5c03ea['query'][_0x8895('0x3e')]+'%'};return _0x331a9e;}})});}_0x6e449d=_[_0x8895('0x3c')]({},_0x6e449d,_0x5c03ea[_0x8895('0x3f')]);var _0x10005f={'where':_0x6e449d[_0x8895('0x3a')]};return db[_0x8895('0x40')]['count'](_0x10005f)[_0x8895('0x24')](function(_0x5ebfc4){_0x3fc4cc[_0x8895('0x1e')]=_0x5ebfc4;if(_0x5c03ea[_0x8895('0x30')]['includeAll']){_0x6e449d[_0x8895('0x41')]=[{'all':!![]}];}return db['ScreenRecording'][_0x8895('0x42')](_0x6e449d);})['then'](function(_0x4af3b1){_0x3fc4cc['rows']=_0x4af3b1;return _0x3fc4cc;})['then'](respondWithFilteredResult(_0x4d567a,_0x6e449d))['catch'](handleError(_0x4d567a,null));};exports['show']=function(_0x447ed6,_0x206f57){var _0x596531={'raw':![],'where':{'id':_0x447ed6[_0x8895('0x43')]['id']}},_0x4835d7={};_0x4835d7[_0x8895('0x2d')]=_['keys'](db[_0x8895('0x40')][_0x8895('0x44')]);_0x4835d7[_0x8895('0x30')]=_[_0x8895('0x2f')](_0x447ed6[_0x8895('0x30')]);_0x4835d7['filters']=_['intersection'](_0x4835d7['model'],_0x4835d7[_0x8895('0x30')]);_0x596531['attributes']=_[_0x8895('0x32')](_0x4835d7[_0x8895('0x2d')],qs[_0x8895('0x34')](_0x447ed6[_0x8895('0x30')]['fields']));_0x596531[_0x8895('0x33')]=_0x596531[_0x8895('0x33')][_0x8895('0x35')]?_0x596531[_0x8895('0x33')]:_0x4835d7[_0x8895('0x2d')];if(_0x447ed6[_0x8895('0x30')][_0x8895('0x45')]){_0x596531[_0x8895('0x41')]=[{'all':!![]}];}_0x596531=_['merge']({},_0x596531,_0x447ed6[_0x8895('0x3f')]);return db[_0x8895('0x40')]['find'](_0x596531)[_0x8895('0x24')](handleEntityNotFound(_0x206f57,null))['then'](respondWithResult(_0x206f57,null))['catch'](handleError(_0x206f57,null));};exports[_0x8895('0x46')]=function(_0x337a9f,_0x130018){return db['ScreenRecording'][_0x8895('0x46')](_0x337a9f['body'],{})[_0x8895('0x24')](respondWithResult(_0x130018,0xc9))[_0x8895('0x47')](handleError(_0x130018,null));};exports[_0x8895('0x23')]=function(_0x1ca539,_0x2f3bf1){if(_0x1ca539[_0x8895('0x48')]['id']){delete _0x1ca539[_0x8895('0x48')]['id'];}delete _0x1ca539['body']['duration'];delete _0x1ca539[_0x8895('0x48')][_0x8895('0x49')];delete _0x1ca539['body'][_0x8895('0x4a')];delete _0x1ca539['body']['value'];return db[_0x8895('0x40')]['find']({'where':{'id':_0x1ca539[_0x8895('0x43')]['id']}})[_0x8895('0x24')](handleEntityNotFound(_0x2f3bf1,null))[_0x8895('0x24')](saveUpdates(_0x1ca539[_0x8895('0x48')],null))[_0x8895('0x24')](respondWithResult(_0x2f3bf1,null))[_0x8895('0x47')](handleError(_0x2f3bf1,null));};exports[_0x8895('0x4b')]=function(_0x38d6ae,_0x583419){return db[_0x8895('0x40')][_0x8895('0x4b')]()[_0x8895('0x24')](respondWithResult(_0x583419,null))['catch'](handleError(_0x583419,null));};exports[_0x8895('0x4c')]=function(_0x3935fd,_0xd7ffeb,_0x14e769){var _0x1e264a=require(_0x8895('0x4d'));var _0x434ab8=![];var _0x216e6e={};if(_0x3935fd[_0x8895('0x30')][_0x8895('0x2b')]&&_0x3935fd['query'][_0x8895('0x2b')]===_0x8895('0x4e')){_0x216e6e[_0x8895('0x4e')]=_0x3935fd[_0x8895('0x43')]['id'];}else{_0x216e6e['id']=_0x3935fd[_0x8895('0x43')]['id'];}return db['ScreenRecording'][_0x8895('0x4f')]({'where':_0x216e6e,'attributes':['id',_0x8895('0x50')],'raw':!![]})[_0x8895('0x24')](handleEntityNotFound(_0xd7ffeb,null))[_0x8895('0x24')](function(_0x37a7b4){if(_0x37a7b4){var _0x58dd6c=path[_0x8895('0x51')](config[_0x8895('0x52')],_0x8895('0x53'),_0x37a7b4['value']);var _0x20422f=util[_0x8895('0x2e')](_0x8895('0x54'),_0x58dd6c);if(fs['existsSync'](_0x20422f)){_0x434ab8=!![];return _0x1e264a[_0x8895('0x55')](_0x20422f,_0x58dd6c,config[_0x8895('0x56')]['recording'])[_0x8895('0x24')](function(){return _0x37a7b4;});}return _0x37a7b4;}})[_0x8895('0x24')](function(_0x5198f8){if(_0x5198f8){var _0x2f990a=path[_0x8895('0x51')](config[_0x8895('0x52')],_0x8895('0x53'),_0x5198f8['value']);if(!fs['existsSync'](_0x2f990a)){throw new db[(_0x8895('0x57'))][(_0x8895('0x58'))](_0x8895('0x59'));}if(_0x5198f8['filename']){return _0xd7ffeb[_0x8895('0x4c')](_0x2f990a,_0x5198f8[_0x8895('0x5a')]+path['extname'](_0x2f990a),function(){if(_0x434ab8){fs[_0x8895('0x5b')](_0x2f990a);}});}else{return _0xd7ffeb['download'](_0x2f990a,function(_0x435e36){if(_0x434ab8){fs[_0x8895('0x5b')](_0x2f990a);}});}}})[_0x8895('0x47')](function(_0x14f8a4){if(_0x14f8a4[_0x8895('0x5c')]==='ScreenRecording\x20not\x20found'){_0xd7ffeb['status'](0x194)[_0x8895('0x27')](_0x8895('0x5d'));}else{return handleError(_0xd7ffeb,null);}});};exports['destroy']=function(_0x46f8ae,_0x131476){return db[_0x8895('0x40')][_0x8895('0x4f')]({'where':{'id':_0x46f8ae['params']['id']}})[_0x8895('0x24')](function(_0x2d2bf9){if(_[_0x8895('0x5e')](_0x2d2bf9)){throw new ReferenceError(_0x8895('0x5f'));}return _0x2d2bf9;})[_0x8895('0x24')](function(_0x41a2fe){var _0x261d4b=path[_0x8895('0x51')](config[_0x8895('0x52')],_0x8895('0x53'),_0x41a2fe[_0x8895('0x50')]);logger[_0x8895('0x60')](_0x8895('0x61'),_0x261d4b);if(!_[_0x8895('0x5e')](_0x41a2fe[_0x8895('0x50')])&&fs['existsSync'](_0x261d4b)){logger['info']('File:\x20\x22'+_0x261d4b+_0x8895('0x62'));fs[_0x8895('0x63')](_0x261d4b);}_0x261d4b=_0x261d4b+_0x8895('0x64');if(!_[_0x8895('0x5e')](_0x41a2fe[_0x8895('0x50')])&&fs['existsSync'](_0x261d4b)){logger[_0x8895('0x60')](_0x8895('0x65')+_0x261d4b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x8895('0x63')](_0x261d4b);}return _0x41a2fe;})[_0x8895('0x24')](function(_0xf51f48){if(!_0xf51f48)throw new InternalError();return _0xf51f48[_0x8895('0x66')]();})[_0x8895('0x24')](function(){_0x131476['status'](0xcc)[_0x8895('0x1a')]();})[_0x8895('0x47')](handleError(_0x131476,null));}; \ No newline at end of file +var _0xe5b3=['info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','name','index','map','ScreenRecording','rawAttributes','type','key','model','differenceBy','format','keys','intersection','attributes','fields','query','length','nolimit','order','where','filters','filter','merge','options','include','findAll','rows','catch','show','create','body','duration','createdAt','closedAt','value','find','params','describe','download','uniqueid','join','%s.cypher','existsSync','root','server/files/screen_recordings','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','send','Not\x20found','destroy','Entity\x20not\x20found'];(function(_0x89c490,_0x3a9db0){var _0x342bba=function(_0x36c959){while(--_0x36c959){_0x89c490['push'](_0x89c490['shift']());}};_0x342bba(++_0x3a9db0);}(_0xe5b3,0x133));var _0x3e5b=function(_0x1d9bd4,_0xaa100c){_0x1d9bd4=_0x1d9bd4-0x0;var _0x15882f=_0xe5b3[_0x1d9bd4];return _0x15882f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];function respondWithStatusCode(_0x374068,_0x20b97b){_0x20b97b=_0x20b97b||0xcc;return function(_0x3c4eb1){if(_0x3c4eb1){return _0x374068[_0x3e5b('0x19')](_0x20b97b);}return _0x374068['status'](_0x20b97b)[_0x3e5b('0x1a')]();};}function respondWithResult(_0x5f2f9c,_0x51a188){_0x51a188=_0x51a188||0xc8;return function(_0x4d71a3){if(_0x4d71a3){return _0x5f2f9c[_0x3e5b('0x1b')](_0x51a188)[_0x3e5b('0x1c')](_0x4d71a3);}};}function respondWithFilteredResult(_0x17aaa3,_0x4fb471){return function(_0x1f81a7){if(_0x1f81a7){var _0x59ddc0=typeof _0x4fb471['offset']===_0x3e5b('0x1d')&&typeof _0x4fb471[_0x3e5b('0x1e')]==='undefined';var _0x3d58a4=_0x1f81a7[_0x3e5b('0x1f')];var _0x555002=_0x59ddc0?0x0:_0x4fb471[_0x3e5b('0x20')];var _0x3365dd=_0x59ddc0?_0x1f81a7['count']:_0x4fb471['offset']+_0x4fb471[_0x3e5b('0x1e')];var _0x20806a;if(_0x3365dd>=_0x3d58a4){_0x3365dd=_0x3d58a4;_0x20806a=0xc8;}else{_0x20806a=0xce;}_0x17aaa3[_0x3e5b('0x1b')](_0x20806a);return _0x17aaa3[_0x3e5b('0x21')](_0x3e5b('0x22'),_0x555002+'-'+_0x3365dd+'/'+_0x3d58a4)[_0x3e5b('0x1c')](_0x1f81a7);}return null;};}function patchUpdates(_0x447d36){return function(_0x21fc32){try{jsonpatch[_0x3e5b('0x23')](_0x21fc32,_0x447d36,!![]);}catch(_0x3d95f3){return BPromise[_0x3e5b('0x24')](_0x3d95f3);}return _0x21fc32[_0x3e5b('0x25')]();};}function saveUpdates(_0x2d77cc,_0x402873){return function(_0x5b46d4){if(_0x5b46d4){return _0x5b46d4[_0x3e5b('0x26')](_0x2d77cc)[_0x3e5b('0x27')](function(_0x2146d4){return _0x2146d4;});}return null;};}function removeEntity(_0x150674,_0x50039b){return function(_0x1eb80f){if(_0x1eb80f){return _0x1eb80f['destroy']()[_0x3e5b('0x27')](function(){_0x150674[_0x3e5b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41b684,_0x2f6368){return function(_0x42d7e9){if(!_0x42d7e9){_0x41b684[_0x3e5b('0x19')](0x194);}return _0x42d7e9;};}function handleError(_0x3bb749,_0x26c7f2){_0x26c7f2=_0x26c7f2||0x1f4;return function(_0x160e87){logger[_0x3e5b('0x28')](_0x160e87['stack']);if(_0x160e87[_0x3e5b('0x29')]){delete _0x160e87['name'];}_0x3bb749[_0x3e5b('0x1b')](_0x26c7f2)['send'](_0x160e87);};}exports[_0x3e5b('0x2a')]=function(_0x1f6473,_0x1296ec){var _0x475b39={},_0x10d2ed={},_0x3cfaf6={'count':0x0,'rows':[]};var _0x307091=_[_0x3e5b('0x2b')](db[_0x3e5b('0x2c')][_0x3e5b('0x2d')],function(_0x1e1565){return{'name':_0x1e1565['fieldName'],'type':_0x1e1565[_0x3e5b('0x2e')][_0x3e5b('0x2f')]};});_0x10d2ed[_0x3e5b('0x30')]=_[_0x3e5b('0x31')](_[_0x3e5b('0x2b')](_0x307091,_0x3e5b('0x29')),[_0x3e5b('0x32')]);_0x10d2ed['query']=_[_0x3e5b('0x33')](_0x1f6473['query']);_0x10d2ed['filters']=_[_0x3e5b('0x34')](_0x10d2ed[_0x3e5b('0x30')],_0x10d2ed['query']);_0x475b39[_0x3e5b('0x35')]=_[_0x3e5b('0x34')](_0x10d2ed[_0x3e5b('0x30')],qs[_0x3e5b('0x36')](_0x1f6473[_0x3e5b('0x37')][_0x3e5b('0x36')]));_0x475b39[_0x3e5b('0x35')]=_0x475b39[_0x3e5b('0x35')][_0x3e5b('0x38')]?_0x475b39[_0x3e5b('0x35')]:_0x10d2ed[_0x3e5b('0x30')];if(!_0x1f6473[_0x3e5b('0x37')]['hasOwnProperty'](_0x3e5b('0x39'))){_0x475b39[_0x3e5b('0x1e')]=qs['limit'](_0x1f6473['query'][_0x3e5b('0x1e')]);_0x475b39['offset']=qs[_0x3e5b('0x20')](_0x1f6473[_0x3e5b('0x37')][_0x3e5b('0x20')]);}_0x475b39[_0x3e5b('0x3a')]=qs['sort'](_0x1f6473[_0x3e5b('0x37')]['sort']);_0x475b39[_0x3e5b('0x3b')]=qs['filters'](_['pick'](_0x1f6473['query'],_0x10d2ed[_0x3e5b('0x3c')]),_0x307091);if(_0x1f6473[_0x3e5b('0x37')][_0x3e5b('0x3d')]){_0x475b39[_0x3e5b('0x3b')]=_[_0x3e5b('0x3e')](_0x475b39[_0x3e5b('0x3b')],{'$or':_['map'](_0x307091,function(_0x5d0c59){if(_0x5d0c59['type']!=='VIRTUAL'){var _0x5f0271={};_0x5f0271[_0x5d0c59['name']]={'$like':'%'+_0x1f6473['query'][_0x3e5b('0x3d')]+'%'};return _0x5f0271;}})});}_0x475b39=_[_0x3e5b('0x3e')]({},_0x475b39,_0x1f6473[_0x3e5b('0x3f')]);var _0x1aafd5={'where':_0x475b39[_0x3e5b('0x3b')]};return db[_0x3e5b('0x2c')][_0x3e5b('0x1f')](_0x1aafd5)[_0x3e5b('0x27')](function(_0x222d0f){_0x3cfaf6[_0x3e5b('0x1f')]=_0x222d0f;if(_0x1f6473[_0x3e5b('0x37')]['includeAll']){_0x475b39[_0x3e5b('0x40')]=[{'all':!![]}];}return db[_0x3e5b('0x2c')][_0x3e5b('0x41')](_0x475b39);})[_0x3e5b('0x27')](function(_0xa262e0){_0x3cfaf6[_0x3e5b('0x42')]=_0xa262e0;return _0x3cfaf6;})[_0x3e5b('0x27')](respondWithFilteredResult(_0x1296ec,_0x475b39))[_0x3e5b('0x43')](handleError(_0x1296ec,null));};exports[_0x3e5b('0x44')]=function(_0x39da3f,_0x13c8d5){var _0x559056={'raw':![],'where':{'id':_0x39da3f['params']['id']}},_0x598ab4={};_0x598ab4['model']=_[_0x3e5b('0x33')](db[_0x3e5b('0x2c')][_0x3e5b('0x2d')]);_0x598ab4[_0x3e5b('0x37')]=_[_0x3e5b('0x33')](_0x39da3f[_0x3e5b('0x37')]);_0x598ab4[_0x3e5b('0x3c')]=_[_0x3e5b('0x34')](_0x598ab4[_0x3e5b('0x30')],_0x598ab4[_0x3e5b('0x37')]);_0x559056['attributes']=_[_0x3e5b('0x34')](_0x598ab4[_0x3e5b('0x30')],qs[_0x3e5b('0x36')](_0x39da3f[_0x3e5b('0x37')][_0x3e5b('0x36')]));_0x559056['attributes']=_0x559056['attributes']['length']?_0x559056[_0x3e5b('0x35')]:_0x598ab4[_0x3e5b('0x30')];if(_0x39da3f[_0x3e5b('0x37')]['includeAll']){_0x559056['include']=[{'all':!![]}];}_0x559056=_[_0x3e5b('0x3e')]({},_0x559056,_0x39da3f[_0x3e5b('0x3f')]);return db[_0x3e5b('0x2c')]['find'](_0x559056)['then'](handleEntityNotFound(_0x13c8d5,null))[_0x3e5b('0x27')](respondWithResult(_0x13c8d5,null))['catch'](handleError(_0x13c8d5,null));};exports[_0x3e5b('0x45')]=function(_0x3379a1,_0x3f5835){return db[_0x3e5b('0x2c')][_0x3e5b('0x45')](_0x3379a1[_0x3e5b('0x46')],{})[_0x3e5b('0x27')](respondWithResult(_0x3f5835,0xc9))[_0x3e5b('0x43')](handleError(_0x3f5835,null));};exports[_0x3e5b('0x26')]=function(_0x4a2ae1,_0x223185){if(_0x4a2ae1['body']['id']){delete _0x4a2ae1[_0x3e5b('0x46')]['id'];}delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x47')];delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x48')];delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x49')];delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x4a')];return db[_0x3e5b('0x2c')][_0x3e5b('0x4b')]({'where':{'id':_0x4a2ae1[_0x3e5b('0x4c')]['id']}})[_0x3e5b('0x27')](handleEntityNotFound(_0x223185,null))['then'](saveUpdates(_0x4a2ae1[_0x3e5b('0x46')],null))[_0x3e5b('0x27')](respondWithResult(_0x223185,null))[_0x3e5b('0x43')](handleError(_0x223185,null));};exports[_0x3e5b('0x4d')]=function(_0x16c9f9,_0x2cecd3){return db['ScreenRecording'][_0x3e5b('0x4d')]()[_0x3e5b('0x27')](respondWithResult(_0x2cecd3,null))[_0x3e5b('0x43')](handleError(_0x2cecd3,null));};exports[_0x3e5b('0x4e')]=function(_0x3f8646,_0x449d0f,_0x216600){var _0x437430=require('../../components/encryptor');var _0x1e6403=![];var _0x5e702f={};if(_0x3f8646['query'][_0x3e5b('0x2e')]&&_0x3f8646['query'][_0x3e5b('0x2e')]===_0x3e5b('0x4f')){_0x5e702f[_0x3e5b('0x4f')]=_0x3f8646[_0x3e5b('0x4c')]['id'];}else{_0x5e702f['id']=_0x3f8646['params']['id'];}return db['ScreenRecording']['find']({'where':_0x5e702f,'attributes':['id','value'],'raw':!![]})[_0x3e5b('0x27')](handleEntityNotFound(_0x449d0f,null))[_0x3e5b('0x27')](function(_0x1ea02a){if(_0x1ea02a){var _0x4149c8=path[_0x3e5b('0x50')](config['root'],'server/files/screen_recordings',_0x1ea02a[_0x3e5b('0x4a')]);var _0x1b0b32=util[_0x3e5b('0x32')](_0x3e5b('0x51'),_0x4149c8);if(fs[_0x3e5b('0x52')](_0x1b0b32)){_0x1e6403=!![];return _0x437430['decryptFile'](_0x1b0b32,_0x4149c8,config['secrets']['recording'])['then'](function(){return _0x1ea02a;});}return _0x1ea02a;}})[_0x3e5b('0x27')](function(_0x3e3115){if(_0x3e3115){var _0x3088d4=path[_0x3e5b('0x50')](config[_0x3e5b('0x53')],_0x3e5b('0x54'),_0x3e3115[_0x3e5b('0x4a')]);if(!fs[_0x3e5b('0x52')](_0x3088d4)){throw new db['Sequelize'][(_0x3e5b('0x55'))](_0x3e5b('0x56'));}if(_0x3e3115[_0x3e5b('0x57')]){return _0x449d0f[_0x3e5b('0x4e')](_0x3088d4,_0x3e3115[_0x3e5b('0x57')]+path['extname'](_0x3088d4),function(){if(_0x1e6403){fs[_0x3e5b('0x58')](_0x3088d4);}});}else{return _0x449d0f['download'](_0x3088d4,function(_0x45ca16){if(_0x1e6403){fs[_0x3e5b('0x58')](_0x3088d4);}});}}})['catch'](function(_0x4a7d8e){if(_0x4a7d8e['message']===_0x3e5b('0x56')){_0x449d0f['status'](0x194)[_0x3e5b('0x59')](_0x3e5b('0x5a'));}else{return handleError(_0x449d0f,null);}});};exports[_0x3e5b('0x5b')]=function(_0x40197c,_0x14f187){return db['ScreenRecording']['find']({'where':{'id':_0x40197c[_0x3e5b('0x4c')]['id']}})[_0x3e5b('0x27')](function(_0x3f7f71){if(_['isNil'](_0x3f7f71)){throw new ReferenceError(_0x3e5b('0x5c'));}return _0x3f7f71;})[_0x3e5b('0x27')](function(_0x32a42f){var _0x1c9526=path[_0x3e5b('0x50')](config[_0x3e5b('0x53')],_0x3e5b('0x54'),_0x32a42f[_0x3e5b('0x4a')]);logger[_0x3e5b('0x5d')](_0x3e5b('0x5e'),_0x1c9526);if(!_[_0x3e5b('0x5f')](_0x32a42f[_0x3e5b('0x4a')])&&fs[_0x3e5b('0x52')](_0x1c9526)){logger[_0x3e5b('0x5d')](_0x3e5b('0x60')+_0x1c9526+_0x3e5b('0x61'));fs[_0x3e5b('0x62')](_0x1c9526);}_0x1c9526=_0x1c9526+_0x3e5b('0x63');if(!_['isNil'](_0x32a42f[_0x3e5b('0x4a')])&&fs[_0x3e5b('0x52')](_0x1c9526)){logger['info'](_0x3e5b('0x60')+_0x1c9526+_0x3e5b('0x61'));fs['unlinkSync'](_0x1c9526);}return _0x32a42f;})['then'](function(_0x4f67d1){if(!_0x4f67d1)throw new InternalError();return _0x4f67d1[_0x3e5b('0x5b')]();})[_0x3e5b('0x27')](function(){_0x14f187['status'](0xcc)[_0x3e5b('0x1a')]();})[_0x3e5b('0x43')](handleError(_0x14f187,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 3f5be2f..07f3499 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 _0xdecd=['define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./screenRecording.attributes','exports'];(function(_0x57f602,_0xb02a01){var _0x2f604d=function(_0xbb41e0){while(--_0xbb41e0){_0x57f602['push'](_0x57f602['shift']());}};_0x2f604d(++_0xb02a01);}(_0xdecd,0xa9));var _0xddec=function(_0x2ba2cb,_0x4f4fb8){_0x2ba2cb=_0x2ba2cb-0x0;var _0x2669ac=_0xdecd[_0x2ba2cb];return _0x2669ac;};'use strict';var _=require(_0xddec('0x0'));var util=require(_0xddec('0x1'));var logger=require(_0xddec('0x2'))(_0xddec('0x3'));var moment=require(_0xddec('0x4'));var BPromise=require(_0xddec('0x5'));var rp=require(_0xddec('0x6'));var fs=require('fs');var path=require(_0xddec('0x7'));var rimraf=require('rimraf');var config=require(_0xddec('0x8'));var attributes=require(_0xddec('0x9'));module[_0xddec('0xa')]=function(_0x15fcc8,_0x1efc97){return _0x15fcc8[_0xddec('0xb')](_0xddec('0xc'),attributes,{'tableName':_0xddec('0xd'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xddec('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe7d2=['ScreenRecording','interactionid','lodash','util','api','moment','rimraf'];(function(_0x44235a,_0x13d084){var _0x3000b4=function(_0x2c709b){while(--_0x2c709b){_0x44235a['push'](_0x44235a['shift']());}};_0x3000b4(++_0x13d084);}(_0xe7d2,0x14b));var _0x2e7d=function(_0x2b0960,_0x525d1c){_0x2b0960=_0x2b0960-0x0;var _0x140c06=_0xe7d2[_0x2b0960];return _0x140c06;};'use strict';var _=require(_0x2e7d('0x0'));var util=require(_0x2e7d('0x1'));var logger=require('../../config/logger')(_0x2e7d('0x2'));var moment=require(_0x2e7d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2e7d('0x4'));var config=require('../../config/environment');var attributes=require('./screenRecording.attributes');module['exports']=function(_0x3844c6,_0x241150){return _0x3844c6['define'](_0x2e7d('0x5'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x2e7d('0x6')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 48c585c..75119c0 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 _0xafcd=['info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x5e6cb8,_0x16cf56){var _0x3faeb3=function(_0x1a7355){while(--_0x1a7355){_0x5e6cb8['push'](_0x5e6cb8['shift']());}};_0x3faeb3(++_0x16cf56);}(_0xafcd,0x1ad));var _0xdafc=function(_0x1ac562,_0x270a2d){_0x1ac562=_0x1ac562-0x0;var _0x483610=_0xafcd[_0x1ac562];return _0x483610;};'use strict';var _=require(_0xdafc('0x0'));var util=require(_0xdafc('0x1'));var moment=require(_0xdafc('0x2'));var BPromise=require(_0xdafc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdafc('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdafc('0x5'));var config=require(_0xdafc('0x6'));var jayson=require(_0xdafc('0x7'));var client=jayson[_0xdafc('0x8')][_0xdafc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e0294,_0x1115ae,_0x1f0e10){return new BPromise(function(_0x574efa,_0x185975){return client[_0xdafc('0xa')](_0x3e0294,_0x1f0e10)['then'](function(_0x14cb0f){logger[_0xdafc('0xb')](_0xdafc('0xc'),_0x1115ae,_0xdafc('0xd'));logger[_0xdafc('0xe')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x1115ae,'request\x20sent',JSON[_0xdafc('0xf')](_0x14cb0f));if(_0x14cb0f[_0xdafc('0x10')]){if(_0x14cb0f[_0xdafc('0x10')][_0xdafc('0x11')]===0x1f4){logger[_0xdafc('0x10')](_0xdafc('0xc'),_0x1115ae,_0x14cb0f['error'][_0xdafc('0x12')]);return _0x185975(_0x14cb0f[_0xdafc('0x10')]['message']);}logger[_0xdafc('0x10')](_0xdafc('0xc'),_0x1115ae,_0x14cb0f['error'][_0xdafc('0x12')]);return _0x574efa(_0x14cb0f[_0xdafc('0x10')]['message']);}else{logger[_0xdafc('0xb')](_0xdafc('0xc'),_0x1115ae,_0xdafc('0xd'));_0x574efa(_0x14cb0f[_0xdafc('0x13')][_0xdafc('0x12')]);}})['catch'](function(_0x17e709){logger[_0xdafc('0x10')](_0xdafc('0xc'),_0x1115ae,_0x17e709);_0x185975(_0x17e709);});});} \ No newline at end of file +var _0xcb51=['debug','request\x20sent','stringify','error','message','info','result','catch','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','ScreenRecording,\x20%s,\x20%s'];(function(_0x4f4c97,_0x38356b){var _0x72bbfc=function(_0x4a2095){while(--_0x4a2095){_0x4f4c97['push'](_0x4f4c97['shift']());}};_0x72bbfc(++_0x38356b);}(_0xcb51,0x184));var _0x1cb5=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0xcb51[_0x369151];return _0x4292d5;};'use strict';var _=require('lodash');var util=require(_0x1cb5('0x0'));var moment=require(_0x1cb5('0x1'));var BPromise=require('bluebird');var rs=require(_0x1cb5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1cb5('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1cb5('0x4'))(_0x1cb5('0x5'));var config=require('../../config/environment');var jayson=require(_0x1cb5('0x6'));var client=jayson[_0x1cb5('0x7')][_0x1cb5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x48edb0,_0x9cd3bd,_0x27f363){return new BPromise(function(_0x1a69e0,_0x41fd14){return client[_0x1cb5('0x9')](_0x48edb0,_0x27f363)[_0x1cb5('0xa')](function(_0x4686a0){logger['info'](_0x1cb5('0xb'),_0x9cd3bd,'request\x20sent');logger[_0x1cb5('0xc')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x9cd3bd,_0x1cb5('0xd'),JSON[_0x1cb5('0xe')](_0x4686a0));if(_0x4686a0[_0x1cb5('0xf')]){if(_0x4686a0[_0x1cb5('0xf')]['code']===0x1f4){logger['error'](_0x1cb5('0xb'),_0x9cd3bd,_0x4686a0[_0x1cb5('0xf')][_0x1cb5('0x10')]);return _0x41fd14(_0x4686a0['error']['message']);}logger[_0x1cb5('0xf')]('ScreenRecording,\x20%s,\x20%s',_0x9cd3bd,_0x4686a0[_0x1cb5('0xf')][_0x1cb5('0x10')]);return _0x1a69e0(_0x4686a0['error'][_0x1cb5('0x10')]);}else{logger[_0x1cb5('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x9cd3bd,'request\x20sent');_0x1a69e0(_0x4686a0[_0x1cb5('0x12')][_0x1cb5('0x10')]);}})[_0x1cb5('0x13')](function(_0x281e8d){logger[_0x1cb5('0xf')](_0x1cb5('0xb'),_0x9cd3bd,_0x281e8d);_0x41fd14(_0x281e8d);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index cb0c9c5..7e4f59a 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 _0xbd3a=['/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','%s%s','logo','originalname','post','single','file','addLogo','format','logologin','addLogoLogin','preferred','extname','favicon','addFavicon','isAuthenticated','update','multer','path','Router','fs-extra','../../config/environment','./setting.controller','get','/now','getDate','/:id','/:id/logo_login','/:id/gdpr','gdpr'];(function(_0x1af68c,_0x49a8e7){var _0x3a319d=function(_0x1169d4){while(--_0x1169d4){_0x1af68c['push'](_0x1af68c['shift']());}};_0x3a319d(++_0x49a8e7);}(_0xbd3a,0x11b));var _0xabd3=function(_0x27f0c8,_0x54dcdb){_0x27f0c8=_0x27f0c8-0x0;var _0x47386b=_0xbd3a[_0x27f0c8];return _0x47386b;};'use strict';var multer=require(_0xabd3('0x0'));var util=require('util');var path=require(_0xabd3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xabd3('0x2')]();var fs_extra=require(_0xabd3('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xabd3('0x4'));var controller=require(_0xabd3('0x5'));router[_0xabd3('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xabd3('0x6')](_0xabd3('0x7'),controller[_0xabd3('0x8')]);router[_0xabd3('0x6')](_0xabd3('0x9'),controller['show']);router[_0xabd3('0x6')]('/:id/logo',controller['getLogo']);router['get'](_0xabd3('0xa'),controller['getLogoLogin']);router[_0xabd3('0x6')](_0xabd3('0xb'),controller[_0xabd3('0xc')]);router[_0xabd3('0x6')](_0xabd3('0xd'),controller[_0xabd3('0xe')]);router[_0xabd3('0x6')](_0xabd3('0xf'),controller[_0xabd3('0x10')]);var upload=multer({'storage':multer[_0xabd3('0x11')]({'destination':function(_0x215bb6,_0x1bb583,_0x48b115){_0x48b115(null,path[_0xabd3('0x12')](config[_0xabd3('0x13')],_0xabd3('0x14')));},'filename':function(_0x4ff016,_0x226b81,_0x284e14){_0x284e14(null,util['format'](_0xabd3('0x15'),_0xabd3('0x16'),path['extname'](_0x226b81[_0xabd3('0x17')])));}})});router[_0xabd3('0x18')]('/:id/logo',upload[_0xabd3('0x19')](_0xabd3('0x1a')),controller[_0xabd3('0x1b')]);var upload=multer({'storage':multer[_0xabd3('0x11')]({'destination':function(_0x549c57,_0x16b5be,_0x51bb97){_0x51bb97(null,path[_0xabd3('0x12')](config[_0xabd3('0x13')],'server/files/images/logos/'));},'filename':function(_0x1f3528,_0x5a057b,_0x43e483){_0x43e483(null,util[_0xabd3('0x1c')](_0xabd3('0x15'),_0xabd3('0x1d'),path['extname'](_0x5a057b[_0xabd3('0x17')])));}})});router[_0xabd3('0x18')](_0xabd3('0xa'),upload[_0xabd3('0x19')](_0xabd3('0x1a')),controller[_0xabd3('0x1e')]);var upload=multer({'storage':multer[_0xabd3('0x11')]({'destination':function(_0x2e7f12,_0x1d3b93,_0x55e073){_0x55e073(null,path[_0xabd3('0x12')](config[_0xabd3('0x13')],'server/files/images/logos/'));},'filename':function(_0x42d320,_0x5d1c28,_0x24a654){_0x24a654(null,util[_0xabd3('0x1c')]('%s%s',_0xabd3('0x1f'),path[_0xabd3('0x20')](_0x5d1c28['originalname'])));}})});router['post'](_0xabd3('0xd'),upload[_0xabd3('0x19')](_0xabd3('0x1a')),controller['addPreferred']);var upload=multer({'storage':multer[_0xabd3('0x11')]({'destination':function(_0x4086ff,_0x349d42,_0x5b0886){_0x5b0886(null,path[_0xabd3('0x12')](config['root'],_0xabd3('0x14')));},'filename':function(_0xab20dd,_0x331b27,_0x58f944){_0x58f944(null,util[_0xabd3('0x1c')](_0xabd3('0x15'),_0xabd3('0x21'),path[_0xabd3('0x20')](_0x331b27[_0xabd3('0x17')])));}})});router[_0xabd3('0x18')](_0xabd3('0xf'),upload[_0xabd3('0x19')](_0xabd3('0x1a')),controller[_0xabd3('0x22')]);router['put'](_0xabd3('0x9'),auth[_0xabd3('0x23')](),controller[_0xabd3('0x24')]);module['exports']=router; \ No newline at end of file +var _0xf90b=['/:id/gdpr','/:id/preferred','/:id/favicon','getFavicon','server/files/images/logos/','format','%s%s','extname','originalname','post','diskStorage','join','root','logologin','file','addLogoLogin','preferred','favicon','single','addFavicon','put','isAuthenticated','update','exports','multer','util','path','express','../../components/auth/service','../../config/environment','./setting.controller','index','/now','getDate','show','/:id/logo','get','/:id/logo_login'];(function(_0xdc820e,_0x25ee7e){var _0x5d701d=function(_0x1977a3){while(--_0x1977a3){_0xdc820e['push'](_0xdc820e['shift']());}};_0x5d701d(++_0x25ee7e);}(_0xf90b,0x1e0));var _0xbf90=function(_0x396b0,_0x2f09a6){_0x396b0=_0x396b0-0x0;var _0xacb106=_0xf90b[_0x396b0];return _0xacb106;};'use strict';var multer=require(_0xbf90('0x0'));var util=require(_0xbf90('0x1'));var path=require(_0xbf90('0x2'));var timeout=require('connect-timeout');var express=require(_0xbf90('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbf90('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xbf90('0x5'));var controller=require(_0xbf90('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xbf90('0x7')]);router['get'](_0xbf90('0x8'),controller[_0xbf90('0x9')]);router['get']('/:id',controller[_0xbf90('0xa')]);router['get'](_0xbf90('0xb'),controller['getLogo']);router[_0xbf90('0xc')](_0xbf90('0xd'),controller['getLogoLogin']);router[_0xbf90('0xc')](_0xbf90('0xe'),controller['gdpr']);router[_0xbf90('0xc')](_0xbf90('0xf'),controller['getPreferred']);router[_0xbf90('0xc')](_0xbf90('0x10'),controller[_0xbf90('0x11')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1df109,_0x325220,_0x4624e9){_0x4624e9(null,path['join'](config['root'],_0xbf90('0x12')));},'filename':function(_0x5e717b,_0x7ac65b,_0x24bfa3){_0x24bfa3(null,util[_0xbf90('0x13')](_0xbf90('0x14'),'logo',path[_0xbf90('0x15')](_0x7ac65b[_0xbf90('0x16')])));}})});router[_0xbf90('0x17')](_0xbf90('0xb'),upload['single']('file'),controller['addLogo']);var upload=multer({'storage':multer[_0xbf90('0x18')]({'destination':function(_0xc90a12,_0xe5a550,_0x12a86f){_0x12a86f(null,path[_0xbf90('0x19')](config[_0xbf90('0x1a')],'server/files/images/logos/'));},'filename':function(_0x58707c,_0x128a73,_0xded65b){_0xded65b(null,util['format']('%s%s',_0xbf90('0x1b'),path[_0xbf90('0x15')](_0x128a73[_0xbf90('0x16')])));}})});router[_0xbf90('0x17')](_0xbf90('0xd'),upload['single'](_0xbf90('0x1c')),controller[_0xbf90('0x1d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a4272,_0x4b9452,_0x27d870){_0x27d870(null,path[_0xbf90('0x19')](config[_0xbf90('0x1a')],_0xbf90('0x12')));},'filename':function(_0x2a9dee,_0x472d90,_0x443d15){_0x443d15(null,util['format']('%s%s',_0xbf90('0x1e'),path[_0xbf90('0x15')](_0x472d90[_0xbf90('0x16')])));}})});router[_0xbf90('0x17')]('/:id/preferred',upload['single'](_0xbf90('0x1c')),controller['addPreferred']);var upload=multer({'storage':multer[_0xbf90('0x18')]({'destination':function(_0x8af21a,_0x2a49a9,_0x24193d){_0x24193d(null,path[_0xbf90('0x19')](config[_0xbf90('0x1a')],'server/files/images/logos/'));},'filename':function(_0x5a13d8,_0x24d6b4,_0xcba651){_0xcba651(null,util[_0xbf90('0x13')]('%s%s',_0xbf90('0x1f'),path['extname'](_0x24d6b4[_0xbf90('0x16')])));}})});router[_0xbf90('0x17')]('/:id/favicon',upload[_0xbf90('0x20')](_0xbf90('0x1c')),controller[_0xbf90('0x21')]);router[_0xbf90('0x22')]('/:id',auth[_0xbf90('0x23')](),controller[_0xbf90('0x24')]);module[_0xbf90('0x25')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index ba0512a..cef8304 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 _0xc15c=['min_internal','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','INTEGER'];(function(_0x1b3d5a,_0x77805a){var _0x47511c=function(_0x5c86a5){while(--_0x5c86a5){_0x1b3d5a['push'](_0x1b3d5a['shift']());}};_0x47511c(++_0x77805a);}(_0xc15c,0xae));var _0xcc15=function(_0x379e3c,_0x3d16a5){_0x379e3c=_0x379e3c-0x0;var _0x2931a2=_0xc15c[_0x379e3c];return _0x2931a2;};'use strict';var Sequelize=require('sequelize');module['exports']={'min_internal':{'type':Sequelize[_0xcc15('0x0')](0xb),'unique':_0xcc15('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xcc15('0x0')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xcc15('0x0')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0xcc15('0x2')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0xcc15('0x3')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xcc15('0x2')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xcc15('0x3')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xcc15('0x2')]},'turnaddr':{'type':Sequelize[_0xcc15('0x2')]},'turnusername':{'type':Sequelize[_0xcc15('0x2')]},'turnpassword':{'type':Sequelize[_0xcc15('0x2')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0xcc15('0x3')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xcc15('0x3')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xcc15('0x0')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xcc15('0x3')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0xcc15('0x4')},'enableEmailPreview':{'type':Sequelize[_0xcc15('0x3')],'defaultValue':![]},'split':{'type':Sequelize[_0xcc15('0x3')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xcc15('0x0')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xcc15('0x5')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xcc15('0x3')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0xcc15('0x3')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xcc15('0x2')]},'allowedLoginAttempts':{'type':Sequelize[_0xcc15('0x0')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xcc15('0x0')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xcc15('0x2')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xcc15('0x0')]},'transcribeRegion':{'type':Sequelize[_0xcc15('0x2')]},'sentiment':{'type':Sequelize[_0xcc15('0x3')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0xcc15('0x2')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0xcc15('0x2')]},'googleSsoEnabled':{'type':Sequelize[_0xcc15('0x3')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xcc15('0x3')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0xcc15('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xcc15('0x0')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xcc15('0x0')](0x2)[_0xcc15('0x6')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xcc15('0x0')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xcc15('0x3')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xcc15('0x0')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xcc15('0x0')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xcc15('0x0')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xcc15('0x3')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xcc15('0x3')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xcc15('0x0')],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0xcc15('0x3')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xcc15('0x0')],'defaultValue':0x14}}; \ No newline at end of file +var _0xcf7e=['INTEGER','min_internal','STRING','BOOLEAN','UNSIGNED'];(function(_0x233c4e,_0x367986){var _0xb74775=function(_0x5cc8b3){while(--_0x5cc8b3){_0x233c4e['push'](_0x233c4e['shift']());}};_0xb74775(++_0x367986);}(_0xcf7e,0xaf));var _0xecf7=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xcf7e[_0x55e08b];return _0xd1a7ff;};'use strict';var Sequelize=require('sequelize');module['exports']={'min_internal':{'type':Sequelize[_0xecf7('0x0')](0xb),'unique':_0xecf7('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xecf7('0x0')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xecf7('0x0')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xecf7('0x2')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0xecf7('0x2')]},'defaultLogo':{'type':Sequelize[_0xecf7('0x3')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0xecf7('0x3')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xecf7('0x3')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xecf7('0x3')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0xecf7('0x2')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0xecf7('0x2')]},'pageTitle':{'type':Sequelize[_0xecf7('0x2')]},'defaultPageTitle':{'type':Sequelize[_0xecf7('0x3')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xecf7('0x3')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xecf7('0x0')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xecf7('0x3')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xecf7('0x2')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xecf7('0x3')],'defaultValue':![]},'split':{'type':Sequelize[_0xecf7('0x3')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xecf7('0x0')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xecf7('0x0')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xecf7('0x0')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xecf7('0x2')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xecf7('0x3')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xecf7('0x2')]},'defaultPreferred':{'type':Sequelize[_0xecf7('0x3')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xecf7('0x2')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xecf7('0x0')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xecf7('0x2')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xecf7('0x0')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xecf7('0x0')]},'transcribeRegion':{'type':Sequelize[_0xecf7('0x2')]},'sentiment':{'type':Sequelize[_0xecf7('0x3')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xecf7('0x3')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xecf7('0x0')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xecf7('0x2')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0xecf7('0x3')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xecf7('0x3')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xecf7('0x3')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xecf7('0x0')](0x2)[_0xecf7('0x4')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xecf7('0x0')](0x2)[_0xecf7('0x4')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xecf7('0x0')](0x2)[_0xecf7('0x4')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xecf7('0x0')](0x2)[_0xecf7('0x4')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xecf7('0x3')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xecf7('0x0')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xecf7('0x0')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xecf7('0x3')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xecf7('0x3')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0xecf7('0x3')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xecf7('0x0')],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0xecf7('0x3')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xecf7('0x0')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 94516ab..db4b57b 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 _0xc078=['\x20not\x20found','default_loginLogo.svg','custom','ValidationError','download','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','now','utcOffset','format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','status','index','Setting','rawAttributes','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','show','params','options','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default','upperFirst','default_logo.svg','Sequelize'];(function(_0x4b15a4,_0x4241fe){var _0x40a783=function(_0x1f3de1){while(--_0x1f3de1){_0x4b15a4['push'](_0x4b15a4['shift']());}};_0x40a783(++_0x4241fe);}(_0xc078,0xfd));var _0x8c07=function(_0x10bfb3,_0x492f8a){_0x10bfb3=_0x10bfb3-0x0;var _0x1a6ef6=_0xc078[_0x10bfb3];return _0x1a6ef6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8c07('0x0'));var zipdir=require(_0x8c07('0x1'));var jsonpatch=require(_0x8c07('0x2'));var rp=require(_0x8c07('0x3'));var moment=require(_0x8c07('0x4'));var BPromise=require(_0x8c07('0x5'));var Mustache=require('mustache');var util=require(_0x8c07('0x6'));var path=require(_0x8c07('0x7'));var sox=require(_0x8c07('0x8'));var csv=require(_0x8c07('0x9'));var ejs=require(_0x8c07('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8c07('0xb'));var crypto=require(_0x8c07('0xc'));var jsforce=require(_0x8c07('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8c07('0x9'));var querystring=require(_0x8c07('0xe'));var Papa=require(_0x8c07('0xf'));var Redis=require(_0x8c07('0x10'));var authService=require(_0x8c07('0x11'));var qs=require(_0x8c07('0x12'));var as=require(_0x8c07('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c07('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x8c07('0x15'));var licenseUtil=require(_0x8c07('0x16'));var db=require(_0x8c07('0x17'))['db'];var jayson=require(_0x8c07('0x18'));var client=jayson[_0x8c07('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a3e5d,_0x166e0e,_0x5801c9,_0x303bee){return new BPromise(function(_0x4982da,_0x536ca5){var _0xf47a62=_0x303bee||client;return _0xf47a62[_0x8c07('0x1a')](_0x5a3e5d,_0x5801c9)['then'](function(_0x35dcf3){logger[_0x8c07('0x1b')](_0x8c07('0x1c'),_0x166e0e,_0x8c07('0x1d'));logger[_0x8c07('0x1e')](_0x8c07('0x1f'),_0x166e0e,_0x8c07('0x1d'),JSON[_0x8c07('0x20')](_0x35dcf3));if(_0x35dcf3['error']){if(_0x35dcf3[_0x8c07('0x21')][_0x8c07('0x22')]===0x1f4){logger[_0x8c07('0x21')](_0x8c07('0x1c'),_0x166e0e,_0x35dcf3[_0x8c07('0x21')]['message']);return _0x536ca5(_0x35dcf3[_0x8c07('0x21')]['message']);}logger['error']('Setting,\x20%s,\x20%s',_0x166e0e,_0x35dcf3['error']['message']);return _0x4982da(_0x35dcf3[_0x8c07('0x21')][_0x8c07('0x23')]);}else{logger['info'](_0x8c07('0x1c'),_0x166e0e,_0x8c07('0x1d'));_0x4982da(_0x35dcf3[_0x8c07('0x24')][_0x8c07('0x23')]);}})[_0x8c07('0x25')](function(_0x33a7de){logger[_0x8c07('0x21')](_0x8c07('0x1c'),_0x166e0e,_0x33a7de);_0x536ca5(_0x33a7de);});});}function respondWithStatusCode(_0x3d276d,_0x52cc30){_0x52cc30=_0x52cc30||0xcc;return function(_0x1bc715){if(_0x1bc715){return _0x3d276d['sendStatus'](_0x52cc30);}return _0x3d276d['status'](_0x52cc30)[_0x8c07('0x26')]();};}function respondWithResult(_0x2bfcd7,_0x447d03){_0x447d03=_0x447d03||0xc8;return function(_0x5ab095){if(_0x5ab095){return _0x2bfcd7['status'](_0x447d03)['json'](_0x5ab095);}};}function respondWithFilteredResult(_0xa8b7dc,_0x2e748d){return function(_0x318897){if(_0x318897){var _0x3f671f=typeof _0x2e748d[_0x8c07('0x27')]==='undefined'&&typeof _0x2e748d[_0x8c07('0x28')]==='undefined';var _0x3643f8=_0x318897['count'];var _0xe01b51=_0x3f671f?0x0:_0x2e748d[_0x8c07('0x27')];var _0x1f6942=_0x3f671f?_0x318897[_0x8c07('0x29')]:_0x2e748d[_0x8c07('0x27')]+_0x2e748d[_0x8c07('0x28')];var _0x27cb69;if(_0x1f6942>=_0x3643f8){_0x1f6942=_0x3643f8;_0x27cb69=0xc8;}else{_0x27cb69=0xce;}_0xa8b7dc['status'](_0x27cb69);return _0xa8b7dc[_0x8c07('0x2a')](_0x8c07('0x2b'),_0xe01b51+'-'+_0x1f6942+'/'+_0x3643f8)['json'](_0x318897);}return null;};}function patchUpdates(_0x3061ef){return function(_0xb9a3ab){try{jsonpatch[_0x8c07('0x2c')](_0xb9a3ab,_0x3061ef,!![]);}catch(_0x4b0d7e){return BPromise[_0x8c07('0x2d')](_0x4b0d7e);}return _0xb9a3ab['save']();};}function saveUpdates(_0x388daa,_0x506fba){return function(_0x1a2d34){if(_0x1a2d34){return _0x1a2d34[_0x8c07('0x2e')](_0x388daa)[_0x8c07('0x2f')](function(_0x33f891){return _0x33f891;});}return null;};}function removeEntity(_0x37a9b3,_0xdfe5ba){return function(_0x4abf81){if(_0x4abf81){return _0x4abf81[_0x8c07('0x30')]()[_0x8c07('0x2f')](function(){_0x37a9b3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x250e9f,_0x11c4dd){return function(_0x35430f){if(!_0x35430f){_0x250e9f['sendStatus'](0x194);}return _0x35430f;};}function handleError(_0x3b58d,_0x3c914c){_0x3c914c=_0x3c914c||0x1f4;return function(_0xce7902){logger[_0x8c07('0x21')](_0xce7902[_0x8c07('0x31')]);if(_0xce7902['name']){delete _0xce7902[_0x8c07('0x32')];}_0x3b58d[_0x8c07('0x33')](_0x3c914c)['send'](_0xce7902);};}exports[_0x8c07('0x34')]=function(_0x26abf5,_0x41bc15){var _0x345c63={},_0x137d3c={},_0x1ca655={'count':0x0,'rows':[]};var _0x406a18=_['map'](db[_0x8c07('0x35')][_0x8c07('0x36')],function(_0x41476f){return{'name':_0x41476f['fieldName'],'type':_0x41476f['type'][_0x8c07('0x37')]};});_0x137d3c[_0x8c07('0x38')]=_[_0x8c07('0x39')](_0x406a18,_0x8c07('0x32'));_0x137d3c[_0x8c07('0x3a')]=_[_0x8c07('0x3b')](_0x26abf5[_0x8c07('0x3a')]);_0x137d3c[_0x8c07('0x3c')]=_['intersection'](_0x137d3c[_0x8c07('0x38')],_0x137d3c[_0x8c07('0x3a')]);_0x345c63[_0x8c07('0x3d')]=_[_0x8c07('0x3e')](_0x137d3c[_0x8c07('0x38')],qs[_0x8c07('0x3f')](_0x26abf5[_0x8c07('0x3a')][_0x8c07('0x3f')]));_0x345c63[_0x8c07('0x3d')]=_0x345c63[_0x8c07('0x3d')][_0x8c07('0x40')]?_0x345c63[_0x8c07('0x3d')]:_0x137d3c[_0x8c07('0x38')];if(!_0x26abf5[_0x8c07('0x3a')]['hasOwnProperty'](_0x8c07('0x41'))){_0x345c63[_0x8c07('0x28')]=qs[_0x8c07('0x28')](_0x26abf5[_0x8c07('0x3a')][_0x8c07('0x28')]);_0x345c63['offset']=qs[_0x8c07('0x27')](_0x26abf5[_0x8c07('0x3a')][_0x8c07('0x27')]);}_0x345c63[_0x8c07('0x42')]=qs[_0x8c07('0x43')](_0x26abf5[_0x8c07('0x3a')][_0x8c07('0x43')]);_0x345c63[_0x8c07('0x44')]=qs['filters'](_['pick'](_0x26abf5['query'],_0x137d3c['filters']),_0x406a18);if(_0x26abf5['query'][_0x8c07('0x45')]){_0x345c63[_0x8c07('0x44')]=_[_0x8c07('0x46')](_0x345c63[_0x8c07('0x44')],{'$or':_[_0x8c07('0x39')](_0x406a18,function(_0x48646e){if(_0x48646e['type']!==_0x8c07('0x47')){var _0x96cb3f={};_0x96cb3f[_0x48646e[_0x8c07('0x32')]]={'$like':'%'+_0x26abf5[_0x8c07('0x3a')]['filter']+'%'};return _0x96cb3f;}})});}_0x345c63=_[_0x8c07('0x46')]({},_0x345c63,_0x26abf5['options']);var _0x49ec39={'where':_0x345c63[_0x8c07('0x44')]};return db[_0x8c07('0x35')]['count'](_0x49ec39)[_0x8c07('0x2f')](function(_0x99aadf){_0x1ca655[_0x8c07('0x29')]=_0x99aadf;if(_0x26abf5[_0x8c07('0x3a')][_0x8c07('0x48')]){_0x345c63['include']=[{'all':!![]}];}return db[_0x8c07('0x35')][_0x8c07('0x49')](_0x345c63);})[_0x8c07('0x2f')](function(_0x417538){_0x1ca655['rows']=_0x417538;return _0x1ca655;})['then'](respondWithFilteredResult(_0x41bc15,_0x345c63))[_0x8c07('0x25')](handleError(_0x41bc15,null));};exports[_0x8c07('0x4a')]=function(_0x814b0,_0x3e1cf1){var _0x5c2c8f={'raw':![],'where':{'id':_0x814b0[_0x8c07('0x4b')]['id']}},_0x5a2911={};_0x5a2911['model']=_[_0x8c07('0x3b')](db[_0x8c07('0x35')]['rawAttributes']);_0x5a2911[_0x8c07('0x3a')]=_[_0x8c07('0x3b')](_0x814b0['query']);_0x5a2911['filters']=_['intersection'](_0x5a2911['model'],_0x5a2911[_0x8c07('0x3a')]);_0x5c2c8f[_0x8c07('0x3d')]=_['intersection'](_0x5a2911[_0x8c07('0x38')],qs['fields'](_0x814b0[_0x8c07('0x3a')][_0x8c07('0x3f')]));_0x5c2c8f[_0x8c07('0x3d')]=_0x5c2c8f[_0x8c07('0x3d')][_0x8c07('0x40')]?_0x5c2c8f[_0x8c07('0x3d')]:_0x5a2911[_0x8c07('0x38')];if(_0x814b0[_0x8c07('0x3a')][_0x8c07('0x48')]){_0x5c2c8f['include']=[{'all':!![]}];}_0x5c2c8f=_['merge']({},_0x5c2c8f,_0x814b0[_0x8c07('0x4c')]);return db[_0x8c07('0x35')][_0x8c07('0x4d')](_0x5c2c8f)[_0x8c07('0x2f')](handleEntityNotFound(_0x3e1cf1,null))['then'](respondWithResult(_0x3e1cf1,null))['catch'](handleError(_0x3e1cf1,null));};exports[_0x8c07('0x2e')]=function(_0x5cc6f9,_0x9c2bcc){if(_0x5cc6f9[_0x8c07('0x4e')]['id']){delete _0x5cc6f9[_0x8c07('0x4e')]['id'];}return db['Setting'][_0x8c07('0x4d')]({'where':{'id':_0x5cc6f9[_0x8c07('0x4b')]['id']}})[_0x8c07('0x2f')](handleEntityNotFound(_0x9c2bcc,null))[_0x8c07('0x2f')](saveUpdates(_0x5cc6f9[_0x8c07('0x4e')],null))[_0x8c07('0x2f')](respondWithResult(_0x9c2bcc,null))['catch'](handleError(_0x9c2bcc,null));};exports[_0x8c07('0x4f')]=function(_0x4dac5d,_0x35ddc1,_0x36e11f){if(_0x4dac5d[_0x8c07('0x50')]&&_0x4dac5d[_0x8c07('0x50')][_0x8c07('0x51')]){_0x4dac5d[_0x8c07('0x4e')][_0x8c07('0x52')]=_0x4dac5d[_0x8c07('0x50')][_0x8c07('0x51')];}return db[_0x8c07('0x35')]['find']({'where':{'id':_0x4dac5d[_0x8c07('0x4b')]['id']}})[_0x8c07('0x2f')](handleEntityNotFound(_0x35ddc1,null))[_0x8c07('0x2f')](saveUpdates(_0x4dac5d[_0x8c07('0x4e')],null))[_0x8c07('0x2f')](respondWithResult(_0x35ddc1,null))[_0x8c07('0x25')](handleError(_0x35ddc1,null));};exports[_0x8c07('0x53')]=function(_0x1676be,_0x251aa7,_0x4e2b11){if(_0x1676be[_0x8c07('0x50')]&&_0x1676be['file']['filename']){_0x1676be[_0x8c07('0x4e')][_0x8c07('0x54')]=_0x1676be['file'][_0x8c07('0x51')];}return db[_0x8c07('0x35')][_0x8c07('0x4d')]({'where':{'id':_0x1676be['params']['id']}})[_0x8c07('0x2f')](handleEntityNotFound(_0x251aa7,null))[_0x8c07('0x2f')](saveUpdates(_0x1676be['body'],null))[_0x8c07('0x2f')](respondWithResult(_0x251aa7,null))['catch'](handleError(_0x251aa7,null));};var utilLicense=require(_0x8c07('0x16'));exports['getLogo']=function(_0x5e3189,_0x18859f,_0x172aa7){var _0x13412a=_0x8c07('0x55');var _0x27fdf3={'custom':![]};return utilLicense[_0x8c07('0x56')]()[_0x8c07('0x2f')](function(_0x35462d){if(_0x35462d){_0x27fdf3=_0x35462d;}return db[_0x8c07('0x35')][_0x8c07('0x4d')]({'where':{'id':_0x5e3189[_0x8c07('0x4b')]['id']},'attributes':[_0x8c07('0x52'),_0x8c07('0x54'),_0x8c07('0x57'),_0x8c07('0x58'),_0x8c07('0x59'),_0x8c07('0x5a'),_0x8c07('0x5b'),_0x8c07('0x5c')],'raw':!![]});})[_0x8c07('0x2f')](handleEntityNotFound(_0x18859f,null))['then'](function(_0x27f44c){if(_0x27f44c){var _0x20f3b4=_0x27f44c[_0x8c07('0x52')]&&fs[_0x8c07('0x5d')](path[_0x8c07('0x5e')](config[_0x8c07('0x5f')],_0x13412a,_[_0x8c07('0x60')](_0x27f44c[_0x8c07('0x52')])))?path['join'](config[_0x8c07('0x5f')],_0x13412a,_['toLower'](_0x27f44c[_0x8c07('0x52')])):path[_0x8c07('0x5e')](config['root'],_0x13412a,_['toLower']('default_logo.svg'));var _0x1e5b94=_0x8c07('0x61')+_[_0x8c07('0x62')]('logo');if(_0x27f44c[_0x1e5b94]||!_0x27fdf3['custom']){_0x20f3b4=path['join'](config[_0x8c07('0x5f')],_0x13412a,_[_0x8c07('0x60')](_0x8c07('0x63')));}if(!fs[_0x8c07('0x5d')](_0x20f3b4)){throw new db[(_0x8c07('0x64'))]['ValidationError'](_['upperFirst'](_0x8c07('0x52'))+_0x8c07('0x65'));}return _0x18859f['download'](_0x20f3b4);}})['catch'](handleError(_0x18859f,null));};var utilLicense=require(_0x8c07('0x16'));exports['getLogoLogin']=function(_0x511960,_0x592680,_0x54bed9){var _0x297f31=_0x8c07('0x55');var _0x34d9f6={'custom':![]};return utilLicense[_0x8c07('0x56')]()[_0x8c07('0x2f')](function(_0x218298){if(_0x218298){_0x34d9f6=_0x218298;}return db[_0x8c07('0x35')]['find']({'where':{'id':_0x511960[_0x8c07('0x4b')]['id']},'attributes':[_0x8c07('0x52'),'loginLogo','preferred',_0x8c07('0x58'),'defaultLogo',_0x8c07('0x5a'),_0x8c07('0x5b'),'defaultFavicon'],'raw':!![]});})[_0x8c07('0x2f')](handleEntityNotFound(_0x592680,null))[_0x8c07('0x2f')](function(_0x3766b3){if(_0x3766b3){var _0x30716f=_0x3766b3[_0x8c07('0x54')]&&fs[_0x8c07('0x5d')](path[_0x8c07('0x5e')](config[_0x8c07('0x5f')],_0x297f31,_[_0x8c07('0x60')](_0x3766b3[_0x8c07('0x54')])))?path[_0x8c07('0x5e')](config[_0x8c07('0x5f')],_0x297f31,_['toLower'](_0x3766b3[_0x8c07('0x54')])):path[_0x8c07('0x5e')](config[_0x8c07('0x5f')],_0x297f31,_['toLower'](_0x8c07('0x66')));var _0x389445=_0x8c07('0x61')+_[_0x8c07('0x62')](_0x8c07('0x54'));if(_0x3766b3[_0x389445]||!_0x34d9f6[_0x8c07('0x67')]){_0x30716f=path[_0x8c07('0x5e')](config[_0x8c07('0x5f')],_0x297f31,_[_0x8c07('0x60')]('default_loginLogo.svg'));}if(!fs['existsSync'](_0x30716f)){throw new db[(_0x8c07('0x64'))][(_0x8c07('0x68'))](_[_0x8c07('0x62')](_0x8c07('0x54'))+_0x8c07('0x65'));}return _0x592680[_0x8c07('0x69')](_0x30716f);}})[_0x8c07('0x25')](handleError(_0x592680,null));};exports[_0x8c07('0x6a')]=function(_0x42ffab,_0x5de5f5){return db[_0x8c07('0x35')][_0x8c07('0x4d')]({'where':{'id':_0x42ffab[_0x8c07('0x4b')]['id']},'attributes':[_0x8c07('0x6b')]})[_0x8c07('0x2f')](respondWithResult(_0x5de5f5,null))[_0x8c07('0x25')](handleError(_0x5de5f5,null));};exports[_0x8c07('0x6c')]=function(_0x1dedd3,_0x40720c,_0x227d4d){if(_0x1dedd3[_0x8c07('0x50')]&&_0x1dedd3['file'][_0x8c07('0x51')]){_0x1dedd3['body'][_0x8c07('0x57')]=_0x1dedd3['file']['filename'];}return db[_0x8c07('0x35')]['find']({'where':{'id':_0x1dedd3['params']['id']}})[_0x8c07('0x2f')](handleEntityNotFound(_0x40720c,null))['then'](saveUpdates(_0x1dedd3[_0x8c07('0x4e')],null))[_0x8c07('0x2f')](respondWithResult(_0x40720c,null))['catch'](handleError(_0x40720c,null));};var utilLicense=require(_0x8c07('0x16'));exports[_0x8c07('0x6d')]=function(_0xd5810c,_0x4705f9,_0xa3f6ed){var _0x5e1ef7='server/files/images/logos';var _0xeda979={'custom':![]};return utilLicense[_0x8c07('0x56')]()[_0x8c07('0x2f')](function(_0x58d478){if(_0x58d478){_0xeda979=_0x58d478;}return db[_0x8c07('0x35')][_0x8c07('0x4d')]({'where':{'id':_0xd5810c[_0x8c07('0x4b')]['id']},'attributes':['logo',_0x8c07('0x54'),_0x8c07('0x57'),_0x8c07('0x58'),_0x8c07('0x59'),'defaultLoginLogo','defaultPreferred',_0x8c07('0x5c')],'raw':!![]});})['then'](handleEntityNotFound(_0x4705f9,null))['then'](function(_0x1a2480){if(_0x1a2480){var _0xbb4b2c=_0x1a2480[_0x8c07('0x57')]&&fs[_0x8c07('0x5d')](path[_0x8c07('0x5e')](config[_0x8c07('0x5f')],_0x5e1ef7,_[_0x8c07('0x60')](_0x1a2480[_0x8c07('0x57')])))?path[_0x8c07('0x5e')](config[_0x8c07('0x5f')],_0x5e1ef7,_['toLower'](_0x1a2480[_0x8c07('0x57')])):path['join'](config[_0x8c07('0x5f')],_0x5e1ef7,_[_0x8c07('0x60')](_0x8c07('0x6e')));var _0x20302c=_0x8c07('0x61')+_[_0x8c07('0x62')](_0x8c07('0x57'));if(_0x1a2480[_0x20302c]||!_0xeda979[_0x8c07('0x67')]||!_0xeda979[_0x8c07('0x57')]){_0xbb4b2c=path[_0x8c07('0x5e')](config[_0x8c07('0x5f')],_0x5e1ef7,_[_0x8c07('0x60')]('default_preferred.png'));}if(!fs[_0x8c07('0x5d')](_0xbb4b2c)){throw new db[(_0x8c07('0x64'))][(_0x8c07('0x68'))](_[_0x8c07('0x62')](_0x8c07('0x57'))+_0x8c07('0x65'));}return _0x4705f9['download'](_0xbb4b2c);}})[_0x8c07('0x25')](handleError(_0x4705f9,null));};exports[_0x8c07('0x6f')]=function(_0x13945e,_0x1bb0fd,_0x3e2472){if(_0x13945e[_0x8c07('0x50')]&&_0x13945e['file'][_0x8c07('0x51')]){_0x13945e['body'][_0x8c07('0x58')]=_0x13945e[_0x8c07('0x50')][_0x8c07('0x51')];}return db[_0x8c07('0x35')][_0x8c07('0x4d')]({'where':{'id':_0x13945e[_0x8c07('0x4b')]['id']}})[_0x8c07('0x2f')](handleEntityNotFound(_0x1bb0fd,null))[_0x8c07('0x2f')](saveUpdates(_0x13945e[_0x8c07('0x4e')],null))[_0x8c07('0x2f')](respondWithResult(_0x1bb0fd,null))[_0x8c07('0x25')](handleError(_0x1bb0fd,null));};var utilLicense=require(_0x8c07('0x16'));exports[_0x8c07('0x70')]=function(_0x449633,_0x16db58,_0x457564){var _0x45ae4b=_0x8c07('0x55');var _0x45fe9b={'custom':![]};return utilLicense[_0x8c07('0x56')]()['then'](function(_0x545338){if(_0x545338){_0x45fe9b=_0x545338;}return db[_0x8c07('0x35')][_0x8c07('0x4d')]({'where':{'id':_0x449633[_0x8c07('0x4b')]['id']},'attributes':['logo',_0x8c07('0x54'),_0x8c07('0x57'),_0x8c07('0x58'),_0x8c07('0x59'),_0x8c07('0x5a'),_0x8c07('0x5b'),_0x8c07('0x5c')],'raw':!![]});})[_0x8c07('0x2f')](handleEntityNotFound(_0x16db58,null))['then'](function(_0x31a796){if(_0x31a796){var _0x927133=_0x31a796[_0x8c07('0x58')]&&fs[_0x8c07('0x5d')](path[_0x8c07('0x5e')](config[_0x8c07('0x5f')],_0x45ae4b,_[_0x8c07('0x60')](_0x31a796['favicon'])))?path[_0x8c07('0x5e')](config[_0x8c07('0x5f')],_0x45ae4b,_[_0x8c07('0x60')](_0x31a796['favicon'])):path[_0x8c07('0x5e')](config[_0x8c07('0x5f')],_0x45ae4b,_['toLower'](_0x8c07('0x71')));var _0x2e9b8b=_0x8c07('0x61')+_[_0x8c07('0x62')](_0x8c07('0x58'));if(_0x31a796[_0x2e9b8b]||!_0x45fe9b['custom']){_0x927133=path[_0x8c07('0x5e')](config[_0x8c07('0x5f')],_0x45ae4b,_['toLower'](_0x8c07('0x71')));}if(!fs[_0x8c07('0x5d')](_0x927133)){throw new db['Sequelize'][(_0x8c07('0x68'))](_['upperFirst']('favicon')+_0x8c07('0x65'));}return _0x16db58[_0x8c07('0x69')](_0x927133);}})[_0x8c07('0x25')](handleError(_0x16db58,null));};exports[_0x8c07('0x72')]=function(_0x24ea39,_0x43bf14){var _0x2f20ee={'offset':moment()['utcOffset']()};_0x2f20ee[_0x8c07('0x73')]=moment()[_0x8c07('0x74')](_0x2f20ee[_0x8c07('0x27')])[_0x8c07('0x75')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x43bf14[_0x8c07('0x33')](0xc8)['send'](_0x2f20ee);}; \ No newline at end of file +var _0x5c4d=['params','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','preferred','favicon','default_loginLogo.svg','default','gdpr','securePassword','addPreferred','default_preferred.png','addFavicon','default_favicon.ico','getDate','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','zip-dir','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','http','request','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','then','destroy','end','stack','name','send','map','Setting','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','intersection','find','body'];(function(_0x5e4759,_0x1f8793){var _0x1aefe3=function(_0x1be07e){while(--_0x1be07e){_0x5e4759['push'](_0x5e4759['shift']());}};_0x1aefe3(++_0x1f8793);}(_0x5c4d,0x18f));var _0xd5c4=function(_0x283952,_0x442596){_0x283952=_0x283952-0x0;var _0x57bb99=_0x5c4d[_0x283952];return _0x57bb99;};'use strict';var emlformat=require(_0xd5c4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd5c4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd5c4('0x2'));var Mustache=require(_0xd5c4('0x3'));var util=require(_0xd5c4('0x4'));var path=require('path');var sox=require(_0xd5c4('0x5'));var csv=require(_0xd5c4('0x6'));var ejs=require(_0xd5c4('0x7'));var fs=require('fs');var fs_extra=require(_0xd5c4('0x8'));var _=require(_0xd5c4('0x9'));var squel=require(_0xd5c4('0xa'));var crypto=require(_0xd5c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd5c4('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd5c4('0xd'));var Papa=require(_0xd5c4('0xe'));var Redis=require(_0xd5c4('0xf'));var authService=require(_0xd5c4('0x10'));var qs=require(_0xd5c4('0x11'));var as=require(_0xd5c4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd5c4('0x13'))('api');var utils=require(_0xd5c4('0x14'));var config=require(_0xd5c4('0x15'));var licenseUtil=require(_0xd5c4('0x16'));var db=require(_0xd5c4('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xd5c4('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x2b2b05,_0x10faf8,_0x45fa57,_0x46172c){return new BPromise(function(_0x4b018a,_0x1d362b){var _0x49a6ee=_0x46172c||client;return _0x49a6ee[_0xd5c4('0x19')](_0x2b2b05,_0x45fa57)['then'](function(_0x34c210){logger[_0xd5c4('0x1a')](_0xd5c4('0x1b'),_0x10faf8,'request\x20sent');logger[_0xd5c4('0x1c')](_0xd5c4('0x1d'),_0x10faf8,_0xd5c4('0x1e'),JSON[_0xd5c4('0x1f')](_0x34c210));if(_0x34c210['error']){if(_0x34c210[_0xd5c4('0x20')]['code']===0x1f4){logger[_0xd5c4('0x20')](_0xd5c4('0x1b'),_0x10faf8,_0x34c210[_0xd5c4('0x20')][_0xd5c4('0x21')]);return _0x1d362b(_0x34c210['error'][_0xd5c4('0x21')]);}logger['error'](_0xd5c4('0x1b'),_0x10faf8,_0x34c210[_0xd5c4('0x20')][_0xd5c4('0x21')]);return _0x4b018a(_0x34c210[_0xd5c4('0x20')][_0xd5c4('0x21')]);}else{logger['info'](_0xd5c4('0x1b'),_0x10faf8,_0xd5c4('0x1e'));_0x4b018a(_0x34c210[_0xd5c4('0x22')]['message']);}})[_0xd5c4('0x23')](function(_0xc12bb9){logger['error'](_0xd5c4('0x1b'),_0x10faf8,_0xc12bb9);_0x1d362b(_0xc12bb9);});});}function respondWithStatusCode(_0x364365,_0x57c27a){_0x57c27a=_0x57c27a||0xcc;return function(_0x4bd0f1){if(_0x4bd0f1){return _0x364365[_0xd5c4('0x24')](_0x57c27a);}return _0x364365[_0xd5c4('0x25')](_0x57c27a)['end']();};}function respondWithResult(_0x339d97,_0x538b56){_0x538b56=_0x538b56||0xc8;return function(_0x51a1c2){if(_0x51a1c2){return _0x339d97['status'](_0x538b56)[_0xd5c4('0x26')](_0x51a1c2);}};}function respondWithFilteredResult(_0x3c0a14,_0x57e927){return function(_0x3a5e21){if(_0x3a5e21){var _0x800607=typeof _0x57e927[_0xd5c4('0x27')]===_0xd5c4('0x28')&&typeof _0x57e927[_0xd5c4('0x29')]==='undefined';var _0x511641=_0x3a5e21[_0xd5c4('0x2a')];var _0x5c2802=_0x800607?0x0:_0x57e927['offset'];var _0x186666=_0x800607?_0x3a5e21[_0xd5c4('0x2a')]:_0x57e927[_0xd5c4('0x27')]+_0x57e927[_0xd5c4('0x29')];var _0x7ccb3b;if(_0x186666>=_0x511641){_0x186666=_0x511641;_0x7ccb3b=0xc8;}else{_0x7ccb3b=0xce;}_0x3c0a14[_0xd5c4('0x25')](_0x7ccb3b);return _0x3c0a14[_0xd5c4('0x2b')]('Content-Range',_0x5c2802+'-'+_0x186666+'/'+_0x511641)['json'](_0x3a5e21);}return null;};}function patchUpdates(_0x1ea964){return function(_0x21dd52){try{jsonpatch[_0xd5c4('0x2c')](_0x21dd52,_0x1ea964,!![]);}catch(_0x1a7167){return BPromise['reject'](_0x1a7167);}return _0x21dd52[_0xd5c4('0x2d')]();};}function saveUpdates(_0x4c3553,_0x533183){return function(_0x57f1db){if(_0x57f1db){return _0x57f1db['update'](_0x4c3553)[_0xd5c4('0x2e')](function(_0x173d4e){return _0x173d4e;});}return null;};}function removeEntity(_0x5f28e3,_0x48071e){return function(_0x5a29b6){if(_0x5a29b6){return _0x5a29b6[_0xd5c4('0x2f')]()[_0xd5c4('0x2e')](function(){_0x5f28e3[_0xd5c4('0x25')](0xcc)[_0xd5c4('0x30')]();});}};}function handleEntityNotFound(_0x1af1e0,_0xcde8e3){return function(_0x121778){if(!_0x121778){_0x1af1e0['sendStatus'](0x194);}return _0x121778;};}function handleError(_0x1df68b,_0x3de3b7){_0x3de3b7=_0x3de3b7||0x1f4;return function(_0x3dd992){logger[_0xd5c4('0x20')](_0x3dd992[_0xd5c4('0x31')]);if(_0x3dd992[_0xd5c4('0x32')]){delete _0x3dd992['name'];}_0x1df68b[_0xd5c4('0x25')](_0x3de3b7)[_0xd5c4('0x33')](_0x3dd992);};}exports['index']=function(_0xff48d7,_0xb93b0d){var _0x8b275f={},_0x2619bd={},_0x323199={'count':0x0,'rows':[]};var _0x261a23=_[_0xd5c4('0x34')](db[_0xd5c4('0x35')][_0xd5c4('0x36')],function(_0x4f2e10){return{'name':_0x4f2e10[_0xd5c4('0x37')],'type':_0x4f2e10[_0xd5c4('0x38')][_0xd5c4('0x39')]};});_0x2619bd[_0xd5c4('0x3a')]=_[_0xd5c4('0x34')](_0x261a23,_0xd5c4('0x32'));_0x2619bd[_0xd5c4('0x3b')]=_[_0xd5c4('0x3c')](_0xff48d7['query']);_0x2619bd[_0xd5c4('0x3d')]=_['intersection'](_0x2619bd[_0xd5c4('0x3a')],_0x2619bd[_0xd5c4('0x3b')]);_0x8b275f['attributes']=_['intersection'](_0x2619bd[_0xd5c4('0x3a')],qs[_0xd5c4('0x3e')](_0xff48d7[_0xd5c4('0x3b')][_0xd5c4('0x3e')]));_0x8b275f[_0xd5c4('0x3f')]=_0x8b275f[_0xd5c4('0x3f')][_0xd5c4('0x40')]?_0x8b275f[_0xd5c4('0x3f')]:_0x2619bd[_0xd5c4('0x3a')];if(!_0xff48d7[_0xd5c4('0x3b')]['hasOwnProperty'](_0xd5c4('0x41'))){_0x8b275f[_0xd5c4('0x29')]=qs[_0xd5c4('0x29')](_0xff48d7['query'][_0xd5c4('0x29')]);_0x8b275f[_0xd5c4('0x27')]=qs[_0xd5c4('0x27')](_0xff48d7[_0xd5c4('0x3b')][_0xd5c4('0x27')]);}_0x8b275f[_0xd5c4('0x42')]=qs[_0xd5c4('0x43')](_0xff48d7[_0xd5c4('0x3b')][_0xd5c4('0x43')]);_0x8b275f[_0xd5c4('0x44')]=qs[_0xd5c4('0x3d')](_[_0xd5c4('0x45')](_0xff48d7['query'],_0x2619bd[_0xd5c4('0x3d')]),_0x261a23);if(_0xff48d7[_0xd5c4('0x3b')][_0xd5c4('0x46')]){_0x8b275f[_0xd5c4('0x44')]=_[_0xd5c4('0x47')](_0x8b275f[_0xd5c4('0x44')],{'$or':_[_0xd5c4('0x34')](_0x261a23,function(_0x176177){if(_0x176177[_0xd5c4('0x38')]!==_0xd5c4('0x48')){var _0x219c1d={};_0x219c1d[_0x176177[_0xd5c4('0x32')]]={'$like':'%'+_0xff48d7[_0xd5c4('0x3b')][_0xd5c4('0x46')]+'%'};return _0x219c1d;}})});}_0x8b275f=_[_0xd5c4('0x47')]({},_0x8b275f,_0xff48d7[_0xd5c4('0x49')]);var _0x2db243={'where':_0x8b275f[_0xd5c4('0x44')]};return db['Setting'][_0xd5c4('0x2a')](_0x2db243)['then'](function(_0x484978){_0x323199['count']=_0x484978;if(_0xff48d7[_0xd5c4('0x3b')][_0xd5c4('0x4a')]){_0x8b275f[_0xd5c4('0x4b')]=[{'all':!![]}];}return db['Setting']['findAll'](_0x8b275f);})[_0xd5c4('0x2e')](function(_0x19e76c){_0x323199[_0xd5c4('0x4c')]=_0x19e76c;return _0x323199;})[_0xd5c4('0x2e')](respondWithFilteredResult(_0xb93b0d,_0x8b275f))[_0xd5c4('0x23')](handleError(_0xb93b0d,null));};exports[_0xd5c4('0x4d')]=function(_0x556199,_0x244633){var _0x227458={'raw':![],'where':{'id':_0x556199['params']['id']}},_0x5c4b82={};_0x5c4b82['model']=_[_0xd5c4('0x3c')](db[_0xd5c4('0x35')][_0xd5c4('0x36')]);_0x5c4b82[_0xd5c4('0x3b')]=_['keys'](_0x556199[_0xd5c4('0x3b')]);_0x5c4b82['filters']=_['intersection'](_0x5c4b82[_0xd5c4('0x3a')],_0x5c4b82['query']);_0x227458[_0xd5c4('0x3f')]=_[_0xd5c4('0x4e')](_0x5c4b82[_0xd5c4('0x3a')],qs[_0xd5c4('0x3e')](_0x556199[_0xd5c4('0x3b')][_0xd5c4('0x3e')]));_0x227458[_0xd5c4('0x3f')]=_0x227458[_0xd5c4('0x3f')][_0xd5c4('0x40')]?_0x227458[_0xd5c4('0x3f')]:_0x5c4b82[_0xd5c4('0x3a')];if(_0x556199[_0xd5c4('0x3b')][_0xd5c4('0x4a')]){_0x227458[_0xd5c4('0x4b')]=[{'all':!![]}];}_0x227458=_['merge']({},_0x227458,_0x556199[_0xd5c4('0x49')]);return db[_0xd5c4('0x35')][_0xd5c4('0x4f')](_0x227458)['then'](handleEntityNotFound(_0x244633,null))[_0xd5c4('0x2e')](respondWithResult(_0x244633,null))[_0xd5c4('0x23')](handleError(_0x244633,null));};exports['update']=function(_0x4b96b4,_0x53064e){if(_0x4b96b4[_0xd5c4('0x50')]['id']){delete _0x4b96b4[_0xd5c4('0x50')]['id'];}return db['Setting'][_0xd5c4('0x4f')]({'where':{'id':_0x4b96b4[_0xd5c4('0x51')]['id']}})[_0xd5c4('0x2e')](handleEntityNotFound(_0x53064e,null))[_0xd5c4('0x2e')](saveUpdates(_0x4b96b4[_0xd5c4('0x50')],null))[_0xd5c4('0x2e')](respondWithResult(_0x53064e,null))[_0xd5c4('0x23')](handleError(_0x53064e,null));};exports['addLogo']=function(_0x15609f,_0x484b0c,_0x45d901){if(_0x15609f[_0xd5c4('0x52')]&&_0x15609f['file'][_0xd5c4('0x53')]){_0x15609f['body'][_0xd5c4('0x54')]=_0x15609f[_0xd5c4('0x52')][_0xd5c4('0x53')];}return db[_0xd5c4('0x35')][_0xd5c4('0x4f')]({'where':{'id':_0x15609f[_0xd5c4('0x51')]['id']}})[_0xd5c4('0x2e')](handleEntityNotFound(_0x484b0c,null))[_0xd5c4('0x2e')](saveUpdates(_0x15609f['body'],null))[_0xd5c4('0x2e')](respondWithResult(_0x484b0c,null))[_0xd5c4('0x23')](handleError(_0x484b0c,null));};exports[_0xd5c4('0x55')]=function(_0x3a71e1,_0x8cb772,_0x5250eb){if(_0x3a71e1[_0xd5c4('0x52')]&&_0x3a71e1[_0xd5c4('0x52')][_0xd5c4('0x53')]){_0x3a71e1[_0xd5c4('0x50')][_0xd5c4('0x56')]=_0x3a71e1['file'][_0xd5c4('0x53')];}return db['Setting'][_0xd5c4('0x4f')]({'where':{'id':_0x3a71e1['params']['id']}})[_0xd5c4('0x2e')](handleEntityNotFound(_0x8cb772,null))['then'](saveUpdates(_0x3a71e1[_0xd5c4('0x50')],null))[_0xd5c4('0x2e')](respondWithResult(_0x8cb772,null))[_0xd5c4('0x23')](handleError(_0x8cb772,null));};var utilLicense=require(_0xd5c4('0x16'));exports[_0xd5c4('0x57')]=function(_0x537152,_0x48a550,_0x3a5b86){var _0x65cb6d=_0xd5c4('0x58');var _0x2c2fcf={'custom':![]};return utilLicense[_0xd5c4('0x59')]()[_0xd5c4('0x2e')](function(_0x4c33b1){if(_0x4c33b1){_0x2c2fcf=_0x4c33b1;}return db[_0xd5c4('0x35')][_0xd5c4('0x4f')]({'where':{'id':_0x537152[_0xd5c4('0x51')]['id']},'attributes':[_0xd5c4('0x54'),_0xd5c4('0x56'),'preferred','favicon',_0xd5c4('0x5a'),_0xd5c4('0x5b'),_0xd5c4('0x5c'),_0xd5c4('0x5d')],'raw':!![]});})[_0xd5c4('0x2e')](handleEntityNotFound(_0x48a550,null))[_0xd5c4('0x2e')](function(_0x47b268){if(_0x47b268){var _0x3db49e=_0x47b268[_0xd5c4('0x54')]&&fs[_0xd5c4('0x5e')](path[_0xd5c4('0x5f')](config[_0xd5c4('0x60')],_0x65cb6d,_[_0xd5c4('0x61')](_0x47b268['logo'])))?path['join'](config[_0xd5c4('0x60')],_0x65cb6d,_[_0xd5c4('0x61')](_0x47b268[_0xd5c4('0x54')])):path[_0xd5c4('0x5f')](config[_0xd5c4('0x60')],_0x65cb6d,_[_0xd5c4('0x61')](_0xd5c4('0x62')));var _0x24a21f='default'+_[_0xd5c4('0x63')](_0xd5c4('0x54'));if(_0x47b268[_0x24a21f]||!_0x2c2fcf[_0xd5c4('0x64')]){_0x3db49e=path['join'](config['root'],_0x65cb6d,_[_0xd5c4('0x61')](_0xd5c4('0x62')));}if(!fs[_0xd5c4('0x5e')](_0x3db49e)){throw new db[(_0xd5c4('0x65'))][(_0xd5c4('0x66'))](_[_0xd5c4('0x63')]('logo')+_0xd5c4('0x67'));}return _0x48a550[_0xd5c4('0x68')](_0x3db49e);}})[_0xd5c4('0x23')](handleError(_0x48a550,null));};var utilLicense=require(_0xd5c4('0x16'));exports[_0xd5c4('0x69')]=function(_0x2cc09f,_0x2da3d2,_0x336a39){var _0x1d265f=_0xd5c4('0x58');var _0x495a96={'custom':![]};return utilLicense['getLicense']()[_0xd5c4('0x2e')](function(_0x4dcda0){if(_0x4dcda0){_0x495a96=_0x4dcda0;}return db[_0xd5c4('0x35')][_0xd5c4('0x4f')]({'where':{'id':_0x2cc09f[_0xd5c4('0x51')]['id']},'attributes':[_0xd5c4('0x54'),'loginLogo',_0xd5c4('0x6a'),_0xd5c4('0x6b'),_0xd5c4('0x5a'),_0xd5c4('0x5b'),_0xd5c4('0x5c'),_0xd5c4('0x5d')],'raw':!![]});})[_0xd5c4('0x2e')](handleEntityNotFound(_0x2da3d2,null))[_0xd5c4('0x2e')](function(_0x505ae1){if(_0x505ae1){var _0x3f9a74=_0x505ae1[_0xd5c4('0x56')]&&fs[_0xd5c4('0x5e')](path[_0xd5c4('0x5f')](config[_0xd5c4('0x60')],_0x1d265f,_[_0xd5c4('0x61')](_0x505ae1[_0xd5c4('0x56')])))?path[_0xd5c4('0x5f')](config['root'],_0x1d265f,_['toLower'](_0x505ae1[_0xd5c4('0x56')])):path['join'](config[_0xd5c4('0x60')],_0x1d265f,_['toLower'](_0xd5c4('0x6c')));var _0x29ff02=_0xd5c4('0x6d')+_[_0xd5c4('0x63')](_0xd5c4('0x56'));if(_0x505ae1[_0x29ff02]||!_0x495a96['custom']){_0x3f9a74=path[_0xd5c4('0x5f')](config[_0xd5c4('0x60')],_0x1d265f,_['toLower']('default_loginLogo.svg'));}if(!fs[_0xd5c4('0x5e')](_0x3f9a74)){throw new db['Sequelize'][(_0xd5c4('0x66'))](_[_0xd5c4('0x63')]('loginLogo')+_0xd5c4('0x67'));}return _0x2da3d2[_0xd5c4('0x68')](_0x3f9a74);}})[_0xd5c4('0x23')](handleError(_0x2da3d2,null));};exports[_0xd5c4('0x6e')]=function(_0x24229d,_0x6c14c6){return db['Setting'][_0xd5c4('0x4f')]({'where':{'id':_0x24229d[_0xd5c4('0x51')]['id']},'attributes':[_0xd5c4('0x6f')]})[_0xd5c4('0x2e')](respondWithResult(_0x6c14c6,null))[_0xd5c4('0x23')](handleError(_0x6c14c6,null));};exports[_0xd5c4('0x70')]=function(_0x2915a3,_0xe0f415,_0xb8f78c){if(_0x2915a3[_0xd5c4('0x52')]&&_0x2915a3['file'][_0xd5c4('0x53')]){_0x2915a3['body'][_0xd5c4('0x6a')]=_0x2915a3['file']['filename'];}return db[_0xd5c4('0x35')][_0xd5c4('0x4f')]({'where':{'id':_0x2915a3['params']['id']}})['then'](handleEntityNotFound(_0xe0f415,null))['then'](saveUpdates(_0x2915a3[_0xd5c4('0x50')],null))['then'](respondWithResult(_0xe0f415,null))[_0xd5c4('0x23')](handleError(_0xe0f415,null));};var utilLicense=require(_0xd5c4('0x16'));exports['getPreferred']=function(_0x42acf5,_0x438883,_0x4dfaaa){var _0xafe806=_0xd5c4('0x58');var _0x460a61={'custom':![]};return utilLicense['getLicense']()[_0xd5c4('0x2e')](function(_0x44ab7f){if(_0x44ab7f){_0x460a61=_0x44ab7f;}return db[_0xd5c4('0x35')][_0xd5c4('0x4f')]({'where':{'id':_0x42acf5[_0xd5c4('0x51')]['id']},'attributes':[_0xd5c4('0x54'),_0xd5c4('0x56'),_0xd5c4('0x6a'),_0xd5c4('0x6b'),_0xd5c4('0x5a'),_0xd5c4('0x5b'),'defaultPreferred',_0xd5c4('0x5d')],'raw':!![]});})[_0xd5c4('0x2e')](handleEntityNotFound(_0x438883,null))[_0xd5c4('0x2e')](function(_0x50db6e){if(_0x50db6e){var _0x18c2b3=_0x50db6e[_0xd5c4('0x6a')]&&fs[_0xd5c4('0x5e')](path['join'](config[_0xd5c4('0x60')],_0xafe806,_[_0xd5c4('0x61')](_0x50db6e[_0xd5c4('0x6a')])))?path[_0xd5c4('0x5f')](config[_0xd5c4('0x60')],_0xafe806,_['toLower'](_0x50db6e['preferred'])):path[_0xd5c4('0x5f')](config[_0xd5c4('0x60')],_0xafe806,_[_0xd5c4('0x61')](_0xd5c4('0x71')));var _0x47c9a3=_0xd5c4('0x6d')+_['upperFirst'](_0xd5c4('0x6a'));if(_0x50db6e[_0x47c9a3]||!_0x460a61[_0xd5c4('0x64')]||!_0x460a61[_0xd5c4('0x6a')]){_0x18c2b3=path[_0xd5c4('0x5f')](config[_0xd5c4('0x60')],_0xafe806,_[_0xd5c4('0x61')]('default_preferred.png'));}if(!fs['existsSync'](_0x18c2b3)){throw new db[(_0xd5c4('0x65'))][(_0xd5c4('0x66'))](_['upperFirst'](_0xd5c4('0x6a'))+_0xd5c4('0x67'));}return _0x438883['download'](_0x18c2b3);}})[_0xd5c4('0x23')](handleError(_0x438883,null));};exports[_0xd5c4('0x72')]=function(_0x18a11,_0xbe75db,_0x35ab07){if(_0x18a11[_0xd5c4('0x52')]&&_0x18a11[_0xd5c4('0x52')][_0xd5c4('0x53')]){_0x18a11[_0xd5c4('0x50')][_0xd5c4('0x6b')]=_0x18a11[_0xd5c4('0x52')]['filename'];}return db[_0xd5c4('0x35')][_0xd5c4('0x4f')]({'where':{'id':_0x18a11[_0xd5c4('0x51')]['id']}})[_0xd5c4('0x2e')](handleEntityNotFound(_0xbe75db,null))[_0xd5c4('0x2e')](saveUpdates(_0x18a11[_0xd5c4('0x50')],null))['then'](respondWithResult(_0xbe75db,null))[_0xd5c4('0x23')](handleError(_0xbe75db,null));};var utilLicense=require(_0xd5c4('0x16'));exports['getFavicon']=function(_0x21f48e,_0x2ff4ef,_0x31b53f){var _0x2ba673=_0xd5c4('0x58');var _0x33e652={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x3ebdd3){if(_0x3ebdd3){_0x33e652=_0x3ebdd3;}return db[_0xd5c4('0x35')][_0xd5c4('0x4f')]({'where':{'id':_0x21f48e[_0xd5c4('0x51')]['id']},'attributes':[_0xd5c4('0x54'),_0xd5c4('0x56'),_0xd5c4('0x6a'),'favicon',_0xd5c4('0x5a'),_0xd5c4('0x5b'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xd5c4('0x2e')](handleEntityNotFound(_0x2ff4ef,null))[_0xd5c4('0x2e')](function(_0xafc1b9){if(_0xafc1b9){var _0x162185=_0xafc1b9[_0xd5c4('0x6b')]&&fs[_0xd5c4('0x5e')](path[_0xd5c4('0x5f')](config[_0xd5c4('0x60')],_0x2ba673,_[_0xd5c4('0x61')](_0xafc1b9[_0xd5c4('0x6b')])))?path['join'](config[_0xd5c4('0x60')],_0x2ba673,_[_0xd5c4('0x61')](_0xafc1b9[_0xd5c4('0x6b')])):path[_0xd5c4('0x5f')](config[_0xd5c4('0x60')],_0x2ba673,_[_0xd5c4('0x61')](_0xd5c4('0x73')));var _0x40a383=_0xd5c4('0x6d')+_['upperFirst'](_0xd5c4('0x6b'));if(_0xafc1b9[_0x40a383]||!_0x33e652['custom']){_0x162185=path[_0xd5c4('0x5f')](config[_0xd5c4('0x60')],_0x2ba673,_[_0xd5c4('0x61')](_0xd5c4('0x73')));}if(!fs[_0xd5c4('0x5e')](_0x162185)){throw new db[(_0xd5c4('0x65'))][(_0xd5c4('0x66'))](_[_0xd5c4('0x63')](_0xd5c4('0x6b'))+'\x20not\x20found');}return _0x2ff4ef[_0xd5c4('0x68')](_0x162185);}})['catch'](handleError(_0x2ff4ef,null));};exports[_0xd5c4('0x74')]=function(_0x4ab5d3,_0x38a757){var _0xd76ecd={'offset':moment()[_0xd5c4('0x75')]()};_0xd76ecd[_0xd5c4('0x76')]=moment()[_0xd5c4('0x75')](_0xd76ecd[_0xd5c4('0x27')])['format'](_0xd5c4('0x77'));return _0x38a757[_0xd5c4('0x25')](0xc8)[_0xd5c4('0x33')](_0xd76ecd);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 6b22524..9b6fd74 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 _0xe14b=['bluebird','path','./setting.attributes','exports','define','Setting','settings','lodash','util','moment'];(function(_0xbd29ae,_0xd0989){var _0x1d2837=function(_0x276a97){while(--_0x276a97){_0xbd29ae['push'](_0xbd29ae['shift']());}};_0x1d2837(++_0xd0989);}(_0xe14b,0x93));var _0xbe14=function(_0x26acad,_0x34a85d){_0x26acad=_0x26acad-0x0;var _0x5ca7ea=_0xe14b[_0x26acad];return _0x5ca7ea;};'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 +var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xa9eaa0,_0x4ba2b4){var _0x30897a=function(_0x2caa01){while(--_0x2caa01){_0xa9eaa0['push'](_0xa9eaa0['shift']());}};_0x30897a(++_0x4ba2b4);}(_0x55ca,0x126));var _0xa55c=function(_0x1529a3,_0x529f63){_0x1529a3=_0x1529a3-0x0;var _0x1a0d4b=_0x55ca[_0x1529a3];return _0x1a0d4b;};'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 diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 131e2d1..ab59820 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 _0x3c69=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Setting','options','where','attributes','include','map','model','ShowSetting','lodash','util','moment','randomstring'];(function(_0x5dbe23,_0x29c9d5){var _0xf3f9c4=function(_0x5262f2){while(--_0x5262f2){_0x5dbe23['push'](_0x5dbe23['shift']());}};_0xf3f9c4(++_0x29c9d5);}(_0x3c69,0xd5));var _0x93c6=function(_0xd2e2ab,_0x2440cf){_0xd2e2ab=_0xd2e2ab-0x0;var _0x1703a2=_0x3c69[_0xd2e2ab];return _0x1703a2;};'use strict';var _=require(_0x93c6('0x0'));var util=require(_0x93c6('0x1'));var moment=require(_0x93c6('0x2'));var BPromise=require('bluebird');var rs=require(_0x93c6('0x3'));var fs=require('fs');var Redis=require(_0x93c6('0x4'));var db=require(_0x93c6('0x5'))['db'];var utils=require(_0x93c6('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x93c6('0x7'));var jayson=require(_0x93c6('0x8'));var client=jayson['client'][_0x93c6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32eb9b,_0x3565c1,_0x1a1fef){return new BPromise(function(_0x46948b,_0x510fd1){return client[_0x93c6('0xa')](_0x32eb9b,_0x1a1fef)[_0x93c6('0xb')](function(_0x6c32aa){logger[_0x93c6('0xc')](_0x93c6('0xd'),_0x3565c1,_0x93c6('0xe'));logger[_0x93c6('0xf')](_0x93c6('0x10'),_0x3565c1,_0x93c6('0xe'),JSON[_0x93c6('0x11')](_0x6c32aa));if(_0x6c32aa[_0x93c6('0x12')]){if(_0x6c32aa['error'][_0x93c6('0x13')]===0x1f4){logger[_0x93c6('0x12')](_0x93c6('0xd'),_0x3565c1,_0x6c32aa[_0x93c6('0x12')][_0x93c6('0x14')]);return _0x510fd1(_0x6c32aa[_0x93c6('0x12')][_0x93c6('0x14')]);}logger['error'](_0x93c6('0xd'),_0x3565c1,_0x6c32aa[_0x93c6('0x12')]['message']);return _0x46948b(_0x6c32aa[_0x93c6('0x12')][_0x93c6('0x14')]);}else{logger[_0x93c6('0xc')](_0x93c6('0xd'),_0x3565c1,_0x93c6('0xe'));_0x46948b(_0x6c32aa[_0x93c6('0x15')][_0x93c6('0x14')]);}})[_0x93c6('0x16')](function(_0x48f4eb){logger[_0x93c6('0x12')](_0x93c6('0xd'),_0x3565c1,_0x48f4eb);_0x510fd1(_0x48f4eb);});});}exports['ShowSetting']=function(_0x2d1275){var _0x6818a=this;return new Promise(function(_0x46f038,_0x2c711a){return db[_0x93c6('0x17')]['find']({'raw':_0x2d1275[_0x93c6('0x18')]?_0x2d1275[_0x93c6('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2d1275['options']?_0x2d1275[_0x93c6('0x18')][_0x93c6('0x19')]||null:null,'attributes':_0x2d1275[_0x93c6('0x18')]?_0x2d1275[_0x93c6('0x18')][_0x93c6('0x1a')]||null:null,'include':_0x2d1275[_0x93c6('0x18')]?_0x2d1275['options'][_0x93c6('0x1b')]?_[_0x93c6('0x1c')](_0x2d1275[_0x93c6('0x18')]['include'],function(_0x1068ac){return{'model':db[_0x1068ac[_0x93c6('0x1d')]],'as':_0x1068ac['as'],'attributes':_0x1068ac['attributes'],'include':_0x1068ac[_0x93c6('0x1b')]?_['map'](_0x1068ac[_0x93c6('0x1b')],function(_0x4fa414){return{'model':db[_0x4fa414[_0x93c6('0x1d')]],'as':_0x4fa414['as'],'attributes':_0x4fa414['attributes'],'include':_0x4fa414['include']?_['map'](_0x4fa414['include'],function(_0x46a270){return{'model':db[_0x46a270['model']],'as':_0x46a270['as'],'attributes':_0x46a270[_0x93c6('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3deb47){logger[_0x93c6('0xc')]('ShowSetting',_0x2d1275);logger[_0x93c6('0xf')](_0x93c6('0x1e'),_0x2d1275,JSON[_0x93c6('0x11')](_0x3deb47));_0x46f038(_0x3deb47);})[_0x93c6('0x16')](function(_0x348897){logger['error'](_0x93c6('0x1e'),_0x348897[_0x93c6('0x14')],_0x2d1275);_0x2c711a(_0x6818a[_0x93c6('0x12')](0x1f4,_0x348897[_0x93c6('0x14')]));});});}; \ No newline at end of file +var _0xcdfa=['catch','moment','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','message','error','info','result','ShowSetting','find','options','raw','where','attributes','map','include','model'];(function(_0x2f837a,_0x260f38){var _0x50ea02=function(_0x22c299){while(--_0x22c299){_0x2f837a['push'](_0x2f837a['shift']());}};_0x50ea02(++_0x260f38);}(_0xcdfa,0x1cc));var _0xacdf=function(_0x17a9bd,_0x4e02f0){_0x17a9bd=_0x17a9bd-0x0;var _0x69842f=_0xcdfa[_0x17a9bd];return _0x69842f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xacdf('0x0'));var BPromise=require('bluebird');var rs=require(_0xacdf('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xacdf('0x2'));var logger=require('../../config/logger')('rpc');var config=require(_0xacdf('0x3'));var jayson=require(_0xacdf('0x4'));var client=jayson[_0xacdf('0x5')][_0xacdf('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xcd4d23,_0x1e11e0,_0x16ad1a){return new BPromise(function(_0x485840,_0x110bb6){return client['request'](_0xcd4d23,_0x16ad1a)[_0xacdf('0x7')](function(_0x591a66){logger['info'](_0xacdf('0x8'),_0x1e11e0,_0xacdf('0x9'));logger[_0xacdf('0xa')](_0xacdf('0xb'),_0x1e11e0,_0xacdf('0x9'),JSON[_0xacdf('0xc')](_0x591a66));if(_0x591a66['error']){if(_0x591a66['error']['code']===0x1f4){logger['error'](_0xacdf('0x8'),_0x1e11e0,_0x591a66['error'][_0xacdf('0xd')]);return _0x110bb6(_0x591a66[_0xacdf('0xe')][_0xacdf('0xd')]);}logger['error'](_0xacdf('0x8'),_0x1e11e0,_0x591a66[_0xacdf('0xe')][_0xacdf('0xd')]);return _0x485840(_0x591a66['error'][_0xacdf('0xd')]);}else{logger[_0xacdf('0xf')](_0xacdf('0x8'),_0x1e11e0,_0xacdf('0x9'));_0x485840(_0x591a66[_0xacdf('0x10')][_0xacdf('0xd')]);}})['catch'](function(_0x56c4e1){logger[_0xacdf('0xe')]('Setting,\x20%s,\x20%s',_0x1e11e0,_0x56c4e1);_0x110bb6(_0x56c4e1);});});}exports[_0xacdf('0x11')]=function(_0xbcb8ee){var _0x4a14a5=this;return new Promise(function(_0x1a302f,_0x37290d){return db['Setting'][_0xacdf('0x12')]({'raw':_0xbcb8ee[_0xacdf('0x13')]?_0xbcb8ee['options'][_0xacdf('0x14')]===undefined?!![]:![]:!![],'where':_0xbcb8ee[_0xacdf('0x13')]?_0xbcb8ee[_0xacdf('0x13')][_0xacdf('0x15')]||null:null,'attributes':_0xbcb8ee[_0xacdf('0x13')]?_0xbcb8ee[_0xacdf('0x13')][_0xacdf('0x16')]||null:null,'include':_0xbcb8ee[_0xacdf('0x13')]?_0xbcb8ee[_0xacdf('0x13')]['include']?_[_0xacdf('0x17')](_0xbcb8ee[_0xacdf('0x13')][_0xacdf('0x18')],function(_0x333aa5){return{'model':db[_0x333aa5[_0xacdf('0x19')]],'as':_0x333aa5['as'],'attributes':_0x333aa5[_0xacdf('0x16')],'include':_0x333aa5[_0xacdf('0x18')]?_[_0xacdf('0x17')](_0x333aa5[_0xacdf('0x18')],function(_0x2236cc){return{'model':db[_0x2236cc[_0xacdf('0x19')]],'as':_0x2236cc['as'],'attributes':_0x2236cc[_0xacdf('0x16')],'include':_0x2236cc[_0xacdf('0x18')]?_['map'](_0x2236cc['include'],function(_0x5c4499){return{'model':db[_0x5c4499[_0xacdf('0x19')]],'as':_0x5c4499['as'],'attributes':_0x5c4499[_0xacdf('0x16')]};}):[]};}):[]};}):[]:[]})[_0xacdf('0x7')](function(_0x575843){logger[_0xacdf('0xf')](_0xacdf('0x11'),_0xbcb8ee);logger['debug'](_0xacdf('0x11'),_0xbcb8ee,JSON[_0xacdf('0xc')](_0x575843));_0x1a302f(_0x575843);})[_0xacdf('0x1a')](function(_0x554ae1){logger[_0xacdf('0xe')]('ShowSetting',_0x554ae1[_0xacdf('0xd')],_0xbcb8ee);_0x37290d(_0x4a14a5[_0xacdf('0xe')](0x1f4,_0x554ae1[_0xacdf('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index d8eaa4f..eb8ba37 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 _0x55ca=['describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','/:id/status','statusGet','/:id/users','getAgents','create','post','addDisposition','/:id/notify','notify','/:id/send','send','status','addAgents','put','update','destroy','removeDispositions','delete','removeAnswers','removeAgents','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x55ca,0x126));var _0xa55c=function(_0x3a441a,_0x43eb56){_0x3a441a=_0x3a441a-0x0;var _0x3128a2=_0x55ca[_0x3a441a];return _0x3128a2;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getApplications']);router['get'](_0xa55c('0x11'),auth['isAuthenticated'](),controller['getInteractions']);router['get'](_0xa55c('0x12'),controller[_0xa55c('0x13')]);router[_0xa55c('0x7')](_0xa55c('0x14'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x17')](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);router[_0xa55c('0x17')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller['addAnswer']);router[_0xa55c('0x17')](_0xa55c('0x19'),controller[_0xa55c('0x1a')]);router[_0xa55c('0x17')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['addApplications']);router['post'](_0xa55c('0x1b'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x1c')]);router['post'](_0xa55c('0x12'),controller[_0xa55c('0x1d')]);router['post'](_0xa55c('0x14'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x1e')]);router[_0xa55c('0x1f')](_0xa55c('0xb'),auth['isAuthenticated'](),controller[_0xa55c('0x20')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x21')]);router['delete'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x22')]);router[_0xa55c('0x23')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x24')]);router[_0xa55c('0x23')](_0xa55c('0x14'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x25')]);module['exports']=router; \ No newline at end of file +var _0xf494=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','getAgents','post','/:id/applications','addApplications','/:id/send','send','/:id/users','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf494,0x1c6));var _0x4f49=function(_0x541056,_0x1b4d2c){_0x541056=_0x541056-0x0;var _0x576c06=_0xf494[_0x541056];return _0x576c06;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0xc')]);router[_0x4f49('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0xa')](_0x4f49('0x10'),auth[_0x4f49('0xb')](),controller['getDispositions']);router[_0x4f49('0xa')](_0x4f49('0x11'),auth['isAuthenticated'](),controller[_0x4f49('0x12')]);router['get']('/:id/applications',auth[_0x4f49('0xb')](),controller[_0x4f49('0x13')]);router['get'](_0x4f49('0x14'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x15')]);router[_0x4f49('0xa')](_0x4f49('0x16'),controller[_0x4f49('0x17')]);router[_0x4f49('0xa')]('/:id/users',auth[_0x4f49('0xb')](),controller[_0x4f49('0x18')]);router[_0x4f49('0x19')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4f49('0x19')](_0x4f49('0x10'),auth[_0x4f49('0xb')](),controller['addDisposition']);router[_0x4f49('0x19')](_0x4f49('0x11'),auth[_0x4f49('0xb')](),controller['addAnswer']);router['post']('/:id/notify',controller['notify']);router[_0x4f49('0x19')](_0x4f49('0x1a'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x1b')]);router['post'](_0x4f49('0x1c'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x1d')]);router[_0x4f49('0x19')](_0x4f49('0x16'),controller['status']);router[_0x4f49('0x19')](_0x4f49('0x1e'),auth[_0x4f49('0xb')](),controller['addAgents']);router[_0x4f49('0x1f')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x20')]);router[_0x4f49('0x21')](_0x4f49('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0x4f49('0x21')](_0x4f49('0x10'),auth['isAuthenticated'](),controller[_0x4f49('0x22')]);router[_0x4f49('0x21')](_0x4f49('0x11'),auth['isAuthenticated'](),controller[_0x4f49('0x23')]);router[_0x4f49('0x21')](_0x4f49('0x1e'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x24')]);module[_0x4f49('0x25')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 8d458f1..cf557ff 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 _0x565b=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x32cf3c,_0x3f7dc5){var _0x117b60=function(_0x344bf4){while(--_0x344bf4){_0x32cf3c['push'](_0x32cf3c['shift']());}};_0x117b60(++_0x3f7dc5);}(_0x565b,0xc9));var _0xb565=function(_0x35f6b4,_0x505966){_0x35f6b4=_0x35f6b4-0x0;var _0x10f072=_0x565b[_0x35f6b4];return _0x10f072;};'use strict';var Sequelize=require(_0xb565('0x0'));var rs=require('randomstring');module[_0xb565('0x1')]={'name':{'type':Sequelize[_0xb565('0x2')],'unique':_0xb565('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xb565('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xb565('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xb565('0x2')],'defaultValue':function(){return rs[_0xb565('0x4')]();}},'phone':{'type':Sequelize[_0xb565('0x2')]},'type':{'type':Sequelize[_0xb565('0x5')](_0xb565('0x6'),_0xb565('0x7'),_0xb565('0x8'),_0xb565('0x9'),_0xb565('0xa'),_0xb565('0xb'),'bandwidth','csc',_0xb565('0xc'),_0xb565('0xd'))},'accountSid':{'type':Sequelize[_0xb565('0x2')]},'authId':{'type':Sequelize[_0xb565('0x2')]},'authToken':{'type':Sequelize[_0xb565('0x2')]},'smsMethod':{'type':Sequelize[_0xb565('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xb565('0x2')]},'password':{'type':Sequelize[_0xb565('0x2')]},'apiKey':{'type':Sequelize[_0xb565('0x2')]},'applicationId':{'type':Sequelize[_0xb565('0x2')]},'accountId':{'type':Sequelize[_0xb565('0x2')]},'senderString':{'type':Sequelize[_0xb565('0x2')]},'deliveryReport':{'type':Sequelize[_0xb565('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0xb565('0x2')]},'notificationTemplate':{'type':Sequelize[_0xb565('0xf')],'defaultValue':function(){return _0xb565('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb565('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb565('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb565('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb565('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xb565('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb565('0x11')],'comment':_0xb565('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xb565('0x13'),'set':function(_0x3a514e){if(!_0x3a514e)this[_0xb565('0x14')](_0xb565('0x15'),null);this[_0xb565('0x14')]('mandatoryDisposition',_0x3a514e);}}}; \ No newline at end of file +var _0xcab6=['clickatell','bandwidth','csc','infobip','intelepeer','ENUM','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','generate','twilio','skebby','connectel','plivo'];(function(_0x5e211a,_0x1815c7){var _0xeddb09=function(_0x2590aa){while(--_0x2590aa){_0x5e211a['push'](_0x5e211a['shift']());}};_0xeddb09(++_0x1815c7);}(_0xcab6,0x1ac));var _0x6cab=function(_0x31549c,_0x5efb14){_0x31549c=_0x31549c-0x0;var _0x2de667=_0xcab6[_0x31549c];return _0x2de667;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x6cab('0x0'));module[_0x6cab('0x1')]={'name':{'type':Sequelize[_0x6cab('0x2')],'unique':_0x6cab('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x6cab('0x2')],'defaultValue':function(){return rs[_0x6cab('0x4')]();}},'phone':{'type':Sequelize[_0x6cab('0x2')]},'type':{'type':Sequelize['ENUM'](_0x6cab('0x5'),_0x6cab('0x6'),_0x6cab('0x7'),'clicksend',_0x6cab('0x8'),_0x6cab('0x9'),_0x6cab('0xa'),_0x6cab('0xb'),_0x6cab('0xc'),_0x6cab('0xd'))},'accountSid':{'type':Sequelize[_0x6cab('0x2')]},'authId':{'type':Sequelize[_0x6cab('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x6cab('0xe')]('SI','TI','GP')},'username':{'type':Sequelize[_0x6cab('0x2')]},'password':{'type':Sequelize[_0x6cab('0x2')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x6cab('0x2')]},'accountId':{'type':Sequelize[_0x6cab('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x6cab('0xf')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x6cab('0x10');}},'notificationSound':{'type':Sequelize[_0x6cab('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6cab('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6cab('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6cab('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6cab('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6cab('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x6cab('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6cab('0x11')],'comment':_0x6cab('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x6cab('0x13'),'set':function(_0x2e6408){if(!_0x2e6408)this[_0x6cab('0x14')](_0x6cab('0x15'),null);this[_0x6cab('0x14')](_0x6cab('0x16'),_0x2e6408);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 5c42117..7dbd514 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 _0x7bfc=['../../config/utils','../../config/environment','../../config/license/util','redis','register','jayson/promise','client','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','error','code','message','catch','sendStatus','status','end','json','offset','limit','count','Content-Range','reject','save','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','params','create','body','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','length','pick','includeAll','removeDispositions','ids','CannedAnswer','getAnswers','nolimit','removeAnswers','sms','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','CompanyId','ListId','twilio','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','MessageUUID','results','originatingAddress','segmentedMessage','clickatell','replyMessageId','bandwidth','refid','isNil','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','Contacts','updatedAt','DESC','list','omit','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','SmsMessage','AttachmentId','UserId','User','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','set','Content-Type','text/xml','\x0a','addApplications','transaction','sequelize','Transaction','READ_COMMITTED','SmsApplication','bulkCreate','findAndCountAll','finally','getApplications','Contact','Owner','fullname','internal','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','statusInt','requestid','status_code','groupName','DELIVERED','intelepeer','redif','SmsAccount,\x20%s,\x20%s,\x20%s','error_code','infobip','RECEIVED_BY_RECIPIENT','message-delivered','state','message-id','csc','emit','removeAgents','isArray','getAgents','eml-format','rimraf','bluebird','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x10025e,_0x3639b1){var _0x5c4342=function(_0x4a65f1){while(--_0x4a65f1){_0x10025e['push'](_0x10025e['shift']());}};_0x5c4342(++_0x3639b1);}(_0x7bfc,0xc6));var _0xc7bf=function(_0x2d9de5,_0x3846d1){_0x2d9de5=_0x2d9de5-0x0;var _0x20891d=_0x7bfc[_0x2d9de5];return _0x20891d;};'use strict';var emlformat=require(_0xc7bf('0x0'));var rimraf=require(_0xc7bf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc7bf('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc7bf('0x3'));var sox=require(_0xc7bf('0x4'));var csv=require(_0xc7bf('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc7bf('0x6'));var _=require('lodash');var squel=require(_0xc7bf('0x7'));var crypto=require('crypto');var jsforce=require(_0xc7bf('0x8'));var deskjs=require(_0xc7bf('0x9'));var toCsv=require('to-csv');var querystring=require(_0xc7bf('0xa'));var Papa=require(_0xc7bf('0xb'));var Redis=require(_0xc7bf('0xc'));var authService=require(_0xc7bf('0xd'));var qs=require(_0xc7bf('0xe'));var as=require(_0xc7bf('0xf'));var hardwareService=require(_0xc7bf('0x10'));var logger=require(_0xc7bf('0x11'))(_0xc7bf('0x12'));var utils=require(_0xc7bf('0x13'));var config=require(_0xc7bf('0x14'));var licenseUtil=require(_0xc7bf('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc7bf('0x16')]));require('./smsAccount.socket')[_0xc7bf('0x17')](socket);var jayson=require(_0xc7bf('0x18'));var client=jayson[_0xc7bf('0x19')]['http']({'port':0x232c});function respondWithRpcPromise(_0x3c29d6,_0x306a34,_0x1c0761,_0xe0288a){return new BPromise(function(_0x40f620,_0x2a3cb8){var _0x23f32f=_0xe0288a||client;return _0x23f32f['request'](_0x3c29d6,_0x1c0761)[_0xc7bf('0x1a')](function(_0x589d1f){logger[_0xc7bf('0x1b')](_0xc7bf('0x1c'),_0x306a34,'request\x20sent');logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x306a34,_0xc7bf('0x1d'),JSON['stringify'](_0x589d1f));if(_0x589d1f[_0xc7bf('0x1e')]){if(_0x589d1f[_0xc7bf('0x1e')][_0xc7bf('0x1f')]===0x1f4){logger[_0xc7bf('0x1e')](_0xc7bf('0x1c'),_0x306a34,_0x589d1f[_0xc7bf('0x1e')][_0xc7bf('0x20')]);return _0x2a3cb8(_0x589d1f['error'][_0xc7bf('0x20')]);}logger[_0xc7bf('0x1e')](_0xc7bf('0x1c'),_0x306a34,_0x589d1f[_0xc7bf('0x1e')]['message']);return _0x40f620(_0x589d1f[_0xc7bf('0x1e')][_0xc7bf('0x20')]);}else{logger[_0xc7bf('0x1b')]('SmsAccount,\x20%s,\x20%s',_0x306a34,_0xc7bf('0x1d'));_0x40f620(_0x589d1f['result'][_0xc7bf('0x20')]);}})[_0xc7bf('0x21')](function(_0x1fe43d){logger['error'](_0xc7bf('0x1c'),_0x306a34,_0x1fe43d);_0x2a3cb8(_0x1fe43d);});});}function respondWithStatusCode(_0x2863e1,_0x3041ec){_0x3041ec=_0x3041ec||0xcc;return function(_0x325ac5){if(_0x325ac5){return _0x2863e1[_0xc7bf('0x22')](_0x3041ec);}return _0x2863e1[_0xc7bf('0x23')](_0x3041ec)[_0xc7bf('0x24')]();};}function respondWithResult(_0x15c772,_0x3e7ec9){_0x3e7ec9=_0x3e7ec9||0xc8;return function(_0x5e7906){if(_0x5e7906){return _0x15c772[_0xc7bf('0x23')](_0x3e7ec9)[_0xc7bf('0x25')](_0x5e7906);}};}function respondWithFilteredResult(_0x1b52d9,_0x5ea2db){return function(_0x5a8893){if(_0x5a8893){var _0x31abf3=typeof _0x5ea2db[_0xc7bf('0x26')]==='undefined'&&typeof _0x5ea2db[_0xc7bf('0x27')]==='undefined';var _0x121a50=_0x5a8893[_0xc7bf('0x28')];var _0x580d7c=_0x31abf3?0x0:_0x5ea2db[_0xc7bf('0x26')];var _0x4959a4=_0x31abf3?_0x5a8893[_0xc7bf('0x28')]:_0x5ea2db[_0xc7bf('0x26')]+_0x5ea2db['limit'];var _0x54ffd1;if(_0x4959a4>=_0x121a50){_0x4959a4=_0x121a50;_0x54ffd1=0xc8;}else{_0x54ffd1=0xce;}_0x1b52d9[_0xc7bf('0x23')](_0x54ffd1);return _0x1b52d9['set'](_0xc7bf('0x29'),_0x580d7c+'-'+_0x4959a4+'/'+_0x121a50)[_0xc7bf('0x25')](_0x5a8893);}return null;};}function patchUpdates(_0x1d4c16){return function(_0x3dc3cd){try{jsonpatch['apply'](_0x3dc3cd,_0x1d4c16,!![]);}catch(_0x26a20e){return BPromise[_0xc7bf('0x2a')](_0x26a20e);}return _0x3dc3cd[_0xc7bf('0x2b')]();};}function saveUpdates(_0x19b2f4,_0x3e7ff5){return function(_0x280c8d){if(_0x280c8d){return _0x280c8d[_0xc7bf('0x2c')](_0x19b2f4)[_0xc7bf('0x1a')](function(_0x160c75){return _0x160c75;});}return null;};}function removeEntity(_0x4f6038,_0x1122d2){return function(_0x222a5d){if(_0x222a5d){return _0x222a5d[_0xc7bf('0x2d')]()[_0xc7bf('0x1a')](function(){var _0x555c9b=_0x222a5d[_0xc7bf('0x2e')]({'plain':!![]});var _0x458252='SmsAccounts';return db[_0xc7bf('0x2f')][_0xc7bf('0x2d')]({'where':{'type':_0x458252,'resourceId':_0x555c9b['id']}})[_0xc7bf('0x1a')](function(){return _0x222a5d;});})[_0xc7bf('0x1a')](function(){_0x4f6038[_0xc7bf('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x458f4e,_0x72d811){return function(_0x152d95){if(!_0x152d95){_0x458f4e['sendStatus'](0x194);}return _0x152d95;};}function handleError(_0x5e78aa,_0x2d8817){_0x2d8817=_0x2d8817||0x1f4;return function(_0x585d7f){logger[_0xc7bf('0x1e')](_0x585d7f[_0xc7bf('0x30')]);if(_0x585d7f[_0xc7bf('0x31')]){delete _0x585d7f[_0xc7bf('0x31')];}_0x5e78aa[_0xc7bf('0x23')](_0x2d8817)[_0xc7bf('0x32')](_0x585d7f);};}exports[_0xc7bf('0x33')]=function(_0x1e37d5,_0x90e45a){var _0x35cb03={'include':[{'model':db[_0xc7bf('0x34')],'as':_0xc7bf('0x35')}]},_0xc153cd={},_0x3b9e7a={'count':0x0,'rows':[]};var _0x423f73=_[_0xc7bf('0x36')](db[_0xc7bf('0x37')][_0xc7bf('0x38')],function(_0x280fdd){return{'name':_0x280fdd[_0xc7bf('0x39')],'type':_0x280fdd[_0xc7bf('0x3a')]['key']};});_0xc153cd[_0xc7bf('0x3b')]=_[_0xc7bf('0x36')](_0x423f73,_0xc7bf('0x31'));_0xc153cd[_0xc7bf('0x3c')]=_[_0xc7bf('0x3d')](_0x1e37d5['query']);_0xc153cd[_0xc7bf('0x3e')]=_['intersection'](_0xc153cd[_0xc7bf('0x3b')],_0xc153cd['query']);_0x35cb03[_0xc7bf('0x3f')]=_[_0xc7bf('0x40')](_0xc153cd[_0xc7bf('0x3b')],qs[_0xc7bf('0x41')](_0x1e37d5[_0xc7bf('0x3c')][_0xc7bf('0x41')]));_0x35cb03[_0xc7bf('0x3f')]=_0x35cb03[_0xc7bf('0x3f')]['length']?_0x35cb03[_0xc7bf('0x3f')]:_0xc153cd[_0xc7bf('0x3b')];if(!_0x1e37d5[_0xc7bf('0x3c')][_0xc7bf('0x42')]('nolimit')){_0x35cb03[_0xc7bf('0x27')]=qs[_0xc7bf('0x27')](_0x1e37d5['query'][_0xc7bf('0x27')]);_0x35cb03[_0xc7bf('0x26')]=qs[_0xc7bf('0x26')](_0x1e37d5['query'][_0xc7bf('0x26')]);}_0x35cb03[_0xc7bf('0x43')]=qs[_0xc7bf('0x44')](_0x1e37d5[_0xc7bf('0x3c')][_0xc7bf('0x44')]);_0x35cb03[_0xc7bf('0x45')]=qs[_0xc7bf('0x3e')](_['pick'](_0x1e37d5[_0xc7bf('0x3c')],_0xc153cd[_0xc7bf('0x3e')]),_0x423f73);if(_0x1e37d5[_0xc7bf('0x3c')][_0xc7bf('0x46')]){_0x35cb03['where']=_[_0xc7bf('0x47')](_0x35cb03['where'],{'$or':_[_0xc7bf('0x36')](_0x423f73,function(_0xe62082){if(_0xe62082[_0xc7bf('0x3a')]!==_0xc7bf('0x48')){var _0x3f49b3={};_0x3f49b3[_0xe62082[_0xc7bf('0x31')]]={'$like':'%'+_0x1e37d5[_0xc7bf('0x3c')][_0xc7bf('0x46')]+'%'};return _0x3f49b3;}})});}_0x35cb03=_[_0xc7bf('0x47')]({},_0x35cb03,_0x1e37d5[_0xc7bf('0x49')]);var _0x59a30e={'where':_0x35cb03[_0xc7bf('0x45')]};return db['SmsAccount'][_0xc7bf('0x28')](_0x59a30e)[_0xc7bf('0x1a')](function(_0x386d05){_0x3b9e7a['count']=_0x386d05;if(_0x1e37d5[_0xc7bf('0x3c')]['includeAll']){_0x35cb03[_0xc7bf('0x4a')]=[{'all':!![]}];}return db[_0xc7bf('0x37')][_0xc7bf('0x4b')](_0x35cb03);})[_0xc7bf('0x1a')](function(_0x11d85c){_0x3b9e7a[_0xc7bf('0x4c')]=_0x11d85c;return _0x3b9e7a;})['then'](respondWithFilteredResult(_0x90e45a,_0x35cb03))[_0xc7bf('0x21')](handleError(_0x90e45a,null));};exports['show']=function(_0x2e7ca2,_0x23e2e5){var _0x9b7d73={'raw':![],'where':{'id':_0x2e7ca2[_0xc7bf('0x4d')]['id']},'include':[{'model':db[_0xc7bf('0x34')],'as':'mandatoryDispositionPause'}]},_0x50e347={};_0x50e347[_0xc7bf('0x3b')]=_[_0xc7bf('0x3d')](db['SmsAccount'][_0xc7bf('0x38')]);_0x50e347[_0xc7bf('0x3c')]=_[_0xc7bf('0x3d')](_0x2e7ca2['query']);_0x50e347[_0xc7bf('0x3e')]=_[_0xc7bf('0x40')](_0x50e347[_0xc7bf('0x3b')],_0x50e347['query']);_0x9b7d73[_0xc7bf('0x3f')]=_[_0xc7bf('0x40')](_0x50e347[_0xc7bf('0x3b')],qs['fields'](_0x2e7ca2['query']['fields']));_0x9b7d73[_0xc7bf('0x3f')]=_0x9b7d73[_0xc7bf('0x3f')]['length']?_0x9b7d73['attributes']:_0x50e347[_0xc7bf('0x3b')];if(_0x2e7ca2['query']['includeAll']){_0x9b7d73[_0xc7bf('0x4a')]=[{'all':!![]}];}_0x9b7d73=_[_0xc7bf('0x47')]({},_0x9b7d73,_0x2e7ca2[_0xc7bf('0x49')]);return db['SmsAccount']['find'](_0x9b7d73)['then'](handleEntityNotFound(_0x23e2e5,null))[_0xc7bf('0x1a')](respondWithResult(_0x23e2e5,null))[_0xc7bf('0x21')](handleError(_0x23e2e5,null));};exports[_0xc7bf('0x4e')]=function(_0x2e8377,_0x51222f){return db['SmsAccount'][_0xc7bf('0x4e')](_0x2e8377[_0xc7bf('0x4f')],{})[_0xc7bf('0x1a')](function(_0x246d9b){var _0x423ec8=_0x2e8377[_0xc7bf('0x50')][_0xc7bf('0x2e')]({'plain':!![]});if(!_0x423ec8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x423ec8['role']===_0xc7bf('0x50')){var _0x267d88=_0x246d9b[_0xc7bf('0x2e')]({'plain':!![]});var _0x736fec='SmsAccounts';return db[_0xc7bf('0x51')][_0xc7bf('0x52')]({'where':{'name':_0x736fec,'userProfileId':_0x423ec8[_0xc7bf('0x53')]},'raw':!![]})['then'](function(_0x9c5291){if(_0x9c5291&&_0x9c5291[_0xc7bf('0x54')]===0x0){return db['UserProfileResource'][_0xc7bf('0x4e')]({'name':_0x267d88[_0xc7bf('0x31')],'resourceId':_0x267d88['id'],'type':_0x9c5291[_0xc7bf('0x31')],'sectionId':_0x9c5291['id']},{})[_0xc7bf('0x1a')](function(){return _0x246d9b;});}else{return _0x246d9b;}})[_0xc7bf('0x21')](function(_0x556c99){logger[_0xc7bf('0x1e')](_0xc7bf('0x55'),_0x556c99);throw _0x556c99;});}return _0x246d9b;})[_0xc7bf('0x1a')](respondWithResult(_0x51222f,0xc9))[_0xc7bf('0x21')](handleError(_0x51222f,null));};exports[_0xc7bf('0x2c')]=function(_0x5ef955,_0x57f1f8){if(_0x5ef955[_0xc7bf('0x4f')]['id']){delete _0x5ef955[_0xc7bf('0x4f')]['id'];}return db[_0xc7bf('0x37')][_0xc7bf('0x52')]({'where':{'id':_0x5ef955[_0xc7bf('0x4d')]['id']},'include':[{'model':db[_0xc7bf('0x34')],'as':'mandatoryDispositionPause'}]})[_0xc7bf('0x1a')](handleEntityNotFound(_0x57f1f8,null))[_0xc7bf('0x1a')](saveUpdates(_0x5ef955[_0xc7bf('0x4f')],null))[_0xc7bf('0x1a')](respondWithResult(_0x57f1f8,null))['catch'](handleError(_0x57f1f8,null));};exports[_0xc7bf('0x2d')]=function(_0x4f6c54,_0x4502f7){return db[_0xc7bf('0x37')][_0xc7bf('0x52')]({'where':{'id':_0x4f6c54[_0xc7bf('0x4d')]['id']}})[_0xc7bf('0x1a')](handleEntityNotFound(_0x4502f7,null))[_0xc7bf('0x1a')](removeEntity(_0x4502f7,null))[_0xc7bf('0x21')](handleError(_0x4502f7,null));};exports[_0xc7bf('0x56')]=function(_0x5ccce9,_0x5c08d7){return db[_0xc7bf('0x37')][_0xc7bf('0x56')]()[_0xc7bf('0x1a')](respondWithResult(_0x5c08d7,null))['catch'](handleError(_0x5c08d7,null));};exports[_0xc7bf('0x57')]=function(_0x53781b,_0x2fa2a2,_0x413837){if(_0x53781b[_0xc7bf('0x4f')]['id']){delete _0x53781b[_0xc7bf('0x4f')]['id'];}return db[_0xc7bf('0x37')][_0xc7bf('0x52')]({'where':{'id':_0x53781b[_0xc7bf('0x4d')]['id']}})[_0xc7bf('0x1a')](handleEntityNotFound(_0x2fa2a2,null))[_0xc7bf('0x1a')](function(_0xca732e){if(_0xca732e){_0x53781b[_0xc7bf('0x4f')][_0xc7bf('0x58')]=_0xca732e['id'];return db[_0xc7bf('0x59')][_0xc7bf('0x4e')](_0x53781b['body']);}})['then'](respondWithResult(_0x2fa2a2,null))['catch'](handleError(_0x2fa2a2,null));};exports[_0xc7bf('0x5a')]=function(_0xaa5dbf,_0x4327f7,_0x457808){var _0x288914={'raw':![],'where':{}};var _0x3c7b35={};var _0x695a1={'count':0x0,'rows':[]};return db['SmsAccount'][_0xc7bf('0x5b')]({'where':{'id':_0xaa5dbf[_0xc7bf('0x4d')]['id']}})[_0xc7bf('0x1a')](handleEntityNotFound(_0x4327f7,null))[_0xc7bf('0x1a')](function(_0x27fc3d){if(_0x27fc3d){_0x3c7b35[_0xc7bf('0x3b')]=_['keys'](db[_0xc7bf('0x59')][_0xc7bf('0x38')]);_0x3c7b35[_0xc7bf('0x3c')]=_[_0xc7bf('0x3d')](_0xaa5dbf[_0xc7bf('0x3c')]);_0x3c7b35[_0xc7bf('0x3e')]=_[_0xc7bf('0x40')](_0x3c7b35[_0xc7bf('0x3b')],_0x3c7b35[_0xc7bf('0x3c')]);_0x288914['attributes']=_['intersection'](_0x3c7b35['model'],qs['fields'](_0xaa5dbf[_0xc7bf('0x3c')][_0xc7bf('0x41')]));_0x288914[_0xc7bf('0x3f')]=_0x288914[_0xc7bf('0x3f')][_0xc7bf('0x5c')]?_0x288914[_0xc7bf('0x3f')]:_0x3c7b35[_0xc7bf('0x3b')];if(!_0xaa5dbf['query'][_0xc7bf('0x42')]('nolimit')){_0x288914[_0xc7bf('0x27')]=qs[_0xc7bf('0x27')](_0xaa5dbf[_0xc7bf('0x3c')][_0xc7bf('0x27')]);_0x288914['offset']=qs['offset'](_0xaa5dbf[_0xc7bf('0x3c')][_0xc7bf('0x26')]);}_0x288914['order']=qs[_0xc7bf('0x44')](_0xaa5dbf['query'][_0xc7bf('0x44')]);_0x288914[_0xc7bf('0x45')]=qs[_0xc7bf('0x3e')](_[_0xc7bf('0x5d')](_0xaa5dbf[_0xc7bf('0x3c')],_0x3c7b35['filters']));_0x288914[_0xc7bf('0x45')][_0xc7bf('0x58')]=_0x27fc3d['id'];if(_0xaa5dbf[_0xc7bf('0x3c')][_0xc7bf('0x46')]){_0x288914[_0xc7bf('0x45')]=_[_0xc7bf('0x47')](_0x288914[_0xc7bf('0x45')],{'$or':_[_0xc7bf('0x36')](_0x288914[_0xc7bf('0x3f')],function(_0x12bfa2){var _0x1e1f4b={};_0x1e1f4b[_0x12bfa2]={'$like':'%'+_0xaa5dbf[_0xc7bf('0x3c')][_0xc7bf('0x46')]+'%'};return _0x1e1f4b;})});}_0x288914=_['merge']({},_0x288914,_0xaa5dbf['options']);return db[_0xc7bf('0x59')][_0xc7bf('0x28')]({'where':_0x288914['where']})[_0xc7bf('0x1a')](function(_0x353bb4){_0x695a1['count']=_0x353bb4;if(_0xaa5dbf[_0xc7bf('0x3c')][_0xc7bf('0x5e')]){_0x288914['include']=[{'all':!![]}];}return db[_0xc7bf('0x59')]['findAll'](_0x288914);})[_0xc7bf('0x1a')](function(_0xb069c){_0x695a1[_0xc7bf('0x4c')]=_0xb069c;return _0x695a1;});}})[_0xc7bf('0x1a')](respondWithFilteredResult(_0x4327f7,_0x288914))[_0xc7bf('0x21')](handleError(_0x4327f7,null));};exports[_0xc7bf('0x5f')]=function(_0x49054b,_0x349401,_0x3db8ea){return db[_0xc7bf('0x37')][_0xc7bf('0x52')]({'where':{'id':_0x49054b[_0xc7bf('0x4d')]['id']}})[_0xc7bf('0x1a')](handleEntityNotFound(_0x349401,null))[_0xc7bf('0x1a')](function(_0x44ea9c){if(_0x44ea9c){return _0x44ea9c[_0xc7bf('0x5f')](_0x49054b[_0xc7bf('0x3c')][_0xc7bf('0x60')]);}})['then'](respondWithStatusCode(_0x349401,null))[_0xc7bf('0x21')](handleError(_0x349401,null));};exports['addAnswer']=function(_0x47f8a5,_0x34ed7e,_0x60b405){if(_0x47f8a5[_0xc7bf('0x4f')]['id']){delete _0x47f8a5[_0xc7bf('0x4f')]['id'];}return db[_0xc7bf('0x37')][_0xc7bf('0x52')]({'where':{'id':_0x47f8a5[_0xc7bf('0x4d')]['id']}})['then'](handleEntityNotFound(_0x34ed7e,null))[_0xc7bf('0x1a')](function(_0x477d9f){if(_0x477d9f){_0x47f8a5[_0xc7bf('0x4f')][_0xc7bf('0x58')]=_0x477d9f['id'];return db[_0xc7bf('0x61')][_0xc7bf('0x4e')](_0x47f8a5[_0xc7bf('0x4f')]);}})[_0xc7bf('0x1a')](respondWithResult(_0x34ed7e,null))[_0xc7bf('0x21')](handleError(_0x34ed7e,null));};exports[_0xc7bf('0x62')]=function(_0x362cd3,_0x5c9eaf,_0x3874e9){var _0xce475d={'raw':![],'where':{}};var _0x56ef3d={};var _0x263ed7={'count':0x0,'rows':[]};return db[_0xc7bf('0x37')][_0xc7bf('0x5b')]({'where':{'id':_0x362cd3['params']['id']}})[_0xc7bf('0x1a')](handleEntityNotFound(_0x5c9eaf,null))[_0xc7bf('0x1a')](function(_0x2b4124){if(_0x2b4124){_0x56ef3d[_0xc7bf('0x3b')]=_[_0xc7bf('0x3d')](db[_0xc7bf('0x61')]['rawAttributes']);_0x56ef3d[_0xc7bf('0x3c')]=_[_0xc7bf('0x3d')](_0x362cd3[_0xc7bf('0x3c')]);_0x56ef3d[_0xc7bf('0x3e')]=_['intersection'](_0x56ef3d[_0xc7bf('0x3b')],_0x56ef3d[_0xc7bf('0x3c')]);_0xce475d[_0xc7bf('0x3f')]=_['intersection'](_0x56ef3d['model'],qs[_0xc7bf('0x41')](_0x362cd3[_0xc7bf('0x3c')][_0xc7bf('0x41')]));_0xce475d[_0xc7bf('0x3f')]=_0xce475d[_0xc7bf('0x3f')]['length']?_0xce475d[_0xc7bf('0x3f')]:_0x56ef3d[_0xc7bf('0x3b')];if(!_0x362cd3['query'][_0xc7bf('0x42')](_0xc7bf('0x63'))){_0xce475d[_0xc7bf('0x27')]=qs[_0xc7bf('0x27')](_0x362cd3[_0xc7bf('0x3c')]['limit']);_0xce475d[_0xc7bf('0x26')]=qs[_0xc7bf('0x26')](_0x362cd3['query'][_0xc7bf('0x26')]);}_0xce475d['order']=qs[_0xc7bf('0x44')](_0x362cd3['query']['sort']);_0xce475d['where']=qs[_0xc7bf('0x3e')](_[_0xc7bf('0x5d')](_0x362cd3[_0xc7bf('0x3c')],_0x56ef3d[_0xc7bf('0x3e')]));_0xce475d['where']['SmsAccountId']=_0x2b4124['id'];if(_0x362cd3[_0xc7bf('0x3c')][_0xc7bf('0x46')]){_0xce475d[_0xc7bf('0x45')]=_[_0xc7bf('0x47')](_0xce475d[_0xc7bf('0x45')],{'$or':_[_0xc7bf('0x36')](_0xce475d['attributes'],function(_0x304e9e){var _0x1c1547={};_0x1c1547[_0x304e9e]={'$like':'%'+_0x362cd3[_0xc7bf('0x3c')][_0xc7bf('0x46')]+'%'};return _0x1c1547;})});}_0xce475d=_['merge']({},_0xce475d,_0x362cd3['options']);return db[_0xc7bf('0x61')][_0xc7bf('0x28')]({'where':_0xce475d['where']})[_0xc7bf('0x1a')](function(_0x456f24){_0x263ed7[_0xc7bf('0x28')]=_0x456f24;if(_0x362cd3['query']['includeAll']){_0xce475d[_0xc7bf('0x4a')]=[{'all':!![]}];}return db['CannedAnswer'][_0xc7bf('0x4b')](_0xce475d);})[_0xc7bf('0x1a')](function(_0x2e8150){_0x263ed7[_0xc7bf('0x4c')]=_0x2e8150;return _0x263ed7;});}})['then'](respondWithFilteredResult(_0x5c9eaf,_0xce475d))[_0xc7bf('0x21')](handleError(_0x5c9eaf,null));};exports[_0xc7bf('0x64')]=function(_0x2309d1,_0x36bfb5,_0x6d9bde){return db[_0xc7bf('0x37')][_0xc7bf('0x52')]({'where':{'id':_0x2309d1['params']['id']}})[_0xc7bf('0x1a')](handleEntityNotFound(_0x36bfb5,null))['then'](function(_0x30f5bb){if(_0x30f5bb){return _0x30f5bb['removeAnswers'](_0x2309d1['query'][_0xc7bf('0x60')]);}})[_0xc7bf('0x1a')](respondWithStatusCode(_0x36bfb5,null))[_0xc7bf('0x21')](handleError(_0x36bfb5,null));};exports['notify']=function(_0x1db4cb,_0x15d7d1,_0x3f054d){var _0xbf269b={'channel':_0xc7bf('0x65')};var _0x434578=[];var _0x3a0f68=[];var _0x20ea33={};return db[_0xc7bf('0x37')][_0xc7bf('0x52')]({'where':{'id':_0x1db4cb['params']['id']},'include':[{'model':db['SmsApplication'],'as':_0xc7bf('0x66')}]})[_0xc7bf('0x1a')](handleEntityNotFound(_0x15d7d1,null))[_0xc7bf('0x1a')](function(_0x4afc0c){_0xbf269b[_0xc7bf('0x67')]=_0x4afc0c;_0xbf269b[_0xc7bf('0x68')]=_[_0xc7bf('0x69')](_0x4afc0c[_0xc7bf('0x66')],[_0xc7bf('0x6a')],[_0xc7bf('0x6b')]);if(_0xbf269b[_0xc7bf('0x67')]['Applications']){delete _0xbf269b[_0xc7bf('0x67')][_0xc7bf('0x66')];}return db[_0xc7bf('0x6c')][_0xc7bf('0x56')]();})[_0xc7bf('0x1a')](function(_0x40c83f){if(!_0x40c83f){throw new db[(_0xc7bf('0x6d'))][(_0xc7bf('0x6e'))](_0xc7bf('0x6f'));}_0x434578=_['difference'](_['keys'](_0x40c83f),[_0xc7bf('0x70'),'updatedAt']);_0x3a0f68=_['difference'](_['keys'](_0x40c83f),['createdAt','updatedAt',_0xc7bf('0x71'),_0xc7bf('0x72')]);_0xbf269b[_0xc7bf('0x4f')]={'mapKey':'mobile'};if(_0xbf269b[_0xc7bf('0x67')][_0xc7bf('0x3a')]){switch(_0xbf269b['account'][_0xc7bf('0x3a')]){case _0xc7bf('0x73'):_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x74')]=_0x1db4cb[_0xc7bf('0x4f')][_0xc7bf('0x75')];_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x4f')]=_0x1db4cb[_0xc7bf('0x4f')][_0xc7bf('0x76')];_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x77')]=_0x1db4cb[_0xc7bf('0x4f')][_0xc7bf('0x78')];break;case _0xc7bf('0x79'):_0xbf269b['body'][_0xc7bf('0x74')]='+'+_0x1db4cb[_0xc7bf('0x4f')][_0xc7bf('0x7a')];_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x4f')]=_0x1db4cb[_0xc7bf('0x4f')][_0xc7bf('0x7b')];break;case _0xc7bf('0x7c'):_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x74')]=_0x1db4cb[_0xc7bf('0x4f')][_0xc7bf('0x74')];_0xbf269b['body'][_0xc7bf('0x4f')]=_0x1db4cb[_0xc7bf('0x4f')][_0xc7bf('0x20')];break;case _0xc7bf('0x7d'):_0xbf269b['body'][_0xc7bf('0x74')]=_0x1db4cb[_0xc7bf('0x4f')]['from'];_0xbf269b['body'][_0xc7bf('0x4f')]=_0x1db4cb[_0xc7bf('0x4f')][_0xc7bf('0x4f')];_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x77')]=_0x1db4cb[_0xc7bf('0x4f')][_0xc7bf('0x7e')];break;case'plivo':_0xbf269b[_0xc7bf('0x4f')]['from']=_0x1db4cb['body'][_0xc7bf('0x75')];_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x4f')]=_0x1db4cb[_0xc7bf('0x4f')]['Text'];_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x77')]=_0x1db4cb['body'][_0xc7bf('0x7f')];break;case'infobip':_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x74')]='+'+_0x1db4cb[_0xc7bf('0x4f')]['results'][0x0][_0xc7bf('0x74')];_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x4f')]=_0x1db4cb[_0xc7bf('0x4f')][_0xc7bf('0x80')][0x0][_0xc7bf('0x7b')];_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x77')]=_0x1db4cb[_0xc7bf('0x4f')][_0xc7bf('0x80')][0x0][_0xc7bf('0x77')];break;case'csc':_0xbf269b[_0xc7bf('0x4f')]['from']=_0x1db4cb[_0xc7bf('0x4f')][_0xc7bf('0x81')];_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x4f')]=_0x1db4cb[_0xc7bf('0x4f')][_0xc7bf('0x82')]['message'];break;case _0xc7bf('0x83'):_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x74')]=_0x1db4cb[_0xc7bf('0x4f')]['fromNumber'];_0xbf269b[_0xc7bf('0x4f')]['body']=_0x1db4cb[_0xc7bf('0x4f')]['text'];_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x77')]=_0x1db4cb[_0xc7bf('0x4f')][_0xc7bf('0x84')];break;case _0xc7bf('0x85'):_0xbf269b['body'][_0xc7bf('0x77')]=_0x1db4cb[_0xc7bf('0x4f')][0x0][_0xc7bf('0x20')]['id'];_0xbf269b['body']['from']=_0x1db4cb[_0xc7bf('0x4f')][0x0]['message'][_0xc7bf('0x74')];_0xbf269b['body'][_0xc7bf('0x4f')]=_0x1db4cb['body'][0x0][_0xc7bf('0x20')]['text'];break;case'intelepeer':_0xbf269b['body'][_0xc7bf('0x74')]=_0x1db4cb[_0xc7bf('0x4f')][_0xc7bf('0x74')];_0xbf269b[_0xc7bf('0x4f')]['body']=_0x1db4cb[_0xc7bf('0x4f')]['message'];_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x77')]=_0x1db4cb[_0xc7bf('0x4f')][_0xc7bf('0x86')];break;}}if(_0xbf269b[_0xc7bf('0x4f')]['id']){delete _0xbf269b[_0xc7bf('0x4f')]['id'];}if(_[_0xc7bf('0x87')](_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x74')])){throw new db[(_0xc7bf('0x6d'))]['ValidationError'](_0xc7bf('0x88'));}if(_[_0xc7bf('0x87')](_0xbf269b['body']['body'])||_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x4f')]===''){throw new db['Sequelize'][(_0xc7bf('0x6e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc7bf('0x87')](_0xbf269b[_0xc7bf('0x4f')]['mapKey'])){throw new db[(_0xc7bf('0x6d'))][(_0xc7bf('0x6e'))](_0xc7bf('0x89')+_0x3a0f68);}if(!_['includes'](_0x3a0f68,_0xbf269b[_0xc7bf('0x4f')]['mapKey'])){throw new db[(_0xc7bf('0x6d'))][(_0xc7bf('0x6e'))](_0xc7bf('0x8a')+_0x3a0f68);}_0x20ea33[_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x8b')]]=_0xbf269b['body'][_0xc7bf('0x74')];return db[_0xc7bf('0x8c')][_0xc7bf('0x52')]({'where':{'id':_0xbf269b[_0xc7bf('0x67')]['ListId']},'include':[{'model':db[_0xc7bf('0x6c')],'as':_0xc7bf('0x8d'),'where':_0x20ea33,'limit':0x1,'order':[[_0xc7bf('0x8e'),_0xc7bf('0x8f')]]}]});})[_0xc7bf('0x1a')](handleEntityNotFound(_0x15d7d1,null))[_0xc7bf('0x1a')](function(_0x4112c1){if(_0x4112c1){_0xbf269b[_0xc7bf('0x90')]=_[_0xc7bf('0x91')](_0x4112c1,[_0xc7bf('0x8d')]);if(_0x4112c1[_0xc7bf('0x8d')]['length']){return _0x4112c1[_0xc7bf('0x8d')][0x0];}var _0x3a088c=_['defaults'](_0xbf269b[_0xc7bf('0x4f')],{'firstName':_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x74')],'ListId':_0x4112c1['id']});_0x3a088c[_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x8b')]]=_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x74')];return db[_0xc7bf('0x6c')][_0xc7bf('0x4e')](_0x3a088c,{'fields':_0x434578,'raw':!![]});}})[_0xc7bf('0x1a')](handleEntityNotFound(_0x15d7d1,null))[_0xc7bf('0x1a')](function(_0x54a0ec){if(_0x54a0ec){_0xbf269b[_0xc7bf('0x92')]=_0x54a0ec;var _0x141311={'ContactId':_0x54a0ec['id'],'phone':_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x74')],'SmsAccountId':_0x1db4cb[_0xc7bf('0x4d')]['id']};var _0x2af417={'ContactId':_0x54a0ec['id'],'SmsAccountId':_0x1db4cb[_0xc7bf('0x4d')]['id'],'closed':![]};return db[_0xc7bf('0x93')]['find']({'where':_0x2af417})[_0xc7bf('0x1a')](function(_0x1c46dd){if(_0x1c46dd){return[_0x1c46dd,![]];}return db['SmsInteraction']['create'](_0x141311)[_0xc7bf('0x1a')](function(_0x463e86){return[_0x463e86,!![]];});});}})[_0xc7bf('0x94')](function(_0x113ab7,_0x1d0c05){_0xbf269b[_0xc7bf('0x95')]=_0x113ab7[_0xc7bf('0x2e')]({'plain':!![]});_0xbf269b[_0xc7bf('0x95')]['created']=![];if(_0x1d0c05){if(_0xbf269b[_0xc7bf('0x67')][_0xc7bf('0x96')]){_0xbf269b[_0xc7bf('0x68')][_0xc7bf('0x97')]({'id':0x0,'priority':_0xbf269b['applications'][_0xc7bf('0x5c')]+0x1,'app':_0xc7bf('0x98'),'appdata':_0xc7bf('0x99'),'interval':_0xc7bf('0x9a')});}_0xbf269b[_0xc7bf('0x95')][_0xc7bf('0x9b')]=!![];}return db[_0xc7bf('0x9c')][_0xc7bf('0x4e')]({'phone':_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x74')],'messageId':_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x77')],'body':_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x4f')],'SmsAccountId':_0x1db4cb[_0xc7bf('0x4d')]['id'],'SmsInteractionId':_0x113ab7['id'],'direction':'in','ContactId':_0x113ab7['ContactId'],'AttachmentId':_0xbf269b['body'][_0xc7bf('0x9d')]});})[_0xc7bf('0x1a')](function(_0x41248a){_0xbf269b['message']=_0x41248a;if(_0xbf269b['interaction'][_0xc7bf('0x9e')]){return db[_0xc7bf('0x9f')][_0xc7bf('0x52')]({'attributes':['id',_0xc7bf('0x31')],'where':{'id':_0xbf269b[_0xc7bf('0x95')][_0xc7bf('0x9e')]}})[_0xc7bf('0x1a')](function(_0x9c08a1){if(_0x9c08a1){_0xbf269b['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x9c08a1['name']+','+(_0xbf269b[_0xc7bf('0x67')][_0xc7bf('0xa0')]||0xa),'interval':_0xc7bf('0x9a')});}return respondWithRpcPromise(_0xc7bf('0xa1'),_0xc7bf('0xa2'),_0xbf269b);});}return respondWithRpcPromise(_0xc7bf('0xa1'),_0xc7bf('0xa2'),_0xbf269b);})['then'](function(_0xfb702e){if(_0xfb702e){var _0x38cc6b=0xc8;var _0x2beaa1=_0xc7bf('0xa3');logger[_0xc7bf('0x1b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2beaa1,_0x38cc6b,_0xc7bf('0xa4'));logger[_0xc7bf('0xa5')](_0xc7bf('0xa6'),_0x2beaa1,_0x38cc6b,_0xc7bf('0xa4'),JSON[_0xc7bf('0xa7')](_0xfb702e));if(_0xbf269b[_0xc7bf('0x67')][_0xc7bf('0x3a')]===_0xc7bf('0x73')){return _0x15d7d1['status'](_0x38cc6b)[_0xc7bf('0xa8')](_0xc7bf('0xa9'),_0xc7bf('0xaa'))[_0xc7bf('0x32')](_0xc7bf('0xab'));}else{return _0x15d7d1[_0xc7bf('0x23')](_0x38cc6b)[_0xc7bf('0x25')](_0xfb702e);}}})[_0xc7bf('0x21')](handleError(_0x15d7d1,null));};exports[_0xc7bf('0xac')]=function(_0x48c31b,_0x5a5efa){var _0x17cb07=_0x48c31b[_0xc7bf('0x4d')]['id'];var _0x22fce4=_0x48c31b[_0xc7bf('0x4f')];var _0x586d6e=0xc8;var _0x2c290b=null;return db['sequelize'][_0xc7bf('0xad')]({'isolationLevel':db[_0xc7bf('0xae')][_0xc7bf('0xaf')]['ISOLATION_LEVELS'][_0xc7bf('0xb0')]},function(_0x45286c){return db[_0xc7bf('0x37')][_0xc7bf('0x5b')]({'where':{'id':_0x17cb07},'transaction':_0x45286c})[_0xc7bf('0x1a')](function(_0x4d42eb){if(_0x4d42eb){return db[_0xc7bf('0xb1')][_0xc7bf('0x2d')]({'where':{'SmsAccountId':_0x17cb07},'transaction':_0x45286c})['then'](function(){var _0x1f30fd=_[_0xc7bf('0x36')](_0x22fce4,function(_0x35bcb4){_0x35bcb4[_0xc7bf('0x58')]=_0x17cb07;return _0x35bcb4;});return db[_0xc7bf('0xb1')][_0xc7bf('0xb2')](_0x1f30fd,{'transaction':_0x45286c});});}else{_0x586d6e=0x194;_0x2c290b=[];}});})[_0xc7bf('0x1a')](function(){if(_0x586d6e!==0x194){return db['SmsApplication'][_0xc7bf('0xb3')]({'where':{'SmsAccountId':_0x17cb07},'order':_0xc7bf('0x6a')})['then'](function(_0x26a389){_0x2c290b=_0x26a389;});}})['catch'](function(_0x3241d1){_0x586d6e=0x1f4;logger[_0xc7bf('0x1e')](_0x3241d1['stack']);if(_0x3241d1['name']){delete _0x3241d1[_0xc7bf('0x31')];}_0x2c290b=_0x3241d1;})[_0xc7bf('0xb4')](function(){if(_0x2c290b===null){_0x5a5efa[_0xc7bf('0x22')](_0x586d6e);}else{if(_0x586d6e===0x1f4){_0x5a5efa[_0xc7bf('0x23')](_0x586d6e)['send'](_0x2c290b);}else{_0x5a5efa[_0xc7bf('0x23')](_0x586d6e)[_0xc7bf('0x25')](_0x2c290b);}}});};exports[_0xc7bf('0xb5')]=function(_0x436303,_0x3e8a0c,_0x5b35d8){var _0x5ef44c={};var _0x28b1b8={};var _0x59e737;var _0x4540e4;return db[_0xc7bf('0x37')][_0xc7bf('0x5b')]({'where':{'id':_0x436303[_0xc7bf('0x4d')]['id']}})[_0xc7bf('0x1a')](handleEntityNotFound(_0x3e8a0c,null))[_0xc7bf('0x1a')](function(_0x104696){if(_0x104696){_0x59e737=_0x104696;_0x28b1b8[_0xc7bf('0x3b')]=_['keys'](db[_0xc7bf('0xb1')]['rawAttributes']);_0x28b1b8[_0xc7bf('0x3c')]=_[_0xc7bf('0x3d')](_0x436303['query']);_0x28b1b8[_0xc7bf('0x3e')]=_['intersection'](_0x28b1b8['model'],_0x28b1b8['query']);_0x5ef44c[_0xc7bf('0x3f')]=_[_0xc7bf('0x40')](_0x28b1b8[_0xc7bf('0x3b')],qs[_0xc7bf('0x41')](_0x436303['query'][_0xc7bf('0x41')]));_0x5ef44c[_0xc7bf('0x3f')]=_0x5ef44c['attributes'][_0xc7bf('0x5c')]?_0x5ef44c[_0xc7bf('0x3f')]:_0x28b1b8[_0xc7bf('0x3b')];_0x5ef44c[_0xc7bf('0x43')]=qs[_0xc7bf('0x44')](_0x436303[_0xc7bf('0x3c')]['sort']);_0x5ef44c[_0xc7bf('0x45')]=qs[_0xc7bf('0x3e')](_[_0xc7bf('0x5d')](_0x436303[_0xc7bf('0x3c')],_0x28b1b8['filters']));if(_0x436303['query'][_0xc7bf('0x46')]){_0x5ef44c[_0xc7bf('0x45')]=_[_0xc7bf('0x47')](_0x5ef44c[_0xc7bf('0x45')],{'$or':_[_0xc7bf('0x36')](_0x5ef44c[_0xc7bf('0x3f')],function(_0x2da815){var _0x10bf26={};_0x10bf26[_0x2da815]={'$like':'%'+_0x436303[_0xc7bf('0x3c')]['filter']+'%'};return _0x10bf26;})});}_0x5ef44c=_['merge']({},_0x5ef44c,_0x436303['options']);return _0x59e737[_0xc7bf('0xb5')](_0x5ef44c);}})[_0xc7bf('0x1a')](function(_0x537122){if(_0x537122){_0x4540e4=_0x537122[_0xc7bf('0x5c')];if(!_0x436303[_0xc7bf('0x3c')][_0xc7bf('0x42')](_0xc7bf('0x63'))){_0x5ef44c[_0xc7bf('0x27')]=qs[_0xc7bf('0x27')](_0x436303[_0xc7bf('0x3c')][_0xc7bf('0x27')]);_0x5ef44c[_0xc7bf('0x26')]=qs[_0xc7bf('0x26')](_0x436303[_0xc7bf('0x3c')][_0xc7bf('0x26')]);}return _0x59e737[_0xc7bf('0xb5')](_0x5ef44c);}})['then'](function(_0x40bd6d){if(_0x40bd6d){return _0x40bd6d?{'count':_0x4540e4,'rows':_0x40bd6d}:null;}})['then'](respondWithResult(_0x3e8a0c,null))[_0xc7bf('0x21')](handleError(_0x3e8a0c,null));};exports['getInteractions']=function(_0x373c87,_0xd31e1f,_0x5d9fd6){var _0x4158a9={'raw':![],'where':{}};var _0x5c9107={};var _0x532acb={'count':0x0,'rows':[]};return db[_0xc7bf('0x37')]['findOne']({'where':{'id':_0x373c87['params']['id']}})['then'](handleEntityNotFound(_0xd31e1f,null))[_0xc7bf('0x1a')](function(_0x239548){if(_0x239548){_0x5c9107['model']=_[_0xc7bf('0x3d')](db[_0xc7bf('0x93')][_0xc7bf('0x38')]);_0x5c9107[_0xc7bf('0x3c')]=_[_0xc7bf('0x3d')](_0x373c87[_0xc7bf('0x3c')]);_0x5c9107[_0xc7bf('0x3e')]=_[_0xc7bf('0x40')](_0x5c9107[_0xc7bf('0x3b')],_0x5c9107[_0xc7bf('0x3c')]);_0x4158a9[_0xc7bf('0x3f')]=_[_0xc7bf('0x40')](_0x5c9107['model'],qs[_0xc7bf('0x41')](_0x373c87[_0xc7bf('0x3c')][_0xc7bf('0x41')]));_0x4158a9[_0xc7bf('0x3f')]=_0x4158a9['attributes']['length']?_0x4158a9['attributes']:_0x5c9107['model'];if(!_0x373c87[_0xc7bf('0x3c')][_0xc7bf('0x42')](_0xc7bf('0x63'))){_0x4158a9['limit']=qs[_0xc7bf('0x27')](_0x373c87[_0xc7bf('0x3c')][_0xc7bf('0x27')]);_0x4158a9[_0xc7bf('0x26')]=qs[_0xc7bf('0x26')](_0x373c87[_0xc7bf('0x3c')][_0xc7bf('0x26')]);}_0x4158a9[_0xc7bf('0x43')]=qs['sort'](_0x373c87['query'][_0xc7bf('0x44')]);_0x4158a9['where']=qs['filters'](_['pick'](_0x373c87['query'],_0x5c9107[_0xc7bf('0x3e')]));_0x4158a9['where'][_0xc7bf('0x58')]=_0x239548['id'];if(_0x373c87[_0xc7bf('0x3c')][_0xc7bf('0x46')]){_0x4158a9['where']=_[_0xc7bf('0x47')](_0x4158a9[_0xc7bf('0x45')],{'$or':_[_0xc7bf('0x36')](_0x4158a9[_0xc7bf('0x3f')],function(_0x3bf94d){var _0x3259a7={};_0x3259a7[_0x3bf94d]={'$like':'%'+_0x373c87['query'][_0xc7bf('0x46')]+'%'};return _0x3259a7;})});}_0x4158a9=_[_0xc7bf('0x47')]({},_0x4158a9,_0x373c87['options']);return db[_0xc7bf('0x93')][_0xc7bf('0x28')]({'where':_0x4158a9['where']})[_0xc7bf('0x1a')](function(_0x203c95){_0x532acb[_0xc7bf('0x28')]=_0x203c95;if(_0x373c87[_0xc7bf('0x3c')][_0xc7bf('0x5e')]){_0x4158a9[_0xc7bf('0x4a')]=[{'model':db[_0xc7bf('0x6c')],'as':_0xc7bf('0xb6'),'required':![]},{'model':db['User'],'as':_0xc7bf('0xb7'),'attributes':[_0xc7bf('0x31'),_0xc7bf('0xb8'),_0xc7bf('0xb9')],'required':![]},{'model':db[_0xc7bf('0xba')],'as':_0xc7bf('0xbb'),'attributes':['id',_0xc7bf('0x31'),_0xc7bf('0xbc')],'where':_0x373c87[_0xc7bf('0x3c')][_0xc7bf('0xbd')]?{'id':_0x373c87[_0xc7bf('0x3c')][_0xc7bf('0xbd')]}:undefined,'required':_0x373c87[_0xc7bf('0x3c')][_0xc7bf('0xbd')]?!![]:![]}];}return db[_0xc7bf('0x93')]['findAll'](_0x4158a9);})['then'](function(_0x470462){_0x532acb[_0xc7bf('0x4c')]=_0x470462;return _0x532acb;});}})[_0xc7bf('0x1a')](respondWithFilteredResult(_0xd31e1f,_0x4158a9))['catch'](handleError(_0xd31e1f,null));};exports[_0xc7bf('0x32')]=function(_0x35d645,_0x218f81,_0x5930f2){var _0x4bfae0,_0x4510ec,_0x2c8650;if(_[_0xc7bf('0x87')](_0x35d645['body'][_0xc7bf('0x4f')])||_0x35d645[_0xc7bf('0x4f')][_0xc7bf('0x4f')]===''){throw new db[(_0xc7bf('0x6d'))]['ValidationError'](_0xc7bf('0xbe'));}if(_[_0xc7bf('0x87')](_0x35d645[_0xc7bf('0x4f')]['to'])){throw new db[(_0xc7bf('0x6d'))][(_0xc7bf('0x6e'))](_0xc7bf('0xbf'));}_0x4bfae0=_0x35d645['body']['to'];return db[_0xc7bf('0x37')][_0xc7bf('0x52')]({'where':{'id':_0x35d645[_0xc7bf('0x4d')]['id']},'include':[{'model':db[_0xc7bf('0x8c')],'as':_0xc7bf('0xc0'),'include':[{'model':db['CmContact'],'as':_0xc7bf('0x8d'),'where':{'mobile':_0x4bfae0},'limit':0x1,'order':[[_0xc7bf('0x8e'),'DESC']]}]}]})[_0xc7bf('0x1a')](handleEntityNotFound(_0x218f81,null))[_0xc7bf('0x1a')](function(_0x56c1d1){if(_0x56c1d1&&_0x56c1d1['List']){_0x4510ec=_0x56c1d1[_0xc7bf('0x2e')]({'plain':!![]});if(_0x4510ec[_0xc7bf('0xc0')]&&_0x4510ec[_0xc7bf('0xc0')][_0xc7bf('0x8d')]['length']){return _0x4510ec[_0xc7bf('0xc0')]['Contacts'][0x0];}return db[_0xc7bf('0x6c')][_0xc7bf('0x4e')](_['defaults'](_0x35d645[_0xc7bf('0x4f')],{'firstName':_0x4bfae0,'mobile':_0x4bfae0,'phone':_0x4bfae0,'ListId':_0x4510ec['ListId']}));}})[_0xc7bf('0x1a')](handleEntityNotFound(_0x218f81,null))[_0xc7bf('0x1a')](function(_0x47b265){if(_0x47b265){_0x2c8650=_0x47b265;return db[_0xc7bf('0x93')]['find']({'where':{'ContactId':_0x2c8650['id'],'closed':![],'SmsAccountId':_0x4510ec['id']}})[_0xc7bf('0x1a')](function(_0x503f35){if(_0x503f35){return[_0x503f35,![]];}return db['SmsInteraction'][_0xc7bf('0x4e')]({'UserId':_0x35d645[_0xc7bf('0x50')]['id'],'ContactId':_0x2c8650['id'],'SmsAccountId':_0x4510ec['id'],'phone':_0x4bfae0,'firstMsgDirection':_0xc7bf('0xc1'),'Messages':[_[_0xc7bf('0x47')](_0x35d645['body'],{'read':![],'body':_0x35d645[_0xc7bf('0x4f')][_0xc7bf('0x4f')],'phone':_0x4bfae0,'SmsAccountId':_0x4510ec['id'],'UserId':_0x35d645[_0xc7bf('0x50')]['id'],'ContactId':_0x2c8650['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xc7bf('0xc2')}]})[_0xc7bf('0x1a')](function(_0xcab5c5){return[_0xcab5c5,!![]];});});}})[_0xc7bf('0x94')](function(_0x150b33,_0xb5b3ee){if(_0xb5b3ee){return _0x150b33;}return db[_0xc7bf('0x9c')][_0xc7bf('0x4e')](_['merge'](_0x35d645[_0xc7bf('0x4f')],{'read':![],'body':_0x35d645[_0xc7bf('0x4f')][_0xc7bf('0x4f')],'phone':_0x4bfae0,'SmsAccountId':_0x4510ec['id'],'SmsInteractionId':_0x150b33['id'],'UserId':_0x35d645[_0xc7bf('0x50')]['id'],'ContactId':_0x2c8650['id']}))[_0xc7bf('0x1a')](function(_0x1d4200){_0x150b33[_0xc7bf('0xc3')][_0xc7bf('0xc2')]=[];_0x150b33[_0xc7bf('0xc3')][_0xc7bf('0xc2')][_0xc7bf('0x97')](_0x1d4200[_0xc7bf('0xc3')]);return _0x150b33;});})[_0xc7bf('0x1a')](respondWithResult(_0x218f81,null))['catch'](handleError(_0x218f81,null));};exports[_0xc7bf('0x23')]=function(_0x19fc68,_0x452c6c,_0xe57d72){if(_0x19fc68['body']['id']){delete _0x19fc68[_0xc7bf('0x4f')]['id'];}var _0x5cae5f,_0x12f00a,_0x10df83;return db[_0xc7bf('0x37')][_0xc7bf('0x52')]({'where':{'id':_0x19fc68[_0xc7bf('0x4d')]['id']}})[_0xc7bf('0x1a')](handleEntityNotFound(_0x452c6c,null))[_0xc7bf('0x1a')](function(_0x1c070a){if(_0x1c070a){_0x10df83=_0x1c070a;logger[_0xc7bf('0xa5')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc7bf('0x23'),_0xc7bf('0xc4'),_0x1c070a[_0xc7bf('0x3a')],util[_0xc7bf('0xc5')](_0x19fc68[_0xc7bf('0x4f')],{'showHidden':![],'depth':null}));switch(_0x1c070a[_0xc7bf('0x3a')]){case _0xc7bf('0x79'):if(_0x19fc68[_0xc7bf('0x4f')]['skebby_dispatch_id']&&_0x19fc68[_0xc7bf('0x4f')][_0xc7bf('0x23')]){_0x12f00a=_0x19fc68[_0xc7bf('0x4f')][_0xc7bf('0x23')];return db[_0xc7bf('0x9c')][_0xc7bf('0x52')]({'where':{'messageId':_0x19fc68['body']['skebby_dispatch_id']}});}break;case _0xc7bf('0x7c'):if(_0x19fc68[_0xc7bf('0x4f')]['requestid']&&_0x19fc68[_0xc7bf('0x4f')][_0xc7bf('0xc6')]){_0x12f00a=_0x19fc68['body'][_0xc7bf('0xc6')];return db['SmsMessage'][_0xc7bf('0x52')]({'where':{'messageId':_0x19fc68[_0xc7bf('0x4f')][_0xc7bf('0xc7')]}});}break;case'clicksend':if(_0x19fc68[_0xc7bf('0x4f')]['message_id']&&_0x19fc68[_0xc7bf('0x4f')][_0xc7bf('0xc8')]){_0x12f00a=_0x19fc68[_0xc7bf('0x4f')]['status_code'];return db['SmsMessage']['find']({'where':{'messageId':_0x19fc68['body'][_0xc7bf('0x7e')]}});}break;case'infobip':var _0x18d950=_0x19fc68['body'][_0xc7bf('0x80')][0x0];if(_0x18d950[_0xc7bf('0x77')]&&_0x18d950[_0xc7bf('0x23')][_0xc7bf('0xc9')]===_0xc7bf('0xca')){_0x12f00a=_0x18d950['status'][_0xc7bf('0xc9')];return db[_0xc7bf('0x9c')][_0xc7bf('0x52')]({'where':{'messageId':_0x18d950['messageId']}});}break;case'clickatell':if(_0x19fc68[_0xc7bf('0x4f')][_0xc7bf('0x77')]&&_0x19fc68[_0xc7bf('0x4f')][_0xc7bf('0x23')]){_0x12f00a=_0x19fc68['body'][_0xc7bf('0x23')];return db[_0xc7bf('0x9c')][_0xc7bf('0x52')]({'where':{'messageId':_0x19fc68[_0xc7bf('0x4f')][_0xc7bf('0x77')]}});}break;case _0xc7bf('0x85'):if(_0x19fc68[_0xc7bf('0x4f')][0x0]['message']['id']){_0x12f00a=_0x19fc68['body'][0x0][_0xc7bf('0x3a')];return db[_0xc7bf('0x9c')][_0xc7bf('0x52')]({'where':{'messageId':_0x19fc68['body'][0x0]['message']['id']}});}break;case _0xc7bf('0xcb'):if(_0x19fc68[_0xc7bf('0x4f')]['redif']&&_0x19fc68['body']['status']){_0x12f00a=_0x19fc68[_0xc7bf('0x4f')][_0xc7bf('0x23')];return db[_0xc7bf('0x9c')][_0xc7bf('0x52')]({'where':{'messageId':_0x19fc68['body'][_0xc7bf('0xcc')]}});}break;}}})[_0xc7bf('0x1a')](handleEntityNotFound(_0x452c6c,null))[_0xc7bf('0x1a')](function(_0x42451d){if(_0x42451d){_0x5cae5f=_0x42451d;switch(_0x10df83['type']){case _0xc7bf('0x79'):if(_0x12f00a===_0xc7bf('0xca')){return _0x5cae5f[_0xc7bf('0x2c')]({'read':!![]});}else{logger[_0xc7bf('0x1e')](_0xc7bf('0xcd'),_0xc7bf('0x23'),'skebby',util[_0xc7bf('0xc5')](_0x19fc68[_0xc7bf('0x4f')],{'showHidden':![],'depth':null}));}break;case _0xc7bf('0x7c'):if(_0x12f00a==='1'){return _0x5cae5f['update']({'read':!![]});}else{logger[_0xc7bf('0x1e')](_0xc7bf('0xcd'),'status',_0xc7bf('0x79'),util[_0xc7bf('0xc5')](_0x19fc68[_0xc7bf('0x4f')],{'showHidden':![],'depth':null}));}break;case _0xc7bf('0x7d'):if(!_0x19fc68[_0xc7bf('0x4f')][_0xc7bf('0xce')]&&_0x12f00a>=0xc8&&_0x12f00a<=0xce){return _0x5cae5f[_0xc7bf('0x2c')]({'read':!![]});}else{logger[_0xc7bf('0x1e')](_0xc7bf('0xcd'),_0xc7bf('0x23'),_0xc7bf('0x7d'),util[_0xc7bf('0xc5')](_0x19fc68[_0xc7bf('0x4f')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x52839b=_0x19fc68[_0xc7bf('0x4f')][_0xc7bf('0x80')][0x0];if(_0x52839b[_0xc7bf('0x23')][_0xc7bf('0xc9')]==='DELIVERED'){return _0x5cae5f['update']({'read':!![]});}else{logger['error'](_0xc7bf('0xcd'),_0xc7bf('0x23'),_0xc7bf('0xcf'),util[_0xc7bf('0xc5')](_0x19fc68[_0xc7bf('0x4f')],{'showHidden':![],'depth':null}));}break;case _0xc7bf('0x83'):if(_0x12f00a=='DELIVERED_TO_GATEWAY'||_0x12f00a==_0xc7bf('0xd0')){return _0x5cae5f['update']({'read':!![]});}else{logger['error'](_0xc7bf('0xcd'),_0xc7bf('0x23'),_0xc7bf('0x83'),util[_0xc7bf('0xc5')](_0x19fc68[_0xc7bf('0x4f')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x12f00a==_0xc7bf('0xd1')){return _0x5cae5f[_0xc7bf('0x2c')]({'read':!![]});}else{logger['error'](_0xc7bf('0xcd'),'status',_0xc7bf('0x85'),util['inspect'](_0x19fc68[_0xc7bf('0x4f')],{'showHidden':![],'depth':null}));}break;case _0xc7bf('0xcb'):if(_0x12f00a==='DELIVRD'||_0x12f00a==='ACCEPTD'){return _0x5cae5f['update']({'read':!![]});}else{logger[_0xc7bf('0x1e')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc7bf('0x23'),_0xc7bf('0xcb'),util[_0xc7bf('0xc5')](_0x19fc68[_0xc7bf('0x4f')],{'showHidden':![],'depth':null}));}break;}return _0x5cae5f;}})['then'](respondWithResult(_0x452c6c,null))['catch'](handleError(_0x452c6c,null));};exports['statusGet']=function(_0x163423,_0xb5dce1,_0x303f54){var _0x5d7142,_0x12dffd,_0x4af238;return db[_0xc7bf('0x37')][_0xc7bf('0x52')]({'where':{'id':_0x163423[_0xc7bf('0x4d')]['id']}})[_0xc7bf('0x1a')](handleEntityNotFound(_0xb5dce1,null))[_0xc7bf('0x1a')](function(_0x365587){if(_0x365587){_0x4af238=_0x365587;logger[_0xc7bf('0xa5')](_0xc7bf('0xcd'),_0xc7bf('0x23'),'received\x20delivery\x20report\x20from',_0x365587[_0xc7bf('0x3a')],util[_0xc7bf('0xc5')](_0x163423[_0xc7bf('0x3c')],{'showHidden':![],'depth':null}));switch(_0x365587[_0xc7bf('0x3a')]){case'csc':if(_0x163423[_0xc7bf('0x3c')]['message-id']&&_0x163423[_0xc7bf('0x3c')][_0xc7bf('0xd2')]){_0x12dffd=_0x163423[_0xc7bf('0x3c')][_0xc7bf('0xd2')];return db['SmsMessage'][_0xc7bf('0x52')]({'where':{'messageId':_0x163423[_0xc7bf('0x3c')][_0xc7bf('0xd3')]}});}break;}}})[_0xc7bf('0x1a')](handleEntityNotFound(_0xb5dce1,null))[_0xc7bf('0x1a')](function(_0xf48458){if(_0xf48458){_0x5d7142=_0xf48458;switch(_0x4af238[_0xc7bf('0x3a')]){case _0xc7bf('0xd4'):if(_0x12dffd==='2'||_0x12dffd==='6'){return _0x5d7142[_0xc7bf('0x2c')]({'read':!![]});}else{logger[_0xc7bf('0x1e')](_0xc7bf('0xcd'),_0xc7bf('0x23'),'csc',util['inspect'](_0x163423['query'],{'showHidden':![],'depth':null}));};break;}return _0x5d7142;}})['then'](respondWithResult(_0xb5dce1,null))['catch'](handleError(_0xb5dce1,null));};exports['addAgents']=function(_0x2db53c,_0x5e7ee1,_0x258a48){return db[_0xc7bf('0x37')][_0xc7bf('0x52')]({'where':{'id':_0x2db53c[_0xc7bf('0x4d')]['id']}})[_0xc7bf('0x1a')](handleEntityNotFound(_0x5e7ee1,null))['then'](function(_0x23bab){if(_0x23bab){return _0x23bab['addAgents'](_0x2db53c[_0xc7bf('0x4f')][_0xc7bf('0x60')],_[_0xc7bf('0x91')](_0x2db53c[_0xc7bf('0x4f')],['ids','id'])||{})['spread'](function(_0xaf776f){for(var _0x2dacce=0x0;_0x2dacce<_0x2db53c[_0xc7bf('0x4f')][_0xc7bf('0x60')][_0xc7bf('0x5c')];_0x2dacce+=0x1){socket[_0xc7bf('0xd5')]('userSmsAccount:save',{'UserId':Number(_0x2db53c[_0xc7bf('0x4f')][_0xc7bf('0x60')][_0x2dacce]),'SmsAccountId':Number(_0x2db53c[_0xc7bf('0x4d')]['id'])});}return _0xaf776f;});}})[_0xc7bf('0x1a')](respondWithResult(_0x5e7ee1,null))['catch'](handleError(_0x5e7ee1,null));};exports[_0xc7bf('0xd6')]=function(_0x657e4a,_0x73e5ca,_0x3caa21){return db[_0xc7bf('0x37')][_0xc7bf('0x52')]({'where':{'id':_0x657e4a['params']['id']}})[_0xc7bf('0x1a')](handleEntityNotFound(_0x73e5ca,null))[_0xc7bf('0x1a')](function(_0x31b84f){if(_0x31b84f){return _0x31b84f[_0xc7bf('0xd6')](_0x657e4a[_0xc7bf('0x3c')][_0xc7bf('0x60')])[_0xc7bf('0x1a')](function(){if(_[_0xc7bf('0xd7')](_0x657e4a[_0xc7bf('0x3c')][_0xc7bf('0x60')])){for(var _0x5b17cb=0x0;_0x5b17cb<_0x657e4a[_0xc7bf('0x3c')][_0xc7bf('0x60')][_0xc7bf('0x5c')];_0x5b17cb+=0x1){socket[_0xc7bf('0xd5')]('userSmsAccount:remove',{'UserId':Number(_0x657e4a['query'][_0xc7bf('0x60')][_0x5b17cb]),'SmsAccountId':Number(_0x657e4a[_0xc7bf('0x4d')]['id'])});}}else{socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x657e4a[_0xc7bf('0x3c')][_0xc7bf('0x60')]),'SmsAccountId':Number(_0x657e4a[_0xc7bf('0x4d')]['id'])});}});}})[_0xc7bf('0x1a')](respondWithStatusCode(_0x73e5ca,null))[_0xc7bf('0x21')](handleError(_0x73e5ca,null));};exports[_0xc7bf('0xd8')]=function(_0x787ad3,_0x50557e,_0x404e45){var _0x2d4a6d={};var _0xd5e7df={};var _0x41bbf2;var _0x35c129;return db[_0xc7bf('0x37')][_0xc7bf('0x5b')]({'where':{'id':_0x787ad3[_0xc7bf('0x4d')]['id']}})[_0xc7bf('0x1a')](handleEntityNotFound(_0x50557e,null))[_0xc7bf('0x1a')](function(_0x47624e){if(_0x47624e){_0x41bbf2=_0x47624e;_0xd5e7df[_0xc7bf('0x3b')]=_[_0xc7bf('0x3d')](db[_0xc7bf('0x9f')][_0xc7bf('0x38')]);_0xd5e7df[_0xc7bf('0x3c')]=_[_0xc7bf('0x3d')](_0x787ad3['query']);_0xd5e7df[_0xc7bf('0x3e')]=_[_0xc7bf('0x40')](_0xd5e7df[_0xc7bf('0x3b')],_0xd5e7df[_0xc7bf('0x3c')]);_0x2d4a6d['attributes']=_[_0xc7bf('0x40')](_0xd5e7df[_0xc7bf('0x3b')],qs['fields'](_0x787ad3[_0xc7bf('0x3c')][_0xc7bf('0x41')]));_0x2d4a6d[_0xc7bf('0x3f')]=_0x2d4a6d[_0xc7bf('0x3f')][_0xc7bf('0x5c')]?_0x2d4a6d[_0xc7bf('0x3f')]:_0xd5e7df[_0xc7bf('0x3b')];_0x2d4a6d[_0xc7bf('0x43')]=qs[_0xc7bf('0x44')](_0x787ad3[_0xc7bf('0x3c')][_0xc7bf('0x44')]);_0x2d4a6d[_0xc7bf('0x45')]=qs[_0xc7bf('0x3e')](_[_0xc7bf('0x5d')](_0x787ad3[_0xc7bf('0x3c')],_0xd5e7df[_0xc7bf('0x3e')]));if(_0x787ad3[_0xc7bf('0x3c')][_0xc7bf('0x46')]){_0x2d4a6d[_0xc7bf('0x45')]=_[_0xc7bf('0x47')](_0x2d4a6d[_0xc7bf('0x45')],{'$or':_['map'](_0x2d4a6d[_0xc7bf('0x3f')],function(_0x568f50){var _0x2d87ec={};_0x2d87ec[_0x568f50]={'$like':'%'+_0x787ad3['query'][_0xc7bf('0x46')]+'%'};return _0x2d87ec;})});}_0x2d4a6d=_[_0xc7bf('0x47')]({},_0x2d4a6d,_0x787ad3[_0xc7bf('0x49')]);return _0x41bbf2[_0xc7bf('0xd8')](_0x2d4a6d);}})[_0xc7bf('0x1a')](function(_0xe86321){if(_0xe86321){_0x35c129=_0xe86321['length'];if(!_0x787ad3['query'][_0xc7bf('0x42')](_0xc7bf('0x63'))){_0x2d4a6d[_0xc7bf('0x27')]=qs[_0xc7bf('0x27')](_0x787ad3['query']['limit']);_0x2d4a6d['offset']=qs[_0xc7bf('0x26')](_0x787ad3[_0xc7bf('0x3c')][_0xc7bf('0x26')]);}return _0x41bbf2[_0xc7bf('0xd8')](_0x2d4a6d);}})[_0xc7bf('0x1a')](function(_0x435cb7){if(_0x435cb7){return _0x435cb7?{'count':_0x35c129,'rows':_0x435cb7}:null;}})[_0xc7bf('0x1a')](respondWithResult(_0x50557e,null))[_0xc7bf('0x21')](handleError(_0x50557e,null));}; \ No newline at end of file +var _0xb0c6=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','register','jayson/promise','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','destroy','UserProfileResource','name','send','Pause','mandatoryDispositionPause','map','rawAttributes','type','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SmsAccount','includeAll','include','findAll','rows','show','keys','intersection','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','account','applications','orderBy','Applications','priority','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','skebby','sender','text','connectel','clicksend','plivo','Text','MessageUUID','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','DESC','list','omit','contact','interaction','created','close','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','\x0a','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','stack','finally','getApplications','getInteractions','SmsInteraction','Contact','User','Owner','internal','Tag','Tags','color','tag','List','out','SmsMessage','Messages','spread','dataValues','push','skebby_dispatch_id','requestid','statusInt','message_id','status_code','infobip','groupName','DELIVERED','redif','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','state','message-id','addAgents','emit','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse'];(function(_0x1b8946,_0x20952d){var _0x218c25=function(_0x1d911f){while(--_0x1d911f){_0x1b8946['push'](_0x1b8946['shift']());}};_0x218c25(++_0x20952d);}(_0xb0c6,0xd4));var _0x6b0c=function(_0x35304e,_0x2148d2){_0x35304e=_0x35304e-0x0;var _0x243975=_0xb0c6[_0x35304e];return _0x243975;};'use strict';var emlformat=require(_0x6b0c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6b0c('0x1'));var rp=require(_0x6b0c('0x2'));var moment=require(_0x6b0c('0x3'));var BPromise=require(_0x6b0c('0x4'));var Mustache=require(_0x6b0c('0x5'));var util=require(_0x6b0c('0x6'));var path=require('path');var sox=require(_0x6b0c('0x7'));var csv=require(_0x6b0c('0x8'));var ejs=require(_0x6b0c('0x9'));var fs=require('fs');var fs_extra=require(_0x6b0c('0xa'));var _=require(_0x6b0c('0xb'));var squel=require(_0x6b0c('0xc'));var crypto=require(_0x6b0c('0xd'));var jsforce=require(_0x6b0c('0xe'));var deskjs=require(_0x6b0c('0xf'));var toCsv=require(_0x6b0c('0x8'));var querystring=require('querystring');var Papa=require(_0x6b0c('0x10'));var Redis=require('ioredis');var authService=require(_0x6b0c('0x11'));var qs=require(_0x6b0c('0x12'));var as=require(_0x6b0c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b0c('0x14'))('api');var utils=require(_0x6b0c('0x15'));var config=require(_0x6b0c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6b0c('0x17'))['db'];config['redis']=_[_0x6b0c('0x18')](config[_0x6b0c('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x6b0c('0x1a'))(new Redis(config['redis']));require('./smsAccount.socket')[_0x6b0c('0x1b')](socket);var jayson=require(_0x6b0c('0x1c'));var client=jayson['client'][_0x6b0c('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x34fc44,_0x6e77d2,_0x413bd3,_0x1b4438){return new BPromise(function(_0x2b55c8,_0x12aa2d){var _0x453a43=_0x1b4438||client;return _0x453a43[_0x6b0c('0x1e')](_0x34fc44,_0x413bd3)[_0x6b0c('0x1f')](function(_0x469c73){logger[_0x6b0c('0x20')](_0x6b0c('0x21'),_0x6e77d2,_0x6b0c('0x22'));logger[_0x6b0c('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6e77d2,_0x6b0c('0x22'),JSON[_0x6b0c('0x24')](_0x469c73));if(_0x469c73[_0x6b0c('0x25')]){if(_0x469c73['error'][_0x6b0c('0x26')]===0x1f4){logger[_0x6b0c('0x25')]('SmsAccount,\x20%s,\x20%s',_0x6e77d2,_0x469c73[_0x6b0c('0x25')][_0x6b0c('0x27')]);return _0x12aa2d(_0x469c73[_0x6b0c('0x25')][_0x6b0c('0x27')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x6e77d2,_0x469c73[_0x6b0c('0x25')][_0x6b0c('0x27')]);return _0x2b55c8(_0x469c73[_0x6b0c('0x25')][_0x6b0c('0x27')]);}else{logger[_0x6b0c('0x20')](_0x6b0c('0x21'),_0x6e77d2,_0x6b0c('0x22'));_0x2b55c8(_0x469c73[_0x6b0c('0x28')][_0x6b0c('0x27')]);}})[_0x6b0c('0x29')](function(_0x31953c){logger[_0x6b0c('0x25')](_0x6b0c('0x21'),_0x6e77d2,_0x31953c);_0x12aa2d(_0x31953c);});});}function respondWithStatusCode(_0x28868b,_0x21f459){_0x21f459=_0x21f459||0xcc;return function(_0x5019f3){if(_0x5019f3){return _0x28868b[_0x6b0c('0x2a')](_0x21f459);}return _0x28868b[_0x6b0c('0x2b')](_0x21f459)[_0x6b0c('0x2c')]();};}function respondWithResult(_0x345ee4,_0x54a844){_0x54a844=_0x54a844||0xc8;return function(_0x526253){if(_0x526253){return _0x345ee4[_0x6b0c('0x2b')](_0x54a844)[_0x6b0c('0x2d')](_0x526253);}};}function respondWithFilteredResult(_0x3df708,_0x456615){return function(_0x390fa6){if(_0x390fa6){var _0x322a8a=typeof _0x456615[_0x6b0c('0x2e')]===_0x6b0c('0x2f')&&typeof _0x456615[_0x6b0c('0x30')]===_0x6b0c('0x2f');var _0x3691f0=_0x390fa6['count'];var _0x13427e=_0x322a8a?0x0:_0x456615[_0x6b0c('0x2e')];var _0x538f63=_0x322a8a?_0x390fa6[_0x6b0c('0x31')]:_0x456615['offset']+_0x456615[_0x6b0c('0x30')];var _0x454501;if(_0x538f63>=_0x3691f0){_0x538f63=_0x3691f0;_0x454501=0xc8;}else{_0x454501=0xce;}_0x3df708[_0x6b0c('0x2b')](_0x454501);return _0x3df708[_0x6b0c('0x32')]('Content-Range',_0x13427e+'-'+_0x538f63+'/'+_0x3691f0)['json'](_0x390fa6);}return null;};}function patchUpdates(_0x54e5fa){return function(_0x15d43d){try{jsonpatch['apply'](_0x15d43d,_0x54e5fa,!![]);}catch(_0x3b0b5d){return BPromise[_0x6b0c('0x33')](_0x3b0b5d);}return _0x15d43d['save']();};}function saveUpdates(_0x3095d8,_0xe4a67e){return function(_0x56e580){if(_0x56e580){return _0x56e580[_0x6b0c('0x34')](_0x3095d8)[_0x6b0c('0x1f')](function(_0x560c19){return _0x560c19;});}return null;};}function removeEntity(_0x5e0a83,_0x54807e){return function(_0x4d8e1d){if(_0x4d8e1d){return _0x4d8e1d[_0x6b0c('0x35')]()[_0x6b0c('0x1f')](function(){var _0x2c64df=_0x4d8e1d['get']({'plain':!![]});var _0x216323='SmsAccounts';return db[_0x6b0c('0x36')][_0x6b0c('0x35')]({'where':{'type':_0x216323,'resourceId':_0x2c64df['id']}})[_0x6b0c('0x1f')](function(){return _0x4d8e1d;});})['then'](function(){_0x5e0a83['status'](0xcc)[_0x6b0c('0x2c')]();});}};}function handleEntityNotFound(_0x5e8ccb,_0x4fa5df){return function(_0x45705a){if(!_0x45705a){_0x5e8ccb['sendStatus'](0x194);}return _0x45705a;};}function handleError(_0x13594f,_0x4ecec7){_0x4ecec7=_0x4ecec7||0x1f4;return function(_0x1fa346){logger['error'](_0x1fa346['stack']);if(_0x1fa346[_0x6b0c('0x37')]){delete _0x1fa346[_0x6b0c('0x37')];}_0x13594f[_0x6b0c('0x2b')](_0x4ecec7)[_0x6b0c('0x38')](_0x1fa346);};}exports['index']=function(_0x52d835,_0x49a928){var _0x2a5a97={'include':[{'model':db[_0x6b0c('0x39')],'as':_0x6b0c('0x3a')}]},_0x42e66b={},_0xc145a9={'count':0x0,'rows':[]};var _0x1558ae=_[_0x6b0c('0x3b')](db['SmsAccount'][_0x6b0c('0x3c')],function(_0x2e9338){return{'name':_0x2e9338['fieldName'],'type':_0x2e9338[_0x6b0c('0x3d')]['key']};});_0x42e66b[_0x6b0c('0x3e')]=_[_0x6b0c('0x3b')](_0x1558ae,_0x6b0c('0x37'));_0x42e66b[_0x6b0c('0x3f')]=_['keys'](_0x52d835[_0x6b0c('0x3f')]);_0x42e66b[_0x6b0c('0x40')]=_['intersection'](_0x42e66b['model'],_0x42e66b[_0x6b0c('0x3f')]);_0x2a5a97[_0x6b0c('0x41')]=_['intersection'](_0x42e66b[_0x6b0c('0x3e')],qs[_0x6b0c('0x42')](_0x52d835[_0x6b0c('0x3f')][_0x6b0c('0x42')]));_0x2a5a97[_0x6b0c('0x41')]=_0x2a5a97['attributes'][_0x6b0c('0x43')]?_0x2a5a97[_0x6b0c('0x41')]:_0x42e66b['model'];if(!_0x52d835[_0x6b0c('0x3f')][_0x6b0c('0x44')](_0x6b0c('0x45'))){_0x2a5a97[_0x6b0c('0x30')]=qs[_0x6b0c('0x30')](_0x52d835[_0x6b0c('0x3f')]['limit']);_0x2a5a97[_0x6b0c('0x2e')]=qs['offset'](_0x52d835[_0x6b0c('0x3f')][_0x6b0c('0x2e')]);}_0x2a5a97[_0x6b0c('0x46')]=qs[_0x6b0c('0x47')](_0x52d835[_0x6b0c('0x3f')][_0x6b0c('0x47')]);_0x2a5a97[_0x6b0c('0x48')]=qs[_0x6b0c('0x40')](_[_0x6b0c('0x49')](_0x52d835[_0x6b0c('0x3f')],_0x42e66b['filters']),_0x1558ae);if(_0x52d835['query'][_0x6b0c('0x4a')]){_0x2a5a97[_0x6b0c('0x48')]=_[_0x6b0c('0x4b')](_0x2a5a97[_0x6b0c('0x48')],{'$or':_[_0x6b0c('0x3b')](_0x1558ae,function(_0x502bca){if(_0x502bca[_0x6b0c('0x3d')]!==_0x6b0c('0x4c')){var _0x432930={};_0x432930[_0x502bca[_0x6b0c('0x37')]]={'$like':'%'+_0x52d835[_0x6b0c('0x3f')][_0x6b0c('0x4a')]+'%'};return _0x432930;}})});}_0x2a5a97=_[_0x6b0c('0x4b')]({},_0x2a5a97,_0x52d835[_0x6b0c('0x4d')]);var _0x1c0b3b={'where':_0x2a5a97[_0x6b0c('0x48')]};return db[_0x6b0c('0x4e')][_0x6b0c('0x31')](_0x1c0b3b)[_0x6b0c('0x1f')](function(_0x39c6e){_0xc145a9[_0x6b0c('0x31')]=_0x39c6e;if(_0x52d835[_0x6b0c('0x3f')][_0x6b0c('0x4f')]){_0x2a5a97[_0x6b0c('0x50')]=[{'all':!![]}];}return db['SmsAccount'][_0x6b0c('0x51')](_0x2a5a97);})['then'](function(_0x399e2b){_0xc145a9[_0x6b0c('0x52')]=_0x399e2b;return _0xc145a9;})[_0x6b0c('0x1f')](respondWithFilteredResult(_0x49a928,_0x2a5a97))[_0x6b0c('0x29')](handleError(_0x49a928,null));};exports[_0x6b0c('0x53')]=function(_0x11c5f6,_0x1fbe5f){var _0x109e1f={'raw':![],'where':{'id':_0x11c5f6['params']['id']},'include':[{'model':db[_0x6b0c('0x39')],'as':'mandatoryDispositionPause'}]},_0xc1e04a={};_0xc1e04a[_0x6b0c('0x3e')]=_[_0x6b0c('0x54')](db['SmsAccount'][_0x6b0c('0x3c')]);_0xc1e04a[_0x6b0c('0x3f')]=_[_0x6b0c('0x54')](_0x11c5f6[_0x6b0c('0x3f')]);_0xc1e04a['filters']=_['intersection'](_0xc1e04a[_0x6b0c('0x3e')],_0xc1e04a[_0x6b0c('0x3f')]);_0x109e1f[_0x6b0c('0x41')]=_[_0x6b0c('0x55')](_0xc1e04a[_0x6b0c('0x3e')],qs[_0x6b0c('0x42')](_0x11c5f6[_0x6b0c('0x3f')][_0x6b0c('0x42')]));_0x109e1f['attributes']=_0x109e1f['attributes'][_0x6b0c('0x43')]?_0x109e1f[_0x6b0c('0x41')]:_0xc1e04a['model'];if(_0x11c5f6[_0x6b0c('0x3f')][_0x6b0c('0x4f')]){_0x109e1f['include']=[{'all':!![]}];}_0x109e1f=_['merge']({},_0x109e1f,_0x11c5f6['options']);return db['SmsAccount'][_0x6b0c('0x56')](_0x109e1f)[_0x6b0c('0x1f')](handleEntityNotFound(_0x1fbe5f,null))[_0x6b0c('0x1f')](respondWithResult(_0x1fbe5f,null))[_0x6b0c('0x29')](handleError(_0x1fbe5f,null));};exports[_0x6b0c('0x57')]=function(_0x548fa1,_0x2f9fc5){return db[_0x6b0c('0x4e')]['create'](_0x548fa1[_0x6b0c('0x58')],{})[_0x6b0c('0x1f')](function(_0x3910ab){var _0x3d93f4=_0x548fa1[_0x6b0c('0x59')][_0x6b0c('0x5a')]({'plain':!![]});if(!_0x3d93f4)throw new Error(_0x6b0c('0x5b'));if(_0x3d93f4[_0x6b0c('0x5c')]===_0x6b0c('0x59')){var _0x315ef4=_0x3910ab['get']({'plain':!![]});var _0x3f6f80='SmsAccounts';return db[_0x6b0c('0x5d')][_0x6b0c('0x56')]({'where':{'name':_0x3f6f80,'userProfileId':_0x3d93f4['userProfileId']},'raw':!![]})['then'](function(_0x1331fa){if(_0x1331fa&&_0x1331fa['autoAssociation']===0x0){return db[_0x6b0c('0x36')][_0x6b0c('0x57')]({'name':_0x315ef4[_0x6b0c('0x37')],'resourceId':_0x315ef4['id'],'type':_0x1331fa[_0x6b0c('0x37')],'sectionId':_0x1331fa['id']},{})[_0x6b0c('0x1f')](function(){return _0x3910ab;});}else{return _0x3910ab;}})[_0x6b0c('0x29')](function(_0x4fdec4){logger[_0x6b0c('0x25')](_0x6b0c('0x5e'),_0x4fdec4);throw _0x4fdec4;});}return _0x3910ab;})[_0x6b0c('0x1f')](respondWithResult(_0x2f9fc5,0xc9))[_0x6b0c('0x29')](handleError(_0x2f9fc5,null));};exports[_0x6b0c('0x34')]=function(_0x2dcbfc,_0x424595){if(_0x2dcbfc[_0x6b0c('0x58')]['id']){delete _0x2dcbfc['body']['id'];}return db['SmsAccount'][_0x6b0c('0x56')]({'where':{'id':_0x2dcbfc[_0x6b0c('0x5f')]['id']},'include':[{'model':db['Pause'],'as':_0x6b0c('0x3a')}]})['then'](handleEntityNotFound(_0x424595,null))[_0x6b0c('0x1f')](saveUpdates(_0x2dcbfc[_0x6b0c('0x58')],null))[_0x6b0c('0x1f')](respondWithResult(_0x424595,null))[_0x6b0c('0x29')](handleError(_0x424595,null));};exports[_0x6b0c('0x35')]=function(_0x35d902,_0x45e602){return db[_0x6b0c('0x4e')][_0x6b0c('0x56')]({'where':{'id':_0x35d902[_0x6b0c('0x5f')]['id']}})[_0x6b0c('0x1f')](handleEntityNotFound(_0x45e602,null))[_0x6b0c('0x1f')](removeEntity(_0x45e602,null))[_0x6b0c('0x29')](handleError(_0x45e602,null));};exports['describe']=function(_0x11b5cf,_0xe6b635){return db['SmsAccount']['describe']()[_0x6b0c('0x1f')](respondWithResult(_0xe6b635,null))[_0x6b0c('0x29')](handleError(_0xe6b635,null));};exports[_0x6b0c('0x60')]=function(_0x583bed,_0x3b015f,_0x402815){if(_0x583bed[_0x6b0c('0x58')]['id']){delete _0x583bed[_0x6b0c('0x58')]['id'];}return db[_0x6b0c('0x4e')][_0x6b0c('0x56')]({'where':{'id':_0x583bed[_0x6b0c('0x5f')]['id']}})[_0x6b0c('0x1f')](handleEntityNotFound(_0x3b015f,null))[_0x6b0c('0x1f')](function(_0x22d552){if(_0x22d552){_0x583bed[_0x6b0c('0x58')][_0x6b0c('0x61')]=_0x22d552['id'];return db[_0x6b0c('0x62')]['create'](_0x583bed[_0x6b0c('0x58')]);}})[_0x6b0c('0x1f')](respondWithResult(_0x3b015f,null))[_0x6b0c('0x29')](handleError(_0x3b015f,null));};exports[_0x6b0c('0x63')]=function(_0x298769,_0x22f50d,_0x335e45){var _0x4170bf={'raw':![],'where':{}};var _0x485024={};var _0x3e82fc={'count':0x0,'rows':[]};return db[_0x6b0c('0x4e')][_0x6b0c('0x64')]({'where':{'id':_0x298769[_0x6b0c('0x5f')]['id']}})['then'](handleEntityNotFound(_0x22f50d,null))[_0x6b0c('0x1f')](function(_0x7c522c){if(_0x7c522c){_0x485024['model']=_[_0x6b0c('0x54')](db['Disposition'][_0x6b0c('0x3c')]);_0x485024['query']=_['keys'](_0x298769[_0x6b0c('0x3f')]);_0x485024[_0x6b0c('0x40')]=_[_0x6b0c('0x55')](_0x485024['model'],_0x485024[_0x6b0c('0x3f')]);_0x4170bf[_0x6b0c('0x41')]=_[_0x6b0c('0x55')](_0x485024[_0x6b0c('0x3e')],qs[_0x6b0c('0x42')](_0x298769[_0x6b0c('0x3f')]['fields']));_0x4170bf['attributes']=_0x4170bf[_0x6b0c('0x41')][_0x6b0c('0x43')]?_0x4170bf[_0x6b0c('0x41')]:_0x485024[_0x6b0c('0x3e')];if(!_0x298769[_0x6b0c('0x3f')]['hasOwnProperty']('nolimit')){_0x4170bf[_0x6b0c('0x30')]=qs[_0x6b0c('0x30')](_0x298769['query'][_0x6b0c('0x30')]);_0x4170bf[_0x6b0c('0x2e')]=qs[_0x6b0c('0x2e')](_0x298769[_0x6b0c('0x3f')][_0x6b0c('0x2e')]);}_0x4170bf[_0x6b0c('0x46')]=qs[_0x6b0c('0x47')](_0x298769[_0x6b0c('0x3f')][_0x6b0c('0x47')]);_0x4170bf[_0x6b0c('0x48')]=qs['filters'](_[_0x6b0c('0x49')](_0x298769[_0x6b0c('0x3f')],_0x485024['filters']));_0x4170bf[_0x6b0c('0x48')][_0x6b0c('0x61')]=_0x7c522c['id'];if(_0x298769['query']['filter']){_0x4170bf[_0x6b0c('0x48')]=_[_0x6b0c('0x4b')](_0x4170bf['where'],{'$or':_[_0x6b0c('0x3b')](_0x4170bf[_0x6b0c('0x41')],function(_0x3ba462){var _0x232f77={};_0x232f77[_0x3ba462]={'$like':'%'+_0x298769['query'][_0x6b0c('0x4a')]+'%'};return _0x232f77;})});}_0x4170bf=_[_0x6b0c('0x4b')]({},_0x4170bf,_0x298769[_0x6b0c('0x4d')]);return db['Disposition'][_0x6b0c('0x31')]({'where':_0x4170bf[_0x6b0c('0x48')]})[_0x6b0c('0x1f')](function(_0x11bf05){_0x3e82fc[_0x6b0c('0x31')]=_0x11bf05;if(_0x298769[_0x6b0c('0x3f')]['includeAll']){_0x4170bf[_0x6b0c('0x50')]=[{'all':!![]}];}return db[_0x6b0c('0x62')]['findAll'](_0x4170bf);})[_0x6b0c('0x1f')](function(_0x6480d9){_0x3e82fc[_0x6b0c('0x52')]=_0x6480d9;return _0x3e82fc;});}})[_0x6b0c('0x1f')](respondWithFilteredResult(_0x22f50d,_0x4170bf))[_0x6b0c('0x29')](handleError(_0x22f50d,null));};exports[_0x6b0c('0x65')]=function(_0x74cbd0,_0x1d2981,_0x44d013){return db['SmsAccount'][_0x6b0c('0x56')]({'where':{'id':_0x74cbd0['params']['id']}})['then'](handleEntityNotFound(_0x1d2981,null))[_0x6b0c('0x1f')](function(_0x370375){if(_0x370375){return _0x370375[_0x6b0c('0x65')](_0x74cbd0[_0x6b0c('0x3f')][_0x6b0c('0x66')]);}})['then'](respondWithStatusCode(_0x1d2981,null))[_0x6b0c('0x29')](handleError(_0x1d2981,null));};exports[_0x6b0c('0x67')]=function(_0x2ab369,_0x4d7bd9,_0x4bf4bd){if(_0x2ab369['body']['id']){delete _0x2ab369[_0x6b0c('0x58')]['id'];}return db[_0x6b0c('0x4e')][_0x6b0c('0x56')]({'where':{'id':_0x2ab369['params']['id']}})[_0x6b0c('0x1f')](handleEntityNotFound(_0x4d7bd9,null))[_0x6b0c('0x1f')](function(_0x53dd03){if(_0x53dd03){_0x2ab369['body']['SmsAccountId']=_0x53dd03['id'];return db[_0x6b0c('0x68')][_0x6b0c('0x57')](_0x2ab369[_0x6b0c('0x58')]);}})['then'](respondWithResult(_0x4d7bd9,null))[_0x6b0c('0x29')](handleError(_0x4d7bd9,null));};exports[_0x6b0c('0x69')]=function(_0x5a408a,_0x344b2b,_0x480d54){var _0x328c82={'raw':![],'where':{}};var _0x4d58d2={};var _0x4fc733={'count':0x0,'rows':[]};return db['SmsAccount'][_0x6b0c('0x64')]({'where':{'id':_0x5a408a[_0x6b0c('0x5f')]['id']}})[_0x6b0c('0x1f')](handleEntityNotFound(_0x344b2b,null))[_0x6b0c('0x1f')](function(_0x3f9a2c){if(_0x3f9a2c){_0x4d58d2[_0x6b0c('0x3e')]=_['keys'](db[_0x6b0c('0x68')]['rawAttributes']);_0x4d58d2[_0x6b0c('0x3f')]=_[_0x6b0c('0x54')](_0x5a408a[_0x6b0c('0x3f')]);_0x4d58d2[_0x6b0c('0x40')]=_['intersection'](_0x4d58d2[_0x6b0c('0x3e')],_0x4d58d2[_0x6b0c('0x3f')]);_0x328c82[_0x6b0c('0x41')]=_[_0x6b0c('0x55')](_0x4d58d2['model'],qs[_0x6b0c('0x42')](_0x5a408a[_0x6b0c('0x3f')][_0x6b0c('0x42')]));_0x328c82[_0x6b0c('0x41')]=_0x328c82[_0x6b0c('0x41')][_0x6b0c('0x43')]?_0x328c82[_0x6b0c('0x41')]:_0x4d58d2[_0x6b0c('0x3e')];if(!_0x5a408a[_0x6b0c('0x3f')][_0x6b0c('0x44')](_0x6b0c('0x45'))){_0x328c82['limit']=qs[_0x6b0c('0x30')](_0x5a408a[_0x6b0c('0x3f')][_0x6b0c('0x30')]);_0x328c82[_0x6b0c('0x2e')]=qs[_0x6b0c('0x2e')](_0x5a408a[_0x6b0c('0x3f')][_0x6b0c('0x2e')]);}_0x328c82[_0x6b0c('0x46')]=qs['sort'](_0x5a408a[_0x6b0c('0x3f')][_0x6b0c('0x47')]);_0x328c82[_0x6b0c('0x48')]=qs[_0x6b0c('0x40')](_[_0x6b0c('0x49')](_0x5a408a[_0x6b0c('0x3f')],_0x4d58d2['filters']));_0x328c82[_0x6b0c('0x48')][_0x6b0c('0x61')]=_0x3f9a2c['id'];if(_0x5a408a['query'][_0x6b0c('0x4a')]){_0x328c82[_0x6b0c('0x48')]=_[_0x6b0c('0x4b')](_0x328c82['where'],{'$or':_[_0x6b0c('0x3b')](_0x328c82[_0x6b0c('0x41')],function(_0x58a127){var _0xcaf642={};_0xcaf642[_0x58a127]={'$like':'%'+_0x5a408a[_0x6b0c('0x3f')][_0x6b0c('0x4a')]+'%'};return _0xcaf642;})});}_0x328c82=_['merge']({},_0x328c82,_0x5a408a['options']);return db['CannedAnswer'][_0x6b0c('0x31')]({'where':_0x328c82[_0x6b0c('0x48')]})[_0x6b0c('0x1f')](function(_0x2e859c){_0x4fc733[_0x6b0c('0x31')]=_0x2e859c;if(_0x5a408a[_0x6b0c('0x3f')][_0x6b0c('0x4f')]){_0x328c82[_0x6b0c('0x50')]=[{'all':!![]}];}return db[_0x6b0c('0x68')][_0x6b0c('0x51')](_0x328c82);})[_0x6b0c('0x1f')](function(_0x150784){_0x4fc733[_0x6b0c('0x52')]=_0x150784;return _0x4fc733;});}})['then'](respondWithFilteredResult(_0x344b2b,_0x328c82))[_0x6b0c('0x29')](handleError(_0x344b2b,null));};exports['removeAnswers']=function(_0xcc8433,_0x464e10,_0x46613a){return db[_0x6b0c('0x4e')][_0x6b0c('0x56')]({'where':{'id':_0xcc8433[_0x6b0c('0x5f')]['id']}})[_0x6b0c('0x1f')](handleEntityNotFound(_0x464e10,null))['then'](function(_0x1a6b18){if(_0x1a6b18){return _0x1a6b18[_0x6b0c('0x6a')](_0xcc8433[_0x6b0c('0x3f')][_0x6b0c('0x66')]);}})[_0x6b0c('0x1f')](respondWithStatusCode(_0x464e10,null))[_0x6b0c('0x29')](handleError(_0x464e10,null));};exports[_0x6b0c('0x6b')]=function(_0xecab3f,_0x3da2e5,_0x1b1e24){var _0x199d11={'channel':_0x6b0c('0x6c')};var _0x128152=[];var _0x16a9e7=[];var _0x3e6207={};return db[_0x6b0c('0x4e')][_0x6b0c('0x56')]({'where':{'id':_0xecab3f[_0x6b0c('0x5f')]['id']},'include':[{'model':db[_0x6b0c('0x6d')],'as':'Applications'}]})[_0x6b0c('0x1f')](handleEntityNotFound(_0x3da2e5,null))[_0x6b0c('0x1f')](function(_0x34c787){_0x199d11[_0x6b0c('0x6e')]=_0x34c787;_0x199d11[_0x6b0c('0x6f')]=_[_0x6b0c('0x70')](_0x34c787[_0x6b0c('0x71')],[_0x6b0c('0x72')],[_0x6b0c('0x73')]);if(_0x199d11[_0x6b0c('0x6e')][_0x6b0c('0x71')]){delete _0x199d11[_0x6b0c('0x6e')][_0x6b0c('0x71')];}return db[_0x6b0c('0x74')]['describe']();})[_0x6b0c('0x1f')](function(_0x19d88f){if(!_0x19d88f){throw new db[(_0x6b0c('0x75'))]['ValidationError'](_0x6b0c('0x76'));}_0x128152=_[_0x6b0c('0x77')](_[_0x6b0c('0x54')](_0x19d88f),[_0x6b0c('0x78'),'updatedAt']);_0x16a9e7=_[_0x6b0c('0x77')](_['keys'](_0x19d88f),[_0x6b0c('0x78'),_0x6b0c('0x79'),_0x6b0c('0x7a'),_0x6b0c('0x7b')]);_0x199d11[_0x6b0c('0x58')]={'mapKey':_0x6b0c('0x7c')};if(_0x199d11['account'][_0x6b0c('0x3d')]){switch(_0x199d11[_0x6b0c('0x6e')][_0x6b0c('0x3d')]){case _0x6b0c('0x7d'):_0x199d11[_0x6b0c('0x58')][_0x6b0c('0x7e')]=_0xecab3f[_0x6b0c('0x58')][_0x6b0c('0x7f')];_0x199d11[_0x6b0c('0x58')][_0x6b0c('0x58')]=_0xecab3f[_0x6b0c('0x58')][_0x6b0c('0x80')];_0x199d11[_0x6b0c('0x58')][_0x6b0c('0x81')]=_0xecab3f[_0x6b0c('0x58')]['MessageSid'];break;case _0x6b0c('0x82'):_0x199d11[_0x6b0c('0x58')][_0x6b0c('0x7e')]='+'+_0xecab3f['body'][_0x6b0c('0x83')];_0x199d11[_0x6b0c('0x58')][_0x6b0c('0x58')]=_0xecab3f['body'][_0x6b0c('0x84')];break;case _0x6b0c('0x85'):_0x199d11[_0x6b0c('0x58')]['from']=_0xecab3f['body']['from'];_0x199d11[_0x6b0c('0x58')]['body']=_0xecab3f[_0x6b0c('0x58')][_0x6b0c('0x27')];break;case _0x6b0c('0x86'):_0x199d11[_0x6b0c('0x58')][_0x6b0c('0x7e')]=_0xecab3f['body']['from'];_0x199d11['body'][_0x6b0c('0x58')]=_0xecab3f[_0x6b0c('0x58')][_0x6b0c('0x58')];_0x199d11[_0x6b0c('0x58')][_0x6b0c('0x81')]=_0xecab3f['body']['message_id'];break;case _0x6b0c('0x87'):_0x199d11[_0x6b0c('0x58')][_0x6b0c('0x7e')]=_0xecab3f[_0x6b0c('0x58')][_0x6b0c('0x7f')];_0x199d11[_0x6b0c('0x58')][_0x6b0c('0x58')]=_0xecab3f[_0x6b0c('0x58')][_0x6b0c('0x88')];_0x199d11['body']['messageId']=_0xecab3f[_0x6b0c('0x58')][_0x6b0c('0x89')];break;case'infobip':_0x199d11['body'][_0x6b0c('0x7e')]='+'+_0xecab3f[_0x6b0c('0x58')][_0x6b0c('0x8a')][0x0][_0x6b0c('0x7e')];_0x199d11[_0x6b0c('0x58')]['body']=_0xecab3f['body']['results'][0x0][_0x6b0c('0x84')];_0x199d11[_0x6b0c('0x58')][_0x6b0c('0x81')]=_0xecab3f['body'][_0x6b0c('0x8a')][0x0][_0x6b0c('0x81')];break;case _0x6b0c('0x8b'):_0x199d11[_0x6b0c('0x58')][_0x6b0c('0x7e')]=_0xecab3f[_0x6b0c('0x58')][_0x6b0c('0x8c')];_0x199d11[_0x6b0c('0x58')][_0x6b0c('0x58')]=_0xecab3f[_0x6b0c('0x58')][_0x6b0c('0x8d')]['message'];break;case _0x6b0c('0x8e'):_0x199d11[_0x6b0c('0x58')]['from']=_0xecab3f[_0x6b0c('0x58')][_0x6b0c('0x8f')];_0x199d11['body'][_0x6b0c('0x58')]=_0xecab3f[_0x6b0c('0x58')][_0x6b0c('0x84')];_0x199d11[_0x6b0c('0x58')]['messageId']=_0xecab3f['body'][_0x6b0c('0x90')];break;case _0x6b0c('0x91'):_0x199d11['body']['messageId']=_0xecab3f[_0x6b0c('0x58')][0x0][_0x6b0c('0x27')]['id'];_0x199d11[_0x6b0c('0x58')][_0x6b0c('0x7e')]=_0xecab3f['body'][0x0]['message']['from'];_0x199d11[_0x6b0c('0x58')][_0x6b0c('0x58')]=_0xecab3f[_0x6b0c('0x58')][0x0][_0x6b0c('0x27')][_0x6b0c('0x84')];break;case _0x6b0c('0x92'):_0x199d11[_0x6b0c('0x58')][_0x6b0c('0x7e')]=_0xecab3f[_0x6b0c('0x58')]['from'];_0x199d11[_0x6b0c('0x58')][_0x6b0c('0x58')]=_0xecab3f['body'][_0x6b0c('0x27')];_0x199d11[_0x6b0c('0x58')][_0x6b0c('0x81')]=_0xecab3f[_0x6b0c('0x58')][_0x6b0c('0x93')];break;}}if(_0x199d11[_0x6b0c('0x58')]['id']){delete _0x199d11['body']['id'];}if(_[_0x6b0c('0x94')](_0x199d11[_0x6b0c('0x58')]['from'])){throw new db['Sequelize'][(_0x6b0c('0x95'))](_0x6b0c('0x96'));}if(_[_0x6b0c('0x94')](_0x199d11[_0x6b0c('0x58')][_0x6b0c('0x58')])||_0x199d11[_0x6b0c('0x58')][_0x6b0c('0x58')]===''){throw new db[(_0x6b0c('0x75'))][(_0x6b0c('0x95'))](_0x6b0c('0x97'));}if(_[_0x6b0c('0x94')](_0x199d11['body'][_0x6b0c('0x98')])){throw new db[(_0x6b0c('0x75'))][(_0x6b0c('0x95'))](_0x6b0c('0x99')+_0x16a9e7);}if(!_[_0x6b0c('0x9a')](_0x16a9e7,_0x199d11[_0x6b0c('0x58')]['mapKey'])){throw new db[(_0x6b0c('0x75'))][(_0x6b0c('0x95'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x16a9e7);}_0x3e6207[_0x199d11[_0x6b0c('0x58')][_0x6b0c('0x98')]]=_0x199d11[_0x6b0c('0x58')][_0x6b0c('0x7e')];return db[_0x6b0c('0x9b')][_0x6b0c('0x56')]({'where':{'id':_0x199d11[_0x6b0c('0x6e')][_0x6b0c('0x7b')]},'include':[{'model':db[_0x6b0c('0x74')],'as':_0x6b0c('0x9c'),'where':_0x3e6207,'limit':0x1,'order':[[_0x6b0c('0x79'),_0x6b0c('0x9d')]]}]});})[_0x6b0c('0x1f')](handleEntityNotFound(_0x3da2e5,null))['then'](function(_0x5281ad){if(_0x5281ad){_0x199d11[_0x6b0c('0x9e')]=_[_0x6b0c('0x9f')](_0x5281ad,['Contacts']);if(_0x5281ad[_0x6b0c('0x9c')]['length']){return _0x5281ad[_0x6b0c('0x9c')][0x0];}var _0x20301d=_[_0x6b0c('0x18')](_0x199d11[_0x6b0c('0x58')],{'firstName':_0x199d11[_0x6b0c('0x58')][_0x6b0c('0x7e')],'ListId':_0x5281ad['id']});_0x20301d[_0x199d11[_0x6b0c('0x58')][_0x6b0c('0x98')]]=_0x199d11[_0x6b0c('0x58')][_0x6b0c('0x7e')];return db[_0x6b0c('0x74')][_0x6b0c('0x57')](_0x20301d,{'fields':_0x128152,'raw':!![]});}})[_0x6b0c('0x1f')](handleEntityNotFound(_0x3da2e5,null))[_0x6b0c('0x1f')](function(_0x3371f2){if(_0x3371f2){_0x199d11[_0x6b0c('0xa0')]=_0x3371f2;var _0xa12884={'ContactId':_0x3371f2['id'],'phone':_0x199d11[_0x6b0c('0x58')]['from'],'SmsAccountId':_0xecab3f[_0x6b0c('0x5f')]['id']};var _0x352956={'ContactId':_0x3371f2['id'],'SmsAccountId':_0xecab3f[_0x6b0c('0x5f')]['id'],'closed':![]};return db['SmsInteraction']['find']({'where':_0x352956})[_0x6b0c('0x1f')](function(_0x1049a5){if(_0x1049a5){return[_0x1049a5,![]];}return db['SmsInteraction'][_0x6b0c('0x57')](_0xa12884)[_0x6b0c('0x1f')](function(_0x7b1194){return[_0x7b1194,!![]];});});}})['spread'](function(_0x4883fe,_0x361e11){_0x199d11[_0x6b0c('0xa1')]=_0x4883fe[_0x6b0c('0x5a')]({'plain':!![]});_0x199d11[_0x6b0c('0xa1')][_0x6b0c('0xa2')]=![];if(_0x361e11){if(_0x199d11[_0x6b0c('0x6e')]['autoclose']){_0x199d11[_0x6b0c('0x6f')]['push']({'id':0x0,'priority':_0x199d11['applications'][_0x6b0c('0x43')]+0x1,'app':_0x6b0c('0xa3'),'appdata':_0x6b0c('0xa4'),'interval':_0x6b0c('0xa5')});}_0x199d11['interaction'][_0x6b0c('0xa2')]=!![];}return db['SmsMessage'][_0x6b0c('0x57')]({'phone':_0x199d11[_0x6b0c('0x58')]['from'],'messageId':_0x199d11['body'][_0x6b0c('0x81')],'body':_0x199d11[_0x6b0c('0x58')]['body'],'SmsAccountId':_0xecab3f[_0x6b0c('0x5f')]['id'],'SmsInteractionId':_0x4883fe['id'],'direction':'in','ContactId':_0x4883fe['ContactId'],'AttachmentId':_0x199d11[_0x6b0c('0x58')][_0x6b0c('0xa6')]});})['then'](function(_0x4b15dc){_0x199d11[_0x6b0c('0x27')]=_0x4b15dc;if(_0x199d11['interaction'][_0x6b0c('0xa7')]){return db['User']['find']({'attributes':['id',_0x6b0c('0x37')],'where':{'id':_0x199d11[_0x6b0c('0xa1')][_0x6b0c('0xa7')]}})[_0x6b0c('0x1f')](function(_0xca5011){if(_0xca5011){_0x199d11[_0x6b0c('0x6f')][_0x6b0c('0xa8')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xca5011['name']+','+(_0x199d11['account']['waitForTheAssignedAgent']||0xa),'interval':_0x6b0c('0xa5')});}return respondWithRpcPromise(_0x6b0c('0xa9'),_0x6b0c('0xaa'),_0x199d11);});}return respondWithRpcPromise(_0x6b0c('0xa9'),_0x6b0c('0xaa'),_0x199d11);})[_0x6b0c('0x1f')](function(_0x2a9223){if(_0x2a9223){var _0x29f97a=0xc8;var _0x2c8335=_0x6b0c('0xab');logger[_0x6b0c('0x20')](_0x6b0c('0xac'),_0x2c8335,_0x29f97a,_0x6b0c('0xad'));logger[_0x6b0c('0x23')](_0x6b0c('0xae'),_0x2c8335,_0x29f97a,'entity\x20found',JSON[_0x6b0c('0x24')](_0x2a9223));if(_0x199d11['account'][_0x6b0c('0x3d')]===_0x6b0c('0x7d')){return _0x3da2e5[_0x6b0c('0x2b')](_0x29f97a)[_0x6b0c('0x32')]('Content-Type',_0x6b0c('0xaf'))[_0x6b0c('0x38')](_0x6b0c('0xb0'));}else{return _0x3da2e5[_0x6b0c('0x2b')](_0x29f97a)[_0x6b0c('0x2d')](_0x2a9223);}}})['catch'](handleError(_0x3da2e5,null));};exports['addApplications']=function(_0x6a73cd,_0x4910e2){var _0x58d0dd=_0x6a73cd[_0x6b0c('0x5f')]['id'];var _0x405cd5=_0x6a73cd[_0x6b0c('0x58')];var _0xa3798a=0xc8;var _0x25bd33=null;return db[_0x6b0c('0xb1')][_0x6b0c('0xb2')]({'isolationLevel':db[_0x6b0c('0xb1')]['Transaction'][_0x6b0c('0xb3')][_0x6b0c('0xb4')]},function(_0x4ba24a){return db[_0x6b0c('0x4e')][_0x6b0c('0x64')]({'where':{'id':_0x58d0dd},'transaction':_0x4ba24a})[_0x6b0c('0x1f')](function(_0x22ae2c){if(_0x22ae2c){return db[_0x6b0c('0x6d')][_0x6b0c('0x35')]({'where':{'SmsAccountId':_0x58d0dd},'transaction':_0x4ba24a})[_0x6b0c('0x1f')](function(){var _0x57e746=_[_0x6b0c('0x3b')](_0x405cd5,function(_0x1b56d1){_0x1b56d1[_0x6b0c('0x61')]=_0x58d0dd;return _0x1b56d1;});return db[_0x6b0c('0x6d')][_0x6b0c('0xb5')](_0x57e746,{'transaction':_0x4ba24a});});}else{_0xa3798a=0x194;_0x25bd33=[];}});})[_0x6b0c('0x1f')](function(){if(_0xa3798a!==0x194){return db[_0x6b0c('0x6d')][_0x6b0c('0xb6')]({'where':{'SmsAccountId':_0x58d0dd},'order':_0x6b0c('0x72')})['then'](function(_0x546d8b){_0x25bd33=_0x546d8b;});}})[_0x6b0c('0x29')](function(_0x3f7902){_0xa3798a=0x1f4;logger[_0x6b0c('0x25')](_0x3f7902[_0x6b0c('0xb7')]);if(_0x3f7902[_0x6b0c('0x37')]){delete _0x3f7902[_0x6b0c('0x37')];}_0x25bd33=_0x3f7902;})[_0x6b0c('0xb8')](function(){if(_0x25bd33===null){_0x4910e2[_0x6b0c('0x2a')](_0xa3798a);}else{if(_0xa3798a===0x1f4){_0x4910e2[_0x6b0c('0x2b')](_0xa3798a)[_0x6b0c('0x38')](_0x25bd33);}else{_0x4910e2['status'](_0xa3798a)[_0x6b0c('0x2d')](_0x25bd33);}}});};exports[_0x6b0c('0xb9')]=function(_0x19ff12,_0xbc16f3,_0xf8192c){var _0x467767={};var _0x58b394={};var _0x48027a;var _0x244802;return db[_0x6b0c('0x4e')][_0x6b0c('0x64')]({'where':{'id':_0x19ff12['params']['id']}})[_0x6b0c('0x1f')](handleEntityNotFound(_0xbc16f3,null))['then'](function(_0x5463aa){if(_0x5463aa){_0x48027a=_0x5463aa;_0x58b394[_0x6b0c('0x3e')]=_['keys'](db['SmsApplication']['rawAttributes']);_0x58b394[_0x6b0c('0x3f')]=_['keys'](_0x19ff12[_0x6b0c('0x3f')]);_0x58b394['filters']=_[_0x6b0c('0x55')](_0x58b394['model'],_0x58b394['query']);_0x467767[_0x6b0c('0x41')]=_[_0x6b0c('0x55')](_0x58b394[_0x6b0c('0x3e')],qs[_0x6b0c('0x42')](_0x19ff12[_0x6b0c('0x3f')][_0x6b0c('0x42')]));_0x467767['attributes']=_0x467767[_0x6b0c('0x41')][_0x6b0c('0x43')]?_0x467767[_0x6b0c('0x41')]:_0x58b394[_0x6b0c('0x3e')];_0x467767[_0x6b0c('0x46')]=qs[_0x6b0c('0x47')](_0x19ff12[_0x6b0c('0x3f')][_0x6b0c('0x47')]);_0x467767[_0x6b0c('0x48')]=qs[_0x6b0c('0x40')](_[_0x6b0c('0x49')](_0x19ff12[_0x6b0c('0x3f')],_0x58b394[_0x6b0c('0x40')]));if(_0x19ff12[_0x6b0c('0x3f')]['filter']){_0x467767['where']=_['merge'](_0x467767['where'],{'$or':_[_0x6b0c('0x3b')](_0x467767['attributes'],function(_0x8d9ceb){var _0x1d4da6={};_0x1d4da6[_0x8d9ceb]={'$like':'%'+_0x19ff12[_0x6b0c('0x3f')][_0x6b0c('0x4a')]+'%'};return _0x1d4da6;})});}_0x467767=_[_0x6b0c('0x4b')]({},_0x467767,_0x19ff12[_0x6b0c('0x4d')]);return _0x48027a[_0x6b0c('0xb9')](_0x467767);}})[_0x6b0c('0x1f')](function(_0x2e2c73){if(_0x2e2c73){_0x244802=_0x2e2c73['length'];if(!_0x19ff12['query'][_0x6b0c('0x44')](_0x6b0c('0x45'))){_0x467767[_0x6b0c('0x30')]=qs[_0x6b0c('0x30')](_0x19ff12[_0x6b0c('0x3f')][_0x6b0c('0x30')]);_0x467767['offset']=qs['offset'](_0x19ff12['query']['offset']);}return _0x48027a[_0x6b0c('0xb9')](_0x467767);}})[_0x6b0c('0x1f')](function(_0x17e7c2){if(_0x17e7c2){return _0x17e7c2?{'count':_0x244802,'rows':_0x17e7c2}:null;}})[_0x6b0c('0x1f')](respondWithResult(_0xbc16f3,null))[_0x6b0c('0x29')](handleError(_0xbc16f3,null));};exports[_0x6b0c('0xba')]=function(_0x31a8d9,_0x1d33cf,_0x23dad0){var _0x472cf6={'raw':![],'where':{}};var _0x31a57b={};var _0x196f81={'count':0x0,'rows':[]};return db[_0x6b0c('0x4e')][_0x6b0c('0x64')]({'where':{'id':_0x31a8d9[_0x6b0c('0x5f')]['id']}})['then'](handleEntityNotFound(_0x1d33cf,null))[_0x6b0c('0x1f')](function(_0x3e6bfc){if(_0x3e6bfc){_0x31a57b[_0x6b0c('0x3e')]=_[_0x6b0c('0x54')](db[_0x6b0c('0xbb')][_0x6b0c('0x3c')]);_0x31a57b[_0x6b0c('0x3f')]=_[_0x6b0c('0x54')](_0x31a8d9[_0x6b0c('0x3f')]);_0x31a57b[_0x6b0c('0x40')]=_[_0x6b0c('0x55')](_0x31a57b[_0x6b0c('0x3e')],_0x31a57b['query']);_0x472cf6[_0x6b0c('0x41')]=_[_0x6b0c('0x55')](_0x31a57b[_0x6b0c('0x3e')],qs[_0x6b0c('0x42')](_0x31a8d9[_0x6b0c('0x3f')][_0x6b0c('0x42')]));_0x472cf6['attributes']=_0x472cf6[_0x6b0c('0x41')][_0x6b0c('0x43')]?_0x472cf6['attributes']:_0x31a57b[_0x6b0c('0x3e')];if(!_0x31a8d9[_0x6b0c('0x3f')][_0x6b0c('0x44')](_0x6b0c('0x45'))){_0x472cf6['limit']=qs['limit'](_0x31a8d9['query'][_0x6b0c('0x30')]);_0x472cf6[_0x6b0c('0x2e')]=qs[_0x6b0c('0x2e')](_0x31a8d9[_0x6b0c('0x3f')][_0x6b0c('0x2e')]);}_0x472cf6['order']=qs[_0x6b0c('0x47')](_0x31a8d9[_0x6b0c('0x3f')][_0x6b0c('0x47')]);_0x472cf6[_0x6b0c('0x48')]=qs[_0x6b0c('0x40')](_[_0x6b0c('0x49')](_0x31a8d9[_0x6b0c('0x3f')],_0x31a57b['filters']));_0x472cf6[_0x6b0c('0x48')][_0x6b0c('0x61')]=_0x3e6bfc['id'];if(_0x31a8d9['query'][_0x6b0c('0x4a')]){_0x472cf6[_0x6b0c('0x48')]=_[_0x6b0c('0x4b')](_0x472cf6[_0x6b0c('0x48')],{'$or':_['map'](_0x472cf6[_0x6b0c('0x41')],function(_0x46f65){var _0x3060d6={};_0x3060d6[_0x46f65]={'$like':'%'+_0x31a8d9[_0x6b0c('0x3f')][_0x6b0c('0x4a')]+'%'};return _0x3060d6;})});}_0x472cf6=_[_0x6b0c('0x4b')]({},_0x472cf6,_0x31a8d9['options']);return db[_0x6b0c('0xbb')][_0x6b0c('0x31')]({'where':_0x472cf6[_0x6b0c('0x48')]})['then'](function(_0x25843c){_0x196f81[_0x6b0c('0x31')]=_0x25843c;if(_0x31a8d9[_0x6b0c('0x3f')]['includeAll']){_0x472cf6['include']=[{'model':db[_0x6b0c('0x74')],'as':_0x6b0c('0xbc'),'required':![]},{'model':db[_0x6b0c('0xbd')],'as':_0x6b0c('0xbe'),'attributes':[_0x6b0c('0x37'),'fullname',_0x6b0c('0xbf')],'required':![]},{'model':db[_0x6b0c('0xc0')],'as':_0x6b0c('0xc1'),'attributes':['id',_0x6b0c('0x37'),_0x6b0c('0xc2')],'where':_0x31a8d9[_0x6b0c('0x3f')][_0x6b0c('0xc3')]?{'id':_0x31a8d9[_0x6b0c('0x3f')][_0x6b0c('0xc3')]}:undefined,'required':_0x31a8d9[_0x6b0c('0x3f')][_0x6b0c('0xc3')]?!![]:![]}];}return db[_0x6b0c('0xbb')][_0x6b0c('0x51')](_0x472cf6);})[_0x6b0c('0x1f')](function(_0x8e11bb){_0x196f81[_0x6b0c('0x52')]=_0x8e11bb;return _0x196f81;});}})['then'](respondWithFilteredResult(_0x1d33cf,_0x472cf6))[_0x6b0c('0x29')](handleError(_0x1d33cf,null));};exports['send']=function(_0x282c22,_0x476a3e,_0x184772){var _0x3753a7,_0x3a6b0a,_0x518b13;if(_['isNil'](_0x282c22[_0x6b0c('0x58')]['body'])||_0x282c22[_0x6b0c('0x58')][_0x6b0c('0x58')]===''){throw new db[(_0x6b0c('0x75'))]['ValidationError'](_0x6b0c('0x97'));}if(_[_0x6b0c('0x94')](_0x282c22['body']['to'])){throw new db[(_0x6b0c('0x75'))][(_0x6b0c('0x95'))]('to\x20is\x20mandatory');}_0x3753a7=_0x282c22[_0x6b0c('0x58')]['to'];return db['SmsAccount'][_0x6b0c('0x56')]({'where':{'id':_0x282c22['params']['id']},'include':[{'model':db['CmList'],'as':_0x6b0c('0xc4'),'include':[{'model':db['CmContact'],'as':_0x6b0c('0x9c'),'where':{'mobile':_0x3753a7},'limit':0x1,'order':[[_0x6b0c('0x79'),_0x6b0c('0x9d')]]}]}]})[_0x6b0c('0x1f')](handleEntityNotFound(_0x476a3e,null))['then'](function(_0x4b4b2d){if(_0x4b4b2d&&_0x4b4b2d[_0x6b0c('0xc4')]){_0x3a6b0a=_0x4b4b2d['get']({'plain':!![]});if(_0x3a6b0a[_0x6b0c('0xc4')]&&_0x3a6b0a['List'][_0x6b0c('0x9c')]['length']){return _0x3a6b0a[_0x6b0c('0xc4')][_0x6b0c('0x9c')][0x0];}return db[_0x6b0c('0x74')][_0x6b0c('0x57')](_['defaults'](_0x282c22['body'],{'firstName':_0x3753a7,'mobile':_0x3753a7,'phone':_0x3753a7,'ListId':_0x3a6b0a[_0x6b0c('0x7b')]}));}})['then'](handleEntityNotFound(_0x476a3e,null))['then'](function(_0x2e14a3){if(_0x2e14a3){_0x518b13=_0x2e14a3;return db[_0x6b0c('0xbb')][_0x6b0c('0x56')]({'where':{'ContactId':_0x518b13['id'],'closed':![],'SmsAccountId':_0x3a6b0a['id']}})['then'](function(_0x2bac89){if(_0x2bac89){return[_0x2bac89,![]];}return db[_0x6b0c('0xbb')][_0x6b0c('0x57')]({'UserId':_0x282c22[_0x6b0c('0x59')]['id'],'ContactId':_0x518b13['id'],'SmsAccountId':_0x3a6b0a['id'],'phone':_0x3753a7,'firstMsgDirection':_0x6b0c('0xc5'),'Messages':[_['merge'](_0x282c22[_0x6b0c('0x58')],{'read':![],'body':_0x282c22['body'][_0x6b0c('0x58')],'phone':_0x3753a7,'SmsAccountId':_0x3a6b0a['id'],'UserId':_0x282c22[_0x6b0c('0x59')]['id'],'ContactId':_0x518b13['id']})]},{'include':[{'model':db[_0x6b0c('0xc6')],'as':_0x6b0c('0xc7')}]})['then'](function(_0x659467){return[_0x659467,!![]];});});}})[_0x6b0c('0xc8')](function(_0x2907e2,_0x323791){if(_0x323791){return _0x2907e2;}return db[_0x6b0c('0xc6')][_0x6b0c('0x57')](_[_0x6b0c('0x4b')](_0x282c22[_0x6b0c('0x58')],{'read':![],'body':_0x282c22[_0x6b0c('0x58')][_0x6b0c('0x58')],'phone':_0x3753a7,'SmsAccountId':_0x3a6b0a['id'],'SmsInteractionId':_0x2907e2['id'],'UserId':_0x282c22[_0x6b0c('0x59')]['id'],'ContactId':_0x518b13['id']}))[_0x6b0c('0x1f')](function(_0x4d9349){_0x2907e2[_0x6b0c('0xc9')][_0x6b0c('0xc7')]=[];_0x2907e2['dataValues'][_0x6b0c('0xc7')][_0x6b0c('0xca')](_0x4d9349[_0x6b0c('0xc9')]);return _0x2907e2;});})[_0x6b0c('0x1f')](respondWithResult(_0x476a3e,null))['catch'](handleError(_0x476a3e,null));};exports[_0x6b0c('0x2b')]=function(_0x5e82a6,_0x26154d,_0xcb3c37){if(_0x5e82a6[_0x6b0c('0x58')]['id']){delete _0x5e82a6[_0x6b0c('0x58')]['id'];}var _0x366a18,_0x2a783d,_0x1ef54f;return db[_0x6b0c('0x4e')][_0x6b0c('0x56')]({'where':{'id':_0x5e82a6[_0x6b0c('0x5f')]['id']}})[_0x6b0c('0x1f')](handleEntityNotFound(_0x26154d,null))[_0x6b0c('0x1f')](function(_0x4e3b73){if(_0x4e3b73){_0x1ef54f=_0x4e3b73;logger[_0x6b0c('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','received\x20delivery\x20report\x20from',_0x4e3b73[_0x6b0c('0x3d')],util['inspect'](_0x5e82a6[_0x6b0c('0x58')],{'showHidden':![],'depth':null}));switch(_0x4e3b73['type']){case _0x6b0c('0x82'):if(_0x5e82a6['body'][_0x6b0c('0xcb')]&&_0x5e82a6[_0x6b0c('0x58')][_0x6b0c('0x2b')]){_0x2a783d=_0x5e82a6['body'][_0x6b0c('0x2b')];return db[_0x6b0c('0xc6')][_0x6b0c('0x56')]({'where':{'messageId':_0x5e82a6['body'][_0x6b0c('0xcb')]}});}break;case _0x6b0c('0x85'):if(_0x5e82a6[_0x6b0c('0x58')][_0x6b0c('0xcc')]&&_0x5e82a6[_0x6b0c('0x58')][_0x6b0c('0xcd')]){_0x2a783d=_0x5e82a6[_0x6b0c('0x58')][_0x6b0c('0xcd')];return db[_0x6b0c('0xc6')][_0x6b0c('0x56')]({'where':{'messageId':_0x5e82a6['body'][_0x6b0c('0xcc')]}});}break;case _0x6b0c('0x86'):if(_0x5e82a6[_0x6b0c('0x58')][_0x6b0c('0xce')]&&_0x5e82a6[_0x6b0c('0x58')]['status_code']){_0x2a783d=_0x5e82a6[_0x6b0c('0x58')][_0x6b0c('0xcf')];return db[_0x6b0c('0xc6')]['find']({'where':{'messageId':_0x5e82a6[_0x6b0c('0x58')]['message_id']}});}break;case _0x6b0c('0xd0'):var _0x10d9fe=_0x5e82a6[_0x6b0c('0x58')][_0x6b0c('0x8a')][0x0];if(_0x10d9fe[_0x6b0c('0x81')]&&_0x10d9fe['status'][_0x6b0c('0xd1')]===_0x6b0c('0xd2')){_0x2a783d=_0x10d9fe[_0x6b0c('0x2b')][_0x6b0c('0xd1')];return db['SmsMessage'][_0x6b0c('0x56')]({'where':{'messageId':_0x10d9fe[_0x6b0c('0x81')]}});}break;case'clickatell':if(_0x5e82a6[_0x6b0c('0x58')][_0x6b0c('0x81')]&&_0x5e82a6[_0x6b0c('0x58')][_0x6b0c('0x2b')]){_0x2a783d=_0x5e82a6[_0x6b0c('0x58')][_0x6b0c('0x2b')];return db['SmsMessage']['find']({'where':{'messageId':_0x5e82a6[_0x6b0c('0x58')]['messageId']}});}break;case _0x6b0c('0x91'):if(_0x5e82a6[_0x6b0c('0x58')][0x0][_0x6b0c('0x27')]['id']){_0x2a783d=_0x5e82a6['body'][0x0]['type'];return db['SmsMessage'][_0x6b0c('0x56')]({'where':{'messageId':_0x5e82a6[_0x6b0c('0x58')][0x0][_0x6b0c('0x27')]['id']}});}break;case _0x6b0c('0x92'):if(_0x5e82a6[_0x6b0c('0x58')][_0x6b0c('0xd3')]&&_0x5e82a6[_0x6b0c('0x58')][_0x6b0c('0x2b')]){_0x2a783d=_0x5e82a6['body'][_0x6b0c('0x2b')];return db['SmsMessage'][_0x6b0c('0x56')]({'where':{'messageId':_0x5e82a6[_0x6b0c('0x58')][_0x6b0c('0xd3')]}});}break;}}})[_0x6b0c('0x1f')](handleEntityNotFound(_0x26154d,null))[_0x6b0c('0x1f')](function(_0x596505){if(_0x596505){_0x366a18=_0x596505;switch(_0x1ef54f[_0x6b0c('0x3d')]){case _0x6b0c('0x82'):if(_0x2a783d===_0x6b0c('0xd2')){return _0x366a18[_0x6b0c('0x34')]({'read':!![]});}else{logger[_0x6b0c('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6b0c('0x2b'),_0x6b0c('0x82'),util[_0x6b0c('0xd4')](_0x5e82a6[_0x6b0c('0x58')],{'showHidden':![],'depth':null}));}break;case _0x6b0c('0x85'):if(_0x2a783d==='1'){return _0x366a18[_0x6b0c('0x34')]({'read':!![]});}else{logger[_0x6b0c('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6b0c('0x2b'),_0x6b0c('0x82'),util[_0x6b0c('0xd4')](_0x5e82a6[_0x6b0c('0x58')],{'showHidden':![],'depth':null}));}break;case _0x6b0c('0x86'):if(!_0x5e82a6[_0x6b0c('0x58')][_0x6b0c('0xd5')]&&_0x2a783d>=0xc8&&_0x2a783d<=0xce){return _0x366a18[_0x6b0c('0x34')]({'read':!![]});}else{logger[_0x6b0c('0x25')](_0x6b0c('0xac'),_0x6b0c('0x2b'),_0x6b0c('0x86'),util[_0x6b0c('0xd4')](_0x5e82a6['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x399c78=_0x5e82a6['body'][_0x6b0c('0x8a')][0x0];if(_0x399c78[_0x6b0c('0x2b')][_0x6b0c('0xd1')]===_0x6b0c('0xd2')){return _0x366a18[_0x6b0c('0x34')]({'read':!![]});}else{logger[_0x6b0c('0x25')](_0x6b0c('0xac'),_0x6b0c('0x2b'),_0x6b0c('0xd0'),util[_0x6b0c('0xd4')](_0x5e82a6['body'],{'showHidden':![],'depth':null}));}break;case _0x6b0c('0x8e'):if(_0x2a783d==_0x6b0c('0xd6')||_0x2a783d==_0x6b0c('0xd7')){return _0x366a18[_0x6b0c('0x34')]({'read':!![]});}else{logger[_0x6b0c('0x25')](_0x6b0c('0xac'),_0x6b0c('0x2b'),_0x6b0c('0x8e'),util[_0x6b0c('0xd4')](_0x5e82a6[_0x6b0c('0x58')],{'showHidden':![],'depth':null}));}break;case _0x6b0c('0x91'):if(_0x2a783d==_0x6b0c('0xd8')){return _0x366a18[_0x6b0c('0x34')]({'read':!![]});}else{logger['error'](_0x6b0c('0xac'),'status',_0x6b0c('0x91'),util[_0x6b0c('0xd4')](_0x5e82a6[_0x6b0c('0x58')],{'showHidden':![],'depth':null}));}break;case _0x6b0c('0x92'):if(_0x2a783d===_0x6b0c('0xd9')||_0x2a783d===_0x6b0c('0xda')){return _0x366a18['update']({'read':!![]});}else{logger[_0x6b0c('0x25')](_0x6b0c('0xac'),_0x6b0c('0x2b'),_0x6b0c('0x92'),util[_0x6b0c('0xd4')](_0x5e82a6[_0x6b0c('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x366a18;}})[_0x6b0c('0x1f')](respondWithResult(_0x26154d,null))[_0x6b0c('0x29')](handleError(_0x26154d,null));};exports[_0x6b0c('0xdb')]=function(_0x252d96,_0x1380bc,_0x38c7dc){var _0x5b0e8c,_0xf1e4f7,_0x30ca22;return db[_0x6b0c('0x4e')][_0x6b0c('0x56')]({'where':{'id':_0x252d96[_0x6b0c('0x5f')]['id']}})['then'](handleEntityNotFound(_0x1380bc,null))[_0x6b0c('0x1f')](function(_0x5c3f73){if(_0x5c3f73){_0x30ca22=_0x5c3f73;logger[_0x6b0c('0x23')](_0x6b0c('0xac'),_0x6b0c('0x2b'),_0x6b0c('0xdc'),_0x5c3f73['type'],util[_0x6b0c('0xd4')](_0x252d96[_0x6b0c('0x3f')],{'showHidden':![],'depth':null}));switch(_0x5c3f73[_0x6b0c('0x3d')]){case _0x6b0c('0x8b'):if(_0x252d96[_0x6b0c('0x3f')]['message-id']&&_0x252d96[_0x6b0c('0x3f')][_0x6b0c('0xdd')]){_0xf1e4f7=_0x252d96[_0x6b0c('0x3f')]['state'];return db['SmsMessage'][_0x6b0c('0x56')]({'where':{'messageId':_0x252d96[_0x6b0c('0x3f')][_0x6b0c('0xde')]}});}break;}}})[_0x6b0c('0x1f')](handleEntityNotFound(_0x1380bc,null))[_0x6b0c('0x1f')](function(_0x45a034){if(_0x45a034){_0x5b0e8c=_0x45a034;switch(_0x30ca22[_0x6b0c('0x3d')]){case _0x6b0c('0x8b'):if(_0xf1e4f7==='2'||_0xf1e4f7==='6'){return _0x5b0e8c[_0x6b0c('0x34')]({'read':!![]});}else{logger[_0x6b0c('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6b0c('0x2b'),_0x6b0c('0x8b'),util['inspect'](_0x252d96[_0x6b0c('0x3f')],{'showHidden':![],'depth':null}));};break;}return _0x5b0e8c;}})[_0x6b0c('0x1f')](respondWithResult(_0x1380bc,null))[_0x6b0c('0x29')](handleError(_0x1380bc,null));};exports[_0x6b0c('0xdf')]=function(_0x3db102,_0x17b02d,_0x23c00a){return db[_0x6b0c('0x4e')][_0x6b0c('0x56')]({'where':{'id':_0x3db102[_0x6b0c('0x5f')]['id']}})['then'](handleEntityNotFound(_0x17b02d,null))[_0x6b0c('0x1f')](function(_0x4a963d){if(_0x4a963d){return _0x4a963d['addAgents'](_0x3db102[_0x6b0c('0x58')][_0x6b0c('0x66')],_[_0x6b0c('0x9f')](_0x3db102[_0x6b0c('0x58')],['ids','id'])||{})['spread'](function(_0x193eb6){for(var _0x5722d2=0x0;_0x5722d2<_0x3db102['body'][_0x6b0c('0x66')][_0x6b0c('0x43')];_0x5722d2+=0x1){socket[_0x6b0c('0xe0')]('userSmsAccount:save',{'UserId':Number(_0x3db102['body']['ids'][_0x5722d2]),'SmsAccountId':Number(_0x3db102[_0x6b0c('0x5f')]['id'])});}return _0x193eb6;});}})['then'](respondWithResult(_0x17b02d,null))[_0x6b0c('0x29')](handleError(_0x17b02d,null));};exports[_0x6b0c('0xe1')]=function(_0x21c915,_0x276b25,_0x475f01){return db[_0x6b0c('0x4e')][_0x6b0c('0x56')]({'where':{'id':_0x21c915[_0x6b0c('0x5f')]['id']}})['then'](handleEntityNotFound(_0x276b25,null))[_0x6b0c('0x1f')](function(_0x5e4142){if(_0x5e4142){return _0x5e4142[_0x6b0c('0xe1')](_0x21c915[_0x6b0c('0x3f')]['ids'])['then'](function(){if(_[_0x6b0c('0xe2')](_0x21c915[_0x6b0c('0x3f')][_0x6b0c('0x66')])){for(var _0x3378a5=0x0;_0x3378a5<_0x21c915['query'][_0x6b0c('0x66')][_0x6b0c('0x43')];_0x3378a5+=0x1){socket[_0x6b0c('0xe0')](_0x6b0c('0xe3'),{'UserId':Number(_0x21c915['query']['ids'][_0x3378a5]),'SmsAccountId':Number(_0x21c915[_0x6b0c('0x5f')]['id'])});}}else{socket[_0x6b0c('0xe0')](_0x6b0c('0xe3'),{'UserId':Number(_0x21c915[_0x6b0c('0x3f')][_0x6b0c('0x66')]),'SmsAccountId':Number(_0x21c915[_0x6b0c('0x5f')]['id'])});}});}})[_0x6b0c('0x1f')](respondWithStatusCode(_0x276b25,null))[_0x6b0c('0x29')](handleError(_0x276b25,null));};exports[_0x6b0c('0xe4')]=function(_0x496da8,_0x105a22,_0x52f73a){var _0x4fa83b={};var _0x5a9b53={};var _0x306eff;var _0x4be49a;return db['SmsAccount'][_0x6b0c('0x64')]({'where':{'id':_0x496da8[_0x6b0c('0x5f')]['id']}})[_0x6b0c('0x1f')](handleEntityNotFound(_0x105a22,null))[_0x6b0c('0x1f')](function(_0x2939cc){if(_0x2939cc){_0x306eff=_0x2939cc;_0x5a9b53['model']=_[_0x6b0c('0x54')](db['User']['rawAttributes']);_0x5a9b53[_0x6b0c('0x3f')]=_[_0x6b0c('0x54')](_0x496da8[_0x6b0c('0x3f')]);_0x5a9b53['filters']=_['intersection'](_0x5a9b53[_0x6b0c('0x3e')],_0x5a9b53[_0x6b0c('0x3f')]);_0x4fa83b[_0x6b0c('0x41')]=_[_0x6b0c('0x55')](_0x5a9b53['model'],qs['fields'](_0x496da8['query'][_0x6b0c('0x42')]));_0x4fa83b[_0x6b0c('0x41')]=_0x4fa83b[_0x6b0c('0x41')][_0x6b0c('0x43')]?_0x4fa83b['attributes']:_0x5a9b53['model'];_0x4fa83b['order']=qs[_0x6b0c('0x47')](_0x496da8[_0x6b0c('0x3f')]['sort']);_0x4fa83b[_0x6b0c('0x48')]=qs[_0x6b0c('0x40')](_['pick'](_0x496da8[_0x6b0c('0x3f')],_0x5a9b53['filters']));if(_0x496da8[_0x6b0c('0x3f')][_0x6b0c('0x4a')]){_0x4fa83b[_0x6b0c('0x48')]=_['merge'](_0x4fa83b[_0x6b0c('0x48')],{'$or':_[_0x6b0c('0x3b')](_0x4fa83b[_0x6b0c('0x41')],function(_0x2b6bef){var _0x2b11e6={};_0x2b11e6[_0x2b6bef]={'$like':'%'+_0x496da8[_0x6b0c('0x3f')][_0x6b0c('0x4a')]+'%'};return _0x2b11e6;})});}_0x4fa83b=_[_0x6b0c('0x4b')]({},_0x4fa83b,_0x496da8[_0x6b0c('0x4d')]);return _0x306eff['getAgents'](_0x4fa83b);}})['then'](function(_0x1371b3){if(_0x1371b3){_0x4be49a=_0x1371b3[_0x6b0c('0x43')];if(!_0x496da8[_0x6b0c('0x3f')][_0x6b0c('0x44')](_0x6b0c('0x45'))){_0x4fa83b[_0x6b0c('0x30')]=qs[_0x6b0c('0x30')](_0x496da8[_0x6b0c('0x3f')]['limit']);_0x4fa83b['offset']=qs[_0x6b0c('0x2e')](_0x496da8[_0x6b0c('0x3f')][_0x6b0c('0x2e')]);}return _0x306eff[_0x6b0c('0xe4')](_0x4fa83b);}})[_0x6b0c('0x1f')](function(_0x420e63){if(_0x420e63){return _0x420e63?{'count':_0x4be49a,'rows':_0x420e63}:null;}})[_0x6b0c('0x1f')](respondWithResult(_0x105a22,null))['catch'](handleError(_0x105a22,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 66cc630..00c6adb 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 _0x81a8=['emit','hasOwnProperty','hook','events','SmsAccount','setMaxListeners','save'];(function(_0x37ffea,_0x25b006){var _0x2e2615=function(_0x5e6c74){while(--_0x5e6c74){_0x37ffea['push'](_0x37ffea['shift']());}};_0x2e2615(++_0x25b006);}(_0x81a8,0x145));var _0x881a=function(_0x30e4c0,_0x58fed1){_0x30e4c0=_0x30e4c0-0x0;var _0x30b6d0=_0x81a8[_0x30e4c0];return _0x30b6d0;};'use strict';var EventEmitter=require(_0x881a('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x881a('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x881a('0x2')](0x0);var events={'afterCreate':_0x881a('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x432b51){return function(_0x20850b,_0x16d699,_0x3a65d5){SmsAccountEvents[_0x881a('0x4')](_0x432b51+':'+_0x20850b['id'],_0x20850b);SmsAccountEvents['emit'](_0x432b51,_0x20850b);_0x3a65d5(null);};}for(var e in events){if(events[_0x881a('0x5')](e)){var event=events[e];SmsAccount[_0x881a('0x6')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x3543=['emit','hasOwnProperty','exports','events','SmsAccount','setMaxListeners','save','update','remove'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x3543,0x8a));var _0x3354=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3543[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require(_0x3354('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x3354('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x3354('0x2')](0x0);var events={'afterCreate':_0x3354('0x3'),'afterUpdate':_0x3354('0x4'),'afterDestroy':_0x3354('0x5')};function emitEvent(_0x48b004){return function(_0x1f837f,_0x28b0f4,_0xa0b851){SmsAccountEvents[_0x3354('0x6')](_0x48b004+':'+_0x1f837f['id'],_0x1f837f);SmsAccountEvents[_0x3354('0x6')](_0x48b004,_0x1f837f);_0xa0b851(null);};}for(var e in events){if(events[_0x3354('0x7')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x3354('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index ed38423..b4c3d99 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 _0x5482=['exports','SmsAccount','sms_accounts','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes'];(function(_0x598b0c,_0x12251f){var _0x24c2b3=function(_0x494c90){while(--_0x494c90){_0x598b0c['push'](_0x598b0c['shift']());}};_0x24c2b3(++_0x12251f);}(_0x5482,0x15f));var _0x2548=function(_0x147c96,_0x309657){_0x147c96=_0x147c96-0x0;var _0x4ec711=_0x5482[_0x147c96];return _0x4ec711;};'use strict';var _=require(_0x2548('0x0'));var util=require(_0x2548('0x1'));var logger=require(_0x2548('0x2'))('api');var moment=require(_0x2548('0x3'));var BPromise=require('bluebird');var rp=require(_0x2548('0x4'));var fs=require('fs');var path=require(_0x2548('0x5'));var rimraf=require(_0x2548('0x6'));var config=require(_0x2548('0x7'));var attributes=require(_0x2548('0x8'));module[_0x2548('0x9')]=function(_0x2a6bff,_0x4dd7f2){return _0x2a6bff['define'](_0x2548('0xa'),attributes,{'tableName':_0x2548('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x12eb=['exports','define','SmsAccount','sms_accounts','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./smsAccount.attributes'];(function(_0x44731a,_0x3417bb){var _0x5541bd=function(_0x26d125){while(--_0x26d125){_0x44731a['push'](_0x44731a['shift']());}};_0x5541bd(++_0x3417bb);}(_0x12eb,0x9e));var _0xb12e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x12eb[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb12e('0x0'))(_0xb12e('0x1'));var moment=require('moment');var BPromise=require(_0xb12e('0x2'));var rp=require(_0xb12e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb12e('0x4'));var config=require(_0xb12e('0x5'));var attributes=require(_0xb12e('0x6'));module[_0xb12e('0x7')]=function(_0x44deaa,_0x11ed8d){return _0x44deaa[_0xb12e('0x8')](_0xb12e('0x9'),attributes,{'tableName':_0xb12e('0xa'),'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 5838694..7551fc1 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 _0x25ee=['request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','ShowSmsAccount','SmsAccount','options','raw','where','attributes','include','model','map','stringify','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x25ee,0x7a));var _0xe25e=function(_0xdb1494,_0x1e5208){_0xdb1494=_0xdb1494-0x0;var _0x505635=_0x25ee[_0xdb1494];return _0x505635;};'use strict';var _=require(_0xe25e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe25e('0x1'));var rs=require(_0xe25e('0x2'));var fs=require('fs');var Redis=require(_0xe25e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe25e('0x4'));var logger=require(_0xe25e('0x5'))(_0xe25e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe25e('0x7')][_0xe25e('0x8')]({'port':0x232a});config[_0xe25e('0x9')]=_['defaults'](config[_0xe25e('0x9')],{'host':_0xe25e('0xa'),'port':0x18eb});var socket=require(_0xe25e('0xb'))(new Redis(config[_0xe25e('0x9')]));require(_0xe25e('0xc'))[_0xe25e('0xd')](socket);function respondWithRpcPromise(_0x5ce1a6,_0x11b947,_0x1d7981){return new BPromise(function(_0x316b3f,_0x98ce5a){return client[_0xe25e('0xe')](_0x5ce1a6,_0x1d7981)[_0xe25e('0xf')](function(_0x55d2ca){logger[_0xe25e('0x10')](_0xe25e('0x11'),_0x11b947,_0xe25e('0x12'));logger[_0xe25e('0x13')](_0xe25e('0x14'),_0x11b947,_0xe25e('0x12'),JSON['stringify'](_0x55d2ca));if(_0x55d2ca[_0xe25e('0x15')]){if(_0x55d2ca['error'][_0xe25e('0x16')]===0x1f4){logger[_0xe25e('0x15')](_0xe25e('0x11'),_0x11b947,_0x55d2ca[_0xe25e('0x15')][_0xe25e('0x17')]);return _0x98ce5a(_0x55d2ca[_0xe25e('0x15')][_0xe25e('0x17')]);}logger[_0xe25e('0x15')]('SmsAccount,\x20%s,\x20%s',_0x11b947,_0x55d2ca[_0xe25e('0x15')][_0xe25e('0x17')]);return _0x316b3f(_0x55d2ca['error']['message']);}else{logger[_0xe25e('0x10')](_0xe25e('0x11'),_0x11b947,_0xe25e('0x12'));_0x316b3f(_0x55d2ca[_0xe25e('0x18')][_0xe25e('0x17')]);}})['catch'](function(_0x39518e){logger[_0xe25e('0x15')](_0xe25e('0x11'),_0x11b947,_0x39518e);_0x98ce5a(_0x39518e);});});}exports[_0xe25e('0x19')]=function(_0x16d2ea){var _0xeffa43=this;return new Promise(function(_0x42037c,_0x1282dd){return db[_0xe25e('0x1a')]['find']({'raw':_0x16d2ea[_0xe25e('0x1b')]?_0x16d2ea['options'][_0xe25e('0x1c')]===undefined?!![]:![]:!![],'where':_0x16d2ea[_0xe25e('0x1b')]?_0x16d2ea[_0xe25e('0x1b')][_0xe25e('0x1d')]||null:null,'attributes':_0x16d2ea[_0xe25e('0x1b')]?_0x16d2ea[_0xe25e('0x1b')][_0xe25e('0x1e')]||null:null,'include':_0x16d2ea['options']?_0x16d2ea[_0xe25e('0x1b')][_0xe25e('0x1f')]?_['map'](_0x16d2ea[_0xe25e('0x1b')][_0xe25e('0x1f')],function(_0x4d2d74){return{'model':db[_0x4d2d74[_0xe25e('0x20')]],'as':_0x4d2d74['as'],'attributes':_0x4d2d74[_0xe25e('0x1e')],'include':_0x4d2d74[_0xe25e('0x1f')]?_[_0xe25e('0x21')](_0x4d2d74[_0xe25e('0x1f')],function(_0x12e501){return{'model':db[_0x12e501[_0xe25e('0x20')]],'as':_0x12e501['as'],'attributes':_0x12e501['attributes'],'include':_0x12e501[_0xe25e('0x1f')]?_[_0xe25e('0x21')](_0x12e501[_0xe25e('0x1f')],function(_0x50d3d3){return{'model':db[_0x50d3d3['model']],'as':_0x50d3d3['as'],'attributes':_0x50d3d3[_0xe25e('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a0d2f){logger[_0xe25e('0x10')](_0xe25e('0x19'),_0x16d2ea);logger[_0xe25e('0x13')](_0xe25e('0x19'),_0x16d2ea,JSON[_0xe25e('0x22')](_0x1a0d2f));_0x42037c(_0x1a0d2f);})['catch'](function(_0x4fa19d){logger['error']('ShowSmsAccount',_0x4fa19d[_0xe25e('0x17')],_0x16d2ea);_0x1282dd(_0xeffa43[_0xe25e('0x15')](0x1f4,_0x4fa19d[_0xe25e('0x17')]));});});}; \ No newline at end of file +var _0xd210=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','ShowSmsAccount','SmsAccount','find','options','where','include','model','attributes','map','util','moment'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xd210,0xd6));var _0x0d21=function(_0x3f6b1b,_0x58d3d6){_0x3f6b1b=_0x3f6b1b-0x0;var _0x4a3d2b=_0xd210[_0x3f6b1b];return _0x4a3d2b;};'use strict';var _=require('lodash');var util=require(_0x0d21('0x0'));var moment=require(_0x0d21('0x1'));var BPromise=require(_0x0d21('0x2'));var rs=require(_0x0d21('0x3'));var fs=require('fs');var Redis=require(_0x0d21('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0d21('0x5'));var logger=require(_0x0d21('0x6'))(_0x0d21('0x7'));var config=require(_0x0d21('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0d21('0x9')][_0x0d21('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x0d21('0xb')],{'host':_0x0d21('0xc'),'port':0x18eb});var socket=require(_0x0d21('0xd'))(new Redis(config[_0x0d21('0xb')]));require(_0x0d21('0xe'))[_0x0d21('0xf')](socket);function respondWithRpcPromise(_0x86fb79,_0x358014,_0x340d91){return new BPromise(function(_0x3b5657,_0x5318a4){return client[_0x0d21('0x10')](_0x86fb79,_0x340d91)[_0x0d21('0x11')](function(_0x1073ad){logger[_0x0d21('0x12')](_0x0d21('0x13'),_0x358014,_0x0d21('0x14'));logger[_0x0d21('0x15')](_0x0d21('0x16'),_0x358014,_0x0d21('0x14'),JSON[_0x0d21('0x17')](_0x1073ad));if(_0x1073ad['error']){if(_0x1073ad[_0x0d21('0x18')]['code']===0x1f4){logger[_0x0d21('0x18')](_0x0d21('0x13'),_0x358014,_0x1073ad[_0x0d21('0x18')]['message']);return _0x5318a4(_0x1073ad[_0x0d21('0x18')][_0x0d21('0x19')]);}logger[_0x0d21('0x18')]('SmsAccount,\x20%s,\x20%s',_0x358014,_0x1073ad[_0x0d21('0x18')]['message']);return _0x3b5657(_0x1073ad[_0x0d21('0x18')][_0x0d21('0x19')]);}else{logger['info'](_0x0d21('0x13'),_0x358014,_0x0d21('0x14'));_0x3b5657(_0x1073ad['result']['message']);}})[_0x0d21('0x1a')](function(_0x430de9){logger[_0x0d21('0x18')](_0x0d21('0x13'),_0x358014,_0x430de9);_0x5318a4(_0x430de9);});});}exports[_0x0d21('0x1b')]=function(_0x4f429a){var _0x4c7451=this;return new Promise(function(_0x4030b8,_0x568859){return db[_0x0d21('0x1c')][_0x0d21('0x1d')]({'raw':_0x4f429a['options']?_0x4f429a[_0x0d21('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x4f429a[_0x0d21('0x1e')]?_0x4f429a[_0x0d21('0x1e')][_0x0d21('0x1f')]||null:null,'attributes':_0x4f429a[_0x0d21('0x1e')]?_0x4f429a['options']['attributes']||null:null,'include':_0x4f429a['options']?_0x4f429a[_0x0d21('0x1e')][_0x0d21('0x20')]?_['map'](_0x4f429a[_0x0d21('0x1e')]['include'],function(_0x7e2c71){return{'model':db[_0x7e2c71[_0x0d21('0x21')]],'as':_0x7e2c71['as'],'attributes':_0x7e2c71[_0x0d21('0x22')],'include':_0x7e2c71[_0x0d21('0x20')]?_[_0x0d21('0x23')](_0x7e2c71[_0x0d21('0x20')],function(_0xb0da6c){return{'model':db[_0xb0da6c['model']],'as':_0xb0da6c['as'],'attributes':_0xb0da6c[_0x0d21('0x22')],'include':_0xb0da6c['include']?_[_0x0d21('0x23')](_0xb0da6c[_0x0d21('0x20')],function(_0x276cf){return{'model':db[_0x276cf[_0x0d21('0x21')]],'as':_0x276cf['as'],'attributes':_0x276cf['attributes']};}):[]};}):[]};}):[]:[]})[_0x0d21('0x11')](function(_0x35e356){logger['info'](_0x0d21('0x1b'),_0x4f429a);logger[_0x0d21('0x15')](_0x0d21('0x1b'),_0x4f429a,JSON[_0x0d21('0x17')](_0x35e356));_0x4030b8(_0x35e356);})['catch'](function(_0x2d0193){logger['error'](_0x0d21('0x1b'),_0x2d0193['message'],_0x4f429a);_0x568859(_0x4c7451['error'](0x1f4,_0x2d0193[_0x0d21('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 30a574c..149cd1f 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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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 9ab6f89..a601ab7 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 _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x236227,_0x510911){var _0x143f0b=function(_0x4bc967){while(--_0x4bc967){_0x236227['push'](_0x236227['shift']());}};_0x143f0b(++_0x510911);}(_0x55ca,0x126));var _0xa55c=function(_0x5347f1,_0x1122ab){_0x5347f1=_0x5347f1-0x0;var _0x31216d=_0x55ca[_0x5347f1];return _0x31216d;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('0x10')]=router; \ No newline at end of file +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(_0x5a6159,_0x21eb22){var _0x60d15c=function(_0x4aed5b){while(--_0x4aed5b){_0x5a6159['push'](_0x5a6159['shift']());}};_0x60d15c(++_0x21eb22);}(_0x3e74,0x175));var _0x43e7=function(_0x3594b7,_0x5c0ef6){_0x3594b7=_0x3594b7-0x0;var _0x45d819=_0x3e74[_0x3594b7];return _0x45d819;};'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 diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index cb847c9..7de95ed 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 _0x2c53=['TEXT','sequelize','exports','INTEGER','STRING','noop'];(function(_0x46bb4d,_0x180dbe){var _0x13a119=function(_0x122ce6){while(--_0x122ce6){_0x46bb4d['push'](_0x46bb4d['shift']());}};_0x13a119(++_0x180dbe);}(_0x2c53,0x1e7));var _0x32c5=function(_0x35d775,_0x25431e){_0x35d775=_0x35d775-0x0;var _0x59384d=_0x2c53[_0x35d775];return _0x59384d;};'use strict';var Sequelize=require(_0x32c5('0x0'));module[_0x32c5('0x1')]={'priority':{'type':Sequelize[_0x32c5('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x32c5('0x3')],'allowNull':![],'defaultValue':_0x32c5('0x4')},'appdata':{'type':Sequelize[_0x32c5('0x5')]()},'description':{'type':Sequelize[_0x32c5('0x3')]},'interval':{'type':Sequelize[_0x32c5('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x1790=['exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x241751,_0x42d615){var _0x348447=function(_0x440c5e){while(--_0x440c5e){_0x241751['push'](_0x241751['shift']());}};_0x348447(++_0x42d615);}(_0x1790,0x1a4));var _0x0179=function(_0x1b9dbf,_0xeef94){_0x1b9dbf=_0x1b9dbf-0x0;var _0x42aa86=_0x1790[_0x1b9dbf];return _0x42aa86;};'use strict';var Sequelize=require('sequelize');module[_0x0179('0x0')]={'priority':{'type':Sequelize[_0x0179('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x0179('0x2')],'allowNull':![],'defaultValue':_0x0179('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0179('0x2')],'defaultValue':_0x0179('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 1822c53..9851f39 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 _0xfb37=['VIRTUAL','merge','options','includeAll','include','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','set','apply','save','update','then','destroy','error','stack','name','send','map','SmsApplication','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','filters','pick','filter','where'];(function(_0x2afacb,_0x35b4c8){var _0x273c6f=function(_0x4a3379){while(--_0x4a3379){_0x2afacb['push'](_0x2afacb['shift']());}};_0x273c6f(++_0x35b4c8);}(_0xfb37,0x95));var _0x7fb3=function(_0x261931,_0x5b654a){_0x261931=_0x261931-0x0;var _0x11083a=_0xfb37[_0x261931];return _0x11083a;};'use strict';var emlformat=require(_0x7fb3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7fb3('0x1'));var jsonpatch=require(_0x7fb3('0x2'));var rp=require(_0x7fb3('0x3'));var moment=require(_0x7fb3('0x4'));var BPromise=require(_0x7fb3('0x5'));var Mustache=require('mustache');var util=require(_0x7fb3('0x6'));var path=require(_0x7fb3('0x7'));var sox=require(_0x7fb3('0x8'));var csv=require('to-csv');var ejs=require(_0x7fb3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7fb3('0xa'));var deskjs=require(_0x7fb3('0xb'));var toCsv=require(_0x7fb3('0xc'));var querystring=require(_0x7fb3('0xd'));var Papa=require(_0x7fb3('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7fb3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fb3('0x10'))(_0x7fb3('0x11'));var utils=require(_0x7fb3('0x12'));var config=require(_0x7fb3('0x13'));var licenseUtil=require(_0x7fb3('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x132b62,_0x2b7c4a){_0x2b7c4a=_0x2b7c4a||0xcc;return function(_0x5e1c05){if(_0x5e1c05){return _0x132b62[_0x7fb3('0x15')](_0x2b7c4a);}return _0x132b62[_0x7fb3('0x16')](_0x2b7c4a)[_0x7fb3('0x17')]();};}function respondWithResult(_0xc85944,_0x321970){_0x321970=_0x321970||0xc8;return function(_0x414ee1){if(_0x414ee1){return _0xc85944[_0x7fb3('0x16')](_0x321970)[_0x7fb3('0x18')](_0x414ee1);}};}function respondWithFilteredResult(_0x5cfdaf,_0x1e3dd3){return function(_0x4bcdfd){if(_0x4bcdfd){var _0x46a4bf=typeof _0x1e3dd3['offset']===_0x7fb3('0x19')&&typeof _0x1e3dd3['limit']==='undefined';var _0x15b251=_0x4bcdfd[_0x7fb3('0x1a')];var _0x4f42d7=_0x46a4bf?0x0:_0x1e3dd3['offset'];var _0x1ed2f6=_0x46a4bf?_0x4bcdfd['count']:_0x1e3dd3[_0x7fb3('0x1b')]+_0x1e3dd3['limit'];var _0xd74c65;if(_0x1ed2f6>=_0x15b251){_0x1ed2f6=_0x15b251;_0xd74c65=0xc8;}else{_0xd74c65=0xce;}_0x5cfdaf['status'](_0xd74c65);return _0x5cfdaf[_0x7fb3('0x1c')]('Content-Range',_0x4f42d7+'-'+_0x1ed2f6+'/'+_0x15b251)['json'](_0x4bcdfd);}return null;};}function patchUpdates(_0x1ebdff){return function(_0x47501f){try{jsonpatch[_0x7fb3('0x1d')](_0x47501f,_0x1ebdff,!![]);}catch(_0x59d97b){return BPromise['reject'](_0x59d97b);}return _0x47501f[_0x7fb3('0x1e')]();};}function saveUpdates(_0x16df0b,_0x419280){return function(_0x2252b2){if(_0x2252b2){return _0x2252b2[_0x7fb3('0x1f')](_0x16df0b)[_0x7fb3('0x20')](function(_0x2a914d){return _0x2a914d;});}return null;};}function removeEntity(_0x146a6b,_0x21d91c){return function(_0x4123ca){if(_0x4123ca){return _0x4123ca[_0x7fb3('0x21')]()['then'](function(){_0x146a6b[_0x7fb3('0x16')](0xcc)[_0x7fb3('0x17')]();});}};}function handleEntityNotFound(_0x1ea767,_0x1d3eaf){return function(_0x188c60){if(!_0x188c60){_0x1ea767[_0x7fb3('0x15')](0x194);}return _0x188c60;};}function handleError(_0x224581,_0x3321ca){_0x3321ca=_0x3321ca||0x1f4;return function(_0x483806){logger[_0x7fb3('0x22')](_0x483806[_0x7fb3('0x23')]);if(_0x483806['name']){delete _0x483806[_0x7fb3('0x24')];}_0x224581[_0x7fb3('0x16')](_0x3321ca)[_0x7fb3('0x25')](_0x483806);};}exports['index']=function(_0x1d366b,_0x4088b4){var _0x46d7a1={},_0x4cccb9={},_0x5bec27={'count':0x0,'rows':[]};var _0x1b1ffd=_[_0x7fb3('0x26')](db[_0x7fb3('0x27')][_0x7fb3('0x28')],function(_0x4fadfb){return{'name':_0x4fadfb['fieldName'],'type':_0x4fadfb[_0x7fb3('0x29')][_0x7fb3('0x2a')]};});_0x4cccb9[_0x7fb3('0x2b')]=_[_0x7fb3('0x26')](_0x1b1ffd,_0x7fb3('0x24'));_0x4cccb9[_0x7fb3('0x2c')]=_[_0x7fb3('0x2d')](_0x1d366b[_0x7fb3('0x2c')]);_0x4cccb9['filters']=_[_0x7fb3('0x2e')](_0x4cccb9[_0x7fb3('0x2b')],_0x4cccb9[_0x7fb3('0x2c')]);_0x46d7a1['attributes']=_[_0x7fb3('0x2e')](_0x4cccb9[_0x7fb3('0x2b')],qs[_0x7fb3('0x2f')](_0x1d366b[_0x7fb3('0x2c')][_0x7fb3('0x2f')]));_0x46d7a1[_0x7fb3('0x30')]=_0x46d7a1[_0x7fb3('0x30')][_0x7fb3('0x31')]?_0x46d7a1['attributes']:_0x4cccb9[_0x7fb3('0x2b')];if(!_0x1d366b[_0x7fb3('0x2c')][_0x7fb3('0x32')](_0x7fb3('0x33'))){_0x46d7a1[_0x7fb3('0x34')]=qs[_0x7fb3('0x34')](_0x1d366b[_0x7fb3('0x2c')][_0x7fb3('0x34')]);_0x46d7a1[_0x7fb3('0x1b')]=qs[_0x7fb3('0x1b')](_0x1d366b[_0x7fb3('0x2c')]['offset']);}_0x46d7a1['order']=qs[_0x7fb3('0x35')](_0x1d366b[_0x7fb3('0x2c')][_0x7fb3('0x35')]);_0x46d7a1['where']=qs[_0x7fb3('0x36')](_[_0x7fb3('0x37')](_0x1d366b[_0x7fb3('0x2c')],_0x4cccb9[_0x7fb3('0x36')]),_0x1b1ffd);if(_0x1d366b[_0x7fb3('0x2c')][_0x7fb3('0x38')]){_0x46d7a1[_0x7fb3('0x39')]=_['merge'](_0x46d7a1['where'],{'$or':_[_0x7fb3('0x26')](_0x1b1ffd,function(_0x27404e){if(_0x27404e['type']!==_0x7fb3('0x3a')){var _0x1b8db9={};_0x1b8db9[_0x27404e['name']]={'$like':'%'+_0x1d366b[_0x7fb3('0x2c')][_0x7fb3('0x38')]+'%'};return _0x1b8db9;}})});}_0x46d7a1=_[_0x7fb3('0x3b')]({},_0x46d7a1,_0x1d366b[_0x7fb3('0x3c')]);var _0x1e945a={'where':_0x46d7a1[_0x7fb3('0x39')]};return db[_0x7fb3('0x27')][_0x7fb3('0x1a')](_0x1e945a)['then'](function(_0x23ec2f){_0x5bec27[_0x7fb3('0x1a')]=_0x23ec2f;if(_0x1d366b[_0x7fb3('0x2c')][_0x7fb3('0x3d')]){_0x46d7a1[_0x7fb3('0x3e')]=[{'all':!![]}];}return db[_0x7fb3('0x27')]['findAll'](_0x46d7a1);})[_0x7fb3('0x20')](function(_0x2968ac){_0x5bec27['rows']=_0x2968ac;return _0x5bec27;})[_0x7fb3('0x20')](respondWithFilteredResult(_0x4088b4,_0x46d7a1))[_0x7fb3('0x3f')](handleError(_0x4088b4,null));};exports[_0x7fb3('0x40')]=function(_0x50034d,_0x3e39f5){var _0x28dcd9={'raw':!![],'where':{'id':_0x50034d[_0x7fb3('0x41')]['id']}},_0x1253cd={};_0x1253cd[_0x7fb3('0x2b')]=_[_0x7fb3('0x2d')](db[_0x7fb3('0x27')][_0x7fb3('0x28')]);_0x1253cd[_0x7fb3('0x2c')]=_[_0x7fb3('0x2d')](_0x50034d[_0x7fb3('0x2c')]);_0x1253cd['filters']=_['intersection'](_0x1253cd['model'],_0x1253cd[_0x7fb3('0x2c')]);_0x28dcd9[_0x7fb3('0x30')]=_[_0x7fb3('0x2e')](_0x1253cd[_0x7fb3('0x2b')],qs[_0x7fb3('0x2f')](_0x50034d[_0x7fb3('0x2c')][_0x7fb3('0x2f')]));_0x28dcd9[_0x7fb3('0x30')]=_0x28dcd9[_0x7fb3('0x30')][_0x7fb3('0x31')]?_0x28dcd9[_0x7fb3('0x30')]:_0x1253cd['model'];if(_0x50034d[_0x7fb3('0x2c')][_0x7fb3('0x3d')]){_0x28dcd9['include']=[{'all':!![]}];}_0x28dcd9=_[_0x7fb3('0x3b')]({},_0x28dcd9,_0x50034d[_0x7fb3('0x3c')]);return db['SmsApplication'][_0x7fb3('0x42')](_0x28dcd9)['then'](handleEntityNotFound(_0x3e39f5,null))[_0x7fb3('0x20')](respondWithResult(_0x3e39f5,null))[_0x7fb3('0x3f')](handleError(_0x3e39f5,null));};exports[_0x7fb3('0x43')]=function(_0x24597d,_0x1b6b2a){return db['SmsApplication'][_0x7fb3('0x43')](_0x24597d[_0x7fb3('0x44')],{})[_0x7fb3('0x20')](respondWithResult(_0x1b6b2a,0xc9))[_0x7fb3('0x3f')](handleError(_0x1b6b2a,null));};exports[_0x7fb3('0x1f')]=function(_0x251cee,_0xeef60b){if(_0x251cee[_0x7fb3('0x44')]['id']){delete _0x251cee[_0x7fb3('0x44')]['id'];}return db[_0x7fb3('0x27')][_0x7fb3('0x42')]({'where':{'id':_0x251cee[_0x7fb3('0x41')]['id']}})['then'](handleEntityNotFound(_0xeef60b,null))['then'](saveUpdates(_0x251cee[_0x7fb3('0x44')],null))[_0x7fb3('0x20')](respondWithResult(_0xeef60b,null))[_0x7fb3('0x3f')](handleError(_0xeef60b,null));};exports['destroy']=function(_0x37c023,_0x28be53){return db[_0x7fb3('0x27')][_0x7fb3('0x42')]({'where':{'id':_0x37c023['params']['id']}})['then'](handleEntityNotFound(_0x28be53,null))[_0x7fb3('0x20')](removeEntity(_0x28be53,null))[_0x7fb3('0x3f')](handleError(_0x28be53,null));}; \ No newline at end of file +var _0xe47b=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','offset','undefined','count','Content-Range','json','apply','reject','save','destroy','then','end','error','stack','name','send','SmsApplication','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','limit','sort','where','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','merge','options','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x7a89d9,_0x489d98){var _0x3ddb49=function(_0x5baddc){while(--_0x5baddc){_0x7a89d9['push'](_0x7a89d9['shift']());}};_0x3ddb49(++_0x489d98);}(_0xe47b,0xc0));var _0xbe47=function(_0x241ab1,_0x5d0f2c){_0x241ab1=_0x241ab1-0x0;var _0x13d65c=_0xe47b[_0x241ab1];return _0x13d65c;};'use strict';var emlformat=require(_0xbe47('0x0'));var rimraf=require(_0xbe47('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbe47('0x2'));var rp=require(_0xbe47('0x3'));var moment=require(_0xbe47('0x4'));var BPromise=require(_0xbe47('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe47('0x6'));var sox=require('sox');var csv=require(_0xbe47('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbe47('0x8'));var _=require(_0xbe47('0x9'));var squel=require(_0xbe47('0xa'));var crypto=require('crypto');var jsforce=require(_0xbe47('0xb'));var deskjs=require(_0xbe47('0xc'));var toCsv=require(_0xbe47('0x7'));var querystring=require(_0xbe47('0xd'));var Papa=require(_0xbe47('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbe47('0xf'));var as=require(_0xbe47('0x10'));var hardwareService=require(_0xbe47('0x11'));var logger=require(_0xbe47('0x12'))('api');var utils=require(_0xbe47('0x13'));var config=require(_0xbe47('0x14'));var licenseUtil=require(_0xbe47('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54c15c,_0x33ad71){_0x33ad71=_0x33ad71||0xcc;return function(_0x16fbf7){if(_0x16fbf7){return _0x54c15c['sendStatus'](_0x33ad71);}return _0x54c15c[_0xbe47('0x16')](_0x33ad71)['end']();};}function respondWithResult(_0x28c76d,_0xe1e5ca){_0xe1e5ca=_0xe1e5ca||0xc8;return function(_0xef2ca){if(_0xef2ca){return _0x28c76d[_0xbe47('0x16')](_0xe1e5ca)['json'](_0xef2ca);}};}function respondWithFilteredResult(_0xb22859,_0x111899){return function(_0x56638b){if(_0x56638b){var _0x47a5d5=typeof _0x111899[_0xbe47('0x17')]===_0xbe47('0x18')&&typeof _0x111899['limit']===_0xbe47('0x18');var _0x1e4467=_0x56638b[_0xbe47('0x19')];var _0x371c66=_0x47a5d5?0x0:_0x111899[_0xbe47('0x17')];var _0x42deae=_0x47a5d5?_0x56638b[_0xbe47('0x19')]:_0x111899[_0xbe47('0x17')]+_0x111899['limit'];var _0x1e6536;if(_0x42deae>=_0x1e4467){_0x42deae=_0x1e4467;_0x1e6536=0xc8;}else{_0x1e6536=0xce;}_0xb22859['status'](_0x1e6536);return _0xb22859['set'](_0xbe47('0x1a'),_0x371c66+'-'+_0x42deae+'/'+_0x1e4467)[_0xbe47('0x1b')](_0x56638b);}return null;};}function patchUpdates(_0x1c6fe0){return function(_0x2787ee){try{jsonpatch[_0xbe47('0x1c')](_0x2787ee,_0x1c6fe0,!![]);}catch(_0x39fc54){return BPromise[_0xbe47('0x1d')](_0x39fc54);}return _0x2787ee[_0xbe47('0x1e')]();};}function saveUpdates(_0x3d92da,_0x172c4a){return function(_0x32ffdf){if(_0x32ffdf){return _0x32ffdf['update'](_0x3d92da)['then'](function(_0x46bb1d){return _0x46bb1d;});}return null;};}function removeEntity(_0x3082d8,_0x8f3dd){return function(_0x1ff19f){if(_0x1ff19f){return _0x1ff19f[_0xbe47('0x1f')]()[_0xbe47('0x20')](function(){_0x3082d8['status'](0xcc)[_0xbe47('0x21')]();});}};}function handleEntityNotFound(_0x207c34,_0x28d3e5){return function(_0x49356e){if(!_0x49356e){_0x207c34['sendStatus'](0x194);}return _0x49356e;};}function handleError(_0x166e02,_0x56b42b){_0x56b42b=_0x56b42b||0x1f4;return function(_0x12be75){logger[_0xbe47('0x22')](_0x12be75[_0xbe47('0x23')]);if(_0x12be75[_0xbe47('0x24')]){delete _0x12be75[_0xbe47('0x24')];}_0x166e02['status'](_0x56b42b)[_0xbe47('0x25')](_0x12be75);};}exports['index']=function(_0x3aacbc,_0x1aa868){var _0x47e442={},_0x276200={},_0x5618ff={'count':0x0,'rows':[]};var _0x39ed5f=_['map'](db[_0xbe47('0x26')][_0xbe47('0x27')],function(_0xfb05bb){return{'name':_0xfb05bb[_0xbe47('0x28')],'type':_0xfb05bb[_0xbe47('0x29')][_0xbe47('0x2a')]};});_0x276200[_0xbe47('0x2b')]=_[_0xbe47('0x2c')](_0x39ed5f,_0xbe47('0x24'));_0x276200[_0xbe47('0x2d')]=_[_0xbe47('0x2e')](_0x3aacbc[_0xbe47('0x2d')]);_0x276200[_0xbe47('0x2f')]=_[_0xbe47('0x30')](_0x276200[_0xbe47('0x2b')],_0x276200[_0xbe47('0x2d')]);_0x47e442[_0xbe47('0x31')]=_[_0xbe47('0x30')](_0x276200[_0xbe47('0x2b')],qs[_0xbe47('0x32')](_0x3aacbc['query']['fields']));_0x47e442[_0xbe47('0x31')]=_0x47e442[_0xbe47('0x31')]['length']?_0x47e442[_0xbe47('0x31')]:_0x276200['model'];if(!_0x3aacbc[_0xbe47('0x2d')]['hasOwnProperty'](_0xbe47('0x33'))){_0x47e442[_0xbe47('0x34')]=qs['limit'](_0x3aacbc[_0xbe47('0x2d')][_0xbe47('0x34')]);_0x47e442[_0xbe47('0x17')]=qs['offset'](_0x3aacbc['query']['offset']);}_0x47e442['order']=qs[_0xbe47('0x35')](_0x3aacbc[_0xbe47('0x2d')][_0xbe47('0x35')]);_0x47e442[_0xbe47('0x36')]=qs['filters'](_['pick'](_0x3aacbc[_0xbe47('0x2d')],_0x276200[_0xbe47('0x2f')]),_0x39ed5f);if(_0x3aacbc[_0xbe47('0x2d')][_0xbe47('0x37')]){_0x47e442['where']=_['merge'](_0x47e442[_0xbe47('0x36')],{'$or':_[_0xbe47('0x2c')](_0x39ed5f,function(_0x3db1aa){if(_0x3db1aa[_0xbe47('0x29')]!==_0xbe47('0x38')){var _0x22244e={};_0x22244e[_0x3db1aa[_0xbe47('0x24')]]={'$like':'%'+_0x3aacbc[_0xbe47('0x2d')][_0xbe47('0x37')]+'%'};return _0x22244e;}})});}_0x47e442=_['merge']({},_0x47e442,_0x3aacbc['options']);var _0x5dc432={'where':_0x47e442[_0xbe47('0x36')]};return db[_0xbe47('0x26')][_0xbe47('0x19')](_0x5dc432)[_0xbe47('0x20')](function(_0x1ad4ae){_0x5618ff[_0xbe47('0x19')]=_0x1ad4ae;if(_0x3aacbc['query'][_0xbe47('0x39')]){_0x47e442[_0xbe47('0x3a')]=[{'all':!![]}];}return db[_0xbe47('0x26')][_0xbe47('0x3b')](_0x47e442);})['then'](function(_0x1270c6){_0x5618ff[_0xbe47('0x3c')]=_0x1270c6;return _0x5618ff;})[_0xbe47('0x20')](respondWithFilteredResult(_0x1aa868,_0x47e442))[_0xbe47('0x3d')](handleError(_0x1aa868,null));};exports[_0xbe47('0x3e')]=function(_0x4d46b3,_0x5a4f0d){var _0x1f2fda={'raw':!![],'where':{'id':_0x4d46b3[_0xbe47('0x3f')]['id']}},_0x28d4ef={};_0x28d4ef['model']=_[_0xbe47('0x2e')](db['SmsApplication']['rawAttributes']);_0x28d4ef[_0xbe47('0x2d')]=_[_0xbe47('0x2e')](_0x4d46b3[_0xbe47('0x2d')]);_0x28d4ef[_0xbe47('0x2f')]=_[_0xbe47('0x30')](_0x28d4ef[_0xbe47('0x2b')],_0x28d4ef[_0xbe47('0x2d')]);_0x1f2fda[_0xbe47('0x31')]=_[_0xbe47('0x30')](_0x28d4ef[_0xbe47('0x2b')],qs[_0xbe47('0x32')](_0x4d46b3[_0xbe47('0x2d')][_0xbe47('0x32')]));_0x1f2fda[_0xbe47('0x31')]=_0x1f2fda[_0xbe47('0x31')][_0xbe47('0x40')]?_0x1f2fda['attributes']:_0x28d4ef['model'];if(_0x4d46b3['query'][_0xbe47('0x39')]){_0x1f2fda[_0xbe47('0x3a')]=[{'all':!![]}];}_0x1f2fda=_[_0xbe47('0x41')]({},_0x1f2fda,_0x4d46b3[_0xbe47('0x42')]);return db[_0xbe47('0x26')][_0xbe47('0x43')](_0x1f2fda)['then'](handleEntityNotFound(_0x5a4f0d,null))['then'](respondWithResult(_0x5a4f0d,null))[_0xbe47('0x3d')](handleError(_0x5a4f0d,null));};exports[_0xbe47('0x44')]=function(_0x35edca,_0x5947c9){return db[_0xbe47('0x26')][_0xbe47('0x44')](_0x35edca[_0xbe47('0x45')],{})[_0xbe47('0x20')](respondWithResult(_0x5947c9,0xc9))[_0xbe47('0x3d')](handleError(_0x5947c9,null));};exports['update']=function(_0x479f18,_0x107fd6){if(_0x479f18[_0xbe47('0x45')]['id']){delete _0x479f18[_0xbe47('0x45')]['id'];}return db['SmsApplication'][_0xbe47('0x43')]({'where':{'id':_0x479f18[_0xbe47('0x3f')]['id']}})[_0xbe47('0x20')](handleEntityNotFound(_0x107fd6,null))[_0xbe47('0x20')](saveUpdates(_0x479f18[_0xbe47('0x45')],null))[_0xbe47('0x20')](respondWithResult(_0x107fd6,null))['catch'](handleError(_0x107fd6,null));};exports[_0xbe47('0x1f')]=function(_0x3055be,_0x2455dd){return db['SmsApplication']['find']({'where':{'id':_0x3055be['params']['id']}})[_0xbe47('0x20')](handleEntityNotFound(_0x2455dd,null))['then'](removeEntity(_0x2455dd,null))[_0xbe47('0x3d')](handleError(_0x2455dd,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index ff7b429..a6d0840 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 _0xa584=['define','SmsApplication','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports'];(function(_0x4799d1,_0x282b9a){var _0x982e58=function(_0x1dab92){while(--_0x1dab92){_0x4799d1['push'](_0x4799d1['shift']());}};_0x982e58(++_0x282b9a);}(_0xa584,0x163));var _0x4a58=function(_0x4f856c,_0x3d5ced){_0x4f856c=_0x4f856c-0x0;var _0x52e036=_0xa584[_0x4f856c];return _0x52e036;};'use strict';var _=require('lodash');var util=require(_0x4a58('0x0'));var logger=require(_0x4a58('0x1'))(_0x4a58('0x2'));var moment=require(_0x4a58('0x3'));var BPromise=require(_0x4a58('0x4'));var rp=require(_0x4a58('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4a58('0x6'));var attributes=require('./smsApplication.attributes');module[_0x4a58('0x7')]=function(_0x5d78f6,_0x62455b){return _0x5d78f6[_0x4a58('0x8')](_0x4a58('0x9'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4a58('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xfd02=['path','rimraf','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x492573,_0x383e43){var _0x499c66=function(_0x222005){while(--_0x222005){_0x492573['push'](_0x492573['shift']());}};_0x499c66(++_0x383e43);}(_0xfd02,0xbd));var _0x2fd0=function(_0x5541ae,_0x4a902d){_0x5541ae=_0x5541ae-0x0;var _0x42adf6=_0xfd02[_0x5541ae];return _0x42adf6;};'use strict';var _=require(_0x2fd0('0x0'));var util=require('util');var logger=require(_0x2fd0('0x1'))(_0x2fd0('0x2'));var moment=require(_0x2fd0('0x3'));var BPromise=require(_0x2fd0('0x4'));var rp=require(_0x2fd0('0x5'));var fs=require('fs');var path=require(_0x2fd0('0x6'));var rimraf=require(_0x2fd0('0x7'));var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module['exports']=function(_0x44d448,_0xe43c0b){return _0x44d448[_0x2fd0('0x8')](_0x2fd0('0x9'),attributes,{'tableName':_0x2fd0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2fd0('0xb'),'collate':_0x2fd0('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index aeb6963..01ce120 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 _0xcf3d=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x52af56,_0x27ca65){var _0x63fbaa=function(_0x276d1c){while(--_0x276d1c){_0x52af56['push'](_0x52af56['shift']());}};_0x63fbaa(++_0x27ca65);}(_0xcf3d,0x19e));var _0xdcf3=function(_0x44febe,_0x378a00){_0x44febe=_0x44febe-0x0;var _0x18aa9b=_0xcf3d[_0x44febe];return _0x18aa9b;};'use strict';var _=require(_0xdcf3('0x0'));var util=require(_0xdcf3('0x1'));var moment=require(_0xdcf3('0x2'));var BPromise=require(_0xdcf3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdcf3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdcf3('0x5'));var logger=require(_0xdcf3('0x6'))(_0xdcf3('0x7'));var config=require(_0xdcf3('0x8'));var jayson=require(_0xdcf3('0x9'));var client=jayson[_0xdcf3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43f8d5,_0x47dde8,_0x2cd0af){return new BPromise(function(_0x45c5bd,_0x55fe3a){return client['request'](_0x43f8d5,_0x2cd0af)['then'](function(_0x4515a2){logger[_0xdcf3('0xb')](_0xdcf3('0xc'),_0x47dde8,_0xdcf3('0xd'));logger[_0xdcf3('0xe')](_0xdcf3('0xf'),_0x47dde8,_0xdcf3('0xd'),JSON[_0xdcf3('0x10')](_0x4515a2));if(_0x4515a2[_0xdcf3('0x11')]){if(_0x4515a2['error'][_0xdcf3('0x12')]===0x1f4){logger[_0xdcf3('0x11')]('SmsApplication,\x20%s,\x20%s',_0x47dde8,_0x4515a2[_0xdcf3('0x11')][_0xdcf3('0x13')]);return _0x55fe3a(_0x4515a2[_0xdcf3('0x11')][_0xdcf3('0x13')]);}logger['error'](_0xdcf3('0xc'),_0x47dde8,_0x4515a2[_0xdcf3('0x11')]['message']);return _0x45c5bd(_0x4515a2[_0xdcf3('0x11')]['message']);}else{logger[_0xdcf3('0xb')](_0xdcf3('0xc'),_0x47dde8,_0xdcf3('0xd'));_0x45c5bd(_0x4515a2[_0xdcf3('0x14')]['message']);}})[_0xdcf3('0x15')](function(_0x24cce5){logger['error'](_0xdcf3('0xc'),_0x47dde8,_0x24cce5);_0x55fe3a(_0x24cce5);});});} \ No newline at end of file +var _0x8710=['then','info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request'];(function(_0x49630d,_0x1a9f1d){var _0x4a38f7=function(_0x2d09f9){while(--_0x2d09f9){_0x49630d['push'](_0x49630d['shift']());}};_0x4a38f7(++_0x1a9f1d);}(_0x8710,0x68));var _0x0871=function(_0x4fb93b,_0x512d39){_0x4fb93b=_0x4fb93b-0x0;var _0x10a2e1=_0x8710[_0x4fb93b];return _0x10a2e1;};'use strict';var _=require(_0x0871('0x0'));var util=require(_0x0871('0x1'));var moment=require('moment');var BPromise=require(_0x0871('0x2'));var rs=require(_0x0871('0x3'));var fs=require('fs');var Redis=require(_0x0871('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0871('0x5'));var logger=require(_0x0871('0x6'))('rpc');var config=require(_0x0871('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0871('0x8')][_0x0871('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18b47f,_0x846dd7,_0x3df2b3){return new BPromise(function(_0x3ed8f4,_0x47dd75){return client[_0x0871('0xa')](_0x18b47f,_0x3df2b3)[_0x0871('0xb')](function(_0x5e9ef){logger[_0x0871('0xc')](_0x0871('0xd'),_0x846dd7,'request\x20sent');logger[_0x0871('0xe')](_0x0871('0xf'),_0x846dd7,_0x0871('0x10'),JSON[_0x0871('0x11')](_0x5e9ef));if(_0x5e9ef[_0x0871('0x12')]){if(_0x5e9ef['error'][_0x0871('0x13')]===0x1f4){logger[_0x0871('0x12')](_0x0871('0xd'),_0x846dd7,_0x5e9ef[_0x0871('0x12')][_0x0871('0x14')]);return _0x47dd75(_0x5e9ef[_0x0871('0x12')][_0x0871('0x14')]);}logger[_0x0871('0x12')]('SmsApplication,\x20%s,\x20%s',_0x846dd7,_0x5e9ef['error'][_0x0871('0x14')]);return _0x3ed8f4(_0x5e9ef[_0x0871('0x12')][_0x0871('0x14')]);}else{logger[_0x0871('0xc')](_0x0871('0xd'),_0x846dd7,_0x0871('0x10'));_0x3ed8f4(_0x5e9ef[_0x0871('0x15')][_0x0871('0x14')]);}})[_0x0871('0x16')](function(_0x4decab){logger[_0x0871('0x12')]('SmsApplication,\x20%s,\x20%s',_0x846dd7,_0x4decab);_0x47dd75(_0x4decab);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 80ca97d..7647157 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 _0xb10b=['smsinteraction:addtags','addTags','put','update','delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','post','create','addMessage','tracked','sms'];(function(_0x1381bf,_0x11b131){var _0x36ef59=function(_0x22a68b){while(--_0x22a68b){_0x1381bf['push'](_0x1381bf['shift']());}};_0x36ef59(++_0x11b131);}(_0xb10b,0x12a));var _0xbb10=function(_0x93c171,_0x2b3a4c){_0x93c171=_0x93c171-0x0;var _0x4970d9=_0xb10b[_0x93c171];return _0x4970d9;};'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('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getMessages']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['download']);router[_0xbb10('0x11')]('/',auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x11')](_0xbb10('0xf'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router[_0xbb10('0x11')]('/:id/tags',auth[_0xbb10('0xb')](),interaction[_0xbb10('0x14')](_0xbb10('0x15'),_0xbb10('0x16')),controller[_0xbb10('0x17')]);router[_0xbb10('0x18')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),interaction[_0xbb10('0x14')](_0xbb10('0x15'),'smsinteraction:update'),controller[_0xbb10('0x19')]);router[_0xbb10('0x1a')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),interaction[_0xbb10('0x14')](_0xbb10('0x15'),_0xbb10('0x1b')),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1a')](_0xbb10('0x1d'),auth['isAuthenticated'](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=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(_0x20875e,_0x8b2db4){var _0x5b9190=function(_0x908499){while(--_0x908499){_0x20875e['push'](_0x20875e['shift']());}};_0x5b9190(++_0x8b2db4);}(_0x6324,0x142));var _0x4632=function(_0x457585,_0x47e33a){_0x457585=_0x457585-0x0;var _0x1f96e1=_0x6324[_0x457585];return _0x1f96e1;};'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 74b098d..aebfa33 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 _0x6dfa=['STRING','ENUM','out','sequelize','moment','exports','BOOLEAN','DATE'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x6dfa,0x7b));var _0xa6df=function(_0x4b8bf5,_0x4aea7e){_0x4b8bf5=_0x4b8bf5-0x0;var _0xd7bc51=_0x6dfa[_0x4b8bf5];return _0xd7bc51;};'use strict';var Sequelize=require(_0xa6df('0x0'));var moment=require(_0xa6df('0x1'));module[_0xa6df('0x2')]={'closed':{'type':Sequelize[_0xa6df('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa6df('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xa6df('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa6df('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xa6df('0x6')]('in',_0xa6df('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa6df('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xa6df('0x6')]('in',_0xa6df('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa6df('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x48e3=['BOOLEAN','STRING','ENUM','sequelize','moment'];(function(_0x4a62d3,_0x28f05f){var _0x2e3631=function(_0x386fd6){while(--_0x386fd6){_0x4a62d3['push'](_0x4a62d3['shift']());}};_0x2e3631(++_0x28f05f);}(_0x48e3,0xe9));var _0x348e=function(_0x339e9e,_0x43cf18){_0x339e9e=_0x339e9e-0x0;var _0x4e7c05=_0x48e3[_0x339e9e];return _0x4e7c05;};'use strict';var Sequelize=require(_0x348e('0x0'));var moment=require(_0x348e('0x1'));module['exports']={'closed':{'type':Sequelize[_0x348e('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x348e('0x3')]},'thirdDisposition':{'type':Sequelize[_0x348e('0x3')]},'note':{'type':Sequelize[_0x348e('0x3')]},'phone':{'type':Sequelize[_0x348e('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x348e('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x348e('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index ee06aeb..ad6b53f 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 _0x48a9=['unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','end','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','compact','isEmpty','SmsAccountId','where','i.SmsAccountId\x20IN\x20?','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','role','sequelize','toString','count','merge','SmsInteraction','a.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','Contact.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','groupBy','SmsInteractionId','all','rows','show','filters','include','create','body','update','params','describe','addMessage','SmsMessage','ids','omit','getMessages','hasOwnProperty','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','addTags','setTags','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','fullname','CmContact','firstName','Messages','direction','SmsAccount','Account','mkdirSync','Sms','Owner','N.A.','closedAt','out','System','lastName','secret','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','json','offset','limit','set','apply','reject','save','destroy','then','error','stack','send','TagIds','Tags','split','forEach','push','catch','waiting','total','closed','UserId','talking','answered','unmanaged','map','rawAttributes','fieldName','type','model','name','query','keys','intersection','attributes','fields','length','order','sort','pick','select','color','from','tools_tags','field','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search'];(function(_0x3fb5eb,_0x5947a6){var _0x481291=function(_0x74e4e){while(--_0x74e4e){_0x3fb5eb['push'](_0x3fb5eb['shift']());}};_0x481291(++_0x5947a6);}(_0x48a9,0x8a));var _0x948a=function(_0x289e64,_0x5adb3c){_0x289e64=_0x289e64-0x0;var _0x30246c=_0x48a9[_0x289e64];return _0x30246c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x948a('0x0'));var zipdir=require(_0x948a('0x1'));var jsonpatch=require(_0x948a('0x2'));var rp=require(_0x948a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x948a('0x4'));var util=require(_0x948a('0x5'));var path=require(_0x948a('0x6'));var sox=require(_0x948a('0x7'));var csv=require(_0x948a('0x8'));var ejs=require(_0x948a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x948a('0xa'));var squel=require(_0x948a('0xb'));var crypto=require('crypto');var jsforce=require(_0x948a('0xc'));var deskjs=require(_0x948a('0xd'));var toCsv=require(_0x948a('0x8'));var querystring=require(_0x948a('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x948a('0xf'));var qs=require(_0x948a('0x10'));var as=require(_0x948a('0x11'));var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require(_0x948a('0x12'))(_0x948a('0x13'));var utils=require(_0x948a('0x14'));var config=require(_0x948a('0x15'));var licenseUtil=require(_0x948a('0x16'));var db=require('../../mysqldb')['db'];config[_0x948a('0x17')]=_[_0x948a('0x18')](config[_0x948a('0x17')],{'host':_0x948a('0x19'),'port':0x18eb});var socket=require(_0x948a('0x1a'))(new Redis(config['redis']));require(_0x948a('0x1b'))[_0x948a('0x1c')](socket);function respondWithStatusCode(_0xa9b8e3,_0x432541){_0x432541=_0x432541||0xcc;return function(_0x1a8c8d){if(_0x1a8c8d){return _0xa9b8e3[_0x948a('0x1d')](_0x432541);}return _0xa9b8e3[_0x948a('0x1e')](_0x432541)['end']();};}function respondWithResult(_0x40179b,_0x18147f){_0x18147f=_0x18147f||0xc8;return function(_0x229bcb){if(_0x229bcb){return _0x40179b[_0x948a('0x1e')](_0x18147f)[_0x948a('0x1f')](_0x229bcb);}};}function respondWithFilteredResult(_0x4cc4e1,_0x4b9fe3){return function(_0x55e3d0){if(_0x55e3d0){var _0xd04a81=typeof _0x4b9fe3[_0x948a('0x20')]==='undefined'&&typeof _0x4b9fe3[_0x948a('0x21')]==='undefined';var _0xbda1f2=_0x55e3d0['count'];var _0x504c5c=_0xd04a81?0x0:_0x4b9fe3[_0x948a('0x20')];var _0x188e43=_0xd04a81?_0x55e3d0['count']:_0x4b9fe3['offset']+_0x4b9fe3[_0x948a('0x21')];var _0x3f6c7c;if(_0x188e43>=_0xbda1f2){_0x188e43=_0xbda1f2;_0x3f6c7c=0xc8;}else{_0x3f6c7c=0xce;}_0x4cc4e1['status'](_0x3f6c7c);return _0x4cc4e1[_0x948a('0x22')]('Content-Range',_0x504c5c+'-'+_0x188e43+'/'+_0xbda1f2)[_0x948a('0x1f')](_0x55e3d0);}return null;};}function patchUpdates(_0x4e1f14){return function(_0x393c73){try{jsonpatch[_0x948a('0x23')](_0x393c73,_0x4e1f14,!![]);}catch(_0x5592fb){return BPromise[_0x948a('0x24')](_0x5592fb);}return _0x393c73[_0x948a('0x25')]();};}function saveUpdates(_0x3efdca,_0x5db9fe){return function(_0x508f17){if(_0x508f17){return _0x508f17['update'](_0x3efdca)['then'](function(_0x2645cd){return _0x2645cd;});}return null;};}function removeEntity(_0x108d73,_0x3e1373){return function(_0x4d4dc2){if(_0x4d4dc2){return _0x4d4dc2[_0x948a('0x26')]()[_0x948a('0x27')](function(){_0x108d73['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x52d727,_0x402637){return function(_0xa967b0){if(!_0xa967b0){_0x52d727[_0x948a('0x1d')](0x194);}return _0xa967b0;};}function handleError(_0x5cae37,_0xc91c91){_0xc91c91=_0xc91c91||0x1f4;return function(_0x2a2433){logger[_0x948a('0x28')](_0x2a2433[_0x948a('0x29')]);if(_0x2a2433['name']){delete _0x2a2433['name'];}_0x5cae37[_0x948a('0x1e')](_0xc91c91)[_0x948a('0x2a')](_0x2a2433);};}function getInteractionUsers(_0xaf2c78,_0x43bd0f){return new BPromise(function(_0x1f8e6e,_0x164d74){try{if(_0x43bd0f[_0xaf2c78['id']]){_0xaf2c78['Users']=_['map'](_0x43bd0f[_0xaf2c78['id']],function(_0x1bc64a){return{'id':_0x1bc64a['id'],'fullname':_0x1bc64a['fullname']};});}}catch(_0x3e53ee){_0x164d74(_0x3e53ee);}_0x1f8e6e(_0xaf2c78);});}function getInteractionTags(_0x32f0c3,_0x57ee58){return new BPromise(function(_0x4e2403,_0x31db30){try{if(_0x32f0c3[_0x948a('0x2b')]){_0x32f0c3[_0x948a('0x2c')]=[];_0x32f0c3[_0x948a('0x2b')][_0x948a('0x2d')](',')[_0x948a('0x2e')](function(_0x45f65d){_0x32f0c3[_0x948a('0x2c')][_0x948a('0x2f')](_0x57ee58[_0x45f65d]);});}delete _0x32f0c3[_0x948a('0x2b')];}catch(_0x40ae50){_0x31db30(_0x40ae50);}_0x4e2403(_0x32f0c3);});}function updateSmsInteraction(_0x2f7d97,_0x2ac228,_0x16601e){return new BPromise(function(_0x32339c,_0x40e18d){return getInteractionUsers(_0x2f7d97,_0x16601e)[_0x948a('0x27')](function(_0x568e12){return getInteractionTags(_0x568e12,_0x2ac228);})['then'](function(_0x2f8807){return getStateInteraction(_0x2f8807);})[_0x948a('0x27')](function(_0x27ea38){_0x32339c(_0x27ea38);})[_0x948a('0x30')](function(_0x38e43f){_0x40e18d(_0x38e43f);});});}function getStateInteraction(_0x900ef6){return new BPromise(function(_0x48fdfa){_0x900ef6[_0x948a('0x31')]=0x0;_0x900ef6['talking']=0x0;_0x900ef6['answered']=0x0;_0x900ef6['unmanaged']=0x0;_0x900ef6[_0x948a('0x32')]=0x0;if(!_0x900ef6[_0x948a('0x33')]&&!_0x900ef6[_0x948a('0x34')]){_0x900ef6[_0x948a('0x31')]+=0x1;}if(!_0x900ef6['closed']&&_0x900ef6[_0x948a('0x34')]){_0x900ef6[_0x948a('0x35')]+=0x1;if(_0x900ef6['waiting']){_0x900ef6[_0x948a('0x31')]-=0x1;}}if(_0x900ef6['closed']&&_0x900ef6[_0x948a('0x34')]){_0x900ef6[_0x948a('0x36')]+=0x1;if(_0x900ef6[_0x948a('0x35')]){_0x900ef6[_0x948a('0x35')]-=0x1;}}if(_0x900ef6[_0x948a('0x33')]&&!_0x900ef6[_0x948a('0x34')]){_0x900ef6[_0x948a('0x37')]+=0x1;if(_0x900ef6[_0x948a('0x31')]){_0x900ef6[_0x948a('0x31')]-=0x1;}}_0x900ef6[_0x948a('0x32')]+=0x1;_0x48fdfa(_0x900ef6);});}exports['index']=function(_0x16924b,_0x1bbe38){var _0x26e308={},_0x26fb0c={},_0x553e03={'count':0x0,'rows':[]};var _0xa38c6a=_[_0x948a('0x38')](db['SmsInteraction'][_0x948a('0x39')],function(_0x1980d1){return{'name':_0x1980d1[_0x948a('0x3a')],'type':_0x1980d1[_0x948a('0x3b')]['key']};});_0x26fb0c[_0x948a('0x3c')]=_['map'](_0xa38c6a,_0x948a('0x3d'));_0x26fb0c[_0x948a('0x3e')]=_[_0x948a('0x3f')](_0x16924b[_0x948a('0x3e')]);_0x26fb0c['filters']=_[_0x948a('0x40')](_0x26fb0c[_0x948a('0x3c')],_0x26fb0c[_0x948a('0x3e')]);_0x26e308[_0x948a('0x41')]=_[_0x948a('0x40')](_0x26fb0c[_0x948a('0x3c')],qs[_0x948a('0x42')](_0x16924b[_0x948a('0x3e')][_0x948a('0x42')]));_0x26e308[_0x948a('0x41')]=_0x26e308[_0x948a('0x41')][_0x948a('0x43')]?_0x26e308[_0x948a('0x41')]:_0x26fb0c[_0x948a('0x3c')];if(!_0x16924b[_0x948a('0x3e')]['hasOwnProperty']('nolimit')){_0x26e308[_0x948a('0x21')]=qs[_0x948a('0x21')](_0x16924b[_0x948a('0x3e')][_0x948a('0x21')]);_0x26e308[_0x948a('0x20')]=qs[_0x948a('0x20')](_0x16924b[_0x948a('0x3e')][_0x948a('0x20')]);}_0x26e308[_0x948a('0x44')]=qs[_0x948a('0x45')](_0x16924b[_0x948a('0x3e')][_0x948a('0x45')]);_0x26e308['where']=qs['filters'](_[_0x948a('0x46')](_0x16924b['query'],_0x26fb0c['filters']),_0xa38c6a);var _0x522ea2=[];var _0x1c3f84=squel[_0x948a('0x47')]()['field']('id')['field']('name')['field'](_0x948a('0x48'))[_0x948a('0x49')](_0x948a('0x4a'));var _0x14404a=squel[_0x948a('0x47')]()[_0x948a('0x4b')](_0x948a('0x4c'))[_0x948a('0x4b')](_0x948a('0x4d'))['field'](_0x948a('0x4e'))['from'](_0x948a('0x4f'),'ui')[_0x948a('0x50')]('users','u',_0x948a('0x51'));var _0x3b2cf1=squel[_0x948a('0x47')]()[_0x948a('0x49')]('sms_interactions','i')[_0x948a('0x50')](_0x948a('0x52'),'c',_0x948a('0x53'))['left_join'](_0x948a('0x54'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x948a('0x55'),'a',_0x948a('0x56'))[_0x948a('0x50')](_0x948a('0x57'),'me',_0x948a('0x58'))[_0x948a('0x50')](_0x948a('0x59'),'it','it.SmsInteractionId\x20=\x20i.id')[_0x948a('0x50')](_0x948a('0x4a'),'t',_0x948a('0x5a'));var _0x4ad6d7=squel[_0x948a('0x5b')]();var _0x22af35=[];var _0x373e93=squel['expr']();var _0x50f17f;if(_0x16924b[_0x948a('0x3e')]['search']){_0x50f17f=as[_0x948a('0x5c')](_0x16924b[_0x948a('0x3e')][_0x948a('0x5d')]);var _0x5325f2=_0x50f17f['sqlOperator'];for(var _0x55755e=0x0;_0x55755e<_0x50f17f['conditions'][_0x948a('0x43')];_0x55755e++){var _0x364b5b=_0x50f17f['conditions'][_0x55755e];var _0x4c8273='i';var _0x556ac4=_['find'](_0xa38c6a,[_0x948a('0x3d'),_0x364b5b[_0x948a('0x4b')]]);if(!_0x556ac4){switch(_0x364b5b['field']){case _0x948a('0x5e'):if(_0x364b5b[_0x948a('0x5f')]==0x1){_0x3b2cf1[_0x948a('0x60')]('`'+_0x364b5b['field']+_0x948a('0x61'));}else{_0x3b2cf1['having']('`'+_0x364b5b[_0x948a('0x4b')]+_0x948a('0x62'));}break;case _0x948a('0x63'):if(_0x364b5b[_0x948a('0x64')]===_0x948a('0x65')){if(_0x364b5b['value'][_0x948a('0x2d')]('\x20')[_0x948a('0x43')]>0x1){_0x4ad6d7[_0x5325f2](_0x948a('0x66'),qs['getFullTextValue'](_0x364b5b['value']),null);}else{var _0x57c8c7='%'+_0x364b5b[_0x948a('0x5f')]+'%';_0x4ad6d7[_0x5325f2](_0x948a('0x67'),_0x57c8c7,_0x57c8c7,_0x57c8c7);}}else{_0x556ac4=_[_0x948a('0x68')](_0xa38c6a,['name',_0x948a('0x69')]);_0x364b5b[_0x948a('0x4b')]='ContactId';_0x5a73d6=as[_0x948a('0x6a')](_0x4c8273,_0x556ac4[_0x948a('0x3b')],_0x364b5b);_0x4ad6d7[_0x5325f2](_0x5a73d6[_0x948a('0x6b')],_0x5a73d6[_0x948a('0x5f')][_0x948a('0x6c')],_0x5a73d6[_0x948a('0x5f')][_0x948a('0x6d')]);}break;case _0x948a('0x6e'):var _0x4c5eaa=_0x364b5b[_0x948a('0x5f')][_0x948a('0x2d')](',')[_0x948a('0x38')](function(_0x2d4b92){return Number(_0x2d4b92);});_0x4c5eaa['forEach'](function(_0x4c7975){_0x373e93['or'](_0x948a('0x6f'),'%,'+_0x4c7975+',%');});_0x22af35=_[_0x948a('0x70')](_0x22af35,_0x4c5eaa);break;case _0x948a('0x71'):if(_0x364b5b[_0x948a('0x64')]===_0x948a('0x65')){_0x4ad6d7[_0x5325f2](_0x948a('0x72'),'%'+_0x364b5b['value']+'%',null);}else{_0x556ac4=_[_0x948a('0x68')](_0xa38c6a,[_0x948a('0x3d'),_0x948a('0x34')]);_0x364b5b[_0x948a('0x4b')]='UserId';_0x5a73d6=as[_0x948a('0x6a')](_0x4c8273,_0x556ac4[_0x948a('0x3b')],_0x364b5b);_0x4ad6d7[_0x5325f2](_0x5a73d6[_0x948a('0x6b')],_0x5a73d6[_0x948a('0x5f')]['start'],_0x5a73d6[_0x948a('0x5f')][_0x948a('0x6d')]);}break;case'body':_0x5a73d6=as[_0x948a('0x6a')]('me',null,_0x364b5b);_0x4ad6d7[_0x5325f2](_0x5a73d6[_0x948a('0x6b')],_0x5a73d6[_0x948a('0x5f')]['start'],_0x5a73d6[_0x948a('0x5f')][_0x948a('0x6d')]);break;}}else{var _0x5a73d6=as[_0x948a('0x6a')](_0x4c8273,_0x556ac4[_0x948a('0x3b')],_0x364b5b);_0x4ad6d7[_0x5325f2](_0x5a73d6['text'],_0x5a73d6[_0x948a('0x5f')][_0x948a('0x6c')],_0x5a73d6[_0x948a('0x5f')][_0x948a('0x6d')]);}}}else{var _0x55d30a=_(_0x16924b[_0x948a('0x3e')])[_0x948a('0x3f')]()[_0x948a('0x38')](function(_0x1d5c45){return _[_0x948a('0x73')](_0xa38c6a,[_0x948a('0x3d'),_0x1d5c45])?_0x1d5c45:undefined;})[_0x948a('0x74')]()[_0x948a('0x5f')]();if(!_[_0x948a('0x75')](_0x55d30a)){_0x55d30a[_0x948a('0x2e')](function(_0x2ab9c3){if(_0x2ab9c3===_0x948a('0x76')){_0x3b2cf1[_0x948a('0x77')](_0x948a('0x78'),[]['concat'](_0x16924b[_0x948a('0x3e')][_0x2ab9c3]));}else if(_0x2ab9c3===_0x948a('0x79')){var _0x40f3fe=JSON['parse'](_0x16924b[_0x948a('0x3e')][_0x2ab9c3])['$gte'];var _0x130136=JSON[_0x948a('0x7a')](_0x16924b[_0x948a('0x3e')][_0x2ab9c3])[_0x948a('0x7b')];_0x3b2cf1[_0x948a('0x77')](_0x948a('0x7c'),_0x40f3fe,_0x130136);}else{if(_0x16924b['query'][_0x2ab9c3]===_0x948a('0x7d')){_0x3b2cf1[_0x948a('0x77')]('i.'+_0x2ab9c3+_0x948a('0x7e'));}else{_0x3b2cf1['where']('i.'+_0x2ab9c3+_0x948a('0x7f'),_0x16924b['query'][_0x2ab9c3]);}}});}if(_0x16924b[_0x948a('0x3e')][_0x948a('0x80')]){if(_0x16924b['query']['read']==0x1){_0x3b2cf1['having'](_0x948a('0x81'));}else{_0x3b2cf1[_0x948a('0x60')](_0x948a('0x82'));}}if(_0x16924b[_0x948a('0x3e')][_0x948a('0x83')]){_0x22af35=_['isArray'](_0x16924b[_0x948a('0x3e')][_0x948a('0x83')])?_0x16924b['query'][_0x948a('0x83')]:new Array(_0x16924b[_0x948a('0x3e')][_0x948a('0x83')]);_0x22af35[_0x948a('0x2e')](function(_0x25f501){_0x373e93['or'](_0x948a('0x6f'),'%,'+_0x25f501+',%');});}if(_0x16924b[_0x948a('0x3e')][_0x948a('0x84')]){var _0x4605e8=_0x16924b[_0x948a('0x3e')][_0x948a('0x84')][_0x948a('0x85')]('\x5c','\x5c\x5c')[_0x948a('0x85')](/'/g,'\x27\x27');if(qs[_0x948a('0x86')](_0x4605e8)){_0x4ad6d7['or']('i.id\x20LIKE\x20?',_0x4605e8+'%')['or'](_0x948a('0x87'),_0x4605e8+'%');}else{_0x4ad6d7['or'](_0x948a('0x88'),qs[_0x948a('0x89')](_0x4605e8))['or'](_0x948a('0x8a'),_0x4605e8+'%');}}}_0x3b2cf1['where'](_0x4ad6d7);_0x3b2cf1[_0x948a('0x8b')]('i.id');var _0x256764={'type':db['Sequelize']['QueryTypes'][_0x948a('0x8c')],'raw':!![]};var _0x22c78b=_0x3b2cf1['clone']();_0x22c78b[_0x948a('0x4b')](_0x948a('0x8d'));_0x22c78b[_0x948a('0x4b')](_0x948a('0x8e'),_0x948a('0x5e'));if(_0x26e308[_0x948a('0x44')]){_0x26e308[_0x948a('0x44')]['forEach'](function(_0x5e9185){var _0x1d26f3=_0x5e9185[0x0]===_0x948a('0x8f')?_0x5e9185[0x0]:'i.'+_0x5e9185[0x0];_0x3b2cf1[_0x948a('0x44')](_0x1d26f3,_0x5e9185[0x1]===_0x948a('0x90')?![]:!![]);});}if(!_[_0x948a('0x75')](_0x22af35)){_0x3b2cf1[_0x948a('0x60')](_0x373e93);_0x22c78b['where']('t.id\x20IN\x20?',_0x22af35);}BPromise[_0x948a('0x91')]()[_0x948a('0x27')](function(){if(!_0x50f17f){if(_0x16924b[_0x948a('0x3e')][_0x948a('0x76')])return;_0x22c78b[_0x948a('0x77')](_0x948a('0x92'));_0x3b2cf1[_0x948a('0x77')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x16924b[_0x948a('0x93')]['role']!==_0x948a('0x94'))return;return _0x16924b[_0x948a('0x93')][_0x948a('0x95')]({'attributes':['id'],'raw':!![]})[_0x948a('0x27')](function(_0x5b05ef){if(_[_0x948a('0x75')](_0x5b05ef)){_0x22c78b['where'](_0x948a('0x96'));_0x3b2cf1['where'](_0x948a('0x96'));}else{_0x22c78b[_0x948a('0x77')](_0x948a('0x78'),_['map'](_0x5b05ef,'id'));_0x3b2cf1[_0x948a('0x77')](_0x948a('0x78'),_[_0x948a('0x38')](_0x5b05ef,'id'));}});})[_0x948a('0x27')](function(){if(_0x16924b['user'][_0x948a('0x97')]===_0x948a('0x94')&&!_0x50f17f&&!_0x16924b[_0x948a('0x3e')][_0x948a('0x76')])return[];return db[_0x948a('0x98')][_0x948a('0x3e')](_0x22c78b[_0x948a('0x99')](),_0x256764);})[_0x948a('0x27')](function(_0x4cc1b0){_0x553e03[_0x948a('0x9a')]=_0x4cc1b0[_0x948a('0x43')];if(_0x553e03['count']===0x0)return[];return db[_0x948a('0x98')][_0x948a('0x3e')](_0x1c3f84[_0x948a('0x99')](),_0x256764)[_0x948a('0x27')](function(_0x57737d){_0x522ea2=_['keyBy'](_0x57737d,'id');_0x256764=_[_0x948a('0x9b')](_0x256764,{'model':db[_0x948a('0x9c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x16924b[_0x948a('0x3e')]['fields']){_0x26e308[_0x948a('0x41')][_0x948a('0x2e')](function(_0x1303c3){_0x3b2cf1[_0x948a('0x4b')]('i.'+_0x1303c3);});}else{_0x3b2cf1[_0x948a('0x4b')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x3b2cf1['field'](_0x948a('0x9d'),'Account.key');_0x3b2cf1[_0x948a('0x4b')](_0x948a('0x9e'),'Account.mandatoryDisposition');_0x3b2cf1[_0x948a('0x4b')](_0x948a('0x9f'),_0x948a('0x8f'));_0x3b2cf1[_0x948a('0x4b')]('i.*');_0x3b2cf1[_0x948a('0x4b')]('c.firstName',_0x948a('0xa0'));_0x3b2cf1[_0x948a('0x4b')]('c.lastName',_0x948a('0xa1'));_0x3b2cf1[_0x948a('0x4b')]('c.email',_0x948a('0xa2'));_0x3b2cf1[_0x948a('0x4b')](_0x948a('0xa3'),_0x948a('0xa4'));_0x3b2cf1[_0x948a('0x4b')](_0x948a('0xa5'),_0x948a('0xa6'));_0x3b2cf1[_0x948a('0x4b')](_0x948a('0xa7'),_0x948a('0xa8'));_0x3b2cf1[_0x948a('0x4b')](_0x948a('0xa9'),_0x948a('0xaa'));_0x3b2cf1[_0x948a('0x4b')](_0x948a('0xab'),_0x948a('0xac'));_0x3b2cf1[_0x948a('0x4b')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x948a('0x2b'));}if(_0x26e308[_0x948a('0x21')])_0x3b2cf1[_0x948a('0x21')](_0x26e308[_0x948a('0x21')]);if(_0x26e308[_0x948a('0x20')])_0x3b2cf1['offset'](_0x26e308[_0x948a('0x20')]);return db[_0x948a('0x98')]['query'](_0x3b2cf1[_0x948a('0x99')](),_0x256764);})['then'](function(_0x1576fe){if(_0x1576fe[_0x948a('0x43')]>0x0)_0x14404a[_0x948a('0x77')]('ui.SmsInteractionId\x20IN\x20?',_[_0x948a('0x38')](_0x1576fe,'id'));return db['sequelize'][_0x948a('0x3e')](_0x14404a[_0x948a('0x99')](),_0x256764)[_0x948a('0x27')](function(_0x122d7a){var _0xace1d8=_[_0x948a('0xad')](_0x122d7a,_0x948a('0xae'));var _0x45b842=[];_0x1576fe[_0x948a('0x2e')](function(_0x3431a5){_0x45b842[_0x948a('0x2f')](updateSmsInteraction(_0x3431a5,_0x522ea2,_0xace1d8));});return BPromise[_0x948a('0xaf')](_0x45b842);});});})['then'](function(_0x3cd4db){_0x553e03[_0x948a('0xb0')]=_0x3cd4db;return _0x553e03;})['then'](respondWithFilteredResult(_0x1bbe38,_0x26e308))[_0x948a('0x30')](handleError(_0x1bbe38,null));};exports[_0x948a('0xb1')]=function(_0x31ef1e,_0x5a4722){var _0x20a242={'raw':![],'where':{'id':_0x31ef1e['params']['id']}},_0x4e7ae8={};_0x4e7ae8[_0x948a('0x3c')]=_[_0x948a('0x3f')](db[_0x948a('0x9c')][_0x948a('0x39')]);_0x4e7ae8[_0x948a('0x3e')]=_[_0x948a('0x3f')](_0x31ef1e[_0x948a('0x3e')]);_0x4e7ae8[_0x948a('0xb2')]=_[_0x948a('0x40')](_0x4e7ae8[_0x948a('0x3c')],_0x4e7ae8[_0x948a('0x3e')]);_0x20a242[_0x948a('0x41')]=_[_0x948a('0x40')](_0x4e7ae8['model'],qs[_0x948a('0x42')](_0x31ef1e['query'][_0x948a('0x42')]));_0x20a242[_0x948a('0x41')]=_0x20a242[_0x948a('0x41')][_0x948a('0x43')]?_0x20a242['attributes']:_0x4e7ae8[_0x948a('0x3c')];if(_0x31ef1e[_0x948a('0x3e')]['includeAll']){_0x20a242[_0x948a('0xb3')]=[{'all':!![]}];}_0x20a242=_[_0x948a('0x9b')]({},_0x20a242,_0x31ef1e['options']);return db[_0x948a('0x9c')][_0x948a('0x68')](_0x20a242)[_0x948a('0x27')](handleEntityNotFound(_0x5a4722,null))[_0x948a('0x27')](respondWithResult(_0x5a4722,null))[_0x948a('0x30')](handleError(_0x5a4722,null));};exports[_0x948a('0xb4')]=function(_0x3b9042,_0x2bd35c){return db[_0x948a('0x9c')][_0x948a('0xb4')](_0x3b9042[_0x948a('0xb5')],{})[_0x948a('0x27')](respondWithResult(_0x2bd35c,0xc9))[_0x948a('0x30')](handleError(_0x2bd35c,null));};exports[_0x948a('0xb6')]=function(_0x386b72,_0x547dc0){if(_0x386b72[_0x948a('0xb5')]['id']){delete _0x386b72[_0x948a('0xb5')]['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x386b72['params']['id']}})[_0x948a('0x27')](handleEntityNotFound(_0x547dc0,null))[_0x948a('0x27')](saveUpdates(_0x386b72[_0x948a('0xb5')],null))[_0x948a('0x27')](respondWithResult(_0x547dc0,null))['catch'](handleError(_0x547dc0,null));};exports[_0x948a('0x26')]=function(_0x9f2a4e,_0x65c2e2){return db[_0x948a('0x9c')][_0x948a('0x68')]({'where':{'id':_0x9f2a4e[_0x948a('0xb7')]['id']}})['then'](handleEntityNotFound(_0x65c2e2,null))[_0x948a('0x27')](removeEntity(_0x65c2e2,null))['catch'](handleError(_0x65c2e2,null));};exports[_0x948a('0xb8')]=function(_0x34fc53,_0x3773b0){return db[_0x948a('0x9c')][_0x948a('0xb8')]()[_0x948a('0x27')](respondWithResult(_0x3773b0,null))['catch'](handleError(_0x3773b0,null));};exports[_0x948a('0xb9')]=function(_0x160ede,_0x98ab31,_0x427671){return db[_0x948a('0xba')][_0x948a('0x68')]({'where':{'id':_0x160ede[_0x948a('0xb7')]['id']}})[_0x948a('0x27')](handleEntityNotFound(_0x98ab31,null))[_0x948a('0x27')](function(_0x3d9d14){if(_0x3d9d14){return _0x3d9d14[_0x948a('0xb9')](_0x160ede[_0x948a('0xb5')][_0x948a('0xbb')],_[_0x948a('0xbc')](_0x160ede[_0x948a('0xb5')],[_0x948a('0xbb'),'id'])||{});}})['then'](respondWithResult(_0x98ab31,null))[_0x948a('0x30')](handleError(_0x98ab31,null));};exports[_0x948a('0xbd')]=function(_0x37beb8,_0x1a079c,_0x4fd6f4){var _0x1378cc={'raw':![],'where':{}};var _0x16a119={};var _0x42c5cf={'count':0x0,'rows':[]};return db['SmsInteraction']['findOne']({'where':{'id':_0x37beb8[_0x948a('0xb7')]['id']}})[_0x948a('0x27')](handleEntityNotFound(_0x1a079c,null))['then'](function(_0x256826){if(_0x256826){_0x16a119['model']=_[_0x948a('0x3f')](db['SmsMessage'][_0x948a('0x39')]);_0x16a119[_0x948a('0x3e')]=_[_0x948a('0x3f')](_0x37beb8[_0x948a('0x3e')]);_0x16a119[_0x948a('0xb2')]=_['intersection'](_0x16a119[_0x948a('0x3c')],_0x16a119[_0x948a('0x3e')]);_0x1378cc[_0x948a('0x41')]=_[_0x948a('0x40')](_0x16a119[_0x948a('0x3c')],qs[_0x948a('0x42')](_0x37beb8[_0x948a('0x3e')][_0x948a('0x42')]));_0x1378cc[_0x948a('0x41')]=_0x1378cc['attributes']['length']?_0x1378cc[_0x948a('0x41')]:_0x16a119['model'];if(!_0x37beb8[_0x948a('0x3e')][_0x948a('0xbe')]('nolimit')){_0x1378cc[_0x948a('0x21')]=qs['limit'](_0x37beb8[_0x948a('0x3e')][_0x948a('0x21')]);_0x1378cc[_0x948a('0x20')]=qs[_0x948a('0x20')](_0x37beb8['query']['offset']);}_0x1378cc[_0x948a('0x44')]=qs[_0x948a('0x45')](_0x37beb8[_0x948a('0x3e')][_0x948a('0x45')]);_0x1378cc[_0x948a('0x77')]=qs[_0x948a('0xb2')](_[_0x948a('0x46')](_0x37beb8['query'],_0x16a119[_0x948a('0xb2')]));_0x1378cc[_0x948a('0x77')][_0x948a('0xae')]=_0x256826['id'];if(_0x37beb8[_0x948a('0x3e')][_0x948a('0x84')]){_0x1378cc[_0x948a('0x77')]=_[_0x948a('0x9b')](_0x1378cc[_0x948a('0x77')],{'$or':_[_0x948a('0x38')](_0x1378cc['attributes'],function(_0x871cfa){var _0x2a6a8c={};_0x2a6a8c[_0x871cfa]={'$like':'%'+_0x37beb8[_0x948a('0x3e')][_0x948a('0x84')]+'%'};return _0x2a6a8c;})});}if(_0x37beb8['query'][_0x948a('0xbf')]){var _0x596c44=_0x37beb8[_0x948a('0x3e')][_0x948a('0xbf')][_0x948a('0x2d')](',');var _0x3b7061={};_0x3b7061[_0x596c44[0x0]]={'$gte':moment(_0x596c44[0x1])[_0x948a('0xc0')](_0x948a('0xc1'))};_0x1378cc[_0x948a('0x77')]=_[_0x948a('0x9b')](_0x1378cc[_0x948a('0x77')],_0x3b7061);}_0x1378cc=_['merge']({},_0x1378cc,_0x37beb8[_0x948a('0xc2')]);return db[_0x948a('0xba')][_0x948a('0x9a')]({'where':_0x1378cc[_0x948a('0x77')]})[_0x948a('0x27')](function(_0x5a4159){_0x42c5cf[_0x948a('0x9a')]=_0x5a4159;if(_0x37beb8[_0x948a('0x3e')][_0x948a('0xc3')]){_0x1378cc['include']=[{'all':!![]}];}return db[_0x948a('0xba')]['findAll'](_0x1378cc);})[_0x948a('0x27')](function(_0x1b30e5){_0x42c5cf[_0x948a('0xb0')]=_0x1b30e5;return _0x42c5cf;});}})[_0x948a('0x27')](respondWithFilteredResult(_0x1a079c,_0x1378cc))[_0x948a('0x30')](handleError(_0x1a079c,null));};exports[_0x948a('0xc4')]=function(_0x5b97cb,_0x339176,_0x46572){return db[_0x948a('0x9c')][_0x948a('0x68')]({'where':{'id':_0x5b97cb['params']['id']}})[_0x948a('0x27')](handleEntityNotFound(_0x339176,null))[_0x948a('0x27')](function(_0x51ba74){if(_0x51ba74){return _0x51ba74[_0x948a('0xc5')](_0x5b97cb[_0x948a('0xb5')]['ids'],_['omit'](_0x5b97cb[_0x948a('0xb5')],[_0x948a('0xbb'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id','name',_0x948a('0x48')],'where':{'id':_0x5b97cb['body'][_0x948a('0xbb')]}});})[_0x948a('0x27')](function(_0x1e4a92){socket[_0x948a('0xc6')](_0x948a('0xc7'),{'id':Number(_0x5b97cb['params']['id']),'tags':_0x1e4a92||[]});return{'id':Number(_0x5b97cb[_0x948a('0xb7')]['id']),'tags':_0x1e4a92||[]};});}})['then'](respondWithResult(_0x339176,null))[_0x948a('0x30')](handleError(_0x339176,null));};exports['removeTags']=function(_0x271f65,_0xece03d,_0x369ddb){return db[_0x948a('0x9c')]['find']({'where':{'id':_0x271f65['params']['id']}})[_0x948a('0x27')](handleEntityNotFound(_0xece03d,null))['then'](function(_0x95e8c4){if(_0x95e8c4){return _0x95e8c4[_0x948a('0xc8')](_0x271f65[_0x948a('0x3e')]['ids']);}})[_0x948a('0x27')](respondWithStatusCode(_0xece03d,null))[_0x948a('0x30')](handleError(_0xece03d,null));};exports[_0x948a('0xc9')]=function(_0x115891,_0x4dfe5b){var _0x8a0096=moment()[_0x948a('0xca')]()[_0x948a('0x99')]();var _0x4c0072=path[_0x948a('0xcb')](config[_0x948a('0xcc')],_0x948a('0xcd'),_0x948a('0xce'),_0x948a('0xcf'));var _0x2107da=path['join'](config['root'],_0x948a('0xcd'),_0x948a('0xce'),'attachments');var _0x37d263=path[_0x948a('0xcb')](_0x4c0072,_0x8a0096);var _0x4d5679=util[_0x948a('0xc0')]('transcript-%d-%s.zip',_0x115891[_0x948a('0xb7')]['id'],_0x8a0096);var _0x29bb5d=path[_0x948a('0xcb')](_0x4c0072,_0x4d5679);var _0x334710=[];_0x334710['push']({'model':db[_0x948a('0x71')],'as':_0x948a('0x71'),'attributes':['id',_0x948a('0xd0')],'raw':!![]});_0x334710[_0x948a('0x2f')]({'model':db[_0x948a('0xd1')],'as':_0x948a('0x63'),'attributes':['id',_0x948a('0xd2'),'lastName'],'raw':!![]});var _0x4f91c3=[{'model':db[_0x948a('0xba')],'as':_0x948a('0xd3'),'attributes':['id','body',_0x948a('0x79'),_0x948a('0xd4'),'secret',_0x948a('0x80')],'include':_0x334710}];_0x4f91c3[_0x948a('0x2f')]({'model':db[_0x948a('0xd5')],'as':_0x948a('0xd6'),'attributes':['id',_0x948a('0x3d')]});_0x4f91c3[_0x948a('0x2f')]({'model':db[_0x948a('0x71')],'as':'Owner','attributes':['id',_0x948a('0xd0')]});return db[_0x948a('0x9c')]['find']({'where':{'id':_0x115891['params']['id']},'include':_0x4f91c3})[_0x948a('0x27')](handleEntityNotFound(_0x4dfe5b,null))[_0x948a('0x27')](function(_0x5a27fd){if(_0x5a27fd){var _0x1d32c9=_0x5a27fd['get']({'plain':!![]});fs[_0x948a('0xd7')](_0x37d263);var _0x5ac7d6={'channel':_0x948a('0xd8'),'account':_0x1d32c9['Account'][_0x948a('0x3d')],'agent':_0x1d32c9[_0x948a('0xd9')]?_0x1d32c9[_0x948a('0xd9')]['fullname']:_0x948a('0xda'),'createdAt':moment(_0x1d32c9[_0x948a('0x79')])[_0x948a('0xc0')](_0x948a('0xc1'))['toString'](),'closedAt':_0x1d32c9[_0x948a('0x33')]?moment(_0x1d32c9[_0x948a('0xdb')])['format'](_0x948a('0xc1'))[_0x948a('0x99')]():'','disposition':_0x1d32c9['disposition'],'messages':_(_0x1d32c9[_0x948a('0xd3')])['filter']({'secret':![]})[_0x948a('0x38')](function(_0x1e9a17){return{'date':moment(_0x1e9a17[_0x948a('0x79')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x948a('0x99')](),'sender':_0x1e9a17[_0x948a('0xd4')]===_0x948a('0xdc')?_0x1e9a17['User']?_0x1e9a17[_0x948a('0x71')]['fullname']:_0x948a('0xdd'):_0x1e9a17[_0x948a('0x63')][_0x948a('0xd2')]+(_0x1e9a17['Contact'][_0x948a('0xde')]?'\x20'+_0x1e9a17[_0x948a('0x63')][_0x948a('0xde')]:''),'body':_0x1e9a17['body'],'direction':_0x1e9a17[_0x948a('0xd4')]===_0x948a('0xdc')?'A':'C','secret':_0x1e9a17[_0x948a('0xdf')],'read':_0x1e9a17['read']};})[_0x948a('0x5f')]()};return ejs[_0x948a('0xe0')](path[_0x948a('0xcb')](config['root'],_0x948a('0xcd'),_0x948a('0xe1'),_0x948a('0xe2')),{'interaction':_0x5ac7d6})[_0x948a('0x27')](function(_0x439f03){var _0x49e97e=path[_0x948a('0xcb')](_0x37d263,_0x948a('0xe3')+_0x1d32c9['id']+'-'+_0x8a0096+'.pdf');var _0x2587e7={'path':_0x49e97e,'channel':'Sms','interactionId':_0x1d32c9['id']};return pdf[_0x948a('0xe4')](_0x439f03,_0x2587e7);})['then'](function(){return new BPromise(function(_0x11bb57,_0x4c3d78){zipdir(_0x37d263,{'saveTo':_0x29bb5d},function(_0x2a8cc9,_0x4b6f8){if(_0x2a8cc9)return _0x4c3d78(_0x2a8cc9);return _0x11bb57(_0x4b6f8);});})[_0x948a('0x27')](function(){return new BPromise(function(_0x576099,_0x114aab){rimraf(_0x37d263,function(_0x4b34f2){if(_0x4b34f2)_0x114aab(_0x4b34f2);return _0x576099();});});})['then'](function(){return _0x4dfe5b[_0x948a('0xc9')](_0x29bb5d,_0x4d5679,function(_0x2f8475){if(_0x2f8475){console[_0x948a('0xe5')](_0x948a('0xe6'),_0x2f8475);}else{fs[_0x948a('0xe7')](_0x29bb5d);}});});});}else{return _0x4dfe5b[_0x948a('0x1d')](0xc8);}})[_0x948a('0x30')](handleError(_0x4dfe5b,null));}; \ No newline at end of file +var _0x45c7=['catch','waiting','answered','total','UserId','closed','talking','unmanaged','index','SmsInteraction','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','field','color','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','cm_contacts','sms_accounts','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','end','some','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$lte','null','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','toString','sequelize','merge','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','show','params','includeAll','create','describe','addMessage','ids','omit','getMessages','findOne','SmsMessage','pick','$gte','format','options','include','findAll','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','download','unix','join','root','files','transcript-%d-%s.zip','User','firstName','secret','Account','Owner','get','mkdirSync','Sms','N.A.','YYYY-MM-DD\x20HH:mm:ss','disposition','Messages','direction','out','System','lastName','renderFile','server','views','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','Users','map','fullname','split','forEach','Tags','push'];(function(_0x1a19f2,_0x3c3b1e){var _0x2a6db7=function(_0x146e0d){while(--_0x146e0d){_0x1a19f2['push'](_0x1a19f2['shift']());}};_0x2a6db7(++_0x3c3b1e);}(_0x45c7,0xb7));var _0x745c=function(_0x133ebd,_0x1b4794){_0x133ebd=_0x133ebd-0x0;var _0x38adec=_0x45c7[_0x133ebd];return _0x38adec;};'use strict';var emlformat=require(_0x745c('0x0'));var rimraf=require(_0x745c('0x1'));var zipdir=require(_0x745c('0x2'));var jsonpatch=require(_0x745c('0x3'));var rp=require(_0x745c('0x4'));var moment=require(_0x745c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x745c('0x6'));var util=require(_0x745c('0x7'));var path=require(_0x745c('0x8'));var sox=require(_0x745c('0x9'));var csv=require(_0x745c('0xa'));var ejs=require(_0x745c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x745c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x745c('0xa'));var querystring=require(_0x745c('0xd'));var Papa=require(_0x745c('0xe'));var Redis=require(_0x745c('0xf'));var authService=require(_0x745c('0x10'));var qs=require(_0x745c('0x11'));var as=require(_0x745c('0x12'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x745c('0x13'));var logger=require(_0x745c('0x14'))(_0x745c('0x15'));var utils=require(_0x745c('0x16'));var config=require(_0x745c('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x745c('0x18')]=_[_0x745c('0x19')](config[_0x745c('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x745c('0x1a'))(new Redis(config[_0x745c('0x18')]));require(_0x745c('0x1b'))[_0x745c('0x1c')](socket);function respondWithStatusCode(_0x262a3e,_0x1374d0){_0x1374d0=_0x1374d0||0xcc;return function(_0x29b174){if(_0x29b174){return _0x262a3e[_0x745c('0x1d')](_0x1374d0);}return _0x262a3e[_0x745c('0x1e')](_0x1374d0)['end']();};}function respondWithResult(_0x955bea,_0x2765e5){_0x2765e5=_0x2765e5||0xc8;return function(_0x1de13c){if(_0x1de13c){return _0x955bea[_0x745c('0x1e')](_0x2765e5)[_0x745c('0x1f')](_0x1de13c);}};}function respondWithFilteredResult(_0x3ad7b5,_0xdd5889){return function(_0x1fec43){if(_0x1fec43){var _0x286ceb=typeof _0xdd5889['offset']===_0x745c('0x20')&&typeof _0xdd5889['limit']==='undefined';var _0x4c58c2=_0x1fec43[_0x745c('0x21')];var _0x5250f3=_0x286ceb?0x0:_0xdd5889[_0x745c('0x22')];var _0x192189=_0x286ceb?_0x1fec43[_0x745c('0x21')]:_0xdd5889['offset']+_0xdd5889[_0x745c('0x23')];var _0x5bdb9a;if(_0x192189>=_0x4c58c2){_0x192189=_0x4c58c2;_0x5bdb9a=0xc8;}else{_0x5bdb9a=0xce;}_0x3ad7b5[_0x745c('0x1e')](_0x5bdb9a);return _0x3ad7b5[_0x745c('0x24')](_0x745c('0x25'),_0x5250f3+'-'+_0x192189+'/'+_0x4c58c2)[_0x745c('0x1f')](_0x1fec43);}return null;};}function patchUpdates(_0x4d64c6){return function(_0x1d5001){try{jsonpatch[_0x745c('0x26')](_0x1d5001,_0x4d64c6,!![]);}catch(_0x1a0605){return BPromise[_0x745c('0x27')](_0x1a0605);}return _0x1d5001[_0x745c('0x28')]();};}function saveUpdates(_0x28b5f1,_0x50642f){return function(_0x1c0e78){if(_0x1c0e78){return _0x1c0e78[_0x745c('0x29')](_0x28b5f1)[_0x745c('0x2a')](function(_0x145926){return _0x145926;});}return null;};}function removeEntity(_0x2682bd,_0x42af2b){return function(_0x371aa2){if(_0x371aa2){return _0x371aa2[_0x745c('0x2b')]()[_0x745c('0x2a')](function(){_0x2682bd[_0x745c('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb551f9,_0x219040){return function(_0xe2d28f){if(!_0xe2d28f){_0xb551f9[_0x745c('0x1d')](0x194);}return _0xe2d28f;};}function handleError(_0x449770,_0x2f4e39){_0x2f4e39=_0x2f4e39||0x1f4;return function(_0x3b676d){logger['error'](_0x3b676d[_0x745c('0x2c')]);if(_0x3b676d[_0x745c('0x2d')]){delete _0x3b676d[_0x745c('0x2d')];}_0x449770[_0x745c('0x1e')](_0x2f4e39)[_0x745c('0x2e')](_0x3b676d);};}function getInteractionUsers(_0xa78f14,_0xec92ff){return new BPromise(function(_0x5a176a,_0x128fe0){try{if(_0xec92ff[_0xa78f14['id']]){_0xa78f14[_0x745c('0x2f')]=_[_0x745c('0x30')](_0xec92ff[_0xa78f14['id']],function(_0x3aa227){return{'id':_0x3aa227['id'],'fullname':_0x3aa227[_0x745c('0x31')]};});}}catch(_0x54210f){_0x128fe0(_0x54210f);}_0x5a176a(_0xa78f14);});}function getInteractionTags(_0x17481f,_0x26ea93){return new BPromise(function(_0x43ee45,_0x34e38d){try{if(_0x17481f['TagIds']){_0x17481f['Tags']=[];_0x17481f['TagIds'][_0x745c('0x32')](',')[_0x745c('0x33')](function(_0x1fd661){_0x17481f[_0x745c('0x34')][_0x745c('0x35')](_0x26ea93[_0x1fd661]);});}delete _0x17481f['TagIds'];}catch(_0x11d85e){_0x34e38d(_0x11d85e);}_0x43ee45(_0x17481f);});}function updateSmsInteraction(_0x5970b7,_0xf9a6b4,_0x31f021){return new BPromise(function(_0x5167b1,_0x422204){return getInteractionUsers(_0x5970b7,_0x31f021)[_0x745c('0x2a')](function(_0xbc9f99){return getInteractionTags(_0xbc9f99,_0xf9a6b4);})[_0x745c('0x2a')](function(_0x11f400){return getStateInteraction(_0x11f400);})['then'](function(_0x355a4c){_0x5167b1(_0x355a4c);})[_0x745c('0x36')](function(_0x57eeb6){_0x422204(_0x57eeb6);});});}function getStateInteraction(_0x9b0027){return new BPromise(function(_0x89e8fc){_0x9b0027[_0x745c('0x37')]=0x0;_0x9b0027['talking']=0x0;_0x9b0027[_0x745c('0x38')]=0x0;_0x9b0027['unmanaged']=0x0;_0x9b0027[_0x745c('0x39')]=0x0;if(!_0x9b0027['closed']&&!_0x9b0027[_0x745c('0x3a')]){_0x9b0027['waiting']+=0x1;}if(!_0x9b0027[_0x745c('0x3b')]&&_0x9b0027['UserId']){_0x9b0027[_0x745c('0x3c')]+=0x1;if(_0x9b0027[_0x745c('0x37')]){_0x9b0027[_0x745c('0x37')]-=0x1;}}if(_0x9b0027[_0x745c('0x3b')]&&_0x9b0027[_0x745c('0x3a')]){_0x9b0027[_0x745c('0x38')]+=0x1;if(_0x9b0027[_0x745c('0x3c')]){_0x9b0027[_0x745c('0x3c')]-=0x1;}}if(_0x9b0027['closed']&&!_0x9b0027[_0x745c('0x3a')]){_0x9b0027[_0x745c('0x3d')]+=0x1;if(_0x9b0027[_0x745c('0x37')]){_0x9b0027[_0x745c('0x37')]-=0x1;}}_0x9b0027['total']+=0x1;_0x89e8fc(_0x9b0027);});}exports[_0x745c('0x3e')]=function(_0x51b413,_0x409b35){var _0x444fb2={},_0x2f32ef={},_0x462854={'count':0x0,'rows':[]};var _0x675337=_[_0x745c('0x30')](db[_0x745c('0x3f')][_0x745c('0x40')],function(_0x3e03d6){return{'name':_0x3e03d6[_0x745c('0x41')],'type':_0x3e03d6['type'][_0x745c('0x42')]};});_0x2f32ef['model']=_[_0x745c('0x30')](_0x675337,_0x745c('0x2d'));_0x2f32ef[_0x745c('0x43')]=_[_0x745c('0x44')](_0x51b413[_0x745c('0x43')]);_0x2f32ef[_0x745c('0x45')]=_[_0x745c('0x46')](_0x2f32ef[_0x745c('0x47')],_0x2f32ef[_0x745c('0x43')]);_0x444fb2[_0x745c('0x48')]=_[_0x745c('0x46')](_0x2f32ef[_0x745c('0x47')],qs[_0x745c('0x49')](_0x51b413[_0x745c('0x43')][_0x745c('0x49')]));_0x444fb2[_0x745c('0x48')]=_0x444fb2[_0x745c('0x48')][_0x745c('0x4a')]?_0x444fb2[_0x745c('0x48')]:_0x2f32ef[_0x745c('0x47')];if(!_0x51b413[_0x745c('0x43')][_0x745c('0x4b')](_0x745c('0x4c'))){_0x444fb2[_0x745c('0x23')]=qs[_0x745c('0x23')](_0x51b413[_0x745c('0x43')]['limit']);_0x444fb2[_0x745c('0x22')]=qs[_0x745c('0x22')](_0x51b413[_0x745c('0x43')][_0x745c('0x22')]);}_0x444fb2['order']=qs[_0x745c('0x4d')](_0x51b413['query']['sort']);_0x444fb2[_0x745c('0x4e')]=qs[_0x745c('0x45')](_['pick'](_0x51b413['query'],_0x2f32ef[_0x745c('0x45')]),_0x675337);var _0x3cb183=[];var _0x469405=squel['select']()[_0x745c('0x4f')]('id')[_0x745c('0x4f')](_0x745c('0x2d'))[_0x745c('0x4f')](_0x745c('0x50'))[_0x745c('0x51')](_0x745c('0x52'));var _0x32c666=squel['select']()['field'](_0x745c('0x53'))[_0x745c('0x4f')](_0x745c('0x54'))['field'](_0x745c('0x55'))[_0x745c('0x51')](_0x745c('0x56'),'ui')[_0x745c('0x57')](_0x745c('0x58'),'u',_0x745c('0x59'));var _0x2998db=squel[_0x745c('0x5a')]()['from']('sms_interactions','i')[_0x745c('0x57')](_0x745c('0x5b'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x745c('0x57')]('users','o','o.id\x20=\x20i.UserId')['left_join'](_0x745c('0x5c'),'a','a.id\x20=\x20i.SmsAccountId')['left_join'](_0x745c('0x5d'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x745c('0x57')](_0x745c('0x5e'),'it',_0x745c('0x5f'))[_0x745c('0x57')](_0x745c('0x52'),'t','t.id\x20=\x20it.TagId');var _0xb5f89f=squel[_0x745c('0x60')]();var _0x33c3fa=[];var _0x51bd87=squel['expr']();var _0x453084;if(_0x51b413[_0x745c('0x43')][_0x745c('0x61')]){_0x453084=as[_0x745c('0x62')](_0x51b413[_0x745c('0x43')][_0x745c('0x61')]);var _0x5e5813=_0x453084[_0x745c('0x63')];for(var _0x39ea71=0x0;_0x39ea71<_0x453084[_0x745c('0x64')]['length'];_0x39ea71++){var _0x170b9b=_0x453084[_0x745c('0x64')][_0x39ea71];var _0x4b2d3a='i';var _0x519a7b=_['find'](_0x675337,['name',_0x170b9b[_0x745c('0x4f')]]);if(!_0x519a7b){switch(_0x170b9b[_0x745c('0x4f')]){case _0x745c('0x65'):if(_0x170b9b['value']==0x1){_0x2998db[_0x745c('0x66')]('`'+_0x170b9b[_0x745c('0x4f')]+_0x745c('0x67'));}else{_0x2998db[_0x745c('0x66')]('`'+_0x170b9b[_0x745c('0x4f')]+_0x745c('0x68'));}break;case _0x745c('0x69'):if(_0x170b9b['operator']===_0x745c('0x6a')){if(_0x170b9b[_0x745c('0x6b')][_0x745c('0x32')]('\x20')[_0x745c('0x4a')]>0x1){_0xb5f89f[_0x5e5813](_0x745c('0x6c'),qs[_0x745c('0x6d')](_0x170b9b['value']),null);}else{var _0x50fb5b='%'+_0x170b9b[_0x745c('0x6b')]+'%';_0xb5f89f[_0x5e5813](_0x745c('0x6e'),_0x50fb5b,_0x50fb5b,_0x50fb5b);}}else{_0x519a7b=_[_0x745c('0x6f')](_0x675337,['name',_0x745c('0x70')]);_0x170b9b[_0x745c('0x4f')]='ContactId';_0x10dbca=as[_0x745c('0x71')](_0x4b2d3a,_0x519a7b[_0x745c('0x72')],_0x170b9b);_0xb5f89f[_0x5e5813](_0x10dbca[_0x745c('0x73')],_0x10dbca[_0x745c('0x6b')][_0x745c('0x74')],_0x10dbca[_0x745c('0x6b')]['end']);}break;case _0x745c('0x75'):var _0x384c30=_0x170b9b[_0x745c('0x6b')]['split'](',')[_0x745c('0x30')](function(_0x38ff79){return Number(_0x38ff79);});_0x384c30['forEach'](function(_0x39bdfa){_0x51bd87['or'](_0x745c('0x76'),'%,'+_0x39bdfa+',%');});_0x33c3fa=_[_0x745c('0x77')](_0x33c3fa,_0x384c30);break;case'User':if(_0x170b9b[_0x745c('0x78')]===_0x745c('0x6a')){_0xb5f89f[_0x5e5813](_0x745c('0x79'),'%'+_0x170b9b[_0x745c('0x6b')]+'%',null);}else{_0x519a7b=_[_0x745c('0x6f')](_0x675337,[_0x745c('0x2d'),_0x745c('0x3a')]);_0x170b9b[_0x745c('0x4f')]=_0x745c('0x3a');_0x10dbca=as[_0x745c('0x71')](_0x4b2d3a,_0x519a7b['type'],_0x170b9b);_0xb5f89f[_0x5e5813](_0x10dbca['text'],_0x10dbca[_0x745c('0x6b')][_0x745c('0x74')],_0x10dbca[_0x745c('0x6b')]['end']);}break;case _0x745c('0x7a'):_0x10dbca=as[_0x745c('0x71')]('me',null,_0x170b9b);_0xb5f89f[_0x5e5813](_0x10dbca[_0x745c('0x73')],_0x10dbca[_0x745c('0x6b')]['start'],_0x10dbca[_0x745c('0x6b')][_0x745c('0x7b')]);break;}}else{var _0x10dbca=as[_0x745c('0x71')](_0x4b2d3a,_0x519a7b['type'],_0x170b9b);_0xb5f89f[_0x5e5813](_0x10dbca[_0x745c('0x73')],_0x10dbca[_0x745c('0x6b')][_0x745c('0x74')],_0x10dbca['value'][_0x745c('0x7b')]);}}}else{var _0x4d96f0=_(_0x51b413[_0x745c('0x43')])[_0x745c('0x44')]()[_0x745c('0x30')](function(_0x27c2b8){return _[_0x745c('0x7c')](_0x675337,[_0x745c('0x2d'),_0x27c2b8])?_0x27c2b8:undefined;})['compact']()[_0x745c('0x6b')]();if(!_[_0x745c('0x7d')](_0x4d96f0)){_0x4d96f0[_0x745c('0x33')](function(_0xe2e080){if(_0xe2e080===_0x745c('0x7e')){_0x2998db[_0x745c('0x4e')](_0x745c('0x7f'),[][_0x745c('0x80')](_0x51b413[_0x745c('0x43')][_0xe2e080]));}else if(_0xe2e080===_0x745c('0x81')){var _0x3430b6=JSON['parse'](_0x51b413['query'][_0xe2e080])['$gte'];var _0x3d6c53=JSON[_0x745c('0x82')](_0x51b413[_0x745c('0x43')][_0xe2e080])[_0x745c('0x83')];_0x2998db[_0x745c('0x4e')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3430b6,_0x3d6c53);}else{if(_0x51b413[_0x745c('0x43')][_0xe2e080]===_0x745c('0x84')){_0x2998db['where']('i.'+_0xe2e080+'\x20IS\x20NULL');}else{_0x2998db[_0x745c('0x4e')]('i.'+_0xe2e080+'\x20=\x20?',_0x51b413[_0x745c('0x43')][_0xe2e080]);}}});}if(_0x51b413[_0x745c('0x43')][_0x745c('0x85')]){if(_0x51b413[_0x745c('0x43')][_0x745c('0x85')]==0x1){_0x2998db['having'](_0x745c('0x86'));}else{_0x2998db[_0x745c('0x66')]('`unreadMessages`\x20>\x200');}}if(_0x51b413[_0x745c('0x43')][_0x745c('0x87')]){_0x33c3fa=_[_0x745c('0x88')](_0x51b413['query'][_0x745c('0x87')])?_0x51b413[_0x745c('0x43')][_0x745c('0x87')]:new Array(_0x51b413[_0x745c('0x43')]['tag']);_0x33c3fa[_0x745c('0x33')](function(_0x29212f){_0x51bd87['or'](_0x745c('0x76'),'%,'+_0x29212f+',%');});}if(_0x51b413[_0x745c('0x43')][_0x745c('0x89')]){var _0x24842d=_0x51b413[_0x745c('0x43')][_0x745c('0x89')][_0x745c('0x8a')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x745c('0x8b')](_0x24842d)){_0xb5f89f['or'](_0x745c('0x8c'),_0x24842d+'%')['or']('i.phone\x20LIKE\x20?',_0x24842d+'%');}else{_0xb5f89f['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x745c('0x6d')](_0x24842d))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x24842d+'%');}}}_0x2998db['where'](_0xb5f89f);_0x2998db['group']('i.id');var _0x48119e={'type':db[_0x745c('0x8d')][_0x745c('0x8e')][_0x745c('0x8f')],'raw':!![]};var _0xc1dce7=_0x2998db[_0x745c('0x90')]();_0xc1dce7[_0x745c('0x4f')]('i.id');_0xc1dce7[_0x745c('0x4f')](_0x745c('0x91'),_0x745c('0x65'));if(_0x444fb2[_0x745c('0x92')]){_0x444fb2[_0x745c('0x92')][_0x745c('0x33')](function(_0x437f1e){var _0x2756ec=_0x437f1e[0x0]==='contactName'?_0x437f1e[0x0]:'i.'+_0x437f1e[0x0];_0x2998db['order'](_0x2756ec,_0x437f1e[0x1]===_0x745c('0x93')?![]:!![]);});}if(!_['isEmpty'](_0x33c3fa)){_0x2998db[_0x745c('0x66')](_0x51bd87);_0xc1dce7['where'](_0x745c('0x94'),_0x33c3fa);}BPromise[_0x745c('0x95')]()[_0x745c('0x2a')](function(){if(!_0x453084){if(_0x51b413[_0x745c('0x43')][_0x745c('0x7e')])return;_0xc1dce7[_0x745c('0x4e')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x2998db[_0x745c('0x4e')](_0x745c('0x96'));return;}if(_0x51b413[_0x745c('0x97')][_0x745c('0x98')]!==_0x745c('0x99'))return;return _0x51b413[_0x745c('0x97')][_0x745c('0x9a')]({'attributes':['id'],'raw':!![]})[_0x745c('0x2a')](function(_0x10b70c){if(_[_0x745c('0x7d')](_0x10b70c)){_0xc1dce7['where'](_0x745c('0x9b'));_0x2998db[_0x745c('0x4e')](_0x745c('0x9b'));}else{_0xc1dce7['where']('i.SmsAccountId\x20IN\x20?',_[_0x745c('0x30')](_0x10b70c,'id'));_0x2998db[_0x745c('0x4e')](_0x745c('0x7f'),_[_0x745c('0x30')](_0x10b70c,'id'));}});})['then'](function(){if(_0x51b413[_0x745c('0x97')][_0x745c('0x98')]===_0x745c('0x99')&&!_0x453084&&!_0x51b413[_0x745c('0x43')][_0x745c('0x7e')])return[];return db['sequelize'][_0x745c('0x43')](_0xc1dce7[_0x745c('0x9c')](),_0x48119e);})[_0x745c('0x2a')](function(_0x200191){_0x462854['count']=_0x200191[_0x745c('0x4a')];if(_0x462854['count']===0x0)return[];return db[_0x745c('0x9d')]['query'](_0x469405['toString'](),_0x48119e)[_0x745c('0x2a')](function(_0x3ee590){_0x3cb183=_['keyBy'](_0x3ee590,'id');_0x48119e=_[_0x745c('0x9e')](_0x48119e,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x51b413['query'][_0x745c('0x49')]){_0x444fb2['attributes'][_0x745c('0x33')](function(_0x3d9045){_0x2998db[_0x745c('0x4f')]('i.'+_0x3d9045);});}else{_0x2998db[_0x745c('0x4f')](_0x745c('0x91'),'unreadMessages');_0x2998db['field']('a.key','Account.key');_0x2998db[_0x745c('0x4f')](_0x745c('0x9f'),_0x745c('0xa0'));_0x2998db[_0x745c('0x4f')](_0x745c('0xa1'),_0x745c('0xa2'));_0x2998db['field'](_0x745c('0xa3'));_0x2998db[_0x745c('0x4f')](_0x745c('0xa4'),_0x745c('0xa5'));_0x2998db['field'](_0x745c('0xa6'),_0x745c('0xa7'));_0x2998db['field'](_0x745c('0xa8'),_0x745c('0xa9'));_0x2998db['field'](_0x745c('0xaa'),'Contact.phone');_0x2998db['field']('c.mobile',_0x745c('0xab'));_0x2998db[_0x745c('0x4f')](_0x745c('0xac'),'Contact.fax');_0x2998db['field'](_0x745c('0xad'),_0x745c('0xae'));_0x2998db[_0x745c('0x4f')](_0x745c('0xaf'),_0x745c('0xb0'));_0x2998db[_0x745c('0x4f')](_0x745c('0xb1'),'TagIds');}if(_0x444fb2['limit'])_0x2998db[_0x745c('0x23')](_0x444fb2[_0x745c('0x23')]);if(_0x444fb2[_0x745c('0x22')])_0x2998db[_0x745c('0x22')](_0x444fb2[_0x745c('0x22')]);return db['sequelize'][_0x745c('0x43')](_0x2998db[_0x745c('0x9c')](),_0x48119e);})[_0x745c('0x2a')](function(_0x5cbb42){if(_0x5cbb42[_0x745c('0x4a')]>0x0)_0x32c666[_0x745c('0x4e')](_0x745c('0xb2'),_[_0x745c('0x30')](_0x5cbb42,'id'));return db['sequelize'][_0x745c('0x43')](_0x32c666['toString'](),_0x48119e)['then'](function(_0x3408fa){var _0x43cefe=_[_0x745c('0xb3')](_0x3408fa,_0x745c('0xb4'));var _0x59db11=[];_0x5cbb42[_0x745c('0x33')](function(_0x3f3c8a){_0x59db11[_0x745c('0x35')](updateSmsInteraction(_0x3f3c8a,_0x3cb183,_0x43cefe));});return BPromise[_0x745c('0xb5')](_0x59db11);});});})[_0x745c('0x2a')](function(_0xabf125){_0x462854[_0x745c('0xb6')]=_0xabf125;return _0x462854;})[_0x745c('0x2a')](respondWithFilteredResult(_0x409b35,_0x444fb2))[_0x745c('0x36')](handleError(_0x409b35,null));};exports[_0x745c('0xb7')]=function(_0x4343e3,_0x2dc5aa){var _0x16e92a={'raw':![],'where':{'id':_0x4343e3[_0x745c('0xb8')]['id']}},_0x304cb0={};_0x304cb0[_0x745c('0x47')]=_[_0x745c('0x44')](db[_0x745c('0x3f')][_0x745c('0x40')]);_0x304cb0[_0x745c('0x43')]=_[_0x745c('0x44')](_0x4343e3[_0x745c('0x43')]);_0x304cb0[_0x745c('0x45')]=_[_0x745c('0x46')](_0x304cb0[_0x745c('0x47')],_0x304cb0['query']);_0x16e92a[_0x745c('0x48')]=_[_0x745c('0x46')](_0x304cb0[_0x745c('0x47')],qs[_0x745c('0x49')](_0x4343e3[_0x745c('0x43')][_0x745c('0x49')]));_0x16e92a[_0x745c('0x48')]=_0x16e92a[_0x745c('0x48')]['length']?_0x16e92a[_0x745c('0x48')]:_0x304cb0[_0x745c('0x47')];if(_0x4343e3[_0x745c('0x43')][_0x745c('0xb9')]){_0x16e92a['include']=[{'all':!![]}];}_0x16e92a=_[_0x745c('0x9e')]({},_0x16e92a,_0x4343e3['options']);return db[_0x745c('0x3f')][_0x745c('0x6f')](_0x16e92a)[_0x745c('0x2a')](handleEntityNotFound(_0x2dc5aa,null))[_0x745c('0x2a')](respondWithResult(_0x2dc5aa,null))['catch'](handleError(_0x2dc5aa,null));};exports[_0x745c('0xba')]=function(_0x55f818,_0x102b54){return db[_0x745c('0x3f')][_0x745c('0xba')](_0x55f818[_0x745c('0x7a')],{})[_0x745c('0x2a')](respondWithResult(_0x102b54,0xc9))[_0x745c('0x36')](handleError(_0x102b54,null));};exports[_0x745c('0x29')]=function(_0x7576f9,_0x2bfcfc){if(_0x7576f9[_0x745c('0x7a')]['id']){delete _0x7576f9[_0x745c('0x7a')]['id'];}return db[_0x745c('0x3f')]['find']({'where':{'id':_0x7576f9[_0x745c('0xb8')]['id']}})['then'](handleEntityNotFound(_0x2bfcfc,null))[_0x745c('0x2a')](saveUpdates(_0x7576f9['body'],null))['then'](respondWithResult(_0x2bfcfc,null))[_0x745c('0x36')](handleError(_0x2bfcfc,null));};exports[_0x745c('0x2b')]=function(_0x1a077b,_0x276b10){return db[_0x745c('0x3f')][_0x745c('0x6f')]({'where':{'id':_0x1a077b[_0x745c('0xb8')]['id']}})[_0x745c('0x2a')](handleEntityNotFound(_0x276b10,null))['then'](removeEntity(_0x276b10,null))[_0x745c('0x36')](handleError(_0x276b10,null));};exports['describe']=function(_0x3bced0,_0x4851bf){return db[_0x745c('0x3f')][_0x745c('0xbb')]()[_0x745c('0x2a')](respondWithResult(_0x4851bf,null))[_0x745c('0x36')](handleError(_0x4851bf,null));};exports[_0x745c('0xbc')]=function(_0x2583a1,_0xda6bea,_0x406c3b){return db['SmsMessage']['find']({'where':{'id':_0x2583a1[_0x745c('0xb8')]['id']}})[_0x745c('0x2a')](handleEntityNotFound(_0xda6bea,null))['then'](function(_0xd5377d){if(_0xd5377d){return _0xd5377d[_0x745c('0xbc')](_0x2583a1[_0x745c('0x7a')][_0x745c('0xbd')],_[_0x745c('0xbe')](_0x2583a1[_0x745c('0x7a')],['ids','id'])||{});}})[_0x745c('0x2a')](respondWithResult(_0xda6bea,null))[_0x745c('0x36')](handleError(_0xda6bea,null));};exports[_0x745c('0xbf')]=function(_0x546496,_0x485e93,_0x5cd5b6){var _0x5c46b2={'raw':![],'where':{}};var _0x2ff4ab={};var _0x34ffda={'count':0x0,'rows':[]};return db[_0x745c('0x3f')][_0x745c('0xc0')]({'where':{'id':_0x546496[_0x745c('0xb8')]['id']}})['then'](handleEntityNotFound(_0x485e93,null))[_0x745c('0x2a')](function(_0x2cb646){if(_0x2cb646){_0x2ff4ab['model']=_[_0x745c('0x44')](db[_0x745c('0xc1')][_0x745c('0x40')]);_0x2ff4ab[_0x745c('0x43')]=_[_0x745c('0x44')](_0x546496[_0x745c('0x43')]);_0x2ff4ab[_0x745c('0x45')]=_['intersection'](_0x2ff4ab[_0x745c('0x47')],_0x2ff4ab[_0x745c('0x43')]);_0x5c46b2['attributes']=_['intersection'](_0x2ff4ab[_0x745c('0x47')],qs[_0x745c('0x49')](_0x546496[_0x745c('0x43')][_0x745c('0x49')]));_0x5c46b2[_0x745c('0x48')]=_0x5c46b2[_0x745c('0x48')][_0x745c('0x4a')]?_0x5c46b2[_0x745c('0x48')]:_0x2ff4ab[_0x745c('0x47')];if(!_0x546496[_0x745c('0x43')][_0x745c('0x4b')](_0x745c('0x4c'))){_0x5c46b2[_0x745c('0x23')]=qs[_0x745c('0x23')](_0x546496[_0x745c('0x43')][_0x745c('0x23')]);_0x5c46b2[_0x745c('0x22')]=qs[_0x745c('0x22')](_0x546496[_0x745c('0x43')][_0x745c('0x22')]);}_0x5c46b2[_0x745c('0x92')]=qs['sort'](_0x546496['query'][_0x745c('0x4d')]);_0x5c46b2[_0x745c('0x4e')]=qs[_0x745c('0x45')](_[_0x745c('0xc2')](_0x546496[_0x745c('0x43')],_0x2ff4ab[_0x745c('0x45')]));_0x5c46b2['where'][_0x745c('0xb4')]=_0x2cb646['id'];if(_0x546496['query']['filter']){_0x5c46b2[_0x745c('0x4e')]=_[_0x745c('0x9e')](_0x5c46b2[_0x745c('0x4e')],{'$or':_['map'](_0x5c46b2[_0x745c('0x48')],function(_0x5ee7c6){var _0x135df7={};_0x135df7[_0x5ee7c6]={'$like':'%'+_0x546496['query']['filter']+'%'};return _0x135df7;})});}if(_0x546496['query'][_0x745c('0xc3')]){var _0xa6ba1b=_0x546496['query']['$gte'][_0x745c('0x32')](',');var _0x4f4c99={};_0x4f4c99[_0xa6ba1b[0x0]]={'$gte':moment(_0xa6ba1b[0x1])[_0x745c('0xc4')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5c46b2[_0x745c('0x4e')]=_[_0x745c('0x9e')](_0x5c46b2[_0x745c('0x4e')],_0x4f4c99);}_0x5c46b2=_[_0x745c('0x9e')]({},_0x5c46b2,_0x546496[_0x745c('0xc5')]);return db[_0x745c('0xc1')][_0x745c('0x21')]({'where':_0x5c46b2[_0x745c('0x4e')]})[_0x745c('0x2a')](function(_0x7c8a3c){_0x34ffda['count']=_0x7c8a3c;if(_0x546496[_0x745c('0x43')][_0x745c('0xb9')]){_0x5c46b2[_0x745c('0xc6')]=[{'all':!![]}];}return db[_0x745c('0xc1')][_0x745c('0xc7')](_0x5c46b2);})[_0x745c('0x2a')](function(_0x4f1631){_0x34ffda[_0x745c('0xb6')]=_0x4f1631;return _0x34ffda;});}})[_0x745c('0x2a')](respondWithFilteredResult(_0x485e93,_0x5c46b2))[_0x745c('0x36')](handleError(_0x485e93,null));};exports[_0x745c('0xc8')]=function(_0x527496,_0x5eafe2,_0x50d027){return db[_0x745c('0x3f')][_0x745c('0x6f')]({'where':{'id':_0x527496[_0x745c('0xb8')]['id']}})[_0x745c('0x2a')](handleEntityNotFound(_0x5eafe2,null))[_0x745c('0x2a')](function(_0x377355){if(_0x377355){return _0x377355[_0x745c('0xc9')](_0x527496[_0x745c('0x7a')]['ids'],_[_0x745c('0xbe')](_0x527496[_0x745c('0x7a')],['ids','id'])||{})[_0x745c('0xca')](function(){return db[_0x745c('0x75')][_0x745c('0xc7')]({'attributes':['id',_0x745c('0x2d'),'color'],'where':{'id':_0x527496[_0x745c('0x7a')][_0x745c('0xbd')]}});})[_0x745c('0x2a')](function(_0x36c593){socket[_0x745c('0xcb')](_0x745c('0xcc'),{'id':Number(_0x527496['params']['id']),'tags':_0x36c593||[]});return{'id':Number(_0x527496[_0x745c('0xb8')]['id']),'tags':_0x36c593||[]};});}})[_0x745c('0x2a')](respondWithResult(_0x5eafe2,null))['catch'](handleError(_0x5eafe2,null));};exports['removeTags']=function(_0x5014c8,_0x4aff7d,_0x3a416a){return db[_0x745c('0x3f')]['find']({'where':{'id':_0x5014c8[_0x745c('0xb8')]['id']}})[_0x745c('0x2a')](handleEntityNotFound(_0x4aff7d,null))[_0x745c('0x2a')](function(_0x2288e8){if(_0x2288e8){return _0x2288e8[_0x745c('0xcd')](_0x5014c8[_0x745c('0x43')][_0x745c('0xbd')]);}})[_0x745c('0x2a')](respondWithStatusCode(_0x4aff7d,null))['catch'](handleError(_0x4aff7d,null));};exports[_0x745c('0xce')]=function(_0x3c5724,_0x19f464){var _0x577239=moment()[_0x745c('0xcf')]()['toString']();var _0x3cb010=path[_0x745c('0xd0')](config[_0x745c('0xd1')],'server',_0x745c('0xd2'),'tmp');var _0x499ec3=path[_0x745c('0xd0')](config[_0x745c('0xd1')],'server',_0x745c('0xd2'),'attachments');var _0x58c444=path[_0x745c('0xd0')](_0x3cb010,_0x577239);var _0x420969=util[_0x745c('0xc4')](_0x745c('0xd3'),_0x3c5724[_0x745c('0xb8')]['id'],_0x577239);var _0x2e7488=path[_0x745c('0xd0')](_0x3cb010,_0x420969);var _0x1bae7a=[];_0x1bae7a[_0x745c('0x35')]({'model':db['User'],'as':_0x745c('0xd4'),'attributes':['id',_0x745c('0x31')],'raw':!![]});_0x1bae7a[_0x745c('0x35')]({'model':db['CmContact'],'as':_0x745c('0x69'),'attributes':['id',_0x745c('0xd5'),'lastName'],'raw':!![]});var _0x52f353=[{'model':db[_0x745c('0xc1')],'as':'Messages','attributes':['id',_0x745c('0x7a'),_0x745c('0x81'),'direction',_0x745c('0xd6'),'read'],'include':_0x1bae7a}];_0x52f353[_0x745c('0x35')]({'model':db['SmsAccount'],'as':_0x745c('0xd7'),'attributes':['id','name']});_0x52f353[_0x745c('0x35')]({'model':db['User'],'as':_0x745c('0xd8'),'attributes':['id',_0x745c('0x31')]});return db[_0x745c('0x3f')][_0x745c('0x6f')]({'where':{'id':_0x3c5724['params']['id']},'include':_0x52f353})[_0x745c('0x2a')](handleEntityNotFound(_0x19f464,null))[_0x745c('0x2a')](function(_0x1befbd){if(_0x1befbd){var _0x402af4=_0x1befbd[_0x745c('0xd9')]({'plain':!![]});fs[_0x745c('0xda')](_0x58c444);var _0x415a10={'channel':_0x745c('0xdb'),'account':_0x402af4[_0x745c('0xd7')][_0x745c('0x2d')],'agent':_0x402af4['Owner']?_0x402af4['Owner'][_0x745c('0x31')]:_0x745c('0xdc'),'createdAt':moment(_0x402af4[_0x745c('0x81')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x745c('0x9c')](),'closedAt':_0x402af4[_0x745c('0x3b')]?moment(_0x402af4['closedAt'])[_0x745c('0xc4')](_0x745c('0xdd'))[_0x745c('0x9c')]():'','disposition':_0x402af4[_0x745c('0xde')],'messages':_(_0x402af4[_0x745c('0xdf')])['filter']({'secret':![]})[_0x745c('0x30')](function(_0x1211bd){return{'date':moment(_0x1211bd[_0x745c('0x81')])[_0x745c('0xc4')]('YYYY-MM-DD\x20HH:mm:ss')[_0x745c('0x9c')](),'sender':_0x1211bd[_0x745c('0xe0')]===_0x745c('0xe1')?_0x1211bd[_0x745c('0xd4')]?_0x1211bd[_0x745c('0xd4')]['fullname']:_0x745c('0xe2'):_0x1211bd[_0x745c('0x69')][_0x745c('0xd5')]+(_0x1211bd['Contact']['lastName']?'\x20'+_0x1211bd[_0x745c('0x69')][_0x745c('0xe3')]:''),'body':_0x1211bd[_0x745c('0x7a')],'direction':_0x1211bd[_0x745c('0xe0')]==='out'?'A':'C','secret':_0x1211bd[_0x745c('0xd6')],'read':_0x1211bd[_0x745c('0x85')]};})['value']()};return ejs[_0x745c('0xe4')](path[_0x745c('0xd0')](config['root'],_0x745c('0xe5'),_0x745c('0xe6'),_0x745c('0xe7')),{'interaction':_0x415a10})['then'](function(_0x566113){var _0x217b29=path[_0x745c('0xd0')](_0x58c444,_0x745c('0xe8')+_0x402af4['id']+'-'+_0x577239+_0x745c('0xe9'));var _0x4b8c18={'path':_0x217b29,'channel':_0x745c('0xdb'),'interactionId':_0x402af4['id']};return pdf['createPdfFromHTML'](_0x566113,_0x4b8c18);})[_0x745c('0x2a')](function(){return new BPromise(function(_0x3ab9fb,_0x288363){zipdir(_0x58c444,{'saveTo':_0x2e7488},function(_0x52f115,_0xb26fba){if(_0x52f115)return _0x288363(_0x52f115);return _0x3ab9fb(_0xb26fba);});})[_0x745c('0x2a')](function(){return new BPromise(function(_0xb76492,_0x54a0cb){rimraf(_0x58c444,function(_0x4631a5){if(_0x4631a5)_0x54a0cb(_0x4631a5);return _0xb76492();});});})['then'](function(){return _0x19f464[_0x745c('0xce')](_0x2e7488,_0x420969,function(_0xc78e7f){if(_0xc78e7f){console[_0x745c('0xea')](_0x745c('0xeb'),_0xc78e7f);}else{fs[_0x745c('0xec')](_0x2e7488);}});});});}else{return _0x19f464['sendStatus'](0xc8);}})['catch'](handleError(_0x19f464,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 06703df..162fa49 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 _0xab40=['remove','then','setDataValue','Users','unreadMessages','length','emit','catch','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x41841e,_0x4d2d54){var _0xb709b6=function(_0xf96093){while(--_0xf96093){_0x41841e['push'](_0x41841e['shift']());}};_0xb709b6(++_0x4d2d54);}(_0xab40,0xcd));var _0x0ab4=function(_0x4b53d4,_0x112661){_0x4b53d4=_0x4b53d4-0x0;var _0x15d654=_0xab40[_0x4b53d4];return _0x15d654;};'use strict';var EventEmitter=require(_0x0ab4('0x0'));var SmsInteraction=require(_0x0ab4('0x1'))['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x0ab4('0x2')](0x0);var events={'afterCreate':_0x0ab4('0x3'),'afterUpdate':_0x0ab4('0x4'),'afterDestroy':_0x0ab4('0x5')};function emitEvent(_0x14634a){return function(_0x57fac1,_0x5f01aa,_0x28b17a){_0x57fac1['getUsers']({'attributes':['id'],'raw':!![]})[_0x0ab4('0x6')](function(_0x46d16a){_0x57fac1[_0x0ab4('0x7')](_0x0ab4('0x8'),_0x46d16a['map'](function(_0x55263d){return{'id':_0x55263d['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x57fac1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0ab4('0x6')](function(_0x30e726){_0x57fac1[_0x0ab4('0x7')](_0x0ab4('0x9'),_0x30e726[_0x0ab4('0xa')]);SmsInteractionEvents[_0x0ab4('0xb')](_0x14634a+':'+_0x57fac1['id'],_0x57fac1);SmsInteractionEvents[_0x0ab4('0xb')](_0x14634a,_0x57fac1);_0x28b17a(null);})[_0x0ab4('0xc')](_0x28b17a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x0ab4('0xd')]=SmsInteractionEvents; \ No newline at end of file +var _0xfb11=['setMaxListeners','update','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','emit','catch','hook','exports','events','SmsInteraction','../../mysqldb'];(function(_0x54a229,_0x479dd1){var _0x36232e=function(_0x48a4d3){while(--_0x48a4d3){_0x54a229['push'](_0x54a229['shift']());}};_0x36232e(++_0x479dd1);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xfb11[_0x373dee];return _0x46798f;};'use strict';var EventEmitter=require(_0x1fb1('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x1fb1('0x1')];var SmsMessage=require(_0x1fb1('0x2'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x1fb1('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1fb1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x190f74){return function(_0x2ae20f,_0x5af469,_0x25d44f){_0x2ae20f[_0x1fb1('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1859da){_0x2ae20f[_0x1fb1('0x6')](_0x1fb1('0x7'),_0x1859da[_0x1fb1('0x8')](function(_0x161e1b){return{'id':_0x161e1b['id']};}));return SmsMessage[_0x1fb1('0x9')]({'where':{'SmsInteractionId':_0x2ae20f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1fb1('0xa')](function(_0x416625){_0x2ae20f[_0x1fb1('0x6')](_0x1fb1('0xb'),_0x416625['length']);SmsInteractionEvents[_0x1fb1('0xc')](_0x190f74+':'+_0x2ae20f['id'],_0x2ae20f);SmsInteractionEvents['emit'](_0x190f74,_0x2ae20f);_0x25d44f(null);})[_0x1fb1('0xd')](_0x25d44f(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x1fb1('0xe')](e,emitEvent(event));}}module[_0x1fb1('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 2c86549..6f2f627 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 _0xbd44=['../../config/environment','./smsInteraction.attributes','exports','SmsInteraction','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x574c48,_0x332df7){var _0x5ed59d=function(_0x1c2310){while(--_0x1c2310){_0x574c48['push'](_0x574c48['shift']());}};_0x5ed59d(++_0x332df7);}(_0xbd44,0xfd));var _0x4bd4=function(_0x43c6b1,_0x23e89c){_0x43c6b1=_0x43c6b1-0x0;var _0x358fae=_0xbd44[_0x43c6b1];return _0x358fae;};'use strict';var _=require(_0x4bd4('0x0'));var util=require('util');var logger=require(_0x4bd4('0x1'))(_0x4bd4('0x2'));var moment=require(_0x4bd4('0x3'));var BPromise=require(_0x4bd4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4bd4('0x5'));var rimraf=require(_0x4bd4('0x6'));var config=require(_0x4bd4('0x7'));var attributes=require(_0x4bd4('0x8'));module[_0x4bd4('0x9')]=function(_0x39e5e8,_0x2b05a4){return _0x39e5e8['define'](_0x4bd4('0xa'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xcbf40a,_0x4057a4,_0x441e96){if(_0xcbf40a['changed']('closed')){_0xcbf40a[_0x4bd4('0xb')]=moment()['format'](_0x4bd4('0xc'));}_0x441e96(null,_0xcbf40a);}}});}; \ No newline at end of file +var _0xbe33=['changed','closedAt','format','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions'];(function(_0x36c967,_0x82570f){var _0x27928e=function(_0x3d82aa){while(--_0x3d82aa){_0x36c967['push'](_0x36c967['shift']());}};_0x27928e(++_0x82570f);}(_0xbe33,0x153));var _0x3be3=function(_0x470252,_0x457603){_0x470252=_0x470252-0x0;var _0xeec8b4=_0xbe33[_0x470252];return _0xeec8b4;};'use strict';var _=require(_0x3be3('0x0'));var util=require(_0x3be3('0x1'));var logger=require(_0x3be3('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3be3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3be3('0x4'));var rimraf=require(_0x3be3('0x5'));var config=require(_0x3be3('0x6'));var attributes=require(_0x3be3('0x7'));module[_0x3be3('0x8')]=function(_0x2f5742,_0x34109d){return _0x2f5742['define'](_0x3be3('0x9'),attributes,{'tableName':_0x3be3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x996b04,_0x1804d1,_0xcb55a1){if(_0x996b04[_0x3be3('0xb')]('closed')){_0x996b04[_0x3be3('0xc')]=moment()[_0x3be3('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0xcb55a1(null,_0x996b04);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 5b26df5..13cf39e 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 _0xb8ac=['register','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','limit','catch','AddTagsToSmsInteraction','find','where','addTags','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0xd06d03,_0x45b393){var _0x547b95=function(_0x2821e0){while(--_0x2821e0){_0xd06d03['push'](_0xd06d03['shift']());}};_0x547b95(++_0x45b393);}(_0xb8ac,0x1b3));var _0xcb8a=function(_0x3338e3,_0x141e7b){_0x3338e3=_0x3338e3-0x0;var _0x6ca671=_0xb8ac[_0x3338e3];return _0x6ca671;};'use strict';var _=require(_0xcb8a('0x0'));var util=require(_0xcb8a('0x1'));var moment=require(_0xcb8a('0x2'));var BPromise=require(_0xcb8a('0x3'));var rs=require(_0xcb8a('0x4'));var fs=require('fs');var Redis=require(_0xcb8a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xcb8a('0x6'));var logger=require(_0xcb8a('0x7'))(_0xcb8a('0x8'));var config=require(_0xcb8a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xcb8a('0xa')][_0xcb8a('0xb')]({'port':0x232a});config[_0xcb8a('0xc')]=_[_0xcb8a('0xd')](config[_0xcb8a('0xc')],{'host':_0xcb8a('0xe'),'port':0x18eb});var socket=require(_0xcb8a('0xf'))(new Redis(config[_0xcb8a('0xc')]));require('./smsInteraction.socket')[_0xcb8a('0x10')](socket);function respondWithRpcPromise(_0x1412a8,_0x11ff48,_0x4bd24f){return new BPromise(function(_0x3d5035,_0x1961a0){return client['request'](_0x1412a8,_0x4bd24f)[_0xcb8a('0x11')](function(_0x223a07){logger[_0xcb8a('0x12')](_0xcb8a('0x13'),_0x11ff48,_0xcb8a('0x14'));logger[_0xcb8a('0x15')](_0xcb8a('0x16'),_0x11ff48,_0xcb8a('0x14'),JSON[_0xcb8a('0x17')](_0x223a07));if(_0x223a07[_0xcb8a('0x18')]){if(_0x223a07[_0xcb8a('0x18')][_0xcb8a('0x19')]===0x1f4){logger[_0xcb8a('0x18')](_0xcb8a('0x13'),_0x11ff48,_0x223a07[_0xcb8a('0x18')][_0xcb8a('0x1a')]);return _0x1961a0(_0x223a07[_0xcb8a('0x18')][_0xcb8a('0x1a')]);}logger[_0xcb8a('0x18')](_0xcb8a('0x13'),_0x11ff48,_0x223a07[_0xcb8a('0x18')]['message']);return _0x3d5035(_0x223a07[_0xcb8a('0x18')]['message']);}else{logger[_0xcb8a('0x12')](_0xcb8a('0x13'),_0x11ff48,'request\x20sent');_0x3d5035(_0x223a07['result'][_0xcb8a('0x1a')]);}})['catch'](function(_0x276d3b){logger[_0xcb8a('0x18')](_0xcb8a('0x13'),_0x11ff48,_0x276d3b);_0x1961a0(_0x276d3b);});});}exports[_0xcb8a('0x1b')]=function(_0x338e03){var _0x158ab8=this;return new Promise(function(_0x579cd3,_0x7ecbf0){return db[_0xcb8a('0x1c')][_0xcb8a('0x1d')](_0x338e03[_0xcb8a('0x1e')],{'raw':_0x338e03['options']?_0x338e03[_0xcb8a('0x1f')][_0xcb8a('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x338e03['options']?_0x338e03[_0xcb8a('0x1f')]['where']||null:null,'attributes':_0x338e03[_0xcb8a('0x1f')]?_0x338e03[_0xcb8a('0x1f')]['attributes']||null:null,'limit':_0x338e03[_0xcb8a('0x1f')]?_0x338e03[_0xcb8a('0x1f')][_0xcb8a('0x21')]||null:null})[_0xcb8a('0x11')](function(_0x3ea133){logger[_0xcb8a('0x12')](_0xcb8a('0x1b'),_0x338e03);logger[_0xcb8a('0x15')]('UpdateSmsInteraction',_0x338e03,JSON['stringify'](_0x3ea133));_0x579cd3(_0x3ea133);})[_0xcb8a('0x22')](function(_0x5bea28){logger[_0xcb8a('0x18')](_0xcb8a('0x1b'),_0x5bea28[_0xcb8a('0x1a')],_0x338e03);_0x7ecbf0(_0x158ab8[_0xcb8a('0x18')](0x1f4,_0x5bea28[_0xcb8a('0x1a')]));});});};exports[_0xcb8a('0x23')]=function(_0x41f24a){return new Promise(function(_0x3aa288,_0x301103){return db[_0xcb8a('0x1c')][_0xcb8a('0x24')]({'where':_0x41f24a['options']?_0x41f24a[_0xcb8a('0x1f')][_0xcb8a('0x25')]||null:null})[_0xcb8a('0x11')](function(_0x38d423){if(_0x38d423){return _0x38d423[_0xcb8a('0x26')](_0x41f24a[_0xcb8a('0x1e')]['ids'],_['omit'](_0x41f24a[_0xcb8a('0x1e')],['ids','id'])||{});}})[_0xcb8a('0x27')](function(_0x565d3f){logger[_0xcb8a('0x12')](_0xcb8a('0x28'),_0x41f24a);logger[_0xcb8a('0x15')]('AddTags',_0x41f24a,JSON['stringify'](_0x565d3f));_0x3aa288(_0x565d3f);})['catch'](function(_0x16730f){logger[_0xcb8a('0x18')](_0xcb8a('0x28'),_0x16730f[_0xcb8a('0x1a')],_0x41f24a);_0x301103(_this[_0xcb8a('0x18')](0x1f4,_0x16730f[_0xcb8a('0x1a')]));});});}; \ No newline at end of file +var _0xc100=['message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','where','attributes','AddTagsToSmsInteraction','find','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x52e0da,_0x46546d){var _0x3490ec=function(_0x426afd){while(--_0x426afd){_0x52e0da['push'](_0x52e0da['shift']());}};_0x3490ec(++_0x46546d);}(_0xc100,0x1f0));var _0x0c10=function(_0x37a9d7,_0x2b6fde){_0x37a9d7=_0x37a9d7-0x0;var _0x1343d3=_0xc100[_0x37a9d7];return _0x1343d3;};'use strict';var _=require('lodash');var util=require(_0x0c10('0x0'));var moment=require(_0x0c10('0x1'));var BPromise=require(_0x0c10('0x2'));var rs=require(_0x0c10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c10('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0c10('0x5'))(_0x0c10('0x6'));var config=require(_0x0c10('0x7'));var jayson=require(_0x0c10('0x8'));var client=jayson[_0x0c10('0x9')]['http']({'port':0x232a});config[_0x0c10('0xa')]=_['defaults'](config['redis'],{'host':_0x0c10('0xb'),'port':0x18eb});var socket=require(_0x0c10('0xc'))(new Redis(config[_0x0c10('0xa')]));require(_0x0c10('0xd'))[_0x0c10('0xe')](socket);function respondWithRpcPromise(_0x589cb9,_0x47b2d7,_0x3dea8e){return new BPromise(function(_0x1b5916,_0x2c1dac){return client[_0x0c10('0xf')](_0x589cb9,_0x3dea8e)[_0x0c10('0x10')](function(_0x662938){logger[_0x0c10('0x11')](_0x0c10('0x12'),_0x47b2d7,_0x0c10('0x13'));logger[_0x0c10('0x14')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x47b2d7,_0x0c10('0x13'),JSON[_0x0c10('0x15')](_0x662938));if(_0x662938[_0x0c10('0x16')]){if(_0x662938[_0x0c10('0x16')][_0x0c10('0x17')]===0x1f4){logger[_0x0c10('0x16')](_0x0c10('0x12'),_0x47b2d7,_0x662938[_0x0c10('0x16')][_0x0c10('0x18')]);return _0x2c1dac(_0x662938['error'][_0x0c10('0x18')]);}logger[_0x0c10('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x47b2d7,_0x662938[_0x0c10('0x16')]['message']);return _0x1b5916(_0x662938[_0x0c10('0x16')]['message']);}else{logger[_0x0c10('0x11')](_0x0c10('0x12'),_0x47b2d7,'request\x20sent');_0x1b5916(_0x662938[_0x0c10('0x19')]['message']);}})[_0x0c10('0x1a')](function(_0x81b719){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x47b2d7,_0x81b719);_0x2c1dac(_0x81b719);});});}exports[_0x0c10('0x1b')]=function(_0x1df83c){var _0x1449f6=this;return new Promise(function(_0x276cbd,_0x44d7ef){return db[_0x0c10('0x1c')][_0x0c10('0x1d')](_0x1df83c[_0x0c10('0x1e')],{'raw':_0x1df83c[_0x0c10('0x1f')]?_0x1df83c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1df83c[_0x0c10('0x1f')]?_0x1df83c['options'][_0x0c10('0x20')]||null:null,'attributes':_0x1df83c[_0x0c10('0x1f')]?_0x1df83c[_0x0c10('0x1f')][_0x0c10('0x21')]||null:null,'limit':_0x1df83c[_0x0c10('0x1f')]?_0x1df83c[_0x0c10('0x1f')]['limit']||null:null})[_0x0c10('0x10')](function(_0x4b1946){logger['info'](_0x0c10('0x1b'),_0x1df83c);logger[_0x0c10('0x14')](_0x0c10('0x1b'),_0x1df83c,JSON[_0x0c10('0x15')](_0x4b1946));_0x276cbd(_0x4b1946);})[_0x0c10('0x1a')](function(_0x18e768){logger['error'](_0x0c10('0x1b'),_0x18e768[_0x0c10('0x18')],_0x1df83c);_0x44d7ef(_0x1449f6[_0x0c10('0x16')](0x1f4,_0x18e768['message']));});});};exports[_0x0c10('0x22')]=function(_0x3e0d58){return new Promise(function(_0x33210c,_0x166d93){return db['SmsInteraction'][_0x0c10('0x23')]({'where':_0x3e0d58[_0x0c10('0x1f')]?_0x3e0d58['options'][_0x0c10('0x20')]||null:null})['then'](function(_0x599b60){if(_0x599b60){return _0x599b60['addTags'](_0x3e0d58[_0x0c10('0x1e')][_0x0c10('0x24')],_[_0x0c10('0x25')](_0x3e0d58[_0x0c10('0x1e')],[_0x0c10('0x24'),'id'])||{});}})[_0x0c10('0x26')](function(_0x538e9b){logger[_0x0c10('0x11')](_0x0c10('0x27'),_0x3e0d58);logger[_0x0c10('0x14')](_0x0c10('0x27'),_0x3e0d58,JSON[_0x0c10('0x15')](_0x538e9b));_0x33210c(_0x538e9b);})[_0x0c10('0x1a')](function(_0x25db26){logger[_0x0c10('0x16')](_0x0c10('0x27'),_0x25db26[_0x0c10('0x18')],_0x3e0d58);_0x166d93(_this['error'](0x1f4,_0x25db26[_0x0c10('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 61021e0..9cf70c1 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 _0x88a5=['smsInteraction:','./smsInteraction.events','save','remove','update','emit','register','length'];(function(_0x7b6352,_0x548a1f){var _0x2bec47=function(_0x578a36){while(--_0x578a36){_0x7b6352['push'](_0x7b6352['shift']());}};_0x2bec47(++_0x548a1f);}(_0x88a5,0x151));var _0x588a=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x88a5[_0x19e35c];return _0x3e1fe8;};'use strict';var SmsInteractionEvents=require(_0x588a('0x0'));var events=[_0x588a('0x1'),_0x588a('0x2'),_0x588a('0x3')];function createListener(_0x431bc4,_0x4c6633){return function(_0x32be34){_0x4c6633[_0x588a('0x4')](_0x431bc4,_0x32be34);};}function removeListener(_0x1f0627,_0x21d7ee){return function(){SmsInteractionEvents['removeListener'](_0x1f0627,_0x21d7ee);};}exports[_0x588a('0x5')]=function(_0x58ecac){for(var _0x4328ad=0x0,_0x56f8c9=events[_0x588a('0x6')];_0x4328ad<_0x56f8c9;_0x4328ad++){var _0xdb6a36=events[_0x4328ad];var _0x53a4f4=createListener(_0x588a('0x7')+_0xdb6a36,_0x58ecac);SmsInteractionEvents['on'](_0xdb6a36,_0x53a4f4);}}; \ No newline at end of file +var _0x9798=['length','smsInteraction:','./smsInteraction.events','save','emit','removeListener'];(function(_0x3905ae,_0x416f37){var _0x1ec6ac=function(_0x5740aa){while(--_0x5740aa){_0x3905ae['push'](_0x3905ae['shift']());}};_0x1ec6ac(++_0x416f37);}(_0x9798,0x9e));var _0x8979=function(_0x50ebe2,_0x18dec9){_0x50ebe2=_0x50ebe2-0x0;var _0x300756=_0x9798[_0x50ebe2];return _0x300756;};'use strict';var SmsInteractionEvents=require(_0x8979('0x0'));var events=[_0x8979('0x1'),'remove','update'];function createListener(_0x907314,_0x289cb4){return function(_0x121f0e){_0x289cb4[_0x8979('0x2')](_0x907314,_0x121f0e);};}function removeListener(_0x410bbe,_0xd925be){return function(){SmsInteractionEvents[_0x8979('0x3')](_0x410bbe,_0xd925be);};}exports['register']=function(_0x3931e2){for(var _0x545601=0x0,_0x559301=events[_0x8979('0x4')];_0x545601<_0x559301;_0x545601++){var _0x3460c2=events[_0x545601];var _0x2898bb=createListener(_0x8979('0x5')+_0x3460c2,_0x3931e2);SmsInteractionEvents['on'](_0x3460c2,_0x2898bb);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index a57c066..e6fa415 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 _0xbdd4=['status','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./smsMessage.controller','get','index','describe','/:id','isAuthenticated','post','tracked','sms','smsmessage:create','/:id/status'];(function(_0x1ec8f9,_0x22f5e7){var _0x17cd3d=function(_0x156ad2){while(--_0x156ad2){_0x1ec8f9['push'](_0x1ec8f9['shift']());}};_0x17cd3d(++_0x22f5e7);}(_0xbdd4,0x14e));var _0x4bdd=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xbdd4[_0x397e5f];return _0x5302b8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4bdd('0x0'));var timeout=require(_0x4bdd('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4bdd('0x2'));var auth=require(_0x4bdd('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x4bdd('0x4'));var controller=require(_0x4bdd('0x5'));router[_0x4bdd('0x6')]('/',auth['isAuthenticated'](),controller[_0x4bdd('0x7')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x4bdd('0x8')]);router['get'](_0x4bdd('0x9'),auth[_0x4bdd('0xa')](),controller['show']);router[_0x4bdd('0xb')]('/',auth[_0x4bdd('0xa')](),interaction[_0x4bdd('0xc')](_0x4bdd('0xd'),_0x4bdd('0xe')),controller['create']);router[_0x4bdd('0xb')](_0x4bdd('0xf'),controller[_0x4bdd('0x10')]);router[_0x4bdd('0x11')](_0x4bdd('0x9'),auth['isAuthenticated'](),controller[_0x4bdd('0x12')]);router[_0x4bdd('0x11')](_0x4bdd('0x13'),auth[_0x4bdd('0xa')](),controller[_0x4bdd('0x14')]);router[_0x4bdd('0x11')](_0x4bdd('0x15'),auth[_0x4bdd('0xa')](),controller[_0x4bdd('0x16')]);router['delete']('/:id',auth[_0x4bdd('0xa')](),controller[_0x4bdd('0x17')]);module[_0x4bdd('0x18')]=router; \ No newline at end of file +var _0x6a21=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','describe','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','/:id','update','/:id/accept','accept','delete','exports','util'];(function(_0x32486d,_0x373e8b){var _0x241a4d=function(_0x409da6){while(--_0x409da6){_0x32486d['push'](_0x32486d['shift']());}};_0x241a4d(++_0x373e8b);}(_0x6a21,0xf9));var _0x16a2=function(_0x29db30,_0x3da7ce){_0x29db30=_0x29db30-0x0;var _0x1185f0=_0x6a21[_0x29db30];return _0x1185f0;};'use strict';var multer=require('multer');var util=require(_0x16a2('0x0'));var path=require(_0x16a2('0x1'));var timeout=require('connect-timeout');var express=require(_0x16a2('0x2'));var router=express[_0x16a2('0x3')]();var fs_extra=require(_0x16a2('0x4'));var auth=require(_0x16a2('0x5'));var interaction=require(_0x16a2('0x6'));var config=require('../../config/environment');var controller=require('./smsMessage.controller');router[_0x16a2('0x7')]('/',auth[_0x16a2('0x8')](),controller['index']);router[_0x16a2('0x7')]('/describe',auth[_0x16a2('0x8')](),controller[_0x16a2('0x9')]);router[_0x16a2('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x16a2('0xa')]);router[_0x16a2('0xb')]('/',auth[_0x16a2('0x8')](),interaction[_0x16a2('0xc')](_0x16a2('0xd'),_0x16a2('0xe')),controller[_0x16a2('0xf')]);router[_0x16a2('0xb')](_0x16a2('0x10'),controller[_0x16a2('0x11')]);router[_0x16a2('0x12')](_0x16a2('0x13'),auth[_0x16a2('0x8')](),controller[_0x16a2('0x14')]);router[_0x16a2('0x12')](_0x16a2('0x15'),auth['isAuthenticated'](),controller[_0x16a2('0x16')]);router['put']('/:id/reject',auth[_0x16a2('0x8')](),controller['reject']);router[_0x16a2('0x17')](_0x16a2('0x13'),auth[_0x16a2('0x8')](),controller['destroy']);module[_0x16a2('0x18')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 7d93c4c..4967821 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 _0x8812=['out','STRING','DATE','BOOLEAN','sequelize','exports','TEXT','medium','ENUM'];(function(_0x28bfc4,_0x19ca98){var _0x32f3ae=function(_0x15fbc8){while(--_0x15fbc8){_0x28bfc4['push'](_0x28bfc4['shift']());}};_0x32f3ae(++_0x19ca98);}(_0x8812,0x1cf));var _0x2881=function(_0x2cb8dc,_0x2758ba){_0x2cb8dc=_0x2cb8dc-0x0;var _0xfedef6=_0x8812[_0x2cb8dc];return _0xfedef6;};'use strict';var Sequelize=require(_0x2881('0x0'));module[_0x2881('0x1')]={'body':{'type':Sequelize[_0x2881('0x2')](_0x2881('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x2881('0x4')]('in',_0x2881('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x2881('0x6')]},'readAt':{'type':Sequelize[_0x2881('0x7')]},'secret':{'type':Sequelize[_0x2881('0x8')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x2881('0x6')]},'providerResponse':{'type':Sequelize[_0x2881('0x2')]}}; \ No newline at end of file +var _0x92a4=['ENUM','out','STRING','DATE','TEXT','sequelize','medium'];(function(_0x268111,_0x31c1f9){var _0x54e72a=function(_0x16e79c){while(--_0x16e79c){_0x268111['push'](_0x268111['shift']());}};_0x54e72a(++_0x31c1f9);}(_0x92a4,0xb4));var _0x492a=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x92a4[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x492a('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x492a('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x492a('0x2')]('in',_0x492a('0x3')),'defaultValue':_0x492a('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x492a('0x4')](0xbe)},'phone':{'type':Sequelize[_0x492a('0x4')]},'readAt':{'type':Sequelize[_0x492a('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x492a('0x4')]},'providerResponse':{'type':Sequelize[_0x492a('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 40cf2e9..1e1b295 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 _0x89fb=['SmsInteraction','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','contact','User','motionChannel','rejectmessage','SmsAccountId','debug','received\x20delivery\x20report\x20from','inspect','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','indexOf','sent','delivered','Status','infobip','results','groupName','DELIVERED','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','client','http','info','SmsMessage,\x20%s,\x20%s','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','reject','save','then','destroy','stack','name','send','map','SmsMessage','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','rawAttributes','include','options','find','create','body','update','describe','../../config/logger','sms-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','isNil','read1stAt','interaction','user','role','null','acceptMessage','sequelize','QueryTypes','SELECT','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x89fb,0x14b));var _0xb89f=function(_0x5a152b,_0x341c18){_0x5a152b=_0x5a152b-0x0;var _0x25c8b1=_0x89fb[_0x5a152b];return _0x25c8b1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb89f('0x0'));var zipdir=require(_0xb89f('0x1'));var jsonpatch=require(_0xb89f('0x2'));var rp=require(_0xb89f('0x3'));var moment=require(_0xb89f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb89f('0x5'));var util=require(_0xb89f('0x6'));var path=require(_0xb89f('0x7'));var sox=require(_0xb89f('0x8'));var csv=require(_0xb89f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb89f('0xa'));var _=require('lodash');var squel=require(_0xb89f('0xb'));var crypto=require('crypto');var jsforce=require(_0xb89f('0xc'));var deskjs=require(_0xb89f('0xd'));var toCsv=require(_0xb89f('0x9'));var querystring=require('querystring');var Papa=require(_0xb89f('0xe'));var Redis=require(_0xb89f('0xf'));var authService=require(_0xb89f('0x10'));var qs=require(_0xb89f('0x11'));var as=require(_0xb89f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb89f('0x13'));var utils=require(_0xb89f('0x14'));var config=require(_0xb89f('0x15'));var licenseUtil=require(_0xb89f('0x16'));var db=require(_0xb89f('0x17'))['db'];config['redis']=_[_0xb89f('0x18')](config[_0xb89f('0x19')],{'host':_0xb89f('0x1a'),'port':0x18eb});var socket=require(_0xb89f('0x1b'))(new Redis(config[_0xb89f('0x19')]));require(_0xb89f('0x1c'))['register'](socket);var jayson=require(_0xb89f('0x1d'));var client=jayson[_0xb89f('0x1e')][_0xb89f('0x1f')]({'port':0x232c});var client9002=jayson[_0xb89f('0x1e')][_0xb89f('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x10ffba,_0xb33497,_0x4d7a92,_0x243388){return new BPromise(function(_0xfc48d,_0x236c5b){var _0x43b231=_0x243388||client;return _0x43b231['request'](_0x10ffba,_0x4d7a92)['then'](function(_0x77a882){logger[_0xb89f('0x20')](_0xb89f('0x21'),_0xb33497,'request\x20sent');logger['debug'](_0xb89f('0x22'),_0xb33497,_0xb89f('0x23'),JSON[_0xb89f('0x24')](_0x77a882));if(_0x77a882[_0xb89f('0x25')]){if(_0x77a882[_0xb89f('0x25')][_0xb89f('0x26')]===0x1f4){logger[_0xb89f('0x25')]('SmsMessage,\x20%s,\x20%s',_0xb33497,_0x77a882['error']['message']);return _0x236c5b(_0x77a882['error']['message']);}logger[_0xb89f('0x25')]('SmsMessage,\x20%s,\x20%s',_0xb33497,_0x77a882[_0xb89f('0x25')][_0xb89f('0x27')]);return _0xfc48d(_0x77a882[_0xb89f('0x25')][_0xb89f('0x27')]);}else{logger[_0xb89f('0x20')](_0xb89f('0x21'),_0xb33497,'request\x20sent');_0xfc48d(_0x77a882[_0xb89f('0x28')][_0xb89f('0x27')]);}})[_0xb89f('0x29')](function(_0x3b3829){logger[_0xb89f('0x25')](_0xb89f('0x21'),_0xb33497,_0x3b3829);_0x236c5b(_0x3b3829);});});}function respondWithStatusCode(_0x1934e8,_0x177db8){_0x177db8=_0x177db8||0xcc;return function(_0x4bef2e){if(_0x4bef2e){return _0x1934e8[_0xb89f('0x2a')](_0x177db8);}return _0x1934e8[_0xb89f('0x2b')](_0x177db8)[_0xb89f('0x2c')]();};}function respondWithResult(_0x38983e,_0x1defa1){_0x1defa1=_0x1defa1||0xc8;return function(_0x22195c){if(_0x22195c){return _0x38983e['status'](_0x1defa1)[_0xb89f('0x2d')](_0x22195c);}};}function respondWithFilteredResult(_0x22b15f,_0x289d88){return function(_0x2ab40c){if(_0x2ab40c){var _0x4eb8da=typeof _0x289d88['offset']==='undefined'&&typeof _0x289d88[_0xb89f('0x2e')]===_0xb89f('0x2f');var _0x3ce71d=_0x2ab40c[_0xb89f('0x30')];var _0x283091=_0x4eb8da?0x0:_0x289d88[_0xb89f('0x31')];var _0x215925=_0x4eb8da?_0x2ab40c[_0xb89f('0x30')]:_0x289d88[_0xb89f('0x31')]+_0x289d88['limit'];var _0x17076d;if(_0x215925>=_0x3ce71d){_0x215925=_0x3ce71d;_0x17076d=0xc8;}else{_0x17076d=0xce;}_0x22b15f[_0xb89f('0x2b')](_0x17076d);return _0x22b15f['set'](_0xb89f('0x32'),_0x283091+'-'+_0x215925+'/'+_0x3ce71d)[_0xb89f('0x2d')](_0x2ab40c);}return null;};}function patchUpdates(_0x11ddbc){return function(_0xa0833d){try{jsonpatch['apply'](_0xa0833d,_0x11ddbc,!![]);}catch(_0x39cd78){return BPromise[_0xb89f('0x33')](_0x39cd78);}return _0xa0833d[_0xb89f('0x34')]();};}function saveUpdates(_0x11cef3,_0x4cda3d){return function(_0x4c2695){if(_0x4c2695){return _0x4c2695['update'](_0x11cef3)[_0xb89f('0x35')](function(_0x1cc704){return _0x1cc704;});}return null;};}function removeEntity(_0x3909a8,_0x4a5c19){return function(_0x465e68){if(_0x465e68){return _0x465e68[_0xb89f('0x36')]()[_0xb89f('0x35')](function(){_0x3909a8['status'](0xcc)[_0xb89f('0x2c')]();});}};}function handleEntityNotFound(_0x18578f,_0x19ad82){return function(_0x3fa6e6){if(!_0x3fa6e6){_0x18578f[_0xb89f('0x2a')](0x194);}return _0x3fa6e6;};}function handleError(_0x3a27a9,_0x3e49f4){_0x3e49f4=_0x3e49f4||0x1f4;return function(_0x4d70d2){logger[_0xb89f('0x25')](_0x4d70d2[_0xb89f('0x37')]);if(_0x4d70d2[_0xb89f('0x38')]){delete _0x4d70d2[_0xb89f('0x38')];}_0x3a27a9['status'](_0x3e49f4)[_0xb89f('0x39')](_0x4d70d2);};}exports['index']=function(_0x388606,_0x1bea30){var _0x5dc041={},_0x1b07b7={},_0x10ab12={'count':0x0,'rows':[]};var _0x2462cd=_[_0xb89f('0x3a')](db[_0xb89f('0x3b')]['rawAttributes'],function(_0x5d7b55){return{'name':_0x5d7b55[_0xb89f('0x3c')],'type':_0x5d7b55[_0xb89f('0x3d')][_0xb89f('0x3e')]};});_0x1b07b7[_0xb89f('0x3f')]=_[_0xb89f('0x3a')](_0x2462cd,_0xb89f('0x38'));_0x1b07b7['query']=_[_0xb89f('0x40')](_0x388606[_0xb89f('0x41')]);_0x1b07b7[_0xb89f('0x42')]=_[_0xb89f('0x43')](_0x1b07b7['model'],_0x1b07b7[_0xb89f('0x41')]);_0x5dc041[_0xb89f('0x44')]=_[_0xb89f('0x43')](_0x1b07b7['model'],qs[_0xb89f('0x45')](_0x388606[_0xb89f('0x41')][_0xb89f('0x45')]));_0x5dc041['attributes']=_0x5dc041[_0xb89f('0x44')][_0xb89f('0x46')]?_0x5dc041['attributes']:_0x1b07b7['model'];if(!_0x388606['query']['hasOwnProperty'](_0xb89f('0x47'))){_0x5dc041['limit']=qs[_0xb89f('0x2e')](_0x388606[_0xb89f('0x41')][_0xb89f('0x2e')]);_0x5dc041[_0xb89f('0x31')]=qs['offset'](_0x388606[_0xb89f('0x41')][_0xb89f('0x31')]);}_0x5dc041[_0xb89f('0x48')]=qs[_0xb89f('0x49')](_0x388606[_0xb89f('0x41')][_0xb89f('0x49')]);_0x5dc041[_0xb89f('0x4a')]=qs[_0xb89f('0x42')](_[_0xb89f('0x4b')](_0x388606[_0xb89f('0x41')],_0x1b07b7[_0xb89f('0x42')]),_0x2462cd);if(_0x388606[_0xb89f('0x41')][_0xb89f('0x4c')]){_0x5dc041['where']=_[_0xb89f('0x4d')](_0x5dc041[_0xb89f('0x4a')],{'$or':_[_0xb89f('0x3a')](_0x2462cd,function(_0x46370b){if(_0x46370b[_0xb89f('0x3d')]!==_0xb89f('0x4e')){var _0x3b028e={};_0x3b028e[_0x46370b['name']]={'$like':'%'+_0x388606[_0xb89f('0x41')]['filter']+'%'};return _0x3b028e;}})});}_0x5dc041=_[_0xb89f('0x4d')]({},_0x5dc041,_0x388606['options']);var _0x7b3c1b={'where':_0x5dc041[_0xb89f('0x4a')]};return db[_0xb89f('0x3b')]['count'](_0x7b3c1b)[_0xb89f('0x35')](function(_0x5d315b){_0x10ab12[_0xb89f('0x30')]=_0x5d315b;if(_0x388606[_0xb89f('0x41')][_0xb89f('0x4f')]){_0x5dc041['include']=[{'all':!![]}];}return db[_0xb89f('0x3b')][_0xb89f('0x50')](_0x5dc041);})['then'](function(_0x667859){_0x10ab12[_0xb89f('0x51')]=_0x667859;return _0x10ab12;})[_0xb89f('0x35')](respondWithFilteredResult(_0x1bea30,_0x5dc041))[_0xb89f('0x29')](handleError(_0x1bea30,null));};exports[_0xb89f('0x52')]=function(_0x3c5421,_0x29ad5f){var _0x30109e={'raw':!![],'where':{'id':_0x3c5421[_0xb89f('0x53')]['id']}},_0x61e636={};_0x61e636['model']=_['keys'](db[_0xb89f('0x3b')][_0xb89f('0x54')]);_0x61e636[_0xb89f('0x41')]=_[_0xb89f('0x40')](_0x3c5421['query']);_0x61e636['filters']=_[_0xb89f('0x43')](_0x61e636['model'],_0x61e636['query']);_0x30109e[_0xb89f('0x44')]=_['intersection'](_0x61e636[_0xb89f('0x3f')],qs[_0xb89f('0x45')](_0x3c5421[_0xb89f('0x41')][_0xb89f('0x45')]));_0x30109e[_0xb89f('0x44')]=_0x30109e['attributes'][_0xb89f('0x46')]?_0x30109e[_0xb89f('0x44')]:_0x61e636[_0xb89f('0x3f')];if(_0x3c5421[_0xb89f('0x41')][_0xb89f('0x4f')]){_0x30109e[_0xb89f('0x55')]=[{'all':!![]}];}_0x30109e=_['merge']({},_0x30109e,_0x3c5421[_0xb89f('0x56')]);return db[_0xb89f('0x3b')][_0xb89f('0x57')](_0x30109e)[_0xb89f('0x35')](handleEntityNotFound(_0x29ad5f,null))[_0xb89f('0x35')](respondWithResult(_0x29ad5f,null))[_0xb89f('0x29')](handleError(_0x29ad5f,null));};exports[_0xb89f('0x58')]=function(_0x496c1d,_0x1f19bb){return db[_0xb89f('0x3b')]['create'](_0x496c1d[_0xb89f('0x59')],{})[_0xb89f('0x35')](respondWithResult(_0x1f19bb,0xc9))['catch'](handleError(_0x1f19bb,null));};exports[_0xb89f('0x5a')]=function(_0x33cede,_0x2ce1a0){if(_0x33cede['body']['id']){delete _0x33cede['body']['id'];}return db[_0xb89f('0x3b')][_0xb89f('0x57')]({'where':{'id':_0x33cede['params']['id']}})[_0xb89f('0x35')](handleEntityNotFound(_0x2ce1a0,null))['then'](saveUpdates(_0x33cede[_0xb89f('0x59')],null))[_0xb89f('0x35')](respondWithResult(_0x2ce1a0,null))[_0xb89f('0x29')](handleError(_0x2ce1a0,null));};exports[_0xb89f('0x36')]=function(_0x4608d6,_0x448aea){return db['SmsMessage'][_0xb89f('0x57')]({'where':{'id':_0x4608d6[_0xb89f('0x53')]['id']}})['then'](handleEntityNotFound(_0x448aea,null))[_0xb89f('0x35')](removeEntity(_0x448aea,null))[_0xb89f('0x29')](handleError(_0x448aea,null));};exports['describe']=function(_0x4918c0,_0x11b8ff){return db[_0xb89f('0x3b')][_0xb89f('0x5b')]()['then'](respondWithResult(_0x11b8ff,null))[_0xb89f('0x29')](handleError(_0x11b8ff,null));};var interaction_log=require(_0xb89f('0x5c'))(_0xb89f('0x5d'));exports[_0xb89f('0x5e')]=function(_0x462da9,_0x5c1500,_0x5d8d92){var _0xd8727={'agent':{},'channel':'sms'};if(_0x462da9[_0xb89f('0x59')]['id']){delete _0x462da9['body']['id'];}_0x462da9[_0xb89f('0x59')][_0xb89f('0x5f')]=!![];_0x462da9[_0xb89f('0x59')][_0xb89f('0x60')]=moment()[_0xb89f('0x61')](_0xb89f('0x62'));_0x462da9[_0xb89f('0x59')]['UserId']=_0x462da9[_0xb89f('0x59')][_0xb89f('0x63')]||_0x462da9['user']['id'];_0xd8727[_0xb89f('0x64')]['id']=_0x462da9[_0xb89f('0x59')]['UserId'];return db[_0xb89f('0x3b')][_0xb89f('0x57')]({'where':{'id':_0x462da9[_0xb89f('0x53')]['id'],'UserId':null}})[_0xb89f('0x35')](handleEntityNotFound(_0x5c1500,null))['then'](saveUpdates(_0x462da9[_0xb89f('0x59')],null))[_0xb89f('0x35')](function(_0xa2cedd){if(_0xa2cedd){_0xd8727[_0xb89f('0x27')]=_0xa2cedd[_0xb89f('0x65')]({'plain':!![]});return db['SmsInteraction'][_0xb89f('0x57')]({'where':{'id':_0xa2cedd['SmsInteractionId']}});}return null;})[_0xb89f('0x35')](handleEntityNotFound(_0x5c1500,null))[_0xb89f('0x35')](function(_0x56117e){if(_0x56117e){return _0x56117e[_0xb89f('0x5a')]({'UserId':_0x462da9[_0xb89f('0x59')]['UserId'],'read1stAt':_[_0xb89f('0x66')](_0x56117e[_0xb89f('0x67')])?moment()[_0xb89f('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xb89f('0x35')](function(_0x2c489b){if(_0x2c489b){_0xd8727[_0xb89f('0x68')]=_0x2c489b['get']({'plain':!![]});interaction_log[_0xb89f('0x20')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x462da9[_0xb89f('0x69')]['id'],_0x462da9[_0xb89f('0x69')][_0xb89f('0x38')],_0x462da9[_0xb89f('0x69')][_0xb89f('0x6a')],_0xd8727['interaction']['id'],_0x462da9[_0xb89f('0x59')]?JSON[_0xb89f('0x24')](_0x462da9[_0xb89f('0x59')]):_0xb89f('0x6b'));return respondWithRpcPromise('AcceptMessage',_0xb89f('0x6c'),_0xd8727);}return null;})[_0xb89f('0x35')](function(_0x742e1a){var _0xccb9e1='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x742e1a['message']['ContactId'];return db[_0xb89f('0x6d')][_0xb89f('0x41')](_0xccb9e1,{'type':db['Sequelize'][_0xb89f('0x6e')][_0xb89f('0x6f')],'raw':!![]})[_0xb89f('0x35')](function(_0x4df87d){return _0x4df87d;});})[_0xb89f('0x35')](function(_0x31e97c){if(_0x31e97c){_0xd8727[_0xb89f('0x27')]['contact']=_0x31e97c[0x0];if(!_0x462da9[_0xb89f('0x59')][_0xb89f('0x63')])return;return db['User'][_0xb89f('0x57')]({'where':{'id':_0x462da9[_0xb89f('0x59')][_0xb89f('0x63')],'role':_0xb89f('0x64')},'attributes':['id',_0xb89f('0x38'),_0xb89f('0x70'),_0xb89f('0x71'),_0xb89f('0x72')],'raw':!![]});}return null;})[_0xb89f('0x35')](function(_0x489a73){if(!_0x489a73)return null;_0xd8727[_0xb89f('0x27')]['agent']=_0x489a73;return _0xd8727;})[_0xb89f('0x35')](function(_0x2024c0){if(_0x2024c0){if(_0x462da9[_0xb89f('0x59')][_0xb89f('0x73')]){_0xd8727[_0xb89f('0x27')][_0xb89f('0x74')]=util[_0xb89f('0x61')](_0xb89f('0x75'),_0x462da9[_0xb89f('0x69')][_0xb89f('0x38')]);_0xd8727[_0xb89f('0x27')][_0xb89f('0x76')]=_0xd8727[_0xb89f('0x76')];_0xd8727[_0xb89f('0x27')]['motionChannel']=_0xd8727['channel'];_0xd8727[_0xb89f('0x27')][_0xb89f('0x77')]=_0xb89f('0x5e');return respondWithRpcPromise(_0xb89f('0x78'),_0xb89f('0x78'),{'event':_0xb89f('0x79'),'message':_0xd8727[_0xb89f('0x27')]},client9002)[_0xb89f('0x35')](function(){return _0xd8727;});}return _0xd8727;}return null;})[_0xb89f('0x35')](respondWithResult(_0x5c1500,null))[_0xb89f('0x29')](handleError(_0x5c1500,null));};var interaction_log=require(_0xb89f('0x5c'))(_0xb89f('0x5d'));exports[_0xb89f('0x33')]=function(_0x174181,_0x414b56,_0x1a7060){var _0x3ffd8f={'agent':{},'channel':'sms'};if(_0x174181[_0xb89f('0x59')]['id']){delete _0x174181[_0xb89f('0x59')]['id'];}_0x174181[_0xb89f('0x59')][_0xb89f('0x63')]=_0x174181['body']['UserId']||_0x174181[_0xb89f('0x69')]['id'];_0x3ffd8f[_0xb89f('0x64')]['id']=_0x174181['body'][_0xb89f('0x63')];return db[_0xb89f('0x3b')][_0xb89f('0x57')]({'where':{'id':_0x174181[_0xb89f('0x53')]['id'],'UserId':null}})[_0xb89f('0x35')](handleEntityNotFound(_0x414b56,null))[_0xb89f('0x35')](function(_0x497a15){if(_0x497a15){_0x3ffd8f[_0xb89f('0x27')]=_0x497a15[_0xb89f('0x65')]({'plain':!![]});return db[_0xb89f('0x7a')][_0xb89f('0x57')]({'where':{'id':_0x497a15[_0xb89f('0x7b')]}});}return null;})['then'](handleEntityNotFound(_0x414b56,null))[_0xb89f('0x35')](function(_0x819aa4){if(_0x819aa4){_0x3ffd8f[_0xb89f('0x68')]=_0x819aa4[_0xb89f('0x65')]({'plain':!![]});interaction_log['info'](_0xb89f('0x7c'),_0x174181['user']['id'],_0x174181['user'][_0xb89f('0x38')],_0x174181[_0xb89f('0x69')][_0xb89f('0x6a')],_0x3ffd8f[_0xb89f('0x68')]['id'],_0x174181[_0xb89f('0x59')]?JSON['stringify'](_0x174181['body']):_0xb89f('0x6b'));return respondWithRpcPromise(_0xb89f('0x7d'),_0xb89f('0x7e'),_0x3ffd8f);}return null;})[_0xb89f('0x35')](function(_0x1c1aa1){var _0x2ada7=_0xb89f('0x7f')+_0x1c1aa1['message'][_0xb89f('0x80')];return db['sequelize']['query'](_0x2ada7,{'type':db[_0xb89f('0x81')][_0xb89f('0x6e')][_0xb89f('0x6f')],'raw':!![]})[_0xb89f('0x35')](function(_0x16defe){return _0x16defe;});})[_0xb89f('0x35')](function(_0x541467){if(_0x541467){_0x3ffd8f[_0xb89f('0x27')][_0xb89f('0x82')]=_0x541467[0x0];if(!_0x174181[_0xb89f('0x59')]['UserId'])return;return db[_0xb89f('0x83')][_0xb89f('0x57')]({'where':{'id':_0x174181[_0xb89f('0x59')][_0xb89f('0x63')],'role':_0xb89f('0x64')},'attributes':['id',_0xb89f('0x38'),'fullname',_0xb89f('0x71'),_0xb89f('0x72')],'raw':!![]});}return null;})[_0xb89f('0x35')](function(_0x1ddf08){if(!_0x1ddf08)return null;_0x3ffd8f[_0xb89f('0x27')][_0xb89f('0x64')]=_0x1ddf08;return _0x3ffd8f;})[_0xb89f('0x35')](function(_0x272011){if(_0x272011){_0x272011['message']['interface']=util[_0xb89f('0x61')](_0xb89f('0x75'),_0x174181[_0xb89f('0x69')]['name']);_0x272011[_0xb89f('0x27')][_0xb89f('0x76')]=_0x3ffd8f[_0xb89f('0x76')];_0x272011['message'][_0xb89f('0x84')]=_0x3ffd8f[_0xb89f('0x76')];_0x272011['message'][_0xb89f('0x77')]=_0xb89f('0x33');respondWithRpcPromise(_0xb89f('0x78'),_0xb89f('0x78'),{'event':_0xb89f('0x85'),'message':_0x272011['message']},client9002);return _0x3ffd8f;}return null;})[_0xb89f('0x35')](respondWithResult(_0x414b56,null))[_0xb89f('0x29')](handleError(_0x414b56,null));};exports[_0xb89f('0x2b')]=function(_0x207fed,_0x11ba25,_0x181ee2){if(_0x207fed[_0xb89f('0x59')]['id']){delete _0x207fed['body']['id'];}var _0x3bf1a3;return db[_0xb89f('0x3b')][_0xb89f('0x57')]({'where':{'id':_0x207fed['params']['id']}})[_0xb89f('0x35')](handleEntityNotFound(_0x11ba25,null))[_0xb89f('0x35')](function(_0x2d0123){if(_0x2d0123){_0x3bf1a3=_0x2d0123;return db['SmsAccount'][_0xb89f('0x57')]({'where':{'id':_0x2d0123[_0xb89f('0x86')]}});}})[_0xb89f('0x35')](handleEntityNotFound(_0x11ba25,null))[_0xb89f('0x35')](function(_0x3baa1b){if(_0x3baa1b){logger[_0xb89f('0x87')](_0xb89f('0x22'),_0xb89f('0x2b'),_0xb89f('0x88'),_0x3baa1b['type'],util[_0xb89f('0x89')](_0x207fed[_0xb89f('0x59')],{'showHidden':![],'depth':null}));switch(_0x3baa1b[_0xb89f('0x3d')]){case'twilio':if(_0x207fed['body']['MessageSid']&&_0x207fed[_0xb89f('0x59')]['MessageSid']===_0x3bf1a3[_0xb89f('0x8a')]){return _0x3bf1a3[_0xb89f('0x5a')]({'read':!![]});}else{logger[_0xb89f('0x25')](_0xb89f('0x8b'),_0xb89f('0x2b'),_0xb89f('0x8c'),util[_0xb89f('0x89')](_0x207fed[_0xb89f('0x59')],{'showHidden':![],'depth':null}));}break;case _0xb89f('0x8d'):if(_0x207fed['body']['MessageUUID']&&_0x207fed['body'][_0xb89f('0x8e')]===_0x3bf1a3[_0xb89f('0x8a')]&&_[_0xb89f('0x8f')]([_0xb89f('0x90'),_0xb89f('0x91')],_0x207fed[_0xb89f('0x59')][_0xb89f('0x92')])>=0x0){return _0x3bf1a3[_0xb89f('0x5a')]({'read':!![]});}else{logger['error'](_0xb89f('0x8b'),'status','plivio',util[_0xb89f('0x89')](_0x207fed[_0xb89f('0x59')],{'showHidden':![],'depth':null}));}break;case _0xb89f('0x93'):var _0xf9cd1=_0x207fed[_0xb89f('0x59')][_0xb89f('0x94')][0x0];if(_0xf9cd1[_0xb89f('0x2b')][_0xb89f('0x95')]===_0xb89f('0x96')){return _0x3bf1a3[_0xb89f('0x5a')]({'read':!![]});}else{logger[_0xb89f('0x25')](_0xb89f('0x8b'),_0xb89f('0x2b'),_0xb89f('0x93'),util['inspect'](_0x207fed[_0xb89f('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x3bf1a3;}})[_0xb89f('0x35')](respondWithResult(_0x11ba25,null))[_0xb89f('0x29')](handleError(_0x11ba25,null));}; \ No newline at end of file +var _0xdc6f=['debug','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','name','send','index','map','SmsMessage','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','type','options','includeAll','include','findAll','rows','show','params','create','body','find','describe','accept','sms','read','readAt','format','UserId','user','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','role','null','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','User','agent','fullname','email','manual','interface','channel','motionChannel','EventManager','sms-interactions','SmsInteraction','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','internal','SIP/%s','event','SmsAccount','inspect','twilio','MessageSid','MessageUUID','indexOf','sent','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xdc6f,0x6d));var _0xfdc6=function(_0x282442,_0x135555){_0x282442=_0x282442-0x0;var _0xf97807=_0xdc6f[_0x282442];return _0xf97807;};'use strict';var emlformat=require(_0xfdc6('0x0'));var rimraf=require(_0xfdc6('0x1'));var zipdir=require(_0xfdc6('0x2'));var jsonpatch=require(_0xfdc6('0x3'));var rp=require(_0xfdc6('0x4'));var moment=require(_0xfdc6('0x5'));var BPromise=require(_0xfdc6('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfdc6('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfdc6('0x8'));var fs=require('fs');var fs_extra=require(_0xfdc6('0x9'));var _=require(_0xfdc6('0xa'));var squel=require('squel');var crypto=require(_0xfdc6('0xb'));var jsforce=require(_0xfdc6('0xc'));var deskjs=require(_0xfdc6('0xd'));var toCsv=require(_0xfdc6('0xe'));var querystring=require(_0xfdc6('0xf'));var Papa=require(_0xfdc6('0x10'));var Redis=require(_0xfdc6('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfdc6('0x12'));var logger=require(_0xfdc6('0x13'))(_0xfdc6('0x14'));var utils=require(_0xfdc6('0x15'));var config=require(_0xfdc6('0x16'));var licenseUtil=require(_0xfdc6('0x17'));var db=require(_0xfdc6('0x18'))['db'];config[_0xfdc6('0x19')]=_['defaults'](config['redis'],{'host':_0xfdc6('0x1a'),'port':0x18eb});var socket=require(_0xfdc6('0x1b'))(new Redis(config['redis']));require(_0xfdc6('0x1c'))[_0xfdc6('0x1d')](socket);var jayson=require(_0xfdc6('0x1e'));var client=jayson[_0xfdc6('0x1f')][_0xfdc6('0x20')]({'port':0x232c});var client9002=jayson[_0xfdc6('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58dde9,_0x30d29f,_0x54242f,_0x2d1096){return new BPromise(function(_0x4385ac,_0x1d6085){var _0x27f792=_0x2d1096||client;return _0x27f792[_0xfdc6('0x21')](_0x58dde9,_0x54242f)[_0xfdc6('0x22')](function(_0x162f4c){logger[_0xfdc6('0x23')](_0xfdc6('0x24'),_0x30d29f,_0xfdc6('0x25'));logger[_0xfdc6('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x30d29f,'request\x20sent',JSON[_0xfdc6('0x27')](_0x162f4c));if(_0x162f4c[_0xfdc6('0x28')]){if(_0x162f4c[_0xfdc6('0x28')][_0xfdc6('0x29')]===0x1f4){logger[_0xfdc6('0x28')]('SmsMessage,\x20%s,\x20%s',_0x30d29f,_0x162f4c[_0xfdc6('0x28')][_0xfdc6('0x2a')]);return _0x1d6085(_0x162f4c['error'][_0xfdc6('0x2a')]);}logger[_0xfdc6('0x28')](_0xfdc6('0x24'),_0x30d29f,_0x162f4c[_0xfdc6('0x28')][_0xfdc6('0x2a')]);return _0x4385ac(_0x162f4c['error'][_0xfdc6('0x2a')]);}else{logger[_0xfdc6('0x23')](_0xfdc6('0x24'),_0x30d29f,'request\x20sent');_0x4385ac(_0x162f4c[_0xfdc6('0x2b')][_0xfdc6('0x2a')]);}})[_0xfdc6('0x2c')](function(_0x4af107){logger[_0xfdc6('0x28')]('SmsMessage,\x20%s,\x20%s',_0x30d29f,_0x4af107);_0x1d6085(_0x4af107);});});}function respondWithStatusCode(_0x3bc238,_0x1d3e21){_0x1d3e21=_0x1d3e21||0xcc;return function(_0x257b66){if(_0x257b66){return _0x3bc238[_0xfdc6('0x2d')](_0x1d3e21);}return _0x3bc238[_0xfdc6('0x2e')](_0x1d3e21)[_0xfdc6('0x2f')]();};}function respondWithResult(_0x1d51c3,_0xb92fc4){_0xb92fc4=_0xb92fc4||0xc8;return function(_0x1c5dc4){if(_0x1c5dc4){return _0x1d51c3[_0xfdc6('0x2e')](_0xb92fc4)['json'](_0x1c5dc4);}};}function respondWithFilteredResult(_0x4d28b5,_0x232d46){return function(_0x4fbfe6){if(_0x4fbfe6){var _0x5678e7=typeof _0x232d46[_0xfdc6('0x30')]===_0xfdc6('0x31')&&typeof _0x232d46[_0xfdc6('0x32')]===_0xfdc6('0x31');var _0x55cdc0=_0x4fbfe6[_0xfdc6('0x33')];var _0x55dac9=_0x5678e7?0x0:_0x232d46[_0xfdc6('0x30')];var _0x221dd9=_0x5678e7?_0x4fbfe6[_0xfdc6('0x33')]:_0x232d46[_0xfdc6('0x30')]+_0x232d46[_0xfdc6('0x32')];var _0x3171f7;if(_0x221dd9>=_0x55cdc0){_0x221dd9=_0x55cdc0;_0x3171f7=0xc8;}else{_0x3171f7=0xce;}_0x4d28b5[_0xfdc6('0x2e')](_0x3171f7);return _0x4d28b5[_0xfdc6('0x34')](_0xfdc6('0x35'),_0x55dac9+'-'+_0x221dd9+'/'+_0x55cdc0)[_0xfdc6('0x36')](_0x4fbfe6);}return null;};}function patchUpdates(_0x1f000b){return function(_0xb0361d){try{jsonpatch[_0xfdc6('0x37')](_0xb0361d,_0x1f000b,!![]);}catch(_0x38d37d){return BPromise[_0xfdc6('0x38')](_0x38d37d);}return _0xb0361d[_0xfdc6('0x39')]();};}function saveUpdates(_0x127aa7,_0x3d0de5){return function(_0xe10248){if(_0xe10248){return _0xe10248[_0xfdc6('0x3a')](_0x127aa7)[_0xfdc6('0x22')](function(_0x427287){return _0x427287;});}return null;};}function removeEntity(_0x4a2d74,_0x3640a9){return function(_0x71a3ba){if(_0x71a3ba){return _0x71a3ba[_0xfdc6('0x3b')]()['then'](function(){_0x4a2d74[_0xfdc6('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17353c,_0x483dff){return function(_0x4aa6df){if(!_0x4aa6df){_0x17353c['sendStatus'](0x194);}return _0x4aa6df;};}function handleError(_0x4d89a2,_0x4e551b){_0x4e551b=_0x4e551b||0x1f4;return function(_0x58b7d5){logger[_0xfdc6('0x28')](_0x58b7d5['stack']);if(_0x58b7d5['name']){delete _0x58b7d5[_0xfdc6('0x3c')];}_0x4d89a2[_0xfdc6('0x2e')](_0x4e551b)[_0xfdc6('0x3d')](_0x58b7d5);};}exports[_0xfdc6('0x3e')]=function(_0x1ce16c,_0x5b1774){var _0x1b0f58={},_0xd957f7={},_0x47c4b5={'count':0x0,'rows':[]};var _0x4763a4=_[_0xfdc6('0x3f')](db[_0xfdc6('0x40')][_0xfdc6('0x41')],function(_0x4e9a86){return{'name':_0x4e9a86[_0xfdc6('0x42')],'type':_0x4e9a86['type'][_0xfdc6('0x43')]};});_0xd957f7[_0xfdc6('0x44')]=_[_0xfdc6('0x3f')](_0x4763a4,'name');_0xd957f7[_0xfdc6('0x45')]=_[_0xfdc6('0x46')](_0x1ce16c[_0xfdc6('0x45')]);_0xd957f7['filters']=_[_0xfdc6('0x47')](_0xd957f7[_0xfdc6('0x44')],_0xd957f7['query']);_0x1b0f58[_0xfdc6('0x48')]=_[_0xfdc6('0x47')](_0xd957f7['model'],qs['fields'](_0x1ce16c['query'][_0xfdc6('0x49')]));_0x1b0f58[_0xfdc6('0x48')]=_0x1b0f58['attributes'][_0xfdc6('0x4a')]?_0x1b0f58[_0xfdc6('0x48')]:_0xd957f7[_0xfdc6('0x44')];if(!_0x1ce16c[_0xfdc6('0x45')]['hasOwnProperty'](_0xfdc6('0x4b'))){_0x1b0f58[_0xfdc6('0x32')]=qs[_0xfdc6('0x32')](_0x1ce16c[_0xfdc6('0x45')]['limit']);_0x1b0f58['offset']=qs[_0xfdc6('0x30')](_0x1ce16c[_0xfdc6('0x45')][_0xfdc6('0x30')]);}_0x1b0f58[_0xfdc6('0x4c')]=qs[_0xfdc6('0x4d')](_0x1ce16c['query']['sort']);_0x1b0f58[_0xfdc6('0x4e')]=qs[_0xfdc6('0x4f')](_[_0xfdc6('0x50')](_0x1ce16c[_0xfdc6('0x45')],_0xd957f7[_0xfdc6('0x4f')]),_0x4763a4);if(_0x1ce16c[_0xfdc6('0x45')]['filter']){_0x1b0f58[_0xfdc6('0x4e')]=_[_0xfdc6('0x51')](_0x1b0f58[_0xfdc6('0x4e')],{'$or':_[_0xfdc6('0x3f')](_0x4763a4,function(_0x3dd8a9){if(_0x3dd8a9[_0xfdc6('0x52')]!=='VIRTUAL'){var _0x3f3f19={};_0x3f3f19[_0x3dd8a9[_0xfdc6('0x3c')]]={'$like':'%'+_0x1ce16c[_0xfdc6('0x45')]['filter']+'%'};return _0x3f3f19;}})});}_0x1b0f58=_[_0xfdc6('0x51')]({},_0x1b0f58,_0x1ce16c[_0xfdc6('0x53')]);var _0x1ac3d3={'where':_0x1b0f58[_0xfdc6('0x4e')]};return db['SmsMessage'][_0xfdc6('0x33')](_0x1ac3d3)[_0xfdc6('0x22')](function(_0x30d693){_0x47c4b5[_0xfdc6('0x33')]=_0x30d693;if(_0x1ce16c[_0xfdc6('0x45')][_0xfdc6('0x54')]){_0x1b0f58[_0xfdc6('0x55')]=[{'all':!![]}];}return db[_0xfdc6('0x40')][_0xfdc6('0x56')](_0x1b0f58);})['then'](function(_0x59513f){_0x47c4b5[_0xfdc6('0x57')]=_0x59513f;return _0x47c4b5;})[_0xfdc6('0x22')](respondWithFilteredResult(_0x5b1774,_0x1b0f58))[_0xfdc6('0x2c')](handleError(_0x5b1774,null));};exports[_0xfdc6('0x58')]=function(_0x232cca,_0x5b7aca){var _0x525c88={'raw':!![],'where':{'id':_0x232cca[_0xfdc6('0x59')]['id']}},_0x3f3a2f={};_0x3f3a2f[_0xfdc6('0x44')]=_[_0xfdc6('0x46')](db[_0xfdc6('0x40')]['rawAttributes']);_0x3f3a2f[_0xfdc6('0x45')]=_[_0xfdc6('0x46')](_0x232cca[_0xfdc6('0x45')]);_0x3f3a2f['filters']=_[_0xfdc6('0x47')](_0x3f3a2f[_0xfdc6('0x44')],_0x3f3a2f[_0xfdc6('0x45')]);_0x525c88['attributes']=_[_0xfdc6('0x47')](_0x3f3a2f['model'],qs[_0xfdc6('0x49')](_0x232cca['query'][_0xfdc6('0x49')]));_0x525c88['attributes']=_0x525c88['attributes'][_0xfdc6('0x4a')]?_0x525c88[_0xfdc6('0x48')]:_0x3f3a2f[_0xfdc6('0x44')];if(_0x232cca[_0xfdc6('0x45')][_0xfdc6('0x54')]){_0x525c88[_0xfdc6('0x55')]=[{'all':!![]}];}_0x525c88=_[_0xfdc6('0x51')]({},_0x525c88,_0x232cca[_0xfdc6('0x53')]);return db['SmsMessage']['find'](_0x525c88)[_0xfdc6('0x22')](handleEntityNotFound(_0x5b7aca,null))[_0xfdc6('0x22')](respondWithResult(_0x5b7aca,null))[_0xfdc6('0x2c')](handleError(_0x5b7aca,null));};exports[_0xfdc6('0x5a')]=function(_0x2dc214,_0x5b7c52){return db[_0xfdc6('0x40')][_0xfdc6('0x5a')](_0x2dc214['body'],{})[_0xfdc6('0x22')](respondWithResult(_0x5b7c52,0xc9))[_0xfdc6('0x2c')](handleError(_0x5b7c52,null));};exports['update']=function(_0x35f121,_0x3478a0){if(_0x35f121[_0xfdc6('0x5b')]['id']){delete _0x35f121['body']['id'];}return db[_0xfdc6('0x40')][_0xfdc6('0x5c')]({'where':{'id':_0x35f121[_0xfdc6('0x59')]['id']}})[_0xfdc6('0x22')](handleEntityNotFound(_0x3478a0,null))[_0xfdc6('0x22')](saveUpdates(_0x35f121[_0xfdc6('0x5b')],null))['then'](respondWithResult(_0x3478a0,null))[_0xfdc6('0x2c')](handleError(_0x3478a0,null));};exports['destroy']=function(_0x60e333,_0x3e0735){return db[_0xfdc6('0x40')]['find']({'where':{'id':_0x60e333[_0xfdc6('0x59')]['id']}})['then'](handleEntityNotFound(_0x3e0735,null))[_0xfdc6('0x22')](removeEntity(_0x3e0735,null))['catch'](handleError(_0x3e0735,null));};exports[_0xfdc6('0x5d')]=function(_0x4744d1,_0x3524cc){return db[_0xfdc6('0x40')][_0xfdc6('0x5d')]()[_0xfdc6('0x22')](respondWithResult(_0x3524cc,null))[_0xfdc6('0x2c')](handleError(_0x3524cc,null));};var interaction_log=require(_0xfdc6('0x13'))('sms-interactions');exports[_0xfdc6('0x5e')]=function(_0x2fc6e4,_0x2b2963,_0x325ec5){var _0x3b766e={'agent':{},'channel':_0xfdc6('0x5f')};if(_0x2fc6e4[_0xfdc6('0x5b')]['id']){delete _0x2fc6e4['body']['id'];}_0x2fc6e4[_0xfdc6('0x5b')][_0xfdc6('0x60')]=!![];_0x2fc6e4[_0xfdc6('0x5b')][_0xfdc6('0x61')]=moment()[_0xfdc6('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x2fc6e4[_0xfdc6('0x5b')][_0xfdc6('0x63')]=_0x2fc6e4[_0xfdc6('0x5b')][_0xfdc6('0x63')]||_0x2fc6e4[_0xfdc6('0x64')]['id'];_0x3b766e['agent']['id']=_0x2fc6e4[_0xfdc6('0x5b')][_0xfdc6('0x63')];return db[_0xfdc6('0x40')][_0xfdc6('0x5c')]({'where':{'id':_0x2fc6e4[_0xfdc6('0x59')]['id'],'UserId':null}})[_0xfdc6('0x22')](handleEntityNotFound(_0x2b2963,null))[_0xfdc6('0x22')](saveUpdates(_0x2fc6e4['body'],null))['then'](function(_0x190c90){if(_0x190c90){_0x3b766e[_0xfdc6('0x2a')]=_0x190c90['get']({'plain':!![]});return db['SmsInteraction'][_0xfdc6('0x5c')]({'where':{'id':_0x190c90['SmsInteractionId']}});}return null;})[_0xfdc6('0x22')](handleEntityNotFound(_0x2b2963,null))[_0xfdc6('0x22')](function(_0x256301){if(_0x256301){return _0x256301['update']({'UserId':_0x2fc6e4[_0xfdc6('0x5b')][_0xfdc6('0x63')],'read1stAt':_[_0xfdc6('0x65')](_0x256301[_0xfdc6('0x66')])?moment()[_0xfdc6('0x62')](_0xfdc6('0x67')):undefined});}return null;})[_0xfdc6('0x22')](function(_0x2af6e5){if(_0x2af6e5){_0x3b766e[_0xfdc6('0x68')]=_0x2af6e5[_0xfdc6('0x69')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2fc6e4[_0xfdc6('0x64')]['id'],_0x2fc6e4[_0xfdc6('0x64')][_0xfdc6('0x3c')],_0x2fc6e4[_0xfdc6('0x64')][_0xfdc6('0x6a')],_0x3b766e[_0xfdc6('0x68')]['id'],_0x2fc6e4[_0xfdc6('0x5b')]?JSON[_0xfdc6('0x27')](_0x2fc6e4[_0xfdc6('0x5b')]):_0xfdc6('0x6b'));return respondWithRpcPromise('AcceptMessage',_0xfdc6('0x6c'),_0x3b766e);}return null;})[_0xfdc6('0x22')](function(_0x2add65){var _0x136139='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2add65[_0xfdc6('0x2a')][_0xfdc6('0x6d')];return db['sequelize'][_0xfdc6('0x45')](_0x136139,{'type':db[_0xfdc6('0x6e')][_0xfdc6('0x6f')][_0xfdc6('0x70')],'raw':!![]})['then'](function(_0x1d1476){return _0x1d1476;});})[_0xfdc6('0x22')](function(_0x2752f8){if(_0x2752f8){_0x3b766e[_0xfdc6('0x2a')]['contact']=_0x2752f8[0x0];if(!_0x2fc6e4[_0xfdc6('0x5b')][_0xfdc6('0x63')])return;return db[_0xfdc6('0x71')][_0xfdc6('0x5c')]({'where':{'id':_0x2fc6e4[_0xfdc6('0x5b')][_0xfdc6('0x63')],'role':_0xfdc6('0x72')},'attributes':['id',_0xfdc6('0x3c'),_0xfdc6('0x73'),_0xfdc6('0x74'),'internal'],'raw':!![]});}return null;})[_0xfdc6('0x22')](function(_0x44e188){if(!_0x44e188)return null;_0x3b766e[_0xfdc6('0x2a')][_0xfdc6('0x72')]=_0x44e188;return _0x3b766e;})[_0xfdc6('0x22')](function(_0x2759a7){if(_0x2759a7){if(_0x2fc6e4['body'][_0xfdc6('0x75')]){_0x3b766e[_0xfdc6('0x2a')][_0xfdc6('0x76')]=util[_0xfdc6('0x62')]('SIP/%s',_0x2fc6e4[_0xfdc6('0x64')][_0xfdc6('0x3c')]);_0x3b766e['message']['channel']=_0x3b766e[_0xfdc6('0x77')];_0x3b766e[_0xfdc6('0x2a')][_0xfdc6('0x78')]=_0x3b766e[_0xfdc6('0x77')];_0x3b766e['message']['event']=_0xfdc6('0x5e');return respondWithRpcPromise(_0xfdc6('0x79'),_0xfdc6('0x79'),{'event':'acceptmessage','message':_0x3b766e[_0xfdc6('0x2a')]},client9002)[_0xfdc6('0x22')](function(){return _0x3b766e;});}return _0x3b766e;}return null;})['then'](respondWithResult(_0x2b2963,null))[_0xfdc6('0x2c')](handleError(_0x2b2963,null));};var interaction_log=require(_0xfdc6('0x13'))(_0xfdc6('0x7a'));exports[_0xfdc6('0x38')]=function(_0x115813,_0x306564,_0x1d54bf){var _0x3ae6d8={'agent':{},'channel':'sms'};if(_0x115813['body']['id']){delete _0x115813['body']['id'];}_0x115813[_0xfdc6('0x5b')]['UserId']=_0x115813[_0xfdc6('0x5b')][_0xfdc6('0x63')]||_0x115813[_0xfdc6('0x64')]['id'];_0x3ae6d8[_0xfdc6('0x72')]['id']=_0x115813[_0xfdc6('0x5b')][_0xfdc6('0x63')];return db[_0xfdc6('0x40')][_0xfdc6('0x5c')]({'where':{'id':_0x115813[_0xfdc6('0x59')]['id'],'UserId':null}})[_0xfdc6('0x22')](handleEntityNotFound(_0x306564,null))['then'](function(_0x1ad323){if(_0x1ad323){_0x3ae6d8['message']=_0x1ad323[_0xfdc6('0x69')]({'plain':!![]});return db[_0xfdc6('0x7b')]['find']({'where':{'id':_0x1ad323[_0xfdc6('0x7c')]}});}return null;})['then'](handleEntityNotFound(_0x306564,null))[_0xfdc6('0x22')](function(_0x429fc8){if(_0x429fc8){_0x3ae6d8[_0xfdc6('0x68')]=_0x429fc8[_0xfdc6('0x69')]({'plain':!![]});interaction_log[_0xfdc6('0x23')](_0xfdc6('0x7d'),_0x115813[_0xfdc6('0x64')]['id'],_0x115813[_0xfdc6('0x64')][_0xfdc6('0x3c')],_0x115813['user'][_0xfdc6('0x6a')],_0x3ae6d8[_0xfdc6('0x68')]['id'],_0x115813[_0xfdc6('0x5b')]?JSON[_0xfdc6('0x27')](_0x115813[_0xfdc6('0x5b')]):_0xfdc6('0x6b'));return respondWithRpcPromise(_0xfdc6('0x7e'),_0xfdc6('0x7f'),_0x3ae6d8);}return null;})[_0xfdc6('0x22')](function(_0x37d7af){var _0x568823=_0xfdc6('0x80')+_0x37d7af[_0xfdc6('0x2a')][_0xfdc6('0x6d')];return db[_0xfdc6('0x81')][_0xfdc6('0x45')](_0x568823,{'type':db['Sequelize'][_0xfdc6('0x6f')][_0xfdc6('0x70')],'raw':!![]})['then'](function(_0x13168d){return _0x13168d;});})[_0xfdc6('0x22')](function(_0x597b67){if(_0x597b67){_0x3ae6d8[_0xfdc6('0x2a')]['contact']=_0x597b67[0x0];if(!_0x115813['body']['UserId'])return;return db['User']['find']({'where':{'id':_0x115813[_0xfdc6('0x5b')][_0xfdc6('0x63')],'role':_0xfdc6('0x72')},'attributes':['id','name',_0xfdc6('0x73'),'email',_0xfdc6('0x82')],'raw':!![]});}return null;})[_0xfdc6('0x22')](function(_0x215cc0){if(!_0x215cc0)return null;_0x3ae6d8[_0xfdc6('0x2a')][_0xfdc6('0x72')]=_0x215cc0;return _0x3ae6d8;})[_0xfdc6('0x22')](function(_0x1f39fb){if(_0x1f39fb){_0x1f39fb[_0xfdc6('0x2a')]['interface']=util['format'](_0xfdc6('0x83'),_0x115813[_0xfdc6('0x64')][_0xfdc6('0x3c')]);_0x1f39fb[_0xfdc6('0x2a')][_0xfdc6('0x77')]=_0x3ae6d8['channel'];_0x1f39fb[_0xfdc6('0x2a')][_0xfdc6('0x78')]=_0x3ae6d8[_0xfdc6('0x77')];_0x1f39fb['message'][_0xfdc6('0x84')]=_0xfdc6('0x38');respondWithRpcPromise(_0xfdc6('0x79'),_0xfdc6('0x79'),{'event':'rejectmessage','message':_0x1f39fb[_0xfdc6('0x2a')]},client9002);return _0x3ae6d8;}return null;})[_0xfdc6('0x22')](respondWithResult(_0x306564,null))['catch'](handleError(_0x306564,null));};exports[_0xfdc6('0x2e')]=function(_0x48e643,_0x32799e,_0x1ce533){if(_0x48e643['body']['id']){delete _0x48e643[_0xfdc6('0x5b')]['id'];}var _0x190402;return db[_0xfdc6('0x40')][_0xfdc6('0x5c')]({'where':{'id':_0x48e643[_0xfdc6('0x59')]['id']}})[_0xfdc6('0x22')](handleEntityNotFound(_0x32799e,null))['then'](function(_0x5980cb){if(_0x5980cb){_0x190402=_0x5980cb;return db[_0xfdc6('0x85')][_0xfdc6('0x5c')]({'where':{'id':_0x5980cb['SmsAccountId']}});}})[_0xfdc6('0x22')](handleEntityNotFound(_0x32799e,null))[_0xfdc6('0x22')](function(_0x2ccfc1){if(_0x2ccfc1){logger[_0xfdc6('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfdc6('0x2e'),'received\x20delivery\x20report\x20from',_0x2ccfc1[_0xfdc6('0x52')],util[_0xfdc6('0x86')](_0x48e643[_0xfdc6('0x5b')],{'showHidden':![],'depth':null}));switch(_0x2ccfc1['type']){case _0xfdc6('0x87'):if(_0x48e643[_0xfdc6('0x5b')][_0xfdc6('0x88')]&&_0x48e643[_0xfdc6('0x5b')][_0xfdc6('0x88')]===_0x190402['messageId']){return _0x190402[_0xfdc6('0x3a')]({'read':!![]});}else{logger[_0xfdc6('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xfdc6('0x2e'),_0xfdc6('0x87'),util[_0xfdc6('0x86')](_0x48e643['body'],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x48e643[_0xfdc6('0x5b')][_0xfdc6('0x89')]&&_0x48e643[_0xfdc6('0x5b')][_0xfdc6('0x89')]===_0x190402['messageId']&&_[_0xfdc6('0x8a')]([_0xfdc6('0x8b'),_0xfdc6('0x8c')],_0x48e643[_0xfdc6('0x5b')][_0xfdc6('0x8d')])>=0x0){return _0x190402['update']({'read':!![]});}else{logger[_0xfdc6('0x28')](_0xfdc6('0x8e'),_0xfdc6('0x2e'),_0xfdc6('0x8f'),util['inspect'](_0x48e643['body'],{'showHidden':![],'depth':null}));}break;case _0xfdc6('0x90'):var _0x377ac1=_0x48e643[_0xfdc6('0x5b')][_0xfdc6('0x91')][0x0];if(_0x377ac1[_0xfdc6('0x2e')]['groupName']===_0xfdc6('0x92')){return _0x190402[_0xfdc6('0x3a')]({'read':!![]});}else{logger[_0xfdc6('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xfdc6('0x2e'),_0xfdc6('0x90'),util[_0xfdc6('0x86')](_0x48e643[_0xfdc6('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x190402;}})[_0xfdc6('0x22')](respondWithResult(_0x32799e,null))[_0xfdc6('0x2c')](handleError(_0x32799e,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index a5bf2ce..3b89b53 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 _0x059c=['events','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x38d595,_0x58c96f){var _0x43a940=function(_0x3e8102){while(--_0x3e8102){_0x38d595['push'](_0x38d595['shift']());}};_0x43a940(++_0x58c96f);}(_0x059c,0x1d0));var _0xc059=function(_0x50e40b,_0x338d17){_0x50e40b=_0x50e40b-0x0;var _0x2608b7=_0x059c[_0x50e40b];return _0x2608b7;};'use strict';var EventEmitter=require(_0xc059('0x0'));var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xc059('0x1')](0x0);var events={'afterCreate':_0xc059('0x2'),'afterUpdate':_0xc059('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1f7c21){return function(_0x4160f9,_0x9d046f,_0x1ce1da){SmsMessageEvents[_0xc059('0x4')](_0x1f7c21+':'+_0x4160f9['id'],_0x4160f9);SmsMessageEvents[_0xc059('0x4')](_0x1f7c21,_0x4160f9);_0x1ce1da(null);};}for(var e in events){if(events[_0xc059('0x5')](e)){var event=events[e];SmsMessage[_0xc059('0x6')](e,emitEvent(event));}}module[_0xc059('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0xed45=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x52211e,_0x4e906e){var _0xbecda3=function(_0x4df572){while(--_0x4df572){_0x52211e['push'](_0x52211e['shift']());}};_0xbecda3(++_0x4e906e);}(_0xed45,0xeb));var _0x5ed4=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xed45[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require(_0x5ed4('0x0'));var SmsMessage=require(_0x5ed4('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5ed4('0x2'),'afterUpdate':_0x5ed4('0x3'),'afterDestroy':'remove'};function emitEvent(_0x13338e){return function(_0x3cf32c,_0x3f2140,_0x20f850){SmsMessageEvents[_0x5ed4('0x4')](_0x13338e+':'+_0x3cf32c['id'],_0x3cf32c);SmsMessageEvents[_0x5ed4('0x4')](_0x13338e,_0x3cf32c);_0x20f850(null);};}for(var e in events){if(events[_0x5ed4('0x5')](e)){var event=events[e];SmsMessage[_0x5ed4('0x6')](e,emitEvent(event));}}module[_0x5ed4('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 b49a72e..56d56ee 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 _0x2242=['keys','sort','length','createHash','digest','hex','signature=','GET','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','%s:%s','https://messaging.bandwidth.com/api/v2/users/','accountId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','refid','status','finally','lodash','util','api','moment','request-promise','path','../../config/environment','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','out','UserId','isNil','SmsInteraction','SmsInteractionId','then','update','toLowerCase','secret','SmsAccount','type','twilio','accountSid','phone','authToken','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','error','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','authId','format','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','/auth/1/session','baseUrl','application/json','IBSSO\x20','csc','crypto','login','text','timestamp'];(function(_0x409019,_0x9764c4){var _0x37a84c=function(_0x1de3d3){while(--_0x1de3d3){_0x409019['push'](_0x409019['shift']());}};_0x37a84c(++_0x9764c4);}(_0x2242,0x98));var _0x2224=function(_0x2f9e24,_0x40d108){_0x2f9e24=_0x2f9e24-0x0;var _0x221b02=_0x2242[_0x2f9e24];return _0x221b02;};'use strict';var _=require(_0x2224('0x0'));var util=require(_0x2224('0x1'));var logger=require('../../config/logger')(_0x2224('0x2'));var moment=require(_0x2224('0x3'));var BPromise=require('bluebird');var rp=require(_0x2224('0x4'));var fs=require('fs');var path=require(_0x2224('0x5'));var rimraf=require('rimraf');var config=require(_0x2224('0x6'));var attributes=require('./smsMessage.attributes');module[_0x2224('0x7')]=function(_0x42fddb,_0xece6f9){return _0x42fddb[_0x2224('0x8')](_0x2224('0x9'),attributes,{'tableName':_0x2224('0xa'),'paranoid':![],'indexes':[{'name':_0x2224('0xb'),'fields':[_0x2224('0xb')]},{'name':_0x2224('0xc'),'fields':[_0x2224('0xd')],'type':_0x2224('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2dad1c,_0x49eeb2,_0x184295){var _0x4b2805=_0x42fddb[_0x2224('0xf')];var _0x16c29d=_0x2dad1c[_0x2224('0x10')]({'plain':!![]});if(_0x16c29d[_0x2224('0x11')]['toLowerCase']()==='in'||_0x16c29d[_0x2224('0x11')]['toLowerCase']()===_0x2224('0x12')&&!_0x16c29d['secret']&&!_['isNil'](_0x16c29d[_0x2224('0x13')])&&!_[_0x2224('0x14')](_0x16c29d['SmsInteractionId'])){_0x4b2805[_0x2224('0x15')]['findOne']({'where':{'id':_0x16c29d[_0x2224('0x16')]}})[_0x2224('0x17')](function(_0x1c8d8e){if(_0x1c8d8e){_0x1c8d8e[_0x2224('0x18')]({'lastMsgAt':_0x16c29d['createdAt'],'lastMsgDirection':_0x16c29d[_0x2224('0x11')][_0x2224('0x19')]()});}})['catch'](function(_0x57e9cc){console['error'](_0x57e9cc);});}if(_0x16c29d['direction']===_0x2224('0x12')&&!_0x16c29d[_0x2224('0x1a')]){var _0x3f969c;_0x4b2805[_0x2224('0x1b')]['find']({'where':{'id':_0x16c29d['SmsAccountId']},'raw':!![]})['then'](function(_0x5a49b2){_0x3f969c=_0x5a49b2;if(_0x3f969c&&_0x3f969c[_0x2224('0x1c')]){switch(_0x3f969c[_0x2224('0x1c')]){case _0x2224('0x1d'):var _0x31fb9b=require(_0x2224('0x1d'));if(_0x3f969c[_0x2224('0x1e')]&&_0x3f969c['authToken']&&_0x3f969c[_0x2224('0x1f')]){var _0xd68729=new _0x31fb9b(_0x3f969c[_0x2224('0x1e')],_0x3f969c[_0x2224('0x20')]);_0xd68729[_0x2224('0x21')][_0x2224('0x22')]({'body':_0x16c29d[_0x2224('0xd')],'to':_0x16c29d[_0x2224('0x1f')],'from':_0x3f969c['phone'],'statusCallback':_0x3f969c[_0x2224('0x23')]+_0x2224('0x24')+_0x16c29d['id']+_0x2224('0x25')+_0x3f969c[_0x2224('0x26')]})['then'](function(_0x4f14df){if(_0x4f14df[_0x2224('0x27')]){return _0x2dad1c[_0x2224('0x18')]({'messageId':_0x4f14df[_0x2224('0x27')]});}})[_0x2224('0x28')](function(_0x494234){logger['error'](_0x2224('0x29'),_0x2224('0x2a'),_0x2224('0x1d'),util['inspect'](_0x494234,{'showHidden':![],'depth':null}));});}else{logger[_0x2224('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2224('0x2a'),'twilio',_0x2224('0x2c'));}break;case _0x2224('0x2d'):var _0x375d4c=_0x2224('0x2e');if(_0x3f969c[_0x2224('0x2f')]&&_0x3f969c[_0x2224('0x30')]){var _0x2c6f41={'recipient':[_0x16c29d[_0x2224('0x1f')]],'message':_0x16c29d[_0x2224('0xd')],'message_type':_0x3f969c[_0x2224('0x31')]};if(_0x3f969c[_0x2224('0x31')]&&_0x3f969c['smsMethod']!=='SI'){_0x2c6f41[_0x2224('0x32')]=_0x3f969c[_0x2224('0x1f')];}var _0x152fc8={'url':_0x375d4c+_0x2224('0x33')+_0x3f969c[_0x2224('0x2f')]+_0x2224('0x34')+_0x3f969c[_0x2224('0x30')],'method':'GET'};rp(_0x152fc8)[_0x2224('0x17')](function(_0x690e4){var _0x1ace58=_0x690e4['split'](';');var _0xc96032={'user_key':_0x1ace58[0x0],'session_key':_0x1ace58[0x1]};_0x152fc8={'url':_0x375d4c+_0x2224('0x35'),'method':_0x2224('0x36'),'headers':{'user_key':_0xc96032[_0x2224('0x37')],'Session_key':_0xc96032[_0x2224('0x38')]},'json':!![],'body':_0x2c6f41};return rp(_0x152fc8);})[_0x2224('0x17')](function(_0x4d2a5d){if(_0x4d2a5d[_0x2224('0x39')]>=0x1){var _0x35c5cd={'messageId':_0x4d2a5d[_0x2224('0x3a')]};if(_0x3f969c['smsMethod']!=='GP'||!_0x3f969c[_0x2224('0x3b')]){_0x35c5cd[_0x2224('0x3c')]=!![];}return _0x2dad1c['update'](_0x35c5cd);}else{return logger[_0x2224('0x2b')](_0x2224('0x29'),'afterCreate',_0x2224('0x2d'),util[_0x2224('0x3d')](_0x4d2a5d,{'showHidden':![],'depth':null}));}})[_0x2224('0x28')](function(_0x318582){return logger[_0x2224('0x2b')](_0x2224('0x29'),_0x2224('0x2a'),_0x2224('0x2d'),util['inspect'](_0x318582,{'showHidden':![],'depth':null}));});}else{logger[_0x2224('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby',_0x2224('0x3e'));}break;case _0x2224('0x3f'):if(_0x3f969c[_0x2224('0x20')]){var _0x11a007={'recipient':_0x16c29d['phone'],'message':_0x16c29d['body'],'sender':_0x3f969c[_0x2224('0x40')]||_0x3f969c[_0x2224('0x1f')],'authorization':_0x3f969c[_0x2224('0x20')]};var _0x49eeb2={'method':_0x2224('0x36'),'uri':_0x2224('0x41'),'body':_0x11a007,'json':!![]};rp(_0x49eeb2)[_0x2224('0x17')](function(_0x12155e){var _0x3b919b={'messageId':_0x12155e[_0x2224('0x42')]};if(!_0x3f969c[_0x2224('0x3b')]){_0x3b919b[_0x2224('0x3c')]=!![];}return _0x2dad1c[_0x2224('0x18')](_0x3b919b);})[_0x2224('0x28')](function(_0x16fc3e){logger[_0x2224('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2224('0x2a'),_0x2224('0x3f'),util[_0x2224('0x3d')](_0x16fc3e,{'showHidden':![],'depth':null}));});}else{logger[_0x2224('0x2b')](_0x2224('0x29'),_0x2224('0x2a'),_0x2224('0x3f'),_0x2224('0x43'));}break;case _0x2224('0x44'):if(_0x3f969c['username']&&_0x3f969c[_0x2224('0x30')]){var _0x11a007={'messages':[{'source':_0x2224('0x45'),'to':_0x16c29d[_0x2224('0x1f')],'body':_0x16c29d[_0x2224('0xd')],'from':_0x3f969c[_0x2224('0x40')]||_0x3f969c[_0x2224('0x1f')]}]};var _0x4ebe36=util['format']('%s:%s',_0x3f969c['username'],_0x3f969c['password']);var _0x49eeb2={'method':_0x2224('0x36'),'uri':_0x2224('0x46'),'body':_0x11a007,'headers':{'Authorization':util['format'](_0x2224('0x47'),new Buffer(_0x4ebe36)[_0x2224('0x48')](_0x2224('0x49')))},'json':!![]};rp(_0x49eeb2)[_0x2224('0x17')](function(_0x196439){if(_0x196439[_0x2224('0x4a')]>=0xc8&&_0x196439[_0x2224('0x4a')]<=0xce){if(_0x196439[_0x2224('0x4b')]&&_0x196439[_0x2224('0x4b')][_0x2224('0x4c')]>0x0){var _0x3bc398=_[_0x2224('0x4d')](_0x196439['data'][_0x2224('0x21')]);var _0xf18576={'messageId':_0x3bc398[_0x2224('0x4e')]};if(!_0x3f969c['deliveryReport']){_0xf18576[_0x2224('0x3c')]=!![];}return _0x2dad1c[_0x2224('0x18')](_0xf18576);}else{logger['error'](_0x2224('0x29'),'afterCreate',_0x2224('0x4f'),util[_0x2224('0x3d')](_0x196439,{'showHidden':![],'depth':null}));}}else{logger[_0x2224('0x2b')](_0x2224('0x29'),_0x2224('0x2a'),_0x2224('0x4f'),util[_0x2224('0x3d')](_0x196439,{'showHidden':![],'depth':null}));}})[_0x2224('0x28')](function(_0x33e51c){logger['error'](_0x2224('0x29'),_0x2224('0x2a'),'clickSend',util[_0x2224('0x3d')](_0x33e51c,{'showHidden':![],'depth':null}));});}else{logger[_0x2224('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2224('0x2a'),_0x2224('0x4f'),_0x2224('0x3e'));}break;case'plivo':if(_0x3f969c['authId']&&_0x3f969c[_0x2224('0x20')]){var _0x11a007={'dst':_0x16c29d[_0x2224('0x1f')],'text':_0x16c29d[_0x2224('0xd')],'src':_0x3f969c[_0x2224('0x40')]||_0x3f969c[_0x2224('0x1f')],'url':_0x3f969c[_0x2224('0x23')]+'/api/sms/messages/'+_0x16c29d['id']+'/status?token='+_0x3f969c[_0x2224('0x26')]};var _0x4ebe36=util['format']('%s:%s',_0x3f969c[_0x2224('0x50')],_0x3f969c[_0x2224('0x20')]);var _0x49eeb2={'method':_0x2224('0x36'),'uri':util[_0x2224('0x51')](_0x2224('0x52'),_0x3f969c['authId']),'body':_0x11a007,'headers':{'Authorization':util[_0x2224('0x51')](_0x2224('0x47'),new Buffer(_0x4ebe36)[_0x2224('0x48')]('base64'))},'json':!![]};rp(_0x49eeb2)[_0x2224('0x17')](function(_0x2c579d){var _0x7ddb6e={'messageId':_0x2c579d[_0x2224('0x53')][0x0]};return _0x2dad1c[_0x2224('0x18')](_0x7ddb6e);})[_0x2224('0x28')](function(_0xc2cc60){logger[_0x2224('0x2b')](_0x2224('0x29'),_0x2224('0x2a'),_0x2224('0x54'),util[_0x2224('0x3d')](_0xc2cc60,{'showHidden':![],'depth':null}));});}else{logger[_0x2224('0x2b')](_0x2224('0x29'),_0x2224('0x2a'),_0x2224('0x54'),_0x2224('0x55'));}break;case _0x2224('0x56'):if(_0x3f969c[_0x2224('0x2f')]&&_0x3f969c[_0x2224('0x30')]){if(_0x3f969c['baseUrl']){var _0x41fbbc={'method':'POST','uri':_0x3f969c['baseUrl']+_0x2224('0x57'),'body':{'username':_0x3f969c[_0x2224('0x2f')],'password':_0x3f969c[_0x2224('0x30')]},'json':!![]};return rp(_0x41fbbc)[_0x2224('0x17')](function(_0x1ed646){var _0x4a1326={'method':_0x2224('0x36'),'uri':_0x3f969c[_0x2224('0x58')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x3f969c[_0x2224('0x1f')],'destinations':[{'to':_0x16c29d[_0x2224('0x1f')]}],'text':_0x16c29d[_0x2224('0xd')],'notifyUrl':_0x3f969c['remote']+'/api/sms/messages/'+_0x16c29d['id']+_0x2224('0x25')+_0x3f969c[_0x2224('0x26')],'notifyContentType':_0x2224('0x59'),'callbackData':_0x3f969c[_0x2224('0x1f')]+';'+_0x16c29d['body']}]},'headers':{'Authorization':_0x2224('0x5a')+_0x1ed646[_0x2224('0x26')]},'json':!![]};return rp(_0x4a1326)[_0x2224('0x17')](function(_0x8e1e2f){if(_0x8e1e2f['messages']){var _0x12dd9e={'messageId':_0x8e1e2f['messages'][0x0][_0x2224('0xb')]};if(!_0x3f969c[_0x2224('0x3b')]){_0x12dd9e[_0x2224('0x3c')]=!![];}return _0x2dad1c[_0x2224('0x18')](_0x12dd9e);}else{return logger[_0x2224('0x2b')](_0x2224('0x29'),_0x2224('0x2a'),'infobip',util[_0x2224('0x3d')](_0x8e1e2f,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x53c672){return logger['error'](_0x2224('0x29'),'afterCreate',_0x2224('0x56'),util['inspect'](_0x53c672,{'showHidden':![],'depth':null}));});}else{logger[_0x2224('0x2b')](_0x2224('0x29'),_0x2224('0x2a'),'infobip','Missing\x20parameters:\x20base_url');}}else{logger['error'](_0x2224('0x29'),_0x2224('0x2a'),_0x2224('0x56'),_0x2224('0x3e'));}break;case _0x2224('0x5b'):var _0x4a1d9b=require(_0x2224('0x5c'));if(_0x3f969c['apiKey']){var _0x11c7ce={};_0x11c7ce[_0x2224('0x5d')]=_0x3f969c[_0x2224('0x2f')];_0x11c7ce[_0x2224('0x1f')]=_0x16c29d[_0x2224('0x1f')];_0x11c7ce[_0x2224('0x32')]=_0x3f969c['phone'];_0x11c7ce[_0x2224('0x5e')]=_0x16c29d[_0x2224('0xd')];_0x11c7ce[_0x2224('0x5f')]=+new Date();var _0x476e9a='';var _0xa674d6='';var _0x3c020f=Object[_0x2224('0x60')](_0x11c7ce);_0x3c020f[_0x2224('0x61')]();for(var _0x34b465=0x0;_0x34b465<_0x3c020f[_0x2224('0x62')];_0x34b465++){if(_0x476e9a!=''){_0x476e9a+='&';}_0x476e9a+=_0x3c020f[_0x34b465]+'='+encodeURIComponent(_0x11c7ce[_0x3c020f[_0x34b465]]);_0xa674d6+=_0x11c7ce[_0x3c020f[_0x34b465]];}_0xa674d6+=_0x3f969c['apiKey'];_0xa674d6=_0x4a1d9b[_0x2224('0x63')]('md5')[_0x2224('0x18')](_0xa674d6)[_0x2224('0x64')](_0x2224('0x65'));if(_0x476e9a!==''){_0x476e9a+='&';}_0x476e9a+=_0x2224('0x66')+_0xa674d6;var _0x152fc8={'method':_0x2224('0x67'),'uri':_0x3f969c[_0x2224('0x58')]+_0x2224('0x68')+_0x476e9a,'json':!![]};return rp(_0x152fc8)[_0x2224('0x17')](function(_0x513a5d){var _0x316053=Object[_0x2224('0x60')](_0x513a5d);if(_0x513a5d[_0x316053[0x0]][_0x2224('0x2b')]&&parseInt(_0x513a5d[_0x316053[0x0]][_0x2224('0x2b')])===0x0){var _0x4a555c={'messageId':_0x513a5d[_0x316053[0x0]][_0x2224('0x69')]};if(!_0x3f969c[_0x2224('0x3b')]){_0x4a555c[_0x2224('0x3c')]=!![];}return _0x2dad1c[_0x2224('0x18')](_0x4a555c);}else{return logger[_0x2224('0x2b')](_0x2224('0x29'),_0x2224('0x2a'),_0x2224('0x5b'),util['inspect'](_0x513a5d[_0x2224('0x2b')],{'showHidden':![],'depth':null}));}})[_0x2224('0x28')](function(_0xd4f828){return logger[_0x2224('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2224('0x2a'),'csc',util['inspect'](_0xd4f828,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2224('0x29'),_0x2224('0x2a'),'csc',_0x2224('0x6a'));}break;case _0x2224('0x6b'):if(_0x3f969c[_0x2224('0x6c')]){var _0x3e3748={'method':_0x2224('0x36'),'uri':_0x2224('0x6d'),'headers':{'Authorization':_0x3f969c[_0x2224('0x6c')]},'body':{'content':_0x16c29d[_0x2224('0xd')],'to':[_0x16c29d['phone']],'from':_0x3f969c[_0x2224('0x1f')],'binary':![],'clientMessageId':_0x2224('0x6e'),'charset':_0x2224('0x6f')},'json':!![]};rp(_0x3e3748)['then'](function(_0x4cfd35){if(!_0x4cfd35[_0x2224('0x2b')]){var _0x572698={'messageId':_0x4cfd35[_0x2224('0x21')][0x0][_0x2224('0x70')]};if(!_0x3f969c[_0x2224('0x3b')]){_0x572698[_0x2224('0x3c')]=!![];}return _0x2dad1c[_0x2224('0x18')](_0x572698);}else{return logger[_0x2224('0x2b')](_0x2224('0x29'),_0x2224('0x2a'),'clickatell',util[_0x2224('0x3d')](_0x4cfd35[_0x2224('0x2b')],{'showHidden':![],'depth':null}));}})[_0x2224('0x28')](function(_0x225365){return logger[_0x2224('0x2b')](_0x2224('0x29'),'afterCreate',_0x2224('0x6b'),util[_0x2224('0x3d')](_0x225365,{'showHidden':![],'depth':null}));});}else{logger[_0x2224('0x2b')](_0x2224('0x29'),_0x2224('0x2a'),'clickatell',_0x2224('0x6a'));}break;case _0x2224('0x71'):if(_0x3f969c[_0x2224('0x2f')]&&_0x3f969c['password']){var _0x4ebe36=util[_0x2224('0x51')](_0x2224('0x72'),_0x3f969c[_0x2224('0x2f')],_0x3f969c['password']);var _0x49eeb2={'method':'POST','uri':_0x2224('0x73')+_0x3f969c[_0x2224('0x74')]+'/messages','body':{'to':[_0x16c29d[_0x2224('0x1f')]],'text':_0x16c29d['body'],'from':_0x3f969c['phone'],'applicationId':_0x3f969c['applicationId']},'headers':{'Authorization':util[_0x2224('0x51')](_0x2224('0x47'),new Buffer(_0x4ebe36)[_0x2224('0x48')](_0x2224('0x49')))},'json':!![]};rp(_0x49eeb2)[_0x2224('0x17')](function(_0x303753){if(_0x303753['id']){var _0x5cf332={'messageId':_0x303753['id']};return _0x2dad1c[_0x2224('0x18')](_0x5cf332);}else{logger[_0x2224('0x2b')](_0x2224('0x29'),_0x2224('0x2a'),_0x2224('0x71'),util['inspect'](_0x303753,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4e7b42){logger['error'](_0x2224('0x29'),_0x2224('0x2a'),_0x2224('0x71'),util[_0x2224('0x3d')](_0x4e7b42,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2224('0x29'),_0x2224('0x2a'),'bandwidth',_0x2224('0x3e'));}break;case _0x2224('0x75'):if(_0x3f969c[_0x2224('0x6c')]){var _0x554bad={};var _0x152fc8={'method':_0x2224('0x36'),'uri':_0x2224('0x76'),'headers':{'Authorization':_0x2224('0x77')+_0x3f969c[_0x2224('0x6c')],'Content-Type':'application/json'},'body':{'from':_0x3f969c[_0x2224('0x1f')],'to':_0x16c29d[_0x2224('0x1f')],'text':_0x16c29d['body']},'json':!![]};return rp(_0x152fc8)[_0x2224('0x17')](function(_0xc94dd2){if(_0xc94dd2['code']==0xca){_0x554bad['message']=_0xc94dd2;var _0x117e49={'method':_0x2224('0x36'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x2224('0x77')+_0x3f969c[_0x2224('0x6c')],'Content-Type':_0x2224('0x59')},'body':{'refid':_0x554bad[_0x2224('0x78')][_0x2224('0x79')]},'json':!![]};return rp(_0x117e49)[_0x2224('0x17')](function(_0x2abc5e){_0x554bad[_0x2224('0x7a')]=_0x2abc5e;var _0x24ae79={'messageId':_0x554bad[_0x2224('0x78')][_0x2224('0x79')],'read':!![]};return _0x2dad1c[_0x2224('0x18')](_0x24ae79);});}else{return logger[_0x2224('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2224('0x2a'),_0x2224('0x75'),util[_0x2224('0x3d')](_0xc94dd2,{'showHidden':![],'depth':null}));}})['catch'](function(_0xd27867){return logger[_0x2224('0x2b')](_0x2224('0x29'),_0x2224('0x2a'),_0x2224('0x75'),util[_0x2224('0x3d')](_0xd27867,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2224('0x2a'),'intelepeer','Token\x20not\x20received');}break;}}})[_0x2224('0x7b')](function(){_0x184295();});}else{_0x184295();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3e15=['/api/sms/messages/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','application/json','login','sender','text','timestamp','keys','length','apiKey','md5','digest','hex','signature=','id_sms','csc','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','refid','Token\x20not\x20received','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','messageId','fti_sms_messages','models','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','then','update','direction','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','phone','authToken','messages','create','body','remote','/status?token=','token','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','GET','split','sms','POST','user_key','session_key','internal_order_id','deliveryReport','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','toString','base64','http_code','data','queued_count','head','read','clickSend','plivo','authId'];(function(_0x49d568,_0x40a676){var _0x5bf8a4=function(_0x40f587){while(--_0x40f587){_0x49d568['push'](_0x49d568['shift']());}};_0x5bf8a4(++_0x40a676);}(_0x3e15,0x182));var _0x53e1=function(_0x23e919,_0x279fdb){_0x23e919=_0x23e919-0x0;var _0x1ab4f1=_0x3e15[_0x23e919];return _0x1ab4f1;};'use strict';var _=require(_0x53e1('0x0'));var util=require(_0x53e1('0x1'));var logger=require(_0x53e1('0x2'))(_0x53e1('0x3'));var moment=require(_0x53e1('0x4'));var BPromise=require(_0x53e1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x53e1('0x6'));var rimraf=require(_0x53e1('0x7'));var config=require(_0x53e1('0x8'));var attributes=require('./smsMessage.attributes');module[_0x53e1('0x9')]=function(_0x5c1e8d,_0x3e3b5b){return _0x5c1e8d['define']('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x53e1('0xa'),'fields':[_0x53e1('0xa')]},{'name':_0x53e1('0xb'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5c7d7e,_0x4579de,_0x4cfaba){var _0x490b2f=_0x5c1e8d[_0x53e1('0xc')];var _0xcb714c=_0x5c7d7e['get']({'plain':!![]});if(_0xcb714c['direction'][_0x53e1('0xd')]()==='in'||_0xcb714c['direction'][_0x53e1('0xd')]()===_0x53e1('0xe')&&!_0xcb714c[_0x53e1('0xf')]&&!_[_0x53e1('0x10')](_0xcb714c[_0x53e1('0x11')])&&!_[_0x53e1('0x10')](_0xcb714c[_0x53e1('0x12')])){_0x490b2f[_0x53e1('0x13')]['findOne']({'where':{'id':_0xcb714c[_0x53e1('0x12')]}})[_0x53e1('0x14')](function(_0x183b4a){if(_0x183b4a){_0x183b4a[_0x53e1('0x15')]({'lastMsgAt':_0xcb714c['createdAt'],'lastMsgDirection':_0xcb714c[_0x53e1('0x16')][_0x53e1('0xd')]()});}})['catch'](function(_0xec5422){console[_0x53e1('0x17')](_0xec5422);});}if(_0xcb714c[_0x53e1('0x16')]==='out'&&!_0xcb714c[_0x53e1('0xf')]){var _0x386754;_0x490b2f[_0x53e1('0x18')][_0x53e1('0x19')]({'where':{'id':_0xcb714c[_0x53e1('0x1a')]},'raw':!![]})[_0x53e1('0x14')](function(_0xf65e85){_0x386754=_0xf65e85;if(_0x386754&&_0x386754['type']){switch(_0x386754[_0x53e1('0x1b')]){case'twilio':var _0x4d3118=require(_0x53e1('0x1c'));if(_0x386754[_0x53e1('0x1d')]&&_0x386754['authToken']&&_0x386754[_0x53e1('0x1e')]){var _0x248c82=new _0x4d3118(_0x386754[_0x53e1('0x1d')],_0x386754[_0x53e1('0x1f')]);_0x248c82[_0x53e1('0x20')][_0x53e1('0x21')]({'body':_0xcb714c[_0x53e1('0x22')],'to':_0xcb714c[_0x53e1('0x1e')],'from':_0x386754['phone'],'statusCallback':_0x386754[_0x53e1('0x23')]+'/api/sms/messages/'+_0xcb714c['id']+_0x53e1('0x24')+_0x386754[_0x53e1('0x25')]})[_0x53e1('0x14')](function(_0x290420){if(_0x290420['sid']){return _0x5c7d7e[_0x53e1('0x15')]({'messageId':_0x290420[_0x53e1('0x26')]});}})[_0x53e1('0x27')](function(_0xd3d2f5){logger[_0x53e1('0x17')](_0x53e1('0x28'),_0x53e1('0x29'),_0x53e1('0x1c'),util[_0x53e1('0x2a')](_0xd3d2f5,{'showHidden':![],'depth':null}));});}else{logger[_0x53e1('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x53e1('0x29'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x53e1('0x2b'):var _0x4d2f9f=_0x53e1('0x2c');if(_0x386754[_0x53e1('0x2d')]&&_0x386754[_0x53e1('0x2e')]){var _0x30bf94={'recipient':[_0xcb714c[_0x53e1('0x1e')]],'message':_0xcb714c[_0x53e1('0x22')],'message_type':_0x386754[_0x53e1('0x2f')]};if(_0x386754[_0x53e1('0x2f')]&&_0x386754['smsMethod']!=='SI'){_0x30bf94['sender']=_0x386754[_0x53e1('0x1e')];}var _0x342293={'url':_0x4d2f9f+_0x53e1('0x30')+_0x386754['username']+'&password='+_0x386754[_0x53e1('0x2e')],'method':_0x53e1('0x31')};rp(_0x342293)[_0x53e1('0x14')](function(_0x38a595){var _0x2162fe=_0x38a595[_0x53e1('0x32')](';');var _0x15844e={'user_key':_0x2162fe[0x0],'session_key':_0x2162fe[0x1]};_0x342293={'url':_0x4d2f9f+_0x53e1('0x33'),'method':_0x53e1('0x34'),'headers':{'user_key':_0x15844e[_0x53e1('0x35')],'Session_key':_0x15844e[_0x53e1('0x36')]},'json':!![],'body':_0x30bf94};return rp(_0x342293);})['then'](function(_0x414d00){if(_0x414d00['total_sent']>=0x1){var _0x1d2f29={'messageId':_0x414d00[_0x53e1('0x37')]};if(_0x386754['smsMethod']!=='GP'||!_0x386754[_0x53e1('0x38')]){_0x1d2f29['read']=!![];}return _0x5c7d7e['update'](_0x1d2f29);}else{return logger[_0x53e1('0x17')](_0x53e1('0x28'),_0x53e1('0x29'),_0x53e1('0x2b'),util[_0x53e1('0x2a')](_0x414d00,{'showHidden':![],'depth':null}));}})[_0x53e1('0x27')](function(_0x3a0559){return logger[_0x53e1('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x53e1('0x2b'),util['inspect'](_0x3a0559,{'showHidden':![],'depth':null}));});}else{logger[_0x53e1('0x17')](_0x53e1('0x28'),'afterCreate','skebby',_0x53e1('0x39'));}break;case _0x53e1('0x3a'):if(_0x386754['authToken']){var _0x276743={'recipient':_0xcb714c[_0x53e1('0x1e')],'message':_0xcb714c[_0x53e1('0x22')],'sender':_0x386754[_0x53e1('0x3b')]||_0x386754[_0x53e1('0x1e')],'authorization':_0x386754[_0x53e1('0x1f')]};var _0x4579de={'method':_0x53e1('0x34'),'uri':_0x53e1('0x3c'),'body':_0x276743,'json':!![]};rp(_0x4579de)[_0x53e1('0x14')](function(_0x1be3f3){var _0x46c4be={'messageId':_0x1be3f3['requestid']};if(!_0x386754[_0x53e1('0x38')]){_0x46c4be['read']=!![];}return _0x5c7d7e[_0x53e1('0x15')](_0x46c4be);})[_0x53e1('0x27')](function(_0x56dd44){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x53e1('0x3a'),util['inspect'](_0x56dd44,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x53e1('0x28'),_0x53e1('0x29'),_0x53e1('0x3a'),_0x53e1('0x3d'));}break;case _0x53e1('0x3e'):if(_0x386754['username']&&_0x386754[_0x53e1('0x2e')]){var _0x276743={'messages':[{'source':_0x53e1('0x3f'),'to':_0xcb714c[_0x53e1('0x1e')],'body':_0xcb714c[_0x53e1('0x22')],'from':_0x386754['senderString']||_0x386754['phone']}]};var _0x3bd03e=util['format'](_0x53e1('0x40'),_0x386754[_0x53e1('0x2d')],_0x386754[_0x53e1('0x2e')]);var _0x4579de={'method':'POST','uri':_0x53e1('0x41'),'body':_0x276743,'headers':{'Authorization':util[_0x53e1('0x42')](_0x53e1('0x43'),new Buffer(_0x3bd03e)[_0x53e1('0x44')](_0x53e1('0x45')))},'json':!![]};rp(_0x4579de)['then'](function(_0x59e33a){if(_0x59e33a[_0x53e1('0x46')]>=0xc8&&_0x59e33a['http_code']<=0xce){if(_0x59e33a[_0x53e1('0x47')]&&_0x59e33a[_0x53e1('0x47')][_0x53e1('0x48')]>0x0){var _0x122927=_[_0x53e1('0x49')](_0x59e33a[_0x53e1('0x47')][_0x53e1('0x20')]);var _0x4d6817={'messageId':_0x122927['message_id']};if(!_0x386754[_0x53e1('0x38')]){_0x4d6817[_0x53e1('0x4a')]=!![];}return _0x5c7d7e['update'](_0x4d6817);}else{logger['error'](_0x53e1('0x28'),'afterCreate',_0x53e1('0x4b'),util['inspect'](_0x59e33a,{'showHidden':![],'depth':null}));}}else{logger[_0x53e1('0x17')](_0x53e1('0x28'),_0x53e1('0x29'),_0x53e1('0x4b'),util['inspect'](_0x59e33a,{'showHidden':![],'depth':null}));}})['catch'](function(_0x348da5){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x53e1('0x29'),_0x53e1('0x4b'),util[_0x53e1('0x2a')](_0x348da5,{'showHidden':![],'depth':null}));});}else{logger[_0x53e1('0x17')](_0x53e1('0x28'),_0x53e1('0x29'),'clickSend',_0x53e1('0x39'));}break;case _0x53e1('0x4c'):if(_0x386754[_0x53e1('0x4d')]&&_0x386754[_0x53e1('0x1f')]){var _0x276743={'dst':_0xcb714c[_0x53e1('0x1e')],'text':_0xcb714c[_0x53e1('0x22')],'src':_0x386754[_0x53e1('0x3b')]||_0x386754['phone'],'url':_0x386754['remote']+_0x53e1('0x4e')+_0xcb714c['id']+_0x53e1('0x24')+_0x386754['token']};var _0x3bd03e=util[_0x53e1('0x42')](_0x53e1('0x40'),_0x386754[_0x53e1('0x4d')],_0x386754['authToken']);var _0x4579de={'method':'POST','uri':util[_0x53e1('0x42')]('https://api.plivo.com/v1/Account/%s/Message/',_0x386754[_0x53e1('0x4d')]),'body':_0x276743,'headers':{'Authorization':util[_0x53e1('0x42')](_0x53e1('0x43'),new Buffer(_0x3bd03e)[_0x53e1('0x44')](_0x53e1('0x45')))},'json':!![]};rp(_0x4579de)['then'](function(_0xf19308){var _0x28a721={'messageId':_0xf19308[_0x53e1('0x4f')][0x0]};return _0x5c7d7e[_0x53e1('0x15')](_0x28a721);})[_0x53e1('0x27')](function(_0x575275){logger[_0x53e1('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x53e1('0x29'),_0x53e1('0x4c'),util[_0x53e1('0x2a')](_0x575275,{'showHidden':![],'depth':null}));});}else{logger[_0x53e1('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','plivo',_0x53e1('0x50'));}break;case _0x53e1('0x51'):if(_0x386754[_0x53e1('0x2d')]&&_0x386754[_0x53e1('0x2e')]){if(_0x386754[_0x53e1('0x52')]){var _0x3c3eb3={'method':'POST','uri':_0x386754['baseUrl']+_0x53e1('0x53'),'body':{'username':_0x386754['username'],'password':_0x386754[_0x53e1('0x2e')]},'json':!![]};return rp(_0x3c3eb3)[_0x53e1('0x14')](function(_0x4f688b){var _0x3adbe6={'method':_0x53e1('0x34'),'uri':_0x386754[_0x53e1('0x52')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x386754[_0x53e1('0x1e')],'destinations':[{'to':_0xcb714c[_0x53e1('0x1e')]}],'text':_0xcb714c[_0x53e1('0x22')],'notifyUrl':_0x386754[_0x53e1('0x23')]+_0x53e1('0x4e')+_0xcb714c['id']+_0x53e1('0x24')+_0x386754[_0x53e1('0x25')],'notifyContentType':_0x53e1('0x54'),'callbackData':_0x386754[_0x53e1('0x1e')]+';'+_0xcb714c['body']}]},'headers':{'Authorization':'IBSSO\x20'+_0x4f688b[_0x53e1('0x25')]},'json':!![]};return rp(_0x3adbe6)[_0x53e1('0x14')](function(_0xd677a){if(_0xd677a[_0x53e1('0x20')]){var _0x3c0316={'messageId':_0xd677a[_0x53e1('0x20')][0x0][_0x53e1('0xa')]};if(!_0x386754['deliveryReport']){_0x3c0316[_0x53e1('0x4a')]=!![];}return _0x5c7d7e[_0x53e1('0x15')](_0x3c0316);}else{return logger[_0x53e1('0x17')](_0x53e1('0x28'),_0x53e1('0x29'),'infobip',util[_0x53e1('0x2a')](_0xd677a,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x41598b){return logger[_0x53e1('0x17')](_0x53e1('0x28'),_0x53e1('0x29'),'infobip',util[_0x53e1('0x2a')](_0x41598b,{'showHidden':![],'depth':null}));});}else{logger[_0x53e1('0x17')](_0x53e1('0x28'),_0x53e1('0x29'),_0x53e1('0x51'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x53e1('0x17')](_0x53e1('0x28'),_0x53e1('0x29'),'infobip',_0x53e1('0x39'));}break;case'csc':var _0x57bd3a=require('crypto');if(_0x386754['apiKey']){var _0x308d94={};_0x308d94[_0x53e1('0x55')]=_0x386754[_0x53e1('0x2d')];_0x308d94[_0x53e1('0x1e')]=_0xcb714c[_0x53e1('0x1e')];_0x308d94[_0x53e1('0x56')]=_0x386754['phone'];_0x308d94[_0x53e1('0x57')]=_0xcb714c[_0x53e1('0x22')];_0x308d94[_0x53e1('0x58')]=+new Date();var _0x2a8bf0='';var _0x484318='';var _0x2eab15=Object[_0x53e1('0x59')](_0x308d94);_0x2eab15['sort']();for(var _0x451734=0x0;_0x451734<_0x2eab15[_0x53e1('0x5a')];_0x451734++){if(_0x2a8bf0!=''){_0x2a8bf0+='&';}_0x2a8bf0+=_0x2eab15[_0x451734]+'='+encodeURIComponent(_0x308d94[_0x2eab15[_0x451734]]);_0x484318+=_0x308d94[_0x2eab15[_0x451734]];}_0x484318+=_0x386754[_0x53e1('0x5b')];_0x484318=_0x57bd3a['createHash'](_0x53e1('0x5c'))[_0x53e1('0x15')](_0x484318)[_0x53e1('0x5d')](_0x53e1('0x5e'));if(_0x2a8bf0!==''){_0x2a8bf0+='&';}_0x2a8bf0+=_0x53e1('0x5f')+_0x484318;var _0x342293={'method':'GET','uri':_0x386754[_0x53e1('0x52')]+'/external/get/send.php?'+_0x2a8bf0,'json':!![]};return rp(_0x342293)[_0x53e1('0x14')](function(_0x5bdbd7){var _0x112fbc=Object[_0x53e1('0x59')](_0x5bdbd7);if(_0x5bdbd7[_0x112fbc[0x0]]['error']&&parseInt(_0x5bdbd7[_0x112fbc[0x0]][_0x53e1('0x17')])===0x0){var _0x3a641f={'messageId':_0x5bdbd7[_0x112fbc[0x0]][_0x53e1('0x60')]};if(!_0x386754[_0x53e1('0x38')]){_0x3a641f[_0x53e1('0x4a')]=!![];}return _0x5c7d7e[_0x53e1('0x15')](_0x3a641f);}else{return logger[_0x53e1('0x17')](_0x53e1('0x28'),_0x53e1('0x29'),_0x53e1('0x61'),util[_0x53e1('0x2a')](_0x5bdbd7[_0x53e1('0x17')],{'showHidden':![],'depth':null}));}})[_0x53e1('0x27')](function(_0x22bf2d){return logger[_0x53e1('0x17')](_0x53e1('0x28'),_0x53e1('0x29'),'csc',util['inspect'](_0x22bf2d,{'showHidden':![],'depth':null}));});}else{logger[_0x53e1('0x17')](_0x53e1('0x28'),_0x53e1('0x29'),_0x53e1('0x61'),'Missing\x20parameters:\x20apiKey');}break;case _0x53e1('0x62'):if(_0x386754[_0x53e1('0x5b')]){var _0x1f2e62={'method':_0x53e1('0x34'),'uri':_0x53e1('0x63'),'headers':{'Authorization':_0x386754[_0x53e1('0x5b')]},'body':{'content':_0xcb714c[_0x53e1('0x22')],'to':[_0xcb714c[_0x53e1('0x1e')]],'from':_0x386754[_0x53e1('0x1e')],'binary':![],'clientMessageId':'uuid','charset':_0x53e1('0x64')},'json':!![]};rp(_0x1f2e62)[_0x53e1('0x14')](function(_0x522358){if(!_0x522358[_0x53e1('0x17')]){var _0x384d52={'messageId':_0x522358[_0x53e1('0x20')][0x0][_0x53e1('0x65')]};if(!_0x386754[_0x53e1('0x38')]){_0x384d52[_0x53e1('0x4a')]=!![];}return _0x5c7d7e[_0x53e1('0x15')](_0x384d52);}else{return logger[_0x53e1('0x17')](_0x53e1('0x28'),_0x53e1('0x29'),_0x53e1('0x62'),util[_0x53e1('0x2a')](_0x522358[_0x53e1('0x17')],{'showHidden':![],'depth':null}));}})[_0x53e1('0x27')](function(_0x8cdec0){return logger[_0x53e1('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x53e1('0x29'),'clickatell',util[_0x53e1('0x2a')](_0x8cdec0,{'showHidden':![],'depth':null}));});}else{logger[_0x53e1('0x17')](_0x53e1('0x28'),_0x53e1('0x29'),_0x53e1('0x62'),_0x53e1('0x66'));}break;case _0x53e1('0x67'):if(_0x386754[_0x53e1('0x2d')]&&_0x386754[_0x53e1('0x2e')]){var _0x3bd03e=util['format'](_0x53e1('0x40'),_0x386754[_0x53e1('0x2d')],_0x386754[_0x53e1('0x2e')]);var _0x4579de={'method':_0x53e1('0x34'),'uri':_0x53e1('0x68')+_0x386754['accountId']+_0x53e1('0x69'),'body':{'to':[_0xcb714c[_0x53e1('0x1e')]],'text':_0xcb714c[_0x53e1('0x22')],'from':_0x386754['phone'],'applicationId':_0x386754['applicationId']},'headers':{'Authorization':util['format'](_0x53e1('0x43'),new Buffer(_0x3bd03e)[_0x53e1('0x44')](_0x53e1('0x45')))},'json':!![]};rp(_0x4579de)[_0x53e1('0x14')](function(_0x503a81){if(_0x503a81['id']){var _0x1c1944={'messageId':_0x503a81['id']};return _0x5c7d7e[_0x53e1('0x15')](_0x1c1944);}else{logger[_0x53e1('0x17')](_0x53e1('0x28'),'afterCreate',_0x53e1('0x67'),util['inspect'](_0x503a81,{'showHidden':![],'depth':null}));}})[_0x53e1('0x27')](function(_0x14f166){logger[_0x53e1('0x17')](_0x53e1('0x28'),_0x53e1('0x29'),'bandwidth',util['inspect'](_0x14f166,{'showHidden':![],'depth':null}));});}else{logger[_0x53e1('0x17')](_0x53e1('0x28'),'afterCreate',_0x53e1('0x67'),_0x53e1('0x39'));}break;case _0x53e1('0x6a'):if(_0x386754[_0x53e1('0x5b')]){var _0xad1234={};var _0x342293={'method':_0x53e1('0x34'),'uri':_0x53e1('0x6b'),'headers':{'Authorization':_0x53e1('0x6c')+_0x386754[_0x53e1('0x5b')],'Content-Type':'application/json'},'body':{'from':_0x386754[_0x53e1('0x1e')],'to':_0xcb714c[_0x53e1('0x1e')],'text':_0xcb714c['body']},'json':!![]};return rp(_0x342293)['then'](function(_0x24f408){if(_0x24f408[_0x53e1('0x6d')]==0xca){_0xad1234[_0x53e1('0x6e')]=_0x24f408;var _0x31a6ba={'method':'POST','uri':_0x53e1('0x6f'),'headers':{'Authorization':_0x53e1('0x6c')+_0x386754[_0x53e1('0x5b')],'Content-Type':'application/json'},'body':{'refid':_0xad1234['message']['refid']},'json':!![]};return rp(_0x31a6ba)[_0x53e1('0x14')](function(_0x2b543f){_0xad1234[_0x53e1('0x70')]=_0x2b543f;var _0x2dac79={'messageId':_0xad1234['message'][_0x53e1('0x71')],'read':!![]};return _0x5c7d7e['update'](_0x2dac79);});}else{return logger[_0x53e1('0x17')](_0x53e1('0x28'),_0x53e1('0x29'),_0x53e1('0x6a'),util['inspect'](_0x24f408,{'showHidden':![],'depth':null}));}})['catch'](function(_0x36112f){return logger[_0x53e1('0x17')](_0x53e1('0x28'),_0x53e1('0x29'),_0x53e1('0x6a'),util['inspect'](_0x36112f,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x53e1('0x28'),_0x53e1('0x29'),_0x53e1('0x6a'),_0x53e1('0x72'));}break;}}})['finally'](function(){_0x4cfaba();});}else{_0x4cfaba();}}},'charset':'utf8mb4','collate':_0x53e1('0x73')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 1f7e7b1..9d75a99 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 _0xb3bf=['catch','CreateSmsMessage','SmsMessage','create','body','options','raw','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','localhost','./smsMessage.socket','register','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result'];(function(_0x5511ea,_0x175172){var _0x104292=function(_0x33c286){while(--_0x33c286){_0x5511ea['push'](_0x5511ea['shift']());}};_0x104292(++_0x175172);}(_0xb3bf,0x157));var _0xfb3b=function(_0x56c5bd,_0x30adb4){_0x56c5bd=_0x56c5bd-0x0;var _0x35ed02=_0xb3bf[_0x56c5bd];return _0x35ed02;};'use strict';var _=require(_0xfb3b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfb3b('0x1'));var fs=require('fs');var Redis=require(_0xfb3b('0x2'));var db=require(_0xfb3b('0x3'))['db'];var utils=require(_0xfb3b('0x4'));var logger=require(_0xfb3b('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfb3b('0x6'));var client=jayson['client'][_0xfb3b('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0xfb3b('0x8')],{'host':_0xfb3b('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfb3b('0x8')]));require(_0xfb3b('0xa'))[_0xfb3b('0xb')](socket);function respondWithRpcPromise(_0x1c1c37,_0x3ba2d9,_0x55050e){return new BPromise(function(_0xab83f8,_0x309e8f){return client['request'](_0x1c1c37,_0x55050e)[_0xfb3b('0xc')](function(_0x384eef){logger['info'](_0xfb3b('0xd'),_0x3ba2d9,_0xfb3b('0xe'));logger[_0xfb3b('0xf')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3ba2d9,_0xfb3b('0xe'),JSON[_0xfb3b('0x10')](_0x384eef));if(_0x384eef[_0xfb3b('0x11')]){if(_0x384eef[_0xfb3b('0x11')]['code']===0x1f4){logger['error'](_0xfb3b('0xd'),_0x3ba2d9,_0x384eef[_0xfb3b('0x11')][_0xfb3b('0x12')]);return _0x309e8f(_0x384eef[_0xfb3b('0x11')][_0xfb3b('0x12')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x3ba2d9,_0x384eef[_0xfb3b('0x11')][_0xfb3b('0x12')]);return _0xab83f8(_0x384eef['error'][_0xfb3b('0x12')]);}else{logger[_0xfb3b('0x13')](_0xfb3b('0xd'),_0x3ba2d9,_0xfb3b('0xe'));_0xab83f8(_0x384eef[_0xfb3b('0x14')][_0xfb3b('0x12')]);}})[_0xfb3b('0x15')](function(_0x334ea4){logger['error'](_0xfb3b('0xd'),_0x3ba2d9,_0x334ea4);_0x309e8f(_0x334ea4);});});}exports[_0xfb3b('0x16')]=function(_0x2f2a7e){var _0x25ab11=this;return new Promise(function(_0x56a3b9,_0x4caa65){return db[_0xfb3b('0x17')][_0xfb3b('0x18')](_0x2f2a7e[_0xfb3b('0x19')],{'raw':_0x2f2a7e[_0xfb3b('0x1a')]?_0x2f2a7e['options'][_0xfb3b('0x1b')]===undefined?!![]:![]:!![]})[_0xfb3b('0xc')](function(_0x44bb21){logger[_0xfb3b('0x13')](_0xfb3b('0x16'),_0x2f2a7e);logger['debug'](_0xfb3b('0x16'),_0x2f2a7e,JSON[_0xfb3b('0x10')](_0x44bb21));_0x56a3b9(_0x44bb21);})[_0xfb3b('0x15')](function(_0x546471){logger[_0xfb3b('0x11')](_0xfb3b('0x16'),_0x546471[_0xfb3b('0x12')],_0x2f2a7e);_0x4caa65(_0x25ab11[_0xfb3b('0x11')](0x1f4,_0x546471[_0xfb3b('0x12')]));});});}; \ No newline at end of file +var _0x11d2=['rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SmsMessage,\x20%s,\x20%s','message','catch','CreateSmsMessage','SmsMessage','body','options','raw','then','info','debug','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xc7f2b9,_0x580f74){var _0x1a7432=function(_0x46275b){while(--_0x46275b){_0xc7f2b9['push'](_0xc7f2b9['shift']());}};_0x1a7432(++_0x580f74);}(_0x11d2,0x110));var _0x211d=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0x11d2[_0x4ae829];return _0x256b31;};'use strict';var _=require(_0x211d('0x0'));var util=require('util');var moment=require(_0x211d('0x1'));var BPromise=require(_0x211d('0x2'));var rs=require(_0x211d('0x3'));var fs=require('fs');var Redis=require(_0x211d('0x4'));var db=require(_0x211d('0x5'))['db'];var utils=require(_0x211d('0x6'));var logger=require(_0x211d('0x7'))(_0x211d('0x8'));var config=require(_0x211d('0x9'));var jayson=require(_0x211d('0xa'));var client=jayson[_0x211d('0xb')]['http']({'port':0x232a});config[_0x211d('0xc')]=_[_0x211d('0xd')](config[_0x211d('0xc')],{'host':_0x211d('0xe'),'port':0x18eb});var socket=require(_0x211d('0xf'))(new Redis(config[_0x211d('0xc')]));require(_0x211d('0x10'))[_0x211d('0x11')](socket);function respondWithRpcPromise(_0x202b29,_0x47c31b,_0x50d935){return new BPromise(function(_0x57fce2,_0x5674d2){return client[_0x211d('0x12')](_0x202b29,_0x50d935)['then'](function(_0x507003){logger['info']('SmsMessage,\x20%s,\x20%s',_0x47c31b,'request\x20sent');logger['debug'](_0x211d('0x13'),_0x47c31b,_0x211d('0x14'),JSON['stringify'](_0x507003));if(_0x507003[_0x211d('0x15')]){if(_0x507003[_0x211d('0x15')][_0x211d('0x16')]===0x1f4){logger[_0x211d('0x15')](_0x211d('0x17'),_0x47c31b,_0x507003['error'][_0x211d('0x18')]);return _0x5674d2(_0x507003[_0x211d('0x15')]['message']);}logger['error'](_0x211d('0x17'),_0x47c31b,_0x507003[_0x211d('0x15')][_0x211d('0x18')]);return _0x57fce2(_0x507003[_0x211d('0x15')][_0x211d('0x18')]);}else{logger['info'](_0x211d('0x17'),_0x47c31b,'request\x20sent');_0x57fce2(_0x507003['result']['message']);}})[_0x211d('0x19')](function(_0x3ff3ca){logger['error'](_0x211d('0x17'),_0x47c31b,_0x3ff3ca);_0x5674d2(_0x3ff3ca);});});}exports[_0x211d('0x1a')]=function(_0x4dad06){var _0x5b5e05=this;return new Promise(function(_0xf029b0,_0x3e189d){return db[_0x211d('0x1b')]['create'](_0x4dad06[_0x211d('0x1c')],{'raw':_0x4dad06[_0x211d('0x1d')]?_0x4dad06[_0x211d('0x1d')][_0x211d('0x1e')]===undefined?!![]:![]:!![]})[_0x211d('0x1f')](function(_0x1f9b08){logger[_0x211d('0x20')]('CreateSmsMessage',_0x4dad06);logger[_0x211d('0x21')](_0x211d('0x1a'),_0x4dad06,JSON[_0x211d('0x22')](_0x1f9b08));_0xf029b0(_0x1f9b08);})[_0x211d('0x19')](function(_0x44f4b1){logger[_0x211d('0x15')](_0x211d('0x1a'),_0x44f4b1['message'],_0x4dad06);_0x3e189d(_0x5b5e05[_0x211d('0x15')](0x1f4,_0x44f4b1[_0x211d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index d160b36..477b65f 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 _0xa824=['update','removeListener','length','./smsMessage.events','save','remove'];(function(_0xbbfe59,_0x46067f){var _0x28a2a4=function(_0xfe230){while(--_0xfe230){_0xbbfe59['push'](_0xbbfe59['shift']());}};_0x28a2a4(++_0x46067f);}(_0xa824,0x183));var _0x4a82=function(_0x26a163,_0x4c335b){_0x26a163=_0x26a163-0x0;var _0x3a5a4e=_0xa824[_0x26a163];return _0x3a5a4e;};'use strict';var SmsMessageEvents=require(_0x4a82('0x0'));var events=[_0x4a82('0x1'),_0x4a82('0x2'),_0x4a82('0x3')];function createListener(_0x5b0aa4,_0x2c11d6){return function(_0x57d654){_0x2c11d6['emit'](_0x5b0aa4,_0x57d654);};}function removeListener(_0xccd446,_0x4b1703){return function(){SmsMessageEvents[_0x4a82('0x4')](_0xccd446,_0x4b1703);};}exports['register']=function(_0x99709c){for(var _0x2a2eef=0x0,_0x47ae61=events[_0x4a82('0x5')];_0x2a2eef<_0x47ae61;_0x2a2eef++){var _0x1da3d5=events[_0x2a2eef];var _0x1542e7=createListener('smsMessage:'+_0x1da3d5,_0x99709c);SmsMessageEvents['on'](_0x1da3d5,_0x1542e7);}}; \ No newline at end of file +var _0xfcf2=['save','remove','smsMessage:','./smsMessage.events'];(function(_0x56553e,_0x3a2373){var _0x229b34=function(_0x1c484c){while(--_0x1c484c){_0x56553e['push'](_0x56553e['shift']());}};_0x229b34(++_0x3a2373);}(_0xfcf2,0x153));var _0x2fcf=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xfcf2[_0x2c91e9];return _0x13f0ff;};'use strict';var SmsMessageEvents=require(_0x2fcf('0x0'));var events=[_0x2fcf('0x1'),_0x2fcf('0x2'),'update'];function createListener(_0x2125ff,_0x4709d4){return function(_0x214fef){_0x4709d4['emit'](_0x2125ff,_0x214fef);};}function removeListener(_0x51c9d2,_0x2722d6){return function(){SmsMessageEvents['removeListener'](_0x51c9d2,_0x2722d6);};}exports['register']=function(_0x22a2fa){for(var _0x1b238a=0x0,_0x28548c=events['length'];_0x1b238a<_0x28548c;_0x1b238a++){var _0x560deb=events[_0x1b238a];var _0xeee582=createListener(_0x2fcf('0x3')+_0x560deb,_0x22a2fa);SmsMessageEvents['on'](_0x560deb,_0xeee582);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 8336100..02d3a93 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 _0x9db0=['destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','update','delete'];(function(_0x255caf,_0x2f893b){var _0x25e862=function(_0xffbed9){while(--_0xffbed9){_0x255caf['push'](_0x255caf['shift']());}};_0x25e862(++_0x2f893b);}(_0x9db0,0xf4));var _0x09db=function(_0x1ae389,_0x282417){_0x1ae389=_0x1ae389-0x0;var _0xcee9ca=_0x9db0[_0x1ae389];return _0xcee9ca;};'use strict';var multer=require(_0x09db('0x0'));var util=require('util');var path=require(_0x09db('0x1'));var timeout=require(_0x09db('0x2'));var express=require(_0x09db('0x3'));var router=express[_0x09db('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x09db('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x09db('0x6'));var controller=require(_0x09db('0x7'));router[_0x09db('0x8')]('/',auth[_0x09db('0x9')](),controller[_0x09db('0xa')]);router[_0x09db('0x8')](_0x09db('0xb'),auth[_0x09db('0x9')](),controller['describe']);router[_0x09db('0x8')]('/:id',auth[_0x09db('0x9')](),controller[_0x09db('0xc')]);router[_0x09db('0x8')](_0x09db('0xd'),auth[_0x09db('0x9')](),controller[_0x09db('0xe')]);router[_0x09db('0x8')]('/:id/teams',auth[_0x09db('0x9')](),controller[_0x09db('0xf')]);router[_0x09db('0x8')](_0x09db('0x10'),auth[_0x09db('0x9')](),controller[_0x09db('0x11')]);router[_0x09db('0x12')]('/',auth[_0x09db('0x9')](),controller[_0x09db('0x13')]);router[_0x09db('0x12')](_0x09db('0x14'),auth['isAuthenticated'](),controller[_0x09db('0x15')]);router[_0x09db('0x12')](_0x09db('0x10'),auth['isAuthenticated'](),controller[_0x09db('0x16')]);router[_0x09db('0x17')]('/:id',auth[_0x09db('0x9')](),controller[_0x09db('0x18')]);router[_0x09db('0x19')]('/:id',auth[_0x09db('0x9')](),controller[_0x09db('0x1a')]);router['delete']('/:id/teams',auth[_0x09db('0x9')](),controller[_0x09db('0x1b')]);router[_0x09db('0x19')](_0x09db('0x10'),auth[_0x09db('0x9')](),controller[_0x09db('0x1c')]);module[_0x09db('0x1d')]=router; \ No newline at end of file +var _0xdb92=['../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','/:id/teams','/:id/users','addAgents','put','update','delete','removeTeams','removeAgents','exports','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x556581,_0x3e6075){var _0x1d8143=function(_0x2c0ff5){while(--_0x2c0ff5){_0x556581['push'](_0x556581['shift']());}};_0x1d8143(++_0x3e6075);}(_0xdb92,0x127));var _0x2db9=function(_0x3d27dd,_0x47ad28){_0x3d27dd=_0x3d27dd-0x0;var _0x45ca7e=_0xdb92[_0x3d27dd];return _0x45ca7e;};'use strict';var multer=require('multer');var util=require(_0x2db9('0x0'));var path=require('path');var timeout=require(_0x2db9('0x1'));var express=require(_0x2db9('0x2'));var router=express[_0x2db9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2db9('0x4'));var interaction=require(_0x2db9('0x5'));var config=require(_0x2db9('0x6'));var controller=require(_0x2db9('0x7'));router[_0x2db9('0x8')]('/',auth[_0x2db9('0x9')](),controller[_0x2db9('0xa')]);router[_0x2db9('0x8')](_0x2db9('0xb'),auth[_0x2db9('0x9')](),controller['describe']);router[_0x2db9('0x8')](_0x2db9('0xc'),auth[_0x2db9('0x9')](),controller[_0x2db9('0xd')]);router[_0x2db9('0x8')]('/:id/members',auth[_0x2db9('0x9')](),controller['getMembers']);router[_0x2db9('0x8')]('/:id/teams',auth[_0x2db9('0x9')](),controller['getTeams']);router[_0x2db9('0x8')]('/:id/users',auth[_0x2db9('0x9')](),controller['getAgents']);router[_0x2db9('0xe')]('/',auth[_0x2db9('0x9')](),controller[_0x2db9('0xf')]);router[_0x2db9('0xe')](_0x2db9('0x10'),auth[_0x2db9('0x9')](),controller['addTeams']);router['post'](_0x2db9('0x11'),auth[_0x2db9('0x9')](),controller[_0x2db9('0x12')]);router[_0x2db9('0x13')](_0x2db9('0xc'),auth[_0x2db9('0x9')](),controller[_0x2db9('0x14')]);router[_0x2db9('0x15')]('/:id',auth[_0x2db9('0x9')](),controller['destroy']);router['delete'](_0x2db9('0x10'),auth[_0x2db9('0x9')](),controller[_0x2db9('0x16')]);router[_0x2db9('0x15')](_0x2db9('0x11'),auth[_0x2db9('0x9')](),controller[_0x2db9('0x17')]);module[_0x2db9('0x18')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 1f5ddd3..9aef560 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 _0x7226=['exports','STRING','INTEGER','rrmemory'];(function(_0x5dc5fc,_0x19e40d){var _0x310094=function(_0x470c6a){while(--_0x470c6a){_0x5dc5fc['push'](_0x5dc5fc['shift']());}};_0x310094(++_0x19e40d);}(_0x7226,0x1b4));var _0x6722=function(_0x491496,_0x50fc1c){_0x491496=_0x491496-0x0;var _0x15fec2=_0x7226[_0x491496];return _0x15fec2;};'use strict';var Sequelize=require('sequelize');module[_0x6722('0x0')]={'name':{'type':Sequelize[_0x6722('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6722('0x1')]},'timeout':{'type':Sequelize[_0x6722('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x6722('0x3'),'beepall','roundrobin')}}; \ No newline at end of file +var _0x9a37=['INTEGER','ENUM','rrmemory','beepall','sequelize','STRING','name'];(function(_0x366335,_0x52056a){var _0x3dd401=function(_0x5f28ad){while(--_0x5f28ad){_0x366335['push'](_0x366335['shift']());}};_0x3dd401(++_0x52056a);}(_0x9a37,0xf9));var _0x79a3=function(_0x102826,_0x35f7b9){_0x102826=_0x102826-0x0;var _0x57556e=_0x9a37[_0x102826];return _0x57556e;};'use strict';var Sequelize=require(_0x79a3('0x0'));module['exports']={'name':{'type':Sequelize[_0x79a3('0x1')],'unique':_0x79a3('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x79a3('0x1')]},'timeout':{'type':Sequelize[_0x79a3('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x79a3('0x4')](_0x79a3('0x5'),_0x79a3('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 8150e1a..6599c7e 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 _0xc468=['options','find','create','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserSmsQueue','order','findAndCountAll','agent','smsPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','hasOwnProperty','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','each','findOrCreate','forEach','emit','userSmsQueue:save','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','sequelize','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','userSmsQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./smsQueue.socket','register','end','status','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','get','SmsQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','sort','pick','filter','where','VIRTUAL','merge','includeAll','findAll','catch','show','params'];(function(_0x35ed66,_0x2e94c5){var _0x4b33a6=function(_0x21c8cc){while(--_0x21c8cc){_0x35ed66['push'](_0x35ed66['shift']());}};_0x4b33a6(++_0x2e94c5);}(_0xc468,0xd0));var _0x8c46=function(_0x2c8898,_0x1b5aa4){_0x2c8898=_0x2c8898-0x0;var _0x37cb1a=_0xc468[_0x2c8898];return _0x37cb1a;};'use strict';var emlformat=require(_0x8c46('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8c46('0x1'));var jsonpatch=require(_0x8c46('0x2'));var rp=require(_0x8c46('0x3'));var moment=require(_0x8c46('0x4'));var BPromise=require(_0x8c46('0x5'));var Mustache=require(_0x8c46('0x6'));var util=require(_0x8c46('0x7'));var path=require(_0x8c46('0x8'));var sox=require(_0x8c46('0x9'));var csv=require('to-csv');var ejs=require(_0x8c46('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8c46('0xb'));var squel=require(_0x8c46('0xc'));var crypto=require(_0x8c46('0xd'));var jsforce=require(_0x8c46('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8c46('0xf'));var querystring=require(_0x8c46('0x10'));var Papa=require(_0x8c46('0x11'));var Redis=require('ioredis');var authService=require(_0x8c46('0x12'));var qs=require(_0x8c46('0x13'));var as=require(_0x8c46('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c46('0x15'))(_0x8c46('0x16'));var utils=require(_0x8c46('0x17'));var config=require(_0x8c46('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x8c46('0x19')]=_['defaults'](config['redis'],{'host':_0x8c46('0x1a'),'port':0x18eb});var socket=require(_0x8c46('0x1b'))(new Redis(config[_0x8c46('0x19')]));require(_0x8c46('0x1c'))[_0x8c46('0x1d')](socket);function respondWithStatusCode(_0x20e656,_0x2b7a7f){_0x2b7a7f=_0x2b7a7f||0xcc;return function(_0x4632d4){if(_0x4632d4){return _0x20e656['sendStatus'](_0x2b7a7f);}return _0x20e656['status'](_0x2b7a7f)[_0x8c46('0x1e')]();};}function respondWithResult(_0x3d74b9,_0x2cf6ae){_0x2cf6ae=_0x2cf6ae||0xc8;return function(_0x25a3f3){if(_0x25a3f3){return _0x3d74b9[_0x8c46('0x1f')](_0x2cf6ae)[_0x8c46('0x20')](_0x25a3f3);}};}function respondWithFilteredResult(_0x3d08bc,_0x1fb993){return function(_0x167855){if(_0x167855){var _0x36680f=typeof _0x1fb993[_0x8c46('0x21')]===_0x8c46('0x22')&&typeof _0x1fb993[_0x8c46('0x23')]===_0x8c46('0x22');var _0x3420ef=_0x167855[_0x8c46('0x24')];var _0x2b2430=_0x36680f?0x0:_0x1fb993[_0x8c46('0x21')];var _0x5564ca=_0x36680f?_0x167855[_0x8c46('0x24')]:_0x1fb993[_0x8c46('0x21')]+_0x1fb993[_0x8c46('0x23')];var _0x1b164c;if(_0x5564ca>=_0x3420ef){_0x5564ca=_0x3420ef;_0x1b164c=0xc8;}else{_0x1b164c=0xce;}_0x3d08bc['status'](_0x1b164c);return _0x3d08bc['set']('Content-Range',_0x2b2430+'-'+_0x5564ca+'/'+_0x3420ef)['json'](_0x167855);}return null;};}function patchUpdates(_0x12d5fa){return function(_0x44de5e){try{jsonpatch[_0x8c46('0x25')](_0x44de5e,_0x12d5fa,!![]);}catch(_0x8160){return BPromise[_0x8c46('0x26')](_0x8160);}return _0x44de5e[_0x8c46('0x27')]();};}function saveUpdates(_0x320805,_0x38adf9){return function(_0x58a7f0){if(_0x58a7f0){return _0x58a7f0[_0x8c46('0x28')](_0x320805)[_0x8c46('0x29')](function(_0x2a583f){return _0x2a583f;});}return null;};}function removeEntity(_0x333360,_0x4aed4b){return function(_0x23f498){if(_0x23f498){return _0x23f498[_0x8c46('0x2a')]()[_0x8c46('0x29')](function(){var _0x28dda8=_0x23f498[_0x8c46('0x2b')]({'plain':!![]});var _0x4bf8bf=_0x8c46('0x2c');return db[_0x8c46('0x2d')][_0x8c46('0x2a')]({'where':{'type':_0x4bf8bf,'resourceId':_0x28dda8['id']}})[_0x8c46('0x29')](function(){return _0x23f498;});})[_0x8c46('0x29')](function(){_0x333360[_0x8c46('0x1f')](0xcc)[_0x8c46('0x1e')]();});}};}function handleEntityNotFound(_0x4bc631,_0x467871){return function(_0x3ce18b){if(!_0x3ce18b){_0x4bc631[_0x8c46('0x2e')](0x194);}return _0x3ce18b;};}function handleError(_0x9ed31a,_0x270cf0){_0x270cf0=_0x270cf0||0x1f4;return function(_0x42a27f){logger[_0x8c46('0x2f')](_0x42a27f[_0x8c46('0x30')]);if(_0x42a27f['name']){delete _0x42a27f[_0x8c46('0x31')];}_0x9ed31a[_0x8c46('0x1f')](_0x270cf0)[_0x8c46('0x32')](_0x42a27f);};}exports[_0x8c46('0x33')]=function(_0x30d4db,_0x490ffe){var _0x7c8476={},_0x5e3916={},_0x3e95d9={'count':0x0,'rows':[]};var _0x4190a2=_[_0x8c46('0x34')](db[_0x8c46('0x35')][_0x8c46('0x36')],function(_0x484383){return{'name':_0x484383[_0x8c46('0x37')],'type':_0x484383[_0x8c46('0x38')][_0x8c46('0x39')]};});_0x5e3916['model']=_['map'](_0x4190a2,_0x8c46('0x31'));_0x5e3916[_0x8c46('0x3a')]=_[_0x8c46('0x3b')](_0x30d4db[_0x8c46('0x3a')]);_0x5e3916[_0x8c46('0x3c')]=_[_0x8c46('0x3d')](_0x5e3916['model'],_0x5e3916['query']);_0x7c8476[_0x8c46('0x3e')]=_[_0x8c46('0x3d')](_0x5e3916[_0x8c46('0x3f')],qs[_0x8c46('0x40')](_0x30d4db[_0x8c46('0x3a')][_0x8c46('0x40')]));_0x7c8476[_0x8c46('0x3e')]=_0x7c8476['attributes'][_0x8c46('0x41')]?_0x7c8476[_0x8c46('0x3e')]:_0x5e3916[_0x8c46('0x3f')];if(!_0x30d4db['query']['hasOwnProperty'](_0x8c46('0x42'))){_0x7c8476[_0x8c46('0x23')]=qs[_0x8c46('0x23')](_0x30d4db[_0x8c46('0x3a')][_0x8c46('0x23')]);_0x7c8476[_0x8c46('0x21')]=qs['offset'](_0x30d4db['query'][_0x8c46('0x21')]);}_0x7c8476['order']=qs['sort'](_0x30d4db[_0x8c46('0x3a')][_0x8c46('0x43')]);_0x7c8476['where']=qs['filters'](_[_0x8c46('0x44')](_0x30d4db[_0x8c46('0x3a')],_0x5e3916[_0x8c46('0x3c')]),_0x4190a2);if(_0x30d4db['query'][_0x8c46('0x45')]){_0x7c8476[_0x8c46('0x46')]=_['merge'](_0x7c8476['where'],{'$or':_[_0x8c46('0x34')](_0x4190a2,function(_0xb75a27){if(_0xb75a27['type']!==_0x8c46('0x47')){var _0x510fac={};_0x510fac[_0xb75a27[_0x8c46('0x31')]]={'$like':'%'+_0x30d4db['query'][_0x8c46('0x45')]+'%'};return _0x510fac;}})});}_0x7c8476=_[_0x8c46('0x48')]({},_0x7c8476,_0x30d4db['options']);var _0x53c4bb={'where':_0x7c8476[_0x8c46('0x46')]};return db[_0x8c46('0x35')][_0x8c46('0x24')](_0x53c4bb)[_0x8c46('0x29')](function(_0x49fb1a){_0x3e95d9['count']=_0x49fb1a;if(_0x30d4db[_0x8c46('0x3a')][_0x8c46('0x49')]){_0x7c8476['include']=[{'all':!![]}];}return db[_0x8c46('0x35')][_0x8c46('0x4a')](_0x7c8476);})[_0x8c46('0x29')](function(_0x52c61e){_0x3e95d9['rows']=_0x52c61e;return _0x3e95d9;})['then'](respondWithFilteredResult(_0x490ffe,_0x7c8476))[_0x8c46('0x4b')](handleError(_0x490ffe,null));};exports[_0x8c46('0x4c')]=function(_0x2900ac,_0x32bd7d){var _0x139ae7={'raw':!![],'where':{'id':_0x2900ac[_0x8c46('0x4d')]['id']}},_0x14d5cd={};_0x14d5cd['model']=_[_0x8c46('0x3b')](db[_0x8c46('0x35')][_0x8c46('0x36')]);_0x14d5cd[_0x8c46('0x3a')]=_['keys'](_0x2900ac[_0x8c46('0x3a')]);_0x14d5cd[_0x8c46('0x3c')]=_[_0x8c46('0x3d')](_0x14d5cd[_0x8c46('0x3f')],_0x14d5cd[_0x8c46('0x3a')]);_0x139ae7[_0x8c46('0x3e')]=_[_0x8c46('0x3d')](_0x14d5cd[_0x8c46('0x3f')],qs['fields'](_0x2900ac[_0x8c46('0x3a')]['fields']));_0x139ae7[_0x8c46('0x3e')]=_0x139ae7[_0x8c46('0x3e')][_0x8c46('0x41')]?_0x139ae7[_0x8c46('0x3e')]:_0x14d5cd[_0x8c46('0x3f')];if(_0x2900ac[_0x8c46('0x3a')][_0x8c46('0x49')]){_0x139ae7['include']=[{'all':!![]}];}_0x139ae7=_[_0x8c46('0x48')]({},_0x139ae7,_0x2900ac[_0x8c46('0x4e')]);return db[_0x8c46('0x35')][_0x8c46('0x4f')](_0x139ae7)[_0x8c46('0x29')](handleEntityNotFound(_0x32bd7d,null))[_0x8c46('0x29')](respondWithResult(_0x32bd7d,null))[_0x8c46('0x4b')](handleError(_0x32bd7d,null));};exports[_0x8c46('0x50')]=function(_0x3cef9a,_0x293d52){return db[_0x8c46('0x35')][_0x8c46('0x50')](_0x3cef9a['body'],{})['then'](function(_0x1a4c6b){var _0x3decf6=_0x3cef9a[_0x8c46('0x51')]['get']({'plain':!![]});if(!_0x3decf6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3decf6['role']==='user'){var _0x5d47d5=_0x1a4c6b['get']({'plain':!![]});var _0x4eadf8=_0x8c46('0x2c');return db[_0x8c46('0x52')][_0x8c46('0x4f')]({'where':{'name':_0x4eadf8,'userProfileId':_0x3decf6[_0x8c46('0x53')]},'raw':!![]})[_0x8c46('0x29')](function(_0x353258){if(_0x353258&&_0x353258['autoAssociation']===0x0){return db[_0x8c46('0x2d')]['create']({'name':_0x5d47d5[_0x8c46('0x31')],'resourceId':_0x5d47d5['id'],'type':_0x353258[_0x8c46('0x31')],'sectionId':_0x353258['id']},{})[_0x8c46('0x29')](function(){return _0x1a4c6b;});}else{return _0x1a4c6b;}})[_0x8c46('0x4b')](function(_0xc4aa65){logger[_0x8c46('0x2f')](_0x8c46('0x54'),_0xc4aa65);throw _0xc4aa65;});}return _0x1a4c6b;})[_0x8c46('0x29')](respondWithResult(_0x293d52,0xc9))[_0x8c46('0x4b')](handleError(_0x293d52,null));};exports[_0x8c46('0x28')]=function(_0x1a5aff,_0x2b178d){if(_0x1a5aff['body']['id']){delete _0x1a5aff[_0x8c46('0x55')]['id'];}return db[_0x8c46('0x35')]['find']({'where':{'id':_0x1a5aff[_0x8c46('0x4d')]['id']}})[_0x8c46('0x29')](handleEntityNotFound(_0x2b178d,null))[_0x8c46('0x29')](saveUpdates(_0x1a5aff[_0x8c46('0x55')],null))[_0x8c46('0x29')](respondWithResult(_0x2b178d,null))[_0x8c46('0x4b')](handleError(_0x2b178d,null));};exports[_0x8c46('0x2a')]=function(_0x228cea,_0x355f3e){return db[_0x8c46('0x35')][_0x8c46('0x4f')]({'where':{'id':_0x228cea[_0x8c46('0x4d')]['id']}})[_0x8c46('0x29')](handleEntityNotFound(_0x355f3e,null))[_0x8c46('0x29')](removeEntity(_0x355f3e,null))['catch'](handleError(_0x355f3e,null));};exports[_0x8c46('0x56')]=function(_0x55749b,_0x1abb97){return db[_0x8c46('0x35')]['describe']()[_0x8c46('0x29')](respondWithResult(_0x1abb97,null))[_0x8c46('0x4b')](handleError(_0x1abb97,null));};exports['getMembers']=function(_0x47d41f,_0x10c6dc,_0x5c2b32){var _0x3d79eb={'raw':!![],'where':{}},_0x2257b8={},_0x40cecc;return db[_0x8c46('0x35')][_0x8c46('0x57')]({'where':{'id':_0x47d41f[_0x8c46('0x4d')]['id']}})[_0x8c46('0x29')](handleEntityNotFound(_0x10c6dc,null))[_0x8c46('0x29')](function(_0x1d08c7){if(_0x1d08c7){_0x40cecc=_0x1d08c7[_0x8c46('0x2b')]({'plain':!![]});_0x2257b8['model']=_['keys'](db[_0x8c46('0x58')][_0x8c46('0x36')]);_0x2257b8['query']=_['keys'](_0x47d41f['query']);_0x2257b8[_0x8c46('0x3c')]=_[_0x8c46('0x3d')](_0x2257b8[_0x8c46('0x3f')],_0x2257b8['query']);_0x3d79eb[_0x8c46('0x3e')]=_['intersection'](_0x2257b8[_0x8c46('0x3f')],qs[_0x8c46('0x40')](_0x47d41f[_0x8c46('0x3a')][_0x8c46('0x40')]));_0x3d79eb[_0x8c46('0x3e')]=_0x3d79eb[_0x8c46('0x3e')]['length']?_0x3d79eb[_0x8c46('0x3e')]:_0x2257b8[_0x8c46('0x3f')];if(!_0x47d41f[_0x8c46('0x3a')]['hasOwnProperty'](_0x8c46('0x42'))){_0x3d79eb['limit']=qs[_0x8c46('0x23')](_0x47d41f[_0x8c46('0x3a')]['limit']);_0x3d79eb['offset']=qs[_0x8c46('0x21')](_0x47d41f['query']['offset']);}_0x3d79eb[_0x8c46('0x59')]=qs[_0x8c46('0x43')](_0x47d41f[_0x8c46('0x3a')][_0x8c46('0x43')]);_0x3d79eb['where']=qs[_0x8c46('0x3c')](_[_0x8c46('0x44')](_0x47d41f['query'],_0x2257b8['filters']));_0x3d79eb[_0x8c46('0x46')]['SmsQueueId']=_0x1d08c7['id'];if(_0x47d41f[_0x8c46('0x3a')][_0x8c46('0x45')]){_0x3d79eb[_0x8c46('0x46')]=_[_0x8c46('0x48')](_0x3d79eb[_0x8c46('0x46')],{'$or':_['map'](_0x3d79eb[_0x8c46('0x3e')],function(_0x2cac08){var _0x7c6a3f={};_0x7c6a3f[_0x2cac08]={'$like':'%'+_0x47d41f[_0x8c46('0x3a')][_0x8c46('0x45')]+'%'};return _0x7c6a3f;})});}_0x3d79eb=_[_0x8c46('0x48')]({},_0x3d79eb,_0x47d41f[_0x8c46('0x4e')]);return db[_0x8c46('0x58')][_0x8c46('0x4a')](_0x3d79eb);}})[_0x8c46('0x29')](function(_0x3fd0e1){if(_0x3fd0e1){return db['User'][_0x8c46('0x5a')]({'where':{'id':_[_0x8c46('0x34')](_0x3fd0e1,'UserId'),'role':_0x8c46('0x5b')},'attributes':['id',_0x8c46('0x31'),_0x8c46('0x5c'),'updatedAt',_0x8c46('0x5d')]});}})[_0x8c46('0x29')](function(_0x2ca995){if(_0x2ca995){return{'count':_0x2ca995[_0x8c46('0x24')],'rows':_[_0x8c46('0x34')](_0x2ca995['rows'],function(_0x39fd42){return{'membername':_0x39fd42['name'],'UserId':_0x39fd42['id'],'queue_name':_0x40cecc['name'],'SmsQueueId':_0x40cecc['id'],'interface':util[_0x8c46('0x5e')](_0x8c46('0x5f'),_0x8c46('0x60'),_0x39fd42['name']),'penalty':0x0,'paused':_0x39fd42[_0x8c46('0x5c')],'createdAt':_0x39fd42[_0x8c46('0x5d')],'updatedAt':_0x39fd42[_0x8c46('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x10c6dc,_0x3d79eb))['catch'](handleError(_0x10c6dc,null));};exports[_0x8c46('0x62')]=function(_0x36d125,_0x7fd5fb,_0x18cfb3){var _0x41f73a={};var _0x2b4880={};var _0x325162;var _0x2648f4;return db[_0x8c46('0x35')][_0x8c46('0x57')]({'where':{'id':_0x36d125[_0x8c46('0x4d')]['id']}})[_0x8c46('0x29')](handleEntityNotFound(_0x7fd5fb,null))[_0x8c46('0x29')](function(_0x49fee7){if(_0x49fee7){_0x325162=_0x49fee7;_0x2b4880['model']=_[_0x8c46('0x3b')](db[_0x8c46('0x63')][_0x8c46('0x36')]);_0x2b4880['query']=_[_0x8c46('0x3b')](_0x36d125[_0x8c46('0x3a')]);_0x2b4880[_0x8c46('0x3c')]=_[_0x8c46('0x3d')](_0x2b4880['model'],_0x2b4880['query']);_0x41f73a[_0x8c46('0x3e')]=_[_0x8c46('0x3d')](_0x2b4880[_0x8c46('0x3f')],qs[_0x8c46('0x40')](_0x36d125[_0x8c46('0x3a')][_0x8c46('0x40')]));_0x41f73a[_0x8c46('0x3e')]=_0x41f73a['attributes'][_0x8c46('0x41')]?_0x41f73a[_0x8c46('0x3e')]:_0x2b4880[_0x8c46('0x3f')];_0x41f73a[_0x8c46('0x59')]=qs[_0x8c46('0x43')](_0x36d125['query']['sort']);_0x41f73a[_0x8c46('0x46')]=qs[_0x8c46('0x3c')](_[_0x8c46('0x44')](_0x36d125[_0x8c46('0x3a')],_0x2b4880['filters']));if(_0x36d125[_0x8c46('0x3a')][_0x8c46('0x45')]){_0x41f73a[_0x8c46('0x46')]=_[_0x8c46('0x48')](_0x41f73a[_0x8c46('0x46')],{'$or':_[_0x8c46('0x34')](_0x41f73a['attributes'],function(_0x33a3b9){var _0x30add5={};_0x30add5[_0x33a3b9]={'$like':'%'+_0x36d125[_0x8c46('0x3a')][_0x8c46('0x45')]+'%'};return _0x30add5;})});}_0x41f73a=_['merge']({},_0x41f73a,_0x36d125[_0x8c46('0x4e')]);return _0x325162[_0x8c46('0x62')](_0x41f73a);}})[_0x8c46('0x29')](function(_0x570b65){if(_0x570b65){_0x2648f4=_0x570b65[_0x8c46('0x41')];if(!_0x36d125['query'][_0x8c46('0x64')](_0x8c46('0x42'))){_0x41f73a[_0x8c46('0x23')]=qs[_0x8c46('0x23')](_0x36d125[_0x8c46('0x3a')][_0x8c46('0x23')]);_0x41f73a[_0x8c46('0x21')]=qs[_0x8c46('0x21')](_0x36d125[_0x8c46('0x3a')][_0x8c46('0x21')]);}return _0x325162[_0x8c46('0x62')](_0x41f73a);}})[_0x8c46('0x29')](function(_0x3927f8){if(_0x3927f8){return _0x3927f8?{'count':_0x2648f4,'rows':_0x3927f8}:null;}})['then'](respondWithResult(_0x7fd5fb,null))[_0x8c46('0x4b')](handleError(_0x7fd5fb,null));};exports[_0x8c46('0x65')]=function(_0x1e3d33,_0x41a643,_0x9938e3){var _0x2386cc=_0x1e3d33[_0x8c46('0x55')][_0x8c46('0x66')];return db[_0x8c46('0x63')][_0x8c46('0x4a')]({'where':{'id':_0x2386cc},'attributes':['id'],'include':[{'model':db[_0x8c46('0x67')],'as':_0x8c46('0x68'),'attributes':['id',_0x8c46('0x31'),_0x8c46('0x69'),_0x8c46('0x6a'),_0x8c46('0x6b')],'raw':!![]}]})['then'](function(_0x473da6){if(_0x473da6){var _0xa0c55d=_[_0x8c46('0x6c')](_0x473da6,function(_0x23e31a){var _0x1b0c97=_0x23e31a[_0x8c46('0x2b')]({'plain':!![]});return _0x1b0c97[_0x8c46('0x68')];});return db['SmsQueue'][_0x8c46('0x4f')]({'where':{'id':_0x1e3d33['params']['id']}})[_0x8c46('0x29')](function(_0x267e55){return db['sequelize']['transaction'](function(_0x51e213){return _0x267e55['addTeams'](_0x2386cc,{'transaction':_0x51e213})[_0x8c46('0x29')](function(){return BPromise[_0x8c46('0x6d')](_0xa0c55d,function(_0x52089d){return db[_0x8c46('0x58')][_0x8c46('0x6e')]({'where':{'UserId':_0x52089d['id'],'SmsQueueId':_0x1e3d33['params']['id']},'transaction':_0x51e213});});})['then'](function(){_0xa0c55d[_0x8c46('0x6f')](function(_0x135118){socket[_0x8c46('0x70')](_0x8c46('0x71'),{'UserId':_0x135118['id'],'SmsQueueId':_0x267e55['id']});});});});});}})[_0x8c46('0x29')](respondWithStatusCode(_0x41a643,null))[_0x8c46('0x4b')](handleError(_0x41a643,null));};exports['removeTeams']=function(_0x214fbe,_0x2f905f,_0x41ee06){return db[_0x8c46('0x63')][_0x8c46('0x4a')]({'where':{'id':_0x214fbe[_0x8c46('0x3a')][_0x8c46('0x66')]},'attributes':['id'],'include':[{'model':db[_0x8c46('0x67')],'as':_0x8c46('0x68'),'attributes':['id'],'raw':!![]}]})[_0x8c46('0x29')](handleEntityNotFound(_0x2f905f,null))[_0x8c46('0x29')](function(_0xcdb8a5){var _0x3533e1=_[_0x8c46('0x34')](_0xcdb8a5,'id');var _0x49afdb=[];var _0x3cbd57=[];var _0x1b72f1=squel[_0x8c46('0x72')]();_0x1b72f1[_0x8c46('0x73')]('tq.TeamId')[_0x8c46('0x74')](_0x8c46('0x75'),'tq')[_0x8c46('0x76')](_0x8c46('0x77'),'ut',_0x8c46('0x78'))[_0x8c46('0x46')](_0x8c46('0x79'),_0x214fbe[_0x8c46('0x4d')]['id']);for(var _0x1b3f73=0x0;_0x1b3f73<_0xcdb8a5[_0x8c46('0x41')];_0x1b3f73+=0x1){let _0x1d67bc=_0xcdb8a5[_0x1b3f73];for(var _0x27020f=0x0;_0x27020f<_0x1d67bc[_0x8c46('0x68')][_0x8c46('0x41')];_0x27020f+=0x1){let _0x1d8de2=_0x1d67bc['Agents'][_0x27020f];var _0x117bbc=_0x1b72f1[_0x8c46('0x7a')]();_0x117bbc[_0x8c46('0x46')](_0x8c46('0x7b'),_0x1d8de2['id']);_0x3cbd57[_0x8c46('0x7c')](db['sequelize']['query'](_0x117bbc[_0x8c46('0x7d')](),{'type':db[_0x8c46('0x7e')]['QueryTypes']['SELECT']})[_0x8c46('0x29')](function(_0x1d9841){if(_0x1d9841[_0x8c46('0x41')]===0x1){return _0x1d8de2['id'];}else{var _0x218a4d=_[_0x8c46('0x7f')](_[_0x8c46('0x34')](_0x1d9841,_0x8c46('0x80')),function(_0x1560de){return _[_0x8c46('0x81')](_0x3533e1,_0x1560de);});if(_0x218a4d){return _0x1d8de2['id'];}}}));}}return BPromise[_0x8c46('0x82')](_0x3cbd57)[_0x8c46('0x29')](function(_0x293227){_0x49afdb=_(_0x49afdb)[_0x8c46('0x83')](_0x293227)[_0x8c46('0x84')]()[_0x8c46('0x85')]();return db[_0x8c46('0x35')]['find']({'where':{'id':_0x214fbe[_0x8c46('0x4d')]['id']}})[_0x8c46('0x29')](function(_0x2af691){return db[_0x8c46('0x7e')]['transaction'](function(_0x3733d4){return _0x2af691[_0x8c46('0x86')](_0x214fbe[_0x8c46('0x3a')]['ids'],{'transaction':_0x3733d4})[_0x8c46('0x29')](function(){if(!_[_0x8c46('0x87')](_0x49afdb)){return _0x2af691['removeAgents'](_0x49afdb,{'transaction':_0x3733d4});}})['then'](function(){_0x49afdb[_0x8c46('0x6f')](function(_0x5ce6dc){socket['emit'](_0x8c46('0x88'),{'UserId':_0x5ce6dc,'SmsQueueId':_0x2af691['id']});});});});});});})['then'](respondWithStatusCode(_0x2f905f,null))['catch'](handleError(_0x2f905f,null));};exports[_0x8c46('0x89')]=function(_0x426d39,_0x451089,_0x3fe492){return db[_0x8c46('0x35')][_0x8c46('0x4f')]({'where':{'id':_0x426d39['params']['id']}})['then'](handleEntityNotFound(_0x451089,null))[_0x8c46('0x29')](function(_0x1a1587){if(_0x1a1587){return _0x1a1587[_0x8c46('0x89')](_0x426d39[_0x8c46('0x55')][_0x8c46('0x66')],_[_0x8c46('0x8a')](_0x426d39[_0x8c46('0x55')],[_0x8c46('0x66'),'id'])||{})[_0x8c46('0x8b')](function(_0x2dada2){for(var _0x47a61e=0x0;_0x47a61e<_0x426d39[_0x8c46('0x55')][_0x8c46('0x66')][_0x8c46('0x41')];_0x47a61e+=0x1){socket[_0x8c46('0x70')](_0x8c46('0x71'),{'UserId':Number(_0x426d39['body'][_0x8c46('0x66')][_0x47a61e]),'SmsQueueId':Number(_0x426d39[_0x8c46('0x4d')]['id'])});}return _0x2dada2;});}})[_0x8c46('0x29')](respondWithResult(_0x451089,null))[_0x8c46('0x4b')](handleError(_0x451089,null));};exports[_0x8c46('0x8c')]=function(_0x1a2c3c,_0x44b9cb,_0x3031a6){return db['SmsQueue'][_0x8c46('0x4f')]({'where':{'id':_0x1a2c3c[_0x8c46('0x4d')]['id']}})[_0x8c46('0x29')](handleEntityNotFound(_0x44b9cb,null))[_0x8c46('0x29')](function(_0x2ad17a){if(_0x2ad17a){return _0x2ad17a[_0x8c46('0x8c')](_0x1a2c3c[_0x8c46('0x3a')][_0x8c46('0x66')])[_0x8c46('0x29')](function(){if(_[_0x8c46('0x8d')](_0x1a2c3c[_0x8c46('0x3a')][_0x8c46('0x66')])){for(var _0x296564=0x0;_0x296564<_0x1a2c3c[_0x8c46('0x3a')]['ids']['length'];_0x296564+=0x1){socket[_0x8c46('0x70')](_0x8c46('0x88'),{'UserId':Number(_0x1a2c3c[_0x8c46('0x3a')]['ids'][_0x296564]),'SmsQueueId':Number(_0x1a2c3c[_0x8c46('0x4d')]['id'])});}}else{socket[_0x8c46('0x70')](_0x8c46('0x88'),{'UserId':Number(_0x1a2c3c['query'][_0x8c46('0x66')]),'SmsQueueId':Number(_0x1a2c3c[_0x8c46('0x4d')]['id'])});}});}})[_0x8c46('0x29')](respondWithStatusCode(_0x44b9cb,null))['catch'](handleError(_0x44b9cb,null));};exports['getAgents']=function(_0x32ac6b,_0x301c97,_0x247a07){var _0x36ba31={};var _0x23be4a={};var _0x1da60c;var _0x2f3504;return db[_0x8c46('0x35')][_0x8c46('0x57')]({'where':{'id':_0x32ac6b[_0x8c46('0x4d')]['id']}})[_0x8c46('0x29')](handleEntityNotFound(_0x301c97,null))[_0x8c46('0x29')](function(_0x44f7a){if(_0x44f7a){_0x1da60c=_0x44f7a;_0x23be4a[_0x8c46('0x3f')]=_[_0x8c46('0x3b')](db['User'][_0x8c46('0x36')]);_0x23be4a[_0x8c46('0x3a')]=_[_0x8c46('0x3b')](_0x32ac6b[_0x8c46('0x3a')]);_0x23be4a['filters']=_[_0x8c46('0x3d')](_0x23be4a[_0x8c46('0x3f')],_0x23be4a[_0x8c46('0x3a')]);_0x36ba31[_0x8c46('0x3e')]=_[_0x8c46('0x3d')](_0x23be4a[_0x8c46('0x3f')],qs['fields'](_0x32ac6b[_0x8c46('0x3a')][_0x8c46('0x40')]));_0x36ba31[_0x8c46('0x3e')]=_0x36ba31[_0x8c46('0x3e')][_0x8c46('0x41')]?_0x36ba31[_0x8c46('0x3e')]:_0x23be4a[_0x8c46('0x3f')];_0x36ba31[_0x8c46('0x59')]=qs[_0x8c46('0x43')](_0x32ac6b[_0x8c46('0x3a')][_0x8c46('0x43')]);_0x36ba31['where']=qs['filters'](_[_0x8c46('0x44')](_0x32ac6b['query'],_0x23be4a[_0x8c46('0x3c')]));if(_0x32ac6b[_0x8c46('0x3a')][_0x8c46('0x45')]){_0x36ba31[_0x8c46('0x46')]=_[_0x8c46('0x48')](_0x36ba31[_0x8c46('0x46')],{'$or':_[_0x8c46('0x34')](_0x36ba31[_0x8c46('0x3e')],function(_0x3a89dd){var _0x12114c={};_0x12114c[_0x3a89dd]={'$like':'%'+_0x32ac6b[_0x8c46('0x3a')]['filter']+'%'};return _0x12114c;})});}_0x36ba31=_['merge']({},_0x36ba31,_0x32ac6b[_0x8c46('0x4e')]);return _0x1da60c[_0x8c46('0x8e')](_0x36ba31);}})[_0x8c46('0x29')](function(_0x517322){if(_0x517322){_0x2f3504=_0x517322[_0x8c46('0x41')];if(!_0x32ac6b[_0x8c46('0x3a')]['hasOwnProperty']('nolimit')){_0x36ba31[_0x8c46('0x23')]=qs[_0x8c46('0x23')](_0x32ac6b[_0x8c46('0x3a')]['limit']);_0x36ba31['offset']=qs['offset'](_0x32ac6b[_0x8c46('0x3a')]['offset']);}return _0x1da60c[_0x8c46('0x8e')](_0x36ba31);}})[_0x8c46('0x29')](function(_0x3f58cf){if(_0x3f58cf){return _0x3f58cf?{'count':_0x2f3504,'rows':_0x3f58cf}:null;}})['then'](respondWithResult(_0x301c97,null))[_0x8c46('0x4b')](handleError(_0x301c97,null));}; \ No newline at end of file +var _0x8c25=['SmsQueue','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','type','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserSmsQueue','UserId','agent','smsPause','updatedAt','createdAt','format','SIP','getTeams','findOne','Team','pick','Agents','voicePause','interface','flatMap','sequelize','addTeams','each','findOrCreate','emit','removeTeams','ids','select','field','tq.TeamId','from','join','user_has_teams','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','value','transaction','removeAgents','forEach','omit','spread','userSmsQueue:save','userSmsQueue:remove','getAgents','rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','SmsQueues','UserProfileResource','destroy','end','error','stack','name','send','index','map'];(function(_0x2d03b8,_0x134daf){var _0x328232=function(_0x5caa2a){while(--_0x5caa2a){_0x2d03b8['push'](_0x2d03b8['shift']());}};_0x328232(++_0x134daf);}(_0x8c25,0xe2));var _0x58c2=function(_0x41f906,_0x3319d1){_0x41f906=_0x41f906-0x0;var _0x4b5906=_0x8c25[_0x41f906];return _0x4b5906;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x58c2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x58c2('0x1'));var rp=require(_0x58c2('0x2'));var moment=require(_0x58c2('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x58c2('0x4'));var path=require(_0x58c2('0x5'));var sox=require(_0x58c2('0x6'));var csv=require('to-csv');var ejs=require(_0x58c2('0x7'));var fs=require('fs');var fs_extra=require(_0x58c2('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x58c2('0x9'));var jsforce=require(_0x58c2('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x58c2('0xb'));var querystring=require(_0x58c2('0xc'));var Papa=require(_0x58c2('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x58c2('0xe'));var as=require(_0x58c2('0xf'));var hardwareService=require(_0x58c2('0x10'));var logger=require('../../config/logger')(_0x58c2('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x58c2('0x12'));var db=require(_0x58c2('0x13'))['db'];config[_0x58c2('0x14')]=_[_0x58c2('0x15')](config[_0x58c2('0x14')],{'host':_0x58c2('0x16'),'port':0x18eb});var socket=require(_0x58c2('0x17'))(new Redis(config['redis']));require(_0x58c2('0x18'))[_0x58c2('0x19')](socket);function respondWithStatusCode(_0x301ff3,_0x24e9ee){_0x24e9ee=_0x24e9ee||0xcc;return function(_0x1441c7){if(_0x1441c7){return _0x301ff3['sendStatus'](_0x24e9ee);}return _0x301ff3[_0x58c2('0x1a')](_0x24e9ee)['end']();};}function respondWithResult(_0x4f3779,_0x2c3378){_0x2c3378=_0x2c3378||0xc8;return function(_0x3ddea1){if(_0x3ddea1){return _0x4f3779[_0x58c2('0x1a')](_0x2c3378)[_0x58c2('0x1b')](_0x3ddea1);}};}function respondWithFilteredResult(_0x4671c2,_0x3189ce){return function(_0x6cd95a){if(_0x6cd95a){var _0x333ad3=typeof _0x3189ce[_0x58c2('0x1c')]===_0x58c2('0x1d')&&typeof _0x3189ce[_0x58c2('0x1e')]===_0x58c2('0x1d');var _0x3890aa=_0x6cd95a[_0x58c2('0x1f')];var _0x4f1955=_0x333ad3?0x0:_0x3189ce[_0x58c2('0x1c')];var _0x2b6a91=_0x333ad3?_0x6cd95a[_0x58c2('0x1f')]:_0x3189ce['offset']+_0x3189ce[_0x58c2('0x1e')];var _0x52c3ca;if(_0x2b6a91>=_0x3890aa){_0x2b6a91=_0x3890aa;_0x52c3ca=0xc8;}else{_0x52c3ca=0xce;}_0x4671c2['status'](_0x52c3ca);return _0x4671c2[_0x58c2('0x20')](_0x58c2('0x21'),_0x4f1955+'-'+_0x2b6a91+'/'+_0x3890aa)[_0x58c2('0x1b')](_0x6cd95a);}return null;};}function patchUpdates(_0x97efa){return function(_0x1f4f58){try{jsonpatch[_0x58c2('0x22')](_0x1f4f58,_0x97efa,!![]);}catch(_0x5b419f){return BPromise[_0x58c2('0x23')](_0x5b419f);}return _0x1f4f58[_0x58c2('0x24')]();};}function saveUpdates(_0x1f7540,_0xa55d8e){return function(_0x4aca25){if(_0x4aca25){return _0x4aca25[_0x58c2('0x25')](_0x1f7540)['then'](function(_0x566d4d){return _0x566d4d;});}return null;};}function removeEntity(_0x2dd4ee,_0x24c594){return function(_0x40b331){if(_0x40b331){return _0x40b331['destroy']()[_0x58c2('0x26')](function(){var _0x47109a=_0x40b331[_0x58c2('0x27')]({'plain':!![]});var _0x3976a3=_0x58c2('0x28');return db[_0x58c2('0x29')][_0x58c2('0x2a')]({'where':{'type':_0x3976a3,'resourceId':_0x47109a['id']}})['then'](function(){return _0x40b331;});})[_0x58c2('0x26')](function(){_0x2dd4ee[_0x58c2('0x1a')](0xcc)[_0x58c2('0x2b')]();});}};}function handleEntityNotFound(_0x4d036d,_0x377955){return function(_0x2127fe){if(!_0x2127fe){_0x4d036d['sendStatus'](0x194);}return _0x2127fe;};}function handleError(_0xc43743,_0x30e40f){_0x30e40f=_0x30e40f||0x1f4;return function(_0x16b865){logger[_0x58c2('0x2c')](_0x16b865[_0x58c2('0x2d')]);if(_0x16b865[_0x58c2('0x2e')]){delete _0x16b865[_0x58c2('0x2e')];}_0xc43743[_0x58c2('0x1a')](_0x30e40f)[_0x58c2('0x2f')](_0x16b865);};}exports[_0x58c2('0x30')]=function(_0x3990ad,_0x7925b6){var _0x4562d={},_0x2c88e5={},_0x1328bf={'count':0x0,'rows':[]};var _0x576f36=_[_0x58c2('0x31')](db[_0x58c2('0x32')][_0x58c2('0x33')],function(_0x1ae6d1){return{'name':_0x1ae6d1[_0x58c2('0x34')],'type':_0x1ae6d1['type'][_0x58c2('0x35')]};});_0x2c88e5[_0x58c2('0x36')]=_[_0x58c2('0x31')](_0x576f36,_0x58c2('0x2e'));_0x2c88e5[_0x58c2('0x37')]=_[_0x58c2('0x38')](_0x3990ad[_0x58c2('0x37')]);_0x2c88e5[_0x58c2('0x39')]=_['intersection'](_0x2c88e5[_0x58c2('0x36')],_0x2c88e5[_0x58c2('0x37')]);_0x4562d[_0x58c2('0x3a')]=_[_0x58c2('0x3b')](_0x2c88e5['model'],qs[_0x58c2('0x3c')](_0x3990ad[_0x58c2('0x37')]['fields']));_0x4562d[_0x58c2('0x3a')]=_0x4562d['attributes'][_0x58c2('0x3d')]?_0x4562d[_0x58c2('0x3a')]:_0x2c88e5['model'];if(!_0x3990ad[_0x58c2('0x37')][_0x58c2('0x3e')](_0x58c2('0x3f'))){_0x4562d['limit']=qs[_0x58c2('0x1e')](_0x3990ad[_0x58c2('0x37')][_0x58c2('0x1e')]);_0x4562d[_0x58c2('0x1c')]=qs[_0x58c2('0x1c')](_0x3990ad[_0x58c2('0x37')][_0x58c2('0x1c')]);}_0x4562d[_0x58c2('0x40')]=qs[_0x58c2('0x41')](_0x3990ad[_0x58c2('0x37')][_0x58c2('0x41')]);_0x4562d['where']=qs[_0x58c2('0x39')](_['pick'](_0x3990ad[_0x58c2('0x37')],_0x2c88e5[_0x58c2('0x39')]),_0x576f36);if(_0x3990ad[_0x58c2('0x37')][_0x58c2('0x42')]){_0x4562d['where']=_[_0x58c2('0x43')](_0x4562d[_0x58c2('0x44')],{'$or':_['map'](_0x576f36,function(_0x4cc2c0){if(_0x4cc2c0[_0x58c2('0x45')]!==_0x58c2('0x46')){var _0x2612fb={};_0x2612fb[_0x4cc2c0['name']]={'$like':'%'+_0x3990ad[_0x58c2('0x37')][_0x58c2('0x42')]+'%'};return _0x2612fb;}})});}_0x4562d=_[_0x58c2('0x43')]({},_0x4562d,_0x3990ad[_0x58c2('0x47')]);var _0x535de0={'where':_0x4562d[_0x58c2('0x44')]};return db['SmsQueue']['count'](_0x535de0)[_0x58c2('0x26')](function(_0x3a7adf){_0x1328bf['count']=_0x3a7adf;if(_0x3990ad[_0x58c2('0x37')]['includeAll']){_0x4562d[_0x58c2('0x48')]=[{'all':!![]}];}return db[_0x58c2('0x32')][_0x58c2('0x49')](_0x4562d);})['then'](function(_0xfa2d4f){_0x1328bf[_0x58c2('0x4a')]=_0xfa2d4f;return _0x1328bf;})[_0x58c2('0x26')](respondWithFilteredResult(_0x7925b6,_0x4562d))[_0x58c2('0x4b')](handleError(_0x7925b6,null));};exports['show']=function(_0x57997c,_0x47cbe5){var _0x105429={'raw':!![],'where':{'id':_0x57997c[_0x58c2('0x4c')]['id']}},_0x236937={};_0x236937[_0x58c2('0x36')]=_[_0x58c2('0x38')](db['SmsQueue']['rawAttributes']);_0x236937[_0x58c2('0x37')]=_['keys'](_0x57997c[_0x58c2('0x37')]);_0x236937[_0x58c2('0x39')]=_[_0x58c2('0x3b')](_0x236937['model'],_0x236937[_0x58c2('0x37')]);_0x105429[_0x58c2('0x3a')]=_[_0x58c2('0x3b')](_0x236937['model'],qs['fields'](_0x57997c[_0x58c2('0x37')][_0x58c2('0x3c')]));_0x105429[_0x58c2('0x3a')]=_0x105429[_0x58c2('0x3a')][_0x58c2('0x3d')]?_0x105429[_0x58c2('0x3a')]:_0x236937[_0x58c2('0x36')];if(_0x57997c[_0x58c2('0x37')][_0x58c2('0x4d')]){_0x105429[_0x58c2('0x48')]=[{'all':!![]}];}_0x105429=_[_0x58c2('0x43')]({},_0x105429,_0x57997c[_0x58c2('0x47')]);return db[_0x58c2('0x32')][_0x58c2('0x4e')](_0x105429)[_0x58c2('0x26')](handleEntityNotFound(_0x47cbe5,null))[_0x58c2('0x26')](respondWithResult(_0x47cbe5,null))[_0x58c2('0x4b')](handleError(_0x47cbe5,null));};exports[_0x58c2('0x4f')]=function(_0x58cfdb,_0x5c4906){return db['SmsQueue'][_0x58c2('0x4f')](_0x58cfdb[_0x58c2('0x50')],{})[_0x58c2('0x26')](function(_0x585f16){var _0x6ae7d1=_0x58cfdb[_0x58c2('0x51')][_0x58c2('0x27')]({'plain':!![]});if(!_0x6ae7d1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x6ae7d1[_0x58c2('0x52')]===_0x58c2('0x51')){var _0x2496dd=_0x585f16[_0x58c2('0x27')]({'plain':!![]});var _0x334830=_0x58c2('0x28');return db[_0x58c2('0x53')][_0x58c2('0x4e')]({'where':{'name':_0x334830,'userProfileId':_0x6ae7d1[_0x58c2('0x54')]},'raw':!![]})['then'](function(_0x3fe063){if(_0x3fe063&&_0x3fe063[_0x58c2('0x55')]===0x0){return db[_0x58c2('0x29')][_0x58c2('0x4f')]({'name':_0x2496dd[_0x58c2('0x2e')],'resourceId':_0x2496dd['id'],'type':_0x3fe063[_0x58c2('0x2e')],'sectionId':_0x3fe063['id']},{})[_0x58c2('0x26')](function(){return _0x585f16;});}else{return _0x585f16;}})[_0x58c2('0x4b')](function(_0x1e3e90){logger[_0x58c2('0x2c')](_0x58c2('0x56'),_0x1e3e90);throw _0x1e3e90;});}return _0x585f16;})[_0x58c2('0x26')](respondWithResult(_0x5c4906,0xc9))[_0x58c2('0x4b')](handleError(_0x5c4906,null));};exports[_0x58c2('0x25')]=function(_0x8a697e,_0x151ef1){if(_0x8a697e[_0x58c2('0x50')]['id']){delete _0x8a697e[_0x58c2('0x50')]['id'];}return db[_0x58c2('0x32')][_0x58c2('0x4e')]({'where':{'id':_0x8a697e['params']['id']}})[_0x58c2('0x26')](handleEntityNotFound(_0x151ef1,null))[_0x58c2('0x26')](saveUpdates(_0x8a697e[_0x58c2('0x50')],null))[_0x58c2('0x26')](respondWithResult(_0x151ef1,null))[_0x58c2('0x4b')](handleError(_0x151ef1,null));};exports[_0x58c2('0x2a')]=function(_0x34b186,_0x27a5a4){return db[_0x58c2('0x32')]['find']({'where':{'id':_0x34b186[_0x58c2('0x4c')]['id']}})[_0x58c2('0x26')](handleEntityNotFound(_0x27a5a4,null))['then'](removeEntity(_0x27a5a4,null))[_0x58c2('0x4b')](handleError(_0x27a5a4,null));};exports[_0x58c2('0x57')]=function(_0x3422b8,_0x47add5){return db[_0x58c2('0x32')][_0x58c2('0x57')]()[_0x58c2('0x26')](respondWithResult(_0x47add5,null))['catch'](handleError(_0x47add5,null));};exports[_0x58c2('0x58')]=function(_0xc33794,_0x2e6901,_0x381639){var _0x36cb09={'raw':!![],'where':{}},_0x3f3338={},_0x59d350;return db[_0x58c2('0x32')]['findOne']({'where':{'id':_0xc33794[_0x58c2('0x4c')]['id']}})[_0x58c2('0x26')](handleEntityNotFound(_0x2e6901,null))['then'](function(_0x53b1d0){if(_0x53b1d0){_0x59d350=_0x53b1d0['get']({'plain':!![]});_0x3f3338[_0x58c2('0x36')]=_['keys'](db[_0x58c2('0x59')][_0x58c2('0x33')]);_0x3f3338[_0x58c2('0x37')]=_[_0x58c2('0x38')](_0xc33794[_0x58c2('0x37')]);_0x3f3338[_0x58c2('0x39')]=_[_0x58c2('0x3b')](_0x3f3338['model'],_0x3f3338[_0x58c2('0x37')]);_0x36cb09[_0x58c2('0x3a')]=_[_0x58c2('0x3b')](_0x3f3338['model'],qs[_0x58c2('0x3c')](_0xc33794['query'][_0x58c2('0x3c')]));_0x36cb09['attributes']=_0x36cb09['attributes'][_0x58c2('0x3d')]?_0x36cb09[_0x58c2('0x3a')]:_0x3f3338[_0x58c2('0x36')];if(!_0xc33794['query']['hasOwnProperty']('nolimit')){_0x36cb09[_0x58c2('0x1e')]=qs[_0x58c2('0x1e')](_0xc33794['query'][_0x58c2('0x1e')]);_0x36cb09[_0x58c2('0x1c')]=qs['offset'](_0xc33794[_0x58c2('0x37')][_0x58c2('0x1c')]);}_0x36cb09[_0x58c2('0x40')]=qs[_0x58c2('0x41')](_0xc33794[_0x58c2('0x37')][_0x58c2('0x41')]);_0x36cb09[_0x58c2('0x44')]=qs[_0x58c2('0x39')](_['pick'](_0xc33794['query'],_0x3f3338[_0x58c2('0x39')]));_0x36cb09[_0x58c2('0x44')]['SmsQueueId']=_0x53b1d0['id'];if(_0xc33794[_0x58c2('0x37')][_0x58c2('0x42')]){_0x36cb09[_0x58c2('0x44')]=_['merge'](_0x36cb09[_0x58c2('0x44')],{'$or':_[_0x58c2('0x31')](_0x36cb09[_0x58c2('0x3a')],function(_0x158c2a){var _0x22d3c7={};_0x22d3c7[_0x158c2a]={'$like':'%'+_0xc33794[_0x58c2('0x37')][_0x58c2('0x42')]+'%'};return _0x22d3c7;})});}_0x36cb09=_[_0x58c2('0x43')]({},_0x36cb09,_0xc33794['options']);return db['UserSmsQueue']['findAll'](_0x36cb09);}})['then'](function(_0xe9fde0){if(_0xe9fde0){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0xe9fde0,_0x58c2('0x5a')),'role':_0x58c2('0x5b')},'attributes':['id',_0x58c2('0x2e'),_0x58c2('0x5c'),_0x58c2('0x5d'),_0x58c2('0x5e')]});}})[_0x58c2('0x26')](function(_0xc77613){if(_0xc77613){return{'count':_0xc77613[_0x58c2('0x1f')],'rows':_[_0x58c2('0x31')](_0xc77613['rows'],function(_0x37ad39){return{'membername':_0x37ad39[_0x58c2('0x2e')],'UserId':_0x37ad39['id'],'queue_name':_0x59d350[_0x58c2('0x2e')],'SmsQueueId':_0x59d350['id'],'interface':util[_0x58c2('0x5f')]('%s/%s',_0x58c2('0x60'),_0x37ad39[_0x58c2('0x2e')]),'penalty':0x0,'paused':_0x37ad39[_0x58c2('0x5c')],'createdAt':_0x37ad39['createdAt'],'updatedAt':_0x37ad39[_0x58c2('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x58c2('0x26')](respondWithFilteredResult(_0x2e6901,_0x36cb09))[_0x58c2('0x4b')](handleError(_0x2e6901,null));};exports[_0x58c2('0x61')]=function(_0x3a1c5d,_0x3a96d0,_0x2379d3){var _0x1995c5={};var _0x449923={};var _0xdecab6;var _0x33c2ed;return db['SmsQueue'][_0x58c2('0x62')]({'where':{'id':_0x3a1c5d[_0x58c2('0x4c')]['id']}})[_0x58c2('0x26')](handleEntityNotFound(_0x3a96d0,null))[_0x58c2('0x26')](function(_0x5a20bd){if(_0x5a20bd){_0xdecab6=_0x5a20bd;_0x449923[_0x58c2('0x36')]=_[_0x58c2('0x38')](db[_0x58c2('0x63')]['rawAttributes']);_0x449923[_0x58c2('0x37')]=_[_0x58c2('0x38')](_0x3a1c5d[_0x58c2('0x37')]);_0x449923[_0x58c2('0x39')]=_['intersection'](_0x449923[_0x58c2('0x36')],_0x449923[_0x58c2('0x37')]);_0x1995c5[_0x58c2('0x3a')]=_[_0x58c2('0x3b')](_0x449923[_0x58c2('0x36')],qs[_0x58c2('0x3c')](_0x3a1c5d[_0x58c2('0x37')][_0x58c2('0x3c')]));_0x1995c5[_0x58c2('0x3a')]=_0x1995c5[_0x58c2('0x3a')]['length']?_0x1995c5['attributes']:_0x449923['model'];_0x1995c5[_0x58c2('0x40')]=qs[_0x58c2('0x41')](_0x3a1c5d[_0x58c2('0x37')][_0x58c2('0x41')]);_0x1995c5[_0x58c2('0x44')]=qs[_0x58c2('0x39')](_[_0x58c2('0x64')](_0x3a1c5d[_0x58c2('0x37')],_0x449923[_0x58c2('0x39')]));if(_0x3a1c5d[_0x58c2('0x37')]['filter']){_0x1995c5[_0x58c2('0x44')]=_[_0x58c2('0x43')](_0x1995c5[_0x58c2('0x44')],{'$or':_[_0x58c2('0x31')](_0x1995c5['attributes'],function(_0x1362a9){var _0x39b7f2={};_0x39b7f2[_0x1362a9]={'$like':'%'+_0x3a1c5d['query'][_0x58c2('0x42')]+'%'};return _0x39b7f2;})});}_0x1995c5=_['merge']({},_0x1995c5,_0x3a1c5d['options']);return _0xdecab6[_0x58c2('0x61')](_0x1995c5);}})[_0x58c2('0x26')](function(_0x47cff5){if(_0x47cff5){_0x33c2ed=_0x47cff5['length'];if(!_0x3a1c5d['query'][_0x58c2('0x3e')](_0x58c2('0x3f'))){_0x1995c5['limit']=qs[_0x58c2('0x1e')](_0x3a1c5d[_0x58c2('0x37')][_0x58c2('0x1e')]);_0x1995c5['offset']=qs[_0x58c2('0x1c')](_0x3a1c5d[_0x58c2('0x37')][_0x58c2('0x1c')]);}return _0xdecab6['getTeams'](_0x1995c5);}})['then'](function(_0x300742){if(_0x300742){return _0x300742?{'count':_0x33c2ed,'rows':_0x300742}:null;}})[_0x58c2('0x26')](respondWithResult(_0x3a96d0,null))['catch'](handleError(_0x3a96d0,null));};exports['addTeams']=function(_0x4cd144,_0x34869d,_0x3660d9){var _0x58f1ac=_0x4cd144[_0x58c2('0x50')]['ids'];return db['Team'][_0x58c2('0x49')]({'where':{'id':_0x58f1ac},'attributes':['id'],'include':[{'model':db['User'],'as':_0x58c2('0x65'),'attributes':['id','name','online',_0x58c2('0x66'),_0x58c2('0x67')],'raw':!![]}]})[_0x58c2('0x26')](function(_0x43146b){if(_0x43146b){var _0x33082d=_[_0x58c2('0x68')](_0x43146b,function(_0x172851){var _0x55da21=_0x172851[_0x58c2('0x27')]({'plain':!![]});return _0x55da21['Agents'];});return db[_0x58c2('0x32')][_0x58c2('0x4e')]({'where':{'id':_0x4cd144[_0x58c2('0x4c')]['id']}})[_0x58c2('0x26')](function(_0x10faa7){return db[_0x58c2('0x69')]['transaction'](function(_0x9d138){return _0x10faa7[_0x58c2('0x6a')](_0x58f1ac,{'transaction':_0x9d138})[_0x58c2('0x26')](function(){return BPromise[_0x58c2('0x6b')](_0x33082d,function(_0x52b315){return db[_0x58c2('0x59')][_0x58c2('0x6c')]({'where':{'UserId':_0x52b315['id'],'SmsQueueId':_0x4cd144[_0x58c2('0x4c')]['id']},'transaction':_0x9d138});});})['then'](function(){_0x33082d['forEach'](function(_0x31f094){socket[_0x58c2('0x6d')]('userSmsQueue:save',{'UserId':_0x31f094['id'],'SmsQueueId':_0x10faa7['id']});});});});});}})[_0x58c2('0x26')](respondWithStatusCode(_0x34869d,null))[_0x58c2('0x4b')](handleError(_0x34869d,null));};exports[_0x58c2('0x6e')]=function(_0x390ddc,_0x5a258d,_0x40dcf9){return db[_0x58c2('0x63')][_0x58c2('0x49')]({'where':{'id':_0x390ddc['query'][_0x58c2('0x6f')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x58c2('0x65'),'attributes':['id'],'raw':!![]}]})[_0x58c2('0x26')](handleEntityNotFound(_0x5a258d,null))[_0x58c2('0x26')](function(_0x24c23b){var _0x572482=_[_0x58c2('0x31')](_0x24c23b,'id');var _0x198e0b=[];var _0x5de327=[];var _0x182b67=squel[_0x58c2('0x70')]();_0x182b67[_0x58c2('0x71')](_0x58c2('0x72'))[_0x58c2('0x73')]('team_has_sms_queues','tq')[_0x58c2('0x74')](_0x58c2('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x58c2('0x44')](_0x58c2('0x76'),_0x390ddc[_0x58c2('0x4c')]['id']);for(var _0x57a4eb=0x0;_0x57a4eb<_0x24c23b[_0x58c2('0x3d')];_0x57a4eb+=0x1){let _0x42182d=_0x24c23b[_0x57a4eb];for(var _0x567706=0x0;_0x567706<_0x42182d[_0x58c2('0x65')][_0x58c2('0x3d')];_0x567706+=0x1){let _0xc7587d=_0x42182d['Agents'][_0x567706];var _0x578983=_0x182b67[_0x58c2('0x77')]();_0x578983[_0x58c2('0x44')](_0x58c2('0x78'),_0xc7587d['id']);_0x5de327[_0x58c2('0x79')](db[_0x58c2('0x69')][_0x58c2('0x37')](_0x578983[_0x58c2('0x7a')](),{'type':db[_0x58c2('0x69')]['QueryTypes'][_0x58c2('0x7b')]})['then'](function(_0x266f5b){if(_0x266f5b[_0x58c2('0x3d')]===0x1){return _0xc7587d['id'];}else{var _0x1204e9=_[_0x58c2('0x7c')](_[_0x58c2('0x31')](_0x266f5b,_0x58c2('0x7d')),function(_0x230808){return _[_0x58c2('0x7e')](_0x572482,_0x230808);});if(_0x1204e9){return _0xc7587d['id'];}}}));}}return BPromise[_0x58c2('0x7f')](_0x5de327)[_0x58c2('0x26')](function(_0x1ec273){_0x198e0b=_(_0x198e0b)[_0x58c2('0x80')](_0x1ec273)['compact']()[_0x58c2('0x81')]();return db[_0x58c2('0x32')][_0x58c2('0x4e')]({'where':{'id':_0x390ddc[_0x58c2('0x4c')]['id']}})[_0x58c2('0x26')](function(_0xf50cfe){return db['sequelize'][_0x58c2('0x82')](function(_0x3577cf){return _0xf50cfe[_0x58c2('0x6e')](_0x390ddc[_0x58c2('0x37')][_0x58c2('0x6f')],{'transaction':_0x3577cf})[_0x58c2('0x26')](function(){if(!_['isEmpty'](_0x198e0b)){return _0xf50cfe[_0x58c2('0x83')](_0x198e0b,{'transaction':_0x3577cf});}})[_0x58c2('0x26')](function(){_0x198e0b[_0x58c2('0x84')](function(_0x374857){socket[_0x58c2('0x6d')]('userSmsQueue:remove',{'UserId':_0x374857,'SmsQueueId':_0xf50cfe['id']});});});});});});})[_0x58c2('0x26')](respondWithStatusCode(_0x5a258d,null))[_0x58c2('0x4b')](handleError(_0x5a258d,null));};exports['addAgents']=function(_0x368ec5,_0x2d7f1b,_0x223fbb){return db['SmsQueue']['find']({'where':{'id':_0x368ec5['params']['id']}})['then'](handleEntityNotFound(_0x2d7f1b,null))[_0x58c2('0x26')](function(_0x536765){if(_0x536765){return _0x536765['addAgents'](_0x368ec5[_0x58c2('0x50')][_0x58c2('0x6f')],_[_0x58c2('0x85')](_0x368ec5[_0x58c2('0x50')],[_0x58c2('0x6f'),'id'])||{})[_0x58c2('0x86')](function(_0x598d9b){for(var _0x39c752=0x0;_0x39c752<_0x368ec5[_0x58c2('0x50')]['ids'][_0x58c2('0x3d')];_0x39c752+=0x1){socket['emit'](_0x58c2('0x87'),{'UserId':Number(_0x368ec5[_0x58c2('0x50')][_0x58c2('0x6f')][_0x39c752]),'SmsQueueId':Number(_0x368ec5[_0x58c2('0x4c')]['id'])});}return _0x598d9b;});}})[_0x58c2('0x26')](respondWithResult(_0x2d7f1b,null))[_0x58c2('0x4b')](handleError(_0x2d7f1b,null));};exports[_0x58c2('0x83')]=function(_0x32e696,_0x470fae,_0x49b781){return db['SmsQueue'][_0x58c2('0x4e')]({'where':{'id':_0x32e696['params']['id']}})['then'](handleEntityNotFound(_0x470fae,null))[_0x58c2('0x26')](function(_0x4928fb){if(_0x4928fb){return _0x4928fb[_0x58c2('0x83')](_0x32e696['query'][_0x58c2('0x6f')])[_0x58c2('0x26')](function(){if(_['isArray'](_0x32e696['query'][_0x58c2('0x6f')])){for(var _0x1b3a36=0x0;_0x1b3a36<_0x32e696['query']['ids']['length'];_0x1b3a36+=0x1){socket[_0x58c2('0x6d')](_0x58c2('0x88'),{'UserId':Number(_0x32e696[_0x58c2('0x37')][_0x58c2('0x6f')][_0x1b3a36]),'SmsQueueId':Number(_0x32e696[_0x58c2('0x4c')]['id'])});}}else{socket['emit'](_0x58c2('0x88'),{'UserId':Number(_0x32e696[_0x58c2('0x37')][_0x58c2('0x6f')]),'SmsQueueId':Number(_0x32e696[_0x58c2('0x4c')]['id'])});}});}})[_0x58c2('0x26')](respondWithStatusCode(_0x470fae,null))['catch'](handleError(_0x470fae,null));};exports[_0x58c2('0x89')]=function(_0x1b359b,_0x319a8c,_0x2c536a){var _0x4d9dc2={};var _0xeeec3a={};var _0x3f85c9;var _0x280be3;return db[_0x58c2('0x32')][_0x58c2('0x62')]({'where':{'id':_0x1b359b[_0x58c2('0x4c')]['id']}})[_0x58c2('0x26')](handleEntityNotFound(_0x319a8c,null))[_0x58c2('0x26')](function(_0x4a220f){if(_0x4a220f){_0x3f85c9=_0x4a220f;_0xeeec3a[_0x58c2('0x36')]=_['keys'](db['User'][_0x58c2('0x33')]);_0xeeec3a[_0x58c2('0x37')]=_[_0x58c2('0x38')](_0x1b359b[_0x58c2('0x37')]);_0xeeec3a[_0x58c2('0x39')]=_[_0x58c2('0x3b')](_0xeeec3a[_0x58c2('0x36')],_0xeeec3a['query']);_0x4d9dc2[_0x58c2('0x3a')]=_[_0x58c2('0x3b')](_0xeeec3a['model'],qs[_0x58c2('0x3c')](_0x1b359b[_0x58c2('0x37')][_0x58c2('0x3c')]));_0x4d9dc2[_0x58c2('0x3a')]=_0x4d9dc2['attributes'][_0x58c2('0x3d')]?_0x4d9dc2['attributes']:_0xeeec3a[_0x58c2('0x36')];_0x4d9dc2[_0x58c2('0x40')]=qs[_0x58c2('0x41')](_0x1b359b[_0x58c2('0x37')][_0x58c2('0x41')]);_0x4d9dc2[_0x58c2('0x44')]=qs['filters'](_[_0x58c2('0x64')](_0x1b359b['query'],_0xeeec3a[_0x58c2('0x39')]));if(_0x1b359b[_0x58c2('0x37')][_0x58c2('0x42')]){_0x4d9dc2[_0x58c2('0x44')]=_[_0x58c2('0x43')](_0x4d9dc2[_0x58c2('0x44')],{'$or':_['map'](_0x4d9dc2[_0x58c2('0x3a')],function(_0x391ff9){var _0x34c020={};_0x34c020[_0x391ff9]={'$like':'%'+_0x1b359b['query']['filter']+'%'};return _0x34c020;})});}_0x4d9dc2=_[_0x58c2('0x43')]({},_0x4d9dc2,_0x1b359b[_0x58c2('0x47')]);return _0x3f85c9['getAgents'](_0x4d9dc2);}})[_0x58c2('0x26')](function(_0x59efaa){if(_0x59efaa){_0x280be3=_0x59efaa['length'];if(!_0x1b359b[_0x58c2('0x37')][_0x58c2('0x3e')]('nolimit')){_0x4d9dc2[_0x58c2('0x1e')]=qs[_0x58c2('0x1e')](_0x1b359b[_0x58c2('0x37')][_0x58c2('0x1e')]);_0x4d9dc2[_0x58c2('0x1c')]=qs[_0x58c2('0x1c')](_0x1b359b[_0x58c2('0x37')][_0x58c2('0x1c')]);}return _0x3f85c9[_0x58c2('0x89')](_0x4d9dc2);}})[_0x58c2('0x26')](function(_0x3efaf1){if(_0x3efaf1){return _0x3efaf1?{'count':_0x280be3,'rows':_0x3efaf1}:null;}})[_0x58c2('0x26')](respondWithResult(_0x319a8c,null))[_0x58c2('0x4b')](handleError(_0x319a8c,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 3e479fb..e6c4c22 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 _0x2af7=['update','remove','emit','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners'];(function(_0x3c504b,_0x437693){var _0x2e5354=function(_0x456709){while(--_0x456709){_0x3c504b['push'](_0x3c504b['shift']());}};_0x2e5354(++_0x437693);}(_0x2af7,0x125));var _0x72af=function(_0x4f2119,_0x5cbdc8){_0x4f2119=_0x4f2119-0x0;var _0x9f2ccc=_0x2af7[_0x4f2119];return _0x9f2ccc;};'use strict';var EventEmitter=require(_0x72af('0x0'));var SmsQueue=require(_0x72af('0x1'))['db'][_0x72af('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x72af('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x72af('0x4'),'afterDestroy':_0x72af('0x5')};function emitEvent(_0x585d2b){return function(_0x2c2eac,_0x3ce31e,_0x4fb644){SmsQueueEvents['emit'](_0x585d2b+':'+_0x2c2eac['id'],_0x2c2eac);SmsQueueEvents[_0x72af('0x6')](_0x585d2b,_0x2c2eac);_0x4fb644(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x72af('0x7')](e,emitEvent(event));}}module[_0x72af('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0xfa7a=['events','SmsQueue','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4e5fba,_0x1962da){var _0x582f0e=function(_0x35f638){while(--_0x35f638){_0x4e5fba['push'](_0x4e5fba['shift']());}};_0x582f0e(++_0x1962da);}(_0xfa7a,0xd8));var _0xafa7=function(_0x25b1fd,_0x177eee){_0x25b1fd=_0x25b1fd-0x0;var _0x2f75b7=_0xfa7a[_0x25b1fd];return _0x2f75b7;};'use strict';var EventEmitter=require(_0xafa7('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0xafa7('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xafa7('0x2'),'afterUpdate':_0xafa7('0x3'),'afterDestroy':_0xafa7('0x4')};function emitEvent(_0x43e506){return function(_0x55151f,_0x22cdfb,_0x2b34f9){SmsQueueEvents[_0xafa7('0x5')](_0x43e506+':'+_0x55151f['id'],_0x55151f);SmsQueueEvents[_0xafa7('0x5')](_0x43e506,_0x55151f);_0x2b34f9(null);};}for(var e in events){if(events[_0xafa7('0x6')](e)){var event=events[e];SmsQueue[_0xafa7('0x7')](e,emitEvent(event));}}module[_0xafa7('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 790e126..5bf3ded 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 _0x0cc6=['exports','SmsQueue','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes'];(function(_0x3d1cd6,_0x1eb52d){var _0xfbf315=function(_0x4ae843){while(--_0x4ae843){_0x3d1cd6['push'](_0x3d1cd6['shift']());}};_0xfbf315(++_0x1eb52d);}(_0x0cc6,0x91));var _0x60cc=function(_0x1ad9b4,_0x5df9ed){_0x1ad9b4=_0x1ad9b4-0x0;var _0xbbee74=_0x0cc6[_0x1ad9b4];return _0xbbee74;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x60cc('0x0'))(_0x60cc('0x1'));var moment=require(_0x60cc('0x2'));var BPromise=require(_0x60cc('0x3'));var rp=require(_0x60cc('0x4'));var fs=require('fs');var path=require(_0x60cc('0x5'));var rimraf=require(_0x60cc('0x6'));var config=require(_0x60cc('0x7'));var attributes=require(_0x60cc('0x8'));module[_0x60cc('0x9')]=function(_0x3da20a,_0x3da48b){return _0x3da20a['define'](_0x60cc('0xa'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a26=['lodash','api','moment','bluebird','request-promise','path','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue'];(function(_0x5035e7,_0x275843){var _0x31bef9=function(_0x4618a9){while(--_0x4618a9){_0x5035e7['push'](_0x5035e7['shift']());}};_0x31bef9(++_0x275843);}(_0x3a26,0x129));var _0x63a2=function(_0x36fa9e,_0x35fd47){_0x36fa9e=_0x36fa9e-0x0;var _0x37eff6=_0x3a26[_0x36fa9e];return _0x37eff6;};'use strict';var _=require(_0x63a2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x63a2('0x1'));var moment=require(_0x63a2('0x2'));var BPromise=require(_0x63a2('0x3'));var rp=require(_0x63a2('0x4'));var fs=require('fs');var path=require(_0x63a2('0x5'));var rimraf=require('rimraf');var config=require(_0x63a2('0x6'));var attributes=require(_0x63a2('0x7'));module[_0x63a2('0x8')]=function(_0x5213c1,_0x47023e){return _0x5213c1[_0x63a2('0x9')](_0x63a2('0xa'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index b9b24dc..5a857ae 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 _0x0ac6=['stringify','error','code','message','SmsQueue','findAll','options','raw','where','attributes','map','include','model','GetSmsQueue','ShowSmsQueue','find','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','http','defaults','localhost','socket.io-emitter','register','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0x0ac6,0x7d));var _0x60ac=function(_0x47023d,_0xd869d7){_0x47023d=_0x47023d-0x0;var _0x3cd608=_0x0ac6[_0x47023d];return _0x3cd608;};'use strict';var _=require(_0x60ac('0x0'));var util=require(_0x60ac('0x1'));var moment=require(_0x60ac('0x2'));var BPromise=require(_0x60ac('0x3'));var rs=require(_0x60ac('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x60ac('0x5'))(_0x60ac('0x6'));var config=require(_0x60ac('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x60ac('0x8')]({'port':0x232a});config['redis']=_[_0x60ac('0x9')](config['redis'],{'host':_0x60ac('0xa'),'port':0x18eb});var socket=require(_0x60ac('0xb'))(new Redis(config['redis']));require('./smsQueue.socket')[_0x60ac('0xc')](socket);function respondWithRpcPromise(_0x30bec7,_0x2dfb56,_0x5598bf){return new BPromise(function(_0x32ee3e,_0x1d1e14){return client['request'](_0x30bec7,_0x5598bf)[_0x60ac('0xd')](function(_0x18f4f3){logger[_0x60ac('0xe')](_0x60ac('0xf'),_0x2dfb56,_0x60ac('0x10'));logger[_0x60ac('0x11')](_0x60ac('0x12'),_0x2dfb56,_0x60ac('0x10'),JSON[_0x60ac('0x13')](_0x18f4f3));if(_0x18f4f3[_0x60ac('0x14')]){if(_0x18f4f3['error'][_0x60ac('0x15')]===0x1f4){logger[_0x60ac('0x14')](_0x60ac('0xf'),_0x2dfb56,_0x18f4f3[_0x60ac('0x14')][_0x60ac('0x16')]);return _0x1d1e14(_0x18f4f3['error'][_0x60ac('0x16')]);}logger['error'](_0x60ac('0xf'),_0x2dfb56,_0x18f4f3[_0x60ac('0x14')][_0x60ac('0x16')]);return _0x32ee3e(_0x18f4f3[_0x60ac('0x14')][_0x60ac('0x16')]);}else{logger['info'](_0x60ac('0xf'),_0x2dfb56,_0x60ac('0x10'));_0x32ee3e(_0x18f4f3['result']['message']);}})['catch'](function(_0x287eff){logger[_0x60ac('0x14')](_0x60ac('0xf'),_0x2dfb56,_0x287eff);_0x1d1e14(_0x287eff);});});}exports['GetSmsQueue']=function(_0x35fdab){var _0x540381=this;return new Promise(function(_0x289ef3,_0x19c2f1){return db[_0x60ac('0x17')][_0x60ac('0x18')]({'raw':_0x35fdab[_0x60ac('0x19')]?_0x35fdab[_0x60ac('0x19')][_0x60ac('0x1a')]===undefined?!![]:![]:!![],'where':_0x35fdab[_0x60ac('0x19')]?_0x35fdab[_0x60ac('0x19')][_0x60ac('0x1b')]||null:null,'attributes':_0x35fdab[_0x60ac('0x19')]?_0x35fdab[_0x60ac('0x19')][_0x60ac('0x1c')]||null:null,'limit':_0x35fdab['options']?_0x35fdab[_0x60ac('0x19')]['limit']||null:null,'include':_0x35fdab[_0x60ac('0x19')]?_0x35fdab[_0x60ac('0x19')]['include']?_[_0x60ac('0x1d')](_0x35fdab[_0x60ac('0x19')][_0x60ac('0x1e')],function(_0x217b9b){return{'model':db[_0x217b9b[_0x60ac('0x1f')]],'as':_0x217b9b['as'],'attributes':_0x217b9b['attributes'],'include':_0x217b9b[_0x60ac('0x1e')]?_[_0x60ac('0x1d')](_0x217b9b['include'],function(_0x56bca2){return{'model':db[_0x56bca2[_0x60ac('0x1f')]],'as':_0x56bca2['as'],'attributes':_0x56bca2[_0x60ac('0x1c')],'include':_0x56bca2[_0x60ac('0x1e')]?_[_0x60ac('0x1d')](_0x56bca2['include'],function(_0x5ac9f5){return{'model':db[_0x5ac9f5['model']],'as':_0x5ac9f5['as'],'attributes':_0x5ac9f5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x498481){logger[_0x60ac('0xe')](_0x60ac('0x20'),_0x35fdab);logger[_0x60ac('0x11')](_0x60ac('0x20'),_0x35fdab,JSON[_0x60ac('0x13')](_0x498481));_0x289ef3(_0x498481);})['catch'](function(_0x562214){logger[_0x60ac('0x14')](_0x60ac('0x20'),_0x562214[_0x60ac('0x16')],_0x35fdab);_0x19c2f1(_0x540381[_0x60ac('0x14')](0x1f4,_0x562214[_0x60ac('0x16')]));});});};exports[_0x60ac('0x21')]=function(_0x20a272){var _0x32c142=this;return new Promise(function(_0x1f37cc,_0x141464){return db[_0x60ac('0x17')][_0x60ac('0x22')]({'raw':_0x20a272['options']?_0x20a272['options'][_0x60ac('0x1a')]===undefined?!![]:![]:!![],'where':_0x20a272[_0x60ac('0x19')]?_0x20a272[_0x60ac('0x19')][_0x60ac('0x1b')]||null:null,'attributes':_0x20a272[_0x60ac('0x19')]?_0x20a272['options']['attributes']||null:null,'include':_0x20a272[_0x60ac('0x19')]?_0x20a272['options'][_0x60ac('0x1e')]?_[_0x60ac('0x1d')](_0x20a272[_0x60ac('0x19')][_0x60ac('0x1e')],function(_0x50df0b){return{'model':db[_0x50df0b[_0x60ac('0x1f')]],'as':_0x50df0b['as'],'attributes':_0x50df0b['attributes'],'include':_0x50df0b[_0x60ac('0x1e')]?_[_0x60ac('0x1d')](_0x50df0b[_0x60ac('0x1e')],function(_0x38c880){return{'model':db[_0x38c880[_0x60ac('0x1f')]],'as':_0x38c880['as'],'attributes':_0x38c880[_0x60ac('0x1c')],'include':_0x38c880['include']?_[_0x60ac('0x1d')](_0x38c880['include'],function(_0x6485e6){return{'model':db[_0x6485e6[_0x60ac('0x1f')]],'as':_0x6485e6['as'],'attributes':_0x6485e6[_0x60ac('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x60ac('0xd')](function(_0x47a736){logger[_0x60ac('0xe')]('ShowSmsQueue',_0x20a272);logger[_0x60ac('0x11')](_0x60ac('0x21'),_0x20a272,JSON[_0x60ac('0x13')](_0x47a736));_0x1f37cc(_0x47a736);})[_0x60ac('0x23')](function(_0x225387){logger[_0x60ac('0x14')](_0x60ac('0x21'),_0x225387[_0x60ac('0x16')],_0x20a272);_0x141464(_0x32c142[_0x60ac('0x14')](0x1f4,_0x225387[_0x60ac('0x16')]));});});}; \ No newline at end of file +var _0xfbd2=['catch','ShowSmsQueue','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetSmsQueue','SmsQueue','options','raw','where','limit','include','map','attributes','model'];(function(_0x435b2f,_0x4c44da){var _0x181648=function(_0x3d753e){while(--_0x3d753e){_0x435b2f['push'](_0x435b2f['shift']());}};_0x181648(++_0x4c44da);}(_0xfbd2,0xc6));var _0x2fbd=function(_0x20f57d,_0x494967){_0x20f57d=_0x20f57d-0x0;var _0x216528=_0xfbd2[_0x20f57d];return _0x216528;};'use strict';var _=require(_0x2fbd('0x0'));var util=require(_0x2fbd('0x1'));var moment=require(_0x2fbd('0x2'));var BPromise=require(_0x2fbd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2fbd('0x4'));var db=require(_0x2fbd('0x5'))['db'];var utils=require(_0x2fbd('0x6'));var logger=require('../../config/logger')(_0x2fbd('0x7'));var config=require(_0x2fbd('0x8'));var jayson=require(_0x2fbd('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x2fbd('0xa')]=_[_0x2fbd('0xb')](config['redis'],{'host':_0x2fbd('0xc'),'port':0x18eb});var socket=require(_0x2fbd('0xd'))(new Redis(config[_0x2fbd('0xa')]));require(_0x2fbd('0xe'))[_0x2fbd('0xf')](socket);function respondWithRpcPromise(_0x4beeb9,_0x527fd2,_0x92b437){return new BPromise(function(_0x1f6287,_0x118571){return client[_0x2fbd('0x10')](_0x4beeb9,_0x92b437)[_0x2fbd('0x11')](function(_0x42d08a){logger[_0x2fbd('0x12')](_0x2fbd('0x13'),_0x527fd2,'request\x20sent');logger['debug'](_0x2fbd('0x14'),_0x527fd2,_0x2fbd('0x15'),JSON[_0x2fbd('0x16')](_0x42d08a));if(_0x42d08a[_0x2fbd('0x17')]){if(_0x42d08a[_0x2fbd('0x17')][_0x2fbd('0x18')]===0x1f4){logger[_0x2fbd('0x17')](_0x2fbd('0x13'),_0x527fd2,_0x42d08a['error'][_0x2fbd('0x19')]);return _0x118571(_0x42d08a[_0x2fbd('0x17')]['message']);}logger[_0x2fbd('0x17')](_0x2fbd('0x13'),_0x527fd2,_0x42d08a[_0x2fbd('0x17')][_0x2fbd('0x19')]);return _0x1f6287(_0x42d08a[_0x2fbd('0x17')][_0x2fbd('0x19')]);}else{logger['info'](_0x2fbd('0x13'),_0x527fd2,_0x2fbd('0x15'));_0x1f6287(_0x42d08a['result'][_0x2fbd('0x19')]);}})['catch'](function(_0x27c67b){logger['error'](_0x2fbd('0x13'),_0x527fd2,_0x27c67b);_0x118571(_0x27c67b);});});}exports[_0x2fbd('0x1a')]=function(_0x50b8a1){var _0x251b57=this;return new Promise(function(_0x48ba1c,_0x4a39cf){return db[_0x2fbd('0x1b')]['findAll']({'raw':_0x50b8a1[_0x2fbd('0x1c')]?_0x50b8a1[_0x2fbd('0x1c')][_0x2fbd('0x1d')]===undefined?!![]:![]:!![],'where':_0x50b8a1['options']?_0x50b8a1[_0x2fbd('0x1c')][_0x2fbd('0x1e')]||null:null,'attributes':_0x50b8a1[_0x2fbd('0x1c')]?_0x50b8a1[_0x2fbd('0x1c')]['attributes']||null:null,'limit':_0x50b8a1[_0x2fbd('0x1c')]?_0x50b8a1[_0x2fbd('0x1c')][_0x2fbd('0x1f')]||null:null,'include':_0x50b8a1[_0x2fbd('0x1c')]?_0x50b8a1[_0x2fbd('0x1c')][_0x2fbd('0x20')]?_[_0x2fbd('0x21')](_0x50b8a1[_0x2fbd('0x1c')][_0x2fbd('0x20')],function(_0xadde9){return{'model':db[_0xadde9['model']],'as':_0xadde9['as'],'attributes':_0xadde9[_0x2fbd('0x22')],'include':_0xadde9[_0x2fbd('0x20')]?_[_0x2fbd('0x21')](_0xadde9[_0x2fbd('0x20')],function(_0x3ec761){return{'model':db[_0x3ec761[_0x2fbd('0x23')]],'as':_0x3ec761['as'],'attributes':_0x3ec761['attributes'],'include':_0x3ec761['include']?_[_0x2fbd('0x21')](_0x3ec761[_0x2fbd('0x20')],function(_0x3a4ba5){return{'model':db[_0x3a4ba5['model']],'as':_0x3a4ba5['as'],'attributes':_0x3a4ba5[_0x2fbd('0x22')]};}):[]};}):[]};}):[]:[]})[_0x2fbd('0x11')](function(_0x3968ea){logger['info'](_0x2fbd('0x1a'),_0x50b8a1);logger['debug']('GetSmsQueue',_0x50b8a1,JSON[_0x2fbd('0x16')](_0x3968ea));_0x48ba1c(_0x3968ea);})[_0x2fbd('0x24')](function(_0x26f463){logger[_0x2fbd('0x17')](_0x2fbd('0x1a'),_0x26f463['message'],_0x50b8a1);_0x4a39cf(_0x251b57[_0x2fbd('0x17')](0x1f4,_0x26f463['message']));});});};exports[_0x2fbd('0x25')]=function(_0x24c1dd){var _0xf20b87=this;return new Promise(function(_0x1327f9,_0x3acc85){return db[_0x2fbd('0x1b')]['find']({'raw':_0x24c1dd[_0x2fbd('0x1c')]?_0x24c1dd['options'][_0x2fbd('0x1d')]===undefined?!![]:![]:!![],'where':_0x24c1dd[_0x2fbd('0x1c')]?_0x24c1dd[_0x2fbd('0x1c')][_0x2fbd('0x1e')]||null:null,'attributes':_0x24c1dd['options']?_0x24c1dd[_0x2fbd('0x1c')][_0x2fbd('0x22')]||null:null,'include':_0x24c1dd[_0x2fbd('0x1c')]?_0x24c1dd[_0x2fbd('0x1c')]['include']?_[_0x2fbd('0x21')](_0x24c1dd['options'][_0x2fbd('0x20')],function(_0x1a11b5){return{'model':db[_0x1a11b5[_0x2fbd('0x23')]],'as':_0x1a11b5['as'],'attributes':_0x1a11b5[_0x2fbd('0x22')],'include':_0x1a11b5['include']?_[_0x2fbd('0x21')](_0x1a11b5[_0x2fbd('0x20')],function(_0x14fa27){return{'model':db[_0x14fa27[_0x2fbd('0x23')]],'as':_0x14fa27['as'],'attributes':_0x14fa27[_0x2fbd('0x22')],'include':_0x14fa27['include']?_['map'](_0x14fa27[_0x2fbd('0x20')],function(_0xafd1df){return{'model':db[_0xafd1df[_0x2fbd('0x23')]],'as':_0xafd1df['as'],'attributes':_0xafd1df[_0x2fbd('0x22')]};}):[]};}):[]};}):[]:[]})[_0x2fbd('0x11')](function(_0x5b0637){logger[_0x2fbd('0x12')](_0x2fbd('0x25'),_0x24c1dd);logger[_0x2fbd('0x26')]('ShowSmsQueue',_0x24c1dd,JSON[_0x2fbd('0x16')](_0x5b0637));_0x1327f9(_0x5b0637);})[_0x2fbd('0x24')](function(_0xc7a7d1){logger[_0x2fbd('0x17')]('ShowSmsQueue',_0xc7a7d1[_0x2fbd('0x19')],_0x24c1dd);_0x3acc85(_0xf20b87[_0x2fbd('0x17')](0x1f4,_0xc7a7d1[_0x2fbd('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index acd9798..a702a1c 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 _0xb7e6=['update','emit','removeListener','register','length','smsQueue:','./smsQueue.events','save','remove'];(function(_0x661311,_0x4aea1a){var _0x620063=function(_0x55f758){while(--_0x55f758){_0x661311['push'](_0x661311['shift']());}};_0x620063(++_0x4aea1a);}(_0xb7e6,0x8d));var _0x6b7e=function(_0x34b7e9,_0x382d81){_0x34b7e9=_0x34b7e9-0x0;var _0x32cb40=_0xb7e6[_0x34b7e9];return _0x32cb40;};'use strict';var SmsQueueEvents=require(_0x6b7e('0x0'));var events=[_0x6b7e('0x1'),_0x6b7e('0x2'),_0x6b7e('0x3')];function createListener(_0x3f027c,_0x96f421){return function(_0x24ee11){_0x96f421[_0x6b7e('0x4')](_0x3f027c,_0x24ee11);};}function removeListener(_0x50f8da,_0x238b62){return function(){SmsQueueEvents[_0x6b7e('0x5')](_0x50f8da,_0x238b62);};}exports[_0x6b7e('0x6')]=function(_0x4c357b){for(var _0x3310e5=0x0,_0x13b183=events[_0x6b7e('0x7')];_0x3310e5<_0x13b183;_0x3310e5++){var _0x1e108a=events[_0x3310e5];var _0x161ffb=createListener(_0x6b7e('0x8')+_0x1e108a,_0x4c357b);SmsQueueEvents['on'](_0x1e108a,_0x161ffb);}}; \ No newline at end of file +var _0x1429=['length','smsQueue:','save','remove','emit','removeListener','register'];(function(_0x238084,_0x43d6d6){var _0x4a02b0=function(_0x203e69){while(--_0x203e69){_0x238084['push'](_0x238084['shift']());}};_0x4a02b0(++_0x43d6d6);}(_0x1429,0x1d0));var _0x9142=function(_0x3fba06,_0x3c0243){_0x3fba06=_0x3fba06-0x0;var _0x4ec6a2=_0x1429[_0x3fba06];return _0x4ec6a2;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x9142('0x0'),_0x9142('0x1'),'update'];function createListener(_0x2d6e74,_0x3b962d){return function(_0x136e86){_0x3b962d[_0x9142('0x2')](_0x2d6e74,_0x136e86);};}function removeListener(_0x2c811c,_0x559ed8){return function(){SmsQueueEvents[_0x9142('0x3')](_0x2c811c,_0x559ed8);};}exports[_0x9142('0x4')]=function(_0x12eb69){for(var _0x2af9cb=0x0,_0x267933=events[_0x9142('0x5')];_0x2af9cb<_0x267933;_0x2af9cb++){var _0x6ddf81=events[_0x2af9cb];var _0x250e04=createListener(_0x9142('0x6')+_0x6ddf81,_0x12eb69);SmsQueueEvents['on'](_0x6ddf81,_0x250e04);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index ee03c5b..f8b75a5 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 _0xdb65=['update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller','get','isAuthenticated','index','describe','post','create','put','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb65,0x16c));var _0x5db6=function(_0xc3d763,_0x2e826d){_0xc3d763=_0xc3d763-0x0;var _0x122a26=_0xdb65[_0xc3d763];return _0x122a26;};'use strict';var multer=require('multer');var util=require(_0x5db6('0x0'));var path=require(_0x5db6('0x1'));var timeout=require(_0x5db6('0x2'));var express=require('express');var router=express[_0x5db6('0x3')]();var fs_extra=require(_0x5db6('0x4'));var auth=require(_0x5db6('0x5'));var interaction=require(_0x5db6('0x6'));var config=require('../../config/environment');var controller=require(_0x5db6('0x7'));router[_0x5db6('0x8')]('/',auth[_0x5db6('0x9')](),controller[_0x5db6('0xa')]);router[_0x5db6('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x5db6('0xb')]);router[_0x5db6('0x8')]('/:id',auth[_0x5db6('0x9')](),controller['show']);router[_0x5db6('0xc')]('/',auth[_0x5db6('0x9')](),controller[_0x5db6('0xd')]);router[_0x5db6('0xe')](_0x5db6('0xf'),auth['isAuthenticated'](),controller[_0x5db6('0x10')]);router[_0x5db6('0x11')]('/:id',auth[_0x5db6('0x9')](),controller[_0x5db6('0x12')]);module[_0x5db6('0x13')]=router; \ No newline at end of file +var _0x484e=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','./smsQueueReport.controller','get','isAuthenticated','/describe','/:id','show','post','create'];(function(_0x144c55,_0xd1255c){var _0x51ecff=function(_0x3de632){while(--_0x3de632){_0x144c55['push'](_0x144c55['shift']());}};_0x51ecff(++_0xd1255c);}(_0x484e,0x194));var _0xe484=function(_0x310c2f,_0x523c2a){_0x310c2f=_0x310c2f-0x0;var _0x58a8d4=_0x484e[_0x310c2f];return _0x58a8d4;};'use strict';var multer=require('multer');var util=require(_0xe484('0x0'));var path=require(_0xe484('0x1'));var timeout=require(_0xe484('0x2'));var express=require(_0xe484('0x3'));var router=express[_0xe484('0x4')]();var fs_extra=require(_0xe484('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe484('0x6'));router[_0xe484('0x7')]('/',auth[_0xe484('0x8')](),controller['index']);router[_0xe484('0x7')](_0xe484('0x9'),auth[_0xe484('0x8')](),controller['describe']);router[_0xe484('0x7')](_0xe484('0xa'),auth[_0xe484('0x8')](),controller[_0xe484('0xb')]);router[_0xe484('0xc')]('/',auth['isAuthenticated'](),controller[_0xe484('0xd')]);router[_0xe484('0xe')](_0xe484('0xa'),auth[_0xe484('0x8')](),controller[_0xe484('0xf')]);router[_0xe484('0x10')]('/:id',auth[_0xe484('0x8')](),controller[_0xe484('0x11')]);module[_0xe484('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 501e0d4..a991fac 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 _0xfc72=['exports','STRING','DATE','sequelize'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0xfc72,0xff));var _0x2fc7=function(_0x3a89dc,_0x54bb1e){_0x3a89dc=_0x3a89dc-0x0;var _0x11c5c9=_0xfc72[_0x3a89dc];return _0x11c5c9;};'use strict';var moment=require('moment');var Sequelize=require(_0x2fc7('0x0'));module[_0x2fc7('0x1')]={'uniqueid':{'type':Sequelize[_0x2fc7('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x2fc7('0x2')]},'joinAt':{'type':Sequelize[_0x2fc7('0x3')]},'leaveAt':{'type':Sequelize[_0x2fc7('0x3')]},'acceptAt':{'type':Sequelize[_0x2fc7('0x3')]},'exitAt':{'type':Sequelize[_0x2fc7('0x3')]},'reason':{'type':Sequelize[_0x2fc7('0x2')]}}; \ No newline at end of file +var _0x6f7b=['sequelize','exports','STRING','DATE'];(function(_0x33d8de,_0x5641bc){var _0x330a1f=function(_0x20388d){while(--_0x20388d){_0x33d8de['push'](_0x33d8de['shift']());}};_0x330a1f(++_0x5641bc);}(_0x6f7b,0x168));var _0xb6f7=function(_0x283459,_0x12c1bf){_0x283459=_0x283459-0x0;var _0xc8ad49=_0x6f7b[_0x283459];return _0xc8ad49;};'use strict';var moment=require('moment');var Sequelize=require(_0xb6f7('0x0'));module[_0xb6f7('0x1')]={'uniqueid':{'type':Sequelize[_0xb6f7('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xb6f7('0x2')]},'joinAt':{'type':Sequelize[_0xb6f7('0x3')]},'leaveAt':{'type':Sequelize[_0xb6f7('0x3')]},'acceptAt':{'type':Sequelize[_0xb6f7('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xb6f7('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index abe6131..90d6ad6 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 _0x3393=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','end','sendStatus','error','stack','name','SmsQueueReport','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js'];(function(_0x385eee,_0x270cca){var _0x41fd49=function(_0x6bb501){while(--_0x6bb501){_0x385eee['push'](_0x385eee['shift']());}};_0x41fd49(++_0x270cca);}(_0x3393,0x8a));var _0x3339=function(_0x200772,_0xe7614d){_0x200772=_0x200772-0x0;var _0x43ef27=_0x3393[_0x200772];return _0x43ef27;};'use strict';var emlformat=require(_0x3339('0x0'));var rimraf=require(_0x3339('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3339('0x2'));var rp=require(_0x3339('0x3'));var moment=require(_0x3339('0x4'));var BPromise=require(_0x3339('0x5'));var Mustache=require(_0x3339('0x6'));var util=require(_0x3339('0x7'));var path=require(_0x3339('0x8'));var sox=require(_0x3339('0x9'));var csv=require(_0x3339('0xa'));var ejs=require(_0x3339('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3339('0xc'));var squel=require('squel');var crypto=require(_0x3339('0xd'));var jsforce=require(_0x3339('0xe'));var deskjs=require(_0x3339('0xf'));var toCsv=require(_0x3339('0xa'));var querystring=require(_0x3339('0x10'));var Papa=require(_0x3339('0x11'));var Redis=require(_0x3339('0x12'));var authService=require(_0x3339('0x13'));var qs=require(_0x3339('0x14'));var as=require(_0x3339('0x15'));var hardwareService=require(_0x3339('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x3339('0x17'));var licenseUtil=require(_0x3339('0x18'));var db=require(_0x3339('0x19'))['db'];function respondWithStatusCode(_0x4dd86c,_0x120887){_0x120887=_0x120887||0xcc;return function(_0x10c5c3){if(_0x10c5c3){return _0x4dd86c['sendStatus'](_0x120887);}return _0x4dd86c[_0x3339('0x1a')](_0x120887)['end']();};}function respondWithResult(_0x99969c,_0x2de747){_0x2de747=_0x2de747||0xc8;return function(_0x1bb540){if(_0x1bb540){return _0x99969c['status'](_0x2de747)['json'](_0x1bb540);}};}function respondWithFilteredResult(_0x41146f,_0x452b0f){return function(_0x1bf745){if(_0x1bf745){var _0x2576fe=typeof _0x452b0f[_0x3339('0x1b')]===_0x3339('0x1c')&&typeof _0x452b0f[_0x3339('0x1d')]==='undefined';var _0x477ede=_0x1bf745['count'];var _0x553af0=_0x2576fe?0x0:_0x452b0f[_0x3339('0x1b')];var _0x2ab990=_0x2576fe?_0x1bf745[_0x3339('0x1e')]:_0x452b0f[_0x3339('0x1b')]+_0x452b0f['limit'];var _0x1df6ef;if(_0x2ab990>=_0x477ede){_0x2ab990=_0x477ede;_0x1df6ef=0xc8;}else{_0x1df6ef=0xce;}_0x41146f[_0x3339('0x1a')](_0x1df6ef);return _0x41146f[_0x3339('0x1f')](_0x3339('0x20'),_0x553af0+'-'+_0x2ab990+'/'+_0x477ede)[_0x3339('0x21')](_0x1bf745);}return null;};}function patchUpdates(_0xc708b9){return function(_0x4ec3e0){try{jsonpatch[_0x3339('0x22')](_0x4ec3e0,_0xc708b9,!![]);}catch(_0x36b3ab){return BPromise['reject'](_0x36b3ab);}return _0x4ec3e0[_0x3339('0x23')]();};}function saveUpdates(_0x59ffee,_0x292d83){return function(_0x80c3a1){if(_0x80c3a1){return _0x80c3a1[_0x3339('0x24')](_0x59ffee)[_0x3339('0x25')](function(_0x7d1a03){return _0x7d1a03;});}return null;};}function removeEntity(_0x26e940,_0x2e1c93){return function(_0x3c6e96){if(_0x3c6e96){return _0x3c6e96['destroy']()[_0x3339('0x25')](function(){_0x26e940[_0x3339('0x1a')](0xcc)[_0x3339('0x26')]();});}};}function handleEntityNotFound(_0x56e51a,_0x290aae){return function(_0x21177d){if(!_0x21177d){_0x56e51a[_0x3339('0x27')](0x194);}return _0x21177d;};}function handleError(_0x4b49c1,_0x2dfd2f){_0x2dfd2f=_0x2dfd2f||0x1f4;return function(_0x44ce9d){logger[_0x3339('0x28')](_0x44ce9d[_0x3339('0x29')]);if(_0x44ce9d['name']){delete _0x44ce9d[_0x3339('0x2a')];}_0x4b49c1['status'](_0x2dfd2f)['send'](_0x44ce9d);};}exports['index']=function(_0x246ec6,_0x2835d7){var _0x6cffc6={},_0x5d7bec={},_0x5db6b9={'count':0x0,'rows':[]};var _0x2252a2=_['map'](db[_0x3339('0x2b')][_0x3339('0x2c')],function(_0x6dfd50){return{'name':_0x6dfd50[_0x3339('0x2d')],'type':_0x6dfd50[_0x3339('0x2e')][_0x3339('0x2f')]};});_0x5d7bec['model']=_[_0x3339('0x30')](_0x2252a2,_0x3339('0x2a'));_0x5d7bec[_0x3339('0x31')]=_[_0x3339('0x32')](_0x246ec6[_0x3339('0x31')]);_0x5d7bec[_0x3339('0x33')]=_[_0x3339('0x34')](_0x5d7bec[_0x3339('0x35')],_0x5d7bec[_0x3339('0x31')]);_0x6cffc6[_0x3339('0x36')]=_['intersection'](_0x5d7bec['model'],qs[_0x3339('0x37')](_0x246ec6['query'][_0x3339('0x37')]));_0x6cffc6['attributes']=_0x6cffc6[_0x3339('0x36')][_0x3339('0x38')]?_0x6cffc6[_0x3339('0x36')]:_0x5d7bec[_0x3339('0x35')];if(!_0x246ec6['query'][_0x3339('0x39')]('nolimit')){_0x6cffc6[_0x3339('0x1d')]=qs['limit'](_0x246ec6['query']['limit']);_0x6cffc6['offset']=qs['offset'](_0x246ec6[_0x3339('0x31')][_0x3339('0x1b')]);}_0x6cffc6[_0x3339('0x3a')]=qs[_0x3339('0x3b')](_0x246ec6[_0x3339('0x31')][_0x3339('0x3b')]);_0x6cffc6['where']=qs[_0x3339('0x33')](_[_0x3339('0x3c')](_0x246ec6['query'],_0x5d7bec[_0x3339('0x33')]),_0x2252a2);if(_0x246ec6['query']['filter']){_0x6cffc6['where']=_['merge'](_0x6cffc6['where'],{'$or':_['map'](_0x2252a2,function(_0x40ddf4){if(_0x40ddf4[_0x3339('0x2e')]!==_0x3339('0x3d')){var _0x26b77f={};_0x26b77f[_0x40ddf4[_0x3339('0x2a')]]={'$like':'%'+_0x246ec6[_0x3339('0x31')][_0x3339('0x3e')]+'%'};return _0x26b77f;}})});}_0x6cffc6=_[_0x3339('0x3f')]({},_0x6cffc6,_0x246ec6[_0x3339('0x40')]);var _0x5095d6={'where':_0x6cffc6['where']};return db['SmsQueueReport']['count'](_0x5095d6)[_0x3339('0x25')](function(_0xf478ef){_0x5db6b9['count']=_0xf478ef;if(_0x246ec6[_0x3339('0x31')][_0x3339('0x41')]){_0x6cffc6[_0x3339('0x42')]=[{'all':!![]}];}return db[_0x3339('0x2b')][_0x3339('0x43')](_0x6cffc6);})[_0x3339('0x25')](function(_0x368a39){_0x5db6b9[_0x3339('0x44')]=_0x368a39;return _0x5db6b9;})[_0x3339('0x25')](respondWithFilteredResult(_0x2835d7,_0x6cffc6))['catch'](handleError(_0x2835d7,null));};exports[_0x3339('0x45')]=function(_0x1ab994,_0x58be71){var _0x31c621={'raw':!![],'where':{'id':_0x1ab994[_0x3339('0x46')]['id']}},_0x27f4e0={};_0x27f4e0['model']=_[_0x3339('0x32')](db['SmsQueueReport'][_0x3339('0x2c')]);_0x27f4e0[_0x3339('0x31')]=_[_0x3339('0x32')](_0x1ab994[_0x3339('0x31')]);_0x27f4e0[_0x3339('0x33')]=_[_0x3339('0x34')](_0x27f4e0[_0x3339('0x35')],_0x27f4e0[_0x3339('0x31')]);_0x31c621[_0x3339('0x36')]=_['intersection'](_0x27f4e0[_0x3339('0x35')],qs[_0x3339('0x37')](_0x1ab994[_0x3339('0x31')][_0x3339('0x37')]));_0x31c621[_0x3339('0x36')]=_0x31c621[_0x3339('0x36')][_0x3339('0x38')]?_0x31c621['attributes']:_0x27f4e0[_0x3339('0x35')];if(_0x1ab994['query'][_0x3339('0x41')]){_0x31c621['include']=[{'all':!![]}];}_0x31c621=_[_0x3339('0x3f')]({},_0x31c621,_0x1ab994[_0x3339('0x40')]);return db[_0x3339('0x2b')][_0x3339('0x47')](_0x31c621)[_0x3339('0x25')](handleEntityNotFound(_0x58be71,null))[_0x3339('0x25')](respondWithResult(_0x58be71,null))[_0x3339('0x48')](handleError(_0x58be71,null));};exports[_0x3339('0x49')]=function(_0x10e43c,_0x3c1444){return db[_0x3339('0x2b')][_0x3339('0x49')](_0x10e43c[_0x3339('0x4a')],{})[_0x3339('0x25')](respondWithResult(_0x3c1444,0xc9))[_0x3339('0x48')](handleError(_0x3c1444,null));};exports[_0x3339('0x24')]=function(_0x168369,_0x3d9247){if(_0x168369[_0x3339('0x4a')]['id']){delete _0x168369['body']['id'];}return db['SmsQueueReport'][_0x3339('0x47')]({'where':{'id':_0x168369[_0x3339('0x46')]['id']}})['then'](handleEntityNotFound(_0x3d9247,null))['then'](saveUpdates(_0x168369[_0x3339('0x4a')],null))[_0x3339('0x25')](respondWithResult(_0x3d9247,null))[_0x3339('0x48')](handleError(_0x3d9247,null));};exports[_0x3339('0x4b')]=function(_0x30147c,_0x45e604){return db['SmsQueueReport'][_0x3339('0x47')]({'where':{'id':_0x30147c[_0x3339('0x46')]['id']}})[_0x3339('0x25')](handleEntityNotFound(_0x45e604,null))[_0x3339('0x25')](removeEntity(_0x45e604,null))['catch'](handleError(_0x45e604,null));};exports['describe']=function(_0x180fd6,_0xe0dc1c){return db[_0x3339('0x2b')][_0x3339('0x4c')]()[_0x3339('0x25')](respondWithResult(_0xe0dc1c,null))['catch'](handleError(_0xe0dc1c,null));}; \ No newline at end of file +var _0x0e88=['map','SmsQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','find','create','body','update','describe','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index'];(function(_0x4df25d,_0x5b6872){var _0x4ab15f=function(_0x3e2cc1){while(--_0x3e2cc1){_0x4df25d['push'](_0x4df25d['shift']());}};_0x4ab15f(++_0x5b6872);}(_0x0e88,0x105));var _0x80e8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0e88[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x80e8('0x0'));var rimraf=require(_0x80e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x80e8('0x2'));var moment=require(_0x80e8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x80e8('0x4'));var util=require(_0x80e8('0x5'));var path=require(_0x80e8('0x6'));var sox=require(_0x80e8('0x7'));var csv=require(_0x80e8('0x8'));var ejs=require(_0x80e8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x80e8('0xa'));var squel=require(_0x80e8('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x80e8('0xc'));var toCsv=require(_0x80e8('0x8'));var querystring=require(_0x80e8('0xd'));var Papa=require(_0x80e8('0xe'));var Redis=require(_0x80e8('0xf'));var authService=require(_0x80e8('0x10'));var qs=require(_0x80e8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x80e8('0x12'));var logger=require(_0x80e8('0x13'))('api');var utils=require(_0x80e8('0x14'));var config=require(_0x80e8('0x15'));var licenseUtil=require(_0x80e8('0x16'));var db=require(_0x80e8('0x17'))['db'];function respondWithStatusCode(_0x380d89,_0x2d2a47){_0x2d2a47=_0x2d2a47||0xcc;return function(_0x299afe){if(_0x299afe){return _0x380d89[_0x80e8('0x18')](_0x2d2a47);}return _0x380d89[_0x80e8('0x19')](_0x2d2a47)[_0x80e8('0x1a')]();};}function respondWithResult(_0x4d781e,_0x288321){_0x288321=_0x288321||0xc8;return function(_0x4b14a9){if(_0x4b14a9){return _0x4d781e[_0x80e8('0x19')](_0x288321)[_0x80e8('0x1b')](_0x4b14a9);}};}function respondWithFilteredResult(_0xac1d77,_0x3d5ba1){return function(_0x3822d0){if(_0x3822d0){var _0x1057e2=typeof _0x3d5ba1[_0x80e8('0x1c')]===_0x80e8('0x1d')&&typeof _0x3d5ba1[_0x80e8('0x1e')]==='undefined';var _0x4c8648=_0x3822d0[_0x80e8('0x1f')];var _0x518c98=_0x1057e2?0x0:_0x3d5ba1[_0x80e8('0x1c')];var _0x6f3d7f=_0x1057e2?_0x3822d0[_0x80e8('0x1f')]:_0x3d5ba1[_0x80e8('0x1c')]+_0x3d5ba1[_0x80e8('0x1e')];var _0x6ea14f;if(_0x6f3d7f>=_0x4c8648){_0x6f3d7f=_0x4c8648;_0x6ea14f=0xc8;}else{_0x6ea14f=0xce;}_0xac1d77['status'](_0x6ea14f);return _0xac1d77[_0x80e8('0x20')](_0x80e8('0x21'),_0x518c98+'-'+_0x6f3d7f+'/'+_0x4c8648)[_0x80e8('0x1b')](_0x3822d0);}return null;};}function patchUpdates(_0x54d484){return function(_0x5c84f8){try{jsonpatch[_0x80e8('0x22')](_0x5c84f8,_0x54d484,!![]);}catch(_0x26afc5){return BPromise['reject'](_0x26afc5);}return _0x5c84f8[_0x80e8('0x23')]();};}function saveUpdates(_0x534f78,_0x5d245d){return function(_0x20b922){if(_0x20b922){return _0x20b922['update'](_0x534f78)[_0x80e8('0x24')](function(_0x142e6d){return _0x142e6d;});}return null;};}function removeEntity(_0x5253b0,_0x2d3ce2){return function(_0x23dcb1){if(_0x23dcb1){return _0x23dcb1[_0x80e8('0x25')]()[_0x80e8('0x24')](function(){_0x5253b0[_0x80e8('0x19')](0xcc)[_0x80e8('0x1a')]();});}};}function handleEntityNotFound(_0x10c255,_0x353fd8){return function(_0x45c2b0){if(!_0x45c2b0){_0x10c255[_0x80e8('0x18')](0x194);}return _0x45c2b0;};}function handleError(_0x4425b8,_0x48313d){_0x48313d=_0x48313d||0x1f4;return function(_0xaa4d9){logger[_0x80e8('0x26')](_0xaa4d9[_0x80e8('0x27')]);if(_0xaa4d9[_0x80e8('0x28')]){delete _0xaa4d9[_0x80e8('0x28')];}_0x4425b8[_0x80e8('0x19')](_0x48313d)[_0x80e8('0x29')](_0xaa4d9);};}exports[_0x80e8('0x2a')]=function(_0x2fd31c,_0x16b09b){var _0x4f4172={},_0x28f786={},_0x173f89={'count':0x0,'rows':[]};var _0x1a5f6e=_[_0x80e8('0x2b')](db[_0x80e8('0x2c')][_0x80e8('0x2d')],function(_0x35f5f1){return{'name':_0x35f5f1[_0x80e8('0x2e')],'type':_0x35f5f1['type'][_0x80e8('0x2f')]};});_0x28f786[_0x80e8('0x30')]=_[_0x80e8('0x2b')](_0x1a5f6e,_0x80e8('0x28'));_0x28f786[_0x80e8('0x31')]=_[_0x80e8('0x32')](_0x2fd31c[_0x80e8('0x31')]);_0x28f786[_0x80e8('0x33')]=_['intersection'](_0x28f786[_0x80e8('0x30')],_0x28f786[_0x80e8('0x31')]);_0x4f4172['attributes']=_[_0x80e8('0x34')](_0x28f786[_0x80e8('0x30')],qs[_0x80e8('0x35')](_0x2fd31c['query'][_0x80e8('0x35')]));_0x4f4172[_0x80e8('0x36')]=_0x4f4172[_0x80e8('0x36')][_0x80e8('0x37')]?_0x4f4172[_0x80e8('0x36')]:_0x28f786[_0x80e8('0x30')];if(!_0x2fd31c[_0x80e8('0x31')][_0x80e8('0x38')](_0x80e8('0x39'))){_0x4f4172[_0x80e8('0x1e')]=qs[_0x80e8('0x1e')](_0x2fd31c[_0x80e8('0x31')]['limit']);_0x4f4172[_0x80e8('0x1c')]=qs[_0x80e8('0x1c')](_0x2fd31c[_0x80e8('0x31')][_0x80e8('0x1c')]);}_0x4f4172[_0x80e8('0x3a')]=qs[_0x80e8('0x3b')](_0x2fd31c[_0x80e8('0x31')]['sort']);_0x4f4172[_0x80e8('0x3c')]=qs['filters'](_[_0x80e8('0x3d')](_0x2fd31c[_0x80e8('0x31')],_0x28f786[_0x80e8('0x33')]),_0x1a5f6e);if(_0x2fd31c[_0x80e8('0x31')][_0x80e8('0x3e')]){_0x4f4172[_0x80e8('0x3c')]=_[_0x80e8('0x3f')](_0x4f4172[_0x80e8('0x3c')],{'$or':_['map'](_0x1a5f6e,function(_0x2e4e49){if(_0x2e4e49['type']!=='VIRTUAL'){var _0x4eefde={};_0x4eefde[_0x2e4e49[_0x80e8('0x28')]]={'$like':'%'+_0x2fd31c[_0x80e8('0x31')][_0x80e8('0x3e')]+'%'};return _0x4eefde;}})});}_0x4f4172=_[_0x80e8('0x3f')]({},_0x4f4172,_0x2fd31c[_0x80e8('0x40')]);var _0x2a37c4={'where':_0x4f4172[_0x80e8('0x3c')]};return db[_0x80e8('0x2c')][_0x80e8('0x1f')](_0x2a37c4)[_0x80e8('0x24')](function(_0x47563b){_0x173f89[_0x80e8('0x1f')]=_0x47563b;if(_0x2fd31c[_0x80e8('0x31')]['includeAll']){_0x4f4172[_0x80e8('0x41')]=[{'all':!![]}];}return db[_0x80e8('0x2c')][_0x80e8('0x42')](_0x4f4172);})[_0x80e8('0x24')](function(_0x417a3f){_0x173f89[_0x80e8('0x43')]=_0x417a3f;return _0x173f89;})[_0x80e8('0x24')](respondWithFilteredResult(_0x16b09b,_0x4f4172))[_0x80e8('0x44')](handleError(_0x16b09b,null));};exports[_0x80e8('0x45')]=function(_0x2f4325,_0x257dfc){var _0x43ba52={'raw':!![],'where':{'id':_0x2f4325[_0x80e8('0x46')]['id']}},_0x128df3={};_0x128df3[_0x80e8('0x30')]=_[_0x80e8('0x32')](db[_0x80e8('0x2c')]['rawAttributes']);_0x128df3[_0x80e8('0x31')]=_[_0x80e8('0x32')](_0x2f4325['query']);_0x128df3['filters']=_[_0x80e8('0x34')](_0x128df3['model'],_0x128df3[_0x80e8('0x31')]);_0x43ba52[_0x80e8('0x36')]=_[_0x80e8('0x34')](_0x128df3[_0x80e8('0x30')],qs[_0x80e8('0x35')](_0x2f4325['query'][_0x80e8('0x35')]));_0x43ba52[_0x80e8('0x36')]=_0x43ba52[_0x80e8('0x36')][_0x80e8('0x37')]?_0x43ba52['attributes']:_0x128df3[_0x80e8('0x30')];if(_0x2f4325[_0x80e8('0x31')]['includeAll']){_0x43ba52[_0x80e8('0x41')]=[{'all':!![]}];}_0x43ba52=_[_0x80e8('0x3f')]({},_0x43ba52,_0x2f4325[_0x80e8('0x40')]);return db[_0x80e8('0x2c')][_0x80e8('0x47')](_0x43ba52)['then'](handleEntityNotFound(_0x257dfc,null))[_0x80e8('0x24')](respondWithResult(_0x257dfc,null))['catch'](handleError(_0x257dfc,null));};exports[_0x80e8('0x48')]=function(_0x3d2834,_0x2aa362){return db[_0x80e8('0x2c')][_0x80e8('0x48')](_0x3d2834[_0x80e8('0x49')],{})[_0x80e8('0x24')](respondWithResult(_0x2aa362,0xc9))['catch'](handleError(_0x2aa362,null));};exports[_0x80e8('0x4a')]=function(_0x58152f,_0x374d75){if(_0x58152f['body']['id']){delete _0x58152f[_0x80e8('0x49')]['id'];}return db['SmsQueueReport'][_0x80e8('0x47')]({'where':{'id':_0x58152f[_0x80e8('0x46')]['id']}})[_0x80e8('0x24')](handleEntityNotFound(_0x374d75,null))[_0x80e8('0x24')](saveUpdates(_0x58152f[_0x80e8('0x49')],null))[_0x80e8('0x24')](respondWithResult(_0x374d75,null))[_0x80e8('0x44')](handleError(_0x374d75,null));};exports['destroy']=function(_0x571967,_0x4eaf82){return db[_0x80e8('0x2c')][_0x80e8('0x47')]({'where':{'id':_0x571967['params']['id']}})[_0x80e8('0x24')](handleEntityNotFound(_0x4eaf82,null))['then'](removeEntity(_0x4eaf82,null))[_0x80e8('0x44')](handleError(_0x4eaf82,null));};exports[_0x80e8('0x4b')]=function(_0x43293c,_0x491402){return db[_0x80e8('0x2c')][_0x80e8('0x4b')]()['then'](respondWithResult(_0x491402,null))[_0x80e8('0x44')](handleError(_0x491402,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index c083da1..9337d04 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0xd6297b,_0x3878a3){var _0x8ccab7=function(_0x152ac1){while(--_0x152ac1){_0xd6297b['push'](_0xd6297b['shift']());}};_0x8ccab7(++_0x3878a3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1f5a63,_0x511504){_0x1f5a63=_0x1f5a63-0x0;var _0x30bb7a=_0xcb91[_0x1f5a63];return _0x30bb7a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('SmsQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x21d36e,_0x5dc096){var _0x4cc307=function(_0x4ae995){while(--_0x4ae995){_0x21d36e['push'](_0x21d36e['shift']());}};_0x4cc307(++_0x5dc096);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 7f9a268..afba92e 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 _0xfc26=['UpdateSmsQueueReport','update','where','limit','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','request\x20sent','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','then'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xfc26,0x137));var _0x6fc2=function(_0x57d13b,_0x52d8cb){_0x57d13b=_0x57d13b-0x0;var _0x467696=_0xfc26[_0x57d13b];return _0x467696;};'use strict';var _=require(_0x6fc2('0x0'));var util=require(_0x6fc2('0x1'));var moment=require(_0x6fc2('0x2'));var BPromise=require(_0x6fc2('0x3'));var rs=require(_0x6fc2('0x4'));var fs=require('fs');var Redis=require(_0x6fc2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6fc2('0x6'));var logger=require(_0x6fc2('0x7'))(_0x6fc2('0x8'));var config=require('../../config/environment');var jayson=require(_0x6fc2('0x9'));var client=jayson[_0x6fc2('0xa')][_0x6fc2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b39b2,_0x85cb7f,_0x2942f5){return new BPromise(function(_0x1cfd30,_0x475abe){return client[_0x6fc2('0xc')](_0x2b39b2,_0x2942f5)['then'](function(_0x13706a){logger[_0x6fc2('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x85cb7f,'request\x20sent');logger['debug'](_0x6fc2('0xe'),_0x85cb7f,'request\x20sent',JSON[_0x6fc2('0xf')](_0x13706a));if(_0x13706a['error']){if(_0x13706a[_0x6fc2('0x10')][_0x6fc2('0x11')]===0x1f4){logger['error'](_0x6fc2('0x12'),_0x85cb7f,_0x13706a[_0x6fc2('0x10')][_0x6fc2('0x13')]);return _0x475abe(_0x13706a['error'][_0x6fc2('0x13')]);}logger['error'](_0x6fc2('0x12'),_0x85cb7f,_0x13706a[_0x6fc2('0x10')]['message']);return _0x1cfd30(_0x13706a['error'][_0x6fc2('0x13')]);}else{logger[_0x6fc2('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x85cb7f,_0x6fc2('0x14'));_0x1cfd30(_0x13706a['result'][_0x6fc2('0x13')]);}})[_0x6fc2('0x15')](function(_0x2765f3){logger['error'](_0x6fc2('0x12'),_0x85cb7f,_0x2765f3);_0x475abe(_0x2765f3);});});}exports[_0x6fc2('0x16')]=function(_0x49d92f){var _0x5c2250=this;return new Promise(function(_0x4dc3d1,_0x3e7f3b){return db[_0x6fc2('0x17')][_0x6fc2('0x18')](_0x49d92f[_0x6fc2('0x19')],{'raw':_0x49d92f[_0x6fc2('0x1a')]?_0x49d92f['options'][_0x6fc2('0x1b')]===undefined?!![]:![]:!![]})[_0x6fc2('0x1c')](function(_0x4a04a3){logger['info'](_0x6fc2('0x16'),_0x49d92f);logger['debug']('CreateSmsQueueReport',_0x49d92f,JSON[_0x6fc2('0xf')](_0x4a04a3));_0x4dc3d1(_0x4a04a3);})[_0x6fc2('0x15')](function(_0x40d831){logger[_0x6fc2('0x10')](_0x6fc2('0x16'),_0x40d831[_0x6fc2('0x13')],_0x49d92f);_0x3e7f3b(_0x5c2250[_0x6fc2('0x10')](0x1f4,_0x40d831[_0x6fc2('0x13')]));});});};exports[_0x6fc2('0x1d')]=function(_0x1645d1){var _0x520133=this;return new Promise(function(_0x29b04a,_0x424c93){return db[_0x6fc2('0x17')][_0x6fc2('0x1e')](_0x1645d1[_0x6fc2('0x19')],{'raw':_0x1645d1[_0x6fc2('0x1a')]?_0x1645d1['options'][_0x6fc2('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1645d1[_0x6fc2('0x1a')]?_0x1645d1[_0x6fc2('0x1a')][_0x6fc2('0x1f')]||null:null,'attributes':_0x1645d1['options']?_0x1645d1[_0x6fc2('0x1a')]['attributes']||null:null,'limit':_0x1645d1[_0x6fc2('0x1a')]?_0x1645d1['options'][_0x6fc2('0x20')]||null:null})[_0x6fc2('0x1c')](function(_0x281f5d){logger[_0x6fc2('0xd')]('UpdateSmsQueueReport',_0x1645d1);logger[_0x6fc2('0x21')](_0x6fc2('0x1d'),_0x1645d1,JSON[_0x6fc2('0xf')](_0x281f5d));_0x29b04a(_0x281f5d);})[_0x6fc2('0x15')](function(_0x14e42e){logger[_0x6fc2('0x10')](_0x6fc2('0x1d'),_0x14e42e[_0x6fc2('0x13')],_0x1645d1);_0x424c93(_0x520133[_0x6fc2('0x10')](0x1f4,_0x14e42e['message']));});});}; \ No newline at end of file +var _0x1974=['where','attributes','limit','UpdateSmsQueueReport','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','info'];(function(_0x3661fa,_0xeeada2){var _0x5a9305=function(_0x46a3a3){while(--_0x46a3a3){_0x3661fa['push'](_0x3661fa['shift']());}};_0x5a9305(++_0xeeada2);}(_0x1974,0x184));var _0x4197=function(_0x54d107,_0x5c0ce7){_0x54d107=_0x54d107-0x0;var _0x39c683=_0x1974[_0x54d107];return _0x39c683;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4197('0x0'));var BPromise=require(_0x4197('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4197('0x2'))['db'];var utils=require(_0x4197('0x3'));var logger=require(_0x4197('0x4'))(_0x4197('0x5'));var config=require(_0x4197('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4197('0x7')][_0x4197('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c7412,_0x302635,_0x37ac7d){return new BPromise(function(_0x21dffe,_0x8edee3){return client[_0x4197('0x9')](_0x4c7412,_0x37ac7d)[_0x4197('0xa')](function(_0x27e4dc){logger['info'](_0x4197('0xb'),_0x302635,_0x4197('0xc'));logger[_0x4197('0xd')](_0x4197('0xe'),_0x302635,'request\x20sent',JSON[_0x4197('0xf')](_0x27e4dc));if(_0x27e4dc['error']){if(_0x27e4dc[_0x4197('0x10')][_0x4197('0x11')]===0x1f4){logger[_0x4197('0x10')](_0x4197('0xb'),_0x302635,_0x27e4dc[_0x4197('0x10')][_0x4197('0x12')]);return _0x8edee3(_0x27e4dc[_0x4197('0x10')][_0x4197('0x12')]);}logger['error'](_0x4197('0xb'),_0x302635,_0x27e4dc[_0x4197('0x10')][_0x4197('0x12')]);return _0x21dffe(_0x27e4dc[_0x4197('0x10')][_0x4197('0x12')]);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x302635,'request\x20sent');_0x21dffe(_0x27e4dc[_0x4197('0x13')][_0x4197('0x12')]);}})[_0x4197('0x14')](function(_0x17bcb8){logger[_0x4197('0x10')](_0x4197('0xb'),_0x302635,_0x17bcb8);_0x8edee3(_0x17bcb8);});});}exports[_0x4197('0x15')]=function(_0x4fb484){var _0xc07ee3=this;return new Promise(function(_0x3cb572,_0x3cd96e){return db[_0x4197('0x16')][_0x4197('0x17')](_0x4fb484[_0x4197('0x18')],{'raw':_0x4fb484[_0x4197('0x19')]?_0x4fb484[_0x4197('0x19')][_0x4197('0x1a')]===undefined?!![]:![]:!![]})[_0x4197('0xa')](function(_0x5d6456){logger[_0x4197('0x1b')](_0x4197('0x15'),_0x4fb484);logger[_0x4197('0xd')]('CreateSmsQueueReport',_0x4fb484,JSON[_0x4197('0xf')](_0x5d6456));_0x3cb572(_0x5d6456);})[_0x4197('0x14')](function(_0x51c2bc){logger[_0x4197('0x10')](_0x4197('0x15'),_0x51c2bc['message'],_0x4fb484);_0x3cd96e(_0xc07ee3['error'](0x1f4,_0x51c2bc[_0x4197('0x12')]));});});};exports['UpdateSmsQueueReport']=function(_0xfb8bc4){var _0x36274d=this;return new Promise(function(_0x5b3612,_0x200076){return db[_0x4197('0x16')]['update'](_0xfb8bc4[_0x4197('0x18')],{'raw':_0xfb8bc4[_0x4197('0x19')]?_0xfb8bc4[_0x4197('0x19')][_0x4197('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfb8bc4[_0x4197('0x19')]?_0xfb8bc4[_0x4197('0x19')][_0x4197('0x1c')]||null:null,'attributes':_0xfb8bc4[_0x4197('0x19')]?_0xfb8bc4[_0x4197('0x19')][_0x4197('0x1d')]||null:null,'limit':_0xfb8bc4['options']?_0xfb8bc4['options'][_0x4197('0x1e')]||null:null})[_0x4197('0xa')](function(_0xc7cf08){logger[_0x4197('0x1b')](_0x4197('0x1f'),_0xfb8bc4);logger[_0x4197('0xd')](_0x4197('0x1f'),_0xfb8bc4,JSON['stringify'](_0xc7cf08));_0x5b3612(_0xc7cf08);})['catch'](function(_0x49db41){logger[_0x4197('0x10')](_0x4197('0x1f'),_0x49db41['message'],_0xfb8bc4);_0x200076(_0x36274d['error'](0x1f4,_0x49db41['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 31bf3e8..d92e8cf 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 _0x04de=['describe','get','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','/describe','isAuthenticated'];(function(_0x429684,_0x1e94fe){var _0x3903d6=function(_0x5323f9){while(--_0x5323f9){_0x429684['push'](_0x429684['shift']());}};_0x3903d6(++_0x1e94fe);}(_0x04de,0x107));var _0xe04d=function(_0x5dd57d,_0x352ddd){_0x5dd57d=_0x5dd57d-0x0;var _0x988bc0=_0x04de[_0x5dd57d];return _0x988bc0;};'use strict';var multer=require(_0xe04d('0x0'));var util=require(_0xe04d('0x1'));var path=require(_0xe04d('0x2'));var timeout=require(_0xe04d('0x3'));var express=require(_0xe04d('0x4'));var router=express[_0xe04d('0x5')]();var fs_extra=require(_0xe04d('0x6'));var auth=require(_0xe04d('0x7'));var interaction=require(_0xe04d('0x8'));var config=require(_0xe04d('0x9'));var controller=require(_0xe04d('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xe04d('0xb'),auth[_0xe04d('0xc')](),controller[_0xe04d('0xd')]);router[_0xe04d('0xe')](_0xe04d('0xf'),auth[_0xe04d('0xc')](),controller[_0xe04d('0x10')]);router[_0xe04d('0x11')]('/',auth['isAuthenticated'](),controller[_0xe04d('0x12')]);router[_0xe04d('0x13')](_0xe04d('0xf'),auth[_0xe04d('0xc')](),controller[_0xe04d('0x14')]);router[_0xe04d('0x15')](_0xe04d('0xf'),auth[_0xe04d('0xc')](),controller[_0xe04d('0x16')]);module['exports']=router; \ No newline at end of file +var _0xa1f6=['util','path','connect-timeout','express','Router','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','destroy','exports','multer'];(function(_0x311d07,_0x5e878e){var _0x3a7cda=function(_0x1e1c25){while(--_0x1e1c25){_0x311d07['push'](_0x311d07['shift']());}};_0x3a7cda(++_0x5e878e);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x22ee1e,_0x3eff80){_0x22ee1e=_0x22ee1e-0x0;var _0x49a5c9=_0xa1f6[_0x22ee1e];return _0x49a5c9;};'use strict';var multer=require(_0x6a1f('0x0'));var util=require(_0x6a1f('0x1'));var path=require(_0x6a1f('0x2'));var timeout=require(_0x6a1f('0x3'));var express=require(_0x6a1f('0x4'));var router=express[_0x6a1f('0x5')]();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('./smsTransferReport.controller');router[_0x6a1f('0x6')]('/',auth[_0x6a1f('0x7')](),controller[_0x6a1f('0x8')]);router[_0x6a1f('0x6')](_0x6a1f('0x9'),auth[_0x6a1f('0x7')](),controller[_0x6a1f('0xa')]);router['get'](_0x6a1f('0xb'),auth[_0x6a1f('0x7')](),controller[_0x6a1f('0xc')]);router[_0x6a1f('0xd')]('/',auth[_0x6a1f('0x7')](),controller['create']);router[_0x6a1f('0xe')](_0x6a1f('0xb'),auth[_0x6a1f('0x7')](),controller[_0x6a1f('0xf')]);router['delete'](_0x6a1f('0xb'),auth['isAuthenticated'](),controller[_0x6a1f('0x10')]);module[_0x6a1f('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 6203d3a..d99ab57 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x1c5950,_0x49e128){var _0x2b720a=function(_0x4454f1){while(--_0x4454f1){_0x1c5950['push'](_0x1c5950['shift']());}};_0x2b720a(++_0x49e128);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2a1008,_0x402274){_0x2a1008=_0x2a1008-0x0;var _0x5a3e27=_0xb43b[_0x2a1008];return _0x5a3e27;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x402a20,_0x52661d){var _0x4a1b81=function(_0x986cf8){while(--_0x986cf8){_0x402a20['push'](_0x402a20['shift']());}};_0x4a1b81(++_0x52661d);}(_0x70e0,0x17b));var _0x070e=function(_0x453c54,_0x2a1067){_0x453c54=_0x453c54-0x0;var _0x92025a=_0x70e0[_0x453c54];return _0x92025a;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index bc9a362..0c64894 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 _0x9034=['hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','update','then','destroy','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length'];(function(_0x59080e,_0x2c3518){var _0x4f86a9=function(_0x43784a){while(--_0x43784a){_0x59080e['push'](_0x59080e['shift']());}};_0x4f86a9(++_0x2c3518);}(_0x9034,0xaa));var _0x4903=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9034[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x4903('0x0'));var rimraf=require(_0x4903('0x1'));var zipdir=require(_0x4903('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4903('0x3'));var moment=require(_0x4903('0x4'));var BPromise=require(_0x4903('0x5'));var Mustache=require('mustache');var util=require(_0x4903('0x6'));var path=require(_0x4903('0x7'));var sox=require(_0x4903('0x8'));var csv=require(_0x4903('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4903('0xa'));var _=require(_0x4903('0xb'));var squel=require(_0x4903('0xc'));var crypto=require(_0x4903('0xd'));var jsforce=require(_0x4903('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4903('0x9'));var querystring=require(_0x4903('0xf'));var Papa=require('papaparse');var Redis=require(_0x4903('0x10'));var authService=require(_0x4903('0x11'));var qs=require(_0x4903('0x12'));var as=require(_0x4903('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4903('0x14'))('api');var utils=require(_0x4903('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4903('0x16'));var db=require(_0x4903('0x17'))['db'];function respondWithStatusCode(_0x386124,_0x5c0307){_0x5c0307=_0x5c0307||0xcc;return function(_0x1c09db){if(_0x1c09db){return _0x386124[_0x4903('0x18')](_0x5c0307);}return _0x386124['status'](_0x5c0307)[_0x4903('0x19')]();};}function respondWithResult(_0x893c6b,_0x5591d0){_0x5591d0=_0x5591d0||0xc8;return function(_0x3954f4){if(_0x3954f4){return _0x893c6b['status'](_0x5591d0)[_0x4903('0x1a')](_0x3954f4);}};}function respondWithFilteredResult(_0x539a97,_0x6d63a5){return function(_0x2da41f){if(_0x2da41f){var _0x4d02a4=typeof _0x6d63a5[_0x4903('0x1b')]===_0x4903('0x1c')&&typeof _0x6d63a5[_0x4903('0x1d')]===_0x4903('0x1c');var _0x41461a=_0x2da41f['count'];var _0xd39784=_0x4d02a4?0x0:_0x6d63a5[_0x4903('0x1b')];var _0x36f085=_0x4d02a4?_0x2da41f[_0x4903('0x1e')]:_0x6d63a5['offset']+_0x6d63a5[_0x4903('0x1d')];var _0x5791fa;if(_0x36f085>=_0x41461a){_0x36f085=_0x41461a;_0x5791fa=0xc8;}else{_0x5791fa=0xce;}_0x539a97[_0x4903('0x1f')](_0x5791fa);return _0x539a97[_0x4903('0x20')]('Content-Range',_0xd39784+'-'+_0x36f085+'/'+_0x41461a)[_0x4903('0x1a')](_0x2da41f);}return null;};}function patchUpdates(_0x1e0fed){return function(_0x308d8c){try{jsonpatch[_0x4903('0x21')](_0x308d8c,_0x1e0fed,!![]);}catch(_0x54565f){return BPromise[_0x4903('0x22')](_0x54565f);}return _0x308d8c['save']();};}function saveUpdates(_0x714fee,_0x33f27c){return function(_0x17a59a){if(_0x17a59a){return _0x17a59a[_0x4903('0x23')](_0x714fee)[_0x4903('0x24')](function(_0x1e4b43){return _0x1e4b43;});}return null;};}function removeEntity(_0x48a564,_0x1db90c){return function(_0x259d50){if(_0x259d50){return _0x259d50[_0x4903('0x25')]()[_0x4903('0x24')](function(){_0x48a564['status'](0xcc)[_0x4903('0x19')]();});}};}function handleEntityNotFound(_0x3437c5,_0x3ebf4d){return function(_0x4c659c){if(!_0x4c659c){_0x3437c5['sendStatus'](0x194);}return _0x4c659c;};}function handleError(_0x118136,_0x5bcfc6){_0x5bcfc6=_0x5bcfc6||0x1f4;return function(_0x4adb13){logger['error'](_0x4adb13[_0x4903('0x26')]);if(_0x4adb13[_0x4903('0x27')]){delete _0x4adb13[_0x4903('0x27')];}_0x118136[_0x4903('0x1f')](_0x5bcfc6)[_0x4903('0x28')](_0x4adb13);};}exports[_0x4903('0x29')]=function(_0x21e158,_0x50e53e){var _0x46cbd8={},_0x1b1a21={},_0x235bf6={'count':0x0,'rows':[]};var _0x5889c5=_[_0x4903('0x2a')](db[_0x4903('0x2b')][_0x4903('0x2c')],function(_0x4e1a64){return{'name':_0x4e1a64[_0x4903('0x2d')],'type':_0x4e1a64[_0x4903('0x2e')][_0x4903('0x2f')]};});_0x1b1a21[_0x4903('0x30')]=_[_0x4903('0x2a')](_0x5889c5,'name');_0x1b1a21[_0x4903('0x31')]=_[_0x4903('0x32')](_0x21e158['query']);_0x1b1a21['filters']=_[_0x4903('0x33')](_0x1b1a21[_0x4903('0x30')],_0x1b1a21[_0x4903('0x31')]);_0x46cbd8[_0x4903('0x34')]=_[_0x4903('0x33')](_0x1b1a21[_0x4903('0x30')],qs['fields'](_0x21e158[_0x4903('0x31')][_0x4903('0x35')]));_0x46cbd8[_0x4903('0x34')]=_0x46cbd8['attributes'][_0x4903('0x36')]?_0x46cbd8['attributes']:_0x1b1a21['model'];if(!_0x21e158[_0x4903('0x31')][_0x4903('0x37')](_0x4903('0x38'))){_0x46cbd8[_0x4903('0x1d')]=qs[_0x4903('0x1d')](_0x21e158[_0x4903('0x31')]['limit']);_0x46cbd8[_0x4903('0x1b')]=qs[_0x4903('0x1b')](_0x21e158[_0x4903('0x31')][_0x4903('0x1b')]);}_0x46cbd8[_0x4903('0x39')]=qs[_0x4903('0x3a')](_0x21e158[_0x4903('0x31')][_0x4903('0x3a')]);_0x46cbd8[_0x4903('0x3b')]=qs[_0x4903('0x3c')](_[_0x4903('0x3d')](_0x21e158[_0x4903('0x31')],_0x1b1a21[_0x4903('0x3c')]),_0x5889c5);if(_0x21e158[_0x4903('0x31')][_0x4903('0x3e')]){_0x46cbd8[_0x4903('0x3b')]=_[_0x4903('0x3f')](_0x46cbd8[_0x4903('0x3b')],{'$or':_[_0x4903('0x2a')](_0x5889c5,function(_0x586f6f){if(_0x586f6f[_0x4903('0x2e')]!==_0x4903('0x40')){var _0x16381a={};_0x16381a[_0x586f6f[_0x4903('0x27')]]={'$like':'%'+_0x21e158[_0x4903('0x31')]['filter']+'%'};return _0x16381a;}})});}_0x46cbd8=_['merge']({},_0x46cbd8,_0x21e158[_0x4903('0x41')]);var _0x5ed6f9={'where':_0x46cbd8['where']};return db[_0x4903('0x2b')][_0x4903('0x1e')](_0x5ed6f9)[_0x4903('0x24')](function(_0x35a657){_0x235bf6[_0x4903('0x1e')]=_0x35a657;if(_0x21e158[_0x4903('0x31')][_0x4903('0x42')]){_0x46cbd8['include']=[{'all':!![]}];}return db[_0x4903('0x2b')]['findAll'](_0x46cbd8);})[_0x4903('0x24')](function(_0x5969ee){_0x235bf6[_0x4903('0x43')]=_0x5969ee;return _0x235bf6;})[_0x4903('0x24')](respondWithFilteredResult(_0x50e53e,_0x46cbd8))[_0x4903('0x44')](handleError(_0x50e53e,null));};exports['show']=function(_0x21dcb5,_0x27fd54){var _0x1372e1={'raw':!![],'where':{'id':_0x21dcb5[_0x4903('0x45')]['id']}},_0x588fca={};_0x588fca['model']=_['keys'](db[_0x4903('0x2b')][_0x4903('0x2c')]);_0x588fca[_0x4903('0x31')]=_['keys'](_0x21dcb5[_0x4903('0x31')]);_0x588fca['filters']=_[_0x4903('0x33')](_0x588fca[_0x4903('0x30')],_0x588fca[_0x4903('0x31')]);_0x1372e1['attributes']=_[_0x4903('0x33')](_0x588fca[_0x4903('0x30')],qs[_0x4903('0x35')](_0x21dcb5[_0x4903('0x31')]['fields']));_0x1372e1[_0x4903('0x34')]=_0x1372e1[_0x4903('0x34')][_0x4903('0x36')]?_0x1372e1['attributes']:_0x588fca[_0x4903('0x30')];if(_0x21dcb5[_0x4903('0x31')][_0x4903('0x42')]){_0x1372e1[_0x4903('0x46')]=[{'all':!![]}];}_0x1372e1=_[_0x4903('0x3f')]({},_0x1372e1,_0x21dcb5['options']);return db[_0x4903('0x2b')][_0x4903('0x47')](_0x1372e1)[_0x4903('0x24')](handleEntityNotFound(_0x27fd54,null))['then'](respondWithResult(_0x27fd54,null))[_0x4903('0x44')](handleError(_0x27fd54,null));};exports[_0x4903('0x48')]=function(_0x502a19,_0x40812d){return db[_0x4903('0x2b')]['create'](_0x502a19[_0x4903('0x49')],{})[_0x4903('0x24')](respondWithResult(_0x40812d,0xc9))[_0x4903('0x44')](handleError(_0x40812d,null));};exports[_0x4903('0x23')]=function(_0x50e42e,_0x554d8a){if(_0x50e42e[_0x4903('0x49')]['id']){delete _0x50e42e['body']['id'];}return db[_0x4903('0x2b')][_0x4903('0x47')]({'where':{'id':_0x50e42e[_0x4903('0x45')]['id']}})[_0x4903('0x24')](handleEntityNotFound(_0x554d8a,null))[_0x4903('0x24')](saveUpdates(_0x50e42e[_0x4903('0x49')],null))[_0x4903('0x24')](respondWithResult(_0x554d8a,null))['catch'](handleError(_0x554d8a,null));};exports[_0x4903('0x25')]=function(_0x2d681c,_0x1ed6c9){return db[_0x4903('0x2b')]['find']({'where':{'id':_0x2d681c[_0x4903('0x45')]['id']}})[_0x4903('0x24')](handleEntityNotFound(_0x1ed6c9,null))[_0x4903('0x24')](removeEntity(_0x1ed6c9,null))[_0x4903('0x44')](handleError(_0x1ed6c9,null));};exports[_0x4903('0x4a')]=function(_0x1915c2,_0x520022){return db[_0x4903('0x2b')][_0x4903('0x4a')]()['then'](respondWithResult(_0x520022,null))[_0x4903('0x44')](handleError(_0x520022,null));}; \ No newline at end of file +var _0xedd3=['index','map','SmsTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','name','send'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xedd3,0x111));var _0x3edd=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xedd3[_0x2e4aa2];return _0x5e6092;};'use strict';var emlformat=require(_0x3edd('0x0'));var rimraf=require(_0x3edd('0x1'));var zipdir=require(_0x3edd('0x2'));var jsonpatch=require(_0x3edd('0x3'));var rp=require(_0x3edd('0x4'));var moment=require(_0x3edd('0x5'));var BPromise=require(_0x3edd('0x6'));var Mustache=require(_0x3edd('0x7'));var util=require(_0x3edd('0x8'));var path=require(_0x3edd('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3edd('0xa'));var fs=require('fs');var fs_extra=require(_0x3edd('0xb'));var _=require('lodash');var squel=require(_0x3edd('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3edd('0xd'));var toCsv=require(_0x3edd('0xe'));var querystring=require(_0x3edd('0xf'));var Papa=require(_0x3edd('0x10'));var Redis=require(_0x3edd('0x11'));var authService=require(_0x3edd('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3edd('0x13'));var hardwareService=require(_0x3edd('0x14'));var logger=require(_0x3edd('0x15'))(_0x3edd('0x16'));var utils=require(_0x3edd('0x17'));var config=require(_0x3edd('0x18'));var licenseUtil=require(_0x3edd('0x19'));var db=require(_0x3edd('0x1a'))['db'];function respondWithStatusCode(_0x50a5aa,_0x2c4476){_0x2c4476=_0x2c4476||0xcc;return function(_0x357d60){if(_0x357d60){return _0x50a5aa[_0x3edd('0x1b')](_0x2c4476);}return _0x50a5aa['status'](_0x2c4476)[_0x3edd('0x1c')]();};}function respondWithResult(_0x3fe68a,_0x2f0d46){_0x2f0d46=_0x2f0d46||0xc8;return function(_0x5a5f29){if(_0x5a5f29){return _0x3fe68a[_0x3edd('0x1d')](_0x2f0d46)[_0x3edd('0x1e')](_0x5a5f29);}};}function respondWithFilteredResult(_0x3dca92,_0x553e60){return function(_0x24b3fc){if(_0x24b3fc){var _0x13957a=typeof _0x553e60['offset']==='undefined'&&typeof _0x553e60[_0x3edd('0x1f')]==='undefined';var _0x3ab38e=_0x24b3fc[_0x3edd('0x20')];var _0x26617c=_0x13957a?0x0:_0x553e60['offset'];var _0x1163cd=_0x13957a?_0x24b3fc['count']:_0x553e60[_0x3edd('0x21')]+_0x553e60[_0x3edd('0x1f')];var _0x1fc98f;if(_0x1163cd>=_0x3ab38e){_0x1163cd=_0x3ab38e;_0x1fc98f=0xc8;}else{_0x1fc98f=0xce;}_0x3dca92[_0x3edd('0x1d')](_0x1fc98f);return _0x3dca92[_0x3edd('0x22')](_0x3edd('0x23'),_0x26617c+'-'+_0x1163cd+'/'+_0x3ab38e)['json'](_0x24b3fc);}return null;};}function patchUpdates(_0x36fa64){return function(_0x1dc9b1){try{jsonpatch['apply'](_0x1dc9b1,_0x36fa64,!![]);}catch(_0x3360c2){return BPromise[_0x3edd('0x24')](_0x3360c2);}return _0x1dc9b1[_0x3edd('0x25')]();};}function saveUpdates(_0xfa4681,_0x353250){return function(_0x215218){if(_0x215218){return _0x215218[_0x3edd('0x26')](_0xfa4681)[_0x3edd('0x27')](function(_0x469a5a){return _0x469a5a;});}return null;};}function removeEntity(_0x2f5b23,_0x1033a7){return function(_0x2976a3){if(_0x2976a3){return _0x2976a3[_0x3edd('0x28')]()[_0x3edd('0x27')](function(){_0x2f5b23[_0x3edd('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f59d9,_0x58e948){return function(_0xfb11f6){if(!_0xfb11f6){_0x3f59d9[_0x3edd('0x1b')](0x194);}return _0xfb11f6;};}function handleError(_0x4ec175,_0x56ad2c){_0x56ad2c=_0x56ad2c||0x1f4;return function(_0x9d3271){logger['error'](_0x9d3271['stack']);if(_0x9d3271[_0x3edd('0x29')]){delete _0x9d3271[_0x3edd('0x29')];}_0x4ec175['status'](_0x56ad2c)[_0x3edd('0x2a')](_0x9d3271);};}exports[_0x3edd('0x2b')]=function(_0x48f201,_0x526ad2){var _0x43be62={},_0x304f72={},_0x258f63={'count':0x0,'rows':[]};var _0x32602d=_[_0x3edd('0x2c')](db[_0x3edd('0x2d')][_0x3edd('0x2e')],function(_0x33e319){return{'name':_0x33e319[_0x3edd('0x2f')],'type':_0x33e319['type'][_0x3edd('0x30')]};});_0x304f72[_0x3edd('0x31')]=_[_0x3edd('0x2c')](_0x32602d,_0x3edd('0x29'));_0x304f72[_0x3edd('0x32')]=_[_0x3edd('0x33')](_0x48f201[_0x3edd('0x32')]);_0x304f72[_0x3edd('0x34')]=_[_0x3edd('0x35')](_0x304f72[_0x3edd('0x31')],_0x304f72[_0x3edd('0x32')]);_0x43be62[_0x3edd('0x36')]=_[_0x3edd('0x35')](_0x304f72[_0x3edd('0x31')],qs['fields'](_0x48f201[_0x3edd('0x32')][_0x3edd('0x37')]));_0x43be62[_0x3edd('0x36')]=_0x43be62['attributes'][_0x3edd('0x38')]?_0x43be62['attributes']:_0x304f72[_0x3edd('0x31')];if(!_0x48f201[_0x3edd('0x32')][_0x3edd('0x39')](_0x3edd('0x3a'))){_0x43be62[_0x3edd('0x1f')]=qs[_0x3edd('0x1f')](_0x48f201[_0x3edd('0x32')][_0x3edd('0x1f')]);_0x43be62[_0x3edd('0x21')]=qs[_0x3edd('0x21')](_0x48f201['query']['offset']);}_0x43be62[_0x3edd('0x3b')]=qs['sort'](_0x48f201[_0x3edd('0x32')][_0x3edd('0x3c')]);_0x43be62[_0x3edd('0x3d')]=qs[_0x3edd('0x34')](_[_0x3edd('0x3e')](_0x48f201[_0x3edd('0x32')],_0x304f72['filters']),_0x32602d);if(_0x48f201[_0x3edd('0x32')][_0x3edd('0x3f')]){_0x43be62['where']=_[_0x3edd('0x40')](_0x43be62[_0x3edd('0x3d')],{'$or':_[_0x3edd('0x2c')](_0x32602d,function(_0x3ab36b){if(_0x3ab36b[_0x3edd('0x41')]!==_0x3edd('0x42')){var _0x4fe876={};_0x4fe876[_0x3ab36b[_0x3edd('0x29')]]={'$like':'%'+_0x48f201['query'][_0x3edd('0x3f')]+'%'};return _0x4fe876;}})});}_0x43be62=_[_0x3edd('0x40')]({},_0x43be62,_0x48f201[_0x3edd('0x43')]);var _0x2c694e={'where':_0x43be62[_0x3edd('0x3d')]};return db[_0x3edd('0x2d')][_0x3edd('0x20')](_0x2c694e)['then'](function(_0x434610){_0x258f63['count']=_0x434610;if(_0x48f201[_0x3edd('0x32')][_0x3edd('0x44')]){_0x43be62[_0x3edd('0x45')]=[{'all':!![]}];}return db['SmsTransferReport'][_0x3edd('0x46')](_0x43be62);})[_0x3edd('0x27')](function(_0x187e26){_0x258f63[_0x3edd('0x47')]=_0x187e26;return _0x258f63;})[_0x3edd('0x27')](respondWithFilteredResult(_0x526ad2,_0x43be62))[_0x3edd('0x48')](handleError(_0x526ad2,null));};exports[_0x3edd('0x49')]=function(_0x3f7853,_0x28f8b9){var _0x18d3d4={'raw':!![],'where':{'id':_0x3f7853[_0x3edd('0x4a')]['id']}},_0x5ea307={};_0x5ea307[_0x3edd('0x31')]=_[_0x3edd('0x33')](db[_0x3edd('0x2d')][_0x3edd('0x2e')]);_0x5ea307[_0x3edd('0x32')]=_[_0x3edd('0x33')](_0x3f7853[_0x3edd('0x32')]);_0x5ea307[_0x3edd('0x34')]=_[_0x3edd('0x35')](_0x5ea307['model'],_0x5ea307[_0x3edd('0x32')]);_0x18d3d4[_0x3edd('0x36')]=_[_0x3edd('0x35')](_0x5ea307[_0x3edd('0x31')],qs[_0x3edd('0x37')](_0x3f7853[_0x3edd('0x32')][_0x3edd('0x37')]));_0x18d3d4[_0x3edd('0x36')]=_0x18d3d4[_0x3edd('0x36')][_0x3edd('0x38')]?_0x18d3d4['attributes']:_0x5ea307[_0x3edd('0x31')];if(_0x3f7853[_0x3edd('0x32')][_0x3edd('0x44')]){_0x18d3d4['include']=[{'all':!![]}];}_0x18d3d4=_[_0x3edd('0x40')]({},_0x18d3d4,_0x3f7853[_0x3edd('0x43')]);return db[_0x3edd('0x2d')][_0x3edd('0x4b')](_0x18d3d4)[_0x3edd('0x27')](handleEntityNotFound(_0x28f8b9,null))[_0x3edd('0x27')](respondWithResult(_0x28f8b9,null))[_0x3edd('0x48')](handleError(_0x28f8b9,null));};exports[_0x3edd('0x4c')]=function(_0x3af2ae,_0x2b8e02){return db[_0x3edd('0x2d')][_0x3edd('0x4c')](_0x3af2ae['body'],{})[_0x3edd('0x27')](respondWithResult(_0x2b8e02,0xc9))['catch'](handleError(_0x2b8e02,null));};exports[_0x3edd('0x26')]=function(_0xfea46b,_0x35deb6){if(_0xfea46b[_0x3edd('0x4d')]['id']){delete _0xfea46b['body']['id'];}return db[_0x3edd('0x2d')]['find']({'where':{'id':_0xfea46b[_0x3edd('0x4a')]['id']}})[_0x3edd('0x27')](handleEntityNotFound(_0x35deb6,null))['then'](saveUpdates(_0xfea46b[_0x3edd('0x4d')],null))['then'](respondWithResult(_0x35deb6,null))[_0x3edd('0x48')](handleError(_0x35deb6,null));};exports[_0x3edd('0x28')]=function(_0x4743d7,_0x57335){return db[_0x3edd('0x2d')]['find']({'where':{'id':_0x4743d7[_0x3edd('0x4a')]['id']}})[_0x3edd('0x27')](handleEntityNotFound(_0x57335,null))[_0x3edd('0x27')](removeEntity(_0x57335,null))['catch'](handleError(_0x57335,null));};exports['describe']=function(_0x2e68f4,_0x1cdac0){return db[_0x3edd('0x2d')][_0x3edd('0x4e')]()['then'](respondWithResult(_0x1cdac0,null))[_0x3edd('0x48')](handleError(_0x1cdac0,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 05e4229..3e80d02 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 _0x155d=['exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x277190,_0x38dea5){var _0x21992c=function(_0x2114cf){while(--_0x2114cf){_0x277190['push'](_0x277190['shift']());}};_0x21992c(++_0x38dea5);}(_0x155d,0x89));var _0xd155=function(_0x14fad0,_0x278d75){_0x14fad0=_0x14fad0-0x0;var _0x5c665f=_0x155d[_0x14fad0];return _0x5c665f;};'use strict';var _=require(_0xd155('0x0'));var util=require(_0xd155('0x1'));var logger=require(_0xd155('0x2'))(_0xd155('0x3'));var moment=require('moment');var BPromise=require(_0xd155('0x4'));var rp=require(_0xd155('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsTransferReport.attributes');module[_0xd155('0x6')]=function(_0x433e8e,_0x2ec7a9){return _0x433e8e[_0xd155('0x7')](_0xd155('0x8'),attributes,{'tableName':_0xd155('0x9'),'paranoid':![],'indexes':[{'name':_0xd155('0xa'),'fields':[_0xd155('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8413=['api','moment','bluebird','request-promise','path','rimraf','./smsTransferReport.attributes','exports','define','report_sms_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x1167da,_0x369908){var _0x2df5f3=function(_0x4afc02){while(--_0x4afc02){_0x1167da['push'](_0x1167da['shift']());}};_0x2df5f3(++_0x369908);}(_0x8413,0x7b));var _0x3841=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x8413[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x3841('0x0'));var util=require(_0x3841('0x1'));var logger=require(_0x3841('0x2'))(_0x3841('0x3'));var moment=require(_0x3841('0x4'));var BPromise=require(_0x3841('0x5'));var rp=require(_0x3841('0x6'));var fs=require('fs');var path=require(_0x3841('0x7'));var rimraf=require(_0x3841('0x8'));var config=require('../../config/environment');var attributes=require(_0x3841('0x9'));module[_0x3841('0xa')]=function(_0x3cdddc,_0x41e6ab){return _0x3cdddc[_0x3841('0xb')]('SmsTransferReport',attributes,{'tableName':_0x3841('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3841('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 d7795f6..370820a 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 _0x9829=['then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request'];(function(_0x49d6be,_0x133f47){var _0x3b5550=function(_0x19da23){while(--_0x19da23){_0x49d6be['push'](_0x49d6be['shift']());}};_0x3b5550(++_0x133f47);}(_0x9829,0xc4));var _0x9982=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x9829[_0x17b6e3];return _0x3906f3;};'use strict';var _=require(_0x9982('0x0'));var util=require(_0x9982('0x1'));var moment=require(_0x9982('0x2'));var BPromise=require(_0x9982('0x3'));var rs=require(_0x9982('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9982('0x5'))['db'];var utils=require(_0x9982('0x6'));var logger=require(_0x9982('0x7'))('rpc');var config=require(_0x9982('0x8'));var jayson=require(_0x9982('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x340d62,_0x35a93f,_0x5d0824){return new BPromise(function(_0x25f30a,_0x1a3931){return client[_0x9982('0xa')](_0x340d62,_0x5d0824)[_0x9982('0xb')](function(_0x1e7881){logger[_0x9982('0xc')](_0x9982('0xd'),_0x35a93f,_0x9982('0xe'));logger[_0x9982('0xf')](_0x9982('0x10'),_0x35a93f,_0x9982('0xe'),JSON[_0x9982('0x11')](_0x1e7881));if(_0x1e7881[_0x9982('0x12')]){if(_0x1e7881[_0x9982('0x12')][_0x9982('0x13')]===0x1f4){logger[_0x9982('0x12')](_0x9982('0xd'),_0x35a93f,_0x1e7881[_0x9982('0x12')]['message']);return _0x1a3931(_0x1e7881[_0x9982('0x12')][_0x9982('0x14')]);}logger['error'](_0x9982('0xd'),_0x35a93f,_0x1e7881['error'][_0x9982('0x14')]);return _0x25f30a(_0x1e7881[_0x9982('0x12')][_0x9982('0x14')]);}else{logger[_0x9982('0xc')](_0x9982('0xd'),_0x35a93f,_0x9982('0xe'));_0x25f30a(_0x1e7881[_0x9982('0x15')][_0x9982('0x14')]);}})[_0x9982('0x16')](function(_0x50ca89){logger[_0x9982('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x35a93f,_0x50ca89);_0x1a3931(_0x50ca89);});});} \ No newline at end of file +var _0xd9c8=['http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x31ed74,_0x96d0de){var _0x260f84=function(_0x49e5f2){while(--_0x49e5f2){_0x31ed74['push'](_0x31ed74['shift']());}};_0x260f84(++_0x96d0de);}(_0xd9c8,0x15c));var _0x8d9c=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xd9c8[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0x8d9c('0x0'));var util=require(_0x8d9c('0x1'));var moment=require('moment');var BPromise=require(_0x8d9c('0x2'));var rs=require(_0x8d9c('0x3'));var fs=require('fs');var Redis=require(_0x8d9c('0x4'));var db=require(_0x8d9c('0x5'))['db'];var utils=require(_0x8d9c('0x6'));var logger=require(_0x8d9c('0x7'))(_0x8d9c('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x8d9c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ebb5a,_0x475edd,_0x49c96f){return new BPromise(function(_0x3790f6,_0x3de357){return client[_0x8d9c('0xa')](_0x1ebb5a,_0x49c96f)[_0x8d9c('0xb')](function(_0x2db4b3){logger[_0x8d9c('0xc')](_0x8d9c('0xd'),_0x475edd,_0x8d9c('0xe'));logger['debug'](_0x8d9c('0xf'),_0x475edd,'request\x20sent',JSON[_0x8d9c('0x10')](_0x2db4b3));if(_0x2db4b3['error']){if(_0x2db4b3[_0x8d9c('0x11')]['code']===0x1f4){logger['error'](_0x8d9c('0xd'),_0x475edd,_0x2db4b3['error'][_0x8d9c('0x12')]);return _0x3de357(_0x2db4b3[_0x8d9c('0x11')][_0x8d9c('0x12')]);}logger[_0x8d9c('0x11')](_0x8d9c('0xd'),_0x475edd,_0x2db4b3[_0x8d9c('0x11')][_0x8d9c('0x12')]);return _0x3790f6(_0x2db4b3[_0x8d9c('0x11')][_0x8d9c('0x12')]);}else{logger[_0x8d9c('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x475edd,_0x8d9c('0xe'));_0x3790f6(_0x2db4b3[_0x8d9c('0x13')][_0x8d9c('0x12')]);}})[_0x8d9c('0x14')](function(_0x1a071d){logger[_0x8d9c('0x11')](_0x8d9c('0xd'),_0x475edd,_0x1a071d);_0x3de357(_0x1a071d);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 09d24b4..1093f32 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 _0x9fd0=['server/files/sounds/original/','originalname','basename','extname','now','post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','/:id','show','download','diskStorage','root'];(function(_0x36c913,_0x148df8){var _0x589cfd=function(_0x1b5fd0){while(--_0x1b5fd0){_0x36c913['push'](_0x36c913['shift']());}};_0x589cfd(++_0x148df8);}(_0x9fd0,0xce));var _0x09fd=function(_0x692463,_0x2c1ebc){_0x692463=_0x692463-0x0;var _0x14dbc2=_0x9fd0[_0x692463];return _0x14dbc2;};'use strict';var multer=require(_0x09fd('0x0'));var util=require(_0x09fd('0x1'));var path=require(_0x09fd('0x2'));var timeout=require(_0x09fd('0x3'));var express=require(_0x09fd('0x4'));var router=express[_0x09fd('0x5')]();var fs_extra=require(_0x09fd('0x6'));var auth=require(_0x09fd('0x7'));var interaction=require(_0x09fd('0x8'));var config=require(_0x09fd('0x9'));var controller=require(_0x09fd('0xa'));router[_0x09fd('0xb')]('/',auth[_0x09fd('0xc')](),controller['index']);router['get'](_0x09fd('0xd'),auth[_0x09fd('0xc')](),controller[_0x09fd('0xe')]);router[_0x09fd('0xb')]('/:id/download',auth[_0x09fd('0xc')](),controller[_0x09fd('0xf')]);var upload=multer({'storage':multer[_0x09fd('0x10')]({'destination':function(_0x1c1891,_0x38f8b6,_0x1bf3c5){_0x1bf3c5(null,path['join'](config[_0x09fd('0x11')],_0x09fd('0x12')));},'filename':function(_0x4c2127,_0x1a6e92,_0x57576f){_0x1a6e92[_0x09fd('0x13')]=_0x1a6e92[_0x09fd('0x13')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x57576f(null,util['format']('%s-%s%s',path[_0x09fd('0x14')](_0x1a6e92[_0x09fd('0x13')],path[_0x09fd('0x15')](_0x1a6e92[_0x09fd('0x13')])),Date[_0x09fd('0x16')](),path[_0x09fd('0x15')](_0x1a6e92[_0x09fd('0x13')])));}})});router[_0x09fd('0x17')]('/',upload['single']('file'),controller[_0x09fd('0x18')]);router[_0x09fd('0x19')](_0x09fd('0xd'),auth[_0x09fd('0xc')](),controller['update']);router[_0x09fd('0x1a')](_0x09fd('0xd'),auth[_0x09fd('0xc')](),controller[_0x09fd('0x1a')]);module[_0x09fd('0x1b')]=router; \ No newline at end of file +var _0x64c2=['../../components/interaction/service','../../config/environment','./sound.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','diskStorage','join','root','originalname','replace','format','%s-%s%s','basename','extname','now','single','update','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x57041d,_0x3c34ad){var _0x5c5372=function(_0x248f05){while(--_0x248f05){_0x57041d['push'](_0x57041d['shift']());}};_0x5c5372(++_0x3c34ad);}(_0x64c2,0x1bc));var _0x264c=function(_0x1f6fef,_0x67f0ca){_0x1f6fef=_0x1f6fef-0x0;var _0xfbba51=_0x64c2[_0x1f6fef];return _0xfbba51;};'use strict';var multer=require(_0x264c('0x0'));var util=require(_0x264c('0x1'));var path=require('path');var timeout=require(_0x264c('0x2'));var express=require(_0x264c('0x3'));var router=express['Router']();var fs_extra=require(_0x264c('0x4'));var auth=require(_0x264c('0x5'));var interaction=require(_0x264c('0x6'));var config=require(_0x264c('0x7'));var controller=require(_0x264c('0x8'));router[_0x264c('0x9')]('/',auth['isAuthenticated'](),controller[_0x264c('0xa')]);router['get'](_0x264c('0xb'),auth[_0x264c('0xc')](),controller[_0x264c('0xd')]);router[_0x264c('0x9')](_0x264c('0xe'),auth[_0x264c('0xc')](),controller[_0x264c('0xf')]);var upload=multer({'storage':multer[_0x264c('0x10')]({'destination':function(_0x449e4d,_0x20efca,_0x5476de){_0x5476de(null,path[_0x264c('0x11')](config[_0x264c('0x12')],'server/files/sounds/original/'));},'filename':function(_0x3d6d79,_0x40ca3d,_0x1850ed){_0x40ca3d['originalname']=_0x40ca3d[_0x264c('0x13')][_0x264c('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1850ed(null,util[_0x264c('0x15')](_0x264c('0x16'),path[_0x264c('0x17')](_0x40ca3d[_0x264c('0x13')],path[_0x264c('0x18')](_0x40ca3d[_0x264c('0x13')])),Date[_0x264c('0x19')](),path[_0x264c('0x18')](_0x40ca3d[_0x264c('0x13')])));}})});router['post']('/',upload[_0x264c('0x1a')]('file'),controller['create']);router['put'](_0x264c('0xb'),auth[_0x264c('0xc')](),controller[_0x264c('0x1b')]);router[_0x264c('0x1c')](_0x264c('0xb'),auth[_0x264c('0xc')](),controller['delete']);module[_0x264c('0x1d')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 1af5a3e..2307be0 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 _0x52ad=['STRING','name','FLOAT','BIGINT','INTEGER','exports'];(function(_0x1d9864,_0x447ae3){var _0x3e12ea=function(_0xd5818e){while(--_0xd5818e){_0x1d9864['push'](_0x1d9864['shift']());}};_0x3e12ea(++_0x447ae3);}(_0x52ad,0xef));var _0xd52a=function(_0x5181d6,_0x176d8e){_0x5181d6=_0x5181d6-0x0;var _0x485c73=_0x52ad[_0x5181d6];return _0x485c73;};'use strict';var Sequelize=require('sequelize');module[_0xd52a('0x0')]={'name':{'type':Sequelize[_0xd52a('0x1')],'unique':_0xd52a('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xd52a('0x1')]},'display_name':{'type':Sequelize[_0xd52a('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xd52a('0x1')]},'original_format':{'type':Sequelize[_0xd52a('0x1')]},'original_duration':{'type':Sequelize[_0xd52a('0x3')]},'original_sampleCount':{'type':Sequelize[_0xd52a('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0xd52a('0x4')]},'original_sampleRate':{'type':Sequelize[_0xd52a('0x5')]},'converted_format':{'type':Sequelize[_0xd52a('0x1')]},'converted_duration':{'type':Sequelize[_0xd52a('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xd52a('0x4')]},'converted_channelCount':{'type':Sequelize[_0xd52a('0x5')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xd52a('0x5')]}}; \ No newline at end of file +var _0x5a14=['name','FLOAT','INTEGER','BIGINT','exports','STRING'];(function(_0x6dffbf,_0x1e97c5){var _0x41b2db=function(_0x2b2610){while(--_0x2b2610){_0x6dffbf['push'](_0x6dffbf['shift']());}};_0x41b2db(++_0x1e97c5);}(_0x5a14,0x70));var _0x45a1=function(_0x117a3c,_0x374279){_0x117a3c=_0x117a3c-0x0;var _0x54bb11=_0x5a14[_0x117a3c];return _0x54bb11;};'use strict';var Sequelize=require('sequelize');module[_0x45a1('0x0')]={'name':{'type':Sequelize[_0x45a1('0x1')],'unique':_0x45a1('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x45a1('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x45a1('0x1')]},'original_format':{'type':Sequelize[_0x45a1('0x1')]},'original_duration':{'type':Sequelize[_0x45a1('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x45a1('0x4')]},'original_bitRate':{'type':Sequelize[_0x45a1('0x5')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x45a1('0x1')]},'converted_duration':{'type':Sequelize[_0x45a1('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x45a1('0x5')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x45a1('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x45a1('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 5096c57..412cf25 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 _0xd450=['sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','Sounds','UserProfileResource','destroy','end','error','stack','name','Sound','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','length','download','find','params','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','file','basename','filename','extname','originalname','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','0777','transcode','send','src','original_duration','duration','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','chmodSync','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','start','description','delete','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x2cc569,_0x4e9568){var _0x1bfc2e=function(_0x5b8fcb){while(--_0x5b8fcb){_0x2cc569['push'](_0x2cc569['shift']());}};_0x1bfc2e(++_0x4e9568);}(_0xd450,0x176));var _0x0d45=function(_0x24a31f,_0x4e7a76){_0x24a31f=_0x24a31f-0x0;var _0x296f4a=_0xd450[_0x24a31f];return _0x296f4a;};'use strict';var emlformat=require(_0x0d45('0x0'));var rimraf=require(_0x0d45('0x1'));var zipdir=require(_0x0d45('0x2'));var jsonpatch=require(_0x0d45('0x3'));var rp=require(_0x0d45('0x4'));var moment=require(_0x0d45('0x5'));var BPromise=require(_0x0d45('0x6'));var Mustache=require(_0x0d45('0x7'));var util=require(_0x0d45('0x8'));var path=require(_0x0d45('0x9'));var sox=require(_0x0d45('0xa'));var csv=require('to-csv');var ejs=require(_0x0d45('0xb'));var fs=require('fs');var fs_extra=require(_0x0d45('0xc'));var _=require(_0x0d45('0xd'));var squel=require(_0x0d45('0xe'));var crypto=require(_0x0d45('0xf'));var jsforce=require(_0x0d45('0x10'));var deskjs=require(_0x0d45('0x11'));var toCsv=require('to-csv');var querystring=require(_0x0d45('0x12'));var Papa=require(_0x0d45('0x13'));var Redis=require('ioredis');var authService=require(_0x0d45('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x0d45('0x15'));var hardwareService=require(_0x0d45('0x16'));var logger=require(_0x0d45('0x17'))(_0x0d45('0x18'));var utils=require(_0x0d45('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0d45('0x1a'))['db'];function respondWithStatusCode(_0x41f89a,_0x4cbd62){_0x4cbd62=_0x4cbd62||0xcc;return function(_0xd3970){if(_0xd3970){return _0x41f89a[_0x0d45('0x1b')](_0x4cbd62);}return _0x41f89a[_0x0d45('0x1c')](_0x4cbd62)['end']();};}function respondWithResult(_0x126248,_0x7d638a){_0x7d638a=_0x7d638a||0xc8;return function(_0x229494){if(_0x229494){return _0x126248[_0x0d45('0x1c')](_0x7d638a)[_0x0d45('0x1d')](_0x229494);}};}function respondWithFilteredResult(_0xf784ed,_0x265b33){return function(_0x28d2f2){if(_0x28d2f2){var _0x1b5ae0=typeof _0x265b33[_0x0d45('0x1e')]===_0x0d45('0x1f')&&typeof _0x265b33[_0x0d45('0x20')]==='undefined';var _0xae8e8b=_0x28d2f2[_0x0d45('0x21')];var _0x3f54d1=_0x1b5ae0?0x0:_0x265b33[_0x0d45('0x1e')];var _0x1c9049=_0x1b5ae0?_0x28d2f2['count']:_0x265b33[_0x0d45('0x1e')]+_0x265b33[_0x0d45('0x20')];var _0x28f3b7;if(_0x1c9049>=_0xae8e8b){_0x1c9049=_0xae8e8b;_0x28f3b7=0xc8;}else{_0x28f3b7=0xce;}_0xf784ed[_0x0d45('0x1c')](_0x28f3b7);return _0xf784ed[_0x0d45('0x22')](_0x0d45('0x23'),_0x3f54d1+'-'+_0x1c9049+'/'+_0xae8e8b)[_0x0d45('0x1d')](_0x28d2f2);}return null;};}function patchUpdates(_0x2c8065){return function(_0x382a54){try{jsonpatch[_0x0d45('0x24')](_0x382a54,_0x2c8065,!![]);}catch(_0x34b569){return BPromise[_0x0d45('0x25')](_0x34b569);}return _0x382a54['save']();};}function saveUpdates(_0x40e9e6,_0x5f3d1b){return function(_0x2b6c69){if(_0x2b6c69){return _0x2b6c69[_0x0d45('0x26')](_0x40e9e6)[_0x0d45('0x27')](function(_0xb91718){return _0xb91718;});}return null;};}function removeEntity(_0x3f3327,_0x4bf64c){return function(_0x29acb0){if(_0x29acb0){return _0x29acb0['destroy']()['then'](function(){var _0x30bfaf=_0x29acb0[_0x0d45('0x28')]({'plain':!![]});var _0x410db7=_0x0d45('0x29');return db[_0x0d45('0x2a')][_0x0d45('0x2b')]({'where':{'type':_0x410db7,'resourceId':_0x30bfaf['id']}})['then'](function(){return _0x29acb0;});})[_0x0d45('0x27')](function(){_0x3f3327[_0x0d45('0x1c')](0xcc)[_0x0d45('0x2c')]();});}};}function handleEntityNotFound(_0x2a0c53,_0x43e85b){return function(_0x841d5a){if(!_0x841d5a){_0x2a0c53[_0x0d45('0x1b')](0x194);}return _0x841d5a;};}function handleError(_0x2025b6,_0xd0d3a1){_0xd0d3a1=_0xd0d3a1||0x1f4;return function(_0x585ead){logger[_0x0d45('0x2d')](_0x585ead[_0x0d45('0x2e')]);if(_0x585ead[_0x0d45('0x2f')]){delete _0x585ead[_0x0d45('0x2f')];}_0x2025b6['status'](_0xd0d3a1)['send'](_0x585ead);};}exports['index']=function(_0x28f061,_0x2c8c1c){var _0x4dd195={},_0x3961ee={},_0x1a54b0={'count':0x0,'rows':[]};var _0x40ff42=_['map'](db[_0x0d45('0x30')]['rawAttributes'],function(_0x4b716f){return{'name':_0x4b716f[_0x0d45('0x31')],'type':_0x4b716f[_0x0d45('0x32')][_0x0d45('0x33')]};});_0x3961ee[_0x0d45('0x34')]=_[_0x0d45('0x35')](_0x40ff42,'name');_0x3961ee[_0x0d45('0x36')]=_[_0x0d45('0x37')](_0x28f061[_0x0d45('0x36')]);_0x3961ee[_0x0d45('0x38')]=_[_0x0d45('0x39')](_0x3961ee[_0x0d45('0x34')],_0x3961ee[_0x0d45('0x36')]);_0x4dd195[_0x0d45('0x3a')]=_[_0x0d45('0x39')](_0x3961ee[_0x0d45('0x34')],qs[_0x0d45('0x3b')](_0x28f061[_0x0d45('0x36')][_0x0d45('0x3b')]));_0x4dd195[_0x0d45('0x3a')]=_0x4dd195[_0x0d45('0x3a')]['length']?_0x4dd195['attributes']:_0x3961ee['model'];if(!_0x28f061[_0x0d45('0x36')][_0x0d45('0x3c')](_0x0d45('0x3d'))){_0x4dd195[_0x0d45('0x20')]=qs[_0x0d45('0x20')](_0x28f061[_0x0d45('0x36')][_0x0d45('0x20')]);_0x4dd195[_0x0d45('0x1e')]=qs[_0x0d45('0x1e')](_0x28f061['query'][_0x0d45('0x1e')]);}_0x4dd195['order']=qs[_0x0d45('0x3e')](_0x28f061['query']['sort']);_0x4dd195[_0x0d45('0x3f')]=qs[_0x0d45('0x38')](_[_0x0d45('0x40')](_0x28f061[_0x0d45('0x36')],_0x3961ee[_0x0d45('0x38')]),_0x40ff42);if(_0x28f061[_0x0d45('0x36')][_0x0d45('0x41')]){_0x4dd195['where']=_[_0x0d45('0x42')](_0x4dd195[_0x0d45('0x3f')],{'$or':_[_0x0d45('0x35')](_0x40ff42,function(_0x3efa0b){if(_0x3efa0b['type']!==_0x0d45('0x43')){var _0x1a2eb5={};_0x1a2eb5[_0x3efa0b[_0x0d45('0x2f')]]={'$like':'%'+_0x28f061[_0x0d45('0x36')][_0x0d45('0x41')]+'%'};return _0x1a2eb5;}})});}_0x4dd195=_[_0x0d45('0x42')]({},_0x4dd195,_0x28f061[_0x0d45('0x44')]);var _0x574fe8={'where':_0x4dd195[_0x0d45('0x3f')]};return db['Sound'][_0x0d45('0x21')](_0x574fe8)['then'](function(_0x22a021){_0x1a54b0['count']=_0x22a021;if(_0x28f061[_0x0d45('0x36')]['includeAll']){_0x4dd195[_0x0d45('0x45')]=[{'all':!![]}];}return db[_0x0d45('0x30')][_0x0d45('0x46')](_0x4dd195);})['then'](function(_0x193e22){_0x1a54b0[_0x0d45('0x47')]=_0x193e22;return _0x1a54b0;})['then'](respondWithFilteredResult(_0x2c8c1c,_0x4dd195))[_0x0d45('0x48')](handleError(_0x2c8c1c,null));};exports[_0x0d45('0x49')]=function(_0x1c0e4a,_0x1a911f){var _0xd91729={'raw':!![],'where':{'id':_0x1c0e4a['params']['id']}},_0x24c9ca={};_0x24c9ca[_0x0d45('0x34')]=_[_0x0d45('0x37')](db[_0x0d45('0x30')][_0x0d45('0x4a')]);_0x24c9ca['query']=_[_0x0d45('0x37')](_0x1c0e4a[_0x0d45('0x36')]);_0x24c9ca['filters']=_[_0x0d45('0x39')](_0x24c9ca[_0x0d45('0x34')],_0x24c9ca[_0x0d45('0x36')]);_0xd91729[_0x0d45('0x3a')]=_['intersection'](_0x24c9ca[_0x0d45('0x34')],qs[_0x0d45('0x3b')](_0x1c0e4a[_0x0d45('0x36')][_0x0d45('0x3b')]));_0xd91729['attributes']=_0xd91729['attributes'][_0x0d45('0x4b')]?_0xd91729[_0x0d45('0x3a')]:_0x24c9ca[_0x0d45('0x34')];if(_0x1c0e4a['query']['includeAll']){_0xd91729[_0x0d45('0x45')]=[{'all':!![]}];}_0xd91729=_[_0x0d45('0x42')]({},_0xd91729,_0x1c0e4a['options']);return db[_0x0d45('0x30')]['find'](_0xd91729)[_0x0d45('0x27')](handleEntityNotFound(_0x1a911f,null))[_0x0d45('0x27')](respondWithResult(_0x1a911f,null))[_0x0d45('0x48')](handleError(_0x1a911f,null));};exports[_0x0d45('0x4c')]=function(_0x31ff51,_0x55ef34,_0x555279){return db[_0x0d45('0x30')][_0x0d45('0x4d')]({'where':{'id':_0x31ff51[_0x0d45('0x4e')]['id']},'attributes':['name',_0x0d45('0x4f'),_0x0d45('0x50')],'raw':!![]})[_0x0d45('0x27')](handleEntityNotFound(_0x55ef34,null))[_0x0d45('0x27')](function(_0x15b382){if(_0x15b382){if(!fs[_0x0d45('0x51')](path[_0x0d45('0x52')](config[_0x0d45('0x53')],_0x0d45('0x54'),_0x15b382['save_name']+'.'+_0x15b382[_0x0d45('0x50')]))){throw new db[(_0x0d45('0x55'))][(_0x0d45('0x56'))](_0x0d45('0x57'));}return _0x55ef34['download'](path[_0x0d45('0x52')](config[_0x0d45('0x53')],_0x0d45('0x54'),util[_0x0d45('0x58')](_0x0d45('0x59'),_0x15b382[_0x0d45('0x4f')],_0x15b382[_0x0d45('0x50')])),util[_0x0d45('0x58')](_0x0d45('0x59'),_0x15b382['name'],_0x15b382[_0x0d45('0x50')]));}return null;})[_0x0d45('0x48')](handleError(_0x55ef34,null));};exports['create']=function(_0x542748,_0x4c549e,_0x17738e){var _0x4e37e7={'name':path['basename'](_0x542748[_0x0d45('0x5a')]['originalname'],path['extname'](_0x542748[_0x0d45('0x5a')]['originalname'])),'save_name':path[_0x0d45('0x5b')](_0x542748[_0x0d45('0x5a')][_0x0d45('0x5c')],path[_0x0d45('0x5d')](_0x542748[_0x0d45('0x5a')]['filename'])),'original_format':path[_0x0d45('0x5d')](_0x542748[_0x0d45('0x5a')][_0x0d45('0x5e')])['substring'](0x1),'converted_format':_0x0d45('0x5f')};var _0x201415=path[_0x0d45('0x52')](config[_0x0d45('0x53')],_0x0d45('0x60'),_0x542748[_0x0d45('0x5a')][_0x0d45('0x5c')]);var _0x15c314=path[_0x0d45('0x52')](config['root'],_0x0d45('0x54'),util[_0x0d45('0x58')]('%s.%s',path['basename'](_0x542748['file'][_0x0d45('0x5c')],path[_0x0d45('0x5d')](_0x542748[_0x0d45('0x5a')][_0x0d45('0x5c')])),_0x4e37e7['converted_format']));logger[_0x0d45('0x61')](_0x0d45('0x62'),_0x201415);logger[_0x0d45('0x61')]('Sound\x20upload\x20destination:\x20%s',_0x15c314);try{fs['chmodSync'](_0x201415,parseInt(_0x0d45('0x63'),0x8));var _0x495460=sox[_0x0d45('0x64')](_0x201415,_0x15c314,{'sampleRate':0x1f40,'format':_0x0d45('0x5f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x495460['on'](_0x0d45('0x2d'),function(_0x247689){fs['unlinkSync'](_0x201415);_0x4c549e[_0x0d45('0x1c')](0x1f4)[_0x0d45('0x65')](_0x247689);});_0x495460['on'](_0x0d45('0x66'),function(_0x44c5b3){_0x4e37e7[_0x0d45('0x67')]=isNaN(_0x44c5b3[_0x0d45('0x68')])?null:_0x44c5b3[_0x0d45('0x68')]*0x3e8;_0x4e37e7['original_sampleCount']=isNaN(_0x44c5b3[_0x0d45('0x69')])?null:_0x44c5b3[_0x0d45('0x69')];_0x4e37e7['original_channelCount']=isNaN(_0x44c5b3[_0x0d45('0x6a')])?null:_0x44c5b3[_0x0d45('0x6a')];_0x4e37e7[_0x0d45('0x6b')]=isNaN(_0x44c5b3[_0x0d45('0x6c')])?null:_0x44c5b3[_0x0d45('0x6c')];_0x4e37e7[_0x0d45('0x6d')]=isNaN(_0x44c5b3[_0x0d45('0x6e')])?null:_0x44c5b3['sampleRate'];});_0x495460['on'](_0x0d45('0x6f'),function(_0x1d6d46){_0x4e37e7['converted_duration']=isNaN(_0x1d6d46[_0x0d45('0x68')])?null:_0x1d6d46[_0x0d45('0x68')]*0x3e8;_0x4e37e7[_0x0d45('0x70')]=isNaN(_0x1d6d46['sampleCount'])?null:_0x1d6d46['sampleCount'];_0x4e37e7[_0x0d45('0x71')]=isNaN(_0x1d6d46[_0x0d45('0x6a')])?null:_0x1d6d46[_0x0d45('0x6a')];_0x4e37e7[_0x0d45('0x72')]=isNaN(_0x1d6d46[_0x0d45('0x6c')])?null:_0x1d6d46['bitRate'];_0x4e37e7[_0x0d45('0x73')]=isNaN(_0x1d6d46[_0x0d45('0x6e')])?null:_0x1d6d46['sampleRate'];});_0x495460['on'](_0x0d45('0x2c'),function(){fs[_0x0d45('0x74')](_0x15c314,parseInt(_0x0d45('0x63'),0x8));return db[_0x0d45('0x30')][_0x0d45('0x75')](_0x4e37e7)[_0x0d45('0x27')](function(_0x447568){var _0x3a9d65={'role':_0x542748[_0x0d45('0x76')][_0x0d45('0x77')],'userProfileId':_0x542748['body'][_0x0d45('0x78')]};if(!_0x3a9d65)throw new Error(_0x0d45('0x79'));if(_0x3a9d65[_0x0d45('0x77')]===_0x0d45('0x7a')){var _0x48128a=_0x447568['get']({'plain':!![]});return db['UserProfileSection'][_0x0d45('0x4d')]({'where':{'name':_0x0d45('0x29'),'userProfileId':_0x3a9d65[_0x0d45('0x78')]},'raw':!![]})[_0x0d45('0x27')](function(_0x35caca){if(_0x35caca&&_0x35caca[_0x0d45('0x7b')]===0x0){return db[_0x0d45('0x2a')][_0x0d45('0x75')]({'name':_0x48128a[_0x0d45('0x2f')],'resourceId':_0x48128a['id'],'type':_0x35caca[_0x0d45('0x2f')],'sectionId':_0x35caca['id']},{})[_0x0d45('0x27')](function(){return _0x447568;});}else{return _0x447568;}})['catch'](function(_0x1907ba){logger[_0x0d45('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1907ba);throw _0x1907ba;});}return _0x447568;})[_0x0d45('0x27')](respondWithResult(_0x4c549e,null))[_0x0d45('0x48')](handleError(_0x4c549e,null));});_0x495460[_0x0d45('0x7c')]();}catch(_0xd8f47b){_0x4c549e[_0x0d45('0x1c')](0x1f4)[_0x0d45('0x65')](_0xd8f47b);}};exports[_0x0d45('0x26')]=function(_0x366ecb,_0x4a0369,_0x46eb87){return db['Sound'][_0x0d45('0x4d')]({'where':{'id':_0x366ecb['params']['id']}})[_0x0d45('0x27')](handleEntityNotFound(_0x4a0369,null))[_0x0d45('0x27')](saveUpdates(_[_0x0d45('0x40')](_0x366ecb[_0x0d45('0x76')],['name',_0x0d45('0x7d')]),null))[_0x0d45('0x27')](respondWithResult(_0x4a0369,null))[_0x0d45('0x48')](handleError(_0x4a0369,null));};exports[_0x0d45('0x7e')]=function(_0x3004fd,_0x1455a5,_0x1387f3){return db[_0x0d45('0x30')][_0x0d45('0x4d')]({'where':{'id':_0x3004fd[_0x0d45('0x4e')]['id']}})[_0x0d45('0x27')](function(_0x51b6a5){if(_0x51b6a5){return _0x51b6a5['destroy']();}})['then'](function(_0x17f566){var _0x533b19=path['join'](config[_0x0d45('0x53')],_0x0d45('0x60'),util[_0x0d45('0x58')](_0x0d45('0x59'),_0x17f566['save_name'],_0x17f566['original_format']));var _0x46eeb9=path[_0x0d45('0x52')](config['root'],_0x0d45('0x54'),util[_0x0d45('0x58')](_0x0d45('0x59'),_0x17f566[_0x0d45('0x4f')],_0x17f566['converted_format']));fs[_0x0d45('0x7f')](_0x533b19);fs[_0x0d45('0x7f')](_0x46eeb9);return _0x17f566;})['then'](function(_0xd1ebe0){if(_0xd1ebe0){return _0x1455a5['status'](0xcc)['end']();}})[_0x0d45('0x27')](handleEntityNotFound(_0x1455a5,null))[_0x0d45('0x48')](handleError(_0x1455a5,null));}; \ No newline at end of file +var _0xbfc2=['root','Sequelize','ValidationError','Sound\x20not\x20found','server/files/sounds/converted','format','save_name','%s.%s','create','file','extname','originalname','basename','filename','substring','wav','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','original_duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','converted_duration','duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','chmodSync','0777','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','Sounds','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','server/files/sounds/original','original_format','unlinkSync','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','get','UserProfileResource','destroy','stack','name','send','index','Sound','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','download','converted_format','join'];(function(_0x52bc23,_0x1bcddd){var _0x5dc22a=function(_0x669e78){while(--_0x669e78){_0x52bc23['push'](_0x52bc23['shift']());}};_0x5dc22a(++_0x1bcddd);}(_0xbfc2,0xb4));var _0x2bfc=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xbfc2[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x2bfc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2bfc('0x1'));var rp=require(_0x2bfc('0x2'));var moment=require('moment');var BPromise=require(_0x2bfc('0x3'));var Mustache=require(_0x2bfc('0x4'));var util=require(_0x2bfc('0x5'));var path=require('path');var sox=require(_0x2bfc('0x6'));var csv=require(_0x2bfc('0x7'));var ejs=require(_0x2bfc('0x8'));var fs=require('fs');var fs_extra=require(_0x2bfc('0x9'));var _=require(_0x2bfc('0xa'));var squel=require('squel');var crypto=require(_0x2bfc('0xb'));var jsforce=require(_0x2bfc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2bfc('0x7'));var querystring=require(_0x2bfc('0xd'));var Papa=require(_0x2bfc('0xe'));var Redis=require(_0x2bfc('0xf'));var authService=require(_0x2bfc('0x10'));var qs=require(_0x2bfc('0x11'));var as=require(_0x2bfc('0x12'));var hardwareService=require(_0x2bfc('0x13'));var logger=require(_0x2bfc('0x14'))('api');var utils=require(_0x2bfc('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2bfc('0x16'));var db=require(_0x2bfc('0x17'))['db'];function respondWithStatusCode(_0x1ad4fd,_0x5a0e09){_0x5a0e09=_0x5a0e09||0xcc;return function(_0x9e504f){if(_0x9e504f){return _0x1ad4fd[_0x2bfc('0x18')](_0x5a0e09);}return _0x1ad4fd[_0x2bfc('0x19')](_0x5a0e09)[_0x2bfc('0x1a')]();};}function respondWithResult(_0x552690,_0x418df2){_0x418df2=_0x418df2||0xc8;return function(_0x52bbc7){if(_0x52bbc7){return _0x552690[_0x2bfc('0x19')](_0x418df2)[_0x2bfc('0x1b')](_0x52bbc7);}};}function respondWithFilteredResult(_0x3cbafe,_0x25a0a6){return function(_0x20909e){if(_0x20909e){var _0x43fcfe=typeof _0x25a0a6[_0x2bfc('0x1c')]===_0x2bfc('0x1d')&&typeof _0x25a0a6[_0x2bfc('0x1e')]===_0x2bfc('0x1d');var _0x338f33=_0x20909e[_0x2bfc('0x1f')];var _0x407cc5=_0x43fcfe?0x0:_0x25a0a6[_0x2bfc('0x1c')];var _0x52e6af=_0x43fcfe?_0x20909e[_0x2bfc('0x1f')]:_0x25a0a6[_0x2bfc('0x1c')]+_0x25a0a6[_0x2bfc('0x1e')];var _0x20338;if(_0x52e6af>=_0x338f33){_0x52e6af=_0x338f33;_0x20338=0xc8;}else{_0x20338=0xce;}_0x3cbafe[_0x2bfc('0x19')](_0x20338);return _0x3cbafe[_0x2bfc('0x20')](_0x2bfc('0x21'),_0x407cc5+'-'+_0x52e6af+'/'+_0x338f33)[_0x2bfc('0x1b')](_0x20909e);}return null;};}function patchUpdates(_0x37668a){return function(_0x2bbd24){try{jsonpatch['apply'](_0x2bbd24,_0x37668a,!![]);}catch(_0x369ce5){return BPromise['reject'](_0x369ce5);}return _0x2bbd24[_0x2bfc('0x22')]();};}function saveUpdates(_0x202e33,_0x346a4d){return function(_0x4766f0){if(_0x4766f0){return _0x4766f0[_0x2bfc('0x23')](_0x202e33)[_0x2bfc('0x24')](function(_0x1ba02d){return _0x1ba02d;});}return null;};}function removeEntity(_0x1d5520,_0x15af84){return function(_0xa26792){if(_0xa26792){return _0xa26792['destroy']()[_0x2bfc('0x24')](function(){var _0x46785d=_0xa26792[_0x2bfc('0x25')]({'plain':!![]});var _0x452739='Sounds';return db[_0x2bfc('0x26')][_0x2bfc('0x27')]({'where':{'type':_0x452739,'resourceId':_0x46785d['id']}})[_0x2bfc('0x24')](function(){return _0xa26792;});})[_0x2bfc('0x24')](function(){_0x1d5520[_0x2bfc('0x19')](0xcc)[_0x2bfc('0x1a')]();});}};}function handleEntityNotFound(_0x2a16f4,_0x37605c){return function(_0x15c83b){if(!_0x15c83b){_0x2a16f4[_0x2bfc('0x18')](0x194);}return _0x15c83b;};}function handleError(_0x2223c,_0x11467b){_0x11467b=_0x11467b||0x1f4;return function(_0x18ad1e){logger['error'](_0x18ad1e[_0x2bfc('0x28')]);if(_0x18ad1e[_0x2bfc('0x29')]){delete _0x18ad1e[_0x2bfc('0x29')];}_0x2223c[_0x2bfc('0x19')](_0x11467b)[_0x2bfc('0x2a')](_0x18ad1e);};}exports[_0x2bfc('0x2b')]=function(_0x5d36a7,_0x25c715){var _0x304f52={},_0x21eb54={},_0x211246={'count':0x0,'rows':[]};var _0x2d4150=_['map'](db[_0x2bfc('0x2c')][_0x2bfc('0x2d')],function(_0x209f18){return{'name':_0x209f18[_0x2bfc('0x2e')],'type':_0x209f18[_0x2bfc('0x2f')][_0x2bfc('0x30')]};});_0x21eb54['model']=_[_0x2bfc('0x31')](_0x2d4150,'name');_0x21eb54[_0x2bfc('0x32')]=_[_0x2bfc('0x33')](_0x5d36a7[_0x2bfc('0x32')]);_0x21eb54[_0x2bfc('0x34')]=_[_0x2bfc('0x35')](_0x21eb54['model'],_0x21eb54[_0x2bfc('0x32')]);_0x304f52[_0x2bfc('0x36')]=_[_0x2bfc('0x35')](_0x21eb54[_0x2bfc('0x37')],qs['fields'](_0x5d36a7[_0x2bfc('0x32')][_0x2bfc('0x38')]));_0x304f52[_0x2bfc('0x36')]=_0x304f52['attributes']['length']?_0x304f52[_0x2bfc('0x36')]:_0x21eb54[_0x2bfc('0x37')];if(!_0x5d36a7[_0x2bfc('0x32')][_0x2bfc('0x39')](_0x2bfc('0x3a'))){_0x304f52[_0x2bfc('0x1e')]=qs[_0x2bfc('0x1e')](_0x5d36a7['query'][_0x2bfc('0x1e')]);_0x304f52[_0x2bfc('0x1c')]=qs[_0x2bfc('0x1c')](_0x5d36a7[_0x2bfc('0x32')][_0x2bfc('0x1c')]);}_0x304f52[_0x2bfc('0x3b')]=qs[_0x2bfc('0x3c')](_0x5d36a7['query']['sort']);_0x304f52[_0x2bfc('0x3d')]=qs['filters'](_[_0x2bfc('0x3e')](_0x5d36a7[_0x2bfc('0x32')],_0x21eb54[_0x2bfc('0x34')]),_0x2d4150);if(_0x5d36a7[_0x2bfc('0x32')][_0x2bfc('0x3f')]){_0x304f52[_0x2bfc('0x3d')]=_[_0x2bfc('0x40')](_0x304f52[_0x2bfc('0x3d')],{'$or':_[_0x2bfc('0x31')](_0x2d4150,function(_0x51e496){if(_0x51e496[_0x2bfc('0x2f')]!==_0x2bfc('0x41')){var _0x4a95d5={};_0x4a95d5[_0x51e496[_0x2bfc('0x29')]]={'$like':'%'+_0x5d36a7[_0x2bfc('0x32')]['filter']+'%'};return _0x4a95d5;}})});}_0x304f52=_['merge']({},_0x304f52,_0x5d36a7[_0x2bfc('0x42')]);var _0x30c696={'where':_0x304f52['where']};return db['Sound'][_0x2bfc('0x1f')](_0x30c696)[_0x2bfc('0x24')](function(_0x1d347f){_0x211246['count']=_0x1d347f;if(_0x5d36a7['query'][_0x2bfc('0x43')]){_0x304f52[_0x2bfc('0x44')]=[{'all':!![]}];}return db[_0x2bfc('0x2c')][_0x2bfc('0x45')](_0x304f52);})[_0x2bfc('0x24')](function(_0x185cad){_0x211246[_0x2bfc('0x46')]=_0x185cad;return _0x211246;})[_0x2bfc('0x24')](respondWithFilteredResult(_0x25c715,_0x304f52))[_0x2bfc('0x47')](handleError(_0x25c715,null));};exports[_0x2bfc('0x48')]=function(_0x317676,_0x2bc248){var _0x9debef={'raw':!![],'where':{'id':_0x317676[_0x2bfc('0x49')]['id']}},_0x26cf14={};_0x26cf14[_0x2bfc('0x37')]=_[_0x2bfc('0x33')](db[_0x2bfc('0x2c')][_0x2bfc('0x2d')]);_0x26cf14[_0x2bfc('0x32')]=_[_0x2bfc('0x33')](_0x317676[_0x2bfc('0x32')]);_0x26cf14['filters']=_[_0x2bfc('0x35')](_0x26cf14[_0x2bfc('0x37')],_0x26cf14[_0x2bfc('0x32')]);_0x9debef['attributes']=_['intersection'](_0x26cf14[_0x2bfc('0x37')],qs[_0x2bfc('0x38')](_0x317676['query']['fields']));_0x9debef[_0x2bfc('0x36')]=_0x9debef[_0x2bfc('0x36')][_0x2bfc('0x4a')]?_0x9debef[_0x2bfc('0x36')]:_0x26cf14[_0x2bfc('0x37')];if(_0x317676[_0x2bfc('0x32')][_0x2bfc('0x43')]){_0x9debef['include']=[{'all':!![]}];}_0x9debef=_[_0x2bfc('0x40')]({},_0x9debef,_0x317676[_0x2bfc('0x42')]);return db['Sound']['find'](_0x9debef)['then'](handleEntityNotFound(_0x2bc248,null))[_0x2bfc('0x24')](respondWithResult(_0x2bc248,null))[_0x2bfc('0x47')](handleError(_0x2bc248,null));};exports[_0x2bfc('0x4b')]=function(_0x3564b1,_0x25fbdc,_0x39cc96){return db[_0x2bfc('0x2c')]['find']({'where':{'id':_0x3564b1['params']['id']},'attributes':['name','save_name',_0x2bfc('0x4c')],'raw':!![]})[_0x2bfc('0x24')](handleEntityNotFound(_0x25fbdc,null))['then'](function(_0x2bee43){if(_0x2bee43){if(!fs['existsSync'](path[_0x2bfc('0x4d')](config[_0x2bfc('0x4e')],'server/files/sounds/converted',_0x2bee43['save_name']+'.'+_0x2bee43['converted_format']))){throw new db[(_0x2bfc('0x4f'))][(_0x2bfc('0x50'))](_0x2bfc('0x51'));}return _0x25fbdc[_0x2bfc('0x4b')](path[_0x2bfc('0x4d')](config[_0x2bfc('0x4e')],_0x2bfc('0x52'),util[_0x2bfc('0x53')]('%s.%s',_0x2bee43[_0x2bfc('0x54')],_0x2bee43['converted_format'])),util['format'](_0x2bfc('0x55'),_0x2bee43[_0x2bfc('0x29')],_0x2bee43['converted_format']));}return null;})[_0x2bfc('0x47')](handleError(_0x25fbdc,null));};exports[_0x2bfc('0x56')]=function(_0x258193,_0x49dba0,_0x3a979a){var _0x4acae6={'name':path['basename'](_0x258193[_0x2bfc('0x57')]['originalname'],path[_0x2bfc('0x58')](_0x258193[_0x2bfc('0x57')][_0x2bfc('0x59')])),'save_name':path[_0x2bfc('0x5a')](_0x258193['file'][_0x2bfc('0x5b')],path[_0x2bfc('0x58')](_0x258193[_0x2bfc('0x57')][_0x2bfc('0x5b')])),'original_format':path['extname'](_0x258193[_0x2bfc('0x57')][_0x2bfc('0x59')])[_0x2bfc('0x5c')](0x1),'converted_format':_0x2bfc('0x5d')};var _0x4b95b3=path['join'](config[_0x2bfc('0x4e')],'server/files/sounds/original',_0x258193[_0x2bfc('0x57')][_0x2bfc('0x5b')]);var _0x59ec77=path[_0x2bfc('0x4d')](config['root'],_0x2bfc('0x52'),util[_0x2bfc('0x53')](_0x2bfc('0x55'),path[_0x2bfc('0x5a')](_0x258193['file']['filename'],path[_0x2bfc('0x58')](_0x258193[_0x2bfc('0x57')]['filename'])),_0x4acae6[_0x2bfc('0x4c')]));logger[_0x2bfc('0x5e')](_0x2bfc('0x5f'),_0x4b95b3);logger['info'](_0x2bfc('0x60'),_0x59ec77);try{fs['chmodSync'](_0x4b95b3,parseInt('0777',0x8));var _0x399d2c=sox['transcode'](_0x4b95b3,_0x59ec77,{'sampleRate':0x1f40,'format':_0x2bfc('0x5d'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x399d2c['on']('error',function(_0x20f383){fs['unlinkSync'](_0x4b95b3);_0x49dba0[_0x2bfc('0x19')](0x1f4)[_0x2bfc('0x2a')](_0x20f383);});_0x399d2c['on']('src',function(_0x1632ba){_0x4acae6[_0x2bfc('0x61')]=isNaN(_0x1632ba['duration'])?null:_0x1632ba['duration']*0x3e8;_0x4acae6[_0x2bfc('0x62')]=isNaN(_0x1632ba[_0x2bfc('0x63')])?null:_0x1632ba[_0x2bfc('0x63')];_0x4acae6[_0x2bfc('0x64')]=isNaN(_0x1632ba[_0x2bfc('0x65')])?null:_0x1632ba[_0x2bfc('0x65')];_0x4acae6[_0x2bfc('0x66')]=isNaN(_0x1632ba[_0x2bfc('0x67')])?null:_0x1632ba[_0x2bfc('0x67')];_0x4acae6['original_sampleRate']=isNaN(_0x1632ba[_0x2bfc('0x68')])?null:_0x1632ba[_0x2bfc('0x68')];});_0x399d2c['on']('dest',function(_0x56fe37){_0x4acae6[_0x2bfc('0x69')]=isNaN(_0x56fe37[_0x2bfc('0x6a')])?null:_0x56fe37[_0x2bfc('0x6a')]*0x3e8;_0x4acae6[_0x2bfc('0x6b')]=isNaN(_0x56fe37[_0x2bfc('0x63')])?null:_0x56fe37[_0x2bfc('0x63')];_0x4acae6[_0x2bfc('0x6c')]=isNaN(_0x56fe37[_0x2bfc('0x65')])?null:_0x56fe37[_0x2bfc('0x65')];_0x4acae6[_0x2bfc('0x6d')]=isNaN(_0x56fe37[_0x2bfc('0x67')])?null:_0x56fe37[_0x2bfc('0x67')];_0x4acae6[_0x2bfc('0x6e')]=isNaN(_0x56fe37[_0x2bfc('0x68')])?null:_0x56fe37[_0x2bfc('0x68')];});_0x399d2c['on'](_0x2bfc('0x1a'),function(){fs[_0x2bfc('0x6f')](_0x59ec77,parseInt(_0x2bfc('0x70'),0x8));return db[_0x2bfc('0x2c')]['create'](_0x4acae6)[_0x2bfc('0x24')](function(_0x5c2c6a){var _0x1a3bb6={'role':_0x258193[_0x2bfc('0x71')][_0x2bfc('0x72')],'userProfileId':_0x258193[_0x2bfc('0x71')][_0x2bfc('0x73')]};if(!_0x1a3bb6)throw new Error(_0x2bfc('0x74'));if(_0x1a3bb6[_0x2bfc('0x72')]===_0x2bfc('0x75')){var _0x1c4564=_0x5c2c6a[_0x2bfc('0x25')]({'plain':!![]});return db[_0x2bfc('0x76')][_0x2bfc('0x77')]({'where':{'name':_0x2bfc('0x78'),'userProfileId':_0x1a3bb6['userProfileId']},'raw':!![]})['then'](function(_0xb563ea){if(_0xb563ea&&_0xb563ea[_0x2bfc('0x79')]===0x0){return db[_0x2bfc('0x26')][_0x2bfc('0x56')]({'name':_0x1c4564[_0x2bfc('0x29')],'resourceId':_0x1c4564['id'],'type':_0xb563ea[_0x2bfc('0x29')],'sectionId':_0xb563ea['id']},{})[_0x2bfc('0x24')](function(){return _0x5c2c6a;});}else{return _0x5c2c6a;}})[_0x2bfc('0x47')](function(_0x4db2ef){logger[_0x2bfc('0x7a')](_0x2bfc('0x7b'),_0x4db2ef);throw _0x4db2ef;});}return _0x5c2c6a;})[_0x2bfc('0x24')](respondWithResult(_0x49dba0,null))['catch'](handleError(_0x49dba0,null));});_0x399d2c[_0x2bfc('0x7c')]();}catch(_0x584b9c){_0x49dba0[_0x2bfc('0x19')](0x1f4)[_0x2bfc('0x2a')](_0x584b9c);}};exports[_0x2bfc('0x23')]=function(_0xc493a3,_0x5bc451,_0x322010){return db['Sound']['find']({'where':{'id':_0xc493a3[_0x2bfc('0x49')]['id']}})['then'](handleEntityNotFound(_0x5bc451,null))[_0x2bfc('0x24')](saveUpdates(_[_0x2bfc('0x3e')](_0xc493a3['body'],['name','description']),null))[_0x2bfc('0x24')](respondWithResult(_0x5bc451,null))[_0x2bfc('0x47')](handleError(_0x5bc451,null));};exports[_0x2bfc('0x7d')]=function(_0x5f3125,_0x35ff9b,_0x5112d6){return db['Sound'][_0x2bfc('0x77')]({'where':{'id':_0x5f3125[_0x2bfc('0x49')]['id']}})[_0x2bfc('0x24')](function(_0x5691d9){if(_0x5691d9){return _0x5691d9['destroy']();}})[_0x2bfc('0x24')](function(_0x3a86a3){var _0xa5c505=path[_0x2bfc('0x4d')](config[_0x2bfc('0x4e')],_0x2bfc('0x7e'),util[_0x2bfc('0x53')]('%s.%s',_0x3a86a3[_0x2bfc('0x54')],_0x3a86a3[_0x2bfc('0x7f')]));var _0x180151=path[_0x2bfc('0x4d')](config[_0x2bfc('0x4e')],_0x2bfc('0x52'),util[_0x2bfc('0x53')]('%s.%s',_0x3a86a3[_0x2bfc('0x54')],_0x3a86a3['converted_format']));fs[_0x2bfc('0x80')](_0xa5c505);fs[_0x2bfc('0x80')](_0x180151);return _0x3a86a3;})[_0x2bfc('0x24')](function(_0x768aa8){if(_0x768aa8){return _0x35ff9b[_0x2bfc('0x19')](0xcc)[_0x2bfc('0x1a')]();}})[_0x2bfc('0x24')](handleEntityNotFound(_0x35ff9b,null))['catch'](handleError(_0x35ff9b,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 2bca89b..76a4612 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 _0xcb84=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','define','Sound','tools_sounds','util','api'];(function(_0x195983,_0x9845c1){var _0xc77367=function(_0x23cea4){while(--_0x23cea4){_0x195983['push'](_0x195983['shift']());}};_0xc77367(++_0x9845c1);}(_0xcb84,0x1ea));var _0x4cb8=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xcb84[_0x1c546c];return _0x2cc384;};'use strict';var _=require('lodash');var util=require(_0x4cb8('0x0'));var logger=require('../../config/logger')(_0x4cb8('0x1'));var moment=require(_0x4cb8('0x2'));var BPromise=require(_0x4cb8('0x3'));var rp=require(_0x4cb8('0x4'));var fs=require('fs');var path=require(_0x4cb8('0x5'));var rimraf=require(_0x4cb8('0x6'));var config=require(_0x4cb8('0x7'));var attributes=require(_0x4cb8('0x8'));module['exports']=function(_0x247705,_0x3699cc){return _0x247705[_0x4cb8('0x9')](_0x4cb8('0xa'),attributes,{'tableName':_0x4cb8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3641=['../../config/logger','api','moment','path','rimraf','../../config/environment','./sound.attributes','tools_sounds','util'];(function(_0x16b1a5,_0x318267){var _0x475e25=function(_0x2e3bf6){while(--_0x2e3bf6){_0x16b1a5['push'](_0x16b1a5['shift']());}};_0x475e25(++_0x318267);}(_0x3641,0x1ee));var _0x1364=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3641[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x1364('0x0'));var logger=require(_0x1364('0x1'))(_0x1364('0x2'));var moment=require(_0x1364('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1364('0x4'));var rimraf=require(_0x1364('0x5'));var config=require(_0x1364('0x6'));var attributes=require(_0x1364('0x7'));module['exports']=function(_0x12e1b6,_0x4f5cd6){return _0x12e1b6['define']('Sound',attributes,{'tableName':_0x1364('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 5f07aca..2a349aa 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 _0x5417=['http','request','then','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','ShowSound','Sound','find','options','raw','attributes','include','map','model','info','debug','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x56a871,_0x18b7fe){var _0x124954=function(_0x39b7a1){while(--_0x39b7a1){_0x56a871['push'](_0x56a871['shift']());}};_0x124954(++_0x18b7fe);}(_0x5417,0x137));var _0x7541=function(_0x2c90d4,_0x5abd07){_0x2c90d4=_0x2c90d4-0x0;var _0x1cbdfc=_0x5417[_0x2c90d4];return _0x1cbdfc;};'use strict';var _=require('lodash');var util=require(_0x7541('0x0'));var moment=require(_0x7541('0x1'));var BPromise=require(_0x7541('0x2'));var rs=require(_0x7541('0x3'));var fs=require('fs');var Redis=require(_0x7541('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7541('0x5'))('rpc');var config=require(_0x7541('0x6'));var jayson=require(_0x7541('0x7'));var client=jayson[_0x7541('0x8')][_0x7541('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58162b,_0xb6d109,_0xe57696){return new BPromise(function(_0x31aafc,_0x122144){return client[_0x7541('0xa')](_0x58162b,_0xe57696)[_0x7541('0xb')](function(_0x1a6bf3){logger['info'](_0x7541('0xc'),_0xb6d109,_0x7541('0xd'));logger['debug'](_0x7541('0xe'),_0xb6d109,'request\x20sent',JSON[_0x7541('0xf')](_0x1a6bf3));if(_0x1a6bf3['error']){if(_0x1a6bf3['error'][_0x7541('0x10')]===0x1f4){logger[_0x7541('0x11')](_0x7541('0xc'),_0xb6d109,_0x1a6bf3[_0x7541('0x11')][_0x7541('0x12')]);return _0x122144(_0x1a6bf3[_0x7541('0x11')]['message']);}logger[_0x7541('0x11')]('Sound,\x20%s,\x20%s',_0xb6d109,_0x1a6bf3[_0x7541('0x11')][_0x7541('0x12')]);return _0x31aafc(_0x1a6bf3[_0x7541('0x11')][_0x7541('0x12')]);}else{logger['info'](_0x7541('0xc'),_0xb6d109,_0x7541('0xd'));_0x31aafc(_0x1a6bf3[_0x7541('0x13')][_0x7541('0x12')]);}})[_0x7541('0x14')](function(_0x4ca9e8){logger['error']('Sound,\x20%s,\x20%s',_0xb6d109,_0x4ca9e8);_0x122144(_0x4ca9e8);});});}exports[_0x7541('0x15')]=function(_0x29c2f4){var _0x48d898=this;return new Promise(function(_0x4439e2,_0x26f835){return db[_0x7541('0x16')][_0x7541('0x17')]({'raw':_0x29c2f4[_0x7541('0x18')]?_0x29c2f4[_0x7541('0x18')][_0x7541('0x19')]===undefined?!![]:![]:!![],'where':_0x29c2f4[_0x7541('0x18')]?_0x29c2f4[_0x7541('0x18')]['where']||null:null,'attributes':_0x29c2f4['options']?_0x29c2f4[_0x7541('0x18')][_0x7541('0x1a')]||null:null,'include':_0x29c2f4[_0x7541('0x18')]?_0x29c2f4[_0x7541('0x18')][_0x7541('0x1b')]?_[_0x7541('0x1c')](_0x29c2f4[_0x7541('0x18')][_0x7541('0x1b')],function(_0x11fc35){return{'model':db[_0x11fc35[_0x7541('0x1d')]],'as':_0x11fc35['as'],'attributes':_0x11fc35[_0x7541('0x1a')],'include':_0x11fc35[_0x7541('0x1b')]?_['map'](_0x11fc35[_0x7541('0x1b')],function(_0x55bcd0){return{'model':db[_0x55bcd0['model']],'as':_0x55bcd0['as'],'attributes':_0x55bcd0[_0x7541('0x1a')],'include':_0x55bcd0[_0x7541('0x1b')]?_[_0x7541('0x1c')](_0x55bcd0[_0x7541('0x1b')],function(_0x1ec2d8){return{'model':db[_0x1ec2d8[_0x7541('0x1d')]],'as':_0x1ec2d8['as'],'attributes':_0x1ec2d8[_0x7541('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7541('0xb')](function(_0x3b21d9){logger[_0x7541('0x1e')](_0x7541('0x15'),_0x29c2f4);logger[_0x7541('0x1f')](_0x7541('0x15'),_0x29c2f4,JSON[_0x7541('0xf')](_0x3b21d9));_0x4439e2(_0x3b21d9);})[_0x7541('0x14')](function(_0x8ea0b0){logger[_0x7541('0x11')]('ShowSound',_0x8ea0b0['message'],_0x29c2f4);_0x26f835(_0x48d898[_0x7541('0x11')](0x1f4,_0x8ea0b0[_0x7541('0x12')]));});});}; \ No newline at end of file +var _0xb270=['jayson/promise','client','http','info','Sound,\x20%s,\x20%s','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','Sound','find','options','where','attributes','map','model','include','then','debug','ShowSound','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1881ac,_0x57ecf4){var _0x3b966e=function(_0x134036){while(--_0x134036){_0x1881ac['push'](_0x1881ac['shift']());}};_0x3b966e(++_0x57ecf4);}(_0xb270,0x1d2));var _0x0b27=function(_0x28107d,_0x2ec8b3){_0x28107d=_0x28107d-0x0;var _0x2b1cbe=_0xb270[_0x28107d];return _0x2b1cbe;};'use strict';var _=require(_0x0b27('0x0'));var util=require(_0x0b27('0x1'));var moment=require('moment');var BPromise=require(_0x0b27('0x2'));var rs=require(_0x0b27('0x3'));var fs=require('fs');var Redis=require(_0x0b27('0x4'));var db=require(_0x0b27('0x5'))['db'];var utils=require(_0x0b27('0x6'));var logger=require(_0x0b27('0x7'))(_0x0b27('0x8'));var config=require(_0x0b27('0x9'));var jayson=require(_0x0b27('0xa'));var client=jayson[_0x0b27('0xb')][_0x0b27('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5547a1,_0x379778,_0x14a79b){return new BPromise(function(_0x58a8a9,_0x4d34f9){return client['request'](_0x5547a1,_0x14a79b)['then'](function(_0x25c627){logger[_0x0b27('0xd')](_0x0b27('0xe'),_0x379778,'request\x20sent');logger['debug'](_0x0b27('0xf'),_0x379778,'request\x20sent',JSON[_0x0b27('0x10')](_0x25c627));if(_0x25c627[_0x0b27('0x11')]){if(_0x25c627[_0x0b27('0x11')][_0x0b27('0x12')]===0x1f4){logger['error'](_0x0b27('0xe'),_0x379778,_0x25c627[_0x0b27('0x11')]['message']);return _0x4d34f9(_0x25c627[_0x0b27('0x11')][_0x0b27('0x13')]);}logger[_0x0b27('0x11')](_0x0b27('0xe'),_0x379778,_0x25c627['error'][_0x0b27('0x13')]);return _0x58a8a9(_0x25c627[_0x0b27('0x11')][_0x0b27('0x13')]);}else{logger[_0x0b27('0xd')](_0x0b27('0xe'),_0x379778,_0x0b27('0x14'));_0x58a8a9(_0x25c627[_0x0b27('0x15')][_0x0b27('0x13')]);}})[_0x0b27('0x16')](function(_0x7fffb2){logger['error'](_0x0b27('0xe'),_0x379778,_0x7fffb2);_0x4d34f9(_0x7fffb2);});});}exports['ShowSound']=function(_0x3c6686){var _0x2110c2=this;return new Promise(function(_0x145d21,_0x1c6349){return db[_0x0b27('0x17')][_0x0b27('0x18')]({'raw':_0x3c6686['options']?_0x3c6686[_0x0b27('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3c6686[_0x0b27('0x19')]?_0x3c6686[_0x0b27('0x19')][_0x0b27('0x1a')]||null:null,'attributes':_0x3c6686[_0x0b27('0x19')]?_0x3c6686[_0x0b27('0x19')][_0x0b27('0x1b')]||null:null,'include':_0x3c6686['options']?_0x3c6686[_0x0b27('0x19')]['include']?_[_0x0b27('0x1c')](_0x3c6686[_0x0b27('0x19')]['include'],function(_0x1203f2){return{'model':db[_0x1203f2[_0x0b27('0x1d')]],'as':_0x1203f2['as'],'attributes':_0x1203f2[_0x0b27('0x1b')],'include':_0x1203f2[_0x0b27('0x1e')]?_[_0x0b27('0x1c')](_0x1203f2['include'],function(_0x2ed0ee){return{'model':db[_0x2ed0ee[_0x0b27('0x1d')]],'as':_0x2ed0ee['as'],'attributes':_0x2ed0ee['attributes'],'include':_0x2ed0ee[_0x0b27('0x1e')]?_['map'](_0x2ed0ee[_0x0b27('0x1e')],function(_0x364b1e){return{'model':db[_0x364b1e['model']],'as':_0x364b1e['as'],'attributes':_0x364b1e['attributes']};}):[]};}):[]};}):[]:[]})[_0x0b27('0x1f')](function(_0x42bfee){logger['info']('ShowSound',_0x3c6686);logger[_0x0b27('0x20')](_0x0b27('0x21'),_0x3c6686,JSON[_0x0b27('0x10')](_0x42bfee));_0x145d21(_0x42bfee);})[_0x0b27('0x16')](function(_0x295b79){logger[_0x0b27('0x11')](_0x0b27('0x21'),_0x295b79[_0x0b27('0x13')],_0x3c6686);_0x1c6349(_0x2110c2['error'](0x1f4,_0x295b79[_0x0b27('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index a8903d7..1908011 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(_0x38550,_0x1e36a6){var _0x556e2c=function(_0x20777a){while(--_0x20777a){_0x38550['push'](_0x38550['shift']());}};_0x556e2c(++_0x1e36a6);}(_0xda2d,0x102));var _0xdda2=function(_0x37855c,_0x48abdd){_0x37855c=_0x37855c-0x0;var _0x2cb242=_0xda2d[_0x37855c];return _0x2cb242;};'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 _0x757a=['destroy','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete'];(function(_0x5aab82,_0x27ca03){var _0x3b5272=function(_0x49a074){while(--_0x49a074){_0x5aab82['push'](_0x5aab82['shift']());}};_0x3b5272(++_0x27ca03);}(_0x757a,0xde));var _0xa757=function(_0x261763,_0x5d0e2f){_0x261763=_0x261763-0x0;var _0x2d65e8=_0x757a[_0x261763];return _0x2d65e8;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0xb')]('/',auth[_0xa757('0x9')](),controller[_0xa757('0xc')]);router['put'](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);router[_0xa757('0xf')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index f6129fe..d1ba7c3 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 _0xfaa4=['exports','TEXT','ENUM','out','STRING','sequelize'];(function(_0x5e40d2,_0x307679){var _0x3cf22a=function(_0x168f20){while(--_0x168f20){_0x5e40d2['push'](_0x5e40d2['shift']());}};_0x3cf22a(++_0x307679);}(_0xfaa4,0x71));var _0x4faa=function(_0x50f810,_0x3673a1){_0x50f810=_0x50f810-0x0;var _0x1a90dd=_0xfaa4[_0x50f810];return _0x1a90dd;};'use strict';var Sequelize=require(_0x4faa('0x0'));module[_0x4faa('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x4faa('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x4faa('0x3')]('in',_0x4faa('0x4')),'defaultValue':_0x4faa('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0x4faa('0x5')]},'providerResponse':{'type':Sequelize[_0x4faa('0x2')]}}; \ No newline at end of file +var _0x5a32=['STRING','TEXT','medium','out','exports'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x5a32,0x81));var _0x25a3=function(_0x2c00c9,_0x55436e){_0x2c00c9=_0x2c00c9-0x0;var _0x21676a=_0x5a32[_0x2c00c9];return _0x21676a;};'use strict';var Sequelize=require('sequelize');module[_0x25a3('0x0')]={'uniqueid':{'type':Sequelize[_0x25a3('0x1')]},'body':{'type':Sequelize[_0x25a3('0x2')](_0x25a3('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x25a3('0x4')),'defaultValue':_0x25a3('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0x25a3('0x1')]},'providerResponse':{'type':Sequelize[_0x25a3('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index f1e8df3..b4e7cb8 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 _0x685d=['attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','rows','params','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','destroy','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x685d,0x143));var _0xd685=function(_0x517cd4,_0x26453a){_0x517cd4=_0x517cd4-0x0;var _0x3d93b0=_0x685d[_0x517cd4];return _0x3d93b0;};'use strict';var emlformat=require(_0xd685('0x0'));var rimraf=require(_0xd685('0x1'));var zipdir=require(_0xd685('0x2'));var jsonpatch=require(_0xd685('0x3'));var rp=require(_0xd685('0x4'));var moment=require(_0xd685('0x5'));var BPromise=require(_0xd685('0x6'));var Mustache=require(_0xd685('0x7'));var util=require(_0xd685('0x8'));var path=require(_0xd685('0x9'));var sox=require(_0xd685('0xa'));var csv=require(_0xd685('0xb'));var ejs=require(_0xd685('0xc'));var fs=require('fs');var fs_extra=require(_0xd685('0xd'));var _=require(_0xd685('0xe'));var squel=require('squel');var crypto=require(_0xd685('0xf'));var jsforce=require(_0xd685('0x10'));var deskjs=require(_0xd685('0x11'));var toCsv=require('to-csv');var querystring=require(_0xd685('0x12'));var Papa=require(_0xd685('0x13'));var Redis=require(_0xd685('0x14'));var authService=require(_0xd685('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd685('0x16'))(_0xd685('0x17'));var utils=require(_0xd685('0x18'));var config=require(_0xd685('0x19'));var licenseUtil=require(_0xd685('0x1a'));var db=require(_0xd685('0x1b'))['db'];function respondWithStatusCode(_0x55b01f,_0x2360df){_0x2360df=_0x2360df||0xcc;return function(_0x3eecba){if(_0x3eecba){return _0x55b01f[_0xd685('0x1c')](_0x2360df);}return _0x55b01f[_0xd685('0x1d')](_0x2360df)[_0xd685('0x1e')]();};}function respondWithResult(_0x5134ef,_0x5a0b30){_0x5a0b30=_0x5a0b30||0xc8;return function(_0x1b07d3){if(_0x1b07d3){return _0x5134ef[_0xd685('0x1d')](_0x5a0b30)[_0xd685('0x1f')](_0x1b07d3);}};}function respondWithFilteredResult(_0x1efb06,_0x33f449){return function(_0xed1cfb){if(_0xed1cfb){var _0x42d903=typeof _0x33f449[_0xd685('0x20')]===_0xd685('0x21')&&typeof _0x33f449[_0xd685('0x22')]==='undefined';var _0x4406ab=_0xed1cfb[_0xd685('0x23')];var _0x4c1467=_0x42d903?0x0:_0x33f449[_0xd685('0x20')];var _0x3897fa=_0x42d903?_0xed1cfb[_0xd685('0x23')]:_0x33f449[_0xd685('0x20')]+_0x33f449[_0xd685('0x22')];var _0x4c43a9;if(_0x3897fa>=_0x4406ab){_0x3897fa=_0x4406ab;_0x4c43a9=0xc8;}else{_0x4c43a9=0xce;}_0x1efb06[_0xd685('0x1d')](_0x4c43a9);return _0x1efb06[_0xd685('0x24')]('Content-Range',_0x4c1467+'-'+_0x3897fa+'/'+_0x4406ab)[_0xd685('0x1f')](_0xed1cfb);}return null;};}function patchUpdates(_0x366921){return function(_0x2dcf03){try{jsonpatch['apply'](_0x2dcf03,_0x366921,!![]);}catch(_0x36321b){return BPromise[_0xd685('0x25')](_0x36321b);}return _0x2dcf03['save']();};}function saveUpdates(_0x447fb6,_0x460759){return function(_0x3d1889){if(_0x3d1889){return _0x3d1889[_0xd685('0x26')](_0x447fb6)[_0xd685('0x27')](function(_0x189ebf){return _0x189ebf;});}return null;};}function removeEntity(_0x40fbd9,_0x32a2b6){return function(_0x3de24d){if(_0x3de24d){return _0x3de24d[_0xd685('0x28')]()[_0xd685('0x27')](function(){_0x40fbd9['status'](0xcc)[_0xd685('0x1e')]();});}};}function handleEntityNotFound(_0x191693,_0x2d44f7){return function(_0x3d77fc){if(!_0x3d77fc){_0x191693[_0xd685('0x1c')](0x194);}return _0x3d77fc;};}function handleError(_0xefa1b1,_0x250ee4){_0x250ee4=_0x250ee4||0x1f4;return function(_0x2e260f){logger[_0xd685('0x29')](_0x2e260f[_0xd685('0x2a')]);if(_0x2e260f['name']){delete _0x2e260f[_0xd685('0x2b')];}_0xefa1b1[_0xd685('0x1d')](_0x250ee4)[_0xd685('0x2c')](_0x2e260f);};}exports[_0xd685('0x2d')]=function(_0x226348,_0x5db7e5){var _0x2b7a49={},_0x4e4637={},_0x3e813a={'count':0x0,'rows':[]};var _0x495e99=_[_0xd685('0x2e')](db[_0xd685('0x2f')][_0xd685('0x30')],function(_0x43b377){return{'name':_0x43b377[_0xd685('0x31')],'type':_0x43b377[_0xd685('0x32')]['key']};});_0x4e4637[_0xd685('0x33')]=_[_0xd685('0x2e')](_0x495e99,_0xd685('0x2b'));_0x4e4637[_0xd685('0x34')]=_[_0xd685('0x35')](_0x226348['query']);_0x4e4637[_0xd685('0x36')]=_[_0xd685('0x37')](_0x4e4637[_0xd685('0x33')],_0x4e4637['query']);_0x2b7a49['attributes']=_['intersection'](_0x4e4637['model'],qs['fields'](_0x226348[_0xd685('0x34')][_0xd685('0x38')]));_0x2b7a49['attributes']=_0x2b7a49[_0xd685('0x39')][_0xd685('0x3a')]?_0x2b7a49['attributes']:_0x4e4637[_0xd685('0x33')];if(!_0x226348[_0xd685('0x34')][_0xd685('0x3b')](_0xd685('0x3c'))){_0x2b7a49['limit']=qs[_0xd685('0x22')](_0x226348[_0xd685('0x34')][_0xd685('0x22')]);_0x2b7a49[_0xd685('0x20')]=qs['offset'](_0x226348['query']['offset']);}_0x2b7a49[_0xd685('0x3d')]=qs[_0xd685('0x3e')](_0x226348[_0xd685('0x34')]['sort']);_0x2b7a49['where']=qs[_0xd685('0x36')](_['pick'](_0x226348['query'],_0x4e4637['filters']),_0x495e99);if(_0x226348[_0xd685('0x34')][_0xd685('0x3f')]){_0x2b7a49[_0xd685('0x40')]=_['merge'](_0x2b7a49[_0xd685('0x40')],{'$or':_[_0xd685('0x2e')](_0x495e99,function(_0x137d85){if(_0x137d85[_0xd685('0x32')]!==_0xd685('0x41')){var _0x46d8b5={};_0x46d8b5[_0x137d85['name']]={'$like':'%'+_0x226348['query'][_0xd685('0x3f')]+'%'};return _0x46d8b5;}})});}_0x2b7a49=_[_0xd685('0x42')]({},_0x2b7a49,_0x226348[_0xd685('0x43')]);var _0x29b866={'where':_0x2b7a49[_0xd685('0x40')]};return db[_0xd685('0x2f')][_0xd685('0x23')](_0x29b866)['then'](function(_0x5d7635){_0x3e813a[_0xd685('0x23')]=_0x5d7635;if(_0x226348[_0xd685('0x34')][_0xd685('0x44')]){_0x2b7a49[_0xd685('0x45')]=[{'all':!![]}];}return db[_0xd685('0x2f')]['findAll'](_0x2b7a49);})[_0xd685('0x27')](function(_0x525359){_0x3e813a[_0xd685('0x46')]=_0x525359;return _0x3e813a;})[_0xd685('0x27')](respondWithFilteredResult(_0x5db7e5,_0x2b7a49))['catch'](handleError(_0x5db7e5,null));};exports['show']=function(_0x7187e4,_0x2c9683){var _0x2b5532={'raw':!![],'where':{'id':_0x7187e4[_0xd685('0x47')]['id']}},_0x5513b0={};_0x5513b0[_0xd685('0x33')]=_[_0xd685('0x35')](db[_0xd685('0x2f')]['rawAttributes']);_0x5513b0[_0xd685('0x34')]=_[_0xd685('0x35')](_0x7187e4[_0xd685('0x34')]);_0x5513b0['filters']=_[_0xd685('0x37')](_0x5513b0['model'],_0x5513b0[_0xd685('0x34')]);_0x2b5532[_0xd685('0x39')]=_[_0xd685('0x37')](_0x5513b0['model'],qs[_0xd685('0x38')](_0x7187e4['query'][_0xd685('0x38')]));_0x2b5532[_0xd685('0x39')]=_0x2b5532['attributes'][_0xd685('0x3a')]?_0x2b5532[_0xd685('0x39')]:_0x5513b0['model'];if(_0x7187e4[_0xd685('0x34')]['includeAll']){_0x2b5532[_0xd685('0x45')]=[{'all':!![]}];}_0x2b5532=_[_0xd685('0x42')]({},_0x2b5532,_0x7187e4[_0xd685('0x43')]);return db[_0xd685('0x2f')][_0xd685('0x48')](_0x2b5532)[_0xd685('0x27')](handleEntityNotFound(_0x2c9683,null))[_0xd685('0x27')](respondWithResult(_0x2c9683,null))[_0xd685('0x49')](handleError(_0x2c9683,null));};exports['create']=function(_0x5eb4ae,_0xd62dac){return db[_0xd685('0x2f')][_0xd685('0x4a')](_0x5eb4ae[_0xd685('0x4b')],{})[_0xd685('0x27')](respondWithResult(_0xd62dac,0xc9))[_0xd685('0x49')](handleError(_0xd62dac,null));};exports[_0xd685('0x26')]=function(_0x13570d,_0x14648c){if(_0x13570d[_0xd685('0x4b')]['id']){delete _0x13570d[_0xd685('0x4b')]['id'];}return db['SquareMessage'][_0xd685('0x48')]({'where':{'id':_0x13570d['params']['id']}})[_0xd685('0x27')](handleEntityNotFound(_0x14648c,null))[_0xd685('0x27')](saveUpdates(_0x13570d[_0xd685('0x4b')],null))[_0xd685('0x27')](respondWithResult(_0x14648c,null))[_0xd685('0x49')](handleError(_0x14648c,null));};exports[_0xd685('0x28')]=function(_0x1a36eb,_0x2d5c13){return db[_0xd685('0x2f')]['find']({'where':{'id':_0x1a36eb['params']['id']}})[_0xd685('0x27')](handleEntityNotFound(_0x2d5c13,null))[_0xd685('0x27')](removeEntity(_0x2d5c13,null))['catch'](handleError(_0x2d5c13,null));}; \ No newline at end of file +var _0x5b92=['fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','json','update','then','destroy','sendStatus','error','stack','name','send','index','SquareMessage','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','find','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs'];(function(_0x1bc762,_0x523eb3){var _0x40f70c=function(_0x3c206e){while(--_0x3c206e){_0x1bc762['push'](_0x1bc762['shift']());}};_0x40f70c(++_0x523eb3);}(_0x5b92,0x1a0));var _0x25b9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5b92[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x25b9('0x0'));var rimraf=require(_0x25b9('0x1'));var zipdir=require(_0x25b9('0x2'));var jsonpatch=require(_0x25b9('0x3'));var rp=require(_0x25b9('0x4'));var moment=require('moment');var BPromise=require(_0x25b9('0x5'));var Mustache=require(_0x25b9('0x6'));var util=require('util');var path=require(_0x25b9('0x7'));var sox=require(_0x25b9('0x8'));var csv=require('to-csv');var ejs=require(_0x25b9('0x9'));var fs=require('fs');var fs_extra=require(_0x25b9('0xa'));var _=require('lodash');var squel=require(_0x25b9('0xb'));var crypto=require(_0x25b9('0xc'));var jsforce=require(_0x25b9('0xd'));var deskjs=require(_0x25b9('0xe'));var toCsv=require(_0x25b9('0xf'));var querystring=require(_0x25b9('0x10'));var Papa=require('papaparse');var Redis=require(_0x25b9('0x11'));var authService=require(_0x25b9('0x12'));var qs=require(_0x25b9('0x13'));var as=require(_0x25b9('0x14'));var hardwareService=require(_0x25b9('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x25b9('0x16'));var config=require(_0x25b9('0x17'));var licenseUtil=require(_0x25b9('0x18'));var db=require(_0x25b9('0x19'))['db'];function respondWithStatusCode(_0x158b60,_0x294991){_0x294991=_0x294991||0xcc;return function(_0x3e3655){if(_0x3e3655){return _0x158b60['sendStatus'](_0x294991);}return _0x158b60[_0x25b9('0x1a')](_0x294991)[_0x25b9('0x1b')]();};}function respondWithResult(_0x4b1083,_0x4871ba){_0x4871ba=_0x4871ba||0xc8;return function(_0x1666e7){if(_0x1666e7){return _0x4b1083['status'](_0x4871ba)['json'](_0x1666e7);}};}function respondWithFilteredResult(_0x3ca9fe,_0x3876b3){return function(_0x45b41b){if(_0x45b41b){var _0x26758d=typeof _0x3876b3[_0x25b9('0x1c')]===_0x25b9('0x1d')&&typeof _0x3876b3[_0x25b9('0x1e')]===_0x25b9('0x1d');var _0x317a00=_0x45b41b[_0x25b9('0x1f')];var _0x3e3591=_0x26758d?0x0:_0x3876b3[_0x25b9('0x1c')];var _0x1892e6=_0x26758d?_0x45b41b[_0x25b9('0x1f')]:_0x3876b3['offset']+_0x3876b3['limit'];var _0xc5a9f6;if(_0x1892e6>=_0x317a00){_0x1892e6=_0x317a00;_0xc5a9f6=0xc8;}else{_0xc5a9f6=0xce;}_0x3ca9fe[_0x25b9('0x1a')](_0xc5a9f6);return _0x3ca9fe['set'](_0x25b9('0x20'),_0x3e3591+'-'+_0x1892e6+'/'+_0x317a00)[_0x25b9('0x21')](_0x45b41b);}return null;};}function patchUpdates(_0x3a2b86){return function(_0x5e3058){try{jsonpatch['apply'](_0x5e3058,_0x3a2b86,!![]);}catch(_0x4ae435){return BPromise['reject'](_0x4ae435);}return _0x5e3058['save']();};}function saveUpdates(_0x4a7449,_0x349140){return function(_0x37e65f){if(_0x37e65f){return _0x37e65f[_0x25b9('0x22')](_0x4a7449)[_0x25b9('0x23')](function(_0x4224e9){return _0x4224e9;});}return null;};}function removeEntity(_0x222f47,_0x46b3d1){return function(_0x136c17){if(_0x136c17){return _0x136c17[_0x25b9('0x24')]()[_0x25b9('0x23')](function(){_0x222f47[_0x25b9('0x1a')](0xcc)[_0x25b9('0x1b')]();});}};}function handleEntityNotFound(_0x326000,_0x3b8b55){return function(_0x8f5ce5){if(!_0x8f5ce5){_0x326000[_0x25b9('0x25')](0x194);}return _0x8f5ce5;};}function handleError(_0x272584,_0x210255){_0x210255=_0x210255||0x1f4;return function(_0x51d7c5){logger[_0x25b9('0x26')](_0x51d7c5[_0x25b9('0x27')]);if(_0x51d7c5[_0x25b9('0x28')]){delete _0x51d7c5[_0x25b9('0x28')];}_0x272584[_0x25b9('0x1a')](_0x210255)[_0x25b9('0x29')](_0x51d7c5);};}exports[_0x25b9('0x2a')]=function(_0x22f2a7,_0x485b6c){var _0x561615={},_0x1ba165={},_0x5ea190={'count':0x0,'rows':[]};var _0x586b2b=_['map'](db[_0x25b9('0x2b')][_0x25b9('0x2c')],function(_0x195a9c){return{'name':_0x195a9c[_0x25b9('0x2d')],'type':_0x195a9c[_0x25b9('0x2e')]['key']};});_0x1ba165[_0x25b9('0x2f')]=_[_0x25b9('0x30')](_0x586b2b,_0x25b9('0x28'));_0x1ba165[_0x25b9('0x31')]=_[_0x25b9('0x32')](_0x22f2a7[_0x25b9('0x31')]);_0x1ba165[_0x25b9('0x33')]=_[_0x25b9('0x34')](_0x1ba165[_0x25b9('0x2f')],_0x1ba165[_0x25b9('0x31')]);_0x561615['attributes']=_['intersection'](_0x1ba165[_0x25b9('0x2f')],qs[_0x25b9('0x35')](_0x22f2a7['query'][_0x25b9('0x35')]));_0x561615[_0x25b9('0x36')]=_0x561615[_0x25b9('0x36')]['length']?_0x561615['attributes']:_0x1ba165['model'];if(!_0x22f2a7[_0x25b9('0x31')][_0x25b9('0x37')](_0x25b9('0x38'))){_0x561615[_0x25b9('0x1e')]=qs[_0x25b9('0x1e')](_0x22f2a7[_0x25b9('0x31')]['limit']);_0x561615[_0x25b9('0x1c')]=qs['offset'](_0x22f2a7[_0x25b9('0x31')]['offset']);}_0x561615['order']=qs[_0x25b9('0x39')](_0x22f2a7[_0x25b9('0x31')][_0x25b9('0x39')]);_0x561615[_0x25b9('0x3a')]=qs[_0x25b9('0x33')](_[_0x25b9('0x3b')](_0x22f2a7[_0x25b9('0x31')],_0x1ba165[_0x25b9('0x33')]),_0x586b2b);if(_0x22f2a7[_0x25b9('0x31')][_0x25b9('0x3c')]){_0x561615['where']=_[_0x25b9('0x3d')](_0x561615[_0x25b9('0x3a')],{'$or':_[_0x25b9('0x30')](_0x586b2b,function(_0x4b0542){if(_0x4b0542[_0x25b9('0x2e')]!=='VIRTUAL'){var _0x214c88={};_0x214c88[_0x4b0542[_0x25b9('0x28')]]={'$like':'%'+_0x22f2a7['query']['filter']+'%'};return _0x214c88;}})});}_0x561615=_[_0x25b9('0x3d')]({},_0x561615,_0x22f2a7[_0x25b9('0x3e')]);var _0x216a87={'where':_0x561615[_0x25b9('0x3a')]};return db['SquareMessage']['count'](_0x216a87)[_0x25b9('0x23')](function(_0x5a9483){_0x5ea190[_0x25b9('0x1f')]=_0x5a9483;if(_0x22f2a7[_0x25b9('0x31')]['includeAll']){_0x561615[_0x25b9('0x3f')]=[{'all':!![]}];}return db[_0x25b9('0x2b')][_0x25b9('0x40')](_0x561615);})[_0x25b9('0x23')](function(_0xc80da4){_0x5ea190[_0x25b9('0x41')]=_0xc80da4;return _0x5ea190;})[_0x25b9('0x23')](respondWithFilteredResult(_0x485b6c,_0x561615))[_0x25b9('0x42')](handleError(_0x485b6c,null));};exports[_0x25b9('0x43')]=function(_0x98b95b,_0x5d7b1d){var _0x124ff1={'raw':!![],'where':{'id':_0x98b95b[_0x25b9('0x44')]['id']}},_0xc5ad2a={};_0xc5ad2a[_0x25b9('0x2f')]=_['keys'](db[_0x25b9('0x2b')][_0x25b9('0x2c')]);_0xc5ad2a[_0x25b9('0x31')]=_[_0x25b9('0x32')](_0x98b95b[_0x25b9('0x31')]);_0xc5ad2a[_0x25b9('0x33')]=_[_0x25b9('0x34')](_0xc5ad2a['model'],_0xc5ad2a[_0x25b9('0x31')]);_0x124ff1[_0x25b9('0x36')]=_[_0x25b9('0x34')](_0xc5ad2a['model'],qs[_0x25b9('0x35')](_0x98b95b['query'][_0x25b9('0x35')]));_0x124ff1[_0x25b9('0x36')]=_0x124ff1[_0x25b9('0x36')]['length']?_0x124ff1['attributes']:_0xc5ad2a[_0x25b9('0x2f')];if(_0x98b95b['query']['includeAll']){_0x124ff1[_0x25b9('0x3f')]=[{'all':!![]}];}_0x124ff1=_[_0x25b9('0x3d')]({},_0x124ff1,_0x98b95b[_0x25b9('0x3e')]);return db[_0x25b9('0x2b')][_0x25b9('0x45')](_0x124ff1)[_0x25b9('0x23')](handleEntityNotFound(_0x5d7b1d,null))[_0x25b9('0x23')](respondWithResult(_0x5d7b1d,null))['catch'](handleError(_0x5d7b1d,null));};exports['create']=function(_0xc0e823,_0x2e89af){return db[_0x25b9('0x2b')]['create'](_0xc0e823[_0x25b9('0x46')],{})['then'](respondWithResult(_0x2e89af,0xc9))[_0x25b9('0x42')](handleError(_0x2e89af,null));};exports[_0x25b9('0x22')]=function(_0x182f55,_0x6e2b4c){if(_0x182f55['body']['id']){delete _0x182f55[_0x25b9('0x46')]['id'];}return db[_0x25b9('0x2b')][_0x25b9('0x45')]({'where':{'id':_0x182f55[_0x25b9('0x44')]['id']}})[_0x25b9('0x23')](handleEntityNotFound(_0x6e2b4c,null))[_0x25b9('0x23')](saveUpdates(_0x182f55[_0x25b9('0x46')],null))[_0x25b9('0x23')](respondWithResult(_0x6e2b4c,null))[_0x25b9('0x42')](handleError(_0x6e2b4c,null));};exports[_0x25b9('0x24')]=function(_0x55ccfe,_0x4fdb2b){return db[_0x25b9('0x2b')][_0x25b9('0x45')]({'where':{'id':_0x55ccfe[_0x25b9('0x44')]['id']}})[_0x25b9('0x23')](handleEntityNotFound(_0x4fdb2b,null))[_0x25b9('0x23')](removeEntity(_0x4fdb2b,null))[_0x25b9('0x42')](handleError(_0x4fdb2b,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 9415dbb..0c01dea 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 _0x7c73=['request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','lodash','util','../../config/logger','moment'];(function(_0x5617e2,_0x1ffcd7){var _0x27b60d=function(_0xf3f7a2){while(--_0xf3f7a2){_0x5617e2['push'](_0x5617e2['shift']());}};_0x27b60d(++_0x1ffcd7);}(_0x7c73,0x104));var _0x37c7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7c73[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x37c7('0x0'));var util=require(_0x37c7('0x1'));var logger=require(_0x37c7('0x2'))('api');var moment=require(_0x37c7('0x3'));var BPromise=require('bluebird');var rp=require(_0x37c7('0x4'));var fs=require('fs');var path=require(_0x37c7('0x5'));var rimraf=require(_0x37c7('0x6'));var config=require(_0x37c7('0x7'));var attributes=require(_0x37c7('0x8'));module[_0x37c7('0x9')]=function(_0x18748e,_0x150d75){return _0x18748e[_0x37c7('0xa')]('SquareMessage',attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8306=['../../config/environment','exports','SquareMessage','util','api','request-promise','path'];(function(_0x20b09f,_0x52a063){var _0x182909=function(_0x8c8f19){while(--_0x8c8f19){_0x20b09f['push'](_0x20b09f['shift']());}};_0x182909(++_0x52a063);}(_0x8306,0x153));var _0x6830=function(_0x1ae30e,_0x3d3089){_0x1ae30e=_0x1ae30e-0x0;var _0x3f8cab=_0x8306[_0x1ae30e];return _0x3f8cab;};'use strict';var _=require('lodash');var util=require(_0x6830('0x0'));var logger=require('../../config/logger')(_0x6830('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6830('0x2'));var fs=require('fs');var path=require(_0x6830('0x3'));var rimraf=require('rimraf');var config=require(_0x6830('0x4'));var attributes=require('./squareMessage.attributes');module[_0x6830('0x5')]=function(_0x42d7e9,_0xf98439){return _0x42d7e9['define'](_0x6830('0x6'),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 1575f19..35fd2ee 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 _0xae8b=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','SquareMessage,\x20%s,\x20%s','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateSquareMessage','SquareMessage','create','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x205b1a,_0x14c840){var _0x1540ed=function(_0x480ec7){while(--_0x480ec7){_0x205b1a['push'](_0x205b1a['shift']());}};_0x1540ed(++_0x14c840);}(_0xae8b,0x11b));var _0xbae8=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xae8b[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xbae8('0x0'));var util=require(_0xbae8('0x1'));var moment=require(_0xbae8('0x2'));var BPromise=require(_0xbae8('0x3'));var rs=require(_0xbae8('0x4'));var fs=require('fs');var Redis=require(_0xbae8('0x5'));var db=require(_0xbae8('0x6'))['db'];var utils=require(_0xbae8('0x7'));var logger=require(_0xbae8('0x8'))(_0xbae8('0x9'));var config=require(_0xbae8('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xbae8('0xb')][_0xbae8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x6d89d2,_0x2ca6d6,_0x51b267){return new BPromise(function(_0xcb0955,_0x39cda0){return client['request'](_0x6d89d2,_0x51b267)[_0xbae8('0xd')](function(_0x43e132){logger[_0xbae8('0xe')](_0xbae8('0xf'),_0x2ca6d6,'request\x20sent');logger['debug'](_0xbae8('0x10'),_0x2ca6d6,_0xbae8('0x11'),JSON[_0xbae8('0x12')](_0x43e132));if(_0x43e132[_0xbae8('0x13')]){if(_0x43e132[_0xbae8('0x13')][_0xbae8('0x14')]===0x1f4){logger[_0xbae8('0x13')](_0xbae8('0xf'),_0x2ca6d6,_0x43e132[_0xbae8('0x13')][_0xbae8('0x15')]);return _0x39cda0(_0x43e132[_0xbae8('0x13')][_0xbae8('0x15')]);}logger[_0xbae8('0x13')](_0xbae8('0xf'),_0x2ca6d6,_0x43e132[_0xbae8('0x13')][_0xbae8('0x15')]);return _0xcb0955(_0x43e132['error']['message']);}else{logger[_0xbae8('0xe')]('SquareMessage,\x20%s,\x20%s',_0x2ca6d6,_0xbae8('0x11'));_0xcb0955(_0x43e132['result']['message']);}})[_0xbae8('0x16')](function(_0x1205f1){logger[_0xbae8('0x13')](_0xbae8('0xf'),_0x2ca6d6,_0x1205f1);_0x39cda0(_0x1205f1);});});}exports[_0xbae8('0x17')]=function(_0x2938ef){var _0x3e3fe1=this;return new Promise(function(_0x3f0dba,_0x2e3f9c){return db[_0xbae8('0x18')][_0xbae8('0x19')](_0x2938ef['body'],{'raw':_0x2938ef[_0xbae8('0x1a')]?_0x2938ef[_0xbae8('0x1a')][_0xbae8('0x1b')]===undefined?!![]:![]:!![]})[_0xbae8('0xd')](function(_0x54b8c8){logger[_0xbae8('0xe')](_0xbae8('0x17'),_0x2938ef);logger[_0xbae8('0x1c')](_0xbae8('0x17'),_0x2938ef,JSON[_0xbae8('0x12')](_0x54b8c8));_0x3f0dba(_0x54b8c8);})[_0xbae8('0x16')](function(_0x13ddea){logger[_0xbae8('0x13')](_0xbae8('0x17'),_0x13ddea[_0xbae8('0x15')],_0x2938ef);_0x2e3f9c(_0x3e3fe1[_0xbae8('0x13')](0x1f4,_0x13ddea[_0xbae8('0x15')]));});});}; \ No newline at end of file +var _0x7df8=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','SquareMessage,\x20%s,\x20%s','message','result','catch','CreateSquareMessage','create','body','options','raw','then','lodash','util','randomstring'];(function(_0x4b0d0c,_0x437378){var _0x125492=function(_0x12603a){while(--_0x12603a){_0x4b0d0c['push'](_0x4b0d0c['shift']());}};_0x125492(++_0x437378);}(_0x7df8,0x69));var _0x87df=function(_0x517f96,_0x996664){_0x517f96=_0x517f96-0x0;var _0x50c9cd=_0x7df8[_0x517f96];return _0x50c9cd;};'use strict';var _=require(_0x87df('0x0'));var util=require(_0x87df('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x87df('0x2'));var fs=require('fs');var Redis=require(_0x87df('0x3'));var db=require(_0x87df('0x4'))['db'];var utils=require(_0x87df('0x5'));var logger=require(_0x87df('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x87df('0x7'));var client=jayson[_0x87df('0x8')][_0x87df('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f1c42,_0x15a630,_0x40851a){return new BPromise(function(_0x151e69,_0x19425c){return client[_0x87df('0xa')](_0x5f1c42,_0x40851a)['then'](function(_0x549964){logger[_0x87df('0xb')]('SquareMessage,\x20%s,\x20%s',_0x15a630,_0x87df('0xc'));logger[_0x87df('0xd')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x15a630,'request\x20sent',JSON[_0x87df('0xe')](_0x549964));if(_0x549964['error']){if(_0x549964[_0x87df('0xf')][_0x87df('0x10')]===0x1f4){logger['error'](_0x87df('0x11'),_0x15a630,_0x549964[_0x87df('0xf')][_0x87df('0x12')]);return _0x19425c(_0x549964['error'][_0x87df('0x12')]);}logger[_0x87df('0xf')](_0x87df('0x11'),_0x15a630,_0x549964[_0x87df('0xf')][_0x87df('0x12')]);return _0x151e69(_0x549964['error'][_0x87df('0x12')]);}else{logger[_0x87df('0xb')](_0x87df('0x11'),_0x15a630,_0x87df('0xc'));_0x151e69(_0x549964[_0x87df('0x13')][_0x87df('0x12')]);}})[_0x87df('0x14')](function(_0x409595){logger[_0x87df('0xf')]('SquareMessage,\x20%s,\x20%s',_0x15a630,_0x409595);_0x19425c(_0x409595);});});}exports[_0x87df('0x15')]=function(_0xcb590c){var _0x55ee1b=this;return new Promise(function(_0x35819d,_0x48c06b){return db['SquareMessage'][_0x87df('0x16')](_0xcb590c[_0x87df('0x17')],{'raw':_0xcb590c[_0x87df('0x18')]?_0xcb590c[_0x87df('0x18')][_0x87df('0x19')]===undefined?!![]:![]:!![]})[_0x87df('0x1a')](function(_0x5284fd){logger['info'](_0x87df('0x15'),_0xcb590c);logger['debug'](_0x87df('0x15'),_0xcb590c,JSON['stringify'](_0x5284fd));_0x35819d(_0x5284fd);})[_0x87df('0x14')](function(_0x52e975){logger['error'](_0x87df('0x15'),_0x52e975['message'],_0xcb590c);_0x48c06b(_0x55ee1b['error'](0x1f4,_0x52e975['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 99fb189..a282826 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 _0xfd9b=['create','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','15s'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xfd9b,0x1d1));var _0xbfd9=function(_0x2c3aed,_0xa4011f){_0x2c3aed=_0x2c3aed-0x0;var _0x473dc4=_0xfd9b[_0x2c3aed];return _0x473dc4;};'use strict';var multer=require(_0xbfd9('0x0'));var util=require(_0xbfd9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbfd9('0x2'));var router=express[_0xbfd9('0x3')]();var fs_extra=require(_0xbfd9('0x4'));var auth=require(_0xbfd9('0x5'));var interaction=require(_0xbfd9('0x6'));var config=require(_0xbfd9('0x7'));var controller=require(_0xbfd9('0x8'));router[_0xbfd9('0x9')]('/',auth[_0xbfd9('0xa')](),controller[_0xbfd9('0xb')]);router[_0xbfd9('0x9')](_0xbfd9('0xc'),auth['isAuthenticated'](),controller[_0xbfd9('0xd')]);router[_0xbfd9('0x9')]('/:id/test',auth[_0xbfd9('0xa')](),timeout(_0xbfd9('0xe')),controller['test']);router['post']('/',auth[_0xbfd9('0xa')](),controller[_0xbfd9('0xf')]);router['put'](_0xbfd9('0xc'),auth[_0xbfd9('0xa')](),controller[_0xbfd9('0x10')]);router[_0xbfd9('0x11')](_0xbfd9('0xc'),auth[_0xbfd9('0xa')](),controller[_0xbfd9('0x12')]);module[_0xbfd9('0x13')]=router; \ No newline at end of file +var _0x5de3=['destroy','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated','show','15s','test','post','put','/:id','update','delete'];(function(_0x2bf641,_0x36a6c7){var _0x460419=function(_0x4461ca){while(--_0x4461ca){_0x2bf641['push'](_0x2bf641['shift']());}};_0x460419(++_0x36a6c7);}(_0x5de3,0xa3));var _0x35de=function(_0x437aac,_0x7f0a20){_0x437aac=_0x437aac-0x0;var _0x4a3ee6=_0x5de3[_0x437aac];return _0x4a3ee6;};'use strict';var multer=require(_0x35de('0x0'));var util=require(_0x35de('0x1'));var path=require(_0x35de('0x2'));var timeout=require('connect-timeout');var express=require(_0x35de('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x35de('0x4'));var interaction=require(_0x35de('0x5'));var config=require('../../config/environment');var controller=require(_0x35de('0x6'));router[_0x35de('0x7')]('/',auth[_0x35de('0x8')](),controller['index']);router[_0x35de('0x7')]('/:id',auth[_0x35de('0x8')](),controller[_0x35de('0x9')]);router[_0x35de('0x7')]('/:id/test',auth[_0x35de('0x8')](),timeout(_0x35de('0xa')),controller[_0x35de('0xb')]);router[_0x35de('0xc')]('/',auth[_0x35de('0x8')](),controller['create']);router[_0x35de('0xd')](_0x35de('0xe'),auth['isAuthenticated'](),controller[_0x35de('0xf')]);router[_0x35de('0x10')](_0x35de('0xe'),auth['isAuthenticated'](),controller[_0x35de('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index fce03be..4ee2cd8 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 _0xf913=['STRING','name','exports'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf913,0x182));var _0x3f91=function(_0x1dd70c,_0x562663){_0x1dd70c=_0x1dd70c-0x0;var _0x22259c=_0xf913[_0x1dd70c];return _0x22259c;};'use strict';var Sequelize=require('sequelize');module[_0x3f91('0x0')]={'name':{'type':Sequelize[_0x3f91('0x1')],'unique':_0x3f91('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x3f91('0x1')]},'description':{'type':Sequelize[_0x3f91('0x1')]}}; \ No newline at end of file +var _0xdb69=['sequelize','exports','STRING','name'];(function(_0x20d73e,_0x39f9ec){var _0x52e84b=function(_0x11a4ac){while(--_0x11a4ac){_0x20d73e['push'](_0x20d73e['shift']());}};_0x52e84b(++_0x39f9ec);}(_0xdb69,0x178));var _0x9db6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xdb69[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x9db6('0x0'));module[_0x9db6('0x1')]={'name':{'type':Sequelize[_0x9db6('0x2')],'unique':_0x9db6('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x9db6('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index aeba9c8..46414e6 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 _0x7188=['keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','openSync','closeSync','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','Content-Range','update','then','get','ODBC','UserProfileResource','destroy','error','stack','name','status','send','index','map','SquareOdbc','rawAttributes','fieldName','type','model','query'];(function(_0x3a2843,_0x5aeacb){var _0x396cb8=function(_0x4398ad){while(--_0x4398ad){_0x3a2843['push'](_0x3a2843['shift']());}};_0x396cb8(++_0x5aeacb);}(_0x7188,0x75));var _0x8718=function(_0x452954,_0xe7b363){_0x452954=_0x452954-0x0;var _0x469f03=_0x7188[_0x452954];return _0x469f03;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8718('0x0'));var zipdir=require(_0x8718('0x1'));var jsonpatch=require(_0x8718('0x2'));var rp=require(_0x8718('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8718('0x4'));var util=require(_0x8718('0x5'));var path=require(_0x8718('0x6'));var sox=require(_0x8718('0x7'));var csv=require(_0x8718('0x8'));var ejs=require(_0x8718('0x9'));var fs=require('fs');var fs_extra=require(_0x8718('0xa'));var _=require('lodash');var squel=require(_0x8718('0xb'));var crypto=require(_0x8718('0xc'));var jsforce=require(_0x8718('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8718('0xe'));var Redis=require(_0x8718('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8718('0x10'));var hardwareService=require(_0x8718('0x11'));var logger=require('../../config/logger')(_0x8718('0x12'));var utils=require(_0x8718('0x13'));var config=require(_0x8718('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8718('0x15'))['db'];function respondWithStatusCode(_0x5dddb2,_0x40ba98){_0x40ba98=_0x40ba98||0xcc;return function(_0x23976b){if(_0x23976b){return _0x5dddb2[_0x8718('0x16')](_0x40ba98);}return _0x5dddb2['status'](_0x40ba98)[_0x8718('0x17')]();};}function respondWithResult(_0x15d444,_0x262714){_0x262714=_0x262714||0xc8;return function(_0x2b5494){if(_0x2b5494){return _0x15d444['status'](_0x262714)[_0x8718('0x18')](_0x2b5494);}};}function respondWithFilteredResult(_0x1216d3,_0x5ea498){return function(_0x447752){if(_0x447752){var _0x15b48b=typeof _0x5ea498[_0x8718('0x19')]===_0x8718('0x1a')&&typeof _0x5ea498['limit']===_0x8718('0x1a');var _0x136c7d=_0x447752[_0x8718('0x1b')];var _0x39854a=_0x15b48b?0x0:_0x5ea498[_0x8718('0x19')];var _0x32d4e0=_0x15b48b?_0x447752[_0x8718('0x1b')]:_0x5ea498[_0x8718('0x19')]+_0x5ea498[_0x8718('0x1c')];var _0x25558e;if(_0x32d4e0>=_0x136c7d){_0x32d4e0=_0x136c7d;_0x25558e=0xc8;}else{_0x25558e=0xce;}_0x1216d3['status'](_0x25558e);return _0x1216d3['set'](_0x8718('0x1d'),_0x39854a+'-'+_0x32d4e0+'/'+_0x136c7d)[_0x8718('0x18')](_0x447752);}return null;};}function patchUpdates(_0x4a7018){return function(_0x984506){try{jsonpatch['apply'](_0x984506,_0x4a7018,!![]);}catch(_0x2720d3){return BPromise['reject'](_0x2720d3);}return _0x984506['save']();};}function saveUpdates(_0x53619c,_0x56052a){return function(_0x2cb15f){if(_0x2cb15f){return _0x2cb15f[_0x8718('0x1e')](_0x53619c)[_0x8718('0x1f')](function(_0x12b306){return _0x12b306;});}return null;};}function removeEntity(_0x418257,_0x556d22){return function(_0x58b760){if(_0x58b760){return _0x58b760['destroy']()[_0x8718('0x1f')](function(){var _0x879e56=_0x58b760[_0x8718('0x20')]({'plain':!![]});var _0x3f0550=_0x8718('0x21');return db[_0x8718('0x22')][_0x8718('0x23')]({'where':{'type':_0x3f0550,'resourceId':_0x879e56['id']}})['then'](function(){return _0x58b760;});})[_0x8718('0x1f')](function(){_0x418257['status'](0xcc)[_0x8718('0x17')]();});}};}function handleEntityNotFound(_0x40e9b8,_0x45de2a){return function(_0x3f6d4f){if(!_0x3f6d4f){_0x40e9b8[_0x8718('0x16')](0x194);}return _0x3f6d4f;};}function handleError(_0xe05c27,_0x353f21){_0x353f21=_0x353f21||0x1f4;return function(_0x1b9d4e){logger[_0x8718('0x24')](_0x1b9d4e[_0x8718('0x25')]);if(_0x1b9d4e[_0x8718('0x26')]){delete _0x1b9d4e[_0x8718('0x26')];}_0xe05c27[_0x8718('0x27')](_0x353f21)[_0x8718('0x28')](_0x1b9d4e);};}exports[_0x8718('0x29')]=function(_0x41d2d2,_0x3a6a83){var _0x189259={},_0x4c5f2e={},_0x15a159={'count':0x0,'rows':[]};var _0x15d057=_[_0x8718('0x2a')](db[_0x8718('0x2b')][_0x8718('0x2c')],function(_0x230ac7){return{'name':_0x230ac7[_0x8718('0x2d')],'type':_0x230ac7[_0x8718('0x2e')]['key']};});_0x4c5f2e[_0x8718('0x2f')]=_[_0x8718('0x2a')](_0x15d057,_0x8718('0x26'));_0x4c5f2e[_0x8718('0x30')]=_[_0x8718('0x31')](_0x41d2d2[_0x8718('0x30')]);_0x4c5f2e[_0x8718('0x32')]=_[_0x8718('0x33')](_0x4c5f2e[_0x8718('0x2f')],_0x4c5f2e['query']);_0x189259[_0x8718('0x34')]=_['intersection'](_0x4c5f2e[_0x8718('0x2f')],qs['fields'](_0x41d2d2['query']['fields']));_0x189259[_0x8718('0x34')]=_0x189259[_0x8718('0x34')][_0x8718('0x35')]?_0x189259[_0x8718('0x34')]:_0x4c5f2e[_0x8718('0x2f')];if(!_0x41d2d2[_0x8718('0x30')][_0x8718('0x36')](_0x8718('0x37'))){_0x189259[_0x8718('0x1c')]=qs[_0x8718('0x1c')](_0x41d2d2['query']['limit']);_0x189259[_0x8718('0x19')]=qs[_0x8718('0x19')](_0x41d2d2[_0x8718('0x30')][_0x8718('0x19')]);}_0x189259[_0x8718('0x38')]=qs['sort'](_0x41d2d2['query'][_0x8718('0x39')]);_0x189259['where']=qs[_0x8718('0x32')](_[_0x8718('0x3a')](_0x41d2d2[_0x8718('0x30')],_0x4c5f2e[_0x8718('0x32')]),_0x15d057);if(_0x41d2d2[_0x8718('0x30')][_0x8718('0x3b')]){_0x189259[_0x8718('0x3c')]=_[_0x8718('0x3d')](_0x189259[_0x8718('0x3c')],{'$or':_[_0x8718('0x2a')](_0x15d057,function(_0x147eef){if(_0x147eef[_0x8718('0x2e')]!==_0x8718('0x3e')){var _0x4b7eef={};_0x4b7eef[_0x147eef[_0x8718('0x26')]]={'$like':'%'+_0x41d2d2[_0x8718('0x30')][_0x8718('0x3b')]+'%'};return _0x4b7eef;}})});}_0x189259=_[_0x8718('0x3d')]({},_0x189259,_0x41d2d2[_0x8718('0x3f')]);var _0x4c7442={'where':_0x189259[_0x8718('0x3c')]};return db[_0x8718('0x2b')][_0x8718('0x1b')](_0x4c7442)[_0x8718('0x1f')](function(_0x542062){_0x15a159[_0x8718('0x1b')]=_0x542062;if(_0x41d2d2[_0x8718('0x30')][_0x8718('0x40')]){_0x189259['include']=[{'all':!![]}];}return db['SquareOdbc'][_0x8718('0x41')](_0x189259);})['then'](function(_0x5d0d7c){_0x15a159[_0x8718('0x42')]=_0x5d0d7c;return _0x15a159;})[_0x8718('0x1f')](respondWithFilteredResult(_0x3a6a83,_0x189259))['catch'](handleError(_0x3a6a83,null));};exports[_0x8718('0x43')]=function(_0x4bcbc9,_0x348432){var _0x3077a6={'raw':!![],'where':{'id':_0x4bcbc9[_0x8718('0x44')]['id']}},_0x448992={};_0x448992[_0x8718('0x2f')]=_[_0x8718('0x31')](db[_0x8718('0x2b')][_0x8718('0x2c')]);_0x448992[_0x8718('0x30')]=_['keys'](_0x4bcbc9[_0x8718('0x30')]);_0x448992['filters']=_[_0x8718('0x33')](_0x448992[_0x8718('0x2f')],_0x448992['query']);_0x3077a6['attributes']=_['intersection'](_0x448992[_0x8718('0x2f')],qs['fields'](_0x4bcbc9['query']['fields']));_0x3077a6[_0x8718('0x34')]=_0x3077a6[_0x8718('0x34')][_0x8718('0x35')]?_0x3077a6[_0x8718('0x34')]:_0x448992[_0x8718('0x2f')];if(_0x4bcbc9['query'][_0x8718('0x40')]){_0x3077a6[_0x8718('0x45')]=[{'all':!![]}];}_0x3077a6=_[_0x8718('0x3d')]({},_0x3077a6,_0x4bcbc9['options']);return db[_0x8718('0x2b')][_0x8718('0x46')](_0x3077a6)['then'](handleEntityNotFound(_0x348432,null))[_0x8718('0x1f')](respondWithResult(_0x348432,null))[_0x8718('0x47')](handleError(_0x348432,null));};exports[_0x8718('0x48')]=function(_0x3c6992,_0x27cadc){return db['SquareOdbc'][_0x8718('0x48')](_0x3c6992['body'],{})[_0x8718('0x1f')](function(_0x3dbc9e){var _0x201a6c=_0x3c6992[_0x8718('0x49')][_0x8718('0x20')]({'plain':!![]});if(!_0x201a6c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x201a6c[_0x8718('0x4a')]==='user'){var _0x3e660b=_0x3dbc9e[_0x8718('0x20')]({'plain':!![]});var _0x1308bb=_0x8718('0x21');return db[_0x8718('0x4b')]['find']({'where':{'name':_0x1308bb,'userProfileId':_0x201a6c[_0x8718('0x4c')]},'raw':!![]})[_0x8718('0x1f')](function(_0x119055){if(_0x119055&&_0x119055[_0x8718('0x4d')]===0x0){return db[_0x8718('0x22')][_0x8718('0x48')]({'name':_0x3e660b[_0x8718('0x26')],'resourceId':_0x3e660b['id'],'type':_0x119055[_0x8718('0x26')],'sectionId':_0x119055['id']},{})[_0x8718('0x1f')](function(){return _0x3dbc9e;});}else{return _0x3dbc9e;}})[_0x8718('0x47')](function(_0x1d5892){logger[_0x8718('0x24')](_0x8718('0x4e'),_0x1d5892);throw _0x1d5892;});}return _0x3dbc9e;})[_0x8718('0x1f')](respondWithResult(_0x27cadc,0xc9))['catch'](handleError(_0x27cadc,null));};exports[_0x8718('0x1e')]=function(_0xfadd0b,_0x439315){if(_0xfadd0b[_0x8718('0x4f')]['id']){delete _0xfadd0b[_0x8718('0x4f')]['id'];}return db[_0x8718('0x2b')]['find']({'where':{'id':_0xfadd0b['params']['id']}})[_0x8718('0x1f')](handleEntityNotFound(_0x439315,null))[_0x8718('0x1f')](saveUpdates(_0xfadd0b[_0x8718('0x4f')],null))[_0x8718('0x1f')](respondWithResult(_0x439315,null))[_0x8718('0x47')](handleError(_0x439315,null));};exports[_0x8718('0x23')]=function(_0x5d75e9,_0x2dbacb){return db['SquareOdbc'][_0x8718('0x46')]({'where':{'id':_0x5d75e9[_0x8718('0x44')]['id']}})['then'](handleEntityNotFound(_0x2dbacb,null))['then'](removeEntity(_0x2dbacb,null))[_0x8718('0x47')](handleError(_0x2dbacb,null));};exports[_0x8718('0x50')]=function(_0x6acb38,_0x18ecc8,_0x1a3d70){var _0x570c6a;return db['SquareOdbc'][_0x8718('0x46')]({'where':{'id':_0x6acb38['params']['id']},'attributes':['id','dsn']})[_0x8718('0x1f')](handleEntityNotFound(_0x18ecc8,null))[_0x8718('0x1f')](function(_0xfd6838){if(_0xfd6838){var _0x347bcd=require('odbc')();_0x347bcd[_0x8718('0x51')](_0xfd6838['dsn']);_0x347bcd[_0x8718('0x52')]();return _0xfd6838;}})['then'](respondWithResult(_0x18ecc8,null))[_0x8718('0x47')](handleError(_0x18ecc8,null));}; \ No newline at end of file +var _0xf1e9=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','set','Content-Range','apply','reject','save','then','destroy','ODBC','UserProfileResource','stack','name','send','index','map','SquareOdbc','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','openSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x463388,_0x3fb150){var _0x360b12=function(_0x243841){while(--_0x243841){_0x463388['push'](_0x463388['shift']());}};_0x360b12(++_0x3fb150);}(_0xf1e9,0x99));var _0x9f1e=function(_0x5561f0,_0x46d65b){_0x5561f0=_0x5561f0-0x0;var _0x1b920d=_0xf1e9[_0x5561f0];return _0x1b920d;};'use strict';var emlformat=require(_0x9f1e('0x0'));var rimraf=require(_0x9f1e('0x1'));var zipdir=require(_0x9f1e('0x2'));var jsonpatch=require(_0x9f1e('0x3'));var rp=require(_0x9f1e('0x4'));var moment=require('moment');var BPromise=require(_0x9f1e('0x5'));var Mustache=require(_0x9f1e('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9f1e('0x7'));var _=require(_0x9f1e('0x8'));var squel=require(_0x9f1e('0x9'));var crypto=require('crypto');var jsforce=require(_0x9f1e('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x9f1e('0xb'));var querystring=require(_0x9f1e('0xc'));var Papa=require('papaparse');var Redis=require(_0x9f1e('0xd'));var authService=require(_0x9f1e('0xe'));var qs=require(_0x9f1e('0xf'));var as=require(_0x9f1e('0x10'));var hardwareService=require(_0x9f1e('0x11'));var logger=require(_0x9f1e('0x12'))(_0x9f1e('0x13'));var utils=require(_0x9f1e('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9f1e('0x15'))['db'];function respondWithStatusCode(_0x2f884d,_0x412290){_0x412290=_0x412290||0xcc;return function(_0x1a9ccf){if(_0x1a9ccf){return _0x2f884d[_0x9f1e('0x16')](_0x412290);}return _0x2f884d[_0x9f1e('0x17')](_0x412290)[_0x9f1e('0x18')]();};}function respondWithResult(_0x3b06de,_0x271cae){_0x271cae=_0x271cae||0xc8;return function(_0x5916fd){if(_0x5916fd){return _0x3b06de['status'](_0x271cae)[_0x9f1e('0x19')](_0x5916fd);}};}function respondWithFilteredResult(_0x2d70ff,_0x51d62d){return function(_0x3d007e){if(_0x3d007e){var _0x3c565a=typeof _0x51d62d['offset']==='undefined'&&typeof _0x51d62d[_0x9f1e('0x1a')]===_0x9f1e('0x1b');var _0x136104=_0x3d007e['count'];var _0x47f62f=_0x3c565a?0x0:_0x51d62d[_0x9f1e('0x1c')];var _0x5adb56=_0x3c565a?_0x3d007e['count']:_0x51d62d['offset']+_0x51d62d[_0x9f1e('0x1a')];var _0x3f24d1;if(_0x5adb56>=_0x136104){_0x5adb56=_0x136104;_0x3f24d1=0xc8;}else{_0x3f24d1=0xce;}_0x2d70ff[_0x9f1e('0x17')](_0x3f24d1);return _0x2d70ff[_0x9f1e('0x1d')](_0x9f1e('0x1e'),_0x47f62f+'-'+_0x5adb56+'/'+_0x136104)[_0x9f1e('0x19')](_0x3d007e);}return null;};}function patchUpdates(_0xf93f95){return function(_0x409501){try{jsonpatch[_0x9f1e('0x1f')](_0x409501,_0xf93f95,!![]);}catch(_0x2e475b){return BPromise[_0x9f1e('0x20')](_0x2e475b);}return _0x409501[_0x9f1e('0x21')]();};}function saveUpdates(_0x1b081d,_0x436374){return function(_0x858bc0){if(_0x858bc0){return _0x858bc0['update'](_0x1b081d)[_0x9f1e('0x22')](function(_0x110a58){return _0x110a58;});}return null;};}function removeEntity(_0x1a2eaa,_0x4434ca){return function(_0x1a11c5){if(_0x1a11c5){return _0x1a11c5[_0x9f1e('0x23')]()[_0x9f1e('0x22')](function(){var _0x5c9991=_0x1a11c5['get']({'plain':!![]});var _0x4cee8b=_0x9f1e('0x24');return db[_0x9f1e('0x25')][_0x9f1e('0x23')]({'where':{'type':_0x4cee8b,'resourceId':_0x5c9991['id']}})[_0x9f1e('0x22')](function(){return _0x1a11c5;});})[_0x9f1e('0x22')](function(){_0x1a2eaa[_0x9f1e('0x17')](0xcc)[_0x9f1e('0x18')]();});}};}function handleEntityNotFound(_0x339f51,_0xf19d15){return function(_0x19638c){if(!_0x19638c){_0x339f51[_0x9f1e('0x16')](0x194);}return _0x19638c;};}function handleError(_0x4d6351,_0x5ef2de){_0x5ef2de=_0x5ef2de||0x1f4;return function(_0x1a3c18){logger['error'](_0x1a3c18[_0x9f1e('0x26')]);if(_0x1a3c18[_0x9f1e('0x27')]){delete _0x1a3c18[_0x9f1e('0x27')];}_0x4d6351[_0x9f1e('0x17')](_0x5ef2de)[_0x9f1e('0x28')](_0x1a3c18);};}exports[_0x9f1e('0x29')]=function(_0x2d9db1,_0x3e72d6){var _0x112b76={},_0x3ee9ac={},_0x57de59={'count':0x0,'rows':[]};var _0x13fdb5=_[_0x9f1e('0x2a')](db[_0x9f1e('0x2b')][_0x9f1e('0x2c')],function(_0x1a59d6){return{'name':_0x1a59d6['fieldName'],'type':_0x1a59d6[_0x9f1e('0x2d')]['key']};});_0x3ee9ac[_0x9f1e('0x2e')]=_[_0x9f1e('0x2a')](_0x13fdb5,_0x9f1e('0x27'));_0x3ee9ac[_0x9f1e('0x2f')]=_[_0x9f1e('0x30')](_0x2d9db1['query']);_0x3ee9ac[_0x9f1e('0x31')]=_[_0x9f1e('0x32')](_0x3ee9ac[_0x9f1e('0x2e')],_0x3ee9ac[_0x9f1e('0x2f')]);_0x112b76[_0x9f1e('0x33')]=_[_0x9f1e('0x32')](_0x3ee9ac[_0x9f1e('0x2e')],qs[_0x9f1e('0x34')](_0x2d9db1[_0x9f1e('0x2f')][_0x9f1e('0x34')]));_0x112b76[_0x9f1e('0x33')]=_0x112b76['attributes'][_0x9f1e('0x35')]?_0x112b76[_0x9f1e('0x33')]:_0x3ee9ac['model'];if(!_0x2d9db1[_0x9f1e('0x2f')]['hasOwnProperty'](_0x9f1e('0x36'))){_0x112b76[_0x9f1e('0x1a')]=qs[_0x9f1e('0x1a')](_0x2d9db1['query'][_0x9f1e('0x1a')]);_0x112b76[_0x9f1e('0x1c')]=qs[_0x9f1e('0x1c')](_0x2d9db1['query'][_0x9f1e('0x1c')]);}_0x112b76[_0x9f1e('0x37')]=qs[_0x9f1e('0x38')](_0x2d9db1[_0x9f1e('0x2f')][_0x9f1e('0x38')]);_0x112b76[_0x9f1e('0x39')]=qs['filters'](_[_0x9f1e('0x3a')](_0x2d9db1[_0x9f1e('0x2f')],_0x3ee9ac[_0x9f1e('0x31')]),_0x13fdb5);if(_0x2d9db1[_0x9f1e('0x2f')][_0x9f1e('0x3b')]){_0x112b76[_0x9f1e('0x39')]=_[_0x9f1e('0x3c')](_0x112b76[_0x9f1e('0x39')],{'$or':_[_0x9f1e('0x2a')](_0x13fdb5,function(_0x5a990e){if(_0x5a990e[_0x9f1e('0x2d')]!==_0x9f1e('0x3d')){var _0x512694={};_0x512694[_0x5a990e[_0x9f1e('0x27')]]={'$like':'%'+_0x2d9db1[_0x9f1e('0x2f')][_0x9f1e('0x3b')]+'%'};return _0x512694;}})});}_0x112b76=_[_0x9f1e('0x3c')]({},_0x112b76,_0x2d9db1[_0x9f1e('0x3e')]);var _0x4f700b={'where':_0x112b76['where']};return db[_0x9f1e('0x2b')][_0x9f1e('0x3f')](_0x4f700b)['then'](function(_0x5067d2){_0x57de59[_0x9f1e('0x3f')]=_0x5067d2;if(_0x2d9db1[_0x9f1e('0x2f')][_0x9f1e('0x40')]){_0x112b76[_0x9f1e('0x41')]=[{'all':!![]}];}return db['SquareOdbc'][_0x9f1e('0x42')](_0x112b76);})[_0x9f1e('0x22')](function(_0x502af7){_0x57de59[_0x9f1e('0x43')]=_0x502af7;return _0x57de59;})[_0x9f1e('0x22')](respondWithFilteredResult(_0x3e72d6,_0x112b76))['catch'](handleError(_0x3e72d6,null));};exports[_0x9f1e('0x44')]=function(_0x2a24a3,_0x2d0d45){var _0x26c5c5={'raw':!![],'where':{'id':_0x2a24a3[_0x9f1e('0x45')]['id']}},_0x73721={};_0x73721[_0x9f1e('0x2e')]=_[_0x9f1e('0x30')](db[_0x9f1e('0x2b')]['rawAttributes']);_0x73721[_0x9f1e('0x2f')]=_[_0x9f1e('0x30')](_0x2a24a3[_0x9f1e('0x2f')]);_0x73721[_0x9f1e('0x31')]=_[_0x9f1e('0x32')](_0x73721['model'],_0x73721[_0x9f1e('0x2f')]);_0x26c5c5[_0x9f1e('0x33')]=_[_0x9f1e('0x32')](_0x73721['model'],qs[_0x9f1e('0x34')](_0x2a24a3[_0x9f1e('0x2f')][_0x9f1e('0x34')]));_0x26c5c5['attributes']=_0x26c5c5['attributes']['length']?_0x26c5c5[_0x9f1e('0x33')]:_0x73721[_0x9f1e('0x2e')];if(_0x2a24a3['query']['includeAll']){_0x26c5c5[_0x9f1e('0x41')]=[{'all':!![]}];}_0x26c5c5=_[_0x9f1e('0x3c')]({},_0x26c5c5,_0x2a24a3[_0x9f1e('0x3e')]);return db[_0x9f1e('0x2b')][_0x9f1e('0x46')](_0x26c5c5)[_0x9f1e('0x22')](handleEntityNotFound(_0x2d0d45,null))['then'](respondWithResult(_0x2d0d45,null))[_0x9f1e('0x47')](handleError(_0x2d0d45,null));};exports[_0x9f1e('0x48')]=function(_0x396763,_0x22efe3){return db[_0x9f1e('0x2b')]['create'](_0x396763[_0x9f1e('0x49')],{})['then'](function(_0x34e5ff){var _0x267e34=_0x396763['user'][_0x9f1e('0x4a')]({'plain':!![]});if(!_0x267e34)throw new Error(_0x9f1e('0x4b'));if(_0x267e34[_0x9f1e('0x4c')]===_0x9f1e('0x4d')){var _0x1c1652=_0x34e5ff['get']({'plain':!![]});var _0x3b632d=_0x9f1e('0x24');return db['UserProfileSection'][_0x9f1e('0x46')]({'where':{'name':_0x3b632d,'userProfileId':_0x267e34[_0x9f1e('0x4e')]},'raw':!![]})[_0x9f1e('0x22')](function(_0x2f5d37){if(_0x2f5d37&&_0x2f5d37[_0x9f1e('0x4f')]===0x0){return db[_0x9f1e('0x25')][_0x9f1e('0x48')]({'name':_0x1c1652[_0x9f1e('0x27')],'resourceId':_0x1c1652['id'],'type':_0x2f5d37[_0x9f1e('0x27')],'sectionId':_0x2f5d37['id']},{})[_0x9f1e('0x22')](function(){return _0x34e5ff;});}else{return _0x34e5ff;}})[_0x9f1e('0x47')](function(_0x50b50a){logger[_0x9f1e('0x50')](_0x9f1e('0x51'),_0x50b50a);throw _0x50b50a;});}return _0x34e5ff;})[_0x9f1e('0x22')](respondWithResult(_0x22efe3,0xc9))[_0x9f1e('0x47')](handleError(_0x22efe3,null));};exports['update']=function(_0x1037db,_0x559644){if(_0x1037db[_0x9f1e('0x49')]['id']){delete _0x1037db[_0x9f1e('0x49')]['id'];}return db[_0x9f1e('0x2b')]['find']({'where':{'id':_0x1037db[_0x9f1e('0x45')]['id']}})[_0x9f1e('0x22')](handleEntityNotFound(_0x559644,null))['then'](saveUpdates(_0x1037db['body'],null))[_0x9f1e('0x22')](respondWithResult(_0x559644,null))[_0x9f1e('0x47')](handleError(_0x559644,null));};exports['destroy']=function(_0x154dc4,_0xbd368e){return db[_0x9f1e('0x2b')][_0x9f1e('0x46')]({'where':{'id':_0x154dc4['params']['id']}})[_0x9f1e('0x22')](handleEntityNotFound(_0xbd368e,null))[_0x9f1e('0x22')](removeEntity(_0xbd368e,null))[_0x9f1e('0x47')](handleError(_0xbd368e,null));};exports[_0x9f1e('0x52')]=function(_0x3c4d60,_0x1ff3d8,_0xc21ad2){var _0x1f246e;return db[_0x9f1e('0x2b')][_0x9f1e('0x46')]({'where':{'id':_0x3c4d60[_0x9f1e('0x45')]['id']},'attributes':['id',_0x9f1e('0x53')]})['then'](handleEntityNotFound(_0x1ff3d8,null))[_0x9f1e('0x22')](function(_0x408bc2){if(_0x408bc2){var _0x5d881c=require('odbc')();_0x5d881c[_0x9f1e('0x54')](_0x408bc2['dsn']);_0x5d881c['closeSync']();return _0x408bc2;}})['then'](respondWithResult(_0x1ff3d8,null))[_0x9f1e('0x47')](handleError(_0x1ff3d8,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index d803302..20dc03a 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 _0x3380=['bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','square_odbc','lodash','util','../../config/logger','moment'];(function(_0x1cbcf1,_0x3f9fd9){var _0x3a06f0=function(_0x5425d4){while(--_0x5425d4){_0x1cbcf1['push'](_0x1cbcf1['shift']());}};_0x3a06f0(++_0x3f9fd9);}(_0x3380,0xd4));var _0x0338=function(_0xd0f74,_0x47f7d4){_0xd0f74=_0xd0f74-0x0;var _0x1a29eb=_0x3380[_0xd0f74];return _0x1a29eb;};'use strict';var _=require(_0x0338('0x0'));var util=require(_0x0338('0x1'));var logger=require(_0x0338('0x2'))('api');var moment=require(_0x0338('0x3'));var BPromise=require(_0x0338('0x4'));var rp=require(_0x0338('0x5'));var fs=require('fs');var path=require(_0x0338('0x6'));var rimraf=require(_0x0338('0x7'));var config=require(_0x0338('0x8'));var attributes=require(_0x0338('0x9'));module[_0x0338('0xa')]=function(_0x21a2b2,_0xd18707){return _0x21a2b2['define']('SquareOdbc',attributes,{'tableName':_0x0338('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc3f1=['./squareOdbc.attributes','exports','define','SquareOdbc','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x3bee6d,_0x4c0e34){var _0x35ecf5=function(_0xb558ac){while(--_0xb558ac){_0x3bee6d['push'](_0x3bee6d['shift']());}};_0x35ecf5(++_0x4c0e34);}(_0xc3f1,0xe8));var _0x1c3f=function(_0x47acbc,_0x369a1b){_0x47acbc=_0x47acbc-0x0;var _0x35b144=_0xc3f1[_0x47acbc];return _0x35b144;};'use strict';var _=require(_0x1c3f('0x0'));var util=require(_0x1c3f('0x1'));var logger=require(_0x1c3f('0x2'))(_0x1c3f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1c3f('0x4'));var fs=require('fs');var path=require(_0x1c3f('0x5'));var rimraf=require(_0x1c3f('0x6'));var config=require(_0x1c3f('0x7'));var attributes=require(_0x1c3f('0x8'));module[_0x1c3f('0x9')]=function(_0xa4b81c,_0x3ef1fd){return _0xa4b81c[_0x1c3f('0xa')](_0x1c3f('0xb'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 22e3859..ae9c6b7 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 _0x876b=['error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','options','raw','where','attributes','include','model','map','debug','stringify','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent'];(function(_0xe78add,_0x237047){var _0x41bf85=function(_0x1253e5){while(--_0x1253e5){_0xe78add['push'](_0xe78add['shift']());}};_0x41bf85(++_0x237047);}(_0x876b,0xa1));var _0xb876=function(_0x3346fa,_0x2a46e2){_0x3346fa=_0x3346fa-0x0;var _0x25a965=_0x876b[_0x3346fa];return _0x25a965;};'use strict';var _=require('lodash');var util=require(_0xb876('0x0'));var moment=require('moment');var BPromise=require(_0xb876('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb876('0x2'));var db=require(_0xb876('0x3'))['db'];var utils=require(_0xb876('0x4'));var logger=require(_0xb876('0x5'))('rpc');var config=require(_0xb876('0x6'));var jayson=require(_0xb876('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x20d0f6,_0x4898ec,_0x2c04e2){return new BPromise(function(_0x152b21,_0x2bbe99){return client[_0xb876('0x8')](_0x20d0f6,_0x2c04e2)[_0xb876('0x9')](function(_0x24d00d){logger[_0xb876('0xa')](_0xb876('0xb'),_0x4898ec,_0xb876('0xc'));logger['debug']('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x4898ec,'request\x20sent',JSON['stringify'](_0x24d00d));if(_0x24d00d[_0xb876('0xd')]){if(_0x24d00d['error'][_0xb876('0xe')]===0x1f4){logger[_0xb876('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4898ec,_0x24d00d['error']['message']);return _0x2bbe99(_0x24d00d[_0xb876('0xd')]['message']);}logger[_0xb876('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4898ec,_0x24d00d['error'][_0xb876('0xf')]);return _0x152b21(_0x24d00d['error'][_0xb876('0xf')]);}else{logger[_0xb876('0xa')]('SquareOdbc,\x20%s,\x20%s',_0x4898ec,_0xb876('0xc'));_0x152b21(_0x24d00d[_0xb876('0x10')][_0xb876('0xf')]);}})[_0xb876('0x11')](function(_0x517b4a){logger[_0xb876('0xd')](_0xb876('0xb'),_0x4898ec,_0x517b4a);_0x2bbe99(_0x517b4a);});});}exports[_0xb876('0x12')]=function(_0x2869f4){var _0x230dba=this;return new Promise(function(_0x53c2c9,_0x287405){return db[_0xb876('0x13')]['find']({'raw':_0x2869f4['options']?_0x2869f4[_0xb876('0x14')][_0xb876('0x15')]===undefined?!![]:![]:!![],'where':_0x2869f4[_0xb876('0x14')]?_0x2869f4[_0xb876('0x14')][_0xb876('0x16')]||null:null,'attributes':_0x2869f4[_0xb876('0x14')]?_0x2869f4['options'][_0xb876('0x17')]||null:null,'include':_0x2869f4[_0xb876('0x14')]?_0x2869f4[_0xb876('0x14')][_0xb876('0x18')]?_['map'](_0x2869f4[_0xb876('0x14')][_0xb876('0x18')],function(_0x224fbb){return{'model':db[_0x224fbb[_0xb876('0x19')]],'as':_0x224fbb['as'],'attributes':_0x224fbb[_0xb876('0x17')],'include':_0x224fbb[_0xb876('0x18')]?_['map'](_0x224fbb['include'],function(_0x1d55be){return{'model':db[_0x1d55be[_0xb876('0x19')]],'as':_0x1d55be['as'],'attributes':_0x1d55be['attributes'],'include':_0x1d55be['include']?_[_0xb876('0x1a')](_0x1d55be[_0xb876('0x18')],function(_0x3534e5){return{'model':db[_0x3534e5['model']],'as':_0x3534e5['as'],'attributes':_0x3534e5[_0xb876('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x15e5e2){logger['info']('ShowSquareOdbc',_0x2869f4);logger[_0xb876('0x1b')](_0xb876('0x12'),_0x2869f4,JSON[_0xb876('0x1c')](_0x15e5e2));_0x53c2c9(_0x15e5e2);})[_0xb876('0x11')](function(_0x3a3893){logger['error']('ShowSquareOdbc',_0x3a3893['message'],_0x2869f4);_0x287405(_0x230dba[_0xb876('0xd')](0x1f4,_0x3a3893[_0xb876('0xf')]));});});}; \ No newline at end of file +var _0x46b8=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareOdbc','find','options','raw','where','attributes','include','map','model','lodash','util','moment'];(function(_0x48ffc9,_0x581b31){var _0x1985cb=function(_0x4702d6){while(--_0x4702d6){_0x48ffc9['push'](_0x48ffc9['shift']());}};_0x1985cb(++_0x581b31);}(_0x46b8,0x1aa));var _0x846b=function(_0xe79083,_0x15b6c4){_0xe79083=_0xe79083-0x0;var _0x191b20=_0x46b8[_0xe79083];return _0x191b20;};'use strict';var _=require(_0x846b('0x0'));var util=require(_0x846b('0x1'));var moment=require(_0x846b('0x2'));var BPromise=require('bluebird');var rs=require(_0x846b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x846b('0x4'))['db'];var utils=require(_0x846b('0x5'));var logger=require(_0x846b('0x6'))('rpc');var config=require(_0x846b('0x7'));var jayson=require(_0x846b('0x8'));var client=jayson[_0x846b('0x9')][_0x846b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c37a6,_0x12443f,_0x31f884){return new BPromise(function(_0x316463,_0x36d6a3){return client[_0x846b('0xb')](_0x2c37a6,_0x31f884)[_0x846b('0xc')](function(_0x4a873f){logger[_0x846b('0xd')](_0x846b('0xe'),_0x12443f,_0x846b('0xf'));logger[_0x846b('0x10')](_0x846b('0x11'),_0x12443f,'request\x20sent',JSON[_0x846b('0x12')](_0x4a873f));if(_0x4a873f[_0x846b('0x13')]){if(_0x4a873f[_0x846b('0x13')][_0x846b('0x14')]===0x1f4){logger[_0x846b('0x13')](_0x846b('0xe'),_0x12443f,_0x4a873f['error'][_0x846b('0x15')]);return _0x36d6a3(_0x4a873f['error']['message']);}logger[_0x846b('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x12443f,_0x4a873f[_0x846b('0x13')]['message']);return _0x316463(_0x4a873f[_0x846b('0x13')][_0x846b('0x15')]);}else{logger[_0x846b('0xd')](_0x846b('0xe'),_0x12443f,_0x846b('0xf'));_0x316463(_0x4a873f[_0x846b('0x16')][_0x846b('0x15')]);}})[_0x846b('0x17')](function(_0xb5b86f){logger[_0x846b('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x12443f,_0xb5b86f);_0x36d6a3(_0xb5b86f);});});}exports[_0x846b('0x18')]=function(_0x91f2f8){var _0x26cc4d=this;return new Promise(function(_0x1a263f,_0x45eaf6){return db['SquareOdbc'][_0x846b('0x19')]({'raw':_0x91f2f8[_0x846b('0x1a')]?_0x91f2f8[_0x846b('0x1a')][_0x846b('0x1b')]===undefined?!![]:![]:!![],'where':_0x91f2f8[_0x846b('0x1a')]?_0x91f2f8[_0x846b('0x1a')][_0x846b('0x1c')]||null:null,'attributes':_0x91f2f8[_0x846b('0x1a')]?_0x91f2f8['options'][_0x846b('0x1d')]||null:null,'include':_0x91f2f8[_0x846b('0x1a')]?_0x91f2f8[_0x846b('0x1a')][_0x846b('0x1e')]?_[_0x846b('0x1f')](_0x91f2f8['options'][_0x846b('0x1e')],function(_0x1b3f98){return{'model':db[_0x1b3f98[_0x846b('0x20')]],'as':_0x1b3f98['as'],'attributes':_0x1b3f98[_0x846b('0x1d')],'include':_0x1b3f98[_0x846b('0x1e')]?_[_0x846b('0x1f')](_0x1b3f98[_0x846b('0x1e')],function(_0x5c2999){return{'model':db[_0x5c2999[_0x846b('0x20')]],'as':_0x5c2999['as'],'attributes':_0x5c2999[_0x846b('0x1d')],'include':_0x5c2999[_0x846b('0x1e')]?_[_0x846b('0x1f')](_0x5c2999[_0x846b('0x1e')],function(_0x4b2971){return{'model':db[_0x4b2971[_0x846b('0x20')]],'as':_0x4b2971['as'],'attributes':_0x4b2971[_0x846b('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ded65){logger['info'](_0x846b('0x18'),_0x91f2f8);logger[_0x846b('0x10')](_0x846b('0x18'),_0x91f2f8,JSON[_0x846b('0x12')](_0x5ded65));_0x1a263f(_0x5ded65);})[_0x846b('0x17')](function(_0x37aaf9){logger[_0x846b('0x13')](_0x846b('0x18'),_0x37aaf9['message'],_0x91f2f8);_0x45eaf6(_0x26cc4d[_0x846b('0x13')](0x1f4,_0x37aaf9['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index e929c23..96cc24a 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 _0x826c=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/users','post','create','addUsers','delete','destroy','removeUsers','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4c6ea2,_0x235789){var _0x3f1e64=function(_0x32cc91){while(--_0x32cc91){_0x4c6ea2['push'](_0x4c6ea2['shift']());}};_0x3f1e64(++_0x235789);}(_0x826c,0xc8));var _0xc826=function(_0x2f10ec,_0x53682a){_0x2f10ec=_0x2f10ec-0x0;var _0x299021=_0x826c[_0x2f10ec];return _0x299021;};'use strict';var multer=require(_0xc826('0x0'));var util=require(_0xc826('0x1'));var path=require(_0xc826('0x2'));var timeout=require(_0xc826('0x3'));var express=require(_0xc826('0x4'));var router=express[_0xc826('0x5')]();var fs_extra=require(_0xc826('0x6'));var auth=require(_0xc826('0x7'));var interaction=require(_0xc826('0x8'));var config=require(_0xc826('0x9'));var controller=require('./squareProject.controller');router[_0xc826('0xa')]('/',auth['isAuthenticated'](),controller[_0xc826('0xb')]);router['get'](_0xc826('0xc'),auth[_0xc826('0xd')](),controller[_0xc826('0xe')]);router[_0xc826('0xa')](_0xc826('0xf'),auth[_0xc826('0xd')](),controller['getUsers']);router[_0xc826('0x10')]('/',auth[_0xc826('0xd')](),controller[_0xc826('0x11')]);router['post'](_0xc826('0xf'),auth['isAuthenticated'](),controller[_0xc826('0x12')]);router['put']('/:id',auth[_0xc826('0xd')](),controller['update']);router[_0xc826('0x13')](_0xc826('0xc'),auth[_0xc826('0xd')](),controller[_0xc826('0x14')]);router['delete'](_0xc826('0xf'),auth['isAuthenticated'](),controller[_0xc826('0x15')]);module[_0xc826('0x16')]=router; \ No newline at end of file +var _0xc771=['../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/users','getUsers','post','create','put','update','delete','destroy','removeUsers','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x1d233c,_0x2312df){var _0x11eaec=function(_0x27eee3){while(--_0x27eee3){_0x1d233c['push'](_0x1d233c['shift']());}};_0x11eaec(++_0x2312df);}(_0xc771,0x1d9));var _0x1c77=function(_0x616d6,_0x49c2ec){_0x616d6=_0x616d6-0x0;var _0x47afa8=_0xc771[_0x616d6];return _0x47afa8;};'use strict';var multer=require(_0x1c77('0x0'));var util=require(_0x1c77('0x1'));var path=require(_0x1c77('0x2'));var timeout=require(_0x1c77('0x3'));var express=require('express');var router=express[_0x1c77('0x4')]();var fs_extra=require(_0x1c77('0x5'));var auth=require(_0x1c77('0x6'));var interaction=require(_0x1c77('0x7'));var config=require(_0x1c77('0x8'));var controller=require('./squareProject.controller');router[_0x1c77('0x9')]('/',auth['isAuthenticated'](),controller[_0x1c77('0xa')]);router['get'](_0x1c77('0xb'),auth[_0x1c77('0xc')](),controller[_0x1c77('0xd')]);router[_0x1c77('0x9')](_0x1c77('0xe'),auth[_0x1c77('0xc')](),controller[_0x1c77('0xf')]);router[_0x1c77('0x10')]('/',auth[_0x1c77('0xc')](),controller[_0x1c77('0x11')]);router['post'](_0x1c77('0xe'),auth['isAuthenticated'](),controller['addUsers']);router[_0x1c77('0x12')](_0x1c77('0xb'),auth[_0x1c77('0xc')](),controller[_0x1c77('0x13')]);router[_0x1c77('0x14')](_0x1c77('0xb'),auth[_0x1c77('0xc')](),controller[_0x1c77('0x15')]);router[_0x1c77('0x14')](_0x1c77('0xe'),auth[_0x1c77('0xc')](),controller[_0x1c77('0x16')]);module[_0x1c77('0x17')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 7089cfc..0b4b459 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 _0xf40b=['preproduction','toString','utf8','production','DATE','sequelize','STRING','TEXT','BLOB','long','getDataValue'];(function(_0x1d3901,_0x30d63e){var _0x2107bd=function(_0x33b3c1){while(--_0x33b3c1){_0x1d3901['push'](_0x1d3901['shift']());}};_0x2107bd(++_0x30d63e);}(_0xf40b,0xf7));var _0xbf40=function(_0x411511,_0x13b21a){_0x411511=_0x411511-0x0;var _0xda7b33=_0xf40b[_0x411511];return _0xda7b33;};'use strict';var Sequelize=require(_0xbf40('0x0'));module['exports']={'name':{'type':Sequelize[_0xbf40('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xbf40('0x1')]},'notes':{'type':Sequelize[_0xbf40('0x2')]},'preproduction':{'type':Sequelize[_0xbf40('0x3')](_0xbf40('0x4')),'get':function(){if(this[_0xbf40('0x5')](_0xbf40('0x6'))){return this[_0xbf40('0x5')]('preproduction')[_0xbf40('0x7')](_0xbf40('0x8'));}}},'production':{'type':Sequelize[_0xbf40('0x3')](_0xbf40('0x4')),'get':function(){if(this[_0xbf40('0x5')](_0xbf40('0x9'))){return this[_0xbf40('0x5')](_0xbf40('0x9'))[_0xbf40('0x7')](_0xbf40('0x8'));}}},'savedAt':{'type':Sequelize[_0xbf40('0xa')]},'publishedAt':{'type':Sequelize[_0xbf40('0xa')]}}; \ No newline at end of file +var _0x36f2=['toString','BLOB','production','utf8','DATE','sequelize','STRING','long','getDataValue','preproduction'];(function(_0x112a03,_0x522ec3){var _0x3380f6=function(_0xf73e8d){while(--_0xf73e8d){_0x112a03['push'](_0x112a03['shift']());}};_0x3380f6(++_0x522ec3);}(_0x36f2,0x9b));var _0x236f=function(_0x1630fd,_0x2ec6eb){_0x1630fd=_0x1630fd-0x0;var _0x49bf45=_0x36f2[_0x1630fd];return _0x49bf45;};'use strict';var Sequelize=require(_0x236f('0x0'));module['exports']={'name':{'type':Sequelize[_0x236f('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x236f('0x1')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize['BLOB'](_0x236f('0x2')),'get':function(){if(this[_0x236f('0x3')]('preproduction')){return this[_0x236f('0x3')](_0x236f('0x4'))[_0x236f('0x5')]('utf8');}}},'production':{'type':Sequelize[_0x236f('0x6')]('long'),'get':function(){if(this[_0x236f('0x3')](_0x236f('0x7'))){return this[_0x236f('0x3')](_0x236f('0x7'))[_0x236f('0x5')](_0x236f('0x8'));}}},'savedAt':{'type':Sequelize[_0x236f('0x9')]},'publishedAt':{'type':Sequelize[_0x236f('0x9')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 38d9091..4fe951c 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 _0x4712=['filter','where','merge','VIRTUAL','options','count','include','findAll','rows','show','params','keys','intersection','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','body','addUsers','ids','removeUsers','isArray','userSquareProject:remove','emit','getUsers','rawAttributes','pick','hasOwnProperty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','offset','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','SquareProject','key','model','query','attributes','fields','length','nolimit','order','sort','filters'];(function(_0x9691c1,_0x3fee65){var _0x106cbf=function(_0x5948a5){while(--_0x5948a5){_0x9691c1['push'](_0x9691c1['shift']());}};_0x106cbf(++_0x3fee65);}(_0x4712,0xe5));var _0x2471=function(_0x30a02e,_0x38185c){_0x30a02e=_0x30a02e-0x0;var _0x1022a9=_0x4712[_0x30a02e];return _0x1022a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2471('0x0'));var zipdir=require(_0x2471('0x1'));var jsonpatch=require(_0x2471('0x2'));var rp=require(_0x2471('0x3'));var moment=require(_0x2471('0x4'));var BPromise=require(_0x2471('0x5'));var Mustache=require('mustache');var util=require(_0x2471('0x6'));var path=require(_0x2471('0x7'));var sox=require('sox');var csv=require(_0x2471('0x8'));var ejs=require(_0x2471('0x9'));var fs=require('fs');var fs_extra=require(_0x2471('0xa'));var _=require(_0x2471('0xb'));var squel=require(_0x2471('0xc'));var crypto=require(_0x2471('0xd'));var jsforce=require(_0x2471('0xe'));var deskjs=require(_0x2471('0xf'));var toCsv=require(_0x2471('0x8'));var querystring=require(_0x2471('0x10'));var Papa=require(_0x2471('0x11'));var Redis=require(_0x2471('0x12'));var authService=require(_0x2471('0x13'));var qs=require(_0x2471('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2471('0x15'));var logger=require(_0x2471('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x2471('0x17'));var licenseUtil=require(_0x2471('0x18'));var db=require(_0x2471('0x19'))['db'];config[_0x2471('0x1a')]=_[_0x2471('0x1b')](config[_0x2471('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x2471('0x1c'))(new Redis(config[_0x2471('0x1a')]));require('./squareProject.socket')[_0x2471('0x1d')](socket);function respondWithStatusCode(_0x350ff5,_0x5675d5){_0x5675d5=_0x5675d5||0xcc;return function(_0x564b23){if(_0x564b23){return _0x350ff5[_0x2471('0x1e')](_0x5675d5);}return _0x350ff5[_0x2471('0x1f')](_0x5675d5)[_0x2471('0x20')]();};}function respondWithResult(_0x1fdf16,_0x435def){_0x435def=_0x435def||0xc8;return function(_0x3ccea5){if(_0x3ccea5){return _0x1fdf16['status'](_0x435def)[_0x2471('0x21')](_0x3ccea5);}};}function respondWithFilteredResult(_0x132ee7,_0xb731d){return function(_0xeb2322){if(_0xeb2322){var _0x5d3678=typeof _0xb731d['offset']===_0x2471('0x22')&&typeof _0xb731d[_0x2471('0x23')]===_0x2471('0x22');var _0xc46820=_0xeb2322['count'];var _0x1ce145=_0x5d3678?0x0:_0xb731d[_0x2471('0x24')];var _0x7ebf4c=_0x5d3678?_0xeb2322['count']:_0xb731d[_0x2471('0x24')]+_0xb731d['limit'];var _0x122bbf;if(_0x7ebf4c>=_0xc46820){_0x7ebf4c=_0xc46820;_0x122bbf=0xc8;}else{_0x122bbf=0xce;}_0x132ee7[_0x2471('0x1f')](_0x122bbf);return _0x132ee7['set'](_0x2471('0x25'),_0x1ce145+'-'+_0x7ebf4c+'/'+_0xc46820)[_0x2471('0x21')](_0xeb2322);}return null;};}function patchUpdates(_0x5c2057){return function(_0x119dbc){try{jsonpatch[_0x2471('0x26')](_0x119dbc,_0x5c2057,!![]);}catch(_0x4ee866){return BPromise[_0x2471('0x27')](_0x4ee866);}return _0x119dbc[_0x2471('0x28')]();};}function saveUpdates(_0x59c7c2,_0xb31f4e){return function(_0x10e152){if(_0x10e152){return _0x10e152[_0x2471('0x29')](_0x59c7c2)[_0x2471('0x2a')](function(_0x5efd01){return _0x5efd01;});}return null;};}function removeEntity(_0x166d95,_0x4a7e55){return function(_0x5ca66d){if(_0x5ca66d){return _0x5ca66d[_0x2471('0x2b')]()[_0x2471('0x2a')](function(){var _0x4d3f3c=_0x5ca66d[_0x2471('0x2c')]({'plain':!![]});var _0x37bc1a='SquareProjects';return db[_0x2471('0x2d')][_0x2471('0x2b')]({'where':{'type':_0x37bc1a,'resourceId':_0x4d3f3c['id']}})[_0x2471('0x2a')](function(){return _0x5ca66d;});})[_0x2471('0x2a')](function(){_0x166d95['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x10ef6a,_0x211639){return function(_0x3d2680){if(!_0x3d2680){_0x10ef6a[_0x2471('0x1e')](0x194);}return _0x3d2680;};}function handleError(_0x24c017,_0x70b83a){_0x70b83a=_0x70b83a||0x1f4;return function(_0x3c20de){logger['error'](_0x3c20de[_0x2471('0x2e')]);if(_0x3c20de[_0x2471('0x2f')]){delete _0x3c20de[_0x2471('0x2f')];}_0x24c017[_0x2471('0x1f')](_0x70b83a)[_0x2471('0x30')](_0x3c20de);};}exports[_0x2471('0x31')]=function(_0x3258a2,_0x4c76d){var _0x5429ec={},_0x30f540={},_0x17a1ec={'count':0x0,'rows':[]};var _0x271ee1=_[_0x2471('0x32')](db[_0x2471('0x33')]['rawAttributes'],function(_0x219102){return{'name':_0x219102['fieldName'],'type':_0x219102['type'][_0x2471('0x34')]};});_0x30f540[_0x2471('0x35')]=_['map'](_0x271ee1,_0x2471('0x2f'));_0x30f540['query']=_['keys'](_0x3258a2[_0x2471('0x36')]);_0x30f540['filters']=_['intersection'](_0x30f540[_0x2471('0x35')],_0x30f540[_0x2471('0x36')]);_0x5429ec[_0x2471('0x37')]=_['intersection'](_0x30f540['model'],qs['fields'](_0x3258a2[_0x2471('0x36')][_0x2471('0x38')]));_0x5429ec[_0x2471('0x37')]=_0x5429ec[_0x2471('0x37')][_0x2471('0x39')]?_0x5429ec[_0x2471('0x37')]:_0x30f540[_0x2471('0x35')];if(!_0x3258a2[_0x2471('0x36')]['hasOwnProperty'](_0x2471('0x3a'))){_0x5429ec['limit']=qs[_0x2471('0x23')](_0x3258a2[_0x2471('0x36')][_0x2471('0x23')]);_0x5429ec[_0x2471('0x24')]=qs[_0x2471('0x24')](_0x3258a2[_0x2471('0x36')][_0x2471('0x24')]);}_0x5429ec[_0x2471('0x3b')]=qs[_0x2471('0x3c')](_0x3258a2['query']['sort']);_0x5429ec['where']=qs[_0x2471('0x3d')](_['pick'](_0x3258a2['query'],_0x30f540[_0x2471('0x3d')]),_0x271ee1);if(_0x3258a2[_0x2471('0x36')][_0x2471('0x3e')]){_0x5429ec[_0x2471('0x3f')]=_[_0x2471('0x40')](_0x5429ec[_0x2471('0x3f')],{'$or':_[_0x2471('0x32')](_0x271ee1,function(_0x29ecf1){if(_0x29ecf1['type']!==_0x2471('0x41')){var _0x945cf8={};_0x945cf8[_0x29ecf1[_0x2471('0x2f')]]={'$like':'%'+_0x3258a2['query'][_0x2471('0x3e')]+'%'};return _0x945cf8;}})});}_0x5429ec=_[_0x2471('0x40')]({},_0x5429ec,_0x3258a2[_0x2471('0x42')]);var _0x47e5bf={'where':_0x5429ec['where']};return db[_0x2471('0x33')]['count'](_0x47e5bf)[_0x2471('0x2a')](function(_0x2ccd33){_0x17a1ec[_0x2471('0x43')]=_0x2ccd33;if(_0x3258a2[_0x2471('0x36')]['includeAll']){_0x5429ec[_0x2471('0x44')]=[{'all':!![]}];}return db['SquareProject'][_0x2471('0x45')](_0x5429ec);})[_0x2471('0x2a')](function(_0x30f021){_0x17a1ec[_0x2471('0x46')]=_0x30f021;return _0x17a1ec;})[_0x2471('0x2a')](respondWithFilteredResult(_0x4c76d,_0x5429ec))['catch'](handleError(_0x4c76d,null));};exports[_0x2471('0x47')]=function(_0x2a1f34,_0x3fd6d6){var _0x56cbbd={'raw':![],'where':{'id':_0x2a1f34[_0x2471('0x48')]['id']}},_0x354f2a={};_0x354f2a[_0x2471('0x35')]=_['keys'](db['SquareProject']['rawAttributes']);_0x354f2a[_0x2471('0x36')]=_[_0x2471('0x49')](_0x2a1f34[_0x2471('0x36')]);_0x354f2a['filters']=_[_0x2471('0x4a')](_0x354f2a['model'],_0x354f2a['query']);_0x56cbbd[_0x2471('0x37')]=_[_0x2471('0x4a')](_0x354f2a[_0x2471('0x35')],qs[_0x2471('0x38')](_0x2a1f34[_0x2471('0x36')]['fields']));_0x56cbbd[_0x2471('0x37')]=_0x56cbbd['attributes'][_0x2471('0x39')]?_0x56cbbd['attributes']:_0x354f2a[_0x2471('0x35')];if(_0x2a1f34[_0x2471('0x36')][_0x2471('0x4b')]){_0x56cbbd[_0x2471('0x44')]=[{'all':!![]}];}_0x56cbbd=_[_0x2471('0x40')]({},_0x56cbbd,_0x2a1f34[_0x2471('0x42')]);return db['SquareProject']['find'](_0x56cbbd)[_0x2471('0x2a')](handleEntityNotFound(_0x3fd6d6,null))['then'](respondWithResult(_0x3fd6d6,null))['catch'](handleError(_0x3fd6d6,null));};exports['create']=function(_0x35c5bb,_0x3e0d55){return db['SquareProject'][_0x2471('0x4c')](_0x35c5bb['body'],{})[_0x2471('0x2a')](function(_0x11bb83){var _0x2e05dd=_0x35c5bb[_0x2471('0x4d')][_0x2471('0x2c')]({'plain':!![]});if(!_0x2e05dd)throw new Error(_0x2471('0x4e'));if(_0x2e05dd[_0x2471('0x4f')]===_0x2471('0x4d')){var _0x22d240=_0x11bb83[_0x2471('0x2c')]({'plain':!![]});var _0x3e993e=_0x2471('0x50');return db['UserProfileSection']['find']({'where':{'name':_0x3e993e,'userProfileId':_0x2e05dd[_0x2471('0x51')]},'raw':!![]})['then'](function(_0x2052af){if(_0x2052af&&_0x2052af[_0x2471('0x52')]===0x0){return db[_0x2471('0x2d')][_0x2471('0x4c')]({'name':_0x22d240[_0x2471('0x2f')],'resourceId':_0x22d240['id'],'type':_0x2052af['name'],'sectionId':_0x2052af['id']},{})[_0x2471('0x2a')](function(){return _0x11bb83;});}else{return _0x11bb83;}})['catch'](function(_0x431b4a){logger[_0x2471('0x53')](_0x2471('0x54'),_0x431b4a);throw _0x431b4a;});}return _0x11bb83;})[_0x2471('0x2a')](respondWithResult(_0x3e0d55,0xc9))[_0x2471('0x55')](handleError(_0x3e0d55,null));};exports['update']=function(_0x512fa4,_0x452a99){if(_0x512fa4[_0x2471('0x56')]['id']){delete _0x512fa4['body']['id'];}return db['SquareProject']['find']({'where':{'id':_0x512fa4[_0x2471('0x48')]['id']}})[_0x2471('0x2a')](handleEntityNotFound(_0x452a99,null))[_0x2471('0x2a')](saveUpdates(_0x512fa4[_0x2471('0x56')],null))[_0x2471('0x2a')](respondWithResult(_0x452a99,null))[_0x2471('0x55')](handleError(_0x452a99,null));};exports[_0x2471('0x2b')]=function(_0x5a8811,_0x4d4adf){return db[_0x2471('0x33')]['find']({'where':{'id':_0x5a8811['params']['id']}})[_0x2471('0x2a')](handleEntityNotFound(_0x4d4adf,null))[_0x2471('0x2a')](removeEntity(_0x4d4adf,null))[_0x2471('0x55')](handleError(_0x4d4adf,null));};exports[_0x2471('0x57')]=function(_0x4d5198,_0x58d6d1,_0x444d4c){return db['SquareProject']['find']({'where':{'id':_0x4d5198[_0x2471('0x48')]['id']}})['then'](handleEntityNotFound(_0x58d6d1,null))[_0x2471('0x2a')](function(_0x3cde4c){if(_0x3cde4c){return _0x3cde4c[_0x2471('0x57')](_0x4d5198[_0x2471('0x56')][_0x2471('0x58')],_['omit'](_0x4d5198['body'],[_0x2471('0x58'),'id'])||{});}})['then'](respondWithResult(_0x58d6d1,null))[_0x2471('0x55')](handleError(_0x58d6d1,null));};exports[_0x2471('0x59')]=function(_0x3b9c30,_0x11980c,_0x2b763e){return db[_0x2471('0x33')]['find']({'where':{'id':_0x3b9c30[_0x2471('0x48')]['id']}})[_0x2471('0x2a')](handleEntityNotFound(_0x11980c,null))['then'](function(_0x5eae3c){if(_0x5eae3c){return _0x5eae3c[_0x2471('0x59')](_0x3b9c30[_0x2471('0x36')][_0x2471('0x58')])[_0x2471('0x2a')](function(){if(_[_0x2471('0x5a')](_0x3b9c30[_0x2471('0x36')][_0x2471('0x58')])){for(var _0x21e62e=0x0;_0x21e62e<_0x3b9c30['query']['ids']['length'];_0x21e62e+=0x1){socket['emit'](_0x2471('0x5b'),{'UserId':Number(_0x3b9c30[_0x2471('0x36')][_0x2471('0x58')][_0x21e62e]),'SquareProjectId':Number(_0x3b9c30['params']['id'])});}}else{socket[_0x2471('0x5c')](_0x2471('0x5b'),{'UserId':Number(_0x3b9c30[_0x2471('0x36')][_0x2471('0x58')]),'SquareProjectId':Number(_0x3b9c30['params']['id'])});}});}})[_0x2471('0x2a')](respondWithStatusCode(_0x11980c,null))[_0x2471('0x55')](handleError(_0x11980c,null));};exports[_0x2471('0x5d')]=function(_0x54442c,_0x90ba51,_0x1e066e){var _0x240563={};var _0x59bd46={};var _0x8e61f5;var _0x3e1aff;return db[_0x2471('0x33')]['findOne']({'where':{'id':_0x54442c[_0x2471('0x48')]['id']}})[_0x2471('0x2a')](handleEntityNotFound(_0x90ba51,null))[_0x2471('0x2a')](function(_0x4b4b34){if(_0x4b4b34){_0x8e61f5=_0x4b4b34;_0x59bd46[_0x2471('0x35')]=_[_0x2471('0x49')](db['User'][_0x2471('0x5e')]);_0x59bd46[_0x2471('0x36')]=_[_0x2471('0x49')](_0x54442c['query']);_0x59bd46[_0x2471('0x3d')]=_['intersection'](_0x59bd46[_0x2471('0x35')],_0x59bd46[_0x2471('0x36')]);_0x240563[_0x2471('0x37')]=_['intersection'](_0x59bd46[_0x2471('0x35')],qs[_0x2471('0x38')](_0x54442c[_0x2471('0x36')][_0x2471('0x38')]));_0x240563['attributes']=_0x240563['attributes'][_0x2471('0x39')]?_0x240563[_0x2471('0x37')]:_0x59bd46[_0x2471('0x35')];_0x240563[_0x2471('0x3b')]=qs[_0x2471('0x3c')](_0x54442c['query'][_0x2471('0x3c')]);_0x240563['where']=qs[_0x2471('0x3d')](_[_0x2471('0x5f')](_0x54442c[_0x2471('0x36')],_0x59bd46[_0x2471('0x3d')]));if(_0x54442c[_0x2471('0x36')][_0x2471('0x3e')]){_0x240563[_0x2471('0x3f')]=_[_0x2471('0x40')](_0x240563[_0x2471('0x3f')],{'$or':_[_0x2471('0x32')](_0x240563['attributes'],function(_0x528582){var _0x4bd2e4={};_0x4bd2e4[_0x528582]={'$like':'%'+_0x54442c[_0x2471('0x36')][_0x2471('0x3e')]+'%'};return _0x4bd2e4;})});}_0x240563=_[_0x2471('0x40')]({},_0x240563,_0x54442c[_0x2471('0x42')]);return _0x8e61f5['getUsers'](_0x240563);}})[_0x2471('0x2a')](function(_0x1633a0){if(_0x1633a0){_0x3e1aff=_0x1633a0[_0x2471('0x39')];if(!_0x54442c['query'][_0x2471('0x60')](_0x2471('0x3a'))){_0x240563[_0x2471('0x23')]=qs[_0x2471('0x23')](_0x54442c[_0x2471('0x36')]['limit']);_0x240563[_0x2471('0x24')]=qs[_0x2471('0x24')](_0x54442c[_0x2471('0x36')][_0x2471('0x24')]);}return _0x8e61f5[_0x2471('0x5d')](_0x240563);}})['then'](function(_0x176fb9){if(_0x176fb9){return _0x176fb9?{'count':_0x3e1aff,'rows':_0x176fb9}:null;}})['then'](respondWithResult(_0x90ba51,null))['catch'](handleError(_0x90ba51,null));}; \ No newline at end of file +var _0x52dc=['register','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','then','destroy','get','SquareProjects','name','send','index','map','SquareProject','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filters','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','user','role','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../mysqldb','defaults','redis','localhost'];(function(_0x28ba13,_0x3ed8fe){var _0x3407af=function(_0x1a4af4){while(--_0x1a4af4){_0x28ba13['push'](_0x28ba13['shift']());}};_0x3407af(++_0x3ed8fe);}(_0x52dc,0x100));var _0xc52d=function(_0xe883a9,_0x493c67){_0xe883a9=_0xe883a9-0x0;var _0x539bf3=_0x52dc[_0xe883a9];return _0x539bf3;};'use strict';var emlformat=require(_0xc52d('0x0'));var rimraf=require(_0xc52d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc52d('0x2'));var rp=require(_0xc52d('0x3'));var moment=require(_0xc52d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc52d('0x5'));var util=require(_0xc52d('0x6'));var path=require('path');var sox=require(_0xc52d('0x7'));var csv=require(_0xc52d('0x8'));var ejs=require(_0xc52d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc52d('0xa'));var squel=require('squel');var crypto=require(_0xc52d('0xb'));var jsforce=require(_0xc52d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc52d('0x8'));var querystring=require('querystring');var Papa=require(_0xc52d('0xd'));var Redis=require(_0xc52d('0xe'));var authService=require(_0xc52d('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc52d('0x10'));var logger=require('../../config/logger')(_0xc52d('0x11'));var utils=require(_0xc52d('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc52d('0x13'))['db'];config['redis']=_[_0xc52d('0x14')](config[_0xc52d('0x15')],{'host':_0xc52d('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc52d('0x15')]));require('./squareProject.socket')[_0xc52d('0x17')](socket);function respondWithStatusCode(_0x1883c7,_0x5918e5){_0x5918e5=_0x5918e5||0xcc;return function(_0x36c778){if(_0x36c778){return _0x1883c7[_0xc52d('0x18')](_0x5918e5);}return _0x1883c7['status'](_0x5918e5)[_0xc52d('0x19')]();};}function respondWithResult(_0x5ddbba,_0x24a978){_0x24a978=_0x24a978||0xc8;return function(_0x3d138d){if(_0x3d138d){return _0x5ddbba[_0xc52d('0x1a')](_0x24a978)['json'](_0x3d138d);}};}function respondWithFilteredResult(_0x3b44f3,_0x283066){return function(_0x6c6381){if(_0x6c6381){var _0x422948=typeof _0x283066['offset']===_0xc52d('0x1b')&&typeof _0x283066[_0xc52d('0x1c')]==='undefined';var _0x1109e0=_0x6c6381[_0xc52d('0x1d')];var _0x3fde30=_0x422948?0x0:_0x283066['offset'];var _0x580ba3=_0x422948?_0x6c6381[_0xc52d('0x1d')]:_0x283066[_0xc52d('0x1e')]+_0x283066[_0xc52d('0x1c')];var _0x23b766;if(_0x580ba3>=_0x1109e0){_0x580ba3=_0x1109e0;_0x23b766=0xc8;}else{_0x23b766=0xce;}_0x3b44f3[_0xc52d('0x1a')](_0x23b766);return _0x3b44f3[_0xc52d('0x1f')](_0xc52d('0x20'),_0x3fde30+'-'+_0x580ba3+'/'+_0x1109e0)[_0xc52d('0x21')](_0x6c6381);}return null;};}function patchUpdates(_0x25f7bf){return function(_0x33efea){try{jsonpatch[_0xc52d('0x22')](_0x33efea,_0x25f7bf,!![]);}catch(_0x533152){return BPromise[_0xc52d('0x23')](_0x533152);}return _0x33efea['save']();};}function saveUpdates(_0x183884,_0x4e23c7){return function(_0x337284){if(_0x337284){return _0x337284[_0xc52d('0x24')](_0x183884)[_0xc52d('0x25')](function(_0x3f2aec){return _0x3f2aec;});}return null;};}function removeEntity(_0x46d246,_0x4e5c00){return function(_0x1b5834){if(_0x1b5834){return _0x1b5834[_0xc52d('0x26')]()[_0xc52d('0x25')](function(){var _0x200d5d=_0x1b5834[_0xc52d('0x27')]({'plain':!![]});var _0x39d85f=_0xc52d('0x28');return db['UserProfileResource'][_0xc52d('0x26')]({'where':{'type':_0x39d85f,'resourceId':_0x200d5d['id']}})[_0xc52d('0x25')](function(){return _0x1b5834;});})[_0xc52d('0x25')](function(){_0x46d246[_0xc52d('0x1a')](0xcc)[_0xc52d('0x19')]();});}};}function handleEntityNotFound(_0x2d13fe,_0x219ee5){return function(_0x835c20){if(!_0x835c20){_0x2d13fe[_0xc52d('0x18')](0x194);}return _0x835c20;};}function handleError(_0xb3720,_0x17044b){_0x17044b=_0x17044b||0x1f4;return function(_0x34652e){logger['error'](_0x34652e['stack']);if(_0x34652e[_0xc52d('0x29')]){delete _0x34652e['name'];}_0xb3720[_0xc52d('0x1a')](_0x17044b)[_0xc52d('0x2a')](_0x34652e);};}exports[_0xc52d('0x2b')]=function(_0x21b2df,_0x32c1ee){var _0x7ff3cc={},_0x352050={},_0x15f18d={'count':0x0,'rows':[]};var _0x116ec8=_[_0xc52d('0x2c')](db[_0xc52d('0x2d')][_0xc52d('0x2e')],function(_0x12d567){return{'name':_0x12d567[_0xc52d('0x2f')],'type':_0x12d567[_0xc52d('0x30')][_0xc52d('0x31')]};});_0x352050['model']=_[_0xc52d('0x2c')](_0x116ec8,_0xc52d('0x29'));_0x352050['query']=_[_0xc52d('0x32')](_0x21b2df[_0xc52d('0x33')]);_0x352050['filters']=_[_0xc52d('0x34')](_0x352050[_0xc52d('0x35')],_0x352050['query']);_0x7ff3cc[_0xc52d('0x36')]=_[_0xc52d('0x34')](_0x352050[_0xc52d('0x35')],qs[_0xc52d('0x37')](_0x21b2df[_0xc52d('0x33')]['fields']));_0x7ff3cc[_0xc52d('0x36')]=_0x7ff3cc[_0xc52d('0x36')]['length']?_0x7ff3cc['attributes']:_0x352050[_0xc52d('0x35')];if(!_0x21b2df[_0xc52d('0x33')][_0xc52d('0x38')](_0xc52d('0x39'))){_0x7ff3cc[_0xc52d('0x1c')]=qs[_0xc52d('0x1c')](_0x21b2df[_0xc52d('0x33')][_0xc52d('0x1c')]);_0x7ff3cc[_0xc52d('0x1e')]=qs[_0xc52d('0x1e')](_0x21b2df[_0xc52d('0x33')][_0xc52d('0x1e')]);}_0x7ff3cc[_0xc52d('0x3a')]=qs[_0xc52d('0x3b')](_0x21b2df[_0xc52d('0x33')][_0xc52d('0x3b')]);_0x7ff3cc['where']=qs['filters'](_[_0xc52d('0x3c')](_0x21b2df['query'],_0x352050[_0xc52d('0x3d')]),_0x116ec8);if(_0x21b2df['query']['filter']){_0x7ff3cc[_0xc52d('0x3e')]=_[_0xc52d('0x3f')](_0x7ff3cc[_0xc52d('0x3e')],{'$or':_['map'](_0x116ec8,function(_0x10d0e6){if(_0x10d0e6['type']!==_0xc52d('0x40')){var _0x133a0c={};_0x133a0c[_0x10d0e6['name']]={'$like':'%'+_0x21b2df['query'][_0xc52d('0x41')]+'%'};return _0x133a0c;}})});}_0x7ff3cc=_[_0xc52d('0x3f')]({},_0x7ff3cc,_0x21b2df[_0xc52d('0x42')]);var _0x41c78f={'where':_0x7ff3cc[_0xc52d('0x3e')]};return db[_0xc52d('0x2d')]['count'](_0x41c78f)['then'](function(_0x5cabaf){_0x15f18d['count']=_0x5cabaf;if(_0x21b2df['query']['includeAll']){_0x7ff3cc[_0xc52d('0x43')]=[{'all':!![]}];}return db[_0xc52d('0x2d')][_0xc52d('0x44')](_0x7ff3cc);})['then'](function(_0x5d3da8){_0x15f18d[_0xc52d('0x45')]=_0x5d3da8;return _0x15f18d;})[_0xc52d('0x25')](respondWithFilteredResult(_0x32c1ee,_0x7ff3cc))[_0xc52d('0x46')](handleError(_0x32c1ee,null));};exports[_0xc52d('0x47')]=function(_0x3e0475,_0x52d28d){var _0x3370cc={'raw':![],'where':{'id':_0x3e0475[_0xc52d('0x48')]['id']}},_0x52b34c={};_0x52b34c['model']=_[_0xc52d('0x32')](db['SquareProject']['rawAttributes']);_0x52b34c[_0xc52d('0x33')]=_[_0xc52d('0x32')](_0x3e0475[_0xc52d('0x33')]);_0x52b34c[_0xc52d('0x3d')]=_[_0xc52d('0x34')](_0x52b34c[_0xc52d('0x35')],_0x52b34c[_0xc52d('0x33')]);_0x3370cc[_0xc52d('0x36')]=_['intersection'](_0x52b34c['model'],qs['fields'](_0x3e0475[_0xc52d('0x33')][_0xc52d('0x37')]));_0x3370cc[_0xc52d('0x36')]=_0x3370cc[_0xc52d('0x36')][_0xc52d('0x49')]?_0x3370cc[_0xc52d('0x36')]:_0x52b34c[_0xc52d('0x35')];if(_0x3e0475['query'][_0xc52d('0x4a')]){_0x3370cc[_0xc52d('0x43')]=[{'all':!![]}];}_0x3370cc=_[_0xc52d('0x3f')]({},_0x3370cc,_0x3e0475[_0xc52d('0x42')]);return db[_0xc52d('0x2d')][_0xc52d('0x4b')](_0x3370cc)[_0xc52d('0x25')](handleEntityNotFound(_0x52d28d,null))[_0xc52d('0x25')](respondWithResult(_0x52d28d,null))['catch'](handleError(_0x52d28d,null));};exports[_0xc52d('0x4c')]=function(_0x4d4b88,_0x209c07){return db[_0xc52d('0x2d')]['create'](_0x4d4b88[_0xc52d('0x4d')],{})[_0xc52d('0x25')](function(_0x37ba7f){var _0x268160=_0x4d4b88[_0xc52d('0x4e')][_0xc52d('0x27')]({'plain':!![]});if(!_0x268160)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x268160[_0xc52d('0x4f')]===_0xc52d('0x4e')){var _0x4caa3f=_0x37ba7f[_0xc52d('0x27')]({'plain':!![]});var _0x2ed2f5=_0xc52d('0x28');return db['UserProfileSection'][_0xc52d('0x4b')]({'where':{'name':_0x2ed2f5,'userProfileId':_0x268160[_0xc52d('0x50')]},'raw':!![]})['then'](function(_0x3eb8e8){if(_0x3eb8e8&&_0x3eb8e8[_0xc52d('0x51')]===0x0){return db[_0xc52d('0x52')][_0xc52d('0x4c')]({'name':_0x4caa3f['name'],'resourceId':_0x4caa3f['id'],'type':_0x3eb8e8[_0xc52d('0x29')],'sectionId':_0x3eb8e8['id']},{})['then'](function(){return _0x37ba7f;});}else{return _0x37ba7f;}})['catch'](function(_0x570ad7){logger[_0xc52d('0x53')](_0xc52d('0x54'),_0x570ad7);throw _0x570ad7;});}return _0x37ba7f;})[_0xc52d('0x25')](respondWithResult(_0x209c07,0xc9))[_0xc52d('0x46')](handleError(_0x209c07,null));};exports[_0xc52d('0x24')]=function(_0x34c84a,_0x4f50b4){if(_0x34c84a['body']['id']){delete _0x34c84a['body']['id'];}return db['SquareProject'][_0xc52d('0x4b')]({'where':{'id':_0x34c84a[_0xc52d('0x48')]['id']}})[_0xc52d('0x25')](handleEntityNotFound(_0x4f50b4,null))['then'](saveUpdates(_0x34c84a[_0xc52d('0x4d')],null))['then'](respondWithResult(_0x4f50b4,null))['catch'](handleError(_0x4f50b4,null));};exports[_0xc52d('0x26')]=function(_0x312191,_0xa94735){return db[_0xc52d('0x2d')][_0xc52d('0x4b')]({'where':{'id':_0x312191[_0xc52d('0x48')]['id']}})[_0xc52d('0x25')](handleEntityNotFound(_0xa94735,null))['then'](removeEntity(_0xa94735,null))[_0xc52d('0x46')](handleError(_0xa94735,null));};exports[_0xc52d('0x55')]=function(_0x120529,_0x13c7f8,_0x44747f){return db['SquareProject'][_0xc52d('0x4b')]({'where':{'id':_0x120529[_0xc52d('0x48')]['id']}})[_0xc52d('0x25')](handleEntityNotFound(_0x13c7f8,null))['then'](function(_0x1c7c82){if(_0x1c7c82){return _0x1c7c82[_0xc52d('0x55')](_0x120529[_0xc52d('0x4d')][_0xc52d('0x56')],_['omit'](_0x120529['body'],[_0xc52d('0x56'),'id'])||{});}})[_0xc52d('0x25')](respondWithResult(_0x13c7f8,null))[_0xc52d('0x46')](handleError(_0x13c7f8,null));};exports[_0xc52d('0x57')]=function(_0x4a4d2c,_0x406cb0,_0x368248){return db[_0xc52d('0x2d')][_0xc52d('0x4b')]({'where':{'id':_0x4a4d2c[_0xc52d('0x48')]['id']}})[_0xc52d('0x25')](handleEntityNotFound(_0x406cb0,null))[_0xc52d('0x25')](function(_0x39b220){if(_0x39b220){return _0x39b220[_0xc52d('0x57')](_0x4a4d2c[_0xc52d('0x33')]['ids'])[_0xc52d('0x25')](function(){if(_[_0xc52d('0x58')](_0x4a4d2c[_0xc52d('0x33')][_0xc52d('0x56')])){for(var _0x4c30f2=0x0;_0x4c30f2<_0x4a4d2c[_0xc52d('0x33')]['ids'][_0xc52d('0x49')];_0x4c30f2+=0x1){socket[_0xc52d('0x59')](_0xc52d('0x5a'),{'UserId':Number(_0x4a4d2c[_0xc52d('0x33')]['ids'][_0x4c30f2]),'SquareProjectId':Number(_0x4a4d2c[_0xc52d('0x48')]['id'])});}}else{socket[_0xc52d('0x59')](_0xc52d('0x5a'),{'UserId':Number(_0x4a4d2c[_0xc52d('0x33')][_0xc52d('0x56')]),'SquareProjectId':Number(_0x4a4d2c['params']['id'])});}});}})[_0xc52d('0x25')](respondWithStatusCode(_0x406cb0,null))['catch'](handleError(_0x406cb0,null));};exports[_0xc52d('0x5b')]=function(_0x534693,_0x23ad36,_0x44687a){var _0xce2655={};var _0x434840={};var _0x4bfd44;var _0x6d2dd3;return db[_0xc52d('0x2d')][_0xc52d('0x5c')]({'where':{'id':_0x534693[_0xc52d('0x48')]['id']}})[_0xc52d('0x25')](handleEntityNotFound(_0x23ad36,null))[_0xc52d('0x25')](function(_0x3e1f53){if(_0x3e1f53){_0x4bfd44=_0x3e1f53;_0x434840['model']=_[_0xc52d('0x32')](db['User'][_0xc52d('0x2e')]);_0x434840['query']=_[_0xc52d('0x32')](_0x534693['query']);_0x434840[_0xc52d('0x3d')]=_[_0xc52d('0x34')](_0x434840['model'],_0x434840[_0xc52d('0x33')]);_0xce2655['attributes']=_[_0xc52d('0x34')](_0x434840[_0xc52d('0x35')],qs[_0xc52d('0x37')](_0x534693[_0xc52d('0x33')][_0xc52d('0x37')]));_0xce2655[_0xc52d('0x36')]=_0xce2655[_0xc52d('0x36')]['length']?_0xce2655[_0xc52d('0x36')]:_0x434840[_0xc52d('0x35')];_0xce2655[_0xc52d('0x3a')]=qs[_0xc52d('0x3b')](_0x534693[_0xc52d('0x33')][_0xc52d('0x3b')]);_0xce2655[_0xc52d('0x3e')]=qs[_0xc52d('0x3d')](_['pick'](_0x534693[_0xc52d('0x33')],_0x434840[_0xc52d('0x3d')]));if(_0x534693[_0xc52d('0x33')][_0xc52d('0x41')]){_0xce2655[_0xc52d('0x3e')]=_[_0xc52d('0x3f')](_0xce2655['where'],{'$or':_[_0xc52d('0x2c')](_0xce2655['attributes'],function(_0x576c89){var _0x104b62={};_0x104b62[_0x576c89]={'$like':'%'+_0x534693[_0xc52d('0x33')][_0xc52d('0x41')]+'%'};return _0x104b62;})});}_0xce2655=_[_0xc52d('0x3f')]({},_0xce2655,_0x534693[_0xc52d('0x42')]);return _0x4bfd44[_0xc52d('0x5b')](_0xce2655);}})['then'](function(_0x423cfd){if(_0x423cfd){_0x6d2dd3=_0x423cfd[_0xc52d('0x49')];if(!_0x534693['query']['hasOwnProperty'](_0xc52d('0x39'))){_0xce2655[_0xc52d('0x1c')]=qs[_0xc52d('0x1c')](_0x534693[_0xc52d('0x33')][_0xc52d('0x1c')]);_0xce2655[_0xc52d('0x1e')]=qs[_0xc52d('0x1e')](_0x534693[_0xc52d('0x33')][_0xc52d('0x1e')]);}return _0x4bfd44[_0xc52d('0x5b')](_0xce2655);}})[_0xc52d('0x25')](function(_0x3805f1){if(_0x3805f1){return _0x3805f1?{'count':_0x6d2dd3,'rows':_0x3805f1}:null;}})['then'](respondWithResult(_0x23ad36,null))[_0xc52d('0x46')](handleError(_0x23ad36,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index a7dc094..3e8d65d 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 _0x9252=['emit','hasOwnProperty','hook','exports','../../mysqldb','SquareProject','save','remove'];(function(_0x330723,_0x8de382){var _0x60c546=function(_0xd6d3fe){while(--_0xd6d3fe){_0x330723['push'](_0x330723['shift']());}};_0x60c546(++_0x8de382);}(_0x9252,0x164));var _0x2925=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9252[_0x5d2803];return _0xdcad2c;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x2925('0x0'))['db'][_0x2925('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2925('0x2'),'afterUpdate':'update','afterDestroy':_0x2925('0x3')};function emitEvent(_0x5a825e){return function(_0x14fc60,_0x43ddab,_0x356246){SquareProjectEvents[_0x2925('0x4')](_0x5a825e+':'+_0x14fc60['id'],_0x14fc60);SquareProjectEvents['emit'](_0x5a825e,_0x14fc60);_0x356246(null);};}for(var e in events){if(events[_0x2925('0x5')](e)){var event=events[e];SquareProject[_0x2925('0x6')](e,emitEvent(event));}}module[_0x2925('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0xf6fe=['exports','events','../../mysqldb','SquareProject','save','update','remove','emit','hasOwnProperty','hook'];(function(_0xe1b5f6,_0x210c09){var _0x44636e=function(_0x3a3212){while(--_0x3a3212){_0xe1b5f6['push'](_0xe1b5f6['shift']());}};_0x44636e(++_0x210c09);}(_0xf6fe,0x8d));var _0xef6f=function(_0x3c8065,_0x314d86){_0x3c8065=_0x3c8065-0x0;var _0x598da9=_0xf6fe[_0x3c8065];return _0x598da9;};'use strict';var EventEmitter=require(_0xef6f('0x0'));var SquareProject=require(_0xef6f('0x1'))['db'][_0xef6f('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xef6f('0x3'),'afterUpdate':_0xef6f('0x4'),'afterDestroy':_0xef6f('0x5')};function emitEvent(_0x1a6d89){return function(_0x301ac9,_0x8282f8,_0x26e113){SquareProjectEvents['emit'](_0x1a6d89+':'+_0x301ac9['id'],_0x301ac9);SquareProjectEvents[_0xef6f('0x6')](_0x1a6d89,_0x301ac9);_0x26e113(null);};}for(var e in events){if(events[_0xef6f('0x7')](e)){var event=events[e];SquareProject[_0xef6f('0x8')](e,emitEvent(event));}}module[_0xef6f('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 14f7b36..8771153 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 _0x08f6=['changed','production','publishedAt','lodash','util','request-promise','path','rimraf','./squareProject.attributes','define','SquareProject','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5c2831,_0x33a580){var _0x36ac43=function(_0x52e503){while(--_0x52e503){_0x5c2831['push'](_0x5c2831['shift']());}};_0x36ac43(++_0x33a580);}(_0x08f6,0xc6));var _0x608f=function(_0x130d82,_0x25f49b){_0x130d82=_0x130d82-0x0;var _0x112070=_0x08f6[_0x130d82];return _0x112070;};'use strict';var _=require(_0x608f('0x0'));var util=require(_0x608f('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x608f('0x2'));var fs=require('fs');var path=require(_0x608f('0x3'));var rimraf=require(_0x608f('0x4'));var config=require('../../config/environment');var attributes=require(_0x608f('0x5'));module['exports']=function(_0xe2671,_0x4d6eb3){return _0xe2671[_0x608f('0x6')](_0x608f('0x7'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x88eabb,_0x3a2c8f,_0x4218ae){if(_0x88eabb['changed'](_0x608f('0x8'))){_0x88eabb[_0x608f('0x9')]=moment()[_0x608f('0xa')](_0x608f('0xb'));}if(_0x88eabb[_0x608f('0xc')](_0x608f('0xd'))){_0x88eabb[_0x608f('0xe')]=moment()[_0x608f('0xa')](_0x608f('0xb'));}_0x4218ae(null,_0x88eabb);}}});}; \ No newline at end of file +var _0xa197=['publishedAt','format','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','SquareProject','square_projects','changed','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','production'];(function(_0x48f244,_0x127d1d){var _0x55bac7=function(_0x13d842){while(--_0x13d842){_0x48f244['push'](_0x48f244['shift']());}};_0x55bac7(++_0x127d1d);}(_0xa197,0x1a4));var _0x7a19=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xa197[_0x2b7764];return _0x848dcb;};'use strict';var _=require(_0x7a19('0x0'));var util=require('util');var logger=require(_0x7a19('0x1'))(_0x7a19('0x2'));var moment=require(_0x7a19('0x3'));var BPromise=require('bluebird');var rp=require(_0x7a19('0x4'));var fs=require('fs');var path=require(_0x7a19('0x5'));var rimraf=require(_0x7a19('0x6'));var config=require(_0x7a19('0x7'));var attributes=require(_0x7a19('0x8'));module[_0x7a19('0x9')]=function(_0x568cfe,_0x576c8f){return _0x568cfe['define'](_0x7a19('0xa'),attributes,{'tableName':_0x7a19('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x674de8,_0x3e7a9a,_0x1616b9){if(_0x674de8[_0x7a19('0xc')](_0x7a19('0xd'))){_0x674de8[_0x7a19('0xe')]=moment()['format'](_0x7a19('0xf'));}if(_0x674de8[_0x7a19('0xc')](_0x7a19('0x10'))){_0x674de8[_0x7a19('0x11')]=moment()[_0x7a19('0x12')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1616b9(null,_0x674de8);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 66044a5..b92b276 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 _0x632e=['SquareProject,\x20%s,\x20%s,\x20%s','error','code','SquareProject,\x20%s,\x20%s','message','result','catch','SquareProject','options','raw','where','attributes','include','map','model','ShowSquareProject','stringify','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./squareProject.socket','register','request','then','info','request\x20sent','debug'];(function(_0x12d573,_0x20ae28){var _0x5c7071=function(_0x16ea02){while(--_0x16ea02){_0x12d573['push'](_0x12d573['shift']());}};_0x5c7071(++_0x20ae28);}(_0x632e,0x1b3));var _0xe632=function(_0x5c2e5e,_0x2bc00e){_0x5c2e5e=_0x5c2e5e-0x0;var _0x46a5da=_0x632e[_0x5c2e5e];return _0x46a5da;};'use strict';var _=require(_0xe632('0x0'));var util=require('util');var moment=require(_0xe632('0x1'));var BPromise=require(_0xe632('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe632('0x3'));var db=require(_0xe632('0x4'))['db'];var utils=require(_0xe632('0x5'));var logger=require(_0xe632('0x6'))(_0xe632('0x7'));var config=require(_0xe632('0x8'));var jayson=require(_0xe632('0x9'));var client=jayson[_0xe632('0xa')][_0xe632('0xb')]({'port':0x232a});config[_0xe632('0xc')]=_[_0xe632('0xd')](config[_0xe632('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe632('0xc')]));require(_0xe632('0xe'))[_0xe632('0xf')](socket);function respondWithRpcPromise(_0x3f2610,_0x341879,_0x296767){return new BPromise(function(_0x1c1c30,_0x522657){return client[_0xe632('0x10')](_0x3f2610,_0x296767)[_0xe632('0x11')](function(_0x69240c){logger[_0xe632('0x12')]('SquareProject,\x20%s,\x20%s',_0x341879,_0xe632('0x13'));logger[_0xe632('0x14')](_0xe632('0x15'),_0x341879,'request\x20sent',JSON['stringify'](_0x69240c));if(_0x69240c[_0xe632('0x16')]){if(_0x69240c[_0xe632('0x16')][_0xe632('0x17')]===0x1f4){logger[_0xe632('0x16')](_0xe632('0x18'),_0x341879,_0x69240c[_0xe632('0x16')][_0xe632('0x19')]);return _0x522657(_0x69240c[_0xe632('0x16')][_0xe632('0x19')]);}logger[_0xe632('0x16')](_0xe632('0x18'),_0x341879,_0x69240c['error'][_0xe632('0x19')]);return _0x1c1c30(_0x69240c[_0xe632('0x16')][_0xe632('0x19')]);}else{logger[_0xe632('0x12')](_0xe632('0x18'),_0x341879,_0xe632('0x13'));_0x1c1c30(_0x69240c[_0xe632('0x1a')][_0xe632('0x19')]);}})[_0xe632('0x1b')](function(_0x9fcf53){logger[_0xe632('0x16')](_0xe632('0x18'),_0x341879,_0x9fcf53);_0x522657(_0x9fcf53);});});}exports['ShowSquareProject']=function(_0x5306ba){var _0x5e93aa=this;return new Promise(function(_0x4bc62e,_0x536c8c){return db[_0xe632('0x1c')]['find']({'raw':_0x5306ba['options']?_0x5306ba[_0xe632('0x1d')][_0xe632('0x1e')]===undefined?!![]:![]:!![],'where':_0x5306ba[_0xe632('0x1d')]?_0x5306ba[_0xe632('0x1d')][_0xe632('0x1f')]||null:null,'attributes':_0x5306ba['options']?_0x5306ba['options'][_0xe632('0x20')]||null:null,'include':_0x5306ba[_0xe632('0x1d')]?_0x5306ba[_0xe632('0x1d')][_0xe632('0x21')]?_[_0xe632('0x22')](_0x5306ba[_0xe632('0x1d')][_0xe632('0x21')],function(_0x5f0370){return{'model':db[_0x5f0370[_0xe632('0x23')]],'as':_0x5f0370['as'],'attributes':_0x5f0370[_0xe632('0x20')],'include':_0x5f0370[_0xe632('0x21')]?_[_0xe632('0x22')](_0x5f0370[_0xe632('0x21')],function(_0x31d269){return{'model':db[_0x31d269[_0xe632('0x23')]],'as':_0x31d269['as'],'attributes':_0x31d269[_0xe632('0x20')],'include':_0x31d269['include']?_[_0xe632('0x22')](_0x31d269[_0xe632('0x21')],function(_0x5d6dfa){return{'model':db[_0x5d6dfa[_0xe632('0x23')]],'as':_0x5d6dfa['as'],'attributes':_0x5d6dfa[_0xe632('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe632('0x11')](function(_0x35e21f){logger['info'](_0xe632('0x24'),_0x5306ba);logger[_0xe632('0x14')](_0xe632('0x24'),_0x5306ba,JSON[_0xe632('0x25')](_0x35e21f));_0x4bc62e(_0x35e21f);})[_0xe632('0x1b')](function(_0x38737d){logger[_0xe632('0x16')](_0xe632('0x24'),_0x38737d[_0xe632('0x19')],_0x5306ba);_0x536c8c(_0x5e93aa[_0xe632('0x16')](0x1f4,_0x38737d['message']));});});}; \ No newline at end of file +var _0x4b04=['register','request','then','SquareProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowSquareProject','SquareProject','find','options','raw','where','include','model','attributes','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket'];(function(_0x2cd1fb,_0x291f55){var _0x48fd2b=function(_0x18e23e){while(--_0x18e23e){_0x2cd1fb['push'](_0x2cd1fb['shift']());}};_0x48fd2b(++_0x291f55);}(_0x4b04,0xed));var _0x44b0=function(_0x455bcb,_0x2707d6){_0x455bcb=_0x455bcb-0x0;var _0x5f900=_0x4b04[_0x455bcb];return _0x5f900;};'use strict';var _=require(_0x44b0('0x0'));var util=require(_0x44b0('0x1'));var moment=require(_0x44b0('0x2'));var BPromise=require('bluebird');var rs=require(_0x44b0('0x3'));var fs=require('fs');var Redis=require(_0x44b0('0x4'));var db=require(_0x44b0('0x5'))['db'];var utils=require(_0x44b0('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x44b0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x44b0('0x8')][_0x44b0('0x9')]({'port':0x232a});config[_0x44b0('0xa')]=_[_0x44b0('0xb')](config[_0x44b0('0xa')],{'host':_0x44b0('0xc'),'port':0x18eb});var socket=require(_0x44b0('0xd'))(new Redis(config[_0x44b0('0xa')]));require(_0x44b0('0xe'))[_0x44b0('0xf')](socket);function respondWithRpcPromise(_0x48820b,_0xc8cb9b,_0x341199){return new BPromise(function(_0x1fc5d1,_0x39d8a7){return client[_0x44b0('0x10')](_0x48820b,_0x341199)[_0x44b0('0x11')](function(_0x5dff8f){logger['info'](_0x44b0('0x12'),_0xc8cb9b,_0x44b0('0x13'));logger[_0x44b0('0x14')]('SquareProject,\x20%s,\x20%s,\x20%s',_0xc8cb9b,'request\x20sent',JSON[_0x44b0('0x15')](_0x5dff8f));if(_0x5dff8f['error']){if(_0x5dff8f[_0x44b0('0x16')][_0x44b0('0x17')]===0x1f4){logger['error']('SquareProject,\x20%s,\x20%s',_0xc8cb9b,_0x5dff8f[_0x44b0('0x16')][_0x44b0('0x18')]);return _0x39d8a7(_0x5dff8f[_0x44b0('0x16')][_0x44b0('0x18')]);}logger[_0x44b0('0x16')](_0x44b0('0x12'),_0xc8cb9b,_0x5dff8f['error']['message']);return _0x1fc5d1(_0x5dff8f['error'][_0x44b0('0x18')]);}else{logger['info']('SquareProject,\x20%s,\x20%s',_0xc8cb9b,'request\x20sent');_0x1fc5d1(_0x5dff8f[_0x44b0('0x19')][_0x44b0('0x18')]);}})[_0x44b0('0x1a')](function(_0x3535e7){logger[_0x44b0('0x16')](_0x44b0('0x12'),_0xc8cb9b,_0x3535e7);_0x39d8a7(_0x3535e7);});});}exports[_0x44b0('0x1b')]=function(_0x41f541){var _0x53bda9=this;return new Promise(function(_0x5098bd,_0x3a3740){return db[_0x44b0('0x1c')][_0x44b0('0x1d')]({'raw':_0x41f541[_0x44b0('0x1e')]?_0x41f541['options'][_0x44b0('0x1f')]===undefined?!![]:![]:!![],'where':_0x41f541[_0x44b0('0x1e')]?_0x41f541[_0x44b0('0x1e')][_0x44b0('0x20')]||null:null,'attributes':_0x41f541['options']?_0x41f541['options']['attributes']||null:null,'include':_0x41f541['options']?_0x41f541[_0x44b0('0x1e')]['include']?_['map'](_0x41f541[_0x44b0('0x1e')][_0x44b0('0x21')],function(_0x13d36e){return{'model':db[_0x13d36e[_0x44b0('0x22')]],'as':_0x13d36e['as'],'attributes':_0x13d36e[_0x44b0('0x23')],'include':_0x13d36e[_0x44b0('0x21')]?_['map'](_0x13d36e['include'],function(_0x15ceb8){return{'model':db[_0x15ceb8[_0x44b0('0x22')]],'as':_0x15ceb8['as'],'attributes':_0x15ceb8[_0x44b0('0x23')],'include':_0x15ceb8[_0x44b0('0x21')]?_['map'](_0x15ceb8[_0x44b0('0x21')],function(_0x5d3d73){return{'model':db[_0x5d3d73[_0x44b0('0x22')]],'as':_0x5d3d73['as'],'attributes':_0x5d3d73['attributes']};}):[]};}):[]};}):[]:[]})[_0x44b0('0x11')](function(_0x5a8d82){logger['info']('ShowSquareProject',_0x41f541);logger['debug'](_0x44b0('0x1b'),_0x41f541,JSON[_0x44b0('0x15')](_0x5a8d82));_0x5098bd(_0x5a8d82);})[_0x44b0('0x1a')](function(_0x21dbd7){logger[_0x44b0('0x16')](_0x44b0('0x1b'),_0x21dbd7[_0x44b0('0x18')],_0x41f541);_0x3a3740(_0x53bda9['error'](0x1f4,_0x21dbd7['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 41a7c87..5e45925 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 _0x719a=['length','squareProject:','./squareProject.events','save','remove','emit','removeListener'];(function(_0x229b16,_0x432da1){var _0x934bd4=function(_0x4a4ed4){while(--_0x4a4ed4){_0x229b16['push'](_0x229b16['shift']());}};_0x934bd4(++_0x432da1);}(_0x719a,0x80));var _0xa719=function(_0x3d71d1,_0x4f10d0){_0x3d71d1=_0x3d71d1-0x0;var _0x5df68a=_0x719a[_0x3d71d1];return _0x5df68a;};'use strict';var SquareProjectEvents=require(_0xa719('0x0'));var events=[_0xa719('0x1'),_0xa719('0x2'),'update'];function createListener(_0x549e33,_0x5d06d0){return function(_0x54efce){_0x5d06d0[_0xa719('0x3')](_0x549e33,_0x54efce);};}function removeListener(_0x797368,_0x358cb3){return function(){SquareProjectEvents[_0xa719('0x4')](_0x797368,_0x358cb3);};}exports['register']=function(_0x2c4208){for(var _0x27126f=0x0,_0x4aada1=events[_0xa719('0x5')];_0x27126f<_0x4aada1;_0x27126f++){var _0x53fdd5=events[_0x27126f];var _0x508974=createListener(_0xa719('0x6')+_0x53fdd5,_0x2c4208);SquareProjectEvents['on'](_0x53fdd5,_0x508974);}}; \ No newline at end of file +var _0x4350=['remove','update','emit','removeListener','register','length','./squareProject.events','save'];(function(_0x510f51,_0x161448){var _0x3ef086=function(_0x43af09){while(--_0x43af09){_0x510f51['push'](_0x510f51['shift']());}};_0x3ef086(++_0x161448);}(_0x4350,0x86));var _0x0435=function(_0xbdb587,_0x1969c1){_0xbdb587=_0xbdb587-0x0;var _0x53923d=_0x4350[_0xbdb587];return _0x53923d;};'use strict';var SquareProjectEvents=require(_0x0435('0x0'));var events=[_0x0435('0x1'),_0x0435('0x2'),_0x0435('0x3')];function createListener(_0x2f5cf3,_0x44f716){return function(_0x22d647){_0x44f716[_0x0435('0x4')](_0x2f5cf3,_0x22d647);};}function removeListener(_0x1ca255,_0x52c1d3){return function(){SquareProjectEvents[_0x0435('0x5')](_0x1ca255,_0x52c1d3);};}exports[_0x0435('0x6')]=function(_0x4b87df){for(var _0x23d5bf=0x0,_0x4f501e=events[_0x0435('0x7')];_0x23d5bf<_0x4f501e;_0x23d5bf++){var _0x427cc9=events[_0x23d5bf];var _0x38ec53=createListener('squareProject:'+_0x427cc9,_0x4b87df);SquareProjectEvents['on'](_0x427cc9,_0x38ec53);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 3344b7a..eda77dd 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 _0xe14b=['Router','../../components/auth/service','./squareRecording.controller','get','isAuthenticated','index','/:id','download','post','delete','destroy','exports','multer','util','express'];(function(_0x1cdf2e,_0x1ff831){var _0x677952=function(_0x5752b7){while(--_0x5752b7){_0x1cdf2e['push'](_0x1cdf2e['shift']());}};_0x677952(++_0x1ff831);}(_0xe14b,0x93));var _0xbe14=function(_0x9b9e98,_0x372c4c){_0x9b9e98=_0x9b9e98-0x0;var _0x2893eb=_0xe14b[_0x9b9e98];return _0x2893eb;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['show']);router['get']('/:id/download',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')]('/',auth[_0xbe14('0x7')](),controller['create']);router['put'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0xc')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xd')]);module[_0xbe14('0xe')]=router; \ No newline at end of file +var _0x0295=['isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x0295,0x1f0));var _0x5029=function(_0x5d57c7,_0x3547be){_0x5d57c7=_0x5d57c7-0x0;var _0x2ee0ee=_0x0295[_0x5d57c7];return _0x2ee0ee;};'use strict';var multer=require(_0x5029('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5029('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5029('0x2'));var auth=require(_0x5029('0x3'));var interaction=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var controller=require(_0x5029('0x6'));router[_0x5029('0x7')]('/',auth[_0x5029('0x8')](),controller[_0x5029('0x9')]);router[_0x5029('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5029('0x7')]('/:id/download',auth[_0x5029('0x8')](),controller['download']);router[_0x5029('0xa')]('/',auth['isAuthenticated'](),controller[_0x5029('0xb')]);router[_0x5029('0xc')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0xe')]);router[_0x5029('0xf')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0x10')]);module[_0x5029('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 6dd0f48..994ee68 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 _0x425d=['getDataValue','savePath','substring','lastIndexOf','sequelize','STRING','VIRTUAL'];(function(_0x284019,_0x47c521){var _0x1c5fd5=function(_0x1c7e8e){while(--_0x1c7e8e){_0x284019['push'](_0x284019['shift']());}};_0x1c5fd5(++_0x47c521);}(_0x425d,0x1e0));var _0xd425=function(_0x4e7bb4,_0x42572c){_0x4e7bb4=_0x4e7bb4-0x0;var _0x456e48=_0x425d[_0x4e7bb4];return _0x456e48;};'use strict';var Sequelize=require(_0xd425('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xd425('0x1')]},'callerid':{'type':Sequelize[_0xd425('0x1')]},'calleridname':{'type':Sequelize[_0xd425('0x1')]},'context':{'type':Sequelize[_0xd425('0x1')]},'extension':{'type':Sequelize[_0xd425('0x1')]},'priority':{'type':Sequelize[_0xd425('0x1')]},'accountcode':{'type':Sequelize[_0xd425('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xd425('0x1')]},'saveName':{'type':Sequelize[_0xd425('0x1')]},'filename':{'type':Sequelize[_0xd425('0x1')]},'savePath':{'type':Sequelize[_0xd425('0x1')]},'format':{'type':Sequelize[_0xd425('0x2')],'get':function(){var _0x1d2ed0='';var _0x50b061=this[_0xd425('0x3')](_0xd425('0x4'));if(_0x50b061){_0x1d2ed0=_0x50b061[_0xd425('0x5')](_0x50b061[_0xd425('0x6')]('.'));}return _0x1d2ed0;}}}; \ No newline at end of file +var _0x5075=['savePath','sequelize','exports','STRING','VIRTUAL','getDataValue'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x5075,0x73));var _0x5507=function(_0x3fa4bd,_0x14a72d){_0x3fa4bd=_0x3fa4bd-0x0;var _0x358c95=_0x5075[_0x3fa4bd];return _0x358c95;};'use strict';var Sequelize=require(_0x5507('0x0'));module[_0x5507('0x1')]={'uniqueid':{'type':Sequelize[_0x5507('0x2')]},'callerid':{'type':Sequelize[_0x5507('0x2')]},'calleridname':{'type':Sequelize[_0x5507('0x2')]},'context':{'type':Sequelize[_0x5507('0x2')]},'extension':{'type':Sequelize[_0x5507('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x5507('0x2')]},'dnid':{'type':Sequelize[_0x5507('0x2')]},'projectName':{'type':Sequelize[_0x5507('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x5507('0x2')]},'format':{'type':Sequelize[_0x5507('0x3')],'get':function(){var _0x4c2d6d='';var _0x42c232=this[_0x5507('0x4')](_0x5507('0x5'));if(_0x42c232){_0x4c2d6d=_0x42c232['substring'](_0x42c232['lastIndexOf']('.'));}return _0x4c2d6d;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 494ac94..bce4ae0 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 _0xe6a6=['where','pick','filter','merge','includeAll','include','findAll','show','find','catch','create','body','params','download','../../components/encryptor','type','uniqueid','savePath','filename','format','%s.cypher','existsSync','secrets','Sequelize','ValidationError','extname','unlink','message','SquareRecording\x20not\x20found','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','destroy','then','end','error','stack','name','send','SquareRecording','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x43d28d,_0x249835){var _0x4c477e=function(_0x4d0c5f){while(--_0x4d0c5f){_0x43d28d['push'](_0x43d28d['shift']());}};_0x4c477e(++_0x249835);}(_0xe6a6,0x13c));var _0x6e6a=function(_0x228344,_0x440e68){_0x228344=_0x228344-0x0;var _0x6230c0=_0xe6a6[_0x228344];return _0x6230c0;};'use strict';var emlformat=require(_0x6e6a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6e6a('0x1'));var jsonpatch=require(_0x6e6a('0x2'));var rp=require(_0x6e6a('0x3'));var moment=require(_0x6e6a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6e6a('0x5'));var path=require(_0x6e6a('0x6'));var sox=require(_0x6e6a('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6e6a('0x8'));var squel=require(_0x6e6a('0x9'));var crypto=require(_0x6e6a('0xa'));var jsforce=require(_0x6e6a('0xb'));var deskjs=require(_0x6e6a('0xc'));var toCsv=require(_0x6e6a('0xd'));var querystring=require(_0x6e6a('0xe'));var Papa=require('papaparse');var Redis=require(_0x6e6a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6e6a('0x10'));var as=require(_0x6e6a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6e6a('0x12'))(_0x6e6a('0x13'));var utils=require('../../config/utils');var config=require(_0x6e6a('0x14'));var licenseUtil=require(_0x6e6a('0x15'));var db=require(_0x6e6a('0x16'))['db'];function respondWithStatusCode(_0x568cee,_0x219b51){_0x219b51=_0x219b51||0xcc;return function(_0x57c26f){if(_0x57c26f){return _0x568cee[_0x6e6a('0x17')](_0x219b51);}return _0x568cee['status'](_0x219b51)['end']();};}function respondWithResult(_0x15f535,_0x1625f9){_0x1625f9=_0x1625f9||0xc8;return function(_0x4506dc){if(_0x4506dc){return _0x15f535[_0x6e6a('0x18')](_0x1625f9)['json'](_0x4506dc);}};}function respondWithFilteredResult(_0x5b21f4,_0x300fdd){return function(_0x2280c4){if(_0x2280c4){var _0x447fa3=typeof _0x300fdd['offset']===_0x6e6a('0x19')&&typeof _0x300fdd[_0x6e6a('0x1a')]===_0x6e6a('0x19');var _0x355ffa=_0x2280c4[_0x6e6a('0x1b')];var _0x3d20de=_0x447fa3?0x0:_0x300fdd['offset'];var _0x443acd=_0x447fa3?_0x2280c4[_0x6e6a('0x1b')]:_0x300fdd[_0x6e6a('0x1c')]+_0x300fdd[_0x6e6a('0x1a')];var _0x2c1ab4;if(_0x443acd>=_0x355ffa){_0x443acd=_0x355ffa;_0x2c1ab4=0xc8;}else{_0x2c1ab4=0xce;}_0x5b21f4[_0x6e6a('0x18')](_0x2c1ab4);return _0x5b21f4[_0x6e6a('0x1d')](_0x6e6a('0x1e'),_0x3d20de+'-'+_0x443acd+'/'+_0x355ffa)[_0x6e6a('0x1f')](_0x2280c4);}return null;};}function patchUpdates(_0x5eed4f){return function(_0x2af4b8){try{jsonpatch[_0x6e6a('0x20')](_0x2af4b8,_0x5eed4f,!![]);}catch(_0x4a8f58){return BPromise[_0x6e6a('0x21')](_0x4a8f58);}return _0x2af4b8[_0x6e6a('0x22')]();};}function saveUpdates(_0x41dd53,_0x4a877b){return function(_0x5aa25d){if(_0x5aa25d){return _0x5aa25d['update'](_0x41dd53)['then'](function(_0x399afc){return _0x399afc;});}return null;};}function removeEntity(_0x4bdb69,_0x5838b8){return function(_0x4ec52e){if(_0x4ec52e){return _0x4ec52e[_0x6e6a('0x23')]()[_0x6e6a('0x24')](function(){_0x4bdb69[_0x6e6a('0x18')](0xcc)[_0x6e6a('0x25')]();});}};}function handleEntityNotFound(_0x216c06,_0x2bab95){return function(_0x2bb17d){if(!_0x2bb17d){_0x216c06[_0x6e6a('0x17')](0x194);}return _0x2bb17d;};}function handleError(_0x52ea91,_0x29175f){_0x29175f=_0x29175f||0x1f4;return function(_0x4ce14f){logger[_0x6e6a('0x26')](_0x4ce14f[_0x6e6a('0x27')]);if(_0x4ce14f[_0x6e6a('0x28')]){delete _0x4ce14f[_0x6e6a('0x28')];}_0x52ea91[_0x6e6a('0x18')](_0x29175f)[_0x6e6a('0x29')](_0x4ce14f);};}exports['index']=function(_0x4d858f,_0x226aa7){var _0x1095e3={},_0x22b1b8={},_0x373f13={'count':0x0,'rows':[]};var _0x387796=_['map'](db[_0x6e6a('0x2a')]['rawAttributes'],function(_0x53dae3){return{'name':_0x53dae3['fieldName'],'type':_0x53dae3['type'][_0x6e6a('0x2b')]};});_0x22b1b8[_0x6e6a('0x2c')]=_[_0x6e6a('0x2d')](_0x387796,_0x6e6a('0x28'));_0x22b1b8[_0x6e6a('0x2e')]=_[_0x6e6a('0x2f')](_0x4d858f[_0x6e6a('0x2e')]);_0x22b1b8[_0x6e6a('0x30')]=_[_0x6e6a('0x31')](_0x22b1b8['model'],_0x22b1b8['query']);_0x1095e3[_0x6e6a('0x32')]=_['intersection'](_0x22b1b8[_0x6e6a('0x2c')],qs[_0x6e6a('0x33')](_0x4d858f[_0x6e6a('0x2e')]['fields']));_0x1095e3[_0x6e6a('0x32')]=_0x1095e3[_0x6e6a('0x32')][_0x6e6a('0x34')]?_0x1095e3[_0x6e6a('0x32')]:_0x22b1b8[_0x6e6a('0x2c')];if(!_0x4d858f['query'][_0x6e6a('0x35')]('nolimit')){_0x1095e3[_0x6e6a('0x1a')]=qs[_0x6e6a('0x1a')](_0x4d858f['query'][_0x6e6a('0x1a')]);_0x1095e3[_0x6e6a('0x1c')]=qs[_0x6e6a('0x1c')](_0x4d858f[_0x6e6a('0x2e')]['offset']);}_0x1095e3[_0x6e6a('0x36')]=qs[_0x6e6a('0x37')](_0x4d858f[_0x6e6a('0x2e')][_0x6e6a('0x37')]);_0x1095e3[_0x6e6a('0x38')]=qs[_0x6e6a('0x30')](_[_0x6e6a('0x39')](_0x4d858f[_0x6e6a('0x2e')],_0x22b1b8[_0x6e6a('0x30')]),_0x387796);if(_0x4d858f['query'][_0x6e6a('0x3a')]){_0x1095e3[_0x6e6a('0x38')]=_[_0x6e6a('0x3b')](_0x1095e3['where'],{'$or':_[_0x6e6a('0x2d')](_0x387796,function(_0x484a55){if(_0x484a55['type']!=='VIRTUAL'){var _0xa18767={};_0xa18767[_0x484a55[_0x6e6a('0x28')]]={'$like':'%'+_0x4d858f[_0x6e6a('0x2e')][_0x6e6a('0x3a')]+'%'};return _0xa18767;}})});}_0x1095e3=_[_0x6e6a('0x3b')]({},_0x1095e3,_0x4d858f['options']);var _0x1f1741={'where':_0x1095e3[_0x6e6a('0x38')]};return db[_0x6e6a('0x2a')][_0x6e6a('0x1b')](_0x1f1741)[_0x6e6a('0x24')](function(_0x46c049){_0x373f13[_0x6e6a('0x1b')]=_0x46c049;if(_0x4d858f[_0x6e6a('0x2e')][_0x6e6a('0x3c')]){_0x1095e3[_0x6e6a('0x3d')]=[{'all':!![]}];}return db[_0x6e6a('0x2a')][_0x6e6a('0x3e')](_0x1095e3);})['then'](function(_0x46b71b){_0x373f13['rows']=_0x46b71b;return _0x373f13;})[_0x6e6a('0x24')](respondWithFilteredResult(_0x226aa7,_0x1095e3))['catch'](handleError(_0x226aa7,null));};exports[_0x6e6a('0x3f')]=function(_0x31cdda,_0x2b1461){var _0x37fdeb={'raw':!![],'where':{'id':_0x31cdda['params']['id']}},_0x370aef={};_0x370aef['model']=_[_0x6e6a('0x2f')](db[_0x6e6a('0x2a')]['rawAttributes']);_0x370aef[_0x6e6a('0x2e')]=_[_0x6e6a('0x2f')](_0x31cdda['query']);_0x370aef[_0x6e6a('0x30')]=_['intersection'](_0x370aef[_0x6e6a('0x2c')],_0x370aef[_0x6e6a('0x2e')]);_0x37fdeb[_0x6e6a('0x32')]=_['intersection'](_0x370aef['model'],qs[_0x6e6a('0x33')](_0x31cdda['query'][_0x6e6a('0x33')]));_0x37fdeb['attributes']=_0x37fdeb[_0x6e6a('0x32')]['length']?_0x37fdeb[_0x6e6a('0x32')]:_0x370aef['model'];if(_0x31cdda['query']['includeAll']){_0x37fdeb[_0x6e6a('0x3d')]=[{'all':!![]}];}_0x37fdeb=_[_0x6e6a('0x3b')]({},_0x37fdeb,_0x31cdda['options']);return db[_0x6e6a('0x2a')][_0x6e6a('0x40')](_0x37fdeb)[_0x6e6a('0x24')](handleEntityNotFound(_0x2b1461,null))['then'](respondWithResult(_0x2b1461,null))[_0x6e6a('0x41')](handleError(_0x2b1461,null));};exports[_0x6e6a('0x42')]=function(_0x2c78e3,_0x1f76de){return db[_0x6e6a('0x2a')]['create'](_0x2c78e3[_0x6e6a('0x43')],{})[_0x6e6a('0x24')](respondWithResult(_0x1f76de,0xc9))['catch'](handleError(_0x1f76de,null));};exports['update']=function(_0x504c5c,_0x111863){if(_0x504c5c['body']['id']){delete _0x504c5c[_0x6e6a('0x43')]['id'];}return db['SquareRecording']['find']({'where':{'id':_0x504c5c[_0x6e6a('0x44')]['id']}})[_0x6e6a('0x24')](handleEntityNotFound(_0x111863,null))[_0x6e6a('0x24')](saveUpdates(_0x504c5c['body'],null))[_0x6e6a('0x24')](respondWithResult(_0x111863,null))['catch'](handleError(_0x111863,null));};exports[_0x6e6a('0x45')]=function(_0x28bdec,_0x32e054,_0x46f24e){var _0x3a1305=require(_0x6e6a('0x46'));var _0x82fe1b=![];var _0x411545={};if(_0x28bdec[_0x6e6a('0x2e')]['type']&&_0x28bdec[_0x6e6a('0x2e')][_0x6e6a('0x47')]===_0x6e6a('0x48')){_0x411545[_0x6e6a('0x48')]=_0x28bdec['params']['id'];}else{_0x411545['id']=_0x28bdec[_0x6e6a('0x44')]['id'];}return db['SquareRecording'][_0x6e6a('0x40')]({'where':_0x411545,'attributes':['id',_0x6e6a('0x49'),_0x6e6a('0x4a')],'raw':!![]})[_0x6e6a('0x24')](handleEntityNotFound(_0x32e054,null))[_0x6e6a('0x24')](function(_0x52d3bc){if(_0x52d3bc){var _0x7a5506=_0x52d3bc['savePath'];var _0x44d7f3=util[_0x6e6a('0x4b')](_0x6e6a('0x4c'),_0x7a5506);if(fs[_0x6e6a('0x4d')](_0x44d7f3)){_0x82fe1b=!![];return _0x3a1305['decryptFile'](_0x44d7f3,_0x7a5506,config[_0x6e6a('0x4e')]['recording'])['then'](function(){return _0x52d3bc;});}return _0x52d3bc;}})['then'](function(_0x11bdfd){if(_0x11bdfd){var _0x23be73=_0x11bdfd[_0x6e6a('0x49')];if(!fs[_0x6e6a('0x4d')](_0x23be73)){throw new db[(_0x6e6a('0x4f'))][(_0x6e6a('0x50'))]('SquareRecording\x20not\x20found');}if(_0x11bdfd[_0x6e6a('0x4a')]){return _0x32e054[_0x6e6a('0x45')](_0x23be73,_0x11bdfd[_0x6e6a('0x4a')]+path[_0x6e6a('0x51')](_0x23be73),function(){if(_0x82fe1b){fs[_0x6e6a('0x52')](_0x23be73);}});}else{return _0x32e054[_0x6e6a('0x45')](_0x23be73,function(_0x30c26c){if(_0x82fe1b){fs[_0x6e6a('0x52')](_0x23be73);}});}}})[_0x6e6a('0x41')](function(_0x234470){if(_0x234470[_0x6e6a('0x53')]===_0x6e6a('0x54')){_0x32e054['status'](0x194)[_0x6e6a('0x29')](_0x6e6a('0x55'));}else{return handleError(_0x32e054,null);}});};exports[_0x6e6a('0x23')]=function(_0x1f68df,_0x215896){return db[_0x6e6a('0x2a')][_0x6e6a('0x40')]({'where':{'id':_0x1f68df['params']['id']}})[_0x6e6a('0x24')](function(_0x58d856){if(_[_0x6e6a('0x56')](_0x58d856)){throw new ReferenceError('Entity\x20not\x20found');}return _0x58d856;})[_0x6e6a('0x24')](function(_0x5685dd){var _0x226980=_0x5685dd[_0x6e6a('0x49')];logger[_0x6e6a('0x57')](_0x6e6a('0x58'),_0x226980);if(!_[_0x6e6a('0x56')](_0x5685dd['savePath'])&&fs['existsSync'](_0x226980)){logger[_0x6e6a('0x57')](_0x6e6a('0x59')+_0x226980+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x6e6a('0x5a')](_0x226980);}_0x226980=_0x226980+_0x6e6a('0x5b');if(!_[_0x6e6a('0x56')](_0x5685dd[_0x6e6a('0x49')])&&fs[_0x6e6a('0x4d')](_0x226980)){logger[_0x6e6a('0x57')](_0x6e6a('0x59')+_0x226980+_0x6e6a('0x5c'));fs[_0x6e6a('0x5a')](_0x226980);}return _0x5685dd;})[_0x6e6a('0x24')](function(_0x216a11){if(!_0x216a11)throw new InternalError();return _0x216a11[_0x6e6a('0x23')]();})['then'](function(){_0x215896[_0x6e6a('0x18')](0xcc)[_0x6e6a('0x25')]();})[_0x6e6a('0x41')](handleError(_0x215896,null));}; \ No newline at end of file +var _0xe480=['../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','save','destroy','then','sendStatus','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','key','model','query','attributes','intersection','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','includeAll','catch','show','params','keys','fields','find','create','body','update','download','../../components/encryptor','uniqueid','savePath','filename','format','decryptFile','secrets','existsSync','SquareRecording\x20not\x20found','unlink','message','Not\x20found','Entity\x20not\x20found','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','isNil','File:\x20\x22','unlinkSync','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x2dbd8c,_0x3cfe0){var _0x1c977e=function(_0x19fb80){while(--_0x19fb80){_0x2dbd8c['push'](_0x2dbd8c['shift']());}};_0x1c977e(++_0x3cfe0);}(_0xe480,0x158));var _0x0e48=function(_0x3114ef,_0x36e3ef){_0x3114ef=_0x3114ef-0x0;var _0x2ac8bf=_0xe480[_0x3114ef];return _0x2ac8bf;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0e48('0x0'));var jsonpatch=require(_0x0e48('0x1'));var rp=require(_0x0e48('0x2'));var moment=require(_0x0e48('0x3'));var BPromise=require(_0x0e48('0x4'));var Mustache=require(_0x0e48('0x5'));var util=require(_0x0e48('0x6'));var path=require(_0x0e48('0x7'));var sox=require(_0x0e48('0x8'));var csv=require('to-csv');var ejs=require(_0x0e48('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e48('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0e48('0xb'));var deskjs=require(_0x0e48('0xc'));var toCsv=require(_0x0e48('0xd'));var querystring=require(_0x0e48('0xe'));var Papa=require('papaparse');var Redis=require(_0x0e48('0xf'));var authService=require(_0x0e48('0x10'));var qs=require(_0x0e48('0x11'));var as=require(_0x0e48('0x12'));var hardwareService=require(_0x0e48('0x13'));var logger=require(_0x0e48('0x14'))(_0x0e48('0x15'));var utils=require('../../config/utils');var config=require(_0x0e48('0x16'));var licenseUtil=require(_0x0e48('0x17'));var db=require(_0x0e48('0x18'))['db'];function respondWithStatusCode(_0x4de5b1,_0x3ca8cc){_0x3ca8cc=_0x3ca8cc||0xcc;return function(_0x203184){if(_0x203184){return _0x4de5b1['sendStatus'](_0x3ca8cc);}return _0x4de5b1[_0x0e48('0x19')](_0x3ca8cc)[_0x0e48('0x1a')]();};}function respondWithResult(_0x442a7e,_0x15058c){_0x15058c=_0x15058c||0xc8;return function(_0x49fef2){if(_0x49fef2){return _0x442a7e['status'](_0x15058c)[_0x0e48('0x1b')](_0x49fef2);}};}function respondWithFilteredResult(_0x291021,_0x3fe827){return function(_0x5113bf){if(_0x5113bf){var _0x300536=typeof _0x3fe827[_0x0e48('0x1c')]===_0x0e48('0x1d')&&typeof _0x3fe827['limit']==='undefined';var _0x204aae=_0x5113bf['count'];var _0x71a196=_0x300536?0x0:_0x3fe827['offset'];var _0x22f237=_0x300536?_0x5113bf['count']:_0x3fe827['offset']+_0x3fe827[_0x0e48('0x1e')];var _0x4340af;if(_0x22f237>=_0x204aae){_0x22f237=_0x204aae;_0x4340af=0xc8;}else{_0x4340af=0xce;}_0x291021[_0x0e48('0x19')](_0x4340af);return _0x291021[_0x0e48('0x1f')](_0x0e48('0x20'),_0x71a196+'-'+_0x22f237+'/'+_0x204aae)[_0x0e48('0x1b')](_0x5113bf);}return null;};}function patchUpdates(_0xe20b7c){return function(_0x42c8e9){try{jsonpatch['apply'](_0x42c8e9,_0xe20b7c,!![]);}catch(_0x3c7e3b){return BPromise['reject'](_0x3c7e3b);}return _0x42c8e9[_0x0e48('0x21')]();};}function saveUpdates(_0x138b43,_0x3b9b50){return function(_0x1774da){if(_0x1774da){return _0x1774da['update'](_0x138b43)['then'](function(_0x38e615){return _0x38e615;});}return null;};}function removeEntity(_0x2e9e27,_0x6ffbbc){return function(_0x2ce11f){if(_0x2ce11f){return _0x2ce11f[_0x0e48('0x22')]()[_0x0e48('0x23')](function(){_0x2e9e27[_0x0e48('0x19')](0xcc)[_0x0e48('0x1a')]();});}};}function handleEntityNotFound(_0x9f49ce,_0x2e2dc1){return function(_0x1f61d3){if(!_0x1f61d3){_0x9f49ce[_0x0e48('0x24')](0x194);}return _0x1f61d3;};}function handleError(_0x3aaa8c,_0xacacdb){_0xacacdb=_0xacacdb||0x1f4;return function(_0x111762){logger['error'](_0x111762[_0x0e48('0x25')]);if(_0x111762[_0x0e48('0x26')]){delete _0x111762[_0x0e48('0x26')];}_0x3aaa8c[_0x0e48('0x19')](_0xacacdb)[_0x0e48('0x27')](_0x111762);};}exports[_0x0e48('0x28')]=function(_0x24a115,_0x184c15){var _0x58c0f6={},_0x116e23={},_0x216472={'count':0x0,'rows':[]};var _0x402533=_[_0x0e48('0x29')](db[_0x0e48('0x2a')][_0x0e48('0x2b')],function(_0x208f53){return{'name':_0x208f53[_0x0e48('0x2c')],'type':_0x208f53['type'][_0x0e48('0x2d')]};});_0x116e23[_0x0e48('0x2e')]=_[_0x0e48('0x29')](_0x402533,_0x0e48('0x26'));_0x116e23[_0x0e48('0x2f')]=_['keys'](_0x24a115[_0x0e48('0x2f')]);_0x116e23['filters']=_['intersection'](_0x116e23[_0x0e48('0x2e')],_0x116e23[_0x0e48('0x2f')]);_0x58c0f6[_0x0e48('0x30')]=_[_0x0e48('0x31')](_0x116e23[_0x0e48('0x2e')],qs['fields'](_0x24a115['query']['fields']));_0x58c0f6[_0x0e48('0x30')]=_0x58c0f6[_0x0e48('0x30')]['length']?_0x58c0f6[_0x0e48('0x30')]:_0x116e23[_0x0e48('0x2e')];if(!_0x24a115[_0x0e48('0x2f')]['hasOwnProperty'](_0x0e48('0x32'))){_0x58c0f6['limit']=qs[_0x0e48('0x1e')](_0x24a115[_0x0e48('0x2f')][_0x0e48('0x1e')]);_0x58c0f6[_0x0e48('0x1c')]=qs[_0x0e48('0x1c')](_0x24a115[_0x0e48('0x2f')][_0x0e48('0x1c')]);}_0x58c0f6[_0x0e48('0x33')]=qs[_0x0e48('0x34')](_0x24a115[_0x0e48('0x2f')][_0x0e48('0x34')]);_0x58c0f6[_0x0e48('0x35')]=qs[_0x0e48('0x36')](_[_0x0e48('0x37')](_0x24a115['query'],_0x116e23[_0x0e48('0x36')]),_0x402533);if(_0x24a115[_0x0e48('0x2f')][_0x0e48('0x38')]){_0x58c0f6[_0x0e48('0x35')]=_[_0x0e48('0x39')](_0x58c0f6[_0x0e48('0x35')],{'$or':_['map'](_0x402533,function(_0x265297){if(_0x265297[_0x0e48('0x3a')]!==_0x0e48('0x3b')){var _0x105ccb={};_0x105ccb[_0x265297[_0x0e48('0x26')]]={'$like':'%'+_0x24a115[_0x0e48('0x2f')]['filter']+'%'};return _0x105ccb;}})});}_0x58c0f6=_[_0x0e48('0x39')]({},_0x58c0f6,_0x24a115[_0x0e48('0x3c')]);var _0x41814a={'where':_0x58c0f6[_0x0e48('0x35')]};return db[_0x0e48('0x2a')][_0x0e48('0x3d')](_0x41814a)[_0x0e48('0x23')](function(_0xc28a51){_0x216472[_0x0e48('0x3d')]=_0xc28a51;if(_0x24a115[_0x0e48('0x2f')][_0x0e48('0x3e')]){_0x58c0f6['include']=[{'all':!![]}];}return db[_0x0e48('0x2a')]['findAll'](_0x58c0f6);})[_0x0e48('0x23')](function(_0x1d3fa2){_0x216472['rows']=_0x1d3fa2;return _0x216472;})[_0x0e48('0x23')](respondWithFilteredResult(_0x184c15,_0x58c0f6))[_0x0e48('0x3f')](handleError(_0x184c15,null));};exports[_0x0e48('0x40')]=function(_0x236479,_0x4331bd){var _0x3ca79a={'raw':!![],'where':{'id':_0x236479[_0x0e48('0x41')]['id']}},_0xa4570f={};_0xa4570f['model']=_[_0x0e48('0x42')](db[_0x0e48('0x2a')]['rawAttributes']);_0xa4570f[_0x0e48('0x2f')]=_[_0x0e48('0x42')](_0x236479[_0x0e48('0x2f')]);_0xa4570f['filters']=_['intersection'](_0xa4570f[_0x0e48('0x2e')],_0xa4570f[_0x0e48('0x2f')]);_0x3ca79a[_0x0e48('0x30')]=_[_0x0e48('0x31')](_0xa4570f[_0x0e48('0x2e')],qs[_0x0e48('0x43')](_0x236479[_0x0e48('0x2f')][_0x0e48('0x43')]));_0x3ca79a['attributes']=_0x3ca79a['attributes']['length']?_0x3ca79a[_0x0e48('0x30')]:_0xa4570f[_0x0e48('0x2e')];if(_0x236479[_0x0e48('0x2f')][_0x0e48('0x3e')]){_0x3ca79a['include']=[{'all':!![]}];}_0x3ca79a=_['merge']({},_0x3ca79a,_0x236479[_0x0e48('0x3c')]);return db[_0x0e48('0x2a')][_0x0e48('0x44')](_0x3ca79a)[_0x0e48('0x23')](handleEntityNotFound(_0x4331bd,null))[_0x0e48('0x23')](respondWithResult(_0x4331bd,null))[_0x0e48('0x3f')](handleError(_0x4331bd,null));};exports[_0x0e48('0x45')]=function(_0x5561bc,_0x55f70e){return db[_0x0e48('0x2a')][_0x0e48('0x45')](_0x5561bc[_0x0e48('0x46')],{})[_0x0e48('0x23')](respondWithResult(_0x55f70e,0xc9))[_0x0e48('0x3f')](handleError(_0x55f70e,null));};exports[_0x0e48('0x47')]=function(_0x116705,_0x216b99){if(_0x116705['body']['id']){delete _0x116705[_0x0e48('0x46')]['id'];}return db['SquareRecording']['find']({'where':{'id':_0x116705[_0x0e48('0x41')]['id']}})[_0x0e48('0x23')](handleEntityNotFound(_0x216b99,null))[_0x0e48('0x23')](saveUpdates(_0x116705[_0x0e48('0x46')],null))['then'](respondWithResult(_0x216b99,null))['catch'](handleError(_0x216b99,null));};exports[_0x0e48('0x48')]=function(_0x2dee52,_0x5ad95a,_0xa7bd0d){var _0x54d3c5=require(_0x0e48('0x49'));var _0x44e4cc=![];var _0x134b15={};if(_0x2dee52['query'][_0x0e48('0x3a')]&&_0x2dee52[_0x0e48('0x2f')]['type']==='uniqueid'){_0x134b15[_0x0e48('0x4a')]=_0x2dee52[_0x0e48('0x41')]['id'];}else{_0x134b15['id']=_0x2dee52[_0x0e48('0x41')]['id'];}return db['SquareRecording'][_0x0e48('0x44')]({'where':_0x134b15,'attributes':['id',_0x0e48('0x4b'),_0x0e48('0x4c')],'raw':!![]})[_0x0e48('0x23')](handleEntityNotFound(_0x5ad95a,null))['then'](function(_0x54c4d4){if(_0x54c4d4){var _0xb934f4=_0x54c4d4[_0x0e48('0x4b')];var _0x52aa6f=util[_0x0e48('0x4d')]('%s.cypher',_0xb934f4);if(fs['existsSync'](_0x52aa6f)){_0x44e4cc=!![];return _0x54d3c5[_0x0e48('0x4e')](_0x52aa6f,_0xb934f4,config[_0x0e48('0x4f')]['recording'])[_0x0e48('0x23')](function(){return _0x54c4d4;});}return _0x54c4d4;}})[_0x0e48('0x23')](function(_0x1c736e){if(_0x1c736e){var _0x13c289=_0x1c736e[_0x0e48('0x4b')];if(!fs[_0x0e48('0x50')](_0x13c289)){throw new db['Sequelize']['ValidationError'](_0x0e48('0x51'));}if(_0x1c736e[_0x0e48('0x4c')]){return _0x5ad95a[_0x0e48('0x48')](_0x13c289,_0x1c736e[_0x0e48('0x4c')]+path['extname'](_0x13c289),function(){if(_0x44e4cc){fs[_0x0e48('0x52')](_0x13c289);}});}else{return _0x5ad95a[_0x0e48('0x48')](_0x13c289,function(_0x39d7b6){if(_0x44e4cc){fs[_0x0e48('0x52')](_0x13c289);}});}}})['catch'](function(_0x1429d){if(_0x1429d[_0x0e48('0x53')]===_0x0e48('0x51')){_0x5ad95a['status'](0x194)[_0x0e48('0x27')](_0x0e48('0x54'));}else{return handleError(_0x5ad95a,null);}});};exports[_0x0e48('0x22')]=function(_0x1ad2a2,_0x44e471){return db['SquareRecording'][_0x0e48('0x44')]({'where':{'id':_0x1ad2a2[_0x0e48('0x41')]['id']}})[_0x0e48('0x23')](function(_0x22236e){if(_['isNil'](_0x22236e)){throw new ReferenceError(_0x0e48('0x55'));}return _0x22236e;})[_0x0e48('0x23')](function(_0x98ffc4){var _0x51ccbd=_0x98ffc4['savePath'];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x51ccbd);if(!_['isNil'](_0x98ffc4[_0x0e48('0x4b')])&&fs['existsSync'](_0x51ccbd)){logger[_0x0e48('0x56')]('File:\x20\x22'+_0x51ccbd+_0x0e48('0x57'));fs['unlinkSync'](_0x51ccbd);}_0x51ccbd=_0x51ccbd+'.cypher';if(!_[_0x0e48('0x58')](_0x98ffc4[_0x0e48('0x4b')])&&fs['existsSync'](_0x51ccbd)){logger[_0x0e48('0x56')](_0x0e48('0x59')+_0x51ccbd+_0x0e48('0x57'));fs[_0x0e48('0x5a')](_0x51ccbd);}return _0x98ffc4;})[_0x0e48('0x23')](function(_0x5292ff){if(!_0x5292ff)throw new InternalError();return _0x5292ff[_0x0e48('0x22')]();})[_0x0e48('0x23')](function(){_0x44e471['status'](0xcc)[_0x0e48('0x1a')]();})[_0x0e48('0x3f')](handleError(_0x44e471,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 9b586f2..9ba45e0 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 _0x032e=['./squareRecording.attributes','exports','SquareRecording','square_recordings','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0x032e,0x1cc));var _0xe032=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x032e[_0x4e9628];return _0x27bc8c;};'use strict';var _=require('lodash');var util=require(_0xe032('0x0'));var logger=require(_0xe032('0x1'))(_0xe032('0x2'));var moment=require(_0xe032('0x3'));var BPromise=require(_0xe032('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe032('0x5'));var rimraf=require(_0xe032('0x6'));var config=require(_0xe032('0x7'));var attributes=require(_0xe032('0x8'));module[_0xe032('0x9')]=function(_0x43dc81,_0x20da91){return _0x43dc81['define'](_0xe032('0xa'),attributes,{'tableName':_0xe032('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd69e=['../../config/logger','moment','bluebird','./squareRecording.attributes','define','SquareRecording','square_recordings','lodash','util'];(function(_0x448e8d,_0x43a056){var _0x46e774=function(_0x22f0be){while(--_0x22f0be){_0x448e8d['push'](_0x448e8d['shift']());}};_0x46e774(++_0x43a056);}(_0xd69e,0xa0));var _0xed69=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xd69e[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xed69('0x0'));var util=require(_0xed69('0x1'));var logger=require(_0xed69('0x2'))('api');var moment=require(_0xed69('0x3'));var BPromise=require(_0xed69('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xed69('0x5'));module['exports']=function(_0x5c6d8f,_0x1c85d5){return _0x5c6d8f[_0xed69('0x6')](_0xed69('0x7'),attributes,{'tableName':_0xed69('0x8'),'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 82a1810..3fe7ad5 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 _0xbf60=['message','info','result','catch','CreateSquareRecording','create','body','options','raw','then','debug','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','http','request','SquareRecording,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xbf60,0x182));var _0x0bf6=function(_0x3f1a8a,_0x5e6b68){_0x3f1a8a=_0x3f1a8a-0x0;var _0x3e34da=_0xbf60[_0x3f1a8a];return _0x3e34da;};'use strict';var _=require(_0x0bf6('0x0'));var util=require(_0x0bf6('0x1'));var moment=require(_0x0bf6('0x2'));var BPromise=require(_0x0bf6('0x3'));var rs=require(_0x0bf6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0bf6('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x0bf6('0x6'));var jayson=require(_0x0bf6('0x7'));var client=jayson['client'][_0x0bf6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2417ee,_0x27e32c,_0x5da7e1){return new BPromise(function(_0x5d3d60,_0x4f4819){return client[_0x0bf6('0x9')](_0x2417ee,_0x5da7e1)['then'](function(_0x428cb3){logger['info'](_0x0bf6('0xa'),_0x27e32c,'request\x20sent');logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x27e32c,_0x0bf6('0xb'),JSON[_0x0bf6('0xc')](_0x428cb3));if(_0x428cb3['error']){if(_0x428cb3[_0x0bf6('0xd')]['code']===0x1f4){logger['error'](_0x0bf6('0xa'),_0x27e32c,_0x428cb3[_0x0bf6('0xd')]['message']);return _0x4f4819(_0x428cb3['error'][_0x0bf6('0xe')]);}logger[_0x0bf6('0xd')](_0x0bf6('0xa'),_0x27e32c,_0x428cb3['error'][_0x0bf6('0xe')]);return _0x5d3d60(_0x428cb3[_0x0bf6('0xd')][_0x0bf6('0xe')]);}else{logger[_0x0bf6('0xf')](_0x0bf6('0xa'),_0x27e32c,'request\x20sent');_0x5d3d60(_0x428cb3[_0x0bf6('0x10')]['message']);}})[_0x0bf6('0x11')](function(_0x195714){logger[_0x0bf6('0xd')](_0x0bf6('0xa'),_0x27e32c,_0x195714);_0x4f4819(_0x195714);});});}exports[_0x0bf6('0x12')]=function(_0x4a41cf){var _0x578259=this;return new Promise(function(_0x249416,_0x2a2608){return db['SquareRecording'][_0x0bf6('0x13')](_0x4a41cf[_0x0bf6('0x14')],{'raw':_0x4a41cf[_0x0bf6('0x15')]?_0x4a41cf[_0x0bf6('0x15')][_0x0bf6('0x16')]===undefined?!![]:![]:!![]})[_0x0bf6('0x17')](function(_0x1d968d){logger[_0x0bf6('0xf')](_0x0bf6('0x12'),_0x4a41cf);logger[_0x0bf6('0x18')](_0x0bf6('0x12'),_0x4a41cf,JSON[_0x0bf6('0xc')](_0x1d968d));_0x249416(_0x1d968d);})[_0x0bf6('0x11')](function(_0x8ae0d){logger['error'](_0x0bf6('0x12'),_0x8ae0d[_0x0bf6('0xe')],_0x4a41cf);_0x2a2608(_0x578259[_0x0bf6('0xd')](0x1f4,_0x8ae0d[_0x0bf6('0xe')]));});});}; \ No newline at end of file +var _0xbb30=['moment','ioredis','../../config/utils','rpc','../../config/environment','client','http','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareRecording','body','options','raw','catch','lodash','util'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xbb30,0x1f2));var _0x0bb3=function(_0x2f8aa2,_0x548f3b){_0x2f8aa2=_0x2f8aa2-0x0;var _0x551fe9=_0xbb30[_0x2f8aa2];return _0x551fe9;};'use strict';var _=require(_0x0bb3('0x0'));var util=require(_0x0bb3('0x1'));var moment=require(_0x0bb3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0bb3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0bb3('0x4'));var logger=require('../../config/logger')(_0x0bb3('0x5'));var config=require(_0x0bb3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0bb3('0x7')][_0x0bb3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12959f,_0x5dc1e0,_0x584655){return new BPromise(function(_0x171660,_0x50a636){return client['request'](_0x12959f,_0x584655)[_0x0bb3('0x9')](function(_0x5f08a0){logger[_0x0bb3('0xa')](_0x0bb3('0xb'),_0x5dc1e0,_0x0bb3('0xc'));logger[_0x0bb3('0xd')](_0x0bb3('0xe'),_0x5dc1e0,_0x0bb3('0xc'),JSON[_0x0bb3('0xf')](_0x5f08a0));if(_0x5f08a0[_0x0bb3('0x10')]){if(_0x5f08a0[_0x0bb3('0x10')][_0x0bb3('0x11')]===0x1f4){logger[_0x0bb3('0x10')]('SquareRecording,\x20%s,\x20%s',_0x5dc1e0,_0x5f08a0[_0x0bb3('0x10')]['message']);return _0x50a636(_0x5f08a0[_0x0bb3('0x10')][_0x0bb3('0x12')]);}logger[_0x0bb3('0x10')](_0x0bb3('0xb'),_0x5dc1e0,_0x5f08a0[_0x0bb3('0x10')]['message']);return _0x171660(_0x5f08a0['error']['message']);}else{logger[_0x0bb3('0xa')](_0x0bb3('0xb'),_0x5dc1e0,_0x0bb3('0xc'));_0x171660(_0x5f08a0[_0x0bb3('0x13')][_0x0bb3('0x12')]);}})['catch'](function(_0x15fd8a){logger[_0x0bb3('0x10')](_0x0bb3('0xb'),_0x5dc1e0,_0x15fd8a);_0x50a636(_0x15fd8a);});});}exports[_0x0bb3('0x14')]=function(_0x46ad9c){var _0x17a6d1=this;return new Promise(function(_0x34bb2b,_0xe2d26c){return db['SquareRecording']['create'](_0x46ad9c[_0x0bb3('0x15')],{'raw':_0x46ad9c[_0x0bb3('0x16')]?_0x46ad9c[_0x0bb3('0x16')][_0x0bb3('0x17')]===undefined?!![]:![]:!![]})[_0x0bb3('0x9')](function(_0x31c8e8){logger[_0x0bb3('0xa')](_0x0bb3('0x14'),_0x46ad9c);logger[_0x0bb3('0xd')](_0x0bb3('0x14'),_0x46ad9c,JSON[_0x0bb3('0xf')](_0x31c8e8));_0x34bb2b(_0x31c8e8);})[_0x0bb3('0x18')](function(_0x2a3a50){logger[_0x0bb3('0x10')](_0x0bb3('0x14'),_0x2a3a50['message'],_0x46ad9c);_0xe2d26c(_0x17a6d1['error'](0x1f4,_0x2a3a50[_0x0bb3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 1b305b6..32f9cc9 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x3c8bce,_0x18ef29){var _0x44e876=function(_0x92cfad){while(--_0x92cfad){_0x3c8bce['push'](_0x3c8bce['shift']());}};_0x44e876(++_0x18ef29);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0x4afac5,_0x1ab4ed){var _0x2404b3=function(_0x5c700b){while(--_0x5c700b){_0x4afac5['push'](_0x4afac5['shift']());}};_0x2404b3(++_0x1ab4ed);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 057bee7..c296392 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 _0xd2c4=['STRING','DATE','sequelize','exports'];(function(_0x45be8d,_0x365f2a){var _0x1a7740=function(_0x5aba28){while(--_0x5aba28){_0x45be8d['push'](_0x45be8d['shift']());}};_0x1a7740(++_0x365f2a);}(_0xd2c4,0x1ca));var _0x4d2c=function(_0x44976e,_0x311385){_0x44976e=_0x44976e-0x0;var _0x4852b2=_0xd2c4[_0x44976e];return _0x4852b2;};'use strict';var Sequelize=require(_0x4d2c('0x0'));module[_0x4d2c('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x4d2c('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4d2c('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4d2c('0x2')]},'uniqueid':{'type':Sequelize[_0x4d2c('0x2')]},'version':{'type':Sequelize[_0x4d2c('0x2')]},'callerid':{'type':Sequelize[_0x4d2c('0x2')]},'calleridname':{'type':Sequelize[_0x4d2c('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x4d2c('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x4d2c('0x2')]},'dnid':{'type':Sequelize[_0x4d2c('0x2')]},'rdnis':{'type':Sequelize[_0x4d2c('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x4d2c('0x2')]},'priority':{'type':Sequelize[_0x4d2c('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4d2c('0x2')]},'threadid':{'type':Sequelize[_0x4d2c('0x2')]},'project_name':{'type':Sequelize[_0x4d2c('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x4d2c('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x21fc=['BOOLEAN','exports','STRING','DATE'];(function(_0x44d853,_0x687284){var _0xfa3100=function(_0x571eba){while(--_0x571eba){_0x44d853['push'](_0x44d853['shift']());}};_0xfa3100(++_0x687284);}(_0x21fc,0x185));var _0xc21f=function(_0x4287fe,_0x14ad49){_0x4287fe=_0x4287fe-0x0;var _0x329a39=_0x21fc[_0x4287fe];return _0x329a39;};'use strict';var Sequelize=require('sequelize');module[_0xc21f('0x0')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xc21f('0x1')]},'channel':{'type':Sequelize[_0xc21f('0x1')]},'language':{'type':Sequelize[_0xc21f('0x1')]},'type':{'type':Sequelize[_0xc21f('0x1')]},'uniqueid':{'type':Sequelize[_0xc21f('0x1')]},'version':{'type':Sequelize[_0xc21f('0x1')]},'callerid':{'type':Sequelize[_0xc21f('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xc21f('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xc21f('0x1')]},'rdnis':{'type':Sequelize[_0xc21f('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xc21f('0x1')]},'priority':{'type':Sequelize[_0xc21f('0x1')]},'enhanced':{'type':Sequelize[_0xc21f('0x1')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0xc21f('0x1')]},'project_name':{'type':Sequelize[_0xc21f('0x1')]},'joinAt':{'type':Sequelize[_0xc21f('0x2')]},'leaveAt':{'type':Sequelize[_0xc21f('0x2')]},'bot':{'type':Sequelize[_0xc21f('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 e72d847..439f4c9 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 _0x9cb4=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','reject','save','then','destroy','end','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','VIRTUAL','options','include','rows','catch','show','params','keys','includeAll','find','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x20aee0,_0x29076f){var _0x26ba37=function(_0x3014ee){while(--_0x3014ee){_0x20aee0['push'](_0x20aee0['shift']());}};_0x26ba37(++_0x29076f);}(_0x9cb4,0xd9));var _0x49cb=function(_0x3fc388,_0x36668){_0x3fc388=_0x3fc388-0x0;var _0x36d7cd=_0x9cb4[_0x3fc388];return _0x36d7cd;};'use strict';var emlformat=require(_0x49cb('0x0'));var rimraf=require(_0x49cb('0x1'));var zipdir=require(_0x49cb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x49cb('0x3'));var moment=require(_0x49cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x49cb('0x5'));var util=require(_0x49cb('0x6'));var path=require(_0x49cb('0x7'));var sox=require(_0x49cb('0x8'));var csv=require('to-csv');var ejs=require(_0x49cb('0x9'));var fs=require('fs');var fs_extra=require(_0x49cb('0xa'));var _=require(_0x49cb('0xb'));var squel=require('squel');var crypto=require(_0x49cb('0xc'));var jsforce=require(_0x49cb('0xd'));var deskjs=require(_0x49cb('0xe'));var toCsv=require(_0x49cb('0xf'));var querystring=require(_0x49cb('0x10'));var Papa=require(_0x49cb('0x11'));var Redis=require(_0x49cb('0x12'));var authService=require(_0x49cb('0x13'));var qs=require(_0x49cb('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x49cb('0x15'));var logger=require(_0x49cb('0x16'))(_0x49cb('0x17'));var utils=require(_0x49cb('0x18'));var config=require(_0x49cb('0x19'));var licenseUtil=require(_0x49cb('0x1a'));var db=require(_0x49cb('0x1b'))['db'];function respondWithStatusCode(_0x13ca55,_0xba32be){_0xba32be=_0xba32be||0xcc;return function(_0x3d0890){if(_0x3d0890){return _0x13ca55[_0x49cb('0x1c')](_0xba32be);}return _0x13ca55['status'](_0xba32be)['end']();};}function respondWithResult(_0xb0efe5,_0xc73a58){_0xc73a58=_0xc73a58||0xc8;return function(_0x4cdfe2){if(_0x4cdfe2){return _0xb0efe5[_0x49cb('0x1d')](_0xc73a58)['json'](_0x4cdfe2);}};}function respondWithFilteredResult(_0x1a41f0,_0x2034d5){return function(_0x50f666){if(_0x50f666){var _0x40d454=typeof _0x2034d5['offset']===_0x49cb('0x1e')&&typeof _0x2034d5[_0x49cb('0x1f')]===_0x49cb('0x1e');var _0x2c4c5c=_0x50f666[_0x49cb('0x20')];var _0x5bb435=_0x40d454?0x0:_0x2034d5['offset'];var _0x252da6=_0x40d454?_0x50f666[_0x49cb('0x20')]:_0x2034d5[_0x49cb('0x21')]+_0x2034d5[_0x49cb('0x1f')];var _0x417d27;if(_0x252da6>=_0x2c4c5c){_0x252da6=_0x2c4c5c;_0x417d27=0xc8;}else{_0x417d27=0xce;}_0x1a41f0[_0x49cb('0x1d')](_0x417d27);return _0x1a41f0[_0x49cb('0x22')](_0x49cb('0x23'),_0x5bb435+'-'+_0x252da6+'/'+_0x2c4c5c)[_0x49cb('0x24')](_0x50f666);}return null;};}function patchUpdates(_0x214d4e){return function(_0xf2cc55){try{jsonpatch['apply'](_0xf2cc55,_0x214d4e,!![]);}catch(_0x58104c){return BPromise[_0x49cb('0x25')](_0x58104c);}return _0xf2cc55[_0x49cb('0x26')]();};}function saveUpdates(_0x595497,_0x142089){return function(_0x2a6219){if(_0x2a6219){return _0x2a6219['update'](_0x595497)[_0x49cb('0x27')](function(_0x5dff13){return _0x5dff13;});}return null;};}function removeEntity(_0x52ff96,_0x5a58f1){return function(_0x4efc52){if(_0x4efc52){return _0x4efc52[_0x49cb('0x28')]()['then'](function(){_0x52ff96[_0x49cb('0x1d')](0xcc)[_0x49cb('0x29')]();});}};}function handleEntityNotFound(_0x289d86,_0x50f3f4){return function(_0x9d4994){if(!_0x9d4994){_0x289d86['sendStatus'](0x194);}return _0x9d4994;};}function handleError(_0x285cab,_0x1d4308){_0x1d4308=_0x1d4308||0x1f4;return function(_0x195936){logger[_0x49cb('0x2a')](_0x195936[_0x49cb('0x2b')]);if(_0x195936[_0x49cb('0x2c')]){delete _0x195936[_0x49cb('0x2c')];}_0x285cab[_0x49cb('0x1d')](_0x1d4308)[_0x49cb('0x2d')](_0x195936);};}exports[_0x49cb('0x2e')]=function(_0x6011e3,_0x3c81dd){var _0x4fce8f={},_0xbd35e={},_0x543c79={'count':0x0,'rows':[]};var _0x4609dc=_[_0x49cb('0x2f')](db[_0x49cb('0x30')][_0x49cb('0x31')],function(_0xbd7c57){return{'name':_0xbd7c57[_0x49cb('0x32')],'type':_0xbd7c57[_0x49cb('0x33')][_0x49cb('0x34')]};});_0xbd35e['model']=_[_0x49cb('0x2f')](_0x4609dc,_0x49cb('0x2c'));_0xbd35e[_0x49cb('0x35')]=_['keys'](_0x6011e3['query']);_0xbd35e[_0x49cb('0x36')]=_['intersection'](_0xbd35e[_0x49cb('0x37')],_0xbd35e[_0x49cb('0x35')]);_0x4fce8f[_0x49cb('0x38')]=_[_0x49cb('0x39')](_0xbd35e[_0x49cb('0x37')],qs[_0x49cb('0x3a')](_0x6011e3[_0x49cb('0x35')][_0x49cb('0x3a')]));_0x4fce8f[_0x49cb('0x38')]=_0x4fce8f[_0x49cb('0x38')][_0x49cb('0x3b')]?_0x4fce8f[_0x49cb('0x38')]:_0xbd35e[_0x49cb('0x37')];if(!_0x6011e3[_0x49cb('0x35')][_0x49cb('0x3c')](_0x49cb('0x3d'))){_0x4fce8f[_0x49cb('0x1f')]=qs[_0x49cb('0x1f')](_0x6011e3[_0x49cb('0x35')][_0x49cb('0x1f')]);_0x4fce8f['offset']=qs[_0x49cb('0x21')](_0x6011e3['query']['offset']);}_0x4fce8f['order']=qs['sort'](_0x6011e3[_0x49cb('0x35')][_0x49cb('0x3e')]);_0x4fce8f['where']=qs[_0x49cb('0x36')](_['pick'](_0x6011e3[_0x49cb('0x35')],_0xbd35e[_0x49cb('0x36')]),_0x4609dc);if(_0x6011e3[_0x49cb('0x35')][_0x49cb('0x3f')]){_0x4fce8f['where']=_[_0x49cb('0x40')](_0x4fce8f[_0x49cb('0x41')],{'$or':_[_0x49cb('0x2f')](_0x4609dc,function(_0x29e5e){if(_0x29e5e[_0x49cb('0x33')]!==_0x49cb('0x42')){var _0x22de70={};_0x22de70[_0x29e5e[_0x49cb('0x2c')]]={'$like':'%'+_0x6011e3[_0x49cb('0x35')][_0x49cb('0x3f')]+'%'};return _0x22de70;}})});}_0x4fce8f=_[_0x49cb('0x40')]({},_0x4fce8f,_0x6011e3[_0x49cb('0x43')]);var _0x28199a={'where':_0x4fce8f[_0x49cb('0x41')]};return db[_0x49cb('0x30')]['count'](_0x28199a)[_0x49cb('0x27')](function(_0xb6af30){_0x543c79[_0x49cb('0x20')]=_0xb6af30;if(_0x6011e3['query']['includeAll']){_0x4fce8f[_0x49cb('0x44')]=[{'all':!![]}];}return db['SquareReport']['findAll'](_0x4fce8f);})[_0x49cb('0x27')](function(_0x33aa90){_0x543c79[_0x49cb('0x45')]=_0x33aa90;return _0x543c79;})[_0x49cb('0x27')](respondWithFilteredResult(_0x3c81dd,_0x4fce8f))[_0x49cb('0x46')](handleError(_0x3c81dd,null));};exports[_0x49cb('0x47')]=function(_0x5239b1,_0x3b8b7c){var _0x4c891f={'raw':!![],'where':{'id':_0x5239b1[_0x49cb('0x48')]['id']}},_0x23b139={};_0x23b139[_0x49cb('0x37')]=_[_0x49cb('0x49')](db[_0x49cb('0x30')]['rawAttributes']);_0x23b139[_0x49cb('0x35')]=_[_0x49cb('0x49')](_0x5239b1['query']);_0x23b139[_0x49cb('0x36')]=_[_0x49cb('0x39')](_0x23b139['model'],_0x23b139['query']);_0x4c891f['attributes']=_['intersection'](_0x23b139['model'],qs[_0x49cb('0x3a')](_0x5239b1['query'][_0x49cb('0x3a')]));_0x4c891f[_0x49cb('0x38')]=_0x4c891f[_0x49cb('0x38')][_0x49cb('0x3b')]?_0x4c891f['attributes']:_0x23b139[_0x49cb('0x37')];if(_0x5239b1[_0x49cb('0x35')][_0x49cb('0x4a')]){_0x4c891f[_0x49cb('0x44')]=[{'all':!![]}];}_0x4c891f=_[_0x49cb('0x40')]({},_0x4c891f,_0x5239b1[_0x49cb('0x43')]);return db['SquareReport'][_0x49cb('0x4b')](_0x4c891f)[_0x49cb('0x27')](handleEntityNotFound(_0x3b8b7c,null))[_0x49cb('0x27')](respondWithResult(_0x3b8b7c,null))[_0x49cb('0x46')](handleError(_0x3b8b7c,null));};exports['create']=function(_0x1303e1,_0x16242f){return db['SquareReport']['create'](_0x1303e1['body'],{})['then'](respondWithResult(_0x16242f,0xc9))['catch'](handleError(_0x16242f,null));};exports['update']=function(_0xb9606b,_0x191781){if(_0xb9606b[_0x49cb('0x4c')]['id']){delete _0xb9606b['body']['id'];}return db[_0x49cb('0x30')][_0x49cb('0x4b')]({'where':{'id':_0xb9606b[_0x49cb('0x48')]['id']}})[_0x49cb('0x27')](handleEntityNotFound(_0x191781,null))['then'](saveUpdates(_0xb9606b[_0x49cb('0x4c')],null))[_0x49cb('0x27')](respondWithResult(_0x191781,null))[_0x49cb('0x46')](handleError(_0x191781,null));};exports['destroy']=function(_0x5c90c2,_0x1d097a){return db[_0x49cb('0x30')][_0x49cb('0x4b')]({'where':{'id':_0x5c90c2[_0x49cb('0x48')]['id']}})['then'](handleEntityNotFound(_0x1d097a,null))['then'](removeEntity(_0x1d097a,null))[_0x49cb('0x46')](handleError(_0x1d097a,null));};exports[_0x49cb('0x4d')]=function(_0x4bcc4d,_0x569709){return db[_0x49cb('0x30')][_0x49cb('0x4d')]()[_0x49cb('0x27')](respondWithResult(_0x569709,null))['catch'](handleError(_0x569709,null));}; \ No newline at end of file +var _0xbdd5=['to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','update','destroy','then','error','stack','name','send','index','map','SquareReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','rawAttributes','length','include','find','create','body','describe','eml-format','rimraf','zip-dir','moment','mustache','path','sox'];(function(_0x505b68,_0x1549aa){var _0x6afe6e=function(_0x1f1476){while(--_0x1f1476){_0x505b68['push'](_0x505b68['shift']());}};_0x6afe6e(++_0x1549aa);}(_0xbdd5,0x1af));var _0x5bdd=function(_0x1c60a2,_0x2a6822){_0x1c60a2=_0x1c60a2-0x0;var _0x1a615d=_0xbdd5[_0x1c60a2];return _0x1a615d;};'use strict';var emlformat=require(_0x5bdd('0x0'));var rimraf=require(_0x5bdd('0x1'));var zipdir=require(_0x5bdd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5bdd('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5bdd('0x4'));var util=require('util');var path=require(_0x5bdd('0x5'));var sox=require(_0x5bdd('0x6'));var csv=require(_0x5bdd('0x7'));var ejs=require(_0x5bdd('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5bdd('0x9'));var squel=require(_0x5bdd('0xa'));var crypto=require(_0x5bdd('0xb'));var jsforce=require(_0x5bdd('0xc'));var deskjs=require(_0x5bdd('0xd'));var toCsv=require(_0x5bdd('0x7'));var querystring=require(_0x5bdd('0xe'));var Papa=require(_0x5bdd('0xf'));var Redis=require(_0x5bdd('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5bdd('0x11'));var logger=require(_0x5bdd('0x12'))('api');var utils=require(_0x5bdd('0x13'));var config=require(_0x5bdd('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x5bdd('0x15'))['db'];function respondWithStatusCode(_0x3305d2,_0x3f70a2){_0x3f70a2=_0x3f70a2||0xcc;return function(_0x34ec43){if(_0x34ec43){return _0x3305d2['sendStatus'](_0x3f70a2);}return _0x3305d2[_0x5bdd('0x16')](_0x3f70a2)[_0x5bdd('0x17')]();};}function respondWithResult(_0x1ec03b,_0x241875){_0x241875=_0x241875||0xc8;return function(_0x2cec17){if(_0x2cec17){return _0x1ec03b[_0x5bdd('0x16')](_0x241875)[_0x5bdd('0x18')](_0x2cec17);}};}function respondWithFilteredResult(_0x1161ce,_0xbe5f){return function(_0x5a0458){if(_0x5a0458){var _0x21bc23=typeof _0xbe5f[_0x5bdd('0x19')]===_0x5bdd('0x1a')&&typeof _0xbe5f[_0x5bdd('0x1b')]===_0x5bdd('0x1a');var _0x262607=_0x5a0458[_0x5bdd('0x1c')];var _0x158d9f=_0x21bc23?0x0:_0xbe5f[_0x5bdd('0x19')];var _0x19889c=_0x21bc23?_0x5a0458['count']:_0xbe5f[_0x5bdd('0x19')]+_0xbe5f[_0x5bdd('0x1b')];var _0x14f4ec;if(_0x19889c>=_0x262607){_0x19889c=_0x262607;_0x14f4ec=0xc8;}else{_0x14f4ec=0xce;}_0x1161ce[_0x5bdd('0x16')](_0x14f4ec);return _0x1161ce[_0x5bdd('0x1d')]('Content-Range',_0x158d9f+'-'+_0x19889c+'/'+_0x262607)[_0x5bdd('0x18')](_0x5a0458);}return null;};}function patchUpdates(_0x4a42c9){return function(_0x475f97){try{jsonpatch[_0x5bdd('0x1e')](_0x475f97,_0x4a42c9,!![]);}catch(_0x32fe69){return BPromise[_0x5bdd('0x1f')](_0x32fe69);}return _0x475f97['save']();};}function saveUpdates(_0x8593c1,_0x407fbd){return function(_0x25bbc5){if(_0x25bbc5){return _0x25bbc5[_0x5bdd('0x20')](_0x8593c1)['then'](function(_0x578769){return _0x578769;});}return null;};}function removeEntity(_0x2de36f,_0x453382){return function(_0x287527){if(_0x287527){return _0x287527[_0x5bdd('0x21')]()[_0x5bdd('0x22')](function(){_0x2de36f[_0x5bdd('0x16')](0xcc)[_0x5bdd('0x17')]();});}};}function handleEntityNotFound(_0x493f6e,_0x32026f){return function(_0x17e294){if(!_0x17e294){_0x493f6e['sendStatus'](0x194);}return _0x17e294;};}function handleError(_0x271362,_0x332504){_0x332504=_0x332504||0x1f4;return function(_0x4c827e){logger[_0x5bdd('0x23')](_0x4c827e[_0x5bdd('0x24')]);if(_0x4c827e[_0x5bdd('0x25')]){delete _0x4c827e['name'];}_0x271362[_0x5bdd('0x16')](_0x332504)[_0x5bdd('0x26')](_0x4c827e);};}exports[_0x5bdd('0x27')]=function(_0x3aac32,_0x5d4d89){var _0x555454={},_0x2fb55b={},_0x13a732={'count':0x0,'rows':[]};var _0x49ca12=_[_0x5bdd('0x28')](db[_0x5bdd('0x29')]['rawAttributes'],function(_0x414da7){return{'name':_0x414da7[_0x5bdd('0x2a')],'type':_0x414da7[_0x5bdd('0x2b')][_0x5bdd('0x2c')]};});_0x2fb55b[_0x5bdd('0x2d')]=_[_0x5bdd('0x28')](_0x49ca12,_0x5bdd('0x25'));_0x2fb55b['query']=_['keys'](_0x3aac32[_0x5bdd('0x2e')]);_0x2fb55b[_0x5bdd('0x2f')]=_[_0x5bdd('0x30')](_0x2fb55b[_0x5bdd('0x2d')],_0x2fb55b['query']);_0x555454[_0x5bdd('0x31')]=_[_0x5bdd('0x30')](_0x2fb55b['model'],qs[_0x5bdd('0x32')](_0x3aac32[_0x5bdd('0x2e')][_0x5bdd('0x32')]));_0x555454[_0x5bdd('0x31')]=_0x555454[_0x5bdd('0x31')]['length']?_0x555454[_0x5bdd('0x31')]:_0x2fb55b[_0x5bdd('0x2d')];if(!_0x3aac32['query'][_0x5bdd('0x33')](_0x5bdd('0x34'))){_0x555454['limit']=qs[_0x5bdd('0x1b')](_0x3aac32[_0x5bdd('0x2e')][_0x5bdd('0x1b')]);_0x555454[_0x5bdd('0x19')]=qs[_0x5bdd('0x19')](_0x3aac32[_0x5bdd('0x2e')][_0x5bdd('0x19')]);}_0x555454[_0x5bdd('0x35')]=qs['sort'](_0x3aac32[_0x5bdd('0x2e')]['sort']);_0x555454[_0x5bdd('0x36')]=qs['filters'](_[_0x5bdd('0x37')](_0x3aac32[_0x5bdd('0x2e')],_0x2fb55b[_0x5bdd('0x2f')]),_0x49ca12);if(_0x3aac32['query'][_0x5bdd('0x38')]){_0x555454[_0x5bdd('0x36')]=_[_0x5bdd('0x39')](_0x555454[_0x5bdd('0x36')],{'$or':_[_0x5bdd('0x28')](_0x49ca12,function(_0x4634e8){if(_0x4634e8['type']!==_0x5bdd('0x3a')){var _0x2fb1fc={};_0x2fb1fc[_0x4634e8[_0x5bdd('0x25')]]={'$like':'%'+_0x3aac32[_0x5bdd('0x2e')][_0x5bdd('0x38')]+'%'};return _0x2fb1fc;}})});}_0x555454=_[_0x5bdd('0x39')]({},_0x555454,_0x3aac32[_0x5bdd('0x3b')]);var _0x3ab521={'where':_0x555454['where']};return db['SquareReport'][_0x5bdd('0x1c')](_0x3ab521)['then'](function(_0x2d7770){_0x13a732[_0x5bdd('0x1c')]=_0x2d7770;if(_0x3aac32[_0x5bdd('0x2e')][_0x5bdd('0x3c')]){_0x555454['include']=[{'all':!![]}];}return db[_0x5bdd('0x29')][_0x5bdd('0x3d')](_0x555454);})[_0x5bdd('0x22')](function(_0x538de7){_0x13a732['rows']=_0x538de7;return _0x13a732;})[_0x5bdd('0x22')](respondWithFilteredResult(_0x5d4d89,_0x555454))[_0x5bdd('0x3e')](handleError(_0x5d4d89,null));};exports[_0x5bdd('0x3f')]=function(_0x576600,_0x2b3e58){var _0x591a74={'raw':!![],'where':{'id':_0x576600[_0x5bdd('0x40')]['id']}},_0x100086={};_0x100086[_0x5bdd('0x2d')]=_[_0x5bdd('0x41')](db['SquareReport'][_0x5bdd('0x42')]);_0x100086[_0x5bdd('0x2e')]=_[_0x5bdd('0x41')](_0x576600['query']);_0x100086[_0x5bdd('0x2f')]=_[_0x5bdd('0x30')](_0x100086[_0x5bdd('0x2d')],_0x100086[_0x5bdd('0x2e')]);_0x591a74[_0x5bdd('0x31')]=_[_0x5bdd('0x30')](_0x100086[_0x5bdd('0x2d')],qs[_0x5bdd('0x32')](_0x576600[_0x5bdd('0x2e')][_0x5bdd('0x32')]));_0x591a74[_0x5bdd('0x31')]=_0x591a74[_0x5bdd('0x31')][_0x5bdd('0x43')]?_0x591a74[_0x5bdd('0x31')]:_0x100086[_0x5bdd('0x2d')];if(_0x576600[_0x5bdd('0x2e')][_0x5bdd('0x3c')]){_0x591a74[_0x5bdd('0x44')]=[{'all':!![]}];}_0x591a74=_[_0x5bdd('0x39')]({},_0x591a74,_0x576600[_0x5bdd('0x3b')]);return db['SquareReport'][_0x5bdd('0x45')](_0x591a74)[_0x5bdd('0x22')](handleEntityNotFound(_0x2b3e58,null))['then'](respondWithResult(_0x2b3e58,null))[_0x5bdd('0x3e')](handleError(_0x2b3e58,null));};exports[_0x5bdd('0x46')]=function(_0x2e0a7e,_0x875077){return db[_0x5bdd('0x29')][_0x5bdd('0x46')](_0x2e0a7e['body'],{})[_0x5bdd('0x22')](respondWithResult(_0x875077,0xc9))['catch'](handleError(_0x875077,null));};exports[_0x5bdd('0x20')]=function(_0x435079,_0x50cb1a){if(_0x435079['body']['id']){delete _0x435079[_0x5bdd('0x47')]['id'];}return db['SquareReport'][_0x5bdd('0x45')]({'where':{'id':_0x435079['params']['id']}})[_0x5bdd('0x22')](handleEntityNotFound(_0x50cb1a,null))['then'](saveUpdates(_0x435079[_0x5bdd('0x47')],null))[_0x5bdd('0x22')](respondWithResult(_0x50cb1a,null))[_0x5bdd('0x3e')](handleError(_0x50cb1a,null));};exports[_0x5bdd('0x21')]=function(_0x1c6da6,_0x3ab06b){return db['SquareReport'][_0x5bdd('0x45')]({'where':{'id':_0x1c6da6[_0x5bdd('0x40')]['id']}})[_0x5bdd('0x22')](handleEntityNotFound(_0x3ab06b,null))[_0x5bdd('0x22')](removeEntity(_0x3ab06b,null))[_0x5bdd('0x3e')](handleError(_0x3ab06b,null));};exports[_0x5bdd('0x48')]=function(_0x3014db,_0x23c7ec){return db['SquareReport'][_0x5bdd('0x48')]()[_0x5bdd('0x22')](respondWithResult(_0x23c7ec,null))[_0x5bdd('0x3e')](handleError(_0x23c7ec,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 1bd2e47..71072c6 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 _0xf0d7=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./squareReport.attributes','exports','define','report_square','uid_pname','uniqueid','leaveAt'];(function(_0x1c776a,_0x2d93fa){var _0x560caa=function(_0xc093d4){while(--_0xc093d4){_0x1c776a['push'](_0x1c776a['shift']());}};_0x560caa(++_0x2d93fa);}(_0xf0d7,0x195));var _0x7f0d=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xf0d7[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7f0d('0x0'));var util=require(_0x7f0d('0x1'));var logger=require(_0x7f0d('0x2'))(_0x7f0d('0x3'));var moment=require('moment');var BPromise=require(_0x7f0d('0x4'));var rp=require(_0x7f0d('0x5'));var fs=require('fs');var path=require(_0x7f0d('0x6'));var rimraf=require(_0x7f0d('0x7'));var config=require('../../config/environment');var attributes=require(_0x7f0d('0x8'));module[_0x7f0d('0x9')]=function(_0x14955a,_0xc58be8){return _0x14955a[_0x7f0d('0xa')]('SquareReport',attributes,{'tableName':_0x7f0d('0xb'),'paranoid':![],'indexes':[{'name':_0x7f0d('0xc'),'fields':[_0x7f0d('0xd'),'project_name']},{'name':_0x7f0d('0xe'),'fields':[_0x7f0d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x316a=['SquareReport','report_square','uid_pname','project_name','leaveAt','lodash','util','moment','bluebird','rimraf','exports','define'];(function(_0xeb5f9,_0x36ff4d){var _0x43aba6=function(_0x4bf3cc){while(--_0x4bf3cc){_0xeb5f9['push'](_0xeb5f9['shift']());}};_0x43aba6(++_0x36ff4d);}(_0x316a,0x1c1));var _0xa316=function(_0x3fece6,_0x183c35){_0x3fece6=_0x3fece6-0x0;var _0x17712d=_0x316a[_0x3fece6];return _0x17712d;};'use strict';var _=require(_0xa316('0x0'));var util=require(_0xa316('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa316('0x2'));var BPromise=require(_0xa316('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa316('0x4'));var config=require('../../config/environment');var attributes=require('./squareReport.attributes');module[_0xa316('0x5')]=function(_0x2e0f94,_0x3b7946){return _0x2e0f94[_0xa316('0x6')](_0xa316('0x7'),attributes,{'tableName':_0xa316('0x8'),'paranoid':![],'indexes':[{'name':_0xa316('0x9'),'fields':['uniqueid',_0xa316('0xa')]},{'name':_0xa316('0xb'),'fields':[_0xa316('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 98d1ee7..087d7b6 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 _0x822a=['SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','SquareReport','body','options','UpdateSquareReport','raw','where','attributes','limit','then','stringify','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','request','info'];(function(_0x55e430,_0x34984b){var _0x228190=function(_0x37a0c3){while(--_0x37a0c3){_0x55e430['push'](_0x55e430['shift']());}};_0x228190(++_0x34984b);}(_0x822a,0xcf));var _0xa822=function(_0x2a0ab3,_0xcdddf1){_0x2a0ab3=_0x2a0ab3-0x0;var _0x73f2ad=_0x822a[_0x2a0ab3];return _0x73f2ad;};'use strict';var _=require(_0xa822('0x0'));var util=require(_0xa822('0x1'));var moment=require(_0xa822('0x2'));var BPromise=require('bluebird');var rs=require(_0xa822('0x3'));var fs=require('fs');var Redis=require(_0xa822('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa822('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xa822('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3d1caa,_0x2e244a,_0x44d39a){return new BPromise(function(_0x43e5d0,_0x1b309e){return client[_0xa822('0x7')](_0x3d1caa,_0x44d39a)['then'](function(_0x38f76e){logger[_0xa822('0x8')](_0xa822('0x9'),_0x2e244a,_0xa822('0xa'));logger[_0xa822('0xb')](_0xa822('0xc'),_0x2e244a,_0xa822('0xa'),JSON['stringify'](_0x38f76e));if(_0x38f76e['error']){if(_0x38f76e[_0xa822('0xd')][_0xa822('0xe')]===0x1f4){logger['error'](_0xa822('0x9'),_0x2e244a,_0x38f76e[_0xa822('0xd')][_0xa822('0xf')]);return _0x1b309e(_0x38f76e[_0xa822('0xd')][_0xa822('0xf')]);}logger['error'](_0xa822('0x9'),_0x2e244a,_0x38f76e[_0xa822('0xd')]['message']);return _0x43e5d0(_0x38f76e[_0xa822('0xd')][_0xa822('0xf')]);}else{logger[_0xa822('0x8')](_0xa822('0x9'),_0x2e244a,'request\x20sent');_0x43e5d0(_0x38f76e['result']['message']);}})[_0xa822('0x10')](function(_0x558230){logger[_0xa822('0xd')](_0xa822('0x9'),_0x2e244a,_0x558230);_0x1b309e(_0x558230);});});}exports['CreateSquareReport']=function(_0x8e081a){var _0x4b7a55=this;return new Promise(function(_0x364eb1,_0x58b974){return db[_0xa822('0x11')]['create'](_0x8e081a[_0xa822('0x12')],{'raw':_0x8e081a['options']?_0x8e081a[_0xa822('0x13')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x155aaa){logger['info']('CreateSquareReport',_0x8e081a);logger['debug']('CreateSquareReport',_0x8e081a,JSON['stringify'](_0x155aaa));_0x364eb1(_0x155aaa);})[_0xa822('0x10')](function(_0xea56f){logger['error']('CreateSquareReport',_0xea56f[_0xa822('0xf')],_0x8e081a);_0x58b974(_0x4b7a55['error'](0x1f4,_0xea56f[_0xa822('0xf')]));});});};exports[_0xa822('0x14')]=function(_0x56274a){var _0x4c27d3=this;return new Promise(function(_0x4e9315,_0x1ff374){return db[_0xa822('0x11')]['update'](_0x56274a[_0xa822('0x12')],{'raw':_0x56274a[_0xa822('0x13')]?_0x56274a['options'][_0xa822('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56274a['options']?_0x56274a[_0xa822('0x13')][_0xa822('0x16')]||null:null,'attributes':_0x56274a['options']?_0x56274a[_0xa822('0x13')][_0xa822('0x17')]||null:null,'limit':_0x56274a[_0xa822('0x13')]?_0x56274a[_0xa822('0x13')][_0xa822('0x18')]||null:null})[_0xa822('0x19')](function(_0x42cc55){logger[_0xa822('0x8')](_0xa822('0x14'),_0x56274a);logger[_0xa822('0xb')](_0xa822('0x14'),_0x56274a,JSON[_0xa822('0x1a')](_0x42cc55));_0x4e9315(_0x42cc55);})[_0xa822('0x10')](function(_0x208b23){logger[_0xa822('0xd')](_0xa822('0x14'),_0x208b23[_0xa822('0xf')],_0x56274a);_0x1ff374(_0x4c27d3[_0xa822('0xd')](0x1f4,_0x208b23[_0xa822('0xf')]));});});}; \ No newline at end of file +var _0xd1ae=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','body','options','raw','then','CreateSquareReport','UpdateSquareReport','SquareReport','update','where'];(function(_0x754ab4,_0x56daa7){var _0x34079a=function(_0x295ec1){while(--_0x295ec1){_0x754ab4['push'](_0x754ab4['shift']());}};_0x34079a(++_0x56daa7);}(_0xd1ae,0x1a4));var _0xed1a=function(_0x15035e,_0x2317a3){_0x15035e=_0x15035e-0x0;var _0x25eb10=_0xd1ae[_0x15035e];return _0x25eb10;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xed1a('0x0'));var BPromise=require(_0xed1a('0x1'));var rs=require(_0xed1a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xed1a('0x3'))['db'];var utils=require(_0xed1a('0x4'));var logger=require(_0xed1a('0x5'))(_0xed1a('0x6'));var config=require(_0xed1a('0x7'));var jayson=require(_0xed1a('0x8'));var client=jayson[_0xed1a('0x9')][_0xed1a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e9425,_0x4ae0cc,_0xb94723){return new BPromise(function(_0x999df4,_0x594a62){return client[_0xed1a('0xb')](_0x1e9425,_0xb94723)['then'](function(_0xf5ac){logger[_0xed1a('0xc')](_0xed1a('0xd'),_0x4ae0cc,_0xed1a('0xe'));logger[_0xed1a('0xf')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x4ae0cc,_0xed1a('0xe'),JSON[_0xed1a('0x10')](_0xf5ac));if(_0xf5ac['error']){if(_0xf5ac[_0xed1a('0x11')][_0xed1a('0x12')]===0x1f4){logger['error'](_0xed1a('0xd'),_0x4ae0cc,_0xf5ac['error']['message']);return _0x594a62(_0xf5ac['error'][_0xed1a('0x13')]);}logger[_0xed1a('0x11')](_0xed1a('0xd'),_0x4ae0cc,_0xf5ac[_0xed1a('0x11')]['message']);return _0x999df4(_0xf5ac[_0xed1a('0x11')][_0xed1a('0x13')]);}else{logger['info'](_0xed1a('0xd'),_0x4ae0cc,_0xed1a('0xe'));_0x999df4(_0xf5ac['result']['message']);}})[_0xed1a('0x14')](function(_0x2cca79){logger[_0xed1a('0x11')](_0xed1a('0xd'),_0x4ae0cc,_0x2cca79);_0x594a62(_0x2cca79);});});}exports['CreateSquareReport']=function(_0xde07d8){var _0x1ac33f=this;return new Promise(function(_0xc151d0,_0x40ec4e){return db['SquareReport']['create'](_0xde07d8[_0xed1a('0x15')],{'raw':_0xde07d8['options']?_0xde07d8[_0xed1a('0x16')][_0xed1a('0x17')]===undefined?!![]:![]:!![]})[_0xed1a('0x18')](function(_0x3ae8f2){logger[_0xed1a('0xc')](_0xed1a('0x19'),_0xde07d8);logger[_0xed1a('0xf')](_0xed1a('0x19'),_0xde07d8,JSON[_0xed1a('0x10')](_0x3ae8f2));_0xc151d0(_0x3ae8f2);})[_0xed1a('0x14')](function(_0x5d6b36){logger[_0xed1a('0x11')](_0xed1a('0x19'),_0x5d6b36[_0xed1a('0x13')],_0xde07d8);_0x40ec4e(_0x1ac33f[_0xed1a('0x11')](0x1f4,_0x5d6b36['message']));});});};exports[_0xed1a('0x1a')]=function(_0x4f5917){var _0x1cfe68=this;return new Promise(function(_0x283074,_0x512c18){return db[_0xed1a('0x1b')][_0xed1a('0x1c')](_0x4f5917[_0xed1a('0x15')],{'raw':_0x4f5917[_0xed1a('0x16')]?_0x4f5917[_0xed1a('0x16')][_0xed1a('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f5917[_0xed1a('0x16')]?_0x4f5917[_0xed1a('0x16')][_0xed1a('0x1d')]||null:null,'attributes':_0x4f5917['options']?_0x4f5917[_0xed1a('0x16')]['attributes']||null:null,'limit':_0x4f5917[_0xed1a('0x16')]?_0x4f5917[_0xed1a('0x16')]['limit']||null:null})[_0xed1a('0x18')](function(_0x802a){logger['info'](_0xed1a('0x1a'),_0x4f5917);logger[_0xed1a('0xf')]('UpdateSquareReport',_0x4f5917,JSON[_0xed1a('0x10')](_0x802a));_0x283074(_0x802a);})['catch'](function(_0x1f08b0){logger[_0xed1a('0x11')](_0xed1a('0x1a'),_0x1f08b0[_0xed1a('0x13')],_0x4f5917);_0x512c18(_0x1cfe68[_0xed1a('0x11')](0x1f4,_0x1f08b0['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index d1c1790..3ddeebb 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 _0x9451=['/:id','show','post','create','update','delete','destroy','multer','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','index','isAuthenticated','describe'];(function(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0x9451,0x15d));var _0x1945=function(_0x4e8147,_0x15717b){_0x4e8147=_0x4e8147-0x0;var _0x49285b=_0x9451[_0x4e8147];return _0x49285b;};'use strict';var multer=require(_0x1945('0x0'));var util=require('util');var path=require(_0x1945('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x1945('0x2'));var auth=require(_0x1945('0x3'));var interaction=require(_0x1945('0x4'));var config=require(_0x1945('0x5'));var controller=require(_0x1945('0x6'));router[_0x1945('0x7')]('/',auth['isAuthenticated'](),controller[_0x1945('0x8')]);router[_0x1945('0x7')]('/describe',auth[_0x1945('0x9')](),controller[_0x1945('0xa')]);router[_0x1945('0x7')](_0x1945('0xb'),auth[_0x1945('0x9')](),controller[_0x1945('0xc')]);router[_0x1945('0xd')]('/',auth[_0x1945('0x9')](),controller[_0x1945('0xe')]);router['put'](_0x1945('0xb'),auth[_0x1945('0x9')](),controller[_0x1945('0xf')]);router[_0x1945('0x10')](_0x1945('0xb'),auth['isAuthenticated'](),controller[_0x1945('0x11')]);module['exports']=router; \ No newline at end of file +var _0x37e5=['exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','get','index','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','delete'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x37e5,0x17b));var _0x537e=function(_0xf832f,_0x37e3ce){_0xf832f=_0xf832f-0x0;var _0x1fc929=_0x37e5[_0xf832f];return _0x1fc929;};'use strict';var multer=require('multer');var util=require(_0x537e('0x0'));var path=require(_0x537e('0x1'));var timeout=require('connect-timeout');var express=require(_0x537e('0x2'));var router=express[_0x537e('0x3')]();var fs_extra=require(_0x537e('0x4'));var auth=require(_0x537e('0x5'));var interaction=require(_0x537e('0x6'));var config=require('../../config/environment');var controller=require(_0x537e('0x7'));router[_0x537e('0x8')]('/',auth['isAuthenticated'](),controller[_0x537e('0x9')]);router[_0x537e('0x8')](_0x537e('0xa'),auth[_0x537e('0xb')](),controller[_0x537e('0xc')]);router[_0x537e('0x8')]('/:id',auth[_0x537e('0xb')](),controller[_0x537e('0xd')]);router[_0x537e('0xe')]('/',auth[_0x537e('0xb')](),controller[_0x537e('0xf')]);router[_0x537e('0x10')](_0x537e('0x11'),auth[_0x537e('0xb')](),controller[_0x537e('0x12')]);router[_0x537e('0x13')](_0x537e('0x11'),auth[_0x537e('0xb')](),controller['destroy']);module[_0x537e('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 99d3bfa..160a36d 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 _0x9f91=['STRING','TEXT','sequelize','exports'];(function(_0x1599cb,_0x5bb2e2){var _0x1b4c09=function(_0x42d6df){while(--_0x42d6df){_0x1599cb['push'](_0x1599cb['shift']());}};_0x1b4c09(++_0x5bb2e2);}(_0x9f91,0xbe));var _0x19f9=function(_0x2f3ecd,_0x57976b){_0x2f3ecd=_0x2f3ecd-0x0;var _0xffdc44=_0x9f91[_0x2f3ecd];return _0xffdc44;};'use strict';var Sequelize=require(_0x19f9('0x0'));module[_0x19f9('0x1')]={'uniqueid':{'type':Sequelize[_0x19f9('0x2')]},'node':{'type':Sequelize[_0x19f9('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x19f9('0x3')]},'project_name':{'type':Sequelize[_0x19f9('0x2')]},'callerid':{'type':Sequelize[_0x19f9('0x2')]}}; \ No newline at end of file +var _0x7f23=['sequelize','exports','STRING','TEXT'];(function(_0x4ee579,_0x4c84a6){var _0x11c73b=function(_0x3e0ea3){while(--_0x3e0ea3){_0x4ee579['push'](_0x4ee579['shift']());}};_0x11c73b(++_0x4c84a6);}(_0x7f23,0x184));var _0x37f2=function(_0x17103b,_0x2610df){_0x17103b=_0x17103b-0x0;var _0x2bc1a4=_0x7f23[_0x17103b];return _0x2bc1a4;};'use strict';var Sequelize=require(_0x37f2('0x0'));module[_0x37f2('0x1')]={'uniqueid':{'type':Sequelize[_0x37f2('0x2')]},'node':{'type':Sequelize[_0x37f2('0x2')]},'application':{'type':Sequelize[_0x37f2('0x2')]},'data':{'type':Sequelize[_0x37f2('0x3')]},'project_name':{'type':Sequelize[_0x37f2('0x2')]},'callerid':{'type':Sequelize[_0x37f2('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index a03c6c0..7b60f61 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 _0x8d97=['SquareDetailsReport','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','then','includeAll','include','findAll','rows','show','params','rawAttributes','catch','update','body','find','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','destroy','stack','name','index','map'];(function(_0x1eff09,_0x505cb0){var _0x2c442a=function(_0x276dff){while(--_0x276dff){_0x1eff09['push'](_0x1eff09['shift']());}};_0x2c442a(++_0x505cb0);}(_0x8d97,0x13c));var _0x78d9=function(_0x2abfe4,_0x32333e){_0x2abfe4=_0x2abfe4-0x0;var _0x5b90a0=_0x8d97[_0x2abfe4];return _0x5b90a0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x78d9('0x0'));var zipdir=require(_0x78d9('0x1'));var jsonpatch=require(_0x78d9('0x2'));var rp=require('request-promise');var moment=require(_0x78d9('0x3'));var BPromise=require(_0x78d9('0x4'));var Mustache=require(_0x78d9('0x5'));var util=require('util');var path=require(_0x78d9('0x6'));var sox=require('sox');var csv=require(_0x78d9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x78d9('0x8'));var _=require('lodash');var squel=require(_0x78d9('0x9'));var crypto=require(_0x78d9('0xa'));var jsforce=require(_0x78d9('0xb'));var deskjs=require(_0x78d9('0xc'));var toCsv=require(_0x78d9('0x7'));var querystring=require('querystring');var Papa=require(_0x78d9('0xd'));var Redis=require(_0x78d9('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x78d9('0xf'));var as=require(_0x78d9('0x10'));var hardwareService=require(_0x78d9('0x11'));var logger=require('../../config/logger')(_0x78d9('0x12'));var utils=require(_0x78d9('0x13'));var config=require(_0x78d9('0x14'));var licenseUtil=require(_0x78d9('0x15'));var db=require(_0x78d9('0x16'))['db'];function respondWithStatusCode(_0x5576fa,_0x364a4f){_0x364a4f=_0x364a4f||0xcc;return function(_0x160088){if(_0x160088){return _0x5576fa[_0x78d9('0x17')](_0x364a4f);}return _0x5576fa[_0x78d9('0x18')](_0x364a4f)[_0x78d9('0x19')]();};}function respondWithResult(_0x2656b1,_0x9f66a1){_0x9f66a1=_0x9f66a1||0xc8;return function(_0x3dc5ac){if(_0x3dc5ac){return _0x2656b1[_0x78d9('0x18')](_0x9f66a1)[_0x78d9('0x1a')](_0x3dc5ac);}};}function respondWithFilteredResult(_0x588a33,_0x4d2879){return function(_0x14fda8){if(_0x14fda8){var _0x39a9b7=typeof _0x4d2879[_0x78d9('0x1b')]===_0x78d9('0x1c')&&typeof _0x4d2879[_0x78d9('0x1d')]===_0x78d9('0x1c');var _0x5e1d37=_0x14fda8[_0x78d9('0x1e')];var _0x2d372e=_0x39a9b7?0x0:_0x4d2879['offset'];var _0x2e96ba=_0x39a9b7?_0x14fda8[_0x78d9('0x1e')]:_0x4d2879[_0x78d9('0x1b')]+_0x4d2879[_0x78d9('0x1d')];var _0x579514;if(_0x2e96ba>=_0x5e1d37){_0x2e96ba=_0x5e1d37;_0x579514=0xc8;}else{_0x579514=0xce;}_0x588a33[_0x78d9('0x18')](_0x579514);return _0x588a33[_0x78d9('0x1f')](_0x78d9('0x20'),_0x2d372e+'-'+_0x2e96ba+'/'+_0x5e1d37)[_0x78d9('0x1a')](_0x14fda8);}return null;};}function patchUpdates(_0x86bd29){return function(_0x4e83b2){try{jsonpatch['apply'](_0x4e83b2,_0x86bd29,!![]);}catch(_0xdd4949){return BPromise[_0x78d9('0x21')](_0xdd4949);}return _0x4e83b2['save']();};}function saveUpdates(_0x4b19f5,_0x173966){return function(_0x45e583){if(_0x45e583){return _0x45e583['update'](_0x4b19f5)['then'](function(_0x192c2e){return _0x192c2e;});}return null;};}function removeEntity(_0x46a496,_0x5d3a2a){return function(_0x28004e){if(_0x28004e){return _0x28004e[_0x78d9('0x22')]()['then'](function(){_0x46a496[_0x78d9('0x18')](0xcc)[_0x78d9('0x19')]();});}};}function handleEntityNotFound(_0x1c0ef0,_0x1f6095){return function(_0x39ec53){if(!_0x39ec53){_0x1c0ef0[_0x78d9('0x17')](0x194);}return _0x39ec53;};}function handleError(_0x17cd8f,_0x48c109){_0x48c109=_0x48c109||0x1f4;return function(_0xeb4d89){logger['error'](_0xeb4d89[_0x78d9('0x23')]);if(_0xeb4d89[_0x78d9('0x24')]){delete _0xeb4d89[_0x78d9('0x24')];}_0x17cd8f[_0x78d9('0x18')](_0x48c109)['send'](_0xeb4d89);};}exports[_0x78d9('0x25')]=function(_0x35f19b,_0x5256b6){var _0x789b7d={},_0xef1666={},_0x531ca2={'count':0x0,'rows':[]};var _0x3b6b7b=_[_0x78d9('0x26')](db[_0x78d9('0x27')]['rawAttributes'],function(_0x55d232){return{'name':_0x55d232[_0x78d9('0x28')],'type':_0x55d232[_0x78d9('0x29')]['key']};});_0xef1666['model']=_[_0x78d9('0x26')](_0x3b6b7b,'name');_0xef1666[_0x78d9('0x2a')]=_[_0x78d9('0x2b')](_0x35f19b[_0x78d9('0x2a')]);_0xef1666[_0x78d9('0x2c')]=_[_0x78d9('0x2d')](_0xef1666[_0x78d9('0x2e')],_0xef1666[_0x78d9('0x2a')]);_0x789b7d[_0x78d9('0x2f')]=_['intersection'](_0xef1666['model'],qs[_0x78d9('0x30')](_0x35f19b[_0x78d9('0x2a')][_0x78d9('0x30')]));_0x789b7d[_0x78d9('0x2f')]=_0x789b7d[_0x78d9('0x2f')]['length']?_0x789b7d['attributes']:_0xef1666[_0x78d9('0x2e')];if(!_0x35f19b[_0x78d9('0x2a')][_0x78d9('0x31')](_0x78d9('0x32'))){_0x789b7d[_0x78d9('0x1d')]=qs[_0x78d9('0x1d')](_0x35f19b[_0x78d9('0x2a')][_0x78d9('0x1d')]);_0x789b7d['offset']=qs['offset'](_0x35f19b[_0x78d9('0x2a')]['offset']);}_0x789b7d[_0x78d9('0x33')]=qs[_0x78d9('0x34')](_0x35f19b[_0x78d9('0x2a')][_0x78d9('0x34')]);_0x789b7d['where']=qs[_0x78d9('0x2c')](_[_0x78d9('0x35')](_0x35f19b['query'],_0xef1666[_0x78d9('0x2c')]),_0x3b6b7b);if(_0x35f19b[_0x78d9('0x2a')][_0x78d9('0x36')]){_0x789b7d[_0x78d9('0x37')]=_['merge'](_0x789b7d['where'],{'$or':_[_0x78d9('0x26')](_0x3b6b7b,function(_0x1ad51f){if(_0x1ad51f[_0x78d9('0x29')]!=='VIRTUAL'){var _0x288e98={};_0x288e98[_0x1ad51f[_0x78d9('0x24')]]={'$like':'%'+_0x35f19b[_0x78d9('0x2a')]['filter']+'%'};return _0x288e98;}})});}_0x789b7d=_[_0x78d9('0x38')]({},_0x789b7d,_0x35f19b[_0x78d9('0x39')]);var _0x5d3fc9={'where':_0x789b7d[_0x78d9('0x37')]};return db[_0x78d9('0x27')][_0x78d9('0x1e')](_0x5d3fc9)[_0x78d9('0x3a')](function(_0x4cd0a9){_0x531ca2[_0x78d9('0x1e')]=_0x4cd0a9;if(_0x35f19b[_0x78d9('0x2a')][_0x78d9('0x3b')]){_0x789b7d[_0x78d9('0x3c')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x78d9('0x3d')](_0x789b7d);})[_0x78d9('0x3a')](function(_0x526000){_0x531ca2[_0x78d9('0x3e')]=_0x526000;return _0x531ca2;})[_0x78d9('0x3a')](respondWithFilteredResult(_0x5256b6,_0x789b7d))['catch'](handleError(_0x5256b6,null));};exports[_0x78d9('0x3f')]=function(_0x56dd45,_0x5bf22e){var _0x5552dc={'raw':!![],'where':{'id':_0x56dd45[_0x78d9('0x40')]['id']}},_0x387b7f={};_0x387b7f[_0x78d9('0x2e')]=_[_0x78d9('0x2b')](db[_0x78d9('0x27')][_0x78d9('0x41')]);_0x387b7f['query']=_['keys'](_0x56dd45['query']);_0x387b7f[_0x78d9('0x2c')]=_['intersection'](_0x387b7f[_0x78d9('0x2e')],_0x387b7f[_0x78d9('0x2a')]);_0x5552dc[_0x78d9('0x2f')]=_[_0x78d9('0x2d')](_0x387b7f[_0x78d9('0x2e')],qs[_0x78d9('0x30')](_0x56dd45['query'][_0x78d9('0x30')]));_0x5552dc[_0x78d9('0x2f')]=_0x5552dc[_0x78d9('0x2f')]['length']?_0x5552dc['attributes']:_0x387b7f[_0x78d9('0x2e')];if(_0x56dd45[_0x78d9('0x2a')]['includeAll']){_0x5552dc[_0x78d9('0x3c')]=[{'all':!![]}];}_0x5552dc=_[_0x78d9('0x38')]({},_0x5552dc,_0x56dd45[_0x78d9('0x39')]);return db[_0x78d9('0x27')]['find'](_0x5552dc)['then'](handleEntityNotFound(_0x5bf22e,null))['then'](respondWithResult(_0x5bf22e,null))[_0x78d9('0x42')](handleError(_0x5bf22e,null));};exports['create']=function(_0x1e3bfe,_0x16da86){return db[_0x78d9('0x27')]['create'](_0x1e3bfe['body'],{})[_0x78d9('0x3a')](respondWithResult(_0x16da86,0xc9))[_0x78d9('0x42')](handleError(_0x16da86,null));};exports[_0x78d9('0x43')]=function(_0x23bb89,_0x377f25){if(_0x23bb89[_0x78d9('0x44')]['id']){delete _0x23bb89['body']['id'];}return db['SquareDetailsReport'][_0x78d9('0x45')]({'where':{'id':_0x23bb89[_0x78d9('0x40')]['id']}})[_0x78d9('0x3a')](handleEntityNotFound(_0x377f25,null))[_0x78d9('0x3a')](saveUpdates(_0x23bb89['body'],null))['then'](respondWithResult(_0x377f25,null))[_0x78d9('0x42')](handleError(_0x377f25,null));};exports[_0x78d9('0x22')]=function(_0x458eb0,_0x5b98c8){return db[_0x78d9('0x27')]['find']({'where':{'id':_0x458eb0[_0x78d9('0x40')]['id']}})[_0x78d9('0x3a')](handleEntityNotFound(_0x5b98c8,null))['then'](removeEntity(_0x5b98c8,null))[_0x78d9('0x42')](handleError(_0x5b98c8,null));};exports[_0x78d9('0x46')]=function(_0x4a20c9,_0x4a8aef){return db[_0x78d9('0x27')][_0x78d9('0x46')]()[_0x78d9('0x3a')](respondWithResult(_0x4a8aef,null))[_0x78d9('0x42')](handleError(_0x4a8aef,null));}; \ No newline at end of file +var _0x1626=['index','SquareDetailsReport','rawAttributes','type','key','model','map','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','keys','create','body','find','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1626,0x101));var _0x6162=function(_0x1e2080,_0x53283b){_0x1e2080=_0x1e2080-0x0;var _0x260111=_0x1626[_0x1e2080];return _0x260111;};'use strict';var emlformat=require(_0x6162('0x0'));var rimraf=require(_0x6162('0x1'));var zipdir=require(_0x6162('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6162('0x3'));var moment=require(_0x6162('0x4'));var BPromise=require(_0x6162('0x5'));var Mustache=require(_0x6162('0x6'));var util=require('util');var path=require(_0x6162('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6162('0x8'));var fs=require('fs');var fs_extra=require(_0x6162('0x9'));var _=require('lodash');var squel=require(_0x6162('0xa'));var crypto=require(_0x6162('0xb'));var jsforce=require(_0x6162('0xc'));var deskjs=require(_0x6162('0xd'));var toCsv=require(_0x6162('0xe'));var querystring=require(_0x6162('0xf'));var Papa=require(_0x6162('0x10'));var Redis=require(_0x6162('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6162('0x12'));var logger=require(_0x6162('0x13'))(_0x6162('0x14'));var utils=require('../../config/utils');var config=require(_0x6162('0x15'));var licenseUtil=require(_0x6162('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fcc4,_0x1be104){_0x1be104=_0x1be104||0xcc;return function(_0x19e6a7){if(_0x19e6a7){return _0x44fcc4[_0x6162('0x17')](_0x1be104);}return _0x44fcc4[_0x6162('0x18')](_0x1be104)[_0x6162('0x19')]();};}function respondWithResult(_0x4bad12,_0x6833d7){_0x6833d7=_0x6833d7||0xc8;return function(_0x59624a){if(_0x59624a){return _0x4bad12[_0x6162('0x18')](_0x6833d7)[_0x6162('0x1a')](_0x59624a);}};}function respondWithFilteredResult(_0x155c1e,_0x5d1aa5){return function(_0x26081b){if(_0x26081b){var _0x2899b1=typeof _0x5d1aa5[_0x6162('0x1b')]===_0x6162('0x1c')&&typeof _0x5d1aa5['limit']==='undefined';var _0x2c1e14=_0x26081b[_0x6162('0x1d')];var _0x710127=_0x2899b1?0x0:_0x5d1aa5[_0x6162('0x1b')];var _0x429b53=_0x2899b1?_0x26081b[_0x6162('0x1d')]:_0x5d1aa5[_0x6162('0x1b')]+_0x5d1aa5[_0x6162('0x1e')];var _0x3ae1f3;if(_0x429b53>=_0x2c1e14){_0x429b53=_0x2c1e14;_0x3ae1f3=0xc8;}else{_0x3ae1f3=0xce;}_0x155c1e[_0x6162('0x18')](_0x3ae1f3);return _0x155c1e[_0x6162('0x1f')](_0x6162('0x20'),_0x710127+'-'+_0x429b53+'/'+_0x2c1e14)[_0x6162('0x1a')](_0x26081b);}return null;};}function patchUpdates(_0x51b859){return function(_0x46c880){try{jsonpatch[_0x6162('0x21')](_0x46c880,_0x51b859,!![]);}catch(_0x443758){return BPromise[_0x6162('0x22')](_0x443758);}return _0x46c880[_0x6162('0x23')]();};}function saveUpdates(_0x184625,_0x5d3bac){return function(_0x5a1154){if(_0x5a1154){return _0x5a1154[_0x6162('0x24')](_0x184625)[_0x6162('0x25')](function(_0x443f1f){return _0x443f1f;});}return null;};}function removeEntity(_0x3f3f72,_0x2b3ff9){return function(_0x322985){if(_0x322985){return _0x322985[_0x6162('0x26')]()['then'](function(){_0x3f3f72[_0x6162('0x18')](0xcc)[_0x6162('0x19')]();});}};}function handleEntityNotFound(_0x48219f,_0xe99df1){return function(_0x14bd37){if(!_0x14bd37){_0x48219f['sendStatus'](0x194);}return _0x14bd37;};}function handleError(_0x25feb9,_0x4aafc2){_0x4aafc2=_0x4aafc2||0x1f4;return function(_0x4c02ec){logger[_0x6162('0x27')](_0x4c02ec[_0x6162('0x28')]);if(_0x4c02ec[_0x6162('0x29')]){delete _0x4c02ec[_0x6162('0x29')];}_0x25feb9['status'](_0x4aafc2)[_0x6162('0x2a')](_0x4c02ec);};}exports[_0x6162('0x2b')]=function(_0x431f90,_0x2210e3){var _0x5e7cde={},_0x54ef8c={},_0x41dd67={'count':0x0,'rows':[]};var _0x500be0=_['map'](db[_0x6162('0x2c')][_0x6162('0x2d')],function(_0x2108db){return{'name':_0x2108db['fieldName'],'type':_0x2108db[_0x6162('0x2e')][_0x6162('0x2f')]};});_0x54ef8c[_0x6162('0x30')]=_[_0x6162('0x31')](_0x500be0,_0x6162('0x29'));_0x54ef8c['query']=_['keys'](_0x431f90[_0x6162('0x32')]);_0x54ef8c['filters']=_[_0x6162('0x33')](_0x54ef8c[_0x6162('0x30')],_0x54ef8c['query']);_0x5e7cde[_0x6162('0x34')]=_[_0x6162('0x33')](_0x54ef8c[_0x6162('0x30')],qs[_0x6162('0x35')](_0x431f90[_0x6162('0x32')]['fields']));_0x5e7cde[_0x6162('0x34')]=_0x5e7cde[_0x6162('0x34')][_0x6162('0x36')]?_0x5e7cde[_0x6162('0x34')]:_0x54ef8c[_0x6162('0x30')];if(!_0x431f90[_0x6162('0x32')]['hasOwnProperty'](_0x6162('0x37'))){_0x5e7cde[_0x6162('0x1e')]=qs['limit'](_0x431f90[_0x6162('0x32')][_0x6162('0x1e')]);_0x5e7cde['offset']=qs[_0x6162('0x1b')](_0x431f90[_0x6162('0x32')]['offset']);}_0x5e7cde[_0x6162('0x38')]=qs[_0x6162('0x39')](_0x431f90['query']['sort']);_0x5e7cde[_0x6162('0x3a')]=qs[_0x6162('0x3b')](_[_0x6162('0x3c')](_0x431f90[_0x6162('0x32')],_0x54ef8c[_0x6162('0x3b')]),_0x500be0);if(_0x431f90[_0x6162('0x32')][_0x6162('0x3d')]){_0x5e7cde[_0x6162('0x3a')]=_[_0x6162('0x3e')](_0x5e7cde[_0x6162('0x3a')],{'$or':_[_0x6162('0x31')](_0x500be0,function(_0x2b466d){if(_0x2b466d['type']!==_0x6162('0x3f')){var _0x5c9cec={};_0x5c9cec[_0x2b466d['name']]={'$like':'%'+_0x431f90[_0x6162('0x32')][_0x6162('0x3d')]+'%'};return _0x5c9cec;}})});}_0x5e7cde=_[_0x6162('0x3e')]({},_0x5e7cde,_0x431f90[_0x6162('0x40')]);var _0xa88f7b={'where':_0x5e7cde[_0x6162('0x3a')]};return db['SquareDetailsReport']['count'](_0xa88f7b)[_0x6162('0x25')](function(_0x14f44a){_0x41dd67[_0x6162('0x1d')]=_0x14f44a;if(_0x431f90[_0x6162('0x32')][_0x6162('0x41')]){_0x5e7cde[_0x6162('0x42')]=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x5e7cde);})[_0x6162('0x25')](function(_0x125fc5){_0x41dd67['rows']=_0x125fc5;return _0x41dd67;})[_0x6162('0x25')](respondWithFilteredResult(_0x2210e3,_0x5e7cde))[_0x6162('0x43')](handleError(_0x2210e3,null));};exports[_0x6162('0x44')]=function(_0x542bf1,_0x378397){var _0x50647c={'raw':!![],'where':{'id':_0x542bf1['params']['id']}},_0x429fda={};_0x429fda[_0x6162('0x30')]=_[_0x6162('0x45')](db['SquareDetailsReport'][_0x6162('0x2d')]);_0x429fda[_0x6162('0x32')]=_[_0x6162('0x45')](_0x542bf1[_0x6162('0x32')]);_0x429fda[_0x6162('0x3b')]=_[_0x6162('0x33')](_0x429fda[_0x6162('0x30')],_0x429fda[_0x6162('0x32')]);_0x50647c[_0x6162('0x34')]=_[_0x6162('0x33')](_0x429fda[_0x6162('0x30')],qs[_0x6162('0x35')](_0x542bf1[_0x6162('0x32')][_0x6162('0x35')]));_0x50647c['attributes']=_0x50647c[_0x6162('0x34')][_0x6162('0x36')]?_0x50647c['attributes']:_0x429fda['model'];if(_0x542bf1['query'][_0x6162('0x41')]){_0x50647c[_0x6162('0x42')]=[{'all':!![]}];}_0x50647c=_[_0x6162('0x3e')]({},_0x50647c,_0x542bf1['options']);return db[_0x6162('0x2c')]['find'](_0x50647c)[_0x6162('0x25')](handleEntityNotFound(_0x378397,null))[_0x6162('0x25')](respondWithResult(_0x378397,null))['catch'](handleError(_0x378397,null));};exports['create']=function(_0x11ad97,_0x48e070){return db['SquareDetailsReport'][_0x6162('0x46')](_0x11ad97[_0x6162('0x47')],{})[_0x6162('0x25')](respondWithResult(_0x48e070,0xc9))[_0x6162('0x43')](handleError(_0x48e070,null));};exports[_0x6162('0x24')]=function(_0x3e8497,_0x19d1ad){if(_0x3e8497[_0x6162('0x47')]['id']){delete _0x3e8497[_0x6162('0x47')]['id'];}return db[_0x6162('0x2c')][_0x6162('0x48')]({'where':{'id':_0x3e8497[_0x6162('0x49')]['id']}})[_0x6162('0x25')](handleEntityNotFound(_0x19d1ad,null))['then'](saveUpdates(_0x3e8497[_0x6162('0x47')],null))[_0x6162('0x25')](respondWithResult(_0x19d1ad,null))[_0x6162('0x43')](handleError(_0x19d1ad,null));};exports['destroy']=function(_0x5b4ac9,_0x3eb658){return db[_0x6162('0x2c')][_0x6162('0x48')]({'where':{'id':_0x5b4ac9[_0x6162('0x49')]['id']}})[_0x6162('0x25')](handleEntityNotFound(_0x3eb658,null))[_0x6162('0x25')](removeEntity(_0x3eb658,null))[_0x6162('0x43')](handleError(_0x3eb658,null));};exports[_0x6162('0x4a')]=function(_0x182501,_0x1a72b6){return db[_0x6162('0x2c')][_0x6162('0x4a')]()[_0x6162('0x25')](respondWithResult(_0x1a72b6,null))[_0x6162('0x43')](handleError(_0x1a72b6,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index d371cac..697020a 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 _0xa2d4=['SquareDetailsReport','util','bluebird','request-promise','path','rimraf'];(function(_0x3fcc20,_0x57c31b){var _0x15d3ce=function(_0x575619){while(--_0x575619){_0x3fcc20['push'](_0x3fcc20['shift']());}};_0x15d3ce(++_0x57c31b);}(_0xa2d4,0x1f3));var _0x4a2d=function(_0x1d4c3d,_0x4ef405){_0x1d4c3d=_0x1d4c3d-0x0;var _0x39a709=_0xa2d4[_0x1d4c3d];return _0x39a709;};'use strict';var _=require('lodash');var util=require(_0x4a2d('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4a2d('0x1'));var rp=require(_0x4a2d('0x2'));var fs=require('fs');var path=require(_0x4a2d('0x3'));var rimraf=require(_0x4a2d('0x4'));var config=require('../../config/environment');var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0x1def41,_0x17ac6a){return _0x1def41['define'](_0x4a2d('0x5'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3090=['path','../../config/environment','./squareReportDetail.attributes','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','bluebird'];(function(_0x360656,_0x14f2ae){var _0x23cb4a=function(_0x103acf){while(--_0x103acf){_0x360656['push'](_0x360656['shift']());}};_0x23cb4a(++_0x14f2ae);}(_0x3090,0xe2));var _0x0309=function(_0xefe8df,_0x399303){_0xefe8df=_0xefe8df-0x0;var _0x55b239=_0x3090[_0xefe8df];return _0x55b239;};'use strict';var _=require(_0x0309('0x0'));var util=require(_0x0309('0x1'));var logger=require(_0x0309('0x2'))(_0x0309('0x3'));var moment=require('moment');var BPromise=require(_0x0309('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0309('0x5'));var rimraf=require('rimraf');var config=require(_0x0309('0x6'));var attributes=require(_0x0309('0x7'));module['exports']=function(_0x5c3a6c,_0x2abc2a){return _0x5c3a6c[_0x0309('0x8')](_0x0309('0x9'),attributes,{'tableName':_0x0309('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 25ee65a..d6f2741 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 _0x3f8c=['code','message','result','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','debug','catch','moment','bluebird','randomstring','ioredis','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x126a1b,_0x4fac35){var _0x1f23e1=function(_0x559b87){while(--_0x559b87){_0x126a1b['push'](_0x126a1b['shift']());}};_0x1f23e1(++_0x4fac35);}(_0x3f8c,0x104));var _0xc3f8=function(_0x2cddc8,_0x1bf009){_0x2cddc8=_0x2cddc8-0x0;var _0x587596=_0x3f8c[_0x2cddc8];return _0x587596;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc3f8('0x0'));var BPromise=require(_0xc3f8('0x1'));var rs=require(_0xc3f8('0x2'));var fs=require('fs');var Redis=require(_0xc3f8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc3f8('0x4'));var client=jayson[_0xc3f8('0x5')][_0xc3f8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x44c25d,_0x2bbaa5,_0x15512a){return new BPromise(function(_0x51093a,_0x28397e){return client[_0xc3f8('0x7')](_0x44c25d,_0x15512a)[_0xc3f8('0x8')](function(_0x3c340c){logger[_0xc3f8('0x9')](_0xc3f8('0xa'),_0x2bbaa5,_0xc3f8('0xb'));logger['debug'](_0xc3f8('0xc'),_0x2bbaa5,_0xc3f8('0xb'),JSON[_0xc3f8('0xd')](_0x3c340c));if(_0x3c340c[_0xc3f8('0xe')]){if(_0x3c340c['error'][_0xc3f8('0xf')]===0x1f4){logger[_0xc3f8('0xe')](_0xc3f8('0xa'),_0x2bbaa5,_0x3c340c[_0xc3f8('0xe')]['message']);return _0x28397e(_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);}logger[_0xc3f8('0xe')](_0xc3f8('0xa'),_0x2bbaa5,_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);return _0x51093a(_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);}else{logger[_0xc3f8('0x9')](_0xc3f8('0xa'),_0x2bbaa5,_0xc3f8('0xb'));_0x51093a(_0x3c340c[_0xc3f8('0x11')][_0xc3f8('0x10')]);}})['catch'](function(_0x14b3ed){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x2bbaa5,_0x14b3ed);_0x28397e(_0x14b3ed);});});}exports[_0xc3f8('0x12')]=function(_0x2e7c0f){var _0x35500f=this;return new Promise(function(_0xb4ab67,_0x47a185){return db[_0xc3f8('0x13')][_0xc3f8('0x14')](_0x2e7c0f['body'],{'raw':_0x2e7c0f[_0xc3f8('0x15')]?_0x2e7c0f['options'][_0xc3f8('0x16')]===undefined?!![]:![]:!![]})[_0xc3f8('0x8')](function(_0x3b2e98){logger['info']('CreateSquareDetailsReport',_0x2e7c0f);logger[_0xc3f8('0x17')](_0xc3f8('0x12'),_0x2e7c0f,JSON[_0xc3f8('0xd')](_0x3b2e98));_0xb4ab67(_0x3b2e98);})[_0xc3f8('0x18')](function(_0x6522e9){logger[_0xc3f8('0xe')](_0xc3f8('0x12'),_0x6522e9[_0xc3f8('0x10')],_0x2e7c0f);_0x47a185(_0x35500f['error'](0x1f4,_0x6522e9['message']));});});}; \ No newline at end of file +var _0x9c9b=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','debug','util'];(function(_0x27488f,_0x58085d){var _0x3a0d9d=function(_0x4e62a8){while(--_0x4e62a8){_0x27488f['push'](_0x27488f['shift']());}};_0x3a0d9d(++_0x58085d);}(_0x9c9b,0x194));var _0xb9c9=function(_0x2fa7b0,_0x1fc583){_0x2fa7b0=_0x2fa7b0-0x0;var _0x46ac25=_0x9c9b[_0x2fa7b0];return _0x46ac25;};'use strict';var _=require('lodash');var util=require(_0xb9c9('0x0'));var moment=require(_0xb9c9('0x1'));var BPromise=require(_0xb9c9('0x2'));var rs=require(_0xb9c9('0x3'));var fs=require('fs');var Redis=require(_0xb9c9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb9c9('0x5'));var logger=require(_0xb9c9('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb9c9('0x7')][_0xb9c9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x726f01,_0x3ccb91,_0x16158b){return new BPromise(function(_0x9dc3da,_0x32ff81){return client[_0xb9c9('0x9')](_0x726f01,_0x16158b)[_0xb9c9('0xa')](function(_0x131b42){logger[_0xb9c9('0xb')](_0xb9c9('0xc'),_0x3ccb91,_0xb9c9('0xd'));logger['debug']('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x3ccb91,_0xb9c9('0xd'),JSON[_0xb9c9('0xe')](_0x131b42));if(_0x131b42[_0xb9c9('0xf')]){if(_0x131b42[_0xb9c9('0xf')][_0xb9c9('0x10')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x3ccb91,_0x131b42['error'][_0xb9c9('0x11')]);return _0x32ff81(_0x131b42['error'][_0xb9c9('0x11')]);}logger[_0xb9c9('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x3ccb91,_0x131b42['error'][_0xb9c9('0x11')]);return _0x9dc3da(_0x131b42[_0xb9c9('0xf')][_0xb9c9('0x11')]);}else{logger['info'](_0xb9c9('0xc'),_0x3ccb91,_0xb9c9('0xd'));_0x9dc3da(_0x131b42[_0xb9c9('0x12')][_0xb9c9('0x11')]);}})[_0xb9c9('0x13')](function(_0x49f17c){logger[_0xb9c9('0xf')](_0xb9c9('0xc'),_0x3ccb91,_0x49f17c);_0x32ff81(_0x49f17c);});});}exports[_0xb9c9('0x14')]=function(_0x5b569f){var _0x5b9586=this;return new Promise(function(_0x4b5414,_0x5551cd){return db[_0xb9c9('0x15')][_0xb9c9('0x16')](_0x5b569f[_0xb9c9('0x17')],{'raw':_0x5b569f[_0xb9c9('0x18')]?_0x5b569f[_0xb9c9('0x18')][_0xb9c9('0x19')]===undefined?!![]:![]:!![]})[_0xb9c9('0xa')](function(_0x2faa66){logger[_0xb9c9('0xb')](_0xb9c9('0x14'),_0x5b569f);logger[_0xb9c9('0x1a')](_0xb9c9('0x14'),_0x5b569f,JSON[_0xb9c9('0xe')](_0x2faa66));_0x4b5414(_0x2faa66);})['catch'](function(_0xbdbb51){logger['error'](_0xb9c9('0x14'),_0xbdbb51[_0xb9c9('0x11')],_0x5b569f);_0x5551cd(_0x5b9586[_0xb9c9('0xf')](0x1f4,_0xbdbb51[_0xb9c9('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 29763a9..61e9372 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 _0x2230=['exports','Router','../../components/auth/service','./system.controller','index','/process/:pid/kill','isAuthenticated','killProcess'];(function(_0x2e0115,_0x27bc38){var _0x5a1dae=function(_0xa86064){while(--_0xa86064){_0x2e0115['push'](_0x2e0115['shift']());}};_0x5a1dae(++_0x27bc38);}(_0x2230,0x161));var _0x0223=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2230[_0x3dd15e];return _0x231fd0;};'use strict';var express=require('express');var router=express[_0x0223('0x0')]();var auth=require(_0x0223('0x1'));var controller=require(_0x0223('0x2'));router['get']('/',auth['isAuthenticated'](),controller[_0x0223('0x3')]);router['get'](_0x0223('0x4'),auth[_0x0223('0x5')](),controller[_0x0223('0x6')]);module[_0x0223('0x7')]=router; \ No newline at end of file +var _0xd626=['exports','express','Router','./system.controller','get','isAuthenticated','index','/process/:pid/kill'];(function(_0x137e88,_0x254d26){var _0x240e90=function(_0x341003){while(--_0x341003){_0x137e88['push'](_0x137e88['shift']());}};_0x240e90(++_0x254d26);}(_0xd626,0xf9));var _0x6d62=function(_0x1e6aaa,_0x1175b6){_0x1e6aaa=_0x1e6aaa-0x0;var _0x3f5679=_0xd626[_0x1e6aaa];return _0x3f5679;};'use strict';var express=require(_0x6d62('0x0'));var router=express[_0x6d62('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x6d62('0x2'));router[_0x6d62('0x3')]('/',auth[_0x6d62('0x4')](),controller[_0x6d62('0x5')]);router[_0x6d62('0x3')](_0x6d62('0x6'),auth[_0x6d62('0x4')](),controller['killProcess']);module[_0x6d62('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 86b9c03..e42ca23 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 _0x554e=['bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','catch','json','components/import/cm','format','params','pid','indexOf','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','exec','../../config/logger','util'];(function(_0x52f617,_0x43f347){var _0x29ee7e=function(_0x5888f5){while(--_0x5888f5){_0x52f617['push'](_0x52f617['shift']());}};_0x29ee7e(++_0x43f347);}(_0x554e,0x165));var _0xe554=function(_0x53f74c,_0xd71010){_0x53f74c=_0x53f74c-0x0;var _0x467bc0=_0x554e[_0x53f74c];return _0x467bc0;};'use strict';var info=require('systeminformation');var exec=require('child_process')[_0xe554('0x0')];var logger=require(_0xe554('0x1'))('api');var util=require(_0xe554('0x2'));var BPromise=require(_0xe554('0x3'));var _=require(_0xe554('0x4'));function handleError(_0x569f85,_0x5a277b,_0x435dfd){_0x5a277b=_0x5a277b||0x1f4;return function(_0x1fbd30){logger[_0xe554('0x5')](_0xe554('0x6'),_0x435dfd,_0x5a277b,util[_0xe554('0x7')](_0x1fbd30,{'showHidden':![],'depth':null}));delete _0x1fbd30[_0xe554('0x8')];_0x569f85[_0xe554('0x9')](_0x5a277b)[_0xe554('0xa')](_0x1fbd30);};}exports[_0xe554('0xb')]=function(_0x135099,_0x5b6691){return info[_0xe554('0xc')]()[_0xe554('0xd')](function(_0x33dbb7){return _0x5b6691[_0xe554('0x9')](0xc8)['json'](_0x33dbb7);})[_0xe554('0xe')](function(_0x304e04){return _0x5b6691[_0xe554('0x9')](0x1f4)[_0xe554('0xf')](_0x304e04);});};exports['killProcess']=function(_0x307ebd,_0x49d40b){var _0x3b528c=[_0xe554('0x10')];return new BPromise(function(_0x40e576,_0x4992f3){return exec(util[_0xe554('0x11')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x307ebd[_0xe554('0x12')][_0xe554('0x13')]),function(_0x4713ea,_0x1ae541,_0x4b11a0){if(_0x4713ea){return _0x4992f3(_0x4713ea);}return _0x40e576(_0x1ae541);});})[_0xe554('0xd')](function(_0x617d35){var _0x546545=![];var _0x5a5511=_0x617d35['split'](/\n/);for(var _0x1fd584=0x0,_0x50a2f8=_0x3b528c['length'];_0x1fd584<_0x50a2f8,_0x546545===![];_0x1fd584+=0x1){if(_0x617d35[_0xe554('0x14')](_0x3b528c[_0x1fd584])>=0x0){_0x546545=!![];}}if(!_0x546545){throw new Error(util[_0xe554('0x11')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x307ebd[_0xe554('0x12')]['pid']));}process[_0xe554('0x15')](_0x307ebd[_0xe554('0x12')][_0xe554('0x13')],'SIGINT');return _0x49d40b[_0xe554('0x9')](0xc8)[_0xe554('0xf')]({'message':util['format'](_0xe554('0x16'),_0x307ebd[_0xe554('0x12')]['pid'])});})[_0xe554('0xe')](handleError(_0x49d40b,null,_0xe554('0x17')));}; \ No newline at end of file +var _0xea13=['then','json','catch','components/import/cm','params','pid','split','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','exec','api','util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0xea13,0xee));var _0x3ea1=function(_0x42c20c,_0x31c57d){_0x42c20c=_0x42c20c-0x0;var _0x3d9b1e=_0xea13[_0x42c20c];return _0x3d9b1e;};'use strict';var info=require('systeminformation');var exec=require('child_process')[_0x3ea1('0x0')];var logger=require('../../config/logger')(_0x3ea1('0x1'));var util=require(_0x3ea1('0x2'));var BPromise=require('bluebird');var _=require(_0x3ea1('0x3'));function handleError(_0x46f3b8,_0x20a160,_0x3885d3){_0x20a160=_0x20a160||0x1f4;return function(_0x2eeef8){logger[_0x3ea1('0x4')](_0x3ea1('0x5'),_0x3885d3,_0x20a160,util[_0x3ea1('0x6')](_0x2eeef8,{'showHidden':![],'depth':null}));delete _0x2eeef8[_0x3ea1('0x7')];_0x46f3b8[_0x3ea1('0x8')](_0x20a160)[_0x3ea1('0x9')](_0x2eeef8);};}exports[_0x3ea1('0xa')]=function(_0x3767f2,_0x1cdd95){return info[_0x3ea1('0xb')]()[_0x3ea1('0xc')](function(_0x551195){return _0x1cdd95[_0x3ea1('0x8')](0xc8)[_0x3ea1('0xd')](_0x551195);})[_0x3ea1('0xe')](function(_0x330461){return _0x1cdd95[_0x3ea1('0x8')](0x1f4)['json'](_0x330461);});};exports['killProcess']=function(_0x31fa84,_0x4121e7){var _0x27b1aa=[_0x3ea1('0xf')];return new BPromise(function(_0x89924d,_0x3d0ea4){return exec(util['format']('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x31fa84[_0x3ea1('0x10')][_0x3ea1('0x11')]),function(_0x557a25,_0x5b655e,_0x15f99b){if(_0x557a25){return _0x3d0ea4(_0x557a25);}return _0x89924d(_0x5b655e);});})[_0x3ea1('0xc')](function(_0x2a6db9){var _0xf6001a=![];var _0x37a2f6=_0x2a6db9[_0x3ea1('0x12')](/\n/);for(var _0x3d4d50=0x0,_0x5ee01e=_0x27b1aa[_0x3ea1('0x13')];_0x3d4d50<_0x5ee01e,_0xf6001a===![];_0x3d4d50+=0x1){if(_0x2a6db9[_0x3ea1('0x14')](_0x27b1aa[_0x3d4d50])>=0x0){_0xf6001a=!![];}}if(!_0xf6001a){throw new Error(util[_0x3ea1('0x15')](_0x3ea1('0x16'),_0x31fa84['params'][_0x3ea1('0x11')]));}process['kill'](_0x31fa84[_0x3ea1('0x10')][_0x3ea1('0x11')],'SIGINT');return _0x4121e7[_0x3ea1('0x8')](0xc8)[_0x3ea1('0xd')]({'message':util[_0x3ea1('0x15')](_0x3ea1('0x17'),_0x31fa84[_0x3ea1('0x10')][_0x3ea1('0x11')])});})['catch'](handleError(_0x4121e7,null,_0x3ea1('0x18')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index d5987a5..8772bce 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 _0xf316=['/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','show','post','create','put'];(function(_0x28c939,_0x110e29){var _0x527fe9=function(_0x1df2a6){while(--_0x1df2a6){_0x28c939['push'](_0x28c939['shift']());}};_0x527fe9(++_0x110e29);}(_0xf316,0xd7));var _0x6f31=function(_0x15d0f8,_0x12533c){_0x15d0f8=_0x15d0f8-0x0;var _0x12c086=_0xf316[_0x15d0f8];return _0x12c086;};'use strict';var multer=require('multer');var util=require(_0x6f31('0x0'));var path=require(_0x6f31('0x1'));var timeout=require(_0x6f31('0x2'));var express=require(_0x6f31('0x3'));var router=express[_0x6f31('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6f31('0x5'));var interaction=require(_0x6f31('0x6'));var config=require(_0x6f31('0x7'));var controller=require(_0x6f31('0x8'));router[_0x6f31('0x9')]('/',auth[_0x6f31('0xa')](),controller[_0x6f31('0xb')]);router[_0x6f31('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6f31('0xc')]);router[_0x6f31('0xd')]('/',auth['isAuthenticated'](),controller[_0x6f31('0xe')]);router[_0x6f31('0xf')](_0x6f31('0x10'),auth['isAuthenticated'](),controller[_0x6f31('0x11')]);router[_0x6f31('0x12')](_0x6f31('0x10'),auth[_0x6f31('0xa')](),controller[_0x6f31('0x13')]);module[_0x6f31('0x14')]=router; \ No newline at end of file +var _0xdf2b=['put','update','delete','destroy','exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','/:id','show','post','create'];(function(_0x1c35ec,_0x147906){var _0x2cf085=function(_0x1d8f78){while(--_0x1d8f78){_0x1c35ec['push'](_0x1c35ec['shift']());}};_0x2cf085(++_0x147906);}(_0xdf2b,0x125));var _0xbdf2=function(_0x165303,_0x4c4d68){_0x165303=_0x165303-0x0;var _0x5ac782=_0xdf2b[_0x165303];return _0x5ac782;};'use strict';var multer=require('multer');var util=require(_0xbdf2('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbdf2('0x1'));var router=express['Router']();var fs_extra=require(_0xbdf2('0x2'));var auth=require(_0xbdf2('0x3'));var interaction=require(_0xbdf2('0x4'));var config=require(_0xbdf2('0x5'));var controller=require(_0xbdf2('0x6'));router[_0xbdf2('0x7')]('/',auth[_0xbdf2('0x8')](),controller['index']);router[_0xbdf2('0x7')](_0xbdf2('0x9'),auth['isAuthenticated'](),controller[_0xbdf2('0xa')]);router[_0xbdf2('0xb')]('/',auth[_0xbdf2('0x8')](),controller[_0xbdf2('0xc')]);router[_0xbdf2('0xd')](_0xbdf2('0x9'),auth[_0xbdf2('0x8')](),controller[_0xbdf2('0xe')]);router[_0xbdf2('0xf')](_0xbdf2('0x9'),auth[_0xbdf2('0x8')](),controller[_0xbdf2('0x10')]);module[_0xbdf2('0x11')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index df7ff97..513ad6d 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 _0x6582=['sequelize','exports','STRING','name'];(function(_0x33a151,_0x3527b4){var _0x5664ab=function(_0x4de25c){while(--_0x4de25c){_0x33a151['push'](_0x33a151['shift']());}};_0x5664ab(++_0x3527b4);}(_0x6582,0x108));var _0x2658=function(_0x5b50ae,_0x7da7e1){_0x5b50ae=_0x5b50ae-0x0;var _0x84eb56=_0x6582[_0x5b50ae];return _0x84eb56;};'use strict';var Sequelize=require(_0x2658('0x0'));module[_0x2658('0x1')]={'name':{'type':Sequelize[_0x2658('0x2')],'unique':_0x2658('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x2658('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x2658('0x2')]}}; \ No newline at end of file +var _0x0ca5=['name','#0091EA','sequelize','exports','STRING'];(function(_0x7e212c,_0x5e1e46){var _0x2426b8=function(_0x5aa4cc){while(--_0x5aa4cc){_0x7e212c['push'](_0x7e212c['shift']());}};_0x2426b8(++_0x5e1e46);}(_0x0ca5,0xfc));var _0x50ca=function(_0x470e72,_0x12b07e){_0x470e72=_0x470e72-0x0;var _0x546586=_0x0ca5[_0x470e72];return _0x546586;};'use strict';var Sequelize=require(_0x50ca('0x0'));module[_0x50ca('0x1')]={'name':{'type':Sequelize[_0x50ca('0x2')],'unique':_0x50ca('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x50ca('0x2')],'defaultValue':_0x50ca('0x4')},'description':{'type':Sequelize[_0x50ca('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 1f6bfb2..799057f 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 _0xc3fe=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','status','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','body','params'];(function(_0x521347,_0x4b0ba5){var _0x4e2b48=function(_0x46a8f4){while(--_0x46a8f4){_0x521347['push'](_0x521347['shift']());}};_0x4e2b48(++_0x4b0ba5);}(_0xc3fe,0xff));var _0xec3f=function(_0x3290db,_0x45ea71){_0x3290db=_0x3290db-0x0;var _0x5e8c4e=_0xc3fe[_0x3290db];return _0x5e8c4e;};'use strict';var emlformat=require(_0xec3f('0x0'));var rimraf=require(_0xec3f('0x1'));var zipdir=require(_0xec3f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xec3f('0x3'));var moment=require(_0xec3f('0x4'));var BPromise=require(_0xec3f('0x5'));var Mustache=require('mustache');var util=require(_0xec3f('0x6'));var path=require(_0xec3f('0x7'));var sox=require(_0xec3f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xec3f('0x9'));var _=require(_0xec3f('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xec3f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xec3f('0xc'));var querystring=require(_0xec3f('0xd'));var Papa=require(_0xec3f('0xe'));var Redis=require(_0xec3f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xec3f('0x10'));var as=require(_0xec3f('0x11'));var hardwareService=require(_0xec3f('0x12'));var logger=require(_0xec3f('0x13'))(_0xec3f('0x14'));var utils=require(_0xec3f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xec3f('0x16'));var db=require(_0xec3f('0x17'))['db'];function respondWithStatusCode(_0x367c5e,_0x57891d){_0x57891d=_0x57891d||0xcc;return function(_0x5367df){if(_0x5367df){return _0x367c5e[_0xec3f('0x18')](_0x57891d);}return _0x367c5e['status'](_0x57891d)['end']();};}function respondWithResult(_0x209ffa,_0x4318bd){_0x4318bd=_0x4318bd||0xc8;return function(_0x113d16){if(_0x113d16){return _0x209ffa['status'](_0x4318bd)['json'](_0x113d16);}};}function respondWithFilteredResult(_0x5509ec,_0x5ad65a){return function(_0x37d688){if(_0x37d688){var _0x10ff81=typeof _0x5ad65a['offset']===_0xec3f('0x19')&&typeof _0x5ad65a[_0xec3f('0x1a')]===_0xec3f('0x19');var _0x3b7393=_0x37d688['count'];var _0x7805c=_0x10ff81?0x0:_0x5ad65a[_0xec3f('0x1b')];var _0x2d338=_0x10ff81?_0x37d688[_0xec3f('0x1c')]:_0x5ad65a[_0xec3f('0x1b')]+_0x5ad65a['limit'];var _0x2f8bc8;if(_0x2d338>=_0x3b7393){_0x2d338=_0x3b7393;_0x2f8bc8=0xc8;}else{_0x2f8bc8=0xce;}_0x5509ec['status'](_0x2f8bc8);return _0x5509ec[_0xec3f('0x1d')](_0xec3f('0x1e'),_0x7805c+'-'+_0x2d338+'/'+_0x3b7393)[_0xec3f('0x1f')](_0x37d688);}return null;};}function patchUpdates(_0x47b6f9){return function(_0x526ff){try{jsonpatch[_0xec3f('0x20')](_0x526ff,_0x47b6f9,!![]);}catch(_0x4fdfc3){return BPromise[_0xec3f('0x21')](_0x4fdfc3);}return _0x526ff[_0xec3f('0x22')]();};}function saveUpdates(_0x1f173f,_0x395b9a){return function(_0x4d9598){if(_0x4d9598){return _0x4d9598[_0xec3f('0x23')](_0x1f173f)[_0xec3f('0x24')](function(_0x2f45bb){return _0x2f45bb;});}return null;};}function removeEntity(_0x4e4770,_0xfc9c0d){return function(_0x4b5932){if(_0x4b5932){return _0x4b5932[_0xec3f('0x25')]()['then'](function(){var _0x56ecc3=_0x4b5932[_0xec3f('0x26')]({'plain':!![]});var _0x482bf2=_0xec3f('0x27');return db[_0xec3f('0x28')][_0xec3f('0x25')]({'where':{'type':_0x482bf2,'resourceId':_0x56ecc3['id']}})['then'](function(){return _0x4b5932;});})[_0xec3f('0x24')](function(){_0x4e4770[_0xec3f('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53cc0d,_0x3e5244){return function(_0x48e166){if(!_0x48e166){_0x53cc0d[_0xec3f('0x18')](0x194);}return _0x48e166;};}function handleError(_0x1b3155,_0x358fcd){_0x358fcd=_0x358fcd||0x1f4;return function(_0x2eac8d){logger[_0xec3f('0x2a')](_0x2eac8d[_0xec3f('0x2b')]);if(_0x2eac8d[_0xec3f('0x2c')]){delete _0x2eac8d[_0xec3f('0x2c')];}_0x1b3155['status'](_0x358fcd)[_0xec3f('0x2d')](_0x2eac8d);};}exports[_0xec3f('0x2e')]=function(_0x4bfff2,_0x91c11a){var _0xb6da0={},_0x328284={},_0x185b20={'count':0x0,'rows':[]};var _0x26fb2a=_[_0xec3f('0x2f')](db[_0xec3f('0x30')][_0xec3f('0x31')],function(_0x32a522){return{'name':_0x32a522[_0xec3f('0x32')],'type':_0x32a522[_0xec3f('0x33')][_0xec3f('0x34')]};});_0x328284[_0xec3f('0x35')]=_[_0xec3f('0x2f')](_0x26fb2a,_0xec3f('0x2c'));_0x328284['query']=_[_0xec3f('0x36')](_0x4bfff2[_0xec3f('0x37')]);_0x328284[_0xec3f('0x38')]=_[_0xec3f('0x39')](_0x328284[_0xec3f('0x35')],_0x328284['query']);_0xb6da0[_0xec3f('0x3a')]=_[_0xec3f('0x39')](_0x328284[_0xec3f('0x35')],qs['fields'](_0x4bfff2['query'][_0xec3f('0x3b')]));_0xb6da0['attributes']=_0xb6da0[_0xec3f('0x3a')]['length']?_0xb6da0[_0xec3f('0x3a')]:_0x328284['model'];if(!_0x4bfff2['query'][_0xec3f('0x3c')](_0xec3f('0x3d'))){_0xb6da0[_0xec3f('0x1a')]=qs[_0xec3f('0x1a')](_0x4bfff2[_0xec3f('0x37')][_0xec3f('0x1a')]);_0xb6da0['offset']=qs['offset'](_0x4bfff2[_0xec3f('0x37')][_0xec3f('0x1b')]);}_0xb6da0[_0xec3f('0x3e')]=qs[_0xec3f('0x3f')](_0x4bfff2[_0xec3f('0x37')][_0xec3f('0x3f')]);_0xb6da0[_0xec3f('0x40')]=qs['filters'](_[_0xec3f('0x41')](_0x4bfff2['query'],_0x328284[_0xec3f('0x38')]),_0x26fb2a);if(_0x4bfff2[_0xec3f('0x37')][_0xec3f('0x42')]){_0xb6da0[_0xec3f('0x40')]=_[_0xec3f('0x43')](_0xb6da0[_0xec3f('0x40')],{'$or':_[_0xec3f('0x2f')](_0x26fb2a,function(_0x17722c){if(_0x17722c[_0xec3f('0x33')]!==_0xec3f('0x44')){var _0x38a9e3={};_0x38a9e3[_0x17722c[_0xec3f('0x2c')]]={'$like':'%'+_0x4bfff2[_0xec3f('0x37')]['filter']+'%'};return _0x38a9e3;}})});}_0xb6da0=_[_0xec3f('0x43')]({},_0xb6da0,_0x4bfff2[_0xec3f('0x45')]);var _0x4b416d={'where':_0xb6da0[_0xec3f('0x40')]};return db[_0xec3f('0x30')]['count'](_0x4b416d)[_0xec3f('0x24')](function(_0xae1b8a){_0x185b20[_0xec3f('0x1c')]=_0xae1b8a;if(_0x4bfff2[_0xec3f('0x37')][_0xec3f('0x46')]){_0xb6da0[_0xec3f('0x47')]=[{'all':!![]}];}return db['Tag'][_0xec3f('0x48')](_0xb6da0);})[_0xec3f('0x24')](function(_0x1c6494){_0x185b20[_0xec3f('0x49')]=_0x1c6494;return _0x185b20;})[_0xec3f('0x24')](respondWithFilteredResult(_0x91c11a,_0xb6da0))[_0xec3f('0x4a')](handleError(_0x91c11a,null));};exports[_0xec3f('0x4b')]=function(_0x18c560,_0x42d1ae){var _0x5f4033={'raw':!![],'where':{'id':_0x18c560['params']['id']}},_0x8d0f18={};_0x8d0f18[_0xec3f('0x35')]=_[_0xec3f('0x36')](db[_0xec3f('0x30')][_0xec3f('0x31')]);_0x8d0f18[_0xec3f('0x37')]=_[_0xec3f('0x36')](_0x18c560[_0xec3f('0x37')]);_0x8d0f18[_0xec3f('0x38')]=_[_0xec3f('0x39')](_0x8d0f18[_0xec3f('0x35')],_0x8d0f18[_0xec3f('0x37')]);_0x5f4033[_0xec3f('0x3a')]=_['intersection'](_0x8d0f18[_0xec3f('0x35')],qs[_0xec3f('0x3b')](_0x18c560['query'][_0xec3f('0x3b')]));_0x5f4033[_0xec3f('0x3a')]=_0x5f4033[_0xec3f('0x3a')][_0xec3f('0x4c')]?_0x5f4033['attributes']:_0x8d0f18['model'];if(_0x18c560[_0xec3f('0x37')][_0xec3f('0x46')]){_0x5f4033['include']=[{'all':!![]}];}_0x5f4033=_[_0xec3f('0x43')]({},_0x5f4033,_0x18c560[_0xec3f('0x45')]);return db[_0xec3f('0x30')]['find'](_0x5f4033)[_0xec3f('0x24')](handleEntityNotFound(_0x42d1ae,null))['then'](respondWithResult(_0x42d1ae,null))['catch'](handleError(_0x42d1ae,null));};exports['create']=function(_0x97c57d,_0x1b7cf6){return db[_0xec3f('0x30')][_0xec3f('0x4d')](_0x97c57d['body'],{})[_0xec3f('0x24')](function(_0x54673e){var _0x5af435=_0x97c57d[_0xec3f('0x4e')][_0xec3f('0x26')]({'plain':!![]});if(!_0x5af435)throw new Error(_0xec3f('0x4f'));if(_0x5af435[_0xec3f('0x50')]===_0xec3f('0x4e')){var _0x515bf2=_0x54673e[_0xec3f('0x26')]({'plain':!![]});var _0x56e5c2=_0xec3f('0x27');return db['UserProfileSection'][_0xec3f('0x51')]({'where':{'name':_0x56e5c2,'userProfileId':_0x5af435['userProfileId']},'raw':!![]})[_0xec3f('0x24')](function(_0x370660){if(_0x370660&&_0x370660[_0xec3f('0x52')]===0x0){return db[_0xec3f('0x28')][_0xec3f('0x4d')]({'name':_0x515bf2[_0xec3f('0x2c')],'resourceId':_0x515bf2['id'],'type':_0x370660[_0xec3f('0x2c')],'sectionId':_0x370660['id']},{})[_0xec3f('0x24')](function(){return _0x54673e;});}else{return _0x54673e;}})['catch'](function(_0x230aad){logger[_0xec3f('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x230aad);throw _0x230aad;});}return _0x54673e;})[_0xec3f('0x24')](respondWithResult(_0x1b7cf6,0xc9))['catch'](handleError(_0x1b7cf6,null));};exports[_0xec3f('0x23')]=function(_0x4cc474,_0x3d1767){if(_0x4cc474['body']['id']){delete _0x4cc474[_0xec3f('0x53')]['id'];}return db['Tag'][_0xec3f('0x51')]({'where':{'id':_0x4cc474[_0xec3f('0x54')]['id']}})[_0xec3f('0x24')](handleEntityNotFound(_0x3d1767,null))[_0xec3f('0x24')](saveUpdates(_0x4cc474[_0xec3f('0x53')],null))[_0xec3f('0x24')](respondWithResult(_0x3d1767,null))['catch'](handleError(_0x3d1767,null));};exports[_0xec3f('0x25')]=function(_0x584c68,_0x13825e){return db[_0xec3f('0x30')][_0xec3f('0x51')]({'where':{'id':_0x584c68[_0xec3f('0x54')]['id']}})[_0xec3f('0x24')](handleEntityNotFound(_0x13825e,null))[_0xec3f('0x24')](removeEntity(_0x13825e,null))[_0xec3f('0x4a')](handleError(_0x13825e,null));}; \ No newline at end of file +var _0x7980=['Unable\x20to\x20retrieve\x20the\x20current\x20user','Tags','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','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','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','index','map','Tag','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','sort','where','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','merge','find','create','body','user'];(function(_0x1d767a,_0x27c14d){var _0x42d207=function(_0x83aadd){while(--_0x83aadd){_0x1d767a['push'](_0x1d767a['shift']());}};_0x42d207(++_0x27c14d);}(_0x7980,0xab));var _0x0798=function(_0x2fe59b,_0x43428c){_0x2fe59b=_0x2fe59b-0x0;var _0x47df15=_0x7980[_0x2fe59b];return _0x47df15;};'use strict';var emlformat=require(_0x0798('0x0'));var rimraf=require(_0x0798('0x1'));var zipdir=require(_0x0798('0x2'));var jsonpatch=require(_0x0798('0x3'));var rp=require(_0x0798('0x4'));var moment=require('moment');var BPromise=require(_0x0798('0x5'));var Mustache=require(_0x0798('0x6'));var util=require(_0x0798('0x7'));var path=require(_0x0798('0x8'));var sox=require(_0x0798('0x9'));var csv=require('to-csv');var ejs=require(_0x0798('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0798('0xb'));var squel=require(_0x0798('0xc'));var crypto=require(_0x0798('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0798('0xe'));var querystring=require(_0x0798('0xf'));var Papa=require(_0x0798('0x10'));var Redis=require(_0x0798('0x11'));var authService=require(_0x0798('0x12'));var qs=require(_0x0798('0x13'));var as=require(_0x0798('0x14'));var hardwareService=require(_0x0798('0x15'));var logger=require(_0x0798('0x16'))(_0x0798('0x17'));var utils=require('../../config/utils');var config=require(_0x0798('0x18'));var licenseUtil=require(_0x0798('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5323e5,_0x588f9d){_0x588f9d=_0x588f9d||0xcc;return function(_0x376a60){if(_0x376a60){return _0x5323e5[_0x0798('0x1a')](_0x588f9d);}return _0x5323e5[_0x0798('0x1b')](_0x588f9d)[_0x0798('0x1c')]();};}function respondWithResult(_0x39bacd,_0xfd88af){_0xfd88af=_0xfd88af||0xc8;return function(_0x5f1640){if(_0x5f1640){return _0x39bacd['status'](_0xfd88af)[_0x0798('0x1d')](_0x5f1640);}};}function respondWithFilteredResult(_0x112362,_0x47be56){return function(_0x555c45){if(_0x555c45){var _0x21c30b=typeof _0x47be56[_0x0798('0x1e')]===_0x0798('0x1f')&&typeof _0x47be56['limit']==='undefined';var _0x1c6d6f=_0x555c45['count'];var _0x41e217=_0x21c30b?0x0:_0x47be56[_0x0798('0x1e')];var _0x288f41=_0x21c30b?_0x555c45[_0x0798('0x20')]:_0x47be56['offset']+_0x47be56[_0x0798('0x21')];var _0x3039d6;if(_0x288f41>=_0x1c6d6f){_0x288f41=_0x1c6d6f;_0x3039d6=0xc8;}else{_0x3039d6=0xce;}_0x112362['status'](_0x3039d6);return _0x112362[_0x0798('0x22')](_0x0798('0x23'),_0x41e217+'-'+_0x288f41+'/'+_0x1c6d6f)[_0x0798('0x1d')](_0x555c45);}return null;};}function patchUpdates(_0x44ac33){return function(_0xfbb4a5){try{jsonpatch[_0x0798('0x24')](_0xfbb4a5,_0x44ac33,!![]);}catch(_0x3a7f8b){return BPromise[_0x0798('0x25')](_0x3a7f8b);}return _0xfbb4a5[_0x0798('0x26')]();};}function saveUpdates(_0x4a86d5,_0x2aaabf){return function(_0x35c141){if(_0x35c141){return _0x35c141[_0x0798('0x27')](_0x4a86d5)[_0x0798('0x28')](function(_0x20654b){return _0x20654b;});}return null;};}function removeEntity(_0x23f283,_0x52037c){return function(_0x3f66e2){if(_0x3f66e2){return _0x3f66e2[_0x0798('0x29')]()[_0x0798('0x28')](function(){var _0xd5e027=_0x3f66e2[_0x0798('0x2a')]({'plain':!![]});var _0x23d59c='Tags';return db[_0x0798('0x2b')][_0x0798('0x29')]({'where':{'type':_0x23d59c,'resourceId':_0xd5e027['id']}})[_0x0798('0x28')](function(){return _0x3f66e2;});})['then'](function(){_0x23f283[_0x0798('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53a3d7,_0x406030){return function(_0x2dfbff){if(!_0x2dfbff){_0x53a3d7[_0x0798('0x1a')](0x194);}return _0x2dfbff;};}function handleError(_0xaa949b,_0x11b7f4){_0x11b7f4=_0x11b7f4||0x1f4;return function(_0x161244){logger[_0x0798('0x2c')](_0x161244[_0x0798('0x2d')]);if(_0x161244['name']){delete _0x161244[_0x0798('0x2e')];}_0xaa949b['status'](_0x11b7f4)['send'](_0x161244);};}exports[_0x0798('0x2f')]=function(_0x4a7eeb,_0x1dabd5){var _0x4a5fb1={},_0x93c004={},_0xb8d33e={'count':0x0,'rows':[]};var _0x201e4c=_[_0x0798('0x30')](db[_0x0798('0x31')][_0x0798('0x32')],function(_0xa1376e){return{'name':_0xa1376e[_0x0798('0x33')],'type':_0xa1376e[_0x0798('0x34')][_0x0798('0x35')]};});_0x93c004[_0x0798('0x36')]=_[_0x0798('0x30')](_0x201e4c,'name');_0x93c004[_0x0798('0x37')]=_['keys'](_0x4a7eeb['query']);_0x93c004[_0x0798('0x38')]=_[_0x0798('0x39')](_0x93c004['model'],_0x93c004['query']);_0x4a5fb1[_0x0798('0x3a')]=_[_0x0798('0x39')](_0x93c004[_0x0798('0x36')],qs[_0x0798('0x3b')](_0x4a7eeb[_0x0798('0x37')][_0x0798('0x3b')]));_0x4a5fb1['attributes']=_0x4a5fb1['attributes'][_0x0798('0x3c')]?_0x4a5fb1[_0x0798('0x3a')]:_0x93c004[_0x0798('0x36')];if(!_0x4a7eeb['query']['hasOwnProperty']('nolimit')){_0x4a5fb1[_0x0798('0x21')]=qs[_0x0798('0x21')](_0x4a7eeb[_0x0798('0x37')][_0x0798('0x21')]);_0x4a5fb1[_0x0798('0x1e')]=qs[_0x0798('0x1e')](_0x4a7eeb[_0x0798('0x37')][_0x0798('0x1e')]);}_0x4a5fb1['order']=qs[_0x0798('0x3d')](_0x4a7eeb['query'][_0x0798('0x3d')]);_0x4a5fb1[_0x0798('0x3e')]=qs[_0x0798('0x38')](_['pick'](_0x4a7eeb[_0x0798('0x37')],_0x93c004['filters']),_0x201e4c);if(_0x4a7eeb[_0x0798('0x37')][_0x0798('0x3f')]){_0x4a5fb1[_0x0798('0x3e')]=_['merge'](_0x4a5fb1[_0x0798('0x3e')],{'$or':_[_0x0798('0x30')](_0x201e4c,function(_0x4edb16){if(_0x4edb16[_0x0798('0x34')]!=='VIRTUAL'){var _0x4e9d94={};_0x4e9d94[_0x4edb16[_0x0798('0x2e')]]={'$like':'%'+_0x4a7eeb[_0x0798('0x37')]['filter']+'%'};return _0x4e9d94;}})});}_0x4a5fb1=_['merge']({},_0x4a5fb1,_0x4a7eeb[_0x0798('0x40')]);var _0x331218={'where':_0x4a5fb1[_0x0798('0x3e')]};return db[_0x0798('0x31')][_0x0798('0x20')](_0x331218)[_0x0798('0x28')](function(_0x27a671){_0xb8d33e['count']=_0x27a671;if(_0x4a7eeb[_0x0798('0x37')][_0x0798('0x41')]){_0x4a5fb1[_0x0798('0x42')]=[{'all':!![]}];}return db[_0x0798('0x31')][_0x0798('0x43')](_0x4a5fb1);})[_0x0798('0x28')](function(_0x4c2d8a){_0xb8d33e[_0x0798('0x44')]=_0x4c2d8a;return _0xb8d33e;})[_0x0798('0x28')](respondWithFilteredResult(_0x1dabd5,_0x4a5fb1))[_0x0798('0x45')](handleError(_0x1dabd5,null));};exports[_0x0798('0x46')]=function(_0x387450,_0xecc618){var _0x3be652={'raw':!![],'where':{'id':_0x387450[_0x0798('0x47')]['id']}},_0x10a50a={};_0x10a50a[_0x0798('0x36')]=_[_0x0798('0x48')](db[_0x0798('0x31')]['rawAttributes']);_0x10a50a[_0x0798('0x37')]=_[_0x0798('0x48')](_0x387450[_0x0798('0x37')]);_0x10a50a[_0x0798('0x38')]=_['intersection'](_0x10a50a['model'],_0x10a50a[_0x0798('0x37')]);_0x3be652[_0x0798('0x3a')]=_[_0x0798('0x39')](_0x10a50a[_0x0798('0x36')],qs['fields'](_0x387450[_0x0798('0x37')]['fields']));_0x3be652['attributes']=_0x3be652[_0x0798('0x3a')][_0x0798('0x3c')]?_0x3be652[_0x0798('0x3a')]:_0x10a50a[_0x0798('0x36')];if(_0x387450[_0x0798('0x37')][_0x0798('0x41')]){_0x3be652[_0x0798('0x42')]=[{'all':!![]}];}_0x3be652=_[_0x0798('0x49')]({},_0x3be652,_0x387450[_0x0798('0x40')]);return db['Tag'][_0x0798('0x4a')](_0x3be652)['then'](handleEntityNotFound(_0xecc618,null))[_0x0798('0x28')](respondWithResult(_0xecc618,null))[_0x0798('0x45')](handleError(_0xecc618,null));};exports[_0x0798('0x4b')]=function(_0x54634d,_0x9dea1f){return db[_0x0798('0x31')][_0x0798('0x4b')](_0x54634d[_0x0798('0x4c')],{})['then'](function(_0x2695d5){var _0x9e6db6=_0x54634d[_0x0798('0x4d')][_0x0798('0x2a')]({'plain':!![]});if(!_0x9e6db6)throw new Error(_0x0798('0x4e'));if(_0x9e6db6['role']===_0x0798('0x4d')){var _0x3e1c15=_0x2695d5[_0x0798('0x2a')]({'plain':!![]});var _0x10173d=_0x0798('0x4f');return db[_0x0798('0x50')][_0x0798('0x4a')]({'where':{'name':_0x10173d,'userProfileId':_0x9e6db6[_0x0798('0x51')]},'raw':!![]})[_0x0798('0x28')](function(_0x48dc0d){if(_0x48dc0d&&_0x48dc0d['autoAssociation']===0x0){return db[_0x0798('0x2b')][_0x0798('0x4b')]({'name':_0x3e1c15[_0x0798('0x2e')],'resourceId':_0x3e1c15['id'],'type':_0x48dc0d[_0x0798('0x2e')],'sectionId':_0x48dc0d['id']},{})[_0x0798('0x28')](function(){return _0x2695d5;});}else{return _0x2695d5;}})[_0x0798('0x45')](function(_0x3fa571){logger['error'](_0x0798('0x52'),_0x3fa571);throw _0x3fa571;});}return _0x2695d5;})['then'](respondWithResult(_0x9dea1f,0xc9))[_0x0798('0x45')](handleError(_0x9dea1f,null));};exports[_0x0798('0x27')]=function(_0x3a3cc7,_0x48a072){if(_0x3a3cc7['body']['id']){delete _0x3a3cc7['body']['id'];}return db[_0x0798('0x31')]['find']({'where':{'id':_0x3a3cc7['params']['id']}})[_0x0798('0x28')](handleEntityNotFound(_0x48a072,null))[_0x0798('0x28')](saveUpdates(_0x3a3cc7[_0x0798('0x4c')],null))['then'](respondWithResult(_0x48a072,null))[_0x0798('0x45')](handleError(_0x48a072,null));};exports[_0x0798('0x29')]=function(_0x359a4d,_0x743d26){return db['Tag']['find']({'where':{'id':_0x359a4d[_0x0798('0x47')]['id']}})[_0x0798('0x28')](handleEntityNotFound(_0x743d26,null))[_0x0798('0x28')](removeEntity(_0x743d26,null))['catch'](handleError(_0x743d26,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index f300c48..13cf67a 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 _0xcf62=['bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','define','Tag','tools_tags','lodash','util','api','moment'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xcf62,0x71));var _0x2cf6=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xcf62[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x2cf6('0x0'));var util=require(_0x2cf6('0x1'));var logger=require('../../config/logger')(_0x2cf6('0x2'));var moment=require(_0x2cf6('0x3'));var BPromise=require(_0x2cf6('0x4'));var rp=require(_0x2cf6('0x5'));var fs=require('fs');var path=require(_0x2cf6('0x6'));var rimraf=require(_0x2cf6('0x7'));var config=require(_0x2cf6('0x8'));var attributes=require(_0x2cf6('0x9'));module['exports']=function(_0x3fe4c2,_0x55ab07){return _0x3fe4c2[_0x2cf6('0xa')](_0x2cf6('0xb'),attributes,{'tableName':_0x2cf6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd4a=['tools_tags','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./tag.attributes','exports','define','Tag'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xdd4a,0xb1));var _0xadd4=function(_0x5a25f6,_0x3db5cb){_0x5a25f6=_0x5a25f6-0x0;var _0x5a524d=_0xdd4a[_0x5a25f6];return _0x5a524d;};'use strict';var _=require('lodash');var util=require(_0xadd4('0x0'));var logger=require(_0xadd4('0x1'))(_0xadd4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xadd4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xadd4('0x4'));var config=require(_0xadd4('0x5'));var attributes=require(_0xadd4('0x6'));module[_0xadd4('0x7')]=function(_0x58d443,_0x48c29d){return _0x58d443[_0xadd4('0x8')](_0xadd4('0x9'),attributes,{'tableName':_0xadd4('0xa'),'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 673a8f7..e30edad 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 _0xb458=['Tag,\x20%s,\x20%s,\x20%s','code','error','message','request\x20sent','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','Tag,\x20%s,\x20%s','debug'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xb458,0x103));var _0x8b45=function(_0x41cb9f,_0x34f6e0){_0x41cb9f=_0x41cb9f-0x0;var _0x426494=_0xb458[_0x41cb9f];return _0x426494;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var moment=require(_0x8b45('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b45('0x3'));var db=require(_0x8b45('0x4'))['db'];var utils=require(_0x8b45('0x5'));var logger=require(_0x8b45('0x6'))('rpc');var config=require(_0x8b45('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8b45('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12bd05,_0x2daa9a,_0x3a8ccb){return new BPromise(function(_0x32342f,_0x4d1718){return client[_0x8b45('0x9')](_0x12bd05,_0x3a8ccb)[_0x8b45('0xa')](function(_0x33f30e){logger[_0x8b45('0xb')](_0x8b45('0xc'),_0x2daa9a,'request\x20sent');logger[_0x8b45('0xd')](_0x8b45('0xe'),_0x2daa9a,'request\x20sent',JSON['stringify'](_0x33f30e));if(_0x33f30e['error']){if(_0x33f30e['error'][_0x8b45('0xf')]===0x1f4){logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x33f30e['error'][_0x8b45('0x11')]);return _0x4d1718(_0x33f30e[_0x8b45('0x10')][_0x8b45('0x11')]);}logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x33f30e[_0x8b45('0x10')]['message']);return _0x32342f(_0x33f30e['error'][_0x8b45('0x11')]);}else{logger[_0x8b45('0xb')](_0x8b45('0xc'),_0x2daa9a,_0x8b45('0x12'));_0x32342f(_0x33f30e[_0x8b45('0x13')][_0x8b45('0x11')]);}})[_0x8b45('0x14')](function(_0x147d6b){logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x147d6b);_0x4d1718(_0x147d6b);});});} \ No newline at end of file +var _0xd382=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','info','Tag,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x93f510,_0x4aedb1){var _0x3e5ebe=function(_0x605995){while(--_0x605995){_0x93f510['push'](_0x93f510['shift']());}};_0x3e5ebe(++_0x4aedb1);}(_0xd382,0x1b6));var _0x2d38=function(_0x294ba2,_0x492576){_0x294ba2=_0x294ba2-0x0;var _0x5251b5=_0xd382[_0x294ba2];return _0x5251b5;};'use strict';var _=require(_0x2d38('0x0'));var util=require(_0x2d38('0x1'));var moment=require(_0x2d38('0x2'));var BPromise=require(_0x2d38('0x3'));var rs=require(_0x2d38('0x4'));var fs=require('fs');var Redis=require(_0x2d38('0x5'));var db=require(_0x2d38('0x6'))['db'];var utils=require(_0x2d38('0x7'));var logger=require(_0x2d38('0x8'))(_0x2d38('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2d38('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e2919,_0x55ae65,_0x1296cb){return new BPromise(function(_0x3fb88f,_0x39ebfd){return client['request'](_0x1e2919,_0x1296cb)['then'](function(_0x5f20a4){logger[_0x2d38('0xb')](_0x2d38('0xc'),_0x55ae65,'request\x20sent');logger[_0x2d38('0xd')]('Tag,\x20%s,\x20%s,\x20%s',_0x55ae65,_0x2d38('0xe'),JSON[_0x2d38('0xf')](_0x5f20a4));if(_0x5f20a4[_0x2d38('0x10')]){if(_0x5f20a4[_0x2d38('0x10')][_0x2d38('0x11')]===0x1f4){logger[_0x2d38('0x10')](_0x2d38('0xc'),_0x55ae65,_0x5f20a4['error'][_0x2d38('0x12')]);return _0x39ebfd(_0x5f20a4[_0x2d38('0x10')][_0x2d38('0x12')]);}logger[_0x2d38('0x10')](_0x2d38('0xc'),_0x55ae65,_0x5f20a4['error'][_0x2d38('0x12')]);return _0x3fb88f(_0x5f20a4[_0x2d38('0x10')][_0x2d38('0x12')]);}else{logger[_0x2d38('0xb')](_0x2d38('0xc'),_0x55ae65,_0x2d38('0xe'));_0x3fb88f(_0x5f20a4[_0x2d38('0x13')][_0x2d38('0x12')]);}})[_0x2d38('0x14')](function(_0x6d2a9a){logger[_0x2d38('0x10')](_0x2d38('0xc'),_0x55ae65,_0x6d2a9a);_0x39ebfd(_0x6d2a9a);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index df14fa0..b242bf5 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 452c64b..1cfbc2f 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 _0x757a=['exports','STRING'];(function(_0x4a5b02,_0x2f2061){var _0xaef9c5=function(_0x50437d){while(--_0x50437d){_0x4a5b02['push'](_0x4a5b02['shift']());}};_0xaef9c5(++_0x2f2061);}(_0x757a,0xde));var _0xa757=function(_0x244c96,_0x1a8e6a){_0x244c96=_0x244c96-0x0;var _0x113f5f=_0x757a[_0x244c96];return _0x113f5f;};'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 +var _0xb7e7=['STRING','sequelize'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xb7e7[_0x164eca];return _0x2ce562;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 1e6a9ae..996a9cf 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 _0x388c=['save','update','then','error','stack','name','send','index','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','filter','where','merge','options','Team','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','FaxQueueId','OpenchannelQueueId','UserVoicePrefix','getQueues','findOne','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','length','sort','pick','Queues','isValidChannel','add','ids','remove','addAgents','isArray','Voice','Mail','Sms','Fax','Whatsapp','through','QueueId','TeamVoiceQueue','User','Queue','emit','Queue:save','findAll','online','interface','UserVoiceQueueRt','format','SIP/%s','penalty','all','TeamVoicePrefix','VoicePrefixId','spread','removeAgents','Chat','Openchannel','Queue:remove','getAgents','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject'];(function(_0x55a04b,_0x760be4){var _0x41e61e=function(_0x26e231){while(--_0x26e231){_0x55a04b['push'](_0x55a04b['shift']());}};_0x41e61e(++_0x760be4);}(_0x388c,0x19c));var _0xc388=function(_0x49cbfe,_0x1e6a12){_0x49cbfe=_0x49cbfe-0x0;var _0xa22a0c=_0x388c[_0x49cbfe];return _0xa22a0c;};'use strict';var emlformat=require(_0xc388('0x0'));var rimraf=require(_0xc388('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc388('0x2'));var rp=require('request-promise');var moment=require(_0xc388('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc388('0x4'));var util=require(_0xc388('0x5'));var path=require(_0xc388('0x6'));var sox=require(_0xc388('0x7'));var csv=require(_0xc388('0x8'));var ejs=require(_0xc388('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc388('0xa'));var squel=require(_0xc388('0xb'));var crypto=require(_0xc388('0xc'));var jsforce=require(_0xc388('0xd'));var deskjs=require(_0xc388('0xe'));var toCsv=require(_0xc388('0x8'));var querystring=require(_0xc388('0xf'));var Papa=require(_0xc388('0x10'));var Redis=require(_0xc388('0x11'));var authService=require(_0xc388('0x12'));var qs=require(_0xc388('0x13'));var as=require(_0xc388('0x14'));var hardwareService=require(_0xc388('0x15'));var logger=require(_0xc388('0x16'))(_0xc388('0x17'));var utils=require(_0xc388('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xc388('0x19'));var db=require('../../mysqldb')['db'];config[_0xc388('0x1a')]=_[_0xc388('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc388('0x1c'))(new Redis(config[_0xc388('0x1a')]));require(_0xc388('0x1d'))[_0xc388('0x1e')](socket);function respondWithStatusCode(_0x4650ee,_0x10f512){_0x10f512=_0x10f512||0xcc;return function(_0x29cd9a){if(_0x29cd9a){return _0x4650ee[_0xc388('0x1f')](_0x10f512);}return _0x4650ee[_0xc388('0x20')](_0x10f512)[_0xc388('0x21')]();};}function respondWithResult(_0x234aa9,_0x10731f){_0x10731f=_0x10731f||0xc8;return function(_0x272085){if(_0x272085){return _0x234aa9[_0xc388('0x20')](_0x10731f)[_0xc388('0x22')](_0x272085);}};}function respondWithFilteredResult(_0x28086e,_0x5a9f08){return function(_0x17ec43){if(_0x17ec43){var _0x3fff61=typeof _0x5a9f08['offset']===_0xc388('0x23')&&typeof _0x5a9f08[_0xc388('0x24')]===_0xc388('0x23');var _0x5d69ff=_0x17ec43[_0xc388('0x25')];var _0x505b48=_0x3fff61?0x0:_0x5a9f08[_0xc388('0x26')];var _0x58e8f5=_0x3fff61?_0x17ec43[_0xc388('0x25')]:_0x5a9f08[_0xc388('0x26')]+_0x5a9f08[_0xc388('0x24')];var _0xd23924;if(_0x58e8f5>=_0x5d69ff){_0x58e8f5=_0x5d69ff;_0xd23924=0xc8;}else{_0xd23924=0xce;}_0x28086e[_0xc388('0x20')](_0xd23924);return _0x28086e['set']('Content-Range',_0x505b48+'-'+_0x58e8f5+'/'+_0x5d69ff)[_0xc388('0x22')](_0x17ec43);}return null;};}function patchUpdates(_0x41789a){return function(_0x389862){try{jsonpatch[_0xc388('0x27')](_0x389862,_0x41789a,!![]);}catch(_0x2f1b29){return BPromise[_0xc388('0x28')](_0x2f1b29);}return _0x389862[_0xc388('0x29')]();};}function saveUpdates(_0x41047e,_0x1e9710){return function(_0x5e3340){if(_0x5e3340){return _0x5e3340[_0xc388('0x2a')](_0x41047e)[_0xc388('0x2b')](function(_0x163d42){return _0x163d42;});}return null;};}function handleEntityNotFound(_0x21e4af,_0x12ddd5){return function(_0x281ecf){if(!_0x281ecf){_0x21e4af['sendStatus'](0x194);}return _0x281ecf;};}function handleError(_0xcfc10,_0x31b3b6){_0x31b3b6=_0x31b3b6||0x1f4;return function(_0xc73865){logger[_0xc388('0x2c')](_0xc73865[_0xc388('0x2d')]);if(_0xc73865[_0xc388('0x2e')]){delete _0xc73865[_0xc388('0x2e')];}_0xcfc10[_0xc388('0x20')](_0x31b3b6)[_0xc388('0x2f')](_0xc73865);};}exports[_0xc388('0x30')]=function(_0x192c87,_0x27c52d){var _0x453dff={},_0x2d62aa={},_0x37103e={'count':0x0,'rows':[]};var _0x462065=_['map'](db['Team']['rawAttributes'],function(_0x2b260b){return{'name':_0x2b260b['fieldName'],'type':_0x2b260b['type'][_0xc388('0x31')]};});_0x2d62aa[_0xc388('0x32')]=_[_0xc388('0x33')](_0x462065,_0xc388('0x2e'));_0x2d62aa[_0xc388('0x34')]=_[_0xc388('0x35')](_0x192c87[_0xc388('0x34')]);_0x2d62aa[_0xc388('0x36')]=_['intersection'](_0x2d62aa[_0xc388('0x32')],_0x2d62aa[_0xc388('0x34')]);_0x453dff[_0xc388('0x37')]=_[_0xc388('0x38')](_0x2d62aa['model'],qs[_0xc388('0x39')](_0x192c87[_0xc388('0x34')][_0xc388('0x39')]));_0x453dff[_0xc388('0x37')]=_0x453dff[_0xc388('0x37')]['length']?_0x453dff[_0xc388('0x37')]:_0x2d62aa[_0xc388('0x32')];if(!_0x192c87[_0xc388('0x34')][_0xc388('0x3a')](_0xc388('0x3b'))){_0x453dff[_0xc388('0x24')]=qs[_0xc388('0x24')](_0x192c87[_0xc388('0x34')][_0xc388('0x24')]);_0x453dff[_0xc388('0x26')]=qs['offset'](_0x192c87[_0xc388('0x34')][_0xc388('0x26')]);}_0x453dff[_0xc388('0x3c')]=qs['sort'](_0x192c87[_0xc388('0x34')]['sort']);_0x453dff['where']=qs[_0xc388('0x36')](_['pick'](_0x192c87[_0xc388('0x34')],_0x2d62aa[_0xc388('0x36')]),_0x462065);if(_0x192c87[_0xc388('0x34')][_0xc388('0x3d')]){_0x453dff[_0xc388('0x3e')]=_[_0xc388('0x3f')](_0x453dff[_0xc388('0x3e')],{'$or':_[_0xc388('0x33')](_0x462065,function(_0x5232e7){if(_0x5232e7['type']!=='VIRTUAL'){var _0xad94aa={};_0xad94aa[_0x5232e7[_0xc388('0x2e')]]={'$like':'%'+_0x192c87['query'][_0xc388('0x3d')]+'%'};return _0xad94aa;}})});}_0x453dff=_[_0xc388('0x3f')]({},_0x453dff,_0x192c87[_0xc388('0x40')]);var _0x1488fa={'where':_0x453dff[_0xc388('0x3e')]};return db[_0xc388('0x41')][_0xc388('0x25')](_0x1488fa)[_0xc388('0x2b')](function(_0x1ba709){_0x37103e[_0xc388('0x25')]=_0x1ba709;if(_0x192c87[_0xc388('0x34')][_0xc388('0x42')]){_0x453dff[_0xc388('0x43')]=[{'all':!![]}];}return db[_0xc388('0x41')]['findAll'](_0x453dff);})['then'](function(_0x27948b){_0x37103e[_0xc388('0x44')]=_0x27948b;return _0x37103e;})[_0xc388('0x2b')](respondWithFilteredResult(_0x27c52d,_0x453dff))[_0xc388('0x45')](handleError(_0x27c52d,null));};exports[_0xc388('0x46')]=function(_0x5c5429,_0x43339f){var _0x447c93={'raw':![],'where':{'id':_0x5c5429[_0xc388('0x47')]['id']}},_0x55d8e1={};_0x55d8e1[_0xc388('0x32')]=_[_0xc388('0x35')](db[_0xc388('0x41')][_0xc388('0x48')]);_0x55d8e1[_0xc388('0x34')]=_[_0xc388('0x35')](_0x5c5429[_0xc388('0x34')]);_0x55d8e1[_0xc388('0x36')]=_[_0xc388('0x38')](_0x55d8e1[_0xc388('0x32')],_0x55d8e1[_0xc388('0x34')]);_0x447c93[_0xc388('0x37')]=_[_0xc388('0x38')](_0x55d8e1[_0xc388('0x32')],qs['fields'](_0x5c5429[_0xc388('0x34')]['fields']));_0x447c93[_0xc388('0x37')]=_0x447c93[_0xc388('0x37')]['length']?_0x447c93[_0xc388('0x37')]:_0x55d8e1[_0xc388('0x32')];if(_0x5c5429[_0xc388('0x34')][_0xc388('0x42')]){_0x447c93[_0xc388('0x43')]=[{'all':!![]}];}_0x447c93=_[_0xc388('0x3f')]({},_0x447c93,_0x5c5429[_0xc388('0x40')]);return db[_0xc388('0x41')][_0xc388('0x49')](_0x447c93)[_0xc388('0x2b')](handleEntityNotFound(_0x43339f,null))[_0xc388('0x2b')](respondWithResult(_0x43339f,null))['catch'](handleError(_0x43339f,null));};exports[_0xc388('0x4a')]=function(_0x2959b0,_0x2fb526){return db['Team'][_0xc388('0x4a')](_0x2959b0[_0xc388('0x4b')],{})['then'](function(_0xc4263e){var _0x3f8c86=_0x2959b0[_0xc388('0x4c')]['get']({'plain':!![]});if(!_0x3f8c86)throw new Error(_0xc388('0x4d'));if(_0x3f8c86[_0xc388('0x4e')]==='user'){var _0x255aaf=_0xc4263e[_0xc388('0x4f')]({'plain':!![]});var _0x42a7f7=_0xc388('0x50');return db[_0xc388('0x51')]['find']({'where':{'name':_0x42a7f7,'userProfileId':_0x3f8c86[_0xc388('0x52')]},'raw':!![]})[_0xc388('0x2b')](function(_0x335369){if(_0x335369&&_0x335369[_0xc388('0x53')]===0x0){return db[_0xc388('0x54')][_0xc388('0x4a')]({'name':_0x255aaf[_0xc388('0x2e')],'resourceId':_0x255aaf['id'],'type':_0x335369[_0xc388('0x2e')],'sectionId':_0x335369['id']},{})[_0xc388('0x2b')](function(){return _0xc4263e;});}else{return _0xc4263e;}})[_0xc388('0x45')](function(_0x47287e){logger['error'](_0xc388('0x55'),_0x47287e);throw _0x47287e;});}return _0xc4263e;})[_0xc388('0x2b')](respondWithResult(_0x2fb526,0xc9))[_0xc388('0x45')](handleError(_0x2fb526,null));};exports[_0xc388('0x2a')]=function(_0x5164fa,_0x33e139){if(_0x5164fa['body']['id']){delete _0x5164fa[_0xc388('0x4b')]['id'];}return db[_0xc388('0x41')]['find']({'where':{'id':_0x5164fa[_0xc388('0x47')]['id']}})['then'](handleEntityNotFound(_0x33e139,null))[_0xc388('0x2b')](saveUpdates(_0x5164fa[_0xc388('0x4b')],null))[_0xc388('0x2b')](respondWithResult(_0x33e139,null))[_0xc388('0x45')](handleError(_0x33e139,null));};exports[_0xc388('0x56')]=function(_0x5cf307,_0x252643){var _0x40fc21=_0x5cf307[_0xc388('0x47')]['id'];var _0x88277f=[];return db[_0xc388('0x57')][_0xc388('0x58')](function(_0xa78439){var _0x4c1a19='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x40fc21;return db[_0xc388('0x57')]['query'](_0x4c1a19,{'type':db['Sequelize'][_0xc388('0x59')]['SELECT'],'raw':!![],'transaction':_0xa78439})[_0xc388('0x2b')](function(_0x4def7a){_0x88277f=_['map'](_0x4def7a,function(_0x4cc9fd){return Number(_0x4cc9fd[_0xc388('0x5a')]);});})['then'](function(){var _0x1015fe=_0xc388('0x5b')+_0x40fc21;return db['sequelize'][_0xc388('0x34')](_0x1015fe,{'type':db[_0xc388('0x5c')][_0xc388('0x59')][_0xc388('0x5d')],'raw':!![],'transaction':_0xa78439});})[_0xc388('0x2b')](function(_0x4e694a){var _0x2e869a=_[_0xc388('0x33')](_0x4e694a,function(_0x57182f){return Number(_0x57182f['VoiceQueueId']);});return db[_0xc388('0x5e')][_0xc388('0x56')]({'where':{'UserId':{'$in':_0x88277f},'VoiceQueueId':{'$in':_0x2e869a}},'transaction':_0xa78439});})[_0xc388('0x2b')](function(){var _0x54dab8=_0xc388('0x5f')+_0x40fc21;return db[_0xc388('0x57')][_0xc388('0x34')](_0x54dab8,{'type':db[_0xc388('0x5c')][_0xc388('0x59')][_0xc388('0x5d')],'raw':!![],'transaction':_0xa78439});})['then'](function(_0xdb07e4){var _0x56e8a3=_[_0xc388('0x33')](_0xdb07e4,function(_0x258db6){return Number(_0x258db6[_0xc388('0x60')]);});return db['UserMailQueue']['destroy']({'where':{'UserId':{'$in':_0x88277f},'MailQueueId':{'$in':_0x56e8a3}},'transaction':_0xa78439});})[_0xc388('0x2b')](function(){var _0x1c30cb=_0xc388('0x61')+_0x40fc21;return db['sequelize'][_0xc388('0x34')](_0x1c30cb,{'type':db[_0xc388('0x5c')][_0xc388('0x59')][_0xc388('0x5d')],'raw':!![],'transaction':_0xa78439});})[_0xc388('0x2b')](function(_0x6fe460){var _0x12748d=_[_0xc388('0x33')](_0x6fe460,function(_0x7536f8){return Number(_0x7536f8[_0xc388('0x62')]);});return db[_0xc388('0x63')][_0xc388('0x56')]({'where':{'UserId':{'$in':_0x88277f},'SmsQueueId':{'$in':_0x12748d}},'transaction':_0xa78439});})['then'](function(){var _0x2550bc=_0xc388('0x64')+_0x40fc21;return db['sequelize']['query'](_0x2550bc,{'type':db[_0xc388('0x5c')][_0xc388('0x59')][_0xc388('0x5d')],'raw':!![],'transaction':_0xa78439});})[_0xc388('0x2b')](function(_0x40d6b0){var _0xe2a2df=_['map'](_0x40d6b0,function(_0x17f0eb){return Number(_0x17f0eb[_0xc388('0x65')]);});return db[_0xc388('0x66')][_0xc388('0x56')]({'where':{'UserId':{'$in':_0x88277f},'ChatQueueId':{'$in':_0xe2a2df}},'transaction':_0xa78439});})[_0xc388('0x2b')](function(){var _0x333bc5='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x40fc21;return db['sequelize'][_0xc388('0x34')](_0x333bc5,{'type':db['Sequelize']['QueryTypes'][_0xc388('0x5d')],'raw':!![],'transaction':_0xa78439});})['then'](function(_0x4cb88e){var _0x4cd2e8=_[_0xc388('0x33')](_0x4cb88e,function(_0x1caa39){return Number(_0x1caa39[_0xc388('0x67')]);});return db['UserFaxQueue'][_0xc388('0x56')]({'where':{'UserId':{'$in':_0x88277f},'FaxQueueId':{'$in':_0x4cd2e8}},'transaction':_0xa78439});})['then'](function(){var _0x39403b='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x40fc21;return db[_0xc388('0x57')][_0xc388('0x34')](_0x39403b,{'type':db[_0xc388('0x5c')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0xa78439});})[_0xc388('0x2b')](function(_0x3648fd){var _0x1f900f=_[_0xc388('0x33')](_0x3648fd,function(_0x202959){return Number(_0x202959[_0xc388('0x68')]);});return db['UserOpenchannelQueue'][_0xc388('0x56')]({'where':{'UserId':{'$in':_0x88277f},'OpenchannelQueueId':{'$in':_0x1f900f}},'transaction':_0xa78439});})['then'](function(){var _0x113129='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x40fc21;return db[_0xc388('0x57')][_0xc388('0x34')](_0x113129,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![],'transaction':_0xa78439});})[_0xc388('0x2b')](function(_0xc22c1a){var _0x2af90d=_[_0xc388('0x33')](_0xc22c1a,function(_0x35a6c3){return Number(_0x35a6c3['WhatsappQueueId']);});return db['UserWhatsappQueue'][_0xc388('0x56')]({'where':{'UserId':{'$in':_0x88277f},'WhatsappQueueId':{'$in':_0x2af90d}},'transaction':_0xa78439});})['then'](function(){return db['TeamVoicePrefix'][_0xc388('0x49')]({'where':{'TeamId':_0x40fc21}});})[_0xc388('0x2b')](function(_0x437582){if(_0x437582===null){return;}return db[_0xc388('0x69')][_0xc388('0x56')]({'where':{'UserId':{'$in':_0x88277f},'VoicePrefixId':_0x437582['VoicePrefixId']},'transaction':_0xa78439});})[_0xc388('0x2b')](function(){return db[_0xc388('0x41')]['destroy']({'where':{'id':_0x40fc21},'cascade':!![],'transaction':_0xa78439});})[_0xc388('0x2b')](function(_0xa6efb7){if(_0xa6efb7===0x0){_0x252643[_0xc388('0x1f')](0x194);}else{return db[_0xc388('0x54')]['destroy']({'where':{'type':'Teams','resourceId':_0x40fc21},'cascade':!![],'transaction':_0xa78439})['then'](function(){_0x252643['status'](0xcc)[_0xc388('0x21')]();});}})[_0xc388('0x45')](function(_0x4bcf3e){_0x252643[_0xc388('0x20')](0x1f4)['send'](_0x4bcf3e);});});};exports[_0xc388('0x6a')]=function(_0x49d615,_0x410a51,_0x3c2382){return db[_0xc388('0x41')][_0xc388('0x6b')]({'where':{'id':_0x49d615[_0xc388('0x47')]['id']}})[_0xc388('0x2b')](handleEntityNotFound(_0x410a51,null))[_0xc388('0x2b')](function(_0x427644){if(!_0x49d615[_0xc388('0x34')][_0xc388('0x6c')]||!utils['isValidChannel'](_0x49d615['query'][_0xc388('0x6c')])){throw new db[(_0xc388('0x5c'))][(_0xc388('0x6d'))](_0xc388('0x6e'));}var _0xf831df={};var _0x59f72f={};_0x59f72f['model']=_[_0xc388('0x35')](db[_[_0xc388('0x6f')](_0x49d615[_0xc388('0x34')][_0xc388('0x6c')][_0xc388('0x70')]())+'Queue'][_0xc388('0x48')]);_0x59f72f[_0xc388('0x34')]=_[_0xc388('0x35')](_0x49d615['query']);_0x59f72f['filters']=_['intersection'](_0x59f72f[_0xc388('0x32')],_0x59f72f[_0xc388('0x34')]);_0xf831df[_0xc388('0x37')]=_[_0xc388('0x38')](_0x59f72f[_0xc388('0x32')],qs[_0xc388('0x39')](_0x49d615[_0xc388('0x34')][_0xc388('0x39')]));_0xf831df[_0xc388('0x37')]=_0xf831df[_0xc388('0x37')][_0xc388('0x71')]?_0xf831df[_0xc388('0x37')]:_0x59f72f[_0xc388('0x32')];_0xf831df['limit']=qs[_0xc388('0x24')](_0x49d615[_0xc388('0x34')][_0xc388('0x24')]);_0xf831df[_0xc388('0x26')]=qs[_0xc388('0x26')](_0x49d615['query'][_0xc388('0x26')]);_0xf831df[_0xc388('0x3c')]=qs[_0xc388('0x72')](_0x49d615[_0xc388('0x34')]['sort']);_0xf831df[_0xc388('0x3e')]=qs[_0xc388('0x36')](_[_0xc388('0x73')](_0x49d615[_0xc388('0x34')],_0x59f72f[_0xc388('0x36')]));_0xf831df=_[_0xc388('0x3f')]({},_0xf831df,_0x49d615[_0xc388('0x40')]);return _0x427644[_0xc388('0x4f')+_[_0xc388('0x6f')](_0x49d615['query'][_0xc388('0x6c')]['toLowerCase']())+_0xc388('0x74')](_0xf831df);})[_0xc388('0x2b')](respondWithResult(_0x410a51,null))[_0xc388('0x45')](handleError(_0x410a51,null));};exports['addQueues']=function(_0x28d9b5,_0x45152f,_0x5de7e4){return db[_0xc388('0x41')]['findOne']({'where':{'id':_0x28d9b5[_0xc388('0x47')]['id']}})['then'](function(_0x5071e6){if(_0x5071e6){if(!_0x28d9b5[_0xc388('0x4b')][_0xc388('0x6c')]||!utils[_0xc388('0x75')](_0x28d9b5[_0xc388('0x4b')][_0xc388('0x6c')])){throw new db[(_0xc388('0x5c'))]['ValidationError']('Unknown\x20channel');}return _0x5071e6[_0xc388('0x76')+_[_0xc388('0x6f')](_0x28d9b5[_0xc388('0x4b')]['channel'][_0xc388('0x70')]())+_0xc388('0x74')](_0x28d9b5[_0xc388('0x4b')][_0xc388('0x77')]);}return null;})[_0xc388('0x2b')](handleEntityNotFound(_0x45152f,null))[_0xc388('0x2b')](respondWithStatusCode(_0x45152f,null))['catch'](handleError(_0x45152f,null));};exports['removeQueues']=function(_0x4a31c2,_0x52058e,_0x429216){return db[_0xc388('0x41')][_0xc388('0x6b')]({'where':{'id':_0x4a31c2['params']['id']}})[_0xc388('0x2b')](function(_0x3f8411){if(_0x3f8411){if(!_0x4a31c2['query']['channel']||!utils[_0xc388('0x75')](_0x4a31c2[_0xc388('0x34')][_0xc388('0x6c')])){throw new db[(_0xc388('0x5c'))][(_0xc388('0x6d'))](_0xc388('0x6e'));}return _0x3f8411[_0xc388('0x78')+_[_0xc388('0x6f')](_0x4a31c2['query'][_0xc388('0x6c')]['toLowerCase']())+_0xc388('0x74')](_0x4a31c2[_0xc388('0x34')][_0xc388('0x77')]);}return null;})[_0xc388('0x2b')](handleEntityNotFound(_0x52058e,null))[_0xc388('0x2b')](respondWithStatusCode(_0x52058e,null))['catch'](handleError(_0x52058e,null));};exports[_0xc388('0x79')]=function(_0x3e4c84,_0x24200b){var _0xb4567=_[_0xc388('0x7a')](_0x3e4c84[_0xc388('0x4b')]['ids'])?_0x3e4c84['body'][_0xc388('0x77')]:[_0x3e4c84[_0xc388('0x4b')][_0xc388('0x77')]];var _0x2786e5=_0x3e4c84['params']['id'];return db[_0xc388('0x41')]['find']({'where':{'id':_0x2786e5}})[_0xc388('0x2b')](handleEntityNotFound(_0x24200b,null))[_0xc388('0x2b')](function(_0x287459){if(_0x287459){var _0x4898ab=[_0xc388('0x7b'),'Chat',_0xc388('0x7c'),_0xc388('0x7d'),_0xc388('0x7e'),'Openchannel',_0xc388('0x7f')];return db[_0xc388('0x57')][_0xc388('0x58')](function(_0x1da8fb){var _0x535415=_[_0xc388('0x33')](_0x4898ab,function(_0x48b1c0){var _0x4b88af={'attributes':['id',_0xc388('0x2e')]};if(_0x48b1c0===_0xc388('0x7b')){_0x4b88af[_0xc388('0x80')]={'attributes':['penalty']};}return _0x287459[_0xc388('0x4f')+_0x48b1c0+_0xc388('0x74')](_0x4b88af)['then'](function(_0x457775){var _0x2e1847=_[_0xc388('0x33')](_0x457775,function(_0x242e23){var _0x3ad6a2=_['map'](_0xb4567,function(_0x599194){var _0x203118={'where':{'UserId':_0x599194,[_0x48b1c0+_0xc388('0x81')]:_0x242e23['id']},'transaction':_0x1da8fb};if(_0x48b1c0==='Voice'){_0x203118[_0xc388('0x1b')]={'penalty':_0x242e23[_0xc388('0x82')]['penalty']};}return db[_0xc388('0x83')+_0x48b1c0+_0xc388('0x84')]['findOrCreate'](_0x203118)[_0xc388('0x2b')](function(){socket[_0xc388('0x85')]('user'+_0x48b1c0+_0xc388('0x86'),{'UserId':_0x599194,[_0x48b1c0+_0xc388('0x81')]:_0x242e23['id']});if(_0x48b1c0!==_0xc388('0x7b')){return;}return db[_0xc388('0x83')][_0xc388('0x87')]({'where':{'id':_0xb4567,'online':0x1},'attributes':['id',_0xc388('0x2e'),_0xc388('0x88'),'voicePause',_0xc388('0x89')],'raw':!![]})[_0xc388('0x2b')](function(_0x23575c){var _0x11c88d=_[_0xc388('0x33')](_0x23575c,function(_0x201e48){return db[_0xc388('0x8a')]['upsert']({'membername':_0x201e48['name'],'UserId':_0x201e48['id'],'queue_name':_0x242e23[_0xc388('0x2e')],'VoiceQueueId':_0x242e23['id'],'interface':_['isNil'](_0x201e48['interface'])?util[_0xc388('0x8b')](_0xc388('0x8c'),_0x201e48[_0xc388('0x2e')]):_0x201e48[_0xc388('0x89')],'paused':_0x201e48['voicePause']||![],'penalty':_0x242e23[_0xc388('0x82')][_0xc388('0x8d')]},{'transaction':_0x1da8fb});});return Promise[_0xc388('0x8e')](_0x11c88d);});});});return Promise[_0xc388('0x8e')](_0x3ad6a2);});return Promise['all'](_0x2e1847);})[_0xc388('0x2b')](function(){return db[_0xc388('0x8f')]['findOne']({'where':{'teamId':_0x2786e5}})['then'](function(_0x23e94f){if(_0x23e94f){var _0xffe934=_[_0xc388('0x33')](_0xb4567,function(_0x41dc26){db[_0xc388('0x69')]['upsert']({'UserId':_0x41dc26,'VoicePrefixId':_0x23e94f[_0xc388('0x90')]});});return Promise['all'](_0xffe934);}});});});return Promise[_0xc388('0x8e')](_0x535415)[_0xc388('0x2b')](function(){return _0x287459[_0xc388('0x79')](_0xb4567,{'transaction':_0x1da8fb})[_0xc388('0x91')](function(_0x137fbc){return _0x137fbc;});});});}})[_0xc388('0x2b')](respondWithResult(_0x24200b,null))['catch'](handleError(_0x24200b,null));};exports[_0xc388('0x92')]=function(_0x8b9177,_0x694be){var _0x3ecdb0=_[_0xc388('0x7a')](_0x8b9177[_0xc388('0x34')]['ids'])?_0x8b9177[_0xc388('0x34')][_0xc388('0x77')]:[_0x8b9177[_0xc388('0x34')]['ids']];var _0xcb73e7=_0x8b9177[_0xc388('0x47')]['id'];return db[_0xc388('0x41')]['find']({'where':{'id':_0xcb73e7}})[_0xc388('0x2b')](handleEntityNotFound(_0x694be,null))[_0xc388('0x2b')](function(_0x37f202){if(_0x37f202){var _0x1c4b8d=['Voice',_0xc388('0x93'),_0xc388('0x7c'),_0xc388('0x7d'),_0xc388('0x7e'),_0xc388('0x94'),_0xc388('0x7f')];return db[_0xc388('0x57')][_0xc388('0x58')](function(_0x2ec322){var _0x4d09fe=_['map'](_0x1c4b8d,function(_0x2f85eb){var _0x240801={'attributes':['id',_0xc388('0x2e')]};return _0x37f202[_0xc388('0x4f')+_0x2f85eb+_0xc388('0x74')](_0x240801)['then'](function(_0x42b176){var _0x305304=_[_0xc388('0x33')](_0x42b176,function(_0xcb6190){return _0xcb6190[_0xc388('0x92')](_0x3ecdb0,{'transaction':_0x2ec322})['then'](function(){var _0x186f25=_[_0xc388('0x33')](_0x3ecdb0,function(_0x2c0e41){socket['emit'](_0xc388('0x4c')+_0x2f85eb+_0xc388('0x95'),{'UserId':Number(_0x2c0e41),[_0x2f85eb+_0xc388('0x81')]:_0xcb6190['id']});if(_0x2f85eb!==_0xc388('0x7b')){return;}return db[_0xc388('0x8a')]['destroy']({'where':{'VoiceQueueId':_0xcb6190['id'],'UserId':_0x2c0e41},'transaction':_0x2ec322});});return Promise['all'](_0x186f25);});});return Promise[_0xc388('0x8e')](_0x305304);});});return Promise[_0xc388('0x8e')](_0x4d09fe)['then'](function(){return _0x37f202[_0xc388('0x92')](_0x3ecdb0,{'transaction':_0x2ec322});})[_0xc388('0x2b')](function(){return db[_0xc388('0x8f')][_0xc388('0x6b')]({'where':{'teamId':_0xcb73e7}})[_0xc388('0x2b')](function(_0x13b2a4){if(_0x13b2a4){var _0x53831f=_[_0xc388('0x33')](_0x3ecdb0,function(_0x27dfc7){db['UserVoicePrefix'][_0xc388('0x56')]({'where':{'UserId':_0x27dfc7,'VoicePrefixId':_0x13b2a4[_0xc388('0x90')]}});});return Promise['all'](_0x53831f);}});});});}})[_0xc388('0x2b')](respondWithStatusCode(_0x694be,null))['catch'](handleError(_0x694be,null));};exports[_0xc388('0x96')]=function(_0x5bce0d,_0x4a624a,_0x3b48e0){var _0x8307a5={};var _0x1070fb={};var _0x346537;var _0x35512b;return db['Team'][_0xc388('0x6b')]({'where':{'id':_0x5bce0d[_0xc388('0x47')]['id']}})[_0xc388('0x2b')](handleEntityNotFound(_0x4a624a,null))[_0xc388('0x2b')](function(_0x2cb1d3){if(_0x2cb1d3){_0x346537=_0x2cb1d3;_0x1070fb[_0xc388('0x32')]=_[_0xc388('0x35')](db[_0xc388('0x83')][_0xc388('0x48')]);_0x1070fb[_0xc388('0x34')]=_[_0xc388('0x35')](_0x5bce0d[_0xc388('0x34')]);_0x1070fb[_0xc388('0x36')]=_[_0xc388('0x38')](_0x1070fb[_0xc388('0x32')],_0x1070fb[_0xc388('0x34')]);_0x8307a5[_0xc388('0x37')]=_[_0xc388('0x38')](_0x1070fb[_0xc388('0x32')],qs[_0xc388('0x39')](_0x5bce0d[_0xc388('0x34')]['fields']));_0x8307a5['attributes']=_0x8307a5[_0xc388('0x37')][_0xc388('0x71')]?_0x8307a5[_0xc388('0x37')]:_0x1070fb['model'];_0x8307a5[_0xc388('0x3c')]=qs[_0xc388('0x72')](_0x5bce0d[_0xc388('0x34')][_0xc388('0x72')]);_0x8307a5['where']=qs['filters'](_[_0xc388('0x73')](_0x5bce0d[_0xc388('0x34')],_0x1070fb['filters']));if(_0x5bce0d[_0xc388('0x34')][_0xc388('0x3d')]){_0x8307a5[_0xc388('0x3e')]=_[_0xc388('0x3f')](_0x8307a5[_0xc388('0x3e')],{'$or':_[_0xc388('0x33')](_0x8307a5[_0xc388('0x37')],function(_0x5923ba){var _0x2765cb={};_0x2765cb[_0x5923ba]={'$like':'%'+_0x5bce0d[_0xc388('0x34')][_0xc388('0x3d')]+'%'};return _0x2765cb;})});}_0x8307a5=_[_0xc388('0x3f')]({},_0x8307a5,_0x5bce0d[_0xc388('0x40')]);return _0x346537[_0xc388('0x96')](_0x8307a5);}})[_0xc388('0x2b')](function(_0x22990a){if(_0x22990a){_0x35512b=_0x22990a[_0xc388('0x71')];if(!_0x5bce0d[_0xc388('0x34')][_0xc388('0x3a')](_0xc388('0x3b'))){_0x8307a5[_0xc388('0x24')]=qs[_0xc388('0x24')](_0x5bce0d[_0xc388('0x34')]['limit']);_0x8307a5[_0xc388('0x26')]=qs[_0xc388('0x26')](_0x5bce0d[_0xc388('0x34')][_0xc388('0x26')]);}return _0x346537['getAgents'](_0x8307a5);}})[_0xc388('0x2b')](function(_0x306f52){if(_0x306f52){return _0x306f52?{'count':_0x35512b,'rows':_0x306f52}:null;}})[_0xc388('0x2b')](respondWithResult(_0x4a624a,null))['catch'](handleError(_0x4a624a,null));}; \ No newline at end of file +var _0x6267=['voicePause','all','removeAgents','Openchannel','Whatsapp','Queue:remove','getAgents','hasOwnProperty','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','stack','name','send','index','map','Team','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','type','VIRTUAL','filter','options','then','rows','catch','params','rawAttributes','includeAll','include','merge','get','role','user','Teams','UserProfileSection','find','autoAssociation','UserProfileResource','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','VoiceQueueId','UserVoiceQueue','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','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','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','channel','Unknown\x20channel','toLowerCase','capitalize','Queues','addQueues','ValidationError','add','ids','removeQueues','findOne','remove','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','through','penalty','QueueId','TeamVoiceQueue','User','Queue','findOrCreate','emit','Queue:save','findAll','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s'];(function(_0x1cc009,_0x5fdc4d){var _0x5dd236=function(_0x4e5563){while(--_0x4e5563){_0x1cc009['push'](_0x1cc009['shift']());}};_0x5dd236(++_0x5fdc4d);}(_0x6267,0xa3));var _0x7626=function(_0x43d2db,_0x5cc3f6){_0x43d2db=_0x43d2db-0x0;var _0x151e07=_0x6267[_0x43d2db];return _0x151e07;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7626('0x0'));var jsonpatch=require(_0x7626('0x1'));var rp=require(_0x7626('0x2'));var moment=require(_0x7626('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7626('0x4'));var path=require(_0x7626('0x5'));var sox=require(_0x7626('0x6'));var csv=require(_0x7626('0x7'));var ejs=require(_0x7626('0x8'));var fs=require('fs');var fs_extra=require(_0x7626('0x9'));var _=require(_0x7626('0xa'));var squel=require(_0x7626('0xb'));var crypto=require(_0x7626('0xc'));var jsforce=require(_0x7626('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7626('0x7'));var querystring=require('querystring');var Papa=require(_0x7626('0xe'));var Redis=require(_0x7626('0xf'));var authService=require(_0x7626('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7626('0x11'));var hardwareService=require(_0x7626('0x12'));var logger=require(_0x7626('0x13'))(_0x7626('0x14'));var utils=require(_0x7626('0x15'));var config=require(_0x7626('0x16'));var licenseUtil=require(_0x7626('0x17'));var db=require(_0x7626('0x18'))['db'];config[_0x7626('0x19')]=_[_0x7626('0x1a')](config[_0x7626('0x19')],{'host':_0x7626('0x1b'),'port':0x18eb});var socket=require(_0x7626('0x1c'))(new Redis(config['redis']));require('./team.socket')[_0x7626('0x1d')](socket);function respondWithStatusCode(_0x673edf,_0x1569bf){_0x1569bf=_0x1569bf||0xcc;return function(_0x4ece13){if(_0x4ece13){return _0x673edf[_0x7626('0x1e')](_0x1569bf);}return _0x673edf[_0x7626('0x1f')](_0x1569bf)[_0x7626('0x20')]();};}function respondWithResult(_0x102d14,_0x5af88e){_0x5af88e=_0x5af88e||0xc8;return function(_0x1a3b95){if(_0x1a3b95){return _0x102d14['status'](_0x5af88e)[_0x7626('0x21')](_0x1a3b95);}};}function respondWithFilteredResult(_0x2d1535,_0x5a1380){return function(_0x52cadc){if(_0x52cadc){var _0x5fcf4a=typeof _0x5a1380[_0x7626('0x22')]===_0x7626('0x23')&&typeof _0x5a1380['limit']===_0x7626('0x23');var _0x5b5ded=_0x52cadc[_0x7626('0x24')];var _0x3ad0b2=_0x5fcf4a?0x0:_0x5a1380[_0x7626('0x22')];var _0x23a030=_0x5fcf4a?_0x52cadc['count']:_0x5a1380['offset']+_0x5a1380[_0x7626('0x25')];var _0x1f923d;if(_0x23a030>=_0x5b5ded){_0x23a030=_0x5b5ded;_0x1f923d=0xc8;}else{_0x1f923d=0xce;}_0x2d1535[_0x7626('0x1f')](_0x1f923d);return _0x2d1535['set'](_0x7626('0x26'),_0x3ad0b2+'-'+_0x23a030+'/'+_0x5b5ded)['json'](_0x52cadc);}return null;};}function patchUpdates(_0x212c2a){return function(_0x47660e){try{jsonpatch['apply'](_0x47660e,_0x212c2a,!![]);}catch(_0x1e389e){return BPromise[_0x7626('0x27')](_0x1e389e);}return _0x47660e[_0x7626('0x28')]();};}function saveUpdates(_0x515ea1,_0x2e04c7){return function(_0x5d6a35){if(_0x5d6a35){return _0x5d6a35['update'](_0x515ea1)['then'](function(_0x485f46){return _0x485f46;});}return null;};}function handleEntityNotFound(_0x227ac2,_0xa92e94){return function(_0xe8257b){if(!_0xe8257b){_0x227ac2['sendStatus'](0x194);}return _0xe8257b;};}function handleError(_0x4e3394,_0xdff12d){_0xdff12d=_0xdff12d||0x1f4;return function(_0x16e043){logger['error'](_0x16e043[_0x7626('0x29')]);if(_0x16e043['name']){delete _0x16e043[_0x7626('0x2a')];}_0x4e3394[_0x7626('0x1f')](_0xdff12d)[_0x7626('0x2b')](_0x16e043);};}exports[_0x7626('0x2c')]=function(_0x22f0e1,_0x515410){var _0x1a9db8={},_0x245e34={},_0x52238f={'count':0x0,'rows':[]};var _0x559958=_[_0x7626('0x2d')](db[_0x7626('0x2e')]['rawAttributes'],function(_0x89f314){return{'name':_0x89f314[_0x7626('0x2f')],'type':_0x89f314['type'][_0x7626('0x30')]};});_0x245e34[_0x7626('0x31')]=_[_0x7626('0x2d')](_0x559958,'name');_0x245e34[_0x7626('0x32')]=_[_0x7626('0x33')](_0x22f0e1[_0x7626('0x32')]);_0x245e34[_0x7626('0x34')]=_['intersection'](_0x245e34['model'],_0x245e34[_0x7626('0x32')]);_0x1a9db8[_0x7626('0x35')]=_[_0x7626('0x36')](_0x245e34[_0x7626('0x31')],qs['fields'](_0x22f0e1[_0x7626('0x32')][_0x7626('0x37')]));_0x1a9db8[_0x7626('0x35')]=_0x1a9db8[_0x7626('0x35')][_0x7626('0x38')]?_0x1a9db8[_0x7626('0x35')]:_0x245e34[_0x7626('0x31')];if(!_0x22f0e1[_0x7626('0x32')]['hasOwnProperty'](_0x7626('0x39'))){_0x1a9db8[_0x7626('0x25')]=qs[_0x7626('0x25')](_0x22f0e1['query'][_0x7626('0x25')]);_0x1a9db8[_0x7626('0x22')]=qs['offset'](_0x22f0e1[_0x7626('0x32')]['offset']);}_0x1a9db8[_0x7626('0x3a')]=qs[_0x7626('0x3b')](_0x22f0e1[_0x7626('0x32')][_0x7626('0x3b')]);_0x1a9db8[_0x7626('0x3c')]=qs[_0x7626('0x34')](_[_0x7626('0x3d')](_0x22f0e1[_0x7626('0x32')],_0x245e34[_0x7626('0x34')]),_0x559958);if(_0x22f0e1[_0x7626('0x32')]['filter']){_0x1a9db8[_0x7626('0x3c')]=_['merge'](_0x1a9db8['where'],{'$or':_[_0x7626('0x2d')](_0x559958,function(_0x294000){if(_0x294000[_0x7626('0x3e')]!==_0x7626('0x3f')){var _0x4dc2e8={};_0x4dc2e8[_0x294000[_0x7626('0x2a')]]={'$like':'%'+_0x22f0e1[_0x7626('0x32')][_0x7626('0x40')]+'%'};return _0x4dc2e8;}})});}_0x1a9db8=_['merge']({},_0x1a9db8,_0x22f0e1[_0x7626('0x41')]);var _0x591466={'where':_0x1a9db8['where']};return db['Team'][_0x7626('0x24')](_0x591466)[_0x7626('0x42')](function(_0x184cd3){_0x52238f[_0x7626('0x24')]=_0x184cd3;if(_0x22f0e1[_0x7626('0x32')]['includeAll']){_0x1a9db8['include']=[{'all':!![]}];}return db[_0x7626('0x2e')]['findAll'](_0x1a9db8);})['then'](function(_0x6e356f){_0x52238f[_0x7626('0x43')]=_0x6e356f;return _0x52238f;})[_0x7626('0x42')](respondWithFilteredResult(_0x515410,_0x1a9db8))[_0x7626('0x44')](handleError(_0x515410,null));};exports['show']=function(_0x5e1acd,_0x1179e2){var _0x17bf44={'raw':![],'where':{'id':_0x5e1acd[_0x7626('0x45')]['id']}},_0x59e725={};_0x59e725[_0x7626('0x31')]=_[_0x7626('0x33')](db['Team'][_0x7626('0x46')]);_0x59e725[_0x7626('0x32')]=_[_0x7626('0x33')](_0x5e1acd[_0x7626('0x32')]);_0x59e725['filters']=_[_0x7626('0x36')](_0x59e725[_0x7626('0x31')],_0x59e725[_0x7626('0x32')]);_0x17bf44['attributes']=_[_0x7626('0x36')](_0x59e725[_0x7626('0x31')],qs[_0x7626('0x37')](_0x5e1acd[_0x7626('0x32')]['fields']));_0x17bf44[_0x7626('0x35')]=_0x17bf44[_0x7626('0x35')][_0x7626('0x38')]?_0x17bf44['attributes']:_0x59e725[_0x7626('0x31')];if(_0x5e1acd[_0x7626('0x32')][_0x7626('0x47')]){_0x17bf44[_0x7626('0x48')]=[{'all':!![]}];}_0x17bf44=_[_0x7626('0x49')]({},_0x17bf44,_0x5e1acd[_0x7626('0x41')]);return db[_0x7626('0x2e')]['find'](_0x17bf44)[_0x7626('0x42')](handleEntityNotFound(_0x1179e2,null))[_0x7626('0x42')](respondWithResult(_0x1179e2,null))[_0x7626('0x44')](handleError(_0x1179e2,null));};exports['create']=function(_0x2e8929,_0x3137f4){return db[_0x7626('0x2e')]['create'](_0x2e8929['body'],{})[_0x7626('0x42')](function(_0x2ed480){var _0x46662b=_0x2e8929['user'][_0x7626('0x4a')]({'plain':!![]});if(!_0x46662b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x46662b[_0x7626('0x4b')]===_0x7626('0x4c')){var _0x150c86=_0x2ed480[_0x7626('0x4a')]({'plain':!![]});var _0x44b969=_0x7626('0x4d');return db[_0x7626('0x4e')][_0x7626('0x4f')]({'where':{'name':_0x44b969,'userProfileId':_0x46662b['userProfileId']},'raw':!![]})[_0x7626('0x42')](function(_0x493dc6){if(_0x493dc6&&_0x493dc6[_0x7626('0x50')]===0x0){return db[_0x7626('0x51')][_0x7626('0x52')]({'name':_0x150c86[_0x7626('0x2a')],'resourceId':_0x150c86['id'],'type':_0x493dc6[_0x7626('0x2a')],'sectionId':_0x493dc6['id']},{})[_0x7626('0x42')](function(){return _0x2ed480;});}else{return _0x2ed480;}})[_0x7626('0x44')](function(_0x3dddd3){logger[_0x7626('0x53')](_0x7626('0x54'),_0x3dddd3);throw _0x3dddd3;});}return _0x2ed480;})[_0x7626('0x42')](respondWithResult(_0x3137f4,0xc9))[_0x7626('0x44')](handleError(_0x3137f4,null));};exports['update']=function(_0x873336,_0xb4912f){if(_0x873336[_0x7626('0x55')]['id']){delete _0x873336[_0x7626('0x55')]['id'];}return db[_0x7626('0x2e')][_0x7626('0x4f')]({'where':{'id':_0x873336[_0x7626('0x45')]['id']}})[_0x7626('0x42')](handleEntityNotFound(_0xb4912f,null))['then'](saveUpdates(_0x873336['body'],null))[_0x7626('0x42')](respondWithResult(_0xb4912f,null))['catch'](handleError(_0xb4912f,null));};exports['destroy']=function(_0x331216,_0xf42161){var _0x512aa5=_0x331216[_0x7626('0x45')]['id'];var _0x1bef08=[];return db[_0x7626('0x56')][_0x7626('0x57')](function(_0x3ff084){var _0x4c0b8e=_0x7626('0x58')+_0x512aa5;return db[_0x7626('0x56')]['query'](_0x4c0b8e,{'type':db['Sequelize'][_0x7626('0x59')]['SELECT'],'raw':!![],'transaction':_0x3ff084})[_0x7626('0x42')](function(_0x59f51e){_0x1bef08=_[_0x7626('0x2d')](_0x59f51e,function(_0x36f515){return Number(_0x36f515['UserId']);});})[_0x7626('0x42')](function(){var _0x7e50ea=_0x7626('0x5a')+_0x512aa5;return db[_0x7626('0x56')][_0x7626('0x32')](_0x7e50ea,{'type':db[_0x7626('0x5b')][_0x7626('0x59')][_0x7626('0x5c')],'raw':!![],'transaction':_0x3ff084});})[_0x7626('0x42')](function(_0x6af2d){var _0x4b11c2=_[_0x7626('0x2d')](_0x6af2d,function(_0x3f691f){return Number(_0x3f691f[_0x7626('0x5d')]);});return db[_0x7626('0x5e')][_0x7626('0x5f')]({'where':{'UserId':{'$in':_0x1bef08},'VoiceQueueId':{'$in':_0x4b11c2}},'transaction':_0x3ff084});})[_0x7626('0x42')](function(){var _0xcd1c07=_0x7626('0x60')+_0x512aa5;return db['sequelize'][_0x7626('0x32')](_0xcd1c07,{'type':db['Sequelize'][_0x7626('0x59')][_0x7626('0x5c')],'raw':!![],'transaction':_0x3ff084});})[_0x7626('0x42')](function(_0x1ed280){var _0xb02a0=_[_0x7626('0x2d')](_0x1ed280,function(_0x5db92e){return Number(_0x5db92e[_0x7626('0x61')]);});return db[_0x7626('0x62')][_0x7626('0x5f')]({'where':{'UserId':{'$in':_0x1bef08},'MailQueueId':{'$in':_0xb02a0}},'transaction':_0x3ff084});})[_0x7626('0x42')](function(){var _0x41f45b=_0x7626('0x63')+_0x512aa5;return db['sequelize'][_0x7626('0x32')](_0x41f45b,{'type':db[_0x7626('0x5b')][_0x7626('0x59')]['SELECT'],'raw':!![],'transaction':_0x3ff084});})['then'](function(_0x28fa83){var _0x3c4317=_[_0x7626('0x2d')](_0x28fa83,function(_0x269dc1){return Number(_0x269dc1['SmsQueueId']);});return db['UserSmsQueue']['destroy']({'where':{'UserId':{'$in':_0x1bef08},'SmsQueueId':{'$in':_0x3c4317}},'transaction':_0x3ff084});})[_0x7626('0x42')](function(){var _0x2d6e91='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x512aa5;return db['sequelize']['query'](_0x2d6e91,{'type':db[_0x7626('0x5b')][_0x7626('0x59')][_0x7626('0x5c')],'raw':!![],'transaction':_0x3ff084});})[_0x7626('0x42')](function(_0x271460){var _0x400f3a=_[_0x7626('0x2d')](_0x271460,function(_0x49d9cb){return Number(_0x49d9cb['ChatQueueId']);});return db['UserChatQueue'][_0x7626('0x5f')]({'where':{'UserId':{'$in':_0x1bef08},'ChatQueueId':{'$in':_0x400f3a}},'transaction':_0x3ff084});})[_0x7626('0x42')](function(){var _0x4f073e=_0x7626('0x64')+_0x512aa5;return db['sequelize'][_0x7626('0x32')](_0x4f073e,{'type':db[_0x7626('0x5b')][_0x7626('0x59')]['SELECT'],'raw':!![],'transaction':_0x3ff084});})[_0x7626('0x42')](function(_0x7925c5){var _0x43ec2b=_[_0x7626('0x2d')](_0x7925c5,function(_0x391553){return Number(_0x391553[_0x7626('0x65')]);});return db[_0x7626('0x66')][_0x7626('0x5f')]({'where':{'UserId':{'$in':_0x1bef08},'FaxQueueId':{'$in':_0x43ec2b}},'transaction':_0x3ff084});})[_0x7626('0x42')](function(){var _0x84b768=_0x7626('0x67')+_0x512aa5;return db[_0x7626('0x56')]['query'](_0x84b768,{'type':db['Sequelize'][_0x7626('0x59')][_0x7626('0x5c')],'raw':!![],'transaction':_0x3ff084});})[_0x7626('0x42')](function(_0x4de12b){var _0x20199a=_[_0x7626('0x2d')](_0x4de12b,function(_0x1dd35a){return Number(_0x1dd35a[_0x7626('0x68')]);});return db[_0x7626('0x69')][_0x7626('0x5f')]({'where':{'UserId':{'$in':_0x1bef08},'OpenchannelQueueId':{'$in':_0x20199a}},'transaction':_0x3ff084});})[_0x7626('0x42')](function(){var _0xdfbbd0='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x512aa5;return db[_0x7626('0x56')][_0x7626('0x32')](_0xdfbbd0,{'type':db['Sequelize'][_0x7626('0x59')]['SELECT'],'raw':!![],'transaction':_0x3ff084});})[_0x7626('0x42')](function(_0x49f748){var _0x2caf3d=_['map'](_0x49f748,function(_0x183674){return Number(_0x183674[_0x7626('0x6a')]);});return db[_0x7626('0x6b')]['destroy']({'where':{'UserId':{'$in':_0x1bef08},'WhatsappQueueId':{'$in':_0x2caf3d}},'transaction':_0x3ff084});})['then'](function(){return db[_0x7626('0x6c')][_0x7626('0x4f')]({'where':{'TeamId':_0x512aa5}});})[_0x7626('0x42')](function(_0x13ef9f){if(_0x13ef9f===null){return;}return db[_0x7626('0x6d')][_0x7626('0x5f')]({'where':{'UserId':{'$in':_0x1bef08},'VoicePrefixId':_0x13ef9f[_0x7626('0x6e')]},'transaction':_0x3ff084});})[_0x7626('0x42')](function(){return db['Team'][_0x7626('0x5f')]({'where':{'id':_0x512aa5},'cascade':!![],'transaction':_0x3ff084});})[_0x7626('0x42')](function(_0x3aeb97){if(_0x3aeb97===0x0){_0xf42161[_0x7626('0x1e')](0x194);}else{return db[_0x7626('0x51')]['destroy']({'where':{'type':_0x7626('0x4d'),'resourceId':_0x512aa5},'cascade':!![],'transaction':_0x3ff084})[_0x7626('0x42')](function(){_0xf42161['status'](0xcc)[_0x7626('0x20')]();});}})[_0x7626('0x44')](function(_0x17cd47){_0xf42161['status'](0x1f4)[_0x7626('0x2b')](_0x17cd47);});});};exports[_0x7626('0x6f')]=function(_0x2dd97f,_0x557fac,_0x3e7b4b){return db[_0x7626('0x2e')]['findOne']({'where':{'id':_0x2dd97f[_0x7626('0x45')]['id']}})[_0x7626('0x42')](handleEntityNotFound(_0x557fac,null))[_0x7626('0x42')](function(_0x4d2ef4){if(!_0x2dd97f[_0x7626('0x32')]['channel']||!utils['isValidChannel'](_0x2dd97f[_0x7626('0x32')][_0x7626('0x70')])){throw new db['Sequelize']['ValidationError'](_0x7626('0x71'));}var _0x1dd19f={};var _0x57aada={};_0x57aada[_0x7626('0x31')]=_[_0x7626('0x33')](db[_['capitalize'](_0x2dd97f['query'][_0x7626('0x70')][_0x7626('0x72')]())+'Queue'][_0x7626('0x46')]);_0x57aada[_0x7626('0x32')]=_[_0x7626('0x33')](_0x2dd97f[_0x7626('0x32')]);_0x57aada[_0x7626('0x34')]=_[_0x7626('0x36')](_0x57aada[_0x7626('0x31')],_0x57aada[_0x7626('0x32')]);_0x1dd19f['attributes']=_[_0x7626('0x36')](_0x57aada['model'],qs['fields'](_0x2dd97f[_0x7626('0x32')][_0x7626('0x37')]));_0x1dd19f[_0x7626('0x35')]=_0x1dd19f['attributes']['length']?_0x1dd19f[_0x7626('0x35')]:_0x57aada[_0x7626('0x31')];_0x1dd19f[_0x7626('0x25')]=qs[_0x7626('0x25')](_0x2dd97f[_0x7626('0x32')]['limit']);_0x1dd19f[_0x7626('0x22')]=qs[_0x7626('0x22')](_0x2dd97f['query'][_0x7626('0x22')]);_0x1dd19f[_0x7626('0x3a')]=qs[_0x7626('0x3b')](_0x2dd97f[_0x7626('0x32')]['sort']);_0x1dd19f['where']=qs[_0x7626('0x34')](_['pick'](_0x2dd97f[_0x7626('0x32')],_0x57aada[_0x7626('0x34')]));_0x1dd19f=_[_0x7626('0x49')]({},_0x1dd19f,_0x2dd97f[_0x7626('0x41')]);return _0x4d2ef4[_0x7626('0x4a')+_[_0x7626('0x73')](_0x2dd97f['query'][_0x7626('0x70')]['toLowerCase']())+_0x7626('0x74')](_0x1dd19f);})[_0x7626('0x42')](respondWithResult(_0x557fac,null))[_0x7626('0x44')](handleError(_0x557fac,null));};exports[_0x7626('0x75')]=function(_0x414d99,_0x598b44,_0x51e94e){return db['Team']['findOne']({'where':{'id':_0x414d99[_0x7626('0x45')]['id']}})['then'](function(_0x370c1e){if(_0x370c1e){if(!_0x414d99[_0x7626('0x55')][_0x7626('0x70')]||!utils['isValidChannel'](_0x414d99[_0x7626('0x55')]['channel'])){throw new db['Sequelize'][(_0x7626('0x76'))](_0x7626('0x71'));}return _0x370c1e[_0x7626('0x77')+_[_0x7626('0x73')](_0x414d99[_0x7626('0x55')][_0x7626('0x70')][_0x7626('0x72')]())+_0x7626('0x74')](_0x414d99[_0x7626('0x55')][_0x7626('0x78')]);}return null;})[_0x7626('0x42')](handleEntityNotFound(_0x598b44,null))['then'](respondWithStatusCode(_0x598b44,null))[_0x7626('0x44')](handleError(_0x598b44,null));};exports[_0x7626('0x79')]=function(_0x27031f,_0x20d587,_0x192c86){return db[_0x7626('0x2e')][_0x7626('0x7a')]({'where':{'id':_0x27031f[_0x7626('0x45')]['id']}})[_0x7626('0x42')](function(_0x4ef8f0){if(_0x4ef8f0){if(!_0x27031f[_0x7626('0x32')]['channel']||!utils['isValidChannel'](_0x27031f[_0x7626('0x32')][_0x7626('0x70')])){throw new db[(_0x7626('0x5b'))]['ValidationError'](_0x7626('0x71'));}return _0x4ef8f0[_0x7626('0x7b')+_[_0x7626('0x73')](_0x27031f[_0x7626('0x32')][_0x7626('0x70')][_0x7626('0x72')]())+_0x7626('0x74')](_0x27031f[_0x7626('0x32')]['ids']);}return null;})[_0x7626('0x42')](handleEntityNotFound(_0x20d587,null))[_0x7626('0x42')](respondWithStatusCode(_0x20d587,null))['catch'](handleError(_0x20d587,null));};exports[_0x7626('0x7c')]=function(_0x398924,_0x4c4b1a){var _0x17590b=_[_0x7626('0x7d')](_0x398924['body'][_0x7626('0x78')])?_0x398924[_0x7626('0x55')]['ids']:[_0x398924[_0x7626('0x55')][_0x7626('0x78')]];var _0x124d7b=_0x398924[_0x7626('0x45')]['id'];return db[_0x7626('0x2e')]['find']({'where':{'id':_0x124d7b}})[_0x7626('0x42')](handleEntityNotFound(_0x4c4b1a,null))[_0x7626('0x42')](function(_0x4fb6ca){if(_0x4fb6ca){var _0x3c1981=[_0x7626('0x7e'),_0x7626('0x7f'),_0x7626('0x80'),_0x7626('0x81'),_0x7626('0x82'),'Openchannel','Whatsapp'];return db[_0x7626('0x56')][_0x7626('0x57')](function(_0x2c22ec){var _0x3d11c3=_[_0x7626('0x2d')](_0x3c1981,function(_0xdb1d3a){var _0x365a96={'attributes':['id',_0x7626('0x2a')]};if(_0xdb1d3a===_0x7626('0x7e')){_0x365a96[_0x7626('0x83')]={'attributes':[_0x7626('0x84')]};}return _0x4fb6ca[_0x7626('0x4a')+_0xdb1d3a+_0x7626('0x74')](_0x365a96)[_0x7626('0x42')](function(_0x58ad93){var _0x2af66d=_[_0x7626('0x2d')](_0x58ad93,function(_0x5f3fe9){var _0x411d90=_[_0x7626('0x2d')](_0x17590b,function(_0x5ba5f4){var _0x177a28={'where':{'UserId':_0x5ba5f4,[_0xdb1d3a+_0x7626('0x85')]:_0x5f3fe9['id']},'transaction':_0x2c22ec};if(_0xdb1d3a==='Voice'){_0x177a28[_0x7626('0x1a')]={'penalty':_0x5f3fe9[_0x7626('0x86')][_0x7626('0x84')]};}return db[_0x7626('0x87')+_0xdb1d3a+_0x7626('0x88')][_0x7626('0x89')](_0x177a28)[_0x7626('0x42')](function(){socket[_0x7626('0x8a')](_0x7626('0x4c')+_0xdb1d3a+_0x7626('0x8b'),{'UserId':_0x5ba5f4,[_0xdb1d3a+_0x7626('0x85')]:_0x5f3fe9['id']});if(_0xdb1d3a!==_0x7626('0x7e')){return;}return db[_0x7626('0x87')][_0x7626('0x8c')]({'where':{'id':_0x17590b,'online':0x1},'attributes':['id',_0x7626('0x2a'),'online','voicePause',_0x7626('0x8d')],'raw':!![]})[_0x7626('0x42')](function(_0x160827){var _0x10211d=_['map'](_0x160827,function(_0x505375){return db[_0x7626('0x8e')][_0x7626('0x8f')]({'membername':_0x505375[_0x7626('0x2a')],'UserId':_0x505375['id'],'queue_name':_0x5f3fe9[_0x7626('0x2a')],'VoiceQueueId':_0x5f3fe9['id'],'interface':_[_0x7626('0x90')](_0x505375[_0x7626('0x8d')])?util[_0x7626('0x91')](_0x7626('0x92'),_0x505375[_0x7626('0x2a')]):_0x505375[_0x7626('0x8d')],'paused':_0x505375[_0x7626('0x93')]||![],'penalty':_0x5f3fe9[_0x7626('0x86')][_0x7626('0x84')]},{'transaction':_0x2c22ec});});return Promise[_0x7626('0x94')](_0x10211d);});});});return Promise[_0x7626('0x94')](_0x411d90);});return Promise[_0x7626('0x94')](_0x2af66d);})[_0x7626('0x42')](function(){return db[_0x7626('0x6c')]['findOne']({'where':{'teamId':_0x124d7b}})[_0x7626('0x42')](function(_0x1a17d4){if(_0x1a17d4){var _0x9afe2c=_[_0x7626('0x2d')](_0x17590b,function(_0x5a1841){db['UserVoicePrefix'][_0x7626('0x8f')]({'UserId':_0x5a1841,'VoicePrefixId':_0x1a17d4[_0x7626('0x6e')]});});return Promise[_0x7626('0x94')](_0x9afe2c);}});});});return Promise[_0x7626('0x94')](_0x3d11c3)[_0x7626('0x42')](function(){return _0x4fb6ca[_0x7626('0x7c')](_0x17590b,{'transaction':_0x2c22ec})['spread'](function(_0x455246){return _0x455246;});});});}})[_0x7626('0x42')](respondWithResult(_0x4c4b1a,null))[_0x7626('0x44')](handleError(_0x4c4b1a,null));};exports[_0x7626('0x95')]=function(_0x2d7aeb,_0x5df801){var _0x44f8d1=_[_0x7626('0x7d')](_0x2d7aeb[_0x7626('0x32')][_0x7626('0x78')])?_0x2d7aeb[_0x7626('0x32')][_0x7626('0x78')]:[_0x2d7aeb[_0x7626('0x32')][_0x7626('0x78')]];var _0x19d36e=_0x2d7aeb[_0x7626('0x45')]['id'];return db[_0x7626('0x2e')]['find']({'where':{'id':_0x19d36e}})[_0x7626('0x42')](handleEntityNotFound(_0x5df801,null))[_0x7626('0x42')](function(_0x10ecf2){if(_0x10ecf2){var _0x20d574=[_0x7626('0x7e'),_0x7626('0x7f'),_0x7626('0x80'),_0x7626('0x81'),'Fax',_0x7626('0x96'),_0x7626('0x97')];return db[_0x7626('0x56')][_0x7626('0x57')](function(_0x45f36a){var _0x95794e=_[_0x7626('0x2d')](_0x20d574,function(_0x498a13){var _0x5db6c5={'attributes':['id',_0x7626('0x2a')]};return _0x10ecf2['get'+_0x498a13+_0x7626('0x74')](_0x5db6c5)[_0x7626('0x42')](function(_0x37acbc){var _0x1dfdaf=_[_0x7626('0x2d')](_0x37acbc,function(_0x154231){return _0x154231[_0x7626('0x95')](_0x44f8d1,{'transaction':_0x45f36a})['then'](function(){var _0xb2b60f=_[_0x7626('0x2d')](_0x44f8d1,function(_0x4539ee){socket[_0x7626('0x8a')](_0x7626('0x4c')+_0x498a13+_0x7626('0x98'),{'UserId':Number(_0x4539ee),[_0x498a13+_0x7626('0x85')]:_0x154231['id']});if(_0x498a13!==_0x7626('0x7e')){return;}return db[_0x7626('0x8e')][_0x7626('0x5f')]({'where':{'VoiceQueueId':_0x154231['id'],'UserId':_0x4539ee},'transaction':_0x45f36a});});return Promise[_0x7626('0x94')](_0xb2b60f);});});return Promise[_0x7626('0x94')](_0x1dfdaf);});});return Promise[_0x7626('0x94')](_0x95794e)[_0x7626('0x42')](function(){return _0x10ecf2['removeAgents'](_0x44f8d1,{'transaction':_0x45f36a});})[_0x7626('0x42')](function(){return db[_0x7626('0x6c')]['findOne']({'where':{'teamId':_0x19d36e}})[_0x7626('0x42')](function(_0x44379e){if(_0x44379e){var _0xd2a22c=_[_0x7626('0x2d')](_0x44f8d1,function(_0xc36b16){db[_0x7626('0x6d')]['destroy']({'where':{'UserId':_0xc36b16,'VoicePrefixId':_0x44379e['VoicePrefixId']}});});return Promise[_0x7626('0x94')](_0xd2a22c);}});});});}})[_0x7626('0x42')](respondWithStatusCode(_0x5df801,null))[_0x7626('0x44')](handleError(_0x5df801,null));};exports[_0x7626('0x99')]=function(_0x43f218,_0x543557,_0x2758cf){var _0x58a1d7={};var _0x440490={};var _0x82d64;var _0xd2f2f5;return db[_0x7626('0x2e')][_0x7626('0x7a')]({'where':{'id':_0x43f218[_0x7626('0x45')]['id']}})['then'](handleEntityNotFound(_0x543557,null))['then'](function(_0x2d955f){if(_0x2d955f){_0x82d64=_0x2d955f;_0x440490['model']=_[_0x7626('0x33')](db[_0x7626('0x87')][_0x7626('0x46')]);_0x440490[_0x7626('0x32')]=_[_0x7626('0x33')](_0x43f218[_0x7626('0x32')]);_0x440490[_0x7626('0x34')]=_['intersection'](_0x440490['model'],_0x440490[_0x7626('0x32')]);_0x58a1d7[_0x7626('0x35')]=_[_0x7626('0x36')](_0x440490[_0x7626('0x31')],qs[_0x7626('0x37')](_0x43f218[_0x7626('0x32')][_0x7626('0x37')]));_0x58a1d7['attributes']=_0x58a1d7['attributes'][_0x7626('0x38')]?_0x58a1d7[_0x7626('0x35')]:_0x440490[_0x7626('0x31')];_0x58a1d7[_0x7626('0x3a')]=qs[_0x7626('0x3b')](_0x43f218[_0x7626('0x32')][_0x7626('0x3b')]);_0x58a1d7[_0x7626('0x3c')]=qs[_0x7626('0x34')](_['pick'](_0x43f218['query'],_0x440490[_0x7626('0x34')]));if(_0x43f218['query'][_0x7626('0x40')]){_0x58a1d7[_0x7626('0x3c')]=_[_0x7626('0x49')](_0x58a1d7[_0x7626('0x3c')],{'$or':_[_0x7626('0x2d')](_0x58a1d7['attributes'],function(_0x34bdef){var _0x5c32a7={};_0x5c32a7[_0x34bdef]={'$like':'%'+_0x43f218['query'][_0x7626('0x40')]+'%'};return _0x5c32a7;})});}_0x58a1d7=_[_0x7626('0x49')]({},_0x58a1d7,_0x43f218[_0x7626('0x41')]);return _0x82d64[_0x7626('0x99')](_0x58a1d7);}})['then'](function(_0x554b87){if(_0x554b87){_0xd2f2f5=_0x554b87[_0x7626('0x38')];if(!_0x43f218[_0x7626('0x32')][_0x7626('0x9a')](_0x7626('0x39'))){_0x58a1d7[_0x7626('0x25')]=qs['limit'](_0x43f218['query'][_0x7626('0x25')]);_0x58a1d7[_0x7626('0x22')]=qs[_0x7626('0x22')](_0x43f218['query'][_0x7626('0x22')]);}return _0x82d64['getAgents'](_0x58a1d7);}})[_0x7626('0x42')](function(_0x493287){if(_0x493287){return _0x493287?{'count':_0xd2f2f5,'rows':_0x493287}:null;}})['then'](respondWithResult(_0x543557,null))[_0x7626('0x44')](handleError(_0x543557,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index cf3eba7..77e4b24 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 _0xe9ba=['hasOwnProperty','hook','events','Team','setMaxListeners','update','remove','emit'];(function(_0x53abe5,_0x33a9e5){var _0xc1c37e=function(_0xd53c6e){while(--_0xd53c6e){_0x53abe5['push'](_0x53abe5['shift']());}};_0xc1c37e(++_0x33a9e5);}(_0xe9ba,0x1da));var _0xae9b=function(_0x34ad09,_0xba8f16){_0x34ad09=_0x34ad09-0x0;var _0x4c8431=_0xe9ba[_0x34ad09];return _0x4c8431;};'use strict';var EventEmitter=require(_0xae9b('0x0'));var Team=require('../../mysqldb')['db'][_0xae9b('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xae9b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xae9b('0x3'),'afterDestroy':_0xae9b('0x4')};function emitEvent(_0x34d3f9){return function(_0x4fb75c,_0x240956,_0x2080de){TeamEvents[_0xae9b('0x5')](_0x34d3f9+':'+_0x4fb75c['id'],_0x4fb75c);TeamEvents[_0xae9b('0x5')](_0x34d3f9,_0x4fb75c);_0x2080de(null);};}for(var e in events){if(events[_0xae9b('0x6')](e)){var event=events[e];Team[_0xae9b('0x7')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x02fb=['Team','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x1afa5a,_0x28194f){var _0x86f759=function(_0x4c3130){while(--_0x4c3130){_0x1afa5a['push'](_0x1afa5a['shift']());}};_0x86f759(++_0x28194f);}(_0x02fb,0x170));var _0xb02f=function(_0x55406c,_0x5b7022){_0x55406c=_0x55406c-0x0;var _0x2643ac=_0x02fb[_0x55406c];return _0x2643ac;};'use strict';var EventEmitter=require(_0xb02f('0x0'));var Team=require(_0xb02f('0x1'))['db'][_0xb02f('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xb02f('0x3')](0x0);var events={'afterCreate':_0xb02f('0x4'),'afterUpdate':_0xb02f('0x5'),'afterDestroy':_0xb02f('0x6')};function emitEvent(_0x3057d6){return function(_0x384650,_0x20b5f,_0x5205c8){TeamEvents[_0xb02f('0x7')](_0x3057d6+':'+_0x384650['id'],_0x384650);TeamEvents['emit'](_0x3057d6,_0x384650);_0x5205c8(null);};}for(var e in events){if(events[_0xb02f('0x8')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xb02f('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 5afcabe..f058b69 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 _0x3fa9=['../../config/environment','exports','Team','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x3fa9,0x17d));var _0x93fa=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x3fa9[_0x46aff0];return _0x9d78cf;};'use strict';var _=require('lodash');var util=require(_0x93fa('0x0'));var logger=require(_0x93fa('0x1'))('api');var moment=require('moment');var BPromise=require(_0x93fa('0x2'));var rp=require(_0x93fa('0x3'));var fs=require('fs');var path=require(_0x93fa('0x4'));var rimraf=require(_0x93fa('0x5'));var config=require(_0x93fa('0x6'));var attributes=require('./team.attributes');module[_0x93fa('0x7')]=function(_0x27f932,_0x176d66){return _0x27f932['define'](_0x93fa('0x8'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ba3=['teams','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./team.attributes','exports','define','Team'];(function(_0x1c8bd4,_0x43f28b){var _0x3ea6e2=function(_0x56f9df){while(--_0x56f9df){_0x1c8bd4['push'](_0x1c8bd4['shift']());}};_0x3ea6e2(++_0x43f28b);}(_0x0ba3,0x139));var _0x30ba=function(_0x44a64f,_0x38475c){_0x44a64f=_0x44a64f-0x0;var _0x52024b=_0x0ba3[_0x44a64f];return _0x52024b;};'use strict';var _=require(_0x30ba('0x0'));var util=require(_0x30ba('0x1'));var logger=require('../../config/logger')(_0x30ba('0x2'));var moment=require(_0x30ba('0x3'));var BPromise=require(_0x30ba('0x4'));var rp=require(_0x30ba('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x30ba('0x6'));var config=require(_0x30ba('0x7'));var attributes=require(_0x30ba('0x8'));module[_0x30ba('0x9')]=function(_0x375736,_0x3d3889){return _0x375736[_0x30ba('0xa')](_0x30ba('0xb'),attributes,{'tableName':_0x30ba('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 02ae7d3..c611434 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 _0x4ed6=['socket.io-emitter','./team.socket','request','then','request\x20sent','Team,\x20%s,\x20%s,\x20%s','error','code','Team,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults'];(function(_0x2c7ec0,_0x30fae7){var _0x4643b3=function(_0x215cf0){while(--_0x215cf0){_0x2c7ec0['push'](_0x2c7ec0['shift']());}};_0x4643b3(++_0x30fae7);}(_0x4ed6,0xa3));var _0x64ed=function(_0x304634,_0x404e77){_0x304634=_0x304634-0x0;var _0x5724cc=_0x4ed6[_0x304634];return _0x5724cc;};'use strict';var _=require(_0x64ed('0x0'));var util=require(_0x64ed('0x1'));var moment=require(_0x64ed('0x2'));var BPromise=require('bluebird');var rs=require(_0x64ed('0x3'));var fs=require('fs');var Redis=require(_0x64ed('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x64ed('0x5'));var logger=require(_0x64ed('0x6'))(_0x64ed('0x7'));var config=require('../../config/environment');var jayson=require(_0x64ed('0x8'));var client=jayson[_0x64ed('0x9')]['http']({'port':0x232a});config[_0x64ed('0xa')]=_[_0x64ed('0xb')](config[_0x64ed('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x64ed('0xc'))(new Redis(config[_0x64ed('0xa')]));require(_0x64ed('0xd'))['register'](socket);function respondWithRpcPromise(_0x4748c8,_0x127cac,_0x37e2d4){return new BPromise(function(_0x2728ff,_0x4e9ba9){return client[_0x64ed('0xe')](_0x4748c8,_0x37e2d4)[_0x64ed('0xf')](function(_0x189796){logger['info']('Team,\x20%s,\x20%s',_0x127cac,_0x64ed('0x10'));logger['debug'](_0x64ed('0x11'),_0x127cac,_0x64ed('0x10'),JSON['stringify'](_0x189796));if(_0x189796[_0x64ed('0x12')]){if(_0x189796['error'][_0x64ed('0x13')]===0x1f4){logger[_0x64ed('0x12')](_0x64ed('0x14'),_0x127cac,_0x189796[_0x64ed('0x12')][_0x64ed('0x15')]);return _0x4e9ba9(_0x189796[_0x64ed('0x12')][_0x64ed('0x15')]);}logger[_0x64ed('0x12')](_0x64ed('0x14'),_0x127cac,_0x189796[_0x64ed('0x12')][_0x64ed('0x15')]);return _0x2728ff(_0x189796[_0x64ed('0x12')][_0x64ed('0x15')]);}else{logger[_0x64ed('0x16')](_0x64ed('0x14'),_0x127cac,'request\x20sent');_0x2728ff(_0x189796[_0x64ed('0x17')][_0x64ed('0x15')]);}})[_0x64ed('0x18')](function(_0x307d34){logger['error'](_0x64ed('0x14'),_0x127cac,_0x307d34);_0x4e9ba9(_0x307d34);});});} \ No newline at end of file +var _0x20c4=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./team.socket','request','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x2afbdf,_0x302edd){var _0x504eed=function(_0x42e61c){while(--_0x42e61c){_0x2afbdf['push'](_0x2afbdf['shift']());}};_0x504eed(++_0x302edd);}(_0x20c4,0xb5));var _0x420c=function(_0x21b3f6,_0x5b8736){_0x21b3f6=_0x21b3f6-0x0;var _0x401d4c=_0x20c4[_0x21b3f6];return _0x401d4c;};'use strict';var _=require(_0x420c('0x0'));var util=require('util');var moment=require(_0x420c('0x1'));var BPromise=require(_0x420c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x420c('0x3'));var db=require(_0x420c('0x4'))['db'];var utils=require(_0x420c('0x5'));var logger=require(_0x420c('0x6'))(_0x420c('0x7'));var config=require(_0x420c('0x8'));var jayson=require(_0x420c('0x9'));var client=jayson[_0x420c('0xa')][_0x420c('0xb')]({'port':0x232a});config[_0x420c('0xc')]=_['defaults'](config[_0x420c('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x420c('0xd'))(new Redis(config['redis']));require(_0x420c('0xe'))['register'](socket);function respondWithRpcPromise(_0x220288,_0xb30d80,_0x3c2bcd){return new BPromise(function(_0x1bc96d,_0xf5ec71){return client[_0x420c('0xf')](_0x220288,_0x3c2bcd)['then'](function(_0x2b9c1d){logger[_0x420c('0x10')](_0x420c('0x11'),_0xb30d80,_0x420c('0x12'));logger[_0x420c('0x13')](_0x420c('0x14'),_0xb30d80,'request\x20sent',JSON[_0x420c('0x15')](_0x2b9c1d));if(_0x2b9c1d[_0x420c('0x16')]){if(_0x2b9c1d[_0x420c('0x16')][_0x420c('0x17')]===0x1f4){logger[_0x420c('0x16')](_0x420c('0x11'),_0xb30d80,_0x2b9c1d[_0x420c('0x16')][_0x420c('0x18')]);return _0xf5ec71(_0x2b9c1d[_0x420c('0x16')]['message']);}logger[_0x420c('0x16')](_0x420c('0x11'),_0xb30d80,_0x2b9c1d['error'][_0x420c('0x18')]);return _0x1bc96d(_0x2b9c1d[_0x420c('0x16')][_0x420c('0x18')]);}else{logger[_0x420c('0x10')](_0x420c('0x11'),_0xb30d80,_0x420c('0x12'));_0x1bc96d(_0x2b9c1d[_0x420c('0x19')][_0x420c('0x18')]);}})['catch'](function(_0x396dd7){logger[_0x420c('0x16')](_0x420c('0x11'),_0xb30d80,_0x396dd7);_0xf5ec71(_0x396dd7);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index b7fb4d3..9ae527f 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 _0xb886=['update','emit','removeListener','register','length','./team.events','save','remove'];(function(_0x22e33f,_0x1620f6){var _0x20c9c=function(_0x4cbd90){while(--_0x4cbd90){_0x22e33f['push'](_0x22e33f['shift']());}};_0x20c9c(++_0x1620f6);}(_0xb886,0xf5));var _0x6b88=function(_0x524127,_0x161261){_0x524127=_0x524127-0x0;var _0x4f643e=_0xb886[_0x524127];return _0x4f643e;};'use strict';var TeamEvents=require(_0x6b88('0x0'));var events=[_0x6b88('0x1'),_0x6b88('0x2'),_0x6b88('0x3')];function createListener(_0x1227da,_0x24f91b){return function(_0x15bf58){_0x24f91b[_0x6b88('0x4')](_0x1227da,_0x15bf58);};}function removeListener(_0x5dc17b,_0x5007af){return function(){TeamEvents[_0x6b88('0x5')](_0x5dc17b,_0x5007af);};}exports[_0x6b88('0x6')]=function(_0x14acc6){for(var _0x23b99e=0x0,_0x2e0afb=events[_0x6b88('0x7')];_0x23b99e<_0x2e0afb;_0x23b99e++){var _0x4e15f1=events[_0x23b99e];var _0x154466=createListener('team:'+_0x4e15f1,_0x14acc6);TeamEvents['on'](_0x4e15f1,_0x154466);}}; \ No newline at end of file +var _0xa0df=['update','emit','removeListener','register','team:','./team.events','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa0df,0x11d));var _0xfa0d=function(_0xde5ac4,_0x3725c3){_0xde5ac4=_0xde5ac4-0x0;var _0x2a3b5a=_0xa0df[_0xde5ac4];return _0x2a3b5a;};'use strict';var TeamEvents=require(_0xfa0d('0x0'));var events=[_0xfa0d('0x1'),'remove',_0xfa0d('0x2')];function createListener(_0x361bab,_0x4df8e9){return function(_0x103b17){_0x4df8e9[_0xfa0d('0x3')](_0x361bab,_0x103b17);};}function removeListener(_0x1f6dd0,_0x370e41){return function(){TeamEvents[_0xfa0d('0x4')](_0x1f6dd0,_0x370e41);};}exports[_0xfa0d('0x5')]=function(_0x4f7fb2){for(var _0x408a87=0x0,_0x16e980=events['length'];_0x408a87<_0x16e980;_0x408a87++){var _0xf228f9=events[_0x408a87];var _0x2ed12c=createListener(_0xfa0d('0x6')+_0xf228f9,_0x4f7fb2);TeamEvents['on'](_0xf228f9,_0x2ed12c);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index c0fb875..c60213d 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 _0xf403=['INTEGER','sequelize'];(function(_0x454165,_0x1f3e74){var _0x56db53=function(_0x23388c){while(--_0x23388c){_0x454165['push'](_0x454165['shift']());}};_0x56db53(++_0x1f3e74);}(_0xf403,0x1d3));var _0x3f40=function(_0x5b3682,_0x4786bf){_0x5b3682=_0x5b3682-0x0;var _0x23ae75=_0xf403[_0x5b3682];return _0x23ae75;};'use strict';var Sequelize=require(_0x3f40('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x3f40('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x3f40('0x1')]}}; \ No newline at end of file +var _0x0e35=['exports','INTEGER','sequelize'];(function(_0x53e8b0,_0x5d538a){var _0x301edd=function(_0x2b1e88){while(--_0x2b1e88){_0x53e8b0['push'](_0x53e8b0['shift']());}};_0x301edd(++_0x5d538a);}(_0x0e35,0xc2));var _0x50e3=function(_0x39f3b1,_0x57dd31){_0x39f3b1=_0x39f3b1-0x0;var _0x33514c=_0x0e35[_0x39f3b1];return _0x33514c;};'use strict';var Sequelize=require(_0x50e3('0x0'));module[_0x50e3('0x1')]={'TeamId':{'type':Sequelize[_0x50e3('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x50e3('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 8ee4a99..84d251f 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 _0x3c32=['./teamVoicePrefix.attributes','exports','define','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x3c32,0x161));var _0x23c3=function(_0x119bb9,_0x1bbcb7){_0x119bb9=_0x119bb9-0x0;var _0x391b91=_0x3c32[_0x119bb9];return _0x391b91;};'use strict';var _=require(_0x23c3('0x0'));var util=require(_0x23c3('0x1'));var logger=require(_0x23c3('0x2'))('api');var moment=require(_0x23c3('0x3'));var BPromise=require(_0x23c3('0x4'));var rp=require(_0x23c3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x23c3('0x6'));var config=require('../../config/environment');var attributes=require(_0x23c3('0x7'));module[_0x23c3('0x8')]=function(_0x1ec17b,_0x190132){return _0x1ec17b[_0x23c3('0x9')]('TeamVoicePrefix',attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9e7=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','TeamVoicePrefix','team_has_voice_prefixes','util'];(function(_0x2eb15c,_0x21c769){var _0x523ed4=function(_0x1e816b){while(--_0x1e816b){_0x2eb15c['push'](_0x2eb15c['shift']());}};_0x523ed4(++_0x21c769);}(_0xb9e7,0x1df));var _0x7b9e=function(_0x3a4318,_0x13c6eb){_0x3a4318=_0x3a4318-0x0;var _0x36d746=_0xb9e7[_0x3a4318];return _0x36d746;};'use strict';var _=require('lodash');var util=require(_0x7b9e('0x0'));var logger=require(_0x7b9e('0x1'))(_0x7b9e('0x2'));var moment=require(_0x7b9e('0x3'));var BPromise=require(_0x7b9e('0x4'));var rp=require(_0x7b9e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b9e('0x6'));var config=require(_0x7b9e('0x7'));var attributes=require('./teamVoicePrefix.attributes');module[_0x7b9e('0x8')]=function(_0x51a0ca,_0x3a9c5e){return _0x51a0ca[_0x7b9e('0x9')](_0x7b9e('0xa'),attributes,{'tableName':_0x7b9e('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 632dadb..40663a4 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x492857,_0xad43c7){var _0x443046=function(_0x3a82ad){while(--_0x3a82ad){_0x492857['push'](_0x492857['shift']());}};_0x443046(++_0xad43c7);}(_0xe706,0xa3));var _0x6e70=function(_0x17b1c0,_0x5f48f5){_0x17b1c0=_0x17b1c0-0x0;var _0x5b0ff5=_0xe706[_0x17b1c0];return _0x5b0ff5;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5f0864,_0x413e01){var _0x5700dc=function(_0x1677cf){while(--_0x1677cf){_0x5f0864['push'](_0x5f0864['shift']());}};_0x5700dc(++_0x413e01);}(_0x9c44,0x178));var _0x49c4=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x9c44[_0x1694f5];return _0x5b4321;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 8477ead..5668d9b 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 _0x5bec=['INTEGER','sequelize','exports'];(function(_0x27bfc0,_0x648c41){var _0x2fea21=function(_0x4ba588){while(--_0x4ba588){_0x27bfc0['push'](_0x27bfc0['shift']());}};_0x2fea21(++_0x648c41);}(_0x5bec,0x85));var _0xc5be=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x5bec[_0x29d915];return _0x160f86;};'use strict';var Sequelize=require(_0xc5be('0x0'));module[_0xc5be('0x1')]={'penalty':{'type':Sequelize[_0xc5be('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x26aa=['exports','INTEGER'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x26aa,0xa2));var _0xa26a=function(_0x3b2ea0,_0x1fa0e2){_0x3b2ea0=_0x3b2ea0-0x0;var _0x130879=_0x26aa[_0x3b2ea0];return _0x130879;};'use strict';var Sequelize=require('sequelize');module[_0xa26a('0x0')]={'penalty':{'type':Sequelize[_0xa26a('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 ed015d2..023d84a 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 _0xbdfd=['team_has_voice_queues','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','TeamVoiceQueue'];(function(_0x3bc3c5,_0xa101ec){var _0x5641b3=function(_0x5da0e9){while(--_0x5da0e9){_0x3bc3c5['push'](_0x3bc3c5['shift']());}};_0x5641b3(++_0xa101ec);}(_0xbdfd,0x135));var _0xdbdf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbdfd[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xdbdf('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdbdf('0x1'));var moment=require(_0xdbdf('0x2'));var BPromise=require(_0xdbdf('0x3'));var rp=require(_0xdbdf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdbdf('0x5'));var config=require(_0xdbdf('0x6'));var attributes=require('./teamVoiceQueue.attributes');module[_0xdbdf('0x7')]=function(_0xa743ff,_0x484034){return _0xa743ff[_0xdbdf('0x8')](_0xdbdf('0x9'),attributes,{'tableName':_0xdbdf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a5e=['path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','team_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3a5e,0x14c));var _0xe3a5=function(_0x4a3e77,_0xb55265){_0x4a3e77=_0x4a3e77-0x0;var _0x299762=_0x3a5e[_0x4a3e77];return _0x299762;};'use strict';var _=require(_0xe3a5('0x0'));var util=require(_0xe3a5('0x1'));var logger=require(_0xe3a5('0x2'))(_0xe3a5('0x3'));var moment=require(_0xe3a5('0x4'));var BPromise=require(_0xe3a5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe3a5('0x6'));var rimraf=require(_0xe3a5('0x7'));var config=require(_0xe3a5('0x8'));var attributes=require(_0xe3a5('0x9'));module[_0xe3a5('0xa')]=function(_0x499f61,_0x5e1507){return _0x499f61[_0xe3a5('0xb')]('TeamVoiceQueue',attributes,{'tableName':_0xe3a5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 4c9121c..116ae73 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 _0xd847=['../../config/utils','../../config/logger','rpc','../../config/environment','client','request','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','TeamVoiceQueue,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','../../mysqldb'];(function(_0x587715,_0x4d4abe){var _0x599ece=function(_0x3ecbb8){while(--_0x3ecbb8){_0x587715['push'](_0x587715['shift']());}};_0x599ece(++_0x4d4abe);}(_0xd847,0x18a));var _0x7d84=function(_0x1acde2,_0x4cd189){_0x1acde2=_0x1acde2-0x0;var _0x4ccd31=_0xd847[_0x1acde2];return _0x4ccd31;};'use strict';var _=require(_0x7d84('0x0'));var util=require(_0x7d84('0x1'));var moment=require(_0x7d84('0x2'));var BPromise=require(_0x7d84('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7d84('0x4'))['db'];var utils=require(_0x7d84('0x5'));var logger=require(_0x7d84('0x6'))(_0x7d84('0x7'));var config=require(_0x7d84('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7d84('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c57cd,_0x20ce63,_0x1d6297){return new BPromise(function(_0x32da6d,_0x128ef5){return client[_0x7d84('0xa')](_0x3c57cd,_0x1d6297)['then'](function(_0x1cf0b9){logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x20ce63,_0x7d84('0xb'));logger[_0x7d84('0xc')](_0x7d84('0xd'),_0x20ce63,_0x7d84('0xb'),JSON[_0x7d84('0xe')](_0x1cf0b9));if(_0x1cf0b9[_0x7d84('0xf')]){if(_0x1cf0b9[_0x7d84('0xf')][_0x7d84('0x10')]===0x1f4){logger[_0x7d84('0xf')](_0x7d84('0x11'),_0x20ce63,_0x1cf0b9[_0x7d84('0xf')][_0x7d84('0x12')]);return _0x128ef5(_0x1cf0b9[_0x7d84('0xf')][_0x7d84('0x12')]);}logger[_0x7d84('0xf')](_0x7d84('0x11'),_0x20ce63,_0x1cf0b9[_0x7d84('0xf')][_0x7d84('0x12')]);return _0x32da6d(_0x1cf0b9[_0x7d84('0xf')][_0x7d84('0x12')]);}else{logger[_0x7d84('0x13')]('TeamVoiceQueue,\x20%s,\x20%s',_0x20ce63,_0x7d84('0xb'));_0x32da6d(_0x1cf0b9[_0x7d84('0x14')]['message']);}})['catch'](function(_0x5338ab){logger[_0x7d84('0xf')](_0x7d84('0x11'),_0x20ce63,_0x5338ab);_0x128ef5(_0x5338ab);});});} \ No newline at end of file +var _0xb2b5=['request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x5a26b6,_0x18f94e){var _0x2ee225=function(_0x414290){while(--_0x414290){_0x5a26b6['push'](_0x5a26b6['shift']());}};_0x2ee225(++_0x18f94e);}(_0xb2b5,0xa3));var _0x5b2b=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xb2b5[_0x17b6e3];return _0x3906f3;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5b2b('0x0'));var fs=require('fs');var Redis=require(_0x5b2b('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5b2b('0x2'))(_0x5b2b('0x3'));var config=require(_0x5b2b('0x4'));var jayson=require(_0x5b2b('0x5'));var client=jayson['client'][_0x5b2b('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x362524,_0x51a531,_0x54389e){return new BPromise(function(_0x1e08e6,_0x8e6e14){return client[_0x5b2b('0x7')](_0x362524,_0x54389e)[_0x5b2b('0x8')](function(_0x6cc9ab){logger[_0x5b2b('0x9')](_0x5b2b('0xa'),_0x51a531,_0x5b2b('0xb'));logger['debug'](_0x5b2b('0xc'),_0x51a531,_0x5b2b('0xb'),JSON['stringify'](_0x6cc9ab));if(_0x6cc9ab[_0x5b2b('0xd')]){if(_0x6cc9ab[_0x5b2b('0xd')]['code']===0x1f4){logger[_0x5b2b('0xd')](_0x5b2b('0xa'),_0x51a531,_0x6cc9ab[_0x5b2b('0xd')][_0x5b2b('0xe')]);return _0x8e6e14(_0x6cc9ab[_0x5b2b('0xd')][_0x5b2b('0xe')]);}logger[_0x5b2b('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x51a531,_0x6cc9ab[_0x5b2b('0xd')]['message']);return _0x1e08e6(_0x6cc9ab[_0x5b2b('0xd')][_0x5b2b('0xe')]);}else{logger[_0x5b2b('0x9')](_0x5b2b('0xa'),_0x51a531,'request\x20sent');_0x1e08e6(_0x6cc9ab[_0x5b2b('0xf')]['message']);}})[_0x5b2b('0x10')](function(_0x481d65){logger['error'](_0x5b2b('0xa'),_0x51a531,_0x481d65);_0x8e6e14(_0x481d65);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index df9e1c1..9069789 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 _0x8a87=['delete','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','post','create','update'];(function(_0x367a3d,_0x452717){var _0x460539=function(_0x1e8beb){while(--_0x1e8beb){_0x367a3d['push'](_0x367a3d['shift']());}};_0x460539(++_0x452717);}(_0x8a87,0x6b));var _0x78a8=function(_0x5927ba,_0x34792d){_0x5927ba=_0x5927ba-0x0;var _0x1975d6=_0x8a87[_0x5927ba];return _0x1975d6;};'use strict';var multer=require(_0x78a8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x78a8('0x1'));var express=require('express');var router=express[_0x78a8('0x2')]();var fs_extra=require(_0x78a8('0x3'));var auth=require(_0x78a8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x78a8('0x5'));var controller=require('./template.controller');router['get']('/',auth[_0x78a8('0x6')](),controller[_0x78a8('0x7')]);router[_0x78a8('0x8')](_0x78a8('0x9'),auth[_0x78a8('0x6')](),controller['show']);router[_0x78a8('0xa')]('/',auth['isAuthenticated'](),controller[_0x78a8('0xb')]);router['put'](_0x78a8('0x9'),auth[_0x78a8('0x6')](),controller[_0x78a8('0xc')]);router[_0x78a8('0xd')](_0x78a8('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x78a8('0xe')]=router; \ No newline at end of file +var _0xdc86=['isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0xdc86,0x118));var _0x6dc8=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0xdc86[_0x616290];return _0x453879;};'use strict';var multer=require('multer');var util=require(_0x6dc8('0x0'));var path=require('path');var timeout=require(_0x6dc8('0x1'));var express=require('express');var router=express[_0x6dc8('0x2')]();var fs_extra=require(_0x6dc8('0x3'));var auth=require(_0x6dc8('0x4'));var interaction=require(_0x6dc8('0x5'));var config=require(_0x6dc8('0x6'));var controller=require('./template.controller');router[_0x6dc8('0x7')]('/',auth[_0x6dc8('0x8')](),controller[_0x6dc8('0x9')]);router[_0x6dc8('0x7')](_0x6dc8('0xa'),auth[_0x6dc8('0x8')](),controller[_0x6dc8('0xb')]);router[_0x6dc8('0xc')]('/',auth['isAuthenticated'](),controller[_0x6dc8('0xd')]);router['put'](_0x6dc8('0xa'),auth[_0x6dc8('0x8')](),controller[_0x6dc8('0xe')]);router[_0x6dc8('0xf')]('/:id',auth[_0x6dc8('0x8')](),controller[_0x6dc8('0x10')]);module[_0x6dc8('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index f6342e1..4c89ad4 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 _0x5239=['exports','STRING','sequelize'];(function(_0xcb7a1b,_0x39f401){var _0x550285=function(_0x290c6b){while(--_0x290c6b){_0xcb7a1b['push'](_0xcb7a1b['shift']());}};_0x550285(++_0x39f401);}(_0x5239,0x9e));var _0x9523=function(_0x3b8d4e,_0x3bb04b){_0x3b8d4e=_0x3b8d4e-0x0;var _0x41de4e=_0x5239[_0x3b8d4e];return _0x41de4e;};'use strict';var Sequelize=require(_0x9523('0x0'));module[_0x9523('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9523('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x43a6=['STRING','TEXT','sequelize'];(function(_0x44ef42,_0x4a819c){var _0x32a13c=function(_0x445438){while(--_0x445438){_0x44ef42['push'](_0x44ef42['shift']());}};_0x32a13c(++_0x4a819c);}(_0x43a6,0x16d));var _0x643a=function(_0x1044e5,_0x498e01){_0x1044e5=_0x1044e5-0x0;var _0x5ad0dd=_0x43a6[_0x1044e5];return _0x5ad0dd;};'use strict';var Sequelize=require(_0x643a('0x0'));module['exports']={'name':{'type':Sequelize[_0x643a('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x643a('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index b2bb021..58c0e27 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 _0xf596=['status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','UserProfileResource','then','stack','name','index','rawAttributes','type','key','model','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','Template','catch','show','params','keys','intersection','include','merge','find','create','body','user','get','role','Templates','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end'];(function(_0x24fcf3,_0x87a2c4){var _0x4b6ed6=function(_0x59717d){while(--_0x59717d){_0x24fcf3['push'](_0x24fcf3['shift']());}};_0x4b6ed6(++_0x87a2c4);}(_0xf596,0xe1));var _0x6f59=function(_0x1c6520,_0x19ce8c){_0x1c6520=_0x1c6520-0x0;var _0x445165=_0xf596[_0x1c6520];return _0x445165;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6f59('0x0'));var zipdir=require(_0x6f59('0x1'));var jsonpatch=require(_0x6f59('0x2'));var rp=require(_0x6f59('0x3'));var moment=require('moment');var BPromise=require(_0x6f59('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6f59('0x5'));var sox=require(_0x6f59('0x6'));var csv=require(_0x6f59('0x7'));var ejs=require(_0x6f59('0x8'));var fs=require('fs');var fs_extra=require(_0x6f59('0x9'));var _=require(_0x6f59('0xa'));var squel=require(_0x6f59('0xb'));var crypto=require(_0x6f59('0xc'));var jsforce=require(_0x6f59('0xd'));var deskjs=require(_0x6f59('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6f59('0xf'));var Papa=require('papaparse');var Redis=require(_0x6f59('0x10'));var authService=require(_0x6f59('0x11'));var qs=require(_0x6f59('0x12'));var as=require(_0x6f59('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6f59('0x14'))(_0x6f59('0x15'));var utils=require(_0x6f59('0x16'));var config=require(_0x6f59('0x17'));var licenseUtil=require(_0x6f59('0x18'));var db=require(_0x6f59('0x19'))['db'];function respondWithStatusCode(_0x359bec,_0x4bd1ab){_0x4bd1ab=_0x4bd1ab||0xcc;return function(_0x491fed){if(_0x491fed){return _0x359bec['sendStatus'](_0x4bd1ab);}return _0x359bec['status'](_0x4bd1ab)[_0x6f59('0x1a')]();};}function respondWithResult(_0x12e1f8,_0x4bb569){_0x4bb569=_0x4bb569||0xc8;return function(_0x3af006){if(_0x3af006){return _0x12e1f8[_0x6f59('0x1b')](_0x4bb569)[_0x6f59('0x1c')](_0x3af006);}};}function respondWithFilteredResult(_0x18d190,_0x425fc7){return function(_0x1b5412){if(_0x1b5412){var _0x3c4c24=typeof _0x425fc7[_0x6f59('0x1d')]===_0x6f59('0x1e')&&typeof _0x425fc7[_0x6f59('0x1f')]===_0x6f59('0x1e');var _0x2cec53=_0x1b5412[_0x6f59('0x20')];var _0x5c7f8d=_0x3c4c24?0x0:_0x425fc7[_0x6f59('0x1d')];var _0x3034c2=_0x3c4c24?_0x1b5412['count']:_0x425fc7[_0x6f59('0x1d')]+_0x425fc7[_0x6f59('0x1f')];var _0x1b5c14;if(_0x3034c2>=_0x2cec53){_0x3034c2=_0x2cec53;_0x1b5c14=0xc8;}else{_0x1b5c14=0xce;}_0x18d190['status'](_0x1b5c14);return _0x18d190[_0x6f59('0x21')](_0x6f59('0x22'),_0x5c7f8d+'-'+_0x3034c2+'/'+_0x2cec53)[_0x6f59('0x1c')](_0x1b5412);}return null;};}function patchUpdates(_0x464061){return function(_0x2edba3){try{jsonpatch[_0x6f59('0x23')](_0x2edba3,_0x464061,!![]);}catch(_0x3cc81d){return BPromise[_0x6f59('0x24')](_0x3cc81d);}return _0x2edba3[_0x6f59('0x25')]();};}function saveUpdates(_0x2a838e,_0x42f4e4){return function(_0x256b40){if(_0x256b40){return _0x256b40[_0x6f59('0x26')](_0x2a838e)['then'](function(_0x467e6e){return _0x467e6e;});}return null;};}function removeEntity(_0xbee047,_0x561ab6){return function(_0x530008){if(_0x530008){return _0x530008[_0x6f59('0x27')]()['then'](function(){var _0x404e9f=_0x530008['get']({'plain':!![]});var _0x51cc6f='Templates';return db[_0x6f59('0x28')][_0x6f59('0x27')]({'where':{'type':_0x51cc6f,'resourceId':_0x404e9f['id']}})[_0x6f59('0x29')](function(){return _0x530008;});})[_0x6f59('0x29')](function(){_0xbee047[_0x6f59('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4243ef,_0x2f0227){return function(_0xdb6941){if(!_0xdb6941){_0x4243ef['sendStatus'](0x194);}return _0xdb6941;};}function handleError(_0x2a5297,_0x2cf503){_0x2cf503=_0x2cf503||0x1f4;return function(_0xeda4a3){logger['error'](_0xeda4a3[_0x6f59('0x2a')]);if(_0xeda4a3[_0x6f59('0x2b')]){delete _0xeda4a3[_0x6f59('0x2b')];}_0x2a5297[_0x6f59('0x1b')](_0x2cf503)['send'](_0xeda4a3);};}exports[_0x6f59('0x2c')]=function(_0x2e41a9,_0x5effa8){var _0x589fa3={},_0x2d72df={},_0x564a9b={'count':0x0,'rows':[]};var _0x2c6ef4=_['map'](db['Template'][_0x6f59('0x2d')],function(_0x51acc6){return{'name':_0x51acc6['fieldName'],'type':_0x51acc6[_0x6f59('0x2e')][_0x6f59('0x2f')]};});_0x2d72df[_0x6f59('0x30')]=_['map'](_0x2c6ef4,_0x6f59('0x2b'));_0x2d72df['query']=_['keys'](_0x2e41a9[_0x6f59('0x31')]);_0x2d72df['filters']=_['intersection'](_0x2d72df[_0x6f59('0x30')],_0x2d72df[_0x6f59('0x31')]);_0x589fa3['attributes']=_['intersection'](_0x2d72df[_0x6f59('0x30')],qs[_0x6f59('0x32')](_0x2e41a9[_0x6f59('0x31')][_0x6f59('0x32')]));_0x589fa3['attributes']=_0x589fa3[_0x6f59('0x33')][_0x6f59('0x34')]?_0x589fa3[_0x6f59('0x33')]:_0x2d72df['model'];if(!_0x2e41a9[_0x6f59('0x31')][_0x6f59('0x35')](_0x6f59('0x36'))){_0x589fa3['limit']=qs['limit'](_0x2e41a9['query'][_0x6f59('0x1f')]);_0x589fa3['offset']=qs[_0x6f59('0x1d')](_0x2e41a9[_0x6f59('0x31')][_0x6f59('0x1d')]);}_0x589fa3[_0x6f59('0x37')]=qs[_0x6f59('0x38')](_0x2e41a9[_0x6f59('0x31')][_0x6f59('0x38')]);_0x589fa3[_0x6f59('0x39')]=qs[_0x6f59('0x3a')](_[_0x6f59('0x3b')](_0x2e41a9[_0x6f59('0x31')],_0x2d72df[_0x6f59('0x3a')]),_0x2c6ef4);if(_0x2e41a9['query'][_0x6f59('0x3c')]){_0x589fa3[_0x6f59('0x39')]=_['merge'](_0x589fa3[_0x6f59('0x39')],{'$or':_['map'](_0x2c6ef4,function(_0x4a9e62){if(_0x4a9e62[_0x6f59('0x2e')]!==_0x6f59('0x3d')){var _0x1bd877={};_0x1bd877[_0x4a9e62[_0x6f59('0x2b')]]={'$like':'%'+_0x2e41a9['query'][_0x6f59('0x3c')]+'%'};return _0x1bd877;}})});}_0x589fa3=_['merge']({},_0x589fa3,_0x2e41a9[_0x6f59('0x3e')]);var _0x2edb48={'where':_0x589fa3[_0x6f59('0x39')]};return db['Template'][_0x6f59('0x20')](_0x2edb48)['then'](function(_0x56a883){_0x564a9b[_0x6f59('0x20')]=_0x56a883;if(_0x2e41a9[_0x6f59('0x31')][_0x6f59('0x3f')]){_0x589fa3['include']=[{'all':!![]}];}return db[_0x6f59('0x40')]['findAll'](_0x589fa3);})['then'](function(_0x55903c){_0x564a9b['rows']=_0x55903c;return _0x564a9b;})[_0x6f59('0x29')](respondWithFilteredResult(_0x5effa8,_0x589fa3))[_0x6f59('0x41')](handleError(_0x5effa8,null));};exports[_0x6f59('0x42')]=function(_0x449db9,_0x2d1470){var _0x303f36={'raw':!![],'where':{'id':_0x449db9[_0x6f59('0x43')]['id']}},_0x44a686={};_0x44a686[_0x6f59('0x30')]=_[_0x6f59('0x44')](db['Template'][_0x6f59('0x2d')]);_0x44a686[_0x6f59('0x31')]=_[_0x6f59('0x44')](_0x449db9[_0x6f59('0x31')]);_0x44a686[_0x6f59('0x3a')]=_[_0x6f59('0x45')](_0x44a686['model'],_0x44a686[_0x6f59('0x31')]);_0x303f36[_0x6f59('0x33')]=_[_0x6f59('0x45')](_0x44a686['model'],qs['fields'](_0x449db9[_0x6f59('0x31')][_0x6f59('0x32')]));_0x303f36[_0x6f59('0x33')]=_0x303f36[_0x6f59('0x33')][_0x6f59('0x34')]?_0x303f36[_0x6f59('0x33')]:_0x44a686[_0x6f59('0x30')];if(_0x449db9['query'][_0x6f59('0x3f')]){_0x303f36[_0x6f59('0x46')]=[{'all':!![]}];}_0x303f36=_[_0x6f59('0x47')]({},_0x303f36,_0x449db9[_0x6f59('0x3e')]);return db[_0x6f59('0x40')][_0x6f59('0x48')](_0x303f36)['then'](handleEntityNotFound(_0x2d1470,null))[_0x6f59('0x29')](respondWithResult(_0x2d1470,null))[_0x6f59('0x41')](handleError(_0x2d1470,null));};exports[_0x6f59('0x49')]=function(_0x33f911,_0x267aab){return db['Template'][_0x6f59('0x49')](_0x33f911[_0x6f59('0x4a')],{})[_0x6f59('0x29')](function(_0x1d9498){var _0x264a66=_0x33f911[_0x6f59('0x4b')][_0x6f59('0x4c')]({'plain':!![]});if(!_0x264a66)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x264a66[_0x6f59('0x4d')]===_0x6f59('0x4b')){var _0x2eb024=_0x1d9498[_0x6f59('0x4c')]({'plain':!![]});var _0x2be6ac=_0x6f59('0x4e');return db[_0x6f59('0x4f')]['find']({'where':{'name':_0x2be6ac,'userProfileId':_0x264a66[_0x6f59('0x50')]},'raw':!![]})[_0x6f59('0x29')](function(_0xf2917){if(_0xf2917&&_0xf2917[_0x6f59('0x51')]===0x0){return db[_0x6f59('0x28')][_0x6f59('0x49')]({'name':_0x2eb024['name'],'resourceId':_0x2eb024['id'],'type':_0xf2917[_0x6f59('0x2b')],'sectionId':_0xf2917['id']},{})[_0x6f59('0x29')](function(){return _0x1d9498;});}else{return _0x1d9498;}})['catch'](function(_0x295cf2){logger[_0x6f59('0x52')](_0x6f59('0x53'),_0x295cf2);throw _0x295cf2;});}return _0x1d9498;})['then'](respondWithResult(_0x267aab,0xc9))[_0x6f59('0x41')](handleError(_0x267aab,null));};exports[_0x6f59('0x26')]=function(_0x580f6c,_0x3f0cd8){if(_0x580f6c[_0x6f59('0x4a')]['id']){delete _0x580f6c[_0x6f59('0x4a')]['id'];}return db[_0x6f59('0x40')]['find']({'where':{'id':_0x580f6c['params']['id']}})[_0x6f59('0x29')](handleEntityNotFound(_0x3f0cd8,null))[_0x6f59('0x29')](saveUpdates(_0x580f6c[_0x6f59('0x4a')],null))[_0x6f59('0x29')](respondWithResult(_0x3f0cd8,null))[_0x6f59('0x41')](handleError(_0x3f0cd8,null));};exports['destroy']=function(_0x2405c5,_0x24e19a){return db[_0x6f59('0x40')][_0x6f59('0x48')]({'where':{'id':_0x2405c5[_0x6f59('0x43')]['id']}})['then'](handleEntityNotFound(_0x24e19a,null))[_0x6f59('0x29')](removeEntity(_0x24e19a,null))[_0x6f59('0x41')](handleError(_0x24e19a,null));}; \ No newline at end of file +var _0x2926=['get','Templates','UserProfileResource','error','stack','name','map','Template','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows','catch','params','keys','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then'];(function(_0x463697,_0xccfdc4){var _0x33cfe1=function(_0x5c74ec){while(--_0x5c74ec){_0x463697['push'](_0x463697['shift']());}};_0x33cfe1(++_0xccfdc4);}(_0x2926,0x82));var _0x6292=function(_0x1ea6eb,_0x33d3d4){_0x1ea6eb=_0x1ea6eb-0x0;var _0x127200=_0x2926[_0x1ea6eb];return _0x127200;};'use strict';var emlformat=require(_0x6292('0x0'));var rimraf=require(_0x6292('0x1'));var zipdir=require(_0x6292('0x2'));var jsonpatch=require(_0x6292('0x3'));var rp=require(_0x6292('0x4'));var moment=require(_0x6292('0x5'));var BPromise=require(_0x6292('0x6'));var Mustache=require(_0x6292('0x7'));var util=require(_0x6292('0x8'));var path=require('path');var sox=require(_0x6292('0x9'));var csv=require(_0x6292('0xa'));var ejs=require(_0x6292('0xb'));var fs=require('fs');var fs_extra=require(_0x6292('0xc'));var _=require(_0x6292('0xd'));var squel=require(_0x6292('0xe'));var crypto=require(_0x6292('0xf'));var jsforce=require(_0x6292('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x6292('0xa'));var querystring=require(_0x6292('0x11'));var Papa=require(_0x6292('0x12'));var Redis=require('ioredis');var authService=require(_0x6292('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6292('0x14'));var hardwareService=require(_0x6292('0x15'));var logger=require(_0x6292('0x16'))(_0x6292('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6292('0x18'))['db'];function respondWithStatusCode(_0x52b449,_0x4f4f71){_0x4f4f71=_0x4f4f71||0xcc;return function(_0x564807){if(_0x564807){return _0x52b449[_0x6292('0x19')](_0x4f4f71);}return _0x52b449[_0x6292('0x1a')](_0x4f4f71)[_0x6292('0x1b')]();};}function respondWithResult(_0x26f16d,_0x4edd0f){_0x4edd0f=_0x4edd0f||0xc8;return function(_0x3028e8){if(_0x3028e8){return _0x26f16d[_0x6292('0x1a')](_0x4edd0f)[_0x6292('0x1c')](_0x3028e8);}};}function respondWithFilteredResult(_0x23a188,_0x408d79){return function(_0x4af2a3){if(_0x4af2a3){var _0x3a667f=typeof _0x408d79[_0x6292('0x1d')]===_0x6292('0x1e')&&typeof _0x408d79['limit']==='undefined';var _0xe066f7=_0x4af2a3['count'];var _0x5c4eb4=_0x3a667f?0x0:_0x408d79[_0x6292('0x1d')];var _0x33eedd=_0x3a667f?_0x4af2a3['count']:_0x408d79['offset']+_0x408d79[_0x6292('0x1f')];var _0x40df7a;if(_0x33eedd>=_0xe066f7){_0x33eedd=_0xe066f7;_0x40df7a=0xc8;}else{_0x40df7a=0xce;}_0x23a188[_0x6292('0x1a')](_0x40df7a);return _0x23a188[_0x6292('0x20')](_0x6292('0x21'),_0x5c4eb4+'-'+_0x33eedd+'/'+_0xe066f7)['json'](_0x4af2a3);}return null;};}function patchUpdates(_0x23b5bf){return function(_0x55c5e2){try{jsonpatch[_0x6292('0x22')](_0x55c5e2,_0x23b5bf,!![]);}catch(_0x27bf6c){return BPromise[_0x6292('0x23')](_0x27bf6c);}return _0x55c5e2[_0x6292('0x24')]();};}function saveUpdates(_0x326df8,_0x1f4564){return function(_0x36644a){if(_0x36644a){return _0x36644a[_0x6292('0x25')](_0x326df8)['then'](function(_0x31a203){return _0x31a203;});}return null;};}function removeEntity(_0x243d8d,_0x1c6d72){return function(_0x5c8907){if(_0x5c8907){return _0x5c8907[_0x6292('0x26')]()[_0x6292('0x27')](function(){var _0x245fd1=_0x5c8907[_0x6292('0x28')]({'plain':!![]});var _0x42a2d4=_0x6292('0x29');return db[_0x6292('0x2a')][_0x6292('0x26')]({'where':{'type':_0x42a2d4,'resourceId':_0x245fd1['id']}})[_0x6292('0x27')](function(){return _0x5c8907;});})['then'](function(){_0x243d8d['status'](0xcc)[_0x6292('0x1b')]();});}};}function handleEntityNotFound(_0x565871,_0x35ca1c){return function(_0x39f125){if(!_0x39f125){_0x565871[_0x6292('0x19')](0x194);}return _0x39f125;};}function handleError(_0x5f61ee,_0x27d7d1){_0x27d7d1=_0x27d7d1||0x1f4;return function(_0x3c8839){logger[_0x6292('0x2b')](_0x3c8839[_0x6292('0x2c')]);if(_0x3c8839[_0x6292('0x2d')]){delete _0x3c8839[_0x6292('0x2d')];}_0x5f61ee['status'](_0x27d7d1)['send'](_0x3c8839);};}exports['index']=function(_0x6078eb,_0x1d556c){var _0x3e114f={},_0x2f41fb={},_0x18acb6={'count':0x0,'rows':[]};var _0x111d66=_[_0x6292('0x2e')](db[_0x6292('0x2f')][_0x6292('0x30')],function(_0x55f8cf){return{'name':_0x55f8cf[_0x6292('0x31')],'type':_0x55f8cf[_0x6292('0x32')][_0x6292('0x33')]};});_0x2f41fb[_0x6292('0x34')]=_['map'](_0x111d66,'name');_0x2f41fb[_0x6292('0x35')]=_['keys'](_0x6078eb['query']);_0x2f41fb[_0x6292('0x36')]=_['intersection'](_0x2f41fb[_0x6292('0x34')],_0x2f41fb[_0x6292('0x35')]);_0x3e114f[_0x6292('0x37')]=_[_0x6292('0x38')](_0x2f41fb[_0x6292('0x34')],qs[_0x6292('0x39')](_0x6078eb[_0x6292('0x35')][_0x6292('0x39')]));_0x3e114f[_0x6292('0x37')]=_0x3e114f[_0x6292('0x37')][_0x6292('0x3a')]?_0x3e114f[_0x6292('0x37')]:_0x2f41fb[_0x6292('0x34')];if(!_0x6078eb[_0x6292('0x35')][_0x6292('0x3b')](_0x6292('0x3c'))){_0x3e114f[_0x6292('0x1f')]=qs[_0x6292('0x1f')](_0x6078eb[_0x6292('0x35')][_0x6292('0x1f')]);_0x3e114f[_0x6292('0x1d')]=qs[_0x6292('0x1d')](_0x6078eb['query'][_0x6292('0x1d')]);}_0x3e114f[_0x6292('0x3d')]=qs['sort'](_0x6078eb['query'][_0x6292('0x3e')]);_0x3e114f[_0x6292('0x3f')]=qs[_0x6292('0x36')](_[_0x6292('0x40')](_0x6078eb[_0x6292('0x35')],_0x2f41fb['filters']),_0x111d66);if(_0x6078eb['query'][_0x6292('0x41')]){_0x3e114f[_0x6292('0x3f')]=_[_0x6292('0x42')](_0x3e114f[_0x6292('0x3f')],{'$or':_[_0x6292('0x2e')](_0x111d66,function(_0x409716){if(_0x409716[_0x6292('0x32')]!==_0x6292('0x43')){var _0x27226e={};_0x27226e[_0x409716[_0x6292('0x2d')]]={'$like':'%'+_0x6078eb['query'][_0x6292('0x41')]+'%'};return _0x27226e;}})});}_0x3e114f=_[_0x6292('0x42')]({},_0x3e114f,_0x6078eb['options']);var _0x5f2958={'where':_0x3e114f[_0x6292('0x3f')]};return db[_0x6292('0x2f')][_0x6292('0x44')](_0x5f2958)[_0x6292('0x27')](function(_0x2ac3c6){_0x18acb6[_0x6292('0x44')]=_0x2ac3c6;if(_0x6078eb['query'][_0x6292('0x45')]){_0x3e114f['include']=[{'all':!![]}];}return db['Template'][_0x6292('0x46')](_0x3e114f);})['then'](function(_0x448dba){_0x18acb6[_0x6292('0x47')]=_0x448dba;return _0x18acb6;})[_0x6292('0x27')](respondWithFilteredResult(_0x1d556c,_0x3e114f))[_0x6292('0x48')](handleError(_0x1d556c,null));};exports['show']=function(_0x11e9f1,_0x5d976e){var _0x131c22={'raw':!![],'where':{'id':_0x11e9f1[_0x6292('0x49')]['id']}},_0x115103={};_0x115103['model']=_[_0x6292('0x4a')](db[_0x6292('0x2f')][_0x6292('0x30')]);_0x115103[_0x6292('0x35')]=_[_0x6292('0x4a')](_0x11e9f1['query']);_0x115103['filters']=_['intersection'](_0x115103[_0x6292('0x34')],_0x115103[_0x6292('0x35')]);_0x131c22[_0x6292('0x37')]=_['intersection'](_0x115103[_0x6292('0x34')],qs[_0x6292('0x39')](_0x11e9f1['query']['fields']));_0x131c22['attributes']=_0x131c22[_0x6292('0x37')][_0x6292('0x3a')]?_0x131c22[_0x6292('0x37')]:_0x115103[_0x6292('0x34')];if(_0x11e9f1[_0x6292('0x35')][_0x6292('0x45')]){_0x131c22[_0x6292('0x4b')]=[{'all':!![]}];}_0x131c22=_['merge']({},_0x131c22,_0x11e9f1[_0x6292('0x4c')]);return db[_0x6292('0x2f')][_0x6292('0x4d')](_0x131c22)[_0x6292('0x27')](handleEntityNotFound(_0x5d976e,null))['then'](respondWithResult(_0x5d976e,null))[_0x6292('0x48')](handleError(_0x5d976e,null));};exports[_0x6292('0x4e')]=function(_0xf0e705,_0x422f6a){return db[_0x6292('0x2f')][_0x6292('0x4e')](_0xf0e705[_0x6292('0x4f')],{})[_0x6292('0x27')](function(_0x22277c){var _0x598974=_0xf0e705['user'][_0x6292('0x28')]({'plain':!![]});if(!_0x598974)throw new Error(_0x6292('0x50'));if(_0x598974['role']===_0x6292('0x51')){var _0x944a46=_0x22277c[_0x6292('0x28')]({'plain':!![]});var _0x334efa=_0x6292('0x29');return db['UserProfileSection'][_0x6292('0x4d')]({'where':{'name':_0x334efa,'userProfileId':_0x598974[_0x6292('0x52')]},'raw':!![]})[_0x6292('0x27')](function(_0x334882){if(_0x334882&&_0x334882[_0x6292('0x53')]===0x0){return db[_0x6292('0x2a')]['create']({'name':_0x944a46[_0x6292('0x2d')],'resourceId':_0x944a46['id'],'type':_0x334882['name'],'sectionId':_0x334882['id']},{})['then'](function(){return _0x22277c;});}else{return _0x22277c;}})[_0x6292('0x48')](function(_0x1e9f59){logger[_0x6292('0x2b')](_0x6292('0x54'),_0x1e9f59);throw _0x1e9f59;});}return _0x22277c;})['then'](respondWithResult(_0x422f6a,0xc9))[_0x6292('0x48')](handleError(_0x422f6a,null));};exports['update']=function(_0x3245f9,_0x25c1a6){if(_0x3245f9['body']['id']){delete _0x3245f9[_0x6292('0x4f')]['id'];}return db['Template']['find']({'where':{'id':_0x3245f9['params']['id']}})[_0x6292('0x27')](handleEntityNotFound(_0x25c1a6,null))[_0x6292('0x27')](saveUpdates(_0x3245f9['body'],null))['then'](respondWithResult(_0x25c1a6,null))['catch'](handleError(_0x25c1a6,null));};exports[_0x6292('0x26')]=function(_0x429eb5,_0x5c8390){return db[_0x6292('0x2f')]['find']({'where':{'id':_0x429eb5['params']['id']}})[_0x6292('0x27')](handleEntityNotFound(_0x5c8390,null))[_0x6292('0x27')](removeEntity(_0x5c8390,null))[_0x6292('0x48')](handleError(_0x5c8390,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index bee26ee..2fa3a92 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 _0x5028=['../../config/logger','moment','bluebird','path','rimraf','./template.attributes','define','tools_templates','util'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x5028,0x74));var _0x8502=function(_0x2e211,_0x56a1c9){_0x2e211=_0x2e211-0x0;var _0x36f6c6=_0x5028[_0x2e211];return _0x36f6c6;};'use strict';var _=require('lodash');var util=require(_0x8502('0x0'));var logger=require(_0x8502('0x1'))('api');var moment=require(_0x8502('0x2'));var BPromise=require(_0x8502('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8502('0x4'));var rimraf=require(_0x8502('0x5'));var config=require('../../config/environment');var attributes=require(_0x8502('0x6'));module['exports']=function(_0x54dfee,_0x197dc3){return _0x54dfee[_0x8502('0x7')]('Template',attributes,{'tableName':_0x8502('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7159=['util','moment','bluebird','request-promise','rimraf','../../config/environment','./template.attributes','define','Template','tools_templates','lodash'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x7159,0x133));var _0x9715=function(_0x101423,_0x4e7503){_0x101423=_0x101423-0x0;var _0x11166c=_0x7159[_0x101423];return _0x11166c;};'use strict';var _=require(_0x9715('0x0'));var util=require(_0x9715('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9715('0x2'));var BPromise=require(_0x9715('0x3'));var rp=require(_0x9715('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9715('0x5'));var config=require(_0x9715('0x6'));var attributes=require(_0x9715('0x7'));module['exports']=function(_0x37c485,_0xad62f0){return _0x37c485[_0x9715('0x8')](_0x9715('0x9'),attributes,{'tableName':_0x9715('0xa'),'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 97af287..7c7953d 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 _0x98d2=['info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Template,\x20%s,\x20%s','catch','GetTemplate','Template','options','raw','attributes','limit','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then'];(function(_0x3c0c9e,_0x3ecdee){var _0x5ba5fe=function(_0x1f4a60){while(--_0x1f4a60){_0x3c0c9e['push'](_0x3c0c9e['shift']());}};_0x5ba5fe(++_0x3ecdee);}(_0x98d2,0xb3));var _0x298d=function(_0x1857d0,_0x6eade0){_0x1857d0=_0x1857d0-0x0;var _0x3e3c46=_0x98d2[_0x1857d0];return _0x3e3c46;};'use strict';var _=require(_0x298d('0x0'));var util=require(_0x298d('0x1'));var moment=require(_0x298d('0x2'));var BPromise=require(_0x298d('0x3'));var rs=require(_0x298d('0x4'));var fs=require('fs');var Redis=require(_0x298d('0x5'));var db=require(_0x298d('0x6'))['db'];var utils=require(_0x298d('0x7'));var logger=require(_0x298d('0x8'))('rpc');var config=require(_0x298d('0x9'));var jayson=require(_0x298d('0xa'));var client=jayson['client'][_0x298d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27720a,_0x94eb90,_0x49cff2){return new BPromise(function(_0x2e00cd,_0x4bc06c){return client['request'](_0x27720a,_0x49cff2)[_0x298d('0xc')](function(_0x47f0c9){logger[_0x298d('0xd')]('Template,\x20%s,\x20%s',_0x94eb90,_0x298d('0xe'));logger[_0x298d('0xf')](_0x298d('0x10'),_0x94eb90,_0x298d('0xe'),JSON[_0x298d('0x11')](_0x47f0c9));if(_0x47f0c9[_0x298d('0x12')]){if(_0x47f0c9[_0x298d('0x12')][_0x298d('0x13')]===0x1f4){logger[_0x298d('0x12')]('Template,\x20%s,\x20%s',_0x94eb90,_0x47f0c9[_0x298d('0x12')]['message']);return _0x4bc06c(_0x47f0c9['error'][_0x298d('0x14')]);}logger[_0x298d('0x12')](_0x298d('0x15'),_0x94eb90,_0x47f0c9[_0x298d('0x12')][_0x298d('0x14')]);return _0x2e00cd(_0x47f0c9[_0x298d('0x12')]['message']);}else{logger['info'](_0x298d('0x15'),_0x94eb90,'request\x20sent');_0x2e00cd(_0x47f0c9['result'][_0x298d('0x14')]);}})[_0x298d('0x16')](function(_0x52fb00){logger[_0x298d('0x12')](_0x298d('0x15'),_0x94eb90,_0x52fb00);_0x4bc06c(_0x52fb00);});});}exports[_0x298d('0x17')]=function(_0x4cbc15){var _0x25c9fe=this;return new Promise(function(_0x206a29,_0x5a81ae){return db[_0x298d('0x18')]['findAll']({'raw':_0x4cbc15['options']?_0x4cbc15[_0x298d('0x19')][_0x298d('0x1a')]===undefined?!![]:![]:!![],'where':_0x4cbc15[_0x298d('0x19')]?_0x4cbc15[_0x298d('0x19')]['where']||null:null,'attributes':_0x4cbc15[_0x298d('0x19')]?_0x4cbc15[_0x298d('0x19')][_0x298d('0x1b')]||null:null,'limit':_0x4cbc15[_0x298d('0x19')]?_0x4cbc15['options'][_0x298d('0x1c')]||null:null,'include':_0x4cbc15['options']?_0x4cbc15[_0x298d('0x19')][_0x298d('0x1d')]?_[_0x298d('0x1e')](_0x4cbc15[_0x298d('0x19')]['include'],function(_0x10e07a){return{'model':db[_0x10e07a['model']],'as':_0x10e07a['as'],'attributes':_0x10e07a[_0x298d('0x1b')],'include':_0x10e07a[_0x298d('0x1d')]?_[_0x298d('0x1e')](_0x10e07a['include'],function(_0x9da717){return{'model':db[_0x9da717[_0x298d('0x1f')]],'as':_0x9da717['as'],'attributes':_0x9da717[_0x298d('0x1b')],'include':_0x9da717[_0x298d('0x1d')]?_[_0x298d('0x1e')](_0x9da717[_0x298d('0x1d')],function(_0x510b33){return{'model':db[_0x510b33['model']],'as':_0x510b33['as'],'attributes':_0x510b33['attributes']};}):[]};}):[]};}):[]:[]})[_0x298d('0xc')](function(_0x55ec55){logger['info'](_0x298d('0x17'),_0x4cbc15);logger['debug'](_0x298d('0x17'),_0x4cbc15,JSON[_0x298d('0x11')](_0x55ec55));_0x206a29(_0x55ec55);})[_0x298d('0x16')](function(_0x2056f3){logger['error']('GetTemplate',_0x2056f3[_0x298d('0x14')],_0x4cbc15);_0x5a81ae(_0x25c9fe[_0x298d('0x12')](0x1f4,_0x2056f3[_0x298d('0x14')]));});});}; \ No newline at end of file +var _0x123d=['raw','where','attributes','limit','include','model','map','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetTemplate','Template','findAll','options'];(function(_0xbf7079,_0x1ce325){var _0xe443a9=function(_0x52fe9a){while(--_0x52fe9a){_0xbf7079['push'](_0xbf7079['shift']());}};_0xe443a9(++_0x1ce325);}(_0x123d,0x187));var _0xd123=function(_0x15e023,_0x50e383){_0x15e023=_0x15e023-0x0;var _0x497bb1=_0x123d[_0x15e023];return _0x497bb1;};'use strict';var _=require(_0xd123('0x0'));var util=require('util');var moment=require(_0xd123('0x1'));var BPromise=require('bluebird');var rs=require(_0xd123('0x2'));var fs=require('fs');var Redis=require(_0xd123('0x3'));var db=require(_0xd123('0x4'))['db'];var utils=require(_0xd123('0x5'));var logger=require(_0xd123('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd123('0x7')][_0xd123('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x18a5ef,_0x8fd7da,_0x224035){return new BPromise(function(_0x210676,_0x20ea6b){return client[_0xd123('0x9')](_0x18a5ef,_0x224035)[_0xd123('0xa')](function(_0x59323a){logger[_0xd123('0xb')](_0xd123('0xc'),_0x8fd7da,'request\x20sent');logger[_0xd123('0xd')](_0xd123('0xe'),_0x8fd7da,_0xd123('0xf'),JSON[_0xd123('0x10')](_0x59323a));if(_0x59323a[_0xd123('0x11')]){if(_0x59323a[_0xd123('0x11')][_0xd123('0x12')]===0x1f4){logger[_0xd123('0x11')](_0xd123('0xc'),_0x8fd7da,_0x59323a['error'][_0xd123('0x13')]);return _0x20ea6b(_0x59323a[_0xd123('0x11')][_0xd123('0x13')]);}logger[_0xd123('0x11')](_0xd123('0xc'),_0x8fd7da,_0x59323a[_0xd123('0x11')][_0xd123('0x13')]);return _0x210676(_0x59323a['error'][_0xd123('0x13')]);}else{logger[_0xd123('0xb')]('Template,\x20%s,\x20%s',_0x8fd7da,'request\x20sent');_0x210676(_0x59323a[_0xd123('0x14')][_0xd123('0x13')]);}})['catch'](function(_0x556dc3){logger[_0xd123('0x11')](_0xd123('0xc'),_0x8fd7da,_0x556dc3);_0x20ea6b(_0x556dc3);});});}exports[_0xd123('0x15')]=function(_0x637866){var _0x10bee6=this;return new Promise(function(_0x67a750,_0x3be87d){return db[_0xd123('0x16')][_0xd123('0x17')]({'raw':_0x637866[_0xd123('0x18')]?_0x637866[_0xd123('0x18')][_0xd123('0x19')]===undefined?!![]:![]:!![],'where':_0x637866['options']?_0x637866[_0xd123('0x18')][_0xd123('0x1a')]||null:null,'attributes':_0x637866[_0xd123('0x18')]?_0x637866[_0xd123('0x18')][_0xd123('0x1b')]||null:null,'limit':_0x637866[_0xd123('0x18')]?_0x637866[_0xd123('0x18')][_0xd123('0x1c')]||null:null,'include':_0x637866['options']?_0x637866['options'][_0xd123('0x1d')]?_['map'](_0x637866[_0xd123('0x18')]['include'],function(_0x5660b3){return{'model':db[_0x5660b3[_0xd123('0x1e')]],'as':_0x5660b3['as'],'attributes':_0x5660b3[_0xd123('0x1b')],'include':_0x5660b3[_0xd123('0x1d')]?_[_0xd123('0x1f')](_0x5660b3[_0xd123('0x1d')],function(_0x941fbe){return{'model':db[_0x941fbe[_0xd123('0x1e')]],'as':_0x941fbe['as'],'attributes':_0x941fbe[_0xd123('0x1b')],'include':_0x941fbe['include']?_[_0xd123('0x1f')](_0x941fbe['include'],function(_0x3e1d3a){return{'model':db[_0x3e1d3a['model']],'as':_0x3e1d3a['as'],'attributes':_0x3e1d3a['attributes']};}):[]};}):[]};}):[]:[]})[_0xd123('0xa')](function(_0x368407){logger[_0xd123('0xb')](_0xd123('0x15'),_0x637866);logger[_0xd123('0xd')](_0xd123('0x15'),_0x637866,JSON[_0xd123('0x10')](_0x368407));_0x67a750(_0x368407);})['catch'](function(_0x2e4a6f){logger[_0xd123('0x11')]('GetTemplate',_0x2e4a6f['message'],_0x637866);_0x3be87d(_0x10bee6['error'](0x1f4,_0x2e4a6f[_0xd123('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index b4c659b..9d339b6 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 _0x91bc=['addAction','put','/:id','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trigger.controller','isAuthenticated','index','get','show','/:id/all_conditions','getAllConditions','getAnyConditions','/:id/actions','post','addAllCondition','/:id/any_conditions','addAnyCondition'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x91bc,0x181));var _0xc91b=function(_0x533279,_0x42f831){_0x533279=_0x533279-0x0;var _0x5793db=_0x91bc[_0x533279];return _0x5793db;};'use strict';var multer=require(_0xc91b('0x0'));var util=require(_0xc91b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc91b('0x2'));var router=express[_0xc91b('0x3')]();var fs_extra=require(_0xc91b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc91b('0x5'));var config=require(_0xc91b('0x6'));var controller=require(_0xc91b('0x7'));router['get']('/',auth[_0xc91b('0x8')](),controller[_0xc91b('0x9')]);router[_0xc91b('0xa')]('/:id',auth[_0xc91b('0x8')](),controller[_0xc91b('0xb')]);router[_0xc91b('0xa')](_0xc91b('0xc'),auth[_0xc91b('0x8')](),controller[_0xc91b('0xd')]);router[_0xc91b('0xa')]('/:id/any_conditions',auth[_0xc91b('0x8')](),controller[_0xc91b('0xe')]);router[_0xc91b('0xa')](_0xc91b('0xf'),auth['isAuthenticated'](),controller['getActions']);router[_0xc91b('0x10')]('/',auth[_0xc91b('0x8')](),controller['create']);router[_0xc91b('0x10')](_0xc91b('0xc'),auth[_0xc91b('0x8')](),controller[_0xc91b('0x11')]);router['post'](_0xc91b('0x12'),auth['isAuthenticated'](),controller[_0xc91b('0x13')]);router['post']('/:id/actions',auth[_0xc91b('0x8')](),controller[_0xc91b('0x14')]);router[_0xc91b('0x15')](_0xc91b('0x16'),auth['isAuthenticated'](),controller[_0xc91b('0x17')]);router[_0xc91b('0x18')]('/:id',auth[_0xc91b('0x8')](),controller[_0xc91b('0x19')]);module[_0xc91b('0x1a')]=router; \ No newline at end of file +var _0x9b05=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','getActions','post','create','addAnyCondition','/:id/actions','put','update','delete','destroy','exports'];(function(_0xfa6362,_0x4f6c6a){var _0x49e0d2=function(_0xd60aa6){while(--_0xd60aa6){_0xfa6362['push'](_0xfa6362['shift']());}};_0x49e0d2(++_0x4f6c6a);}(_0x9b05,0x1cb));var _0x59b0=function(_0x2bd4e3,_0x4d9b53){_0x2bd4e3=_0x2bd4e3-0x0;var _0x259f7c=_0x9b05[_0x2bd4e3];return _0x259f7c;};'use strict';var multer=require('multer');var util=require(_0x59b0('0x0'));var path=require(_0x59b0('0x1'));var timeout=require(_0x59b0('0x2'));var express=require(_0x59b0('0x3'));var router=express[_0x59b0('0x4')]();var fs_extra=require(_0x59b0('0x5'));var auth=require(_0x59b0('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x59b0('0x7'));router[_0x59b0('0x8')]('/',auth[_0x59b0('0x9')](),controller[_0x59b0('0xa')]);router['get'](_0x59b0('0xb'),auth[_0x59b0('0x9')](),controller[_0x59b0('0xc')]);router['get'](_0x59b0('0xd'),auth[_0x59b0('0x9')](),controller[_0x59b0('0xe')]);router['get'](_0x59b0('0xf'),auth[_0x59b0('0x9')](),controller[_0x59b0('0x10')]);router[_0x59b0('0x8')]('/:id/actions',auth[_0x59b0('0x9')](),controller[_0x59b0('0x11')]);router[_0x59b0('0x12')]('/',auth[_0x59b0('0x9')](),controller[_0x59b0('0x13')]);router['post']('/:id/all_conditions',auth[_0x59b0('0x9')](),controller['addAllCondition']);router[_0x59b0('0x12')]('/:id/any_conditions',auth[_0x59b0('0x9')](),controller[_0x59b0('0x14')]);router['post'](_0x59b0('0x15'),auth[_0x59b0('0x9')](),controller['addAction']);router[_0x59b0('0x16')](_0x59b0('0xb'),auth[_0x59b0('0x9')](),controller[_0x59b0('0x17')]);router[_0x59b0('0x18')](_0x59b0('0xb'),auth['isAuthenticated'](),controller[_0x59b0('0x19')]);module[_0x59b0('0x1a')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 0c96993..07e036b 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 _0xad84=['exports','STRING','sequelize'];(function(_0x5f2f0b,_0x5cceb8){var _0x2e3087=function(_0x2f9fb6){while(--_0x2f9fb6){_0x5f2f0b['push'](_0x5f2f0b['shift']());}};_0x2e3087(++_0x5cceb8);}(_0xad84,0x164));var _0x4ad8=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xad84[_0x40220a];return _0x3903cc;};'use strict';var Sequelize=require(_0x4ad8('0x0'));module[_0x4ad8('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4ad8('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x661e=['STRING','BOOLEAN','exports'];(function(_0x5058e6,_0x1a8a6b){var _0x34cc3b=function(_0x1fb6c0){while(--_0x1fb6c0){_0x5058e6['push'](_0x5058e6['shift']());}};_0x34cc3b(++_0x1a8a6b);}(_0x661e,0x7d));var _0xe661=function(_0x3d56b4,_0x5d0af9){_0x3d56b4=_0x3d56b4-0x0;var _0x162c4e=_0x661e[_0x3d56b4];return _0x162c4e;};'use strict';var Sequelize=require('sequelize');module[_0xe661('0x0')]={'name':{'type':Sequelize[_0xe661('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xe661('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 b956a87..44764bf 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 _0xdb76=['lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','get','Triggers','UserProfileResource','name','index','map','rawAttributes','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','Trigger','include','findAll','rows','catch','params','keys','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','error','destroy','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','findOne','getAnyConditions','Action','getActions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x1d6746,_0xaccce7){var _0x18239e=function(_0x2ff661){while(--_0x2ff661){_0x1d6746['push'](_0x1d6746['shift']());}};_0x18239e(++_0xaccce7);}(_0xdb76,0xa8));var _0x6db7=function(_0x235ae0,_0x450404){_0x235ae0=_0x235ae0-0x0;var _0x29db32=_0xdb76[_0x235ae0];return _0x29db32;};'use strict';var emlformat=require(_0x6db7('0x0'));var rimraf=require(_0x6db7('0x1'));var zipdir=require(_0x6db7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6db7('0x3'));var moment=require(_0x6db7('0x4'));var BPromise=require(_0x6db7('0x5'));var Mustache=require('mustache');var util=require(_0x6db7('0x6'));var path=require(_0x6db7('0x7'));var sox=require(_0x6db7('0x8'));var csv=require(_0x6db7('0x9'));var ejs=require(_0x6db7('0xa'));var fs=require('fs');var fs_extra=require(_0x6db7('0xb'));var _=require(_0x6db7('0xc'));var squel=require('squel');var crypto=require(_0x6db7('0xd'));var jsforce=require(_0x6db7('0xe'));var deskjs=require(_0x6db7('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6db7('0x10'));var Papa=require(_0x6db7('0x11'));var Redis=require(_0x6db7('0x12'));var authService=require(_0x6db7('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6db7('0x14'))(_0x6db7('0x15'));var utils=require(_0x6db7('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6db7('0x17'));var db=require(_0x6db7('0x18'))['db'];function respondWithStatusCode(_0xbe1d7f,_0x57891f){_0x57891f=_0x57891f||0xcc;return function(_0x1ef869){if(_0x1ef869){return _0xbe1d7f[_0x6db7('0x19')](_0x57891f);}return _0xbe1d7f[_0x6db7('0x1a')](_0x57891f)[_0x6db7('0x1b')]();};}function respondWithResult(_0xe40e8d,_0x4d4ce7){_0x4d4ce7=_0x4d4ce7||0xc8;return function(_0x4360ba){if(_0x4360ba){return _0xe40e8d[_0x6db7('0x1a')](_0x4d4ce7)['json'](_0x4360ba);}};}function respondWithFilteredResult(_0x350c8a,_0x5e5998){return function(_0x1e087e){if(_0x1e087e){var _0x277105=typeof _0x5e5998[_0x6db7('0x1c')]===_0x6db7('0x1d')&&typeof _0x5e5998[_0x6db7('0x1e')]===_0x6db7('0x1d');var _0x89d7b4=_0x1e087e[_0x6db7('0x1f')];var _0x2a3f63=_0x277105?0x0:_0x5e5998[_0x6db7('0x1c')];var _0x2e4981=_0x277105?_0x1e087e[_0x6db7('0x1f')]:_0x5e5998[_0x6db7('0x1c')]+_0x5e5998['limit'];var _0x44d458;if(_0x2e4981>=_0x89d7b4){_0x2e4981=_0x89d7b4;_0x44d458=0xc8;}else{_0x44d458=0xce;}_0x350c8a[_0x6db7('0x1a')](_0x44d458);return _0x350c8a[_0x6db7('0x20')](_0x6db7('0x21'),_0x2a3f63+'-'+_0x2e4981+'/'+_0x89d7b4)[_0x6db7('0x22')](_0x1e087e);}return null;};}function patchUpdates(_0x2592d8){return function(_0x34ee4d){try{jsonpatch['apply'](_0x34ee4d,_0x2592d8,!![]);}catch(_0x4d0696){return BPromise[_0x6db7('0x23')](_0x4d0696);}return _0x34ee4d['save']();};}function saveUpdates(_0x26b237,_0x3c5cbc){return function(_0x361e1e){if(_0x361e1e){return _0x361e1e[_0x6db7('0x24')](_0x26b237)[_0x6db7('0x25')](function(_0xcb0923){return _0xcb0923;});}return null;};}function removeEntity(_0x343b1e,_0x3c2b3a){return function(_0x48c8be){if(_0x48c8be){return _0x48c8be['destroy']()['then'](function(){var _0x591bdf=_0x48c8be[_0x6db7('0x26')]({'plain':!![]});var _0x2c9adc=_0x6db7('0x27');return db[_0x6db7('0x28')]['destroy']({'where':{'type':_0x2c9adc,'resourceId':_0x591bdf['id']}})[_0x6db7('0x25')](function(){return _0x48c8be;});})[_0x6db7('0x25')](function(){_0x343b1e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x17a19e,_0x914082){return function(_0x3a18a7){if(!_0x3a18a7){_0x17a19e[_0x6db7('0x19')](0x194);}return _0x3a18a7;};}function handleError(_0x16da7b,_0x3b4710){_0x3b4710=_0x3b4710||0x1f4;return function(_0x214bef){logger['error'](_0x214bef['stack']);if(_0x214bef[_0x6db7('0x29')]){delete _0x214bef[_0x6db7('0x29')];}_0x16da7b['status'](_0x3b4710)['send'](_0x214bef);};}exports[_0x6db7('0x2a')]=function(_0x16f54d,_0x2cb358){var _0x590bda={},_0x392c36={},_0x2ad2f4={'count':0x0,'rows':[]};var _0x62285=_[_0x6db7('0x2b')](db['Trigger'][_0x6db7('0x2c')],function(_0x29dce6){return{'name':_0x29dce6['fieldName'],'type':_0x29dce6['type'][_0x6db7('0x2d')]};});_0x392c36['model']=_[_0x6db7('0x2b')](_0x62285,'name');_0x392c36[_0x6db7('0x2e')]=_['keys'](_0x16f54d['query']);_0x392c36[_0x6db7('0x2f')]=_['intersection'](_0x392c36[_0x6db7('0x30')],_0x392c36['query']);_0x590bda[_0x6db7('0x31')]=_[_0x6db7('0x32')](_0x392c36[_0x6db7('0x30')],qs[_0x6db7('0x33')](_0x16f54d[_0x6db7('0x2e')][_0x6db7('0x33')]));_0x590bda['attributes']=_0x590bda['attributes'][_0x6db7('0x34')]?_0x590bda[_0x6db7('0x31')]:_0x392c36[_0x6db7('0x30')];if(!_0x16f54d[_0x6db7('0x2e')][_0x6db7('0x35')](_0x6db7('0x36'))){_0x590bda['limit']=qs[_0x6db7('0x1e')](_0x16f54d[_0x6db7('0x2e')][_0x6db7('0x1e')]);_0x590bda[_0x6db7('0x1c')]=qs['offset'](_0x16f54d['query']['offset']);}_0x590bda[_0x6db7('0x37')]=qs[_0x6db7('0x38')](_0x16f54d['query']['sort']);_0x590bda[_0x6db7('0x39')]=qs[_0x6db7('0x2f')](_[_0x6db7('0x3a')](_0x16f54d[_0x6db7('0x2e')],_0x392c36[_0x6db7('0x2f')]),_0x62285);if(_0x16f54d[_0x6db7('0x2e')]['filter']){_0x590bda[_0x6db7('0x39')]=_[_0x6db7('0x3b')](_0x590bda[_0x6db7('0x39')],{'$or':_['map'](_0x62285,function(_0x273c18){if(_0x273c18[_0x6db7('0x3c')]!==_0x6db7('0x3d')){var _0x44b748={};_0x44b748[_0x273c18[_0x6db7('0x29')]]={'$like':'%'+_0x16f54d[_0x6db7('0x2e')][_0x6db7('0x3e')]+'%'};return _0x44b748;}})});}_0x590bda=_[_0x6db7('0x3b')]({},_0x590bda,_0x16f54d[_0x6db7('0x3f')]);var _0x35c560={'where':_0x590bda['where']};return db[_0x6db7('0x40')][_0x6db7('0x1f')](_0x35c560)['then'](function(_0xf697ef){_0x2ad2f4[_0x6db7('0x1f')]=_0xf697ef;if(_0x16f54d[_0x6db7('0x2e')]['includeAll']){_0x590bda[_0x6db7('0x41')]=[{'all':!![]}];}return db['Trigger'][_0x6db7('0x42')](_0x590bda);})[_0x6db7('0x25')](function(_0x4e97d8){_0x2ad2f4[_0x6db7('0x43')]=_0x4e97d8;return _0x2ad2f4;})[_0x6db7('0x25')](respondWithFilteredResult(_0x2cb358,_0x590bda))[_0x6db7('0x44')](handleError(_0x2cb358,null));};exports['show']=function(_0x331ea9,_0x135692){var _0x3dd33d={'raw':![],'where':{'id':_0x331ea9[_0x6db7('0x45')]['id']}},_0x2cfd06={};_0x2cfd06[_0x6db7('0x30')]=_[_0x6db7('0x46')](db['Trigger'][_0x6db7('0x2c')]);_0x2cfd06[_0x6db7('0x2e')]=_['keys'](_0x331ea9['query']);_0x2cfd06[_0x6db7('0x2f')]=_[_0x6db7('0x32')](_0x2cfd06[_0x6db7('0x30')],_0x2cfd06[_0x6db7('0x2e')]);_0x3dd33d['attributes']=_['intersection'](_0x2cfd06[_0x6db7('0x30')],qs['fields'](_0x331ea9['query'][_0x6db7('0x33')]));_0x3dd33d['attributes']=_0x3dd33d[_0x6db7('0x31')]['length']?_0x3dd33d['attributes']:_0x2cfd06['model'];if(_0x331ea9[_0x6db7('0x2e')][_0x6db7('0x47')]){_0x3dd33d[_0x6db7('0x41')]=[{'all':!![]}];}_0x3dd33d=_['merge']({},_0x3dd33d,_0x331ea9[_0x6db7('0x3f')]);return db[_0x6db7('0x40')]['find'](_0x3dd33d)[_0x6db7('0x25')](handleEntityNotFound(_0x135692,null))[_0x6db7('0x25')](respondWithResult(_0x135692,null))[_0x6db7('0x44')](handleError(_0x135692,null));};exports['create']=function(_0x20edb6,_0x189bdb){return db[_0x6db7('0x40')][_0x6db7('0x48')](_0x20edb6[_0x6db7('0x49')],{})[_0x6db7('0x25')](function(_0xfff5fd){var _0x2be6dc=_0x20edb6[_0x6db7('0x4a')]['get']({'plain':!![]});if(!_0x2be6dc)throw new Error(_0x6db7('0x4b'));if(_0x2be6dc['role']===_0x6db7('0x4a')){var _0x220053=_0xfff5fd[_0x6db7('0x26')]({'plain':!![]});var _0x15e088=_0x6db7('0x27');return db['UserProfileSection'][_0x6db7('0x4c')]({'where':{'name':_0x15e088,'userProfileId':_0x2be6dc[_0x6db7('0x4d')]},'raw':!![]})[_0x6db7('0x25')](function(_0x4f89ea){if(_0x4f89ea&&_0x4f89ea[_0x6db7('0x4e')]===0x0){return db[_0x6db7('0x28')][_0x6db7('0x48')]({'name':_0x220053['name'],'resourceId':_0x220053['id'],'type':_0x4f89ea['name'],'sectionId':_0x4f89ea['id']},{})[_0x6db7('0x25')](function(){return _0xfff5fd;});}else{return _0xfff5fd;}})[_0x6db7('0x44')](function(_0x188680){logger[_0x6db7('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x188680);throw _0x188680;});}return _0xfff5fd;})['then'](respondWithResult(_0x189bdb,0xc9))[_0x6db7('0x44')](handleError(_0x189bdb,null));};exports[_0x6db7('0x24')]=function(_0x534aba,_0x1215a2){if(_0x534aba[_0x6db7('0x49')]['id']){delete _0x534aba[_0x6db7('0x49')]['id'];}return db[_0x6db7('0x40')][_0x6db7('0x4c')]({'where':{'id':_0x534aba[_0x6db7('0x45')]['id']}})[_0x6db7('0x25')](handleEntityNotFound(_0x1215a2,null))[_0x6db7('0x25')](saveUpdates(_0x534aba[_0x6db7('0x49')],null))[_0x6db7('0x25')](respondWithResult(_0x1215a2,null))[_0x6db7('0x44')](handleError(_0x1215a2,null));};exports[_0x6db7('0x50')]=function(_0x5e1154,_0x21a11e){return db[_0x6db7('0x40')][_0x6db7('0x4c')]({'where':{'id':_0x5e1154[_0x6db7('0x45')]['id']}})[_0x6db7('0x25')](handleEntityNotFound(_0x21a11e,null))['then'](removeEntity(_0x21a11e,null))[_0x6db7('0x44')](handleError(_0x21a11e,null));};exports[_0x6db7('0x51')]=function(_0x47c33a,_0x4a674b,_0x59ca63){if(_0x47c33a[_0x6db7('0x49')]['id']){delete _0x47c33a[_0x6db7('0x49')]['id'];}return db[_0x6db7('0x40')][_0x6db7('0x4c')]({'where':{'id':_0x47c33a['params']['id']}})[_0x6db7('0x25')](handleEntityNotFound(_0x4a674b,null))[_0x6db7('0x25')](function(_0x27090e){if(_0x27090e){_0x47c33a[_0x6db7('0x49')][_0x6db7('0x52')]=_0x27090e['id'];return db[_0x6db7('0x53')][_0x6db7('0x48')](_0x47c33a['body']);}})['then'](respondWithResult(_0x4a674b,null))[_0x6db7('0x44')](handleError(_0x4a674b,null));};exports[_0x6db7('0x54')]=function(_0x35deb0,_0xb4b435,_0x2ee20c){if(_0x35deb0[_0x6db7('0x49')]['id']){delete _0x35deb0['body']['id'];}return db[_0x6db7('0x40')][_0x6db7('0x4c')]({'where':{'id':_0x35deb0['params']['id']}})[_0x6db7('0x25')](handleEntityNotFound(_0xb4b435,null))[_0x6db7('0x25')](function(_0x18aa52){if(_0x18aa52){_0x35deb0[_0x6db7('0x49')]['TriggerAnyId']=_0x18aa52['id'];return db[_0x6db7('0x53')][_0x6db7('0x48')](_0x35deb0[_0x6db7('0x49')]);}})[_0x6db7('0x25')](respondWithResult(_0xb4b435,null))[_0x6db7('0x44')](handleError(_0xb4b435,null));};exports[_0x6db7('0x55')]=function(_0x21e635,_0x2e5d40,_0x5d41bd){var _0x2fe318={};var _0x5cd098={};var _0x4ef810;var _0x1038a6;return db[_0x6db7('0x40')][_0x6db7('0x56')]({'where':{'id':_0x21e635['params']['id']}})[_0x6db7('0x25')](handleEntityNotFound(_0x2e5d40,null))['then'](function(_0x5f26a1){if(_0x5f26a1){_0x4ef810=_0x5f26a1;_0x5cd098[_0x6db7('0x30')]=_[_0x6db7('0x46')](db[_0x6db7('0x53')][_0x6db7('0x2c')]);_0x5cd098[_0x6db7('0x2e')]=_[_0x6db7('0x46')](_0x21e635[_0x6db7('0x2e')]);_0x5cd098[_0x6db7('0x2f')]=_['intersection'](_0x5cd098[_0x6db7('0x30')],_0x5cd098[_0x6db7('0x2e')]);_0x2fe318[_0x6db7('0x31')]=_[_0x6db7('0x32')](_0x5cd098[_0x6db7('0x30')],qs['fields'](_0x21e635[_0x6db7('0x2e')][_0x6db7('0x33')]));_0x2fe318[_0x6db7('0x31')]=_0x2fe318[_0x6db7('0x31')]['length']?_0x2fe318[_0x6db7('0x31')]:_0x5cd098[_0x6db7('0x30')];_0x2fe318['order']=qs[_0x6db7('0x38')](_0x21e635[_0x6db7('0x2e')]['sort']);_0x2fe318[_0x6db7('0x39')]=qs['filters'](_[_0x6db7('0x3a')](_0x21e635['query'],_0x5cd098[_0x6db7('0x2f')]));if(_0x21e635[_0x6db7('0x2e')]['filter']){_0x2fe318['where']=_[_0x6db7('0x3b')](_0x2fe318[_0x6db7('0x39')],{'$or':_[_0x6db7('0x2b')](_0x2fe318[_0x6db7('0x31')],function(_0x2e9beb){var _0x246b83={};_0x246b83[_0x2e9beb]={'$like':'%'+_0x21e635[_0x6db7('0x2e')][_0x6db7('0x3e')]+'%'};return _0x246b83;})});}_0x2fe318=_[_0x6db7('0x3b')]({},_0x2fe318,_0x21e635[_0x6db7('0x3f')]);return _0x4ef810[_0x6db7('0x55')](_0x2fe318);}})[_0x6db7('0x25')](function(_0x142406){if(_0x142406){_0x1038a6=_0x142406['length'];if(!_0x21e635[_0x6db7('0x2e')][_0x6db7('0x35')](_0x6db7('0x36'))){_0x2fe318[_0x6db7('0x1e')]=qs[_0x6db7('0x1e')](_0x21e635[_0x6db7('0x2e')][_0x6db7('0x1e')]);_0x2fe318[_0x6db7('0x1c')]=qs[_0x6db7('0x1c')](_0x21e635['query']['offset']);}return _0x4ef810[_0x6db7('0x55')](_0x2fe318);}})['then'](function(_0x1579e8){if(_0x1579e8){return _0x1579e8?{'count':_0x1038a6,'rows':_0x1579e8}:null;}})['then'](respondWithResult(_0x2e5d40,null))[_0x6db7('0x44')](handleError(_0x2e5d40,null));};exports[_0x6db7('0x57')]=function(_0xd663a,_0xf78a4a,_0x5195ae){var _0x39b4d0={};var _0x53d41b={};var _0x5ae25f;var _0x35d64d;return db['Trigger'][_0x6db7('0x56')]({'where':{'id':_0xd663a[_0x6db7('0x45')]['id']}})[_0x6db7('0x25')](handleEntityNotFound(_0xf78a4a,null))[_0x6db7('0x25')](function(_0x472f1c){if(_0x472f1c){_0x5ae25f=_0x472f1c;_0x53d41b['model']=_[_0x6db7('0x46')](db[_0x6db7('0x53')][_0x6db7('0x2c')]);_0x53d41b[_0x6db7('0x2e')]=_['keys'](_0xd663a['query']);_0x53d41b['filters']=_['intersection'](_0x53d41b['model'],_0x53d41b['query']);_0x39b4d0['attributes']=_[_0x6db7('0x32')](_0x53d41b[_0x6db7('0x30')],qs[_0x6db7('0x33')](_0xd663a['query']['fields']));_0x39b4d0[_0x6db7('0x31')]=_0x39b4d0[_0x6db7('0x31')][_0x6db7('0x34')]?_0x39b4d0[_0x6db7('0x31')]:_0x53d41b['model'];_0x39b4d0[_0x6db7('0x37')]=qs[_0x6db7('0x38')](_0xd663a[_0x6db7('0x2e')][_0x6db7('0x38')]);_0x39b4d0[_0x6db7('0x39')]=qs[_0x6db7('0x2f')](_['pick'](_0xd663a['query'],_0x53d41b[_0x6db7('0x2f')]));if(_0xd663a[_0x6db7('0x2e')]['filter']){_0x39b4d0[_0x6db7('0x39')]=_[_0x6db7('0x3b')](_0x39b4d0[_0x6db7('0x39')],{'$or':_[_0x6db7('0x2b')](_0x39b4d0[_0x6db7('0x31')],function(_0x4651c2){var _0x2212e8={};_0x2212e8[_0x4651c2]={'$like':'%'+_0xd663a[_0x6db7('0x2e')][_0x6db7('0x3e')]+'%'};return _0x2212e8;})});}_0x39b4d0=_[_0x6db7('0x3b')]({},_0x39b4d0,_0xd663a[_0x6db7('0x3f')]);return _0x5ae25f[_0x6db7('0x57')](_0x39b4d0);}})[_0x6db7('0x25')](function(_0x522e14){if(_0x522e14){_0x35d64d=_0x522e14[_0x6db7('0x34')];if(!_0xd663a[_0x6db7('0x2e')][_0x6db7('0x35')]('nolimit')){_0x39b4d0[_0x6db7('0x1e')]=qs['limit'](_0xd663a[_0x6db7('0x2e')][_0x6db7('0x1e')]);_0x39b4d0[_0x6db7('0x1c')]=qs[_0x6db7('0x1c')](_0xd663a[_0x6db7('0x2e')]['offset']);}return _0x5ae25f['getAnyConditions'](_0x39b4d0);}})[_0x6db7('0x25')](function(_0x16fd3a){if(_0x16fd3a){return _0x16fd3a?{'count':_0x35d64d,'rows':_0x16fd3a}:null;}})['then'](respondWithResult(_0xf78a4a,null))[_0x6db7('0x44')](handleError(_0xf78a4a,null));};exports['addAction']=function(_0x4ded51,_0x51e38b,_0x198733){if(_0x4ded51[_0x6db7('0x49')]['id']){delete _0x4ded51['body']['id'];}return db[_0x6db7('0x40')]['find']({'where':{'id':_0x4ded51[_0x6db7('0x45')]['id']}})[_0x6db7('0x25')](handleEntityNotFound(_0x51e38b,null))[_0x6db7('0x25')](function(_0x180c0c){if(_0x180c0c){_0x4ded51[_0x6db7('0x49')]['TriggerId']=_0x180c0c['id'];return db[_0x6db7('0x58')][_0x6db7('0x48')](_0x4ded51['body']);}})[_0x6db7('0x25')](respondWithResult(_0x51e38b,null))['catch'](handleError(_0x51e38b,null));};exports[_0x6db7('0x59')]=function(_0x2760b4,_0x37fbaf,_0x250b2a){var _0x241f16={};var _0x352750={};var _0x4227de;var _0x429772;return db[_0x6db7('0x40')][_0x6db7('0x56')]({'where':{'id':_0x2760b4[_0x6db7('0x45')]['id']}})[_0x6db7('0x25')](handleEntityNotFound(_0x37fbaf,null))[_0x6db7('0x25')](function(_0x2e47c0){if(_0x2e47c0){_0x4227de=_0x2e47c0;_0x352750[_0x6db7('0x30')]=_[_0x6db7('0x46')](db[_0x6db7('0x58')][_0x6db7('0x2c')]);_0x352750['query']=_['keys'](_0x2760b4[_0x6db7('0x2e')]);_0x352750[_0x6db7('0x2f')]=_['intersection'](_0x352750[_0x6db7('0x30')],_0x352750[_0x6db7('0x2e')]);_0x241f16[_0x6db7('0x31')]=_['intersection'](_0x352750['model'],qs[_0x6db7('0x33')](_0x2760b4[_0x6db7('0x2e')][_0x6db7('0x33')]));_0x241f16['attributes']=_0x241f16[_0x6db7('0x31')][_0x6db7('0x34')]?_0x241f16[_0x6db7('0x31')]:_0x352750[_0x6db7('0x30')];_0x241f16[_0x6db7('0x37')]=qs['sort'](_0x2760b4[_0x6db7('0x2e')]['sort']);_0x241f16[_0x6db7('0x39')]=qs[_0x6db7('0x2f')](_[_0x6db7('0x3a')](_0x2760b4[_0x6db7('0x2e')],_0x352750[_0x6db7('0x2f')]));if(_0x2760b4[_0x6db7('0x2e')][_0x6db7('0x3e')]){_0x241f16[_0x6db7('0x39')]=_[_0x6db7('0x3b')](_0x241f16[_0x6db7('0x39')],{'$or':_['map'](_0x241f16['attributes'],function(_0x1aa853){var _0x2bf58c={};_0x2bf58c[_0x1aa853]={'$like':'%'+_0x2760b4[_0x6db7('0x2e')]['filter']+'%'};return _0x2bf58c;})});}_0x241f16=_['merge']({},_0x241f16,_0x2760b4['options']);return _0x4227de[_0x6db7('0x59')](_0x241f16);}})[_0x6db7('0x25')](function(_0x1de217){if(_0x1de217){_0x429772=_0x1de217['length'];if(!_0x2760b4[_0x6db7('0x2e')]['hasOwnProperty'](_0x6db7('0x36'))){_0x241f16[_0x6db7('0x1e')]=qs[_0x6db7('0x1e')](_0x2760b4[_0x6db7('0x2e')][_0x6db7('0x1e')]);_0x241f16[_0x6db7('0x1c')]=qs[_0x6db7('0x1c')](_0x2760b4[_0x6db7('0x2e')][_0x6db7('0x1c')]);}return _0x4227de['getActions'](_0x241f16);}})['then'](function(_0x262188){if(_0x262188){return _0x262188?{'count':_0x429772,'rows':_0x262188}:null;}})[_0x6db7('0x25')](respondWithResult(_0x37fbaf,null))['catch'](handleError(_0x37fbaf,null));}; \ No newline at end of file +var _0xf642=['get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Triggers','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','findOne','order','getAllConditions','getAnyConditions','addAction','TriggerId','Action','getActions','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','Trigger','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','length','find','create','body','user'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xf642,0x1f1));var _0x2f64=function(_0x13b7fd,_0x4eaf7f){_0x13b7fd=_0x13b7fd-0x0;var _0x32a74a=_0xf642[_0x13b7fd];return _0x32a74a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2f64('0x0'));var zipdir=require(_0x2f64('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2f64('0x2'));var moment=require('moment');var BPromise=require(_0x2f64('0x3'));var Mustache=require(_0x2f64('0x4'));var util=require(_0x2f64('0x5'));var path=require(_0x2f64('0x6'));var sox=require(_0x2f64('0x7'));var csv=require(_0x2f64('0x8'));var ejs=require(_0x2f64('0x9'));var fs=require('fs');var fs_extra=require(_0x2f64('0xa'));var _=require('lodash');var squel=require(_0x2f64('0xb'));var crypto=require(_0x2f64('0xc'));var jsforce=require(_0x2f64('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2f64('0xe'));var Papa=require('papaparse');var Redis=require(_0x2f64('0xf'));var authService=require(_0x2f64('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2f64('0x11'));var logger=require(_0x2f64('0x12'))(_0x2f64('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2f64('0x14'))['db'];function respondWithStatusCode(_0x1fa88a,_0xbc94e){_0xbc94e=_0xbc94e||0xcc;return function(_0x9609ad){if(_0x9609ad){return _0x1fa88a['sendStatus'](_0xbc94e);}return _0x1fa88a[_0x2f64('0x15')](_0xbc94e)[_0x2f64('0x16')]();};}function respondWithResult(_0x2863e9,_0x3b854d){_0x3b854d=_0x3b854d||0xc8;return function(_0x21a223){if(_0x21a223){return _0x2863e9[_0x2f64('0x15')](_0x3b854d)[_0x2f64('0x17')](_0x21a223);}};}function respondWithFilteredResult(_0x335e86,_0x3d314f){return function(_0x183bc5){if(_0x183bc5){var _0x273012=typeof _0x3d314f[_0x2f64('0x18')]===_0x2f64('0x19')&&typeof _0x3d314f[_0x2f64('0x1a')]==='undefined';var _0x312f72=_0x183bc5[_0x2f64('0x1b')];var _0x31fa9f=_0x273012?0x0:_0x3d314f['offset'];var _0x5125ec=_0x273012?_0x183bc5[_0x2f64('0x1b')]:_0x3d314f[_0x2f64('0x18')]+_0x3d314f[_0x2f64('0x1a')];var _0x37ad45;if(_0x5125ec>=_0x312f72){_0x5125ec=_0x312f72;_0x37ad45=0xc8;}else{_0x37ad45=0xce;}_0x335e86[_0x2f64('0x15')](_0x37ad45);return _0x335e86[_0x2f64('0x1c')](_0x2f64('0x1d'),_0x31fa9f+'-'+_0x5125ec+'/'+_0x312f72)[_0x2f64('0x17')](_0x183bc5);}return null;};}function patchUpdates(_0x2b250f){return function(_0x2645f5){try{jsonpatch[_0x2f64('0x1e')](_0x2645f5,_0x2b250f,!![]);}catch(_0x3677f1){return BPromise[_0x2f64('0x1f')](_0x3677f1);}return _0x2645f5[_0x2f64('0x20')]();};}function saveUpdates(_0x33efdb,_0x15a771){return function(_0x775205){if(_0x775205){return _0x775205[_0x2f64('0x21')](_0x33efdb)['then'](function(_0x266bde){return _0x266bde;});}return null;};}function removeEntity(_0x5e2f1a,_0x1134cd){return function(_0x391dfd){if(_0x391dfd){return _0x391dfd[_0x2f64('0x22')]()[_0x2f64('0x23')](function(){var _0x22caf9=_0x391dfd['get']({'plain':!![]});var _0x531fb3='Triggers';return db['UserProfileResource'][_0x2f64('0x22')]({'where':{'type':_0x531fb3,'resourceId':_0x22caf9['id']}})[_0x2f64('0x23')](function(){return _0x391dfd;});})[_0x2f64('0x23')](function(){_0x5e2f1a[_0x2f64('0x15')](0xcc)[_0x2f64('0x16')]();});}};}function handleEntityNotFound(_0x14e31f,_0x59b32d){return function(_0x4396f5){if(!_0x4396f5){_0x14e31f[_0x2f64('0x24')](0x194);}return _0x4396f5;};}function handleError(_0x1222c2,_0x217dcf){_0x217dcf=_0x217dcf||0x1f4;return function(_0x49ae3a){logger[_0x2f64('0x25')](_0x49ae3a[_0x2f64('0x26')]);if(_0x49ae3a[_0x2f64('0x27')]){delete _0x49ae3a['name'];}_0x1222c2['status'](_0x217dcf)[_0x2f64('0x28')](_0x49ae3a);};}exports['index']=function(_0x4a1be8,_0x1c39cb){var _0x417949={},_0x5ab2cf={},_0x23a793={'count':0x0,'rows':[]};var _0x252817=_['map'](db[_0x2f64('0x29')][_0x2f64('0x2a')],function(_0x304de5){return{'name':_0x304de5[_0x2f64('0x2b')],'type':_0x304de5[_0x2f64('0x2c')][_0x2f64('0x2d')]};});_0x5ab2cf[_0x2f64('0x2e')]=_[_0x2f64('0x2f')](_0x252817,_0x2f64('0x27'));_0x5ab2cf[_0x2f64('0x30')]=_[_0x2f64('0x31')](_0x4a1be8[_0x2f64('0x30')]);_0x5ab2cf['filters']=_['intersection'](_0x5ab2cf['model'],_0x5ab2cf['query']);_0x417949[_0x2f64('0x32')]=_[_0x2f64('0x33')](_0x5ab2cf['model'],qs[_0x2f64('0x34')](_0x4a1be8['query'][_0x2f64('0x34')]));_0x417949[_0x2f64('0x32')]=_0x417949[_0x2f64('0x32')]['length']?_0x417949['attributes']:_0x5ab2cf['model'];if(!_0x4a1be8['query'][_0x2f64('0x35')](_0x2f64('0x36'))){_0x417949[_0x2f64('0x1a')]=qs[_0x2f64('0x1a')](_0x4a1be8[_0x2f64('0x30')]['limit']);_0x417949[_0x2f64('0x18')]=qs['offset'](_0x4a1be8[_0x2f64('0x30')][_0x2f64('0x18')]);}_0x417949['order']=qs[_0x2f64('0x37')](_0x4a1be8[_0x2f64('0x30')][_0x2f64('0x37')]);_0x417949[_0x2f64('0x38')]=qs[_0x2f64('0x39')](_[_0x2f64('0x3a')](_0x4a1be8['query'],_0x5ab2cf[_0x2f64('0x39')]),_0x252817);if(_0x4a1be8[_0x2f64('0x30')][_0x2f64('0x3b')]){_0x417949[_0x2f64('0x38')]=_[_0x2f64('0x3c')](_0x417949[_0x2f64('0x38')],{'$or':_[_0x2f64('0x2f')](_0x252817,function(_0xe63648){if(_0xe63648['type']!==_0x2f64('0x3d')){var _0x308e99={};_0x308e99[_0xe63648[_0x2f64('0x27')]]={'$like':'%'+_0x4a1be8[_0x2f64('0x30')][_0x2f64('0x3b')]+'%'};return _0x308e99;}})});}_0x417949=_[_0x2f64('0x3c')]({},_0x417949,_0x4a1be8[_0x2f64('0x3e')]);var _0x5c7f9a={'where':_0x417949[_0x2f64('0x38')]};return db[_0x2f64('0x29')][_0x2f64('0x1b')](_0x5c7f9a)['then'](function(_0x4c95af){_0x23a793[_0x2f64('0x1b')]=_0x4c95af;if(_0x4a1be8[_0x2f64('0x30')][_0x2f64('0x3f')]){_0x417949[_0x2f64('0x40')]=[{'all':!![]}];}return db['Trigger'][_0x2f64('0x41')](_0x417949);})['then'](function(_0xc7ac6a){_0x23a793['rows']=_0xc7ac6a;return _0x23a793;})[_0x2f64('0x23')](respondWithFilteredResult(_0x1c39cb,_0x417949))[_0x2f64('0x42')](handleError(_0x1c39cb,null));};exports[_0x2f64('0x43')]=function(_0xab3db7,_0x26cd74){var _0x40341a={'raw':![],'where':{'id':_0xab3db7['params']['id']}},_0x362264={};_0x362264[_0x2f64('0x2e')]=_[_0x2f64('0x31')](db[_0x2f64('0x29')]['rawAttributes']);_0x362264[_0x2f64('0x30')]=_[_0x2f64('0x31')](_0xab3db7['query']);_0x362264[_0x2f64('0x39')]=_['intersection'](_0x362264['model'],_0x362264[_0x2f64('0x30')]);_0x40341a['attributes']=_[_0x2f64('0x33')](_0x362264[_0x2f64('0x2e')],qs[_0x2f64('0x34')](_0xab3db7[_0x2f64('0x30')]['fields']));_0x40341a['attributes']=_0x40341a[_0x2f64('0x32')][_0x2f64('0x44')]?_0x40341a['attributes']:_0x362264['model'];if(_0xab3db7[_0x2f64('0x30')][_0x2f64('0x3f')]){_0x40341a[_0x2f64('0x40')]=[{'all':!![]}];}_0x40341a=_[_0x2f64('0x3c')]({},_0x40341a,_0xab3db7['options']);return db[_0x2f64('0x29')][_0x2f64('0x45')](_0x40341a)[_0x2f64('0x23')](handleEntityNotFound(_0x26cd74,null))[_0x2f64('0x23')](respondWithResult(_0x26cd74,null))[_0x2f64('0x42')](handleError(_0x26cd74,null));};exports['create']=function(_0x364f1d,_0x36bbb5){return db[_0x2f64('0x29')][_0x2f64('0x46')](_0x364f1d[_0x2f64('0x47')],{})['then'](function(_0xae2787){var _0x1d1181=_0x364f1d[_0x2f64('0x48')][_0x2f64('0x49')]({'plain':!![]});if(!_0x1d1181)throw new Error(_0x2f64('0x4a'));if(_0x1d1181['role']==='user'){var _0x308dd9=_0xae2787[_0x2f64('0x49')]({'plain':!![]});var _0x3e1473=_0x2f64('0x4b');return db[_0x2f64('0x4c')][_0x2f64('0x45')]({'where':{'name':_0x3e1473,'userProfileId':_0x1d1181[_0x2f64('0x4d')]},'raw':!![]})[_0x2f64('0x23')](function(_0x1834d3){if(_0x1834d3&&_0x1834d3[_0x2f64('0x4e')]===0x0){return db[_0x2f64('0x4f')][_0x2f64('0x46')]({'name':_0x308dd9[_0x2f64('0x27')],'resourceId':_0x308dd9['id'],'type':_0x1834d3[_0x2f64('0x27')],'sectionId':_0x1834d3['id']},{})['then'](function(){return _0xae2787;});}else{return _0xae2787;}})[_0x2f64('0x42')](function(_0x2971e4){logger[_0x2f64('0x25')](_0x2f64('0x50'),_0x2971e4);throw _0x2971e4;});}return _0xae2787;})[_0x2f64('0x23')](respondWithResult(_0x36bbb5,0xc9))[_0x2f64('0x42')](handleError(_0x36bbb5,null));};exports[_0x2f64('0x21')]=function(_0x30a905,_0xa13c82){if(_0x30a905[_0x2f64('0x47')]['id']){delete _0x30a905[_0x2f64('0x47')]['id'];}return db[_0x2f64('0x29')][_0x2f64('0x45')]({'where':{'id':_0x30a905[_0x2f64('0x51')]['id']}})[_0x2f64('0x23')](handleEntityNotFound(_0xa13c82,null))['then'](saveUpdates(_0x30a905[_0x2f64('0x47')],null))[_0x2f64('0x23')](respondWithResult(_0xa13c82,null))[_0x2f64('0x42')](handleError(_0xa13c82,null));};exports[_0x2f64('0x22')]=function(_0x3ea854,_0x868cc8){return db[_0x2f64('0x29')][_0x2f64('0x45')]({'where':{'id':_0x3ea854['params']['id']}})['then'](handleEntityNotFound(_0x868cc8,null))[_0x2f64('0x23')](removeEntity(_0x868cc8,null))['catch'](handleError(_0x868cc8,null));};exports[_0x2f64('0x52')]=function(_0x395e8f,_0x19f6e5,_0x38b17d){if(_0x395e8f[_0x2f64('0x47')]['id']){delete _0x395e8f[_0x2f64('0x47')]['id'];}return db[_0x2f64('0x29')]['find']({'where':{'id':_0x395e8f[_0x2f64('0x51')]['id']}})[_0x2f64('0x23')](handleEntityNotFound(_0x19f6e5,null))[_0x2f64('0x23')](function(_0x1754f8){if(_0x1754f8){_0x395e8f[_0x2f64('0x47')][_0x2f64('0x53')]=_0x1754f8['id'];return db[_0x2f64('0x54')][_0x2f64('0x46')](_0x395e8f[_0x2f64('0x47')]);}})[_0x2f64('0x23')](respondWithResult(_0x19f6e5,null))['catch'](handleError(_0x19f6e5,null));};exports[_0x2f64('0x55')]=function(_0x1a333b,_0x24f903,_0x4d52ed){if(_0x1a333b[_0x2f64('0x47')]['id']){delete _0x1a333b[_0x2f64('0x47')]['id'];}return db[_0x2f64('0x29')][_0x2f64('0x45')]({'where':{'id':_0x1a333b['params']['id']}})['then'](handleEntityNotFound(_0x24f903,null))[_0x2f64('0x23')](function(_0x2292a2){if(_0x2292a2){_0x1a333b['body'][_0x2f64('0x56')]=_0x2292a2['id'];return db['Condition'][_0x2f64('0x46')](_0x1a333b['body']);}})[_0x2f64('0x23')](respondWithResult(_0x24f903,null))[_0x2f64('0x42')](handleError(_0x24f903,null));};exports['getAllConditions']=function(_0x29e50,_0x5f5038,_0x118ab4){var _0xe19772={};var _0x576115={};var _0x2166ec;var _0x23e408;return db[_0x2f64('0x29')][_0x2f64('0x57')]({'where':{'id':_0x29e50[_0x2f64('0x51')]['id']}})[_0x2f64('0x23')](handleEntityNotFound(_0x5f5038,null))['then'](function(_0x5b55fe){if(_0x5b55fe){_0x2166ec=_0x5b55fe;_0x576115['model']=_[_0x2f64('0x31')](db[_0x2f64('0x54')][_0x2f64('0x2a')]);_0x576115['query']=_['keys'](_0x29e50[_0x2f64('0x30')]);_0x576115[_0x2f64('0x39')]=_[_0x2f64('0x33')](_0x576115['model'],_0x576115[_0x2f64('0x30')]);_0xe19772[_0x2f64('0x32')]=_[_0x2f64('0x33')](_0x576115['model'],qs[_0x2f64('0x34')](_0x29e50[_0x2f64('0x30')]['fields']));_0xe19772[_0x2f64('0x32')]=_0xe19772[_0x2f64('0x32')][_0x2f64('0x44')]?_0xe19772['attributes']:_0x576115['model'];_0xe19772[_0x2f64('0x58')]=qs['sort'](_0x29e50['query'][_0x2f64('0x37')]);_0xe19772['where']=qs['filters'](_[_0x2f64('0x3a')](_0x29e50[_0x2f64('0x30')],_0x576115['filters']));if(_0x29e50[_0x2f64('0x30')]['filter']){_0xe19772['where']=_[_0x2f64('0x3c')](_0xe19772[_0x2f64('0x38')],{'$or':_[_0x2f64('0x2f')](_0xe19772[_0x2f64('0x32')],function(_0x116df8){var _0x4958c8={};_0x4958c8[_0x116df8]={'$like':'%'+_0x29e50['query']['filter']+'%'};return _0x4958c8;})});}_0xe19772=_[_0x2f64('0x3c')]({},_0xe19772,_0x29e50[_0x2f64('0x3e')]);return _0x2166ec[_0x2f64('0x59')](_0xe19772);}})[_0x2f64('0x23')](function(_0x1ac2a6){if(_0x1ac2a6){_0x23e408=_0x1ac2a6[_0x2f64('0x44')];if(!_0x29e50[_0x2f64('0x30')][_0x2f64('0x35')](_0x2f64('0x36'))){_0xe19772[_0x2f64('0x1a')]=qs[_0x2f64('0x1a')](_0x29e50['query'][_0x2f64('0x1a')]);_0xe19772[_0x2f64('0x18')]=qs['offset'](_0x29e50[_0x2f64('0x30')][_0x2f64('0x18')]);}return _0x2166ec[_0x2f64('0x59')](_0xe19772);}})[_0x2f64('0x23')](function(_0x215efc){if(_0x215efc){return _0x215efc?{'count':_0x23e408,'rows':_0x215efc}:null;}})[_0x2f64('0x23')](respondWithResult(_0x5f5038,null))[_0x2f64('0x42')](handleError(_0x5f5038,null));};exports['getAnyConditions']=function(_0x454962,_0x3b10e1,_0x3bb8cf){var _0x4e7879={};var _0x388974={};var _0x1cba82;var _0x566ba0;return db[_0x2f64('0x29')][_0x2f64('0x57')]({'where':{'id':_0x454962[_0x2f64('0x51')]['id']}})[_0x2f64('0x23')](handleEntityNotFound(_0x3b10e1,null))[_0x2f64('0x23')](function(_0x2110f8){if(_0x2110f8){_0x1cba82=_0x2110f8;_0x388974[_0x2f64('0x2e')]=_[_0x2f64('0x31')](db[_0x2f64('0x54')][_0x2f64('0x2a')]);_0x388974['query']=_[_0x2f64('0x31')](_0x454962['query']);_0x388974[_0x2f64('0x39')]=_[_0x2f64('0x33')](_0x388974[_0x2f64('0x2e')],_0x388974[_0x2f64('0x30')]);_0x4e7879[_0x2f64('0x32')]=_['intersection'](_0x388974[_0x2f64('0x2e')],qs['fields'](_0x454962[_0x2f64('0x30')]['fields']));_0x4e7879['attributes']=_0x4e7879['attributes'][_0x2f64('0x44')]?_0x4e7879[_0x2f64('0x32')]:_0x388974[_0x2f64('0x2e')];_0x4e7879[_0x2f64('0x58')]=qs[_0x2f64('0x37')](_0x454962[_0x2f64('0x30')][_0x2f64('0x37')]);_0x4e7879['where']=qs['filters'](_[_0x2f64('0x3a')](_0x454962['query'],_0x388974[_0x2f64('0x39')]));if(_0x454962[_0x2f64('0x30')][_0x2f64('0x3b')]){_0x4e7879[_0x2f64('0x38')]=_[_0x2f64('0x3c')](_0x4e7879[_0x2f64('0x38')],{'$or':_[_0x2f64('0x2f')](_0x4e7879[_0x2f64('0x32')],function(_0x565b17){var _0x344e49={};_0x344e49[_0x565b17]={'$like':'%'+_0x454962['query'][_0x2f64('0x3b')]+'%'};return _0x344e49;})});}_0x4e7879=_['merge']({},_0x4e7879,_0x454962[_0x2f64('0x3e')]);return _0x1cba82[_0x2f64('0x5a')](_0x4e7879);}})[_0x2f64('0x23')](function(_0x1e51f3){if(_0x1e51f3){_0x566ba0=_0x1e51f3[_0x2f64('0x44')];if(!_0x454962[_0x2f64('0x30')][_0x2f64('0x35')](_0x2f64('0x36'))){_0x4e7879[_0x2f64('0x1a')]=qs[_0x2f64('0x1a')](_0x454962[_0x2f64('0x30')][_0x2f64('0x1a')]);_0x4e7879[_0x2f64('0x18')]=qs[_0x2f64('0x18')](_0x454962['query']['offset']);}return _0x1cba82[_0x2f64('0x5a')](_0x4e7879);}})[_0x2f64('0x23')](function(_0x260aee){if(_0x260aee){return _0x260aee?{'count':_0x566ba0,'rows':_0x260aee}:null;}})[_0x2f64('0x23')](respondWithResult(_0x3b10e1,null))[_0x2f64('0x42')](handleError(_0x3b10e1,null));};exports[_0x2f64('0x5b')]=function(_0x5becc9,_0xa7bc77,_0x546e95){if(_0x5becc9[_0x2f64('0x47')]['id']){delete _0x5becc9[_0x2f64('0x47')]['id'];}return db[_0x2f64('0x29')]['find']({'where':{'id':_0x5becc9[_0x2f64('0x51')]['id']}})[_0x2f64('0x23')](handleEntityNotFound(_0xa7bc77,null))[_0x2f64('0x23')](function(_0x3d8ab0){if(_0x3d8ab0){_0x5becc9['body'][_0x2f64('0x5c')]=_0x3d8ab0['id'];return db['Action'][_0x2f64('0x46')](_0x5becc9[_0x2f64('0x47')]);}})['then'](respondWithResult(_0xa7bc77,null))[_0x2f64('0x42')](handleError(_0xa7bc77,null));};exports['getActions']=function(_0x717ae9,_0x2b9de2,_0x55569d){var _0x57bbaa={};var _0x3f595f={};var _0x47751b;var _0x34a9c7;return db[_0x2f64('0x29')]['findOne']({'where':{'id':_0x717ae9[_0x2f64('0x51')]['id']}})['then'](handleEntityNotFound(_0x2b9de2,null))['then'](function(_0x25a520){if(_0x25a520){_0x47751b=_0x25a520;_0x3f595f[_0x2f64('0x2e')]=_[_0x2f64('0x31')](db[_0x2f64('0x5d')][_0x2f64('0x2a')]);_0x3f595f[_0x2f64('0x30')]=_[_0x2f64('0x31')](_0x717ae9['query']);_0x3f595f[_0x2f64('0x39')]=_['intersection'](_0x3f595f[_0x2f64('0x2e')],_0x3f595f[_0x2f64('0x30')]);_0x57bbaa[_0x2f64('0x32')]=_[_0x2f64('0x33')](_0x3f595f[_0x2f64('0x2e')],qs['fields'](_0x717ae9['query'][_0x2f64('0x34')]));_0x57bbaa['attributes']=_0x57bbaa[_0x2f64('0x32')][_0x2f64('0x44')]?_0x57bbaa[_0x2f64('0x32')]:_0x3f595f['model'];_0x57bbaa[_0x2f64('0x58')]=qs['sort'](_0x717ae9['query'][_0x2f64('0x37')]);_0x57bbaa[_0x2f64('0x38')]=qs[_0x2f64('0x39')](_[_0x2f64('0x3a')](_0x717ae9[_0x2f64('0x30')],_0x3f595f[_0x2f64('0x39')]));if(_0x717ae9[_0x2f64('0x30')][_0x2f64('0x3b')]){_0x57bbaa[_0x2f64('0x38')]=_[_0x2f64('0x3c')](_0x57bbaa[_0x2f64('0x38')],{'$or':_[_0x2f64('0x2f')](_0x57bbaa['attributes'],function(_0x51bed4){var _0x18ba1a={};_0x18ba1a[_0x51bed4]={'$like':'%'+_0x717ae9[_0x2f64('0x30')][_0x2f64('0x3b')]+'%'};return _0x18ba1a;})});}_0x57bbaa=_['merge']({},_0x57bbaa,_0x717ae9[_0x2f64('0x3e')]);return _0x47751b['getActions'](_0x57bbaa);}})[_0x2f64('0x23')](function(_0x4860b6){if(_0x4860b6){_0x34a9c7=_0x4860b6[_0x2f64('0x44')];if(!_0x717ae9['query'][_0x2f64('0x35')](_0x2f64('0x36'))){_0x57bbaa[_0x2f64('0x1a')]=qs['limit'](_0x717ae9['query'][_0x2f64('0x1a')]);_0x57bbaa[_0x2f64('0x18')]=qs['offset'](_0x717ae9[_0x2f64('0x30')][_0x2f64('0x18')]);}return _0x47751b[_0x2f64('0x5e')](_0x57bbaa);}})[_0x2f64('0x23')](function(_0x5cbfa1){if(_0x5cbfa1){return _0x5cbfa1?{'count':_0x34a9c7,'rows':_0x5cbfa1}:null;}})[_0x2f64('0x23')](respondWithResult(_0x2b9de2,null))[_0x2f64('0x42')](handleError(_0x2b9de2,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 03ebb58..5a466d9 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 _0x1159=['define','Trigger','tools_triggers','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trigger.attributes'];(function(_0xbf4346,_0x56ef94){var _0xb3ce4b=function(_0x561472){while(--_0x561472){_0xbf4346['push'](_0xbf4346['shift']());}};_0xb3ce4b(++_0x56ef94);}(_0x1159,0xf3));var _0x9115=function(_0x396aca,_0x1b4f0c){_0x396aca=_0x396aca-0x0;var _0xe179d8=_0x1159[_0x396aca];return _0xe179d8;};'use strict';var _=require(_0x9115('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9115('0x1'));var moment=require(_0x9115('0x2'));var BPromise=require(_0x9115('0x3'));var rp=require(_0x9115('0x4'));var fs=require('fs');var path=require(_0x9115('0x5'));var rimraf=require(_0x9115('0x6'));var config=require(_0x9115('0x7'));var attributes=require(_0x9115('0x8'));module['exports']=function(_0x4a23ba,_0x3fd395){return _0x4a23ba[_0x9115('0x9')](_0x9115('0xa'),attributes,{'tableName':_0x9115('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0434=['api','moment','path','rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger','lodash','util','../../config/logger'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x0434,0x1ad));var _0x4043=function(_0x3c0dcc,_0x18c419){_0x3c0dcc=_0x3c0dcc-0x0;var _0x1a224c=_0x0434[_0x3c0dcc];return _0x1a224c;};'use strict';var _=require(_0x4043('0x0'));var util=require(_0x4043('0x1'));var logger=require(_0x4043('0x2'))(_0x4043('0x3'));var moment=require(_0x4043('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4043('0x5'));var rimraf=require(_0x4043('0x6'));var config=require(_0x4043('0x7'));var attributes=require(_0x4043('0x8'));module[_0x4043('0x9')]=function(_0x1dba57,_0x58fca7){return _0x1dba57[_0x4043('0xa')](_0x4043('0xb'),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 0ee6a40..2225ed9 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 _0x4880=['http','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetTrigger','Trigger','options','raw','where','attributes','limit','include','map','model','stringify','ShowTrigger','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x32b168,_0x22e559){var _0x4b0a8b=function(_0x568c0c){while(--_0x568c0c){_0x32b168['push'](_0x32b168['shift']());}};_0x4b0a8b(++_0x22e559);}(_0x4880,0xea));var _0x0488=function(_0x1e175c,_0x22076d){_0x1e175c=_0x1e175c-0x0;var _0x36f74e=_0x4880[_0x1e175c];return _0x36f74e;};'use strict';var _=require(_0x0488('0x0'));var util=require(_0x0488('0x1'));var moment=require(_0x0488('0x2'));var BPromise=require(_0x0488('0x3'));var rs=require(_0x0488('0x4'));var fs=require('fs');var Redis=require(_0x0488('0x5'));var db=require(_0x0488('0x6'))['db'];var utils=require(_0x0488('0x7'));var logger=require(_0x0488('0x8'))(_0x0488('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0488('0xa')][_0x0488('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1abc36,_0x40f71c,_0x414973){return new BPromise(function(_0x340c9f,_0x28435a){return client['request'](_0x1abc36,_0x414973)[_0x0488('0xc')](function(_0xece6a){logger[_0x0488('0xd')](_0x0488('0xe'),_0x40f71c,_0x0488('0xf'));logger[_0x0488('0x10')](_0x0488('0x11'),_0x40f71c,_0x0488('0xf'),JSON['stringify'](_0xece6a));if(_0xece6a[_0x0488('0x12')]){if(_0xece6a['error']['code']===0x1f4){logger['error'](_0x0488('0xe'),_0x40f71c,_0xece6a[_0x0488('0x12')][_0x0488('0x13')]);return _0x28435a(_0xece6a[_0x0488('0x12')]['message']);}logger[_0x0488('0x12')](_0x0488('0xe'),_0x40f71c,_0xece6a[_0x0488('0x12')]['message']);return _0x340c9f(_0xece6a[_0x0488('0x12')]['message']);}else{logger[_0x0488('0xd')]('Trigger,\x20%s,\x20%s',_0x40f71c,_0x0488('0xf'));_0x340c9f(_0xece6a[_0x0488('0x14')][_0x0488('0x13')]);}})[_0x0488('0x15')](function(_0x4e66e2){logger[_0x0488('0x12')](_0x0488('0xe'),_0x40f71c,_0x4e66e2);_0x28435a(_0x4e66e2);});});}exports[_0x0488('0x16')]=function(_0x47601a){var _0x48b54b=this;return new Promise(function(_0x166dae,_0x5222cd){return db[_0x0488('0x17')]['findAll']({'raw':_0x47601a[_0x0488('0x18')]?_0x47601a['options'][_0x0488('0x19')]===undefined?!![]:![]:!![],'where':_0x47601a[_0x0488('0x18')]?_0x47601a[_0x0488('0x18')][_0x0488('0x1a')]||null:null,'attributes':_0x47601a[_0x0488('0x18')]?_0x47601a[_0x0488('0x18')][_0x0488('0x1b')]||null:null,'limit':_0x47601a[_0x0488('0x18')]?_0x47601a[_0x0488('0x18')][_0x0488('0x1c')]||null:null,'include':_0x47601a[_0x0488('0x18')]?_0x47601a[_0x0488('0x18')][_0x0488('0x1d')]?_[_0x0488('0x1e')](_0x47601a[_0x0488('0x18')][_0x0488('0x1d')],function(_0x26b97d){return{'model':db[_0x26b97d['model']],'as':_0x26b97d['as'],'attributes':_0x26b97d[_0x0488('0x1b')],'include':_0x26b97d[_0x0488('0x1d')]?_['map'](_0x26b97d['include'],function(_0x1c59d4){return{'model':db[_0x1c59d4[_0x0488('0x1f')]],'as':_0x1c59d4['as'],'attributes':_0x1c59d4[_0x0488('0x1b')],'include':_0x1c59d4[_0x0488('0x1d')]?_[_0x0488('0x1e')](_0x1c59d4[_0x0488('0x1d')],function(_0x4d47f1){return{'model':db[_0x4d47f1['model']],'as':_0x4d47f1['as'],'attributes':_0x4d47f1[_0x0488('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0488('0xc')](function(_0x3608e2){logger[_0x0488('0xd')](_0x0488('0x16'),_0x47601a);logger[_0x0488('0x10')](_0x0488('0x16'),_0x47601a,JSON[_0x0488('0x20')](_0x3608e2));_0x166dae(_0x3608e2);})[_0x0488('0x15')](function(_0x383aa7){logger[_0x0488('0x12')](_0x0488('0x16'),_0x383aa7[_0x0488('0x13')],_0x47601a);_0x5222cd(_0x48b54b[_0x0488('0x12')](0x1f4,_0x383aa7[_0x0488('0x13')]));});});};exports[_0x0488('0x21')]=function(_0x3cc9d1){var _0x2f187b=this;return new Promise(function(_0x45bfe0,_0x1c8e3b){return db[_0x0488('0x17')][_0x0488('0x22')]({'raw':_0x3cc9d1[_0x0488('0x18')]?_0x3cc9d1['options'][_0x0488('0x19')]===undefined?!![]:![]:!![],'where':_0x3cc9d1[_0x0488('0x18')]?_0x3cc9d1['options'][_0x0488('0x1a')]||null:null,'attributes':_0x3cc9d1['options']?_0x3cc9d1[_0x0488('0x18')][_0x0488('0x1b')]||null:null,'include':_0x3cc9d1[_0x0488('0x18')]?_0x3cc9d1[_0x0488('0x18')]['include']?_[_0x0488('0x1e')](_0x3cc9d1[_0x0488('0x18')][_0x0488('0x1d')],function(_0x47c85c){return{'model':db[_0x47c85c['model']],'as':_0x47c85c['as'],'attributes':_0x47c85c[_0x0488('0x1b')],'include':_0x47c85c[_0x0488('0x1d')]?_[_0x0488('0x1e')](_0x47c85c[_0x0488('0x1d')],function(_0x17a5c6){return{'model':db[_0x17a5c6[_0x0488('0x1f')]],'as':_0x17a5c6['as'],'attributes':_0x17a5c6[_0x0488('0x1b')],'include':_0x17a5c6[_0x0488('0x1d')]?_[_0x0488('0x1e')](_0x17a5c6[_0x0488('0x1d')],function(_0x42a8b8){return{'model':db[_0x42a8b8[_0x0488('0x1f')]],'as':_0x42a8b8['as'],'attributes':_0x42a8b8[_0x0488('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4717e2){logger[_0x0488('0xd')](_0x0488('0x21'),_0x3cc9d1);logger[_0x0488('0x10')](_0x0488('0x21'),_0x3cc9d1,JSON[_0x0488('0x20')](_0x4717e2));_0x45bfe0(_0x4717e2);})[_0x0488('0x15')](function(_0x2289d8){logger['error'](_0x0488('0x21'),_0x2289d8[_0x0488('0x13')],_0x3cc9d1);_0x1c8e3b(_0x2f187b[_0x0488('0x12')](0x1f4,_0x2289d8[_0x0488('0x13')]));});});}; \ No newline at end of file +var _0xa440=['model','GetTrigger','ShowTrigger','Trigger','lodash','util','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x5a5d0,_0x2fbb4f){var _0x56261d=function(_0xc4f8fb){while(--_0xc4f8fb){_0x5a5d0['push'](_0x5a5d0['shift']());}};_0x56261d(++_0x2fbb4f);}(_0xa440,0x6a));var _0x0a44=function(_0x2ef8f1,_0x1280a3){_0x2ef8f1=_0x2ef8f1-0x0;var _0x17498d=_0xa440[_0x2ef8f1];return _0x17498d;};'use strict';var _=require(_0x0a44('0x0'));var util=require(_0x0a44('0x1'));var moment=require(_0x0a44('0x2'));var BPromise=require('bluebird');var rs=require(_0x0a44('0x3'));var fs=require('fs');var Redis=require(_0x0a44('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0a44('0x5'))('rpc');var config=require(_0x0a44('0x6'));var jayson=require(_0x0a44('0x7'));var client=jayson[_0x0a44('0x8')][_0x0a44('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x316890,_0x4ce780,_0x3d21e){return new BPromise(function(_0xb0bc2,_0x4172f9){return client[_0x0a44('0xa')](_0x316890,_0x3d21e)[_0x0a44('0xb')](function(_0x549652){logger['info'](_0x0a44('0xc'),_0x4ce780,_0x0a44('0xd'));logger[_0x0a44('0xe')](_0x0a44('0xf'),_0x4ce780,'request\x20sent',JSON[_0x0a44('0x10')](_0x549652));if(_0x549652[_0x0a44('0x11')]){if(_0x549652['error'][_0x0a44('0x12')]===0x1f4){logger[_0x0a44('0x11')]('Trigger,\x20%s,\x20%s',_0x4ce780,_0x549652['error'][_0x0a44('0x13')]);return _0x4172f9(_0x549652[_0x0a44('0x11')][_0x0a44('0x13')]);}logger['error'](_0x0a44('0xc'),_0x4ce780,_0x549652['error'][_0x0a44('0x13')]);return _0xb0bc2(_0x549652[_0x0a44('0x11')][_0x0a44('0x13')]);}else{logger[_0x0a44('0x14')](_0x0a44('0xc'),_0x4ce780,_0x0a44('0xd'));_0xb0bc2(_0x549652['result']['message']);}})[_0x0a44('0x15')](function(_0x4e6160){logger[_0x0a44('0x11')](_0x0a44('0xc'),_0x4ce780,_0x4e6160);_0x4172f9(_0x4e6160);});});}exports['GetTrigger']=function(_0x42288f){var _0x53bff8=this;return new Promise(function(_0x2cbf25,_0x4d43fe){return db['Trigger'][_0x0a44('0x16')]({'raw':_0x42288f[_0x0a44('0x17')]?_0x42288f[_0x0a44('0x17')][_0x0a44('0x18')]===undefined?!![]:![]:!![],'where':_0x42288f[_0x0a44('0x17')]?_0x42288f['options'][_0x0a44('0x19')]||null:null,'attributes':_0x42288f['options']?_0x42288f[_0x0a44('0x17')][_0x0a44('0x1a')]||null:null,'limit':_0x42288f[_0x0a44('0x17')]?_0x42288f[_0x0a44('0x17')][_0x0a44('0x1b')]||null:null,'include':_0x42288f[_0x0a44('0x17')]?_0x42288f[_0x0a44('0x17')][_0x0a44('0x1c')]?_[_0x0a44('0x1d')](_0x42288f[_0x0a44('0x17')]['include'],function(_0x27cc47){return{'model':db[_0x27cc47[_0x0a44('0x1e')]],'as':_0x27cc47['as'],'attributes':_0x27cc47[_0x0a44('0x1a')],'include':_0x27cc47['include']?_[_0x0a44('0x1d')](_0x27cc47['include'],function(_0xfd704a){return{'model':db[_0xfd704a[_0x0a44('0x1e')]],'as':_0xfd704a['as'],'attributes':_0xfd704a[_0x0a44('0x1a')],'include':_0xfd704a['include']?_[_0x0a44('0x1d')](_0xfd704a[_0x0a44('0x1c')],function(_0x467454){return{'model':db[_0x467454[_0x0a44('0x1e')]],'as':_0x467454['as'],'attributes':_0x467454[_0x0a44('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0a44('0xb')](function(_0x25d8cf){logger[_0x0a44('0x14')](_0x0a44('0x1f'),_0x42288f);logger[_0x0a44('0xe')](_0x0a44('0x1f'),_0x42288f,JSON[_0x0a44('0x10')](_0x25d8cf));_0x2cbf25(_0x25d8cf);})[_0x0a44('0x15')](function(_0x59d8f7){logger[_0x0a44('0x11')](_0x0a44('0x1f'),_0x59d8f7[_0x0a44('0x13')],_0x42288f);_0x4d43fe(_0x53bff8[_0x0a44('0x11')](0x1f4,_0x59d8f7['message']));});});};exports[_0x0a44('0x20')]=function(_0x1aca2e){var _0x59db04=this;return new Promise(function(_0x404013,_0x370af7){return db[_0x0a44('0x21')]['find']({'raw':_0x1aca2e[_0x0a44('0x17')]?_0x1aca2e[_0x0a44('0x17')][_0x0a44('0x18')]===undefined?!![]:![]:!![],'where':_0x1aca2e[_0x0a44('0x17')]?_0x1aca2e['options']['where']||null:null,'attributes':_0x1aca2e[_0x0a44('0x17')]?_0x1aca2e[_0x0a44('0x17')][_0x0a44('0x1a')]||null:null,'include':_0x1aca2e['options']?_0x1aca2e[_0x0a44('0x17')][_0x0a44('0x1c')]?_[_0x0a44('0x1d')](_0x1aca2e[_0x0a44('0x17')]['include'],function(_0x3a3f56){return{'model':db[_0x3a3f56['model']],'as':_0x3a3f56['as'],'attributes':_0x3a3f56['attributes'],'include':_0x3a3f56[_0x0a44('0x1c')]?_[_0x0a44('0x1d')](_0x3a3f56[_0x0a44('0x1c')],function(_0x197fa8){return{'model':db[_0x197fa8[_0x0a44('0x1e')]],'as':_0x197fa8['as'],'attributes':_0x197fa8[_0x0a44('0x1a')],'include':_0x197fa8[_0x0a44('0x1c')]?_[_0x0a44('0x1d')](_0x197fa8[_0x0a44('0x1c')],function(_0x290032){return{'model':db[_0x290032[_0x0a44('0x1e')]],'as':_0x290032['as'],'attributes':_0x290032[_0x0a44('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0a44('0xb')](function(_0x4660bd){logger['info']('ShowTrigger',_0x1aca2e);logger[_0x0a44('0xe')](_0x0a44('0x20'),_0x1aca2e,JSON['stringify'](_0x4660bd));_0x404013(_0x4660bd);})[_0x0a44('0x15')](function(_0xbb9dd2){logger['error']('ShowTrigger',_0xbb9dd2[_0x0a44('0x13')],_0x1aca2e);_0x370af7(_0x59db04[_0x0a44('0x11')](0x1f4,_0xbb9dd2[_0x0a44('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 592c605..9dcd41d 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 _0xff77=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','get','index','/:id','isAuthenticated','post','/:id/clone','clone','create','put','delete','destroy','exports','util'];(function(_0x41243b,_0x24f5b4){var _0x39dffe=function(_0xe569fc){while(--_0xe569fc){_0x41243b['push'](_0x41243b['shift']());}};_0x39dffe(++_0x24f5b4);}(_0xff77,0x9f));var _0x7ff7=function(_0x5d4311,_0x1ce34d){_0x5d4311=_0x5d4311-0x0;var _0x5c93d3=_0xff77[_0x5d4311];return _0x5c93d3;};'use strict';var multer=require('multer');var util=require(_0x7ff7('0x0'));var path=require('path');var timeout=require(_0x7ff7('0x1'));var express=require(_0x7ff7('0x2'));var router=express[_0x7ff7('0x3')]();var fs_extra=require(_0x7ff7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7ff7('0x5'));var config=require(_0x7ff7('0x6'));var controller=require(_0x7ff7('0x7'));router[_0x7ff7('0x8')]('/',auth['isAuthenticated'](),controller[_0x7ff7('0x9')]);router[_0x7ff7('0x8')](_0x7ff7('0xa'),auth[_0x7ff7('0xb')](),controller['show']);router[_0x7ff7('0xc')](_0x7ff7('0xd'),auth[_0x7ff7('0xb')](),controller[_0x7ff7('0xe')]);router[_0x7ff7('0xc')]('/',auth['isAuthenticated'](),controller[_0x7ff7('0xf')]);router[_0x7ff7('0x10')](_0x7ff7('0xa'),auth[_0x7ff7('0xb')](),controller['update']);router[_0x7ff7('0x11')](_0x7ff7('0xa'),auth['isAuthenticated'](),controller[_0x7ff7('0x12')]);module[_0x7ff7('0x13')]=router; \ No newline at end of file +var _0x080a=['util','path','express','Router','fs-extra','../../components/auth/service','./trunk.controller','isAuthenticated','index','/:id','show','/:id/clone','clone','post','create','update','delete','destroy','exports','multer'];(function(_0x41b0a8,_0x1b05cc){var _0x3a83d4=function(_0x3d1011){while(--_0x3d1011){_0x41b0a8['push'](_0x41b0a8['shift']());}};_0x3a83d4(++_0x1b05cc);}(_0x080a,0x8b));var _0xa080=function(_0x3ada4d,_0x2fff14){_0x3ada4d=_0x3ada4d-0x0;var _0x3cdabb=_0x080a[_0x3ada4d];return _0x3cdabb;};'use strict';var multer=require(_0xa080('0x0'));var util=require(_0xa080('0x1'));var path=require(_0xa080('0x2'));var timeout=require('connect-timeout');var express=require(_0xa080('0x3'));var router=express[_0xa080('0x4')]();var fs_extra=require(_0xa080('0x5'));var auth=require(_0xa080('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa080('0x7'));router['get']('/',auth[_0xa080('0x8')](),controller[_0xa080('0x9')]);router['get'](_0xa080('0xa'),auth[_0xa080('0x8')](),controller[_0xa080('0xb')]);router['post'](_0xa080('0xc'),auth['isAuthenticated'](),controller[_0xa080('0xd')]);router[_0xa080('0xe')]('/',auth[_0xa080('0x8')](),controller[_0xa080('0xf')]);router['put'](_0xa080('0xa'),auth['isAuthenticated'](),controller[_0xa080('0x10')]);router[_0xa080('0x11')]('/:id',auth[_0xa080('0x8')](),controller[_0xa080('0x12')]);module[_0xa080('0x13')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 4cf635e..79b7470 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 _0x4115=['uac','uas','pai','active','passive','actpass','dynamic','update,nonat','BOOLEAN','exports','STRING','name','ENUM','friend','user','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','join','getDataValue','transport','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','setDataValue','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\x22alaw\x22]','port,invite','insecure','never','INTEGER','\x22\x22\x20<>','always','refuse','originate'];(function(_0x11ac91,_0x20c725){var _0x5a63dc=function(_0x157380){while(--_0x157380){_0x11ac91['push'](_0x11ac91['shift']());}};_0x5a63dc(++_0x20c725);}(_0x4115,0x1e6));var _0x5411=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4115[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require('sequelize');module[_0x5411('0x0')]={'name':{'type':Sequelize[_0x5411('0x1')],'allowNull':![],'unique':_0x5411('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x4'),_0x5411('0x5'),'peer'),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x5411('0x1')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x6'),_0x5411('0x7'),_0x5411('0x8'),_0x5411('0x9'),_0x5411('0xa'),_0x5411('0xb'),_0x5411('0xc'),_0x5411('0xd'))},'deny':{'type':Sequelize[_0x5411('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x5411('0x1')]},'remotesecret':{'type':Sequelize[_0x5411('0x1')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x5411('0xe'),'set':function(_0x560a42){this['setDataValue']('transport',_0x560a42?_0x560a42[_0x5411('0xf')](','):null);},'get':function(){return this[_0x5411('0x10')](_0x5411('0x11'))?this[_0x5411('0x10')](_0x5411('0x11'))[_0x5411('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x13'),_0x5411('0x14'),_0x5411('0x15'),_0x5411('0x16'),_0x5411('0x17')),'defaultValue':_0x5411('0x13')},'directmedia':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x18'),'no',_0x5411('0x19'),_0x5411('0x1a'),_0x5411('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x5411('0x1')]},'directmediadeny':{'type':Sequelize[_0x5411('0x1')]},'nat':{'type':Sequelize[_0x5411('0x1')],'defaultValue':_0x5411('0x1c'),'set':function(_0x43a89c){this[_0x5411('0x1d')]('nat',_0x43a89c?_0x43a89c[_0x5411('0xf')](','):null);},'get':function(){return this[_0x5411('0x10')](_0x5411('0x1e'))?this['getDataValue'](_0x5411('0x1e'))['split'](','):null;},'comment':_0x5411('0x1f')},'callgroup':{'type':Sequelize[_0x5411('0x1')]},'namedcallgroup':{'type':Sequelize[_0x5411('0x1')]},'pickupgroup':{'type':Sequelize[_0x5411('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x5411('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x5411('0x1')],'defaultValue':_0x5411('0x20')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x39b335){this[_0x5411('0x1d')](_0x5411('0x21'),_0x39b335?_0x39b335[_0x5411('0xf')](';'):_0x5411('0x22'));},'get':function(){return this['getDataValue']('allow')?this[_0x5411('0x10')](_0x5411('0x21'))[_0x5411('0x12')](';'):null;},'comment':_0x5411('0x23')},'autoframing':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x18'),'no')},'insecure':{'type':Sequelize[_0x5411('0x1')],'defaultValue':_0x5411('0x24'),'set':function(_0x183f17){this[_0x5411('0x1d')](_0x5411('0x25'),_0x183f17?_0x183f17[_0x5411('0xf')](','):null);},'get':function(){return this[_0x5411('0x10')](_0x5411('0x25'))?this['getDataValue'](_0x5411('0x25'))[_0x5411('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x5411('0x3')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x18'),'no',_0x5411('0x26'))},'promiscredir':{'type':Sequelize[_0x5411('0x3')]('yes','no')},'useclientcode':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x18'),'no')},'accountcode':{'type':Sequelize[_0x5411('0x27')](0xb)},'setvar':{'type':Sequelize[_0x5411('0x1')]},'callerid':{'type':Sequelize[_0x5411('0x1')],'defaultValue':_0x5411('0x28')},'amaflags':{'type':Sequelize[_0x5411('0x1')]},'callcounter':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x18'),'no'),'defaultValue':_0x5411('0x18')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x5411('0x3')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x18'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x5411('0x18'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x5411('0x1')]},'videosupport':{'type':Sequelize['ENUM'](_0x5411('0x18'),'no',_0x5411('0x29')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x5411('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x18'),'no')},'mailbox':{'type':Sequelize[_0x5411('0x1')]},'session_timers':{'type':Sequelize[_0x5411('0x3')]('accept',_0x5411('0x2a'),_0x5411('0x2b'))},'session_expires':{'type':Sequelize[_0x5411('0x27')](0xb)},'session_minse':{'type':Sequelize[_0x5411('0x27')](0xb)},'session_refresher':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x2c'),_0x5411('0x2d')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x5411('0x1')]},'regexten':{'type':Sequelize[_0x5411('0x1')]},'fromdomain':{'type':Sequelize[_0x5411('0x1')]},'fromuser':{'type':Sequelize[_0x5411('0x1')]},'port':{'type':Sequelize[_0x5411('0x27')](0x5)},'qualify':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x18'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x5411('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x5411('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x18'),'no',_0x5411('0x2e')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x5411('0x1')]},'timert1':{'type':Sequelize[_0x5411('0x27')](0xb)},'timerb':{'type':Sequelize[_0x5411('0x27')](0xb)},'qualifyfreq':{'type':Sequelize[_0x5411('0x27')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x5411('0x1')]},'contactacl':{'type':Sequelize[_0x5411('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x5411('0x1')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x5411('0x27')](0xb)},'encryption':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x18'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x5411('0x18'),'no')},'icesupport':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0x5411('0x3')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x5411('0x3')]('yes','no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x5411('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x5411('0x1')]},'dtlscipher':{'type':Sequelize[_0x5411('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x5411('0x1')]},'dtlssetup':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x2f'),_0x5411('0x30'),_0x5411('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x5411('0x1')]},'recordofffeature':{'type':Sequelize[_0x5411('0x1')]},'call_limit':{'type':Sequelize[_0x5411('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x5411('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0x5411('0x3')]('yes','no')},'vmexten':{'type':Sequelize[_0x5411('0x1')]},'mohinterpret':{'type':Sequelize[_0x5411('0x1')]},'mohsuggest':{'type':Sequelize[_0x5411('0x1')]},'parkinglot':{'type':Sequelize[_0x5411('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':_0x5411('0x32')},'canreinvite':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x18'),'no','nonat',_0x5411('0x1a'),_0x5411('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x5411('0x1')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x5411('0x34')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x5411('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0x8905=['update','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','accept','originate','uac','uas','fingerprint','certificate','passive','actpass','dynamic','update,nonat','BOOLEAN','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','nonat'];(function(_0x15a706,_0x49392f){var _0x190561=function(_0x4b81ce){while(--_0x4b81ce){_0x15a706['push'](_0x15a706['shift']());}};_0x190561(++_0x49392f);}(_0x8905,0x1b0));var _0x5890=function(_0x5f34b8,_0x956a5c){_0x5f34b8=_0x5f34b8-0x0;var _0x21e158=_0x8905[_0x5f34b8];return _0x21e158;};'use strict';var Sequelize=require('sequelize');module[_0x5890('0x0')]={'name':{'type':Sequelize[_0x5890('0x1')],'allowNull':![],'unique':_0x5890('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x5890('0x3')](_0x5890('0x4'),_0x5890('0x5'),_0x5890('0x6')),'allowNull':![],'defaultValue':_0x5890('0x4')},'context':{'type':Sequelize[_0x5890('0x1')],'allowNull':![],'defaultValue':_0x5890('0x7')},'callingpres':{'type':Sequelize['ENUM'](_0x5890('0x8'),'ALLOWED_PASSED_SCREEN',_0x5890('0x9'),_0x5890('0xa'),_0x5890('0xb'),_0x5890('0xc'),_0x5890('0xd'),_0x5890('0xe'))},'deny':{'type':Sequelize[_0x5890('0x1')]},'permit':{'type':Sequelize[_0x5890('0x1')]},'secret':{'type':Sequelize[_0x5890('0x1')]},'md5secret':{'type':Sequelize[_0x5890('0x1')]},'remotesecret':{'type':Sequelize[_0x5890('0x1')]},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x9e7b33){this[_0x5890('0xf')](_0x5890('0x10'),_0x9e7b33?_0x9e7b33[_0x5890('0x11')](','):null);},'get':function(){return this[_0x5890('0x12')]('transport')?this[_0x5890('0x12')](_0x5890('0x10'))[_0x5890('0x13')](','):null;},'comment':_0x5890('0x14')},'dtmfmode':{'type':Sequelize[_0x5890('0x3')](_0x5890('0x15'),_0x5890('0x16'),_0x5890('0x17'),_0x5890('0x18'),_0x5890('0x19')),'defaultValue':_0x5890('0x15')},'directmedia':{'type':Sequelize[_0x5890('0x3')]('yes','no',_0x5890('0x1a'),_0x5890('0x1b'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x5890('0x3')](_0x5890('0x1c'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x5890('0x1')]},'directmediadeny':{'type':Sequelize[_0x5890('0x1')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x5890('0x1d'),'set':function(_0x195788){this[_0x5890('0xf')]('nat',_0x195788?_0x195788[_0x5890('0x11')](','):null);},'get':function(){return this[_0x5890('0x12')]('nat')?this[_0x5890('0x12')](_0x5890('0x1e'))[_0x5890('0x13')](','):null;},'comment':_0x5890('0x1f')},'callgroup':{'type':Sequelize[_0x5890('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x5890('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x5890('0x1')]},'language':{'type':Sequelize[_0x5890('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x5890('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize[_0x5890('0x1')],'allowNull':![],'defaultValue':_0x5890('0x20'),'set':function(_0x3cc9ba){this[_0x5890('0xf')](_0x5890('0x21'),_0x3cc9ba?_0x3cc9ba['join'](';'):_0x5890('0x20'));},'get':function(){return this['getDataValue'](_0x5890('0x21'))?this[_0x5890('0x12')](_0x5890('0x21'))[_0x5890('0x13')](';'):null;},'comment':_0x5890('0x22')},'autoframing':{'type':Sequelize[_0x5890('0x3')](_0x5890('0x1c'),'no')},'insecure':{'type':Sequelize[_0x5890('0x1')],'defaultValue':'port,invite','set':function(_0x5bbcca){this['setDataValue'](_0x5890('0x23'),_0x5bbcca?_0x5bbcca[_0x5890('0x11')](','):null);},'get':function(){return this[_0x5890('0x12')](_0x5890('0x23'))?this[_0x5890('0x12')](_0x5890('0x23'))[_0x5890('0x13')](','):null;},'comment':_0x5890('0x24')},'trustrpid':{'type':Sequelize[_0x5890('0x3')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x5890('0x3')](_0x5890('0x1c'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x5890('0x25'))},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize[_0x5890('0x3')](_0x5890('0x1c'),'no')},'accountcode':{'type':Sequelize[_0x5890('0x26')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x5890('0x1')],'defaultValue':_0x5890('0x27')},'amaflags':{'type':Sequelize[_0x5890('0x1')]},'callcounter':{'type':Sequelize['ENUM'](_0x5890('0x1c'),'no'),'defaultValue':_0x5890('0x1c')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x5890('0x3')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0x5890('0x3')](_0x5890('0x1c'),'no')},'allowtransfer':{'type':Sequelize[_0x5890('0x3')](_0x5890('0x1c'),'no')},'ignoresdpversion':{'type':Sequelize[_0x5890('0x3')](_0x5890('0x1c'),'no')},'subscribecontext':{'type':Sequelize[_0x5890('0x1')]},'template':{'type':Sequelize[_0x5890('0x1')]},'videosupport':{'type':Sequelize[_0x5890('0x3')](_0x5890('0x1c'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x5890('0x1c'),'no')},'mailbox':{'type':Sequelize[_0x5890('0x1')]},'session_timers':{'type':Sequelize[_0x5890('0x3')](_0x5890('0x28'),'refuse',_0x5890('0x29'))},'session_expires':{'type':Sequelize[_0x5890('0x26')](0xb)},'session_minse':{'type':Sequelize[_0x5890('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0x5890('0x3')](_0x5890('0x2a'),'uas'),'defaultValue':_0x5890('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0x5890('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x5890('0x1')]},'fromuser':{'type':Sequelize[_0x5890('0x1')]},'port':{'type':Sequelize[_0x5890('0x26')](0x5)},'qualify':{'type':Sequelize[_0x5890('0x3')](_0x5890('0x1c'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x5890('0x26')](0xb)},'defaultip':{'type':Sequelize[_0x5890('0x1')]},'defaultuser':{'type':Sequelize[_0x5890('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x5890('0x3')](_0x5890('0x1c'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x5890('0x1')]},'timert1':{'type':Sequelize[_0x5890('0x26')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x5890('0x26')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x5890('0x1')]},'contactacl':{'type':Sequelize[_0x5890('0x1')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x5890('0x1')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x5890('0x1c'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x5890('0x3')]('yes','no')},'force_avp':{'type':Sequelize[_0x5890('0x3')](_0x5890('0x1c'),'no')},'icesupport':{'type':Sequelize[_0x5890('0x3')](_0x5890('0x1c'),'no')},'dtlsenable':{'type':Sequelize[_0x5890('0x3')](_0x5890('0x1c'),'no')},'dtlsverify':{'type':Sequelize[_0x5890('0x3')](_0x5890('0x1c'),'no',_0x5890('0x2c'),_0x5890('0x2d'))},'dtlsrekey':{'type':Sequelize[_0x5890('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0x5890('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x5890('0x1')]},'dtlscipher':{'type':Sequelize[_0x5890('0x1')]},'dtlscafile':{'type':Sequelize[_0x5890('0x1')]},'dtlscapath':{'type':Sequelize[_0x5890('0x1')]},'dtlssetup':{'type':Sequelize[_0x5890('0x3')]('active',_0x5890('0x2e'),_0x5890('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x5890('0x1')]},'usereqphone':{'type':Sequelize[_0x5890('0x3')](_0x5890('0x1c'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x5890('0x1')]},'recordofffeature':{'type':Sequelize[_0x5890('0x1')]},'call_limit':{'type':Sequelize[_0x5890('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x5890('0x3')](_0x5890('0x1c'),'no')},'subscribemwi':{'type':Sequelize[_0x5890('0x3')]('yes','no')},'vmexten':{'type':Sequelize[_0x5890('0x1')]},'mohinterpret':{'type':Sequelize[_0x5890('0x1')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5890('0x1')]},'host':{'type':Sequelize[_0x5890('0x1')],'defaultValue':_0x5890('0x30')},'canreinvite':{'type':Sequelize[_0x5890('0x3')](_0x5890('0x1c'),'no',_0x5890('0x1a'),_0x5890('0x1b'),_0x5890('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x5890('0x1')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x5890('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index aa35914..01e2121 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 _0xe5b3=['then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','request\x20sent','result','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','catch','clone','find','omit','createdAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','Reload','chan_sip.so','/etc/asterisk/sip_xcally_registers.conf','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request'];(function(_0x49f913,_0x12ccd8){var _0xf48ea5=function(_0xfd48b0){while(--_0xfd48b0){_0x49f913['push'](_0x49f913['shift']());}};_0xf48ea5(++_0x12ccd8);}(_0xe5b3,0x133));var _0x3e5b=function(_0x4b3d12,_0x1d4133){_0x4b3d12=_0x4b3d12-0x0;var _0x104e8c=_0xe5b3[_0x4b3d12];return _0x104e8c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];var jayson=require(_0x3e5b('0x19'));var client=jayson[_0x3e5b('0x1a')][_0x3e5b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x405e70,_0x560010,_0x39a2a1,_0x5f2f9c){return new BPromise(function(_0x51a188,_0x4d71a3){var _0x3754e3=_0x5f2f9c||client;return _0x3754e3[_0x3e5b('0x1c')](_0x405e70,_0x39a2a1)[_0x3e5b('0x1d')](function(_0x4fb471){logger[_0x3e5b('0x1e')]('Trunk,\x20%s,\x20%s',_0x560010,'request\x20sent');logger[_0x3e5b('0x1f')](_0x3e5b('0x20'),_0x560010,'request\x20sent',JSON[_0x3e5b('0x21')](_0x4fb471));if(_0x4fb471[_0x3e5b('0x22')]){if(_0x4fb471['error'][_0x3e5b('0x23')]===0x1f4){logger[_0x3e5b('0x22')]('Trunk,\x20%s,\x20%s',_0x560010,_0x4fb471['error'][_0x3e5b('0x24')]);return _0x4d71a3(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);return _0x51a188(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}else{logger[_0x3e5b('0x1e')](_0x3e5b('0x25'),_0x560010,_0x3e5b('0x26'));_0x51a188(_0x4fb471[_0x3e5b('0x27')][_0x3e5b('0x24')]);}})['catch'](function(_0x433f9c){logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x433f9c);_0x4d71a3(_0x433f9c);});});}function respondWithStatusCode(_0x150674,_0x50039b){_0x50039b=_0x50039b||0xcc;return function(_0x1eb80f){if(_0x1eb80f){return _0x150674['sendStatus'](_0x50039b);}return _0x150674[_0x3e5b('0x28')](_0x50039b)[_0x3e5b('0x29')]();};}function respondWithResult(_0x4d5e61,_0x41b684){_0x41b684=_0x41b684||0xc8;return function(_0x2f6368){if(_0x2f6368){return _0x4d5e61[_0x3e5b('0x28')](_0x41b684)[_0x3e5b('0x2a')](_0x2f6368);}};}function respondWithFilteredResult(_0x3bb749,_0x26c7f2){return function(_0x160e87){if(_0x160e87){var _0x2ddf57=typeof _0x26c7f2['offset']===_0x3e5b('0x2b')&&typeof _0x26c7f2['limit']===_0x3e5b('0x2b');var _0x4fd64b=_0x160e87[_0x3e5b('0x2c')];var _0x1f6473=_0x2ddf57?0x0:_0x26c7f2[_0x3e5b('0x2d')];var _0x475b39=_0x2ddf57?_0x160e87[_0x3e5b('0x2c')]:_0x26c7f2[_0x3e5b('0x2d')]+_0x26c7f2[_0x3e5b('0x2e')];var _0x9c2123;if(_0x475b39>=_0x4fd64b){_0x475b39=_0x4fd64b;_0x9c2123=0xc8;}else{_0x9c2123=0xce;}_0x3bb749[_0x3e5b('0x28')](_0x9c2123);return _0x3bb749[_0x3e5b('0x2f')](_0x3e5b('0x30'),_0x1f6473+'-'+_0x475b39+'/'+_0x4fd64b)['json'](_0x160e87);}return null;};}function patchUpdates(_0x21bc10){return function(_0x1882aa){try{jsonpatch[_0x3e5b('0x31')](_0x1882aa,_0x21bc10,!![]);}catch(_0x2a14eb){return BPromise[_0x3e5b('0x32')](_0x2a14eb);}return _0x1882aa[_0x3e5b('0x33')]();};}function saveUpdates(_0x345927,_0x4c4e01){return function(_0x33f089){if(_0x33f089){return _0x33f089['update'](_0x345927)['then'](function(_0x32c6b0){return _0x32c6b0;});}return null;};}function removeEntity(_0x78d68a,_0x51ea0d){return function(_0x40e37d){if(_0x40e37d){return _0x40e37d[_0x3e5b('0x34')]()[_0x3e5b('0x1d')](function(){var _0x33e356=_0x40e37d[_0x3e5b('0x35')]({'plain':!![]});var _0x26f842=_0x3e5b('0x36');return db[_0x3e5b('0x37')][_0x3e5b('0x34')]({'where':{'type':_0x26f842,'resourceId':_0x33e356['id']}})[_0x3e5b('0x1d')](function(){return _0x40e37d;});})[_0x3e5b('0x1d')](function(){_0x78d68a[_0x3e5b('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x141b7e,_0xec45c5){return function(_0x53caa2){if(!_0x53caa2){_0x141b7e['sendStatus'](0x194);}return _0x53caa2;};}function handleError(_0x471196,_0x56d7ef){_0x56d7ef=_0x56d7ef||0x1f4;return function(_0x2939da){logger[_0x3e5b('0x22')](_0x2939da[_0x3e5b('0x38')]);if(_0x2939da[_0x3e5b('0x39')]){delete _0x2939da['name'];}_0x471196[_0x3e5b('0x28')](_0x56d7ef)['send'](_0x2939da);};}exports[_0x3e5b('0x3a')]=function(_0x5ec841,_0x47f7c8){var _0x48f414={},_0x10c202={},_0x174ebf={'count':0x0,'rows':[]};var _0x2eaa30=_[_0x3e5b('0x3b')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')],function(_0x5466ac){return{'name':_0x5466ac['fieldName'],'type':_0x5466ac['type']['key']};});_0x10c202['model']=_['map'](_0x2eaa30,'name');_0x10c202[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x5ec841[_0x3e5b('0x3e')]);_0x10c202[_0x3e5b('0x40')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],_0x10c202[_0x3e5b('0x3e')]);_0x48f414[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x5ec841['query'][_0x3e5b('0x44')]));_0x48f414[_0x3e5b('0x43')]=_0x48f414[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x48f414[_0x3e5b('0x43')]:_0x10c202[_0x3e5b('0x42')];if(!_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x46')](_0x3e5b('0x47'))){_0x48f414[_0x3e5b('0x2e')]=qs[_0x3e5b('0x2e')](_0x5ec841['query']['limit']);_0x48f414['offset']=qs['offset'](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x2d')]);}_0x48f414[_0x3e5b('0x48')]=qs[_0x3e5b('0x49')](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x49')]);_0x48f414[_0x3e5b('0x4a')]=qs[_0x3e5b('0x40')](_[_0x3e5b('0x4b')](_0x5ec841[_0x3e5b('0x3e')],_0x10c202['filters']),_0x2eaa30);if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x4c')]){_0x48f414[_0x3e5b('0x4a')]=_[_0x3e5b('0x4d')](_0x48f414[_0x3e5b('0x4a')],{'$or':_['map'](_0x2eaa30,function(_0x588ee7){if(_0x588ee7['type']!==_0x3e5b('0x4e')){var _0x20af6a={};_0x20af6a[_0x588ee7[_0x3e5b('0x39')]]={'$like':'%'+_0x5ec841['query']['filter']+'%'};return _0x20af6a;}})});}_0x48f414=_[_0x3e5b('0x4d')]({},_0x48f414,_0x5ec841[_0x3e5b('0x4f')]);var _0x123947={'where':_0x48f414['where']};return db['Trunk'][_0x3e5b('0x2c')](_0x123947)['then'](function(_0x14b62a){_0x174ebf[_0x3e5b('0x2c')]=_0x14b62a;if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x48f414[_0x3e5b('0x51')]=[{'all':!![]}];}return db[_0x3e5b('0x3c')][_0x3e5b('0x52')](_0x48f414);})[_0x3e5b('0x1d')](function(_0x339852){_0x174ebf['rows']=_0x339852;return _0x174ebf;})[_0x3e5b('0x1d')](respondWithFilteredResult(_0x47f7c8,_0x48f414))['catch'](handleError(_0x47f7c8,null));};exports[_0x3e5b('0x53')]=function(_0x2e7047,_0x26e11e){var _0x3d51fa={'raw':![],'where':{'id':_0x2e7047[_0x3e5b('0x54')]['id']}},_0x291e4d={};_0x291e4d[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x291e4d[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x2e7047[_0x3e5b('0x3e')]);_0x291e4d['filters']=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],_0x291e4d[_0x3e5b('0x3e')]);_0x3d51fa[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],qs['fields'](_0x2e7047[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x3d51fa[_0x3e5b('0x43')]=_0x3d51fa[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x3d51fa[_0x3e5b('0x43')]:_0x291e4d[_0x3e5b('0x42')];if(_0x2e7047[_0x3e5b('0x3e')]['includeAll']){_0x3d51fa[_0x3e5b('0x51')]=[{'all':!![]}];}_0x3d51fa=_['merge']({},_0x3d51fa,_0x2e7047['options']);return db[_0x3e5b('0x3c')]['find'](_0x3d51fa)[_0x3e5b('0x1d')](handleEntityNotFound(_0x26e11e,null))[_0x3e5b('0x1d')](respondWithResult(_0x26e11e,null))[_0x3e5b('0x55')](handleError(_0x26e11e,null));};exports[_0x3e5b('0x56')]=function(_0x4a492b,_0x5ddeee){var _0x545712={'where':{'id':_0x4a492b[_0x3e5b('0x54')]['id']}},_0x581b94={};_0x581b94[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x545712['attributes']=_['intersection'](_0x581b94[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x545712[_0x3e5b('0x43')]=_0x545712['attributes']['length']?_0x545712['attributes']:_0x581b94['model'];if(_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x545712[_0x3e5b('0x51')]=[{'all':!![]}];}_0x545712=_[_0x3e5b('0x4d')]({},_0x545712,_0x4a492b[_0x3e5b('0x4f')]);return db[_0x3e5b('0x3c')][_0x3e5b('0x57')](_0x545712)[_0x3e5b('0x1d')](handleEntityNotFound(_0x5ddeee,null))['then'](function(_0x285db6){if(_0x285db6){var _0x29897b=_0x285db6[_0x3e5b('0x35')]({'plain':!![]});_0x29897b=qs[_0x3e5b('0x58')](_0x29897b,['id',_0x3e5b('0x59'),'updatedAt']);_0x4a492b[_0x3e5b('0x5a')]=_['omit'](_0x4a492b[_0x3e5b('0x5a')],['id',_0x3e5b('0x59'),'updatedAt']);return db['Trunk']['create'](_[_0x3e5b('0x4d')](_0x29897b,_0x4a492b['body']),{'include':_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]?[{'all':!![]}]:undefined})[_0x3e5b('0x1d')](function(_0x40197c){var _0x14f187=_0x4a492b['user']['get']({'plain':!![]});if(!_0x14f187)throw new Error(_0x3e5b('0x5b'));if(_0x14f187[_0x3e5b('0x5c')]===_0x3e5b('0x5d')){var _0x4dfb45=_0x40197c[_0x3e5b('0x35')]({'plain':!![]});var _0x3c5293=_0x3e5b('0x36');return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3c5293,'userProfileId':_0x14f187[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x4a1ce3){if(_0x4a1ce3&&_0x4a1ce3[_0x3e5b('0x60')]===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x4dfb45[_0x3e5b('0x39')],'resourceId':_0x4dfb45['id'],'type':_0x4a1ce3[_0x3e5b('0x39')],'sectionId':_0x4a1ce3['id']},{})[_0x3e5b('0x1d')](function(){return _0x40197c;});}else{return _0x40197c;}})[_0x3e5b('0x55')](function(_0x2411c3){logger[_0x3e5b('0x22')](_0x3e5b('0x62'),_0x2411c3);throw _0x2411c3;});}return _0x40197c;});}})['then'](respondWithResult(_0x5ddeee,0xc9))[_0x3e5b('0x55')](handleError(_0x5ddeee,null));};exports[_0x3e5b('0x61')]=function(_0x5af305,_0x177144,_0x31ef31){var _0x561c78;return db['Trunk']['create'](_0x5af305[_0x3e5b('0x5a')],{'raw':!![]})[_0x3e5b('0x1d')](function(_0x498e6d){_0x561c78=_0x498e6d;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});})['then'](function(_0x3d3bf2){var _0x17f60f=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0x410c7a=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x40103e=ejs[_0x3e5b('0x69')](_0x17f60f,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x40103e);if(_0x561c78['registry']){var _0x590f0c=ejs[_0x3e5b('0x69')](_0x410c7a,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')]('/etc/asterisk/sip_xcally_registers.conf',_0x590f0c);}})[_0x3e5b('0x1d')](function(){return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x61'),{'module':_0x3e5b('0x6d')});})[_0x3e5b('0x1d')](function(){var _0x9deb09=_0x5af305[_0x3e5b('0x5d')]['get']({'plain':!![]});if(!_0x9deb09)throw new Error(_0x3e5b('0x5b'));if(_0x9deb09[_0x3e5b('0x5c')]==='user'){var _0x577747=_0x561c78['get']({'plain':!![]});return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3e5b('0x36'),'userProfileId':_0x9deb09[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x1ba550){if(_0x1ba550&&_0x1ba550['autoAssociation']===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x577747['name'],'resourceId':_0x577747['id'],'type':_0x1ba550[_0x3e5b('0x39')],'sectionId':_0x1ba550['id']},{})['then'](function(){return _0x561c78;});}else{return _0x561c78;}})['catch'](function(_0x211e73){logger[_0x3e5b('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x211e73);throw _0x211e73;});}return _0x561c78;})[_0x3e5b('0x1d')](respondWithResult(_0x177144,0xc9))[_0x3e5b('0x55')](handleError(_0x177144,null));};exports['update']=function(_0x2e36af,_0x185640,_0x14baa9){var _0x1425eb;return db[_0x3e5b('0x3c')][_0x3e5b('0x57')]({'where':{'id':_0x2e36af['params']['id']}})['then'](handleEntityNotFound(_0x185640,null))[_0x3e5b('0x1d')](saveUpdates(_0x2e36af['body'],null))['then'](function(_0x25d3d8){if(_0x25d3d8){_0x1425eb=_0x25d3d8;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});}})['then'](function(_0x2e5fa3){if(_0x2e5fa3){var _0x4b8d19=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0xdf2677=fs['readFileSync'](path[_0x3e5b('0x64')](config['root'],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x58ccf3=ejs[_0x3e5b('0x69')](_0x4b8d19,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x58ccf3);var _0x5ad011=ejs[_0x3e5b('0x69')](_0xdf2677,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5ad011);return respondWithRpcPromise('Reload',_0x3e5b('0x6f'),{'module':_0x3e5b('0x6d')});}return null;})['then'](function(_0xd9d941){if(_0xd9d941){return _0x1425eb;}})[_0x3e5b('0x1d')](respondWithResult(_0x185640,null))[_0x3e5b('0x55')](handleError(_0x185640,null));};exports['destroy']=function(_0x3b3306,_0x30e079,_0x352f7e){var _0x1d7c05;return db['Trunk'][_0x3e5b('0x57')]({'where':{'id':_0x3b3306['params']['id']}})[_0x3e5b('0x1d')](handleEntityNotFound(_0x30e079,null))['then'](removeEntity(_0x30e079,null))[_0x3e5b('0x1d')](function(){return db[_0x3e5b('0x3c')]['findAll']({'raw':!![]});})[_0x3e5b('0x1d')](function(_0x2299b9){var _0x56ff9d=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),'utf8');var _0x53328b=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x3d1193=ejs['render'](_0x56ff9d,{'trunks':_0x2299b9});var _0x5d6aae=ejs[_0x3e5b('0x69')](_0x53328b,{'trunks':_0x2299b9});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x3d1193);fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5d6aae);return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x34'),{'module':_0x3e5b('0x6d')});})['catch'](handleError(_0x30e079,null));}; \ No newline at end of file +var _0xd6d6=['sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','get','Trunks','UserProfileResource','stack','send','index','rawAttributes','fieldName','type','model','map','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','VIRTUAL','filter','merge','options','Trunk','includeAll','include','findAll','rows','show','params','find','clone','omit','createdAt','updatedAt','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','create','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','role','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','client','http','request','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch'];(function(_0x308dfd,_0x4d293b){var _0x23732c=function(_0x241ba0){while(--_0x241ba0){_0x308dfd['push'](_0x308dfd['shift']());}};_0x23732c(++_0x4d293b);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x50229a,_0x18d550){_0x50229a=_0x50229a-0x0;var _0x56e66b=_0xd6d6[_0x50229a];return _0x56e66b;};'use strict';var emlformat=require(_0x6d6d('0x0'));var rimraf=require(_0x6d6d('0x1'));var zipdir=require(_0x6d6d('0x2'));var jsonpatch=require(_0x6d6d('0x3'));var rp=require('request-promise');var moment=require(_0x6d6d('0x4'));var BPromise=require(_0x6d6d('0x5'));var Mustache=require(_0x6d6d('0x6'));var util=require(_0x6d6d('0x7'));var path=require(_0x6d6d('0x8'));var sox=require(_0x6d6d('0x9'));var csv=require(_0x6d6d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d6d('0xb'));var _=require(_0x6d6d('0xc'));var squel=require(_0x6d6d('0xd'));var crypto=require(_0x6d6d('0xe'));var jsforce=require(_0x6d6d('0xf'));var deskjs=require(_0x6d6d('0x10'));var toCsv=require(_0x6d6d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d6d('0x11'));var authService=require(_0x6d6d('0x12'));var qs=require(_0x6d6d('0x13'));var as=require(_0x6d6d('0x14'));var hardwareService=require(_0x6d6d('0x15'));var logger=require('../../config/logger')(_0x6d6d('0x16'));var utils=require(_0x6d6d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d6d('0x18'))['db'];var jayson=require(_0x6d6d('0x19'));var client=jayson[_0x6d6d('0x1a')][_0x6d6d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2b74ed,_0x41fbdf,_0x19cf50,_0x2cb2dd){return new BPromise(function(_0x5f4154,_0xd09ea7){var _0x3dd4b3=_0x2cb2dd||client;return _0x3dd4b3[_0x6d6d('0x1c')](_0x2b74ed,_0x19cf50)[_0x6d6d('0x1d')](function(_0x29cbd8){logger['info'](_0x6d6d('0x1e'),_0x41fbdf,'request\x20sent');logger[_0x6d6d('0x1f')](_0x6d6d('0x20'),_0x41fbdf,_0x6d6d('0x21'),JSON['stringify'](_0x29cbd8));if(_0x29cbd8['error']){if(_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x23')]===0x1f4){logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x29cbd8['error']['message']);return _0xd09ea7(_0x29cbd8[_0x6d6d('0x22')]['message']);}logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x24')]);return _0x5f4154(_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x24')]);}else{logger[_0x6d6d('0x25')](_0x6d6d('0x1e'),_0x41fbdf,_0x6d6d('0x21'));_0x5f4154(_0x29cbd8[_0x6d6d('0x26')][_0x6d6d('0x24')]);}})[_0x6d6d('0x27')](function(_0x466a29){logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x466a29);_0xd09ea7(_0x466a29);});});}function respondWithStatusCode(_0x25a02e,_0xced622){_0xced622=_0xced622||0xcc;return function(_0x583b10){if(_0x583b10){return _0x25a02e[_0x6d6d('0x28')](_0xced622);}return _0x25a02e[_0x6d6d('0x29')](_0xced622)[_0x6d6d('0x2a')]();};}function respondWithResult(_0x97ec9e,_0xf0df7f){_0xf0df7f=_0xf0df7f||0xc8;return function(_0x12fab2){if(_0x12fab2){return _0x97ec9e['status'](_0xf0df7f)[_0x6d6d('0x2b')](_0x12fab2);}};}function respondWithFilteredResult(_0x2b5e31,_0x235451){return function(_0x126ac8){if(_0x126ac8){var _0x25c121=typeof _0x235451[_0x6d6d('0x2c')]===_0x6d6d('0x2d')&&typeof _0x235451['limit']===_0x6d6d('0x2d');var _0x9595d8=_0x126ac8['count'];var _0x553645=_0x25c121?0x0:_0x235451[_0x6d6d('0x2c')];var _0x5273cd=_0x25c121?_0x126ac8[_0x6d6d('0x2e')]:_0x235451['offset']+_0x235451[_0x6d6d('0x2f')];var _0x20255e;if(_0x5273cd>=_0x9595d8){_0x5273cd=_0x9595d8;_0x20255e=0xc8;}else{_0x20255e=0xce;}_0x2b5e31[_0x6d6d('0x29')](_0x20255e);return _0x2b5e31[_0x6d6d('0x30')](_0x6d6d('0x31'),_0x553645+'-'+_0x5273cd+'/'+_0x9595d8)[_0x6d6d('0x2b')](_0x126ac8);}return null;};}function patchUpdates(_0xdda3f2){return function(_0x359cfd){try{jsonpatch[_0x6d6d('0x32')](_0x359cfd,_0xdda3f2,!![]);}catch(_0x34050a){return BPromise['reject'](_0x34050a);}return _0x359cfd[_0x6d6d('0x33')]();};}function saveUpdates(_0x4f1fc5,_0x18015a){return function(_0x1ea9b2){if(_0x1ea9b2){return _0x1ea9b2[_0x6d6d('0x34')](_0x4f1fc5)[_0x6d6d('0x1d')](function(_0x5c6248){return _0x5c6248;});}return null;};}function removeEntity(_0x182441,_0x4f2f13){return function(_0x3cc702){if(_0x3cc702){return _0x3cc702[_0x6d6d('0x35')]()['then'](function(){var _0x37993f=_0x3cc702[_0x6d6d('0x36')]({'plain':!![]});var _0x37ac94=_0x6d6d('0x37');return db[_0x6d6d('0x38')][_0x6d6d('0x35')]({'where':{'type':_0x37ac94,'resourceId':_0x37993f['id']}})[_0x6d6d('0x1d')](function(){return _0x3cc702;});})[_0x6d6d('0x1d')](function(){_0x182441[_0x6d6d('0x29')](0xcc)[_0x6d6d('0x2a')]();});}};}function handleEntityNotFound(_0x2fcf88,_0x3693da){return function(_0x17d863){if(!_0x17d863){_0x2fcf88[_0x6d6d('0x28')](0x194);}return _0x17d863;};}function handleError(_0x5a2397,_0x1335ef){_0x1335ef=_0x1335ef||0x1f4;return function(_0xf98bfa){logger[_0x6d6d('0x22')](_0xf98bfa[_0x6d6d('0x39')]);if(_0xf98bfa['name']){delete _0xf98bfa['name'];}_0x5a2397[_0x6d6d('0x29')](_0x1335ef)[_0x6d6d('0x3a')](_0xf98bfa);};}exports[_0x6d6d('0x3b')]=function(_0x4d42ff,_0x2a3f67){var _0x2607c1={},_0x23c173={},_0x125d79={'count':0x0,'rows':[]};var _0x52556b=_['map'](db['Trunk'][_0x6d6d('0x3c')],function(_0x4196f0){return{'name':_0x4196f0[_0x6d6d('0x3d')],'type':_0x4196f0[_0x6d6d('0x3e')]['key']};});_0x23c173[_0x6d6d('0x3f')]=_[_0x6d6d('0x40')](_0x52556b,_0x6d6d('0x41'));_0x23c173[_0x6d6d('0x42')]=_[_0x6d6d('0x43')](_0x4d42ff[_0x6d6d('0x42')]);_0x23c173['filters']=_[_0x6d6d('0x44')](_0x23c173[_0x6d6d('0x3f')],_0x23c173[_0x6d6d('0x42')]);_0x2607c1[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x23c173[_0x6d6d('0x3f')],qs[_0x6d6d('0x46')](_0x4d42ff['query'][_0x6d6d('0x46')]));_0x2607c1[_0x6d6d('0x45')]=_0x2607c1[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x2607c1[_0x6d6d('0x45')]:_0x23c173['model'];if(!_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x48')]('nolimit')){_0x2607c1[_0x6d6d('0x2f')]=qs['limit'](_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x2f')]);_0x2607c1['offset']=qs[_0x6d6d('0x2c')](_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x2c')]);}_0x2607c1[_0x6d6d('0x49')]=qs[_0x6d6d('0x4a')](_0x4d42ff['query']['sort']);_0x2607c1[_0x6d6d('0x4b')]=qs['filters'](_['pick'](_0x4d42ff[_0x6d6d('0x42')],_0x23c173[_0x6d6d('0x4c')]),_0x52556b);if(_0x4d42ff[_0x6d6d('0x42')]['filter']){_0x2607c1[_0x6d6d('0x4b')]=_['merge'](_0x2607c1[_0x6d6d('0x4b')],{'$or':_[_0x6d6d('0x40')](_0x52556b,function(_0x1d3826){if(_0x1d3826[_0x6d6d('0x3e')]!==_0x6d6d('0x4d')){var _0x2669f0={};_0x2669f0[_0x1d3826[_0x6d6d('0x41')]]={'$like':'%'+_0x4d42ff['query'][_0x6d6d('0x4e')]+'%'};return _0x2669f0;}})});}_0x2607c1=_[_0x6d6d('0x4f')]({},_0x2607c1,_0x4d42ff[_0x6d6d('0x50')]);var _0x389e51={'where':_0x2607c1[_0x6d6d('0x4b')]};return db[_0x6d6d('0x51')][_0x6d6d('0x2e')](_0x389e51)[_0x6d6d('0x1d')](function(_0x24cec2){_0x125d79['count']=_0x24cec2;if(_0x4d42ff['query'][_0x6d6d('0x52')]){_0x2607c1[_0x6d6d('0x53')]=[{'all':!![]}];}return db[_0x6d6d('0x51')][_0x6d6d('0x54')](_0x2607c1);})[_0x6d6d('0x1d')](function(_0x492834){_0x125d79[_0x6d6d('0x55')]=_0x492834;return _0x125d79;})[_0x6d6d('0x1d')](respondWithFilteredResult(_0x2a3f67,_0x2607c1))[_0x6d6d('0x27')](handleError(_0x2a3f67,null));};exports[_0x6d6d('0x56')]=function(_0x2ee917,_0x23c2db){var _0x1f7a09={'raw':![],'where':{'id':_0x2ee917[_0x6d6d('0x57')]['id']}},_0x39ec2a={};_0x39ec2a[_0x6d6d('0x3f')]=_[_0x6d6d('0x43')](db[_0x6d6d('0x51')]['rawAttributes']);_0x39ec2a[_0x6d6d('0x42')]=_[_0x6d6d('0x43')](_0x2ee917[_0x6d6d('0x42')]);_0x39ec2a[_0x6d6d('0x4c')]=_[_0x6d6d('0x44')](_0x39ec2a['model'],_0x39ec2a[_0x6d6d('0x42')]);_0x1f7a09[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x39ec2a['model'],qs['fields'](_0x2ee917[_0x6d6d('0x42')]['fields']));_0x1f7a09[_0x6d6d('0x45')]=_0x1f7a09[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x1f7a09[_0x6d6d('0x45')]:_0x39ec2a[_0x6d6d('0x3f')];if(_0x2ee917[_0x6d6d('0x42')][_0x6d6d('0x52')]){_0x1f7a09[_0x6d6d('0x53')]=[{'all':!![]}];}_0x1f7a09=_[_0x6d6d('0x4f')]({},_0x1f7a09,_0x2ee917[_0x6d6d('0x50')]);return db['Trunk'][_0x6d6d('0x58')](_0x1f7a09)[_0x6d6d('0x1d')](handleEntityNotFound(_0x23c2db,null))[_0x6d6d('0x1d')](respondWithResult(_0x23c2db,null))[_0x6d6d('0x27')](handleError(_0x23c2db,null));};exports[_0x6d6d('0x59')]=function(_0x45f44a,_0x243be3){var _0x5e5ace={'where':{'id':_0x45f44a[_0x6d6d('0x57')]['id']}},_0x5a1cdc={};_0x5a1cdc[_0x6d6d('0x3f')]=_['keys'](db[_0x6d6d('0x51')][_0x6d6d('0x3c')]);_0x5e5ace[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x5a1cdc[_0x6d6d('0x3f')],qs[_0x6d6d('0x46')](_0x45f44a[_0x6d6d('0x42')][_0x6d6d('0x46')]));_0x5e5ace[_0x6d6d('0x45')]=_0x5e5ace[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x5e5ace[_0x6d6d('0x45')]:_0x5a1cdc[_0x6d6d('0x3f')];if(_0x45f44a[_0x6d6d('0x42')][_0x6d6d('0x52')]){_0x5e5ace['include']=[{'all':!![]}];}_0x5e5ace=_[_0x6d6d('0x4f')]({},_0x5e5ace,_0x45f44a[_0x6d6d('0x50')]);return db['Trunk'][_0x6d6d('0x58')](_0x5e5ace)[_0x6d6d('0x1d')](handleEntityNotFound(_0x243be3,null))[_0x6d6d('0x1d')](function(_0x407357){if(_0x407357){var _0x2d61cc=_0x407357[_0x6d6d('0x36')]({'plain':!![]});_0x2d61cc=qs[_0x6d6d('0x5a')](_0x2d61cc,['id',_0x6d6d('0x5b'),_0x6d6d('0x5c')]);_0x45f44a['body']=_['omit'](_0x45f44a[_0x6d6d('0x5d')],['id',_0x6d6d('0x5b'),_0x6d6d('0x5c')]);return db['Trunk']['create'](_[_0x6d6d('0x4f')](_0x2d61cc,_0x45f44a['body']),{'include':_0x45f44a[_0x6d6d('0x42')]['includeAll']?[{'all':!![]}]:undefined})[_0x6d6d('0x1d')](function(_0x367a6f){var _0x21f14c=_0x45f44a[_0x6d6d('0x5e')][_0x6d6d('0x36')]({'plain':!![]});if(!_0x21f14c)throw new Error(_0x6d6d('0x5f'));if(_0x21f14c['role']===_0x6d6d('0x5e')){var _0x5eb78f=_0x367a6f[_0x6d6d('0x36')]({'plain':!![]});var _0x52d9e7=_0x6d6d('0x37');return db[_0x6d6d('0x60')][_0x6d6d('0x58')]({'where':{'name':_0x52d9e7,'userProfileId':_0x21f14c[_0x6d6d('0x61')]},'raw':!![]})[_0x6d6d('0x1d')](function(_0x163bb7){if(_0x163bb7&&_0x163bb7[_0x6d6d('0x62')]===0x0){return db['UserProfileResource']['create']({'name':_0x5eb78f[_0x6d6d('0x41')],'resourceId':_0x5eb78f['id'],'type':_0x163bb7['name'],'sectionId':_0x163bb7['id']},{})[_0x6d6d('0x1d')](function(){return _0x367a6f;});}else{return _0x367a6f;}})['catch'](function(_0xe19d23){logger[_0x6d6d('0x22')](_0x6d6d('0x63'),_0xe19d23);throw _0xe19d23;});}return _0x367a6f;});}})[_0x6d6d('0x1d')](respondWithResult(_0x243be3,0xc9))[_0x6d6d('0x27')](handleError(_0x243be3,null));};exports[_0x6d6d('0x64')]=function(_0x5dd3b0,_0x3cedc0,_0xbca58e){var _0x3a6d79;return db[_0x6d6d('0x51')][_0x6d6d('0x64')](_0x5dd3b0[_0x6d6d('0x5d')],{'raw':!![]})[_0x6d6d('0x1d')](function(_0x589d64){_0x3a6d79=_0x589d64;return db[_0x6d6d('0x51')][_0x6d6d('0x54')]({'raw':!![]});})[_0x6d6d('0x1d')](function(_0x3bf8a7){var _0x1aa25d=fs[_0x6d6d('0x65')](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],_0x6d6d('0x68')),_0x6d6d('0x69'));var _0x1efc55=fs['readFileSync'](path['join'](config[_0x6d6d('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x5b6ca7=ejs[_0x6d6d('0x6a')](_0x1aa25d,{'trunks':_0x3bf8a7||[]});fs[_0x6d6d('0x6b')](_0x6d6d('0x6c'),_0x5b6ca7);if(_0x3a6d79[_0x6d6d('0x6d')]){var _0x2d4a04=ejs[_0x6d6d('0x6a')](_0x1efc55,{'trunks':_0x3bf8a7||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x2d4a04);}})[_0x6d6d('0x1d')](function(){return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});})[_0x6d6d('0x1d')](function(){var _0x5cd494=_0x5dd3b0[_0x6d6d('0x5e')]['get']({'plain':!![]});if(!_0x5cd494)throw new Error(_0x6d6d('0x5f'));if(_0x5cd494[_0x6d6d('0x6e')]==='user'){var _0x52dca9=_0x3a6d79[_0x6d6d('0x36')]({'plain':!![]});return db[_0x6d6d('0x60')][_0x6d6d('0x58')]({'where':{'name':_0x6d6d('0x37'),'userProfileId':_0x5cd494['userProfileId']},'raw':!![]})[_0x6d6d('0x1d')](function(_0x264d24){if(_0x264d24&&_0x264d24[_0x6d6d('0x62')]===0x0){return db[_0x6d6d('0x38')]['create']({'name':_0x52dca9[_0x6d6d('0x41')],'resourceId':_0x52dca9['id'],'type':_0x264d24['name'],'sectionId':_0x264d24['id']},{})['then'](function(){return _0x3a6d79;});}else{return _0x3a6d79;}})['catch'](function(_0x3da125){logger['error'](_0x6d6d('0x63'),_0x3da125);throw _0x3da125;});}return _0x3a6d79;})[_0x6d6d('0x1d')](respondWithResult(_0x3cedc0,0xc9))[_0x6d6d('0x27')](handleError(_0x3cedc0,null));};exports['update']=function(_0x5146a4,_0x55d877,_0xcba8dd){var _0x542386;return db['Trunk'][_0x6d6d('0x58')]({'where':{'id':_0x5146a4[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x1d')](handleEntityNotFound(_0x55d877,null))[_0x6d6d('0x1d')](saveUpdates(_0x5146a4[_0x6d6d('0x5d')],null))[_0x6d6d('0x1d')](function(_0x3f9aad){if(_0x3f9aad){_0x542386=_0x3f9aad;return db['Trunk']['findAll']({'raw':!![]});}})['then'](function(_0x5c20c5){if(_0x5c20c5){var _0x54bdef=fs['readFileSync'](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],_0x6d6d('0x68')),_0x6d6d('0x69'));var _0x59998e=fs['readFileSync'](path['join'](config[_0x6d6d('0x67')],_0x6d6d('0x6f')),_0x6d6d('0x69'));var _0x1c8d15=ejs['render'](_0x54bdef,{'trunks':_0x5c20c5||[]});fs['writeFileSync'](_0x6d6d('0x6c'),_0x1c8d15);var _0x1e1c4e=ejs['render'](_0x59998e,{'trunks':_0x5c20c5||[]});fs[_0x6d6d('0x6b')](_0x6d6d('0x70'),_0x1e1c4e);return respondWithRpcPromise(_0x6d6d('0x71'),_0x6d6d('0x34'),{'module':_0x6d6d('0x72')});}return null;})['then'](function(_0xf5586f){if(_0xf5586f){return _0x542386;}})['then'](respondWithResult(_0x55d877,null))[_0x6d6d('0x27')](handleError(_0x55d877,null));};exports['destroy']=function(_0x108108,_0x54a5a9,_0x445196){var _0x1bfce6;return db[_0x6d6d('0x51')][_0x6d6d('0x58')]({'where':{'id':_0x108108[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x1d')](handleEntityNotFound(_0x54a5a9,null))[_0x6d6d('0x1d')](removeEntity(_0x54a5a9,null))[_0x6d6d('0x1d')](function(){return db[_0x6d6d('0x51')][_0x6d6d('0x54')]({'raw':!![]});})[_0x6d6d('0x1d')](function(_0xb2940d){var _0x7c1934=fs[_0x6d6d('0x65')](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],'server/files/templates/trunk.ejs'),'utf8');var _0x139b61=fs['readFileSync'](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x1d2668=ejs['render'](_0x7c1934,{'trunks':_0xb2940d});var _0x2ab52f=ejs[_0x6d6d('0x6a')](_0x139b61,{'trunks':_0xb2940d});fs[_0x6d6d('0x6b')](_0x6d6d('0x6c'),_0x1d2668);fs[_0x6d6d('0x6b')](_0x6d6d('0x70'),_0x2ab52f);return respondWithRpcPromise(_0x6d6d('0x71'),_0x6d6d('0x35'),{'module':'chan_sip.so'});})[_0x6d6d('0x27')](handleError(_0x54a5a9,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 2d19419..8685fe6 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 _0x85a1=['tools_trunks','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','define','Trunk'];(function(_0x51e122,_0x5d27d5){var _0x374a80=function(_0x565df0){while(--_0x565df0){_0x51e122['push'](_0x51e122['shift']());}};_0x374a80(++_0x5d27d5);}(_0x85a1,0x90));var _0x185a=function(_0x2509e0,_0x64310e){_0x2509e0=_0x2509e0-0x0;var _0x7bcee8=_0x85a1[_0x2509e0];return _0x7bcee8;};'use strict';var _=require('lodash');var util=require(_0x185a('0x0'));var logger=require(_0x185a('0x1'))(_0x185a('0x2'));var moment=require(_0x185a('0x3'));var BPromise=require(_0x185a('0x4'));var rp=require(_0x185a('0x5'));var fs=require('fs');var path=require(_0x185a('0x6'));var rimraf=require(_0x185a('0x7'));var config=require(_0x185a('0x8'));var attributes=require(_0x185a('0x9'));module['exports']=function(_0x4a9e24,_0x3a739d){return _0x4a9e24[_0x185a('0xa')](_0x185a('0xb'),attributes,{'tableName':_0x185a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85d7=['define','lodash','util','api','request-promise','../../config/environment','exports'];(function(_0x4cd68c,_0x5ca7e4){var _0x1f5bad=function(_0x67d294){while(--_0x67d294){_0x4cd68c['push'](_0x4cd68c['shift']());}};_0x1f5bad(++_0x5ca7e4);}(_0x85d7,0x86));var _0x785d=function(_0x294b6,_0x2907ae){_0x294b6=_0x294b6-0x0;var _0x38bb97=_0x85d7[_0x294b6];return _0x38bb97;};'use strict';var _=require(_0x785d('0x0'));var util=require(_0x785d('0x1'));var logger=require('../../config/logger')(_0x785d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x785d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x785d('0x4'));var attributes=require('./trunk.attributes');module[_0x785d('0x5')]=function(_0x39aff7,_0x537702){return _0x39aff7[_0x785d('0x6')]('Trunk',attributes,{'tableName':'tools_trunks','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 ca6b585..cefc23e 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 _0x346d=['Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTrunk','options','raw','where','limit','include','map','model','attributes','find','ShowTrunk','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x346d,0x191));var _0xd346=function(_0x158d88,_0x489365){_0x158d88=_0x158d88-0x0;var _0x22e983=_0x346d[_0x158d88];return _0x22e983;};'use strict';var _=require(_0xd346('0x0'));var util=require(_0xd346('0x1'));var moment=require('moment');var BPromise=require(_0xd346('0x2'));var rs=require(_0xd346('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd346('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd346('0x5'))('rpc');var config=require(_0xd346('0x6'));var jayson=require(_0xd346('0x7'));var client=jayson['client'][_0xd346('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d2374,_0xf87e39,_0x3f7a30){return new BPromise(function(_0x19a26a,_0x4cc10a){return client[_0xd346('0x9')](_0x3d2374,_0x3f7a30)[_0xd346('0xa')](function(_0x252f6e){logger[_0xd346('0xb')](_0xd346('0xc'),_0xf87e39,_0xd346('0xd'));logger[_0xd346('0xe')](_0xd346('0xf'),_0xf87e39,'request\x20sent',JSON[_0xd346('0x10')](_0x252f6e));if(_0x252f6e[_0xd346('0x11')]){if(_0x252f6e['error'][_0xd346('0x12')]===0x1f4){logger[_0xd346('0x11')](_0xd346('0xc'),_0xf87e39,_0x252f6e[_0xd346('0x11')][_0xd346('0x13')]);return _0x4cc10a(_0x252f6e[_0xd346('0x11')][_0xd346('0x13')]);}logger['error'](_0xd346('0xc'),_0xf87e39,_0x252f6e[_0xd346('0x11')][_0xd346('0x13')]);return _0x19a26a(_0x252f6e[_0xd346('0x11')][_0xd346('0x13')]);}else{logger['info'](_0xd346('0xc'),_0xf87e39,'request\x20sent');_0x19a26a(_0x252f6e['result'][_0xd346('0x13')]);}})[_0xd346('0x14')](function(_0x2e5e49){logger[_0xd346('0x11')](_0xd346('0xc'),_0xf87e39,_0x2e5e49);_0x4cc10a(_0x2e5e49);});});}exports[_0xd346('0x15')]=function(_0x1d18fa){var _0x4ce67f=this;return new Promise(function(_0x3a778f,_0x18e227){return db['Trunk']['findAll']({'raw':_0x1d18fa[_0xd346('0x16')]?_0x1d18fa[_0xd346('0x16')][_0xd346('0x17')]===undefined?!![]:![]:!![],'where':_0x1d18fa[_0xd346('0x16')]?_0x1d18fa[_0xd346('0x16')][_0xd346('0x18')]||null:null,'attributes':_0x1d18fa[_0xd346('0x16')]?_0x1d18fa[_0xd346('0x16')]['attributes']||null:null,'limit':_0x1d18fa[_0xd346('0x16')]?_0x1d18fa['options'][_0xd346('0x19')]||null:null,'include':_0x1d18fa['options']?_0x1d18fa['options'][_0xd346('0x1a')]?_[_0xd346('0x1b')](_0x1d18fa[_0xd346('0x16')][_0xd346('0x1a')],function(_0x2950c4){return{'model':db[_0x2950c4[_0xd346('0x1c')]],'as':_0x2950c4['as'],'attributes':_0x2950c4[_0xd346('0x1d')],'include':_0x2950c4[_0xd346('0x1a')]?_[_0xd346('0x1b')](_0x2950c4['include'],function(_0x1d262e){return{'model':db[_0x1d262e[_0xd346('0x1c')]],'as':_0x1d262e['as'],'attributes':_0x1d262e[_0xd346('0x1d')],'include':_0x1d262e['include']?_[_0xd346('0x1b')](_0x1d262e[_0xd346('0x1a')],function(_0x26a3ff){return{'model':db[_0x26a3ff['model']],'as':_0x26a3ff['as'],'attributes':_0x26a3ff[_0xd346('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47796d){logger['info'](_0xd346('0x15'),_0x1d18fa);logger[_0xd346('0xe')](_0xd346('0x15'),_0x1d18fa,JSON[_0xd346('0x10')](_0x47796d));_0x3a778f(_0x47796d);})['catch'](function(_0x16cf6a){logger['error'](_0xd346('0x15'),_0x16cf6a['message'],_0x1d18fa);_0x18e227(_0x4ce67f['error'](0x1f4,_0x16cf6a['message']));});});};exports['ShowTrunk']=function(_0x323ab0){var _0x48af19=this;return new Promise(function(_0x3070dc,_0x43962c){return db['Trunk'][_0xd346('0x1e')]({'raw':_0x323ab0[_0xd346('0x16')]?_0x323ab0[_0xd346('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x323ab0[_0xd346('0x16')]?_0x323ab0[_0xd346('0x16')][_0xd346('0x18')]||null:null,'attributes':_0x323ab0[_0xd346('0x16')]?_0x323ab0[_0xd346('0x16')][_0xd346('0x1d')]||null:null,'include':_0x323ab0['options']?_0x323ab0[_0xd346('0x16')][_0xd346('0x1a')]?_[_0xd346('0x1b')](_0x323ab0[_0xd346('0x16')][_0xd346('0x1a')],function(_0x5d97e8){return{'model':db[_0x5d97e8[_0xd346('0x1c')]],'as':_0x5d97e8['as'],'attributes':_0x5d97e8[_0xd346('0x1d')],'include':_0x5d97e8[_0xd346('0x1a')]?_[_0xd346('0x1b')](_0x5d97e8[_0xd346('0x1a')],function(_0x3cb04b){return{'model':db[_0x3cb04b[_0xd346('0x1c')]],'as':_0x3cb04b['as'],'attributes':_0x3cb04b[_0xd346('0x1d')],'include':_0x3cb04b[_0xd346('0x1a')]?_[_0xd346('0x1b')](_0x3cb04b[_0xd346('0x1a')],function(_0x550159){return{'model':db[_0x550159['model']],'as':_0x550159['as'],'attributes':_0x550159[_0xd346('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd346('0xa')](function(_0x366b87){logger[_0xd346('0xb')](_0xd346('0x1f'),_0x323ab0);logger[_0xd346('0xe')]('ShowTrunk',_0x323ab0,JSON[_0xd346('0x10')](_0x366b87));_0x3070dc(_0x366b87);})[_0xd346('0x14')](function(_0x133323){logger['error'](_0xd346('0x1f'),_0x133323[_0xd346('0x13')],_0x323ab0);_0x43962c(_0x48af19[_0xd346('0x11')](0x1f4,_0x133323[_0xd346('0x13')]));});});}; \ No newline at end of file +var _0xa33d=['stringify','error','code','message','request\x20sent','result','catch','GetTrunk','findAll','options','raw','attributes','limit','include','map','model','find','where','ShowTrunk','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa33d,0x1e1));var _0xda33=function(_0x18a4ac,_0x2fbebf){_0x18a4ac=_0x18a4ac-0x0;var _0x2c9113=_0xa33d[_0x18a4ac];return _0x2c9113;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xda33('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda33('0x1'));var db=require(_0xda33('0x2'))['db'];var utils=require(_0xda33('0x3'));var logger=require(_0xda33('0x4'))('rpc');var config=require(_0xda33('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xda33('0x6')][_0xda33('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x33ab4a,_0x356a05,_0x546eae){return new BPromise(function(_0x118695,_0x109675){return client[_0xda33('0x8')](_0x33ab4a,_0x546eae)[_0xda33('0x9')](function(_0x3e4bac){logger[_0xda33('0xa')](_0xda33('0xb'),_0x356a05,'request\x20sent');logger[_0xda33('0xc')](_0xda33('0xd'),_0x356a05,'request\x20sent',JSON[_0xda33('0xe')](_0x3e4bac));if(_0x3e4bac[_0xda33('0xf')]){if(_0x3e4bac[_0xda33('0xf')][_0xda33('0x10')]===0x1f4){logger[_0xda33('0xf')](_0xda33('0xb'),_0x356a05,_0x3e4bac[_0xda33('0xf')][_0xda33('0x11')]);return _0x109675(_0x3e4bac[_0xda33('0xf')]['message']);}logger[_0xda33('0xf')](_0xda33('0xb'),_0x356a05,_0x3e4bac[_0xda33('0xf')]['message']);return _0x118695(_0x3e4bac[_0xda33('0xf')][_0xda33('0x11')]);}else{logger[_0xda33('0xa')]('Trunk,\x20%s,\x20%s',_0x356a05,_0xda33('0x12'));_0x118695(_0x3e4bac[_0xda33('0x13')][_0xda33('0x11')]);}})[_0xda33('0x14')](function(_0x25fbf9){logger[_0xda33('0xf')](_0xda33('0xb'),_0x356a05,_0x25fbf9);_0x109675(_0x25fbf9);});});}exports[_0xda33('0x15')]=function(_0x22d02b){var _0x324571=this;return new Promise(function(_0x79f728,_0x5e2fef){return db['Trunk'][_0xda33('0x16')]({'raw':_0x22d02b['options']?_0x22d02b[_0xda33('0x17')][_0xda33('0x18')]===undefined?!![]:![]:!![],'where':_0x22d02b[_0xda33('0x17')]?_0x22d02b[_0xda33('0x17')]['where']||null:null,'attributes':_0x22d02b[_0xda33('0x17')]?_0x22d02b['options'][_0xda33('0x19')]||null:null,'limit':_0x22d02b[_0xda33('0x17')]?_0x22d02b[_0xda33('0x17')][_0xda33('0x1a')]||null:null,'include':_0x22d02b[_0xda33('0x17')]?_0x22d02b[_0xda33('0x17')][_0xda33('0x1b')]?_[_0xda33('0x1c')](_0x22d02b[_0xda33('0x17')]['include'],function(_0x5424a4){return{'model':db[_0x5424a4[_0xda33('0x1d')]],'as':_0x5424a4['as'],'attributes':_0x5424a4['attributes'],'include':_0x5424a4[_0xda33('0x1b')]?_[_0xda33('0x1c')](_0x5424a4[_0xda33('0x1b')],function(_0x29b57f){return{'model':db[_0x29b57f['model']],'as':_0x29b57f['as'],'attributes':_0x29b57f[_0xda33('0x19')],'include':_0x29b57f['include']?_[_0xda33('0x1c')](_0x29b57f[_0xda33('0x1b')],function(_0x376b86){return{'model':db[_0x376b86[_0xda33('0x1d')]],'as':_0x376b86['as'],'attributes':_0x376b86[_0xda33('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f17b1){logger[_0xda33('0xa')](_0xda33('0x15'),_0x22d02b);logger[_0xda33('0xc')]('GetTrunk',_0x22d02b,JSON[_0xda33('0xe')](_0x4f17b1));_0x79f728(_0x4f17b1);})[_0xda33('0x14')](function(_0x5495d8){logger['error']('GetTrunk',_0x5495d8[_0xda33('0x11')],_0x22d02b);_0x5e2fef(_0x324571['error'](0x1f4,_0x5495d8['message']));});});};exports['ShowTrunk']=function(_0x56b6b6){var _0x332ce2=this;return new Promise(function(_0x445352,_0x563162){return db['Trunk'][_0xda33('0x1e')]({'raw':_0x56b6b6[_0xda33('0x17')]?_0x56b6b6[_0xda33('0x17')][_0xda33('0x18')]===undefined?!![]:![]:!![],'where':_0x56b6b6[_0xda33('0x17')]?_0x56b6b6[_0xda33('0x17')][_0xda33('0x1f')]||null:null,'attributes':_0x56b6b6[_0xda33('0x17')]?_0x56b6b6['options'][_0xda33('0x19')]||null:null,'include':_0x56b6b6[_0xda33('0x17')]?_0x56b6b6[_0xda33('0x17')][_0xda33('0x1b')]?_['map'](_0x56b6b6[_0xda33('0x17')][_0xda33('0x1b')],function(_0x3b049d){return{'model':db[_0x3b049d[_0xda33('0x1d')]],'as':_0x3b049d['as'],'attributes':_0x3b049d[_0xda33('0x19')],'include':_0x3b049d['include']?_['map'](_0x3b049d[_0xda33('0x1b')],function(_0x59281c){return{'model':db[_0x59281c[_0xda33('0x1d')]],'as':_0x59281c['as'],'attributes':_0x59281c['attributes'],'include':_0x59281c['include']?_['map'](_0x59281c[_0xda33('0x1b')],function(_0x59e19f){return{'model':db[_0x59e19f[_0xda33('0x1d')]],'as':_0x59e19f['as'],'attributes':_0x59e19f[_0xda33('0x19')]};}):[]};}):[]};}):[]:[]})[_0xda33('0x9')](function(_0x632031){logger['info']('ShowTrunk',_0x56b6b6);logger[_0xda33('0xc')](_0xda33('0x20'),_0x56b6b6,JSON['stringify'](_0x632031));_0x445352(_0x632031);})['catch'](function(_0x2a2733){logger[_0xda33('0xf')](_0xda33('0x20'),_0x2a2733[_0xda33('0x11')],_0x56b6b6);_0x563162(_0x332ce2[_0xda33('0xf')](0x1f4,_0x2a2733[_0xda33('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 4fae1f2..d86f6c2 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 _0x73a2=['express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','whoami','/presence','/:id','show','/:id/avatar','getOpenTabs','/:id/contacts','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','getLists','/:id/agents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','/:id/api_key','post','create','/create_many','bulkCreate','/:id/queues','addQueues','diskStorage','join','server/files/images/','format','%s-%s','now','originalname','file','/:id/login','login','logout','/:id/pause','pause','/:id/teams','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','update','/:id/password','changePassword','removeQueues','delete','destroy','removeChatInteractions','removeFaxInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','exports','multer','util','path','connect-timeout'];(function(_0x582d74,_0x1d54d8){var _0x46f7fc=function(_0x527205){while(--_0x527205){_0x582d74['push'](_0x582d74['shift']());}};_0x46f7fc(++_0x1d54d8);}(_0x73a2,0x6d));var _0x273a=function(_0x32c718,_0x58ef99){_0x32c718=_0x32c718-0x0;var _0x3febe8=_0x73a2[_0x32c718];return _0x3febe8;};'use strict';var multer=require(_0x273a('0x0'));var util=require(_0x273a('0x1'));var path=require(_0x273a('0x2'));var timeout=require(_0x273a('0x3'));var express=require(_0x273a('0x4'));var router=express['Router']();var fs_extra=require(_0x273a('0x5'));var auth=require(_0x273a('0x6'));var interaction=require(_0x273a('0x7'));var config=require('../../config/environment');var controller=require('./user.controller');router[_0x273a('0x8')]('/',auth[_0x273a('0x9')](),controller[_0x273a('0xa')]);router[_0x273a('0x8')](_0x273a('0xb'),auth[_0x273a('0x9')](),controller[_0x273a('0xc')]);router[_0x273a('0x8')]('/whoami',auth['isAuthenticated'](),controller[_0x273a('0xd')]);router['get'](_0x273a('0xe'),auth[_0x273a('0x9')](),controller['getPresence']);router[_0x273a('0x8')](_0x273a('0xf'),auth[_0x273a('0x9')](),controller[_0x273a('0x10')]);router[_0x273a('0x8')](_0x273a('0x11'),controller['getAvatar']);router[_0x273a('0x8')]('/:id/open_tabs',auth['isAuthenticated'](),controller[_0x273a('0x12')]);router[_0x273a('0x8')](_0x273a('0x13'),auth[_0x273a('0x9')](),controller[_0x273a('0x14')]);router[_0x273a('0x8')]('/:id/queues',auth[_0x273a('0x9')](),controller[_0x273a('0x15')]);router[_0x273a('0x8')](_0x273a('0x16'),auth['isAuthenticated'](),controller[_0x273a('0x17')]);router['get'](_0x273a('0x18'),auth[_0x273a('0x9')](),controller[_0x273a('0x19')]);router['get'](_0x273a('0x1a'),auth[_0x273a('0x9')](),controller['getRecordings']);router[_0x273a('0x8')](_0x273a('0x1b'),auth[_0x273a('0x9')](),controller['getScreenRecordings']);router['get'](_0x273a('0x1c'),auth['isAuthenticated'](),controller[_0x273a('0x1d')]);router[_0x273a('0x8')](_0x273a('0x1e'),auth['isAuthenticated'](),controller[_0x273a('0x1f')]);router[_0x273a('0x8')](_0x273a('0x20'),auth[_0x273a('0x9')](),controller[_0x273a('0x21')]);router[_0x273a('0x8')](_0x273a('0x22'),auth[_0x273a('0x9')](),controller[_0x273a('0x23')]);router['get'](_0x273a('0x24'),auth[_0x273a('0x9')](),controller[_0x273a('0x25')]);router['get'](_0x273a('0x26'),auth['isAuthenticated'](),controller[_0x273a('0x27')]);router['get']('/:id/teams',auth[_0x273a('0x9')](),controller[_0x273a('0x28')]);router[_0x273a('0x8')](_0x273a('0x29'),auth['isAuthenticated'](),controller[_0x273a('0x2a')]);router['get'](_0x273a('0x2b'),auth['isAuthenticated'](),controller['getAgents']);router[_0x273a('0x8')](_0x273a('0x2c'),auth['isAuthenticated'](),controller[_0x273a('0x2d')]);router[_0x273a('0x8')](_0x273a('0x2e'),auth[_0x273a('0x9')](),controller[_0x273a('0x2f')]);router['get'](_0x273a('0x30'),auth[_0x273a('0x9')](),controller[_0x273a('0x31')]);router[_0x273a('0x8')](_0x273a('0x32'),auth[_0x273a('0x9')](),controller[_0x273a('0x33')]);router['get'](_0x273a('0x34'),auth[_0x273a('0x9')](),controller[_0x273a('0x35')]);router[_0x273a('0x8')](_0x273a('0x36'),auth[_0x273a('0x9')](),controller[_0x273a('0x37')]);router[_0x273a('0x8')](_0x273a('0x38'),auth[_0x273a('0x9')](),controller[_0x273a('0x39')]);router[_0x273a('0x8')](_0x273a('0x3a'),auth[_0x273a('0x9')](),controller[_0x273a('0x3b')]);router['get'](_0x273a('0x3c'),auth['isAuthenticated'](),controller['getScheduledCalls']);router['get'](_0x273a('0x3d'),auth[_0x273a('0x9')](),controller['getApiKey']);router[_0x273a('0x3e')](_0x273a('0x13'),auth[_0x273a('0x9')](),controller['addContacts']);router[_0x273a('0x3e')]('/',auth[_0x273a('0x9')](),controller[_0x273a('0x3f')]);router[_0x273a('0x3e')](_0x273a('0x40'),auth[_0x273a('0x9')](),controller[_0x273a('0x41')]);router[_0x273a('0x3e')](_0x273a('0x42'),auth['isAuthenticated'](),controller[_0x273a('0x43')]);var upload=multer({'storage':multer[_0x273a('0x44')]({'destination':function(_0x336308,_0x178c90,_0x5e541a){_0x5e541a(null,path[_0x273a('0x45')](config['root'],_0x273a('0x46')));},'filename':function(_0x240d94,_0x56d9a0,_0x391ac2){_0x391ac2(null,util[_0x273a('0x47')](_0x273a('0x48'),Date[_0x273a('0x49')](),_0x56d9a0[_0x273a('0x4a')]));}})});router[_0x273a('0x3e')](_0x273a('0x11'),upload['single'](_0x273a('0x4b')),controller['addAvatar']);router[_0x273a('0x3e')](_0x273a('0x4c'),auth['isAuthenticated'](),controller[_0x273a('0x4d')]);router[_0x273a('0x3e')]('/:id/logout',auth['isAuthenticated'](),controller[_0x273a('0x4e')]);router[_0x273a('0x3e')](_0x273a('0x4f'),auth[_0x273a('0x9')](),controller[_0x273a('0x50')]);router['post']('/:id/unpause',auth['isAuthenticated'](),controller['unpause']);router[_0x273a('0x3e')](_0x273a('0x51'),auth[_0x273a('0x9')](),controller['addTeams']);router[_0x273a('0x3e')]('/:id/chat_interactions',auth[_0x273a('0x9')](),controller[_0x273a('0x52')]);router[_0x273a('0x3e')](_0x273a('0x53'),auth[_0x273a('0x9')](),controller['addMailInteractions']);router[_0x273a('0x3e')](_0x273a('0x54'),auth[_0x273a('0x9')](),controller[_0x273a('0x55')]);router[_0x273a('0x3e')](_0x273a('0x56'),auth['isAuthenticated'](),controller['addSmsInteractions']);router[_0x273a('0x3e')](_0x273a('0x57'),auth[_0x273a('0x9')](),controller[_0x273a('0x58')]);router[_0x273a('0x3e')](_0x273a('0x59'),auth[_0x273a('0x9')](),controller[_0x273a('0x5a')]);router[_0x273a('0x3e')](_0x273a('0x2e'),auth['isAuthenticated'](),controller[_0x273a('0x5b')]);router[_0x273a('0x3e')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x273a('0x5c')]);router[_0x273a('0x3e')](_0x273a('0x32'),auth['isAuthenticated'](),controller[_0x273a('0x5d')]);router['post'](_0x273a('0x34'),auth[_0x273a('0x9')](),controller['addSmsAccounts']);router['post'](_0x273a('0x36'),auth['isAuthenticated'](),controller[_0x273a('0x5e')]);router[_0x273a('0x3e')](_0x273a('0x38'),auth[_0x273a('0x9')](),controller[_0x273a('0x5f')]);router[_0x273a('0x3e')](_0x273a('0x3a'),auth['isAuthenticated'](),controller[_0x273a('0x60')]);router[_0x273a('0x3e')](_0x273a('0x3d'),auth['isAuthenticated'](),controller['createApiKey']);router['put']('/:id',auth[_0x273a('0x9')](),controller[_0x273a('0x61')]);router['put'](_0x273a('0x62'),auth[_0x273a('0x9')](),controller[_0x273a('0x63')]);router['delete'](_0x273a('0x42'),auth[_0x273a('0x9')](),controller[_0x273a('0x64')]);router[_0x273a('0x65')]('/:id/teams',auth[_0x273a('0x9')](),controller['removeTeams']);router[_0x273a('0x65')](_0x273a('0xf'),auth[_0x273a('0x9')](),controller[_0x273a('0x66')]);router[_0x273a('0x65')]('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0x273a('0x67')]);router[_0x273a('0x65')]('/:id/mail_interactions',auth[_0x273a('0x9')](),controller['removeMailInteractions']);router['delete'](_0x273a('0x54'),auth['isAuthenticated'](),controller[_0x273a('0x68')]);router[_0x273a('0x65')]('/:id/sms_interactions',auth['isAuthenticated'](),controller['removeSmsInteractions']);router[_0x273a('0x65')](_0x273a('0x57'),auth[_0x273a('0x9')](),controller[_0x273a('0x69')]);router['delete'](_0x273a('0x59'),auth[_0x273a('0x9')](),controller[_0x273a('0x6a')]);router[_0x273a('0x65')](_0x273a('0x2e'),auth[_0x273a('0x9')](),controller[_0x273a('0x6b')]);router['delete'](_0x273a('0x30'),auth[_0x273a('0x9')](),controller['removeMailAccounts']);router['delete']('/:id/openchannel_accounts',auth[_0x273a('0x9')](),controller[_0x273a('0x6c')]);router[_0x273a('0x65')](_0x273a('0x34'),auth[_0x273a('0x9')](),controller[_0x273a('0x6d')]);router['delete'](_0x273a('0x36'),auth[_0x273a('0x9')](),controller[_0x273a('0x6e')]);router[_0x273a('0x65')](_0x273a('0x38'),auth['isAuthenticated'](),controller['removeWhatsappAccounts']);router[_0x273a('0x65')]('/:id/square_projects',auth[_0x273a('0x9')](),controller[_0x273a('0x6f')]);router[_0x273a('0x65')](_0x273a('0x3d'),auth[_0x273a('0x9')](),controller['removeApiKey']);module[_0x273a('0x70')]=router; \ No newline at end of file +var _0x9463=['getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','getSquareProjects','getScheduledCalls','addContacts','post','create','bulkCreate','/:id/queues','addQueues','join','root','server/files/images/','format','%s-%s','single','file','/:id/login','login','logout','/:id/pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','/:id/openchannel_accounts','/:id/sms_accounts','addSmsAccounts','addWhatsappAccounts','/:id/api_key','createApiKey','update','put','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','/:id/fax_interactions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','index','/describe','isAuthenticated','describe','/whoami','whoami','/presence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9463,0x1a6));var _0x3946=function(_0x7ec1b2,_0x2b38e1){_0x7ec1b2=_0x7ec1b2-0x0;var _0x5a1e9f=_0x9463[_0x7ec1b2];return _0x5a1e9f;};'use strict';var multer=require(_0x3946('0x0'));var util=require('util');var path=require(_0x3946('0x1'));var timeout=require('connect-timeout');var express=require(_0x3946('0x2'));var router=express[_0x3946('0x3')]();var fs_extra=require(_0x3946('0x4'));var auth=require(_0x3946('0x5'));var interaction=require(_0x3946('0x6'));var config=require(_0x3946('0x7'));var controller=require(_0x3946('0x8'));router[_0x3946('0x9')]('/',auth['isAuthenticated'](),controller[_0x3946('0xa')]);router[_0x3946('0x9')](_0x3946('0xb'),auth[_0x3946('0xc')](),controller[_0x3946('0xd')]);router['get'](_0x3946('0xe'),auth['isAuthenticated'](),controller[_0x3946('0xf')]);router[_0x3946('0x9')](_0x3946('0x10'),auth[_0x3946('0xc')](),controller['getPresence']);router['get'](_0x3946('0x11'),auth['isAuthenticated'](),controller[_0x3946('0x12')]);router['get'](_0x3946('0x13'),controller[_0x3946('0x14')]);router[_0x3946('0x9')](_0x3946('0x15'),auth[_0x3946('0xc')](),controller[_0x3946('0x16')]);router[_0x3946('0x9')](_0x3946('0x17'),auth[_0x3946('0xc')](),controller['getContacts']);router['get']('/:id/queues',auth[_0x3946('0xc')](),controller['getQueues']);router['get'](_0x3946('0x18'),auth['isAuthenticated'](),controller[_0x3946('0x19')]);router[_0x3946('0x9')](_0x3946('0x1a'),auth[_0x3946('0xc')](),controller['getGroups']);router[_0x3946('0x9')](_0x3946('0x1b'),auth['isAuthenticated'](),controller['getRecordings']);router[_0x3946('0x9')](_0x3946('0x1c'),auth['isAuthenticated'](),controller[_0x3946('0x1d')]);router['get'](_0x3946('0x1e'),auth[_0x3946('0xc')](),controller['getChatInteractions']);router[_0x3946('0x9')](_0x3946('0x1f'),auth[_0x3946('0xc')](),controller[_0x3946('0x20')]);router[_0x3946('0x9')](_0x3946('0x21'),auth[_0x3946('0xc')](),controller[_0x3946('0x22')]);router['get'](_0x3946('0x23'),auth[_0x3946('0xc')](),controller[_0x3946('0x24')]);router[_0x3946('0x9')](_0x3946('0x25'),auth[_0x3946('0xc')](),controller[_0x3946('0x26')]);router['get'](_0x3946('0x27'),auth[_0x3946('0xc')](),controller[_0x3946('0x28')]);router[_0x3946('0x9')](_0x3946('0x29'),auth['isAuthenticated'](),controller['getTeams']);router[_0x3946('0x9')](_0x3946('0x2a'),auth[_0x3946('0xc')](),controller[_0x3946('0x2b')]);router[_0x3946('0x9')](_0x3946('0x2c'),auth[_0x3946('0xc')](),controller[_0x3946('0x2d')]);router[_0x3946('0x9')](_0x3946('0x2e'),auth[_0x3946('0xc')](),controller[_0x3946('0x2f')]);router[_0x3946('0x9')]('/:id/fax_accounts',auth[_0x3946('0xc')](),controller[_0x3946('0x30')]);router[_0x3946('0x9')](_0x3946('0x31'),auth[_0x3946('0xc')](),controller[_0x3946('0x32')]);router['get']('/:id/openchannel_accounts',auth[_0x3946('0xc')](),controller[_0x3946('0x33')]);router[_0x3946('0x9')]('/:id/sms_accounts',auth[_0x3946('0xc')](),controller[_0x3946('0x34')]);router[_0x3946('0x9')](_0x3946('0x35'),auth[_0x3946('0xc')](),controller[_0x3946('0x36')]);router['get'](_0x3946('0x37'),auth[_0x3946('0xc')](),controller['getWhatsappAccounts']);router['get'](_0x3946('0x38'),auth['isAuthenticated'](),controller[_0x3946('0x39')]);router[_0x3946('0x9')]('/:id/scheduled_calls',auth[_0x3946('0xc')](),controller[_0x3946('0x3a')]);router[_0x3946('0x9')]('/:id/api_key',auth[_0x3946('0xc')](),controller['getApiKey']);router['post']('/:id/contacts',auth[_0x3946('0xc')](),controller[_0x3946('0x3b')]);router[_0x3946('0x3c')]('/',auth[_0x3946('0xc')](),controller[_0x3946('0x3d')]);router[_0x3946('0x3c')]('/create_many',auth[_0x3946('0xc')](),controller[_0x3946('0x3e')]);router[_0x3946('0x3c')](_0x3946('0x3f'),auth[_0x3946('0xc')](),controller[_0x3946('0x40')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x48f143,_0x16de45,_0x50bdef){_0x50bdef(null,path[_0x3946('0x41')](config[_0x3946('0x42')],_0x3946('0x43')));},'filename':function(_0x4981bf,_0x1bd7e4,_0x5bff2a){_0x5bff2a(null,util[_0x3946('0x44')](_0x3946('0x45'),Date['now'](),_0x1bd7e4['originalname']));}})});router['post'](_0x3946('0x13'),upload[_0x3946('0x46')](_0x3946('0x47')),controller['addAvatar']);router[_0x3946('0x3c')](_0x3946('0x48'),auth[_0x3946('0xc')](),controller[_0x3946('0x49')]);router['post']('/:id/logout',auth[_0x3946('0xc')](),controller[_0x3946('0x4a')]);router['post'](_0x3946('0x4b'),auth[_0x3946('0xc')](),controller['pause']);router[_0x3946('0x3c')](_0x3946('0x4c'),auth['isAuthenticated'](),controller[_0x3946('0x4d')]);router[_0x3946('0x3c')](_0x3946('0x29'),auth[_0x3946('0xc')](),controller['addTeams']);router[_0x3946('0x3c')](_0x3946('0x4e'),auth[_0x3946('0xc')](),controller[_0x3946('0x4f')]);router[_0x3946('0x3c')](_0x3946('0x50'),auth[_0x3946('0xc')](),controller[_0x3946('0x51')]);router[_0x3946('0x3c')]('/:id/fax_interactions',auth[_0x3946('0xc')](),controller[_0x3946('0x52')]);router['post']('/:id/sms_interactions',auth[_0x3946('0xc')](),controller[_0x3946('0x53')]);router['post'](_0x3946('0x54'),auth[_0x3946('0xc')](),controller[_0x3946('0x55')]);router[_0x3946('0x3c')](_0x3946('0x56'),auth['isAuthenticated'](),controller[_0x3946('0x57')]);router[_0x3946('0x3c')](_0x3946('0x58'),auth['isAuthenticated'](),controller[_0x3946('0x59')]);router[_0x3946('0x3c')](_0x3946('0x31'),auth[_0x3946('0xc')](),controller['addMailAccounts']);router[_0x3946('0x3c')](_0x3946('0x5a'),auth[_0x3946('0xc')](),controller['addOpenchannelAccounts']);router[_0x3946('0x3c')](_0x3946('0x5b'),auth['isAuthenticated'](),controller[_0x3946('0x5c')]);router[_0x3946('0x3c')](_0x3946('0x35'),auth[_0x3946('0xc')](),controller['addChatWebsites']);router[_0x3946('0x3c')](_0x3946('0x37'),auth['isAuthenticated'](),controller[_0x3946('0x5d')]);router[_0x3946('0x3c')](_0x3946('0x38'),auth[_0x3946('0xc')](),controller['addSquareProjects']);router[_0x3946('0x3c')](_0x3946('0x5e'),auth[_0x3946('0xc')](),controller[_0x3946('0x5f')]);router['put'](_0x3946('0x11'),auth[_0x3946('0xc')](),controller[_0x3946('0x60')]);router[_0x3946('0x61')](_0x3946('0x62'),auth['isAuthenticated'](),controller[_0x3946('0x63')]);router[_0x3946('0x64')](_0x3946('0x3f'),auth['isAuthenticated'](),controller[_0x3946('0x65')]);router[_0x3946('0x64')]('/:id/teams',auth[_0x3946('0xc')](),controller[_0x3946('0x66')]);router[_0x3946('0x64')](_0x3946('0x11'),auth[_0x3946('0xc')](),controller[_0x3946('0x67')]);router['delete'](_0x3946('0x4e'),auth['isAuthenticated'](),controller['removeChatInteractions']);router[_0x3946('0x64')](_0x3946('0x50'),auth[_0x3946('0xc')](),controller['removeMailInteractions']);router[_0x3946('0x64')](_0x3946('0x68'),auth['isAuthenticated'](),controller[_0x3946('0x69')]);router[_0x3946('0x64')](_0x3946('0x6a'),auth[_0x3946('0xc')](),controller[_0x3946('0x6b')]);router['delete'](_0x3946('0x54'),auth[_0x3946('0xc')](),controller['removeOpenchannelInteractions']);router[_0x3946('0x64')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0x3946('0x6c')]);router[_0x3946('0x64')](_0x3946('0x58'),auth['isAuthenticated'](),controller[_0x3946('0x6d')]);router[_0x3946('0x64')](_0x3946('0x31'),auth[_0x3946('0xc')](),controller['removeMailAccounts']);router[_0x3946('0x64')](_0x3946('0x5a'),auth['isAuthenticated'](),controller[_0x3946('0x6e')]);router[_0x3946('0x64')]('/:id/sms_accounts',auth[_0x3946('0xc')](),controller[_0x3946('0x6f')]);router[_0x3946('0x64')](_0x3946('0x35'),auth[_0x3946('0xc')](),controller[_0x3946('0x70')]);router['delete'](_0x3946('0x37'),auth[_0x3946('0xc')](),controller[_0x3946('0x71')]);router[_0x3946('0x64')](_0x3946('0x38'),auth[_0x3946('0xc')](),controller[_0x3946('0x72')]);router['delete']('/:id/api_key',auth[_0x3946('0xc')](),controller['removeApiKey']);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 d42f72c..4b79d28 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 _0xa181=['encryption','avpf','force_avp','icesupport','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','dtlsenable','/etc/pki/tls/certs/motion.crt','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','lodash','STRING','name','setDataValue','defaultuser','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','toLowerCase','ENUM','admin','user','agent','telephone','local','INTEGER','internal','accountcode','BOOLEAN','DEFAULT\x20PAUSE','DATE','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes','nonat','update','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','accept','originate','uac','uas','fingerprint','actpass','update,nonat','TEXT','showWebBar','get','isArray','wss'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa181,0xbe));var _0x1a18=function(_0x443913,_0x33f0fb){_0x443913=_0x443913-0x0;var _0xda11cd=_0xa181[_0x443913];return _0xda11cd;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require('util');var _=require(_0x1a18('0x0'));module['exports']={'name':{'type':Sequelize[_0x1a18('0x1')],'allowNull':![],'unique':_0x1a18('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1aebfc){this[_0x1a18('0x3')](_0x1a18('0x2'),_0x1aebfc);this[_0x1a18('0x3')](_0x1a18('0x4'),_0x1aebfc);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x58b916){this[_0x1a18('0x3')](_0x1a18('0x5'),_0x58b916);this[_0x1a18('0x3')](_0x1a18('0x6'),util[_0x1a18('0x7')](_0x1a18('0x8'),_0x58b916,this[_0x1a18('0x9')]('internal')));}},'alias':{'type':Sequelize[_0x1a18('0x1')]},'email':{'type':Sequelize[_0x1a18('0x1')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x59f026){if(_0x59f026){this[_0x1a18('0x3')](_0x1a18('0xa'),_0x59f026[_0x1a18('0xb')]());}}},'role':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0xd'),_0x1a18('0xe'),_0x1a18('0xf'),_0x1a18('0x10')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x1a18('0x1')],'defaultValue':_0x1a18('0x11')},'internal':{'type':Sequelize[_0x1a18('0x12')](0xb),'allowNull':![],'unique':_0x1a18('0x13'),'set':function(_0x475a64){this[_0x1a18('0x3')]('internal',_0x475a64);this[_0x1a18('0x3')](_0x1a18('0x14'),_0x475a64);this[_0x1a18('0x3')](_0x1a18('0x6'),util[_0x1a18('0x7')](_0x1a18('0x8'),this[_0x1a18('0x9')]('fullname'),_0x475a64));}},'salt':{'type':Sequelize[_0x1a18('0x1')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x1a18('0x1')]},'address':{'type':Sequelize[_0x1a18('0x1')]},'zipcode':{'type':Sequelize[_0x1a18('0x1')]},'userpic':{'type':Sequelize[_0x1a18('0x1')]},'city':{'type':Sequelize[_0x1a18('0x1')]},'country':{'type':Sequelize[_0x1a18('0x1')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x1a18('0x1')],'defaultValue':_0x1a18('0x16')},'lastPauseAt':{'type':Sequelize[_0x1a18('0x17')]},'chatCapacity':{'type':Sequelize[_0x1a18('0x12')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x1a18('0x12')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x1a18('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x1a18('0x12')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x1a18('0x12')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x1a18('0x12')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x1a18('0x12')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'host':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'port':{'type':Sequelize[_0x1a18('0x12')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x1a18('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x1a18('0x12')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x1a18('0xc')]('friend',_0x1a18('0xe'),'peer'),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize['ENUM'](_0x1a18('0x18'),_0x1a18('0x19'),_0x1a18('0x1a'),_0x1a18('0x1b'),_0x1a18('0x1c'),_0x1a18('0x1d'),_0x1a18('0x1e'),_0x1a18('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'permit':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'transport':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![],'defaultValue':_0x1a18('0x20'),'set':function(_0x5c97bb){this[_0x1a18('0x3')](_0x1a18('0x21'),_0x5c97bb?_0x5c97bb[_0x1a18('0x22')](','):null);},'get':function(){return this[_0x1a18('0x9')]('transport')?this[_0x1a18('0x9')]('transport')['split'](','):null;},'comment':_0x1a18('0x23')},'dtmfmode':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x24'),'info',_0x1a18('0x25'),_0x1a18('0x26'),_0x1a18('0x27')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x28'),'no',_0x1a18('0x29'),_0x1a18('0x2a'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1a18('0xc')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'nat':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![],'defaultValue':_0x1a18('0x2b'),'set':function(_0x331612){this[_0x1a18('0x3')](_0x1a18('0x2c'),_0x331612?_0x331612['join'](','):null);},'get':function(){return this[_0x1a18('0x9')]('nat')?this['getDataValue'](_0x1a18('0x2c'))[_0x1a18('0x2d')](','):null;},'comment':_0x1a18('0x2e')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x1a18('0x1')]},'pickupgroup':{'type':Sequelize[_0x1a18('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x1a18('0x1')]},'language':{'type':Sequelize[_0x1a18('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1a18('0x2f')},'allow':{'type':Sequelize[_0x1a18('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0xe6c3f0){this[_0x1a18('0x3')](_0x1a18('0x30'),_0xe6c3f0?_0xe6c3f0[_0x1a18('0x22')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x1a18('0x9')](_0x1a18('0x30'))?this['getDataValue'](_0x1a18('0x30'))[_0x1a18('0x2d')](';'):null;},'comment':_0x1a18('0x31')},'autoframing':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![],'set':function(_0x3477f0){this[_0x1a18('0x3')](_0x1a18('0x32'),_0x3477f0?_0x3477f0[_0x1a18('0x22')](','):null);},'get':function(){return this[_0x1a18('0x9')](_0x1a18('0x32'))?this[_0x1a18('0x9')]('insecure')[_0x1a18('0x2d')](','):null;},'comment':_0x1a18('0x33')},'trustrpid':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1a18('0xc')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x1a18('0xc')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![],'defaultValue':_0x1a18('0x34')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x28'),'no'),'allowNull':!![],'defaultValue':_0x1a18('0x28')},'busylevel':{'type':Sequelize[_0x1a18('0x12')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x1a18('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x1a18('0xc')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'template':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x1a18('0x28'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x28'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x35'),'refuse',_0x1a18('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x1a18('0x12')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x37'),_0x1a18('0x38')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x1a18('0x28'),'no'),'allowNull':!![],'defaultValue':_0x1a18('0x28')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x1a18('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x1a18('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x1a18('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x1a18('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x1a18('0x12')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x1a18('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x1a18('0xc')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x28'),'no',_0x1a18('0x39'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM']('active','passive',_0x1a18('0x3a')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x1a18('0xc')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x1a18('0x12')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x1a18('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x28'),'no','nonat',_0x1a18('0x2a'),_0x1a18('0x3b')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x1a18('0x1')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x1a18('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x1a18('0x3c')]},'showWebBar':{'type':Sequelize[_0x1a18('0x12')],'defaultValue':0x0,'set':function(_0x5f1517){this['setDataValue'](_0x1a18('0x3d'),_0x5f1517);var _0x3b04f6=this[_0x1a18('0x3e')]({'plain':!![]});switch(_0x5f1517){case 0x0:case 0x1:var _0x1363c0=_0x3b04f6['transport']?_[_0x1a18('0x3f')](_0x3b04f6[_0x1a18('0x21')])?_0x3b04f6['transport'][_0x1a18('0x22')]():_0x3b04f6[_0x1a18('0x21')]:_0x1a18('0x20');if(_0x1363c0===_0x1a18('0x40')){_0x1363c0='udp';}this[_0x1a18('0x3')](_0x1a18('0x21'),_0x1363c0);this[_0x1a18('0x3')](_0x1a18('0x41'),'no');this[_0x1a18('0x3')](_0x1a18('0x42'),null);this['setDataValue'](_0x1a18('0x43'),null);this[_0x1a18('0x3')](_0x1a18('0x44'),null);this[_0x1a18('0x3')]('dtlsenable',null);this['setDataValue'](_0x1a18('0x45'),null);this[_0x1a18('0x3')](_0x1a18('0x46'),null);this[_0x1a18('0x3')](_0x1a18('0x47'),null);this[_0x1a18('0x3')](_0x1a18('0x48'),null);this[_0x1a18('0x3')](_0x1a18('0x49'),'no');break;case 0x2:this['setDataValue'](_0x1a18('0x21'),_0x1a18('0x40'));this[_0x1a18('0x3')](_0x1a18('0x41'),'yes');this[_0x1a18('0x3')]('avpf',_0x1a18('0x28'));this[_0x1a18('0x3')](_0x1a18('0x43'),_0x1a18('0x28'));this['setDataValue']('icesupport',_0x1a18('0x28'));this['setDataValue'](_0x1a18('0x4a'),_0x1a18('0x28'));this[_0x1a18('0x3')](_0x1a18('0x45'),'no');this[_0x1a18('0x3')](_0x1a18('0x46'),_0x1a18('0x3a'));this[_0x1a18('0x3')](_0x1a18('0x47'),_0x3b04f6['dtlscertfile']||_0x1a18('0x4b'));this[_0x1a18('0x3')](_0x1a18('0x48'),_0x3b04f6[_0x1a18('0x48')]||'/etc/pki/tls/private/motion.key');this[_0x1a18('0x3')](_0x1a18('0x49'),_0x1a18('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x1a18('0x3c')],'set':function(_0x4a2804){this[_0x1a18('0x3')](_0x1a18('0x4c'),_0x4a2804?_0x4a2804[_0x1a18('0x22')](','):[]);},'get':function(){return this[_0x1a18('0x9')](_0x1a18('0x4c'))?_[_0x1a18('0x4d')](this['getDataValue'](_0x1a18('0x4c'))[_0x1a18('0x2d')](','),function(_0x3442e7){return parseInt(_0x3442e7,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x1a18('0x1')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x1a18('0x1')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x1a18('0x1')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x1a18('0x12')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x1a18('0x1')]},'phoneBarEnableJaws':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x1a18('0x4e')],'get':function(){return this[_0x1a18('0x9')](_0x1a18('0x4f'))?this[_0x1a18('0x9')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x1a18('0x1')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![],'set':function(_0xf8531a){if(typeof _0xf8531a==='string'){var _0x116c72=_0xf8531a==='1'?!![]:_0xf8531a==='0'?![]:_0xf8531a===_0x1a18('0x50')?!![]:_0xf8531a===_0x1a18('0x51')?![]:![];this['setDataValue'](_0x1a18('0x52'),_0x116c72);}else{this[_0x1a18('0x3')](_0x1a18('0x52'),_0xf8531a);}}},'blocked':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![],'set':function(_0x2bc684){this[_0x1a18('0x3')](_0x1a18('0x53'),_0x2bc684);if(_0x2bc684===!![]){this[_0x1a18('0x3')](_0x1a18('0x54'),moment());this[_0x1a18('0x3')]('loginAttempts',0x0);}else{this[_0x1a18('0x3')](_0x1a18('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x1a18('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x1a18('0x12')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]}}; \ No newline at end of file +var _0x092c=['local','INTEGER','internal','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','friend','from-sip','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','shortinfo','inband','auto','rfc2833','yes','nonat','update','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','fingerprint','certificate','active','passive','actpass','update,nonat','TEXT','showWebBar','isArray','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','wss','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','lodash','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','STRING','email','toLowerCase','ENUM','user','telephone'];(function(_0x11751f,_0xd76063){var _0x2b45fe=function(_0x5a427d){while(--_0x5a427d){_0x11751f['push'](_0x11751f['shift']());}};_0x2b45fe(++_0xd76063);}(_0x092c,0xa2));var _0xc092=function(_0x543fcc,_0x38e5cf){_0x543fcc=_0x543fcc-0x0;var _0x1aedb1=_0x092c[_0x543fcc];return _0x1aedb1;};'use strict';var Sequelize=require(_0xc092('0x0'));var moment=require(_0xc092('0x1'));var util=require(_0xc092('0x2'));var _=require(_0xc092('0x3'));module[_0xc092('0x4')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc092('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2d0f24){this['setDataValue'](_0xc092('0x5'),_0x2d0f24);this[_0xc092('0x6')](_0xc092('0x7'),_0x2d0f24);},'comment':_0xc092('0x8')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x11ccd5){this[_0xc092('0x6')](_0xc092('0x9'),_0x11ccd5);this[_0xc092('0x6')](_0xc092('0xa'),util[_0xc092('0xb')](_0xc092('0xc'),_0x11ccd5,this[_0xc092('0xd')]('internal')));}},'alias':{'type':Sequelize[_0xc092('0xe')]},'email':{'type':Sequelize[_0xc092('0xe')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x2a1d49){if(_0x2a1d49){this['setDataValue'](_0xc092('0xf'),_0x2a1d49[_0xc092('0x10')]());}}},'role':{'type':Sequelize[_0xc092('0x11')]('admin',_0xc092('0x12'),'agent',_0xc092('0x13')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xc092('0xe')],'defaultValue':_0xc092('0x14')},'internal':{'type':Sequelize[_0xc092('0x15')](0xb),'allowNull':![],'unique':_0xc092('0x16'),'set':function(_0xf73edb){this['setDataValue'](_0xc092('0x16'),_0xf73edb);this['setDataValue'](_0xc092('0x17'),_0xf73edb);this[_0xc092('0x6')]('callerid',util[_0xc092('0xb')](_0xc092('0xc'),this[_0xc092('0xd')](_0xc092('0x9')),_0xf73edb));}},'salt':{'type':Sequelize[_0xc092('0xe')]},'phone':{'type':Sequelize[_0xc092('0xe')]},'mobile':{'type':Sequelize[_0xc092('0xe')]},'address':{'type':Sequelize[_0xc092('0xe')]},'zipcode':{'type':Sequelize[_0xc092('0xe')]},'userpic':{'type':Sequelize[_0xc092('0xe')]},'city':{'type':Sequelize[_0xc092('0xe')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xc092('0x18')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xc092('0x19')]},'voicePause':{'type':Sequelize[_0xc092('0x18')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xc092('0x18')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xc092('0x18')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xc092('0x18')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xc092('0x18')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xc092('0xe')],'defaultValue':_0xc092('0x1a')},'lastPauseAt':{'type':Sequelize[_0xc092('0x19')]},'chatCapacity':{'type':Sequelize[_0xc092('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xc092('0x15')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xc092('0x15')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xc092('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xc092('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xc092('0x18')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xc092('0x18')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xc092('0x15')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xc092('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xc092('0x18')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xc092('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xc092('0x18')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xc092('0x18')],'defaultValue':![]},'description':{'type':Sequelize[_0xc092('0xe')],'allowNull':!![]},'host':{'type':Sequelize[_0xc092('0xe')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0xc092('0xe')],'allowNull':!![]},'port':{'type':Sequelize[_0xc092('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xc092('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xc092('0xe')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xc092('0xe')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xc092('0xe')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0xc092('0x1b'),_0xc092('0x12'),'peer'),'allowNull':!![],'defaultValue':_0xc092('0x1b')},'context':{'type':Sequelize[_0xc092('0xe')],'allowNull':!![],'defaultValue':_0xc092('0x1c')},'callingpres':{'type':Sequelize[_0xc092('0x11')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0xc092('0x1d'),_0xc092('0x1e'),_0xc092('0x1f'),_0xc092('0x20'),_0xc092('0x21')),'allowNull':!![]},'deny':{'type':Sequelize[_0xc092('0xe')],'allowNull':!![]},'permit':{'type':Sequelize[_0xc092('0xe')],'allowNull':!![]},'secret':{'type':Sequelize[_0xc092('0xe')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0xc092('0xe')],'allowNull':!![],'defaultValue':_0xc092('0x22'),'set':function(_0x1ce83c){this['setDataValue'](_0xc092('0x23'),_0x1ce83c?_0x1ce83c['join'](','):null);},'get':function(){return this[_0xc092('0xd')](_0xc092('0x23'))?this[_0xc092('0xd')]('transport')[_0xc092('0x24')](','):null;},'comment':_0xc092('0x25')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833','info',_0xc092('0x26'),_0xc092('0x27'),_0xc092('0x28')),'allowNull':!![],'defaultValue':_0xc092('0x29')},'directmedia':{'type':Sequelize[_0xc092('0x11')](_0xc092('0x2a'),'no',_0xc092('0x2b'),_0xc092('0x2c'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xc092('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xc092('0xe')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xc092('0x2d'),'set':function(_0x56ef61){this[_0xc092('0x6')](_0xc092('0x2e'),_0x56ef61?_0x56ef61[_0xc092('0x2f')](','):null);},'get':function(){return this['getDataValue'](_0xc092('0x2e'))?this['getDataValue'](_0xc092('0x2e'))[_0xc092('0x24')](','):null;},'comment':_0xc092('0x30')},'callgroup':{'type':Sequelize[_0xc092('0xe')]},'namedcallgroup':{'type':Sequelize[_0xc092('0xe')]},'pickupgroup':{'type':Sequelize[_0xc092('0xe')]},'namedpickupgroup':{'type':Sequelize[_0xc092('0xe')]},'language':{'type':Sequelize[_0xc092('0xe')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xc092('0xe')],'allowNull':![],'defaultValue':_0xc092('0x31')},'allow':{'type':Sequelize[_0xc092('0xe')],'allowNull':![],'defaultValue':_0xc092('0x32'),'set':function(_0xe483a1){this[_0xc092('0x6')](_0xc092('0x33'),_0xe483a1?_0xe483a1[_0xc092('0x2f')](';'):_0xc092('0x32'));},'get':function(){return this[_0xc092('0xd')](_0xc092('0x33'))?this['getDataValue'](_0xc092('0x33'))[_0xc092('0x24')](';'):null;},'comment':_0xc092('0x34')},'autoframing':{'type':Sequelize[_0xc092('0x11')](_0xc092('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xc092('0xe')],'allowNull':!![],'set':function(_0xc7fcdb){this['setDataValue'](_0xc092('0x35'),_0xc7fcdb?_0xc7fcdb['join'](','):null);},'get':function(){return this[_0xc092('0xd')](_0xc092('0x35'))?this['getDataValue'](_0xc092('0x35'))['split'](','):null;},'comment':_0xc092('0x36')},'trustrpid':{'type':Sequelize['ENUM'](_0xc092('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc092('0x11')](_0xc092('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc092('0x11')](_0xc092('0x2a'),'no',_0xc092('0x37')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xc092('0x11')](_0xc092('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xc092('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xc092('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0xc092('0xe')],'allowNull':!![],'defaultValue':_0xc092('0x38')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xc092('0x11')]('yes','no'),'allowNull':!![],'defaultValue':_0xc092('0x2a')},'busylevel':{'type':Sequelize[_0xc092('0x15')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xc092('0x11')](_0xc092('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xc092('0x11')](_0xc092('0x2a'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xc092('0xe')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xc092('0x11')](_0xc092('0x2a'),'no',_0xc092('0x39')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xc092('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xc092('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xc092('0xe')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0xc092('0x3a'),_0xc092('0x3b'),_0xc092('0x3c')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xc092('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xc092('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xc092('0x11')](_0xc092('0x3d'),'uas'),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0xc092('0xe')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xc092('0xe')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xc092('0xe')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0xc092('0x2a'),'no'),'allowNull':!![],'defaultValue':_0xc092('0x2a')},'keepalive':{'type':Sequelize[_0xc092('0x15')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xc092('0xe')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xc092('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xc092('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xc092('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xc092('0x11')](_0xc092('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc092('0xe')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xc092('0xe')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xc092('0x15')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xc092('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xc092('0xe')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xc092('0xe')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xc092('0xe')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xc092('0xe')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xc092('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xc092('0x11')](_0xc092('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc092('0x11')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xc092('0x11')](_0xc092('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xc092('0x11')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0xc092('0x2a'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xc092('0x11')](_0xc092('0x2a'),'no',_0xc092('0x3e'),_0xc092('0x3f')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xc092('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xc092('0xe')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xc092('0xe')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0xc092('0x40'),_0xc092('0x41'),_0xc092('0x42')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xc092('0x11')](_0xc092('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xc092('0xe')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xc092('0xe')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xc092('0x15')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xc092('0x11')](_0xc092('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xc092('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xc092('0xe')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xc092('0xe')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xc092('0xe')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xc092('0x11')]('yes','no',_0xc092('0x2b'),_0xc092('0x2c'),_0xc092('0x43')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xc092('0x18')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xc092('0xe')]},'resetPasswordExpires':{'type':Sequelize[_0xc092('0x19')]},'passwordResetAt':{'type':Sequelize[_0xc092('0x19')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xc092('0x44')]},'showWebBar':{'type':Sequelize[_0xc092('0x15')],'defaultValue':0x0,'set':function(_0x205537){this[_0xc092('0x6')](_0xc092('0x45'),_0x205537);var _0x3a8d21=this['get']({'plain':!![]});switch(_0x205537){case 0x0:case 0x1:var _0x4de680=_0x3a8d21[_0xc092('0x23')]?_[_0xc092('0x46')](_0x3a8d21['transport'])?_0x3a8d21[_0xc092('0x23')]['join']():_0x3a8d21[_0xc092('0x23')]:_0xc092('0x22');if(_0x4de680==='wss'){_0x4de680=_0xc092('0x22');}this[_0xc092('0x6')](_0xc092('0x23'),_0x4de680);this['setDataValue'](_0xc092('0x47'),'no');this['setDataValue']('avpf',null);this['setDataValue'](_0xc092('0x48'),null);this[_0xc092('0x6')](_0xc092('0x49'),null);this[_0xc092('0x6')](_0xc092('0x4a'),null);this[_0xc092('0x6')](_0xc092('0x4b'),null);this[_0xc092('0x6')](_0xc092('0x4c'),null);this[_0xc092('0x6')]('dtlscertfile',null);this[_0xc092('0x6')]('dtlsprivatekey',null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this[_0xc092('0x6')](_0xc092('0x23'),_0xc092('0x4d'));this[_0xc092('0x6')](_0xc092('0x47'),_0xc092('0x2a'));this['setDataValue']('avpf',_0xc092('0x2a'));this[_0xc092('0x6')](_0xc092('0x48'),_0xc092('0x2a'));this[_0xc092('0x6')](_0xc092('0x49'),'yes');this[_0xc092('0x6')](_0xc092('0x4a'),_0xc092('0x2a'));this[_0xc092('0x6')]('dtlsverify','no');this[_0xc092('0x6')]('dtlssetup',_0xc092('0x42'));this[_0xc092('0x6')](_0xc092('0x4e'),_0x3a8d21[_0xc092('0x4e')]||_0xc092('0x4f'));this[_0xc092('0x6')](_0xc092('0x50'),_0x3a8d21[_0xc092('0x50')]||_0xc092('0x51'));this[_0xc092('0x6')]('rtcp_mux',_0xc092('0x2a'));break;default:}}},'permissions':{'type':Sequelize[_0xc092('0x44')],'set':function(_0x2d4324){this[_0xc092('0x6')](_0xc092('0x52'),_0x2d4324?_0x2d4324['join'](','):[]);},'get':function(){return this[_0xc092('0xd')](_0xc092('0x52'))?_[_0xc092('0x53')](this['getDataValue']('permissions')[_0xc092('0x24')](','),function(_0x57936b){return parseInt(_0x57936b,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0xc092('0xe')]},'phoneBarBusyNumber':{'type':Sequelize[_0xc092('0xe')]},'phoneBarUnconditional':{'type':Sequelize[_0xc092('0x18')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xc092('0x18')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xc092('0x18')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xc092('0x18')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xc092('0x18')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xc092('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xc092('0xe')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xc092('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xc092('0x18')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0xc092('0x18')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xc092('0x18')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xc092('0x54')],'get':function(){return this[_0xc092('0xd')](_0xc092('0x55'))?this[_0xc092('0xd')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xc092('0x18')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xc092('0x18')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xc092('0x18')],'defaultValue':![]},'interface':{'type':Sequelize[_0xc092('0xe')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xc092('0x18')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xc092('0xe')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xc092('0xe')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xc092('0x18')],'defaultValue':![],'set':function(_0x54cf12){if(typeof _0x54cf12==='string'){var _0x408823=_0x54cf12==='1'?!![]:_0x54cf12==='0'?![]:_0x54cf12==='true'?!![]:_0x54cf12===_0xc092('0x56')?![]:![];this['setDataValue'](_0xc092('0x57'),_0x408823);}else{this[_0xc092('0x6')](_0xc092('0x57'),_0x54cf12);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x1f0720){this[_0xc092('0x6')](_0xc092('0x58'),_0x1f0720);if(_0x1f0720===!![]){this['setDataValue'](_0xc092('0x59'),moment());this[_0xc092('0x6')](_0xc092('0x5a'),0x0);}else{this['setDataValue'](_0xc092('0x59'),null);}}},'blockedAt':{'type':Sequelize[_0xc092('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xc092('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xc092('0x18')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xc092('0x18')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xc092('0x15')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xc092('0x18')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xc092('0x18')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xc092('0x18')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xc092('0x18')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xc092('0x18')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xc092('0x18')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 51bb00f..2871521 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 _0x4888=['jayson/promise','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','register','redis','localhost','client','http','request','then','User,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','result','sendStatus','status','end','json','limit','count','offset','set','Content-Range','update','get','role','admin','user','Agents','agent','Telephones','telephone','filter','ignore','value','includes','name','destroy','stack','send','index','rawAttributes','map','fieldName','type','key','salt','where','User','includeAll','include','attributes','findAll','rows','query','openTabs','true','length','push','chat','dataValues','sms','fax','mail','openchannel','all','catch','show','params','model','differenceBy','keys','filters','intersection','fields','options','body','describe','addContacts','find','omit','ids','internal','findById','securePassword','validatePasswordPattern','max','min_internal','isNil','sequelize','QueryTypes','SELECT','from','voicemail','VoiceMail','password','email','permissions','101','102','103','113','110','104','105','106','108','111','114','115','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','UserProfileSection','autoAssociation','UserProfileResource','create','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','each','isEmpty','compact','changePassword','oldPassword','newPassword','Sequelize','Wrong\x20credentials','ValidationError','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','findOne','enforcePasswordHistory','previousPasswords','validatePasswordHistory','passwordHistoryLimit','updatePasswordsHistory','addQueues','online','loginInPause','voicePause','isValidChannel','Unknown\x20channel','add','toLowerCase','penalty','spread','capitalize','QueueId','emit','Queue:save','voice','VoiceQueue','interface','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','channel','Queues','Queue:remove','addAvatar','file','filename','getAvatar','root','existsSync','join','userpic','download','server/files/images/','getOpenTabs','whatsapp','ChatOpenTabs','CHAT','FaxOpenTabs','FAX','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','getContacts','CmContact','order','sort','pick','merge','hasOwnProperty','Tags','color','tag','nolimit','getQueues','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','FaxInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','phone','LOCAL/%s@from-sip/n','intrf','user:%s','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','device','LOGININPAUSE','isMiddleware','resolve','logout','pause','QueuePause','DEFAULT\x20PAUSE','chatPause','faxPause','lastPauseAt','unpause','PAUSE','manual','%s%s','Pause','getTeams','addTeams','Team','setDataValue','Voice','getChatQueues','Chat','getMailQueues','getSmsQueues','Sms','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','getDataValue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','Mail','removeAgent','CmList','getLists','getAgents','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','concat','$and','$or','$gt','$gte','$ne','$eq','$not','$between','$notBetween','$notIn','$notILike','$like','$overlap','$contains','$contained','$any','firstName','lastName','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','getPresence','teams','queues','inbound','col','toString','asc','desc','substring','uniqBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','unknown','unavailable','ringing','voiceStatus','busy','slice','charAt','toUpperCase','select','InteractionId','field','ui.createdAt','_interactions','ui.UserId\x20=\x20?','OpenTabs','bluebird','util','path','lodash','squel'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x4888,0x198));var _0x8488=function(_0x19fbdc,_0x2e1d6a){_0x19fbdc=_0x19fbdc-0x0;var _0x176533=_0x4888[_0x19fbdc];return _0x176533;};'use strict';var moment=require('moment');var BPromise=require(_0x8488('0x0'));var util=require(_0x8488('0x1'));var path=require(_0x8488('0x2'));var fs=require('fs');var _=require(_0x8488('0x3'));var squel=require(_0x8488('0x4'));var jayson=require(_0x8488('0x5'));var Redis=require(_0x8488('0x6'));var authService=require('../../components/auth/service');var qs=require(_0x8488('0x7'));var logger=require(_0x8488('0x8'))(_0x8488('0x9'));var utils=require(_0x8488('0xa'));var config=require(_0x8488('0xb'));var licenseUtil=require(_0x8488('0xc'));var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./user.socket')[_0x8488('0xd')](socket);config[_0x8488('0xe')]=_['defaults'](config[_0x8488('0xe')],{'host':_0x8488('0xf'),'port':0x18eb});var client=jayson[_0x8488('0x10')][_0x8488('0x11')]({'port':0x232a});var values;function respondWithRpcPromise(_0x515ea8,_0x377d3b,_0x1909c9,_0x468896){return new BPromise(function(_0x256bab,_0x47146a){var _0x50ea94=_0x468896||client;return _0x50ea94[_0x8488('0x12')](_0x515ea8,_0x1909c9)[_0x8488('0x13')](function(_0x58f83d){logger['info'](_0x8488('0x14'),_0x377d3b,'request\x20sent');logger[_0x8488('0x15')]('User,\x20%s,\x20%s,\x20%s',_0x377d3b,'request\x20sent',JSON[_0x8488('0x16')](_0x58f83d));if(_0x58f83d[_0x8488('0x17')]){if(_0x58f83d[_0x8488('0x17')][_0x8488('0x18')]===0x1f4){logger[_0x8488('0x17')](_0x8488('0x14'),_0x377d3b,_0x58f83d[_0x8488('0x17')]['message']);return _0x47146a(_0x58f83d[_0x8488('0x17')][_0x8488('0x19')]);}logger[_0x8488('0x17')](_0x8488('0x14'),_0x377d3b,_0x58f83d[_0x8488('0x17')][_0x8488('0x19')]);return _0x256bab(_0x58f83d[_0x8488('0x17')][_0x8488('0x19')]);}else{logger[_0x8488('0x1a')](_0x8488('0x14'),_0x377d3b,_0x8488('0x1b'));_0x256bab(_0x58f83d[_0x8488('0x1c')][_0x8488('0x19')]);}})['catch'](function(_0x4a1b45){logger[_0x8488('0x17')](_0x8488('0x14'),_0x377d3b,_0x4a1b45);_0x47146a(_0x4a1b45);});});}function respondWithStatusCode(_0xbb10fe,_0x3c9fc2){_0x3c9fc2=_0x3c9fc2||0xcc;return function(_0x892236){if(_0x892236){return _0xbb10fe[_0x8488('0x1d')](_0x3c9fc2);}return _0xbb10fe[_0x8488('0x1e')](_0x3c9fc2)[_0x8488('0x1f')]();};}function respondWithResult(_0x39dd43,_0x5123d0){_0x5123d0=_0x5123d0||0xc8;return function(_0x476a14){if(_0x476a14){return _0x39dd43[_0x8488('0x1e')](_0x5123d0)[_0x8488('0x20')](_0x476a14);}};}function respondWithFilteredResult(_0x1361a6,_0x290b33){return function(_0x54ecda){if(_0x54ecda){var _0x577234=typeof _0x290b33['offset']==='undefined'&&typeof _0x290b33[_0x8488('0x21')]==='undefined';var _0x58057a=_0x54ecda[_0x8488('0x22')];var _0x2f350a=_0x577234?0x0:_0x290b33[_0x8488('0x23')];var _0x6ebee0=_0x577234?_0x54ecda[_0x8488('0x22')]:_0x290b33['offset']+_0x290b33[_0x8488('0x21')];var _0x38c137;if(_0x6ebee0>=_0x58057a){_0x6ebee0=_0x58057a;_0x38c137=0xc8;}else{_0x38c137=0xce;}_0x1361a6[_0x8488('0x1e')](_0x38c137);return _0x1361a6[_0x8488('0x24')](_0x8488('0x25'),_0x2f350a+'-'+_0x6ebee0+'/'+_0x58057a)[_0x8488('0x20')](_0x54ecda);}return null;};}function saveUpdates(_0x2c15ff){return function(_0x296b6c){if(_0x296b6c){return _0x296b6c[_0x8488('0x26')](_0x2c15ff)[_0x8488('0x13')](function(_0x888b24){return _0x888b24;});}return null;};}function removeEntity(_0x58d0cc){return function(_0x57ce3c){if(_0x57ce3c){return _0x57ce3c['destroy']()[_0x8488('0x13')](function(){var _0x408c36=_0x57ce3c[_0x8488('0x27')]({'plain':!![]});if(_0x408c36[_0x8488('0x28')]===_0x8488('0x29'))return;var _0x2f1399=[{'name':'Users','value':_0x8488('0x2a'),'ignore':!![]},{'name':_0x8488('0x2b'),'value':_0x8488('0x2c'),'ignore':![]},{'name':_0x8488('0x2d'),'value':_0x8488('0x2e'),'ignore':![]}];var _0x501981=_(_0x2f1399)[_0x8488('0x2f')](_0x8488('0x30'))['map'](_0x8488('0x31'))[_0x8488('0x31')]();if(_[_0x8488('0x32')](_0x501981,_0x408c36[_0x8488('0x28')])){return;}var _0x4555d0=_['find'](_0x2f1399,[_0x8488('0x31'),_0x408c36[_0x8488('0x28')]])[_0x8488('0x33')];return db['UserProfileResource'][_0x8488('0x34')]({'where':{'type':_0x4555d0,'resourceId':_0x408c36['id']}})['then'](function(){return _0x57ce3c;});})[_0x8488('0x13')](function(){_0x58d0cc[_0x8488('0x1e')](0xcc)[_0x8488('0x1f')]();});}};}function handleEntityNotFound(_0x16b0cd){return function(_0x4c3b59){if(!_0x4c3b59){_0x16b0cd[_0x8488('0x1d')](0x194);}return _0x4c3b59;};}function handleError(_0xe71bd9,_0x3939f2){_0x3939f2=_0x3939f2||0x1f4;return function(_0x583ece){logger[_0x8488('0x17')](_0x583ece[_0x8488('0x35')]);if(_0x583ece[_0x8488('0x33')]){delete _0x583ece[_0x8488('0x33')];}_0xe71bd9[_0x8488('0x1e')](_0x3939f2)[_0x8488('0x36')](_0x583ece);};}exports[_0x8488('0x37')]=function(_0x27ddb0,_0x1a8235){var _0x2171dc={},_0x3b6d07={'count':0x0,'rows':[]};var _0x4cb675=_(db['User'][_0x8488('0x38')])[_0x8488('0x39')](function(_0x3abb68){return{'name':_0x3abb68[_0x8488('0x3a')],'type':_0x3abb68[_0x8488('0x3b')][_0x8488('0x3c')]};})[_0x8488('0x2f')](function(_0x4481df){return!_[_0x8488('0x32')](['password',_0x8488('0x3d')],_0x4481df[_0x8488('0x33')]);})[_0x8488('0x31')]();_0x2171dc=qs['getOptions'](_0x4cb675,_0x27ddb0);var _0x207429={'where':_0x2171dc[_0x8488('0x3e')]};return db[_0x8488('0x3f')][_0x8488('0x22')](_0x207429)[_0x8488('0x13')](function(_0x156246){_0x3b6d07[_0x8488('0x22')]=_0x156246;if(_0x27ddb0['query'][_0x8488('0x40')]){_0x2171dc[_0x8488('0x41')]=[{'all':!![]}];}if(!_[_0x8488('0x32')](_0x2171dc['attributes'],'id')){_0x2171dc[_0x8488('0x42')]['push']('id');}return db[_0x8488('0x3f')][_0x8488('0x43')](_0x2171dc);})['then'](function(_0x22a3f3){_0x3b6d07[_0x8488('0x44')]=_0x22a3f3;if(_0x27ddb0[_0x8488('0x45')][_0x8488('0x46')]===_0x8488('0x47')){var _0x4e5c83=[];for(var _0x3724be=0x0;_0x3724be<_0x3b6d07['rows'][_0x8488('0x48')];_0x3724be++){_0x4e5c83[_0x8488('0x49')](get_open_tabs(_0x8488('0x4a'),_0x3b6d07[_0x8488('0x44')][_0x3724be][_0x8488('0x4b')]));_0x4e5c83[_0x8488('0x49')](get_open_tabs(_0x8488('0x4c'),_0x3b6d07[_0x8488('0x44')][_0x3724be][_0x8488('0x4b')]));_0x4e5c83[_0x8488('0x49')](get_open_tabs(_0x8488('0x4d'),_0x3b6d07[_0x8488('0x44')][_0x3724be][_0x8488('0x4b')]));_0x4e5c83[_0x8488('0x49')](get_open_tabs(_0x8488('0x4e'),_0x3b6d07[_0x8488('0x44')][_0x3724be][_0x8488('0x4b')]));_0x4e5c83['push'](get_open_tabs(_0x8488('0x4f'),_0x3b6d07[_0x8488('0x44')][_0x3724be][_0x8488('0x4b')]));_0x4e5c83[_0x8488('0x49')](get_open_tabs('whatsapp',_0x3b6d07[_0x8488('0x44')][_0x3724be][_0x8488('0x4b')]));}return BPromise[_0x8488('0x50')](_0x4e5c83)[_0x8488('0x13')](function(_0x52042c){return _0x3b6d07;});}else{return _0x3b6d07;}})[_0x8488('0x13')](respondWithFilteredResult(_0x1a8235,_0x2171dc))[_0x8488('0x51')](handleError(_0x1a8235,null));};exports[_0x8488('0x52')]=function(_0x33d6c9,_0x19a940){var _0x1157db={'raw':![],'where':{'id':_0x33d6c9[_0x8488('0x53')]['id']}},_0x886a9e={};_0x886a9e[_0x8488('0x54')]=_[_0x8488('0x55')](_[_0x8488('0x56')](db[_0x8488('0x3f')][_0x8488('0x38')]),['password','salt']);_0x886a9e[_0x8488('0x45')]=_[_0x8488('0x56')](_0x33d6c9[_0x8488('0x45')]);_0x886a9e[_0x8488('0x57')]=_[_0x8488('0x58')](_0x886a9e[_0x8488('0x54')],_0x886a9e[_0x8488('0x45')]);_0x1157db[_0x8488('0x42')]=_[_0x8488('0x58')](_0x886a9e['model'],qs[_0x8488('0x59')](_0x33d6c9[_0x8488('0x45')]['fields']));_0x1157db[_0x8488('0x42')]=_0x1157db[_0x8488('0x42')][_0x8488('0x48')]?_0x1157db[_0x8488('0x42')]:_0x886a9e['model'];if(_0x33d6c9[_0x8488('0x45')][_0x8488('0x40')]){_0x1157db[_0x8488('0x41')]=[{'all':!![]}];}_0x1157db=_['merge']({},_0x1157db,_0x33d6c9[_0x8488('0x5a')]);if(!_[_0x8488('0x32')](_0x1157db[_0x8488('0x42')],'id')){_0x1157db[_0x8488('0x42')]['push']('id');}return db[_0x8488('0x3f')]['find'](_0x1157db)['then'](handleEntityNotFound(_0x19a940,null))[_0x8488('0x13')](function(_0x5ca135){var _0x3453c7=[];values=_0x5ca135;if(_0x33d6c9[_0x8488('0x45')][_0x8488('0x46')]===_0x8488('0x47')){_0x3453c7[_0x8488('0x49')](get_open_tabs(_0x8488('0x4a'),_0x5ca135['dataValues']));_0x3453c7[_0x8488('0x49')](get_open_tabs(_0x8488('0x4c'),_0x5ca135[_0x8488('0x4b')]));_0x3453c7[_0x8488('0x49')](get_open_tabs(_0x8488('0x4f'),_0x5ca135['dataValues']));_0x3453c7[_0x8488('0x49')](get_open_tabs('whatsapp',_0x5ca135[_0x8488('0x4b')]));_0x3453c7[_0x8488('0x49')](get_open_tabs('fax',_0x5ca135[_0x8488('0x4b')]));_0x3453c7[_0x8488('0x49')](get_open_tabs(_0x8488('0x4e'),_0x5ca135[_0x8488('0x4b')]));return BPromise[_0x8488('0x50')](_0x3453c7);}else{return values;}})[_0x8488('0x13')](function(_0x59d0d4){return values;})[_0x8488('0x13')](respondWithResult(_0x19a940,null))['catch'](handleError(_0x19a940,null));};exports[_0x8488('0x26')]=function(_0x3fa6e2,_0x3c06a4){if(_0x3fa6e2[_0x8488('0x5b')]['id']){delete _0x3fa6e2[_0x8488('0x5b')]['id'];}delete _0x3fa6e2[_0x8488('0x5b')]['role'];return db[_0x8488('0x3f')]['find']({'where':{'id':_0x3fa6e2[_0x8488('0x53')]['id']}})[_0x8488('0x13')](handleEntityNotFound(_0x3c06a4,null))[_0x8488('0x13')](saveUpdates(_0x3fa6e2[_0x8488('0x5b')],null))[_0x8488('0x13')](respondWithResult(_0x3c06a4,null))[_0x8488('0x51')](handleError(_0x3c06a4,null));};exports['describe']=function(_0x5755af,_0x5c8310){return db[_0x8488('0x3f')][_0x8488('0x5c')]()[_0x8488('0x13')](respondWithResult(_0x5c8310,null))[_0x8488('0x51')](handleError(_0x5c8310,null));};exports[_0x8488('0x5d')]=function(_0x190e53,_0x2377db){return db[_0x8488('0x3f')][_0x8488('0x5e')]({'where':{'id':_0x190e53[_0x8488('0x53')]['id']}})['then'](handleEntityNotFound(_0x2377db,null))[_0x8488('0x13')](function(_0x174c57){if(_0x174c57){return _0x174c57[_0x8488('0x5d')](_0x190e53['body']['ids'],_[_0x8488('0x5f')](_0x190e53[_0x8488('0x5b')],[_0x8488('0x60'),'id'])||{});}})[_0x8488('0x13')](respondWithResult(_0x2377db,null))['catch'](handleError(_0x2377db,null));};function validateUser(_0x4b7475){return new BPromise(function(_0x1577ce,_0x26e0cc){if(_0x4b7475[_0x8488('0x61')])return _0x1577ce(_0x4b7475);return db['Setting'][_0x8488('0x62')](0x1)[_0x8488('0x13')](function(_0x17149f){if(_0x17149f[_0x8488('0x63')])authService[_0x8488('0x64')](_0x4b7475['password']);db[_0x8488('0x3f')][_0x8488('0x65')]('internal')[_0x8488('0x13')](function(_0x1b981b){if(_['isNil'](_0x1b981b)){_0x4b7475[_0x8488('0x61')]=_0x17149f[_0x8488('0x66')]||0x1;return;}if(_[_0x8488('0x67')](_0x17149f[_0x8488('0x66')])||_0x17149f[_0x8488('0x66')]===_0x1b981b){_0x4b7475[_0x8488('0x61')]=_0x1b981b+0x1;return;}if(_0x17149f[_0x8488('0x66')]>_0x1b981b){_0x4b7475['internal']=_0x17149f[_0x8488('0x66')];return;}return db[_0x8488('0x68')]['query']('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x8488('0x68')][_0x8488('0x69')][_0x8488('0x6a')]})['then'](function(_0xb85159){if(_0xb85159&&_0xb85159[_0x8488('0x48')]){for(var _0x56b35a=0x0,_0x42b5c5=_0xb85159['length'];_0x56b35a<_0x42b5c5&&_[_0x8488('0x67')](_0x4b7475[_0x8488('0x61')]);_0x56b35a++){if(_0x17149f[_0x8488('0x66')]<=_0xb85159[_0x56b35a]['from']){_0x4b7475[_0x8488('0x61')]=_0xb85159[_0x56b35a][_0x8488('0x6b')];}else if(_0x17149f['min_internal']>_0xb85159[_0x56b35a]['from']&&_0x17149f[_0x8488('0x66')]<=_0xb85159[_0x56b35a]['to']){_0x4b7475[_0x8488('0x61')]=_0x17149f[_0x8488('0x66')];}}}if(_[_0x8488('0x67')](_0x4b7475[_0x8488('0x61')])){_0x4b7475[_0x8488('0x61')]=_0x1b981b+0x1;}return _0x1577ce(_0x4b7475);});});})[_0x8488('0x51')](function(_0x4288ce){_0x26e0cc(_0x4288ce);});});}function updateUser(_0x1dee36){return new BPromise(function(_0x1ff111,_0x5da70b){try{if(_0x1dee36[_0x8488('0x6c')]){_0x1dee36['mailbox']=_0x1dee36[_0x8488('0x61')];_0x1dee36[_0x8488('0x6d')]={'mailbox':_0x1dee36[_0x8488('0x61')],'password':_0x1dee36[_0x8488('0x6e')],'fullname':_0x1dee36['fullname'],'email':_0x1dee36[_0x8488('0x6f')]};}if(_0x1dee36[_0x8488('0x28')]==='agent'){if(!_0x1dee36[_0x8488('0x70')])_0x1dee36['permissions']=[_0x8488('0x71'),_0x8488('0x72'),_0x8488('0x73'),_0x8488('0x74'),_0x8488('0x75'),_0x8488('0x76'),_0x8488('0x77'),_0x8488('0x78'),'107',_0x8488('0x79'),'109','100',_0x8488('0x7a'),_0x8488('0x7b'),_0x8488('0x7c')];}_0x1ff111(_0x1dee36);}catch(_0x481e4b){_0x5da70b(_0x481e4b);}});}exports['create']=function(_0x1f89f9,_0xee1aac){if(_0x1f89f9['user'][_0x8488('0x28')]===_0x8488('0x2c'))throw new Error(_0x8488('0x7d'));if(_0x1f89f9[_0x8488('0x5b')][_0x8488('0x28')]===_0x8488('0x2a')&&_0x1f89f9['user'][_0x8488('0x28')]!==_0x8488('0x29')){throw new Error(_0x8488('0x7e'));}if(_0x1f89f9['body'][_0x8488('0x28')]===_0x8488('0x29')&&_0x1f89f9[_0x8488('0x2a')]['role']!==_0x8488('0x29')){throw new Error(_0x8488('0x7f'));}return licenseUtil['checkUserLimits']([_0x1f89f9['body']])[_0x8488('0x13')](function(){return validateUser(_0x1f89f9[_0x8488('0x5b')]);})['then'](function(_0x353514){return updateUser(_0x353514)[_0x8488('0x13')](function(_0x5c63b1){if(_0x5c63b1['role']===_0x8488('0x29')){_0x5c63b1['settingsEnabled']=_0x1f89f9[_0x8488('0x2a')][_0x8488('0x80')];delete _0x5c63b1[_0x8488('0x81')];}return _0x5c63b1;});})[_0x8488('0x13')](function(_0x581ea2){return db[_0x8488('0x3f')]['create'](_0x581ea2,{'include':[{'model':db[_0x8488('0x6d')],'as':'VoiceMail'}]});})[_0x8488('0x13')](function(_0x1a3a2d){if(_0x1f89f9[_0x8488('0x5b')][_0x8488('0x28')]===_0x8488('0x2a'))return _0x1a3a2d;if(_0x1f89f9[_0x8488('0x2a')][_0x8488('0x28')]!==_0x8488('0x2a'))return _0x1a3a2d;return db[_0x8488('0x82')][_0x8488('0x5e')]({'where':{'name':_0x1a3a2d[_0x8488('0x28')]===_0x8488('0x2c')?_0x8488('0x2b'):_0x8488('0x2d'),'userProfileId':_0x1f89f9['user'][_0x8488('0x81')]},'raw':!![]})[_0x8488('0x13')](function(_0x55ddaf){if(!_0x55ddaf||_0x55ddaf[_0x8488('0x83')]!=0x0)return _0x1a3a2d;return db[_0x8488('0x84')][_0x8488('0x85')]({'name':_0x1a3a2d[_0x8488('0x33')],'resourceId':_0x1a3a2d['id'],'type':_0x55ddaf[_0x8488('0x33')],'sectionId':_0x55ddaf['id']},{})[_0x8488('0x13')](function(){return _0x1a3a2d;});})[_0x8488('0x51')](function(_0x42ce91){logger[_0x8488('0x17')](_0x8488('0x86'),_0x42ce91);throw _0x42ce91;});})[_0x8488('0x13')](respondWithResult(_0xee1aac,0xc9))['catch'](handleError(_0xee1aac,null));};exports[_0x8488('0x87')]=function(_0x1abac4,_0x51814e){var _0x1e509a=_0x1abac4[_0x8488('0x5b')];var _0x76c3c=[];if(_0x1abac4[_0x8488('0x2a')][_0x8488('0x28')]==='agent')throw new Error('Unauthorized');if(_[_0x8488('0x88')](_0x1e509a,[_0x8488('0x28'),_0x8488('0x2a')])&&_0x1abac4[_0x8488('0x2a')][_0x8488('0x28')]!==_0x8488('0x29')){throw new Error(_0x8488('0x7e'));}if(_[_0x8488('0x88')](_0x1e509a,[_0x8488('0x28'),_0x8488('0x29')])&&_0x1abac4[_0x8488('0x2a')][_0x8488('0x28')]!==_0x8488('0x29')){throw new Error(_0x8488('0x89'));}return licenseUtil[_0x8488('0x8a')](_0x1e509a)['then'](function(){return validateUser(_0x1e509a[0x0]);})[_0x8488('0x13')](function(){for(var _0x5d5234=0x1;_0x5d5234<_0x1e509a['length'];_0x5d5234++){var _0x1e25a3=_0x1e509a[_0x5d5234-0x1][_0x8488('0x61')];if(!_0x1e509a[_0x5d5234][_0x8488('0x61')])_0x1e509a[_0x5d5234][_0x8488('0x61')]=_0x1e25a3+0x1;_0x76c3c[_0x8488('0x49')](validateUser(_0x1e509a[_0x5d5234]));}return BPromise[_0x8488('0x50')](_0x76c3c);})[_0x8488('0x13')](function(){_0x76c3c=[];for(var _0x366eab=0x0;_0x366eab<_0x1e509a[_0x8488('0x48')];_0x366eab++){_0x76c3c[_0x8488('0x49')](updateUser(_0x1e509a[_0x366eab]));}return BPromise['all'](_0x76c3c);})[_0x8488('0x13')](function(){return BPromise[_0x8488('0x8b')](_0x1e509a,function(_0x179637){return db[_0x8488('0x3f')][_0x8488('0x85')](_0x179637,{'include':[{'model':db[_0x8488('0x6d')],'as':'VoiceMail'}]})[_0x8488('0x13')](function(_0x5b0d69){_0x179637['id']=_0x5b0d69['id'];return _0x179637;});});})[_0x8488('0x13')](function(_0x3936b6){if(_0x1abac4['body']['role']===_0x8488('0x2a'))return _0x3936b6;if(_0x1abac4[_0x8488('0x2a')][_0x8488('0x28')]!==_0x8488('0x2a'))return _0x3936b6;var _0xbec8a6=_['some'](_0x3936b6,function(_0x26fb11){return _0x26fb11[_0x8488('0x28')]==='agent'||_0x26fb11['role']===_0x8488('0x2e');});if(!_0xbec8a6)return _0x3936b6;return db[_0x8488('0x82')][_0x8488('0x43')]({'where':{'name':{'$or':['Agents','Telephones']},'userProfileId':_0x1abac4[_0x8488('0x2a')][_0x8488('0x81')]},'raw':!![]})[_0x8488('0x13')](function(_0x57e71a){if(_[_0x8488('0x8c')](_0x57e71a)||!_[_0x8488('0x88')](_0x57e71a,[_0x8488('0x83'),0x0]))return _0x3936b6;_0x76c3c=[];var _0x39851c=_(_0x57e71a)[_0x8488('0x39')](function(_0xd6a03b){if(_0xd6a03b[_0x8488('0x83')]===0x1)return;return _0xd6a03b[_0x8488('0x33')]===_0x8488('0x2b')?_0x8488('0x2c'):_0x8488('0x2e');})[_0x8488('0x8d')]()[_0x8488('0x31')]();for(var _0x591a58=0x0;_0x591a58<_0x3936b6[_0x8488('0x48')];_0x591a58++){if(!_[_0x8488('0x32')](_0x39851c,_0x3936b6[_0x591a58][_0x8488('0x28')]))return;var _0x553785=_0x3936b6[_0x591a58][_0x8488('0x28')]==='agent'?_0x8488('0x2b'):'Telephones';_0x76c3c['push'](db[_0x8488('0x84')]['create']({'name':_0x3936b6[_0x591a58][_0x8488('0x33')],'resourceId':_0x3936b6[_0x591a58]['id'],'type':_0x553785,'sectionId':_[_0x8488('0x5e')](_0x57e71a,[_0x8488('0x33'),_0x553785])['id']},{}));}return BPromise[_0x8488('0x50')](_0x76c3c);});})['then'](respondWithResult(_0x51814e,0xc9))[_0x8488('0x51')](handleError(_0x51814e,null));};exports[_0x8488('0x8e')]=function(_0x477a86,_0x37ca73){if(_0x477a86['body']['id']){delete _0x477a86[_0x8488('0x5b')]['id'];}return db[_0x8488('0x3f')][_0x8488('0x5e')]({'where':{'id':_0x477a86[_0x8488('0x53')]['id']}})[_0x8488('0x13')](function(_0x564c4d){if(!_0x564c4d)return null;if(_0x564c4d['id']===_0x477a86['user']['id']){if(!_0x477a86[_0x8488('0x5b')][_0x8488('0x8f')]||!_0x477a86[_0x8488('0x5b')][_0x8488('0x90')]){throw new db[(_0x8488('0x91'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x564c4d['authenticate'](_0x477a86[_0x8488('0x5b')][_0x8488('0x8f')])){throw new db[(_0x8488('0x91'))]['ValidationError'](_0x8488('0x92'));}if(_0x477a86[_0x8488('0x5b')]['oldPassword']===_0x477a86[_0x8488('0x5b')][_0x8488('0x90')]){throw new db[(_0x8488('0x91'))][(_0x8488('0x93'))](_0x8488('0x94'));}}else if(_0x477a86[_0x8488('0x2a')][_0x8488('0x28')]===_0x8488('0x29')){if(!_0x477a86[_0x8488('0x5b')][_0x8488('0x90')]){throw new db[(_0x8488('0x91'))][(_0x8488('0x93'))](_0x8488('0x95'));}}else if(_0x477a86['user'][_0x8488('0x28')]===_0x8488('0x2a')){if(!_0x477a86['body']['newPassword']){throw new db['Sequelize'][(_0x8488('0x93'))](_0x8488('0x95'));}if(_0x564c4d[_0x8488('0x28')]!=='agent'){throw new db[(_0x8488('0x91'))]['ValidationError'](_0x8488('0x7d'));}}else{throw new db[(_0x8488('0x91'))][(_0x8488('0x93'))](_0x8488('0x7d'));}return _0x564c4d;})[_0x8488('0x13')](handleEntityNotFound(_0x37ca73,null))['then'](function(_0x85093c){return db[_0x8488('0x96')][_0x8488('0x97')]({'attributes':['id',_0x8488('0x63'),'enforcePasswordHistory','passwordHistoryLimit']})[_0x8488('0x13')](function(_0xfaf366){if(_0xfaf366[_0x8488('0x63')])authService[_0x8488('0x64')](_0x477a86[_0x8488('0x5b')][_0x8488('0x90')]);if(!_0xfaf366[_0x8488('0x98')]||!_0x85093c[_0x8488('0x99')])return _0x85093c;authService[_0x8488('0x9a')](_0x477a86[_0x8488('0x5b')][_0x8488('0x90')],_0x85093c[_0x8488('0x99')],_0xfaf366[_0x8488('0x9b')]);return _0x85093c;})[_0x8488('0x13')](saveUpdates({'password':_0x477a86['body']['newPassword'],'passwordResetAt':_0x477a86[_0x8488('0x2a')]['id']==_0x477a86[_0x8488('0x53')]['id']?moment():null,'previousPasswords':authService[_0x8488('0x9c')](_0x477a86[_0x8488('0x5b')][_0x8488('0x90')],_0x85093c[_0x8488('0x99')])},null));})[_0x8488('0x13')](respondWithResult(_0x37ca73,null))[_0x8488('0x51')](handleError(_0x37ca73,null));};exports[_0x8488('0x9d')]=function(_0x4d611a,_0x46195e){var _0x153c05=_0x4d611a[_0x8488('0x5b')]['channel'];return db[_0x8488('0x3f')][_0x8488('0x5e')]({'where':{'id':_0x4d611a[_0x8488('0x53')]['id']},'attributes':['id',_0x8488('0x33'),_0x8488('0x28'),_0x8488('0x9e'),_0x8488('0x9f'),_0x8488('0xa0'),'interface']})['then'](handleEntityNotFound(_0x46195e,null))[_0x8488('0x13')](function(_0x215d7e){if(_0x215d7e){if(!utils[_0x8488('0xa1')](_0x153c05)){throw new db[(_0x8488('0x91'))][(_0x8488('0x93'))](_0x8488('0xa2'));}return _0x215d7e[_0x8488('0xa3')+_['capitalize'](_0x153c05[_0x8488('0xa4')]())+'Queues'](_0x4d611a[_0x8488('0x5b')][_0x8488('0x60')],{'penalty':_0x4d611a[_0x8488('0x5b')][_0x8488('0xa5')]||0x0})[_0x8488('0xa6')](function(_0x5eeb6d){for(var _0x27add0=0x0;_0x27add0<_0x4d611a[_0x8488('0x5b')][_0x8488('0x60')][_0x8488('0x48')];_0x27add0+=0x1){var _0x14e4a9={'UserId':Number(_0x4d611a[_0x8488('0x53')]['id'])};_0x14e4a9[_[_0x8488('0xa7')](_0x153c05['toLowerCase']())+_0x8488('0xa8')]=Number(_0x4d611a['body']['ids'][_0x27add0]);socket[_0x8488('0xa9')](_0x8488('0x2a')+_['capitalize'](_0x153c05[_0x8488('0xa4')]())+_0x8488('0xaa'),_0x14e4a9);}return _0x5eeb6d;})[_0x8488('0x13')](function(){if(_0x153c05===_0x8488('0xab')){return db[_0x8488('0xac')]['findAll']({'where':{'id':_0x4d611a['body'][_0x8488('0x60')]||[]},'raw':!![],'attributes':['id',_0x8488('0x33')]});}})[_0x8488('0x13')](function(_0x13abe8){var _0x3178fd=_0x215d7e['get']({'plain':!![]});var _0x4cfff4=[];if(_0x153c05===_0x8488('0xab')&&_0x3178fd[_0x8488('0x28')]===_0x8488('0x2c')&&_0x3178fd[_0x8488('0x9e')]){for(var _0x258985=0x0;_0x258985<_0x13abe8[_0x8488('0x48')];_0x258985+=0x1){_0x4cfff4[_0x8488('0x49')]({'membername':_0x3178fd[_0x8488('0x33')],'UserId':_0x3178fd['id'],'queue_name':_0x13abe8[_0x258985][_0x8488('0x33')],'VoiceQueueId':_0x13abe8[_0x258985]['id'],'interface':_[_0x8488('0x67')](_0x3178fd[_0x8488('0xad')])?util[_0x8488('0xae')](_0x8488('0xaf'),_0x3178fd[_0x8488('0x33')]):_0x3178fd['interface'],'paused':_0x3178fd[_0x8488('0xa0')]||![],'penalty':_0x4d611a[_0x8488('0x5b')][_0x8488('0xa5')]||0x0});}return BPromise['each'](_0x4cfff4,function(_0xfb02ed){return db[_0x8488('0xb0')][_0x8488('0xb1')](_0xfb02ed);});}return _0x215d7e;});}})['then'](respondWithStatusCode(_0x46195e,null))[_0x8488('0x51')](handleError(_0x46195e,null));};exports[_0x8488('0xb2')]=function(_0x5c7791,_0x310ffb){var _0x357136;return db['User'][_0x8488('0x5e')]({'where':{'id':_0x5c7791[_0x8488('0x53')]['id']},'attributes':['id',_0x8488('0x33'),_0x8488('0x28')]})[_0x8488('0x13')](handleEntityNotFound(_0x310ffb,null))[_0x8488('0x13')](function(_0x2ce70b){if(_0x2ce70b){_0x357136=_0x2ce70b;if(!_0x5c7791[_0x8488('0x45')][_0x8488('0xb3')]||!utils[_0x8488('0xa1')](_0x5c7791['query'][_0x8488('0xb3')])){throw new db[(_0x8488('0x91'))]['ValidationError'](_0x8488('0xa2'));}return _0x2ce70b['remove'+_[_0x8488('0xa7')](_0x5c7791[_0x8488('0x45')][_0x8488('0xb3')][_0x8488('0xa4')]())+_0x8488('0xb4')](_0x5c7791[_0x8488('0x45')]['ids']);}})[_0x8488('0x13')](function(_0x4da306){if(_['isArray'](_0x5c7791[_0x8488('0x45')][_0x8488('0x60')])){for(var _0x3dffa8=0x0;_0x3dffa8<_0x5c7791[_0x8488('0x45')]['ids']['length'];_0x3dffa8+=0x1){var _0x5ea079={'UserId':Number(_0x5c7791['params']['id'])};_0x5ea079[_[_0x8488('0xa7')](_0x5c7791[_0x8488('0x45')][_0x8488('0xb3')][_0x8488('0xa4')]())+_0x8488('0xa8')]=Number(_0x5c7791['query'][_0x8488('0x60')][_0x3dffa8]);socket[_0x8488('0xa9')](_0x8488('0x2a')+_['capitalize'](_0x5c7791['query'][_0x8488('0xb3')][_0x8488('0xa4')]())+'Queue:remove',_0x5ea079);}}else{var _0x5ea079={'UserId':Number(_0x5c7791[_0x8488('0x53')]['id'])};_0x5ea079[_[_0x8488('0xa7')](_0x5c7791[_0x8488('0x45')][_0x8488('0xb3')][_0x8488('0xa4')]())+_0x8488('0xa8')]=Number(_0x5c7791[_0x8488('0x45')][_0x8488('0x60')]);socket[_0x8488('0xa9')](_0x8488('0x2a')+_[_0x8488('0xa7')](_0x5c7791[_0x8488('0x45')][_0x8488('0xb3')][_0x8488('0xa4')]())+_0x8488('0xb5'),_0x5ea079);}return _0x4da306;})[_0x8488('0x13')](function(){if(_0x5c7791[_0x8488('0x45')]['channel']===_0x8488('0xab')){return db[_0x8488('0xb0')][_0x8488('0x34')]({'where':{'UserId':_0x5c7791['params']['id'],'VoiceQueueId':_0x5c7791[_0x8488('0x45')][_0x8488('0x60')]},'individualHooks':!![]})[_0x8488('0x13')](function(){return _0x357136;});}return _0x357136;})[_0x8488('0x13')](respondWithStatusCode(_0x310ffb,null))['catch'](handleError(_0x310ffb,null));};exports[_0x8488('0xb6')]=function(_0x479aca,_0xbd1f56){_0x479aca[_0x8488('0x5b')]['userpic']=_0x479aca[_0x8488('0xb7')][_0x8488('0xb8')];return db[_0x8488('0x3f')][_0x8488('0x5e')]({'where':{'id':_0x479aca[_0x8488('0x53')]['id']}})[_0x8488('0x13')](handleEntityNotFound(_0xbd1f56,null))['then'](saveUpdates(_0x479aca['body'],null))[_0x8488('0x13')](respondWithResult(_0xbd1f56,null))[_0x8488('0x51')](handleError(_0xbd1f56,null));};exports[_0x8488('0xb9')]=function(_0x2628ba,_0x15a8de){var _0x590166=path['join'](config[_0x8488('0xba')],'server/files/images/logos/default_profile.png');return db[_0x8488('0x3f')][_0x8488('0x5e')]({'where':{'id':_0x2628ba['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0x8488('0x13')](handleEntityNotFound(_0x15a8de,null))[_0x8488('0x13')](function(_0x54ac42){if(_0x54ac42){if(_[_0x8488('0x67')](_0x54ac42['userpic'])){return _0x15a8de['download'](_0x590166);}else{if(!fs[_0x8488('0xbb')](path[_0x8488('0xbc')](config[_0x8488('0xba')],'server/files/images/',_0x54ac42[_0x8488('0xbd')]))){return _0x15a8de[_0x8488('0xbe')](_0x590166);}return _0x15a8de[_0x8488('0xbe')](path[_0x8488('0xbc')](config['root'],_0x8488('0xbf'),_0x54ac42[_0x8488('0xbd')]));}}})[_0x8488('0x51')](handleError(_0x15a8de,null));};exports[_0x8488('0xc0')]=function(_0x19f9ff,_0x778e6e){return db[_0x8488('0x3f')][_0x8488('0x5e')]({'where':{'id':_0x19f9ff[_0x8488('0x53')]['id']},'attributes':['id']})[_0x8488('0x13')](handleEntityNotFound(_0x778e6e,null))[_0x8488('0x13')](function(_0x545002){var _0x4c94a2=[];values=_0x545002['dataValues'];_0x4c94a2[_0x8488('0x49')](get_open_tabs('chat',_0x545002[_0x8488('0x4b')]));_0x4c94a2['push'](get_open_tabs(_0x8488('0x4c'),_0x545002[_0x8488('0x4b')]));_0x4c94a2[_0x8488('0x49')](get_open_tabs(_0x8488('0x4f'),_0x545002['dataValues']));_0x4c94a2['push'](get_open_tabs(_0x8488('0xc1'),_0x545002['dataValues']));_0x4c94a2[_0x8488('0x49')](get_open_tabs('fax',_0x545002[_0x8488('0x4b')]));_0x4c94a2[_0x8488('0x49')](get_open_tabs('mail',_0x545002[_0x8488('0x4b')]));return BPromise[_0x8488('0x50')](_0x4c94a2);})[_0x8488('0x13')](function(_0x319912){var _0x63ed1c=[];if(_0x319912){for(var _0xd0ee30=0x0;_0xd0ee30=_0x587df0){_0x2cc01e=_0x587df0;_0x3dd890=0xc8;}else{_0x3dd890=0xce;}_0x2a7f6a[_0x6953('0x1f')](_0x3dd890);return _0x2a7f6a['set'](_0x6953('0x25'),_0x2bf39b+'-'+_0x2cc01e+'/'+_0x587df0)['json'](_0x495ebd);}return null;};}function saveUpdates(_0x173b3c){return function(_0x3b1175){if(_0x3b1175){return _0x3b1175[_0x6953('0x26')](_0x173b3c)['then'](function(_0x131992){return _0x131992;});}return null;};}function removeEntity(_0x3d7b04){return function(_0xf78141){if(_0xf78141){return _0xf78141['destroy']()[_0x6953('0x27')](function(){var _0x132a71=_0xf78141['get']({'plain':!![]});if(_0x132a71['role']===_0x6953('0x28'))return;var _0x44389b=[{'name':_0x6953('0x29'),'value':_0x6953('0x2a'),'ignore':!![]},{'name':_0x6953('0x2b'),'value':'agent','ignore':![]},{'name':_0x6953('0x2c'),'value':'telephone','ignore':![]}];var _0x2d5e76=_(_0x44389b)[_0x6953('0x2d')]('ignore')['map'](_0x6953('0x2e'))[_0x6953('0x2e')]();if(_[_0x6953('0x2f')](_0x2d5e76,_0x132a71['role'])){return;}var _0x28cb92=_['find'](_0x44389b,['value',_0x132a71['role']])['name'];return db[_0x6953('0x30')][_0x6953('0x31')]({'where':{'type':_0x28cb92,'resourceId':_0x132a71['id']}})[_0x6953('0x27')](function(){return _0xf78141;});})[_0x6953('0x27')](function(){_0x3d7b04[_0x6953('0x1f')](0xcc)[_0x6953('0x20')]();});}};}function handleEntityNotFound(_0x4f6e06){return function(_0x2b76a5){if(!_0x2b76a5){_0x4f6e06['sendStatus'](0x194);}return _0x2b76a5;};}function handleError(_0x199c67,_0x5c9a4e){_0x5c9a4e=_0x5c9a4e||0x1f4;return function(_0xc63da7){logger[_0x6953('0x1b')](_0xc63da7[_0x6953('0x32')]);if(_0xc63da7[_0x6953('0x33')]){delete _0xc63da7['name'];}_0x199c67[_0x6953('0x1f')](_0x5c9a4e)[_0x6953('0x34')](_0xc63da7);};}exports[_0x6953('0x35')]=function(_0xba2c1d,_0x40b6ea){var _0x475ea8={},_0x37b2b3={'count':0x0,'rows':[]};var _0x81428b=_(db[_0x6953('0x36')][_0x6953('0x37')])[_0x6953('0x38')](function(_0x483a33){return{'name':_0x483a33[_0x6953('0x39')],'type':_0x483a33[_0x6953('0x3a')][_0x6953('0x3b')]};})['filter'](function(_0x47e7e7){return!_[_0x6953('0x2f')](['password','salt'],_0x47e7e7[_0x6953('0x33')]);})[_0x6953('0x2e')]();_0x475ea8=qs['getOptions'](_0x81428b,_0xba2c1d);var _0x3434d6={'where':_0x475ea8[_0x6953('0x3c')]};return db[_0x6953('0x36')][_0x6953('0x24')](_0x3434d6)[_0x6953('0x27')](function(_0x4d7f59){_0x37b2b3['count']=_0x4d7f59;if(_0xba2c1d[_0x6953('0x3d')][_0x6953('0x3e')]){_0x475ea8[_0x6953('0x3f')]=[{'all':!![]}];}if(!_[_0x6953('0x2f')](_0x475ea8[_0x6953('0x40')],'id')){_0x475ea8[_0x6953('0x40')]['push']('id');}return db['User'][_0x6953('0x41')](_0x475ea8);})['then'](function(_0x588ff8){_0x37b2b3[_0x6953('0x42')]=_0x588ff8;if(_0xba2c1d[_0x6953('0x3d')][_0x6953('0x43')]===_0x6953('0x44')){var _0x139a84=[];for(var _0x5ac8f7=0x0;_0x5ac8f7<_0x37b2b3['rows'][_0x6953('0x45')];_0x5ac8f7++){_0x139a84[_0x6953('0x46')](get_open_tabs('chat',_0x37b2b3[_0x6953('0x42')][_0x5ac8f7]['dataValues']));_0x139a84[_0x6953('0x46')](get_open_tabs(_0x6953('0x47'),_0x37b2b3[_0x6953('0x42')][_0x5ac8f7][_0x6953('0x48')]));_0x139a84['push'](get_open_tabs(_0x6953('0x49'),_0x37b2b3[_0x6953('0x42')][_0x5ac8f7]['dataValues']));_0x139a84[_0x6953('0x46')](get_open_tabs(_0x6953('0x4a'),_0x37b2b3[_0x6953('0x42')][_0x5ac8f7][_0x6953('0x48')]));_0x139a84[_0x6953('0x46')](get_open_tabs(_0x6953('0x4b'),_0x37b2b3[_0x6953('0x42')][_0x5ac8f7][_0x6953('0x48')]));_0x139a84[_0x6953('0x46')](get_open_tabs(_0x6953('0x4c'),_0x37b2b3[_0x6953('0x42')][_0x5ac8f7]['dataValues']));}return BPromise[_0x6953('0x4d')](_0x139a84)['then'](function(_0x15c142){return _0x37b2b3;});}else{return _0x37b2b3;}})[_0x6953('0x27')](respondWithFilteredResult(_0x40b6ea,_0x475ea8))[_0x6953('0x1e')](handleError(_0x40b6ea,null));};exports['show']=function(_0xfb9613,_0x2a4e54){var _0x506561={'raw':![],'where':{'id':_0xfb9613[_0x6953('0x4e')]['id']}},_0x525145={};_0x525145[_0x6953('0x4f')]=_[_0x6953('0x50')](_[_0x6953('0x51')](db[_0x6953('0x36')][_0x6953('0x37')]),[_0x6953('0x52'),_0x6953('0x53')]);_0x525145[_0x6953('0x3d')]=_[_0x6953('0x51')](_0xfb9613[_0x6953('0x3d')]);_0x525145['filters']=_['intersection'](_0x525145[_0x6953('0x4f')],_0x525145[_0x6953('0x3d')]);_0x506561[_0x6953('0x40')]=_[_0x6953('0x54')](_0x525145[_0x6953('0x4f')],qs[_0x6953('0x55')](_0xfb9613[_0x6953('0x3d')][_0x6953('0x55')]));_0x506561[_0x6953('0x40')]=_0x506561['attributes']['length']?_0x506561['attributes']:_0x525145['model'];if(_0xfb9613[_0x6953('0x3d')][_0x6953('0x3e')]){_0x506561[_0x6953('0x3f')]=[{'all':!![]}];}_0x506561=_['merge']({},_0x506561,_0xfb9613['options']);if(!_[_0x6953('0x2f')](_0x506561[_0x6953('0x40')],'id')){_0x506561[_0x6953('0x40')]['push']('id');}return db['User'][_0x6953('0x56')](_0x506561)[_0x6953('0x27')](handleEntityNotFound(_0x2a4e54,null))['then'](function(_0x58fcb3){var _0x29937b=[];values=_0x58fcb3;if(_0xfb9613[_0x6953('0x3d')][_0x6953('0x43')]===_0x6953('0x44')){_0x29937b[_0x6953('0x46')](get_open_tabs('chat',_0x58fcb3[_0x6953('0x48')]));_0x29937b[_0x6953('0x46')](get_open_tabs('sms',_0x58fcb3[_0x6953('0x48')]));_0x29937b['push'](get_open_tabs(_0x6953('0x4b'),_0x58fcb3[_0x6953('0x48')]));_0x29937b[_0x6953('0x46')](get_open_tabs(_0x6953('0x4c'),_0x58fcb3['dataValues']));_0x29937b[_0x6953('0x46')](get_open_tabs(_0x6953('0x49'),_0x58fcb3[_0x6953('0x48')]));_0x29937b['push'](get_open_tabs('mail',_0x58fcb3[_0x6953('0x48')]));return BPromise[_0x6953('0x4d')](_0x29937b);}else{return values;}})[_0x6953('0x27')](function(_0x482f3b){return values;})['then'](respondWithResult(_0x2a4e54,null))[_0x6953('0x1e')](handleError(_0x2a4e54,null));};exports[_0x6953('0x26')]=function(_0x4c0f1c,_0x4f3df2){if(_0x4c0f1c[_0x6953('0x57')]['id']){delete _0x4c0f1c['body']['id'];}delete _0x4c0f1c[_0x6953('0x57')][_0x6953('0x58')];return db[_0x6953('0x36')][_0x6953('0x56')]({'where':{'id':_0x4c0f1c[_0x6953('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4f3df2,null))[_0x6953('0x27')](saveUpdates(_0x4c0f1c[_0x6953('0x57')],null))[_0x6953('0x27')](respondWithResult(_0x4f3df2,null))['catch'](handleError(_0x4f3df2,null));};exports['describe']=function(_0x1c0678,_0x2bf359){return db[_0x6953('0x36')][_0x6953('0x59')]()[_0x6953('0x27')](respondWithResult(_0x2bf359,null))['catch'](handleError(_0x2bf359,null));};exports[_0x6953('0x5a')]=function(_0x2df49c,_0xe93bf2){return db[_0x6953('0x36')][_0x6953('0x56')]({'where':{'id':_0x2df49c[_0x6953('0x4e')]['id']}})[_0x6953('0x27')](handleEntityNotFound(_0xe93bf2,null))[_0x6953('0x27')](function(_0x1cbc70){if(_0x1cbc70){return _0x1cbc70[_0x6953('0x5a')](_0x2df49c[_0x6953('0x57')][_0x6953('0x5b')],_[_0x6953('0x5c')](_0x2df49c['body'],[_0x6953('0x5b'),'id'])||{});}})[_0x6953('0x27')](respondWithResult(_0xe93bf2,null))[_0x6953('0x1e')](handleError(_0xe93bf2,null));};function validateUser(_0x20efa9){return new BPromise(function(_0x38674d,_0x523a4a){if(_0x20efa9['internal'])return _0x38674d(_0x20efa9);return db[_0x6953('0x5d')]['findById'](0x1)[_0x6953('0x27')](function(_0x2b5de2){if(_0x2b5de2[_0x6953('0x5e')])authService[_0x6953('0x5f')](_0x20efa9['password']);db[_0x6953('0x36')][_0x6953('0x60')](_0x6953('0x61'))[_0x6953('0x27')](function(_0x1c3190){if(_[_0x6953('0x62')](_0x1c3190)){_0x20efa9[_0x6953('0x61')]=_0x2b5de2[_0x6953('0x63')]||0x1;return;}if(_[_0x6953('0x62')](_0x2b5de2[_0x6953('0x63')])||_0x2b5de2[_0x6953('0x63')]===_0x1c3190){_0x20efa9[_0x6953('0x61')]=_0x1c3190+0x1;return;}if(_0x2b5de2[_0x6953('0x63')]>_0x1c3190){_0x20efa9[_0x6953('0x61')]=_0x2b5de2[_0x6953('0x63')];return;}return db['sequelize'][_0x6953('0x3d')](_0x6953('0x64'),{'type':db[_0x6953('0x65')][_0x6953('0x66')][_0x6953('0x67')]})[_0x6953('0x27')](function(_0x3e19f1){if(_0x3e19f1&&_0x3e19f1['length']){for(var _0x3bb873=0x0,_0x403d81=_0x3e19f1['length'];_0x3bb873<_0x403d81&&_[_0x6953('0x62')](_0x20efa9[_0x6953('0x61')]);_0x3bb873++){if(_0x2b5de2[_0x6953('0x63')]<=_0x3e19f1[_0x3bb873]['from']){_0x20efa9['internal']=_0x3e19f1[_0x3bb873][_0x6953('0x68')];}else if(_0x2b5de2[_0x6953('0x63')]>_0x3e19f1[_0x3bb873][_0x6953('0x68')]&&_0x2b5de2[_0x6953('0x63')]<=_0x3e19f1[_0x3bb873]['to']){_0x20efa9[_0x6953('0x61')]=_0x2b5de2[_0x6953('0x63')];}}}if(_[_0x6953('0x62')](_0x20efa9[_0x6953('0x61')])){_0x20efa9[_0x6953('0x61')]=_0x1c3190+0x1;}return _0x38674d(_0x20efa9);});});})['catch'](function(_0x78eb85){_0x523a4a(_0x78eb85);});});}function updateUser(_0x729812){return new BPromise(function(_0x1b641e,_0x3bdb47){try{if(_0x729812['voicemail']){_0x729812[_0x6953('0x69')]=_0x729812[_0x6953('0x61')];_0x729812[_0x6953('0x6a')]={'mailbox':_0x729812['internal'],'password':_0x729812[_0x6953('0x52')],'fullname':_0x729812[_0x6953('0x6b')],'email':_0x729812[_0x6953('0x6c')]};}if(_0x729812[_0x6953('0x58')]==='agent'){if(!_0x729812[_0x6953('0x6d')])_0x729812[_0x6953('0x6d')]=[_0x6953('0x6e'),_0x6953('0x6f'),'103','113',_0x6953('0x70'),_0x6953('0x71'),'105','106',_0x6953('0x72'),_0x6953('0x73'),_0x6953('0x74'),_0x6953('0x75'),'111',_0x6953('0x76'),_0x6953('0x77')];}_0x1b641e(_0x729812);}catch(_0x574606){_0x3bdb47(_0x574606);}});}exports[_0x6953('0x78')]=function(_0xd2aae9,_0x491bae){if(_0xd2aae9['user']['role']===_0x6953('0x79'))throw new Error(_0x6953('0x7a'));if(_0xd2aae9[_0x6953('0x57')][_0x6953('0x58')]===_0x6953('0x2a')&&_0xd2aae9[_0x6953('0x2a')][_0x6953('0x58')]!==_0x6953('0x28')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0xd2aae9[_0x6953('0x57')][_0x6953('0x58')]===_0x6953('0x28')&&_0xd2aae9[_0x6953('0x2a')][_0x6953('0x58')]!==_0x6953('0x28')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x6953('0x7b')]([_0xd2aae9['body']])[_0x6953('0x27')](function(){return validateUser(_0xd2aae9['body']);})[_0x6953('0x27')](function(_0x9de87a){return updateUser(_0x9de87a)[_0x6953('0x27')](function(_0x50d2e0){if(_0x50d2e0[_0x6953('0x58')]===_0x6953('0x28')){_0x50d2e0[_0x6953('0x7c')]=_0xd2aae9[_0x6953('0x2a')][_0x6953('0x7c')];delete _0x50d2e0[_0x6953('0x7d')];}return _0x50d2e0;});})['then'](function(_0x24a666){return db[_0x6953('0x36')][_0x6953('0x78')](_0x24a666,{'include':[{'model':db[_0x6953('0x6a')],'as':_0x6953('0x6a')}]});})[_0x6953('0x27')](function(_0x19716d){if(_0xd2aae9[_0x6953('0x57')][_0x6953('0x58')]===_0x6953('0x2a'))return _0x19716d;if(_0xd2aae9[_0x6953('0x2a')]['role']!==_0x6953('0x2a'))return _0x19716d;return db[_0x6953('0x7e')][_0x6953('0x56')]({'where':{'name':_0x19716d[_0x6953('0x58')]===_0x6953('0x79')?_0x6953('0x2b'):_0x6953('0x2c'),'userProfileId':_0xd2aae9[_0x6953('0x2a')][_0x6953('0x7d')]},'raw':!![]})[_0x6953('0x27')](function(_0x2feda2){if(!_0x2feda2||_0x2feda2['autoAssociation']!=0x0)return _0x19716d;return db[_0x6953('0x30')][_0x6953('0x78')]({'name':_0x19716d[_0x6953('0x33')],'resourceId':_0x19716d['id'],'type':_0x2feda2['name'],'sectionId':_0x2feda2['id']},{})[_0x6953('0x27')](function(){return _0x19716d;});})['catch'](function(_0x5c2078){logger[_0x6953('0x1b')](_0x6953('0x7f'),_0x5c2078);throw _0x5c2078;});})[_0x6953('0x27')](respondWithResult(_0x491bae,0xc9))[_0x6953('0x1e')](handleError(_0x491bae,null));};exports[_0x6953('0x80')]=function(_0x2928c3,_0x228544){var _0x5e34b6=_0x2928c3[_0x6953('0x57')];var _0x3113c0=[];if(_0x2928c3[_0x6953('0x2a')]['role']===_0x6953('0x79'))throw new Error(_0x6953('0x7a'));if(_['some'](_0x5e34b6,[_0x6953('0x58'),'user'])&&_0x2928c3['user'][_0x6953('0x58')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x6953('0x81')](_0x5e34b6,[_0x6953('0x58'),_0x6953('0x28')])&&_0x2928c3['user'][_0x6953('0x58')]!==_0x6953('0x28')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x6953('0x7b')](_0x5e34b6)[_0x6953('0x27')](function(){return validateUser(_0x5e34b6[0x0]);})[_0x6953('0x27')](function(){for(var _0x200599=0x1;_0x200599<_0x5e34b6[_0x6953('0x45')];_0x200599++){var _0x31d847=_0x5e34b6[_0x200599-0x1][_0x6953('0x61')];if(!_0x5e34b6[_0x200599][_0x6953('0x61')])_0x5e34b6[_0x200599][_0x6953('0x61')]=_0x31d847+0x1;_0x3113c0['push'](validateUser(_0x5e34b6[_0x200599]));}return BPromise[_0x6953('0x4d')](_0x3113c0);})[_0x6953('0x27')](function(){_0x3113c0=[];for(var _0x52ba59=0x0;_0x52ba59<_0x5e34b6[_0x6953('0x45')];_0x52ba59++){_0x3113c0[_0x6953('0x46')](updateUser(_0x5e34b6[_0x52ba59]));}return BPromise[_0x6953('0x4d')](_0x3113c0);})[_0x6953('0x27')](function(){return BPromise[_0x6953('0x82')](_0x5e34b6,function(_0x300be9){return db[_0x6953('0x36')]['create'](_0x300be9,{'include':[{'model':db[_0x6953('0x6a')],'as':_0x6953('0x6a')}]})[_0x6953('0x27')](function(_0x12e2ec){_0x300be9['id']=_0x12e2ec['id'];return _0x300be9;});});})[_0x6953('0x27')](function(_0xa54eb8){if(_0x2928c3[_0x6953('0x57')][_0x6953('0x58')]===_0x6953('0x2a'))return _0xa54eb8;if(_0x2928c3['user'][_0x6953('0x58')]!=='user')return _0xa54eb8;var _0x476893=_['some'](_0xa54eb8,function(_0x2c8907){return _0x2c8907[_0x6953('0x58')]===_0x6953('0x79')||_0x2c8907[_0x6953('0x58')]===_0x6953('0x83');});if(!_0x476893)return _0xa54eb8;return db['UserProfileSection'][_0x6953('0x41')]({'where':{'name':{'$or':['Agents',_0x6953('0x2c')]},'userProfileId':_0x2928c3[_0x6953('0x2a')][_0x6953('0x7d')]},'raw':!![]})[_0x6953('0x27')](function(_0x564a73){if(_[_0x6953('0x84')](_0x564a73)||!_[_0x6953('0x81')](_0x564a73,[_0x6953('0x85'),0x0]))return _0xa54eb8;_0x3113c0=[];var _0x2e5191=_(_0x564a73)[_0x6953('0x38')](function(_0x1b3658){if(_0x1b3658[_0x6953('0x85')]===0x1)return;return _0x1b3658['name']===_0x6953('0x2b')?_0x6953('0x79'):_0x6953('0x83');})[_0x6953('0x86')]()[_0x6953('0x2e')]();for(var _0x575b5f=0x0;_0x575b5f<_0xa54eb8['length'];_0x575b5f++){if(!_['includes'](_0x2e5191,_0xa54eb8[_0x575b5f][_0x6953('0x58')]))return;var _0xe578d4=_0xa54eb8[_0x575b5f][_0x6953('0x58')]==='agent'?_0x6953('0x2b'):'Telephones';_0x3113c0[_0x6953('0x46')](db[_0x6953('0x30')]['create']({'name':_0xa54eb8[_0x575b5f][_0x6953('0x33')],'resourceId':_0xa54eb8[_0x575b5f]['id'],'type':_0xe578d4,'sectionId':_['find'](_0x564a73,[_0x6953('0x33'),_0xe578d4])['id']},{}));}return BPromise['all'](_0x3113c0);});})['then'](respondWithResult(_0x228544,0xc9))[_0x6953('0x1e')](handleError(_0x228544,null));};exports[_0x6953('0x87')]=function(_0xbf0da2,_0x14ad16){if(_0xbf0da2[_0x6953('0x57')]['id']){delete _0xbf0da2[_0x6953('0x57')]['id'];}return db[_0x6953('0x36')][_0x6953('0x56')]({'where':{'id':_0xbf0da2['params']['id']}})['then'](function(_0x49fefc){if(!_0x49fefc)return null;if(_0x49fefc['id']===_0xbf0da2[_0x6953('0x2a')]['id']){if(!_0xbf0da2[_0x6953('0x57')][_0x6953('0x88')]||!_0xbf0da2[_0x6953('0x57')][_0x6953('0x89')]){throw new db['Sequelize'][(_0x6953('0x8a'))](_0x6953('0x8b'));}if(!_0x49fefc[_0x6953('0x8c')](_0xbf0da2[_0x6953('0x57')][_0x6953('0x88')])){throw new db[(_0x6953('0x8d'))][(_0x6953('0x8a'))](_0x6953('0x8e'));}if(_0xbf0da2['body'][_0x6953('0x88')]===_0xbf0da2['body'][_0x6953('0x89')]){throw new db[(_0x6953('0x8d'))][(_0x6953('0x8a'))](_0x6953('0x8f'));}}else if(_0xbf0da2[_0x6953('0x2a')][_0x6953('0x58')]==='admin'){if(!_0xbf0da2[_0x6953('0x57')]['newPassword']){throw new db[(_0x6953('0x8d'))][(_0x6953('0x8a'))](_0x6953('0x90'));}}else if(_0xbf0da2[_0x6953('0x2a')][_0x6953('0x58')]===_0x6953('0x2a')){if(!_0xbf0da2[_0x6953('0x57')][_0x6953('0x89')]){throw new db[(_0x6953('0x8d'))][(_0x6953('0x8a'))](_0x6953('0x90'));}if(_0x49fefc[_0x6953('0x58')]!==_0x6953('0x79')){throw new db[(_0x6953('0x8d'))]['ValidationError'](_0x6953('0x7a'));}}else{throw new db['Sequelize']['ValidationError']('Unauthorized');}return _0x49fefc;})[_0x6953('0x27')](handleEntityNotFound(_0x14ad16,null))[_0x6953('0x27')](function(_0x17cd4b){return db[_0x6953('0x5d')][_0x6953('0x91')]({'attributes':['id',_0x6953('0x5e'),_0x6953('0x92'),_0x6953('0x93')]})[_0x6953('0x27')](function(_0x2a9080){if(_0x2a9080[_0x6953('0x5e')])authService[_0x6953('0x5f')](_0xbf0da2[_0x6953('0x57')]['newPassword']);if(!_0x2a9080[_0x6953('0x92')]||!_0x17cd4b[_0x6953('0x94')])return _0x17cd4b;authService[_0x6953('0x95')](_0xbf0da2[_0x6953('0x57')]['newPassword'],_0x17cd4b[_0x6953('0x94')],_0x2a9080[_0x6953('0x93')]);return _0x17cd4b;})['then'](saveUpdates({'password':_0xbf0da2[_0x6953('0x57')][_0x6953('0x89')],'passwordResetAt':_0xbf0da2[_0x6953('0x2a')]['id']==_0xbf0da2[_0x6953('0x4e')]['id']?moment():null,'previousPasswords':authService[_0x6953('0x96')](_0xbf0da2['body'][_0x6953('0x89')],_0x17cd4b[_0x6953('0x94')])},null));})[_0x6953('0x27')](respondWithResult(_0x14ad16,null))[_0x6953('0x1e')](handleError(_0x14ad16,null));};exports[_0x6953('0x97')]=function(_0x4769f9,_0xedf35d){var _0x37aa51=_0x4769f9[_0x6953('0x57')][_0x6953('0x98')];return db[_0x6953('0x36')]['find']({'where':{'id':_0x4769f9['params']['id']},'attributes':['id',_0x6953('0x33'),_0x6953('0x58'),_0x6953('0x99'),_0x6953('0x9a'),_0x6953('0x9b'),_0x6953('0x9c')]})[_0x6953('0x27')](handleEntityNotFound(_0xedf35d,null))[_0x6953('0x27')](function(_0x56cf6f){if(_0x56cf6f){if(!utils['isValidChannel'](_0x37aa51)){throw new db[(_0x6953('0x8d'))]['ValidationError'](_0x6953('0x9d'));}return _0x56cf6f[_0x6953('0x9e')+_['capitalize'](_0x37aa51[_0x6953('0x9f')]())+_0x6953('0xa0')](_0x4769f9[_0x6953('0x57')][_0x6953('0x5b')],{'penalty':_0x4769f9[_0x6953('0x57')]['penalty']||0x0})[_0x6953('0xa1')](function(_0x5229b8){for(var _0x4eeecf=0x0;_0x4eeecf<_0x4769f9[_0x6953('0x57')]['ids'][_0x6953('0x45')];_0x4eeecf+=0x1){var _0x355497={'UserId':Number(_0x4769f9['params']['id'])};_0x355497[_[_0x6953('0xa2')](_0x37aa51[_0x6953('0x9f')]())+_0x6953('0xa3')]=Number(_0x4769f9[_0x6953('0x57')][_0x6953('0x5b')][_0x4eeecf]);socket[_0x6953('0xa4')](_0x6953('0x2a')+_[_0x6953('0xa2')](_0x37aa51['toLowerCase']())+_0x6953('0xa5'),_0x355497);}return _0x5229b8;})[_0x6953('0x27')](function(){if(_0x37aa51===_0x6953('0xa6')){return db[_0x6953('0xa7')][_0x6953('0x41')]({'where':{'id':_0x4769f9[_0x6953('0x57')][_0x6953('0x5b')]||[]},'raw':!![],'attributes':['id',_0x6953('0x33')]});}})['then'](function(_0x2d0702){var _0xdbd3db=_0x56cf6f[_0x6953('0xa8')]({'plain':!![]});var _0x3661ce=[];if(_0x37aa51===_0x6953('0xa6')&&_0xdbd3db[_0x6953('0x58')]===_0x6953('0x79')&&_0xdbd3db['online']){for(var _0x4c2505=0x0;_0x4c2505<_0x2d0702[_0x6953('0x45')];_0x4c2505+=0x1){_0x3661ce[_0x6953('0x46')]({'membername':_0xdbd3db[_0x6953('0x33')],'UserId':_0xdbd3db['id'],'queue_name':_0x2d0702[_0x4c2505][_0x6953('0x33')],'VoiceQueueId':_0x2d0702[_0x4c2505]['id'],'interface':_[_0x6953('0x62')](_0xdbd3db[_0x6953('0x9c')])?util[_0x6953('0xa9')](_0x6953('0xaa'),_0xdbd3db[_0x6953('0x33')]):_0xdbd3db[_0x6953('0x9c')],'paused':_0xdbd3db[_0x6953('0x9b')]||![],'penalty':_0x4769f9[_0x6953('0x57')][_0x6953('0xab')]||0x0});}return BPromise[_0x6953('0x82')](_0x3661ce,function(_0x1dcbd2){return db['UserVoiceQueueRt'][_0x6953('0xac')](_0x1dcbd2);});}return _0x56cf6f;});}})['then'](respondWithStatusCode(_0xedf35d,null))['catch'](handleError(_0xedf35d,null));};exports[_0x6953('0xad')]=function(_0x4ca574,_0x1cedb8){var _0x128748;return db[_0x6953('0x36')][_0x6953('0x56')]({'where':{'id':_0x4ca574[_0x6953('0x4e')]['id']},'attributes':['id',_0x6953('0x33'),'role']})[_0x6953('0x27')](handleEntityNotFound(_0x1cedb8,null))[_0x6953('0x27')](function(_0x7cd620){if(_0x7cd620){_0x128748=_0x7cd620;if(!_0x4ca574[_0x6953('0x3d')][_0x6953('0x98')]||!utils[_0x6953('0xae')](_0x4ca574['query'][_0x6953('0x98')])){throw new db[(_0x6953('0x8d'))][(_0x6953('0x8a'))](_0x6953('0x9d'));}return _0x7cd620[_0x6953('0xaf')+_['capitalize'](_0x4ca574[_0x6953('0x3d')][_0x6953('0x98')][_0x6953('0x9f')]())+_0x6953('0xa0')](_0x4ca574[_0x6953('0x3d')][_0x6953('0x5b')]);}})[_0x6953('0x27')](function(_0x2e68d0){if(_[_0x6953('0xb0')](_0x4ca574[_0x6953('0x3d')][_0x6953('0x5b')])){for(var _0xb74ca4=0x0;_0xb74ca4<_0x4ca574[_0x6953('0x3d')]['ids'][_0x6953('0x45')];_0xb74ca4+=0x1){var _0xcd7f7c={'UserId':Number(_0x4ca574[_0x6953('0x4e')]['id'])};_0xcd7f7c[_[_0x6953('0xa2')](_0x4ca574[_0x6953('0x3d')][_0x6953('0x98')]['toLowerCase']())+'QueueId']=Number(_0x4ca574[_0x6953('0x3d')]['ids'][_0xb74ca4]);socket[_0x6953('0xa4')](_0x6953('0x2a')+_[_0x6953('0xa2')](_0x4ca574[_0x6953('0x3d')][_0x6953('0x98')][_0x6953('0x9f')]())+'Queue:remove',_0xcd7f7c);}}else{var _0xcd7f7c={'UserId':Number(_0x4ca574[_0x6953('0x4e')]['id'])};_0xcd7f7c[_[_0x6953('0xa2')](_0x4ca574[_0x6953('0x3d')][_0x6953('0x98')][_0x6953('0x9f')]())+_0x6953('0xa3')]=Number(_0x4ca574[_0x6953('0x3d')]['ids']);socket[_0x6953('0xa4')](_0x6953('0x2a')+_['capitalize'](_0x4ca574[_0x6953('0x3d')][_0x6953('0x98')][_0x6953('0x9f')]())+_0x6953('0xb1'),_0xcd7f7c);}return _0x2e68d0;})[_0x6953('0x27')](function(){if(_0x4ca574[_0x6953('0x3d')][_0x6953('0x98')]===_0x6953('0xa6')){return db[_0x6953('0xb2')][_0x6953('0x31')]({'where':{'UserId':_0x4ca574['params']['id'],'VoiceQueueId':_0x4ca574[_0x6953('0x3d')]['ids']},'individualHooks':!![]})['then'](function(){return _0x128748;});}return _0x128748;})[_0x6953('0x27')](respondWithStatusCode(_0x1cedb8,null))[_0x6953('0x1e')](handleError(_0x1cedb8,null));};exports[_0x6953('0xb3')]=function(_0x49b41d,_0x487e1d){_0x49b41d[_0x6953('0x57')]['userpic']=_0x49b41d[_0x6953('0xb4')]['filename'];return db[_0x6953('0x36')][_0x6953('0x56')]({'where':{'id':_0x49b41d['params']['id']}})['then'](handleEntityNotFound(_0x487e1d,null))[_0x6953('0x27')](saveUpdates(_0x49b41d[_0x6953('0x57')],null))[_0x6953('0x27')](respondWithResult(_0x487e1d,null))[_0x6953('0x1e')](handleError(_0x487e1d,null));};exports['getAvatar']=function(_0x5ef901,_0x43fa2f){var _0xbeda4b=path[_0x6953('0xb5')](config[_0x6953('0xb6')],_0x6953('0xb7'));return db[_0x6953('0x36')][_0x6953('0x56')]({'where':{'id':_0x5ef901[_0x6953('0x4e')]['id']},'attributes':['id',_0x6953('0xb8')],'raw':!![]})['then'](handleEntityNotFound(_0x43fa2f,null))[_0x6953('0x27')](function(_0x46e1a0){if(_0x46e1a0){if(_[_0x6953('0x62')](_0x46e1a0[_0x6953('0xb8')])){return _0x43fa2f[_0x6953('0xb9')](_0xbeda4b);}else{if(!fs[_0x6953('0xba')](path[_0x6953('0xb5')](config[_0x6953('0xb6')],_0x6953('0xbb'),_0x46e1a0[_0x6953('0xb8')]))){return _0x43fa2f[_0x6953('0xb9')](_0xbeda4b);}return _0x43fa2f[_0x6953('0xb9')](path[_0x6953('0xb5')](config[_0x6953('0xb6')],_0x6953('0xbb'),_0x46e1a0[_0x6953('0xb8')]));}}})[_0x6953('0x1e')](handleError(_0x43fa2f,null));};exports[_0x6953('0xbc')]=function(_0xb8b49b,_0x2b52ef){return db[_0x6953('0x36')][_0x6953('0x56')]({'where':{'id':_0xb8b49b[_0x6953('0x4e')]['id']},'attributes':['id']})[_0x6953('0x27')](handleEntityNotFound(_0x2b52ef,null))[_0x6953('0x27')](function(_0x51ea38){var _0x11aece=[];values=_0x51ea38['dataValues'];_0x11aece[_0x6953('0x46')](get_open_tabs(_0x6953('0xbd'),_0x51ea38[_0x6953('0x48')]));_0x11aece[_0x6953('0x46')](get_open_tabs(_0x6953('0x47'),_0x51ea38[_0x6953('0x48')]));_0x11aece[_0x6953('0x46')](get_open_tabs('openchannel',_0x51ea38[_0x6953('0x48')]));_0x11aece[_0x6953('0x46')](get_open_tabs(_0x6953('0x4c'),_0x51ea38[_0x6953('0x48')]));_0x11aece[_0x6953('0x46')](get_open_tabs(_0x6953('0x49'),_0x51ea38[_0x6953('0x48')]));_0x11aece[_0x6953('0x46')](get_open_tabs(_0x6953('0x4a'),_0x51ea38[_0x6953('0x48')]));return BPromise[_0x6953('0x4d')](_0x11aece);})[_0x6953('0x27')](function(_0x481206){var _0x392c3d=[];if(_0x481206){for(var _0x36d3ef=0x0;_0x36d3ef=_0x1cc806[_0x9283('0x52')]){throw new Error(_0x9283('0x53'));}})[_0x9283('0x11')](function(){if(_0x5c4051){return db[_0x9283('0x2b')]['destroy']({'where':{'membername':_0x5c4051['name']},'individualHooks':!![]});}})[_0x9283('0x11')](function(){if(_0x5c4051){return _0x5c4051['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x154821){if(_0x5c4051){if(_0x154821){var _0x1013bc=[];_0x3af5c9=_0x154821;if(_0x3af5c9['length']){for(var _0x44cc16=0x0;_0x44cc16<_0x3af5c9[_0x9283('0x2f')];_0x44cc16++){_0x1013bc[_0x9283('0x33')](db[_0x9283('0x2b')][_0x9283('0x54')]({'membername':_0x5c4051[_0x9283('0x28')],'UserId':_0x5c4051['id'],'queue_name':_0x3af5c9[_0x44cc16]['name'],'VoiceQueueId':_0x3af5c9[_0x44cc16]['id'],'interface':_0x19470a,'paused':_0x5c4051[_0x9283('0x4f')]||![],'penalty':_0x3af5c9[_0x44cc16][_0x9283('0x55')]||0x0}));}return BPromise[_0x9283('0x4a')](_0x1013bc);}}}})['then'](function(){if(_0x5c4051){return db[_0x9283('0x3a')]['findAll']({'where':{'membername':_0x5c4051[_0x9283('0x28')],'exitAt':null}});}})['then'](function(_0x18562d){if(_0x5c4051){if(_0x18562d&&_0x18562d[_0x9283('0x2f')]){var _0x12ef38=[];_0x18562d[_0x9283('0x49')](function(_0xb41e66){_0x12ef38['push'](_0xb41e66['update']({'exitAt':moment()[_0x9283('0x36')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x9283('0x4a')](_0x12ef38);}}})[_0x9283('0x11')](function(_0x3bf10e){if(_0x5c4051){var _0x1d356e=[];var _0x2f84d1=[];var _0x2ba5be=utils['getChannels']();var _0x543d46={'membername':_0x5c4051[_0x9283('0x28')],'interface':_0x19470a,'enterAt':moment()[_0x9283('0x36')](_0x9283('0x30')),'role':_0x5c4051[_0x9283('0x39')],'internal':_0x5c4051['internal']};_0x2ba5be['forEach'](function(_0x904ef){_0x1d356e['push'](_['merge']({'channel':_0x904ef,'type':_0x9283('0x56'),'data1':_0x9283('0x57'),'data2':_0x19470a},_0x543d46));if(_0x5c4051[_0x9283('0x4f')]){_0x2f84d1[_0x9283('0x33')](_[_0x9283('0x58')]({'channel':_0x904ef,'type':_0x9283('0x2e'),'data1':_0x9283('0x59')},_0x543d46));}});return db[_0x9283('0x3a')][_0x9283('0x5a')](_0x1d356e[_0x9283('0x5b')](_0x2f84d1),{'individualHooks':!![]});}})[_0x9283('0x11')](function(){if(_0x5c4051){return _0x5c4051[_0x9283('0x2c')]({'online':!![],'lastLoginAt':moment()[_0x9283('0x36')](_0x9283('0x30')),'voicePause':_0x5c4051[_0x9283('0x4f')]||![],'mailPause':_0x5c4051[_0x9283('0x4f')]||![],'chatPause':_0x5c4051[_0x9283('0x4f')]||![],'faxPause':_0x5c4051[_0x9283('0x4f')]||![],'smsPause':_0x5c4051[_0x9283('0x4f')]||![],'openchannelPause':_0x5c4051['loginInPause']||![],'pauseType':_0x5c4051[_0x9283('0x4f')]?_0x9283('0x59'):null,'lastPauseAt':moment()['format'](_0x9283('0x30')),'interface':_0x19470a});}})[_0x9283('0x11')](function(_0x82a89d){_0x458c89(_0x82a89d);})['catch'](function(_0x4eaeeb){_0x2628ae(_0x46ec52[_0x9283('0x17')](0x1f4,_0x4eaeeb[_0x9283('0x18')]));});});}; \ No newline at end of file +var _0xf71e=['stringify','error','code','message','result','catch','GetUser','User','findAll','options','raw','where','limit','include','model','attributes','map','ShowUser','find','name','internal','UserVoiceQueueRt','update','MemberReport','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','interface','SIP/%s','PAUSE','body','type','DEFAULT\x20PAUSE','role','uniqueid','bulkCreate','UnpauseUser','findOne','channel','isValidChannel','Unknown\x20channel','voice','system','mail','chat','fax','sms','whatsapp','set','%s%s','LogoutUser','destroy','all','LoginUser','mobile','phone','loginInPause','count','agent','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','concat','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','./user.socket','register','then','info','User,\x20%s,\x20%s','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xbcb4bf,_0x5296ed){var _0x3932b3=function(_0x3df0f2){while(--_0x3df0f2){_0xbcb4bf['push'](_0xbcb4bf['shift']());}};_0x3932b3(++_0x5296ed);}(_0xf71e,0x1ca));var _0xef71=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0xf71e[_0x54d4a8];return _0x3b321b;};'use strict';var _=require(_0xef71('0x0'));var util=require(_0xef71('0x1'));var moment=require(_0xef71('0x2'));var BPromise=require('bluebird');var rs=require(_0xef71('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef71('0x4'))['db'];var utils=require(_0xef71('0x5'));var logger=require(_0xef71('0x6'))(_0xef71('0x7'));var config=require(_0xef71('0x8'));var jayson=require(_0xef71('0x9'));var client=jayson[_0xef71('0xa')]['http']({'port':0x232a});config['redis']=_[_0xef71('0xb')](config[_0xef71('0xc')],{'host':_0xef71('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xef71('0xc')]));require(_0xef71('0xe'))[_0xef71('0xf')](socket);function respondWithRpcPromise(_0xea609f,_0x460928,_0x562cde){return new BPromise(function(_0x3f311c,_0x303431){return client['request'](_0xea609f,_0x562cde)[_0xef71('0x10')](function(_0x4c6664){logger[_0xef71('0x11')](_0xef71('0x12'),_0x460928,'request\x20sent');logger[_0xef71('0x13')](_0xef71('0x14'),_0x460928,_0xef71('0x15'),JSON[_0xef71('0x16')](_0x4c6664));if(_0x4c6664[_0xef71('0x17')]){if(_0x4c6664[_0xef71('0x17')][_0xef71('0x18')]===0x1f4){logger['error']('User,\x20%s,\x20%s',_0x460928,_0x4c6664[_0xef71('0x17')]['message']);return _0x303431(_0x4c6664[_0xef71('0x17')][_0xef71('0x19')]);}logger[_0xef71('0x17')]('User,\x20%s,\x20%s',_0x460928,_0x4c6664[_0xef71('0x17')]['message']);return _0x3f311c(_0x4c6664['error']['message']);}else{logger[_0xef71('0x11')](_0xef71('0x12'),_0x460928,_0xef71('0x15'));_0x3f311c(_0x4c6664[_0xef71('0x1a')][_0xef71('0x19')]);}})[_0xef71('0x1b')](function(_0x1f38a5){logger[_0xef71('0x17')](_0xef71('0x12'),_0x460928,_0x1f38a5);_0x303431(_0x1f38a5);});});}exports[_0xef71('0x1c')]=function(_0xeae582){var _0x8c7f2f=this;return new Promise(function(_0x53716b,_0x2fc55f){return db[_0xef71('0x1d')][_0xef71('0x1e')]({'raw':_0xeae582['options']?_0xeae582[_0xef71('0x1f')][_0xef71('0x20')]===undefined?!![]:![]:!![],'where':_0xeae582[_0xef71('0x1f')]?_0xeae582['options'][_0xef71('0x21')]||null:null,'attributes':_0xeae582[_0xef71('0x1f')]?_0xeae582[_0xef71('0x1f')]['attributes']||null:null,'limit':_0xeae582[_0xef71('0x1f')]?_0xeae582[_0xef71('0x1f')][_0xef71('0x22')]||null:null,'include':_0xeae582[_0xef71('0x1f')]?_0xeae582[_0xef71('0x1f')][_0xef71('0x23')]?_['map'](_0xeae582[_0xef71('0x1f')][_0xef71('0x23')],function(_0x180afe){return{'model':db[_0x180afe[_0xef71('0x24')]],'as':_0x180afe['as'],'attributes':_0x180afe[_0xef71('0x25')],'include':_0x180afe['include']?_[_0xef71('0x26')](_0x180afe[_0xef71('0x23')],function(_0x260c36){return{'model':db[_0x260c36[_0xef71('0x24')]],'as':_0x260c36['as'],'attributes':_0x260c36[_0xef71('0x25')],'include':_0x260c36[_0xef71('0x23')]?_[_0xef71('0x26')](_0x260c36[_0xef71('0x23')],function(_0x45491a){return{'model':db[_0x45491a[_0xef71('0x24')]],'as':_0x45491a['as'],'attributes':_0x45491a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x35a48a){logger[_0xef71('0x11')](_0xef71('0x1c'),_0xeae582);logger['debug'](_0xef71('0x1c'),_0xeae582,JSON[_0xef71('0x16')](_0x35a48a));_0x53716b(_0x35a48a);})[_0xef71('0x1b')](function(_0x1af1bc){logger[_0xef71('0x17')](_0xef71('0x1c'),_0x1af1bc['message'],_0xeae582);_0x2fc55f(_0x8c7f2f['error'](0x1f4,_0x1af1bc[_0xef71('0x19')]));});});};exports[_0xef71('0x27')]=function(_0x102f8d){var _0x27b152=this;return new Promise(function(_0x380755,_0x4b7506){return db[_0xef71('0x1d')][_0xef71('0x28')]({'raw':_0x102f8d['options']?_0x102f8d[_0xef71('0x1f')][_0xef71('0x20')]===undefined?!![]:![]:!![],'where':_0x102f8d[_0xef71('0x1f')]?_0x102f8d[_0xef71('0x1f')][_0xef71('0x21')]||null:null,'attributes':_0x102f8d[_0xef71('0x1f')]?_0x102f8d[_0xef71('0x1f')][_0xef71('0x25')]||null:null,'include':_0x102f8d[_0xef71('0x1f')]?_0x102f8d[_0xef71('0x1f')][_0xef71('0x23')]?_[_0xef71('0x26')](_0x102f8d[_0xef71('0x1f')][_0xef71('0x23')],function(_0x40d2c8){return{'model':db[_0x40d2c8[_0xef71('0x24')]],'as':_0x40d2c8['as'],'attributes':_0x40d2c8[_0xef71('0x25')],'include':_0x40d2c8[_0xef71('0x23')]?_[_0xef71('0x26')](_0x40d2c8[_0xef71('0x23')],function(_0x1a9b58){return{'model':db[_0x1a9b58[_0xef71('0x24')]],'as':_0x1a9b58['as'],'attributes':_0x1a9b58[_0xef71('0x25')],'include':_0x1a9b58[_0xef71('0x23')]?_['map'](_0x1a9b58[_0xef71('0x23')],function(_0x216ad8){return{'model':db[_0x216ad8[_0xef71('0x24')]],'as':_0x216ad8['as'],'attributes':_0x216ad8[_0xef71('0x25')]};}):[]};}):[]};}):[]:[]})[_0xef71('0x10')](function(_0x1d45f5){logger['info'](_0xef71('0x27'),_0x102f8d);logger[_0xef71('0x13')](_0xef71('0x27'),_0x102f8d,JSON[_0xef71('0x16')](_0x1d45f5));_0x380755(_0x1d45f5);})[_0xef71('0x1b')](function(_0x51e8bc){logger[_0xef71('0x17')](_0xef71('0x27'),_0x51e8bc['message'],_0x102f8d);_0x4b7506(_0x27b152['error'](0x1f4,_0x51e8bc['message']));});});};exports['PauseUser']=function(_0x2dcb87){var _0x4e880b=this;return new Promise(function(_0x331a3f,_0x2a698d){var _0x440f8f;return db[_0xef71('0x1d')][_0xef71('0x28')]({'where':_0x2dcb87['options'][_0xef71('0x21')]||{},'attributes':['id',_0xef71('0x29'),'role',_0xef71('0x2a'),'interface']})['then'](function(_0x142cf4){if(_0x142cf4){_0x440f8f=_0x142cf4;return db[_0xef71('0x2b')][_0xef71('0x2c')]({'paused':0x1},{'where':{'UserId':_0x440f8f['id']},'individualHooks':!![]});}})['then'](function(){if(_0x440f8f){return db[_0xef71('0x2d')]['findAll']({'where':{'membername':_0x440f8f[_0xef71('0x29')],'type':'PAUSE','exitAt':null}});}})[_0xef71('0x10')](function(_0x216f2b){if(_0x440f8f){if(_0x216f2b&&_0x216f2b[_0xef71('0x2e')]){var _0x2e5c7b=moment()[_0xef71('0x2f')](_0xef71('0x30'));for(var _0x3ba3b6=0x0,_0x1ea904=_0x216f2b[_0xef71('0x2e')];_0x3ba3b6<_0x1ea904;_0x3ba3b6++){_0x216f2b[_0x3ba3b6][_0xef71('0x31')]({'exitAt':_0x2e5c7b});}}}})[_0xef71('0x10')](function(){if(_0x440f8f){var _0x540bb2=[];var _0x406272=utils[_0xef71('0x32')]();_0x406272[_0xef71('0x33')](function(_0x5116a9){_0x540bb2[_0xef71('0x34')]({'channel':_0x5116a9,'membername':_0x440f8f[_0xef71('0x29')],'interface':_[_0xef71('0x35')](_0x440f8f[_0xef71('0x36')])?util[_0xef71('0x2f')](_0xef71('0x37'),_0x440f8f[_0xef71('0x29')]):_0x440f8f[_0xef71('0x36')],'type':_0xef71('0x38'),'enterAt':moment()[_0xef71('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x2dcb87[_0xef71('0x39')][_0xef71('0x3a')]||_0xef71('0x3b'),'role':_0x440f8f[_0xef71('0x3c')],'internal':_0x440f8f[_0xef71('0x2a')],'uniqueid':_0x2dcb87['body'][_0xef71('0x3d')]||null});});return db['MemberReport'][_0xef71('0x3e')](_0x540bb2,{'individualHooks':!![]});}})[_0xef71('0x10')](function(){if(_0x440f8f){return _0x440f8f[_0xef71('0x2c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x2dcb87['body'][_0xef71('0x3a')]||_0xef71('0x3b'),'lastPauseAt':moment()[_0xef71('0x2f')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xef71('0x10')](function(_0x4fe404){_0x331a3f(_0x4fe404);})[_0xef71('0x1b')](function(_0x69962){_0x2a698d(_0x4e880b[_0xef71('0x17')](0x1f4,_0x69962[_0xef71('0x19')]));});});};exports[_0xef71('0x3f')]=function(_0x5103f3){var _0x297bfb=this;return new Promise(function(_0x401e85,_0x3dfa66){var _0x3ed2b0;return db[_0xef71('0x1d')][_0xef71('0x40')]({'where':_0x5103f3[_0xef71('0x1f')][_0xef71('0x21')]||{},'attributes':['id',_0xef71('0x29')]})[_0xef71('0x10')](function(_0x5da0b5){if(_0x5da0b5){_0x3ed2b0=_0x5da0b5;if(_0x5103f3['body'][_0xef71('0x41')]&&!utils[_0xef71('0x42')](_0x5103f3['body'][_0xef71('0x41')])){throw new Error(_0xef71('0x43'));}switch(_0x5103f3[_0xef71('0x39')][_0xef71('0x41')]){case _0xef71('0x44'):return db[_0xef71('0x2b')][_0xef71('0x2c')]({'paused':0x0},{'where':{'UserId':_0x3ed2b0['id']}})[_0xef71('0x10')](function(){return db[_0xef71('0x2d')][_0xef71('0x28')]({'where':{'channel':_0x5103f3[_0xef71('0x39')][_0xef71('0x41')],'membername':_0x3ed2b0[_0xef71('0x29')],'type':_0xef71('0x38'),'exitAt':null}});})[_0xef71('0x10')](function(_0x194516){if(_0x194516){return _0x194516[_0xef71('0x2c')]({'exitAt':moment()[_0xef71('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xef71('0x45')},{'individualHooks':!![]});}return null;})[_0xef71('0x10')](function(){return _0x3ed2b0[_0xef71('0x2c')]({'voicePause':![]});});case _0xef71('0x46'):case _0xef71('0x47'):case _0xef71('0x48'):case _0xef71('0x49'):case'openchannel':case _0xef71('0x4a'):return db[_0xef71('0x2d')][_0xef71('0x28')]({'where':{'channel':_0x5103f3[_0xef71('0x39')][_0xef71('0x41')],'membername':_0x3ed2b0[_0xef71('0x29')],'type':'PAUSE','exitAt':null}})[_0xef71('0x10')](function(_0x425488){return _0x425488[_0xef71('0x2c')]({'exitAt':moment()[_0xef71('0x2f')](_0xef71('0x30')),'data2':'system'},{'individualHooks':!![]});})[_0xef71('0x10')](function(){var _0x1c5dec={};_[_0xef71('0x4b')](_0x1c5dec,util['format'](_0xef71('0x4c'),_0x5103f3[_0xef71('0x39')][_0xef71('0x41')],'Pause'),![]);return _0x3ed2b0['update'](_0x1c5dec);});default:return db[_0xef71('0x2b')][_0xef71('0x2c')]({'paused':0x0},{'where':{'UserId':_0x3ed2b0['id']}})['then'](function(){return db[_0xef71('0x2d')]['findAll']({'where':{'membername':_0x3ed2b0[_0xef71('0x29')],'type':_0xef71('0x38'),'exitAt':null}});})[_0xef71('0x10')](function(_0x4a87ed){var _0x7b1586=[];_0x4a87ed[_0xef71('0x33')](function(_0x1d3d5d){_0x7b1586[_0xef71('0x34')](_0x1d3d5d[_0xef71('0x2c')]({'exitAt':moment()[_0xef71('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'}));});return BPromise['all'](_0x7b1586);})[_0xef71('0x10')](function(){return _0x3ed2b0[_0xef71('0x2c')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0xef71('0x10')](function(_0x9d9c58){_0x401e85(_0x9d9c58);})[_0xef71('0x1b')](function(_0xd47ee4){_0x3dfa66(_0x297bfb[_0xef71('0x17')](0x1f4,_0xd47ee4[_0xef71('0x19')]));});});};exports[_0xef71('0x4d')]=function(_0x36c76f){var _0x33001e=this;return new Promise(function(_0x306150,_0x5ee237){var _0x437500;return db[_0xef71('0x1d')][_0xef71('0x40')]({'where':_0x36c76f[_0xef71('0x1f')][_0xef71('0x21')]||{},'attributes':['id','name']})['then'](function(_0x29811e){if(_0x29811e){_0x437500=_0x29811e;return db[_0xef71('0x2b')][_0xef71('0x4e')]({'where':{'membername':_0x437500[_0xef71('0x29')]},'individualHooks':!![]});}})[_0xef71('0x10')](function(){if(_0x437500){return db[_0xef71('0x2d')][_0xef71('0x1e')]({'where':{'membername':_0x437500['name'],'exitAt':null}});}})[_0xef71('0x10')](function(_0x164f54){if(_0x437500){if(_0x164f54&&_0x164f54[_0xef71('0x2e')]){var _0x300cca=[];_0x164f54[_0xef71('0x33')](function(_0x3855fb){_0x300cca['push'](_0x3855fb[_0xef71('0x2c')]({'exitAt':moment()[_0xef71('0x2f')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xef71('0x4f')](_0x300cca);}}})['then'](function(){if(_0x437500){return _0x437500[_0xef71('0x2c')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xef71('0x10')](function(_0x15e301){_0x306150(_0x15e301);})[_0xef71('0x1b')](function(_0x169a22){_0x5ee237(_0x33001e[_0xef71('0x17')](0x1f4,_0x169a22[_0xef71('0x19')]));});});};exports[_0xef71('0x50')]=function(_0x12e53b){var _0x2e1ab3=this;return new Promise(function(_0x55d4c4,_0x5726d5){var _0x37cc38;var _0x134d09;var _0x571309;var _0x58ea49;return db[_0xef71('0x1d')][_0xef71('0x40')]({'where':_0x12e53b[_0xef71('0x1f')][_0xef71('0x21')]||{},'attributes':['id','name',_0xef71('0x3c'),_0xef71('0x51'),_0xef71('0x52'),_0xef71('0x2a'),_0xef71('0x53'),_0xef71('0x36')]})[_0xef71('0x10')](function(_0x37fd3e){if(_0x37fd3e){_0x37cc38=_0x37fd3e;_0x58ea49=_0x12e53b[_0xef71('0x39')][_0xef71('0x36')]?_0x12e53b[_0xef71('0x39')][_0xef71('0x36')]:util[_0xef71('0x2f')](_0xef71('0x37'),_0x37cc38[_0xef71('0x29')]);return db[_0xef71('0x1d')][_0xef71('0x54')]({'where':{'role':_0xef71('0x55'),'online':!![],'id':{'$ne':_0x37cc38['id']}}});}})[_0xef71('0x10')](function(_0x1d826e){if(_0x1d826e){_0x571309=_0x1d826e;return require('../../config/license/util')[_0xef71('0x56')]();}})[_0xef71('0x10')](function(_0x1587c6){if(_0x1587c6&&_0x1587c6[_0xef71('0x57')]&&_0x571309>=_0x1587c6[_0xef71('0x57')]){throw new Error(_0xef71('0x58'));}})[_0xef71('0x10')](function(){if(_0x37cc38){return db[_0xef71('0x2b')][_0xef71('0x4e')]({'where':{'membername':_0x37cc38[_0xef71('0x29')]},'individualHooks':!![]});}})[_0xef71('0x10')](function(){if(_0x37cc38){return _0x37cc38[_0xef71('0x59')]({'raw':!![]});}})['then'](function(_0x3bca33){if(_0x37cc38){if(_0x3bca33){var _0x30c85d=[];_0x134d09=_0x3bca33;if(_0x134d09['length']){for(var _0x383f8f=0x0;_0x383f8f<_0x134d09[_0xef71('0x2e')];_0x383f8f++){_0x30c85d[_0xef71('0x34')](db[_0xef71('0x2b')][_0xef71('0x5a')]({'membername':_0x37cc38['name'],'UserId':_0x37cc38['id'],'queue_name':_0x134d09[_0x383f8f]['name'],'VoiceQueueId':_0x134d09[_0x383f8f]['id'],'interface':_0x58ea49,'paused':_0x37cc38[_0xef71('0x53')]||![],'penalty':_0x134d09[_0x383f8f][_0xef71('0x5b')]||0x0}));}return BPromise[_0xef71('0x4f')](_0x30c85d);}}}})['then'](function(){if(_0x37cc38){return db[_0xef71('0x2d')][_0xef71('0x1e')]({'where':{'membername':_0x37cc38[_0xef71('0x29')],'exitAt':null}});}})['then'](function(_0x1d783e){if(_0x37cc38){if(_0x1d783e&&_0x1d783e[_0xef71('0x2e')]){var _0xc488b0=[];_0x1d783e[_0xef71('0x33')](function(_0x3a3b43){_0xc488b0['push'](_0x3a3b43[_0xef71('0x2c')]({'exitAt':moment()['format'](_0xef71('0x30'))}));});return BPromise[_0xef71('0x4f')](_0xc488b0);}}})[_0xef71('0x10')](function(_0x10c3da){if(_0x37cc38){var _0x244996=[];var _0xbe1866=[];var _0x519089=utils[_0xef71('0x32')]();var _0x398b5b={'membername':_0x37cc38[_0xef71('0x29')],'interface':_0x58ea49,'enterAt':moment()[_0xef71('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x37cc38['role'],'internal':_0x37cc38[_0xef71('0x2a')]};_0x519089[_0xef71('0x33')](function(_0x4e9e50){_0x244996['push'](_[_0xef71('0x5c')]({'channel':_0x4e9e50,'type':_0xef71('0x5d'),'data1':_0xef71('0x5e'),'data2':_0x58ea49},_0x398b5b));if(_0x37cc38['loginInPause']){_0xbe1866[_0xef71('0x34')](_[_0xef71('0x5c')]({'channel':_0x4e9e50,'type':_0xef71('0x38'),'data1':'LOGININPAUSE'},_0x398b5b));}});return db[_0xef71('0x2d')][_0xef71('0x3e')](_0x244996[_0xef71('0x5f')](_0xbe1866),{'individualHooks':!![]});}})[_0xef71('0x10')](function(){if(_0x37cc38){return _0x37cc38[_0xef71('0x2c')]({'online':!![],'lastLoginAt':moment()['format'](_0xef71('0x30')),'voicePause':_0x37cc38[_0xef71('0x53')]||![],'mailPause':_0x37cc38[_0xef71('0x53')]||![],'chatPause':_0x37cc38['loginInPause']||![],'faxPause':_0x37cc38[_0xef71('0x53')]||![],'smsPause':_0x37cc38[_0xef71('0x53')]||![],'openchannelPause':_0x37cc38[_0xef71('0x53')]||![],'pauseType':_0x37cc38['loginInPause']?'LOGININPAUSE':null,'lastPauseAt':moment()[_0xef71('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x58ea49});}})[_0xef71('0x10')](function(_0x23d856){_0x55d4c4(_0x23d856);})[_0xef71('0x1b')](function(_0x2c8903){_0x5726d5(_0x2e1ab3[_0xef71('0x17')](0x1f4,_0x2c8903[_0xef71('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index b0355ee..81383cf 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 _0xc988=['update','emit','removeListener','register','user:'];(function(_0x4c98b9,_0x1ad11b){var _0x3a257a=function(_0x147857){while(--_0x147857){_0x4c98b9['push'](_0x4c98b9['shift']());}};_0x3a257a(++_0x1ad11b);}(_0xc988,0x1cc));var _0x8c98=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0xc988[_0x576170];return _0x397c70;};'use strict';var UserEvents=require('./user.events');var events=['save','remove',_0x8c98('0x0')];function createListener(_0x6d9df,_0x50036b){return function(_0x3b409d){_0x50036b[_0x8c98('0x1')](_0x6d9df,_0x3b409d);};}function removeListener(_0xcde86e,_0x19e7a5){return function(){UserEvents[_0x8c98('0x2')](_0xcde86e,_0x19e7a5);};}exports[_0x8c98('0x3')]=function(_0x45ecd0){for(var _0x39bbc0=0x0,_0xbe8431=events['length'];_0x39bbc0<_0xbe8431;_0x39bbc0++){var _0x2510f6=events[_0x39bbc0];var _0x567a2a=createListener(_0x8c98('0x4')+_0x2510f6,_0x45ecd0);UserEvents['on'](_0x2510f6,_0x567a2a);}}; \ No newline at end of file +var _0x9329=['./user.events','save','update','emit','removeListener','register','user:'];(function(_0x1da7f8,_0x3f70aa){var _0x1b11e3=function(_0x1f21e9){while(--_0x1f21e9){_0x1da7f8['push'](_0x1da7f8['shift']());}};_0x1b11e3(++_0x3f70aa);}(_0x9329,0x15e));var _0x9932=function(_0x1630fd,_0x2ec6eb){_0x1630fd=_0x1630fd-0x0;var _0x49bf45=_0x9329[_0x1630fd];return _0x49bf45;};'use strict';var UserEvents=require(_0x9932('0x0'));var events=[_0x9932('0x1'),'remove',_0x9932('0x2')];function createListener(_0x3b92c7,_0x1642c0){return function(_0x2570c9){_0x1642c0[_0x9932('0x3')](_0x3b92c7,_0x2570c9);};}function removeListener(_0x3080b8,_0x26e4c6){return function(){UserEvents[_0x9932('0x4')](_0x3080b8,_0x26e4c6);};}exports[_0x9932('0x5')]=function(_0x44258e){for(var _0x34e768=0x0,_0x2f7063=events['length'];_0x34e768<_0x2f7063;_0x34e768++){var _0x202ee8=events[_0x34e768];var _0x13688f=createListener(_0x9932('0x6')+_0x202ee8,_0x44258e);UserEvents['on'](_0x202ee8,_0x13688f);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 72fdfd4..f20d17f 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(_0x571db3,_0x419d9a){var _0x1034be=function(_0x333d8c){while(--_0x333d8c){_0x571db3['push'](_0x571db3['shift']());}};_0x1034be(++_0x419d9a);}(_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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xb01615,_0x2f5535){var _0x2d1b5b=function(_0x3c3417){while(--_0x3c3417){_0xb01615['push'](_0xb01615['shift']());}};_0x2d1b5b(++_0x2f5535);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x119b3e,_0x588d50){_0x119b3e=_0x119b3e-0x0;var _0x1169ae=_0xcb91[_0x119b3e];return _0x1169ae;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 5e76dab..3dddeac 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 _0xf75b=['exports','INTEGER','sequelize'];(function(_0x425541,_0x5dec0e){var _0x455616=function(_0x28e721){while(--_0x28e721){_0x425541['push'](_0x425541['shift']());}};_0x455616(++_0x5dec0e);}(_0xf75b,0x1f4));var _0xbf75=function(_0x50e888,_0x29b0d8){_0x50e888=_0x50e888-0x0;var _0x646a07=_0xf75b[_0x50e888];return _0x646a07;};'use strict';var Sequelize=require(_0xbf75('0x0'));module[_0xbf75('0x1')]={'penalty':{'type':Sequelize[_0xbf75('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7ae5=['INTEGER','sequelize','exports'];(function(_0x42b030,_0x252cb6){var _0x112303=function(_0x261838){while(--_0x261838){_0x42b030['push'](_0x42b030['shift']());}};_0x112303(++_0x252cb6);}(_0x7ae5,0x133));var _0x57ae=function(_0x45e725,_0x452382){_0x45e725=_0x45e725-0x0;var _0x1346a1=_0x7ae5[_0x45e725];return _0x1346a1;};'use strict';var Sequelize=require(_0x57ae('0x0'));module[_0x57ae('0x1')]={'penalty':{'type':Sequelize[_0x57ae('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 34c4a31..6e24b69 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 _0x5108=['define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','bluebird','request-promise','./userChatQueue.attributes','exports'];(function(_0xe64b39,_0x21e115){var _0x43eb66=function(_0x1ca777){while(--_0x1ca777){_0xe64b39['push'](_0xe64b39['shift']());}};_0x43eb66(++_0x21e115);}(_0x5108,0x7c));var _0x8510=function(_0x528a8a,_0x5e138f){_0x528a8a=_0x528a8a-0x0;var _0x4469f5=_0x5108[_0x528a8a];return _0x4469f5;};'use strict';var _=require(_0x8510('0x0'));var util=require(_0x8510('0x1'));var logger=require(_0x8510('0x2'))(_0x8510('0x3'));var moment=require('moment');var BPromise=require(_0x8510('0x4'));var rp=require(_0x8510('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8510('0x6'));module[_0x8510('0x7')]=function(_0x47a1df,_0x3c40f4){return _0x47a1df[_0x8510('0x8')](_0x8510('0x9'),attributes,{'tableName':_0x8510('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bcb=['UserChatQueue','user_has_chat_queues','util','api','bluebird','request-promise','rimraf','../../config/environment','./userChatQueue.attributes','exports'];(function(_0x7791d5,_0xdab65f){var _0x5ce288=function(_0x2b818d){while(--_0x2b818d){_0x7791d5['push'](_0x7791d5['shift']());}};_0x5ce288(++_0xdab65f);}(_0x9bcb,0x138));var _0xb9bc=function(_0x602d37,_0x3f7738){_0x602d37=_0x602d37-0x0;var _0x5e303c=_0x9bcb[_0x602d37];return _0x5e303c;};'use strict';var _=require('lodash');var util=require(_0xb9bc('0x0'));var logger=require('../../config/logger')(_0xb9bc('0x1'));var moment=require('moment');var BPromise=require(_0xb9bc('0x2'));var rp=require(_0xb9bc('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb9bc('0x4'));var config=require(_0xb9bc('0x5'));var attributes=require(_0xb9bc('0x6'));module[_0xb9bc('0x7')]=function(_0xb910e0,_0x1cbde0){return _0xb910e0['define'](_0xb9bc('0x8'),attributes,{'tableName':_0xb9bc('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 f9e5fbc..d180bf3 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 _0xa1f0=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x1709e7,_0x2ced21){var _0x402819=function(_0x3637a0){while(--_0x3637a0){_0x1709e7['push'](_0x1709e7['shift']());}};_0x402819(++_0x2ced21);}(_0xa1f0,0xe4));var _0x0a1f=function(_0x59f8b5,_0x582975){_0x59f8b5=_0x59f8b5-0x0;var _0x4ef083=_0xa1f0[_0x59f8b5];return _0x4ef083;};'use strict';var _=require(_0x0a1f('0x0'));var util=require(_0x0a1f('0x1'));var moment=require('moment');var BPromise=require(_0x0a1f('0x2'));var rs=require(_0x0a1f('0x3'));var fs=require('fs');var Redis=require(_0x0a1f('0x4'));var db=require(_0x0a1f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a1f('0x6'))(_0x0a1f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0a1f('0x8')][_0x0a1f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4da7e5,_0x5d5496,_0x3c75d4){return new BPromise(function(_0x525413,_0x1c9c9f){return client[_0x0a1f('0xa')](_0x4da7e5,_0x3c75d4)[_0x0a1f('0xb')](function(_0x1f9abc){logger['info'](_0x0a1f('0xc'),_0x5d5496,_0x0a1f('0xd'));logger['debug'](_0x0a1f('0xe'),_0x5d5496,_0x0a1f('0xd'),JSON[_0x0a1f('0xf')](_0x1f9abc));if(_0x1f9abc[_0x0a1f('0x10')]){if(_0x1f9abc[_0x0a1f('0x10')][_0x0a1f('0x11')]===0x1f4){logger[_0x0a1f('0x10')](_0x0a1f('0xc'),_0x5d5496,_0x1f9abc[_0x0a1f('0x10')][_0x0a1f('0x12')]);return _0x1c9c9f(_0x1f9abc[_0x0a1f('0x10')][_0x0a1f('0x12')]);}logger['error']('UserChatQueue,\x20%s,\x20%s',_0x5d5496,_0x1f9abc[_0x0a1f('0x10')]['message']);return _0x525413(_0x1f9abc[_0x0a1f('0x10')][_0x0a1f('0x12')]);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x5d5496,_0x0a1f('0xd'));_0x525413(_0x1f9abc[_0x0a1f('0x13')]['message']);}})[_0x0a1f('0x14')](function(_0x45f426){logger[_0x0a1f('0x10')](_0x0a1f('0xc'),_0x5d5496,_0x45f426);_0x1c9c9f(_0x45f426);});});} \ No newline at end of file +var _0xdef6=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util'];(function(_0x322bef,_0x4890d4){var _0x229e60=function(_0x45f89b){while(--_0x45f89b){_0x322bef['push'](_0x322bef['shift']());}};_0x229e60(++_0x4890d4);}(_0xdef6,0x106));var _0x6def=function(_0x1a3fb7,_0x5db72e){_0x1a3fb7=_0x1a3fb7-0x0;var _0x33b999=_0xdef6[_0x1a3fb7];return _0x33b999;};'use strict';var _=require(_0x6def('0x0'));var util=require(_0x6def('0x1'));var moment=require(_0x6def('0x2'));var BPromise=require(_0x6def('0x3'));var rs=require(_0x6def('0x4'));var fs=require('fs');var Redis=require(_0x6def('0x5'));var db=require(_0x6def('0x6'))['db'];var utils=require(_0x6def('0x7'));var logger=require(_0x6def('0x8'))('rpc');var config=require(_0x6def('0x9'));var jayson=require(_0x6def('0xa'));var client=jayson['client'][_0x6def('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13a5fb,_0x2d1d6e,_0x4af0c4){return new BPromise(function(_0x44c6ac,_0x252a2d){return client[_0x6def('0xc')](_0x13a5fb,_0x4af0c4)[_0x6def('0xd')](function(_0x3fe9fa){logger['info'](_0x6def('0xe'),_0x2d1d6e,_0x6def('0xf'));logger[_0x6def('0x10')](_0x6def('0x11'),_0x2d1d6e,_0x6def('0xf'),JSON['stringify'](_0x3fe9fa));if(_0x3fe9fa[_0x6def('0x12')]){if(_0x3fe9fa[_0x6def('0x12')][_0x6def('0x13')]===0x1f4){logger[_0x6def('0x12')](_0x6def('0xe'),_0x2d1d6e,_0x3fe9fa['error'][_0x6def('0x14')]);return _0x252a2d(_0x3fe9fa['error'][_0x6def('0x14')]);}logger[_0x6def('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x2d1d6e,_0x3fe9fa[_0x6def('0x12')][_0x6def('0x14')]);return _0x44c6ac(_0x3fe9fa[_0x6def('0x12')][_0x6def('0x14')]);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x2d1d6e,'request\x20sent');_0x44c6ac(_0x3fe9fa[_0x6def('0x15')][_0x6def('0x14')]);}})['catch'](function(_0x2533bb){logger[_0x6def('0x12')](_0x6def('0xe'),_0x2d1d6e,_0x2533bb);_0x252a2d(_0x2533bb);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 95da337..4690fac 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x567d04,_0x3d13a1){var _0x58ee79=function(_0x4c5548){while(--_0x4c5548){_0x567d04['push'](_0x567d04['shift']());}};_0x58ee79(++_0x3d13a1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x483eea,_0x30b518){var _0x3ea569=function(_0x274db2){while(--_0x274db2){_0x483eea['push'](_0x483eea['shift']());}};_0x3ea569(++_0x30b518);}(_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 81a0338..1340b0f 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 _0xb55c=['INTEGER','sequelize'];(function(_0x1d3c0e,_0x146084){var _0x571395=function(_0x5b55bf){while(--_0x5b55bf){_0x1d3c0e['push'](_0x1d3c0e['shift']());}};_0x571395(++_0x146084);}(_0xb55c,0x18f));var _0xcb55=function(_0x129259,_0x3c39ec){_0x129259=_0x129259-0x0;var _0x110f34=_0xb55c[_0x129259];return _0x110f34;};'use strict';var Sequelize=require(_0xcb55('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xcb55('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe51b=['INTEGER','STRING','sequelize','exports'];(function(_0x420ba8,_0x34cd80){var _0x493d62=function(_0x38b4b8){while(--_0x38b4b8){_0x420ba8['push'](_0x420ba8['shift']());}};_0x493d62(++_0x34cd80);}(_0xe51b,0x196));var _0xbe51=function(_0x5d44a6,_0x398111){_0x5d44a6=_0x5d44a6-0x0;var _0x5524f3=_0xe51b[_0x5d44a6];return _0x5524f3;};'use strict';var Sequelize=require(_0xbe51('0x0'));module[_0xbe51('0x1')]={'penalty':{'type':Sequelize[_0xbe51('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xbe51('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xbe51('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index b54c722..d19dc01 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 _0x53dc=['path','rimraf','../../config/environment','./userFaxQueue.attributes','define','UserFaxQueue','user_has_fax_queues','util','moment','bluebird','request-promise'];(function(_0x14c006,_0x252012){var _0x553023=function(_0x427486){while(--_0x427486){_0x14c006['push'](_0x14c006['shift']());}};_0x553023(++_0x252012);}(_0x53dc,0x11a));var _0xc53d=function(_0x49367e,_0x46a9d4){_0x49367e=_0x49367e-0x0;var _0x1ae9ef=_0x53dc[_0x49367e];return _0x1ae9ef;};'use strict';var _=require('lodash');var util=require(_0xc53d('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xc53d('0x1'));var BPromise=require(_0xc53d('0x2'));var rp=require(_0xc53d('0x3'));var fs=require('fs');var path=require(_0xc53d('0x4'));var rimraf=require(_0xc53d('0x5'));var config=require(_0xc53d('0x6'));var attributes=require(_0xc53d('0x7'));module['exports']=function(_0x5a431a,_0x1e4856){return _0x5a431a[_0xc53d('0x8')](_0xc53d('0x9'),attributes,{'tableName':_0xc53d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x148e=['define','lodash','util','../../config/logger','bluebird','request-promise','../../config/environment','./userFaxQueue.attributes','exports'];(function(_0xb87a21,_0x35fc98){var _0x2af1a6=function(_0x277d10){while(--_0x277d10){_0xb87a21['push'](_0xb87a21['shift']());}};_0x2af1a6(++_0x35fc98);}(_0x148e,0x1c3));var _0xe148=function(_0x32b79a,_0xd2538a){_0x32b79a=_0x32b79a-0x0;var _0x483450=_0x148e[_0x32b79a];return _0x483450;};'use strict';var _=require(_0xe148('0x0'));var util=require(_0xe148('0x1'));var logger=require(_0xe148('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe148('0x3'));var rp=require(_0xe148('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe148('0x5'));var attributes=require(_0xe148('0x6'));module[_0xe148('0x7')]=function(_0x472b50,_0x4b38e6){return _0x472b50[_0xe148('0x8')]('UserFaxQueue',attributes,{'tableName':'user_has_fax_queues','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 0f6e7b8..44adb1f 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 _0xb331=['UserFaxQueue,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0xb331,0xeb));var _0x1b33=function(_0x27bfd2,_0x380e36){_0x27bfd2=_0x27bfd2-0x0;var _0x2b2773=_0xb331[_0x27bfd2];return _0x2b2773;};'use strict';var _=require(_0x1b33('0x0'));var util=require(_0x1b33('0x1'));var moment=require(_0x1b33('0x2'));var BPromise=require(_0x1b33('0x3'));var rs=require(_0x1b33('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b33('0x5'))['db'];var utils=require(_0x1b33('0x6'));var logger=require(_0x1b33('0x7'))(_0x1b33('0x8'));var config=require(_0x1b33('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1b33('0xa')][_0x1b33('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x448c54,_0x340b1b,_0x2d20cb){return new BPromise(function(_0xbbab02,_0x16fc74){return client[_0x1b33('0xc')](_0x448c54,_0x2d20cb)[_0x1b33('0xd')](function(_0x5173d4){logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x340b1b,_0x1b33('0xe'));logger['debug'](_0x1b33('0xf'),_0x340b1b,_0x1b33('0xe'),JSON['stringify'](_0x5173d4));if(_0x5173d4[_0x1b33('0x10')]){if(_0x5173d4[_0x1b33('0x10')][_0x1b33('0x11')]===0x1f4){logger['error'](_0x1b33('0x12'),_0x340b1b,_0x5173d4['error'][_0x1b33('0x13')]);return _0x16fc74(_0x5173d4[_0x1b33('0x10')]['message']);}logger['error'](_0x1b33('0x12'),_0x340b1b,_0x5173d4[_0x1b33('0x10')][_0x1b33('0x13')]);return _0xbbab02(_0x5173d4[_0x1b33('0x10')]['message']);}else{logger[_0x1b33('0x14')](_0x1b33('0x12'),_0x340b1b,_0x1b33('0xe'));_0xbbab02(_0x5173d4[_0x1b33('0x15')][_0x1b33('0x13')]);}})[_0x1b33('0x16')](function(_0x369f76){logger[_0x1b33('0x10')](_0x1b33('0x12'),_0x340b1b,_0x369f76);_0x16fc74(_0x369f76);});});} \ No newline at end of file +var _0xa2ab=['info','request\x20sent','debug','error','code','message','UserFaxQueue,\x20%s,\x20%s','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa2ab,0xef));var _0xba2a=function(_0x5d76cc,_0x195736){_0x5d76cc=_0x5d76cc-0x0;var _0x4acce4=_0xa2ab[_0x5d76cc];return _0x4acce4;};'use strict';var _=require(_0xba2a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xba2a('0x1'));var rs=require(_0xba2a('0x2'));var fs=require('fs');var Redis=require(_0xba2a('0x3'));var db=require(_0xba2a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xba2a('0x5'))(_0xba2a('0x6'));var config=require(_0xba2a('0x7'));var jayson=require(_0xba2a('0x8'));var client=jayson[_0xba2a('0x9')][_0xba2a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a0c16,_0x4b5ade,_0x1e60d3){return new BPromise(function(_0x3eeef4,_0x6023dd){return client[_0xba2a('0xb')](_0x5a0c16,_0x1e60d3)[_0xba2a('0xc')](function(_0x17597c){logger[_0xba2a('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x4b5ade,_0xba2a('0xe'));logger[_0xba2a('0xf')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x4b5ade,_0xba2a('0xe'),JSON['stringify'](_0x17597c));if(_0x17597c[_0xba2a('0x10')]){if(_0x17597c[_0xba2a('0x10')][_0xba2a('0x11')]===0x1f4){logger[_0xba2a('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x4b5ade,_0x17597c[_0xba2a('0x10')]['message']);return _0x6023dd(_0x17597c[_0xba2a('0x10')][_0xba2a('0x12')]);}logger['error'](_0xba2a('0x13'),_0x4b5ade,_0x17597c['error']['message']);return _0x3eeef4(_0x17597c[_0xba2a('0x10')][_0xba2a('0x12')]);}else{logger[_0xba2a('0xd')](_0xba2a('0x13'),_0x4b5ade,_0xba2a('0xe'));_0x3eeef4(_0x17597c['result'][_0xba2a('0x12')]);}})[_0xba2a('0x14')](function(_0x537173){logger[_0xba2a('0x10')](_0xba2a('0x13'),_0x4b5ade,_0x537173);_0x6023dd(_0x537173);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index b33b8ee..f7a0ba1 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x462753,_0x18db45){var _0x241048=function(_0x165ef6){while(--_0x165ef6){_0x462753['push'](_0x462753['shift']());}};_0x241048(++_0x18db45);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3f6d2a,_0x452907){var _0x162d1a=function(_0x593dc5){while(--_0x593dc5){_0x3f6d2a['push'](_0x3f6d2a['shift']());}};_0x162d1a(++_0x452907);}(_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 717e5e4..dbfb99c 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 _0x42a8=['INTEGER','sequelize','exports'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x42a8,0x18a));var _0x842a=function(_0x2d9e27,_0x5965b2){_0x2d9e27=_0x2d9e27-0x0;var _0xd35381=_0x42a8[_0x2d9e27];return _0xd35381;};'use strict';var Sequelize=require(_0x842a('0x0'));module[_0x842a('0x1')]={'penalty':{'type':Sequelize[_0x842a('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xaf1b=['INTEGER','sequelize','exports'];(function(_0x5c18ef,_0xa2e81d){var _0x33789d=function(_0x5761a9){while(--_0x5761a9){_0x5c18ef['push'](_0x5c18ef['shift']());}};_0x33789d(++_0xa2e81d);}(_0xaf1b,0x1ed));var _0xbaf1=function(_0xd05577,_0x7e4023){_0xd05577=_0xd05577-0x0;var _0x439148=_0xaf1b[_0xd05577];return _0x439148;};'use strict';var Sequelize=require(_0xbaf1('0x0'));module[_0xbaf1('0x1')]={'penalty':{'type':Sequelize[_0xbaf1('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 c22ba97..0d3aa74 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 _0x24c8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','user_has_mail_queues','../../config/logger'];(function(_0x15e3b5,_0x5f3780){var _0x145958=function(_0x42564d){while(--_0x42564d){_0x15e3b5['push'](_0x15e3b5['shift']());}};_0x145958(++_0x5f3780);}(_0x24c8,0x133));var _0x824c=function(_0x38fb8b,_0x70dd0a){_0x38fb8b=_0x38fb8b-0x0;var _0x1ec681=_0x24c8[_0x38fb8b];return _0x1ec681;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x824c('0x0'))('api');var moment=require(_0x824c('0x1'));var BPromise=require(_0x824c('0x2'));var rp=require(_0x824c('0x3'));var fs=require('fs');var path=require(_0x824c('0x4'));var rimraf=require(_0x824c('0x5'));var config=require(_0x824c('0x6'));var attributes=require(_0x824c('0x7'));module[_0x824c('0x8')]=function(_0x3a963e,_0x102802){return _0x3a963e[_0x824c('0x9')]('UserMailQueue',attributes,{'tableName':_0x824c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6554=['bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','api','moment'];(function(_0xad4e6e,_0x1424f8){var _0x100dd6=function(_0x5f221f){while(--_0x5f221f){_0xad4e6e['push'](_0xad4e6e['shift']());}};_0x100dd6(++_0x1424f8);}(_0x6554,0x114));var _0x4655=function(_0x51536b,_0x18c2ee){_0x51536b=_0x51536b-0x0;var _0x4a2476=_0x6554[_0x51536b];return _0x4a2476;};'use strict';var _=require(_0x4655('0x0'));var util=require(_0x4655('0x1'));var logger=require('../../config/logger')(_0x4655('0x2'));var moment=require(_0x4655('0x3'));var BPromise=require(_0x4655('0x4'));var rp=require(_0x4655('0x5'));var fs=require('fs');var path=require(_0x4655('0x6'));var rimraf=require(_0x4655('0x7'));var config=require(_0x4655('0x8'));var attributes=require(_0x4655('0x9'));module[_0x4655('0xa')]=function(_0x56c9b1,_0x72f584){return _0x56c9b1[_0x4655('0xb')](_0x4655('0xc'),attributes,{'tableName':_0x4655('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index fac9886..6d3054d 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 _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(_0x1f90f0,_0xe64e8f){var _0x51cbd3=function(_0x210c9a){while(--_0x210c9a){_0x1f90f0['push'](_0x1f90f0['shift']());}};_0x51cbd3(++_0xe64e8f);}(_0x8ef6,0xf2));var _0x68ef=function(_0x144bbb,_0x5145cd){_0x144bbb=_0x144bbb-0x0;var _0x86e150=_0x8ef6[_0x144bbb];return _0x86e150;};'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 +var _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','UserMailQueue,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x159ec4,_0x13a700){var _0x595c3f=function(_0x5ca340){while(--_0x5ca340){_0x159ec4['push'](_0x159ec4['shift']());}};_0x595c3f(++_0x13a700);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3f3f40,_0x4c71f4){_0x3f3f40=_0x3f3f40-0x0;var _0x403b7a=_0x5fc3[_0x3f3f40];return _0x403b7a;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('UserMailQueue,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 859d51b..80e692c 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 _0x2139=['isAuthenticated','sendUserNotification','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post'];(function(_0x53fc9e,_0x4e4499){var _0x3d3dff=function(_0x581484){while(--_0x581484){_0x53fc9e['push'](_0x53fc9e['shift']());}};_0x3d3dff(++_0x4e4499);}(_0x2139,0x123));var _0x9213=function(_0x181167,_0x5a5269){_0x181167=_0x181167-0x0;var _0x10484f=_0x2139[_0x181167];return _0x10484f;};'use strict';var multer=require(_0x9213('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9213('0x1'));var router=express[_0x9213('0x2')]();var fs_extra=require(_0x9213('0x3'));var auth=require(_0x9213('0x4'));var interaction=require(_0x9213('0x5'));var config=require(_0x9213('0x6'));var controller=require(_0x9213('0x7'));router[_0x9213('0x8')]('/',auth[_0x9213('0x9')](),controller[_0x9213('0xa')]);module[_0x9213('0xb')]=router; \ No newline at end of file +var _0xf7d7=['../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','sendUserNotification','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x12ffa8,_0x3bb0c7){var _0x4c0a7e=function(_0x3ac44a){while(--_0x3ac44a){_0x12ffa8['push'](_0x12ffa8['shift']());}};_0x4c0a7e(++_0x3bb0c7);}(_0xf7d7,0x159));var _0x7f7d=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0xf7d7[_0x166742];return _0xb7814a;};'use strict';var multer=require(_0x7f7d('0x0'));var util=require(_0x7f7d('0x1'));var path=require(_0x7f7d('0x2'));var timeout=require(_0x7f7d('0x3'));var express=require('express');var router=express[_0x7f7d('0x4')]();var fs_extra=require(_0x7f7d('0x5'));var auth=require(_0x7f7d('0x6'));var interaction=require(_0x7f7d('0x7'));var config=require(_0x7f7d('0x8'));var controller=require(_0x7f7d('0x9'));router[_0x7f7d('0xa')]('/',auth['isAuthenticated'](),controller[_0x7f7d('0xb')]);module[_0x7f7d('0xc')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index faa7c02..e704a7e 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 _0xc13b=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x57fa08,_0x3ab921){var _0x19e260=function(_0x54dfec){while(--_0x54dfec){_0x57fa08['push'](_0x57fa08['shift']());}};_0x19e260(++_0x3ab921);}(_0xc13b,0x70));var _0xbc13=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xc13b[_0x5bd426];return _0x23a7eb;};'use strict';var Sequelize=require(_0xbc13('0x0'));module[_0xbc13('0x1')]={'body':{'type':Sequelize[_0xbc13('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xbc13('0x3')]},'beep':{'type':Sequelize[_0xbc13('0x4')]}}; \ No newline at end of file +var _0xaf20=['exports','TEXT'];(function(_0x278da0,_0xb9b7d8){var _0x4af065=function(_0x418a8b){while(--_0x418a8b){_0x278da0['push'](_0x278da0['shift']());}};_0x4af065(++_0xb9b7d8);}(_0xaf20,0x6c));var _0x0af2=function(_0x326762,_0x2ec10d){_0x326762=_0x326762-0x0;var _0x25dbd3=_0xaf20[_0x326762];return _0x25dbd3;};'use strict';var Sequelize=require('sequelize');module[_0x0af2('0x0')]={'body':{'type':Sequelize[_0x0af2('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x0af2('0x1')]},'recipientsDescription':{'type':Sequelize['STRING']},'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 9f68a58..3177a04 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 _0x9a29=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','register','sendStatus','end','offset','undefined','limit','set','apply','reject','save','update','then','destroy','status','error','stack','name','sendUserNotification','body','hasOwnProperty','text','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27view\x27\x20parameter','Sequelize','ValidationError','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','chatqueue','faxqueue','openchannelqueue','smsqueue','voicequeue','team','user','some','includes','model','toLowerCase','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','UserNotification','create','recipient','emit','userNotification:send','catch','Template','findOne','html','TemplateId','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','ids','queue','replace','Queue','forEach','push','union','flatten','getAgents','eml-format','zip-dir','fast-json-patch','moment'];(function(_0x53b5f9,_0x2bf7dc){var _0x4180fb=function(_0x169466){while(--_0x169466){_0x53b5f9['push'](_0x53b5f9['shift']());}};_0x4180fb(++_0x2bf7dc);}(_0x9a29,0x184));var _0x99a2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9a29[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x99a2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x99a2('0x1'));var jsonpatch=require(_0x99a2('0x2'));var rp=require('request-promise');var moment=require(_0x99a2('0x3'));var BPromise=require(_0x99a2('0x4'));var Mustache=require(_0x99a2('0x5'));var util=require(_0x99a2('0x6'));var path=require(_0x99a2('0x7'));var sox=require(_0x99a2('0x8'));var csv=require(_0x99a2('0x9'));var ejs=require(_0x99a2('0xa'));var fs=require('fs');var fs_extra=require(_0x99a2('0xb'));var _=require(_0x99a2('0xc'));var squel=require('squel');var crypto=require(_0x99a2('0xd'));var jsforce=require(_0x99a2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x99a2('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a2('0xf'));var authService=require(_0x99a2('0x10'));var qs=require(_0x99a2('0x11'));var as=require(_0x99a2('0x12'));var hardwareService=require(_0x99a2('0x13'));var logger=require(_0x99a2('0x14'))(_0x99a2('0x15'));var utils=require(_0x99a2('0x16'));var config=require(_0x99a2('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x99a2('0x18')]=_['defaults'](config[_0x99a2('0x18')],{'host':_0x99a2('0x19'),'port':0x18eb});var socket=require(_0x99a2('0x1a'))(new Redis(config[_0x99a2('0x18')]));require('./userNotification.socket')[_0x99a2('0x1b')](socket);function respondWithStatusCode(_0x2857d4,_0x5dbff1){_0x5dbff1=_0x5dbff1||0xcc;return function(_0x4c5e17){if(_0x4c5e17){return _0x2857d4[_0x99a2('0x1c')](_0x5dbff1);}return _0x2857d4['status'](_0x5dbff1)[_0x99a2('0x1d')]();};}function respondWithResult(_0x525694,_0x591ea0){_0x591ea0=_0x591ea0||0xc8;return function(_0x375015){if(_0x375015){return _0x525694['status'](_0x591ea0)['json'](_0x375015);}};}function respondWithFilteredResult(_0xb34465,_0x3c71dc){return function(_0x1098a1){if(_0x1098a1){var _0x3f27e9=typeof _0x3c71dc[_0x99a2('0x1e')]===_0x99a2('0x1f')&&typeof _0x3c71dc[_0x99a2('0x20')]===_0x99a2('0x1f');var _0x267be8=_0x1098a1['count'];var _0x2a4aea=_0x3f27e9?0x0:_0x3c71dc['offset'];var _0x5abd6c=_0x3f27e9?_0x1098a1['count']:_0x3c71dc['offset']+_0x3c71dc['limit'];var _0x46f0c6;if(_0x5abd6c>=_0x267be8){_0x5abd6c=_0x267be8;_0x46f0c6=0xc8;}else{_0x46f0c6=0xce;}_0xb34465['status'](_0x46f0c6);return _0xb34465[_0x99a2('0x21')]('Content-Range',_0x2a4aea+'-'+_0x5abd6c+'/'+_0x267be8)['json'](_0x1098a1);}return null;};}function patchUpdates(_0xf3bd6a){return function(_0x4ae6d7){try{jsonpatch[_0x99a2('0x22')](_0x4ae6d7,_0xf3bd6a,!![]);}catch(_0x3c1ca9){return BPromise[_0x99a2('0x23')](_0x3c1ca9);}return _0x4ae6d7[_0x99a2('0x24')]();};}function saveUpdates(_0x985d8,_0x118e05){return function(_0x593e04){if(_0x593e04){return _0x593e04[_0x99a2('0x25')](_0x985d8)[_0x99a2('0x26')](function(_0x5a2a0b){return _0x5a2a0b;});}return null;};}function removeEntity(_0x521718,_0x1fcb57){return function(_0x5d23bc){if(_0x5d23bc){return _0x5d23bc[_0x99a2('0x27')]()[_0x99a2('0x26')](function(){_0x521718[_0x99a2('0x28')](0xcc)[_0x99a2('0x1d')]();});}};}function handleEntityNotFound(_0x53e3a0,_0x5b1404){return function(_0x57558e){if(!_0x57558e){_0x53e3a0[_0x99a2('0x1c')](0x194);}return _0x57558e;};}function handleError(_0x2a03a8,_0x1cece2){_0x1cece2=_0x1cece2||0x1f4;return function(_0x42d085){logger[_0x99a2('0x29')](_0x42d085[_0x99a2('0x2a')]);if(_0x42d085['name']){delete _0x42d085[_0x99a2('0x2b')];}_0x2a03a8[_0x99a2('0x28')](_0x1cece2)['send'](_0x42d085);};}exports[_0x99a2('0x2c')]=function(_0x5507ff,_0x4dad1c,_0x55020a){if(!_0x5507ff[_0x99a2('0x2d')][_0x99a2('0x2e')](_0x99a2('0x2f'))&&!_0x5507ff[_0x99a2('0x2d')][_0x99a2('0x2e')]('TemplateId')){throw new db['Sequelize']['ValidationError'](_0x99a2('0x30'));}else{if(_0x5507ff[_0x99a2('0x2d')][_0x99a2('0x2e')]('TemplateId')&&!_0x5507ff['body'][_0x99a2('0x2e')]('view')){throw new db['Sequelize']['ValidationError'](_0x99a2('0x31'));}if(!_0x5507ff['body'][_0x99a2('0x2e')]('recipients')){throw new db[(_0x99a2('0x32'))][(_0x99a2('0x33'))](_0x99a2('0x34'));}else{try{var _0x35be81=JSON[_0x99a2('0x35')](_0x5507ff['body'][_0x99a2('0x36')]);}catch(_0x5b8e66){logger[_0x99a2('0x29')](_0x5b8e66);throw new db[(_0x99a2('0x32'))][(_0x99a2('0x33'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x20094d=[_0x99a2('0x37'),_0x99a2('0x38'),'mailqueue',_0x99a2('0x39'),_0x99a2('0x3a'),_0x99a2('0x3b'),'whatsappqueue',_0x99a2('0x3c'),_0x99a2('0x3d')];if(_[_0x99a2('0x3e')](_0x35be81,function(_0x470698){return!_[_0x99a2('0x3f')](_0x20094d,_0x470698[_0x99a2('0x40')][_0x99a2('0x41')]());})){throw new db[(_0x99a2('0x32'))][(_0x99a2('0x33'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x39f229={};_0x39f229['senderName']=_0x5507ff[_0x99a2('0x2d')][_0x99a2('0x2e')](_0x99a2('0x42'))?_0x5507ff[_0x99a2('0x2d')]['senderName']:_0x5507ff[_0x99a2('0x3d')][_0x99a2('0x43')];_0x39f229[_0x99a2('0x44')]=_[_0x99a2('0x45')](_0x5507ff['body'][_0x99a2('0x44')])?null:_0x5507ff[_0x99a2('0x2d')][_0x99a2('0x44')];_0x39f229[_0x99a2('0x46')]=_0x5507ff['body'][_0x99a2('0x46')]||![];_0x39f229[_0x99a2('0x47')]=_0x5507ff[_0x99a2('0x3d')]['id'];return getContent(_0x5507ff[_0x99a2('0x2d')])[_0x99a2('0x26')](function(_0x525c8d){_0x39f229[_0x99a2('0x2d')]=_0x525c8d;return getRecipients(_0x35be81);})[_0x99a2('0x26')](function(_0x1793d1){_0x39f229[_0x99a2('0x48')]=_[_0x99a2('0x49')](_0x1793d1)[_0x99a2('0x4a')](',');return db['sequelize']['transaction'](function(_0xfcf49d){return db[_0x99a2('0x4b')][_0x99a2('0x4c')](_0x39f229,{'raw':!![],'transaction':_0xfcf49d})['then'](function(_0x2a6079){var _0x25d386={'sender':_0x39f229[_0x99a2('0x42')],'description':_0x39f229[_0x99a2('0x44')],'content':_0x39f229['body'],'beep':_0x39f229[_0x99a2('0x46')]};_0x1793d1['forEach'](function(_0x4df463){_0x25d386[_0x99a2('0x4d')]=_0x4df463;socket[_0x99a2('0x4e')](_0x99a2('0x4f'),_0x25d386);});return _0x2a6079;});});})[_0x99a2('0x26')](respondWithResult(_0x4dad1c,0xc9))[_0x99a2('0x50')](handleError(_0x4dad1c,null));};function getContent(_0x4ec84e){return new BPromise(function(_0x22c36d,_0x4390e6){if(_0x4ec84e['text']){_0x22c36d(_0x4ec84e[_0x99a2('0x2f')]);return;}return db[_0x99a2('0x51')][_0x99a2('0x52')]({'attributes':[_0x99a2('0x53')],'where':{'id':_0x4ec84e[_0x99a2('0x54')]},'raw':!![]})[_0x99a2('0x26')](function(_0x2b7c12){if(!_0x2b7c12)throw new db[(_0x99a2('0x32'))]['ValidationError'](_0x99a2('0x55'));var _0x568ea4=Mustache[_0x99a2('0x56')](_0x2b7c12['html'],_0x4ec84e['view']);_0x22c36d(_0x568ea4);})[_0x99a2('0x50')](function(_0x334779){_0x4390e6(_0x334779);});});}function getRecipients(_0x376d89){return new BPromise(function(_0x116485,_0x40c549){var _0x2eca0c=[];var _0x34c8be=[];_0x376d89['forEach'](function(_0x3c0a9f){var _0x7f4d54=_[_0x99a2('0x57')](_0x3c0a9f[_0x99a2('0x40')]['toLowerCase']());if(_0x7f4d54===_0x99a2('0x58')){_0x2eca0c=_['union'](_0x2eca0c,_0x3c0a9f[_0x99a2('0x59')]);}else{if(_[_0x99a2('0x3f')](_0x7f4d54,_0x99a2('0x5a')))_0x7f4d54=_0x7f4d54[_0x99a2('0x5b')](_0x99a2('0x5a'),_0x99a2('0x5c'));_0x3c0a9f[_0x99a2('0x59')][_0x99a2('0x5d')](function(_0x11caf5){_0x34c8be[_0x99a2('0x5e')](getAgents(_0x7f4d54,_0x11caf5));});}});return BPromise['all'](_0x34c8be)[_0x99a2('0x26')](function(_0x4fbf02){_0x2eca0c=_[_0x99a2('0x5f')](_0x2eca0c,_[_0x99a2('0x60')](_0x4fbf02));_0x116485(_0x2eca0c);})[_0x99a2('0x50')](function(_0x14ece0){_0x40c549(_0x14ece0);});});}function getAgents(_0xdb102f,_0x49a389){return new BPromise(function(_0x45efdb,_0x4f3d80){return db[_0xdb102f][_0x99a2('0x52')]({'where':{'id':_0x49a389}})[_0x99a2('0x26')](function(_0x5d9157){return _0x5d9157[_0x99a2('0x61')]({'attributes':['id'],'raw':!![]})[_0x99a2('0x26')](function(_0x568162){var _0x52ec80=_['map'](_0x568162,'id');_0x45efdb(_0x52ec80);});})[_0x99a2('0x50')](function(_0x685945){_0x4f3d80(_0x685945);});});} \ No newline at end of file +var _0x2cd0=['all','flatten','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','smsqueue','voicequeue','team','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','join','sequelize','transaction','forEach','recipient','emit','userNotification:send','catch','text','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','startCase','union','queue','replace','ids','push'];(function(_0x102c64,_0x3d041e){var _0x4a3b73=function(_0x525d01){while(--_0x525d01){_0x102c64['push'](_0x102c64['shift']());}};_0x4a3b73(++_0x3d041e);}(_0x2cd0,0x123));var _0x02cd=function(_0x292037,_0x442f7c){_0x292037=_0x292037-0x0;var _0x4bd506=_0x2cd0[_0x292037];return _0x4bd506;};'use strict';var emlformat=require(_0x02cd('0x0'));var rimraf=require(_0x02cd('0x1'));var zipdir=require(_0x02cd('0x2'));var jsonpatch=require(_0x02cd('0x3'));var rp=require(_0x02cd('0x4'));var moment=require(_0x02cd('0x5'));var BPromise=require(_0x02cd('0x6'));var Mustache=require(_0x02cd('0x7'));var util=require(_0x02cd('0x8'));var path=require('path');var sox=require(_0x02cd('0x9'));var csv=require('to-csv');var ejs=require(_0x02cd('0xa'));var fs=require('fs');var fs_extra=require(_0x02cd('0xb'));var _=require('lodash');var squel=require(_0x02cd('0xc'));var crypto=require(_0x02cd('0xd'));var jsforce=require(_0x02cd('0xe'));var deskjs=require(_0x02cd('0xf'));var toCsv=require(_0x02cd('0x10'));var querystring=require('querystring');var Papa=require(_0x02cd('0x11'));var Redis=require(_0x02cd('0x12'));var authService=require(_0x02cd('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x02cd('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x02cd('0x15'))(_0x02cd('0x16'));var utils=require('../../config/utils');var config=require(_0x02cd('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x02cd('0x18'))['db'];config[_0x02cd('0x19')]=_['defaults'](config[_0x02cd('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x02cd('0x1a'))(new Redis(config['redis']));require('./userNotification.socket')[_0x02cd('0x1b')](socket);function respondWithStatusCode(_0x38b399,_0x46a48a){_0x46a48a=_0x46a48a||0xcc;return function(_0x1b0217){if(_0x1b0217){return _0x38b399[_0x02cd('0x1c')](_0x46a48a);}return _0x38b399[_0x02cd('0x1d')](_0x46a48a)[_0x02cd('0x1e')]();};}function respondWithResult(_0x1768ce,_0x13dda2){_0x13dda2=_0x13dda2||0xc8;return function(_0x3d82f6){if(_0x3d82f6){return _0x1768ce['status'](_0x13dda2)['json'](_0x3d82f6);}};}function respondWithFilteredResult(_0x4f9bd3,_0x4573c0){return function(_0x6e3a58){if(_0x6e3a58){var _0x5d8820=typeof _0x4573c0[_0x02cd('0x1f')]===_0x02cd('0x20')&&typeof _0x4573c0[_0x02cd('0x21')]===_0x02cd('0x20');var _0x3e71c6=_0x6e3a58[_0x02cd('0x22')];var _0x47af1c=_0x5d8820?0x0:_0x4573c0[_0x02cd('0x1f')];var _0x4e2dc5=_0x5d8820?_0x6e3a58['count']:_0x4573c0[_0x02cd('0x1f')]+_0x4573c0['limit'];var _0x41694d;if(_0x4e2dc5>=_0x3e71c6){_0x4e2dc5=_0x3e71c6;_0x41694d=0xc8;}else{_0x41694d=0xce;}_0x4f9bd3[_0x02cd('0x1d')](_0x41694d);return _0x4f9bd3[_0x02cd('0x23')]('Content-Range',_0x47af1c+'-'+_0x4e2dc5+'/'+_0x3e71c6)[_0x02cd('0x24')](_0x6e3a58);}return null;};}function patchUpdates(_0x5e4156){return function(_0x1e10fb){try{jsonpatch[_0x02cd('0x25')](_0x1e10fb,_0x5e4156,!![]);}catch(_0x18b90f){return BPromise[_0x02cd('0x26')](_0x18b90f);}return _0x1e10fb[_0x02cd('0x27')]();};}function saveUpdates(_0x388479,_0x2652f2){return function(_0x2c510b){if(_0x2c510b){return _0x2c510b['update'](_0x388479)[_0x02cd('0x28')](function(_0x2373f8){return _0x2373f8;});}return null;};}function removeEntity(_0x19ec78,_0x45e8fa){return function(_0x195128){if(_0x195128){return _0x195128[_0x02cd('0x29')]()[_0x02cd('0x28')](function(){_0x19ec78[_0x02cd('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7d227b,_0x4e5b91){return function(_0xe9e1e3){if(!_0xe9e1e3){_0x7d227b['sendStatus'](0x194);}return _0xe9e1e3;};}function handleError(_0x4a1775,_0x10a4cf){_0x10a4cf=_0x10a4cf||0x1f4;return function(_0x3e1565){logger[_0x02cd('0x2a')](_0x3e1565[_0x02cd('0x2b')]);if(_0x3e1565[_0x02cd('0x2c')]){delete _0x3e1565[_0x02cd('0x2c')];}_0x4a1775['status'](_0x10a4cf)[_0x02cd('0x2d')](_0x3e1565);};}exports[_0x02cd('0x2e')]=function(_0x249912,_0x697c00,_0x3dbb71){if(!_0x249912[_0x02cd('0x2f')][_0x02cd('0x30')]('text')&&!_0x249912[_0x02cd('0x2f')][_0x02cd('0x30')](_0x02cd('0x31'))){throw new db[(_0x02cd('0x32'))][(_0x02cd('0x33'))](_0x02cd('0x34'));}else{if(_0x249912[_0x02cd('0x2f')][_0x02cd('0x30')](_0x02cd('0x31'))&&!_0x249912[_0x02cd('0x2f')][_0x02cd('0x30')](_0x02cd('0x35'))){throw new db[(_0x02cd('0x32'))][(_0x02cd('0x33'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x249912['body'][_0x02cd('0x30')]('recipients')){throw new db[(_0x02cd('0x32'))][(_0x02cd('0x33'))](_0x02cd('0x36'));}else{try{var _0xf1f86f=JSON[_0x02cd('0x37')](_0x249912['body'][_0x02cd('0x38')]);}catch(_0x790668){logger[_0x02cd('0x2a')](_0x790668);throw new db[(_0x02cd('0x32'))][(_0x02cd('0x33'))](_0x02cd('0x39'));}var _0x49b35a=[_0x02cd('0x3a'),_0x02cd('0x3b'),'mailqueue',_0x02cd('0x3c'),_0x02cd('0x3d'),_0x02cd('0x3e'),'whatsappqueue',_0x02cd('0x3f'),_0x02cd('0x40')];if(_[_0x02cd('0x41')](_0xf1f86f,function(_0x410584){return!_[_0x02cd('0x42')](_0x49b35a,_0x410584['model'][_0x02cd('0x43')]());})){throw new db[(_0x02cd('0x32'))][(_0x02cd('0x33'))](_0x02cd('0x44'));}}}var _0xf22826={};_0xf22826[_0x02cd('0x45')]=_0x249912[_0x02cd('0x2f')][_0x02cd('0x30')]('senderName')?_0x249912[_0x02cd('0x2f')][_0x02cd('0x45')]:_0x249912['user'][_0x02cd('0x46')];_0xf22826[_0x02cd('0x47')]=_[_0x02cd('0x48')](_0x249912[_0x02cd('0x2f')][_0x02cd('0x47')])?null:_0x249912[_0x02cd('0x2f')]['recipientsDescription'];_0xf22826[_0x02cd('0x49')]=_0x249912[_0x02cd('0x2f')]['beep']||![];_0xf22826[_0x02cd('0x4a')]=_0x249912[_0x02cd('0x40')]['id'];return getContent(_0x249912['body'])[_0x02cd('0x28')](function(_0x4dcead){_0xf22826['body']=_0x4dcead;return getRecipients(_0xf1f86f);})[_0x02cd('0x28')](function(_0x12d029){_0xf22826['recipientsId']=_['sortBy'](_0x12d029)[_0x02cd('0x4b')](',');return db[_0x02cd('0x4c')][_0x02cd('0x4d')](function(_0xe4e722){return db['UserNotification']['create'](_0xf22826,{'raw':!![],'transaction':_0xe4e722})[_0x02cd('0x28')](function(_0x3245de){var _0x14eee4={'sender':_0xf22826[_0x02cd('0x45')],'description':_0xf22826[_0x02cd('0x47')],'content':_0xf22826[_0x02cd('0x2f')],'beep':_0xf22826[_0x02cd('0x49')]};_0x12d029[_0x02cd('0x4e')](function(_0x20dead){_0x14eee4[_0x02cd('0x4f')]=_0x20dead;socket[_0x02cd('0x50')](_0x02cd('0x51'),_0x14eee4);});return _0x3245de;});});})[_0x02cd('0x28')](respondWithResult(_0x697c00,0xc9))[_0x02cd('0x52')](handleError(_0x697c00,null));};function getContent(_0x477ea6){return new BPromise(function(_0x293300,_0x4ecbf5){if(_0x477ea6['text']){_0x293300(_0x477ea6[_0x02cd('0x53')]);return;}return db['Template'][_0x02cd('0x54')]({'attributes':[_0x02cd('0x55')],'where':{'id':_0x477ea6[_0x02cd('0x31')]},'raw':!![]})[_0x02cd('0x28')](function(_0x3ede77){if(!_0x3ede77)throw new db[(_0x02cd('0x32'))][(_0x02cd('0x33'))](_0x02cd('0x56'));var _0x3529f3=Mustache['render'](_0x3ede77[_0x02cd('0x55')],_0x477ea6[_0x02cd('0x35')]);_0x293300(_0x3529f3);})[_0x02cd('0x52')](function(_0x46caa7){_0x4ecbf5(_0x46caa7);});});}function getRecipients(_0x203df2){return new BPromise(function(_0x46cab0,_0x3c3fc3){var _0x26bc62=[];var _0xf9380d=[];_0x203df2[_0x02cd('0x4e')](function(_0x491181){var _0x4e8467=_[_0x02cd('0x57')](_0x491181['model'][_0x02cd('0x43')]());if(_0x4e8467==='User'){_0x26bc62=_[_0x02cd('0x58')](_0x26bc62,_0x491181['ids']);}else{if(_[_0x02cd('0x42')](_0x4e8467,_0x02cd('0x59')))_0x4e8467=_0x4e8467[_0x02cd('0x5a')](_0x02cd('0x59'),'Queue');_0x491181[_0x02cd('0x5b')][_0x02cd('0x4e')](function(_0x1f47e1){_0xf9380d[_0x02cd('0x5c')](getAgents(_0x4e8467,_0x1f47e1));});}});return BPromise[_0x02cd('0x5d')](_0xf9380d)[_0x02cd('0x28')](function(_0x3d6562){_0x26bc62=_[_0x02cd('0x58')](_0x26bc62,_[_0x02cd('0x5e')](_0x3d6562));_0x46cab0(_0x26bc62);})[_0x02cd('0x52')](function(_0x1bd2ca){_0x3c3fc3(_0x1bd2ca);});});}function getAgents(_0xf310be,_0x1bab0a){return new BPromise(function(_0x31a290,_0x22fdbf){return db[_0xf310be][_0x02cd('0x54')]({'where':{'id':_0x1bab0a}})[_0x02cd('0x28')](function(_0x35b758){return _0x35b758['getAgents']({'attributes':['id'],'raw':!![]})[_0x02cd('0x28')](function(_0x2d8480){var _0x36495d=_[_0x02cd('0x5f')](_0x2d8480,'id');_0x31a290(_0x36495d);});})[_0x02cd('0x52')](function(_0x1e6460){_0x22fdbf(_0x1e6460);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index efb769f..4c37755 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 _0xbb4b=['events','UserNotification','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x3696c1,_0x23bacb){var _0x1d013a=function(_0xbd5328){while(--_0xbd5328){_0x3696c1['push'](_0x3696c1['shift']());}};_0x1d013a(++_0x23bacb);}(_0xbb4b,0xbd));var _0xbbb4=function(_0xbb61de,_0x3e9399){_0xbb61de=_0xbb61de-0x0;var _0x378623=_0xbb4b[_0xbb61de];return _0x378623;};'use strict';var EventEmitter=require(_0xbbb4('0x0'));var UserNotification=require('../../mysqldb')['db'][_0xbbb4('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xbbb4('0x2')](0x0);var events={'afterCreate':_0xbbb4('0x3'),'afterUpdate':_0xbbb4('0x4'),'afterDestroy':_0xbbb4('0x5')};function emitEvent(_0xe79ac){return function(_0x17e5de,_0x1997d3,_0x3eb6e0){UserNotificationEvents[_0xbbb4('0x6')](_0xe79ac+':'+_0x17e5de['id'],_0x17e5de);UserNotificationEvents[_0xbbb4('0x6')](_0xe79ac,_0x17e5de);_0x3eb6e0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0xbbb4('0x7')](e,emitEvent(event));}}module[_0xbbb4('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0x7b47=['hook','exports','../../mysqldb','UserNotification','setMaxListeners','save','update','remove','emit'];(function(_0x9d49a8,_0x65edb8){var _0xd1d7a1=function(_0x455b09){while(--_0x455b09){_0x9d49a8['push'](_0x9d49a8['shift']());}};_0xd1d7a1(++_0x65edb8);}(_0x7b47,0x1f1));var _0x77b4=function(_0x4e8685,_0x479823){_0x4e8685=_0x4e8685-0x0;var _0x2d547b=_0x7b47[_0x4e8685];return _0x2d547b;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x77b4('0x0'))['db'][_0x77b4('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x77b4('0x2')](0x0);var events={'afterCreate':_0x77b4('0x3'),'afterUpdate':_0x77b4('0x4'),'afterDestroy':_0x77b4('0x5')};function emitEvent(_0x5d2dfd){return function(_0x1722fb,_0x4f1514,_0x73c8d9){UserNotificationEvents[_0x77b4('0x6')](_0x5d2dfd+':'+_0x1722fb['id'],_0x1722fb);UserNotificationEvents[_0x77b4('0x6')](_0x5d2dfd,_0x1722fb);_0x73c8d9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x77b4('0x7')](e,emitEvent(event));}}module[_0x77b4('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index bda13fe..2906e56 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 _0xcc22=['./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x3b9223,_0x5129c3){var _0x41ec61=function(_0x7001d4){while(--_0x7001d4){_0x3b9223['push'](_0x3b9223['shift']());}};_0x41ec61(++_0x5129c3);}(_0xcc22,0x19c));var _0x2cc2=function(_0x481f66,_0x2be3f1){_0x481f66=_0x481f66-0x0;var _0x5e848b=_0xcc22[_0x481f66];return _0x5e848b;};'use strict';var _=require(_0x2cc2('0x0'));var util=require(_0x2cc2('0x1'));var logger=require(_0x2cc2('0x2'))(_0x2cc2('0x3'));var moment=require(_0x2cc2('0x4'));var BPromise=require('bluebird');var rp=require(_0x2cc2('0x5'));var fs=require('fs');var path=require(_0x2cc2('0x6'));var rimraf=require('rimraf');var config=require(_0x2cc2('0x7'));var attributes=require(_0x2cc2('0x8'));module[_0x2cc2('0x9')]=function(_0x5141f8,_0x23204b){return _0x5141f8[_0x2cc2('0xa')](_0x2cc2('0xb'),attributes,{'tableName':_0x2cc2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x2cc2('0xd')});}; \ No newline at end of file +var _0x6462=['request-promise','rimraf','./userNotification.attributes','exports','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird'];(function(_0x5921c7,_0x4b5384){var _0x6405e9=function(_0x2d39e8){while(--_0x2d39e8){_0x5921c7['push'](_0x5921c7['shift']());}};_0x6405e9(++_0x4b5384);}(_0x6462,0x163));var _0x2646=function(_0x58128a,_0x8ab991){_0x58128a=_0x58128a-0x0;var _0x56f353=_0x6462[_0x58128a];return _0x56f353;};'use strict';var _=require(_0x2646('0x0'));var util=require(_0x2646('0x1'));var logger=require(_0x2646('0x2'))('api');var moment=require(_0x2646('0x3'));var BPromise=require(_0x2646('0x4'));var rp=require(_0x2646('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2646('0x6'));var config=require('../../config/environment');var attributes=require(_0x2646('0x7'));module[_0x2646('0x8')]=function(_0x497f37,_0x3fc100){return _0x497f37['define']('UserNotification',attributes,{'tableName':_0x2646('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2646('0xa'),'collate':_0x2646('0xb')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 9a8d9b0..6b7ee78 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 _0x54d1=['../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x40570d,_0x173745){var _0x53bc05=function(_0x2e0259){while(--_0x2e0259){_0x40570d['push'](_0x40570d['shift']());}};_0x53bc05(++_0x173745);}(_0x54d1,0x88));var _0x154d=function(_0x4d80cd,_0x3e3fa4){_0x4d80cd=_0x4d80cd-0x0;var _0x180461=_0x54d1[_0x4d80cd];return _0x180461;};'use strict';var _=require(_0x154d('0x0'));var util=require(_0x154d('0x1'));var moment=require('moment');var BPromise=require(_0x154d('0x2'));var rs=require(_0x154d('0x3'));var fs=require('fs');var Redis=require(_0x154d('0x4'));var db=require(_0x154d('0x5'))['db'];var utils=require(_0x154d('0x6'));var logger=require(_0x154d('0x7'))(_0x154d('0x8'));var config=require(_0x154d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x154d('0xa')]['http']({'port':0x232a});config[_0x154d('0xb')]=_[_0x154d('0xc')](config[_0x154d('0xb')],{'host':_0x154d('0xd'),'port':0x18eb});var socket=require(_0x154d('0xe'))(new Redis(config[_0x154d('0xb')]));require(_0x154d('0xf'))['register'](socket);function respondWithRpcPromise(_0x5d2b26,_0x59c299,_0x38b608){return new BPromise(function(_0x43965b,_0x41ab79){return client[_0x154d('0x10')](_0x5d2b26,_0x38b608)[_0x154d('0x11')](function(_0x60cf84){logger[_0x154d('0x12')](_0x154d('0x13'),_0x59c299,_0x154d('0x14'));logger[_0x154d('0x15')](_0x154d('0x16'),_0x59c299,_0x154d('0x14'),JSON[_0x154d('0x17')](_0x60cf84));if(_0x60cf84[_0x154d('0x18')]){if(_0x60cf84[_0x154d('0x18')][_0x154d('0x19')]===0x1f4){logger['error'](_0x154d('0x13'),_0x59c299,_0x60cf84[_0x154d('0x18')]['message']);return _0x41ab79(_0x60cf84[_0x154d('0x18')][_0x154d('0x1a')]);}logger[_0x154d('0x18')](_0x154d('0x13'),_0x59c299,_0x60cf84['error']['message']);return _0x43965b(_0x60cf84[_0x154d('0x18')][_0x154d('0x1a')]);}else{logger[_0x154d('0x12')]('UserNotification,\x20%s,\x20%s',_0x59c299,_0x154d('0x14'));_0x43965b(_0x60cf84[_0x154d('0x1b')][_0x154d('0x1a')]);}})[_0x154d('0x1c')](function(_0x129ab7){logger[_0x154d('0x18')](_0x154d('0x13'),_0x59c299,_0x129ab7);_0x41ab79(_0x129ab7);});});} \ No newline at end of file +var _0x73e0=['UserNotification,\x20%s,\x20%s','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','request\x20sent','debug','stringify','error','code'];(function(_0x3f33e8,_0x551360){var _0x1911c0=function(_0x54ba07){while(--_0x54ba07){_0x3f33e8['push'](_0x3f33e8['shift']());}};_0x1911c0(++_0x551360);}(_0x73e0,0xba));var _0x073e=function(_0x43fdc2,_0x55aacf){_0x43fdc2=_0x43fdc2-0x0;var _0x3931b8=_0x73e0[_0x43fdc2];return _0x3931b8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x073e('0x0'));var BPromise=require('bluebird');var rs=require(_0x073e('0x1'));var fs=require('fs');var Redis=require(_0x073e('0x2'));var db=require(_0x073e('0x3'))['db'];var utils=require(_0x073e('0x4'));var logger=require(_0x073e('0x5'))(_0x073e('0x6'));var config=require(_0x073e('0x7'));var jayson=require(_0x073e('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x073e('0x9')]=_['defaults'](config['redis'],{'host':_0x073e('0xa'),'port':0x18eb});var socket=require(_0x073e('0xb'))(new Redis(config[_0x073e('0x9')]));require(_0x073e('0xc'))[_0x073e('0xd')](socket);function respondWithRpcPromise(_0x5a5675,_0x328816,_0x330672){return new BPromise(function(_0x5d93e1,_0x53cf3a){return client[_0x073e('0xe')](_0x5a5675,_0x330672)[_0x073e('0xf')](function(_0x44ea1a){logger[_0x073e('0x10')]('UserNotification,\x20%s,\x20%s',_0x328816,_0x073e('0x11'));logger[_0x073e('0x12')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x328816,'request\x20sent',JSON[_0x073e('0x13')](_0x44ea1a));if(_0x44ea1a[_0x073e('0x14')]){if(_0x44ea1a[_0x073e('0x14')][_0x073e('0x15')]===0x1f4){logger['error'](_0x073e('0x16'),_0x328816,_0x44ea1a[_0x073e('0x14')][_0x073e('0x17')]);return _0x53cf3a(_0x44ea1a['error'][_0x073e('0x17')]);}logger[_0x073e('0x14')](_0x073e('0x16'),_0x328816,_0x44ea1a[_0x073e('0x14')][_0x073e('0x17')]);return _0x5d93e1(_0x44ea1a[_0x073e('0x14')][_0x073e('0x17')]);}else{logger['info'](_0x073e('0x16'),_0x328816,_0x073e('0x11'));_0x5d93e1(_0x44ea1a[_0x073e('0x18')]['message']);}})[_0x073e('0x19')](function(_0x13f334){logger[_0x073e('0x14')]('UserNotification,\x20%s,\x20%s',_0x328816,_0x13f334);_0x53cf3a(_0x13f334);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 965f08f..e8af56b 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 _0xa906=['userNotification:','./userNotification.events','remove','update','emit','removeListener','register','length'];(function(_0x207420,_0x2f9c05){var _0x3253d6=function(_0x40b220){while(--_0x40b220){_0x207420['push'](_0x207420['shift']());}};_0x3253d6(++_0x2f9c05);}(_0xa906,0x69));var _0x6a90=function(_0x5acd2d,_0x50aea0){_0x5acd2d=_0x5acd2d-0x0;var _0x2bab66=_0xa906[_0x5acd2d];return _0x2bab66;};'use strict';var UserNotificationEvents=require(_0x6a90('0x0'));var events=['save',_0x6a90('0x1'),_0x6a90('0x2')];function createListener(_0x5a76df,_0x3ba02c){return function(_0x185909){_0x3ba02c[_0x6a90('0x3')](_0x5a76df,_0x185909);};}function removeListener(_0x323b60,_0x253bcc){return function(){UserNotificationEvents[_0x6a90('0x4')](_0x323b60,_0x253bcc);};}exports[_0x6a90('0x5')]=function(_0x2f1c24){for(var _0x21076c=0x0,_0x4796df=events[_0x6a90('0x6')];_0x21076c<_0x4796df;_0x21076c++){var _0x29ff57=events[_0x21076c];var _0x1991a6=createListener(_0x6a90('0x7')+_0x29ff57,_0x2f1c24);UserNotificationEvents['on'](_0x29ff57,_0x1991a6);}}; \ No newline at end of file +var _0xcf7d=['remove','emit','removeListener','register','length','./userNotification.events','save'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcf7d,0x108));var _0xdcf7=function(_0x55bd5b,_0x52d241){_0x55bd5b=_0x55bd5b-0x0;var _0x522df1=_0xcf7d[_0x55bd5b];return _0x522df1;};'use strict';var UserNotificationEvents=require(_0xdcf7('0x0'));var events=[_0xdcf7('0x1'),_0xdcf7('0x2'),'update'];function createListener(_0x49e9a9,_0x341193){return function(_0x5c9eea){_0x341193[_0xdcf7('0x3')](_0x49e9a9,_0x5c9eea);};}function removeListener(_0x207097,_0x4267c4){return function(){UserNotificationEvents[_0xdcf7('0x4')](_0x207097,_0x4267c4);};}exports[_0xdcf7('0x5')]=function(_0x2c545c){for(var _0x2486a7=0x0,_0xd9782=events[_0xdcf7('0x6')];_0x2486a7<_0xd9782;_0x2486a7++){var _0xbb174a=events[_0x2486a7];var _0x20bbc2=createListener('userNotification:'+_0xbb174a,_0x2c545c);UserNotificationEvents['on'](_0xbb174a,_0x20bbc2);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index d1efc4d..0c6a585 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x49cbb4,_0x3e9c47){var _0x41d4c4=function(_0x3a3dae){while(--_0x3a3dae){_0x49cbb4['push'](_0x49cbb4['shift']());}};_0x41d4c4(++_0x3e9c47);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4ec13d,_0x358a8f){_0x4ec13d=_0x4ec13d-0x0;var _0x3c3fa7=_0xcb91[_0x4ec13d];return _0x3c3fa7;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3eae57,_0x29d0ae){var _0x161d3c=function(_0xf9e320){while(--_0xf9e320){_0x3eae57['push'](_0x3eae57['shift']());}};_0x161d3c(++_0x29d0ae);}(_0xe706,0xa3));var _0x6e70=function(_0x5b5239,_0x111b9f){_0x5b5239=_0x5b5239-0x0;var _0x4c55f1=_0xe706[_0x5b5239];return _0x4c55f1;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 36e1033..346e723 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 _0x60ed=['exports','INTEGER'];(function(_0xfd5be2,_0x1dd184){var _0x1dfe9d=function(_0x5b95db){while(--_0x5b95db){_0xfd5be2['push'](_0xfd5be2['shift']());}};_0x1dfe9d(++_0x1dd184);}(_0x60ed,0x118));var _0xd60e=function(_0x239f9d,_0x406400){_0x239f9d=_0x239f9d-0x0;var _0x3cadca=_0x60ed[_0x239f9d];return _0x3cadca;};'use strict';var Sequelize=require('sequelize');module[_0xd60e('0x0')]={'penalty':{'type':Sequelize[_0xd60e('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x41b5=['exports','INTEGER'];(function(_0x58c3b3,_0x1e8496){var _0x824dbb=function(_0x357fda){while(--_0x357fda){_0x58c3b3['push'](_0x58c3b3['shift']());}};_0x824dbb(++_0x1e8496);}(_0x41b5,0x94));var _0x541b=function(_0x31b590,_0x36d3b8){_0x31b590=_0x31b590-0x0;var _0x58c468=_0x41b5[_0x31b590];return _0x58c468;};'use strict';var Sequelize=require('sequelize');module[_0x541b('0x0')]={'penalty':{'type':Sequelize[_0x541b('0x1')],'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 3680b2b..ae1a012 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 _0x3838=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define'];(function(_0x108d68,_0x9b39de){var _0x11476a=function(_0x21cc20){while(--_0x21cc20){_0x108d68['push'](_0x108d68['shift']());}};_0x11476a(++_0x9b39de);}(_0x3838,0x1b8));var _0x8383=function(_0x7591c,_0x12dafd){_0x7591c=_0x7591c-0x0;var _0x3b62cb=_0x3838[_0x7591c];return _0x3b62cb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8383('0x0'))('api');var moment=require(_0x8383('0x1'));var BPromise=require(_0x8383('0x2'));var rp=require(_0x8383('0x3'));var fs=require('fs');var path=require(_0x8383('0x4'));var rimraf=require(_0x8383('0x5'));var config=require(_0x8383('0x6'));var attributes=require(_0x8383('0x7'));module[_0x8383('0x8')]=function(_0x1a7db6,_0x1c3b15){return _0x1a7db6[_0x8383('0x9')]('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0163=['exports','define','user_has_openchannel_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./userOpenchannelQueue.attributes'];(function(_0x59247c,_0x2960ca){var _0x59c94c=function(_0x2b415b){while(--_0x2b415b){_0x59247c['push'](_0x59247c['shift']());}};_0x59c94c(++_0x2960ca);}(_0x0163,0x1ef));var _0x3016=function(_0x1644c9,_0xad4a16){_0x1644c9=_0x1644c9-0x0;var _0x25b200=_0x0163[_0x1644c9];return _0x25b200;};'use strict';var _=require(_0x3016('0x0'));var util=require(_0x3016('0x1'));var logger=require('../../config/logger')(_0x3016('0x2'));var moment=require(_0x3016('0x3'));var BPromise=require(_0x3016('0x4'));var rp=require(_0x3016('0x5'));var fs=require('fs');var path=require(_0x3016('0x6'));var rimraf=require(_0x3016('0x7'));var config=require('../../config/environment');var attributes=require(_0x3016('0x8'));module[_0x3016('0x9')]=function(_0x516a90,_0x55e4bc){return _0x516a90[_0x3016('0xa')]('UserOpenchannelQueue',attributes,{'tableName':_0x3016('0xb'),'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 3a55892..0c8945e 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 _0xa9ec=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x499b5b,_0x2960e3){var _0x47329e=function(_0x532a06){while(--_0x532a06){_0x499b5b['push'](_0x499b5b['shift']());}};_0x47329e(++_0x2960e3);}(_0xa9ec,0x148));var _0xca9e=function(_0x1dc337,_0x163446){_0x1dc337=_0x1dc337-0x0;var _0x2c4d04=_0xa9ec[_0x1dc337];return _0x2c4d04;};'use strict';var _=require(_0xca9e('0x0'));var util=require(_0xca9e('0x1'));var moment=require(_0xca9e('0x2'));var BPromise=require(_0xca9e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xca9e('0x4'));var db=require(_0xca9e('0x5'))['db'];var utils=require(_0xca9e('0x6'));var logger=require(_0xca9e('0x7'))(_0xca9e('0x8'));var config=require(_0xca9e('0x9'));var jayson=require(_0xca9e('0xa'));var client=jayson[_0xca9e('0xb')][_0xca9e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x27bff2,_0x4c46fb,_0x52a126){return new BPromise(function(_0x56301c,_0x203b16){return client[_0xca9e('0xd')](_0x27bff2,_0x52a126)[_0xca9e('0xe')](function(_0x43cb13){logger[_0xca9e('0xf')](_0xca9e('0x10'),_0x4c46fb,'request\x20sent');logger[_0xca9e('0x11')](_0xca9e('0x12'),_0x4c46fb,_0xca9e('0x13'),JSON[_0xca9e('0x14')](_0x43cb13));if(_0x43cb13[_0xca9e('0x15')]){if(_0x43cb13[_0xca9e('0x15')]['code']===0x1f4){logger[_0xca9e('0x15')](_0xca9e('0x10'),_0x4c46fb,_0x43cb13['error'][_0xca9e('0x16')]);return _0x203b16(_0x43cb13[_0xca9e('0x15')][_0xca9e('0x16')]);}logger[_0xca9e('0x15')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4c46fb,_0x43cb13[_0xca9e('0x15')][_0xca9e('0x16')]);return _0x56301c(_0x43cb13[_0xca9e('0x15')][_0xca9e('0x16')]);}else{logger[_0xca9e('0xf')](_0xca9e('0x10'),_0x4c46fb,_0xca9e('0x13'));_0x56301c(_0x43cb13[_0xca9e('0x17')][_0xca9e('0x16')]);}})[_0xca9e('0x18')](function(_0x5bc2f3){logger[_0xca9e('0x15')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4c46fb,_0x5bc2f3);_0x203b16(_0x5bc2f3);});});} \ No newline at end of file +var _0x7055=['ioredis','../../config/logger','http','request','info','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','UserOpenchannelQueue,\x20%s,\x20%s','result','catch','util','randomstring'];(function(_0x46c0ef,_0x1d0b09){var _0x472403=function(_0x2e37c3){while(--_0x2e37c3){_0x46c0ef['push'](_0x46c0ef['shift']());}};_0x472403(++_0x1d0b09);}(_0x7055,0xae));var _0x5705=function(_0x1f44e4,_0x22d9fd){_0x1f44e4=_0x1f44e4-0x0;var _0x591989=_0x7055[_0x1f44e4];return _0x591989;};'use strict';var _=require('lodash');var util=require(_0x5705('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5705('0x1'));var fs=require('fs');var Redis=require(_0x5705('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5705('0x3'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x5705('0x4')]({'port':0x232a});function respondWithRpcPromise(_0x253ac6,_0x16ebf1,_0x192236){return new BPromise(function(_0x30911d,_0x205bc8){return client[_0x5705('0x5')](_0x253ac6,_0x192236)['then'](function(_0x4eff67){logger[_0x5705('0x6')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x16ebf1,'request\x20sent');logger[_0x5705('0x7')](_0x5705('0x8'),_0x16ebf1,_0x5705('0x9'),JSON['stringify'](_0x4eff67));if(_0x4eff67['error']){if(_0x4eff67[_0x5705('0xa')][_0x5705('0xb')]===0x1f4){logger[_0x5705('0xa')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x16ebf1,_0x4eff67[_0x5705('0xa')][_0x5705('0xc')]);return _0x205bc8(_0x4eff67[_0x5705('0xa')][_0x5705('0xc')]);}logger['error'](_0x5705('0xd'),_0x16ebf1,_0x4eff67[_0x5705('0xa')]['message']);return _0x30911d(_0x4eff67[_0x5705('0xa')][_0x5705('0xc')]);}else{logger[_0x5705('0x6')](_0x5705('0xd'),_0x16ebf1,_0x5705('0x9'));_0x30911d(_0x4eff67[_0x5705('0xe')][_0x5705('0xc')]);}})[_0x5705('0xf')](function(_0x579842){logger[_0x5705('0xa')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x16ebf1,_0x579842);_0x205bc8(_0x579842);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 206a40d..5ec705a 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 _0xb27c=['removeResources','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getSections','/:id/resources','post','create','/:id/clone','clone','/:id/sections','addSections','put','delete','destroy','removeSections'];(function(_0x3713a0,_0x47fe71){var _0x63353b=function(_0x2bca8b){while(--_0x2bca8b){_0x3713a0['push'](_0x3713a0['shift']());}};_0x63353b(++_0x47fe71);}(_0xb27c,0x16a));var _0xcb27=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xb27c[_0x5f09c5];return _0x426ad9;};'use strict';var multer=require(_0xcb27('0x0'));var util=require(_0xcb27('0x1'));var path=require(_0xcb27('0x2'));var timeout=require(_0xcb27('0x3'));var express=require('express');var router=express[_0xcb27('0x4')]();var fs_extra=require(_0xcb27('0x5'));var auth=require(_0xcb27('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcb27('0x7'));var controller=require(_0xcb27('0x8'));router[_0xcb27('0x9')]('/',auth['isAuthenticated'](),controller[_0xcb27('0xa')]);router[_0xcb27('0x9')](_0xcb27('0xb'),auth[_0xcb27('0xc')](),controller[_0xcb27('0xd')]);router[_0xcb27('0x9')](_0xcb27('0xe'),auth[_0xcb27('0xc')](),controller[_0xcb27('0xf')]);router[_0xcb27('0x9')]('/:id/sections',auth[_0xcb27('0xc')](),controller[_0xcb27('0x10')]);router[_0xcb27('0x9')](_0xcb27('0x11'),auth[_0xcb27('0xc')](),controller['getResources']);router[_0xcb27('0x12')]('/',auth[_0xcb27('0xc')](),controller[_0xcb27('0x13')]);router[_0xcb27('0x12')](_0xcb27('0x14'),auth['isAuthenticated'](),controller[_0xcb27('0x15')]);router[_0xcb27('0x12')](_0xcb27('0x16'),auth['isAuthenticated'](),controller[_0xcb27('0x17')]);router['post'](_0xcb27('0x11'),auth['isAuthenticated'](),controller['addResources']);router[_0xcb27('0x18')](_0xcb27('0xe'),auth[_0xcb27('0xc')](),controller['update']);router[_0xcb27('0x19')](_0xcb27('0xe'),auth['isAuthenticated'](),controller[_0xcb27('0x1a')]);router[_0xcb27('0x19')](_0xcb27('0x16'),auth['isAuthenticated'](),controller[_0xcb27('0x1b')]);router['delete'](_0xcb27('0x11'),auth['isAuthenticated'](),controller[_0xcb27('0x1c')]);module[_0xcb27('0x1d')]=router; \ No newline at end of file +var _0xe7f5=['/:id/resources','getResources','post','create','clone','addResources','put','destroy','delete','removeResources','multer','util','path','connect-timeout','express','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections'];(function(_0x42149a,_0x699b82){var _0x52abe4=function(_0x42a020){while(--_0x42a020){_0x42149a['push'](_0x42149a['shift']());}};_0x52abe4(++_0x699b82);}(_0xe7f5,0x1b3));var _0x5e7f=function(_0x119877,_0x3fbedf){_0x119877=_0x119877-0x0;var _0x27bf06=_0xe7f5[_0x119877];return _0x27bf06;};'use strict';var multer=require(_0x5e7f('0x0'));var util=require(_0x5e7f('0x1'));var path=require(_0x5e7f('0x2'));var timeout=require(_0x5e7f('0x3'));var express=require(_0x5e7f('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5e7f('0x5'));var config=require('../../config/environment');var controller=require(_0x5e7f('0x6'));router[_0x5e7f('0x7')]('/',auth[_0x5e7f('0x8')](),controller[_0x5e7f('0x9')]);router[_0x5e7f('0x7')](_0x5e7f('0xa'),auth[_0x5e7f('0x8')](),controller[_0x5e7f('0xb')]);router[_0x5e7f('0x7')](_0x5e7f('0xc'),auth[_0x5e7f('0x8')](),controller[_0x5e7f('0xd')]);router[_0x5e7f('0x7')](_0x5e7f('0xe'),auth[_0x5e7f('0x8')](),controller['getSections']);router[_0x5e7f('0x7')](_0x5e7f('0xf'),auth[_0x5e7f('0x8')](),controller[_0x5e7f('0x10')]);router[_0x5e7f('0x11')]('/',auth['isAuthenticated'](),controller[_0x5e7f('0x12')]);router[_0x5e7f('0x11')]('/:id/clone',auth[_0x5e7f('0x8')](),controller[_0x5e7f('0x13')]);router['post'](_0x5e7f('0xe'),auth[_0x5e7f('0x8')](),controller['addSections']);router[_0x5e7f('0x11')]('/:id/resources',auth['isAuthenticated'](),controller[_0x5e7f('0x14')]);router[_0x5e7f('0x15')]('/:id',auth[_0x5e7f('0x8')](),controller['update']);router['delete'](_0x5e7f('0xc'),auth[_0x5e7f('0x8')](),controller[_0x5e7f('0x16')]);router[_0x5e7f('0x17')](_0x5e7f('0xe'),auth['isAuthenticated'](),controller['removeSections']);router['delete'](_0x5e7f('0xf'),auth[_0x5e7f('0x8')](),controller[_0x5e7f('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index b87accf..f0cf3f1 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 _0x7952=['STRING','BOOLEAN','sequelize','exports','name','setDataValue','getDataValue','split'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7952,0xfa));var _0x2795=function(_0xc55d64,_0x133f2d){_0xc55d64=_0xc55d64-0x0;var _0x4194f6=_0x7952[_0xc55d64];return _0x4194f6;};'use strict';var Sequelize=require(_0x2795('0x0'));module[_0x2795('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2795('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x198458){this[_0x2795('0x3')]('crudPermissions',_0x198458?_0x198458['join'](''):[]);},'get':function(){return this[_0x2795('0x4')]('crudPermissions')?this[_0x2795('0x4')]('crudPermissions')[_0x2795('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x2795('0x6')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x2795('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x2795('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x2795('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x2795('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x2795('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x2795('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x8b74=['crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING'];(function(_0x36cc83,_0x1cdcdc){var _0x316ea7=function(_0x31bf65){while(--_0x31bf65){_0x36cc83['push'](_0x36cc83['shift']());}};_0x316ea7(++_0x1cdcdc);}(_0x8b74,0x1dd));var _0x48b7=function(_0x5ce9ce,_0x51e950){_0x5ce9ce=_0x5ce9ce-0x0;var _0x3887a4=_0x8b74[_0x5ce9ce];return _0x3887a4;};'use strict';var Sequelize=require(_0x48b7('0x0'));module[_0x48b7('0x1')]={'name':{'type':Sequelize[_0x48b7('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x48b7('0x2')],'set':function(_0x5d267c){this['setDataValue'](_0x48b7('0x3'),_0x5d267c?_0x5d267c[_0x48b7('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0x48b7('0x3'))?this[_0x48b7('0x5')](_0x48b7('0x3'))[_0x48b7('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x48b7('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x48b7('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x48b7('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x48b7('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x48b7('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x48b7('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x48b7('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x48b7('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x48b7('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index f026f93..5a55efc 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 _0xae8e=['update','then','destroy','end','stack','name','send','index','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','get','updatedAt','crudPermissions','omit','createdAt','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','sequelize','push','ids','enabled','isEmpty','includes','subsections','findOne','forEach','resourceId','addResources','bulkCreate','removeResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','json','undefined','count','offset','limit','set','reject','save'];(function(_0x5e2ce3,_0x11c06f){var _0x5a2859=function(_0x18f60b){while(--_0x18f60b){_0x5e2ce3['push'](_0x5e2ce3['shift']());}};_0x5a2859(++_0x11c06f);}(_0xae8e,0xc3));var _0xeae8=function(_0x2a6505,_0x122a9c){_0x2a6505=_0x2a6505-0x0;var _0x46cbb4=_0xae8e[_0x2a6505];return _0x46cbb4;};'use strict';var emlformat=require(_0xeae8('0x0'));var rimraf=require(_0xeae8('0x1'));var zipdir=require(_0xeae8('0x2'));var jsonpatch=require(_0xeae8('0x3'));var rp=require(_0xeae8('0x4'));var moment=require(_0xeae8('0x5'));var BPromise=require(_0xeae8('0x6'));var Mustache=require(_0xeae8('0x7'));var util=require(_0xeae8('0x8'));var path=require(_0xeae8('0x9'));var sox=require(_0xeae8('0xa'));var csv=require(_0xeae8('0xb'));var ejs=require(_0xeae8('0xc'));var fs=require('fs');var fs_extra=require(_0xeae8('0xd'));var _=require(_0xeae8('0xe'));var squel=require(_0xeae8('0xf'));var crypto=require(_0xeae8('0x10'));var jsforce=require(_0xeae8('0x11'));var deskjs=require(_0xeae8('0x12'));var toCsv=require(_0xeae8('0xb'));var querystring=require(_0xeae8('0x13'));var Papa=require(_0xeae8('0x14'));var Redis=require(_0xeae8('0x15'));var authService=require(_0xeae8('0x16'));var qs=require(_0xeae8('0x17'));var as=require(_0xeae8('0x18'));var hardwareService=require(_0xeae8('0x19'));var logger=require(_0xeae8('0x1a'))(_0xeae8('0x1b'));var utils=require(_0xeae8('0x1c'));var config=require(_0xeae8('0x1d'));var licenseUtil=require('../../config/license/util');var db=require(_0xeae8('0x1e'))['db'];config[_0xeae8('0x1f')]=_[_0xeae8('0x20')](config[_0xeae8('0x1f')],{'host':_0xeae8('0x21'),'port':0x18eb});var socket=require(_0xeae8('0x22'))(new Redis(config['redis']));require(_0xeae8('0x23'))[_0xeae8('0x24')](socket);function respondWithStatusCode(_0x3bf06a,_0x3c3787){_0x3c3787=_0x3c3787||0xcc;return function(_0xd5b943){if(_0xd5b943){return _0x3bf06a[_0xeae8('0x25')](_0x3c3787);}return _0x3bf06a[_0xeae8('0x26')](_0x3c3787)['end']();};}function respondWithResult(_0x2290d3,_0x3ac314){_0x3ac314=_0x3ac314||0xc8;return function(_0x3780e1){if(_0x3780e1){return _0x2290d3[_0xeae8('0x26')](_0x3ac314)[_0xeae8('0x27')](_0x3780e1);}};}function respondWithFilteredResult(_0x75d70b,_0xf7088f){return function(_0x5c53db){if(_0x5c53db){var _0x59931d=typeof _0xf7088f['offset']===_0xeae8('0x28')&&typeof _0xf7088f['limit']==='undefined';var _0x397695=_0x5c53db[_0xeae8('0x29')];var _0x25fe31=_0x59931d?0x0:_0xf7088f[_0xeae8('0x2a')];var _0x10bc44=_0x59931d?_0x5c53db[_0xeae8('0x29')]:_0xf7088f[_0xeae8('0x2a')]+_0xf7088f[_0xeae8('0x2b')];var _0x1c005f;if(_0x10bc44>=_0x397695){_0x10bc44=_0x397695;_0x1c005f=0xc8;}else{_0x1c005f=0xce;}_0x75d70b[_0xeae8('0x26')](_0x1c005f);return _0x75d70b[_0xeae8('0x2c')]('Content-Range',_0x25fe31+'-'+_0x10bc44+'/'+_0x397695)[_0xeae8('0x27')](_0x5c53db);}return null;};}function patchUpdates(_0x138dfe){return function(_0x364ada){try{jsonpatch['apply'](_0x364ada,_0x138dfe,!![]);}catch(_0x48af01){return BPromise[_0xeae8('0x2d')](_0x48af01);}return _0x364ada[_0xeae8('0x2e')]();};}function saveUpdates(_0x41e418,_0x447956){return function(_0x333de6){if(_0x333de6){return _0x333de6[_0xeae8('0x2f')](_0x41e418)[_0xeae8('0x30')](function(_0x93c8e1){return _0x93c8e1;});}return null;};}function removeEntity(_0x303a7a,_0x290ff4){return function(_0x2c0f38){if(_0x2c0f38){return _0x2c0f38[_0xeae8('0x31')]()['then'](function(){_0x303a7a[_0xeae8('0x26')](0xcc)[_0xeae8('0x32')]();});}};}function handleEntityNotFound(_0xac5c3e,_0x159b66){return function(_0x3e8c45){if(!_0x3e8c45){_0xac5c3e[_0xeae8('0x25')](0x194);}return _0x3e8c45;};}function handleError(_0x1388a7,_0x54ff77){_0x54ff77=_0x54ff77||0x1f4;return function(_0x163f0e){logger['error'](_0x163f0e[_0xeae8('0x33')]);if(_0x163f0e[_0xeae8('0x34')]){delete _0x163f0e[_0xeae8('0x34')];}_0x1388a7[_0xeae8('0x26')](_0x54ff77)[_0xeae8('0x35')](_0x163f0e);};}exports[_0xeae8('0x36')]=function(_0x4237c9,_0x3955a1){var _0x360657={},_0x265830={},_0x218012={'count':0x0,'rows':[]};var _0x3ee4ab=_['map'](db[_0xeae8('0x37')][_0xeae8('0x38')],function(_0x325e17){return{'name':_0x325e17[_0xeae8('0x39')],'type':_0x325e17[_0xeae8('0x3a')][_0xeae8('0x3b')]};});_0x265830[_0xeae8('0x3c')]=_['map'](_0x3ee4ab,_0xeae8('0x34'));_0x265830[_0xeae8('0x3d')]=_[_0xeae8('0x3e')](_0x4237c9[_0xeae8('0x3d')]);_0x265830[_0xeae8('0x3f')]=_[_0xeae8('0x40')](_0x265830['model'],_0x265830[_0xeae8('0x3d')]);_0x360657['attributes']=_[_0xeae8('0x40')](_0x265830['model'],qs['fields'](_0x4237c9[_0xeae8('0x3d')][_0xeae8('0x41')]));_0x360657['attributes']=_0x360657['attributes']['length']?_0x360657[_0xeae8('0x42')]:_0x265830[_0xeae8('0x3c')];if(!_0x4237c9['query'][_0xeae8('0x43')](_0xeae8('0x44'))){_0x360657[_0xeae8('0x2b')]=qs[_0xeae8('0x2b')](_0x4237c9['query'][_0xeae8('0x2b')]);_0x360657[_0xeae8('0x2a')]=qs[_0xeae8('0x2a')](_0x4237c9['query'][_0xeae8('0x2a')]);}_0x360657[_0xeae8('0x45')]=qs['sort'](_0x4237c9['query'][_0xeae8('0x46')]);_0x360657[_0xeae8('0x47')]=qs[_0xeae8('0x3f')](_[_0xeae8('0x48')](_0x4237c9[_0xeae8('0x3d')],_0x265830[_0xeae8('0x3f')]),_0x3ee4ab);if(_0x4237c9[_0xeae8('0x3d')][_0xeae8('0x49')]){_0x360657['where']=_[_0xeae8('0x4a')](_0x360657[_0xeae8('0x47')],{'$or':_[_0xeae8('0x4b')](_0x3ee4ab,function(_0x1f2981){if(_0x1f2981[_0xeae8('0x3a')]!==_0xeae8('0x4c')){var _0x343317={};_0x343317[_0x1f2981[_0xeae8('0x34')]]={'$like':'%'+_0x4237c9[_0xeae8('0x3d')][_0xeae8('0x49')]+'%'};return _0x343317;}})});}_0x360657=_['merge']({},_0x360657,_0x4237c9[_0xeae8('0x4d')]);var _0x10843a={'where':_0x360657[_0xeae8('0x47')]};return db[_0xeae8('0x37')]['count'](_0x10843a)[_0xeae8('0x30')](function(_0x1c9f47){_0x218012[_0xeae8('0x29')]=_0x1c9f47;if(_0x4237c9[_0xeae8('0x3d')]['includeAll']){_0x360657[_0xeae8('0x4e')]=[{'all':!![]}];}return db[_0xeae8('0x37')][_0xeae8('0x4f')](_0x360657);})[_0xeae8('0x30')](function(_0x1564f7){_0x218012[_0xeae8('0x50')]=_0x1564f7;return _0x218012;})[_0xeae8('0x30')](respondWithFilteredResult(_0x3955a1,_0x360657))[_0xeae8('0x51')](handleError(_0x3955a1,null));};exports[_0xeae8('0x52')]=function(_0x948c83,_0x59e4b6){var _0x55cf2a={'raw':![],'where':{'id':_0x948c83[_0xeae8('0x53')]['id']}},_0x40bceb={};_0x40bceb['model']=_[_0xeae8('0x3e')](db['UserProfile'][_0xeae8('0x38')]);_0x40bceb[_0xeae8('0x3d')]=_[_0xeae8('0x3e')](_0x948c83[_0xeae8('0x3d')]);_0x40bceb[_0xeae8('0x3f')]=_[_0xeae8('0x40')](_0x40bceb[_0xeae8('0x3c')],_0x40bceb[_0xeae8('0x3d')]);_0x55cf2a[_0xeae8('0x42')]=_['intersection'](_0x40bceb[_0xeae8('0x3c')],qs['fields'](_0x948c83[_0xeae8('0x3d')][_0xeae8('0x41')]));_0x55cf2a[_0xeae8('0x42')]=_0x55cf2a['attributes'][_0xeae8('0x54')]?_0x55cf2a[_0xeae8('0x42')]:_0x40bceb['model'];if(_0x948c83[_0xeae8('0x3d')][_0xeae8('0x55')]){_0x55cf2a[_0xeae8('0x4e')]=[{'all':!![]}];}_0x55cf2a=_[_0xeae8('0x4a')]({},_0x55cf2a,_0x948c83['options']);return db[_0xeae8('0x37')][_0xeae8('0x56')](_0x55cf2a)[_0xeae8('0x30')](handleEntityNotFound(_0x59e4b6,null))[_0xeae8('0x30')](respondWithResult(_0x59e4b6,null))[_0xeae8('0x51')](handleError(_0x59e4b6,null));};exports[_0xeae8('0x57')]=function(_0x2c0c35,_0x34b710){return db['UserProfile']['create'](_0x2c0c35[_0xeae8('0x58')],{})[_0xeae8('0x30')](respondWithResult(_0x34b710,0xc9))[_0xeae8('0x51')](handleError(_0x34b710,null));};exports['clone']=function(_0x4508ed,_0x213b55){var _0x46d7a0={'where':{'id':_0x4508ed[_0xeae8('0x53')]['id']}},_0x40d590={};_0x40d590[_0xeae8('0x3c')]=_['keys'](db[_0xeae8('0x37')][_0xeae8('0x38')]);_0x46d7a0['attributes']=_['intersection'](_0x40d590[_0xeae8('0x3c')],qs['fields'](_0x4508ed['query'][_0xeae8('0x41')]));_0x46d7a0['attributes']=_0x46d7a0[_0xeae8('0x42')][_0xeae8('0x54')]?_0x46d7a0[_0xeae8('0x42')]:_0x40d590[_0xeae8('0x3c')];if(_0x4508ed['query']['includeAll']){_0x46d7a0[_0xeae8('0x4e')]=[{'all':!![]}];}_0x46d7a0=_['merge']({},_0x46d7a0,_0x4508ed[_0xeae8('0x4d')]);return db[_0xeae8('0x37')]['find'](_0x46d7a0)[_0xeae8('0x30')](handleEntityNotFound(_0x213b55,null))[_0xeae8('0x30')](function(_0x4c01d4){if(_0x4c01d4){var _0x1d8284=_0x4c01d4[_0xeae8('0x59')]({'plain':!![]});_0x1d8284=qs['omit'](_0x1d8284,['id','createdAt',_0xeae8('0x5a'),_0xeae8('0x5b')]);_0x4508ed[_0xeae8('0x58')]=_[_0xeae8('0x5c')](_0x4508ed[_0xeae8('0x58')],['id',_0xeae8('0x5d'),_0xeae8('0x5a')]);return db['sequelize'][_0xeae8('0x5e')](function(_0x460c34){return db[_0xeae8('0x37')][_0xeae8('0x57')](_[_0xeae8('0x4a')](_0x1d8284,_0x4508ed[_0xeae8('0x58')]),{'include':_0x4508ed[_0xeae8('0x3d')][_0xeae8('0x55')]?[{'all':!![]}]:undefined,'transaction':_0x460c34})['then'](function(_0x12f1e6){var _0x1a4299=_0x12f1e6[_0xeae8('0x59')]({'plain':!![]});return db[_0xeae8('0x5f')]['findAll']({'where':{'userProfileId':_0x4508ed[_0xeae8('0x53')]['id']},'raw':!![]})[_0xeae8('0x30')](function(_0x1c6989){if(_0x1c6989){return BPromise[_0xeae8('0x60')](_0x1c6989,function(_0x3da746){return new BPromise(function(_0x4ddd15,_0x30bc45){if(_0x3da746['autoAssociation']===null||_0x3da746[_0xeae8('0x61')]===0x1)_0x4ddd15(null);return db[_0xeae8('0x62')][_0xeae8('0x4f')]({'where':{'sectionId':_0x3da746['id']},'raw':!![]})[_0xeae8('0x30')](function(_0x6bf317){var _0x403e89=_[_0xeae8('0x4b')](_0x6bf317,function(_0x2163b3){return qs[_0xeae8('0x5c')](_0x2163b3,['id','createdAt',_0xeae8('0x5a'),_0xeae8('0x63')]);});_0x4ddd15(_0x403e89);})[_0xeae8('0x51')](function(_0x56f0f4){_0x30bc45(_0x56f0f4);});})[_0xeae8('0x30')](function(_0x3e6ad1){var _0x18c778=qs['omit'](_0x3da746,['id',_0xeae8('0x5d'),_0xeae8('0x5a')]);_0x18c778[_0xeae8('0x64')]=_0x1a4299['id'];if(_0x3e6ad1)_0x18c778[_0xeae8('0x65')]=_0x3e6ad1;return _0x18c778;})[_0xeae8('0x30')](function(_0x23db7a){return db['UserProfileSection'][_0xeae8('0x57')](_0x23db7a,{'include':[{'model':db[_0xeae8('0x62')],'as':_0xeae8('0x65')}],'raw':!![],'transaction':_0x460c34});});})['then'](function(){return _0x1a4299;});}});});});}})[_0xeae8('0x30')](respondWithResult(_0x213b55,0xc9))['catch'](handleError(_0x213b55,null));};exports['update']=function(_0x22b9d6,_0x123ada){if(_0x22b9d6[_0xeae8('0x58')]['id']){delete _0x22b9d6[_0xeae8('0x58')]['id'];}return db['UserProfile']['find']({'where':{'id':_0x22b9d6[_0xeae8('0x53')]['id']}})['then'](handleEntityNotFound(_0x123ada,null))['then'](saveUpdates(_0x22b9d6[_0xeae8('0x58')],null))[_0xeae8('0x30')](respondWithResult(_0x123ada,null))['catch'](handleError(_0x123ada,null));};exports[_0xeae8('0x31')]=function(_0x1173d4,_0x5ed2e5){return db[_0xeae8('0x37')][_0xeae8('0x56')]({'where':{'id':_0x1173d4[_0xeae8('0x53')]['id']}})['then'](handleEntityNotFound(_0x5ed2e5,null))[_0xeae8('0x30')](removeEntity(_0x5ed2e5,null))[_0xeae8('0x51')](handleError(_0x5ed2e5,null));};exports[_0xeae8('0x66')]=function(_0x20107f,_0x5722ce){return db[_0xeae8('0x37')][_0xeae8('0x66')]()[_0xeae8('0x30')](respondWithResult(_0x5722ce,null))[_0xeae8('0x51')](handleError(_0x5722ce,null));};exports[_0xeae8('0x67')]=function(_0x55c5f5,_0x705e9d){var _0x55ab38=_0x55c5f5[_0xeae8('0x58')];return db['UserProfile'][_0xeae8('0x56')]({'where':{'id':_0x55c5f5[_0xeae8('0x53')]['id']}})[_0xeae8('0x30')](handleEntityNotFound(_0x705e9d,null))[_0xeae8('0x30')](function(_0x2e7991){if(_0x2e7991){return db[_0xeae8('0x68')][_0xeae8('0x5e')](function(_0x490036){return db[_0xeae8('0x5f')][_0xeae8('0x31')]({'where':{'userProfileId':_0x55c5f5[_0xeae8('0x53')]['id'],'sectionId':_[_0xeae8('0x4b')](_0x55ab38,function(_0x3cac2d){return _0x3cac2d[_0xeae8('0x63')];})},'transaction':_0x490036})[_0xeae8('0x30')](function(){var _0x3668cd=_[_0xeae8('0x4b')](_0x55ab38,function(_0x775b22){_0x775b22[_0xeae8('0x64')]=_0x55c5f5[_0xeae8('0x53')]['id'];return _0x775b22;});var _0x18f1bb=[];return BPromise[_0xeae8('0x60')](_0x3668cd,function(_0x4c0690){return db['UserProfileSection'][_0xeae8('0x57')](_0x4c0690,{'include':[{'model':db[_0xeae8('0x62')],'as':_0xeae8('0x65')}],'raw':!![],'transaction':_0x490036})['then'](function(_0x1752ce){_0x18f1bb[_0xeae8('0x69')](_0x1752ce[_0xeae8('0x59')]({'plain':!![]}));});})[_0xeae8('0x30')](function(){return _0x18f1bb;});});});}})[_0xeae8('0x30')](function(_0x2e2aad){return _0x2e2aad;})[_0xeae8('0x30')](respondWithResult(_0x705e9d,null))['catch'](handleError(_0x705e9d,null));};exports['removeSections']=function(_0x365dfa,_0x2e6130){var _0x13ab33;return db[_0xeae8('0x37')][_0xeae8('0x56')]({'where':{'id':_0x365dfa[_0xeae8('0x53')]['id']},'attributes':['id','name']})[_0xeae8('0x30')](handleEntityNotFound(_0x2e6130,null))[_0xeae8('0x30')](function(_0x1db18f){if(_0x1db18f){_0x13ab33=_0x1db18f;return db[_0xeae8('0x5f')][_0xeae8('0x31')]({'where':{'userProfileId':_0x365dfa[_0xeae8('0x53')]['id'],'sectionId':_0x365dfa['query'][_0xeae8('0x6a')]}});}})[_0xeae8('0x30')](function(){return _0x13ab33;})[_0xeae8('0x30')](respondWithStatusCode(_0x2e6130,null))[_0xeae8('0x51')](handleError(_0x2e6130,null));};exports['getSections']=function(_0x458a76,_0xf1c6bd){var _0x559023=[];var _0x460ae5=[];return db[_0xeae8('0x5f')][_0xeae8('0x4f')]({'where':{'userProfileId':_0x458a76[_0xeae8('0x53')]['id']},'raw':!![]})['then'](function(_0x7d3cb2){_0x559023=_[_0xeae8('0x49')](_0x7d3cb2,function(_0x59da9e){return _0x59da9e[_0xeae8('0x6b')]===0x1||_['includes']([0x3eb,0x709],_0x59da9e[_0xeae8('0x63')]);});if(!_[_0xeae8('0x6c')](_0x559023)){return _['map'](_0x559023,function(_0x1bfc3a){return _0x1bfc3a[_0xeae8('0x63')];});}else{return;}})[_0xeae8('0x30')](function(_0x572244){if(_0x572244)_0x460ae5=_0x572244;if(_[_0xeae8('0x6d')](_0x460ae5,0x64)){var _0x28bdbb=_[_0xeae8('0x56')](_0x559023,{'sectionId':0x64});return hasDefaultDashboard(_0x28bdbb)[_0xeae8('0x30')](function(_0x1d7b7c){return _[_0xeae8('0x4b')](_0x559023,function(_0x5d2ae2){if(_0x5d2ae2[_0xeae8('0x63')]===0x64){_0x5d2ae2['subsections']=_0x1d7b7c;}return _0x5d2ae2;});});}else{return;}})[_0xeae8('0x30')](function(_0x5d1766){if(_0x5d1766)_0x559023=_0x5d1766;if(_[_0xeae8('0x6d')](_0x460ae5,0x3eb)){var _0x4dc0b6=_[_0xeae8('0x56')](_0x559023,{'sectionId':0x3eb});return getCustomDashboards(_0x4dc0b6)[_0xeae8('0x30')](function(_0x27317b){return _[_0xeae8('0x4b')](_0x559023,function(_0x4b0a11){if(_0x4dc0b6['enabled']){if(_0x4b0a11['sectionId']===0x3eb){_0x4b0a11[_0xeae8('0x6e')]=_0x27317b;}}else{if(_0x4b0a11[_0xeae8('0x63')]===0x64){_0x4b0a11['subsections']=_0x27317b;}}return _0x4b0a11;});});}else{return;}})[_0xeae8('0x30')](function(_0x3d2d2a){if(_0x3d2d2a)_0x559023=_0x3d2d2a;if(_['includes'](_0x460ae5,0x709)){var _0x27a398=_[_0xeae8('0x56')](_0x559023,{'sectionId':0x709});return getPlugins(_0x27a398)['then'](function(_0x4fb7a1){if(_0x27a398[_0xeae8('0x6b')]){return _[_0xeae8('0x4b')](_0x559023,function(_0x59c266){if(_0x59c266[_0xeae8('0x63')]===0x709){_0x59c266[_0xeae8('0x6e')]=_0x4fb7a1;}return _0x59c266;});}else{var _0x4f2dbb={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4fb7a1};var _0x45bee4=_[_0xeae8('0x4b')](_0x559023);_0x45bee4[_0xeae8('0x69')](_0x4f2dbb);return _0x45bee4;}});}else{return;}})[_0xeae8('0x30')](function(_0x233e89){if(_0x233e89)_0x559023=_0x233e89;return _[_0xeae8('0x49')](_0x559023,[_0xeae8('0x6b'),0x1]);})[_0xeae8('0x30')](respondWithResult(_0xf1c6bd,null))[_0xeae8('0x51')](handleError(_0xf1c6bd,null));};function hasDefaultDashboard(_0x63afe9){var _0x3bd9fb=[0x65];return new BPromise(function(_0x260014,_0x22cc41){try{if(_0x63afe9[_0xeae8('0x61')]){_0x260014(_0x3bd9fb);}else{return db['UserProfileResource'][_0xeae8('0x6f')]({'where':{'sectionId':_0x63afe9['id']},'raw':!![]})[_0xeae8('0x30')](function(_0x3cd292){_0x3cd292?_0x260014(_0x3bd9fb):_0x260014();});}}catch(_0x4134fa){_0x22cc41(_0x4134fa);}});}function getCustomDashboards(_0x4f052f){var _0x1bc707=[];return new BPromise(function(_0x5cb731,_0x330f86){try{if(_0x4f052f[_0xeae8('0x61')]){return db['Dashboard'][_0xeae8('0x4f')]({'raw':!![]})[_0xeae8('0x30')](function(_0xb3efdb){_0xb3efdb[_0xeae8('0x70')](function(_0x36a2f4){_0x1bc707[_0xeae8('0x69')](_0x36a2f4['id']+0x1869f);});_0x5cb731(_0x1bc707);});}else{return db['UserProfileResource'][_0xeae8('0x4f')]({'where':{'sectionId':_0x4f052f['id']},'raw':!![]})[_0xeae8('0x30')](function(_0x15ac76){_0x15ac76[_0xeae8('0x70')](function(_0x366f29){_0x1bc707[_0xeae8('0x69')](_0x366f29[_0xeae8('0x71')]+0x1869f);});_0x5cb731(_0x1bc707);});}}catch(_0x5efa33){_0x330f86(_0x5efa33);}});}function getPlugins(_0xdb988f){var _0x263c50=[];return new BPromise(function(_0x3d4df5,_0x1eddd9){try{if(_0xdb988f[_0xeae8('0x61')]){return db['Plugin'][_0xeae8('0x4f')]({'raw':!![]})[_0xeae8('0x30')](function(_0x21eb4e){_0x21eb4e[_0xeae8('0x70')](function(_0x1d89ef){_0x263c50[_0xeae8('0x69')](_0x1d89ef['id']+0x15b38);});_0x3d4df5(_0x263c50);});}else{return db[_0xeae8('0x62')][_0xeae8('0x4f')]({'where':{'sectionId':_0xdb988f['id']},'raw':!![]})[_0xeae8('0x30')](function(_0xfbc5ca){_0xfbc5ca[_0xeae8('0x70')](function(_0x28d37a){_0x263c50[_0xeae8('0x69')](_0x28d37a[_0xeae8('0x71')]+0x15b38);});_0x3d4df5(_0x263c50);});}}catch(_0x1b6305){_0x1eddd9(_0x1b6305);}});}exports[_0xeae8('0x72')]=function(_0xa2a9dc,_0x5b5deb){return db[_0xeae8('0x37')]['find']({'where':{'id':_0xa2a9dc['params']['id']}})[_0xeae8('0x30')](handleEntityNotFound(_0x5b5deb,null))[_0xeae8('0x30')](function(_0x147de4){if(_0x147de4){return db[_0xeae8('0x68')][_0xeae8('0x5e')](function(_0x3d2ed2){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0xa2a9dc[_0xeae8('0x53')]['id']},'attributes':['id'],'raw':!![]})[_0xeae8('0x30')](function(_0x17614b){if(_0x17614b){return db[_0xeae8('0x5f')][_0xeae8('0x31')]({'where':{'userProfileId':_0xa2a9dc[_0xeae8('0x53')]['id'],'id':_[_0xeae8('0x4b')](_0x17614b,function(_0x5c2002){return _0x5c2002['id'];})},'transaction':_0x3d2ed2});}})['then'](function(_0xf6aa2d){var _0xa15897=_[_0xeae8('0x4b')](_0xa2a9dc[_0xeae8('0x58')],function(_0x21f488){_0x21f488[_0xeae8('0x64')]=_0xa2a9dc[_0xeae8('0x53')]['id'];return _0x21f488;});return db['UserProfileSection'][_0xeae8('0x73')](_0xa15897,{'raw':!![],'transaction':_0x3d2ed2});})[_0xeae8('0x30')](function(_0x5815c6){var _0x7386a9=_[_0xeae8('0x49')](_[_0xeae8('0x4b')](_0x5815c6,function(_0x36f6d1){return _0x36f6d1[_0xeae8('0x59')]({'plain':!![]});}),{'includeAll':![]});if(_0x7386a9){return db[_0xeae8('0x5f')][_0xeae8('0x4f')]({'where':{'userProfileId':_0xa2a9dc[_0xeae8('0x53')]['id'],'sectionId':_[_0xeae8('0x4b')](_0x7386a9,function(_0x318368){return _0x318368[_0xeae8('0x63')];})},'attributes':['id',_0xeae8('0x63')],'raw':!![]})['then'](function(_0x6bd067){var _0x4bbeb4=_[_0xeae8('0x4b')](_0xa2a9dc[_0xeae8('0x58')],function(_0x1c8a8d){_0x1c8a8d[_0xeae8('0x64')]=_0xa2a9dc[_0xeae8('0x53')]['id'];return _0x1c8a8d;});return db[_0xeae8('0x62')]['bulkCreate'](_0x4bbeb4,{'raw':!![],'transaction':_0x3d2ed2});});}})[_0xeae8('0x51')](handleError(_0x5b5deb,null));});}})[_0xeae8('0x30')](function(_0x206dc9){var _0x28361f=_[_0xeae8('0x4b')](_0x206dc9,function(_0x368e0d){return _0x368e0d[_0xeae8('0x59')]({'plain':!![]});});})[_0xeae8('0x30')](respondWithResult(_0x5b5deb,null))[_0xeae8('0x51')](handleError(_0x5b5deb,null));};exports[_0xeae8('0x74')]=function(_0x4e7fcc,_0x5f5144,_0x3dfb7d){return db[_0xeae8('0x37')][_0xeae8('0x56')]({'where':{'id':_0x4e7fcc[_0xeae8('0x53')]['id']}})[_0xeae8('0x30')](handleEntityNotFound(_0x5f5144,null))['then'](function(_0x4d5a2c){if(_0x4d5a2c){return _0x4d5a2c[_0xeae8('0x74')](_0x4e7fcc[_0xeae8('0x3d')]['ids']);}})['then'](respondWithStatusCode(_0x5f5144,null))['catch'](handleError(_0x5f5144,null));};exports['getResources']=function(_0x1ebc1c,_0x17db20){var _0x8bc288={};if(!_0x1ebc1c[_0xeae8('0x3d')][_0xeae8('0x75')])throw new Error(_0xeae8('0x76'));if(!_0x1ebc1c['query'][_0xeae8('0x43')](_0xeae8('0x44'))){_0x8bc288[_0xeae8('0x2b')]=qs[_0xeae8('0x2b')](_0x1ebc1c[_0xeae8('0x3d')]['limit']);_0x8bc288[_0xeae8('0x2a')]=qs['offset'](_0x1ebc1c[_0xeae8('0x3d')][_0xeae8('0x2a')]);}return db[_0xeae8('0x37')][_0xeae8('0x56')]({'where':{'id':_0x1ebc1c[_0xeae8('0x53')]['id']}})[_0xeae8('0x30')](function(_0x2097a1){if(!_0x2097a1)throw new Error(_0xeae8('0x77')+_0x1ebc1c[_0xeae8('0x53')]['id']);return db[_0xeae8('0x37')][_0xeae8('0x78')](_0x1ebc1c);})[_0xeae8('0x30')](respondWithFilteredResult(_0x17db20,_0x8bc288))[_0xeae8('0x51')](handleError(_0x17db20,null));}; \ No newline at end of file +var _0x5ae9=['status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then','end','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','UserProfile','includeAll','include','findAll','catch','show','params','keys','options','find','create','body','omit','createdAt','updatedAt','transaction','UserProfileSection','autoAssociation','sectionId','userProfileId','Resources','UserProfileResource','update','destroy','describe','sequelize','each','push','get','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','eml-format','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','register'];(function(_0x42b92e,_0x445ec1){var _0x434681=function(_0x20a823){while(--_0x20a823){_0x42b92e['push'](_0x42b92e['shift']());}};_0x434681(++_0x445ec1);}(_0x5ae9,0x19b));var _0x95ae=function(_0x344128,_0x9b9e88){_0x344128=_0x344128-0x0;var _0x693fae=_0x5ae9[_0x344128];return _0x693fae;};'use strict';var emlformat=require(_0x95ae('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x95ae('0x1'));var rp=require(_0x95ae('0x2'));var moment=require('moment');var BPromise=require(_0x95ae('0x3'));var Mustache=require(_0x95ae('0x4'));var util=require('util');var path=require(_0x95ae('0x5'));var sox=require('sox');var csv=require(_0x95ae('0x6'));var ejs=require(_0x95ae('0x7'));var fs=require('fs');var fs_extra=require(_0x95ae('0x8'));var _=require(_0x95ae('0x9'));var squel=require(_0x95ae('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x95ae('0xb'));var toCsv=require(_0x95ae('0x6'));var querystring=require(_0x95ae('0xc'));var Papa=require(_0x95ae('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x95ae('0xe'));var as=require(_0x95ae('0xf'));var hardwareService=require(_0x95ae('0x10'));var logger=require(_0x95ae('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x95ae('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x95ae('0x13'))['db'];config[_0x95ae('0x14')]=_['defaults'](config[_0x95ae('0x14')],{'host':_0x95ae('0x15'),'port':0x18eb});var socket=require(_0x95ae('0x16'))(new Redis(config['redis']));require(_0x95ae('0x17'))[_0x95ae('0x18')](socket);function respondWithStatusCode(_0x308b7a,_0x5a7ecb){_0x5a7ecb=_0x5a7ecb||0xcc;return function(_0x1bc94f){if(_0x1bc94f){return _0x308b7a['sendStatus'](_0x5a7ecb);}return _0x308b7a[_0x95ae('0x19')](_0x5a7ecb)['end']();};}function respondWithResult(_0x2594fe,_0x194337){_0x194337=_0x194337||0xc8;return function(_0x3fc518){if(_0x3fc518){return _0x2594fe[_0x95ae('0x19')](_0x194337)[_0x95ae('0x1a')](_0x3fc518);}};}function respondWithFilteredResult(_0x38b457,_0x129b62){return function(_0x24d5d2){if(_0x24d5d2){var _0x3e1afc=typeof _0x129b62['offset']===_0x95ae('0x1b')&&typeof _0x129b62[_0x95ae('0x1c')]==='undefined';var _0x14a11d=_0x24d5d2[_0x95ae('0x1d')];var _0x52b27c=_0x3e1afc?0x0:_0x129b62['offset'];var _0x2649c4=_0x3e1afc?_0x24d5d2[_0x95ae('0x1d')]:_0x129b62[_0x95ae('0x1e')]+_0x129b62[_0x95ae('0x1c')];var _0x8ed1b1;if(_0x2649c4>=_0x14a11d){_0x2649c4=_0x14a11d;_0x8ed1b1=0xc8;}else{_0x8ed1b1=0xce;}_0x38b457['status'](_0x8ed1b1);return _0x38b457[_0x95ae('0x1f')](_0x95ae('0x20'),_0x52b27c+'-'+_0x2649c4+'/'+_0x14a11d)[_0x95ae('0x1a')](_0x24d5d2);}return null;};}function patchUpdates(_0x2ad155){return function(_0x4cf68d){try{jsonpatch[_0x95ae('0x21')](_0x4cf68d,_0x2ad155,!![]);}catch(_0x5b0453){return BPromise[_0x95ae('0x22')](_0x5b0453);}return _0x4cf68d['save']();};}function saveUpdates(_0x2b46c5,_0x199c68){return function(_0x198427){if(_0x198427){return _0x198427['update'](_0x2b46c5)[_0x95ae('0x23')](function(_0x25d81c){return _0x25d81c;});}return null;};}function removeEntity(_0x1b3dc5,_0x1437e1){return function(_0x36351e){if(_0x36351e){return _0x36351e['destroy']()[_0x95ae('0x23')](function(){_0x1b3dc5[_0x95ae('0x19')](0xcc)[_0x95ae('0x24')]();});}};}function handleEntityNotFound(_0x23d006,_0x3a3cd6){return function(_0x51ba5d){if(!_0x51ba5d){_0x23d006[_0x95ae('0x25')](0x194);}return _0x51ba5d;};}function handleError(_0x4d1708,_0x3362e2){_0x3362e2=_0x3362e2||0x1f4;return function(_0x5f4d16){logger[_0x95ae('0x26')](_0x5f4d16[_0x95ae('0x27')]);if(_0x5f4d16['name']){delete _0x5f4d16[_0x95ae('0x28')];}_0x4d1708[_0x95ae('0x19')](_0x3362e2)[_0x95ae('0x29')](_0x5f4d16);};}exports['index']=function(_0x23d3fb,_0x4c111d){var _0x4c44f4={},_0x4ab2db={},_0x1820b4={'count':0x0,'rows':[]};var _0x1e893e=_[_0x95ae('0x2a')](db['UserProfile'][_0x95ae('0x2b')],function(_0x59f686){return{'name':_0x59f686[_0x95ae('0x2c')],'type':_0x59f686[_0x95ae('0x2d')]['key']};});_0x4ab2db[_0x95ae('0x2e')]=_['map'](_0x1e893e,_0x95ae('0x28'));_0x4ab2db[_0x95ae('0x2f')]=_['keys'](_0x23d3fb[_0x95ae('0x2f')]);_0x4ab2db[_0x95ae('0x30')]=_[_0x95ae('0x31')](_0x4ab2db[_0x95ae('0x2e')],_0x4ab2db[_0x95ae('0x2f')]);_0x4c44f4[_0x95ae('0x32')]=_[_0x95ae('0x31')](_0x4ab2db['model'],qs['fields'](_0x23d3fb[_0x95ae('0x2f')][_0x95ae('0x33')]));_0x4c44f4[_0x95ae('0x32')]=_0x4c44f4[_0x95ae('0x32')][_0x95ae('0x34')]?_0x4c44f4['attributes']:_0x4ab2db[_0x95ae('0x2e')];if(!_0x23d3fb[_0x95ae('0x2f')][_0x95ae('0x35')](_0x95ae('0x36'))){_0x4c44f4[_0x95ae('0x1c')]=qs[_0x95ae('0x1c')](_0x23d3fb['query'][_0x95ae('0x1c')]);_0x4c44f4[_0x95ae('0x1e')]=qs[_0x95ae('0x1e')](_0x23d3fb[_0x95ae('0x2f')]['offset']);}_0x4c44f4[_0x95ae('0x37')]=qs['sort'](_0x23d3fb[_0x95ae('0x2f')][_0x95ae('0x38')]);_0x4c44f4[_0x95ae('0x39')]=qs[_0x95ae('0x30')](_[_0x95ae('0x3a')](_0x23d3fb[_0x95ae('0x2f')],_0x4ab2db['filters']),_0x1e893e);if(_0x23d3fb[_0x95ae('0x2f')][_0x95ae('0x3b')]){_0x4c44f4['where']=_['merge'](_0x4c44f4[_0x95ae('0x39')],{'$or':_[_0x95ae('0x2a')](_0x1e893e,function(_0x33d62d){if(_0x33d62d['type']!==_0x95ae('0x3c')){var _0x1763d7={};_0x1763d7[_0x33d62d[_0x95ae('0x28')]]={'$like':'%'+_0x23d3fb[_0x95ae('0x2f')][_0x95ae('0x3b')]+'%'};return _0x1763d7;}})});}_0x4c44f4=_[_0x95ae('0x3d')]({},_0x4c44f4,_0x23d3fb['options']);var _0x3a3923={'where':_0x4c44f4[_0x95ae('0x39')]};return db[_0x95ae('0x3e')][_0x95ae('0x1d')](_0x3a3923)[_0x95ae('0x23')](function(_0xf41d5b){_0x1820b4[_0x95ae('0x1d')]=_0xf41d5b;if(_0x23d3fb['query'][_0x95ae('0x3f')]){_0x4c44f4[_0x95ae('0x40')]=[{'all':!![]}];}return db[_0x95ae('0x3e')][_0x95ae('0x41')](_0x4c44f4);})[_0x95ae('0x23')](function(_0x4ec147){_0x1820b4['rows']=_0x4ec147;return _0x1820b4;})[_0x95ae('0x23')](respondWithFilteredResult(_0x4c111d,_0x4c44f4))[_0x95ae('0x42')](handleError(_0x4c111d,null));};exports[_0x95ae('0x43')]=function(_0x63150a,_0x5d8c84){var _0x480200={'raw':![],'where':{'id':_0x63150a[_0x95ae('0x44')]['id']}},_0x5438db={};_0x5438db['model']=_['keys'](db[_0x95ae('0x3e')][_0x95ae('0x2b')]);_0x5438db['query']=_[_0x95ae('0x45')](_0x63150a[_0x95ae('0x2f')]);_0x5438db[_0x95ae('0x30')]=_[_0x95ae('0x31')](_0x5438db['model'],_0x5438db[_0x95ae('0x2f')]);_0x480200[_0x95ae('0x32')]=_[_0x95ae('0x31')](_0x5438db['model'],qs[_0x95ae('0x33')](_0x63150a[_0x95ae('0x2f')][_0x95ae('0x33')]));_0x480200[_0x95ae('0x32')]=_0x480200[_0x95ae('0x32')][_0x95ae('0x34')]?_0x480200[_0x95ae('0x32')]:_0x5438db[_0x95ae('0x2e')];if(_0x63150a[_0x95ae('0x2f')]['includeAll']){_0x480200[_0x95ae('0x40')]=[{'all':!![]}];}_0x480200=_['merge']({},_0x480200,_0x63150a[_0x95ae('0x46')]);return db[_0x95ae('0x3e')][_0x95ae('0x47')](_0x480200)['then'](handleEntityNotFound(_0x5d8c84,null))[_0x95ae('0x23')](respondWithResult(_0x5d8c84,null))[_0x95ae('0x42')](handleError(_0x5d8c84,null));};exports['create']=function(_0x13e4eb,_0x468620){return db['UserProfile'][_0x95ae('0x48')](_0x13e4eb[_0x95ae('0x49')],{})['then'](respondWithResult(_0x468620,0xc9))[_0x95ae('0x42')](handleError(_0x468620,null));};exports['clone']=function(_0x1d2166,_0x1de74a){var _0x23621f={'where':{'id':_0x1d2166[_0x95ae('0x44')]['id']}},_0x4be73a={};_0x4be73a[_0x95ae('0x2e')]=_['keys'](db[_0x95ae('0x3e')][_0x95ae('0x2b')]);_0x23621f['attributes']=_['intersection'](_0x4be73a[_0x95ae('0x2e')],qs[_0x95ae('0x33')](_0x1d2166['query']['fields']));_0x23621f['attributes']=_0x23621f[_0x95ae('0x32')][_0x95ae('0x34')]?_0x23621f[_0x95ae('0x32')]:_0x4be73a[_0x95ae('0x2e')];if(_0x1d2166[_0x95ae('0x2f')]['includeAll']){_0x23621f[_0x95ae('0x40')]=[{'all':!![]}];}_0x23621f=_[_0x95ae('0x3d')]({},_0x23621f,_0x1d2166[_0x95ae('0x46')]);return db[_0x95ae('0x3e')]['find'](_0x23621f)[_0x95ae('0x23')](handleEntityNotFound(_0x1de74a,null))[_0x95ae('0x23')](function(_0x5f021b){if(_0x5f021b){var _0x79ec22=_0x5f021b['get']({'plain':!![]});_0x79ec22=qs[_0x95ae('0x4a')](_0x79ec22,['id',_0x95ae('0x4b'),_0x95ae('0x4c'),'crudPermissions']);_0x1d2166[_0x95ae('0x49')]=_[_0x95ae('0x4a')](_0x1d2166['body'],['id',_0x95ae('0x4b'),_0x95ae('0x4c')]);return db['sequelize'][_0x95ae('0x4d')](function(_0x52bc1e){return db[_0x95ae('0x3e')][_0x95ae('0x48')](_[_0x95ae('0x3d')](_0x79ec22,_0x1d2166['body']),{'include':_0x1d2166[_0x95ae('0x2f')][_0x95ae('0x3f')]?[{'all':!![]}]:undefined,'transaction':_0x52bc1e})[_0x95ae('0x23')](function(_0x3917ca){var _0x47c475=_0x3917ca['get']({'plain':!![]});return db[_0x95ae('0x4e')][_0x95ae('0x41')]({'where':{'userProfileId':_0x1d2166[_0x95ae('0x44')]['id']},'raw':!![]})[_0x95ae('0x23')](function(_0x577578){if(_0x577578){return BPromise['each'](_0x577578,function(_0x4c3242){return new BPromise(function(_0x4b8606,_0x4339bb){if(_0x4c3242[_0x95ae('0x4f')]===null||_0x4c3242['autoAssociation']===0x1)_0x4b8606(null);return db['UserProfileResource'][_0x95ae('0x41')]({'where':{'sectionId':_0x4c3242['id']},'raw':!![]})[_0x95ae('0x23')](function(_0x1ba655){var _0x2c1225=_[_0x95ae('0x2a')](_0x1ba655,function(_0x231cda){return qs[_0x95ae('0x4a')](_0x231cda,['id',_0x95ae('0x4b'),'updatedAt',_0x95ae('0x50')]);});_0x4b8606(_0x2c1225);})[_0x95ae('0x42')](function(_0x19bace){_0x4339bb(_0x19bace);});})['then'](function(_0x299067){var _0x559885=qs[_0x95ae('0x4a')](_0x4c3242,['id',_0x95ae('0x4b'),_0x95ae('0x4c')]);_0x559885[_0x95ae('0x51')]=_0x47c475['id'];if(_0x299067)_0x559885[_0x95ae('0x52')]=_0x299067;return _0x559885;})[_0x95ae('0x23')](function(_0x5a3fc7){return db[_0x95ae('0x4e')][_0x95ae('0x48')](_0x5a3fc7,{'include':[{'model':db[_0x95ae('0x53')],'as':_0x95ae('0x52')}],'raw':!![],'transaction':_0x52bc1e});});})['then'](function(){return _0x47c475;});}});});});}})[_0x95ae('0x23')](respondWithResult(_0x1de74a,0xc9))['catch'](handleError(_0x1de74a,null));};exports[_0x95ae('0x54')]=function(_0x3db2e8,_0x2e009a){if(_0x3db2e8[_0x95ae('0x49')]['id']){delete _0x3db2e8[_0x95ae('0x49')]['id'];}return db[_0x95ae('0x3e')][_0x95ae('0x47')]({'where':{'id':_0x3db2e8['params']['id']}})['then'](handleEntityNotFound(_0x2e009a,null))[_0x95ae('0x23')](saveUpdates(_0x3db2e8['body'],null))[_0x95ae('0x23')](respondWithResult(_0x2e009a,null))[_0x95ae('0x42')](handleError(_0x2e009a,null));};exports[_0x95ae('0x55')]=function(_0x793ae6,_0x44eb9a){return db[_0x95ae('0x3e')]['find']({'where':{'id':_0x793ae6[_0x95ae('0x44')]['id']}})[_0x95ae('0x23')](handleEntityNotFound(_0x44eb9a,null))[_0x95ae('0x23')](removeEntity(_0x44eb9a,null))[_0x95ae('0x42')](handleError(_0x44eb9a,null));};exports['describe']=function(_0x84d4ca,_0x5c68ea){return db[_0x95ae('0x3e')][_0x95ae('0x56')]()[_0x95ae('0x23')](respondWithResult(_0x5c68ea,null))[_0x95ae('0x42')](handleError(_0x5c68ea,null));};exports['addSections']=function(_0x2c891c,_0x3d44d7){var _0x5f9224=_0x2c891c[_0x95ae('0x49')];return db['UserProfile']['find']({'where':{'id':_0x2c891c[_0x95ae('0x44')]['id']}})[_0x95ae('0x23')](handleEntityNotFound(_0x3d44d7,null))['then'](function(_0x3aaf60){if(_0x3aaf60){return db[_0x95ae('0x57')][_0x95ae('0x4d')](function(_0x4f6735){return db[_0x95ae('0x4e')]['destroy']({'where':{'userProfileId':_0x2c891c[_0x95ae('0x44')]['id'],'sectionId':_[_0x95ae('0x2a')](_0x5f9224,function(_0x5d8c26){return _0x5d8c26[_0x95ae('0x50')];})},'transaction':_0x4f6735})['then'](function(){var _0x3e431f=_['map'](_0x5f9224,function(_0x1c22a1){_0x1c22a1[_0x95ae('0x51')]=_0x2c891c['params']['id'];return _0x1c22a1;});var _0x2725bf=[];return BPromise[_0x95ae('0x58')](_0x3e431f,function(_0x4f1fce){return db[_0x95ae('0x4e')][_0x95ae('0x48')](_0x4f1fce,{'include':[{'model':db[_0x95ae('0x53')],'as':_0x95ae('0x52')}],'raw':!![],'transaction':_0x4f6735})[_0x95ae('0x23')](function(_0x3a09d0){_0x2725bf[_0x95ae('0x59')](_0x3a09d0[_0x95ae('0x5a')]({'plain':!![]}));});})[_0x95ae('0x23')](function(){return _0x2725bf;});});});}})[_0x95ae('0x23')](function(_0x4eb034){return _0x4eb034;})[_0x95ae('0x23')](respondWithResult(_0x3d44d7,null))[_0x95ae('0x42')](handleError(_0x3d44d7,null));};exports[_0x95ae('0x5b')]=function(_0x4f3426,_0x536a4a){var _0x9322fe;return db[_0x95ae('0x3e')][_0x95ae('0x47')]({'where':{'id':_0x4f3426[_0x95ae('0x44')]['id']},'attributes':['id','name']})[_0x95ae('0x23')](handleEntityNotFound(_0x536a4a,null))[_0x95ae('0x23')](function(_0x52ce94){if(_0x52ce94){_0x9322fe=_0x52ce94;return db[_0x95ae('0x4e')]['destroy']({'where':{'userProfileId':_0x4f3426[_0x95ae('0x44')]['id'],'sectionId':_0x4f3426[_0x95ae('0x2f')][_0x95ae('0x5c')]}});}})[_0x95ae('0x23')](function(){return _0x9322fe;})['then'](respondWithStatusCode(_0x536a4a,null))[_0x95ae('0x42')](handleError(_0x536a4a,null));};exports[_0x95ae('0x5d')]=function(_0x545404,_0x29c911){var _0x102eb5=[];var _0x17d435=[];return db[_0x95ae('0x4e')][_0x95ae('0x41')]({'where':{'userProfileId':_0x545404[_0x95ae('0x44')]['id']},'raw':!![]})[_0x95ae('0x23')](function(_0x534e91){_0x102eb5=_[_0x95ae('0x3b')](_0x534e91,function(_0x723b2e){return _0x723b2e[_0x95ae('0x5e')]===0x1||_[_0x95ae('0x5f')]([0x3eb,0x709],_0x723b2e['sectionId']);});if(!_[_0x95ae('0x60')](_0x102eb5)){return _[_0x95ae('0x2a')](_0x102eb5,function(_0x36d7e0){return _0x36d7e0[_0x95ae('0x50')];});}else{return;}})[_0x95ae('0x23')](function(_0x3f9c0c){if(_0x3f9c0c)_0x17d435=_0x3f9c0c;if(_[_0x95ae('0x5f')](_0x17d435,0x64)){var _0x3daf7f=_[_0x95ae('0x47')](_0x102eb5,{'sectionId':0x64});return hasDefaultDashboard(_0x3daf7f)[_0x95ae('0x23')](function(_0x38383a){return _[_0x95ae('0x2a')](_0x102eb5,function(_0x1bad57){if(_0x1bad57[_0x95ae('0x50')]===0x64){_0x1bad57['subsections']=_0x38383a;}return _0x1bad57;});});}else{return;}})[_0x95ae('0x23')](function(_0x31b17c){if(_0x31b17c)_0x102eb5=_0x31b17c;if(_[_0x95ae('0x5f')](_0x17d435,0x3eb)){var _0x241ce4=_[_0x95ae('0x47')](_0x102eb5,{'sectionId':0x3eb});return getCustomDashboards(_0x241ce4)['then'](function(_0x5c0019){return _['map'](_0x102eb5,function(_0x42ce16){if(_0x241ce4[_0x95ae('0x5e')]){if(_0x42ce16[_0x95ae('0x50')]===0x3eb){_0x42ce16['subsections']=_0x5c0019;}}else{if(_0x42ce16[_0x95ae('0x50')]===0x64){_0x42ce16[_0x95ae('0x61')]=_0x5c0019;}}return _0x42ce16;});});}else{return;}})[_0x95ae('0x23')](function(_0x316e99){if(_0x316e99)_0x102eb5=_0x316e99;if(_[_0x95ae('0x5f')](_0x17d435,0x709)){var _0x1e9e0f=_['find'](_0x102eb5,{'sectionId':0x709});return getPlugins(_0x1e9e0f)[_0x95ae('0x23')](function(_0x11896f){if(_0x1e9e0f['enabled']){return _[_0x95ae('0x2a')](_0x102eb5,function(_0x343638){if(_0x343638['sectionId']===0x709){_0x343638[_0x95ae('0x61')]=_0x11896f;}return _0x343638;});}else{var _0x3e523d={'sectionId':0x76c,'enabled':0x1,'subsections':_0x11896f};var _0x4f886d=_[_0x95ae('0x2a')](_0x102eb5);_0x4f886d[_0x95ae('0x59')](_0x3e523d);return _0x4f886d;}});}else{return;}})[_0x95ae('0x23')](function(_0x305afe){if(_0x305afe)_0x102eb5=_0x305afe;return _['filter'](_0x102eb5,[_0x95ae('0x5e'),0x1]);})[_0x95ae('0x23')](respondWithResult(_0x29c911,null))['catch'](handleError(_0x29c911,null));};function hasDefaultDashboard(_0x236df6){var _0x4dee23=[0x65];return new BPromise(function(_0x9e4043,_0x53682d){try{if(_0x236df6['autoAssociation']){_0x9e4043(_0x4dee23);}else{return db[_0x95ae('0x53')][_0x95ae('0x62')]({'where':{'sectionId':_0x236df6['id']},'raw':!![]})[_0x95ae('0x23')](function(_0x247192){_0x247192?_0x9e4043(_0x4dee23):_0x9e4043();});}}catch(_0x3c5f4f){_0x53682d(_0x3c5f4f);}});}function getCustomDashboards(_0x12aa75){var _0x4453c7=[];return new BPromise(function(_0x1da62e,_0x20ecbf){try{if(_0x12aa75[_0x95ae('0x4f')]){return db[_0x95ae('0x63')]['findAll']({'raw':!![]})[_0x95ae('0x23')](function(_0x87cfd0){_0x87cfd0[_0x95ae('0x64')](function(_0x380151){_0x4453c7['push'](_0x380151['id']+0x1869f);});_0x1da62e(_0x4453c7);});}else{return db[_0x95ae('0x53')][_0x95ae('0x41')]({'where':{'sectionId':_0x12aa75['id']},'raw':!![]})[_0x95ae('0x23')](function(_0xe0c94f){_0xe0c94f['forEach'](function(_0x21984f){_0x4453c7[_0x95ae('0x59')](_0x21984f[_0x95ae('0x65')]+0x1869f);});_0x1da62e(_0x4453c7);});}}catch(_0x14d3e5){_0x20ecbf(_0x14d3e5);}});}function getPlugins(_0x5b5592){var _0xe14fe8=[];return new BPromise(function(_0x5b0258,_0x13af5c){try{if(_0x5b5592[_0x95ae('0x4f')]){return db[_0x95ae('0x66')][_0x95ae('0x41')]({'raw':!![]})[_0x95ae('0x23')](function(_0x3665ee){_0x3665ee['forEach'](function(_0xdc676a){_0xe14fe8[_0x95ae('0x59')](_0xdc676a['id']+0x15b38);});_0x5b0258(_0xe14fe8);});}else{return db[_0x95ae('0x53')][_0x95ae('0x41')]({'where':{'sectionId':_0x5b5592['id']},'raw':!![]})[_0x95ae('0x23')](function(_0x3d8bec){_0x3d8bec[_0x95ae('0x64')](function(_0x3461e3){_0xe14fe8[_0x95ae('0x59')](_0x3461e3['resourceId']+0x15b38);});_0x5b0258(_0xe14fe8);});}}catch(_0x212be2){_0x13af5c(_0x212be2);}});}exports[_0x95ae('0x67')]=function(_0xbc83ba,_0x143ec1){return db['UserProfile'][_0x95ae('0x47')]({'where':{'id':_0xbc83ba[_0x95ae('0x44')]['id']}})[_0x95ae('0x23')](handleEntityNotFound(_0x143ec1,null))[_0x95ae('0x23')](function(_0x356121){if(_0x356121){return db[_0x95ae('0x57')]['transaction'](function(_0x5c6992){return db[_0x95ae('0x4e')][_0x95ae('0x41')]({'where':{'userProfileId':_0xbc83ba[_0x95ae('0x44')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x59c2a0){if(_0x59c2a0){return db[_0x95ae('0x4e')][_0x95ae('0x55')]({'where':{'userProfileId':_0xbc83ba[_0x95ae('0x44')]['id'],'id':_[_0x95ae('0x2a')](_0x59c2a0,function(_0x16dec5){return _0x16dec5['id'];})},'transaction':_0x5c6992});}})['then'](function(_0x41143e){var _0x72d8d5=_[_0x95ae('0x2a')](_0xbc83ba[_0x95ae('0x49')],function(_0xb6622c){_0xb6622c[_0x95ae('0x51')]=_0xbc83ba[_0x95ae('0x44')]['id'];return _0xb6622c;});return db['UserProfileSection'][_0x95ae('0x68')](_0x72d8d5,{'raw':!![],'transaction':_0x5c6992});})['then'](function(_0x4e08c0){var _0x1f7ddd=_[_0x95ae('0x3b')](_['map'](_0x4e08c0,function(_0x2ee0bf){return _0x2ee0bf['get']({'plain':!![]});}),{'includeAll':![]});if(_0x1f7ddd){return db[_0x95ae('0x4e')][_0x95ae('0x41')]({'where':{'userProfileId':_0xbc83ba[_0x95ae('0x44')]['id'],'sectionId':_[_0x95ae('0x2a')](_0x1f7ddd,function(_0x24a7ef){return _0x24a7ef[_0x95ae('0x50')];})},'attributes':['id',_0x95ae('0x50')],'raw':!![]})[_0x95ae('0x23')](function(_0x1b965a){var _0x1363d0=_[_0x95ae('0x2a')](_0xbc83ba[_0x95ae('0x49')],function(_0x28ae2a){_0x28ae2a[_0x95ae('0x51')]=_0xbc83ba[_0x95ae('0x44')]['id'];return _0x28ae2a;});return db[_0x95ae('0x53')]['bulkCreate'](_0x1363d0,{'raw':!![],'transaction':_0x5c6992});});}})[_0x95ae('0x42')](handleError(_0x143ec1,null));});}})[_0x95ae('0x23')](function(_0x4f5d57){var _0x2a00cb=_[_0x95ae('0x2a')](_0x4f5d57,function(_0x31f0c0){return _0x31f0c0[_0x95ae('0x5a')]({'plain':!![]});});})[_0x95ae('0x23')](respondWithResult(_0x143ec1,null))[_0x95ae('0x42')](handleError(_0x143ec1,null));};exports[_0x95ae('0x69')]=function(_0x5aaca9,_0x491851,_0x6b4833){return db['UserProfile'][_0x95ae('0x47')]({'where':{'id':_0x5aaca9[_0x95ae('0x44')]['id']}})[_0x95ae('0x23')](handleEntityNotFound(_0x491851,null))[_0x95ae('0x23')](function(_0x3ba038){if(_0x3ba038){return _0x3ba038[_0x95ae('0x69')](_0x5aaca9[_0x95ae('0x2f')][_0x95ae('0x5c')]);}})[_0x95ae('0x23')](respondWithStatusCode(_0x491851,null))[_0x95ae('0x42')](handleError(_0x491851,null));};exports[_0x95ae('0x6a')]=function(_0x11871a,_0x4422af){var _0x534c99={};if(!_0x11871a[_0x95ae('0x2f')][_0x95ae('0x6b')])throw new Error(_0x95ae('0x6c'));if(!_0x11871a[_0x95ae('0x2f')][_0x95ae('0x35')]('nolimit')){_0x534c99[_0x95ae('0x1c')]=qs[_0x95ae('0x1c')](_0x11871a[_0x95ae('0x2f')][_0x95ae('0x1c')]);_0x534c99['offset']=qs['offset'](_0x11871a[_0x95ae('0x2f')]['offset']);}return db['UserProfile']['find']({'where':{'id':_0x11871a[_0x95ae('0x44')]['id']}})[_0x95ae('0x23')](function(_0x1135aa){if(!_0x1135aa)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x11871a[_0x95ae('0x44')]['id']);return db[_0x95ae('0x3e')]['getResources'](_0x11871a);})[_0x95ae('0x23')](respondWithFilteredResult(_0x4422af,_0x534c99))['catch'](handleError(_0x4422af,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index d93043b..5d9699e 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 _0x11f3=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserProfile','save'];(function(_0x44aa58,_0x211ecd){var _0x43e9cf=function(_0x3fb357){while(--_0x3fb357){_0x44aa58['push'](_0x44aa58['shift']());}};_0x43e9cf(++_0x211ecd);}(_0x11f3,0x149));var _0x311f=function(_0x13f638,_0x3dd3a4){_0x13f638=_0x13f638-0x0;var _0x500f5d=_0x11f3[_0x13f638];return _0x500f5d;};'use strict';var EventEmitter=require(_0x311f('0x0'));var UserProfile=require(_0x311f('0x1'))['db'][_0x311f('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x311f('0x3'),'afterUpdate':'update','afterDestroy':_0x311f('0x4')};function emitEvent(_0x3f8433){return function(_0x14ae97,_0x5efe46,_0x5cb8aa){UserProfileEvents[_0x311f('0x5')](_0x3f8433+':'+_0x14ae97['id'],_0x14ae97);UserProfileEvents['emit'](_0x3f8433,_0x14ae97);_0x5cb8aa(null);};}for(var e in events){if(events[_0x311f('0x6')](e)){var event=events[e];UserProfile[_0x311f('0x7')](e,emitEvent(event));}}module[_0x311f('0x8')]=UserProfileEvents; \ No newline at end of file +var _0xe5af=['emit','exports','../../mysqldb','UserProfile','save','update','remove'];(function(_0x1c3811,_0x413bfb){var _0x1b87f2=function(_0x26a5f1){while(--_0x26a5f1){_0x1c3811['push'](_0x1c3811['shift']());}};_0x1b87f2(++_0x413bfb);}(_0xe5af,0x9c));var _0xfe5a=function(_0x2d9bca,_0xb3e985){_0x2d9bca=_0x2d9bca-0x0;var _0xbb82af=_0xe5af[_0x2d9bca];return _0xbb82af;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xfe5a('0x0'))['db'][_0xfe5a('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfe5a('0x2'),'afterUpdate':_0xfe5a('0x3'),'afterDestroy':_0xfe5a('0x4')};function emitEvent(_0x4adbd1){return function(_0x1165e3,_0x48e3a7,_0x526677){UserProfileEvents[_0xfe5a('0x5')](_0x4adbd1+':'+_0x1165e3['id'],_0x1165e3);UserProfileEvents[_0xfe5a('0x5')](_0x4adbd1,_0x1165e3);_0x526677(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xfe5a('0x6')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index d31c4a0..9816432 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 _0xed17=['telephones','Users','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','CannedAnswer','Disposition','intervals','Interval','pauses','Pause','scheduler','Schedule','Sound','tags','Template','triggers','Trigger','trunks','Trunk','Variable','plugins','extractedreports','AnalyticExtractedReport','Reports','reportId','AnalyticMetric','toUpperCase','QueryTypes','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','Invalid\x20section\x20\x27','isEmpty','push','UserProfileSection','find','params','union','ignore','autoAssociation','all','length','rawAttributes','keys','filters','model','attributes','intersection','fields','hasOwnProperty','limit','offset','order','sort','pick','key','VIRTUAL','foreignKey','forEach','merge','options','includeAll','reportType','default','DefaultReports','custom','count','rows','include','Tag','Tags','tag','ThroughTags','Agents','openTabs','true','chat','sms','fax','dataValues','mail','openchannel','whatsapp','lodash','../../components/parsers/qs','squel','exports','filter','field','value','then','associatedResources','catch','findAll','name','UserProfileResource','map','resourceId','type','squareprojects','SquareProject','odbc','childModel','SquareOdbc','SquareRecording','parentSections','SquareProjects','projects','JscriptyProject','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','chatwebsites','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','contexts','VoiceContext','VoiceMail','voicerecordings','membername','User','role','agent','Telephones','VoiceQueues','inbound','QueueCampaigns','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','queuecampaigns','users'];(function(_0x4ec339,_0x22430f){var _0x4e0e80=function(_0x321374){while(--_0x321374){_0x4ec339['push'](_0x4ec339['shift']());}};_0x4e0e80(++_0x22430f);}(_0xed17,0x67));var _0x7ed1=function(_0x540315,_0x5e4286){_0x540315=_0x540315-0x0;var _0x45b752=_0xed17[_0x540315];return _0x45b752;};'use strict';var _=require(_0x7ed1('0x0'));var attributes=require('./userProfile.attributes');var qs=require(_0x7ed1('0x1'));var squel=require(_0x7ed1('0x2'));module[_0x7ed1('0x3')]=function(_0x1c90be){var _0x149413=_0x1c90be['models'];function _0x29adfd(_0x545306,_0x47fc8f){return new Promise(function(_0x5c8309,_0x1b77a4){if(!_0x47fc8f)return _0x5c8309(null);var _0x1dcde7=_0x47fc8f[_0x7ed1('0x4')]?{[_0x47fc8f['filter'][_0x7ed1('0x5')]]:_0x47fc8f[_0x7ed1('0x4')][_0x7ed1('0x6')]}:undefined;return _0x149413[_0x545306]['findAll']({'where':_0x1dcde7,'raw':!![]})[_0x7ed1('0x7')](function(_0x477d93){_0x47fc8f[_0x7ed1('0x8')]=_['map'](_0x477d93,'id');_0x5c8309(_0x47fc8f);})[_0x7ed1('0x9')](function(_0x1ff213){_0x1b77a4(_0x1ff213);});});}function _0x2fca6f(_0x574176,_0x1036c0){return new Promise(function(_0x2c0f01,_0x3b0222){var _0x476129=_0x574176[_0x7ed1('0x4')]?{[_0x574176['filter'][_0x7ed1('0x5')]]:_0x574176['filter']['value']}:undefined;return _0x149413[_0x574176['model']][_0x7ed1('0xa')]({'where':_0x476129,'raw':!![]})[_0x7ed1('0x7')](function(_0x93b0cf){_0x1036c0[_0x7ed1('0x8')]=_['map'](_0x93b0cf,function(_0x21ee51){return _0x21ee51[_0x7ed1('0xb')];});_0x2c0f01(_0x1036c0);})[_0x7ed1('0x9')](function(_0x13641b){_0x3b0222(_0x13641b);});});}function _0x16f09d(_0x5e867b,_0x38dd17,_0x59ca4){if(!_0x38dd17)return Promise['resolve'](null);return new Promise(function(_0x3ddadb,_0x3e898f){return _0x149413[_0x7ed1('0xc')][_0x7ed1('0xa')]({'where':{'sectionId':_0x38dd17['id']},'raw':!![]})['then'](function(_0x58056a){if(_0x5e867b[_0x7ed1('0x5')]&&_0x5e867b['field']!=='id'){_0x38dd17[_0x7ed1('0x8')]=_['map'](_0x58056a,function(_0x103bd7){return _0x103bd7[_0x5e867b[_0x7ed1('0x5')]];});}else{if(_0x59ca4==='AnalyticExtractedReport'){_0x38dd17[_0x7ed1('0x8')]=_[_0x7ed1('0xd')](_0x58056a,function(_0x590807){return{'id':_0x590807[_0x7ed1('0xe')],'type':_0x590807[_0x7ed1('0xf')]};});}else{_0x38dd17[_0x7ed1('0x8')]=_[_0x7ed1('0xd')](_0x58056a,function(_0x2de566){return _0x2de566[_0x7ed1('0xe')];});}}_0x3ddadb(_0x38dd17);})[_0x7ed1('0x9')](function(_0x50d65a){_0x3e898f(_0x50d65a);});});}function _0x1b1b4d(_0x2cb8fe,_0x20eb9f){var _0x2d5e9a={'parentSections':[]};switch(_0x2cb8fe['toLowerCase']()){case _0x7ed1('0x10'):_0x2d5e9a['childModel']=_0x7ed1('0x11');break;case _0x7ed1('0x12'):_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x14');break;case'squarerecordings':_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x15');_0x2d5e9a[_0x7ed1('0x16')]=[{'name':_0x7ed1('0x17'),'field':'name','foreignKey':'projectName'}];break;case _0x7ed1('0x18'):_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x19');break;case'contacts':_0x2d5e9a[_0x7ed1('0x13')]='CmContact';_0x2d5e9a[_0x7ed1('0x16')]=[{'name':_0x7ed1('0x1a'),'field':'id','foreignKey':_0x7ed1('0x1b')}];break;case _0x7ed1('0x1c'):_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x1d');break;case _0x7ed1('0x1e'):_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x1f');break;case _0x7ed1('0x20'):_0x2d5e9a['childModel']=_0x7ed1('0x21');break;case _0x7ed1('0x22'):_0x2d5e9a[_0x7ed1('0x13')]='ChatQueue';break;case _0x7ed1('0x23'):_0x2d5e9a['childModel']='ChatWebsite';break;case'faxqueues':_0x2d5e9a['childModel']=_0x7ed1('0x24');break;case _0x7ed1('0x25'):_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x26');break;case _0x7ed1('0x27'):case _0x7ed1('0x28'):case _0x7ed1('0x29'):_0x2d5e9a[_0x7ed1('0x13')]='VoiceExtension';break;case _0x7ed1('0x2a'):_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x2b');break;case'voicemails':_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x2c');break;case _0x7ed1('0x2d'):_0x2d5e9a['childModel']='VoiceRecording';_0x2d5e9a[_0x7ed1('0x16')]=[{'name':'Agents','field':'name','foreignKey':_0x7ed1('0x2e'),'model':_0x7ed1('0x2f'),'filter':{'field':_0x7ed1('0x30'),'value':[_0x7ed1('0x31')]}},{'name':_0x7ed1('0x32'),'field':_0x7ed1('0xb'),'foreignKey':_0x7ed1('0x2e'),'model':_0x7ed1('0x2f'),'filter':{'field':'role','value':['telephone']}},{'name':_0x7ed1('0x33'),'field':_0x7ed1('0xb'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0x7ed1('0xf'),'value':[_0x7ed1('0x34')]}},{'name':_0x7ed1('0x35'),'field':_0x7ed1('0xb'),'foreignKey':'queue','model':_0x7ed1('0x36'),'filter':{'field':'type','value':[_0x7ed1('0x37')]}}];break;case _0x7ed1('0x38'):_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x39');break;case _0x7ed1('0x3a'):_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x3b');break;case _0x7ed1('0x3c'):_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x3d');break;case _0x7ed1('0x3e'):_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x3f');break;case'mailqueues':_0x2d5e9a['childModel']=_0x7ed1('0x40');break;case _0x7ed1('0x41'):_0x2d5e9a[_0x7ed1('0x13')]='MailAccount';break;case _0x7ed1('0x42'):_0x2d5e9a['childModel']=_0x7ed1('0x43');break;case _0x7ed1('0x44'):_0x2d5e9a['childModel']=_0x7ed1('0x45');break;case'openchannelaccounts':_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x46');break;case'smsqueues':_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x47');break;case _0x7ed1('0x48'):_0x2d5e9a[_0x7ed1('0x13')]='SmsAccount';break;case _0x7ed1('0x49'):_0x2d5e9a['childModel']=_0x7ed1('0x4a');break;case _0x7ed1('0x4b'):_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x4c');break;case _0x7ed1('0x4d'):_0x2d5e9a['childModel']=_0x7ed1('0x4e');break;case'voicequeues':case _0x7ed1('0x4f'):_0x2d5e9a[_0x7ed1('0x13')]='VoiceQueue';if(_0x20eb9f){_0x2d5e9a[_0x7ed1('0x16')]=[{'name':'VoiceQueues'},{'name':_0x7ed1('0x35')}];}break;case _0x7ed1('0x50'):case'agents':case _0x7ed1('0x51'):_0x2d5e9a[_0x7ed1('0x13')]='User';if(_0x20eb9f){_0x2d5e9a[_0x7ed1('0x16')]=[{'name':_0x7ed1('0x52'),'filter':{'field':_0x7ed1('0x30'),'value':['admin','user']},'ignore':!![]},{'name':'Agents'},{'name':_0x7ed1('0x32')}];}break;case _0x7ed1('0x53'):_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x54');break;case _0x7ed1('0x55'):_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x56');break;case'freshdeskaccounts':_0x2d5e9a[_0x7ed1('0x13')]='FreshdeskAccount';break;case _0x7ed1('0x57'):_0x2d5e9a['childModel']=_0x7ed1('0x58');break;case _0x7ed1('0x59'):_0x2d5e9a['childModel']=_0x7ed1('0x5a');break;case'zohoaccounts':_0x2d5e9a[_0x7ed1('0x13')]='ZohoAccount';break;case'vtigeraccounts':_0x2d5e9a['childModel']=_0x7ed1('0x2f');break;case'cannedanswers':_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x5b');break;case'dispositions':_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x5c');break;case'customdashboards':_0x2d5e9a[_0x7ed1('0x13')]='Dashboard';break;case _0x7ed1('0x5d'):_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x5e');break;case _0x7ed1('0x5f'):_0x2d5e9a['childModel']=_0x7ed1('0x60');break;case _0x7ed1('0x61'):_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x62');break;case'sounds':_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x63');break;case _0x7ed1('0x64'):_0x2d5e9a['childModel']='Tag';break;case'templates':_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x65');break;case _0x7ed1('0x66'):_0x2d5e9a['childModel']=_0x7ed1('0x67');break;case _0x7ed1('0x68'):_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x69');break;case'variables':_0x2d5e9a['childModel']=_0x7ed1('0x6a');break;case _0x7ed1('0x6b'):_0x2d5e9a[_0x7ed1('0x13')]='Plugin';break;case _0x7ed1('0x6c'):_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x6d');_0x2d5e9a[_0x7ed1('0x16')]=[{'name':_0x7ed1('0x6e'),'field':'id','foreignKey':_0x7ed1('0x6f')}];break;case'metrics':_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x70');break;}return _0x2d5e9a;}function _0x5f2ae3(_0x284639,_0xf91833){var _0x5d5b65=_0x284639['charAt'](0x0)[_0x7ed1('0x71')]()+_0x284639['slice'](0x1);var _0x1deae6={'type':_0x149413['Sequelize'][_0x7ed1('0x72')]['SELECT'],'raw':!![]};return new Promise(function(_0x4ac306,_0x39ee6c){var _0x3ee4f8=squel[_0x7ed1('0x73')]()[_0x7ed1('0x5')](_0x7ed1('0x74')+_0x5d5b65+_0x7ed1('0x75'),'id')[_0x7ed1('0x5')](_0x7ed1('0x76'))[_0x7ed1('0x77')](_0x7ed1('0x78')+_0x284639+_0x7ed1('0x79'),'ui')[_0x7ed1('0x7a')](_0x7ed1('0x7b'),_0xf91833['id']);return _0x149413[_0x7ed1('0x7c')][_0x7ed1('0x7d')](_0x3ee4f8[_0x7ed1('0x7e')](),_0x1deae6)['then'](function(_0x270c87){_0xf91833[_0x5d5b65+_0x7ed1('0x7f')]=_0x270c87;_0x4ac306(_0x270c87);})['catch'](function(_0x2d8c34){_0x39ee6c(_0x2d8c34);});});}return _0x1c90be[_0x7ed1('0x80')](_0x7ed1('0x81'),attributes,{'tableName':_0x7ed1('0x82'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x4a02bb){var _0x3fc1ec={'raw':_0x4a02bb[_0x7ed1('0x7d')][_0x7ed1('0x83')],'where':{}};var _0x3456c3={};var _0x123f61={'count':0x0,'rows':[]};var _0x3d0d56=_0x4a02bb['query']['section'];var _0x5a7179=_0x4a02bb[_0x7ed1('0x7d')]['mergeResources']||![];var _0x5a06fe=_0x1b1b4d(_0x3d0d56,_0x5a7179);if(!_0x5a06fe[_0x7ed1('0x13')])throw new Error(_0x7ed1('0x84')+_0x3d0d56+'\x27');var _0x3142fc=[{'name':_0x3d0d56}];if(!_[_0x7ed1('0x85')](_0x5a06fe[_0x7ed1('0x16')]))_0x3142fc=_0x5a06fe[_0x7ed1('0x16')];var _0x1dc101=[];for(var _0x3e71d9=0x0;_0x3e71d9<_0x3142fc['length'];_0x3e71d9++){_0x1dc101[_0x7ed1('0x86')](_0x149413[_0x7ed1('0x87')][_0x7ed1('0x88')]({'where':{'userProfileId':_0x4a02bb[_0x7ed1('0x89')]['id'],'name':_0x3142fc[_0x3e71d9][_0x7ed1('0xb')]},'raw':!![]}));}return Promise['all'](_0x1dc101)[_0x7ed1('0x7')](function(_0x17121c){var _0x1e5f8c=_['filter'](_0x17121c,function(_0x40b6fe){return _0x40b6fe?_0x40b6fe:undefined;});var _0x31c42c=_['filter'](_0x3142fc,['ignore',!![]]);var _0x28bf05=_[_0x7ed1('0x85')](_0x1e5f8c)&&_[_0x7ed1('0x85')](_0x31c42c)?null:_[_0x7ed1('0x8a')](_0x31c42c,_0x1e5f8c);if(!_0x28bf05)return null;var _0xe9084c=[];for(var _0xb8e96b=0x0;_0xb8e96b<_0x28bf05['length'];_0xb8e96b++){var _0x11532e=_[_0x7ed1('0x88')](_0x3142fc,function(_0x5848dc){return _0x28bf05[_0xb8e96b]?_0x5848dc[_0x7ed1('0xb')]===_0x28bf05[_0xb8e96b]['name']:null;});if(_0x11532e){if(_0x28bf05[_0xb8e96b][_0x7ed1('0x8b')]){_0xe9084c[_0x7ed1('0x86')](_0x29adfd(_0x5a06fe[_0x7ed1('0x13')],_0x28bf05[_0xb8e96b]));}else{if(!_0x28bf05[_0xb8e96b][_0x7ed1('0x8c')]){_0xe9084c[_0x7ed1('0x86')](_0x16f09d(_0x11532e,_0x28bf05[_0xb8e96b],_0x5a06fe[_0x7ed1('0x13')]));}else{if(_0x11532e['model']){_0xe9084c[_0x7ed1('0x86')](_0x2fca6f(_0x11532e,_0x28bf05[_0xb8e96b]));}}}}}return Promise[_0x7ed1('0x8d')](_0xe9084c);})[_0x7ed1('0x7')](function(_0x472769){var _0x569c02=_0x472769;var _0x59fe87=null;if(_0x569c02){_0x59fe87=_0x569c02[_0x7ed1('0x8e')]===0x1?_0x569c02[0x0]:null;}if(!_0x59fe87&&!_0x569c02)return _0x123f61;var _0x6f4d10=_0x149413[_0x5a06fe[_0x7ed1('0x13')]][_0x7ed1('0x8f')];_0x3456c3['model']=_['keys'](_0x6f4d10);_0x3456c3[_0x7ed1('0x7d')]=_[_0x7ed1('0x90')](_0x4a02bb[_0x7ed1('0x7d')]);_0x3456c3[_0x7ed1('0x91')]=_['intersection'](_0x3456c3[_0x7ed1('0x92')],_0x3456c3[_0x7ed1('0x7d')]);_0x3fc1ec[_0x7ed1('0x93')]=_[_0x7ed1('0x94')](_0x3456c3[_0x7ed1('0x92')],qs[_0x7ed1('0x95')](_0x4a02bb['query'][_0x7ed1('0x95')]));_0x3fc1ec['attributes']=_0x3fc1ec['attributes'][_0x7ed1('0x8e')]?_0x3fc1ec[_0x7ed1('0x93')]:_0x3456c3[_0x7ed1('0x92')];if(!_0x4a02bb[_0x7ed1('0x7d')][_0x7ed1('0x96')]('nolimit')){_0x3fc1ec['limit']=qs[_0x7ed1('0x97')](_0x4a02bb['query']['limit']);_0x3fc1ec[_0x7ed1('0x98')]=qs[_0x7ed1('0x98')](_0x4a02bb[_0x7ed1('0x7d')][_0x7ed1('0x98')]);}_0x3fc1ec[_0x7ed1('0x99')]=qs[_0x7ed1('0x9a')](_0x4a02bb[_0x7ed1('0x7d')][_0x7ed1('0x9a')]);_0x3fc1ec[_0x7ed1('0x7a')]=qs[_0x7ed1('0x91')](_[_0x7ed1('0x9b')](_0x4a02bb[_0x7ed1('0x7d')],_0x3456c3[_0x7ed1('0x91')]));if(_0x4a02bb[_0x7ed1('0x7d')]['filter']){_0x3fc1ec[_0x7ed1('0x7a')]=_['merge'](_0x3fc1ec[_0x7ed1('0x7a')],{'$or':_[_0x7ed1('0xd')](_0x6f4d10,function(_0x3ef102){if(_0x3ef102['type'][_0x7ed1('0x9c')]!==_0x7ed1('0x9d')){var _0x5fa39f={};_0x5fa39f[_0x3ef102[_0x7ed1('0x5')]]={'$like':'%'+_0x4a02bb[_0x7ed1('0x7d')][_0x7ed1('0x4')]+'%'};return _0x5fa39f;}})});}var _0x51285a=[];var _0x71b272=null;var _0x115f9f={};if(_0x59fe87){_0x71b272=_[_0x7ed1('0x88')](_0x3142fc,[_0x7ed1('0xb'),_0x59fe87[_0x7ed1('0xb')]]);if(_0x71b272[_0x7ed1('0x5')]){_0x115f9f={};if(_0x5a06fe['childModel']==='AnalyticExtractedReport'){_0x115f9f[_0x71b272[_0x7ed1('0x9e')]]=_[_0x7ed1('0xd')](_0x59fe87['associatedResources'],'id');}else{_0x115f9f[_0x71b272[_0x7ed1('0x9e')]]=_0x59fe87['associatedResources'];}_0x51285a['push'](_0x115f9f);}else{_0x3fc1ec[_0x7ed1('0x7a')]['id']=_0x59fe87['associatedResources'];}}else{for(var _0x5bb988=0x0;_0x5bb988<_0x569c02[_0x7ed1('0x8e')];_0x5bb988++){_0x71b272=_[_0x7ed1('0x88')](_0x3142fc,[_0x7ed1('0xb'),_0x569c02[_0x5bb988][_0x7ed1('0xb')]]);if(_0x71b272[_0x7ed1('0x5')]){_0x115f9f={};_0x115f9f[_0x71b272['foreignKey']]=_0x569c02[_0x5bb988][_0x7ed1('0x8')];_0x51285a[_0x7ed1('0x86')](_0x115f9f);}else{if(!_0x3fc1ec[_0x7ed1('0x7a')]['id'])_0x3fc1ec[_0x7ed1('0x7a')]['id']=[];_0x569c02[_0x5bb988]['associatedResources'][_0x7ed1('0x9f')](function(_0x2858bc){_0x3fc1ec[_0x7ed1('0x7a')]['id']['push'](_0x2858bc);});}}}if(!_[_0x7ed1('0x85')](_0x51285a)){_0x3fc1ec[_0x7ed1('0x7a')]=_['merge'](_0x3fc1ec[_0x7ed1('0x7a')],{'$and':{'$or':_0x51285a}});}_0x3fc1ec=_[_0x7ed1('0xa0')]({},_0x3fc1ec,_0x4a02bb[_0x7ed1('0xa1')]);if(_0x59fe87&&!_0x59fe87[_0x7ed1('0x8c')]&&_0x5a06fe[_0x7ed1('0x13')]===_0x7ed1('0x6d')){if(_0x4a02bb[_0x7ed1('0x7d')][_0x7ed1('0xa2')]){_0x3fc1ec['include']=[{'all':!![]}];}return _0x149413[_0x5a06fe['childModel']][_0x7ed1('0xa')](_0x3fc1ec)[_0x7ed1('0x7')](function(_0x3ca5a4){var _0x321afb=[];_0x3ca5a4[_0x7ed1('0x9f')](function(_0x26cde2){var _0x18152f;switch(_0x26cde2[_0x7ed1('0xa3')]){case _0x7ed1('0xa4'):_0x18152f=_[_0x7ed1('0x88')](_0x59fe87[_0x7ed1('0x8')],function(_0x2c7665){return _0x2c7665['id']===_0x26cde2[_0x7ed1('0x6f')]&&_0x2c7665[_0x7ed1('0xf')]===_0x7ed1('0xa5');});break;case _0x7ed1('0xa6'):_0x18152f=_[_0x7ed1('0x88')](_0x59fe87[_0x7ed1('0x8')],function(_0x4368de){return _0x4368de['id']===_0x26cde2['reportId']&&_0x4368de['type']==='CustomReports';});break;}if(_0x18152f)_0x321afb[_0x7ed1('0x86')](_0x26cde2);});_0x123f61[_0x7ed1('0xa7')]=_0x321afb[_0x7ed1('0x8e')];_0x123f61[_0x7ed1('0xa8')]=_0x321afb;return _0x123f61;});}else{return _0x149413[_0x5a06fe[_0x7ed1('0x13')]][_0x7ed1('0xa7')]({'where':_0x3fc1ec[_0x7ed1('0x7a')]})[_0x7ed1('0x7')](function(_0x390c12){_0x123f61['count']=_0x390c12;if(_0x4a02bb[_0x7ed1('0x7d')][_0x7ed1('0xa2')]){if(_0x5a06fe[_0x7ed1('0x13')]==='CmContact'){_0x3fc1ec[_0x7ed1('0xa9')]=[{'model':_0x149413[_0x7ed1('0xaa')],'as':_0x7ed1('0xab'),'attributes':['id',_0x7ed1('0xb'),'color'],'required':_0x4a02bb[_0x7ed1('0x7d')][_0x7ed1('0xac')]?!![]:![]},{'model':_0x149413[_0x7ed1('0xaa')],'as':_0x7ed1('0xad'),'attributes':['id','name','color'],'through':_0x4a02bb[_0x7ed1('0x7d')][_0x7ed1('0xac')]?{'attributes':[],'where':{'TagId':_0x4a02bb['query'][_0x7ed1('0xac')]||undefined}}:{},'required':_0x4a02bb[_0x7ed1('0x7d')]['tag']?!![]:![]}];}else{_0x3fc1ec[_0x7ed1('0xa9')]=[{'all':!![]}];}}return _0x149413[_0x5a06fe[_0x7ed1('0x13')]][_0x7ed1('0xa')](_0x3fc1ec);})[_0x7ed1('0x7')](function(_0x444bf9){_0x123f61[_0x7ed1('0xa8')]=_0x444bf9;if(_0x3d0d56===_0x7ed1('0xae')&&_0x4a02bb[_0x7ed1('0x7d')][_0x7ed1('0xaf')]===_0x7ed1('0xb0')){var _0x589ce4=[];for(var _0x35efdd=0x0;_0x35efdd<_0x123f61['rows'][_0x7ed1('0x8e')];_0x35efdd++){_0x589ce4[_0x7ed1('0x86')](_0x5f2ae3(_0x7ed1('0xb1'),_0x123f61[_0x7ed1('0xa8')][_0x35efdd]['dataValues']));_0x589ce4[_0x7ed1('0x86')](_0x5f2ae3(_0x7ed1('0xb2'),_0x123f61[_0x7ed1('0xa8')][_0x35efdd]['dataValues']));_0x589ce4[_0x7ed1('0x86')](_0x5f2ae3(_0x7ed1('0xb3'),_0x123f61[_0x7ed1('0xa8')][_0x35efdd][_0x7ed1('0xb4')]));_0x589ce4['push'](_0x5f2ae3(_0x7ed1('0xb5'),_0x123f61[_0x7ed1('0xa8')][_0x35efdd][_0x7ed1('0xb4')]));_0x589ce4[_0x7ed1('0x86')](_0x5f2ae3(_0x7ed1('0xb6'),_0x123f61[_0x7ed1('0xa8')][_0x35efdd][_0x7ed1('0xb4')]));_0x589ce4['push'](_0x5f2ae3(_0x7ed1('0xb7'),_0x123f61[_0x7ed1('0xa8')][_0x35efdd][_0x7ed1('0xb4')]));}return Promise[_0x7ed1('0x8d')](_0x589ce4)[_0x7ed1('0x7')](function(){return _0x123f61;});}return _0x123f61;});}});}}});}; \ No newline at end of file +var _0xc582=['voiceprefixes','ivrcampaigns','Campaign','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','queuecampaigns','VoiceQueues','users','agents','telephones','admin','user','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','scheduler','Schedule','sounds','Sound','tags','templates','Template','triggers','Trigger','trunks','variables','Variable','Plugin','extractedreports','AnalyticExtractedReport','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','Sequelize','SELECT','select','ui.','ui.createdAt','_interactions','where','ui.UserId\x20=\x20?','toString','OpenTabs','define','UserProfile','query','raw','section','Invalid\x20section\x20\x27','isEmpty','UserProfileSection','all','ignore','union','length','autoAssociation','push','filters','model','fields','attributes','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','find','foreignKey','forEach','includeAll','reportType','default','DefaultReports','custom','count','CmContact','include','Tag','Tags','color','tag','rows','openTabs','true','sms','dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','findAll','then','associatedResources','map','catch','value','name','UserProfileResource','type','resourceId','toLowerCase','squareprojects','SquareProject','odbc','childModel','SquareOdbc','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','Lists','lists','CmList','companies','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','faxaccounts','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','User','role','agent','Telephones','membername','queue','VoiceQueue','inbound','QueueCampaigns','outbound'];(function(_0x1773f7,_0x54318f){var _0x1983fb=function(_0x50b543){while(--_0x50b543){_0x1773f7['push'](_0x1773f7['shift']());}};_0x1983fb(++_0x54318f);}(_0xc582,0x81));var _0x2c58=function(_0x1fcaf1,_0x21c3c2){_0x1fcaf1=_0x1fcaf1-0x0;var _0x55f464=_0xc582[_0x1fcaf1];return _0x55f464;};'use strict';var _=require(_0x2c58('0x0'));var attributes=require(_0x2c58('0x1'));var qs=require(_0x2c58('0x2'));var squel=require(_0x2c58('0x3'));module[_0x2c58('0x4')]=function(_0x158ed8){var _0x388ff2=_0x158ed8[_0x2c58('0x5')];function _0xec4386(_0x173b1d,_0x16da88){return new Promise(function(_0x2d04c0,_0x50f5ec){if(!_0x16da88)return _0x2d04c0(null);var _0x4ab428=_0x16da88[_0x2c58('0x6')]?{[_0x16da88['filter'][_0x2c58('0x7')]]:_0x16da88[_0x2c58('0x6')]['value']}:undefined;return _0x388ff2[_0x173b1d][_0x2c58('0x8')]({'where':_0x4ab428,'raw':!![]})[_0x2c58('0x9')](function(_0x29ea21){_0x16da88[_0x2c58('0xa')]=_[_0x2c58('0xb')](_0x29ea21,'id');_0x2d04c0(_0x16da88);})[_0x2c58('0xc')](function(_0x1c31db){_0x50f5ec(_0x1c31db);});});}function _0x1b4f4f(_0x1bb360,_0x166670){return new Promise(function(_0x23933b,_0x16d99f){var _0x410da7=_0x1bb360[_0x2c58('0x6')]?{[_0x1bb360[_0x2c58('0x6')][_0x2c58('0x7')]]:_0x1bb360[_0x2c58('0x6')][_0x2c58('0xd')]}:undefined;return _0x388ff2[_0x1bb360['model']]['findAll']({'where':_0x410da7,'raw':!![]})[_0x2c58('0x9')](function(_0x2eaead){_0x166670['associatedResources']=_[_0x2c58('0xb')](_0x2eaead,function(_0x7677d){return _0x7677d[_0x2c58('0xe')];});_0x23933b(_0x166670);})['catch'](function(_0x107c42){_0x16d99f(_0x107c42);});});}function _0xd82a4(_0x535ca7,_0x371a8b,_0x58321b){if(!_0x371a8b)return Promise['resolve'](null);return new Promise(function(_0x157e5f,_0x17e181){return _0x388ff2[_0x2c58('0xf')][_0x2c58('0x8')]({'where':{'sectionId':_0x371a8b['id']},'raw':!![]})[_0x2c58('0x9')](function(_0x56f538){if(_0x535ca7[_0x2c58('0x7')]&&_0x535ca7['field']!=='id'){_0x371a8b[_0x2c58('0xa')]=_[_0x2c58('0xb')](_0x56f538,function(_0x49cef7){return _0x49cef7[_0x535ca7[_0x2c58('0x7')]];});}else{if(_0x58321b==='AnalyticExtractedReport'){_0x371a8b[_0x2c58('0xa')]=_[_0x2c58('0xb')](_0x56f538,function(_0x4dd741){return{'id':_0x4dd741['resourceId'],'type':_0x4dd741[_0x2c58('0x10')]};});}else{_0x371a8b[_0x2c58('0xa')]=_[_0x2c58('0xb')](_0x56f538,function(_0x305a27){return _0x305a27[_0x2c58('0x11')];});}}_0x157e5f(_0x371a8b);})['catch'](function(_0x188d95){_0x17e181(_0x188d95);});});}function _0x4d11b0(_0x3528e2,_0x25004d){var _0x2977a7={'parentSections':[]};switch(_0x3528e2[_0x2c58('0x12')]()){case _0x2c58('0x13'):_0x2977a7['childModel']=_0x2c58('0x14');break;case _0x2c58('0x15'):_0x2977a7[_0x2c58('0x16')]=_0x2c58('0x17');break;case'squarerecordings':_0x2977a7[_0x2c58('0x16')]=_0x2c58('0x18');_0x2977a7[_0x2c58('0x19')]=[{'name':_0x2c58('0x1a'),'field':_0x2c58('0xe'),'foreignKey':_0x2c58('0x1b')}];break;case _0x2c58('0x1c'):_0x2977a7[_0x2c58('0x16')]=_0x2c58('0x1d');break;case _0x2c58('0x1e'):_0x2977a7[_0x2c58('0x16')]='CmContact';_0x2977a7[_0x2c58('0x19')]=[{'name':_0x2c58('0x1f'),'field':'id','foreignKey':'ListId'}];break;case _0x2c58('0x20'):_0x2977a7['childModel']=_0x2c58('0x21');break;case _0x2c58('0x22'):_0x2977a7[_0x2c58('0x16')]='CmCompany';break;case _0x2c58('0x23'):_0x2977a7[_0x2c58('0x16')]=_0x2c58('0x24');break;case _0x2c58('0x25'):_0x2977a7[_0x2c58('0x16')]=_0x2c58('0x26');break;case'chatwebsites':_0x2977a7[_0x2c58('0x16')]=_0x2c58('0x27');break;case _0x2c58('0x28'):_0x2977a7[_0x2c58('0x16')]=_0x2c58('0x29');break;case _0x2c58('0x2a'):_0x2977a7['childModel']='FaxAccount';break;case _0x2c58('0x2b'):case _0x2c58('0x2c'):case _0x2c58('0x2d'):_0x2977a7[_0x2c58('0x16')]=_0x2c58('0x2e');break;case _0x2c58('0x2f'):_0x2977a7[_0x2c58('0x16')]=_0x2c58('0x30');break;case _0x2c58('0x31'):_0x2977a7[_0x2c58('0x16')]=_0x2c58('0x32');break;case _0x2c58('0x33'):_0x2977a7[_0x2c58('0x16')]=_0x2c58('0x34');_0x2977a7[_0x2c58('0x19')]=[{'name':_0x2c58('0x35'),'field':'name','foreignKey':'membername','model':_0x2c58('0x36'),'filter':{'field':_0x2c58('0x37'),'value':[_0x2c58('0x38')]}},{'name':_0x2c58('0x39'),'field':_0x2c58('0xe'),'foreignKey':_0x2c58('0x3a'),'model':'User','filter':{'field':_0x2c58('0x37'),'value':['telephone']}},{'name':'VoiceQueues','field':'name','foreignKey':_0x2c58('0x3b'),'model':_0x2c58('0x3c'),'filter':{'field':_0x2c58('0x10'),'value':[_0x2c58('0x3d')]}},{'name':_0x2c58('0x3e'),'field':_0x2c58('0xe'),'foreignKey':'queue','model':_0x2c58('0x3c'),'filter':{'field':_0x2c58('0x10'),'value':[_0x2c58('0x3f')]}}];break;case'musiconholds':_0x2977a7[_0x2c58('0x16')]='VoiceMusicOnHold';break;case'chanspies':_0x2977a7[_0x2c58('0x16')]='VoiceChanSpy';break;case _0x2c58('0x40'):_0x2977a7[_0x2c58('0x16')]='VoicePrefix';break;case _0x2c58('0x41'):_0x2977a7[_0x2c58('0x16')]=_0x2c58('0x42');break;case'mailqueues':_0x2977a7['childModel']=_0x2c58('0x43');break;case _0x2c58('0x44'):_0x2977a7[_0x2c58('0x16')]='MailAccount';break;case _0x2c58('0x45'):_0x2977a7['childModel']=_0x2c58('0x46');break;case'openchannelqueues':_0x2977a7[_0x2c58('0x16')]=_0x2c58('0x47');break;case _0x2c58('0x48'):_0x2977a7[_0x2c58('0x16')]=_0x2c58('0x49');break;case _0x2c58('0x4a'):_0x2977a7[_0x2c58('0x16')]=_0x2c58('0x4b');break;case _0x2c58('0x4c'):_0x2977a7['childModel']=_0x2c58('0x4d');break;case'whatsappqueues':_0x2977a7[_0x2c58('0x16')]=_0x2c58('0x4e');break;case _0x2c58('0x4f'):_0x2977a7[_0x2c58('0x16')]=_0x2c58('0x50');break;case _0x2c58('0x51'):_0x2977a7[_0x2c58('0x16')]=_0x2c58('0x52');break;case'voicequeues':case _0x2c58('0x53'):_0x2977a7['childModel']=_0x2c58('0x3c');if(_0x25004d){_0x2977a7[_0x2c58('0x19')]=[{'name':_0x2c58('0x54')},{'name':'QueueCampaigns'}];}break;case _0x2c58('0x55'):case _0x2c58('0x56'):case _0x2c58('0x57'):_0x2977a7[_0x2c58('0x16')]='User';if(_0x25004d){_0x2977a7[_0x2c58('0x19')]=[{'name':'Users','filter':{'field':_0x2c58('0x37'),'value':[_0x2c58('0x58'),_0x2c58('0x59')]},'ignore':!![]},{'name':_0x2c58('0x35')},{'name':_0x2c58('0x39')}];}break;case _0x2c58('0x5a'):_0x2977a7[_0x2c58('0x16')]=_0x2c58('0x5b');break;case'salesforceaccounts':_0x2977a7[_0x2c58('0x16')]=_0x2c58('0x5c');break;case _0x2c58('0x5d'):_0x2977a7[_0x2c58('0x16')]=_0x2c58('0x5e');break;case _0x2c58('0x5f'):_0x2977a7['childModel']=_0x2c58('0x60');break;case _0x2c58('0x61'):_0x2977a7['childModel']=_0x2c58('0x62');break;case _0x2c58('0x63'):_0x2977a7[_0x2c58('0x16')]=_0x2c58('0x64');break;case _0x2c58('0x65'):_0x2977a7['childModel']='User';break;case _0x2c58('0x66'):_0x2977a7[_0x2c58('0x16')]=_0x2c58('0x67');break;case _0x2c58('0x68'):_0x2977a7[_0x2c58('0x16')]=_0x2c58('0x69');break;case _0x2c58('0x6a'):_0x2977a7[_0x2c58('0x16')]=_0x2c58('0x6b');break;case _0x2c58('0x6c'):_0x2977a7[_0x2c58('0x16')]=_0x2c58('0x6d');break;case _0x2c58('0x6e'):_0x2977a7[_0x2c58('0x16')]='Pause';break;case _0x2c58('0x6f'):_0x2977a7['childModel']=_0x2c58('0x70');break;case _0x2c58('0x71'):_0x2977a7['childModel']=_0x2c58('0x72');break;case _0x2c58('0x73'):_0x2977a7[_0x2c58('0x16')]='Tag';break;case _0x2c58('0x74'):_0x2977a7[_0x2c58('0x16')]=_0x2c58('0x75');break;case _0x2c58('0x76'):_0x2977a7[_0x2c58('0x16')]=_0x2c58('0x77');break;case _0x2c58('0x78'):_0x2977a7[_0x2c58('0x16')]='Trunk';break;case _0x2c58('0x79'):_0x2977a7[_0x2c58('0x16')]=_0x2c58('0x7a');break;case'plugins':_0x2977a7[_0x2c58('0x16')]=_0x2c58('0x7b');break;case _0x2c58('0x7c'):_0x2977a7[_0x2c58('0x16')]=_0x2c58('0x7d');_0x2977a7['parentSections']=[{'name':_0x2c58('0x7e'),'field':'id','foreignKey':_0x2c58('0x7f')}];break;case _0x2c58('0x80'):_0x2977a7[_0x2c58('0x16')]=_0x2c58('0x81');break;}return _0x2977a7;}function _0x18ad80(_0x5ec4c1,_0x4783d1){var _0x430906=_0x5ec4c1[_0x2c58('0x82')](0x0)[_0x2c58('0x83')]()+_0x5ec4c1['slice'](0x1);var _0x5e09d9={'type':_0x388ff2[_0x2c58('0x84')]['QueryTypes'][_0x2c58('0x85')],'raw':!![]};return new Promise(function(_0x1a1390,_0x131c64){var _0x1b325b=squel[_0x2c58('0x86')]()[_0x2c58('0x7')](_0x2c58('0x87')+_0x430906+'InteractionId','id')[_0x2c58('0x7')](_0x2c58('0x88'))['from']('user_has_'+_0x5ec4c1+_0x2c58('0x89'),'ui')[_0x2c58('0x8a')](_0x2c58('0x8b'),_0x4783d1['id']);return _0x388ff2['sequelize']['query'](_0x1b325b[_0x2c58('0x8c')](),_0x5e09d9)[_0x2c58('0x9')](function(_0x3d3d50){_0x4783d1[_0x430906+_0x2c58('0x8d')]=_0x3d3d50;_0x1a1390(_0x3d3d50);})['catch'](function(_0x35ca0e){_0x131c64(_0x35ca0e);});});}return _0x158ed8[_0x2c58('0x8e')](_0x2c58('0x8f'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x33ae28){var _0x3c468d={'raw':_0x33ae28[_0x2c58('0x90')][_0x2c58('0x91')],'where':{}};var _0x39ed0e={};var _0x3aa777={'count':0x0,'rows':[]};var _0x5f3153=_0x33ae28['query'][_0x2c58('0x92')];var _0xb883a1=_0x33ae28[_0x2c58('0x90')]['mergeResources']||![];var _0x1e7b58=_0x4d11b0(_0x5f3153,_0xb883a1);if(!_0x1e7b58['childModel'])throw new Error(_0x2c58('0x93')+_0x5f3153+'\x27');var _0x56d75f=[{'name':_0x5f3153}];if(!_[_0x2c58('0x94')](_0x1e7b58[_0x2c58('0x19')]))_0x56d75f=_0x1e7b58[_0x2c58('0x19')];var _0x227ba2=[];for(var _0x3c4ee4=0x0;_0x3c4ee4<_0x56d75f['length'];_0x3c4ee4++){_0x227ba2['push'](_0x388ff2[_0x2c58('0x95')]['find']({'where':{'userProfileId':_0x33ae28['params']['id'],'name':_0x56d75f[_0x3c4ee4][_0x2c58('0xe')]},'raw':!![]}));}return Promise[_0x2c58('0x96')](_0x227ba2)[_0x2c58('0x9')](function(_0x1b78f3){var _0x47ccb1=_[_0x2c58('0x6')](_0x1b78f3,function(_0x8d963e){return _0x8d963e?_0x8d963e:undefined;});var _0x3d5a80=_[_0x2c58('0x6')](_0x56d75f,[_0x2c58('0x97'),!![]]);var _0x1ea8e8=_[_0x2c58('0x94')](_0x47ccb1)&&_[_0x2c58('0x94')](_0x3d5a80)?null:_[_0x2c58('0x98')](_0x3d5a80,_0x47ccb1);if(!_0x1ea8e8)return null;var _0x1e4bca=[];for(var _0x4b8781=0x0;_0x4b8781<_0x1ea8e8[_0x2c58('0x99')];_0x4b8781++){var _0x3e859d=_['find'](_0x56d75f,function(_0x54421f){return _0x1ea8e8[_0x4b8781]?_0x54421f[_0x2c58('0xe')]===_0x1ea8e8[_0x4b8781][_0x2c58('0xe')]:null;});if(_0x3e859d){if(_0x1ea8e8[_0x4b8781][_0x2c58('0x97')]){_0x1e4bca['push'](_0xec4386(_0x1e7b58[_0x2c58('0x16')],_0x1ea8e8[_0x4b8781]));}else{if(!_0x1ea8e8[_0x4b8781][_0x2c58('0x9a')]){_0x1e4bca[_0x2c58('0x9b')](_0xd82a4(_0x3e859d,_0x1ea8e8[_0x4b8781],_0x1e7b58[_0x2c58('0x16')]));}else{if(_0x3e859d['model']){_0x1e4bca['push'](_0x1b4f4f(_0x3e859d,_0x1ea8e8[_0x4b8781]));}}}}}return Promise[_0x2c58('0x96')](_0x1e4bca);})['then'](function(_0x2373e0){var _0x40ea89=_0x2373e0;var _0x439a04=null;if(_0x40ea89){_0x439a04=_0x40ea89[_0x2c58('0x99')]===0x1?_0x40ea89[0x0]:null;}if(!_0x439a04&&!_0x40ea89)return _0x3aa777;var _0x16f80b=_0x388ff2[_0x1e7b58['childModel']]['rawAttributes'];_0x39ed0e['model']=_['keys'](_0x16f80b);_0x39ed0e[_0x2c58('0x90')]=_['keys'](_0x33ae28[_0x2c58('0x90')]);_0x39ed0e[_0x2c58('0x9c')]=_['intersection'](_0x39ed0e[_0x2c58('0x9d')],_0x39ed0e[_0x2c58('0x90')]);_0x3c468d['attributes']=_['intersection'](_0x39ed0e[_0x2c58('0x9d')],qs[_0x2c58('0x9e')](_0x33ae28[_0x2c58('0x90')][_0x2c58('0x9e')]));_0x3c468d[_0x2c58('0x9f')]=_0x3c468d['attributes'][_0x2c58('0x99')]?_0x3c468d['attributes']:_0x39ed0e[_0x2c58('0x9d')];if(!_0x33ae28[_0x2c58('0x90')]['hasOwnProperty'](_0x2c58('0xa0'))){_0x3c468d[_0x2c58('0xa1')]=qs[_0x2c58('0xa1')](_0x33ae28['query'][_0x2c58('0xa1')]);_0x3c468d[_0x2c58('0xa2')]=qs[_0x2c58('0xa2')](_0x33ae28['query'][_0x2c58('0xa2')]);}_0x3c468d[_0x2c58('0xa3')]=qs[_0x2c58('0xa4')](_0x33ae28[_0x2c58('0x90')][_0x2c58('0xa4')]);_0x3c468d[_0x2c58('0x8a')]=qs[_0x2c58('0x9c')](_[_0x2c58('0xa5')](_0x33ae28['query'],_0x39ed0e[_0x2c58('0x9c')]));if(_0x33ae28[_0x2c58('0x90')][_0x2c58('0x6')]){_0x3c468d[_0x2c58('0x8a')]=_[_0x2c58('0xa6')](_0x3c468d[_0x2c58('0x8a')],{'$or':_['map'](_0x16f80b,function(_0x5b8cef){if(_0x5b8cef[_0x2c58('0x10')][_0x2c58('0xa7')]!==_0x2c58('0xa8')){var _0x3760d7={};_0x3760d7[_0x5b8cef[_0x2c58('0x7')]]={'$like':'%'+_0x33ae28[_0x2c58('0x90')][_0x2c58('0x6')]+'%'};return _0x3760d7;}})});}var _0xc18d63=[];var _0x2cc2be=null;var _0x2aaa26={};if(_0x439a04){_0x2cc2be=_[_0x2c58('0xa9')](_0x56d75f,[_0x2c58('0xe'),_0x439a04[_0x2c58('0xe')]]);if(_0x2cc2be[_0x2c58('0x7')]){_0x2aaa26={};if(_0x1e7b58[_0x2c58('0x16')]===_0x2c58('0x7d')){_0x2aaa26[_0x2cc2be[_0x2c58('0xaa')]]=_[_0x2c58('0xb')](_0x439a04['associatedResources'],'id');}else{_0x2aaa26[_0x2cc2be[_0x2c58('0xaa')]]=_0x439a04[_0x2c58('0xa')];}_0xc18d63['push'](_0x2aaa26);}else{_0x3c468d[_0x2c58('0x8a')]['id']=_0x439a04['associatedResources'];}}else{for(var _0x5edd88=0x0;_0x5edd88<_0x40ea89[_0x2c58('0x99')];_0x5edd88++){_0x2cc2be=_[_0x2c58('0xa9')](_0x56d75f,[_0x2c58('0xe'),_0x40ea89[_0x5edd88]['name']]);if(_0x2cc2be[_0x2c58('0x7')]){_0x2aaa26={};_0x2aaa26[_0x2cc2be[_0x2c58('0xaa')]]=_0x40ea89[_0x5edd88][_0x2c58('0xa')];_0xc18d63[_0x2c58('0x9b')](_0x2aaa26);}else{if(!_0x3c468d[_0x2c58('0x8a')]['id'])_0x3c468d['where']['id']=[];_0x40ea89[_0x5edd88][_0x2c58('0xa')][_0x2c58('0xab')](function(_0x2788c7){_0x3c468d['where']['id'][_0x2c58('0x9b')](_0x2788c7);});}}}if(!_['isEmpty'](_0xc18d63)){_0x3c468d[_0x2c58('0x8a')]=_['merge'](_0x3c468d['where'],{'$and':{'$or':_0xc18d63}});}_0x3c468d=_['merge']({},_0x3c468d,_0x33ae28['options']);if(_0x439a04&&!_0x439a04[_0x2c58('0x9a')]&&_0x1e7b58[_0x2c58('0x16')]===_0x2c58('0x7d')){if(_0x33ae28['query'][_0x2c58('0xac')]){_0x3c468d['include']=[{'all':!![]}];}return _0x388ff2[_0x1e7b58[_0x2c58('0x16')]][_0x2c58('0x8')](_0x3c468d)['then'](function(_0x5aa193){var _0x451edf=[];_0x5aa193[_0x2c58('0xab')](function(_0x349189){var _0x2740a6;switch(_0x349189[_0x2c58('0xad')]){case _0x2c58('0xae'):_0x2740a6=_[_0x2c58('0xa9')](_0x439a04[_0x2c58('0xa')],function(_0x3aac65){return _0x3aac65['id']===_0x349189[_0x2c58('0x7f')]&&_0x3aac65[_0x2c58('0x10')]===_0x2c58('0xaf');});break;case _0x2c58('0xb0'):_0x2740a6=_[_0x2c58('0xa9')](_0x439a04['associatedResources'],function(_0x27d27b){return _0x27d27b['id']===_0x349189[_0x2c58('0x7f')]&&_0x27d27b[_0x2c58('0x10')]==='CustomReports';});break;}if(_0x2740a6)_0x451edf[_0x2c58('0x9b')](_0x349189);});_0x3aa777['count']=_0x451edf[_0x2c58('0x99')];_0x3aa777['rows']=_0x451edf;return _0x3aa777;});}else{return _0x388ff2[_0x1e7b58[_0x2c58('0x16')]][_0x2c58('0xb1')]({'where':_0x3c468d[_0x2c58('0x8a')]})[_0x2c58('0x9')](function(_0x117846){_0x3aa777['count']=_0x117846;if(_0x33ae28[_0x2c58('0x90')][_0x2c58('0xac')]){if(_0x1e7b58['childModel']===_0x2c58('0xb2')){_0x3c468d[_0x2c58('0xb3')]=[{'model':_0x388ff2[_0x2c58('0xb4')],'as':_0x2c58('0xb5'),'attributes':['id',_0x2c58('0xe'),'color'],'required':_0x33ae28['query']['tag']?!![]:![]},{'model':_0x388ff2[_0x2c58('0xb4')],'as':'ThroughTags','attributes':['id',_0x2c58('0xe'),_0x2c58('0xb6')],'through':_0x33ae28[_0x2c58('0x90')]['tag']?{'attributes':[],'where':{'TagId':_0x33ae28[_0x2c58('0x90')][_0x2c58('0xb7')]||undefined}}:{},'required':_0x33ae28['query']['tag']?!![]:![]}];}else{_0x3c468d[_0x2c58('0xb3')]=[{'all':!![]}];}}return _0x388ff2[_0x1e7b58[_0x2c58('0x16')]][_0x2c58('0x8')](_0x3c468d);})[_0x2c58('0x9')](function(_0x1ea1ed){_0x3aa777[_0x2c58('0xb8')]=_0x1ea1ed;if(_0x5f3153==='Agents'&&_0x33ae28[_0x2c58('0x90')][_0x2c58('0xb9')]===_0x2c58('0xba')){var _0x577dd4=[];for(var _0x8ec353=0x0;_0x8ec353<_0x3aa777[_0x2c58('0xb8')][_0x2c58('0x99')];_0x8ec353++){_0x577dd4['push'](_0x18ad80('chat',_0x3aa777['rows'][_0x8ec353]['dataValues']));_0x577dd4[_0x2c58('0x9b')](_0x18ad80(_0x2c58('0xbb'),_0x3aa777[_0x2c58('0xb8')][_0x8ec353][_0x2c58('0xbc')]));_0x577dd4[_0x2c58('0x9b')](_0x18ad80(_0x2c58('0xbd'),_0x3aa777[_0x2c58('0xb8')][_0x8ec353]['dataValues']));_0x577dd4[_0x2c58('0x9b')](_0x18ad80(_0x2c58('0xbe'),_0x3aa777[_0x2c58('0xb8')][_0x8ec353][_0x2c58('0xbc')]));_0x577dd4[_0x2c58('0x9b')](_0x18ad80(_0x2c58('0xbf'),_0x3aa777[_0x2c58('0xb8')][_0x8ec353][_0x2c58('0xbc')]));_0x577dd4[_0x2c58('0x9b')](_0x18ad80(_0x2c58('0xc0'),_0x3aa777[_0x2c58('0xb8')][_0x8ec353]['dataValues']));}return Promise[_0x2c58('0x96')](_0x577dd4)[_0x2c58('0x9')](function(){return _0x3aa777;});}return _0x3aa777;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 9cf5bee..3a1cd7d 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 _0x598a=['result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userProfile.socket','register','request','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info'];(function(_0x561f25,_0x2d95c1){var _0x150e4c=function(_0x266e99){while(--_0x266e99){_0x561f25['push'](_0x561f25['shift']());}};_0x150e4c(++_0x2d95c1);}(_0x598a,0xfb));var _0xa598=function(_0x4c19f2,_0x5de019){_0x4c19f2=_0x4c19f2-0x0;var _0x1902d8=_0x598a[_0x4c19f2];return _0x1902d8;};'use strict';var _=require(_0xa598('0x0'));var util=require(_0xa598('0x1'));var moment=require(_0xa598('0x2'));var BPromise=require(_0xa598('0x3'));var rs=require(_0xa598('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa598('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xa598('0x6'));var jayson=require(_0xa598('0x7'));var client=jayson[_0xa598('0x8')][_0xa598('0x9')]({'port':0x232a});config[_0xa598('0xa')]=_['defaults'](config['redis'],{'host':_0xa598('0xb'),'port':0x18eb});var socket=require(_0xa598('0xc'))(new Redis(config[_0xa598('0xa')]));require(_0xa598('0xd'))[_0xa598('0xe')](socket);function respondWithRpcPromise(_0x387afc,_0x5207d5,_0x5871a3){return new BPromise(function(_0x3ea1e4,_0x3cb7b8){return client[_0xa598('0xf')](_0x387afc,_0x5871a3)[_0xa598('0x10')](function(_0xa1c53){logger['info'](_0xa598('0x11'),_0x5207d5,_0xa598('0x12'));logger[_0xa598('0x13')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x5207d5,_0xa598('0x12'),JSON['stringify'](_0xa1c53));if(_0xa1c53[_0xa598('0x14')]){if(_0xa1c53[_0xa598('0x14')][_0xa598('0x15')]===0x1f4){logger[_0xa598('0x14')](_0xa598('0x11'),_0x5207d5,_0xa1c53[_0xa598('0x14')][_0xa598('0x16')]);return _0x3cb7b8(_0xa1c53[_0xa598('0x14')][_0xa598('0x16')]);}logger['error'](_0xa598('0x11'),_0x5207d5,_0xa1c53[_0xa598('0x14')][_0xa598('0x16')]);return _0x3ea1e4(_0xa1c53[_0xa598('0x14')][_0xa598('0x16')]);}else{logger[_0xa598('0x17')](_0xa598('0x11'),_0x5207d5,_0xa598('0x12'));_0x3ea1e4(_0xa1c53[_0xa598('0x18')][_0xa598('0x16')]);}})['catch'](function(_0x1ed03f){logger[_0xa598('0x14')](_0xa598('0x11'),_0x5207d5,_0x1ed03f);_0x3cb7b8(_0x1ed03f);});});} \ No newline at end of file +var _0x2c16=['http','defaults','redis','localhost','register','request','then','info','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','UserProfile,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x384fc4,_0x1740d6){var _0x292817=function(_0x50249c){while(--_0x50249c){_0x384fc4['push'](_0x384fc4['shift']());}};_0x292817(++_0x1740d6);}(_0x2c16,0xf0));var _0x62c1=function(_0x59b2de,_0x19f3af){_0x59b2de=_0x59b2de-0x0;var _0x25603f=_0x2c16[_0x59b2de];return _0x25603f;};'use strict';var _=require(_0x62c1('0x0'));var util=require(_0x62c1('0x1'));var moment=require(_0x62c1('0x2'));var BPromise=require('bluebird');var rs=require(_0x62c1('0x3'));var fs=require('fs');var Redis=require(_0x62c1('0x4'));var db=require(_0x62c1('0x5'))['db'];var utils=require(_0x62c1('0x6'));var logger=require(_0x62c1('0x7'))(_0x62c1('0x8'));var config=require(_0x62c1('0x9'));var jayson=require(_0x62c1('0xa'));var client=jayson[_0x62c1('0xb')][_0x62c1('0xc')]({'port':0x232a});config['redis']=_[_0x62c1('0xd')](config[_0x62c1('0xe')],{'host':_0x62c1('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x62c1('0xe')]));require('./userProfile.socket')[_0x62c1('0x10')](socket);function respondWithRpcPromise(_0x3c7586,_0x4ff7eb,_0x1e040a){return new BPromise(function(_0x5c3213,_0x39920f){return client[_0x62c1('0x11')](_0x3c7586,_0x1e040a)[_0x62c1('0x12')](function(_0x24fe57){logger[_0x62c1('0x13')]('UserProfile,\x20%s,\x20%s',_0x4ff7eb,'request\x20sent');logger[_0x62c1('0x14')](_0x62c1('0x15'),_0x4ff7eb,'request\x20sent',JSON['stringify'](_0x24fe57));if(_0x24fe57[_0x62c1('0x16')]){if(_0x24fe57[_0x62c1('0x16')]['code']===0x1f4){logger[_0x62c1('0x16')](_0x62c1('0x17'),_0x4ff7eb,_0x24fe57[_0x62c1('0x16')][_0x62c1('0x18')]);return _0x39920f(_0x24fe57[_0x62c1('0x16')]['message']);}logger[_0x62c1('0x16')]('UserProfile,\x20%s,\x20%s',_0x4ff7eb,_0x24fe57[_0x62c1('0x16')][_0x62c1('0x18')]);return _0x5c3213(_0x24fe57[_0x62c1('0x16')][_0x62c1('0x18')]);}else{logger[_0x62c1('0x13')](_0x62c1('0x17'),_0x4ff7eb,_0x62c1('0x19'));_0x5c3213(_0x24fe57[_0x62c1('0x1a')][_0x62c1('0x18')]);}})[_0x62c1('0x1b')](function(_0x2b5b36){logger[_0x62c1('0x16')](_0x62c1('0x17'),_0x4ff7eb,_0x2b5b36);_0x39920f(_0x2b5b36);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 823b8d3..0e51d58 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 _0xb43a=['removeListener','./userProfile.events','save','remove','update','emit'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xb43a,0xb5));var _0xab43=function(_0x9edfd5,_0x286486){_0x9edfd5=_0x9edfd5-0x0;var _0x330738=_0xb43a[_0x9edfd5];return _0x330738;};'use strict';var UserProfileEvents=require(_0xab43('0x0'));var events=[_0xab43('0x1'),_0xab43('0x2'),_0xab43('0x3')];function createListener(_0x448623,_0x382a61){return function(_0x2371ef){_0x382a61[_0xab43('0x4')](_0x448623,_0x2371ef);};}function removeListener(_0x4a2c88,_0x25330b){return function(){UserProfileEvents[_0xab43('0x5')](_0x4a2c88,_0x25330b);};}exports['register']=function(_0x49283c){for(var _0x5e9fa9=0x0,_0x36f1bc=events['length'];_0x5e9fa9<_0x36f1bc;_0x5e9fa9++){var _0x59169e=events[_0x5e9fa9];var _0x278d23=createListener('userProfile:'+_0x59169e,_0x49283c);UserProfileEvents['on'](_0x59169e,_0x278d23);}}; \ No newline at end of file +var _0xd5e0=['update','emit','removeListener','register','length','userProfile:','save','remove'];(function(_0x37b451,_0xadba42){var _0x4c528c=function(_0x450000){while(--_0x450000){_0x37b451['push'](_0x37b451['shift']());}};_0x4c528c(++_0xadba42);}(_0xd5e0,0x1de));var _0x0d5e=function(_0x12bb01,_0x2112fb){_0x12bb01=_0x12bb01-0x0;var _0xa0ae37=_0xd5e0[_0x12bb01];return _0xa0ae37;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x0d5e('0x0'),_0x0d5e('0x1'),_0x0d5e('0x2')];function createListener(_0x249dcd,_0x40df97){return function(_0x68eda8){_0x40df97[_0x0d5e('0x3')](_0x249dcd,_0x68eda8);};}function removeListener(_0x33e4bd,_0x4e7dbe){return function(){UserProfileEvents[_0x0d5e('0x4')](_0x33e4bd,_0x4e7dbe);};}exports[_0x0d5e('0x5')]=function(_0x51aae6){for(var _0x59c4d0=0x0,_0x5abf41=events[_0x0d5e('0x6')];_0x59c4d0<_0x5abf41;_0x59c4d0++){var _0x510855=events[_0x59c4d0];var _0x4bd6ea=createListener(_0x0d5e('0x7')+_0x510855,_0x51aae6);UserProfileEvents['on'](_0x510855,_0x4bd6ea);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 84838c6..e3073bf 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 _0xb26d=['/:id','show','post','put','update','delete','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x386b03,_0x5d0000){var _0xd3d524=function(_0x474754){while(--_0x474754){_0x386b03['push'](_0x386b03['shift']());}};_0xd3d524(++_0x5d0000);}(_0xb26d,0x197));var _0xdb26=function(_0x54c1eb,_0x90486d){_0x54c1eb=_0x54c1eb-0x0;var _0x18bd76=_0xb26d[_0x54c1eb];return _0x18bd76;};'use strict';var multer=require(_0xdb26('0x0'));var util=require(_0xdb26('0x1'));var path=require(_0xdb26('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xdb26('0x3'));var auth=require(_0xdb26('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdb26('0x5'));var controller=require('./userProfileResource.controller');router[_0xdb26('0x6')]('/',auth[_0xdb26('0x7')](),controller[_0xdb26('0x8')]);router[_0xdb26('0x6')](_0xdb26('0x9'),auth[_0xdb26('0x7')](),controller[_0xdb26('0xa')]);router['get'](_0xdb26('0xb'),auth[_0xdb26('0x7')](),controller[_0xdb26('0xc')]);router[_0xdb26('0xd')]('/',auth[_0xdb26('0x7')](),controller['create']);router[_0xdb26('0xe')](_0xdb26('0xb'),auth[_0xdb26('0x7')](),controller[_0xdb26('0xf')]);router[_0xdb26('0x10')](_0xdb26('0xb'),auth[_0xdb26('0x7')](),controller[_0xdb26('0x11')]);module[_0xdb26('0x12')]=router; \ No newline at end of file +var _0x8131=['connect-timeout','express','fs-extra','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','index','/:id','post','create','delete','exports','multer'];(function(_0x20d3f7,_0x169671){var _0x49450e=function(_0x1a0dab){while(--_0x1a0dab){_0x20d3f7['push'](_0x20d3f7['shift']());}};_0x49450e(++_0x169671);}(_0x8131,0x1db));var _0x1813=function(_0x24731c,_0x5a2e04){_0x24731c=_0x24731c-0x0;var _0x414a84=_0x8131[_0x24731c];return _0x414a84;};'use strict';var multer=require(_0x1813('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1813('0x1'));var express=require(_0x1813('0x2'));var router=express['Router']();var fs_extra=require(_0x1813('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1813('0x4'));var config=require('../../config/environment');var controller=require(_0x1813('0x5'));router[_0x1813('0x6')]('/',auth[_0x1813('0x7')](),controller[_0x1813('0x8')]);router[_0x1813('0x6')]('/describe',auth[_0x1813('0x7')](),controller['describe']);router[_0x1813('0x6')](_0x1813('0x9'),auth[_0x1813('0x7')](),controller['show']);router[_0x1813('0xa')]('/',auth['isAuthenticated'](),controller[_0x1813('0xb')]);router['put']('/:id',auth[_0x1813('0x7')](),controller['update']);router[_0x1813('0xc')](_0x1813('0x9'),auth[_0x1813('0x7')](),controller['destroy']);module[_0x1813('0xd')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 624a541..ba41411 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 _0x0264=['exports','STRING','INTEGER'];(function(_0x31d849,_0x3db9bc){var _0x1c55b3=function(_0x3b8040){while(--_0x3b8040){_0x31d849['push'](_0x31d849['shift']());}};_0x1c55b3(++_0x3db9bc);}(_0x0264,0x183));var _0x4026=function(_0x587041,_0x179518){_0x587041=_0x587041-0x0;var _0x13d979=_0x0264[_0x587041];return _0x13d979;};'use strict';var Sequelize=require('sequelize');module[_0x4026('0x0')]={'name':{'type':Sequelize[_0x4026('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x4026('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4026('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xd676=['STRING','sequelize','exports'];(function(_0x300014,_0x46f435){var _0x4f18a5=function(_0x3f35cd){while(--_0x3f35cd){_0x300014['push'](_0x300014['shift']());}};_0x4f18a5(++_0x46f435);}(_0xd676,0x1db));var _0x6d67=function(_0x59dc02,_0x120477){_0x59dc02=_0x59dc02-0x0;var _0x556178=_0xd676[_0x59dc02];return _0x556178;};'use strict';var Sequelize=require(_0x6d67('0x0'));module[_0x6d67('0x1')]={'name':{'type':Sequelize[_0x6d67('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x6d67('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 5f69c47..7affaca 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 _0x1261=['end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','send','UserProfileResource','model','map','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filters','where','type','VIRTUAL','filter','merge','options','findAll','rows','params','include','find','create','catch','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x3dc6d6,_0x1788e8){var _0x1db7f1=function(_0x2147a0){while(--_0x2147a0){_0x3dc6d6['push'](_0x3dc6d6['shift']());}};_0x1db7f1(++_0x1788e8);}(_0x1261,0x144));var _0x1126=function(_0xd60031,_0x5efb93){_0xd60031=_0xd60031-0x0;var _0x43d00a=_0x1261[_0xd60031];return _0x43d00a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=typeof _0x4be0c6[_0x1126('0x1c')]===_0x1126('0x1d')&&typeof _0x4be0c6[_0x1126('0x1e')]==='undefined';var _0x245cd7=_0x45149c[_0x1126('0x1f')];var _0x4a7b49=_0x4794a7?0x0:_0x4be0c6['offset'];var _0x22ae0b=_0x4794a7?_0x45149c[_0x1126('0x1f')]:_0x4be0c6['offset']+_0x4be0c6['limit'];var _0x4564c0;if(_0x22ae0b>=_0x245cd7){_0x22ae0b=_0x245cd7;_0x4564c0=0xc8;}else{_0x4564c0=0xce;}_0x279455['status'](_0x4564c0);return _0x279455[_0x1126('0x20')](_0x1126('0x21'),_0x4a7b49+'-'+_0x22ae0b+'/'+_0x245cd7)[_0x1126('0x1b')](_0x45149c);}return null;};}function patchUpdates(_0x54400a){return function(_0x2a08ba){try{jsonpatch['apply'](_0x2a08ba,_0x54400a,!![]);}catch(_0x56efeb){return BPromise[_0x1126('0x22')](_0x56efeb);}return _0x2a08ba[_0x1126('0x23')]();};}function saveUpdates(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x24')](_0x25b24b)[_0x1126('0x25')](function(_0x48a08d){return _0x48a08d;});}return null;};}function removeEntity(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(_0x529dd9){return _0x529dd9['destroy']()[_0x1126('0x25')](function(){_0x2175fa[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x34bcf1,_0x566c09){return function(_0x1b07a7){if(!_0x1b07a7){_0x34bcf1[_0x1126('0x18')](0x194);}return _0x1b07a7;};}function handleError(_0x38119d,_0x589725){_0x589725=_0x589725||0x1f4;return function(_0x35eec3){logger[_0x1126('0x26')](_0x35eec3[_0x1126('0x27')]);if(_0x35eec3['name']){delete _0x35eec3['name'];}_0x38119d[_0x1126('0x19')](_0x589725)[_0x1126('0x28')](_0x35eec3);};}exports['index']=function(_0x2fb797,_0x23d2bc){var _0x4a334a={},_0x3fa694={},_0x4bf807={'count':0x0,'rows':[]};var _0xc62460=_['map'](db[_0x1126('0x29')]['rawAttributes'],function(_0x378f4d){return{'name':_0x378f4d['fieldName'],'type':_0x378f4d['type']['key']};});_0x3fa694[_0x1126('0x2a')]=_[_0x1126('0x2b')](_0xc62460,_0x1126('0x2c'));_0x3fa694['query']=_[_0x1126('0x2d')](_0x2fb797[_0x1126('0x2e')]);_0x3fa694['filters']=_[_0x1126('0x2f')](_0x3fa694[_0x1126('0x2a')],_0x3fa694[_0x1126('0x2e')]);_0x4a334a[_0x1126('0x30')]=_['intersection'](_0x3fa694['model'],qs[_0x1126('0x31')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x31')]));_0x4a334a[_0x1126('0x30')]=_0x4a334a['attributes'][_0x1126('0x32')]?_0x4a334a[_0x1126('0x30')]:_0x3fa694[_0x1126('0x2a')];if(!_0x2fb797[_0x1126('0x2e')][_0x1126('0x33')]('nolimit')){_0x4a334a[_0x1126('0x1e')]=qs[_0x1126('0x1e')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1e')]);_0x4a334a['offset']=qs['offset'](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1c')]);}_0x4a334a['order']=qs[_0x1126('0x34')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x34')]);_0x4a334a['where']=qs['filters'](_[_0x1126('0x35')](_0x2fb797[_0x1126('0x2e')],_0x3fa694[_0x1126('0x36')]),_0xc62460);if(_0x2fb797[_0x1126('0x2e')]['filter']){_0x4a334a[_0x1126('0x37')]=_['merge'](_0x4a334a[_0x1126('0x37')],{'$or':_[_0x1126('0x2b')](_0xc62460,function(_0xfa96e0){if(_0xfa96e0[_0x1126('0x38')]!==_0x1126('0x39')){var _0x5746f6={};_0x5746f6[_0xfa96e0[_0x1126('0x2c')]]={'$like':'%'+_0x2fb797[_0x1126('0x2e')][_0x1126('0x3a')]+'%'};return _0x5746f6;}})});}_0x4a334a=_[_0x1126('0x3b')]({},_0x4a334a,_0x2fb797[_0x1126('0x3c')]);var _0x3442b8={'where':_0x4a334a[_0x1126('0x37')]};return db['UserProfileResource'][_0x1126('0x1f')](_0x3442b8)[_0x1126('0x25')](function(_0x227a6b){_0x4bf807[_0x1126('0x1f')]=_0x227a6b;if(_0x2fb797[_0x1126('0x2e')]['includeAll']){_0x4a334a['include']=[{'all':!![]}];}return db[_0x1126('0x29')][_0x1126('0x3d')](_0x4a334a);})[_0x1126('0x25')](function(_0x21c38e){_0x4bf807[_0x1126('0x3e')]=_0x21c38e;return _0x4bf807;})[_0x1126('0x25')](respondWithFilteredResult(_0x23d2bc,_0x4a334a))['catch'](handleError(_0x23d2bc,null));};exports['show']=function(_0x4cb1db,_0xb8054e){var _0x5d4194={'raw':![],'where':{'id':_0x4cb1db[_0x1126('0x3f')]['id']}},_0xf84005={};_0xf84005[_0x1126('0x2a')]=_[_0x1126('0x2d')](db['UserProfileResource']['rawAttributes']);_0xf84005[_0x1126('0x2e')]=_[_0x1126('0x2d')](_0x4cb1db[_0x1126('0x2e')]);_0xf84005['filters']=_[_0x1126('0x2f')](_0xf84005['model'],_0xf84005[_0x1126('0x2e')]);_0x5d4194['attributes']=_[_0x1126('0x2f')](_0xf84005[_0x1126('0x2a')],qs[_0x1126('0x31')](_0x4cb1db['query'][_0x1126('0x31')]));_0x5d4194[_0x1126('0x30')]=_0x5d4194[_0x1126('0x30')]['length']?_0x5d4194['attributes']:_0xf84005['model'];if(_0x4cb1db[_0x1126('0x2e')]['includeAll']){_0x5d4194[_0x1126('0x40')]=[{'all':!![]}];}_0x5d4194=_['merge']({},_0x5d4194,_0x4cb1db[_0x1126('0x3c')]);return db[_0x1126('0x29')][_0x1126('0x41')](_0x5d4194)[_0x1126('0x25')](handleEntityNotFound(_0xb8054e,null))[_0x1126('0x25')](respondWithResult(_0xb8054e,null))['catch'](handleError(_0xb8054e,null));};exports[_0x1126('0x42')]=function(_0x512f60,_0x5111d3){return db[_0x1126('0x29')][_0x1126('0x42')](_0x512f60['body'],{})[_0x1126('0x25')](respondWithResult(_0x5111d3,0xc9))[_0x1126('0x43')](handleError(_0x5111d3,null));};exports['update']=function(_0x3e4eeb,_0xbdde58){if(_0x3e4eeb[_0x1126('0x44')]['id']){delete _0x3e4eeb['body']['id'];}return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'id':_0x3e4eeb[_0x1126('0x3f')]['id']}})[_0x1126('0x25')](handleEntityNotFound(_0xbdde58,null))[_0x1126('0x25')](saveUpdates(_0x3e4eeb[_0x1126('0x44')],null))[_0x1126('0x25')](respondWithResult(_0xbdde58,null))[_0x1126('0x43')](handleError(_0xbdde58,null));};exports['destroy']=function(_0x1b8b83,_0x5a2287){return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'id':_0x1b8b83['params']['id']}})['then'](handleEntityNotFound(_0x5a2287,null))[_0x1126('0x25')](removeEntity(_0x5a2287,null))[_0x1126('0x43')](handleError(_0x5a2287,null));};exports[_0x1126('0x45')]=function(_0x52a9a4,_0x3cb44c){return db[_0x1126('0x29')][_0x1126('0x45')]()[_0x1126('0x25')](respondWithResult(_0x3cb44c,null))['catch'](handleError(_0x3cb44c,null));}; \ No newline at end of file +var _0x187d=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','update','destroy','error','stack','name','index','map','UserProfileResource','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','where','filter','merge','includeAll','include','findAll','then','rows','catch','show','params','fields','options','find','create','body','describe','eml-format'];(function(_0x203256,_0x5bbf7e){var _0x26e07b=function(_0x5962a8){while(--_0x5962a8){_0x203256['push'](_0x203256['shift']());}};_0x26e07b(++_0x5bbf7e);}(_0x187d,0x93));var _0xd187=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x187d[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0xd187('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd187('0x1'));var jsonpatch=require(_0xd187('0x2'));var rp=require(_0xd187('0x3'));var moment=require(_0xd187('0x4'));var BPromise=require(_0xd187('0x5'));var Mustache=require(_0xd187('0x6'));var util=require('util');var path=require(_0xd187('0x7'));var sox=require(_0xd187('0x8'));var csv=require('to-csv');var ejs=require(_0xd187('0x9'));var fs=require('fs');var fs_extra=require(_0xd187('0xa'));var _=require(_0xd187('0xb'));var squel=require(_0xd187('0xc'));var crypto=require(_0xd187('0xd'));var jsforce=require(_0xd187('0xe'));var deskjs=require(_0xd187('0xf'));var toCsv=require(_0xd187('0x10'));var querystring=require('querystring');var Papa=require(_0xd187('0x11'));var Redis=require(_0xd187('0x12'));var authService=require(_0xd187('0x13'));var qs=require(_0xd187('0x14'));var as=require(_0xd187('0x15'));var hardwareService=require(_0xd187('0x16'));var logger=require('../../config/logger')(_0xd187('0x17'));var utils=require(_0xd187('0x18'));var config=require(_0xd187('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd187('0x1a'))['db'];function respondWithStatusCode(_0x4545cf,_0x32ba07){_0x32ba07=_0x32ba07||0xcc;return function(_0x59ee4a){if(_0x59ee4a){return _0x4545cf[_0xd187('0x1b')](_0x32ba07);}return _0x4545cf[_0xd187('0x1c')](_0x32ba07)[_0xd187('0x1d')]();};}function respondWithResult(_0x126d1a,_0x517b25){_0x517b25=_0x517b25||0xc8;return function(_0x39a927){if(_0x39a927){return _0x126d1a[_0xd187('0x1c')](_0x517b25)[_0xd187('0x1e')](_0x39a927);}};}function respondWithFilteredResult(_0x188cfe,_0x4c8f68){return function(_0x245d3e){if(_0x245d3e){var _0x52a208=typeof _0x4c8f68['offset']===_0xd187('0x1f')&&typeof _0x4c8f68['limit']==='undefined';var _0x207b36=_0x245d3e[_0xd187('0x20')];var _0x374fe0=_0x52a208?0x0:_0x4c8f68[_0xd187('0x21')];var _0x21df74=_0x52a208?_0x245d3e[_0xd187('0x20')]:_0x4c8f68[_0xd187('0x21')]+_0x4c8f68[_0xd187('0x22')];var _0x4f2f88;if(_0x21df74>=_0x207b36){_0x21df74=_0x207b36;_0x4f2f88=0xc8;}else{_0x4f2f88=0xce;}_0x188cfe[_0xd187('0x1c')](_0x4f2f88);return _0x188cfe[_0xd187('0x23')](_0xd187('0x24'),_0x374fe0+'-'+_0x21df74+'/'+_0x207b36)[_0xd187('0x1e')](_0x245d3e);}return null;};}function patchUpdates(_0x5204ee){return function(_0x2f7fb3){try{jsonpatch[_0xd187('0x25')](_0x2f7fb3,_0x5204ee,!![]);}catch(_0xc5bba5){return BPromise['reject'](_0xc5bba5);}return _0x2f7fb3['save']();};}function saveUpdates(_0x57cf1d,_0x435d94){return function(_0x33741d){if(_0x33741d){return _0x33741d[_0xd187('0x26')](_0x57cf1d)['then'](function(_0x2c07c8){return _0x2c07c8;});}return null;};}function removeEntity(_0x57186b,_0x145771){return function(_0x5a7a23){if(_0x5a7a23){return _0x5a7a23[_0xd187('0x27')]()['then'](function(){_0x57186b['status'](0xcc)[_0xd187('0x1d')]();});}};}function handleEntityNotFound(_0x4d992b,_0x12da33){return function(_0x598aa4){if(!_0x598aa4){_0x4d992b['sendStatus'](0x194);}return _0x598aa4;};}function handleError(_0x4eac6a,_0x848ddd){_0x848ddd=_0x848ddd||0x1f4;return function(_0xeff822){logger[_0xd187('0x28')](_0xeff822[_0xd187('0x29')]);if(_0xeff822['name']){delete _0xeff822[_0xd187('0x2a')];}_0x4eac6a[_0xd187('0x1c')](_0x848ddd)['send'](_0xeff822);};}exports[_0xd187('0x2b')]=function(_0x1c87ee,_0x34febe){var _0x4c50a5={},_0x15e2e8={},_0x56e292={'count':0x0,'rows':[]};var _0x263e31=_[_0xd187('0x2c')](db[_0xd187('0x2d')][_0xd187('0x2e')],function(_0x489f2e){return{'name':_0x489f2e[_0xd187('0x2f')],'type':_0x489f2e[_0xd187('0x30')]['key']};});_0x15e2e8['model']=_[_0xd187('0x2c')](_0x263e31,_0xd187('0x2a'));_0x15e2e8[_0xd187('0x31')]=_[_0xd187('0x32')](_0x1c87ee[_0xd187('0x31')]);_0x15e2e8[_0xd187('0x33')]=_[_0xd187('0x34')](_0x15e2e8[_0xd187('0x35')],_0x15e2e8['query']);_0x4c50a5[_0xd187('0x36')]=_[_0xd187('0x34')](_0x15e2e8[_0xd187('0x35')],qs['fields'](_0x1c87ee[_0xd187('0x31')]['fields']));_0x4c50a5[_0xd187('0x36')]=_0x4c50a5[_0xd187('0x36')][_0xd187('0x37')]?_0x4c50a5['attributes']:_0x15e2e8['model'];if(!_0x1c87ee[_0xd187('0x31')][_0xd187('0x38')]('nolimit')){_0x4c50a5[_0xd187('0x22')]=qs[_0xd187('0x22')](_0x1c87ee[_0xd187('0x31')]['limit']);_0x4c50a5['offset']=qs[_0xd187('0x21')](_0x1c87ee[_0xd187('0x31')]['offset']);}_0x4c50a5['order']=qs['sort'](_0x1c87ee[_0xd187('0x31')]['sort']);_0x4c50a5[_0xd187('0x39')]=qs[_0xd187('0x33')](_['pick'](_0x1c87ee[_0xd187('0x31')],_0x15e2e8['filters']),_0x263e31);if(_0x1c87ee[_0xd187('0x31')][_0xd187('0x3a')]){_0x4c50a5['where']=_[_0xd187('0x3b')](_0x4c50a5[_0xd187('0x39')],{'$or':_['map'](_0x263e31,function(_0x4399a5){if(_0x4399a5['type']!=='VIRTUAL'){var _0x26b06d={};_0x26b06d[_0x4399a5[_0xd187('0x2a')]]={'$like':'%'+_0x1c87ee[_0xd187('0x31')][_0xd187('0x3a')]+'%'};return _0x26b06d;}})});}_0x4c50a5=_[_0xd187('0x3b')]({},_0x4c50a5,_0x1c87ee['options']);var _0x8860c={'where':_0x4c50a5[_0xd187('0x39')]};return db[_0xd187('0x2d')]['count'](_0x8860c)['then'](function(_0x538c05){_0x56e292['count']=_0x538c05;if(_0x1c87ee[_0xd187('0x31')][_0xd187('0x3c')]){_0x4c50a5[_0xd187('0x3d')]=[{'all':!![]}];}return db[_0xd187('0x2d')][_0xd187('0x3e')](_0x4c50a5);})[_0xd187('0x3f')](function(_0x4699e1){_0x56e292[_0xd187('0x40')]=_0x4699e1;return _0x56e292;})['then'](respondWithFilteredResult(_0x34febe,_0x4c50a5))[_0xd187('0x41')](handleError(_0x34febe,null));};exports[_0xd187('0x42')]=function(_0x31d9d2,_0x51c7fc){var _0x21cbf6={'raw':![],'where':{'id':_0x31d9d2[_0xd187('0x43')]['id']}},_0x48c100={};_0x48c100[_0xd187('0x35')]=_[_0xd187('0x32')](db[_0xd187('0x2d')][_0xd187('0x2e')]);_0x48c100['query']=_[_0xd187('0x32')](_0x31d9d2[_0xd187('0x31')]);_0x48c100[_0xd187('0x33')]=_[_0xd187('0x34')](_0x48c100['model'],_0x48c100[_0xd187('0x31')]);_0x21cbf6[_0xd187('0x36')]=_['intersection'](_0x48c100[_0xd187('0x35')],qs[_0xd187('0x44')](_0x31d9d2['query']['fields']));_0x21cbf6[_0xd187('0x36')]=_0x21cbf6[_0xd187('0x36')]['length']?_0x21cbf6['attributes']:_0x48c100['model'];if(_0x31d9d2[_0xd187('0x31')][_0xd187('0x3c')]){_0x21cbf6[_0xd187('0x3d')]=[{'all':!![]}];}_0x21cbf6=_[_0xd187('0x3b')]({},_0x21cbf6,_0x31d9d2[_0xd187('0x45')]);return db[_0xd187('0x2d')][_0xd187('0x46')](_0x21cbf6)['then'](handleEntityNotFound(_0x51c7fc,null))[_0xd187('0x3f')](respondWithResult(_0x51c7fc,null))[_0xd187('0x41')](handleError(_0x51c7fc,null));};exports[_0xd187('0x47')]=function(_0x3ce4a1,_0x3f5def){return db[_0xd187('0x2d')][_0xd187('0x47')](_0x3ce4a1[_0xd187('0x48')],{})['then'](respondWithResult(_0x3f5def,0xc9))[_0xd187('0x41')](handleError(_0x3f5def,null));};exports[_0xd187('0x26')]=function(_0x4523c8,_0x1449d7){if(_0x4523c8[_0xd187('0x48')]['id']){delete _0x4523c8['body']['id'];}return db[_0xd187('0x2d')][_0xd187('0x46')]({'where':{'id':_0x4523c8['params']['id']}})[_0xd187('0x3f')](handleEntityNotFound(_0x1449d7,null))[_0xd187('0x3f')](saveUpdates(_0x4523c8['body'],null))['then'](respondWithResult(_0x1449d7,null))['catch'](handleError(_0x1449d7,null));};exports['destroy']=function(_0x473bef,_0x22f432){return db[_0xd187('0x2d')][_0xd187('0x46')]({'where':{'id':_0x473bef[_0xd187('0x43')]['id']}})[_0xd187('0x3f')](handleEntityNotFound(_0x22f432,null))[_0xd187('0x3f')](removeEntity(_0x22f432,null))['catch'](handleError(_0x22f432,null));};exports[_0xd187('0x49')]=function(_0x3aaeaa,_0x1b12c4){return db[_0xd187('0x2d')]['describe']()[_0xd187('0x3f')](respondWithResult(_0x1b12c4,null))['catch'](handleError(_0x1b12c4,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 0dfc497..6cd23cb 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 _0x9ca9=['resourceId','sectionId','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','user_profile_has_resources','compositeIndex'];(function(_0x5e2af2,_0x3964a5){var _0x5b964b=function(_0x2e6a71){while(--_0x2e6a71){_0x5e2af2['push'](_0x5e2af2['shift']());}};_0x5b964b(++_0x3964a5);}(_0x9ca9,0x18a));var _0x99ca=function(_0x142cc0,_0x4ca2d0){_0x142cc0=_0x142cc0-0x0;var _0xabe71f=_0x9ca9[_0x142cc0];return _0xabe71f;};'use strict';var _=require(_0x99ca('0x0'));var util=require(_0x99ca('0x1'));var logger=require('../../config/logger')(_0x99ca('0x2'));var moment=require('moment');var BPromise=require(_0x99ca('0x3'));var rp=require(_0x99ca('0x4'));var fs=require('fs');var path=require(_0x99ca('0x5'));var rimraf=require(_0x99ca('0x6'));var config=require(_0x99ca('0x7'));var attributes=require(_0x99ca('0x8'));module[_0x99ca('0x9')]=function(_0x3f4cc2,_0x1f132d){return _0x3f4cc2['define']('UserProfileResource',attributes,{'tableName':_0x99ca('0xa'),'paranoid':![],'indexes':[{'name':_0x99ca('0xb'),'fields':[_0x99ca('0xc'),_0x99ca('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xab16=['define','UserProfileResource','compositeIndex','resourceId','sectionId','lodash','util','api','moment','bluebird','path','rimraf','./userProfileResource.attributes','exports'];(function(_0x43d79c,_0x531a55){var _0x4866b0=function(_0x847a){while(--_0x847a){_0x43d79c['push'](_0x43d79c['shift']());}};_0x4866b0(++_0x531a55);}(_0xab16,0xad));var _0x6ab1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xab16[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6ab1('0x0'));var util=require(_0x6ab1('0x1'));var logger=require('../../config/logger')(_0x6ab1('0x2'));var moment=require(_0x6ab1('0x3'));var BPromise=require(_0x6ab1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ab1('0x5'));var rimraf=require(_0x6ab1('0x6'));var config=require('../../config/environment');var attributes=require(_0x6ab1('0x7'));module[_0x6ab1('0x8')]=function(_0x3deb86,_0x10eef4){return _0x3deb86[_0x6ab1('0x9')](_0x6ab1('0xa'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x6ab1('0xb'),'fields':[_0x6ab1('0xc'),_0x6ab1('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 3208a09..f28316b 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 _0x6236=['../../config/logger','rpc','request','then','info','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x6cf5ec,_0x194d2e){var _0x271c4f=function(_0x206fee){while(--_0x206fee){_0x6cf5ec['push'](_0x6cf5ec['shift']());}};_0x271c4f(++_0x194d2e);}(_0x6236,0x149));var _0x6623=function(_0x1b327e,_0x488918){_0x1b327e=_0x1b327e-0x0;var _0xc8bf7e=_0x6236[_0x1b327e];return _0xc8bf7e;};'use strict';var _=require(_0x6623('0x0'));var util=require(_0x6623('0x1'));var moment=require(_0x6623('0x2'));var BPromise=require(_0x6623('0x3'));var rs=require(_0x6623('0x4'));var fs=require('fs');var Redis=require(_0x6623('0x5'));var db=require(_0x6623('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6623('0x7'))(_0x6623('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x54b9fa,_0x960251,_0x314f11){return new BPromise(function(_0x41ba7f,_0x35aec1){return client[_0x6623('0x9')](_0x54b9fa,_0x314f11)[_0x6623('0xa')](function(_0x459e51){logger[_0x6623('0xb')]('UserProfileResource,\x20%s,\x20%s',_0x960251,_0x6623('0xc'));logger[_0x6623('0xd')](_0x6623('0xe'),_0x960251,_0x6623('0xc'),JSON[_0x6623('0xf')](_0x459e51));if(_0x459e51[_0x6623('0x10')]){if(_0x459e51[_0x6623('0x10')][_0x6623('0x11')]===0x1f4){logger['error'](_0x6623('0x12'),_0x960251,_0x459e51[_0x6623('0x10')][_0x6623('0x13')]);return _0x35aec1(_0x459e51['error'][_0x6623('0x13')]);}logger[_0x6623('0x10')](_0x6623('0x12'),_0x960251,_0x459e51['error'][_0x6623('0x13')]);return _0x41ba7f(_0x459e51[_0x6623('0x10')][_0x6623('0x13')]);}else{logger[_0x6623('0xb')]('UserProfileResource,\x20%s,\x20%s',_0x960251,'request\x20sent');_0x41ba7f(_0x459e51[_0x6623('0x14')][_0x6623('0x13')]);}})['catch'](function(_0x517648){logger[_0x6623('0x10')](_0x6623('0x12'),_0x960251,_0x517648);_0x35aec1(_0x517648);});});} \ No newline at end of file +var _0x7789=['UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info'];(function(_0x1c8cc6,_0x411e5c){var _0x522936=function(_0x38d044){while(--_0x38d044){_0x1c8cc6['push'](_0x1c8cc6['shift']());}};_0x522936(++_0x411e5c);}(_0x7789,0xb9));var _0x9778=function(_0x253fef,_0x273b8d){_0x253fef=_0x253fef-0x0;var _0x825f22=_0x7789[_0x253fef];return _0x825f22;};'use strict';var _=require(_0x9778('0x0'));var util=require(_0x9778('0x1'));var moment=require(_0x9778('0x2'));var BPromise=require(_0x9778('0x3'));var rs=require(_0x9778('0x4'));var fs=require('fs');var Redis=require(_0x9778('0x5'));var db=require(_0x9778('0x6'))['db'];var utils=require(_0x9778('0x7'));var logger=require('../../config/logger')(_0x9778('0x8'));var config=require(_0x9778('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9778('0xa')][_0x9778('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3fd241,_0x1817c8,_0x27ed96){return new BPromise(function(_0x136b26,_0x5ddd84){return client[_0x9778('0xc')](_0x3fd241,_0x27ed96)[_0x9778('0xd')](function(_0x3d2b02){logger[_0x9778('0xe')](_0x9778('0xf'),_0x1817c8,_0x9778('0x10'));logger[_0x9778('0x11')](_0x9778('0x12'),_0x1817c8,_0x9778('0x10'),JSON[_0x9778('0x13')](_0x3d2b02));if(_0x3d2b02['error']){if(_0x3d2b02['error'][_0x9778('0x14')]===0x1f4){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x1817c8,_0x3d2b02[_0x9778('0x15')][_0x9778('0x16')]);return _0x5ddd84(_0x3d2b02[_0x9778('0x15')][_0x9778('0x16')]);}logger[_0x9778('0x15')](_0x9778('0xf'),_0x1817c8,_0x3d2b02[_0x9778('0x15')][_0x9778('0x16')]);return _0x136b26(_0x3d2b02[_0x9778('0x15')]['message']);}else{logger[_0x9778('0xe')](_0x9778('0xf'),_0x1817c8,'request\x20sent');_0x136b26(_0x3d2b02[_0x9778('0x17')][_0x9778('0x16')]);}})[_0x9778('0x18')](function(_0x52430a){logger[_0x9778('0x15')](_0x9778('0xf'),_0x1817c8,_0x52430a);_0x5ddd84(_0x52430a);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 0d642b9..9e36902 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 _0xafad=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','/describe','describe','post','create','put','delete','/:id','destroy','exports','multer','util','path'];(function(_0x447f32,_0x13386f){var _0x559a50=function(_0x27e1d6){while(--_0x27e1d6){_0x447f32['push'](_0x447f32['shift']());}};_0x559a50(++_0x13386f);}(_0xafad,0xbb));var _0xdafa=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xafad[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0xdafa('0x0'));var util=require(_0xdafa('0x1'));var path=require(_0xdafa('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdafa('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdafa('0x4'));var interaction=require(_0xdafa('0x5'));var config=require(_0xdafa('0x6'));var controller=require(_0xdafa('0x7'));router[_0xdafa('0x8')]('/',auth[_0xdafa('0x9')](),controller['index']);router[_0xdafa('0x8')](_0xdafa('0xa'),auth[_0xdafa('0x9')](),controller[_0xdafa('0xb')]);router[_0xdafa('0x8')]('/:id',auth[_0xdafa('0x9')](),controller['show']);router[_0xdafa('0xc')]('/',auth['isAuthenticated'](),controller[_0xdafa('0xd')]);router[_0xdafa('0xe')]('/:id',auth[_0xdafa('0x9')](),controller['update']);router[_0xdafa('0xf')](_0xdafa('0x10'),auth[_0xdafa('0x9')](),controller[_0xdafa('0x11')]);module[_0xdafa('0x12')]=router; \ No newline at end of file +var _0xa28a=['describe','/:id','show','post','create','put','exports','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa28a,0xc7));var _0xaa28=function(_0xaecaca,_0x34fcb1){_0xaecaca=_0xaecaca-0x0;var _0x348518=_0xa28a[_0xaecaca];return _0x348518;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xaa28('0x0'));var express=require('express');var router=express[_0xaa28('0x1')]();var fs_extra=require(_0xaa28('0x2'));var auth=require(_0xaa28('0x3'));var interaction=require(_0xaa28('0x4'));var config=require(_0xaa28('0x5'));var controller=require('./userProfileSection.controller');router[_0xaa28('0x6')]('/',auth[_0xaa28('0x7')](),controller[_0xaa28('0x8')]);router[_0xaa28('0x6')]('/describe',auth[_0xaa28('0x7')](),controller[_0xaa28('0x9')]);router[_0xaa28('0x6')](_0xaa28('0xa'),auth['isAuthenticated'](),controller[_0xaa28('0xb')]);router[_0xaa28('0xc')]('/',auth[_0xaa28('0x7')](),controller[_0xaa28('0xd')]);router[_0xaa28('0xe')](_0xaa28('0xa'),auth[_0xaa28('0x7')](),controller['update']);router['delete'](_0xaa28('0xa'),auth[_0xaa28('0x7')](),controller['destroy']);module[_0xaa28('0xf')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 3199857..4dec6d3 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 _0x36ee=['getDataValue','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join'];(function(_0x48ccc4,_0x4045e4){var _0x49d8bd=function(_0x25fc2b){while(--_0x25fc2b){_0x48ccc4['push'](_0x48ccc4['shift']());}};_0x49d8bd(++_0x4045e4);}(_0x36ee,0xe8));var _0xe36e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x36ee[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe36e('0x0')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xe36e('0x1')],'allowNull':![]},'enabled':{'type':Sequelize[_0xe36e('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xe36e('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xe36e('0x0')],'set':function(_0x567a84){this[_0xe36e('0x3')](_0xe36e('0x4'),_0x567a84?_0x567a84[_0xe36e('0x5')](''):[]);},'get':function(){return this[_0xe36e('0x6')](_0xe36e('0x4'))?this[_0xe36e('0x6')](_0xe36e('0x4'))['split'](''):[];}}}; \ No newline at end of file +var _0xb62e=['STRING','BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb62e,0x1de));var _0xeb62=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb62e[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xeb62('0x0'));module[_0xeb62('0x1')]={'name':{'type':Sequelize[_0xeb62('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xeb62('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0xeb62('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xeb62('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xeb62('0x2')],'set':function(_0x929329){this[_0xeb62('0x4')](_0xeb62('0x5'),_0x929329?_0x929329['join'](''):[]);},'get':function(){return this[_0xeb62('0x6')](_0xeb62('0x5'))?this[_0xeb62('0x6')]('crudPermissions')[_0xeb62('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 1e49fe8..47194e7 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 _0x3ec5=['limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','findAll','catch','show','params','length','include','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','to-csv','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined'];(function(_0x492af5,_0xd51471){var _0x59f529=function(_0x40c9aa){while(--_0x40c9aa){_0x492af5['push'](_0x492af5['shift']());}};_0x59f529(++_0xd51471);}(_0x3ec5,0x1eb));var _0x53ec=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3ec5[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x53ec('0x0'));var rimraf=require(_0x53ec('0x1'));var zipdir=require(_0x53ec('0x2'));var jsonpatch=require(_0x53ec('0x3'));var rp=require('request-promise');var moment=require(_0x53ec('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x53ec('0x5'));var util=require(_0x53ec('0x6'));var path=require(_0x53ec('0x7'));var sox=require(_0x53ec('0x8'));var csv=require('to-csv');var ejs=require(_0x53ec('0x9'));var fs=require('fs');var fs_extra=require(_0x53ec('0xa'));var _=require(_0x53ec('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x53ec('0xc'));var querystring=require(_0x53ec('0xd'));var Papa=require(_0x53ec('0xe'));var Redis=require('ioredis');var authService=require(_0x53ec('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x53ec('0x10'))(_0x53ec('0x11'));var utils=require(_0x53ec('0x12'));var config=require(_0x53ec('0x13'));var licenseUtil=require(_0x53ec('0x14'));var db=require(_0x53ec('0x15'))['db'];function respondWithStatusCode(_0x3d223f,_0x28343d){_0x28343d=_0x28343d||0xcc;return function(_0x52317f){if(_0x52317f){return _0x3d223f['sendStatus'](_0x28343d);}return _0x3d223f['status'](_0x28343d)[_0x53ec('0x16')]();};}function respondWithResult(_0x4ce593,_0x487239){_0x487239=_0x487239||0xc8;return function(_0x8533b8){if(_0x8533b8){return _0x4ce593[_0x53ec('0x17')](_0x487239)[_0x53ec('0x18')](_0x8533b8);}};}function respondWithFilteredResult(_0x55d071,_0xc0543d){return function(_0x4ec24a){if(_0x4ec24a){var _0x384d3d=typeof _0xc0543d[_0x53ec('0x19')]===_0x53ec('0x1a')&&typeof _0xc0543d[_0x53ec('0x1b')]===_0x53ec('0x1a');var _0x44fa54=_0x4ec24a[_0x53ec('0x1c')];var _0x5559a9=_0x384d3d?0x0:_0xc0543d[_0x53ec('0x19')];var _0x40c2ca=_0x384d3d?_0x4ec24a[_0x53ec('0x1c')]:_0xc0543d[_0x53ec('0x19')]+_0xc0543d[_0x53ec('0x1b')];var _0x5974b2;if(_0x40c2ca>=_0x44fa54){_0x40c2ca=_0x44fa54;_0x5974b2=0xc8;}else{_0x5974b2=0xce;}_0x55d071[_0x53ec('0x17')](_0x5974b2);return _0x55d071[_0x53ec('0x1d')](_0x53ec('0x1e'),_0x5559a9+'-'+_0x40c2ca+'/'+_0x44fa54)[_0x53ec('0x18')](_0x4ec24a);}return null;};}function patchUpdates(_0x378042){return function(_0x429fe1){try{jsonpatch[_0x53ec('0x1f')](_0x429fe1,_0x378042,!![]);}catch(_0x1c4403){return BPromise[_0x53ec('0x20')](_0x1c4403);}return _0x429fe1[_0x53ec('0x21')]();};}function saveUpdates(_0x55b2b5,_0x1158c2){return function(_0x34d2aa){if(_0x34d2aa){return _0x34d2aa['update'](_0x55b2b5)[_0x53ec('0x22')](function(_0x461830){return _0x461830;});}return null;};}function removeEntity(_0x57011a,_0x3534bc){return function(_0x1663f6){if(_0x1663f6){return _0x1663f6[_0x53ec('0x23')]()[_0x53ec('0x22')](function(){_0x57011a[_0x53ec('0x17')](0xcc)[_0x53ec('0x16')]();});}};}function handleEntityNotFound(_0xada51a,_0x45f464){return function(_0x206662){if(!_0x206662){_0xada51a[_0x53ec('0x24')](0x194);}return _0x206662;};}function handleError(_0x28eeac,_0x2064f3){_0x2064f3=_0x2064f3||0x1f4;return function(_0x54d566){logger[_0x53ec('0x25')](_0x54d566[_0x53ec('0x26')]);if(_0x54d566[_0x53ec('0x27')]){delete _0x54d566[_0x53ec('0x27')];}_0x28eeac[_0x53ec('0x17')](_0x2064f3)[_0x53ec('0x28')](_0x54d566);};}exports[_0x53ec('0x29')]=function(_0x132d2e,_0x3611a4){var _0xc8e685={},_0x54505a={},_0x364b0a={'count':0x0,'rows':[]};var _0x3e57e6=_[_0x53ec('0x2a')](db[_0x53ec('0x2b')][_0x53ec('0x2c')],function(_0x282f27){return{'name':_0x282f27[_0x53ec('0x2d')],'type':_0x282f27[_0x53ec('0x2e')]['key']};});_0x54505a[_0x53ec('0x2f')]=_[_0x53ec('0x2a')](_0x3e57e6,_0x53ec('0x27'));_0x54505a[_0x53ec('0x30')]=_[_0x53ec('0x31')](_0x132d2e[_0x53ec('0x30')]);_0x54505a[_0x53ec('0x32')]=_[_0x53ec('0x33')](_0x54505a[_0x53ec('0x2f')],_0x54505a[_0x53ec('0x30')]);_0xc8e685[_0x53ec('0x34')]=_[_0x53ec('0x33')](_0x54505a[_0x53ec('0x2f')],qs['fields'](_0x132d2e[_0x53ec('0x30')][_0x53ec('0x35')]));_0xc8e685[_0x53ec('0x34')]=_0xc8e685[_0x53ec('0x34')]['length']?_0xc8e685[_0x53ec('0x34')]:_0x54505a[_0x53ec('0x2f')];if(!_0x132d2e[_0x53ec('0x30')][_0x53ec('0x36')](_0x53ec('0x37'))){_0xc8e685[_0x53ec('0x1b')]=qs[_0x53ec('0x1b')](_0x132d2e['query'][_0x53ec('0x1b')]);_0xc8e685[_0x53ec('0x19')]=qs[_0x53ec('0x19')](_0x132d2e[_0x53ec('0x30')][_0x53ec('0x19')]);}_0xc8e685[_0x53ec('0x38')]=qs['sort'](_0x132d2e[_0x53ec('0x30')]['sort']);_0xc8e685[_0x53ec('0x39')]=qs[_0x53ec('0x32')](_[_0x53ec('0x3a')](_0x132d2e['query'],_0x54505a[_0x53ec('0x32')]),_0x3e57e6);if(_0x132d2e[_0x53ec('0x30')][_0x53ec('0x3b')]){_0xc8e685[_0x53ec('0x39')]=_[_0x53ec('0x3c')](_0xc8e685[_0x53ec('0x39')],{'$or':_['map'](_0x3e57e6,function(_0x17c62b){if(_0x17c62b[_0x53ec('0x2e')]!==_0x53ec('0x3d')){var _0x1bec4c={};_0x1bec4c[_0x17c62b[_0x53ec('0x27')]]={'$like':'%'+_0x132d2e[_0x53ec('0x30')][_0x53ec('0x3b')]+'%'};return _0x1bec4c;}})});}_0xc8e685=_[_0x53ec('0x3c')]({},_0xc8e685,_0x132d2e[_0x53ec('0x3e')]);var _0x1de0be={'where':_0xc8e685[_0x53ec('0x39')]};return db[_0x53ec('0x2b')][_0x53ec('0x1c')](_0x1de0be)[_0x53ec('0x22')](function(_0x48731a){_0x364b0a['count']=_0x48731a;if(_0x132d2e['query']['includeAll']){_0xc8e685['include']=[{'all':!![]}];}return db['UserProfileSection'][_0x53ec('0x3f')](_0xc8e685);})['then'](function(_0x196d35){_0x364b0a['rows']=_0x196d35;return _0x364b0a;})[_0x53ec('0x22')](respondWithFilteredResult(_0x3611a4,_0xc8e685))[_0x53ec('0x40')](handleError(_0x3611a4,null));};exports[_0x53ec('0x41')]=function(_0xb490d9,_0x114cc8){var _0x2009e7={'raw':![],'where':{'id':_0xb490d9[_0x53ec('0x42')]['id']}},_0x3487a7={};_0x3487a7[_0x53ec('0x2f')]=_[_0x53ec('0x31')](db['UserProfileSection'][_0x53ec('0x2c')]);_0x3487a7[_0x53ec('0x30')]=_[_0x53ec('0x31')](_0xb490d9[_0x53ec('0x30')]);_0x3487a7['filters']=_[_0x53ec('0x33')](_0x3487a7[_0x53ec('0x2f')],_0x3487a7['query']);_0x2009e7[_0x53ec('0x34')]=_[_0x53ec('0x33')](_0x3487a7[_0x53ec('0x2f')],qs[_0x53ec('0x35')](_0xb490d9['query'][_0x53ec('0x35')]));_0x2009e7[_0x53ec('0x34')]=_0x2009e7[_0x53ec('0x34')][_0x53ec('0x43')]?_0x2009e7['attributes']:_0x3487a7[_0x53ec('0x2f')];if(_0xb490d9[_0x53ec('0x30')]['includeAll']){_0x2009e7[_0x53ec('0x44')]=[{'all':!![]}];}_0x2009e7=_[_0x53ec('0x3c')]({},_0x2009e7,_0xb490d9[_0x53ec('0x3e')]);return db[_0x53ec('0x2b')][_0x53ec('0x45')](_0x2009e7)[_0x53ec('0x22')](handleEntityNotFound(_0x114cc8,null))[_0x53ec('0x22')](respondWithResult(_0x114cc8,null))[_0x53ec('0x40')](handleError(_0x114cc8,null));};exports[_0x53ec('0x46')]=function(_0x774f52,_0xefa194){return db[_0x53ec('0x2b')]['create'](_0x774f52[_0x53ec('0x47')],{})[_0x53ec('0x22')](respondWithResult(_0xefa194,0xc9))[_0x53ec('0x40')](handleError(_0xefa194,null));};exports[_0x53ec('0x48')]=function(_0x21f6f4,_0x5ead96){if(_0x21f6f4[_0x53ec('0x47')]['id']){delete _0x21f6f4[_0x53ec('0x47')]['id'];}return db[_0x53ec('0x2b')][_0x53ec('0x45')]({'where':{'id':_0x21f6f4[_0x53ec('0x42')]['id']}})[_0x53ec('0x22')](handleEntityNotFound(_0x5ead96,null))[_0x53ec('0x22')](saveUpdates(_0x21f6f4[_0x53ec('0x47')],null))['then'](respondWithResult(_0x5ead96,null))[_0x53ec('0x40')](handleError(_0x5ead96,null));};exports[_0x53ec('0x23')]=function(_0x402ff3,_0x53fd19){return db[_0x53ec('0x2b')][_0x53ec('0x45')]({'where':{'id':_0x402ff3[_0x53ec('0x42')]['id']}})['then'](handleEntityNotFound(_0x53fd19,null))['then'](removeEntity(_0x53fd19,null))[_0x53ec('0x40')](handleError(_0x53fd19,null));};exports[_0x53ec('0x49')]=function(_0x3ecd70,_0x304428){return db[_0x53ec('0x2b')]['describe']()[_0x53ec('0x22')](respondWithResult(_0x304428,null))[_0x53ec('0x40')](handleError(_0x304428,null));}; \ No newline at end of file +var _0x75d2=['desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','error','stack','name','map','UserProfileSection','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','length','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto'];(function(_0x44e04f,_0x31968c){var _0x479aca=function(_0x5b3d9a){while(--_0x5b3d9a){_0x44e04f['push'](_0x44e04f['shift']());}};_0x479aca(++_0x31968c);}(_0x75d2,0x1ea));var _0x275d=function(_0x406115,_0x19f7a1){_0x406115=_0x406115-0x0;var _0xbbabdb=_0x75d2[_0x406115];return _0xbbabdb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x275d('0x0'));var zipdir=require(_0x275d('0x1'));var jsonpatch=require(_0x275d('0x2'));var rp=require(_0x275d('0x3'));var moment=require(_0x275d('0x4'));var BPromise=require(_0x275d('0x5'));var Mustache=require(_0x275d('0x6'));var util=require(_0x275d('0x7'));var path=require(_0x275d('0x8'));var sox=require(_0x275d('0x9'));var csv=require(_0x275d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x275d('0xb'));var _=require('lodash');var squel=require(_0x275d('0xc'));var crypto=require(_0x275d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x275d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x275d('0xf'));var Papa=require(_0x275d('0x10'));var Redis=require(_0x275d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x275d('0x12'));var as=require(_0x275d('0x13'));var hardwareService=require(_0x275d('0x14'));var logger=require('../../config/logger')(_0x275d('0x15'));var utils=require(_0x275d('0x16'));var config=require(_0x275d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x275d('0x18'))['db'];function respondWithStatusCode(_0x399449,_0x9bad07){_0x9bad07=_0x9bad07||0xcc;return function(_0x56ae3f){if(_0x56ae3f){return _0x399449[_0x275d('0x19')](_0x9bad07);}return _0x399449[_0x275d('0x1a')](_0x9bad07)[_0x275d('0x1b')]();};}function respondWithResult(_0x26fb07,_0x28e52e){_0x28e52e=_0x28e52e||0xc8;return function(_0x65c27f){if(_0x65c27f){return _0x26fb07[_0x275d('0x1a')](_0x28e52e)['json'](_0x65c27f);}};}function respondWithFilteredResult(_0x4c61ef,_0x4f79f9){return function(_0x49fbfa){if(_0x49fbfa){var _0x12dc1a=typeof _0x4f79f9[_0x275d('0x1c')]===_0x275d('0x1d')&&typeof _0x4f79f9[_0x275d('0x1e')]==='undefined';var _0x4e0b12=_0x49fbfa[_0x275d('0x1f')];var _0x25600d=_0x12dc1a?0x0:_0x4f79f9['offset'];var _0x4e12cf=_0x12dc1a?_0x49fbfa['count']:_0x4f79f9[_0x275d('0x1c')]+_0x4f79f9[_0x275d('0x1e')];var _0x5a5ad9;if(_0x4e12cf>=_0x4e0b12){_0x4e12cf=_0x4e0b12;_0x5a5ad9=0xc8;}else{_0x5a5ad9=0xce;}_0x4c61ef[_0x275d('0x1a')](_0x5a5ad9);return _0x4c61ef['set'](_0x275d('0x20'),_0x25600d+'-'+_0x4e12cf+'/'+_0x4e0b12)['json'](_0x49fbfa);}return null;};}function patchUpdates(_0x1bf741){return function(_0x4f6602){try{jsonpatch[_0x275d('0x21')](_0x4f6602,_0x1bf741,!![]);}catch(_0xef5f10){return BPromise['reject'](_0xef5f10);}return _0x4f6602['save']();};}function saveUpdates(_0x5765d3,_0x10e696){return function(_0x46bb09){if(_0x46bb09){return _0x46bb09[_0x275d('0x22')](_0x5765d3)[_0x275d('0x23')](function(_0x327eb2){return _0x327eb2;});}return null;};}function removeEntity(_0x593382,_0x26f392){return function(_0x2f05dd){if(_0x2f05dd){return _0x2f05dd[_0x275d('0x24')]()[_0x275d('0x23')](function(){_0x593382[_0x275d('0x1a')](0xcc)[_0x275d('0x1b')]();});}};}function handleEntityNotFound(_0x3b2577,_0x44dd23){return function(_0x394f6a){if(!_0x394f6a){_0x3b2577['sendStatus'](0x194);}return _0x394f6a;};}function handleError(_0x50aeeb,_0xef530e){_0xef530e=_0xef530e||0x1f4;return function(_0x5e6a7f){logger[_0x275d('0x25')](_0x5e6a7f[_0x275d('0x26')]);if(_0x5e6a7f[_0x275d('0x27')]){delete _0x5e6a7f[_0x275d('0x27')];}_0x50aeeb[_0x275d('0x1a')](_0xef530e)['send'](_0x5e6a7f);};}exports['index']=function(_0x1c4fd7,_0xbb034){var _0x3e1470={},_0x5b997b={},_0x5979ca={'count':0x0,'rows':[]};var _0x54d766=_[_0x275d('0x28')](db[_0x275d('0x29')]['rawAttributes'],function(_0x4bc792){return{'name':_0x4bc792[_0x275d('0x2a')],'type':_0x4bc792[_0x275d('0x2b')][_0x275d('0x2c')]};});_0x5b997b['model']=_['map'](_0x54d766,_0x275d('0x27'));_0x5b997b[_0x275d('0x2d')]=_[_0x275d('0x2e')](_0x1c4fd7[_0x275d('0x2d')]);_0x5b997b['filters']=_[_0x275d('0x2f')](_0x5b997b[_0x275d('0x30')],_0x5b997b[_0x275d('0x2d')]);_0x3e1470[_0x275d('0x31')]=_[_0x275d('0x2f')](_0x5b997b[_0x275d('0x30')],qs[_0x275d('0x32')](_0x1c4fd7[_0x275d('0x2d')][_0x275d('0x32')]));_0x3e1470[_0x275d('0x31')]=_0x3e1470['attributes']['length']?_0x3e1470[_0x275d('0x31')]:_0x5b997b['model'];if(!_0x1c4fd7['query'][_0x275d('0x33')](_0x275d('0x34'))){_0x3e1470[_0x275d('0x1e')]=qs[_0x275d('0x1e')](_0x1c4fd7['query']['limit']);_0x3e1470['offset']=qs[_0x275d('0x1c')](_0x1c4fd7[_0x275d('0x2d')]['offset']);}_0x3e1470[_0x275d('0x35')]=qs[_0x275d('0x36')](_0x1c4fd7[_0x275d('0x2d')][_0x275d('0x36')]);_0x3e1470[_0x275d('0x37')]=qs[_0x275d('0x38')](_[_0x275d('0x39')](_0x1c4fd7[_0x275d('0x2d')],_0x5b997b[_0x275d('0x38')]),_0x54d766);if(_0x1c4fd7[_0x275d('0x2d')][_0x275d('0x3a')]){_0x3e1470[_0x275d('0x37')]=_['merge'](_0x3e1470['where'],{'$or':_[_0x275d('0x28')](_0x54d766,function(_0x16a2af){if(_0x16a2af[_0x275d('0x2b')]!==_0x275d('0x3b')){var _0x45665c={};_0x45665c[_0x16a2af[_0x275d('0x27')]]={'$like':'%'+_0x1c4fd7[_0x275d('0x2d')][_0x275d('0x3a')]+'%'};return _0x45665c;}})});}_0x3e1470=_[_0x275d('0x3c')]({},_0x3e1470,_0x1c4fd7[_0x275d('0x3d')]);var _0x4f73fa={'where':_0x3e1470['where']};return db[_0x275d('0x29')]['count'](_0x4f73fa)[_0x275d('0x23')](function(_0x4ac2a5){_0x5979ca[_0x275d('0x1f')]=_0x4ac2a5;if(_0x1c4fd7['query'][_0x275d('0x3e')]){_0x3e1470[_0x275d('0x3f')]=[{'all':!![]}];}return db[_0x275d('0x29')][_0x275d('0x40')](_0x3e1470);})[_0x275d('0x23')](function(_0x317bcc){_0x5979ca['rows']=_0x317bcc;return _0x5979ca;})[_0x275d('0x23')](respondWithFilteredResult(_0xbb034,_0x3e1470))[_0x275d('0x41')](handleError(_0xbb034,null));};exports['show']=function(_0x3b6694,_0x7c92cd){var _0x538394={'raw':![],'where':{'id':_0x3b6694[_0x275d('0x42')]['id']}},_0x52fac8={};_0x52fac8[_0x275d('0x30')]=_[_0x275d('0x2e')](db['UserProfileSection']['rawAttributes']);_0x52fac8[_0x275d('0x2d')]=_['keys'](_0x3b6694[_0x275d('0x2d')]);_0x52fac8[_0x275d('0x38')]=_[_0x275d('0x2f')](_0x52fac8['model'],_0x52fac8[_0x275d('0x2d')]);_0x538394['attributes']=_['intersection'](_0x52fac8['model'],qs[_0x275d('0x32')](_0x3b6694[_0x275d('0x2d')]['fields']));_0x538394[_0x275d('0x31')]=_0x538394[_0x275d('0x31')][_0x275d('0x43')]?_0x538394[_0x275d('0x31')]:_0x52fac8[_0x275d('0x30')];if(_0x3b6694[_0x275d('0x2d')]['includeAll']){_0x538394[_0x275d('0x3f')]=[{'all':!![]}];}_0x538394=_['merge']({},_0x538394,_0x3b6694['options']);return db[_0x275d('0x29')][_0x275d('0x44')](_0x538394)[_0x275d('0x23')](handleEntityNotFound(_0x7c92cd,null))[_0x275d('0x23')](respondWithResult(_0x7c92cd,null))[_0x275d('0x41')](handleError(_0x7c92cd,null));};exports[_0x275d('0x45')]=function(_0x4bd13a,_0x29afaf){return db['UserProfileSection']['create'](_0x4bd13a[_0x275d('0x46')],{})['then'](respondWithResult(_0x29afaf,0xc9))[_0x275d('0x41')](handleError(_0x29afaf,null));};exports[_0x275d('0x22')]=function(_0x433737,_0x29c204){if(_0x433737['body']['id']){delete _0x433737[_0x275d('0x46')]['id'];}return db['UserProfileSection'][_0x275d('0x44')]({'where':{'id':_0x433737['params']['id']}})[_0x275d('0x23')](handleEntityNotFound(_0x29c204,null))['then'](saveUpdates(_0x433737[_0x275d('0x46')],null))[_0x275d('0x23')](respondWithResult(_0x29c204,null))['catch'](handleError(_0x29c204,null));};exports[_0x275d('0x24')]=function(_0x145479,_0x7b3f52){return db[_0x275d('0x29')][_0x275d('0x44')]({'where':{'id':_0x145479[_0x275d('0x42')]['id']}})[_0x275d('0x23')](handleEntityNotFound(_0x7b3f52,null))[_0x275d('0x23')](removeEntity(_0x7b3f52,null))[_0x275d('0x41')](handleError(_0x7b3f52,null));};exports[_0x275d('0x47')]=function(_0x83d3f1,_0x33f8aa){return db[_0x275d('0x29')][_0x275d('0x47')]()[_0x275d('0x23')](respondWithResult(_0x33f8aa,null))['catch'](handleError(_0x33f8aa,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 020b844..e02faff 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 _0x3cc7=['util','../../config/logger','api','moment','request-promise','rimraf','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','lodash'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x3cc7,0x11f));var _0x73cc=function(_0x1e381c,_0x47b5b9){_0x1e381c=_0x1e381c-0x0;var _0x9b5ea9=_0x3cc7[_0x1e381c];return _0x9b5ea9;};'use strict';var _=require(_0x73cc('0x0'));var util=require(_0x73cc('0x1'));var logger=require(_0x73cc('0x2'))(_0x73cc('0x3'));var moment=require(_0x73cc('0x4'));var BPromise=require('bluebird');var rp=require(_0x73cc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x73cc('0x6'));var config=require('../../config/environment');var attributes=require(_0x73cc('0x7'));module[_0x73cc('0x8')]=function(_0x343002,_0x5daec4){return _0x343002[_0x73cc('0x9')](_0x73cc('0xa'),attributes,{'tableName':_0x73cc('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId','userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x29e1=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','lodash'];(function(_0x2d460c,_0x4f08c0){var _0xf6fc4c=function(_0x4fb81c){while(--_0x4fb81c){_0x2d460c['push'](_0x2d460c['shift']());}};_0xf6fc4c(++_0x4f08c0);}(_0x29e1,0xe0));var _0x129e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29e1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x129e('0x0'));var util=require(_0x129e('0x1'));var logger=require('../../config/logger')(_0x129e('0x2'));var moment=require('moment');var BPromise=require(_0x129e('0x3'));var rp=require(_0x129e('0x4'));var fs=require('fs');var path=require(_0x129e('0x5'));var rimraf=require(_0x129e('0x6'));var config=require(_0x129e('0x7'));var attributes=require(_0x129e('0x8'));module[_0x129e('0x9')]=function(_0x211d13,_0x458835){return _0x211d13[_0x129e('0xa')](_0x129e('0xb'),attributes,{'tableName':_0x129e('0xc'),'paranoid':![],'indexes':[{'name':_0x129e('0xd'),'fields':['sectionId',_0x129e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index caabd84..e799117 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 _0x5434=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','util','moment','bluebird'];(function(_0x8a14d8,_0x416faf){var _0x3fdcf3=function(_0x3bfd12){while(--_0x3bfd12){_0x8a14d8['push'](_0x8a14d8['shift']());}};_0x3fdcf3(++_0x416faf);}(_0x5434,0x105));var _0x4543=function(_0x2de031,_0x27f624){_0x2de031=_0x2de031-0x0;var _0x28a7d2=_0x5434[_0x2de031];return _0x28a7d2;};'use strict';var _=require('lodash');var util=require(_0x4543('0x0'));var moment=require(_0x4543('0x1'));var BPromise=require(_0x4543('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4543('0x3'));var db=require(_0x4543('0x4'))['db'];var utils=require(_0x4543('0x5'));var logger=require(_0x4543('0x6'))(_0x4543('0x7'));var config=require(_0x4543('0x8'));var jayson=require(_0x4543('0x9'));var client=jayson['client'][_0x4543('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x101db0,_0x44a653,_0xea67fa){return new BPromise(function(_0x318d48,_0x46c8ce){return client['request'](_0x101db0,_0xea67fa)[_0x4543('0xb')](function(_0x5264ce){logger['info'](_0x4543('0xc'),_0x44a653,'request\x20sent');logger[_0x4543('0xd')](_0x4543('0xe'),_0x44a653,_0x4543('0xf'),JSON[_0x4543('0x10')](_0x5264ce));if(_0x5264ce['error']){if(_0x5264ce[_0x4543('0x11')]['code']===0x1f4){logger[_0x4543('0x11')](_0x4543('0xc'),_0x44a653,_0x5264ce['error'][_0x4543('0x12')]);return _0x46c8ce(_0x5264ce[_0x4543('0x11')][_0x4543('0x12')]);}logger[_0x4543('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x44a653,_0x5264ce[_0x4543('0x11')][_0x4543('0x12')]);return _0x318d48(_0x5264ce[_0x4543('0x11')][_0x4543('0x12')]);}else{logger[_0x4543('0x13')](_0x4543('0xc'),_0x44a653,_0x4543('0xf'));_0x318d48(_0x5264ce[_0x4543('0x14')][_0x4543('0x12')]);}})[_0x4543('0x15')](function(_0x3d6cb5){logger['error'](_0x4543('0xc'),_0x44a653,_0x3d6cb5);_0x46c8ce(_0x3d6cb5);});});} \ No newline at end of file +var _0x0384=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment'];(function(_0x48fe57,_0x5f007c){var _0x33c1a4=function(_0x433ff6){while(--_0x433ff6){_0x48fe57['push'](_0x48fe57['shift']());}};_0x33c1a4(++_0x5f007c);}(_0x0384,0x1e2));var _0x4038=function(_0x2837d0,_0x1e2d59){_0x2837d0=_0x2837d0-0x0;var _0x109486=_0x0384[_0x2837d0];return _0x109486;};'use strict';var _=require(_0x4038('0x0'));var util=require('util');var moment=require(_0x4038('0x1'));var BPromise=require(_0x4038('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4038('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4038('0x4'));var logger=require(_0x4038('0x5'))(_0x4038('0x6'));var config=require(_0x4038('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4038('0x8')][_0x4038('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4556d6,_0x5a9146,_0x1623d1){return new BPromise(function(_0x2ab7e8,_0x4855be){return client[_0x4038('0xa')](_0x4556d6,_0x1623d1)[_0x4038('0xb')](function(_0xa03043){logger[_0x4038('0xc')](_0x4038('0xd'),_0x5a9146,_0x4038('0xe'));logger['debug'](_0x4038('0xf'),_0x5a9146,'request\x20sent',JSON[_0x4038('0x10')](_0xa03043));if(_0xa03043[_0x4038('0x11')]){if(_0xa03043[_0x4038('0x11')][_0x4038('0x12')]===0x1f4){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x5a9146,_0xa03043['error'][_0x4038('0x13')]);return _0x4855be(_0xa03043['error'][_0x4038('0x13')]);}logger[_0x4038('0x11')](_0x4038('0xd'),_0x5a9146,_0xa03043[_0x4038('0x11')][_0x4038('0x13')]);return _0x2ab7e8(_0xa03043['error'][_0x4038('0x13')]);}else{logger[_0x4038('0xc')](_0x4038('0xd'),_0x5a9146,_0x4038('0xe'));_0x2ab7e8(_0xa03043[_0x4038('0x14')]['message']);}})[_0x4038('0x15')](function(_0x4cfe73){logger[_0x4038('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x5a9146,_0x4cfe73);_0x4855be(_0x4cfe73);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 627e243..01a7d87 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3e2ac7,_0x5ecfed){var _0xa9af6f=function(_0x45f2b6){while(--_0x45f2b6){_0x3e2ac7['push'](_0x3e2ac7['shift']());}};_0xa9af6f(++_0x5ecfed);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4eafed,_0x26e2bc){_0x4eafed=_0x4eafed-0x0;var _0x159c85=_0xcb91[_0x4eafed];return _0x159c85;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2bcc87,_0x937b46){var _0x42e86e=function(_0x5db555){while(--_0x5db555){_0x2bcc87['push'](_0x2bcc87['shift']());}};_0x42e86e(++_0x937b46);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 9cd6f57..c2adfb7 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 _0xc9c7=['INTEGER','sequelize'];(function(_0x261abd,_0x2f2e52){var _0x345c8e=function(_0x5841ee){while(--_0x5841ee){_0x261abd['push'](_0x261abd['shift']());}};_0x345c8e(++_0x2f2e52);}(_0xc9c7,0x16d));var _0x7c9c=function(_0x264054,_0x9e7673){_0x264054=_0x264054-0x0;var _0x3754e2=_0xc9c7[_0x264054];return _0x3754e2;};'use strict';var Sequelize=require(_0x7c9c('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x7c9c('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd845=['INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd845,0x1e1));var _0x5d84=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xd845[_0x25bea7];return _0x175952;};'use strict';var Sequelize=require(_0x5d84('0x0'));module[_0x5d84('0x1')]={'penalty':{'type':Sequelize[_0x5d84('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 96be5af..844db6a 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 _0x4bd3=['exports','define','UserSmsQueue','lodash','../../config/logger','api','path','rimraf','../../config/environment'];(function(_0x5a0e70,_0x520112){var _0x69ae46=function(_0x9a6b97){while(--_0x9a6b97){_0x5a0e70['push'](_0x5a0e70['shift']());}};_0x69ae46(++_0x520112);}(_0x4bd3,0x174));var _0x34bd=function(_0x22d3c7,_0x3c7255){_0x22d3c7=_0x22d3c7-0x0;var _0x594349=_0x4bd3[_0x22d3c7];return _0x594349;};'use strict';var _=require(_0x34bd('0x0'));var util=require('util');var logger=require(_0x34bd('0x1'))(_0x34bd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x34bd('0x3'));var rimraf=require(_0x34bd('0x4'));var config=require(_0x34bd('0x5'));var attributes=require('./userSmsQueue.attributes');module[_0x34bd('0x6')]=function(_0x2a15a2,_0x5c2a7a){return _0x2a15a2[_0x34bd('0x7')](_0x34bd('0x8'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x82d8=['define','UserSmsQueue','user_has_sms_queues','lodash','../../config/logger','bluebird','path','./userSmsQueue.attributes','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x82d8,0xff));var _0x882d=function(_0x1f3d5a,_0x49f219){_0x1f3d5a=_0x1f3d5a-0x0;var _0x426265=_0x82d8[_0x1f3d5a];return _0x426265;};'use strict';var _=require(_0x882d('0x0'));var util=require('util');var logger=require(_0x882d('0x1'))('api');var moment=require('moment');var BPromise=require(_0x882d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x882d('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x882d('0x4'));module[_0x882d('0x5')]=function(_0x19f644,_0xa928f7){return _0x19f644[_0x882d('0x6')](_0x882d('0x7'),attributes,{'tableName':_0x882d('0x8'),'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 0bbc87c..9a0946d 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 _0x3aed=['UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserSmsQueue,\x20%s,\x20%s','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug'];(function(_0x3a32af,_0x14914f){var _0x1c5754=function(_0x3ef5c7){while(--_0x3ef5c7){_0x3a32af['push'](_0x3a32af['shift']());}};_0x1c5754(++_0x14914f);}(_0x3aed,0xa1));var _0xd3ae=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x3aed[_0x409353];return _0x4f4b59;};'use strict';var _=require(_0xd3ae('0x0'));var util=require('util');var moment=require(_0xd3ae('0x1'));var BPromise=require(_0xd3ae('0x2'));var rs=require(_0xd3ae('0x3'));var fs=require('fs');var Redis=require(_0xd3ae('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd3ae('0x5'));var logger=require(_0xd3ae('0x6'))(_0xd3ae('0x7'));var config=require(_0xd3ae('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd3ae('0x9')][_0xd3ae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ee45f,_0x15c59a,_0x577750){return new BPromise(function(_0x51f0bb,_0x2afb29){return client['request'](_0x1ee45f,_0x577750)[_0xd3ae('0xb')](function(_0x3d53fd){logger[_0xd3ae('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x15c59a,_0xd3ae('0xd'));logger[_0xd3ae('0xe')](_0xd3ae('0xf'),_0x15c59a,'request\x20sent',JSON[_0xd3ae('0x10')](_0x3d53fd));if(_0x3d53fd[_0xd3ae('0x11')]){if(_0x3d53fd['error'][_0xd3ae('0x12')]===0x1f4){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x15c59a,_0x3d53fd[_0xd3ae('0x11')][_0xd3ae('0x13')]);return _0x2afb29(_0x3d53fd['error']['message']);}logger['error'](_0xd3ae('0x14'),_0x15c59a,_0x3d53fd[_0xd3ae('0x11')][_0xd3ae('0x13')]);return _0x51f0bb(_0x3d53fd[_0xd3ae('0x11')][_0xd3ae('0x13')]);}else{logger[_0xd3ae('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x15c59a,'request\x20sent');_0x51f0bb(_0x3d53fd['result'][_0xd3ae('0x13')]);}})[_0xd3ae('0x15')](function(_0x5c884e){logger[_0xd3ae('0x11')](_0xd3ae('0x14'),_0x15c59a,_0x5c884e);_0x2afb29(_0x5c884e);});});} \ No newline at end of file +var _0x6f34=['UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xc235e7,_0x2889cb){var _0x5128f1=function(_0x3ea353){while(--_0x3ea353){_0xc235e7['push'](_0xc235e7['shift']());}};_0x5128f1(++_0x2889cb);}(_0x6f34,0x132));var _0x46f3=function(_0x2bc4c0,_0x517b27){_0x2bc4c0=_0x2bc4c0-0x0;var _0x10b80a=_0x6f34[_0x2bc4c0];return _0x10b80a;};'use strict';var _=require(_0x46f3('0x0'));var util=require(_0x46f3('0x1'));var moment=require(_0x46f3('0x2'));var BPromise=require(_0x46f3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x46f3('0x4'));var db=require(_0x46f3('0x5'))['db'];var utils=require(_0x46f3('0x6'));var logger=require('../../config/logger')(_0x46f3('0x7'));var config=require('../../config/environment');var jayson=require(_0x46f3('0x8'));var client=jayson['client'][_0x46f3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x419839,_0x5a5bde,_0x1f397e){return new BPromise(function(_0x24d11c,_0x1af47d){return client[_0x46f3('0xa')](_0x419839,_0x1f397e)[_0x46f3('0xb')](function(_0x113d94){logger[_0x46f3('0xc')](_0x46f3('0xd'),_0x5a5bde,_0x46f3('0xe'));logger[_0x46f3('0xf')](_0x46f3('0x10'),_0x5a5bde,_0x46f3('0xe'),JSON[_0x46f3('0x11')](_0x113d94));if(_0x113d94[_0x46f3('0x12')]){if(_0x113d94['error'][_0x46f3('0x13')]===0x1f4){logger['error'](_0x46f3('0xd'),_0x5a5bde,_0x113d94[_0x46f3('0x12')][_0x46f3('0x14')]);return _0x1af47d(_0x113d94[_0x46f3('0x12')][_0x46f3('0x14')]);}logger[_0x46f3('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x5a5bde,_0x113d94[_0x46f3('0x12')]['message']);return _0x24d11c(_0x113d94[_0x46f3('0x12')][_0x46f3('0x14')]);}else{logger[_0x46f3('0xc')](_0x46f3('0xd'),_0x5a5bde,_0x46f3('0xe'));_0x24d11c(_0x113d94[_0x46f3('0x15')][_0x46f3('0x14')]);}})[_0x46f3('0x16')](function(_0x4417cf){logger[_0x46f3('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x5a5bde,_0x4417cf);_0x1af47d(_0x4417cf);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index e6e356b..cc9498c 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 _0xd5c8=['exports','sequelize'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xd5c8,0x193));var _0x8d5c=function(_0x5cca9f,_0x154684){_0x5cca9f=_0x5cca9f-0x0;var _0x55edda=_0xd5c8[_0x5cca9f];return _0x55edda;};'use strict';var Sequelize=require(_0x8d5c('0x0'));module[_0x8d5c('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xf24f=['sequelize','INTEGER'];(function(_0x2a6e86,_0x5d6e59){var _0x2a428c=function(_0x40490e){while(--_0x40490e){_0x2a6e86['push'](_0x2a6e86['shift']());}};_0x2a428c(++_0x5d6e59);}(_0xf24f,0x108));var _0xff24=function(_0x2906e6,_0x5ccd59){_0x2906e6=_0x2906e6-0x0;var _0x12517a=_0xf24f[_0x2906e6];return _0x12517a;};'use strict';var Sequelize=require(_0xff24('0x0'));module['exports']={'UserId':{'type':Sequelize[_0xff24('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xff24('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index ca39882..e11bd31 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(_0x1d492b,_0x43b3d1){var _0x385bb4=function(_0x2deb23){while(--_0x2deb23){_0x1d492b['push'](_0x1d492b['shift']());}};_0x385bb4(++_0x43b3d1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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(_0x1f1653,_0x464d80){var _0x35ed6b=function(_0x410485){while(--_0x410485){_0x1f1653['push'](_0x1f1653['shift']());}};_0x35ed6b(++_0x464d80);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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 be3c275..4d13153 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xabcaf7,_0x5dea8c){var _0x389851=function(_0x34dc0d){while(--_0x34dc0d){_0xabcaf7['push'](_0xabcaf7['shift']());}};_0x389851(++_0x5dea8c);}(_0xe706,0xa3));var _0x6e70=function(_0x2c8350,_0x5126ed){_0x2c8350=_0x2c8350-0x0;var _0x4d5530=_0xe706[_0x2c8350];return _0x4d5530;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x431164,_0x513537){var _0x52d1ec=function(_0x2a403d){while(--_0x2a403d){_0x431164['push'](_0x431164['shift']());}};_0x52d1ec(++_0x513537);}(_0x70e0,0x17b));var _0x070e=function(_0x14c025,_0x50e5f9){_0x14c025=_0x14c025-0x0;var _0xa60410=_0x70e0[_0x14c025];return _0xa60410;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 147cb99..1b245a7 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 _0xd78e=['INTEGER','exports'];(function(_0x13794e,_0x3ceaa1){var _0x4bac6e=function(_0x2a1357){while(--_0x2a1357){_0x13794e['push'](_0x13794e['shift']());}};_0x4bac6e(++_0x3ceaa1);}(_0xd78e,0x19b));var _0xed78=function(_0x18d5d7,_0x19074b){_0x18d5d7=_0x18d5d7-0x0;var _0x30a9ea=_0xd78e[_0x18d5d7];return _0x30a9ea;};'use strict';var Sequelize=require('sequelize');module[_0xed78('0x0')]={'penalty':{'type':Sequelize[_0xed78('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2f17=['INTEGER','sequelize','exports'];(function(_0x651fde,_0x5ad1e7){var _0x534525=function(_0x33689f){while(--_0x33689f){_0x651fde['push'](_0x651fde['shift']());}};_0x534525(++_0x5ad1e7);}(_0x2f17,0x1f0));var _0x72f1=function(_0x5125f6,_0x78ec92){_0x5125f6=_0x5125f6-0x0;var _0x47e6ee=_0x2f17[_0x5125f6];return _0x47e6ee;};'use strict';var Sequelize=require(_0x72f1('0x0'));module[_0x72f1('0x1')]={'penalty':{'type':Sequelize[_0x72f1('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 41fd35e..7aec1cc 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 _0xd2b7=['request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger'];(function(_0x5e8ad0,_0x203209){var _0x202e84=function(_0x179af8){while(--_0x179af8){_0x5e8ad0['push'](_0x5e8ad0['shift']());}};_0x202e84(++_0x203209);}(_0xd2b7,0xa7));var _0x7d2b=function(_0xaf025d,_0x586d7a){_0xaf025d=_0xaf025d-0x0;var _0x1c77cb=_0xd2b7[_0xaf025d];return _0x1c77cb;};'use strict';var _=require(_0x7d2b('0x0'));var util=require(_0x7d2b('0x1'));var logger=require(_0x7d2b('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7d2b('0x3'));var fs=require('fs');var path=require(_0x7d2b('0x4'));var rimraf=require(_0x7d2b('0x5'));var config=require(_0x7d2b('0x6'));var attributes=require(_0x7d2b('0x7'));module['exports']=function(_0x289d1f,_0x5ed9df){return _0x289d1f['define'](_0x7d2b('0x8'),attributes,{'tableName':_0x7d2b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfebb=['bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueue.attributes','define','user_has_voice_queues','lodash','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfebb,0x115));var _0xbfeb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfebb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbfeb('0x0'));var util=require('util');var logger=require(_0xbfeb('0x1'))(_0xbfeb('0x2'));var moment=require('moment');var BPromise=require(_0xbfeb('0x3'));var rp=require(_0xbfeb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbfeb('0x5'));var config=require(_0xbfeb('0x6'));var attributes=require(_0xbfeb('0x7'));module['exports']=function(_0x6ceea5,_0x2a049b){return _0x6ceea5[_0xbfeb('0x8')]('UserVoiceQueue',attributes,{'tableName':_0xbfeb('0x9'),'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 ac95b73..6d7e7c0 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 _0xc3a5=['message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1c3370,_0xf617e8){var _0xa9b358=function(_0x39cb44){while(--_0x39cb44){_0x1c3370['push'](_0x1c3370['shift']());}};_0xa9b358(++_0xf617e8);}(_0xc3a5,0x1d2));var _0x5c3a=function(_0x4207e3,_0x49ff32){_0x4207e3=_0x4207e3-0x0;var _0x5277b8=_0xc3a5[_0x4207e3];return _0x5277b8;};'use strict';var _=require(_0x5c3a('0x0'));var util=require(_0x5c3a('0x1'));var moment=require(_0x5c3a('0x2'));var BPromise=require('bluebird');var rs=require(_0x5c3a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5c3a('0x4'))['db'];var utils=require(_0x5c3a('0x5'));var logger=require('../../config/logger')(_0x5c3a('0x6'));var config=require(_0x5c3a('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5c3a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51b71a,_0x4aa3ed,_0x397330){return new BPromise(function(_0x3f1712,_0x11c000){return client[_0x5c3a('0x9')](_0x51b71a,_0x397330)[_0x5c3a('0xa')](function(_0xf57893){logger['info'](_0x5c3a('0xb'),_0x4aa3ed,_0x5c3a('0xc'));logger[_0x5c3a('0xd')](_0x5c3a('0xe'),_0x4aa3ed,_0x5c3a('0xc'),JSON[_0x5c3a('0xf')](_0xf57893));if(_0xf57893['error']){if(_0xf57893[_0x5c3a('0x10')]['code']===0x1f4){logger[_0x5c3a('0x10')](_0x5c3a('0xb'),_0x4aa3ed,_0xf57893[_0x5c3a('0x10')][_0x5c3a('0x11')]);return _0x11c000(_0xf57893[_0x5c3a('0x10')][_0x5c3a('0x11')]);}logger[_0x5c3a('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x4aa3ed,_0xf57893[_0x5c3a('0x10')][_0x5c3a('0x11')]);return _0x3f1712(_0xf57893[_0x5c3a('0x10')][_0x5c3a('0x11')]);}else{logger[_0x5c3a('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x4aa3ed,_0x5c3a('0xc'));_0x3f1712(_0xf57893[_0x5c3a('0x13')][_0x5c3a('0x11')]);}})[_0x5c3a('0x14')](function(_0x3bc20b){logger[_0x5c3a('0x10')](_0x5c3a('0xb'),_0x4aa3ed,_0x3bc20b);_0x11c000(_0x3bc20b);});});} \ No newline at end of file +var _0x7286=['stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','client','http','info','request\x20sent','debug'];(function(_0x2e3f38,_0x2b3a39){var _0x27e32d=function(_0x4c9cba){while(--_0x4c9cba){_0x2e3f38['push'](_0x2e3f38['shift']());}};_0x27e32d(++_0x2b3a39);}(_0x7286,0xbb));var _0x6728=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x7286[_0x29d94e];return _0x106237;};'use strict';var _=require('lodash');var util=require(_0x6728('0x0'));var moment=require(_0x6728('0x1'));var BPromise=require(_0x6728('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6728('0x3'))['db'];var utils=require(_0x6728('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x6728('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x6728('0x6')][_0x6728('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x10f6c6,_0x3cd192,_0x54a23b){return new BPromise(function(_0x47803a,_0x2bb78d){return client['request'](_0x10f6c6,_0x54a23b)['then'](function(_0x7a4f08){logger[_0x6728('0x8')]('UserVoiceQueue,\x20%s,\x20%s',_0x3cd192,_0x6728('0x9'));logger[_0x6728('0xa')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x3cd192,_0x6728('0x9'),JSON[_0x6728('0xb')](_0x7a4f08));if(_0x7a4f08[_0x6728('0xc')]){if(_0x7a4f08['error'][_0x6728('0xd')]===0x1f4){logger[_0x6728('0xc')](_0x6728('0xe'),_0x3cd192,_0x7a4f08[_0x6728('0xc')][_0x6728('0xf')]);return _0x2bb78d(_0x7a4f08[_0x6728('0xc')][_0x6728('0xf')]);}logger['error'](_0x6728('0xe'),_0x3cd192,_0x7a4f08[_0x6728('0xc')]['message']);return _0x47803a(_0x7a4f08[_0x6728('0xc')][_0x6728('0xf')]);}else{logger[_0x6728('0x8')](_0x6728('0xe'),_0x3cd192,'request\x20sent');_0x47803a(_0x7a4f08[_0x6728('0x10')][_0x6728('0xf')]);}})[_0x6728('0x11')](function(_0x4917b4){logger[_0x6728('0xc')](_0x6728('0xe'),_0x3cd192,_0x4917b4);_0x2bb78d(_0x4917b4);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 8f4bf53..86fc684 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x25b830,_0x1b0b50){var _0x42a947=function(_0x3380b2){while(--_0x3380b2){_0x25b830['push'](_0x25b830['shift']());}};_0x42a947(++_0x1b0b50);}(_0xe706,0xa3));var _0x6e70=function(_0x12fec1,_0x20be9c){_0x12fec1=_0x12fec1-0x0;var _0x26c3af=_0xe706[_0x12fec1];return _0x26c3af;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5a6ef9,_0x1c56d3){var _0x133ba2=function(_0x556eea){while(--_0x556eea){_0x5a6ef9['push'](_0x5a6ef9['shift']());}};_0x133ba2(++_0x1c56d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('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 baea584..b22080f 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 _0xa793=['INTEGER','queue_interface','exports','Required\x20by\x20Asterisk','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa793,0x101));var _0x3a79=function(_0x2caaef,_0x3c19ed){_0x2caaef=_0x2caaef-0x0;var _0xd011f8=_0xa793[_0x2caaef];return _0xd011f8;};'use strict';var Sequelize=require('sequelize');module[_0x3a79('0x0')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x3a79('0x1')},'membername':{'type':Sequelize[_0x3a79('0x2')],'allowNull':![],'comment':_0x3a79('0x1')},'UserId':{'type':Sequelize[_0x3a79('0x3')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x3a79('0x2')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x3a79('0x3')],'allowNull':![]},'interface':{'type':Sequelize[_0x3a79('0x2')],'allowNull':![],'unique':_0x3a79('0x4'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x3a79('0x3')](0xb),'defaultValue':0x0,'comment':_0x3a79('0x1')},'paused':{'type':Sequelize[_0x3a79('0x3')](0xb),'defaultValue':0x0,'comment':_0x3a79('0x1')}}; \ No newline at end of file +var _0x2e7e=['queue_interface','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x5f0a07,_0x22f141){var _0xa183e5=function(_0xd6923e){while(--_0xd6923e){_0x5f0a07['push'](_0x5f0a07['shift']());}};_0xa183e5(++_0x22f141);}(_0x2e7e,0xce));var _0xe2e7=function(_0x4212c9,_0x26c526){_0x4212c9=_0x4212c9-0x0;var _0x6b7476=_0x2e7e[_0x4212c9];return _0x6b7476;};'use strict';var Sequelize=require('sequelize');module[_0xe2e7('0x0')]={'uniqueid':{'type':Sequelize[_0xe2e7('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xe2e7('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0xe2e7('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xe2e7('0x3')],'allowNull':![],'unique':_0xe2e7('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xe2e7('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0xe2e7('0x3')],'allowNull':![],'unique':_0xe2e7('0x4'),'comment':_0xe2e7('0x2')},'penalty':{'type':Sequelize[_0xe2e7('0x1')](0xb),'defaultValue':0x0,'comment':_0xe2e7('0x2')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xe2e7('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 95973db..46ef283 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 _0xa46a=['hook','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit'];(function(_0x550e29,_0x4047f){var _0x3515b6=function(_0x303fe2){while(--_0x303fe2){_0x550e29['push'](_0x550e29['shift']());}};_0x3515b6(++_0x4047f);}(_0xa46a,0x184));var _0xaa46=function(_0x4ebdf4,_0x57d47f){_0x4ebdf4=_0x4ebdf4-0x0;var _0x18d1c1=_0xa46a[_0x4ebdf4];return _0x18d1c1;};'use strict';var EventEmitter=require(_0xaa46('0x0'));var UserVoiceQueueRt=require(_0xaa46('0x1'))['db'][_0xaa46('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xaa46('0x3')](0x0);var events={'afterCreate':_0xaa46('0x4'),'afterUpdate':_0xaa46('0x5'),'afterDestroy':_0xaa46('0x6')};function emitEvent(_0x4d9cdb){return function(_0x43e0a8,_0x21dd38,_0x22940f){UserVoiceQueueRtEvents[_0xaa46('0x7')](_0x4d9cdb+':'+_0x43e0a8['id'],_0x43e0a8);UserVoiceQueueRtEvents[_0xaa46('0x7')](_0x4d9cdb,_0x43e0a8);_0x22940f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xaa46('0x8')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xada4=['../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','remove','emit','exports','events'];(function(_0x2680e3,_0x243387){var _0x3e789f=function(_0x487950){while(--_0x487950){_0x2680e3['push'](_0x2680e3['shift']());}};_0x3e789f(++_0x243387);}(_0xada4,0x77));var _0x4ada=function(_0x35906e,_0x3fd538){_0x35906e=_0x35906e-0x0;var _0x426856=_0xada4[_0x35906e];return _0x426856;};'use strict';var EventEmitter=require(_0x4ada('0x0'));var UserVoiceQueueRt=require(_0x4ada('0x1'))['db'][_0x4ada('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x4ada('0x3')](0x0);var events={'afterCreate':_0x4ada('0x4'),'afterUpdate':'update','afterDestroy':_0x4ada('0x5')};function emitEvent(_0x20b425){return function(_0x91aef1,_0x1a9580,_0x1a77e8){UserVoiceQueueRtEvents[_0x4ada('0x6')](_0x20b425+':'+_0x91aef1['id'],_0x91aef1);UserVoiceQueueRtEvents['emit'](_0x20b425,_0x91aef1);_0x1a77e8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x4ada('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 23a6d20..34318a3 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 _0xff66=['rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','moment','bluebird'];(function(_0x2fca13,_0x2ff971){var _0x57f01f=function(_0x7aea9a){while(--_0x7aea9a){_0x2fca13['push'](_0x2fca13['shift']());}};_0x57f01f(++_0x2ff971);}(_0xff66,0x1b7));var _0x6ff6=function(_0x1f530d,_0x18a19e){_0x1f530d=_0x1f530d-0x0;var _0x22103f=_0xff66[_0x1f530d];return _0x22103f;};'use strict';var _=require(_0x6ff6('0x0'));var util=require(_0x6ff6('0x1'));var logger=require(_0x6ff6('0x2'))('api');var moment=require(_0x6ff6('0x3'));var BPromise=require(_0x6ff6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6ff6('0x5'));var config=require(_0x6ff6('0x6'));var attributes=require(_0x6ff6('0x7'));module[_0x6ff6('0x8')]=function(_0x2ca71f,_0xa1965c){return _0x2ca71f[_0x6ff6('0x9')](_0x6ff6('0xa'),attributes,{'tableName':_0x6ff6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc29=['path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','lodash','util','api','moment','bluebird','request-promise'];(function(_0x3ed8e2,_0x25732f){var _0x3e3849=function(_0xb13239){while(--_0xb13239){_0x3ed8e2['push'](_0x3ed8e2['shift']());}};_0x3e3849(++_0x25732f);}(_0xdc29,0x11a));var _0x9dc2=function(_0xbb75c8,_0x3e081e){_0xbb75c8=_0xbb75c8-0x0;var _0x418b6c=_0xdc29[_0xbb75c8];return _0x418b6c;};'use strict';var _=require(_0x9dc2('0x0'));var util=require(_0x9dc2('0x1'));var logger=require('../../config/logger')(_0x9dc2('0x2'));var moment=require(_0x9dc2('0x3'));var BPromise=require(_0x9dc2('0x4'));var rp=require(_0x9dc2('0x5'));var fs=require('fs');var path=require(_0x9dc2('0x6'));var rimraf=require(_0x9dc2('0x7'));var config=require(_0x9dc2('0x8'));var attributes=require(_0x9dc2('0x9'));module[_0x9dc2('0xa')]=function(_0x250c6c,_0x38ecee){return _0x250c6c[_0x9dc2('0xb')]('UserVoiceQueueRt',attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index cb3dcfb..4cf0afb 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 _0xd851=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','./userVoiceQueueRt.socket','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','result','UserVoiceQueueRt','findAll','options','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','stringify','catch','GetVoiceQueueRtPauses'];(function(_0x101d0d,_0x270fbb){var _0x5cc237=function(_0x5776e9){while(--_0x5776e9){_0x101d0d['push'](_0x101d0d['shift']());}};_0x5cc237(++_0x270fbb);}(_0xd851,0x120));var _0x1d85=function(_0x4d40dd,_0x39592b){_0x4d40dd=_0x4d40dd-0x0;var _0x1c51f2=_0xd851[_0x4d40dd];return _0x1c51f2;};'use strict';var _=require(_0x1d85('0x0'));var util=require('util');var moment=require(_0x1d85('0x1'));var BPromise=require(_0x1d85('0x2'));var rs=require(_0x1d85('0x3'));var fs=require('fs');var Redis=require(_0x1d85('0x4'));var db=require(_0x1d85('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1d85('0x6'))(_0x1d85('0x7'));var config=require(_0x1d85('0x8'));var jayson=require(_0x1d85('0x9'));var client=jayson[_0x1d85('0xa')][_0x1d85('0xb')]({'port':0x232a});config['redis']=_[_0x1d85('0xc')](config[_0x1d85('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1d85('0xd')]));require(_0x1d85('0xe'))['register'](socket);function respondWithRpcPromise(_0x6e51e,_0x20e9fb,_0x3163de){return new BPromise(function(_0xe95a09,_0x477fc6){return client['request'](_0x6e51e,_0x3163de)[_0x1d85('0xf')](function(_0x369294){logger[_0x1d85('0x10')](_0x1d85('0x11'),_0x20e9fb,_0x1d85('0x12'));logger['debug'](_0x1d85('0x13'),_0x20e9fb,_0x1d85('0x12'),JSON['stringify'](_0x369294));if(_0x369294[_0x1d85('0x14')]){if(_0x369294[_0x1d85('0x14')][_0x1d85('0x15')]===0x1f4){logger[_0x1d85('0x14')](_0x1d85('0x11'),_0x20e9fb,_0x369294['error'][_0x1d85('0x16')]);return _0x477fc6(_0x369294[_0x1d85('0x14')]['message']);}logger['error'](_0x1d85('0x11'),_0x20e9fb,_0x369294[_0x1d85('0x14')]['message']);return _0xe95a09(_0x369294[_0x1d85('0x14')][_0x1d85('0x16')]);}else{logger[_0x1d85('0x10')](_0x1d85('0x11'),_0x20e9fb,'request\x20sent');_0xe95a09(_0x369294[_0x1d85('0x17')][_0x1d85('0x16')]);}})['catch'](function(_0x4810fe){logger['error'](_0x1d85('0x11'),_0x20e9fb,_0x4810fe);_0x477fc6(_0x4810fe);});});}exports['GetVoiceQueueRtPauses']=function(_0x7f6fa2){var _0x54a34b=this;return new Promise(function(_0x4fa357,_0x3fa171){return db[_0x1d85('0x18')][_0x1d85('0x19')]({'raw':_0x7f6fa2['options']?_0x7f6fa2[_0x1d85('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x7f6fa2[_0x1d85('0x1a')]?_0x7f6fa2[_0x1d85('0x1a')]['where']||null:null,'attributes':[[db[_0x1d85('0x1b')]['fn'](_0x1d85('0x1c'),db['sequelize']['fn']('IF',db[_0x1d85('0x1b')][_0x1d85('0x1d')](_0x1d85('0x1e')))),_0x1d85('0x1f')]]})[_0x1d85('0xf')](function(_0x2e8d69){logger['info']('GetVoiceQueueRtPauses',_0x7f6fa2);logger[_0x1d85('0x20')]('GetVoiceQueueRtPauses',_0x7f6fa2,JSON[_0x1d85('0x21')](_0x2e8d69));_0x4fa357(_0x2e8d69);})[_0x1d85('0x22')](function(_0x273fec){logger[_0x1d85('0x14')](_0x1d85('0x23'),_0x273fec[_0x1d85('0x16')],_0x7f6fa2);_0x3fa171(_0x54a34b[_0x1d85('0x14')](0x1f4,_0x273fec[_0x1d85('0x16')]));});});}; \ No newline at end of file +var _0xa543=['./userVoiceQueueRt.socket','register','request','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','UserVoiceQueueRt,\x20%s,\x20%s','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter'];(function(_0xb078e4,_0x52bc8b){var _0x54528a=function(_0x16ea42){while(--_0x16ea42){_0xb078e4['push'](_0xb078e4['shift']());}};_0x54528a(++_0x52bc8b);}(_0xa543,0x158));var _0x3a54=function(_0x574f57,_0x4bc189){_0x574f57=_0x574f57-0x0;var _0x54c574=_0xa543[_0x574f57];return _0x54c574;};'use strict';var _=require('lodash');var util=require(_0x3a54('0x0'));var moment=require(_0x3a54('0x1'));var BPromise=require(_0x3a54('0x2'));var rs=require(_0x3a54('0x3'));var fs=require('fs');var Redis=require(_0x3a54('0x4'));var db=require(_0x3a54('0x5'))['db'];var utils=require(_0x3a54('0x6'));var logger=require(_0x3a54('0x7'))(_0x3a54('0x8'));var config=require(_0x3a54('0x9'));var jayson=require(_0x3a54('0xa'));var client=jayson['client'][_0x3a54('0xb')]({'port':0x232a});config['redis']=_[_0x3a54('0xc')](config[_0x3a54('0xd')],{'host':_0x3a54('0xe'),'port':0x18eb});var socket=require(_0x3a54('0xf'))(new Redis(config[_0x3a54('0xd')]));require(_0x3a54('0x10'))[_0x3a54('0x11')](socket);function respondWithRpcPromise(_0x3e98b2,_0x4dc5b9,_0x2575ea){return new BPromise(function(_0x5bac24,_0x325722){return client[_0x3a54('0x12')](_0x3e98b2,_0x2575ea)['then'](function(_0x1efb36){logger[_0x3a54('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x4dc5b9,_0x3a54('0x14'));logger[_0x3a54('0x15')](_0x3a54('0x16'),_0x4dc5b9,_0x3a54('0x14'),JSON[_0x3a54('0x17')](_0x1efb36));if(_0x1efb36[_0x3a54('0x18')]){if(_0x1efb36[_0x3a54('0x18')]['code']===0x1f4){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x4dc5b9,_0x1efb36[_0x3a54('0x18')][_0x3a54('0x19')]);return _0x325722(_0x1efb36[_0x3a54('0x18')][_0x3a54('0x19')]);}logger[_0x3a54('0x18')](_0x3a54('0x1a'),_0x4dc5b9,_0x1efb36[_0x3a54('0x18')][_0x3a54('0x19')]);return _0x5bac24(_0x1efb36['error'][_0x3a54('0x19')]);}else{logger[_0x3a54('0x13')](_0x3a54('0x1a'),_0x4dc5b9,'request\x20sent');_0x5bac24(_0x1efb36[_0x3a54('0x1b')][_0x3a54('0x19')]);}})['catch'](function(_0x24c139){logger[_0x3a54('0x18')](_0x3a54('0x1a'),_0x4dc5b9,_0x24c139);_0x325722(_0x24c139);});});}exports[_0x3a54('0x1c')]=function(_0x495c21){var _0x1cfe11=this;return new Promise(function(_0x32a402,_0x1f3e4f){return db[_0x3a54('0x1d')][_0x3a54('0x1e')]({'raw':_0x495c21[_0x3a54('0x1f')]?_0x495c21[_0x3a54('0x1f')][_0x3a54('0x20')]===undefined?!![]:![]:!![],'where':_0x495c21[_0x3a54('0x1f')]?_0x495c21[_0x3a54('0x1f')][_0x3a54('0x21')]||null:null,'attributes':[[db[_0x3a54('0x22')]['fn'](_0x3a54('0x23'),db['sequelize']['fn']('IF',db['sequelize'][_0x3a54('0x24')](_0x3a54('0x25')))),_0x3a54('0x26')]]})[_0x3a54('0x27')](function(_0x4078bb){logger[_0x3a54('0x13')]('GetVoiceQueueRtPauses',_0x495c21);logger[_0x3a54('0x15')](_0x3a54('0x1c'),_0x495c21,JSON[_0x3a54('0x17')](_0x4078bb));_0x32a402(_0x4078bb);})['catch'](function(_0x2716e0){logger['error']('GetVoiceQueueRtPauses',_0x2716e0['message'],_0x495c21);_0x1f3e4f(_0x1cfe11[_0x3a54('0x18')](0x1f4,_0x2716e0[_0x3a54('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 0619ce3..a702844 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 _0xb7ae=['removeListener','register','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit'];(function(_0x12fa51,_0x3f3353){var _0x13db4b=function(_0x25dcde){while(--_0x25dcde){_0x12fa51['push'](_0x12fa51['shift']());}};_0x13db4b(++_0x3f3353);}(_0xb7ae,0xf3));var _0xeb7a=function(_0x194a96,_0x5ab37c){_0x194a96=_0x194a96-0x0;var _0x27e0ef=_0xb7ae[_0x194a96];return _0x27e0ef;};'use strict';var UserVoiceQueueRtEvents=require(_0xeb7a('0x0'));var events=[_0xeb7a('0x1'),_0xeb7a('0x2'),_0xeb7a('0x3')];function createListener(_0x3749dd,_0x497fc8){return function(_0x1121bd){_0x497fc8[_0xeb7a('0x4')](_0x3749dd,_0x1121bd);};}function removeListener(_0x44ce73,_0x51e0af){return function(){UserVoiceQueueRtEvents[_0xeb7a('0x5')](_0x44ce73,_0x51e0af);};}exports[_0xeb7a('0x6')]=function(_0x33c928){for(var _0x2564ab=0x0,_0x365bc0=events['length'];_0x2564ab<_0x365bc0;_0x2564ab++){var _0x1d872f=events[_0x2564ab];var _0x19f415=createListener(_0xeb7a('0x7')+_0x1d872f,_0x33c928);UserVoiceQueueRtEvents['on'](_0x1d872f,_0x19f415);}}; \ No newline at end of file +var _0xf1c6=['remove','update','register','length','userVoiceQueueRt:'];(function(_0x36c6eb,_0x4fb127){var _0x30675b=function(_0x3a788b){while(--_0x3a788b){_0x36c6eb['push'](_0x36c6eb['shift']());}};_0x30675b(++_0x4fb127);}(_0xf1c6,0x145));var _0x6f1c=function(_0x25fe21,_0x53c775){_0x25fe21=_0x25fe21-0x0;var _0x4b1b49=_0xf1c6[_0x25fe21];return _0x4b1b49;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=['save',_0x6f1c('0x0'),_0x6f1c('0x1')];function createListener(_0x26cd1b,_0x405b3c){return function(_0xc393e2){_0x405b3c['emit'](_0x26cd1b,_0xc393e2);};}function removeListener(_0x5f0d77,_0x43775d){return function(){UserVoiceQueueRtEvents['removeListener'](_0x5f0d77,_0x43775d);};}exports[_0x6f1c('0x2')]=function(_0xa275f4){for(var _0x462c85=0x0,_0x537c4f=events[_0x6f1c('0x3')];_0x462c85<_0x537c4f;_0x462c85++){var _0x564a8f=events[_0x462c85];var _0x275f11=createListener(_0x6f1c('0x4')+_0x564a8f,_0xa275f4);UserVoiceQueueRtEvents['on'](_0x564a8f,_0x275f11);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 179072a..ef098ba 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x21c0de,_0x4a9720){var _0x32229e=function(_0x275c29){while(--_0x275c29){_0x21c0de['push'](_0x21c0de['shift']());}};_0x32229e(++_0x4a9720);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x22664d,_0x2f94a1){var _0x3680a4=function(_0x1e8485){while(--_0x1e8485){_0x22664d['push'](_0x22664d['shift']());}};_0x3680a4(++_0x2f94a1);}(_0x9c44,0x178));var _0x49c4=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x9c44[_0x4f9b18];return _0x29f20c;};'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 132ce64..afe62ec 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 _0x5570=['INTEGER'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x5570,0x122));var _0x0557=function(_0x485bad,_0x21c418){_0x485bad=_0x485bad-0x0;var _0x523c91=_0x5570[_0x485bad];return _0x523c91;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x0557('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0xee10=['sequelize','INTEGER'];(function(_0x6a2cd8,_0x529720){var _0x52e973=function(_0x38e51e){while(--_0x38e51e){_0x6a2cd8['push'](_0x6a2cd8['shift']());}};_0x52e973(++_0x529720);}(_0xee10,0x66));var _0x0ee1=function(_0x31adf9,_0x511868){_0x31adf9=_0x31adf9-0x0;var _0x4412b5=_0xee10[_0x31adf9];return _0x4412b5;};'use strict';var Sequelize=require(_0x0ee1('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x0ee1('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 ed9fe26..5a0c6cb 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 _0xe44a=['../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x192474,_0x2f1866){var _0xbfd1ed=function(_0x459f67){while(--_0x459f67){_0x192474['push'](_0x192474['shift']());}};_0xbfd1ed(++_0x2f1866);}(_0xe44a,0x199));var _0xae44=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe44a[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xae44('0x0'));var logger=require(_0xae44('0x1'))(_0xae44('0x2'));var moment=require('moment');var BPromise=require(_0xae44('0x3'));var rp=require(_0xae44('0x4'));var fs=require('fs');var path=require(_0xae44('0x5'));var rimraf=require(_0xae44('0x6'));var config=require(_0xae44('0x7'));var attributes=require(_0xae44('0x8'));module[_0xae44('0x9')]=function(_0x55e704,_0xe6d962){return _0x55e704[_0xae44('0xa')](_0xae44('0xb'),attributes,{'tableName':_0xae44('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ede=['rimraf','../../config/environment','./userWhatsappQueue.attributes','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x49acbe,_0x10e4fb){var _0x3350bc=function(_0x2c4184){while(--_0x2c4184){_0x49acbe['push'](_0x49acbe['shift']());}};_0x3350bc(++_0x10e4fb);}(_0x4ede,0x132));var _0xe4ed=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x4ede[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xe4ed('0x0'));var util=require(_0xe4ed('0x1'));var logger=require(_0xe4ed('0x2'))(_0xe4ed('0x3'));var moment=require('moment');var BPromise=require(_0xe4ed('0x4'));var rp=require(_0xe4ed('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe4ed('0x6'));var config=require(_0xe4ed('0x7'));var attributes=require(_0xe4ed('0x8'));module['exports']=function(_0x2caa49,_0x17cab1){return _0x2caa49[_0xe4ed('0x9')](_0xe4ed('0xa'),attributes,{'tableName':_0xe4ed('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 162c378..a278197 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 _0xdff7=['util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash'];(function(_0x421eeb,_0x3d3e3e){var _0x2c7371=function(_0x174b74){while(--_0x174b74){_0x421eeb['push'](_0x421eeb['shift']());}};_0x2c7371(++_0x3d3e3e);}(_0xdff7,0x13f));var _0x7dff=function(_0x177ece,_0x1e407c){_0x177ece=_0x177ece-0x0;var _0x4bde75=_0xdff7[_0x177ece];return _0x4bde75;};'use strict';var _=require(_0x7dff('0x0'));var util=require(_0x7dff('0x1'));var moment=require(_0x7dff('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7dff('0x3'));var db=require(_0x7dff('0x4'))['db'];var utils=require(_0x7dff('0x5'));var logger=require(_0x7dff('0x6'))(_0x7dff('0x7'));var config=require(_0x7dff('0x8'));var jayson=require(_0x7dff('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x540d51,_0x1c043e,_0x51de34){return new BPromise(function(_0x1a627b,_0x331b6a){return client[_0x7dff('0xa')](_0x540d51,_0x51de34)['then'](function(_0x50fe64){logger['info'](_0x7dff('0xb'),_0x1c043e,_0x7dff('0xc'));logger[_0x7dff('0xd')](_0x7dff('0xe'),_0x1c043e,_0x7dff('0xc'),JSON['stringify'](_0x50fe64));if(_0x50fe64['error']){if(_0x50fe64[_0x7dff('0xf')][_0x7dff('0x10')]===0x1f4){logger[_0x7dff('0xf')](_0x7dff('0xb'),_0x1c043e,_0x50fe64['error'][_0x7dff('0x11')]);return _0x331b6a(_0x50fe64[_0x7dff('0xf')][_0x7dff('0x11')]);}logger['error'](_0x7dff('0xb'),_0x1c043e,_0x50fe64[_0x7dff('0xf')][_0x7dff('0x11')]);return _0x1a627b(_0x50fe64[_0x7dff('0xf')]['message']);}else{logger[_0x7dff('0x12')](_0x7dff('0xb'),_0x1c043e,_0x7dff('0xc'));_0x1a627b(_0x50fe64[_0x7dff('0x13')][_0x7dff('0x11')]);}})['catch'](function(_0x27d137){logger[_0x7dff('0xf')](_0x7dff('0xb'),_0x1c043e,_0x27d137);_0x331b6a(_0x27d137);});});} \ No newline at end of file +var _0xed56=['stringify','error','UserWhatsappQueue,\x20%s,\x20%s','message','info','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s'];(function(_0x53781f,_0x1ea6bb){var _0xd5895f=function(_0x4d7b44){while(--_0x4d7b44){_0x53781f['push'](_0x53781f['shift']());}};_0xd5895f(++_0x1ea6bb);}(_0xed56,0xa1));var _0x6ed5=function(_0x206597,_0x1fdb43){_0x206597=_0x206597-0x0;var _0xec7e6c=_0xed56[_0x206597];return _0xec7e6c;};'use strict';var _=require('lodash');var util=require(_0x6ed5('0x0'));var moment=require('moment');var BPromise=require(_0x6ed5('0x1'));var rs=require(_0x6ed5('0x2'));var fs=require('fs');var Redis=require(_0x6ed5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ed5('0x4'));var logger=require(_0x6ed5('0x5'))(_0x6ed5('0x6'));var config=require(_0x6ed5('0x7'));var jayson=require(_0x6ed5('0x8'));var client=jayson['client'][_0x6ed5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x341676,_0x27e266,_0x1440e8){return new BPromise(function(_0x9810e7,_0x1e80a1){return client[_0x6ed5('0xa')](_0x341676,_0x1440e8)[_0x6ed5('0xb')](function(_0x3031d1){logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0x27e266,_0x6ed5('0xc'));logger[_0x6ed5('0xd')](_0x6ed5('0xe'),_0x27e266,_0x6ed5('0xc'),JSON[_0x6ed5('0xf')](_0x3031d1));if(_0x3031d1[_0x6ed5('0x10')]){if(_0x3031d1['error']['code']===0x1f4){logger['error'](_0x6ed5('0x11'),_0x27e266,_0x3031d1['error'][_0x6ed5('0x12')]);return _0x1e80a1(_0x3031d1['error'][_0x6ed5('0x12')]);}logger[_0x6ed5('0x10')](_0x6ed5('0x11'),_0x27e266,_0x3031d1['error'][_0x6ed5('0x12')]);return _0x9810e7(_0x3031d1[_0x6ed5('0x10')][_0x6ed5('0x12')]);}else{logger[_0x6ed5('0x13')](_0x6ed5('0x11'),_0x27e266,_0x6ed5('0xc'));_0x9810e7(_0x3031d1[_0x6ed5('0x14')][_0x6ed5('0x12')]);}})[_0x6ed5('0x15')](function(_0x1a8bd2){logger['error'](_0x6ed5('0x11'),_0x27e266,_0x1a8bd2);_0x1e80a1(_0x1a8bd2);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index d25bbc0..fad4458 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 _0xf6c1=['path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports'];(function(_0x16e9aa,_0x5f4220){var _0x1b6bba=function(_0x13dcf3){while(--_0x13dcf3){_0x16e9aa['push'](_0x16e9aa['shift']());}};_0x1b6bba(++_0x5f4220);}(_0xf6c1,0x99));var _0x1f6c=function(_0x292df7,_0x57e5dc){_0x292df7=_0x292df7-0x0;var _0x2cb2c9=_0xf6c1[_0x292df7];return _0x2cb2c9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1f6c('0x0'));var timeout=require(_0x1f6c('0x1'));var express=require(_0x1f6c('0x2'));var router=express['Router']();var fs_extra=require(_0x1f6c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1f6c('0x4'));var config=require(_0x1f6c('0x5'));var controller=require(_0x1f6c('0x6'));router[_0x1f6c('0x7')]('/',auth[_0x1f6c('0x8')](),controller[_0x1f6c('0x9')]);router['get'](_0x1f6c('0xa'),auth[_0x1f6c('0x8')](),controller[_0x1f6c('0xb')]);router[_0x1f6c('0xc')]('/',auth[_0x1f6c('0x8')](),controller[_0x1f6c('0xd')]);router[_0x1f6c('0xe')](_0x1f6c('0xa'),auth[_0x1f6c('0x8')](),controller['update']);router['delete']('/:id',auth[_0x1f6c('0x8')](),controller[_0x1f6c('0xf')]);module[_0x1f6c('0x10')]=router; \ No newline at end of file +var _0xff16=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete','destroy'];(function(_0x38651d,_0x5ca1bc){var _0x3f4c9b=function(_0x553aa1){while(--_0x553aa1){_0x38651d['push'](_0x38651d['shift']());}};_0x3f4c9b(++_0x5ca1bc);}(_0xff16,0x7f));var _0x6ff1=function(_0x655dfa,_0x2e99b4){_0x655dfa=_0x655dfa-0x0;var _0x14ee2d=_0xff16[_0x655dfa];return _0x14ee2d;};'use strict';var multer=require(_0x6ff1('0x0'));var util=require(_0x6ff1('0x1'));var path=require('path');var timeout=require(_0x6ff1('0x2'));var express=require(_0x6ff1('0x3'));var router=express[_0x6ff1('0x4')]();var fs_extra=require(_0x6ff1('0x5'));var auth=require(_0x6ff1('0x6'));var interaction=require(_0x6ff1('0x7'));var config=require(_0x6ff1('0x8'));var controller=require(_0x6ff1('0x9'));router['get']('/',auth[_0x6ff1('0xa')](),controller['index']);router[_0x6ff1('0xb')](_0x6ff1('0xc'),auth[_0x6ff1('0xa')](),controller[_0x6ff1('0xd')]);router[_0x6ff1('0xe')]('/',auth[_0x6ff1('0xa')](),controller[_0x6ff1('0xf')]);router[_0x6ff1('0x10')]('/:id',auth[_0x6ff1('0xa')](),controller[_0x6ff1('0x11')]);router[_0x6ff1('0x12')](_0x6ff1('0xc'),auth[_0x6ff1('0xa')](),controller[_0x6ff1('0x13')]);module[_0x6ff1('0x14')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 21d4c40..f307b34 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 _0xa328=['STRING','name','sequelize','exports'];(function(_0x6b6d09,_0xc0dc47){var _0x320edb=function(_0x244527){while(--_0x244527){_0x6b6d09['push'](_0x6b6d09['shift']());}};_0x320edb(++_0xc0dc47);}(_0xa328,0x156));var _0x8a32=function(_0x26c112,_0x41e2fd){_0x26c112=_0x26c112-0x0;var _0x4933d8=_0xa328[_0x26c112];return _0x4933d8;};'use strict';var Sequelize=require(_0x8a32('0x0'));module[_0x8a32('0x1')]={'name':{'type':Sequelize[_0x8a32('0x2')],'unique':_0x8a32('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8a32('0x2')]}}; \ No newline at end of file +var _0xe066=['STRING','name'];(function(_0x4b070d,_0x3a9368){var _0x15fac6=function(_0x5c2638){while(--_0x5c2638){_0x4b070d['push'](_0x4b070d['shift']());}};_0x15fac6(++_0x3a9368);}(_0xe066,0xcc));var _0x6e06=function(_0x2e65ee,_0x29dad9){_0x2e65ee=_0x2e65ee-0x0;var _0x4c712a=_0xe066[_0x2e65ee];return _0x4c712a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6e06('0x0')],'unique':_0x6e06('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6e06('0x0')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 2e286db..aab3467 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 _0x7dd0=['role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','Variables','error','name','send','map','Variable','fieldName','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0xd2a9db,_0x18d43b){var _0x5de12a=function(_0x3bc365){while(--_0x3bc365){_0xd2a9db['push'](_0xd2a9db['shift']());}};_0x5de12a(++_0x18d43b);}(_0x7dd0,0x10c));var _0x07dd=function(_0x4b4f1a,_0xe5ab88){_0x4b4f1a=_0x4b4f1a-0x0;var _0x23ccb1=_0x7dd0[_0x4b4f1a];return _0x23ccb1;};'use strict';var emlformat=require(_0x07dd('0x0'));var rimraf=require(_0x07dd('0x1'));var zipdir=require(_0x07dd('0x2'));var jsonpatch=require(_0x07dd('0x3'));var rp=require(_0x07dd('0x4'));var moment=require('moment');var BPromise=require(_0x07dd('0x5'));var Mustache=require(_0x07dd('0x6'));var util=require(_0x07dd('0x7'));var path=require(_0x07dd('0x8'));var sox=require(_0x07dd('0x9'));var csv=require('to-csv');var ejs=require(_0x07dd('0xa'));var fs=require('fs');var fs_extra=require(_0x07dd('0xb'));var _=require(_0x07dd('0xc'));var squel=require(_0x07dd('0xd'));var crypto=require(_0x07dd('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x07dd('0xf'));var toCsv=require(_0x07dd('0x10'));var querystring=require(_0x07dd('0x11'));var Papa=require('papaparse');var Redis=require(_0x07dd('0x12'));var authService=require(_0x07dd('0x13'));var qs=require(_0x07dd('0x14'));var as=require(_0x07dd('0x15'));var hardwareService=require(_0x07dd('0x16'));var logger=require('../../config/logger')(_0x07dd('0x17'));var utils=require(_0x07dd('0x18'));var config=require(_0x07dd('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x07dd('0x1a'))['db'];function respondWithStatusCode(_0x599ab8,_0x2f75b2){_0x2f75b2=_0x2f75b2||0xcc;return function(_0x313ad2){if(_0x313ad2){return _0x599ab8[_0x07dd('0x1b')](_0x2f75b2);}return _0x599ab8[_0x07dd('0x1c')](_0x2f75b2)[_0x07dd('0x1d')]();};}function respondWithResult(_0x4fa704,_0x1429d0){_0x1429d0=_0x1429d0||0xc8;return function(_0x2da92a){if(_0x2da92a){return _0x4fa704['status'](_0x1429d0)[_0x07dd('0x1e')](_0x2da92a);}};}function respondWithFilteredResult(_0x390209,_0xb969b4){return function(_0x261ea2){if(_0x261ea2){var _0x41459e=typeof _0xb969b4[_0x07dd('0x1f')]===_0x07dd('0x20')&&typeof _0xb969b4[_0x07dd('0x21')]===_0x07dd('0x20');var _0x309007=_0x261ea2['count'];var _0x43e04f=_0x41459e?0x0:_0xb969b4['offset'];var _0x19b571=_0x41459e?_0x261ea2[_0x07dd('0x22')]:_0xb969b4[_0x07dd('0x1f')]+_0xb969b4[_0x07dd('0x21')];var _0x29b268;if(_0x19b571>=_0x309007){_0x19b571=_0x309007;_0x29b268=0xc8;}else{_0x29b268=0xce;}_0x390209[_0x07dd('0x1c')](_0x29b268);return _0x390209[_0x07dd('0x23')](_0x07dd('0x24'),_0x43e04f+'-'+_0x19b571+'/'+_0x309007)[_0x07dd('0x1e')](_0x261ea2);}return null;};}function patchUpdates(_0x571b9f){return function(_0x425456){try{jsonpatch[_0x07dd('0x25')](_0x425456,_0x571b9f,!![]);}catch(_0x2de4d5){return BPromise[_0x07dd('0x26')](_0x2de4d5);}return _0x425456['save']();};}function saveUpdates(_0x291b89,_0x406283){return function(_0x1e37bc){if(_0x1e37bc){return _0x1e37bc[_0x07dd('0x27')](_0x291b89)[_0x07dd('0x28')](function(_0x34e929){return _0x34e929;});}return null;};}function removeEntity(_0x13f08e,_0x72d468){return function(_0x58dfc4){if(_0x58dfc4){return _0x58dfc4[_0x07dd('0x29')]()[_0x07dd('0x28')](function(){var _0x34ddc7=_0x58dfc4[_0x07dd('0x2a')]({'plain':!![]});var _0x1ee777=_0x07dd('0x2b');return db['UserProfileResource'][_0x07dd('0x29')]({'where':{'type':_0x1ee777,'resourceId':_0x34ddc7['id']}})[_0x07dd('0x28')](function(){return _0x58dfc4;});})[_0x07dd('0x28')](function(){_0x13f08e[_0x07dd('0x1c')](0xcc)[_0x07dd('0x1d')]();});}};}function handleEntityNotFound(_0x4430f9,_0x5e2751){return function(_0x55aa91){if(!_0x55aa91){_0x4430f9[_0x07dd('0x1b')](0x194);}return _0x55aa91;};}function handleError(_0x38d6aa,_0x2e8456){_0x2e8456=_0x2e8456||0x1f4;return function(_0x312a14){logger[_0x07dd('0x2c')](_0x312a14['stack']);if(_0x312a14['name']){delete _0x312a14[_0x07dd('0x2d')];}_0x38d6aa['status'](_0x2e8456)[_0x07dd('0x2e')](_0x312a14);};}exports['index']=function(_0x5c1c21,_0x549638){var _0xbff781={},_0x900db3={},_0x46117e={'count':0x0,'rows':[]};var _0x1edd02=_[_0x07dd('0x2f')](db[_0x07dd('0x30')]['rawAttributes'],function(_0x9618c8){return{'name':_0x9618c8[_0x07dd('0x31')],'type':_0x9618c8['type']['key']};});_0x900db3['model']=_[_0x07dd('0x2f')](_0x1edd02,_0x07dd('0x2d'));_0x900db3[_0x07dd('0x32')]=_[_0x07dd('0x33')](_0x5c1c21[_0x07dd('0x32')]);_0x900db3['filters']=_[_0x07dd('0x34')](_0x900db3[_0x07dd('0x35')],_0x900db3[_0x07dd('0x32')]);_0xbff781[_0x07dd('0x36')]=_[_0x07dd('0x34')](_0x900db3[_0x07dd('0x35')],qs['fields'](_0x5c1c21[_0x07dd('0x32')][_0x07dd('0x37')]));_0xbff781['attributes']=_0xbff781['attributes'][_0x07dd('0x38')]?_0xbff781[_0x07dd('0x36')]:_0x900db3['model'];if(!_0x5c1c21['query']['hasOwnProperty'](_0x07dd('0x39'))){_0xbff781[_0x07dd('0x21')]=qs['limit'](_0x5c1c21[_0x07dd('0x32')][_0x07dd('0x21')]);_0xbff781['offset']=qs[_0x07dd('0x1f')](_0x5c1c21['query']['offset']);}_0xbff781[_0x07dd('0x3a')]=qs[_0x07dd('0x3b')](_0x5c1c21[_0x07dd('0x32')][_0x07dd('0x3b')]);_0xbff781[_0x07dd('0x3c')]=qs[_0x07dd('0x3d')](_[_0x07dd('0x3e')](_0x5c1c21[_0x07dd('0x32')],_0x900db3[_0x07dd('0x3d')]),_0x1edd02);if(_0x5c1c21['query'][_0x07dd('0x3f')]){_0xbff781[_0x07dd('0x3c')]=_[_0x07dd('0x40')](_0xbff781[_0x07dd('0x3c')],{'$or':_[_0x07dd('0x2f')](_0x1edd02,function(_0xfce45c){if(_0xfce45c[_0x07dd('0x41')]!==_0x07dd('0x42')){var _0x544280={};_0x544280[_0xfce45c[_0x07dd('0x2d')]]={'$like':'%'+_0x5c1c21['query'][_0x07dd('0x3f')]+'%'};return _0x544280;}})});}_0xbff781=_[_0x07dd('0x40')]({},_0xbff781,_0x5c1c21[_0x07dd('0x43')]);var _0x2539ac={'where':_0xbff781[_0x07dd('0x3c')]};return db[_0x07dd('0x30')][_0x07dd('0x22')](_0x2539ac)[_0x07dd('0x28')](function(_0x5bb394){_0x46117e['count']=_0x5bb394;if(_0x5c1c21[_0x07dd('0x32')][_0x07dd('0x44')]){_0xbff781[_0x07dd('0x45')]=[{'all':!![]}];}return db['Variable'][_0x07dd('0x46')](_0xbff781);})['then'](function(_0x600f67){_0x46117e[_0x07dd('0x47')]=_0x600f67;return _0x46117e;})[_0x07dd('0x28')](respondWithFilteredResult(_0x549638,_0xbff781))[_0x07dd('0x48')](handleError(_0x549638,null));};exports[_0x07dd('0x49')]=function(_0x102928,_0x2a1bf8){var _0x2c2b5e={'raw':!![],'where':{'id':_0x102928[_0x07dd('0x4a')]['id']}},_0x298c90={};_0x298c90[_0x07dd('0x35')]=_[_0x07dd('0x33')](db[_0x07dd('0x30')][_0x07dd('0x4b')]);_0x298c90[_0x07dd('0x32')]=_[_0x07dd('0x33')](_0x102928[_0x07dd('0x32')]);_0x298c90[_0x07dd('0x3d')]=_[_0x07dd('0x34')](_0x298c90[_0x07dd('0x35')],_0x298c90[_0x07dd('0x32')]);_0x2c2b5e[_0x07dd('0x36')]=_['intersection'](_0x298c90['model'],qs['fields'](_0x102928['query'][_0x07dd('0x37')]));_0x2c2b5e['attributes']=_0x2c2b5e[_0x07dd('0x36')][_0x07dd('0x38')]?_0x2c2b5e[_0x07dd('0x36')]:_0x298c90['model'];if(_0x102928['query'][_0x07dd('0x44')]){_0x2c2b5e[_0x07dd('0x45')]=[{'all':!![]}];}_0x2c2b5e=_[_0x07dd('0x40')]({},_0x2c2b5e,_0x102928[_0x07dd('0x43')]);return db[_0x07dd('0x30')][_0x07dd('0x4c')](_0x2c2b5e)[_0x07dd('0x28')](handleEntityNotFound(_0x2a1bf8,null))[_0x07dd('0x28')](respondWithResult(_0x2a1bf8,null))[_0x07dd('0x48')](handleError(_0x2a1bf8,null));};exports[_0x07dd('0x4d')]=function(_0x2d8556,_0x4453b4){return db[_0x07dd('0x30')][_0x07dd('0x4d')](_0x2d8556['body'],{})[_0x07dd('0x28')](function(_0x383dfb){var _0xecb392=_0x2d8556[_0x07dd('0x4e')][_0x07dd('0x2a')]({'plain':!![]});if(!_0xecb392)throw new Error(_0x07dd('0x4f'));if(_0xecb392[_0x07dd('0x50')]===_0x07dd('0x4e')){var _0x3c7d98=_0x383dfb[_0x07dd('0x2a')]({'plain':!![]});var _0x22aa18=_0x07dd('0x2b');return db[_0x07dd('0x51')][_0x07dd('0x4c')]({'where':{'name':_0x22aa18,'userProfileId':_0xecb392[_0x07dd('0x52')]},'raw':!![]})[_0x07dd('0x28')](function(_0x2acc1e){if(_0x2acc1e&&_0x2acc1e[_0x07dd('0x53')]===0x0){return db[_0x07dd('0x54')][_0x07dd('0x4d')]({'name':_0x3c7d98[_0x07dd('0x2d')],'resourceId':_0x3c7d98['id'],'type':_0x2acc1e[_0x07dd('0x2d')],'sectionId':_0x2acc1e['id']},{})[_0x07dd('0x28')](function(){return _0x383dfb;});}else{return _0x383dfb;}})[_0x07dd('0x48')](function(_0x18b81f){logger['error'](_0x07dd('0x55'),_0x18b81f);throw _0x18b81f;});}return _0x383dfb;})[_0x07dd('0x28')](respondWithResult(_0x4453b4,0xc9))['catch'](handleError(_0x4453b4,null));};exports['update']=function(_0x582476,_0x1e513e){if(_0x582476[_0x07dd('0x56')]['id']){delete _0x582476[_0x07dd('0x56')]['id'];}return db['Variable']['find']({'where':{'id':_0x582476[_0x07dd('0x4a')]['id']}})[_0x07dd('0x28')](handleEntityNotFound(_0x1e513e,null))[_0x07dd('0x28')](saveUpdates(_0x582476['body'],null))[_0x07dd('0x28')](respondWithResult(_0x1e513e,null))[_0x07dd('0x48')](handleError(_0x1e513e,null));};exports[_0x07dd('0x29')]=function(_0x442464,_0x456c8c){return db['Variable'][_0x07dd('0x4c')]({'where':{'id':_0x442464[_0x07dd('0x4a')]['id']}})[_0x07dd('0x28')](handleEntityNotFound(_0x456c8c,null))[_0x07dd('0x28')](removeEntity(_0x456c8c,null))[_0x07dd('0x48')](handleError(_0x456c8c,null));}; \ No newline at end of file +var _0xa937=['map','Variable','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','catch','show','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','name','index'];(function(_0x22a385,_0x179b2e){var _0x6877e7=function(_0x1f37db){while(--_0x1f37db){_0x22a385['push'](_0x22a385['shift']());}};_0x6877e7(++_0x179b2e);}(_0xa937,0xc4));var _0x7a93=function(_0x2b10b3,_0x4f476d){_0x2b10b3=_0x2b10b3-0x0;var _0x27b99e=_0xa937[_0x2b10b3];return _0x27b99e;};'use strict';var emlformat=require(_0x7a93('0x0'));var rimraf=require(_0x7a93('0x1'));var zipdir=require(_0x7a93('0x2'));var jsonpatch=require(_0x7a93('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7a93('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x7a93('0x5'));var ejs=require(_0x7a93('0x6'));var fs=require('fs');var fs_extra=require(_0x7a93('0x7'));var _=require(_0x7a93('0x8'));var squel=require(_0x7a93('0x9'));var crypto=require(_0x7a93('0xa'));var jsforce=require(_0x7a93('0xb'));var deskjs=require(_0x7a93('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7a93('0xd'));var Papa=require(_0x7a93('0xe'));var Redis=require(_0x7a93('0xf'));var authService=require(_0x7a93('0x10'));var qs=require(_0x7a93('0x11'));var as=require(_0x7a93('0x12'));var hardwareService=require(_0x7a93('0x13'));var logger=require('../../config/logger')(_0x7a93('0x14'));var utils=require(_0x7a93('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7a93('0x16'));var db=require(_0x7a93('0x17'))['db'];function respondWithStatusCode(_0x444e87,_0x4f2ea9){_0x4f2ea9=_0x4f2ea9||0xcc;return function(_0x55f80f){if(_0x55f80f){return _0x444e87[_0x7a93('0x18')](_0x4f2ea9);}return _0x444e87[_0x7a93('0x19')](_0x4f2ea9)[_0x7a93('0x1a')]();};}function respondWithResult(_0xfd2be7,_0x63f28e){_0x63f28e=_0x63f28e||0xc8;return function(_0x5f39a4){if(_0x5f39a4){return _0xfd2be7[_0x7a93('0x19')](_0x63f28e)[_0x7a93('0x1b')](_0x5f39a4);}};}function respondWithFilteredResult(_0x48f22a,_0x123af3){return function(_0x332575){if(_0x332575){var _0x813fe9=typeof _0x123af3['offset']===_0x7a93('0x1c')&&typeof _0x123af3[_0x7a93('0x1d')]===_0x7a93('0x1c');var _0x9d25be=_0x332575['count'];var _0x224103=_0x813fe9?0x0:_0x123af3['offset'];var _0x4e3b4d=_0x813fe9?_0x332575[_0x7a93('0x1e')]:_0x123af3[_0x7a93('0x1f')]+_0x123af3[_0x7a93('0x1d')];var _0x3873af;if(_0x4e3b4d>=_0x9d25be){_0x4e3b4d=_0x9d25be;_0x3873af=0xc8;}else{_0x3873af=0xce;}_0x48f22a[_0x7a93('0x19')](_0x3873af);return _0x48f22a[_0x7a93('0x20')](_0x7a93('0x21'),_0x224103+'-'+_0x4e3b4d+'/'+_0x9d25be)[_0x7a93('0x1b')](_0x332575);}return null;};}function patchUpdates(_0x3e3257){return function(_0xe21ef1){try{jsonpatch[_0x7a93('0x22')](_0xe21ef1,_0x3e3257,!![]);}catch(_0x18e68a){return BPromise[_0x7a93('0x23')](_0x18e68a);}return _0xe21ef1['save']();};}function saveUpdates(_0x4cb1a2,_0xa9bb43){return function(_0x13de5e){if(_0x13de5e){return _0x13de5e[_0x7a93('0x24')](_0x4cb1a2)[_0x7a93('0x25')](function(_0x40a790){return _0x40a790;});}return null;};}function removeEntity(_0x3a388e,_0x4f05d1){return function(_0x376db6){if(_0x376db6){return _0x376db6[_0x7a93('0x26')]()[_0x7a93('0x25')](function(){var _0x309fac=_0x376db6[_0x7a93('0x27')]({'plain':!![]});var _0x3e46cb='Variables';return db[_0x7a93('0x28')]['destroy']({'where':{'type':_0x3e46cb,'resourceId':_0x309fac['id']}})[_0x7a93('0x25')](function(){return _0x376db6;});})[_0x7a93('0x25')](function(){_0x3a388e[_0x7a93('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cdcd5,_0x3cfd08){return function(_0x2e50c2){if(!_0x2e50c2){_0x3cdcd5[_0x7a93('0x18')](0x194);}return _0x2e50c2;};}function handleError(_0x337b5b,_0x336910){_0x336910=_0x336910||0x1f4;return function(_0x115a21){logger[_0x7a93('0x29')](_0x115a21['stack']);if(_0x115a21[_0x7a93('0x2a')]){delete _0x115a21[_0x7a93('0x2a')];}_0x337b5b[_0x7a93('0x19')](_0x336910)['send'](_0x115a21);};}exports[_0x7a93('0x2b')]=function(_0x50a50b,_0x176577){var _0x3ba3ee={},_0xd10ae1={},_0x15cdd0={'count':0x0,'rows':[]};var _0x275ea5=_[_0x7a93('0x2c')](db[_0x7a93('0x2d')][_0x7a93('0x2e')],function(_0x407d93){return{'name':_0x407d93[_0x7a93('0x2f')],'type':_0x407d93[_0x7a93('0x30')][_0x7a93('0x31')]};});_0xd10ae1[_0x7a93('0x32')]=_['map'](_0x275ea5,_0x7a93('0x2a'));_0xd10ae1[_0x7a93('0x33')]=_[_0x7a93('0x34')](_0x50a50b[_0x7a93('0x33')]);_0xd10ae1[_0x7a93('0x35')]=_[_0x7a93('0x36')](_0xd10ae1[_0x7a93('0x32')],_0xd10ae1[_0x7a93('0x33')]);_0x3ba3ee[_0x7a93('0x37')]=_[_0x7a93('0x36')](_0xd10ae1[_0x7a93('0x32')],qs[_0x7a93('0x38')](_0x50a50b[_0x7a93('0x33')][_0x7a93('0x38')]));_0x3ba3ee[_0x7a93('0x37')]=_0x3ba3ee[_0x7a93('0x37')][_0x7a93('0x39')]?_0x3ba3ee[_0x7a93('0x37')]:_0xd10ae1[_0x7a93('0x32')];if(!_0x50a50b[_0x7a93('0x33')][_0x7a93('0x3a')](_0x7a93('0x3b'))){_0x3ba3ee[_0x7a93('0x1d')]=qs[_0x7a93('0x1d')](_0x50a50b[_0x7a93('0x33')][_0x7a93('0x1d')]);_0x3ba3ee[_0x7a93('0x1f')]=qs[_0x7a93('0x1f')](_0x50a50b['query']['offset']);}_0x3ba3ee[_0x7a93('0x3c')]=qs[_0x7a93('0x3d')](_0x50a50b[_0x7a93('0x33')][_0x7a93('0x3d')]);_0x3ba3ee[_0x7a93('0x3e')]=qs[_0x7a93('0x35')](_['pick'](_0x50a50b['query'],_0xd10ae1[_0x7a93('0x35')]),_0x275ea5);if(_0x50a50b['query'][_0x7a93('0x3f')]){_0x3ba3ee['where']=_[_0x7a93('0x40')](_0x3ba3ee['where'],{'$or':_[_0x7a93('0x2c')](_0x275ea5,function(_0x2b2092){if(_0x2b2092[_0x7a93('0x30')]!==_0x7a93('0x41')){var _0xbf9225={};_0xbf9225[_0x2b2092[_0x7a93('0x2a')]]={'$like':'%'+_0x50a50b['query']['filter']+'%'};return _0xbf9225;}})});}_0x3ba3ee=_[_0x7a93('0x40')]({},_0x3ba3ee,_0x50a50b['options']);var _0x351e9e={'where':_0x3ba3ee[_0x7a93('0x3e')]};return db['Variable'][_0x7a93('0x1e')](_0x351e9e)[_0x7a93('0x25')](function(_0x52f4bd){_0x15cdd0[_0x7a93('0x1e')]=_0x52f4bd;if(_0x50a50b[_0x7a93('0x33')][_0x7a93('0x42')]){_0x3ba3ee[_0x7a93('0x43')]=[{'all':!![]}];}return db[_0x7a93('0x2d')]['findAll'](_0x3ba3ee);})[_0x7a93('0x25')](function(_0x31da21){_0x15cdd0['rows']=_0x31da21;return _0x15cdd0;})[_0x7a93('0x25')](respondWithFilteredResult(_0x176577,_0x3ba3ee))[_0x7a93('0x44')](handleError(_0x176577,null));};exports[_0x7a93('0x45')]=function(_0x2c34a0,_0xdc075f){var _0x49fd52={'raw':!![],'where':{'id':_0x2c34a0[_0x7a93('0x46')]['id']}},_0x329628={};_0x329628['model']=_[_0x7a93('0x34')](db[_0x7a93('0x2d')][_0x7a93('0x2e')]);_0x329628[_0x7a93('0x33')]=_['keys'](_0x2c34a0[_0x7a93('0x33')]);_0x329628[_0x7a93('0x35')]=_['intersection'](_0x329628['model'],_0x329628[_0x7a93('0x33')]);_0x49fd52['attributes']=_[_0x7a93('0x36')](_0x329628[_0x7a93('0x32')],qs[_0x7a93('0x38')](_0x2c34a0[_0x7a93('0x33')][_0x7a93('0x38')]));_0x49fd52[_0x7a93('0x37')]=_0x49fd52[_0x7a93('0x37')][_0x7a93('0x39')]?_0x49fd52[_0x7a93('0x37')]:_0x329628['model'];if(_0x2c34a0[_0x7a93('0x33')][_0x7a93('0x42')]){_0x49fd52['include']=[{'all':!![]}];}_0x49fd52=_['merge']({},_0x49fd52,_0x2c34a0[_0x7a93('0x47')]);return db[_0x7a93('0x2d')][_0x7a93('0x48')](_0x49fd52)['then'](handleEntityNotFound(_0xdc075f,null))[_0x7a93('0x25')](respondWithResult(_0xdc075f,null))[_0x7a93('0x44')](handleError(_0xdc075f,null));};exports[_0x7a93('0x49')]=function(_0x96c800,_0x65f881){return db[_0x7a93('0x2d')][_0x7a93('0x49')](_0x96c800['body'],{})['then'](function(_0x4497b0){var _0x4e0ecd=_0x96c800[_0x7a93('0x4a')][_0x7a93('0x27')]({'plain':!![]});if(!_0x4e0ecd)throw new Error(_0x7a93('0x4b'));if(_0x4e0ecd['role']===_0x7a93('0x4a')){var _0x29ab89=_0x4497b0[_0x7a93('0x27')]({'plain':!![]});var _0x118efa='Variables';return db['UserProfileSection'][_0x7a93('0x48')]({'where':{'name':_0x118efa,'userProfileId':_0x4e0ecd[_0x7a93('0x4c')]},'raw':!![]})[_0x7a93('0x25')](function(_0x1dd05b){if(_0x1dd05b&&_0x1dd05b[_0x7a93('0x4d')]===0x0){return db[_0x7a93('0x28')]['create']({'name':_0x29ab89[_0x7a93('0x2a')],'resourceId':_0x29ab89['id'],'type':_0x1dd05b[_0x7a93('0x2a')],'sectionId':_0x1dd05b['id']},{})['then'](function(){return _0x4497b0;});}else{return _0x4497b0;}})[_0x7a93('0x44')](function(_0x1c35b9){logger[_0x7a93('0x29')](_0x7a93('0x4e'),_0x1c35b9);throw _0x1c35b9;});}return _0x4497b0;})['then'](respondWithResult(_0x65f881,0xc9))['catch'](handleError(_0x65f881,null));};exports[_0x7a93('0x24')]=function(_0x5b14ae,_0x384004){if(_0x5b14ae[_0x7a93('0x4f')]['id']){delete _0x5b14ae[_0x7a93('0x4f')]['id'];}return db[_0x7a93('0x2d')]['find']({'where':{'id':_0x5b14ae[_0x7a93('0x46')]['id']}})[_0x7a93('0x25')](handleEntityNotFound(_0x384004,null))['then'](saveUpdates(_0x5b14ae[_0x7a93('0x4f')],null))[_0x7a93('0x25')](respondWithResult(_0x384004,null))['catch'](handleError(_0x384004,null));};exports[_0x7a93('0x26')]=function(_0x5b4e4f,_0x5d22bb){return db['Variable']['find']({'where':{'id':_0x5b4e4f['params']['id']}})[_0x7a93('0x25')](handleEntityNotFound(_0x5d22bb,null))[_0x7a93('0x25')](removeEntity(_0x5d22bb,null))['catch'](handleError(_0x5d22bb,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 2accecc..7dddacb 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 _0x25ad=['define','Variable','tools_variables','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x21384d,_0xca16){var _0x118772=function(_0x1d7429){while(--_0x1d7429){_0x21384d['push'](_0x21384d['shift']());}};_0x118772(++_0xca16);}(_0x25ad,0x1bb));var _0xd25a=function(_0x51b1d4,_0x278dbb){_0x51b1d4=_0x51b1d4-0x0;var _0x4e0cee=_0x25ad[_0x51b1d4];return _0x4e0cee;};'use strict';var _=require('lodash');var util=require(_0xd25a('0x0'));var logger=require(_0xd25a('0x1'))('api');var moment=require(_0xd25a('0x2'));var BPromise=require(_0xd25a('0x3'));var rp=require(_0xd25a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd25a('0x5'));var config=require(_0xd25a('0x6'));var attributes=require('./variable.attributes');module[_0xd25a('0x7')]=function(_0x3d13a9,_0x43d107){return _0x3d13a9[_0xd25a('0x8')](_0xd25a('0x9'),attributes,{'tableName':_0xd25a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf9ae=['tools_variables','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','Variable'];(function(_0x37a9d7,_0x2b6fde){var _0x1343d3=function(_0x3bde45){while(--_0x3bde45){_0x37a9d7['push'](_0x37a9d7['shift']());}};_0x1343d3(++_0x2b6fde);}(_0xf9ae,0x85));var _0xef9a=function(_0x2616dd,_0x544a38){_0x2616dd=_0x2616dd-0x0;var _0x5a6c9a=_0xf9ae[_0x2616dd];return _0x5a6c9a;};'use strict';var _=require(_0xef9a('0x0'));var util=require(_0xef9a('0x1'));var logger=require('../../config/logger')(_0xef9a('0x2'));var moment=require(_0xef9a('0x3'));var BPromise=require(_0xef9a('0x4'));var rp=require(_0xef9a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xef9a('0x6'));var config=require(_0xef9a('0x7'));var attributes=require('./variable.attributes');module[_0xef9a('0x8')]=function(_0x2d1c4b,_0x3b33d6){return _0x2d1c4b['define'](_0xef9a('0x9'),attributes,{'tableName':_0xef9a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 2322ede..fb8e86a 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 _0xabce=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowVariable','Variable','find','options','attributes','map','include','model','catch','lodash','util'];(function(_0x59861c,_0x48ccaa){var _0x239dcd=function(_0x5bcc50){while(--_0x5bcc50){_0x59861c['push'](_0x59861c['shift']());}};_0x239dcd(++_0x48ccaa);}(_0xabce,0x103));var _0xeabc=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0xabce[_0x54d4a8];return _0x3b321b;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Variable,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});}exports[_0xeabc('0x14')]=function(_0x58a3c0){var _0x16f08b=this;return new Promise(function(_0x31dd53,_0x31f52a){return db[_0xeabc('0x15')][_0xeabc('0x16')]({'raw':_0x58a3c0['options']?_0x58a3c0[_0xeabc('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['where']||null:null,'attributes':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x18')]||null:null,'include':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['include']?_[_0xeabc('0x19')](_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x1a')],function(_0x5bdd57){return{'model':db[_0x5bdd57[_0xeabc('0x1b')]],'as':_0x5bdd57['as'],'attributes':_0x5bdd57[_0xeabc('0x18')],'include':_0x5bdd57[_0xeabc('0x1a')]?_[_0xeabc('0x19')](_0x5bdd57['include'],function(_0x109e1d){return{'model':db[_0x109e1d['model']],'as':_0x109e1d['as'],'attributes':_0x109e1d[_0xeabc('0x18')],'include':_0x109e1d['include']?_[_0xeabc('0x19')](_0x109e1d[_0xeabc('0x1a')],function(_0x269621){return{'model':db[_0x269621[_0xeabc('0x1b')]],'as':_0x269621['as'],'attributes':_0x269621[_0xeabc('0x18')]};}):[]};}):[]};}):[]:[]})[_0xeabc('0x9')](function(_0x131722){logger['info']('ShowVariable',_0x58a3c0);logger[_0xeabc('0xd')]('ShowVariable',_0x58a3c0,JSON[_0xeabc('0xf')](_0x131722));_0x31dd53(_0x131722);})[_0xeabc('0x1c')](function(_0x48fb52){logger[_0xeabc('0x10')](_0xeabc('0x14'),_0x48fb52[_0xeabc('0x12')],_0x58a3c0);_0x31f52a(_0x16f08b[_0xeabc('0x10')](0x1f4,_0x48fb52[_0xeabc('0x12')]));});});}; \ No newline at end of file +var _0x9957=['stringify','error','code','message','result','catch','ShowVariable','find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x37eea2,_0x47fd95){var _0x10a86f=function(_0x164860){while(--_0x164860){_0x37eea2['push'](_0x37eea2['shift']());}};_0x10a86f(++_0x47fd95);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Variable,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Variable'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')]['include'],function(_0x32a09a){return{'model':db[_0x32a09a[_0x7995('0x20')]],'as':_0x32a09a['as'],'attributes':_0x32a09a[_0x7995('0x1d')],'include':_0x32a09a[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x32a09a[_0x7995('0x1e')],function(_0x475351){return{'model':db[_0x475351[_0x7995('0x20')]],'as':_0x475351['as'],'attributes':_0x475351['attributes'],'include':_0x475351[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x475351[_0x7995('0x1e')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x20')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47625f){logger['info'](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x47625f));_0x37a7d4(_0x47625f);})[_0x7995('0x17')](function(_0x4b6f99){logger[_0x7995('0x13')]('ShowVariable',_0x4b6f99[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x4b6f99[_0x7995('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 270e4ae..54d5694 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 _0x0327=['index','get','isAuthenticated','canUpdate','fetch','/reset','pull','/restart','restart','migrations','exports','express','Router','../../components/auth/service','./version.controller'];(function(_0x544443,_0x51526a){var _0x25610c=function(_0x4617d3){while(--_0x4617d3){_0x544443['push'](_0x544443['shift']());}};_0x25610c(++_0x51526a);}(_0x0327,0xce));var _0x7032=function(_0x1800ce,_0x44fc6b){_0x1800ce=_0x1800ce-0x0;var _0x26d534=_0x0327[_0x1800ce];return _0x26d534;};'use strict';var express=require(_0x7032('0x0'));var router=express[_0x7032('0x1')]();var auth=require(_0x7032('0x2'));var controller=require(_0x7032('0x3'));router['get']('/',controller[_0x7032('0x4')]);router[_0x7032('0x5')]('/fetch',auth[_0x7032('0x6')](),auth[_0x7032('0x7')](),controller[_0x7032('0x8')]);router[_0x7032('0x5')](_0x7032('0x9'),auth[_0x7032('0x6')](),auth[_0x7032('0x7')](),controller['reset']);router['get']('/pull',auth['isAuthenticated'](),auth[_0x7032('0x7')](),controller[_0x7032('0xa')]);router['get'](_0x7032('0xb'),auth['isAuthenticated'](),controller[_0x7032('0xc')]);router[_0x7032('0x5')]('/migrations',controller[_0x7032('0xd')]);module[_0x7032('0xe')]=router; \ No newline at end of file +var _0x2896=['pull','/restart','/migrations','exports','express','get','/fetch','canUpdate','fetch','/reset','isAuthenticated','reset'];(function(_0x22e75f,_0x255868){var _0x35c241=function(_0x2696be){while(--_0x2696be){_0x22e75f['push'](_0x22e75f['shift']());}};_0x35c241(++_0x255868);}(_0x2896,0x7c));var _0x6289=function(_0x5e06e0,_0x43a2ca){_0x5e06e0=_0x5e06e0-0x0;var _0x356b2a=_0x2896[_0x5e06e0];return _0x356b2a;};'use strict';var express=require(_0x6289('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./version.controller');router[_0x6289('0x1')]('/',controller['index']);router[_0x6289('0x1')](_0x6289('0x2'),auth['isAuthenticated'](),auth[_0x6289('0x3')](),controller[_0x6289('0x4')]);router[_0x6289('0x1')](_0x6289('0x5'),auth[_0x6289('0x6')](),auth[_0x6289('0x3')](),controller[_0x6289('0x7')]);router['get']('/pull',auth['isAuthenticated'](),auth[_0x6289('0x3')](),controller[_0x6289('0x8')]);router[_0x6289('0x1')](_0x6289('0x9'),auth[_0x6289('0x6')](),controller['restart']);router['get'](_0x6289('0xa'),controller['migrations']);module[_0x6289('0xb')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 5f1a216..c62fc38 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 _0x1b0c=['git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','server','replace','.js','push','length','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.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','join','UniqueConstraintError','Database\x20already\x20up-to-date','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','update','root','index','query','latest','fetch','tags','exports','2.0.0','status','json','origin','master','error','info','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x1b0c,0xfd));var _0xc1b0=function(_0x3f239d,_0x1e4675){_0x3f239d=_0x3f239d-0x0;var _0x46f035=_0x1b0c[_0x3f239d];return _0x46f035;};'use strict';var Umzug=require('umzug');var path=require('path');var fs=require('fs');var _=require(_0xc1b0('0x0'));var pkginfo=require(_0xc1b0('0x1'))(module,_0xc1b0('0x2'));var compareVersions=require(_0xc1b0('0x3'));var exec=require(_0xc1b0('0x4'))[_0xc1b0('0x5')];var db=require(_0xc1b0('0x6'))['db'];var config=require('../../config/environment');var pm2=require(_0xc1b0('0x7'));var logger=require(_0xc1b0('0x8'))(_0xc1b0('0x9'));var git=require('simple-git')(config[_0xc1b0('0xa')]);exports[_0xc1b0('0xb')]=function(_0x591a89,_0x53d056){var _0x459253={'current':module['exports']['version'],'phonebar':0x2};if(_0x591a89[_0xc1b0('0xc')]&&_0x591a89['query'][_0xc1b0('0xd')]){return git[_0xc1b0('0xe')]()[_0xc1b0('0xf')](function(_0x211cd7,_0x5a1269){_0x459253[_0xc1b0('0xd')]=(_0x211cd7?module[_0xc1b0('0x10')]['version']:_0x5a1269['latest'])||_0xc1b0('0x11');return _0x53d056[_0xc1b0('0x12')](0xc8)[_0xc1b0('0x13')](_0x459253);});}else{return _0x53d056['status'](0xc8)['json'](_0x459253);}};exports[_0xc1b0('0xe')]=function(_0xcb59e1,_0x41fb17){return git[_0xc1b0('0xe')]([_0xc1b0('0x14'),_0xc1b0('0x15')],function(_0x3ead27){if(_0x3ead27){logger[_0xc1b0('0x16')](_0x3ead27);return _0x41fb17[_0xc1b0('0x12')](0x1f4)[_0xc1b0('0x13')](_0x3ead27);}logger[_0xc1b0('0x17')]('git\x20fetch');return _0x41fb17['status'](0xc8)[_0xc1b0('0x13')]({'output':_0xc1b0('0x18')});});};exports[_0xc1b0('0x19')]=function(_0x314309,_0x1d373e){return git['reset'](['--hard',_0xc1b0('0x1a')],function(_0x234a53){if(_0x234a53){logger[_0xc1b0('0x16')](_0x234a53);return _0x1d373e[_0xc1b0('0x12')](0x1f4)['json'](_0x234a53);}logger['info']('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x1d373e[_0xc1b0('0x12')](0xc8)[_0xc1b0('0x13')]({'output':_0xc1b0('0x1b')});});};exports[_0xc1b0('0x1c')]=function(_0x442614,_0x4eaa8b){exec(_0xc1b0('0x1d'),function(_0x201531,_0x4fa1e4,_0x33c1c6){logger[_0xc1b0('0x17')](_0x4fa1e4);logger[_0xc1b0('0x17')](_0x33c1c6);if(_0x201531){logger[_0xc1b0('0x16')](_0x201531);return _0x4eaa8b[_0xc1b0('0x12')](0x1f4)[_0xc1b0('0x13')](_0x201531);}return _0x4eaa8b[_0xc1b0('0x12')](0xc8)[_0xc1b0('0x13')]({'output':_0x4fa1e4});});};exports[_0xc1b0('0x1e')]=function(_0x1762de,_0xd45e28){return pm2[_0xc1b0('0x1e')](_0xc1b0('0x1f'))[_0xc1b0('0x20')](function(_0x35ba5e){logger[_0xc1b0('0x17')](_0xc1b0('0x21'),_0x35ba5e);return _0xd45e28[_0xc1b0('0x12')](0xc8)[_0xc1b0('0x13')]({'output':_0xc1b0('0x22')});})[_0xc1b0('0x23')](function(_0xbbf88a){logger[_0xc1b0('0x16')](_0xbbf88a);return _0xd45e28[_0xc1b0('0x12')](0x1f4)[_0xc1b0('0x13')](_0xbbf88a);});};exports[_0xc1b0('0x24')]=function(_0xb41111,_0x51f24c){var _0x1ae2da=fs[_0xc1b0('0x25')](path['join'](config[_0xc1b0('0xa')],_0xc1b0('0x26'),'migrations'));var _0x1b183d=[];for(var _0x3b5cb9=0x0;_0x3b5cb9<_0x1ae2da['length'];_0x3b5cb9++){var _0x1bd27f=_0x1ae2da[_0x3b5cb9][_0xc1b0('0x27')](_0xc1b0('0x28'),'');if(compareVersions(module[_0xc1b0('0x10')]['version'],_0x1bd27f)===-0x1){_0x1b183d[_0xc1b0('0x29')](_0x1bd27f);}}if(_0x1b183d[_0xc1b0('0x2a')]){var _0x3f9034=_0x1b183d[_0xc1b0('0x2b')](compareVersions);var _0xb9925a=new Umzug({'storage':_0xc1b0('0x2c'),'storageOptions':{'model':db[_0xc1b0('0x2d')],'modelName':_0xc1b0('0x2d'),'columnName':_0xc1b0('0x2')},'migrations':{'params':[db['sequelize'][_0xc1b0('0x2e')](),db['sequelize'][_0xc1b0('0x2f')],function(){throw new Error(_0xc1b0('0x30'));}],'path':path['join'](config['root'],_0xc1b0('0x26'),_0xc1b0('0x24')),'pattern':/\.js$/}});_0xb9925a['up']({'migrations':_[_0xc1b0('0x31')](_0x3f9034,function(_0x269139){return _0x269139+'.js';})})[_0xc1b0('0x20')](function(){return _0x51f24c[_0xc1b0('0x12')](0xc8)[_0xc1b0('0x13')]({'output':_0xc1b0('0x32')+module[_0xc1b0('0x10')][_0xc1b0('0x2')]+_0xc1b0('0x33')+_[_0xc1b0('0x34')](_0x3f9034),'migrations':_[_0xc1b0('0x35')](_0x3f9034)});})[_0xc1b0('0x23')](function(_0x42e252){if(_0x42e252 instanceof db['sequelize'][_0xc1b0('0x36')]){return _0x51f24c['status'](0xc8)[_0xc1b0('0x13')]({'output':_0xc1b0('0x37')});}else{return _0x51f24c[_0xc1b0('0x12')](0x1f4)[_0xc1b0('0x13')](_0x42e252);}});}else{return _0x51f24c['status'](0xc8)['json']({'output':_0xc1b0('0x37')});}}; \ No newline at end of file +var _0x7603=['lodash','pkginfo','version','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','update','root','index','exports','query','latest','fetch','tags','2.0.0','json','status','master','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','error','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','replace','push','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','last','UniqueConstraintError','Database\x20already\x20up-to-date','path'];(function(_0x32de2f,_0x459029){var _0x24cf92=function(_0x12996c){while(--_0x12996c){_0x32de2f['push'](_0x32de2f['shift']());}};_0x24cf92(++_0x459029);}(_0x7603,0x19f));var _0x3760=function(_0x3fc2b6,_0x15df05){_0x3fc2b6=_0x3fc2b6-0x0;var _0x6fb909=_0x7603[_0x3fc2b6];return _0x6fb909;};'use strict';var Umzug=require('umzug');var path=require(_0x3760('0x0'));var fs=require('fs');var _=require(_0x3760('0x1'));var pkginfo=require(_0x3760('0x2'))(module,_0x3760('0x3'));var compareVersions=require('compare-versions');var exec=require(_0x3760('0x4'))[_0x3760('0x5')];var db=require(_0x3760('0x6'))['db'];var config=require('../../config/environment');var pm2=require(_0x3760('0x7'));var logger=require(_0x3760('0x8'))(_0x3760('0x9'));var git=require('simple-git')(config[_0x3760('0xa')]);exports[_0x3760('0xb')]=function(_0xae503a,_0xdaf0fc){var _0x4771ea={'current':module[_0x3760('0xc')][_0x3760('0x3')],'phonebar':0x2};if(_0xae503a['query']&&_0xae503a[_0x3760('0xd')][_0x3760('0xe')]){return git[_0x3760('0xf')]()[_0x3760('0x10')](function(_0x178435,_0x2d51d7){_0x4771ea[_0x3760('0xe')]=(_0x178435?module[_0x3760('0xc')][_0x3760('0x3')]:_0x2d51d7[_0x3760('0xe')])||_0x3760('0x11');return _0xdaf0fc['status'](0xc8)[_0x3760('0x12')](_0x4771ea);});}else{return _0xdaf0fc[_0x3760('0x13')](0xc8)[_0x3760('0x12')](_0x4771ea);}};exports['fetch']=function(_0x2cc952,_0x2cc6d7){return git[_0x3760('0xf')](['origin',_0x3760('0x14')],function(_0x37cf02){if(_0x37cf02){logger['error'](_0x37cf02);return _0x2cc6d7[_0x3760('0x13')](0x1f4)[_0x3760('0x12')](_0x37cf02);}logger['info']('git\x20fetch');return _0x2cc6d7[_0x3760('0x13')](0xc8)['json']({'output':_0x3760('0x15')});});};exports[_0x3760('0x16')]=function(_0x410abf,_0x50c730){return git[_0x3760('0x16')]([_0x3760('0x17'),_0x3760('0x18')],function(_0x2e4e2e){if(_0x2e4e2e){logger['error'](_0x2e4e2e);return _0x50c730['status'](0x1f4)['json'](_0x2e4e2e);}logger[_0x3760('0x19')](_0x3760('0x1a'));return _0x50c730[_0x3760('0x13')](0xc8)['json']({'output':'git\x20reset\x20--hard'});});};exports[_0x3760('0x1b')]=function(_0x3021ea,_0x16176a){exec(_0x3760('0x1c'),function(_0x3a54ed,_0x2f926a,_0x3e0a39){logger[_0x3760('0x19')](_0x2f926a);logger[_0x3760('0x19')](_0x3e0a39);if(_0x3a54ed){logger[_0x3760('0x1d')](_0x3a54ed);return _0x16176a['status'](0x1f4)[_0x3760('0x12')](_0x3a54ed);}return _0x16176a[_0x3760('0x13')](0xc8)[_0x3760('0x12')]({'output':_0x2f926a});});};exports['restart']=function(_0x4b7233,_0x473d34){return pm2[_0x3760('0x1e')](_0x3760('0x1f'))[_0x3760('0x20')](function(_0x567366){logger['info'](_0x3760('0x21'),_0x567366);return _0x473d34[_0x3760('0x13')](0xc8)[_0x3760('0x12')]({'output':_0x3760('0x22')});})[_0x3760('0x23')](function(_0x7e733f){logger[_0x3760('0x1d')](_0x7e733f);return _0x473d34[_0x3760('0x13')](0x1f4)[_0x3760('0x12')](_0x7e733f);});};exports[_0x3760('0x24')]=function(_0x3243b2,_0x2b0b03){var _0x1ca0f4=fs[_0x3760('0x25')](path[_0x3760('0x26')](config[_0x3760('0xa')],_0x3760('0x27'),_0x3760('0x24')));var _0x4b78fe=[];for(var _0xb93631=0x0;_0xb93631<_0x1ca0f4[_0x3760('0x28')];_0xb93631++){var _0x5d5a02=_0x1ca0f4[_0xb93631][_0x3760('0x29')]('.js','');if(compareVersions(module['exports']['version'],_0x5d5a02)===-0x1){_0x4b78fe[_0x3760('0x2a')](_0x5d5a02);}}if(_0x4b78fe[_0x3760('0x28')]){var _0x3b9662=_0x4b78fe['sort'](compareVersions);var _0x4d3e7d=new Umzug({'storage':_0x3760('0x2b'),'storageOptions':{'model':db['Migration'],'modelName':_0x3760('0x2c'),'columnName':_0x3760('0x3')},'migrations':{'params':[db[_0x3760('0x2b')][_0x3760('0x2d')](),db[_0x3760('0x2b')]['constructor'],function(){throw new Error(_0x3760('0x2e'));}],'path':path[_0x3760('0x26')](config[_0x3760('0xa')],'server',_0x3760('0x24')),'pattern':/\.js$/}});_0x4d3e7d['up']({'migrations':_[_0x3760('0x2f')](_0x3b9662,function(_0x50a1a8){return _0x50a1a8+'.js';})})['then'](function(){return _0x2b0b03[_0x3760('0x13')](0xc8)['json']({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x3760('0xc')][_0x3760('0x3')]+_0x3760('0x30')+_[_0x3760('0x31')](_0x3b9662),'migrations':_[_0x3760('0x26')](_0x3b9662)});})[_0x3760('0x23')](function(_0xa85f70){if(_0xa85f70 instanceof db[_0x3760('0x2b')][_0x3760('0x32')]){return _0x2b0b03[_0x3760('0x13')](0xc8)[_0x3760('0x12')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x2b0b03[_0x3760('0x13')](0x1f4)[_0x3760('0x12')](_0xa85f70);}});}else{return _0x2b0b03[_0x3760('0x13')](0xc8)[_0x3760('0x12')]({'output':_0x3760('0x33')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 3ce8328..461f789 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 _0x8c69=['/describe','describe','/:id','show','put','update','delete','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index'];(function(_0x1d03c4,_0x1cbf92){var _0x121f22=function(_0x4e4c4d){while(--_0x4e4c4d){_0x1d03c4['push'](_0x1d03c4['shift']());}};_0x121f22(++_0x1cbf92);}(_0x8c69,0x8f));var _0x98c6=function(_0x5c88fe,_0x67178d){_0x5c88fe=_0x5c88fe-0x0;var _0x367979=_0x8c69[_0x5c88fe];return _0x367979;};'use strict';var multer=require(_0x98c6('0x0'));var util=require(_0x98c6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x98c6('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x98c6('0x3'));var interaction=require(_0x98c6('0x4'));var config=require(_0x98c6('0x5'));var controller=require(_0x98c6('0x6'));router[_0x98c6('0x7')]('/',auth[_0x98c6('0x8')](),controller[_0x98c6('0x9')]);router[_0x98c6('0x7')](_0x98c6('0xa'),auth[_0x98c6('0x8')](),controller[_0x98c6('0xb')]);router['get'](_0x98c6('0xc'),auth[_0x98c6('0x8')](),controller[_0x98c6('0xd')]);router['post']('/',auth[_0x98c6('0x8')](),controller['create']);router[_0x98c6('0xe')](_0x98c6('0xc'),auth['isAuthenticated'](),controller[_0x98c6('0xf')]);router[_0x98c6('0x10')](_0x98c6('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6dfb=['get','describe','/:id','show','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','isAuthenticated','index'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x6dfb,0xf1));var _0xb6df=function(_0x38df1e,_0x487f4f){_0x38df1e=_0x38df1e-0x0;var _0x509e1e=_0x6dfb[_0x38df1e];return _0x509e1e;};'use strict';var multer=require('multer');var util=require(_0xb6df('0x0'));var path=require(_0xb6df('0x1'));var timeout=require(_0xb6df('0x2'));var express=require(_0xb6df('0x3'));var router=express[_0xb6df('0x4')]();var fs_extra=require(_0xb6df('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb6df('0x6'));var config=require(_0xb6df('0x7'));var controller=require(_0xb6df('0x8'));router['get']('/',auth[_0xb6df('0x9')](),controller[_0xb6df('0xa')]);router[_0xb6df('0xb')]('/describe',auth[_0xb6df('0x9')](),controller[_0xb6df('0xc')]);router[_0xb6df('0xb')](_0xb6df('0xd'),auth[_0xb6df('0x9')](),controller[_0xb6df('0xe')]);router[_0xb6df('0xf')]('/',auth['isAuthenticated'](),controller[_0xb6df('0x10')]);router['put']('/:id',auth[_0xb6df('0x9')](),controller[_0xb6df('0x11')]);router[_0xb6df('0x12')](_0xb6df('0xd'),auth[_0xb6df('0x9')](),controller[_0xb6df('0x13')]);module[_0xb6df('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 347b3f6..fba526d 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 _0x93e6=['DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING'];(function(_0x18fe97,_0x1a8b99){var _0x4611ca=function(_0x185c86){while(--_0x185c86){_0x18fe97['push'](_0x18fe97['shift']());}};_0x4611ca(++_0x1a8b99);}(_0x93e6,0x11e));var _0x693e=function(_0x2d120a,_0x5e4d33){_0x2d120a=_0x2d120a-0x0;var _0x205747=_0x93e6[_0x2d120a];return _0x205747;};'use strict';var Sequelize=require(_0x693e('0x0'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x693e('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x693e('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x693e('0x1')]},'membername':{'type':Sequelize[_0x693e('0x1')]},'agentcalledAt':{'type':Sequelize[_0x693e('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x693e('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x693e('0x2')]},'agentdumpAt':{'type':Sequelize[_0x693e('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x693e('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x693e('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x693e('0x4')]},'reason':{'type':Sequelize[_0x693e('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x693e('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x693e('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x693e('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x693e('0x1')]},'exten':{'type':Sequelize[_0x693e('0x1')]},'priority':{'type':Sequelize[_0x693e('0x1')]},'destchannel':{'type':Sequelize[_0x693e('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x693e('0x1')]},'destcalleridnum':{'type':Sequelize[_0x693e('0x1')]},'destcalleridname':{'type':Sequelize[_0x693e('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x693e('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x693e('0x1')]},'destlanguage':{'type':Sequelize[_0x693e('0x1')]},'destaccountcode':{'type':Sequelize[_0x693e('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x693e('0x1')]},'destpriority':{'type':Sequelize[_0x693e('0x1')]},'destuniqueid':{'type':Sequelize[_0x693e('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x693e('0x1')]},'transfer':{'type':Sequelize[_0x693e('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x693e('0x1')],'comment':_0x693e('0x5')},'transferexten':{'type':Sequelize[_0x693e('0x1')]},'transferuniqueid':{'type':Sequelize[_0x693e('0x1')]},'agententerreason':{'type':Sequelize[_0x693e('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0972=['DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING'];(function(_0x2954fb,_0x40c726){var _0x443f36=function(_0x4bc63e){while(--_0x4bc63e){_0x2954fb['push'](_0x2954fb['shift']());}};_0x443f36(++_0x40c726);}(_0x0972,0x64));var _0x2097=function(_0x34d889,_0x563c5e){_0x34d889=_0x34d889-0x0;var _0xfc0793=_0x0972[_0x34d889];return _0xfc0793;};'use strict';var Sequelize=require('sequelize');module[_0x2097('0x0')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x2097('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2097('0x1')]},'queue':{'type':Sequelize[_0x2097('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x2097('0x1')]},'agentcalledAt':{'type':Sequelize[_0x2097('0x2')]},'agentconnectAt':{'type':Sequelize[_0x2097('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x2097('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x2097('0x2')]},'agentdumpAt':{'type':Sequelize[_0x2097('0x2')]},'holdtime':{'type':Sequelize[_0x2097('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x2097('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x2097('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x2097('0x3')]},'agentacw':{'type':Sequelize[_0x2097('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2097('0x3')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x2097('0x1')]},'channel':{'type':Sequelize[_0x2097('0x1')]},'channelstate':{'type':Sequelize[_0x2097('0x3')]},'channelstatedesc':{'type':Sequelize[_0x2097('0x1')]},'connectedlinenum':{'type':Sequelize[_0x2097('0x1')]},'connectedlinename':{'type':Sequelize[_0x2097('0x1')]},'language':{'type':Sequelize[_0x2097('0x1')]},'accountcode':{'type':Sequelize[_0x2097('0x1')]},'context':{'type':Sequelize[_0x2097('0x1')]},'exten':{'type':Sequelize[_0x2097('0x1')]},'priority':{'type':Sequelize[_0x2097('0x1')]},'destchannel':{'type':Sequelize[_0x2097('0x1')]},'destchannelstate':{'type':Sequelize[_0x2097('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x2097('0x1')]},'destcalleridnum':{'type':Sequelize[_0x2097('0x1')]},'destcalleridname':{'type':Sequelize[_0x2097('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x2097('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x2097('0x1')]},'destlanguage':{'type':Sequelize[_0x2097('0x1')]},'destaccountcode':{'type':Sequelize[_0x2097('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x2097('0x1')]},'destpriority':{'type':Sequelize[_0x2097('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x2097('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x2097('0x5')},'transferexten':{'type':Sequelize[_0x2097('0x1')]},'transferuniqueid':{'type':Sequelize[_0x2097('0x1')]},'agententerreason':{'type':Sequelize[_0x2097('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index b2e9741..1ef8326 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(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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 31f76da..d97a3a7 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 _0xbeea=['moment','request-promise','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','VoiceAgentReport','report_agent','destuniqueid','lodash','../../config/logger','api'];(function(_0xa8f19c,_0x47ae30){var _0x2f58c4=function(_0x30faf1){while(--_0x30faf1){_0xa8f19c['push'](_0xa8f19c['shift']());}};_0x2f58c4(++_0x47ae30);}(_0xbeea,0xb1));var _0xabee=function(_0x3a2c67,_0x32d339){_0x3a2c67=_0x3a2c67-0x0;var _0xeb9da5=_0xbeea[_0x3a2c67];return _0xeb9da5;};'use strict';var _=require(_0xabee('0x0'));var util=require('util');var logger=require(_0xabee('0x1'))(_0xabee('0x2'));var moment=require(_0xabee('0x3'));var BPromise=require('bluebird');var rp=require(_0xabee('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xabee('0x5'));var config=require(_0xabee('0x6'));var attributes=require(_0xabee('0x7'));module[_0xabee('0x8')]=function(_0x1ea258,_0x58c9ef){return _0x1ea258['define'](_0xabee('0x9'),attributes,{'tableName':_0xabee('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0xabee('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x84e7=['report_agent','uniqueid','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define'];(function(_0x44e0f9,_0x26dbae){var _0x15e4f5=function(_0x3c273a){while(--_0x3c273a){_0x44e0f9['push'](_0x44e0f9['shift']());}};_0x15e4f5(++_0x26dbae);}(_0x84e7,0x122));var _0x784e=function(_0x37601e,_0x365bb2){_0x37601e=_0x37601e-0x0;var _0x27ae01=_0x84e7[_0x37601e];return _0x27ae01;};'use strict';var _=require('lodash');var util=require(_0x784e('0x0'));var logger=require(_0x784e('0x1'))('api');var moment=require(_0x784e('0x2'));var BPromise=require(_0x784e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x784e('0x4'));var rimraf=require(_0x784e('0x5'));var config=require(_0x784e('0x6'));var attributes=require(_0x784e('0x7'));module[_0x784e('0x8')]=function(_0x133296,_0x48ed22){return _0x133296[_0x784e('0x9')]('VoiceAgentReport',attributes,{'tableName':_0x784e('0xa'),'paranoid':![],'indexes':[{'fields':[_0x784e('0xb'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 5d8cd9a..7499462 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 _0xecd4=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','update','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x544b41,_0x53aaed){var _0x3ef985=function(_0x494bc0){while(--_0x494bc0){_0x544b41['push'](_0x544b41['shift']());}};_0x3ef985(++_0x53aaed);}(_0xecd4,0x1a7));var _0x4ecd=function(_0x54818d,_0x2853a5){_0x54818d=_0x54818d-0x0;var _0x420ccb=_0xecd4[_0x54818d];return _0x420ccb;};'use strict';var _=require(_0x4ecd('0x0'));var util=require(_0x4ecd('0x1'));var moment=require(_0x4ecd('0x2'));var BPromise=require(_0x4ecd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4ecd('0x4'));var db=require(_0x4ecd('0x5'))['db'];var utils=require(_0x4ecd('0x6'));var logger=require(_0x4ecd('0x7'))(_0x4ecd('0x8'));var config=require(_0x4ecd('0x9'));var jayson=require(_0x4ecd('0xa'));var client=jayson['client'][_0x4ecd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x137261,_0x53e9d8,_0x4ebec2){return new BPromise(function(_0xe4dbca,_0x227aa5){return client[_0x4ecd('0xc')](_0x137261,_0x4ebec2)[_0x4ecd('0xd')](function(_0x2843e2){logger[_0x4ecd('0xe')](_0x4ecd('0xf'),_0x53e9d8,_0x4ecd('0x10'));logger[_0x4ecd('0x11')](_0x4ecd('0x12'),_0x53e9d8,_0x4ecd('0x10'),JSON[_0x4ecd('0x13')](_0x2843e2));if(_0x2843e2[_0x4ecd('0x14')]){if(_0x2843e2[_0x4ecd('0x14')][_0x4ecd('0x15')]===0x1f4){logger[_0x4ecd('0x14')](_0x4ecd('0xf'),_0x53e9d8,_0x2843e2[_0x4ecd('0x14')]['message']);return _0x227aa5(_0x2843e2[_0x4ecd('0x14')][_0x4ecd('0x16')]);}logger[_0x4ecd('0x14')]('VoiceAgentReport,\x20%s,\x20%s',_0x53e9d8,_0x2843e2['error'][_0x4ecd('0x16')]);return _0xe4dbca(_0x2843e2['error'][_0x4ecd('0x16')]);}else{logger[_0x4ecd('0xe')](_0x4ecd('0xf'),_0x53e9d8,_0x4ecd('0x10'));_0xe4dbca(_0x2843e2['result'][_0x4ecd('0x16')]);}})[_0x4ecd('0x17')](function(_0xce6cd){logger['error'](_0x4ecd('0xf'),_0x53e9d8,_0xce6cd);_0x227aa5(_0xce6cd);});});}exports[_0x4ecd('0x18')]=function(_0x53467b){var _0x567a4d=this;return new Promise(function(_0x477e35,_0x8bbad8){return db[_0x4ecd('0x19')][_0x4ecd('0x1a')](_0x53467b[_0x4ecd('0x1b')],{'raw':_0x53467b[_0x4ecd('0x1c')]?_0x53467b[_0x4ecd('0x1c')][_0x4ecd('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0xe5da85){logger[_0x4ecd('0xe')]('CreateVoiceAgentReport',_0x53467b);logger[_0x4ecd('0x11')](_0x4ecd('0x18'),_0x53467b,JSON[_0x4ecd('0x13')](_0xe5da85));_0x477e35(_0xe5da85);})['catch'](function(_0x4c3c02){logger[_0x4ecd('0x14')]('CreateVoiceAgentReport',_0x4c3c02['message'],_0x53467b);_0x8bbad8(_0x567a4d[_0x4ecd('0x14')](0x1f4,_0x4c3c02['message']));});});};exports[_0x4ecd('0x1e')]=function(_0x38a3b0){var _0x43c500=this;return new Promise(function(_0x197576,_0x62d7be){return db['VoiceAgentReport'][_0x4ecd('0x1f')](_0x38a3b0[_0x4ecd('0x1b')],{'raw':_0x38a3b0[_0x4ecd('0x1c')]?_0x38a3b0[_0x4ecd('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38a3b0['options']?_0x38a3b0['options']['where']||null:null,'attributes':_0x38a3b0[_0x4ecd('0x1c')]?_0x38a3b0['options']['attributes']||null:null,'limit':_0x38a3b0[_0x4ecd('0x1c')]?_0x38a3b0[_0x4ecd('0x1c')][_0x4ecd('0x20')]||null:null})[_0x4ecd('0xd')](function(_0x595e00){logger[_0x4ecd('0xe')]('UpdateVoiceAgentReport',_0x38a3b0);logger[_0x4ecd('0x11')]('UpdateVoiceAgentReport',_0x38a3b0,JSON['stringify'](_0x595e00));_0x197576(_0x595e00);})[_0x4ecd('0x17')](function(_0x3310f5){logger[_0x4ecd('0x14')](_0x4ecd('0x1e'),_0x3310f5[_0x4ecd('0x16')],_0x38a3b0);_0x62d7be(_0x43c500[_0x4ecd('0x14')](0x1f4,_0x3310f5[_0x4ecd('0x16')]));});});}; \ No newline at end of file +var _0x81c8=['stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','update','attributes','limit','UpdateVoiceAgentReport','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x409028,_0x406a12){var _0x199c47=function(_0x4b11a9){while(--_0x4b11a9){_0x409028['push'](_0x409028['shift']());}};_0x199c47(++_0x406a12);}(_0x81c8,0x119));var _0x881c=function(_0x261c29,_0xe9c56){_0x261c29=_0x261c29-0x0;var _0x417dbc=_0x81c8[_0x261c29];return _0x417dbc;};'use strict';var _=require('lodash');var util=require(_0x881c('0x0'));var moment=require(_0x881c('0x1'));var BPromise=require(_0x881c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x881c('0x3'))['db'];var utils=require(_0x881c('0x4'));var logger=require('../../config/logger')(_0x881c('0x5'));var config=require(_0x881c('0x6'));var jayson=require(_0x881c('0x7'));var client=jayson[_0x881c('0x8')][_0x881c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf3d7f5,_0x46bd42,_0x1e2505){return new BPromise(function(_0x2e90bd,_0x5dd2e9){return client[_0x881c('0xa')](_0xf3d7f5,_0x1e2505)[_0x881c('0xb')](function(_0xae99e9){logger[_0x881c('0xc')]('VoiceAgentReport,\x20%s,\x20%s',_0x46bd42,'request\x20sent');logger[_0x881c('0xd')](_0x881c('0xe'),_0x46bd42,_0x881c('0xf'),JSON[_0x881c('0x10')](_0xae99e9));if(_0xae99e9[_0x881c('0x11')]){if(_0xae99e9[_0x881c('0x11')][_0x881c('0x12')]===0x1f4){logger[_0x881c('0x11')](_0x881c('0x13'),_0x46bd42,_0xae99e9['error'][_0x881c('0x14')]);return _0x5dd2e9(_0xae99e9[_0x881c('0x11')]['message']);}logger[_0x881c('0x11')](_0x881c('0x13'),_0x46bd42,_0xae99e9[_0x881c('0x11')][_0x881c('0x14')]);return _0x2e90bd(_0xae99e9['error'][_0x881c('0x14')]);}else{logger[_0x881c('0xc')](_0x881c('0x13'),_0x46bd42,_0x881c('0xf'));_0x2e90bd(_0xae99e9[_0x881c('0x15')]['message']);}})[_0x881c('0x16')](function(_0x29352e){logger[_0x881c('0x11')](_0x881c('0x13'),_0x46bd42,_0x29352e);_0x5dd2e9(_0x29352e);});});}exports[_0x881c('0x17')]=function(_0x8df99e){var _0x16bbd4=this;return new Promise(function(_0x3cdcc4,_0x8af00b){return db[_0x881c('0x18')][_0x881c('0x19')](_0x8df99e[_0x881c('0x1a')],{'raw':_0x8df99e[_0x881c('0x1b')]?_0x8df99e[_0x881c('0x1b')][_0x881c('0x1c')]===undefined?!![]:![]:!![]})[_0x881c('0xb')](function(_0x5b6283){logger[_0x881c('0xc')](_0x881c('0x17'),_0x8df99e);logger[_0x881c('0xd')](_0x881c('0x17'),_0x8df99e,JSON[_0x881c('0x10')](_0x5b6283));_0x3cdcc4(_0x5b6283);})[_0x881c('0x16')](function(_0x43773d){logger['error'](_0x881c('0x17'),_0x43773d[_0x881c('0x14')],_0x8df99e);_0x8af00b(_0x16bbd4[_0x881c('0x11')](0x1f4,_0x43773d[_0x881c('0x14')]));});});};exports['UpdateVoiceAgentReport']=function(_0x5dffa3){var _0x126a95=this;return new Promise(function(_0x582efb,_0x261b7a){return db[_0x881c('0x18')][_0x881c('0x1d')](_0x5dffa3['body'],{'raw':_0x5dffa3[_0x881c('0x1b')]?_0x5dffa3['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5dffa3[_0x881c('0x1b')]?_0x5dffa3[_0x881c('0x1b')]['where']||null:null,'attributes':_0x5dffa3[_0x881c('0x1b')]?_0x5dffa3['options'][_0x881c('0x1e')]||null:null,'limit':_0x5dffa3[_0x881c('0x1b')]?_0x5dffa3['options'][_0x881c('0x1f')]||null:null})['then'](function(_0x5db15d){logger['info']('UpdateVoiceAgentReport',_0x5dffa3);logger[_0x881c('0xd')](_0x881c('0x20'),_0x5dffa3,JSON[_0x881c('0x10')](_0x5db15d));_0x582efb(_0x5db15d);})[_0x881c('0x16')](function(_0x550de9){logger[_0x881c('0x11')](_0x881c('0x20'),_0x550de9[_0x881c('0x14')],_0x5dffa3);_0x261b7a(_0x126a95[_0x881c('0x11')](0x1f4,_0x550de9[_0x881c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 49fce45..8387384 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 _0x4bc3=['post','put','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','describe','/:id','show'];(function(_0x4abcc0,_0xd1d228){var _0x575073=function(_0xe3a4ee){while(--_0xe3a4ee){_0x4abcc0['push'](_0x4abcc0['shift']());}};_0x575073(++_0xd1d228);}(_0x4bc3,0x16e));var _0x34bc=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x4bc3[_0x88cd7b];return _0x56fcc8;};'use strict';var multer=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var path=require('path');var timeout=require(_0x34bc('0x2'));var express=require(_0x34bc('0x3'));var router=express['Router']();var fs_extra=require(_0x34bc('0x4'));var auth=require(_0x34bc('0x5'));var interaction=require(_0x34bc('0x6'));var config=require(_0x34bc('0x7'));var controller=require(_0x34bc('0x8'));router[_0x34bc('0x9')]('/',auth[_0x34bc('0xa')](),controller['index']);router[_0x34bc('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x34bc('0xb')]);router[_0x34bc('0x9')](_0x34bc('0xc'),auth[_0x34bc('0xa')](),controller[_0x34bc('0xd')]);router[_0x34bc('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x34bc('0xf')](_0x34bc('0xc'),auth[_0x34bc('0xa')](),controller['update']);router[_0x34bc('0x10')]('/:id',auth[_0x34bc('0xa')](),controller[_0x34bc('0x11')]);module[_0x34bc('0x12')]=router; \ No newline at end of file +var _0x5ad3=['isAuthenticated','index','describe','create','/:id','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get'];(function(_0x22a89e,_0x5a78f9){var _0x213ea7=function(_0x177603){while(--_0x177603){_0x22a89e['push'](_0x22a89e['shift']());}};_0x213ea7(++_0x5a78f9);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x4bf3a7,_0x5d756b){_0x4bf3a7=_0x4bf3a7-0x0;var _0x58c9cc=_0x5ad3[_0x4bf3a7];return _0x58c9cc;};'use strict';var multer=require(_0x35ad('0x0'));var util=require(_0x35ad('0x1'));var path=require(_0x35ad('0x2'));var timeout=require(_0x35ad('0x3'));var express=require('express');var router=express[_0x35ad('0x4')]();var fs_extra=require(_0x35ad('0x5'));var auth=require(_0x35ad('0x6'));var interaction=require(_0x35ad('0x7'));var config=require(_0x35ad('0x8'));var controller=require(_0x35ad('0x9'));router[_0x35ad('0xa')]('/',auth[_0x35ad('0xb')](),controller[_0x35ad('0xc')]);router[_0x35ad('0xa')]('/describe',auth[_0x35ad('0xb')](),controller[_0x35ad('0xd')]);router[_0x35ad('0xa')]('/:id',auth[_0x35ad('0xb')](),controller['show']);router['post']('/',auth[_0x35ad('0xb')](),controller[_0x35ad('0xe')]);router['put'](_0x35ad('0xf'),auth[_0x35ad('0xb')](),controller['update']);router['delete'](_0x35ad('0xf'),auth[_0x35ad('0xb')](),controller['destroy']);module[_0x35ad('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index b036930..2736477 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 _0x2f68=['STRING','ENUM','inbound','internal','inbound-fax','outbound-fax','dialer','DATE','INTEGER','exports'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x2f68,0x12b));var _0x82f6=function(_0x36071b,_0x1fbee8){_0x36071b=_0x36071b-0x0;var _0x6b902a=_0x2f68[_0x36071b];return _0x6b902a;};'use strict';var Sequelize=require('sequelize');module[_0x82f6('0x0')]={'uniqueid':{'type':Sequelize[_0x82f6('0x1')]},'type':{'type':Sequelize[_0x82f6('0x2')](_0x82f6('0x3'),_0x82f6('0x4'),'outbound',_0x82f6('0x5'),_0x82f6('0x6'),_0x82f6('0x7'))},'tag':{'type':Sequelize[_0x82f6('0x1')]},'accountcode':{'type':Sequelize[_0x82f6('0x1')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x82f6('0x1')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x82f6('0x1')]},'destinationchannel':{'type':Sequelize[_0x82f6('0x1')]},'lastapplication':{'type':Sequelize[_0x82f6('0x1')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x82f6('0x8')]},'systemanswertime':{'type':Sequelize[_0x82f6('0x8')]},'answertime':{'type':Sequelize[_0x82f6('0x8')]},'endtime':{'type':Sequelize[_0x82f6('0x8')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x82f6('0x9')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x82f6('0x1')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x82f6('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x82f6('0x1')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x82f6('0x1')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x82f6('0x9')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4f3c=['STRING','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports'];(function(_0x478117,_0x167248){var _0x5635e2=function(_0x268700){while(--_0x268700){_0x478117['push'](_0x478117['shift']());}};_0x5635e2(++_0x167248);}(_0x4f3c,0x15d));var _0xc4f3=function(_0x3480e9,_0x1ce980){_0x3480e9=_0x3480e9-0x0;var _0x389aad=_0x4f3c[_0x3480e9];return _0x389aad;};'use strict';var Sequelize=require(_0xc4f3('0x0'));module[_0xc4f3('0x1')]={'uniqueid':{'type':Sequelize[_0xc4f3('0x2')]},'type':{'type':Sequelize[_0xc4f3('0x3')](_0xc4f3('0x4'),_0xc4f3('0x5'),_0xc4f3('0x6'),_0xc4f3('0x7'),_0xc4f3('0x8'),_0xc4f3('0x9'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xc4f3('0x2')]},'destination':{'type':Sequelize[_0xc4f3('0x2')]},'destinationcontext':{'type':Sequelize[_0xc4f3('0x2')]},'callerid':{'type':Sequelize[_0xc4f3('0x2')]},'channel':{'type':Sequelize[_0xc4f3('0x2')]},'destinationchannel':{'type':Sequelize[_0xc4f3('0x2')]},'lastapplication':{'type':Sequelize[_0xc4f3('0x2')]},'lastdata':{'type':Sequelize[_0xc4f3('0xa')]},'starttime':{'type':Sequelize[_0xc4f3('0xb')]},'systemanswertime':{'type':Sequelize[_0xc4f3('0xb')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xc4f3('0xb')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xc4f3('0xc')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xc4f3('0x2')]},'userfield':{'type':Sequelize[_0xc4f3('0x2')]},'userDisposition':{'type':Sequelize[_0xc4f3('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xc4f3('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0xc4f3('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index d9af4a1..311e219 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 _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x3e6729,_0x16d4af){var _0x535bcd=function(_0x5e6c5f){while(--_0x5e6c5f){_0x3e6729['push'](_0x3e6729['shift']());}};_0x535bcd(++_0x16d4af);}(_0x2ef3,0xba));var _0x32ef=function(_0x1c85b8,_0x1d65f5){_0x1c85b8=_0x1c85b8-0x0;var _0x224f11=_0x2ef3[_0x1c85b8];return _0x224f11;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['VoiceCallReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file +var _0xdb28=['options','includeAll','fullname','User','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','VoiceCallReport','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge'];(function(_0xaf5417,_0x26ef35){var _0x1c8053=function(_0x35d2d9){while(--_0x35d2d9){_0xaf5417['push'](_0xaf5417['shift']());}};_0x1c8053(++_0x26ef35);}(_0xdb28,0x106));var _0x8db2=function(_0x1afa68,_0xebfae){_0x1afa68=_0x1afa68-0x0;var _0x40ebf3=_0xdb28[_0x1afa68];return _0x40ebf3;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'attributes':['id',_0x8db2('0x28'),_0x8db2('0x40'),'alias'],'model':db['User'],'as':_0x8db2('0x41')}];}return db['VoiceCallReport'][_0x8db2('0x42')](_0x21bae5);})[_0x8db2('0x24')](function(_0x313130){_0x3124d5[_0x8db2('0x43')]=_0x313130;return _0x3124d5;})[_0x8db2('0x24')](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x44')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x45')]=function(_0x5c97ef,_0x2f86b1){var _0x3d44de={'raw':!![],'where':{'id':_0x5c97ef[_0x8db2('0x46')]['id']}},_0x40c69e={};_0x40c69e['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x47')]);_0x40c69e[_0x8db2('0x30')]=_['keys'](_0x5c97ef[_0x8db2('0x30')]);_0x40c69e['filters']=_[_0x8db2('0x48')](_0x40c69e[_0x8db2('0x32')],_0x40c69e[_0x8db2('0x30')]);_0x3d44de['attributes']=_['intersection'](_0x40c69e[_0x8db2('0x32')],qs['fields'](_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x33')]));_0x3d44de[_0x8db2('0x34')]=_0x3d44de[_0x8db2('0x34')][_0x8db2('0x35')]?_0x3d44de[_0x8db2('0x34')]:_0x40c69e[_0x8db2('0x32')];if(_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x3d44de[_0x8db2('0x49')]=[{'all':!![]}];}_0x3d44de=_[_0x8db2('0x3d')]({},_0x3d44de,_0x5c97ef[_0x8db2('0x3e')]);return db['VoiceCallReport'][_0x8db2('0x4a')](_0x3d44de)[_0x8db2('0x24')](handleEntityNotFound(_0x2f86b1,null))[_0x8db2('0x24')](respondWithResult(_0x2f86b1,null))[_0x8db2('0x44')](handleError(_0x2f86b1,null));};exports['create']=function(_0x4ffd9d,_0x11c224){return db[_0x8db2('0x2b')][_0x8db2('0x4b')](_0x4ffd9d['body'],{})['then'](respondWithResult(_0x11c224,0xc9))['catch'](handleError(_0x11c224,null));};exports[_0x8db2('0x4c')]=function(_0x368c37,_0x55c7dd){return db[_0x8db2('0x2b')][_0x8db2('0x4a')]({'where':{'id':_0x368c37[_0x8db2('0x46')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x55c7dd,null))['then'](removeEntity(_0x55c7dd,null))['catch'](handleError(_0x55c7dd,null));};exports[_0x8db2('0x4d')]=function(_0x18c6ef,_0x2908e4){return db[_0x8db2('0x2b')][_0x8db2('0x4d')]()[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x44')](handleError(_0x2908e4,null));};exports[_0x8db2('0x23')]=function(_0x4187d6,_0x426ae0){if(_0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')]){delete _0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')];}return db[_0x8db2('0x2b')]['find']({'where':{'uniqueid':_0x4187d6[_0x8db2('0x46')]['id'],'UserId':{'$or':[null,_0x4187d6[_0x8db2('0x50')]['id']]}}})['then'](handleEntityNotFound(_0x426ae0,null))[_0x8db2('0x24')](saveUpdates(_0x4187d6[_0x8db2('0x4e')],null))[_0x8db2('0x24')](respondWithResult(_0x426ae0,null))['catch'](handleError(_0x426ae0,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 6dc94e7..3c40f75 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 _0x0531=['VoiceCallReport','report_call','lodash','util','moment','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define'];(function(_0x3a3c17,_0x5b7b7e){var _0xd07f21=function(_0xeaad44){while(--_0xeaad44){_0x3a3c17['push'](_0x3a3c17['shift']());}};_0xd07f21(++_0x5b7b7e);}(_0x0531,0xde));var _0x1053=function(_0x208505,_0x241a77){_0x208505=_0x208505-0x0;var _0x1a985f=_0x0531[_0x208505];return _0x1a985f;};'use strict';var _=require(_0x1053('0x0'));var util=require(_0x1053('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1053('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1053('0x3'));var rimraf=require(_0x1053('0x4'));var config=require(_0x1053('0x5'));var attributes=require(_0x1053('0x6'));module[_0x1053('0x7')]=function(_0x5d8ce2,_0x29e7cd){return _0x5d8ce2[_0x1053('0x8')](_0x1053('0x9'),attributes,{'tableName':_0x1053('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa2d7=['moment','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','lodash','util','../../config/logger','api'];(function(_0x186d17,_0x9fa8ef){var _0x5d4b89=function(_0x57bd70){while(--_0x57bd70){_0x186d17['push'](_0x186d17['shift']());}};_0x5d4b89(++_0x9fa8ef);}(_0xa2d7,0x11a));var _0x7a2d=function(_0x3a886f,_0x2f49be){_0x3a886f=_0x3a886f-0x0;var _0x52662c=_0xa2d7[_0x3a886f];return _0x52662c;};'use strict';var _=require(_0x7a2d('0x0'));var util=require(_0x7a2d('0x1'));var logger=require(_0x7a2d('0x2'))(_0x7a2d('0x3'));var moment=require(_0x7a2d('0x4'));var BPromise=require('bluebird');var rp=require(_0x7a2d('0x5'));var fs=require('fs');var path=require(_0x7a2d('0x6'));var rimraf=require(_0x7a2d('0x7'));var config=require(_0x7a2d('0x8'));var attributes=require(_0x7a2d('0x9'));module[_0x7a2d('0xa')]=function(_0xfe3ec1,_0x3e8506){return _0xfe3ec1[_0x7a2d('0xb')](_0x7a2d('0xc'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index d3bf80a..0ab2366 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 _0xe0c6=['body','raw','CreateVoiceCallReport','debug','stringify','UpdateVoiceCallReport','where','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','VoiceCallReport,\x20%s,\x20%s','result','GetVoiceCallReport','VoiceCallReport','findAll','options','attributes','limit','map','include','model','catch'];(function(_0x42f204,_0x26d24e){var _0x54da59=function(_0x11dafb){while(--_0x11dafb){_0x42f204['push'](_0x42f204['shift']());}};_0x54da59(++_0x26d24e);}(_0xe0c6,0x1db));var _0x6e0c=function(_0x614386,_0x181ef8){_0x614386=_0x614386-0x0;var _0x3e1c89=_0xe0c6[_0x614386];return _0x3e1c89;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6e0c('0x0'));var BPromise=require('bluebird');var rs=require(_0x6e0c('0x1'));var fs=require('fs');var Redis=require(_0x6e0c('0x2'));var db=require(_0x6e0c('0x3'))['db'];var utils=require(_0x6e0c('0x4'));var logger=require(_0x6e0c('0x5'))('rpc');var config=require(_0x6e0c('0x6'));var jayson=require(_0x6e0c('0x7'));var client=jayson[_0x6e0c('0x8')][_0x6e0c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d3d9a,_0x2c63b2,_0x2eb304){return new BPromise(function(_0x4b3a85,_0x1d26cc){return client['request'](_0x2d3d9a,_0x2eb304)[_0x6e0c('0xa')](function(_0x535884){logger[_0x6e0c('0xb')]('VoiceCallReport,\x20%s,\x20%s',_0x2c63b2,_0x6e0c('0xc'));logger['debug'](_0x6e0c('0xd'),_0x2c63b2,_0x6e0c('0xc'),JSON['stringify'](_0x535884));if(_0x535884['error']){if(_0x535884[_0x6e0c('0xe')][_0x6e0c('0xf')]===0x1f4){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x2c63b2,_0x535884['error'][_0x6e0c('0x10')]);return _0x1d26cc(_0x535884[_0x6e0c('0xe')][_0x6e0c('0x10')]);}logger[_0x6e0c('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x2c63b2,_0x535884['error'][_0x6e0c('0x10')]);return _0x4b3a85(_0x535884[_0x6e0c('0xe')][_0x6e0c('0x10')]);}else{logger['info'](_0x6e0c('0x11'),_0x2c63b2,_0x6e0c('0xc'));_0x4b3a85(_0x535884[_0x6e0c('0x12')][_0x6e0c('0x10')]);}})['catch'](function(_0x270570){logger[_0x6e0c('0xe')](_0x6e0c('0x11'),_0x2c63b2,_0x270570);_0x1d26cc(_0x270570);});});}exports[_0x6e0c('0x13')]=function(_0x24f3ed){var _0x286b82=this;return new Promise(function(_0x1dcdb6,_0x4df83d){return db[_0x6e0c('0x14')][_0x6e0c('0x15')]({'raw':_0x24f3ed['options']?_0x24f3ed['options']['raw']===undefined?!![]:![]:!![],'where':_0x24f3ed[_0x6e0c('0x16')]?_0x24f3ed[_0x6e0c('0x16')]['where']||null:null,'attributes':_0x24f3ed[_0x6e0c('0x16')]?_0x24f3ed[_0x6e0c('0x16')][_0x6e0c('0x17')]||null:null,'limit':_0x24f3ed['options']?_0x24f3ed[_0x6e0c('0x16')][_0x6e0c('0x18')]||null:null,'include':_0x24f3ed[_0x6e0c('0x16')]?_0x24f3ed[_0x6e0c('0x16')]['include']?_[_0x6e0c('0x19')](_0x24f3ed[_0x6e0c('0x16')][_0x6e0c('0x1a')],function(_0x498ff9){return{'model':db[_0x498ff9[_0x6e0c('0x1b')]],'as':_0x498ff9['as'],'attributes':_0x498ff9[_0x6e0c('0x17')],'include':_0x498ff9[_0x6e0c('0x1a')]?_[_0x6e0c('0x19')](_0x498ff9[_0x6e0c('0x1a')],function(_0x2ed52d){return{'model':db[_0x2ed52d[_0x6e0c('0x1b')]],'as':_0x2ed52d['as'],'attributes':_0x2ed52d[_0x6e0c('0x17')],'include':_0x2ed52d['include']?_[_0x6e0c('0x19')](_0x2ed52d[_0x6e0c('0x1a')],function(_0x4899e2){return{'model':db[_0x4899e2[_0x6e0c('0x1b')]],'as':_0x4899e2['as'],'attributes':_0x4899e2['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e0c('0xa')](function(_0x140374){logger[_0x6e0c('0xb')](_0x6e0c('0x13'),_0x24f3ed);logger['debug'](_0x6e0c('0x13'),_0x24f3ed,JSON['stringify'](_0x140374));_0x1dcdb6(_0x140374);})[_0x6e0c('0x1c')](function(_0x12fe95){logger[_0x6e0c('0xe')](_0x6e0c('0x13'),_0x12fe95[_0x6e0c('0x10')],_0x24f3ed);_0x4df83d(_0x286b82[_0x6e0c('0xe')](0x1f4,_0x12fe95[_0x6e0c('0x10')]));});});};exports['CreateVoiceCallReport']=function(_0x93beb4){var _0x2cde25=this;return new Promise(function(_0x258061,_0x214317){return db[_0x6e0c('0x14')]['create'](_0x93beb4[_0x6e0c('0x1d')],{'raw':_0x93beb4['options']?_0x93beb4[_0x6e0c('0x16')][_0x6e0c('0x1e')]===undefined?!![]:![]:!![]})[_0x6e0c('0xa')](function(_0x3995d7){logger[_0x6e0c('0xb')](_0x6e0c('0x1f'),_0x93beb4);logger[_0x6e0c('0x20')](_0x6e0c('0x1f'),_0x93beb4,JSON[_0x6e0c('0x21')](_0x3995d7));_0x258061(_0x3995d7);})['catch'](function(_0x5e9948){logger[_0x6e0c('0xe')]('CreateVoiceCallReport',_0x5e9948['message'],_0x93beb4);_0x214317(_0x2cde25[_0x6e0c('0xe')](0x1f4,_0x5e9948[_0x6e0c('0x10')]));});});};exports[_0x6e0c('0x22')]=function(_0xc7f59f){var _0x5a9d6c=this;return new Promise(function(_0x1f286e,_0x324c41){return db['VoiceCallReport']['update'](_0xc7f59f[_0x6e0c('0x1d')],{'raw':_0xc7f59f[_0x6e0c('0x16')]?_0xc7f59f[_0x6e0c('0x16')][_0x6e0c('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc7f59f[_0x6e0c('0x16')]?_0xc7f59f[_0x6e0c('0x16')][_0x6e0c('0x23')]||null:null,'attributes':_0xc7f59f[_0x6e0c('0x16')]?_0xc7f59f[_0x6e0c('0x16')][_0x6e0c('0x17')]||null:null,'limit':_0xc7f59f['options']?_0xc7f59f[_0x6e0c('0x16')][_0x6e0c('0x18')]||null:null})[_0x6e0c('0xa')](function(_0x398dfb){logger[_0x6e0c('0xb')](_0x6e0c('0x22'),_0xc7f59f);logger[_0x6e0c('0x20')](_0x6e0c('0x22'),_0xc7f59f,JSON[_0x6e0c('0x21')](_0x398dfb));_0x1f286e(_0x398dfb);})['catch'](function(_0x309e21){logger[_0x6e0c('0xe')]('UpdateVoiceCallReport',_0x309e21[_0x6e0c('0x10')],_0xc7f59f);_0x324c41(_0x5a9d6c['error'](0x1f4,_0x309e21[_0x6e0c('0x10')]));});});}; \ No newline at end of file +var _0xca73=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','VoiceCallReport,\x20%s,\x20%s','message','result','catch','findAll','options','raw','attributes','include','map','model','GetVoiceCallReport','stringify','CreateVoiceCallReport','VoiceCallReport','create','body','update','where','lodash','util','moment'];(function(_0x2a0346,_0x2c1300){var _0x1f5232=function(_0x345c8e){while(--_0x345c8e){_0x2a0346['push'](_0x2a0346['shift']());}};_0x1f5232(++_0x2c1300);}(_0xca73,0x125));var _0x3ca7=function(_0x2e1aa2,_0x72bfb2){_0x2e1aa2=_0x2e1aa2-0x0;var _0x13188a=_0xca73[_0x2e1aa2];return _0x13188a;};'use strict';var _=require(_0x3ca7('0x0'));var util=require(_0x3ca7('0x1'));var moment=require(_0x3ca7('0x2'));var BPromise=require(_0x3ca7('0x3'));var rs=require(_0x3ca7('0x4'));var fs=require('fs');var Redis=require(_0x3ca7('0x5'));var db=require(_0x3ca7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3ca7('0x7'))(_0x3ca7('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3ca7('0x9')][_0x3ca7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2cb3d2,_0x231678,_0x4a733d){return new BPromise(function(_0x490383,_0x3952b9){return client[_0x3ca7('0xb')](_0x2cb3d2,_0x4a733d)[_0x3ca7('0xc')](function(_0x2f6dfb){logger[_0x3ca7('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x231678,_0x3ca7('0xe'));logger[_0x3ca7('0xf')](_0x3ca7('0x10'),_0x231678,_0x3ca7('0xe'),JSON['stringify'](_0x2f6dfb));if(_0x2f6dfb[_0x3ca7('0x11')]){if(_0x2f6dfb[_0x3ca7('0x11')]['code']===0x1f4){logger[_0x3ca7('0x11')](_0x3ca7('0x12'),_0x231678,_0x2f6dfb[_0x3ca7('0x11')][_0x3ca7('0x13')]);return _0x3952b9(_0x2f6dfb[_0x3ca7('0x11')][_0x3ca7('0x13')]);}logger[_0x3ca7('0x11')](_0x3ca7('0x12'),_0x231678,_0x2f6dfb[_0x3ca7('0x11')][_0x3ca7('0x13')]);return _0x490383(_0x2f6dfb['error'][_0x3ca7('0x13')]);}else{logger[_0x3ca7('0xd')](_0x3ca7('0x12'),_0x231678,'request\x20sent');_0x490383(_0x2f6dfb[_0x3ca7('0x14')]['message']);}})[_0x3ca7('0x15')](function(_0x724406){logger[_0x3ca7('0x11')](_0x3ca7('0x12'),_0x231678,_0x724406);_0x3952b9(_0x724406);});});}exports['GetVoiceCallReport']=function(_0x21b1dd){var _0x342ca6=this;return new Promise(function(_0x4299ef,_0x368694){return db['VoiceCallReport'][_0x3ca7('0x16')]({'raw':_0x21b1dd[_0x3ca7('0x17')]?_0x21b1dd[_0x3ca7('0x17')][_0x3ca7('0x18')]===undefined?!![]:![]:!![],'where':_0x21b1dd[_0x3ca7('0x17')]?_0x21b1dd[_0x3ca7('0x17')]['where']||null:null,'attributes':_0x21b1dd[_0x3ca7('0x17')]?_0x21b1dd[_0x3ca7('0x17')][_0x3ca7('0x19')]||null:null,'limit':_0x21b1dd[_0x3ca7('0x17')]?_0x21b1dd[_0x3ca7('0x17')]['limit']||null:null,'include':_0x21b1dd[_0x3ca7('0x17')]?_0x21b1dd[_0x3ca7('0x17')][_0x3ca7('0x1a')]?_[_0x3ca7('0x1b')](_0x21b1dd[_0x3ca7('0x17')][_0x3ca7('0x1a')],function(_0x403a0f){return{'model':db[_0x403a0f[_0x3ca7('0x1c')]],'as':_0x403a0f['as'],'attributes':_0x403a0f[_0x3ca7('0x19')],'include':_0x403a0f[_0x3ca7('0x1a')]?_[_0x3ca7('0x1b')](_0x403a0f[_0x3ca7('0x1a')],function(_0x16bd1c){return{'model':db[_0x16bd1c[_0x3ca7('0x1c')]],'as':_0x16bd1c['as'],'attributes':_0x16bd1c['attributes'],'include':_0x16bd1c['include']?_[_0x3ca7('0x1b')](_0x16bd1c[_0x3ca7('0x1a')],function(_0x33156f){return{'model':db[_0x33156f['model']],'as':_0x33156f['as'],'attributes':_0x33156f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xc46135){logger[_0x3ca7('0xd')](_0x3ca7('0x1d'),_0x21b1dd);logger[_0x3ca7('0xf')](_0x3ca7('0x1d'),_0x21b1dd,JSON[_0x3ca7('0x1e')](_0xc46135));_0x4299ef(_0xc46135);})[_0x3ca7('0x15')](function(_0x2e5320){logger[_0x3ca7('0x11')]('GetVoiceCallReport',_0x2e5320[_0x3ca7('0x13')],_0x21b1dd);_0x368694(_0x342ca6[_0x3ca7('0x11')](0x1f4,_0x2e5320['message']));});});};exports[_0x3ca7('0x1f')]=function(_0x4be678){var _0x410d07=this;return new Promise(function(_0x5ac084,_0x3ddd4c){return db[_0x3ca7('0x20')][_0x3ca7('0x21')](_0x4be678[_0x3ca7('0x22')],{'raw':_0x4be678[_0x3ca7('0x17')]?_0x4be678[_0x3ca7('0x17')][_0x3ca7('0x18')]===undefined?!![]:![]:!![]})[_0x3ca7('0xc')](function(_0x4ef119){logger['info'](_0x3ca7('0x1f'),_0x4be678);logger['debug'](_0x3ca7('0x1f'),_0x4be678,JSON[_0x3ca7('0x1e')](_0x4ef119));_0x5ac084(_0x4ef119);})[_0x3ca7('0x15')](function(_0x35cc1e){logger[_0x3ca7('0x11')](_0x3ca7('0x1f'),_0x35cc1e['message'],_0x4be678);_0x3ddd4c(_0x410d07[_0x3ca7('0x11')](0x1f4,_0x35cc1e[_0x3ca7('0x13')]));});});};exports['UpdateVoiceCallReport']=function(_0x2bacea){var _0x6ee5e5=this;return new Promise(function(_0x2d97da,_0x48cf16){return db[_0x3ca7('0x20')][_0x3ca7('0x23')](_0x2bacea[_0x3ca7('0x22')],{'raw':_0x2bacea[_0x3ca7('0x17')]?_0x2bacea[_0x3ca7('0x17')][_0x3ca7('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2bacea[_0x3ca7('0x17')]?_0x2bacea['options'][_0x3ca7('0x24')]||null:null,'attributes':_0x2bacea[_0x3ca7('0x17')]?_0x2bacea['options'][_0x3ca7('0x19')]||null:null,'limit':_0x2bacea['options']?_0x2bacea['options']['limit']||null:null})[_0x3ca7('0xc')](function(_0x579c09){logger[_0x3ca7('0xd')]('UpdateVoiceCallReport',_0x2bacea);logger[_0x3ca7('0xf')]('UpdateVoiceCallReport',_0x2bacea,JSON[_0x3ca7('0x1e')](_0x579c09));_0x2d97da(_0x579c09);})[_0x3ca7('0x15')](function(_0x1b4f9f){logger[_0x3ca7('0x11')]('UpdateVoiceCallReport',_0x1b4f9f[_0x3ca7('0x13')],_0x2bacea);_0x48cf16(_0x6ee5e5[_0x3ca7('0x11')](0x1f4,_0x1b4f9f[_0x3ca7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 40ab7d9..d663fbd 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 _0xfe7e=['path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','post','update','delete','destroy','util'];(function(_0xbe05af,_0x4345a1){var _0x134631=function(_0x4fd4d8){while(--_0x4fd4d8){_0xbe05af['push'](_0xbe05af['shift']());}};_0x134631(++_0x4345a1);}(_0xfe7e,0x12b));var _0xefe7=function(_0x5b069f,_0x2a6941){_0x5b069f=_0x5b069f-0x0;var _0x3a83d2=_0xfe7e[_0x5b069f];return _0x3a83d2;};'use strict';var multer=require('multer');var util=require(_0xefe7('0x0'));var path=require(_0xefe7('0x1'));var timeout=require(_0xefe7('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xefe7('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xefe7('0x4'));var config=require(_0xefe7('0x5'));var controller=require(_0xefe7('0x6'));router[_0xefe7('0x7')]('/',auth[_0xefe7('0x8')](),controller[_0xefe7('0x9')]);router['get'](_0xefe7('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xefe7('0xb')]('/',auth[_0xefe7('0x8')](),controller['create']);router['put'](_0xefe7('0xa'),auth[_0xefe7('0x8')](),controller[_0xefe7('0xc')]);router[_0xefe7('0xd')](_0xefe7('0xa'),auth['isAuthenticated'](),controller[_0xefe7('0xe')]);module['exports']=router; \ No newline at end of file +var _0xd26e=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0xe406e8,_0x2dbfd8){var _0x3f8fbe=function(_0x967a30){while(--_0x967a30){_0xe406e8['push'](_0xe406e8['shift']());}};_0x3f8fbe(++_0x2dbfd8);}(_0xd26e,0x1e4));var _0xed26=function(_0x5556cd,_0x327ee7){_0x5556cd=_0x5556cd-0x0;var _0x2d49f4=_0xd26e[_0x5556cd];return _0x2d49f4;};'use strict';var multer=require(_0xed26('0x0'));var util=require(_0xed26('0x1'));var path=require(_0xed26('0x2'));var timeout=require(_0xed26('0x3'));var express=require(_0xed26('0x4'));var router=express[_0xed26('0x5')]();var fs_extra=require(_0xed26('0x6'));var auth=require(_0xed26('0x7'));var interaction=require(_0xed26('0x8'));var config=require(_0xed26('0x9'));var controller=require('./voiceChanSpy.controller');router[_0xed26('0xa')]('/',auth[_0xed26('0xb')](),controller[_0xed26('0xc')]);router[_0xed26('0xa')](_0xed26('0xd'),auth[_0xed26('0xb')](),controller[_0xed26('0xe')]);router[_0xed26('0xf')]('/',auth[_0xed26('0xb')](),controller[_0xed26('0x10')]);router[_0xed26('0x11')]('/:id',auth[_0xed26('0xb')](),controller[_0xed26('0x12')]);router[_0xed26('0x13')](_0xed26('0xd'),auth[_0xed26('0xb')](),controller['destroy']);module[_0xed26('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 c45af42..a1f1464 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 _0x1fd3=['BOOLEAN','sequelize','STRING','name','setDataValue','options','join','getDataValue','split'];(function(_0x5e3701,_0x596265){var _0x345dcf=function(_0x5eb12a){while(--_0x5eb12a){_0x5e3701['push'](_0x5e3701['shift']());}};_0x345dcf(++_0x596265);}(_0x1fd3,0x17b));var _0x31fd=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x1fd3[_0x173d7e];return _0x2220d6;};'use strict';var Sequelize=require(_0x31fd('0x0'));module['exports']={'name':{'type':Sequelize[_0x31fd('0x1')]},'prefix':{'type':Sequelize[_0x31fd('0x1')],'unique':_0x31fd('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x276fed){this[_0x31fd('0x3')](_0x31fd('0x4'),_0x276fed?_0x276fed[_0x31fd('0x5')](''):[]);},'get':function(){return this[_0x31fd('0x6')](_0x31fd('0x4'))?this[_0x31fd('0x6')](_0x31fd('0x4'))[_0x31fd('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x31fd('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x31fd('0x1')]},'description':{'type':Sequelize[_0x31fd('0x1')]}}; \ No newline at end of file +var _0x84d5=['join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','options'];(function(_0x1d3be5,_0x2a969f){var _0x313bc7=function(_0x20fa63){while(--_0x20fa63){_0x1d3be5['push'](_0x1d3be5['shift']());}};_0x313bc7(++_0x2a969f);}(_0x84d5,0x1bc));var _0x584d=function(_0x225012,_0x5660ea){_0x225012=_0x225012-0x0;var _0x57498b=_0x84d5[_0x225012];return _0x57498b;};'use strict';var Sequelize=require(_0x584d('0x0'));module[_0x584d('0x1')]={'name':{'type':Sequelize[_0x584d('0x2')]},'prefix':{'type':Sequelize[_0x584d('0x2')],'unique':_0x584d('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x35a658){this[_0x584d('0x4')](_0x584d('0x5'),_0x35a658?_0x35a658[_0x584d('0x6')](''):[]);},'get':function(){return this[_0x584d('0x7')](_0x584d('0x5'))?this[_0x584d('0x7')](_0x584d('0x5'))[_0x584d('0x8')](''):[];}},'auth':{'type':Sequelize[_0x584d('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0x584d('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x584d('0x2')]},'description':{'type':Sequelize[_0x584d('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 7f6bd4e..a71b353 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 _0xf00e=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','status','end','json','offset','undefined','Content-Range','apply','save','destroy','then','get','ChanSpies','stack','name','send','map','VoiceChanSpy','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','findAll','catch','show','keys','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0xa59e37,_0xd7215f){var _0x4d9133=function(_0x3b4b50){while(--_0x3b4b50){_0xa59e37['push'](_0xa59e37['shift']());}};_0x4d9133(++_0xd7215f);}(_0xf00e,0x12f));var _0xef00=function(_0x3e525e,_0x2432a9){_0x3e525e=_0x3e525e-0x0;var _0x3fe8ac=_0xf00e[_0x3e525e];return _0x3fe8ac;};'use strict';var emlformat=require(_0xef00('0x0'));var rimraf=require(_0xef00('0x1'));var zipdir=require(_0xef00('0x2'));var jsonpatch=require(_0xef00('0x3'));var rp=require(_0xef00('0x4'));var moment=require(_0xef00('0x5'));var BPromise=require(_0xef00('0x6'));var Mustache=require(_0xef00('0x7'));var util=require(_0xef00('0x8'));var path=require(_0xef00('0x9'));var sox=require(_0xef00('0xa'));var csv=require(_0xef00('0xb'));var ejs=require(_0xef00('0xc'));var fs=require('fs');var fs_extra=require(_0xef00('0xd'));var _=require(_0xef00('0xe'));var squel=require(_0xef00('0xf'));var crypto=require(_0xef00('0x10'));var jsforce=require(_0xef00('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xef00('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xef00('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xef00('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xef00('0x14'))(_0xef00('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19c7d9,_0x582462){_0x582462=_0x582462||0xcc;return function(_0x18ea2e){if(_0x18ea2e){return _0x19c7d9['sendStatus'](_0x582462);}return _0x19c7d9[_0xef00('0x16')](_0x582462)[_0xef00('0x17')]();};}function respondWithResult(_0x2b897,_0x7d477e){_0x7d477e=_0x7d477e||0xc8;return function(_0x216963){if(_0x216963){return _0x2b897['status'](_0x7d477e)[_0xef00('0x18')](_0x216963);}};}function respondWithFilteredResult(_0x2fba5d,_0x4f0a5b){return function(_0x21257e){if(_0x21257e){var _0x457035=typeof _0x4f0a5b[_0xef00('0x19')]===_0xef00('0x1a')&&typeof _0x4f0a5b['limit']===_0xef00('0x1a');var _0x1e714d=_0x21257e['count'];var _0x45a9d4=_0x457035?0x0:_0x4f0a5b[_0xef00('0x19')];var _0x242658=_0x457035?_0x21257e['count']:_0x4f0a5b['offset']+_0x4f0a5b['limit'];var _0x1b059c;if(_0x242658>=_0x1e714d){_0x242658=_0x1e714d;_0x1b059c=0xc8;}else{_0x1b059c=0xce;}_0x2fba5d[_0xef00('0x16')](_0x1b059c);return _0x2fba5d['set'](_0xef00('0x1b'),_0x45a9d4+'-'+_0x242658+'/'+_0x1e714d)[_0xef00('0x18')](_0x21257e);}return null;};}function patchUpdates(_0x4e4157){return function(_0x5838c9){try{jsonpatch[_0xef00('0x1c')](_0x5838c9,_0x4e4157,!![]);}catch(_0xcf0f4b){return BPromise['reject'](_0xcf0f4b);}return _0x5838c9[_0xef00('0x1d')]();};}function saveUpdates(_0x70bf89,_0x54cd84){return function(_0x232565){if(_0x232565){return _0x232565['update'](_0x70bf89)['then'](function(_0x203cfe){return _0x203cfe;});}return null;};}function removeEntity(_0x56347a,_0x639d69){return function(_0x1f6b50){if(_0x1f6b50){return _0x1f6b50[_0xef00('0x1e')]()[_0xef00('0x1f')](function(){var _0x57f4eb=_0x1f6b50[_0xef00('0x20')]({'plain':!![]});var _0x1ec423=_0xef00('0x21');return db['UserProfileResource'][_0xef00('0x1e')]({'where':{'type':_0x1ec423,'resourceId':_0x57f4eb['id']}})[_0xef00('0x1f')](function(){return _0x1f6b50;});})[_0xef00('0x1f')](function(){_0x56347a[_0xef00('0x16')](0xcc)[_0xef00('0x17')]();});}};}function handleEntityNotFound(_0x441584,_0x1d1fce){return function(_0x4c1978){if(!_0x4c1978){_0x441584['sendStatus'](0x194);}return _0x4c1978;};}function handleError(_0x996710,_0x18f56f){_0x18f56f=_0x18f56f||0x1f4;return function(_0x17b633){logger['error'](_0x17b633[_0xef00('0x22')]);if(_0x17b633[_0xef00('0x23')]){delete _0x17b633[_0xef00('0x23')];}_0x996710[_0xef00('0x16')](_0x18f56f)[_0xef00('0x24')](_0x17b633);};}exports['index']=function(_0x26f3c0,_0xba426c){var _0x4892be={},_0x128dd9={},_0x19b4c1={'count':0x0,'rows':[]};var _0x1c6dde=_[_0xef00('0x25')](db[_0xef00('0x26')][_0xef00('0x27')],function(_0x5c977f){return{'name':_0x5c977f['fieldName'],'type':_0x5c977f[_0xef00('0x28')][_0xef00('0x29')]};});_0x128dd9[_0xef00('0x2a')]=_['map'](_0x1c6dde,'name');_0x128dd9[_0xef00('0x2b')]=_['keys'](_0x26f3c0[_0xef00('0x2b')]);_0x128dd9[_0xef00('0x2c')]=_[_0xef00('0x2d')](_0x128dd9[_0xef00('0x2a')],_0x128dd9[_0xef00('0x2b')]);_0x4892be['attributes']=_[_0xef00('0x2d')](_0x128dd9['model'],qs[_0xef00('0x2e')](_0x26f3c0[_0xef00('0x2b')][_0xef00('0x2e')]));_0x4892be[_0xef00('0x2f')]=_0x4892be[_0xef00('0x2f')][_0xef00('0x30')]?_0x4892be['attributes']:_0x128dd9[_0xef00('0x2a')];if(!_0x26f3c0[_0xef00('0x2b')][_0xef00('0x31')]('nolimit')){_0x4892be[_0xef00('0x32')]=qs[_0xef00('0x32')](_0x26f3c0[_0xef00('0x2b')]['limit']);_0x4892be['offset']=qs['offset'](_0x26f3c0['query'][_0xef00('0x19')]);}_0x4892be[_0xef00('0x33')]=qs['sort'](_0x26f3c0['query'][_0xef00('0x34')]);_0x4892be[_0xef00('0x35')]=qs[_0xef00('0x2c')](_[_0xef00('0x36')](_0x26f3c0[_0xef00('0x2b')],_0x128dd9[_0xef00('0x2c')]),_0x1c6dde);if(_0x26f3c0[_0xef00('0x2b')][_0xef00('0x37')]){_0x4892be[_0xef00('0x35')]=_['merge'](_0x4892be[_0xef00('0x35')],{'$or':_[_0xef00('0x25')](_0x1c6dde,function(_0x16cfcc){if(_0x16cfcc[_0xef00('0x28')]!==_0xef00('0x38')){var _0x358ed6={};_0x358ed6[_0x16cfcc[_0xef00('0x23')]]={'$like':'%'+_0x26f3c0[_0xef00('0x2b')][_0xef00('0x37')]+'%'};return _0x358ed6;}})});}_0x4892be=_[_0xef00('0x39')]({},_0x4892be,_0x26f3c0[_0xef00('0x3a')]);var _0x503238={'where':_0x4892be[_0xef00('0x35')]};return db[_0xef00('0x26')]['count'](_0x503238)['then'](function(_0x578ea3){_0x19b4c1[_0xef00('0x3b')]=_0x578ea3;if(_0x26f3c0[_0xef00('0x2b')][_0xef00('0x3c')]){_0x4892be['include']=[{'all':!![]}];}return db['VoiceChanSpy'][_0xef00('0x3d')](_0x4892be);})[_0xef00('0x1f')](function(_0x2e0b58){_0x19b4c1['rows']=_0x2e0b58;return _0x19b4c1;})[_0xef00('0x1f')](respondWithFilteredResult(_0xba426c,_0x4892be))[_0xef00('0x3e')](handleError(_0xba426c,null));};exports[_0xef00('0x3f')]=function(_0x38e2be,_0x2d0639){var _0x30b756={'raw':![],'where':{'id':_0x38e2be['params']['id']}},_0x3ed1fa={};_0x3ed1fa[_0xef00('0x2a')]=_[_0xef00('0x40')](db[_0xef00('0x26')][_0xef00('0x27')]);_0x3ed1fa[_0xef00('0x2b')]=_[_0xef00('0x40')](_0x38e2be[_0xef00('0x2b')]);_0x3ed1fa[_0xef00('0x2c')]=_['intersection'](_0x3ed1fa[_0xef00('0x2a')],_0x3ed1fa[_0xef00('0x2b')]);_0x30b756['attributes']=_['intersection'](_0x3ed1fa[_0xef00('0x2a')],qs['fields'](_0x38e2be[_0xef00('0x2b')][_0xef00('0x2e')]));_0x30b756['attributes']=_0x30b756[_0xef00('0x2f')][_0xef00('0x30')]?_0x30b756['attributes']:_0x3ed1fa[_0xef00('0x2a')];if(_0x38e2be[_0xef00('0x2b')][_0xef00('0x3c')]){_0x30b756[_0xef00('0x41')]=[{'all':!![]}];}_0x30b756=_['merge']({},_0x30b756,_0x38e2be['options']);return db[_0xef00('0x26')]['find'](_0x30b756)[_0xef00('0x1f')](handleEntityNotFound(_0x2d0639,null))[_0xef00('0x1f')](respondWithResult(_0x2d0639,null))['catch'](handleError(_0x2d0639,null));};exports[_0xef00('0x42')]=function(_0x39c7dc,_0x21aed8){return db[_0xef00('0x26')][_0xef00('0x42')](_0x39c7dc[_0xef00('0x43')],{})[_0xef00('0x1f')](function(_0x33e9a6){var _0x3c6cbf=_0x39c7dc[_0xef00('0x44')]['get']({'plain':!![]});if(!_0x3c6cbf)throw new Error(_0xef00('0x45'));if(_0x3c6cbf['role']===_0xef00('0x44')){var _0xb39b1=_0x33e9a6[_0xef00('0x20')]({'plain':!![]});var _0x2e3f40=_0xef00('0x21');return db[_0xef00('0x46')]['find']({'where':{'name':_0x2e3f40,'userProfileId':_0x3c6cbf[_0xef00('0x47')]},'raw':!![]})[_0xef00('0x1f')](function(_0x3617ca){if(_0x3617ca&&_0x3617ca[_0xef00('0x48')]===0x0){return db[_0xef00('0x49')]['create']({'name':_0xb39b1[_0xef00('0x23')],'resourceId':_0xb39b1['id'],'type':_0x3617ca[_0xef00('0x23')],'sectionId':_0x3617ca['id']},{})[_0xef00('0x1f')](function(){return _0x33e9a6;});}else{return _0x33e9a6;}})[_0xef00('0x3e')](function(_0x5c81f1){logger['error'](_0xef00('0x4a'),_0x5c81f1);throw _0x5c81f1;});}return _0x33e9a6;})['then'](respondWithResult(_0x21aed8,0xc9))[_0xef00('0x3e')](handleError(_0x21aed8,null));};exports[_0xef00('0x4b')]=function(_0x14cf37,_0x2b6b45){if(_0x14cf37[_0xef00('0x43')]['id']){delete _0x14cf37[_0xef00('0x43')]['id'];}return db[_0xef00('0x26')][_0xef00('0x4c')]({'where':{'id':_0x14cf37['params']['id']}})[_0xef00('0x1f')](handleEntityNotFound(_0x2b6b45,null))[_0xef00('0x1f')](saveUpdates(_0x14cf37['body'],null))[_0xef00('0x1f')](respondWithResult(_0x2b6b45,null))[_0xef00('0x3e')](handleError(_0x2b6b45,null));};exports[_0xef00('0x1e')]=function(_0x798bcc,_0x382b95){return db['VoiceChanSpy'][_0xef00('0x4c')]({'where':{'id':_0x798bcc[_0xef00('0x4d')]['id']}})[_0xef00('0x1f')](handleEntityNotFound(_0x382b95,null))['then'](removeEntity(_0x382b95,null))['catch'](handleError(_0x382b95,null));}; \ No newline at end of file +var _0xe829=['update','then','destroy','ChanSpies','UserProfileResource','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','order','sort','where','filters','pick','merge','filter','includeAll','findAll','rows','show','params','include','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0xe829,0x1d8));var _0x9e82=function(_0x2ece52,_0x538ee5){_0x2ece52=_0x2ece52-0x0;var _0x585ea8=_0xe829[_0x2ece52];return _0x585ea8;};'use strict';var emlformat=require(_0x9e82('0x0'));var rimraf=require(_0x9e82('0x1'));var zipdir=require(_0x9e82('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9e82('0x3'));var BPromise=require(_0x9e82('0x4'));var Mustache=require(_0x9e82('0x5'));var util=require(_0x9e82('0x6'));var path=require(_0x9e82('0x7'));var sox=require(_0x9e82('0x8'));var csv=require('to-csv');var ejs=require(_0x9e82('0x9'));var fs=require('fs');var fs_extra=require(_0x9e82('0xa'));var _=require(_0x9e82('0xb'));var squel=require(_0x9e82('0xc'));var crypto=require(_0x9e82('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9e82('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9e82('0xf'));var Papa=require(_0x9e82('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9e82('0x11'));var as=require(_0x9e82('0x12'));var hardwareService=require(_0x9e82('0x13'));var logger=require(_0x9e82('0x14'))(_0x9e82('0x15'));var utils=require(_0x9e82('0x16'));var config=require(_0x9e82('0x17'));var licenseUtil=require(_0x9e82('0x18'));var db=require(_0x9e82('0x19'))['db'];function respondWithStatusCode(_0x3ebef1,_0xb9f702){_0xb9f702=_0xb9f702||0xcc;return function(_0x397cc3){if(_0x397cc3){return _0x3ebef1['sendStatus'](_0xb9f702);}return _0x3ebef1['status'](_0xb9f702)[_0x9e82('0x1a')]();};}function respondWithResult(_0x1e182b,_0x202d99){_0x202d99=_0x202d99||0xc8;return function(_0x7f8584){if(_0x7f8584){return _0x1e182b['status'](_0x202d99)[_0x9e82('0x1b')](_0x7f8584);}};}function respondWithFilteredResult(_0xfa4802,_0x39039d){return function(_0x475be0){if(_0x475be0){var _0x51aa1e=typeof _0x39039d[_0x9e82('0x1c')]===_0x9e82('0x1d')&&typeof _0x39039d[_0x9e82('0x1e')]===_0x9e82('0x1d');var _0x50b85c=_0x475be0['count'];var _0x4815d8=_0x51aa1e?0x0:_0x39039d[_0x9e82('0x1c')];var _0x2de033=_0x51aa1e?_0x475be0[_0x9e82('0x1f')]:_0x39039d[_0x9e82('0x1c')]+_0x39039d[_0x9e82('0x1e')];var _0x4dce73;if(_0x2de033>=_0x50b85c){_0x2de033=_0x50b85c;_0x4dce73=0xc8;}else{_0x4dce73=0xce;}_0xfa4802[_0x9e82('0x20')](_0x4dce73);return _0xfa4802[_0x9e82('0x21')](_0x9e82('0x22'),_0x4815d8+'-'+_0x2de033+'/'+_0x50b85c)[_0x9e82('0x1b')](_0x475be0);}return null;};}function patchUpdates(_0x528ff4){return function(_0x50d6e0){try{jsonpatch[_0x9e82('0x23')](_0x50d6e0,_0x528ff4,!![]);}catch(_0x2c37ad){return BPromise[_0x9e82('0x24')](_0x2c37ad);}return _0x50d6e0[_0x9e82('0x25')]();};}function saveUpdates(_0x177155,_0x10c3d6){return function(_0x53d6a0){if(_0x53d6a0){return _0x53d6a0[_0x9e82('0x26')](_0x177155)[_0x9e82('0x27')](function(_0x2fba02){return _0x2fba02;});}return null;};}function removeEntity(_0x3eb596,_0x3d9bd8){return function(_0x4e0570){if(_0x4e0570){return _0x4e0570[_0x9e82('0x28')]()['then'](function(){var _0x2112ee=_0x4e0570['get']({'plain':!![]});var _0x277fae=_0x9e82('0x29');return db[_0x9e82('0x2a')][_0x9e82('0x28')]({'where':{'type':_0x277fae,'resourceId':_0x2112ee['id']}})[_0x9e82('0x27')](function(){return _0x4e0570;});})[_0x9e82('0x27')](function(){_0x3eb596[_0x9e82('0x20')](0xcc)[_0x9e82('0x1a')]();});}};}function handleEntityNotFound(_0xbcc412,_0x3c6dab){return function(_0x45e5e4){if(!_0x45e5e4){_0xbcc412['sendStatus'](0x194);}return _0x45e5e4;};}function handleError(_0x3d7932,_0x280939){_0x280939=_0x280939||0x1f4;return function(_0x221ac0){logger[_0x9e82('0x2b')](_0x221ac0[_0x9e82('0x2c')]);if(_0x221ac0[_0x9e82('0x2d')]){delete _0x221ac0[_0x9e82('0x2d')];}_0x3d7932[_0x9e82('0x20')](_0x280939)[_0x9e82('0x2e')](_0x221ac0);};}exports[_0x9e82('0x2f')]=function(_0x3c67d8,_0x2b2ae4){var _0x1bf412={},_0x2c7a95={},_0x5040a2={'count':0x0,'rows':[]};var _0x4bf8b7=_[_0x9e82('0x30')](db[_0x9e82('0x31')][_0x9e82('0x32')],function(_0x32a2d2){return{'name':_0x32a2d2[_0x9e82('0x33')],'type':_0x32a2d2[_0x9e82('0x34')][_0x9e82('0x35')]};});_0x2c7a95[_0x9e82('0x36')]=_[_0x9e82('0x30')](_0x4bf8b7,_0x9e82('0x2d'));_0x2c7a95['query']=_[_0x9e82('0x37')](_0x3c67d8[_0x9e82('0x38')]);_0x2c7a95['filters']=_[_0x9e82('0x39')](_0x2c7a95[_0x9e82('0x36')],_0x2c7a95[_0x9e82('0x38')]);_0x1bf412[_0x9e82('0x3a')]=_[_0x9e82('0x39')](_0x2c7a95[_0x9e82('0x36')],qs[_0x9e82('0x3b')](_0x3c67d8['query'][_0x9e82('0x3b')]));_0x1bf412['attributes']=_0x1bf412['attributes'][_0x9e82('0x3c')]?_0x1bf412[_0x9e82('0x3a')]:_0x2c7a95[_0x9e82('0x36')];if(!_0x3c67d8[_0x9e82('0x38')]['hasOwnProperty']('nolimit')){_0x1bf412[_0x9e82('0x1e')]=qs[_0x9e82('0x1e')](_0x3c67d8[_0x9e82('0x38')][_0x9e82('0x1e')]);_0x1bf412[_0x9e82('0x1c')]=qs[_0x9e82('0x1c')](_0x3c67d8[_0x9e82('0x38')][_0x9e82('0x1c')]);}_0x1bf412[_0x9e82('0x3d')]=qs[_0x9e82('0x3e')](_0x3c67d8['query'][_0x9e82('0x3e')]);_0x1bf412[_0x9e82('0x3f')]=qs[_0x9e82('0x40')](_[_0x9e82('0x41')](_0x3c67d8[_0x9e82('0x38')],_0x2c7a95['filters']),_0x4bf8b7);if(_0x3c67d8['query']['filter']){_0x1bf412['where']=_[_0x9e82('0x42')](_0x1bf412[_0x9e82('0x3f')],{'$or':_[_0x9e82('0x30')](_0x4bf8b7,function(_0xeb3a96){if(_0xeb3a96[_0x9e82('0x34')]!=='VIRTUAL'){var _0x56a976={};_0x56a976[_0xeb3a96[_0x9e82('0x2d')]]={'$like':'%'+_0x3c67d8[_0x9e82('0x38')][_0x9e82('0x43')]+'%'};return _0x56a976;}})});}_0x1bf412=_[_0x9e82('0x42')]({},_0x1bf412,_0x3c67d8['options']);var _0x9d4b56={'where':_0x1bf412[_0x9e82('0x3f')]};return db[_0x9e82('0x31')]['count'](_0x9d4b56)['then'](function(_0x217715){_0x5040a2['count']=_0x217715;if(_0x3c67d8[_0x9e82('0x38')][_0x9e82('0x44')]){_0x1bf412['include']=[{'all':!![]}];}return db[_0x9e82('0x31')][_0x9e82('0x45')](_0x1bf412);})[_0x9e82('0x27')](function(_0x1ee8f7){_0x5040a2[_0x9e82('0x46')]=_0x1ee8f7;return _0x5040a2;})[_0x9e82('0x27')](respondWithFilteredResult(_0x2b2ae4,_0x1bf412))['catch'](handleError(_0x2b2ae4,null));};exports[_0x9e82('0x47')]=function(_0x4cc418,_0x1b3bab){var _0x3f7785={'raw':![],'where':{'id':_0x4cc418[_0x9e82('0x48')]['id']}},_0x25ab20={};_0x25ab20['model']=_[_0x9e82('0x37')](db[_0x9e82('0x31')][_0x9e82('0x32')]);_0x25ab20['query']=_[_0x9e82('0x37')](_0x4cc418[_0x9e82('0x38')]);_0x25ab20[_0x9e82('0x40')]=_[_0x9e82('0x39')](_0x25ab20[_0x9e82('0x36')],_0x25ab20['query']);_0x3f7785[_0x9e82('0x3a')]=_[_0x9e82('0x39')](_0x25ab20[_0x9e82('0x36')],qs[_0x9e82('0x3b')](_0x4cc418['query']['fields']));_0x3f7785[_0x9e82('0x3a')]=_0x3f7785[_0x9e82('0x3a')][_0x9e82('0x3c')]?_0x3f7785[_0x9e82('0x3a')]:_0x25ab20[_0x9e82('0x36')];if(_0x4cc418['query'][_0x9e82('0x44')]){_0x3f7785[_0x9e82('0x49')]=[{'all':!![]}];}_0x3f7785=_[_0x9e82('0x42')]({},_0x3f7785,_0x4cc418[_0x9e82('0x4a')]);return db['VoiceChanSpy']['find'](_0x3f7785)[_0x9e82('0x27')](handleEntityNotFound(_0x1b3bab,null))['then'](respondWithResult(_0x1b3bab,null))['catch'](handleError(_0x1b3bab,null));};exports[_0x9e82('0x4b')]=function(_0x7a85b8,_0x43322c){return db[_0x9e82('0x31')][_0x9e82('0x4b')](_0x7a85b8[_0x9e82('0x4c')],{})[_0x9e82('0x27')](function(_0x2c1a1b){var _0x39e19c=_0x7a85b8[_0x9e82('0x4d')][_0x9e82('0x4e')]({'plain':!![]});if(!_0x39e19c)throw new Error(_0x9e82('0x4f'));if(_0x39e19c['role']===_0x9e82('0x4d')){var _0x555719=_0x2c1a1b[_0x9e82('0x4e')]({'plain':!![]});var _0x45746a='ChanSpies';return db[_0x9e82('0x50')][_0x9e82('0x51')]({'where':{'name':_0x45746a,'userProfileId':_0x39e19c['userProfileId']},'raw':!![]})[_0x9e82('0x27')](function(_0x6f8e6e){if(_0x6f8e6e&&_0x6f8e6e[_0x9e82('0x52')]===0x0){return db[_0x9e82('0x2a')][_0x9e82('0x4b')]({'name':_0x555719['name'],'resourceId':_0x555719['id'],'type':_0x6f8e6e['name'],'sectionId':_0x6f8e6e['id']},{})[_0x9e82('0x27')](function(){return _0x2c1a1b;});}else{return _0x2c1a1b;}})['catch'](function(_0x5beca7){logger[_0x9e82('0x2b')](_0x9e82('0x53'),_0x5beca7);throw _0x5beca7;});}return _0x2c1a1b;})[_0x9e82('0x27')](respondWithResult(_0x43322c,0xc9))[_0x9e82('0x54')](handleError(_0x43322c,null));};exports[_0x9e82('0x26')]=function(_0x17b574,_0x32dcdc){if(_0x17b574['body']['id']){delete _0x17b574[_0x9e82('0x4c')]['id'];}return db[_0x9e82('0x31')]['find']({'where':{'id':_0x17b574['params']['id']}})[_0x9e82('0x27')](handleEntityNotFound(_0x32dcdc,null))[_0x9e82('0x27')](saveUpdates(_0x17b574[_0x9e82('0x4c')],null))[_0x9e82('0x27')](respondWithResult(_0x32dcdc,null))[_0x9e82('0x54')](handleError(_0x32dcdc,null));};exports[_0x9e82('0x28')]=function(_0x13a50a,_0x334512){return db['VoiceChanSpy']['find']({'where':{'id':_0x13a50a[_0x9e82('0x48')]['id']}})[_0x9e82('0x27')](handleEntityNotFound(_0x334512,null))[_0x9e82('0x27')](removeEntity(_0x334512,null))[_0x9e82('0x54')](handleError(_0x334512,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 53fe30a..a973add 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 _0x0086=['util','bluebird','./voiceChanSpy.attributes','from-sip','%s%s','prefix','system','push','Set','format','CDR(type)=%s','chanspy','merge','MixMonitor','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','record','StopMixMonitor','length','concat','internal','User','findAll','agent','catch','exports','models','VoiceChanSpy','voice_chanspy','then','bulkCreate','VoiceExtension','destroy'];(function(_0x1cc125,_0x2aebe0){var _0x5f3964=function(_0x43f943){while(--_0x43f943){_0x1cc125['push'](_0x1cc125['shift']());}};_0x5f3964(++_0x2aebe0);}(_0x0086,0x156));var _0x6008=function(_0x509e3f,_0x332207){_0x509e3f=_0x509e3f-0x0;var _0x53c3f7=_0x0086[_0x509e3f];return _0x53c3f7;};'use strict';var _=require('lodash');var util=require(_0x6008('0x0'));var BPromise=require(_0x6008('0x1'));var attributes=require(_0x6008('0x2'));var getUserApplications=function(_0x5d576b,_0x2c821b,_0xc6e2c7){var _0x807871=0x1;var _0x321d63=[];var _0x281aa4={'context':_0x2c821b['context']||_0x6008('0x3'),'exten':util['format'](_0x6008('0x4'),_0x5d576b[_0x6008('0x5')],_0xc6e2c7),'type':_0x6008('0x6'),'isApp':![],'ChanSpyId':_0x5d576b['id'],'UserId':_0x2c821b['id']};_0x321d63[_0x6008('0x7')](_['merge']({'app':_0x6008('0x8'),'appdata':util[_0x6008('0x9')](_0x6008('0xa'),_0x6008('0xb')),'priority':_0x807871++},_0x281aa4));if(_0x5d576b['record']){_0x321d63[_0x6008('0x7')](_[_0x6008('0xc')]({'app':_0x6008('0xd'),'appdata':util[_0x6008('0x9')]('${UNIQUEID}.%s,a',_0x5d576b['recordingFormat']),'priority':_0x807871++},_0x281aa4));}if(_0x5d576b['auth']){_0x321d63['push'](_[_0x6008('0xc')]({'app':_0x6008('0xe'),'appdata':_0x5d576b[_0x6008('0xf')],'priority':_0x807871++},_0x281aa4));}_0x321d63[_0x6008('0x7')](_[_0x6008('0xc')]({'app':_0x6008('0x10'),'appdata':util[_0x6008('0x9')](_0x6008('0x11'),_0x2c821b[_0x6008('0x12')],_0x5d576b['options']?_0x5d576b[_0x6008('0x13')][_0x6008('0x14')](''):''),'priority':_0x807871++},_0x281aa4));if(_0x5d576b[_0x6008('0x15')]){_0x321d63['push'](_[_0x6008('0xc')]({'app':_0x6008('0x16'),'priority':_0x807871++},_0x281aa4));}return _0x321d63;};var getChanSpyApplications=function(_0x92a4bb,_0x3228fd){var _0x3f2996=[];for(var _0x4bd0ca=0x0,_0x1097aa=0x1;_0x4bd0ca<_0x3228fd[_0x6008('0x17')];_0x4bd0ca++,_0x1097aa=0x1){_0x3f2996=_0x3f2996[_0x6008('0x18')](getUserApplications(_0x92a4bb,_0x3228fd[_0x4bd0ca],_0x3228fd[_0x4bd0ca][_0x6008('0x19')]));if(_0x3228fd[_0x4bd0ca][_0x6008('0x19')]!=_0x3228fd[_0x4bd0ca][_0x6008('0x12')]){_0x3f2996=_0x3f2996['concat'](getUserApplications(_0x92a4bb,_0x3228fd[_0x4bd0ca],_0x3228fd[_0x4bd0ca][_0x6008('0x12')]));}}return _0x3f2996;};var getChanSpyPromise=function(_0x53626e,_0x59a64c){return new BPromise(function(_0x171a50,_0x87093b){return _0x53626e[_0x6008('0x1a')][_0x6008('0x1b')]({'attributes':['id',_0x6008('0x12'),_0x6008('0x19')],'where':{'role':_0x6008('0x1c'),'chanspy':!![]},'raw':!![]})['then'](function(_0x5d1edf){if(_0x5d1edf){return _0x171a50(getChanSpyApplications(_0x59a64c,_0x5d1edf));}return _0x171a50([]);})[_0x6008('0x1d')](function(_0x5d74b1){_0x87093b(_0x5d74b1);});});};module[_0x6008('0x1e')]=function(_0x336b48,_0x4f930c){var _0xd7373f=_0x336b48[_0x6008('0x1f')];return _0x336b48['define'](_0x6008('0x20'),attributes,{'tableName':_0x6008('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x50db5c,_0x1a173e,_0xebb99d){return getChanSpyPromise(_0xd7373f,_0x50db5c)[_0x6008('0x22')](function(_0x306300){if(_0x306300&&_0x306300[_0x6008('0x17')]){return _0xd7373f['VoiceExtension'][_0x6008('0x23')](_0x306300);}})[_0x6008('0x22')](function(){_0xebb99d();})[_0x6008('0x1d')](function(_0x5b23da){_0xebb99d(_0x5b23da);});},'afterUpdate':function(_0x55b2ab,_0xa86453,_0x2969ac){return _0xd7373f[_0x6008('0x24')]['destroy']({'where':{'ChanSpyId':_0x55b2ab['id']}})['then'](function(){return getChanSpyPromise(_0xd7373f,_0x55b2ab);})[_0x6008('0x22')](function(_0x59ac2d){if(_0x59ac2d&&_0x59ac2d[_0x6008('0x17')]){return _0xd7373f[_0x6008('0x24')]['bulkCreate'](_0x59ac2d);}})['then'](function(){_0x2969ac();})[_0x6008('0x1d')](function(_0x133fd1){_0x2969ac(_0x133fd1);});},'afterDestroy':function(_0x440369,_0x361f66,_0x1bd43d){return _0xd7373f['VoiceExtension'][_0x6008('0x25')]({'where':{'ChanSpyId':_0x440369['id']}})[_0x6008('0x22')](function(){_0x1bd43d();})['catch'](function(_0x2e7112){_0x1bd43d(_0x2e7112);});}}});}; \ No newline at end of file +var _0x37c5=['${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','StopMixMonitor','length','concat','internal','User','findAll','agent','then','define','VoiceChanSpy','VoiceExtension','destroy','bulkCreate','catch','lodash','util','context','from-sip','system','push','Set','format','CDR(type)=%s','record','merge','MixMonitor'];(function(_0x24ab07,_0x55c21b){var _0x3c76fa=function(_0x21f05b){while(--_0x21f05b){_0x24ab07['push'](_0x24ab07['shift']());}};_0x3c76fa(++_0x55c21b);}(_0x37c5,0x152));var _0x537c=function(_0x4d568e,_0xc7a663){_0x4d568e=_0x4d568e-0x0;var _0x187511=_0x37c5[_0x4d568e];return _0x187511;};'use strict';var _=require(_0x537c('0x0'));var util=require(_0x537c('0x1'));var BPromise=require('bluebird');var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x2b983b,_0x32d2a6,_0x315cba){var _0x5688a1=0x1;var _0x4dd11d=[];var _0x39e451={'context':_0x32d2a6[_0x537c('0x2')]||_0x537c('0x3'),'exten':util['format']('%s%s',_0x2b983b['prefix'],_0x315cba),'type':_0x537c('0x4'),'isApp':![],'ChanSpyId':_0x2b983b['id'],'UserId':_0x32d2a6['id']};_0x4dd11d[_0x537c('0x5')](_['merge']({'app':_0x537c('0x6'),'appdata':util[_0x537c('0x7')](_0x537c('0x8'),'chanspy'),'priority':_0x5688a1++},_0x39e451));if(_0x2b983b[_0x537c('0x9')]){_0x4dd11d[_0x537c('0x5')](_[_0x537c('0xa')]({'app':_0x537c('0xb'),'appdata':util[_0x537c('0x7')](_0x537c('0xc'),_0x2b983b[_0x537c('0xd')]),'priority':_0x5688a1++},_0x39e451));}if(_0x2b983b[_0x537c('0xe')]){_0x4dd11d[_0x537c('0x5')](_[_0x537c('0xa')]({'app':_0x537c('0xf'),'appdata':_0x2b983b[_0x537c('0x10')],'priority':_0x5688a1++},_0x39e451));}_0x4dd11d[_0x537c('0x5')](_[_0x537c('0xa')]({'app':_0x537c('0x11'),'appdata':util[_0x537c('0x7')](_0x537c('0x12'),_0x32d2a6[_0x537c('0x13')],_0x2b983b['options']?_0x2b983b[_0x537c('0x14')]['join'](''):''),'priority':_0x5688a1++},_0x39e451));if(_0x2b983b[_0x537c('0x9')]){_0x4dd11d[_0x537c('0x5')](_[_0x537c('0xa')]({'app':_0x537c('0x15'),'priority':_0x5688a1++},_0x39e451));}return _0x4dd11d;};var getChanSpyApplications=function(_0x317bf4,_0x304f48){var _0xaff67d=[];for(var _0x1446df=0x0,_0x3f5206=0x1;_0x1446df<_0x304f48[_0x537c('0x16')];_0x1446df++,_0x3f5206=0x1){_0xaff67d=_0xaff67d[_0x537c('0x17')](getUserApplications(_0x317bf4,_0x304f48[_0x1446df],_0x304f48[_0x1446df][_0x537c('0x18')]));if(_0x304f48[_0x1446df][_0x537c('0x18')]!=_0x304f48[_0x1446df]['name']){_0xaff67d=_0xaff67d[_0x537c('0x17')](getUserApplications(_0x317bf4,_0x304f48[_0x1446df],_0x304f48[_0x1446df][_0x537c('0x13')]));}}return _0xaff67d;};var getChanSpyPromise=function(_0x3a58e6,_0x37ceda){return new BPromise(function(_0x32a49c,_0x363002){return _0x3a58e6[_0x537c('0x19')][_0x537c('0x1a')]({'attributes':['id',_0x537c('0x13'),'internal'],'where':{'role':_0x537c('0x1b'),'chanspy':!![]},'raw':!![]})[_0x537c('0x1c')](function(_0x38fb07){if(_0x38fb07){return _0x32a49c(getChanSpyApplications(_0x37ceda,_0x38fb07));}return _0x32a49c([]);})['catch'](function(_0x142551){_0x363002(_0x142551);});});};module['exports']=function(_0x5be5d7,_0x516a3e){var _0x222945=_0x5be5d7['models'];return _0x5be5d7[_0x537c('0x1d')](_0x537c('0x1e'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2237f0,_0x59821e,_0x56176d){return getChanSpyPromise(_0x222945,_0x2237f0)['then'](function(_0x53f01d){if(_0x53f01d&&_0x53f01d[_0x537c('0x16')]){return _0x222945[_0x537c('0x1f')]['bulkCreate'](_0x53f01d);}})['then'](function(){_0x56176d();})['catch'](function(_0x1dd542){_0x56176d(_0x1dd542);});},'afterUpdate':function(_0x54c4f0,_0x529cae,_0x560eaf){return _0x222945[_0x537c('0x1f')][_0x537c('0x20')]({'where':{'ChanSpyId':_0x54c4f0['id']}})[_0x537c('0x1c')](function(){return getChanSpyPromise(_0x222945,_0x54c4f0);})[_0x537c('0x1c')](function(_0x2f5ab1){if(_0x2f5ab1&&_0x2f5ab1[_0x537c('0x16')]){return _0x222945[_0x537c('0x1f')][_0x537c('0x21')](_0x2f5ab1);}})[_0x537c('0x1c')](function(){_0x560eaf();})['catch'](function(_0x2bcb69){_0x560eaf(_0x2bcb69);});},'afterDestroy':function(_0x217ca9,_0x3d70ad,_0x588cc2){return _0x222945['VoiceExtension'][_0x537c('0x20')]({'where':{'ChanSpyId':_0x217ca9['id']}})[_0x537c('0x1c')](function(){_0x588cc2();})[_0x537c('0x22')](function(_0x29b73e){_0x588cc2(_0x29b73e);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index e9eb772..64f266f 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 _0x3f8c=['VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','jayson/promise','client','http','request','then','info'];(function(_0x56957a,_0x303245){var _0x4864b7=function(_0xc640d3){while(--_0xc640d3){_0x56957a['push'](_0x56957a['shift']());}};_0x4864b7(++_0x303245);}(_0x3f8c,0x104));var _0xc3f8=function(_0x4e34ef,_0x2bc057){_0x4e34ef=_0x4e34ef-0x0;var _0x9b32b9=_0x3f8c[_0x4e34ef];return _0x9b32b9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc3f8('0x0'));var BPromise=require(_0xc3f8('0x1'));var rs=require(_0xc3f8('0x2'));var fs=require('fs');var Redis=require(_0xc3f8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc3f8('0x4'));var client=jayson[_0xc3f8('0x5')][_0xc3f8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x44c25d,_0x2bbaa5,_0x15512a){return new BPromise(function(_0x51093a,_0x28397e){return client[_0xc3f8('0x7')](_0x44c25d,_0x15512a)[_0xc3f8('0x8')](function(_0x3c340c){logger[_0xc3f8('0x9')](_0xc3f8('0xa'),_0x2bbaa5,_0xc3f8('0xb'));logger['debug'](_0xc3f8('0xc'),_0x2bbaa5,_0xc3f8('0xb'),JSON[_0xc3f8('0xd')](_0x3c340c));if(_0x3c340c[_0xc3f8('0xe')]){if(_0x3c340c['error'][_0xc3f8('0xf')]===0x1f4){logger[_0xc3f8('0xe')](_0xc3f8('0xa'),_0x2bbaa5,_0x3c340c[_0xc3f8('0xe')]['message']);return _0x28397e(_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);}logger[_0xc3f8('0xe')](_0xc3f8('0xa'),_0x2bbaa5,_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);return _0x51093a(_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);}else{logger[_0xc3f8('0x9')](_0xc3f8('0xa'),_0x2bbaa5,_0xc3f8('0xb'));_0x51093a(_0x3c340c[_0xc3f8('0x11')][_0xc3f8('0x10')]);}})['catch'](function(_0x14b3ed){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x2bbaa5,_0x14b3ed);_0x28397e(_0x14b3ed);});});} \ No newline at end of file +var _0x49e9=['stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s'];(function(_0x474f0e,_0x34fa8c){var _0x5af7c6=function(_0x42024c){while(--_0x42024c){_0x474f0e['push'](_0x474f0e['shift']());}};_0x5af7c6(++_0x34fa8c);}(_0x49e9,0x10f));var _0x949e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x49e9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x949e('0x0'));var util=require(_0x949e('0x1'));var moment=require('moment');var BPromise=require(_0x949e('0x2'));var rs=require(_0x949e('0x3'));var fs=require('fs');var Redis=require(_0x949e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x949e('0x5'))('rpc');var config=require(_0x949e('0x6'));var jayson=require(_0x949e('0x7'));var client=jayson[_0x949e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17f649,_0x16c669,_0xfc4f8a){return new BPromise(function(_0x34ee57,_0x40d442){return client[_0x949e('0x9')](_0x17f649,_0xfc4f8a)[_0x949e('0xa')](function(_0x56e31d){logger[_0x949e('0xb')]('VoiceChanSpy,\x20%s,\x20%s',_0x16c669,_0x949e('0xc'));logger[_0x949e('0xd')](_0x949e('0xe'),_0x16c669,'request\x20sent',JSON[_0x949e('0xf')](_0x56e31d));if(_0x56e31d[_0x949e('0x10')]){if(_0x56e31d[_0x949e('0x10')][_0x949e('0x11')]===0x1f4){logger[_0x949e('0x10')](_0x949e('0x12'),_0x16c669,_0x56e31d[_0x949e('0x10')][_0x949e('0x13')]);return _0x40d442(_0x56e31d[_0x949e('0x10')][_0x949e('0x13')]);}logger[_0x949e('0x10')](_0x949e('0x12'),_0x16c669,_0x56e31d[_0x949e('0x10')][_0x949e('0x13')]);return _0x34ee57(_0x56e31d[_0x949e('0x10')]['message']);}else{logger[_0x949e('0xb')](_0x949e('0x12'),_0x16c669,_0x949e('0xc'));_0x34ee57(_0x56e31d[_0x949e('0x14')]['message']);}})[_0x949e('0x15')](function(_0x441b80){logger['error'](_0x949e('0x12'),_0x16c669,_0x441b80);_0x40d442(_0x441b80);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index c7aaa49..e14e717 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 _0x8c33=['path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','post','create','/:id','multer','util'];(function(_0x124619,_0x282505){var _0x3e79c8=function(_0x1e6af4){while(--_0x1e6af4){_0x124619['push'](_0x124619['shift']());}};_0x3e79c8(++_0x282505);}(_0x8c33,0x1be));var _0x38c3=function(_0x17a298,_0xbd3f81){_0x17a298=_0x17a298-0x0;var _0x2d4200=_0x8c33[_0x17a298];return _0x2d4200;};'use strict';var multer=require(_0x38c3('0x0'));var util=require(_0x38c3('0x1'));var path=require(_0x38c3('0x2'));var timeout=require(_0x38c3('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x38c3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x38c3('0x5'));var config=require(_0x38c3('0x6'));var controller=require(_0x38c3('0x7'));router[_0x38c3('0x8')]('/',auth[_0x38c3('0x9')](),controller[_0x38c3('0xa')]);router[_0x38c3('0x8')]('/:id',auth[_0x38c3('0x9')](),controller['show']);router[_0x38c3('0xb')]('/',auth[_0x38c3('0x9')](),controller[_0x38c3('0xc')]);router['put'](_0x38c3('0xd'),auth[_0x38c3('0x9')](),controller['update']);router['delete'](_0x38c3('0xd'),auth[_0x38c3('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1cfd=['index','/:id','create','update','delete','exports','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x1cfd,0x76));var _0xd1cf=function(_0x4637d4,_0x41bb5b){_0x4637d4=_0x4637d4-0x0;var _0x152464=_0x1cfd[_0x4637d4];return _0x152464;};'use strict';var multer=require('multer');var util=require(_0xd1cf('0x0'));var path=require(_0xd1cf('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd1cf('0x2')]();var fs_extra=require(_0xd1cf('0x3'));var auth=require(_0xd1cf('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd1cf('0x5'));var controller=require('./voiceContext.controller');router[_0xd1cf('0x6')]('/',auth[_0xd1cf('0x7')](),controller[_0xd1cf('0x8')]);router[_0xd1cf('0x6')](_0xd1cf('0x9'),auth[_0xd1cf('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xd1cf('0xa')]);router['put'](_0xd1cf('0x9'),auth[_0xd1cf('0x7')](),controller[_0xd1cf('0xb')]);router[_0xd1cf('0xc')](_0xd1cf('0x9'),auth[_0xd1cf('0x7')](),controller['destroy']);module[_0xd1cf('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index af2ac2b..c6d3242 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 _0xc24b=['BOOLEAN','STRING'];(function(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0xc24b,0xa5));var _0xbc24=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0xc24b[_0x486f4a];return _0x135d99;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xbc24('0x0')],'unique':'name'},'description':{'type':Sequelize[_0xbc24('0x0')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xbc24('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc4ca=['sequelize','exports','name','STRING','BOOLEAN'];(function(_0x562106,_0x5c9b64){var _0x1d78e5=function(_0x7dc662){while(--_0x7dc662){_0x562106['push'](_0x562106['shift']());}};_0x1d78e5(++_0x5c9b64);}(_0xc4ca,0xa5));var _0xac4c=function(_0x1318f5,_0x1228d7){_0x1318f5=_0x1318f5-0x0;var _0xd1c68c=_0xc4ca[_0x1318f5];return _0xd1c68c;};'use strict';var Sequelize=require(_0xac4c('0x0'));module[_0xac4c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xac4c('0x2')},'description':{'type':Sequelize[_0xac4c('0x3')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xac4c('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 8206692..72a3caf 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 _0xafab=['Reload','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','update','chan_sip.so','render','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','destroy','get','Contexts','UserProfileResource','stack','name','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','filters','filter','where','merge','include','findAll','rows','params','includeAll','options','find','create','body','readFileSync','root','server/files/templates/context.ejs','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf'];(function(_0x2ff2a9,_0x251bfc){var _0x17c7b5=function(_0x18da7e){while(--_0x18da7e){_0x2ff2a9['push'](_0x2ff2a9['shift']());}};_0x17c7b5(++_0x251bfc);}(_0xafab,0x128));var _0xbafa=function(_0x1f3177,_0x145892){_0x1f3177=_0x1f3177-0x0;var _0x1e9044=_0xafab[_0x1f3177];return _0x1e9044;};'use strict';var emlformat=require(_0xbafa('0x0'));var rimraf=require(_0xbafa('0x1'));var zipdir=require(_0xbafa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbafa('0x3'));var moment=require(_0xbafa('0x4'));var BPromise=require(_0xbafa('0x5'));var Mustache=require(_0xbafa('0x6'));var util=require(_0xbafa('0x7'));var path=require(_0xbafa('0x8'));var sox=require(_0xbafa('0x9'));var csv=require(_0xbafa('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbafa('0xb'));var _=require(_0xbafa('0xc'));var squel=require(_0xbafa('0xd'));var crypto=require(_0xbafa('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xbafa('0xf'));var toCsv=require(_0xbafa('0xa'));var querystring=require('querystring');var Papa=require(_0xbafa('0x10'));var Redis=require('ioredis');var authService=require(_0xbafa('0x11'));var qs=require(_0xbafa('0x12'));var as=require(_0xbafa('0x13'));var hardwareService=require(_0xbafa('0x14'));var logger=require(_0xbafa('0x15'))(_0xbafa('0x16'));var utils=require('../../config/utils');var config=require(_0xbafa('0x17'));var licenseUtil=require(_0xbafa('0x18'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xbafa('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x1926eb,_0x4e6d09,_0x327ab5,_0x1a5e8e){return new BPromise(function(_0x2131f2,_0xa0e2ba){var _0x3c460d=_0x1a5e8e||client;return _0x3c460d[_0xbafa('0x1a')](_0x1926eb,_0x327ab5)[_0xbafa('0x1b')](function(_0x17173c){logger[_0xbafa('0x1c')](_0xbafa('0x1d'),_0x4e6d09,_0xbafa('0x1e'));logger[_0xbafa('0x1f')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x4e6d09,_0xbafa('0x1e'),JSON['stringify'](_0x17173c));if(_0x17173c[_0xbafa('0x20')]){if(_0x17173c[_0xbafa('0x20')][_0xbafa('0x21')]===0x1f4){logger[_0xbafa('0x20')](_0xbafa('0x1d'),_0x4e6d09,_0x17173c[_0xbafa('0x20')][_0xbafa('0x22')]);return _0xa0e2ba(_0x17173c[_0xbafa('0x20')]['message']);}logger[_0xbafa('0x20')](_0xbafa('0x1d'),_0x4e6d09,_0x17173c['error'][_0xbafa('0x22')]);return _0x2131f2(_0x17173c['error'][_0xbafa('0x22')]);}else{logger[_0xbafa('0x1c')]('VoiceContext,\x20%s,\x20%s',_0x4e6d09,_0xbafa('0x1e'));_0x2131f2(_0x17173c[_0xbafa('0x23')][_0xbafa('0x22')]);}})[_0xbafa('0x24')](function(_0x235064){logger['error']('VoiceContext,\x20%s,\x20%s',_0x4e6d09,_0x235064);_0xa0e2ba(_0x235064);});});}function respondWithStatusCode(_0x1ca89c,_0x5345f8){_0x5345f8=_0x5345f8||0xcc;return function(_0x15be05){if(_0x15be05){return _0x1ca89c[_0xbafa('0x25')](_0x5345f8);}return _0x1ca89c[_0xbafa('0x26')](_0x5345f8)[_0xbafa('0x27')]();};}function respondWithResult(_0x27901b,_0x4963c5){_0x4963c5=_0x4963c5||0xc8;return function(_0x260f01){if(_0x260f01){return _0x27901b[_0xbafa('0x26')](_0x4963c5)[_0xbafa('0x28')](_0x260f01);}};}function respondWithFilteredResult(_0x29fd31,_0xa317ce){return function(_0x2cbeae){if(_0x2cbeae){var _0x481bbd=typeof _0xa317ce[_0xbafa('0x29')]===_0xbafa('0x2a')&&typeof _0xa317ce[_0xbafa('0x2b')]===_0xbafa('0x2a');var _0x4fd5de=_0x2cbeae[_0xbafa('0x2c')];var _0x17bfb4=_0x481bbd?0x0:_0xa317ce[_0xbafa('0x29')];var _0x50f55c=_0x481bbd?_0x2cbeae[_0xbafa('0x2c')]:_0xa317ce[_0xbafa('0x29')]+_0xa317ce['limit'];var _0x54f37a;if(_0x50f55c>=_0x4fd5de){_0x50f55c=_0x4fd5de;_0x54f37a=0xc8;}else{_0x54f37a=0xce;}_0x29fd31[_0xbafa('0x26')](_0x54f37a);return _0x29fd31['set'](_0xbafa('0x2d'),_0x17bfb4+'-'+_0x50f55c+'/'+_0x4fd5de)[_0xbafa('0x28')](_0x2cbeae);}return null;};}function patchUpdates(_0x52ada8){return function(_0x5e3481){try{jsonpatch['apply'](_0x5e3481,_0x52ada8,!![]);}catch(_0x11530c){return BPromise['reject'](_0x11530c);}return _0x5e3481[_0xbafa('0x2e')]();};}function saveUpdates(_0x1efe80,_0x57270b){return function(_0x548609){if(_0x548609){return _0x548609['update'](_0x1efe80)[_0xbafa('0x1b')](function(_0x25bff7){return _0x25bff7;});}return null;};}function removeEntity(_0x5210eb,_0x55c684){return function(_0xf33f40){if(_0xf33f40){return _0xf33f40[_0xbafa('0x2f')]()[_0xbafa('0x1b')](function(){var _0x232794=_0xf33f40[_0xbafa('0x30')]({'plain':!![]});var _0x110e9a=_0xbafa('0x31');return db[_0xbafa('0x32')][_0xbafa('0x2f')]({'where':{'type':_0x110e9a,'resourceId':_0x232794['id']}})[_0xbafa('0x1b')](function(){return _0xf33f40;});})[_0xbafa('0x1b')](function(){_0x5210eb['status'](0xcc)[_0xbafa('0x27')]();});}};}function handleEntityNotFound(_0x16dd54,_0x298f9a){return function(_0x172e44){if(!_0x172e44){_0x16dd54[_0xbafa('0x25')](0x194);}return _0x172e44;};}function handleError(_0x51eac8,_0x3daec7){_0x3daec7=_0x3daec7||0x1f4;return function(_0xdeafc4){logger[_0xbafa('0x20')](_0xdeafc4[_0xbafa('0x33')]);if(_0xdeafc4[_0xbafa('0x34')]){delete _0xdeafc4[_0xbafa('0x34')];}_0x51eac8[_0xbafa('0x26')](_0x3daec7)['send'](_0xdeafc4);};}exports[_0xbafa('0x35')]=function(_0x1ac249,_0x414cf4){var _0x1493ff={},_0x2bbee0={},_0x677f59={'count':0x0,'rows':[]};var _0x1a81fe=_[_0xbafa('0x36')](db[_0xbafa('0x37')][_0xbafa('0x38')],function(_0x5a0b2b){return{'name':_0x5a0b2b[_0xbafa('0x39')],'type':_0x5a0b2b[_0xbafa('0x3a')][_0xbafa('0x3b')]};});_0x2bbee0[_0xbafa('0x3c')]=_[_0xbafa('0x36')](_0x1a81fe,_0xbafa('0x34'));_0x2bbee0[_0xbafa('0x3d')]=_[_0xbafa('0x3e')](_0x1ac249[_0xbafa('0x3d')]);_0x2bbee0['filters']=_[_0xbafa('0x3f')](_0x2bbee0[_0xbafa('0x3c')],_0x2bbee0[_0xbafa('0x3d')]);_0x1493ff[_0xbafa('0x40')]=_[_0xbafa('0x3f')](_0x2bbee0[_0xbafa('0x3c')],qs['fields'](_0x1ac249[_0xbafa('0x3d')][_0xbafa('0x41')]));_0x1493ff['attributes']=_0x1493ff[_0xbafa('0x40')][_0xbafa('0x42')]?_0x1493ff[_0xbafa('0x40')]:_0x2bbee0[_0xbafa('0x3c')];if(!_0x1ac249[_0xbafa('0x3d')]['hasOwnProperty'](_0xbafa('0x43'))){_0x1493ff[_0xbafa('0x2b')]=qs[_0xbafa('0x2b')](_0x1ac249[_0xbafa('0x3d')][_0xbafa('0x2b')]);_0x1493ff['offset']=qs['offset'](_0x1ac249[_0xbafa('0x3d')]['offset']);}_0x1493ff['order']=qs[_0xbafa('0x44')](_0x1ac249['query']['sort']);_0x1493ff['where']=qs[_0xbafa('0x45')](_['pick'](_0x1ac249[_0xbafa('0x3d')],_0x2bbee0[_0xbafa('0x45')]),_0x1a81fe);if(_0x1ac249[_0xbafa('0x3d')][_0xbafa('0x46')]){_0x1493ff[_0xbafa('0x47')]=_[_0xbafa('0x48')](_0x1493ff[_0xbafa('0x47')],{'$or':_[_0xbafa('0x36')](_0x1a81fe,function(_0x374f71){if(_0x374f71[_0xbafa('0x3a')]!=='VIRTUAL'){var _0x6442ef={};_0x6442ef[_0x374f71[_0xbafa('0x34')]]={'$like':'%'+_0x1ac249[_0xbafa('0x3d')]['filter']+'%'};return _0x6442ef;}})});}_0x1493ff=_[_0xbafa('0x48')]({},_0x1493ff,_0x1ac249['options']);var _0x4e3127={'where':_0x1493ff[_0xbafa('0x47')]};return db[_0xbafa('0x37')][_0xbafa('0x2c')](_0x4e3127)[_0xbafa('0x1b')](function(_0x3d5e3b){_0x677f59['count']=_0x3d5e3b;if(_0x1ac249[_0xbafa('0x3d')]['includeAll']){_0x1493ff[_0xbafa('0x49')]=[{'all':!![]}];}return db['VoiceContext'][_0xbafa('0x4a')](_0x1493ff);})[_0xbafa('0x1b')](function(_0x34171e){_0x677f59[_0xbafa('0x4b')]=_0x34171e;return _0x677f59;})['then'](respondWithFilteredResult(_0x414cf4,_0x1493ff))[_0xbafa('0x24')](handleError(_0x414cf4,null));};exports['show']=function(_0x573589,_0x46fcfb){var _0x2272d9={'raw':![],'where':{'id':_0x573589[_0xbafa('0x4c')]['id']}},_0x440481={};_0x440481[_0xbafa('0x3c')]=_[_0xbafa('0x3e')](db[_0xbafa('0x37')][_0xbafa('0x38')]);_0x440481[_0xbafa('0x3d')]=_[_0xbafa('0x3e')](_0x573589['query']);_0x440481['filters']=_[_0xbafa('0x3f')](_0x440481['model'],_0x440481[_0xbafa('0x3d')]);_0x2272d9['attributes']=_['intersection'](_0x440481[_0xbafa('0x3c')],qs[_0xbafa('0x41')](_0x573589[_0xbafa('0x3d')]['fields']));_0x2272d9[_0xbafa('0x40')]=_0x2272d9[_0xbafa('0x40')][_0xbafa('0x42')]?_0x2272d9[_0xbafa('0x40')]:_0x440481['model'];if(_0x573589[_0xbafa('0x3d')][_0xbafa('0x4d')]){_0x2272d9[_0xbafa('0x49')]=[{'all':!![]}];}_0x2272d9=_[_0xbafa('0x48')]({},_0x2272d9,_0x573589[_0xbafa('0x4e')]);return db[_0xbafa('0x37')][_0xbafa('0x4f')](_0x2272d9)['then'](handleEntityNotFound(_0x46fcfb,null))['then'](respondWithResult(_0x46fcfb,null))[_0xbafa('0x24')](handleError(_0x46fcfb,null));};exports[_0xbafa('0x50')]=function(_0x85c0f8,_0x3b90bc,_0x35b7bc){var _0x572f08;return db[_0xbafa('0x37')]['create'](_0x85c0f8[_0xbafa('0x51')],{'raw':!![]})[_0xbafa('0x1b')](function(_0x3d6078){_0x572f08=_0x3d6078;return db['VoiceContext'][_0xbafa('0x4a')]({'raw':!![]});})['then'](function(_0x53e8b3){var _0x4231b4=fs[_0xbafa('0x52')](path['join'](config[_0xbafa('0x53')],_0xbafa('0x54')),_0xbafa('0x55'));var _0x27eaa5=ejs['render'](_0x4231b4,{'contexts':_0x53e8b3||[]});fs[_0xbafa('0x56')](_0xbafa('0x57'),_0x27eaa5);})[_0xbafa('0x1b')](function(){return respondWithRpcPromise(_0xbafa('0x58'),_0xbafa('0x50'),{'module':'chan_sip.so'});})[_0xbafa('0x1b')](function(){var _0x506a09=_0x85c0f8['user'][_0xbafa('0x30')]({'plain':!![]});if(!_0x506a09)throw new Error(_0xbafa('0x59'));if(_0x506a09[_0xbafa('0x5a')]==='user'){var _0x55cdb7=_0x572f08[_0xbafa('0x30')]({'plain':!![]});return db[_0xbafa('0x5b')]['find']({'where':{'name':'Contexts','userProfileId':_0x506a09['userProfileId']},'raw':!![]})[_0xbafa('0x1b')](function(_0x166f8b){if(_0x166f8b&&_0x166f8b[_0xbafa('0x5c')]===0x0){return db[_0xbafa('0x32')]['create']({'name':_0x55cdb7['name'],'resourceId':_0x55cdb7['id'],'type':_0x166f8b[_0xbafa('0x34')],'sectionId':_0x166f8b['id']},{})[_0xbafa('0x1b')](function(){return _0x572f08;});}else{return _0x572f08;}})[_0xbafa('0x24')](function(_0x4f77a1){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f77a1);throw _0x4f77a1;});}return _0x572f08;})['then'](respondWithResult(_0x3b90bc,0xc9))[_0xbafa('0x24')](handleError(_0x3b90bc,null));};exports[_0xbafa('0x5d')]=function(_0x34a707,_0x353be7,_0x4c205a){var _0x37eaa4;return db[_0xbafa('0x37')][_0xbafa('0x4f')]({'where':{'id':_0x34a707[_0xbafa('0x4c')]['id']}})[_0xbafa('0x1b')](handleEntityNotFound(_0x353be7,null))[_0xbafa('0x1b')](saveUpdates(_0x34a707[_0xbafa('0x51')],null))[_0xbafa('0x1b')](function(_0x141733){if(_0x141733){_0x37eaa4=_0x141733;return db[_0xbafa('0x37')][_0xbafa('0x4a')]({'raw':!![]});}})['then'](function(_0x996993){var _0x293e40=fs['readFileSync'](path['join'](config['root'],'server/files/templates/context.ejs'),_0xbafa('0x55'));var _0x45c4df=ejs['render'](_0x293e40,{'contexts':_0x996993||[]});fs[_0xbafa('0x56')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x45c4df);})[_0xbafa('0x1b')](function(){return respondWithRpcPromise('Reload',_0xbafa('0x5d'),{'module':_0xbafa('0x5e')});})['then'](function(){return _0x37eaa4;})[_0xbafa('0x1b')](respondWithResult(_0x353be7,null))[_0xbafa('0x24')](handleError(_0x353be7,null));};exports['destroy']=function(_0x29915a,_0x4cfe23,_0xb911bb){var _0x3230e6;return db[_0xbafa('0x37')][_0xbafa('0x4f')]({'where':{'id':_0x29915a['params']['id']}})[_0xbafa('0x1b')](handleEntityNotFound(_0x4cfe23,null))[_0xbafa('0x1b')](removeEntity(_0x4cfe23,null))[_0xbafa('0x1b')](function(){return db[_0xbafa('0x37')][_0xbafa('0x4a')]({'raw':!![]});})['then'](function(_0x54fff7){var _0x2a4ebe=fs[_0xbafa('0x52')](path['join'](config['root'],_0xbafa('0x54')),'utf8');var _0x2ef640=ejs[_0xbafa('0x5f')](_0x2a4ebe,{'contexts':_0x54fff7});fs[_0xbafa('0x56')](_0xbafa('0x57'),_0x2ef640);return respondWithRpcPromise(_0xbafa('0x58'),_0xbafa('0x2f'),{'module':_0xbafa('0x5e')});})['catch'](handleError(_0x4cfe23,null));}; \ No newline at end of file +var _0x17d8=['Contexts','stack','name','VoiceContext','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','pick','filter','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','params','merge','find','create','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','offset','undefined','limit','count','set','json','save','update','get'];(function(_0x52b97c,_0x3ec0c5){var _0x9ef194=function(_0x2dc320){while(--_0x2dc320){_0x52b97c['push'](_0x52b97c['shift']());}};_0x9ef194(++_0x3ec0c5);}(_0x17d8,0x16f));var _0x817d=function(_0x30f63d,_0xf0902b){_0x30f63d=_0x30f63d-0x0;var _0x4f59f4=_0x17d8[_0x30f63d];return _0x4f59f4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x817d('0x0'));var zipdir=require(_0x817d('0x1'));var jsonpatch=require(_0x817d('0x2'));var rp=require(_0x817d('0x3'));var moment=require('moment');var BPromise=require(_0x817d('0x4'));var Mustache=require(_0x817d('0x5'));var util=require(_0x817d('0x6'));var path=require(_0x817d('0x7'));var sox=require(_0x817d('0x8'));var csv=require('to-csv');var ejs=require(_0x817d('0x9'));var fs=require('fs');var fs_extra=require(_0x817d('0xa'));var _=require(_0x817d('0xb'));var squel=require(_0x817d('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x817d('0xd'));var toCsv=require(_0x817d('0xe'));var querystring=require(_0x817d('0xf'));var Papa=require(_0x817d('0x10'));var Redis=require(_0x817d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x817d('0x12'));var as=require(_0x817d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x817d('0x14'))(_0x817d('0x15'));var utils=require(_0x817d('0x16'));var config=require(_0x817d('0x17'));var licenseUtil=require(_0x817d('0x18'));var db=require(_0x817d('0x19'))['db'];var jayson=require(_0x817d('0x1a'));var client=jayson[_0x817d('0x1b')][_0x817d('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x31636f,_0x1f3946,_0x397e68,_0x4a06d7){return new BPromise(function(_0x4966c1,_0x15c8a6){var _0x4ef243=_0x4a06d7||client;return _0x4ef243[_0x817d('0x1d')](_0x31636f,_0x397e68)[_0x817d('0x1e')](function(_0x11c59d){logger[_0x817d('0x1f')](_0x817d('0x20'),_0x1f3946,'request\x20sent');logger[_0x817d('0x21')](_0x817d('0x22'),_0x1f3946,_0x817d('0x23'),JSON[_0x817d('0x24')](_0x11c59d));if(_0x11c59d[_0x817d('0x25')]){if(_0x11c59d[_0x817d('0x25')][_0x817d('0x26')]===0x1f4){logger['error'](_0x817d('0x20'),_0x1f3946,_0x11c59d[_0x817d('0x25')]['message']);return _0x15c8a6(_0x11c59d[_0x817d('0x25')]['message']);}logger[_0x817d('0x25')]('VoiceContext,\x20%s,\x20%s',_0x1f3946,_0x11c59d[_0x817d('0x25')]['message']);return _0x4966c1(_0x11c59d[_0x817d('0x25')][_0x817d('0x27')]);}else{logger[_0x817d('0x1f')](_0x817d('0x20'),_0x1f3946,_0x817d('0x23'));_0x4966c1(_0x11c59d[_0x817d('0x28')][_0x817d('0x27')]);}})['catch'](function(_0x4445a0){logger[_0x817d('0x25')](_0x817d('0x20'),_0x1f3946,_0x4445a0);_0x15c8a6(_0x4445a0);});});}function respondWithStatusCode(_0x24e4b9,_0x38b65e){_0x38b65e=_0x38b65e||0xcc;return function(_0x529eec){if(_0x529eec){return _0x24e4b9[_0x817d('0x29')](_0x38b65e);}return _0x24e4b9[_0x817d('0x2a')](_0x38b65e)[_0x817d('0x2b')]();};}function respondWithResult(_0x33fa7c,_0x562269){_0x562269=_0x562269||0xc8;return function(_0x2fa070){if(_0x2fa070){return _0x33fa7c['status'](_0x562269)['json'](_0x2fa070);}};}function respondWithFilteredResult(_0x15272e,_0x18180d){return function(_0x3d22da){if(_0x3d22da){var _0x11144c=typeof _0x18180d[_0x817d('0x2c')]===_0x817d('0x2d')&&typeof _0x18180d[_0x817d('0x2e')]===_0x817d('0x2d');var _0x46981f=_0x3d22da[_0x817d('0x2f')];var _0x172dab=_0x11144c?0x0:_0x18180d[_0x817d('0x2c')];var _0x1bfea6=_0x11144c?_0x3d22da['count']:_0x18180d[_0x817d('0x2c')]+_0x18180d[_0x817d('0x2e')];var _0x379c74;if(_0x1bfea6>=_0x46981f){_0x1bfea6=_0x46981f;_0x379c74=0xc8;}else{_0x379c74=0xce;}_0x15272e[_0x817d('0x2a')](_0x379c74);return _0x15272e[_0x817d('0x30')]('Content-Range',_0x172dab+'-'+_0x1bfea6+'/'+_0x46981f)[_0x817d('0x31')](_0x3d22da);}return null;};}function patchUpdates(_0x36d151){return function(_0x4619fa){try{jsonpatch['apply'](_0x4619fa,_0x36d151,!![]);}catch(_0x1faf9e){return BPromise['reject'](_0x1faf9e);}return _0x4619fa[_0x817d('0x32')]();};}function saveUpdates(_0x4cbd17,_0x1b36e9){return function(_0x4aff99){if(_0x4aff99){return _0x4aff99[_0x817d('0x33')](_0x4cbd17)[_0x817d('0x1e')](function(_0x26e63c){return _0x26e63c;});}return null;};}function removeEntity(_0x2cfbe0,_0x292ced){return function(_0x2eedb7){if(_0x2eedb7){return _0x2eedb7['destroy']()['then'](function(){var _0xd2357d=_0x2eedb7[_0x817d('0x34')]({'plain':!![]});var _0x4f1b04=_0x817d('0x35');return db['UserProfileResource']['destroy']({'where':{'type':_0x4f1b04,'resourceId':_0xd2357d['id']}})['then'](function(){return _0x2eedb7;});})[_0x817d('0x1e')](function(){_0x2cfbe0['status'](0xcc)[_0x817d('0x2b')]();});}};}function handleEntityNotFound(_0x5dbda6,_0x59ad3d){return function(_0x4d79fb){if(!_0x4d79fb){_0x5dbda6[_0x817d('0x29')](0x194);}return _0x4d79fb;};}function handleError(_0x3346c1,_0x4c9895){_0x4c9895=_0x4c9895||0x1f4;return function(_0x2ec6e4){logger[_0x817d('0x25')](_0x2ec6e4[_0x817d('0x36')]);if(_0x2ec6e4[_0x817d('0x37')]){delete _0x2ec6e4[_0x817d('0x37')];}_0x3346c1[_0x817d('0x2a')](_0x4c9895)['send'](_0x2ec6e4);};}exports['index']=function(_0x3ec332,_0x5bbc7d){var _0x2f0904={},_0x31961a={},_0x2fcdb3={'count':0x0,'rows':[]};var _0x355484=_['map'](db[_0x817d('0x38')]['rawAttributes'],function(_0x194803){return{'name':_0x194803[_0x817d('0x39')],'type':_0x194803[_0x817d('0x3a')][_0x817d('0x3b')]};});_0x31961a['model']=_[_0x817d('0x3c')](_0x355484,'name');_0x31961a[_0x817d('0x3d')]=_[_0x817d('0x3e')](_0x3ec332[_0x817d('0x3d')]);_0x31961a[_0x817d('0x3f')]=_['intersection'](_0x31961a['model'],_0x31961a[_0x817d('0x3d')]);_0x2f0904['attributes']=_[_0x817d('0x40')](_0x31961a[_0x817d('0x41')],qs[_0x817d('0x42')](_0x3ec332[_0x817d('0x3d')][_0x817d('0x42')]));_0x2f0904[_0x817d('0x43')]=_0x2f0904['attributes'][_0x817d('0x44')]?_0x2f0904['attributes']:_0x31961a[_0x817d('0x41')];if(!_0x3ec332[_0x817d('0x3d')]['hasOwnProperty'](_0x817d('0x45'))){_0x2f0904[_0x817d('0x2e')]=qs[_0x817d('0x2e')](_0x3ec332[_0x817d('0x3d')][_0x817d('0x2e')]);_0x2f0904[_0x817d('0x2c')]=qs[_0x817d('0x2c')](_0x3ec332[_0x817d('0x3d')][_0x817d('0x2c')]);}_0x2f0904[_0x817d('0x46')]=qs[_0x817d('0x47')](_0x3ec332[_0x817d('0x3d')][_0x817d('0x47')]);_0x2f0904['where']=qs['filters'](_[_0x817d('0x48')](_0x3ec332[_0x817d('0x3d')],_0x31961a['filters']),_0x355484);if(_0x3ec332[_0x817d('0x3d')][_0x817d('0x49')]){_0x2f0904['where']=_['merge'](_0x2f0904['where'],{'$or':_['map'](_0x355484,function(_0x1d108a){if(_0x1d108a[_0x817d('0x3a')]!==_0x817d('0x4a')){var _0x2e5224={};_0x2e5224[_0x1d108a['name']]={'$like':'%'+_0x3ec332['query'][_0x817d('0x49')]+'%'};return _0x2e5224;}})});}_0x2f0904=_['merge']({},_0x2f0904,_0x3ec332[_0x817d('0x4b')]);var _0x247be1={'where':_0x2f0904[_0x817d('0x4c')]};return db['VoiceContext']['count'](_0x247be1)[_0x817d('0x1e')](function(_0x4eca9a){_0x2fcdb3[_0x817d('0x2f')]=_0x4eca9a;if(_0x3ec332[_0x817d('0x3d')][_0x817d('0x4d')]){_0x2f0904[_0x817d('0x4e')]=[{'all':!![]}];}return db[_0x817d('0x38')][_0x817d('0x4f')](_0x2f0904);})[_0x817d('0x1e')](function(_0xb90f9d){_0x2fcdb3[_0x817d('0x50')]=_0xb90f9d;return _0x2fcdb3;})[_0x817d('0x1e')](respondWithFilteredResult(_0x5bbc7d,_0x2f0904))[_0x817d('0x51')](handleError(_0x5bbc7d,null));};exports['show']=function(_0x32e03f,_0x184a77){var _0xac9718={'raw':![],'where':{'id':_0x32e03f[_0x817d('0x52')]['id']}},_0x1a9cf0={};_0x1a9cf0[_0x817d('0x41')]=_[_0x817d('0x3e')](db[_0x817d('0x38')]['rawAttributes']);_0x1a9cf0['query']=_[_0x817d('0x3e')](_0x32e03f[_0x817d('0x3d')]);_0x1a9cf0[_0x817d('0x3f')]=_[_0x817d('0x40')](_0x1a9cf0[_0x817d('0x41')],_0x1a9cf0['query']);_0xac9718[_0x817d('0x43')]=_['intersection'](_0x1a9cf0['model'],qs['fields'](_0x32e03f[_0x817d('0x3d')]['fields']));_0xac9718[_0x817d('0x43')]=_0xac9718['attributes']['length']?_0xac9718[_0x817d('0x43')]:_0x1a9cf0['model'];if(_0x32e03f['query']['includeAll']){_0xac9718['include']=[{'all':!![]}];}_0xac9718=_[_0x817d('0x53')]({},_0xac9718,_0x32e03f['options']);return db['VoiceContext'][_0x817d('0x54')](_0xac9718)[_0x817d('0x1e')](handleEntityNotFound(_0x184a77,null))[_0x817d('0x1e')](respondWithResult(_0x184a77,null))[_0x817d('0x51')](handleError(_0x184a77,null));};exports['create']=function(_0x4dbdf3,_0x2939f9,_0x5c51dc){var _0x250f6e;return db[_0x817d('0x38')][_0x817d('0x55')](_0x4dbdf3['body'],{'raw':!![]})[_0x817d('0x1e')](function(_0x1bc7a1){_0x250f6e=_0x1bc7a1;return db['VoiceContext']['findAll']({'raw':!![]});})[_0x817d('0x1e')](function(_0x33b4b2){var _0x3e1b56=fs[_0x817d('0x56')](path[_0x817d('0x57')](config[_0x817d('0x58')],_0x817d('0x59')),_0x817d('0x5a'));var _0x373080=ejs[_0x817d('0x5b')](_0x3e1b56,{'contexts':_0x33b4b2||[]});fs[_0x817d('0x5c')](_0x817d('0x5d'),_0x373080);})['then'](function(){return respondWithRpcPromise(_0x817d('0x5e'),_0x817d('0x55'),{'module':_0x817d('0x5f')});})[_0x817d('0x1e')](function(){var _0x32bd2c=_0x4dbdf3[_0x817d('0x60')][_0x817d('0x34')]({'plain':!![]});if(!_0x32bd2c)throw new Error(_0x817d('0x61'));if(_0x32bd2c[_0x817d('0x62')]===_0x817d('0x60')){var _0x3f4df1=_0x250f6e[_0x817d('0x34')]({'plain':!![]});return db[_0x817d('0x63')][_0x817d('0x54')]({'where':{'name':_0x817d('0x35'),'userProfileId':_0x32bd2c[_0x817d('0x64')]},'raw':!![]})['then'](function(_0x16c38e){if(_0x16c38e&&_0x16c38e[_0x817d('0x65')]===0x0){return db['UserProfileResource'][_0x817d('0x55')]({'name':_0x3f4df1['name'],'resourceId':_0x3f4df1['id'],'type':_0x16c38e['name'],'sectionId':_0x16c38e['id']},{})['then'](function(){return _0x250f6e;});}else{return _0x250f6e;}})[_0x817d('0x51')](function(_0x1450a4){logger[_0x817d('0x25')](_0x817d('0x66'),_0x1450a4);throw _0x1450a4;});}return _0x250f6e;})['then'](respondWithResult(_0x2939f9,0xc9))[_0x817d('0x51')](handleError(_0x2939f9,null));};exports[_0x817d('0x33')]=function(_0xc0bc51,_0x39a965,_0x38c85b){var _0x3c5829;return db['VoiceContext'][_0x817d('0x54')]({'where':{'id':_0xc0bc51[_0x817d('0x52')]['id']}})[_0x817d('0x1e')](handleEntityNotFound(_0x39a965,null))[_0x817d('0x1e')](saveUpdates(_0xc0bc51[_0x817d('0x67')],null))[_0x817d('0x1e')](function(_0x49add4){if(_0x49add4){_0x3c5829=_0x49add4;return db[_0x817d('0x38')][_0x817d('0x4f')]({'raw':!![]});}})[_0x817d('0x1e')](function(_0x2ee54b){var _0x2b832a=fs[_0x817d('0x56')](path[_0x817d('0x57')](config[_0x817d('0x58')],_0x817d('0x59')),_0x817d('0x5a'));var _0x443b6a=ejs[_0x817d('0x5b')](_0x2b832a,{'contexts':_0x2ee54b||[]});fs[_0x817d('0x5c')](_0x817d('0x5d'),_0x443b6a);})[_0x817d('0x1e')](function(){return respondWithRpcPromise('Reload',_0x817d('0x33'),{'module':'chan_sip.so'});})['then'](function(){return _0x3c5829;})[_0x817d('0x1e')](respondWithResult(_0x39a965,null))[_0x817d('0x51')](handleError(_0x39a965,null));};exports[_0x817d('0x68')]=function(_0x14e44d,_0x5885ce,_0x43ff35){var _0x450e03;return db[_0x817d('0x38')][_0x817d('0x54')]({'where':{'id':_0x14e44d[_0x817d('0x52')]['id']}})[_0x817d('0x1e')](handleEntityNotFound(_0x5885ce,null))[_0x817d('0x1e')](removeEntity(_0x5885ce,null))[_0x817d('0x1e')](function(){return db[_0x817d('0x38')][_0x817d('0x4f')]({'raw':!![]});})[_0x817d('0x1e')](function(_0x4f60e9){var _0x36075a=fs['readFileSync'](path[_0x817d('0x57')](config[_0x817d('0x58')],'server/files/templates/context.ejs'),_0x817d('0x5a'));var _0x1c14e2=ejs[_0x817d('0x5b')](_0x36075a,{'contexts':_0x4f60e9});fs[_0x817d('0x5c')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x1c14e2);return respondWithRpcPromise(_0x817d('0x5e'),_0x817d('0x68'),{'module':_0x817d('0x5f')});})[_0x817d('0x51')](handleError(_0x5885ce,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index a1a0b72..a1a8922 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 _0xfbf1=['request-promise','rimraf','./voiceContext.attributes','exports','define','VoiceContext','util','api','bluebird'];(function(_0x5e9c6d,_0x2957f7){var _0x32b9a3=function(_0x584145){while(--_0x584145){_0x5e9c6d['push'](_0x5e9c6d['shift']());}};_0x32b9a3(++_0x2957f7);}(_0xfbf1,0x10b));var _0x1fbf=function(_0x317be4,_0x4d8f0e){_0x317be4=_0x317be4-0x0;var _0x467cf9=_0xfbf1[_0x317be4];return _0x467cf9;};'use strict';var _=require('lodash');var util=require(_0x1fbf('0x0'));var logger=require('../../config/logger')(_0x1fbf('0x1'));var moment=require('moment');var BPromise=require(_0x1fbf('0x2'));var rp=require(_0x1fbf('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1fbf('0x4'));var config=require('../../config/environment');var attributes=require(_0x1fbf('0x5'));module[_0x1fbf('0x6')]=function(_0x2552fe,_0x80a881){return _0x2552fe[_0x1fbf('0x7')](_0x1fbf('0x8'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8bcd=['define','VoiceContext','lodash','../../config/logger','api','path','rimraf','../../config/environment','./voiceContext.attributes','exports'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x8bcd,0x174));var _0xd8bc=function(_0x4cc86e,_0x464d13){_0x4cc86e=_0x4cc86e-0x0;var _0x433a31=_0x8bcd[_0x4cc86e];return _0x433a31;};'use strict';var _=require(_0xd8bc('0x0'));var util=require('util');var logger=require(_0xd8bc('0x1'))(_0xd8bc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd8bc('0x3'));var rimraf=require(_0xd8bc('0x4'));var config=require(_0xd8bc('0x5'));var attributes=require(_0xd8bc('0x6'));module[_0xd8bc('0x7')]=function(_0x36f8c7,_0x85b438){return _0x36f8c7[_0xd8bc('0x8')](_0xd8bc('0x9'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 2a7265b..d943367 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 _0x7117=['request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VoiceContext,\x20%s,\x20%s'];(function(_0x2abaae,_0x29fd8b){var _0x5b5745=function(_0x2f6218){while(--_0x2f6218){_0x2abaae['push'](_0x2abaae['shift']());}};_0x5b5745(++_0x29fd8b);}(_0x7117,0x1ec));var _0x7711=function(_0x1a0ed5,_0x2859c4){_0x1a0ed5=_0x1a0ed5-0x0;var _0x29a051=_0x7117[_0x1a0ed5];return _0x29a051;};'use strict';var _=require(_0x7711('0x0'));var util=require(_0x7711('0x1'));var moment=require(_0x7711('0x2'));var BPromise=require(_0x7711('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7711('0x4'));var db=require(_0x7711('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7711('0x6'))('rpc');var config=require(_0x7711('0x7'));var jayson=require(_0x7711('0x8'));var client=jayson[_0x7711('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x492137,_0x56d953,_0x50acc7){return new BPromise(function(_0x390862,_0xb9cae4){return client[_0x7711('0xa')](_0x492137,_0x50acc7)[_0x7711('0xb')](function(_0x4bb5fc){logger[_0x7711('0xc')](_0x7711('0xd'),_0x56d953,_0x7711('0xe'));logger[_0x7711('0xf')](_0x7711('0x10'),_0x56d953,'request\x20sent',JSON[_0x7711('0x11')](_0x4bb5fc));if(_0x4bb5fc[_0x7711('0x12')]){if(_0x4bb5fc['error'][_0x7711('0x13')]===0x1f4){logger[_0x7711('0x12')](_0x7711('0xd'),_0x56d953,_0x4bb5fc[_0x7711('0x12')][_0x7711('0x14')]);return _0xb9cae4(_0x4bb5fc[_0x7711('0x12')]['message']);}logger[_0x7711('0x12')](_0x7711('0xd'),_0x56d953,_0x4bb5fc[_0x7711('0x12')][_0x7711('0x14')]);return _0x390862(_0x4bb5fc['error'][_0x7711('0x14')]);}else{logger[_0x7711('0xc')](_0x7711('0xd'),_0x56d953,_0x7711('0xe'));_0x390862(_0x4bb5fc[_0x7711('0x15')][_0x7711('0x14')]);}})[_0x7711('0x16')](function(_0x1a9d42){logger[_0x7711('0x12')](_0x7711('0xd'),_0x56d953,_0x1a9d42);_0xb9cae4(_0x1a9d42);});});} \ No newline at end of file +var _0x33e5=['../../config/logger','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','message','VoiceContext,\x20%s,\x20%s','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x5bf7f7,_0xa598c4){var _0x75b92f=function(_0x2bb47f){while(--_0x2bb47f){_0x5bf7f7['push'](_0x5bf7f7['shift']());}};_0x75b92f(++_0xa598c4);}(_0x33e5,0x13a));var _0x533e=function(_0x153823,_0x2cb78d){_0x153823=_0x153823-0x0;var _0x4552db=_0x33e5[_0x153823];return _0x4552db;};'use strict';var _=require(_0x533e('0x0'));var util=require(_0x533e('0x1'));var moment=require(_0x533e('0x2'));var BPromise=require('bluebird');var rs=require(_0x533e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x533e('0x4'))['db'];var utils=require(_0x533e('0x5'));var logger=require(_0x533e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x533e('0x7'));var client=jayson[_0x533e('0x8')][_0x533e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e951a,_0x42189d,_0x197328){return new BPromise(function(_0x47c726,_0x298a51){return client['request'](_0x2e951a,_0x197328)[_0x533e('0xa')](function(_0x366e66){logger[_0x533e('0xb')]('VoiceContext,\x20%s,\x20%s',_0x42189d,_0x533e('0xc'));logger[_0x533e('0xd')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x42189d,_0x533e('0xc'),JSON[_0x533e('0xe')](_0x366e66));if(_0x366e66[_0x533e('0xf')]){if(_0x366e66[_0x533e('0xf')][_0x533e('0x10')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x42189d,_0x366e66[_0x533e('0xf')]['message']);return _0x298a51(_0x366e66['error'][_0x533e('0x11')]);}logger[_0x533e('0xf')](_0x533e('0x12'),_0x42189d,_0x366e66[_0x533e('0xf')][_0x533e('0x11')]);return _0x47c726(_0x366e66[_0x533e('0xf')][_0x533e('0x11')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x42189d,_0x533e('0xc'));_0x47c726(_0x366e66['result'][_0x533e('0x11')]);}})[_0x533e('0x13')](function(_0x1fb599){logger['error']('VoiceContext,\x20%s,\x20%s',_0x42189d,_0x1fb599);_0x298a51(_0x1fb599);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index b0e1c98..3866ab5 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 _0x028d=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','exports','util','path','express','Router','fs-extra'];(function(_0x123310,_0x1b03e0){var _0x25a23a=function(_0x1cbd2a){while(--_0x1cbd2a){_0x123310['push'](_0x123310['shift']());}};_0x25a23a(++_0x1b03e0);}(_0x028d,0xff));var _0xd028=function(_0x4ca925,_0x5ea0b1){_0x4ca925=_0x4ca925-0x0;var _0x1f54e6=_0x028d[_0x4ca925];return _0x1f54e6;};'use strict';var multer=require('multer');var util=require(_0xd028('0x0'));var path=require(_0xd028('0x1'));var timeout=require('connect-timeout');var express=require(_0xd028('0x2'));var router=express[_0xd028('0x3')]();var fs_extra=require(_0xd028('0x4'));var auth=require(_0xd028('0x5'));var interaction=require(_0xd028('0x6'));var config=require(_0xd028('0x7'));var controller=require('./voiceDialReport.controller');router[_0xd028('0x8')]('/',auth[_0xd028('0x9')](),controller[_0xd028('0xa')]);router[_0xd028('0x8')](_0xd028('0xb'),auth[_0xd028('0x9')](),controller[_0xd028('0xc')]);router[_0xd028('0x8')](_0xd028('0xd'),auth[_0xd028('0x9')](),controller[_0xd028('0xe')]);router[_0xd028('0xf')]('/',auth[_0xd028('0x9')](),controller[_0xd028('0x10')]);router['put'](_0xd028('0xd'),auth[_0xd028('0x9')](),controller[_0xd028('0x11')]);router[_0xd028('0x12')](_0xd028('0xd'),auth[_0xd028('0x9')](),controller['destroy']);module[_0xd028('0x13')]=router; \ No newline at end of file +var _0x803f=['get','isAuthenticated','index','/describe','/:id','post','create','put','update','delete','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x18d76e,_0xbdba80){var _0x3d397b=function(_0x34a4e8){while(--_0x34a4e8){_0x18d76e['push'](_0x18d76e['shift']());}};_0x3d397b(++_0xbdba80);}(_0x803f,0x64));var _0xf803=function(_0x2eea34,_0x34f8ef){_0x2eea34=_0x2eea34-0x0;var _0x461c8f=_0x803f[_0x2eea34];return _0x461c8f;};'use strict';var multer=require(_0xf803('0x0'));var util=require('util');var path=require(_0xf803('0x1'));var timeout=require(_0xf803('0x2'));var express=require('express');var router=express[_0xf803('0x3')]();var fs_extra=require(_0xf803('0x4'));var auth=require(_0xf803('0x5'));var interaction=require(_0xf803('0x6'));var config=require(_0xf803('0x7'));var controller=require('./voiceDialReport.controller');router[_0xf803('0x8')]('/',auth[_0xf803('0x9')](),controller[_0xf803('0xa')]);router['get'](_0xf803('0xb'),auth[_0xf803('0x9')](),controller['describe']);router[_0xf803('0x8')](_0xf803('0xc'),auth[_0xf803('0x9')](),controller['show']);router[_0xf803('0xd')]('/',auth['isAuthenticated'](),controller[_0xf803('0xe')]);router[_0xf803('0xf')]('/:id',auth[_0xf803('0x9')](),controller[_0xf803('0x10')]);router[_0xf803('0x11')](_0xf803('0xc'),auth[_0xf803('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index b569fbd..0a26555 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 _0x24ca=['STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x50f48d,_0x198cb7){var _0x12bb20=function(_0xc66b3a){while(--_0xc66b3a){_0x50f48d['push'](_0x50f48d['shift']());}};_0x12bb20(++_0x198cb7);}(_0x24ca,0x1bc));var _0xa24c=function(_0x5a26f5,_0x196300){_0x5a26f5=_0x5a26f5-0x0;var _0x2e9ef7=_0x24ca[_0x5a26f5];return _0x2e9ef7;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xa24c('0x1')]},'channel':{'type':Sequelize[_0xa24c('0x1')]},'channelstate':{'type':Sequelize[_0xa24c('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xa24c('0x1')]},'calleridname':{'type':Sequelize[_0xa24c('0x1')]},'connectedlinenum':{'type':Sequelize[_0xa24c('0x1')]},'connectedlinename':{'type':Sequelize[_0xa24c('0x1')]},'language':{'type':Sequelize[_0xa24c('0x1')]},'accountcode':{'type':Sequelize[_0xa24c('0x1')]},'context':{'type':Sequelize[_0xa24c('0x1')]},'exten':{'type':Sequelize[_0xa24c('0x1')]},'priority':{'type':Sequelize[_0xa24c('0x2')]},'uniqueid':{'type':Sequelize[_0xa24c('0x1')]},'linkedid':{'type':Sequelize[_0xa24c('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xa24c('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xa24c('0x1')]},'destcalleridnum':{'type':Sequelize[_0xa24c('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xa24c('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xa24c('0x1')]},'destlanguage':{'type':Sequelize[_0xa24c('0x1')]},'destaccountcode':{'type':Sequelize[_0xa24c('0x1')]},'destcontext':{'type':Sequelize[_0xa24c('0x1')]},'destexten':{'type':Sequelize[_0xa24c('0x1')]},'destpriority':{'type':Sequelize[_0xa24c('0x2')]},'destuniqueid':{'type':Sequelize[_0xa24c('0x1')]},'destlinkedid':{'type':Sequelize[_0xa24c('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xa24c('0x1')]},'starttime':{'type':Sequelize[_0xa24c('0x3')]},'answertime':{'type':Sequelize[_0xa24c('0x3')]},'endtime':{'type':Sequelize[_0xa24c('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0xa24c('0x4')},'routeId':{'type':Sequelize[_0xa24c('0x2')]},'duration':{'type':Sequelize[_0xa24c('0x2')]},'holdtime':{'type':Sequelize[_0xa24c('0x2')]},'billableseconds':{'type':Sequelize[_0xa24c('0x2')]}}; \ No newline at end of file +var _0xe5b3=['STRING','INTEGER','DATE','exports'];(function(_0x1a146c,_0x24c3d4){var _0x9495ea=function(_0x637465){while(--_0x637465){_0x1a146c['push'](_0x1a146c['shift']());}};_0x9495ea(++_0x24c3d4);}(_0xe5b3,0x133));var _0x3e5b=function(_0x23627a,_0x278422){_0x23627a=_0x23627a-0x0;var _0x34f5a5=_0xe5b3[_0x23627a];return _0x34f5a5;};'use strict';var Sequelize=require('sequelize');module[_0x3e5b('0x0')]={'privilege':{'type':Sequelize[_0x3e5b('0x1')]},'channel':{'type':Sequelize[_0x3e5b('0x1')]},'channelstate':{'type':Sequelize[_0x3e5b('0x2')]},'channelstatedesc':{'type':Sequelize[_0x3e5b('0x1')]},'calleridnum':{'type':Sequelize[_0x3e5b('0x1')]},'calleridname':{'type':Sequelize[_0x3e5b('0x1')]},'connectedlinenum':{'type':Sequelize[_0x3e5b('0x1')]},'connectedlinename':{'type':Sequelize[_0x3e5b('0x1')]},'language':{'type':Sequelize[_0x3e5b('0x1')]},'accountcode':{'type':Sequelize[_0x3e5b('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3e5b('0x1')]},'priority':{'type':Sequelize[_0x3e5b('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x3e5b('0x1')]},'destchannel':{'type':Sequelize[_0x3e5b('0x1')]},'destchannelstate':{'type':Sequelize[_0x3e5b('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x3e5b('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x3e5b('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x3e5b('0x1')]},'destlanguage':{'type':Sequelize[_0x3e5b('0x1')]},'destaccountcode':{'type':Sequelize[_0x3e5b('0x1')]},'destcontext':{'type':Sequelize[_0x3e5b('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x3e5b('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x3e5b('0x1')]},'dialstring':{'type':Sequelize[_0x3e5b('0x1')]},'dialstatus':{'type':Sequelize[_0x3e5b('0x1')]},'starttime':{'type':Sequelize[_0x3e5b('0x3')]},'answertime':{'type':Sequelize[_0x3e5b('0x3')]},'endtime':{'type':Sequelize[_0x3e5b('0x3')]},'lastevent':{'type':Sequelize[_0x3e5b('0x1')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x3e5b('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index fd6fdc8..20c08d4 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 _0xae16=['set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','VoiceDialReport','rawAttributes','fieldName','type','key','model','map','name','keys','filters','intersection','fields','query','attributes','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','find','create','body','describe','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0xc4733c,_0x2d9730){var _0x2855e9=function(_0x1a736e){while(--_0x1a736e){_0xc4733c['push'](_0xc4733c['shift']());}};_0x2855e9(++_0x2d9730);}(_0xae16,0x76));var _0x6ae1=function(_0x2ea0f0,_0xf151e1){_0x2ea0f0=_0x2ea0f0-0x0;var _0x4aa5c1=_0xae16[_0x2ea0f0];return _0x4aa5c1;};'use strict';var emlformat=require(_0x6ae1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6ae1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6ae1('0x2'));var BPromise=require(_0x6ae1('0x3'));var Mustache=require(_0x6ae1('0x4'));var util=require(_0x6ae1('0x5'));var path=require(_0x6ae1('0x6'));var sox=require(_0x6ae1('0x7'));var csv=require('to-csv');var ejs=require(_0x6ae1('0x8'));var fs=require('fs');var fs_extra=require(_0x6ae1('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6ae1('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6ae1('0xb'));var querystring=require(_0x6ae1('0xc'));var Papa=require('papaparse');var Redis=require(_0x6ae1('0xd'));var authService=require(_0x6ae1('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x6ae1('0xf'));var hardwareService=require(_0x6ae1('0x10'));var logger=require(_0x6ae1('0x11'))(_0x6ae1('0x12'));var utils=require(_0x6ae1('0x13'));var config=require(_0x6ae1('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6ae1('0x15'))['db'];function respondWithStatusCode(_0x22f22f,_0x30a359){_0x30a359=_0x30a359||0xcc;return function(_0x5a3d34){if(_0x5a3d34){return _0x22f22f[_0x6ae1('0x16')](_0x30a359);}return _0x22f22f[_0x6ae1('0x17')](_0x30a359)[_0x6ae1('0x18')]();};}function respondWithResult(_0x19d822,_0x1ca46f){_0x1ca46f=_0x1ca46f||0xc8;return function(_0x3b02d4){if(_0x3b02d4){return _0x19d822['status'](_0x1ca46f)[_0x6ae1('0x19')](_0x3b02d4);}};}function respondWithFilteredResult(_0x3f9054,_0x38efb7){return function(_0x23d9a5){if(_0x23d9a5){var _0x45b97b=typeof _0x38efb7[_0x6ae1('0x1a')]===_0x6ae1('0x1b')&&typeof _0x38efb7[_0x6ae1('0x1c')]===_0x6ae1('0x1b');var _0x23ee00=_0x23d9a5['count'];var _0xc3217f=_0x45b97b?0x0:_0x38efb7[_0x6ae1('0x1a')];var _0x590b32=_0x45b97b?_0x23d9a5[_0x6ae1('0x1d')]:_0x38efb7[_0x6ae1('0x1a')]+_0x38efb7[_0x6ae1('0x1c')];var _0x520b5d;if(_0x590b32>=_0x23ee00){_0x590b32=_0x23ee00;_0x520b5d=0xc8;}else{_0x520b5d=0xce;}_0x3f9054[_0x6ae1('0x17')](_0x520b5d);return _0x3f9054[_0x6ae1('0x1e')](_0x6ae1('0x1f'),_0xc3217f+'-'+_0x590b32+'/'+_0x23ee00)[_0x6ae1('0x19')](_0x23d9a5);}return null;};}function patchUpdates(_0x3e69b3){return function(_0x444fea){try{jsonpatch[_0x6ae1('0x20')](_0x444fea,_0x3e69b3,!![]);}catch(_0x5775fc){return BPromise[_0x6ae1('0x21')](_0x5775fc);}return _0x444fea[_0x6ae1('0x22')]();};}function saveUpdates(_0x458146,_0x3061af){return function(_0x4f1694){if(_0x4f1694){return _0x4f1694[_0x6ae1('0x23')](_0x458146)[_0x6ae1('0x24')](function(_0x55de53){return _0x55de53;});}return null;};}function removeEntity(_0x595c92,_0xb14d54){return function(_0x99e679){if(_0x99e679){return _0x99e679[_0x6ae1('0x25')]()[_0x6ae1('0x24')](function(){_0x595c92[_0x6ae1('0x17')](0xcc)[_0x6ae1('0x18')]();});}};}function handleEntityNotFound(_0x3fd4ba,_0x5f4ba1){return function(_0x3f80ce){if(!_0x3f80ce){_0x3fd4ba[_0x6ae1('0x16')](0x194);}return _0x3f80ce;};}function handleError(_0x37d4e2,_0x18e890){_0x18e890=_0x18e890||0x1f4;return function(_0x2031c4){logger[_0x6ae1('0x26')](_0x2031c4[_0x6ae1('0x27')]);if(_0x2031c4['name']){delete _0x2031c4['name'];}_0x37d4e2[_0x6ae1('0x17')](_0x18e890)[_0x6ae1('0x28')](_0x2031c4);};}exports[_0x6ae1('0x29')]=function(_0x35eca5,_0x586ae7){var _0x4db0c2={},_0x23211b={},_0x115568={'count':0x0,'rows':[]};var _0x2de9f1=_['map'](db[_0x6ae1('0x2a')][_0x6ae1('0x2b')],function(_0x47e032){return{'name':_0x47e032[_0x6ae1('0x2c')],'type':_0x47e032[_0x6ae1('0x2d')][_0x6ae1('0x2e')]};});_0x23211b[_0x6ae1('0x2f')]=_[_0x6ae1('0x30')](_0x2de9f1,_0x6ae1('0x31'));_0x23211b['query']=_[_0x6ae1('0x32')](_0x35eca5['query']);_0x23211b[_0x6ae1('0x33')]=_[_0x6ae1('0x34')](_0x23211b['model'],_0x23211b['query']);_0x4db0c2['attributes']=_['intersection'](_0x23211b[_0x6ae1('0x2f')],qs[_0x6ae1('0x35')](_0x35eca5[_0x6ae1('0x36')]['fields']));_0x4db0c2['attributes']=_0x4db0c2['attributes']['length']?_0x4db0c2[_0x6ae1('0x37')]:_0x23211b[_0x6ae1('0x2f')];if(!_0x35eca5['query']['hasOwnProperty'](_0x6ae1('0x38'))){_0x4db0c2[_0x6ae1('0x1c')]=qs['limit'](_0x35eca5[_0x6ae1('0x36')][_0x6ae1('0x1c')]);_0x4db0c2[_0x6ae1('0x1a')]=qs['offset'](_0x35eca5['query']['offset']);}_0x4db0c2[_0x6ae1('0x39')]=qs[_0x6ae1('0x3a')](_0x35eca5['query'][_0x6ae1('0x3a')]);_0x4db0c2[_0x6ae1('0x3b')]=qs[_0x6ae1('0x33')](_[_0x6ae1('0x3c')](_0x35eca5['query'],_0x23211b[_0x6ae1('0x33')]),_0x2de9f1);if(_0x35eca5[_0x6ae1('0x36')][_0x6ae1('0x3d')]){_0x4db0c2['where']=_['merge'](_0x4db0c2['where'],{'$or':_[_0x6ae1('0x30')](_0x2de9f1,function(_0x203fe1){if(_0x203fe1[_0x6ae1('0x2d')]!==_0x6ae1('0x3e')){var _0x514fef={};_0x514fef[_0x203fe1[_0x6ae1('0x31')]]={'$like':'%'+_0x35eca5[_0x6ae1('0x36')][_0x6ae1('0x3d')]+'%'};return _0x514fef;}})});}_0x4db0c2=_[_0x6ae1('0x3f')]({},_0x4db0c2,_0x35eca5[_0x6ae1('0x40')]);var _0x2698c0={'where':_0x4db0c2[_0x6ae1('0x3b')]};return db[_0x6ae1('0x2a')]['count'](_0x2698c0)[_0x6ae1('0x24')](function(_0x510153){_0x115568[_0x6ae1('0x1d')]=_0x510153;if(_0x35eca5[_0x6ae1('0x36')][_0x6ae1('0x41')]){_0x4db0c2['include']=[{'all':!![]}];}return db[_0x6ae1('0x2a')][_0x6ae1('0x42')](_0x4db0c2);})[_0x6ae1('0x24')](function(_0x225713){_0x115568[_0x6ae1('0x43')]=_0x225713;return _0x115568;})[_0x6ae1('0x24')](respondWithFilteredResult(_0x586ae7,_0x4db0c2))[_0x6ae1('0x44')](handleError(_0x586ae7,null));};exports['show']=function(_0x1f93c0,_0x4ac214){var _0x3e7cc7={'raw':!![],'where':{'id':_0x1f93c0[_0x6ae1('0x45')]['id']}},_0x32aec3={};_0x32aec3[_0x6ae1('0x2f')]=_['keys'](db[_0x6ae1('0x2a')][_0x6ae1('0x2b')]);_0x32aec3[_0x6ae1('0x36')]=_[_0x6ae1('0x32')](_0x1f93c0[_0x6ae1('0x36')]);_0x32aec3['filters']=_[_0x6ae1('0x34')](_0x32aec3['model'],_0x32aec3[_0x6ae1('0x36')]);_0x3e7cc7[_0x6ae1('0x37')]=_[_0x6ae1('0x34')](_0x32aec3[_0x6ae1('0x2f')],qs[_0x6ae1('0x35')](_0x1f93c0[_0x6ae1('0x36')][_0x6ae1('0x35')]));_0x3e7cc7[_0x6ae1('0x37')]=_0x3e7cc7[_0x6ae1('0x37')]['length']?_0x3e7cc7[_0x6ae1('0x37')]:_0x32aec3[_0x6ae1('0x2f')];if(_0x1f93c0['query']['includeAll']){_0x3e7cc7['include']=[{'all':!![]}];}_0x3e7cc7=_['merge']({},_0x3e7cc7,_0x1f93c0[_0x6ae1('0x40')]);return db[_0x6ae1('0x2a')][_0x6ae1('0x46')](_0x3e7cc7)['then'](handleEntityNotFound(_0x4ac214,null))[_0x6ae1('0x24')](respondWithResult(_0x4ac214,null))[_0x6ae1('0x44')](handleError(_0x4ac214,null));};exports[_0x6ae1('0x47')]=function(_0x5cd9ba,_0x43a6be){return db['VoiceDialReport'][_0x6ae1('0x47')](_0x5cd9ba[_0x6ae1('0x48')],{})[_0x6ae1('0x24')](respondWithResult(_0x43a6be,0xc9))[_0x6ae1('0x44')](handleError(_0x43a6be,null));};exports[_0x6ae1('0x23')]=function(_0x2ce8e7,_0x2fdd30){if(_0x2ce8e7[_0x6ae1('0x48')]['id']){delete _0x2ce8e7[_0x6ae1('0x48')]['id'];}return db[_0x6ae1('0x2a')][_0x6ae1('0x46')]({'where':{'id':_0x2ce8e7['params']['id']}})[_0x6ae1('0x24')](handleEntityNotFound(_0x2fdd30,null))[_0x6ae1('0x24')](saveUpdates(_0x2ce8e7[_0x6ae1('0x48')],null))[_0x6ae1('0x24')](respondWithResult(_0x2fdd30,null))['catch'](handleError(_0x2fdd30,null));};exports[_0x6ae1('0x25')]=function(_0x3fad4e,_0x595291){return db[_0x6ae1('0x2a')][_0x6ae1('0x46')]({'where':{'id':_0x3fad4e[_0x6ae1('0x45')]['id']}})[_0x6ae1('0x24')](handleEntityNotFound(_0x595291,null))[_0x6ae1('0x24')](removeEntity(_0x595291,null))['catch'](handleError(_0x595291,null));};exports[_0x6ae1('0x49')]=function(_0x51cfad,_0x4f0c21){return db[_0x6ae1('0x2a')]['describe']()[_0x6ae1('0x24')](respondWithResult(_0x4f0c21,null))['catch'](handleError(_0x4f0c21,null));}; \ No newline at end of file +var _0xf8b6=['include','findAll','catch','show','keys','create','body','params','find','describe','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','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','VoiceDialReport','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','options','includeAll'];(function(_0x5967e3,_0x33737e){var _0x11bec3=function(_0x6b51d4){while(--_0x6b51d4){_0x5967e3['push'](_0x5967e3['shift']());}};_0x11bec3(++_0x33737e);}(_0xf8b6,0xe8));var _0x6f8b=function(_0xca7b7f,_0x1e91f5){_0xca7b7f=_0xca7b7f-0x0;var _0x1fd57a=_0xf8b6[_0xca7b7f];return _0x1fd57a;};'use strict';var emlformat=require(_0x6f8b('0x0'));var rimraf=require(_0x6f8b('0x1'));var zipdir=require(_0x6f8b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6f8b('0x3'));var moment=require(_0x6f8b('0x4'));var BPromise=require(_0x6f8b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6f8b('0x6'));var sox=require(_0x6f8b('0x7'));var csv=require(_0x6f8b('0x8'));var ejs=require(_0x6f8b('0x9'));var fs=require('fs');var fs_extra=require(_0x6f8b('0xa'));var _=require('lodash');var squel=require(_0x6f8b('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6f8b('0xc'));var toCsv=require(_0x6f8b('0x8'));var querystring=require(_0x6f8b('0xd'));var Papa=require(_0x6f8b('0xe'));var Redis=require(_0x6f8b('0xf'));var authService=require(_0x6f8b('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f8b('0x11'));var logger=require('../../config/logger')(_0x6f8b('0x12'));var utils=require('../../config/utils');var config=require(_0x6f8b('0x13'));var licenseUtil=require(_0x6f8b('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4391a9,_0x1de286){_0x1de286=_0x1de286||0xcc;return function(_0x501df3){if(_0x501df3){return _0x4391a9[_0x6f8b('0x15')](_0x1de286);}return _0x4391a9[_0x6f8b('0x16')](_0x1de286)[_0x6f8b('0x17')]();};}function respondWithResult(_0xd0e40c,_0x438030){_0x438030=_0x438030||0xc8;return function(_0x4d22c7){if(_0x4d22c7){return _0xd0e40c['status'](_0x438030)[_0x6f8b('0x18')](_0x4d22c7);}};}function respondWithFilteredResult(_0x25235c,_0x5cbe5b){return function(_0x1db1a6){if(_0x1db1a6){var _0x58a258=typeof _0x5cbe5b[_0x6f8b('0x19')]===_0x6f8b('0x1a')&&typeof _0x5cbe5b[_0x6f8b('0x1b')]==='undefined';var _0x4360d6=_0x1db1a6[_0x6f8b('0x1c')];var _0x2f97d9=_0x58a258?0x0:_0x5cbe5b[_0x6f8b('0x19')];var _0x2dd3b0=_0x58a258?_0x1db1a6[_0x6f8b('0x1c')]:_0x5cbe5b[_0x6f8b('0x19')]+_0x5cbe5b[_0x6f8b('0x1b')];var _0xa0a460;if(_0x2dd3b0>=_0x4360d6){_0x2dd3b0=_0x4360d6;_0xa0a460=0xc8;}else{_0xa0a460=0xce;}_0x25235c[_0x6f8b('0x16')](_0xa0a460);return _0x25235c[_0x6f8b('0x1d')](_0x6f8b('0x1e'),_0x2f97d9+'-'+_0x2dd3b0+'/'+_0x4360d6)[_0x6f8b('0x18')](_0x1db1a6);}return null;};}function patchUpdates(_0x5061eb){return function(_0x268fb2){try{jsonpatch[_0x6f8b('0x1f')](_0x268fb2,_0x5061eb,!![]);}catch(_0x39edb6){return BPromise[_0x6f8b('0x20')](_0x39edb6);}return _0x268fb2[_0x6f8b('0x21')]();};}function saveUpdates(_0x175608,_0x42ed6){return function(_0x5129fa){if(_0x5129fa){return _0x5129fa[_0x6f8b('0x22')](_0x175608)[_0x6f8b('0x23')](function(_0x2ec1c5){return _0x2ec1c5;});}return null;};}function removeEntity(_0x5b6489,_0x1b578a){return function(_0x101a43){if(_0x101a43){return _0x101a43[_0x6f8b('0x24')]()[_0x6f8b('0x23')](function(){_0x5b6489[_0x6f8b('0x16')](0xcc)[_0x6f8b('0x17')]();});}};}function handleEntityNotFound(_0x5bfa42,_0x52af0c){return function(_0x453f38){if(!_0x453f38){_0x5bfa42[_0x6f8b('0x15')](0x194);}return _0x453f38;};}function handleError(_0x1080f2,_0x30c08d){_0x30c08d=_0x30c08d||0x1f4;return function(_0x4085df){logger[_0x6f8b('0x25')](_0x4085df['stack']);if(_0x4085df[_0x6f8b('0x26')]){delete _0x4085df[_0x6f8b('0x26')];}_0x1080f2[_0x6f8b('0x16')](_0x30c08d)[_0x6f8b('0x27')](_0x4085df);};}exports[_0x6f8b('0x28')]=function(_0x35ba73,_0x4d6dca){var _0x1242ce={},_0x3c1744={},_0x52be12={'count':0x0,'rows':[]};var _0xff6b00=_['map'](db[_0x6f8b('0x29')][_0x6f8b('0x2a')],function(_0x31c919){return{'name':_0x31c919[_0x6f8b('0x2b')],'type':_0x31c919['type'][_0x6f8b('0x2c')]};});_0x3c1744[_0x6f8b('0x2d')]=_['map'](_0xff6b00,_0x6f8b('0x26'));_0x3c1744[_0x6f8b('0x2e')]=_['keys'](_0x35ba73[_0x6f8b('0x2e')]);_0x3c1744[_0x6f8b('0x2f')]=_['intersection'](_0x3c1744[_0x6f8b('0x2d')],_0x3c1744[_0x6f8b('0x2e')]);_0x1242ce['attributes']=_[_0x6f8b('0x30')](_0x3c1744[_0x6f8b('0x2d')],qs[_0x6f8b('0x31')](_0x35ba73[_0x6f8b('0x2e')][_0x6f8b('0x31')]));_0x1242ce[_0x6f8b('0x32')]=_0x1242ce[_0x6f8b('0x32')][_0x6f8b('0x33')]?_0x1242ce[_0x6f8b('0x32')]:_0x3c1744[_0x6f8b('0x2d')];if(!_0x35ba73['query'][_0x6f8b('0x34')](_0x6f8b('0x35'))){_0x1242ce[_0x6f8b('0x1b')]=qs[_0x6f8b('0x1b')](_0x35ba73[_0x6f8b('0x2e')][_0x6f8b('0x1b')]);_0x1242ce[_0x6f8b('0x19')]=qs['offset'](_0x35ba73[_0x6f8b('0x2e')][_0x6f8b('0x19')]);}_0x1242ce[_0x6f8b('0x36')]=qs[_0x6f8b('0x37')](_0x35ba73[_0x6f8b('0x2e')][_0x6f8b('0x37')]);_0x1242ce[_0x6f8b('0x38')]=qs[_0x6f8b('0x2f')](_[_0x6f8b('0x39')](_0x35ba73[_0x6f8b('0x2e')],_0x3c1744[_0x6f8b('0x2f')]),_0xff6b00);if(_0x35ba73['query'][_0x6f8b('0x3a')]){_0x1242ce[_0x6f8b('0x38')]=_[_0x6f8b('0x3b')](_0x1242ce[_0x6f8b('0x38')],{'$or':_[_0x6f8b('0x3c')](_0xff6b00,function(_0xb30de3){if(_0xb30de3[_0x6f8b('0x3d')]!=='VIRTUAL'){var _0x2d35cc={};_0x2d35cc[_0xb30de3[_0x6f8b('0x26')]]={'$like':'%'+_0x35ba73[_0x6f8b('0x2e')][_0x6f8b('0x3a')]+'%'};return _0x2d35cc;}})});}_0x1242ce=_['merge']({},_0x1242ce,_0x35ba73[_0x6f8b('0x3e')]);var _0x42c535={'where':_0x1242ce[_0x6f8b('0x38')]};return db[_0x6f8b('0x29')]['count'](_0x42c535)[_0x6f8b('0x23')](function(_0x20df19){_0x52be12[_0x6f8b('0x1c')]=_0x20df19;if(_0x35ba73[_0x6f8b('0x2e')][_0x6f8b('0x3f')]){_0x1242ce[_0x6f8b('0x40')]=[{'all':!![]}];}return db[_0x6f8b('0x29')][_0x6f8b('0x41')](_0x1242ce);})['then'](function(_0x2729ac){_0x52be12['rows']=_0x2729ac;return _0x52be12;})[_0x6f8b('0x23')](respondWithFilteredResult(_0x4d6dca,_0x1242ce))[_0x6f8b('0x42')](handleError(_0x4d6dca,null));};exports[_0x6f8b('0x43')]=function(_0x1294e6,_0x495559){var _0x41fd32={'raw':!![],'where':{'id':_0x1294e6['params']['id']}},_0x2fad30={};_0x2fad30[_0x6f8b('0x2d')]=_[_0x6f8b('0x44')](db[_0x6f8b('0x29')][_0x6f8b('0x2a')]);_0x2fad30['query']=_[_0x6f8b('0x44')](_0x1294e6[_0x6f8b('0x2e')]);_0x2fad30[_0x6f8b('0x2f')]=_[_0x6f8b('0x30')](_0x2fad30[_0x6f8b('0x2d')],_0x2fad30[_0x6f8b('0x2e')]);_0x41fd32[_0x6f8b('0x32')]=_['intersection'](_0x2fad30[_0x6f8b('0x2d')],qs[_0x6f8b('0x31')](_0x1294e6[_0x6f8b('0x2e')][_0x6f8b('0x31')]));_0x41fd32['attributes']=_0x41fd32[_0x6f8b('0x32')]['length']?_0x41fd32[_0x6f8b('0x32')]:_0x2fad30['model'];if(_0x1294e6['query'][_0x6f8b('0x3f')]){_0x41fd32['include']=[{'all':!![]}];}_0x41fd32=_[_0x6f8b('0x3b')]({},_0x41fd32,_0x1294e6[_0x6f8b('0x3e')]);return db[_0x6f8b('0x29')]['find'](_0x41fd32)[_0x6f8b('0x23')](handleEntityNotFound(_0x495559,null))[_0x6f8b('0x23')](respondWithResult(_0x495559,null))[_0x6f8b('0x42')](handleError(_0x495559,null));};exports[_0x6f8b('0x45')]=function(_0x3f4795,_0x4de664){return db['VoiceDialReport'][_0x6f8b('0x45')](_0x3f4795[_0x6f8b('0x46')],{})[_0x6f8b('0x23')](respondWithResult(_0x4de664,0xc9))[_0x6f8b('0x42')](handleError(_0x4de664,null));};exports[_0x6f8b('0x22')]=function(_0x3f5c54,_0x37f80b){if(_0x3f5c54[_0x6f8b('0x46')]['id']){delete _0x3f5c54[_0x6f8b('0x46')]['id'];}return db[_0x6f8b('0x29')]['find']({'where':{'id':_0x3f5c54[_0x6f8b('0x47')]['id']}})[_0x6f8b('0x23')](handleEntityNotFound(_0x37f80b,null))[_0x6f8b('0x23')](saveUpdates(_0x3f5c54[_0x6f8b('0x46')],null))[_0x6f8b('0x23')](respondWithResult(_0x37f80b,null))[_0x6f8b('0x42')](handleError(_0x37f80b,null));};exports[_0x6f8b('0x24')]=function(_0x4980a7,_0x1a54c1){return db[_0x6f8b('0x29')][_0x6f8b('0x48')]({'where':{'id':_0x4980a7['params']['id']}})[_0x6f8b('0x23')](handleEntityNotFound(_0x1a54c1,null))[_0x6f8b('0x23')](removeEntity(_0x1a54c1,null))['catch'](handleError(_0x1a54c1,null));};exports[_0x6f8b('0x49')]=function(_0x35c457,_0x1852e6){return db[_0x6f8b('0x29')][_0x6f8b('0x49')]()['then'](respondWithResult(_0x1852e6,null))[_0x6f8b('0x42')](handleError(_0x1852e6,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 2c7a3b3..a062cf4 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 _0xf541=['../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xf541,0x1f4));var _0x1f54=function(_0x44268d,_0xad8443){_0x44268d=_0x44268d-0x0;var _0x4be92d=_0xf541[_0x44268d];return _0x4be92d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1f54('0x0'))('api');var moment=require(_0x1f54('0x1'));var BPromise=require(_0x1f54('0x2'));var rp=require(_0x1f54('0x3'));var fs=require('fs');var path=require(_0x1f54('0x4'));var rimraf=require(_0x1f54('0x5'));var config=require(_0x1f54('0x6'));var attributes=require(_0x1f54('0x7'));module[_0x1f54('0x8')]=function(_0x538b5f,_0x3d1766){return _0x538b5f[_0x1f54('0x9')](_0x1f54('0xa'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc30e=['exports','define','VoiceDialReport','report_dial','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceDialReport.attributes'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xc30e,0x1d8));var _0xec30=function(_0x8f1b87,_0x5c358f){_0x8f1b87=_0x8f1b87-0x0;var _0x4c1d98=_0xc30e[_0x8f1b87];return _0x4c1d98;};'use strict';var _=require(_0xec30('0x0'));var util=require('util');var logger=require(_0xec30('0x1'))(_0xec30('0x2'));var moment=require(_0xec30('0x3'));var BPromise=require(_0xec30('0x4'));var rp=require(_0xec30('0x5'));var fs=require('fs');var path=require(_0xec30('0x6'));var rimraf=require(_0xec30('0x7'));var config=require('../../config/environment');var attributes=require(_0xec30('0x8'));module[_0xec30('0x9')]=function(_0x8c3e25,_0x58fa6e){return _0x8c3e25[_0xec30('0xa')](_0xec30('0xb'),attributes,{'tableName':_0xec30('0xc'),'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 7f3d362..60dbbc9 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 _0x0992=['CreateVoiceDialReport','VoiceDialReport','create','options','then','stringify','UpdateVoiceDialReport','update','body','raw','where','attributes','limit','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x0992,0x1ba));var _0x2099=function(_0x47adb8,_0x591ccc){_0x47adb8=_0x47adb8-0x0;var _0x4689a8=_0x0992[_0x47adb8];return _0x4689a8;};'use strict';var _=require('lodash');var util=require(_0x2099('0x0'));var moment=require(_0x2099('0x1'));var BPromise=require('bluebird');var rs=require(_0x2099('0x2'));var fs=require('fs');var Redis=require(_0x2099('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2099('0x4'));var logger=require(_0x2099('0x5'))(_0x2099('0x6'));var config=require(_0x2099('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2099('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16945,_0x57c09d,_0x1c3d79){return new BPromise(function(_0x583797,_0x11ffc2){return client[_0x2099('0x9')](_0x16945,_0x1c3d79)['then'](function(_0x2d5975){logger[_0x2099('0xa')](_0x2099('0xb'),_0x57c09d,'request\x20sent');logger[_0x2099('0xc')](_0x2099('0xd'),_0x57c09d,_0x2099('0xe'),JSON['stringify'](_0x2d5975));if(_0x2d5975[_0x2099('0xf')]){if(_0x2d5975['error'][_0x2099('0x10')]===0x1f4){logger[_0x2099('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x57c09d,_0x2d5975[_0x2099('0xf')][_0x2099('0x11')]);return _0x11ffc2(_0x2d5975['error'][_0x2099('0x11')]);}logger[_0x2099('0xf')](_0x2099('0xb'),_0x57c09d,_0x2d5975['error']['message']);return _0x583797(_0x2d5975['error'][_0x2099('0x11')]);}else{logger['info'](_0x2099('0xb'),_0x57c09d,_0x2099('0xe'));_0x583797(_0x2d5975[_0x2099('0x12')][_0x2099('0x11')]);}})[_0x2099('0x13')](function(_0x2d2c91){logger[_0x2099('0xf')](_0x2099('0xb'),_0x57c09d,_0x2d2c91);_0x11ffc2(_0x2d2c91);});});}exports[_0x2099('0x14')]=function(_0x41a1d0){var _0xcabf26=this;return new Promise(function(_0xb01af9,_0x4fbf30){return db[_0x2099('0x15')][_0x2099('0x16')](_0x41a1d0['body'],{'raw':_0x41a1d0[_0x2099('0x17')]?_0x41a1d0[_0x2099('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x2099('0x18')](function(_0x13ec63){logger[_0x2099('0xa')](_0x2099('0x14'),_0x41a1d0);logger[_0x2099('0xc')](_0x2099('0x14'),_0x41a1d0,JSON[_0x2099('0x19')](_0x13ec63));_0xb01af9(_0x13ec63);})[_0x2099('0x13')](function(_0x3667d3){logger['error'](_0x2099('0x14'),_0x3667d3[_0x2099('0x11')],_0x41a1d0);_0x4fbf30(_0xcabf26[_0x2099('0xf')](0x1f4,_0x3667d3[_0x2099('0x11')]));});});};exports[_0x2099('0x1a')]=function(_0x560394){var _0x3e8b56=this;return new Promise(function(_0x1d1541,_0x347618){return db[_0x2099('0x15')][_0x2099('0x1b')](_0x560394[_0x2099('0x1c')],{'raw':_0x560394[_0x2099('0x17')]?_0x560394['options'][_0x2099('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x560394[_0x2099('0x17')]?_0x560394[_0x2099('0x17')][_0x2099('0x1e')]||null:null,'attributes':_0x560394[_0x2099('0x17')]?_0x560394[_0x2099('0x17')][_0x2099('0x1f')]||null:null,'limit':_0x560394[_0x2099('0x17')]?_0x560394[_0x2099('0x17')][_0x2099('0x20')]||null:null})[_0x2099('0x18')](function(_0x50115f){logger[_0x2099('0xa')](_0x2099('0x1a'),_0x560394);logger[_0x2099('0xc')](_0x2099('0x1a'),_0x560394,JSON[_0x2099('0x19')](_0x50115f));_0x1d1541(_0x50115f);})[_0x2099('0x13')](function(_0x49be14){logger[_0x2099('0xf')](_0x2099('0x1a'),_0x49be14[_0x2099('0x11')],_0x560394);_0x347618(_0x3e8b56[_0x2099('0xf')](0x1f4,_0x49be14[_0x2099('0x11')]));});});}; \ No newline at end of file +var _0x0f2a=['VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateVoiceDialReport','VoiceDialReport','body','options','UpdateVoiceDialReport','update','raw','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0f2a,0x1e1));var _0xa0f2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0f2a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xa0f2('0x0'));var util=require('util');var moment=require(_0xa0f2('0x1'));var BPromise=require(_0xa0f2('0x2'));var rs=require(_0xa0f2('0x3'));var fs=require('fs');var Redis=require(_0xa0f2('0x4'));var db=require(_0xa0f2('0x5'))['db'];var utils=require(_0xa0f2('0x6'));var logger=require(_0xa0f2('0x7'))(_0xa0f2('0x8'));var config=require(_0xa0f2('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa0f2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1bcd8a,_0x319e70,_0x1086a7){return new BPromise(function(_0x4cf9f3,_0xb1099e){return client[_0xa0f2('0xb')](_0x1bcd8a,_0x1086a7)[_0xa0f2('0xc')](function(_0x561a75){logger[_0xa0f2('0xd')](_0xa0f2('0xe'),_0x319e70,_0xa0f2('0xf'));logger[_0xa0f2('0x10')](_0xa0f2('0x11'),_0x319e70,_0xa0f2('0xf'),JSON[_0xa0f2('0x12')](_0x561a75));if(_0x561a75[_0xa0f2('0x13')]){if(_0x561a75[_0xa0f2('0x13')]['code']===0x1f4){logger[_0xa0f2('0x13')]('VoiceDialReport,\x20%s,\x20%s',_0x319e70,_0x561a75['error'][_0xa0f2('0x14')]);return _0xb1099e(_0x561a75[_0xa0f2('0x13')][_0xa0f2('0x14')]);}logger[_0xa0f2('0x13')](_0xa0f2('0xe'),_0x319e70,_0x561a75[_0xa0f2('0x13')]['message']);return _0x4cf9f3(_0x561a75[_0xa0f2('0x13')][_0xa0f2('0x14')]);}else{logger[_0xa0f2('0xd')](_0xa0f2('0xe'),_0x319e70,'request\x20sent');_0x4cf9f3(_0x561a75[_0xa0f2('0x15')][_0xa0f2('0x14')]);}})[_0xa0f2('0x16')](function(_0x4581a1){logger['error'](_0xa0f2('0xe'),_0x319e70,_0x4581a1);_0xb1099e(_0x4581a1);});});}exports[_0xa0f2('0x17')]=function(_0x9b81ae){var _0x148fad=this;return new Promise(function(_0x35e6a4,_0x9d28c4){return db[_0xa0f2('0x18')]['create'](_0x9b81ae[_0xa0f2('0x19')],{'raw':_0x9b81ae[_0xa0f2('0x1a')]?_0x9b81ae[_0xa0f2('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4427a4){logger[_0xa0f2('0xd')](_0xa0f2('0x17'),_0x9b81ae);logger['debug']('CreateVoiceDialReport',_0x9b81ae,JSON[_0xa0f2('0x12')](_0x4427a4));_0x35e6a4(_0x4427a4);})[_0xa0f2('0x16')](function(_0x3e37ae){logger[_0xa0f2('0x13')](_0xa0f2('0x17'),_0x3e37ae[_0xa0f2('0x14')],_0x9b81ae);_0x9d28c4(_0x148fad['error'](0x1f4,_0x3e37ae['message']));});});};exports[_0xa0f2('0x1b')]=function(_0x176679){var _0x3e38ad=this;return new Promise(function(_0x3c64ab,_0x142981){return db[_0xa0f2('0x18')][_0xa0f2('0x1c')](_0x176679[_0xa0f2('0x19')],{'raw':_0x176679[_0xa0f2('0x1a')]?_0x176679[_0xa0f2('0x1a')][_0xa0f2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x176679['options']?_0x176679['options'][_0xa0f2('0x1e')]||null:null,'attributes':_0x176679[_0xa0f2('0x1a')]?_0x176679[_0xa0f2('0x1a')][_0xa0f2('0x1f')]||null:null,'limit':_0x176679[_0xa0f2('0x1a')]?_0x176679['options'][_0xa0f2('0x20')]||null:null})[_0xa0f2('0xc')](function(_0x5799fa){logger['info'](_0xa0f2('0x1b'),_0x176679);logger[_0xa0f2('0x10')](_0xa0f2('0x1b'),_0x176679,JSON[_0xa0f2('0x12')](_0x5799fa));_0x3c64ab(_0x5799fa);})[_0xa0f2('0x16')](function(_0x42217d){logger['error'](_0xa0f2('0x1b'),_0x42217d[_0xa0f2('0x14')],_0x176679);_0x142981(_0x3e38ad[_0xa0f2('0x13')](0x1f4,_0x42217d[_0xa0f2('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index deacf74..774f4ba 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 _0xb292=['/:id','show','post','create','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index'];(function(_0x2382a0,_0x29c440){var _0x1308dc=function(_0x41b07b){while(--_0x41b07b){_0x2382a0['push'](_0x2382a0['shift']());}};_0x1308dc(++_0x29c440);}(_0xb292,0x149));var _0x2b29=function(_0x327b51,_0x4a20bd){_0x327b51=_0x327b51-0x0;var _0x1b6be1=_0xb292[_0x327b51];return _0x1b6be1;};'use strict';var multer=require(_0x2b29('0x0'));var util=require(_0x2b29('0x1'));var path=require(_0x2b29('0x2'));var timeout=require(_0x2b29('0x3'));var express=require(_0x2b29('0x4'));var router=express[_0x2b29('0x5')]();var fs_extra=require(_0x2b29('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2b29('0x7'));var config=require(_0x2b29('0x8'));var controller=require(_0x2b29('0x9'));router[_0x2b29('0xa')]('/',auth[_0x2b29('0xb')](),controller[_0x2b29('0xc')]);router[_0x2b29('0xa')](_0x2b29('0xd'),auth[_0x2b29('0xb')](),controller[_0x2b29('0xe')]);router[_0x2b29('0xf')]('/',auth[_0x2b29('0xb')](),controller[_0x2b29('0x10')]);router['post']('/:id/applications',auth[_0x2b29('0xb')](),controller['addApplications']);router['put'](_0x2b29('0xd'),auth[_0x2b29('0xb')](),controller[_0x2b29('0x11')]);router[_0x2b29('0x12')](_0x2b29('0xd'),auth[_0x2b29('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd8d2=['addApplications','put','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../config/environment','isAuthenticated','index','/:id','show','create','post','/:id/applications'];(function(_0xaaf2e2,_0x19d28a){var _0x28bc36=function(_0x53bdb5){while(--_0x53bdb5){_0xaaf2e2['push'](_0xaaf2e2['shift']());}};_0x28bc36(++_0x19d28a);}(_0xd8d2,0x15c));var _0x2d8d=function(_0x29a1d6,_0x3fdc36){_0x29a1d6=_0x29a1d6-0x0;var _0x979ba2=_0xd8d2[_0x29a1d6];return _0x979ba2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2d8d('0x0'));var timeout=require(_0x2d8d('0x1'));var express=require('express');var router=express[_0x2d8d('0x2')]();var fs_extra=require(_0x2d8d('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2d8d('0x4'));var controller=require('./voiceExtension.controller');router['get']('/',auth[_0x2d8d('0x5')](),controller[_0x2d8d('0x6')]);router['get'](_0x2d8d('0x7'),auth[_0x2d8d('0x5')](),controller[_0x2d8d('0x8')]);router['post']('/',auth[_0x2d8d('0x5')](),controller[_0x2d8d('0x9')]);router[_0x2d8d('0xa')](_0x2d8d('0xb'),auth['isAuthenticated'](),controller[_0x2d8d('0xc')]);router[_0x2d8d('0xd')](_0x2d8d('0x7'),auth['isAuthenticated'](),controller[_0x2d8d('0xe')]);router[_0x2d8d('0xf')](_0x2d8d('0x7'),auth[_0x2d8d('0x5')](),controller[_0x2d8d('0x10')]);module[_0x2d8d('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index cde6225..667850b 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 _0xdaa3=['VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','ENUM','inbound','internal','inbound-fax','system','any','INTEGER','wav'];(function(_0x331fde,_0x6c962){var _0x3b6855=function(_0x207bdd){while(--_0x207bdd){_0x331fde['push'](_0x331fde['shift']());}};_0x3b6855(++_0x6c962);}(_0xdaa3,0xe4));var _0x3daa=function(_0x1e076c,_0x36176a){_0x1e076c=_0x1e076c-0x0;var _0x1b583a=_0xdaa3[_0x1e076c];return _0x1b583a;};'use strict';var Sequelize=require(_0x3daa('0x0'));module[_0x3daa('0x1')]={'context':{'type':Sequelize[_0x3daa('0x2')],'allowNull':![],'unique':_0x3daa('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x3daa('0x2')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x3daa('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x3daa('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x3daa('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x3daa('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x3daa('0x4')](_0x3daa('0x5'),'outbound',_0x3daa('0x6'),_0x3daa('0x7'),'outbound-fax',_0x3daa('0x8'),_0x3daa('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x3daa('0x2')]},'interval':{'type':Sequelize[_0x3daa('0x2')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x3daa('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x3daa('0xa')]},'recordingFormat':{'type':Sequelize[_0x3daa('0x2')],'defaultValue':_0x3daa('0xb')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x3daa('0xc')],'get':function(_0x4dcff5){return this[_0x3daa('0xd')](_0x3daa('0xe'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xdef8=['wav','VIRTUAL','getDataValue','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','internal','inbound-fax','outbound-fax','system','any','INTEGER','BOOLEAN'];(function(_0x39f9d8,_0x14be62){var _0x58b727=function(_0x178a2c){while(--_0x178a2c){_0x39f9d8['push'](_0x39f9d8['shift']());}};_0x58b727(++_0x14be62);}(_0xdef8,0x133));var _0x8def=function(_0x432762,_0x11184d){_0x432762=_0x432762-0x0;var _0x281cbe=_0xdef8[_0x432762];return _0x281cbe;};'use strict';var Sequelize=require(_0x8def('0x0'));module[_0x8def('0x1')]={'context':{'type':Sequelize[_0x8def('0x2')],'allowNull':![],'unique':_0x8def('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x8def('0x2')],'allowNull':![],'unique':_0x8def('0x3')},'priority':{'type':Sequelize[_0x8def('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x8def('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8def('0x4')},'appdata':{'type':Sequelize[_0x8def('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x8def('0x5')]('inbound','outbound',_0x8def('0x6'),_0x8def('0x7'),_0x8def('0x8'),_0x8def('0x9'),_0x8def('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x8def('0x2')]},'interval':{'type':Sequelize[_0x8def('0x2')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0x8def('0xb')]},'isApp':{'type':Sequelize[_0x8def('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x8def('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x8def('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0x8def('0x2')],'defaultValue':_0x8def('0xd')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x8def('0xe')],'get':function(_0xea7e34){return this[_0x8def('0xf')]('exten');}},'alias':{'type':Sequelize[_0x8def('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index eb7b4ce..41d54f8 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 _0xb4b0=['addApplications','transaction','sequelize','Transaction','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','localhost','./voiceExtension.socket','register','status','end','undefined','limit','offset','count','json','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','ignore','map','includes','find','value','UserProfileResource','sendStatus','stack','name','send','index','VoiceExtension','rawAttributes','fieldName','type','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','catch','body','startsWith','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','description','recordingFormat','mandatoryDisposition'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xb4b0,0xbc));var _0x0b4b=function(_0x24b156,_0x6e3d6){_0x24b156=_0x24b156-0x0;var _0x1fa205=_0xb4b0[_0x24b156];return _0x1fa205;};'use strict';var _=require('lodash');var Redis=require(_0x0b4b('0x0'));var qs=require(_0x0b4b('0x1'));var logger=require('../../config/logger')(_0x0b4b('0x2'));var config=require(_0x0b4b('0x3'));var db=require('../../mysqldb')['db'];config[_0x0b4b('0x4')]=_[_0x0b4b('0x5')](config[_0x0b4b('0x4')],{'host':_0x0b4b('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0b4b('0x7'))[_0x0b4b('0x8')](socket);function respondWithStatusCode(_0x14144b,_0x536187){_0x536187=_0x536187||0xcc;return function(_0xb9acd5){if(_0xb9acd5){return _0x14144b['sendStatus'](_0x536187);}return _0x14144b[_0x0b4b('0x9')](_0x536187)[_0x0b4b('0xa')]();};}function respondWithResult(_0x21736b,_0x31f7cc){_0x31f7cc=_0x31f7cc||0xc8;return function(_0xb6c465){if(_0xb6c465){return _0x21736b['status'](_0x31f7cc)['json'](_0xb6c465);}};}function respondWithFilteredResult(_0x1c28fe,_0x569a91){return function(_0x5a88ff){if(_0x5a88ff){var _0x418309=typeof _0x569a91['offset']===_0x0b4b('0xb')&&typeof _0x569a91[_0x0b4b('0xc')]===_0x0b4b('0xb');var _0x4074b1=_0x5a88ff['count'];var _0x550125=_0x418309?0x0:_0x569a91[_0x0b4b('0xd')];var _0x145b79=_0x418309?_0x5a88ff[_0x0b4b('0xe')]:_0x569a91[_0x0b4b('0xd')]+_0x569a91[_0x0b4b('0xc')];var _0x13ce3e;if(_0x145b79>=_0x4074b1){_0x145b79=_0x4074b1;_0x13ce3e=0xc8;}else{_0x13ce3e=0xce;}_0x1c28fe[_0x0b4b('0x9')](_0x13ce3e);return _0x1c28fe['set']('Content-Range',_0x550125+'-'+_0x145b79+'/'+_0x4074b1)[_0x0b4b('0xf')](_0x5a88ff);}return null;};}function removeEntity(_0x56bdb9){return function(_0x28fda7){if(_0x28fda7){return _0x28fda7[_0x0b4b('0x10')]()[_0x0b4b('0x11')](function(){var _0x132871=_0x28fda7[_0x0b4b('0x12')]({'plain':!![]});var _0x2ad73c=[{'name':_0x0b4b('0x13'),'value':_0x0b4b('0x14'),'ignore':![]},{'name':_0x0b4b('0x15'),'value':_0x0b4b('0x16'),'ignore':![]},{'name':_0x0b4b('0x17'),'value':_0x0b4b('0x18'),'ignore':![]}];var _0x5164fc=_(_0x2ad73c)['filter'](_0x0b4b('0x19'))[_0x0b4b('0x1a')]('value')['value']();if(_[_0x0b4b('0x1b')](_0x5164fc,_0x132871['type'])){return;}var _0x16c0ee=_[_0x0b4b('0x1c')](_0x2ad73c,[_0x0b4b('0x1d'),_0x132871['type']])['name'];return db[_0x0b4b('0x1e')][_0x0b4b('0x10')]({'where':{'type':_0x16c0ee,'resourceId':_0x132871['id']}})['then'](function(){return _0x28fda7;});})['then'](function(){_0x56bdb9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x203377){return function(_0x1549af){if(!_0x1549af){_0x203377[_0x0b4b('0x1f')](0x194);}return _0x1549af;};}function handleError(_0x36e702,_0x268d7e){_0x268d7e=_0x268d7e||0x1f4;return function(_0x1d93e4){logger['error'](_0x1d93e4[_0x0b4b('0x20')]);if(_0x1d93e4[_0x0b4b('0x21')]){delete _0x1d93e4['name'];}_0x36e702[_0x0b4b('0x9')](_0x268d7e)[_0x0b4b('0x22')](_0x1d93e4);};}exports[_0x0b4b('0x23')]=function(_0x2887ad,_0x479b3f){var _0x454066={},_0xae566a={},_0x5a1282={'count':0x0,'rows':[]};var _0x1e9aee=_['map'](db[_0x0b4b('0x24')][_0x0b4b('0x25')],function(_0x4954ec){return{'name':_0x4954ec[_0x0b4b('0x26')],'type':_0x4954ec[_0x0b4b('0x27')]['key']};});_0xae566a[_0x0b4b('0x28')]=_[_0x0b4b('0x1a')](_0x1e9aee,'name');_0xae566a['query']=_[_0x0b4b('0x29')](_0x2887ad[_0x0b4b('0x2a')]);_0xae566a['filters']=_['intersection'](_0xae566a[_0x0b4b('0x28')],_0xae566a[_0x0b4b('0x2a')]);_0x454066[_0x0b4b('0x2b')]=_[_0x0b4b('0x2c')](_0xae566a[_0x0b4b('0x28')],qs[_0x0b4b('0x2d')](_0x2887ad[_0x0b4b('0x2a')][_0x0b4b('0x2d')]));_0x454066[_0x0b4b('0x2b')]=_0x454066[_0x0b4b('0x2b')][_0x0b4b('0x2e')]?_0x454066[_0x0b4b('0x2b')]:_0xae566a[_0x0b4b('0x28')];if(!_0x2887ad[_0x0b4b('0x2a')][_0x0b4b('0x2f')](_0x0b4b('0x30'))){_0x454066['limit']=qs[_0x0b4b('0xc')](_0x2887ad['query'][_0x0b4b('0xc')]);_0x454066['offset']=qs['offset'](_0x2887ad[_0x0b4b('0x2a')]['offset']);}_0x454066[_0x0b4b('0x31')]=qs['sort'](_0x2887ad[_0x0b4b('0x2a')][_0x0b4b('0x32')]);_0x454066[_0x0b4b('0x33')]=qs[_0x0b4b('0x34')](_['pick'](_0x2887ad['query'],_0xae566a[_0x0b4b('0x34')]),_0x1e9aee);if(_0x2887ad[_0x0b4b('0x2a')][_0x0b4b('0x35')]){_0x454066['where']=_['merge'](_0x454066[_0x0b4b('0x33')],{'$or':_[_0x0b4b('0x1a')](_0x1e9aee,function(_0x70237b){if(_0x70237b['type']!==_0x0b4b('0x36')){var _0x5e79f1={};_0x5e79f1[_0x70237b[_0x0b4b('0x21')]]={'$like':'%'+_0x2887ad[_0x0b4b('0x2a')][_0x0b4b('0x35')]+'%'};return _0x5e79f1;}})});}_0x454066=_[_0x0b4b('0x37')]({},_0x454066,_0x2887ad[_0x0b4b('0x38')]);var _0x32bde5={'where':_0x454066[_0x0b4b('0x33')]};return db[_0x0b4b('0x24')]['count'](_0x32bde5)[_0x0b4b('0x11')](function(_0x225f20){_0x5a1282['count']=_0x225f20;if(_0x2887ad[_0x0b4b('0x2a')][_0x0b4b('0x39')]){_0x454066[_0x0b4b('0x3a')]=[{'all':!![]}];}return db['VoiceExtension'][_0x0b4b('0x3b')](_0x454066);})[_0x0b4b('0x11')](function(_0x570515){_0x5a1282[_0x0b4b('0x3c')]=_0x570515;return _0x5a1282;})[_0x0b4b('0x11')](respondWithFilteredResult(_0x479b3f,_0x454066))['catch'](handleError(_0x479b3f,null));};exports[_0x0b4b('0x3d')]=function(_0x45a61e,_0x77434c){var _0x15fbe3={'raw':![],'where':{'id':_0x45a61e[_0x0b4b('0x3e')]['id']}},_0x4251b8={};_0x4251b8[_0x0b4b('0x28')]=_[_0x0b4b('0x29')](db[_0x0b4b('0x24')][_0x0b4b('0x25')]);_0x4251b8[_0x0b4b('0x2a')]=_[_0x0b4b('0x29')](_0x45a61e['query']);_0x4251b8[_0x0b4b('0x34')]=_[_0x0b4b('0x2c')](_0x4251b8[_0x0b4b('0x28')],_0x4251b8['query']);_0x15fbe3[_0x0b4b('0x2b')]=_[_0x0b4b('0x2c')](_0x4251b8[_0x0b4b('0x28')],qs[_0x0b4b('0x2d')](_0x45a61e['query']['fields']));_0x15fbe3['attributes']=_0x15fbe3[_0x0b4b('0x2b')]['length']?_0x15fbe3['attributes']:_0x4251b8[_0x0b4b('0x28')];if(_0x45a61e['query']['includeAll']){_0x15fbe3['include']=[{'all':!![]}];}_0x15fbe3=_['merge']({},_0x15fbe3,_0x45a61e[_0x0b4b('0x38')]);return db[_0x0b4b('0x24')][_0x0b4b('0x1c')](_0x15fbe3)[_0x0b4b('0x11')](handleEntityNotFound(_0x77434c,null))[_0x0b4b('0x11')](respondWithResult(_0x77434c,null))[_0x0b4b('0x3f')](handleError(_0x77434c,null));};exports['destroy']=function(_0x8f864e,_0x391de5){return db[_0x0b4b('0x24')][_0x0b4b('0x1c')]({'where':{'id':_0x8f864e[_0x0b4b('0x3e')]['id']}})[_0x0b4b('0x11')](handleEntityNotFound(_0x391de5,null))[_0x0b4b('0x11')](removeEntity(_0x391de5,null))[_0x0b4b('0x3f')](handleError(_0x391de5,null));};exports['create']=function(_0x4e5df5,_0x44e1d5){if(_0x4e5df5[_0x0b4b('0x40')][_0x0b4b('0x27')]===_0x0b4b('0x16')&&!_[_0x0b4b('0x41')](_0x4e5df5[_0x0b4b('0x40')]['exten'],'_')){_0x4e5df5[_0x0b4b('0x40')][_0x0b4b('0x42')]='_'['concat'](_0x4e5df5[_0x0b4b('0x40')][_0x0b4b('0x42')]);}return db[_0x0b4b('0x24')]['create'](_0x4e5df5['body'],{'raw':![]})[_0x0b4b('0x11')](function(_0x23fb40){var _0x42737e=_0x4e5df5[_0x0b4b('0x43')]['get']({'plain':!![]});if(!_0x42737e)throw new Error(_0x0b4b('0x44'));if(_0x42737e[_0x0b4b('0x45')]===_0x0b4b('0x43')){var _0x396da6=_0x23fb40[_0x0b4b('0x12')]({'plain':!![]});var _0xb47575=[{'name':'InboundRoutes','value':_0x0b4b('0x14')},{'name':_0x0b4b('0x15'),'value':_0x0b4b('0x16')},{'name':'InternalRoutes','value':_0x0b4b('0x18')}];var _0x3ceeaf=_[_0x0b4b('0x1c')](_0xb47575,[_0x0b4b('0x1d'),_0x396da6['type']])[_0x0b4b('0x21')];return db['UserProfileSection']['find']({'where':{'name':_0x3ceeaf,'userProfileId':_0x42737e[_0x0b4b('0x46')]},'raw':!![]})[_0x0b4b('0x11')](function(_0x2c61fd){if(_0x2c61fd&&_0x2c61fd[_0x0b4b('0x47')]===0x0){return db[_0x0b4b('0x1e')]['create']({'name':_0x396da6[_0x0b4b('0x21')],'resourceId':_0x396da6['id'],'type':_0x2c61fd['name'],'sectionId':_0x2c61fd['id']},{})['then'](function(){return _0x23fb40;});}else{return _0x23fb40;}})[_0x0b4b('0x3f')](function(_0x4aeb5f){logger['error'](_0x0b4b('0x48'),_0x4aeb5f);throw _0x4aeb5f;});}return _0x23fb40;})[_0x0b4b('0x11')](respondWithResult(_0x44e1d5,0xc9))[_0x0b4b('0x3f')](handleError(_0x44e1d5,null));};exports[_0x0b4b('0x49')]=function(_0x234d93,_0x2495ae){if(_0x234d93['body']['id']){delete _0x234d93[_0x0b4b('0x40')]['id'];}return db[_0x0b4b('0x24')]['find']({'where':{'id':_0x234d93['params']['id']}})[_0x0b4b('0x11')](handleEntityNotFound(_0x2495ae,null))['then'](function(_0xd64771){if(_0xd64771){return db[_0x0b4b('0x24')][_0x0b4b('0x49')](_[_0x0b4b('0x4a')](_0x234d93[_0x0b4b('0x40')],[_0x0b4b('0x42'),_0x0b4b('0x4b'),_0x0b4b('0x4c'),_0x0b4b('0x4d'),'cutdigits',_0x0b4b('0x4e'),'alias']),{'where':{'context':_0xd64771[_0x0b4b('0x4b')],'exten':_0xd64771[_0x0b4b('0x42')]},'individualHooks':!![]})[_0x0b4b('0x11')](function(_0x38522a){return _0x38522a;});}return null;})[_0x0b4b('0x11')](respondWithStatusCode(_0x2495ae,null))[_0x0b4b('0x3f')](handleError(_0x2495ae,null));};exports[_0x0b4b('0x4f')]=function(_0x55d085,_0x576810){var _0x196321=_0x55d085[_0x0b4b('0x3e')]['id'];var _0x5e4db0=_0x55d085[_0x0b4b('0x40')];var _0x4a9229=0xc8;var _0x370e2b=null;return db['sequelize'][_0x0b4b('0x50')]({'isolationLevel':db[_0x0b4b('0x51')][_0x0b4b('0x52')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0xb82f61){return db['VoiceExtension']['findOne']({'where':{'id':_0x196321},'transaction':_0xb82f61})[_0x0b4b('0x11')](function(_0x48d5f3){if(_0x48d5f3){return db['VoiceExtension'][_0x0b4b('0x10')]({'where':{'VoiceExtensionId':_0x196321},'transaction':_0xb82f61})[_0x0b4b('0x11')](function(){var _0x28cc15=_[_0x0b4b('0x1a')](_0x5e4db0,function(_0x278a47){_0x278a47[_0x0b4b('0x53')]=_0x196321;_0x278a47[_0x0b4b('0x54')]=!![];return _0x278a47;});return _0x48d5f3[_0x0b4b('0x55')](_0x28cc15);})[_0x0b4b('0x11')](function(_0x165bbb){return db[_0x0b4b('0x24')][_0x0b4b('0x56')](_0x165bbb,{'transaction':_0xb82f61});});}else{_0x4a9229=0x194;_0x370e2b=[];}});})[_0x0b4b('0x11')](function(){if(_0x4a9229!==0x194){return db[_0x0b4b('0x24')][_0x0b4b('0x57')]({'where':{'isApp':!![],'VoiceExtensionId':_0x196321},'order':_0x0b4b('0x58')})[_0x0b4b('0x11')](function(_0x4834b5){_0x370e2b=_0x4834b5;});}})[_0x0b4b('0x3f')](function(_0x3b4957){_0x4a9229=0x1f4;logger['error'](_0x3b4957[_0x0b4b('0x20')]);if(_0x3b4957['name']){delete _0x3b4957[_0x0b4b('0x21')];}_0x370e2b=_0x3b4957;})['finally'](function(){if(_0x370e2b===null){_0x576810[_0x0b4b('0x1f')](_0x4a9229);}else{if(_0x4a9229===0x1f4){_0x576810[_0x0b4b('0x9')](_0x4a9229)[_0x0b4b('0x22')](_0x370e2b);}else{_0x576810[_0x0b4b('0x9')](_0x4a9229)[_0x0b4b('0xf')](_0x370e2b);}}});}; \ No newline at end of file +var _0xf7b2=['inbound','outbound','InternalRoutes','internal','filter','map','value','includes','type','find','name','error','stack','send','index','VoiceExtension','rawAttributes','key','model','query','keys','intersection','attributes','fields','length','nolimit','limit','sort','where','VIRTUAL','merge','includeAll','include','rows','catch','show','params','filters','options','body','startsWith','exten','concat','create','user','get','role','OutboundRoutes','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','description','recordingFormat','mandatoryDisposition','context','sequelize','transaction','Transaction','ISOLATION_LEVELS','VoiceExtensionId','findAndCountAll','cast(priority\x20as\x20unsigned)','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceExtension.socket','register','sendStatus','status','end','undefined','count','offset','set','Content-Range','json','destroy','then','InboundRoutes'];(function(_0x17ad88,_0x5e66e1){var _0x3778cd=function(_0x485af3){while(--_0x485af3){_0x17ad88['push'](_0x17ad88['shift']());}};_0x3778cd(++_0x5e66e1);}(_0xf7b2,0x97));var _0x2f7b=function(_0x55262f,_0x1fb0bf){_0x55262f=_0x55262f-0x0;var _0x4c8d31=_0xf7b2[_0x55262f];return _0x4c8d31;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x2f7b('0x0'))(_0x2f7b('0x1'));var config=require(_0x2f7b('0x2'));var db=require(_0x2f7b('0x3'))['db'];config[_0x2f7b('0x4')]=_[_0x2f7b('0x5')](config[_0x2f7b('0x4')],{'host':_0x2f7b('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2f7b('0x4')]));require(_0x2f7b('0x7'))[_0x2f7b('0x8')](socket);function respondWithStatusCode(_0x18214a,_0x4d0cf9){_0x4d0cf9=_0x4d0cf9||0xcc;return function(_0x535f71){if(_0x535f71){return _0x18214a[_0x2f7b('0x9')](_0x4d0cf9);}return _0x18214a[_0x2f7b('0xa')](_0x4d0cf9)[_0x2f7b('0xb')]();};}function respondWithResult(_0x22c332,_0x12deff){_0x12deff=_0x12deff||0xc8;return function(_0x473914){if(_0x473914){return _0x22c332[_0x2f7b('0xa')](_0x12deff)['json'](_0x473914);}};}function respondWithFilteredResult(_0x2c1dd6,_0x2ee3e7){return function(_0x303fc3){if(_0x303fc3){var _0x5bdeca=typeof _0x2ee3e7['offset']===_0x2f7b('0xc')&&typeof _0x2ee3e7['limit']===_0x2f7b('0xc');var _0x1d359c=_0x303fc3[_0x2f7b('0xd')];var _0x5e6ee5=_0x5bdeca?0x0:_0x2ee3e7['offset'];var _0x2cfdcd=_0x5bdeca?_0x303fc3[_0x2f7b('0xd')]:_0x2ee3e7[_0x2f7b('0xe')]+_0x2ee3e7['limit'];var _0x30b3a9;if(_0x2cfdcd>=_0x1d359c){_0x2cfdcd=_0x1d359c;_0x30b3a9=0xc8;}else{_0x30b3a9=0xce;}_0x2c1dd6['status'](_0x30b3a9);return _0x2c1dd6[_0x2f7b('0xf')](_0x2f7b('0x10'),_0x5e6ee5+'-'+_0x2cfdcd+'/'+_0x1d359c)[_0x2f7b('0x11')](_0x303fc3);}return null;};}function removeEntity(_0x2ccc1f){return function(_0x445fc6){if(_0x445fc6){return _0x445fc6[_0x2f7b('0x12')]()[_0x2f7b('0x13')](function(){var _0x33e836=_0x445fc6['get']({'plain':!![]});var _0x78909a=[{'name':_0x2f7b('0x14'),'value':_0x2f7b('0x15'),'ignore':![]},{'name':'OutboundRoutes','value':_0x2f7b('0x16'),'ignore':![]},{'name':_0x2f7b('0x17'),'value':_0x2f7b('0x18'),'ignore':![]}];var _0x2b5d8f=_(_0x78909a)[_0x2f7b('0x19')]('ignore')[_0x2f7b('0x1a')](_0x2f7b('0x1b'))[_0x2f7b('0x1b')]();if(_[_0x2f7b('0x1c')](_0x2b5d8f,_0x33e836[_0x2f7b('0x1d')])){return;}var _0x148db2=_[_0x2f7b('0x1e')](_0x78909a,['value',_0x33e836[_0x2f7b('0x1d')]])[_0x2f7b('0x1f')];return db['UserProfileResource'][_0x2f7b('0x12')]({'where':{'type':_0x148db2,'resourceId':_0x33e836['id']}})[_0x2f7b('0x13')](function(){return _0x445fc6;});})[_0x2f7b('0x13')](function(){_0x2ccc1f[_0x2f7b('0xa')](0xcc)[_0x2f7b('0xb')]();});}};}function handleEntityNotFound(_0x1b8098){return function(_0x38505d){if(!_0x38505d){_0x1b8098[_0x2f7b('0x9')](0x194);}return _0x38505d;};}function handleError(_0x260f83,_0x4b7539){_0x4b7539=_0x4b7539||0x1f4;return function(_0x4d2786){logger[_0x2f7b('0x20')](_0x4d2786[_0x2f7b('0x21')]);if(_0x4d2786[_0x2f7b('0x1f')]){delete _0x4d2786[_0x2f7b('0x1f')];}_0x260f83['status'](_0x4b7539)[_0x2f7b('0x22')](_0x4d2786);};}exports[_0x2f7b('0x23')]=function(_0x2b55aa,_0x116ba9){var _0xeb0943={},_0x3addbe={},_0xe79fd3={'count':0x0,'rows':[]};var _0x4e4c1b=_[_0x2f7b('0x1a')](db[_0x2f7b('0x24')][_0x2f7b('0x25')],function(_0x2db636){return{'name':_0x2db636['fieldName'],'type':_0x2db636[_0x2f7b('0x1d')][_0x2f7b('0x26')]};});_0x3addbe[_0x2f7b('0x27')]=_['map'](_0x4e4c1b,_0x2f7b('0x1f'));_0x3addbe[_0x2f7b('0x28')]=_[_0x2f7b('0x29')](_0x2b55aa[_0x2f7b('0x28')]);_0x3addbe['filters']=_[_0x2f7b('0x2a')](_0x3addbe[_0x2f7b('0x27')],_0x3addbe[_0x2f7b('0x28')]);_0xeb0943[_0x2f7b('0x2b')]=_[_0x2f7b('0x2a')](_0x3addbe[_0x2f7b('0x27')],qs[_0x2f7b('0x2c')](_0x2b55aa[_0x2f7b('0x28')]['fields']));_0xeb0943[_0x2f7b('0x2b')]=_0xeb0943['attributes'][_0x2f7b('0x2d')]?_0xeb0943[_0x2f7b('0x2b')]:_0x3addbe[_0x2f7b('0x27')];if(!_0x2b55aa['query']['hasOwnProperty'](_0x2f7b('0x2e'))){_0xeb0943[_0x2f7b('0x2f')]=qs[_0x2f7b('0x2f')](_0x2b55aa['query'][_0x2f7b('0x2f')]);_0xeb0943[_0x2f7b('0xe')]=qs['offset'](_0x2b55aa['query'][_0x2f7b('0xe')]);}_0xeb0943['order']=qs[_0x2f7b('0x30')](_0x2b55aa[_0x2f7b('0x28')][_0x2f7b('0x30')]);_0xeb0943[_0x2f7b('0x31')]=qs['filters'](_['pick'](_0x2b55aa[_0x2f7b('0x28')],_0x3addbe['filters']),_0x4e4c1b);if(_0x2b55aa[_0x2f7b('0x28')][_0x2f7b('0x19')]){_0xeb0943['where']=_['merge'](_0xeb0943[_0x2f7b('0x31')],{'$or':_['map'](_0x4e4c1b,function(_0x474443){if(_0x474443[_0x2f7b('0x1d')]!==_0x2f7b('0x32')){var _0x58e7ad={};_0x58e7ad[_0x474443[_0x2f7b('0x1f')]]={'$like':'%'+_0x2b55aa[_0x2f7b('0x28')]['filter']+'%'};return _0x58e7ad;}})});}_0xeb0943=_[_0x2f7b('0x33')]({},_0xeb0943,_0x2b55aa['options']);var _0x577cd1={'where':_0xeb0943[_0x2f7b('0x31')]};return db[_0x2f7b('0x24')][_0x2f7b('0xd')](_0x577cd1)['then'](function(_0x1dddb3){_0xe79fd3[_0x2f7b('0xd')]=_0x1dddb3;if(_0x2b55aa[_0x2f7b('0x28')][_0x2f7b('0x34')]){_0xeb0943[_0x2f7b('0x35')]=[{'all':!![]}];}return db[_0x2f7b('0x24')]['findAll'](_0xeb0943);})[_0x2f7b('0x13')](function(_0x17be19){_0xe79fd3[_0x2f7b('0x36')]=_0x17be19;return _0xe79fd3;})[_0x2f7b('0x13')](respondWithFilteredResult(_0x116ba9,_0xeb0943))[_0x2f7b('0x37')](handleError(_0x116ba9,null));};exports[_0x2f7b('0x38')]=function(_0x40f439,_0x201845){var _0x2c99aa={'raw':![],'where':{'id':_0x40f439[_0x2f7b('0x39')]['id']}},_0x557a47={};_0x557a47['model']=_[_0x2f7b('0x29')](db['VoiceExtension'][_0x2f7b('0x25')]);_0x557a47[_0x2f7b('0x28')]=_['keys'](_0x40f439[_0x2f7b('0x28')]);_0x557a47[_0x2f7b('0x3a')]=_[_0x2f7b('0x2a')](_0x557a47[_0x2f7b('0x27')],_0x557a47[_0x2f7b('0x28')]);_0x2c99aa[_0x2f7b('0x2b')]=_[_0x2f7b('0x2a')](_0x557a47['model'],qs['fields'](_0x40f439[_0x2f7b('0x28')][_0x2f7b('0x2c')]));_0x2c99aa[_0x2f7b('0x2b')]=_0x2c99aa[_0x2f7b('0x2b')][_0x2f7b('0x2d')]?_0x2c99aa[_0x2f7b('0x2b')]:_0x557a47[_0x2f7b('0x27')];if(_0x40f439['query'][_0x2f7b('0x34')]){_0x2c99aa[_0x2f7b('0x35')]=[{'all':!![]}];}_0x2c99aa=_[_0x2f7b('0x33')]({},_0x2c99aa,_0x40f439[_0x2f7b('0x3b')]);return db[_0x2f7b('0x24')][_0x2f7b('0x1e')](_0x2c99aa)[_0x2f7b('0x13')](handleEntityNotFound(_0x201845,null))['then'](respondWithResult(_0x201845,null))[_0x2f7b('0x37')](handleError(_0x201845,null));};exports['destroy']=function(_0x137754,_0x16fffa){return db['VoiceExtension'][_0x2f7b('0x1e')]({'where':{'id':_0x137754[_0x2f7b('0x39')]['id']}})[_0x2f7b('0x13')](handleEntityNotFound(_0x16fffa,null))[_0x2f7b('0x13')](removeEntity(_0x16fffa,null))[_0x2f7b('0x37')](handleError(_0x16fffa,null));};exports['create']=function(_0x27b051,_0x4a3281){if(_0x27b051[_0x2f7b('0x3c')][_0x2f7b('0x1d')]===_0x2f7b('0x16')&&!_[_0x2f7b('0x3d')](_0x27b051['body'][_0x2f7b('0x3e')],'_')){_0x27b051[_0x2f7b('0x3c')][_0x2f7b('0x3e')]='_'[_0x2f7b('0x3f')](_0x27b051['body'][_0x2f7b('0x3e')]);}return db[_0x2f7b('0x24')][_0x2f7b('0x40')](_0x27b051[_0x2f7b('0x3c')],{'raw':![]})[_0x2f7b('0x13')](function(_0x26e00b){var _0x26ac5c=_0x27b051[_0x2f7b('0x41')][_0x2f7b('0x42')]({'plain':!![]});if(!_0x26ac5c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26ac5c[_0x2f7b('0x43')]===_0x2f7b('0x41')){var _0x4cecd9=_0x26e00b[_0x2f7b('0x42')]({'plain':!![]});var _0x5b12e3=[{'name':_0x2f7b('0x14'),'value':_0x2f7b('0x15')},{'name':_0x2f7b('0x44'),'value':_0x2f7b('0x16')},{'name':_0x2f7b('0x17'),'value':_0x2f7b('0x18')}];var _0x55dc2e=_[_0x2f7b('0x1e')](_0x5b12e3,[_0x2f7b('0x1b'),_0x4cecd9['type']])['name'];return db[_0x2f7b('0x45')]['find']({'where':{'name':_0x55dc2e,'userProfileId':_0x26ac5c['userProfileId']},'raw':!![]})['then'](function(_0x4fe000){if(_0x4fe000&&_0x4fe000[_0x2f7b('0x46')]===0x0){return db[_0x2f7b('0x47')]['create']({'name':_0x4cecd9['name'],'resourceId':_0x4cecd9['id'],'type':_0x4fe000[_0x2f7b('0x1f')],'sectionId':_0x4fe000['id']},{})[_0x2f7b('0x13')](function(){return _0x26e00b;});}else{return _0x26e00b;}})[_0x2f7b('0x37')](function(_0xa27090){logger[_0x2f7b('0x20')](_0x2f7b('0x48'),_0xa27090);throw _0xa27090;});}return _0x26e00b;})['then'](respondWithResult(_0x4a3281,0xc9))[_0x2f7b('0x37')](handleError(_0x4a3281,null));};exports['update']=function(_0x3c2387,_0x1a5466){if(_0x3c2387[_0x2f7b('0x3c')]['id']){delete _0x3c2387['body']['id'];}return db[_0x2f7b('0x24')][_0x2f7b('0x1e')]({'where':{'id':_0x3c2387[_0x2f7b('0x39')]['id']}})[_0x2f7b('0x13')](handleEntityNotFound(_0x1a5466,null))[_0x2f7b('0x13')](function(_0x56196e){if(_0x56196e){return db[_0x2f7b('0x24')][_0x2f7b('0x49')](_[_0x2f7b('0x4a')](_0x3c2387[_0x2f7b('0x3c')],[_0x2f7b('0x3e'),'context',_0x2f7b('0x4b'),_0x2f7b('0x4c'),'cutdigits',_0x2f7b('0x4d'),'alias']),{'where':{'context':_0x56196e[_0x2f7b('0x4e')],'exten':_0x56196e[_0x2f7b('0x3e')]},'individualHooks':!![]})[_0x2f7b('0x13')](function(_0x40e210){return _0x40e210;});}return null;})[_0x2f7b('0x13')](respondWithStatusCode(_0x1a5466,null))[_0x2f7b('0x37')](handleError(_0x1a5466,null));};exports['addApplications']=function(_0xf51493,_0x4de4bc){var _0x20ce48=_0xf51493['params']['id'];var _0x35bbd7=_0xf51493[_0x2f7b('0x3c')];var _0x30a38a=0xc8;var _0x52bded=null;return db[_0x2f7b('0x4f')][_0x2f7b('0x50')]({'isolationLevel':db[_0x2f7b('0x4f')][_0x2f7b('0x51')][_0x2f7b('0x52')]['READ_COMMITTED']},function(_0x478a89){return db[_0x2f7b('0x24')]['findOne']({'where':{'id':_0x20ce48},'transaction':_0x478a89})[_0x2f7b('0x13')](function(_0x2b2b95){if(_0x2b2b95){return db[_0x2f7b('0x24')][_0x2f7b('0x12')]({'where':{'VoiceExtensionId':_0x20ce48},'transaction':_0x478a89})[_0x2f7b('0x13')](function(){var _0x247a30=_[_0x2f7b('0x1a')](_0x35bbd7,function(_0x5e2656){_0x5e2656[_0x2f7b('0x53')]=_0x20ce48;_0x5e2656['isApp']=!![];return _0x5e2656;});return _0x2b2b95['createRouting'](_0x247a30);})['then'](function(_0x31e161){return db[_0x2f7b('0x24')]['bulkCreate'](_0x31e161,{'transaction':_0x478a89});});}else{_0x30a38a=0x194;_0x52bded=[];}});})[_0x2f7b('0x13')](function(){if(_0x30a38a!==0x194){return db[_0x2f7b('0x24')][_0x2f7b('0x54')]({'where':{'isApp':!![],'VoiceExtensionId':_0x20ce48},'order':_0x2f7b('0x55')})[_0x2f7b('0x13')](function(_0x53fdfc){_0x52bded=_0x53fdfc;});}})[_0x2f7b('0x37')](function(_0x5317bc){_0x30a38a=0x1f4;logger[_0x2f7b('0x20')](_0x5317bc[_0x2f7b('0x21')]);if(_0x5317bc[_0x2f7b('0x1f')]){delete _0x5317bc[_0x2f7b('0x1f')];}_0x52bded=_0x5317bc;})['finally'](function(){if(_0x52bded===null){_0x4de4bc[_0x2f7b('0x9')](_0x30a38a);}else{if(_0x30a38a===0x1f4){_0x4de4bc[_0x2f7b('0xa')](_0x30a38a)[_0x2f7b('0x22')](_0x52bded);}else{_0x4de4bc[_0x2f7b('0xa')](_0x30a38a)[_0x2f7b('0x11')](_0x52bded);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 809de55..cb7dc55 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 _0xf5b9=['exports','events','VoiceExtension','setMaxListeners','save','update','remove','emit'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xf5b9,0xb9));var _0x9f5b=function(_0x368eba,_0x561e2a){_0x368eba=_0x368eba-0x0;var _0xf13fe7=_0xf5b9[_0x368eba];return _0xf13fe7;};'use strict';var EventEmitter=require(_0x9f5b('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x9f5b('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x9f5b('0x2')](0x0);var events={'afterCreate':_0x9f5b('0x3'),'afterUpdate':_0x9f5b('0x4'),'afterDestroy':_0x9f5b('0x5')};function emitEvent(_0x4d8414){return function(_0x4803b1,_0x223bc2,_0x2e11af){VoiceExtensionEvents['emit'](_0x4d8414+':'+_0x4803b1['id'],_0x4803b1);VoiceExtensionEvents[_0x9f5b('0x6')](_0x4d8414,_0x4803b1);_0x2e11af(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x9f5b('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0xced1=['emit','hasOwnProperty','hook','exports','VoiceExtension','save','update'];(function(_0x40869e,_0x7d12ab){var _0x373d46=function(_0x3b6775){while(--_0x3b6775){_0x40869e['push'](_0x40869e['shift']());}};_0x373d46(++_0x7d12ab);}(_0xced1,0xe4));var _0x1ced=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0xced1[_0x58afd5];return _0x3e503b;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0x1ced('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1ced('0x1'),'afterUpdate':_0x1ced('0x2'),'afterDestroy':'remove'};function emitEvent(_0x392dd0){return function(_0x1bdb45,_0x37c82b,_0x43cb7d){VoiceExtensionEvents[_0x1ced('0x3')](_0x392dd0+':'+_0x1bdb45['id'],_0x1bdb45);VoiceExtensionEvents[_0x1ced('0x3')](_0x392dd0,_0x1bdb45);_0x43cb7d(null);};}for(var e in events){if(events[_0x1ced('0x4')](e)){var event=events[e];VoiceExtension[_0x1ced('0x5')](e,emitEvent(event));}}module[_0x1ced('0x6')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 37b144f..5b43da6 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 _0xe9e8=['length','name','param','phone','prefix','SIP','join','none','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','tag','toLowerCase','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime','appdata','priority','last','concat','catch','define','VoiceExtension','get','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','exten','alias','NoOp','No\x20alias\x20set','context','inbound','push','CDR(routeid)=','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split'];(function(_0x272206,_0x428bb6){var _0x57df1d=function(_0x2d52bc){while(--_0x2d52bc){_0x272206['push'](_0x272206['shift']());}};_0x57df1d(++_0x428bb6);}(_0xe9e8,0x179));var _0x8e9e=function(_0x2188e3,_0x322761){_0x2188e3=_0x2188e3-0x0;var _0x150f51=_0xe9e8[_0x2188e3];return _0x150f51;};'use strict';var _=require(_0x8e9e('0x0'));var attributes=require(_0x8e9e('0x1'));module[_0x8e9e('0x2')]=function(_0x38b3cb){var _0x1a564e=_0x38b3cb[_0x8e9e('0x3')];function _0x398891(_0x48f1bc){var _0x1508fb=0x2;var _0x497f2a=[{'type':_0x48f1bc[_0x8e9e('0x4')],'app':_0x8e9e('0x5'),'appdata':_0x8e9e('0x6')+_0x48f1bc['type'],'context':_0x48f1bc['context'],'exten':_0x48f1bc[_0x8e9e('0x7')],'priority':_0x1508fb++,'VoiceExtensionId':_0x48f1bc['id']},{'type':_0x48f1bc[_0x8e9e('0x4')],'app':_0x48f1bc[_0x8e9e('0x8')]?_0x8e9e('0x5'):_0x8e9e('0x9'),'appdata':_0x48f1bc[_0x8e9e('0x8')]?'CDR(routeAlias)='+_0x48f1bc['alias']:_0x8e9e('0xa'),'context':_0x48f1bc[_0x8e9e('0xb')],'exten':_0x48f1bc[_0x8e9e('0x7')],'priority':_0x1508fb++,'VoiceExtensionId':_0x48f1bc['id']}];if(_0x48f1bc[_0x8e9e('0x4')]===_0x8e9e('0xc')){_0x497f2a[_0x8e9e('0xd')]({'type':_0x8e9e('0xc'),'app':_0x8e9e('0x5'),'appdata':_0x8e9e('0xe')+_0x48f1bc['id'],'context':_0x48f1bc[_0x8e9e('0xb')],'exten':_0x48f1bc[_0x8e9e('0x7')],'priority':_0x1508fb++,'VoiceExtensionId':_0x48f1bc['id']});}_0x497f2a[_0x8e9e('0xd')]({'type':_0x48f1bc[_0x8e9e('0x4')],'app':_0x8e9e('0x5'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x48f1bc[_0x8e9e('0xb')],'exten':_0x48f1bc[_0x8e9e('0x7')],'priority':_0x1508fb++,'VoiceExtensionId':_0x48f1bc['id']},{'type':_0x48f1bc[_0x8e9e('0x4')],'app':_0x8e9e('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x48f1bc[_0x8e9e('0xb')],'exten':_0x48f1bc['exten'],'priority':_0x1508fb++,'VoiceExtensionId':_0x48f1bc['id']},{'type':_0x48f1bc[_0x8e9e('0x4')],'app':_0x8e9e('0x5'),'appdata':_0x8e9e('0xf'),'context':_0x48f1bc['context'],'exten':_0x48f1bc['exten'],'priority':_0x1508fb++,'VoiceExtensionId':_0x48f1bc['id']});return _0x497f2a;}function _0x20220a(_0xe80653){var _0x5b62ca=0x2;var _0x1bddc7=[{'type':_0x8e9e('0x10'),'app':_0x8e9e('0x5'),'appdata':_0x8e9e('0x11'),'context':_0xe80653['context'],'exten':_0xe80653[_0x8e9e('0x7')],'priority':_0x5b62ca++,'VoiceExtensionId':_0xe80653['id']},{'type':'outbound','app':_0xe80653[_0x8e9e('0x8')]?_0x8e9e('0x5'):_0x8e9e('0x9'),'appdata':_0xe80653[_0x8e9e('0x8')]?'CDR(routeAlias)='+_0xe80653['alias']:'No\x20alias\x20set','context':_0xe80653[_0x8e9e('0xb')],'exten':_0xe80653[_0x8e9e('0x7')],'priority':_0x5b62ca++,'VoiceExtensionId':_0xe80653['id']},{'type':_0x8e9e('0x10'),'app':_0x8e9e('0x5'),'appdata':_0x8e9e('0x12')+(_0xe80653[_0x8e9e('0x13')]?_0x8e9e('0x14')+_0xe80653[_0x8e9e('0x13')]+'}':_0x8e9e('0x15')),'context':_0xe80653[_0x8e9e('0xb')],'exten':_0xe80653[_0x8e9e('0x7')],'priority':_0x5b62ca++,'VoiceExtensionId':_0xe80653['id']},{'type':_0x8e9e('0x10'),'app':_0x8e9e('0x5'),'appdata':_0x8e9e('0xe')+_0xe80653['id'],'context':_0xe80653[_0x8e9e('0xb')],'exten':_0xe80653['exten'],'priority':_0x5b62ca++,'VoiceExtensionId':_0xe80653['id']},{'type':_0x8e9e('0x10'),'app':'ExecIf','appdata':_0x8e9e('0x16')+(_0x5b62ca+0x2)+_0x8e9e('0x17')+(_0x5b62ca+0x1)+')','context':_0xe80653[_0x8e9e('0xb')],'exten':_0xe80653[_0x8e9e('0x7')],'priority':_0x5b62ca++,'VoiceExtensionId':_0xe80653['id']},{'type':_0x8e9e('0x10'),'app':_0x8e9e('0x5'),'appdata':_0xe80653[_0x8e9e('0x13')]?'CDR(prefix)=${EXTEN:0:'+_0xe80653[_0x8e9e('0x13')]+'}':_0x8e9e('0x18'),'context':_0xe80653[_0x8e9e('0xb')],'exten':_0xe80653[_0x8e9e('0x7')],'priority':_0x5b62ca++,'VoiceExtensionId':_0xe80653['id']},{'type':_0x8e9e('0x10'),'app':'Set','appdata':_0x8e9e('0x19'),'context':_0xe80653[_0x8e9e('0xb')],'exten':_0xe80653[_0x8e9e('0x7')],'priority':_0x5b62ca++,'VoiceExtensionId':_0xe80653['id']},{'type':'outbound','app':_0x8e9e('0x5'),'appdata':_0x8e9e('0x1a'),'context':_0xe80653['context'],'exten':_0xe80653[_0x8e9e('0x7')],'priority':_0x5b62ca++,'VoiceExtensionId':_0xe80653['id']},{'type':_0x8e9e('0x10'),'app':_0x8e9e('0x5'),'appdata':_0x8e9e('0xf'),'context':_0xe80653[_0x8e9e('0xb')],'exten':_0xe80653[_0x8e9e('0x7')],'priority':_0x5b62ca++,'VoiceExtensionId':_0xe80653['id']},{'type':'outbound','app':_0x8e9e('0x5'),'appdata':_0x8e9e('0x1b')+_0xe80653['id'],'context':_0xe80653[_0x8e9e('0xb')],'exten':_0xe80653[_0x8e9e('0x7')],'priority':_0x5b62ca++,'VoiceExtensionId':_0xe80653['id']}];if(_0xe80653[_0x8e9e('0x1c')](_0x8e9e('0x1d'))&&_0xe80653['recordingFormat']!=='none'){_0x1bddc7[_0x8e9e('0xd')]({'type':_0x8e9e('0x10'),'app':_0x8e9e('0x5'),'appdata':_0x8e9e('0x1e'),'context':_0xe80653[_0x8e9e('0xb')],'exten':_0xe80653['exten'],'priority':_0x5b62ca++,'VoiceExtensionId':_0xe80653['id']},{'type':_0x8e9e('0x10'),'app':_0x8e9e('0x5'),'appdata':_0x8e9e('0x1f')+_0xe80653[_0x8e9e('0x1d')]||_0x8e9e('0x20'),'context':_0xe80653[_0x8e9e('0xb')],'exten':_0xe80653[_0x8e9e('0x7')],'priority':_0x5b62ca++,'VoiceExtensionId':_0xe80653['id']});}return _0x1bddc7;}function _0x3f6caa(_0x5f0e5b,_0x597609){var _0x52f57f=[{'name':_0x8e9e('0x21'),'param':0x0},{'name':_0x8e9e('0x22'),'param':0x1},{'name':_0x8e9e('0x23'),'param':0x2},{'name':_0x8e9e('0x24'),'param':0x3}];var _0x574954={};var _0x142676=_0x597609[_0x8e9e('0x25')](',');var _0x2cda50=[];for(var _0x1ea9c0=0x0;_0x1ea9c0<_0x52f57f[_0x8e9e('0x26')];_0x1ea9c0++){switch(_0x52f57f[_0x1ea9c0][_0x8e9e('0x27')]){case _0x8e9e('0x21'):_0x574954['trunk']=_0x142676[_0x52f57f[_0x1ea9c0][_0x8e9e('0x28')]][_0x8e9e('0x25')]('/')[0x1];_0x574954[_0x8e9e('0x29')]=_0x142676[_0x52f57f[_0x1ea9c0][_0x8e9e('0x28')]]['split']('/')[0x2];_0x574954[_0x8e9e('0x2a')]=_0x574954[_0x8e9e('0x29')]?_0x574954[_0x8e9e('0x29')][_0x8e9e('0x25')]('$')[0x0]:undefined;_0x574954['phone']=_0x5f0e5b[_0x8e9e('0x13')]?(_0x574954[_0x8e9e('0x2a')]||'')+_0x8e9e('0x14')+_0x5f0e5b[_0x8e9e('0x13')]+'}':(_0x574954[_0x8e9e('0x2a')]||'')+'${EXTEN}';_0x2cda50[_0x52f57f[_0x1ea9c0]['param']]=[_0x8e9e('0x2b'),_0x574954[_0x8e9e('0x21')],_0x574954['phone']][_0x8e9e('0x2c')]('/');break;case'options':_0x574954[_0x8e9e('0x23')]=_0x142676[_0x52f57f[_0x1ea9c0][_0x8e9e('0x28')]];if(_0x5f0e5b[_0x8e9e('0x1d')]!==_0x8e9e('0x2d')){if(_0x574954['options'][_0x8e9e('0x2e')]('U(xcally-mixmonitor-context)')<0x0){_0x574954[_0x8e9e('0x23')]+=_0x8e9e('0x2f');}}else{_0x574954[_0x8e9e('0x23')]=_0x574954[_0x8e9e('0x23')][_0x8e9e('0x30')](_0x8e9e('0x2f'),'');}_0x2cda50[_0x52f57f[_0x1ea9c0][_0x8e9e('0x28')]]=_0x574954[_0x8e9e('0x23')];break;default:_0x2cda50[_0x52f57f[_0x1ea9c0]['param']]=_0x142676[_0x52f57f[_0x1ea9c0]['param']];}}return _0x2cda50['join'](',');}function _0x240164(_0x52094c,_0x1d5d79,_0x2f3c12){return new Promise(function(_0x5802bf,_0x2bb2f2){var _0x4c747b=[];if(_[_0x8e9e('0x31')](_0x1d5d79))return _0x5802bf(_0x4c747b);_0x1a564e[_0x8e9e('0x32')][_0x8e9e('0x33')]({'attributes':['id',_0x8e9e('0x34'),_0x8e9e('0x35')],'raw':!![]})[_0x8e9e('0x36')](function(_0x31c134){for(var _0x2d7a86=0x0,_0x1b6d8a=0x0;_0x2d7a86<_0x1d5d79[_0x8e9e('0x26')];_0x2d7a86++,_0x1b6d8a=0x0){var _0x41b9e4=_0x1d5d79[_0x2d7a86];var _0x58bd25=[];var _0x150db7=[];delete _0x41b9e4['id'];if(_0x41b9e4[_0x8e9e('0x34')]!==_0x8e9e('0x37')){_0x41b9e4[_0x8e9e('0x38')]=[_0x41b9e4[_0x8e9e('0x34')]];}else{_0x41b9e4['intervals']=_0x41b9e4[_0x8e9e('0x35')]?_[_0x8e9e('0x39')](_['filter'](_0x31c134,{'IntervalId':_0x41b9e4[_0x8e9e('0x35')]}),_0x8e9e('0x34')):[];}_0x41b9e4['context']=_0x52094c[_0x8e9e('0xb')];_0x41b9e4[_0x8e9e('0x7')]=_0x52094c[_0x8e9e('0x7')];if(_0x41b9e4[_0x8e9e('0x4')])_0x41b9e4['type']=_0x41b9e4[_0x8e9e('0x4')]['toLowerCase']();if(_0x52094c['type']===_0x8e9e('0x10')){if(_0x41b9e4['hasOwnProperty'](_0x8e9e('0x3a'))&&_0x41b9e4['tag']&&_0x41b9e4['tag']!=='--'){_0x58bd25[_0x8e9e('0xd')]({'type':_0x41b9e4[_0x8e9e('0x4')][_0x8e9e('0x3b')](),'app':_0x8e9e('0x5'),'appdata':_0x8e9e('0x3c')+_0x41b9e4[_0x8e9e('0x3a')],'context':_0x52094c[_0x8e9e('0xb')],'exten':_0x52094c[_0x8e9e('0x7')],'priority':_0x41b9e4['intervals'][_0x8e9e('0x26')]+_0x2f3c12+_0x1b6d8a++,'VoiceExtensionId':_0x52094c['id']});}_0x58bd25[_0x8e9e('0xd')]({'type':_0x41b9e4[_0x8e9e('0x4')][_0x8e9e('0x3b')](),'app':'ExecIf','appdata':_0x8e9e('0x3d')+(_0x41b9e4[_0x8e9e('0x3e')]?_0x8e9e('0x3f')+_0x41b9e4['callerID']+')':_0x8e9e('0x40')),'context':_0x52094c[_0x8e9e('0xb')],'exten':_0x52094c[_0x8e9e('0x7')],'priority':_0x41b9e4[_0x8e9e('0x38')]['length']+_0x2f3c12+_0x1b6d8a++,'VoiceExtensionId':_0x52094c['id']});}else{if(_0x41b9e4[_0x8e9e('0x1c')](_0x8e9e('0x41'))){if([_0x8e9e('0x42'),_0x8e9e('0x43')]['includes'](_0x41b9e4[_0x8e9e('0x44')][_0x8e9e('0x3b')]())&&_0x41b9e4[_0x8e9e('0x45')]!==_0x8e9e('0x46')){if(_0x41b9e4[_0x8e9e('0x41')]){_0x58bd25['push']({'type':_0x41b9e4['type']['toLowerCase'](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x52094c[_0x8e9e('0xb')],'exten':_0x52094c[_0x8e9e('0x7')],'priority':_0x41b9e4[_0x8e9e('0x38')][_0x8e9e('0x26')]+_0x2f3c12+_0x1b6d8a++,'VoiceExtensionId':_0x52094c['id']});_0x58bd25['push']({'type':_0x41b9e4[_0x8e9e('0x4')][_0x8e9e('0x3b')](),'app':_0x8e9e('0x5'),'appdata':_0x8e9e('0x47'),'context':_0x52094c[_0x8e9e('0xb')],'exten':_0x52094c['exten'],'priority':_0x41b9e4[_0x8e9e('0x38')]['length']+_0x2f3c12+_0x1b6d8a++,'VoiceExtensionId':_0x52094c['id']});}else{_0x58bd25['push']({'type':_0x41b9e4[_0x8e9e('0x4')]['toLowerCase'](),'app':'ExecIf','appdata':_0x8e9e('0x48'),'context':_0x52094c[_0x8e9e('0xb')],'exten':_0x52094c[_0x8e9e('0x7')],'priority':_0x41b9e4[_0x8e9e('0x38')][_0x8e9e('0x26')]+_0x2f3c12+_0x1b6d8a++,'VoiceExtensionId':_0x52094c['id']});_0x58bd25[_0x8e9e('0xd')]({'type':_0x41b9e4['type']['toLowerCase'](),'app':_0x8e9e('0x5'),'appdata':_0x8e9e('0x49'),'context':_0x52094c[_0x8e9e('0xb')],'exten':_0x52094c[_0x8e9e('0x7')],'priority':_0x41b9e4[_0x8e9e('0x38')]['length']+_0x2f3c12+_0x1b6d8a++,'VoiceExtensionId':_0x52094c['id']});}}}}for(var _0x183e92=0x0;_0x183e92<_0x41b9e4['intervals'][_0x8e9e('0x26')];_0x183e92++){var _0x425eff=_0x2f3c12+_0x41b9e4[_0x8e9e('0x38')][_0x8e9e('0x26')];var _0x387367=_0x183e92===_0x41b9e4['intervals']['length']-0x1?_0x2f3c12+_0x58bd25[_0x8e9e('0x26')]+_0x150db7['length']+0x2:_0x2f3c12+_0x183e92+0x1;_0x58bd25['splice'](_0x183e92,0x0,{'type':_0x52094c[_0x8e9e('0x4')],'app':_0x8e9e('0x4a'),'appdata':_0x41b9e4[_0x8e9e('0x38')][_0x183e92]+'?'+_0x52094c[_0x8e9e('0xb')]+',${EXTEN},'+_0x425eff+':'+_0x52094c['context']+',${EXTEN},'+_0x387367,'exten':_0x52094c[_0x8e9e('0x7')],'context':_0x52094c[_0x8e9e('0xb')],'priority':_0x2f3c12+_0x183e92,'VoiceExtensionId':_0x52094c['id']});}if(_0x41b9e4[_0x8e9e('0x45')]==='outboundDial')_0x41b9e4[_0x8e9e('0x4b')]=_0x3f6caa(_0x52094c,_0x41b9e4[_0x8e9e('0x4b')]);_0x41b9e4[_0x8e9e('0x4c')]=_0x58bd25['length']?_[_0x8e9e('0x4d')](_0x58bd25)[_0x8e9e('0x4c')]+0x1:_0x2f3c12;_0x4c747b=_[_0x8e9e('0x4e')](_0x4c747b,_0x58bd25,[_0x41b9e4],_0x150db7);_0x2f3c12=_[_0x8e9e('0x4d')](_0x4c747b)[_0x8e9e('0x4c')]+0x1;}return _0x5802bf(_0x4c747b);})[_0x8e9e('0x4f')](function(_0x429514){_0x2bb2f2(_0x429514);});});}return _0x38b3cb[_0x8e9e('0x50')](_0x8e9e('0x51'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1839b1){var _0x189501=this[_0x8e9e('0x52')]({'plain':!![]});var _0x40e965=_0x189501['type']===_0x8e9e('0x10')?_0x20220a(_0x189501):_0x398891(_0x189501);return _0x240164(_0x189501,_0x1839b1,_[_0x8e9e('0x4d')](_0x40e965)[_0x8e9e('0x4c')]+0x1)[_0x8e9e('0x36')](function(_0x3be122){var _0x14edc4=_[_0x8e9e('0x4e')](_0x40e965,_0x3be122);_0x14edc4['push']({'type':_0x189501[_0x8e9e('0x4')],'app':'Hangup','exten':_0x189501['exten'],'context':_0x189501[_0x8e9e('0xb')],'priority':_[_0x8e9e('0x4d')](_0x14edc4)[_0x8e9e('0x4c')]+0x1,'VoiceExtensionId':_0x189501['id']});return _0x14edc4;});}}});}; \ No newline at end of file +var _0x510e=['filter','toLowerCase','tag','Set(CALLERID(all)=','callerID','answer','playback','includes','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','catch','define','VoiceExtension','get','then','concat','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outbound','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','MONITOR_OPTIONS=ab','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','length','param','phone','prefix','${EXTEN:','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','interval','IntervalId','intervals'];(function(_0x99868f,_0xbdb8e7){var _0x27a71b=function(_0x41feca){while(--_0x41feca){_0x99868f['push'](_0x99868f['shift']());}};_0x27a71b(++_0xbdb8e7);}(_0x510e,0x1ed));var _0xe510=function(_0x469a3c,_0x5ebc10){_0x469a3c=_0x469a3c-0x0;var _0x968f4=_0x510e[_0x469a3c];return _0x968f4;};'use strict';var _=require(_0xe510('0x0'));var attributes=require(_0xe510('0x1'));module[_0xe510('0x2')]=function(_0x44a747){var _0x2ed31a=_0x44a747[_0xe510('0x3')];function _0x31d884(_0x2a9a5b){var _0x3cd0a5=0x2;var _0x4dd477=[{'type':_0x2a9a5b[_0xe510('0x4')],'app':_0xe510('0x5'),'appdata':_0xe510('0x6')+_0x2a9a5b[_0xe510('0x4')],'context':_0x2a9a5b[_0xe510('0x7')],'exten':_0x2a9a5b[_0xe510('0x8')],'priority':_0x3cd0a5++,'VoiceExtensionId':_0x2a9a5b['id']},{'type':_0x2a9a5b[_0xe510('0x4')],'app':_0x2a9a5b[_0xe510('0x9')]?_0xe510('0x5'):_0xe510('0xa'),'appdata':_0x2a9a5b[_0xe510('0x9')]?_0xe510('0xb')+_0x2a9a5b[_0xe510('0x9')]:_0xe510('0xc'),'context':_0x2a9a5b['context'],'exten':_0x2a9a5b[_0xe510('0x8')],'priority':_0x3cd0a5++,'VoiceExtensionId':_0x2a9a5b['id']}];if(_0x2a9a5b[_0xe510('0x4')]===_0xe510('0xd')){_0x4dd477[_0xe510('0xe')]({'type':_0xe510('0xd'),'app':_0xe510('0x5'),'appdata':'CDR(routeid)='+_0x2a9a5b['id'],'context':_0x2a9a5b[_0xe510('0x7')],'exten':_0x2a9a5b[_0xe510('0x8')],'priority':_0x3cd0a5++,'VoiceExtensionId':_0x2a9a5b['id']});}_0x4dd477[_0xe510('0xe')]({'type':_0x2a9a5b[_0xe510('0x4')],'app':_0xe510('0x5'),'appdata':_0xe510('0xf'),'context':_0x2a9a5b[_0xe510('0x7')],'exten':_0x2a9a5b[_0xe510('0x8')],'priority':_0x3cd0a5++,'VoiceExtensionId':_0x2a9a5b['id']},{'type':_0x2a9a5b[_0xe510('0x4')],'app':_0xe510('0x5'),'appdata':_0xe510('0x10'),'context':_0x2a9a5b[_0xe510('0x7')],'exten':_0x2a9a5b['exten'],'priority':_0x3cd0a5++,'VoiceExtensionId':_0x2a9a5b['id']},{'type':_0x2a9a5b[_0xe510('0x4')],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x2a9a5b[_0xe510('0x7')],'exten':_0x2a9a5b[_0xe510('0x8')],'priority':_0x3cd0a5++,'VoiceExtensionId':_0x2a9a5b['id']});return _0x4dd477;}function _0x2684b4(_0x391f6f){var _0x9b92b0=0x2;var _0x1754e=[{'type':_0xe510('0x11'),'app':_0xe510('0x5'),'appdata':'CDR(type)=outbound','context':_0x391f6f[_0xe510('0x7')],'exten':_0x391f6f[_0xe510('0x8')],'priority':_0x9b92b0++,'VoiceExtensionId':_0x391f6f['id']},{'type':_0xe510('0x11'),'app':_0x391f6f[_0xe510('0x9')]?_0xe510('0x5'):_0xe510('0xa'),'appdata':_0x391f6f[_0xe510('0x9')]?'CDR(routeAlias)='+_0x391f6f[_0xe510('0x9')]:_0xe510('0xc'),'context':_0x391f6f['context'],'exten':_0x391f6f[_0xe510('0x8')],'priority':_0x9b92b0++,'VoiceExtensionId':_0x391f6f['id']},{'type':_0xe510('0x11'),'app':'Set','appdata':_0xe510('0x12')+(_0x391f6f[_0xe510('0x13')]?'${EXTEN:'+_0x391f6f[_0xe510('0x13')]+'}':_0xe510('0x14')),'context':_0x391f6f[_0xe510('0x7')],'exten':_0x391f6f[_0xe510('0x8')],'priority':_0x9b92b0++,'VoiceExtensionId':_0x391f6f['id']},{'type':_0xe510('0x11'),'app':'Set','appdata':_0xe510('0x15')+_0x391f6f['id'],'context':_0x391f6f['context'],'exten':_0x391f6f['exten'],'priority':_0x9b92b0++,'VoiceExtensionId':_0x391f6f['id']},{'type':'outbound','app':_0xe510('0x16'),'appdata':_0xe510('0x17')+(_0x9b92b0+0x2)+'):Goto('+(_0x9b92b0+0x1)+')','context':_0x391f6f[_0xe510('0x7')],'exten':_0x391f6f['exten'],'priority':_0x9b92b0++,'VoiceExtensionId':_0x391f6f['id']},{'type':_0xe510('0x11'),'app':_0xe510('0x5'),'appdata':_0x391f6f[_0xe510('0x13')]?_0xe510('0x18')+_0x391f6f[_0xe510('0x13')]+'}':_0xe510('0x19'),'context':_0x391f6f[_0xe510('0x7')],'exten':_0x391f6f[_0xe510('0x8')],'priority':_0x9b92b0++,'VoiceExtensionId':_0x391f6f['id']},{'type':_0xe510('0x11'),'app':_0xe510('0x5'),'appdata':_0xe510('0xf'),'context':_0x391f6f['context'],'exten':_0x391f6f[_0xe510('0x8')],'priority':_0x9b92b0++,'VoiceExtensionId':_0x391f6f['id']},{'type':_0xe510('0x11'),'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x391f6f[_0xe510('0x7')],'exten':_0x391f6f[_0xe510('0x8')],'priority':_0x9b92b0++,'VoiceExtensionId':_0x391f6f['id']},{'type':'outbound','app':_0xe510('0x5'),'appdata':_0xe510('0x1a'),'context':_0x391f6f[_0xe510('0x7')],'exten':_0x391f6f[_0xe510('0x8')],'priority':_0x9b92b0++,'VoiceExtensionId':_0x391f6f['id']},{'type':_0xe510('0x11'),'app':'Set','appdata':_0xe510('0x1b')+_0x391f6f['id'],'context':_0x391f6f[_0xe510('0x7')],'exten':_0x391f6f[_0xe510('0x8')],'priority':_0x9b92b0++,'VoiceExtensionId':_0x391f6f['id']}];if(_0x391f6f[_0xe510('0x1c')](_0xe510('0x1d'))&&_0x391f6f[_0xe510('0x1d')]!==_0xe510('0x1e')){_0x1754e[_0xe510('0xe')]({'type':_0xe510('0x11'),'app':_0xe510('0x5'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x391f6f[_0xe510('0x7')],'exten':_0x391f6f[_0xe510('0x8')],'priority':_0x9b92b0++,'VoiceExtensionId':_0x391f6f['id']},{'type':_0xe510('0x11'),'app':_0xe510('0x5'),'appdata':_0xe510('0x1f')+_0x391f6f[_0xe510('0x1d')]||_0xe510('0x20'),'context':_0x391f6f[_0xe510('0x7')],'exten':_0x391f6f[_0xe510('0x8')],'priority':_0x9b92b0++,'VoiceExtensionId':_0x391f6f['id']});}return _0x1754e;}function _0x2f971a(_0x22b714,_0x21fef0){var _0x1e9c6d=[{'name':_0xe510('0x21'),'param':0x0},{'name':_0xe510('0x22'),'param':0x1},{'name':_0xe510('0x23'),'param':0x2},{'name':_0xe510('0x24'),'param':0x3}];var _0x5998b2={};var _0x3943b4=_0x21fef0[_0xe510('0x25')](',');var _0x56c356=[];for(var _0x54950f=0x0;_0x54950f<_0x1e9c6d[_0xe510('0x26')];_0x54950f++){switch(_0x1e9c6d[_0x54950f]['name']){case'trunk':_0x5998b2[_0xe510('0x21')]=_0x3943b4[_0x1e9c6d[_0x54950f][_0xe510('0x27')]][_0xe510('0x25')]('/')[0x1];_0x5998b2[_0xe510('0x28')]=_0x3943b4[_0x1e9c6d[_0x54950f]['param']][_0xe510('0x25')]('/')[0x2];_0x5998b2['prefix']=_0x5998b2[_0xe510('0x28')]?_0x5998b2[_0xe510('0x28')][_0xe510('0x25')]('$')[0x0]:undefined;_0x5998b2['phone']=_0x22b714[_0xe510('0x13')]?(_0x5998b2[_0xe510('0x29')]||'')+_0xe510('0x2a')+_0x22b714[_0xe510('0x13')]+'}':(_0x5998b2[_0xe510('0x29')]||'')+_0xe510('0x14');_0x56c356[_0x1e9c6d[_0x54950f][_0xe510('0x27')]]=[_0xe510('0x2b'),_0x5998b2[_0xe510('0x21')],_0x5998b2[_0xe510('0x28')]][_0xe510('0x2c')]('/');break;case _0xe510('0x23'):_0x5998b2[_0xe510('0x23')]=_0x3943b4[_0x1e9c6d[_0x54950f][_0xe510('0x27')]];if(_0x22b714[_0xe510('0x1d')]!==_0xe510('0x1e')){if(_0x5998b2[_0xe510('0x23')][_0xe510('0x2d')](_0xe510('0x2e'))<0x0){_0x5998b2['options']+='U(xcally-mixmonitor-context)';}}else{_0x5998b2['options']=_0x5998b2[_0xe510('0x23')][_0xe510('0x2f')](_0xe510('0x2e'),'');}_0x56c356[_0x1e9c6d[_0x54950f][_0xe510('0x27')]]=_0x5998b2['options'];break;default:_0x56c356[_0x1e9c6d[_0x54950f]['param']]=_0x3943b4[_0x1e9c6d[_0x54950f][_0xe510('0x27')]];}}return _0x56c356[_0xe510('0x2c')](',');}function _0x5b5b8b(_0x427c7b,_0xe12644,_0x545c18){return new Promise(function(_0x2b8bde,_0x28b049){var _0x3361b8=[];if(_[_0xe510('0x30')](_0xe12644))return _0x2b8bde(_0x3361b8);_0x2ed31a['Interval'][_0xe510('0x31')]({'attributes':['id',_0xe510('0x32'),_0xe510('0x33')],'raw':!![]})['then'](function(_0x1ef45f){for(var _0x2c5266=0x0,_0x480a13=0x0;_0x2c5266<_0xe12644[_0xe510('0x26')];_0x2c5266++,_0x480a13=0x0){var _0x20d8cb=_0xe12644[_0x2c5266];var _0x76f80f=[];var _0x542d00=[];delete _0x20d8cb['id'];if(_0x20d8cb[_0xe510('0x32')]!=='*,*,*,*'){_0x20d8cb[_0xe510('0x34')]=[_0x20d8cb[_0xe510('0x32')]];}else{_0x20d8cb[_0xe510('0x34')]=_0x20d8cb[_0xe510('0x33')]?_['map'](_[_0xe510('0x35')](_0x1ef45f,{'IntervalId':_0x20d8cb['IntervalId']}),_0xe510('0x32')):[];}_0x20d8cb['context']=_0x427c7b['context'];_0x20d8cb['exten']=_0x427c7b[_0xe510('0x8')];if(_0x20d8cb['type'])_0x20d8cb['type']=_0x20d8cb['type'][_0xe510('0x36')]();if(_0x427c7b[_0xe510('0x4')]===_0xe510('0x11')){if(_0x20d8cb[_0xe510('0x1c')]('tag')&&_0x20d8cb[_0xe510('0x37')]&&_0x20d8cb[_0xe510('0x37')]!=='--'){_0x76f80f[_0xe510('0xe')]({'type':_0x20d8cb[_0xe510('0x4')]['toLowerCase'](),'app':'Set','appdata':'CDR(tag)='+_0x20d8cb[_0xe510('0x37')],'context':_0x427c7b[_0xe510('0x7')],'exten':_0x427c7b[_0xe510('0x8')],'priority':_0x20d8cb[_0xe510('0x34')][_0xe510('0x26')]+_0x545c18+_0x480a13++,'VoiceExtensionId':_0x427c7b['id']});}_0x76f80f['push']({'type':_0x20d8cb[_0xe510('0x4')]['toLowerCase'](),'app':_0xe510('0x16'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x20d8cb['callerID']?_0xe510('0x38')+_0x20d8cb[_0xe510('0x39')]+')':'NoOp(No\x20number\x20available)'),'context':_0x427c7b[_0xe510('0x7')],'exten':_0x427c7b[_0xe510('0x8')],'priority':_0x20d8cb[_0xe510('0x34')][_0xe510('0x26')]+_0x545c18+_0x480a13++,'VoiceExtensionId':_0x427c7b['id']});}else{if(_0x20d8cb[_0xe510('0x1c')](_0xe510('0x3a'))){if(['queue',_0xe510('0x3b')][_0xe510('0x3c')](_0x20d8cb['app']['toLowerCase']())&&_0x20d8cb[_0xe510('0x3d')]!==_0xe510('0x3e')){if(_0x20d8cb[_0xe510('0x3a')]){_0x76f80f[_0xe510('0xe')]({'type':_0x20d8cb[_0xe510('0x4')][_0xe510('0x36')](),'app':_0xe510('0x16'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x427c7b['context'],'exten':_0x427c7b[_0xe510('0x8')],'priority':_0x20d8cb[_0xe510('0x34')]['length']+_0x545c18+_0x480a13++,'VoiceExtensionId':_0x427c7b['id']});_0x76f80f[_0xe510('0xe')]({'type':_0x20d8cb[_0xe510('0x4')][_0xe510('0x36')](),'app':_0xe510('0x5'),'appdata':_0xe510('0x3f'),'context':_0x427c7b[_0xe510('0x7')],'exten':_0x427c7b['exten'],'priority':_0x20d8cb['intervals'][_0xe510('0x26')]+_0x545c18+_0x480a13++,'VoiceExtensionId':_0x427c7b['id']});}else{_0x76f80f[_0xe510('0xe')]({'type':_0x20d8cb['type'][_0xe510('0x36')](),'app':_0xe510('0x16'),'appdata':_0xe510('0x40'),'context':_0x427c7b['context'],'exten':_0x427c7b[_0xe510('0x8')],'priority':_0x20d8cb[_0xe510('0x34')][_0xe510('0x26')]+_0x545c18+_0x480a13++,'VoiceExtensionId':_0x427c7b['id']});_0x76f80f[_0xe510('0xe')]({'type':_0x20d8cb['type'][_0xe510('0x36')](),'app':'Set','appdata':_0xe510('0x41'),'context':_0x427c7b['context'],'exten':_0x427c7b[_0xe510('0x8')],'priority':_0x20d8cb[_0xe510('0x34')][_0xe510('0x26')]+_0x545c18+_0x480a13++,'VoiceExtensionId':_0x427c7b['id']});}}}}for(var _0x382dc3=0x0;_0x382dc3<_0x20d8cb[_0xe510('0x34')]['length'];_0x382dc3++){var _0x4a45a8=_0x545c18+_0x20d8cb[_0xe510('0x34')][_0xe510('0x26')];var _0x5f1add=_0x382dc3===_0x20d8cb[_0xe510('0x34')]['length']-0x1?_0x545c18+_0x76f80f[_0xe510('0x26')]+_0x542d00['length']+0x2:_0x545c18+_0x382dc3+0x1;_0x76f80f['splice'](_0x382dc3,0x0,{'type':_0x427c7b['type'],'app':_0xe510('0x42'),'appdata':_0x20d8cb[_0xe510('0x34')][_0x382dc3]+'?'+_0x427c7b[_0xe510('0x7')]+_0xe510('0x43')+_0x4a45a8+':'+_0x427c7b[_0xe510('0x7')]+_0xe510('0x43')+_0x5f1add,'exten':_0x427c7b[_0xe510('0x8')],'context':_0x427c7b[_0xe510('0x7')],'priority':_0x545c18+_0x382dc3,'VoiceExtensionId':_0x427c7b['id']});}if(_0x20d8cb[_0xe510('0x3d')]===_0xe510('0x44'))_0x20d8cb[_0xe510('0x45')]=_0x2f971a(_0x427c7b,_0x20d8cb[_0xe510('0x45')]);_0x20d8cb[_0xe510('0x46')]=_0x76f80f[_0xe510('0x26')]?_[_0xe510('0x47')](_0x76f80f)[_0xe510('0x46')]+0x1:_0x545c18;_0x3361b8=_['concat'](_0x3361b8,_0x76f80f,[_0x20d8cb],_0x542d00);_0x545c18=_['last'](_0x3361b8)[_0xe510('0x46')]+0x1;}return _0x2b8bde(_0x3361b8);})[_0xe510('0x48')](function(_0x2734c9){_0x28b049(_0x2734c9);});});}return _0x44a747[_0xe510('0x49')](_0xe510('0x4a'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x2bc202){var _0x342108=this[_0xe510('0x4b')]({'plain':!![]});var _0x1b2f8c=_0x342108[_0xe510('0x4')]===_0xe510('0x11')?_0x2684b4(_0x342108):_0x31d884(_0x342108);return _0x5b5b8b(_0x342108,_0x2bc202,_[_0xe510('0x47')](_0x1b2f8c)[_0xe510('0x46')]+0x1)[_0xe510('0x4c')](function(_0x47edfd){var _0x30bc92=_[_0xe510('0x4d')](_0x1b2f8c,_0x47edfd);_0x30bc92[_0xe510('0xe')]({'type':_0x342108[_0xe510('0x4')],'app':'Hangup','exten':_0x342108[_0xe510('0x8')],'context':_0x342108[_0xe510('0x7')],'priority':_['last'](_0x30bc92)[_0xe510('0x46')]+0x1,'VoiceExtensionId':_0x342108['id']});return _0x30bc92;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 27a6a65..1a8382e 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 _0xe132=['info','result','catch','GetVoiceExtension','findAll','options','where','attributes','limit','include','map','model','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1c7cea,_0x58d586){var _0x4ce52a=function(_0x3face3){while(--_0x3face3){_0x1c7cea['push'](_0x1c7cea['shift']());}};_0x4ce52a(++_0x58d586);}(_0xe132,0x162));var _0x2e13=function(_0x2b44c5,_0x3130c1){_0x2b44c5=_0x2b44c5-0x0;var _0x173a85=_0xe132[_0x2b44c5];return _0x173a85;};'use strict';var _=require(_0x2e13('0x0'));var util=require('util');var moment=require(_0x2e13('0x1'));var BPromise=require(_0x2e13('0x2'));var rs=require(_0x2e13('0x3'));var fs=require('fs');var Redis=require(_0x2e13('0x4'));var db=require(_0x2e13('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2e13('0x6'))(_0x2e13('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2e13('0x8')][_0x2e13('0x9')]({'port':0x232a});config[_0x2e13('0xa')]=_[_0x2e13('0xb')](config[_0x2e13('0xa')],{'host':_0x2e13('0xc'),'port':0x18eb});var socket=require(_0x2e13('0xd'))(new Redis(config[_0x2e13('0xa')]));require(_0x2e13('0xe'))[_0x2e13('0xf')](socket);function respondWithRpcPromise(_0x5122a2,_0x1fc092,_0x20fe3e){return new BPromise(function(_0x31b284,_0x40c2eb){return client[_0x2e13('0x10')](_0x5122a2,_0x20fe3e)[_0x2e13('0x11')](function(_0x302718){logger['info'](_0x2e13('0x12'),_0x1fc092,_0x2e13('0x13'));logger[_0x2e13('0x14')](_0x2e13('0x15'),_0x1fc092,_0x2e13('0x13'),JSON[_0x2e13('0x16')](_0x302718));if(_0x302718[_0x2e13('0x17')]){if(_0x302718['error'][_0x2e13('0x18')]===0x1f4){logger[_0x2e13('0x17')](_0x2e13('0x12'),_0x1fc092,_0x302718['error'][_0x2e13('0x19')]);return _0x40c2eb(_0x302718[_0x2e13('0x17')][_0x2e13('0x19')]);}logger['error'](_0x2e13('0x12'),_0x1fc092,_0x302718[_0x2e13('0x17')][_0x2e13('0x19')]);return _0x31b284(_0x302718['error']['message']);}else{logger[_0x2e13('0x1a')](_0x2e13('0x12'),_0x1fc092,_0x2e13('0x13'));_0x31b284(_0x302718[_0x2e13('0x1b')][_0x2e13('0x19')]);}})[_0x2e13('0x1c')](function(_0x2496ee){logger[_0x2e13('0x17')]('VoiceExtension,\x20%s,\x20%s',_0x1fc092,_0x2496ee);_0x40c2eb(_0x2496ee);});});}exports[_0x2e13('0x1d')]=function(_0x9c37a9){var _0xa1ea28=this;return new Promise(function(_0x173a27,_0x479013){return db['VoiceExtension'][_0x2e13('0x1e')]({'raw':_0x9c37a9[_0x2e13('0x1f')]?_0x9c37a9['options']['raw']===undefined?!![]:![]:!![],'where':_0x9c37a9['options']?_0x9c37a9[_0x2e13('0x1f')][_0x2e13('0x20')]||null:null,'attributes':_0x9c37a9[_0x2e13('0x1f')]?_0x9c37a9[_0x2e13('0x1f')][_0x2e13('0x21')]||null:null,'limit':_0x9c37a9[_0x2e13('0x1f')]?_0x9c37a9['options'][_0x2e13('0x22')]||null:null,'include':_0x9c37a9[_0x2e13('0x1f')]?_0x9c37a9[_0x2e13('0x1f')][_0x2e13('0x23')]?_[_0x2e13('0x24')](_0x9c37a9[_0x2e13('0x1f')]['include'],function(_0x341ae7){return{'model':db[_0x341ae7[_0x2e13('0x25')]],'as':_0x341ae7['as'],'attributes':_0x341ae7['attributes'],'include':_0x341ae7['include']?_[_0x2e13('0x24')](_0x341ae7[_0x2e13('0x23')],function(_0x279d9e){return{'model':db[_0x279d9e['model']],'as':_0x279d9e['as'],'attributes':_0x279d9e[_0x2e13('0x21')],'include':_0x279d9e[_0x2e13('0x23')]?_[_0x2e13('0x24')](_0x279d9e[_0x2e13('0x23')],function(_0x2c6e04){return{'model':db[_0x2c6e04[_0x2e13('0x25')]],'as':_0x2c6e04['as'],'attributes':_0x2c6e04[_0x2e13('0x21')]};}):[]};}):[]};}):[]:[]})[_0x2e13('0x11')](function(_0x31f448){logger[_0x2e13('0x1a')](_0x2e13('0x1d'),_0x9c37a9);logger[_0x2e13('0x14')](_0x2e13('0x1d'),_0x9c37a9,JSON[_0x2e13('0x16')](_0x31f448));_0x173a27(_0x31f448);})[_0x2e13('0x1c')](function(_0x49e258){logger[_0x2e13('0x17')](_0x2e13('0x1d'),_0x49e258[_0x2e13('0x19')],_0x9c37a9);_0x479013(_0xa1ea28['error'](0x1f4,_0x49e258['message']));});});}; \ No newline at end of file +var _0xe6e9=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','limit','map','include','attributes','model','lodash','util','moment','randomstring'];(function(_0x22959a,_0x16fc4f){var _0x247278=function(_0x4dde64){while(--_0x4dde64){_0x22959a['push'](_0x22959a['shift']());}};_0x247278(++_0x16fc4f);}(_0xe6e9,0x182));var _0x9e6e=function(_0x561c94,_0x1a8217){_0x561c94=_0x561c94-0x0;var _0x1ed0dc=_0xe6e9[_0x561c94];return _0x1ed0dc;};'use strict';var _=require(_0x9e6e('0x0'));var util=require(_0x9e6e('0x1'));var moment=require(_0x9e6e('0x2'));var BPromise=require('bluebird');var rs=require(_0x9e6e('0x3'));var fs=require('fs');var Redis=require(_0x9e6e('0x4'));var db=require(_0x9e6e('0x5'))['db'];var utils=require(_0x9e6e('0x6'));var logger=require(_0x9e6e('0x7'))('rpc');var config=require(_0x9e6e('0x8'));var jayson=require(_0x9e6e('0x9'));var client=jayson[_0x9e6e('0xa')][_0x9e6e('0xb')]({'port':0x232a});config[_0x9e6e('0xc')]=_['defaults'](config[_0x9e6e('0xc')],{'host':_0x9e6e('0xd'),'port':0x18eb});var socket=require(_0x9e6e('0xe'))(new Redis(config[_0x9e6e('0xc')]));require(_0x9e6e('0xf'))[_0x9e6e('0x10')](socket);function respondWithRpcPromise(_0x4862cb,_0x1b683d,_0x40360d){return new BPromise(function(_0x286351,_0xbf2d04){return client['request'](_0x4862cb,_0x40360d)[_0x9e6e('0x11')](function(_0x4697d1){logger['info'](_0x9e6e('0x12'),_0x1b683d,_0x9e6e('0x13'));logger[_0x9e6e('0x14')](_0x9e6e('0x15'),_0x1b683d,'request\x20sent',JSON[_0x9e6e('0x16')](_0x4697d1));if(_0x4697d1[_0x9e6e('0x17')]){if(_0x4697d1[_0x9e6e('0x17')][_0x9e6e('0x18')]===0x1f4){logger[_0x9e6e('0x17')](_0x9e6e('0x12'),_0x1b683d,_0x4697d1[_0x9e6e('0x17')][_0x9e6e('0x19')]);return _0xbf2d04(_0x4697d1[_0x9e6e('0x17')][_0x9e6e('0x19')]);}logger[_0x9e6e('0x17')](_0x9e6e('0x12'),_0x1b683d,_0x4697d1[_0x9e6e('0x17')][_0x9e6e('0x19')]);return _0x286351(_0x4697d1[_0x9e6e('0x17')][_0x9e6e('0x19')]);}else{logger[_0x9e6e('0x1a')](_0x9e6e('0x12'),_0x1b683d,_0x9e6e('0x13'));_0x286351(_0x4697d1[_0x9e6e('0x1b')][_0x9e6e('0x19')]);}})['catch'](function(_0x54ba62){logger['error'](_0x9e6e('0x12'),_0x1b683d,_0x54ba62);_0xbf2d04(_0x54ba62);});});}exports[_0x9e6e('0x1c')]=function(_0x9b0282){var _0x351201=this;return new Promise(function(_0x35dd6d,_0x3b9299){return db[_0x9e6e('0x1d')][_0x9e6e('0x1e')]({'raw':_0x9b0282[_0x9e6e('0x1f')]?_0x9b0282[_0x9e6e('0x1f')][_0x9e6e('0x20')]===undefined?!![]:![]:!![],'where':_0x9b0282[_0x9e6e('0x1f')]?_0x9b0282[_0x9e6e('0x1f')][_0x9e6e('0x21')]||null:null,'attributes':_0x9b0282[_0x9e6e('0x1f')]?_0x9b0282[_0x9e6e('0x1f')]['attributes']||null:null,'limit':_0x9b0282[_0x9e6e('0x1f')]?_0x9b0282[_0x9e6e('0x1f')][_0x9e6e('0x22')]||null:null,'include':_0x9b0282[_0x9e6e('0x1f')]?_0x9b0282['options']['include']?_[_0x9e6e('0x23')](_0x9b0282[_0x9e6e('0x1f')][_0x9e6e('0x24')],function(_0x4e17b7){return{'model':db[_0x4e17b7['model']],'as':_0x4e17b7['as'],'attributes':_0x4e17b7[_0x9e6e('0x25')],'include':_0x4e17b7[_0x9e6e('0x24')]?_[_0x9e6e('0x23')](_0x4e17b7[_0x9e6e('0x24')],function(_0x4d30c1){return{'model':db[_0x4d30c1['model']],'as':_0x4d30c1['as'],'attributes':_0x4d30c1[_0x9e6e('0x25')],'include':_0x4d30c1['include']?_[_0x9e6e('0x23')](_0x4d30c1['include'],function(_0x43b1bf){return{'model':db[_0x43b1bf[_0x9e6e('0x26')]],'as':_0x43b1bf['as'],'attributes':_0x43b1bf['attributes']};}):[]};}):[]};}):[]:[]})[_0x9e6e('0x11')](function(_0x16f6f7){logger[_0x9e6e('0x1a')](_0x9e6e('0x1c'),_0x9b0282);logger['debug'](_0x9e6e('0x1c'),_0x9b0282,JSON['stringify'](_0x16f6f7));_0x35dd6d(_0x16f6f7);})['catch'](function(_0xcb9992){logger['error'](_0x9e6e('0x1c'),_0xcb9992[_0x9e6e('0x19')],_0x9b0282);_0x3b9299(_0x351201[_0x9e6e('0x17')](0x1f4,_0xcb9992[_0x9e6e('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 423974e..0cf197e 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 _0x7a54=['remove','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x2e5e96,_0x22eed2){var _0x26cbe1=function(_0x13cda5){while(--_0x13cda5){_0x2e5e96['push'](_0x2e5e96['shift']());}};_0x26cbe1(++_0x22eed2);}(_0x7a54,0x106));var _0x47a5=function(_0x276f59,_0x52a165){_0x276f59=_0x276f59-0x0;var _0x3f9def=_0x7a54[_0x276f59];return _0x3f9def;};'use strict';var VoiceExtensionEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){VoiceExtensionEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);VoiceExtensionEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file +var _0xabce=['voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x3d97d8,_0x269463){var _0x584093=function(_0x1e61aa){while(--_0x1e61aa){_0x3d97d8['push'](_0x3d97d8['shift']());}};_0x584093(++_0x269463);}(_0xabce,0x103));var _0xeabc=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xabce[_0x2bf141];return _0x48277b;};'use strict';var VoiceExtensionEvents=require(_0xeabc('0x0'));var events=[_0xeabc('0x1'),_0xeabc('0x2'),_0xeabc('0x3')];function createListener(_0x49dbcc,_0x5bd1a4){return function(_0x5ebc95){_0x5bd1a4[_0xeabc('0x4')](_0x49dbcc,_0x5ebc95);};}function removeListener(_0x1d9f37,_0x1a88a7){return function(){VoiceExtensionEvents['removeListener'](_0x1d9f37,_0x1a88a7);};}exports['register']=function(_0x1b07a8){for(var _0x52a4d7=0x0,_0x229ba4=events['length'];_0x52a4d7<_0x229ba4;_0x52a4d7++){var _0x3bdc29=events[_0x52a4d7];var _0x9417af=createListener(_0xeabc('0x5')+_0x3bdc29,_0x1b07a8);VoiceExtensionEvents['on'](_0x3bdc29,_0x9417af);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index c2075d9..c0c12d9 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 _0x958a=['Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','getMessages','post','create','put','update','delete','destroy','multer','util','connect-timeout','express'];(function(_0x557dde,_0x3d745b){var _0x350143=function(_0x33a1a1){while(--_0x33a1a1){_0x557dde['push'](_0x557dde['shift']());}};_0x350143(++_0x3d745b);}(_0x958a,0x128));var _0xa958=function(_0xb7f49,_0x2a762e){_0xb7f49=_0xb7f49-0x0;var _0x5274d2=_0x958a[_0xb7f49];return _0x5274d2;};'use strict';var multer=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var path=require('path');var timeout=require(_0xa958('0x2'));var express=require(_0xa958('0x3'));var router=express[_0xa958('0x4')]();var fs_extra=require(_0xa958('0x5'));var auth=require(_0xa958('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa958('0x7'));var controller=require('./voiceMail.controller');router[_0xa958('0x8')]('/',auth[_0xa958('0x9')](),controller[_0xa958('0xa')]);router[_0xa958('0x8')](_0xa958('0xb'),auth[_0xa958('0x9')](),controller[_0xa958('0xc')]);router['get']('/:id/messages',auth[_0xa958('0x9')](),controller[_0xa958('0xd')]);router[_0xa958('0xe')]('/',auth[_0xa958('0x9')](),controller[_0xa958('0xf')]);router[_0xa958('0x10')](_0xa958('0xb'),auth[_0xa958('0x9')](),controller[_0xa958('0x11')]);router[_0xa958('0x12')](_0xa958('0xb'),auth[_0xa958('0x9')](),controller[_0xa958('0x13')]);module['exports']=router; \ No newline at end of file +var _0x6d38=['path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','isAuthenticated','index','get','/:id','/:id/messages','create','update','destroy','exports','util'];(function(_0x50c6ce,_0x28db6f){var _0x586c7d=function(_0x54e9c6){while(--_0x54e9c6){_0x50c6ce['push'](_0x50c6ce['shift']());}};_0x586c7d(++_0x28db6f);}(_0x6d38,0x1ef));var _0x86d3=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x6d38[_0x173441];return _0x2423a8;};'use strict';var multer=require('multer');var util=require(_0x86d3('0x0'));var path=require(_0x86d3('0x1'));var timeout=require(_0x86d3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x86d3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var controller=require(_0x86d3('0x6'));router['get']('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0x8')]);router[_0x86d3('0x9')](_0x86d3('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x86d3('0x9')](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller['getMessages']);router['post']('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0xc')]);router['put']('/:id',auth[_0x86d3('0x7')](),controller[_0x86d3('0xd')]);router['delete'](_0x86d3('0xa'),auth['isAuthenticated'](),controller[_0x86d3('0xe')]);module[_0x86d3('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 1b0feb5..40fdd1f 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 _0x51e5=['VIRTUAL','fullname','getDataValue','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER'];(function(_0x355674,_0x428058){var _0x37fcf9=function(_0x3d1f3a){while(--_0x3d1f3a){_0x355674['push'](_0x355674['shift']());}};_0x37fcf9(++_0x428058);}(_0x51e5,0x136));var _0x551e=function(_0x2904a2,_0x4b8269){_0x2904a2=_0x2904a2-0x0;var _0x55b7fa=_0x51e5[_0x2904a2];return _0x55b7fa;};'use strict';var Sequelize=require(_0x551e('0x0'));module[_0x551e('0x1')]={'customer_id':{'type':Sequelize[_0x551e('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x551e('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x551e('0x2')],'defaultValue':'','allowNull':![],'unique':_0x551e('0x4')},'password':{'type':Sequelize[_0x551e('0x2')]},'fullname':{'type':Sequelize[_0x551e('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x1f8808){this[_0x551e('0x5')]('email',typeof _0x1f8808===_0x551e('0x6')&&_0x1f8808[_0x551e('0x7')]()?_0x1f8808[_0x551e('0x7')]():null);}},'pager':{'type':Sequelize[_0x551e('0x2')]},'tz':{'type':Sequelize[_0x551e('0x2')],'defaultValue':_0x551e('0x8')},'attach':{'type':Sequelize[_0x551e('0x9')](_0x551e('0xa'),'no'),'defaultValue':_0x551e('0xa'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x551e('0x2')]},'callback':{'type':Sequelize[_0x551e('0x2')]},'review':{'type':Sequelize[_0x551e('0x9')](_0x551e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x551e('0x9')](_0x551e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x551e('0x9')](_0x551e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x551e('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x551e('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x551e('0x9')](_0x551e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x551e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x551e('0xa'),'no'),'defaultValue':_0x551e('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x551e('0x9')](_0x551e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x551e('0x9')](_0x551e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x551e('0x9')](_0x551e('0xa'),'no'),'defaultValue':_0x551e('0xa'),'allowNull':![]},'stamp':{'type':_0x551e('0xc')},'emailsubject':{'type':Sequelize[_0x551e('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x551e('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x551e('0xe')],'get':function(){return this['getDataValue'](_0x551e('0xf'))+'\x20-\x20'+this[_0x551e('0x10')](_0x551e('0x11'));}}}; \ No newline at end of file +var _0x457f=['ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','string','trim','central'];(function(_0x53361f,_0x3b2cb6){var _0x279237=function(_0x317757){while(--_0x317757){_0x53361f['push'](_0x53361f['shift']());}};_0x279237(++_0x3b2cb6);}(_0x457f,0x119));var _0xf457=function(_0x4e0136,_0x1355a5){_0x4e0136=_0x4e0136-0x0;var _0x5e97c1=_0x457f[_0x4e0136];return _0x5e97c1;};'use strict';var Sequelize=require(_0xf457('0x0'));module[_0xf457('0x1')]={'customer_id':{'type':Sequelize[_0xf457('0x2')]},'context':{'type':Sequelize[_0xf457('0x2')],'defaultValue':_0xf457('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0xf457('0x4')},'password':{'type':Sequelize[_0xf457('0x2')]},'fullname':{'type':Sequelize[_0xf457('0x2')]},'email':{'type':Sequelize[_0xf457('0x2')],'validate':{'isEmail':!![]},'set':function(_0x319ce7){this['setDataValue']('email',typeof _0x319ce7===_0xf457('0x5')&&_0x319ce7[_0xf457('0x6')]()?_0x319ce7[_0xf457('0x6')]():null);}},'pager':{'type':Sequelize[_0xf457('0x2')]},'tz':{'type':Sequelize[_0xf457('0x2')],'defaultValue':_0xf457('0x7')},'attach':{'type':Sequelize[_0xf457('0x8')](_0xf457('0x9'),'no'),'defaultValue':_0xf457('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0xf457('0x8')](_0xf457('0x9'),'no'),'defaultValue':_0xf457('0x9'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0xf457('0x2')]},'review':{'type':Sequelize[_0xf457('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xf457('0x8')](_0xf457('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xf457('0x8')](_0xf457('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xf457('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xf457('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xf457('0x8')](_0xf457('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xf457('0x8')](_0xf457('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xf457('0x8')](_0xf457('0x9'),'no'),'defaultValue':_0xf457('0x9'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0xf457('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xf457('0x8')](_0xf457('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xf457('0x8')](_0xf457('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0xf457('0xb')},'emailsubject':{'type':Sequelize[_0xf457('0x2')]},'emailbody':{'type':Sequelize[_0xf457('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xf457('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xf457('0xd')],'get':function(){return this['getDataValue'](_0xf457('0xe'))+_0xf457('0xf')+this['getDataValue'](_0xf457('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 2910b7d..7fcb2ec 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 _0xb574=['filter','merge','VoiceMail','includeAll','findAll','rows','catch','show','params','intersection','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','body','length','pick','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','get','Voicemails','error','stack','name','send','map','rawAttributes','fieldName','type','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x1347f8,_0x233feb){var _0x218368=function(_0x3f4ca3){while(--_0x3f4ca3){_0x1347f8['push'](_0x1347f8['shift']());}};_0x218368(++_0x233feb);}(_0xb574,0x106));var _0x4b57=function(_0x2cb2c2,_0x17c283){_0x2cb2c2=_0x2cb2c2-0x0;var _0x5a4a42=_0xb574[_0x2cb2c2];return _0x5a4a42;};'use strict';var emlformat=require(_0x4b57('0x0'));var rimraf=require(_0x4b57('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b57('0x2'));var rp=require(_0x4b57('0x3'));var moment=require('moment');var BPromise=require(_0x4b57('0x4'));var Mustache=require(_0x4b57('0x5'));var util=require(_0x4b57('0x6'));var path=require(_0x4b57('0x7'));var sox=require(_0x4b57('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b57('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4b57('0xa'));var toCsv=require(_0x4b57('0xb'));var querystring=require(_0x4b57('0xc'));var Papa=require(_0x4b57('0xd'));var Redis=require(_0x4b57('0xe'));var authService=require(_0x4b57('0xf'));var qs=require(_0x4b57('0x10'));var as=require(_0x4b57('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b57('0x12'))(_0x4b57('0x13'));var utils=require(_0x4b57('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4b57('0x15'))['db'];function respondWithStatusCode(_0x357c8b,_0x43d066){_0x43d066=_0x43d066||0xcc;return function(_0xf8a6fc){if(_0xf8a6fc){return _0x357c8b[_0x4b57('0x16')](_0x43d066);}return _0x357c8b[_0x4b57('0x17')](_0x43d066)[_0x4b57('0x18')]();};}function respondWithResult(_0xd5ee6d,_0x31cced){_0x31cced=_0x31cced||0xc8;return function(_0x4e15be){if(_0x4e15be){return _0xd5ee6d['status'](_0x31cced)[_0x4b57('0x19')](_0x4e15be);}};}function respondWithFilteredResult(_0x24f776,_0x10b9ff){return function(_0x58d6bd){if(_0x58d6bd){var _0x284640=typeof _0x10b9ff['offset']===_0x4b57('0x1a')&&typeof _0x10b9ff[_0x4b57('0x1b')]===_0x4b57('0x1a');var _0x10eda5=_0x58d6bd[_0x4b57('0x1c')];var _0xfb71cc=_0x284640?0x0:_0x10b9ff['offset'];var _0x1b35ff=_0x284640?_0x58d6bd[_0x4b57('0x1c')]:_0x10b9ff[_0x4b57('0x1d')]+_0x10b9ff[_0x4b57('0x1b')];var _0x4baaeb;if(_0x1b35ff>=_0x10eda5){_0x1b35ff=_0x10eda5;_0x4baaeb=0xc8;}else{_0x4baaeb=0xce;}_0x24f776[_0x4b57('0x17')](_0x4baaeb);return _0x24f776[_0x4b57('0x1e')](_0x4b57('0x1f'),_0xfb71cc+'-'+_0x1b35ff+'/'+_0x10eda5)[_0x4b57('0x19')](_0x58d6bd);}return null;};}function patchUpdates(_0xef1eae){return function(_0x4454c8){try{jsonpatch['apply'](_0x4454c8,_0xef1eae,!![]);}catch(_0x4b504b){return BPromise[_0x4b57('0x20')](_0x4b504b);}return _0x4454c8[_0x4b57('0x21')]();};}function saveUpdates(_0x567d8f,_0x380554){return function(_0x4a34b2){if(_0x4a34b2){return _0x4a34b2[_0x4b57('0x22')](_0x567d8f)[_0x4b57('0x23')](function(_0x56f017){return _0x56f017;});}return null;};}function removeEntity(_0x271361,_0x368c5f){return function(_0x4d07c9){if(_0x4d07c9){return _0x4d07c9[_0x4b57('0x24')]()[_0x4b57('0x23')](function(){var _0x25d190=_0x4d07c9[_0x4b57('0x25')]({'plain':!![]});var _0x540eff=_0x4b57('0x26');return db['UserProfileResource'][_0x4b57('0x24')]({'where':{'type':_0x540eff,'resourceId':_0x25d190['id']}})['then'](function(){return _0x4d07c9;});})[_0x4b57('0x23')](function(){_0x271361[_0x4b57('0x17')](0xcc)[_0x4b57('0x18')]();});}};}function handleEntityNotFound(_0x6584c4,_0x104f52){return function(_0x392e37){if(!_0x392e37){_0x6584c4['sendStatus'](0x194);}return _0x392e37;};}function handleError(_0x5c3c7a,_0x16d196){_0x16d196=_0x16d196||0x1f4;return function(_0x4c58e4){logger[_0x4b57('0x27')](_0x4c58e4[_0x4b57('0x28')]);if(_0x4c58e4[_0x4b57('0x29')]){delete _0x4c58e4[_0x4b57('0x29')];}_0x5c3c7a[_0x4b57('0x17')](_0x16d196)[_0x4b57('0x2a')](_0x4c58e4);};}exports['index']=function(_0xab365c,_0x2e9922){var _0x68be27={},_0x3cd331={},_0x4ccf89={'count':0x0,'rows':[]};var _0xa91ba=_[_0x4b57('0x2b')](db['VoiceMail'][_0x4b57('0x2c')],function(_0xa5b5dc){return{'name':_0xa5b5dc[_0x4b57('0x2d')],'type':_0xa5b5dc[_0x4b57('0x2e')]['key']};});_0x3cd331['model']=_['map'](_0xa91ba,_0x4b57('0x29'));_0x3cd331[_0x4b57('0x2f')]=_[_0x4b57('0x30')](_0xab365c[_0x4b57('0x2f')]);_0x3cd331[_0x4b57('0x31')]=_['intersection'](_0x3cd331[_0x4b57('0x32')],_0x3cd331[_0x4b57('0x2f')]);_0x68be27[_0x4b57('0x33')]=_['intersection'](_0x3cd331[_0x4b57('0x32')],qs[_0x4b57('0x34')](_0xab365c[_0x4b57('0x2f')]['fields']));_0x68be27[_0x4b57('0x33')]=_0x68be27[_0x4b57('0x33')]['length']?_0x68be27[_0x4b57('0x33')]:_0x3cd331[_0x4b57('0x32')];if(!_0xab365c[_0x4b57('0x2f')][_0x4b57('0x35')](_0x4b57('0x36'))){_0x68be27[_0x4b57('0x1b')]=qs['limit'](_0xab365c[_0x4b57('0x2f')][_0x4b57('0x1b')]);_0x68be27[_0x4b57('0x1d')]=qs[_0x4b57('0x1d')](_0xab365c[_0x4b57('0x2f')][_0x4b57('0x1d')]);}_0x68be27[_0x4b57('0x37')]=qs['sort'](_0xab365c['query'][_0x4b57('0x38')]);_0x68be27[_0x4b57('0x39')]=qs[_0x4b57('0x31')](_['pick'](_0xab365c[_0x4b57('0x2f')],_0x3cd331[_0x4b57('0x31')]),_0xa91ba);if(_0xab365c[_0x4b57('0x2f')][_0x4b57('0x3a')]){_0x68be27['where']=_[_0x4b57('0x3b')](_0x68be27[_0x4b57('0x39')],{'$or':_[_0x4b57('0x2b')](_0xa91ba,function(_0x2d24ab){if(_0x2d24ab['type']!=='VIRTUAL'){var _0x5d624c={};_0x5d624c[_0x2d24ab[_0x4b57('0x29')]]={'$like':'%'+_0xab365c[_0x4b57('0x2f')][_0x4b57('0x3a')]+'%'};return _0x5d624c;}})});}_0x68be27=_[_0x4b57('0x3b')]({},_0x68be27,_0xab365c['options']);var _0x445353={'where':_0x68be27[_0x4b57('0x39')]};return db[_0x4b57('0x3c')][_0x4b57('0x1c')](_0x445353)[_0x4b57('0x23')](function(_0x453129){_0x4ccf89[_0x4b57('0x1c')]=_0x453129;if(_0xab365c[_0x4b57('0x2f')][_0x4b57('0x3d')]){_0x68be27['include']=[{'all':!![]}];}return db[_0x4b57('0x3c')][_0x4b57('0x3e')](_0x68be27);})[_0x4b57('0x23')](function(_0x5b2f50){_0x4ccf89[_0x4b57('0x3f')]=_0x5b2f50;return _0x4ccf89;})['then'](respondWithFilteredResult(_0x2e9922,_0x68be27))[_0x4b57('0x40')](handleError(_0x2e9922,null));};exports[_0x4b57('0x41')]=function(_0x457273,_0x19ba66){var _0x189fd0={'raw':!![],'where':{'id':_0x457273[_0x4b57('0x42')]['id']}},_0x477352={};_0x477352[_0x4b57('0x32')]=_[_0x4b57('0x30')](db[_0x4b57('0x3c')][_0x4b57('0x2c')]);_0x477352[_0x4b57('0x2f')]=_[_0x4b57('0x30')](_0x457273['query']);_0x477352['filters']=_[_0x4b57('0x43')](_0x477352[_0x4b57('0x32')],_0x477352[_0x4b57('0x2f')]);_0x189fd0[_0x4b57('0x33')]=_['intersection'](_0x477352[_0x4b57('0x32')],qs[_0x4b57('0x34')](_0x457273['query'][_0x4b57('0x34')]));_0x189fd0['attributes']=_0x189fd0[_0x4b57('0x33')]['length']?_0x189fd0['attributes']:_0x477352[_0x4b57('0x32')];if(_0x457273[_0x4b57('0x2f')]['includeAll']){_0x189fd0[_0x4b57('0x44')]=[{'all':!![]}];}_0x189fd0=_[_0x4b57('0x3b')]({},_0x189fd0,_0x457273[_0x4b57('0x45')]);return db[_0x4b57('0x3c')][_0x4b57('0x46')](_0x189fd0)[_0x4b57('0x23')](handleEntityNotFound(_0x19ba66,null))['then'](respondWithResult(_0x19ba66,null))[_0x4b57('0x40')](handleError(_0x19ba66,null));};exports[_0x4b57('0x47')]=function(_0x4a632c,_0xd529fb){return db[_0x4b57('0x3c')][_0x4b57('0x47')](_0x4a632c['body'],{})[_0x4b57('0x23')](function(_0x5cba5f){var _0x213dca=_0x4a632c[_0x4b57('0x48')][_0x4b57('0x25')]({'plain':!![]});if(!_0x213dca)throw new Error(_0x4b57('0x49'));if(_0x213dca[_0x4b57('0x4a')]===_0x4b57('0x48')){var _0x3d1ecd=_0x5cba5f[_0x4b57('0x25')]({'plain':!![]});var _0x5ab120=_0x4b57('0x26');return db[_0x4b57('0x4b')][_0x4b57('0x46')]({'where':{'name':_0x5ab120,'userProfileId':_0x213dca['userProfileId']},'raw':!![]})[_0x4b57('0x23')](function(_0xcf72b6){if(_0xcf72b6&&_0xcf72b6[_0x4b57('0x4c')]===0x0){return db['UserProfileResource'][_0x4b57('0x47')]({'name':_0x3d1ecd[_0x4b57('0x29')],'resourceId':_0x3d1ecd['id'],'type':_0xcf72b6[_0x4b57('0x29')],'sectionId':_0xcf72b6['id']},{})[_0x4b57('0x23')](function(){return _0x5cba5f;});}else{return _0x5cba5f;}})[_0x4b57('0x40')](function(_0xb7c37c){logger[_0x4b57('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb7c37c);throw _0xb7c37c;});}return _0x5cba5f;})['then'](respondWithResult(_0xd529fb,0xc9))[_0x4b57('0x40')](handleError(_0xd529fb,null));};exports[_0x4b57('0x22')]=function(_0x3b4cbf,_0x2e64c2){if(_0x3b4cbf['body']['id']){delete _0x3b4cbf[_0x4b57('0x4d')]['id'];}return db[_0x4b57('0x3c')][_0x4b57('0x46')]({'where':{'id':_0x3b4cbf[_0x4b57('0x42')]['id']}})['then'](handleEntityNotFound(_0x2e64c2,null))['then'](saveUpdates(_0x3b4cbf[_0x4b57('0x4d')],null))[_0x4b57('0x23')](respondWithResult(_0x2e64c2,null))['catch'](handleError(_0x2e64c2,null));};exports['destroy']=function(_0x451737,_0x5c1082){return db[_0x4b57('0x3c')][_0x4b57('0x46')]({'where':{'id':_0x451737[_0x4b57('0x42')]['id']}})[_0x4b57('0x23')](handleEntityNotFound(_0x5c1082,null))[_0x4b57('0x23')](removeEntity(_0x5c1082,null))['catch'](handleError(_0x5c1082,null));};exports['getMessages']=function(_0x54ff9d,_0x4c241a,_0x179802){return db[_0x4b57('0x3c')]['findOne']({'where':{'id':_0x54ff9d[_0x4b57('0x42')]['id']}})[_0x4b57('0x23')](handleEntityNotFound(_0x4c241a,null))[_0x4b57('0x23')](function(_0x9ed750){var _0x64b0fd;var _0x1fcc10={},_0xf1bf63={};_0xf1bf63[_0x4b57('0x32')]=_[_0x4b57('0x30')](db['VoiceMailMessage'][_0x4b57('0x2c')]);_0xf1bf63['query']=_[_0x4b57('0x30')](_0x54ff9d[_0x4b57('0x2f')]);_0xf1bf63['filters']=_[_0x4b57('0x43')](_0xf1bf63[_0x4b57('0x32')],_0xf1bf63[_0x4b57('0x2f')]);_0x1fcc10[_0x4b57('0x33')]=_[_0x4b57('0x43')](_0xf1bf63[_0x4b57('0x32')],qs[_0x4b57('0x34')](_0x54ff9d[_0x4b57('0x2f')][_0x4b57('0x34')]));_0x1fcc10[_0x4b57('0x33')]=_0x1fcc10[_0x4b57('0x33')][_0x4b57('0x4e')]?_0x1fcc10['attributes']:_0xf1bf63[_0x4b57('0x32')];if(!_0x54ff9d[_0x4b57('0x2f')]['hasOwnProperty'](_0x4b57('0x36'))){_0x1fcc10['limit']=qs['limit'](_0x54ff9d['query'][_0x4b57('0x1b')]);_0x1fcc10['offset']=qs[_0x4b57('0x1d')](_0x54ff9d[_0x4b57('0x2f')]['offset']);}_0x1fcc10['order']=qs[_0x4b57('0x38')](_0x54ff9d[_0x4b57('0x2f')][_0x4b57('0x38')]);_0x1fcc10['where']=qs[_0x4b57('0x31')](_[_0x4b57('0x4f')](_0x54ff9d['query'],_0xf1bf63[_0x4b57('0x31')]));if(_0x54ff9d[_0x4b57('0x2f')]['filter']){_0x1fcc10[_0x4b57('0x39')]=_[_0x4b57('0x3b')](_0x1fcc10[_0x4b57('0x39')],{'$or':_[_0x4b57('0x2b')](_0x1fcc10[_0x4b57('0x33')],function(_0x5d9dd5){var _0x2112d5={};_0x2112d5[_0x5d9dd5]={'$like':'%'+_0x54ff9d['query']['filter']+'%'};return _0x2112d5;})});}_0x1fcc10[_0x4b57('0x39')]=_[_0x4b57('0x3b')](_0x1fcc10['where'],{'mailboxuser':_0x9ed750['mailbox']});_0x1fcc10=_[_0x4b57('0x3b')]({},_0x1fcc10,_0x54ff9d[_0x4b57('0x45')]);return db['VoiceMailMessage']['findAndCountAll'](_0x1fcc10)['then'](respondWithFilteredResult(_0x4c241a,_0x1fcc10));})[_0x4b57('0x40')](handleError(_0x4c241a,null));}; \ No newline at end of file +var _0xb10b=['attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','type','merge','options','VoiceMail','include','findAll','rows','includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Voicemails','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','findOne','VoiceMailMessage','rawAttributes','mailbox','findAndCountAll','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','get','end','error','stack','name','send','map','fieldName','key','model','query','keys','intersection'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb10b,0x12a));var _0xbb10=function(_0x48ea38,_0xb5b397){_0x48ea38=_0x48ea38-0x0;var _0xa6780=_0xb10b[_0x48ea38];return _0xa6780;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){var _0x3ba6cd=_0x436104[_0xbb10('0x25')]({'plain':!![]});var _0x537898='Voicemails';return db['UserProfileResource'][_0xbb10('0x24')]({'where':{'type':_0x537898,'resourceId':_0x3ba6cd['id']}})[_0xbb10('0x23')](function(){return _0x436104;});})[_0xbb10('0x23')](function(){_0x1824b7['status'](0xcc)[_0xbb10('0x26')]();});}};}function handleEntityNotFound(_0x24d586,_0x6ed43b){return function(_0x1d5e95){if(!_0x1d5e95){_0x24d586[_0xbb10('0x18')](0x194);}return _0x1d5e95;};}function handleError(_0x20d946,_0x2a0e8b){_0x2a0e8b=_0x2a0e8b||0x1f4;return function(_0x4aabb9){logger[_0xbb10('0x27')](_0x4aabb9[_0xbb10('0x28')]);if(_0x4aabb9[_0xbb10('0x29')]){delete _0x4aabb9[_0xbb10('0x29')];}_0x20d946[_0xbb10('0x19')](_0x2a0e8b)[_0xbb10('0x2a')](_0x4aabb9);};}exports['index']=function(_0x221624,_0x4ee02e){var _0x448d5c={},_0x56f2da={},_0x16ad2a={'count':0x0,'rows':[]};var _0x1dcc9c=_[_0xbb10('0x2b')](db['VoiceMail']['rawAttributes'],function(_0x4c3744){return{'name':_0x4c3744[_0xbb10('0x2c')],'type':_0x4c3744['type'][_0xbb10('0x2d')]};});_0x56f2da[_0xbb10('0x2e')]=_[_0xbb10('0x2b')](_0x1dcc9c,_0xbb10('0x29'));_0x56f2da[_0xbb10('0x2f')]=_[_0xbb10('0x30')](_0x221624[_0xbb10('0x2f')]);_0x56f2da['filters']=_[_0xbb10('0x31')](_0x56f2da[_0xbb10('0x2e')],_0x56f2da[_0xbb10('0x2f')]);_0x448d5c[_0xbb10('0x32')]=_[_0xbb10('0x31')](_0x56f2da[_0xbb10('0x2e')],qs[_0xbb10('0x33')](_0x221624[_0xbb10('0x2f')][_0xbb10('0x33')]));_0x448d5c['attributes']=_0x448d5c[_0xbb10('0x32')][_0xbb10('0x34')]?_0x448d5c[_0xbb10('0x32')]:_0x56f2da[_0xbb10('0x2e')];if(!_0x221624['query'][_0xbb10('0x35')]('nolimit')){_0x448d5c['limit']=qs[_0xbb10('0x1c')](_0x221624[_0xbb10('0x2f')][_0xbb10('0x1c')]);_0x448d5c[_0xbb10('0x1b')]=qs[_0xbb10('0x1b')](_0x221624[_0xbb10('0x2f')]['offset']);}_0x448d5c[_0xbb10('0x36')]=qs[_0xbb10('0x37')](_0x221624['query']['sort']);_0x448d5c['where']=qs[_0xbb10('0x38')](_[_0xbb10('0x39')](_0x221624[_0xbb10('0x2f')],_0x56f2da['filters']),_0x1dcc9c);if(_0x221624[_0xbb10('0x2f')][_0xbb10('0x3a')]){_0x448d5c[_0xbb10('0x3b')]=_['merge'](_0x448d5c[_0xbb10('0x3b')],{'$or':_[_0xbb10('0x2b')](_0x1dcc9c,function(_0x1dcd38){if(_0x1dcd38[_0xbb10('0x3c')]!=='VIRTUAL'){var _0xd238e9={};_0xd238e9[_0x1dcd38[_0xbb10('0x29')]]={'$like':'%'+_0x221624['query'][_0xbb10('0x3a')]+'%'};return _0xd238e9;}})});}_0x448d5c=_[_0xbb10('0x3d')]({},_0x448d5c,_0x221624[_0xbb10('0x3e')]);var _0x3a9934={'where':_0x448d5c[_0xbb10('0x3b')]};return db[_0xbb10('0x3f')]['count'](_0x3a9934)[_0xbb10('0x23')](function(_0x1c7fae){_0x16ad2a[_0xbb10('0x1e')]=_0x1c7fae;if(_0x221624[_0xbb10('0x2f')]['includeAll']){_0x448d5c[_0xbb10('0x40')]=[{'all':!![]}];}return db[_0xbb10('0x3f')][_0xbb10('0x41')](_0x448d5c);})[_0xbb10('0x23')](function(_0x5e2cfa){_0x16ad2a[_0xbb10('0x42')]=_0x5e2cfa;return _0x16ad2a;})[_0xbb10('0x23')](respondWithFilteredResult(_0x4ee02e,_0x448d5c))['catch'](handleError(_0x4ee02e,null));};exports['show']=function(_0x38d78f,_0x4a3ddf){var _0x318984={'raw':!![],'where':{'id':_0x38d78f['params']['id']}},_0x180933={};_0x180933[_0xbb10('0x2e')]=_[_0xbb10('0x30')](db[_0xbb10('0x3f')]['rawAttributes']);_0x180933[_0xbb10('0x2f')]=_[_0xbb10('0x30')](_0x38d78f[_0xbb10('0x2f')]);_0x180933[_0xbb10('0x38')]=_[_0xbb10('0x31')](_0x180933[_0xbb10('0x2e')],_0x180933[_0xbb10('0x2f')]);_0x318984[_0xbb10('0x32')]=_[_0xbb10('0x31')](_0x180933[_0xbb10('0x2e')],qs[_0xbb10('0x33')](_0x38d78f[_0xbb10('0x2f')]['fields']));_0x318984[_0xbb10('0x32')]=_0x318984[_0xbb10('0x32')]['length']?_0x318984[_0xbb10('0x32')]:_0x180933[_0xbb10('0x2e')];if(_0x38d78f[_0xbb10('0x2f')][_0xbb10('0x43')]){_0x318984[_0xbb10('0x40')]=[{'all':!![]}];}_0x318984=_[_0xbb10('0x3d')]({},_0x318984,_0x38d78f[_0xbb10('0x3e')]);return db['VoiceMail']['find'](_0x318984)[_0xbb10('0x23')](handleEntityNotFound(_0x4a3ddf,null))[_0xbb10('0x23')](respondWithResult(_0x4a3ddf,null))[_0xbb10('0x44')](handleError(_0x4a3ddf,null));};exports['create']=function(_0x5f0c12,_0x3cd6f3){return db[_0xbb10('0x3f')][_0xbb10('0x45')](_0x5f0c12[_0xbb10('0x46')],{})[_0xbb10('0x23')](function(_0x22b315){var _0x2f2552=_0x5f0c12[_0xbb10('0x47')][_0xbb10('0x25')]({'plain':!![]});if(!_0x2f2552)throw new Error(_0xbb10('0x48'));if(_0x2f2552['role']==='user'){var _0x412e13=_0x22b315[_0xbb10('0x25')]({'plain':!![]});var _0x36ab7d=_0xbb10('0x49');return db[_0xbb10('0x4a')][_0xbb10('0x4b')]({'where':{'name':_0x36ab7d,'userProfileId':_0x2f2552[_0xbb10('0x4c')]},'raw':!![]})[_0xbb10('0x23')](function(_0x1c0d8f){if(_0x1c0d8f&&_0x1c0d8f[_0xbb10('0x4d')]===0x0){return db[_0xbb10('0x4e')][_0xbb10('0x45')]({'name':_0x412e13[_0xbb10('0x29')],'resourceId':_0x412e13['id'],'type':_0x1c0d8f[_0xbb10('0x29')],'sectionId':_0x1c0d8f['id']},{})[_0xbb10('0x23')](function(){return _0x22b315;});}else{return _0x22b315;}})['catch'](function(_0x124052){logger['error'](_0xbb10('0x4f'),_0x124052);throw _0x124052;});}return _0x22b315;})[_0xbb10('0x23')](respondWithResult(_0x3cd6f3,0xc9))[_0xbb10('0x44')](handleError(_0x3cd6f3,null));};exports[_0xbb10('0x22')]=function(_0x26e66e,_0x32d8e9){if(_0x26e66e[_0xbb10('0x46')]['id']){delete _0x26e66e[_0xbb10('0x46')]['id'];}return db[_0xbb10('0x3f')][_0xbb10('0x4b')]({'where':{'id':_0x26e66e[_0xbb10('0x50')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x32d8e9,null))[_0xbb10('0x23')](saveUpdates(_0x26e66e[_0xbb10('0x46')],null))[_0xbb10('0x23')](respondWithResult(_0x32d8e9,null))['catch'](handleError(_0x32d8e9,null));};exports[_0xbb10('0x24')]=function(_0x466eb7,_0x1b83a9){return db[_0xbb10('0x3f')][_0xbb10('0x4b')]({'where':{'id':_0x466eb7[_0xbb10('0x50')]['id']}})['then'](handleEntityNotFound(_0x1b83a9,null))[_0xbb10('0x23')](removeEntity(_0x1b83a9,null))[_0xbb10('0x44')](handleError(_0x1b83a9,null));};exports[_0xbb10('0x51')]=function(_0x14fed3,_0x432728,_0x22de7f){return db[_0xbb10('0x3f')][_0xbb10('0x52')]({'where':{'id':_0x14fed3[_0xbb10('0x50')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x432728,null))[_0xbb10('0x23')](function(_0x2a1ce1){var _0x16932f;var _0x4e7fac={},_0x4ea1a6={};_0x4ea1a6[_0xbb10('0x2e')]=_[_0xbb10('0x30')](db[_0xbb10('0x53')][_0xbb10('0x54')]);_0x4ea1a6['query']=_['keys'](_0x14fed3[_0xbb10('0x2f')]);_0x4ea1a6[_0xbb10('0x38')]=_[_0xbb10('0x31')](_0x4ea1a6[_0xbb10('0x2e')],_0x4ea1a6[_0xbb10('0x2f')]);_0x4e7fac[_0xbb10('0x32')]=_[_0xbb10('0x31')](_0x4ea1a6['model'],qs[_0xbb10('0x33')](_0x14fed3[_0xbb10('0x2f')]['fields']));_0x4e7fac['attributes']=_0x4e7fac['attributes'][_0xbb10('0x34')]?_0x4e7fac[_0xbb10('0x32')]:_0x4ea1a6[_0xbb10('0x2e')];if(!_0x14fed3['query']['hasOwnProperty']('nolimit')){_0x4e7fac[_0xbb10('0x1c')]=qs[_0xbb10('0x1c')](_0x14fed3[_0xbb10('0x2f')]['limit']);_0x4e7fac[_0xbb10('0x1b')]=qs[_0xbb10('0x1b')](_0x14fed3['query']['offset']);}_0x4e7fac[_0xbb10('0x36')]=qs[_0xbb10('0x37')](_0x14fed3[_0xbb10('0x2f')][_0xbb10('0x37')]);_0x4e7fac['where']=qs[_0xbb10('0x38')](_[_0xbb10('0x39')](_0x14fed3[_0xbb10('0x2f')],_0x4ea1a6['filters']));if(_0x14fed3[_0xbb10('0x2f')][_0xbb10('0x3a')]){_0x4e7fac[_0xbb10('0x3b')]=_['merge'](_0x4e7fac[_0xbb10('0x3b')],{'$or':_[_0xbb10('0x2b')](_0x4e7fac[_0xbb10('0x32')],function(_0x37b65f){var _0x5e4a6e={};_0x5e4a6e[_0x37b65f]={'$like':'%'+_0x14fed3[_0xbb10('0x2f')][_0xbb10('0x3a')]+'%'};return _0x5e4a6e;})});}_0x4e7fac[_0xbb10('0x3b')]=_[_0xbb10('0x3d')](_0x4e7fac['where'],{'mailboxuser':_0x2a1ce1[_0xbb10('0x55')]});_0x4e7fac=_[_0xbb10('0x3d')]({},_0x4e7fac,_0x14fed3[_0xbb10('0x3e')]);return db[_0xbb10('0x53')][_0xbb10('0x56')](_0x4e7fac)[_0xbb10('0x23')](respondWithFilteredResult(_0x432728,_0x4e7fac));})[_0xbb10('0x44')](handleError(_0x432728,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 6d57db6..ab5a9a2 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 _0x0010=['api','bluebird','path','rimraf','../../config/environment','./voiceMail.attributes','define','VoiceMail','voice_voicemail','lodash','util','../../config/logger'];(function(_0x55b69e,_0x3ce1f9){var _0x403210=function(_0x479718){while(--_0x479718){_0x55b69e['push'](_0x55b69e['shift']());}};_0x403210(++_0x3ce1f9);}(_0x0010,0xe1));var _0x0001=function(_0x6cf138,_0x4a24d3){_0x6cf138=_0x6cf138-0x0;var _0x9d9c29=_0x0010[_0x6cf138];return _0x9d9c29;};'use strict';var _=require(_0x0001('0x0'));var util=require(_0x0001('0x1'));var logger=require(_0x0001('0x2'))(_0x0001('0x3'));var moment=require('moment');var BPromise=require(_0x0001('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0001('0x5'));var rimraf=require(_0x0001('0x6'));var config=require(_0x0001('0x7'));var attributes=require(_0x0001('0x8'));module['exports']=function(_0xc50962,_0xb23a0e){return _0xc50962[_0x0001('0x9')](_0x0001('0xa'),attributes,{'tableName':_0x0001('0xb'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox','context']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf7c5=['moment','bluebird','request-promise','path','rimraf','./voiceMail.attributes','exports','define','voice_voicemail','mailbox_context','mailbox','context','lodash','util','api'];(function(_0x5bad0d,_0x134353){var _0x58d604=function(_0x39920e){while(--_0x39920e){_0x5bad0d['push'](_0x5bad0d['shift']());}};_0x58d604(++_0x134353);}(_0xf7c5,0x75));var _0x5f7c=function(_0x770f7,_0x3af003){_0x770f7=_0x770f7-0x0;var _0xe797c6=_0xf7c5[_0x770f7];return _0xe797c6;};'use strict';var _=require(_0x5f7c('0x0'));var util=require(_0x5f7c('0x1'));var logger=require('../../config/logger')(_0x5f7c('0x2'));var moment=require(_0x5f7c('0x3'));var BPromise=require(_0x5f7c('0x4'));var rp=require(_0x5f7c('0x5'));var fs=require('fs');var path=require(_0x5f7c('0x6'));var rimraf=require(_0x5f7c('0x7'));var config=require('../../config/environment');var attributes=require(_0x5f7c('0x8'));module[_0x5f7c('0x9')]=function(_0x163025,_0x43a22b){return _0x163025[_0x5f7c('0xa')]('VoiceMail',attributes,{'tableName':_0x5f7c('0xb'),'paranoid':![],'indexes':[{'name':_0x5f7c('0xc'),'fields':[_0x5f7c('0xd'),_0x5f7c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 4a95514..8d202f7 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 _0x0953=['info','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','VoiceMail,\x20%s,\x20%s','message'];(function(_0x3e961c,_0x5747e7){var _0x474f9c=function(_0x33f8ea){while(--_0x33f8ea){_0x3e961c['push'](_0x3e961c['shift']());}};_0x474f9c(++_0x5747e7);}(_0x0953,0x113));var _0x3095=function(_0x1fc84d,_0x3f469d){_0x1fc84d=_0x1fc84d-0x0;var _0x2658fa=_0x0953[_0x1fc84d];return _0x2658fa;};'use strict';var _=require('lodash');var util=require(_0x3095('0x0'));var moment=require('moment');var BPromise=require(_0x3095('0x1'));var rs=require(_0x3095('0x2'));var fs=require('fs');var Redis=require(_0x3095('0x3'));var db=require(_0x3095('0x4'))['db'];var utils=require(_0x3095('0x5'));var logger=require(_0x3095('0x6'))(_0x3095('0x7'));var config=require('../../config/environment');var jayson=require(_0x3095('0x8'));var client=jayson[_0x3095('0x9')][_0x3095('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47ef82,_0xff4580,_0x3f43fc){return new BPromise(function(_0x84f10f,_0x4a1c6f){return client[_0x3095('0xb')](_0x47ef82,_0x3f43fc)['then'](function(_0x1b3582){logger['info']('VoiceMail,\x20%s,\x20%s',_0xff4580,_0x3095('0xc'));logger[_0x3095('0xd')](_0x3095('0xe'),_0xff4580,_0x3095('0xc'),JSON['stringify'](_0x1b3582));if(_0x1b3582['error']){if(_0x1b3582[_0x3095('0xf')][_0x3095('0x10')]===0x1f4){logger[_0x3095('0xf')](_0x3095('0x11'),_0xff4580,_0x1b3582[_0x3095('0xf')][_0x3095('0x12')]);return _0x4a1c6f(_0x1b3582[_0x3095('0xf')][_0x3095('0x12')]);}logger['error'](_0x3095('0x11'),_0xff4580,_0x1b3582[_0x3095('0xf')][_0x3095('0x12')]);return _0x84f10f(_0x1b3582[_0x3095('0xf')]['message']);}else{logger[_0x3095('0x13')](_0x3095('0x11'),_0xff4580,_0x3095('0xc'));_0x84f10f(_0x1b3582['result'][_0x3095('0x12')]);}})[_0x3095('0x14')](function(_0x524646){logger[_0x3095('0xf')]('VoiceMail,\x20%s,\x20%s',_0xff4580,_0x524646);_0x4a1c6f(_0x524646);});});} \ No newline at end of file +var _0x199d=['VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x14cc30,_0xd574b){var _0x3ad39c=function(_0x58bc4f){while(--_0x58bc4f){_0x14cc30['push'](_0x14cc30['shift']());}};_0x3ad39c(++_0xd574b);}(_0x199d,0x1ba));var _0xd199=function(_0x1af98d,_0x3c608e){_0x1af98d=_0x1af98d-0x0;var _0x3553ea=_0x199d[_0x1af98d];return _0x3553ea;};'use strict';var _=require(_0xd199('0x0'));var util=require(_0xd199('0x1'));var moment=require(_0xd199('0x2'));var BPromise=require('bluebird');var rs=require(_0xd199('0x3'));var fs=require('fs');var Redis=require(_0xd199('0x4'));var db=require(_0xd199('0x5'))['db'];var utils=require(_0xd199('0x6'));var logger=require('../../config/logger')(_0xd199('0x7'));var config=require(_0xd199('0x8'));var jayson=require(_0xd199('0x9'));var client=jayson[_0xd199('0xa')][_0xd199('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40612a,_0x37cf66,_0x4fc881){return new BPromise(function(_0x28fe8a,_0x3039be){return client['request'](_0x40612a,_0x4fc881)[_0xd199('0xc')](function(_0x281cb2){logger[_0xd199('0xd')](_0xd199('0xe'),_0x37cf66,_0xd199('0xf'));logger[_0xd199('0x10')](_0xd199('0x11'),_0x37cf66,'request\x20sent',JSON[_0xd199('0x12')](_0x281cb2));if(_0x281cb2[_0xd199('0x13')]){if(_0x281cb2['error'][_0xd199('0x14')]===0x1f4){logger['error'](_0xd199('0xe'),_0x37cf66,_0x281cb2[_0xd199('0x13')]['message']);return _0x3039be(_0x281cb2[_0xd199('0x13')][_0xd199('0x15')]);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x37cf66,_0x281cb2[_0xd199('0x13')][_0xd199('0x15')]);return _0x28fe8a(_0x281cb2[_0xd199('0x13')][_0xd199('0x15')]);}else{logger[_0xd199('0xd')](_0xd199('0xe'),_0x37cf66,_0xd199('0xf'));_0x28fe8a(_0x281cb2[_0xd199('0x16')][_0xd199('0x15')]);}})[_0xd199('0x17')](function(_0x51c5e6){logger[_0xd199('0x13')](_0xd199('0xe'),_0x37cf66,_0x51c5e6);_0x3039be(_0x51c5e6);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index bb129d4..692d9fe 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 _0xe7f1=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','download','create','put','delete','exports','util'];(function(_0x4d8a8f,_0x2afd4c){var _0xfc4adc=function(_0xb89886){while(--_0xb89886){_0x4d8a8f['push'](_0x4d8a8f['shift']());}};_0xfc4adc(++_0x2afd4c);}(_0xe7f1,0x1c1));var _0x1e7f=function(_0x4f2e7b,_0x31a091){_0x4f2e7b=_0x4f2e7b-0x0;var _0x49a09f=_0xe7f1[_0x4f2e7b];return _0x49a09f;};'use strict';var multer=require('multer');var util=require(_0x1e7f('0x0'));var path=require(_0x1e7f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1e7f('0x2')]();var fs_extra=require(_0x1e7f('0x3'));var auth=require(_0x1e7f('0x4'));var interaction=require(_0x1e7f('0x5'));var config=require(_0x1e7f('0x6'));var controller=require('./voiceMailMessage.controller');router[_0x1e7f('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x1e7f('0x8'),auth[_0x1e7f('0x9')](),controller['show']);router[_0x1e7f('0x7')]('/:id/download',auth[_0x1e7f('0x9')](),controller[_0x1e7f('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1e7f('0xb')]);router[_0x1e7f('0xc')](_0x1e7f('0x8'),auth[_0x1e7f('0x9')](),controller['update']);router[_0x1e7f('0xd')](_0x1e7f('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x1e7f('0xe')]=router; \ No newline at end of file +var _0x91c1=['fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','post','update','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x128caf,_0x1eac2e){var _0x25a6e3=function(_0x15287a){while(--_0x15287a){_0x128caf['push'](_0x128caf['shift']());}};_0x25a6e3(++_0x1eac2e);}(_0x91c1,0x79));var _0x191c=function(_0x11dc39,_0x491115){_0x11dc39=_0x11dc39-0x0;var _0x457277=_0x91c1[_0x11dc39];return _0x457277;};'use strict';var multer=require(_0x191c('0x0'));var util=require(_0x191c('0x1'));var path=require(_0x191c('0x2'));var timeout=require(_0x191c('0x3'));var express=require('express');var router=express[_0x191c('0x4')]();var fs_extra=require(_0x191c('0x5'));var auth=require(_0x191c('0x6'));var interaction=require(_0x191c('0x7'));var config=require('../../config/environment');var controller=require(_0x191c('0x8'));router[_0x191c('0x9')]('/',auth['isAuthenticated'](),controller[_0x191c('0xa')]);router[_0x191c('0x9')](_0x191c('0xb'),auth[_0x191c('0xc')](),controller[_0x191c('0xd')]);router[_0x191c('0x9')](_0x191c('0xe'),auth['isAuthenticated'](),controller[_0x191c('0xf')]);router[_0x191c('0x10')]('/',auth[_0x191c('0xc')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x191c('0x11')]);router[_0x191c('0x12')]('/:id',auth[_0x191c('0xc')](),controller[_0x191c('0x13')]);module[_0x191c('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index a0cb0a9..e026f1a 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 _0x1dab=['sequelize','exports','INTEGER','STRING','BLOB','long','TIMESTAMP','literal'];(function(_0x29c99d,_0x1e6b61){var _0x263260=function(_0x31f425){while(--_0x31f425){_0x29c99d['push'](_0x29c99d['shift']());}};_0x263260(++_0x1e6b61);}(_0x1dab,0x140));var _0xb1da=function(_0x29bfda,_0x30ad24){_0x29bfda=_0x29bfda-0x0;var _0x3f3db5=_0x1dab[_0x29bfda];return _0x3f3db5;};'use strict';var Sequelize=require(_0xb1da('0x0'));module[_0xb1da('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x147b2d){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xb1da('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xb1da('0x3')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xb1da('0x3')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xb1da('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xb1da('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xb1da('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xb1da('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xb1da('0x4')](_0xb1da('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xb1da('0x3')],'defaultValue':''},'stamp':{'type':_0xb1da('0x6'),'defaultValue':Sequelize[_0xb1da('0x7')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x3675=['literal','exports','getDataValue','STRING','BLOB','long','TIMESTAMP'];(function(_0x12e238,_0x3300f9){var _0x940010=function(_0x1508c9){while(--_0x1508c9){_0x12e238['push'](_0x12e238['shift']());}};_0x940010(++_0x3300f9);}(_0x3675,0x10b));var _0x5367=function(_0x35a140,_0x3aeac6){_0x35a140=_0x35a140-0x0;var _0x30ab82=_0x3675[_0x35a140];return _0x30ab82;};'use strict';var Sequelize=require('sequelize');module[_0x5367('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x58959f){return this[_0x5367('0x1')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x5367('0x2')],'defaultValue':''},'context':{'type':Sequelize[_0x5367('0x2')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x5367('0x2')],'defaultValue':''},'origtime':{'type':Sequelize[_0x5367('0x2')],'defaultValue':''},'duration':{'type':Sequelize[_0x5367('0x2')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x5367('0x2')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x5367('0x2')],'defaultValue':''},'recording':{'type':Sequelize[_0x5367('0x3')](_0x5367('0x4')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x5367('0x2')],'defaultValue':''},'stamp':{'type':_0x5367('0x5'),'defaultValue':Sequelize[_0x5367('0x6')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 5fd3929..a184af6 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 _0x411d=['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/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','VoiceMailMessage','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','pick','where','VIRTUAL','filter','options','includeAll','include','catch','show','keys','merge','find','create','body','params','download','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','recording','eml-format','fast-json-patch','request-promise','moment','bluebird'];(function(_0x2cdfbd,_0x11fe4f){var _0x430aa4=function(_0x551b8d){while(--_0x551b8d){_0x2cdfbd['push'](_0x2cdfbd['shift']());}};_0x430aa4(++_0x11fe4f);}(_0x411d,0x153));var _0xd411=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x411d[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0xd411('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd411('0x1'));var rp=require(_0xd411('0x2'));var moment=require(_0xd411('0x3'));var BPromise=require(_0xd411('0x4'));var Mustache=require(_0xd411('0x5'));var util=require('util');var path=require(_0xd411('0x6'));var sox=require(_0xd411('0x7'));var csv=require(_0xd411('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd411('0x9'));var _=require('lodash');var squel=require(_0xd411('0xa'));var crypto=require(_0xd411('0xb'));var jsforce=require(_0xd411('0xc'));var deskjs=require(_0xd411('0xd'));var toCsv=require(_0xd411('0x8'));var querystring=require(_0xd411('0xe'));var Papa=require(_0xd411('0xf'));var Redis=require(_0xd411('0x10'));var authService=require(_0xd411('0x11'));var qs=require(_0xd411('0x12'));var as=require(_0xd411('0x13'));var hardwareService=require(_0xd411('0x14'));var logger=require(_0xd411('0x15'))('api');var utils=require(_0xd411('0x16'));var config=require(_0xd411('0x17'));var licenseUtil=require(_0xd411('0x18'));var db=require(_0xd411('0x19'))['db'];function respondWithStatusCode(_0x97b67d,_0x4cd277){_0x4cd277=_0x4cd277||0xcc;return function(_0x575f38){if(_0x575f38){return _0x97b67d[_0xd411('0x1a')](_0x4cd277);}return _0x97b67d[_0xd411('0x1b')](_0x4cd277)['end']();};}function respondWithResult(_0x23cd81,_0x4b4a55){_0x4b4a55=_0x4b4a55||0xc8;return function(_0x48f9d3){if(_0x48f9d3){return _0x23cd81[_0xd411('0x1b')](_0x4b4a55)[_0xd411('0x1c')](_0x48f9d3);}};}function respondWithFilteredResult(_0x23103d,_0x46e51a){return function(_0x78c566){if(_0x78c566){var _0x4c0430=typeof _0x46e51a[_0xd411('0x1d')]===_0xd411('0x1e')&&typeof _0x46e51a['limit']===_0xd411('0x1e');var _0x33dea1=_0x78c566['count'];var _0x3e9146=_0x4c0430?0x0:_0x46e51a[_0xd411('0x1d')];var _0xc0e040=_0x4c0430?_0x78c566[_0xd411('0x1f')]:_0x46e51a['offset']+_0x46e51a['limit'];var _0x1fa9f;if(_0xc0e040>=_0x33dea1){_0xc0e040=_0x33dea1;_0x1fa9f=0xc8;}else{_0x1fa9f=0xce;}_0x23103d['status'](_0x1fa9f);return _0x23103d[_0xd411('0x20')](_0xd411('0x21'),_0x3e9146+'-'+_0xc0e040+'/'+_0x33dea1)[_0xd411('0x1c')](_0x78c566);}return null;};}function patchUpdates(_0xfb7fa1){return function(_0x1589b8){try{jsonpatch[_0xd411('0x22')](_0x1589b8,_0xfb7fa1,!![]);}catch(_0x3ba3b1){return BPromise['reject'](_0x3ba3b1);}return _0x1589b8[_0xd411('0x23')]();};}function saveUpdates(_0xbd5613,_0x93060c){return function(_0x51fd87){if(_0x51fd87){return _0x51fd87[_0xd411('0x24')](_0xbd5613)[_0xd411('0x25')](function(_0x304231){return _0x304231;});}return null;};}function removeEntity(_0x57efa6,_0x105fe0){return function(_0xea9b30){if(_0xea9b30){return _0xea9b30[_0xd411('0x26')]()[_0xd411('0x25')](function(){_0x57efa6['status'](0xcc)[_0xd411('0x27')]();});}};}function handleEntityNotFound(_0x4a481d,_0x415a0f){return function(_0x91a95f){if(!_0x91a95f){_0x4a481d[_0xd411('0x1a')](0x194);}return _0x91a95f;};}function handleError(_0x14d2a3,_0x4add25){_0x4add25=_0x4add25||0x1f4;return function(_0x327ac8){logger[_0xd411('0x28')](_0x327ac8[_0xd411('0x29')]);if(_0x327ac8[_0xd411('0x2a')]){delete _0x327ac8['name'];}_0x14d2a3['status'](_0x4add25)[_0xd411('0x2b')](_0x327ac8);};}exports['index']=function(_0x211561,_0x555d34){var _0x400c6f={},_0x6af54e={},_0x292dc0={'count':0x0,'rows':[]};var _0x42adf9=_['map'](db[_0xd411('0x2c')][_0xd411('0x2d')],function(_0x1ee0c9){return{'name':_0x1ee0c9[_0xd411('0x2e')],'type':_0x1ee0c9[_0xd411('0x2f')][_0xd411('0x30')]};});_0x6af54e[_0xd411('0x31')]=_['differenceBy'](_[_0xd411('0x32')](_0x42adf9,'name'),[_0xd411('0x2a')]);_0x6af54e[_0xd411('0x33')]=_['keys'](_0x211561['query']);_0x6af54e[_0xd411('0x34')]=_[_0xd411('0x35')](_0x6af54e[_0xd411('0x31')],_0x6af54e[_0xd411('0x33')]);_0x400c6f['attributes']=_[_0xd411('0x35')](_0x6af54e[_0xd411('0x31')],qs[_0xd411('0x36')](_0x211561['query'][_0xd411('0x36')]));_0x400c6f[_0xd411('0x37')]=_0x400c6f['attributes'][_0xd411('0x38')]?_0x400c6f[_0xd411('0x37')]:_0x6af54e['model'];if(!_0x211561[_0xd411('0x33')][_0xd411('0x39')]('nolimit')){_0x400c6f[_0xd411('0x3a')]=qs[_0xd411('0x3a')](_0x211561[_0xd411('0x33')][_0xd411('0x3a')]);_0x400c6f[_0xd411('0x1d')]=qs[_0xd411('0x1d')](_0x211561[_0xd411('0x33')][_0xd411('0x1d')]);}_0x400c6f[_0xd411('0x3b')]=qs['sort'](_0x211561[_0xd411('0x33')][_0xd411('0x3c')]);_0x400c6f['where']=qs[_0xd411('0x34')](_[_0xd411('0x3d')](_0x211561[_0xd411('0x33')],_0x6af54e[_0xd411('0x34')]),_0x42adf9);if(_0x211561[_0xd411('0x33')]['filter']){_0x400c6f[_0xd411('0x3e')]=_['merge'](_0x400c6f[_0xd411('0x3e')],{'$or':_[_0xd411('0x32')](_0x42adf9,function(_0x4c8784){if(_0x4c8784[_0xd411('0x2f')]!==_0xd411('0x3f')){var _0x5ec436={};_0x5ec436[_0x4c8784[_0xd411('0x2a')]]={'$like':'%'+_0x211561['query'][_0xd411('0x40')]+'%'};return _0x5ec436;}})});}_0x400c6f=_['merge']({},_0x400c6f,_0x211561[_0xd411('0x41')]);var _0x11ef7b={'where':_0x400c6f[_0xd411('0x3e')]};return db[_0xd411('0x2c')][_0xd411('0x1f')](_0x11ef7b)['then'](function(_0x13751a){_0x292dc0[_0xd411('0x1f')]=_0x13751a;if(_0x211561[_0xd411('0x33')][_0xd411('0x42')]){_0x400c6f[_0xd411('0x43')]=[{'all':!![]}];}return db[_0xd411('0x2c')]['findAll'](_0x400c6f);})[_0xd411('0x25')](function(_0x527f1a){_0x292dc0['rows']=_0x527f1a;return _0x292dc0;})[_0xd411('0x25')](respondWithFilteredResult(_0x555d34,_0x400c6f))[_0xd411('0x44')](handleError(_0x555d34,null));};exports[_0xd411('0x45')]=function(_0x593656,_0x361cf5){var _0x34fb4c={'raw':!![],'where':{'id':_0x593656['params']['id']}},_0x421073={};_0x421073[_0xd411('0x31')]=_[_0xd411('0x46')](db['VoiceMailMessage'][_0xd411('0x2d')]);_0x421073[_0xd411('0x33')]=_[_0xd411('0x46')](_0x593656[_0xd411('0x33')]);_0x421073[_0xd411('0x34')]=_[_0xd411('0x35')](_0x421073[_0xd411('0x31')],_0x421073['query']);_0x34fb4c[_0xd411('0x37')]=_[_0xd411('0x35')](_0x421073[_0xd411('0x31')],qs['fields'](_0x593656[_0xd411('0x33')]['fields']));_0x34fb4c[_0xd411('0x37')]=_0x34fb4c[_0xd411('0x37')]['length']?_0x34fb4c[_0xd411('0x37')]:_0x421073[_0xd411('0x31')];if(_0x593656[_0xd411('0x33')][_0xd411('0x42')]){_0x34fb4c['include']=[{'all':!![]}];}_0x34fb4c=_[_0xd411('0x47')]({},_0x34fb4c,_0x593656[_0xd411('0x41')]);return db[_0xd411('0x2c')][_0xd411('0x48')](_0x34fb4c)[_0xd411('0x25')](handleEntityNotFound(_0x361cf5,null))['then'](respondWithResult(_0x361cf5,null))[_0xd411('0x44')](handleError(_0x361cf5,null));};exports['create']=function(_0x839b84,_0x1e5902){return db[_0xd411('0x2c')][_0xd411('0x49')](_0x839b84[_0xd411('0x4a')],{})[_0xd411('0x25')](respondWithResult(_0x1e5902,0xc9))[_0xd411('0x44')](handleError(_0x1e5902,null));};exports['update']=function(_0x10a69d,_0x49d51d){if(_0x10a69d[_0xd411('0x4a')]['id']){delete _0x10a69d[_0xd411('0x4a')]['id'];}return db['VoiceMailMessage']['find']({'where':{'id':_0x10a69d[_0xd411('0x4b')]['id']}})[_0xd411('0x25')](handleEntityNotFound(_0x49d51d,null))[_0xd411('0x25')](saveUpdates(_0x10a69d[_0xd411('0x4a')],null))['then'](respondWithResult(_0x49d51d,null))[_0xd411('0x44')](handleError(_0x49d51d,null));};exports[_0xd411('0x26')]=function(_0xef3c29,_0x48837b){return db[_0xd411('0x2c')][_0xd411('0x48')]({'where':{'id':_0xef3c29[_0xd411('0x4b')]['id']}})['then'](handleEntityNotFound(_0x48837b,null))[_0xd411('0x25')](removeEntity(_0x48837b,null))[_0xd411('0x44')](handleError(_0x48837b,null));};exports[_0xd411('0x4c')]=function(_0x2afa77,_0xce4f79,_0x5740a){return db['VoiceMailMessage'][_0xd411('0x48')]({'where':{'id':_0x2afa77['params']['id']},'attributes':['id','recording',_0xd411('0x4d')]})[_0xd411('0x25')](handleEntityNotFound(_0xce4f79,null))[_0xd411('0x25')](function(_0x1e7ae4){if(_0x1e7ae4){if(!_0x1e7ae4['recording']){throw new db['Sequelize'][(_0xd411('0x4e'))](_0xd411('0x4f'));}var _0x467fa2={'Content-Type':_0xd411('0x50'),'Content-Disposition':_0xd411('0x51')};if(_0x1e7ae4[_0xd411('0x4d')]){_0x467fa2[_0xd411('0x52')]=_0xd411('0x53')+_0x1e7ae4['msg_id']+_0xd411('0x54');}_0xce4f79[_0xd411('0x20')](_0x467fa2);return _0xce4f79['send'](new Buffer(_0x1e7ae4[_0xd411('0x55')]));}})[_0xd411('0x44')](handleError(_0xce4f79,null));}; \ No newline at end of file +var _0xca99=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','key','model','differenceBy','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','options','includeAll','include','rows','show','params','length','find','catch','create','body','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','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'];(function(_0x45c97a,_0x3198bc){var _0x38354e=function(_0x4a939f){while(--_0x4a939f){_0x45c97a['push'](_0x45c97a['shift']());}};_0x38354e(++_0x3198bc);}(_0xca99,0x14b));var _0x9ca9=function(_0x1116ac,_0xcbe059){_0x1116ac=_0x1116ac-0x0;var _0x3e806b=_0xca99[_0x1116ac];return _0x3e806b;};'use strict';var emlformat=require(_0x9ca9('0x0'));var rimraf=require(_0x9ca9('0x1'));var zipdir=require(_0x9ca9('0x2'));var jsonpatch=require(_0x9ca9('0x3'));var rp=require(_0x9ca9('0x4'));var moment=require('moment');var BPromise=require(_0x9ca9('0x5'));var Mustache=require('mustache');var util=require(_0x9ca9('0x6'));var path=require('path');var sox=require(_0x9ca9('0x7'));var csv=require(_0x9ca9('0x8'));var ejs=require(_0x9ca9('0x9'));var fs=require('fs');var fs_extra=require(_0x9ca9('0xa'));var _=require(_0x9ca9('0xb'));var squel=require(_0x9ca9('0xc'));var crypto=require(_0x9ca9('0xd'));var jsforce=require(_0x9ca9('0xe'));var deskjs=require(_0x9ca9('0xf'));var toCsv=require(_0x9ca9('0x8'));var querystring=require(_0x9ca9('0x10'));var Papa=require(_0x9ca9('0x11'));var Redis=require('ioredis');var authService=require(_0x9ca9('0x12'));var qs=require(_0x9ca9('0x13'));var as=require(_0x9ca9('0x14'));var hardwareService=require(_0x9ca9('0x15'));var logger=require(_0x9ca9('0x16'))(_0x9ca9('0x17'));var utils=require(_0x9ca9('0x18'));var config=require(_0x9ca9('0x19'));var licenseUtil=require(_0x9ca9('0x1a'));var db=require(_0x9ca9('0x1b'))['db'];function respondWithStatusCode(_0x66be3,_0x44f02c){_0x44f02c=_0x44f02c||0xcc;return function(_0xcfabea){if(_0xcfabea){return _0x66be3[_0x9ca9('0x1c')](_0x44f02c);}return _0x66be3[_0x9ca9('0x1d')](_0x44f02c)[_0x9ca9('0x1e')]();};}function respondWithResult(_0x402651,_0x5ae6cb){_0x5ae6cb=_0x5ae6cb||0xc8;return function(_0x2fb8ce){if(_0x2fb8ce){return _0x402651[_0x9ca9('0x1d')](_0x5ae6cb)[_0x9ca9('0x1f')](_0x2fb8ce);}};}function respondWithFilteredResult(_0xcbe8e5,_0x1aa9ae){return function(_0x5d1f1e){if(_0x5d1f1e){var _0x3e5b1d=typeof _0x1aa9ae[_0x9ca9('0x20')]==='undefined'&&typeof _0x1aa9ae[_0x9ca9('0x21')]===_0x9ca9('0x22');var _0x30ae0d=_0x5d1f1e[_0x9ca9('0x23')];var _0x730557=_0x3e5b1d?0x0:_0x1aa9ae[_0x9ca9('0x20')];var _0x4a4e91=_0x3e5b1d?_0x5d1f1e[_0x9ca9('0x23')]:_0x1aa9ae[_0x9ca9('0x20')]+_0x1aa9ae['limit'];var _0x3b17fc;if(_0x4a4e91>=_0x30ae0d){_0x4a4e91=_0x30ae0d;_0x3b17fc=0xc8;}else{_0x3b17fc=0xce;}_0xcbe8e5[_0x9ca9('0x1d')](_0x3b17fc);return _0xcbe8e5['set'](_0x9ca9('0x24'),_0x730557+'-'+_0x4a4e91+'/'+_0x30ae0d)[_0x9ca9('0x1f')](_0x5d1f1e);}return null;};}function patchUpdates(_0x3d25e7){return function(_0x56a3ca){try{jsonpatch[_0x9ca9('0x25')](_0x56a3ca,_0x3d25e7,!![]);}catch(_0x2a4e5f){return BPromise[_0x9ca9('0x26')](_0x2a4e5f);}return _0x56a3ca[_0x9ca9('0x27')]();};}function saveUpdates(_0x4e4cb7,_0x215696){return function(_0x887770){if(_0x887770){return _0x887770[_0x9ca9('0x28')](_0x4e4cb7)[_0x9ca9('0x29')](function(_0x300ea1){return _0x300ea1;});}return null;};}function removeEntity(_0x156d7a,_0x381f42){return function(_0x18ce15){if(_0x18ce15){return _0x18ce15[_0x9ca9('0x2a')]()[_0x9ca9('0x29')](function(){_0x156d7a[_0x9ca9('0x1d')](0xcc)[_0x9ca9('0x1e')]();});}};}function handleEntityNotFound(_0x25d1fc,_0x4b7331){return function(_0x42a21d){if(!_0x42a21d){_0x25d1fc[_0x9ca9('0x1c')](0x194);}return _0x42a21d;};}function handleError(_0x205c56,_0x35503d){_0x35503d=_0x35503d||0x1f4;return function(_0x2ca089){logger['error'](_0x2ca089[_0x9ca9('0x2b')]);if(_0x2ca089['name']){delete _0x2ca089[_0x9ca9('0x2c')];}_0x205c56[_0x9ca9('0x1d')](_0x35503d)[_0x9ca9('0x2d')](_0x2ca089);};}exports[_0x9ca9('0x2e')]=function(_0x10c681,_0x492c0c){var _0x3228bb={},_0x1badcc={},_0x433b6b={'count':0x0,'rows':[]};var _0x2c34b9=_[_0x9ca9('0x2f')](db[_0x9ca9('0x30')][_0x9ca9('0x31')],function(_0x341f0b){return{'name':_0x341f0b[_0x9ca9('0x32')],'type':_0x341f0b['type'][_0x9ca9('0x33')]};});_0x1badcc[_0x9ca9('0x34')]=_[_0x9ca9('0x35')](_[_0x9ca9('0x2f')](_0x2c34b9,_0x9ca9('0x2c')),[_0x9ca9('0x2c')]);_0x1badcc[_0x9ca9('0x36')]=_[_0x9ca9('0x37')](_0x10c681['query']);_0x1badcc['filters']=_[_0x9ca9('0x38')](_0x1badcc[_0x9ca9('0x34')],_0x1badcc['query']);_0x3228bb[_0x9ca9('0x39')]=_[_0x9ca9('0x38')](_0x1badcc[_0x9ca9('0x34')],qs['fields'](_0x10c681[_0x9ca9('0x36')][_0x9ca9('0x3a')]));_0x3228bb[_0x9ca9('0x39')]=_0x3228bb['attributes']['length']?_0x3228bb[_0x9ca9('0x39')]:_0x1badcc['model'];if(!_0x10c681[_0x9ca9('0x36')][_0x9ca9('0x3b')]('nolimit')){_0x3228bb['limit']=qs[_0x9ca9('0x21')](_0x10c681['query'][_0x9ca9('0x21')]);_0x3228bb[_0x9ca9('0x20')]=qs[_0x9ca9('0x20')](_0x10c681['query'][_0x9ca9('0x20')]);}_0x3228bb[_0x9ca9('0x3c')]=qs[_0x9ca9('0x3d')](_0x10c681[_0x9ca9('0x36')][_0x9ca9('0x3d')]);_0x3228bb[_0x9ca9('0x3e')]=qs[_0x9ca9('0x3f')](_[_0x9ca9('0x40')](_0x10c681['query'],_0x1badcc[_0x9ca9('0x3f')]),_0x2c34b9);if(_0x10c681[_0x9ca9('0x36')][_0x9ca9('0x41')]){_0x3228bb[_0x9ca9('0x3e')]=_[_0x9ca9('0x42')](_0x3228bb[_0x9ca9('0x3e')],{'$or':_[_0x9ca9('0x2f')](_0x2c34b9,function(_0x193cef){if(_0x193cef[_0x9ca9('0x43')]!=='VIRTUAL'){var _0x3e663d={};_0x3e663d[_0x193cef[_0x9ca9('0x2c')]]={'$like':'%'+_0x10c681[_0x9ca9('0x36')][_0x9ca9('0x41')]+'%'};return _0x3e663d;}})});}_0x3228bb=_[_0x9ca9('0x42')]({},_0x3228bb,_0x10c681[_0x9ca9('0x44')]);var _0x10a049={'where':_0x3228bb[_0x9ca9('0x3e')]};return db[_0x9ca9('0x30')][_0x9ca9('0x23')](_0x10a049)[_0x9ca9('0x29')](function(_0x268033){_0x433b6b['count']=_0x268033;if(_0x10c681[_0x9ca9('0x36')][_0x9ca9('0x45')]){_0x3228bb[_0x9ca9('0x46')]=[{'all':!![]}];}return db['VoiceMailMessage']['findAll'](_0x3228bb);})[_0x9ca9('0x29')](function(_0x189552){_0x433b6b[_0x9ca9('0x47')]=_0x189552;return _0x433b6b;})[_0x9ca9('0x29')](respondWithFilteredResult(_0x492c0c,_0x3228bb))['catch'](handleError(_0x492c0c,null));};exports[_0x9ca9('0x48')]=function(_0x38196b,_0x4c673e){var _0x4c0171={'raw':!![],'where':{'id':_0x38196b[_0x9ca9('0x49')]['id']}},_0x1a3238={};_0x1a3238[_0x9ca9('0x34')]=_['keys'](db[_0x9ca9('0x30')]['rawAttributes']);_0x1a3238[_0x9ca9('0x36')]=_[_0x9ca9('0x37')](_0x38196b[_0x9ca9('0x36')]);_0x1a3238[_0x9ca9('0x3f')]=_[_0x9ca9('0x38')](_0x1a3238['model'],_0x1a3238[_0x9ca9('0x36')]);_0x4c0171[_0x9ca9('0x39')]=_[_0x9ca9('0x38')](_0x1a3238[_0x9ca9('0x34')],qs[_0x9ca9('0x3a')](_0x38196b['query'][_0x9ca9('0x3a')]));_0x4c0171[_0x9ca9('0x39')]=_0x4c0171[_0x9ca9('0x39')][_0x9ca9('0x4a')]?_0x4c0171[_0x9ca9('0x39')]:_0x1a3238[_0x9ca9('0x34')];if(_0x38196b[_0x9ca9('0x36')][_0x9ca9('0x45')]){_0x4c0171['include']=[{'all':!![]}];}_0x4c0171=_[_0x9ca9('0x42')]({},_0x4c0171,_0x38196b[_0x9ca9('0x44')]);return db['VoiceMailMessage'][_0x9ca9('0x4b')](_0x4c0171)[_0x9ca9('0x29')](handleEntityNotFound(_0x4c673e,null))['then'](respondWithResult(_0x4c673e,null))[_0x9ca9('0x4c')](handleError(_0x4c673e,null));};exports[_0x9ca9('0x4d')]=function(_0x1209a1,_0x1d9257){return db[_0x9ca9('0x30')][_0x9ca9('0x4d')](_0x1209a1[_0x9ca9('0x4e')],{})[_0x9ca9('0x29')](respondWithResult(_0x1d9257,0xc9))[_0x9ca9('0x4c')](handleError(_0x1d9257,null));};exports[_0x9ca9('0x28')]=function(_0x5369d7,_0x66bc55){if(_0x5369d7['body']['id']){delete _0x5369d7[_0x9ca9('0x4e')]['id'];}return db[_0x9ca9('0x30')][_0x9ca9('0x4b')]({'where':{'id':_0x5369d7[_0x9ca9('0x49')]['id']}})[_0x9ca9('0x29')](handleEntityNotFound(_0x66bc55,null))[_0x9ca9('0x29')](saveUpdates(_0x5369d7[_0x9ca9('0x4e')],null))[_0x9ca9('0x29')](respondWithResult(_0x66bc55,null))['catch'](handleError(_0x66bc55,null));};exports[_0x9ca9('0x2a')]=function(_0x29a307,_0xd01584){return db['VoiceMailMessage'][_0x9ca9('0x4b')]({'where':{'id':_0x29a307['params']['id']}})[_0x9ca9('0x29')](handleEntityNotFound(_0xd01584,null))[_0x9ca9('0x29')](removeEntity(_0xd01584,null))[_0x9ca9('0x4c')](handleError(_0xd01584,null));};exports['download']=function(_0x319b80,_0x4e1e02,_0x5a6bf7){return db['VoiceMailMessage']['find']({'where':{'id':_0x319b80[_0x9ca9('0x49')]['id']},'attributes':['id',_0x9ca9('0x4f'),_0x9ca9('0x50')]})[_0x9ca9('0x29')](handleEntityNotFound(_0x4e1e02,null))[_0x9ca9('0x29')](function(_0x35a100){if(_0x35a100){if(!_0x35a100[_0x9ca9('0x4f')]){throw new db[(_0x9ca9('0x51'))][(_0x9ca9('0x52'))](_0x9ca9('0x53'));}var _0x588bb5={'Content-Type':'audio/wav','Content-Disposition':_0x9ca9('0x54')};if(_0x35a100[_0x9ca9('0x50')]){_0x588bb5[_0x9ca9('0x55')]=_0x9ca9('0x56')+_0x35a100[_0x9ca9('0x50')]+_0x9ca9('0x57');}_0x4e1e02[_0x9ca9('0x58')](_0x588bb5);return _0x4e1e02[_0x9ca9('0x2d')](new Buffer(_0x35a100['recording']));}})[_0x9ca9('0x4c')](handleError(_0x4e1e02,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index dca09b8..a44b51d 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 _0x38b2=['voice_voicemail_messages','dir','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage'];(function(_0x2405de,_0x548637){var _0xeadb6e=function(_0x4ad187){while(--_0x4ad187){_0x2405de['push'](_0x2405de['shift']());}};_0xeadb6e(++_0x548637);}(_0x38b2,0xaa));var _0x238b=function(_0x1de8af,_0x56efd7){_0x1de8af=_0x1de8af-0x0;var _0x5e35fb=_0x38b2[_0x1de8af];return _0x5e35fb;};'use strict';var _=require('lodash');var util=require(_0x238b('0x0'));var logger=require(_0x238b('0x1'))(_0x238b('0x2'));var moment=require('moment');var BPromise=require(_0x238b('0x3'));var rp=require(_0x238b('0x4'));var fs=require('fs');var path=require(_0x238b('0x5'));var rimraf=require(_0x238b('0x6'));var config=require(_0x238b('0x7'));var attributes=require(_0x238b('0x8'));module[_0x238b('0x9')]=function(_0x5238e3,_0x1f9c05){return _0x5238e3[_0x238b('0xa')](_0x238b('0xb'),attributes,{'tableName':_0x238b('0xc'),'paranoid':![],'indexes':[{'name':_0x238b('0xd'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x7882=['request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7882,0x14b));var _0x2788=function(_0x101a17,_0x5d047a){_0x101a17=_0x101a17-0x0;var _0x3b76ee=_0x7882[_0x101a17];return _0x3b76ee;};'use strict';var _=require(_0x2788('0x0'));var util=require(_0x2788('0x1'));var logger=require(_0x2788('0x2'))(_0x2788('0x3'));var moment=require(_0x2788('0x4'));var BPromise=require('bluebird');var rp=require(_0x2788('0x5'));var fs=require('fs');var path=require(_0x2788('0x6'));var rimraf=require(_0x2788('0x7'));var config=require(_0x2788('0x8'));var attributes=require(_0x2788('0x9'));module['exports']=function(_0x18c12f,_0x29b463){return _0x18c12f['define']('VoiceMailMessage',attributes,{'tableName':_0x2788('0xa'),'paranoid':![],'indexes':[{'name':_0x2788('0xb'),'fields':[_0x2788('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 0794df2..134c945 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 _0x8b96=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8b96,0x17e));var _0x68b9=function(_0x3464b4,_0x70c61f){_0x3464b4=_0x3464b4-0x0;var _0x56c27d=_0x8b96[_0x3464b4];return _0x56c27d;};'use strict';var _=require(_0x68b9('0x0'));var util=require(_0x68b9('0x1'));var moment=require(_0x68b9('0x2'));var BPromise=require(_0x68b9('0x3'));var rs=require(_0x68b9('0x4'));var fs=require('fs');var Redis=require(_0x68b9('0x5'));var db=require(_0x68b9('0x6'))['db'];var utils=require(_0x68b9('0x7'));var logger=require(_0x68b9('0x8'))(_0x68b9('0x9'));var config=require(_0x68b9('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x68b9('0xb')][_0x68b9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x6d3879,_0xc9a15a,_0x156b54){return new BPromise(function(_0x620197,_0x29147c){return client[_0x68b9('0xd')](_0x6d3879,_0x156b54)[_0x68b9('0xe')](function(_0x58b016){logger[_0x68b9('0xf')](_0x68b9('0x10'),_0xc9a15a,'request\x20sent');logger[_0x68b9('0x11')](_0x68b9('0x12'),_0xc9a15a,_0x68b9('0x13'),JSON[_0x68b9('0x14')](_0x58b016));if(_0x58b016[_0x68b9('0x15')]){if(_0x58b016[_0x68b9('0x15')][_0x68b9('0x16')]===0x1f4){logger[_0x68b9('0x15')](_0x68b9('0x10'),_0xc9a15a,_0x58b016[_0x68b9('0x15')][_0x68b9('0x17')]);return _0x29147c(_0x58b016[_0x68b9('0x15')][_0x68b9('0x17')]);}logger[_0x68b9('0x15')]('VoiceMailMessage,\x20%s,\x20%s',_0xc9a15a,_0x58b016[_0x68b9('0x15')][_0x68b9('0x17')]);return _0x620197(_0x58b016[_0x68b9('0x15')][_0x68b9('0x17')]);}else{logger[_0x68b9('0xf')](_0x68b9('0x10'),_0xc9a15a,'request\x20sent');_0x620197(_0x58b016[_0x68b9('0x18')][_0x68b9('0x17')]);}})[_0x68b9('0x19')](function(_0x30c4cf){logger['error'](_0x68b9('0x10'),_0xc9a15a,_0x30c4cf);_0x29147c(_0x30c4cf);});});} \ No newline at end of file +var _0x146c=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x42b569,_0x4f83bd){var _0x3642e8=function(_0x2df073){while(--_0x2df073){_0x42b569['push'](_0x42b569['shift']());}};_0x3642e8(++_0x4f83bd);}(_0x146c,0x169));var _0xc146=function(_0x3429f2,_0x4c6469){_0x3429f2=_0x3429f2-0x0;var _0x26574b=_0x146c[_0x3429f2];return _0x26574b;};'use strict';var _=require(_0xc146('0x0'));var util=require(_0xc146('0x1'));var moment=require(_0xc146('0x2'));var BPromise=require(_0xc146('0x3'));var rs=require(_0xc146('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc146('0x5'))['db'];var utils=require(_0xc146('0x6'));var logger=require(_0xc146('0x7'))('rpc');var config=require(_0xc146('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc146('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x263f94,_0x5c5368,_0x463cd5){return new BPromise(function(_0x2827a8,_0x508d27){return client['request'](_0x263f94,_0x463cd5)[_0xc146('0xa')](function(_0x51e322){logger['info'](_0xc146('0xb'),_0x5c5368,_0xc146('0xc'));logger['debug'](_0xc146('0xd'),_0x5c5368,'request\x20sent',JSON[_0xc146('0xe')](_0x51e322));if(_0x51e322[_0xc146('0xf')]){if(_0x51e322['error'][_0xc146('0x10')]===0x1f4){logger[_0xc146('0xf')](_0xc146('0xb'),_0x5c5368,_0x51e322[_0xc146('0xf')][_0xc146('0x11')]);return _0x508d27(_0x51e322[_0xc146('0xf')][_0xc146('0x11')]);}logger['error'](_0xc146('0xb'),_0x5c5368,_0x51e322[_0xc146('0xf')][_0xc146('0x11')]);return _0x2827a8(_0x51e322[_0xc146('0xf')]['message']);}else{logger[_0xc146('0x12')](_0xc146('0xb'),_0x5c5368,_0xc146('0xc'));_0x2827a8(_0x51e322[_0xc146('0x13')]['message']);}})[_0xc146('0x14')](function(_0x538515){logger['error'](_0xc146('0xb'),_0x5c5368,_0x538515);_0x508d27(_0x538515);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index c1abbc2..3d616bf 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 _0x2307=['/:id/sounds/:id2','exports','multer','path','connect-timeout','express','Router','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','post','/:id/sounds','addSound','update','delete','destroy'];(function(_0x45518f,_0x475a6b){var _0x198175=function(_0x40d333){while(--_0x40d333){_0x45518f['push'](_0x45518f['shift']());}};_0x198175(++_0x475a6b);}(_0x2307,0x17e));var _0x7230=function(_0x2cec8a,_0xec8ab5){_0x2cec8a=_0x2cec8a-0x0;var _0x2f42bb=_0x2307[_0x2cec8a];return _0x2f42bb;};'use strict';var multer=require(_0x7230('0x0'));var util=require('util');var path=require(_0x7230('0x1'));var timeout=require(_0x7230('0x2'));var express=require(_0x7230('0x3'));var router=express[_0x7230('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7230('0x5'));var controller=require(_0x7230('0x6'));router[_0x7230('0x7')]('/',auth[_0x7230('0x8')](),controller[_0x7230('0x9')]);router[_0x7230('0x7')](_0x7230('0xa'),auth['isAuthenticated'](),controller[_0x7230('0xb')]);router[_0x7230('0x7')]('/:id/sounds',auth[_0x7230('0x8')](),controller['getSounds']);router[_0x7230('0xc')]('/',auth[_0x7230('0x8')](),controller['create']);router['post'](_0x7230('0xd'),auth[_0x7230('0x8')](),controller[_0x7230('0xe')]);router['put'](_0x7230('0xa'),auth[_0x7230('0x8')](),controller[_0x7230('0xf')]);router[_0x7230('0x10')](_0x7230('0xa'),auth[_0x7230('0x8')](),controller[_0x7230('0x11')]);router[_0x7230('0x10')](_0x7230('0x12'),auth[_0x7230('0x8')](),controller['removeSound']);module[_0x7230('0x13')]=router; \ No newline at end of file +var _0x518a=['put','delete','/:id/sounds/:id2','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','isAuthenticated','index','/:id','show','/:id/sounds','post'];(function(_0x245327,_0x2bbe5f){var _0x4d441c=function(_0x281a13){while(--_0x281a13){_0x245327['push'](_0x245327['shift']());}};_0x4d441c(++_0x2bbe5f);}(_0x518a,0x1bc));var _0xa518=function(_0x365f1b,_0xa1fa0c){_0x365f1b=_0x365f1b-0x0;var _0x429e6f=_0x518a[_0x365f1b];return _0x429e6f;};'use strict';var multer=require(_0xa518('0x0'));var util=require(_0xa518('0x1'));var path=require(_0xa518('0x2'));var timeout=require(_0xa518('0x3'));var express=require(_0xa518('0x4'));var router=express[_0xa518('0x5')]();var fs_extra=require(_0xa518('0x6'));var auth=require(_0xa518('0x7'));var interaction=require(_0xa518('0x8'));var config=require('../../config/environment');var controller=require(_0xa518('0x9'));router['get']('/',auth[_0xa518('0xa')](),controller[_0xa518('0xb')]);router['get'](_0xa518('0xc'),auth[_0xa518('0xa')](),controller[_0xa518('0xd')]);router['get'](_0xa518('0xe'),auth[_0xa518('0xa')](),controller['getSounds']);router[_0xa518('0xf')]('/',auth[_0xa518('0xa')](),controller['create']);router[_0xa518('0xf')]('/:id/sounds',auth['isAuthenticated'](),controller['addSound']);router[_0xa518('0x10')](_0xa518('0xc'),auth[_0xa518('0xa')](),controller['update']);router['delete'](_0xa518('0xc'),auth[_0xa518('0xa')](),controller['destroy']);router[_0xa518('0x11')](_0xa518('0x12'),auth['isAuthenticated'](),controller['removeSound']);module[_0xa518('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 83db9d8..f0bfe99 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 _0xbd72=['quietmp3','mp3','STRING','TIMESTAMP','BOOLEAN','sequelize','exports','name','ENUM','custom','files','mp3nb'];(function(_0x54dcb7,_0x310c80){var _0x2d68d1=function(_0x541e70){while(--_0x541e70){_0x54dcb7['push'](_0x54dcb7['shift']());}};_0x2d68d1(++_0x310c80);}(_0xbd72,0x179));var _0x2bd7=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xbd72[_0x45d55e];return _0x29812a;};'use strict';var Sequelize=require(_0x2bd7('0x0'));module[_0x2bd7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2bd7('0x2')},'mode':{'type':Sequelize[_0x2bd7('0x3')](_0x2bd7('0x4'),_0x2bd7('0x5'),_0x2bd7('0x6'),'quietmp3nb',_0x2bd7('0x7'),_0x2bd7('0x8')),'allowNull':!![],'defaultValue':_0x2bd7('0x5')},'directory':{'type':Sequelize[_0x2bd7('0x9')],'allowNull':!![]},'application':{'type':Sequelize[_0x2bd7('0x9')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x2bd7('0x9')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x2bd7('0x9')],'allowNull':!![]},'stamp':{'type':_0x2bd7('0xa')},'defaultEntry':{'type':Sequelize[_0x2bd7('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0177=['quietmp3','mp3','STRING','alpha','TIMESTAMP','exports','ENUM','custom','files','mp3nb','quietmp3nb'];(function(_0x5ef766,_0xe2692){var _0x54fa70=function(_0x45b862){while(--_0x45b862){_0x5ef766['push'](_0x5ef766['shift']());}};_0x54fa70(++_0xe2692);}(_0x0177,0x15a));var _0x7017=function(_0x3a4375,_0x3b9f3b){_0x3a4375=_0x3a4375-0x0;var _0x24124d=_0x0177[_0x3a4375];return _0x24124d;};'use strict';var Sequelize=require('sequelize');module[_0x7017('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x7017('0x1')](_0x7017('0x2'),_0x7017('0x3'),_0x7017('0x4'),_0x7017('0x5'),_0x7017('0x6'),_0x7017('0x7')),'allowNull':!![],'defaultValue':_0x7017('0x3')},'directory':{'type':Sequelize[_0x7017('0x8')],'allowNull':!![]},'application':{'type':Sequelize[_0x7017('0x8')],'allowNull':!![]},'digit':{'type':Sequelize[_0x7017('0x8')],'allowNull':!![]},'sort':{'type':Sequelize[_0x7017('0x8')],'allowNull':!![],'defaultValue':_0x7017('0x9')},'format':{'type':Sequelize[_0x7017('0x8')],'allowNull':!![]},'stamp':{'type':_0x7017('0xa')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index ac33252..bb5f614 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 _0x637b=['server/files/sounds/converted','format','extname','%s.%s','converted_format','symlinkSync','message','removeSound','id2','unlinkSync','getSounds','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','json','undefined','limit','count','offset','set','reject','save','then','destroy','MusicOnHolds','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','catch','show','params','include','find','update','body','create','sequelize','transaction','files','directory','join','root','server/files/moh','mkdirSync','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','rmdirSync','Sequelize','ValidationError','addSound','Sound','findOne','save_name','createdAt'];(function(_0x903228,_0x42c429){var _0xcec81d=function(_0x4da97a){while(--_0x4da97a){_0x903228['push'](_0x903228['shift']());}};_0xcec81d(++_0x42c429);}(_0x637b,0x79));var _0xb637=function(_0xa86729,_0x56846a){_0xa86729=_0xa86729-0x0;var _0x45fd8d=_0x637b[_0xa86729];return _0x45fd8d;};'use strict';var emlformat=require(_0xb637('0x0'));var rimraf=require(_0xb637('0x1'));var zipdir=require(_0xb637('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb637('0x3'));var BPromise=require(_0xb637('0x4'));var Mustache=require(_0xb637('0x5'));var util=require(_0xb637('0x6'));var path=require(_0xb637('0x7'));var sox=require(_0xb637('0x8'));var csv=require(_0xb637('0x9'));var ejs=require(_0xb637('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb637('0xb'));var crypto=require(_0xb637('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb637('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb637('0xe'));var Papa=require(_0xb637('0xf'));var Redis=require('ioredis');var authService=require(_0xb637('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb637('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb637('0x12'));var utils=require(_0xb637('0x13'));var config=require(_0xb637('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb637('0x15'))['db'];function respondWithStatusCode(_0x2fcd2b,_0x2459d6){_0x2459d6=_0x2459d6||0xcc;return function(_0x20f211){if(_0x20f211){return _0x2fcd2b['sendStatus'](_0x2459d6);}return _0x2fcd2b[_0xb637('0x16')](_0x2459d6)['end']();};}function respondWithResult(_0x43bf86,_0x1ecc4d){_0x1ecc4d=_0x1ecc4d||0xc8;return function(_0x5066ee){if(_0x5066ee){return _0x43bf86[_0xb637('0x16')](_0x1ecc4d)[_0xb637('0x17')](_0x5066ee);}};}function respondWithFilteredResult(_0x5998c1,_0x19061c){return function(_0xc9486c){if(_0xc9486c){var _0x4cb472=typeof _0x19061c['offset']===_0xb637('0x18')&&typeof _0x19061c[_0xb637('0x19')]==='undefined';var _0x4a37ae=_0xc9486c[_0xb637('0x1a')];var _0x1facc9=_0x4cb472?0x0:_0x19061c[_0xb637('0x1b')];var _0x2974b3=_0x4cb472?_0xc9486c['count']:_0x19061c[_0xb637('0x1b')]+_0x19061c[_0xb637('0x19')];var _0x826c35;if(_0x2974b3>=_0x4a37ae){_0x2974b3=_0x4a37ae;_0x826c35=0xc8;}else{_0x826c35=0xce;}_0x5998c1[_0xb637('0x16')](_0x826c35);return _0x5998c1[_0xb637('0x1c')]('Content-Range',_0x1facc9+'-'+_0x2974b3+'/'+_0x4a37ae)[_0xb637('0x17')](_0xc9486c);}return null;};}function patchUpdates(_0x2d556f){return function(_0x46963d){try{jsonpatch['apply'](_0x46963d,_0x2d556f,!![]);}catch(_0x5252cb){return BPromise[_0xb637('0x1d')](_0x5252cb);}return _0x46963d[_0xb637('0x1e')]();};}function saveUpdates(_0x3b1f00,_0x295e70){return function(_0x170840){if(_0x170840){return _0x170840['update'](_0x3b1f00)[_0xb637('0x1f')](function(_0x5de78e){return _0x5de78e;});}return null;};}function removeEntity(_0x2f1519,_0x3b33b0){return function(_0x26bd80){if(_0x26bd80){return _0x26bd80[_0xb637('0x20')]()[_0xb637('0x1f')](function(){var _0x42cdde=_0x26bd80['get']({'plain':!![]});var _0x1701e3=_0xb637('0x21');return db[_0xb637('0x22')]['destroy']({'where':{'type':_0x1701e3,'resourceId':_0x42cdde['id']}})['then'](function(){return _0x26bd80;});})[_0xb637('0x1f')](function(){_0x2f1519[_0xb637('0x16')](0xcc)[_0xb637('0x23')]();});}};}function handleEntityNotFound(_0x329a0c,_0x5e9e34){return function(_0x168037){if(!_0x168037){_0x329a0c[_0xb637('0x24')](0x194);}return _0x168037;};}function handleError(_0xc3c955,_0x3b2cc9){_0x3b2cc9=_0x3b2cc9||0x1f4;return function(_0x15c9ce){logger[_0xb637('0x25')](_0x15c9ce[_0xb637('0x26')]);if(_0x15c9ce['name']){delete _0x15c9ce[_0xb637('0x27')];}_0xc3c955[_0xb637('0x16')](_0x3b2cc9)[_0xb637('0x28')](_0x15c9ce);};}exports[_0xb637('0x29')]=function(_0x3107b0,_0x1f9fd8){var _0x485ebe={},_0x15d31c={},_0x152aa9={'count':0x0,'rows':[]};var _0xc75fc=_[_0xb637('0x2a')](db[_0xb637('0x2b')][_0xb637('0x2c')],function(_0x19dee1){return{'name':_0x19dee1[_0xb637('0x2d')],'type':_0x19dee1[_0xb637('0x2e')]['key']};});_0x15d31c[_0xb637('0x2f')]=_[_0xb637('0x2a')](_0xc75fc,_0xb637('0x27'));_0x15d31c['query']=_[_0xb637('0x30')](_0x3107b0['query']);_0x15d31c[_0xb637('0x31')]=_['intersection'](_0x15d31c[_0xb637('0x2f')],_0x15d31c[_0xb637('0x32')]);_0x485ebe[_0xb637('0x33')]=_[_0xb637('0x34')](_0x15d31c[_0xb637('0x2f')],qs[_0xb637('0x35')](_0x3107b0[_0xb637('0x32')][_0xb637('0x35')]));_0x485ebe[_0xb637('0x33')]=_0x485ebe[_0xb637('0x33')][_0xb637('0x36')]?_0x485ebe[_0xb637('0x33')]:_0x15d31c['model'];if(!_0x3107b0[_0xb637('0x32')][_0xb637('0x37')](_0xb637('0x38'))){_0x485ebe[_0xb637('0x19')]=qs[_0xb637('0x19')](_0x3107b0[_0xb637('0x32')][_0xb637('0x19')]);_0x485ebe[_0xb637('0x1b')]=qs[_0xb637('0x1b')](_0x3107b0[_0xb637('0x32')][_0xb637('0x1b')]);}_0x485ebe[_0xb637('0x39')]=qs[_0xb637('0x3a')](_0x3107b0[_0xb637('0x32')][_0xb637('0x3a')]);delete _0x3107b0[_0xb637('0x32')][_0xb637('0x3a')];_0x485ebe['where']=qs[_0xb637('0x31')](_[_0xb637('0x3b')](_0x3107b0[_0xb637('0x32')],_0x15d31c['filters']),_0xc75fc);if(_0x3107b0[_0xb637('0x32')][_0xb637('0x3c')]){_0x485ebe[_0xb637('0x3d')]=_['merge'](_0x485ebe['where'],{'$or':_[_0xb637('0x2a')](_0xc75fc,function(_0x39833f){if(_0x39833f[_0xb637('0x2e')]!==_0xb637('0x3e')){var _0x11e43b={};_0x11e43b[_0x39833f[_0xb637('0x27')]]={'$like':'%'+_0x3107b0[_0xb637('0x32')][_0xb637('0x3c')]+'%'};return _0x11e43b;}})});}_0x485ebe=_[_0xb637('0x3f')]({},_0x485ebe,_0x3107b0[_0xb637('0x40')]);var _0xa38301={'where':_0x485ebe[_0xb637('0x3d')]};return db[_0xb637('0x2b')][_0xb637('0x1a')](_0xa38301)[_0xb637('0x1f')](function(_0x20542e){_0x152aa9[_0xb637('0x1a')]=_0x20542e;if(_0x3107b0['query'][_0xb637('0x41')]){_0x485ebe['include']=[{'all':!![]}];}return db[_0xb637('0x2b')]['findAll'](_0x485ebe);})[_0xb637('0x1f')](function(_0x54aa4d){_0x152aa9['rows']=_0x54aa4d;return _0x152aa9;})[_0xb637('0x1f')](respondWithFilteredResult(_0x1f9fd8,_0x485ebe))[_0xb637('0x42')](handleError(_0x1f9fd8,null));};exports[_0xb637('0x43')]=function(_0x4dd5c4,_0x5adeee){var _0x44b9df={'raw':![],'where':{'id':_0x4dd5c4[_0xb637('0x44')]['id']}},_0x271f84={};_0x271f84[_0xb637('0x2f')]=_[_0xb637('0x30')](db[_0xb637('0x2b')][_0xb637('0x2c')]);_0x271f84[_0xb637('0x32')]=_['keys'](_0x4dd5c4[_0xb637('0x32')]);_0x271f84[_0xb637('0x31')]=_[_0xb637('0x34')](_0x271f84['model'],_0x271f84['query']);_0x44b9df['attributes']=_[_0xb637('0x34')](_0x271f84['model'],qs[_0xb637('0x35')](_0x4dd5c4[_0xb637('0x32')]['fields']));_0x44b9df[_0xb637('0x33')]=_0x44b9df[_0xb637('0x33')][_0xb637('0x36')]?_0x44b9df[_0xb637('0x33')]:_0x271f84[_0xb637('0x2f')];if(_0x4dd5c4[_0xb637('0x32')][_0xb637('0x41')]){_0x44b9df[_0xb637('0x45')]=[{'all':!![]}];}_0x44b9df=_[_0xb637('0x3f')]({},_0x44b9df,_0x4dd5c4[_0xb637('0x40')]);return db['VoiceMusicOnHold'][_0xb637('0x46')](_0x44b9df)[_0xb637('0x1f')](handleEntityNotFound(_0x5adeee,null))[_0xb637('0x1f')](respondWithResult(_0x5adeee,null))['catch'](handleError(_0x5adeee,null));};exports[_0xb637('0x47')]=function(_0x4bca20,_0x334a89){if(_0x4bca20[_0xb637('0x48')]['id']){delete _0x4bca20['body']['id'];}return db[_0xb637('0x2b')][_0xb637('0x46')]({'where':{'id':_0x4bca20[_0xb637('0x44')]['id']}})[_0xb637('0x1f')](handleEntityNotFound(_0x334a89,null))[_0xb637('0x1f')](saveUpdates(_0x4bca20['body'],null))['then'](respondWithResult(_0x334a89,null))['catch'](handleError(_0x334a89,null));};exports[_0xb637('0x49')]=function(_0x12e6d3,_0x164dfc,_0x2f9dbb){return db[_0xb637('0x4a')][_0xb637('0x4b')](function(_0xa13c1c){if(_0x12e6d3[_0xb637('0x48')]['mode']===_0xb637('0x4c')){_0x12e6d3[_0xb637('0x48')][_0xb637('0x4d')]=path[_0xb637('0x4e')](config[_0xb637('0x4f')],_0xb637('0x50'),_0x12e6d3[_0xb637('0x48')][_0xb637('0x27')]);}return db[_0xb637('0x2b')][_0xb637('0x49')](_0x12e6d3[_0xb637('0x48')],{'transaction':_0xa13c1c})[_0xb637('0x1f')](function(_0x306051){if(_0x12e6d3[_0xb637('0x48')]['mode']===_0xb637('0x4c')){fs[_0xb637('0x51')](_0x306051[_0xb637('0x4d')],parseInt(_0xb637('0x52'),0x8));}var _0x5c57e9=_0x12e6d3[_0xb637('0x53')][_0xb637('0x54')]({'plain':!![]});if(!_0x5c57e9)throw new Error(_0xb637('0x55'));if(_0x5c57e9['role']===_0xb637('0x53')){var _0x4a8c88=_0x306051[_0xb637('0x54')]({'plain':!![]});return db[_0xb637('0x56')][_0xb637('0x46')]({'where':{'name':_0xb637('0x21'),'userProfileId':_0x5c57e9[_0xb637('0x57')]},'raw':!![]})['then'](function(_0x183241){if(_0x183241&&_0x183241['autoAssociation']===0x0){return db['UserProfileResource'][_0xb637('0x49')]({'name':_0x4a8c88[_0xb637('0x27')],'resourceId':_0x4a8c88['id'],'type':_0x183241['name'],'sectionId':_0x183241['id']},{})[_0xb637('0x1f')](function(){return _0x306051;});}else{return _0x306051;}})[_0xb637('0x42')](function(_0x35ba25){logger[_0xb637('0x25')](_0xb637('0x58'),_0x35ba25);});}return _0x306051;});})['then'](respondWithResult(_0x164dfc,0xc9))[_0xb637('0x42')](handleError(_0x164dfc,null));};exports[_0xb637('0x20')]=function(_0x4c3129,_0x21d927,_0x44476f){var _0x246e3d;return db[_0xb637('0x2b')]['find']({'where':{'id':_0x4c3129['params']['id']}})[_0xb637('0x1f')](function(_0x537986){if(_0x537986){return db['sequelize'][_0xb637('0x4b')](function(_0x51d200){return _0x537986[_0xb637('0x20')]({'transaction':_0x51d200,'raw':!![]})[_0xb637('0x1f')](function(_0x277fc6){if(_0x277fc6['directory']){fs[_0xb637('0x59')](_0x277fc6['directory'])[_0xb637('0x5a')](function(_0x2f3e5a){fs['unlinkSync'](path[_0xb637('0x4e')](_0x277fc6['directory'],_0x2f3e5a));});fs[_0xb637('0x5b')](_0x277fc6['directory']);}return _0x277fc6;});})[_0xb637('0x42')](function(_0x5d9095){throw new db[(_0xb637('0x5c'))][(_0xb637('0x5d'))](_0x5d9095['message']);});}})['then'](handleEntityNotFound(_0x21d927,null))[_0xb637('0x1f')](removeEntity(_0x21d927,null))[_0xb637('0x42')](handleError(_0x21d927,null));};exports[_0xb637('0x5e')]=function(_0x4f4c64,_0x266442,_0x21ed14){return db[_0xb637('0x4a')]['transaction'](function(_0x2eaf65){var _0x2695ed;return db[_0xb637('0x2b')]['find']({'where':{'id':_0x4f4c64[_0xb637('0x44')]['id']}})[_0xb637('0x1f')](function(_0x22ee9b){if(_0x22ee9b){_0x2695ed=_0x22ee9b;return _0x22ee9b[_0xb637('0x5e')](_0x4f4c64[_0xb637('0x48')]['id'],{'transaction':_0x2eaf65});}})[_0xb637('0x1f')](function(_0x645acf){if(_0x645acf){return db[_0xb637('0x5f')][_0xb637('0x60')]({'where':{'id':_0x4f4c64[_0xb637('0x48')]['id']},'attributes':['id',_0xb637('0x27'),_0xb637('0x61'),'converted_format',_0xb637('0x62')],'raw':!![]});}})['then'](function(_0x51d6d1){if(_0x51d6d1){var _0x129d03=path[_0xb637('0x4e')](config[_0xb637('0x4f')],_0xb637('0x63'),util[_0xb637('0x64')]('%s.%s',path['basename'](_0x51d6d1[_0xb637('0x61')],path[_0xb637('0x65')](_0x51d6d1[_0xb637('0x61')])),_0x51d6d1['converted_format']));var _0x41d3f3=path[_0xb637('0x4e')](config[_0xb637('0x4f')],_0xb637('0x50'),_0x2695ed[_0xb637('0x27')],util['format'](_0xb637('0x66'),_0x51d6d1[_0xb637('0x27')],_0x51d6d1[_0xb637('0x67')]));fs[_0xb637('0x68')](_0x129d03,_0x41d3f3);return _0x51d6d1;}})[_0xb637('0x42')](function(_0x48bc8a){throw new db[(_0xb637('0x5c'))][(_0xb637('0x5d'))](_0x48bc8a[_0xb637('0x69')]);});})[_0xb637('0x1f')](handleEntityNotFound(_0x266442,null))[_0xb637('0x1f')](respondWithResult(_0x266442,0xc9))[_0xb637('0x42')](handleError(_0x266442,null));};exports[_0xb637('0x6a')]=function(_0x122ab8,_0x33e45f,_0x46a7c9){return db[_0xb637('0x4a')][_0xb637('0x4b')](function(_0x57701a){var _0x4e89ef;return db[_0xb637('0x2b')]['findOne']({'where':{'id':_0x122ab8[_0xb637('0x44')]['id']}})[_0xb637('0x1f')](handleEntityNotFound(_0x33e45f,null))[_0xb637('0x1f')](function(_0x40e12b){if(_0x40e12b){_0x4e89ef=_0x40e12b;return _0x40e12b[_0xb637('0x6a')](_0x122ab8[_0xb637('0x44')][_0xb637('0x6b')]);}})[_0xb637('0x1f')](function(_0xab4306){if(_0xab4306){return db[_0xb637('0x5f')]['findOne']({'where':{'id':_0x122ab8[_0xb637('0x44')]['id2']},'attributes':['id',_0xb637('0x27'),'save_name',_0xb637('0x67'),'createdAt'],'raw':!![]});}})[_0xb637('0x1f')](function(_0x39379f){if(_0x39379f){fs[_0xb637('0x6c')](path[_0xb637('0x4e')](_0x4e89ef[_0xb637('0x4d')],util[_0xb637('0x64')](_0xb637('0x66'),_0x39379f[_0xb637('0x27')],_0x39379f['converted_format'])));return _0x39379f;}})['catch'](function(_0x5567ff){throw new db[(_0xb637('0x5c'))]['ValidationError'](_0x5567ff[_0xb637('0x69')]);});})[_0xb637('0x1f')](handleEntityNotFound(_0x33e45f,null))['then'](respondWithStatusCode(_0x33e45f,0xcc))[_0xb637('0x42')](handleError(_0x33e45f,null));};exports[_0xb637('0x6d')]=function(_0x2021d4,_0x3d9e48,_0x3c7182){var _0x3eb021={};var _0x23c8b8={};var _0x33f693;var _0x58a70e;return db[_0xb637('0x2b')][_0xb637('0x60')]({'where':{'id':_0x2021d4[_0xb637('0x44')]['id']}})['then'](handleEntityNotFound(_0x3d9e48,null))[_0xb637('0x1f')](function(_0x55aac1){if(_0x55aac1){_0x33f693=_0x55aac1;_0x23c8b8[_0xb637('0x2f')]=_[_0xb637('0x30')](db[_0xb637('0x5f')][_0xb637('0x2c')]);_0x23c8b8[_0xb637('0x32')]=_[_0xb637('0x30')](_0x2021d4[_0xb637('0x32')]);_0x23c8b8[_0xb637('0x31')]=_[_0xb637('0x34')](_0x23c8b8[_0xb637('0x2f')],_0x23c8b8[_0xb637('0x32')]);_0x3eb021[_0xb637('0x33')]=_[_0xb637('0x34')](_0x23c8b8[_0xb637('0x2f')],qs[_0xb637('0x35')](_0x2021d4[_0xb637('0x32')][_0xb637('0x35')]));_0x3eb021[_0xb637('0x33')]=_0x3eb021[_0xb637('0x33')][_0xb637('0x36')]?_0x3eb021[_0xb637('0x33')]:_0x23c8b8[_0xb637('0x2f')];_0x3eb021['order']=qs[_0xb637('0x3a')](_0x2021d4[_0xb637('0x32')][_0xb637('0x3a')]);_0x3eb021[_0xb637('0x3d')]=qs[_0xb637('0x31')](_[_0xb637('0x3b')](_0x2021d4[_0xb637('0x32')],_0x23c8b8[_0xb637('0x31')]));if(_0x2021d4[_0xb637('0x32')][_0xb637('0x3c')]){_0x3eb021[_0xb637('0x3d')]=_[_0xb637('0x3f')](_0x3eb021[_0xb637('0x3d')],{'$or':_[_0xb637('0x2a')](_0x3eb021['attributes'],function(_0x20860a){var _0x1c29a8={};_0x1c29a8[_0x20860a]={'$like':'%'+_0x2021d4['query'][_0xb637('0x3c')]+'%'};return _0x1c29a8;})});}_0x3eb021=_['merge']({},_0x3eb021,_0x2021d4[_0xb637('0x40')]);return _0x33f693[_0xb637('0x6d')](_0x3eb021);}})[_0xb637('0x1f')](function(_0xba7442){if(_0xba7442){_0x58a70e=_0xba7442[_0xb637('0x36')];if(!_0x2021d4[_0xb637('0x32')][_0xb637('0x37')](_0xb637('0x38'))){_0x3eb021['limit']=qs['limit'](_0x2021d4['query']['limit']);_0x3eb021[_0xb637('0x1b')]=qs[_0xb637('0x1b')](_0x2021d4[_0xb637('0x32')][_0xb637('0x1b')]);}return _0x33f693['getSounds'](_0x3eb021);}})['then'](function(_0x48dd6f){if(_0x48dd6f){return _0x48dd6f?{'count':_0x58a70e,'rows':_0x48dd6f}:null;}})[_0xb637('0x1f')](respondWithResult(_0x3d9e48,null))[_0xb637('0x42')](handleError(_0x3d9e48,null));}; \ No newline at end of file +var _0x4fb6=['removeSound','id2','Sequelize','getSounds','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','MusicOnHolds','error','stack','send','map','VoiceMusicOnHold','rawAttributes','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','body','create','transaction','mode','files','directory','join','0777','role','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','addSound','sequelize','Sound','findOne','converted_format','createdAt','root','format','basename','save_name','extname','%s.%s','message'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x4fb6,0x1bc));var _0x64fb=function(_0x4fa291,_0x56e289){_0x4fa291=_0x4fa291-0x0;var _0x506d9b=_0x4fb6[_0x4fa291];return _0x506d9b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x64fb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x64fb('0x1'));var rp=require(_0x64fb('0x2'));var moment=require(_0x64fb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x64fb('0x4'));var util=require(_0x64fb('0x5'));var path=require('path');var sox=require(_0x64fb('0x6'));var csv=require(_0x64fb('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x64fb('0x8'));var crypto=require(_0x64fb('0x9'));var jsforce=require(_0x64fb('0xa'));var deskjs=require(_0x64fb('0xb'));var toCsv=require('to-csv');var querystring=require(_0x64fb('0xc'));var Papa=require(_0x64fb('0xd'));var Redis=require('ioredis');var authService=require(_0x64fb('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x64fb('0xf'));var hardwareService=require(_0x64fb('0x10'));var logger=require(_0x64fb('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x64fb('0x12'));var licenseUtil=require(_0x64fb('0x13'));var db=require(_0x64fb('0x14'))['db'];function respondWithStatusCode(_0x381ab3,_0x227e08){_0x227e08=_0x227e08||0xcc;return function(_0x36e440){if(_0x36e440){return _0x381ab3[_0x64fb('0x15')](_0x227e08);}return _0x381ab3[_0x64fb('0x16')](_0x227e08)[_0x64fb('0x17')]();};}function respondWithResult(_0x3af259,_0x12eb55){_0x12eb55=_0x12eb55||0xc8;return function(_0x52695a){if(_0x52695a){return _0x3af259['status'](_0x12eb55)[_0x64fb('0x18')](_0x52695a);}};}function respondWithFilteredResult(_0x6b5288,_0x2ab620){return function(_0x216164){if(_0x216164){var _0x3e48b0=typeof _0x2ab620[_0x64fb('0x19')]===_0x64fb('0x1a')&&typeof _0x2ab620[_0x64fb('0x1b')]==='undefined';var _0x5df13f=_0x216164[_0x64fb('0x1c')];var _0x975363=_0x3e48b0?0x0:_0x2ab620[_0x64fb('0x19')];var _0x50927f=_0x3e48b0?_0x216164[_0x64fb('0x1c')]:_0x2ab620['offset']+_0x2ab620[_0x64fb('0x1b')];var _0x3c5850;if(_0x50927f>=_0x5df13f){_0x50927f=_0x5df13f;_0x3c5850=0xc8;}else{_0x3c5850=0xce;}_0x6b5288[_0x64fb('0x16')](_0x3c5850);return _0x6b5288[_0x64fb('0x1d')](_0x64fb('0x1e'),_0x975363+'-'+_0x50927f+'/'+_0x5df13f)[_0x64fb('0x18')](_0x216164);}return null;};}function patchUpdates(_0x314d85){return function(_0x16980d){try{jsonpatch[_0x64fb('0x1f')](_0x16980d,_0x314d85,!![]);}catch(_0x4a8390){return BPromise[_0x64fb('0x20')](_0x4a8390);}return _0x16980d[_0x64fb('0x21')]();};}function saveUpdates(_0x2db9e0,_0x2d5a59){return function(_0x353838){if(_0x353838){return _0x353838[_0x64fb('0x22')](_0x2db9e0)[_0x64fb('0x23')](function(_0x5e37fd){return _0x5e37fd;});}return null;};}function removeEntity(_0x4e6cb0,_0x5723d6){return function(_0x3948f6){if(_0x3948f6){return _0x3948f6[_0x64fb('0x24')]()[_0x64fb('0x23')](function(){var _0x267122=_0x3948f6[_0x64fb('0x25')]({'plain':!![]});var _0x12aa52=_0x64fb('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x12aa52,'resourceId':_0x267122['id']}})[_0x64fb('0x23')](function(){return _0x3948f6;});})[_0x64fb('0x23')](function(){_0x4e6cb0[_0x64fb('0x16')](0xcc)[_0x64fb('0x17')]();});}};}function handleEntityNotFound(_0x4acdf0,_0x242338){return function(_0x35b8d6){if(!_0x35b8d6){_0x4acdf0['sendStatus'](0x194);}return _0x35b8d6;};}function handleError(_0x2c2632,_0x49c713){_0x49c713=_0x49c713||0x1f4;return function(_0x3c2244){logger[_0x64fb('0x27')](_0x3c2244[_0x64fb('0x28')]);if(_0x3c2244['name']){delete _0x3c2244['name'];}_0x2c2632[_0x64fb('0x16')](_0x49c713)[_0x64fb('0x29')](_0x3c2244);};}exports['index']=function(_0x19ecb8,_0x58f74f){var _0x23f1bc={},_0x986f5a={},_0x4f11b0={'count':0x0,'rows':[]};var _0x110db4=_[_0x64fb('0x2a')](db[_0x64fb('0x2b')][_0x64fb('0x2c')],function(_0x4c6953){return{'name':_0x4c6953['fieldName'],'type':_0x4c6953[_0x64fb('0x2d')][_0x64fb('0x2e')]};});_0x986f5a[_0x64fb('0x2f')]=_[_0x64fb('0x2a')](_0x110db4,_0x64fb('0x30'));_0x986f5a[_0x64fb('0x31')]=_[_0x64fb('0x32')](_0x19ecb8[_0x64fb('0x31')]);_0x986f5a[_0x64fb('0x33')]=_[_0x64fb('0x34')](_0x986f5a[_0x64fb('0x2f')],_0x986f5a['query']);_0x23f1bc['attributes']=_[_0x64fb('0x34')](_0x986f5a[_0x64fb('0x2f')],qs[_0x64fb('0x35')](_0x19ecb8[_0x64fb('0x31')][_0x64fb('0x35')]));_0x23f1bc[_0x64fb('0x36')]=_0x23f1bc[_0x64fb('0x36')][_0x64fb('0x37')]?_0x23f1bc[_0x64fb('0x36')]:_0x986f5a[_0x64fb('0x2f')];if(!_0x19ecb8['query'][_0x64fb('0x38')](_0x64fb('0x39'))){_0x23f1bc['limit']=qs[_0x64fb('0x1b')](_0x19ecb8[_0x64fb('0x31')][_0x64fb('0x1b')]);_0x23f1bc['offset']=qs['offset'](_0x19ecb8[_0x64fb('0x31')][_0x64fb('0x19')]);}_0x23f1bc[_0x64fb('0x3a')]=qs['sort'](_0x19ecb8['query']['sort']);delete _0x19ecb8['query'][_0x64fb('0x3b')];_0x23f1bc[_0x64fb('0x3c')]=qs[_0x64fb('0x33')](_[_0x64fb('0x3d')](_0x19ecb8[_0x64fb('0x31')],_0x986f5a['filters']),_0x110db4);if(_0x19ecb8['query'][_0x64fb('0x3e')]){_0x23f1bc[_0x64fb('0x3c')]=_[_0x64fb('0x3f')](_0x23f1bc[_0x64fb('0x3c')],{'$or':_[_0x64fb('0x2a')](_0x110db4,function(_0x4efbd3){if(_0x4efbd3[_0x64fb('0x2d')]!==_0x64fb('0x40')){var _0x55dd9a={};_0x55dd9a[_0x4efbd3['name']]={'$like':'%'+_0x19ecb8[_0x64fb('0x31')][_0x64fb('0x3e')]+'%'};return _0x55dd9a;}})});}_0x23f1bc=_[_0x64fb('0x3f')]({},_0x23f1bc,_0x19ecb8[_0x64fb('0x41')]);var _0x12b96d={'where':_0x23f1bc['where']};return db[_0x64fb('0x2b')][_0x64fb('0x1c')](_0x12b96d)[_0x64fb('0x23')](function(_0x496ca9){_0x4f11b0[_0x64fb('0x1c')]=_0x496ca9;if(_0x19ecb8['query'][_0x64fb('0x42')]){_0x23f1bc['include']=[{'all':!![]}];}return db[_0x64fb('0x2b')][_0x64fb('0x43')](_0x23f1bc);})['then'](function(_0x2c2d48){_0x4f11b0[_0x64fb('0x44')]=_0x2c2d48;return _0x4f11b0;})[_0x64fb('0x23')](respondWithFilteredResult(_0x58f74f,_0x23f1bc))['catch'](handleError(_0x58f74f,null));};exports[_0x64fb('0x45')]=function(_0x39eaa3,_0x914611){var _0x270534={'raw':![],'where':{'id':_0x39eaa3[_0x64fb('0x46')]['id']}},_0x11083f={};_0x11083f['model']=_[_0x64fb('0x32')](db['VoiceMusicOnHold'][_0x64fb('0x2c')]);_0x11083f['query']=_[_0x64fb('0x32')](_0x39eaa3[_0x64fb('0x31')]);_0x11083f['filters']=_[_0x64fb('0x34')](_0x11083f['model'],_0x11083f[_0x64fb('0x31')]);_0x270534[_0x64fb('0x36')]=_['intersection'](_0x11083f[_0x64fb('0x2f')],qs['fields'](_0x39eaa3[_0x64fb('0x31')]['fields']));_0x270534[_0x64fb('0x36')]=_0x270534[_0x64fb('0x36')]['length']?_0x270534[_0x64fb('0x36')]:_0x11083f['model'];if(_0x39eaa3[_0x64fb('0x31')][_0x64fb('0x42')]){_0x270534[_0x64fb('0x47')]=[{'all':!![]}];}_0x270534=_[_0x64fb('0x3f')]({},_0x270534,_0x39eaa3[_0x64fb('0x41')]);return db[_0x64fb('0x2b')][_0x64fb('0x48')](_0x270534)[_0x64fb('0x23')](handleEntityNotFound(_0x914611,null))[_0x64fb('0x23')](respondWithResult(_0x914611,null))[_0x64fb('0x49')](handleError(_0x914611,null));};exports['update']=function(_0x3ff282,_0x1afd89){if(_0x3ff282[_0x64fb('0x4a')]['id']){delete _0x3ff282[_0x64fb('0x4a')]['id'];}return db[_0x64fb('0x2b')][_0x64fb('0x48')]({'where':{'id':_0x3ff282['params']['id']}})[_0x64fb('0x23')](handleEntityNotFound(_0x1afd89,null))[_0x64fb('0x23')](saveUpdates(_0x3ff282[_0x64fb('0x4a')],null))[_0x64fb('0x23')](respondWithResult(_0x1afd89,null))['catch'](handleError(_0x1afd89,null));};exports[_0x64fb('0x4b')]=function(_0x201670,_0x50c7ac,_0x5da9fb){return db['sequelize'][_0x64fb('0x4c')](function(_0x57f14f){if(_0x201670[_0x64fb('0x4a')][_0x64fb('0x4d')]===_0x64fb('0x4e')){_0x201670['body'][_0x64fb('0x4f')]=path[_0x64fb('0x50')](config['root'],'server/files/moh',_0x201670['body'][_0x64fb('0x30')]);}return db[_0x64fb('0x2b')][_0x64fb('0x4b')](_0x201670['body'],{'transaction':_0x57f14f})[_0x64fb('0x23')](function(_0x3ee163){if(_0x201670['body'][_0x64fb('0x4d')]===_0x64fb('0x4e')){fs['mkdirSync'](_0x3ee163['directory'],parseInt(_0x64fb('0x51'),0x8));}var _0x3ee171=_0x201670['user'][_0x64fb('0x25')]({'plain':!![]});if(!_0x3ee171)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ee171[_0x64fb('0x52')]===_0x64fb('0x53')){var _0x32e215=_0x3ee163['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x64fb('0x26'),'userProfileId':_0x3ee171[_0x64fb('0x54')]},'raw':!![]})['then'](function(_0x214154){if(_0x214154&&_0x214154[_0x64fb('0x55')]===0x0){return db[_0x64fb('0x56')][_0x64fb('0x4b')]({'name':_0x32e215[_0x64fb('0x30')],'resourceId':_0x32e215['id'],'type':_0x214154[_0x64fb('0x30')],'sectionId':_0x214154['id']},{})[_0x64fb('0x23')](function(){return _0x3ee163;});}else{return _0x3ee163;}})[_0x64fb('0x49')](function(_0x5017f7){logger[_0x64fb('0x27')](_0x64fb('0x57'),_0x5017f7);});}return _0x3ee163;});})['then'](respondWithResult(_0x50c7ac,0xc9))[_0x64fb('0x49')](handleError(_0x50c7ac,null));};exports['destroy']=function(_0x2affc2,_0x470423,_0x220c23){var _0x4c76c5;return db[_0x64fb('0x2b')]['find']({'where':{'id':_0x2affc2['params']['id']}})['then'](function(_0x3e6cde){if(_0x3e6cde){return db['sequelize']['transaction'](function(_0x5a27d9){return _0x3e6cde[_0x64fb('0x24')]({'transaction':_0x5a27d9,'raw':!![]})[_0x64fb('0x23')](function(_0x1017c7){if(_0x1017c7['directory']){fs[_0x64fb('0x58')](_0x1017c7[_0x64fb('0x4f')])[_0x64fb('0x59')](function(_0x16513a){fs[_0x64fb('0x5a')](path[_0x64fb('0x50')](_0x1017c7[_0x64fb('0x4f')],_0x16513a));});fs[_0x64fb('0x5b')](_0x1017c7[_0x64fb('0x4f')]);}return _0x1017c7;});})[_0x64fb('0x49')](function(_0x20d3f4){throw new db['Sequelize'][(_0x64fb('0x5c'))](_0x20d3f4['message']);});}})[_0x64fb('0x23')](handleEntityNotFound(_0x470423,null))[_0x64fb('0x23')](removeEntity(_0x470423,null))[_0x64fb('0x49')](handleError(_0x470423,null));};exports[_0x64fb('0x5d')]=function(_0x33a02b,_0x334f29,_0x4ad87a){return db[_0x64fb('0x5e')][_0x64fb('0x4c')](function(_0x96ebb7){var _0x3c5895;return db[_0x64fb('0x2b')][_0x64fb('0x48')]({'where':{'id':_0x33a02b[_0x64fb('0x46')]['id']}})['then'](function(_0x163620){if(_0x163620){_0x3c5895=_0x163620;return _0x163620[_0x64fb('0x5d')](_0x33a02b['body']['id'],{'transaction':_0x96ebb7});}})['then'](function(_0x21496a){if(_0x21496a){return db[_0x64fb('0x5f')][_0x64fb('0x60')]({'where':{'id':_0x33a02b[_0x64fb('0x4a')]['id']},'attributes':['id',_0x64fb('0x30'),'save_name',_0x64fb('0x61'),_0x64fb('0x62')],'raw':!![]});}})[_0x64fb('0x23')](function(_0xc341f1){if(_0xc341f1){var _0x301251=path['join'](config[_0x64fb('0x63')],'server/files/sounds/converted',util[_0x64fb('0x64')]('%s.%s',path[_0x64fb('0x65')](_0xc341f1[_0x64fb('0x66')],path[_0x64fb('0x67')](_0xc341f1[_0x64fb('0x66')])),_0xc341f1[_0x64fb('0x61')]));var _0x12fdd6=path[_0x64fb('0x50')](config[_0x64fb('0x63')],'server/files/moh',_0x3c5895[_0x64fb('0x30')],util[_0x64fb('0x64')](_0x64fb('0x68'),_0xc341f1[_0x64fb('0x30')],_0xc341f1[_0x64fb('0x61')]));fs['symlinkSync'](_0x301251,_0x12fdd6);return _0xc341f1;}})[_0x64fb('0x49')](function(_0x4d8c27){throw new db['Sequelize'][(_0x64fb('0x5c'))](_0x4d8c27[_0x64fb('0x69')]);});})['then'](handleEntityNotFound(_0x334f29,null))[_0x64fb('0x23')](respondWithResult(_0x334f29,0xc9))[_0x64fb('0x49')](handleError(_0x334f29,null));};exports[_0x64fb('0x6a')]=function(_0x2a54fd,_0x2281c7,_0x5804c7){return db[_0x64fb('0x5e')]['transaction'](function(_0x10ecdc){var _0x465988;return db[_0x64fb('0x2b')][_0x64fb('0x60')]({'where':{'id':_0x2a54fd[_0x64fb('0x46')]['id']}})['then'](handleEntityNotFound(_0x2281c7,null))[_0x64fb('0x23')](function(_0x21dc4b){if(_0x21dc4b){_0x465988=_0x21dc4b;return _0x21dc4b[_0x64fb('0x6a')](_0x2a54fd[_0x64fb('0x46')]['id2']);}})[_0x64fb('0x23')](function(_0x293899){if(_0x293899){return db[_0x64fb('0x5f')][_0x64fb('0x60')]({'where':{'id':_0x2a54fd[_0x64fb('0x46')][_0x64fb('0x6b')]},'attributes':['id','name','save_name',_0x64fb('0x61'),_0x64fb('0x62')],'raw':!![]});}})[_0x64fb('0x23')](function(_0x5697c6){if(_0x5697c6){fs[_0x64fb('0x5a')](path[_0x64fb('0x50')](_0x465988[_0x64fb('0x4f')],util[_0x64fb('0x64')]('%s.%s',_0x5697c6['name'],_0x5697c6[_0x64fb('0x61')])));return _0x5697c6;}})[_0x64fb('0x49')](function(_0x1c5aa6){throw new db[(_0x64fb('0x6c'))]['ValidationError'](_0x1c5aa6[_0x64fb('0x69')]);});})[_0x64fb('0x23')](handleEntityNotFound(_0x2281c7,null))[_0x64fb('0x23')](respondWithStatusCode(_0x2281c7,0xcc))[_0x64fb('0x49')](handleError(_0x2281c7,null));};exports[_0x64fb('0x6d')]=function(_0x48abd0,_0x37214a,_0x3a9bb1){var _0x44c33b={};var _0x5f2aa1={};var _0x882544;var _0x4ad7a7;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x48abd0[_0x64fb('0x46')]['id']}})[_0x64fb('0x23')](handleEntityNotFound(_0x37214a,null))[_0x64fb('0x23')](function(_0x503779){if(_0x503779){_0x882544=_0x503779;_0x5f2aa1[_0x64fb('0x2f')]=_[_0x64fb('0x32')](db['Sound']['rawAttributes']);_0x5f2aa1['query']=_['keys'](_0x48abd0['query']);_0x5f2aa1[_0x64fb('0x33')]=_[_0x64fb('0x34')](_0x5f2aa1['model'],_0x5f2aa1[_0x64fb('0x31')]);_0x44c33b[_0x64fb('0x36')]=_[_0x64fb('0x34')](_0x5f2aa1[_0x64fb('0x2f')],qs[_0x64fb('0x35')](_0x48abd0[_0x64fb('0x31')]['fields']));_0x44c33b['attributes']=_0x44c33b['attributes']['length']?_0x44c33b[_0x64fb('0x36')]:_0x5f2aa1[_0x64fb('0x2f')];_0x44c33b[_0x64fb('0x3a')]=qs[_0x64fb('0x3b')](_0x48abd0[_0x64fb('0x31')][_0x64fb('0x3b')]);_0x44c33b[_0x64fb('0x3c')]=qs['filters'](_[_0x64fb('0x3d')](_0x48abd0[_0x64fb('0x31')],_0x5f2aa1[_0x64fb('0x33')]));if(_0x48abd0[_0x64fb('0x31')][_0x64fb('0x3e')]){_0x44c33b[_0x64fb('0x3c')]=_[_0x64fb('0x3f')](_0x44c33b['where'],{'$or':_[_0x64fb('0x2a')](_0x44c33b[_0x64fb('0x36')],function(_0xe7fecc){var _0xcceaca={};_0xcceaca[_0xe7fecc]={'$like':'%'+_0x48abd0[_0x64fb('0x31')][_0x64fb('0x3e')]+'%'};return _0xcceaca;})});}_0x44c33b=_[_0x64fb('0x3f')]({},_0x44c33b,_0x48abd0[_0x64fb('0x41')]);return _0x882544[_0x64fb('0x6d')](_0x44c33b);}})[_0x64fb('0x23')](function(_0x3265a8){if(_0x3265a8){_0x4ad7a7=_0x3265a8[_0x64fb('0x37')];if(!_0x48abd0[_0x64fb('0x31')]['hasOwnProperty'](_0x64fb('0x39'))){_0x44c33b[_0x64fb('0x1b')]=qs['limit'](_0x48abd0['query'][_0x64fb('0x1b')]);_0x44c33b[_0x64fb('0x19')]=qs['offset'](_0x48abd0[_0x64fb('0x31')]['offset']);}return _0x882544[_0x64fb('0x6d')](_0x44c33b);}})[_0x64fb('0x23')](function(_0x152ab2){if(_0x152ab2){return _0x152ab2?{'count':_0x4ad7a7,'rows':_0x152ab2}:null;}})[_0x64fb('0x23')](respondWithResult(_0x37214a,null))[_0x64fb('0x49')](handleError(_0x37214a,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index ec209cd..aea3499 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 _0x9dca=['define','voice_musiconhold','lodash','util','../../config/logger','api','bluebird','../../config/environment','./voiceMusicOnHold.attributes','exports'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x9dca,0x188));var _0xa9dc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9dca[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa9dc('0x0'));var util=require(_0xa9dc('0x1'));var logger=require(_0xa9dc('0x2'))(_0xa9dc('0x3'));var moment=require('moment');var BPromise=require(_0xa9dc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa9dc('0x5'));var attributes=require(_0xa9dc('0x6'));module[_0xa9dc('0x7')]=function(_0x31fcdd,_0x490856){return _0x31fcdd[_0xa9dc('0x8')]('VoiceMusicOnHold',attributes,{'tableName':_0xa9dc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39b5=['VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define'];(function(_0x3aa616,_0x463b69){var _0x15eb62=function(_0x5be47e){while(--_0x5be47e){_0x3aa616['push'](_0x3aa616['shift']());}};_0x15eb62(++_0x463b69);}(_0x39b5,0x1b5));var _0x539b=function(_0x264837,_0x8063db){_0x264837=_0x264837-0x0;var _0xd4bc13=_0x39b5[_0x264837];return _0xd4bc13;};'use strict';var _=require(_0x539b('0x0'));var util=require(_0x539b('0x1'));var logger=require(_0x539b('0x2'))(_0x539b('0x3'));var moment=require(_0x539b('0x4'));var BPromise=require(_0x539b('0x5'));var rp=require(_0x539b('0x6'));var fs=require('fs');var path=require(_0x539b('0x7'));var rimraf=require(_0x539b('0x8'));var config=require(_0x539b('0x9'));var attributes=require(_0x539b('0xa'));module[_0x539b('0xb')]=function(_0x2ed737,_0x4f1d0b){return _0x2ed737[_0x539b('0xc')](_0x539b('0xd'),attributes,{'tableName':_0x539b('0xe'),'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 8f8ab48..7cbade5 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 _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(_0x5f446e,_0x24c66b){var _0x384a84=function(_0x2251c2){while(--_0x2251c2){_0x5f446e['push'](_0x5f446e['shift']());}};_0x384a84(++_0x24c66b);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'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 +var _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xd5b7f7,_0x55cfdb){var _0xf018b3=function(_0x21acfd){while(--_0x21acfd){_0xd5b7f7['push'](_0xd5b7f7['shift']());}};_0xf018b3(++_0x55cfdb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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/voicePrefix/index.js b/server/api/voicePrefix/index.js index f1a91c6..b4c199f 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 _0xa41a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','describe','/:id','show','get','/:id/users','getAgents','/:id/teams','getTeams','post','addAgents','put','update','delete','removeAgents','removeTeams','exports','multer','util','connect-timeout','express','Router'];(function(_0x390801,_0x43ec03){var _0x5381f9=function(_0x42f265){while(--_0x42f265){_0x390801['push'](_0x390801['shift']());}};_0x5381f9(++_0x43ec03);}(_0xa41a,0x6b));var _0xaa41=function(_0x4bde3e,_0x4ae680){_0x4bde3e=_0x4bde3e-0x0;var _0x2e37bb=_0xa41a[_0x4bde3e];return _0x2e37bb;};'use strict';var multer=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var path=require('path');var timeout=require(_0xaa41('0x2'));var express=require(_0xaa41('0x3'));var router=express[_0xaa41('0x4')]();var fs_extra=require(_0xaa41('0x5'));var auth=require(_0xaa41('0x6'));var interaction=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var controller=require(_0xaa41('0x9'));router['get']('/',auth[_0xaa41('0xa')](),controller[_0xaa41('0xb')]);router['get']('/describe',auth[_0xaa41('0xa')](),controller[_0xaa41('0xc')]);router['get'](_0xaa41('0xd'),auth[_0xaa41('0xa')](),controller[_0xaa41('0xe')]);router[_0xaa41('0xf')](_0xaa41('0x10'),auth[_0xaa41('0xa')](),controller[_0xaa41('0x11')]);router[_0xaa41('0xf')](_0xaa41('0x12'),auth['isAuthenticated'](),controller[_0xaa41('0x13')]);router[_0xaa41('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0xaa41('0x14')]('/:id/users',auth[_0xaa41('0xa')](),controller[_0xaa41('0x15')]);router[_0xaa41('0x14')](_0xaa41('0x12'),auth[_0xaa41('0xa')](),controller['addTeams']);router[_0xaa41('0x16')](_0xaa41('0xd'),auth[_0xaa41('0xa')](),controller[_0xaa41('0x17')]);router[_0xaa41('0x18')](_0xaa41('0xd'),auth[_0xaa41('0xa')](),controller['destroy']);router[_0xaa41('0x18')](_0xaa41('0x10'),auth[_0xaa41('0xa')](),controller[_0xaa41('0x19')]);router[_0xaa41('0x18')](_0xaa41('0x12'),auth[_0xaa41('0xa')](),controller[_0xaa41('0x1a')]);module[_0xaa41('0x1b')]=router; \ No newline at end of file +var _0xea81=['addTeams','put','update','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xea81,0x1ed));var _0x1ea8=function(_0x4810a3,_0x354a38){_0x4810a3=_0x4810a3-0x0;var _0x3c0dc9=_0xea81[_0x4810a3];return _0x3c0dc9;};'use strict';var multer=require(_0x1ea8('0x0'));var util=require(_0x1ea8('0x1'));var path=require(_0x1ea8('0x2'));var timeout=require(_0x1ea8('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1ea8('0x4'));var auth=require(_0x1ea8('0x5'));var interaction=require(_0x1ea8('0x6'));var config=require(_0x1ea8('0x7'));var controller=require(_0x1ea8('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x1ea8('0x9')](_0x1ea8('0xa'),auth[_0x1ea8('0xb')](),controller[_0x1ea8('0xc')]);router['get'](_0x1ea8('0xd'),auth[_0x1ea8('0xb')](),controller[_0x1ea8('0xe')]);router[_0x1ea8('0x9')](_0x1ea8('0xf'),auth['isAuthenticated'](),controller[_0x1ea8('0x10')]);router['get'](_0x1ea8('0x11'),auth[_0x1ea8('0xb')](),controller[_0x1ea8('0x12')]);router[_0x1ea8('0x13')]('/',auth[_0x1ea8('0xb')](),controller['create']);router['post'](_0x1ea8('0xf'),auth[_0x1ea8('0xb')](),controller['addAgents']);router[_0x1ea8('0x13')](_0x1ea8('0x11'),auth[_0x1ea8('0xb')](),controller[_0x1ea8('0x14')]);router[_0x1ea8('0x15')]('/:id',auth[_0x1ea8('0xb')](),controller[_0x1ea8('0x16')]);router[_0x1ea8('0x17')]('/:id',auth[_0x1ea8('0xb')](),controller[_0x1ea8('0x18')]);router['delete']('/:id/users',auth[_0x1ea8('0xb')](),controller['removeAgents']);router[_0x1ea8('0x17')]('/:id/teams',auth[_0x1ea8('0xb')](),controller[_0x1ea8('0x19')]);module[_0x1ea8('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index a351710..802a90f 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 _0x15fe=['system-','getDataValue','name','INTEGER','sequelize','exports','STRING','VIRTUAL'];(function(_0x54f423,_0x2cde1d){var _0x2f80a9=function(_0x35c597){while(--_0x35c597){_0x54f423['push'](_0x54f423['shift']());}};_0x2f80a9(++_0x2cde1d);}(_0x15fe,0x144));var _0xe15f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x15fe[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe15f('0x0'));module[_0xe15f('0x1')]={'name':{'type':Sequelize[_0xe15f('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0xe15f('0x3')],'get':function(_0xe34c55){return _0xe15f('0x4')+this[_0xe15f('0x5')](_0xe15f('0x6'))+'-';}},'description':{'type':Sequelize[_0xe15f('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0xe15f('0x7')]}}; \ No newline at end of file +var _0x7127=['STRING','name','VIRTUAL','system-','getDataValue','sequelize','exports'];(function(_0x2f852c,_0x5bdadd){var _0x13f8ab=function(_0x294cea){while(--_0x294cea){_0x2f852c['push'](_0x2f852c['shift']());}};_0x13f8ab(++_0x5bdadd);}(_0x7127,0xc9));var _0x7712=function(_0x12bab4,_0x48412b){_0x12bab4=_0x12bab4-0x0;var _0x14c1eb=_0x7127[_0x12bab4];return _0x14c1eb;};'use strict';var Sequelize=require(_0x7712('0x0'));module[_0x7712('0x1')]={'name':{'type':Sequelize[_0x7712('0x2')],'allowNull':![],'unique':_0x7712('0x3')},'prefix':{'type':Sequelize[_0x7712('0x4')],'get':function(_0x59fc3b){return _0x7712('0x5')+this[_0x7712('0x6')](_0x7712('0x3'))+'-';}},'description':{'type':Sequelize[_0x7712('0x2')]},'callerIdAll':{'type':Sequelize[_0x7712('0x2')]},'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 d34ba57..c48a88c 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 _0x1399=['Extensions\x20creation\x20failed','push','Set','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','charAt','system-','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','Team','getTeams','addTeams','online','voicePause','interface','flatMap','Agents','sequelize','each','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','compact','value','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./voicePrefix.socket','register','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','get','VoicePrefixes','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','VoicePrefix','findAll','catch','show','params','includeAll','find','describe','transaction','create','body','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','error','context','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate'];(function(_0x9b12da,_0xf22341){var _0x263db6=function(_0x1b740f){while(--_0x1b740f){_0x9b12da['push'](_0x9b12da['shift']());}};_0x263db6(++_0xf22341);}(_0x1399,0x16c));var _0x9139=function(_0x436adc,_0x5c9ae1){_0x436adc=_0x436adc-0x0;var _0x421a87=_0x1399[_0x436adc];return _0x421a87;};'use strict';var emlformat=require(_0x9139('0x0'));var rimraf=require(_0x9139('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9139('0x2'));var rp=require('request-promise');var moment=require(_0x9139('0x3'));var BPromise=require(_0x9139('0x4'));var Mustache=require(_0x9139('0x5'));var util=require(_0x9139('0x6'));var path=require(_0x9139('0x7'));var sox=require(_0x9139('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9139('0x9'));var _=require(_0x9139('0xa'));var squel=require(_0x9139('0xb'));var crypto=require('crypto');var jsforce=require(_0x9139('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9139('0xd'));var Papa=require(_0x9139('0xe'));var Redis=require('ioredis');var authService=require(_0x9139('0xf'));var qs=require(_0x9139('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9139('0x11'))(_0x9139('0x12'));var utils=require(_0x9139('0x13'));var config=require(_0x9139('0x14'));var licenseUtil=require(_0x9139('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x9139('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x9139('0x17'))(new Redis(config[_0x9139('0x16')]));require(_0x9139('0x18'))[_0x9139('0x19')](socket);function respondWithStatusCode(_0x5936d2,_0x3b1f21){_0x3b1f21=_0x3b1f21||0xcc;return function(_0x4d1a85){if(_0x4d1a85){return _0x5936d2['sendStatus'](_0x3b1f21);}return _0x5936d2['status'](_0x3b1f21)[_0x9139('0x1a')]();};}function respondWithResult(_0x3e2bad,_0x1cd24e){_0x1cd24e=_0x1cd24e||0xc8;return function(_0x3fadf7){if(_0x3fadf7){return _0x3e2bad[_0x9139('0x1b')](_0x1cd24e)[_0x9139('0x1c')](_0x3fadf7);}};}function respondWithFilteredResult(_0x4bd957,_0x57b9df){return function(_0x13cab8){if(_0x13cab8){var _0xe39cbc=typeof _0x57b9df['offset']==='undefined'&&typeof _0x57b9df[_0x9139('0x1d')]===_0x9139('0x1e');var _0x56add4=_0x13cab8[_0x9139('0x1f')];var _0x1ef57b=_0xe39cbc?0x0:_0x57b9df[_0x9139('0x20')];var _0x3c8296=_0xe39cbc?_0x13cab8[_0x9139('0x1f')]:_0x57b9df[_0x9139('0x20')]+_0x57b9df[_0x9139('0x1d')];var _0x45fa16;if(_0x3c8296>=_0x56add4){_0x3c8296=_0x56add4;_0x45fa16=0xc8;}else{_0x45fa16=0xce;}_0x4bd957[_0x9139('0x1b')](_0x45fa16);return _0x4bd957[_0x9139('0x21')](_0x9139('0x22'),_0x1ef57b+'-'+_0x3c8296+'/'+_0x56add4)[_0x9139('0x1c')](_0x13cab8);}return null;};}function patchUpdates(_0x5a3e2e){return function(_0x105170){try{jsonpatch[_0x9139('0x23')](_0x105170,_0x5a3e2e,!![]);}catch(_0x31635a){return BPromise[_0x9139('0x24')](_0x31635a);}return _0x105170[_0x9139('0x25')]();};}function saveUpdates(_0x1a7350,_0x4b7fe0){return function(_0x28bf7d){if(_0x28bf7d){return _0x28bf7d[_0x9139('0x26')](_0x1a7350)['then'](function(_0x3ed4da){return _0x3ed4da;});}return null;};}function removeEntity(_0x2ee4bb,_0x10bfa0){return function(_0x4a3ed2){if(_0x4a3ed2){return _0x4a3ed2[_0x9139('0x27')]()[_0x9139('0x28')](function(){var _0x49d01e=_0x4a3ed2[_0x9139('0x29')]({'plain':!![]});var _0x39e8cf=_0x9139('0x2a');return db['UserProfileResource'][_0x9139('0x27')]({'where':{'type':_0x39e8cf,'resourceId':_0x49d01e['id']}})[_0x9139('0x28')](function(){return _0x4a3ed2;});})[_0x9139('0x28')](function(){_0x2ee4bb[_0x9139('0x1b')](0xcc)[_0x9139('0x1a')]();});}};}function handleEntityNotFound(_0x16dfb4,_0xfe6854){return function(_0x573a05){if(!_0x573a05){_0x16dfb4['sendStatus'](0x194);}return _0x573a05;};}function handleError(_0x1b3fd9,_0x22d0f8){_0x22d0f8=_0x22d0f8||0x1f4;return function(_0xd27355){logger['error'](_0xd27355['stack']);if(_0xd27355[_0x9139('0x2b')]){delete _0xd27355[_0x9139('0x2b')];}_0x1b3fd9[_0x9139('0x1b')](_0x22d0f8)[_0x9139('0x2c')](_0xd27355);};}exports[_0x9139('0x2d')]=function(_0x541644,_0x5a1673){var _0x2f26de={},_0x57a6fb={},_0x4de1a2={'count':0x0,'rows':[]};var _0x222429=_[_0x9139('0x2e')](db['VoicePrefix'][_0x9139('0x2f')],function(_0xe658c2){return{'name':_0xe658c2['fieldName'],'type':_0xe658c2[_0x9139('0x30')][_0x9139('0x31')]};});_0x57a6fb[_0x9139('0x32')]=_[_0x9139('0x2e')](_0x222429,_0x9139('0x2b'));_0x57a6fb[_0x9139('0x33')]=_[_0x9139('0x34')](_0x541644[_0x9139('0x33')]);_0x57a6fb[_0x9139('0x35')]=_[_0x9139('0x36')](_0x57a6fb[_0x9139('0x32')],_0x57a6fb['query']);_0x2f26de[_0x9139('0x37')]=_[_0x9139('0x36')](_0x57a6fb['model'],qs[_0x9139('0x38')](_0x541644[_0x9139('0x33')][_0x9139('0x38')]));_0x2f26de['attributes']=_0x2f26de[_0x9139('0x37')][_0x9139('0x39')]?_0x2f26de[_0x9139('0x37')]:_0x57a6fb[_0x9139('0x32')];if(!_0x541644[_0x9139('0x33')][_0x9139('0x3a')](_0x9139('0x3b'))){_0x2f26de[_0x9139('0x1d')]=qs[_0x9139('0x1d')](_0x541644[_0x9139('0x33')]['limit']);_0x2f26de[_0x9139('0x20')]=qs[_0x9139('0x20')](_0x541644[_0x9139('0x33')][_0x9139('0x20')]);}_0x2f26de[_0x9139('0x3c')]=qs[_0x9139('0x3d')](_0x541644[_0x9139('0x33')]['sort']);_0x2f26de[_0x9139('0x3e')]=qs['filters'](_[_0x9139('0x3f')](_0x541644[_0x9139('0x33')],_0x57a6fb[_0x9139('0x35')]),_0x222429);if(_0x541644['query'][_0x9139('0x40')]){_0x2f26de[_0x9139('0x3e')]=_[_0x9139('0x41')](_0x2f26de[_0x9139('0x3e')],{'$or':_[_0x9139('0x2e')](_0x222429,function(_0xe90991){if(_0xe90991[_0x9139('0x30')]!==_0x9139('0x42')){var _0x118d53={};_0x118d53[_0xe90991[_0x9139('0x2b')]]={'$like':'%'+_0x541644['query'][_0x9139('0x40')]+'%'};return _0x118d53;}})});}_0x2f26de=_[_0x9139('0x41')]({},_0x2f26de,_0x541644[_0x9139('0x43')]);var _0x4b8dd7={'where':_0x2f26de['where']};return db['VoicePrefix'][_0x9139('0x1f')](_0x4b8dd7)[_0x9139('0x28')](function(_0x3611b4){_0x4de1a2[_0x9139('0x1f')]=_0x3611b4;if(_0x541644[_0x9139('0x33')]['includeAll']){_0x2f26de[_0x9139('0x44')]=[{'all':!![]}];}return db[_0x9139('0x45')][_0x9139('0x46')](_0x2f26de);})[_0x9139('0x28')](function(_0x2197ff){_0x4de1a2['rows']=_0x2197ff;return _0x4de1a2;})[_0x9139('0x28')](respondWithFilteredResult(_0x5a1673,_0x2f26de))[_0x9139('0x47')](handleError(_0x5a1673,null));};exports[_0x9139('0x48')]=function(_0x197891,_0x539a55){var _0x5b0aec={'raw':![],'where':{'id':_0x197891[_0x9139('0x49')]['id']}},_0x39d3dc={};_0x39d3dc['model']=_['keys'](db[_0x9139('0x45')][_0x9139('0x2f')]);_0x39d3dc['query']=_[_0x9139('0x34')](_0x197891[_0x9139('0x33')]);_0x39d3dc['filters']=_[_0x9139('0x36')](_0x39d3dc['model'],_0x39d3dc['query']);_0x5b0aec[_0x9139('0x37')]=_[_0x9139('0x36')](_0x39d3dc[_0x9139('0x32')],qs[_0x9139('0x38')](_0x197891[_0x9139('0x33')]['fields']));_0x5b0aec[_0x9139('0x37')]=_0x5b0aec[_0x9139('0x37')][_0x9139('0x39')]?_0x5b0aec['attributes']:_0x39d3dc[_0x9139('0x32')];if(_0x197891[_0x9139('0x33')][_0x9139('0x4a')]){_0x5b0aec[_0x9139('0x44')]=[{'all':!![]}];}_0x5b0aec=_[_0x9139('0x41')]({},_0x5b0aec,_0x197891[_0x9139('0x43')]);return db[_0x9139('0x45')][_0x9139('0x4b')](_0x5b0aec)[_0x9139('0x28')](handleEntityNotFound(_0x539a55,null))[_0x9139('0x28')](respondWithResult(_0x539a55,null))[_0x9139('0x47')](handleError(_0x539a55,null));};exports['destroy']=function(_0x10eb03,_0x2e1bbe){return db[_0x9139('0x45')]['find']({'where':{'id':_0x10eb03[_0x9139('0x49')]['id']}})[_0x9139('0x28')](handleEntityNotFound(_0x2e1bbe,null))['then'](removeEntity(_0x2e1bbe,null))[_0x9139('0x47')](handleError(_0x2e1bbe,null));};exports[_0x9139('0x4c')]=function(_0x83f1d2,_0x5180b5){return db[_0x9139('0x45')][_0x9139('0x4c')]()[_0x9139('0x28')](respondWithResult(_0x5180b5,null))[_0x9139('0x47')](handleError(_0x5180b5,null));};exports['create']=function(_0x2b6948,_0x1a2a2d){var _0x3ba071;return db['sequelize'][_0x9139('0x4d')](function(_0x146201){return db[_0x9139('0x45')][_0x9139('0x4e')](_0x2b6948[_0x9139('0x4f')],{'transaction':_0x146201})[_0x9139('0x28')](function(_0x2b22fa){_0x3ba071=_0x2b22fa['get']({'plain':!![]});return db[_0x9139('0x50')][_0x9139('0x4b')]({'where':{'id':_0x3ba071['VoiceExtensionId']},'raw':!![]})[_0x9139('0x28')](function(_0x1e1290){return createVoicePrefixExtensions(_0x3ba071,_0x1e1290,_0x146201);});});})[_0x9139('0x28')](function(){var _0x1a0841=_0x2b6948[_0x9139('0x51')]['get']({'plain':!![]});if(!_0x1a0841)throw new Error(_0x9139('0x52'));if(_0x1a0841[_0x9139('0x53')]==='user'){var _0x500863=_0x3ba071;return db[_0x9139('0x54')][_0x9139('0x4b')]({'where':{'name':_0x9139('0x2a'),'userProfileId':_0x1a0841['userProfileId']},'raw':!![]})[_0x9139('0x28')](function(_0x576b5a){if(_0x576b5a&&_0x576b5a['autoAssociation']===0x0){return db[_0x9139('0x55')][_0x9139('0x4e')]({'name':_0x500863[_0x9139('0x2b')],'resourceId':_0x500863['id'],'type':_0x576b5a[_0x9139('0x2b')],'sectionId':_0x576b5a['id']},{})['then'](function(){return _0x3ba071;});}else{return _0x3ba071;}})[_0x9139('0x47')](function(_0x91a5a8){logger[_0x9139('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x91a5a8);throw _0x91a5a8;});}return _0x3ba071;})[_0x9139('0x28')](respondWithResult(_0x1a2a2d,null))[_0x9139('0x47')](handleError(_0x1a2a2d,null));};function Extension(_0x25cf0f,_0x73d4fc,_0x163730,_0x3f7e41){this[_0x9139('0x57')]=_0x9139('0x58');this[_0x9139('0x59')]=_0x25cf0f;this[_0x9139('0x5a')]=_0x163730;this[_0x9139('0x30')]=_0x9139('0x5b');this[_0x9139('0x5c')]=_0x9139('0x5d');this['priority']=_0x73d4fc;this[_0x9139('0x5e')]=_0x3f7e41;}function createVoicePrefixExtensions(_0x32b31b,_0x3ef34c,_0x37433c){return new BPromise(function(_0x40afea,_0x53c09a){var _0x3feaac=new Extension(formatPrefixName(_0x32b31b[_0x9139('0x5f')]),0x1,_0x9139('0x60'),_0x9139('0x61'));_0x3feaac[_0x9139('0x62')]=_0x32b31b['id'];return db['VoiceExtension']['create'](_0x3feaac,{'transaction':_0x37433c})[_0x9139('0x28')](function(_0x3a0bc6){var _0x4b0274=_0x3a0bc6[_0x9139('0x29')]({'plain':!![]});var _0xd20c65=_[_0x9139('0x2e')](addVoicePrefixExtensions(_0x32b31b,_0x3ef34c),function(_0x4c125e){_0x4c125e[_0x9139('0x63')]=_0x4b0274['id'];_0x4c125e[_0x9139('0x62')]=_0x32b31b['id'];return _0x4c125e;});return db[_0x9139('0x50')][_0x9139('0x64')](_0xd20c65,{'transaction':_0x37433c})[_0x9139('0x28')](function(_0x53a27f){if(!_0x53a27f){return _0x53c09a(_0x9139('0x65'));}else{return _0x40afea(_0x53a27f);}})[_0x9139('0x47')](function(_0x336230){return _0x53c09a(_0x336230);});});;});};function addVoicePrefixExtensions(_0x26fe55,_0x4f6e7c){var _0x53152f=[];var _0x46b5cb=formatPrefixName(_0x26fe55[_0x9139('0x5f')]);_0x53152f[_0x9139('0x66')](new Extension(_0x46b5cb,0x2,_0x9139('0x67'),'CDR(prefix)='+_0x26fe55[_0x9139('0x2b')]));if(_0x26fe55[_0x9139('0x68')]){_0x53152f['push'](new Extension(_0x46b5cb,0x3,_0x9139('0x67'),_0x9139('0x69')+_0x26fe55[_0x9139('0x68')]));}else{_0x53152f[_0x9139('0x66')](new Extension(_0x46b5cb,0x3,_0x9139('0x60'),_0x9139('0x6a')));}_0x53152f[_0x9139('0x66')](new Extension(_0x46b5cb,0x4,_0x9139('0x6b'),_0x4f6e7c['context']+','+'${EXTEN:'+(0x8+_0x26fe55['name'][_0x9139('0x39')])+'}'+','+0x1));return _0x53152f;}function formatPrefixName(_0x1025d6){var _0x2235fb='_';for(var _0x4eefd8=0x0;_0x4eefd8<_0x1025d6[_0x9139('0x39')];_0x4eefd8++){if(_0x1025d6[_0x9139('0x6c')](_0x4eefd8)=='-'){_0x2235fb+=_0x1025d6[_0x9139('0x6c')](_0x4eefd8);}else{_0x2235fb+='['+_0x1025d6[_0x9139('0x6c')](_0x4eefd8)+']';}}_0x2235fb+='.';return _0x2235fb;}exports[_0x9139('0x26')]=function(_0x3aacdb,_0x5d9ae8,_0x437d18){var _0x582b67=_0x3aacdb[_0x9139('0x4f')];_0x582b67['prefix']=_0x9139('0x6d')+_0x582b67[_0x9139('0x2b')]+'-';return db['sequelize']['transaction'](function(_0x4324ed){return db[_0x9139('0x45')][_0x9139('0x26')](_0x582b67,{'where':{'id':_0x582b67['id']},'transaction':_0x4324ed})['then'](function(){return db[_0x9139('0x50')][_0x9139('0x27')]({'where':{'VoicePrefixId':_0x582b67['id']},'transaction':_0x4324ed})[_0x9139('0x28')](function(){return db[_0x9139('0x50')]['find']({'where':{'id':_0x582b67['VoiceExtensionId']},'raw':!![]})[_0x9139('0x28')](function(_0x2462fc){return createVoicePrefixExtensions(_0x582b67,_0x2462fc,_0x4324ed);});});});})['then'](function(){return db[_0x9139('0x45')][_0x9139('0x6e')](_0x582b67['id']);})[_0x9139('0x28')](respondWithResult(_0x5d9ae8,null))[_0x9139('0x47')](handleError(_0x5d9ae8,null));};exports[_0x9139('0x6f')]=function(_0x400ac9,_0x3c17fd,_0x3167bb){return db[_0x9139('0x45')][_0x9139('0x4b')]({'where':{'id':_0x400ac9[_0x9139('0x49')]['id']}})[_0x9139('0x28')](handleEntityNotFound(_0x3c17fd,null))[_0x9139('0x28')](function(_0x582a47){if(_0x582a47){return _0x582a47[_0x9139('0x6f')](_0x400ac9[_0x9139('0x4f')][_0x9139('0x70')],_[_0x9139('0x71')](_0x400ac9[_0x9139('0x4f')],['ids','id'])||{})[_0x9139('0x72')](function(_0x54cd2a){for(var _0x14868a=0x0;_0x14868a<_0x400ac9[_0x9139('0x4f')][_0x9139('0x70')]['length'];_0x14868a+=0x1){socket[_0x9139('0x73')](_0x9139('0x74'),{'UserId':Number(_0x400ac9['body'][_0x9139('0x70')][_0x14868a]),'VoicePrefixId':Number(_0x400ac9[_0x9139('0x49')]['id'])});}return _0x54cd2a;});}})[_0x9139('0x28')](respondWithResult(_0x3c17fd,null))[_0x9139('0x47')](handleError(_0x3c17fd,null));};exports[_0x9139('0x75')]=function(_0x451458,_0x1abb10,_0x24b8d8){return db[_0x9139('0x45')]['find']({'where':{'id':_0x451458[_0x9139('0x49')]['id']}})[_0x9139('0x28')](handleEntityNotFound(_0x1abb10,null))[_0x9139('0x28')](function(_0x3c3474){if(_0x3c3474){return _0x3c3474[_0x9139('0x75')](_0x451458['query'][_0x9139('0x70')])[_0x9139('0x28')](function(){if(_['isArray'](_0x451458['query'][_0x9139('0x70')])){for(var _0x377234=0x0;_0x377234<_0x451458[_0x9139('0x33')][_0x9139('0x70')]['length'];_0x377234+=0x1){socket[_0x9139('0x73')](_0x9139('0x76'),{'UserId':Number(_0x451458[_0x9139('0x33')][_0x9139('0x70')][_0x377234]),'VoicePrefixId':Number(_0x451458[_0x9139('0x49')]['id'])});}}else{socket[_0x9139('0x73')](_0x9139('0x76'),{'UserId':Number(_0x451458[_0x9139('0x33')][_0x9139('0x70')]),'VoicePrefixId':Number(_0x451458[_0x9139('0x49')]['id'])});}});}})[_0x9139('0x28')](respondWithStatusCode(_0x1abb10,null))[_0x9139('0x47')](handleError(_0x1abb10,null));};exports[_0x9139('0x77')]=function(_0x100c61,_0x1bcf40,_0x402a07){var _0x4152b2={};var _0x43a3d4={};var _0x2d9821;var _0x55ac7a;return db[_0x9139('0x45')][_0x9139('0x78')]({'where':{'id':_0x100c61[_0x9139('0x49')]['id']}})[_0x9139('0x28')](handleEntityNotFound(_0x1bcf40,null))[_0x9139('0x28')](function(_0x4c633e){if(_0x4c633e){_0x2d9821=_0x4c633e;_0x43a3d4[_0x9139('0x32')]=_[_0x9139('0x34')](db[_0x9139('0x79')][_0x9139('0x2f')]);_0x43a3d4[_0x9139('0x33')]=_[_0x9139('0x34')](_0x100c61[_0x9139('0x33')]);_0x43a3d4['filters']=_['intersection'](_0x43a3d4[_0x9139('0x32')],_0x43a3d4[_0x9139('0x33')]);_0x4152b2[_0x9139('0x37')]=_[_0x9139('0x36')](_0x43a3d4['model'],qs['fields'](_0x100c61[_0x9139('0x33')][_0x9139('0x38')]));_0x4152b2[_0x9139('0x37')]=_0x4152b2[_0x9139('0x37')][_0x9139('0x39')]?_0x4152b2[_0x9139('0x37')]:_0x43a3d4[_0x9139('0x32')];_0x4152b2[_0x9139('0x3c')]=qs[_0x9139('0x3d')](_0x100c61['query'][_0x9139('0x3d')]);_0x4152b2['where']=qs[_0x9139('0x35')](_[_0x9139('0x3f')](_0x100c61[_0x9139('0x33')],_0x43a3d4[_0x9139('0x35')]));if(_0x100c61['query']['filter']){_0x4152b2[_0x9139('0x3e')]=_[_0x9139('0x41')](_0x4152b2[_0x9139('0x3e')],{'$or':_[_0x9139('0x2e')](_0x4152b2[_0x9139('0x37')],function(_0x49bdc7){var _0x47e8bf={};_0x47e8bf[_0x49bdc7]={'$like':'%'+_0x100c61[_0x9139('0x33')]['filter']+'%'};return _0x47e8bf;})});}_0x4152b2=_[_0x9139('0x41')]({},_0x4152b2,_0x100c61[_0x9139('0x43')]);return _0x2d9821[_0x9139('0x77')](_0x4152b2);}})['then'](function(_0x22ce9c){if(_0x22ce9c){_0x55ac7a=_0x22ce9c[_0x9139('0x39')];if(!_0x100c61[_0x9139('0x33')][_0x9139('0x3a')](_0x9139('0x3b'))){_0x4152b2[_0x9139('0x1d')]=qs['limit'](_0x100c61[_0x9139('0x33')][_0x9139('0x1d')]);_0x4152b2[_0x9139('0x20')]=qs[_0x9139('0x20')](_0x100c61['query']['offset']);}return _0x2d9821[_0x9139('0x77')](_0x4152b2);}})[_0x9139('0x28')](function(_0x4fe06f){if(_0x4fe06f){return _0x4fe06f?{'count':_0x55ac7a,'rows':_0x4fe06f}:null;}})['then'](respondWithResult(_0x1bcf40,null))[_0x9139('0x47')](handleError(_0x1bcf40,null));};exports['getTeams']=function(_0x43514f,_0x550504,_0x580185){var _0x21c1e0={};var _0x2ed30b={};var _0x7eeefb;var _0x22349d;return db[_0x9139('0x45')]['findOne']({'where':{'id':_0x43514f['params']['id']}})[_0x9139('0x28')](handleEntityNotFound(_0x550504,null))[_0x9139('0x28')](function(_0x459e1e){if(_0x459e1e){_0x7eeefb=_0x459e1e;_0x2ed30b[_0x9139('0x32')]=_['keys'](db[_0x9139('0x7a')]['rawAttributes']);_0x2ed30b[_0x9139('0x33')]=_[_0x9139('0x34')](_0x43514f[_0x9139('0x33')]);_0x2ed30b['filters']=_[_0x9139('0x36')](_0x2ed30b['model'],_0x2ed30b['query']);_0x21c1e0[_0x9139('0x37')]=_[_0x9139('0x36')](_0x2ed30b[_0x9139('0x32')],qs['fields'](_0x43514f[_0x9139('0x33')]['fields']));_0x21c1e0[_0x9139('0x37')]=_0x21c1e0[_0x9139('0x37')][_0x9139('0x39')]?_0x21c1e0[_0x9139('0x37')]:_0x2ed30b[_0x9139('0x32')];_0x21c1e0[_0x9139('0x3c')]=qs['sort'](_0x43514f['query'][_0x9139('0x3d')]);_0x21c1e0[_0x9139('0x3e')]=qs[_0x9139('0x35')](_[_0x9139('0x3f')](_0x43514f[_0x9139('0x33')],_0x2ed30b['filters']));if(_0x43514f['query'][_0x9139('0x40')]){_0x21c1e0[_0x9139('0x3e')]=_[_0x9139('0x41')](_0x21c1e0[_0x9139('0x3e')],{'$or':_[_0x9139('0x2e')](_0x21c1e0[_0x9139('0x37')],function(_0x5614df){var _0x55e8d7={};_0x55e8d7[_0x5614df]={'$like':'%'+_0x43514f[_0x9139('0x33')][_0x9139('0x40')]+'%'};return _0x55e8d7;})});}_0x21c1e0=_[_0x9139('0x41')]({},_0x21c1e0,_0x43514f['options']);return _0x7eeefb['getTeams'](_0x21c1e0);}})[_0x9139('0x28')](function(_0x4f8488){if(_0x4f8488){_0x22349d=_0x4f8488[_0x9139('0x39')];if(!_0x43514f['query'][_0x9139('0x3a')](_0x9139('0x3b'))){_0x21c1e0['limit']=qs[_0x9139('0x1d')](_0x43514f['query']['limit']);_0x21c1e0[_0x9139('0x20')]=qs[_0x9139('0x20')](_0x43514f[_0x9139('0x33')][_0x9139('0x20')]);}return _0x7eeefb[_0x9139('0x7b')](_0x21c1e0);}})[_0x9139('0x28')](function(_0x4cce2c){if(_0x4cce2c){return _0x4cce2c?{'count':_0x22349d,'rows':_0x4cce2c}:null;}})[_0x9139('0x28')](respondWithResult(_0x550504,null))[_0x9139('0x47')](handleError(_0x550504,null));};exports[_0x9139('0x7c')]=function(_0x387d19,_0x5511ac,_0x2c3437){var _0x24e241=_0x387d19[_0x9139('0x4f')][_0x9139('0x70')];var _0x10c463;return db[_0x9139('0x7a')][_0x9139('0x46')]({'where':{'id':_0x24e241},'attributes':['id'],'include':[{'model':db[_0x9139('0x79')],'as':'Agents','attributes':['id',_0x9139('0x2b'),_0x9139('0x7d'),_0x9139('0x7e'),_0x9139('0x7f')],'raw':!![]}]})[_0x9139('0x28')](function(_0xdbd388){if(_0xdbd388){_0x10c463=_0xdbd388;var _0x6a479a=_[_0x9139('0x80')](_0xdbd388,function(_0x4ab1ed){var _0x4ac0a5=_0x4ab1ed[_0x9139('0x29')]({'plain':!![]});return _0x4ac0a5[_0x9139('0x81')];});return db[_0x9139('0x45')][_0x9139('0x4b')]({'where':{'id':_0x387d19[_0x9139('0x49')]['id']}})[_0x9139('0x28')](function(_0x338cf4){return db[_0x9139('0x82')][_0x9139('0x4d')](function(_0x4ac429){return _0x338cf4[_0x9139('0x7c')](_0x24e241,{'transaction':_0x4ac429})[_0x9139('0x28')](function(){return BPromise[_0x9139('0x83')](_0x10c463,function(_0xee935b){return db['TeamVoicePrefix'][_0x9139('0x84')]({'TeamId':_0xee935b['id'],'VoicePrefixId':_0x387d19['params']['id']},{'transaction':_0x4ac429});});})[_0x9139('0x28')](function(){return BPromise[_0x9139('0x83')](_0x6a479a,function(_0x8ee6f3){return db[_0x9139('0x85')][_0x9139('0x86')]({'where':{'UserId':_0x8ee6f3['id'],'VoicePrefixId':_0x387d19[_0x9139('0x49')]['id']},'transaction':_0x4ac429});});})[_0x9139('0x28')](function(){_0x6a479a[_0x9139('0x87')](function(_0x520457){socket['emit']('userVoicePrefix:save',{'UserId':_0x520457['id'],'VoicePrefixId':_0x338cf4['id']});});});});});}})[_0x9139('0x28')](respondWithStatusCode(_0x5511ac,null))['catch'](handleError(_0x5511ac,null));};exports[_0x9139('0x88')]=function(_0x26e724,_0x31ede0,_0x13f114){return db[_0x9139('0x7a')][_0x9139('0x46')]({'where':{'id':_0x26e724[_0x9139('0x33')][_0x9139('0x70')]},'attributes':['id'],'include':[{'model':db[_0x9139('0x79')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x9139('0x28')](handleEntityNotFound(_0x31ede0,null))['then'](function(_0x2cc56d){var _0x346236=_[_0x9139('0x2e')](_0x2cc56d,'id');var _0x2c3a84=[];var _0x518031=[];var _0x4e1267=squel[_0x9139('0x89')]();_0x4e1267[_0x9139('0x8a')](_0x9139('0x8b'))[_0x9139('0x8c')](_0x9139('0x8d'),'tq')[_0x9139('0x8e')](_0x9139('0x8f'),'ut',_0x9139('0x90'))[_0x9139('0x3e')](_0x9139('0x91'),_0x26e724['params']['id']);for(var _0x568234=0x0;_0x568234<_0x2cc56d[_0x9139('0x39')];_0x568234+=0x1){let _0x3e41e5=_0x2cc56d[_0x568234];for(var _0x27c1a2=0x0;_0x27c1a2<_0x3e41e5[_0x9139('0x81')][_0x9139('0x39')];_0x27c1a2+=0x1){let _0x40a2a5=_0x3e41e5[_0x9139('0x81')][_0x27c1a2];var _0x194b7d=_0x4e1267['clone']();_0x194b7d[_0x9139('0x3e')](_0x9139('0x92'),_0x40a2a5['id']);_0x518031['push'](db[_0x9139('0x82')][_0x9139('0x33')](_0x194b7d[_0x9139('0x93')](),{'type':db[_0x9139('0x82')][_0x9139('0x94')][_0x9139('0x95')]})[_0x9139('0x28')](function(_0x43ef80){if(_0x43ef80[_0x9139('0x39')]===0x1){return _0x40a2a5['id'];}else{var _0x4cb6ad=_[_0x9139('0x96')](_['map'](_0x43ef80,'TeamId'),function(_0xd0b878){return _[_0x9139('0x97')](_0x346236,_0xd0b878);});if(_0x4cb6ad){return _0x40a2a5['id'];}}}));}}return BPromise[_0x9139('0x98')](_0x518031)[_0x9139('0x28')](function(_0x59cf9d){_0x2c3a84=_(_0x2c3a84)['union'](_0x59cf9d)[_0x9139('0x99')]()[_0x9139('0x9a')]();return db['VoicePrefix'][_0x9139('0x4b')]({'where':{'id':_0x26e724[_0x9139('0x49')]['id']}})['then'](function(_0x18625c){return db['sequelize'][_0x9139('0x4d')](function(_0x20ff88){return _0x18625c[_0x9139('0x88')](_0x26e724[_0x9139('0x33')][_0x9139('0x70')],{'transaction':_0x20ff88})['then'](function(){if(!_['isEmpty'](_0x2c3a84)){return _0x18625c['removeAgents'](_0x2c3a84,{'transaction':_0x20ff88});}})['then'](function(){_0x2c3a84[_0x9139('0x87')](function(_0x4c4081){socket[_0x9139('0x73')](_0x9139('0x76'),{'UserId':_0x4c4081,'VoicePrefixId':_0x18625c['id']});});});});});});})[_0x9139('0x28')](respondWithStatusCode(_0x31ede0,null))[_0x9139('0x47')](handleError(_0x31ede0,null));}; \ No newline at end of file +var _0x63a5=['merge','VIRTUAL','options','includeAll','include','VoicePrefix','findAll','rows','catch','show','params','rawAttributes','keys','find','describe','create','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','context','from-sip','exten','app','appdata','prefix','NoOp','VoicePrefixId','VoiceExtension','bulkCreate','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','No\x20callerid\x20available','goto','charAt','system-','transaction','findById','addAgents','ids','spread','emit','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','pick','getTeams','Team','Agents','online','voicePause','interface','flatMap','sequelize','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','userVoicePrefix:save','removeTeams','select','field','tq.TeamId','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','compact','value','isEmpty','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','get','VoicePrefixes','UserProfileResource','sendStatus','error','stack','name','send','index','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter'];(function(_0xca757a,_0x8dfaf9){var _0x2a3ce8=function(_0x3513c5){while(--_0x3513c5){_0xca757a['push'](_0xca757a['shift']());}};_0x2a3ce8(++_0x8dfaf9);}(_0x63a5,0x18e));var _0x563a=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x63a5[_0x4b73a2];return _0x383c66;};'use strict';var emlformat=require(_0x563a('0x0'));var rimraf=require(_0x563a('0x1'));var zipdir=require(_0x563a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x563a('0x3'));var moment=require('moment');var BPromise=require(_0x563a('0x4'));var Mustache=require(_0x563a('0x5'));var util=require(_0x563a('0x6'));var path=require(_0x563a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x563a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x563a('0x9'));var squel=require(_0x563a('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x563a('0xb'));var toCsv=require(_0x563a('0xc'));var querystring=require(_0x563a('0xd'));var Papa=require(_0x563a('0xe'));var Redis=require(_0x563a('0xf'));var authService=require(_0x563a('0x10'));var qs=require(_0x563a('0x11'));var as=require(_0x563a('0x12'));var hardwareService=require(_0x563a('0x13'));var logger=require(_0x563a('0x14'))(_0x563a('0x15'));var utils=require(_0x563a('0x16'));var config=require(_0x563a('0x17'));var licenseUtil=require(_0x563a('0x18'));var db=require('../../mysqldb')['db'];config[_0x563a('0x19')]=_[_0x563a('0x1a')](config[_0x563a('0x19')],{'host':_0x563a('0x1b'),'port':0x18eb});var socket=require(_0x563a('0x1c'))(new Redis(config[_0x563a('0x19')]));require('./voicePrefix.socket')[_0x563a('0x1d')](socket);function respondWithStatusCode(_0x3045ac,_0x8c3727){_0x8c3727=_0x8c3727||0xcc;return function(_0x26987f){if(_0x26987f){return _0x3045ac['sendStatus'](_0x8c3727);}return _0x3045ac['status'](_0x8c3727)[_0x563a('0x1e')]();};}function respondWithResult(_0x2ad667,_0x5b291f){_0x5b291f=_0x5b291f||0xc8;return function(_0x2ade24){if(_0x2ade24){return _0x2ad667[_0x563a('0x1f')](_0x5b291f)[_0x563a('0x20')](_0x2ade24);}};}function respondWithFilteredResult(_0x9c2f77,_0x4f947d){return function(_0x598693){if(_0x598693){var _0xe3d2bd=typeof _0x4f947d[_0x563a('0x21')]===_0x563a('0x22')&&typeof _0x4f947d['limit']==='undefined';var _0x52b99a=_0x598693['count'];var _0x40916a=_0xe3d2bd?0x0:_0x4f947d[_0x563a('0x21')];var _0x26061f=_0xe3d2bd?_0x598693[_0x563a('0x23')]:_0x4f947d['offset']+_0x4f947d['limit'];var _0x3930f0;if(_0x26061f>=_0x52b99a){_0x26061f=_0x52b99a;_0x3930f0=0xc8;}else{_0x3930f0=0xce;}_0x9c2f77[_0x563a('0x1f')](_0x3930f0);return _0x9c2f77[_0x563a('0x24')](_0x563a('0x25'),_0x40916a+'-'+_0x26061f+'/'+_0x52b99a)[_0x563a('0x20')](_0x598693);}return null;};}function patchUpdates(_0x2dc7e2){return function(_0x44b460){try{jsonpatch[_0x563a('0x26')](_0x44b460,_0x2dc7e2,!![]);}catch(_0x506491){return BPromise[_0x563a('0x27')](_0x506491);}return _0x44b460['save']();};}function saveUpdates(_0x44e2c1,_0xd3e0ae){return function(_0x3a36a4){if(_0x3a36a4){return _0x3a36a4[_0x563a('0x28')](_0x44e2c1)[_0x563a('0x29')](function(_0x1682ee){return _0x1682ee;});}return null;};}function removeEntity(_0x3642b3,_0x173990){return function(_0x4de4c3){if(_0x4de4c3){return _0x4de4c3[_0x563a('0x2a')]()[_0x563a('0x29')](function(){var _0x2311f2=_0x4de4c3[_0x563a('0x2b')]({'plain':!![]});var _0xce8165=_0x563a('0x2c');return db[_0x563a('0x2d')][_0x563a('0x2a')]({'where':{'type':_0xce8165,'resourceId':_0x2311f2['id']}})[_0x563a('0x29')](function(){return _0x4de4c3;});})[_0x563a('0x29')](function(){_0x3642b3[_0x563a('0x1f')](0xcc)[_0x563a('0x1e')]();});}};}function handleEntityNotFound(_0x1bdfb0,_0x7696c2){return function(_0x579cb5){if(!_0x579cb5){_0x1bdfb0[_0x563a('0x2e')](0x194);}return _0x579cb5;};}function handleError(_0x3c16d0,_0x2257e1){_0x2257e1=_0x2257e1||0x1f4;return function(_0x4aaa3d){logger[_0x563a('0x2f')](_0x4aaa3d[_0x563a('0x30')]);if(_0x4aaa3d[_0x563a('0x31')]){delete _0x4aaa3d[_0x563a('0x31')];}_0x3c16d0[_0x563a('0x1f')](_0x2257e1)[_0x563a('0x32')](_0x4aaa3d);};}exports[_0x563a('0x33')]=function(_0x4a2d28,_0x2418ae){var _0x24ec9d={},_0x4259f6={},_0x2ea6c2={'count':0x0,'rows':[]};var _0x1a77b8=_['map'](db['VoicePrefix']['rawAttributes'],function(_0x4e5c46){return{'name':_0x4e5c46[_0x563a('0x34')],'type':_0x4e5c46[_0x563a('0x35')][_0x563a('0x36')]};});_0x4259f6[_0x563a('0x37')]=_[_0x563a('0x38')](_0x1a77b8,_0x563a('0x31'));_0x4259f6['query']=_['keys'](_0x4a2d28[_0x563a('0x39')]);_0x4259f6[_0x563a('0x3a')]=_[_0x563a('0x3b')](_0x4259f6[_0x563a('0x37')],_0x4259f6[_0x563a('0x39')]);_0x24ec9d[_0x563a('0x3c')]=_[_0x563a('0x3b')](_0x4259f6[_0x563a('0x37')],qs[_0x563a('0x3d')](_0x4a2d28[_0x563a('0x39')][_0x563a('0x3d')]));_0x24ec9d[_0x563a('0x3c')]=_0x24ec9d[_0x563a('0x3c')][_0x563a('0x3e')]?_0x24ec9d[_0x563a('0x3c')]:_0x4259f6[_0x563a('0x37')];if(!_0x4a2d28['query'][_0x563a('0x3f')](_0x563a('0x40'))){_0x24ec9d[_0x563a('0x41')]=qs['limit'](_0x4a2d28[_0x563a('0x39')]['limit']);_0x24ec9d[_0x563a('0x21')]=qs[_0x563a('0x21')](_0x4a2d28['query']['offset']);}_0x24ec9d[_0x563a('0x42')]=qs['sort'](_0x4a2d28[_0x563a('0x39')][_0x563a('0x43')]);_0x24ec9d[_0x563a('0x44')]=qs[_0x563a('0x3a')](_['pick'](_0x4a2d28['query'],_0x4259f6[_0x563a('0x3a')]),_0x1a77b8);if(_0x4a2d28['query'][_0x563a('0x45')]){_0x24ec9d[_0x563a('0x44')]=_[_0x563a('0x46')](_0x24ec9d[_0x563a('0x44')],{'$or':_[_0x563a('0x38')](_0x1a77b8,function(_0x38fab5){if(_0x38fab5[_0x563a('0x35')]!==_0x563a('0x47')){var _0x4c71df={};_0x4c71df[_0x38fab5[_0x563a('0x31')]]={'$like':'%'+_0x4a2d28['query'][_0x563a('0x45')]+'%'};return _0x4c71df;}})});}_0x24ec9d=_[_0x563a('0x46')]({},_0x24ec9d,_0x4a2d28[_0x563a('0x48')]);var _0x2d3800={'where':_0x24ec9d['where']};return db['VoicePrefix']['count'](_0x2d3800)[_0x563a('0x29')](function(_0x1255da){_0x2ea6c2[_0x563a('0x23')]=_0x1255da;if(_0x4a2d28[_0x563a('0x39')][_0x563a('0x49')]){_0x24ec9d[_0x563a('0x4a')]=[{'all':!![]}];}return db[_0x563a('0x4b')][_0x563a('0x4c')](_0x24ec9d);})[_0x563a('0x29')](function(_0x433353){_0x2ea6c2[_0x563a('0x4d')]=_0x433353;return _0x2ea6c2;})[_0x563a('0x29')](respondWithFilteredResult(_0x2418ae,_0x24ec9d))[_0x563a('0x4e')](handleError(_0x2418ae,null));};exports[_0x563a('0x4f')]=function(_0x144e15,_0x456d27){var _0x4643c4={'raw':![],'where':{'id':_0x144e15[_0x563a('0x50')]['id']}},_0x21bafb={};_0x21bafb['model']=_['keys'](db[_0x563a('0x4b')][_0x563a('0x51')]);_0x21bafb[_0x563a('0x39')]=_[_0x563a('0x52')](_0x144e15[_0x563a('0x39')]);_0x21bafb[_0x563a('0x3a')]=_[_0x563a('0x3b')](_0x21bafb[_0x563a('0x37')],_0x21bafb['query']);_0x4643c4['attributes']=_[_0x563a('0x3b')](_0x21bafb[_0x563a('0x37')],qs[_0x563a('0x3d')](_0x144e15[_0x563a('0x39')][_0x563a('0x3d')]));_0x4643c4[_0x563a('0x3c')]=_0x4643c4[_0x563a('0x3c')][_0x563a('0x3e')]?_0x4643c4['attributes']:_0x21bafb[_0x563a('0x37')];if(_0x144e15[_0x563a('0x39')]['includeAll']){_0x4643c4[_0x563a('0x4a')]=[{'all':!![]}];}_0x4643c4=_['merge']({},_0x4643c4,_0x144e15[_0x563a('0x48')]);return db[_0x563a('0x4b')][_0x563a('0x53')](_0x4643c4)['then'](handleEntityNotFound(_0x456d27,null))[_0x563a('0x29')](respondWithResult(_0x456d27,null))[_0x563a('0x4e')](handleError(_0x456d27,null));};exports[_0x563a('0x2a')]=function(_0x39c104,_0x6fe8a9){return db[_0x563a('0x4b')][_0x563a('0x53')]({'where':{'id':_0x39c104[_0x563a('0x50')]['id']}})[_0x563a('0x29')](handleEntityNotFound(_0x6fe8a9,null))[_0x563a('0x29')](removeEntity(_0x6fe8a9,null))[_0x563a('0x4e')](handleError(_0x6fe8a9,null));};exports[_0x563a('0x54')]=function(_0x406d4a,_0x497469){return db['VoicePrefix'][_0x563a('0x54')]()[_0x563a('0x29')](respondWithResult(_0x497469,null))[_0x563a('0x4e')](handleError(_0x497469,null));};exports['create']=function(_0x5ae08f,_0x13530f){var _0x1fc4d2;return db['sequelize']['transaction'](function(_0x51e142){return db[_0x563a('0x4b')][_0x563a('0x55')](_0x5ae08f[_0x563a('0x56')],{'transaction':_0x51e142})[_0x563a('0x29')](function(_0x8d3997){_0x1fc4d2=_0x8d3997[_0x563a('0x2b')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x1fc4d2[_0x563a('0x57')]},'raw':!![]})['then'](function(_0x4453b2){return createVoicePrefixExtensions(_0x1fc4d2,_0x4453b2,_0x51e142);});});})[_0x563a('0x29')](function(){var _0x3e993e=_0x5ae08f[_0x563a('0x58')][_0x563a('0x2b')]({'plain':!![]});if(!_0x3e993e)throw new Error(_0x563a('0x59'));if(_0x3e993e[_0x563a('0x5a')]==='user'){var _0x22cc91=_0x1fc4d2;return db[_0x563a('0x5b')]['find']({'where':{'name':_0x563a('0x2c'),'userProfileId':_0x3e993e[_0x563a('0x5c')]},'raw':!![]})[_0x563a('0x29')](function(_0x2afa8c){if(_0x2afa8c&&_0x2afa8c[_0x563a('0x5d')]===0x0){return db[_0x563a('0x2d')][_0x563a('0x55')]({'name':_0x22cc91[_0x563a('0x31')],'resourceId':_0x22cc91['id'],'type':_0x2afa8c[_0x563a('0x31')],'sectionId':_0x2afa8c['id']},{})[_0x563a('0x29')](function(){return _0x1fc4d2;});}else{return _0x1fc4d2;}})['catch'](function(_0x1926f1){logger[_0x563a('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1926f1);throw _0x1926f1;});}return _0x1fc4d2;})['then'](respondWithResult(_0x13530f,null))[_0x563a('0x4e')](handleError(_0x13530f,null));};function Extension(_0x709bfd,_0x579d61,_0x19edc3,_0x59e371){this[_0x563a('0x5e')]=_0x563a('0x5f');this[_0x563a('0x60')]=_0x709bfd;this[_0x563a('0x61')]=_0x19edc3;this[_0x563a('0x35')]='system';this['description']='Voice\x20Prefix\x20Extension';this['priority']=_0x579d61;this[_0x563a('0x62')]=_0x59e371;}function createVoicePrefixExtensions(_0x5141d5,_0x111444,_0x496b6a){return new BPromise(function(_0x2a82cf,_0x3f2750){var _0xbe3343=new Extension(formatPrefixName(_0x5141d5[_0x563a('0x63')]),0x1,_0x563a('0x64'),'Voice\x20Prefix');_0xbe3343[_0x563a('0x65')]=_0x5141d5['id'];return db['VoiceExtension']['create'](_0xbe3343,{'transaction':_0x496b6a})[_0x563a('0x29')](function(_0x3b7993){var _0x409f3c=_0x3b7993[_0x563a('0x2b')]({'plain':!![]});var _0x1c8ad7=_['map'](addVoicePrefixExtensions(_0x5141d5,_0x111444),function(_0x10eb03){_0x10eb03[_0x563a('0x57')]=_0x409f3c['id'];_0x10eb03[_0x563a('0x65')]=_0x5141d5['id'];return _0x10eb03;});return db[_0x563a('0x66')][_0x563a('0x67')](_0x1c8ad7,{'transaction':_0x496b6a})['then'](function(_0xac578c){if(!_0xac578c){return _0x3f2750('Extensions\x20creation\x20failed');}else{return _0x2a82cf(_0xac578c);}})[_0x563a('0x4e')](function(_0x201c9d){return _0x3f2750(_0x201c9d);});});;});};function addVoicePrefixExtensions(_0x47d6cd,_0x34dd59){var _0x30bf2b=[];var _0x18a26b=formatPrefixName(_0x47d6cd[_0x563a('0x63')]);_0x30bf2b[_0x563a('0x68')](new Extension(_0x18a26b,0x2,_0x563a('0x69'),_0x563a('0x6a')+_0x47d6cd[_0x563a('0x31')]));if(_0x47d6cd['callerIdAll']){_0x30bf2b[_0x563a('0x68')](new Extension(_0x18a26b,0x3,_0x563a('0x69'),_0x563a('0x6b')+_0x47d6cd[_0x563a('0x6c')]));}else{_0x30bf2b[_0x563a('0x68')](new Extension(_0x18a26b,0x3,_0x563a('0x64'),_0x563a('0x6d')));}_0x30bf2b['push'](new Extension(_0x18a26b,0x4,_0x563a('0x6e'),_0x34dd59['context']+','+'${EXTEN:'+(0x8+_0x47d6cd['name'][_0x563a('0x3e')])+'}'+','+0x1));return _0x30bf2b;}function formatPrefixName(_0x4e4e60){var _0x529587='_';for(var _0x30d775=0x0;_0x30d775<_0x4e4e60[_0x563a('0x3e')];_0x30d775++){if(_0x4e4e60[_0x563a('0x6f')](_0x30d775)=='-'){_0x529587+=_0x4e4e60[_0x563a('0x6f')](_0x30d775);}else{_0x529587+='['+_0x4e4e60[_0x563a('0x6f')](_0x30d775)+']';}}_0x529587+='.';return _0x529587;}exports['update']=function(_0x4814b3,_0x4c9ad7,_0x39b8f8){var _0x8b2e10=_0x4814b3[_0x563a('0x56')];_0x8b2e10[_0x563a('0x63')]=_0x563a('0x70')+_0x8b2e10[_0x563a('0x31')]+'-';return db['sequelize'][_0x563a('0x71')](function(_0x43b2f1){return db['VoicePrefix'][_0x563a('0x28')](_0x8b2e10,{'where':{'id':_0x8b2e10['id']},'transaction':_0x43b2f1})[_0x563a('0x29')](function(){return db[_0x563a('0x66')]['destroy']({'where':{'VoicePrefixId':_0x8b2e10['id']},'transaction':_0x43b2f1})[_0x563a('0x29')](function(){return db[_0x563a('0x66')][_0x563a('0x53')]({'where':{'id':_0x8b2e10[_0x563a('0x57')]},'raw':!![]})['then'](function(_0x229690){return createVoicePrefixExtensions(_0x8b2e10,_0x229690,_0x43b2f1);});});});})[_0x563a('0x29')](function(){return db[_0x563a('0x4b')][_0x563a('0x72')](_0x8b2e10['id']);})[_0x563a('0x29')](respondWithResult(_0x4c9ad7,null))['catch'](handleError(_0x4c9ad7,null));};exports['addAgents']=function(_0x4346fe,_0x598a91,_0x46beba){return db[_0x563a('0x4b')][_0x563a('0x53')]({'where':{'id':_0x4346fe[_0x563a('0x50')]['id']}})[_0x563a('0x29')](handleEntityNotFound(_0x598a91,null))[_0x563a('0x29')](function(_0x3f66be){if(_0x3f66be){return _0x3f66be[_0x563a('0x73')](_0x4346fe[_0x563a('0x56')][_0x563a('0x74')],_['omit'](_0x4346fe[_0x563a('0x56')],['ids','id'])||{})[_0x563a('0x75')](function(_0x441933){for(var _0x54c512=0x0;_0x54c512<_0x4346fe[_0x563a('0x56')]['ids'][_0x563a('0x3e')];_0x54c512+=0x1){socket[_0x563a('0x76')]('userVoicePrefix:save',{'UserId':Number(_0x4346fe[_0x563a('0x56')][_0x563a('0x74')][_0x54c512]),'VoicePrefixId':Number(_0x4346fe[_0x563a('0x50')]['id'])});}return _0x441933;});}})[_0x563a('0x29')](respondWithResult(_0x598a91,null))['catch'](handleError(_0x598a91,null));};exports[_0x563a('0x77')]=function(_0x31faef,_0x17000b,_0x3cdfc1){return db[_0x563a('0x4b')][_0x563a('0x53')]({'where':{'id':_0x31faef[_0x563a('0x50')]['id']}})[_0x563a('0x29')](handleEntityNotFound(_0x17000b,null))[_0x563a('0x29')](function(_0x238ae4){if(_0x238ae4){return _0x238ae4['removeAgents'](_0x31faef[_0x563a('0x39')][_0x563a('0x74')])[_0x563a('0x29')](function(){if(_['isArray'](_0x31faef[_0x563a('0x39')][_0x563a('0x74')])){for(var _0x3dc800=0x0;_0x3dc800<_0x31faef[_0x563a('0x39')][_0x563a('0x74')][_0x563a('0x3e')];_0x3dc800+=0x1){socket[_0x563a('0x76')](_0x563a('0x78'),{'UserId':Number(_0x31faef[_0x563a('0x39')][_0x563a('0x74')][_0x3dc800]),'VoicePrefixId':Number(_0x31faef[_0x563a('0x50')]['id'])});}}else{socket[_0x563a('0x76')](_0x563a('0x78'),{'UserId':Number(_0x31faef['query'][_0x563a('0x74')]),'VoicePrefixId':Number(_0x31faef[_0x563a('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0x17000b,null))[_0x563a('0x4e')](handleError(_0x17000b,null));};exports[_0x563a('0x79')]=function(_0x1ecca5,_0x162ab6,_0xf3ed04){var _0x44cbb4={};var _0x3a00b8={};var _0x9b753b;var _0x41898f;return db['VoicePrefix'][_0x563a('0x7a')]({'where':{'id':_0x1ecca5[_0x563a('0x50')]['id']}})[_0x563a('0x29')](handleEntityNotFound(_0x162ab6,null))[_0x563a('0x29')](function(_0x4c5547){if(_0x4c5547){_0x9b753b=_0x4c5547;_0x3a00b8['model']=_['keys'](db[_0x563a('0x7b')][_0x563a('0x51')]);_0x3a00b8[_0x563a('0x39')]=_[_0x563a('0x52')](_0x1ecca5[_0x563a('0x39')]);_0x3a00b8[_0x563a('0x3a')]=_[_0x563a('0x3b')](_0x3a00b8[_0x563a('0x37')],_0x3a00b8[_0x563a('0x39')]);_0x44cbb4[_0x563a('0x3c')]=_['intersection'](_0x3a00b8[_0x563a('0x37')],qs[_0x563a('0x3d')](_0x1ecca5[_0x563a('0x39')][_0x563a('0x3d')]));_0x44cbb4[_0x563a('0x3c')]=_0x44cbb4[_0x563a('0x3c')][_0x563a('0x3e')]?_0x44cbb4[_0x563a('0x3c')]:_0x3a00b8[_0x563a('0x37')];_0x44cbb4[_0x563a('0x42')]=qs[_0x563a('0x43')](_0x1ecca5[_0x563a('0x39')][_0x563a('0x43')]);_0x44cbb4['where']=qs[_0x563a('0x3a')](_[_0x563a('0x7c')](_0x1ecca5[_0x563a('0x39')],_0x3a00b8[_0x563a('0x3a')]));if(_0x1ecca5[_0x563a('0x39')][_0x563a('0x45')]){_0x44cbb4[_0x563a('0x44')]=_['merge'](_0x44cbb4[_0x563a('0x44')],{'$or':_[_0x563a('0x38')](_0x44cbb4[_0x563a('0x3c')],function(_0x562120){var _0x1e3b8c={};_0x1e3b8c[_0x562120]={'$like':'%'+_0x1ecca5[_0x563a('0x39')][_0x563a('0x45')]+'%'};return _0x1e3b8c;})});}_0x44cbb4=_[_0x563a('0x46')]({},_0x44cbb4,_0x1ecca5[_0x563a('0x48')]);return _0x9b753b[_0x563a('0x79')](_0x44cbb4);}})['then'](function(_0x2d46f5){if(_0x2d46f5){_0x41898f=_0x2d46f5[_0x563a('0x3e')];if(!_0x1ecca5[_0x563a('0x39')][_0x563a('0x3f')](_0x563a('0x40'))){_0x44cbb4['limit']=qs[_0x563a('0x41')](_0x1ecca5[_0x563a('0x39')][_0x563a('0x41')]);_0x44cbb4[_0x563a('0x21')]=qs['offset'](_0x1ecca5[_0x563a('0x39')][_0x563a('0x21')]);}return _0x9b753b['getAgents'](_0x44cbb4);}})['then'](function(_0x458a21){if(_0x458a21){return _0x458a21?{'count':_0x41898f,'rows':_0x458a21}:null;}})[_0x563a('0x29')](respondWithResult(_0x162ab6,null))[_0x563a('0x4e')](handleError(_0x162ab6,null));};exports[_0x563a('0x7d')]=function(_0x241361,_0x31a58e,_0x1e324a){var _0x38857b={};var _0x43b6a2={};var _0x2385eb;var _0x36fe22;return db['VoicePrefix'][_0x563a('0x7a')]({'where':{'id':_0x241361[_0x563a('0x50')]['id']}})[_0x563a('0x29')](handleEntityNotFound(_0x31a58e,null))['then'](function(_0x1dc77d){if(_0x1dc77d){_0x2385eb=_0x1dc77d;_0x43b6a2[_0x563a('0x37')]=_['keys'](db[_0x563a('0x7e')][_0x563a('0x51')]);_0x43b6a2[_0x563a('0x39')]=_[_0x563a('0x52')](_0x241361[_0x563a('0x39')]);_0x43b6a2[_0x563a('0x3a')]=_[_0x563a('0x3b')](_0x43b6a2[_0x563a('0x37')],_0x43b6a2['query']);_0x38857b[_0x563a('0x3c')]=_[_0x563a('0x3b')](_0x43b6a2[_0x563a('0x37')],qs[_0x563a('0x3d')](_0x241361[_0x563a('0x39')]['fields']));_0x38857b[_0x563a('0x3c')]=_0x38857b['attributes']['length']?_0x38857b[_0x563a('0x3c')]:_0x43b6a2[_0x563a('0x37')];_0x38857b[_0x563a('0x42')]=qs[_0x563a('0x43')](_0x241361['query'][_0x563a('0x43')]);_0x38857b[_0x563a('0x44')]=qs['filters'](_[_0x563a('0x7c')](_0x241361['query'],_0x43b6a2[_0x563a('0x3a')]));if(_0x241361[_0x563a('0x39')][_0x563a('0x45')]){_0x38857b[_0x563a('0x44')]=_[_0x563a('0x46')](_0x38857b[_0x563a('0x44')],{'$or':_[_0x563a('0x38')](_0x38857b[_0x563a('0x3c')],function(_0x372e43){var _0x484953={};_0x484953[_0x372e43]={'$like':'%'+_0x241361[_0x563a('0x39')]['filter']+'%'};return _0x484953;})});}_0x38857b=_['merge']({},_0x38857b,_0x241361[_0x563a('0x48')]);return _0x2385eb[_0x563a('0x7d')](_0x38857b);}})['then'](function(_0x44859c){if(_0x44859c){_0x36fe22=_0x44859c[_0x563a('0x3e')];if(!_0x241361[_0x563a('0x39')][_0x563a('0x3f')](_0x563a('0x40'))){_0x38857b[_0x563a('0x41')]=qs[_0x563a('0x41')](_0x241361[_0x563a('0x39')]['limit']);_0x38857b[_0x563a('0x21')]=qs[_0x563a('0x21')](_0x241361['query'][_0x563a('0x21')]);}return _0x2385eb[_0x563a('0x7d')](_0x38857b);}})['then'](function(_0x38601a){if(_0x38601a){return _0x38601a?{'count':_0x36fe22,'rows':_0x38601a}:null;}})[_0x563a('0x29')](respondWithResult(_0x31a58e,null))[_0x563a('0x4e')](handleError(_0x31a58e,null));};exports['addTeams']=function(_0x10c81e,_0x4928de,_0x95bb77){var _0x33d74b=_0x10c81e[_0x563a('0x56')]['ids'];var _0x2d9810;return db['Team'][_0x563a('0x4c')]({'where':{'id':_0x33d74b},'attributes':['id'],'include':[{'model':db['User'],'as':_0x563a('0x7f'),'attributes':['id',_0x563a('0x31'),_0x563a('0x80'),_0x563a('0x81'),_0x563a('0x82')],'raw':!![]}]})[_0x563a('0x29')](function(_0x2d2cb9){if(_0x2d2cb9){_0x2d9810=_0x2d2cb9;var _0x2c4b52=_[_0x563a('0x83')](_0x2d2cb9,function(_0x5c8df5){var _0x579601=_0x5c8df5[_0x563a('0x2b')]({'plain':!![]});return _0x579601[_0x563a('0x7f')];});return db['VoicePrefix'][_0x563a('0x53')]({'where':{'id':_0x10c81e[_0x563a('0x50')]['id']}})[_0x563a('0x29')](function(_0x1ebdd0){return db[_0x563a('0x84')][_0x563a('0x71')](function(_0x2a3bdd){return _0x1ebdd0['addTeams'](_0x33d74b,{'transaction':_0x2a3bdd})[_0x563a('0x29')](function(){return BPromise[_0x563a('0x85')](_0x2d9810,function(_0x28bbe5){return db[_0x563a('0x86')]['upsert']({'TeamId':_0x28bbe5['id'],'VoicePrefixId':_0x10c81e[_0x563a('0x50')]['id']},{'transaction':_0x2a3bdd});});})[_0x563a('0x29')](function(){return BPromise[_0x563a('0x85')](_0x2c4b52,function(_0x150fd6){return db[_0x563a('0x87')][_0x563a('0x88')]({'where':{'UserId':_0x150fd6['id'],'VoicePrefixId':_0x10c81e[_0x563a('0x50')]['id']},'transaction':_0x2a3bdd});});})[_0x563a('0x29')](function(){_0x2c4b52[_0x563a('0x89')](function(_0x3f78b7){socket[_0x563a('0x76')](_0x563a('0x8a'),{'UserId':_0x3f78b7['id'],'VoicePrefixId':_0x1ebdd0['id']});});});});});}})[_0x563a('0x29')](respondWithStatusCode(_0x4928de,null))[_0x563a('0x4e')](handleError(_0x4928de,null));};exports[_0x563a('0x8b')]=function(_0x115188,_0x713637,_0x12bb1b){return db[_0x563a('0x7e')][_0x563a('0x4c')]({'where':{'id':_0x115188[_0x563a('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0x563a('0x7b')],'as':_0x563a('0x7f'),'attributes':['id'],'raw':!![]}]})[_0x563a('0x29')](handleEntityNotFound(_0x713637,null))[_0x563a('0x29')](function(_0xb9cbc9){var _0x42831f=_[_0x563a('0x38')](_0xb9cbc9,'id');var _0x5385e0=[];var _0x1d0ed4=[];var _0x14bc9e=squel[_0x563a('0x8c')]();_0x14bc9e[_0x563a('0x8d')](_0x563a('0x8e'))['from'](_0x563a('0x8f'),'tq')['join'](_0x563a('0x90'),'ut',_0x563a('0x91'))[_0x563a('0x44')]('VoicePrefixId\x20=\x20?',_0x115188[_0x563a('0x50')]['id']);for(var _0x25e5d1=0x0;_0x25e5d1<_0xb9cbc9[_0x563a('0x3e')];_0x25e5d1+=0x1){let _0x5ba698=_0xb9cbc9[_0x25e5d1];for(var _0x2dadc1=0x0;_0x2dadc1<_0x5ba698[_0x563a('0x7f')]['length'];_0x2dadc1+=0x1){let _0x55f64e=_0x5ba698[_0x563a('0x7f')][_0x2dadc1];var _0x41d0df=_0x14bc9e['clone']();_0x41d0df['where'](_0x563a('0x92'),_0x55f64e['id']);_0x1d0ed4['push'](db[_0x563a('0x84')][_0x563a('0x39')](_0x41d0df[_0x563a('0x93')](),{'type':db[_0x563a('0x84')][_0x563a('0x94')][_0x563a('0x95')]})[_0x563a('0x29')](function(_0xc24817){if(_0xc24817[_0x563a('0x3e')]===0x1){return _0x55f64e['id'];}else{var _0xd04cd=_[_0x563a('0x96')](_['map'](_0xc24817,'TeamId'),function(_0x571a84){return _[_0x563a('0x97')](_0x42831f,_0x571a84);});if(_0xd04cd){return _0x55f64e['id'];}}}));}}return BPromise[_0x563a('0x98')](_0x1d0ed4)[_0x563a('0x29')](function(_0x5244e5){_0x5385e0=_(_0x5385e0)['union'](_0x5244e5)[_0x563a('0x99')]()[_0x563a('0x9a')]();return db[_0x563a('0x4b')][_0x563a('0x53')]({'where':{'id':_0x115188[_0x563a('0x50')]['id']}})[_0x563a('0x29')](function(_0x23e33f){return db['sequelize'][_0x563a('0x71')](function(_0x25049d){return _0x23e33f[_0x563a('0x8b')](_0x115188[_0x563a('0x39')][_0x563a('0x74')],{'transaction':_0x25049d})[_0x563a('0x29')](function(){if(!_[_0x563a('0x9b')](_0x5385e0)){return _0x23e33f[_0x563a('0x77')](_0x5385e0,{'transaction':_0x25049d});}})[_0x563a('0x29')](function(){_0x5385e0[_0x563a('0x89')](function(_0x482d21){socket[_0x563a('0x76')]('userVoicePrefix:remove',{'UserId':_0x482d21,'VoicePrefixId':_0x23e33f['id']});});});});});});})[_0x563a('0x29')](respondWithStatusCode(_0x713637,null))[_0x563a('0x4e')](handleError(_0x713637,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 5e4b803..3098f3f 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 _0xeb6e=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoicePrefix','setMaxListeners'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xeb6e,0x19c));var _0xeeb6=function(_0x3304d6,_0x2c346c){_0x3304d6=_0x3304d6-0x0;var _0x3e8895=_0xeb6e[_0x3304d6];return _0x3e8895;};'use strict';var EventEmitter=require(_0xeeb6('0x0'));var VoicePrefix=require(_0xeeb6('0x1'))['db'][_0xeeb6('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xeeb6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xeeb6('0x4')};function emitEvent(_0x1038f2){return function(_0x10082e,_0x4c9b24,_0x501ec1){VoicePrefixEvents['emit'](_0x1038f2+':'+_0x10082e['id'],_0x10082e);VoicePrefixEvents[_0xeeb6('0x5')](_0x1038f2,_0x10082e);_0x501ec1(null);};}for(var e in events){if(events[_0xeeb6('0x6')](e)){var event=events[e];VoicePrefix[_0xeeb6('0x7')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x047e=['events','../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x047e,0x10e));var _0xe047=function(_0x2b0e05,_0x160b7f){_0x2b0e05=_0x2b0e05-0x0;var _0x529563=_0x047e[_0x2b0e05];return _0x529563;};'use strict';var EventEmitter=require(_0xe047('0x0'));var VoicePrefix=require(_0xe047('0x1'))['db'][_0xe047('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xe047('0x3')](0x0);var events={'afterCreate':_0xe047('0x4'),'afterUpdate':_0xe047('0x5'),'afterDestroy':_0xe047('0x6')};function emitEvent(_0x962e6e){return function(_0x38671b,_0x549cf2,_0x1d3551){VoicePrefixEvents['emit'](_0x962e6e+':'+_0x38671b['id'],_0x38671b);VoicePrefixEvents[_0xe047('0x7')](_0x962e6e,_0x38671b);_0x1d3551(null);};}for(var e in events){if(events[_0xe047('0x8')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0xe047('0x9')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 4d92860..67bf781 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 _0x0d15=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','VoicePrefix','voice_prefixes','util'];(function(_0x377f18,_0x50612d){var _0x5cb7b0=function(_0x272388){while(--_0x272388){_0x377f18['push'](_0x377f18['shift']());}};_0x5cb7b0(++_0x50612d);}(_0x0d15,0x8f));var _0x50d1=function(_0x3afd5d,_0x5e5d0f){_0x3afd5d=_0x3afd5d-0x0;var _0x2ffa6c=_0x0d15[_0x3afd5d];return _0x2ffa6c;};'use strict';var _=require('lodash');var util=require(_0x50d1('0x0'));var logger=require(_0x50d1('0x1'))(_0x50d1('0x2'));var moment=require(_0x50d1('0x3'));var BPromise=require(_0x50d1('0x4'));var rp=require(_0x50d1('0x5'));var fs=require('fs');var path=require(_0x50d1('0x6'));var rimraf=require(_0x50d1('0x7'));var config=require(_0x50d1('0x8'));var attributes=require('./voicePrefix.attributes');module[_0x50d1('0x9')]=function(_0x1ec7b2,_0x248319){return _0x1ec7b2['define'](_0x50d1('0xa'),attributes,{'tableName':_0x50d1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d94=['exports','voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./voicePrefix.attributes'];(function(_0xc893d0,_0x72f69a){var _0x29f9f8=function(_0x462d19){while(--_0x462d19){_0xc893d0['push'](_0xc893d0['shift']());}};_0x29f9f8(++_0x72f69a);}(_0x7d94,0x1ba));var _0x47d9=function(_0x382a62,_0x1baa5e){_0x382a62=_0x382a62-0x0;var _0x490a25=_0x7d94[_0x382a62];return _0x490a25;};'use strict';var _=require(_0x47d9('0x0'));var util=require(_0x47d9('0x1'));var logger=require(_0x47d9('0x2'))(_0x47d9('0x3'));var moment=require(_0x47d9('0x4'));var BPromise=require(_0x47d9('0x5'));var rp=require(_0x47d9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x47d9('0x7'));var attributes=require(_0x47d9('0x8'));module[_0x47d9('0x9')]=function(_0x4f46a2,_0x1ca334){return _0x4f46a2['define']('VoicePrefix',attributes,{'tableName':_0x47d9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 4dd1871..a0ea727 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 _0xa613=['info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./voicePrefix.socket','request','then'];(function(_0x91f1f5,_0x230416){var _0x5bdb35=function(_0x149aa9){while(--_0x149aa9){_0x91f1f5['push'](_0x91f1f5['shift']());}};_0x5bdb35(++_0x230416);}(_0xa613,0x8a));var _0x3a61=function(_0x337748,_0x402b05){_0x337748=_0x337748-0x0;var _0x3bb03f=_0xa613[_0x337748];return _0x3bb03f;};'use strict';var _=require(_0x3a61('0x0'));var util=require('util');var moment=require(_0x3a61('0x1'));var BPromise=require(_0x3a61('0x2'));var rs=require(_0x3a61('0x3'));var fs=require('fs');var Redis=require(_0x3a61('0x4'));var db=require(_0x3a61('0x5'))['db'];var utils=require(_0x3a61('0x6'));var logger=require(_0x3a61('0x7'))(_0x3a61('0x8'));var config=require(_0x3a61('0x9'));var jayson=require(_0x3a61('0xa'));var client=jayson['client'][_0x3a61('0xb')]({'port':0x232a});config[_0x3a61('0xc')]=_['defaults'](config[_0x3a61('0xc')],{'host':_0x3a61('0xd'),'port':0x18eb});var socket=require(_0x3a61('0xe'))(new Redis(config[_0x3a61('0xc')]));require(_0x3a61('0xf'))['register'](socket);function respondWithRpcPromise(_0x2ad63f,_0x357242,_0x5b0db1){return new BPromise(function(_0x57be09,_0x56fbbc){return client[_0x3a61('0x10')](_0x2ad63f,_0x5b0db1)[_0x3a61('0x11')](function(_0x5ab59f){logger[_0x3a61('0x12')](_0x3a61('0x13'),_0x357242,_0x3a61('0x14'));logger[_0x3a61('0x15')](_0x3a61('0x16'),_0x357242,_0x3a61('0x14'),JSON['stringify'](_0x5ab59f));if(_0x5ab59f['error']){if(_0x5ab59f[_0x3a61('0x17')][_0x3a61('0x18')]===0x1f4){logger[_0x3a61('0x17')](_0x3a61('0x13'),_0x357242,_0x5ab59f[_0x3a61('0x17')]['message']);return _0x56fbbc(_0x5ab59f['error'][_0x3a61('0x19')]);}logger['error'](_0x3a61('0x13'),_0x357242,_0x5ab59f['error'][_0x3a61('0x19')]);return _0x57be09(_0x5ab59f[_0x3a61('0x17')]['message']);}else{logger[_0x3a61('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x357242,_0x3a61('0x14'));_0x57be09(_0x5ab59f['result'][_0x3a61('0x19')]);}})['catch'](function(_0x1047f5){logger[_0x3a61('0x17')](_0x3a61('0x13'),_0x357242,_0x1047f5);_0x56fbbc(_0x1047f5);});});} \ No newline at end of file +var _0x8969=['stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x4a409a,_0x20baf7){var _0x385ef9=function(_0x30a9a4){while(--_0x30a9a4){_0x4a409a['push'](_0x4a409a['shift']());}};_0x385ef9(++_0x20baf7);}(_0x8969,0x130));var _0x9896=function(_0x2f6fae,_0x47d162){_0x2f6fae=_0x2f6fae-0x0;var _0x37fb98=_0x8969[_0x2f6fae];return _0x37fb98;};'use strict';var _=require(_0x9896('0x0'));var util=require('util');var moment=require(_0x9896('0x1'));var BPromise=require(_0x9896('0x2'));var rs=require(_0x9896('0x3'));var fs=require('fs');var Redis=require(_0x9896('0x4'));var db=require(_0x9896('0x5'))['db'];var utils=require(_0x9896('0x6'));var logger=require(_0x9896('0x7'))('rpc');var config=require(_0x9896('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9896('0x9')]({'port':0x232a});config[_0x9896('0xa')]=_[_0x9896('0xb')](config['redis'],{'host':_0x9896('0xc'),'port':0x18eb});var socket=require(_0x9896('0xd'))(new Redis(config[_0x9896('0xa')]));require('./voicePrefix.socket')[_0x9896('0xe')](socket);function respondWithRpcPromise(_0x1857d9,_0x4d9376,_0x362a7c){return new BPromise(function(_0x1814ea,_0x53316e){return client[_0x9896('0xf')](_0x1857d9,_0x362a7c)[_0x9896('0x10')](function(_0x2b5c25){logger[_0x9896('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x4d9376,'request\x20sent');logger['debug'](_0x9896('0x12'),_0x4d9376,_0x9896('0x13'),JSON[_0x9896('0x14')](_0x2b5c25));if(_0x2b5c25[_0x9896('0x15')]){if(_0x2b5c25[_0x9896('0x15')][_0x9896('0x16')]===0x1f4){logger[_0x9896('0x15')](_0x9896('0x17'),_0x4d9376,_0x2b5c25[_0x9896('0x15')][_0x9896('0x18')]);return _0x53316e(_0x2b5c25['error'][_0x9896('0x18')]);}logger['error'](_0x9896('0x17'),_0x4d9376,_0x2b5c25[_0x9896('0x15')][_0x9896('0x18')]);return _0x1814ea(_0x2b5c25[_0x9896('0x15')]['message']);}else{logger[_0x9896('0x11')](_0x9896('0x17'),_0x4d9376,_0x9896('0x13'));_0x1814ea(_0x2b5c25[_0x9896('0x19')]['message']);}})[_0x9896('0x1a')](function(_0x581480){logger[_0x9896('0x15')](_0x9896('0x17'),_0x4d9376,_0x581480);_0x53316e(_0x581480);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 49dd494..482af08 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 _0x340c=['update','emit','removeListener','register','voicePrefix:','./voicePrefix.events','save','remove'];(function(_0x3c192c,_0x5bd6f9){var _0x3d8f5b=function(_0xce675c){while(--_0xce675c){_0x3c192c['push'](_0x3c192c['shift']());}};_0x3d8f5b(++_0x5bd6f9);}(_0x340c,0xe5));var _0xc340=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x340c[_0x3dd15e];return _0x231fd0;};'use strict';var VoicePrefixEvents=require(_0xc340('0x0'));var events=[_0xc340('0x1'),_0xc340('0x2'),_0xc340('0x3')];function createListener(_0x5b80c5,_0x44a3d4){return function(_0x13c907){_0x44a3d4[_0xc340('0x4')](_0x5b80c5,_0x13c907);};}function removeListener(_0x43c651,_0x577d30){return function(){VoicePrefixEvents[_0xc340('0x5')](_0x43c651,_0x577d30);};}exports[_0xc340('0x6')]=function(_0x337a1f){for(var _0xb55d36=0x0,_0x35b8e6=events['length'];_0xb55d36<_0x35b8e6;_0xb55d36++){var _0x4c33db=events[_0xb55d36];var _0x59a213=createListener(_0xc340('0x7')+_0x4c33db,_0x337a1f);VoicePrefixEvents['on'](_0x4c33db,_0x59a213);}}; \ No newline at end of file +var _0xf00e=['save','remove','update','emit','removeListener','register','length','./voicePrefix.events'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xf00e,0x12f));var _0xef00=function(_0x95fa91,_0x874d77){_0x95fa91=_0x95fa91-0x0;var _0x1a9715=_0xf00e[_0x95fa91];return _0x1a9715;};'use strict';var VoicePrefixEvents=require(_0xef00('0x0'));var events=[_0xef00('0x1'),_0xef00('0x2'),_0xef00('0x3')];function createListener(_0x3df5cf,_0x2e7eda){return function(_0x1861da){_0x2e7eda[_0xef00('0x4')](_0x3df5cf,_0x1861da);};}function removeListener(_0x21260a,_0x4261ea){return function(){VoicePrefixEvents[_0xef00('0x5')](_0x21260a,_0x4261ea);};}exports[_0xef00('0x6')]=function(_0x397c39){for(var _0x3e91d1=0x0,_0x254f2e=events[_0xef00('0x7')];_0x3e91d1<_0x254f2e;_0x3e91d1++){var _0x2245a3=events[_0x3e91d1];var _0xdfd1bd=createListener('voicePrefix:'+_0x2245a3,_0x397c39);VoicePrefixEvents['on'](_0x2245a3,_0xdfd1bd);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index a5f3ede..32e75e7 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(_0x42d97b,_0x511716){var _0x4ab9fc=function(_0x435046){while(--_0x435046){_0x42d97b['push'](_0x42d97b['shift']());}};_0x4ab9fc(++_0x511716);}(_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'));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(_0xff8595,_0x39341d){var _0x31e49e=function(_0x23ee7b){while(--_0x23ee7b){_0xff8595['push'](_0xff8595['shift']());}};_0x31e49e(++_0x39341d);}(_0xb10b,0x12a));var _0xbb10=function(_0x420a7c,_0x3ef0bc){_0x420a7c=_0x420a7c-0x0;var _0x311c52=_0xb10b[_0x420a7c];return _0x311c52;};'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 f7f169a..a1c975e 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 _0xc1a8=['Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','#AMD\x20Initial\x20Silence','#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)','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','inbound','outbound','default','ringall','leastrecent','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','booked','roundrobin','progressive','power','INTEGER','yes','all','once','TEXT','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'];(function(_0x3dd266,_0x4d919f){var _0x320665=function(_0x447b4e){while(--_0x447b4e){_0x3dd266['push'](_0x3dd266['shift']());}};_0x320665(++_0x4d919f);}(_0xc1a8,0xcb));var _0x8c1a=function(_0x443f79,_0x33e446){_0x443f79=_0x443f79-0x0;var _0x3847e4=_0xc1a8[_0x443f79];return _0x3847e4;};'use strict';var Sequelize=require(_0x8c1a('0x0'));module[_0x8c1a('0x1')]={'name':{'type':Sequelize[_0x8c1a('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x8c1a('0x3')](_0x8c1a('0x4'),_0x8c1a('0x5')),'allowNull':![],'defaultValue':_0x8c1a('0x4')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x8c1a('0x6')},'announce':{'type':Sequelize[_0x8c1a('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x8c1a('0x3')]('rr',_0x8c1a('0x7'),_0x8c1a('0x8'),'fewestcalls',_0x8c1a('0x9'),_0x8c1a('0xa'),_0x8c1a('0xb'),_0x8c1a('0xc'),_0x8c1a('0xd')),'allowNull':![],'defaultValue':_0x8c1a('0x7'),'set':function(_0x3a5ce3){this[_0x8c1a('0xe')](_0x8c1a('0xf'),_0x3a5ce3?_0x3a5ce3:_0x8c1a('0xa'));},'get':function(){var _0x1525cb=this[_0x8c1a('0x10')](_0x8c1a('0x11'));var _0x137a8e=this[_0x8c1a('0x10')](_0x8c1a('0x12'));var _0xebbbd9=this[_0x8c1a('0x10')](_0x8c1a('0xf'));if(_0x1525cb===_0x8c1a('0x4')){return _0xebbbd9;}if(_0x137a8e===_0x8c1a('0x13')&&_0xebbbd9===_0x8c1a('0xa')||_0x137a8e==='booked'&&_0xebbbd9===_0x8c1a('0x14')){return _0xebbbd9;}if(_0x137a8e===_0x8c1a('0x15')||_0x137a8e==='predictive'||_0x137a8e===_0x8c1a('0x16')){return _0xebbbd9;}return null;}},'servicelevel':{'type':Sequelize[_0x8c1a('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x8c1a('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x8c1a('0x17')](0xb)},'timeout':{'type':Sequelize[_0x8c1a('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x8c1a('0x2')]},'weight':{'type':Sequelize[_0x8c1a('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x8c1a('0x3')]('yes','no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x8c1a('0x3')](_0x8c1a('0x18'),'no',_0x8c1a('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x8c1a('0x17')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x8c1a('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x8c1a('0x3')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x8c1a('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x8c1a('0x3')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x8c1a('0x3')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x8c1a('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x8c1a('0x3')](_0x8c1a('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x8c1a('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x8c1a('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x8c1a('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x8c1a('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x8c1a('0x3')](_0x8c1a('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x8c1a('0x3')]('yes','no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x8c1a('0x3')](_0x8c1a('0x18'),'no',_0x8c1a('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x8c1a('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x8c1a('0x3')](_0x8c1a('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0x8c1a('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x8c1a('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x8c1a('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x8c1a('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x8c1a('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x8c1a('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x8c1a('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x8c1a('0x2')]},'queue_quantity1':{'type':Sequelize[_0x8c1a('0x2')]},'queue_quantity2':{'type':Sequelize[_0x8c1a('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x8c1a('0x2')]},'queue_less_than':{'type':Sequelize[_0x8c1a('0x2')]},'periodic_announce':{'type':Sequelize[_0x8c1a('0x1b')],'set':function(_0x4e856b){this[_0x8c1a('0xe')]('periodic_announce',_0x4e856b?_0x4e856b[_0x8c1a('0x1c')](','):[]);},'get':function(){return this[_0x8c1a('0x10')](_0x8c1a('0x1d'))?this[_0x8c1a('0x10')](_0x8c1a('0x1d'))[_0x8c1a('0x1e')](','):[];}},'joinempty':{'type':Sequelize[_0x8c1a('0x2')],'defaultValue':_0x8c1a('0x18'),'set':function(_0x507225){this[_0x8c1a('0xe')](_0x8c1a('0x1f'),_0x507225?_0x507225[_0x8c1a('0x1c')](','):undefined);},'get':function(){return this['getDataValue'](_0x8c1a('0x1f'))?this[_0x8c1a('0x10')](_0x8c1a('0x1f'))[_0x8c1a('0x1e')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x8c1a('0x2')],'defaultValue':'no','set':function(_0x3606e2){this[_0x8c1a('0xe')]('leavewhenempty',_0x3606e2?_0x3606e2[_0x8c1a('0x1c')](','):undefined);},'get':function(){return this['getDataValue']('leavewhenempty')?this['getDataValue'](_0x8c1a('0x20'))[_0x8c1a('0x1e')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x8c1a('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x8c1a('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x8c1a('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x8c1a('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x8c1a('0x2')]},'description':{'type':Sequelize[_0x8c1a('0x2')]},'acw':{'type':Sequelize[_0x8c1a('0x21')],'defaultValue':0x0,'set':function(_0x3eeeaa){this[_0x8c1a('0xe')](_0x8c1a('0x22'),_0x3eeeaa);if(_0x3eeeaa){if(this[_0x8c1a('0x10')](_0x8c1a('0x23'))<0x2){this['setDataValue']('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x8c1a('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x8c1a('0x21')],'defaultValue':0x0,'comment':_0x8c1a('0x24')},'dialMethod':{'type':Sequelize['ENUM'](_0x8c1a('0x25'),'progressive',_0x8c1a('0x16'),'predictive',_0x8c1a('0x13')),'defaultValue':_0x8c1a('0x15'),'comment':_0x8c1a('0x26')},'dialLimitChannel':{'type':Sequelize[_0x8c1a('0x17')](0x4)[_0x8c1a('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x8c1a('0x28')},'dialLimitQueue':{'type':Sequelize[_0x8c1a('0x17')](0x4)[_0x8c1a('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x8c1a('0x29')},'dialPowerLevel':{'type':Sequelize[_0x8c1a('0x2a')](0x2)[_0x8c1a('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x8c1a('0x2b')},'dialPredictiveOptimization':{'type':Sequelize[_0x8c1a('0x3')]('agentBusyFactor',_0x8c1a('0x2c')),'defaultValue':'dropRate','comment':_0x8c1a('0x2d')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x8c1a('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x8c1a('0x17')](0x3)[_0x8c1a('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x8c1a('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize[_0x8c1a('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x8c1a('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x8c1a('0x17')](0x3)[_0x8c1a('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8c1a('0x2f')},'dialQueueOptions':{'type':Sequelize[_0x8c1a('0x2')],'defaultValue':'tTxX','comment':_0x8c1a('0x30')},'dialQueueTimeout':{'type':Sequelize[_0x8c1a('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8c1a('0x31')},'dialQueueProject':{'type':Sequelize[_0x8c1a('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x8c1a('0x17')](0x3)[_0x8c1a('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8c1a('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8c1a('0x33')},'dialBusyMaxRetry':{'type':Sequelize[_0x8c1a('0x17')](0x3)[_0x8c1a('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8c1a('0x34')},'dialBusyRetryFrequency':{'type':Sequelize[_0x8c1a('0x17')](0x5)[_0x8c1a('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8c1a('0x35')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x8c1a('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x8c1a('0x36')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x8c1a('0x17')](0x5)[_0x8c1a('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8c1a('0x37')},'dialGlobalMaxRetry':{'type':Sequelize[_0x8c1a('0x17')](0x3)[_0x8c1a('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x8c1a('0x38')},'dialTimezone':{'type':Sequelize[_0x8c1a('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x8c1a('0x2')],'defaultValue':_0x8c1a('0x39')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x8c1a('0x3')]('always',_0x8c1a('0x3a'),_0x8c1a('0x3b')),'defaultValue':_0x8c1a('0x3c')},'dialAMDActive':{'type':Sequelize[_0x8c1a('0x21')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x8c1a('0x17')](0x9)[_0x8c1a('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8c1a('0x3d')},'dialAMDGreeting':{'type':Sequelize[_0x8c1a('0x17')](0x9)[_0x8c1a('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8c1a('0x17')](0x9)[_0x8c1a('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x8c1a('0x3e')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x8c1a('0x17')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8c1a('0x3f')},'dialAMDMinWordLength':{'type':Sequelize[_0x8c1a('0x17')](0x9)[_0x8c1a('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x8c1a('0x40')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x8c1a('0x17')](0x9)[_0x8c1a('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x8c1a('0x41')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x8c1a('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x8c1a('0x42')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x8c1a('0x27')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x8c1a('0x43')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8c1a('0x17')](0x9)[_0x8c1a('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x8c1a('0x17')](0x5)[_0x8c1a('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x8c1a('0x44')},'dialRecallInQueue':{'type':Sequelize[_0x8c1a('0x21')],'defaultValue':0x0,'comment':_0x8c1a('0x45')},'dialOrderByScheduledAt':{'type':Sequelize[_0x8c1a('0x3')]('DESC','ASC'),'defaultValue':_0x8c1a('0x46')},'dialQueueProject2':{'type':Sequelize[_0x8c1a('0x2')],'comment':_0x8c1a('0x47')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x8c1a('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x8c1a('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x8c1a('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x8c1a('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x8c1a('0x17')](0x3)[_0x8c1a('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8c1a('0x48')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x8c1a('0x17')](0x5)[_0x8c1a('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8c1a('0x49')},'dialDropMaxRetry':{'type':Sequelize[_0x8c1a('0x17')](0x3)[_0x8c1a('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x8c1a('0x17')](0x5)[_0x8c1a('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8c1a('0x4a')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8c1a('0x4b')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x8c1a('0x17')](0x5)[_0x8c1a('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8c1a('0x4c')},'dialMachineMaxRetry':{'type':Sequelize[_0x8c1a('0x17')](0x3)[_0x8c1a('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8c1a('0x4d')},'dialMachineRetryFrequency':{'type':Sequelize[_0x8c1a('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8c1a('0x4e')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x8c1a('0x17')](0x3)[_0x8c1a('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8c1a('0x4f')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x8c1a('0x17')](0x5)[_0x8c1a('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8c1a('0x17')],'allowNull':!![],'comment':_0x8c1a('0x50')},'mandatoryDisposition':{'type':Sequelize[_0x8c1a('0x21')],'defaultValue':![],'comment':_0x8c1a('0x51'),'set':function(_0xcec68e){if(!_0xcec68e)this['setDataValue'](_0x8c1a('0x52'),null);this['setDataValue'](_0x8c1a('0x53'),_0xcec68e);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x8c1a('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x8c1a('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xb232=['outbound','inbound','default','ENUM','ringall','leastrecent','fewestcalls','rrmemory','linear','setDataValue','strategy','getDataValue','type','booked','roundrobin','progressive','predictive','power','INTEGER','yes','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb232,0xf6));var _0x2b23=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xb232[_0x2a6809];return _0x11c371;};'use strict';var Sequelize=require(_0x2b23('0x0'));module['exports']={'name':{'type':Sequelize[_0x2b23('0x1')],'allowNull':![],'unique':_0x2b23('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('inbound',_0x2b23('0x3')),'allowNull':![],'defaultValue':_0x2b23('0x4')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x2b23('0x5')},'announce':{'type':Sequelize[_0x2b23('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x2b23('0x6')]('rr',_0x2b23('0x7'),_0x2b23('0x8'),_0x2b23('0x9'),'random',_0x2b23('0xa'),_0x2b23('0xb'),'wrandom','rrordered'),'allowNull':![],'defaultValue':_0x2b23('0x7'),'set':function(_0x398b7e){this[_0x2b23('0xc')](_0x2b23('0xd'),_0x398b7e?_0x398b7e:_0x2b23('0xa'));},'get':function(){var _0x2e583d=this[_0x2b23('0xe')](_0x2b23('0xf'));var _0x272bf6=this['getDataValue']('dialMethod');var _0x1b5a4d=this[_0x2b23('0xe')](_0x2b23('0xd'));if(_0x2e583d===_0x2b23('0x4')){return _0x1b5a4d;}if(_0x272bf6===_0x2b23('0x10')&&_0x1b5a4d===_0x2b23('0xa')||_0x272bf6===_0x2b23('0x10')&&_0x1b5a4d===_0x2b23('0x11')){return _0x1b5a4d;}if(_0x272bf6===_0x2b23('0x12')||_0x272bf6===_0x2b23('0x13')||_0x272bf6===_0x2b23('0x14')){return _0x1b5a4d;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x2b23('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x2b23('0x15')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x2b23('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x2b23('0x1')]},'weight':{'type':Sequelize[_0x2b23('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x2b23('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0x2b23('0x16'),'no'),'defaultValue':_0x2b23('0x16')},'autopause':{'type':Sequelize[_0x2b23('0x6')]('yes','no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x2b23('0x6')](_0x2b23('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x2b23('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x2b23('0x6')](_0x2b23('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x2b23('0x6')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x2b23('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x2b23('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x2b23('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x2b23('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x2b23('0x6')](_0x2b23('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x2b23('0x6')](_0x2b23('0x16'),'no'),'defaultValue':_0x2b23('0x16')},'announce_holdtime':{'type':Sequelize[_0x2b23('0x6')](_0x2b23('0x16'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x2b23('0x6')](_0x2b23('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0x2b23('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x2b23('0x6')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x2b23('0x1')]},'queue_youarenext':{'type':Sequelize[_0x2b23('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x2b23('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x2b23('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x2b23('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x2b23('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x2b23('0x1')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x2b23('0x17')],'set':function(_0x31db56){this[_0x2b23('0xc')](_0x2b23('0x18'),_0x31db56?_0x31db56[_0x2b23('0x19')](','):[]);},'get':function(){return this[_0x2b23('0xe')]('periodic_announce')?this[_0x2b23('0xe')](_0x2b23('0x18'))[_0x2b23('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x2b23('0x1')],'defaultValue':_0x2b23('0x16'),'set':function(_0x1c4c47){this[_0x2b23('0xc')]('joinempty',_0x1c4c47?_0x1c4c47['join'](','):undefined);},'get':function(){return this['getDataValue'](_0x2b23('0x1b'))?this[_0x2b23('0xe')](_0x2b23('0x1b'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x5037b2){this['setDataValue'](_0x2b23('0x1c'),_0x5037b2?_0x5037b2['join'](','):undefined);},'get':function(){return this[_0x2b23('0xe')](_0x2b23('0x1c'))?this[_0x2b23('0xe')]('leavewhenempty')[_0x2b23('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x2b23('0x6')](_0x2b23('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x2b23('0x6')](_0x2b23('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x2b23('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x2b23('0x6')](_0x2b23('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x2b23('0x1')]},'description':{'type':Sequelize[_0x2b23('0x1')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x25ddf7){this[_0x2b23('0xc')](_0x2b23('0x1d'),_0x25ddf7);if(_0x25ddf7){if(this[_0x2b23('0xe')]('wrapuptime')<0x2){this[_0x2b23('0xc')](_0x2b23('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x2b23('0x1f')],'defaultValue':0x0,'comment':_0x2b23('0x20')},'dialMethod':{'type':Sequelize[_0x2b23('0x6')](_0x2b23('0x21'),_0x2b23('0x12'),'power',_0x2b23('0x13'),_0x2b23('0x10')),'defaultValue':_0x2b23('0x12'),'comment':_0x2b23('0x22')},'dialLimitChannel':{'type':Sequelize[_0x2b23('0x15')](0x4)[_0x2b23('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x2b23('0x24')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x2b23('0x25')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x2b23('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x2b23('0x26'),_0x2b23('0x27')),'defaultValue':_0x2b23('0x27'),'comment':_0x2b23('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x2b23('0x29')](0x2)[_0x2b23('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x2b23('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x2b23('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize[_0x2b23('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x2b23('0x15')](0x3)[_0x2b23('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2b23('0x2b')},'dialQueueOptions':{'type':Sequelize[_0x2b23('0x1')],'defaultValue':'tTxX','comment':_0x2b23('0x2c')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x2b23('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2b23('0x2d')},'dialQueueProject':{'type':Sequelize[_0x2b23('0x1')],'comment':_0x2b23('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x2b23('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2b23('0x2f')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x2b23('0x15')](0x5)[_0x2b23('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x2b23('0x15')](0x3)[_0x2b23('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2b23('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x2b23('0x15')](0x5)[_0x2b23('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2b23('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2b23('0x23')],'defaultValue':0x3,'comment':_0x2b23('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x2b23('0x15')](0x5)[_0x2b23('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2b23('0x33')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2b23('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x2b23('0x34')},'dialTimezone':{'type':Sequelize[_0x2b23('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x2b23('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always',_0x2b23('0x35'),_0x2b23('0x36')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x2b23('0x37')},'dialAMDInitialSilence':{'type':Sequelize[_0x2b23('0x15')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x2b23('0x15')](0x9)[_0x2b23('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x2b23('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x2b23('0x15')](0x9)[_0x2b23('0x23')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x2b23('0x15')](0x9)[_0x2b23('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2b23('0x39')},'dialAMDMinWordLength':{'type':Sequelize[_0x2b23('0x15')](0x9)[_0x2b23('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x2b23('0x3a')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x2b23('0x15')](0x9)[_0x2b23('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x2b23('0x3b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x2b23('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x2b23('0x3c')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x2b23('0x15')](0x5)[_0x2b23('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x2b23('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x2b23('0x15')](0x9)[_0x2b23('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2b23('0x3e')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0x2b23('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x2b23('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x2b23('0x1f')],'defaultValue':0x0,'comment':_0x2b23('0x40')},'dialOrderByScheduledAt':{'type':Sequelize[_0x2b23('0x6')](_0x2b23('0x41'),_0x2b23('0x42')),'defaultValue':_0x2b23('0x41')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x2b23('0x2e')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x2b23('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x2b23('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x2b23('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2b23('0x43')},'dialCutDigit':{'type':Sequelize[_0x2b23('0x15')](0x3)[_0x2b23('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2b23('0x44')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x2b23('0x15')](0x3)[_0x2b23('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2b23('0x45')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x2b23('0x15')](0x5)[_0x2b23('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2b23('0x46')},'dialDropMaxRetry':{'type':Sequelize[_0x2b23('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2b23('0x47')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2b23('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2b23('0x48')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x2b23('0x15')](0x3)[_0x2b23('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2b23('0x49')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x2b23('0x15')](0x5)[_0x2b23('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2b23('0x4a')},'dialMachineMaxRetry':{'type':Sequelize[_0x2b23('0x15')](0x3)[_0x2b23('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2b23('0x4b')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2b23('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2b23('0x4c')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2b23('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2b23('0x4d')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x2b23('0x15')](0x5)[_0x2b23('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2b23('0x4e')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2b23('0x15')],'allowNull':!![],'comment':_0x2b23('0x4f')},'mandatoryDisposition':{'type':Sequelize[_0x2b23('0x1f')],'defaultValue':![],'comment':_0x2b23('0x50'),'set':function(_0x5976b1){if(!_0x5976b1)this['setDataValue'](_0x2b23('0x51'),null);this[_0x2b23('0xc')](_0x2b23('0x52'),_0x5976b1);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x2b23('0x15')](0x3)[_0x2b23('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x2b23('0x15')](0x3)[_0x2b23('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x2b23('0x1f')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 9f69779..681d65f 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 _0x41a1=['UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','body','omit','params','getHoppers','findOne','CmHopper','hasOwnProperty','VoiceQueueId','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','Team','teams','Agents','voicePause','flatMap','forEach','penalty','sequelize','transaction','addTeams','each','TeamVoiceQueue','upsert','UserVoiceQueue','UserVoiceQueueRt','isNil','interface','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','User','select','field','tq.TeamId','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','all','compact','ids','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','online','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','fromQuery','scheduledAt','ListId','phone','NOW()','CmListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','createdAt','ContactId','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','get','VoiceQueues','QueueCampaigns','outbound','filter','ignore','type','value','name','error','stack','send','index','map','VoiceQueue','rawAttributes','fieldName','model','query','keys','intersection','fields','length','attributes','nolimit','order','sort','pick','filters','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','user','role','inbound'];(function(_0x33a82a,_0xd1bb35){var _0x15d013=function(_0x14b340){while(--_0x14b340){_0x33a82a['push'](_0x33a82a['shift']());}};_0x15d013(++_0xd1bb35);}(_0x41a1,0x111));var _0x141a=function(_0x27ec33,_0xddd613){_0x27ec33=_0x27ec33-0x0;var _0x168e5e=_0x41a1[_0x27ec33];return _0x168e5e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x141a('0x0'));var zipdir=require(_0x141a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x141a('0x2'));var moment=require(_0x141a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x141a('0x4'));var util=require(_0x141a('0x5'));var path=require(_0x141a('0x6'));var sox=require(_0x141a('0x7'));var csv=require('to-csv');var ejs=require(_0x141a('0x8'));var fs=require('fs');var fs_extra=require(_0x141a('0x9'));var _=require(_0x141a('0xa'));var squel=require(_0x141a('0xb'));var crypto=require(_0x141a('0xc'));var jsforce=require(_0x141a('0xd'));var deskjs=require(_0x141a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x141a('0xf'));var Papa=require('papaparse');var Redis=require(_0x141a('0x10'));var authService=require(_0x141a('0x11'));var qs=require(_0x141a('0x12'));var as=require(_0x141a('0x13'));var hardwareService=require(_0x141a('0x14'));var logger=require(_0x141a('0x15'))('api');var utils=require(_0x141a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x141a('0x17')](config[_0x141a('0x18')],{'host':_0x141a('0x19'),'port':0x18eb});var socket=require(_0x141a('0x1a'))(new Redis(config['redis']));require(_0x141a('0x1b'))['register'](socket);function respondWithStatusCode(_0x2dd715,_0xee6c9d){_0xee6c9d=_0xee6c9d||0xcc;return function(_0x1c487d){if(_0x1c487d){return _0x2dd715[_0x141a('0x1c')](_0xee6c9d);}return _0x2dd715[_0x141a('0x1d')](_0xee6c9d)[_0x141a('0x1e')]();};}function respondWithResult(_0x4be9b1,_0x3ac686){_0x3ac686=_0x3ac686||0xc8;return function(_0x2a9381){if(_0x2a9381){return _0x4be9b1[_0x141a('0x1d')](_0x3ac686)['json'](_0x2a9381);}};}function respondWithFilteredResult(_0x3db6ab,_0x2c35df){return function(_0x4342e9){if(_0x4342e9){var _0x1a4504=typeof _0x2c35df[_0x141a('0x1f')]===_0x141a('0x20')&&typeof _0x2c35df[_0x141a('0x21')]===_0x141a('0x20');var _0x31f785=_0x4342e9[_0x141a('0x22')];var _0x1790a7=_0x1a4504?0x0:_0x2c35df[_0x141a('0x1f')];var _0x5dc729=_0x1a4504?_0x4342e9[_0x141a('0x22')]:_0x2c35df[_0x141a('0x1f')]+_0x2c35df['limit'];var _0x476010;if(_0x5dc729>=_0x31f785){_0x5dc729=_0x31f785;_0x476010=0xc8;}else{_0x476010=0xce;}_0x3db6ab[_0x141a('0x1d')](_0x476010);return _0x3db6ab[_0x141a('0x23')](_0x141a('0x24'),_0x1790a7+'-'+_0x5dc729+'/'+_0x31f785)['json'](_0x4342e9);}return null;};}function patchUpdates(_0x3c927c){return function(_0x1802d8){try{jsonpatch[_0x141a('0x25')](_0x1802d8,_0x3c927c,!![]);}catch(_0x3e1a17){return BPromise[_0x141a('0x26')](_0x3e1a17);}return _0x1802d8['save']();};}function saveUpdates(_0x2ac197,_0x3c3365){return function(_0x378ef9){if(_0x378ef9){return _0x378ef9['update'](_0x2ac197)[_0x141a('0x27')](function(_0x22ce8b){return _0x22ce8b;});}return null;};}function removeEntity(_0x4cabbf,_0x5d6644){return function(_0x38fff2){if(_0x38fff2){return _0x38fff2[_0x141a('0x28')]()[_0x141a('0x27')](function(){var _0x365724=_0x38fff2[_0x141a('0x29')]({'plain':!![]});var _0x256e54=[{'name':_0x141a('0x2a'),'value':'inbound','ignore':![]},{'name':_0x141a('0x2b'),'value':_0x141a('0x2c'),'ignore':![]}];var _0x5a568c=_(_0x256e54)[_0x141a('0x2d')](_0x141a('0x2e'))['map']('value')['value']();if(_['includes'](_0x5a568c,_0x365724[_0x141a('0x2f')])){return;}var _0x2a8243=_['find'](_0x256e54,[_0x141a('0x30'),_0x365724[_0x141a('0x2f')]])[_0x141a('0x31')];return db['UserProfileResource'][_0x141a('0x28')]({'where':{'type':_0x2a8243,'resourceId':_0x365724['id']}})[_0x141a('0x27')](function(){return _0x38fff2;});})[_0x141a('0x27')](function(){_0x4cabbf['status'](0xcc)[_0x141a('0x1e')]();});}};}function handleEntityNotFound(_0x4d7bf4,_0x4a122f){return function(_0x3b6c27){if(!_0x3b6c27){_0x4d7bf4[_0x141a('0x1c')](0x194);}return _0x3b6c27;};}function handleError(_0x237f3f,_0x248548){_0x248548=_0x248548||0x1f4;return function(_0x48f5cb){logger[_0x141a('0x32')](_0x48f5cb[_0x141a('0x33')]);if(_0x48f5cb[_0x141a('0x31')]){delete _0x48f5cb[_0x141a('0x31')];}_0x237f3f['status'](_0x248548)[_0x141a('0x34')](_0x48f5cb);};}exports[_0x141a('0x35')]=function(_0x2130c0,_0x3d3613){var _0x330353={},_0x204dd7={},_0x1ef1af={'count':0x0,'rows':[]};var _0xd7d7c2=_[_0x141a('0x36')](db[_0x141a('0x37')][_0x141a('0x38')],function(_0x5f139c){return{'name':_0x5f139c[_0x141a('0x39')],'type':_0x5f139c[_0x141a('0x2f')]['key']};});_0x204dd7[_0x141a('0x3a')]=_['map'](_0xd7d7c2,_0x141a('0x31'));_0x204dd7[_0x141a('0x3b')]=_[_0x141a('0x3c')](_0x2130c0[_0x141a('0x3b')]);_0x204dd7['filters']=_[_0x141a('0x3d')](_0x204dd7['model'],_0x204dd7[_0x141a('0x3b')]);_0x330353['attributes']=_[_0x141a('0x3d')](_0x204dd7[_0x141a('0x3a')],qs[_0x141a('0x3e')](_0x2130c0['query'][_0x141a('0x3e')]));_0x330353['attributes']=_0x330353['attributes'][_0x141a('0x3f')]?_0x330353[_0x141a('0x40')]:_0x204dd7[_0x141a('0x3a')];if(!_0x2130c0[_0x141a('0x3b')]['hasOwnProperty'](_0x141a('0x41'))){_0x330353[_0x141a('0x21')]=qs[_0x141a('0x21')](_0x2130c0['query'][_0x141a('0x21')]);_0x330353[_0x141a('0x1f')]=qs[_0x141a('0x1f')](_0x2130c0[_0x141a('0x3b')][_0x141a('0x1f')]);}_0x330353[_0x141a('0x42')]=qs[_0x141a('0x43')](_0x2130c0[_0x141a('0x3b')]['sort']);_0x330353['where']=qs['filters'](_[_0x141a('0x44')](_0x2130c0[_0x141a('0x3b')],_0x204dd7[_0x141a('0x45')]),_0xd7d7c2);if(_0x2130c0[_0x141a('0x3b')]['filter']){_0x330353[_0x141a('0x46')]=_[_0x141a('0x47')](_0x330353[_0x141a('0x46')],{'$or':_[_0x141a('0x36')](_0xd7d7c2,function(_0x1fa668){if(_0x1fa668[_0x141a('0x2f')]!==_0x141a('0x48')){var _0x461257={};_0x461257[_0x1fa668['name']]={'$like':'%'+_0x2130c0[_0x141a('0x3b')][_0x141a('0x2d')]+'%'};return _0x461257;}})});}_0x330353=_['merge']({},_0x330353,_0x2130c0['options']);var _0x17886c={'where':_0x330353[_0x141a('0x46')]};return db[_0x141a('0x37')]['count'](_0x17886c)[_0x141a('0x27')](function(_0x1b58b6){_0x1ef1af[_0x141a('0x22')]=_0x1b58b6;if(_0x2130c0['query'][_0x141a('0x49')]){_0x330353[_0x141a('0x4a')]=[{'all':!![]}];}return db['VoiceQueue'][_0x141a('0x4b')](_0x330353);})[_0x141a('0x27')](function(_0x4a4d75){_0x1ef1af[_0x141a('0x4c')]=_0x4a4d75;return _0x1ef1af;})[_0x141a('0x27')](respondWithFilteredResult(_0x3d3613,_0x330353))[_0x141a('0x4d')](handleError(_0x3d3613,null));};exports[_0x141a('0x4e')]=function(_0x4f9aaa,_0x22c96a){var _0x5e8fff={'raw':![],'where':{'id':_0x4f9aaa['params']['id']}},_0x4eb6a6={};_0x4eb6a6[_0x141a('0x3a')]=_[_0x141a('0x3c')](db[_0x141a('0x37')]['rawAttributes']);_0x4eb6a6[_0x141a('0x3b')]=_['keys'](_0x4f9aaa['query']);_0x4eb6a6[_0x141a('0x45')]=_[_0x141a('0x3d')](_0x4eb6a6['model'],_0x4eb6a6[_0x141a('0x3b')]);_0x5e8fff[_0x141a('0x40')]=_[_0x141a('0x3d')](_0x4eb6a6[_0x141a('0x3a')],qs[_0x141a('0x3e')](_0x4f9aaa[_0x141a('0x3b')][_0x141a('0x3e')]));_0x5e8fff[_0x141a('0x40')]=_0x5e8fff['attributes'][_0x141a('0x3f')]?_0x5e8fff[_0x141a('0x40')]:_0x4eb6a6[_0x141a('0x3a')];if(_0x4f9aaa['query']['includeAll']){_0x5e8fff[_0x141a('0x4a')]=[{'all':!![]}];}_0x5e8fff=_[_0x141a('0x47')]({},_0x5e8fff,_0x4f9aaa[_0x141a('0x4f')]);return db[_0x141a('0x37')][_0x141a('0x50')](_0x5e8fff)[_0x141a('0x27')](handleEntityNotFound(_0x22c96a,null))['then'](respondWithResult(_0x22c96a,null))[_0x141a('0x4d')](handleError(_0x22c96a,null));};exports['create']=function(_0x454964,_0x40c80a){return db[_0x141a('0x37')][_0x141a('0x51')](_0x454964['body'],{})['then'](function(_0x38b380){var _0x43b918=_0x454964[_0x141a('0x52')]['get']({'plain':!![]});if(!_0x43b918)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x43b918[_0x141a('0x53')]===_0x141a('0x52')){var _0xaee0dd=_0x38b380['get']({'plain':!![]});var _0x10de3c=[{'name':_0x141a('0x2a'),'value':_0x141a('0x54')},{'name':_0x141a('0x2b'),'value':_0x141a('0x2c')}];var _0x622a59=_[_0x141a('0x50')](_0x10de3c,['value',_0xaee0dd[_0x141a('0x2f')]])[_0x141a('0x31')];return db[_0x141a('0x55')][_0x141a('0x50')]({'where':{'name':_0x622a59,'userProfileId':_0x43b918['userProfileId']},'raw':!![]})[_0x141a('0x27')](function(_0x5853f1){if(_0x5853f1&&_0x5853f1[_0x141a('0x56')]===0x0){return db[_0x141a('0x57')][_0x141a('0x51')]({'name':_0xaee0dd[_0x141a('0x31')],'resourceId':_0xaee0dd['id'],'type':_0x5853f1['name'],'sectionId':_0x5853f1['id']},{})['then'](function(){return _0x38b380;});}else{return _0x38b380;}})[_0x141a('0x4d')](function(_0x14c8c0){logger[_0x141a('0x32')](_0x141a('0x58'),_0x14c8c0);throw _0x14c8c0;});}return _0x38b380;})[_0x141a('0x27')](respondWithResult(_0x40c80a,0xc9))['catch'](handleError(_0x40c80a,null));};exports[_0x141a('0x59')]=function(_0x4b7adc,_0x35a522){var _0x5498a6={'where':{'id':_0x4b7adc['params']['id']}},_0xa0bf14={};_0xa0bf14[_0x141a('0x3a')]=_['keys'](db[_0x141a('0x37')][_0x141a('0x38')]);_0x5498a6[_0x141a('0x40')]=_[_0x141a('0x3d')](_0xa0bf14[_0x141a('0x3a')],qs['fields'](_0x4b7adc['query'][_0x141a('0x3e')]));_0x5498a6[_0x141a('0x40')]=_0x5498a6[_0x141a('0x40')]['length']?_0x5498a6[_0x141a('0x40')]:_0xa0bf14[_0x141a('0x3a')];if(_0x4b7adc[_0x141a('0x3b')][_0x141a('0x49')]){_0x5498a6[_0x141a('0x4a')]=[{'all':!![]}];}_0x5498a6=_[_0x141a('0x47')]({},_0x5498a6,_0x4b7adc['options']);return db[_0x141a('0x37')][_0x141a('0x50')](_0x5498a6)[_0x141a('0x27')](handleEntityNotFound(_0x35a522,null))[_0x141a('0x27')](function(_0x45f66e){if(_0x45f66e){var _0x36d5b7=_0x45f66e[_0x141a('0x29')]({'plain':!![]});_0x36d5b7=qs['omit'](_0x36d5b7,['id','createdAt',_0x141a('0x5a')]);_0x4b7adc[_0x141a('0x5b')]=_[_0x141a('0x5c')](_0x4b7adc[_0x141a('0x5b')],['id','createdAt',_0x141a('0x5a')]);return db[_0x141a('0x37')][_0x141a('0x51')](_['merge'](_0x36d5b7,_0x4b7adc[_0x141a('0x5b')]),{'include':_0x4b7adc['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x50caff){var _0x222baa=_0x4b7adc[_0x141a('0x52')]['get']({'plain':!![]});if(!_0x222baa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x222baa[_0x141a('0x53')]==='user'){var _0x408a7f=_0x50caff[_0x141a('0x29')]({'plain':!![]});var _0xc881be=[{'name':_0x141a('0x2a'),'value':_0x141a('0x54')},{'name':'QueueCampaigns','value':_0x141a('0x2c')}];var _0x2a9b98=_[_0x141a('0x50')](_0xc881be,[_0x141a('0x30'),_0x408a7f[_0x141a('0x2f')]])[_0x141a('0x31')];return db[_0x141a('0x55')]['find']({'where':{'name':_0x2a9b98,'userProfileId':_0x222baa['userProfileId']},'raw':!![]})[_0x141a('0x27')](function(_0x5f074a){if(_0x5f074a&&_0x5f074a['autoAssociation']===0x0){return db['UserProfileResource'][_0x141a('0x51')]({'name':_0x408a7f[_0x141a('0x31')],'resourceId':_0x408a7f['id'],'type':_0x5f074a[_0x141a('0x31')],'sectionId':_0x5f074a['id']},{})[_0x141a('0x27')](function(){return _0x50caff;});}else{return _0x50caff;}})[_0x141a('0x4d')](function(_0x365bb9){logger[_0x141a('0x32')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x365bb9);throw _0x365bb9;});}return _0x50caff;});}})[_0x141a('0x27')](respondWithResult(_0x35a522,0xc9))[_0x141a('0x4d')](handleError(_0x35a522,null));};exports['update']=function(_0xbaab73,_0x521754){if(_0xbaab73[_0x141a('0x5b')]['id']){delete _0xbaab73[_0x141a('0x5b')]['id'];}return db['VoiceQueue']['find']({'where':{'id':_0xbaab73['params']['id']}})['then'](handleEntityNotFound(_0x521754,null))[_0x141a('0x27')](saveUpdates(_0xbaab73[_0x141a('0x5b')],null))['then'](respondWithResult(_0x521754,null))['catch'](handleError(_0x521754,null));};exports[_0x141a('0x28')]=function(_0x572d8e,_0x34bccc){return db[_0x141a('0x37')]['find']({'where':{'id':_0x572d8e[_0x141a('0x5d')]['id']}})[_0x141a('0x27')](handleEntityNotFound(_0x34bccc,null))['then'](removeEntity(_0x34bccc,null))[_0x141a('0x4d')](handleError(_0x34bccc,null));};exports[_0x141a('0x5e')]=function(_0x42316f,_0x122bf1,_0x45958e){var _0x38834c={'raw':![],'where':{}};var _0x4e904b={};var _0x41462e={'count':0x0,'rows':[]};return db[_0x141a('0x37')][_0x141a('0x5f')]({'where':{'id':_0x42316f[_0x141a('0x5d')]['id']}})['then'](handleEntityNotFound(_0x122bf1,null))[_0x141a('0x27')](function(_0x459248){if(_0x459248){_0x4e904b[_0x141a('0x3a')]=_[_0x141a('0x3c')](db[_0x141a('0x60')][_0x141a('0x38')]);_0x4e904b['query']=_['keys'](_0x42316f[_0x141a('0x3b')]);_0x4e904b['filters']=_['intersection'](_0x4e904b[_0x141a('0x3a')],_0x4e904b['query']);_0x38834c[_0x141a('0x40')]=_[_0x141a('0x3d')](_0x4e904b['model'],qs[_0x141a('0x3e')](_0x42316f[_0x141a('0x3b')][_0x141a('0x3e')]));_0x38834c[_0x141a('0x40')]=_0x38834c[_0x141a('0x40')][_0x141a('0x3f')]?_0x38834c['attributes']:_0x4e904b[_0x141a('0x3a')];if(!_0x42316f[_0x141a('0x3b')][_0x141a('0x61')](_0x141a('0x41'))){_0x38834c['limit']=qs['limit'](_0x42316f['query'][_0x141a('0x21')]);_0x38834c[_0x141a('0x1f')]=qs[_0x141a('0x1f')](_0x42316f[_0x141a('0x3b')][_0x141a('0x1f')]);}_0x38834c['order']=qs[_0x141a('0x43')](_0x42316f[_0x141a('0x3b')][_0x141a('0x43')]);_0x38834c[_0x141a('0x46')]=qs[_0x141a('0x45')](_[_0x141a('0x44')](_0x42316f[_0x141a('0x3b')],_0x4e904b[_0x141a('0x45')]));_0x38834c[_0x141a('0x46')][_0x141a('0x62')]=_0x459248['id'];if(_0x42316f['query'][_0x141a('0x2d')]){_0x38834c['where']=_[_0x141a('0x47')](_0x38834c['where'],{'$or':_[_0x141a('0x36')](_0x38834c[_0x141a('0x40')],function(_0x5ab227){var _0xa37529={};_0xa37529[_0x5ab227]={'$like':'%'+_0x42316f[_0x141a('0x3b')][_0x141a('0x2d')]+'%'};return _0xa37529;})});}_0x38834c=_[_0x141a('0x47')]({},_0x38834c,_0x42316f[_0x141a('0x4f')]);return db[_0x141a('0x60')][_0x141a('0x22')]({'where':_0x38834c[_0x141a('0x46')]})[_0x141a('0x27')](function(_0x5933b8){_0x41462e[_0x141a('0x22')]=_0x5933b8;if(_0x42316f['query'][_0x141a('0x49')]){_0x38834c[_0x141a('0x4a')]=[{'all':!![]}];}return db[_0x141a('0x60')]['findAll'](_0x38834c);})[_0x141a('0x27')](function(_0xbfdf61){_0x41462e[_0x141a('0x4c')]=_0xbfdf61;return _0x41462e;});}})[_0x141a('0x27')](respondWithFilteredResult(_0x122bf1,_0x38834c))[_0x141a('0x4d')](handleError(_0x122bf1,null));};exports['getHopperHistories']=function(_0x4e1d63,_0x23754b,_0x4cc836){var _0xf814ee={'raw':!![],'where':{}};var _0x4857b7={};var _0x34423f={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x141a('0x5f')]({'where':{'id':_0x4e1d63[_0x141a('0x5d')]['id']}})[_0x141a('0x27')](handleEntityNotFound(_0x23754b,null))[_0x141a('0x27')](function(_0x2f6eb8){if(_0x2f6eb8){_0x4857b7[_0x141a('0x3a')]=_['keys'](db[_0x141a('0x63')]['rawAttributes']);_0x4857b7[_0x141a('0x3b')]=_[_0x141a('0x3c')](_0x4e1d63['query']);_0x4857b7[_0x141a('0x45')]=_['intersection'](_0x4857b7['model'],_0x4857b7[_0x141a('0x3b')]);_0xf814ee['attributes']=_[_0x141a('0x3d')](_0x4857b7[_0x141a('0x3a')],qs['fields'](_0x4e1d63[_0x141a('0x3b')]['fields']));_0xf814ee[_0x141a('0x40')]=_0xf814ee[_0x141a('0x40')][_0x141a('0x3f')]?_0xf814ee[_0x141a('0x40')]:_0x4857b7[_0x141a('0x3a')];if(!_0x4e1d63[_0x141a('0x3b')][_0x141a('0x61')]('nolimit')){_0xf814ee[_0x141a('0x21')]=qs[_0x141a('0x21')](_0x4e1d63[_0x141a('0x3b')][_0x141a('0x21')]);_0xf814ee[_0x141a('0x1f')]=qs['offset'](_0x4e1d63[_0x141a('0x3b')][_0x141a('0x1f')]);}_0xf814ee[_0x141a('0x42')]=qs[_0x141a('0x43')](_0x4e1d63[_0x141a('0x3b')][_0x141a('0x43')]);_0xf814ee[_0x141a('0x46')]=qs[_0x141a('0x45')](_[_0x141a('0x44')](_0x4e1d63[_0x141a('0x3b')],_0x4857b7[_0x141a('0x45')]));_0xf814ee['where']['VoiceQueueId']=_0x2f6eb8['id'];if(_0x4e1d63[_0x141a('0x3b')]['filter']){_0xf814ee['where']=_['merge'](_0xf814ee[_0x141a('0x46')],{'$or':_['map'](_0xf814ee[_0x141a('0x40')],function(_0x1edabe){var _0x199164={};_0x199164[_0x1edabe]={'$like':'%'+_0x4e1d63['query'][_0x141a('0x2d')]+'%'};return _0x199164;})});}_0xf814ee=_[_0x141a('0x47')]({},_0xf814ee,_0x4e1d63[_0x141a('0x4f')]);return db[_0x141a('0x63')][_0x141a('0x22')]({'where':_0xf814ee[_0x141a('0x46')]})[_0x141a('0x27')](function(_0x10d3d6){_0x34423f['count']=_0x10d3d6;if(_0x4e1d63[_0x141a('0x3b')][_0x141a('0x49')]){_0xf814ee[_0x141a('0x4a')]=[{'all':!![]}];}return db[_0x141a('0x63')][_0x141a('0x4b')](_0xf814ee);})[_0x141a('0x27')](function(_0x1288b7){_0x34423f[_0x141a('0x4c')]=_0x1288b7;return _0x34423f;});}})[_0x141a('0x27')](respondWithFilteredResult(_0x23754b,_0xf814ee))[_0x141a('0x4d')](handleError(_0x23754b,null));};exports[_0x141a('0x64')]=function(_0x4d43c5,_0x3981b6,_0x46d4ae){var _0x634350={'raw':!![],'where':{}};var _0x284773={};var _0x45c14a={'count':0x0,'rows':[]};return db[_0x141a('0x37')][_0x141a('0x5f')]({'where':{'id':_0x4d43c5[_0x141a('0x5d')]['id']}})[_0x141a('0x27')](handleEntityNotFound(_0x3981b6,null))[_0x141a('0x27')](function(_0x19ace9){if(_0x19ace9){_0x284773[_0x141a('0x3a')]=_[_0x141a('0x3c')](db['CmHopperFinal']['rawAttributes']);_0x284773[_0x141a('0x3b')]=_['keys'](_0x4d43c5[_0x141a('0x3b')]);_0x284773[_0x141a('0x45')]=_[_0x141a('0x3d')](_0x284773['model'],_0x284773['query']);_0x634350[_0x141a('0x40')]=_[_0x141a('0x3d')](_0x284773['model'],qs[_0x141a('0x3e')](_0x4d43c5[_0x141a('0x3b')]['fields']));_0x634350[_0x141a('0x40')]=_0x634350[_0x141a('0x40')][_0x141a('0x3f')]?_0x634350[_0x141a('0x40')]:_0x284773[_0x141a('0x3a')];if(!_0x4d43c5['query'][_0x141a('0x61')](_0x141a('0x41'))){_0x634350[_0x141a('0x21')]=qs['limit'](_0x4d43c5[_0x141a('0x3b')][_0x141a('0x21')]);_0x634350[_0x141a('0x1f')]=qs[_0x141a('0x1f')](_0x4d43c5[_0x141a('0x3b')][_0x141a('0x1f')]);}_0x634350[_0x141a('0x42')]=qs[_0x141a('0x43')](_0x4d43c5[_0x141a('0x3b')][_0x141a('0x43')]);_0x634350[_0x141a('0x46')]=qs[_0x141a('0x45')](_[_0x141a('0x44')](_0x4d43c5[_0x141a('0x3b')],_0x284773[_0x141a('0x45')]));_0x634350[_0x141a('0x46')][_0x141a('0x62')]=_0x19ace9['id'];if(_0x4d43c5[_0x141a('0x3b')][_0x141a('0x2d')]){_0x634350[_0x141a('0x46')]=_[_0x141a('0x47')](_0x634350[_0x141a('0x46')],{'$or':_[_0x141a('0x36')](_0x634350[_0x141a('0x40')],function(_0x19edc4){var _0x525bd3={};_0x525bd3[_0x19edc4]={'$like':'%'+_0x4d43c5[_0x141a('0x3b')]['filter']+'%'};return _0x525bd3;})});}_0x634350=_[_0x141a('0x47')]({},_0x634350,_0x4d43c5[_0x141a('0x4f')]);return db['CmHopperFinal'][_0x141a('0x22')]({'where':_0x634350['where']})[_0x141a('0x27')](function(_0x1f8011){_0x45c14a[_0x141a('0x22')]=_0x1f8011;if(_0x4d43c5[_0x141a('0x3b')][_0x141a('0x49')]){_0x634350[_0x141a('0x4a')]=[{'all':!![]}];}return db[_0x141a('0x65')][_0x141a('0x4b')](_0x634350);})['then'](function(_0x553ca2){_0x45c14a['rows']=_0x553ca2;return _0x45c14a;});}})['then'](respondWithFilteredResult(_0x3981b6,_0x634350))[_0x141a('0x4d')](handleError(_0x3981b6,null));};exports['getHopperBlacks']=function(_0x4120b9,_0x37ab25,_0x493bb7){var _0x525d03={'raw':!![],'where':{}};var _0x2b412d={};var _0x3c4fb1={'count':0x0,'rows':[]};return db[_0x141a('0x37')]['findOne']({'where':{'id':_0x4120b9['params']['id']}})['then'](handleEntityNotFound(_0x37ab25,null))[_0x141a('0x27')](function(_0xff13a7){if(_0xff13a7){_0x2b412d[_0x141a('0x3a')]=_[_0x141a('0x3c')](db[_0x141a('0x66')][_0x141a('0x38')]);_0x2b412d[_0x141a('0x3b')]=_[_0x141a('0x3c')](_0x4120b9['query']);_0x2b412d['filters']=_[_0x141a('0x3d')](_0x2b412d[_0x141a('0x3a')],_0x2b412d[_0x141a('0x3b')]);_0x525d03[_0x141a('0x40')]=_[_0x141a('0x3d')](_0x2b412d[_0x141a('0x3a')],qs[_0x141a('0x3e')](_0x4120b9[_0x141a('0x3b')][_0x141a('0x3e')]));_0x525d03[_0x141a('0x40')]=_0x525d03[_0x141a('0x40')][_0x141a('0x3f')]?_0x525d03[_0x141a('0x40')]:_0x2b412d[_0x141a('0x3a')];if(!_0x4120b9[_0x141a('0x3b')]['hasOwnProperty'](_0x141a('0x41'))){_0x525d03['limit']=qs[_0x141a('0x21')](_0x4120b9[_0x141a('0x3b')][_0x141a('0x21')]);_0x525d03[_0x141a('0x1f')]=qs[_0x141a('0x1f')](_0x4120b9[_0x141a('0x3b')][_0x141a('0x1f')]);}_0x525d03[_0x141a('0x42')]=qs[_0x141a('0x43')](_0x4120b9[_0x141a('0x3b')][_0x141a('0x43')]);_0x525d03[_0x141a('0x46')]=qs['filters'](_[_0x141a('0x44')](_0x4120b9[_0x141a('0x3b')],_0x2b412d[_0x141a('0x45')]));_0x525d03[_0x141a('0x46')][_0x141a('0x62')]=_0xff13a7['id'];if(_0x4120b9[_0x141a('0x3b')][_0x141a('0x2d')]){_0x525d03['where']=_[_0x141a('0x47')](_0x525d03[_0x141a('0x46')],{'$or':_[_0x141a('0x36')](_0x525d03[_0x141a('0x40')],function(_0x37cb27){var _0x593e9d={};_0x593e9d[_0x37cb27]={'$like':'%'+_0x4120b9['query'][_0x141a('0x2d')]+'%'};return _0x593e9d;})});}_0x525d03=_[_0x141a('0x47')]({},_0x525d03,_0x4120b9['options']);return db[_0x141a('0x66')][_0x141a('0x22')]({'where':_0x525d03[_0x141a('0x46')]})[_0x141a('0x27')](function(_0x305a7b){_0x3c4fb1['count']=_0x305a7b;if(_0x4120b9[_0x141a('0x3b')][_0x141a('0x49')]){_0x525d03[_0x141a('0x4a')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x141a('0x4b')](_0x525d03);})[_0x141a('0x27')](function(_0x3f7411){_0x3c4fb1[_0x141a('0x4c')]=_0x3f7411;return _0x3c4fb1;});}})[_0x141a('0x27')](respondWithFilteredResult(_0x37ab25,_0x525d03))['catch'](handleError(_0x37ab25,null));};exports[_0x141a('0x67')]=function(_0x388742,_0x71abfa,_0x420a42){var _0x2aaae1={};var _0x4e2c9c={};var _0x10d780;var _0xd01894;return db[_0x141a('0x37')][_0x141a('0x5f')]({'where':{'id':_0x388742[_0x141a('0x5d')]['id']}})[_0x141a('0x27')](handleEntityNotFound(_0x71abfa,null))['then'](function(_0x5d60a1){if(_0x5d60a1){_0x10d780=_0x5d60a1;_0x4e2c9c['model']=_['keys'](db[_0x141a('0x68')][_0x141a('0x38')]);_0x4e2c9c[_0x141a('0x3b')]=_[_0x141a('0x3c')](_0x388742[_0x141a('0x3b')]);_0x4e2c9c['filters']=_['intersection'](_0x4e2c9c[_0x141a('0x3a')],_0x4e2c9c[_0x141a('0x3b')]);_0x2aaae1[_0x141a('0x40')]=_['intersection'](_0x4e2c9c[_0x141a('0x3a')],qs[_0x141a('0x3e')](_0x388742[_0x141a('0x3b')]['fields']));_0x2aaae1[_0x141a('0x40')]=_0x2aaae1[_0x141a('0x40')]['length']?_0x2aaae1[_0x141a('0x40')]:_0x4e2c9c[_0x141a('0x3a')];_0x2aaae1[_0x141a('0x42')]=qs[_0x141a('0x43')](_0x388742[_0x141a('0x3b')]['sort']);_0x2aaae1[_0x141a('0x46')]=qs['filters'](_[_0x141a('0x44')](_0x388742[_0x141a('0x3b')],_0x4e2c9c['filters']));if(_0x388742[_0x141a('0x3b')][_0x141a('0x2d')]){_0x2aaae1[_0x141a('0x46')]=_[_0x141a('0x47')](_0x2aaae1['where'],{'$or':_[_0x141a('0x36')](_0x2aaae1['attributes'],function(_0x3d2043){var _0x271194={};_0x271194[_0x3d2043]={'$like':'%'+_0x388742[_0x141a('0x3b')][_0x141a('0x2d')]+'%'};return _0x271194;})});}_0x2aaae1=_[_0x141a('0x47')]({},_0x2aaae1,_0x388742[_0x141a('0x4f')]);return _0x10d780[_0x141a('0x67')](_0x2aaae1);}})['then'](function(_0x1d712d){if(_0x1d712d){_0xd01894=_0x1d712d['length'];if(!_0x388742['query'][_0x141a('0x61')](_0x141a('0x41'))){_0x2aaae1[_0x141a('0x21')]=qs[_0x141a('0x21')](_0x388742[_0x141a('0x3b')]['limit']);_0x2aaae1[_0x141a('0x1f')]=qs[_0x141a('0x1f')](_0x388742[_0x141a('0x3b')][_0x141a('0x1f')]);}return _0x10d780[_0x141a('0x67')](_0x2aaae1);}})[_0x141a('0x27')](function(_0x2594e2){if(_0x2594e2){return _0x2594e2?{'count':_0xd01894,'rows':_0x2594e2}:null;}})['then'](respondWithResult(_0x71abfa,null))['catch'](handleError(_0x71abfa,null));};exports['addTeams']=function(_0x1a55ed,_0x49c840,_0x2c3494){var _0x6958ff=_0x1a55ed[_0x141a('0x5b')][_0x141a('0x69')];var _0x51a95b=_[_0x141a('0x36')](_0x6958ff,'id');return db[_0x141a('0x68')]['findAll']({'where':{'id':_0x51a95b},'attributes':['id'],'include':[{'model':db['User'],'as':_0x141a('0x6a'),'attributes':['id','name','online',_0x141a('0x6b'),'interface'],'raw':!![]}]})[_0x141a('0x27')](function(_0x3fd3db){if(_0x3fd3db){var _0x5ec90a=_[_0x141a('0x6c')](_0x3fd3db,function(_0x4c3ada){var _0x3182fb=_0x4c3ada[_0x141a('0x29')]({'plain':!![]});_0x3182fb[_0x141a('0x6a')][_0x141a('0x6d')](function(_0x25aaec){_0x25aaec[_0x141a('0x6e')]=_[_0x141a('0x50')](_0x6958ff,{'id':_0x3182fb['id']})[_0x141a('0x6e')];});return _0x3182fb[_0x141a('0x6a')];});return db['VoiceQueue'][_0x141a('0x50')]({'where':{'id':_0x1a55ed['params']['id']}})[_0x141a('0x27')](function(_0x4eccfc){return db[_0x141a('0x6f')][_0x141a('0x70')](function(_0x436be5){return _0x4eccfc[_0x141a('0x71')](_0x51a95b,{'transaction':_0x436be5})[_0x141a('0x27')](function(){return BPromise[_0x141a('0x72')](_0x6958ff,function(_0x3d65ba){return db[_0x141a('0x73')][_0x141a('0x74')]({'TeamId':_0x3d65ba['id'],'VoiceQueueId':_0x1a55ed[_0x141a('0x5d')]['id'],'penalty':_0x3d65ba[_0x141a('0x6e')]},{'transaction':_0x436be5});});})[_0x141a('0x27')](function(){return BPromise[_0x141a('0x72')](_0x5ec90a,function(_0x29cfa6){return db[_0x141a('0x75')]['findOrCreate']({'where':{'UserId':_0x29cfa6['id'],'VoiceQueueId':_0x1a55ed['params']['id']},'defaults':{'penalty':_0x29cfa6[_0x141a('0x6e')]},'transaction':_0x436be5});});})[_0x141a('0x27')](function(){return BPromise[_0x141a('0x72')](_[_0x141a('0x2d')](_0x5ec90a,{'online':!![]}),function(_0x4b03a5){return db[_0x141a('0x76')][_0x141a('0x74')]({'membername':_0x4b03a5['name'],'UserId':_0x4b03a5['id'],'queue_name':_0x4eccfc[_0x141a('0x31')],'VoiceQueueId':_0x4eccfc['id'],'interface':_[_0x141a('0x77')](_0x4b03a5[_0x141a('0x78')])?util[_0x141a('0x79')](_0x141a('0x7a'),_0x4b03a5[_0x141a('0x31')]):_0x4b03a5[_0x141a('0x78')],'paused':_0x4b03a5[_0x141a('0x6b')]||![],'penalty':_0x4b03a5[_0x141a('0x6e')]},{'transaction':_0x436be5});});})['then'](function(){_0x5ec90a['forEach'](function(_0x1b193d){socket[_0x141a('0x7b')](_0x141a('0x7c'),{'UserId':_0x1b193d['id'],'VoiceQueueId':_0x4eccfc['id']});});});});});}})[_0x141a('0x27')](respondWithStatusCode(_0x49c840,null))[_0x141a('0x4d')](handleError(_0x49c840,null));};exports[_0x141a('0x7d')]=function(_0x1169ef,_0x5a7afb,_0x5e636a){return db[_0x141a('0x68')][_0x141a('0x4b')]({'where':{'id':_0x1169ef[_0x141a('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db[_0x141a('0x7e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x141a('0x27')](handleEntityNotFound(_0x5a7afb,null))[_0x141a('0x27')](function(_0x44de8f){var _0x1ad63b=_[_0x141a('0x36')](_0x44de8f,'id');var _0x46ab1a=[];var _0x3d1e88=[];var _0xca09b2=squel[_0x141a('0x7f')]();_0xca09b2[_0x141a('0x80')](_0x141a('0x81'))['from']('team_has_voice_queues','tq')['join'](_0x141a('0x82'),'ut',_0x141a('0x83'))[_0x141a('0x46')](_0x141a('0x84'),_0x1169ef['params']['id']);for(var _0x52c62a=0x0;_0x52c62a<_0x44de8f[_0x141a('0x3f')];_0x52c62a+=0x1){let _0x2abc9d=_0x44de8f[_0x52c62a];for(var _0x3065e3=0x0;_0x3065e3<_0x2abc9d['Agents'][_0x141a('0x3f')];_0x3065e3+=0x1){let _0x147016=_0x2abc9d[_0x141a('0x6a')][_0x3065e3];var _0x47e7cf=_0xca09b2[_0x141a('0x59')]();_0x47e7cf[_0x141a('0x46')](_0x141a('0x85'),_0x147016['id']);_0x3d1e88[_0x141a('0x86')](db[_0x141a('0x6f')][_0x141a('0x3b')](_0x47e7cf[_0x141a('0x87')](),{'type':db['sequelize'][_0x141a('0x88')][_0x141a('0x89')]})['then'](function(_0x5d2e32){if(_0x5d2e32[_0x141a('0x3f')]===0x1){return _0x147016['id'];}else{var _0x155492=_[_0x141a('0x8a')](_[_0x141a('0x36')](_0x5d2e32,'TeamId'),function(_0x12afb4){return _['includes'](_0x1ad63b,_0x12afb4);});if(_0x155492){return _0x147016['id'];}}}));}}return BPromise[_0x141a('0x8b')](_0x3d1e88)['then'](function(_0x3f98af){_0x46ab1a=_(_0x46ab1a)['union'](_0x3f98af)[_0x141a('0x8c')]()[_0x141a('0x30')]();return db['VoiceQueue'][_0x141a('0x50')]({'where':{'id':_0x1169ef[_0x141a('0x5d')]['id']}})[_0x141a('0x27')](function(_0x2a0b8a){return db[_0x141a('0x6f')][_0x141a('0x70')](function(_0x13b5ef){return _0x2a0b8a['removeTeams'](_0x1169ef[_0x141a('0x3b')][_0x141a('0x8d')],{'transaction':_0x13b5ef})['then'](function(){if(!_[_0x141a('0x8e')](_0x46ab1a)){return _0x2a0b8a[_0x141a('0x8f')](_0x46ab1a,{'transaction':_0x13b5ef})[_0x141a('0x27')](function(){return db[_0x141a('0x76')][_0x141a('0x28')]({'where':{'VoiceQueueId':_0x1169ef['params']['id'],'UserId':_0x46ab1a},'transaction':_0x13b5ef});});}})[_0x141a('0x27')](function(){_0x46ab1a[_0x141a('0x6d')](function(_0x3974b5){socket['emit'](_0x141a('0x90'),{'UserId':_0x3974b5,'VoiceQueueId':_0x2a0b8a['id']});});});});});});})[_0x141a('0x27')](respondWithStatusCode(_0x5a7afb,null))[_0x141a('0x4d')](handleError(_0x5a7afb,null));};exports['addAgents']=function(_0x388c84,_0x239936,_0x2fab4a){var _0x1e5094,_0x277698;return db[_0x141a('0x37')]['find']({'where':{'id':_0x388c84['params']['id']}})[_0x141a('0x27')](handleEntityNotFound(_0x239936,null))['then'](function(_0x391fc6){if(_0x391fc6){_0x277698=_0x391fc6;return _0x391fc6[_0x141a('0x91')](_0x388c84[_0x141a('0x5b')]['ids'],_[_0x141a('0x5c')](_0x388c84[_0x141a('0x5b')],[_0x141a('0x8d'),'id'])||{})[_0x141a('0x92')](function(_0x20a7ca){for(var _0x1b0e57=0x0;_0x1b0e57<_0x388c84[_0x141a('0x5b')]['ids']['length'];_0x1b0e57+=0x1){socket['emit'](_0x141a('0x7c'),{'UserId':Number(_0x388c84[_0x141a('0x5b')][_0x141a('0x8d')][_0x1b0e57]),'VoiceQueueId':Number(_0x388c84[_0x141a('0x5d')]['id'])});}return _0x20a7ca;});}})[_0x141a('0x27')](function(_0x38344f){_0x1e5094=_0x38344f||[];if(_0x277698){return db[_0x141a('0x7e')]['findAll']({'where':{'id':_0x388c84[_0x141a('0x5b')][_0x141a('0x8d')]},'attributes':['id',_0x141a('0x31'),_0x141a('0x93'),_0x141a('0x6b'),_0x141a('0x78')],'raw':!![]});}})[_0x141a('0x27')](function(_0x4349e1){if(!_['isEmpty'](_0x4349e1)){var _0x2d61ab=[];for(var _0x2b8de=0x0;_0x2b8de<_0x4349e1[_0x141a('0x3f')];_0x2b8de++){if(_0x4349e1[_0x2b8de][_0x141a('0x93')]){_0x2d61ab['push'](db[_0x141a('0x76')][_0x141a('0x74')]({'membername':_0x4349e1[_0x2b8de][_0x141a('0x31')],'UserId':_0x4349e1[_0x2b8de]['id'],'queue_name':_0x277698[_0x141a('0x31')],'VoiceQueueId':_0x277698['id'],'interface':_['isNil'](_0x4349e1[_0x2b8de][_0x141a('0x78')])?util[_0x141a('0x79')]('SIP/%s',_0x4349e1[_0x2b8de]['name']):_0x4349e1[_0x2b8de][_0x141a('0x78')],'paused':_0x4349e1[_0x2b8de][_0x141a('0x6b')]||![],'penalty':_0x388c84[_0x141a('0x5b')]['penalty']||0x0}));}}return BPromise[_0x141a('0x8b')](_0x2d61ab);}})[_0x141a('0x27')](function(){return _0x1e5094;})[_0x141a('0x27')](respondWithResult(_0x239936,null))['catch'](handleError(_0x239936,null));};exports[_0x141a('0x8f')]=function(_0x327e5a,_0x26f3a1,_0x373495){return db[_0x141a('0x37')][_0x141a('0x50')]({'where':{'id':_0x327e5a[_0x141a('0x5d')]['id']}})[_0x141a('0x27')](handleEntityNotFound(_0x26f3a1,null))['then'](function(_0x449381){if(_0x449381){return _0x449381[_0x141a('0x8f')](_0x327e5a[_0x141a('0x3b')]['ids'])[_0x141a('0x27')](function(){if(_['isArray'](_0x327e5a[_0x141a('0x3b')][_0x141a('0x8d')])){for(var _0x2f1b7e=0x0;_0x2f1b7e<_0x327e5a[_0x141a('0x3b')][_0x141a('0x8d')]['length'];_0x2f1b7e+=0x1){socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x327e5a['query'][_0x141a('0x8d')][_0x2f1b7e]),'VoiceQueueId':Number(_0x327e5a[_0x141a('0x5d')]['id'])});}}else{socket[_0x141a('0x7b')](_0x141a('0x90'),{'UserId':Number(_0x327e5a[_0x141a('0x3b')][_0x141a('0x8d')]),'VoiceQueueId':Number(_0x327e5a[_0x141a('0x5d')]['id'])});}});}})[_0x141a('0x27')](function(_0x549056){return db[_0x141a('0x76')][_0x141a('0x28')]({'where':{'VoiceQueueId':_0x327e5a[_0x141a('0x5d')]['id'],'UserId':_0x327e5a[_0x141a('0x3b')][_0x141a('0x8d')]}})[_0x141a('0x27')](function(){return _0x549056;});})['then'](respondWithStatusCode(_0x26f3a1,null))[_0x141a('0x4d')](handleError(_0x26f3a1,null));};exports[_0x141a('0x94')]=function(_0x130ede,_0x2fd8ba,_0x3cc042){var _0x5cb1ed={};var _0x57220f={};var _0x506b10;var _0x58d526;return db[_0x141a('0x37')][_0x141a('0x5f')]({'where':{'id':_0x130ede[_0x141a('0x5d')]['id']}})[_0x141a('0x27')](handleEntityNotFound(_0x2fd8ba,null))['then'](function(_0xb99c43){if(_0xb99c43){_0x506b10=_0xb99c43;_0x57220f[_0x141a('0x3a')]=_[_0x141a('0x3c')](db['User'][_0x141a('0x38')]);_0x57220f[_0x141a('0x3b')]=_['keys'](_0x130ede[_0x141a('0x3b')]);_0x57220f[_0x141a('0x45')]=_[_0x141a('0x3d')](_0x57220f[_0x141a('0x3a')],_0x57220f[_0x141a('0x3b')]);_0x5cb1ed[_0x141a('0x40')]=_[_0x141a('0x3d')](_0x57220f[_0x141a('0x3a')],qs[_0x141a('0x3e')](_0x130ede['query'][_0x141a('0x3e')]));_0x5cb1ed[_0x141a('0x40')]=_0x5cb1ed['attributes'][_0x141a('0x3f')]?_0x5cb1ed[_0x141a('0x40')]:_0x57220f['model'];_0x5cb1ed['order']=qs[_0x141a('0x43')](_0x130ede[_0x141a('0x3b')]['sort']);_0x5cb1ed['where']=qs['filters'](_[_0x141a('0x44')](_0x130ede['query'],_0x57220f[_0x141a('0x45')]));if(_0x130ede[_0x141a('0x3b')][_0x141a('0x2d')]){_0x5cb1ed['where']=_[_0x141a('0x47')](_0x5cb1ed[_0x141a('0x46')],{'$or':_['map'](_0x5cb1ed[_0x141a('0x40')],function(_0x478e72){var _0x3a7018={};_0x3a7018[_0x478e72]={'$like':'%'+_0x130ede[_0x141a('0x3b')][_0x141a('0x2d')]+'%'};return _0x3a7018;})});}_0x5cb1ed=_[_0x141a('0x47')]({},_0x5cb1ed,_0x130ede[_0x141a('0x4f')]);return _0x506b10['getAgents'](_0x5cb1ed);}})[_0x141a('0x27')](function(_0x4cc831){if(_0x4cc831){_0x58d526=_0x4cc831[_0x141a('0x3f')];if(!_0x130ede[_0x141a('0x3b')][_0x141a('0x61')](_0x141a('0x41'))){_0x5cb1ed[_0x141a('0x21')]=qs[_0x141a('0x21')](_0x130ede[_0x141a('0x3b')][_0x141a('0x21')]);_0x5cb1ed[_0x141a('0x1f')]=qs[_0x141a('0x1f')](_0x130ede[_0x141a('0x3b')][_0x141a('0x1f')]);}return _0x506b10['getAgents'](_0x5cb1ed);}})[_0x141a('0x27')](function(_0x89e45c){if(_0x89e45c){return _0x89e45c?{'count':_0x58d526,'rows':_0x89e45c}:null;}})[_0x141a('0x27')](respondWithResult(_0x2fd8ba,null))[_0x141a('0x4d')](handleError(_0x2fd8ba,null));};exports['getMembers']=function(_0x37d7c1,_0x1ca562,_0x1f2aa5){var _0x3f0e4b={};var _0x1291cf={};var _0x2a6d70;var _0x27ca0d;return db['VoiceQueue'][_0x141a('0x5f')]({'where':{'id':_0x37d7c1[_0x141a('0x5d')]['id']}})[_0x141a('0x27')](handleEntityNotFound(_0x1ca562,null))[_0x141a('0x27')](function(_0x508d44){if(_0x508d44){_0x2a6d70=_0x508d44;_0x1291cf[_0x141a('0x3a')]=_['keys'](db[_0x141a('0x76')][_0x141a('0x38')]);_0x1291cf[_0x141a('0x3b')]=_[_0x141a('0x3c')](_0x37d7c1['query']);_0x1291cf['filters']=_[_0x141a('0x3d')](_0x1291cf[_0x141a('0x3a')],_0x1291cf[_0x141a('0x3b')]);_0x3f0e4b['attributes']=_[_0x141a('0x3d')](_0x1291cf[_0x141a('0x3a')],qs[_0x141a('0x3e')](_0x37d7c1[_0x141a('0x3b')][_0x141a('0x3e')]));_0x3f0e4b['attributes']=_0x3f0e4b[_0x141a('0x40')][_0x141a('0x3f')]?_0x3f0e4b[_0x141a('0x40')]:_0x1291cf['model'];_0x3f0e4b[_0x141a('0x42')]=qs[_0x141a('0x43')](_0x37d7c1['query']['sort']);_0x3f0e4b[_0x141a('0x46')]=qs['filters'](_[_0x141a('0x44')](_0x37d7c1[_0x141a('0x3b')],_0x1291cf[_0x141a('0x45')]));if(_0x37d7c1[_0x141a('0x3b')][_0x141a('0x2d')]){_0x3f0e4b[_0x141a('0x46')]=_[_0x141a('0x47')](_0x3f0e4b['where'],{'$or':_['map'](_0x3f0e4b[_0x141a('0x40')],function(_0x38a449){var _0x2e21bb={};_0x2e21bb[_0x38a449]={'$like':'%'+_0x37d7c1[_0x141a('0x3b')][_0x141a('0x2d')]+'%'};return _0x2e21bb;})});}_0x3f0e4b=_[_0x141a('0x47')]({},_0x3f0e4b,_0x37d7c1[_0x141a('0x4f')]);return _0x2a6d70[_0x141a('0x95')](_0x3f0e4b);}})['then'](function(_0x22cdbc){if(_0x22cdbc){_0x27ca0d=_0x22cdbc['length'];if(!_0x37d7c1[_0x141a('0x3b')][_0x141a('0x61')](_0x141a('0x41'))){_0x3f0e4b['limit']=qs['limit'](_0x37d7c1[_0x141a('0x3b')]['limit']);_0x3f0e4b[_0x141a('0x1f')]=qs[_0x141a('0x1f')](_0x37d7c1[_0x141a('0x3b')][_0x141a('0x1f')]);}return _0x2a6d70[_0x141a('0x95')](_0x3f0e4b);}})[_0x141a('0x27')](function(_0x36437c){return _0x36437c?{'count':_0x27ca0d,'rows':_0x36437c}:null;})[_0x141a('0x27')](respondWithResult(_0x1ca562,null))[_0x141a('0x4d')](handleError(_0x1ca562,null));};exports[_0x141a('0x96')]=function(_0x86e084,_0x5139c3,_0x2ed717){var _0x5c74b3={};var _0x19b9ba={};var _0x46c2f8;var _0x4228b8;return db['VoiceQueue'][_0x141a('0x5f')]({'where':{'id':_0x86e084['params']['id']}})[_0x141a('0x27')](handleEntityNotFound(_0x5139c3,null))[_0x141a('0x27')](function(_0x6db3b0){if(_0x6db3b0){_0x46c2f8=_0x6db3b0;_0x19b9ba[_0x141a('0x3a')]=_[_0x141a('0x3c')](db[_0x141a('0x97')][_0x141a('0x38')]);_0x19b9ba[_0x141a('0x3b')]=_[_0x141a('0x3c')](_0x86e084[_0x141a('0x3b')]);_0x19b9ba[_0x141a('0x45')]=_['intersection'](_0x19b9ba[_0x141a('0x3a')],_0x19b9ba['query']);_0x5c74b3['attributes']=_[_0x141a('0x3d')](_0x19b9ba[_0x141a('0x3a')],qs[_0x141a('0x3e')](_0x86e084[_0x141a('0x3b')][_0x141a('0x3e')]));_0x5c74b3['attributes']=_0x5c74b3[_0x141a('0x40')][_0x141a('0x3f')]?_0x5c74b3[_0x141a('0x40')]:_0x19b9ba['model'];_0x5c74b3[_0x141a('0x42')]=qs[_0x141a('0x43')](_0x86e084[_0x141a('0x3b')]['sort']);_0x5c74b3[_0x141a('0x46')]=qs['filters'](_[_0x141a('0x44')](_0x86e084[_0x141a('0x3b')],_0x19b9ba[_0x141a('0x45')]));if(_0x86e084[_0x141a('0x3b')][_0x141a('0x2d')]){_0x5c74b3['where']=_[_0x141a('0x47')](_0x5c74b3[_0x141a('0x46')],{'$or':_[_0x141a('0x36')](_0x5c74b3[_0x141a('0x40')],function(_0xb0ea11){var _0x15b285={};_0x15b285[_0xb0ea11]={'$like':'%'+_0x86e084[_0x141a('0x3b')]['filter']+'%'};return _0x15b285;})});}_0x5c74b3=_[_0x141a('0x47')]({},_0x5c74b3,_0x86e084[_0x141a('0x4f')]);return _0x46c2f8[_0x141a('0x96')](_0x5c74b3);}})[_0x141a('0x27')](function(_0x3456c5){if(_0x3456c5){_0x4228b8=_0x3456c5[_0x141a('0x3f')];if(!_0x86e084[_0x141a('0x3b')][_0x141a('0x61')]('nolimit')){_0x5c74b3[_0x141a('0x21')]=qs['limit'](_0x86e084[_0x141a('0x3b')]['limit']);_0x5c74b3[_0x141a('0x1f')]=qs['offset'](_0x86e084[_0x141a('0x3b')][_0x141a('0x1f')]);}return _0x46c2f8[_0x141a('0x96')](_0x5c74b3);}})['then'](function(_0x285f06){if(_0x285f06){return _0x285f06?{'count':_0x4228b8,'rows':_0x285f06}:null;}})[_0x141a('0x27')](respondWithResult(_0x5139c3,null))[_0x141a('0x4d')](handleError(_0x5139c3,null));};exports[_0x141a('0x98')]=function(_0x5f39aa,_0x2988c7,_0x597457){var _0x56c21e,_0x5bb0c2;return db[_0x141a('0x37')][_0x141a('0x50')]({'where':{'id':_0x5f39aa[_0x141a('0x5d')]['id']}})[_0x141a('0x27')](handleEntityNotFound(_0x2988c7,null))['then'](function(_0x175af3){if(_0x175af3){_0x5bb0c2=_0x175af3;return _0x175af3[_0x141a('0x98')](_0x5f39aa[_0x141a('0x5b')][_0x141a('0x8d')],_[_0x141a('0x5c')](_0x5f39aa['body'],['ids','id'])||{});}return null;})[_0x141a('0x92')](function(_0x181a59){var _0x2b55d5;_0x56c21e=_0x181a59||[];var _0x4c06c2=[];if(_0x181a59){for(var _0x562dc1=0x0;_0x562dc1<_0x181a59[_0x141a('0x3f')];_0x562dc1+=0x1){var _0xc667d5=_0x181a59[_0x562dc1][_0x141a('0x29')]({'plain':!![]});_0x5bb0c2[_0x141a('0x99')]=_0x5f39aa[_0x141a('0x5b')][_0x141a('0x99')]?_0x5f39aa[_0x141a('0x5b')]['dialCheckDuplicateType']:_0x5bb0c2[_0x141a('0x99')];switch(_0x5bb0c2[_0x141a('0x99')]){case _0x141a('0x9a'):_0x2b55d5=squel[_0x141a('0x9b')]()[_0x141a('0x9c')]('cm_hopper')[_0x141a('0x9d')](['phone',_0x141a('0x9e'),'ContactId',_0x141a('0x9f'),_0x141a('0x62'),'createdAt',_0x141a('0x5a')],squel[_0x141a('0x7f')]()[_0x141a('0x80')]('phone',_0x141a('0xa0'))['field'](_0x141a('0xa1'),'scheduledAt')[_0x141a('0x80')]('id','ContactId')[_0x141a('0x80')](_0xc667d5[_0x141a('0xa2')][_0x141a('0x87')](),_0x141a('0x9f'))['field'](_0x5f39aa['params']['id'][_0x141a('0x87')](),'VoiceQueueId')[_0x141a('0x80')](_0x141a('0xa1'),'createdAt')[_0x141a('0x80')](_0x141a('0xa1'),_0x141a('0x5a'))[_0x141a('0xa3')](_0x141a('0xa4'))['where'](_0x141a('0xa5'))[_0x141a('0x46')](_0x141a('0xa6'),_0xc667d5[_0x141a('0xa2')][_0x141a('0x87')]())[_0x141a('0x46')](_0x141a('0xa7'))[_0x141a('0x46')](_0x141a('0xa8'),squel[_0x141a('0x7f')]()[_0x141a('0x80')]('COALESCE(calleridnum,\x27\x27)')[_0x141a('0xa3')](_0x141a('0xa9'))[_0x141a('0x46')](_0x141a('0x84'),_0x5f39aa['params']['id'][_0x141a('0x87')]()))[_0x141a('0x46')](_0x141a('0xa8'),squel[_0x141a('0x7f')]()['field'](_0x141a('0xaa'))[_0x141a('0xa3')]('cm_hopper')[_0x141a('0x46')](_0x141a('0x84'),_0x5f39aa[_0x141a('0x5d')]['id'][_0x141a('0x87')]())))[_0x141a('0x87')]();break;case'onlyIfOpen':_0x2b55d5=squel[_0x141a('0x9b')]()[_0x141a('0x9c')](_0x141a('0xab'))['fromQuery']([_0x141a('0xa0'),_0x141a('0x9e'),'ContactId',_0x141a('0x9f'),'VoiceQueueId',_0x141a('0xac'),_0x141a('0x5a')],squel[_0x141a('0x7f')]()['field'](_0x141a('0xa0'),'phone')[_0x141a('0x80')](_0x141a('0xa1'),_0x141a('0x9e'))['field']('id','ContactId')[_0x141a('0x80')](_0xc667d5[_0x141a('0xa2')][_0x141a('0x87')](),'ListId')['field'](_0x5f39aa[_0x141a('0x5d')]['id'][_0x141a('0x87')](),'VoiceQueueId')['field'](_0x141a('0xa1'),_0x141a('0xac'))[_0x141a('0x80')]('NOW()',_0x141a('0x5a'))[_0x141a('0xa3')](_0x141a('0xa4'))[_0x141a('0x46')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0xc667d5[_0x141a('0xa2')][_0x141a('0x87')]())[_0x141a('0x46')](_0x141a('0xa7'))[_0x141a('0x46')](_0x141a('0xa8'),squel[_0x141a('0x7f')]()[_0x141a('0x80')](_0x141a('0xaa'))[_0x141a('0xa3')](_0x141a('0xab'))['where'](_0x141a('0x84'),_0x5f39aa[_0x141a('0x5d')]['id'][_0x141a('0x87')]())))['toString']();break;default:_0x2b55d5=squel[_0x141a('0x9b')]()[_0x141a('0x9c')]('cm_hopper')[_0x141a('0x9d')]([_0x141a('0xa0'),_0x141a('0x9e'),_0x141a('0xad'),_0x141a('0x9f'),_0x141a('0x62'),_0x141a('0xac'),_0x141a('0x5a')],squel[_0x141a('0x7f')]()['field'](_0x141a('0xa0'),_0x141a('0xa0'))[_0x141a('0x80')]('NOW()',_0x141a('0x9e'))[_0x141a('0x80')]('id',_0x141a('0xad'))[_0x141a('0x80')](_0xc667d5['CmListId'][_0x141a('0x87')](),_0x141a('0x9f'))[_0x141a('0x80')](_0x5f39aa[_0x141a('0x5d')]['id'][_0x141a('0x87')](),_0x141a('0x62'))['field'](_0x141a('0xa1'),_0x141a('0xac'))[_0x141a('0x80')](_0x141a('0xa1'),_0x141a('0x5a'))[_0x141a('0xa3')](_0x141a('0xa4'))['where'](_0x141a('0xa5'))[_0x141a('0x46')]('ListId\x20=\x20?',_0xc667d5[_0x141a('0xa2')]['toString']())[_0x141a('0x46')](_0x141a('0xa7')))[_0x141a('0x87')]();}_0x4c06c2[_0x141a('0x86')](db['sequelize'][_0x141a('0x3b')](_0x2b55d5));}return BPromise[_0x141a('0x8b')](_0x4c06c2);}})[_0x141a('0x27')](function(){return _0x56c21e;})[_0x141a('0x27')](respondWithResult(_0x2988c7,null))[_0x141a('0x4d')](handleError(_0x2988c7,null));};exports[_0x141a('0xae')]=function(_0x165448,_0x381241,_0x2a3684){return db[_0x141a('0x37')][_0x141a('0x50')]({'where':{'id':_0x165448[_0x141a('0x5d')]['id']}})[_0x141a('0x27')](handleEntityNotFound(_0x381241,null))[_0x141a('0x27')](function(_0x30c835){if(_0x30c835){return _0x30c835[_0x141a('0xae')](_0x165448['query']['ids']);}})[_0x141a('0x27')](function(_0x43c55f){if(_0x43c55f){return db['CmHopper'][_0x141a('0x28')]({'where':{'ListId':_0x165448[_0x141a('0x3b')]['ids'],'VoiceQueueId':_0x165448[_0x141a('0x5d')]['id']}})['then'](function(){return _0x43c55f;});}})[_0x141a('0x27')](respondWithStatusCode(_0x381241,null))[_0x141a('0x4d')](handleError(_0x381241,null));};exports[_0x141a('0xaf')]=function(_0xc7b005,_0x4ee663,_0x2ca503){var _0x1df999={};var _0x3cadf4={};var _0x352293;var _0x5418c6;return db[_0x141a('0x37')][_0x141a('0x5f')]({'where':{'id':_0xc7b005[_0x141a('0x5d')]['id']}})[_0x141a('0x27')](handleEntityNotFound(_0x4ee663,null))[_0x141a('0x27')](function(_0x56bdbb){if(_0x56bdbb){_0x352293=_0x56bdbb;_0x3cadf4[_0x141a('0x3a')]=_[_0x141a('0x3c')](db[_0x141a('0x97')][_0x141a('0x38')]);_0x3cadf4[_0x141a('0x3b')]=_[_0x141a('0x3c')](_0xc7b005[_0x141a('0x3b')]);_0x3cadf4[_0x141a('0x45')]=_['intersection'](_0x3cadf4[_0x141a('0x3a')],_0x3cadf4[_0x141a('0x3b')]);_0x1df999[_0x141a('0x40')]=_[_0x141a('0x3d')](_0x3cadf4[_0x141a('0x3a')],qs[_0x141a('0x3e')](_0xc7b005['query'][_0x141a('0x3e')]));_0x1df999[_0x141a('0x40')]=_0x1df999[_0x141a('0x40')]['length']?_0x1df999['attributes']:_0x3cadf4[_0x141a('0x3a')];_0x1df999[_0x141a('0x42')]=qs[_0x141a('0x43')](_0xc7b005['query'][_0x141a('0x43')]);_0x1df999[_0x141a('0x46')]=qs[_0x141a('0x45')](_[_0x141a('0x44')](_0xc7b005['query'],_0x3cadf4[_0x141a('0x45')]));if(_0xc7b005[_0x141a('0x3b')][_0x141a('0x2d')]){_0x1df999[_0x141a('0x46')]=_[_0x141a('0x47')](_0x1df999['where'],{'$or':_[_0x141a('0x36')](_0x1df999[_0x141a('0x40')],function(_0x4ec8ea){var _0x19f16f={};_0x19f16f[_0x4ec8ea]={'$like':'%'+_0xc7b005[_0x141a('0x3b')][_0x141a('0x2d')]+'%'};return _0x19f16f;})});}_0x1df999=_[_0x141a('0x47')]({},_0x1df999,_0xc7b005[_0x141a('0x4f')]);return _0x352293[_0x141a('0xaf')](_0x1df999);}})[_0x141a('0x27')](function(_0x140a96){if(_0x140a96){_0x5418c6=_0x140a96[_0x141a('0x3f')];if(!_0xc7b005['query'][_0x141a('0x61')](_0x141a('0x41'))){_0x1df999[_0x141a('0x21')]=qs[_0x141a('0x21')](_0xc7b005[_0x141a('0x3b')][_0x141a('0x21')]);_0x1df999[_0x141a('0x1f')]=qs[_0x141a('0x1f')](_0xc7b005['query']['offset']);}return _0x352293['getBlackLists'](_0x1df999);}})[_0x141a('0x27')](function(_0x4bb49b){if(_0x4bb49b){return _0x4bb49b?{'count':_0x5418c6,'rows':_0x4bb49b}:null;}})[_0x141a('0x27')](respondWithResult(_0x4ee663,null))[_0x141a('0x4d')](handleError(_0x4ee663,null));};exports[_0x141a('0xb0')]=function(_0x23c944,_0x332f73,_0x27a334){var _0x4eb965,_0x3b7d37;return db['VoiceQueue']['find']({'where':{'id':_0x23c944[_0x141a('0x5d')]['id']}})[_0x141a('0x27')](handleEntityNotFound(_0x332f73,null))[_0x141a('0x27')](function(_0x4f2f12){if(_0x4f2f12){_0x3b7d37=_0x4f2f12;return _0x4f2f12['addBlackLists'](_0x23c944[_0x141a('0x5b')][_0x141a('0x8d')],_[_0x141a('0x5c')](_0x23c944[_0x141a('0x5b')],['ids','id'])||{});}return null;})[_0x141a('0x92')](function(_0x5c5fe5){var _0x280c8c;_0x4eb965=_0x5c5fe5||[];var _0x128f7e=[];if(_0x5c5fe5){for(var _0x4330a0=0x0;_0x4330a0<_0x5c5fe5[_0x141a('0x3f')];_0x4330a0+=0x1){var _0x5f1d53=_0x5c5fe5[_0x4330a0][_0x141a('0x29')]({'plain':!![]});_0x280c8c=squel[_0x141a('0x9b')]()[_0x141a('0x9c')](_0x141a('0xb1'))[_0x141a('0x9d')](['phone',_0x141a('0xad'),_0x141a('0x9f'),_0x141a('0x62'),_0x141a('0xac'),_0x141a('0x5a')],squel[_0x141a('0x7f')]()[_0x141a('0x80')](_0x141a('0xa0'),_0x141a('0xa0'))[_0x141a('0x80')]('id',_0x141a('0xad'))[_0x141a('0x80')](_0x5f1d53['CmListId'][_0x141a('0x87')](),'ListId')[_0x141a('0x80')](_0x23c944['params']['id']['toString'](),_0x141a('0x62'))[_0x141a('0x80')](_0x141a('0xa1'),'createdAt')[_0x141a('0x80')](_0x141a('0xa1'),_0x141a('0x5a'))[_0x141a('0xa3')](_0x141a('0xa4'))[_0x141a('0x46')](_0x141a('0xa5'))[_0x141a('0x46')](_0x141a('0xa6'),_0x5f1d53[_0x141a('0xa2')][_0x141a('0x87')]())['where'](_0x141a('0xa7')))[_0x141a('0x87')]();_0x128f7e['push'](db[_0x141a('0x6f')][_0x141a('0x3b')](_0x280c8c));}return BPromise[_0x141a('0x8b')](_0x128f7e);}})[_0x141a('0x27')](function(){return _0x4eb965;})['then'](respondWithResult(_0x332f73,null))['catch'](handleError(_0x332f73,null));};exports[_0x141a('0xb2')]=function(_0x47d59f,_0x23b232,_0x41cc71){return db[_0x141a('0x37')][_0x141a('0x50')]({'where':{'id':_0x47d59f['params']['id']}})[_0x141a('0x27')](handleEntityNotFound(_0x23b232,null))[_0x141a('0x27')](function(_0x14dbba){if(_0x14dbba){return _0x14dbba[_0x141a('0xb2')](_0x47d59f[_0x141a('0x3b')]['ids']);}})[_0x141a('0x27')](function(_0x3ca2f8){if(_0x3ca2f8){return db[_0x141a('0x66')][_0x141a('0x28')]({'where':{'ListId':_0x47d59f[_0x141a('0x3b')][_0x141a('0x8d')],'VoiceQueueId':_0x47d59f[_0x141a('0x5d')]['id']}})[_0x141a('0x27')](function(){return _0x3ca2f8;});}})['then'](respondWithStatusCode(_0x23b232,null))[_0x141a('0x4d')](handleError(_0x23b232,null));}; \ No newline at end of file +var _0x0b62=['removeTeams','ids','select','field','from','team_has_voice_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','includes','compact','isEmpty','addAgents','spread','User','removeAgents','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','ListId\x20=\x20?','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','value','find','destroy','error','stack','name','send','index','VoiceQueue','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','role','UserProfileSection','userProfileId','autoAssociation','getHoppers','CmHopper','VoiceQueueId','getHopperHistories','findOne','CmHopperHistory','CmHopperFinal','hasOwnProperty','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','online','voicePause','flatMap','Agents','forEach','sequelize','transaction','TeamVoiceQueue','upsert','penalty','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','interface','format','SIP/%s','emit','userVoiceQueue:save'];(function(_0x1a33de,_0x59ed11){var _0x43afb5=function(_0xd4ce91){while(--_0xd4ce91){_0x1a33de['push'](_0x1a33de['shift']());}};_0x43afb5(++_0x59ed11);}(_0x0b62,0xe8));var _0x20b6=function(_0x599882,_0x94217a){_0x599882=_0x599882-0x0;var _0x598291=_0x0b62[_0x599882];return _0x598291;};'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(_0x20b6('0x0'));var moment=require(_0x20b6('0x1'));var BPromise=require(_0x20b6('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x20b6('0x3'));var sox=require(_0x20b6('0x4'));var csv=require('to-csv');var ejs=require(_0x20b6('0x5'));var fs=require('fs');var fs_extra=require(_0x20b6('0x6'));var _=require(_0x20b6('0x7'));var squel=require(_0x20b6('0x8'));var crypto=require(_0x20b6('0x9'));var jsforce=require(_0x20b6('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x20b6('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x20b6('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x20b6('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x20b6('0xe'));var logger=require('../../config/logger')(_0x20b6('0xf'));var utils=require(_0x20b6('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x20b6('0x11'));var db=require(_0x20b6('0x12'))['db'];config['redis']=_[_0x20b6('0x13')](config[_0x20b6('0x14')],{'host':_0x20b6('0x15'),'port':0x18eb});var socket=require(_0x20b6('0x16'))(new Redis(config[_0x20b6('0x14')]));require(_0x20b6('0x17'))[_0x20b6('0x18')](socket);function respondWithStatusCode(_0x33bf7c,_0x4a8d9d){_0x4a8d9d=_0x4a8d9d||0xcc;return function(_0x368f7a){if(_0x368f7a){return _0x33bf7c[_0x20b6('0x19')](_0x4a8d9d);}return _0x33bf7c[_0x20b6('0x1a')](_0x4a8d9d)[_0x20b6('0x1b')]();};}function respondWithResult(_0x3134c5,_0x168ea3){_0x168ea3=_0x168ea3||0xc8;return function(_0x3ed2c9){if(_0x3ed2c9){return _0x3134c5['status'](_0x168ea3)[_0x20b6('0x1c')](_0x3ed2c9);}};}function respondWithFilteredResult(_0x17365f,_0x5f29c5){return function(_0x494599){if(_0x494599){var _0x294d98=typeof _0x5f29c5[_0x20b6('0x1d')]===_0x20b6('0x1e')&&typeof _0x5f29c5[_0x20b6('0x1f')]===_0x20b6('0x1e');var _0x5903cf=_0x494599[_0x20b6('0x20')];var _0x364ec8=_0x294d98?0x0:_0x5f29c5[_0x20b6('0x1d')];var _0x271ee0=_0x294d98?_0x494599[_0x20b6('0x20')]:_0x5f29c5[_0x20b6('0x1d')]+_0x5f29c5[_0x20b6('0x1f')];var _0x4d8caa;if(_0x271ee0>=_0x5903cf){_0x271ee0=_0x5903cf;_0x4d8caa=0xc8;}else{_0x4d8caa=0xce;}_0x17365f[_0x20b6('0x1a')](_0x4d8caa);return _0x17365f[_0x20b6('0x21')](_0x20b6('0x22'),_0x364ec8+'-'+_0x271ee0+'/'+_0x5903cf)['json'](_0x494599);}return null;};}function patchUpdates(_0x15456b){return function(_0x355256){try{jsonpatch[_0x20b6('0x23')](_0x355256,_0x15456b,!![]);}catch(_0x402f8c){return BPromise[_0x20b6('0x24')](_0x402f8c);}return _0x355256['save']();};}function saveUpdates(_0x325b86,_0x4f4ec6){return function(_0x1ce60a){if(_0x1ce60a){return _0x1ce60a[_0x20b6('0x25')](_0x325b86)[_0x20b6('0x26')](function(_0x194aaf){return _0x194aaf;});}return null;};}function removeEntity(_0x3a8889,_0x4a7014){return function(_0x811409){if(_0x811409){return _0x811409['destroy']()['then'](function(){var _0x55ec6f=_0x811409[_0x20b6('0x27')]({'plain':!![]});var _0x468b6d=[{'name':_0x20b6('0x28'),'value':_0x20b6('0x29'),'ignore':![]},{'name':_0x20b6('0x2a'),'value':_0x20b6('0x2b'),'ignore':![]}];var _0x43bb6e=_(_0x468b6d)[_0x20b6('0x2c')](_0x20b6('0x2d'))['map'](_0x20b6('0x2e'))['value']();if(_['includes'](_0x43bb6e,_0x55ec6f['type'])){return;}var _0x5b1099=_[_0x20b6('0x2f')](_0x468b6d,[_0x20b6('0x2e'),_0x55ec6f['type']])['name'];return db['UserProfileResource'][_0x20b6('0x30')]({'where':{'type':_0x5b1099,'resourceId':_0x55ec6f['id']}})[_0x20b6('0x26')](function(){return _0x811409;});})[_0x20b6('0x26')](function(){_0x3a8889[_0x20b6('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13eb13,_0x580beb){return function(_0x33d72f){if(!_0x33d72f){_0x13eb13[_0x20b6('0x19')](0x194);}return _0x33d72f;};}function handleError(_0x4e86d3,_0x147b6f){_0x147b6f=_0x147b6f||0x1f4;return function(_0x151f5f){logger[_0x20b6('0x31')](_0x151f5f[_0x20b6('0x32')]);if(_0x151f5f[_0x20b6('0x33')]){delete _0x151f5f[_0x20b6('0x33')];}_0x4e86d3[_0x20b6('0x1a')](_0x147b6f)[_0x20b6('0x34')](_0x151f5f);};}exports[_0x20b6('0x35')]=function(_0x27ce84,_0x4c958c){var _0x3dbe31={},_0x386e8d={},_0x823bdc={'count':0x0,'rows':[]};var _0x1f3719=_['map'](db[_0x20b6('0x36')][_0x20b6('0x37')],function(_0x47bd7c){return{'name':_0x47bd7c[_0x20b6('0x38')],'type':_0x47bd7c[_0x20b6('0x39')][_0x20b6('0x3a')]};});_0x386e8d['model']=_['map'](_0x1f3719,_0x20b6('0x33'));_0x386e8d['query']=_[_0x20b6('0x3b')](_0x27ce84[_0x20b6('0x3c')]);_0x386e8d[_0x20b6('0x3d')]=_[_0x20b6('0x3e')](_0x386e8d[_0x20b6('0x3f')],_0x386e8d[_0x20b6('0x3c')]);_0x3dbe31[_0x20b6('0x40')]=_[_0x20b6('0x3e')](_0x386e8d[_0x20b6('0x3f')],qs[_0x20b6('0x41')](_0x27ce84['query'][_0x20b6('0x41')]));_0x3dbe31[_0x20b6('0x40')]=_0x3dbe31[_0x20b6('0x40')][_0x20b6('0x42')]?_0x3dbe31[_0x20b6('0x40')]:_0x386e8d[_0x20b6('0x3f')];if(!_0x27ce84[_0x20b6('0x3c')]['hasOwnProperty'](_0x20b6('0x43'))){_0x3dbe31[_0x20b6('0x1f')]=qs[_0x20b6('0x1f')](_0x27ce84[_0x20b6('0x3c')]['limit']);_0x3dbe31[_0x20b6('0x1d')]=qs[_0x20b6('0x1d')](_0x27ce84[_0x20b6('0x3c')]['offset']);}_0x3dbe31[_0x20b6('0x44')]=qs[_0x20b6('0x45')](_0x27ce84[_0x20b6('0x3c')][_0x20b6('0x45')]);_0x3dbe31[_0x20b6('0x46')]=qs['filters'](_[_0x20b6('0x47')](_0x27ce84['query'],_0x386e8d[_0x20b6('0x3d')]),_0x1f3719);if(_0x27ce84[_0x20b6('0x3c')][_0x20b6('0x2c')]){_0x3dbe31[_0x20b6('0x46')]=_[_0x20b6('0x48')](_0x3dbe31[_0x20b6('0x46')],{'$or':_[_0x20b6('0x49')](_0x1f3719,function(_0x4fe69f){if(_0x4fe69f[_0x20b6('0x39')]!==_0x20b6('0x4a')){var _0x1a296f={};_0x1a296f[_0x4fe69f[_0x20b6('0x33')]]={'$like':'%'+_0x27ce84[_0x20b6('0x3c')][_0x20b6('0x2c')]+'%'};return _0x1a296f;}})});}_0x3dbe31=_[_0x20b6('0x48')]({},_0x3dbe31,_0x27ce84[_0x20b6('0x4b')]);var _0x352595={'where':_0x3dbe31[_0x20b6('0x46')]};return db[_0x20b6('0x36')][_0x20b6('0x20')](_0x352595)[_0x20b6('0x26')](function(_0x44b4b0){_0x823bdc['count']=_0x44b4b0;if(_0x27ce84[_0x20b6('0x3c')]['includeAll']){_0x3dbe31[_0x20b6('0x4c')]=[{'all':!![]}];}return db[_0x20b6('0x36')][_0x20b6('0x4d')](_0x3dbe31);})['then'](function(_0x474ec8){_0x823bdc[_0x20b6('0x4e')]=_0x474ec8;return _0x823bdc;})[_0x20b6('0x26')](respondWithFilteredResult(_0x4c958c,_0x3dbe31))[_0x20b6('0x4f')](handleError(_0x4c958c,null));};exports[_0x20b6('0x50')]=function(_0x4f037e,_0x262653){var _0x1b4cbb={'raw':![],'where':{'id':_0x4f037e[_0x20b6('0x51')]['id']}},_0x41fef9={};_0x41fef9[_0x20b6('0x3f')]=_[_0x20b6('0x3b')](db['VoiceQueue'][_0x20b6('0x37')]);_0x41fef9['query']=_[_0x20b6('0x3b')](_0x4f037e[_0x20b6('0x3c')]);_0x41fef9[_0x20b6('0x3d')]=_[_0x20b6('0x3e')](_0x41fef9[_0x20b6('0x3f')],_0x41fef9['query']);_0x1b4cbb[_0x20b6('0x40')]=_[_0x20b6('0x3e')](_0x41fef9[_0x20b6('0x3f')],qs[_0x20b6('0x41')](_0x4f037e[_0x20b6('0x3c')][_0x20b6('0x41')]));_0x1b4cbb[_0x20b6('0x40')]=_0x1b4cbb[_0x20b6('0x40')][_0x20b6('0x42')]?_0x1b4cbb[_0x20b6('0x40')]:_0x41fef9[_0x20b6('0x3f')];if(_0x4f037e['query'][_0x20b6('0x52')]){_0x1b4cbb[_0x20b6('0x4c')]=[{'all':!![]}];}_0x1b4cbb=_[_0x20b6('0x48')]({},_0x1b4cbb,_0x4f037e[_0x20b6('0x4b')]);return db[_0x20b6('0x36')][_0x20b6('0x2f')](_0x1b4cbb)[_0x20b6('0x26')](handleEntityNotFound(_0x262653,null))[_0x20b6('0x26')](respondWithResult(_0x262653,null))[_0x20b6('0x4f')](handleError(_0x262653,null));};exports[_0x20b6('0x53')]=function(_0x32cc70,_0x4cf604){return db[_0x20b6('0x36')][_0x20b6('0x53')](_0x32cc70[_0x20b6('0x54')],{})[_0x20b6('0x26')](function(_0x2dbc7d){var _0x44a5cb=_0x32cc70[_0x20b6('0x55')][_0x20b6('0x27')]({'plain':!![]});if(!_0x44a5cb)throw new Error(_0x20b6('0x56'));if(_0x44a5cb['role']==='user'){var _0x59679f=_0x2dbc7d[_0x20b6('0x27')]({'plain':!![]});var _0x48e783=[{'name':_0x20b6('0x28'),'value':_0x20b6('0x29')},{'name':_0x20b6('0x2a'),'value':_0x20b6('0x2b')}];var _0x27a8eb=_[_0x20b6('0x2f')](_0x48e783,[_0x20b6('0x2e'),_0x59679f[_0x20b6('0x39')]])[_0x20b6('0x33')];return db['UserProfileSection'][_0x20b6('0x2f')]({'where':{'name':_0x27a8eb,'userProfileId':_0x44a5cb['userProfileId']},'raw':!![]})[_0x20b6('0x26')](function(_0x437b19){if(_0x437b19&&_0x437b19['autoAssociation']===0x0){return db[_0x20b6('0x57')][_0x20b6('0x53')]({'name':_0x59679f[_0x20b6('0x33')],'resourceId':_0x59679f['id'],'type':_0x437b19['name'],'sectionId':_0x437b19['id']},{})[_0x20b6('0x26')](function(){return _0x2dbc7d;});}else{return _0x2dbc7d;}})[_0x20b6('0x4f')](function(_0xda8a18){logger['error'](_0x20b6('0x58'),_0xda8a18);throw _0xda8a18;});}return _0x2dbc7d;})['then'](respondWithResult(_0x4cf604,0xc9))[_0x20b6('0x4f')](handleError(_0x4cf604,null));};exports['clone']=function(_0x5846f1,_0xf24ee3){var _0x48ee72={'where':{'id':_0x5846f1[_0x20b6('0x51')]['id']}},_0xf11e={};_0xf11e[_0x20b6('0x3f')]=_[_0x20b6('0x3b')](db[_0x20b6('0x36')]['rawAttributes']);_0x48ee72['attributes']=_[_0x20b6('0x3e')](_0xf11e[_0x20b6('0x3f')],qs[_0x20b6('0x41')](_0x5846f1[_0x20b6('0x3c')][_0x20b6('0x41')]));_0x48ee72[_0x20b6('0x40')]=_0x48ee72[_0x20b6('0x40')][_0x20b6('0x42')]?_0x48ee72[_0x20b6('0x40')]:_0xf11e[_0x20b6('0x3f')];if(_0x5846f1[_0x20b6('0x3c')]['includeAll']){_0x48ee72[_0x20b6('0x4c')]=[{'all':!![]}];}_0x48ee72=_['merge']({},_0x48ee72,_0x5846f1[_0x20b6('0x4b')]);return db[_0x20b6('0x36')]['find'](_0x48ee72)[_0x20b6('0x26')](handleEntityNotFound(_0xf24ee3,null))[_0x20b6('0x26')](function(_0x3d1835){if(_0x3d1835){var _0x33ae81=_0x3d1835[_0x20b6('0x27')]({'plain':!![]});_0x33ae81=qs[_0x20b6('0x59')](_0x33ae81,['id',_0x20b6('0x5a'),_0x20b6('0x5b')]);_0x5846f1['body']=_[_0x20b6('0x59')](_0x5846f1['body'],['id',_0x20b6('0x5a'),_0x20b6('0x5b')]);return db[_0x20b6('0x36')][_0x20b6('0x53')](_[_0x20b6('0x48')](_0x33ae81,_0x5846f1[_0x20b6('0x54')]),{'include':_0x5846f1['query'][_0x20b6('0x52')]?[{'all':!![]}]:undefined})[_0x20b6('0x26')](function(_0x28f843){var _0x3dde5c=_0x5846f1[_0x20b6('0x55')][_0x20b6('0x27')]({'plain':!![]});if(!_0x3dde5c)throw new Error(_0x20b6('0x56'));if(_0x3dde5c[_0x20b6('0x5c')]===_0x20b6('0x55')){var _0x5259dd=_0x28f843[_0x20b6('0x27')]({'plain':!![]});var _0x36c1db=[{'name':_0x20b6('0x28'),'value':_0x20b6('0x29')},{'name':_0x20b6('0x2a'),'value':_0x20b6('0x2b')}];var _0xe3de8b=_[_0x20b6('0x2f')](_0x36c1db,[_0x20b6('0x2e'),_0x5259dd[_0x20b6('0x39')]])['name'];return db[_0x20b6('0x5d')][_0x20b6('0x2f')]({'where':{'name':_0xe3de8b,'userProfileId':_0x3dde5c[_0x20b6('0x5e')]},'raw':!![]})['then'](function(_0x5091ef){if(_0x5091ef&&_0x5091ef[_0x20b6('0x5f')]===0x0){return db[_0x20b6('0x57')]['create']({'name':_0x5259dd[_0x20b6('0x33')],'resourceId':_0x5259dd['id'],'type':_0x5091ef['name'],'sectionId':_0x5091ef['id']},{})[_0x20b6('0x26')](function(){return _0x28f843;});}else{return _0x28f843;}})[_0x20b6('0x4f')](function(_0x56eb50){logger[_0x20b6('0x31')](_0x20b6('0x58'),_0x56eb50);throw _0x56eb50;});}return _0x28f843;});}})['then'](respondWithResult(_0xf24ee3,0xc9))[_0x20b6('0x4f')](handleError(_0xf24ee3,null));};exports[_0x20b6('0x25')]=function(_0x4fd316,_0x119a33){if(_0x4fd316[_0x20b6('0x54')]['id']){delete _0x4fd316[_0x20b6('0x54')]['id'];}return db[_0x20b6('0x36')][_0x20b6('0x2f')]({'where':{'id':_0x4fd316[_0x20b6('0x51')]['id']}})[_0x20b6('0x26')](handleEntityNotFound(_0x119a33,null))[_0x20b6('0x26')](saveUpdates(_0x4fd316[_0x20b6('0x54')],null))[_0x20b6('0x26')](respondWithResult(_0x119a33,null))[_0x20b6('0x4f')](handleError(_0x119a33,null));};exports['destroy']=function(_0x2761c3,_0xc899aa){return db['VoiceQueue'][_0x20b6('0x2f')]({'where':{'id':_0x2761c3[_0x20b6('0x51')]['id']}})[_0x20b6('0x26')](handleEntityNotFound(_0xc899aa,null))[_0x20b6('0x26')](removeEntity(_0xc899aa,null))['catch'](handleError(_0xc899aa,null));};exports[_0x20b6('0x60')]=function(_0x405228,_0x1a0d98,_0x4f4507){var _0x4c240b={'raw':![],'where':{}};var _0x1b01d6={};var _0x326102={'count':0x0,'rows':[]};return db[_0x20b6('0x36')]['findOne']({'where':{'id':_0x405228[_0x20b6('0x51')]['id']}})[_0x20b6('0x26')](handleEntityNotFound(_0x1a0d98,null))[_0x20b6('0x26')](function(_0x2120a5){if(_0x2120a5){_0x1b01d6[_0x20b6('0x3f')]=_['keys'](db[_0x20b6('0x61')][_0x20b6('0x37')]);_0x1b01d6[_0x20b6('0x3c')]=_[_0x20b6('0x3b')](_0x405228['query']);_0x1b01d6[_0x20b6('0x3d')]=_[_0x20b6('0x3e')](_0x1b01d6[_0x20b6('0x3f')],_0x1b01d6['query']);_0x4c240b[_0x20b6('0x40')]=_[_0x20b6('0x3e')](_0x1b01d6[_0x20b6('0x3f')],qs['fields'](_0x405228[_0x20b6('0x3c')][_0x20b6('0x41')]));_0x4c240b[_0x20b6('0x40')]=_0x4c240b[_0x20b6('0x40')][_0x20b6('0x42')]?_0x4c240b[_0x20b6('0x40')]:_0x1b01d6[_0x20b6('0x3f')];if(!_0x405228[_0x20b6('0x3c')]['hasOwnProperty'](_0x20b6('0x43'))){_0x4c240b[_0x20b6('0x1f')]=qs[_0x20b6('0x1f')](_0x405228['query']['limit']);_0x4c240b[_0x20b6('0x1d')]=qs[_0x20b6('0x1d')](_0x405228[_0x20b6('0x3c')][_0x20b6('0x1d')]);}_0x4c240b[_0x20b6('0x44')]=qs[_0x20b6('0x45')](_0x405228[_0x20b6('0x3c')][_0x20b6('0x45')]);_0x4c240b[_0x20b6('0x46')]=qs['filters'](_[_0x20b6('0x47')](_0x405228[_0x20b6('0x3c')],_0x1b01d6[_0x20b6('0x3d')]));_0x4c240b[_0x20b6('0x46')][_0x20b6('0x62')]=_0x2120a5['id'];if(_0x405228[_0x20b6('0x3c')]['filter']){_0x4c240b[_0x20b6('0x46')]=_[_0x20b6('0x48')](_0x4c240b[_0x20b6('0x46')],{'$or':_[_0x20b6('0x49')](_0x4c240b[_0x20b6('0x40')],function(_0x17f0dd){var _0x3f62b5={};_0x3f62b5[_0x17f0dd]={'$like':'%'+_0x405228[_0x20b6('0x3c')][_0x20b6('0x2c')]+'%'};return _0x3f62b5;})});}_0x4c240b=_[_0x20b6('0x48')]({},_0x4c240b,_0x405228[_0x20b6('0x4b')]);return db[_0x20b6('0x61')]['count']({'where':_0x4c240b[_0x20b6('0x46')]})[_0x20b6('0x26')](function(_0xed7ed5){_0x326102[_0x20b6('0x20')]=_0xed7ed5;if(_0x405228[_0x20b6('0x3c')]['includeAll']){_0x4c240b[_0x20b6('0x4c')]=[{'all':!![]}];}return db[_0x20b6('0x61')][_0x20b6('0x4d')](_0x4c240b);})['then'](function(_0x399146){_0x326102['rows']=_0x399146;return _0x326102;});}})[_0x20b6('0x26')](respondWithFilteredResult(_0x1a0d98,_0x4c240b))[_0x20b6('0x4f')](handleError(_0x1a0d98,null));};exports[_0x20b6('0x63')]=function(_0x38f5f7,_0x5b684e,_0x5b89f1){var _0x162e6a={'raw':!![],'where':{}};var _0x1495f2={};var _0x22492f={'count':0x0,'rows':[]};return db[_0x20b6('0x36')][_0x20b6('0x64')]({'where':{'id':_0x38f5f7[_0x20b6('0x51')]['id']}})[_0x20b6('0x26')](handleEntityNotFound(_0x5b684e,null))['then'](function(_0x1d0aa4){if(_0x1d0aa4){_0x1495f2[_0x20b6('0x3f')]=_[_0x20b6('0x3b')](db['CmHopperHistory'][_0x20b6('0x37')]);_0x1495f2[_0x20b6('0x3c')]=_[_0x20b6('0x3b')](_0x38f5f7['query']);_0x1495f2[_0x20b6('0x3d')]=_['intersection'](_0x1495f2[_0x20b6('0x3f')],_0x1495f2[_0x20b6('0x3c')]);_0x162e6a[_0x20b6('0x40')]=_[_0x20b6('0x3e')](_0x1495f2[_0x20b6('0x3f')],qs[_0x20b6('0x41')](_0x38f5f7[_0x20b6('0x3c')]['fields']));_0x162e6a[_0x20b6('0x40')]=_0x162e6a['attributes'][_0x20b6('0x42')]?_0x162e6a['attributes']:_0x1495f2[_0x20b6('0x3f')];if(!_0x38f5f7['query']['hasOwnProperty'](_0x20b6('0x43'))){_0x162e6a[_0x20b6('0x1f')]=qs[_0x20b6('0x1f')](_0x38f5f7[_0x20b6('0x3c')][_0x20b6('0x1f')]);_0x162e6a[_0x20b6('0x1d')]=qs[_0x20b6('0x1d')](_0x38f5f7[_0x20b6('0x3c')][_0x20b6('0x1d')]);}_0x162e6a['order']=qs[_0x20b6('0x45')](_0x38f5f7[_0x20b6('0x3c')][_0x20b6('0x45')]);_0x162e6a[_0x20b6('0x46')]=qs[_0x20b6('0x3d')](_[_0x20b6('0x47')](_0x38f5f7[_0x20b6('0x3c')],_0x1495f2[_0x20b6('0x3d')]));_0x162e6a[_0x20b6('0x46')][_0x20b6('0x62')]=_0x1d0aa4['id'];if(_0x38f5f7['query'][_0x20b6('0x2c')]){_0x162e6a[_0x20b6('0x46')]=_[_0x20b6('0x48')](_0x162e6a[_0x20b6('0x46')],{'$or':_[_0x20b6('0x49')](_0x162e6a[_0x20b6('0x40')],function(_0x283e72){var _0x3ea37f={};_0x3ea37f[_0x283e72]={'$like':'%'+_0x38f5f7['query'][_0x20b6('0x2c')]+'%'};return _0x3ea37f;})});}_0x162e6a=_['merge']({},_0x162e6a,_0x38f5f7[_0x20b6('0x4b')]);return db[_0x20b6('0x65')][_0x20b6('0x20')]({'where':_0x162e6a[_0x20b6('0x46')]})['then'](function(_0x3e2fee){_0x22492f[_0x20b6('0x20')]=_0x3e2fee;if(_0x38f5f7['query'][_0x20b6('0x52')]){_0x162e6a['include']=[{'all':!![]}];}return db[_0x20b6('0x65')][_0x20b6('0x4d')](_0x162e6a);})[_0x20b6('0x26')](function(_0x32e47e){_0x22492f[_0x20b6('0x4e')]=_0x32e47e;return _0x22492f;});}})[_0x20b6('0x26')](respondWithFilteredResult(_0x5b684e,_0x162e6a))[_0x20b6('0x4f')](handleError(_0x5b684e,null));};exports['getHopperFinals']=function(_0x4618ad,_0x545cde,_0x48bda4){var _0x2f56c5={'raw':!![],'where':{}};var _0x3865d2={};var _0x364226={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x20b6('0x64')]({'where':{'id':_0x4618ad['params']['id']}})[_0x20b6('0x26')](handleEntityNotFound(_0x545cde,null))[_0x20b6('0x26')](function(_0x52a733){if(_0x52a733){_0x3865d2[_0x20b6('0x3f')]=_[_0x20b6('0x3b')](db[_0x20b6('0x66')][_0x20b6('0x37')]);_0x3865d2[_0x20b6('0x3c')]=_['keys'](_0x4618ad[_0x20b6('0x3c')]);_0x3865d2[_0x20b6('0x3d')]=_[_0x20b6('0x3e')](_0x3865d2[_0x20b6('0x3f')],_0x3865d2[_0x20b6('0x3c')]);_0x2f56c5[_0x20b6('0x40')]=_[_0x20b6('0x3e')](_0x3865d2[_0x20b6('0x3f')],qs['fields'](_0x4618ad['query'][_0x20b6('0x41')]));_0x2f56c5[_0x20b6('0x40')]=_0x2f56c5[_0x20b6('0x40')][_0x20b6('0x42')]?_0x2f56c5[_0x20b6('0x40')]:_0x3865d2['model'];if(!_0x4618ad[_0x20b6('0x3c')][_0x20b6('0x67')](_0x20b6('0x43'))){_0x2f56c5[_0x20b6('0x1f')]=qs[_0x20b6('0x1f')](_0x4618ad[_0x20b6('0x3c')][_0x20b6('0x1f')]);_0x2f56c5[_0x20b6('0x1d')]=qs[_0x20b6('0x1d')](_0x4618ad[_0x20b6('0x3c')][_0x20b6('0x1d')]);}_0x2f56c5[_0x20b6('0x44')]=qs[_0x20b6('0x45')](_0x4618ad[_0x20b6('0x3c')][_0x20b6('0x45')]);_0x2f56c5[_0x20b6('0x46')]=qs[_0x20b6('0x3d')](_[_0x20b6('0x47')](_0x4618ad['query'],_0x3865d2[_0x20b6('0x3d')]));_0x2f56c5[_0x20b6('0x46')][_0x20b6('0x62')]=_0x52a733['id'];if(_0x4618ad[_0x20b6('0x3c')][_0x20b6('0x2c')]){_0x2f56c5['where']=_[_0x20b6('0x48')](_0x2f56c5[_0x20b6('0x46')],{'$or':_[_0x20b6('0x49')](_0x2f56c5[_0x20b6('0x40')],function(_0x13ecdd){var _0x34a015={};_0x34a015[_0x13ecdd]={'$like':'%'+_0x4618ad['query']['filter']+'%'};return _0x34a015;})});}_0x2f56c5=_[_0x20b6('0x48')]({},_0x2f56c5,_0x4618ad[_0x20b6('0x4b')]);return db[_0x20b6('0x66')][_0x20b6('0x20')]({'where':_0x2f56c5[_0x20b6('0x46')]})[_0x20b6('0x26')](function(_0x5e1ff4){_0x364226['count']=_0x5e1ff4;if(_0x4618ad['query']['includeAll']){_0x2f56c5[_0x20b6('0x4c')]=[{'all':!![]}];}return db[_0x20b6('0x66')][_0x20b6('0x4d')](_0x2f56c5);})[_0x20b6('0x26')](function(_0x699621){_0x364226[_0x20b6('0x4e')]=_0x699621;return _0x364226;});}})[_0x20b6('0x26')](respondWithFilteredResult(_0x545cde,_0x2f56c5))['catch'](handleError(_0x545cde,null));};exports[_0x20b6('0x68')]=function(_0x2dc612,_0x1c5abc,_0x1db7fc){var _0x237797={'raw':!![],'where':{}};var _0x3f521e={};var _0x251e4f={'count':0x0,'rows':[]};return db[_0x20b6('0x36')][_0x20b6('0x64')]({'where':{'id':_0x2dc612[_0x20b6('0x51')]['id']}})['then'](handleEntityNotFound(_0x1c5abc,null))['then'](function(_0x4459c8){if(_0x4459c8){_0x3f521e['model']=_[_0x20b6('0x3b')](db[_0x20b6('0x69')][_0x20b6('0x37')]);_0x3f521e[_0x20b6('0x3c')]=_[_0x20b6('0x3b')](_0x2dc612[_0x20b6('0x3c')]);_0x3f521e[_0x20b6('0x3d')]=_[_0x20b6('0x3e')](_0x3f521e[_0x20b6('0x3f')],_0x3f521e['query']);_0x237797['attributes']=_[_0x20b6('0x3e')](_0x3f521e[_0x20b6('0x3f')],qs['fields'](_0x2dc612[_0x20b6('0x3c')][_0x20b6('0x41')]));_0x237797[_0x20b6('0x40')]=_0x237797[_0x20b6('0x40')][_0x20b6('0x42')]?_0x237797[_0x20b6('0x40')]:_0x3f521e[_0x20b6('0x3f')];if(!_0x2dc612[_0x20b6('0x3c')]['hasOwnProperty'](_0x20b6('0x43'))){_0x237797[_0x20b6('0x1f')]=qs['limit'](_0x2dc612[_0x20b6('0x3c')][_0x20b6('0x1f')]);_0x237797[_0x20b6('0x1d')]=qs[_0x20b6('0x1d')](_0x2dc612['query'][_0x20b6('0x1d')]);}_0x237797[_0x20b6('0x44')]=qs[_0x20b6('0x45')](_0x2dc612[_0x20b6('0x3c')][_0x20b6('0x45')]);_0x237797[_0x20b6('0x46')]=qs[_0x20b6('0x3d')](_['pick'](_0x2dc612[_0x20b6('0x3c')],_0x3f521e[_0x20b6('0x3d')]));_0x237797[_0x20b6('0x46')][_0x20b6('0x62')]=_0x4459c8['id'];if(_0x2dc612['query']['filter']){_0x237797[_0x20b6('0x46')]=_['merge'](_0x237797[_0x20b6('0x46')],{'$or':_['map'](_0x237797[_0x20b6('0x40')],function(_0x549aa2){var _0x14e7c1={};_0x14e7c1[_0x549aa2]={'$like':'%'+_0x2dc612['query'][_0x20b6('0x2c')]+'%'};return _0x14e7c1;})});}_0x237797=_[_0x20b6('0x48')]({},_0x237797,_0x2dc612[_0x20b6('0x4b')]);return db[_0x20b6('0x69')][_0x20b6('0x20')]({'where':_0x237797[_0x20b6('0x46')]})[_0x20b6('0x26')](function(_0x3cc04f){_0x251e4f[_0x20b6('0x20')]=_0x3cc04f;if(_0x2dc612['query'][_0x20b6('0x52')]){_0x237797['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x20b6('0x4d')](_0x237797);})[_0x20b6('0x26')](function(_0x4ff931){_0x251e4f[_0x20b6('0x4e')]=_0x4ff931;return _0x251e4f;});}})['then'](respondWithFilteredResult(_0x1c5abc,_0x237797))[_0x20b6('0x4f')](handleError(_0x1c5abc,null));};exports[_0x20b6('0x6a')]=function(_0x268d9f,_0x16927b,_0x1a30fd){var _0x25bace={};var _0x5cb457={};var _0x4d809c;var _0xb603bc;return db['VoiceQueue'][_0x20b6('0x64')]({'where':{'id':_0x268d9f[_0x20b6('0x51')]['id']}})[_0x20b6('0x26')](handleEntityNotFound(_0x16927b,null))[_0x20b6('0x26')](function(_0xbd05eb){if(_0xbd05eb){_0x4d809c=_0xbd05eb;_0x5cb457['model']=_[_0x20b6('0x3b')](db['Team']['rawAttributes']);_0x5cb457[_0x20b6('0x3c')]=_[_0x20b6('0x3b')](_0x268d9f[_0x20b6('0x3c')]);_0x5cb457[_0x20b6('0x3d')]=_[_0x20b6('0x3e')](_0x5cb457['model'],_0x5cb457[_0x20b6('0x3c')]);_0x25bace[_0x20b6('0x40')]=_[_0x20b6('0x3e')](_0x5cb457[_0x20b6('0x3f')],qs['fields'](_0x268d9f[_0x20b6('0x3c')][_0x20b6('0x41')]));_0x25bace['attributes']=_0x25bace[_0x20b6('0x40')][_0x20b6('0x42')]?_0x25bace[_0x20b6('0x40')]:_0x5cb457[_0x20b6('0x3f')];_0x25bace[_0x20b6('0x44')]=qs[_0x20b6('0x45')](_0x268d9f[_0x20b6('0x3c')][_0x20b6('0x45')]);_0x25bace['where']=qs[_0x20b6('0x3d')](_[_0x20b6('0x47')](_0x268d9f[_0x20b6('0x3c')],_0x5cb457[_0x20b6('0x3d')]));if(_0x268d9f['query'][_0x20b6('0x2c')]){_0x25bace[_0x20b6('0x46')]=_[_0x20b6('0x48')](_0x25bace['where'],{'$or':_[_0x20b6('0x49')](_0x25bace[_0x20b6('0x40')],function(_0x33a2f0){var _0x2bb322={};_0x2bb322[_0x33a2f0]={'$like':'%'+_0x268d9f[_0x20b6('0x3c')][_0x20b6('0x2c')]+'%'};return _0x2bb322;})});}_0x25bace=_[_0x20b6('0x48')]({},_0x25bace,_0x268d9f[_0x20b6('0x4b')]);return _0x4d809c['getTeams'](_0x25bace);}})[_0x20b6('0x26')](function(_0x39a343){if(_0x39a343){_0xb603bc=_0x39a343[_0x20b6('0x42')];if(!_0x268d9f[_0x20b6('0x3c')][_0x20b6('0x67')](_0x20b6('0x43'))){_0x25bace[_0x20b6('0x1f')]=qs[_0x20b6('0x1f')](_0x268d9f[_0x20b6('0x3c')][_0x20b6('0x1f')]);_0x25bace[_0x20b6('0x1d')]=qs[_0x20b6('0x1d')](_0x268d9f[_0x20b6('0x3c')][_0x20b6('0x1d')]);}return _0x4d809c[_0x20b6('0x6a')](_0x25bace);}})['then'](function(_0xf6916e){if(_0xf6916e){return _0xf6916e?{'count':_0xb603bc,'rows':_0xf6916e}:null;}})[_0x20b6('0x26')](respondWithResult(_0x16927b,null))[_0x20b6('0x4f')](handleError(_0x16927b,null));};exports[_0x20b6('0x6b')]=function(_0x12abd8,_0x4ec731,_0x159a61){var _0x1b87a6=_0x12abd8['body'][_0x20b6('0x6c')];var _0x4b632a=_['map'](_0x1b87a6,'id');return db[_0x20b6('0x6d')][_0x20b6('0x4d')]({'where':{'id':_0x4b632a},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x20b6('0x33'),_0x20b6('0x6e'),_0x20b6('0x6f'),'interface'],'raw':!![]}]})[_0x20b6('0x26')](function(_0x4916e4){if(_0x4916e4){var _0x3d8cfd=_[_0x20b6('0x70')](_0x4916e4,function(_0x13832d){var _0xc9ed53=_0x13832d[_0x20b6('0x27')]({'plain':!![]});_0xc9ed53[_0x20b6('0x71')][_0x20b6('0x72')](function(_0x55f429){_0x55f429['penalty']=_[_0x20b6('0x2f')](_0x1b87a6,{'id':_0xc9ed53['id']})['penalty'];});return _0xc9ed53[_0x20b6('0x71')];});return db[_0x20b6('0x36')][_0x20b6('0x2f')]({'where':{'id':_0x12abd8['params']['id']}})[_0x20b6('0x26')](function(_0x35b79e){return db[_0x20b6('0x73')][_0x20b6('0x74')](function(_0x58ebbe){return _0x35b79e['addTeams'](_0x4b632a,{'transaction':_0x58ebbe})[_0x20b6('0x26')](function(){return BPromise['each'](_0x1b87a6,function(_0x5b8e28){return db[_0x20b6('0x75')][_0x20b6('0x76')]({'TeamId':_0x5b8e28['id'],'VoiceQueueId':_0x12abd8[_0x20b6('0x51')]['id'],'penalty':_0x5b8e28[_0x20b6('0x77')]},{'transaction':_0x58ebbe});});})[_0x20b6('0x26')](function(){return BPromise[_0x20b6('0x78')](_0x3d8cfd,function(_0x28a68d){return db[_0x20b6('0x79')][_0x20b6('0x7a')]({'where':{'UserId':_0x28a68d['id'],'VoiceQueueId':_0x12abd8[_0x20b6('0x51')]['id']},'defaults':{'penalty':_0x28a68d[_0x20b6('0x77')]},'transaction':_0x58ebbe});});})['then'](function(){return BPromise[_0x20b6('0x78')](_[_0x20b6('0x2c')](_0x3d8cfd,{'online':!![]}),function(_0x168bd6){return db[_0x20b6('0x7b')]['upsert']({'membername':_0x168bd6[_0x20b6('0x33')],'UserId':_0x168bd6['id'],'queue_name':_0x35b79e['name'],'VoiceQueueId':_0x35b79e['id'],'interface':_[_0x20b6('0x7c')](_0x168bd6[_0x20b6('0x7d')])?util[_0x20b6('0x7e')](_0x20b6('0x7f'),_0x168bd6[_0x20b6('0x33')]):_0x168bd6['interface'],'paused':_0x168bd6[_0x20b6('0x6f')]||![],'penalty':_0x168bd6[_0x20b6('0x77')]},{'transaction':_0x58ebbe});});})[_0x20b6('0x26')](function(){_0x3d8cfd['forEach'](function(_0x4d6e33){socket[_0x20b6('0x80')](_0x20b6('0x81'),{'UserId':_0x4d6e33['id'],'VoiceQueueId':_0x35b79e['id']});});});});});}})['then'](respondWithStatusCode(_0x4ec731,null))[_0x20b6('0x4f')](handleError(_0x4ec731,null));};exports[_0x20b6('0x82')]=function(_0x1d24ea,_0x3b23f,_0x159042){return db[_0x20b6('0x6d')][_0x20b6('0x4d')]({'where':{'id':_0x1d24ea['query'][_0x20b6('0x83')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x20b6('0x71'),'attributes':['id'],'raw':!![]}]})[_0x20b6('0x26')](handleEntityNotFound(_0x3b23f,null))[_0x20b6('0x26')](function(_0x5b3d16){var _0x21ee71=_[_0x20b6('0x49')](_0x5b3d16,'id');var _0x1bb515=[];var _0x1ed189=[];var _0x466306=squel[_0x20b6('0x84')]();_0x466306[_0x20b6('0x85')]('tq.TeamId')[_0x20b6('0x86')](_0x20b6('0x87'),'tq')[_0x20b6('0x88')](_0x20b6('0x89'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x20b6('0x46')]('VoiceQueueId\x20=\x20?',_0x1d24ea[_0x20b6('0x51')]['id']);for(var _0x609d97=0x0;_0x609d97<_0x5b3d16[_0x20b6('0x42')];_0x609d97+=0x1){let _0x14d1d8=_0x5b3d16[_0x609d97];for(var _0x3ae542=0x0;_0x3ae542<_0x14d1d8[_0x20b6('0x71')][_0x20b6('0x42')];_0x3ae542+=0x1){let _0x363b70=_0x14d1d8['Agents'][_0x3ae542];var _0x55b6e7=_0x466306[_0x20b6('0x8a')]();_0x55b6e7[_0x20b6('0x46')](_0x20b6('0x8b'),_0x363b70['id']);_0x1ed189[_0x20b6('0x8c')](db[_0x20b6('0x73')][_0x20b6('0x3c')](_0x55b6e7[_0x20b6('0x8d')](),{'type':db['sequelize'][_0x20b6('0x8e')][_0x20b6('0x8f')]})['then'](function(_0x1e6b2c){if(_0x1e6b2c['length']===0x1){return _0x363b70['id'];}else{var _0x383eeb=_['every'](_['map'](_0x1e6b2c,'TeamId'),function(_0x3b5001){return _[_0x20b6('0x90')](_0x21ee71,_0x3b5001);});if(_0x383eeb){return _0x363b70['id'];}}}));}}return BPromise['all'](_0x1ed189)[_0x20b6('0x26')](function(_0x3dcab6){_0x1bb515=_(_0x1bb515)['union'](_0x3dcab6)[_0x20b6('0x91')]()[_0x20b6('0x2e')]();return db[_0x20b6('0x36')][_0x20b6('0x2f')]({'where':{'id':_0x1d24ea[_0x20b6('0x51')]['id']}})[_0x20b6('0x26')](function(_0x107142){return db['sequelize'][_0x20b6('0x74')](function(_0x477a34){return _0x107142[_0x20b6('0x82')](_0x1d24ea[_0x20b6('0x3c')][_0x20b6('0x83')],{'transaction':_0x477a34})[_0x20b6('0x26')](function(){if(!_[_0x20b6('0x92')](_0x1bb515)){return _0x107142['removeAgents'](_0x1bb515,{'transaction':_0x477a34})[_0x20b6('0x26')](function(){return db[_0x20b6('0x7b')]['destroy']({'where':{'VoiceQueueId':_0x1d24ea[_0x20b6('0x51')]['id'],'UserId':_0x1bb515},'transaction':_0x477a34});});}})[_0x20b6('0x26')](function(){_0x1bb515[_0x20b6('0x72')](function(_0x28ec5d){socket['emit']('userVoiceQueue:remove',{'UserId':_0x28ec5d,'VoiceQueueId':_0x107142['id']});});});});});});})[_0x20b6('0x26')](respondWithStatusCode(_0x3b23f,null))[_0x20b6('0x4f')](handleError(_0x3b23f,null));};exports['addAgents']=function(_0x197437,_0x43a410,_0x2c21d4){var _0x1bcd53,_0x5568dc;return db['VoiceQueue'][_0x20b6('0x2f')]({'where':{'id':_0x197437[_0x20b6('0x51')]['id']}})['then'](handleEntityNotFound(_0x43a410,null))['then'](function(_0x69e161){if(_0x69e161){_0x5568dc=_0x69e161;return _0x69e161[_0x20b6('0x93')](_0x197437['body'][_0x20b6('0x83')],_[_0x20b6('0x59')](_0x197437[_0x20b6('0x54')],[_0x20b6('0x83'),'id'])||{})[_0x20b6('0x94')](function(_0x1a029e){for(var _0x44d32c=0x0;_0x44d32c<_0x197437[_0x20b6('0x54')]['ids'][_0x20b6('0x42')];_0x44d32c+=0x1){socket[_0x20b6('0x80')](_0x20b6('0x81'),{'UserId':Number(_0x197437[_0x20b6('0x54')][_0x20b6('0x83')][_0x44d32c]),'VoiceQueueId':Number(_0x197437[_0x20b6('0x51')]['id'])});}return _0x1a029e;});}})['then'](function(_0x439f9c){_0x1bcd53=_0x439f9c||[];if(_0x5568dc){return db[_0x20b6('0x95')]['findAll']({'where':{'id':_0x197437[_0x20b6('0x54')][_0x20b6('0x83')]},'attributes':['id',_0x20b6('0x33'),'online',_0x20b6('0x6f'),_0x20b6('0x7d')],'raw':!![]});}})['then'](function(_0x317965){if(!_['isEmpty'](_0x317965)){var _0x252680=[];for(var _0x6147d5=0x0;_0x6147d5<_0x317965[_0x20b6('0x42')];_0x6147d5++){if(_0x317965[_0x6147d5][_0x20b6('0x6e')]){_0x252680[_0x20b6('0x8c')](db[_0x20b6('0x7b')][_0x20b6('0x76')]({'membername':_0x317965[_0x6147d5][_0x20b6('0x33')],'UserId':_0x317965[_0x6147d5]['id'],'queue_name':_0x5568dc[_0x20b6('0x33')],'VoiceQueueId':_0x5568dc['id'],'interface':_[_0x20b6('0x7c')](_0x317965[_0x6147d5][_0x20b6('0x7d')])?util['format'](_0x20b6('0x7f'),_0x317965[_0x6147d5][_0x20b6('0x33')]):_0x317965[_0x6147d5]['interface'],'paused':_0x317965[_0x6147d5][_0x20b6('0x6f')]||![],'penalty':_0x197437[_0x20b6('0x54')][_0x20b6('0x77')]||0x0}));}}return BPromise['all'](_0x252680);}})[_0x20b6('0x26')](function(){return _0x1bcd53;})['then'](respondWithResult(_0x43a410,null))[_0x20b6('0x4f')](handleError(_0x43a410,null));};exports[_0x20b6('0x96')]=function(_0x489e99,_0x1a8a8c,_0x46da9f){return db[_0x20b6('0x36')]['find']({'where':{'id':_0x489e99[_0x20b6('0x51')]['id']}})[_0x20b6('0x26')](handleEntityNotFound(_0x1a8a8c,null))['then'](function(_0x5caa08){if(_0x5caa08){return _0x5caa08['removeAgents'](_0x489e99[_0x20b6('0x3c')][_0x20b6('0x83')])[_0x20b6('0x26')](function(){if(_['isArray'](_0x489e99[_0x20b6('0x3c')][_0x20b6('0x83')])){for(var _0x343bf8=0x0;_0x343bf8<_0x489e99['query'][_0x20b6('0x83')][_0x20b6('0x42')];_0x343bf8+=0x1){socket[_0x20b6('0x80')]('userVoiceQueue:remove',{'UserId':Number(_0x489e99[_0x20b6('0x3c')][_0x20b6('0x83')][_0x343bf8]),'VoiceQueueId':Number(_0x489e99[_0x20b6('0x51')]['id'])});}}else{socket[_0x20b6('0x80')](_0x20b6('0x97'),{'UserId':Number(_0x489e99[_0x20b6('0x3c')][_0x20b6('0x83')]),'VoiceQueueId':Number(_0x489e99[_0x20b6('0x51')]['id'])});}});}})['then'](function(_0x2b4a74){return db[_0x20b6('0x7b')][_0x20b6('0x30')]({'where':{'VoiceQueueId':_0x489e99['params']['id'],'UserId':_0x489e99[_0x20b6('0x3c')][_0x20b6('0x83')]}})[_0x20b6('0x26')](function(){return _0x2b4a74;});})[_0x20b6('0x26')](respondWithStatusCode(_0x1a8a8c,null))[_0x20b6('0x4f')](handleError(_0x1a8a8c,null));};exports['getAgents']=function(_0x337441,_0x431c26,_0xa7037b){var _0x1bcf97={};var _0x1ce716={};var _0x7e27d2;var _0x285d05;return db[_0x20b6('0x36')]['findOne']({'where':{'id':_0x337441[_0x20b6('0x51')]['id']}})[_0x20b6('0x26')](handleEntityNotFound(_0x431c26,null))['then'](function(_0x4d33cc){if(_0x4d33cc){_0x7e27d2=_0x4d33cc;_0x1ce716[_0x20b6('0x3f')]=_['keys'](db[_0x20b6('0x95')]['rawAttributes']);_0x1ce716[_0x20b6('0x3c')]=_['keys'](_0x337441['query']);_0x1ce716[_0x20b6('0x3d')]=_[_0x20b6('0x3e')](_0x1ce716[_0x20b6('0x3f')],_0x1ce716[_0x20b6('0x3c')]);_0x1bcf97['attributes']=_[_0x20b6('0x3e')](_0x1ce716[_0x20b6('0x3f')],qs['fields'](_0x337441[_0x20b6('0x3c')]['fields']));_0x1bcf97[_0x20b6('0x40')]=_0x1bcf97[_0x20b6('0x40')]['length']?_0x1bcf97[_0x20b6('0x40')]:_0x1ce716[_0x20b6('0x3f')];_0x1bcf97[_0x20b6('0x44')]=qs['sort'](_0x337441[_0x20b6('0x3c')][_0x20b6('0x45')]);_0x1bcf97['where']=qs[_0x20b6('0x3d')](_[_0x20b6('0x47')](_0x337441[_0x20b6('0x3c')],_0x1ce716[_0x20b6('0x3d')]));if(_0x337441[_0x20b6('0x3c')][_0x20b6('0x2c')]){_0x1bcf97['where']=_[_0x20b6('0x48')](_0x1bcf97[_0x20b6('0x46')],{'$or':_[_0x20b6('0x49')](_0x1bcf97[_0x20b6('0x40')],function(_0x4d5063){var _0x5d6e6e={};_0x5d6e6e[_0x4d5063]={'$like':'%'+_0x337441[_0x20b6('0x3c')][_0x20b6('0x2c')]+'%'};return _0x5d6e6e;})});}_0x1bcf97=_[_0x20b6('0x48')]({},_0x1bcf97,_0x337441[_0x20b6('0x4b')]);return _0x7e27d2['getAgents'](_0x1bcf97);}})['then'](function(_0x5416dd){if(_0x5416dd){_0x285d05=_0x5416dd[_0x20b6('0x42')];if(!_0x337441[_0x20b6('0x3c')]['hasOwnProperty'](_0x20b6('0x43'))){_0x1bcf97[_0x20b6('0x1f')]=qs[_0x20b6('0x1f')](_0x337441[_0x20b6('0x3c')][_0x20b6('0x1f')]);_0x1bcf97[_0x20b6('0x1d')]=qs[_0x20b6('0x1d')](_0x337441[_0x20b6('0x3c')][_0x20b6('0x1d')]);}return _0x7e27d2[_0x20b6('0x98')](_0x1bcf97);}})[_0x20b6('0x26')](function(_0x514213){if(_0x514213){return _0x514213?{'count':_0x285d05,'rows':_0x514213}:null;}})[_0x20b6('0x26')](respondWithResult(_0x431c26,null))[_0x20b6('0x4f')](handleError(_0x431c26,null));};exports[_0x20b6('0x99')]=function(_0x42b558,_0x47f2db,_0x74f8){var _0x48ddb1={};var _0xd0392c={};var _0x3e0ad8;var _0x187f53;return db[_0x20b6('0x36')][_0x20b6('0x64')]({'where':{'id':_0x42b558[_0x20b6('0x51')]['id']}})[_0x20b6('0x26')](handleEntityNotFound(_0x47f2db,null))[_0x20b6('0x26')](function(_0x178bc8){if(_0x178bc8){_0x3e0ad8=_0x178bc8;_0xd0392c['model']=_[_0x20b6('0x3b')](db[_0x20b6('0x7b')][_0x20b6('0x37')]);_0xd0392c['query']=_[_0x20b6('0x3b')](_0x42b558['query']);_0xd0392c[_0x20b6('0x3d')]=_['intersection'](_0xd0392c[_0x20b6('0x3f')],_0xd0392c[_0x20b6('0x3c')]);_0x48ddb1[_0x20b6('0x40')]=_['intersection'](_0xd0392c[_0x20b6('0x3f')],qs[_0x20b6('0x41')](_0x42b558[_0x20b6('0x3c')][_0x20b6('0x41')]));_0x48ddb1['attributes']=_0x48ddb1[_0x20b6('0x40')]['length']?_0x48ddb1[_0x20b6('0x40')]:_0xd0392c[_0x20b6('0x3f')];_0x48ddb1[_0x20b6('0x44')]=qs['sort'](_0x42b558['query'][_0x20b6('0x45')]);_0x48ddb1['where']=qs[_0x20b6('0x3d')](_[_0x20b6('0x47')](_0x42b558['query'],_0xd0392c['filters']));if(_0x42b558['query']['filter']){_0x48ddb1[_0x20b6('0x46')]=_[_0x20b6('0x48')](_0x48ddb1[_0x20b6('0x46')],{'$or':_[_0x20b6('0x49')](_0x48ddb1['attributes'],function(_0x5e8e95){var _0x35555a={};_0x35555a[_0x5e8e95]={'$like':'%'+_0x42b558['query'][_0x20b6('0x2c')]+'%'};return _0x35555a;})});}_0x48ddb1=_[_0x20b6('0x48')]({},_0x48ddb1,_0x42b558[_0x20b6('0x4b')]);return _0x3e0ad8['getMembers'](_0x48ddb1);}})['then'](function(_0xc56ae3){if(_0xc56ae3){_0x187f53=_0xc56ae3[_0x20b6('0x42')];if(!_0x42b558[_0x20b6('0x3c')][_0x20b6('0x67')](_0x20b6('0x43'))){_0x48ddb1['limit']=qs['limit'](_0x42b558[_0x20b6('0x3c')][_0x20b6('0x1f')]);_0x48ddb1[_0x20b6('0x1d')]=qs[_0x20b6('0x1d')](_0x42b558[_0x20b6('0x3c')][_0x20b6('0x1d')]);}return _0x3e0ad8[_0x20b6('0x99')](_0x48ddb1);}})['then'](function(_0x4b8051){return _0x4b8051?{'count':_0x187f53,'rows':_0x4b8051}:null;})[_0x20b6('0x26')](respondWithResult(_0x47f2db,null))['catch'](handleError(_0x47f2db,null));};exports[_0x20b6('0x9a')]=function(_0x248978,_0x527954,_0x14fb51){var _0x23e212={};var _0x455231={};var _0x25cc7c;var _0x4d430a;return db[_0x20b6('0x36')]['findOne']({'where':{'id':_0x248978[_0x20b6('0x51')]['id']}})['then'](handleEntityNotFound(_0x527954,null))[_0x20b6('0x26')](function(_0x59b01b){if(_0x59b01b){_0x25cc7c=_0x59b01b;_0x455231[_0x20b6('0x3f')]=_['keys'](db[_0x20b6('0x9b')][_0x20b6('0x37')]);_0x455231[_0x20b6('0x3c')]=_[_0x20b6('0x3b')](_0x248978['query']);_0x455231[_0x20b6('0x3d')]=_[_0x20b6('0x3e')](_0x455231[_0x20b6('0x3f')],_0x455231[_0x20b6('0x3c')]);_0x23e212[_0x20b6('0x40')]=_['intersection'](_0x455231[_0x20b6('0x3f')],qs[_0x20b6('0x41')](_0x248978[_0x20b6('0x3c')][_0x20b6('0x41')]));_0x23e212[_0x20b6('0x40')]=_0x23e212[_0x20b6('0x40')]['length']?_0x23e212[_0x20b6('0x40')]:_0x455231[_0x20b6('0x3f')];_0x23e212[_0x20b6('0x44')]=qs[_0x20b6('0x45')](_0x248978['query']['sort']);_0x23e212['where']=qs[_0x20b6('0x3d')](_[_0x20b6('0x47')](_0x248978[_0x20b6('0x3c')],_0x455231['filters']));if(_0x248978[_0x20b6('0x3c')][_0x20b6('0x2c')]){_0x23e212[_0x20b6('0x46')]=_[_0x20b6('0x48')](_0x23e212[_0x20b6('0x46')],{'$or':_['map'](_0x23e212[_0x20b6('0x40')],function(_0xf0352b){var _0x3edd01={};_0x3edd01[_0xf0352b]={'$like':'%'+_0x248978[_0x20b6('0x3c')][_0x20b6('0x2c')]+'%'};return _0x3edd01;})});}_0x23e212=_[_0x20b6('0x48')]({},_0x23e212,_0x248978['options']);return _0x25cc7c[_0x20b6('0x9a')](_0x23e212);}})['then'](function(_0x112b60){if(_0x112b60){_0x4d430a=_0x112b60['length'];if(!_0x248978[_0x20b6('0x3c')][_0x20b6('0x67')](_0x20b6('0x43'))){_0x23e212['limit']=qs[_0x20b6('0x1f')](_0x248978[_0x20b6('0x3c')]['limit']);_0x23e212[_0x20b6('0x1d')]=qs[_0x20b6('0x1d')](_0x248978['query'][_0x20b6('0x1d')]);}return _0x25cc7c[_0x20b6('0x9a')](_0x23e212);}})[_0x20b6('0x26')](function(_0x1f1574){if(_0x1f1574){return _0x1f1574?{'count':_0x4d430a,'rows':_0x1f1574}:null;}})[_0x20b6('0x26')](respondWithResult(_0x527954,null))[_0x20b6('0x4f')](handleError(_0x527954,null));};exports[_0x20b6('0x9c')]=function(_0x50d366,_0x1d6b3d,_0x17f78d){var _0x4f4385,_0x2651f4;return db[_0x20b6('0x36')][_0x20b6('0x2f')]({'where':{'id':_0x50d366[_0x20b6('0x51')]['id']}})['then'](handleEntityNotFound(_0x1d6b3d,null))[_0x20b6('0x26')](function(_0x1ee18a){if(_0x1ee18a){_0x2651f4=_0x1ee18a;return _0x1ee18a[_0x20b6('0x9c')](_0x50d366[_0x20b6('0x54')][_0x20b6('0x83')],_[_0x20b6('0x59')](_0x50d366['body'],['ids','id'])||{});}return null;})[_0x20b6('0x94')](function(_0x2e06bf){var _0x48b0c8;_0x4f4385=_0x2e06bf||[];var _0x4cc4c6=[];if(_0x2e06bf){for(var _0x1c4a38=0x0;_0x1c4a38<_0x2e06bf[_0x20b6('0x42')];_0x1c4a38+=0x1){var _0xee402c=_0x2e06bf[_0x1c4a38][_0x20b6('0x27')]({'plain':!![]});_0x2651f4[_0x20b6('0x9d')]=_0x50d366[_0x20b6('0x54')][_0x20b6('0x9d')]?_0x50d366['body'][_0x20b6('0x9d')]:_0x2651f4['dialCheckDuplicateType'];switch(_0x2651f4['dialCheckDuplicateType']){case'always':_0x48b0c8=squel[_0x20b6('0x9e')]()[_0x20b6('0x9f')](_0x20b6('0xa0'))[_0x20b6('0xa1')]([_0x20b6('0xa2'),_0x20b6('0xa3'),_0x20b6('0xa4'),_0x20b6('0xa5'),_0x20b6('0x62'),_0x20b6('0x5a'),_0x20b6('0x5b')],squel['select']()[_0x20b6('0x85')]('phone',_0x20b6('0xa2'))[_0x20b6('0x85')](_0x20b6('0xa6'),_0x20b6('0xa3'))[_0x20b6('0x85')]('id',_0x20b6('0xa4'))[_0x20b6('0x85')](_0xee402c[_0x20b6('0xa7')][_0x20b6('0x8d')](),_0x20b6('0xa5'))[_0x20b6('0x85')](_0x50d366[_0x20b6('0x51')]['id'][_0x20b6('0x8d')](),_0x20b6('0x62'))[_0x20b6('0x85')]('NOW()',_0x20b6('0x5a'))[_0x20b6('0x85')]('NOW()','updatedAt')[_0x20b6('0x86')](_0x20b6('0xa8'))['where'](_0x20b6('0xa9'))[_0x20b6('0x46')]('ListId\x20=\x20?',_0xee402c[_0x20b6('0xa7')]['toString']())[_0x20b6('0x46')](_0x20b6('0xaa'))['where'](_0x20b6('0xab'),squel[_0x20b6('0x84')]()[_0x20b6('0x85')]('COALESCE(calleridnum,\x27\x27)')[_0x20b6('0x86')](_0x20b6('0xac'))[_0x20b6('0x46')](_0x20b6('0xad'),_0x50d366[_0x20b6('0x51')]['id'][_0x20b6('0x8d')]()))[_0x20b6('0x46')](_0x20b6('0xab'),squel[_0x20b6('0x84')]()[_0x20b6('0x85')](_0x20b6('0xae'))[_0x20b6('0x86')](_0x20b6('0xa0'))[_0x20b6('0x46')](_0x20b6('0xad'),_0x50d366[_0x20b6('0x51')]['id'][_0x20b6('0x8d')]())))[_0x20b6('0x8d')]();break;case _0x20b6('0xaf'):_0x48b0c8=squel[_0x20b6('0x9e')]()[_0x20b6('0x9f')](_0x20b6('0xa0'))[_0x20b6('0xa1')]([_0x20b6('0xa2'),_0x20b6('0xa3'),_0x20b6('0xa4'),'ListId',_0x20b6('0x62'),_0x20b6('0x5a'),_0x20b6('0x5b')],squel[_0x20b6('0x84')]()[_0x20b6('0x85')](_0x20b6('0xa2'),_0x20b6('0xa2'))[_0x20b6('0x85')]('NOW()','scheduledAt')[_0x20b6('0x85')]('id',_0x20b6('0xa4'))[_0x20b6('0x85')](_0xee402c[_0x20b6('0xa7')]['toString'](),'ListId')[_0x20b6('0x85')](_0x50d366[_0x20b6('0x51')]['id']['toString'](),_0x20b6('0x62'))[_0x20b6('0x85')](_0x20b6('0xa6'),_0x20b6('0x5a'))[_0x20b6('0x85')](_0x20b6('0xa6'),_0x20b6('0x5b'))[_0x20b6('0x86')](_0x20b6('0xa8'))['where'](_0x20b6('0xa9'))[_0x20b6('0x46')](_0x20b6('0xb0'),_0xee402c[_0x20b6('0xa7')][_0x20b6('0x8d')]())[_0x20b6('0x46')](_0x20b6('0xaa'))[_0x20b6('0x46')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x20b6('0xae'))[_0x20b6('0x86')](_0x20b6('0xa0'))[_0x20b6('0x46')](_0x20b6('0xad'),_0x50d366[_0x20b6('0x51')]['id'][_0x20b6('0x8d')]())))[_0x20b6('0x8d')]();break;default:_0x48b0c8=squel['insert']()[_0x20b6('0x9f')](_0x20b6('0xa0'))[_0x20b6('0xa1')]([_0x20b6('0xa2'),_0x20b6('0xa3'),'ContactId','ListId','VoiceQueueId','createdAt',_0x20b6('0x5b')],squel[_0x20b6('0x84')]()['field']('phone',_0x20b6('0xa2'))['field'](_0x20b6('0xa6'),_0x20b6('0xa3'))[_0x20b6('0x85')]('id',_0x20b6('0xa4'))[_0x20b6('0x85')](_0xee402c[_0x20b6('0xa7')]['toString'](),'ListId')[_0x20b6('0x85')](_0x50d366[_0x20b6('0x51')]['id'][_0x20b6('0x8d')](),_0x20b6('0x62'))['field']('NOW()',_0x20b6('0x5a'))['field'](_0x20b6('0xa6'),_0x20b6('0x5b'))[_0x20b6('0x86')]('cm_contacts')[_0x20b6('0x46')](_0x20b6('0xa9'))[_0x20b6('0x46')](_0x20b6('0xb0'),_0xee402c[_0x20b6('0xa7')][_0x20b6('0x8d')]())[_0x20b6('0x46')](_0x20b6('0xaa')))[_0x20b6('0x8d')]();}_0x4cc4c6[_0x20b6('0x8c')](db['sequelize'][_0x20b6('0x3c')](_0x48b0c8));}return BPromise['all'](_0x4cc4c6);}})[_0x20b6('0x26')](function(){return _0x4f4385;})[_0x20b6('0x26')](respondWithResult(_0x1d6b3d,null))[_0x20b6('0x4f')](handleError(_0x1d6b3d,null));};exports['removeLists']=function(_0x2630ed,_0x2d9b25,_0x4ebc79){return db['VoiceQueue'][_0x20b6('0x2f')]({'where':{'id':_0x2630ed[_0x20b6('0x51')]['id']}})[_0x20b6('0x26')](handleEntityNotFound(_0x2d9b25,null))['then'](function(_0x354f78){if(_0x354f78){return _0x354f78['removeLists'](_0x2630ed['query']['ids']);}})[_0x20b6('0x26')](function(_0x19d3fd){if(_0x19d3fd){return db[_0x20b6('0x61')][_0x20b6('0x30')]({'where':{'ListId':_0x2630ed[_0x20b6('0x3c')]['ids'],'VoiceQueueId':_0x2630ed['params']['id']}})[_0x20b6('0x26')](function(){return _0x19d3fd;});}})['then'](respondWithStatusCode(_0x2d9b25,null))[_0x20b6('0x4f')](handleError(_0x2d9b25,null));};exports[_0x20b6('0xb1')]=function(_0x2775d9,_0x42c61b,_0x4ba880){var _0x2bdbe9={};var _0x35879d={};var _0x1b6648;var _0x407417;return db[_0x20b6('0x36')][_0x20b6('0x64')]({'where':{'id':_0x2775d9[_0x20b6('0x51')]['id']}})[_0x20b6('0x26')](handleEntityNotFound(_0x42c61b,null))[_0x20b6('0x26')](function(_0x3ab15f){if(_0x3ab15f){_0x1b6648=_0x3ab15f;_0x35879d['model']=_[_0x20b6('0x3b')](db[_0x20b6('0x9b')][_0x20b6('0x37')]);_0x35879d[_0x20b6('0x3c')]=_[_0x20b6('0x3b')](_0x2775d9[_0x20b6('0x3c')]);_0x35879d[_0x20b6('0x3d')]=_[_0x20b6('0x3e')](_0x35879d['model'],_0x35879d[_0x20b6('0x3c')]);_0x2bdbe9['attributes']=_[_0x20b6('0x3e')](_0x35879d[_0x20b6('0x3f')],qs[_0x20b6('0x41')](_0x2775d9['query'][_0x20b6('0x41')]));_0x2bdbe9['attributes']=_0x2bdbe9[_0x20b6('0x40')][_0x20b6('0x42')]?_0x2bdbe9[_0x20b6('0x40')]:_0x35879d['model'];_0x2bdbe9[_0x20b6('0x44')]=qs['sort'](_0x2775d9['query'][_0x20b6('0x45')]);_0x2bdbe9[_0x20b6('0x46')]=qs[_0x20b6('0x3d')](_[_0x20b6('0x47')](_0x2775d9[_0x20b6('0x3c')],_0x35879d[_0x20b6('0x3d')]));if(_0x2775d9[_0x20b6('0x3c')][_0x20b6('0x2c')]){_0x2bdbe9['where']=_['merge'](_0x2bdbe9[_0x20b6('0x46')],{'$or':_[_0x20b6('0x49')](_0x2bdbe9[_0x20b6('0x40')],function(_0x31199c){var _0x387610={};_0x387610[_0x31199c]={'$like':'%'+_0x2775d9['query'][_0x20b6('0x2c')]+'%'};return _0x387610;})});}_0x2bdbe9=_[_0x20b6('0x48')]({},_0x2bdbe9,_0x2775d9[_0x20b6('0x4b')]);return _0x1b6648['getBlackLists'](_0x2bdbe9);}})[_0x20b6('0x26')](function(_0x7b7ca){if(_0x7b7ca){_0x407417=_0x7b7ca[_0x20b6('0x42')];if(!_0x2775d9['query'][_0x20b6('0x67')](_0x20b6('0x43'))){_0x2bdbe9[_0x20b6('0x1f')]=qs[_0x20b6('0x1f')](_0x2775d9[_0x20b6('0x3c')]['limit']);_0x2bdbe9[_0x20b6('0x1d')]=qs[_0x20b6('0x1d')](_0x2775d9[_0x20b6('0x3c')][_0x20b6('0x1d')]);}return _0x1b6648[_0x20b6('0xb1')](_0x2bdbe9);}})[_0x20b6('0x26')](function(_0x13f58f){if(_0x13f58f){return _0x13f58f?{'count':_0x407417,'rows':_0x13f58f}:null;}})[_0x20b6('0x26')](respondWithResult(_0x42c61b,null))[_0x20b6('0x4f')](handleError(_0x42c61b,null));};exports[_0x20b6('0xb2')]=function(_0x7996e9,_0x1370e0,_0x1e586c){var _0x5a004e,_0x48b3a5;return db['VoiceQueue']['find']({'where':{'id':_0x7996e9['params']['id']}})[_0x20b6('0x26')](handleEntityNotFound(_0x1370e0,null))[_0x20b6('0x26')](function(_0x300a6d){if(_0x300a6d){_0x48b3a5=_0x300a6d;return _0x300a6d[_0x20b6('0xb2')](_0x7996e9[_0x20b6('0x54')][_0x20b6('0x83')],_[_0x20b6('0x59')](_0x7996e9['body'],['ids','id'])||{});}return null;})[_0x20b6('0x94')](function(_0xc9c605){var _0x12c37f;_0x5a004e=_0xc9c605||[];var _0x1ee8a5=[];if(_0xc9c605){for(var _0x3fe734=0x0;_0x3fe734<_0xc9c605[_0x20b6('0x42')];_0x3fe734+=0x1){var _0x87f489=_0xc9c605[_0x3fe734]['get']({'plain':!![]});_0x12c37f=squel[_0x20b6('0x9e')]()['into'](_0x20b6('0xb3'))[_0x20b6('0xa1')](['phone',_0x20b6('0xa4'),_0x20b6('0xa5'),'VoiceQueueId',_0x20b6('0x5a'),_0x20b6('0x5b')],squel['select']()[_0x20b6('0x85')]('phone',_0x20b6('0xa2'))[_0x20b6('0x85')]('id',_0x20b6('0xa4'))[_0x20b6('0x85')](_0x87f489[_0x20b6('0xa7')][_0x20b6('0x8d')](),_0x20b6('0xa5'))[_0x20b6('0x85')](_0x7996e9[_0x20b6('0x51')]['id'][_0x20b6('0x8d')](),'VoiceQueueId')[_0x20b6('0x85')](_0x20b6('0xa6'),'createdAt')[_0x20b6('0x85')](_0x20b6('0xa6'),_0x20b6('0x5b'))[_0x20b6('0x86')](_0x20b6('0xa8'))[_0x20b6('0x46')](_0x20b6('0xa9'))['where'](_0x20b6('0xb0'),_0x87f489[_0x20b6('0xa7')]['toString']())[_0x20b6('0x46')](_0x20b6('0xaa')))[_0x20b6('0x8d')]();_0x1ee8a5['push'](db[_0x20b6('0x73')][_0x20b6('0x3c')](_0x12c37f));}return BPromise['all'](_0x1ee8a5);}})[_0x20b6('0x26')](function(){return _0x5a004e;})[_0x20b6('0x26')](respondWithResult(_0x1370e0,null))[_0x20b6('0x4f')](handleError(_0x1370e0,null));};exports[_0x20b6('0xb4')]=function(_0x1542a7,_0x93905e,_0x19aba7){return db['VoiceQueue'][_0x20b6('0x2f')]({'where':{'id':_0x1542a7['params']['id']}})[_0x20b6('0x26')](handleEntityNotFound(_0x93905e,null))[_0x20b6('0x26')](function(_0x6e4369){if(_0x6e4369){return _0x6e4369['removeBlackLists'](_0x1542a7[_0x20b6('0x3c')][_0x20b6('0x83')]);}})[_0x20b6('0x26')](function(_0x249f8e){if(_0x249f8e){return db[_0x20b6('0x69')][_0x20b6('0x30')]({'where':{'ListId':_0x1542a7[_0x20b6('0x3c')]['ids'],'VoiceQueueId':_0x1542a7[_0x20b6('0x51')]['id']}})[_0x20b6('0x26')](function(){return _0x249f8e;});}})[_0x20b6('0x26')](respondWithStatusCode(_0x93905e,null))[_0x20b6('0x4f')](handleError(_0x93905e,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 271f5e1..cf10079 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 _0x2e27=['save','update','remove','emit','hook','exports','../../mysqldb','VoiceQueue','setMaxListeners'];(function(_0x183800,_0x146171){var _0x34aa35=function(_0x264662){while(--_0x264662){_0x183800['push'](_0x183800['shift']());}};_0x34aa35(++_0x146171);}(_0x2e27,0xa8));var _0x72e2=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x2e27[_0x4b2863];return _0x567d67;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x72e2('0x0'))['db'][_0x72e2('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x72e2('0x2')](0x0);var events={'afterCreate':_0x72e2('0x3'),'afterUpdate':_0x72e2('0x4'),'afterDestroy':_0x72e2('0x5')};function emitEvent(_0x3de09e){return function(_0x2c14d6,_0x5cb3fc,_0x22179f){VoiceQueueEvents[_0x72e2('0x6')](_0x3de09e+':'+_0x2c14d6['id'],_0x2c14d6);VoiceQueueEvents[_0x72e2('0x6')](_0x3de09e,_0x2c14d6);_0x22179f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x72e2('0x7')](e,emitEvent(event));}}module[_0x72e2('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0xe06b=['exports','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe06b,0x161));var _0xbe06=function(_0x44b7fc,_0x134103){_0x44b7fc=_0x44b7fc-0x0;var _0x36c0da=_0xe06b[_0x44b7fc];return _0x36c0da;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0xbe06('0x0'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xbe06('0x1')](0x0);var events={'afterCreate':_0xbe06('0x2'),'afterUpdate':_0xbe06('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2f445f){return function(_0x178e27,_0x3829db,_0x470644){VoiceQueueEvents[_0xbe06('0x4')](_0x2f445f+':'+_0x178e27['id'],_0x178e27);VoiceQueueEvents[_0xbe06('0x4')](_0x2f445f,_0x178e27);_0x470644(null);};}for(var e in events){if(events[_0xbe06('0x5')](e)){var event=events[e];VoiceQueue[_0xbe06('0x6')](e,emitEvent(event));}}module[_0xbe06('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 623baa3..743127e 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(_0x36e1e2,_0x5c36a9){var _0x3e5de8=function(_0x5ca6ff){while(--_0x5ca6ff){_0x36e1e2['push'](_0x36e1e2['shift']());}};_0x3e5de8(++_0x5c36a9);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'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 _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x55fe01,_0xa15868){var _0x3485c5=function(_0x8542b2){while(--_0x8542b2){_0x55fe01['push'](_0x55fe01['shift']());}};_0x3485c5(++_0xa15868);}(_0x34e8,0x12c));var _0x834e=function(_0x2b34c2,_0x4f584d){_0x2b34c2=_0x2b34c2-0x0;var _0x2b39fb=_0x34e8[_0x2b34c2];return _0x2b39fb;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index cc4a124..f107b20 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 _0x082a=['raw','where','attributes','include','model','map','GetVoiceQueue','stringify','ShowVoiceQueue','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./voiceQueue.socket','register','request','then','info','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','VoiceQueue,\x20%s,\x20%s','message','result','VoiceQueue','findAll','options'];(function(_0x1c9205,_0x538b38){var _0x4bd51a=function(_0x77709f){while(--_0x77709f){_0x1c9205['push'](_0x1c9205['shift']());}};_0x4bd51a(++_0x538b38);}(_0x082a,0x1a4));var _0xa082=function(_0x205818,_0xe9dc3f){_0x205818=_0x205818-0x0;var _0x41b12f=_0x082a[_0x205818];return _0x41b12f;};'use strict';var _=require(_0xa082('0x0'));var util=require(_0xa082('0x1'));var moment=require('moment');var BPromise=require(_0xa082('0x2'));var rs=require(_0xa082('0x3'));var fs=require('fs');var Redis=require(_0xa082('0x4'));var db=require(_0xa082('0x5'))['db'];var utils=require(_0xa082('0x6'));var logger=require(_0xa082('0x7'))(_0xa082('0x8'));var config=require(_0xa082('0x9'));var jayson=require(_0xa082('0xa'));var client=jayson[_0xa082('0xb')]['http']({'port':0x232a});config[_0xa082('0xc')]=_[_0xa082('0xd')](config[_0xa082('0xc')],{'host':_0xa082('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa082('0xc')]));require(_0xa082('0xf'))[_0xa082('0x10')](socket);function respondWithRpcPromise(_0x2c5f56,_0x3f1291,_0x5ee527){return new BPromise(function(_0x2e6b8b,_0x54581e){return client[_0xa082('0x11')](_0x2c5f56,_0x5ee527)[_0xa082('0x12')](function(_0x56f00a){logger[_0xa082('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x3f1291,_0xa082('0x14'));logger[_0xa082('0x15')](_0xa082('0x16'),_0x3f1291,_0xa082('0x14'),JSON['stringify'](_0x56f00a));if(_0x56f00a[_0xa082('0x17')]){if(_0x56f00a[_0xa082('0x17')][_0xa082('0x18')]===0x1f4){logger['error'](_0xa082('0x19'),_0x3f1291,_0x56f00a[_0xa082('0x17')][_0xa082('0x1a')]);return _0x54581e(_0x56f00a['error'][_0xa082('0x1a')]);}logger[_0xa082('0x17')](_0xa082('0x19'),_0x3f1291,_0x56f00a[_0xa082('0x17')][_0xa082('0x1a')]);return _0x2e6b8b(_0x56f00a[_0xa082('0x17')][_0xa082('0x1a')]);}else{logger[_0xa082('0x13')](_0xa082('0x19'),_0x3f1291,_0xa082('0x14'));_0x2e6b8b(_0x56f00a[_0xa082('0x1b')][_0xa082('0x1a')]);}})['catch'](function(_0x364531){logger['error'](_0xa082('0x19'),_0x3f1291,_0x364531);_0x54581e(_0x364531);});});}exports['GetVoiceQueue']=function(_0xd1ef1b){var _0x512f16=this;return new Promise(function(_0x17d3c9,_0x1764c0){return db[_0xa082('0x1c')][_0xa082('0x1d')]({'raw':_0xd1ef1b[_0xa082('0x1e')]?_0xd1ef1b[_0xa082('0x1e')][_0xa082('0x1f')]===undefined?!![]:![]:!![],'where':_0xd1ef1b['options']?_0xd1ef1b['options'][_0xa082('0x20')]||null:null,'attributes':_0xd1ef1b[_0xa082('0x1e')]?_0xd1ef1b['options'][_0xa082('0x21')]||null:null,'limit':_0xd1ef1b['options']?_0xd1ef1b['options']['limit']||null:null,'include':_0xd1ef1b[_0xa082('0x1e')]?_0xd1ef1b[_0xa082('0x1e')][_0xa082('0x22')]?_['map'](_0xd1ef1b[_0xa082('0x1e')]['include'],function(_0x213e53){return{'model':db[_0x213e53[_0xa082('0x23')]],'as':_0x213e53['as'],'attributes':_0x213e53[_0xa082('0x21')],'include':_0x213e53['include']?_['map'](_0x213e53['include'],function(_0x1f5877){return{'model':db[_0x1f5877[_0xa082('0x23')]],'as':_0x1f5877['as'],'attributes':_0x1f5877[_0xa082('0x21')],'include':_0x1f5877[_0xa082('0x22')]?_[_0xa082('0x24')](_0x1f5877[_0xa082('0x22')],function(_0x30b0ba){return{'model':db[_0x30b0ba['model']],'as':_0x30b0ba['as'],'attributes':_0x30b0ba[_0xa082('0x21')]};}):[]};}):[]};}):[]:[]})[_0xa082('0x12')](function(_0x2e41bd){logger[_0xa082('0x13')](_0xa082('0x25'),_0xd1ef1b);logger[_0xa082('0x15')](_0xa082('0x25'),_0xd1ef1b,JSON[_0xa082('0x26')](_0x2e41bd));_0x17d3c9(_0x2e41bd);})['catch'](function(_0x556e47){logger[_0xa082('0x17')]('GetVoiceQueue',_0x556e47[_0xa082('0x1a')],_0xd1ef1b);_0x1764c0(_0x512f16['error'](0x1f4,_0x556e47[_0xa082('0x1a')]));});});};exports[_0xa082('0x27')]=function(_0x4a65d0){var _0xdc1922=this;return new Promise(function(_0x43db53,_0x4f60d7){return db['VoiceQueue']['find']({'raw':_0x4a65d0['options']?_0x4a65d0['options'][_0xa082('0x1f')]===undefined?!![]:![]:!![],'where':_0x4a65d0[_0xa082('0x1e')]?_0x4a65d0[_0xa082('0x1e')][_0xa082('0x20')]||null:null,'attributes':_0x4a65d0[_0xa082('0x1e')]?_0x4a65d0['options']['attributes']||null:null,'include':_0x4a65d0[_0xa082('0x1e')]?_0x4a65d0['options'][_0xa082('0x22')]?_['map'](_0x4a65d0[_0xa082('0x1e')][_0xa082('0x22')],function(_0x5eace5){return{'model':db[_0x5eace5['model']],'as':_0x5eace5['as'],'attributes':_0x5eace5[_0xa082('0x21')],'include':_0x5eace5[_0xa082('0x22')]?_['map'](_0x5eace5[_0xa082('0x22')],function(_0x32f17f){return{'model':db[_0x32f17f[_0xa082('0x23')]],'as':_0x32f17f['as'],'attributes':_0x32f17f[_0xa082('0x21')],'include':_0x32f17f['include']?_['map'](_0x32f17f['include'],function(_0x2cf53d){return{'model':db[_0x2cf53d[_0xa082('0x23')]],'as':_0x2cf53d['as'],'attributes':_0x2cf53d[_0xa082('0x21')]};}):[]};}):[]};}):[]:[]})[_0xa082('0x12')](function(_0x481110){logger[_0xa082('0x13')](_0xa082('0x27'),_0x4a65d0);logger[_0xa082('0x15')](_0xa082('0x27'),_0x4a65d0,JSON[_0xa082('0x26')](_0x481110));_0x43db53(_0x481110);})[_0xa082('0x28')](function(_0x1b8961){logger[_0xa082('0x17')]('ShowVoiceQueue',_0x1b8961[_0xa082('0x1a')],_0x4a65d0);_0x4f60d7(_0xdc1922[_0xa082('0x17')](0x1f4,_0x1b8961[_0xa082('0x1a')]));});});}; \ No newline at end of file +var _0xa3a4=['request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetVoiceQueue','VoiceQueue','options','raw','where','attributes','include','map','model','stringify','ShowVoiceQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','socket.io-emitter','./voiceQueue.socket','register','then','info','VoiceQueue,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa3a4,0xa3));var _0x4a3a=function(_0x4f2632,_0x165ae5){_0x4f2632=_0x4f2632-0x0;var _0xadedc9=_0xa3a4[_0x4f2632];return _0xadedc9;};'use strict';var _=require(_0x4a3a('0x0'));var util=require(_0x4a3a('0x1'));var moment=require(_0x4a3a('0x2'));var BPromise=require('bluebird');var rs=require(_0x4a3a('0x3'));var fs=require('fs');var Redis=require(_0x4a3a('0x4'));var db=require(_0x4a3a('0x5'))['db'];var utils=require(_0x4a3a('0x6'));var logger=require('../../config/logger')(_0x4a3a('0x7'));var config=require('../../config/environment');var jayson=require(_0x4a3a('0x8'));var client=jayson['client'][_0x4a3a('0x9')]({'port':0x232a});config[_0x4a3a('0xa')]=_['defaults'](config[_0x4a3a('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x4a3a('0xb'))(new Redis(config['redis']));require(_0x4a3a('0xc'))[_0x4a3a('0xd')](socket);function respondWithRpcPromise(_0x3a6f80,_0x8ee31,_0x15b123){return new BPromise(function(_0x485ea3,_0x5d74c0){return client['request'](_0x3a6f80,_0x15b123)[_0x4a3a('0xe')](function(_0xc893a2){logger[_0x4a3a('0xf')](_0x4a3a('0x10'),_0x8ee31,_0x4a3a('0x11'));logger[_0x4a3a('0x12')](_0x4a3a('0x13'),_0x8ee31,_0x4a3a('0x11'),JSON['stringify'](_0xc893a2));if(_0xc893a2[_0x4a3a('0x14')]){if(_0xc893a2['error'][_0x4a3a('0x15')]===0x1f4){logger[_0x4a3a('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x8ee31,_0xc893a2[_0x4a3a('0x14')][_0x4a3a('0x16')]);return _0x5d74c0(_0xc893a2['error'][_0x4a3a('0x16')]);}logger[_0x4a3a('0x14')](_0x4a3a('0x10'),_0x8ee31,_0xc893a2[_0x4a3a('0x14')]['message']);return _0x485ea3(_0xc893a2[_0x4a3a('0x14')][_0x4a3a('0x16')]);}else{logger['info']('VoiceQueue,\x20%s,\x20%s',_0x8ee31,_0x4a3a('0x11'));_0x485ea3(_0xc893a2['result'][_0x4a3a('0x16')]);}})[_0x4a3a('0x17')](function(_0x2a8048){logger[_0x4a3a('0x14')](_0x4a3a('0x10'),_0x8ee31,_0x2a8048);_0x5d74c0(_0x2a8048);});});}exports[_0x4a3a('0x18')]=function(_0x366a58){var _0x202537=this;return new Promise(function(_0x51f7e4,_0x5d60ec){return db[_0x4a3a('0x19')]['findAll']({'raw':_0x366a58[_0x4a3a('0x1a')]?_0x366a58[_0x4a3a('0x1a')][_0x4a3a('0x1b')]===undefined?!![]:![]:!![],'where':_0x366a58['options']?_0x366a58[_0x4a3a('0x1a')][_0x4a3a('0x1c')]||null:null,'attributes':_0x366a58[_0x4a3a('0x1a')]?_0x366a58[_0x4a3a('0x1a')][_0x4a3a('0x1d')]||null:null,'limit':_0x366a58[_0x4a3a('0x1a')]?_0x366a58[_0x4a3a('0x1a')]['limit']||null:null,'include':_0x366a58['options']?_0x366a58[_0x4a3a('0x1a')][_0x4a3a('0x1e')]?_[_0x4a3a('0x1f')](_0x366a58[_0x4a3a('0x1a')]['include'],function(_0x31ace8){return{'model':db[_0x31ace8['model']],'as':_0x31ace8['as'],'attributes':_0x31ace8[_0x4a3a('0x1d')],'include':_0x31ace8[_0x4a3a('0x1e')]?_[_0x4a3a('0x1f')](_0x31ace8['include'],function(_0x450ddd){return{'model':db[_0x450ddd[_0x4a3a('0x20')]],'as':_0x450ddd['as'],'attributes':_0x450ddd['attributes'],'include':_0x450ddd[_0x4a3a('0x1e')]?_[_0x4a3a('0x1f')](_0x450ddd[_0x4a3a('0x1e')],function(_0x535cc6){return{'model':db[_0x535cc6['model']],'as':_0x535cc6['as'],'attributes':_0x535cc6[_0x4a3a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4a3a('0xe')](function(_0x507b98){logger[_0x4a3a('0xf')]('GetVoiceQueue',_0x366a58);logger[_0x4a3a('0x12')](_0x4a3a('0x18'),_0x366a58,JSON[_0x4a3a('0x21')](_0x507b98));_0x51f7e4(_0x507b98);})[_0x4a3a('0x17')](function(_0x30fc48){logger[_0x4a3a('0x14')]('GetVoiceQueue',_0x30fc48['message'],_0x366a58);_0x5d60ec(_0x202537[_0x4a3a('0x14')](0x1f4,_0x30fc48[_0x4a3a('0x16')]));});});};exports[_0x4a3a('0x22')]=function(_0x1a2502){var _0x482565=this;return new Promise(function(_0x431650,_0x59a728){return db[_0x4a3a('0x19')][_0x4a3a('0x23')]({'raw':_0x1a2502[_0x4a3a('0x1a')]?_0x1a2502[_0x4a3a('0x1a')][_0x4a3a('0x1b')]===undefined?!![]:![]:!![],'where':_0x1a2502[_0x4a3a('0x1a')]?_0x1a2502['options'][_0x4a3a('0x1c')]||null:null,'attributes':_0x1a2502[_0x4a3a('0x1a')]?_0x1a2502[_0x4a3a('0x1a')][_0x4a3a('0x1d')]||null:null,'include':_0x1a2502['options']?_0x1a2502[_0x4a3a('0x1a')]['include']?_[_0x4a3a('0x1f')](_0x1a2502[_0x4a3a('0x1a')]['include'],function(_0x57c6f4){return{'model':db[_0x57c6f4[_0x4a3a('0x20')]],'as':_0x57c6f4['as'],'attributes':_0x57c6f4[_0x4a3a('0x1d')],'include':_0x57c6f4['include']?_[_0x4a3a('0x1f')](_0x57c6f4['include'],function(_0x41fb3b){return{'model':db[_0x41fb3b['model']],'as':_0x41fb3b['as'],'attributes':_0x41fb3b[_0x4a3a('0x1d')],'include':_0x41fb3b[_0x4a3a('0x1e')]?_[_0x4a3a('0x1f')](_0x41fb3b[_0x4a3a('0x1e')],function(_0x407ea1){return{'model':db[_0x407ea1[_0x4a3a('0x20')]],'as':_0x407ea1['as'],'attributes':_0x407ea1[_0x4a3a('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xe4549){logger[_0x4a3a('0xf')](_0x4a3a('0x22'),_0x1a2502);logger['debug'](_0x4a3a('0x22'),_0x1a2502,JSON[_0x4a3a('0x21')](_0xe4549));_0x431650(_0xe4549);})[_0x4a3a('0x17')](function(_0x2c1d6d){logger[_0x4a3a('0x14')](_0x4a3a('0x22'),_0x2c1d6d[_0x4a3a('0x16')],_0x1a2502);_0x59a728(_0x482565['error'](0x1f4,_0x2c1d6d[_0x4a3a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 628a783..ff17eae 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 _0xc726=['remove','update','emit','length','./voiceQueue.events'];(function(_0x95dbd7,_0x537d57){var _0x482fd4=function(_0x14c2b7){while(--_0x14c2b7){_0x95dbd7['push'](_0x95dbd7['shift']());}};_0x482fd4(++_0x537d57);}(_0xc726,0x130));var _0x6c72=function(_0x235e59,_0x2a015d){_0x235e59=_0x235e59-0x0;var _0x19aa97=_0xc726[_0x235e59];return _0x19aa97;};'use strict';var VoiceQueueEvents=require(_0x6c72('0x0'));var events=['save',_0x6c72('0x1'),_0x6c72('0x2')];function createListener(_0x542466,_0x20175c){return function(_0x23daff){_0x20175c[_0x6c72('0x3')](_0x542466,_0x23daff);};}function removeListener(_0x4a0f9b,_0x51fa9c){return function(){VoiceQueueEvents['removeListener'](_0x4a0f9b,_0x51fa9c);};}exports['register']=function(_0x58ac57){for(var _0x580431=0x0,_0x78e799=events[_0x6c72('0x4')];_0x580431<_0x78e799;_0x580431++){var _0x370a25=events[_0x580431];var _0x5f1f92=createListener('voiceQueue:'+_0x370a25,_0x58ac57);VoiceQueueEvents['on'](_0x370a25,_0x5f1f92);}}; \ No newline at end of file +var _0xcb18=['save','update','emit','register','length','voiceQueue:','./voiceQueue.events'];(function(_0x5f29f2,_0x36bb62){var _0x5339dd=function(_0x511975){while(--_0x511975){_0x5f29f2['push'](_0x5f29f2['shift']());}};_0x5339dd(++_0x36bb62);}(_0xcb18,0x6f));var _0x8cb1=function(_0x261284,_0x23e594){_0x261284=_0x261284-0x0;var _0xc37bd0=_0xcb18[_0x261284];return _0xc37bd0;};'use strict';var VoiceQueueEvents=require(_0x8cb1('0x0'));var events=[_0x8cb1('0x1'),'remove',_0x8cb1('0x2')];function createListener(_0x45af05,_0x26fd28){return function(_0x40014a){_0x26fd28[_0x8cb1('0x3')](_0x45af05,_0x40014a);};}function removeListener(_0x835851,_0x1d55e9){return function(){VoiceQueueEvents['removeListener'](_0x835851,_0x1d55e9);};}exports[_0x8cb1('0x4')]=function(_0x2d57e5){for(var _0x540ae5=0x0,_0x2317ed=events[_0x8cb1('0x5')];_0x540ae5<_0x2317ed;_0x540ae5++){var _0x4d19e6=events[_0x540ae5];var _0x25f002=createListener(_0x8cb1('0x6')+_0x4d19e6,_0x2d57e5);VoiceQueueEvents['on'](_0x4d19e6,_0x25f002);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index dcfdd2c..d88faa2 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 _0xe64a=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','describe','/index','/:id','show','post','create','update'];(function(_0x5473e5,_0x34da63){var _0x296320=function(_0x261d5d){while(--_0x261d5d){_0x5473e5['push'](_0x5473e5['shift']());}};_0x296320(++_0x34da63);}(_0xe64a,0x1e2));var _0xae64=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe64a[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xae64('0x0'));var util=require(_0xae64('0x1'));var path=require(_0xae64('0x2'));var timeout=require('connect-timeout');var express=require(_0xae64('0x3'));var router=express[_0xae64('0x4')]();var fs_extra=require(_0xae64('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xae64('0x6'));var config=require('../../config/environment');var controller=require(_0xae64('0x7'));router[_0xae64('0x8')]('/',auth[_0xae64('0x9')](),controller[_0xae64('0xa')]);router[_0xae64('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xae64('0xb')]);router[_0xae64('0x8')](_0xae64('0xc'),auth[_0xae64('0x9')](),controller['getVoiceQueuesReport']);router[_0xae64('0x8')](_0xae64('0xd'),auth[_0xae64('0x9')](),controller[_0xae64('0xe')]);router[_0xae64('0xf')]('/',auth[_0xae64('0x9')](),controller[_0xae64('0x10')]);router['put'](_0xae64('0xd'),auth[_0xae64('0x9')](),controller[_0xae64('0x11')]);router['delete'](_0xae64('0xd'),auth[_0xae64('0x9')](),controller[_0xae64('0x12')]);module[_0xae64('0x13')]=router; \ No newline at end of file +var _0xeb35=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','/:id','show','post','create','put','update','destroy','exports','multer','express'];(function(_0x243424,_0x564387){var _0x4f2dfe=function(_0x12877a){while(--_0x12877a){_0x243424['push'](_0x243424['shift']());}};_0x4f2dfe(++_0x564387);}(_0xeb35,0x15e));var _0x5eb3=function(_0x2968a3,_0x2741ab){_0x2968a3=_0x2968a3-0x0;var _0x345774=_0xeb35[_0x2968a3];return _0x345774;};'use strict';var multer=require(_0x5eb3('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5eb3('0x1'));var router=express[_0x5eb3('0x2')]();var fs_extra=require(_0x5eb3('0x3'));var auth=require(_0x5eb3('0x4'));var interaction=require(_0x5eb3('0x5'));var config=require(_0x5eb3('0x6'));var controller=require('./voiceQueueReport.controller');router[_0x5eb3('0x7')]('/',auth[_0x5eb3('0x8')](),controller[_0x5eb3('0x9')]);router[_0x5eb3('0x7')](_0x5eb3('0xa'),auth[_0x5eb3('0x8')](),controller[_0x5eb3('0xb')]);router[_0x5eb3('0x7')](_0x5eb3('0xc'),auth[_0x5eb3('0x8')](),controller[_0x5eb3('0xd')]);router[_0x5eb3('0x7')](_0x5eb3('0xe'),auth['isAuthenticated'](),controller[_0x5eb3('0xf')]);router[_0x5eb3('0x10')]('/',auth['isAuthenticated'](),controller[_0x5eb3('0x11')]);router[_0x5eb3('0x12')](_0x5eb3('0xe'),auth[_0x5eb3('0x8')](),controller[_0x5eb3('0x13')]);router['delete'](_0x5eb3('0xe'),auth[_0x5eb3('0x8')](),controller[_0x5eb3('0x14')]);module[_0x5eb3('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index fb4146e..51fb850 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 _0xc2e7=['diff','setDataValue','holdtime','INTEGER','BOOLEAN','DATE','FORWARD,\x20BLIND,\x20ATTENDED','STRING','getDataValue','queuecallerjoinAt','format'];(function(_0x52761c,_0x40a3fe){var _0x115499=function(_0x335302){while(--_0x335302){_0x52761c['push'](_0x52761c['shift']());}};_0x115499(++_0x40a3fe);}(_0xc2e7,0x19e));var _0x7c2e=function(_0x50a806,_0x58c826){_0x50a806=_0x50a806-0x0;var _0x2c89d2=_0xc2e7[_0x50a806];return _0x2c89d2;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7c2e('0x0')]},'calleridnum':{'type':Sequelize[_0x7c2e('0x0')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x7c2e('0x0')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0xf1d49b){var _0x566a5c=moment(_0xf1d49b);var _0x22a289=moment(this[_0x7c2e('0x1')](_0x7c2e('0x2')))[_0x7c2e('0x3')]('YYYY-MM-DD\x20HH:mm:ss');var _0x4b1af3=_0x566a5c[_0x7c2e('0x4')](_0x22a289,'seconds');this[_0x7c2e('0x5')]('queuecallerleaveAt',_0xf1d49b);this[_0x7c2e('0x5')](_0x7c2e('0x6'),_0x4b1af3||null);}},'position':{'type':Sequelize[_0x7c2e('0x7')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x7c2e('0x8')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x7c2e('0x9')]},'queuecallerexit':{'type':Sequelize[_0x7c2e('0x8')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x7c2e('0x9')]},'queuecallerexitreason':{'type':Sequelize[_0x7c2e('0x0')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x7c2e('0x7')]},'channel':{'type':Sequelize[_0x7c2e('0x0')]},'connectedlinenum':{'type':Sequelize[_0x7c2e('0x0')]},'connectedlinename':{'type':Sequelize[_0x7c2e('0x0')]},'accountcode':{'type':Sequelize[_0x7c2e('0x0')]},'context':{'type':Sequelize[_0x7c2e('0x0')]},'exten':{'type':Sequelize[_0x7c2e('0x0')]},'priority':{'type':Sequelize[_0x7c2e('0x0')]},'holdtime':{'type':Sequelize[_0x7c2e('0x7')]},'mohtime':{'type':Sequelize[_0x7c2e('0x7')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7c2e('0x8')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x7c2e('0x0')]},'transfer':{'type':Sequelize[_0x7c2e('0x8')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7c2e('0x0')],'comment':_0x7c2e('0xa')},'transferexten':{'type':Sequelize[_0x7c2e('0x0')]},'transferuniqueid':{'type':Sequelize[_0x7c2e('0x0')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x7c2e('0x0')]},'thirdDisposition':{'type':Sequelize[_0x7c2e('0x0')]},'queuecallerenterreason':{'type':Sequelize[_0x7c2e('0x7')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb171=['FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','DATE','queuecallerjoinAt','diff','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x459443,_0x27d3e9){var _0x5df86e=function(_0x1707dd){while(--_0x1707dd){_0x459443['push'](_0x459443['shift']());}};_0x5df86e(++_0x27d3e9);}(_0xb171,0x83));var _0x1b17=function(_0x4e008a,_0xa5d6ec){_0x4e008a=_0x4e008a-0x0;var _0xcf74ea=_0xb171[_0x4e008a];return _0xcf74ea;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x1b17('0x0'));module[_0x1b17('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x1b17('0x2')]},'calleridnum':{'type':Sequelize[_0x1b17('0x2')]},'calleridname':{'type':Sequelize[_0x1b17('0x2')]},'queue':{'type':Sequelize[_0x1b17('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x1b17('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x1b17('0x3')],'set':function(_0x1cb12b){var _0x84a117=moment(_0x1cb12b);var _0x47fcc9=moment(this['getDataValue'](_0x1b17('0x4')))['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x52ff43=_0x84a117[_0x1b17('0x5')](_0x47fcc9,'seconds');this[_0x1b17('0x6')](_0x1b17('0x7'),_0x1cb12b);this['setDataValue'](_0x1b17('0x8'),_0x52ff43||null);}},'position':{'type':Sequelize[_0x1b17('0x9')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x1b17('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x1b17('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x1b17('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x1b17('0x2')],'comment':_0x1b17('0xb')},'originalposition':{'type':Sequelize[_0x1b17('0x9')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x1b17('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x1b17('0x2')]},'context':{'type':Sequelize[_0x1b17('0x2')]},'exten':{'type':Sequelize[_0x1b17('0x2')]},'priority':{'type':Sequelize[_0x1b17('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x1b17('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x1b17('0x2')]},'transfer':{'type':Sequelize[_0x1b17('0xa')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x1b17('0x2')],'comment':_0x1b17('0xc')},'transferexten':{'type':Sequelize[_0x1b17('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x1b17('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 8017211..476a934 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 _0x6045=['filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','body','getVoiceQueuesReport','findAll','eml-format','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','offset','order','sort','where'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0x6045,0xa8));var _0x5604=function(_0x3684ba,_0x51c305){_0x3684ba=_0x3684ba-0x0;var _0x4d4cf8=_0x6045[_0x3684ba];return _0x4d4cf8;};'use strict';var emlformat=require(_0x5604('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(_0x5604('0x1'));var Mustache=require(_0x5604('0x2'));var util=require('util');var path=require(_0x5604('0x3'));var sox=require(_0x5604('0x4'));var csv=require(_0x5604('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5604('0x6'));var _=require(_0x5604('0x7'));var squel=require(_0x5604('0x8'));var crypto=require('crypto');var jsforce=require(_0x5604('0x9'));var deskjs=require(_0x5604('0xa'));var toCsv=require(_0x5604('0x5'));var querystring=require('querystring');var Papa=require(_0x5604('0xb'));var Redis=require('ioredis');var authService=require(_0x5604('0xc'));var qs=require(_0x5604('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5604('0xe'));var logger=require('../../config/logger')(_0x5604('0xf'));var utils=require(_0x5604('0x10'));var config=require(_0x5604('0x11'));var licenseUtil=require(_0x5604('0x12'));var db=require(_0x5604('0x13'))['db'];config[_0x5604('0x14')]=_[_0x5604('0x15')](config[_0x5604('0x14')],{'host':_0x5604('0x16'),'port':0x18eb});var socket=require(_0x5604('0x17'))(new Redis(config['redis']));require(_0x5604('0x18'))['register'](socket);function respondWithStatusCode(_0x34160e,_0x375951){_0x375951=_0x375951||0xcc;return function(_0x3f9dc0){if(_0x3f9dc0){return _0x34160e[_0x5604('0x19')](_0x375951);}return _0x34160e[_0x5604('0x1a')](_0x375951)[_0x5604('0x1b')]();};}function respondWithResult(_0x32f953,_0x39f164){_0x39f164=_0x39f164||0xc8;return function(_0x18a957){if(_0x18a957){return _0x32f953[_0x5604('0x1a')](_0x39f164)[_0x5604('0x1c')](_0x18a957);}};}function respondWithFilteredResult(_0x386829,_0x59107a){return function(_0x51b80c){if(_0x51b80c){var _0x3c24a1=typeof _0x59107a['offset']==='undefined'&&typeof _0x59107a['limit']==='undefined';var _0x3b95e8=_0x51b80c[_0x5604('0x1d')];var _0x5cff47=_0x3c24a1?0x0:_0x59107a['offset'];var _0x43bd26=_0x3c24a1?_0x51b80c[_0x5604('0x1d')]:_0x59107a['offset']+_0x59107a[_0x5604('0x1e')];var _0x46f5a4;if(_0x43bd26>=_0x3b95e8){_0x43bd26=_0x3b95e8;_0x46f5a4=0xc8;}else{_0x46f5a4=0xce;}_0x386829['status'](_0x46f5a4);return _0x386829[_0x5604('0x1f')](_0x5604('0x20'),_0x5cff47+'-'+_0x43bd26+'/'+_0x3b95e8)[_0x5604('0x1c')](_0x51b80c);}return null;};}function patchUpdates(_0xbb5d8a){return function(_0x41584f){try{jsonpatch[_0x5604('0x21')](_0x41584f,_0xbb5d8a,!![]);}catch(_0x5d5276){return BPromise[_0x5604('0x22')](_0x5d5276);}return _0x41584f['save']();};}function saveUpdates(_0x19cb94,_0x453046){return function(_0x13f079){if(_0x13f079){return _0x13f079[_0x5604('0x23')](_0x19cb94)[_0x5604('0x24')](function(_0x18c516){return _0x18c516;});}return null;};}function removeEntity(_0x57cb22,_0x5b343c){return function(_0x1f011a){if(_0x1f011a){return _0x1f011a[_0x5604('0x25')]()['then'](function(){_0x57cb22['status'](0xcc)[_0x5604('0x1b')]();});}};}function handleEntityNotFound(_0x2b0489,_0x3b69c9){return function(_0x1f6904){if(!_0x1f6904){_0x2b0489[_0x5604('0x19')](0x194);}return _0x1f6904;};}function handleError(_0x191fe1,_0x105224){_0x105224=_0x105224||0x1f4;return function(_0x16dc00){logger[_0x5604('0x26')](_0x16dc00['stack']);if(_0x16dc00[_0x5604('0x27')]){delete _0x16dc00[_0x5604('0x27')];}_0x191fe1[_0x5604('0x1a')](_0x105224)[_0x5604('0x28')](_0x16dc00);};}exports[_0x5604('0x29')]=function(_0x564ec0,_0x1e105f){var _0xa19ae6={},_0x5e4b74={},_0x946043={'count':0x0,'rows':[]};var _0x5268fb=_[_0x5604('0x2a')](db[_0x5604('0x2b')][_0x5604('0x2c')],function(_0x1c4307){return{'name':_0x1c4307[_0x5604('0x2d')],'type':_0x1c4307[_0x5604('0x2e')]['key']};});_0x5e4b74['model']=_[_0x5604('0x2a')](_0x5268fb,_0x5604('0x27'));_0x5e4b74[_0x5604('0x2f')]=_[_0x5604('0x30')](_0x564ec0[_0x5604('0x2f')]);_0x5e4b74[_0x5604('0x31')]=_[_0x5604('0x32')](_0x5e4b74['model'],_0x5e4b74[_0x5604('0x2f')]);_0xa19ae6[_0x5604('0x33')]=_['intersection'](_0x5e4b74[_0x5604('0x34')],qs[_0x5604('0x35')](_0x564ec0[_0x5604('0x2f')][_0x5604('0x35')]));_0xa19ae6['attributes']=_0xa19ae6[_0x5604('0x33')]['length']?_0xa19ae6[_0x5604('0x33')]:_0x5e4b74['model'];if(!_0x564ec0[_0x5604('0x2f')][_0x5604('0x36')](_0x5604('0x37'))){_0xa19ae6[_0x5604('0x1e')]=qs['limit'](_0x564ec0['query'][_0x5604('0x1e')]);_0xa19ae6[_0x5604('0x38')]=qs[_0x5604('0x38')](_0x564ec0[_0x5604('0x2f')][_0x5604('0x38')]);}_0xa19ae6[_0x5604('0x39')]=qs[_0x5604('0x3a')](_0x564ec0['query'][_0x5604('0x3a')]);_0xa19ae6[_0x5604('0x3b')]=qs[_0x5604('0x31')](_['pick'](_0x564ec0[_0x5604('0x2f')],_0x5e4b74[_0x5604('0x31')]),_0x5268fb);if(_0x564ec0[_0x5604('0x2f')][_0x5604('0x3c')]){_0xa19ae6[_0x5604('0x3b')]=_[_0x5604('0x3d')](_0xa19ae6['where'],{'$or':_[_0x5604('0x2a')](_0x5268fb,function(_0x3734a9){if(_0x3734a9['type']!==_0x5604('0x3e')){var _0x5cea24={};_0x5cea24[_0x3734a9[_0x5604('0x27')]]={'$like':'%'+_0x564ec0[_0x5604('0x2f')][_0x5604('0x3c')]+'%'};return _0x5cea24;}})});}_0xa19ae6=_[_0x5604('0x3d')]({},_0xa19ae6,_0x564ec0[_0x5604('0x3f')]);var _0x4ae1f7={'where':_0xa19ae6[_0x5604('0x3b')]};return db[_0x5604('0x2b')][_0x5604('0x1d')](_0x4ae1f7)[_0x5604('0x24')](function(_0x3f6cf3){_0x946043[_0x5604('0x1d')]=_0x3f6cf3;if(_0x564ec0[_0x5604('0x2f')][_0x5604('0x40')]){_0xa19ae6[_0x5604('0x41')]=[{'all':!![]}];}return db[_0x5604('0x2b')]['findAll'](_0xa19ae6);})[_0x5604('0x24')](function(_0x1bb98a){_0x946043[_0x5604('0x42')]=_0x1bb98a;return _0x946043;})[_0x5604('0x24')](respondWithFilteredResult(_0x1e105f,_0xa19ae6))[_0x5604('0x43')](handleError(_0x1e105f,null));};exports[_0x5604('0x44')]=function(_0x289994,_0x390407){var _0x590877={'raw':![],'where':{'id':_0x289994[_0x5604('0x45')]['id']}},_0x34d90a={};_0x34d90a['model']=_[_0x5604('0x30')](db[_0x5604('0x2b')][_0x5604('0x2c')]);_0x34d90a[_0x5604('0x2f')]=_[_0x5604('0x30')](_0x289994['query']);_0x34d90a[_0x5604('0x31')]=_[_0x5604('0x32')](_0x34d90a[_0x5604('0x34')],_0x34d90a['query']);_0x590877[_0x5604('0x33')]=_[_0x5604('0x32')](_0x34d90a[_0x5604('0x34')],qs[_0x5604('0x35')](_0x289994['query'][_0x5604('0x35')]));_0x590877[_0x5604('0x33')]=_0x590877[_0x5604('0x33')][_0x5604('0x46')]?_0x590877[_0x5604('0x33')]:_0x34d90a['model'];if(_0x289994[_0x5604('0x2f')][_0x5604('0x40')]){_0x590877[_0x5604('0x41')]=[{'all':!![]}];}_0x590877=_[_0x5604('0x3d')]({},_0x590877,_0x289994['options']);return db[_0x5604('0x2b')][_0x5604('0x47')](_0x590877)[_0x5604('0x24')](handleEntityNotFound(_0x390407,null))['then'](respondWithResult(_0x390407,null))[_0x5604('0x43')](handleError(_0x390407,null));};exports[_0x5604('0x48')]=function(_0x4ce1e1,_0x138c4f){return db[_0x5604('0x2b')]['create'](_0x4ce1e1[_0x5604('0x49')],{})[_0x5604('0x24')](respondWithResult(_0x138c4f,0xc9))['catch'](handleError(_0x138c4f,null));};exports[_0x5604('0x23')]=function(_0xc627a0,_0x400160){if(_0xc627a0[_0x5604('0x49')]['id']){delete _0xc627a0['body']['id'];}return db['VoiceQueueReport'][_0x5604('0x47')]({'where':{'id':_0xc627a0['params']['id']}})['then'](handleEntityNotFound(_0x400160,null))[_0x5604('0x24')](saveUpdates(_0xc627a0[_0x5604('0x49')],null))['then'](respondWithResult(_0x400160,null))['catch'](handleError(_0x400160,null));};exports['destroy']=function(_0xbda332,_0x2da284){return db[_0x5604('0x2b')][_0x5604('0x47')]({'where':{'id':_0xbda332[_0x5604('0x45')]['id']}})['then'](handleEntityNotFound(_0x2da284,null))[_0x5604('0x24')](removeEntity(_0x2da284,null))['catch'](handleError(_0x2da284,null));};exports['describe']=function(_0x554296,_0x4af4f4){return db[_0x5604('0x2b')]['describe']()[_0x5604('0x24')](respondWithResult(_0x4af4f4,null))[_0x5604('0x43')](handleError(_0x4af4f4,null));};exports[_0x5604('0x4a')]=function(_0x5b9a51,_0x5db057){var _0x2fc2c6={},_0x102eb9={},_0x4bf474={'count':0x0,'rows':[]};_0x102eb9['model']=_[_0x5604('0x30')](db[_0x5604('0x2b')]['rawAttributes']);_0x102eb9['query']=_[_0x5604('0x30')](_0x5b9a51[_0x5604('0x2f')]);_0x102eb9[_0x5604('0x31')]=_['intersection'](_0x102eb9[_0x5604('0x34')],_0x102eb9[_0x5604('0x2f')]);_0x2fc2c6[_0x5604('0x33')]=_[_0x5604('0x32')](_0x102eb9['model'],qs[_0x5604('0x35')](_0x5b9a51[_0x5604('0x2f')]['fields']));_0x2fc2c6[_0x5604('0x33')]=_0x2fc2c6[_0x5604('0x33')]['length']?_0x2fc2c6[_0x5604('0x33')]:_0x102eb9[_0x5604('0x34')];if(!_0x5b9a51[_0x5604('0x2f')][_0x5604('0x36')]('nolimit')){_0x2fc2c6['limit']=qs[_0x5604('0x1e')](_0x5b9a51[_0x5604('0x2f')][_0x5604('0x1e')]);_0x2fc2c6[_0x5604('0x38')]=qs[_0x5604('0x38')](_0x5b9a51[_0x5604('0x2f')]['offset']);}_0x2fc2c6[_0x5604('0x39')]=qs[_0x5604('0x3a')](_0x5b9a51[_0x5604('0x2f')][_0x5604('0x3a')]);_0x2fc2c6[_0x5604('0x3b')]=qs['filters'](_['pick'](_0x5b9a51[_0x5604('0x2f')],_0x102eb9[_0x5604('0x31')]));if(_0x5b9a51[_0x5604('0x2f')]['filter']){_0x2fc2c6['where']=_[_0x5604('0x3d')](_0x2fc2c6[_0x5604('0x3b')],{'$or':_[_0x5604('0x2a')](_0x2fc2c6[_0x5604('0x33')],function(_0x46d53c){var _0x47692c={};_0x47692c[_0x46d53c]={'$like':'%'+_0x5b9a51[_0x5604('0x2f')]['filter']+'%'};return _0x47692c;})});}_0x2fc2c6=_[_0x5604('0x3d')]({},_0x2fc2c6,_0x5b9a51[_0x5604('0x3f')]);var _0xe7cd78={'where':_0x2fc2c6[_0x5604('0x3b')]};return db[_0x5604('0x2b')][_0x5604('0x1d')](_0xe7cd78)[_0x5604('0x24')](function(_0x346128){_0x4bf474[_0x5604('0x1d')]=_0x346128;if(_0x5b9a51[_0x5604('0x2f')][_0x5604('0x40')]){_0x2fc2c6['include']=[{'all':!![]}];}return db[_0x5604('0x2b')][_0x5604('0x4b')](_0x2fc2c6);})[_0x5604('0x24')](function(_0x53e0e1){_0x4bf474['rows']=_0x53e0e1;return _0x4bf474;})[_0x5604('0x24')](respondWithFilteredResult(_0x5db057,_0x2fc2c6,_0x5604('0x4a')))[_0x5604('0x43')](handleError(_0x5db057,null,_0x5604('0x4a')));}; \ No newline at end of file +var _0xa5e2=['then','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','VoiceQueueReport','includeAll','include','findAll','rows','catch','find','create','body','params','describe','order','options','getVoiceQueuesReport','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa5e2,0xd2));var _0x2a5e=function(_0x393b69,_0xf9b1d9){_0x393b69=_0x393b69-0x0;var _0x88c63=_0xa5e2[_0x393b69];return _0x88c63;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2a5e('0x0'));var zipdir=require(_0x2a5e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2a5e('0x2'));var moment=require(_0x2a5e('0x3'));var BPromise=require(_0x2a5e('0x4'));var Mustache=require(_0x2a5e('0x5'));var util=require(_0x2a5e('0x6'));var path=require(_0x2a5e('0x7'));var sox=require('sox');var csv=require(_0x2a5e('0x8'));var ejs=require(_0x2a5e('0x9'));var fs=require('fs');var fs_extra=require(_0x2a5e('0xa'));var _=require(_0x2a5e('0xb'));var squel=require('squel');var crypto=require(_0x2a5e('0xc'));var jsforce=require(_0x2a5e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2a5e('0x8'));var querystring=require(_0x2a5e('0xe'));var Papa=require(_0x2a5e('0xf'));var Redis=require(_0x2a5e('0x10'));var authService=require(_0x2a5e('0x11'));var qs=require(_0x2a5e('0x12'));var as=require(_0x2a5e('0x13'));var hardwareService=require(_0x2a5e('0x14'));var logger=require(_0x2a5e('0x15'))(_0x2a5e('0x16'));var utils=require('../../config/utils');var config=require(_0x2a5e('0x17'));var licenseUtil=require(_0x2a5e('0x18'));var db=require('../../mysqldb')['db'];config[_0x2a5e('0x19')]=_['defaults'](config[_0x2a5e('0x19')],{'host':_0x2a5e('0x1a'),'port':0x18eb});var socket=require(_0x2a5e('0x1b'))(new Redis(config[_0x2a5e('0x19')]));require(_0x2a5e('0x1c'))[_0x2a5e('0x1d')](socket);function respondWithStatusCode(_0x3f24ee,_0x536a86){_0x536a86=_0x536a86||0xcc;return function(_0x163af7){if(_0x163af7){return _0x3f24ee[_0x2a5e('0x1e')](_0x536a86);}return _0x3f24ee[_0x2a5e('0x1f')](_0x536a86)['end']();};}function respondWithResult(_0x219e56,_0x1dfce1){_0x1dfce1=_0x1dfce1||0xc8;return function(_0x31195e){if(_0x31195e){return _0x219e56['status'](_0x1dfce1)[_0x2a5e('0x20')](_0x31195e);}};}function respondWithFilteredResult(_0x318d14,_0x13b9fa){return function(_0x307e5f){if(_0x307e5f){var _0x5236c6=typeof _0x13b9fa[_0x2a5e('0x21')]===_0x2a5e('0x22')&&typeof _0x13b9fa[_0x2a5e('0x23')]==='undefined';var _0x354ae1=_0x307e5f[_0x2a5e('0x24')];var _0x4208fe=_0x5236c6?0x0:_0x13b9fa['offset'];var _0x38e766=_0x5236c6?_0x307e5f[_0x2a5e('0x24')]:_0x13b9fa['offset']+_0x13b9fa[_0x2a5e('0x23')];var _0x1ff41d;if(_0x38e766>=_0x354ae1){_0x38e766=_0x354ae1;_0x1ff41d=0xc8;}else{_0x1ff41d=0xce;}_0x318d14[_0x2a5e('0x1f')](_0x1ff41d);return _0x318d14[_0x2a5e('0x25')]('Content-Range',_0x4208fe+'-'+_0x38e766+'/'+_0x354ae1)[_0x2a5e('0x20')](_0x307e5f);}return null;};}function patchUpdates(_0x3a408a){return function(_0x2df6bc){try{jsonpatch[_0x2a5e('0x26')](_0x2df6bc,_0x3a408a,!![]);}catch(_0x295894){return BPromise[_0x2a5e('0x27')](_0x295894);}return _0x2df6bc[_0x2a5e('0x28')]();};}function saveUpdates(_0x406464,_0x41f60b){return function(_0x5ebbb8){if(_0x5ebbb8){return _0x5ebbb8[_0x2a5e('0x29')](_0x406464)[_0x2a5e('0x2a')](function(_0x577b96){return _0x577b96;});}return null;};}function removeEntity(_0x4f36a7,_0x29c99b){return function(_0x5d05e7){if(_0x5d05e7){return _0x5d05e7[_0x2a5e('0x2b')]()[_0x2a5e('0x2a')](function(){_0x4f36a7['status'](0xcc)[_0x2a5e('0x2c')]();});}};}function handleEntityNotFound(_0x495723,_0x8122e4){return function(_0x5a9397){if(!_0x5a9397){_0x495723[_0x2a5e('0x1e')](0x194);}return _0x5a9397;};}function handleError(_0x62f127,_0x190766){_0x190766=_0x190766||0x1f4;return function(_0x1d99a6){logger[_0x2a5e('0x2d')](_0x1d99a6[_0x2a5e('0x2e')]);if(_0x1d99a6[_0x2a5e('0x2f')]){delete _0x1d99a6[_0x2a5e('0x2f')];}_0x62f127[_0x2a5e('0x1f')](_0x190766)['send'](_0x1d99a6);};}exports[_0x2a5e('0x30')]=function(_0x590b79,_0x2ddfe3){var _0x7d95c8={},_0x434bd3={},_0x16e7d3={'count':0x0,'rows':[]};var _0x108674=_[_0x2a5e('0x31')](db['VoiceQueueReport'][_0x2a5e('0x32')],function(_0x2f447c){return{'name':_0x2f447c[_0x2a5e('0x33')],'type':_0x2f447c[_0x2a5e('0x34')][_0x2a5e('0x35')]};});_0x434bd3['model']=_['map'](_0x108674,_0x2a5e('0x2f'));_0x434bd3['query']=_[_0x2a5e('0x36')](_0x590b79[_0x2a5e('0x37')]);_0x434bd3[_0x2a5e('0x38')]=_[_0x2a5e('0x39')](_0x434bd3[_0x2a5e('0x3a')],_0x434bd3[_0x2a5e('0x37')]);_0x7d95c8[_0x2a5e('0x3b')]=_['intersection'](_0x434bd3[_0x2a5e('0x3a')],qs[_0x2a5e('0x3c')](_0x590b79[_0x2a5e('0x37')]['fields']));_0x7d95c8[_0x2a5e('0x3b')]=_0x7d95c8[_0x2a5e('0x3b')][_0x2a5e('0x3d')]?_0x7d95c8[_0x2a5e('0x3b')]:_0x434bd3[_0x2a5e('0x3a')];if(!_0x590b79['query'][_0x2a5e('0x3e')](_0x2a5e('0x3f'))){_0x7d95c8['limit']=qs['limit'](_0x590b79[_0x2a5e('0x37')][_0x2a5e('0x23')]);_0x7d95c8[_0x2a5e('0x21')]=qs[_0x2a5e('0x21')](_0x590b79[_0x2a5e('0x37')][_0x2a5e('0x21')]);}_0x7d95c8['order']=qs[_0x2a5e('0x40')](_0x590b79[_0x2a5e('0x37')][_0x2a5e('0x40')]);_0x7d95c8[_0x2a5e('0x41')]=qs[_0x2a5e('0x38')](_[_0x2a5e('0x42')](_0x590b79[_0x2a5e('0x37')],_0x434bd3[_0x2a5e('0x38')]),_0x108674);if(_0x590b79[_0x2a5e('0x37')]['filter']){_0x7d95c8[_0x2a5e('0x41')]=_[_0x2a5e('0x43')](_0x7d95c8[_0x2a5e('0x41')],{'$or':_[_0x2a5e('0x31')](_0x108674,function(_0x3d15dd){if(_0x3d15dd[_0x2a5e('0x34')]!==_0x2a5e('0x44')){var _0x1b47cc={};_0x1b47cc[_0x3d15dd[_0x2a5e('0x2f')]]={'$like':'%'+_0x590b79[_0x2a5e('0x37')][_0x2a5e('0x45')]+'%'};return _0x1b47cc;}})});}_0x7d95c8=_['merge']({},_0x7d95c8,_0x590b79['options']);var _0x1e7348={'where':_0x7d95c8['where']};return db[_0x2a5e('0x46')][_0x2a5e('0x24')](_0x1e7348)[_0x2a5e('0x2a')](function(_0x280fdb){_0x16e7d3[_0x2a5e('0x24')]=_0x280fdb;if(_0x590b79[_0x2a5e('0x37')][_0x2a5e('0x47')]){_0x7d95c8[_0x2a5e('0x48')]=[{'all':!![]}];}return db[_0x2a5e('0x46')][_0x2a5e('0x49')](_0x7d95c8);})[_0x2a5e('0x2a')](function(_0x30c891){_0x16e7d3[_0x2a5e('0x4a')]=_0x30c891;return _0x16e7d3;})[_0x2a5e('0x2a')](respondWithFilteredResult(_0x2ddfe3,_0x7d95c8))[_0x2a5e('0x4b')](handleError(_0x2ddfe3,null));};exports['show']=function(_0x17128b,_0x52df5d){var _0x148f05={'raw':![],'where':{'id':_0x17128b['params']['id']}},_0x5829d8={};_0x5829d8[_0x2a5e('0x3a')]=_[_0x2a5e('0x36')](db[_0x2a5e('0x46')][_0x2a5e('0x32')]);_0x5829d8[_0x2a5e('0x37')]=_[_0x2a5e('0x36')](_0x17128b[_0x2a5e('0x37')]);_0x5829d8['filters']=_['intersection'](_0x5829d8[_0x2a5e('0x3a')],_0x5829d8[_0x2a5e('0x37')]);_0x148f05[_0x2a5e('0x3b')]=_[_0x2a5e('0x39')](_0x5829d8[_0x2a5e('0x3a')],qs[_0x2a5e('0x3c')](_0x17128b[_0x2a5e('0x37')][_0x2a5e('0x3c')]));_0x148f05[_0x2a5e('0x3b')]=_0x148f05[_0x2a5e('0x3b')]['length']?_0x148f05[_0x2a5e('0x3b')]:_0x5829d8['model'];if(_0x17128b['query'][_0x2a5e('0x47')]){_0x148f05[_0x2a5e('0x48')]=[{'all':!![]}];}_0x148f05=_[_0x2a5e('0x43')]({},_0x148f05,_0x17128b['options']);return db['VoiceQueueReport'][_0x2a5e('0x4c')](_0x148f05)['then'](handleEntityNotFound(_0x52df5d,null))[_0x2a5e('0x2a')](respondWithResult(_0x52df5d,null))['catch'](handleError(_0x52df5d,null));};exports['create']=function(_0x239a7c,_0x5cbc64){return db[_0x2a5e('0x46')][_0x2a5e('0x4d')](_0x239a7c[_0x2a5e('0x4e')],{})[_0x2a5e('0x2a')](respondWithResult(_0x5cbc64,0xc9))[_0x2a5e('0x4b')](handleError(_0x5cbc64,null));};exports['update']=function(_0x574696,_0x4043ce){if(_0x574696[_0x2a5e('0x4e')]['id']){delete _0x574696['body']['id'];}return db[_0x2a5e('0x46')]['find']({'where':{'id':_0x574696[_0x2a5e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4043ce,null))[_0x2a5e('0x2a')](saveUpdates(_0x574696[_0x2a5e('0x4e')],null))['then'](respondWithResult(_0x4043ce,null))[_0x2a5e('0x4b')](handleError(_0x4043ce,null));};exports[_0x2a5e('0x2b')]=function(_0x2f3d20,_0x4434eb){return db[_0x2a5e('0x46')][_0x2a5e('0x4c')]({'where':{'id':_0x2f3d20[_0x2a5e('0x4f')]['id']}})[_0x2a5e('0x2a')](handleEntityNotFound(_0x4434eb,null))[_0x2a5e('0x2a')](removeEntity(_0x4434eb,null))[_0x2a5e('0x4b')](handleError(_0x4434eb,null));};exports['describe']=function(_0x2f98f3,_0x2d4f91){return db[_0x2a5e('0x46')][_0x2a5e('0x50')]()[_0x2a5e('0x2a')](respondWithResult(_0x2d4f91,null))['catch'](handleError(_0x2d4f91,null));};exports['getVoiceQueuesReport']=function(_0x2a46bb,_0x24fa78){var _0x4fa56c={},_0x2bc12e={},_0x415865={'count':0x0,'rows':[]};_0x2bc12e[_0x2a5e('0x3a')]=_[_0x2a5e('0x36')](db[_0x2a5e('0x46')][_0x2a5e('0x32')]);_0x2bc12e[_0x2a5e('0x37')]=_[_0x2a5e('0x36')](_0x2a46bb[_0x2a5e('0x37')]);_0x2bc12e[_0x2a5e('0x38')]=_[_0x2a5e('0x39')](_0x2bc12e[_0x2a5e('0x3a')],_0x2bc12e[_0x2a5e('0x37')]);_0x4fa56c['attributes']=_[_0x2a5e('0x39')](_0x2bc12e[_0x2a5e('0x3a')],qs[_0x2a5e('0x3c')](_0x2a46bb[_0x2a5e('0x37')]['fields']));_0x4fa56c[_0x2a5e('0x3b')]=_0x4fa56c[_0x2a5e('0x3b')][_0x2a5e('0x3d')]?_0x4fa56c['attributes']:_0x2bc12e[_0x2a5e('0x3a')];if(!_0x2a46bb['query'][_0x2a5e('0x3e')](_0x2a5e('0x3f'))){_0x4fa56c['limit']=qs[_0x2a5e('0x23')](_0x2a46bb[_0x2a5e('0x37')][_0x2a5e('0x23')]);_0x4fa56c[_0x2a5e('0x21')]=qs[_0x2a5e('0x21')](_0x2a46bb[_0x2a5e('0x37')]['offset']);}_0x4fa56c[_0x2a5e('0x51')]=qs[_0x2a5e('0x40')](_0x2a46bb[_0x2a5e('0x37')][_0x2a5e('0x40')]);_0x4fa56c[_0x2a5e('0x41')]=qs['filters'](_[_0x2a5e('0x42')](_0x2a46bb[_0x2a5e('0x37')],_0x2bc12e['filters']));if(_0x2a46bb[_0x2a5e('0x37')][_0x2a5e('0x45')]){_0x4fa56c['where']=_[_0x2a5e('0x43')](_0x4fa56c[_0x2a5e('0x41')],{'$or':_[_0x2a5e('0x31')](_0x4fa56c[_0x2a5e('0x3b')],function(_0xd6e2b2){var _0xe740d3={};_0xe740d3[_0xd6e2b2]={'$like':'%'+_0x2a46bb[_0x2a5e('0x37')][_0x2a5e('0x45')]+'%'};return _0xe740d3;})});}_0x4fa56c=_[_0x2a5e('0x43')]({},_0x4fa56c,_0x2a46bb[_0x2a5e('0x52')]);var _0x4543ea={'where':_0x4fa56c[_0x2a5e('0x41')]};return db[_0x2a5e('0x46')][_0x2a5e('0x24')](_0x4543ea)[_0x2a5e('0x2a')](function(_0x491964){_0x415865['count']=_0x491964;if(_0x2a46bb[_0x2a5e('0x37')]['includeAll']){_0x4fa56c[_0x2a5e('0x48')]=[{'all':!![]}];}return db[_0x2a5e('0x46')][_0x2a5e('0x49')](_0x4fa56c);})['then'](function(_0x5bdac0){_0x415865[_0x2a5e('0x4a')]=_0x5bdac0;return _0x415865;})[_0x2a5e('0x2a')](respondWithFilteredResult(_0x24fa78,_0x4fa56c,'getVoiceQueuesReport'))[_0x2a5e('0x4b')](handleError(_0x24fa78,null,_0x2a5e('0x53')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 34ba199..8b704e4 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 _0x0f95=['exports','events','../../mysqldb','VoiceQueueReport','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x133fe4,_0x1f473b){var _0x4c4017=function(_0x3c1fb1){while(--_0x3c1fb1){_0x133fe4['push'](_0x133fe4['shift']());}};_0x4c4017(++_0x1f473b);}(_0x0f95,0x1af));var _0x50f9=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x0f95[_0x32f7d7];return _0x133d09;};'use strict';var EventEmitter=require(_0x50f9('0x0'));var VoiceQueueReport=require(_0x50f9('0x1'))['db'][_0x50f9('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x50f9('0x3'),'afterUpdate':_0x50f9('0x4'),'afterDestroy':_0x50f9('0x5')};function emitEvent(_0x36f280){return function(_0x5e5df7,_0x3a0429,_0x2fbe40){VoiceQueueReportEvents[_0x50f9('0x6')](_0x36f280+':'+_0x5e5df7['id'],_0x5e5df7);VoiceQueueReportEvents[_0x50f9('0x6')](_0x36f280,_0x5e5df7);_0x2fbe40(null);};}for(var e in events){if(events[_0x50f9('0x7')](e)){var event=events[e];VoiceQueueReport[_0x50f9('0x8')](e,emitEvent(event));}}module[_0x50f9('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x0a98=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','VoiceQueueReport'];(function(_0x51715b,_0xe852a9){var _0x3ba2e2=function(_0x565694){while(--_0x565694){_0x51715b['push'](_0x51715b['shift']());}};_0x3ba2e2(++_0xe852a9);}(_0x0a98,0x179));var _0x80a9=function(_0x2d27c9,_0x3303e7){_0x2d27c9=_0x2d27c9-0x0;var _0x32d6cc=_0x0a98[_0x2d27c9];return _0x32d6cc;};'use strict';var EventEmitter=require(_0x80a9('0x0'));var VoiceQueueReport=require(_0x80a9('0x1'))['db'][_0x80a9('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x80a9('0x3')](0x0);var events={'afterCreate':_0x80a9('0x4'),'afterUpdate':_0x80a9('0x5'),'afterDestroy':_0x80a9('0x6')};function emitEvent(_0x15b27c){return function(_0x4710f3,_0x109c06,_0x3e6126){VoiceQueueReportEvents[_0x80a9('0x7')](_0x15b27c+':'+_0x4710f3['id'],_0x4710f3);VoiceQueueReportEvents[_0x80a9('0x7')](_0x15b27c,_0x4710f3);_0x3e6126(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x80a9('0x8')](e,emitEvent(event));}}module[_0x80a9('0x9')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index d8d4d2a..4e5bde5 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 _0xceec=['report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','exports','define','VoiceQueueReport'];(function(_0x43167b,_0xbfaf5b){var _0x21c9b9=function(_0x203c11){while(--_0x203c11){_0x43167b['push'](_0x43167b['shift']());}};_0x21c9b9(++_0xbfaf5b);}(_0xceec,0x17c));var _0xccee=function(_0x25132c,_0x5846a5){_0x25132c=_0x25132c-0x0;var _0x2138da=_0xceec[_0x25132c];return _0x2138da;};'use strict';var _=require(_0xccee('0x0'));var util=require(_0xccee('0x1'));var logger=require(_0xccee('0x2'))('api');var moment=require('moment');var BPromise=require(_0xccee('0x3'));var rp=require(_0xccee('0x4'));var fs=require('fs');var path=require(_0xccee('0x5'));var rimraf=require('rimraf');var config=require(_0xccee('0x6'));var attributes=require('./voiceQueueReport.attributes');module[_0xccee('0x7')]=function(_0x1e238d,_0x4d7e89){return _0x1e238d[_0xccee('0x8')](_0xccee('0x9'),attributes,{'tableName':_0xccee('0xa'),'paranoid':![],'indexes':[{'fields':[_0xccee('0xb')]},{'fields':[_0xccee('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdcb2=['api','moment','bluebird','request-promise','../../config/environment','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger'];(function(_0x4616da,_0x330cd1){var _0x3aad1e=function(_0x4f37e2){while(--_0x4f37e2){_0x4616da['push'](_0x4616da['shift']());}};_0x3aad1e(++_0x330cd1);}(_0xdcb2,0xc9));var _0x2dcb=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xdcb2[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x2dcb('0x0'));var util=require(_0x2dcb('0x1'));var logger=require(_0x2dcb('0x2'))(_0x2dcb('0x3'));var moment=require(_0x2dcb('0x4'));var BPromise=require(_0x2dcb('0x5'));var rp=require(_0x2dcb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2dcb('0x7'));var attributes=require('./voiceQueueReport.attributes');module['exports']=function(_0x2537b3,_0x343eff){return _0x2537b3['define'](_0x2dcb('0x8'),attributes,{'tableName':_0x2dcb('0x9'),'paranoid':![],'indexes':[{'fields':[_0x2dcb('0xa')]},{'fields':[_0x2dcb('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 0709291..77c0c7d 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 _0x197b=['defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','where','attributes','include','map','model','CreateVoiceQueueReport','body','raw','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis'];(function(_0x4bd64d,_0x3c2b8a){var _0x37db2d=function(_0x5ca98f){while(--_0x5ca98f){_0x4bd64d['push'](_0x4bd64d['shift']());}};_0x37db2d(++_0x3c2b8a);}(_0x197b,0x12d));var _0xb197=function(_0x3face9,_0x16de50){_0x3face9=_0x3face9-0x0;var _0x3c239a=_0x197b[_0x3face9];return _0x3c239a;};'use strict';var _=require(_0xb197('0x0'));var util=require(_0xb197('0x1'));var moment=require(_0xb197('0x2'));var BPromise=require(_0xb197('0x3'));var rs=require(_0xb197('0x4'));var fs=require('fs');var Redis=require(_0xb197('0x5'));var db=require(_0xb197('0x6'))['db'];var utils=require(_0xb197('0x7'));var logger=require(_0xb197('0x8'))(_0xb197('0x9'));var config=require(_0xb197('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xb197('0xb')][_0xb197('0xc')]({'port':0x232a});config[_0xb197('0xd')]=_[_0xb197('0xe')](config['redis'],{'host':_0xb197('0xf'),'port':0x18eb});var socket=require(_0xb197('0x10'))(new Redis(config[_0xb197('0xd')]));require(_0xb197('0x11'))[_0xb197('0x12')](socket);function respondWithRpcPromise(_0x50994d,_0xef36d5,_0x24de03){return new BPromise(function(_0x622f4e,_0x4235f2){return client[_0xb197('0x13')](_0x50994d,_0x24de03)[_0xb197('0x14')](function(_0x25be31){logger[_0xb197('0x15')](_0xb197('0x16'),_0xef36d5,'request\x20sent');logger[_0xb197('0x17')](_0xb197('0x18'),_0xef36d5,_0xb197('0x19'),JSON[_0xb197('0x1a')](_0x25be31));if(_0x25be31[_0xb197('0x1b')]){if(_0x25be31[_0xb197('0x1b')][_0xb197('0x1c')]===0x1f4){logger[_0xb197('0x1b')](_0xb197('0x16'),_0xef36d5,_0x25be31[_0xb197('0x1b')]['message']);return _0x4235f2(_0x25be31[_0xb197('0x1b')]['message']);}logger['error'](_0xb197('0x16'),_0xef36d5,_0x25be31[_0xb197('0x1b')][_0xb197('0x1d')]);return _0x622f4e(_0x25be31[_0xb197('0x1b')][_0xb197('0x1d')]);}else{logger['info'](_0xb197('0x16'),_0xef36d5,_0xb197('0x19'));_0x622f4e(_0x25be31[_0xb197('0x1e')][_0xb197('0x1d')]);}})[_0xb197('0x1f')](function(_0x7c30cd){logger[_0xb197('0x1b')](_0xb197('0x16'),_0xef36d5,_0x7c30cd);_0x4235f2(_0x7c30cd);});});}exports[_0xb197('0x20')]=function(_0x301b1b){var _0x3b2794=this;return new Promise(function(_0x47d219,_0x1f469a){return db[_0xb197('0x21')]['findAll']({'raw':_0x301b1b[_0xb197('0x22')]?_0x301b1b[_0xb197('0x22')]['raw']===undefined?!![]:![]:!![],'where':_0x301b1b[_0xb197('0x22')]?_0x301b1b[_0xb197('0x22')][_0xb197('0x23')]||null:null,'attributes':_0x301b1b[_0xb197('0x22')]?_0x301b1b[_0xb197('0x22')][_0xb197('0x24')]||null:null,'limit':_0x301b1b[_0xb197('0x22')]?_0x301b1b[_0xb197('0x22')]['limit']||null:null,'include':_0x301b1b[_0xb197('0x22')]?_0x301b1b['options'][_0xb197('0x25')]?_[_0xb197('0x26')](_0x301b1b['options']['include'],function(_0x5bc0ef){return{'model':db[_0x5bc0ef[_0xb197('0x27')]],'as':_0x5bc0ef['as'],'attributes':_0x5bc0ef[_0xb197('0x24')],'include':_0x5bc0ef[_0xb197('0x25')]?_[_0xb197('0x26')](_0x5bc0ef['include'],function(_0x327fb5){return{'model':db[_0x327fb5[_0xb197('0x27')]],'as':_0x327fb5['as'],'attributes':_0x327fb5[_0xb197('0x24')],'include':_0x327fb5[_0xb197('0x25')]?_['map'](_0x327fb5['include'],function(_0x4852e6){return{'model':db[_0x4852e6[_0xb197('0x27')]],'as':_0x4852e6['as'],'attributes':_0x4852e6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x413006){logger[_0xb197('0x15')](_0xb197('0x20'),_0x301b1b);logger[_0xb197('0x17')](_0xb197('0x20'),_0x301b1b,JSON[_0xb197('0x1a')](_0x413006));_0x47d219(_0x413006);})['catch'](function(_0x57f804){logger['error'](_0xb197('0x20'),_0x57f804['message'],_0x301b1b);_0x1f469a(_0x3b2794[_0xb197('0x1b')](0x1f4,_0x57f804[_0xb197('0x1d')]));});});};exports[_0xb197('0x28')]=function(_0x33c3e7){var _0x246f97=this;return new Promise(function(_0x58fb42,_0x337740){return db[_0xb197('0x21')]['create'](_0x33c3e7[_0xb197('0x29')],{'raw':_0x33c3e7['options']?_0x33c3e7[_0xb197('0x22')][_0xb197('0x2a')]===undefined?!![]:![]:!![]})[_0xb197('0x14')](function(_0x6f987b){logger[_0xb197('0x15')](_0xb197('0x28'),_0x33c3e7);logger[_0xb197('0x17')](_0xb197('0x28'),_0x33c3e7,JSON[_0xb197('0x1a')](_0x6f987b));_0x58fb42(_0x6f987b);})[_0xb197('0x1f')](function(_0x1a687b){logger[_0xb197('0x1b')](_0xb197('0x28'),_0x1a687b['message'],_0x33c3e7);_0x337740(_0x246f97[_0xb197('0x1b')](0x1f4,_0x1a687b[_0xb197('0x1d')]));});});};exports[_0xb197('0x2b')]=function(_0x1f9c10){var _0x51ea47=this;return new Promise(function(_0x19e85f,_0x4fdf18){return db[_0xb197('0x21')][_0xb197('0x2c')](_0x1f9c10[_0xb197('0x29')],{'raw':_0x1f9c10['options']?_0x1f9c10[_0xb197('0x22')][_0xb197('0x2a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f9c10[_0xb197('0x22')]?_0x1f9c10[_0xb197('0x22')][_0xb197('0x23')]||null:null,'attributes':_0x1f9c10['options']?_0x1f9c10['options'][_0xb197('0x24')]||null:null,'limit':_0x1f9c10['options']?_0x1f9c10[_0xb197('0x22')]['limit']||null:null})[_0xb197('0x14')](function(_0x1c1e17){logger[_0xb197('0x15')](_0xb197('0x2b'),_0x1f9c10);logger[_0xb197('0x17')](_0xb197('0x2b'),_0x1f9c10,JSON['stringify'](_0x1c1e17));_0x19e85f(_0x1c1e17);})[_0xb197('0x1f')](function(_0x9c3bc9){logger[_0xb197('0x1b')](_0xb197('0x2b'),_0x9c3bc9[_0xb197('0x1d')],_0x1f9c10);_0x4fdf18(_0x51ea47[_0xb197('0x1b')](0x1f4,_0x9c3bc9[_0xb197('0x1d')]));});});}; \ No newline at end of file +var _0x3aa2=['client','http','defaults','redis','socket.io-emitter','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceQueueReport','findAll','options','raw','where','attributes','include','map','model','GetVoiceQueueReport','catch','CreateVoiceQueueReport','body','update','limit','UpdateVoiceQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x24680c,_0x4b8332){var _0x2c07ce=function(_0xc09a0f){while(--_0xc09a0f){_0x24680c['push'](_0x24680c['shift']());}};_0x2c07ce(++_0x4b8332);}(_0x3aa2,0x1b9));var _0x23aa=function(_0x880aed,_0x16597b){_0x880aed=_0x880aed-0x0;var _0x40df37=_0x3aa2[_0x880aed];return _0x40df37;};'use strict';var _=require(_0x23aa('0x0'));var util=require(_0x23aa('0x1'));var moment=require(_0x23aa('0x2'));var BPromise=require(_0x23aa('0x3'));var rs=require(_0x23aa('0x4'));var fs=require('fs');var Redis=require(_0x23aa('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x23aa('0x6'))(_0x23aa('0x7'));var config=require(_0x23aa('0x8'));var jayson=require(_0x23aa('0x9'));var client=jayson[_0x23aa('0xa')][_0x23aa('0xb')]({'port':0x232a});config['redis']=_[_0x23aa('0xc')](config[_0x23aa('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x23aa('0xe'))(new Redis(config[_0x23aa('0xd')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithRpcPromise(_0x4490b5,_0x53fb94,_0x53fd32){return new BPromise(function(_0x5cb69d,_0x73264e){return client[_0x23aa('0xf')](_0x4490b5,_0x53fd32)[_0x23aa('0x10')](function(_0x388a93){logger[_0x23aa('0x11')](_0x23aa('0x12'),_0x53fb94,_0x23aa('0x13'));logger[_0x23aa('0x14')](_0x23aa('0x15'),_0x53fb94,_0x23aa('0x13'),JSON[_0x23aa('0x16')](_0x388a93));if(_0x388a93[_0x23aa('0x17')]){if(_0x388a93[_0x23aa('0x17')]['code']===0x1f4){logger[_0x23aa('0x17')](_0x23aa('0x12'),_0x53fb94,_0x388a93[_0x23aa('0x17')][_0x23aa('0x18')]);return _0x73264e(_0x388a93[_0x23aa('0x17')][_0x23aa('0x18')]);}logger[_0x23aa('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x53fb94,_0x388a93[_0x23aa('0x17')]['message']);return _0x5cb69d(_0x388a93[_0x23aa('0x17')][_0x23aa('0x18')]);}else{logger[_0x23aa('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x53fb94,_0x23aa('0x13'));_0x5cb69d(_0x388a93['result'][_0x23aa('0x18')]);}})['catch'](function(_0x467e80){logger[_0x23aa('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x53fb94,_0x467e80);_0x73264e(_0x467e80);});});}exports['GetVoiceQueueReport']=function(_0x32fc72){var _0x1dd307=this;return new Promise(function(_0x538756,_0x60471b){return db[_0x23aa('0x19')][_0x23aa('0x1a')]({'raw':_0x32fc72[_0x23aa('0x1b')]?_0x32fc72[_0x23aa('0x1b')][_0x23aa('0x1c')]===undefined?!![]:![]:!![],'where':_0x32fc72['options']?_0x32fc72[_0x23aa('0x1b')][_0x23aa('0x1d')]||null:null,'attributes':_0x32fc72[_0x23aa('0x1b')]?_0x32fc72[_0x23aa('0x1b')][_0x23aa('0x1e')]||null:null,'limit':_0x32fc72[_0x23aa('0x1b')]?_0x32fc72[_0x23aa('0x1b')]['limit']||null:null,'include':_0x32fc72[_0x23aa('0x1b')]?_0x32fc72[_0x23aa('0x1b')][_0x23aa('0x1f')]?_[_0x23aa('0x20')](_0x32fc72[_0x23aa('0x1b')][_0x23aa('0x1f')],function(_0x34c8e6){return{'model':db[_0x34c8e6[_0x23aa('0x21')]],'as':_0x34c8e6['as'],'attributes':_0x34c8e6[_0x23aa('0x1e')],'include':_0x34c8e6[_0x23aa('0x1f')]?_[_0x23aa('0x20')](_0x34c8e6['include'],function(_0x731368){return{'model':db[_0x731368[_0x23aa('0x21')]],'as':_0x731368['as'],'attributes':_0x731368[_0x23aa('0x1e')],'include':_0x731368[_0x23aa('0x1f')]?_[_0x23aa('0x20')](_0x731368[_0x23aa('0x1f')],function(_0x50e999){return{'model':db[_0x50e999[_0x23aa('0x21')]],'as':_0x50e999['as'],'attributes':_0x50e999[_0x23aa('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x23aa('0x10')](function(_0x5369e5){logger[_0x23aa('0x11')]('GetVoiceQueueReport',_0x32fc72);logger[_0x23aa('0x14')](_0x23aa('0x22'),_0x32fc72,JSON[_0x23aa('0x16')](_0x5369e5));_0x538756(_0x5369e5);})[_0x23aa('0x23')](function(_0x5d5825){logger[_0x23aa('0x17')](_0x23aa('0x22'),_0x5d5825[_0x23aa('0x18')],_0x32fc72);_0x60471b(_0x1dd307[_0x23aa('0x17')](0x1f4,_0x5d5825[_0x23aa('0x18')]));});});};exports[_0x23aa('0x24')]=function(_0x1101c8){var _0x348776=this;return new Promise(function(_0x244037,_0x37ab7a){return db[_0x23aa('0x19')]['create'](_0x1101c8[_0x23aa('0x25')],{'raw':_0x1101c8[_0x23aa('0x1b')]?_0x1101c8['options'][_0x23aa('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x36790){logger[_0x23aa('0x11')](_0x23aa('0x24'),_0x1101c8);logger[_0x23aa('0x14')](_0x23aa('0x24'),_0x1101c8,JSON[_0x23aa('0x16')](_0x36790));_0x244037(_0x36790);})[_0x23aa('0x23')](function(_0x18ff97){logger['error']('CreateVoiceQueueReport',_0x18ff97['message'],_0x1101c8);_0x37ab7a(_0x348776[_0x23aa('0x17')](0x1f4,_0x18ff97[_0x23aa('0x18')]));});});};exports['UpdateVoiceQueueReport']=function(_0x3b807b){var _0x38d745=this;return new Promise(function(_0x50de2d,_0x3b7ad6){return db['VoiceQueueReport'][_0x23aa('0x26')](_0x3b807b[_0x23aa('0x25')],{'raw':_0x3b807b['options']?_0x3b807b['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b807b[_0x23aa('0x1b')]?_0x3b807b[_0x23aa('0x1b')][_0x23aa('0x1d')]||null:null,'attributes':_0x3b807b[_0x23aa('0x1b')]?_0x3b807b[_0x23aa('0x1b')][_0x23aa('0x1e')]||null:null,'limit':_0x3b807b[_0x23aa('0x1b')]?_0x3b807b[_0x23aa('0x1b')][_0x23aa('0x27')]||null:null})['then'](function(_0x33ecee){logger[_0x23aa('0x11')](_0x23aa('0x28'),_0x3b807b);logger['debug'](_0x23aa('0x28'),_0x3b807b,JSON['stringify'](_0x33ecee));_0x50de2d(_0x33ecee);})[_0x23aa('0x23')](function(_0x327451){logger['error'](_0x23aa('0x28'),_0x327451['message'],_0x3b807b);_0x3b7ad6(_0x38d745[_0x23aa('0x17')](0x1f4,_0x327451[_0x23aa('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index ab45934..f38d027 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 _0x82f5=['remove','update','emit','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x82f5,0x15d));var _0x582f=function(_0x12cf9d,_0xfdf512){_0x12cf9d=_0x12cf9d-0x0;var _0x299d32=_0x82f5[_0x12cf9d];return _0x299d32;};'use strict';var VoiceQueueReportEvents=require(_0x582f('0x0'));var events=[_0x582f('0x1'),_0x582f('0x2'),_0x582f('0x3')];function createListener(_0x43501c,_0x5a8ca2){return function(_0x4e1ebd){_0x5a8ca2[_0x582f('0x4')](_0x43501c,_0x4e1ebd);};}function removeListener(_0x3f3bde,_0xfc37e0){return function(){VoiceQueueReportEvents[_0x582f('0x5')](_0x3f3bde,_0xfc37e0);};}exports[_0x582f('0x6')]=function(_0x15d332){for(var _0x459755=0x0,_0x506655=events[_0x582f('0x7')];_0x459755<_0x506655;_0x459755++){var _0x5d4e30=events[_0x459755];var _0x2cb791=createListener(_0x582f('0x8')+_0x5d4e30,_0x15d332);VoiceQueueReportEvents['on'](_0x5d4e30,_0x2cb791);}}; \ No newline at end of file +var _0xe198=['save','emit','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events'];(function(_0x467fa3,_0x5a9708){var _0x41c880=function(_0x316a85){while(--_0x316a85){_0x467fa3['push'](_0x467fa3['shift']());}};_0x41c880(++_0x5a9708);}(_0xe198,0x6f));var _0x8e19=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xe198[_0x160c73];return _0xd9302;};'use strict';var VoiceQueueReportEvents=require(_0x8e19('0x0'));var events=[_0x8e19('0x1'),'remove','update'];function createListener(_0x18c3af,_0x2b1b2b){return function(_0x2a2529){_0x2b1b2b[_0x8e19('0x2')](_0x18c3af,_0x2a2529);};}function removeListener(_0x32f52f,_0x4e3f58){return function(){VoiceQueueReportEvents[_0x8e19('0x3')](_0x32f52f,_0x4e3f58);};}exports[_0x8e19('0x4')]=function(_0x2fb138){for(var _0x188ce0=0x0,_0x1175d6=events[_0x8e19('0x5')];_0x188ce0<_0x1175d6;_0x188ce0++){var _0x1e61ae=events[_0x188ce0];var _0xfc45e=createListener(_0x8e19('0x6')+_0x1e61ae,_0x2fb138);VoiceQueueReportEvents['on'](_0x1e61ae,_0xfc45e);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 3727332..b046b96 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 _0x4134=['get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller'];(function(_0x4840bc,_0x56cabe){var _0x26632c=function(_0x14f856){while(--_0x14f856){_0x4840bc['push'](_0x4840bc['shift']());}};_0x26632c(++_0x56cabe);}(_0x4134,0x1ac));var _0x4413=function(_0x2877d0,_0x2ea52a){_0x2877d0=_0x2877d0-0x0;var _0x58994c=_0x4134[_0x2877d0];return _0x58994c;};'use strict';var multer=require(_0x4413('0x0'));var util=require(_0x4413('0x1'));var path=require(_0x4413('0x2'));var timeout=require(_0x4413('0x3'));var express=require('express');var router=express[_0x4413('0x4')]();var fs_extra=require(_0x4413('0x5'));var auth=require(_0x4413('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4413('0x7'));var controller=require(_0x4413('0x8'));router[_0x4413('0x9')]('/',auth[_0x4413('0xa')](),controller['index']);router[_0x4413('0x9')](_0x4413('0xb'),auth[_0x4413('0xa')](),controller[_0x4413('0xc')]);router[_0x4413('0xd')]('/',auth[_0x4413('0xa')](),controller[_0x4413('0xe')]);router[_0x4413('0xf')]('/:id',auth[_0x4413('0xa')](),controller['update']);router[_0x4413('0x10')](_0x4413('0xb'),auth[_0x4413('0xa')](),controller[_0x4413('0x11')]);module[_0x4413('0x12')]=router; \ No newline at end of file +var _0xc943=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','post','create'];(function(_0x25455b,_0x2bb4c0){var _0x1b945b=function(_0x2a518a){while(--_0x2a518a){_0x25455b['push'](_0x25455b['shift']());}};_0x1b945b(++_0x2bb4c0);}(_0xc943,0x157));var _0x3c94=function(_0xce93c,_0x555be5){_0xce93c=_0xce93c-0x0;var _0x230720=_0xc943[_0xce93c];return _0x230720;};'use strict';var multer=require(_0x3c94('0x0'));var util=require(_0x3c94('0x1'));var path=require(_0x3c94('0x2'));var timeout=require(_0x3c94('0x3'));var express=require(_0x3c94('0x4'));var router=express[_0x3c94('0x5')]();var fs_extra=require(_0x3c94('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3c94('0x7'));var config=require('../../config/environment');var controller=require('./voiceQueuesLog.controller');router[_0x3c94('0x8')]('/',auth[_0x3c94('0x9')](),controller[_0x3c94('0xa')]);router[_0x3c94('0x8')](_0x3c94('0xb'),auth[_0x3c94('0x9')](),controller['show']);router[_0x3c94('0xc')]('/',auth[_0x3c94('0x9')](),controller[_0x3c94('0xd')]);router['put']('/:id',auth[_0x3c94('0x9')](),controller['update']);router[_0x3c94('0xe')]('/:id',auth[_0x3c94('0x9')](),controller[_0x3c94('0xf')]);module[_0x3c94('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 8150cfa..7454931 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 _0xb7b5=['DATE','format','moment','exports','STRING'];(function(_0x4197da,_0x3b3af5){var _0xcae72e=function(_0x50b9a9){while(--_0x50b9a9){_0x4197da['push'](_0x4197da['shift']());}};_0xcae72e(++_0x3b3af5);}(_0xb7b5,0x75));var _0x5b7b=function(_0xe9d735,_0x57608d){_0xe9d735=_0xe9d735-0x0;var _0x352df1=_0xb7b5[_0xe9d735];return _0x352df1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5b7b('0x0'));module[_0x5b7b('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x5b7b('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x5b7b('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x5b7b('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x5b7b('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x5b7b('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x5b7b('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x5b7b('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x5b7b('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x5b7b('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x5b7b('0x3')],'allowNull':![],'defaultValue':moment()[_0x5b7b('0x4')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0xb7b6=['format','sequelize','moment','STRING','DATE'];(function(_0x515624,_0x262a13){var _0x36d6e1=function(_0x395661){while(--_0x395661){_0x515624['push'](_0x515624['shift']());}};_0x36d6e1(++_0x262a13);}(_0xb7b6,0x15f));var _0x6b7b=function(_0x744eab,_0x4e0d57){_0x744eab=_0x744eab-0x0;var _0x35306d=_0xb7b6[_0x744eab];return _0x35306d;};'use strict';var Sequelize=require(_0x6b7b('0x0'));var moment=require(_0x6b7b('0x1'));module['exports']={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x6b7b('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x6b7b('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x6b7b('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x6b7b('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x6b7b('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x6b7b('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x6b7b('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x6b7b('0x3')],'allowNull':![],'defaultValue':moment()[_0x6b7b('0x4')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 6a5dbcc..29b30d5 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 _0x0bc7=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','count','limit','set','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','VoiceQueuesLog','findAll','rows','catch','show','keys','length','includeAll','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x3ef7ce,_0x57011b){var _0x54d928=function(_0x5d13a7){while(--_0x5d13a7){_0x3ef7ce['push'](_0x3ef7ce['shift']());}};_0x54d928(++_0x57011b);}(_0x0bc7,0x11e));var _0x70bc=function(_0x4a286e,_0x3ff265){_0x4a286e=_0x4a286e-0x0;var _0x142dde=_0x0bc7[_0x4a286e];return _0x142dde;};'use strict';var emlformat=require(_0x70bc('0x0'));var rimraf=require(_0x70bc('0x1'));var zipdir=require(_0x70bc('0x2'));var jsonpatch=require(_0x70bc('0x3'));var rp=require(_0x70bc('0x4'));var moment=require(_0x70bc('0x5'));var BPromise=require(_0x70bc('0x6'));var Mustache=require(_0x70bc('0x7'));var util=require(_0x70bc('0x8'));var path=require('path');var sox=require(_0x70bc('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x70bc('0xa'));var _=require(_0x70bc('0xb'));var squel=require(_0x70bc('0xc'));var crypto=require(_0x70bc('0xd'));var jsforce=require(_0x70bc('0xe'));var deskjs=require(_0x70bc('0xf'));var toCsv=require('to-csv');var querystring=require(_0x70bc('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x70bc('0x11'));var qs=require(_0x70bc('0x12'));var as=require(_0x70bc('0x13'));var hardwareService=require(_0x70bc('0x14'));var logger=require(_0x70bc('0x15'))(_0x70bc('0x16'));var utils=require(_0x70bc('0x17'));var config=require(_0x70bc('0x18'));var licenseUtil=require(_0x70bc('0x19'));var db=require(_0x70bc('0x1a'))['db'];function respondWithStatusCode(_0x3a0597,_0x596d83){_0x596d83=_0x596d83||0xcc;return function(_0x172e64){if(_0x172e64){return _0x3a0597[_0x70bc('0x1b')](_0x596d83);}return _0x3a0597[_0x70bc('0x1c')](_0x596d83)['end']();};}function respondWithResult(_0x5b83de,_0x18d833){_0x18d833=_0x18d833||0xc8;return function(_0x2d0a3f){if(_0x2d0a3f){return _0x5b83de['status'](_0x18d833)[_0x70bc('0x1d')](_0x2d0a3f);}};}function respondWithFilteredResult(_0x2a7bf9,_0x5cb71b){return function(_0x2788b7){if(_0x2788b7){var _0x1512cf=typeof _0x5cb71b['offset']==='undefined'&&typeof _0x5cb71b['limit']===_0x70bc('0x1e');var _0x22dd5f=_0x2788b7['count'];var _0x272534=_0x1512cf?0x0:_0x5cb71b[_0x70bc('0x1f')];var _0xe4cd12=_0x1512cf?_0x2788b7[_0x70bc('0x20')]:_0x5cb71b[_0x70bc('0x1f')]+_0x5cb71b[_0x70bc('0x21')];var _0x442bca;if(_0xe4cd12>=_0x22dd5f){_0xe4cd12=_0x22dd5f;_0x442bca=0xc8;}else{_0x442bca=0xce;}_0x2a7bf9[_0x70bc('0x1c')](_0x442bca);return _0x2a7bf9[_0x70bc('0x22')]('Content-Range',_0x272534+'-'+_0xe4cd12+'/'+_0x22dd5f)['json'](_0x2788b7);}return null;};}function patchUpdates(_0x14987e){return function(_0xde2b0e){try{jsonpatch['apply'](_0xde2b0e,_0x14987e,!![]);}catch(_0x5f03a2){return BPromise[_0x70bc('0x23')](_0x5f03a2);}return _0xde2b0e[_0x70bc('0x24')]();};}function saveUpdates(_0x5d1371,_0x33ab60){return function(_0x1bf340){if(_0x1bf340){return _0x1bf340[_0x70bc('0x25')](_0x5d1371)[_0x70bc('0x26')](function(_0x4095cb){return _0x4095cb;});}return null;};}function removeEntity(_0xe0460c,_0x560d19){return function(_0x5496dd){if(_0x5496dd){return _0x5496dd[_0x70bc('0x27')]()['then'](function(){_0xe0460c[_0x70bc('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x75cfb,_0x56d916){return function(_0x550abe){if(!_0x550abe){_0x75cfb[_0x70bc('0x1b')](0x194);}return _0x550abe;};}function handleError(_0x3b7e0f,_0x174b49){_0x174b49=_0x174b49||0x1f4;return function(_0x3da4f5){logger[_0x70bc('0x28')](_0x3da4f5[_0x70bc('0x29')]);if(_0x3da4f5[_0x70bc('0x2a')]){delete _0x3da4f5[_0x70bc('0x2a')];}_0x3b7e0f[_0x70bc('0x1c')](_0x174b49)[_0x70bc('0x2b')](_0x3da4f5);};}exports[_0x70bc('0x2c')]=function(_0x2aa171,_0x3a0599){var _0x513b62={},_0x3d2bdf={},_0x17eeb0={'count':0x0,'rows':[]};var _0x4dc903=_[_0x70bc('0x2d')](db['VoiceQueuesLog'][_0x70bc('0x2e')],function(_0x18a5a5){return{'name':_0x18a5a5[_0x70bc('0x2f')],'type':_0x18a5a5[_0x70bc('0x30')][_0x70bc('0x31')]};});_0x3d2bdf[_0x70bc('0x32')]=_[_0x70bc('0x2d')](_0x4dc903,_0x70bc('0x2a'));_0x3d2bdf[_0x70bc('0x33')]=_['keys'](_0x2aa171['query']);_0x3d2bdf[_0x70bc('0x34')]=_['intersection'](_0x3d2bdf['model'],_0x3d2bdf[_0x70bc('0x33')]);_0x513b62[_0x70bc('0x35')]=_[_0x70bc('0x36')](_0x3d2bdf[_0x70bc('0x32')],qs[_0x70bc('0x37')](_0x2aa171[_0x70bc('0x33')][_0x70bc('0x37')]));_0x513b62[_0x70bc('0x35')]=_0x513b62[_0x70bc('0x35')]['length']?_0x513b62[_0x70bc('0x35')]:_0x3d2bdf[_0x70bc('0x32')];if(!_0x2aa171['query'][_0x70bc('0x38')]('nolimit')){_0x513b62[_0x70bc('0x21')]=qs[_0x70bc('0x21')](_0x2aa171[_0x70bc('0x33')][_0x70bc('0x21')]);_0x513b62[_0x70bc('0x1f')]=qs['offset'](_0x2aa171[_0x70bc('0x33')][_0x70bc('0x1f')]);}_0x513b62[_0x70bc('0x39')]=qs[_0x70bc('0x3a')](_0x2aa171[_0x70bc('0x33')][_0x70bc('0x3a')]);_0x513b62[_0x70bc('0x3b')]=qs[_0x70bc('0x34')](_['pick'](_0x2aa171[_0x70bc('0x33')],_0x3d2bdf[_0x70bc('0x34')]),_0x4dc903);if(_0x2aa171[_0x70bc('0x33')][_0x70bc('0x3c')]){_0x513b62[_0x70bc('0x3b')]=_[_0x70bc('0x3d')](_0x513b62[_0x70bc('0x3b')],{'$or':_[_0x70bc('0x2d')](_0x4dc903,function(_0x4649ca){if(_0x4649ca[_0x70bc('0x30')]!==_0x70bc('0x3e')){var _0x37ac93={};_0x37ac93[_0x4649ca[_0x70bc('0x2a')]]={'$like':'%'+_0x2aa171['query'][_0x70bc('0x3c')]+'%'};return _0x37ac93;}})});}_0x513b62=_[_0x70bc('0x3d')]({},_0x513b62,_0x2aa171[_0x70bc('0x3f')]);var _0x1ab89b={'where':_0x513b62[_0x70bc('0x3b')]};return db['VoiceQueuesLog']['count'](_0x1ab89b)['then'](function(_0x32cfe2){_0x17eeb0[_0x70bc('0x20')]=_0x32cfe2;if(_0x2aa171['query']['includeAll']){_0x513b62[_0x70bc('0x40')]=[{'all':!![]}];}return db[_0x70bc('0x41')][_0x70bc('0x42')](_0x513b62);})[_0x70bc('0x26')](function(_0x40e4c8){_0x17eeb0[_0x70bc('0x43')]=_0x40e4c8;return _0x17eeb0;})['then'](respondWithFilteredResult(_0x3a0599,_0x513b62))[_0x70bc('0x44')](handleError(_0x3a0599,null));};exports[_0x70bc('0x45')]=function(_0x358a5b,_0x4b890d){var _0x58fdf2={'raw':!![],'where':{'id':_0x358a5b['params']['id']}},_0x2f5754={};_0x2f5754[_0x70bc('0x32')]=_['keys'](db['VoiceQueuesLog'][_0x70bc('0x2e')]);_0x2f5754[_0x70bc('0x33')]=_[_0x70bc('0x46')](_0x358a5b[_0x70bc('0x33')]);_0x2f5754[_0x70bc('0x34')]=_[_0x70bc('0x36')](_0x2f5754[_0x70bc('0x32')],_0x2f5754[_0x70bc('0x33')]);_0x58fdf2[_0x70bc('0x35')]=_[_0x70bc('0x36')](_0x2f5754['model'],qs[_0x70bc('0x37')](_0x358a5b[_0x70bc('0x33')][_0x70bc('0x37')]));_0x58fdf2['attributes']=_0x58fdf2[_0x70bc('0x35')][_0x70bc('0x47')]?_0x58fdf2[_0x70bc('0x35')]:_0x2f5754[_0x70bc('0x32')];if(_0x358a5b[_0x70bc('0x33')][_0x70bc('0x48')]){_0x58fdf2[_0x70bc('0x40')]=[{'all':!![]}];}_0x58fdf2=_[_0x70bc('0x3d')]({},_0x58fdf2,_0x358a5b[_0x70bc('0x3f')]);return db[_0x70bc('0x41')]['find'](_0x58fdf2)[_0x70bc('0x26')](handleEntityNotFound(_0x4b890d,null))[_0x70bc('0x26')](respondWithResult(_0x4b890d,null))['catch'](handleError(_0x4b890d,null));};exports[_0x70bc('0x49')]=function(_0x2da67a,_0x41f051){return db[_0x70bc('0x41')][_0x70bc('0x49')](_0x2da67a[_0x70bc('0x4a')],{})[_0x70bc('0x26')](respondWithResult(_0x41f051,0xc9))['catch'](handleError(_0x41f051,null));};exports[_0x70bc('0x25')]=function(_0x36530e,_0x208c5){if(_0x36530e[_0x70bc('0x4a')]['id']){delete _0x36530e['body']['id'];}return db[_0x70bc('0x41')][_0x70bc('0x4b')]({'where':{'id':_0x36530e[_0x70bc('0x4c')]['id']}})['then'](handleEntityNotFound(_0x208c5,null))[_0x70bc('0x26')](saveUpdates(_0x36530e[_0x70bc('0x4a')],null))['then'](respondWithResult(_0x208c5,null))[_0x70bc('0x44')](handleError(_0x208c5,null));};exports[_0x70bc('0x27')]=function(_0x18e50e,_0x84a503){return db[_0x70bc('0x41')][_0x70bc('0x4b')]({'where':{'id':_0x18e50e[_0x70bc('0x4c')]['id']}})[_0x70bc('0x26')](handleEntityNotFound(_0x84a503,null))[_0x70bc('0x26')](removeEntity(_0x84a503,null))[_0x70bc('0x44')](handleError(_0x84a503,null));}; \ No newline at end of file +var _0x7a4f=['filter','merge','VIRTUAL','includeAll','include','VoiceQueuesLog','findAll','rows','params','rawAttributes','options','catch','create','body','find','destroy','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','map','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick'];(function(_0x20934c,_0x21dd74){var _0x12c69f=function(_0x5dd9fa){while(--_0x5dd9fa){_0x20934c['push'](_0x20934c['shift']());}};_0x12c69f(++_0x21dd74);}(_0x7a4f,0xe2));var _0xf7a4=function(_0x400b43,_0x55da4e){_0x400b43=_0x400b43-0x0;var _0x3c330f=_0x7a4f[_0x400b43];return _0x3c330f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf7a4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf7a4('0x1'));var moment=require(_0xf7a4('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xf7a4('0x3'));var util=require(_0xf7a4('0x4'));var path=require(_0xf7a4('0x5'));var sox=require(_0xf7a4('0x6'));var csv=require(_0xf7a4('0x7'));var ejs=require(_0xf7a4('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf7a4('0x9'));var crypto=require('crypto');var jsforce=require(_0xf7a4('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf7a4('0xb'));var Papa=require('papaparse');var Redis=require(_0xf7a4('0xc'));var authService=require(_0xf7a4('0xd'));var qs=require(_0xf7a4('0xe'));var as=require(_0xf7a4('0xf'));var hardwareService=require(_0xf7a4('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xf7a4('0x11'));var config=require(_0xf7a4('0x12'));var licenseUtil=require(_0xf7a4('0x13'));var db=require(_0xf7a4('0x14'))['db'];function respondWithStatusCode(_0x2f5beb,_0x6852d2){_0x6852d2=_0x6852d2||0xcc;return function(_0x111c94){if(_0x111c94){return _0x2f5beb[_0xf7a4('0x15')](_0x6852d2);}return _0x2f5beb[_0xf7a4('0x16')](_0x6852d2)[_0xf7a4('0x17')]();};}function respondWithResult(_0x34c919,_0x555560){_0x555560=_0x555560||0xc8;return function(_0x17c90d){if(_0x17c90d){return _0x34c919[_0xf7a4('0x16')](_0x555560)[_0xf7a4('0x18')](_0x17c90d);}};}function respondWithFilteredResult(_0x3e675a,_0x4b153b){return function(_0x4ea1de){if(_0x4ea1de){var _0x298477=typeof _0x4b153b[_0xf7a4('0x19')]==='undefined'&&typeof _0x4b153b[_0xf7a4('0x1a')]===_0xf7a4('0x1b');var _0x120920=_0x4ea1de[_0xf7a4('0x1c')];var _0x5f50ef=_0x298477?0x0:_0x4b153b[_0xf7a4('0x19')];var _0x3d1130=_0x298477?_0x4ea1de[_0xf7a4('0x1c')]:_0x4b153b[_0xf7a4('0x19')]+_0x4b153b[_0xf7a4('0x1a')];var _0x3e680d;if(_0x3d1130>=_0x120920){_0x3d1130=_0x120920;_0x3e680d=0xc8;}else{_0x3e680d=0xce;}_0x3e675a[_0xf7a4('0x16')](_0x3e680d);return _0x3e675a[_0xf7a4('0x1d')](_0xf7a4('0x1e'),_0x5f50ef+'-'+_0x3d1130+'/'+_0x120920)[_0xf7a4('0x18')](_0x4ea1de);}return null;};}function patchUpdates(_0x22523a){return function(_0x33f7f1){try{jsonpatch[_0xf7a4('0x1f')](_0x33f7f1,_0x22523a,!![]);}catch(_0x521fb9){return BPromise[_0xf7a4('0x20')](_0x521fb9);}return _0x33f7f1[_0xf7a4('0x21')]();};}function saveUpdates(_0x2fe067,_0x1b0b9a){return function(_0xd27d59){if(_0xd27d59){return _0xd27d59['update'](_0x2fe067)[_0xf7a4('0x22')](function(_0xe00e6c){return _0xe00e6c;});}return null;};}function removeEntity(_0x5558c0,_0x3d145c){return function(_0x29c88b){if(_0x29c88b){return _0x29c88b['destroy']()['then'](function(){_0x5558c0['status'](0xcc)[_0xf7a4('0x17')]();});}};}function handleEntityNotFound(_0x2fc71b,_0x137d62){return function(_0x57fcce){if(!_0x57fcce){_0x2fc71b[_0xf7a4('0x15')](0x194);}return _0x57fcce;};}function handleError(_0x5a85a5,_0x16fba6){_0x16fba6=_0x16fba6||0x1f4;return function(_0x38d0d1){logger[_0xf7a4('0x23')](_0x38d0d1[_0xf7a4('0x24')]);if(_0x38d0d1[_0xf7a4('0x25')]){delete _0x38d0d1['name'];}_0x5a85a5['status'](_0x16fba6)[_0xf7a4('0x26')](_0x38d0d1);};}exports['index']=function(_0x30fed6,_0x2d74c5){var _0x32cee2={},_0x41042b={},_0x302d47={'count':0x0,'rows':[]};var _0x3b69a9=_[_0xf7a4('0x27')](db['VoiceQueuesLog']['rawAttributes'],function(_0x201d93){return{'name':_0x201d93['fieldName'],'type':_0x201d93['type'][_0xf7a4('0x28')]};});_0x41042b[_0xf7a4('0x29')]=_[_0xf7a4('0x27')](_0x3b69a9,'name');_0x41042b['query']=_[_0xf7a4('0x2a')](_0x30fed6[_0xf7a4('0x2b')]);_0x41042b[_0xf7a4('0x2c')]=_[_0xf7a4('0x2d')](_0x41042b[_0xf7a4('0x29')],_0x41042b[_0xf7a4('0x2b')]);_0x32cee2[_0xf7a4('0x2e')]=_[_0xf7a4('0x2d')](_0x41042b[_0xf7a4('0x29')],qs[_0xf7a4('0x2f')](_0x30fed6[_0xf7a4('0x2b')][_0xf7a4('0x2f')]));_0x32cee2[_0xf7a4('0x2e')]=_0x32cee2[_0xf7a4('0x2e')][_0xf7a4('0x30')]?_0x32cee2[_0xf7a4('0x2e')]:_0x41042b[_0xf7a4('0x29')];if(!_0x30fed6[_0xf7a4('0x2b')][_0xf7a4('0x31')]('nolimit')){_0x32cee2[_0xf7a4('0x1a')]=qs[_0xf7a4('0x1a')](_0x30fed6[_0xf7a4('0x2b')][_0xf7a4('0x1a')]);_0x32cee2[_0xf7a4('0x19')]=qs[_0xf7a4('0x19')](_0x30fed6[_0xf7a4('0x2b')][_0xf7a4('0x19')]);}_0x32cee2[_0xf7a4('0x32')]=qs[_0xf7a4('0x33')](_0x30fed6[_0xf7a4('0x2b')][_0xf7a4('0x33')]);_0x32cee2[_0xf7a4('0x34')]=qs['filters'](_[_0xf7a4('0x35')](_0x30fed6['query'],_0x41042b[_0xf7a4('0x2c')]),_0x3b69a9);if(_0x30fed6['query'][_0xf7a4('0x36')]){_0x32cee2[_0xf7a4('0x34')]=_[_0xf7a4('0x37')](_0x32cee2[_0xf7a4('0x34')],{'$or':_['map'](_0x3b69a9,function(_0x22f928){if(_0x22f928['type']!==_0xf7a4('0x38')){var _0x3a9621={};_0x3a9621[_0x22f928[_0xf7a4('0x25')]]={'$like':'%'+_0x30fed6[_0xf7a4('0x2b')][_0xf7a4('0x36')]+'%'};return _0x3a9621;}})});}_0x32cee2=_['merge']({},_0x32cee2,_0x30fed6['options']);var _0xa23463={'where':_0x32cee2['where']};return db['VoiceQueuesLog'][_0xf7a4('0x1c')](_0xa23463)[_0xf7a4('0x22')](function(_0x3ecaf7){_0x302d47[_0xf7a4('0x1c')]=_0x3ecaf7;if(_0x30fed6['query'][_0xf7a4('0x39')]){_0x32cee2[_0xf7a4('0x3a')]=[{'all':!![]}];}return db[_0xf7a4('0x3b')][_0xf7a4('0x3c')](_0x32cee2);})[_0xf7a4('0x22')](function(_0x42a663){_0x302d47[_0xf7a4('0x3d')]=_0x42a663;return _0x302d47;})[_0xf7a4('0x22')](respondWithFilteredResult(_0x2d74c5,_0x32cee2))['catch'](handleError(_0x2d74c5,null));};exports['show']=function(_0x393e73,_0x556141){var _0x2f2a26={'raw':!![],'where':{'id':_0x393e73[_0xf7a4('0x3e')]['id']}},_0x2751f2={};_0x2751f2[_0xf7a4('0x29')]=_[_0xf7a4('0x2a')](db[_0xf7a4('0x3b')][_0xf7a4('0x3f')]);_0x2751f2[_0xf7a4('0x2b')]=_[_0xf7a4('0x2a')](_0x393e73[_0xf7a4('0x2b')]);_0x2751f2[_0xf7a4('0x2c')]=_['intersection'](_0x2751f2[_0xf7a4('0x29')],_0x2751f2['query']);_0x2f2a26[_0xf7a4('0x2e')]=_[_0xf7a4('0x2d')](_0x2751f2[_0xf7a4('0x29')],qs[_0xf7a4('0x2f')](_0x393e73[_0xf7a4('0x2b')][_0xf7a4('0x2f')]));_0x2f2a26[_0xf7a4('0x2e')]=_0x2f2a26[_0xf7a4('0x2e')][_0xf7a4('0x30')]?_0x2f2a26[_0xf7a4('0x2e')]:_0x2751f2[_0xf7a4('0x29')];if(_0x393e73[_0xf7a4('0x2b')][_0xf7a4('0x39')]){_0x2f2a26['include']=[{'all':!![]}];}_0x2f2a26=_[_0xf7a4('0x37')]({},_0x2f2a26,_0x393e73[_0xf7a4('0x40')]);return db[_0xf7a4('0x3b')]['find'](_0x2f2a26)[_0xf7a4('0x22')](handleEntityNotFound(_0x556141,null))[_0xf7a4('0x22')](respondWithResult(_0x556141,null))[_0xf7a4('0x41')](handleError(_0x556141,null));};exports[_0xf7a4('0x42')]=function(_0x1db8bd,_0x516adc){return db[_0xf7a4('0x3b')][_0xf7a4('0x42')](_0x1db8bd[_0xf7a4('0x43')],{})[_0xf7a4('0x22')](respondWithResult(_0x516adc,0xc9))[_0xf7a4('0x41')](handleError(_0x516adc,null));};exports['update']=function(_0x536bdd,_0x364d22){if(_0x536bdd['body']['id']){delete _0x536bdd[_0xf7a4('0x43')]['id'];}return db[_0xf7a4('0x3b')][_0xf7a4('0x44')]({'where':{'id':_0x536bdd[_0xf7a4('0x3e')]['id']}})[_0xf7a4('0x22')](handleEntityNotFound(_0x364d22,null))['then'](saveUpdates(_0x536bdd[_0xf7a4('0x43')],null))['then'](respondWithResult(_0x364d22,null))[_0xf7a4('0x41')](handleError(_0x364d22,null));};exports[_0xf7a4('0x45')]=function(_0x9cea8f,_0x409de){return db['VoiceQueuesLog']['find']({'where':{'id':_0x9cea8f[_0xf7a4('0x3e')]['id']}})[_0xf7a4('0x22')](handleEntityNotFound(_0x409de,null))[_0xf7a4('0x22')](removeEntity(_0x409de,null))[_0xf7a4('0x41')](handleError(_0x409de,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 9ff7368..7ab1105 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 _0x501f=['../../config/logger','api','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','util'];(function(_0x36c6eb,_0x4fb127){var _0x30675b=function(_0x3a788b){while(--_0x3a788b){_0x36c6eb['push'](_0x36c6eb['shift']());}};_0x30675b(++_0x4fb127);}(_0x501f,0x1db));var _0xf501=function(_0x596fb3,_0x5869a0){_0x596fb3=_0x596fb3-0x0;var _0x12621b=_0x501f[_0x596fb3];return _0x12621b;};'use strict';var _=require('lodash');var util=require(_0xf501('0x0'));var logger=require(_0xf501('0x1'))(_0xf501('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf501('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf501('0x4'));var config=require(_0xf501('0x5'));var attributes=require(_0xf501('0x6'));module[_0xf501('0x7')]=function(_0x528848,_0x3d6096){return _0x528848[_0xf501('0x8')](_0xf501('0x9'),attributes,{'tableName':_0xf501('0xa'),'paranoid':![],'indexes':[{'name':_0xf501('0xb'),'fields':[_0xf501('0xc'),_0xf501('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x8ae1=['define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports'];(function(_0x3460d1,_0x2d9677){var _0xbb30bd=function(_0xc7f647){while(--_0xc7f647){_0x3460d1['push'](_0x3460d1['shift']());}};_0xbb30bd(++_0x2d9677);}(_0x8ae1,0x1c8));var _0x18ae=function(_0x22126b,_0x2602e3){_0x22126b=_0x22126b-0x0;var _0x39c2ce=_0x8ae1[_0x22126b];return _0x39c2ce;};'use strict';var _=require(_0x18ae('0x0'));var util=require(_0x18ae('0x1'));var logger=require(_0x18ae('0x2'))(_0x18ae('0x3'));var moment=require(_0x18ae('0x4'));var BPromise=require(_0x18ae('0x5'));var rp=require(_0x18ae('0x6'));var fs=require('fs');var path=require(_0x18ae('0x7'));var rimraf=require(_0x18ae('0x8'));var config=require(_0x18ae('0x9'));var attributes=require(_0x18ae('0xa'));module[_0x18ae('0xb')]=function(_0x550625,_0x53d13c){return _0x550625[_0x18ae('0xc')](_0x18ae('0xd'),attributes,{'tableName':_0x18ae('0xe'),'paranoid':![],'indexes':[{'name':_0x18ae('0xf'),'fields':[_0x18ae('0x10'),_0x18ae('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 001ab60..c663c80 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 _0x048c=['info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x398ec6,_0x450ea7){var _0x1e9a44=function(_0x3c74e6){while(--_0x3c74e6){_0x398ec6['push'](_0x398ec6['shift']());}};_0x1e9a44(++_0x450ea7);}(_0x048c,0xdb));var _0xc048=function(_0x54cb3f,_0x160320){_0x54cb3f=_0x54cb3f-0x0;var _0x530da3=_0x048c[_0x54cb3f];return _0x530da3;};'use strict';var _=require(_0xc048('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc048('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc048('0x2'));var db=require(_0xc048('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc048('0x4'))(_0xc048('0x5'));var config=require(_0xc048('0x6'));var jayson=require(_0xc048('0x7'));var client=jayson[_0xc048('0x8')][_0xc048('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbfb080,_0x3550a8,_0x5597fe){return new BPromise(function(_0xe3f589,_0x3d4f95){return client[_0xc048('0xa')](_0xbfb080,_0x5597fe)[_0xc048('0xb')](function(_0x28fc92){logger[_0xc048('0xc')](_0xc048('0xd'),_0x3550a8,_0xc048('0xe'));logger['debug'](_0xc048('0xf'),_0x3550a8,_0xc048('0xe'),JSON[_0xc048('0x10')](_0x28fc92));if(_0x28fc92[_0xc048('0x11')]){if(_0x28fc92['error'][_0xc048('0x12')]===0x1f4){logger['error'](_0xc048('0xd'),_0x3550a8,_0x28fc92['error'][_0xc048('0x13')]);return _0x3d4f95(_0x28fc92[_0xc048('0x11')][_0xc048('0x13')]);}logger[_0xc048('0x11')](_0xc048('0xd'),_0x3550a8,_0x28fc92[_0xc048('0x11')][_0xc048('0x13')]);return _0xe3f589(_0x28fc92[_0xc048('0x11')][_0xc048('0x13')]);}else{logger[_0xc048('0xc')](_0xc048('0xd'),_0x3550a8,_0xc048('0xe'));_0xe3f589(_0x28fc92[_0xc048('0x14')]['message']);}})['catch'](function(_0x341ae7){logger[_0xc048('0x11')](_0xc048('0xd'),_0x3550a8,_0x341ae7);_0x3d4f95(_0x341ae7);});});} \ No newline at end of file +var _0xaa0c=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment'];(function(_0x4c773f,_0x4fc704){var _0x44e3a3=function(_0x23444a){while(--_0x23444a){_0x4c773f['push'](_0x4c773f['shift']());}};_0x44e3a3(++_0x4fc704);}(_0xaa0c,0xfa));var _0xcaa0=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0xaa0c[_0x20a558];return _0x53d3f7;};'use strict';var _=require(_0xcaa0('0x0'));var util=require('util');var moment=require(_0xcaa0('0x1'));var BPromise=require(_0xcaa0('0x2'));var rs=require(_0xcaa0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcaa0('0x4'))['db'];var utils=require(_0xcaa0('0x5'));var logger=require(_0xcaa0('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcaa0('0x7'));var client=jayson[_0xcaa0('0x8')][_0xcaa0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe2abcf,_0x23ccc6,_0x3107e9){return new BPromise(function(_0x2dfd11,_0xf407b6){return client[_0xcaa0('0xa')](_0xe2abcf,_0x3107e9)[_0xcaa0('0xb')](function(_0x5eb7ee){logger[_0xcaa0('0xc')](_0xcaa0('0xd'),_0x23ccc6,'request\x20sent');logger['debug'](_0xcaa0('0xe'),_0x23ccc6,_0xcaa0('0xf'),JSON[_0xcaa0('0x10')](_0x5eb7ee));if(_0x5eb7ee[_0xcaa0('0x11')]){if(_0x5eb7ee[_0xcaa0('0x11')][_0xcaa0('0x12')]===0x1f4){logger[_0xcaa0('0x11')](_0xcaa0('0xd'),_0x23ccc6,_0x5eb7ee['error'][_0xcaa0('0x13')]);return _0xf407b6(_0x5eb7ee['error'][_0xcaa0('0x13')]);}logger[_0xcaa0('0x11')](_0xcaa0('0xd'),_0x23ccc6,_0x5eb7ee['error'][_0xcaa0('0x13')]);return _0x2dfd11(_0x5eb7ee[_0xcaa0('0x11')][_0xcaa0('0x13')]);}else{logger[_0xcaa0('0xc')](_0xcaa0('0xd'),_0x23ccc6,_0xcaa0('0xf'));_0x2dfd11(_0x5eb7ee['result'][_0xcaa0('0x13')]);}})[_0xcaa0('0x14')](function(_0x3fed88){logger[_0xcaa0('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x23ccc6,_0x3fed88);_0xf407b6(_0x3fed88);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 161d409..fcdbbc9 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 _0x9606=['/:id/transcribe','downloadTranscribe','create','post','runTranscribe','put','update','/:id','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','/describe','get','show','/:id/download'];(function(_0x2d28ee,_0x5c1a43){var _0x55834f=function(_0x338085){while(--_0x338085){_0x2d28ee['push'](_0x2d28ee['shift']());}};_0x55834f(++_0x5c1a43);}(_0x9606,0x153));var _0x6960=function(_0x18d279,_0x1acba8){_0x18d279=_0x18d279-0x0;var _0x5a2100=_0x9606[_0x18d279];return _0x5a2100;};'use strict';var multer=require(_0x6960('0x0'));var util=require(_0x6960('0x1'));var path=require(_0x6960('0x2'));var timeout=require(_0x6960('0x3'));var express=require(_0x6960('0x4'));var router=express[_0x6960('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6960('0x6'));var interaction=require(_0x6960('0x7'));var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router['get']('/',auth[_0x6960('0x8')](),controller['index']);router['get'](_0x6960('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x6960('0xa')]('/:id',auth[_0x6960('0x8')](),controller[_0x6960('0xb')]);router['get'](_0x6960('0xc'),auth[_0x6960('0x8')](),controller['download']);router[_0x6960('0xa')]('/:id/downloads',controller['downloads']);router[_0x6960('0xa')](_0x6960('0xd'),auth['isAuthenticated'](),controller[_0x6960('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6960('0xf')]);router[_0x6960('0x10')](_0x6960('0xd'),auth[_0x6960('0x8')](),controller[_0x6960('0x11')]);router[_0x6960('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x6960('0x13')]);router['delete'](_0x6960('0x14'),auth[_0x6960('0x8')](),controller[_0x6960('0x15')]);module['exports']=router; \ No newline at end of file +var _0x5127=['post','runTranscribe','put','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','describe','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe'];(function(_0x131cbb,_0x308e2b){var _0x537d8e=function(_0x276c21){while(--_0x276c21){_0x131cbb['push'](_0x131cbb['shift']());}};_0x537d8e(++_0x308e2b);}(_0x5127,0x69));var _0x7512=function(_0x5cb7a8,_0x269783){_0x5cb7a8=_0x5cb7a8-0x0;var _0x2a26df=_0x5127[_0x5cb7a8];return _0x2a26df;};'use strict';var multer=require(_0x7512('0x0'));var util=require('util');var path=require(_0x7512('0x1'));var timeout=require(_0x7512('0x2'));var express=require(_0x7512('0x3'));var router=express[_0x7512('0x4')]();var fs_extra=require(_0x7512('0x5'));var auth=require(_0x7512('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7512('0x7'));var controller=require(_0x7512('0x8'));router[_0x7512('0x9')]('/',auth[_0x7512('0xa')](),controller['index']);router[_0x7512('0x9')]('/describe',auth[_0x7512('0xa')](),controller[_0x7512('0xb')]);router[_0x7512('0x9')](_0x7512('0xc'),auth[_0x7512('0xa')](),controller[_0x7512('0xd')]);router[_0x7512('0x9')](_0x7512('0xe'),auth[_0x7512('0xa')](),controller[_0x7512('0xf')]);router['get'](_0x7512('0x10'),controller[_0x7512('0x11')]);router[_0x7512('0x9')](_0x7512('0x12'),auth[_0x7512('0xa')](),controller[_0x7512('0x13')]);router[_0x7512('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7512('0x14')](_0x7512('0x12'),auth[_0x7512('0xa')](),controller[_0x7512('0x15')]);router[_0x7512('0x16')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x7512('0x17')](_0x7512('0xc'),auth[_0x7512('0xa')](),controller[_0x7512('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 92fb0e0..8e4d35f 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(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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 47908c4..2716c54 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 _0x3ce9=['CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','data2','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','reject','save','update','destroy','then','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','name','format','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceRecording','includeAll','findAll','catch','params','include','find','body','download','../../components/encryptor','uniqueid','value','%s.cypher','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','secrets','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','decryptFile','Setting','findOne','transcribe','transcribeAccountId','language','bucket','runSentiment','sentiment','sentimentRegion'];(function(_0x450033,_0x513ddd){var _0xdd1ce4=function(_0x2a2da2){while(--_0x2a2da2){_0x450033['push'](_0x450033['shift']());}};_0xdd1ce4(++_0x513ddd);}(_0x3ce9,0x1d3));var _0x93ce=function(_0x3faebb,_0x1266a4){_0x3faebb=_0x3faebb-0x0;var _0x1d45b2=_0x3ce9[_0x3faebb];return _0x1d45b2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x93ce('0x0'));var zipdir=require(_0x93ce('0x1'));var jsonpatch=require(_0x93ce('0x2'));var rp=require(_0x93ce('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x93ce('0x4'));var path=require('path');var sox=require(_0x93ce('0x5'));var csv=require(_0x93ce('0x6'));var ejs=require(_0x93ce('0x7'));var fs=require('fs');var fs_extra=require(_0x93ce('0x8'));var _=require(_0x93ce('0x9'));var squel=require(_0x93ce('0xa'));var crypto=require(_0x93ce('0xb'));var jsforce=require(_0x93ce('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x93ce('0x6'));var querystring=require(_0x93ce('0xd'));var Papa=require(_0x93ce('0xe'));var AWS=require(_0x93ce('0xf'));var uuidv4=require(_0x93ce('0x10'));var Redis=require(_0x93ce('0x11'));var authService=require(_0x93ce('0x12'));var qs=require(_0x93ce('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x93ce('0x14'))(_0x93ce('0x15'));var utils=require(_0x93ce('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x93ce('0x17'));var db=require(_0x93ce('0x18'))['db'];function respondWithStatusCode(_0x2181c9,_0x583870){_0x583870=_0x583870||0xcc;return function(_0x2438b1){if(_0x2438b1){return _0x2181c9[_0x93ce('0x19')](_0x583870);}return _0x2181c9[_0x93ce('0x1a')](_0x583870)[_0x93ce('0x1b')]();};}function respondWithResult(_0x41c6a4,_0x148d6a){_0x148d6a=_0x148d6a||0xc8;return function(_0x1ff7df){if(_0x1ff7df){return _0x41c6a4['status'](_0x148d6a)[_0x93ce('0x1c')](_0x1ff7df);}};}function respondWithFilteredResult(_0x17ac01,_0x150cb7){return function(_0xee5bba){if(_0xee5bba){var _0x366f3e=typeof _0x150cb7['offset']==='undefined'&&typeof _0x150cb7[_0x93ce('0x1d')]===_0x93ce('0x1e');var _0x38be03=_0xee5bba[_0x93ce('0x1f')];var _0x3b9daf=_0x366f3e?0x0:_0x150cb7[_0x93ce('0x20')];var _0x3c049e=_0x366f3e?_0xee5bba[_0x93ce('0x1f')]:_0x150cb7[_0x93ce('0x20')]+_0x150cb7['limit'];var _0x2de43f;if(_0x3c049e>=_0x38be03){_0x3c049e=_0x38be03;_0x2de43f=0xc8;}else{_0x2de43f=0xce;}_0x17ac01[_0x93ce('0x1a')](_0x2de43f);return _0x17ac01['set'](_0x93ce('0x21'),_0x3b9daf+'-'+_0x3c049e+'/'+_0x38be03)['json'](_0xee5bba);}return null;};}function patchUpdates(_0x14a791){return function(_0x568801){try{jsonpatch['apply'](_0x568801,_0x14a791,!![]);}catch(_0x4a7a18){return BPromise[_0x93ce('0x22')](_0x4a7a18);}return _0x568801[_0x93ce('0x23')]();};}function saveUpdates(_0xd5193e,_0x9343a){return function(_0x572c5a){if(_0x572c5a){return _0x572c5a[_0x93ce('0x24')](_0xd5193e)['then'](function(_0xccaf57){return _0xccaf57;});}return null;};}function removeEntity(_0x3edad8,_0x5e0f4c){return function(_0x48af6b){if(_0x48af6b){return _0x48af6b[_0x93ce('0x25')]()[_0x93ce('0x26')](function(){_0x3edad8[_0x93ce('0x1a')](0xcc)[_0x93ce('0x1b')]();});}};}function handleEntityNotFound(_0x25fc17,_0x4eea5d){return function(_0x580a50){if(!_0x580a50){_0x25fc17[_0x93ce('0x19')](0x194);}return _0x580a50;};}function handleError(_0x3893dc,_0x3efee1){_0x3efee1=_0x3efee1||0x1f4;return function(_0x1262e5){logger['error'](_0x1262e5['stack']);if(_0x1262e5['name']){delete _0x1262e5['name'];}_0x3893dc[_0x93ce('0x1a')](_0x3efee1)[_0x93ce('0x27')](_0x1262e5);};}exports[_0x93ce('0x28')]=function(_0x2ab0e6,_0x29c6ae){var _0x48ca18={},_0x201486={},_0x598874={'count':0x0,'rows':[]};var _0x4bbec8=_[_0x93ce('0x29')](db['VoiceRecording'][_0x93ce('0x2a')],function(_0x742a61){return{'name':_0x742a61[_0x93ce('0x2b')],'type':_0x742a61[_0x93ce('0x2c')][_0x93ce('0x2d')]};});_0x201486[_0x93ce('0x2e')]=_[_0x93ce('0x2f')](_[_0x93ce('0x29')](_0x4bbec8,_0x93ce('0x30')),[_0x93ce('0x31')]);_0x201486['query']=_[_0x93ce('0x32')](_0x2ab0e6['query']);_0x201486[_0x93ce('0x33')]=_[_0x93ce('0x34')](_0x201486[_0x93ce('0x2e')],_0x201486[_0x93ce('0x35')]);_0x48ca18[_0x93ce('0x36')]=_[_0x93ce('0x34')](_0x201486[_0x93ce('0x2e')],qs[_0x93ce('0x37')](_0x2ab0e6[_0x93ce('0x35')][_0x93ce('0x37')]));_0x48ca18[_0x93ce('0x36')]=_0x48ca18[_0x93ce('0x36')][_0x93ce('0x38')]?_0x48ca18[_0x93ce('0x36')]:_0x201486[_0x93ce('0x2e')];if(!_0x2ab0e6['query'][_0x93ce('0x39')]('nolimit')){_0x48ca18[_0x93ce('0x1d')]=qs['limit'](_0x2ab0e6['query'][_0x93ce('0x1d')]);_0x48ca18['offset']=qs['offset'](_0x2ab0e6[_0x93ce('0x35')][_0x93ce('0x20')]);}_0x48ca18[_0x93ce('0x3a')]=qs[_0x93ce('0x3b')](_0x2ab0e6['query']['sort']);_0x48ca18[_0x93ce('0x3c')]=qs[_0x93ce('0x33')](_[_0x93ce('0x3d')](_0x2ab0e6[_0x93ce('0x35')],_0x201486[_0x93ce('0x33')]),_0x4bbec8);if(_0x2ab0e6[_0x93ce('0x35')][_0x93ce('0x3e')]){_0x48ca18[_0x93ce('0x3c')]=_[_0x93ce('0x3f')](_0x48ca18[_0x93ce('0x3c')],{'$or':_[_0x93ce('0x29')](_0x4bbec8,function(_0x424603){if(_0x424603['type']!==_0x93ce('0x40')){var _0x1a846e={};_0x1a846e[_0x424603['name']]={'$like':'%'+_0x2ab0e6[_0x93ce('0x35')]['filter']+'%'};return _0x1a846e;}})});}_0x48ca18=_['merge']({},_0x48ca18,_0x2ab0e6[_0x93ce('0x41')]);var _0x2fdbda={'where':_0x48ca18['where']};return db[_0x93ce('0x42')][_0x93ce('0x1f')](_0x2fdbda)['then'](function(_0x25ace4){_0x598874[_0x93ce('0x1f')]=_0x25ace4;if(_0x2ab0e6['query'][_0x93ce('0x43')]){_0x48ca18['include']=[{'all':!![]}];}return db['VoiceRecording'][_0x93ce('0x44')](_0x48ca18);})[_0x93ce('0x26')](function(_0x2c9682){_0x598874['rows']=_0x2c9682;return _0x598874;})['then'](respondWithFilteredResult(_0x29c6ae,_0x48ca18))[_0x93ce('0x45')](handleError(_0x29c6ae,null));};exports['show']=function(_0x4fc408,_0x2d824a){var _0x21fbc7={'raw':![],'where':{'id':_0x4fc408[_0x93ce('0x46')]['id']}},_0x135f7c={};_0x135f7c[_0x93ce('0x2e')]=_[_0x93ce('0x32')](db[_0x93ce('0x42')][_0x93ce('0x2a')]);_0x135f7c['query']=_[_0x93ce('0x32')](_0x4fc408[_0x93ce('0x35')]);_0x135f7c[_0x93ce('0x33')]=_[_0x93ce('0x34')](_0x135f7c[_0x93ce('0x2e')],_0x135f7c['query']);_0x21fbc7['attributes']=_[_0x93ce('0x34')](_0x135f7c[_0x93ce('0x2e')],qs['fields'](_0x4fc408[_0x93ce('0x35')][_0x93ce('0x37')]));_0x21fbc7[_0x93ce('0x36')]=_0x21fbc7['attributes'][_0x93ce('0x38')]?_0x21fbc7['attributes']:_0x135f7c[_0x93ce('0x2e')];if(_0x4fc408[_0x93ce('0x35')][_0x93ce('0x43')]){_0x21fbc7[_0x93ce('0x47')]=[{'all':!![]}];}_0x21fbc7=_[_0x93ce('0x3f')]({},_0x21fbc7,_0x4fc408[_0x93ce('0x41')]);return db[_0x93ce('0x42')][_0x93ce('0x48')](_0x21fbc7)[_0x93ce('0x26')](handleEntityNotFound(_0x2d824a,null))['then'](respondWithResult(_0x2d824a,null))['catch'](handleError(_0x2d824a,null));};exports['create']=function(_0x53bbb4,_0x5e8970){return db['VoiceRecording']['create'](_0x53bbb4[_0x93ce('0x49')],{})[_0x93ce('0x26')](respondWithResult(_0x5e8970,0xc9))[_0x93ce('0x45')](handleError(_0x5e8970,null));};exports[_0x93ce('0x24')]=function(_0x498df4,_0x5a0d26){if(_0x498df4[_0x93ce('0x49')]['id']){delete _0x498df4['body']['id'];}return db[_0x93ce('0x42')][_0x93ce('0x48')]({'where':{'id':_0x498df4['params']['id']}})[_0x93ce('0x26')](handleEntityNotFound(_0x5a0d26,null))['then'](saveUpdates(_0x498df4['body'],null))[_0x93ce('0x26')](respondWithResult(_0x5a0d26,null))[_0x93ce('0x45')](handleError(_0x5a0d26,null));};exports['describe']=function(_0x58de12,_0x4690f4){return db['VoiceRecording']['describe']()['then'](respondWithResult(_0x4690f4,null))[_0x93ce('0x45')](handleError(_0x4690f4,null));};exports[_0x93ce('0x4a')]=function(_0x4247f7,_0xd3ecda,_0x38fcc2){var _0x9ba269=require(_0x93ce('0x4b'));var _0x2bad13=![];var _0x5b41fe={};if(_0x4247f7[_0x93ce('0x35')][_0x93ce('0x2c')]&&_0x4247f7[_0x93ce('0x35')][_0x93ce('0x2c')]===_0x93ce('0x4c')){_0x5b41fe['uniqueid']=_0x4247f7[_0x93ce('0x46')]['id'];}else{_0x5b41fe['id']=_0x4247f7[_0x93ce('0x46')]['id'];}return db[_0x93ce('0x42')]['find']({'where':_0x5b41fe,'attributes':['id',_0x93ce('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0xd3ecda,null))[_0x93ce('0x26')](function(_0x24157d){if(_0x24157d){var _0x2d274d=_0x24157d[_0x93ce('0x4d')];var _0x4aec19=util['format'](_0x93ce('0x4e'),_0x2d274d);if(fs['existsSync'](_0x4aec19)){_0x2bad13=!![];return _0x9ba269['decryptFile'](_0x4aec19,_0x2d274d,config['secrets'][_0x93ce('0x4f')])[_0x93ce('0x26')](function(){return _0x24157d;});}return _0x24157d;}})[_0x93ce('0x26')](function(_0x8fa1d8){if(_0x8fa1d8){var _0x4f7944=_0x8fa1d8[_0x93ce('0x4d')];if(!fs[_0x93ce('0x50')](_0x4f7944)){throw new db[(_0x93ce('0x51'))][(_0x93ce('0x52'))](_0x93ce('0x53'));}if(_0x8fa1d8[_0x93ce('0x54')]){return _0xd3ecda[_0x93ce('0x4a')](_0x4f7944,_0x8fa1d8['filename']+path['extname'](_0x4f7944),function(){if(_0x2bad13){fs['unlink'](_0x4f7944);}});}else{return _0xd3ecda['download'](_0x4f7944,function(_0x111ca0){if(_0x2bad13){fs[_0x93ce('0x55')](_0x4f7944);}});}}})['catch'](function(_0x5cb9c2){if(_0x5cb9c2[_0x93ce('0x56')]===_0x93ce('0x53')){_0xd3ecda[_0x93ce('0x1a')](0x194)[_0x93ce('0x27')](_0x93ce('0x57'));}else{return handleError(_0xd3ecda,null);}});};exports[_0x93ce('0x58')]=function(_0x42295f,_0x4d6720,_0xdba791){var _0x24daa1=require(_0x93ce('0x4b'));var _0x569fac=![];var _0x2480a9={'$and':[db[_0x93ce('0x59')][_0x93ce('0x3c')](db[_0x93ce('0x59')]['fn'](_0x93ce('0x5a'),db[_0x93ce('0x59')][_0x93ce('0x5b')](_0x93ce('0x4c'))),_0x42295f['query'][_0x93ce('0x5c')])]};if(_0x42295f[_0x93ce('0x35')][_0x93ce('0x2c')]&&_0x42295f[_0x93ce('0x35')][_0x93ce('0x2c')]===_0x93ce('0x4c')){_0x2480a9['$and']['push']({'uniqueid':_0x42295f[_0x93ce('0x46')]['id']});}else{_0x2480a9[_0x93ce('0x5d')][_0x93ce('0x5e')]({'id':_0x42295f['params']['id']});}return db[_0x93ce('0x42')][_0x93ce('0x48')]({'where':_0x2480a9,'attributes':['id',_0x93ce('0x4d')],'raw':!![]})[_0x93ce('0x26')](handleEntityNotFound(_0x4d6720,null))[_0x93ce('0x26')](function(_0x1c5741){if(_0x1c5741){var _0x144eda=util['format'](_0x93ce('0x4e'),_0x1c5741['value']);if(fs['existsSync'](_0x144eda)){_0x569fac=!![];return _0x24daa1['decryptFile'](_0x144eda,_0x1c5741[_0x93ce('0x4d')],config[_0x93ce('0x5f')][_0x93ce('0x4f')])[_0x93ce('0x26')](function(){return _0x1c5741;});}return _0x1c5741;}})['then'](function(_0x479fb4){if(_0x479fb4){if(!fs['existsSync'](_0x479fb4[_0x93ce('0x4d')])){throw new db[(_0x93ce('0x51'))]['ValidationError'](_0x93ce('0x53'));}if(_0x479fb4[_0x93ce('0x54')]){return _0x4d6720[_0x93ce('0x4a')](_0x479fb4[_0x93ce('0x4d')],_0x479fb4['filename']+path['extname'](_0x479fb4['value']),function(){if(_0x569fac){fs[_0x93ce('0x55')](_0x479fb4[_0x93ce('0x4d')]);}});}else{return _0x4d6720[_0x93ce('0x4a')](_0x479fb4['value'],function(_0x2bbcd7){if(_0x569fac){fs['unlink'](_0x479fb4[_0x93ce('0x4d')]);}});}}})[_0x93ce('0x45')](handleError(_0x4d6720,null));};exports[_0x93ce('0x25')]=function(_0x1ecbf2,_0x1eaa50){return db[_0x93ce('0x42')][_0x93ce('0x48')]({'where':{'id':_0x1ecbf2['params']['id']}})[_0x93ce('0x26')](function(_0x3d3a87){if(_[_0x93ce('0x60')](_0x3d3a87)){throw new ReferenceError(_0x93ce('0x61'));}return _0x3d3a87;})['then'](function(_0x57b6e2){var _0x47304b=_0x57b6e2[_0x93ce('0x4d')];logger[_0x93ce('0x62')](_0x93ce('0x63'),_0x47304b);if(!_[_0x93ce('0x60')](_0x57b6e2[_0x93ce('0x4d')])&&fs[_0x93ce('0x50')](_0x47304b)){logger[_0x93ce('0x62')](_0x93ce('0x64')+_0x47304b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x47304b);}_0x47304b=_0x47304b+'.cypher';if(!_[_0x93ce('0x60')](_0x57b6e2[_0x93ce('0x4d')])&&fs['existsSync'](_0x47304b)){logger[_0x93ce('0x62')]('File:\x20\x22'+_0x47304b+_0x93ce('0x65'));fs['unlinkSync'](_0x47304b);}return _0x57b6e2;})[_0x93ce('0x26')](function(_0x49d965){if(!_0x49d965)throw new InternalError();return _0x49d965[_0x93ce('0x25')]();})['then'](function(){_0x1eaa50['status'](0xcc)['end']();})[_0x93ce('0x45')](handleError(_0x1eaa50,null));};function getBucketslist(_0x3a7fc5,_0x5ac129,_0x5d0b68){return new Promise(function(_0x30ae20,_0x2eac2f){var _0x5b184d=new AWS['S3']({'accessKeyId':_0x5ac129,'secretAccessKey':_0x3a7fc5,'region':_0x5d0b68});_0x5b184d[_0x93ce('0x66')]({},function(_0x357693,_0x41d461){if(_0x357693){return _0x2eac2f(_0x357693);}else{return _0x30ae20(_0x41d461);}});});}function createBucket(_0x107b7e,_0x449d5b,_0xaaa37d,_0x84b1f0){return new Promise(function(_0x260a4b,_0x65e58){var _0x31bcd2=new AWS['S3']({'accessKeyId':_0x449d5b,'secretAccessKey':_0x107b7e,'region':_0xaaa37d});_0x31bcd2[_0x93ce('0x67')]({'Bucket':_0x84b1f0},function(_0x14369d,_0x2305b3){if(_0x14369d){return _0x65e58(_0x14369d);}else{return _0x260a4b(_0x2305b3);}});});}function uploadFile(_0x476333,_0x23edbc,_0x1a335b,_0xe6c456,_0xc9fa6a,_0x18f4c4){return new Promise(function(_0x2789c6,_0x38ed36){var _0x57cfde=new AWS['S3']({'accessKeyId':_0x23edbc,'secretAccessKey':_0x476333,'region':_0x1a335b});_0x57cfde[_0x93ce('0x68')]({'Bucket':_0xe6c456,'Key':_0xc9fa6a,'Body':_0x18f4c4},function(_0x2c7b0b,_0x14920a){if(_0x2c7b0b){return _0x38ed36(_0x2c7b0b);}else{return _0x2789c6(_0x14920a);}});});}function startTranscribe(_0x48726d,_0x412c4d,_0x126fea,_0x71ced7,_0x157c25,_0x1f56fb){return new Promise(function(_0x2c0eee,_0x2b1115){var _0x394d94=new AWS[(_0x93ce('0x69'))]({'accessKeyId':_0x412c4d,'secretAccessKey':_0x48726d,'region':_0x126fea});_0x394d94[_0x93ce('0x6a')]({'TranscriptionJobName':_0x71ced7,'LanguageCode':_0x157c25,'Media':{'MediaFileUri':_0x1f56fb}},function(_0x586d4c,_0x5a6b4c){if(_0x586d4c){return _0x2b1115(_0x586d4c);}else{return _0x2c0eee(_0x5a6b4c);}});});}function transcribe(_0xa6c612,_0x2c2be4,_0x30f432,_0xdd67e6,_0x4ea701,_0x400bbd,_0x307471){return new Promise(function(_0x55e7bb,_0x275f01){var _0x1b5df3={};logger[_0x93ce('0x62')](util['format']('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0xa6c612,_0x4ea701));return uploadFile(_0x2c2be4,_0x30f432,_0xdd67e6,_0x4ea701,path[_0x93ce('0x6b')](_0x400bbd),fs[_0x93ce('0x6c')](_0x400bbd))[_0x93ce('0x26')](function(_0x44122c){logger[_0x93ce('0x62')](util['format'](_0x93ce('0x6d'),_0xa6c612,_0x4ea701,_0x44122c[_0x93ce('0x6e')]));_0x1b5df3['bucket']=_0x44122c[_0x93ce('0x6f')];_0x1b5df3['location']=_0x44122c[_0x93ce('0x6e')];logger[_0x93ce('0x62')](util[_0x93ce('0x31')](_0x93ce('0x70'),_0xa6c612));return startTranscribe(_0x2c2be4,_0x30f432,_0xdd67e6,uuidv4(),_0x307471,_0x44122c[_0x93ce('0x6e')]);})[_0x93ce('0x26')](function(_0x64b02f){logger[_0x93ce('0x62')](util['format'](_0x93ce('0x71'),_0xa6c612,_0x64b02f[_0x93ce('0x72')][_0x93ce('0x73')]));_0x1b5df3[_0x93ce('0x74')]=_0x64b02f[_0x93ce('0x72')][_0x93ce('0x73')];_0x1b5df3['transcribeStatus']=_0x64b02f['TranscriptionJob'][_0x93ce('0x75')];return _0x55e7bb(_0x1b5df3);})[_0x93ce('0x45')](function(_0x18526a){return _0x275f01(_0x18526a);});});}exports[_0x93ce('0x76')]=function(_0x2f5c46,_0x45e46b,_0x54a71d){var _0x298782;var _0x481ef8;var _0x5d5530;var _0x336f2b=require(_0x93ce('0x4b'));return db[_0x93ce('0x42')]['findOne']({'where':{'id':_0x2f5c46[_0x93ce('0x46')]['id']}})[_0x93ce('0x26')](function(_0xba4186){if(_0xba4186){var _0x111484=util['format'](_0x93ce('0x4e'),_0xba4186[_0x93ce('0x4d')]);if(fs[_0x93ce('0x50')](_0x111484)){cypher=!![];return _0x336f2b[_0x93ce('0x77')](_0x111484,_0xba4186['value'],config[_0x93ce('0x5f')]['recording'])['then'](function(){return _0xba4186;});}return _0xba4186;}})[_0x93ce('0x26')](function(_0x2dda4b){if(!_0x2dda4b){throw new db[(_0x93ce('0x51'))][(_0x93ce('0x52'))]('Voice\x20Recording\x20not\x20found');}_0x481ef8=_0x2dda4b;return db[_0x93ce('0x78')][_0x93ce('0x79')]({'where':{'id':0x1}});})[_0x93ce('0x26')](handleEntityNotFound(_0x45e46b,null))['then'](function(_0x2257f2){if(_0x2257f2){_0x298782=_0x2257f2;if(!_0x298782[_0x93ce('0x7a')]||!_0x298782[_0x93ce('0x7b')]||!_0x298782['transcribeRegion']||!_0x298782[_0x93ce('0x7c')]||!_0x298782[_0x93ce('0x7d')]){throw new db[(_0x93ce('0x51'))][(_0x93ce('0x52'))]('Transcribe\x20not\x20configured');}if(_0x2f5c46[_0x93ce('0x49')][_0x93ce('0x7e')]&&(!_0x298782[_0x93ce('0x7f')]||!_0x298782['sentimentAccountId']||!_0x298782[_0x93ce('0x80')]||!_0x298782[_0x93ce('0x7c')]||!_0x298782['bucket'])){throw new db['Sequelize'][(_0x93ce('0x52'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x93ce('0x81')]['findOne']({'where':{'id':_0x298782[_0x93ce('0x7b')]}});}})['then'](function(_0x10e7dc){if(!_0x10e7dc){throw new db[(_0x93ce('0x51'))]['ValidationError'](_0x93ce('0x82'));}if(!_0x10e7dc[_0x93ce('0x83')]||!_0x10e7dc['data2']){throw new db['Sequelize'][(_0x93ce('0x52'))](_0x93ce('0x84'));}_0x5d5530=_0x10e7dc;return getBucketslist(_0x5d5530[_0x93ce('0x83')],_0x5d5530['data2'],_0x298782[_0x93ce('0x85')]);})[_0x93ce('0x26')](function(_0xb44026){if(_0xb44026&&_0xb44026[_0x93ce('0x86')]){var _0x3f3483=_[_0x93ce('0x48')](_0xb44026[_0x93ce('0x86')],function(_0x3d91be){return _0x3d91be['Name']===_0x298782[_0x93ce('0x7d')];});if(!_0x3f3483){logger[_0x93ce('0x62')](util[_0x93ce('0x31')](_0x93ce('0x87'),_0x2f5c46[_0x93ce('0x46')]['id'],_0x298782[_0x93ce('0x7d')]));return createBucket(_0x5d5530['data1'],_0x5d5530[_0x93ce('0x88')],_0x298782[_0x93ce('0x85')],_0x298782['bucket']);}logger[_0x93ce('0x62')](util[_0x93ce('0x31')](_0x93ce('0x89'),_0x2f5c46['params']['id'],_0x298782[_0x93ce('0x7d')]));return;}})[_0x93ce('0x26')](function(_0x4a49ab){if(_0x481ef8[_0x93ce('0x8a')]===_0x93ce('0x8b')){return transcribe(_0x2f5c46[_0x93ce('0x46')]['id'],_0x5d5530[_0x93ce('0x83')],_0x5d5530['data2'],_0x298782[_0x93ce('0x85')],_0x298782['bucket'],_0x481ef8[_0x93ce('0x4d')],_0x298782[_0x93ce('0x7c')]);}else{logger[_0x93ce('0x62')](util['format'](_0x93ce('0x8c'),_0x2f5c46[_0x93ce('0x46')]['id']));return{'transcribeStatus':_0x93ce('0x8d')};}})[_0x93ce('0x26')](function(_0x28e015){if(_0x28e015){_0x28e015[_0x93ce('0x8e')]=_0x2f5c46[_0x93ce('0x49')][_0x93ce('0x7e')];return _0x481ef8[_0x93ce('0x8f')](_0x28e015);}})['then'](respondWithResult(_0x45e46b,null))[_0x93ce('0x45')](handleError(_0x45e46b,null));};function writeFile(_0xff7b09,_0x2a3592){return new Promise(function(_0x5d1bf5,_0x214878){fs['writeFile'](_0x2a3592,_0xff7b09,function(_0x18faea,_0x127447){if(_0x18faea){return _0x214878(_0x18faea);}else{return _0x5d1bf5(_0x127447);}});});}exports[_0x93ce('0x90')]=function(_0x46273b,_0x2ceafd,_0x36ef48){return db['VoiceRecording']['findOne']({'where':{'id':_0x46273b['params']['id']}})['then'](handleEntityNotFound(_0x2ceafd))['then'](function(_0x410208){if(_0x410208&&_0x410208[_0x93ce('0x91')]){var _0x1c9c5a=_0x410208[_0x93ce('0x91')];var _0x11a16b=config[_0x93ce('0x92')]+_0x93ce('0x93')+_0x410208['id']+_0x93ce('0x94');if(fs['existsSync'](_0x11a16b)){return _0x11a16b;}return writeFile(_0x1c9c5a,_0x11a16b)[_0x93ce('0x26')](function(){return _0x11a16b;});}else{throw new db[(_0x93ce('0x51'))][(_0x93ce('0x52'))]('Transcript\x20not\x20available');}})['then'](function(_0x4eaa12){return _0x2ceafd['download'](_0x4eaa12);})[_0x93ce('0x45')](handleError(_0x2ceafd));}; \ No newline at end of file +var _0xc1fd=['IN_PROGRESS','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','index','map','VoiceRecording','type','key','model','differenceBy','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','filters','find','create','body','describe','download','../../components/encryptor','uniqueid','value','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','filename','extname','unlink','message','VoiceRecording\x20not\x20found','send','downloads','sequelize','MD5','col','token','push','$and','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','transcribeName','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','ValidationError','Setting','transcribeAccountId','transcribeRegion','language','runSentiment','sentiment','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested'];(function(_0x15d18f,_0x126b0e){var _0xd12bf7=function(_0x19e661){while(--_0x19e661){_0x15d18f['push'](_0x15d18f['shift']());}};_0xd12bf7(++_0x126b0e);}(_0xc1fd,0xa9));var _0xdc1f=function(_0x59be17,_0xc58762){_0x59be17=_0x59be17-0x0;var _0x8243fd=_0xc1fd[_0x59be17];return _0x8243fd;};'use strict';var emlformat=require(_0xdc1f('0x0'));var rimraf=require(_0xdc1f('0x1'));var zipdir=require(_0xdc1f('0x2'));var jsonpatch=require(_0xdc1f('0x3'));var rp=require(_0xdc1f('0x4'));var moment=require('moment');var BPromise=require(_0xdc1f('0x5'));var Mustache=require(_0xdc1f('0x6'));var util=require('util');var path=require(_0xdc1f('0x7'));var sox=require(_0xdc1f('0x8'));var csv=require(_0xdc1f('0x9'));var ejs=require(_0xdc1f('0xa'));var fs=require('fs');var fs_extra=require(_0xdc1f('0xb'));var _=require(_0xdc1f('0xc'));var squel=require(_0xdc1f('0xd'));var crypto=require(_0xdc1f('0xe'));var jsforce=require(_0xdc1f('0xf'));var deskjs=require(_0xdc1f('0x10'));var toCsv=require(_0xdc1f('0x9'));var querystring=require(_0xdc1f('0x11'));var Papa=require(_0xdc1f('0x12'));var AWS=require(_0xdc1f('0x13'));var uuidv4=require(_0xdc1f('0x14'));var Redis=require(_0xdc1f('0x15'));var authService=require('../../components/auth/service');var qs=require(_0xdc1f('0x16'));var as=require(_0xdc1f('0x17'));var hardwareService=require(_0xdc1f('0x18'));var logger=require(_0xdc1f('0x19'))(_0xdc1f('0x1a'));var utils=require(_0xdc1f('0x1b'));var config=require(_0xdc1f('0x1c'));var licenseUtil=require(_0xdc1f('0x1d'));var db=require(_0xdc1f('0x1e'))['db'];function respondWithStatusCode(_0xa7e54b,_0x3bd7ff){_0x3bd7ff=_0x3bd7ff||0xcc;return function(_0x3ae464){if(_0x3ae464){return _0xa7e54b[_0xdc1f('0x1f')](_0x3bd7ff);}return _0xa7e54b['status'](_0x3bd7ff)[_0xdc1f('0x20')]();};}function respondWithResult(_0x3addfd,_0x5bf2a5){_0x5bf2a5=_0x5bf2a5||0xc8;return function(_0x274c50){if(_0x274c50){return _0x3addfd[_0xdc1f('0x21')](_0x5bf2a5)['json'](_0x274c50);}};}function respondWithFilteredResult(_0x1d3101,_0x520acc){return function(_0x1f4057){if(_0x1f4057){var _0x2ccde7=typeof _0x520acc[_0xdc1f('0x22')]==='undefined'&&typeof _0x520acc[_0xdc1f('0x23')]===_0xdc1f('0x24');var _0x23c8f4=_0x1f4057[_0xdc1f('0x25')];var _0x5c2717=_0x2ccde7?0x0:_0x520acc[_0xdc1f('0x22')];var _0x114f71=_0x2ccde7?_0x1f4057[_0xdc1f('0x25')]:_0x520acc[_0xdc1f('0x22')]+_0x520acc['limit'];var _0x551625;if(_0x114f71>=_0x23c8f4){_0x114f71=_0x23c8f4;_0x551625=0xc8;}else{_0x551625=0xce;}_0x1d3101[_0xdc1f('0x21')](_0x551625);return _0x1d3101['set'](_0xdc1f('0x26'),_0x5c2717+'-'+_0x114f71+'/'+_0x23c8f4)[_0xdc1f('0x27')](_0x1f4057);}return null;};}function patchUpdates(_0x2d1616){return function(_0x339884){try{jsonpatch[_0xdc1f('0x28')](_0x339884,_0x2d1616,!![]);}catch(_0x6a3581){return BPromise[_0xdc1f('0x29')](_0x6a3581);}return _0x339884[_0xdc1f('0x2a')]();};}function saveUpdates(_0x19a307,_0x4e99dd){return function(_0x352363){if(_0x352363){return _0x352363[_0xdc1f('0x2b')](_0x19a307)[_0xdc1f('0x2c')](function(_0x22391a){return _0x22391a;});}return null;};}function removeEntity(_0x40b272,_0x5cdcea){return function(_0x4f38cb){if(_0x4f38cb){return _0x4f38cb[_0xdc1f('0x2d')]()[_0xdc1f('0x2c')](function(){_0x40b272['status'](0xcc)[_0xdc1f('0x20')]();});}};}function handleEntityNotFound(_0x95c9df,_0x4fd4c1){return function(_0x1dea1c){if(!_0x1dea1c){_0x95c9df[_0xdc1f('0x1f')](0x194);}return _0x1dea1c;};}function handleError(_0x3da705,_0x13235c){_0x13235c=_0x13235c||0x1f4;return function(_0x10af36){logger['error'](_0x10af36[_0xdc1f('0x2e')]);if(_0x10af36[_0xdc1f('0x2f')]){delete _0x10af36['name'];}_0x3da705[_0xdc1f('0x21')](_0x13235c)['send'](_0x10af36);};}exports[_0xdc1f('0x30')]=function(_0x43f072,_0x5b81fe){var _0x9841e4={},_0x3658ba={},_0x462f68={'count':0x0,'rows':[]};var _0x317e05=_[_0xdc1f('0x31')](db[_0xdc1f('0x32')]['rawAttributes'],function(_0x292c2b){return{'name':_0x292c2b['fieldName'],'type':_0x292c2b[_0xdc1f('0x33')][_0xdc1f('0x34')]};});_0x3658ba[_0xdc1f('0x35')]=_[_0xdc1f('0x36')](_['map'](_0x317e05,_0xdc1f('0x2f')),['format']);_0x3658ba['query']=_[_0xdc1f('0x37')](_0x43f072[_0xdc1f('0x38')]);_0x3658ba['filters']=_[_0xdc1f('0x39')](_0x3658ba[_0xdc1f('0x35')],_0x3658ba[_0xdc1f('0x38')]);_0x9841e4[_0xdc1f('0x3a')]=_[_0xdc1f('0x39')](_0x3658ba[_0xdc1f('0x35')],qs[_0xdc1f('0x3b')](_0x43f072[_0xdc1f('0x38')][_0xdc1f('0x3b')]));_0x9841e4['attributes']=_0x9841e4[_0xdc1f('0x3a')][_0xdc1f('0x3c')]?_0x9841e4[_0xdc1f('0x3a')]:_0x3658ba['model'];if(!_0x43f072['query'][_0xdc1f('0x3d')](_0xdc1f('0x3e'))){_0x9841e4[_0xdc1f('0x23')]=qs[_0xdc1f('0x23')](_0x43f072[_0xdc1f('0x38')][_0xdc1f('0x23')]);_0x9841e4[_0xdc1f('0x22')]=qs[_0xdc1f('0x22')](_0x43f072[_0xdc1f('0x38')][_0xdc1f('0x22')]);}_0x9841e4['order']=qs[_0xdc1f('0x3f')](_0x43f072['query']['sort']);_0x9841e4[_0xdc1f('0x40')]=qs['filters'](_[_0xdc1f('0x41')](_0x43f072[_0xdc1f('0x38')],_0x3658ba['filters']),_0x317e05);if(_0x43f072[_0xdc1f('0x38')][_0xdc1f('0x42')]){_0x9841e4['where']=_[_0xdc1f('0x43')](_0x9841e4[_0xdc1f('0x40')],{'$or':_[_0xdc1f('0x31')](_0x317e05,function(_0x91a97b){if(_0x91a97b[_0xdc1f('0x33')]!==_0xdc1f('0x44')){var _0x470460={};_0x470460[_0x91a97b[_0xdc1f('0x2f')]]={'$like':'%'+_0x43f072[_0xdc1f('0x38')][_0xdc1f('0x42')]+'%'};return _0x470460;}})});}_0x9841e4=_[_0xdc1f('0x43')]({},_0x9841e4,_0x43f072[_0xdc1f('0x45')]);var _0x220ecc={'where':_0x9841e4['where']};return db[_0xdc1f('0x32')][_0xdc1f('0x25')](_0x220ecc)[_0xdc1f('0x2c')](function(_0x5bc7a5){_0x462f68[_0xdc1f('0x25')]=_0x5bc7a5;if(_0x43f072['query'][_0xdc1f('0x46')]){_0x9841e4[_0xdc1f('0x47')]=[{'all':!![]}];}return db['VoiceRecording'][_0xdc1f('0x48')](_0x9841e4);})[_0xdc1f('0x2c')](function(_0x224c5d){_0x462f68[_0xdc1f('0x49')]=_0x224c5d;return _0x462f68;})[_0xdc1f('0x2c')](respondWithFilteredResult(_0x5b81fe,_0x9841e4))[_0xdc1f('0x4a')](handleError(_0x5b81fe,null));};exports[_0xdc1f('0x4b')]=function(_0x56f1ec,_0x580fc4){var _0x16ddeb={'raw':![],'where':{'id':_0x56f1ec[_0xdc1f('0x4c')]['id']}},_0x4b0f00={};_0x4b0f00[_0xdc1f('0x35')]=_[_0xdc1f('0x37')](db[_0xdc1f('0x32')][_0xdc1f('0x4d')]);_0x4b0f00[_0xdc1f('0x38')]=_[_0xdc1f('0x37')](_0x56f1ec['query']);_0x4b0f00[_0xdc1f('0x4e')]=_[_0xdc1f('0x39')](_0x4b0f00[_0xdc1f('0x35')],_0x4b0f00[_0xdc1f('0x38')]);_0x16ddeb[_0xdc1f('0x3a')]=_[_0xdc1f('0x39')](_0x4b0f00[_0xdc1f('0x35')],qs[_0xdc1f('0x3b')](_0x56f1ec[_0xdc1f('0x38')][_0xdc1f('0x3b')]));_0x16ddeb[_0xdc1f('0x3a')]=_0x16ddeb[_0xdc1f('0x3a')]['length']?_0x16ddeb[_0xdc1f('0x3a')]:_0x4b0f00['model'];if(_0x56f1ec[_0xdc1f('0x38')][_0xdc1f('0x46')]){_0x16ddeb[_0xdc1f('0x47')]=[{'all':!![]}];}_0x16ddeb=_[_0xdc1f('0x43')]({},_0x16ddeb,_0x56f1ec[_0xdc1f('0x45')]);return db[_0xdc1f('0x32')][_0xdc1f('0x4f')](_0x16ddeb)[_0xdc1f('0x2c')](handleEntityNotFound(_0x580fc4,null))[_0xdc1f('0x2c')](respondWithResult(_0x580fc4,null))[_0xdc1f('0x4a')](handleError(_0x580fc4,null));};exports[_0xdc1f('0x50')]=function(_0x82000b,_0x58f06d){return db['VoiceRecording'][_0xdc1f('0x50')](_0x82000b['body'],{})[_0xdc1f('0x2c')](respondWithResult(_0x58f06d,0xc9))[_0xdc1f('0x4a')](handleError(_0x58f06d,null));};exports[_0xdc1f('0x2b')]=function(_0x59b7a1,_0x443109){if(_0x59b7a1['body']['id']){delete _0x59b7a1[_0xdc1f('0x51')]['id'];}return db[_0xdc1f('0x32')][_0xdc1f('0x4f')]({'where':{'id':_0x59b7a1['params']['id']}})['then'](handleEntityNotFound(_0x443109,null))[_0xdc1f('0x2c')](saveUpdates(_0x59b7a1[_0xdc1f('0x51')],null))[_0xdc1f('0x2c')](respondWithResult(_0x443109,null))[_0xdc1f('0x4a')](handleError(_0x443109,null));};exports[_0xdc1f('0x52')]=function(_0x5e0659,_0x172d2b){return db[_0xdc1f('0x32')][_0xdc1f('0x52')]()[_0xdc1f('0x2c')](respondWithResult(_0x172d2b,null))[_0xdc1f('0x4a')](handleError(_0x172d2b,null));};exports[_0xdc1f('0x53')]=function(_0x3a6f20,_0x4b2847,_0x283dd5){var _0x58ab6c=require(_0xdc1f('0x54'));var _0x11bf07=![];var _0x52212e={};if(_0x3a6f20[_0xdc1f('0x38')][_0xdc1f('0x33')]&&_0x3a6f20[_0xdc1f('0x38')][_0xdc1f('0x33')]===_0xdc1f('0x55')){_0x52212e['uniqueid']=_0x3a6f20[_0xdc1f('0x4c')]['id'];}else{_0x52212e['id']=_0x3a6f20['params']['id'];}return db[_0xdc1f('0x32')][_0xdc1f('0x4f')]({'where':_0x52212e,'attributes':['id',_0xdc1f('0x56')],'raw':!![]})[_0xdc1f('0x2c')](handleEntityNotFound(_0x4b2847,null))[_0xdc1f('0x2c')](function(_0x543752){if(_0x543752){var _0xbbe471=_0x543752[_0xdc1f('0x56')];var _0x37e3fa=util[_0xdc1f('0x57')](_0xdc1f('0x58'),_0xbbe471);if(fs[_0xdc1f('0x59')](_0x37e3fa)){_0x11bf07=!![];return _0x58ab6c[_0xdc1f('0x5a')](_0x37e3fa,_0xbbe471,config[_0xdc1f('0x5b')][_0xdc1f('0x5c')])[_0xdc1f('0x2c')](function(){return _0x543752;});}return _0x543752;}})[_0xdc1f('0x2c')](function(_0x3c0cb1){if(_0x3c0cb1){var _0x578adc=_0x3c0cb1[_0xdc1f('0x56')];if(!fs[_0xdc1f('0x59')](_0x578adc)){throw new db[(_0xdc1f('0x5d'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x3c0cb1[_0xdc1f('0x5e')]){return _0x4b2847[_0xdc1f('0x53')](_0x578adc,_0x3c0cb1[_0xdc1f('0x5e')]+path[_0xdc1f('0x5f')](_0x578adc),function(){if(_0x11bf07){fs[_0xdc1f('0x60')](_0x578adc);}});}else{return _0x4b2847[_0xdc1f('0x53')](_0x578adc,function(_0x355cca){if(_0x11bf07){fs['unlink'](_0x578adc);}});}}})['catch'](function(_0x173390){if(_0x173390[_0xdc1f('0x61')]===_0xdc1f('0x62')){_0x4b2847[_0xdc1f('0x21')](0x194)[_0xdc1f('0x63')]('Not\x20found');}else{return handleError(_0x4b2847,null);}});};exports[_0xdc1f('0x64')]=function(_0x3e1b86,_0x1aaaf9,_0x3faa30){var _0x24f274=require(_0xdc1f('0x54'));var _0x50b5a0=![];var _0x5513e9={'$and':[db['sequelize'][_0xdc1f('0x40')](db[_0xdc1f('0x65')]['fn'](_0xdc1f('0x66'),db['sequelize'][_0xdc1f('0x67')](_0xdc1f('0x55'))),_0x3e1b86[_0xdc1f('0x38')][_0xdc1f('0x68')])]};if(_0x3e1b86['query']['type']&&_0x3e1b86[_0xdc1f('0x38')]['type']===_0xdc1f('0x55')){_0x5513e9['$and'][_0xdc1f('0x69')]({'uniqueid':_0x3e1b86['params']['id']});}else{_0x5513e9[_0xdc1f('0x6a')][_0xdc1f('0x69')]({'id':_0x3e1b86[_0xdc1f('0x4c')]['id']});}return db['VoiceRecording'][_0xdc1f('0x4f')]({'where':_0x5513e9,'attributes':['id','value'],'raw':!![]})[_0xdc1f('0x2c')](handleEntityNotFound(_0x1aaaf9,null))['then'](function(_0x209cf6){if(_0x209cf6){var _0x5ec725=util['format']('%s.cypher',_0x209cf6[_0xdc1f('0x56')]);if(fs[_0xdc1f('0x59')](_0x5ec725)){_0x50b5a0=!![];return _0x24f274[_0xdc1f('0x5a')](_0x5ec725,_0x209cf6[_0xdc1f('0x56')],config[_0xdc1f('0x5b')]['recording'])[_0xdc1f('0x2c')](function(){return _0x209cf6;});}return _0x209cf6;}})[_0xdc1f('0x2c')](function(_0x4ceb5f){if(_0x4ceb5f){if(!fs[_0xdc1f('0x59')](_0x4ceb5f[_0xdc1f('0x56')])){throw new db['Sequelize']['ValidationError'](_0xdc1f('0x62'));}if(_0x4ceb5f[_0xdc1f('0x5e')]){return _0x1aaaf9['download'](_0x4ceb5f[_0xdc1f('0x56')],_0x4ceb5f[_0xdc1f('0x5e')]+path['extname'](_0x4ceb5f[_0xdc1f('0x56')]),function(){if(_0x50b5a0){fs[_0xdc1f('0x60')](_0x4ceb5f['value']);}});}else{return _0x1aaaf9[_0xdc1f('0x53')](_0x4ceb5f[_0xdc1f('0x56')],function(_0x4beef5){if(_0x50b5a0){fs[_0xdc1f('0x60')](_0x4ceb5f[_0xdc1f('0x56')]);}});}}})[_0xdc1f('0x4a')](handleError(_0x1aaaf9,null));};exports['destroy']=function(_0x58fbe1,_0x34df25){return db['VoiceRecording'][_0xdc1f('0x4f')]({'where':{'id':_0x58fbe1[_0xdc1f('0x4c')]['id']}})[_0xdc1f('0x2c')](function(_0xbc8016){if(_[_0xdc1f('0x6b')](_0xbc8016)){throw new ReferenceError('Entity\x20not\x20found');}return _0xbc8016;})[_0xdc1f('0x2c')](function(_0x27e4a0){var _0x3561d2=_0x27e4a0[_0xdc1f('0x56')];logger[_0xdc1f('0x6c')](_0xdc1f('0x6d'),_0x3561d2);if(!_[_0xdc1f('0x6b')](_0x27e4a0[_0xdc1f('0x56')])&&fs[_0xdc1f('0x59')](_0x3561d2)){logger['info'](_0xdc1f('0x6e')+_0x3561d2+_0xdc1f('0x6f'));fs[_0xdc1f('0x70')](_0x3561d2);}_0x3561d2=_0x3561d2+_0xdc1f('0x71');if(!_[_0xdc1f('0x6b')](_0x27e4a0['value'])&&fs[_0xdc1f('0x59')](_0x3561d2)){logger[_0xdc1f('0x6c')](_0xdc1f('0x6e')+_0x3561d2+_0xdc1f('0x6f'));fs['unlinkSync'](_0x3561d2);}return _0x27e4a0;})[_0xdc1f('0x2c')](function(_0x22683c){if(!_0x22683c)throw new InternalError();return _0x22683c[_0xdc1f('0x2d')]();})[_0xdc1f('0x2c')](function(){_0x34df25['status'](0xcc)[_0xdc1f('0x20')]();})[_0xdc1f('0x4a')](handleError(_0x34df25,null));};function getBucketslist(_0x5dd61c,_0xce8dba,_0x262203){return new Promise(function(_0x5d45f5,_0x329890){var _0x4f35ba=new AWS['S3']({'accessKeyId':_0xce8dba,'secretAccessKey':_0x5dd61c,'region':_0x262203});_0x4f35ba[_0xdc1f('0x72')]({},function(_0x1519f7,_0x19d303){if(_0x1519f7){return _0x329890(_0x1519f7);}else{return _0x5d45f5(_0x19d303);}});});}function createBucket(_0x105b76,_0x19b554,_0x3ebe65,_0x16a18a){return new Promise(function(_0x447a92,_0x384716){var _0x37b3b1=new AWS['S3']({'accessKeyId':_0x19b554,'secretAccessKey':_0x105b76,'region':_0x3ebe65});_0x37b3b1[_0xdc1f('0x73')]({'Bucket':_0x16a18a},function(_0x9aea3c,_0x570800){if(_0x9aea3c){return _0x384716(_0x9aea3c);}else{return _0x447a92(_0x570800);}});});}function uploadFile(_0x389a19,_0x16e9f9,_0x1383d4,_0x28fa15,_0x1c8158,_0x2eddac){return new Promise(function(_0x12451f,_0x4373df){var _0x1d8705=new AWS['S3']({'accessKeyId':_0x16e9f9,'secretAccessKey':_0x389a19,'region':_0x1383d4});_0x1d8705['upload']({'Bucket':_0x28fa15,'Key':_0x1c8158,'Body':_0x2eddac},function(_0x2aade0,_0x301db0){if(_0x2aade0){return _0x4373df(_0x2aade0);}else{return _0x12451f(_0x301db0);}});});}function startTranscribe(_0x3dfc23,_0x101142,_0x24bb6f,_0x8c3cb6,_0x461777,_0x1258c2){return new Promise(function(_0x5d2188,_0x455260){var _0x3cc353=new AWS[(_0xdc1f('0x74'))]({'accessKeyId':_0x101142,'secretAccessKey':_0x3dfc23,'region':_0x24bb6f});_0x3cc353[_0xdc1f('0x75')]({'TranscriptionJobName':_0x8c3cb6,'LanguageCode':_0x461777,'Media':{'MediaFileUri':_0x1258c2}},function(_0x20445e,_0x314666){if(_0x20445e){return _0x455260(_0x20445e);}else{return _0x5d2188(_0x314666);}});});}function transcribe(_0x4da2ad,_0x5f43a9,_0x10b9ab,_0x301f98,_0x46cca0,_0x427125,_0x4ee321){return new Promise(function(_0x597a5f,_0x22ccec){var _0x53a7b0={};logger[_0xdc1f('0x6c')](util[_0xdc1f('0x57')](_0xdc1f('0x76'),_0x4da2ad,_0x46cca0));return uploadFile(_0x5f43a9,_0x10b9ab,_0x301f98,_0x46cca0,path[_0xdc1f('0x77')](_0x427125),fs[_0xdc1f('0x78')](_0x427125))[_0xdc1f('0x2c')](function(_0x36b098){logger[_0xdc1f('0x6c')](util['format'](_0xdc1f('0x79'),_0x4da2ad,_0x46cca0,_0x36b098[_0xdc1f('0x7a')]));_0x53a7b0[_0xdc1f('0x7b')]=_0x36b098[_0xdc1f('0x7c')];_0x53a7b0['location']=_0x36b098[_0xdc1f('0x7a')];logger['info'](util['format'](_0xdc1f('0x7d'),_0x4da2ad));return startTranscribe(_0x5f43a9,_0x10b9ab,_0x301f98,uuidv4(),_0x4ee321,_0x36b098[_0xdc1f('0x7a')]);})[_0xdc1f('0x2c')](function(_0x13f296){logger[_0xdc1f('0x6c')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x4da2ad,_0x13f296['TranscriptionJob']['TranscriptionJobName']));_0x53a7b0[_0xdc1f('0x7e')]=_0x13f296[_0xdc1f('0x7f')][_0xdc1f('0x80')];_0x53a7b0[_0xdc1f('0x81')]=_0x13f296[_0xdc1f('0x7f')][_0xdc1f('0x82')];return _0x597a5f(_0x53a7b0);})[_0xdc1f('0x4a')](function(_0x2d8aca){return _0x22ccec(_0x2d8aca);});});}exports[_0xdc1f('0x83')]=function(_0x40c479,_0x4e401d,_0x389176){var _0x1bdd83;var _0xee6388;var _0x1ad3c8;var _0x21bc4f=require(_0xdc1f('0x54'));return db[_0xdc1f('0x32')][_0xdc1f('0x84')]({'where':{'id':_0x40c479[_0xdc1f('0x4c')]['id']}})[_0xdc1f('0x2c')](function(_0x62b79a){if(_0x62b79a){var _0x12ba02=util[_0xdc1f('0x57')]('%s.cypher',_0x62b79a['value']);if(fs[_0xdc1f('0x59')](_0x12ba02)){cypher=!![];return _0x21bc4f['decryptFile'](_0x12ba02,_0x62b79a[_0xdc1f('0x56')],config[_0xdc1f('0x5b')][_0xdc1f('0x5c')])[_0xdc1f('0x2c')](function(){return _0x62b79a;});}return _0x62b79a;}})[_0xdc1f('0x2c')](function(_0x50f321){if(!_0x50f321){throw new db[(_0xdc1f('0x5d'))][(_0xdc1f('0x85'))]('Voice\x20Recording\x20not\x20found');}_0xee6388=_0x50f321;return db[_0xdc1f('0x86')][_0xdc1f('0x84')]({'where':{'id':0x1}});})[_0xdc1f('0x2c')](handleEntityNotFound(_0x4e401d,null))[_0xdc1f('0x2c')](function(_0x4902f9){if(_0x4902f9){_0x1bdd83=_0x4902f9;if(!_0x1bdd83['transcribe']||!_0x1bdd83[_0xdc1f('0x87')]||!_0x1bdd83[_0xdc1f('0x88')]||!_0x1bdd83[_0xdc1f('0x89')]||!_0x1bdd83['bucket']){throw new db[(_0xdc1f('0x5d'))][(_0xdc1f('0x85'))]('Transcribe\x20not\x20configured');}if(_0x40c479[_0xdc1f('0x51')][_0xdc1f('0x8a')]&&(!_0x1bdd83[_0xdc1f('0x8b')]||!_0x1bdd83['sentimentAccountId']||!_0x1bdd83['sentimentRegion']||!_0x1bdd83[_0xdc1f('0x89')]||!_0x1bdd83['bucket'])){throw new db[(_0xdc1f('0x5d'))]['ValidationError'](_0xdc1f('0x8c'));}return db[_0xdc1f('0x8d')]['findOne']({'where':{'id':_0x1bdd83[_0xdc1f('0x87')]}});}})['then'](function(_0x506a6e){if(!_0x506a6e){throw new db[(_0xdc1f('0x5d'))]['ValidationError'](_0xdc1f('0x8e'));}if(!_0x506a6e[_0xdc1f('0x8f')]||!_0x506a6e[_0xdc1f('0x90')]){throw new db['Sequelize'][(_0xdc1f('0x85'))](_0xdc1f('0x91'));}_0x1ad3c8=_0x506a6e;return getBucketslist(_0x1ad3c8[_0xdc1f('0x8f')],_0x1ad3c8[_0xdc1f('0x90')],_0x1bdd83[_0xdc1f('0x88')]);})['then'](function(_0x5495d2){if(_0x5495d2&&_0x5495d2[_0xdc1f('0x92')]){var _0xa02638=_[_0xdc1f('0x4f')](_0x5495d2['Buckets'],function(_0x16a706){return _0x16a706[_0xdc1f('0x93')]===_0x1bdd83[_0xdc1f('0x7b')];});if(!_0xa02638){logger['info'](util[_0xdc1f('0x57')](_0xdc1f('0x94'),_0x40c479[_0xdc1f('0x4c')]['id'],_0x1bdd83['bucket']));return createBucket(_0x1ad3c8[_0xdc1f('0x8f')],_0x1ad3c8[_0xdc1f('0x90')],_0x1bdd83[_0xdc1f('0x88')],_0x1bdd83[_0xdc1f('0x7b')]);}logger[_0xdc1f('0x6c')](util[_0xdc1f('0x57')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x40c479['params']['id'],_0x1bdd83[_0xdc1f('0x7b')]));return;}})[_0xdc1f('0x2c')](function(_0x2f8fbe){if(_0xee6388[_0xdc1f('0x81')]===_0xdc1f('0x95')){return transcribe(_0x40c479[_0xdc1f('0x4c')]['id'],_0x1ad3c8[_0xdc1f('0x8f')],_0x1ad3c8[_0xdc1f('0x90')],_0x1bdd83[_0xdc1f('0x88')],_0x1bdd83['bucket'],_0xee6388[_0xdc1f('0x56')],_0x1bdd83[_0xdc1f('0x89')]);}else{logger[_0xdc1f('0x6c')](util[_0xdc1f('0x57')](_0xdc1f('0x96'),_0x40c479[_0xdc1f('0x4c')]['id']));return{'transcribeStatus':_0xdc1f('0x97')};}})[_0xdc1f('0x2c')](function(_0x4b0fe2){if(_0x4b0fe2){_0x4b0fe2['tempSentiment']=_0x40c479[_0xdc1f('0x51')][_0xdc1f('0x8a')];return _0xee6388[_0xdc1f('0x98')](_0x4b0fe2);}})[_0xdc1f('0x2c')](respondWithResult(_0x4e401d,null))['catch'](handleError(_0x4e401d,null));};function writeFile(_0x2d1150,_0x42a63d){return new Promise(function(_0x98afd3,_0x52f235){fs[_0xdc1f('0x99')](_0x42a63d,_0x2d1150,function(_0x1a2816,_0x53af13){if(_0x1a2816){return _0x52f235(_0x1a2816);}else{return _0x98afd3(_0x53af13);}});});}exports[_0xdc1f('0x9a')]=function(_0xb402a1,_0x9db065,_0x14dc76){return db['VoiceRecording'][_0xdc1f('0x84')]({'where':{'id':_0xb402a1[_0xdc1f('0x4c')]['id']}})[_0xdc1f('0x2c')](handleEntityNotFound(_0x9db065))[_0xdc1f('0x2c')](function(_0x21c468){if(_0x21c468&&_0x21c468[_0xdc1f('0x9b')]){var _0x3bbcd9=_0x21c468[_0xdc1f('0x9b')];var _0x286187=config[_0xdc1f('0x9c')]+_0xdc1f('0x9d')+_0x21c468['id']+_0xdc1f('0x9e');if(fs[_0xdc1f('0x59')](_0x286187)){return _0x286187;}return writeFile(_0x3bbcd9,_0x286187)[_0xdc1f('0x2c')](function(){return _0x286187;});}else{throw new db[(_0xdc1f('0x5d'))][(_0xdc1f('0x85'))](_0xdc1f('0x9f'));}})[_0xdc1f('0x2c')](function(_0x3903ca){return _0x9db065[_0xdc1f('0x53')](_0x3903ca);})[_0xdc1f('0x4a')](handleError(_0x9db065));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 9227601..8076a96 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 _0x6ca8=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','voice_recordings','uniqueid','lodash'];(function(_0xb63756,_0x4b700f){var _0x48038e=function(_0x2a9ee5){while(--_0x2a9ee5){_0xb63756['push'](_0xb63756['shift']());}};_0x48038e(++_0x4b700f);}(_0x6ca8,0x74));var _0x86ca=function(_0x5f1c98,_0x4c8e8c){_0x5f1c98=_0x5f1c98-0x0;var _0x12ce8a=_0x6ca8[_0x5f1c98];return _0x12ce8a;};'use strict';var _=require(_0x86ca('0x0'));var util=require(_0x86ca('0x1'));var logger=require(_0x86ca('0x2'))(_0x86ca('0x3'));var moment=require(_0x86ca('0x4'));var BPromise=require('bluebird');var rp=require(_0x86ca('0x5'));var fs=require('fs');var path=require(_0x86ca('0x6'));var rimraf=require(_0x86ca('0x7'));var config=require(_0x86ca('0x8'));var attributes=require(_0x86ca('0x9'));module[_0x86ca('0xa')]=function(_0x3ed818,_0x25f654){return _0x3ed818['define']('VoiceRecording',attributes,{'tableName':_0x86ca('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x86ca('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x31d8=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','VoiceRecording','voice_recordings','uniqueid'];(function(_0x122cb1,_0x5abee1){var _0x51b9fd=function(_0x59900e){while(--_0x59900e){_0x122cb1['push'](_0x122cb1['shift']());}};_0x51b9fd(++_0x5abee1);}(_0x31d8,0xf7));var _0x831d=function(_0x1af233,_0x14fab4){_0x1af233=_0x1af233-0x0;var _0x411356=_0x31d8[_0x1af233];return _0x411356;};'use strict';var _=require(_0x831d('0x0'));var util=require(_0x831d('0x1'));var logger=require('../../config/logger')(_0x831d('0x2'));var moment=require(_0x831d('0x3'));var BPromise=require(_0x831d('0x4'));var rp=require(_0x831d('0x5'));var fs=require('fs');var path=require(_0x831d('0x6'));var rimraf=require(_0x831d('0x7'));var config=require(_0x831d('0x8'));var attributes=require(_0x831d('0x9'));module['exports']=function(_0x30fec8,_0x255b00){return _0x30fec8['define'](_0x831d('0xa'),attributes,{'tableName':_0x831d('0xb'),'paranoid':![],'indexes':[{'name':_0x831d('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index dfa6519..77d2b28 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 _0x5204=['attributes','limit','then','CreateVoiceRecording','../../components/encryptor','Setting','findOne','create','callRecordingEncryption','value','format','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','where'];(function(_0x41c0ad,_0x2a73a1){var _0x115106=function(_0x1f0f60){while(--_0x1f0f60){_0x41c0ad['push'](_0x41c0ad['shift']());}};_0x115106(++_0x2a73a1);}(_0x5204,0xdf));var _0x4520=function(_0x58ae8a,_0x3c619e){_0x58ae8a=_0x58ae8a-0x0;var _0x2f0b6b=_0x5204[_0x58ae8a];return _0x2f0b6b;};'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);});});}exports[_0x4520('0x17')]=function(_0x2e00f4){var _0x1dcf51=this;return new Promise(function(_0x4ba69f,_0x3791b6){return db[_0x4520('0x18')][_0x4520('0x19')](_0x2e00f4[_0x4520('0x1a')],{'raw':_0x2e00f4['options']?_0x2e00f4[_0x4520('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e00f4['options']?_0x2e00f4['options'][_0x4520('0x1c')]||null:null,'attributes':_0x2e00f4['options']?_0x2e00f4[_0x4520('0x1b')][_0x4520('0x1d')]||null:null,'limit':_0x2e00f4[_0x4520('0x1b')]?_0x2e00f4['options'][_0x4520('0x1e')]||null:null})[_0x4520('0x1f')](function(_0x3b2ede){logger['info'](_0x4520('0x17'),_0x2e00f4);logger[_0x4520('0xf')](_0x4520('0x17'),_0x2e00f4,JSON[_0x4520('0x11')](_0x3b2ede));_0x4ba69f(_0x3b2ede);})[_0x4520('0x16')](function(_0x552da1){logger[_0x4520('0x12')](_0x4520('0x17'),_0x552da1[_0x4520('0x14')],_0x2e00f4);_0x3791b6(_0x1dcf51[_0x4520('0x12')](0x1f4,_0x552da1['message']));});});};exports[_0x4520('0x20')]=function(_0x4602a4){var _0x92168b=this;return new Promise(function(_0x21e1f3,_0xad9f8){var _0x2c95ea=require(_0x4520('0x21'));var _0x195c58;return db[_0x4520('0x22')][_0x4520('0x23')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x4520('0x1f')](function(_0x5c1a0b){_0x195c58=_0x5c1a0b;return db[_0x4520('0x18')][_0x4520('0x24')](_0x4602a4[_0x4520('0x1a')]);})[_0x4520('0x1f')](function(_0x1da740){if(_0x195c58[_0x4520('0x25')]&&fs['existsSync'](_0x1da740[_0x4520('0x26')])){var _0x508c05=util[_0x4520('0x27')]('%s.cypher',_0x1da740[_0x4520('0x26')]);return _0x2c95ea['encryptFile'](_0x1da740[_0x4520('0x26')],_0x508c05,config['secrets']['recording'])[_0x4520('0x1f')](function(){fs[_0x4520('0x28')](_0x1da740[_0x4520('0x26')]);logger['info'](_0x4520('0x29'));return _0x1da740;});}return _0x1da740;})[_0x4520('0x1f')](function(_0x2acb4e){logger[_0x4520('0xc')]('CreateVoiceRecording',_0x4602a4);logger['debug'](_0x4520('0x20'),_0x4602a4,JSON[_0x4520('0x11')](_0x2acb4e));_0x21e1f3(_0x2acb4e);})['catch'](function(_0x779e94){logger[_0x4520('0x12')](_0x4520('0x20'),_0x779e94[_0x4520('0x14')],_0x4602a4);_0xad9f8(_0x92168b[_0x4520('0x12')](0x1f4,_0x779e94[_0x4520('0x14')]));});});}; \ No newline at end of file +var _0x160f=['../../config/environment','client','http','then','info','VoiceRecording,\x20%s,\x20%s','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','debug','CreateVoiceRecording','../../components/encryptor','Setting','create','existsSync','format','%s.cypher','encryptFile','value','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x26da06,_0x44caa0){var _0x30d5a0=function(_0x4f4cf0){while(--_0x4f4cf0){_0x26da06['push'](_0x26da06['shift']());}};_0x30d5a0(++_0x44caa0);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf160('0x0'));var util=require(_0xf160('0x1'));var moment=require(_0xf160('0x2'));var BPromise=require(_0xf160('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf160('0x4'));var db=require(_0xf160('0x5'))['db'];var utils=require(_0xf160('0x6'));var logger=require(_0xf160('0x7'))(_0xf160('0x8'));var config=require(_0xf160('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf160('0xa')][_0xf160('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49fe49,_0x59440e,_0x41e909){return new BPromise(function(_0x5b76c8,_0x4bf890){return client['request'](_0x49fe49,_0x41e909)[_0xf160('0xc')](function(_0x90608){logger[_0xf160('0xd')](_0xf160('0xe'),_0x59440e,'request\x20sent');logger['debug'](_0xf160('0xf'),_0x59440e,_0xf160('0x10'),JSON[_0xf160('0x11')](_0x90608));if(_0x90608['error']){if(_0x90608[_0xf160('0x12')][_0xf160('0x13')]===0x1f4){logger[_0xf160('0x12')](_0xf160('0xe'),_0x59440e,_0x90608[_0xf160('0x12')]['message']);return _0x4bf890(_0x90608[_0xf160('0x12')]['message']);}logger[_0xf160('0x12')](_0xf160('0xe'),_0x59440e,_0x90608[_0xf160('0x12')][_0xf160('0x14')]);return _0x5b76c8(_0x90608[_0xf160('0x12')][_0xf160('0x14')]);}else{logger[_0xf160('0xd')](_0xf160('0xe'),_0x59440e,_0xf160('0x10'));_0x5b76c8(_0x90608['result'][_0xf160('0x14')]);}})[_0xf160('0x15')](function(_0x8699a0){logger[_0xf160('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x59440e,_0x8699a0);_0x4bf890(_0x8699a0);});});}exports[_0xf160('0x16')]=function(_0x4b8185){var _0x5388c7=this;return new Promise(function(_0x1cf6ba,_0x1e0c78){return db[_0xf160('0x17')][_0xf160('0x18')](_0x4b8185[_0xf160('0x19')],{'raw':_0x4b8185[_0xf160('0x1a')]?_0x4b8185[_0xf160('0x1a')][_0xf160('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b8185['options']?_0x4b8185[_0xf160('0x1a')][_0xf160('0x1c')]||null:null,'attributes':_0x4b8185[_0xf160('0x1a')]?_0x4b8185['options'][_0xf160('0x1d')]||null:null,'limit':_0x4b8185[_0xf160('0x1a')]?_0x4b8185[_0xf160('0x1a')][_0xf160('0x1e')]||null:null})[_0xf160('0xc')](function(_0x1b0081){logger[_0xf160('0xd')]('UpdateVoiceRecording',_0x4b8185);logger[_0xf160('0x1f')](_0xf160('0x16'),_0x4b8185,JSON[_0xf160('0x11')](_0x1b0081));_0x1cf6ba(_0x1b0081);})[_0xf160('0x15')](function(_0x578f7d){logger[_0xf160('0x12')](_0xf160('0x16'),_0x578f7d['message'],_0x4b8185);_0x1e0c78(_0x5388c7['error'](0x1f4,_0x578f7d[_0xf160('0x14')]));});});};exports[_0xf160('0x20')]=function(_0x39c0e3){var _0x4c0c51=this;return new Promise(function(_0xcfa9bd,_0x73851f){var _0x2851e8=require(_0xf160('0x21'));var _0x135e0f;return db[_0xf160('0x22')]['findOne']({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})['then'](function(_0x26e7b9){_0x135e0f=_0x26e7b9;return db[_0xf160('0x17')][_0xf160('0x23')](_0x39c0e3[_0xf160('0x19')]);})[_0xf160('0xc')](function(_0x563103){if(_0x135e0f['callRecordingEncryption']&&fs[_0xf160('0x24')](_0x563103['value'])){var _0x4ce478=util[_0xf160('0x25')](_0xf160('0x26'),_0x563103['value']);return _0x2851e8[_0xf160('0x27')](_0x563103[_0xf160('0x28')],_0x4ce478,config['secrets']['recording'])['then'](function(){fs['unlink'](_0x563103[_0xf160('0x28')]);logger[_0xf160('0xd')](_0xf160('0x29'));return _0x563103;});}return _0x563103;})[_0xf160('0xc')](function(_0x16c528){logger[_0xf160('0xd')]('CreateVoiceRecording',_0x39c0e3);logger['debug']('CreateVoiceRecording',_0x39c0e3,JSON[_0xf160('0x11')](_0x16c528));_0xcfa9bd(_0x16c528);})['catch'](function(_0x5c65d2){logger[_0xf160('0x12')](_0xf160('0x20'),_0x5c65d2['message'],_0x39c0e3);_0x73851f(_0x4c0c51[_0xf160('0x12')](0x1f4,_0x5c65d2[_0xf160('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 25fd7b7..5b95133 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 _0x1fa3=['multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports'];(function(_0x4c2dfc,_0x4814c0){var _0xfd728d=function(_0x5b8d81){while(--_0x5b8d81){_0x4c2dfc['push'](_0x4c2dfc['shift']());}};_0xfd728d(++_0x4814c0);}(_0x1fa3,0x104));var _0x31fa=function(_0x567f55,_0xd4da7){_0x567f55=_0x567f55-0x0;var _0xc4d4ba=_0x1fa3[_0x567f55];return _0xc4d4ba;};'use strict';var multer=require(_0x31fa('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x31fa('0x1'));var express=require(_0x31fa('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x31fa('0x3'));var interaction=require(_0x31fa('0x4'));var config=require(_0x31fa('0x5'));var controller=require(_0x31fa('0x6'));router[_0x31fa('0x7')]('/',auth[_0x31fa('0x8')](),controller[_0x31fa('0x9')]);router[_0x31fa('0x7')](_0x31fa('0xa'),auth[_0x31fa('0x8')](),controller[_0x31fa('0xb')]);router['get'](_0x31fa('0xc'),auth[_0x31fa('0x8')](),controller[_0x31fa('0xd')]);router[_0x31fa('0xe')]('/',auth[_0x31fa('0x8')](),controller[_0x31fa('0xf')]);router[_0x31fa('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x31fa('0x11')]);router['delete'](_0x31fa('0xc'),auth[_0x31fa('0x8')](),controller[_0x31fa('0x12')]);module[_0x31fa('0x13')]=router; \ No newline at end of file +var _0x4ec9=['put','update','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x4ec9,0x138));var _0x94ec=function(_0x3c9df8,_0x387a5d){_0x3c9df8=_0x3c9df8-0x0;var _0x3c8cd3=_0x4ec9[_0x3c9df8];return _0x3c8cd3;};'use strict';var multer=require(_0x94ec('0x0'));var util=require(_0x94ec('0x1'));var path=require(_0x94ec('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x94ec('0x3')]();var fs_extra=require(_0x94ec('0x4'));var auth=require(_0x94ec('0x5'));var interaction=require(_0x94ec('0x6'));var config=require(_0x94ec('0x7'));var controller=require(_0x94ec('0x8'));router[_0x94ec('0x9')]('/',auth[_0x94ec('0xa')](),controller[_0x94ec('0xb')]);router[_0x94ec('0x9')](_0x94ec('0xc'),auth['isAuthenticated'](),controller[_0x94ec('0xd')]);router[_0x94ec('0x9')](_0x94ec('0xe'),auth[_0x94ec('0xa')](),controller[_0x94ec('0xf')]);router[_0x94ec('0x10')]('/',auth[_0x94ec('0xa')](),controller[_0x94ec('0x11')]);router[_0x94ec('0x12')]('/:id',auth[_0x94ec('0xa')](),controller[_0x94ec('0x13')]);router['delete']('/:id',auth[_0x94ec('0xa')](),controller[_0x94ec('0x14')]);module[_0x94ec('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index b7d8e97..0747472 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 _0x3cc7=['exports','ENUM','attended','STRING','Yes','sequelize','moment'];(function(_0x4ee6e0,_0x42c6a0){var _0x503f25=function(_0x1f7734){while(--_0x1f7734){_0x4ee6e0['push'](_0x4ee6e0['shift']());}};_0x503f25(++_0x42c6a0);}(_0x3cc7,0x116));var _0x73cc=function(_0x16bb0e,_0x343132){_0x16bb0e=_0x16bb0e-0x0;var _0x102b8b=_0x3cc7[_0x16bb0e];return _0x102b8b;};'use strict';var Sequelize=require(_0x73cc('0x0'));var moment=require(_0x73cc('0x1'));module[_0x73cc('0x2')]={'type':{'type':Sequelize[_0x73cc('0x3')]('blind',_0x73cc('0x4'))},'result':{'type':Sequelize[_0x73cc('0x5')]},'transfererchannel':{'type':Sequelize[_0x73cc('0x5')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x73cc('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x73cc('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x73cc('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x73cc('0x5')]},'transferercontext':{'type':Sequelize[_0x73cc('0x5')]},'transfererexten':{'type':Sequelize[_0x73cc('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x73cc('0x5')]},'transfereechannel':{'type':Sequelize[_0x73cc('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x73cc('0x5')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x73cc('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x73cc('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x73cc('0x5')]},'isexternal':{'type':Sequelize[_0x73cc('0x3')](_0x73cc('0x6'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x73cc('0x5')]}}; \ No newline at end of file +var _0xcb62=['Yes','moment','ENUM','blind','attended','STRING'];(function(_0x26ffb9,_0x3551d9){var _0x581e6e=function(_0x4ac873){while(--_0x4ac873){_0x26ffb9['push'](_0x26ffb9['shift']());}};_0x581e6e(++_0x3551d9);}(_0xcb62,0x1b1));var _0x2cb6=function(_0x14c9b4,_0x50f0e0){_0x14c9b4=_0x14c9b4-0x0;var _0x1cbe19=_0xcb62[_0x14c9b4];return _0x1cbe19;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2cb6('0x0'));module['exports']={'type':{'type':Sequelize[_0x2cb6('0x1')](_0x2cb6('0x2'),_0x2cb6('0x3'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x2cb6('0x4')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x2cb6('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x2cb6('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x2cb6('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x2cb6('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x2cb6('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x2cb6('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x2cb6('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x2cb6('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x2cb6('0x4')]},'transfereecontext':{'type':Sequelize[_0x2cb6('0x4')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x2cb6('0x4')]},'isexternal':{'type':Sequelize[_0x2cb6('0x1')](_0x2cb6('0x5'),'No')},'context':{'type':Sequelize[_0x2cb6('0x4')]},'extension':{'type':Sequelize[_0x2cb6('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 645a230..373ea25 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 _0x0199=['destroy','error','stack','name','map','VoiceTransferReport','rawAttributes','key','model','keys','query','attributes','intersection','fields','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','describe','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x0199,0xfa));var _0x9019=function(_0x4f9124,_0x441308){_0x4f9124=_0x4f9124-0x0;var _0x590c70=_0x0199[_0x4f9124];return _0x590c70;};'use strict';var emlformat=require(_0x9019('0x0'));var rimraf=require(_0x9019('0x1'));var zipdir=require(_0x9019('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9019('0x3'));var Mustache=require(_0x9019('0x4'));var util=require(_0x9019('0x5'));var path=require(_0x9019('0x6'));var sox=require(_0x9019('0x7'));var csv=require(_0x9019('0x8'));var ejs=require(_0x9019('0x9'));var fs=require('fs');var fs_extra=require(_0x9019('0xa'));var _=require(_0x9019('0xb'));var squel=require(_0x9019('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9019('0xd'));var toCsv=require(_0x9019('0x8'));var querystring=require(_0x9019('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9019('0xf'));var qs=require(_0x9019('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9019('0x11'));var logger=require(_0x9019('0x12'))(_0x9019('0x13'));var utils=require(_0x9019('0x14'));var config=require(_0x9019('0x15'));var licenseUtil=require(_0x9019('0x16'));var db=require(_0x9019('0x17'))['db'];function respondWithStatusCode(_0x592f6b,_0x88030e){_0x88030e=_0x88030e||0xcc;return function(_0x1d9582){if(_0x1d9582){return _0x592f6b[_0x9019('0x18')](_0x88030e);}return _0x592f6b[_0x9019('0x19')](_0x88030e)[_0x9019('0x1a')]();};}function respondWithResult(_0xdf3ee2,_0x27327e){_0x27327e=_0x27327e||0xc8;return function(_0x20307c){if(_0x20307c){return _0xdf3ee2[_0x9019('0x19')](_0x27327e)[_0x9019('0x1b')](_0x20307c);}};}function respondWithFilteredResult(_0x44d1ce,_0xbc05cb){return function(_0x23f386){if(_0x23f386){var _0x57dbc6=typeof _0xbc05cb['offset']===_0x9019('0x1c')&&typeof _0xbc05cb[_0x9019('0x1d')]===_0x9019('0x1c');var _0x3a6884=_0x23f386[_0x9019('0x1e')];var _0x2247aa=_0x57dbc6?0x0:_0xbc05cb[_0x9019('0x1f')];var _0xec98c3=_0x57dbc6?_0x23f386[_0x9019('0x1e')]:_0xbc05cb['offset']+_0xbc05cb['limit'];var _0xa786b8;if(_0xec98c3>=_0x3a6884){_0xec98c3=_0x3a6884;_0xa786b8=0xc8;}else{_0xa786b8=0xce;}_0x44d1ce['status'](_0xa786b8);return _0x44d1ce[_0x9019('0x20')](_0x9019('0x21'),_0x2247aa+'-'+_0xec98c3+'/'+_0x3a6884)[_0x9019('0x1b')](_0x23f386);}return null;};}function patchUpdates(_0x136319){return function(_0x3909aa){try{jsonpatch['apply'](_0x3909aa,_0x136319,!![]);}catch(_0x21394b){return BPromise[_0x9019('0x22')](_0x21394b);}return _0x3909aa[_0x9019('0x23')]();};}function saveUpdates(_0x3176ea,_0x3f37e7){return function(_0x2c15cb){if(_0x2c15cb){return _0x2c15cb[_0x9019('0x24')](_0x3176ea)[_0x9019('0x25')](function(_0x1278bb){return _0x1278bb;});}return null;};}function removeEntity(_0x31ca33,_0xadc8c6){return function(_0xad81a3){if(_0xad81a3){return _0xad81a3[_0x9019('0x26')]()[_0x9019('0x25')](function(){_0x31ca33[_0x9019('0x19')](0xcc)[_0x9019('0x1a')]();});}};}function handleEntityNotFound(_0x4b63cc,_0x476911){return function(_0x7fb8c8){if(!_0x7fb8c8){_0x4b63cc['sendStatus'](0x194);}return _0x7fb8c8;};}function handleError(_0x49d1d6,_0x9558cf){_0x9558cf=_0x9558cf||0x1f4;return function(_0x534b12){logger[_0x9019('0x27')](_0x534b12[_0x9019('0x28')]);if(_0x534b12[_0x9019('0x29')]){delete _0x534b12[_0x9019('0x29')];}_0x49d1d6[_0x9019('0x19')](_0x9558cf)['send'](_0x534b12);};}exports['index']=function(_0x2c50d5,_0x326b90){var _0x2b190b={},_0x80f152={},_0xbc8cdb={'count':0x0,'rows':[]};var _0x23e338=_[_0x9019('0x2a')](db[_0x9019('0x2b')][_0x9019('0x2c')],function(_0x1cc76c){return{'name':_0x1cc76c['fieldName'],'type':_0x1cc76c['type'][_0x9019('0x2d')]};});_0x80f152[_0x9019('0x2e')]=_[_0x9019('0x2a')](_0x23e338,_0x9019('0x29'));_0x80f152['query']=_[_0x9019('0x2f')](_0x2c50d5['query']);_0x80f152['filters']=_['intersection'](_0x80f152[_0x9019('0x2e')],_0x80f152[_0x9019('0x30')]);_0x2b190b[_0x9019('0x31')]=_[_0x9019('0x32')](_0x80f152[_0x9019('0x2e')],qs[_0x9019('0x33')](_0x2c50d5[_0x9019('0x30')]['fields']));_0x2b190b[_0x9019('0x31')]=_0x2b190b[_0x9019('0x31')]['length']?_0x2b190b['attributes']:_0x80f152[_0x9019('0x2e')];if(!_0x2c50d5[_0x9019('0x30')]['hasOwnProperty']('nolimit')){_0x2b190b[_0x9019('0x1d')]=qs[_0x9019('0x1d')](_0x2c50d5[_0x9019('0x30')][_0x9019('0x1d')]);_0x2b190b[_0x9019('0x1f')]=qs[_0x9019('0x1f')](_0x2c50d5[_0x9019('0x30')][_0x9019('0x1f')]);}_0x2b190b['order']=qs[_0x9019('0x34')](_0x2c50d5[_0x9019('0x30')][_0x9019('0x34')]);_0x2b190b[_0x9019('0x35')]=qs[_0x9019('0x36')](_['pick'](_0x2c50d5[_0x9019('0x30')],_0x80f152['filters']),_0x23e338);if(_0x2c50d5['query'][_0x9019('0x37')]){_0x2b190b[_0x9019('0x35')]=_[_0x9019('0x38')](_0x2b190b[_0x9019('0x35')],{'$or':_[_0x9019('0x2a')](_0x23e338,function(_0x2d1d44){if(_0x2d1d44[_0x9019('0x39')]!==_0x9019('0x3a')){var _0x519055={};_0x519055[_0x2d1d44[_0x9019('0x29')]]={'$like':'%'+_0x2c50d5[_0x9019('0x30')][_0x9019('0x37')]+'%'};return _0x519055;}})});}_0x2b190b=_[_0x9019('0x38')]({},_0x2b190b,_0x2c50d5[_0x9019('0x3b')]);var _0x5a3b2d={'where':_0x2b190b[_0x9019('0x35')]};return db[_0x9019('0x2b')][_0x9019('0x1e')](_0x5a3b2d)['then'](function(_0x518fb9){_0xbc8cdb[_0x9019('0x1e')]=_0x518fb9;if(_0x2c50d5[_0x9019('0x30')][_0x9019('0x3c')]){_0x2b190b['include']=[{'all':!![]}];}return db[_0x9019('0x2b')][_0x9019('0x3d')](_0x2b190b);})[_0x9019('0x25')](function(_0xd6cb88){_0xbc8cdb[_0x9019('0x3e')]=_0xd6cb88;return _0xbc8cdb;})[_0x9019('0x25')](respondWithFilteredResult(_0x326b90,_0x2b190b))[_0x9019('0x3f')](handleError(_0x326b90,null));};exports[_0x9019('0x40')]=function(_0x5e24fa,_0x3f9ff1){var _0x52a10e={'raw':!![],'where':{'id':_0x5e24fa[_0x9019('0x41')]['id']}},_0x5c789b={};_0x5c789b[_0x9019('0x2e')]=_['keys'](db['VoiceTransferReport']['rawAttributes']);_0x5c789b['query']=_[_0x9019('0x2f')](_0x5e24fa['query']);_0x5c789b['filters']=_[_0x9019('0x32')](_0x5c789b[_0x9019('0x2e')],_0x5c789b[_0x9019('0x30')]);_0x52a10e['attributes']=_[_0x9019('0x32')](_0x5c789b['model'],qs['fields'](_0x5e24fa['query'][_0x9019('0x33')]));_0x52a10e[_0x9019('0x31')]=_0x52a10e[_0x9019('0x31')][_0x9019('0x42')]?_0x52a10e['attributes']:_0x5c789b['model'];if(_0x5e24fa[_0x9019('0x30')]['includeAll']){_0x52a10e[_0x9019('0x43')]=[{'all':!![]}];}_0x52a10e=_[_0x9019('0x38')]({},_0x52a10e,_0x5e24fa[_0x9019('0x3b')]);return db[_0x9019('0x2b')][_0x9019('0x44')](_0x52a10e)[_0x9019('0x25')](handleEntityNotFound(_0x3f9ff1,null))['then'](respondWithResult(_0x3f9ff1,null))[_0x9019('0x3f')](handleError(_0x3f9ff1,null));};exports[_0x9019('0x45')]=function(_0x302121,_0x5c51a5){return db[_0x9019('0x2b')][_0x9019('0x45')](_0x302121['body'],{})['then'](respondWithResult(_0x5c51a5,0xc9))[_0x9019('0x3f')](handleError(_0x5c51a5,null));};exports[_0x9019('0x24')]=function(_0x24d547,_0x1d2080){if(_0x24d547['body']['id']){delete _0x24d547[_0x9019('0x46')]['id'];}return db[_0x9019('0x2b')][_0x9019('0x44')]({'where':{'id':_0x24d547[_0x9019('0x41')]['id']}})[_0x9019('0x25')](handleEntityNotFound(_0x1d2080,null))[_0x9019('0x25')](saveUpdates(_0x24d547[_0x9019('0x46')],null))[_0x9019('0x25')](respondWithResult(_0x1d2080,null))[_0x9019('0x3f')](handleError(_0x1d2080,null));};exports[_0x9019('0x26')]=function(_0x255029,_0x2610b9){return db[_0x9019('0x2b')]['find']({'where':{'id':_0x255029[_0x9019('0x41')]['id']}})['then'](handleEntityNotFound(_0x2610b9,null))[_0x9019('0x25')](removeEntity(_0x2610b9,null))[_0x9019('0x3f')](handleError(_0x2610b9,null));};exports[_0x9019('0x47')]=function(_0x1cc0e7,_0x1e77e6){return db['VoiceTransferReport']['describe']()[_0x9019('0x25')](respondWithResult(_0x1e77e6,null))[_0x9019('0x3f')](handleError(_0x1e77e6,null));}; \ No newline at end of file +var _0xcb6f=['end','json','limit','undefined','count','offset','set','Content-Range','apply','save','then','destroy','error','name','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','map','VIRTUAL','merge','options','findAll','rows','catch','show','keys','length','includeAll','include','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x36ad2a,_0x1c1291){var _0x294bfc=function(_0x52a7c8){while(--_0x52a7c8){_0x36ad2a['push'](_0x36ad2a['shift']());}};_0x294bfc(++_0x1c1291);}(_0xcb6f,0x1b2));var _0xfcb6=function(_0x1fb04b,_0x510eac){_0x1fb04b=_0x1fb04b-0x0;var _0x3ef33f=_0xcb6f[_0x1fb04b];return _0x3ef33f;};'use strict';var emlformat=require(_0xfcb6('0x0'));var rimraf=require(_0xfcb6('0x1'));var zipdir=require(_0xfcb6('0x2'));var jsonpatch=require(_0xfcb6('0x3'));var rp=require(_0xfcb6('0x4'));var moment=require(_0xfcb6('0x5'));var BPromise=require(_0xfcb6('0x6'));var Mustache=require(_0xfcb6('0x7'));var util=require('util');var path=require('path');var sox=require(_0xfcb6('0x8'));var csv=require('to-csv');var ejs=require(_0xfcb6('0x9'));var fs=require('fs');var fs_extra=require(_0xfcb6('0xa'));var _=require(_0xfcb6('0xb'));var squel=require(_0xfcb6('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfcb6('0xd'));var toCsv=require(_0xfcb6('0xe'));var querystring=require(_0xfcb6('0xf'));var Papa=require(_0xfcb6('0x10'));var Redis=require('ioredis');var authService=require(_0xfcb6('0x11'));var qs=require(_0xfcb6('0x12'));var as=require(_0xfcb6('0x13'));var hardwareService=require(_0xfcb6('0x14'));var logger=require(_0xfcb6('0x15'))(_0xfcb6('0x16'));var utils=require(_0xfcb6('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xfcb6('0x18'));var db=require(_0xfcb6('0x19'))['db'];function respondWithStatusCode(_0x15a39e,_0x1c7ee6){_0x1c7ee6=_0x1c7ee6||0xcc;return function(_0x1f9d2c){if(_0x1f9d2c){return _0x15a39e[_0xfcb6('0x1a')](_0x1c7ee6);}return _0x15a39e[_0xfcb6('0x1b')](_0x1c7ee6)[_0xfcb6('0x1c')]();};}function respondWithResult(_0x2ff0c8,_0x4547f9){_0x4547f9=_0x4547f9||0xc8;return function(_0x5ef76c){if(_0x5ef76c){return _0x2ff0c8[_0xfcb6('0x1b')](_0x4547f9)[_0xfcb6('0x1d')](_0x5ef76c);}};}function respondWithFilteredResult(_0x34a3b1,_0x58f644){return function(_0x3503b4){if(_0x3503b4){var _0x43746f=typeof _0x58f644['offset']==='undefined'&&typeof _0x58f644[_0xfcb6('0x1e')]===_0xfcb6('0x1f');var _0x289acb=_0x3503b4[_0xfcb6('0x20')];var _0x1f06d7=_0x43746f?0x0:_0x58f644[_0xfcb6('0x21')];var _0x3a2d05=_0x43746f?_0x3503b4[_0xfcb6('0x20')]:_0x58f644[_0xfcb6('0x21')]+_0x58f644[_0xfcb6('0x1e')];var _0x249916;if(_0x3a2d05>=_0x289acb){_0x3a2d05=_0x289acb;_0x249916=0xc8;}else{_0x249916=0xce;}_0x34a3b1[_0xfcb6('0x1b')](_0x249916);return _0x34a3b1[_0xfcb6('0x22')](_0xfcb6('0x23'),_0x1f06d7+'-'+_0x3a2d05+'/'+_0x289acb)['json'](_0x3503b4);}return null;};}function patchUpdates(_0xa5a52d){return function(_0x4ad0a4){try{jsonpatch[_0xfcb6('0x24')](_0x4ad0a4,_0xa5a52d,!![]);}catch(_0x1c9d22){return BPromise['reject'](_0x1c9d22);}return _0x4ad0a4[_0xfcb6('0x25')]();};}function saveUpdates(_0x3c3fd5,_0x2f883e){return function(_0x99dcea){if(_0x99dcea){return _0x99dcea['update'](_0x3c3fd5)[_0xfcb6('0x26')](function(_0x5a4106){return _0x5a4106;});}return null;};}function removeEntity(_0x47d142,_0xb531ae){return function(_0x2c165a){if(_0x2c165a){return _0x2c165a[_0xfcb6('0x27')]()['then'](function(){_0x47d142[_0xfcb6('0x1b')](0xcc)[_0xfcb6('0x1c')]();});}};}function handleEntityNotFound(_0x544621,_0x12102d){return function(_0x4021c8){if(!_0x4021c8){_0x544621['sendStatus'](0x194);}return _0x4021c8;};}function handleError(_0x4d4434,_0x4b298a){_0x4b298a=_0x4b298a||0x1f4;return function(_0x3a7d7f){logger[_0xfcb6('0x28')](_0x3a7d7f['stack']);if(_0x3a7d7f[_0xfcb6('0x29')]){delete _0x3a7d7f[_0xfcb6('0x29')];}_0x4d4434[_0xfcb6('0x1b')](_0x4b298a)['send'](_0x3a7d7f);};}exports['index']=function(_0x96400c,_0x398987){var _0xdaf84c={},_0x3d59ff={},_0x3bd1b4={'count':0x0,'rows':[]};var _0x4bbc7b=_['map'](db[_0xfcb6('0x2a')][_0xfcb6('0x2b')],function(_0x3a678d){return{'name':_0x3a678d[_0xfcb6('0x2c')],'type':_0x3a678d[_0xfcb6('0x2d')][_0xfcb6('0x2e')]};});_0x3d59ff[_0xfcb6('0x2f')]=_['map'](_0x4bbc7b,_0xfcb6('0x29'));_0x3d59ff[_0xfcb6('0x30')]=_['keys'](_0x96400c[_0xfcb6('0x30')]);_0x3d59ff[_0xfcb6('0x31')]=_[_0xfcb6('0x32')](_0x3d59ff[_0xfcb6('0x2f')],_0x3d59ff[_0xfcb6('0x30')]);_0xdaf84c[_0xfcb6('0x33')]=_[_0xfcb6('0x32')](_0x3d59ff['model'],qs[_0xfcb6('0x34')](_0x96400c['query']['fields']));_0xdaf84c[_0xfcb6('0x33')]=_0xdaf84c['attributes']['length']?_0xdaf84c[_0xfcb6('0x33')]:_0x3d59ff[_0xfcb6('0x2f')];if(!_0x96400c[_0xfcb6('0x30')][_0xfcb6('0x35')]('nolimit')){_0xdaf84c[_0xfcb6('0x1e')]=qs[_0xfcb6('0x1e')](_0x96400c[_0xfcb6('0x30')][_0xfcb6('0x1e')]);_0xdaf84c[_0xfcb6('0x21')]=qs['offset'](_0x96400c['query']['offset']);}_0xdaf84c[_0xfcb6('0x36')]=qs[_0xfcb6('0x37')](_0x96400c[_0xfcb6('0x30')][_0xfcb6('0x37')]);_0xdaf84c[_0xfcb6('0x38')]=qs['filters'](_[_0xfcb6('0x39')](_0x96400c[_0xfcb6('0x30')],_0x3d59ff[_0xfcb6('0x31')]),_0x4bbc7b);if(_0x96400c[_0xfcb6('0x30')][_0xfcb6('0x3a')]){_0xdaf84c[_0xfcb6('0x38')]=_['merge'](_0xdaf84c[_0xfcb6('0x38')],{'$or':_[_0xfcb6('0x3b')](_0x4bbc7b,function(_0x336dd5){if(_0x336dd5['type']!==_0xfcb6('0x3c')){var _0x4f8b62={};_0x4f8b62[_0x336dd5[_0xfcb6('0x29')]]={'$like':'%'+_0x96400c[_0xfcb6('0x30')][_0xfcb6('0x3a')]+'%'};return _0x4f8b62;}})});}_0xdaf84c=_[_0xfcb6('0x3d')]({},_0xdaf84c,_0x96400c[_0xfcb6('0x3e')]);var _0x434ebb={'where':_0xdaf84c[_0xfcb6('0x38')]};return db[_0xfcb6('0x2a')][_0xfcb6('0x20')](_0x434ebb)[_0xfcb6('0x26')](function(_0x72d40f){_0x3bd1b4['count']=_0x72d40f;if(_0x96400c[_0xfcb6('0x30')]['includeAll']){_0xdaf84c['include']=[{'all':!![]}];}return db[_0xfcb6('0x2a')][_0xfcb6('0x3f')](_0xdaf84c);})[_0xfcb6('0x26')](function(_0x95e1dc){_0x3bd1b4[_0xfcb6('0x40')]=_0x95e1dc;return _0x3bd1b4;})[_0xfcb6('0x26')](respondWithFilteredResult(_0x398987,_0xdaf84c))[_0xfcb6('0x41')](handleError(_0x398987,null));};exports[_0xfcb6('0x42')]=function(_0x4a8ac0,_0x571a5f){var _0x380e2a={'raw':!![],'where':{'id':_0x4a8ac0['params']['id']}},_0x14ef9f={};_0x14ef9f[_0xfcb6('0x2f')]=_[_0xfcb6('0x43')](db[_0xfcb6('0x2a')]['rawAttributes']);_0x14ef9f['query']=_['keys'](_0x4a8ac0['query']);_0x14ef9f[_0xfcb6('0x31')]=_[_0xfcb6('0x32')](_0x14ef9f['model'],_0x14ef9f[_0xfcb6('0x30')]);_0x380e2a[_0xfcb6('0x33')]=_[_0xfcb6('0x32')](_0x14ef9f['model'],qs[_0xfcb6('0x34')](_0x4a8ac0['query'][_0xfcb6('0x34')]));_0x380e2a[_0xfcb6('0x33')]=_0x380e2a[_0xfcb6('0x33')][_0xfcb6('0x44')]?_0x380e2a[_0xfcb6('0x33')]:_0x14ef9f[_0xfcb6('0x2f')];if(_0x4a8ac0[_0xfcb6('0x30')][_0xfcb6('0x45')]){_0x380e2a[_0xfcb6('0x46')]=[{'all':!![]}];}_0x380e2a=_[_0xfcb6('0x3d')]({},_0x380e2a,_0x4a8ac0[_0xfcb6('0x3e')]);return db[_0xfcb6('0x2a')][_0xfcb6('0x47')](_0x380e2a)[_0xfcb6('0x26')](handleEntityNotFound(_0x571a5f,null))['then'](respondWithResult(_0x571a5f,null))[_0xfcb6('0x41')](handleError(_0x571a5f,null));};exports[_0xfcb6('0x48')]=function(_0x31ee0c,_0x14920d){return db[_0xfcb6('0x2a')][_0xfcb6('0x48')](_0x31ee0c[_0xfcb6('0x49')],{})[_0xfcb6('0x26')](respondWithResult(_0x14920d,0xc9))[_0xfcb6('0x41')](handleError(_0x14920d,null));};exports[_0xfcb6('0x4a')]=function(_0x5d455a,_0x17192f){if(_0x5d455a['body']['id']){delete _0x5d455a[_0xfcb6('0x49')]['id'];}return db[_0xfcb6('0x2a')]['find']({'where':{'id':_0x5d455a[_0xfcb6('0x4b')]['id']}})[_0xfcb6('0x26')](handleEntityNotFound(_0x17192f,null))['then'](saveUpdates(_0x5d455a[_0xfcb6('0x49')],null))['then'](respondWithResult(_0x17192f,null))[_0xfcb6('0x41')](handleError(_0x17192f,null));};exports[_0xfcb6('0x27')]=function(_0x165d30,_0x3beb32){return db['VoiceTransferReport'][_0xfcb6('0x47')]({'where':{'id':_0x165d30[_0xfcb6('0x4b')]['id']}})[_0xfcb6('0x26')](handleEntityNotFound(_0x3beb32,null))['then'](removeEntity(_0x3beb32,null))[_0xfcb6('0x41')](handleError(_0x3beb32,null));};exports['describe']=function(_0x1aea3a,_0x1cea11){return db[_0xfcb6('0x2a')][_0xfcb6('0x4c')]()[_0xfcb6('0x26')](respondWithResult(_0x1cea11,null))['catch'](handleError(_0x1cea11,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index fe3e76d..bae238d 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 _0xc166=['./voiceTransferReport.attributes','exports','VoiceTransferReport','report_call_transfer','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xc166,0x79));var _0x6c16=function(_0x178b0c,_0x41198b){_0x178b0c=_0x178b0c-0x0;var _0x4da8be=_0xc166[_0x178b0c];return _0x4da8be;};'use strict';var _=require(_0x6c16('0x0'));var util=require('util');var logger=require(_0x6c16('0x1'))(_0x6c16('0x2'));var moment=require(_0x6c16('0x3'));var BPromise=require(_0x6c16('0x4'));var rp=require(_0x6c16('0x5'));var fs=require('fs');var path=require(_0x6c16('0x6'));var rimraf=require(_0x6c16('0x7'));var config=require(_0x6c16('0x8'));var attributes=require(_0x6c16('0x9'));module[_0x6c16('0xa')]=function(_0x59441c,_0x50258a){return _0x59441c['define'](_0x6c16('0xb'),attributes,{'tableName':_0x6c16('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc7fb=['define','VoiceTransferReport','report_call_transfer','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceTransferReport.attributes'];(function(_0x31d786,_0x18f4ef){var _0x5a60ac=function(_0x31d9b9){while(--_0x31d9b9){_0x31d786['push'](_0x31d786['shift']());}};_0x5a60ac(++_0x18f4ef);}(_0xc7fb,0x1b3));var _0xbc7f=function(_0xc206b6,_0x485493){_0xc206b6=_0xc206b6-0x0;var _0x133c76=_0xc7fb[_0xc206b6];return _0x133c76;};'use strict';var _=require(_0xbc7f('0x0'));var util=require(_0xbc7f('0x1'));var logger=require('../../config/logger')(_0xbc7f('0x2'));var moment=require(_0xbc7f('0x3'));var BPromise=require(_0xbc7f('0x4'));var rp=require(_0xbc7f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbc7f('0x6'));var config=require(_0xbc7f('0x7'));var attributes=require(_0xbc7f('0x8'));module['exports']=function(_0x12abf8,_0xf10ad1){return _0x12abf8[_0xbc7f('0x9')](_0xbc7f('0xa'),attributes,{'tableName':_0xbc7f('0xb'),'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 533105b..26c36af 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 _0x8fca=['CreateVoiceTransferReport','VoiceTransferReport','create','body','options','info','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','result','catch'];(function(_0x21a6a5,_0x50a8bf){var _0x184c01=function(_0x874098){while(--_0x874098){_0x21a6a5['push'](_0x21a6a5['shift']());}};_0x184c01(++_0x50a8bf);}(_0x8fca,0x180));var _0xa8fc=function(_0x58716a,_0x2ed9b2){_0x58716a=_0x58716a-0x0;var _0x57ae5d=_0x8fca[_0x58716a];return _0x57ae5d;};'use strict';var _=require('lodash');var util=require(_0xa8fc('0x0'));var moment=require(_0xa8fc('0x1'));var BPromise=require('bluebird');var rs=require(_0xa8fc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa8fc('0x3'))['db'];var utils=require(_0xa8fc('0x4'));var logger=require(_0xa8fc('0x5'))(_0xa8fc('0x6'));var config=require(_0xa8fc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa8fc('0x8')][_0xa8fc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x167764,_0x2ebbb9,_0x273c7e){return new BPromise(function(_0x1e9817,_0x5723dc){return client[_0xa8fc('0xa')](_0x167764,_0x273c7e)[_0xa8fc('0xb')](function(_0x4bac11){logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x2ebbb9,_0xa8fc('0xc'));logger[_0xa8fc('0xd')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x2ebbb9,_0xa8fc('0xc'),JSON[_0xa8fc('0xe')](_0x4bac11));if(_0x4bac11['error']){if(_0x4bac11[_0xa8fc('0xf')][_0xa8fc('0x10')]===0x1f4){logger[_0xa8fc('0xf')](_0xa8fc('0x11'),_0x2ebbb9,_0x4bac11['error'][_0xa8fc('0x12')]);return _0x5723dc(_0x4bac11[_0xa8fc('0xf')]['message']);}logger[_0xa8fc('0xf')](_0xa8fc('0x11'),_0x2ebbb9,_0x4bac11[_0xa8fc('0xf')][_0xa8fc('0x12')]);return _0x1e9817(_0x4bac11[_0xa8fc('0xf')][_0xa8fc('0x12')]);}else{logger['info'](_0xa8fc('0x11'),_0x2ebbb9,'request\x20sent');_0x1e9817(_0x4bac11[_0xa8fc('0x13')][_0xa8fc('0x12')]);}})[_0xa8fc('0x14')](function(_0x564a7b){logger[_0xa8fc('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x2ebbb9,_0x564a7b);_0x5723dc(_0x564a7b);});});}exports[_0xa8fc('0x15')]=function(_0x5300ba){var _0x11795e=this;return new Promise(function(_0xba5fb1,_0x2615a1){return db[_0xa8fc('0x16')][_0xa8fc('0x17')](_0x5300ba[_0xa8fc('0x18')],{'raw':_0x5300ba[_0xa8fc('0x19')]?_0x5300ba[_0xa8fc('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xa8fc('0xb')](function(_0x54baf6){logger[_0xa8fc('0x1a')](_0xa8fc('0x15'),_0x5300ba);logger['debug'](_0xa8fc('0x15'),_0x5300ba,JSON[_0xa8fc('0xe')](_0x54baf6));_0xba5fb1(_0x54baf6);})[_0xa8fc('0x14')](function(_0x2a6c49){logger[_0xa8fc('0xf')](_0xa8fc('0x15'),_0x2a6c49['message'],_0x5300ba);_0x2615a1(_0x11795e[_0xa8fc('0xf')](0x1f4,_0x2a6c49[_0xa8fc('0x12')]));});});}; \ No newline at end of file +var _0xaf47=['info','result','catch','create','body','options','raw','CreateVoiceTransferReport','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3618b5,_0x3ee41b){var _0x141a4d=function(_0x1edac4){while(--_0x1edac4){_0x3618b5['push'](_0x3618b5['shift']());}};_0x141a4d(++_0x3ee41b);}(_0xaf47,0xcc));var _0x7af4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaf47[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7af4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7af4('0x1'));var rs=require(_0x7af4('0x2'));var fs=require('fs');var Redis=require(_0x7af4('0x3'));var db=require(_0x7af4('0x4'))['db'];var utils=require(_0x7af4('0x5'));var logger=require(_0x7af4('0x6'))(_0x7af4('0x7'));var config=require(_0x7af4('0x8'));var jayson=require(_0x7af4('0x9'));var client=jayson[_0x7af4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38a10d,_0x440bfa,_0x30e7e7){return new BPromise(function(_0x2fb3c1,_0x363174){return client['request'](_0x38a10d,_0x30e7e7)[_0x7af4('0xb')](function(_0x335a60){logger['info'](_0x7af4('0xc'),_0x440bfa,_0x7af4('0xd'));logger[_0x7af4('0xe')](_0x7af4('0xf'),_0x440bfa,'request\x20sent',JSON[_0x7af4('0x10')](_0x335a60));if(_0x335a60[_0x7af4('0x11')]){if(_0x335a60[_0x7af4('0x11')][_0x7af4('0x12')]===0x1f4){logger[_0x7af4('0x11')](_0x7af4('0xc'),_0x440bfa,_0x335a60[_0x7af4('0x11')][_0x7af4('0x13')]);return _0x363174(_0x335a60[_0x7af4('0x11')][_0x7af4('0x13')]);}logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x440bfa,_0x335a60[_0x7af4('0x11')][_0x7af4('0x13')]);return _0x2fb3c1(_0x335a60['error']['message']);}else{logger[_0x7af4('0x14')](_0x7af4('0xc'),_0x440bfa,_0x7af4('0xd'));_0x2fb3c1(_0x335a60[_0x7af4('0x15')][_0x7af4('0x13')]);}})[_0x7af4('0x16')](function(_0x3c335c){logger[_0x7af4('0x11')](_0x7af4('0xc'),_0x440bfa,_0x3c335c);_0x363174(_0x3c335c);});});}exports['CreateVoiceTransferReport']=function(_0x34cf85){var _0x425643=this;return new Promise(function(_0x4c5287,_0x19ca37){return db['VoiceTransferReport'][_0x7af4('0x17')](_0x34cf85[_0x7af4('0x18')],{'raw':_0x34cf85[_0x7af4('0x19')]?_0x34cf85[_0x7af4('0x19')][_0x7af4('0x1a')]===undefined?!![]:![]:!![]})[_0x7af4('0xb')](function(_0x255b64){logger['info'](_0x7af4('0x1b'),_0x34cf85);logger[_0x7af4('0xe')](_0x7af4('0x1b'),_0x34cf85,JSON[_0x7af4('0x10')](_0x255b64));_0x4c5287(_0x255b64);})[_0x7af4('0x16')](function(_0x57f1d0){logger[_0x7af4('0x11')](_0x7af4('0x1b'),_0x57f1d0[_0x7af4('0x13')],_0x34cf85);_0x19ca37(_0x425643[_0x7af4('0x11')](0x1f4,_0x57f1d0['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 88bf575..6bb9655 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 _0x6f0d=['isAuthenticated','isWebrtcLicence','originate','/hangup','/answer','/hold','hold','unhold','calls','/transfer','transfer','exports','Router','../../components/auth/service','./webbar.controller','post'];(function(_0x275699,_0x3531e7){var _0x55708f=function(_0x170fb4){while(--_0x170fb4){_0x275699['push'](_0x275699['shift']());}};_0x55708f(++_0x3531e7);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x20b8d,_0x471e78){_0x20b8d=_0x20b8d-0x0;var _0x44b833=_0x6f0d[_0x20b8d];return _0x44b833;};'use strict';var express=require('express');var router=express[_0xd6f0('0x0')]();var auth=require(_0xd6f0('0x1'));var controller=require(_0xd6f0('0x2'));router[_0xd6f0('0x3')]('/originate',auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller[_0xd6f0('0x6')]);router[_0xd6f0('0x3')](_0xd6f0('0x7'),auth['isAuthenticated'](),auth[_0xd6f0('0x5')](),controller['hangup']);router[_0xd6f0('0x3')](_0xd6f0('0x8'),auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller['answer']);router['post'](_0xd6f0('0x9'),auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller[_0xd6f0('0xa')]);router[_0xd6f0('0x3')]('/unhold',auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller[_0xd6f0('0xb')]);router[_0xd6f0('0x3')]('/calls',auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller[_0xd6f0('0xc')]);router[_0xd6f0('0x3')](_0xd6f0('0xd'),auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller[_0xd6f0('0xe')]);module[_0xd6f0('0xf')]=router; \ No newline at end of file +var _0xe14d=['hangup','answer','/hold','hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','originate','post','/hangup','isWebrtcLicence'];(function(_0x2a0738,_0x3c0bc5){var _0x159679=function(_0x9c9ec7){while(--_0x9c9ec7){_0x2a0738['push'](_0x2a0738['shift']());}};_0x159679(++_0x3c0bc5);}(_0xe14d,0x1ee));var _0xde14=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xe14d[_0x4fc9e6];return _0x551d28;};'use strict';var express=require(_0xde14('0x0'));var router=express[_0xde14('0x1')]();var auth=require(_0xde14('0x2'));var controller=require(_0xde14('0x3'));router['post'](_0xde14('0x4'),auth[_0xde14('0x5')](),auth['isWebrtcLicence'](),controller[_0xde14('0x6')]);router[_0xde14('0x7')](_0xde14('0x8'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xa')]);router['post']('/answer',auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xb')]);router[_0xde14('0x7')](_0xde14('0xc'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xd')]);router['post'](_0xde14('0xe'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xf')]);router[_0xde14('0x7')](_0xde14('0x10'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0x11')]);router[_0xde14('0x7')](_0xde14('0x12'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0x13')]);module[_0xde14('0x14')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 3b43834..017c2bc 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 _0x593e=['number','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','handleError:','error','name','status','send','NotFound','request','code','message','catch','findOne','agent','then','all','filter','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','body','json','userId','callerId','callbackUrl','entityFound:','format','user:%s','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','webbar:hold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','rows','conference\x20fired:','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required'];(function(_0x169dcc,_0x45c7f0){var _0x12b22c=function(_0x1fdb13){while(--_0x1fdb13){_0x169dcc['push'](_0x169dcc['shift']());}};_0x12b22c(++_0x45c7f0);}(_0x593e,0xcb));var _0xe593=function(_0x154d24,_0x30ee21){_0x154d24=_0x154d24-0x0;var _0x128164=_0x593e[_0x154d24];return _0x128164;};'use strict';var path=require(_0xe593('0x0'));var fs=require('fs');var _=require(_0xe593('0x1'));var db=require(_0xe593('0x2'))['db'];var config=require(_0xe593('0x3'));var util=require(_0xe593('0x4'));var BPromise=require(_0xe593('0x5'));var jayson=require(_0xe593('0x6'));var amiClient=jayson[_0xe593('0x7')]['http']({'port':0x232a});var logger=require(_0xe593('0x8'))(_0xe593('0x9'));var Redis=require(_0xe593('0xa'));config[_0xe593('0xb')]=_[_0xe593('0xc')](config[_0xe593('0xb')],{'host':_0xe593('0xd'),'port':0x18eb});var io=require(_0xe593('0xe'))(new Redis(config[_0xe593('0xb')]));var Schema=require(_0xe593('0xf'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0xe593('0x10')]},'callNumber':{'type':_0xe593('0x11'),'required':[!![],_0xe593('0x12')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xe593('0x13'),'required':[!![],_0xe593('0x10')]},'sessionId':{'type':_0xe593('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0xe593('0x10')]},'sessionId':{'type':_0xe593('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xe593('0x13'),'required':[!![],_0xe593('0x10')]},'sessionId':{'type':_0xe593('0x11'),'required':[!![],_0xe593('0x14')]},'transferNumber':{'type':_0xe593('0x11'),'required':[!![],_0xe593('0x15')]}});var holdValidation=new Schema({'userId':{'type':_0xe593('0x13'),'required':[!![],_0xe593('0x10')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xe593('0x13'),'required':[!![],_0xe593('0x10')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xe593('0x13'),'required':[!![],_0xe593('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xe593('0x10')]}});function emit(_0x40416c,_0x1c6de3,_0x2d525c){logger[_0xe593('0x16')](_0x40416c,_0x1c6de3,JSON[_0xe593('0x17')](_0x2d525c));io['to'](_0x40416c)['emit'](_0x1c6de3,_0x2d525c);}function handleError(_0xfbc79f){return function(_0x470d07){console['log'](_0xe593('0x18'),_0x470d07,_0x470d07 instanceof RangeError);logger[_0xe593('0x19')](_0x470d07['stack']);if(_0x470d07 instanceof RangeError){if(_0x470d07[_0xe593('0x1a')]){delete _0x470d07[_0xe593('0x1a')];}_0xfbc79f[_0xe593('0x1b')](0x194)[_0xe593('0x1c')](_0x470d07);}else{if(_0x470d07[_0xe593('0x1a')]){delete _0x470d07[_0xe593('0x1a')];}_0xfbc79f[_0xe593('0x1b')](0x1f4)['send'](_0x470d07);}};}function checkError(){return function(_0x4af4c8){if(!_0x4af4c8){throw new RangeError(_0xe593('0x1d'));}return _0x4af4c8;};}function respondWithRpcPromise(_0x5d4895,_0x56c23f){return new BPromise(function(_0x1bb8e8,_0x3c65b5){var _0x57379d=amiClient;return _0x57379d[_0xe593('0x1e')](_0x5d4895,_0x56c23f)['then'](function(_0x1672bf){if(_0x1672bf[_0xe593('0x19')]){if(_0x1672bf[_0xe593('0x19')][_0xe593('0x1f')]===0x1f4){return _0x3c65b5(_0x1672bf[_0xe593('0x19')][_0xe593('0x20')]);}return _0x1bb8e8(_0x1672bf[_0xe593('0x19')][_0xe593('0x20')]);}else{_0x1bb8e8(_0x1672bf['result']);}})[_0xe593('0x21')](function(_0x347d7d){_0x3c65b5(_0x347d7d);});});}function getAgent(_0x480218){return db['User'][_0xe593('0x22')]({'where':{'id':_0x480218,'role':_0xe593('0x23')}})[_0xe593('0x24')](checkError());}function getAgentCheckSession(_0x43699d,_0x3b66bc){return new BPromise(function(_0x27a3d2,_0x5918cd){var _0x350e2b=respondWithRpcPromise('VoiceChannels');var _0x1dacf6=getAgent(_0x43699d);Promise[_0xe593('0x25')]([_0x350e2b,_0x1dacf6])['then'](function(_0x337ee0){var _0x561a01=_0x337ee0[0x0];var _0x44a68c=_0x337ee0[0x1];var _0x1c147b=_[_0xe593('0x26')](_0x561a01['rows'],function(_0x1ae8d9){return _0x1ae8d9[_0xe593('0x27')]==_0x44a68c['id']&&_0x1ae8d9[_0xe593('0x28')]==_0x3b66bc;});if(_0x1c147b[_0xe593('0x29')]==0x1){_0x27a3d2(_0x44a68c);}else{_0x5918cd(new RangeError(_0xe593('0x2a')+_0x3b66bc+_0xe593('0x2b')));}});});}exports[_0xe593('0x2c')]=function(_0x4efc93,_0x4098a9){logger[_0xe593('0x16')]('originate\x20fired:',_0x4efc93[_0xe593('0x2d')]);var _0x571995=originateValidation[_0xe593('0xf')](_0x4efc93[_0xe593('0x2d')]);if(_0x571995[_0xe593('0x29')]>0x0){return _0x4098a9[_0xe593('0x1b')](0x190)[_0xe593('0x2e')](_0x571995);}var _0x24a560=_0x4efc93[_0xe593('0x2d')][_0xe593('0x2f')];var _0x11f287=_0x4efc93[_0xe593('0x2d')]['callNumber'];var _0x27a563=_0x4efc93[_0xe593('0x2d')][_0xe593('0x30')];var _0x5a55c0=_0x4efc93['body'][_0xe593('0x31')];return getAgent(_0x24a560)['then'](function(_0x232bf1){logger[_0xe593('0x16')](_0xe593('0x32'),_0x232bf1[_0xe593('0x1a')]);emit(util[_0xe593('0x33')](_0xe593('0x34'),_0x232bf1[_0xe593('0x1a')]),'webbar:originate',{'callNumber':_0x11f287,'callerId':_0x27a563,'callbackUrl':_0x5a55c0});return _0x4098a9['status'](0xc8)[_0xe593('0x2e')]({'error':![],'message':'originate\x20executed!'});})[_0xe593('0x21')](handleError(_0x4098a9));};exports['hangup']=function(_0x206775,_0x5b9589){logger['info'](_0xe593('0x35'),_0x206775[_0xe593('0x2d')]);var _0x2aa9d8=hangupValidation['validate'](_0x206775['body']);if(_0x2aa9d8['length']>0x0){return _0x5b9589[_0xe593('0x1b')](0x190)['json'](_0x2aa9d8);}var _0x37ba0e=_0x206775[_0xe593('0x2d')][_0xe593('0x2f')];var _0x475207=_0x206775['body'][_0xe593('0x28')];return getAgent(_0x37ba0e)['then'](function(_0x36c08e){logger['info']('entityFound:',_0x36c08e['name']);emit(util[_0xe593('0x33')]('user:%s',_0x36c08e[_0xe593('0x1a')]),_0xe593('0x36'),{'sessionId':_0x475207});return _0x5b9589[_0xe593('0x1b')](0xc8)['json']({'error':![],'message':_0xe593('0x37')});})[_0xe593('0x21')](handleError(_0x5b9589));};exports[_0xe593('0x38')]=function(_0x4655dd,_0x26ff41){logger[_0xe593('0x16')](_0xe593('0x39'),_0x4655dd[_0xe593('0x2d')]);var _0x4b36e1=answerValidation[_0xe593('0xf')](_0x4655dd[_0xe593('0x2d')]);if(_0x4b36e1[_0xe593('0x29')]>0x0){return _0x26ff41[_0xe593('0x1b')](0x190)[_0xe593('0x2e')](_0x4b36e1);}var _0x4d3018=_0x4655dd['body'][_0xe593('0x2f')];var _0x380429=_0x4655dd[_0xe593('0x2d')]['sessionId'];return getAgent(_0x4d3018)[_0xe593('0x24')](function(_0x8a4c26){logger['info']('entityFound:',_0x8a4c26[_0xe593('0x1a')]);emit(util[_0xe593('0x33')](_0xe593('0x34'),_0x8a4c26['name']),_0xe593('0x3a'),{'sessionId':_0x380429});return _0x26ff41[_0xe593('0x1b')](0xc8)[_0xe593('0x2e')]({'error':![],'message':_0xe593('0x3b')});})['catch'](handleError(_0x26ff41));};exports['hold']=function(_0x4a7434,_0x4c8d14){logger[_0xe593('0x16')]('hold\x20fired:',_0x4a7434[_0xe593('0x2d')]);var _0xd016b3=holdValidation[_0xe593('0xf')](_0x4a7434[_0xe593('0x2d')]);if(_0xd016b3[_0xe593('0x29')]>0x0){return _0x4c8d14[_0xe593('0x1b')](0x190)[_0xe593('0x2e')](_0xd016b3);}var _0x297c3e=_0x4a7434['body'][_0xe593('0x2f')];var _0x1a5e0f=_0x4a7434[_0xe593('0x2d')]['sessionId'];return getAgent(_0x297c3e)[_0xe593('0x24')](function(_0x5dfdb1){logger[_0xe593('0x16')](_0xe593('0x32'),_0x5dfdb1[_0xe593('0x1a')]);emit(util['format']('user:%s',_0x5dfdb1[_0xe593('0x1a')]),_0xe593('0x3c'),{'sessionId':_0x1a5e0f});return _0x4c8d14['status'](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0x4c8d14));};exports['unhold']=function(_0x383645,_0x1e48d8){logger[_0xe593('0x16')](_0xe593('0x3d'),_0x383645[_0xe593('0x2d')]);var _0x44201e=unholdValidation[_0xe593('0xf')](_0x383645[_0xe593('0x2d')]);if(_0x44201e[_0xe593('0x29')]>0x0){return _0x1e48d8[_0xe593('0x1b')](0x190)[_0xe593('0x2e')](_0x44201e);}var _0x1ea4ef=_0x383645[_0xe593('0x2d')][_0xe593('0x2f')];var _0xa25aa8=_0x383645[_0xe593('0x2d')]['sessionId'];return getAgent(_0x1ea4ef)[_0xe593('0x24')](function(_0x12e2ac){logger[_0xe593('0x16')](_0xe593('0x32'),_0x12e2ac[_0xe593('0x1a')]);emit(util[_0xe593('0x33')](_0xe593('0x34'),_0x12e2ac[_0xe593('0x1a')]),_0xe593('0x3e'),{'sessionId':_0xa25aa8});return _0x1e48d8[_0xe593('0x1b')](0xc8)[_0xe593('0x2e')]({'error':![],'message':_0xe593('0x3f')});})[_0xe593('0x21')](handleError(_0x1e48d8));};exports[_0xe593('0x40')]=function(_0x93ca5e,_0x5e8f9c){logger[_0xe593('0x16')](_0xe593('0x41'),_0x5e8f9c[_0xe593('0x2d')]);var _0x24d061=callsValidation[_0xe593('0xf')](_0x93ca5e['body']);if(_0x24d061['length']>0x0){return _0x5e8f9c[_0xe593('0x1b')](0x190)[_0xe593('0x2e')](_0x24d061);}var _0x318dd2=_0x93ca5e[_0xe593('0x2d')][_0xe593('0x2f')];var _0x1e49ed=respondWithRpcPromise(_0xe593('0x42'));var _0x518b6f=getAgent(_0x318dd2);return Promise['all']([_0x1e49ed,_0x518b6f])[_0xe593('0x24')](function(_0x23ee3b){var _0x4ff51d=_0x23ee3b[0x0];var _0x103403=_0x23ee3b[0x1];var _0xf8ed1d=_[_0xe593('0x26')](_0x4ff51d[_0xe593('0x43')],function(_0x3a3d7b){return _0x3a3d7b[_0xe593('0x27')]==_0x103403['id'];});return _0x5e8f9c[_0xe593('0x1b')](0xc8)[_0xe593('0x2e')]({'count':_0xf8ed1d[_0xe593('0x29')],'rows':_0xf8ed1d});})[_0xe593('0x21')](handleError(_0x5e8f9c));};exports['conference']=function(_0x36f38e,_0x13e368){logger[_0xe593('0x16')](_0xe593('0x44'),_0x36f38e[_0xe593('0x2d')]);var _0x202b18=conferenceValidation[_0xe593('0xf')](_0x36f38e['body']);if(_0x202b18[_0xe593('0x29')]>0x0){return _0x13e368[_0xe593('0x1b')](0x190)[_0xe593('0x2e')](_0x202b18);}var _0x14f8e1=_0x36f38e['body'][_0xe593('0x2f')];return getAgent(_0x14f8e1)[_0xe593('0x24')](function(_0x207c3d){logger[_0xe593('0x16')](_0xe593('0x32'),_0x207c3d['name']);emit(util[_0xe593('0x33')](_0xe593('0x34'),_0x207c3d[_0xe593('0x1a')]),_0xe593('0x45'));return _0x13e368[_0xe593('0x1b')](0xc8)[_0xe593('0x2e')]({'error':![],'message':_0xe593('0x46')});})[_0xe593('0x21')](handleError(_0x13e368));};exports['transfer']=function(_0x2145c0,_0x16f9fc){logger[_0xe593('0x16')](_0xe593('0x47'),_0x2145c0[_0xe593('0x2d')]);var _0x9f1813=transferValidation[_0xe593('0xf')](_0x2145c0[_0xe593('0x2d')]);if(_0x9f1813[_0xe593('0x29')]>0x0){return _0x16f9fc[_0xe593('0x1b')](0x190)['json'](_0x9f1813);}var _0x190e90=_0x2145c0[_0xe593('0x2d')][_0xe593('0x2f')];var _0x492a9e=_0x2145c0[_0xe593('0x2d')][_0xe593('0x28')];var _0x4001b7=_0x2145c0[_0xe593('0x2d')][_0xe593('0x48')];return getAgent(_0x190e90)['then'](function(_0x17a1bc){logger[_0xe593('0x16')]('entityFound:',_0x17a1bc[_0xe593('0x1a')]);emit(util[_0xe593('0x33')](_0xe593('0x34'),_0x17a1bc[_0xe593('0x1a')]),'webbar:transfer',{'sessionId':_0x492a9e,'transferNumber':_0x4001b7});return _0x16f9fc[_0xe593('0x1b')](0xc8)[_0xe593('0x2e')]({'error':![],'message':_0xe593('0x49')});})['catch'](handleError(_0x16f9fc));}; \ No newline at end of file +var _0x6a24=['NotFound','request','then','error','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','validate','body','userId','callNumber','callbackUrl','format','user:%s','json','originate\x20executed!','entityFound:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','calls','UserId','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','../../config/environment','util','bluebird','jayson/promise','client','../../config/logger','webbarapi','redis','defaults','socket.io-emitter','number','string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','emit','log','handleError:','stack','name','status','send'];(function(_0x2e0cbb,_0x4c1214){var _0x657a49=function(_0x443398){while(--_0x443398){_0x2e0cbb['push'](_0x2e0cbb['shift']());}};_0x657a49(++_0x4c1214);}(_0x6a24,0xd1));var _0x46a2=function(_0x27038c,_0x5a68b5){_0x27038c=_0x27038c-0x0;var _0x5733b6=_0x6a24[_0x27038c];return _0x5733b6;};'use strict';var path=require(_0x46a2('0x0'));var fs=require('fs');var _=require(_0x46a2('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x46a2('0x2'));var util=require(_0x46a2('0x3'));var BPromise=require(_0x46a2('0x4'));var jayson=require(_0x46a2('0x5'));var amiClient=jayson[_0x46a2('0x6')]['http']({'port':0x232a});var logger=require(_0x46a2('0x7'))(_0x46a2('0x8'));var Redis=require('ioredis');config[_0x46a2('0x9')]=_[_0x46a2('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x46a2('0xb'))(new Redis(config[_0x46a2('0x9')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x46a2('0xc'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x46a2('0xd'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x46a2('0xd')},'callbackUrl':{'type':_0x46a2('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x46a2('0xc'),'required':[!![],_0x46a2('0xe')]},'sessionId':{'type':_0x46a2('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x46a2('0xc'),'required':[!![],_0x46a2('0xe')]},'sessionId':{'type':_0x46a2('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x46a2('0xd'),'required':[!![],_0x46a2('0xf')]},'transferNumber':{'type':'string','required':[!![],_0x46a2('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0x46a2('0xc'),'required':[!![],_0x46a2('0xe')]},'sessionId':{'type':_0x46a2('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x46a2('0xc'),'required':[!![],_0x46a2('0xe')]},'sessionId':{'type':_0x46a2('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x46a2('0xc'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x46a2('0xe')]}});function emit(_0x2deb20,_0x5eeaba,_0xead4f8){logger[_0x46a2('0x11')](_0x2deb20,_0x5eeaba,JSON['stringify'](_0xead4f8));io['to'](_0x2deb20)[_0x46a2('0x12')](_0x5eeaba,_0xead4f8);}function handleError(_0xc00b4d){return function(_0x577f18){console[_0x46a2('0x13')](_0x46a2('0x14'),_0x577f18,_0x577f18 instanceof RangeError);logger['error'](_0x577f18[_0x46a2('0x15')]);if(_0x577f18 instanceof RangeError){if(_0x577f18[_0x46a2('0x16')]){delete _0x577f18[_0x46a2('0x16')];}_0xc00b4d[_0x46a2('0x17')](0x194)[_0x46a2('0x18')](_0x577f18);}else{if(_0x577f18[_0x46a2('0x16')]){delete _0x577f18[_0x46a2('0x16')];}_0xc00b4d[_0x46a2('0x17')](0x1f4)[_0x46a2('0x18')](_0x577f18);}};}function checkError(){return function(_0x764467){if(!_0x764467){throw new RangeError(_0x46a2('0x19'));}return _0x764467;};}function respondWithRpcPromise(_0x2f5525,_0x105509){return new BPromise(function(_0x5c7586,_0xa37d90){var _0x504b9e=amiClient;return _0x504b9e[_0x46a2('0x1a')](_0x2f5525,_0x105509)[_0x46a2('0x1b')](function(_0x511ff6){if(_0x511ff6[_0x46a2('0x1c')]){if(_0x511ff6[_0x46a2('0x1c')][_0x46a2('0x1d')]===0x1f4){return _0xa37d90(_0x511ff6[_0x46a2('0x1c')]['message']);}return _0x5c7586(_0x511ff6[_0x46a2('0x1c')][_0x46a2('0x1e')]);}else{_0x5c7586(_0x511ff6[_0x46a2('0x1f')]);}})[_0x46a2('0x20')](function(_0x74bb6a){_0xa37d90(_0x74bb6a);});});}function getAgent(_0x295f15){return db[_0x46a2('0x21')][_0x46a2('0x22')]({'where':{'id':_0x295f15,'role':_0x46a2('0x23')}})[_0x46a2('0x1b')](checkError());}function getAgentCheckSession(_0x44ffb4,_0x582ada){return new BPromise(function(_0x2b4d9f,_0x704a19){var _0x1c059b=respondWithRpcPromise(_0x46a2('0x24'));var _0x435155=getAgent(_0x44ffb4);Promise[_0x46a2('0x25')]([_0x1c059b,_0x435155])['then'](function(_0x185647){var _0x26856f=_0x185647[0x0];var _0x2166eb=_0x185647[0x1];var _0x6e8b2e=_[_0x46a2('0x26')](_0x26856f[_0x46a2('0x27')],function(_0x4024be){return _0x4024be['UserId']==_0x2166eb['id']&&_0x4024be[_0x46a2('0x28')]==_0x582ada;});if(_0x6e8b2e[_0x46a2('0x29')]==0x1){_0x2b4d9f(_0x2166eb);}else{_0x704a19(new RangeError(_0x46a2('0x2a')+_0x582ada+_0x46a2('0x2b')));}});});}exports[_0x46a2('0x2c')]=function(_0x1910c9,_0x4c294a){logger[_0x46a2('0x11')](_0x46a2('0x2d'),_0x1910c9['body']);var _0x3ad9a7=originateValidation[_0x46a2('0x2e')](_0x1910c9[_0x46a2('0x2f')]);if(_0x3ad9a7[_0x46a2('0x29')]>0x0){return _0x4c294a[_0x46a2('0x17')](0x190)['json'](_0x3ad9a7);}var _0x54e08c=_0x1910c9[_0x46a2('0x2f')][_0x46a2('0x30')];var _0xeace18=_0x1910c9[_0x46a2('0x2f')][_0x46a2('0x31')];var _0x43845d=_0x1910c9['body']['callerId'];var _0x26d699=_0x1910c9['body'][_0x46a2('0x32')];return getAgent(_0x54e08c)[_0x46a2('0x1b')](function(_0x45b470){logger[_0x46a2('0x11')]('entityFound:',_0x45b470[_0x46a2('0x16')]);emit(util[_0x46a2('0x33')](_0x46a2('0x34'),_0x45b470[_0x46a2('0x16')]),'webbar:originate',{'callNumber':_0xeace18,'callerId':_0x43845d,'callbackUrl':_0x26d699});return _0x4c294a[_0x46a2('0x17')](0xc8)[_0x46a2('0x35')]({'error':![],'message':_0x46a2('0x36')});})[_0x46a2('0x20')](handleError(_0x4c294a));};exports['hangup']=function(_0x356c98,_0x5bddad){logger[_0x46a2('0x11')]('hangup\x20fired:',_0x356c98[_0x46a2('0x2f')]);var _0x32be94=hangupValidation['validate'](_0x356c98[_0x46a2('0x2f')]);if(_0x32be94['length']>0x0){return _0x5bddad['status'](0x190)[_0x46a2('0x35')](_0x32be94);}var _0x39e15f=_0x356c98[_0x46a2('0x2f')][_0x46a2('0x30')];var _0x118f23=_0x356c98[_0x46a2('0x2f')]['sessionId'];return getAgent(_0x39e15f)[_0x46a2('0x1b')](function(_0x49ace7){logger[_0x46a2('0x11')](_0x46a2('0x37'),_0x49ace7[_0x46a2('0x16')]);emit(util[_0x46a2('0x33')](_0x46a2('0x34'),_0x49ace7[_0x46a2('0x16')]),_0x46a2('0x38'),{'sessionId':_0x118f23});return _0x5bddad[_0x46a2('0x17')](0xc8)['json']({'error':![],'message':_0x46a2('0x39')});})[_0x46a2('0x20')](handleError(_0x5bddad));};exports[_0x46a2('0x3a')]=function(_0x37977c,_0x56a8b2){logger[_0x46a2('0x11')](_0x46a2('0x3b'),_0x37977c[_0x46a2('0x2f')]);var _0x3869d4=answerValidation[_0x46a2('0x2e')](_0x37977c['body']);if(_0x3869d4[_0x46a2('0x29')]>0x0){return _0x56a8b2['status'](0x190)[_0x46a2('0x35')](_0x3869d4);}var _0x20968b=_0x37977c['body'][_0x46a2('0x30')];var _0x1a7e45=_0x37977c[_0x46a2('0x2f')][_0x46a2('0x28')];return getAgent(_0x20968b)[_0x46a2('0x1b')](function(_0x440ecb){logger[_0x46a2('0x11')](_0x46a2('0x37'),_0x440ecb[_0x46a2('0x16')]);emit(util[_0x46a2('0x33')]('user:%s',_0x440ecb[_0x46a2('0x16')]),_0x46a2('0x3c'),{'sessionId':_0x1a7e45});return _0x56a8b2[_0x46a2('0x17')](0xc8)[_0x46a2('0x35')]({'error':![],'message':_0x46a2('0x3d')});})['catch'](handleError(_0x56a8b2));};exports[_0x46a2('0x3e')]=function(_0x3f0595,_0x13479b){logger[_0x46a2('0x11')](_0x46a2('0x3f'),_0x3f0595['body']);var _0x35a93f=holdValidation['validate'](_0x3f0595[_0x46a2('0x2f')]);if(_0x35a93f[_0x46a2('0x29')]>0x0){return _0x13479b['status'](0x190)[_0x46a2('0x35')](_0x35a93f);}var _0x3f8673=_0x3f0595[_0x46a2('0x2f')][_0x46a2('0x30')];var _0xa32428=_0x3f0595[_0x46a2('0x2f')][_0x46a2('0x28')];return getAgent(_0x3f8673)['then'](function(_0x369015){logger[_0x46a2('0x11')](_0x46a2('0x37'),_0x369015[_0x46a2('0x16')]);emit(util['format'](_0x46a2('0x34'),_0x369015['name']),_0x46a2('0x40'),{'sessionId':_0xa32428});return _0x13479b[_0x46a2('0x17')](0xc8)['json']({'error':![],'message':_0x46a2('0x41')});})['catch'](handleError(_0x13479b));};exports[_0x46a2('0x42')]=function(_0x76ccd3,_0x3be2a7){logger[_0x46a2('0x11')](_0x46a2('0x43'),_0x76ccd3[_0x46a2('0x2f')]);var _0x541de9=unholdValidation['validate'](_0x76ccd3[_0x46a2('0x2f')]);if(_0x541de9[_0x46a2('0x29')]>0x0){return _0x3be2a7[_0x46a2('0x17')](0x190)[_0x46a2('0x35')](_0x541de9);}var _0x3dfe8d=_0x76ccd3[_0x46a2('0x2f')][_0x46a2('0x30')];var _0x4d33fa=_0x76ccd3[_0x46a2('0x2f')][_0x46a2('0x28')];return getAgent(_0x3dfe8d)[_0x46a2('0x1b')](function(_0x32bbdf){logger[_0x46a2('0x11')](_0x46a2('0x37'),_0x32bbdf[_0x46a2('0x16')]);emit(util['format'](_0x46a2('0x34'),_0x32bbdf[_0x46a2('0x16')]),'webbar:unhold',{'sessionId':_0x4d33fa});return _0x3be2a7[_0x46a2('0x17')](0xc8)[_0x46a2('0x35')]({'error':![],'message':'unhold\x20executed!'});})[_0x46a2('0x20')](handleError(_0x3be2a7));};exports[_0x46a2('0x44')]=function(_0x56bbc6,_0x537b0a){logger[_0x46a2('0x11')]('calls\x20fired:',_0x537b0a['body']);var _0x48f2c2=callsValidation['validate'](_0x56bbc6[_0x46a2('0x2f')]);if(_0x48f2c2['length']>0x0){return _0x537b0a['status'](0x190)[_0x46a2('0x35')](_0x48f2c2);}var _0x102775=_0x56bbc6[_0x46a2('0x2f')][_0x46a2('0x30')];var _0x17223e=respondWithRpcPromise(_0x46a2('0x24'));var _0x230d0f=getAgent(_0x102775);return Promise[_0x46a2('0x25')]([_0x17223e,_0x230d0f])[_0x46a2('0x1b')](function(_0xea8a6a){var _0x4c840d=_0xea8a6a[0x0];var _0x5070a6=_0xea8a6a[0x1];var _0x3a6dc1=_[_0x46a2('0x26')](_0x4c840d[_0x46a2('0x27')],function(_0x47a34e){return _0x47a34e[_0x46a2('0x45')]==_0x5070a6['id'];});return _0x537b0a['status'](0xc8)[_0x46a2('0x35')]({'count':_0x3a6dc1['length'],'rows':_0x3a6dc1});})['catch'](handleError(_0x537b0a));};exports[_0x46a2('0x46')]=function(_0x5ec5f3,_0x398fa6){logger['info'](_0x46a2('0x47'),_0x5ec5f3['body']);var _0x2ac617=conferenceValidation['validate'](_0x5ec5f3[_0x46a2('0x2f')]);if(_0x2ac617[_0x46a2('0x29')]>0x0){return _0x398fa6['status'](0x190)[_0x46a2('0x35')](_0x2ac617);}var _0x3827af=_0x5ec5f3[_0x46a2('0x2f')][_0x46a2('0x30')];return getAgent(_0x3827af)[_0x46a2('0x1b')](function(_0x1fe497){logger[_0x46a2('0x11')](_0x46a2('0x37'),_0x1fe497[_0x46a2('0x16')]);emit(util[_0x46a2('0x33')](_0x46a2('0x34'),_0x1fe497['name']),_0x46a2('0x48'));return _0x398fa6[_0x46a2('0x17')](0xc8)[_0x46a2('0x35')]({'error':![],'message':_0x46a2('0x49')});})[_0x46a2('0x20')](handleError(_0x398fa6));};exports[_0x46a2('0x4a')]=function(_0x1fc849,_0x369246){logger[_0x46a2('0x11')](_0x46a2('0x4b'),_0x1fc849[_0x46a2('0x2f')]);var _0x3184f6=transferValidation['validate'](_0x1fc849['body']);if(_0x3184f6['length']>0x0){return _0x369246[_0x46a2('0x17')](0x190)[_0x46a2('0x35')](_0x3184f6);}var _0xdfb3e8=_0x1fc849[_0x46a2('0x2f')][_0x46a2('0x30')];var _0x359151=_0x1fc849[_0x46a2('0x2f')]['sessionId'];var _0x254618=_0x1fc849['body']['transferNumber'];return getAgent(_0xdfb3e8)[_0x46a2('0x1b')](function(_0x44f112){logger[_0x46a2('0x11')]('entityFound:',_0x44f112[_0x46a2('0x16')]);emit(util[_0x46a2('0x33')](_0x46a2('0x34'),_0x44f112[_0x46a2('0x16')]),_0x46a2('0x4c'),{'sessionId':_0x359151,'transferNumber':_0x254618});return _0x369246[_0x46a2('0x17')](0xc8)[_0x46a2('0x35')]({'error':![],'message':_0x46a2('0x4d')});})[_0x46a2('0x20')](handleError(_0x369246));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index e9fb65c..07d0ad6 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 _0x33af=['getAnswers','/:id/users','/:id/applications','post','create','addDisposition','addAgents','addApplications','/:id/notify','/:id/send','send','put','/:id','update','delete','destroy','removeDispositions','/:id/canned_answers','removeAnswers','removeAgents','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','show','/:id/dispositions','getDispositions'];(function(_0x5861a8,_0x18a679){var _0x5b8bb7=function(_0x495256){while(--_0x495256){_0x5861a8['push'](_0x5861a8['shift']());}};_0x5b8bb7(++_0x18a679);}(_0x33af,0xec));var _0xf33a=function(_0x4aaaef,_0x4cd2d0){_0x4aaaef=_0x4aaaef-0x0;var _0xbe59a=_0x33af[_0x4aaaef];return _0xbe59a;};'use strict';var multer=require('multer');var util=require(_0xf33a('0x0'));var path=require('path');var timeout=require(_0xf33a('0x1'));var express=require(_0xf33a('0x2'));var router=express[_0xf33a('0x3')]();var fs_extra=require(_0xf33a('0x4'));var auth=require(_0xf33a('0x5'));var interaction=require(_0xf33a('0x6'));var config=require('../../config/environment');var controller=require(_0xf33a('0x7'));router[_0xf33a('0x8')]('/',auth['isAuthenticated'](),controller[_0xf33a('0x9')]);router[_0xf33a('0x8')](_0xf33a('0xa'),auth[_0xf33a('0xb')](),controller[_0xf33a('0xc')]);router[_0xf33a('0x8')]('/:id',auth[_0xf33a('0xb')](),controller[_0xf33a('0xd')]);router[_0xf33a('0x8')](_0xf33a('0xe'),auth[_0xf33a('0xb')](),controller[_0xf33a('0xf')]);router['get']('/:id/canned_answers',auth[_0xf33a('0xb')](),controller[_0xf33a('0x10')]);router[_0xf33a('0x8')](_0xf33a('0x11'),auth[_0xf33a('0xb')](),controller['getAgents']);router[_0xf33a('0x8')](_0xf33a('0x12'),auth['isAuthenticated'](),controller['getApplications']);router[_0xf33a('0x13')]('/',auth[_0xf33a('0xb')](),controller[_0xf33a('0x14')]);router[_0xf33a('0x13')](_0xf33a('0xe'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x15')]);router[_0xf33a('0x13')]('/:id/canned_answers',auth[_0xf33a('0xb')](),controller['addAnswer']);router[_0xf33a('0x13')](_0xf33a('0x11'),auth['isAuthenticated'](),controller[_0xf33a('0x16')]);router[_0xf33a('0x13')]('/:id/applications',auth[_0xf33a('0xb')](),controller[_0xf33a('0x17')]);router[_0xf33a('0x13')](_0xf33a('0x18'),controller['notify']);router[_0xf33a('0x13')](_0xf33a('0x19'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x1a')]);router[_0xf33a('0x1b')](_0xf33a('0x1c'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x1d')]);router[_0xf33a('0x1e')](_0xf33a('0x1c'),auth['isAuthenticated'](),controller[_0xf33a('0x1f')]);router[_0xf33a('0x1e')](_0xf33a('0xe'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x20')]);router['delete'](_0xf33a('0x21'),auth['isAuthenticated'](),controller[_0xf33a('0x22')]);router[_0xf33a('0x1e')](_0xf33a('0x11'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x23')]);module['exports']=router; \ No newline at end of file +var _0x2542=['describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','post','addDisposition','addAnswer','addAgents','notify','/:id/send','send','put','update','delete','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','isAuthenticated'];(function(_0x45e1bf,_0x4e37cc){var _0x11bdd5=function(_0x3ce5eb){while(--_0x3ce5eb){_0x45e1bf['push'](_0x45e1bf['shift']());}};_0x11bdd5(++_0x4e37cc);}(_0x2542,0x169));var _0x2254=function(_0x2d44a2,_0x4719de){_0x2d44a2=_0x2d44a2-0x0;var _0x1b3a9f=_0x2542[_0x2d44a2];return _0x1b3a9f;};'use strict';var multer=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var path=require(_0x2254('0x2'));var timeout=require(_0x2254('0x3'));var express=require('express');var router=express[_0x2254('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2254('0x5'));var interaction=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var controller=require(_0x2254('0x8'));router[_0x2254('0x9')]('/',auth['isAuthenticated'](),controller[_0x2254('0xa')]);router[_0x2254('0x9')](_0x2254('0xb'),auth[_0x2254('0xc')](),controller[_0x2254('0xd')]);router[_0x2254('0x9')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0xf')]);router[_0x2254('0x9')](_0x2254('0x10'),auth['isAuthenticated'](),controller[_0x2254('0x11')]);router[_0x2254('0x9')](_0x2254('0x12'),auth[_0x2254('0xc')](),controller['getAnswers']);router['get'](_0x2254('0x13'),auth[_0x2254('0xc')](),controller[_0x2254('0x14')]);router[_0x2254('0x9')](_0x2254('0x15'),auth[_0x2254('0xc')](),controller['getApplications']);router[_0x2254('0x16')]('/',auth[_0x2254('0xc')](),controller['create']);router[_0x2254('0x16')](_0x2254('0x10'),auth[_0x2254('0xc')](),controller[_0x2254('0x17')]);router[_0x2254('0x16')](_0x2254('0x12'),auth['isAuthenticated'](),controller[_0x2254('0x18')]);router['post'](_0x2254('0x13'),auth[_0x2254('0xc')](),controller[_0x2254('0x19')]);router[_0x2254('0x16')](_0x2254('0x15'),auth[_0x2254('0xc')](),controller['addApplications']);router['post']('/:id/notify',controller[_0x2254('0x1a')]);router[_0x2254('0x16')](_0x2254('0x1b'),auth[_0x2254('0xc')](),controller[_0x2254('0x1c')]);router[_0x2254('0x1d')]('/:id',auth[_0x2254('0xc')](),controller[_0x2254('0x1e')]);router[_0x2254('0x1f')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x2254('0x1f')](_0x2254('0x10'),auth[_0x2254('0xc')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router['delete'](_0x2254('0x13'),auth[_0x2254('0xc')](),controller[_0x2254('0x20')]);module[_0x2254('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 f5d878d..748f0c3 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 _0xbf70=['randomstring','exports','STRING','name','generate','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','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x2d8fdf,_0x2ea4b7){var _0x50eaa3=function(_0xe86822){while(--_0xe86822){_0x2d8fdf['push'](_0x2d8fdf['shift']());}};_0x50eaa3(++_0x2ea4b7);}(_0xbf70,0x1cb));var _0x0bf7=function(_0x5c3947,_0x10c67e){_0x5c3947=_0x5c3947-0x0;var _0x2a5c23=_0xbf70[_0x5c3947];return _0x2a5c23;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x0bf7('0x0'));module[_0x0bf7('0x1')]={'name':{'type':Sequelize[_0x0bf7('0x2')],'unique':_0x0bf7('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x0bf7('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x0bf7('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x0bf7('0x2')],'defaultValue':function(){return rs[_0x0bf7('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0bf7('0x5')](_0x0bf7('0x6'),_0x0bf7('0x7'))},'accountSid':{'type':Sequelize[_0x0bf7('0x2')]},'baseUrl':{'type':Sequelize[_0x0bf7('0x2')]},'authToken':{'type':Sequelize[_0x0bf7('0x2')]},'notificationTemplate':{'type':Sequelize[_0x0bf7('0x8')],'defaultValue':function(){return _0x0bf7('0x9');}},'notificationSound':{'type':Sequelize[_0x0bf7('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0bf7('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0bf7('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0bf7('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0bf7('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0bf7('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0bf7('0xb')],'comment':_0x0bf7('0xc')},'mandatoryDisposition':{'type':Sequelize[_0x0bf7('0xa')],'defaultValue':![],'comment':_0x0bf7('0xd'),'set':function(_0x251a0d){if(!_0x251a0d){this[_0x0bf7('0xe')](_0x0bf7('0xf'),null);}this['setDataValue'](_0x0bf7('0x10'),_0x251a0d);}},'description':{'type':Sequelize[_0x0bf7('0x2')]}}; \ No newline at end of file +var _0x3cc0=['STRING','name','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0x3cc0,0x132));var _0x03cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3cc0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x03cc('0x0'));var rs=require(_0x03cc('0x1'));module['exports']={'name':{'type':Sequelize[_0x03cc('0x2')],'unique':_0x03cc('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x03cc('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x03cc('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x03cc('0x2')],'defaultValue':function(){return rs[_0x03cc('0x4')]();}},'phone':{'type':Sequelize[_0x03cc('0x2')]},'type':{'type':Sequelize[_0x03cc('0x5')](_0x03cc('0x6'),'sinch')},'accountSid':{'type':Sequelize[_0x03cc('0x2')]},'baseUrl':{'type':Sequelize[_0x03cc('0x2')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x03cc('0x7')],'defaultValue':function(){return _0x03cc('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x03cc('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x03cc('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x03cc('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x03cc('0x9')],'defaultValue':![],'comment':_0x03cc('0xb'),'set':function(_0x3e7d3c){if(!_0x3e7d3c){this[_0x03cc('0xc')]('mandatoryDispositionPauseId',null);}this[_0x03cc('0xc')](_0x03cc('0xd'),_0x3e7d3c);}},'description':{'type':Sequelize[_0x03cc('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 7f49d60..7d95e9e 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 _0xa647=['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','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','client','http','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','status','stack','name','mandatoryDispositionPause','map','WhatsappAccount','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','includeAll','include','findAll','rows','params','options','find','create','body','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','rawAttributes','order','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','removeAgents','userWhatsappAccount:remove','emit','User','getAgents','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','WhatsappApplication','findAndCountAll','priority','send','getApplications','whatsapp','Applications','account','statuses','WhatsappMessage','timestamp','message_id','applications','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','sinch','notifications','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','CmContact','DESC','Contacts','WhatsappInteraction','interaction','created','autoclose','push','close','ContactId','AttachmentId','UserId','agent','*,*,*,*','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','stringify','Content-Type','text/xml','\x0a','CmList','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel'];(function(_0x5afd32,_0x1a9286){var _0x34ff0c=function(_0x56b4c0){while(--_0x56b4c0){_0x5afd32['push'](_0x5afd32['shift']());}};_0x34ff0c(++_0x1a9286);}(_0xa647,0xb7));var _0x7a64=function(_0x174b8a,_0xc5b506){_0x174b8a=_0x174b8a-0x0;var _0x5a119f=_0xa647[_0x174b8a];return _0x5a119f;};'use strict';var emlformat=require(_0x7a64('0x0'));var rimraf=require(_0x7a64('0x1'));var zipdir=require(_0x7a64('0x2'));var jsonpatch=require(_0x7a64('0x3'));var rp=require(_0x7a64('0x4'));var moment=require(_0x7a64('0x5'));var BPromise=require(_0x7a64('0x6'));var Mustache=require(_0x7a64('0x7'));var util=require(_0x7a64('0x8'));var path=require(_0x7a64('0x9'));var sox=require(_0x7a64('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7a64('0xb'));var _=require(_0x7a64('0xc'));var squel=require(_0x7a64('0xd'));var crypto=require(_0x7a64('0xe'));var jsforce=require(_0x7a64('0xf'));var deskjs=require(_0x7a64('0x10'));var toCsv=require(_0x7a64('0x11'));var querystring=require(_0x7a64('0x12'));var Papa=require(_0x7a64('0x13'));var Redis=require(_0x7a64('0x14'));var authService=require(_0x7a64('0x15'));var qs=require(_0x7a64('0x16'));var as=require(_0x7a64('0x17'));var hardwareService=require(_0x7a64('0x18'));var logger=require(_0x7a64('0x19'))(_0x7a64('0x1a'));var utils=require(_0x7a64('0x1b'));var config=require(_0x7a64('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0x7a64('0x1d'))['db'];config[_0x7a64('0x1e')]=_[_0x7a64('0x1f')](config[_0x7a64('0x1e')],{'host':'localhost','port':0x18eb});var socket=require(_0x7a64('0x20'))(new Redis(config[_0x7a64('0x1e')]));require(_0x7a64('0x21'))[_0x7a64('0x22')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7a64('0x23')][_0x7a64('0x24')]({'port':0x232c});function respondWithRpcPromise(_0x55f7ec,_0xffd095,_0x526466,_0x4a42a8){return new BPromise(function(_0x2b4931,_0x492786){var _0x2bdb5f=_0x4a42a8||client;return _0x2bdb5f['request'](_0x55f7ec,_0x526466)[_0x7a64('0x25')](function(_0x417a5a){logger[_0x7a64('0x26')](_0x7a64('0x27'),_0xffd095,_0x7a64('0x28'));logger['debug'](_0x7a64('0x29'),_0xffd095,_0x7a64('0x28'),JSON['stringify'](_0x417a5a));if(_0x417a5a[_0x7a64('0x2a')]){if(_0x417a5a[_0x7a64('0x2a')][_0x7a64('0x2b')]===0x1f4){logger[_0x7a64('0x2a')](_0x7a64('0x27'),_0xffd095,_0x417a5a[_0x7a64('0x2a')]['message']);return _0x492786(_0x417a5a[_0x7a64('0x2a')][_0x7a64('0x2c')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0xffd095,_0x417a5a[_0x7a64('0x2a')]['message']);return _0x2b4931(_0x417a5a[_0x7a64('0x2a')][_0x7a64('0x2c')]);}else{logger[_0x7a64('0x26')](_0x7a64('0x27'),_0xffd095,'request\x20sent');_0x2b4931(_0x417a5a[_0x7a64('0x2d')][_0x7a64('0x2c')]);}})[_0x7a64('0x2e')](function(_0x4661c0){logger[_0x7a64('0x2a')]('WhatsappAccount,\x20%s,\x20%s',_0xffd095,_0x4661c0);_0x492786(_0x4661c0);});});}function respondWithStatusCode(_0x4b6860,_0x4b754d){_0x4b754d=_0x4b754d||0xcc;return function(_0x3b7523){if(_0x3b7523){return _0x4b6860[_0x7a64('0x2f')](_0x4b754d);}return _0x4b6860['status'](_0x4b754d)[_0x7a64('0x30')]();};}function respondWithResult(_0x29263e,_0xe1fd90){_0xe1fd90=_0xe1fd90||0xc8;return function(_0x135ff9){if(_0x135ff9){return _0x29263e['status'](_0xe1fd90)[_0x7a64('0x31')](_0x135ff9);}};}function respondWithFilteredResult(_0x2bd0e6,_0x230c32){return function(_0x222874){if(_0x222874){var _0xbc4827=typeof _0x230c32[_0x7a64('0x32')]===_0x7a64('0x33')&&typeof _0x230c32[_0x7a64('0x34')]===_0x7a64('0x33');var _0x202e45=_0x222874[_0x7a64('0x35')];var _0x5b9cde=_0xbc4827?0x0:_0x230c32[_0x7a64('0x32')];var _0x10a939=_0xbc4827?_0x222874[_0x7a64('0x35')]:_0x230c32[_0x7a64('0x32')]+_0x230c32[_0x7a64('0x34')];var _0x538395;if(_0x10a939>=_0x202e45){_0x10a939=_0x202e45;_0x538395=0xc8;}else{_0x538395=0xce;}_0x2bd0e6['status'](_0x538395);return _0x2bd0e6[_0x7a64('0x36')](_0x7a64('0x37'),_0x5b9cde+'-'+_0x10a939+'/'+_0x202e45)['json'](_0x222874);}return null;};}function patchUpdates(_0x33cd2b){return function(_0x284eeb){try{jsonpatch[_0x7a64('0x38')](_0x284eeb,_0x33cd2b,!![]);}catch(_0x455012){return BPromise[_0x7a64('0x39')](_0x455012);}return _0x284eeb[_0x7a64('0x3a')]();};}function saveUpdates(_0x297fa2,_0x330349){return function(_0x1fe008){if(_0x1fe008){return _0x1fe008[_0x7a64('0x3b')](_0x297fa2)['then'](function(_0x296327){return _0x296327;});}return null;};}function removeEntity(_0x2a4e05,_0x20753b){return function(_0x24173e){if(_0x24173e){return _0x24173e[_0x7a64('0x3c')]()[_0x7a64('0x25')](function(){var _0x4e7ca1=_0x24173e[_0x7a64('0x3d')]({'plain':!![]});var _0x5b61c1=_0x7a64('0x3e');return db[_0x7a64('0x3f')][_0x7a64('0x3c')]({'where':{'type':_0x5b61c1,'resourceId':_0x4e7ca1['id']}})[_0x7a64('0x25')](function(){return _0x24173e;});})['then'](function(){_0x2a4e05[_0x7a64('0x40')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56bc7c,_0x58b0a1){return function(_0x429bcc){if(!_0x429bcc){_0x56bc7c['sendStatus'](0x194);}return _0x429bcc;};}function handleError(_0x578be2,_0x5b140f){_0x5b140f=_0x5b140f||0x1f4;return function(_0x457b95){logger[_0x7a64('0x2a')](_0x457b95[_0x7a64('0x41')]);if(_0x457b95[_0x7a64('0x42')]){delete _0x457b95[_0x7a64('0x42')];}_0x578be2[_0x7a64('0x40')](_0x5b140f)['send'](_0x457b95);};}exports['index']=function(_0x2fc790,_0x5200cc){var _0x267f29={'include':[{'model':db['Pause'],'as':_0x7a64('0x43')}]},_0x2fac34={},_0x3aa5bf={'count':0x0,'rows':[]};var _0x2232a9=_[_0x7a64('0x44')](db[_0x7a64('0x45')]['rawAttributes'],function(_0x248ef8){return{'name':_0x248ef8['fieldName'],'type':_0x248ef8['type'][_0x7a64('0x46')]};});_0x2fac34['model']=_[_0x7a64('0x44')](_0x2232a9,'name');_0x2fac34['query']=_[_0x7a64('0x47')](_0x2fc790['query']);_0x2fac34[_0x7a64('0x48')]=_[_0x7a64('0x49')](_0x2fac34[_0x7a64('0x4a')],_0x2fac34[_0x7a64('0x4b')]);_0x267f29[_0x7a64('0x4c')]=_[_0x7a64('0x49')](_0x2fac34[_0x7a64('0x4a')],qs[_0x7a64('0x4d')](_0x2fc790[_0x7a64('0x4b')]['fields']));_0x267f29['attributes']=_0x267f29['attributes'][_0x7a64('0x4e')]?_0x267f29[_0x7a64('0x4c')]:_0x2fac34[_0x7a64('0x4a')];if(!_0x2fc790[_0x7a64('0x4b')][_0x7a64('0x4f')](_0x7a64('0x50'))){_0x267f29[_0x7a64('0x34')]=qs[_0x7a64('0x34')](_0x2fc790[_0x7a64('0x4b')]['limit']);_0x267f29[_0x7a64('0x32')]=qs[_0x7a64('0x32')](_0x2fc790[_0x7a64('0x4b')][_0x7a64('0x32')]);}_0x267f29['order']=qs['sort'](_0x2fc790[_0x7a64('0x4b')][_0x7a64('0x51')]);_0x267f29[_0x7a64('0x52')]=qs[_0x7a64('0x48')](_['pick'](_0x2fc790[_0x7a64('0x4b')],_0x2fac34[_0x7a64('0x48')]),_0x2232a9);if(_0x2fc790['query'][_0x7a64('0x53')]){_0x267f29['where']=_[_0x7a64('0x54')](_0x267f29[_0x7a64('0x52')],{'$or':_[_0x7a64('0x44')](_0x2232a9,function(_0x3e8d61){if(_0x3e8d61[_0x7a64('0x55')]!=='VIRTUAL'){var _0x13014d={};_0x13014d[_0x3e8d61[_0x7a64('0x42')]]={'$like':'%'+_0x2fc790[_0x7a64('0x4b')][_0x7a64('0x53')]+'%'};return _0x13014d;}})});}_0x267f29=_['merge']({},_0x267f29,_0x2fc790['options']);var _0x4f0c33={'where':_0x267f29[_0x7a64('0x52')]};return db[_0x7a64('0x45')][_0x7a64('0x35')](_0x4f0c33)[_0x7a64('0x25')](function(_0x56a2a4){_0x3aa5bf[_0x7a64('0x35')]=_0x56a2a4;if(_0x2fc790['query'][_0x7a64('0x56')]){_0x267f29[_0x7a64('0x57')]=[{'all':!![]}];}return db[_0x7a64('0x45')][_0x7a64('0x58')](_0x267f29);})['then'](function(_0x29c733){_0x3aa5bf[_0x7a64('0x59')]=_0x29c733;return _0x3aa5bf;})[_0x7a64('0x25')](respondWithFilteredResult(_0x5200cc,_0x267f29))[_0x7a64('0x2e')](handleError(_0x5200cc,null));};exports['show']=function(_0x7bd291,_0x3a6ecf){var _0x40e1a3={'raw':![],'where':{'id':_0x7bd291[_0x7a64('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x7a64('0x43')}]},_0x4c10bd={};_0x4c10bd['model']=_[_0x7a64('0x47')](db[_0x7a64('0x45')]['rawAttributes']);_0x4c10bd[_0x7a64('0x4b')]=_[_0x7a64('0x47')](_0x7bd291['query']);_0x4c10bd[_0x7a64('0x48')]=_[_0x7a64('0x49')](_0x4c10bd['model'],_0x4c10bd[_0x7a64('0x4b')]);_0x40e1a3[_0x7a64('0x4c')]=_[_0x7a64('0x49')](_0x4c10bd['model'],qs[_0x7a64('0x4d')](_0x7bd291[_0x7a64('0x4b')][_0x7a64('0x4d')]));_0x40e1a3[_0x7a64('0x4c')]=_0x40e1a3['attributes'][_0x7a64('0x4e')]?_0x40e1a3[_0x7a64('0x4c')]:_0x4c10bd['model'];if(_0x7bd291[_0x7a64('0x4b')]['includeAll']){_0x40e1a3[_0x7a64('0x57')]=[{'all':!![]}];}_0x40e1a3=_[_0x7a64('0x54')]({},_0x40e1a3,_0x7bd291[_0x7a64('0x5b')]);return db[_0x7a64('0x45')][_0x7a64('0x5c')](_0x40e1a3)[_0x7a64('0x25')](handleEntityNotFound(_0x3a6ecf,null))[_0x7a64('0x25')](respondWithResult(_0x3a6ecf,null))[_0x7a64('0x2e')](handleError(_0x3a6ecf,null));};exports[_0x7a64('0x5d')]=function(_0x340fc9,_0x11ec28){return db[_0x7a64('0x45')][_0x7a64('0x5d')](_0x340fc9[_0x7a64('0x5e')],{})['then'](function(_0x730c23){var _0x33e29d=_0x340fc9['user'][_0x7a64('0x3d')]({'plain':!![]});if(!_0x33e29d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33e29d[_0x7a64('0x5f')]===_0x7a64('0x60')){var _0x29375c=_0x730c23['get']({'plain':!![]});var _0x5791ee=_0x7a64('0x3e');return db[_0x7a64('0x61')][_0x7a64('0x5c')]({'where':{'name':_0x5791ee,'userProfileId':_0x33e29d[_0x7a64('0x62')]},'raw':!![]})[_0x7a64('0x25')](function(_0x306a53){if(_0x306a53&&_0x306a53['autoAssociation']===0x0){return db[_0x7a64('0x3f')][_0x7a64('0x5d')]({'name':_0x29375c[_0x7a64('0x42')],'resourceId':_0x29375c['id'],'type':_0x306a53[_0x7a64('0x42')],'sectionId':_0x306a53['id']},{})[_0x7a64('0x25')](function(){return _0x730c23;});}else{return _0x730c23;}})[_0x7a64('0x2e')](function(_0x100ca8){logger[_0x7a64('0x2a')](_0x7a64('0x63'),_0x100ca8);throw _0x100ca8;});}return _0x730c23;})[_0x7a64('0x25')](respondWithResult(_0x11ec28,0xc9))[_0x7a64('0x2e')](handleError(_0x11ec28,null));};exports['update']=function(_0x419dbb,_0x46817b){if(_0x419dbb[_0x7a64('0x5e')]['id']){delete _0x419dbb[_0x7a64('0x5e')]['id'];}return db[_0x7a64('0x45')]['find']({'where':{'id':_0x419dbb[_0x7a64('0x5a')]['id']},'include':[{'model':db[_0x7a64('0x64')],'as':_0x7a64('0x43')}]})[_0x7a64('0x25')](handleEntityNotFound(_0x46817b,null))['then'](saveUpdates(_0x419dbb[_0x7a64('0x5e')],null))['then'](respondWithResult(_0x46817b,null))[_0x7a64('0x2e')](handleError(_0x46817b,null));};exports[_0x7a64('0x3c')]=function(_0x319fbf,_0x8f473){return db[_0x7a64('0x45')][_0x7a64('0x5c')]({'where':{'id':_0x319fbf[_0x7a64('0x5a')]['id']}})[_0x7a64('0x25')](handleEntityNotFound(_0x8f473,null))[_0x7a64('0x25')](removeEntity(_0x8f473,null))[_0x7a64('0x2e')](handleError(_0x8f473,null));};exports[_0x7a64('0x65')]=function(_0x225574,_0x3c3524){return db[_0x7a64('0x45')][_0x7a64('0x65')]()[_0x7a64('0x25')](respondWithResult(_0x3c3524,null))[_0x7a64('0x2e')](handleError(_0x3c3524,null));};exports[_0x7a64('0x66')]=function(_0x4dfa1e,_0x106306,_0x53aad2){if(_0x4dfa1e[_0x7a64('0x5e')]['id']){delete _0x4dfa1e['body']['id'];}return db[_0x7a64('0x45')]['find']({'where':{'id':_0x4dfa1e[_0x7a64('0x5a')]['id']}})[_0x7a64('0x25')](handleEntityNotFound(_0x106306,null))[_0x7a64('0x25')](function(_0x36bdb4){if(_0x36bdb4){_0x4dfa1e[_0x7a64('0x5e')][_0x7a64('0x67')]=_0x36bdb4['id'];return db[_0x7a64('0x68')][_0x7a64('0x5d')](_0x4dfa1e[_0x7a64('0x5e')]);}})[_0x7a64('0x25')](respondWithResult(_0x106306,null))[_0x7a64('0x2e')](handleError(_0x106306,null));};exports[_0x7a64('0x69')]=function(_0x3c0374,_0x239a90,_0x3a9b34){var _0x101081={'raw':![],'where':{}};var _0x2a5c3e={};var _0x5ebe19={'count':0x0,'rows':[]};return db[_0x7a64('0x45')][_0x7a64('0x6a')]({'where':{'id':_0x3c0374['params']['id']}})['then'](handleEntityNotFound(_0x239a90,null))[_0x7a64('0x25')](function(_0x2792d9){if(_0x2792d9){_0x2a5c3e['model']=_['keys'](db['Disposition'][_0x7a64('0x6b')]);_0x2a5c3e[_0x7a64('0x4b')]=_[_0x7a64('0x47')](_0x3c0374[_0x7a64('0x4b')]);_0x2a5c3e[_0x7a64('0x48')]=_['intersection'](_0x2a5c3e[_0x7a64('0x4a')],_0x2a5c3e[_0x7a64('0x4b')]);_0x101081[_0x7a64('0x4c')]=_[_0x7a64('0x49')](_0x2a5c3e['model'],qs['fields'](_0x3c0374[_0x7a64('0x4b')]['fields']));_0x101081[_0x7a64('0x4c')]=_0x101081[_0x7a64('0x4c')][_0x7a64('0x4e')]?_0x101081['attributes']:_0x2a5c3e[_0x7a64('0x4a')];if(!_0x3c0374['query']['hasOwnProperty'](_0x7a64('0x50'))){_0x101081['limit']=qs[_0x7a64('0x34')](_0x3c0374[_0x7a64('0x4b')][_0x7a64('0x34')]);_0x101081['offset']=qs[_0x7a64('0x32')](_0x3c0374[_0x7a64('0x4b')][_0x7a64('0x32')]);}_0x101081[_0x7a64('0x6c')]=qs[_0x7a64('0x51')](_0x3c0374[_0x7a64('0x4b')][_0x7a64('0x51')]);_0x101081[_0x7a64('0x52')]=qs[_0x7a64('0x48')](_[_0x7a64('0x6d')](_0x3c0374['query'],_0x2a5c3e[_0x7a64('0x48')]));_0x101081[_0x7a64('0x52')]['WhatsappAccountId']=_0x2792d9['id'];if(_0x3c0374['query'][_0x7a64('0x53')]){_0x101081[_0x7a64('0x52')]=_[_0x7a64('0x54')](_0x101081['where'],{'$or':_[_0x7a64('0x44')](_0x101081[_0x7a64('0x4c')],function(_0x2ab644){var _0x334267={};_0x334267[_0x2ab644]={'$like':'%'+_0x3c0374[_0x7a64('0x4b')][_0x7a64('0x53')]+'%'};return _0x334267;})});}_0x101081=_[_0x7a64('0x54')]({},_0x101081,_0x3c0374[_0x7a64('0x5b')]);return db[_0x7a64('0x68')][_0x7a64('0x35')]({'where':_0x101081[_0x7a64('0x52')]})[_0x7a64('0x25')](function(_0x4771aa){_0x5ebe19[_0x7a64('0x35')]=_0x4771aa;if(_0x3c0374['query'][_0x7a64('0x56')]){_0x101081['include']=[{'all':!![]}];}return db[_0x7a64('0x68')]['findAll'](_0x101081);})['then'](function(_0x4310a4){_0x5ebe19[_0x7a64('0x59')]=_0x4310a4;return _0x5ebe19;});}})[_0x7a64('0x25')](respondWithFilteredResult(_0x239a90,_0x101081))['catch'](handleError(_0x239a90,null));};exports[_0x7a64('0x6e')]=function(_0xa5b3e3,_0x188de9,_0x458288){return db['WhatsappAccount'][_0x7a64('0x5c')]({'where':{'id':_0xa5b3e3[_0x7a64('0x5a')]['id']}})[_0x7a64('0x25')](handleEntityNotFound(_0x188de9,null))[_0x7a64('0x25')](function(_0x4dc2e8){if(_0x4dc2e8){return _0x4dc2e8[_0x7a64('0x6e')](_0xa5b3e3['query'][_0x7a64('0x6f')]);}})['then'](respondWithStatusCode(_0x188de9,null))['catch'](handleError(_0x188de9,null));};exports[_0x7a64('0x70')]=function(_0x5e4e67,_0x2cdf85,_0x2c4c26){if(_0x5e4e67[_0x7a64('0x5e')]['id']){delete _0x5e4e67[_0x7a64('0x5e')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x5e4e67['params']['id']}})['then'](handleEntityNotFound(_0x2cdf85,null))[_0x7a64('0x25')](function(_0x3c90dc){if(_0x3c90dc){_0x5e4e67[_0x7a64('0x5e')][_0x7a64('0x67')]=_0x3c90dc['id'];return db[_0x7a64('0x71')]['create'](_0x5e4e67[_0x7a64('0x5e')]);}})[_0x7a64('0x25')](respondWithResult(_0x2cdf85,null))['catch'](handleError(_0x2cdf85,null));};exports[_0x7a64('0x72')]=function(_0xcc8230,_0x45ba32,_0x40e4f0){var _0x3db6fa={'raw':![],'where':{}};var _0x160362={};var _0x41d28e={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x7a64('0x6a')]({'where':{'id':_0xcc8230[_0x7a64('0x5a')]['id']}})[_0x7a64('0x25')](handleEntityNotFound(_0x45ba32,null))['then'](function(_0x5934f4){if(_0x5934f4){_0x160362[_0x7a64('0x4a')]=_[_0x7a64('0x47')](db['CannedAnswer'][_0x7a64('0x6b')]);_0x160362[_0x7a64('0x4b')]=_[_0x7a64('0x47')](_0xcc8230[_0x7a64('0x4b')]);_0x160362[_0x7a64('0x48')]=_['intersection'](_0x160362[_0x7a64('0x4a')],_0x160362[_0x7a64('0x4b')]);_0x3db6fa[_0x7a64('0x4c')]=_[_0x7a64('0x49')](_0x160362['model'],qs['fields'](_0xcc8230[_0x7a64('0x4b')][_0x7a64('0x4d')]));_0x3db6fa[_0x7a64('0x4c')]=_0x3db6fa[_0x7a64('0x4c')]['length']?_0x3db6fa[_0x7a64('0x4c')]:_0x160362[_0x7a64('0x4a')];if(!_0xcc8230[_0x7a64('0x4b')][_0x7a64('0x4f')](_0x7a64('0x50'))){_0x3db6fa[_0x7a64('0x34')]=qs[_0x7a64('0x34')](_0xcc8230[_0x7a64('0x4b')]['limit']);_0x3db6fa[_0x7a64('0x32')]=qs[_0x7a64('0x32')](_0xcc8230[_0x7a64('0x4b')][_0x7a64('0x32')]);}_0x3db6fa[_0x7a64('0x6c')]=qs['sort'](_0xcc8230['query'][_0x7a64('0x51')]);_0x3db6fa[_0x7a64('0x52')]=qs[_0x7a64('0x48')](_[_0x7a64('0x6d')](_0xcc8230[_0x7a64('0x4b')],_0x160362[_0x7a64('0x48')]));_0x3db6fa['where'][_0x7a64('0x67')]=_0x5934f4['id'];if(_0xcc8230[_0x7a64('0x4b')][_0x7a64('0x53')]){_0x3db6fa[_0x7a64('0x52')]=_[_0x7a64('0x54')](_0x3db6fa[_0x7a64('0x52')],{'$or':_['map'](_0x3db6fa['attributes'],function(_0x389662){var _0x4d6060={};_0x4d6060[_0x389662]={'$like':'%'+_0xcc8230['query'][_0x7a64('0x53')]+'%'};return _0x4d6060;})});}_0x3db6fa=_['merge']({},_0x3db6fa,_0xcc8230[_0x7a64('0x5b')]);return db['CannedAnswer'][_0x7a64('0x35')]({'where':_0x3db6fa['where']})['then'](function(_0x30fbaa){_0x41d28e[_0x7a64('0x35')]=_0x30fbaa;if(_0xcc8230[_0x7a64('0x4b')][_0x7a64('0x56')]){_0x3db6fa['include']=[{'all':!![]}];}return db[_0x7a64('0x71')][_0x7a64('0x58')](_0x3db6fa);})[_0x7a64('0x25')](function(_0x308839){_0x41d28e[_0x7a64('0x59')]=_0x308839;return _0x41d28e;});}})[_0x7a64('0x25')](respondWithFilteredResult(_0x45ba32,_0x3db6fa))['catch'](handleError(_0x45ba32,null));};exports['removeAnswers']=function(_0x102d94,_0x2990de,_0x284fad){return db[_0x7a64('0x45')][_0x7a64('0x5c')]({'where':{'id':_0x102d94['params']['id']}})[_0x7a64('0x25')](handleEntityNotFound(_0x2990de,null))[_0x7a64('0x25')](function(_0x915b1){if(_0x915b1){return _0x915b1[_0x7a64('0x73')](_0x102d94[_0x7a64('0x4b')][_0x7a64('0x6f')]);}})[_0x7a64('0x25')](respondWithStatusCode(_0x2990de,null))[_0x7a64('0x2e')](handleError(_0x2990de,null));};exports[_0x7a64('0x74')]=function(_0x100c48,_0x2dfc40,_0x3618cd){return db['WhatsappAccount']['find']({'where':{'id':_0x100c48[_0x7a64('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2dfc40,null))[_0x7a64('0x25')](function(_0x46e0f4){if(_0x46e0f4){return _0x46e0f4[_0x7a64('0x74')](_0x100c48[_0x7a64('0x5e')][_0x7a64('0x6f')],_[_0x7a64('0x75')](_0x100c48[_0x7a64('0x5e')],['ids','id'])||{})[_0x7a64('0x76')](function(_0x112c16){for(var _0x287178=0x0;_0x287178<_0x100c48[_0x7a64('0x5e')]['ids'][_0x7a64('0x4e')];_0x287178+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':Number(_0x100c48['body']['ids'][_0x287178]),'WhatsappAccountId':Number(_0x100c48[_0x7a64('0x5a')]['id'])});}return _0x112c16;});}})[_0x7a64('0x25')](respondWithResult(_0x2dfc40,null))[_0x7a64('0x2e')](handleError(_0x2dfc40,null));};exports[_0x7a64('0x77')]=function(_0x5c5e9c,_0x5d10af,_0x217609){return db[_0x7a64('0x45')][_0x7a64('0x5c')]({'where':{'id':_0x5c5e9c[_0x7a64('0x5a')]['id']}})[_0x7a64('0x25')](handleEntityNotFound(_0x5d10af,null))[_0x7a64('0x25')](function(_0x34df47){if(_0x34df47){return _0x34df47[_0x7a64('0x77')](_0x5c5e9c[_0x7a64('0x4b')][_0x7a64('0x6f')])[_0x7a64('0x25')](function(){if(_['isArray'](_0x5c5e9c[_0x7a64('0x4b')][_0x7a64('0x6f')])){for(var _0x3c061f=0x0;_0x3c061f<_0x5c5e9c[_0x7a64('0x4b')][_0x7a64('0x6f')][_0x7a64('0x4e')];_0x3c061f+=0x1){socket['emit'](_0x7a64('0x78'),{'UserId':Number(_0x5c5e9c[_0x7a64('0x4b')]['ids'][_0x3c061f]),'WhatsappAccountId':Number(_0x5c5e9c[_0x7a64('0x5a')]['id'])});}}else{socket[_0x7a64('0x79')](_0x7a64('0x78'),{'UserId':Number(_0x5c5e9c['query'][_0x7a64('0x6f')]),'WhatsappAccountId':Number(_0x5c5e9c[_0x7a64('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x5d10af,null))[_0x7a64('0x2e')](handleError(_0x5d10af,null));};exports['getAgents']=function(_0x490b50,_0x37adaa,_0x3e3b88){var _0x135c36={};var _0x53de36={};var _0x20b120;var _0x13cfab;return db[_0x7a64('0x45')][_0x7a64('0x6a')]({'where':{'id':_0x490b50[_0x7a64('0x5a')]['id']}})[_0x7a64('0x25')](handleEntityNotFound(_0x37adaa,null))[_0x7a64('0x25')](function(_0x2930a0){if(_0x2930a0){_0x20b120=_0x2930a0;_0x53de36[_0x7a64('0x4a')]=_[_0x7a64('0x47')](db[_0x7a64('0x7a')]['rawAttributes']);_0x53de36['query']=_[_0x7a64('0x47')](_0x490b50['query']);_0x53de36[_0x7a64('0x48')]=_[_0x7a64('0x49')](_0x53de36[_0x7a64('0x4a')],_0x53de36[_0x7a64('0x4b')]);_0x135c36[_0x7a64('0x4c')]=_[_0x7a64('0x49')](_0x53de36['model'],qs['fields'](_0x490b50[_0x7a64('0x4b')][_0x7a64('0x4d')]));_0x135c36[_0x7a64('0x4c')]=_0x135c36['attributes'][_0x7a64('0x4e')]?_0x135c36['attributes']:_0x53de36[_0x7a64('0x4a')];_0x135c36['order']=qs[_0x7a64('0x51')](_0x490b50[_0x7a64('0x4b')][_0x7a64('0x51')]);_0x135c36['where']=qs[_0x7a64('0x48')](_[_0x7a64('0x6d')](_0x490b50[_0x7a64('0x4b')],_0x53de36[_0x7a64('0x48')]));if(_0x490b50[_0x7a64('0x4b')][_0x7a64('0x53')]){_0x135c36[_0x7a64('0x52')]=_[_0x7a64('0x54')](_0x135c36[_0x7a64('0x52')],{'$or':_[_0x7a64('0x44')](_0x135c36['attributes'],function(_0x4c72a3){var _0x2336c0={};_0x2336c0[_0x4c72a3]={'$like':'%'+_0x490b50[_0x7a64('0x4b')][_0x7a64('0x53')]+'%'};return _0x2336c0;})});}_0x135c36=_[_0x7a64('0x54')]({},_0x135c36,_0x490b50[_0x7a64('0x5b')]);return _0x20b120[_0x7a64('0x7b')](_0x135c36);}})[_0x7a64('0x25')](function(_0x208f92){if(_0x208f92){_0x13cfab=_0x208f92[_0x7a64('0x4e')];if(!_0x490b50[_0x7a64('0x4b')]['hasOwnProperty']('nolimit')){_0x135c36[_0x7a64('0x34')]=qs[_0x7a64('0x34')](_0x490b50[_0x7a64('0x4b')][_0x7a64('0x34')]);_0x135c36[_0x7a64('0x32')]=qs['offset'](_0x490b50['query']['offset']);}return _0x20b120[_0x7a64('0x7b')](_0x135c36);}})[_0x7a64('0x25')](function(_0x33ce4e){if(_0x33ce4e){return _0x33ce4e?{'count':_0x13cfab,'rows':_0x33ce4e}:null;}})[_0x7a64('0x25')](respondWithResult(_0x37adaa,null))[_0x7a64('0x2e')](handleError(_0x37adaa,null));};exports[_0x7a64('0x7c')]=function(_0x2ba022,_0x17b1ae){var _0xa3514c=_0x2ba022[_0x7a64('0x5a')]['id'];var _0x3cc597=_0x2ba022[_0x7a64('0x5e')];var _0x420ae2=0xc8;var _0x4c7b51=null;return db[_0x7a64('0x7d')][_0x7a64('0x7e')]({'isolationLevel':db[_0x7a64('0x7d')][_0x7a64('0x7f')][_0x7a64('0x80')][_0x7a64('0x81')]},function(_0xae3de3){return db['WhatsappAccount']['findOne']({'where':{'id':_0xa3514c},'transaction':_0xae3de3})[_0x7a64('0x25')](function(_0x3b46c7){if(_0x3b46c7){return db['WhatsappApplication'][_0x7a64('0x3c')]({'where':{'WhatsappAccountId':_0xa3514c},'transaction':_0xae3de3})[_0x7a64('0x25')](function(){var _0x127c1c=_[_0x7a64('0x44')](_0x3cc597,function(_0x1e21c4){_0x1e21c4[_0x7a64('0x67')]=_0xa3514c;return _0x1e21c4;});return db['WhatsappApplication'][_0x7a64('0x82')](_0x127c1c,{'transaction':_0xae3de3});});}else{_0x420ae2=0x194;_0x4c7b51=[];}});})['then'](function(){if(_0x420ae2!==0x194){return db[_0x7a64('0x83')][_0x7a64('0x84')]({'where':{'WhatsappAccountId':_0xa3514c},'order':_0x7a64('0x85')})['then'](function(_0x4c1158){_0x4c7b51=_0x4c1158;});}})[_0x7a64('0x2e')](function(_0x55c12f){_0x420ae2=0x1f4;logger[_0x7a64('0x2a')](_0x55c12f[_0x7a64('0x41')]);if(_0x55c12f[_0x7a64('0x42')]){delete _0x55c12f[_0x7a64('0x42')];}_0x4c7b51=_0x55c12f;})['finally'](function(){if(_0x4c7b51===null){_0x17b1ae[_0x7a64('0x2f')](_0x420ae2);}else{if(_0x420ae2===0x1f4){_0x17b1ae[_0x7a64('0x40')](_0x420ae2)[_0x7a64('0x86')](_0x4c7b51);}else{_0x17b1ae[_0x7a64('0x40')](_0x420ae2)[_0x7a64('0x31')](_0x4c7b51);}}});};exports['getApplications']=function(_0x2b1083,_0x46beae,_0x5f0dc7){var _0x4b2ddb={};var _0x1392da={};var _0x142ab1;var _0x22814d;return db[_0x7a64('0x45')][_0x7a64('0x6a')]({'where':{'id':_0x2b1083['params']['id']}})['then'](handleEntityNotFound(_0x46beae,null))['then'](function(_0x5be65f){if(_0x5be65f){_0x142ab1=_0x5be65f;_0x1392da[_0x7a64('0x4a')]=_[_0x7a64('0x47')](db[_0x7a64('0x83')]['rawAttributes']);_0x1392da[_0x7a64('0x4b')]=_[_0x7a64('0x47')](_0x2b1083[_0x7a64('0x4b')]);_0x1392da[_0x7a64('0x48')]=_[_0x7a64('0x49')](_0x1392da['model'],_0x1392da[_0x7a64('0x4b')]);_0x4b2ddb[_0x7a64('0x4c')]=_[_0x7a64('0x49')](_0x1392da['model'],qs['fields'](_0x2b1083[_0x7a64('0x4b')][_0x7a64('0x4d')]));_0x4b2ddb[_0x7a64('0x4c')]=_0x4b2ddb[_0x7a64('0x4c')][_0x7a64('0x4e')]?_0x4b2ddb[_0x7a64('0x4c')]:_0x1392da[_0x7a64('0x4a')];_0x4b2ddb[_0x7a64('0x6c')]=qs[_0x7a64('0x51')](_0x2b1083[_0x7a64('0x4b')]['sort']);_0x4b2ddb[_0x7a64('0x52')]=qs[_0x7a64('0x48')](_['pick'](_0x2b1083[_0x7a64('0x4b')],_0x1392da[_0x7a64('0x48')]));if(_0x2b1083[_0x7a64('0x4b')][_0x7a64('0x53')]){_0x4b2ddb['where']=_[_0x7a64('0x54')](_0x4b2ddb[_0x7a64('0x52')],{'$or':_[_0x7a64('0x44')](_0x4b2ddb[_0x7a64('0x4c')],function(_0xaa3411){var _0x466317={};_0x466317[_0xaa3411]={'$like':'%'+_0x2b1083[_0x7a64('0x4b')][_0x7a64('0x53')]+'%'};return _0x466317;})});}_0x4b2ddb=_[_0x7a64('0x54')]({},_0x4b2ddb,_0x2b1083[_0x7a64('0x5b')]);return _0x142ab1[_0x7a64('0x87')](_0x4b2ddb);}})['then'](function(_0x2f2930){if(_0x2f2930){_0x22814d=_0x2f2930[_0x7a64('0x4e')];if(!_0x2b1083[_0x7a64('0x4b')][_0x7a64('0x4f')](_0x7a64('0x50'))){_0x4b2ddb[_0x7a64('0x34')]=qs[_0x7a64('0x34')](_0x2b1083[_0x7a64('0x4b')][_0x7a64('0x34')]);_0x4b2ddb[_0x7a64('0x32')]=qs[_0x7a64('0x32')](_0x2b1083[_0x7a64('0x4b')][_0x7a64('0x32')]);}return _0x142ab1[_0x7a64('0x87')](_0x4b2ddb);}})['then'](function(_0x4d35b8){if(_0x4d35b8){return _0x4d35b8?{'count':_0x22814d,'rows':_0x4d35b8}:null;}})[_0x7a64('0x25')](respondWithResult(_0x46beae,null))[_0x7a64('0x2e')](handleError(_0x46beae,null));};exports['notify']=function(_0x1391c4,_0x5f0fa9,_0x20138e){var _0x5e2962={'channel':_0x7a64('0x88')};var _0x17b3e7=[];var _0x42235c=[];var _0x586b91={};return db[_0x7a64('0x45')][_0x7a64('0x5c')]({'where':{'id':_0x1391c4[_0x7a64('0x5a')]['id']},'include':[{'model':db[_0x7a64('0x83')],'as':_0x7a64('0x89')}]})[_0x7a64('0x25')](handleEntityNotFound(_0x5f0fa9,null))['then'](function(_0x2e0375){_0x5e2962[_0x7a64('0x8a')]=_0x2e0375;if(_0x5e2962[_0x7a64('0x8a')]&&_0x5e2962['account'][_0x7a64('0x55')]==='sinch'&&_0x1391c4[_0x7a64('0x5e')]['statuses']){if(_0x1391c4['body'][_0x7a64('0x8b')][_0x7a64('0x4e')]===0x0)return;if(_0x1391c4['body']['statuses'][0x0]['state']!=='read')return;return db[_0x7a64('0x8c')][_0x7a64('0x3b')]({'read':!![],'readAt':_0x1391c4[_0x7a64('0x5e')][_0x7a64('0x8b')][0x0][_0x7a64('0x8d')]},{'where':{'messageId':_0x1391c4[_0x7a64('0x5e')][_0x7a64('0x8b')][0x0][_0x7a64('0x8e')]},'individualHooks':!![]})['then'](function(_0x48896e){return _0x5f0fa9[_0x7a64('0x40')](0xc8)[_0x7a64('0x31')](_0x48896e);});}_0x5e2962[_0x7a64('0x8f')]=_['orderBy'](_0x2e0375[_0x7a64('0x89')],[_0x7a64('0x85')],[_0x7a64('0x90')]);if(_0x5e2962[_0x7a64('0x8a')][_0x7a64('0x89')]){delete _0x5e2962[_0x7a64('0x8a')]['Applications'];}return db['CmContact'][_0x7a64('0x65')]()[_0x7a64('0x25')](function(_0x5e97d3){if(!_0x5e97d3){throw new db[(_0x7a64('0x91'))][(_0x7a64('0x92'))](_0x7a64('0x93'));}_0x17b3e7=_[_0x7a64('0x94')](_[_0x7a64('0x47')](_0x5e97d3),['createdAt',_0x7a64('0x95')]);_0x42235c=_['difference'](_[_0x7a64('0x47')](_0x5e97d3),[_0x7a64('0x96'),_0x7a64('0x95'),'CompanyId',_0x7a64('0x97')]);_0x5e2962['body']={'mapKey':_0x7a64('0x98')};if(_0x5e2962[_0x7a64('0x8a')]&&_0x5e2962['account'][_0x7a64('0x55')]===_0x7a64('0x99')){_0x5e2962['body'][_0x7a64('0x9a')]=_0x1391c4[_0x7a64('0x5e')][_0x7a64('0x9b')][_0x7a64('0x9c')](_0x7a64('0x9d'),'');_0x5e2962[_0x7a64('0x5e')][_0x7a64('0x5e')]=_0x1391c4[_0x7a64('0x5e')][_0x7a64('0x9e')];_0x5e2962[_0x7a64('0x5e')][_0x7a64('0x9f')]=_0x1391c4[_0x7a64('0x5e')]['MessageSid'];}if(_0x5e2962['account']&&_0x5e2962['account'][_0x7a64('0x55')]===_0x7a64('0xa0')){_0x5e2962['body'][_0x7a64('0x9a')]=_0x1391c4[_0x7a64('0x5e')]['notifications'][0x0][_0x7a64('0x9a')];_0x5e2962[_0x7a64('0x5e')][_0x7a64('0x5e')]=_0x1391c4[_0x7a64('0x5e')][_0x7a64('0xa1')][0x0][_0x7a64('0x2c')]['body'];_0x5e2962[_0x7a64('0x5e')]['messageId']=_0x1391c4[_0x7a64('0x5e')]['notifications'][0x0][_0x7a64('0x8e')];}if(_0x5e2962[_0x7a64('0x5e')]['id']){delete _0x5e2962[_0x7a64('0x5e')]['id'];}if(_[_0x7a64('0xa2')](_0x5e2962[_0x7a64('0x5e')][_0x7a64('0x9a')])){throw new db[(_0x7a64('0x91'))][(_0x7a64('0x92'))](_0x7a64('0xa3'));}if(_['isNil'](_0x5e2962[_0x7a64('0x5e')]['body'])||_0x5e2962[_0x7a64('0x5e')][_0x7a64('0x5e')]===''){throw new db[(_0x7a64('0x91'))][(_0x7a64('0x92'))](_0x7a64('0xa4'));}if(_[_0x7a64('0xa2')](_0x5e2962[_0x7a64('0x5e')][_0x7a64('0xa5')])){throw new db['Sequelize'][(_0x7a64('0x92'))](_0x7a64('0xa6')+_0x42235c);}if(!_[_0x7a64('0xa7')](_0x42235c,_0x5e2962[_0x7a64('0x5e')][_0x7a64('0xa5')])){throw new db['Sequelize'][(_0x7a64('0x92'))](_0x7a64('0xa8')+_0x42235c);}_0x586b91[_0x5e2962[_0x7a64('0x5e')][_0x7a64('0xa5')]]=_0x5e2962[_0x7a64('0x5e')][_0x7a64('0x9a')];return db['CmList'][_0x7a64('0x5c')]({'where':{'id':_0x5e2962[_0x7a64('0x8a')][_0x7a64('0x97')]},'include':[{'model':db[_0x7a64('0xa9')],'as':'Contacts','where':_0x586b91,'limit':0x1,'order':[[_0x7a64('0x95'),_0x7a64('0xaa')]]}]});})[_0x7a64('0x25')](handleEntityNotFound(_0x5f0fa9,null))[_0x7a64('0x25')](function(_0x33a2b1){if(_0x33a2b1){_0x5e2962['list']=_[_0x7a64('0x75')](_0x33a2b1,[_0x7a64('0xab')]);if(_0x33a2b1[_0x7a64('0xab')][_0x7a64('0x4e')]){return _0x33a2b1[_0x7a64('0xab')][0x0];}var _0x427515=_[_0x7a64('0x1f')](_0x5e2962[_0x7a64('0x5e')],{'firstName':_0x5e2962[_0x7a64('0x5e')]['from'],'ListId':_0x33a2b1['id']});_0x427515[_0x5e2962[_0x7a64('0x5e')][_0x7a64('0xa5')]]=_0x5e2962[_0x7a64('0x5e')][_0x7a64('0x9a')];return db['CmContact'][_0x7a64('0x5d')](_0x427515,{'fields':_0x17b3e7,'raw':!![]});}})[_0x7a64('0x25')](handleEntityNotFound(_0x5f0fa9,null))[_0x7a64('0x25')](function(_0xe670a0){if(_0xe670a0){_0x5e2962['contact']=_0xe670a0;var _0x9da720={'ContactId':_0xe670a0['id'],'phone':_0x5e2962[_0x7a64('0x5e')][_0x7a64('0x9a')],'WhatsappAccountId':_0x1391c4[_0x7a64('0x5a')]['id']};var _0x35e929={'ContactId':_0xe670a0['id'],'WhatsappAccountId':_0x1391c4[_0x7a64('0x5a')]['id'],'closed':![]};return db[_0x7a64('0xac')]['find']({'where':_0x35e929})[_0x7a64('0x25')](function(_0x4a4507){if(_0x4a4507){return[_0x4a4507,![]];}return db[_0x7a64('0xac')][_0x7a64('0x5d')](_0x9da720)[_0x7a64('0x25')](function(_0x317564){return[_0x317564,!![]];});});}})[_0x7a64('0x76')](function(_0x5e84f3,_0x129f3d){_0x5e2962['interaction']=_0x5e84f3[_0x7a64('0x3d')]({'plain':!![]});_0x5e2962[_0x7a64('0xad')][_0x7a64('0xae')]=![];if(_0x129f3d){if(_0x5e2962['account'][_0x7a64('0xaf')]){_0x5e2962[_0x7a64('0x8f')][_0x7a64('0xb0')]({'id':0x0,'priority':_0x5e2962[_0x7a64('0x8f')][_0x7a64('0x4e')]+0x1,'app':_0x7a64('0xb1'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x5e2962[_0x7a64('0xad')][_0x7a64('0xae')]=!![];}return db[_0x7a64('0x8c')]['create']({'phone':_0x5e2962[_0x7a64('0x5e')][_0x7a64('0x9a')],'messageId':_0x5e2962[_0x7a64('0x5e')]['messageId'],'body':_0x5e2962[_0x7a64('0x5e')]['body'],'WhatsappAccountId':_0x1391c4[_0x7a64('0x5a')]['id'],'WhatsappInteractionId':_0x5e84f3['id'],'direction':'in','ContactId':_0x5e84f3[_0x7a64('0xb2')],'AttachmentId':_0x5e2962[_0x7a64('0x5e')][_0x7a64('0xb3')]});})[_0x7a64('0x25')](function(_0x43bc26){_0x5e2962[_0x7a64('0x2c')]=_0x43bc26;if(_0x5e2962[_0x7a64('0xad')][_0x7a64('0xb4')]){return db['User'][_0x7a64('0x5c')]({'attributes':['id',_0x7a64('0x42')],'where':{'id':_0x5e2962[_0x7a64('0xad')][_0x7a64('0xb4')]}})[_0x7a64('0x25')](function(_0x1bae26){if(_0x1bae26){_0x5e2962['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x7a64('0xb5'),'appdata':_0x1bae26[_0x7a64('0x42')]+','+(_0x5e2962[_0x7a64('0x8a')]['waitForTheAssignedAgent']||0xa),'interval':_0x7a64('0xb6')});}return respondWithRpcPromise(_0x7a64('0xb7'),_0x7a64('0xb8'),_0x5e2962);});}return respondWithRpcPromise(_0x7a64('0xb7'),'startRouting',_0x5e2962);})['then'](function(_0xe8b459){if(_0xe8b459){var _0x446a5a=0xc8;var _0x6fa22e=_0x7a64('0xb9');logger[_0x7a64('0x26')](_0x7a64('0x29'),_0x6fa22e,_0x446a5a,'entity\x20found');logger['debug'](_0x7a64('0xba'),_0x6fa22e,_0x446a5a,_0x7a64('0xbb'),JSON[_0x7a64('0xbc')](_0xe8b459));if(_0x5e2962[_0x7a64('0x8a')][_0x7a64('0x55')]===_0x7a64('0x99')){return _0x5f0fa9[_0x7a64('0x40')](_0x446a5a)[_0x7a64('0x36')](_0x7a64('0xbd'),_0x7a64('0xbe'))[_0x7a64('0x86')](_0x7a64('0xbf'));}else{return _0x5f0fa9[_0x7a64('0x40')](_0x446a5a)[_0x7a64('0x31')](_0xe8b459);}}});})[_0x7a64('0x2e')](handleError(_0x5f0fa9,null));};exports[_0x7a64('0x86')]=function(_0x105f6d,_0x1d5e3a,_0x4cd2d8){var _0x3eda6a,_0x28be42,_0x5cd71f;if(_[_0x7a64('0xa2')](_0x105f6d[_0x7a64('0x5e')][_0x7a64('0x5e')])||_0x105f6d['body'][_0x7a64('0x5e')]===''){throw new db['Sequelize'][(_0x7a64('0x92'))](_0x7a64('0xa4'));}if(_[_0x7a64('0xa2')](_0x105f6d['body']['to'])){throw new db[(_0x7a64('0x91'))][(_0x7a64('0x92'))]('to\x20is\x20mandatory');}_0x3eda6a=_0x105f6d[_0x7a64('0x5e')]['to'];return db['WhatsappAccount']['find']({'where':{'id':_0x105f6d[_0x7a64('0x5a')]['id']},'include':[{'model':db[_0x7a64('0xc0')],'as':_0x7a64('0xc1'),'include':[{'model':db[_0x7a64('0xa9')],'as':_0x7a64('0xab'),'where':{'mobile':_0x3eda6a},'limit':0x1,'order':[[_0x7a64('0x95'),'DESC']]}]}]})[_0x7a64('0x25')](handleEntityNotFound(_0x1d5e3a,null))[_0x7a64('0x25')](function(_0x56d0b5){if(_0x56d0b5&&_0x56d0b5['List']){_0x28be42=_0x56d0b5[_0x7a64('0x3d')]({'plain':!![]});if(_0x28be42[_0x7a64('0xc1')]&&_0x28be42[_0x7a64('0xc1')][_0x7a64('0xab')][_0x7a64('0x4e')]){return _0x28be42['List'][_0x7a64('0xab')][0x0];}return db[_0x7a64('0xa9')][_0x7a64('0x5d')](_[_0x7a64('0x1f')](_0x105f6d['body'],{'firstName':_0x3eda6a,'mobile':_0x3eda6a,'phone':_0x3eda6a,'ListId':_0x28be42[_0x7a64('0x97')]}));}})['then'](handleEntityNotFound(_0x1d5e3a,null))[_0x7a64('0x25')](function(_0x1d04e7){if(_0x1d04e7){_0x5cd71f=_0x1d04e7;return db[_0x7a64('0xac')][_0x7a64('0x5c')]({'where':{'ContactId':_0x5cd71f['id'],'closed':![],'WhatsappAccountId':_0x28be42['id']}})['then'](function(_0x196396){if(_0x196396){return[_0x196396,![]];}return db[_0x7a64('0xac')][_0x7a64('0x5d')]({'UserId':_0x105f6d[_0x7a64('0x60')]['id'],'ContactId':_0x5cd71f['id'],'WhatsappAccountId':_0x28be42['id'],'phone':_0x3eda6a,'firstMsgDirection':_0x7a64('0xc2'),'Messages':[_[_0x7a64('0x54')](_0x105f6d[_0x7a64('0x5e')],{'read':![],'body':_0x105f6d[_0x7a64('0x5e')][_0x7a64('0x5e')],'phone':_0x3eda6a,'WhatsappAccountId':_0x28be42['id'],'UserId':_0x105f6d[_0x7a64('0x60')]['id'],'ContactId':_0x5cd71f['id']})]},{'include':[{'model':db[_0x7a64('0x8c')],'as':_0x7a64('0xc3')}]})[_0x7a64('0x25')](function(_0x3dfdc6){return[_0x3dfdc6,!![]];});});}})['spread'](function(_0x290015,_0x4e9e92){if(_0x4e9e92){return _0x290015;}return db[_0x7a64('0x8c')][_0x7a64('0x5d')](_[_0x7a64('0x54')](_0x105f6d[_0x7a64('0x5e')],{'read':![],'body':_0x105f6d['body'][_0x7a64('0x5e')],'phone':_0x3eda6a,'WhatsappAccountId':_0x28be42['id'],'WhatsappInteractionId':_0x290015['id'],'UserId':_0x105f6d['user']['id'],'ContactId':_0x5cd71f['id']}))[_0x7a64('0x25')](function(_0x4e4a46){_0x290015[_0x7a64('0xc4')][_0x7a64('0xc3')]=[];_0x290015[_0x7a64('0xc4')]['Messages'][_0x7a64('0xb0')](_0x4e4a46['dataValues']);return _0x290015;});})[_0x7a64('0x25')](respondWithResult(_0x1d5e3a,null))[_0x7a64('0x2e')](handleError(_0x1d5e3a,null));}; \ No newline at end of file +var _0xb4f5=['mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','applications','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','push','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','client','http','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','offset','limit','count','set','apply','save','update','get','WhatsappAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','WhatsappAccount','fieldName','type','key','map','query','keys','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows','show','params','rawAttributes','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','WhatsappAccountId','getDispositions','Disposition','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','ids','addAgents','omit','spread','emit','userWhatsappAccount:save','isArray','userWhatsappAccount:remove','getAgents','User','transaction','sequelize','Transaction','READ_COMMITTED','WhatsappApplication','bulkCreate','finally','json','getApplications','notify','whatsapp','account','sinch','statuses','state','read','WhatsappMessage','timestamp','orderBy','Applications','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','replace','whatsapp:','Body','messageId','MessageSid','from','notifications','message_id','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty'];(function(_0x26562b,_0x3d8d6e){var _0x205c45=function(_0x138933){while(--_0x138933){_0x26562b['push'](_0x26562b['shift']());}};_0x205c45(++_0x3d8d6e);}(_0xb4f5,0x1aa));var _0x5b4f=function(_0x3b9382,_0x32d102){_0x3b9382=_0x3b9382-0x0;var _0x303c10=_0xb4f5[_0x3b9382];return _0x303c10;};'use strict';var emlformat=require(_0x5b4f('0x0'));var rimraf=require(_0x5b4f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5b4f('0x2'));var rp=require(_0x5b4f('0x3'));var moment=require(_0x5b4f('0x4'));var BPromise=require(_0x5b4f('0x5'));var Mustache=require('mustache');var util=require(_0x5b4f('0x6'));var path=require(_0x5b4f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5b4f('0x8'));var _=require(_0x5b4f('0x9'));var squel=require(_0x5b4f('0xa'));var crypto=require(_0x5b4f('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5b4f('0xc'));var Papa=require(_0x5b4f('0xd'));var Redis=require(_0x5b4f('0xe'));var authService=require(_0x5b4f('0xf'));var qs=require(_0x5b4f('0x10'));var as=require(_0x5b4f('0x11'));var hardwareService=require(_0x5b4f('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x5b4f('0x13'));var config=require(_0x5b4f('0x14'));var licenseUtil=require(_0x5b4f('0x15'));var db=require(_0x5b4f('0x16'))['db'];config[_0x5b4f('0x17')]=_[_0x5b4f('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5b4f('0x19'))(new Redis(config[_0x5b4f('0x17')]));require(_0x5b4f('0x1a'))[_0x5b4f('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x5b4f('0x1c')][_0x5b4f('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x1d9f81,_0x3c49a2,_0x2f6315,_0x10b665){return new BPromise(function(_0x39cd90,_0x114d8f){var _0x40eb83=_0x10b665||client;return _0x40eb83['request'](_0x1d9f81,_0x2f6315)[_0x5b4f('0x1e')](function(_0x58136c){logger[_0x5b4f('0x1f')](_0x5b4f('0x20'),_0x3c49a2,_0x5b4f('0x21'));logger[_0x5b4f('0x22')](_0x5b4f('0x23'),_0x3c49a2,_0x5b4f('0x21'),JSON[_0x5b4f('0x24')](_0x58136c));if(_0x58136c[_0x5b4f('0x25')]){if(_0x58136c[_0x5b4f('0x25')]['code']===0x1f4){logger[_0x5b4f('0x25')](_0x5b4f('0x20'),_0x3c49a2,_0x58136c['error'][_0x5b4f('0x26')]);return _0x114d8f(_0x58136c['error'][_0x5b4f('0x26')]);}logger[_0x5b4f('0x25')](_0x5b4f('0x20'),_0x3c49a2,_0x58136c[_0x5b4f('0x25')][_0x5b4f('0x26')]);return _0x39cd90(_0x58136c[_0x5b4f('0x25')][_0x5b4f('0x26')]);}else{logger[_0x5b4f('0x1f')](_0x5b4f('0x20'),_0x3c49a2,_0x5b4f('0x21'));_0x39cd90(_0x58136c[_0x5b4f('0x27')][_0x5b4f('0x26')]);}})[_0x5b4f('0x28')](function(_0x52f8e0){logger[_0x5b4f('0x25')](_0x5b4f('0x20'),_0x3c49a2,_0x52f8e0);_0x114d8f(_0x52f8e0);});});}function respondWithStatusCode(_0x5b61a3,_0x3fe315){_0x3fe315=_0x3fe315||0xcc;return function(_0x4f7cda){if(_0x4f7cda){return _0x5b61a3[_0x5b4f('0x29')](_0x3fe315);}return _0x5b61a3[_0x5b4f('0x2a')](_0x3fe315)[_0x5b4f('0x2b')]();};}function respondWithResult(_0x1d8ab,_0x1a946c){_0x1a946c=_0x1a946c||0xc8;return function(_0x483909){if(_0x483909){return _0x1d8ab[_0x5b4f('0x2a')](_0x1a946c)['json'](_0x483909);}};}function respondWithFilteredResult(_0x3d5819,_0x1734af){return function(_0x4eef55){if(_0x4eef55){var _0x28cfd3=typeof _0x1734af[_0x5b4f('0x2c')]==='undefined'&&typeof _0x1734af[_0x5b4f('0x2d')]==='undefined';var _0x4ea288=_0x4eef55[_0x5b4f('0x2e')];var _0x53c7b6=_0x28cfd3?0x0:_0x1734af['offset'];var _0x3b7bd2=_0x28cfd3?_0x4eef55['count']:_0x1734af['offset']+_0x1734af['limit'];var _0x1b33f2;if(_0x3b7bd2>=_0x4ea288){_0x3b7bd2=_0x4ea288;_0x1b33f2=0xc8;}else{_0x1b33f2=0xce;}_0x3d5819['status'](_0x1b33f2);return _0x3d5819[_0x5b4f('0x2f')]('Content-Range',_0x53c7b6+'-'+_0x3b7bd2+'/'+_0x4ea288)['json'](_0x4eef55);}return null;};}function patchUpdates(_0x4c7c13){return function(_0x41241c){try{jsonpatch[_0x5b4f('0x30')](_0x41241c,_0x4c7c13,!![]);}catch(_0x51bf6d){return BPromise['reject'](_0x51bf6d);}return _0x41241c[_0x5b4f('0x31')]();};}function saveUpdates(_0x5a05b3,_0xf23c87){return function(_0x280eae){if(_0x280eae){return _0x280eae[_0x5b4f('0x32')](_0x5a05b3)[_0x5b4f('0x1e')](function(_0xfbdc11){return _0xfbdc11;});}return null;};}function removeEntity(_0x54851c,_0x9a2be9){return function(_0x59f334){if(_0x59f334){return _0x59f334['destroy']()['then'](function(){var _0x58eaa9=_0x59f334[_0x5b4f('0x33')]({'plain':!![]});var _0x3ce0c0=_0x5b4f('0x34');return db[_0x5b4f('0x35')]['destroy']({'where':{'type':_0x3ce0c0,'resourceId':_0x58eaa9['id']}})[_0x5b4f('0x1e')](function(){return _0x59f334;});})[_0x5b4f('0x1e')](function(){_0x54851c[_0x5b4f('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ac3ee,_0x307c97){return function(_0x5019d2){if(!_0x5019d2){_0x2ac3ee[_0x5b4f('0x29')](0x194);}return _0x5019d2;};}function handleError(_0x15053e,_0x530bdb){_0x530bdb=_0x530bdb||0x1f4;return function(_0x14b619){logger['error'](_0x14b619['stack']);if(_0x14b619['name']){delete _0x14b619[_0x5b4f('0x36')];}_0x15053e[_0x5b4f('0x2a')](_0x530bdb)[_0x5b4f('0x37')](_0x14b619);};}exports[_0x5b4f('0x38')]=function(_0x1995d4,_0x555ba0){var _0x4409b5={'include':[{'model':db[_0x5b4f('0x39')],'as':_0x5b4f('0x3a')}]},_0x4acc76={},_0x14b9ff={'count':0x0,'rows':[]};var _0x140d58=_['map'](db[_0x5b4f('0x3b')]['rawAttributes'],function(_0x1d4529){return{'name':_0x1d4529[_0x5b4f('0x3c')],'type':_0x1d4529[_0x5b4f('0x3d')][_0x5b4f('0x3e')]};});_0x4acc76['model']=_[_0x5b4f('0x3f')](_0x140d58,_0x5b4f('0x36'));_0x4acc76[_0x5b4f('0x40')]=_[_0x5b4f('0x41')](_0x1995d4[_0x5b4f('0x40')]);_0x4acc76['filters']=_['intersection'](_0x4acc76[_0x5b4f('0x42')],_0x4acc76['query']);_0x4409b5[_0x5b4f('0x43')]=_[_0x5b4f('0x44')](_0x4acc76['model'],qs[_0x5b4f('0x45')](_0x1995d4['query']['fields']));_0x4409b5[_0x5b4f('0x43')]=_0x4409b5[_0x5b4f('0x43')]['length']?_0x4409b5['attributes']:_0x4acc76['model'];if(!_0x1995d4[_0x5b4f('0x40')][_0x5b4f('0x46')](_0x5b4f('0x47'))){_0x4409b5[_0x5b4f('0x2d')]=qs[_0x5b4f('0x2d')](_0x1995d4[_0x5b4f('0x40')]['limit']);_0x4409b5[_0x5b4f('0x2c')]=qs[_0x5b4f('0x2c')](_0x1995d4[_0x5b4f('0x40')][_0x5b4f('0x2c')]);}_0x4409b5[_0x5b4f('0x48')]=qs['sort'](_0x1995d4[_0x5b4f('0x40')][_0x5b4f('0x49')]);_0x4409b5[_0x5b4f('0x4a')]=qs[_0x5b4f('0x4b')](_[_0x5b4f('0x4c')](_0x1995d4[_0x5b4f('0x40')],_0x4acc76[_0x5b4f('0x4b')]),_0x140d58);if(_0x1995d4[_0x5b4f('0x40')][_0x5b4f('0x4d')]){_0x4409b5['where']=_['merge'](_0x4409b5[_0x5b4f('0x4a')],{'$or':_['map'](_0x140d58,function(_0x31f4e6){if(_0x31f4e6[_0x5b4f('0x3d')]!=='VIRTUAL'){var _0x8b5692={};_0x8b5692[_0x31f4e6[_0x5b4f('0x36')]]={'$like':'%'+_0x1995d4[_0x5b4f('0x40')][_0x5b4f('0x4d')]+'%'};return _0x8b5692;}})});}_0x4409b5=_[_0x5b4f('0x4e')]({},_0x4409b5,_0x1995d4[_0x5b4f('0x4f')]);var _0x364532={'where':_0x4409b5[_0x5b4f('0x4a')]};return db[_0x5b4f('0x3b')][_0x5b4f('0x2e')](_0x364532)[_0x5b4f('0x1e')](function(_0x86f94f){_0x14b9ff[_0x5b4f('0x2e')]=_0x86f94f;if(_0x1995d4[_0x5b4f('0x40')][_0x5b4f('0x50')]){_0x4409b5['include']=[{'all':!![]}];}return db[_0x5b4f('0x3b')][_0x5b4f('0x51')](_0x4409b5);})[_0x5b4f('0x1e')](function(_0x170f99){_0x14b9ff[_0x5b4f('0x52')]=_0x170f99;return _0x14b9ff;})['then'](respondWithFilteredResult(_0x555ba0,_0x4409b5))[_0x5b4f('0x28')](handleError(_0x555ba0,null));};exports[_0x5b4f('0x53')]=function(_0x3db108,_0x3635f1){var _0x87072a={'raw':![],'where':{'id':_0x3db108[_0x5b4f('0x54')]['id']},'include':[{'model':db[_0x5b4f('0x39')],'as':_0x5b4f('0x3a')}]},_0xd50a41={};_0xd50a41[_0x5b4f('0x42')]=_[_0x5b4f('0x41')](db[_0x5b4f('0x3b')][_0x5b4f('0x55')]);_0xd50a41['query']=_['keys'](_0x3db108['query']);_0xd50a41['filters']=_[_0x5b4f('0x44')](_0xd50a41[_0x5b4f('0x42')],_0xd50a41['query']);_0x87072a[_0x5b4f('0x43')]=_[_0x5b4f('0x44')](_0xd50a41[_0x5b4f('0x42')],qs[_0x5b4f('0x45')](_0x3db108[_0x5b4f('0x40')]['fields']));_0x87072a['attributes']=_0x87072a[_0x5b4f('0x43')][_0x5b4f('0x56')]?_0x87072a[_0x5b4f('0x43')]:_0xd50a41[_0x5b4f('0x42')];if(_0x3db108[_0x5b4f('0x40')][_0x5b4f('0x50')]){_0x87072a[_0x5b4f('0x57')]=[{'all':!![]}];}_0x87072a=_[_0x5b4f('0x4e')]({},_0x87072a,_0x3db108[_0x5b4f('0x4f')]);return db[_0x5b4f('0x3b')][_0x5b4f('0x58')](_0x87072a)[_0x5b4f('0x1e')](handleEntityNotFound(_0x3635f1,null))[_0x5b4f('0x1e')](respondWithResult(_0x3635f1,null))['catch'](handleError(_0x3635f1,null));};exports['create']=function(_0x1bc7f8,_0x5ca724){return db['WhatsappAccount'][_0x5b4f('0x59')](_0x1bc7f8[_0x5b4f('0x5a')],{})['then'](function(_0x3aa889){var _0x4e3e8e=_0x1bc7f8[_0x5b4f('0x5b')][_0x5b4f('0x33')]({'plain':!![]});if(!_0x4e3e8e)throw new Error(_0x5b4f('0x5c'));if(_0x4e3e8e[_0x5b4f('0x5d')]==='user'){var _0x79be8d=_0x3aa889[_0x5b4f('0x33')]({'plain':!![]});var _0x9cf419='WhatsappAccounts';return db[_0x5b4f('0x5e')][_0x5b4f('0x58')]({'where':{'name':_0x9cf419,'userProfileId':_0x4e3e8e[_0x5b4f('0x5f')]},'raw':!![]})[_0x5b4f('0x1e')](function(_0x853f32){if(_0x853f32&&_0x853f32['autoAssociation']===0x0){return db[_0x5b4f('0x35')]['create']({'name':_0x79be8d[_0x5b4f('0x36')],'resourceId':_0x79be8d['id'],'type':_0x853f32[_0x5b4f('0x36')],'sectionId':_0x853f32['id']},{})[_0x5b4f('0x1e')](function(){return _0x3aa889;});}else{return _0x3aa889;}})[_0x5b4f('0x28')](function(_0x55bc02){logger[_0x5b4f('0x25')](_0x5b4f('0x60'),_0x55bc02);throw _0x55bc02;});}return _0x3aa889;})[_0x5b4f('0x1e')](respondWithResult(_0x5ca724,0xc9))[_0x5b4f('0x28')](handleError(_0x5ca724,null));};exports[_0x5b4f('0x32')]=function(_0x279e14,_0x476654){if(_0x279e14[_0x5b4f('0x5a')]['id']){delete _0x279e14[_0x5b4f('0x5a')]['id'];}return db[_0x5b4f('0x3b')][_0x5b4f('0x58')]({'where':{'id':_0x279e14['params']['id']},'include':[{'model':db[_0x5b4f('0x39')],'as':_0x5b4f('0x3a')}]})[_0x5b4f('0x1e')](handleEntityNotFound(_0x476654,null))[_0x5b4f('0x1e')](saveUpdates(_0x279e14[_0x5b4f('0x5a')],null))['then'](respondWithResult(_0x476654,null))[_0x5b4f('0x28')](handleError(_0x476654,null));};exports[_0x5b4f('0x61')]=function(_0x1c3fa3,_0x2ff4f3){return db[_0x5b4f('0x3b')]['find']({'where':{'id':_0x1c3fa3[_0x5b4f('0x54')]['id']}})['then'](handleEntityNotFound(_0x2ff4f3,null))[_0x5b4f('0x1e')](removeEntity(_0x2ff4f3,null))[_0x5b4f('0x28')](handleError(_0x2ff4f3,null));};exports['describe']=function(_0x3b57b8,_0x3ebc6d){return db['WhatsappAccount'][_0x5b4f('0x62')]()['then'](respondWithResult(_0x3ebc6d,null))[_0x5b4f('0x28')](handleError(_0x3ebc6d,null));};exports['addDisposition']=function(_0x5236b3,_0x1879a5,_0x3ff4fb){if(_0x5236b3['body']['id']){delete _0x5236b3[_0x5b4f('0x5a')]['id'];}return db[_0x5b4f('0x3b')]['find']({'where':{'id':_0x5236b3[_0x5b4f('0x54')]['id']}})[_0x5b4f('0x1e')](handleEntityNotFound(_0x1879a5,null))[_0x5b4f('0x1e')](function(_0x2cca15){if(_0x2cca15){_0x5236b3[_0x5b4f('0x5a')][_0x5b4f('0x63')]=_0x2cca15['id'];return db['Disposition'][_0x5b4f('0x59')](_0x5236b3[_0x5b4f('0x5a')]);}})[_0x5b4f('0x1e')](respondWithResult(_0x1879a5,null))['catch'](handleError(_0x1879a5,null));};exports[_0x5b4f('0x64')]=function(_0x3cb4ce,_0x40067a,_0x37d76b){var _0x1cd934={'raw':![],'where':{}};var _0x321c1b={};var _0x2fd811={'count':0x0,'rows':[]};return db[_0x5b4f('0x3b')]['findOne']({'where':{'id':_0x3cb4ce[_0x5b4f('0x54')]['id']}})[_0x5b4f('0x1e')](handleEntityNotFound(_0x40067a,null))[_0x5b4f('0x1e')](function(_0x49d03e){if(_0x49d03e){_0x321c1b[_0x5b4f('0x42')]=_[_0x5b4f('0x41')](db[_0x5b4f('0x65')][_0x5b4f('0x55')]);_0x321c1b['query']=_['keys'](_0x3cb4ce[_0x5b4f('0x40')]);_0x321c1b['filters']=_[_0x5b4f('0x44')](_0x321c1b[_0x5b4f('0x42')],_0x321c1b[_0x5b4f('0x40')]);_0x1cd934[_0x5b4f('0x43')]=_[_0x5b4f('0x44')](_0x321c1b[_0x5b4f('0x42')],qs['fields'](_0x3cb4ce[_0x5b4f('0x40')][_0x5b4f('0x45')]));_0x1cd934[_0x5b4f('0x43')]=_0x1cd934[_0x5b4f('0x43')][_0x5b4f('0x56')]?_0x1cd934[_0x5b4f('0x43')]:_0x321c1b['model'];if(!_0x3cb4ce['query'][_0x5b4f('0x46')](_0x5b4f('0x47'))){_0x1cd934[_0x5b4f('0x2d')]=qs[_0x5b4f('0x2d')](_0x3cb4ce[_0x5b4f('0x40')][_0x5b4f('0x2d')]);_0x1cd934[_0x5b4f('0x2c')]=qs[_0x5b4f('0x2c')](_0x3cb4ce[_0x5b4f('0x40')]['offset']);}_0x1cd934['order']=qs[_0x5b4f('0x49')](_0x3cb4ce['query']['sort']);_0x1cd934['where']=qs[_0x5b4f('0x4b')](_[_0x5b4f('0x4c')](_0x3cb4ce['query'],_0x321c1b[_0x5b4f('0x4b')]));_0x1cd934[_0x5b4f('0x4a')][_0x5b4f('0x63')]=_0x49d03e['id'];if(_0x3cb4ce[_0x5b4f('0x40')]['filter']){_0x1cd934[_0x5b4f('0x4a')]=_[_0x5b4f('0x4e')](_0x1cd934[_0x5b4f('0x4a')],{'$or':_[_0x5b4f('0x3f')](_0x1cd934[_0x5b4f('0x43')],function(_0x48fa4f){var _0x4bbae6={};_0x4bbae6[_0x48fa4f]={'$like':'%'+_0x3cb4ce[_0x5b4f('0x40')][_0x5b4f('0x4d')]+'%'};return _0x4bbae6;})});}_0x1cd934=_[_0x5b4f('0x4e')]({},_0x1cd934,_0x3cb4ce['options']);return db['Disposition'][_0x5b4f('0x2e')]({'where':_0x1cd934[_0x5b4f('0x4a')]})[_0x5b4f('0x1e')](function(_0x18f869){_0x2fd811[_0x5b4f('0x2e')]=_0x18f869;if(_0x3cb4ce['query']['includeAll']){_0x1cd934[_0x5b4f('0x57')]=[{'all':!![]}];}return db['Disposition'][_0x5b4f('0x51')](_0x1cd934);})['then'](function(_0x87036a){_0x2fd811[_0x5b4f('0x52')]=_0x87036a;return _0x2fd811;});}})[_0x5b4f('0x1e')](respondWithFilteredResult(_0x40067a,_0x1cd934))[_0x5b4f('0x28')](handleError(_0x40067a,null));};exports[_0x5b4f('0x66')]=function(_0x44b647,_0x1cae94,_0x56cfdc){return db['WhatsappAccount'][_0x5b4f('0x58')]({'where':{'id':_0x44b647['params']['id']}})['then'](handleEntityNotFound(_0x1cae94,null))[_0x5b4f('0x1e')](function(_0x3eb737){if(_0x3eb737){return _0x3eb737[_0x5b4f('0x66')](_0x44b647[_0x5b4f('0x40')]['ids']);}})[_0x5b4f('0x1e')](respondWithStatusCode(_0x1cae94,null))[_0x5b4f('0x28')](handleError(_0x1cae94,null));};exports[_0x5b4f('0x67')]=function(_0x5b0812,_0x42e536,_0x2e97b4){if(_0x5b0812[_0x5b4f('0x5a')]['id']){delete _0x5b0812[_0x5b4f('0x5a')]['id'];}return db[_0x5b4f('0x3b')][_0x5b4f('0x58')]({'where':{'id':_0x5b0812[_0x5b4f('0x54')]['id']}})[_0x5b4f('0x1e')](handleEntityNotFound(_0x42e536,null))[_0x5b4f('0x1e')](function(_0x53b702){if(_0x53b702){_0x5b0812[_0x5b4f('0x5a')][_0x5b4f('0x63')]=_0x53b702['id'];return db[_0x5b4f('0x68')][_0x5b4f('0x59')](_0x5b0812[_0x5b4f('0x5a')]);}})[_0x5b4f('0x1e')](respondWithResult(_0x42e536,null))[_0x5b4f('0x28')](handleError(_0x42e536,null));};exports[_0x5b4f('0x69')]=function(_0x4f00ee,_0x8b7e77,_0xa944ae){var _0x5bbe4a={'raw':![],'where':{}};var _0x1195c3={};var _0x26bf82={'count':0x0,'rows':[]};return db[_0x5b4f('0x3b')][_0x5b4f('0x6a')]({'where':{'id':_0x4f00ee[_0x5b4f('0x54')]['id']}})[_0x5b4f('0x1e')](handleEntityNotFound(_0x8b7e77,null))[_0x5b4f('0x1e')](function(_0x59858e){if(_0x59858e){_0x1195c3[_0x5b4f('0x42')]=_[_0x5b4f('0x41')](db[_0x5b4f('0x68')][_0x5b4f('0x55')]);_0x1195c3['query']=_['keys'](_0x4f00ee['query']);_0x1195c3[_0x5b4f('0x4b')]=_['intersection'](_0x1195c3[_0x5b4f('0x42')],_0x1195c3[_0x5b4f('0x40')]);_0x5bbe4a[_0x5b4f('0x43')]=_['intersection'](_0x1195c3[_0x5b4f('0x42')],qs[_0x5b4f('0x45')](_0x4f00ee[_0x5b4f('0x40')]['fields']));_0x5bbe4a[_0x5b4f('0x43')]=_0x5bbe4a[_0x5b4f('0x43')][_0x5b4f('0x56')]?_0x5bbe4a['attributes']:_0x1195c3[_0x5b4f('0x42')];if(!_0x4f00ee[_0x5b4f('0x40')][_0x5b4f('0x46')](_0x5b4f('0x47'))){_0x5bbe4a['limit']=qs['limit'](_0x4f00ee[_0x5b4f('0x40')]['limit']);_0x5bbe4a[_0x5b4f('0x2c')]=qs['offset'](_0x4f00ee[_0x5b4f('0x40')]['offset']);}_0x5bbe4a[_0x5b4f('0x48')]=qs[_0x5b4f('0x49')](_0x4f00ee[_0x5b4f('0x40')][_0x5b4f('0x49')]);_0x5bbe4a[_0x5b4f('0x4a')]=qs[_0x5b4f('0x4b')](_[_0x5b4f('0x4c')](_0x4f00ee['query'],_0x1195c3[_0x5b4f('0x4b')]));_0x5bbe4a['where'][_0x5b4f('0x63')]=_0x59858e['id'];if(_0x4f00ee['query'][_0x5b4f('0x4d')]){_0x5bbe4a[_0x5b4f('0x4a')]=_[_0x5b4f('0x4e')](_0x5bbe4a[_0x5b4f('0x4a')],{'$or':_[_0x5b4f('0x3f')](_0x5bbe4a[_0x5b4f('0x43')],function(_0xb84c94){var _0x578d60={};_0x578d60[_0xb84c94]={'$like':'%'+_0x4f00ee[_0x5b4f('0x40')][_0x5b4f('0x4d')]+'%'};return _0x578d60;})});}_0x5bbe4a=_[_0x5b4f('0x4e')]({},_0x5bbe4a,_0x4f00ee[_0x5b4f('0x4f')]);return db[_0x5b4f('0x68')][_0x5b4f('0x2e')]({'where':_0x5bbe4a['where']})[_0x5b4f('0x1e')](function(_0x2d5c22){_0x26bf82[_0x5b4f('0x2e')]=_0x2d5c22;if(_0x4f00ee[_0x5b4f('0x40')][_0x5b4f('0x50')]){_0x5bbe4a[_0x5b4f('0x57')]=[{'all':!![]}];}return db[_0x5b4f('0x68')][_0x5b4f('0x51')](_0x5bbe4a);})[_0x5b4f('0x1e')](function(_0x241689){_0x26bf82[_0x5b4f('0x52')]=_0x241689;return _0x26bf82;});}})[_0x5b4f('0x1e')](respondWithFilteredResult(_0x8b7e77,_0x5bbe4a))[_0x5b4f('0x28')](handleError(_0x8b7e77,null));};exports['removeAnswers']=function(_0x37e784,_0x573d51,_0x3ed635){return db[_0x5b4f('0x3b')][_0x5b4f('0x58')]({'where':{'id':_0x37e784[_0x5b4f('0x54')]['id']}})['then'](handleEntityNotFound(_0x573d51,null))[_0x5b4f('0x1e')](function(_0x35e5b7){if(_0x35e5b7){return _0x35e5b7[_0x5b4f('0x6b')](_0x37e784[_0x5b4f('0x40')][_0x5b4f('0x6c')]);}})[_0x5b4f('0x1e')](respondWithStatusCode(_0x573d51,null))[_0x5b4f('0x28')](handleError(_0x573d51,null));};exports['addAgents']=function(_0x5cf50d,_0x172921,_0x172f53){return db[_0x5b4f('0x3b')][_0x5b4f('0x58')]({'where':{'id':_0x5cf50d['params']['id']}})[_0x5b4f('0x1e')](handleEntityNotFound(_0x172921,null))[_0x5b4f('0x1e')](function(_0x2a0781){if(_0x2a0781){return _0x2a0781[_0x5b4f('0x6d')](_0x5cf50d[_0x5b4f('0x5a')]['ids'],_[_0x5b4f('0x6e')](_0x5cf50d['body'],['ids','id'])||{})[_0x5b4f('0x6f')](function(_0x590724){for(var _0x3571ae=0x0;_0x3571ae<_0x5cf50d[_0x5b4f('0x5a')][_0x5b4f('0x6c')][_0x5b4f('0x56')];_0x3571ae+=0x1){socket[_0x5b4f('0x70')](_0x5b4f('0x71'),{'UserId':Number(_0x5cf50d[_0x5b4f('0x5a')][_0x5b4f('0x6c')][_0x3571ae]),'WhatsappAccountId':Number(_0x5cf50d[_0x5b4f('0x54')]['id'])});}return _0x590724;});}})['then'](respondWithResult(_0x172921,null))[_0x5b4f('0x28')](handleError(_0x172921,null));};exports['removeAgents']=function(_0x41012c,_0x427283,_0x5c1f25){return db[_0x5b4f('0x3b')]['find']({'where':{'id':_0x41012c[_0x5b4f('0x54')]['id']}})['then'](handleEntityNotFound(_0x427283,null))[_0x5b4f('0x1e')](function(_0x195d82){if(_0x195d82){return _0x195d82['removeAgents'](_0x41012c[_0x5b4f('0x40')][_0x5b4f('0x6c')])[_0x5b4f('0x1e')](function(){if(_[_0x5b4f('0x72')](_0x41012c[_0x5b4f('0x40')][_0x5b4f('0x6c')])){for(var _0x222434=0x0;_0x222434<_0x41012c[_0x5b4f('0x40')][_0x5b4f('0x6c')][_0x5b4f('0x56')];_0x222434+=0x1){socket[_0x5b4f('0x70')](_0x5b4f('0x73'),{'UserId':Number(_0x41012c[_0x5b4f('0x40')][_0x5b4f('0x6c')][_0x222434]),'WhatsappAccountId':Number(_0x41012c[_0x5b4f('0x54')]['id'])});}}else{socket[_0x5b4f('0x70')](_0x5b4f('0x73'),{'UserId':Number(_0x41012c['query'][_0x5b4f('0x6c')]),'WhatsappAccountId':Number(_0x41012c[_0x5b4f('0x54')]['id'])});}});}})[_0x5b4f('0x1e')](respondWithStatusCode(_0x427283,null))['catch'](handleError(_0x427283,null));};exports[_0x5b4f('0x74')]=function(_0x526532,_0x481fe2,_0x535d3c){var _0x8ead7c={};var _0x5238f3={};var _0x522cfe;var _0x18140b;return db[_0x5b4f('0x3b')][_0x5b4f('0x6a')]({'where':{'id':_0x526532[_0x5b4f('0x54')]['id']}})[_0x5b4f('0x1e')](handleEntityNotFound(_0x481fe2,null))[_0x5b4f('0x1e')](function(_0x5151bf){if(_0x5151bf){_0x522cfe=_0x5151bf;_0x5238f3[_0x5b4f('0x42')]=_['keys'](db[_0x5b4f('0x75')][_0x5b4f('0x55')]);_0x5238f3[_0x5b4f('0x40')]=_[_0x5b4f('0x41')](_0x526532[_0x5b4f('0x40')]);_0x5238f3['filters']=_[_0x5b4f('0x44')](_0x5238f3[_0x5b4f('0x42')],_0x5238f3[_0x5b4f('0x40')]);_0x8ead7c[_0x5b4f('0x43')]=_[_0x5b4f('0x44')](_0x5238f3[_0x5b4f('0x42')],qs[_0x5b4f('0x45')](_0x526532['query'][_0x5b4f('0x45')]));_0x8ead7c['attributes']=_0x8ead7c[_0x5b4f('0x43')][_0x5b4f('0x56')]?_0x8ead7c['attributes']:_0x5238f3[_0x5b4f('0x42')];_0x8ead7c[_0x5b4f('0x48')]=qs['sort'](_0x526532['query'][_0x5b4f('0x49')]);_0x8ead7c[_0x5b4f('0x4a')]=qs[_0x5b4f('0x4b')](_[_0x5b4f('0x4c')](_0x526532[_0x5b4f('0x40')],_0x5238f3['filters']));if(_0x526532[_0x5b4f('0x40')][_0x5b4f('0x4d')]){_0x8ead7c[_0x5b4f('0x4a')]=_[_0x5b4f('0x4e')](_0x8ead7c['where'],{'$or':_['map'](_0x8ead7c[_0x5b4f('0x43')],function(_0x3cd1ef){var _0x47b4de={};_0x47b4de[_0x3cd1ef]={'$like':'%'+_0x526532['query'][_0x5b4f('0x4d')]+'%'};return _0x47b4de;})});}_0x8ead7c=_[_0x5b4f('0x4e')]({},_0x8ead7c,_0x526532[_0x5b4f('0x4f')]);return _0x522cfe[_0x5b4f('0x74')](_0x8ead7c);}})[_0x5b4f('0x1e')](function(_0xfbdb4f){if(_0xfbdb4f){_0x18140b=_0xfbdb4f['length'];if(!_0x526532[_0x5b4f('0x40')][_0x5b4f('0x46')]('nolimit')){_0x8ead7c[_0x5b4f('0x2d')]=qs[_0x5b4f('0x2d')](_0x526532[_0x5b4f('0x40')]['limit']);_0x8ead7c[_0x5b4f('0x2c')]=qs[_0x5b4f('0x2c')](_0x526532[_0x5b4f('0x40')][_0x5b4f('0x2c')]);}return _0x522cfe['getAgents'](_0x8ead7c);}})['then'](function(_0x597ac6){if(_0x597ac6){return _0x597ac6?{'count':_0x18140b,'rows':_0x597ac6}:null;}})[_0x5b4f('0x1e')](respondWithResult(_0x481fe2,null))[_0x5b4f('0x28')](handleError(_0x481fe2,null));};exports['addApplications']=function(_0x17fe51,_0x1a6c71){var _0xc3c063=_0x17fe51['params']['id'];var _0x3f63d4=_0x17fe51[_0x5b4f('0x5a')];var _0x49983b=0xc8;var _0x223f03=null;return db['sequelize'][_0x5b4f('0x76')]({'isolationLevel':db[_0x5b4f('0x77')][_0x5b4f('0x78')]['ISOLATION_LEVELS'][_0x5b4f('0x79')]},function(_0x1b349d){return db[_0x5b4f('0x3b')][_0x5b4f('0x6a')]({'where':{'id':_0xc3c063},'transaction':_0x1b349d})['then'](function(_0x228d4d){if(_0x228d4d){return db[_0x5b4f('0x7a')][_0x5b4f('0x61')]({'where':{'WhatsappAccountId':_0xc3c063},'transaction':_0x1b349d})[_0x5b4f('0x1e')](function(){var _0x2db474=_['map'](_0x3f63d4,function(_0x315362){_0x315362['WhatsappAccountId']=_0xc3c063;return _0x315362;});return db[_0x5b4f('0x7a')][_0x5b4f('0x7b')](_0x2db474,{'transaction':_0x1b349d});});}else{_0x49983b=0x194;_0x223f03=[];}});})['then'](function(){if(_0x49983b!==0x194){return db[_0x5b4f('0x7a')]['findAndCountAll']({'where':{'WhatsappAccountId':_0xc3c063},'order':'priority'})[_0x5b4f('0x1e')](function(_0x5c2546){_0x223f03=_0x5c2546;});}})[_0x5b4f('0x28')](function(_0x50e533){_0x49983b=0x1f4;logger[_0x5b4f('0x25')](_0x50e533['stack']);if(_0x50e533[_0x5b4f('0x36')]){delete _0x50e533[_0x5b4f('0x36')];}_0x223f03=_0x50e533;})[_0x5b4f('0x7c')](function(){if(_0x223f03===null){_0x1a6c71['sendStatus'](_0x49983b);}else{if(_0x49983b===0x1f4){_0x1a6c71[_0x5b4f('0x2a')](_0x49983b)['send'](_0x223f03);}else{_0x1a6c71[_0x5b4f('0x2a')](_0x49983b)[_0x5b4f('0x7d')](_0x223f03);}}});};exports[_0x5b4f('0x7e')]=function(_0x1f7bbd,_0x541363,_0x27b710){var _0x32079f={};var _0xdf7984={};var _0x43e85f;var _0x312f74;return db[_0x5b4f('0x3b')][_0x5b4f('0x6a')]({'where':{'id':_0x1f7bbd[_0x5b4f('0x54')]['id']}})[_0x5b4f('0x1e')](handleEntityNotFound(_0x541363,null))[_0x5b4f('0x1e')](function(_0xebc124){if(_0xebc124){_0x43e85f=_0xebc124;_0xdf7984[_0x5b4f('0x42')]=_['keys'](db[_0x5b4f('0x7a')][_0x5b4f('0x55')]);_0xdf7984[_0x5b4f('0x40')]=_[_0x5b4f('0x41')](_0x1f7bbd[_0x5b4f('0x40')]);_0xdf7984[_0x5b4f('0x4b')]=_[_0x5b4f('0x44')](_0xdf7984['model'],_0xdf7984['query']);_0x32079f[_0x5b4f('0x43')]=_[_0x5b4f('0x44')](_0xdf7984[_0x5b4f('0x42')],qs['fields'](_0x1f7bbd['query'][_0x5b4f('0x45')]));_0x32079f[_0x5b4f('0x43')]=_0x32079f[_0x5b4f('0x43')][_0x5b4f('0x56')]?_0x32079f[_0x5b4f('0x43')]:_0xdf7984[_0x5b4f('0x42')];_0x32079f['order']=qs[_0x5b4f('0x49')](_0x1f7bbd['query'][_0x5b4f('0x49')]);_0x32079f[_0x5b4f('0x4a')]=qs[_0x5b4f('0x4b')](_['pick'](_0x1f7bbd[_0x5b4f('0x40')],_0xdf7984[_0x5b4f('0x4b')]));if(_0x1f7bbd[_0x5b4f('0x40')][_0x5b4f('0x4d')]){_0x32079f[_0x5b4f('0x4a')]=_['merge'](_0x32079f[_0x5b4f('0x4a')],{'$or':_[_0x5b4f('0x3f')](_0x32079f[_0x5b4f('0x43')],function(_0x283832){var _0x5af820={};_0x5af820[_0x283832]={'$like':'%'+_0x1f7bbd[_0x5b4f('0x40')]['filter']+'%'};return _0x5af820;})});}_0x32079f=_[_0x5b4f('0x4e')]({},_0x32079f,_0x1f7bbd[_0x5b4f('0x4f')]);return _0x43e85f['getApplications'](_0x32079f);}})[_0x5b4f('0x1e')](function(_0x57f718){if(_0x57f718){_0x312f74=_0x57f718[_0x5b4f('0x56')];if(!_0x1f7bbd[_0x5b4f('0x40')][_0x5b4f('0x46')](_0x5b4f('0x47'))){_0x32079f[_0x5b4f('0x2d')]=qs['limit'](_0x1f7bbd[_0x5b4f('0x40')]['limit']);_0x32079f[_0x5b4f('0x2c')]=qs[_0x5b4f('0x2c')](_0x1f7bbd[_0x5b4f('0x40')][_0x5b4f('0x2c')]);}return _0x43e85f['getApplications'](_0x32079f);}})[_0x5b4f('0x1e')](function(_0x84090b){if(_0x84090b){return _0x84090b?{'count':_0x312f74,'rows':_0x84090b}:null;}})[_0x5b4f('0x1e')](respondWithResult(_0x541363,null))[_0x5b4f('0x28')](handleError(_0x541363,null));};exports[_0x5b4f('0x7f')]=function(_0x495a51,_0x4ffde0,_0x57a696){var _0x5c066f={'channel':_0x5b4f('0x80')};var _0x26c48e=[];var _0x39c563=[];var _0x3af842={};return db[_0x5b4f('0x3b')]['find']({'where':{'id':_0x495a51['params']['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})[_0x5b4f('0x1e')](handleEntityNotFound(_0x4ffde0,null))[_0x5b4f('0x1e')](function(_0x61200){_0x5c066f[_0x5b4f('0x81')]=_0x61200;if(_0x5c066f[_0x5b4f('0x81')]&&_0x5c066f['account'][_0x5b4f('0x3d')]===_0x5b4f('0x82')&&_0x495a51[_0x5b4f('0x5a')][_0x5b4f('0x83')]){if(_0x495a51['body'][_0x5b4f('0x83')]['length']===0x0)return;if(_0x495a51['body'][_0x5b4f('0x83')][0x0][_0x5b4f('0x84')]!==_0x5b4f('0x85'))return;return db[_0x5b4f('0x86')][_0x5b4f('0x32')]({'read':!![],'readAt':_0x495a51[_0x5b4f('0x5a')][_0x5b4f('0x83')][0x0][_0x5b4f('0x87')]},{'where':{'messageId':_0x495a51['body']['statuses'][0x0]['message_id']},'individualHooks':!![]})['then'](function(_0xb211d6){return _0x4ffde0['status'](0xc8)[_0x5b4f('0x7d')](_0xb211d6);});}_0x5c066f['applications']=_[_0x5b4f('0x88')](_0x61200[_0x5b4f('0x89')],[_0x5b4f('0x8a')],[_0x5b4f('0x8b')]);if(_0x5c066f[_0x5b4f('0x81')][_0x5b4f('0x89')]){delete _0x5c066f[_0x5b4f('0x81')]['Applications'];}return db[_0x5b4f('0x8c')][_0x5b4f('0x62')]()[_0x5b4f('0x1e')](function(_0x7025ea){if(!_0x7025ea){throw new db[(_0x5b4f('0x8d'))][(_0x5b4f('0x8e'))](_0x5b4f('0x8f'));}_0x26c48e=_[_0x5b4f('0x90')](_[_0x5b4f('0x41')](_0x7025ea),[_0x5b4f('0x91'),_0x5b4f('0x92')]);_0x39c563=_[_0x5b4f('0x90')](_[_0x5b4f('0x41')](_0x7025ea),[_0x5b4f('0x91'),_0x5b4f('0x92'),_0x5b4f('0x93'),_0x5b4f('0x94')]);_0x5c066f['body']={'mapKey':_0x5b4f('0x95')};if(_0x5c066f[_0x5b4f('0x81')]&&_0x5c066f[_0x5b4f('0x81')][_0x5b4f('0x3d')]===_0x5b4f('0x96')){_0x5c066f[_0x5b4f('0x5a')]['from']=_0x495a51[_0x5b4f('0x5a')][_0x5b4f('0x97')][_0x5b4f('0x98')](_0x5b4f('0x99'),'');_0x5c066f[_0x5b4f('0x5a')][_0x5b4f('0x5a')]=_0x495a51[_0x5b4f('0x5a')][_0x5b4f('0x9a')];_0x5c066f[_0x5b4f('0x5a')][_0x5b4f('0x9b')]=_0x495a51[_0x5b4f('0x5a')][_0x5b4f('0x9c')];}if(_0x5c066f['account']&&_0x5c066f[_0x5b4f('0x81')][_0x5b4f('0x3d')]===_0x5b4f('0x82')){_0x5c066f[_0x5b4f('0x5a')]['from']=_0x495a51['body']['notifications'][0x0][_0x5b4f('0x9d')];_0x5c066f[_0x5b4f('0x5a')][_0x5b4f('0x5a')]=_0x495a51[_0x5b4f('0x5a')][_0x5b4f('0x9e')][0x0][_0x5b4f('0x26')][_0x5b4f('0x5a')];_0x5c066f[_0x5b4f('0x5a')][_0x5b4f('0x9b')]=_0x495a51[_0x5b4f('0x5a')][_0x5b4f('0x9e')][0x0][_0x5b4f('0x9f')];}if(_0x5c066f[_0x5b4f('0x5a')]['id']){delete _0x5c066f['body']['id'];}if(_[_0x5b4f('0xa0')](_0x5c066f[_0x5b4f('0x5a')][_0x5b4f('0x9d')])){throw new db[(_0x5b4f('0x8d'))][(_0x5b4f('0x8e'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x5c066f['body']['body'])||_0x5c066f[_0x5b4f('0x5a')][_0x5b4f('0x5a')]===''){throw new db['Sequelize']['ValidationError'](_0x5b4f('0xa1'));}if(_[_0x5b4f('0xa0')](_0x5c066f[_0x5b4f('0x5a')][_0x5b4f('0xa2')])){throw new db[(_0x5b4f('0x8d'))][(_0x5b4f('0x8e'))](_0x5b4f('0xa3')+_0x39c563);}if(!_['includes'](_0x39c563,_0x5c066f[_0x5b4f('0x5a')][_0x5b4f('0xa2')])){throw new db[(_0x5b4f('0x8d'))][(_0x5b4f('0x8e'))](_0x5b4f('0xa4')+_0x39c563);}_0x3af842[_0x5c066f[_0x5b4f('0x5a')]['mapKey']]=_0x5c066f['body'][_0x5b4f('0x9d')];return db[_0x5b4f('0xa5')]['find']({'where':{'id':_0x5c066f[_0x5b4f('0x81')]['ListId']},'include':[{'model':db[_0x5b4f('0x8c')],'as':_0x5b4f('0xa6'),'where':_0x3af842,'limit':0x1,'order':[[_0x5b4f('0x92'),_0x5b4f('0xa7')]]}]});})[_0x5b4f('0x1e')](handleEntityNotFound(_0x4ffde0,null))[_0x5b4f('0x1e')](function(_0x5f7c8){if(_0x5f7c8){_0x5c066f[_0x5b4f('0xa8')]=_['omit'](_0x5f7c8,[_0x5b4f('0xa6')]);if(_0x5f7c8[_0x5b4f('0xa6')]['length']){return _0x5f7c8[_0x5b4f('0xa6')][0x0];}var _0x979e=_[_0x5b4f('0x18')](_0x5c066f[_0x5b4f('0x5a')],{'firstName':_0x5c066f[_0x5b4f('0x5a')][_0x5b4f('0x9d')],'ListId':_0x5f7c8['id']});_0x979e[_0x5c066f['body'][_0x5b4f('0xa2')]]=_0x5c066f[_0x5b4f('0x5a')][_0x5b4f('0x9d')];return db[_0x5b4f('0x8c')][_0x5b4f('0x59')](_0x979e,{'fields':_0x26c48e,'raw':!![]});}})[_0x5b4f('0x1e')](handleEntityNotFound(_0x4ffde0,null))[_0x5b4f('0x1e')](function(_0x20adff){if(_0x20adff){_0x5c066f[_0x5b4f('0xa9')]=_0x20adff;var _0x394acf={'ContactId':_0x20adff['id'],'phone':_0x5c066f[_0x5b4f('0x5a')]['from'],'WhatsappAccountId':_0x495a51['params']['id']};var _0x8507b={'ContactId':_0x20adff['id'],'WhatsappAccountId':_0x495a51[_0x5b4f('0x54')]['id'],'closed':![]};return db[_0x5b4f('0xaa')][_0x5b4f('0x58')]({'where':_0x8507b})[_0x5b4f('0x1e')](function(_0x5c5007){if(_0x5c5007){return[_0x5c5007,![]];}return db[_0x5b4f('0xaa')]['create'](_0x394acf)['then'](function(_0x1e873c){return[_0x1e873c,!![]];});});}})[_0x5b4f('0x6f')](function(_0x39c944,_0x4f7cba){_0x5c066f[_0x5b4f('0xab')]=_0x39c944[_0x5b4f('0x33')]({'plain':!![]});_0x5c066f[_0x5b4f('0xab')][_0x5b4f('0xac')]=![];if(_0x4f7cba){if(_0x5c066f[_0x5b4f('0x81')][_0x5b4f('0xad')]){_0x5c066f[_0x5b4f('0xae')]['push']({'id':0x0,'priority':_0x5c066f['applications'][_0x5b4f('0x56')]+0x1,'app':'close','appdata':_0x5b4f('0xaf'),'interval':_0x5b4f('0xb0')});}_0x5c066f[_0x5b4f('0xab')][_0x5b4f('0xac')]=!![];}return db[_0x5b4f('0x86')]['create']({'phone':_0x5c066f[_0x5b4f('0x5a')][_0x5b4f('0x9d')],'messageId':_0x5c066f[_0x5b4f('0x5a')][_0x5b4f('0x9b')],'body':_0x5c066f[_0x5b4f('0x5a')][_0x5b4f('0x5a')],'WhatsappAccountId':_0x495a51[_0x5b4f('0x54')]['id'],'WhatsappInteractionId':_0x39c944['id'],'direction':'in','ContactId':_0x39c944['ContactId'],'AttachmentId':_0x5c066f[_0x5b4f('0x5a')][_0x5b4f('0xb1')]});})[_0x5b4f('0x1e')](function(_0x4a289c){_0x5c066f[_0x5b4f('0x26')]=_0x4a289c;if(_0x5c066f[_0x5b4f('0xab')][_0x5b4f('0xb2')]){return db[_0x5b4f('0x75')][_0x5b4f('0x58')]({'attributes':['id','name'],'where':{'id':_0x5c066f[_0x5b4f('0xab')][_0x5b4f('0xb2')]}})[_0x5b4f('0x1e')](function(_0x4fbaae){if(_0x4fbaae){_0x5c066f[_0x5b4f('0xae')][_0x5b4f('0xb3')]({'id':0x0,'priority':0x0,'app':_0x5b4f('0xb4'),'appdata':_0x4fbaae[_0x5b4f('0x36')]+','+(_0x5c066f[_0x5b4f('0x81')][_0x5b4f('0xb5')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x5b4f('0xb6'),_0x5b4f('0xb7'),_0x5c066f);});}return respondWithRpcPromise(_0x5b4f('0xb6'),_0x5b4f('0xb7'),_0x5c066f);})[_0x5b4f('0x1e')](function(_0xe48f44){if(_0xe48f44){var _0x107603=0xc8;var _0x2ee8f7=_0x5b4f('0xb8');logger[_0x5b4f('0x1f')](_0x5b4f('0x23'),_0x2ee8f7,_0x107603,_0x5b4f('0xb9'));logger['debug'](_0x5b4f('0xba'),_0x2ee8f7,_0x107603,_0x5b4f('0xb9'),JSON['stringify'](_0xe48f44));if(_0x5c066f[_0x5b4f('0x81')]['type']===_0x5b4f('0x96')){return _0x4ffde0[_0x5b4f('0x2a')](_0x107603)[_0x5b4f('0x2f')](_0x5b4f('0xbb'),_0x5b4f('0xbc'))[_0x5b4f('0x37')](_0x5b4f('0xbd'));}else{return _0x4ffde0[_0x5b4f('0x2a')](_0x107603)[_0x5b4f('0x7d')](_0xe48f44);}}});})[_0x5b4f('0x28')](handleError(_0x4ffde0,null));};exports[_0x5b4f('0x37')]=function(_0x1339f5,_0x1db70b,_0x57fd56){var _0x335f32,_0x2ec39f,_0x5de663;if(_[_0x5b4f('0xa0')](_0x1339f5[_0x5b4f('0x5a')][_0x5b4f('0x5a')])||_0x1339f5[_0x5b4f('0x5a')][_0x5b4f('0x5a')]===''){throw new db[(_0x5b4f('0x8d'))]['ValidationError'](_0x5b4f('0xa1'));}if(_[_0x5b4f('0xa0')](_0x1339f5[_0x5b4f('0x5a')]['to'])){throw new db['Sequelize']['ValidationError'](_0x5b4f('0xbe'));}_0x335f32=_0x1339f5[_0x5b4f('0x5a')]['to'];return db[_0x5b4f('0x3b')][_0x5b4f('0x58')]({'where':{'id':_0x1339f5['params']['id']},'include':[{'model':db[_0x5b4f('0xa5')],'as':'List','include':[{'model':db[_0x5b4f('0x8c')],'as':_0x5b4f('0xa6'),'where':{'mobile':_0x335f32},'limit':0x1,'order':[[_0x5b4f('0x92'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x1db70b,null))[_0x5b4f('0x1e')](function(_0x480922){if(_0x480922&&_0x480922[_0x5b4f('0xbf')]){_0x2ec39f=_0x480922['get']({'plain':!![]});if(_0x2ec39f[_0x5b4f('0xbf')]&&_0x2ec39f[_0x5b4f('0xbf')][_0x5b4f('0xa6')][_0x5b4f('0x56')]){return _0x2ec39f['List']['Contacts'][0x0];}return db['CmContact'][_0x5b4f('0x59')](_[_0x5b4f('0x18')](_0x1339f5[_0x5b4f('0x5a')],{'firstName':_0x335f32,'mobile':_0x335f32,'phone':_0x335f32,'ListId':_0x2ec39f[_0x5b4f('0x94')]}));}})[_0x5b4f('0x1e')](handleEntityNotFound(_0x1db70b,null))[_0x5b4f('0x1e')](function(_0xd21715){if(_0xd21715){_0x5de663=_0xd21715;return db[_0x5b4f('0xaa')][_0x5b4f('0x58')]({'where':{'ContactId':_0x5de663['id'],'closed':![],'WhatsappAccountId':_0x2ec39f['id']}})[_0x5b4f('0x1e')](function(_0xb20184){if(_0xb20184){return[_0xb20184,![]];}return db[_0x5b4f('0xaa')]['create']({'UserId':_0x1339f5[_0x5b4f('0x5b')]['id'],'ContactId':_0x5de663['id'],'WhatsappAccountId':_0x2ec39f['id'],'phone':_0x335f32,'firstMsgDirection':_0x5b4f('0xc0'),'Messages':[_['merge'](_0x1339f5[_0x5b4f('0x5a')],{'read':![],'body':_0x1339f5[_0x5b4f('0x5a')]['body'],'phone':_0x335f32,'WhatsappAccountId':_0x2ec39f['id'],'UserId':_0x1339f5[_0x5b4f('0x5b')]['id'],'ContactId':_0x5de663['id']})]},{'include':[{'model':db[_0x5b4f('0x86')],'as':_0x5b4f('0xc1')}]})[_0x5b4f('0x1e')](function(_0x5463c1){return[_0x5463c1,!![]];});});}})[_0x5b4f('0x6f')](function(_0x3ae66d,_0x124129){if(_0x124129){return _0x3ae66d;}return db[_0x5b4f('0x86')]['create'](_['merge'](_0x1339f5[_0x5b4f('0x5a')],{'read':![],'body':_0x1339f5[_0x5b4f('0x5a')]['body'],'phone':_0x335f32,'WhatsappAccountId':_0x2ec39f['id'],'WhatsappInteractionId':_0x3ae66d['id'],'UserId':_0x1339f5[_0x5b4f('0x5b')]['id'],'ContactId':_0x5de663['id']}))[_0x5b4f('0x1e')](function(_0x540667){_0x3ae66d['dataValues'][_0x5b4f('0xc1')]=[];_0x3ae66d[_0x5b4f('0xc2')][_0x5b4f('0xc1')][_0x5b4f('0xc3')](_0x540667['dataValues']);return _0x3ae66d;});})[_0x5b4f('0x1e')](respondWithResult(_0x1db70b,null))[_0x5b4f('0x28')](handleError(_0x1db70b,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index c0079cb..66ffb63 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 _0x1522=['exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x3feb3c,_0x4379b5){var _0x33e0c0=function(_0x4910e3){while(--_0x4910e3){_0x3feb3c['push'](_0x3feb3c['shift']());}};_0x33e0c0(++_0x4379b5);}(_0x1522,0x1ba));var _0x2152=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1522[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x2152('0x0'));var WhatsappAccount=require(_0x2152('0x1'))['db'][_0x2152('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x2152('0x3')](0x0);var events={'afterCreate':_0x2152('0x4'),'afterUpdate':_0x2152('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5ad08d){return function(_0xf461af,_0xbfb28e,_0x18bb62){WhatsappAccountEvents[_0x2152('0x6')](_0x5ad08d+':'+_0xf461af['id'],_0xf461af);WhatsappAccountEvents['emit'](_0x5ad08d,_0xf461af);_0x18bb62(null);};}for(var e in events){if(events[_0x2152('0x7')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x2152('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0xc52c=['events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x44da6b,_0x906c7a){var _0x445b66=function(_0x1b960e){while(--_0x1b960e){_0x44da6b['push'](_0x44da6b['shift']());}};_0x445b66(++_0x906c7a);}(_0xc52c,0x78));var _0xcc52=function(_0x294b6,_0x2907ae){_0x294b6=_0x294b6-0x0;var _0x38bb97=_0xc52c[_0x294b6];return _0x38bb97;};'use strict';var EventEmitter=require(_0xcc52('0x0'));var WhatsappAccount=require(_0xcc52('0x1'))['db'][_0xcc52('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xcc52('0x3')](0x0);var events={'afterCreate':_0xcc52('0x4'),'afterUpdate':_0xcc52('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4849a5){return function(_0x3f9ff1,_0x19f999,_0x2bd344){WhatsappAccountEvents[_0xcc52('0x6')](_0x4849a5+':'+_0x3f9ff1['id'],_0x3f9ff1);WhatsappAccountEvents[_0xcc52('0x6')](_0x4849a5,_0x3f9ff1);_0x2bd344(null);};}for(var e in events){if(events[_0xcc52('0x7')](e)){var event=events[e];WhatsappAccount[_0xcc52('0x8')](e,emitEvent(event));}}module[_0xcc52('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 2dc1ca4..51c32c3 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 _0x44fb=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappAccount','util','api'];(function(_0x5e068e,_0x28ff2e){var _0x329514=function(_0x1c9815){while(--_0x1c9815){_0x5e068e['push'](_0x5e068e['shift']());}};_0x329514(++_0x28ff2e);}(_0x44fb,0x1e2));var _0xb44f=function(_0x17baf7,_0x232f8c){_0x17baf7=_0x17baf7-0x0;var _0x1b6115=_0x44fb[_0x17baf7];return _0x1b6115;};'use strict';var _=require('lodash');var util=require(_0xb44f('0x0'));var logger=require('../../config/logger')(_0xb44f('0x1'));var moment=require(_0xb44f('0x2'));var BPromise=require(_0xb44f('0x3'));var rp=require(_0xb44f('0x4'));var fs=require('fs');var path=require(_0xb44f('0x5'));var rimraf=require(_0xb44f('0x6'));var config=require(_0xb44f('0x7'));var attributes=require('./whatsappAccount.attributes');module[_0xb44f('0x8')]=function(_0x5a247c,_0x97d206){return _0x5a247c[_0xb44f('0x9')](_0xb44f('0xa'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcbfb=['path','../../config/environment','./whatsappAccount.attributes','define','lodash','../../config/logger','api','bluebird'];(function(_0x108d68,_0x9b39de){var _0x11476a=function(_0x21cc20){while(--_0x21cc20){_0x108d68['push'](_0x108d68['shift']());}};_0x11476a(++_0x9b39de);}(_0xcbfb,0xac));var _0xbcbf=function(_0x48ea3f,_0x52aada){_0x48ea3f=_0x48ea3f-0x0;var _0x452f07=_0xcbfb[_0x48ea3f];return _0x452f07;};'use strict';var _=require(_0xbcbf('0x0'));var util=require('util');var logger=require(_0xbcbf('0x1'))(_0xbcbf('0x2'));var moment=require('moment');var BPromise=require(_0xbcbf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbcbf('0x4'));var rimraf=require('rimraf');var config=require(_0xbcbf('0x5'));var attributes=require(_0xbcbf('0x6'));module['exports']=function(_0x354913,_0x313ce6){return _0x354913[_0xbcbf('0x7')]('WhatsappAccount',attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index aef08b5..3e07cfb 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 _0x9e75=['error','code','message','result','catch','ShowWhatsappAccount','find','options','raw','where','attributes','include','model','stringify','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s'];(function(_0x5407c4,_0x3cb4c8){var _0x3a1c46=function(_0x49fb40){while(--_0x49fb40){_0x5407c4['push'](_0x5407c4['shift']());}};_0x3a1c46(++_0x3cb4c8);}(_0x9e75,0x1ca));var _0x59e7=function(_0x42edcb,_0x42dc81){_0x42edcb=_0x42edcb-0x0;var _0x36c026=_0x9e75[_0x42edcb];return _0x36c026;};'use strict';var _=require(_0x59e7('0x0'));var util=require(_0x59e7('0x1'));var moment=require(_0x59e7('0x2'));var BPromise=require('bluebird');var rs=require(_0x59e7('0x3'));var fs=require('fs');var Redis=require(_0x59e7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x59e7('0x5'));var logger=require('../../config/logger')(_0x59e7('0x6'));var config=require(_0x59e7('0x7'));var jayson=require(_0x59e7('0x8'));var client=jayson[_0x59e7('0x9')][_0x59e7('0xa')]({'port':0x232a});config['redis']=_[_0x59e7('0xb')](config[_0x59e7('0xc')],{'host':_0x59e7('0xd'),'port':0x18eb});var socket=require(_0x59e7('0xe'))(new Redis(config[_0x59e7('0xc')]));require(_0x59e7('0xf'))[_0x59e7('0x10')](socket);function respondWithRpcPromise(_0x131ede,_0x2d76c0,_0x1c71ee){return new BPromise(function(_0x30a315,_0xd6eb29){return client['request'](_0x131ede,_0x1c71ee)[_0x59e7('0x11')](function(_0x26652d){logger[_0x59e7('0x12')](_0x59e7('0x13'),_0x2d76c0,_0x59e7('0x14'));logger[_0x59e7('0x15')](_0x59e7('0x16'),_0x2d76c0,_0x59e7('0x14'),JSON['stringify'](_0x26652d));if(_0x26652d[_0x59e7('0x17')]){if(_0x26652d[_0x59e7('0x17')][_0x59e7('0x18')]===0x1f4){logger[_0x59e7('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x2d76c0,_0x26652d[_0x59e7('0x17')]['message']);return _0xd6eb29(_0x26652d['error'][_0x59e7('0x19')]);}logger[_0x59e7('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x2d76c0,_0x26652d[_0x59e7('0x17')][_0x59e7('0x19')]);return _0x30a315(_0x26652d[_0x59e7('0x17')][_0x59e7('0x19')]);}else{logger[_0x59e7('0x12')](_0x59e7('0x13'),_0x2d76c0,_0x59e7('0x14'));_0x30a315(_0x26652d[_0x59e7('0x1a')][_0x59e7('0x19')]);}})[_0x59e7('0x1b')](function(_0x19c955){logger[_0x59e7('0x17')](_0x59e7('0x13'),_0x2d76c0,_0x19c955);_0xd6eb29(_0x19c955);});});}exports[_0x59e7('0x1c')]=function(_0x16a8e3){var _0x23b53f=this;return new Promise(function(_0x581366,_0xba1952){return db['WhatsappAccount'][_0x59e7('0x1d')]({'raw':_0x16a8e3[_0x59e7('0x1e')]?_0x16a8e3['options'][_0x59e7('0x1f')]===undefined?!![]:![]:!![],'where':_0x16a8e3[_0x59e7('0x1e')]?_0x16a8e3[_0x59e7('0x1e')][_0x59e7('0x20')]||null:null,'attributes':_0x16a8e3['options']?_0x16a8e3[_0x59e7('0x1e')][_0x59e7('0x21')]||null:null,'include':_0x16a8e3['options']?_0x16a8e3['options'][_0x59e7('0x22')]?_['map'](_0x16a8e3[_0x59e7('0x1e')][_0x59e7('0x22')],function(_0x5d1fcc){return{'model':db[_0x5d1fcc[_0x59e7('0x23')]],'as':_0x5d1fcc['as'],'attributes':_0x5d1fcc['attributes'],'include':_0x5d1fcc[_0x59e7('0x22')]?_['map'](_0x5d1fcc[_0x59e7('0x22')],function(_0x10d650){return{'model':db[_0x10d650[_0x59e7('0x23')]],'as':_0x10d650['as'],'attributes':_0x10d650[_0x59e7('0x21')],'include':_0x10d650['include']?_['map'](_0x10d650[_0x59e7('0x22')],function(_0x2fd5de){return{'model':db[_0x2fd5de[_0x59e7('0x23')]],'as':_0x2fd5de['as'],'attributes':_0x2fd5de[_0x59e7('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ac3be){logger[_0x59e7('0x12')](_0x59e7('0x1c'),_0x16a8e3);logger[_0x59e7('0x15')](_0x59e7('0x1c'),_0x16a8e3,JSON[_0x59e7('0x24')](_0x2ac3be));_0x581366(_0x2ac3be);})['catch'](function(_0x57a519){logger[_0x59e7('0x17')](_0x59e7('0x1c'),_0x57a519['message'],_0x16a8e3);_0xba1952(_0x23b53f[_0x59e7('0x17')](0x1f4,_0x57a519[_0x59e7('0x19')]));});});}; \ No newline at end of file +var _0x3ad2=['localhost','socket.io-emitter','./whatsappAccount.socket','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowWhatsappAccount','find','options','raw','where','map','attributes','include','model','then','stringify','lodash','util','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','defaults','redis'];(function(_0x51cda6,_0x3fa1d5){var _0x3ec907=function(_0x4f5ac5){while(--_0x4f5ac5){_0x51cda6['push'](_0x51cda6['shift']());}};_0x3ec907(++_0x3fa1d5);}(_0x3ad2,0x154));var _0x23ad=function(_0x542749,_0x3d95bb){_0x542749=_0x542749-0x0;var _0x4612dd=_0x3ad2[_0x542749];return _0x4612dd;};'use strict';var _=require(_0x23ad('0x0'));var util=require(_0x23ad('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x23ad('0x2'));var fs=require('fs');var Redis=require(_0x23ad('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x23ad('0x4'));var config=require(_0x23ad('0x5'));var jayson=require(_0x23ad('0x6'));var client=jayson['client'][_0x23ad('0x7')]({'port':0x232a});config['redis']=_[_0x23ad('0x8')](config[_0x23ad('0x9')],{'host':_0x23ad('0xa'),'port':0x18eb});var socket=require(_0x23ad('0xb'))(new Redis(config['redis']));require(_0x23ad('0xc'))['register'](socket);function respondWithRpcPromise(_0x1d5f49,_0x2af6e3,_0x44afb8){return new BPromise(function(_0x594cc9,_0x5d83d6){return client[_0x23ad('0xd')](_0x1d5f49,_0x44afb8)['then'](function(_0x3bfbe0){logger[_0x23ad('0xe')](_0x23ad('0xf'),_0x2af6e3,_0x23ad('0x10'));logger[_0x23ad('0x11')](_0x23ad('0x12'),_0x2af6e3,_0x23ad('0x10'),JSON['stringify'](_0x3bfbe0));if(_0x3bfbe0[_0x23ad('0x13')]){if(_0x3bfbe0[_0x23ad('0x13')][_0x23ad('0x14')]===0x1f4){logger[_0x23ad('0x13')](_0x23ad('0xf'),_0x2af6e3,_0x3bfbe0[_0x23ad('0x13')][_0x23ad('0x15')]);return _0x5d83d6(_0x3bfbe0['error'][_0x23ad('0x15')]);}logger['error'](_0x23ad('0xf'),_0x2af6e3,_0x3bfbe0['error'][_0x23ad('0x15')]);return _0x594cc9(_0x3bfbe0[_0x23ad('0x13')][_0x23ad('0x15')]);}else{logger[_0x23ad('0xe')](_0x23ad('0xf'),_0x2af6e3,'request\x20sent');_0x594cc9(_0x3bfbe0[_0x23ad('0x16')][_0x23ad('0x15')]);}})[_0x23ad('0x17')](function(_0x2bf640){logger['error'](_0x23ad('0xf'),_0x2af6e3,_0x2bf640);_0x5d83d6(_0x2bf640);});});}exports[_0x23ad('0x18')]=function(_0x4d0f57){var _0x4615c6=this;return new Promise(function(_0x1473a1,_0x31a222){return db['WhatsappAccount'][_0x23ad('0x19')]({'raw':_0x4d0f57[_0x23ad('0x1a')]?_0x4d0f57[_0x23ad('0x1a')][_0x23ad('0x1b')]===undefined?!![]:![]:!![],'where':_0x4d0f57[_0x23ad('0x1a')]?_0x4d0f57['options'][_0x23ad('0x1c')]||null:null,'attributes':_0x4d0f57[_0x23ad('0x1a')]?_0x4d0f57[_0x23ad('0x1a')]['attributes']||null:null,'include':_0x4d0f57[_0x23ad('0x1a')]?_0x4d0f57[_0x23ad('0x1a')]['include']?_[_0x23ad('0x1d')](_0x4d0f57[_0x23ad('0x1a')]['include'],function(_0x4d7819){return{'model':db[_0x4d7819['model']],'as':_0x4d7819['as'],'attributes':_0x4d7819[_0x23ad('0x1e')],'include':_0x4d7819[_0x23ad('0x1f')]?_['map'](_0x4d7819[_0x23ad('0x1f')],function(_0x3c85cd){return{'model':db[_0x3c85cd[_0x23ad('0x20')]],'as':_0x3c85cd['as'],'attributes':_0x3c85cd['attributes'],'include':_0x3c85cd[_0x23ad('0x1f')]?_['map'](_0x3c85cd[_0x23ad('0x1f')],function(_0x5947b8){return{'model':db[_0x5947b8['model']],'as':_0x5947b8['as'],'attributes':_0x5947b8[_0x23ad('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x23ad('0x21')](function(_0x41f5f8){logger[_0x23ad('0xe')](_0x23ad('0x18'),_0x4d0f57);logger[_0x23ad('0x11')](_0x23ad('0x18'),_0x4d0f57,JSON[_0x23ad('0x22')](_0x41f5f8));_0x1473a1(_0x41f5f8);})[_0x23ad('0x17')](function(_0x17563d){logger[_0x23ad('0x13')]('ShowWhatsappAccount',_0x17563d['message'],_0x4d0f57);_0x31a222(_0x4615c6[_0x23ad('0x13')](0x1f4,_0x17563d[_0x23ad('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index eaa16b0..9063fc3 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 _0xdc68=['save','remove','update','removeListener','register','length','./whatsappAccount.events'];(function(_0x4b784d,_0x5efb2f){var _0x2cdeaf=function(_0x106242){while(--_0x106242){_0x4b784d['push'](_0x4b784d['shift']());}};_0x2cdeaf(++_0x5efb2f);}(_0xdc68,0xa7));var _0x8dc6=function(_0x2bfb95,_0x3d6b56){_0x2bfb95=_0x2bfb95-0x0;var _0x449d66=_0xdc68[_0x2bfb95];return _0x449d66;};'use strict';var WhatsappAccountEvents=require(_0x8dc6('0x0'));var events=[_0x8dc6('0x1'),_0x8dc6('0x2'),_0x8dc6('0x3')];function createListener(_0x522333,_0x27872a){return function(_0x488e21){_0x27872a['emit'](_0x522333,_0x488e21);};}function removeListener(_0x85680b,_0x3b9fc8){return function(){WhatsappAccountEvents[_0x8dc6('0x4')](_0x85680b,_0x3b9fc8);};}exports[_0x8dc6('0x5')]=function(_0x58bf42){for(var _0x5390d9=0x0,_0x1181b6=events[_0x8dc6('0x6')];_0x5390d9<_0x1181b6;_0x5390d9++){var _0x18d3d8=events[_0x5390d9];var _0x4abb3d=createListener('whatsappAccount:'+_0x18d3d8,_0x58bf42);WhatsappAccountEvents['on'](_0x18d3d8,_0x4abb3d);}}; \ No newline at end of file +var _0xb387=['removeListener','length','./whatsappAccount.events','remove','update','emit'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0xb387,0xbc));var _0x7b38=function(_0x43fdf8,_0x8426b3){_0x43fdf8=_0x43fdf8-0x0;var _0x1160c6=_0xb387[_0x43fdf8];return _0x1160c6;};'use strict';var WhatsappAccountEvents=require(_0x7b38('0x0'));var events=['save',_0x7b38('0x1'),_0x7b38('0x2')];function createListener(_0x4959e2,_0x349ff9){return function(_0x24cd0c){_0x349ff9[_0x7b38('0x3')](_0x4959e2,_0x24cd0c);};}function removeListener(_0x710ee8,_0x447480){return function(){WhatsappAccountEvents[_0x7b38('0x4')](_0x710ee8,_0x447480);};}exports['register']=function(_0x3b6de5){for(var _0xef73f2=0x0,_0x79a58b=events[_0x7b38('0x5')];_0xef73f2<_0x79a58b;_0xef73f2++){var _0x2c364f=events[_0xef73f2];var _0x636890=createListener('whatsappAccount:'+_0x2c364f,_0x3b6de5);WhatsappAccountEvents['on'](_0x2c364f,_0x636890);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 1c11af7..9d0a3a2 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 _0x447b=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports'];(function(_0x56dbbd,_0x53a898){var _0x26012c=function(_0x558b27){while(--_0x558b27){_0x56dbbd['push'](_0x56dbbd['shift']());}};_0x26012c(++_0x53a898);}(_0x447b,0x1ee));var _0xb447=function(_0x8c318b,_0x309481){_0x8c318b=_0x8c318b-0x0;var _0x3c000a=_0x447b[_0x8c318b];return _0x3c000a;};'use strict';var multer=require(_0xb447('0x0'));var util=require(_0xb447('0x1'));var path=require(_0xb447('0x2'));var timeout=require(_0xb447('0x3'));var express=require('express');var router=express[_0xb447('0x4')]();var fs_extra=require(_0xb447('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb447('0x6'));var config=require(_0xb447('0x7'));var controller=require('./whatsappApplication.controller');router[_0xb447('0x8')]('/',auth[_0xb447('0x9')](),controller[_0xb447('0xa')]);router[_0xb447('0x8')](_0xb447('0xb'),auth[_0xb447('0x9')](),controller[_0xb447('0xc')]);router[_0xb447('0xd')]('/',auth[_0xb447('0x9')](),controller['create']);router[_0xb447('0xe')](_0xb447('0xb'),auth[_0xb447('0x9')](),controller[_0xb447('0xf')]);router[_0xb447('0x10')]('/:id',auth[_0xb447('0x9')](),controller[_0xb447('0x11')]);module[_0xb447('0x12')]=router; \ No newline at end of file +var _0x561b=['index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x1d6b55,_0x43ab65){var _0x1751f9=function(_0x22cc1b){while(--_0x22cc1b){_0x1d6b55['push'](_0x1d6b55['shift']());}};_0x1751f9(++_0x43ab65);}(_0x561b,0xda));var _0xb561=function(_0x5ec717,_0x1d3047){_0x5ec717=_0x5ec717-0x0;var _0x42d64e=_0x561b[_0x5ec717];return _0x42d64e;};'use strict';var multer=require(_0xb561('0x0'));var util=require(_0xb561('0x1'));var path=require(_0xb561('0x2'));var timeout=require(_0xb561('0x3'));var express=require(_0xb561('0x4'));var router=express['Router']();var fs_extra=require(_0xb561('0x5'));var auth=require(_0xb561('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb561('0x7'));var controller=require('./whatsappApplication.controller');router[_0xb561('0x8')]('/',auth[_0xb561('0x9')](),controller[_0xb561('0xa')]);router['get'](_0xb561('0xb'),auth[_0xb561('0x9')](),controller[_0xb561('0xc')]);router[_0xb561('0xd')]('/',auth[_0xb561('0x9')](),controller[_0xb561('0xe')]);router[_0xb561('0xf')](_0xb561('0xb'),auth[_0xb561('0x9')](),controller[_0xb561('0x10')]);router['delete'](_0xb561('0xb'),auth[_0xb561('0x9')](),controller[_0xb561('0x11')]);module[_0xb561('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 16edf00..d2b2fb9 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 _0x8a6b=['STRING','noop','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x3b7eb5,_0xdb63f8){var _0xbe1830=function(_0x5be6cf){while(--_0x5be6cf){_0x3b7eb5['push'](_0x3b7eb5['shift']());}};_0xbe1830(++_0xdb63f8);}(_0x8a6b,0x1ef));var _0xb8a6=function(_0x5bb343,_0xe17bb5){_0x5bb343=_0x5bb343-0x0;var _0x3ab062=_0x8a6b[_0x5bb343];return _0x3ab062;};'use strict';var Sequelize=require(_0xb8a6('0x0'));module[_0xb8a6('0x1')]={'priority':{'type':Sequelize[_0xb8a6('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xb8a6('0x3')],'allowNull':![],'defaultValue':_0xb8a6('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xb8a6('0x3')]},'interval':{'type':Sequelize[_0xb8a6('0x3')],'defaultValue':_0xb8a6('0x5')}}; \ No newline at end of file +var _0xe850=['sequelize','exports','STRING','TEXT','*,*,*,*'];(function(_0x39616f,_0x4185c7){var _0x215978=function(_0xb9e20){while(--_0xb9e20){_0x39616f['push'](_0x39616f['shift']());}};_0x215978(++_0x4185c7);}(_0xe850,0x122));var _0x0e85=function(_0x235673,_0x4b8ac2){_0x235673=_0x235673-0x0;var _0x5b5bc0=_0xe850[_0x235673];return _0x5b5bc0;};'use strict';var Sequelize=require(_0x0e85('0x0'));module[_0x0e85('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x0e85('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x0e85('0x3')]()},'description':{'type':Sequelize[_0x0e85('0x2')]},'interval':{'type':Sequelize[_0x0e85('0x2')],'defaultValue':_0x0e85('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 87ec0f3..38d021d 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 _0xa817=['count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','merge','find','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit'];(function(_0x188337,_0x4e3280){var _0x205fde=function(_0x1ed4fd){while(--_0x1ed4fd){_0x188337['push'](_0x188337['shift']());}};_0x205fde(++_0x4e3280);}(_0xa817,0x7b));var _0x7a81=function(_0x3f9b1d,_0x21b2a8){_0x3f9b1d=_0x3f9b1d-0x0;var _0x4acf85=_0xa817[_0x3f9b1d];return _0x4acf85;};'use strict';var emlformat=require(_0x7a81('0x0'));var rimraf=require(_0x7a81('0x1'));var zipdir=require(_0x7a81('0x2'));var jsonpatch=require(_0x7a81('0x3'));var rp=require(_0x7a81('0x4'));var moment=require(_0x7a81('0x5'));var BPromise=require(_0x7a81('0x6'));var Mustache=require(_0x7a81('0x7'));var util=require(_0x7a81('0x8'));var path=require('path');var sox=require(_0x7a81('0x9'));var csv=require(_0x7a81('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7a81('0xb'));var _=require(_0x7a81('0xc'));var squel=require(_0x7a81('0xd'));var crypto=require(_0x7a81('0xe'));var jsforce=require(_0x7a81('0xf'));var deskjs=require(_0x7a81('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7a81('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7a81('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7a81('0x13'));var hardwareService=require(_0x7a81('0x14'));var logger=require(_0x7a81('0x15'))(_0x7a81('0x16'));var utils=require(_0x7a81('0x17'));var config=require(_0x7a81('0x18'));var licenseUtil=require(_0x7a81('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12a089,_0x32c90e){_0x32c90e=_0x32c90e||0xcc;return function(_0xc5cdf2){if(_0xc5cdf2){return _0x12a089['sendStatus'](_0x32c90e);}return _0x12a089[_0x7a81('0x1a')](_0x32c90e)[_0x7a81('0x1b')]();};}function respondWithResult(_0x2977a9,_0x4ca2d3){_0x4ca2d3=_0x4ca2d3||0xc8;return function(_0x43141a){if(_0x43141a){return _0x2977a9[_0x7a81('0x1a')](_0x4ca2d3)['json'](_0x43141a);}};}function respondWithFilteredResult(_0x4aef24,_0x1ce514){return function(_0x208a7b){if(_0x208a7b){var _0x584c0c=typeof _0x1ce514[_0x7a81('0x1c')]===_0x7a81('0x1d')&&typeof _0x1ce514[_0x7a81('0x1e')]===_0x7a81('0x1d');var _0xed69fc=_0x208a7b[_0x7a81('0x1f')];var _0x114cfa=_0x584c0c?0x0:_0x1ce514[_0x7a81('0x1c')];var _0x2b5720=_0x584c0c?_0x208a7b[_0x7a81('0x1f')]:_0x1ce514[_0x7a81('0x1c')]+_0x1ce514[_0x7a81('0x1e')];var _0x1aefdf;if(_0x2b5720>=_0xed69fc){_0x2b5720=_0xed69fc;_0x1aefdf=0xc8;}else{_0x1aefdf=0xce;}_0x4aef24['status'](_0x1aefdf);return _0x4aef24[_0x7a81('0x20')](_0x7a81('0x21'),_0x114cfa+'-'+_0x2b5720+'/'+_0xed69fc)[_0x7a81('0x22')](_0x208a7b);}return null;};}function patchUpdates(_0x3087c0){return function(_0x3b0786){try{jsonpatch[_0x7a81('0x23')](_0x3b0786,_0x3087c0,!![]);}catch(_0x34dd0b){return BPromise[_0x7a81('0x24')](_0x34dd0b);}return _0x3b0786[_0x7a81('0x25')]();};}function saveUpdates(_0x596a8c,_0x3c0c41){return function(_0x26b384){if(_0x26b384){return _0x26b384[_0x7a81('0x26')](_0x596a8c)[_0x7a81('0x27')](function(_0x26556b){return _0x26556b;});}return null;};}function removeEntity(_0x15a1cd,_0x249ae1){return function(_0x21c45a){if(_0x21c45a){return _0x21c45a['destroy']()[_0x7a81('0x27')](function(){_0x15a1cd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e2476,_0x41ea68){return function(_0x13d2ae){if(!_0x13d2ae){_0x1e2476['sendStatus'](0x194);}return _0x13d2ae;};}function handleError(_0x2abcf4,_0x35f521){_0x35f521=_0x35f521||0x1f4;return function(_0x87e708){logger[_0x7a81('0x28')](_0x87e708[_0x7a81('0x29')]);if(_0x87e708['name']){delete _0x87e708[_0x7a81('0x2a')];}_0x2abcf4[_0x7a81('0x1a')](_0x35f521)[_0x7a81('0x2b')](_0x87e708);};}exports[_0x7a81('0x2c')]=function(_0x29655a,_0x3295df){var _0x31fe26={},_0x551c14={},_0x1a0232={'count':0x0,'rows':[]};var _0x5b79ea=_[_0x7a81('0x2d')](db[_0x7a81('0x2e')][_0x7a81('0x2f')],function(_0x523d39){return{'name':_0x523d39[_0x7a81('0x30')],'type':_0x523d39['type']['key']};});_0x551c14[_0x7a81('0x31')]=_[_0x7a81('0x2d')](_0x5b79ea,_0x7a81('0x2a'));_0x551c14[_0x7a81('0x32')]=_[_0x7a81('0x33')](_0x29655a['query']);_0x551c14[_0x7a81('0x34')]=_[_0x7a81('0x35')](_0x551c14[_0x7a81('0x31')],_0x551c14[_0x7a81('0x32')]);_0x31fe26[_0x7a81('0x36')]=_[_0x7a81('0x35')](_0x551c14[_0x7a81('0x31')],qs['fields'](_0x29655a[_0x7a81('0x32')][_0x7a81('0x37')]));_0x31fe26[_0x7a81('0x36')]=_0x31fe26['attributes'][_0x7a81('0x38')]?_0x31fe26[_0x7a81('0x36')]:_0x551c14[_0x7a81('0x31')];if(!_0x29655a[_0x7a81('0x32')]['hasOwnProperty'](_0x7a81('0x39'))){_0x31fe26[_0x7a81('0x1e')]=qs[_0x7a81('0x1e')](_0x29655a[_0x7a81('0x32')][_0x7a81('0x1e')]);_0x31fe26['offset']=qs[_0x7a81('0x1c')](_0x29655a[_0x7a81('0x32')][_0x7a81('0x1c')]);}_0x31fe26[_0x7a81('0x3a')]=qs[_0x7a81('0x3b')](_0x29655a[_0x7a81('0x32')][_0x7a81('0x3b')]);_0x31fe26['where']=qs['filters'](_[_0x7a81('0x3c')](_0x29655a[_0x7a81('0x32')],_0x551c14['filters']),_0x5b79ea);if(_0x29655a[_0x7a81('0x32')][_0x7a81('0x3d')]){_0x31fe26[_0x7a81('0x3e')]=_['merge'](_0x31fe26[_0x7a81('0x3e')],{'$or':_[_0x7a81('0x2d')](_0x5b79ea,function(_0x4be82f){if(_0x4be82f[_0x7a81('0x3f')]!==_0x7a81('0x40')){var _0x475aac={};_0x475aac[_0x4be82f['name']]={'$like':'%'+_0x29655a[_0x7a81('0x32')][_0x7a81('0x3d')]+'%'};return _0x475aac;}})});}_0x31fe26=_['merge']({},_0x31fe26,_0x29655a[_0x7a81('0x41')]);var _0x315db1={'where':_0x31fe26[_0x7a81('0x3e')]};return db[_0x7a81('0x2e')][_0x7a81('0x1f')](_0x315db1)[_0x7a81('0x27')](function(_0x4723ea){_0x1a0232['count']=_0x4723ea;if(_0x29655a['query'][_0x7a81('0x42')]){_0x31fe26[_0x7a81('0x43')]=[{'all':!![]}];}return db[_0x7a81('0x2e')][_0x7a81('0x44')](_0x31fe26);})[_0x7a81('0x27')](function(_0x25ef87){_0x1a0232[_0x7a81('0x45')]=_0x25ef87;return _0x1a0232;})[_0x7a81('0x27')](respondWithFilteredResult(_0x3295df,_0x31fe26))[_0x7a81('0x46')](handleError(_0x3295df,null));};exports['show']=function(_0x28f628,_0x58777a){var _0x4f9bb7={'raw':!![],'where':{'id':_0x28f628['params']['id']}},_0x611df={};_0x611df['model']=_[_0x7a81('0x33')](db[_0x7a81('0x2e')][_0x7a81('0x2f')]);_0x611df[_0x7a81('0x32')]=_[_0x7a81('0x33')](_0x28f628[_0x7a81('0x32')]);_0x611df[_0x7a81('0x34')]=_[_0x7a81('0x35')](_0x611df[_0x7a81('0x31')],_0x611df[_0x7a81('0x32')]);_0x4f9bb7[_0x7a81('0x36')]=_[_0x7a81('0x35')](_0x611df[_0x7a81('0x31')],qs['fields'](_0x28f628[_0x7a81('0x32')][_0x7a81('0x37')]));_0x4f9bb7[_0x7a81('0x36')]=_0x4f9bb7[_0x7a81('0x36')][_0x7a81('0x38')]?_0x4f9bb7['attributes']:_0x611df[_0x7a81('0x31')];if(_0x28f628[_0x7a81('0x32')][_0x7a81('0x42')]){_0x4f9bb7['include']=[{'all':!![]}];}_0x4f9bb7=_[_0x7a81('0x47')]({},_0x4f9bb7,_0x28f628[_0x7a81('0x41')]);return db[_0x7a81('0x2e')][_0x7a81('0x48')](_0x4f9bb7)[_0x7a81('0x27')](handleEntityNotFound(_0x58777a,null))[_0x7a81('0x27')](respondWithResult(_0x58777a,null))[_0x7a81('0x46')](handleError(_0x58777a,null));};exports['create']=function(_0x40c17c,_0x473e42){return db[_0x7a81('0x2e')][_0x7a81('0x49')](_0x40c17c[_0x7a81('0x4a')],{})[_0x7a81('0x27')](respondWithResult(_0x473e42,0xc9))['catch'](handleError(_0x473e42,null));};exports['update']=function(_0x31a0aa,_0x7fb80){if(_0x31a0aa[_0x7a81('0x4a')]['id']){delete _0x31a0aa[_0x7a81('0x4a')]['id'];}return db['WhatsappApplication'][_0x7a81('0x48')]({'where':{'id':_0x31a0aa[_0x7a81('0x4b')]['id']}})[_0x7a81('0x27')](handleEntityNotFound(_0x7fb80,null))[_0x7a81('0x27')](saveUpdates(_0x31a0aa[_0x7a81('0x4a')],null))['then'](respondWithResult(_0x7fb80,null))['catch'](handleError(_0x7fb80,null));};exports[_0x7a81('0x4c')]=function(_0x450f67,_0x1ed652){return db['WhatsappApplication'][_0x7a81('0x48')]({'where':{'id':_0x450f67[_0x7a81('0x4b')]['id']}})[_0x7a81('0x27')](handleEntityNotFound(_0x1ed652,null))[_0x7a81('0x27')](removeEntity(_0x1ed652,null))['catch'](handleError(_0x1ed652,null));}; \ No newline at end of file +var _0x2a07=['name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','catch','show','params','fields','includeAll','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','error'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x2a07,0x74));var _0x72a0=function(_0x1abd00,_0x37fcde){_0x1abd00=_0x1abd00-0x0;var _0x2424d3=_0x2a07[_0x1abd00];return _0x2424d3;};'use strict';var emlformat=require(_0x72a0('0x0'));var rimraf=require(_0x72a0('0x1'));var zipdir=require(_0x72a0('0x2'));var jsonpatch=require(_0x72a0('0x3'));var rp=require(_0x72a0('0x4'));var moment=require('moment');var BPromise=require(_0x72a0('0x5'));var Mustache=require(_0x72a0('0x6'));var util=require(_0x72a0('0x7'));var path=require(_0x72a0('0x8'));var sox=require(_0x72a0('0x9'));var csv=require(_0x72a0('0xa'));var ejs=require(_0x72a0('0xb'));var fs=require('fs');var fs_extra=require(_0x72a0('0xc'));var _=require(_0x72a0('0xd'));var squel=require(_0x72a0('0xe'));var crypto=require(_0x72a0('0xf'));var jsforce=require(_0x72a0('0x10'));var deskjs=require(_0x72a0('0x11'));var toCsv=require(_0x72a0('0xa'));var querystring=require(_0x72a0('0x12'));var Papa=require(_0x72a0('0x13'));var Redis=require('ioredis');var authService=require(_0x72a0('0x14'));var qs=require(_0x72a0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72a0('0x16'));var logger=require(_0x72a0('0x17'))(_0x72a0('0x18'));var utils=require(_0x72a0('0x19'));var config=require(_0x72a0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x72a0('0x1b'))['db'];function respondWithStatusCode(_0x335b9f,_0x123ca4){_0x123ca4=_0x123ca4||0xcc;return function(_0xf91a82){if(_0xf91a82){return _0x335b9f[_0x72a0('0x1c')](_0x123ca4);}return _0x335b9f[_0x72a0('0x1d')](_0x123ca4)[_0x72a0('0x1e')]();};}function respondWithResult(_0x5e0b5f,_0x4930c5){_0x4930c5=_0x4930c5||0xc8;return function(_0xe103dc){if(_0xe103dc){return _0x5e0b5f[_0x72a0('0x1d')](_0x4930c5)[_0x72a0('0x1f')](_0xe103dc);}};}function respondWithFilteredResult(_0x1d1133,_0x23b001){return function(_0x3f3d62){if(_0x3f3d62){var _0x4ab55e=typeof _0x23b001[_0x72a0('0x20')]===_0x72a0('0x21')&&typeof _0x23b001[_0x72a0('0x22')]===_0x72a0('0x21');var _0x2d1e95=_0x3f3d62['count'];var _0x100d8f=_0x4ab55e?0x0:_0x23b001[_0x72a0('0x20')];var _0x131b73=_0x4ab55e?_0x3f3d62['count']:_0x23b001[_0x72a0('0x20')]+_0x23b001[_0x72a0('0x22')];var _0x30899b;if(_0x131b73>=_0x2d1e95){_0x131b73=_0x2d1e95;_0x30899b=0xc8;}else{_0x30899b=0xce;}_0x1d1133[_0x72a0('0x1d')](_0x30899b);return _0x1d1133['set'](_0x72a0('0x23'),_0x100d8f+'-'+_0x131b73+'/'+_0x2d1e95)['json'](_0x3f3d62);}return null;};}function patchUpdates(_0x3d0607){return function(_0x315413){try{jsonpatch[_0x72a0('0x24')](_0x315413,_0x3d0607,!![]);}catch(_0x5c7479){return BPromise[_0x72a0('0x25')](_0x5c7479);}return _0x315413[_0x72a0('0x26')]();};}function saveUpdates(_0x1d22d8,_0x3d1965){return function(_0x5d6145){if(_0x5d6145){return _0x5d6145[_0x72a0('0x27')](_0x1d22d8)[_0x72a0('0x28')](function(_0x1ddd54){return _0x1ddd54;});}return null;};}function removeEntity(_0x23b918,_0x3022b0){return function(_0x174b1b){if(_0x174b1b){return _0x174b1b['destroy']()['then'](function(){_0x23b918[_0x72a0('0x1d')](0xcc)[_0x72a0('0x1e')]();});}};}function handleEntityNotFound(_0x123df4,_0x1504ed){return function(_0xf5cb49){if(!_0xf5cb49){_0x123df4[_0x72a0('0x1c')](0x194);}return _0xf5cb49;};}function handleError(_0xa5bda0,_0x15922a){_0x15922a=_0x15922a||0x1f4;return function(_0xee99e2){logger[_0x72a0('0x29')](_0xee99e2['stack']);if(_0xee99e2[_0x72a0('0x2a')]){delete _0xee99e2[_0x72a0('0x2a')];}_0xa5bda0[_0x72a0('0x1d')](_0x15922a)[_0x72a0('0x2b')](_0xee99e2);};}exports[_0x72a0('0x2c')]=function(_0x177a3a,_0x432179){var _0x12eda2={},_0x23c96a={},_0x916733={'count':0x0,'rows':[]};var _0x4ba037=_[_0x72a0('0x2d')](db[_0x72a0('0x2e')][_0x72a0('0x2f')],function(_0xfbe9b3){return{'name':_0xfbe9b3[_0x72a0('0x30')],'type':_0xfbe9b3[_0x72a0('0x31')][_0x72a0('0x32')]};});_0x23c96a['model']=_[_0x72a0('0x2d')](_0x4ba037,_0x72a0('0x2a'));_0x23c96a[_0x72a0('0x33')]=_[_0x72a0('0x34')](_0x177a3a[_0x72a0('0x33')]);_0x23c96a[_0x72a0('0x35')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],_0x23c96a['query']);_0x12eda2[_0x72a0('0x38')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],qs['fields'](_0x177a3a[_0x72a0('0x33')]['fields']));_0x12eda2[_0x72a0('0x38')]=_0x12eda2[_0x72a0('0x38')][_0x72a0('0x39')]?_0x12eda2[_0x72a0('0x38')]:_0x23c96a[_0x72a0('0x37')];if(!_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3a')](_0x72a0('0x3b'))){_0x12eda2[_0x72a0('0x22')]=qs[_0x72a0('0x22')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x22')]);_0x12eda2['offset']=qs[_0x72a0('0x20')](_0x177a3a['query'][_0x72a0('0x20')]);}_0x12eda2[_0x72a0('0x3c')]=qs[_0x72a0('0x3d')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3d')]);_0x12eda2[_0x72a0('0x3e')]=qs[_0x72a0('0x35')](_[_0x72a0('0x3f')](_0x177a3a[_0x72a0('0x33')],_0x23c96a['filters']),_0x4ba037);if(_0x177a3a['query'][_0x72a0('0x40')]){_0x12eda2[_0x72a0('0x3e')]=_[_0x72a0('0x41')](_0x12eda2[_0x72a0('0x3e')],{'$or':_[_0x72a0('0x2d')](_0x4ba037,function(_0x512a06){if(_0x512a06[_0x72a0('0x31')]!==_0x72a0('0x42')){var _0x582c90={};_0x582c90[_0x512a06[_0x72a0('0x2a')]]={'$like':'%'+_0x177a3a['query']['filter']+'%'};return _0x582c90;}})});}_0x12eda2=_['merge']({},_0x12eda2,_0x177a3a[_0x72a0('0x43')]);var _0x49633b={'where':_0x12eda2[_0x72a0('0x3e')]};return db[_0x72a0('0x2e')][_0x72a0('0x44')](_0x49633b)[_0x72a0('0x28')](function(_0x4bf56e){_0x916733['count']=_0x4bf56e;if(_0x177a3a['query']['includeAll']){_0x12eda2[_0x72a0('0x45')]=[{'all':!![]}];}return db[_0x72a0('0x2e')]['findAll'](_0x12eda2);})[_0x72a0('0x28')](function(_0x35d790){_0x916733['rows']=_0x35d790;return _0x916733;})[_0x72a0('0x28')](respondWithFilteredResult(_0x432179,_0x12eda2))[_0x72a0('0x46')](handleError(_0x432179,null));};exports[_0x72a0('0x47')]=function(_0xe4abe1,_0x340153){var _0x341451={'raw':!![],'where':{'id':_0xe4abe1[_0x72a0('0x48')]['id']}},_0x50eb7f={};_0x50eb7f['model']=_[_0x72a0('0x34')](db['WhatsappApplication'][_0x72a0('0x2f')]);_0x50eb7f[_0x72a0('0x33')]=_['keys'](_0xe4abe1[_0x72a0('0x33')]);_0x50eb7f['filters']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],_0x50eb7f[_0x72a0('0x33')]);_0x341451['attributes']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],qs[_0x72a0('0x49')](_0xe4abe1['query']['fields']));_0x341451[_0x72a0('0x38')]=_0x341451['attributes'][_0x72a0('0x39')]?_0x341451[_0x72a0('0x38')]:_0x50eb7f[_0x72a0('0x37')];if(_0xe4abe1[_0x72a0('0x33')][_0x72a0('0x4a')]){_0x341451[_0x72a0('0x45')]=[{'all':!![]}];}_0x341451=_[_0x72a0('0x41')]({},_0x341451,_0xe4abe1[_0x72a0('0x43')]);return db[_0x72a0('0x2e')]['find'](_0x341451)[_0x72a0('0x28')](handleEntityNotFound(_0x340153,null))[_0x72a0('0x28')](respondWithResult(_0x340153,null))[_0x72a0('0x46')](handleError(_0x340153,null));};exports[_0x72a0('0x4b')]=function(_0x3a669d,_0x304400){return db[_0x72a0('0x2e')]['create'](_0x3a669d['body'],{})[_0x72a0('0x28')](respondWithResult(_0x304400,0xc9))[_0x72a0('0x46')](handleError(_0x304400,null));};exports[_0x72a0('0x27')]=function(_0x3cab6a,_0x35a6ad){if(_0x3cab6a[_0x72a0('0x4c')]['id']){delete _0x3cab6a[_0x72a0('0x4c')]['id'];}return db[_0x72a0('0x2e')][_0x72a0('0x4d')]({'where':{'id':_0x3cab6a[_0x72a0('0x48')]['id']}})['then'](handleEntityNotFound(_0x35a6ad,null))[_0x72a0('0x28')](saveUpdates(_0x3cab6a[_0x72a0('0x4c')],null))[_0x72a0('0x28')](respondWithResult(_0x35a6ad,null))[_0x72a0('0x46')](handleError(_0x35a6ad,null));};exports[_0x72a0('0x4e')]=function(_0x5c1570,_0x143410){return db['WhatsappApplication']['find']({'where':{'id':_0x5c1570[_0x72a0('0x48')]['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x143410,null))[_0x72a0('0x28')](removeEntity(_0x143410,null))[_0x72a0('0x46')](handleError(_0x143410,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 5a8add0..383c959 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 _0xc997=['rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path'];(function(_0x26bbb8,_0x12e79a){var _0x27becc=function(_0x15251a){while(--_0x15251a){_0x26bbb8['push'](_0x26bbb8['shift']());}};_0x27becc(++_0x12e79a);}(_0xc997,0x1ac));var _0x7c99=function(_0x45bd41,_0x19b2a0){_0x45bd41=_0x45bd41-0x0;var _0xd955e8=_0xc997[_0x45bd41];return _0xd955e8;};'use strict';var _=require('lodash');var util=require(_0x7c99('0x0'));var logger=require(_0x7c99('0x1'))(_0x7c99('0x2'));var moment=require(_0x7c99('0x3'));var BPromise=require(_0x7c99('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c99('0x5'));var rimraf=require(_0x7c99('0x6'));var config=require(_0x7c99('0x7'));var attributes=require(_0x7c99('0x8'));module[_0x7c99('0x9')]=function(_0x404ffb,_0x1a21e1){return _0x404ffb[_0x7c99('0xa')]('WhatsappApplication',attributes,{'tableName':_0x7c99('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7c99('0xc'),'collate':_0x7c99('0xd')});}; \ No newline at end of file +var _0x9b9b=['path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','moment','bluebird','request-promise'];(function(_0x42277b,_0x24c114){var _0x1b7796=function(_0x235023){while(--_0x235023){_0x42277b['push'](_0x42277b['shift']());}};_0x1b7796(++_0x24c114);}(_0x9b9b,0x114));var _0xb9b9=function(_0x3d71d3,_0x11caf1){_0x3d71d3=_0x3d71d3-0x0;var _0x30ec87=_0x9b9b[_0x3d71d3];return _0x30ec87;};'use strict';var _=require('lodash');var util=require(_0xb9b9('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xb9b9('0x1'));var BPromise=require(_0xb9b9('0x2'));var rp=require(_0xb9b9('0x3'));var fs=require('fs');var path=require(_0xb9b9('0x4'));var rimraf=require(_0xb9b9('0x5'));var config=require(_0xb9b9('0x6'));var attributes=require(_0xb9b9('0x7'));module[_0xb9b9('0x8')]=function(_0x79dd,_0x3d1a95){return _0x79dd[_0xb9b9('0x9')](_0xb9b9('0xa'),attributes,{'tableName':_0xb9b9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb9b9('0xc'),'collate':_0xb9b9('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 0988c76..e50902e 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 _0xed1f=['request','then','info','WhatsappApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1460d7,_0x35787e){var _0x3de766=function(_0x1ef8ef){while(--_0x1ef8ef){_0x1460d7['push'](_0x1460d7['shift']());}};_0x3de766(++_0x35787e);}(_0xed1f,0x6a));var _0xfed1=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xed1f[_0x1589dd];return _0x1bddd1;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var moment=require(_0xfed1('0x2'));var BPromise=require(_0xfed1('0x3'));var rs=require(_0xfed1('0x4'));var fs=require('fs');var Redis=require(_0xfed1('0x5'));var db=require(_0xfed1('0x6'))['db'];var utils=require(_0xfed1('0x7'));var logger=require(_0xfed1('0x8'))(_0xfed1('0x9'));var config=require(_0xfed1('0xa'));var jayson=require(_0xfed1('0xb'));var client=jayson[_0xfed1('0xc')][_0xfed1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x380e18,_0x612b38,_0x2a6082){return new BPromise(function(_0x2967ef,_0x568d48){return client[_0xfed1('0xe')](_0x380e18,_0x2a6082)[_0xfed1('0xf')](function(_0x48862d){logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,'request\x20sent');logger[_0xfed1('0x12')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x612b38,_0xfed1('0x13'),JSON[_0xfed1('0x14')](_0x48862d));if(_0x48862d['error']){if(_0x48862d['error'][_0xfed1('0x15')]===0x1f4){logger[_0xfed1('0x16')]('WhatsappApplication,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x568d48(_0x48862d['error'][_0xfed1('0x17')]);}logger[_0xfed1('0x16')]('WhatsappApplication,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x2967ef(_0x48862d['error'][_0xfed1('0x17')]);}else{logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,_0xfed1('0x13'));_0x2967ef(_0x48862d['result'][_0xfed1('0x17')]);}})['catch'](function(_0x36ff34){logger[_0xfed1('0x16')]('WhatsappApplication,\x20%s,\x20%s',_0x612b38,_0x36ff34);_0x568d48(_0x36ff34);});});} \ No newline at end of file +var _0xa41a=['rpc','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x34450,_0x4cff7e){var _0x4db113=function(_0x4129fe){while(--_0x4129fe){_0x34450['push'](_0x34450['shift']());}};_0x4db113(++_0x4cff7e);}(_0xa41a,0x6b));var _0xaa41=function(_0x2ccee2,_0x56eea1){_0x2ccee2=_0x2ccee2-0x0;var _0x5d5a15=_0xa41a[_0x2ccee2];return _0x5d5a15;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 2e1eeba..a4cf1dd 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 _0xc492=['describe','/:id','/:id/download','download','post','create','/:id/messages','addMessage','tracked','whatsapp','whatsappinteraction:addtags','addTags','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','/:id/tags','removeTags','multer','util','path','Router','../../components/interaction/service','../../config/environment','get','index','isAuthenticated'];(function(_0x157111,_0x3a9771){var _0x5b00c4=function(_0x1b15e4){while(--_0x1b15e4){_0x157111['push'](_0x157111['shift']());}};_0x5b00c4(++_0x3a9771);}(_0xc492,0xd7));var _0x2c49=function(_0x3ab0b7,_0x34e13b){_0x3ab0b7=_0x3ab0b7-0x0;var _0x218c9c=_0xc492[_0x3ab0b7];return _0x218c9c;};'use strict';var multer=require(_0x2c49('0x0'));var util=require(_0x2c49('0x1'));var path=require(_0x2c49('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2c49('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2c49('0x4'));var config=require(_0x2c49('0x5'));var controller=require('./whatsappInteraction.controller');router[_0x2c49('0x6')]('/',auth['isAuthenticated'](),controller[_0x2c49('0x7')]);router[_0x2c49('0x6')]('/describe',auth[_0x2c49('0x8')](),controller[_0x2c49('0x9')]);router[_0x2c49('0x6')](_0x2c49('0xa'),auth[_0x2c49('0x8')](),controller['show']);router[_0x2c49('0x6')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router['get'](_0x2c49('0xb'),auth['isAuthenticated'](),controller[_0x2c49('0xc')]);router[_0x2c49('0xd')]('/',auth['isAuthenticated'](),controller[_0x2c49('0xe')]);router[_0x2c49('0xd')](_0x2c49('0xf'),auth[_0x2c49('0x8')](),controller[_0x2c49('0x10')]);router[_0x2c49('0xd')]('/:id/tags',auth[_0x2c49('0x8')](),interaction[_0x2c49('0x11')](_0x2c49('0x12'),_0x2c49('0x13')),controller[_0x2c49('0x14')]);router['put'](_0x2c49('0xa'),auth[_0x2c49('0x8')](),interaction[_0x2c49('0x11')](_0x2c49('0x12'),_0x2c49('0x15')),controller[_0x2c49('0x16')]);router[_0x2c49('0x17')](_0x2c49('0xa'),auth[_0x2c49('0x8')](),interaction[_0x2c49('0x11')]('whatsapp',_0x2c49('0x18')),controller[_0x2c49('0x19')]);router[_0x2c49('0x17')](_0x2c49('0x1a'),auth['isAuthenticated'](),controller[_0x2c49('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x199c=['tracked','whatsapp','put','whatsappinteraction:update','delete','whatsappinteraction:destroy','destroy','removeTags','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','getMessages','/:id/download','download','create','post','/:id/messages','/:id/tags'];(function(_0x5d1905,_0x25378d){var _0x1f1aee=function(_0x512249){while(--_0x512249){_0x5d1905['push'](_0x5d1905['shift']());}};_0x1f1aee(++_0x25378d);}(_0x199c,0x1d8));var _0xc199=function(_0x6605a0,_0x136491){_0x6605a0=_0x6605a0-0x0;var _0x5d3c3e=_0x199c[_0x6605a0];return _0x5d3c3e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc199('0x0'));var timeout=require(_0xc199('0x1'));var express=require(_0xc199('0x2'));var router=express[_0xc199('0x3')]();var fs_extra=require(_0xc199('0x4'));var auth=require(_0xc199('0x5'));var interaction=require(_0xc199('0x6'));var config=require(_0xc199('0x7'));var controller=require('./whatsappInteraction.controller');router[_0xc199('0x8')]('/',auth[_0xc199('0x9')](),controller['index']);router['get'](_0xc199('0xa'),auth[_0xc199('0x9')](),controller[_0xc199('0xb')]);router[_0xc199('0x8')](_0xc199('0xc'),auth[_0xc199('0x9')](),controller[_0xc199('0xd')]);router[_0xc199('0x8')]('/:id/messages',auth[_0xc199('0x9')](),controller[_0xc199('0xe')]);router[_0xc199('0x8')](_0xc199('0xf'),auth[_0xc199('0x9')](),controller[_0xc199('0x10')]);router['post']('/',auth[_0xc199('0x9')](),controller[_0xc199('0x11')]);router[_0xc199('0x12')](_0xc199('0x13'),auth[_0xc199('0x9')](),controller['addMessage']);router[_0xc199('0x12')](_0xc199('0x14'),auth[_0xc199('0x9')](),interaction[_0xc199('0x15')](_0xc199('0x16'),'whatsappinteraction:addtags'),controller['addTags']);router[_0xc199('0x17')]('/:id',auth[_0xc199('0x9')](),interaction[_0xc199('0x15')]('whatsapp',_0xc199('0x18')),controller['update']);router[_0xc199('0x19')](_0xc199('0xc'),auth[_0xc199('0x9')](),interaction[_0xc199('0x15')](_0xc199('0x16'),_0xc199('0x1a')),controller[_0xc199('0x1b')]);router[_0xc199('0x19')](_0xc199('0x14'),auth[_0xc199('0x9')](),controller[_0xc199('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index aa1834d..5e6ccd3 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 _0x448a=['DATE','STRING','ENUM','out','BOOLEAN','moment','exports'];(function(_0x117bdd,_0x29a86e){var _0x93ed36=function(_0x473358){while(--_0x473358){_0x117bdd['push'](_0x117bdd['shift']());}};_0x93ed36(++_0x29a86e);}(_0x448a,0x1ef));var _0xa448=function(_0x5f3057,_0x4b72da){_0x5f3057=_0x5f3057-0x0;var _0x3f985d=_0x448a[_0x5f3057];return _0x3f985d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa448('0x0'));module[_0xa448('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa448('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xa448('0x3')]},'note':{'type':Sequelize[_0xa448('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xa448('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xa448('0x4')]('in',_0xa448('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa448('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xa448('0x4')]('in',_0xa448('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa448('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0xd9ef=['ENUM','out','sequelize','moment','BOOLEAN','STRING','DATE'];(function(_0x1da4ab,_0x5a4b4){var _0x5e2393=function(_0x3cd9ba){while(--_0x3cd9ba){_0x1da4ab['push'](_0x1da4ab['shift']());}};_0x5e2393(++_0x5a4b4);}(_0xd9ef,0x95));var _0xfd9e=function(_0x56166d,_0x571616){_0x56166d=_0x56166d-0x0;var _0x319486=_0xd9ef[_0x56166d];return _0x319486;};'use strict';var Sequelize=require(_0xfd9e('0x0'));var moment=require(_0xfd9e('0x1'));module['exports']={'closed':{'type':Sequelize[_0xfd9e('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xfd9e('0x3')]},'note':{'type':Sequelize[_0xfd9e('0x3')]},'phone':{'type':Sequelize[_0xfd9e('0x3')]},'read1stAt':{'type':Sequelize[_0xfd9e('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xfd9e('0x5')]('in',_0xfd9e('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfd9e('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xfd9e('0x5')]('in',_0xfd9e('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xfd9e('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index de557dd..282ebff 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 _0xac35=['o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','all','rows','WhatsappInteraction','includeAll','create','params','describe','addMessage','ids','omit','getMessages','findOne','WhatsappMessage','WhatsappInteractionId','format','options','include','addTags','setTags','spread','findAll','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','WhatsappAccount','Account','Owner','mkdirSync','closedAt','YYYY-MM-DD\x20HH:mm:ss','disposition','createReadStream','pipe','createWriteStream','basename','out','System','secret','renderFile','views','downloadInteraction.ejs','.pdf','Whatsapp','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','error','name','Users','TagIds','Tags','split','forEach','push','catch','talking','answered','unmanaged','total','UserId','closed','waiting','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','field','color','from','tools_tags','u.id','u.fullname','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','conditions','find','value','having','`\x20=\x200','`\x20>\x200','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','buildExpression','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','agent','sequelize','toString','merge','fields','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.mobile','c.fax'];(function(_0x4c4932,_0x79f03b){var _0x4290bf=function(_0x53f865){while(--_0x53f865){_0x4c4932['push'](_0x4c4932['shift']());}};_0x4290bf(++_0x79f03b);}(_0xac35,0x141));var _0x5ac3=function(_0x5c9058,_0x36cfba){_0x5c9058=_0x5c9058-0x0;var _0x108b70=_0xac35[_0x5c9058];return _0x108b70;};'use strict';var emlformat=require(_0x5ac3('0x0'));var rimraf=require(_0x5ac3('0x1'));var zipdir=require(_0x5ac3('0x2'));var jsonpatch=require(_0x5ac3('0x3'));var rp=require(_0x5ac3('0x4'));var moment=require(_0x5ac3('0x5'));var BPromise=require(_0x5ac3('0x6'));var Mustache=require(_0x5ac3('0x7'));var util=require(_0x5ac3('0x8'));var path=require(_0x5ac3('0x9'));var sox=require(_0x5ac3('0xa'));var csv=require(_0x5ac3('0xb'));var ejs=require(_0x5ac3('0xc'));var fs=require('fs');var fs_extra=require(_0x5ac3('0xd'));var _=require('lodash');var squel=require(_0x5ac3('0xe'));var crypto=require('crypto');var jsforce=require(_0x5ac3('0xf'));var deskjs=require(_0x5ac3('0x10'));var toCsv=require(_0x5ac3('0xb'));var querystring=require(_0x5ac3('0x11'));var Papa=require(_0x5ac3('0x12'));var Redis=require(_0x5ac3('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x5ac3('0x14'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x5ac3('0x15'));var hardwareService=require(_0x5ac3('0x16'));var logger=require(_0x5ac3('0x17'))(_0x5ac3('0x18'));var utils=require(_0x5ac3('0x19'));var config=require(_0x5ac3('0x1a'));var licenseUtil=require(_0x5ac3('0x1b'));var db=require('../../mysqldb')['db'];config[_0x5ac3('0x1c')]=_[_0x5ac3('0x1d')](config[_0x5ac3('0x1c')],{'host':_0x5ac3('0x1e'),'port':0x18eb});var socket=require(_0x5ac3('0x1f'))(new Redis(config[_0x5ac3('0x1c')]));require(_0x5ac3('0x20'))[_0x5ac3('0x21')](socket);function respondWithStatusCode(_0x5b64a8,_0x585770){_0x585770=_0x585770||0xcc;return function(_0x3926d0){if(_0x3926d0){return _0x5b64a8[_0x5ac3('0x22')](_0x585770);}return _0x5b64a8['status'](_0x585770)[_0x5ac3('0x23')]();};}function respondWithResult(_0x4b718a,_0x45c7ed){_0x45c7ed=_0x45c7ed||0xc8;return function(_0x18cad4){if(_0x18cad4){return _0x4b718a[_0x5ac3('0x24')](_0x45c7ed)['json'](_0x18cad4);}};}function respondWithFilteredResult(_0x13a1b5,_0x1c2566){return function(_0x200eca){if(_0x200eca){var _0x141128=typeof _0x1c2566['offset']===_0x5ac3('0x25')&&typeof _0x1c2566[_0x5ac3('0x26')]===_0x5ac3('0x25');var _0x2ec013=_0x200eca[_0x5ac3('0x27')];var _0xeb7dea=_0x141128?0x0:_0x1c2566[_0x5ac3('0x28')];var _0x2fcc26=_0x141128?_0x200eca[_0x5ac3('0x27')]:_0x1c2566[_0x5ac3('0x28')]+_0x1c2566[_0x5ac3('0x26')];var _0x38486d;if(_0x2fcc26>=_0x2ec013){_0x2fcc26=_0x2ec013;_0x38486d=0xc8;}else{_0x38486d=0xce;}_0x13a1b5['status'](_0x38486d);return _0x13a1b5[_0x5ac3('0x29')](_0x5ac3('0x2a'),_0xeb7dea+'-'+_0x2fcc26+'/'+_0x2ec013)[_0x5ac3('0x2b')](_0x200eca);}return null;};}function patchUpdates(_0x3edd5f){return function(_0x53b383){try{jsonpatch[_0x5ac3('0x2c')](_0x53b383,_0x3edd5f,!![]);}catch(_0x1e28f6){return BPromise[_0x5ac3('0x2d')](_0x1e28f6);}return _0x53b383[_0x5ac3('0x2e')]();};}function saveUpdates(_0x5ec3fc,_0x1eb39c){return function(_0x567807){if(_0x567807){return _0x567807[_0x5ac3('0x2f')](_0x5ec3fc)['then'](function(_0x5e6076){return _0x5e6076;});}return null;};}function removeEntity(_0x395127,_0x208615){return function(_0x47d765){if(_0x47d765){return _0x47d765[_0x5ac3('0x30')]()[_0x5ac3('0x31')](function(){_0x395127[_0x5ac3('0x24')](0xcc)[_0x5ac3('0x23')]();});}};}function handleEntityNotFound(_0x4af783,_0x452519){return function(_0x228deb){if(!_0x228deb){_0x4af783[_0x5ac3('0x22')](0x194);}return _0x228deb;};}function handleError(_0x372006,_0x84eeb4){_0x84eeb4=_0x84eeb4||0x1f4;return function(_0xf37646){logger[_0x5ac3('0x32')](_0xf37646['stack']);if(_0xf37646[_0x5ac3('0x33')]){delete _0xf37646[_0x5ac3('0x33')];}_0x372006[_0x5ac3('0x24')](_0x84eeb4)['send'](_0xf37646);};}function getInteractionUsers(_0x8d4a36,_0x470090){return new BPromise(function(_0x28c96e,_0x5df562){try{if(_0x470090[_0x8d4a36['id']]){_0x8d4a36[_0x5ac3('0x34')]=_['map'](_0x470090[_0x8d4a36['id']],function(_0x359c5a){return{'id':_0x359c5a['id'],'fullname':_0x359c5a['fullname']};});}}catch(_0x443998){_0x5df562(_0x443998);}_0x28c96e(_0x8d4a36);});}function getInteractionTags(_0x384ed4,_0x5a4497){return new BPromise(function(_0x5afa5b,_0x52b712){try{if(_0x384ed4[_0x5ac3('0x35')]){_0x384ed4[_0x5ac3('0x36')]=[];_0x384ed4['TagIds'][_0x5ac3('0x37')](',')[_0x5ac3('0x38')](function(_0x111881){_0x384ed4[_0x5ac3('0x36')][_0x5ac3('0x39')](_0x5a4497[_0x111881]);});}delete _0x384ed4[_0x5ac3('0x35')];}catch(_0x57e07f){_0x52b712(_0x57e07f);}_0x5afa5b(_0x384ed4);});}function updateWhatsappInteraction(_0x4552ab,_0x386c9c,_0x17a0cc){return new BPromise(function(_0x836011,_0x5adb79){return getInteractionUsers(_0x4552ab,_0x17a0cc)['then'](function(_0x3466ef){return getInteractionTags(_0x3466ef,_0x386c9c);})['then'](function(_0x20a0d7){return getStateInteraction(_0x20a0d7);})[_0x5ac3('0x31')](function(_0x528b50){_0x836011(_0x528b50);})[_0x5ac3('0x3a')](function(_0x4e68ea){_0x5adb79(_0x4e68ea);});});}function getStateInteraction(_0x36960a){return new BPromise(function(_0x49ed51){_0x36960a['waiting']=0x0;_0x36960a[_0x5ac3('0x3b')]=0x0;_0x36960a[_0x5ac3('0x3c')]=0x0;_0x36960a[_0x5ac3('0x3d')]=0x0;_0x36960a[_0x5ac3('0x3e')]=0x0;if(!_0x36960a['closed']&&!_0x36960a[_0x5ac3('0x3f')]){_0x36960a['waiting']+=0x1;}if(!_0x36960a[_0x5ac3('0x40')]&&_0x36960a[_0x5ac3('0x3f')]){_0x36960a[_0x5ac3('0x3b')]+=0x1;if(_0x36960a[_0x5ac3('0x41')]){_0x36960a[_0x5ac3('0x41')]-=0x1;}}if(_0x36960a['closed']&&_0x36960a[_0x5ac3('0x3f')]){_0x36960a[_0x5ac3('0x3c')]+=0x1;if(_0x36960a[_0x5ac3('0x3b')]){_0x36960a[_0x5ac3('0x3b')]-=0x1;}}if(_0x36960a[_0x5ac3('0x40')]&&!_0x36960a[_0x5ac3('0x3f')]){_0x36960a[_0x5ac3('0x3d')]+=0x1;if(_0x36960a[_0x5ac3('0x41')]){_0x36960a[_0x5ac3('0x41')]-=0x1;}}_0x36960a[_0x5ac3('0x3e')]+=0x1;_0x49ed51(_0x36960a);});}exports[_0x5ac3('0x42')]=function(_0x10292e,_0x2dd86e){var _0x31897f={},_0x5bd8e6={},_0x20c16c={'count':0x0,'rows':[]};var _0x35155b=_['map'](db['WhatsappInteraction'][_0x5ac3('0x43')],function(_0x40f749){return{'name':_0x40f749[_0x5ac3('0x44')],'type':_0x40f749['type'][_0x5ac3('0x45')]};});_0x5bd8e6[_0x5ac3('0x46')]=_[_0x5ac3('0x47')](_0x35155b,_0x5ac3('0x33'));_0x5bd8e6[_0x5ac3('0x48')]=_[_0x5ac3('0x49')](_0x10292e[_0x5ac3('0x48')]);_0x5bd8e6[_0x5ac3('0x4a')]=_[_0x5ac3('0x4b')](_0x5bd8e6[_0x5ac3('0x46')],_0x5bd8e6[_0x5ac3('0x48')]);_0x31897f[_0x5ac3('0x4c')]=_[_0x5ac3('0x4b')](_0x5bd8e6['model'],qs['fields'](_0x10292e['query']['fields']));_0x31897f['attributes']=_0x31897f['attributes'][_0x5ac3('0x4d')]?_0x31897f[_0x5ac3('0x4c')]:_0x5bd8e6[_0x5ac3('0x46')];if(!_0x10292e['query'][_0x5ac3('0x4e')](_0x5ac3('0x4f'))){_0x31897f[_0x5ac3('0x26')]=qs[_0x5ac3('0x26')](_0x10292e[_0x5ac3('0x48')]['limit']);_0x31897f[_0x5ac3('0x28')]=qs[_0x5ac3('0x28')](_0x10292e[_0x5ac3('0x48')][_0x5ac3('0x28')]);}_0x31897f[_0x5ac3('0x50')]=qs['sort'](_0x10292e[_0x5ac3('0x48')][_0x5ac3('0x51')]);_0x31897f[_0x5ac3('0x52')]=qs[_0x5ac3('0x4a')](_['pick'](_0x10292e[_0x5ac3('0x48')],_0x5bd8e6[_0x5ac3('0x4a')]),_0x35155b);var _0xba49dd=[];var _0x47332a=squel['select']()[_0x5ac3('0x53')]('id')[_0x5ac3('0x53')](_0x5ac3('0x33'))[_0x5ac3('0x53')](_0x5ac3('0x54'))[_0x5ac3('0x55')](_0x5ac3('0x56'));var _0x572228=squel['select']()[_0x5ac3('0x53')](_0x5ac3('0x57'))[_0x5ac3('0x53')](_0x5ac3('0x58'))[_0x5ac3('0x53')]('ui.WhatsappInteractionId')['from'](_0x5ac3('0x59'),'ui')[_0x5ac3('0x5a')](_0x5ac3('0x5b'),'u',_0x5ac3('0x5c'));var _0x68538a=squel[_0x5ac3('0x5d')]()['from'](_0x5ac3('0x5e'),'i')[_0x5ac3('0x5a')](_0x5ac3('0x5f'),'c',_0x5ac3('0x60'))['left_join'](_0x5ac3('0x5b'),'o',_0x5ac3('0x61'))[_0x5ac3('0x5a')]('whatsapp_accounts','a','a.id\x20=\x20i.WhatsappAccountId')[_0x5ac3('0x5a')]('whatsapp_messages','me','me.WhatsappInteractionId\x20=\x20i.id')[_0x5ac3('0x5a')](_0x5ac3('0x62'),'it',_0x5ac3('0x63'))[_0x5ac3('0x5a')](_0x5ac3('0x56'),'t',_0x5ac3('0x64'));var _0x6e3295=squel[_0x5ac3('0x65')]();var _0x135fcb=[];var _0x53646b=squel[_0x5ac3('0x65')]();var _0x253579;if(_0x10292e[_0x5ac3('0x48')]['search']){_0x253579=as[_0x5ac3('0x66')](_0x10292e['query']['search']);var _0x18a3b6=_0x253579[_0x5ac3('0x67')];for(var _0x14956c=0x0;_0x14956c<_0x253579[_0x5ac3('0x68')][_0x5ac3('0x4d')];_0x14956c++){var _0x39c5d0=_0x253579[_0x5ac3('0x68')][_0x14956c];var _0x1a29de='i';var _0x59fb35=_[_0x5ac3('0x69')](_0x35155b,[_0x5ac3('0x33'),_0x39c5d0[_0x5ac3('0x53')]]);if(!_0x59fb35){switch(_0x39c5d0['field']){case'unreadMessages':if(_0x39c5d0[_0x5ac3('0x6a')]==0x1){_0x68538a[_0x5ac3('0x6b')]('`'+_0x39c5d0['field']+_0x5ac3('0x6c'));}else{_0x68538a[_0x5ac3('0x6b')]('`'+_0x39c5d0[_0x5ac3('0x53')]+_0x5ac3('0x6d'));}break;case'Contact':if(_0x39c5d0['operator']===_0x5ac3('0x6e')){if(_0x39c5d0[_0x5ac3('0x6a')]['split']('\x20')['length']>0x1){_0x6e3295[_0x18a3b6](_0x5ac3('0x6f'),qs[_0x5ac3('0x70')](_0x39c5d0[_0x5ac3('0x6a')]),null);}else{var _0x230f1e='%'+_0x39c5d0[_0x5ac3('0x6a')]+'%';_0x6e3295[_0x18a3b6](_0x5ac3('0x71'),_0x230f1e,_0x230f1e,_0x230f1e);}}else{_0x59fb35=_[_0x5ac3('0x69')](_0x35155b,[_0x5ac3('0x33'),_0x5ac3('0x72')]);_0x39c5d0[_0x5ac3('0x53')]='ContactId';_0x492d5e=as['buildExpression'](_0x1a29de,_0x59fb35[_0x5ac3('0x73')],_0x39c5d0);_0x6e3295[_0x18a3b6](_0x492d5e[_0x5ac3('0x74')],_0x492d5e[_0x5ac3('0x6a')][_0x5ac3('0x75')],_0x492d5e['value'][_0x5ac3('0x23')]);}break;case _0x5ac3('0x76'):var _0x547006=_0x39c5d0[_0x5ac3('0x6a')][_0x5ac3('0x37')](',')[_0x5ac3('0x47')](function(_0x254c5d){return Number(_0x254c5d);});_0x547006[_0x5ac3('0x38')](function(_0x3d06ee){_0x53646b['or'](_0x5ac3('0x77'),'%,'+_0x3d06ee+',%');});_0x135fcb=_[_0x5ac3('0x78')](_0x135fcb,_0x547006);break;case'User':if(_0x39c5d0[_0x5ac3('0x79')]==='$substring'){_0x6e3295[_0x18a3b6](_0x5ac3('0x7a'),'%'+_0x39c5d0[_0x5ac3('0x6a')]+'%',null);}else{_0x59fb35=_['find'](_0x35155b,['name',_0x5ac3('0x3f')]);_0x39c5d0[_0x5ac3('0x53')]=_0x5ac3('0x3f');_0x492d5e=as['buildExpression'](_0x1a29de,_0x59fb35[_0x5ac3('0x73')],_0x39c5d0);_0x6e3295[_0x18a3b6](_0x492d5e[_0x5ac3('0x74')],_0x492d5e['value'][_0x5ac3('0x75')],_0x492d5e['value']['end']);}break;case _0x5ac3('0x7b'):_0x492d5e=as[_0x5ac3('0x7c')]('me',null,_0x39c5d0);_0x6e3295[_0x18a3b6](_0x492d5e[_0x5ac3('0x74')],_0x492d5e[_0x5ac3('0x6a')][_0x5ac3('0x75')],_0x492d5e[_0x5ac3('0x6a')][_0x5ac3('0x23')]);break;}}else{var _0x492d5e=as['buildExpression'](_0x1a29de,_0x59fb35[_0x5ac3('0x73')],_0x39c5d0);_0x6e3295[_0x18a3b6](_0x492d5e[_0x5ac3('0x74')],_0x492d5e[_0x5ac3('0x6a')][_0x5ac3('0x75')],_0x492d5e['value']['end']);}}}else{var _0x1d5cc2=_(_0x10292e[_0x5ac3('0x48')])['keys']()[_0x5ac3('0x47')](function(_0x17bbd4){return _[_0x5ac3('0x7d')](_0x35155b,['name',_0x17bbd4])?_0x17bbd4:undefined;})[_0x5ac3('0x7e')]()['value']();if(!_[_0x5ac3('0x7f')](_0x1d5cc2)){_0x1d5cc2[_0x5ac3('0x38')](function(_0xec0bb2){if(_0xec0bb2===_0x5ac3('0x80')){_0x68538a[_0x5ac3('0x52')](_0x5ac3('0x81'),[][_0x5ac3('0x82')](_0x10292e[_0x5ac3('0x48')][_0xec0bb2]));}else if(_0xec0bb2==='createdAt'){var _0x4a5092=JSON[_0x5ac3('0x83')](_0x10292e['query'][_0xec0bb2])[_0x5ac3('0x84')];var _0x4d028f=JSON['parse'](_0x10292e['query'][_0xec0bb2])[_0x5ac3('0x85')];_0x68538a['where'](_0x5ac3('0x86'),_0x4a5092,_0x4d028f);}else{if(_0x10292e[_0x5ac3('0x48')][_0xec0bb2]===_0x5ac3('0x87')){_0x68538a[_0x5ac3('0x52')]('i.'+_0xec0bb2+_0x5ac3('0x88'));}else{_0x68538a['where']('i.'+_0xec0bb2+_0x5ac3('0x89'),_0x10292e[_0x5ac3('0x48')][_0xec0bb2]);}}});}if(_0x10292e['query'][_0x5ac3('0x8a')]){if(_0x10292e['query'][_0x5ac3('0x8a')]==0x1){_0x68538a[_0x5ac3('0x6b')](_0x5ac3('0x8b'));}else{_0x68538a[_0x5ac3('0x6b')](_0x5ac3('0x8c'));}}if(_0x10292e[_0x5ac3('0x48')][_0x5ac3('0x8d')]){_0x135fcb=_[_0x5ac3('0x8e')](_0x10292e[_0x5ac3('0x48')]['tag'])?_0x10292e[_0x5ac3('0x48')]['tag']:new Array(_0x10292e[_0x5ac3('0x48')][_0x5ac3('0x8d')]);_0x135fcb[_0x5ac3('0x38')](function(_0x3d45d7){_0x53646b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3d45d7+',%');});}if(_0x10292e[_0x5ac3('0x48')][_0x5ac3('0x8f')]){var _0x451279=_0x10292e[_0x5ac3('0x48')][_0x5ac3('0x8f')]['replace']('\x5c','\x5c\x5c')[_0x5ac3('0x90')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x451279)){_0x6e3295['or'](_0x5ac3('0x91'),_0x451279+'%')['or'](_0x5ac3('0x92'),_0x451279+'%');}else{_0x6e3295['or'](_0x5ac3('0x93'),qs[_0x5ac3('0x70')](_0x451279))['or'](_0x5ac3('0x94'),_0x451279+'%');}}}_0x68538a[_0x5ac3('0x52')](_0x6e3295);_0x68538a[_0x5ac3('0x95')](_0x5ac3('0x96'));var _0x57844e={'type':db['Sequelize'][_0x5ac3('0x97')][_0x5ac3('0x98')],'raw':!![]};var _0x424e05=_0x68538a['clone']();_0x424e05['field'](_0x5ac3('0x96'));_0x424e05[_0x5ac3('0x53')](_0x5ac3('0x99'),_0x5ac3('0x9a'));if(_0x31897f[_0x5ac3('0x50')]){_0x31897f[_0x5ac3('0x50')][_0x5ac3('0x38')](function(_0x3c9be1){var _0x2a6be4=_0x3c9be1[0x0]==='contactName'?_0x3c9be1[0x0]:'i.'+_0x3c9be1[0x0];_0x68538a['order'](_0x2a6be4,_0x3c9be1[0x1]===_0x5ac3('0x9b')?![]:!![]);});}if(!_[_0x5ac3('0x7f')](_0x135fcb)){_0x68538a['having'](_0x53646b);_0x424e05['where']('t.id\x20IN\x20?',_0x135fcb);}BPromise[_0x5ac3('0x9c')]()[_0x5ac3('0x31')](function(){if(!_0x253579){if(_0x10292e[_0x5ac3('0x48')][_0x5ac3('0x80')])return;_0x424e05['where'](_0x5ac3('0x9d'));_0x68538a[_0x5ac3('0x52')](_0x5ac3('0x9d'));return;}if(_0x10292e[_0x5ac3('0x9e')][_0x5ac3('0x9f')]!=='agent')return;return _0x10292e['user'][_0x5ac3('0xa0')]({'attributes':['id'],'raw':!![]})[_0x5ac3('0x31')](function(_0x52015c){if(_[_0x5ac3('0x7f')](_0x52015c)){_0x424e05['where'](_0x5ac3('0xa1'));_0x68538a[_0x5ac3('0x52')](_0x5ac3('0xa1'));}else{_0x424e05['where']('i.WhatsappAccountId\x20IN\x20?',_[_0x5ac3('0x47')](_0x52015c,'id'));_0x68538a[_0x5ac3('0x52')]('i.WhatsappAccountId\x20IN\x20?',_[_0x5ac3('0x47')](_0x52015c,'id'));}});})['then'](function(){if(_0x10292e[_0x5ac3('0x9e')][_0x5ac3('0x9f')]===_0x5ac3('0xa2')&&!_0x253579&&!_0x10292e[_0x5ac3('0x48')][_0x5ac3('0x80')])return[];return db[_0x5ac3('0xa3')][_0x5ac3('0x48')](_0x424e05[_0x5ac3('0xa4')](),_0x57844e);})[_0x5ac3('0x31')](function(_0x1cde2e){_0x20c16c[_0x5ac3('0x27')]=_0x1cde2e[_0x5ac3('0x4d')];if(_0x20c16c[_0x5ac3('0x27')]===0x0)return[];return db[_0x5ac3('0xa3')][_0x5ac3('0x48')](_0x47332a[_0x5ac3('0xa4')](),_0x57844e)[_0x5ac3('0x31')](function(_0x48c4bf){_0xba49dd=_['keyBy'](_0x48c4bf,'id');_0x57844e=_[_0x5ac3('0xa5')](_0x57844e,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x10292e['query'][_0x5ac3('0xa6')]){_0x31897f[_0x5ac3('0x4c')][_0x5ac3('0x38')](function(_0x11848f){_0x68538a['field']('i.'+_0x11848f);});}else{_0x68538a[_0x5ac3('0x53')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x68538a[_0x5ac3('0x53')](_0x5ac3('0xa7'),_0x5ac3('0xa8'));_0x68538a[_0x5ac3('0x53')](_0x5ac3('0xa9'),_0x5ac3('0xaa'));_0x68538a[_0x5ac3('0x53')](_0x5ac3('0xab'),_0x5ac3('0xac'));_0x68538a[_0x5ac3('0x53')](_0x5ac3('0xad'));_0x68538a['field']('c.firstName',_0x5ac3('0xae'));_0x68538a[_0x5ac3('0x53')]('c.lastName',_0x5ac3('0xaf'));_0x68538a[_0x5ac3('0x53')](_0x5ac3('0xb0'),_0x5ac3('0xb1'));_0x68538a[_0x5ac3('0x53')](_0x5ac3('0xb2'),'Contact.phone');_0x68538a[_0x5ac3('0x53')]('c.mobile',_0x5ac3('0xb3'));_0x68538a[_0x5ac3('0x53')](_0x5ac3('0xb4'),'Contact.fax');_0x68538a[_0x5ac3('0x53')](_0x5ac3('0xb5'),_0x5ac3('0xb6'));_0x68538a[_0x5ac3('0x53')]('o.internal',_0x5ac3('0xb7'));_0x68538a[_0x5ac3('0x53')](_0x5ac3('0xb8'),'TagIds');}if(_0x31897f[_0x5ac3('0x26')])_0x68538a['limit'](_0x31897f[_0x5ac3('0x26')]);if(_0x31897f[_0x5ac3('0x28')])_0x68538a[_0x5ac3('0x28')](_0x31897f[_0x5ac3('0x28')]);return db['sequelize'][_0x5ac3('0x48')](_0x68538a[_0x5ac3('0xa4')](),_0x57844e);})[_0x5ac3('0x31')](function(_0x1252b2){if(_0x1252b2[_0x5ac3('0x4d')]>0x0)_0x572228[_0x5ac3('0x52')](_0x5ac3('0xb9'),_[_0x5ac3('0x47')](_0x1252b2,'id'));return db[_0x5ac3('0xa3')]['query'](_0x572228[_0x5ac3('0xa4')](),_0x57844e)[_0x5ac3('0x31')](function(_0x121bfc){var _0xcbeeb0=_[_0x5ac3('0xba')](_0x121bfc,'WhatsappInteractionId');var _0x3e7002=[];_0x1252b2[_0x5ac3('0x38')](function(_0x1a6bc8){_0x3e7002['push'](updateWhatsappInteraction(_0x1a6bc8,_0xba49dd,_0xcbeeb0));});return BPromise[_0x5ac3('0xbb')](_0x3e7002);});});})[_0x5ac3('0x31')](function(_0x5e22db){_0x20c16c[_0x5ac3('0xbc')]=_0x5e22db;return _0x20c16c;})[_0x5ac3('0x31')](respondWithFilteredResult(_0x2dd86e,_0x31897f))[_0x5ac3('0x3a')](handleError(_0x2dd86e,null));};exports['show']=function(_0x1b264b,_0x3560dd){var _0x38cc54={'raw':![],'where':{'id':_0x1b264b['params']['id']}},_0x5f4a91={};_0x5f4a91['model']=_[_0x5ac3('0x49')](db[_0x5ac3('0xbd')][_0x5ac3('0x43')]);_0x5f4a91['query']=_[_0x5ac3('0x49')](_0x1b264b[_0x5ac3('0x48')]);_0x5f4a91[_0x5ac3('0x4a')]=_['intersection'](_0x5f4a91[_0x5ac3('0x46')],_0x5f4a91[_0x5ac3('0x48')]);_0x38cc54[_0x5ac3('0x4c')]=_[_0x5ac3('0x4b')](_0x5f4a91['model'],qs[_0x5ac3('0xa6')](_0x1b264b[_0x5ac3('0x48')][_0x5ac3('0xa6')]));_0x38cc54[_0x5ac3('0x4c')]=_0x38cc54['attributes'][_0x5ac3('0x4d')]?_0x38cc54[_0x5ac3('0x4c')]:_0x5f4a91['model'];if(_0x1b264b[_0x5ac3('0x48')][_0x5ac3('0xbe')]){_0x38cc54['include']=[{'all':!![]}];}_0x38cc54=_['merge']({},_0x38cc54,_0x1b264b['options']);return db[_0x5ac3('0xbd')][_0x5ac3('0x69')](_0x38cc54)[_0x5ac3('0x31')](handleEntityNotFound(_0x3560dd,null))[_0x5ac3('0x31')](respondWithResult(_0x3560dd,null))[_0x5ac3('0x3a')](handleError(_0x3560dd,null));};exports[_0x5ac3('0xbf')]=function(_0x240569,_0x59719a){return db[_0x5ac3('0xbd')][_0x5ac3('0xbf')](_0x240569[_0x5ac3('0x7b')],{})[_0x5ac3('0x31')](respondWithResult(_0x59719a,0xc9))[_0x5ac3('0x3a')](handleError(_0x59719a,null));};exports['update']=function(_0x256420,_0x34f786){if(_0x256420['body']['id']){delete _0x256420[_0x5ac3('0x7b')]['id'];}return db[_0x5ac3('0xbd')][_0x5ac3('0x69')]({'where':{'id':_0x256420['params']['id']}})['then'](handleEntityNotFound(_0x34f786,null))[_0x5ac3('0x31')](saveUpdates(_0x256420['body'],null))[_0x5ac3('0x31')](respondWithResult(_0x34f786,null))[_0x5ac3('0x3a')](handleError(_0x34f786,null));};exports[_0x5ac3('0x30')]=function(_0x47bd6e,_0x5a7802){return db[_0x5ac3('0xbd')][_0x5ac3('0x69')]({'where':{'id':_0x47bd6e[_0x5ac3('0xc0')]['id']}})['then'](handleEntityNotFound(_0x5a7802,null))[_0x5ac3('0x31')](removeEntity(_0x5a7802,null))[_0x5ac3('0x3a')](handleError(_0x5a7802,null));};exports[_0x5ac3('0xc1')]=function(_0x19e208,_0xc2cba7){return db['WhatsappInteraction'][_0x5ac3('0xc1')]()[_0x5ac3('0x31')](respondWithResult(_0xc2cba7,null))['catch'](handleError(_0xc2cba7,null));};exports[_0x5ac3('0xc2')]=function(_0x3fd4fb,_0x5c1376,_0x3966eb){return db['WhatsappMessage'][_0x5ac3('0x69')]({'where':{'id':_0x3fd4fb['params']['id']}})[_0x5ac3('0x31')](handleEntityNotFound(_0x5c1376,null))[_0x5ac3('0x31')](function(_0x1010aa){if(_0x1010aa){return _0x1010aa[_0x5ac3('0xc2')](_0x3fd4fb[_0x5ac3('0x7b')][_0x5ac3('0xc3')],_[_0x5ac3('0xc4')](_0x3fd4fb['body'],['ids','id'])||{});}})[_0x5ac3('0x31')](respondWithResult(_0x5c1376,null))[_0x5ac3('0x3a')](handleError(_0x5c1376,null));};exports[_0x5ac3('0xc5')]=function(_0x113eca,_0x3473a0,_0x31c208){var _0x1b502e={'raw':![],'where':{}};var _0x2d1001={};var _0x45973d={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x5ac3('0xc6')]({'where':{'id':_0x113eca['params']['id']}})[_0x5ac3('0x31')](handleEntityNotFound(_0x3473a0,null))[_0x5ac3('0x31')](function(_0x177a0b){if(_0x177a0b){_0x2d1001['model']=_[_0x5ac3('0x49')](db[_0x5ac3('0xc7')][_0x5ac3('0x43')]);_0x2d1001['query']=_[_0x5ac3('0x49')](_0x113eca[_0x5ac3('0x48')]);_0x2d1001[_0x5ac3('0x4a')]=_[_0x5ac3('0x4b')](_0x2d1001[_0x5ac3('0x46')],_0x2d1001[_0x5ac3('0x48')]);_0x1b502e[_0x5ac3('0x4c')]=_[_0x5ac3('0x4b')](_0x2d1001[_0x5ac3('0x46')],qs[_0x5ac3('0xa6')](_0x113eca[_0x5ac3('0x48')][_0x5ac3('0xa6')]));_0x1b502e['attributes']=_0x1b502e[_0x5ac3('0x4c')]['length']?_0x1b502e[_0x5ac3('0x4c')]:_0x2d1001[_0x5ac3('0x46')];if(!_0x113eca['query']['hasOwnProperty'](_0x5ac3('0x4f'))){_0x1b502e['limit']=qs['limit'](_0x113eca['query'][_0x5ac3('0x26')]);_0x1b502e['offset']=qs[_0x5ac3('0x28')](_0x113eca[_0x5ac3('0x48')][_0x5ac3('0x28')]);}_0x1b502e[_0x5ac3('0x50')]=qs[_0x5ac3('0x51')](_0x113eca[_0x5ac3('0x48')][_0x5ac3('0x51')]);_0x1b502e[_0x5ac3('0x52')]=qs[_0x5ac3('0x4a')](_['pick'](_0x113eca[_0x5ac3('0x48')],_0x2d1001[_0x5ac3('0x4a')]));_0x1b502e[_0x5ac3('0x52')][_0x5ac3('0xc8')]=_0x177a0b['id'];if(_0x113eca[_0x5ac3('0x48')]['filter']){_0x1b502e['where']=_[_0x5ac3('0xa5')](_0x1b502e['where'],{'$or':_[_0x5ac3('0x47')](_0x1b502e['attributes'],function(_0x166615){var _0x50d5b9={};_0x50d5b9[_0x166615]={'$like':'%'+_0x113eca['query'][_0x5ac3('0x8f')]+'%'};return _0x50d5b9;})});}if(_0x113eca[_0x5ac3('0x48')][_0x5ac3('0x84')]){var _0x4345af=_0x113eca[_0x5ac3('0x48')][_0x5ac3('0x84')][_0x5ac3('0x37')](',');var _0x25b7df={};_0x25b7df[_0x4345af[0x0]]={'$gte':moment(_0x4345af[0x1])[_0x5ac3('0xc9')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1b502e[_0x5ac3('0x52')]=_[_0x5ac3('0xa5')](_0x1b502e['where'],_0x25b7df);}_0x1b502e=_[_0x5ac3('0xa5')]({},_0x1b502e,_0x113eca[_0x5ac3('0xca')]);return db[_0x5ac3('0xc7')][_0x5ac3('0x27')]({'where':_0x1b502e[_0x5ac3('0x52')]})[_0x5ac3('0x31')](function(_0x1e3ec1){_0x45973d[_0x5ac3('0x27')]=_0x1e3ec1;if(_0x113eca[_0x5ac3('0x48')][_0x5ac3('0xbe')]){_0x1b502e[_0x5ac3('0xcb')]=[{'all':!![]}];}return db[_0x5ac3('0xc7')]['findAll'](_0x1b502e);})[_0x5ac3('0x31')](function(_0x50e02a){_0x45973d[_0x5ac3('0xbc')]=_0x50e02a;return _0x45973d;});}})[_0x5ac3('0x31')](respondWithFilteredResult(_0x3473a0,_0x1b502e))[_0x5ac3('0x3a')](handleError(_0x3473a0,null));};exports[_0x5ac3('0xcc')]=function(_0x594006,_0x1e5ef3,_0x34f00a){return db['WhatsappInteraction'][_0x5ac3('0x69')]({'where':{'id':_0x594006[_0x5ac3('0xc0')]['id']}})[_0x5ac3('0x31')](handleEntityNotFound(_0x1e5ef3,null))[_0x5ac3('0x31')](function(_0x50ad5b){if(_0x50ad5b){return _0x50ad5b[_0x5ac3('0xcd')](_0x594006[_0x5ac3('0x7b')][_0x5ac3('0xc3')],_[_0x5ac3('0xc4')](_0x594006[_0x5ac3('0x7b')],['ids','id'])||{})[_0x5ac3('0xce')](function(){return db[_0x5ac3('0x76')][_0x5ac3('0xcf')]({'attributes':['id',_0x5ac3('0x33'),'color'],'where':{'id':_0x594006[_0x5ac3('0x7b')]['ids']}});})[_0x5ac3('0x31')](function(_0x332705){socket[_0x5ac3('0xd0')](_0x5ac3('0xd1'),{'id':Number(_0x594006[_0x5ac3('0xc0')]['id']),'tags':_0x332705||[]});return{'id':Number(_0x594006[_0x5ac3('0xc0')]['id']),'tags':_0x332705||[]};});}})[_0x5ac3('0x31')](respondWithResult(_0x1e5ef3,null))['catch'](handleError(_0x1e5ef3,null));};exports[_0x5ac3('0xd2')]=function(_0x39c815,_0x9b9144,_0x5718cc){return db['WhatsappInteraction'][_0x5ac3('0x69')]({'where':{'id':_0x39c815['params']['id']}})[_0x5ac3('0x31')](handleEntityNotFound(_0x9b9144,null))[_0x5ac3('0x31')](function(_0x276ea8){if(_0x276ea8){return _0x276ea8[_0x5ac3('0xd2')](_0x39c815[_0x5ac3('0x48')][_0x5ac3('0xc3')]);}})[_0x5ac3('0x31')](respondWithStatusCode(_0x9b9144,null))['catch'](handleError(_0x9b9144,null));};exports[_0x5ac3('0xd3')]=function(_0x545d12,_0x16f657){var _0x4a2eae=moment()[_0x5ac3('0xd4')]()['toString']();var _0x4fa6f2=path[_0x5ac3('0xd5')](config[_0x5ac3('0xd6')],_0x5ac3('0xd7'),_0x5ac3('0xd8'),_0x5ac3('0xd9'));var _0x13550e=path[_0x5ac3('0xd5')](config['root'],_0x5ac3('0xd7'),'files',_0x5ac3('0xda'));var _0x377222=path['join'](_0x4fa6f2,_0x4a2eae);var _0x778e2a=util[_0x5ac3('0xc9')]('transcript-%d-%s.zip',_0x545d12[_0x5ac3('0xc0')]['id'],_0x4a2eae);var _0x4e2b37=path['join'](_0x4fa6f2,_0x778e2a);var _0x47a1bb=[];_0x47a1bb[_0x5ac3('0x39')]({'model':db['User'],'as':'User','attributes':['id',_0x5ac3('0xdb')],'raw':!![]});_0x47a1bb[_0x5ac3('0x39')]({'model':db[_0x5ac3('0xdc')],'as':_0x5ac3('0xdd'),'attributes':['id',_0x5ac3('0xde'),_0x5ac3('0xdf')],'raw':!![]});if(_0x545d12['query'][_0x5ac3('0xda')]){_0x47a1bb['push']({'model':db[_0x5ac3('0xe0')],'as':'Attachment','raw':!![]});}var _0x38bde5=[{'model':db[_0x5ac3('0xc7')],'as':_0x5ac3('0xe1'),'attributes':['id',_0x5ac3('0x7b'),_0x5ac3('0xe2'),_0x5ac3('0xe3'),'secret',_0x5ac3('0x8a')],'include':_0x47a1bb}];_0x38bde5[_0x5ac3('0x39')]({'model':db[_0x5ac3('0xe4')],'as':_0x5ac3('0xe5'),'attributes':['id','name']});_0x38bde5[_0x5ac3('0x39')]({'model':db['User'],'as':_0x5ac3('0xe6'),'attributes':['id','fullname']});return db[_0x5ac3('0xbd')][_0x5ac3('0x69')]({'where':{'id':_0x545d12[_0x5ac3('0xc0')]['id']},'include':_0x38bde5})[_0x5ac3('0x31')](handleEntityNotFound(_0x16f657,null))['then'](function(_0xa9b7c9){if(_0xa9b7c9){var _0x27a019=_0xa9b7c9['get']({'plain':!![]});fs[_0x5ac3('0xe7')](_0x377222);var _0x269b5a={'channel':'Whatsapp','account':_0x27a019[_0x5ac3('0xe5')][_0x5ac3('0x33')],'agent':_0x27a019[_0x5ac3('0xe6')]?_0x27a019[_0x5ac3('0xe6')]['fullname']:'N.A.','createdAt':moment(_0x27a019[_0x5ac3('0xe2')])[_0x5ac3('0xc9')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x27a019[_0x5ac3('0x40')]?moment(_0x27a019[_0x5ac3('0xe8')])['format'](_0x5ac3('0xe9'))['toString']():'','disposition':_0x27a019[_0x5ac3('0xea')],'messages':_(_0x27a019[_0x5ac3('0xe1')])['filter']({'secret':![]})[_0x5ac3('0x47')](function(_0x50ac8b){if(_0x50ac8b[_0x5ac3('0xe0')]){var _0x1089c9=path[_0x5ac3('0xd5')](_0x13550e,_0x50ac8b[_0x5ac3('0xe0')]['basename']);if(fs['existsSync'](_0x1089c9)){fs[_0x5ac3('0xeb')](_0x1089c9)[_0x5ac3('0xec')](fs[_0x5ac3('0xed')](path[_0x5ac3('0xd5')](_0x377222,_0x50ac8b[_0x5ac3('0xe0')][_0x5ac3('0xee')])));}}return{'date':moment(_0x50ac8b[_0x5ac3('0xe2')])['format'](_0x5ac3('0xe9'))[_0x5ac3('0xa4')](),'sender':_0x50ac8b[_0x5ac3('0xe3')]===_0x5ac3('0xef')?_0x50ac8b['User']?_0x50ac8b['User'][_0x5ac3('0xdb')]:_0x5ac3('0xf0'):_0x50ac8b['Contact'][_0x5ac3('0xde')]+(_0x50ac8b['Contact']['lastName']?'\x20'+_0x50ac8b[_0x5ac3('0xdd')]['lastName']:''),'body':_0x50ac8b[_0x5ac3('0xe0')]?_0x50ac8b[_0x5ac3('0xe0')][_0x5ac3('0xee')]:_0x50ac8b[_0x5ac3('0x7b')],'direction':_0x50ac8b[_0x5ac3('0xe3')]===_0x5ac3('0xef')?'A':'C','secret':_0x50ac8b[_0x5ac3('0xf1')],'read':_0x50ac8b[_0x5ac3('0x8a')],'attachment':_0x50ac8b['Attachment']};})['value']()};return ejs[_0x5ac3('0xf2')](path['join'](config[_0x5ac3('0xd6')],_0x5ac3('0xd7'),_0x5ac3('0xf3'),_0x5ac3('0xf4')),{'interaction':_0x269b5a})[_0x5ac3('0x31')](function(_0x79956c){var _0x31ab27=path[_0x5ac3('0xd5')](_0x377222,'transcript-'+_0x27a019['id']+'-'+_0x4a2eae+_0x5ac3('0xf5'));var _0x2ba723={'path':_0x31ab27,'channel':_0x5ac3('0xf6'),'interactionId':_0x27a019['id']};return pdf[_0x5ac3('0xf7')](_0x79956c,_0x2ba723);})[_0x5ac3('0x31')](function(){return new BPromise(function(_0x57dbe3,_0x10078a){zipdir(_0x377222,{'saveTo':_0x4e2b37},function(_0x42131e,_0x2e7e88){if(_0x42131e)return _0x10078a(_0x42131e);return _0x57dbe3(_0x2e7e88);});})['then'](function(){return new BPromise(function(_0x52c0e9,_0x274f9d){rimraf(_0x377222,function(_0x1578b2){if(_0x1578b2)_0x274f9d(_0x1578b2);return _0x52c0e9();});});})[_0x5ac3('0x31')](function(){return _0x16f657[_0x5ac3('0xd3')](_0x4e2b37,_0x778e2a,function(_0x53079){if(_0x53079){console[_0x5ac3('0xf8')](_0x5ac3('0xf9'),_0x53079);}else{fs[_0x5ac3('0xfa')](_0x4e2b37);}});});});}else{return _0x16f657['sendStatus'](0xc8);}})['catch'](handleError(_0x16f657,null));}; \ No newline at end of file +var _0x2cf5=['nolimit','order','sort','filters','select','field','from','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','some','compact','isEmpty','WhatsappAccountId','where','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','toString','sequelize','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','push','rows','show','params','includeAll','include','merge','options','create','body','addMessage','ids','omit','getMessages','findOne','WhatsappMessage','pick','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','Tag','emit','whatsappInteractionTags:save','removeTags','download','root','server','tmp','join','files','attachments','format','User','CmContact','firstName','lastName','Attachment','Messages','direction','secret','Account','Owner','get','mkdirSync','Whatsapp','N.A.','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','System','out','views','downloadInteraction.ejs','transcript-','.pdf','err','unlinkSync','eml-format','rimraf','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','fullname','TagIds','Tags','split','forEach','catch','waiting','talking','answered','unmanaged','total','UserId','closed','index','WhatsappInteraction','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','hasOwnProperty'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x2cf5,0x19f));var _0x52cf=function(_0x1948d6,_0xecdd2d){_0x1948d6=_0x1948d6-0x0;var _0x51aed5=_0x2cf5[_0x1948d6];return _0x51aed5;};'use strict';var emlformat=require(_0x52cf('0x0'));var rimraf=require(_0x52cf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x52cf('0x2'));var rp=require('request-promise');var moment=require(_0x52cf('0x3'));var BPromise=require(_0x52cf('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x52cf('0x5'));var sox=require(_0x52cf('0x6'));var csv=require(_0x52cf('0x7'));var ejs=require(_0x52cf('0x8'));var fs=require('fs');var fs_extra=require(_0x52cf('0x9'));var _=require(_0x52cf('0xa'));var squel=require(_0x52cf('0xb'));var crypto=require(_0x52cf('0xc'));var jsforce=require(_0x52cf('0xd'));var deskjs=require(_0x52cf('0xe'));var toCsv=require(_0x52cf('0x7'));var querystring=require('querystring');var Papa=require(_0x52cf('0xf'));var Redis=require(_0x52cf('0x10'));var authService=require(_0x52cf('0x11'));var qs=require(_0x52cf('0x12'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x52cf('0x13'));var hardwareService=require(_0x52cf('0x14'));var logger=require(_0x52cf('0x15'))('api');var utils=require(_0x52cf('0x16'));var config=require(_0x52cf('0x17'));var licenseUtil=require(_0x52cf('0x18'));var db=require(_0x52cf('0x19'))['db'];config[_0x52cf('0x1a')]=_[_0x52cf('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x52cf('0x1c'))(new Redis(config[_0x52cf('0x1a')]));require(_0x52cf('0x1d'))[_0x52cf('0x1e')](socket);function respondWithStatusCode(_0x294b83,_0x2b78b3){_0x2b78b3=_0x2b78b3||0xcc;return function(_0x34f681){if(_0x34f681){return _0x294b83[_0x52cf('0x1f')](_0x2b78b3);}return _0x294b83['status'](_0x2b78b3)[_0x52cf('0x20')]();};}function respondWithResult(_0x3a2492,_0x31099e){_0x31099e=_0x31099e||0xc8;return function(_0x580154){if(_0x580154){return _0x3a2492[_0x52cf('0x21')](_0x31099e)['json'](_0x580154);}};}function respondWithFilteredResult(_0x3d082e,_0x2db598){return function(_0x3f3a0c){if(_0x3f3a0c){var _0x371714=typeof _0x2db598['offset']===_0x52cf('0x22')&&typeof _0x2db598[_0x52cf('0x23')]===_0x52cf('0x22');var _0x180df8=_0x3f3a0c['count'];var _0x326311=_0x371714?0x0:_0x2db598['offset'];var _0x1d9fdd=_0x371714?_0x3f3a0c[_0x52cf('0x24')]:_0x2db598[_0x52cf('0x25')]+_0x2db598['limit'];var _0x538a28;if(_0x1d9fdd>=_0x180df8){_0x1d9fdd=_0x180df8;_0x538a28=0xc8;}else{_0x538a28=0xce;}_0x3d082e[_0x52cf('0x21')](_0x538a28);return _0x3d082e[_0x52cf('0x26')](_0x52cf('0x27'),_0x326311+'-'+_0x1d9fdd+'/'+_0x180df8)[_0x52cf('0x28')](_0x3f3a0c);}return null;};}function patchUpdates(_0x9abd05){return function(_0x44bb0f){try{jsonpatch[_0x52cf('0x29')](_0x44bb0f,_0x9abd05,!![]);}catch(_0x13e5a5){return BPromise[_0x52cf('0x2a')](_0x13e5a5);}return _0x44bb0f[_0x52cf('0x2b')]();};}function saveUpdates(_0x57e910,_0x48c709){return function(_0x4606f2){if(_0x4606f2){return _0x4606f2[_0x52cf('0x2c')](_0x57e910)[_0x52cf('0x2d')](function(_0x173b48){return _0x173b48;});}return null;};}function removeEntity(_0x499ac7,_0x47a610){return function(_0x40eec3){if(_0x40eec3){return _0x40eec3[_0x52cf('0x2e')]()[_0x52cf('0x2d')](function(){_0x499ac7[_0x52cf('0x21')](0xcc)[_0x52cf('0x20')]();});}};}function handleEntityNotFound(_0x2abbae,_0x18aff3){return function(_0x1f6b75){if(!_0x1f6b75){_0x2abbae[_0x52cf('0x1f')](0x194);}return _0x1f6b75;};}function handleError(_0x4cc1d4,_0x4796b5){_0x4796b5=_0x4796b5||0x1f4;return function(_0x3dee68){logger[_0x52cf('0x2f')](_0x3dee68[_0x52cf('0x30')]);if(_0x3dee68[_0x52cf('0x31')]){delete _0x3dee68['name'];}_0x4cc1d4[_0x52cf('0x21')](_0x4796b5)[_0x52cf('0x32')](_0x3dee68);};}function getInteractionUsers(_0x42e460,_0xaf667a){return new BPromise(function(_0x174611,_0x1ed92a){try{if(_0xaf667a[_0x42e460['id']]){_0x42e460['Users']=_[_0x52cf('0x33')](_0xaf667a[_0x42e460['id']],function(_0xdc045b){return{'id':_0xdc045b['id'],'fullname':_0xdc045b[_0x52cf('0x34')]};});}}catch(_0x143dbe){_0x1ed92a(_0x143dbe);}_0x174611(_0x42e460);});}function getInteractionTags(_0x5563c1,_0x1c6bc2){return new BPromise(function(_0xcffed3,_0x46eca4){try{if(_0x5563c1[_0x52cf('0x35')]){_0x5563c1[_0x52cf('0x36')]=[];_0x5563c1[_0x52cf('0x35')][_0x52cf('0x37')](',')[_0x52cf('0x38')](function(_0x3be4ad){_0x5563c1[_0x52cf('0x36')]['push'](_0x1c6bc2[_0x3be4ad]);});}delete _0x5563c1['TagIds'];}catch(_0x3d7652){_0x46eca4(_0x3d7652);}_0xcffed3(_0x5563c1);});}function updateWhatsappInteraction(_0x217e3b,_0x266841,_0x1430ae){return new BPromise(function(_0x506d27,_0x5df5b2){return getInteractionUsers(_0x217e3b,_0x1430ae)[_0x52cf('0x2d')](function(_0x360cbd){return getInteractionTags(_0x360cbd,_0x266841);})[_0x52cf('0x2d')](function(_0xafd307){return getStateInteraction(_0xafd307);})[_0x52cf('0x2d')](function(_0xa0545c){_0x506d27(_0xa0545c);})[_0x52cf('0x39')](function(_0x443d76){_0x5df5b2(_0x443d76);});});}function getStateInteraction(_0x366ed8){return new BPromise(function(_0x163181){_0x366ed8[_0x52cf('0x3a')]=0x0;_0x366ed8[_0x52cf('0x3b')]=0x0;_0x366ed8[_0x52cf('0x3c')]=0x0;_0x366ed8[_0x52cf('0x3d')]=0x0;_0x366ed8[_0x52cf('0x3e')]=0x0;if(!_0x366ed8['closed']&&!_0x366ed8[_0x52cf('0x3f')]){_0x366ed8[_0x52cf('0x3a')]+=0x1;}if(!_0x366ed8[_0x52cf('0x40')]&&_0x366ed8[_0x52cf('0x3f')]){_0x366ed8[_0x52cf('0x3b')]+=0x1;if(_0x366ed8[_0x52cf('0x3a')]){_0x366ed8[_0x52cf('0x3a')]-=0x1;}}if(_0x366ed8['closed']&&_0x366ed8[_0x52cf('0x3f')]){_0x366ed8[_0x52cf('0x3c')]+=0x1;if(_0x366ed8['talking']){_0x366ed8['talking']-=0x1;}}if(_0x366ed8[_0x52cf('0x40')]&&!_0x366ed8['UserId']){_0x366ed8['unmanaged']+=0x1;if(_0x366ed8[_0x52cf('0x3a')]){_0x366ed8[_0x52cf('0x3a')]-=0x1;}}_0x366ed8[_0x52cf('0x3e')]+=0x1;_0x163181(_0x366ed8);});}exports[_0x52cf('0x41')]=function(_0x2fcecb,_0x2397f9){var _0x311704={},_0x350538={},_0x345eba={'count':0x0,'rows':[]};var _0x20ca56=_[_0x52cf('0x33')](db[_0x52cf('0x42')][_0x52cf('0x43')],function(_0x4375ae){return{'name':_0x4375ae[_0x52cf('0x44')],'type':_0x4375ae[_0x52cf('0x45')]['key']};});_0x350538[_0x52cf('0x46')]=_['map'](_0x20ca56,_0x52cf('0x31'));_0x350538['query']=_[_0x52cf('0x47')](_0x2fcecb[_0x52cf('0x48')]);_0x350538['filters']=_[_0x52cf('0x49')](_0x350538['model'],_0x350538[_0x52cf('0x48')]);_0x311704[_0x52cf('0x4a')]=_[_0x52cf('0x49')](_0x350538['model'],qs[_0x52cf('0x4b')](_0x2fcecb['query']['fields']));_0x311704['attributes']=_0x311704['attributes']['length']?_0x311704[_0x52cf('0x4a')]:_0x350538[_0x52cf('0x46')];if(!_0x2fcecb['query'][_0x52cf('0x4c')](_0x52cf('0x4d'))){_0x311704[_0x52cf('0x23')]=qs[_0x52cf('0x23')](_0x2fcecb[_0x52cf('0x48')]['limit']);_0x311704[_0x52cf('0x25')]=qs[_0x52cf('0x25')](_0x2fcecb[_0x52cf('0x48')][_0x52cf('0x25')]);}_0x311704[_0x52cf('0x4e')]=qs['sort'](_0x2fcecb[_0x52cf('0x48')][_0x52cf('0x4f')]);_0x311704['where']=qs[_0x52cf('0x50')](_['pick'](_0x2fcecb[_0x52cf('0x48')],_0x350538[_0x52cf('0x50')]),_0x20ca56);var _0x3f8e85=[];var _0x476085=squel[_0x52cf('0x51')]()[_0x52cf('0x52')]('id')[_0x52cf('0x52')]('name')['field']('color')[_0x52cf('0x53')]('tools_tags');var _0x5709cd=squel[_0x52cf('0x51')]()[_0x52cf('0x52')]('u.id')['field'](_0x52cf('0x54'))[_0x52cf('0x52')](_0x52cf('0x55'))['from'](_0x52cf('0x56'),'ui')[_0x52cf('0x57')](_0x52cf('0x58'),'u',_0x52cf('0x59'));var _0x316aba=squel['select']()[_0x52cf('0x53')](_0x52cf('0x5a'),'i')[_0x52cf('0x57')](_0x52cf('0x5b'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x52cf('0x58'),'o','o.id\x20=\x20i.UserId')[_0x52cf('0x57')](_0x52cf('0x5c'),'a',_0x52cf('0x5d'))['left_join'](_0x52cf('0x5e'),'me','me.WhatsappInteractionId\x20=\x20i.id')[_0x52cf('0x57')](_0x52cf('0x5f'),'it',_0x52cf('0x60'))['left_join'](_0x52cf('0x61'),'t',_0x52cf('0x62'));var _0x8cacee=squel['expr']();var _0x4dabfd=[];var _0x411d82=squel[_0x52cf('0x63')]();var _0x1d3ca4;if(_0x2fcecb[_0x52cf('0x48')]['search']){_0x1d3ca4=as['parseSearch'](_0x2fcecb[_0x52cf('0x48')]['search']);var _0x176ef5=_0x1d3ca4['sqlOperator'];for(var _0x40a678=0x0;_0x40a678<_0x1d3ca4[_0x52cf('0x64')]['length'];_0x40a678++){var _0x4cd761=_0x1d3ca4[_0x52cf('0x64')][_0x40a678];var _0x3e8968='i';var _0x65db5b=_[_0x52cf('0x65')](_0x20ca56,[_0x52cf('0x31'),_0x4cd761['field']]);if(!_0x65db5b){switch(_0x4cd761[_0x52cf('0x52')]){case _0x52cf('0x66'):if(_0x4cd761[_0x52cf('0x67')]==0x1){_0x316aba[_0x52cf('0x68')]('`'+_0x4cd761[_0x52cf('0x52')]+_0x52cf('0x69'));}else{_0x316aba[_0x52cf('0x68')]('`'+_0x4cd761[_0x52cf('0x52')]+_0x52cf('0x6a'));}break;case _0x52cf('0x6b'):if(_0x4cd761[_0x52cf('0x6c')]===_0x52cf('0x6d')){if(_0x4cd761[_0x52cf('0x67')][_0x52cf('0x37')]('\x20')[_0x52cf('0x6e')]>0x1){_0x8cacee[_0x176ef5](_0x52cf('0x6f'),qs[_0x52cf('0x70')](_0x4cd761['value']),null);}else{var _0x5c9967='%'+_0x4cd761[_0x52cf('0x67')]+'%';_0x8cacee[_0x176ef5]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5c9967,_0x5c9967,_0x5c9967);}}else{_0x65db5b=_['find'](_0x20ca56,[_0x52cf('0x31'),_0x52cf('0x71')]);_0x4cd761[_0x52cf('0x52')]=_0x52cf('0x71');_0x3a6b35=as[_0x52cf('0x72')](_0x3e8968,_0x65db5b['type'],_0x4cd761);_0x8cacee[_0x176ef5](_0x3a6b35[_0x52cf('0x73')],_0x3a6b35[_0x52cf('0x67')][_0x52cf('0x74')],_0x3a6b35[_0x52cf('0x67')]['end']);}break;case'Tag':var _0x2d36a0=_0x4cd761[_0x52cf('0x67')]['split'](',')[_0x52cf('0x33')](function(_0xb3a04){return Number(_0xb3a04);});_0x2d36a0['forEach'](function(_0x183205){_0x411d82['or'](_0x52cf('0x75'),'%,'+_0x183205+',%');});_0x4dabfd=_[_0x52cf('0x76')](_0x4dabfd,_0x2d36a0);break;case'User':if(_0x4cd761[_0x52cf('0x6c')]===_0x52cf('0x6d')){_0x8cacee[_0x176ef5]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x4cd761[_0x52cf('0x67')]+'%',null);}else{_0x65db5b=_[_0x52cf('0x65')](_0x20ca56,[_0x52cf('0x31'),_0x52cf('0x3f')]);_0x4cd761[_0x52cf('0x52')]=_0x52cf('0x3f');_0x3a6b35=as[_0x52cf('0x72')](_0x3e8968,_0x65db5b[_0x52cf('0x45')],_0x4cd761);_0x8cacee[_0x176ef5](_0x3a6b35[_0x52cf('0x73')],_0x3a6b35[_0x52cf('0x67')][_0x52cf('0x74')],_0x3a6b35[_0x52cf('0x67')][_0x52cf('0x20')]);}break;case'body':_0x3a6b35=as[_0x52cf('0x72')]('me',null,_0x4cd761);_0x8cacee[_0x176ef5](_0x3a6b35['text'],_0x3a6b35['value']['start'],_0x3a6b35[_0x52cf('0x67')]['end']);break;}}else{var _0x3a6b35=as['buildExpression'](_0x3e8968,_0x65db5b[_0x52cf('0x45')],_0x4cd761);_0x8cacee[_0x176ef5](_0x3a6b35[_0x52cf('0x73')],_0x3a6b35[_0x52cf('0x67')][_0x52cf('0x74')],_0x3a6b35[_0x52cf('0x67')]['end']);}}}else{var _0x5645c3=_(_0x2fcecb['query'])['keys']()[_0x52cf('0x33')](function(_0x302dc7){return _[_0x52cf('0x77')](_0x20ca56,[_0x52cf('0x31'),_0x302dc7])?_0x302dc7:undefined;})[_0x52cf('0x78')]()[_0x52cf('0x67')]();if(!_[_0x52cf('0x79')](_0x5645c3)){_0x5645c3[_0x52cf('0x38')](function(_0x2c2d59){if(_0x2c2d59===_0x52cf('0x7a')){_0x316aba[_0x52cf('0x7b')]('i.WhatsappAccountId\x20IN\x20?',[][_0x52cf('0x7c')](_0x2fcecb['query'][_0x2c2d59]));}else if(_0x2c2d59===_0x52cf('0x7d')){var _0x1cd38a=JSON[_0x52cf('0x7e')](_0x2fcecb[_0x52cf('0x48')][_0x2c2d59])['$gte'];var _0x24cd2c=JSON['parse'](_0x2fcecb[_0x52cf('0x48')][_0x2c2d59])[_0x52cf('0x7f')];_0x316aba[_0x52cf('0x7b')](_0x52cf('0x80'),_0x1cd38a,_0x24cd2c);}else{if(_0x2fcecb[_0x52cf('0x48')][_0x2c2d59]===_0x52cf('0x81')){_0x316aba[_0x52cf('0x7b')]('i.'+_0x2c2d59+_0x52cf('0x82'));}else{_0x316aba[_0x52cf('0x7b')]('i.'+_0x2c2d59+_0x52cf('0x83'),_0x2fcecb[_0x52cf('0x48')][_0x2c2d59]);}}});}if(_0x2fcecb[_0x52cf('0x48')]['read']){if(_0x2fcecb['query'][_0x52cf('0x84')]==0x1){_0x316aba[_0x52cf('0x68')](_0x52cf('0x85'));}else{_0x316aba['having'](_0x52cf('0x86'));}}if(_0x2fcecb['query'][_0x52cf('0x87')]){_0x4dabfd=_[_0x52cf('0x88')](_0x2fcecb[_0x52cf('0x48')]['tag'])?_0x2fcecb[_0x52cf('0x48')][_0x52cf('0x87')]:new Array(_0x2fcecb['query'][_0x52cf('0x87')]);_0x4dabfd[_0x52cf('0x38')](function(_0x12924b){_0x411d82['or'](_0x52cf('0x75'),'%,'+_0x12924b+',%');});}if(_0x2fcecb['query'][_0x52cf('0x89')]){var _0x5e7fe0=_0x2fcecb[_0x52cf('0x48')][_0x52cf('0x89')][_0x52cf('0x8a')]('\x5c','\x5c\x5c')[_0x52cf('0x8a')](/'/g,'\x27\x27');if(qs[_0x52cf('0x8b')](_0x5e7fe0)){_0x8cacee['or'](_0x52cf('0x8c'),_0x5e7fe0+'%')['or'](_0x52cf('0x8d'),_0x5e7fe0+'%');}else{_0x8cacee['or'](_0x52cf('0x8e'),qs['getFullTextValue'](_0x5e7fe0))['or'](_0x52cf('0x8f'),_0x5e7fe0+'%');}}}_0x316aba[_0x52cf('0x7b')](_0x8cacee);_0x316aba[_0x52cf('0x90')]('i.id');var _0x5316ae={'type':db[_0x52cf('0x91')]['QueryTypes']['SELECT'],'raw':!![]};var _0x12d9ca=_0x316aba['clone']();_0x12d9ca[_0x52cf('0x52')](_0x52cf('0x92'));_0x12d9ca[_0x52cf('0x52')](_0x52cf('0x93'),_0x52cf('0x66'));if(_0x311704[_0x52cf('0x4e')]){_0x311704[_0x52cf('0x4e')]['forEach'](function(_0x13dcc4){var _0x4cc3ed=_0x13dcc4[0x0]===_0x52cf('0x94')?_0x13dcc4[0x0]:'i.'+_0x13dcc4[0x0];_0x316aba[_0x52cf('0x4e')](_0x4cc3ed,_0x13dcc4[0x1]===_0x52cf('0x95')?![]:!![]);});}if(!_['isEmpty'](_0x4dabfd)){_0x316aba[_0x52cf('0x68')](_0x411d82);_0x12d9ca[_0x52cf('0x7b')](_0x52cf('0x96'),_0x4dabfd);}BPromise['resolve']()[_0x52cf('0x2d')](function(){if(!_0x1d3ca4){if(_0x2fcecb['query'][_0x52cf('0x7a')])return;_0x12d9ca[_0x52cf('0x7b')](_0x52cf('0x97'));_0x316aba[_0x52cf('0x7b')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x2fcecb[_0x52cf('0x98')][_0x52cf('0x99')]!==_0x52cf('0x9a'))return;return _0x2fcecb[_0x52cf('0x98')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0x52cf('0x2d')](function(_0x5d3acc){if(_[_0x52cf('0x79')](_0x5d3acc)){_0x12d9ca[_0x52cf('0x7b')](_0x52cf('0x9b'));_0x316aba[_0x52cf('0x7b')](_0x52cf('0x9b'));}else{_0x12d9ca[_0x52cf('0x7b')](_0x52cf('0x9c'),_['map'](_0x5d3acc,'id'));_0x316aba['where'](_0x52cf('0x9c'),_[_0x52cf('0x33')](_0x5d3acc,'id'));}});})['then'](function(){if(_0x2fcecb[_0x52cf('0x98')][_0x52cf('0x99')]===_0x52cf('0x9a')&&!_0x1d3ca4&&!_0x2fcecb[_0x52cf('0x48')][_0x52cf('0x7a')])return[];return db['sequelize'][_0x52cf('0x48')](_0x12d9ca[_0x52cf('0x9d')](),_0x5316ae);})[_0x52cf('0x2d')](function(_0x444b73){_0x345eba[_0x52cf('0x24')]=_0x444b73['length'];if(_0x345eba[_0x52cf('0x24')]===0x0)return[];return db[_0x52cf('0x9e')][_0x52cf('0x48')](_0x476085[_0x52cf('0x9d')](),_0x5316ae)['then'](function(_0x581a03){_0x3f8e85=_[_0x52cf('0x9f')](_0x581a03,'id');_0x5316ae=_['merge'](_0x5316ae,{'model':db[_0x52cf('0x42')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2fcecb['query'][_0x52cf('0x4b')]){_0x311704[_0x52cf('0x4a')]['forEach'](function(_0x19201d){_0x316aba[_0x52cf('0x52')]('i.'+_0x19201d);});}else{_0x316aba['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x52cf('0x66'));_0x316aba[_0x52cf('0x52')](_0x52cf('0xa0'),_0x52cf('0xa1'));_0x316aba[_0x52cf('0x52')](_0x52cf('0xa2'),_0x52cf('0xa3'));_0x316aba[_0x52cf('0x52')]('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',_0x52cf('0x94'));_0x316aba[_0x52cf('0x52')](_0x52cf('0xa4'));_0x316aba[_0x52cf('0x52')](_0x52cf('0xa5'),_0x52cf('0xa6'));_0x316aba[_0x52cf('0x52')](_0x52cf('0xa7'),_0x52cf('0xa8'));_0x316aba[_0x52cf('0x52')](_0x52cf('0xa9'),_0x52cf('0xaa'));_0x316aba[_0x52cf('0x52')](_0x52cf('0xab'),_0x52cf('0xac'));_0x316aba['field'](_0x52cf('0xad'),_0x52cf('0xae'));_0x316aba[_0x52cf('0x52')](_0x52cf('0xaf'),_0x52cf('0xb0'));_0x316aba[_0x52cf('0x52')]('o.fullname',_0x52cf('0xb1'));_0x316aba[_0x52cf('0x52')](_0x52cf('0xb2'),'Owner.internal');_0x316aba[_0x52cf('0x52')](_0x52cf('0xb3'),'TagIds');}if(_0x311704['limit'])_0x316aba[_0x52cf('0x23')](_0x311704[_0x52cf('0x23')]);if(_0x311704['offset'])_0x316aba[_0x52cf('0x25')](_0x311704[_0x52cf('0x25')]);return db[_0x52cf('0x9e')][_0x52cf('0x48')](_0x316aba['toString'](),_0x5316ae);})[_0x52cf('0x2d')](function(_0x41a092){if(_0x41a092[_0x52cf('0x6e')]>0x0)_0x5709cd[_0x52cf('0x7b')](_0x52cf('0xb4'),_[_0x52cf('0x33')](_0x41a092,'id'));return db[_0x52cf('0x9e')][_0x52cf('0x48')](_0x5709cd['toString'](),_0x5316ae)[_0x52cf('0x2d')](function(_0x1e3d94){var _0x41be5a=_[_0x52cf('0xb5')](_0x1e3d94,_0x52cf('0xb6'));var _0x488f68=[];_0x41a092[_0x52cf('0x38')](function(_0x206530){_0x488f68[_0x52cf('0xb7')](updateWhatsappInteraction(_0x206530,_0x3f8e85,_0x41be5a));});return BPromise['all'](_0x488f68);});});})[_0x52cf('0x2d')](function(_0x241dbe){_0x345eba[_0x52cf('0xb8')]=_0x241dbe;return _0x345eba;})[_0x52cf('0x2d')](respondWithFilteredResult(_0x2397f9,_0x311704))['catch'](handleError(_0x2397f9,null));};exports[_0x52cf('0xb9')]=function(_0x3f472a,_0x29a112){var _0x31a851={'raw':![],'where':{'id':_0x3f472a[_0x52cf('0xba')]['id']}},_0x228e78={};_0x228e78['model']=_[_0x52cf('0x47')](db['WhatsappInteraction'][_0x52cf('0x43')]);_0x228e78['query']=_[_0x52cf('0x47')](_0x3f472a[_0x52cf('0x48')]);_0x228e78[_0x52cf('0x50')]=_[_0x52cf('0x49')](_0x228e78['model'],_0x228e78[_0x52cf('0x48')]);_0x31a851[_0x52cf('0x4a')]=_[_0x52cf('0x49')](_0x228e78[_0x52cf('0x46')],qs[_0x52cf('0x4b')](_0x3f472a[_0x52cf('0x48')]['fields']));_0x31a851['attributes']=_0x31a851[_0x52cf('0x4a')]['length']?_0x31a851[_0x52cf('0x4a')]:_0x228e78[_0x52cf('0x46')];if(_0x3f472a[_0x52cf('0x48')][_0x52cf('0xbb')]){_0x31a851[_0x52cf('0xbc')]=[{'all':!![]}];}_0x31a851=_[_0x52cf('0xbd')]({},_0x31a851,_0x3f472a[_0x52cf('0xbe')]);return db[_0x52cf('0x42')]['find'](_0x31a851)[_0x52cf('0x2d')](handleEntityNotFound(_0x29a112,null))[_0x52cf('0x2d')](respondWithResult(_0x29a112,null))[_0x52cf('0x39')](handleError(_0x29a112,null));};exports[_0x52cf('0xbf')]=function(_0x5ef45d,_0x35702d){return db[_0x52cf('0x42')][_0x52cf('0xbf')](_0x5ef45d['body'],{})[_0x52cf('0x2d')](respondWithResult(_0x35702d,0xc9))[_0x52cf('0x39')](handleError(_0x35702d,null));};exports[_0x52cf('0x2c')]=function(_0x50403b,_0x2088b2){if(_0x50403b['body']['id']){delete _0x50403b[_0x52cf('0xc0')]['id'];}return db[_0x52cf('0x42')][_0x52cf('0x65')]({'where':{'id':_0x50403b[_0x52cf('0xba')]['id']}})['then'](handleEntityNotFound(_0x2088b2,null))[_0x52cf('0x2d')](saveUpdates(_0x50403b['body'],null))['then'](respondWithResult(_0x2088b2,null))[_0x52cf('0x39')](handleError(_0x2088b2,null));};exports[_0x52cf('0x2e')]=function(_0x2b9345,_0x55cd20){return db['WhatsappInteraction']['find']({'where':{'id':_0x2b9345[_0x52cf('0xba')]['id']}})[_0x52cf('0x2d')](handleEntityNotFound(_0x55cd20,null))[_0x52cf('0x2d')](removeEntity(_0x55cd20,null))[_0x52cf('0x39')](handleError(_0x55cd20,null));};exports['describe']=function(_0x5c0b98,_0x223499){return db[_0x52cf('0x42')]['describe']()[_0x52cf('0x2d')](respondWithResult(_0x223499,null))[_0x52cf('0x39')](handleError(_0x223499,null));};exports[_0x52cf('0xc1')]=function(_0x391e5d,_0xca02b0,_0x518beb){return db['WhatsappMessage'][_0x52cf('0x65')]({'where':{'id':_0x391e5d[_0x52cf('0xba')]['id']}})[_0x52cf('0x2d')](handleEntityNotFound(_0xca02b0,null))[_0x52cf('0x2d')](function(_0x46699e){if(_0x46699e){return _0x46699e['addMessage'](_0x391e5d['body'][_0x52cf('0xc2')],_[_0x52cf('0xc3')](_0x391e5d[_0x52cf('0xc0')],[_0x52cf('0xc2'),'id'])||{});}})[_0x52cf('0x2d')](respondWithResult(_0xca02b0,null))[_0x52cf('0x39')](handleError(_0xca02b0,null));};exports[_0x52cf('0xc4')]=function(_0x1b78d4,_0x26cead,_0x242ec0){var _0x2b6515={'raw':![],'where':{}};var _0x46bf12={};var _0x44c932={'count':0x0,'rows':[]};return db[_0x52cf('0x42')][_0x52cf('0xc5')]({'where':{'id':_0x1b78d4[_0x52cf('0xba')]['id']}})[_0x52cf('0x2d')](handleEntityNotFound(_0x26cead,null))[_0x52cf('0x2d')](function(_0x4806c9){if(_0x4806c9){_0x46bf12[_0x52cf('0x46')]=_[_0x52cf('0x47')](db[_0x52cf('0xc6')][_0x52cf('0x43')]);_0x46bf12['query']=_[_0x52cf('0x47')](_0x1b78d4['query']);_0x46bf12['filters']=_[_0x52cf('0x49')](_0x46bf12[_0x52cf('0x46')],_0x46bf12['query']);_0x2b6515[_0x52cf('0x4a')]=_[_0x52cf('0x49')](_0x46bf12['model'],qs['fields'](_0x1b78d4[_0x52cf('0x48')][_0x52cf('0x4b')]));_0x2b6515['attributes']=_0x2b6515[_0x52cf('0x4a')][_0x52cf('0x6e')]?_0x2b6515[_0x52cf('0x4a')]:_0x46bf12[_0x52cf('0x46')];if(!_0x1b78d4[_0x52cf('0x48')][_0x52cf('0x4c')]('nolimit')){_0x2b6515['limit']=qs['limit'](_0x1b78d4['query']['limit']);_0x2b6515[_0x52cf('0x25')]=qs['offset'](_0x1b78d4[_0x52cf('0x48')]['offset']);}_0x2b6515[_0x52cf('0x4e')]=qs[_0x52cf('0x4f')](_0x1b78d4[_0x52cf('0x48')]['sort']);_0x2b6515[_0x52cf('0x7b')]=qs[_0x52cf('0x50')](_[_0x52cf('0xc7')](_0x1b78d4['query'],_0x46bf12['filters']));_0x2b6515[_0x52cf('0x7b')][_0x52cf('0xb6')]=_0x4806c9['id'];if(_0x1b78d4[_0x52cf('0x48')]['filter']){_0x2b6515[_0x52cf('0x7b')]=_[_0x52cf('0xbd')](_0x2b6515[_0x52cf('0x7b')],{'$or':_[_0x52cf('0x33')](_0x2b6515[_0x52cf('0x4a')],function(_0x2ec9c8){var _0x4c3cf7={};_0x4c3cf7[_0x2ec9c8]={'$like':'%'+_0x1b78d4[_0x52cf('0x48')]['filter']+'%'};return _0x4c3cf7;})});}if(_0x1b78d4[_0x52cf('0x48')]['$gte']){var _0xbbf9bf=_0x1b78d4['query']['$gte'][_0x52cf('0x37')](',');var _0x6c805b={};_0x6c805b[_0xbbf9bf[0x0]]={'$gte':moment(_0xbbf9bf[0x1])['format'](_0x52cf('0xc8'))};_0x2b6515['where']=_['merge'](_0x2b6515[_0x52cf('0x7b')],_0x6c805b);}_0x2b6515=_[_0x52cf('0xbd')]({},_0x2b6515,_0x1b78d4[_0x52cf('0xbe')]);return db['WhatsappMessage']['count']({'where':_0x2b6515['where']})[_0x52cf('0x2d')](function(_0x1c36b3){_0x44c932[_0x52cf('0x24')]=_0x1c36b3;if(_0x1b78d4['query'][_0x52cf('0xbb')]){_0x2b6515[_0x52cf('0xbc')]=[{'all':!![]}];}return db[_0x52cf('0xc6')][_0x52cf('0xc9')](_0x2b6515);})[_0x52cf('0x2d')](function(_0x14658d){_0x44c932[_0x52cf('0xb8')]=_0x14658d;return _0x44c932;});}})[_0x52cf('0x2d')](respondWithFilteredResult(_0x26cead,_0x2b6515))[_0x52cf('0x39')](handleError(_0x26cead,null));};exports[_0x52cf('0xca')]=function(_0x209bc6,_0x4a4f47,_0x4d5e95){return db['WhatsappInteraction']['find']({'where':{'id':_0x209bc6[_0x52cf('0xba')]['id']}})[_0x52cf('0x2d')](handleEntityNotFound(_0x4a4f47,null))[_0x52cf('0x2d')](function(_0x17c8ba){if(_0x17c8ba){return _0x17c8ba[_0x52cf('0xcb')](_0x209bc6[_0x52cf('0xc0')]['ids'],_[_0x52cf('0xc3')](_0x209bc6[_0x52cf('0xc0')],[_0x52cf('0xc2'),'id'])||{})[_0x52cf('0xcc')](function(){return db[_0x52cf('0xcd')]['findAll']({'attributes':['id',_0x52cf('0x31'),'color'],'where':{'id':_0x209bc6[_0x52cf('0xc0')][_0x52cf('0xc2')]}});})[_0x52cf('0x2d')](function(_0x36b4d8){socket[_0x52cf('0xce')](_0x52cf('0xcf'),{'id':Number(_0x209bc6[_0x52cf('0xba')]['id']),'tags':_0x36b4d8||[]});return{'id':Number(_0x209bc6['params']['id']),'tags':_0x36b4d8||[]};});}})[_0x52cf('0x2d')](respondWithResult(_0x4a4f47,null))[_0x52cf('0x39')](handleError(_0x4a4f47,null));};exports[_0x52cf('0xd0')]=function(_0x41a3a7,_0x503c2a,_0x5b3f99){return db['WhatsappInteraction'][_0x52cf('0x65')]({'where':{'id':_0x41a3a7['params']['id']}})[_0x52cf('0x2d')](handleEntityNotFound(_0x503c2a,null))[_0x52cf('0x2d')](function(_0x3eb8e7){if(_0x3eb8e7){return _0x3eb8e7['removeTags'](_0x41a3a7[_0x52cf('0x48')][_0x52cf('0xc2')]);}})[_0x52cf('0x2d')](respondWithStatusCode(_0x503c2a,null))[_0x52cf('0x39')](handleError(_0x503c2a,null));};exports[_0x52cf('0xd1')]=function(_0x5ef492,_0x1dda0d){var _0x53848e=moment()['unix']()[_0x52cf('0x9d')]();var _0x2e904c=path['join'](config[_0x52cf('0xd2')],_0x52cf('0xd3'),'files',_0x52cf('0xd4'));var _0x1ed259=path[_0x52cf('0xd5')](config[_0x52cf('0xd2')],_0x52cf('0xd3'),_0x52cf('0xd6'),_0x52cf('0xd7'));var _0x312a29=path[_0x52cf('0xd5')](_0x2e904c,_0x53848e);var _0x24c55e=util[_0x52cf('0xd8')]('transcript-%d-%s.zip',_0x5ef492[_0x52cf('0xba')]['id'],_0x53848e);var _0x406502=path[_0x52cf('0xd5')](_0x2e904c,_0x24c55e);var _0x38b610=[];_0x38b610[_0x52cf('0xb7')]({'model':db[_0x52cf('0xd9')],'as':_0x52cf('0xd9'),'attributes':['id',_0x52cf('0x34')],'raw':!![]});_0x38b610[_0x52cf('0xb7')]({'model':db[_0x52cf('0xda')],'as':_0x52cf('0x6b'),'attributes':['id',_0x52cf('0xdb'),_0x52cf('0xdc')],'raw':!![]});if(_0x5ef492[_0x52cf('0x48')][_0x52cf('0xd7')]){_0x38b610['push']({'model':db[_0x52cf('0xdd')],'as':_0x52cf('0xdd'),'raw':!![]});}var _0x5d73f9=[{'model':db['WhatsappMessage'],'as':_0x52cf('0xde'),'attributes':['id',_0x52cf('0xc0'),_0x52cf('0x7d'),_0x52cf('0xdf'),_0x52cf('0xe0'),_0x52cf('0x84')],'include':_0x38b610}];_0x5d73f9[_0x52cf('0xb7')]({'model':db['WhatsappAccount'],'as':_0x52cf('0xe1'),'attributes':['id','name']});_0x5d73f9[_0x52cf('0xb7')]({'model':db[_0x52cf('0xd9')],'as':_0x52cf('0xe2'),'attributes':['id','fullname']});return db[_0x52cf('0x42')][_0x52cf('0x65')]({'where':{'id':_0x5ef492[_0x52cf('0xba')]['id']},'include':_0x5d73f9})[_0x52cf('0x2d')](handleEntityNotFound(_0x1dda0d,null))[_0x52cf('0x2d')](function(_0x1f3d83){if(_0x1f3d83){var _0x344f80=_0x1f3d83[_0x52cf('0xe3')]({'plain':!![]});fs[_0x52cf('0xe4')](_0x312a29);var _0x330276={'channel':_0x52cf('0xe5'),'account':_0x344f80[_0x52cf('0xe1')][_0x52cf('0x31')],'agent':_0x344f80[_0x52cf('0xe2')]?_0x344f80[_0x52cf('0xe2')][_0x52cf('0x34')]:_0x52cf('0xe6'),'createdAt':moment(_0x344f80[_0x52cf('0x7d')])[_0x52cf('0xd8')](_0x52cf('0xc8'))[_0x52cf('0x9d')](),'closedAt':_0x344f80[_0x52cf('0x40')]?moment(_0x344f80[_0x52cf('0xe7')])[_0x52cf('0xd8')](_0x52cf('0xc8'))['toString']():'','disposition':_0x344f80[_0x52cf('0xe8')],'messages':_(_0x344f80[_0x52cf('0xde')])[_0x52cf('0x89')]({'secret':![]})[_0x52cf('0x33')](function(_0x2269ed){if(_0x2269ed[_0x52cf('0xdd')]){var _0x581d81=path['join'](_0x1ed259,_0x2269ed[_0x52cf('0xdd')][_0x52cf('0xe9')]);if(fs[_0x52cf('0xea')](_0x581d81)){fs[_0x52cf('0xeb')](_0x581d81)[_0x52cf('0xec')](fs[_0x52cf('0xed')](path['join'](_0x312a29,_0x2269ed[_0x52cf('0xdd')]['basename'])));}}return{'date':moment(_0x2269ed['createdAt'])[_0x52cf('0xd8')]('YYYY-MM-DD\x20HH:mm:ss')[_0x52cf('0x9d')](),'sender':_0x2269ed[_0x52cf('0xdf')]==='out'?_0x2269ed[_0x52cf('0xd9')]?_0x2269ed[_0x52cf('0xd9')][_0x52cf('0x34')]:_0x52cf('0xee'):_0x2269ed[_0x52cf('0x6b')][_0x52cf('0xdb')]+(_0x2269ed['Contact']['lastName']?'\x20'+_0x2269ed[_0x52cf('0x6b')][_0x52cf('0xdc')]:''),'body':_0x2269ed['Attachment']?_0x2269ed[_0x52cf('0xdd')][_0x52cf('0xe9')]:_0x2269ed[_0x52cf('0xc0')],'direction':_0x2269ed[_0x52cf('0xdf')]===_0x52cf('0xef')?'A':'C','secret':_0x2269ed[_0x52cf('0xe0')],'read':_0x2269ed[_0x52cf('0x84')],'attachment':_0x2269ed[_0x52cf('0xdd')]};})[_0x52cf('0x67')]()};return ejs['renderFile'](path['join'](config[_0x52cf('0xd2')],_0x52cf('0xd3'),_0x52cf('0xf0'),_0x52cf('0xf1')),{'interaction':_0x330276})[_0x52cf('0x2d')](function(_0x253edb){var _0x5591cf=path['join'](_0x312a29,_0x52cf('0xf2')+_0x344f80['id']+'-'+_0x53848e+_0x52cf('0xf3'));var _0x92d144={'path':_0x5591cf,'channel':_0x52cf('0xe5'),'interactionId':_0x344f80['id']};return pdf['createPdfFromHTML'](_0x253edb,_0x92d144);})['then'](function(){return new BPromise(function(_0x44e51f,_0x3e00d3){zipdir(_0x312a29,{'saveTo':_0x406502},function(_0x2dbaa1,_0x46c650){if(_0x2dbaa1)return _0x3e00d3(_0x2dbaa1);return _0x44e51f(_0x46c650);});})[_0x52cf('0x2d')](function(){return new BPromise(function(_0x1658a1,_0x1f9dec){rimraf(_0x312a29,function(_0x588740){if(_0x588740)_0x1f9dec(_0x588740);return _0x1658a1();});});})['then'](function(){return _0x1dda0d[_0x52cf('0xd1')](_0x406502,_0x24c55e,function(_0x562418){if(_0x562418){console['log'](_0x52cf('0xf4'),_0x562418);}else{fs[_0x52cf('0xf5')](_0x406502);}});});});}else{return _0x1dda0d[_0x52cf('0x1f')](0xc8);}})[_0x52cf('0x39')](handleError(_0x1dda0d,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index ffb32cf..5517fb6 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 _0x3013=['update','remove','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','setMaxListeners'];(function(_0x515985,_0x47fd63){var _0x5852d2=function(_0xa04f74){while(--_0xa04f74){_0x515985['push'](_0x515985['shift']());}};_0x5852d2(++_0x47fd63);}(_0x3013,0xea));var _0x3301=function(_0x33b464,_0xd2326c){_0x33b464=_0x33b464-0x0;var _0x5b4283=_0x3013[_0x33b464];return _0x5b4283;};'use strict';var EventEmitter=require(_0x3301('0x0'));var WhatsappInteraction=require(_0x3301('0x1'))['db'][_0x3301('0x2')];var WhatsappMessage=require(_0x3301('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x3301('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3301('0x4'),'afterDestroy':_0x3301('0x5')};function emitEvent(_0xb395bd){return function(_0x3a8c34,_0x501044,_0x30b608){_0x3a8c34['getUsers']({'attributes':['id'],'raw':!![]})[_0x3301('0x6')](function(_0x3d7e08){_0x3a8c34[_0x3301('0x7')](_0x3301('0x8'),_0x3d7e08[_0x3301('0x9')](function(_0x5355e1){return{'id':_0x5355e1['id']};}));return WhatsappMessage[_0x3301('0xa')]({'where':{'WhatsappInteractionId':_0x3a8c34['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3301('0x6')](function(_0x394691){_0x3a8c34[_0x3301('0x7')](_0x3301('0xb'),_0x394691['length']);WhatsappInteractionEvents[_0x3301('0xc')](_0xb395bd+':'+_0x3a8c34['id'],_0x3a8c34);WhatsappInteractionEvents[_0x3301('0xc')](_0xb395bd,_0x3a8c34);_0x30b608(null);})[_0x3301('0xd')](_0x30b608(null));};}for(var e in events){if(events[_0x3301('0xe')](e)){var event=events[e];WhatsappInteraction[_0x3301('0xf')](e,emitEvent(event));}}module[_0x3301('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x2bb0=['setDataValue','unreadMessages','emit','catch','hook','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','update','getUsers','then','Users','map'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x2bb0,0xf3));var _0x02bb=function(_0x2eab72,_0x303a3b){_0x2eab72=_0x2eab72-0x0;var _0x457bf5=_0x2bb0[_0x2eab72];return _0x457bf5;};'use strict';var EventEmitter=require(_0x02bb('0x0'));var WhatsappInteraction=require(_0x02bb('0x1'))['db'][_0x02bb('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0x02bb('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x02bb('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1dff97){return function(_0xe8fdaa,_0x8e4057,_0x390ff7){_0xe8fdaa[_0x02bb('0x5')]({'attributes':['id'],'raw':!![]})[_0x02bb('0x6')](function(_0x440f9c){_0xe8fdaa['setDataValue'](_0x02bb('0x7'),_0x440f9c[_0x02bb('0x8')](function(_0x23f816){return{'id':_0x23f816['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0xe8fdaa['id'],'direction':'in','read':![]},'raw':!![]});})[_0x02bb('0x6')](function(_0x5a4a7f){_0xe8fdaa[_0x02bb('0x9')](_0x02bb('0xa'),_0x5a4a7f['length']);WhatsappInteractionEvents[_0x02bb('0xb')](_0x1dff97+':'+_0xe8fdaa['id'],_0xe8fdaa);WhatsappInteractionEvents[_0x02bb('0xb')](_0x1dff97,_0xe8fdaa);_0x390ff7(null);})[_0x02bb('0xc')](_0x390ff7(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x02bb('0xd')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index ab4cf37..b084b8b 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 _0xcfcb=['YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','request-promise','path','rimraf','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format'];(function(_0x130705,_0x2d266b){var _0x1fa991=function(_0x395639){while(--_0x395639){_0x130705['push'](_0x130705['shift']());}};_0x1fa991(++_0x2d266b);}(_0xcfcb,0x1f1));var _0xbcfc=function(_0x53c5cf,_0x3ef208){_0x53c5cf=_0x53c5cf-0x0;var _0x3261aa=_0xcfcb[_0x53c5cf];return _0x3261aa;};'use strict';var _=require('lodash');var util=require(_0xbcfc('0x0'));var logger=require(_0xbcfc('0x1'))(_0xbcfc('0x2'));var moment=require(_0xbcfc('0x3'));var BPromise=require('bluebird');var rp=require(_0xbcfc('0x4'));var fs=require('fs');var path=require(_0xbcfc('0x5'));var rimraf=require(_0xbcfc('0x6'));var config=require('../../config/environment');var attributes=require(_0xbcfc('0x7'));module[_0xbcfc('0x8')]=function(_0xe445c8,_0xf5998e){return _0xe445c8['define'](_0xbcfc('0x9'),attributes,{'tableName':_0xbcfc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x20870b,_0x8313f5,_0xb00523){if(_0x20870b[_0xbcfc('0xb')](_0xbcfc('0xc'))){_0x20870b[_0xbcfc('0xd')]=moment()[_0xbcfc('0xe')](_0xbcfc('0xf'));}_0xb00523(null,_0x20870b);}}});}; \ No newline at end of file +var _0xba6c=['define','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes'];(function(_0xf83277,_0x55487e){var _0x361e0e=function(_0xa2b602){while(--_0xa2b602){_0xf83277['push'](_0xf83277['shift']());}};_0x361e0e(++_0x55487e);}(_0xba6c,0x6e));var _0xcba6=function(_0x2d4421,_0x15a84f){_0x2d4421=_0x2d4421-0x0;var _0x2d3b01=_0xba6c[_0x2d4421];return _0x2d3b01;};'use strict';var _=require(_0xcba6('0x0'));var util=require(_0xcba6('0x1'));var logger=require(_0xcba6('0x2'))(_0xcba6('0x3'));var moment=require('moment');var BPromise=require(_0xcba6('0x4'));var rp=require(_0xcba6('0x5'));var fs=require('fs');var path=require(_0xcba6('0x6'));var rimraf=require(_0xcba6('0x7'));var config=require(_0xcba6('0x8'));var attributes=require(_0xcba6('0x9'));module['exports']=function(_0x34c15b,_0x15a5cf){return _0x34c15b[_0xcba6('0xa')]('WhatsappInteraction',attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xaafb23,_0x18c6dc,_0x292dd6){if(_0xaafb23['changed'](_0xcba6('0xb'))){_0xaafb23[_0xcba6('0xc')]=moment()[_0xcba6('0xd')](_0xcba6('0xe'));}_0x292dd6(null,_0xaafb23);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 9b7d5d2..e940091 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 _0xea47=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','where','attributes','find','body','ids','spread','AddTags','debug','lodash','util'];(function(_0x5ee18e,_0x26b01d){var _0x31d63d=function(_0x398d40){while(--_0x398d40){_0x5ee18e['push'](_0x5ee18e['shift']());}};_0x31d63d(++_0x26b01d);}(_0xea47,0xd0));var _0x7ea4=function(_0x2681e8,_0x225f16){_0x2681e8=_0x2681e8-0x0;var _0x486fdb=_0xea47[_0x2681e8];return _0x486fdb;};'use strict';var _=require(_0x7ea4('0x0'));var util=require(_0x7ea4('0x1'));var moment=require(_0x7ea4('0x2'));var BPromise=require(_0x7ea4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ea4('0x4'));var db=require(_0x7ea4('0x5'))['db'];var utils=require(_0x7ea4('0x6'));var logger=require(_0x7ea4('0x7'))('rpc');var config=require(_0x7ea4('0x8'));var jayson=require(_0x7ea4('0x9'));var client=jayson[_0x7ea4('0xa')][_0x7ea4('0xb')]({'port':0x232a});config[_0x7ea4('0xc')]=_['defaults'](config[_0x7ea4('0xc')],{'host':_0x7ea4('0xd'),'port':0x18eb});var socket=require(_0x7ea4('0xe'))(new Redis(config[_0x7ea4('0xc')]));require(_0x7ea4('0xf'))[_0x7ea4('0x10')](socket);function respondWithRpcPromise(_0x2edea4,_0x2f3612,_0x2de915){return new BPromise(function(_0x39cee2,_0xef971){return client[_0x7ea4('0x11')](_0x2edea4,_0x2de915)[_0x7ea4('0x12')](function(_0x4cf5d5){logger['info'](_0x7ea4('0x13'),_0x2f3612,_0x7ea4('0x14'));logger['debug'](_0x7ea4('0x15'),_0x2f3612,'request\x20sent',JSON[_0x7ea4('0x16')](_0x4cf5d5));if(_0x4cf5d5[_0x7ea4('0x17')]){if(_0x4cf5d5['error'][_0x7ea4('0x18')]===0x1f4){logger[_0x7ea4('0x17')](_0x7ea4('0x13'),_0x2f3612,_0x4cf5d5[_0x7ea4('0x17')]['message']);return _0xef971(_0x4cf5d5[_0x7ea4('0x17')][_0x7ea4('0x19')]);}logger[_0x7ea4('0x17')](_0x7ea4('0x13'),_0x2f3612,_0x4cf5d5[_0x7ea4('0x17')][_0x7ea4('0x19')]);return _0x39cee2(_0x4cf5d5[_0x7ea4('0x17')]['message']);}else{logger[_0x7ea4('0x1a')](_0x7ea4('0x13'),_0x2f3612,'request\x20sent');_0x39cee2(_0x4cf5d5[_0x7ea4('0x1b')][_0x7ea4('0x19')]);}})[_0x7ea4('0x1c')](function(_0x7a6aa8){logger[_0x7ea4('0x17')]('WhatsappInteraction,\x20%s,\x20%s',_0x2f3612,_0x7a6aa8);_0xef971(_0x7a6aa8);});});}exports[_0x7ea4('0x1d')]=function(_0x1eb283){var _0x2af2df=this;return new Promise(function(_0x44661f,_0x2d3165){return db[_0x7ea4('0x1e')][_0x7ea4('0x1f')](_0x1eb283['body'],{'raw':_0x1eb283[_0x7ea4('0x20')]?_0x1eb283[_0x7ea4('0x20')][_0x7ea4('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1eb283[_0x7ea4('0x20')]?_0x1eb283['options'][_0x7ea4('0x22')]||null:null,'attributes':_0x1eb283[_0x7ea4('0x20')]?_0x1eb283[_0x7ea4('0x20')][_0x7ea4('0x23')]||null:null,'limit':_0x1eb283[_0x7ea4('0x20')]?_0x1eb283['options']['limit']||null:null})['then'](function(_0x3d40c2){logger[_0x7ea4('0x1a')](_0x7ea4('0x1d'),_0x1eb283);logger['debug'](_0x7ea4('0x1d'),_0x1eb283,JSON[_0x7ea4('0x16')](_0x3d40c2));_0x44661f(_0x3d40c2);})[_0x7ea4('0x1c')](function(_0x49a382){logger[_0x7ea4('0x17')](_0x7ea4('0x1d'),_0x49a382['message'],_0x1eb283);_0x2d3165(_0x2af2df['error'](0x1f4,_0x49a382['message']));});});};exports['AddTagsToWhatsappInteraction']=function(_0x3ede82){return new Promise(function(_0x53c58a,_0x2aea7b){return db[_0x7ea4('0x1e')][_0x7ea4('0x24')]({'where':_0x3ede82[_0x7ea4('0x20')]?_0x3ede82[_0x7ea4('0x20')][_0x7ea4('0x22')]||null:null})[_0x7ea4('0x12')](function(_0x3d1a89){if(_0x3d1a89){return _0x3d1a89['addTags'](_0x3ede82[_0x7ea4('0x25')][_0x7ea4('0x26')],_['omit'](_0x3ede82[_0x7ea4('0x25')],[_0x7ea4('0x26'),'id'])||{});}})[_0x7ea4('0x27')](function(_0x583f35){logger[_0x7ea4('0x1a')](_0x7ea4('0x28'),_0x3ede82);logger[_0x7ea4('0x29')](_0x7ea4('0x28'),_0x3ede82,JSON[_0x7ea4('0x16')](_0x583f35));_0x53c58a(_0x583f35);})[_0x7ea4('0x1c')](function(_0xfb03d4){logger['error'](_0x7ea4('0x28'),_0xfb03d4['message'],_0x3ede82);_0x2aea7b(_this['error'](0x1f4,_0xfb03d4['message']));});});}; \ No newline at end of file +var _0x80c7=['find','addTags','omit','ids','spread','AddTags','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','update','body','options','raw','where','attributes','limit','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','WhatsappInteraction'];(function(_0x16c6d8,_0x5f53fa){var _0x1bd033=function(_0x3f9306){while(--_0x3f9306){_0x16c6d8['push'](_0x16c6d8['shift']());}};_0x1bd033(++_0x5f53fa);}(_0x80c7,0x8d));var _0x780c=function(_0x4ab9de,_0x3bdf1a){_0x4ab9de=_0x4ab9de-0x0;var _0x516c92=_0x80c7[_0x4ab9de];return _0x516c92;};'use strict';var _=require(_0x780c('0x0'));var util=require(_0x780c('0x1'));var moment=require(_0x780c('0x2'));var BPromise=require(_0x780c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x780c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x780c('0x5'))(_0x780c('0x6'));var config=require(_0x780c('0x7'));var jayson=require(_0x780c('0x8'));var client=jayson[_0x780c('0x9')][_0x780c('0xa')]({'port':0x232a});config[_0x780c('0xb')]=_[_0x780c('0xc')](config[_0x780c('0xb')],{'host':_0x780c('0xd'),'port':0x18eb});var socket=require(_0x780c('0xe'))(new Redis(config['redis']));require(_0x780c('0xf'))[_0x780c('0x10')](socket);function respondWithRpcPromise(_0x5c1ec3,_0x232f41,_0x43cdde){return new BPromise(function(_0x2783b2,_0x4fd5b0){return client[_0x780c('0x11')](_0x5c1ec3,_0x43cdde)[_0x780c('0x12')](function(_0x46631e){logger[_0x780c('0x13')](_0x780c('0x14'),_0x232f41,_0x780c('0x15'));logger[_0x780c('0x16')](_0x780c('0x17'),_0x232f41,_0x780c('0x15'),JSON[_0x780c('0x18')](_0x46631e));if(_0x46631e[_0x780c('0x19')]){if(_0x46631e[_0x780c('0x19')]['code']===0x1f4){logger['error'](_0x780c('0x14'),_0x232f41,_0x46631e[_0x780c('0x19')]['message']);return _0x4fd5b0(_0x46631e['error'][_0x780c('0x1a')]);}logger[_0x780c('0x19')](_0x780c('0x14'),_0x232f41,_0x46631e[_0x780c('0x19')][_0x780c('0x1a')]);return _0x2783b2(_0x46631e[_0x780c('0x19')]['message']);}else{logger[_0x780c('0x13')](_0x780c('0x14'),_0x232f41,_0x780c('0x15'));_0x2783b2(_0x46631e[_0x780c('0x1b')]['message']);}})[_0x780c('0x1c')](function(_0x2449b7){logger[_0x780c('0x19')](_0x780c('0x14'),_0x232f41,_0x2449b7);_0x4fd5b0(_0x2449b7);});});}exports['UpdateWhatsappInteraction']=function(_0x416c56){var _0x6ab4c9=this;return new Promise(function(_0x48ccb9,_0x4f665d){return db['WhatsappInteraction'][_0x780c('0x1d')](_0x416c56[_0x780c('0x1e')],{'raw':_0x416c56[_0x780c('0x1f')]?_0x416c56[_0x780c('0x1f')][_0x780c('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x416c56[_0x780c('0x1f')]?_0x416c56[_0x780c('0x1f')][_0x780c('0x21')]||null:null,'attributes':_0x416c56[_0x780c('0x1f')]?_0x416c56[_0x780c('0x1f')][_0x780c('0x22')]||null:null,'limit':_0x416c56['options']?_0x416c56[_0x780c('0x1f')][_0x780c('0x23')]||null:null})[_0x780c('0x12')](function(_0x54d835){logger[_0x780c('0x13')](_0x780c('0x24'),_0x416c56);logger[_0x780c('0x16')](_0x780c('0x24'),_0x416c56,JSON[_0x780c('0x18')](_0x54d835));_0x48ccb9(_0x54d835);})[_0x780c('0x1c')](function(_0x5d675c){logger[_0x780c('0x19')](_0x780c('0x24'),_0x5d675c[_0x780c('0x1a')],_0x416c56);_0x4f665d(_0x6ab4c9['error'](0x1f4,_0x5d675c[_0x780c('0x1a')]));});});};exports[_0x780c('0x25')]=function(_0x3be361){return new Promise(function(_0x436fca,_0x26708b){return db[_0x780c('0x26')][_0x780c('0x27')]({'where':_0x3be361[_0x780c('0x1f')]?_0x3be361[_0x780c('0x1f')][_0x780c('0x21')]||null:null})[_0x780c('0x12')](function(_0x3b8411){if(_0x3b8411){return _0x3b8411[_0x780c('0x28')](_0x3be361[_0x780c('0x1e')]['ids'],_[_0x780c('0x29')](_0x3be361[_0x780c('0x1e')],[_0x780c('0x2a'),'id'])||{});}})[_0x780c('0x2b')](function(_0x2c76b2){logger[_0x780c('0x13')]('AddTags',_0x3be361);logger[_0x780c('0x16')](_0x780c('0x2c'),_0x3be361,JSON[_0x780c('0x18')](_0x2c76b2));_0x436fca(_0x2c76b2);})[_0x780c('0x1c')](function(_0x5c52ef){logger['error'](_0x780c('0x2c'),_0x5c52ef[_0x780c('0x1a')],_0x3be361);_0x26708b(_this['error'](0x1f4,_0x5c52ef['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 297290b..8e050da 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 _0xdc2d=['update','emit','register','length','whatsappInteraction:','./whatsappInteraction.events','save'];(function(_0x313c96,_0x3cee6e){var _0x522f53=function(_0x8961e){while(--_0x8961e){_0x313c96['push'](_0x313c96['shift']());}};_0x522f53(++_0x3cee6e);}(_0xdc2d,0x98));var _0xddc2=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xdc2d[_0x502c7d];return _0x30b7ed;};'use strict';var WhatsappInteractionEvents=require(_0xddc2('0x0'));var events=[_0xddc2('0x1'),'remove',_0xddc2('0x2')];function createListener(_0x31f7d7,_0x400305){return function(_0xd1bae6){_0x400305[_0xddc2('0x3')](_0x31f7d7,_0xd1bae6);};}function removeListener(_0x419a52,_0x389a85){return function(){WhatsappInteractionEvents['removeListener'](_0x419a52,_0x389a85);};}exports[_0xddc2('0x4')]=function(_0x36ba13){for(var _0xf9026e=0x0,_0x13cbb8=events[_0xddc2('0x5')];_0xf9026e<_0x13cbb8;_0xf9026e++){var _0x410210=events[_0xf9026e];var _0xe197de=createListener(_0xddc2('0x6')+_0x410210,_0x36ba13);WhatsappInteractionEvents['on'](_0x410210,_0xe197de);}}; \ No newline at end of file +var _0xea0e=['./whatsappInteraction.events','remove','update','emit','removeListener','register','length','whatsappInteraction:'];(function(_0x8920ef,_0x17a763){var _0x5df774=function(_0x4389e0){while(--_0x4389e0){_0x8920ef['push'](_0x8920ef['shift']());}};_0x5df774(++_0x17a763);}(_0xea0e,0x148));var _0xeea0=function(_0x206723,_0x1418cd){_0x206723=_0x206723-0x0;var _0x3ef4d4=_0xea0e[_0x206723];return _0x3ef4d4;};'use strict';var WhatsappInteractionEvents=require(_0xeea0('0x0'));var events=['save',_0xeea0('0x1'),_0xeea0('0x2')];function createListener(_0x328bc9,_0x20442e){return function(_0x8ed629){_0x20442e[_0xeea0('0x3')](_0x328bc9,_0x8ed629);};}function removeListener(_0x536290,_0x247fb6){return function(){WhatsappInteractionEvents[_0xeea0('0x4')](_0x536290,_0x247fb6);};}exports[_0xeea0('0x5')]=function(_0x4ec220){for(var _0x4b6d1f=0x0,_0x50789f=events[_0xeea0('0x6')];_0x4b6d1f<_0x50789f;_0x4b6d1f++){var _0x4711b7=events[_0x4b6d1f];var _0x3fa91c=createListener(_0xeea0('0x7')+_0x4711b7,_0x4ec220);WhatsappInteractionEvents['on'](_0x4711b7,_0x3fa91c);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 74cc397..f83529f 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 _0x677a=['show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','put','/:id','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated'];(function(_0x5b7e2e,_0x689e00){var _0x31c1a2=function(_0x2c2949){while(--_0x2c2949){_0x5b7e2e['push'](_0x5b7e2e['shift']());}};_0x31c1a2(++_0x689e00);}(_0x677a,0xf0));var _0xa677=function(_0x1191a6,_0x5da697){_0x1191a6=_0x1191a6-0x0;var _0x398dea=_0x677a[_0x1191a6];return _0x398dea;};'use strict';var multer=require(_0xa677('0x0'));var util=require(_0xa677('0x1'));var path=require('path');var timeout=require(_0xa677('0x2'));var express=require('express');var router=express[_0xa677('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa677('0x4'));var interaction=require(_0xa677('0x5'));var config=require(_0xa677('0x6'));var controller=require(_0xa677('0x7'));router[_0xa677('0x8')]('/',auth[_0xa677('0x9')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xa677('0x8')]('/:id',auth[_0xa677('0x9')](),controller[_0xa677('0xa')]);router[_0xa677('0xb')]('/',auth[_0xa677('0x9')](),interaction[_0xa677('0xc')](_0xa677('0xd'),_0xa677('0xe')),controller[_0xa677('0xf')]);router[_0xa677('0xb')](_0xa677('0x10'),controller['status']);router[_0xa677('0x11')](_0xa677('0x12'),auth[_0xa677('0x9')](),controller['update']);router['put'](_0xa677('0x13'),auth[_0xa677('0x9')](),controller[_0xa677('0x14')]);router[_0xa677('0x11')](_0xa677('0x15'),auth[_0xa677('0x9')](),controller[_0xa677('0x16')]);router['delete'](_0xa677('0x12'),auth[_0xa677('0x9')](),controller[_0xa677('0x17')]);module[_0xa677('0x18')]=router; \ No newline at end of file +var _0x057b=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get','index','isAuthenticated','/:id','show','tracked','whatsapp','whatsappmessage:create','create','post','/:id/status','status','put','/:id/accept','accept','/:id/reject','reject','delete','destroy'];(function(_0x337b9c,_0x3afc9c){var _0x211ae3=function(_0x40150a){while(--_0x40150a){_0x337b9c['push'](_0x337b9c['shift']());}};_0x211ae3(++_0x3afc9c);}(_0x057b,0x1e1));var _0xb057=function(_0x2a1ec5,_0x5887ba){_0x2a1ec5=_0x2a1ec5-0x0;var _0x473a61=_0x057b[_0x2a1ec5];return _0x473a61;};'use strict';var multer=require(_0xb057('0x0'));var util=require(_0xb057('0x1'));var path=require(_0xb057('0x2'));var timeout=require(_0xb057('0x3'));var express=require(_0xb057('0x4'));var router=express[_0xb057('0x5')]();var fs_extra=require(_0xb057('0x6'));var auth=require(_0xb057('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb057('0x8'));var controller=require(_0xb057('0x9'));router[_0xb057('0xa')]('/',auth['isAuthenticated'](),controller[_0xb057('0xb')]);router[_0xb057('0xa')]('/describe',auth[_0xb057('0xc')](),controller['describe']);router[_0xb057('0xa')](_0xb057('0xd'),auth[_0xb057('0xc')](),controller[_0xb057('0xe')]);router['post']('/',auth[_0xb057('0xc')](),interaction[_0xb057('0xf')](_0xb057('0x10'),_0xb057('0x11')),controller[_0xb057('0x12')]);router[_0xb057('0x13')](_0xb057('0x14'),controller[_0xb057('0x15')]);router[_0xb057('0x16')](_0xb057('0xd'),auth[_0xb057('0xc')](),controller['update']);router['put'](_0xb057('0x17'),auth[_0xb057('0xc')](),controller[_0xb057('0x18')]);router[_0xb057('0x16')](_0xb057('0x19'),auth[_0xb057('0xc')](),controller[_0xb057('0x1a')]);router[_0xb057('0x1b')](_0xb057('0xd'),auth[_0xb057('0xc')](),controller[_0xb057('0x1c')]);module[_0xb057('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 22e5198..14949e8 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 _0xa7aa=['out','STRING','DATE','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x1d9ee1,_0x302878){var _0x3923ac=function(_0x59786e){while(--_0x59786e){_0x1d9ee1['push'](_0x1d9ee1['shift']());}};_0x3923ac(++_0x302878);}(_0xa7aa,0x133));var _0xaa7a=function(_0x4d657f,_0x24202a){_0x4d657f=_0x4d657f-0x0;var _0x548c2b=_0xa7aa[_0x4d657f];return _0x548c2b;};'use strict';var Sequelize=require('sequelize');module[_0xaa7a('0x0')]={'body':{'type':Sequelize[_0xaa7a('0x1')](_0xaa7a('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xaa7a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xaa7a('0x4')]('in','out'),'defaultValue':_0xaa7a('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xaa7a('0x6')](0xbe)},'phone':{'type':Sequelize[_0xaa7a('0x6')]},'readAt':{'type':Sequelize[_0xaa7a('0x7')]},'secret':{'type':Sequelize[_0xaa7a('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xaa7a('0x6')]},'providerResponse':{'type':Sequelize[_0xaa7a('0x1')]}}; \ No newline at end of file +var _0x219a=['TEXT','medium','ENUM','STRING','DATE','exports'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x219a,0x1c7));var _0xa219=function(_0x132c5f,_0x1438eb){_0x132c5f=_0x132c5f-0x0;var _0x4c2745=_0x219a[_0x132c5f];return _0x4c2745;};'use strict';var Sequelize=require('sequelize');module[_0xa219('0x0')]={'body':{'type':Sequelize[_0xa219('0x1')](_0xa219('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xa219('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xa219('0x4')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xa219('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xa219('0x4')]},'providerResponse':{'type':Sequelize[_0xa219('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index f7511fb..d3b542c 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 _0xdbea=['crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','undefined','limit','offset','set','reject','update','then','destroy','stack','name','send','index','map','WhatsappMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','filter','merge','VIRTUAL','options','where','count','includeAll','findAll','rows','catch','show','params','length','find','create','body','describe','whatsapp-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','WhatsappInteractionId','isNil','read1stAt','get','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','contact','User','email','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','interaction','RejectMessage','rejectMessage','ContactId','Sequelize','fullname','internal','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','inspect','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x65d12e,_0x4b0a30){var _0x4274e0=function(_0x121624){while(--_0x121624){_0x65d12e['push'](_0x65d12e['shift']());}};_0x4274e0(++_0x4b0a30);}(_0xdbea,0x7d));var _0xadbe=function(_0x241ea5,_0x510707){_0x241ea5=_0x241ea5-0x0;var _0x30a5d6=_0xdbea[_0x241ea5];return _0x30a5d6;};'use strict';var emlformat=require(_0xadbe('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xadbe('0x1'));var jsonpatch=require(_0xadbe('0x2'));var rp=require(_0xadbe('0x3'));var moment=require(_0xadbe('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xadbe('0x5'));var util=require('util');var path=require(_0xadbe('0x6'));var sox=require(_0xadbe('0x7'));var csv=require(_0xadbe('0x8'));var ejs=require(_0xadbe('0x9'));var fs=require('fs');var fs_extra=require(_0xadbe('0xa'));var _=require(_0xadbe('0xb'));var squel=require(_0xadbe('0xc'));var crypto=require(_0xadbe('0xd'));var jsforce=require(_0xadbe('0xe'));var deskjs=require(_0xadbe('0xf'));var toCsv=require(_0xadbe('0x8'));var querystring=require(_0xadbe('0x10'));var Papa=require('papaparse');var Redis=require(_0xadbe('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xadbe('0x12'));var as=require(_0xadbe('0x13'));var hardwareService=require(_0xadbe('0x14'));var logger=require(_0xadbe('0x15'))(_0xadbe('0x16'));var utils=require(_0xadbe('0x17'));var config=require(_0xadbe('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xadbe('0x19')]=_['defaults'](config[_0xadbe('0x19')],{'host':_0xadbe('0x1a'),'port':0x18eb});var socket=require(_0xadbe('0x1b'))(new Redis(config[_0xadbe('0x19')]));require(_0xadbe('0x1c'))[_0xadbe('0x1d')](socket);var jayson=require(_0xadbe('0x1e'));var client=jayson[_0xadbe('0x1f')][_0xadbe('0x20')]({'port':0x232c});var client9002=jayson['client'][_0xadbe('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x379d5d,_0x5c13f0,_0x394a54,_0x4a3d8b){return new BPromise(function(_0x4f31d4,_0x31b113){var _0x580325=_0x4a3d8b||client;return _0x580325['request'](_0x379d5d,_0x394a54)['then'](function(_0x224275){logger[_0xadbe('0x21')](_0xadbe('0x22'),_0x5c13f0,_0xadbe('0x23'));logger[_0xadbe('0x24')](_0xadbe('0x25'),_0x5c13f0,_0xadbe('0x23'),JSON[_0xadbe('0x26')](_0x224275));if(_0x224275[_0xadbe('0x27')]){if(_0x224275['error']['code']===0x1f4){logger[_0xadbe('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x5c13f0,_0x224275['error'][_0xadbe('0x28')]);return _0x31b113(_0x224275[_0xadbe('0x27')][_0xadbe('0x28')]);}logger[_0xadbe('0x27')](_0xadbe('0x22'),_0x5c13f0,_0x224275[_0xadbe('0x27')][_0xadbe('0x28')]);return _0x4f31d4(_0x224275[_0xadbe('0x27')][_0xadbe('0x28')]);}else{logger[_0xadbe('0x21')](_0xadbe('0x22'),_0x5c13f0,_0xadbe('0x23'));_0x4f31d4(_0x224275[_0xadbe('0x29')]['message']);}})['catch'](function(_0x32f6c3){logger[_0xadbe('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x5c13f0,_0x32f6c3);_0x31b113(_0x32f6c3);});});}function respondWithStatusCode(_0x49a576,_0xf53031){_0xf53031=_0xf53031||0xcc;return function(_0xc31fcc){if(_0xc31fcc){return _0x49a576[_0xadbe('0x2a')](_0xf53031);}return _0x49a576[_0xadbe('0x2b')](_0xf53031)[_0xadbe('0x2c')]();};}function respondWithResult(_0x104872,_0x2280ca){_0x2280ca=_0x2280ca||0xc8;return function(_0x12fd65){if(_0x12fd65){return _0x104872[_0xadbe('0x2b')](_0x2280ca)[_0xadbe('0x2d')](_0x12fd65);}};}function respondWithFilteredResult(_0x44c2bd,_0x217194){return function(_0x559792){if(_0x559792){var _0xce615c=typeof _0x217194['offset']===_0xadbe('0x2e')&&typeof _0x217194[_0xadbe('0x2f')]===_0xadbe('0x2e');var _0x28eeeb=_0x559792['count'];var _0x19cc88=_0xce615c?0x0:_0x217194[_0xadbe('0x30')];var _0x1df9f9=_0xce615c?_0x559792['count']:_0x217194[_0xadbe('0x30')]+_0x217194['limit'];var _0x170a5a;if(_0x1df9f9>=_0x28eeeb){_0x1df9f9=_0x28eeeb;_0x170a5a=0xc8;}else{_0x170a5a=0xce;}_0x44c2bd[_0xadbe('0x2b')](_0x170a5a);return _0x44c2bd[_0xadbe('0x31')]('Content-Range',_0x19cc88+'-'+_0x1df9f9+'/'+_0x28eeeb)[_0xadbe('0x2d')](_0x559792);}return null;};}function patchUpdates(_0x3f8aae){return function(_0x36ee4b){try{jsonpatch['apply'](_0x36ee4b,_0x3f8aae,!![]);}catch(_0x3d7b9b){return BPromise[_0xadbe('0x32')](_0x3d7b9b);}return _0x36ee4b['save']();};}function saveUpdates(_0x46bb96,_0x55cae7){return function(_0x2fee23){if(_0x2fee23){return _0x2fee23[_0xadbe('0x33')](_0x46bb96)[_0xadbe('0x34')](function(_0x50e51e){return _0x50e51e;});}return null;};}function removeEntity(_0x5736ac,_0xd7ff3d){return function(_0x507cd7){if(_0x507cd7){return _0x507cd7[_0xadbe('0x35')]()['then'](function(){_0x5736ac[_0xadbe('0x2b')](0xcc)[_0xadbe('0x2c')]();});}};}function handleEntityNotFound(_0x5006df,_0x528a65){return function(_0x3efa9e){if(!_0x3efa9e){_0x5006df[_0xadbe('0x2a')](0x194);}return _0x3efa9e;};}function handleError(_0x5d793e,_0x262b7b){_0x262b7b=_0x262b7b||0x1f4;return function(_0x1b980e){logger[_0xadbe('0x27')](_0x1b980e[_0xadbe('0x36')]);if(_0x1b980e[_0xadbe('0x37')]){delete _0x1b980e[_0xadbe('0x37')];}_0x5d793e[_0xadbe('0x2b')](_0x262b7b)[_0xadbe('0x38')](_0x1b980e);};}exports[_0xadbe('0x39')]=function(_0x51d95a,_0x140b18){var _0xc27364={},_0x1f15f3={},_0x2e36ef={'count':0x0,'rows':[]};var _0x463737=_[_0xadbe('0x3a')](db[_0xadbe('0x3b')]['rawAttributes'],function(_0xf2eac9){return{'name':_0xf2eac9[_0xadbe('0x3c')],'type':_0xf2eac9[_0xadbe('0x3d')][_0xadbe('0x3e')]};});_0x1f15f3[_0xadbe('0x3f')]=_[_0xadbe('0x3a')](_0x463737,'name');_0x1f15f3[_0xadbe('0x40')]=_[_0xadbe('0x41')](_0x51d95a[_0xadbe('0x40')]);_0x1f15f3[_0xadbe('0x42')]=_[_0xadbe('0x43')](_0x1f15f3[_0xadbe('0x3f')],_0x1f15f3[_0xadbe('0x40')]);_0xc27364[_0xadbe('0x44')]=_[_0xadbe('0x43')](_0x1f15f3[_0xadbe('0x3f')],qs['fields'](_0x51d95a[_0xadbe('0x40')][_0xadbe('0x45')]));_0xc27364[_0xadbe('0x44')]=_0xc27364['attributes']['length']?_0xc27364[_0xadbe('0x44')]:_0x1f15f3['model'];if(!_0x51d95a[_0xadbe('0x40')][_0xadbe('0x46')]('nolimit')){_0xc27364[_0xadbe('0x2f')]=qs[_0xadbe('0x2f')](_0x51d95a['query'][_0xadbe('0x2f')]);_0xc27364[_0xadbe('0x30')]=qs['offset'](_0x51d95a[_0xadbe('0x40')][_0xadbe('0x30')]);}_0xc27364[_0xadbe('0x47')]=qs[_0xadbe('0x48')](_0x51d95a[_0xadbe('0x40')][_0xadbe('0x48')]);_0xc27364['where']=qs[_0xadbe('0x42')](_['pick'](_0x51d95a[_0xadbe('0x40')],_0x1f15f3[_0xadbe('0x42')]),_0x463737);if(_0x51d95a[_0xadbe('0x40')][_0xadbe('0x49')]){_0xc27364['where']=_[_0xadbe('0x4a')](_0xc27364['where'],{'$or':_[_0xadbe('0x3a')](_0x463737,function(_0x3b2dae){if(_0x3b2dae[_0xadbe('0x3d')]!==_0xadbe('0x4b')){var _0xc3fdaa={};_0xc3fdaa[_0x3b2dae[_0xadbe('0x37')]]={'$like':'%'+_0x51d95a['query'][_0xadbe('0x49')]+'%'};return _0xc3fdaa;}})});}_0xc27364=_[_0xadbe('0x4a')]({},_0xc27364,_0x51d95a[_0xadbe('0x4c')]);var _0x286d35={'where':_0xc27364[_0xadbe('0x4d')]};return db['WhatsappMessage'][_0xadbe('0x4e')](_0x286d35)[_0xadbe('0x34')](function(_0xc46c86){_0x2e36ef['count']=_0xc46c86;if(_0x51d95a[_0xadbe('0x40')][_0xadbe('0x4f')]){_0xc27364['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0xadbe('0x50')](_0xc27364);})['then'](function(_0x149d96){_0x2e36ef[_0xadbe('0x51')]=_0x149d96;return _0x2e36ef;})[_0xadbe('0x34')](respondWithFilteredResult(_0x140b18,_0xc27364))[_0xadbe('0x52')](handleError(_0x140b18,null));};exports[_0xadbe('0x53')]=function(_0x421a77,_0x54db2){var _0x16fab1={'raw':!![],'where':{'id':_0x421a77[_0xadbe('0x54')]['id']}},_0x28eac1={};_0x28eac1[_0xadbe('0x3f')]=_[_0xadbe('0x41')](db[_0xadbe('0x3b')]['rawAttributes']);_0x28eac1[_0xadbe('0x40')]=_['keys'](_0x421a77[_0xadbe('0x40')]);_0x28eac1[_0xadbe('0x42')]=_[_0xadbe('0x43')](_0x28eac1['model'],_0x28eac1[_0xadbe('0x40')]);_0x16fab1[_0xadbe('0x44')]=_[_0xadbe('0x43')](_0x28eac1[_0xadbe('0x3f')],qs['fields'](_0x421a77['query'][_0xadbe('0x45')]));_0x16fab1[_0xadbe('0x44')]=_0x16fab1[_0xadbe('0x44')][_0xadbe('0x55')]?_0x16fab1[_0xadbe('0x44')]:_0x28eac1[_0xadbe('0x3f')];if(_0x421a77[_0xadbe('0x40')][_0xadbe('0x4f')]){_0x16fab1['include']=[{'all':!![]}];}_0x16fab1=_['merge']({},_0x16fab1,_0x421a77['options']);return db[_0xadbe('0x3b')][_0xadbe('0x56')](_0x16fab1)['then'](handleEntityNotFound(_0x54db2,null))[_0xadbe('0x34')](respondWithResult(_0x54db2,null))[_0xadbe('0x52')](handleError(_0x54db2,null));};exports['create']=function(_0x18f336,_0x1975c4){return db[_0xadbe('0x3b')][_0xadbe('0x57')](_0x18f336[_0xadbe('0x58')],{})[_0xadbe('0x34')](respondWithResult(_0x1975c4,0xc9))[_0xadbe('0x52')](handleError(_0x1975c4,null));};exports['update']=function(_0x39446c,_0x10e97b){if(_0x39446c[_0xadbe('0x58')]['id']){delete _0x39446c[_0xadbe('0x58')]['id'];}return db[_0xadbe('0x3b')][_0xadbe('0x56')]({'where':{'id':_0x39446c[_0xadbe('0x54')]['id']}})[_0xadbe('0x34')](handleEntityNotFound(_0x10e97b,null))[_0xadbe('0x34')](saveUpdates(_0x39446c[_0xadbe('0x58')],null))[_0xadbe('0x34')](respondWithResult(_0x10e97b,null))[_0xadbe('0x52')](handleError(_0x10e97b,null));};exports[_0xadbe('0x35')]=function(_0x222c12,_0xec1ccd){return db[_0xadbe('0x3b')][_0xadbe('0x56')]({'where':{'id':_0x222c12[_0xadbe('0x54')]['id']}})[_0xadbe('0x34')](handleEntityNotFound(_0xec1ccd,null))[_0xadbe('0x34')](removeEntity(_0xec1ccd,null))[_0xadbe('0x52')](handleError(_0xec1ccd,null));};exports[_0xadbe('0x59')]=function(_0x7b6227,_0x319433){return db[_0xadbe('0x3b')][_0xadbe('0x59')]()[_0xadbe('0x34')](respondWithResult(_0x319433,null))[_0xadbe('0x52')](handleError(_0x319433,null));};var interaction_log=require(_0xadbe('0x15'))(_0xadbe('0x5a'));exports[_0xadbe('0x5b')]=function(_0x41438c,_0x2c6be6,_0x170298){var _0x4ddfb5={'agent':{},'channel':'whatsapp'};if(_0x41438c[_0xadbe('0x58')]['id']){delete _0x41438c[_0xadbe('0x58')]['id'];}_0x41438c[_0xadbe('0x58')][_0xadbe('0x5c')]=!![];_0x41438c[_0xadbe('0x58')][_0xadbe('0x5d')]=moment()[_0xadbe('0x5e')](_0xadbe('0x5f'));_0x41438c[_0xadbe('0x58')][_0xadbe('0x60')]=_0x41438c[_0xadbe('0x58')]['UserId']||_0x41438c[_0xadbe('0x61')]['id'];_0x4ddfb5[_0xadbe('0x62')]['id']=_0x41438c['body'][_0xadbe('0x60')];return db[_0xadbe('0x3b')][_0xadbe('0x56')]({'where':{'id':_0x41438c[_0xadbe('0x54')]['id'],'UserId':null}})[_0xadbe('0x34')](handleEntityNotFound(_0x2c6be6,null))[_0xadbe('0x34')](saveUpdates(_0x41438c['body'],null))[_0xadbe('0x34')](function(_0x1a0e86){if(_0x1a0e86){_0x4ddfb5[_0xadbe('0x28')]=_0x1a0e86['get']({'plain':!![]});return db['WhatsappInteraction'][_0xadbe('0x56')]({'where':{'id':_0x1a0e86[_0xadbe('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x2c6be6,null))['then'](function(_0x576ae1){if(_0x576ae1){return _0x576ae1[_0xadbe('0x33')]({'UserId':_0x41438c[_0xadbe('0x58')][_0xadbe('0x60')],'read1stAt':_[_0xadbe('0x64')](_0x576ae1[_0xadbe('0x65')])?moment()[_0xadbe('0x5e')](_0xadbe('0x5f')):undefined});}return null;})[_0xadbe('0x34')](function(_0x418b85){if(_0x418b85){_0x4ddfb5['interaction']=_0x418b85[_0xadbe('0x66')]({'plain':!![]});interaction_log[_0xadbe('0x21')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x41438c[_0xadbe('0x61')]['id'],_0x41438c[_0xadbe('0x61')][_0xadbe('0x37')],_0x41438c['user'][_0xadbe('0x67')],_0x4ddfb5['interaction']['id'],_0x41438c[_0xadbe('0x58')]?JSON[_0xadbe('0x26')](_0x41438c[_0xadbe('0x58')]):_0xadbe('0x68'));return respondWithRpcPromise(_0xadbe('0x69'),_0xadbe('0x6a'),_0x4ddfb5);}return null;})['then'](function(_0x1cb6b2){var _0x1d589f=_0xadbe('0x6b')+_0x1cb6b2['message']['ContactId'];return db[_0xadbe('0x6c')][_0xadbe('0x40')](_0x1d589f,{'type':db['Sequelize'][_0xadbe('0x6d')][_0xadbe('0x6e')],'raw':!![]})['then'](function(_0x4d629a){return _0x4d629a;});})[_0xadbe('0x34')](function(_0x5c139b){if(_0x5c139b){_0x4ddfb5[_0xadbe('0x28')][_0xadbe('0x6f')]=_0x5c139b[0x0];if(!_0x41438c['body'][_0xadbe('0x60')])return;return db[_0xadbe('0x70')]['find']({'where':{'id':_0x41438c['body'][_0xadbe('0x60')],'role':_0xadbe('0x62')},'attributes':['id',_0xadbe('0x37'),'fullname',_0xadbe('0x71'),'internal'],'raw':!![]});}return null;})[_0xadbe('0x34')](function(_0x2307df){if(!_0x2307df)return null;_0x4ddfb5[_0xadbe('0x28')][_0xadbe('0x62')]=_0x2307df;return _0x4ddfb5;})['then'](function(_0x53cfaa){if(_0x53cfaa){if(_0x41438c[_0xadbe('0x58')]['manual']){_0x4ddfb5[_0xadbe('0x28')][_0xadbe('0x72')]=util[_0xadbe('0x5e')](_0xadbe('0x73'),_0x41438c[_0xadbe('0x61')][_0xadbe('0x37')]);_0x4ddfb5[_0xadbe('0x28')][_0xadbe('0x74')]=_0x4ddfb5[_0xadbe('0x74')];_0x4ddfb5[_0xadbe('0x28')][_0xadbe('0x75')]=_0x4ddfb5['channel'];_0x4ddfb5['message'][_0xadbe('0x76')]=_0xadbe('0x5b');return respondWithRpcPromise('EventManager',_0xadbe('0x77'),{'event':_0xadbe('0x78'),'message':_0x4ddfb5['message']},client9002)['then'](function(){return _0x4ddfb5;});}return _0x4ddfb5;}return null;})[_0xadbe('0x34')](respondWithResult(_0x2c6be6,null))[_0xadbe('0x52')](handleError(_0x2c6be6,null));};var interaction_log=require(_0xadbe('0x15'))('whatsapp-interactions');exports[_0xadbe('0x32')]=function(_0x4d7bcd,_0x4ad396,_0x3e8183){var _0x4db130={'agent':{},'channel':'whatsapp'};if(_0x4d7bcd[_0xadbe('0x58')]['id']){delete _0x4d7bcd['body']['id'];}_0x4d7bcd[_0xadbe('0x58')][_0xadbe('0x60')]=_0x4d7bcd[_0xadbe('0x58')][_0xadbe('0x60')]||_0x4d7bcd[_0xadbe('0x61')]['id'];_0x4db130[_0xadbe('0x62')]['id']=_0x4d7bcd[_0xadbe('0x58')]['UserId'];return db[_0xadbe('0x3b')][_0xadbe('0x56')]({'where':{'id':_0x4d7bcd[_0xadbe('0x54')]['id'],'UserId':null}})[_0xadbe('0x34')](handleEntityNotFound(_0x4ad396,null))[_0xadbe('0x34')](function(_0x59a022){if(_0x59a022){_0x4db130['message']=_0x59a022[_0xadbe('0x66')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x59a022[_0xadbe('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x4ad396,null))['then'](function(_0x14ce8a){if(_0x14ce8a){_0x4db130['interaction']=_0x14ce8a[_0xadbe('0x66')]({'plain':!![]});interaction_log[_0xadbe('0x21')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4d7bcd[_0xadbe('0x61')]['id'],_0x4d7bcd[_0xadbe('0x61')][_0xadbe('0x37')],_0x4d7bcd['user'][_0xadbe('0x67')],_0x4db130[_0xadbe('0x79')]['id'],_0x4d7bcd[_0xadbe('0x58')]?JSON[_0xadbe('0x26')](_0x4d7bcd[_0xadbe('0x58')]):_0xadbe('0x68'));return respondWithRpcPromise(_0xadbe('0x7a'),_0xadbe('0x7b'),_0x4db130);}return null;})[_0xadbe('0x34')](function(_0x2b050c){var _0x4ab22d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2b050c[_0xadbe('0x28')][_0xadbe('0x7c')];return db[_0xadbe('0x6c')][_0xadbe('0x40')](_0x4ab22d,{'type':db[_0xadbe('0x7d')]['QueryTypes'][_0xadbe('0x6e')],'raw':!![]})['then'](function(_0x19c288){return _0x19c288;});})['then'](function(_0x1440e3){if(_0x1440e3){_0x4db130[_0xadbe('0x28')][_0xadbe('0x6f')]=_0x1440e3[0x0];if(!_0x4d7bcd[_0xadbe('0x58')]['UserId'])return;return db['User'][_0xadbe('0x56')]({'where':{'id':_0x4d7bcd[_0xadbe('0x58')][_0xadbe('0x60')],'role':_0xadbe('0x62')},'attributes':['id',_0xadbe('0x37'),_0xadbe('0x7e'),'email',_0xadbe('0x7f')],'raw':!![]});}return null;})[_0xadbe('0x34')](function(_0x47fd3f){if(!_0x47fd3f)return null;_0x4db130[_0xadbe('0x28')][_0xadbe('0x62')]=_0x47fd3f;return _0x4db130;})[_0xadbe('0x34')](function(_0xbf2b6e){if(_0xbf2b6e){_0xbf2b6e['message']['interface']=util[_0xadbe('0x5e')]('SIP/%s',_0x4d7bcd[_0xadbe('0x61')][_0xadbe('0x37')]);_0xbf2b6e[_0xadbe('0x28')][_0xadbe('0x74')]=_0x4db130[_0xadbe('0x74')];_0xbf2b6e['message'][_0xadbe('0x75')]=_0x4db130[_0xadbe('0x74')];_0xbf2b6e[_0xadbe('0x28')]['event']=_0xadbe('0x32');respondWithRpcPromise(_0xadbe('0x77'),_0xadbe('0x77'),{'event':_0xadbe('0x80'),'message':_0xbf2b6e[_0xadbe('0x28')]},client9002);return _0x4db130;}return null;})[_0xadbe('0x34')](respondWithResult(_0x4ad396,null))[_0xadbe('0x52')](handleError(_0x4ad396,null));};exports[_0xadbe('0x2b')]=function(_0x312267,_0x312357,_0x2c5295){if(_0x312267['body']['id']){delete _0x312267[_0xadbe('0x58')]['id'];}var _0x4120d7;return db['WhatsappMessage'][_0xadbe('0x56')]({'where':{'id':_0x312267[_0xadbe('0x54')]['id']}})[_0xadbe('0x34')](handleEntityNotFound(_0x312357,null))[_0xadbe('0x34')](function(_0x32decd){if(_0x32decd){_0x4120d7=_0x32decd;return db[_0xadbe('0x81')][_0xadbe('0x56')]({'where':{'id':_0x32decd[_0xadbe('0x82')]}});}})[_0xadbe('0x34')](handleEntityNotFound(_0x312357,null))[_0xadbe('0x34')](function(_0x45a503){if(_0x45a503){logger[_0xadbe('0x24')](_0xadbe('0x83'),_0xadbe('0x2b'),'received\x20delivery\x20report\x20from',_0x45a503[_0xadbe('0x3d')],util['inspect'](_0x312267[_0xadbe('0x58')],{'showHidden':![],'depth':null}));switch(_0x45a503['type']){case'twilio':if(_0x312267[_0xadbe('0x58')][_0xadbe('0x84')]&&_0x312267['body'][_0xadbe('0x84')]===_0x4120d7[_0xadbe('0x85')]&&_0x312267[_0xadbe('0x58')][_0xadbe('0x86')]&&_0x312267[_0xadbe('0x58')][_0xadbe('0x86')]===_0xadbe('0x5c')){return _0x4120d7[_0xadbe('0x33')]({'read':!![]});}else{logger[_0xadbe('0x27')](_0xadbe('0x87'),'status',_0xadbe('0x88'),util[_0xadbe('0x89')](_0x312267[_0xadbe('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x4120d7;}})[_0xadbe('0x34')](respondWithResult(_0x312357,null))[_0xadbe('0x52')](handleError(_0x312357,null));}; \ No newline at end of file +var _0x7256=['save','destroy','stack','name','send','WhatsappMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','map','VIRTUAL','merge','options','include','findAll','rows','params','fields','includeAll','find','create','body','update','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','UserId','user','agent','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','sequelize','SELECT','contact','User','email','internal','manual','interface','channel','motionChannel','event','EventManager','interaction','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','fullname','WhatsappAccount','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','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','redis','defaults','localhost','./whatsappMessage.socket','jayson/promise','client','http','request','then','info','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappMessage,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject'];(function(_0x2929ba,_0x506aa6){var _0x365e6e=function(_0x206fd3){while(--_0x206fd3){_0x2929ba['push'](_0x2929ba['shift']());}};_0x365e6e(++_0x506aa6);}(_0x7256,0x1f4));var _0x6725=function(_0x389432,_0x4f4eec){_0x389432=_0x389432-0x0;var _0x354b97=_0x7256[_0x389432];return _0x354b97;};'use strict';var emlformat=require(_0x6725('0x0'));var rimraf=require(_0x6725('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6725('0x2'));var moment=require(_0x6725('0x3'));var BPromise=require(_0x6725('0x4'));var Mustache=require(_0x6725('0x5'));var util=require(_0x6725('0x6'));var path=require(_0x6725('0x7'));var sox=require(_0x6725('0x8'));var csv=require(_0x6725('0x9'));var ejs=require(_0x6725('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6725('0xb'));var squel=require(_0x6725('0xc'));var crypto=require('crypto');var jsforce=require(_0x6725('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6725('0x9'));var querystring=require(_0x6725('0xe'));var Papa=require(_0x6725('0xf'));var Redis=require(_0x6725('0x10'));var authService=require(_0x6725('0x11'));var qs=require(_0x6725('0x12'));var as=require(_0x6725('0x13'));var hardwareService=require(_0x6725('0x14'));var logger=require(_0x6725('0x15'))('api');var utils=require(_0x6725('0x16'));var config=require(_0x6725('0x17'));var licenseUtil=require(_0x6725('0x18'));var db=require(_0x6725('0x19'))['db'];config[_0x6725('0x1a')]=_[_0x6725('0x1b')](config['redis'],{'host':_0x6725('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6725('0x1d'))['register'](socket);var jayson=require(_0x6725('0x1e'));var client=jayson[_0x6725('0x1f')]['http']({'port':0x232c});var client9002=jayson['client'][_0x6725('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x5c57e3,_0x122de8,_0x30dd8a,_0x89b3ff){return new BPromise(function(_0x36404d,_0x77dd7d){var _0x16c5c1=_0x89b3ff||client;return _0x16c5c1[_0x6725('0x21')](_0x5c57e3,_0x30dd8a)[_0x6725('0x22')](function(_0x532232){logger[_0x6725('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x122de8,'request\x20sent');logger[_0x6725('0x24')](_0x6725('0x25'),_0x122de8,'request\x20sent',JSON[_0x6725('0x26')](_0x532232));if(_0x532232['error']){if(_0x532232[_0x6725('0x27')][_0x6725('0x28')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x122de8,_0x532232['error'][_0x6725('0x29')]);return _0x77dd7d(_0x532232[_0x6725('0x27')][_0x6725('0x29')]);}logger[_0x6725('0x27')](_0x6725('0x2a'),_0x122de8,_0x532232[_0x6725('0x27')][_0x6725('0x29')]);return _0x36404d(_0x532232[_0x6725('0x27')][_0x6725('0x29')]);}else{logger[_0x6725('0x23')](_0x6725('0x2a'),_0x122de8,'request\x20sent');_0x36404d(_0x532232[_0x6725('0x2b')][_0x6725('0x29')]);}})[_0x6725('0x2c')](function(_0x964618){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x122de8,_0x964618);_0x77dd7d(_0x964618);});});}function respondWithStatusCode(_0x591346,_0x7087bf){_0x7087bf=_0x7087bf||0xcc;return function(_0x53310d){if(_0x53310d){return _0x591346[_0x6725('0x2d')](_0x7087bf);}return _0x591346[_0x6725('0x2e')](_0x7087bf)[_0x6725('0x2f')]();};}function respondWithResult(_0x192e59,_0x49ab9d){_0x49ab9d=_0x49ab9d||0xc8;return function(_0x10ff74){if(_0x10ff74){return _0x192e59['status'](_0x49ab9d)[_0x6725('0x30')](_0x10ff74);}};}function respondWithFilteredResult(_0x32f847,_0x5161f5){return function(_0x12ada0){if(_0x12ada0){var _0x1cabe9=typeof _0x5161f5['offset']===_0x6725('0x31')&&typeof _0x5161f5[_0x6725('0x32')]===_0x6725('0x31');var _0x5072a3=_0x12ada0[_0x6725('0x33')];var _0x1e6143=_0x1cabe9?0x0:_0x5161f5[_0x6725('0x34')];var _0x1bc4ca=_0x1cabe9?_0x12ada0[_0x6725('0x33')]:_0x5161f5['offset']+_0x5161f5[_0x6725('0x32')];var _0x18e045;if(_0x1bc4ca>=_0x5072a3){_0x1bc4ca=_0x5072a3;_0x18e045=0xc8;}else{_0x18e045=0xce;}_0x32f847[_0x6725('0x2e')](_0x18e045);return _0x32f847[_0x6725('0x35')](_0x6725('0x36'),_0x1e6143+'-'+_0x1bc4ca+'/'+_0x5072a3)[_0x6725('0x30')](_0x12ada0);}return null;};}function patchUpdates(_0xf4daf9){return function(_0x18f169){try{jsonpatch['apply'](_0x18f169,_0xf4daf9,!![]);}catch(_0x2af74d){return BPromise[_0x6725('0x37')](_0x2af74d);}return _0x18f169[_0x6725('0x38')]();};}function saveUpdates(_0x3935c3,_0x37e2b5){return function(_0x15caf7){if(_0x15caf7){return _0x15caf7['update'](_0x3935c3)[_0x6725('0x22')](function(_0x1ae906){return _0x1ae906;});}return null;};}function removeEntity(_0xe459f5,_0x1c62ee){return function(_0x5f33b4){if(_0x5f33b4){return _0x5f33b4[_0x6725('0x39')]()[_0x6725('0x22')](function(){_0xe459f5[_0x6725('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4550ee,_0xb70bf6){return function(_0x30d4da){if(!_0x30d4da){_0x4550ee['sendStatus'](0x194);}return _0x30d4da;};}function handleError(_0x2c9d1d,_0x4a715a){_0x4a715a=_0x4a715a||0x1f4;return function(_0x5e13a3){logger[_0x6725('0x27')](_0x5e13a3[_0x6725('0x3a')]);if(_0x5e13a3['name']){delete _0x5e13a3[_0x6725('0x3b')];}_0x2c9d1d['status'](_0x4a715a)[_0x6725('0x3c')](_0x5e13a3);};}exports['index']=function(_0xb809b3,_0x204991){var _0x302eaa={},_0x5d93ae={},_0x245313={'count':0x0,'rows':[]};var _0x2c4bec=_['map'](db[_0x6725('0x3d')][_0x6725('0x3e')],function(_0x3aea52){return{'name':_0x3aea52[_0x6725('0x3f')],'type':_0x3aea52[_0x6725('0x40')]['key']};});_0x5d93ae[_0x6725('0x41')]=_['map'](_0x2c4bec,_0x6725('0x3b'));_0x5d93ae[_0x6725('0x42')]=_[_0x6725('0x43')](_0xb809b3[_0x6725('0x42')]);_0x5d93ae[_0x6725('0x44')]=_[_0x6725('0x45')](_0x5d93ae[_0x6725('0x41')],_0x5d93ae[_0x6725('0x42')]);_0x302eaa[_0x6725('0x46')]=_[_0x6725('0x45')](_0x5d93ae[_0x6725('0x41')],qs['fields'](_0xb809b3[_0x6725('0x42')]['fields']));_0x302eaa[_0x6725('0x46')]=_0x302eaa[_0x6725('0x46')]['length']?_0x302eaa[_0x6725('0x46')]:_0x5d93ae[_0x6725('0x41')];if(!_0xb809b3[_0x6725('0x42')][_0x6725('0x47')](_0x6725('0x48'))){_0x302eaa[_0x6725('0x32')]=qs[_0x6725('0x32')](_0xb809b3[_0x6725('0x42')][_0x6725('0x32')]);_0x302eaa['offset']=qs[_0x6725('0x34')](_0xb809b3[_0x6725('0x42')][_0x6725('0x34')]);}_0x302eaa['order']=qs[_0x6725('0x49')](_0xb809b3[_0x6725('0x42')][_0x6725('0x49')]);_0x302eaa[_0x6725('0x4a')]=qs['filters'](_[_0x6725('0x4b')](_0xb809b3[_0x6725('0x42')],_0x5d93ae['filters']),_0x2c4bec);if(_0xb809b3[_0x6725('0x42')][_0x6725('0x4c')]){_0x302eaa[_0x6725('0x4a')]=_['merge'](_0x302eaa[_0x6725('0x4a')],{'$or':_[_0x6725('0x4d')](_0x2c4bec,function(_0x4e280d){if(_0x4e280d[_0x6725('0x40')]!==_0x6725('0x4e')){var _0x98348b={};_0x98348b[_0x4e280d[_0x6725('0x3b')]]={'$like':'%'+_0xb809b3[_0x6725('0x42')][_0x6725('0x4c')]+'%'};return _0x98348b;}})});}_0x302eaa=_[_0x6725('0x4f')]({},_0x302eaa,_0xb809b3[_0x6725('0x50')]);var _0x150a27={'where':_0x302eaa[_0x6725('0x4a')]};return db['WhatsappMessage'][_0x6725('0x33')](_0x150a27)[_0x6725('0x22')](function(_0x30927b){_0x245313[_0x6725('0x33')]=_0x30927b;if(_0xb809b3[_0x6725('0x42')]['includeAll']){_0x302eaa[_0x6725('0x51')]=[{'all':!![]}];}return db[_0x6725('0x3d')][_0x6725('0x52')](_0x302eaa);})[_0x6725('0x22')](function(_0x18d3a4){_0x245313[_0x6725('0x53')]=_0x18d3a4;return _0x245313;})['then'](respondWithFilteredResult(_0x204991,_0x302eaa))[_0x6725('0x2c')](handleError(_0x204991,null));};exports['show']=function(_0x23412e,_0xb4c1fb){var _0x8c5c5={'raw':!![],'where':{'id':_0x23412e[_0x6725('0x54')]['id']}},_0x25fe50={};_0x25fe50[_0x6725('0x41')]=_['keys'](db[_0x6725('0x3d')][_0x6725('0x3e')]);_0x25fe50['query']=_['keys'](_0x23412e[_0x6725('0x42')]);_0x25fe50[_0x6725('0x44')]=_[_0x6725('0x45')](_0x25fe50[_0x6725('0x41')],_0x25fe50[_0x6725('0x42')]);_0x8c5c5[_0x6725('0x46')]=_[_0x6725('0x45')](_0x25fe50[_0x6725('0x41')],qs['fields'](_0x23412e[_0x6725('0x42')][_0x6725('0x55')]));_0x8c5c5[_0x6725('0x46')]=_0x8c5c5[_0x6725('0x46')]['length']?_0x8c5c5[_0x6725('0x46')]:_0x25fe50[_0x6725('0x41')];if(_0x23412e[_0x6725('0x42')][_0x6725('0x56')]){_0x8c5c5[_0x6725('0x51')]=[{'all':!![]}];}_0x8c5c5=_[_0x6725('0x4f')]({},_0x8c5c5,_0x23412e[_0x6725('0x50')]);return db[_0x6725('0x3d')][_0x6725('0x57')](_0x8c5c5)['then'](handleEntityNotFound(_0xb4c1fb,null))[_0x6725('0x22')](respondWithResult(_0xb4c1fb,null))[_0x6725('0x2c')](handleError(_0xb4c1fb,null));};exports[_0x6725('0x58')]=function(_0x29879e,_0x1c0d31){return db[_0x6725('0x3d')][_0x6725('0x58')](_0x29879e[_0x6725('0x59')],{})['then'](respondWithResult(_0x1c0d31,0xc9))[_0x6725('0x2c')](handleError(_0x1c0d31,null));};exports[_0x6725('0x5a')]=function(_0xc35d36,_0x4ceb41){if(_0xc35d36['body']['id']){delete _0xc35d36[_0x6725('0x59')]['id'];}return db[_0x6725('0x3d')][_0x6725('0x57')]({'where':{'id':_0xc35d36['params']['id']}})['then'](handleEntityNotFound(_0x4ceb41,null))[_0x6725('0x22')](saveUpdates(_0xc35d36[_0x6725('0x59')],null))['then'](respondWithResult(_0x4ceb41,null))[_0x6725('0x2c')](handleError(_0x4ceb41,null));};exports[_0x6725('0x39')]=function(_0x1903f6,_0x41a0ad){return db['WhatsappMessage'][_0x6725('0x57')]({'where':{'id':_0x1903f6['params']['id']}})['then'](handleEntityNotFound(_0x41a0ad,null))['then'](removeEntity(_0x41a0ad,null))[_0x6725('0x2c')](handleError(_0x41a0ad,null));};exports[_0x6725('0x5b')]=function(_0x3b22b5,_0xc9889c){return db[_0x6725('0x3d')][_0x6725('0x5b')]()[_0x6725('0x22')](respondWithResult(_0xc9889c,null))['catch'](handleError(_0xc9889c,null));};var interaction_log=require(_0x6725('0x15'))(_0x6725('0x5c'));exports[_0x6725('0x5d')]=function(_0x46c51e,_0x12ecdc,_0x4085de){var _0x1aceea={'agent':{},'channel':_0x6725('0x5e')};if(_0x46c51e[_0x6725('0x59')]['id']){delete _0x46c51e['body']['id'];}_0x46c51e[_0x6725('0x59')][_0x6725('0x5f')]=!![];_0x46c51e[_0x6725('0x59')][_0x6725('0x60')]=moment()[_0x6725('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x46c51e[_0x6725('0x59')]['UserId']=_0x46c51e[_0x6725('0x59')][_0x6725('0x62')]||_0x46c51e[_0x6725('0x63')]['id'];_0x1aceea[_0x6725('0x64')]['id']=_0x46c51e[_0x6725('0x59')][_0x6725('0x62')];return db['WhatsappMessage'][_0x6725('0x57')]({'where':{'id':_0x46c51e['params']['id'],'UserId':null}})[_0x6725('0x22')](handleEntityNotFound(_0x12ecdc,null))[_0x6725('0x22')](saveUpdates(_0x46c51e[_0x6725('0x59')],null))[_0x6725('0x22')](function(_0x53b30e){if(_0x53b30e){_0x1aceea['message']=_0x53b30e['get']({'plain':!![]});return db[_0x6725('0x65')]['find']({'where':{'id':_0x53b30e[_0x6725('0x66')]}});}return null;})[_0x6725('0x22')](handleEntityNotFound(_0x12ecdc,null))[_0x6725('0x22')](function(_0x34761b){if(_0x34761b){return _0x34761b[_0x6725('0x5a')]({'UserId':_0x46c51e[_0x6725('0x59')][_0x6725('0x62')],'read1stAt':_[_0x6725('0x67')](_0x34761b[_0x6725('0x68')])?moment()[_0x6725('0x61')](_0x6725('0x69')):undefined});}return null;})[_0x6725('0x22')](function(_0x1dc7c0){if(_0x1dc7c0){_0x1aceea['interaction']=_0x1dc7c0[_0x6725('0x6a')]({'plain':!![]});interaction_log[_0x6725('0x23')](_0x6725('0x6b'),_0x46c51e[_0x6725('0x63')]['id'],_0x46c51e[_0x6725('0x63')][_0x6725('0x3b')],_0x46c51e[_0x6725('0x63')][_0x6725('0x6c')],_0x1aceea['interaction']['id'],_0x46c51e[_0x6725('0x59')]?JSON['stringify'](_0x46c51e[_0x6725('0x59')]):'null');return respondWithRpcPromise(_0x6725('0x6d'),'acceptMessage',_0x1aceea);}return null;})[_0x6725('0x22')](function(_0x1c1420){var _0x49790b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1c1420[_0x6725('0x29')]['ContactId'];return db[_0x6725('0x6e')][_0x6725('0x42')](_0x49790b,{'type':db['Sequelize']['QueryTypes'][_0x6725('0x6f')],'raw':!![]})[_0x6725('0x22')](function(_0x5bfd10){return _0x5bfd10;});})[_0x6725('0x22')](function(_0x31ba16){if(_0x31ba16){_0x1aceea[_0x6725('0x29')][_0x6725('0x70')]=_0x31ba16[0x0];if(!_0x46c51e[_0x6725('0x59')][_0x6725('0x62')])return;return db[_0x6725('0x71')][_0x6725('0x57')]({'where':{'id':_0x46c51e[_0x6725('0x59')][_0x6725('0x62')],'role':_0x6725('0x64')},'attributes':['id','name','fullname',_0x6725('0x72'),_0x6725('0x73')],'raw':!![]});}return null;})[_0x6725('0x22')](function(_0x2178a5){if(!_0x2178a5)return null;_0x1aceea[_0x6725('0x29')]['agent']=_0x2178a5;return _0x1aceea;})[_0x6725('0x22')](function(_0xe0b82c){if(_0xe0b82c){if(_0x46c51e[_0x6725('0x59')][_0x6725('0x74')]){_0x1aceea[_0x6725('0x29')][_0x6725('0x75')]=util['format']('SIP/%s',_0x46c51e[_0x6725('0x63')][_0x6725('0x3b')]);_0x1aceea[_0x6725('0x29')]['channel']=_0x1aceea[_0x6725('0x76')];_0x1aceea[_0x6725('0x29')][_0x6725('0x77')]=_0x1aceea[_0x6725('0x76')];_0x1aceea['message'][_0x6725('0x78')]=_0x6725('0x5d');return respondWithRpcPromise(_0x6725('0x79'),'EventManager',{'event':'acceptmessage','message':_0x1aceea[_0x6725('0x29')]},client9002)[_0x6725('0x22')](function(){return _0x1aceea;});}return _0x1aceea;}return null;})[_0x6725('0x22')](respondWithResult(_0x12ecdc,null))['catch'](handleError(_0x12ecdc,null));};var interaction_log=require(_0x6725('0x15'))('whatsapp-interactions');exports[_0x6725('0x37')]=function(_0x30ad0c,_0x53f0f5,_0x109c71){var _0x2cdae4={'agent':{},'channel':_0x6725('0x5e')};if(_0x30ad0c[_0x6725('0x59')]['id']){delete _0x30ad0c[_0x6725('0x59')]['id'];}_0x30ad0c[_0x6725('0x59')]['UserId']=_0x30ad0c[_0x6725('0x59')][_0x6725('0x62')]||_0x30ad0c[_0x6725('0x63')]['id'];_0x2cdae4['agent']['id']=_0x30ad0c[_0x6725('0x59')]['UserId'];return db['WhatsappMessage'][_0x6725('0x57')]({'where':{'id':_0x30ad0c[_0x6725('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x53f0f5,null))[_0x6725('0x22')](function(_0x5aea30){if(_0x5aea30){_0x2cdae4['message']=_0x5aea30[_0x6725('0x6a')]({'plain':!![]});return db[_0x6725('0x65')][_0x6725('0x57')]({'where':{'id':_0x5aea30[_0x6725('0x66')]}});}return null;})[_0x6725('0x22')](handleEntityNotFound(_0x53f0f5,null))[_0x6725('0x22')](function(_0x58e46c){if(_0x58e46c){_0x2cdae4[_0x6725('0x7a')]=_0x58e46c[_0x6725('0x6a')]({'plain':!![]});interaction_log[_0x6725('0x23')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x30ad0c[_0x6725('0x63')]['id'],_0x30ad0c['user'][_0x6725('0x3b')],_0x30ad0c['user'][_0x6725('0x6c')],_0x2cdae4[_0x6725('0x7a')]['id'],_0x30ad0c['body']?JSON[_0x6725('0x26')](_0x30ad0c[_0x6725('0x59')]):_0x6725('0x7b'));return respondWithRpcPromise(_0x6725('0x7c'),'rejectMessage',_0x2cdae4);}return null;})['then'](function(_0x2decc5){var _0x116468=_0x6725('0x7d')+_0x2decc5['message'][_0x6725('0x7e')];return db['sequelize'][_0x6725('0x42')](_0x116468,{'type':db[_0x6725('0x7f')][_0x6725('0x80')][_0x6725('0x6f')],'raw':!![]})['then'](function(_0x41a453){return _0x41a453;});})['then'](function(_0x3e9b13){if(_0x3e9b13){_0x2cdae4[_0x6725('0x29')]['contact']=_0x3e9b13[0x0];if(!_0x30ad0c['body']['UserId'])return;return db[_0x6725('0x71')][_0x6725('0x57')]({'where':{'id':_0x30ad0c[_0x6725('0x59')]['UserId'],'role':_0x6725('0x64')},'attributes':['id',_0x6725('0x3b'),_0x6725('0x81'),'email','internal'],'raw':!![]});}return null;})[_0x6725('0x22')](function(_0x2e64a3){if(!_0x2e64a3)return null;_0x2cdae4[_0x6725('0x29')][_0x6725('0x64')]=_0x2e64a3;return _0x2cdae4;})[_0x6725('0x22')](function(_0x163b24){if(_0x163b24){_0x163b24['message'][_0x6725('0x75')]=util[_0x6725('0x61')]('SIP/%s',_0x30ad0c['user'][_0x6725('0x3b')]);_0x163b24[_0x6725('0x29')]['channel']=_0x2cdae4[_0x6725('0x76')];_0x163b24[_0x6725('0x29')][_0x6725('0x77')]=_0x2cdae4['channel'];_0x163b24[_0x6725('0x29')][_0x6725('0x78')]=_0x6725('0x37');respondWithRpcPromise(_0x6725('0x79'),'EventManager',{'event':'rejectmessage','message':_0x163b24[_0x6725('0x29')]},client9002);return _0x2cdae4;}return null;})[_0x6725('0x22')](respondWithResult(_0x53f0f5,null))[_0x6725('0x2c')](handleError(_0x53f0f5,null));};exports[_0x6725('0x2e')]=function(_0xf3c05e,_0x106101,_0x719250){if(_0xf3c05e[_0x6725('0x59')]['id']){delete _0xf3c05e[_0x6725('0x59')]['id'];}var _0x4d9558;return db[_0x6725('0x3d')][_0x6725('0x57')]({'where':{'id':_0xf3c05e[_0x6725('0x54')]['id']}})[_0x6725('0x22')](handleEntityNotFound(_0x106101,null))['then'](function(_0x47cfcf){if(_0x47cfcf){_0x4d9558=_0x47cfcf;return db[_0x6725('0x82')][_0x6725('0x57')]({'where':{'id':_0x47cfcf[_0x6725('0x83')]}});}})[_0x6725('0x22')](handleEntityNotFound(_0x106101,null))['then'](function(_0x293374){if(_0x293374){logger[_0x6725('0x24')]('WhatsppMessage,\x20%s,\x20%s,\x20%s','status',_0x6725('0x84'),_0x293374[_0x6725('0x40')],util[_0x6725('0x85')](_0xf3c05e[_0x6725('0x59')],{'showHidden':![],'depth':null}));switch(_0x293374['type']){case _0x6725('0x86'):if(_0xf3c05e['body'][_0x6725('0x87')]&&_0xf3c05e[_0x6725('0x59')][_0x6725('0x87')]===_0x4d9558[_0x6725('0x88')]&&_0xf3c05e[_0x6725('0x59')][_0x6725('0x89')]&&_0xf3c05e[_0x6725('0x59')][_0x6725('0x89')]==='read'){return _0x4d9558[_0x6725('0x5a')]({'read':!![]});}else{logger[_0x6725('0x27')](_0x6725('0x8a'),_0x6725('0x2e'),_0x6725('0x86'),util[_0x6725('0x85')](_0xf3c05e[_0x6725('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x4d9558;}})[_0x6725('0x22')](respondWithResult(_0x106101,null))[_0x6725('0x2c')](handleError(_0x106101,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 3c84a0f..438d4f7 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 _0x3f8c=['emit','hasOwnProperty','hook','exports','WhatsappMessage','setMaxListeners','save','update'];(function(_0x44ba85,_0x478695){var _0x32545d=function(_0x3800fe){while(--_0x3800fe){_0x44ba85['push'](_0x44ba85['shift']());}};_0x32545d(++_0x478695);}(_0x3f8c,0x104));var _0xc3f8=function(_0x58c16b,_0x332d48){_0x58c16b=_0x58c16b-0x0;var _0x31002d=_0x3f8c[_0x58c16b];return _0x31002d;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db'][_0xc3f8('0x0')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xc3f8('0x1')](0x0);var events={'afterCreate':_0xc3f8('0x2'),'afterUpdate':_0xc3f8('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5bd5e7){return function(_0x54035a,_0x4e5dbd,_0x51b8b5){WhatsappMessageEvents[_0xc3f8('0x4')](_0x5bd5e7+':'+_0x54035a['id'],_0x54035a);WhatsappMessageEvents[_0xc3f8('0x4')](_0x5bd5e7,_0x54035a);_0x51b8b5(null);};}for(var e in events){if(events[_0xc3f8('0x5')](e)){var event=events[e];WhatsappMessage[_0xc3f8('0x6')](e,emitEvent(event));}}module[_0xc3f8('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0xb9be=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappMessage'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xb9be,0xc5));var _0xeb9b=function(_0x836465,_0x5442ae){_0x836465=_0x836465-0x0;var _0x2150ea=_0xb9be[_0x836465];return _0x2150ea;};'use strict';var EventEmitter=require(_0xeb9b('0x0'));var WhatsappMessage=require(_0xeb9b('0x1'))['db'][_0xeb9b('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xeb9b('0x3')](0x0);var events={'afterCreate':_0xeb9b('0x4'),'afterUpdate':_0xeb9b('0x5'),'afterDestroy':_0xeb9b('0x6')};function emitEvent(_0x2003d4){return function(_0x288aaa,_0x579a7e,_0x5006b8){WhatsappMessageEvents[_0xeb9b('0x7')](_0x2003d4+':'+_0x288aaa['id'],_0x288aaa);WhatsappMessageEvents[_0xeb9b('0x7')](_0x2003d4,_0x288aaa);_0x5006b8(null);};}for(var e in events){if(events[_0xeb9b('0x8')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xeb9b('0x9')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 9681df6..17aa17b 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 _0x0d9c=['Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','/whatsapp/v1/','/messages/','text','Bearer\x20','message_id','statuses','err','WhatsappMessage,\x20%s','finally','utf8mb4','util','../../config/logger','api','moment','request-promise','node-fetch','rimraf','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','get','direction','toLowerCase','secret','isNil','UserId','WhatsappInteraction','findOne','update','createdAt','catch','error','out','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','body','whatsapp:','/api/whatsapp/messages/','/status?token=','token','then','sid','afterCreate'];(function(_0x58d038,_0x508f2f){var _0xd5fa8f=function(_0x354b57){while(--_0x354b57){_0x58d038['push'](_0x58d038['shift']());}};_0xd5fa8f(++_0x508f2f);}(_0x0d9c,0x7c));var _0xc0d9=function(_0x6afc9c,_0xf6b755){_0x6afc9c=_0x6afc9c-0x0;var _0x195d68=_0x0d9c[_0x6afc9c];return _0x195d68;};'use strict';var _=require('lodash');var util=require(_0xc0d9('0x0'));var logger=require(_0xc0d9('0x1'))(_0xc0d9('0x2'));var moment=require(_0xc0d9('0x3'));var BPromise=require('bluebird');var rp=require(_0xc0d9('0x4'));var fetch=require(_0xc0d9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc0d9('0x6'));var config=require('../../config/environment');var attributes=require(_0xc0d9('0x7'));module[_0xc0d9('0x8')]=function(_0x2b5ae3,_0x434082){return _0x2b5ae3[_0xc0d9('0x9')](_0xc0d9('0xa'),attributes,{'tableName':_0xc0d9('0xb'),'paranoid':![],'indexes':[{'name':_0xc0d9('0xc'),'fields':[_0xc0d9('0xc')]},{'name':_0xc0d9('0xd'),'fields':['body'],'type':_0xc0d9('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1f5fc6,_0x5301c5,_0x52bbee){var _0x5971e5=_0x2b5ae3['models'];var _0x1e2201=_0x1f5fc6[_0xc0d9('0xf')]({'plain':!![]});if(_0x1e2201[_0xc0d9('0x10')][_0xc0d9('0x11')]()==='in'||_0x1e2201[_0xc0d9('0x10')][_0xc0d9('0x11')]()==='out'&&!_0x1e2201[_0xc0d9('0x12')]&&!_[_0xc0d9('0x13')](_0x1e2201[_0xc0d9('0x14')])){_0x5971e5[_0xc0d9('0x15')][_0xc0d9('0x16')]({'where':{'id':_0x1e2201['WhatsappInteractionId']}})['then'](function(_0x144380){if(_0x144380){_0x144380[_0xc0d9('0x17')]({'lastMsgAt':_0x1e2201[_0xc0d9('0x18')],'lastMsgDirection':_0x1e2201['direction'][_0xc0d9('0x11')]()});}})[_0xc0d9('0x19')](function(_0x3479c4){console[_0xc0d9('0x1a')](_0x3479c4);});}if(_0x1e2201[_0xc0d9('0x10')]===_0xc0d9('0x1b')&&!_0x1e2201[_0xc0d9('0x12')]){var _0x67bf00;_0x5971e5[_0xc0d9('0x1c')][_0xc0d9('0x1d')]({'where':{'id':_0x1e2201[_0xc0d9('0x1e')]},'raw':!![]})['then'](function(_0x5ab313){_0x67bf00=_0x5ab313;if(_0x67bf00&&_0x67bf00[_0xc0d9('0x1f')]){switch(_0x67bf00[_0xc0d9('0x1f')]){case _0xc0d9('0x20'):var _0x54d4eb=require(_0xc0d9('0x20'));if(_0x67bf00[_0xc0d9('0x21')]&&_0x67bf00[_0xc0d9('0x22')]&&_0x67bf00[_0xc0d9('0x23')]){var _0x3640a1=new _0x54d4eb(_0x67bf00[_0xc0d9('0x21')],_0x67bf00[_0xc0d9('0x22')]);_0x3640a1['messages']['create']({'body':_0x1e2201[_0xc0d9('0x24')],'to':_0xc0d9('0x25')+_0x1e2201[_0xc0d9('0x23')],'from':_0xc0d9('0x25')+_0x67bf00[_0xc0d9('0x23')],'statusCallback':_0x67bf00['remote']+_0xc0d9('0x26')+_0x1e2201['id']+_0xc0d9('0x27')+_0x67bf00[_0xc0d9('0x28')]})[_0xc0d9('0x29')](function(_0x9dc075){if(_0x9dc075[_0xc0d9('0x2a')]){return _0x1f5fc6[_0xc0d9('0x17')]({'messageId':_0x9dc075[_0xc0d9('0x2a')]});}})[_0xc0d9('0x19')](function(_0x17f1df){logger[_0xc0d9('0x1a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xc0d9('0x2b'),_0xc0d9('0x20'),util['inspect'](_0x17f1df,{'showHidden':![],'depth':null}));});}else{logger[_0xc0d9('0x1a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xc0d9('0x2b'),'twilio',_0xc0d9('0x2c'));}break;case _0xc0d9('0x2d'):var _0x5f17f3=_0x67bf00[_0xc0d9('0x21')];var _0xcddec=_0x67bf00[_0xc0d9('0x22')];var _0x268bab=_0x67bf00['baseUrl']+_0xc0d9('0x2e')+_0x5f17f3+_0xc0d9('0x2f');var _0x4b55f5={'to':[_0x1e2201[_0xc0d9('0x23')]],'message':{'type':_0xc0d9('0x30'),'text':_0x1e2201[_0xc0d9('0x24')]}};var _0x3c6ab3={'method':'POST','uri':_0x268bab,'headers':{'Authorization':_0xc0d9('0x31')+_0xcddec,'Content-Type':'application/json'},'body':_0x4b55f5,'json':!![]};rp(_0x3c6ab3)[_0xc0d9('0x29')](function(_0x2209b5){if(_0x2209b5['statuses'][0x0][_0xc0d9('0x32')]){return _0x1f5fc6[_0xc0d9('0x17')]({'messageId':_0x2209b5[_0xc0d9('0x33')][0x0][_0xc0d9('0x32')]});}})['catch'](function(_0x393445){logger[_0xc0d9('0x34')](_0xc0d9('0x35'),_0x393445);});break;}}})[_0xc0d9('0x36')](function(){_0x52bbee();});}else{_0x52bbee();}}},'charset':_0xc0d9('0x37'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x0976=['err','WhatsappMessage,\x20%s','finally','lodash','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','createdAt','catch','error','WhatsappAccount','WhatsappAccountId','then','type','twilio','accountSid','authToken','messages','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','update'];(function(_0x5aadfc,_0x1905a5){var _0x491ac7=function(_0x4154d9){while(--_0x4154d9){_0x5aadfc['push'](_0x5aadfc['shift']());}};_0x491ac7(++_0x1905a5);}(_0x0976,0xef));var _0x6097=function(_0x1c350a,_0x1d52b5){_0x1c350a=_0x1c350a-0x0;var _0x1895a8=_0x0976[_0x1c350a];return _0x1895a8;};'use strict';var _=require(_0x6097('0x0'));var util=require('util');var logger=require(_0x6097('0x1'))(_0x6097('0x2'));var moment=require(_0x6097('0x3'));var BPromise=require(_0x6097('0x4'));var rp=require(_0x6097('0x5'));var fetch=require(_0x6097('0x6'));var fs=require('fs');var path=require(_0x6097('0x7'));var rimraf=require(_0x6097('0x8'));var config=require(_0x6097('0x9'));var attributes=require(_0x6097('0xa'));module[_0x6097('0xb')]=function(_0x497c10,_0x3888aa){return _0x497c10['define'](_0x6097('0xc'),attributes,{'tableName':_0x6097('0xd'),'paranoid':![],'indexes':[{'name':_0x6097('0xe'),'fields':[_0x6097('0xe')]},{'name':_0x6097('0xf'),'fields':[_0x6097('0x10')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3bff71,_0x367987,_0x218ac7){var _0x4a753f=_0x497c10['models'];var _0x9f73b5=_0x3bff71[_0x6097('0x11')]({'plain':!![]});if(_0x9f73b5[_0x6097('0x12')][_0x6097('0x13')]()==='in'||_0x9f73b5['direction']['toLowerCase']()===_0x6097('0x14')&&!_0x9f73b5[_0x6097('0x15')]&&!_[_0x6097('0x16')](_0x9f73b5[_0x6097('0x17')])){_0x4a753f[_0x6097('0x18')][_0x6097('0x19')]({'where':{'id':_0x9f73b5[_0x6097('0x1a')]}})['then'](function(_0x30fbe7){if(_0x30fbe7){_0x30fbe7['update']({'lastMsgAt':_0x9f73b5[_0x6097('0x1b')],'lastMsgDirection':_0x9f73b5[_0x6097('0x12')][_0x6097('0x13')]()});}})[_0x6097('0x1c')](function(_0x4fe948){console[_0x6097('0x1d')](_0x4fe948);});}if(_0x9f73b5['direction']===_0x6097('0x14')&&!_0x9f73b5['secret']){var _0x95787d;_0x4a753f[_0x6097('0x1e')]['find']({'where':{'id':_0x9f73b5[_0x6097('0x1f')]},'raw':!![]})[_0x6097('0x20')](function(_0x251ca1){_0x95787d=_0x251ca1;if(_0x95787d&&_0x95787d['type']){switch(_0x95787d[_0x6097('0x21')]){case _0x6097('0x22'):var _0x572cf9=require('twilio');if(_0x95787d[_0x6097('0x23')]&&_0x95787d[_0x6097('0x24')]&&_0x95787d['phone']){var _0x45ac05=new _0x572cf9(_0x95787d[_0x6097('0x23')],_0x95787d['authToken']);_0x45ac05[_0x6097('0x25')]['create']({'body':_0x9f73b5['body'],'to':_0x6097('0x26')+_0x9f73b5['phone'],'from':_0x6097('0x26')+_0x95787d['phone'],'statusCallback':_0x95787d[_0x6097('0x27')]+_0x6097('0x28')+_0x9f73b5['id']+_0x6097('0x29')+_0x95787d['token']})[_0x6097('0x20')](function(_0x14bc16){if(_0x14bc16[_0x6097('0x2a')]){return _0x3bff71['update']({'messageId':_0x14bc16[_0x6097('0x2a')]});}})['catch'](function(_0x123539){logger[_0x6097('0x1d')](_0x6097('0x2b'),'afterCreate','twilio',util[_0x6097('0x2c')](_0x123539,{'showHidden':![],'depth':null}));});}else{logger[_0x6097('0x1d')](_0x6097('0x2b'),'afterCreate',_0x6097('0x22'),_0x6097('0x2d'));}break;case'sinch':var _0x29c525=_0x95787d[_0x6097('0x23')];var _0x3f82d9=_0x95787d[_0x6097('0x24')];var _0xad335a=_0x95787d[_0x6097('0x2e')]+_0x6097('0x2f')+_0x29c525+_0x6097('0x30');var _0x5092cd={'to':[_0x9f73b5['phone']],'message':{'type':_0x6097('0x31'),'text':_0x9f73b5[_0x6097('0x10')]}};var _0x3eaa12={'method':_0x6097('0x32'),'uri':_0xad335a,'headers':{'Authorization':_0x6097('0x33')+_0x3f82d9,'Content-Type':_0x6097('0x34')},'body':_0x5092cd,'json':!![]};rp(_0x3eaa12)[_0x6097('0x20')](function(_0x5beb75){if(_0x5beb75[_0x6097('0x35')][0x0][_0x6097('0x36')]){return _0x3bff71[_0x6097('0x37')]({'messageId':_0x5beb75['statuses'][0x0]['message_id']});}})['catch'](function(_0x4a108d){logger[_0x6097('0x38')](_0x6097('0x39'),_0x4a108d);});break;}}})[_0x6097('0x3a')](function(){_0x218ac7();});}else{_0x218ac7();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 5ffd4d7..168e0a4 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 _0xf308=['WhatsappMessage,\x20%s,\x20%s','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','CreateWhatsappMessage','create','body','options','raw','debug','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0xf308,0x190));var _0x8f30=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf308[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x8f30('0x0'));var util=require(_0x8f30('0x1'));var moment=require(_0x8f30('0x2'));var BPromise=require(_0x8f30('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8f30('0x4'));var db=require(_0x8f30('0x5'))['db'];var utils=require(_0x8f30('0x6'));var logger=require(_0x8f30('0x7'))(_0x8f30('0x8'));var config=require(_0x8f30('0x9'));var jayson=require(_0x8f30('0xa'));var client=jayson[_0x8f30('0xb')][_0x8f30('0xc')]({'port':0x232a});config[_0x8f30('0xd')]=_[_0x8f30('0xe')](config[_0x8f30('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x8f30('0xf'))(new Redis(config[_0x8f30('0xd')]));require('./whatsappMessage.socket')[_0x8f30('0x10')](socket);function respondWithRpcPromise(_0x530828,_0x103def,_0x24bc88){return new BPromise(function(_0x5bb9d4,_0x5b1953){return client[_0x8f30('0x11')](_0x530828,_0x24bc88)[_0x8f30('0x12')](function(_0x57a780){logger[_0x8f30('0x13')](_0x8f30('0x14'),_0x103def,'request\x20sent');logger['debug'](_0x8f30('0x15'),_0x103def,'request\x20sent',JSON[_0x8f30('0x16')](_0x57a780));if(_0x57a780[_0x8f30('0x17')]){if(_0x57a780[_0x8f30('0x17')][_0x8f30('0x18')]===0x1f4){logger[_0x8f30('0x17')](_0x8f30('0x14'),_0x103def,_0x57a780[_0x8f30('0x17')][_0x8f30('0x19')]);return _0x5b1953(_0x57a780[_0x8f30('0x17')][_0x8f30('0x19')]);}logger[_0x8f30('0x17')](_0x8f30('0x14'),_0x103def,_0x57a780[_0x8f30('0x17')][_0x8f30('0x19')]);return _0x5bb9d4(_0x57a780[_0x8f30('0x17')][_0x8f30('0x19')]);}else{logger[_0x8f30('0x13')](_0x8f30('0x14'),_0x103def,_0x8f30('0x1a'));_0x5bb9d4(_0x57a780[_0x8f30('0x1b')][_0x8f30('0x19')]);}})['catch'](function(_0x4971c1){logger[_0x8f30('0x17')](_0x8f30('0x14'),_0x103def,_0x4971c1);_0x5b1953(_0x4971c1);});});}exports[_0x8f30('0x1c')]=function(_0x3869c1){var _0x109daa=this;return new Promise(function(_0x49ed01,_0x219f06){return db['WhatsappMessage'][_0x8f30('0x1d')](_0x3869c1[_0x8f30('0x1e')],{'raw':_0x3869c1['options']?_0x3869c1[_0x8f30('0x1f')][_0x8f30('0x20')]===undefined?!![]:![]:!![]})[_0x8f30('0x12')](function(_0x16dd53){logger[_0x8f30('0x13')](_0x8f30('0x1c'),_0x3869c1);logger[_0x8f30('0x21')]('CreateWhatsappMessage',_0x3869c1,JSON[_0x8f30('0x16')](_0x16dd53));_0x49ed01(_0x16dd53);})[_0x8f30('0x22')](function(_0x538f90){logger['error'](_0x8f30('0x1c'),_0x538f90[_0x8f30('0x19')],_0x3869c1);_0x219f06(_0x109daa[_0x8f30('0x17')](0x1f4,_0x538f90[_0x8f30('0x19')]));});});}; \ No newline at end of file +var _0x7eee=['../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateWhatsappMessage','body','options','raw','debug','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2ea598,_0x2dab82){var _0x28271f=function(_0xed73d3){while(--_0xed73d3){_0x2ea598['push'](_0x2ea598['shift']());}};_0x28271f(++_0x2dab82);}(_0x7eee,0x72));var _0xe7ee=function(_0x49328f,_0x497a7b){_0x49328f=_0x49328f-0x0;var _0x410016=_0x7eee[_0x49328f];return _0x410016;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe7ee('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe7ee('0x1'));var db=require(_0xe7ee('0x2'))['db'];var utils=require(_0xe7ee('0x3'));var logger=require(_0xe7ee('0x4'))(_0xe7ee('0x5'));var config=require(_0xe7ee('0x6'));var jayson=require(_0xe7ee('0x7'));var client=jayson[_0xe7ee('0x8')][_0xe7ee('0x9')]({'port':0x232a});config[_0xe7ee('0xa')]=_['defaults'](config[_0xe7ee('0xa')],{'host':_0xe7ee('0xb'),'port':0x18eb});var socket=require(_0xe7ee('0xc'))(new Redis(config[_0xe7ee('0xa')]));require(_0xe7ee('0xd'))[_0xe7ee('0xe')](socket);function respondWithRpcPromise(_0x4652b4,_0x4e355d,_0x3fd52c){return new BPromise(function(_0x1ebb9b,_0x3592b9){return client[_0xe7ee('0xf')](_0x4652b4,_0x3fd52c)['then'](function(_0x578df6){logger[_0xe7ee('0x10')](_0xe7ee('0x11'),_0x4e355d,_0xe7ee('0x12'));logger['debug'](_0xe7ee('0x13'),_0x4e355d,_0xe7ee('0x12'),JSON[_0xe7ee('0x14')](_0x578df6));if(_0x578df6[_0xe7ee('0x15')]){if(_0x578df6[_0xe7ee('0x15')][_0xe7ee('0x16')]===0x1f4){logger[_0xe7ee('0x15')](_0xe7ee('0x11'),_0x4e355d,_0x578df6[_0xe7ee('0x15')][_0xe7ee('0x17')]);return _0x3592b9(_0x578df6['error'][_0xe7ee('0x17')]);}logger[_0xe7ee('0x15')](_0xe7ee('0x11'),_0x4e355d,_0x578df6[_0xe7ee('0x15')]['message']);return _0x1ebb9b(_0x578df6[_0xe7ee('0x15')][_0xe7ee('0x17')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x4e355d,_0xe7ee('0x12'));_0x1ebb9b(_0x578df6['result'][_0xe7ee('0x17')]);}})[_0xe7ee('0x18')](function(_0x173c82){logger['error'](_0xe7ee('0x11'),_0x4e355d,_0x173c82);_0x3592b9(_0x173c82);});});}exports[_0xe7ee('0x19')]=function(_0xe101b4){var _0x2faffa=this;return new Promise(function(_0x14db62,_0x44afb0){return db['WhatsappMessage']['create'](_0xe101b4[_0xe7ee('0x1a')],{'raw':_0xe101b4[_0xe7ee('0x1b')]?_0xe101b4[_0xe7ee('0x1b')][_0xe7ee('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x40b235){logger['info'](_0xe7ee('0x19'),_0xe101b4);logger[_0xe7ee('0x1d')](_0xe7ee('0x19'),_0xe101b4,JSON[_0xe7ee('0x14')](_0x40b235));_0x14db62(_0x40b235);})[_0xe7ee('0x18')](function(_0x386112){logger['error'](_0xe7ee('0x19'),_0x386112[_0xe7ee('0x17')],_0xe101b4);_0x44afb0(_0x2faffa[_0xe7ee('0x15')](0x1f4,_0x386112[_0xe7ee('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index bbfda00..200f083 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 _0x7a4a=['save','remove','emit','removeListener','register','whatsappMessage:','./whatsappMessage.events'];(function(_0x4ea092,_0x531671){var _0x53a0fd=function(_0x4f67cd){while(--_0x4f67cd){_0x4ea092['push'](_0x4ea092['shift']());}};_0x53a0fd(++_0x531671);}(_0x7a4a,0x8b));var _0xa7a4=function(_0x582274,_0x2cbd9c){_0x582274=_0x582274-0x0;var _0x8f14d3=_0x7a4a[_0x582274];return _0x8f14d3;};'use strict';var WhatsappMessageEvents=require(_0xa7a4('0x0'));var events=[_0xa7a4('0x1'),_0xa7a4('0x2'),'update'];function createListener(_0x5ec646,_0x5366b5){return function(_0x41525c){_0x5366b5[_0xa7a4('0x3')](_0x5ec646,_0x41525c);};}function removeListener(_0x12e6c0,_0x5bbbb5){return function(){WhatsappMessageEvents[_0xa7a4('0x4')](_0x12e6c0,_0x5bbbb5);};}exports[_0xa7a4('0x5')]=function(_0x42edef){for(var _0x5ae486=0x0,_0x27ca8b=events['length'];_0x5ae486<_0x27ca8b;_0x5ae486++){var _0x188d56=events[_0x5ae486];var _0x572bc9=createListener(_0xa7a4('0x6')+_0x188d56,_0x42edef);WhatsappMessageEvents['on'](_0x188d56,_0x572bc9);}}; \ No newline at end of file +var _0xb045=['removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save','remove','emit'];(function(_0x302535,_0x45e81e){var _0xd2f793=function(_0x2516ec){while(--_0x2516ec){_0x302535['push'](_0x302535['shift']());}};_0xd2f793(++_0x45e81e);}(_0xb045,0x8c));var _0x5b04=function(_0x4fa97c,_0x4aa6ab){_0x4fa97c=_0x4fa97c-0x0;var _0x518c7f=_0xb045[_0x4fa97c];return _0x518c7f;};'use strict';var WhatsappMessageEvents=require(_0x5b04('0x0'));var events=[_0x5b04('0x1'),_0x5b04('0x2'),'update'];function createListener(_0x460f2b,_0x3bd8c5){return function(_0x3607cc){_0x3bd8c5[_0x5b04('0x3')](_0x460f2b,_0x3607cc);};}function removeListener(_0x1d1008,_0x2a3b88){return function(){WhatsappMessageEvents[_0x5b04('0x4')](_0x1d1008,_0x2a3b88);};}exports[_0x5b04('0x5')]=function(_0x54fe84){for(var _0x4b744b=0x0,_0x26695b=events[_0x5b04('0x6')];_0x4b744b<_0x26695b;_0x4b744b++){var _0xee40bf=events[_0x4b744b];var _0x3f68be=createListener(_0x5b04('0x7')+_0xee40bf,_0x54fe84);WhatsappMessageEvents['on'](_0xee40bf,_0x3f68be);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index b063aab..473a78b 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 _0xd7a4=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put'];(function(_0x2b78e5,_0x3126f8){var _0xa8d52d=function(_0x51fd7f){while(--_0x51fd7f){_0x2b78e5['push'](_0x2b78e5['shift']());}};_0xa8d52d(++_0x3126f8);}(_0xd7a4,0x7e));var _0x4d7a=function(_0x35f735,_0x23be1b){_0x35f735=_0x35f735-0x0;var _0x59fdfc=_0xd7a4[_0x35f735];return _0x59fdfc;};'use strict';var multer=require(_0x4d7a('0x0'));var util=require(_0x4d7a('0x1'));var path=require('path');var timeout=require(_0x4d7a('0x2'));var express=require(_0x4d7a('0x3'));var router=express[_0x4d7a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4d7a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4d7a('0x6'));var controller=require('./whatsappQueue.controller');router[_0x4d7a('0x7')]('/',auth[_0x4d7a('0x8')](),controller[_0x4d7a('0x9')]);router[_0x4d7a('0x7')](_0x4d7a('0xa'),auth[_0x4d7a('0x8')](),controller[_0x4d7a('0xb')]);router[_0x4d7a('0x7')](_0x4d7a('0xc'),auth['isAuthenticated'](),controller[_0x4d7a('0xd')]);router['get'](_0x4d7a('0xe'),auth[_0x4d7a('0x8')](),controller['getMembers']);router['get']('/:id/teams',auth[_0x4d7a('0x8')](),controller[_0x4d7a('0xf')]);router[_0x4d7a('0x7')](_0x4d7a('0x10'),auth[_0x4d7a('0x8')](),controller[_0x4d7a('0x11')]);router[_0x4d7a('0x12')]('/',auth[_0x4d7a('0x8')](),controller[_0x4d7a('0x13')]);router[_0x4d7a('0x12')](_0x4d7a('0x14'),auth[_0x4d7a('0x8')](),controller[_0x4d7a('0x15')]);router[_0x4d7a('0x12')](_0x4d7a('0x10'),auth['isAuthenticated'](),controller[_0x4d7a('0x16')]);router[_0x4d7a('0x17')](_0x4d7a('0xc'),auth['isAuthenticated'](),controller[_0x4d7a('0x18')]);router[_0x4d7a('0x19')](_0x4d7a('0xc'),auth[_0x4d7a('0x8')](),controller[_0x4d7a('0x1a')]);router[_0x4d7a('0x19')](_0x4d7a('0x14'),auth[_0x4d7a('0x8')](),controller[_0x4d7a('0x1b')]);router['delete'](_0x4d7a('0x10'),auth['isAuthenticated'](),controller[_0x4d7a('0x1c')]);module[_0x4d7a('0x1d')]=router; \ No newline at end of file +var _0x3c75=['delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','put','update'];(function(_0xada2d2,_0x23ffcf){var _0x530305=function(_0x2c0cf8){while(--_0x2c0cf8){_0xada2d2['push'](_0xada2d2['shift']());}};_0x530305(++_0x23ffcf);}(_0x3c75,0x1f4));var _0x53c7=function(_0x2b1336,_0x3bc269){_0x2b1336=_0x2b1336-0x0;var _0x22301a=_0x3c75[_0x2b1336];return _0x22301a;};'use strict';var multer=require(_0x53c7('0x0'));var util=require(_0x53c7('0x1'));var path=require(_0x53c7('0x2'));var timeout=require(_0x53c7('0x3'));var express=require(_0x53c7('0x4'));var router=express[_0x53c7('0x5')]();var fs_extra=require(_0x53c7('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x53c7('0x7'));var config=require(_0x53c7('0x8'));var controller=require(_0x53c7('0x9'));router[_0x53c7('0xa')]('/',auth[_0x53c7('0xb')](),controller[_0x53c7('0xc')]);router[_0x53c7('0xa')](_0x53c7('0xd'),auth[_0x53c7('0xb')](),controller[_0x53c7('0xe')]);router['get'](_0x53c7('0xf'),auth[_0x53c7('0xb')](),controller[_0x53c7('0x10')]);router['get'](_0x53c7('0x11'),auth[_0x53c7('0xb')](),controller[_0x53c7('0x12')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller[_0x53c7('0x13')]);router['get'](_0x53c7('0x14'),auth[_0x53c7('0xb')](),controller[_0x53c7('0x15')]);router[_0x53c7('0x16')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x53c7('0x17'),auth[_0x53c7('0xb')](),controller[_0x53c7('0x18')]);router[_0x53c7('0x16')](_0x53c7('0x14'),auth[_0x53c7('0xb')](),controller['addAgents']);router[_0x53c7('0x19')](_0x53c7('0xf'),auth[_0x53c7('0xb')](),controller[_0x53c7('0x1a')]);router[_0x53c7('0x1b')](_0x53c7('0xf'),auth[_0x53c7('0xb')](),controller[_0x53c7('0x1c')]);router[_0x53c7('0x1b')]('/:id/teams',auth[_0x53c7('0xb')](),controller['removeTeams']);router[_0x53c7('0x1b')](_0x53c7('0x14'),auth[_0x53c7('0xb')](),controller[_0x53c7('0x1d')]);module[_0x53c7('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 60d2bd1..2df537e 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 _0x91a7=['beepall','exports','STRING','name','ENUM'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x91a7,0xe7));var _0x791a=function(_0x35f3b5,_0xcbee2d){_0x35f3b5=_0x35f3b5-0x0;var _0x5d2a4c=_0x91a7[_0x35f3b5];return _0x5d2a4c;};'use strict';var Sequelize=require('sequelize');module[_0x791a('0x0')]={'name':{'type':Sequelize[_0x791a('0x1')],'unique':_0x791a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x791a('0x3')]('rrmemory',_0x791a('0x4'),'roundrobin')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcb18=['STRING','INTEGER','rrmemory','beepall','roundrobin'];(function(_0x4841d0,_0x36c16f){var _0x551437=function(_0x1080d7){while(--_0x1080d7){_0x4841d0['push'](_0x4841d0['shift']());}};_0x551437(++_0x36c16f);}(_0xcb18,0x159));var _0x8cb1=function(_0x708a40,_0x778c58){_0x708a40=_0x708a40-0x0;var _0xe950b=_0xcb18[_0x708a40];return _0xe950b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8cb1('0x0')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x8cb1('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x8cb1('0x2'),_0x8cb1('0x3'),_0x8cb1('0x4'))},'description':{'type':Sequelize[_0x8cb1('0x0')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 288b767..676cce8 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 _0x496b=['join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','every','TeamId','includes','union','compact','value','transaction','removeTeams','removeAgents','userWhatsappQueue:remove','addAgents','spread','isArray','getAgents','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','status','end','offset','limit','count','set','apply','reject','save','then','destroy','get','WhatsappQueues','UserProfileResource','sendStatus','error','stack','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','name','filter','options','WhatsappQueue','includeAll','include','findAll','rows','catch','show','keys','model','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','update','params','describe','getMembers','findOne','UserWhatsappQueue','pick','WhatsappQueueId','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','format','createdAt','getTeams','Team','ids','Agents','voicePause','interface','flatMap','sequelize','addTeams','findOrCreate','forEach','emit','userWhatsappQueue:save','field','from','team_has_whatsapp_queues'];(function(_0x560e99,_0xd4aa09){var _0x2d770d=function(_0x131766){while(--_0x131766){_0x560e99['push'](_0x560e99['shift']());}};_0x2d770d(++_0xd4aa09);}(_0x496b,0x126));var _0xb496=function(_0x3e25c1,_0x1d15f9){_0x3e25c1=_0x3e25c1-0x0;var _0x52e7f2=_0x496b[_0x3e25c1];return _0x52e7f2;};'use strict';var emlformat=require(_0xb496('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb496('0x1'));var BPromise=require(_0xb496('0x2'));var Mustache=require(_0xb496('0x3'));var util=require(_0xb496('0x4'));var path=require(_0xb496('0x5'));var sox=require(_0xb496('0x6'));var csv=require(_0xb496('0x7'));var ejs=require(_0xb496('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb496('0x9'));var crypto=require(_0xb496('0xa'));var jsforce=require(_0xb496('0xb'));var deskjs=require(_0xb496('0xc'));var toCsv=require(_0xb496('0x7'));var querystring=require(_0xb496('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb496('0xe'));var qs=require(_0xb496('0xf'));var as=require(_0xb496('0x10'));var hardwareService=require(_0xb496('0x11'));var logger=require(_0xb496('0x12'))(_0xb496('0x13'));var utils=require(_0xb496('0x14'));var config=require(_0xb496('0x15'));var licenseUtil=require(_0xb496('0x16'));var db=require(_0xb496('0x17'))['db'];config[_0xb496('0x18')]=_[_0xb496('0x19')](config['redis'],{'host':_0xb496('0x1a'),'port':0x18eb});var socket=require(_0xb496('0x1b'))(new Redis(config[_0xb496('0x18')]));require(_0xb496('0x1c'))[_0xb496('0x1d')](socket);function respondWithStatusCode(_0x19463f,_0x3c06d6){_0x3c06d6=_0x3c06d6||0xcc;return function(_0x4fe15a){if(_0x4fe15a){return _0x19463f['sendStatus'](_0x3c06d6);}return _0x19463f[_0xb496('0x1e')](_0x3c06d6)[_0xb496('0x1f')]();};}function respondWithResult(_0x27806f,_0xae62b4){_0xae62b4=_0xae62b4||0xc8;return function(_0x50d01b){if(_0x50d01b){return _0x27806f['status'](_0xae62b4)['json'](_0x50d01b);}};}function respondWithFilteredResult(_0x406118,_0x417c6b){return function(_0x3ef55f){if(_0x3ef55f){var _0x3fbeea=typeof _0x417c6b[_0xb496('0x20')]==='undefined'&&typeof _0x417c6b[_0xb496('0x21')]==='undefined';var _0x2b13c5=_0x3ef55f[_0xb496('0x22')];var _0xa292e4=_0x3fbeea?0x0:_0x417c6b[_0xb496('0x20')];var _0x47597d=_0x3fbeea?_0x3ef55f[_0xb496('0x22')]:_0x417c6b[_0xb496('0x20')]+_0x417c6b['limit'];var _0x2158a9;if(_0x47597d>=_0x2b13c5){_0x47597d=_0x2b13c5;_0x2158a9=0xc8;}else{_0x2158a9=0xce;}_0x406118[_0xb496('0x1e')](_0x2158a9);return _0x406118[_0xb496('0x23')]('Content-Range',_0xa292e4+'-'+_0x47597d+'/'+_0x2b13c5)['json'](_0x3ef55f);}return null;};}function patchUpdates(_0x159f31){return function(_0x2c6609){try{jsonpatch[_0xb496('0x24')](_0x2c6609,_0x159f31,!![]);}catch(_0x59de9b){return BPromise[_0xb496('0x25')](_0x59de9b);}return _0x2c6609[_0xb496('0x26')]();};}function saveUpdates(_0x318da6,_0x218d4e){return function(_0x2d7d27){if(_0x2d7d27){return _0x2d7d27['update'](_0x318da6)[_0xb496('0x27')](function(_0x546892){return _0x546892;});}return null;};}function removeEntity(_0x8ebbe5,_0xcdb36){return function(_0x3466ec){if(_0x3466ec){return _0x3466ec[_0xb496('0x28')]()[_0xb496('0x27')](function(){var _0x4943ca=_0x3466ec[_0xb496('0x29')]({'plain':!![]});var _0x438757=_0xb496('0x2a');return db[_0xb496('0x2b')][_0xb496('0x28')]({'where':{'type':_0x438757,'resourceId':_0x4943ca['id']}})[_0xb496('0x27')](function(){return _0x3466ec;});})['then'](function(){_0x8ebbe5['status'](0xcc)[_0xb496('0x1f')]();});}};}function handleEntityNotFound(_0x24f50a,_0x12a389){return function(_0x277334){if(!_0x277334){_0x24f50a[_0xb496('0x2c')](0x194);}return _0x277334;};}function handleError(_0x690a7b,_0x59fe7d){_0x59fe7d=_0x59fe7d||0x1f4;return function(_0x33220a){logger[_0xb496('0x2d')](_0x33220a[_0xb496('0x2e')]);if(_0x33220a['name']){delete _0x33220a['name'];}_0x690a7b['status'](_0x59fe7d)['send'](_0x33220a);};}exports[_0xb496('0x2f')]=function(_0x502670,_0x532827){var _0x4826c0={},_0x4f8b0e={},_0x36473a={'count':0x0,'rows':[]};var _0x475cbf=_[_0xb496('0x30')](db['WhatsappQueue'][_0xb496('0x31')],function(_0x3b7478){return{'name':_0x3b7478[_0xb496('0x32')],'type':_0x3b7478[_0xb496('0x33')][_0xb496('0x34')]};});_0x4f8b0e['model']=_[_0xb496('0x30')](_0x475cbf,'name');_0x4f8b0e[_0xb496('0x35')]=_['keys'](_0x502670[_0xb496('0x35')]);_0x4f8b0e[_0xb496('0x36')]=_[_0xb496('0x37')](_0x4f8b0e['model'],_0x4f8b0e['query']);_0x4826c0[_0xb496('0x38')]=_['intersection'](_0x4f8b0e['model'],qs['fields'](_0x502670[_0xb496('0x35')][_0xb496('0x39')]));_0x4826c0[_0xb496('0x38')]=_0x4826c0[_0xb496('0x38')][_0xb496('0x3a')]?_0x4826c0[_0xb496('0x38')]:_0x4f8b0e['model'];if(!_0x502670['query'][_0xb496('0x3b')](_0xb496('0x3c'))){_0x4826c0['limit']=qs[_0xb496('0x21')](_0x502670[_0xb496('0x35')][_0xb496('0x21')]);_0x4826c0[_0xb496('0x20')]=qs[_0xb496('0x20')](_0x502670[_0xb496('0x35')][_0xb496('0x20')]);}_0x4826c0[_0xb496('0x3d')]=qs[_0xb496('0x3e')](_0x502670[_0xb496('0x35')][_0xb496('0x3e')]);_0x4826c0[_0xb496('0x3f')]=qs['filters'](_['pick'](_0x502670['query'],_0x4f8b0e[_0xb496('0x36')]),_0x475cbf);if(_0x502670['query']['filter']){_0x4826c0[_0xb496('0x3f')]=_[_0xb496('0x40')](_0x4826c0[_0xb496('0x3f')],{'$or':_[_0xb496('0x30')](_0x475cbf,function(_0x3724a6){if(_0x3724a6[_0xb496('0x33')]!==_0xb496('0x41')){var _0x3ca103={};_0x3ca103[_0x3724a6[_0xb496('0x42')]]={'$like':'%'+_0x502670[_0xb496('0x35')][_0xb496('0x43')]+'%'};return _0x3ca103;}})});}_0x4826c0=_['merge']({},_0x4826c0,_0x502670[_0xb496('0x44')]);var _0x24ba15={'where':_0x4826c0[_0xb496('0x3f')]};return db[_0xb496('0x45')][_0xb496('0x22')](_0x24ba15)['then'](function(_0xcd6cd1){_0x36473a[_0xb496('0x22')]=_0xcd6cd1;if(_0x502670[_0xb496('0x35')][_0xb496('0x46')]){_0x4826c0[_0xb496('0x47')]=[{'all':!![]}];}return db['WhatsappQueue'][_0xb496('0x48')](_0x4826c0);})[_0xb496('0x27')](function(_0x804450){_0x36473a[_0xb496('0x49')]=_0x804450;return _0x36473a;})['then'](respondWithFilteredResult(_0x532827,_0x4826c0))[_0xb496('0x4a')](handleError(_0x532827,null));};exports[_0xb496('0x4b')]=function(_0x35695c,_0x158ddc){var _0x957a31={'raw':!![],'where':{'id':_0x35695c['params']['id']}},_0xcd7678={};_0xcd7678['model']=_['keys'](db[_0xb496('0x45')][_0xb496('0x31')]);_0xcd7678[_0xb496('0x35')]=_[_0xb496('0x4c')](_0x35695c[_0xb496('0x35')]);_0xcd7678[_0xb496('0x36')]=_[_0xb496('0x37')](_0xcd7678[_0xb496('0x4d')],_0xcd7678[_0xb496('0x35')]);_0x957a31[_0xb496('0x38')]=_[_0xb496('0x37')](_0xcd7678[_0xb496('0x4d')],qs[_0xb496('0x39')](_0x35695c[_0xb496('0x35')][_0xb496('0x39')]));_0x957a31['attributes']=_0x957a31[_0xb496('0x38')]['length']?_0x957a31[_0xb496('0x38')]:_0xcd7678[_0xb496('0x4d')];if(_0x35695c[_0xb496('0x35')]['includeAll']){_0x957a31[_0xb496('0x47')]=[{'all':!![]}];}_0x957a31=_[_0xb496('0x40')]({},_0x957a31,_0x35695c[_0xb496('0x44')]);return db[_0xb496('0x45')][_0xb496('0x4e')](_0x957a31)[_0xb496('0x27')](handleEntityNotFound(_0x158ddc,null))['then'](respondWithResult(_0x158ddc,null))['catch'](handleError(_0x158ddc,null));};exports[_0xb496('0x4f')]=function(_0x497021,_0x5e0553){return db[_0xb496('0x45')]['create'](_0x497021[_0xb496('0x50')],{})[_0xb496('0x27')](function(_0x49c688){var _0x3c3739=_0x497021[_0xb496('0x51')][_0xb496('0x29')]({'plain':!![]});if(!_0x3c3739)throw new Error(_0xb496('0x52'));if(_0x3c3739[_0xb496('0x53')]==='user'){var _0x4c97a4=_0x49c688[_0xb496('0x29')]({'plain':!![]});var _0x2ce5b2=_0xb496('0x2a');return db['UserProfileSection'][_0xb496('0x4e')]({'where':{'name':_0x2ce5b2,'userProfileId':_0x3c3739[_0xb496('0x54')]},'raw':!![]})['then'](function(_0x26167d){if(_0x26167d&&_0x26167d['autoAssociation']===0x0){return db[_0xb496('0x2b')][_0xb496('0x4f')]({'name':_0x4c97a4[_0xb496('0x42')],'resourceId':_0x4c97a4['id'],'type':_0x26167d[_0xb496('0x42')],'sectionId':_0x26167d['id']},{})[_0xb496('0x27')](function(){return _0x49c688;});}else{return _0x49c688;}})[_0xb496('0x4a')](function(_0x4a63d2){logger[_0xb496('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a63d2);throw _0x4a63d2;});}return _0x49c688;})[_0xb496('0x27')](respondWithResult(_0x5e0553,0xc9))[_0xb496('0x4a')](handleError(_0x5e0553,null));};exports[_0xb496('0x55')]=function(_0x217656,_0x515729){if(_0x217656[_0xb496('0x50')]['id']){delete _0x217656['body']['id'];}return db[_0xb496('0x45')][_0xb496('0x4e')]({'where':{'id':_0x217656['params']['id']}})[_0xb496('0x27')](handleEntityNotFound(_0x515729,null))[_0xb496('0x27')](saveUpdates(_0x217656['body'],null))[_0xb496('0x27')](respondWithResult(_0x515729,null))[_0xb496('0x4a')](handleError(_0x515729,null));};exports['destroy']=function(_0x2938cc,_0x5e9e71){return db[_0xb496('0x45')][_0xb496('0x4e')]({'where':{'id':_0x2938cc[_0xb496('0x56')]['id']}})[_0xb496('0x27')](handleEntityNotFound(_0x5e9e71,null))[_0xb496('0x27')](removeEntity(_0x5e9e71,null))[_0xb496('0x4a')](handleError(_0x5e9e71,null));};exports[_0xb496('0x57')]=function(_0x5799ed,_0x9cc1d6){return db[_0xb496('0x45')][_0xb496('0x57')]()[_0xb496('0x27')](respondWithResult(_0x9cc1d6,null))['catch'](handleError(_0x9cc1d6,null));};exports[_0xb496('0x58')]=function(_0x2529b0,_0x2258c0,_0x5134aa){var _0xb64990={'raw':!![],'where':{}},_0x4ecaf2={},_0x50f51c;return db[_0xb496('0x45')][_0xb496('0x59')]({'where':{'id':_0x2529b0[_0xb496('0x56')]['id']}})['then'](handleEntityNotFound(_0x2258c0,null))[_0xb496('0x27')](function(_0x4d52aa){if(_0x4d52aa){_0x50f51c=_0x4d52aa['get']({'plain':!![]});_0x4ecaf2['model']=_[_0xb496('0x4c')](db[_0xb496('0x5a')][_0xb496('0x31')]);_0x4ecaf2['query']=_[_0xb496('0x4c')](_0x2529b0[_0xb496('0x35')]);_0x4ecaf2[_0xb496('0x36')]=_[_0xb496('0x37')](_0x4ecaf2[_0xb496('0x4d')],_0x4ecaf2[_0xb496('0x35')]);_0xb64990['attributes']=_[_0xb496('0x37')](_0x4ecaf2[_0xb496('0x4d')],qs['fields'](_0x2529b0[_0xb496('0x35')][_0xb496('0x39')]));_0xb64990[_0xb496('0x38')]=_0xb64990[_0xb496('0x38')]['length']?_0xb64990['attributes']:_0x4ecaf2[_0xb496('0x4d')];if(!_0x2529b0[_0xb496('0x35')][_0xb496('0x3b')]('nolimit')){_0xb64990[_0xb496('0x21')]=qs[_0xb496('0x21')](_0x2529b0[_0xb496('0x35')][_0xb496('0x21')]);_0xb64990[_0xb496('0x20')]=qs[_0xb496('0x20')](_0x2529b0['query'][_0xb496('0x20')]);}_0xb64990['order']=qs[_0xb496('0x3e')](_0x2529b0['query']['sort']);_0xb64990[_0xb496('0x3f')]=qs[_0xb496('0x36')](_[_0xb496('0x5b')](_0x2529b0['query'],_0x4ecaf2[_0xb496('0x36')]));_0xb64990[_0xb496('0x3f')][_0xb496('0x5c')]=_0x4d52aa['id'];if(_0x2529b0[_0xb496('0x35')][_0xb496('0x43')]){_0xb64990[_0xb496('0x3f')]=_[_0xb496('0x40')](_0xb64990[_0xb496('0x3f')],{'$or':_['map'](_0xb64990['attributes'],function(_0x4bb07c){var _0x56b8e0={};_0x56b8e0[_0x4bb07c]={'$like':'%'+_0x2529b0['query'][_0xb496('0x43')]+'%'};return _0x56b8e0;})});}_0xb64990=_[_0xb496('0x40')]({},_0xb64990,_0x2529b0[_0xb496('0x44')]);return db[_0xb496('0x5a')][_0xb496('0x48')](_0xb64990);}})[_0xb496('0x27')](function(_0x1d2a44){if(_0x1d2a44){return db[_0xb496('0x5d')][_0xb496('0x5e')]({'where':{'id':_[_0xb496('0x30')](_0x1d2a44,_0xb496('0x5f')),'role':_0xb496('0x60')},'attributes':['id',_0xb496('0x42'),_0xb496('0x61'),_0xb496('0x62'),'createdAt']});}})[_0xb496('0x27')](function(_0x2258ff){if(_0x2258ff){return{'count':_0x2258ff[_0xb496('0x22')],'rows':_[_0xb496('0x30')](_0x2258ff[_0xb496('0x49')],function(_0x353077){return{'membername':_0x353077[_0xb496('0x42')],'UserId':_0x353077['id'],'queue_name':_0x50f51c[_0xb496('0x42')],'WhatsappQueueId':_0x50f51c['id'],'interface':util[_0xb496('0x63')]('%s/%s','SIP',_0x353077['name']),'penalty':0x0,'paused':_0x353077['whatsappPause'],'createdAt':_0x353077[_0xb496('0x64')],'updatedAt':_0x353077[_0xb496('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb496('0x27')](respondWithFilteredResult(_0x2258c0,_0xb64990))[_0xb496('0x4a')](handleError(_0x2258c0,null));};exports[_0xb496('0x65')]=function(_0x500165,_0x408006,_0x12668c){var _0xa740f5={};var _0x533b25={};var _0x1a9972;var _0x58dd5d;return db['WhatsappQueue'][_0xb496('0x59')]({'where':{'id':_0x500165[_0xb496('0x56')]['id']}})['then'](handleEntityNotFound(_0x408006,null))[_0xb496('0x27')](function(_0x8a89d9){if(_0x8a89d9){_0x1a9972=_0x8a89d9;_0x533b25[_0xb496('0x4d')]=_[_0xb496('0x4c')](db[_0xb496('0x66')][_0xb496('0x31')]);_0x533b25[_0xb496('0x35')]=_['keys'](_0x500165[_0xb496('0x35')]);_0x533b25[_0xb496('0x36')]=_[_0xb496('0x37')](_0x533b25[_0xb496('0x4d')],_0x533b25['query']);_0xa740f5[_0xb496('0x38')]=_[_0xb496('0x37')](_0x533b25[_0xb496('0x4d')],qs[_0xb496('0x39')](_0x500165['query'][_0xb496('0x39')]));_0xa740f5[_0xb496('0x38')]=_0xa740f5[_0xb496('0x38')][_0xb496('0x3a')]?_0xa740f5[_0xb496('0x38')]:_0x533b25[_0xb496('0x4d')];_0xa740f5['order']=qs['sort'](_0x500165[_0xb496('0x35')][_0xb496('0x3e')]);_0xa740f5[_0xb496('0x3f')]=qs['filters'](_[_0xb496('0x5b')](_0x500165[_0xb496('0x35')],_0x533b25[_0xb496('0x36')]));if(_0x500165[_0xb496('0x35')][_0xb496('0x43')]){_0xa740f5['where']=_['merge'](_0xa740f5[_0xb496('0x3f')],{'$or':_['map'](_0xa740f5['attributes'],function(_0xf5eeea){var _0x3a9621={};_0x3a9621[_0xf5eeea]={'$like':'%'+_0x500165['query'][_0xb496('0x43')]+'%'};return _0x3a9621;})});}_0xa740f5=_['merge']({},_0xa740f5,_0x500165[_0xb496('0x44')]);return _0x1a9972[_0xb496('0x65')](_0xa740f5);}})['then'](function(_0x1aac21){if(_0x1aac21){_0x58dd5d=_0x1aac21['length'];if(!_0x500165['query']['hasOwnProperty'](_0xb496('0x3c'))){_0xa740f5[_0xb496('0x21')]=qs['limit'](_0x500165[_0xb496('0x35')][_0xb496('0x21')]);_0xa740f5['offset']=qs['offset'](_0x500165[_0xb496('0x35')][_0xb496('0x20')]);}return _0x1a9972['getTeams'](_0xa740f5);}})['then'](function(_0xcfaf40){if(_0xcfaf40){return _0xcfaf40?{'count':_0x58dd5d,'rows':_0xcfaf40}:null;}})['then'](respondWithResult(_0x408006,null))[_0xb496('0x4a')](handleError(_0x408006,null));};exports['addTeams']=function(_0x23d168,_0x2bf687,_0x17d4b9){var _0x508a49=_0x23d168[_0xb496('0x50')][_0xb496('0x67')];return db['Team'][_0xb496('0x48')]({'where':{'id':_0x508a49},'attributes':['id'],'include':[{'model':db[_0xb496('0x5d')],'as':_0xb496('0x68'),'attributes':['id',_0xb496('0x42'),'online',_0xb496('0x69'),_0xb496('0x6a')],'raw':!![]}]})[_0xb496('0x27')](function(_0x3b1be9){if(_0x3b1be9){var _0x4f411e=_[_0xb496('0x6b')](_0x3b1be9,function(_0x28908a){var _0x2a0423=_0x28908a[_0xb496('0x29')]({'plain':!![]});return _0x2a0423[_0xb496('0x68')];});return db['WhatsappQueue'][_0xb496('0x4e')]({'where':{'id':_0x23d168[_0xb496('0x56')]['id']}})['then'](function(_0x23d97a){return db[_0xb496('0x6c')]['transaction'](function(_0x31ca7d){return _0x23d97a[_0xb496('0x6d')](_0x508a49,{'transaction':_0x31ca7d})['then'](function(){return BPromise['each'](_0x4f411e,function(_0x5aa553){return db[_0xb496('0x5a')][_0xb496('0x6e')]({'where':{'UserId':_0x5aa553['id'],'WhatsappQueueId':_0x23d168[_0xb496('0x56')]['id']},'transaction':_0x31ca7d});});})[_0xb496('0x27')](function(){_0x4f411e[_0xb496('0x6f')](function(_0x91dfe7){socket[_0xb496('0x70')](_0xb496('0x71'),{'UserId':_0x91dfe7['id'],'WhatsappQueueId':_0x23d97a['id']});});});});});}})[_0xb496('0x27')](respondWithStatusCode(_0x2bf687,null))[_0xb496('0x4a')](handleError(_0x2bf687,null));};exports['removeTeams']=function(_0x4c6a34,_0x4f22b1,_0x1e8446){return db['Team'][_0xb496('0x48')]({'where':{'id':_0x4c6a34[_0xb496('0x35')][_0xb496('0x67')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb496('0x27')](handleEntityNotFound(_0x4f22b1,null))[_0xb496('0x27')](function(_0x424b50){var _0x34adf2=_[_0xb496('0x30')](_0x424b50,'id');var _0x2412a8=[];var _0x23a61c=[];var _0x2e70a2=squel['select']();_0x2e70a2[_0xb496('0x72')]('tq.TeamId')[_0xb496('0x73')](_0xb496('0x74'),'tq')[_0xb496('0x75')](_0xb496('0x76'),'ut',_0xb496('0x77'))[_0xb496('0x3f')]('WhatsappQueueId\x20=\x20?',_0x4c6a34[_0xb496('0x56')]['id']);for(var _0x3ababf=0x0;_0x3ababf<_0x424b50['length'];_0x3ababf+=0x1){let _0x7b59f4=_0x424b50[_0x3ababf];for(var _0x384f1b=0x0;_0x384f1b<_0x7b59f4[_0xb496('0x68')][_0xb496('0x3a')];_0x384f1b+=0x1){let _0x10c6c3=_0x7b59f4[_0xb496('0x68')][_0x384f1b];var _0x49c5d9=_0x2e70a2[_0xb496('0x78')]();_0x49c5d9[_0xb496('0x3f')]('ut.UserId\x20=\x20?',_0x10c6c3['id']);_0x23a61c[_0xb496('0x79')](db[_0xb496('0x6c')][_0xb496('0x35')](_0x49c5d9[_0xb496('0x7a')](),{'type':db[_0xb496('0x6c')]['QueryTypes']['SELECT']})[_0xb496('0x27')](function(_0x2a44f6){if(_0x2a44f6['length']===0x1){return _0x10c6c3['id'];}else{var _0x524c2d=_[_0xb496('0x7b')](_[_0xb496('0x30')](_0x2a44f6,_0xb496('0x7c')),function(_0x410c12){return _[_0xb496('0x7d')](_0x34adf2,_0x410c12);});if(_0x524c2d){return _0x10c6c3['id'];}}}));}}return BPromise['all'](_0x23a61c)['then'](function(_0x5b236b){_0x2412a8=_(_0x2412a8)[_0xb496('0x7e')](_0x5b236b)[_0xb496('0x7f')]()[_0xb496('0x80')]();return db['WhatsappQueue'][_0xb496('0x4e')]({'where':{'id':_0x4c6a34[_0xb496('0x56')]['id']}})['then'](function(_0x1552d9){return db[_0xb496('0x6c')][_0xb496('0x81')](function(_0x3ea33d){return _0x1552d9[_0xb496('0x82')](_0x4c6a34[_0xb496('0x35')][_0xb496('0x67')],{'transaction':_0x3ea33d})[_0xb496('0x27')](function(){if(!_['isEmpty'](_0x2412a8)){return _0x1552d9[_0xb496('0x83')](_0x2412a8,{'transaction':_0x3ea33d});}})['then'](function(){_0x2412a8[_0xb496('0x6f')](function(_0x1e49b1){socket[_0xb496('0x70')](_0xb496('0x84'),{'UserId':_0x1e49b1,'WhatsappQueueId':_0x1552d9['id']});});});});});});})[_0xb496('0x27')](respondWithStatusCode(_0x4f22b1,null))[_0xb496('0x4a')](handleError(_0x4f22b1,null));};exports[_0xb496('0x85')]=function(_0x1b23e4,_0x20d8f1,_0x37f05d){return db[_0xb496('0x45')][_0xb496('0x4e')]({'where':{'id':_0x1b23e4[_0xb496('0x56')]['id']}})[_0xb496('0x27')](handleEntityNotFound(_0x20d8f1,null))['then'](function(_0x396e9a){if(_0x396e9a){return _0x396e9a[_0xb496('0x85')](_0x1b23e4['body'][_0xb496('0x67')],_['omit'](_0x1b23e4[_0xb496('0x50')],[_0xb496('0x67'),'id'])||{})[_0xb496('0x86')](function(_0x3cd6b0){for(var _0x1e6702=0x0;_0x1e6702<_0x1b23e4[_0xb496('0x50')][_0xb496('0x67')][_0xb496('0x3a')];_0x1e6702+=0x1){socket['emit'](_0xb496('0x71'),{'UserId':Number(_0x1b23e4[_0xb496('0x50')]['ids'][_0x1e6702]),'WhatsappQueueId':Number(_0x1b23e4[_0xb496('0x56')]['id'])});}return _0x3cd6b0;});}})[_0xb496('0x27')](respondWithResult(_0x20d8f1,null))['catch'](handleError(_0x20d8f1,null));};exports[_0xb496('0x83')]=function(_0x391378,_0x21a194,_0x3190f6){return db[_0xb496('0x45')][_0xb496('0x4e')]({'where':{'id':_0x391378['params']['id']}})['then'](handleEntityNotFound(_0x21a194,null))[_0xb496('0x27')](function(_0x8f16b4){if(_0x8f16b4){return _0x8f16b4[_0xb496('0x83')](_0x391378[_0xb496('0x35')]['ids'])[_0xb496('0x27')](function(){if(_[_0xb496('0x87')](_0x391378[_0xb496('0x35')][_0xb496('0x67')])){for(var _0x2c406f=0x0;_0x2c406f<_0x391378[_0xb496('0x35')][_0xb496('0x67')][_0xb496('0x3a')];_0x2c406f+=0x1){socket[_0xb496('0x70')](_0xb496('0x84'),{'UserId':Number(_0x391378[_0xb496('0x35')][_0xb496('0x67')][_0x2c406f]),'WhatsappQueueId':Number(_0x391378[_0xb496('0x56')]['id'])});}}else{socket[_0xb496('0x70')]('userWhatsappQueue:remove',{'UserId':Number(_0x391378[_0xb496('0x35')][_0xb496('0x67')]),'WhatsappQueueId':Number(_0x391378[_0xb496('0x56')]['id'])});}});}})[_0xb496('0x27')](respondWithStatusCode(_0x21a194,null))[_0xb496('0x4a')](handleError(_0x21a194,null));};exports[_0xb496('0x88')]=function(_0x45a8e3,_0x166bfd,_0x388576){var _0x206766={};var _0x46f3f2={};var _0x5d2b0e;var _0x4dceeb;return db[_0xb496('0x45')][_0xb496('0x59')]({'where':{'id':_0x45a8e3[_0xb496('0x56')]['id']}})['then'](handleEntityNotFound(_0x166bfd,null))[_0xb496('0x27')](function(_0x2428e2){if(_0x2428e2){_0x5d2b0e=_0x2428e2;_0x46f3f2['model']=_[_0xb496('0x4c')](db['User'][_0xb496('0x31')]);_0x46f3f2[_0xb496('0x35')]=_[_0xb496('0x4c')](_0x45a8e3['query']);_0x46f3f2[_0xb496('0x36')]=_[_0xb496('0x37')](_0x46f3f2[_0xb496('0x4d')],_0x46f3f2[_0xb496('0x35')]);_0x206766[_0xb496('0x38')]=_[_0xb496('0x37')](_0x46f3f2[_0xb496('0x4d')],qs['fields'](_0x45a8e3['query'][_0xb496('0x39')]));_0x206766['attributes']=_0x206766['attributes'][_0xb496('0x3a')]?_0x206766['attributes']:_0x46f3f2[_0xb496('0x4d')];_0x206766['order']=qs[_0xb496('0x3e')](_0x45a8e3[_0xb496('0x35')][_0xb496('0x3e')]);_0x206766[_0xb496('0x3f')]=qs['filters'](_[_0xb496('0x5b')](_0x45a8e3[_0xb496('0x35')],_0x46f3f2['filters']));if(_0x45a8e3[_0xb496('0x35')][_0xb496('0x43')]){_0x206766['where']=_[_0xb496('0x40')](_0x206766[_0xb496('0x3f')],{'$or':_['map'](_0x206766['attributes'],function(_0xb1b2f4){var _0x314816={};_0x314816[_0xb1b2f4]={'$like':'%'+_0x45a8e3[_0xb496('0x35')][_0xb496('0x43')]+'%'};return _0x314816;})});}_0x206766=_['merge']({},_0x206766,_0x45a8e3[_0xb496('0x44')]);return _0x5d2b0e['getAgents'](_0x206766);}})[_0xb496('0x27')](function(_0x2de2e7){if(_0x2de2e7){_0x4dceeb=_0x2de2e7[_0xb496('0x3a')];if(!_0x45a8e3['query'][_0xb496('0x3b')](_0xb496('0x3c'))){_0x206766['limit']=qs[_0xb496('0x21')](_0x45a8e3[_0xb496('0x35')]['limit']);_0x206766['offset']=qs[_0xb496('0x20')](_0x45a8e3[_0xb496('0x35')][_0xb496('0x20')]);}return _0x5d2b0e[_0xb496('0x88')](_0x206766);}})['then'](function(_0x3db63b){if(_0x3db63b){return _0x3db63b?{'count':_0x4dceeb,'rows':_0x3db63b}:null;}})['then'](respondWithResult(_0x166bfd,null))['catch'](handleError(_0x166bfd,null));}; \ No newline at end of file +var _0xa6ad=['lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','destroy','get','then','error','stack','name','send','index','rawAttributes','fieldName','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','options','WhatsappQueue','count','includeAll','include','rows','show','params','length','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','findAll','User','agent','whatsappPause','SIP','createdAt','updatedAt','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','userWhatsappQueue:save','removeTeams','select','tq.TeamId','team_has_whatsapp_queues','join','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','all','union','compact','value','removeAgents','addAgents','omit','spread','emit','isArray','userWhatsappQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra'];(function(_0x2f87cd,_0xcaf299){var _0x5d7eda=function(_0x37ffb0){while(--_0x37ffb0){_0x2f87cd['push'](_0x2f87cd['shift']());}};_0x5d7eda(++_0xcaf299);}(_0xa6ad,0x199));var _0xda6a=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0xa6ad[_0x4e7d25];return _0x526fe6;};'use strict';var emlformat=require(_0xda6a('0x0'));var rimraf=require(_0xda6a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xda6a('0x2'));var rp=require(_0xda6a('0x3'));var moment=require(_0xda6a('0x4'));var BPromise=require(_0xda6a('0x5'));var Mustache=require(_0xda6a('0x6'));var util=require('util');var path=require(_0xda6a('0x7'));var sox=require('sox');var csv=require(_0xda6a('0x8'));var ejs=require(_0xda6a('0x9'));var fs=require('fs');var fs_extra=require(_0xda6a('0xa'));var _=require(_0xda6a('0xb'));var squel=require(_0xda6a('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xda6a('0x8'));var querystring=require('querystring');var Papa=require(_0xda6a('0xd'));var Redis=require(_0xda6a('0xe'));var authService=require(_0xda6a('0xf'));var qs=require(_0xda6a('0x10'));var as=require(_0xda6a('0x11'));var hardwareService=require(_0xda6a('0x12'));var logger=require(_0xda6a('0x13'))(_0xda6a('0x14'));var utils=require(_0xda6a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xda6a('0x16'));var db=require(_0xda6a('0x17'))['db'];config[_0xda6a('0x18')]=_[_0xda6a('0x19')](config['redis'],{'host':_0xda6a('0x1a'),'port':0x18eb});var socket=require(_0xda6a('0x1b'))(new Redis(config['redis']));require(_0xda6a('0x1c'))['register'](socket);function respondWithStatusCode(_0x4cfaa9,_0x173f4f){_0x173f4f=_0x173f4f||0xcc;return function(_0x1064c3){if(_0x1064c3){return _0x4cfaa9[_0xda6a('0x1d')](_0x173f4f);}return _0x4cfaa9[_0xda6a('0x1e')](_0x173f4f)[_0xda6a('0x1f')]();};}function respondWithResult(_0x2914e3,_0x57bdcc){_0x57bdcc=_0x57bdcc||0xc8;return function(_0x214537){if(_0x214537){return _0x2914e3[_0xda6a('0x1e')](_0x57bdcc)[_0xda6a('0x20')](_0x214537);}};}function respondWithFilteredResult(_0x1b813d,_0x1d22e8){return function(_0xc251c3){if(_0xc251c3){var _0x281603=typeof _0x1d22e8[_0xda6a('0x21')]===_0xda6a('0x22')&&typeof _0x1d22e8[_0xda6a('0x23')]===_0xda6a('0x22');var _0x13ecd1=_0xc251c3['count'];var _0xa2239b=_0x281603?0x0:_0x1d22e8[_0xda6a('0x21')];var _0x53596d=_0x281603?_0xc251c3['count']:_0x1d22e8[_0xda6a('0x21')]+_0x1d22e8[_0xda6a('0x23')];var _0x2f6223;if(_0x53596d>=_0x13ecd1){_0x53596d=_0x13ecd1;_0x2f6223=0xc8;}else{_0x2f6223=0xce;}_0x1b813d[_0xda6a('0x1e')](_0x2f6223);return _0x1b813d['set'](_0xda6a('0x24'),_0xa2239b+'-'+_0x53596d+'/'+_0x13ecd1)[_0xda6a('0x20')](_0xc251c3);}return null;};}function patchUpdates(_0x1f6b9a){return function(_0x55bac5){try{jsonpatch[_0xda6a('0x25')](_0x55bac5,_0x1f6b9a,!![]);}catch(_0x2f63ec){return BPromise[_0xda6a('0x26')](_0x2f63ec);}return _0x55bac5[_0xda6a('0x27')]();};}function saveUpdates(_0x34df87,_0x567516){return function(_0x24f9cb){if(_0x24f9cb){return _0x24f9cb[_0xda6a('0x28')](_0x34df87)['then'](function(_0xa2020d){return _0xa2020d;});}return null;};}function removeEntity(_0x23e359,_0x303959){return function(_0x4b2c30){if(_0x4b2c30){return _0x4b2c30[_0xda6a('0x29')]()['then'](function(){var _0x40767f=_0x4b2c30[_0xda6a('0x2a')]({'plain':!![]});var _0x4f164b='WhatsappQueues';return db['UserProfileResource'][_0xda6a('0x29')]({'where':{'type':_0x4f164b,'resourceId':_0x40767f['id']}})[_0xda6a('0x2b')](function(){return _0x4b2c30;});})[_0xda6a('0x2b')](function(){_0x23e359[_0xda6a('0x1e')](0xcc)[_0xda6a('0x1f')]();});}};}function handleEntityNotFound(_0x2342d0,_0x573dcc){return function(_0x259032){if(!_0x259032){_0x2342d0[_0xda6a('0x1d')](0x194);}return _0x259032;};}function handleError(_0x17de17,_0x2c1cd9){_0x2c1cd9=_0x2c1cd9||0x1f4;return function(_0x481c67){logger[_0xda6a('0x2c')](_0x481c67[_0xda6a('0x2d')]);if(_0x481c67[_0xda6a('0x2e')]){delete _0x481c67[_0xda6a('0x2e')];}_0x17de17[_0xda6a('0x1e')](_0x2c1cd9)[_0xda6a('0x2f')](_0x481c67);};}exports[_0xda6a('0x30')]=function(_0x34103f,_0x1509d0){var _0x7a8f11={},_0x22a91a={},_0x1f8269={'count':0x0,'rows':[]};var _0x2aee94=_['map'](db['WhatsappQueue'][_0xda6a('0x31')],function(_0x32691c){return{'name':_0x32691c[_0xda6a('0x32')],'type':_0x32691c['type'][_0xda6a('0x33')]};});_0x22a91a[_0xda6a('0x34')]=_[_0xda6a('0x35')](_0x2aee94,_0xda6a('0x2e'));_0x22a91a['query']=_[_0xda6a('0x36')](_0x34103f[_0xda6a('0x37')]);_0x22a91a['filters']=_[_0xda6a('0x38')](_0x22a91a['model'],_0x22a91a[_0xda6a('0x37')]);_0x7a8f11[_0xda6a('0x39')]=_[_0xda6a('0x38')](_0x22a91a['model'],qs[_0xda6a('0x3a')](_0x34103f[_0xda6a('0x37')]['fields']));_0x7a8f11[_0xda6a('0x39')]=_0x7a8f11['attributes']['length']?_0x7a8f11['attributes']:_0x22a91a[_0xda6a('0x34')];if(!_0x34103f['query'][_0xda6a('0x3b')](_0xda6a('0x3c'))){_0x7a8f11['limit']=qs[_0xda6a('0x23')](_0x34103f['query'][_0xda6a('0x23')]);_0x7a8f11[_0xda6a('0x21')]=qs[_0xda6a('0x21')](_0x34103f['query'][_0xda6a('0x21')]);}_0x7a8f11[_0xda6a('0x3d')]=qs[_0xda6a('0x3e')](_0x34103f[_0xda6a('0x37')]['sort']);_0x7a8f11[_0xda6a('0x3f')]=qs['filters'](_[_0xda6a('0x40')](_0x34103f[_0xda6a('0x37')],_0x22a91a[_0xda6a('0x41')]),_0x2aee94);if(_0x34103f['query'][_0xda6a('0x42')]){_0x7a8f11[_0xda6a('0x3f')]=_[_0xda6a('0x43')](_0x7a8f11['where'],{'$or':_[_0xda6a('0x35')](_0x2aee94,function(_0x1bfcda){if(_0x1bfcda[_0xda6a('0x44')]!=='VIRTUAL'){var _0x4d0681={};_0x4d0681[_0x1bfcda[_0xda6a('0x2e')]]={'$like':'%'+_0x34103f[_0xda6a('0x37')]['filter']+'%'};return _0x4d0681;}})});}_0x7a8f11=_[_0xda6a('0x43')]({},_0x7a8f11,_0x34103f[_0xda6a('0x45')]);var _0xa66cee={'where':_0x7a8f11[_0xda6a('0x3f')]};return db[_0xda6a('0x46')][_0xda6a('0x47')](_0xa66cee)['then'](function(_0x18a82a){_0x1f8269['count']=_0x18a82a;if(_0x34103f[_0xda6a('0x37')][_0xda6a('0x48')]){_0x7a8f11[_0xda6a('0x49')]=[{'all':!![]}];}return db[_0xda6a('0x46')]['findAll'](_0x7a8f11);})[_0xda6a('0x2b')](function(_0x4ec4d7){_0x1f8269[_0xda6a('0x4a')]=_0x4ec4d7;return _0x1f8269;})[_0xda6a('0x2b')](respondWithFilteredResult(_0x1509d0,_0x7a8f11))['catch'](handleError(_0x1509d0,null));};exports[_0xda6a('0x4b')]=function(_0x12850b,_0x39cdc1){var _0x228f23={'raw':!![],'where':{'id':_0x12850b[_0xda6a('0x4c')]['id']}},_0x1c142f={};_0x1c142f[_0xda6a('0x34')]=_[_0xda6a('0x36')](db['WhatsappQueue'][_0xda6a('0x31')]);_0x1c142f[_0xda6a('0x37')]=_['keys'](_0x12850b[_0xda6a('0x37')]);_0x1c142f['filters']=_[_0xda6a('0x38')](_0x1c142f[_0xda6a('0x34')],_0x1c142f[_0xda6a('0x37')]);_0x228f23[_0xda6a('0x39')]=_['intersection'](_0x1c142f[_0xda6a('0x34')],qs[_0xda6a('0x3a')](_0x12850b[_0xda6a('0x37')]['fields']));_0x228f23['attributes']=_0x228f23['attributes'][_0xda6a('0x4d')]?_0x228f23[_0xda6a('0x39')]:_0x1c142f['model'];if(_0x12850b['query'][_0xda6a('0x48')]){_0x228f23['include']=[{'all':!![]}];}_0x228f23=_['merge']({},_0x228f23,_0x12850b[_0xda6a('0x45')]);return db[_0xda6a('0x46')][_0xda6a('0x4e')](_0x228f23)[_0xda6a('0x2b')](handleEntityNotFound(_0x39cdc1,null))[_0xda6a('0x2b')](respondWithResult(_0x39cdc1,null))['catch'](handleError(_0x39cdc1,null));};exports[_0xda6a('0x4f')]=function(_0x427832,_0x3ca006){return db[_0xda6a('0x46')][_0xda6a('0x4f')](_0x427832['body'],{})[_0xda6a('0x2b')](function(_0x213a58){var _0x2ed8f8=_0x427832['user']['get']({'plain':!![]});if(!_0x2ed8f8)throw new Error(_0xda6a('0x50'));if(_0x2ed8f8[_0xda6a('0x51')]===_0xda6a('0x52')){var _0x2acb04=_0x213a58['get']({'plain':!![]});var _0x5802c8=_0xda6a('0x53');return db[_0xda6a('0x54')][_0xda6a('0x4e')]({'where':{'name':_0x5802c8,'userProfileId':_0x2ed8f8[_0xda6a('0x55')]},'raw':!![]})[_0xda6a('0x2b')](function(_0xe2688d){if(_0xe2688d&&_0xe2688d[_0xda6a('0x56')]===0x0){return db[_0xda6a('0x57')]['create']({'name':_0x2acb04[_0xda6a('0x2e')],'resourceId':_0x2acb04['id'],'type':_0xe2688d['name'],'sectionId':_0xe2688d['id']},{})['then'](function(){return _0x213a58;});}else{return _0x213a58;}})[_0xda6a('0x58')](function(_0x52fe81){logger[_0xda6a('0x2c')](_0xda6a('0x59'),_0x52fe81);throw _0x52fe81;});}return _0x213a58;})[_0xda6a('0x2b')](respondWithResult(_0x3ca006,0xc9))['catch'](handleError(_0x3ca006,null));};exports['update']=function(_0x353a99,_0x503126){if(_0x353a99[_0xda6a('0x5a')]['id']){delete _0x353a99[_0xda6a('0x5a')]['id'];}return db[_0xda6a('0x46')][_0xda6a('0x4e')]({'where':{'id':_0x353a99[_0xda6a('0x4c')]['id']}})[_0xda6a('0x2b')](handleEntityNotFound(_0x503126,null))['then'](saveUpdates(_0x353a99[_0xda6a('0x5a')],null))[_0xda6a('0x2b')](respondWithResult(_0x503126,null))['catch'](handleError(_0x503126,null));};exports[_0xda6a('0x29')]=function(_0x216263,_0x59b00d){return db[_0xda6a('0x46')][_0xda6a('0x4e')]({'where':{'id':_0x216263[_0xda6a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x59b00d,null))[_0xda6a('0x2b')](removeEntity(_0x59b00d,null))[_0xda6a('0x58')](handleError(_0x59b00d,null));};exports[_0xda6a('0x5b')]=function(_0x44c09b,_0x3df5ee){return db['WhatsappQueue'][_0xda6a('0x5b')]()['then'](respondWithResult(_0x3df5ee,null))[_0xda6a('0x58')](handleError(_0x3df5ee,null));};exports[_0xda6a('0x5c')]=function(_0x203810,_0x33a53a,_0x2e1278){var _0x4661bc={'raw':!![],'where':{}},_0x8a33ea={},_0x4ebcc8;return db[_0xda6a('0x46')][_0xda6a('0x5d')]({'where':{'id':_0x203810['params']['id']}})[_0xda6a('0x2b')](handleEntityNotFound(_0x33a53a,null))[_0xda6a('0x2b')](function(_0x782abd){if(_0x782abd){_0x4ebcc8=_0x782abd[_0xda6a('0x2a')]({'plain':!![]});_0x8a33ea[_0xda6a('0x34')]=_[_0xda6a('0x36')](db[_0xda6a('0x5e')][_0xda6a('0x31')]);_0x8a33ea[_0xda6a('0x37')]=_[_0xda6a('0x36')](_0x203810[_0xda6a('0x37')]);_0x8a33ea['filters']=_[_0xda6a('0x38')](_0x8a33ea['model'],_0x8a33ea[_0xda6a('0x37')]);_0x4661bc[_0xda6a('0x39')]=_[_0xda6a('0x38')](_0x8a33ea[_0xda6a('0x34')],qs[_0xda6a('0x3a')](_0x203810[_0xda6a('0x37')][_0xda6a('0x3a')]));_0x4661bc[_0xda6a('0x39')]=_0x4661bc[_0xda6a('0x39')][_0xda6a('0x4d')]?_0x4661bc[_0xda6a('0x39')]:_0x8a33ea[_0xda6a('0x34')];if(!_0x203810[_0xda6a('0x37')][_0xda6a('0x3b')](_0xda6a('0x3c'))){_0x4661bc['limit']=qs[_0xda6a('0x23')](_0x203810[_0xda6a('0x37')][_0xda6a('0x23')]);_0x4661bc['offset']=qs[_0xda6a('0x21')](_0x203810['query'][_0xda6a('0x21')]);}_0x4661bc[_0xda6a('0x3d')]=qs[_0xda6a('0x3e')](_0x203810[_0xda6a('0x37')][_0xda6a('0x3e')]);_0x4661bc['where']=qs[_0xda6a('0x41')](_[_0xda6a('0x40')](_0x203810[_0xda6a('0x37')],_0x8a33ea['filters']));_0x4661bc['where'][_0xda6a('0x5f')]=_0x782abd['id'];if(_0x203810['query'][_0xda6a('0x42')]){_0x4661bc[_0xda6a('0x3f')]=_[_0xda6a('0x43')](_0x4661bc['where'],{'$or':_[_0xda6a('0x35')](_0x4661bc['attributes'],function(_0xafb9e4){var _0x4c21d0={};_0x4c21d0[_0xafb9e4]={'$like':'%'+_0x203810[_0xda6a('0x37')]['filter']+'%'};return _0x4c21d0;})});}_0x4661bc=_[_0xda6a('0x43')]({},_0x4661bc,_0x203810[_0xda6a('0x45')]);return db[_0xda6a('0x5e')][_0xda6a('0x60')](_0x4661bc);}})[_0xda6a('0x2b')](function(_0x54860f){if(_0x54860f){return db[_0xda6a('0x61')]['findAndCountAll']({'where':{'id':_[_0xda6a('0x35')](_0x54860f,'UserId'),'role':_0xda6a('0x62')},'attributes':['id','name',_0xda6a('0x63'),'updatedAt','createdAt']});}})[_0xda6a('0x2b')](function(_0x46eb34){if(_0x46eb34){return{'count':_0x46eb34['count'],'rows':_[_0xda6a('0x35')](_0x46eb34['rows'],function(_0x4ddcdc){return{'membername':_0x4ddcdc[_0xda6a('0x2e')],'UserId':_0x4ddcdc['id'],'queue_name':_0x4ebcc8['name'],'WhatsappQueueId':_0x4ebcc8['id'],'interface':util['format']('%s/%s',_0xda6a('0x64'),_0x4ddcdc[_0xda6a('0x2e')]),'penalty':0x0,'paused':_0x4ddcdc[_0xda6a('0x63')],'createdAt':_0x4ddcdc[_0xda6a('0x65')],'updatedAt':_0x4ddcdc[_0xda6a('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xda6a('0x2b')](respondWithFilteredResult(_0x33a53a,_0x4661bc))[_0xda6a('0x58')](handleError(_0x33a53a,null));};exports[_0xda6a('0x67')]=function(_0x9e6387,_0xe4abac,_0x49e9cb){var _0xe2d7b={};var _0x4b399a={};var _0x77cb5a;var _0x986403;return db['WhatsappQueue'][_0xda6a('0x5d')]({'where':{'id':_0x9e6387['params']['id']}})[_0xda6a('0x2b')](handleEntityNotFound(_0xe4abac,null))[_0xda6a('0x2b')](function(_0x2883b9){if(_0x2883b9){_0x77cb5a=_0x2883b9;_0x4b399a['model']=_[_0xda6a('0x36')](db['Team'][_0xda6a('0x31')]);_0x4b399a[_0xda6a('0x37')]=_[_0xda6a('0x36')](_0x9e6387['query']);_0x4b399a[_0xda6a('0x41')]=_['intersection'](_0x4b399a['model'],_0x4b399a[_0xda6a('0x37')]);_0xe2d7b['attributes']=_[_0xda6a('0x38')](_0x4b399a[_0xda6a('0x34')],qs[_0xda6a('0x3a')](_0x9e6387[_0xda6a('0x37')][_0xda6a('0x3a')]));_0xe2d7b[_0xda6a('0x39')]=_0xe2d7b[_0xda6a('0x39')][_0xda6a('0x4d')]?_0xe2d7b[_0xda6a('0x39')]:_0x4b399a[_0xda6a('0x34')];_0xe2d7b[_0xda6a('0x3d')]=qs[_0xda6a('0x3e')](_0x9e6387[_0xda6a('0x37')]['sort']);_0xe2d7b[_0xda6a('0x3f')]=qs[_0xda6a('0x41')](_['pick'](_0x9e6387['query'],_0x4b399a[_0xda6a('0x41')]));if(_0x9e6387[_0xda6a('0x37')][_0xda6a('0x42')]){_0xe2d7b[_0xda6a('0x3f')]=_['merge'](_0xe2d7b[_0xda6a('0x3f')],{'$or':_['map'](_0xe2d7b[_0xda6a('0x39')],function(_0x252ce7){var _0x341d6e={};_0x341d6e[_0x252ce7]={'$like':'%'+_0x9e6387['query'][_0xda6a('0x42')]+'%'};return _0x341d6e;})});}_0xe2d7b=_['merge']({},_0xe2d7b,_0x9e6387[_0xda6a('0x45')]);return _0x77cb5a[_0xda6a('0x67')](_0xe2d7b);}})['then'](function(_0x32e82){if(_0x32e82){_0x986403=_0x32e82[_0xda6a('0x4d')];if(!_0x9e6387['query']['hasOwnProperty']('nolimit')){_0xe2d7b['limit']=qs[_0xda6a('0x23')](_0x9e6387[_0xda6a('0x37')]['limit']);_0xe2d7b[_0xda6a('0x21')]=qs[_0xda6a('0x21')](_0x9e6387['query'][_0xda6a('0x21')]);}return _0x77cb5a[_0xda6a('0x67')](_0xe2d7b);}})['then'](function(_0x5b6eaa){if(_0x5b6eaa){return _0x5b6eaa?{'count':_0x986403,'rows':_0x5b6eaa}:null;}})[_0xda6a('0x2b')](respondWithResult(_0xe4abac,null))['catch'](handleError(_0xe4abac,null));};exports[_0xda6a('0x68')]=function(_0x99019a,_0x151d88,_0x3bccd7){var _0x1f7ce9=_0x99019a[_0xda6a('0x5a')][_0xda6a('0x69')];return db[_0xda6a('0x6a')][_0xda6a('0x60')]({'where':{'id':_0x1f7ce9},'attributes':['id'],'include':[{'model':db[_0xda6a('0x61')],'as':_0xda6a('0x6b'),'attributes':['id',_0xda6a('0x2e'),_0xda6a('0x6c'),_0xda6a('0x6d'),_0xda6a('0x6e')],'raw':!![]}]})['then'](function(_0x38c077){if(_0x38c077){var _0xac904d=_[_0xda6a('0x6f')](_0x38c077,function(_0xcc264b){var _0x41a174=_0xcc264b[_0xda6a('0x2a')]({'plain':!![]});return _0x41a174[_0xda6a('0x6b')];});return db['WhatsappQueue']['find']({'where':{'id':_0x99019a[_0xda6a('0x4c')]['id']}})['then'](function(_0x3897a2){return db[_0xda6a('0x70')][_0xda6a('0x71')](function(_0x524173){return _0x3897a2[_0xda6a('0x68')](_0x1f7ce9,{'transaction':_0x524173})['then'](function(){return BPromise[_0xda6a('0x72')](_0xac904d,function(_0x177555){return db[_0xda6a('0x5e')]['findOrCreate']({'where':{'UserId':_0x177555['id'],'WhatsappQueueId':_0x99019a[_0xda6a('0x4c')]['id']},'transaction':_0x524173});});})['then'](function(){_0xac904d[_0xda6a('0x73')](function(_0x503a16){socket['emit'](_0xda6a('0x74'),{'UserId':_0x503a16['id'],'WhatsappQueueId':_0x3897a2['id']});});});});});}})[_0xda6a('0x2b')](respondWithStatusCode(_0x151d88,null))[_0xda6a('0x58')](handleError(_0x151d88,null));};exports[_0xda6a('0x75')]=function(_0x5cf2db,_0x359551,_0x3b797){return db[_0xda6a('0x6a')][_0xda6a('0x60')]({'where':{'id':_0x5cf2db['query'][_0xda6a('0x69')]},'attributes':['id'],'include':[{'model':db[_0xda6a('0x61')],'as':_0xda6a('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xda6a('0x2b')](handleEntityNotFound(_0x359551,null))[_0xda6a('0x2b')](function(_0x44dab8){var _0x5b12c5=_[_0xda6a('0x35')](_0x44dab8,'id');var _0x5d9ab2=[];var _0x46e53c=[];var _0x3a9788=squel[_0xda6a('0x76')]();_0x3a9788['field'](_0xda6a('0x77'))['from'](_0xda6a('0x78'),'tq')[_0xda6a('0x79')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xda6a('0x3f')](_0xda6a('0x7a'),_0x5cf2db[_0xda6a('0x4c')]['id']);for(var _0x28b6b1=0x0;_0x28b6b1<_0x44dab8['length'];_0x28b6b1+=0x1){let _0x4072f3=_0x44dab8[_0x28b6b1];for(var _0x38c54f=0x0;_0x38c54f<_0x4072f3[_0xda6a('0x6b')]['length'];_0x38c54f+=0x1){let _0x10c805=_0x4072f3[_0xda6a('0x6b')][_0x38c54f];var _0x3bb052=_0x3a9788[_0xda6a('0x7b')]();_0x3bb052[_0xda6a('0x3f')](_0xda6a('0x7c'),_0x10c805['id']);_0x46e53c[_0xda6a('0x7d')](db[_0xda6a('0x70')][_0xda6a('0x37')](_0x3bb052['toString'](),{'type':db[_0xda6a('0x70')][_0xda6a('0x7e')]['SELECT']})[_0xda6a('0x2b')](function(_0x2c9e9f){if(_0x2c9e9f[_0xda6a('0x4d')]===0x1){return _0x10c805['id'];}else{var _0x30f683=_['every'](_[_0xda6a('0x35')](_0x2c9e9f,_0xda6a('0x7f')),function(_0x28b5d8){return _['includes'](_0x5b12c5,_0x28b5d8);});if(_0x30f683){return _0x10c805['id'];}}}));}}return BPromise[_0xda6a('0x80')](_0x46e53c)[_0xda6a('0x2b')](function(_0x96c0f8){_0x5d9ab2=_(_0x5d9ab2)[_0xda6a('0x81')](_0x96c0f8)[_0xda6a('0x82')]()[_0xda6a('0x83')]();return db[_0xda6a('0x46')]['find']({'where':{'id':_0x5cf2db[_0xda6a('0x4c')]['id']}})[_0xda6a('0x2b')](function(_0x24ef1a){return db[_0xda6a('0x70')][_0xda6a('0x71')](function(_0x5cf70e){return _0x24ef1a[_0xda6a('0x75')](_0x5cf2db[_0xda6a('0x37')][_0xda6a('0x69')],{'transaction':_0x5cf70e})[_0xda6a('0x2b')](function(){if(!_['isEmpty'](_0x5d9ab2)){return _0x24ef1a[_0xda6a('0x84')](_0x5d9ab2,{'transaction':_0x5cf70e});}})[_0xda6a('0x2b')](function(){_0x5d9ab2[_0xda6a('0x73')](function(_0xc2b9eb){socket['emit']('userWhatsappQueue:remove',{'UserId':_0xc2b9eb,'WhatsappQueueId':_0x24ef1a['id']});});});});});});})[_0xda6a('0x2b')](respondWithStatusCode(_0x359551,null))['catch'](handleError(_0x359551,null));};exports[_0xda6a('0x85')]=function(_0x428be0,_0x5446bb,_0x27c08a){return db[_0xda6a('0x46')][_0xda6a('0x4e')]({'where':{'id':_0x428be0[_0xda6a('0x4c')]['id']}})[_0xda6a('0x2b')](handleEntityNotFound(_0x5446bb,null))[_0xda6a('0x2b')](function(_0x203d0d){if(_0x203d0d){return _0x203d0d[_0xda6a('0x85')](_0x428be0['body'][_0xda6a('0x69')],_[_0xda6a('0x86')](_0x428be0[_0xda6a('0x5a')],[_0xda6a('0x69'),'id'])||{})[_0xda6a('0x87')](function(_0x259b55){for(var _0x38ea14=0x0;_0x38ea14<_0x428be0[_0xda6a('0x5a')][_0xda6a('0x69')]['length'];_0x38ea14+=0x1){socket[_0xda6a('0x88')](_0xda6a('0x74'),{'UserId':Number(_0x428be0['body'][_0xda6a('0x69')][_0x38ea14]),'WhatsappQueueId':Number(_0x428be0[_0xda6a('0x4c')]['id'])});}return _0x259b55;});}})[_0xda6a('0x2b')](respondWithResult(_0x5446bb,null))[_0xda6a('0x58')](handleError(_0x5446bb,null));};exports[_0xda6a('0x84')]=function(_0x129565,_0x2627c7,_0x9f1ae6){return db['WhatsappQueue'][_0xda6a('0x4e')]({'where':{'id':_0x129565[_0xda6a('0x4c')]['id']}})[_0xda6a('0x2b')](handleEntityNotFound(_0x2627c7,null))[_0xda6a('0x2b')](function(_0x56eef0){if(_0x56eef0){return _0x56eef0['removeAgents'](_0x129565[_0xda6a('0x37')][_0xda6a('0x69')])['then'](function(){if(_[_0xda6a('0x89')](_0x129565[_0xda6a('0x37')][_0xda6a('0x69')])){for(var _0x2bf8a2=0x0;_0x2bf8a2<_0x129565['query'][_0xda6a('0x69')][_0xda6a('0x4d')];_0x2bf8a2+=0x1){socket[_0xda6a('0x88')](_0xda6a('0x8a'),{'UserId':Number(_0x129565['query']['ids'][_0x2bf8a2]),'WhatsappQueueId':Number(_0x129565['params']['id'])});}}else{socket['emit'](_0xda6a('0x8a'),{'UserId':Number(_0x129565[_0xda6a('0x37')][_0xda6a('0x69')]),'WhatsappQueueId':Number(_0x129565[_0xda6a('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x2627c7,null))['catch'](handleError(_0x2627c7,null));};exports[_0xda6a('0x8b')]=function(_0x1f23a1,_0x42f35b,_0x267e69){var _0x131223={};var _0x15cf10={};var _0x3c3659;var _0x38e8f4;return db[_0xda6a('0x46')]['findOne']({'where':{'id':_0x1f23a1[_0xda6a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x42f35b,null))[_0xda6a('0x2b')](function(_0x1568b6){if(_0x1568b6){_0x3c3659=_0x1568b6;_0x15cf10['model']=_[_0xda6a('0x36')](db[_0xda6a('0x61')][_0xda6a('0x31')]);_0x15cf10[_0xda6a('0x37')]=_[_0xda6a('0x36')](_0x1f23a1[_0xda6a('0x37')]);_0x15cf10[_0xda6a('0x41')]=_[_0xda6a('0x38')](_0x15cf10[_0xda6a('0x34')],_0x15cf10[_0xda6a('0x37')]);_0x131223[_0xda6a('0x39')]=_[_0xda6a('0x38')](_0x15cf10['model'],qs[_0xda6a('0x3a')](_0x1f23a1['query']['fields']));_0x131223['attributes']=_0x131223[_0xda6a('0x39')]['length']?_0x131223[_0xda6a('0x39')]:_0x15cf10['model'];_0x131223[_0xda6a('0x3d')]=qs[_0xda6a('0x3e')](_0x1f23a1['query']['sort']);_0x131223[_0xda6a('0x3f')]=qs[_0xda6a('0x41')](_['pick'](_0x1f23a1['query'],_0x15cf10[_0xda6a('0x41')]));if(_0x1f23a1['query']['filter']){_0x131223[_0xda6a('0x3f')]=_[_0xda6a('0x43')](_0x131223[_0xda6a('0x3f')],{'$or':_['map'](_0x131223[_0xda6a('0x39')],function(_0x416dd4){var _0x228e9b={};_0x228e9b[_0x416dd4]={'$like':'%'+_0x1f23a1[_0xda6a('0x37')][_0xda6a('0x42')]+'%'};return _0x228e9b;})});}_0x131223=_[_0xda6a('0x43')]({},_0x131223,_0x1f23a1[_0xda6a('0x45')]);return _0x3c3659[_0xda6a('0x8b')](_0x131223);}})['then'](function(_0x3d5451){if(_0x3d5451){_0x38e8f4=_0x3d5451[_0xda6a('0x4d')];if(!_0x1f23a1[_0xda6a('0x37')][_0xda6a('0x3b')](_0xda6a('0x3c'))){_0x131223[_0xda6a('0x23')]=qs[_0xda6a('0x23')](_0x1f23a1[_0xda6a('0x37')]['limit']);_0x131223[_0xda6a('0x21')]=qs[_0xda6a('0x21')](_0x1f23a1[_0xda6a('0x37')]['offset']);}return _0x3c3659[_0xda6a('0x8b')](_0x131223);}})[_0xda6a('0x2b')](function(_0x58cd8f){if(_0x58cd8f){return _0x58cd8f?{'count':_0x38e8f4,'rows':_0x58cd8f}:null;}})[_0xda6a('0x2b')](respondWithResult(_0x42f35b,null))[_0xda6a('0x58')](handleError(_0x42f35b,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 7c4aff5..f554bc2 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 _0x6289=['emit','hook','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove'];(function(_0xa1ecfd,_0x479438){var _0x598b8e=function(_0x560411){while(--_0x560411){_0xa1ecfd['push'](_0xa1ecfd['shift']());}};_0x598b8e(++_0x479438);}(_0x6289,0x12a));var _0x9628=function(_0x28f0f7,_0x5e43cb){_0x28f0f7=_0x28f0f7-0x0;var _0x14eabb=_0x6289[_0x28f0f7];return _0x14eabb;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x9628('0x0'))['db'][_0x9628('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x9628('0x2')](0x0);var events={'afterCreate':_0x9628('0x3'),'afterUpdate':_0x9628('0x4'),'afterDestroy':_0x9628('0x5')};function emitEvent(_0x30c377){return function(_0x4a3fa9,_0x53437b,_0x59ebc0){WhatsappQueueEvents[_0x9628('0x6')](_0x30c377+':'+_0x4a3fa9['id'],_0x4a3fa9);WhatsappQueueEvents['emit'](_0x30c377,_0x4a3fa9);_0x59ebc0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x9628('0x7')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x22fb=['WhatsappQueue','setMaxListeners','save','update','emit','exports','events','../../mysqldb'];(function(_0x25e109,_0x6ab24c){var _0xc0f7d6=function(_0x2fb92b){while(--_0x2fb92b){_0x25e109['push'](_0x25e109['shift']());}};_0xc0f7d6(++_0x6ab24c);}(_0x22fb,0x106));var _0xb22f=function(_0x794386,_0x529cc2){_0x794386=_0x794386-0x0;var _0x2a4009=_0x22fb[_0x794386];return _0x2a4009;};'use strict';var EventEmitter=require(_0xb22f('0x0'));var WhatsappQueue=require(_0xb22f('0x1'))['db'][_0xb22f('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xb22f('0x3')](0x0);var events={'afterCreate':_0xb22f('0x4'),'afterUpdate':_0xb22f('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1535a8){return function(_0x5709a1,_0x3ced89,_0xdfea52){WhatsappQueueEvents[_0xb22f('0x6')](_0x1535a8+':'+_0x5709a1['id'],_0x5709a1);WhatsappQueueEvents[_0xb22f('0x6')](_0x1535a8,_0x5709a1);_0xdfea52(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xb22f('0x7')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 860a8eb..a0f03da 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 _0xa62b=['moment','request-promise','path','rimraf','../../config/environment','exports','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api'];(function(_0x59ab65,_0x410a52){var _0x57db9b=function(_0x19dc31){while(--_0x19dc31){_0x59ab65['push'](_0x59ab65['shift']());}};_0x57db9b(++_0x410a52);}(_0xa62b,0x1a0));var _0xba62=function(_0x51e01c,_0x2a367f){_0x51e01c=_0x51e01c-0x0;var _0x50b0eb=_0xa62b[_0x51e01c];return _0x50b0eb;};'use strict';var _=require(_0xba62('0x0'));var util=require(_0xba62('0x1'));var logger=require(_0xba62('0x2'))(_0xba62('0x3'));var moment=require(_0xba62('0x4'));var BPromise=require('bluebird');var rp=require(_0xba62('0x5'));var fs=require('fs');var path=require(_0xba62('0x6'));var rimraf=require(_0xba62('0x7'));var config=require(_0xba62('0x8'));var attributes=require('./whatsappQueue.attributes');module[_0xba62('0x9')]=function(_0x602289,_0x31f085){return _0x602289['define'](_0xba62('0xa'),attributes,{'tableName':_0xba62('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9828=['request-promise','path','../../config/environment','./whatsappQueue.attributes','define','WhatsappQueue','util','../../config/logger','api','moment'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x9828,0x178));var _0x8982=function(_0x45577f,_0x14b593){_0x45577f=_0x45577f-0x0;var _0x4e372a=_0x9828[_0x45577f];return _0x4e372a;};'use strict';var _=require('lodash');var util=require(_0x8982('0x0'));var logger=require(_0x8982('0x1'))(_0x8982('0x2'));var moment=require(_0x8982('0x3'));var BPromise=require('bluebird');var rp=require(_0x8982('0x4'));var fs=require('fs');var path=require(_0x8982('0x5'));var rimraf=require('rimraf');var config=require(_0x8982('0x6'));var attributes=require(_0x8982('0x7'));module['exports']=function(_0x1ca088,_0x20c921){return _0x1ca088[_0x8982('0x8')](_0x8982('0x9'),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 1316bb0..c0c361a 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 _0x9c01=['../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','limit','include','map','attributes','model','then','ShowWhatsappQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x1a4cac,_0x116f47){var _0x142f2f=function(_0x4a1e47){while(--_0x4a1e47){_0x1a4cac['push'](_0x1a4cac['shift']());}};_0x142f2f(++_0x116f47);}(_0x9c01,0xc7));var _0x19c0=function(_0x5cf083,_0x38b4fa){_0x5cf083=_0x5cf083-0x0;var _0x49d437=_0x9c01[_0x5cf083];return _0x49d437;};'use strict';var _=require(_0x19c0('0x0'));var util=require(_0x19c0('0x1'));var moment=require(_0x19c0('0x2'));var BPromise=require(_0x19c0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x19c0('0x4'));var db=require(_0x19c0('0x5'))['db'];var utils=require(_0x19c0('0x6'));var logger=require('../../config/logger')(_0x19c0('0x7'));var config=require('../../config/environment');var jayson=require(_0x19c0('0x8'));var client=jayson[_0x19c0('0x9')][_0x19c0('0xa')]({'port':0x232a});config[_0x19c0('0xb')]=_[_0x19c0('0xc')](config[_0x19c0('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x19c0('0xd'))(new Redis(config[_0x19c0('0xb')]));require(_0x19c0('0xe'))[_0x19c0('0xf')](socket);function respondWithRpcPromise(_0x1c0615,_0x3df62d,_0x425c6a){return new BPromise(function(_0x4ffeac,_0x3df2e8){return client[_0x19c0('0x10')](_0x1c0615,_0x425c6a)['then'](function(_0x3d1adc){logger[_0x19c0('0x11')](_0x19c0('0x12'),_0x3df62d,_0x19c0('0x13'));logger[_0x19c0('0x14')](_0x19c0('0x15'),_0x3df62d,'request\x20sent',JSON[_0x19c0('0x16')](_0x3d1adc));if(_0x3d1adc[_0x19c0('0x17')]){if(_0x3d1adc[_0x19c0('0x17')][_0x19c0('0x18')]===0x1f4){logger[_0x19c0('0x17')](_0x19c0('0x12'),_0x3df62d,_0x3d1adc[_0x19c0('0x17')][_0x19c0('0x19')]);return _0x3df2e8(_0x3d1adc[_0x19c0('0x17')][_0x19c0('0x19')]);}logger['error'](_0x19c0('0x12'),_0x3df62d,_0x3d1adc[_0x19c0('0x17')][_0x19c0('0x19')]);return _0x4ffeac(_0x3d1adc['error'][_0x19c0('0x19')]);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x3df62d,_0x19c0('0x13'));_0x4ffeac(_0x3d1adc[_0x19c0('0x1a')][_0x19c0('0x19')]);}})[_0x19c0('0x1b')](function(_0x728c5){logger[_0x19c0('0x17')](_0x19c0('0x12'),_0x3df62d,_0x728c5);_0x3df2e8(_0x728c5);});});}exports[_0x19c0('0x1c')]=function(_0x39b709){var _0x298ebd=this;return new Promise(function(_0x4d31ef,_0x4ab6a5){return db[_0x19c0('0x1d')][_0x19c0('0x1e')]({'raw':_0x39b709[_0x19c0('0x1f')]?_0x39b709[_0x19c0('0x1f')][_0x19c0('0x20')]===undefined?!![]:![]:!![],'where':_0x39b709[_0x19c0('0x1f')]?_0x39b709[_0x19c0('0x1f')][_0x19c0('0x21')]||null:null,'attributes':_0x39b709[_0x19c0('0x1f')]?_0x39b709[_0x19c0('0x1f')]['attributes']||null:null,'limit':_0x39b709[_0x19c0('0x1f')]?_0x39b709[_0x19c0('0x1f')][_0x19c0('0x22')]||null:null,'include':_0x39b709['options']?_0x39b709['options'][_0x19c0('0x23')]?_[_0x19c0('0x24')](_0x39b709[_0x19c0('0x1f')][_0x19c0('0x23')],function(_0x50c438){return{'model':db[_0x50c438['model']],'as':_0x50c438['as'],'attributes':_0x50c438[_0x19c0('0x25')],'include':_0x50c438['include']?_[_0x19c0('0x24')](_0x50c438[_0x19c0('0x23')],function(_0x472823){return{'model':db[_0x472823['model']],'as':_0x472823['as'],'attributes':_0x472823[_0x19c0('0x25')],'include':_0x472823[_0x19c0('0x23')]?_['map'](_0x472823[_0x19c0('0x23')],function(_0x3b4817){return{'model':db[_0x3b4817[_0x19c0('0x26')]],'as':_0x3b4817['as'],'attributes':_0x3b4817[_0x19c0('0x25')]};}):[]};}):[]};}):[]:[]})[_0x19c0('0x27')](function(_0x2c2ba8){logger[_0x19c0('0x11')](_0x19c0('0x1c'),_0x39b709);logger[_0x19c0('0x14')](_0x19c0('0x1c'),_0x39b709,JSON[_0x19c0('0x16')](_0x2c2ba8));_0x4d31ef(_0x2c2ba8);})['catch'](function(_0x1462a6){logger[_0x19c0('0x17')](_0x19c0('0x1c'),_0x1462a6[_0x19c0('0x19')],_0x39b709);_0x4ab6a5(_0x298ebd['error'](0x1f4,_0x1462a6[_0x19c0('0x19')]));});});};exports['ShowWhatsappQueue']=function(_0x3a2a71){var _0x22fdf9=this;return new Promise(function(_0x11c3de,_0x41f237){return db[_0x19c0('0x1d')]['find']({'raw':_0x3a2a71[_0x19c0('0x1f')]?_0x3a2a71[_0x19c0('0x1f')][_0x19c0('0x20')]===undefined?!![]:![]:!![],'where':_0x3a2a71[_0x19c0('0x1f')]?_0x3a2a71[_0x19c0('0x1f')][_0x19c0('0x21')]||null:null,'attributes':_0x3a2a71[_0x19c0('0x1f')]?_0x3a2a71['options']['attributes']||null:null,'include':_0x3a2a71[_0x19c0('0x1f')]?_0x3a2a71['options'][_0x19c0('0x23')]?_[_0x19c0('0x24')](_0x3a2a71[_0x19c0('0x1f')][_0x19c0('0x23')],function(_0x44228e){return{'model':db[_0x44228e[_0x19c0('0x26')]],'as':_0x44228e['as'],'attributes':_0x44228e['attributes'],'include':_0x44228e['include']?_['map'](_0x44228e[_0x19c0('0x23')],function(_0x415148){return{'model':db[_0x415148[_0x19c0('0x26')]],'as':_0x415148['as'],'attributes':_0x415148['attributes'],'include':_0x415148[_0x19c0('0x23')]?_[_0x19c0('0x24')](_0x415148[_0x19c0('0x23')],function(_0x43621c){return{'model':db[_0x43621c[_0x19c0('0x26')]],'as':_0x43621c['as'],'attributes':_0x43621c[_0x19c0('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27b47d){logger[_0x19c0('0x11')]('ShowWhatsappQueue',_0x3a2a71);logger[_0x19c0('0x14')](_0x19c0('0x28'),_0x3a2a71,JSON[_0x19c0('0x16')](_0x27b47d));_0x11c3de(_0x27b47d);})[_0x19c0('0x1b')](function(_0x120383){logger[_0x19c0('0x17')](_0x19c0('0x28'),_0x120383[_0x19c0('0x19')],_0x3a2a71);_0x41f237(_0x22fdf9[_0x19c0('0x17')](0x1f4,_0x120383[_0x19c0('0x19')]));});});}; \ No newline at end of file +var _0x0439=['catch','GetWhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','WhatsappQueue','find','debug','ShowWhatsappQueue','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','request','then','info','request\x20sent','stringify','error','WhatsappQueue,\x20%s,\x20%s','message'];(function(_0x196cef,_0x571108){var _0x3a3c28=function(_0x51b590){while(--_0x51b590){_0x196cef['push'](_0x196cef['shift']());}};_0x3a3c28(++_0x571108);}(_0x0439,0x14f));var _0x9043=function(_0x52e716,_0x48170f){_0x52e716=_0x52e716-0x0;var _0x1fdc6b=_0x0439[_0x52e716];return _0x1fdc6b;};'use strict';var _=require(_0x9043('0x0'));var util=require(_0x9043('0x1'));var moment=require('moment');var BPromise=require(_0x9043('0x2'));var rs=require(_0x9043('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9043('0x4'))['db'];var utils=require(_0x9043('0x5'));var logger=require(_0x9043('0x6'))(_0x9043('0x7'));var config=require(_0x9043('0x8'));var jayson=require(_0x9043('0x9'));var client=jayson[_0x9043('0xa')][_0x9043('0xb')]({'port':0x232a});config[_0x9043('0xc')]=_[_0x9043('0xd')](config[_0x9043('0xc')],{'host':_0x9043('0xe'),'port':0x18eb});var socket=require(_0x9043('0xf'))(new Redis(config[_0x9043('0xc')]));require(_0x9043('0x10'))['register'](socket);function respondWithRpcPromise(_0x29a2b4,_0x59f2c9,_0x3aa919){return new BPromise(function(_0x2c9305,_0x5601eb){return client[_0x9043('0x11')](_0x29a2b4,_0x3aa919)[_0x9043('0x12')](function(_0x134519){logger[_0x9043('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x59f2c9,_0x9043('0x14'));logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x59f2c9,_0x9043('0x14'),JSON[_0x9043('0x15')](_0x134519));if(_0x134519[_0x9043('0x16')]){if(_0x134519['error']['code']===0x1f4){logger[_0x9043('0x16')](_0x9043('0x17'),_0x59f2c9,_0x134519[_0x9043('0x16')][_0x9043('0x18')]);return _0x5601eb(_0x134519['error'][_0x9043('0x18')]);}logger[_0x9043('0x16')](_0x9043('0x17'),_0x59f2c9,_0x134519[_0x9043('0x16')][_0x9043('0x18')]);return _0x2c9305(_0x134519[_0x9043('0x16')][_0x9043('0x18')]);}else{logger[_0x9043('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x59f2c9,'request\x20sent');_0x2c9305(_0x134519['result']['message']);}})[_0x9043('0x19')](function(_0x593a72){logger[_0x9043('0x16')](_0x9043('0x17'),_0x59f2c9,_0x593a72);_0x5601eb(_0x593a72);});});}exports[_0x9043('0x1a')]=function(_0x357f26){var _0x29cf97=this;return new Promise(function(_0x38d196,_0x1e78b2){return db['WhatsappQueue'][_0x9043('0x1b')]({'raw':_0x357f26['options']?_0x357f26[_0x9043('0x1c')][_0x9043('0x1d')]===undefined?!![]:![]:!![],'where':_0x357f26[_0x9043('0x1c')]?_0x357f26[_0x9043('0x1c')][_0x9043('0x1e')]||null:null,'attributes':_0x357f26['options']?_0x357f26['options'][_0x9043('0x1f')]||null:null,'limit':_0x357f26[_0x9043('0x1c')]?_0x357f26['options'][_0x9043('0x20')]||null:null,'include':_0x357f26[_0x9043('0x1c')]?_0x357f26[_0x9043('0x1c')][_0x9043('0x21')]?_[_0x9043('0x22')](_0x357f26[_0x9043('0x1c')][_0x9043('0x21')],function(_0x4ec6de){return{'model':db[_0x4ec6de[_0x9043('0x23')]],'as':_0x4ec6de['as'],'attributes':_0x4ec6de[_0x9043('0x1f')],'include':_0x4ec6de[_0x9043('0x21')]?_['map'](_0x4ec6de['include'],function(_0x3cec27){return{'model':db[_0x3cec27[_0x9043('0x23')]],'as':_0x3cec27['as'],'attributes':_0x3cec27[_0x9043('0x1f')],'include':_0x3cec27['include']?_[_0x9043('0x22')](_0x3cec27[_0x9043('0x21')],function(_0x264013){return{'model':db[_0x264013[_0x9043('0x23')]],'as':_0x264013['as'],'attributes':_0x264013[_0x9043('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9043('0x12')](function(_0x1d4edf){logger['info'](_0x9043('0x1a'),_0x357f26);logger['debug'](_0x9043('0x1a'),_0x357f26,JSON[_0x9043('0x15')](_0x1d4edf));_0x38d196(_0x1d4edf);})['catch'](function(_0x4b7993){logger[_0x9043('0x16')]('GetWhatsappQueue',_0x4b7993['message'],_0x357f26);_0x1e78b2(_0x29cf97[_0x9043('0x16')](0x1f4,_0x4b7993[_0x9043('0x18')]));});});};exports['ShowWhatsappQueue']=function(_0x113cde){var _0x215df5=this;return new Promise(function(_0x3fed21,_0x3d2586){return db[_0x9043('0x24')][_0x9043('0x25')]({'raw':_0x113cde[_0x9043('0x1c')]?_0x113cde[_0x9043('0x1c')][_0x9043('0x1d')]===undefined?!![]:![]:!![],'where':_0x113cde[_0x9043('0x1c')]?_0x113cde[_0x9043('0x1c')][_0x9043('0x1e')]||null:null,'attributes':_0x113cde[_0x9043('0x1c')]?_0x113cde[_0x9043('0x1c')][_0x9043('0x1f')]||null:null,'include':_0x113cde[_0x9043('0x1c')]?_0x113cde[_0x9043('0x1c')][_0x9043('0x21')]?_[_0x9043('0x22')](_0x113cde['options'][_0x9043('0x21')],function(_0x378447){return{'model':db[_0x378447[_0x9043('0x23')]],'as':_0x378447['as'],'attributes':_0x378447[_0x9043('0x1f')],'include':_0x378447['include']?_[_0x9043('0x22')](_0x378447['include'],function(_0x126856){return{'model':db[_0x126856[_0x9043('0x23')]],'as':_0x126856['as'],'attributes':_0x126856[_0x9043('0x1f')],'include':_0x126856[_0x9043('0x21')]?_[_0x9043('0x22')](_0x126856[_0x9043('0x21')],function(_0x50d078){return{'model':db[_0x50d078[_0x9043('0x23')]],'as':_0x50d078['as'],'attributes':_0x50d078['attributes']};}):[]};}):[]};}):[]:[]})[_0x9043('0x12')](function(_0x2a43b1){logger[_0x9043('0x13')]('ShowWhatsappQueue',_0x113cde);logger[_0x9043('0x26')](_0x9043('0x27'),_0x113cde,JSON[_0x9043('0x15')](_0x2a43b1));_0x3fed21(_0x2a43b1);})[_0x9043('0x19')](function(_0x580f6d){logger[_0x9043('0x16')](_0x9043('0x27'),_0x580f6d[_0x9043('0x18')],_0x113cde);_0x3d2586(_0x215df5[_0x9043('0x16')](0x1f4,_0x580f6d[_0x9043('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 2599356..2143ec0 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 _0x930c=['./whatsappQueue.events','save','remove','update','removeListener','register','whatsappQueue:'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x930c,0x12d));var _0xc930=function(_0xc53417,_0x17ec83){_0xc53417=_0xc53417-0x0;var _0x4fc437=_0x930c[_0xc53417];return _0x4fc437;};'use strict';var WhatsappQueueEvents=require(_0xc930('0x0'));var events=[_0xc930('0x1'),_0xc930('0x2'),_0xc930('0x3')];function createListener(_0x57e2d3,_0x27d2f9){return function(_0x32398f){_0x27d2f9['emit'](_0x57e2d3,_0x32398f);};}function removeListener(_0x166441,_0x95fa39){return function(){WhatsappQueueEvents[_0xc930('0x4')](_0x166441,_0x95fa39);};}exports[_0xc930('0x5')]=function(_0x2fb045){for(var _0x43a02d=0x0,_0x52c030=events['length'];_0x43a02d<_0x52c030;_0x43a02d++){var _0x1f4dc6=events[_0x43a02d];var _0xd44086=createListener(_0xc930('0x6')+_0x1f4dc6,_0x2fb045);WhatsappQueueEvents['on'](_0x1f4dc6,_0xd44086);}}; \ No newline at end of file +var _0xe68d=['length','whatsappQueue:','./whatsappQueue.events','save','update','emit','register'];(function(_0x55e82f,_0x25cb3f){var _0x12f035=function(_0x4c93df){while(--_0x4c93df){_0x55e82f['push'](_0x55e82f['shift']());}};_0x12f035(++_0x25cb3f);}(_0xe68d,0x95));var _0xde68=function(_0x490be3,_0xf0fca3){_0x490be3=_0x490be3-0x0;var _0x3f5140=_0xe68d[_0x490be3];return _0x3f5140;};'use strict';var WhatsappQueueEvents=require(_0xde68('0x0'));var events=[_0xde68('0x1'),'remove',_0xde68('0x2')];function createListener(_0x419f17,_0x7565ea){return function(_0x2d547b){_0x7565ea[_0xde68('0x3')](_0x419f17,_0x2d547b);};}function removeListener(_0x442ec8,_0x28109d){return function(){WhatsappQueueEvents['removeListener'](_0x442ec8,_0x28109d);};}exports[_0xde68('0x4')]=function(_0xa54cc5){for(var _0x268105=0x0,_0x23b9d9=events[_0xde68('0x5')];_0x268105<_0x23b9d9;_0x268105++){var _0x26f47c=events[_0x268105];var _0x47f479=createListener(_0xde68('0x6')+_0x26f47c,_0xa54cc5);WhatsappQueueEvents['on'](_0x26f47c,_0x47f479);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index b34bace..41b6e02 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 _0xcd88=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./whatsappQueueReport.controller','get','/describe','isAuthenticated','/:id','show','put','delete'];(function(_0xaa7af2,_0x289bf0){var _0xbf48e3=function(_0x477729){while(--_0x477729){_0xaa7af2['push'](_0xaa7af2['shift']());}};_0xbf48e3(++_0x289bf0);}(_0xcd88,0x1ee));var _0x8cd8=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0xcd88[_0x39d544];return _0x5a5ff2;};'use strict';var multer=require(_0x8cd8('0x0'));var util=require(_0x8cd8('0x1'));var path=require(_0x8cd8('0x2'));var timeout=require(_0x8cd8('0x3'));var express=require(_0x8cd8('0x4'));var router=express[_0x8cd8('0x5')]();var fs_extra=require(_0x8cd8('0x6'));var auth=require(_0x8cd8('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8cd8('0x8'));router[_0x8cd8('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x8cd8('0xa'),auth[_0x8cd8('0xb')](),controller['describe']);router['get'](_0x8cd8('0xc'),auth['isAuthenticated'](),controller[_0x8cd8('0xd')]);router['post']('/',auth[_0x8cd8('0xb')](),controller['create']);router[_0x8cd8('0xe')]('/:id',auth[_0x8cd8('0xb')](),controller['update']);router[_0x8cd8('0xf')](_0x8cd8('0xc'),auth[_0x8cd8('0xb')](),controller[_0x8cd8('0x10')]);module['exports']=router; \ No newline at end of file +var _0x067a=['../../config/environment','./whatsappQueueReport.controller','isAuthenticated','index','/describe','describe','post','put','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x434783,_0xff395d){var _0x13efcf=function(_0x235dac){while(--_0x235dac){_0x434783['push'](_0x434783['shift']());}};_0x13efcf(++_0xff395d);}(_0x067a,0xa4));var _0xa067=function(_0x57e770,_0x2d9f61){_0x57e770=_0x57e770-0x0;var _0x251c61=_0x067a[_0x57e770];return _0x251c61;};'use strict';var multer=require(_0xa067('0x0'));var util=require(_0xa067('0x1'));var path=require('path');var timeout=require(_0xa067('0x2'));var express=require(_0xa067('0x3'));var router=express[_0xa067('0x4')]();var fs_extra=require(_0xa067('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa067('0x6'));var config=require(_0xa067('0x7'));var controller=require(_0xa067('0x8'));router['get']('/',auth[_0xa067('0x9')](),controller[_0xa067('0xa')]);router['get'](_0xa067('0xb'),auth[_0xa067('0x9')](),controller[_0xa067('0xc')]);router['get']('/:id',auth[_0xa067('0x9')](),controller['show']);router[_0xa067('0xd')]('/',auth[_0xa067('0x9')](),controller['create']);router[_0xa067('0xe')](_0xa067('0xf'),auth['isAuthenticated'](),controller[_0xa067('0x10')]);router[_0xa067('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xa067('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 e07b9bd..5262b25 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x205add,_0x326491){var _0x133063=function(_0x286a1b){while(--_0x286a1b){_0x205add['push'](_0x205add['shift']());}};_0x133063(++_0x326491);}(_0x7a54,0x106));var _0x47a5=function(_0x265618,_0x1022f0){_0x265618=_0x265618-0x0;var _0x430ef2=_0x7a54[_0x265618];return _0x430ef2;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x26a5e6,_0x33f293){var _0x22fd6c=function(_0x4e5b0f){while(--_0x4e5b0f){_0x26a5e6['push'](_0x26a5e6['shift']());}};_0x22fd6c(++_0x33f293);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index e37d0e6..c715745 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 _0xa902=['ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','includeAll','include','WhatsappQueueReport','findAll','rows','catch','params','length','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv'];(function(_0x49bb70,_0x81f90e){var _0x3b0d52=function(_0x3b5ddc){while(--_0x3b5ddc){_0x49bb70['push'](_0x49bb70['shift']());}};_0x3b0d52(++_0x81f90e);}(_0xa902,0x8d));var _0x2a90=function(_0x1630b3,_0x56559d){_0x1630b3=_0x1630b3-0x0;var _0x4acaa3=_0xa902[_0x1630b3];return _0x4acaa3;};'use strict';var emlformat=require(_0x2a90('0x0'));var rimraf=require(_0x2a90('0x1'));var zipdir=require(_0x2a90('0x2'));var jsonpatch=require(_0x2a90('0x3'));var rp=require(_0x2a90('0x4'));var moment=require('moment');var BPromise=require(_0x2a90('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2a90('0x6'));var sox=require(_0x2a90('0x7'));var csv=require(_0x2a90('0x8'));var ejs=require(_0x2a90('0x9'));var fs=require('fs');var fs_extra=require(_0x2a90('0xa'));var _=require(_0x2a90('0xb'));var squel=require('squel');var crypto=require(_0x2a90('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2a90('0x8'));var querystring=require(_0x2a90('0xd'));var Papa=require(_0x2a90('0xe'));var Redis=require(_0x2a90('0xf'));var authService=require(_0x2a90('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2a90('0x11'));var hardwareService=require(_0x2a90('0x12'));var logger=require(_0x2a90('0x13'))(_0x2a90('0x14'));var utils=require('../../config/utils');var config=require(_0x2a90('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2a90('0x16'))['db'];function respondWithStatusCode(_0x57458a,_0x1f6953){_0x1f6953=_0x1f6953||0xcc;return function(_0x57aee3){if(_0x57aee3){return _0x57458a[_0x2a90('0x17')](_0x1f6953);}return _0x57458a[_0x2a90('0x18')](_0x1f6953)[_0x2a90('0x19')]();};}function respondWithResult(_0x4c328b,_0x56d1b8){_0x56d1b8=_0x56d1b8||0xc8;return function(_0x57227c){if(_0x57227c){return _0x4c328b[_0x2a90('0x18')](_0x56d1b8)[_0x2a90('0x1a')](_0x57227c);}};}function respondWithFilteredResult(_0x5a2682,_0x1ff63d){return function(_0x21c648){if(_0x21c648){var _0x312782=typeof _0x1ff63d[_0x2a90('0x1b')]===_0x2a90('0x1c')&&typeof _0x1ff63d[_0x2a90('0x1d')]===_0x2a90('0x1c');var _0x10cf94=_0x21c648[_0x2a90('0x1e')];var _0x5c3e4b=_0x312782?0x0:_0x1ff63d[_0x2a90('0x1b')];var _0x1d9a28=_0x312782?_0x21c648[_0x2a90('0x1e')]:_0x1ff63d['offset']+_0x1ff63d[_0x2a90('0x1d')];var _0x1f51a6;if(_0x1d9a28>=_0x10cf94){_0x1d9a28=_0x10cf94;_0x1f51a6=0xc8;}else{_0x1f51a6=0xce;}_0x5a2682[_0x2a90('0x18')](_0x1f51a6);return _0x5a2682[_0x2a90('0x1f')](_0x2a90('0x20'),_0x5c3e4b+'-'+_0x1d9a28+'/'+_0x10cf94)[_0x2a90('0x1a')](_0x21c648);}return null;};}function patchUpdates(_0x312cd5){return function(_0x114d42){try{jsonpatch[_0x2a90('0x21')](_0x114d42,_0x312cd5,!![]);}catch(_0x465284){return BPromise[_0x2a90('0x22')](_0x465284);}return _0x114d42[_0x2a90('0x23')]();};}function saveUpdates(_0x4fdd62,_0x3da7d0){return function(_0x217873){if(_0x217873){return _0x217873[_0x2a90('0x24')](_0x4fdd62)[_0x2a90('0x25')](function(_0x5912fd){return _0x5912fd;});}return null;};}function removeEntity(_0x180485,_0xd033d){return function(_0x4ed9e6){if(_0x4ed9e6){return _0x4ed9e6[_0x2a90('0x26')]()[_0x2a90('0x25')](function(){_0x180485[_0x2a90('0x18')](0xcc)[_0x2a90('0x19')]();});}};}function handleEntityNotFound(_0x2a212c,_0x1303d9){return function(_0x29ed73){if(!_0x29ed73){_0x2a212c[_0x2a90('0x17')](0x194);}return _0x29ed73;};}function handleError(_0x48c2f9,_0x27f883){_0x27f883=_0x27f883||0x1f4;return function(_0x17f978){logger[_0x2a90('0x27')](_0x17f978[_0x2a90('0x28')]);if(_0x17f978[_0x2a90('0x29')]){delete _0x17f978['name'];}_0x48c2f9['status'](_0x27f883)[_0x2a90('0x2a')](_0x17f978);};}exports['index']=function(_0x53391e,_0x4969c3){var _0x2d83b3={},_0x3c78f5={},_0x595638={'count':0x0,'rows':[]};var _0x5bd700=_[_0x2a90('0x2b')](db['WhatsappQueueReport'][_0x2a90('0x2c')],function(_0x6892e1){return{'name':_0x6892e1[_0x2a90('0x2d')],'type':_0x6892e1[_0x2a90('0x2e')][_0x2a90('0x2f')]};});_0x3c78f5[_0x2a90('0x30')]=_[_0x2a90('0x2b')](_0x5bd700,'name');_0x3c78f5[_0x2a90('0x31')]=_[_0x2a90('0x32')](_0x53391e[_0x2a90('0x31')]);_0x3c78f5['filters']=_[_0x2a90('0x33')](_0x3c78f5[_0x2a90('0x30')],_0x3c78f5[_0x2a90('0x31')]);_0x2d83b3[_0x2a90('0x34')]=_['intersection'](_0x3c78f5[_0x2a90('0x30')],qs[_0x2a90('0x35')](_0x53391e[_0x2a90('0x31')][_0x2a90('0x35')]));_0x2d83b3[_0x2a90('0x34')]=_0x2d83b3[_0x2a90('0x34')]['length']?_0x2d83b3[_0x2a90('0x34')]:_0x3c78f5[_0x2a90('0x30')];if(!_0x53391e[_0x2a90('0x31')][_0x2a90('0x36')]('nolimit')){_0x2d83b3[_0x2a90('0x1d')]=qs[_0x2a90('0x1d')](_0x53391e['query'][_0x2a90('0x1d')]);_0x2d83b3[_0x2a90('0x1b')]=qs['offset'](_0x53391e['query'][_0x2a90('0x1b')]);}_0x2d83b3[_0x2a90('0x37')]=qs[_0x2a90('0x38')](_0x53391e['query'][_0x2a90('0x38')]);_0x2d83b3['where']=qs[_0x2a90('0x39')](_['pick'](_0x53391e[_0x2a90('0x31')],_0x3c78f5['filters']),_0x5bd700);if(_0x53391e['query'][_0x2a90('0x3a')]){_0x2d83b3['where']=_[_0x2a90('0x3b')](_0x2d83b3[_0x2a90('0x3c')],{'$or':_[_0x2a90('0x2b')](_0x5bd700,function(_0x573aee){if(_0x573aee[_0x2a90('0x2e')]!==_0x2a90('0x3d')){var _0x3be438={};_0x3be438[_0x573aee['name']]={'$like':'%'+_0x53391e[_0x2a90('0x31')][_0x2a90('0x3a')]+'%'};return _0x3be438;}})});}_0x2d83b3=_[_0x2a90('0x3b')]({},_0x2d83b3,_0x53391e['options']);var _0x1aa096={'where':_0x2d83b3[_0x2a90('0x3c')]};return db['WhatsappQueueReport'][_0x2a90('0x1e')](_0x1aa096)[_0x2a90('0x25')](function(_0x2a6bea){_0x595638[_0x2a90('0x1e')]=_0x2a6bea;if(_0x53391e[_0x2a90('0x31')][_0x2a90('0x3e')]){_0x2d83b3[_0x2a90('0x3f')]=[{'all':!![]}];}return db[_0x2a90('0x40')][_0x2a90('0x41')](_0x2d83b3);})[_0x2a90('0x25')](function(_0x45b41c){_0x595638[_0x2a90('0x42')]=_0x45b41c;return _0x595638;})[_0x2a90('0x25')](respondWithFilteredResult(_0x4969c3,_0x2d83b3))[_0x2a90('0x43')](handleError(_0x4969c3,null));};exports['show']=function(_0x45cbc2,_0x3a70fe){var _0x528b41={'raw':!![],'where':{'id':_0x45cbc2[_0x2a90('0x44')]['id']}},_0x1045bb={};_0x1045bb[_0x2a90('0x30')]=_[_0x2a90('0x32')](db[_0x2a90('0x40')]['rawAttributes']);_0x1045bb[_0x2a90('0x31')]=_['keys'](_0x45cbc2[_0x2a90('0x31')]);_0x1045bb['filters']=_[_0x2a90('0x33')](_0x1045bb[_0x2a90('0x30')],_0x1045bb[_0x2a90('0x31')]);_0x528b41[_0x2a90('0x34')]=_[_0x2a90('0x33')](_0x1045bb[_0x2a90('0x30')],qs[_0x2a90('0x35')](_0x45cbc2['query']['fields']));_0x528b41[_0x2a90('0x34')]=_0x528b41[_0x2a90('0x34')][_0x2a90('0x45')]?_0x528b41[_0x2a90('0x34')]:_0x1045bb[_0x2a90('0x30')];if(_0x45cbc2[_0x2a90('0x31')][_0x2a90('0x3e')]){_0x528b41[_0x2a90('0x3f')]=[{'all':!![]}];}_0x528b41=_['merge']({},_0x528b41,_0x45cbc2[_0x2a90('0x46')]);return db['WhatsappQueueReport'][_0x2a90('0x47')](_0x528b41)[_0x2a90('0x25')](handleEntityNotFound(_0x3a70fe,null))['then'](respondWithResult(_0x3a70fe,null))[_0x2a90('0x43')](handleError(_0x3a70fe,null));};exports[_0x2a90('0x48')]=function(_0x280e63,_0x1d55db){return db[_0x2a90('0x40')][_0x2a90('0x48')](_0x280e63[_0x2a90('0x49')],{})['then'](respondWithResult(_0x1d55db,0xc9))['catch'](handleError(_0x1d55db,null));};exports[_0x2a90('0x24')]=function(_0x2611d0,_0x42c890){if(_0x2611d0[_0x2a90('0x49')]['id']){delete _0x2611d0[_0x2a90('0x49')]['id'];}return db['WhatsappQueueReport']['find']({'where':{'id':_0x2611d0[_0x2a90('0x44')]['id']}})[_0x2a90('0x25')](handleEntityNotFound(_0x42c890,null))['then'](saveUpdates(_0x2611d0['body'],null))['then'](respondWithResult(_0x42c890,null))[_0x2a90('0x43')](handleError(_0x42c890,null));};exports['destroy']=function(_0x370da3,_0x3dfe72){return db[_0x2a90('0x40')][_0x2a90('0x47')]({'where':{'id':_0x370da3[_0x2a90('0x44')]['id']}})[_0x2a90('0x25')](handleEntityNotFound(_0x3dfe72,null))['then'](removeEntity(_0x3dfe72,null))[_0x2a90('0x43')](handleError(_0x3dfe72,null));};exports[_0x2a90('0x4a')]=function(_0x48d3bc,_0x265769){return db['WhatsappQueueReport']['describe']()[_0x2a90('0x25')](respondWithResult(_0x265769,null))[_0x2a90('0x43')](handleError(_0x265769,null));}; \ No newline at end of file +var _0x8603=['fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','show','params','includeAll','find','create','body','describe','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','WhatsappQueueReport','rawAttributes'];(function(_0x2e4840,_0x21c9b8){var _0x3457cc=function(_0x55cfce){while(--_0x55cfce){_0x2e4840['push'](_0x2e4840['shift']());}};_0x3457cc(++_0x21c9b8);}(_0x8603,0x190));var _0x3860=function(_0x6595d5,_0x3f84e1){_0x6595d5=_0x6595d5-0x0;var _0x1b7304=_0x8603[_0x6595d5];return _0x1b7304;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3860('0x0'));var zipdir=require(_0x3860('0x1'));var jsonpatch=require(_0x3860('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3860('0x3'));var Mustache=require(_0x3860('0x4'));var util=require(_0x3860('0x5'));var path=require('path');var sox=require(_0x3860('0x6'));var csv=require('to-csv');var ejs=require(_0x3860('0x7'));var fs=require('fs');var fs_extra=require(_0x3860('0x8'));var _=require(_0x3860('0x9'));var squel=require(_0x3860('0xa'));var crypto=require(_0x3860('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3860('0xc'));var Papa=require(_0x3860('0xd'));var Redis=require('ioredis');var authService=require(_0x3860('0xe'));var qs=require(_0x3860('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3860('0x10'));var logger=require(_0x3860('0x11'))('api');var utils=require(_0x3860('0x12'));var config=require(_0x3860('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3860('0x14'))['db'];function respondWithStatusCode(_0x8ad61d,_0x2428f6){_0x2428f6=_0x2428f6||0xcc;return function(_0x1ea619){if(_0x1ea619){return _0x8ad61d[_0x3860('0x15')](_0x2428f6);}return _0x8ad61d[_0x3860('0x16')](_0x2428f6)[_0x3860('0x17')]();};}function respondWithResult(_0x12b23b,_0x465d8d){_0x465d8d=_0x465d8d||0xc8;return function(_0x46264d){if(_0x46264d){return _0x12b23b['status'](_0x465d8d)[_0x3860('0x18')](_0x46264d);}};}function respondWithFilteredResult(_0x21eaf1,_0x122e40){return function(_0x37d9ab){if(_0x37d9ab){var _0x1055b3=typeof _0x122e40[_0x3860('0x19')]===_0x3860('0x1a')&&typeof _0x122e40[_0x3860('0x1b')]===_0x3860('0x1a');var _0x3c0d91=_0x37d9ab[_0x3860('0x1c')];var _0x45b799=_0x1055b3?0x0:_0x122e40['offset'];var _0x4863bd=_0x1055b3?_0x37d9ab[_0x3860('0x1c')]:_0x122e40[_0x3860('0x19')]+_0x122e40[_0x3860('0x1b')];var _0x53fc63;if(_0x4863bd>=_0x3c0d91){_0x4863bd=_0x3c0d91;_0x53fc63=0xc8;}else{_0x53fc63=0xce;}_0x21eaf1[_0x3860('0x16')](_0x53fc63);return _0x21eaf1[_0x3860('0x1d')](_0x3860('0x1e'),_0x45b799+'-'+_0x4863bd+'/'+_0x3c0d91)[_0x3860('0x18')](_0x37d9ab);}return null;};}function patchUpdates(_0x20a5b0){return function(_0x45081f){try{jsonpatch[_0x3860('0x1f')](_0x45081f,_0x20a5b0,!![]);}catch(_0x1f8891){return BPromise[_0x3860('0x20')](_0x1f8891);}return _0x45081f[_0x3860('0x21')]();};}function saveUpdates(_0xacd57f,_0x2e0b6e){return function(_0x280ea9){if(_0x280ea9){return _0x280ea9[_0x3860('0x22')](_0xacd57f)[_0x3860('0x23')](function(_0x564efd){return _0x564efd;});}return null;};}function removeEntity(_0xfc10a5,_0x133093){return function(_0x2b91f2){if(_0x2b91f2){return _0x2b91f2[_0x3860('0x24')]()[_0x3860('0x23')](function(){_0xfc10a5['status'](0xcc)[_0x3860('0x17')]();});}};}function handleEntityNotFound(_0x568515,_0x577750){return function(_0xfa9705){if(!_0xfa9705){_0x568515[_0x3860('0x15')](0x194);}return _0xfa9705;};}function handleError(_0x54b5ec,_0x4d9a90){_0x4d9a90=_0x4d9a90||0x1f4;return function(_0x5f42d5){logger[_0x3860('0x25')](_0x5f42d5[_0x3860('0x26')]);if(_0x5f42d5[_0x3860('0x27')]){delete _0x5f42d5[_0x3860('0x27')];}_0x54b5ec[_0x3860('0x16')](_0x4d9a90)[_0x3860('0x28')](_0x5f42d5);};}exports['index']=function(_0x4c4314,_0x389bd0){var _0x1f1809={},_0x5a9af2={},_0x2551f4={'count':0x0,'rows':[]};var _0x3d5143=_[_0x3860('0x29')](db[_0x3860('0x2a')][_0x3860('0x2b')],function(_0x4bbae9){return{'name':_0x4bbae9[_0x3860('0x2c')],'type':_0x4bbae9[_0x3860('0x2d')][_0x3860('0x2e')]};});_0x5a9af2['model']=_[_0x3860('0x29')](_0x3d5143,'name');_0x5a9af2[_0x3860('0x2f')]=_['keys'](_0x4c4314[_0x3860('0x2f')]);_0x5a9af2[_0x3860('0x30')]=_[_0x3860('0x31')](_0x5a9af2['model'],_0x5a9af2[_0x3860('0x2f')]);_0x1f1809[_0x3860('0x32')]=_['intersection'](_0x5a9af2[_0x3860('0x33')],qs['fields'](_0x4c4314[_0x3860('0x2f')][_0x3860('0x34')]));_0x1f1809[_0x3860('0x32')]=_0x1f1809[_0x3860('0x32')][_0x3860('0x35')]?_0x1f1809[_0x3860('0x32')]:_0x5a9af2[_0x3860('0x33')];if(!_0x4c4314['query'][_0x3860('0x36')](_0x3860('0x37'))){_0x1f1809['limit']=qs[_0x3860('0x1b')](_0x4c4314[_0x3860('0x2f')][_0x3860('0x1b')]);_0x1f1809['offset']=qs['offset'](_0x4c4314[_0x3860('0x2f')][_0x3860('0x19')]);}_0x1f1809[_0x3860('0x38')]=qs[_0x3860('0x39')](_0x4c4314['query']['sort']);_0x1f1809[_0x3860('0x3a')]=qs[_0x3860('0x30')](_[_0x3860('0x3b')](_0x4c4314[_0x3860('0x2f')],_0x5a9af2[_0x3860('0x30')]),_0x3d5143);if(_0x4c4314['query'][_0x3860('0x3c')]){_0x1f1809[_0x3860('0x3a')]=_['merge'](_0x1f1809['where'],{'$or':_[_0x3860('0x29')](_0x3d5143,function(_0x148914){if(_0x148914[_0x3860('0x2d')]!==_0x3860('0x3d')){var _0x2b35b2={};_0x2b35b2[_0x148914['name']]={'$like':'%'+_0x4c4314[_0x3860('0x2f')]['filter']+'%'};return _0x2b35b2;}})});}_0x1f1809=_[_0x3860('0x3e')]({},_0x1f1809,_0x4c4314[_0x3860('0x3f')]);var _0x53d443={'where':_0x1f1809[_0x3860('0x3a')]};return db[_0x3860('0x2a')]['count'](_0x53d443)[_0x3860('0x23')](function(_0xc7d34d){_0x2551f4[_0x3860('0x1c')]=_0xc7d34d;if(_0x4c4314[_0x3860('0x2f')]['includeAll']){_0x1f1809[_0x3860('0x40')]=[{'all':!![]}];}return db[_0x3860('0x2a')][_0x3860('0x41')](_0x1f1809);})['then'](function(_0x3a87e5){_0x2551f4['rows']=_0x3a87e5;return _0x2551f4;})[_0x3860('0x23')](respondWithFilteredResult(_0x389bd0,_0x1f1809))[_0x3860('0x42')](handleError(_0x389bd0,null));};exports[_0x3860('0x43')]=function(_0x3f613f,_0x2220c8){var _0x3f4216={'raw':!![],'where':{'id':_0x3f613f[_0x3860('0x44')]['id']}},_0x4e0a44={};_0x4e0a44[_0x3860('0x33')]=_['keys'](db['WhatsappQueueReport'][_0x3860('0x2b')]);_0x4e0a44[_0x3860('0x2f')]=_['keys'](_0x3f613f[_0x3860('0x2f')]);_0x4e0a44[_0x3860('0x30')]=_['intersection'](_0x4e0a44[_0x3860('0x33')],_0x4e0a44[_0x3860('0x2f')]);_0x3f4216[_0x3860('0x32')]=_[_0x3860('0x31')](_0x4e0a44[_0x3860('0x33')],qs[_0x3860('0x34')](_0x3f613f[_0x3860('0x2f')][_0x3860('0x34')]));_0x3f4216[_0x3860('0x32')]=_0x3f4216[_0x3860('0x32')][_0x3860('0x35')]?_0x3f4216[_0x3860('0x32')]:_0x4e0a44[_0x3860('0x33')];if(_0x3f613f['query'][_0x3860('0x45')]){_0x3f4216['include']=[{'all':!![]}];}_0x3f4216=_[_0x3860('0x3e')]({},_0x3f4216,_0x3f613f[_0x3860('0x3f')]);return db[_0x3860('0x2a')][_0x3860('0x46')](_0x3f4216)[_0x3860('0x23')](handleEntityNotFound(_0x2220c8,null))[_0x3860('0x23')](respondWithResult(_0x2220c8,null))[_0x3860('0x42')](handleError(_0x2220c8,null));};exports[_0x3860('0x47')]=function(_0x5a91b2,_0x3cd575){return db[_0x3860('0x2a')][_0x3860('0x47')](_0x5a91b2['body'],{})[_0x3860('0x23')](respondWithResult(_0x3cd575,0xc9))[_0x3860('0x42')](handleError(_0x3cd575,null));};exports[_0x3860('0x22')]=function(_0x3dc957,_0x5ed2db){if(_0x3dc957['body']['id']){delete _0x3dc957[_0x3860('0x48')]['id'];}return db['WhatsappQueueReport'][_0x3860('0x46')]({'where':{'id':_0x3dc957[_0x3860('0x44')]['id']}})[_0x3860('0x23')](handleEntityNotFound(_0x5ed2db,null))['then'](saveUpdates(_0x3dc957[_0x3860('0x48')],null))['then'](respondWithResult(_0x5ed2db,null))[_0x3860('0x42')](handleError(_0x5ed2db,null));};exports['destroy']=function(_0xf9edb4,_0x25d22f){return db[_0x3860('0x2a')]['find']({'where':{'id':_0xf9edb4['params']['id']}})[_0x3860('0x23')](handleEntityNotFound(_0x25d22f,null))[_0x3860('0x23')](removeEntity(_0x25d22f,null))['catch'](handleError(_0x25d22f,null));};exports[_0x3860('0x49')]=function(_0x58237e,_0x3b3bfe){return db[_0x3860('0x2a')][_0x3860('0x49')]()[_0x3860('0x23')](respondWithResult(_0x3b3bfe,null))[_0x3860('0x42')](handleError(_0x3b3bfe,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index cef62aa..19ddc98 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 _0x3245=['bluebird','path','rimraf','../../config/environment','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','api'];(function(_0x42b990,_0x3aae6d){var _0x36c73a=function(_0x402886){while(--_0x402886){_0x42b990['push'](_0x42b990['shift']());}};_0x36c73a(++_0x3aae6d);}(_0x3245,0xbd));var _0x5324=function(_0x39929e,_0x5b9d76){_0x39929e=_0x39929e-0x0;var _0x2ced4b=_0x3245[_0x39929e];return _0x2ced4b;};'use strict';var _=require(_0x5324('0x0'));var util=require(_0x5324('0x1'));var logger=require('../../config/logger')(_0x5324('0x2'));var moment=require('moment');var BPromise=require(_0x5324('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5324('0x4'));var rimraf=require(_0x5324('0x5'));var config=require(_0x5324('0x6'));var attributes=require('./whatsappQueueReport.attributes');module[_0x5324('0x7')]=function(_0x16f4a8,_0x467132){return _0x16f4a8[_0x5324('0x8')](_0x5324('0x9'),attributes,{'tableName':_0x5324('0xa'),'paranoid':![],'indexes':[{'name':_0x5324('0xb'),'fields':[_0x5324('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa52c=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','uniqueid','lodash'];(function(_0x406e3c,_0x205e1f){var _0x54f4a1=function(_0x3b5d01){while(--_0x3b5d01){_0x406e3c['push'](_0x406e3c['shift']());}};_0x54f4a1(++_0x205e1f);}(_0xa52c,0x8e));var _0xca52=function(_0x44e5bc,_0x2a08dd){_0x44e5bc=_0x44e5bc-0x0;var _0x537677=_0xa52c[_0x44e5bc];return _0x537677;};'use strict';var _=require(_0xca52('0x0'));var util=require(_0xca52('0x1'));var logger=require(_0xca52('0x2'))('api');var moment=require(_0xca52('0x3'));var BPromise=require(_0xca52('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xca52('0x5'));var rimraf=require(_0xca52('0x6'));var config=require(_0xca52('0x7'));var attributes=require(_0xca52('0x8'));module[_0xca52('0x9')]=function(_0x4c54cc,_0x27b771){return _0x4c54cc[_0xca52('0xa')]('WhatsappQueueReport',attributes,{'tableName':_0xca52('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xca52('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index e1240e3..460974c 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 _0x37bc=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','raw','body','where','limit','UpdateWhatsappQueueReport'];(function(_0x119705,_0xba9427){var _0x2affc2=function(_0x16f7e2){while(--_0x16f7e2){_0x119705['push'](_0x119705['shift']());}};_0x2affc2(++_0xba9427);}(_0x37bc,0xf5));var _0xc37b=function(_0x3e225a,_0x41d9aa){_0x3e225a=_0x3e225a-0x0;var _0x1fe38f=_0x37bc[_0x3e225a];return _0x1fe38f;};'use strict';var _=require(_0xc37b('0x0'));var util=require(_0xc37b('0x1'));var moment=require(_0xc37b('0x2'));var BPromise=require(_0xc37b('0x3'));var rs=require(_0xc37b('0x4'));var fs=require('fs');var Redis=require(_0xc37b('0x5'));var db=require(_0xc37b('0x6'))['db'];var utils=require(_0xc37b('0x7'));var logger=require(_0xc37b('0x8'))(_0xc37b('0x9'));var config=require(_0xc37b('0xa'));var jayson=require(_0xc37b('0xb'));var client=jayson[_0xc37b('0xc')][_0xc37b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x174529,_0x5157e4,_0x51f2d6){return new BPromise(function(_0x319732,_0x43ea90){return client[_0xc37b('0xe')](_0x174529,_0x51f2d6)[_0xc37b('0xf')](function(_0x1065f9){logger[_0xc37b('0x10')](_0xc37b('0x11'),_0x5157e4,_0xc37b('0x12'));logger[_0xc37b('0x13')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x5157e4,_0xc37b('0x12'),JSON[_0xc37b('0x14')](_0x1065f9));if(_0x1065f9[_0xc37b('0x15')]){if(_0x1065f9[_0xc37b('0x15')][_0xc37b('0x16')]===0x1f4){logger[_0xc37b('0x15')](_0xc37b('0x11'),_0x5157e4,_0x1065f9[_0xc37b('0x15')][_0xc37b('0x17')]);return _0x43ea90(_0x1065f9[_0xc37b('0x15')][_0xc37b('0x17')]);}logger[_0xc37b('0x15')](_0xc37b('0x11'),_0x5157e4,_0x1065f9[_0xc37b('0x15')][_0xc37b('0x17')]);return _0x319732(_0x1065f9[_0xc37b('0x15')][_0xc37b('0x17')]);}else{logger[_0xc37b('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5157e4,_0xc37b('0x12'));_0x319732(_0x1065f9[_0xc37b('0x18')][_0xc37b('0x17')]);}})[_0xc37b('0x19')](function(_0x549823){logger[_0xc37b('0x15')](_0xc37b('0x11'),_0x5157e4,_0x549823);_0x43ea90(_0x549823);});});}exports[_0xc37b('0x1a')]=function(_0x3a3945){var _0x31fb11=this;return new Promise(function(_0x316956,_0x485669){return db[_0xc37b('0x1b')][_0xc37b('0x1c')](_0x3a3945['body'],{'raw':_0x3a3945[_0xc37b('0x1d')]?_0x3a3945[_0xc37b('0x1d')][_0xc37b('0x1e')]===undefined?!![]:![]:!![]})[_0xc37b('0xf')](function(_0x53bb27){logger[_0xc37b('0x10')](_0xc37b('0x1a'),_0x3a3945);logger['debug']('CreateWhatsappQueueReport',_0x3a3945,JSON[_0xc37b('0x14')](_0x53bb27));_0x316956(_0x53bb27);})[_0xc37b('0x19')](function(_0xecbbc6){logger[_0xc37b('0x15')](_0xc37b('0x1a'),_0xecbbc6[_0xc37b('0x17')],_0x3a3945);_0x485669(_0x31fb11[_0xc37b('0x15')](0x1f4,_0xecbbc6[_0xc37b('0x17')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x30e035){var _0x2812f8=this;return new Promise(function(_0xe5d04c,_0x1db6d6){return db[_0xc37b('0x1b')]['update'](_0x30e035[_0xc37b('0x1f')],{'raw':_0x30e035[_0xc37b('0x1d')]?_0x30e035['options'][_0xc37b('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30e035['options']?_0x30e035[_0xc37b('0x1d')][_0xc37b('0x20')]||null:null,'attributes':_0x30e035[_0xc37b('0x1d')]?_0x30e035['options']['attributes']||null:null,'limit':_0x30e035[_0xc37b('0x1d')]?_0x30e035['options'][_0xc37b('0x21')]||null:null})[_0xc37b('0xf')](function(_0x2eee68){logger['info'](_0xc37b('0x22'),_0x30e035);logger[_0xc37b('0x13')](_0xc37b('0x22'),_0x30e035,JSON[_0xc37b('0x14')](_0x2eee68));_0xe5d04c(_0x2eee68);})[_0xc37b('0x19')](function(_0x3c30b4){logger[_0xc37b('0x15')](_0xc37b('0x22'),_0x3c30b4[_0xc37b('0x17')],_0x30e035);_0x1db6d6(_0x2812f8[_0xc37b('0x15')](0x1f4,_0x3c30b4['message']));});});}; \ No newline at end of file +var _0xb238=['request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappQueueReport,\x20%s,\x20%s','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','debug','UpdateWhatsappQueueReport','update','body','raw','where','attributes','limit','util','moment','randomstring','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xb238,0x141));var _0x8b23=function(_0x53276c,_0x6a1efe){_0x53276c=_0x53276c-0x0;var _0x4b2bcb=_0xb238[_0x53276c];return _0x4b2bcb;};'use strict';var _=require('lodash');var util=require(_0x8b23('0x0'));var moment=require(_0x8b23('0x1'));var BPromise=require('bluebird');var rs=require(_0x8b23('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x8b23('0x3'));var jayson=require(_0x8b23('0x4'));var client=jayson['client'][_0x8b23('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x312cfa,_0x942664,_0x11e0d6){return new BPromise(function(_0x17a2fc,_0x11a868){return client[_0x8b23('0x6')](_0x312cfa,_0x11e0d6)[_0x8b23('0x7')](function(_0x1594b5){logger[_0x8b23('0x8')]('WhatsappQueueReport,\x20%s,\x20%s',_0x942664,_0x8b23('0x9'));logger['debug'](_0x8b23('0xa'),_0x942664,_0x8b23('0x9'),JSON[_0x8b23('0xb')](_0x1594b5));if(_0x1594b5['error']){if(_0x1594b5[_0x8b23('0xc')][_0x8b23('0xd')]===0x1f4){logger[_0x8b23('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0x942664,_0x1594b5[_0x8b23('0xc')][_0x8b23('0xe')]);return _0x11a868(_0x1594b5[_0x8b23('0xc')]['message']);}logger[_0x8b23('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0x942664,_0x1594b5[_0x8b23('0xc')]['message']);return _0x17a2fc(_0x1594b5[_0x8b23('0xc')][_0x8b23('0xe')]);}else{logger[_0x8b23('0x8')](_0x8b23('0xf'),_0x942664,'request\x20sent');_0x17a2fc(_0x1594b5[_0x8b23('0x10')][_0x8b23('0xe')]);}})[_0x8b23('0x11')](function(_0x3091ed){logger[_0x8b23('0xc')](_0x8b23('0xf'),_0x942664,_0x3091ed);_0x11a868(_0x3091ed);});});}exports[_0x8b23('0x12')]=function(_0x4cd561){var _0x47ee7f=this;return new Promise(function(_0x4ad2bc,_0x36a363){return db[_0x8b23('0x13')][_0x8b23('0x14')](_0x4cd561['body'],{'raw':_0x4cd561[_0x8b23('0x15')]?_0x4cd561[_0x8b23('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x8b23('0x7')](function(_0x570b71){logger[_0x8b23('0x8')](_0x8b23('0x12'),_0x4cd561);logger[_0x8b23('0x16')](_0x8b23('0x12'),_0x4cd561,JSON[_0x8b23('0xb')](_0x570b71));_0x4ad2bc(_0x570b71);})[_0x8b23('0x11')](function(_0x1d6f7b){logger[_0x8b23('0xc')]('CreateWhatsappQueueReport',_0x1d6f7b['message'],_0x4cd561);_0x36a363(_0x47ee7f[_0x8b23('0xc')](0x1f4,_0x1d6f7b[_0x8b23('0xe')]));});});};exports[_0x8b23('0x17')]=function(_0x5967bc){var _0x225e5c=this;return new Promise(function(_0x3328a4,_0x50b3ec){return db[_0x8b23('0x13')][_0x8b23('0x18')](_0x5967bc[_0x8b23('0x19')],{'raw':_0x5967bc[_0x8b23('0x15')]?_0x5967bc['options'][_0x8b23('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5967bc[_0x8b23('0x15')]?_0x5967bc[_0x8b23('0x15')][_0x8b23('0x1b')]||null:null,'attributes':_0x5967bc['options']?_0x5967bc[_0x8b23('0x15')][_0x8b23('0x1c')]||null:null,'limit':_0x5967bc[_0x8b23('0x15')]?_0x5967bc[_0x8b23('0x15')][_0x8b23('0x1d')]||null:null})['then'](function(_0x144661){logger[_0x8b23('0x8')]('UpdateWhatsappQueueReport',_0x5967bc);logger[_0x8b23('0x16')](_0x8b23('0x17'),_0x5967bc,JSON[_0x8b23('0xb')](_0x144661));_0x3328a4(_0x144661);})['catch'](function(_0x28b4f2){logger['error']('UpdateWhatsappQueueReport',_0x28b4f2[_0x8b23('0xe')],_0x5967bc);_0x50b3ec(_0x225e5c[_0x8b23('0xc')](0x1f4,_0x28b4f2[_0x8b23('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 4a76fd4..808fa11 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 _0xadef=['../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1717d7,_0x560994){var _0x3b3a98=function(_0x421a65){while(--_0x421a65){_0x1717d7['push'](_0x1717d7['shift']());}};_0x3b3a98(++_0x560994);}(_0xadef,0x1ed));var _0xfade=function(_0x107726,_0x4874bb){_0x107726=_0x107726-0x0;var _0x101b71=_0xadef[_0x107726];return _0x101b71;};'use strict';var multer=require(_0xfade('0x0'));var util=require(_0xfade('0x1'));var path=require('path');var timeout=require(_0xfade('0x2'));var express=require(_0xfade('0x3'));var router=express[_0xfade('0x4')]();var fs_extra=require(_0xfade('0x5'));var auth=require(_0xfade('0x6'));var interaction=require(_0xfade('0x7'));var config=require(_0xfade('0x8'));var controller=require(_0xfade('0x9'));router[_0xfade('0xa')]('/',auth[_0xfade('0xb')](),controller[_0xfade('0xc')]);router[_0xfade('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xfade('0xd')]);router['get'](_0xfade('0xe'),auth[_0xfade('0xb')](),controller[_0xfade('0xf')]);router[_0xfade('0x10')]('/',auth[_0xfade('0xb')](),controller[_0xfade('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xfade('0x12')](_0xfade('0xe'),auth[_0xfade('0xb')](),controller['destroy']);module[_0xfade('0x13')]=router; \ No newline at end of file +var _0x0669=['post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','index','/describe','isAuthenticated','describe','show'];(function(_0x127e05,_0x48fabd){var _0x4d6171=function(_0x39bab0){while(--_0x39bab0){_0x127e05['push'](_0x127e05['shift']());}};_0x4d6171(++_0x48fabd);}(_0x0669,0x1d3));var _0x9066=function(_0x4b6bee,_0x23f984){_0x4b6bee=_0x4b6bee-0x0;var _0x167259=_0x0669[_0x4b6bee];return _0x167259;};'use strict';var multer=require(_0x9066('0x0'));var util=require(_0x9066('0x1'));var path=require(_0x9066('0x2'));var timeout=require(_0x9066('0x3'));var express=require(_0x9066('0x4'));var router=express[_0x9066('0x5')]();var fs_extra=require(_0x9066('0x6'));var auth=require(_0x9066('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x9066('0x8'));var controller=require(_0x9066('0x9'));router[_0x9066('0xa')]('/',auth['isAuthenticated'](),controller[_0x9066('0xb')]);router[_0x9066('0xa')](_0x9066('0xc'),auth[_0x9066('0xd')](),controller[_0x9066('0xe')]);router['get']('/:id',auth[_0x9066('0xd')](),controller[_0x9066('0xf')]);router[_0x9066('0x10')]('/',auth[_0x9066('0xd')](),controller[_0x9066('0x11')]);router[_0x9066('0x12')](_0x9066('0x13'),auth[_0x9066('0xd')](),controller[_0x9066('0x14')]);router['delete'](_0x9066('0x13'),auth['isAuthenticated'](),controller[_0x9066('0x15')]);module[_0x9066('0x16')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index a18a74e..9ef2b49 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 _0xdef9=['ENUM','account','agent','queue','DATE','sequelize','exports','STRING'];(function(_0x3aa758,_0x98c545){var _0x1a43df=function(_0x2b6b7d){while(--_0x2b6b7d){_0x3aa758['push'](_0x3aa758['shift']());}};_0x1a43df(++_0x98c545);}(_0xdef9,0x1ed));var _0x9def=function(_0x1f5236,_0xea7afc){_0x1f5236=_0x1f5236-0x0;var _0x2efe18=_0xdef9[_0x1f5236];return _0x2efe18;};'use strict';var Sequelize=require(_0x9def('0x0'));module[_0x9def('0x1')]={'uniqueid':{'type':Sequelize[_0x9def('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9def('0x3')](_0x9def('0x4'),_0x9def('0x5'),_0x9def('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x9def('0x7')]}}; \ No newline at end of file +var _0x153c=['sequelize','exports','STRING','ENUM','agent','queue','DATE'];(function(_0x18683a,_0x3a2ad3){var _0x453284=function(_0x11920b){while(--_0x11920b){_0x18683a['push'](_0x18683a['shift']());}};_0x453284(++_0x3a2ad3);}(_0x153c,0x8c));var _0xc153=function(_0x323990,_0x458da9){_0x323990=_0x323990-0x0;var _0x1d563b=_0x153c[_0x323990];return _0x1d563b;};'use strict';var Sequelize=require(_0xc153('0x0'));module[_0xc153('0x1')]={'uniqueid':{'type':Sequelize[_0xc153('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc153('0x3')]('account',_0xc153('0x4'),_0xc153('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xc153('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index fbdcae4..6dffcdd 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 _0xfd49=['crypto','desk.js','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','undefined','limit','count','offset','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','map','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','WhatsappTransferReport','findAll','catch','show','params','rawAttributes','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xfd49,0x121));var _0x9fd4=function(_0x10c19d,_0x27d01e){_0x10c19d=_0x10c19d-0x0;var _0x313fe4=_0xfd49[_0x10c19d];return _0x313fe4;};'use strict';var emlformat=require(_0x9fd4('0x0'));var rimraf=require(_0x9fd4('0x1'));var zipdir=require(_0x9fd4('0x2'));var jsonpatch=require(_0x9fd4('0x3'));var rp=require(_0x9fd4('0x4'));var moment=require('moment');var BPromise=require(_0x9fd4('0x5'));var Mustache=require(_0x9fd4('0x6'));var util=require(_0x9fd4('0x7'));var path=require(_0x9fd4('0x8'));var sox=require(_0x9fd4('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9fd4('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9fd4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9fd4('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9fd4('0xd'));var Papa=require(_0x9fd4('0xe'));var Redis=require('ioredis');var authService=require(_0x9fd4('0xf'));var qs=require(_0x9fd4('0x10'));var as=require(_0x9fd4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9fd4('0x12'))(_0x9fd4('0x13'));var utils=require(_0x9fd4('0x14'));var config=require(_0x9fd4('0x15'));var licenseUtil=require(_0x9fd4('0x16'));var db=require(_0x9fd4('0x17'))['db'];function respondWithStatusCode(_0x338e09,_0x46e613){_0x46e613=_0x46e613||0xcc;return function(_0x3d3bef){if(_0x3d3bef){return _0x338e09['sendStatus'](_0x46e613);}return _0x338e09[_0x9fd4('0x18')](_0x46e613)[_0x9fd4('0x19')]();};}function respondWithResult(_0x2bdb31,_0x551601){_0x551601=_0x551601||0xc8;return function(_0x3ef064){if(_0x3ef064){return _0x2bdb31[_0x9fd4('0x18')](_0x551601)[_0x9fd4('0x1a')](_0x3ef064);}};}function respondWithFilteredResult(_0x1b92af,_0x2ae467){return function(_0x54efaa){if(_0x54efaa){var _0x59143e=typeof _0x2ae467['offset']===_0x9fd4('0x1b')&&typeof _0x2ae467[_0x9fd4('0x1c')]===_0x9fd4('0x1b');var _0x291cb1=_0x54efaa[_0x9fd4('0x1d')];var _0x2e55cc=_0x59143e?0x0:_0x2ae467[_0x9fd4('0x1e')];var _0x4600e7=_0x59143e?_0x54efaa['count']:_0x2ae467[_0x9fd4('0x1e')]+_0x2ae467[_0x9fd4('0x1c')];var _0xfbf5a5;if(_0x4600e7>=_0x291cb1){_0x4600e7=_0x291cb1;_0xfbf5a5=0xc8;}else{_0xfbf5a5=0xce;}_0x1b92af[_0x9fd4('0x18')](_0xfbf5a5);return _0x1b92af[_0x9fd4('0x1f')](_0x9fd4('0x20'),_0x2e55cc+'-'+_0x4600e7+'/'+_0x291cb1)[_0x9fd4('0x1a')](_0x54efaa);}return null;};}function patchUpdates(_0x4e1498){return function(_0x22851f){try{jsonpatch[_0x9fd4('0x21')](_0x22851f,_0x4e1498,!![]);}catch(_0xc72c7b){return BPromise[_0x9fd4('0x22')](_0xc72c7b);}return _0x22851f['save']();};}function saveUpdates(_0x18c402,_0x907f07){return function(_0x2a44dc){if(_0x2a44dc){return _0x2a44dc[_0x9fd4('0x23')](_0x18c402)['then'](function(_0x3066f1){return _0x3066f1;});}return null;};}function removeEntity(_0x4d18da,_0xd948d2){return function(_0x415550){if(_0x415550){return _0x415550[_0x9fd4('0x24')]()[_0x9fd4('0x25')](function(){_0x4d18da['status'](0xcc)[_0x9fd4('0x19')]();});}};}function handleEntityNotFound(_0x341dd6,_0x1e89a6){return function(_0x4cd3a6){if(!_0x4cd3a6){_0x341dd6['sendStatus'](0x194);}return _0x4cd3a6;};}function handleError(_0x5da55f,_0x43b5ad){_0x43b5ad=_0x43b5ad||0x1f4;return function(_0x2f6682){logger[_0x9fd4('0x26')](_0x2f6682[_0x9fd4('0x27')]);if(_0x2f6682[_0x9fd4('0x28')]){delete _0x2f6682[_0x9fd4('0x28')];}_0x5da55f['status'](_0x43b5ad)[_0x9fd4('0x29')](_0x2f6682);};}exports['index']=function(_0x30e4a6,_0x1d621a){var _0x3d4b40={},_0x50fed9={},_0x3fef71={'count':0x0,'rows':[]};var _0x8cf39e=_[_0x9fd4('0x2a')](db['WhatsappTransferReport']['rawAttributes'],function(_0x26b659){return{'name':_0x26b659[_0x9fd4('0x2b')],'type':_0x26b659[_0x9fd4('0x2c')][_0x9fd4('0x2d')]};});_0x50fed9['model']=_['map'](_0x8cf39e,_0x9fd4('0x28'));_0x50fed9[_0x9fd4('0x2e')]=_[_0x9fd4('0x2f')](_0x30e4a6[_0x9fd4('0x2e')]);_0x50fed9[_0x9fd4('0x30')]=_['intersection'](_0x50fed9['model'],_0x50fed9[_0x9fd4('0x2e')]);_0x3d4b40['attributes']=_[_0x9fd4('0x31')](_0x50fed9[_0x9fd4('0x32')],qs['fields'](_0x30e4a6[_0x9fd4('0x2e')][_0x9fd4('0x33')]));_0x3d4b40['attributes']=_0x3d4b40[_0x9fd4('0x34')]['length']?_0x3d4b40[_0x9fd4('0x34')]:_0x50fed9[_0x9fd4('0x32')];if(!_0x30e4a6[_0x9fd4('0x2e')][_0x9fd4('0x35')](_0x9fd4('0x36'))){_0x3d4b40[_0x9fd4('0x1c')]=qs[_0x9fd4('0x1c')](_0x30e4a6[_0x9fd4('0x2e')]['limit']);_0x3d4b40[_0x9fd4('0x1e')]=qs['offset'](_0x30e4a6['query'][_0x9fd4('0x1e')]);}_0x3d4b40[_0x9fd4('0x37')]=qs['sort'](_0x30e4a6['query'][_0x9fd4('0x38')]);_0x3d4b40['where']=qs['filters'](_[_0x9fd4('0x39')](_0x30e4a6['query'],_0x50fed9[_0x9fd4('0x30')]),_0x8cf39e);if(_0x30e4a6['query'][_0x9fd4('0x3a')]){_0x3d4b40['where']=_['merge'](_0x3d4b40[_0x9fd4('0x3b')],{'$or':_[_0x9fd4('0x2a')](_0x8cf39e,function(_0x4f0218){if(_0x4f0218[_0x9fd4('0x2c')]!=='VIRTUAL'){var _0x137dd8={};_0x137dd8[_0x4f0218['name']]={'$like':'%'+_0x30e4a6[_0x9fd4('0x2e')][_0x9fd4('0x3a')]+'%'};return _0x137dd8;}})});}_0x3d4b40=_[_0x9fd4('0x3c')]({},_0x3d4b40,_0x30e4a6[_0x9fd4('0x3d')]);var _0x46b5a9={'where':_0x3d4b40['where']};return db['WhatsappTransferReport'][_0x9fd4('0x1d')](_0x46b5a9)[_0x9fd4('0x25')](function(_0x1ba66d){_0x3fef71[_0x9fd4('0x1d')]=_0x1ba66d;if(_0x30e4a6['query'][_0x9fd4('0x3e')]){_0x3d4b40[_0x9fd4('0x3f')]=[{'all':!![]}];}return db[_0x9fd4('0x40')][_0x9fd4('0x41')](_0x3d4b40);})[_0x9fd4('0x25')](function(_0x25ad34){_0x3fef71['rows']=_0x25ad34;return _0x3fef71;})[_0x9fd4('0x25')](respondWithFilteredResult(_0x1d621a,_0x3d4b40))[_0x9fd4('0x42')](handleError(_0x1d621a,null));};exports[_0x9fd4('0x43')]=function(_0x5d05d7,_0x4056e9){var _0x4a6b6e={'raw':!![],'where':{'id':_0x5d05d7[_0x9fd4('0x44')]['id']}},_0x19dd5a={};_0x19dd5a['model']=_['keys'](db[_0x9fd4('0x40')][_0x9fd4('0x45')]);_0x19dd5a[_0x9fd4('0x2e')]=_['keys'](_0x5d05d7[_0x9fd4('0x2e')]);_0x19dd5a[_0x9fd4('0x30')]=_['intersection'](_0x19dd5a[_0x9fd4('0x32')],_0x19dd5a['query']);_0x4a6b6e[_0x9fd4('0x34')]=_[_0x9fd4('0x31')](_0x19dd5a['model'],qs[_0x9fd4('0x33')](_0x5d05d7[_0x9fd4('0x2e')][_0x9fd4('0x33')]));_0x4a6b6e[_0x9fd4('0x34')]=_0x4a6b6e[_0x9fd4('0x34')][_0x9fd4('0x46')]?_0x4a6b6e['attributes']:_0x19dd5a['model'];if(_0x5d05d7['query'][_0x9fd4('0x3e')]){_0x4a6b6e[_0x9fd4('0x3f')]=[{'all':!![]}];}_0x4a6b6e=_[_0x9fd4('0x3c')]({},_0x4a6b6e,_0x5d05d7[_0x9fd4('0x3d')]);return db[_0x9fd4('0x40')][_0x9fd4('0x47')](_0x4a6b6e)[_0x9fd4('0x25')](handleEntityNotFound(_0x4056e9,null))[_0x9fd4('0x25')](respondWithResult(_0x4056e9,null))[_0x9fd4('0x42')](handleError(_0x4056e9,null));};exports['create']=function(_0x5ca70b,_0x5d2cc1){return db[_0x9fd4('0x40')][_0x9fd4('0x48')](_0x5ca70b['body'],{})[_0x9fd4('0x25')](respondWithResult(_0x5d2cc1,0xc9))[_0x9fd4('0x42')](handleError(_0x5d2cc1,null));};exports[_0x9fd4('0x23')]=function(_0x4fdfea,_0x57c527){if(_0x4fdfea[_0x9fd4('0x49')]['id']){delete _0x4fdfea[_0x9fd4('0x49')]['id'];}return db[_0x9fd4('0x40')]['find']({'where':{'id':_0x4fdfea[_0x9fd4('0x44')]['id']}})[_0x9fd4('0x25')](handleEntityNotFound(_0x57c527,null))[_0x9fd4('0x25')](saveUpdates(_0x4fdfea[_0x9fd4('0x49')],null))[_0x9fd4('0x25')](respondWithResult(_0x57c527,null))[_0x9fd4('0x42')](handleError(_0x57c527,null));};exports[_0x9fd4('0x24')]=function(_0x4c26d6,_0x493d07){return db['WhatsappTransferReport'][_0x9fd4('0x47')]({'where':{'id':_0x4c26d6['params']['id']}})[_0x9fd4('0x25')](handleEntityNotFound(_0x493d07,null))[_0x9fd4('0x25')](removeEntity(_0x493d07,null))[_0x9fd4('0x42')](handleError(_0x493d07,null));};exports[_0x9fd4('0x4a')]=function(_0x12df65,_0x40d34c){return db[_0x9fd4('0x40')][_0x9fd4('0x4a')]()[_0x9fd4('0x25')](respondWithResult(_0x40d34c,null))[_0x9fd4('0x42')](handleError(_0x40d34c,null));}; \ No newline at end of file +var _0xf19d=['error','stack','name','send','index','map','WhatsappTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','update','body','params','describe','eml-format','zip-dir','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','then','destroy'];(function(_0x54e856,_0x313d5c){var _0x124873=function(_0x48547e){while(--_0x48547e){_0x54e856['push'](_0x54e856['shift']());}};_0x124873(++_0x313d5c);}(_0xf19d,0x110));var _0xdf19=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xf19d[_0x2b5eae];return _0x5f3ac9;};'use strict';var emlformat=require(_0xdf19('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdf19('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdf19('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdf19('0x3'));var path=require(_0xdf19('0x4'));var sox=require(_0xdf19('0x5'));var csv=require(_0xdf19('0x6'));var ejs=require(_0xdf19('0x7'));var fs=require('fs');var fs_extra=require(_0xdf19('0x8'));var _=require(_0xdf19('0x9'));var squel=require(_0xdf19('0xa'));var crypto=require(_0xdf19('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xdf19('0xc'));var toCsv=require(_0xdf19('0x6'));var querystring=require(_0xdf19('0xd'));var Papa=require(_0xdf19('0xe'));var Redis=require(_0xdf19('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xdf19('0x10'));var as=require(_0xdf19('0x11'));var hardwareService=require(_0xdf19('0x12'));var logger=require(_0xdf19('0x13'))(_0xdf19('0x14'));var utils=require('../../config/utils');var config=require(_0xdf19('0x15'));var licenseUtil=require(_0xdf19('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44cfd7,_0x5fcad0){_0x5fcad0=_0x5fcad0||0xcc;return function(_0x222dc4){if(_0x222dc4){return _0x44cfd7[_0xdf19('0x17')](_0x5fcad0);}return _0x44cfd7[_0xdf19('0x18')](_0x5fcad0)[_0xdf19('0x19')]();};}function respondWithResult(_0x22a340,_0x4a142f){_0x4a142f=_0x4a142f||0xc8;return function(_0x3dcd97){if(_0x3dcd97){return _0x22a340['status'](_0x4a142f)[_0xdf19('0x1a')](_0x3dcd97);}};}function respondWithFilteredResult(_0x150fcf,_0x121a9d){return function(_0x3b7050){if(_0x3b7050){var _0x260207=typeof _0x121a9d['offset']==='undefined'&&typeof _0x121a9d[_0xdf19('0x1b')]===_0xdf19('0x1c');var _0x2744bd=_0x3b7050[_0xdf19('0x1d')];var _0x54ab10=_0x260207?0x0:_0x121a9d['offset'];var _0x203b7b=_0x260207?_0x3b7050[_0xdf19('0x1d')]:_0x121a9d[_0xdf19('0x1e')]+_0x121a9d[_0xdf19('0x1b')];var _0x4264a4;if(_0x203b7b>=_0x2744bd){_0x203b7b=_0x2744bd;_0x4264a4=0xc8;}else{_0x4264a4=0xce;}_0x150fcf['status'](_0x4264a4);return _0x150fcf['set'](_0xdf19('0x1f'),_0x54ab10+'-'+_0x203b7b+'/'+_0x2744bd)[_0xdf19('0x1a')](_0x3b7050);}return null;};}function patchUpdates(_0x2d5957){return function(_0x6592ca){try{jsonpatch[_0xdf19('0x20')](_0x6592ca,_0x2d5957,!![]);}catch(_0x13eb5a){return BPromise[_0xdf19('0x21')](_0x13eb5a);}return _0x6592ca['save']();};}function saveUpdates(_0x28ee9b,_0x1fbad4){return function(_0x111b54){if(_0x111b54){return _0x111b54['update'](_0x28ee9b)[_0xdf19('0x22')](function(_0x889517){return _0x889517;});}return null;};}function removeEntity(_0x2f8203,_0x16d30c){return function(_0xb9f429){if(_0xb9f429){return _0xb9f429[_0xdf19('0x23')]()[_0xdf19('0x22')](function(){_0x2f8203[_0xdf19('0x18')](0xcc)[_0xdf19('0x19')]();});}};}function handleEntityNotFound(_0x210ae,_0xe533a2){return function(_0xccf53f){if(!_0xccf53f){_0x210ae['sendStatus'](0x194);}return _0xccf53f;};}function handleError(_0x2a326,_0x3d552d){_0x3d552d=_0x3d552d||0x1f4;return function(_0x16860f){logger[_0xdf19('0x24')](_0x16860f[_0xdf19('0x25')]);if(_0x16860f[_0xdf19('0x26')]){delete _0x16860f['name'];}_0x2a326[_0xdf19('0x18')](_0x3d552d)[_0xdf19('0x27')](_0x16860f);};}exports[_0xdf19('0x28')]=function(_0x2810de,_0xd2f46f){var _0x18c6c5={},_0x2fa6ab={},_0x54ca3c={'count':0x0,'rows':[]};var _0x5052f0=_[_0xdf19('0x29')](db[_0xdf19('0x2a')]['rawAttributes'],function(_0x396a40){return{'name':_0x396a40[_0xdf19('0x2b')],'type':_0x396a40[_0xdf19('0x2c')][_0xdf19('0x2d')]};});_0x2fa6ab[_0xdf19('0x2e')]=_[_0xdf19('0x29')](_0x5052f0,_0xdf19('0x26'));_0x2fa6ab[_0xdf19('0x2f')]=_[_0xdf19('0x30')](_0x2810de[_0xdf19('0x2f')]);_0x2fa6ab[_0xdf19('0x31')]=_[_0xdf19('0x32')](_0x2fa6ab['model'],_0x2fa6ab[_0xdf19('0x2f')]);_0x18c6c5[_0xdf19('0x33')]=_['intersection'](_0x2fa6ab['model'],qs[_0xdf19('0x34')](_0x2810de['query'][_0xdf19('0x34')]));_0x18c6c5[_0xdf19('0x33')]=_0x18c6c5['attributes'][_0xdf19('0x35')]?_0x18c6c5[_0xdf19('0x33')]:_0x2fa6ab[_0xdf19('0x2e')];if(!_0x2810de[_0xdf19('0x2f')][_0xdf19('0x36')](_0xdf19('0x37'))){_0x18c6c5[_0xdf19('0x1b')]=qs['limit'](_0x2810de[_0xdf19('0x2f')][_0xdf19('0x1b')]);_0x18c6c5['offset']=qs[_0xdf19('0x1e')](_0x2810de['query'][_0xdf19('0x1e')]);}_0x18c6c5[_0xdf19('0x38')]=qs[_0xdf19('0x39')](_0x2810de['query']['sort']);_0x18c6c5[_0xdf19('0x3a')]=qs['filters'](_[_0xdf19('0x3b')](_0x2810de[_0xdf19('0x2f')],_0x2fa6ab[_0xdf19('0x31')]),_0x5052f0);if(_0x2810de['query']['filter']){_0x18c6c5[_0xdf19('0x3a')]=_['merge'](_0x18c6c5[_0xdf19('0x3a')],{'$or':_[_0xdf19('0x29')](_0x5052f0,function(_0x195e6e){if(_0x195e6e[_0xdf19('0x2c')]!==_0xdf19('0x3c')){var _0x1ebd55={};_0x1ebd55[_0x195e6e[_0xdf19('0x26')]]={'$like':'%'+_0x2810de[_0xdf19('0x2f')][_0xdf19('0x3d')]+'%'};return _0x1ebd55;}})});}_0x18c6c5=_[_0xdf19('0x3e')]({},_0x18c6c5,_0x2810de[_0xdf19('0x3f')]);var _0x4bd628={'where':_0x18c6c5['where']};return db[_0xdf19('0x2a')][_0xdf19('0x1d')](_0x4bd628)[_0xdf19('0x22')](function(_0x599479){_0x54ca3c[_0xdf19('0x1d')]=_0x599479;if(_0x2810de['query'][_0xdf19('0x40')]){_0x18c6c5[_0xdf19('0x41')]=[{'all':!![]}];}return db[_0xdf19('0x2a')][_0xdf19('0x42')](_0x18c6c5);})[_0xdf19('0x22')](function(_0x46bb7b){_0x54ca3c[_0xdf19('0x43')]=_0x46bb7b;return _0x54ca3c;})['then'](respondWithFilteredResult(_0xd2f46f,_0x18c6c5))[_0xdf19('0x44')](handleError(_0xd2f46f,null));};exports[_0xdf19('0x45')]=function(_0x1c2bdc,_0x4e196f){var _0x20d6ce={'raw':!![],'where':{'id':_0x1c2bdc['params']['id']}},_0x126e7d={};_0x126e7d['model']=_[_0xdf19('0x30')](db[_0xdf19('0x2a')][_0xdf19('0x46')]);_0x126e7d[_0xdf19('0x2f')]=_[_0xdf19('0x30')](_0x1c2bdc[_0xdf19('0x2f')]);_0x126e7d[_0xdf19('0x31')]=_[_0xdf19('0x32')](_0x126e7d[_0xdf19('0x2e')],_0x126e7d[_0xdf19('0x2f')]);_0x20d6ce['attributes']=_[_0xdf19('0x32')](_0x126e7d[_0xdf19('0x2e')],qs[_0xdf19('0x34')](_0x1c2bdc[_0xdf19('0x2f')][_0xdf19('0x34')]));_0x20d6ce['attributes']=_0x20d6ce[_0xdf19('0x33')][_0xdf19('0x35')]?_0x20d6ce[_0xdf19('0x33')]:_0x126e7d[_0xdf19('0x2e')];if(_0x1c2bdc[_0xdf19('0x2f')]['includeAll']){_0x20d6ce[_0xdf19('0x41')]=[{'all':!![]}];}_0x20d6ce=_[_0xdf19('0x3e')]({},_0x20d6ce,_0x1c2bdc[_0xdf19('0x3f')]);return db[_0xdf19('0x2a')][_0xdf19('0x47')](_0x20d6ce)[_0xdf19('0x22')](handleEntityNotFound(_0x4e196f,null))[_0xdf19('0x22')](respondWithResult(_0x4e196f,null))[_0xdf19('0x44')](handleError(_0x4e196f,null));};exports['create']=function(_0x3bdbfa,_0x56e038){return db['WhatsappTransferReport'][_0xdf19('0x48')](_0x3bdbfa['body'],{})['then'](respondWithResult(_0x56e038,0xc9))['catch'](handleError(_0x56e038,null));};exports[_0xdf19('0x49')]=function(_0x26d653,_0x548419){if(_0x26d653[_0xdf19('0x4a')]['id']){delete _0x26d653[_0xdf19('0x4a')]['id'];}return db[_0xdf19('0x2a')][_0xdf19('0x47')]({'where':{'id':_0x26d653[_0xdf19('0x4b')]['id']}})['then'](handleEntityNotFound(_0x548419,null))['then'](saveUpdates(_0x26d653[_0xdf19('0x4a')],null))['then'](respondWithResult(_0x548419,null))[_0xdf19('0x44')](handleError(_0x548419,null));};exports[_0xdf19('0x23')]=function(_0x45f7f7,_0x3263ee){return db[_0xdf19('0x2a')]['find']({'where':{'id':_0x45f7f7[_0xdf19('0x4b')]['id']}})[_0xdf19('0x22')](handleEntityNotFound(_0x3263ee,null))[_0xdf19('0x22')](removeEntity(_0x3263ee,null))['catch'](handleError(_0x3263ee,null));};exports[_0xdf19('0x4c')]=function(_0x20833a,_0x39225f){return db[_0xdf19('0x2a')][_0xdf19('0x4c')]()[_0xdf19('0x22')](respondWithResult(_0x39225f,null))[_0xdf19('0x44')](handleError(_0x39225f,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index cad9fe0..c69e30e 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 _0xfe97=['path','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','api','bluebird','request-promise'];(function(_0x5751e6,_0x125e5e){var _0x4199e4=function(_0x559843){while(--_0x559843){_0x5751e6['push'](_0x5751e6['shift']());}};_0x4199e4(++_0x125e5e);}(_0xfe97,0x10e));var _0x7fe9=function(_0x1e3450,_0x33e786){_0x1e3450=_0x1e3450-0x0;var _0x186346=_0xfe97[_0x1e3450];return _0x186346;};'use strict';var _=require(_0x7fe9('0x0'));var util=require(_0x7fe9('0x1'));var logger=require('../../config/logger')(_0x7fe9('0x2'));var moment=require('moment');var BPromise=require(_0x7fe9('0x3'));var rp=require(_0x7fe9('0x4'));var fs=require('fs');var path=require(_0x7fe9('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappTransferReport.attributes');module[_0x7fe9('0x6')]=function(_0x4534aa,_0x75c2ac){return _0x4534aa[_0x7fe9('0x7')](_0x7fe9('0x8'),attributes,{'tableName':_0x7fe9('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7fe9('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf956=['../../config/logger','api','bluebird','path','rimraf','define','report_whatsapp_transfer','uniqueid','lodash','util'];(function(_0x23783d,_0x101337){var _0x3d95bf=function(_0x190471){while(--_0x190471){_0x23783d['push'](_0x23783d['shift']());}};_0x3d95bf(++_0x101337);}(_0xf956,0xda));var _0x6f95=function(_0x496221,_0xe39993){_0x496221=_0x496221-0x0;var _0x5b0642=_0xf956[_0x496221];return _0x5b0642;};'use strict';var _=require(_0x6f95('0x0'));var util=require(_0x6f95('0x1'));var logger=require(_0x6f95('0x2'))(_0x6f95('0x3'));var moment=require('moment');var BPromise=require(_0x6f95('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f95('0x5'));var rimraf=require(_0x6f95('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappTransferReport.attributes');module['exports']=function(_0x562ffa,_0xb2889c){return _0x562ffa[_0x6f95('0x7')]('WhatsappTransferReport',attributes,{'tableName':_0x6f95('0x8'),'paranoid':![],'indexes':[{'name':_0x6f95('0x9'),'fields':[_0x6f95('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index c2666f9..5bdb5bd 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 _0x6f2b=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x125bd0,_0x163a59){var _0x45988f=function(_0x183f93){while(--_0x183f93){_0x125bd0['push'](_0x125bd0['shift']());}};_0x45988f(++_0x163a59);}(_0x6f2b,0x1de));var _0xb6f2=function(_0xf59ef4,_0x5822d0){_0xf59ef4=_0xf59ef4-0x0;var _0x60a01e=_0x6f2b[_0xf59ef4];return _0x60a01e;};'use strict';var _=require(_0xb6f2('0x0'));var util=require(_0xb6f2('0x1'));var moment=require(_0xb6f2('0x2'));var BPromise=require(_0xb6f2('0x3'));var rs=require(_0xb6f2('0x4'));var fs=require('fs');var Redis=require(_0xb6f2('0x5'));var db=require(_0xb6f2('0x6'))['db'];var utils=require(_0xb6f2('0x7'));var logger=require(_0xb6f2('0x8'))(_0xb6f2('0x9'));var config=require('../../config/environment');var jayson=require(_0xb6f2('0xa'));var client=jayson[_0xb6f2('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43621b,_0x590e39,_0x46fc8e){return new BPromise(function(_0x3ba807,_0x568ee2){return client[_0xb6f2('0xc')](_0x43621b,_0x46fc8e)[_0xb6f2('0xd')](function(_0x3d40fb){logger[_0xb6f2('0xe')]('WhatsappTransferReport,\x20%s,\x20%s',_0x590e39,'request\x20sent');logger['debug'](_0xb6f2('0xf'),_0x590e39,_0xb6f2('0x10'),JSON[_0xb6f2('0x11')](_0x3d40fb));if(_0x3d40fb[_0xb6f2('0x12')]){if(_0x3d40fb[_0xb6f2('0x12')][_0xb6f2('0x13')]===0x1f4){logger['error'](_0xb6f2('0x14'),_0x590e39,_0x3d40fb[_0xb6f2('0x12')][_0xb6f2('0x15')]);return _0x568ee2(_0x3d40fb[_0xb6f2('0x12')]['message']);}logger[_0xb6f2('0x12')](_0xb6f2('0x14'),_0x590e39,_0x3d40fb[_0xb6f2('0x12')][_0xb6f2('0x15')]);return _0x3ba807(_0x3d40fb['error'][_0xb6f2('0x15')]);}else{logger[_0xb6f2('0xe')]('WhatsappTransferReport,\x20%s,\x20%s',_0x590e39,_0xb6f2('0x10'));_0x3ba807(_0x3d40fb['result']['message']);}})[_0xb6f2('0x16')](function(_0x179dce){logger[_0xb6f2('0x12')](_0xb6f2('0x14'),_0x590e39,_0x179dce);_0x568ee2(_0x179dce);});});} \ No newline at end of file +var _0x7bd0=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7bd0,0x111));var _0x07bd=function(_0x119280,_0x439c3e){_0x119280=_0x119280-0x0;var _0x481797=_0x7bd0[_0x119280];return _0x481797;};'use strict';var _=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var moment=require(_0x07bd('0x2'));var BPromise=require(_0x07bd('0x3'));var rs=require(_0x07bd('0x4'));var fs=require('fs');var Redis=require(_0x07bd('0x5'));var db=require(_0x07bd('0x6'))['db'];var utils=require(_0x07bd('0x7'));var logger=require('../../config/logger')(_0x07bd('0x8'));var config=require(_0x07bd('0x9'));var jayson=require(_0x07bd('0xa'));var client=jayson[_0x07bd('0xb')][_0x07bd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x422a22,_0x2e4cd1,_0x5a939d){return new BPromise(function(_0x3968d9,_0x5cd446){return client[_0x07bd('0xd')](_0x422a22,_0x5a939d)[_0x07bd('0xe')](function(_0x323724){logger['info'](_0x07bd('0xf'),_0x2e4cd1,_0x07bd('0x10'));logger[_0x07bd('0x11')](_0x07bd('0x12'),_0x2e4cd1,'request\x20sent',JSON[_0x07bd('0x13')](_0x323724));if(_0x323724[_0x07bd('0x14')]){if(_0x323724[_0x07bd('0x14')][_0x07bd('0x15')]===0x1f4){logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);return _0x5cd446(_0x323724['error']['message']);}logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);return _0x3968d9(_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);}else{logger[_0x07bd('0x17')]('WhatsappTransferReport,\x20%s,\x20%s',_0x2e4cd1,_0x07bd('0x10'));_0x3968d9(_0x323724['result'][_0x07bd('0x16')]);}})[_0x07bd('0x18')](function(_0x31655a){logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x31655a);_0x5cd446(_0x31655a);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 01a6ade..4093144 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x27ae=['./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','start','info','map','filter','online','name','join','Offline\x20apps:','None','seedDB','default','./config/license','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2/config'];(function(_0x2f4cbf,_0x206d43){var _0x184315=function(_0x594e0a){while(--_0x594e0a){_0x2f4cbf['push'](_0x2f4cbf['shift']());}};_0x184315(++_0x206d43);}(_0x27ae,0xa7));var _0xe27a=function(_0x4f93a9,_0x2793c3){_0x4f93a9=_0x4f93a9-0x0;var _0x8fab33=_0x27ae[_0x4f93a9];return _0x8fab33;};'use strict';var _=require(_0xe27a('0x0'));var mysqldb=require(_0xe27a('0x1'));var rpc=require(_0xe27a('0x2'));var config=require(_0xe27a('0x3'));var logger=require(_0xe27a('0x4'))(_0xe27a('0x5'));var pm2=require('./config/pm2');var pm2Config=require(_0xe27a('0x6'));var schedule=require(_0xe27a('0x7'));var chat=require('./config/schedule/chat');var whatsapp=require(_0xe27a('0x8'));var transcribe=require(_0xe27a('0x9'));var provider=require(_0xe27a('0xa'));function main(){return mysqldb['db'][_0xe27a('0xb')][_0xe27a('0xc')]()['then'](function(){return rpc['listen']();})[_0xe27a('0xd')](function(_0x3be723){logger['info'](_0x3be723);return chat[_0xe27a('0xe')]();})[_0xe27a('0xd')](function(){return whatsapp[_0xe27a('0xe')]();})[_0xe27a('0xd')](function(){return schedule[_0xe27a('0xe')]();})[_0xe27a('0xd')](function(){return transcribe[_0xe27a('0xe')]();})[_0xe27a('0xd')](function(){return provider[_0xe27a('0xe')]();})[_0xe27a('0xd')](function(_0x2902e8){logger[_0xe27a('0xf')](_0x2902e8);return pm2[_0xe27a('0xe')](pm2Config);})['then'](function(_0x50eeb8){logger[_0xe27a('0xf')]('Online\x20apps:',_[_0xe27a('0x10')](_[_0xe27a('0x11')](_0x50eeb8,{'status':_0xe27a('0x12')}),_0xe27a('0x13'))[_0xe27a('0x14')]());logger[_0xe27a('0xf')](_0xe27a('0x15'),_['map'](_[_0xe27a('0x11')](_0x50eeb8,function(_0xa5ef11){return _0xa5ef11['status']!==_0xe27a('0x12');}),_0xe27a('0x13'))[_0xe27a('0x14')]()||_0xe27a('0x16'));config[_0xe27a('0x17')]&&require('./config/seedDB')[_0xe27a('0x18')]();require(_0xe27a('0x19'))[_0xe27a('0x18')]();})[_0xe27a('0x1a')](function(_0x64c48e){logger['error'](_0xe27a('0x1b'),_0x64c48e);process[_0xe27a('0x1c')](0x1);});}main(); \ No newline at end of file +var _0x1346=['./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','start','info','Online\x20apps:','map','filter','online','name','join','None','./config/seedDB','./config/license','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp'];(function(_0x5d9412,_0x349a10){var _0x4e2730=function(_0x598c88){while(--_0x598c88){_0x5d9412['push'](_0x5d9412['shift']());}};_0x4e2730(++_0x349a10);}(_0x1346,0x7e));var _0x6134=function(_0x47450b,_0x4c1fbe){_0x47450b=_0x47450b-0x0;var _0x1e4c4d=_0x1346[_0x47450b];return _0x1e4c4d;};'use strict';var _=require(_0x6134('0x0'));var mysqldb=require(_0x6134('0x1'));var rpc=require('./rpc');var config=require(_0x6134('0x2'));var logger=require(_0x6134('0x3'))(_0x6134('0x4'));var pm2=require(_0x6134('0x5'));var pm2Config=require(_0x6134('0x6'));var schedule=require(_0x6134('0x7'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x6134('0x8'));var transcribe=require(_0x6134('0x9'));var provider=require(_0x6134('0xa'));function main(){return mysqldb['db'][_0x6134('0xb')][_0x6134('0xc')]()[_0x6134('0xd')](function(){return rpc['listen']();})[_0x6134('0xd')](function(_0x349a00){logger['info'](_0x349a00);return chat['start']();})[_0x6134('0xd')](function(){return whatsapp[_0x6134('0xe')]();})['then'](function(){return schedule[_0x6134('0xe')]();})['then'](function(){return transcribe['start']();})[_0x6134('0xd')](function(){return provider[_0x6134('0xe')]();})[_0x6134('0xd')](function(_0x503864){logger[_0x6134('0xf')](_0x503864);return pm2[_0x6134('0xe')](pm2Config);})[_0x6134('0xd')](function(_0x3f92ce){logger[_0x6134('0xf')](_0x6134('0x10'),_[_0x6134('0x11')](_[_0x6134('0x12')](_0x3f92ce,{'status':_0x6134('0x13')}),_0x6134('0x14'))[_0x6134('0x15')]());logger['info']('Offline\x20apps:',_[_0x6134('0x11')](_['filter'](_0x3f92ce,function(_0x525211){return _0x525211['status']!==_0x6134('0x13');}),'name')['join']()||_0x6134('0x16'));config['seedDB']&&require(_0x6134('0x17'))['default']();require(_0x6134('0x18'))['default']();})[_0x6134('0x19')](function(_0x4e1c1a){logger['error'](_0x6134('0x1a'),_0x4e1c1a);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 7d4edf8..3e2f813 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 _0xd1bb=['smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','selectRecallMeCampaign','isChatInteractionAuthorized','isAuthenticated','ChatInteraction','findOne','params','closed','disposition','status','unmanaged','Unmanaged.','Forbidden.','catch','use','headers','startsWith','authorization','Basic','User','find','name','authenticate','pass','json','Wrong\x20credentials.','user','Bearer','query','apikey','getUuid','then','allowedLoginAttempts','isEqual','nonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','minutes','Unknown\x20authorization\x20format','User\x20not\x20found.','canUpdate','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','/dashboards/general','send','retrieveApiKey','apiKeyNonce','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','encryptString','join','promisify','sign','secret','options','verify','randomBytes','toString','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','util','secrets','session','role','fullname','email','permissions','md5secret','voicePause','chatPause','mailPause'];(function(_0x550d2f,_0x367bea){var _0x28e111=function(_0x2e47eb){while(--_0x2e47eb){_0x550d2f['push'](_0x550d2f['shift']());}};_0x28e111(++_0x367bea);}(_0xd1bb,0xef));var _0xbd1b=function(_0x5beaab,_0x4d708d){_0x5beaab=_0x5beaab-0x0;var _0x19e7db=_0xd1bb[_0x5beaab];return _0x19e7db;};'use strict';var db=require(_0xbd1b('0x0'))['db'];var config=require(_0xbd1b('0x1'));var hardwareConf=require(_0xbd1b('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0xbd1b('0x3'));var _=require(_0xbd1b('0x4'));var jwt=require(_0xbd1b('0x5'));var expressJwt=require(_0xbd1b('0x6'));var compose=require(_0xbd1b('0x7'));var basicAuth=require(_0xbd1b('0x8'));var crypto=require(_0xbd1b('0x9'));var BPromise=require('bluebird');var util=require(_0xbd1b('0xa'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0xbd1b('0xb')][_0xbd1b('0xc')]});var userAttributes=['id',_0xbd1b('0xd'),_0xbd1b('0xe'),'name','internal',_0xbd1b('0xf'),'userpic',_0xbd1b('0x10'),_0xbd1b('0x11'),_0xbd1b('0x12'),_0xbd1b('0x13'),_0xbd1b('0x14'),'faxPause',_0xbd1b('0x15'),_0xbd1b('0x16'),_0xbd1b('0x17'),_0xbd1b('0x18'),_0xbd1b('0x19'),_0xbd1b('0x1a'),_0xbd1b('0x1b'),_0xbd1b('0x1c'),_0xbd1b('0x1d'),_0xbd1b('0x1e'),'phoneBarAutoAnswer',_0xbd1b('0x1f'),_0xbd1b('0x20'),'phoneBarEnableRecording',_0xbd1b('0x21'),_0xbd1b('0x22'),_0xbd1b('0x23'),_0xbd1b('0x24'),_0xbd1b('0x25'),_0xbd1b('0x26'),_0xbd1b('0x27'),_0xbd1b('0x28'),'userProfileId','privacyEnabled',_0xbd1b('0x29'),_0xbd1b('0x2a'),_0xbd1b('0x2b'),_0xbd1b('0x2c'),'downloadAttachments','ignorePauseForPreviewCalls',_0xbd1b('0x2d')];exports[_0xbd1b('0x2e')]=function(){return this[_0xbd1b('0x2f')](!![])['use'](function(_0x234ce3,_0x26ca26,_0x302f9d){if(_0x234ce3['user']){_0x302f9d();}else{return db[_0xbd1b('0x30')][_0xbd1b('0x31')]({'where':{'id':_0x234ce3[_0xbd1b('0x32')]['id']},'attributes':['id',_0xbd1b('0x33'),_0xbd1b('0x34')],'raw':!![]})['then'](function(_0x32b60b){if(_0x32b60b&&_0x32b60b[_0xbd1b('0x33')]){return _0x26ca26[_0xbd1b('0x35')](_0x32b60b[_0xbd1b('0x34')]===_0xbd1b('0x36')?0x195:0x193)['json']({'message':_0x32b60b['disposition']===_0xbd1b('0x36')?_0xbd1b('0x37'):_0xbd1b('0x38')});}else{_0x302f9d();}})[_0xbd1b('0x39')](function(_0x5b9425){_0x302f9d(_0x5b9425);});}});};exports[_0xbd1b('0x2f')]=function isAuthenticated(_0x25d534){return compose()[_0xbd1b('0x3a')](function(_0x259b1e,_0x590565,_0x42b3a3){var _0x2b2acf;if(_0x259b1e[_0xbd1b('0x3b')]['authorization']){if(_[_0xbd1b('0x3c')](_0x259b1e[_0xbd1b('0x3b')][_0xbd1b('0x3d')],_0xbd1b('0x3e'))){var _0x29c841=basicAuth(_0x259b1e);db[_0xbd1b('0x3f')][_0xbd1b('0x40')]({'where':{'name':_0x29c841[_0xbd1b('0x41')]}})['then'](function(_0xaaa168){if(!_0xaaa168||!_0xaaa168[_0xbd1b('0x42')](_0x29c841[_0xbd1b('0x43')])){return _0x590565['status'](0x191)[_0xbd1b('0x44')]({'message':_0xbd1b('0x45')});}_0x259b1e[_0xbd1b('0x46')]={'id':_0xaaa168['id']};_0x42b3a3();})[_0xbd1b('0x39')](function(_0x3747e6){_0x42b3a3(_0x3747e6);});}else if(_[_0xbd1b('0x3c')](_0x259b1e[_0xbd1b('0x3b')][_0xbd1b('0x3d')],_0xbd1b('0x47'))){validateJwt(_0x259b1e,_0x590565,_0x42b3a3);}else{if(_0x25d534){_0x42b3a3();}else{return _0x590565[_0xbd1b('0x35')](0x193)[_0xbd1b('0x44')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x259b1e[_0xbd1b('0x48')][_0xbd1b('0x49')]){try{var _0x4c4da7={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xbd1b('0x4a')]()};verifyJwt(_0x259b1e[_0xbd1b('0x48')][_0xbd1b('0x49')],_0x4c4da7)[_0xbd1b('0x4b')](function(_0x452902){return db['User'][_0xbd1b('0x40')]({'where':{'id':_0x452902['sub']}})[_0xbd1b('0x4b')](function(_0xe78c5f){_0x2b2acf=_0xe78c5f;return db['Setting'][_0xbd1b('0x31')]({'where':{'id':0x1},'attributes':[_0xbd1b('0x4c'),'blockDuration'],'raw':!![]});})['then'](function(_0x567176){if(!_0x2b2acf||!_[_0xbd1b('0x4d')](_0x2b2acf['apiKeyNonce'],_0x452902[_0xbd1b('0x4e')])){return _0x590565['status'](0x191)[_0xbd1b('0x44')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x2b2acf[_0xbd1b('0x4f')]){return _0x590565['status'](0x191)[_0xbd1b('0x44')]({'message':_0xbd1b('0x50')});}if(_0x2b2acf[_0xbd1b('0x51')]){if(_0x567176[_0xbd1b('0x52')]>0x0){if(moment(_0x2b2acf[_0xbd1b('0x53')])[_0xbd1b('0x54')](_0x567176[_0xbd1b('0x52')],_0xbd1b('0x55'))>moment()){return _0x590565[_0xbd1b('0x35')](0x191)[_0xbd1b('0x44')]({'message':_0xbd1b('0x50')});}}else{return _0x590565[_0xbd1b('0x35')](0x191)[_0xbd1b('0x44')]({'message':_0xbd1b('0x50')});}}_0x259b1e['user']={'id':_0x2b2acf['id']};_0x42b3a3();});})[_0xbd1b('0x39')](function(){return _0x590565['status'](0x191)[_0xbd1b('0x44')]({'message':_0xbd1b('0x50')});});}catch(_0x3ca8ec){_0x42b3a3(_0x3ca8ec);}}else if(_0x25d534){_0x42b3a3();}else{return _0x590565['status'](0x193)[_0xbd1b('0x44')]({'message':_0xbd1b('0x56')});}})[_0xbd1b('0x3a')](function(_0x427c00,_0x2c4e03,_0x5524ab){if(_0x427c00[_0xbd1b('0x46')]){db['User'][_0xbd1b('0x40')]({'where':{'id':_0x427c00[_0xbd1b('0x46')]['id']},'attributes':userAttributes})['then'](function(_0x236ce5){if(!_0x236ce5){return _0x2c4e03['status'](0x194)[_0xbd1b('0x44')]({'message':_0xbd1b('0x57')});}_0x427c00[_0xbd1b('0x46')]=_0x236ce5;_0x5524ab();})[_0xbd1b('0x39')](function(_0x2fe39b){_0x5524ab(_0x2fe39b);});}else if(_0x25d534){_0x5524ab();}else{return _0x2c4e03[_0xbd1b('0x35')](0x194)[_0xbd1b('0x44')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xbd1b('0x58')]=function canUpdate(){return compose()[_0xbd1b('0x3a')](function(_0x32d760,_0x5e2b13,_0x31116d){return licenseUtil['getLicense']()[_0xbd1b('0x4b')](function(_0x39d72a){if(_0x39d72a[_0xbd1b('0x59')]){_0x31116d();}else{return _0x5e2b13[_0xbd1b('0x35')](0x193)[_0xbd1b('0x44')]({'message':_0xbd1b('0x5a')});}})[_0xbd1b('0x39')](function(_0x5c0467){_0x31116d(_0x5c0467);});});};exports[_0xbd1b('0x5b')]=function isWebrtcLicence(){return compose()[_0xbd1b('0x3a')](function(_0x164e01,_0x407d11,_0x41fab2){return licenseUtil['getLicense']()['then'](function(_0x25cb1e){if(_0x25cb1e[_0xbd1b('0x5c')]){_0x41fab2();}else{return _0x407d11[_0xbd1b('0x35')](0x193)[_0xbd1b('0x44')]({'message':_0xbd1b('0x5a')});}})['catch'](function(_0x57741e){_0x41fab2(_0x57741e);});});};exports[_0xbd1b('0x5d')]=function(_0x1f8d39,_0x55eb31,_0x3601ee){_0x1f8d39[_0xbd1b('0x5d')]=!![];return _0x3601ee();};exports['signToken']=function signToken(_0x3cb6fa){return signJwt(_0x3cb6fa);};exports[_0xbd1b('0x5e')]=function(_0x5f20d2,_0x5ceb15){if(!_0x5f20d2[_0xbd1b('0x46')]){return _0x5ceb15[_0xbd1b('0x35')](0x194)[_0xbd1b('0x44')]({'message':_0xbd1b('0x5f')});}var _0x434e7a={'payload':{'id':_0x5f20d2[_0xbd1b('0x46')]['id'],'role':_0x5f20d2[_0xbd1b('0x46')][_0xbd1b('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x434e7a)[_0xbd1b('0x4b')](function(_0x5238e0){_0x5ceb15['cookie'](_0xbd1b('0x60'),_0x5238e0);_0x5ceb15[_0xbd1b('0x61')](_0xbd1b('0x62'));})[_0xbd1b('0x39')](function(_0x17788d){return _0x5ceb15[_0xbd1b('0x35')](0x1f4)[_0xbd1b('0x63')](_0x17788d);});};exports[_0xbd1b('0x64')]=function(_0xcb0889){if(_['isNil'](_0xcb0889[_0xbd1b('0x65')])||_[_0xbd1b('0x66')](_0xcb0889[_0xbd1b('0x67')])){return null;}else{return createJwt(_0xcb0889);}};exports['generateApiKey']=function(_0x59af40){_0x59af40[_0xbd1b('0x65')]=generateNonce();_0x59af40[_0xbd1b('0x67')]=generateIssuedAt();return createJwt(_0x59af40);};exports[_0xbd1b('0x68')]=function(_0x2dfc42,_0x311de0){var _0x25780c=_0x2dfc42['query'][_0xbd1b('0x49')];if(_0x25780c){var _0x2554c8={'nonce':_0x311de0['apiKeyNonce'],'iat':_0x311de0[_0xbd1b('0x67')],'audience':hardwareConf[_0xbd1b('0x4a')](),'issuer':hardwareConf[_0xbd1b('0x4a')]()};return verifyJwt(_0x25780c,_0x2554c8)[_0xbd1b('0x4b')](function(){return generateApiKey(_0x311de0);});}else{throw{'message':_0xbd1b('0x69')};}};exports[_0xbd1b('0x6a')]=function(_0x2bd4ae){var _0x3fd233=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3fd233[_0xbd1b('0x6b')](_0x2bd4ae))throw new db[(_0xbd1b('0x6c'))][(_0xbd1b('0x6d'))]('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['validatePasswordHistory']=function(_0x4b1364,_0xe8527a,_0x468e1d){var _0x37df62=encryptor[_0xbd1b('0x6e')](_0xe8527a)[_0xbd1b('0x6f')](',');for(var _0x1b9220=0x0;_0x1b9220<_0x468e1d;_0x1b9220++){if(!_0x37df62[_0x1b9220])break;if(_0x4b1364[_0xbd1b('0x70')]()===_0x37df62[_0x1b9220]['toLowerCase']()){var _0x2302a1=util[_0xbd1b('0x71')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x468e1d);if(_0x468e1d===0x1){_0x2302a1=_0xbd1b('0x72');}throw new db['Sequelize']['ValidationError'](_0x2302a1);}}return;};exports[_0xbd1b('0x73')]=function(_0x36cb34,_0x3305c7){var _0x1047f0=_0x3305c7?encryptor['decryptString'](_0x3305c7)[_0xbd1b('0x6f')](','):[];if(_0x1047f0[_0xbd1b('0x74')]===0x5){_0x1047f0[_0xbd1b('0x75')](-0x1,0x1);}_0x1047f0[_0xbd1b('0x76')](_0x36cb34);return encryptor[_0xbd1b('0x77')](_0x1047f0[_0xbd1b('0x78')](','));};function signJwt(_0x15dfe5){var _0x1b4711=BPromise[_0xbd1b('0x79')](jwt[_0xbd1b('0x7a')],{'context':jwt});var _0x5590d9=_0x15dfe5[_0xbd1b('0x7b')]||config[_0xbd1b('0xb')]['session'];return new BPromise(function(_0x135549,_0x61a7c4){_0x1b4711(_0x15dfe5['payload'],_0x5590d9,_0x15dfe5[_0xbd1b('0x7c')])[_0xbd1b('0x4b')](function(_0x101e82){_0x135549(_0x101e82);})[_0xbd1b('0x39')](function(_0x16e4d9){_0x61a7c4(_0x16e4d9);});});}function verifyJwt(_0x432b48,_0x43f051,_0x45a43e){var _0x3f483e=BPromise['promisify'](jwt[_0xbd1b('0x7d')],{'context':jwt});var _0xac8464=_0x45a43e||config[_0xbd1b('0xb')][_0xbd1b('0xc')];return new BPromise(function(_0x3efbef,_0x3355d4){_0x3f483e(_0x432b48,_0xac8464,_0x43f051)['then'](function(_0x4154a2){_0x3efbef(_0x4154a2);})['catch'](function(_0x1b40b4){_0x3355d4(_0x1b40b4);});});}function generateNonce(){return crypto[_0xbd1b('0x7e')](0x10)[_0xbd1b('0x7f')]('hex');}function generateIssuedAt(){return Math['floor'](Date[_0xbd1b('0x80')]()/0x3e8)[_0xbd1b('0x7f')]();}function createJwt(_0x295820){var _0x5689d0={'payload':{'iat':_0x295820[_0xbd1b('0x67')],'nonce':_0x295820['apiKeyNonce']},'options':{'algorithm':_0xbd1b('0x81'),'subject':_0x295820['id'][_0xbd1b('0x7f')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0xbd1b('0x4a')]()}};return signJwt(_0x5689d0)[_0xbd1b('0x4b')](function(_0x237acd){return{'iat':_0x295820[_0xbd1b('0x67')],'nonce':_0x295820[_0xbd1b('0x65')],'token':_0x237acd};});} \ No newline at end of file +var _0x9380=['ChatInteraction','findOne','disposition','status','unmanaged','Unmanaged.','Forbidden.','catch','use','headers','authorization','startsWith','Basic','User','then','authenticate','Wrong\x20credentials.','Bearer','json','Unknown\x20authorization\x20format','apikey','getUuid','find','sub','Setting','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','redirect','/dashboards/general','isNil','apiKeyIat','generateApiKey','regenerateApiKey','query','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','ValidationError','decryptString','length','splice','join','promisify','sign','payload','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/license/util','../encryptor','lodash','jsonwebtoken','basic-auth','crypto','bluebird','util','moment','secrets','session','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','openchannelPause','showWebBar','lastLoginAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','ignorePauseForPreviewCalls','isChatInteractionAuthorized','isAuthenticated','user'];(function(_0x5cc02d,_0x17316b){var _0x14b33d=function(_0x3ed59b){while(--_0x3ed59b){_0x5cc02d['push'](_0x5cc02d['shift']());}};_0x14b33d(++_0x17316b);}(_0x9380,0x14a));var _0x0938=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x9380[_0x1203f];return _0x365f0a;};'use strict';var db=require(_0x0938('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x0938('0x1'));var encryptor=require(_0x0938('0x2'));var _=require(_0x0938('0x3'));var jwt=require(_0x0938('0x4'));var expressJwt=require('express-jwt');var compose=require('composable-middleware');var basicAuth=require(_0x0938('0x5'));var crypto=require(_0x0938('0x6'));var BPromise=require(_0x0938('0x7'));var util=require(_0x0938('0x8'));var moment=require(_0x0938('0x9'));var validateJwt=expressJwt({'secret':config[_0x0938('0xa')][_0x0938('0xb')]});var userAttributes=['id','role',_0x0938('0xc'),_0x0938('0xd'),_0x0938('0xe'),_0x0938('0xf'),_0x0938('0x10'),_0x0938('0x11'),_0x0938('0x12'),_0x0938('0x13'),'chatPause','mailPause','faxPause','smsPause',_0x0938('0x14'),'pauseType',_0x0938('0x15'),_0x0938('0x16'),'lastPauseAt',_0x0938('0x17'),_0x0938('0x18'),'passwordResetAt',_0x0938('0x19'),_0x0938('0x1a'),_0x0938('0x1b'),_0x0938('0x1c'),_0x0938('0x1d'),_0x0938('0x1e'),'phoneBarEnableSettings',_0x0938('0x1f'),_0x0938('0x20'),_0x0938('0x21'),'phoneBarRemoteControlPort','hotdesk',_0x0938('0x22'),_0x0938('0x23'),_0x0938('0x24'),_0x0938('0x25'),_0x0938('0x26'),_0x0938('0x27'),_0x0938('0x28'),'downloadAttachments',_0x0938('0x29'),'selectRecallMeCampaign'];exports[_0x0938('0x2a')]=function(){return this[_0x0938('0x2b')](!![])['use'](function(_0x83ed5b,_0x36d735,_0x53f285){if(_0x83ed5b[_0x0938('0x2c')]){_0x53f285();}else{return db[_0x0938('0x2d')][_0x0938('0x2e')]({'where':{'id':_0x83ed5b['params']['id']},'attributes':['id','closed',_0x0938('0x2f')],'raw':!![]})['then'](function(_0x29cd18){if(_0x29cd18&&_0x29cd18['closed']){return _0x36d735[_0x0938('0x30')](_0x29cd18['disposition']===_0x0938('0x31')?0x195:0x193)['json']({'message':_0x29cd18[_0x0938('0x2f')]===_0x0938('0x31')?_0x0938('0x32'):_0x0938('0x33')});}else{_0x53f285();}})[_0x0938('0x34')](function(_0x363a8f){_0x53f285(_0x363a8f);});}});};exports['isAuthenticated']=function isAuthenticated(_0x55fc81){return compose()[_0x0938('0x35')](function(_0x1e4570,_0x13f7ad,_0x351ff3){var _0x32084a;if(_0x1e4570[_0x0938('0x36')][_0x0938('0x37')]){if(_[_0x0938('0x38')](_0x1e4570['headers'][_0x0938('0x37')],_0x0938('0x39'))){var _0x4c4ebd=basicAuth(_0x1e4570);db[_0x0938('0x3a')]['find']({'where':{'name':_0x4c4ebd[_0x0938('0xd')]}})[_0x0938('0x3b')](function(_0x2d9333){if(!_0x2d9333||!_0x2d9333[_0x0938('0x3c')](_0x4c4ebd['pass'])){return _0x13f7ad['status'](0x191)['json']({'message':_0x0938('0x3d')});}_0x1e4570[_0x0938('0x2c')]={'id':_0x2d9333['id']};_0x351ff3();})['catch'](function(_0x5c399f){_0x351ff3(_0x5c399f);});}else if(_[_0x0938('0x38')](_0x1e4570['headers'][_0x0938('0x37')],_0x0938('0x3e'))){validateJwt(_0x1e4570,_0x13f7ad,_0x351ff3);}else{if(_0x55fc81){_0x351ff3();}else{return _0x13f7ad['status'](0x193)[_0x0938('0x3f')]({'message':_0x0938('0x40')});}}}else if(_0x1e4570['query'][_0x0938('0x41')]){try{var _0x56e1b0={'audience':hardwareConf[_0x0938('0x42')](),'issuer':hardwareConf[_0x0938('0x42')]()};verifyJwt(_0x1e4570['query']['apikey'],_0x56e1b0)['then'](function(_0x386e3c){return db[_0x0938('0x3a')][_0x0938('0x43')]({'where':{'id':_0x386e3c[_0x0938('0x44')]}})['then'](function(_0x338f2c){_0x32084a=_0x338f2c;return db[_0x0938('0x45')][_0x0938('0x2e')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x0938('0x46')],'raw':!![]});})[_0x0938('0x3b')](function(_0x51b815){if(!_0x32084a||!_[_0x0938('0x47')](_0x32084a[_0x0938('0x48')],_0x386e3c[_0x0938('0x49')])){return _0x13f7ad[_0x0938('0x30')](0x191)[_0x0938('0x3f')]({'message':_0x0938('0x4a')});}if(_0x32084a[_0x0938('0x4b')]){return _0x13f7ad[_0x0938('0x30')](0x191)[_0x0938('0x3f')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x32084a[_0x0938('0x4c')]){if(_0x51b815[_0x0938('0x46')]>0x0){if(moment(_0x32084a['blockedAt'])[_0x0938('0x4d')](_0x51b815[_0x0938('0x46')],_0x0938('0x4e'))>moment()){return _0x13f7ad[_0x0938('0x30')](0x191)[_0x0938('0x3f')]({'message':_0x0938('0x4f')});}}else{return _0x13f7ad[_0x0938('0x30')](0x191)['json']({'message':_0x0938('0x4f')});}}_0x1e4570[_0x0938('0x2c')]={'id':_0x32084a['id']};_0x351ff3();});})[_0x0938('0x34')](function(){return _0x13f7ad[_0x0938('0x30')](0x191)[_0x0938('0x3f')]({'message':_0x0938('0x4f')});});}catch(_0x139022){_0x351ff3(_0x139022);}}else if(_0x55fc81){_0x351ff3();}else{return _0x13f7ad[_0x0938('0x30')](0x193)[_0x0938('0x3f')]({'message':'Unknown\x20authorization\x20format'});}})[_0x0938('0x35')](function(_0x78e0f0,_0xc9b790,_0x370144){if(_0x78e0f0['user']){db[_0x0938('0x3a')][_0x0938('0x43')]({'where':{'id':_0x78e0f0[_0x0938('0x2c')]['id']},'attributes':userAttributes})[_0x0938('0x3b')](function(_0x270b15){if(!_0x270b15){return _0xc9b790[_0x0938('0x30')](0x194)[_0x0938('0x3f')]({'message':_0x0938('0x50')});}_0x78e0f0[_0x0938('0x2c')]=_0x270b15;_0x370144();})[_0x0938('0x34')](function(_0x3d9c06){_0x370144(_0x3d9c06);});}else if(_0x55fc81){_0x370144();}else{return _0xc9b790[_0x0938('0x30')](0x194)[_0x0938('0x3f')]({'message':_0x0938('0x51')});}});};exports[_0x0938('0x52')]=function canUpdate(){return compose()['use'](function(_0x5a5e3e,_0x4fad0e,_0x105d79){return licenseUtil[_0x0938('0x53')]()[_0x0938('0x3b')](function(_0x2439fc){if(_0x2439fc[_0x0938('0x54')]){_0x105d79();}else{return _0x4fad0e['status'](0x193)[_0x0938('0x3f')]({'message':_0x0938('0x55')});}})['catch'](function(_0x31cebd){_0x105d79(_0x31cebd);});});};exports[_0x0938('0x56')]=function isWebrtcLicence(){return compose()[_0x0938('0x35')](function(_0x50138e,_0x2bb176,_0x2789c6){return licenseUtil[_0x0938('0x53')]()[_0x0938('0x3b')](function(_0x4f8a92){if(_0x4f8a92[_0x0938('0x57')]){_0x2789c6();}else{return _0x2bb176[_0x0938('0x30')](0x193)[_0x0938('0x3f')]({'message':_0x0938('0x55')});}})[_0x0938('0x34')](function(_0x3f4cde){_0x2789c6(_0x3f4cde);});});};exports['isMiddleware']=function(_0x584de0,_0x1bfe75,_0x57c2f8){_0x584de0['isMiddleware']=!![];return _0x57c2f8();};exports['signToken']=function signToken(_0x37d126){return signJwt(_0x37d126);};exports['setTokenCookie']=function(_0x4aa11a,_0x123228){if(!_0x4aa11a[_0x0938('0x2c')]){return _0x123228[_0x0938('0x30')](0x194)[_0x0938('0x3f')]({'message':_0x0938('0x58')});}var _0x132de7={'payload':{'id':_0x4aa11a[_0x0938('0x2c')]['id'],'role':_0x4aa11a[_0x0938('0x2c')][_0x0938('0x59')]},'options':{'expiresIn':0x15180}};return signJwt(_0x132de7)[_0x0938('0x3b')](function(_0x1eacca){_0x123228[_0x0938('0x5a')]('motion.token',_0x1eacca);_0x123228[_0x0938('0x5b')](_0x0938('0x5c'));})[_0x0938('0x34')](function(_0x523300){return _0x123228[_0x0938('0x30')](0x1f4)['send'](_0x523300);});};exports['retrieveApiKey']=function(_0x3af777){if(_[_0x0938('0x5d')](_0x3af777[_0x0938('0x48')])||_['isNil'](_0x3af777[_0x0938('0x5e')])){return null;}else{return createJwt(_0x3af777);}};exports[_0x0938('0x5f')]=function(_0x4c7f48){_0x4c7f48['apiKeyNonce']=generateNonce();_0x4c7f48[_0x0938('0x5e')]=generateIssuedAt();return createJwt(_0x4c7f48);};exports[_0x0938('0x60')]=function(_0x5a19df,_0xf5ea39){var _0x151c4d=_0x5a19df[_0x0938('0x61')][_0x0938('0x41')];if(_0x151c4d){var _0x2da5e3={'nonce':_0xf5ea39[_0x0938('0x48')],'iat':_0xf5ea39['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x151c4d,_0x2da5e3)[_0x0938('0x3b')](function(){return generateApiKey(_0xf5ea39);});}else{throw{'message':_0x0938('0x62')};}};exports[_0x0938('0x63')]=function(_0x55b10d){var _0x3e0e2d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3e0e2d[_0x0938('0x64')](_0x55b10d))throw new db[(_0x0938('0x65'))]['ValidationError'](_0x0938('0x66'));return;};exports[_0x0938('0x67')]=function(_0xc28df7,_0x3457c4,_0x5c3e18){var _0x176ab9=encryptor['decryptString'](_0x3457c4)[_0x0938('0x68')](',');for(var _0x4fb5f7=0x0;_0x4fb5f7<_0x5c3e18;_0x4fb5f7++){if(!_0x176ab9[_0x4fb5f7])break;if(_0xc28df7[_0x0938('0x69')]()===_0x176ab9[_0x4fb5f7][_0x0938('0x69')]()){var _0x3748d7=util[_0x0938('0x6a')](_0x0938('0x6b'),_0x5c3e18);if(_0x5c3e18===0x1){_0x3748d7=_0x0938('0x6c');}throw new db[(_0x0938('0x65'))][(_0x0938('0x6d'))](_0x3748d7);}}return;};exports['updatePasswordsHistory']=function(_0x23b21d,_0x110678){var _0x3a026e=_0x110678?encryptor[_0x0938('0x6e')](_0x110678)[_0x0938('0x68')](','):[];if(_0x3a026e[_0x0938('0x6f')]===0x5){_0x3a026e[_0x0938('0x70')](-0x1,0x1);}_0x3a026e['unshift'](_0x23b21d);return encryptor['encryptString'](_0x3a026e[_0x0938('0x71')](','));};function signJwt(_0x1d41da){var _0x1483d1=BPromise[_0x0938('0x72')](jwt[_0x0938('0x73')],{'context':jwt});var _0x1c66ec=_0x1d41da['secret']||config['secrets'][_0x0938('0xb')];return new BPromise(function(_0x92281d,_0x55031f){_0x1483d1(_0x1d41da[_0x0938('0x74')],_0x1c66ec,_0x1d41da[_0x0938('0x75')])[_0x0938('0x3b')](function(_0x319a4d){_0x92281d(_0x319a4d);})[_0x0938('0x34')](function(_0x392dea){_0x55031f(_0x392dea);});});}function verifyJwt(_0x295f9e,_0x3a1cc7,_0x2294ac){var _0xece011=BPromise[_0x0938('0x72')](jwt[_0x0938('0x76')],{'context':jwt});var _0x5bf2d8=_0x2294ac||config[_0x0938('0xa')][_0x0938('0xb')];return new BPromise(function(_0x5e9dba,_0x3e5dd3){_0xece011(_0x295f9e,_0x5bf2d8,_0x3a1cc7)[_0x0938('0x3b')](function(_0x59fe8f){_0x5e9dba(_0x59fe8f);})['catch'](function(_0x54a665){_0x3e5dd3(_0x54a665);});});}function generateNonce(){return crypto[_0x0938('0x77')](0x10)[_0x0938('0x78')](_0x0938('0x79'));}function generateIssuedAt(){return Math[_0x0938('0x7a')](Date[_0x0938('0x7b')]()/0x3e8)[_0x0938('0x78')]();}function createJwt(_0x1f7c10){var _0x1aa17c={'payload':{'iat':_0x1f7c10['apiKeyIat'],'nonce':_0x1f7c10[_0x0938('0x48')]},'options':{'algorithm':_0x0938('0x7c'),'subject':_0x1f7c10['id'][_0x0938('0x78')](),'issuer':hardwareConf[_0x0938('0x42')](),'audience':hardwareConf[_0x0938('0x42')]()}};return signJwt(_0x1aa17c)[_0x0938('0x3b')](function(_0x57eda4){return{'iat':_0x1f7c10['apiKeyIat'],'nonce':_0x1f7c10[_0x0938('0x48')],'token':_0x57eda4};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index f57298b..8c4a4d8 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 _0x183e=['decryptFile','createDecipher','close','secret','base64','decryptString','utf8','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','algorithm','encrypt','error','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createCipher','data','update','binary','write','end','final','unlink'];(function(_0x1fcee4,_0x5de71f){var _0x56bb96=function(_0x4b9498){while(--_0x4b9498){_0x1fcee4['push'](_0x1fcee4['shift']());}};_0x56bb96(++_0x5de71f);}(_0x183e,0x6a));var _0xe183=function(_0xb837bd,_0x4186e2){_0xb837bd=_0xb837bd-0x0;var _0x5d229a=_0x183e[_0xb837bd];return _0x5d229a;};'use strict';var crypto=require(_0xe183('0x0'));var fs=require('fs');var BPromise=require(_0xe183('0x1'));var _=require(_0xe183('0x2'));var config=require(_0xe183('0x3'));var logger=require(_0xe183('0x4'))(_0xe183('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xe183('0x6')][_0xe183('0x7')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':'aes192'};if(config['encrypt']&&config['encrypt'][_0xe183('0x8')]){var isSupported=isAlgorithmSupported(config[_0xe183('0x9')][_0xe183('0x8')]);if(isSupported){fileOptions[_0xe183('0x8')]=config[_0xe183('0x9')][_0xe183('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0xe183('0xa')](config[_0xe183('0x9')][_0xe183('0x8')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x304a8a){return AES_SUPPORTED_RX[_0xe183('0xb')](_0x304a8a);}function getSupportedCiphers(){return crypto[_0xe183('0xc')]()[_0xe183('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x1ee673){return getSupportedCiphers()[_0xe183('0xe')](_0x1ee673)>-0x1;}function combineOptions(_0x5e243a){var _0x3195f8={};for(var _0xd119cd in fileOptions){if(fileOptions[_0xe183('0xf')](_0xd119cd)){_0x3195f8[_0xd119cd]=fileOptions[_0xd119cd];}}if(_0x5e243a){for(var _0x46271e in _0x5e243a){if(_0x5e243a[_0xe183('0xf')](_0x46271e)){_0x3195f8[_0x46271e]=_0x5e243a[_0x46271e];}}}return _0x3195f8;}exports[_0xe183('0x10')]=function(_0x586ff4,_0x50c37c,_0x13494a,_0x1a3246){return new BPromise(function(_0x1c7e41,_0x1e7708){_0x1a3246=combineOptions(_0x1a3246);var _0x44eece=new Buffer(_0x13494a);var _0x500098=fs[_0xe183('0x11')](_0x586ff4);var _0x2560c9=fs['createWriteStream'](_0x50c37c);var _0x363b79=crypto[_0xe183('0x12')](_0x1a3246[_0xe183('0x8')],_0x44eece);_0x500098['on'](_0xe183('0x13'),function(_0x5a49a2){var _0x2de5f3=new Buffer(_0x363b79[_0xe183('0x14')](_0x5a49a2),_0xe183('0x15'));_0x2560c9[_0xe183('0x16')](_0x2de5f3);});_0x500098['on'](_0xe183('0x17'),function(){try{var _0x4aa930=new Buffer(_0x363b79[_0xe183('0x18')](_0xe183('0x15')),_0xe183('0x15'));_0x2560c9[_0xe183('0x16')](_0x4aa930);_0x2560c9[_0xe183('0x17')]();_0x2560c9['on']('close',function(){return _0x1c7e41(_0x50c37c);});}catch(_0x392bfe){fs[_0xe183('0x19')](_0x50c37c);return _0x1e7708(_0x392bfe);}});});};exports[_0xe183('0x1a')]=function(_0xc189a3,_0x4e67a2,_0x4f9163,_0x41b55b){return new BPromise(function(_0x4ab252,_0x579de0){_0x41b55b=combineOptions(_0x41b55b);var _0xcb9659=new Buffer(_0x4f9163);var _0x525f6d=fs[_0xe183('0x11')](_0xc189a3);var _0x328eac=fs['createWriteStream'](_0x4e67a2);var _0x32ff60=crypto[_0xe183('0x1b')](_0x41b55b[_0xe183('0x8')],_0xcb9659);_0x525f6d['on']('data',function(_0x273c39){var _0xfe3e5e=new Buffer(_0x32ff60['update'](_0x273c39),_0xe183('0x15'));_0x328eac['write'](_0xfe3e5e);});_0x525f6d['on'](_0xe183('0x17'),function(){try{var _0x19f0be=new Buffer(_0x32ff60[_0xe183('0x18')](_0xe183('0x15')),_0xe183('0x15'));_0x328eac['write'](_0x19f0be);_0x328eac[_0xe183('0x17')]();_0x328eac['on'](_0xe183('0x1c'),function(){return _0x4ab252(_0x4e67a2);});}catch(_0x2aa47e){fs[_0xe183('0x19')](_0x4e67a2);return _0x579de0(_0x2aa47e);}});});};exports['encryptString']=function(_0x2dd972,_0x9a146f,_0x32e376){var _0x332bc3=_0x32e376||stringOptions[_0xe183('0x8')];var _0x5ccb5f=_0x9a146f||stringOptions[_0xe183('0x1d')];var _0x4b1851=crypto[_0xe183('0x12')](_0x332bc3,_0x5ccb5f);var _0xcce77=_0x4b1851[_0xe183('0x14')](_0x2dd972,'utf8',_0xe183('0x1e'));_0xcce77+=_0x4b1851['final'](_0xe183('0x1e'));return _0xcce77;};exports[_0xe183('0x1f')]=function(_0x297eab,_0xe1b6d5,_0x8ddc33){var _0x375347=_0x8ddc33||stringOptions['algorithm'];var _0x5e0fbe=_0xe1b6d5||stringOptions[_0xe183('0x1d')];var _0x20518e=crypto[_0xe183('0x1b')](_0x375347,_0x5e0fbe);var _0x5bb57d=_0x20518e[_0xe183('0x14')](_0x297eab,_0xe183('0x1e'),_0xe183('0x20'));_0x5bb57d+=_0x20518e['final']('utf8');return _0x5bb57d;}; \ No newline at end of file +var _0x5eae=['createWriteStream','createCipher','data','binary','write','end','final','close','unlink','decryptFile','createDecipher','update','encryptString','secret','base64','decryptString','utf8','crypto','lodash','../../config/logger','secrets','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','hasOwnProperty','encryptFile','createReadStream'];(function(_0x511f0f,_0x51f1f0){var _0x552dd8=function(_0x3da2e9){while(--_0x3da2e9){_0x511f0f['push'](_0x511f0f['shift']());}};_0x552dd8(++_0x51f1f0);}(_0x5eae,0xd7));var _0xe5ea=function(_0x16d000,_0x3373bd){_0x16d000=_0x16d000-0x0;var _0xe1d506=_0x5eae[_0x16d000];return _0xe1d506;};'use strict';var crypto=require(_0xe5ea('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0xe5ea('0x1'));var config=require('../../config/environment');var logger=require(_0xe5ea('0x2'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xe5ea('0x3')]['session'],'algorithm':_0xe5ea('0x4')};const fileOptions={'algorithm':_0xe5ea('0x5')};if(config[_0xe5ea('0x6')]&&config['encrypt']['algorithm']){var isSupported=isAlgorithmSupported(config['encrypt'][_0xe5ea('0x7')]);if(isSupported){fileOptions[_0xe5ea('0x7')]=config[_0xe5ea('0x6')][_0xe5ea('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xe5ea('0x8')](',\x20');logger[_0xe5ea('0x9')](config[_0xe5ea('0x6')][_0xe5ea('0x7')],_0xe5ea('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x307079){return AES_SUPPORTED_RX['test'](_0x307079);}function getSupportedCiphers(){return crypto[_0xe5ea('0xb')]()[_0xe5ea('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x2a4cee){return getSupportedCiphers()['indexOf'](_0x2a4cee)>-0x1;}function combineOptions(_0x5d8c40){var _0x41f7de={};for(var _0x49581d in fileOptions){if(fileOptions[_0xe5ea('0xd')](_0x49581d)){_0x41f7de[_0x49581d]=fileOptions[_0x49581d];}}if(_0x5d8c40){for(var _0x8247a7 in _0x5d8c40){if(_0x5d8c40['hasOwnProperty'](_0x8247a7)){_0x41f7de[_0x8247a7]=_0x5d8c40[_0x8247a7];}}}return _0x41f7de;}exports[_0xe5ea('0xe')]=function(_0x576f33,_0x38ad7a,_0xdb5c9b,_0x54f09a){return new BPromise(function(_0x44bcd6,_0x1ecc45){_0x54f09a=combineOptions(_0x54f09a);var _0x4e0ba1=new Buffer(_0xdb5c9b);var _0x4f82ae=fs[_0xe5ea('0xf')](_0x576f33);var _0x57b625=fs[_0xe5ea('0x10')](_0x38ad7a);var _0xcbc802=crypto[_0xe5ea('0x11')](_0x54f09a[_0xe5ea('0x7')],_0x4e0ba1);_0x4f82ae['on'](_0xe5ea('0x12'),function(_0x2c4289){var _0x105dc8=new Buffer(_0xcbc802['update'](_0x2c4289),_0xe5ea('0x13'));_0x57b625[_0xe5ea('0x14')](_0x105dc8);});_0x4f82ae['on'](_0xe5ea('0x15'),function(){try{var _0x24a8a4=new Buffer(_0xcbc802[_0xe5ea('0x16')](_0xe5ea('0x13')),_0xe5ea('0x13'));_0x57b625['write'](_0x24a8a4);_0x57b625[_0xe5ea('0x15')]();_0x57b625['on'](_0xe5ea('0x17'),function(){return _0x44bcd6(_0x38ad7a);});}catch(_0x396ddb){fs[_0xe5ea('0x18')](_0x38ad7a);return _0x1ecc45(_0x396ddb);}});});};exports[_0xe5ea('0x19')]=function(_0x52c0e4,_0x3084c4,_0x178da6,_0x41698a){return new BPromise(function(_0xeff7b2,_0x5a960c){_0x41698a=combineOptions(_0x41698a);var _0x31d064=new Buffer(_0x178da6);var _0x485d1b=fs[_0xe5ea('0xf')](_0x52c0e4);var _0x37082d=fs[_0xe5ea('0x10')](_0x3084c4);var _0x19968c=crypto[_0xe5ea('0x1a')](_0x41698a[_0xe5ea('0x7')],_0x31d064);_0x485d1b['on'](_0xe5ea('0x12'),function(_0x178f86){var _0x338f54=new Buffer(_0x19968c[_0xe5ea('0x1b')](_0x178f86),'binary');_0x37082d[_0xe5ea('0x14')](_0x338f54);});_0x485d1b['on'](_0xe5ea('0x15'),function(){try{var _0x341291=new Buffer(_0x19968c['final']('binary'),_0xe5ea('0x13'));_0x37082d[_0xe5ea('0x14')](_0x341291);_0x37082d[_0xe5ea('0x15')]();_0x37082d['on'](_0xe5ea('0x17'),function(){return _0xeff7b2(_0x3084c4);});}catch(_0x4eaa13){fs[_0xe5ea('0x18')](_0x3084c4);return _0x5a960c(_0x4eaa13);}});});};exports[_0xe5ea('0x1c')]=function(_0x67ab07,_0x5b3a36,_0x3ea45a){var _0x2a8c80=_0x3ea45a||stringOptions['algorithm'];var _0x14f76e=_0x5b3a36||stringOptions[_0xe5ea('0x1d')];var _0x171e75=crypto['createCipher'](_0x2a8c80,_0x14f76e);var _0xd1f26d=_0x171e75['update'](_0x67ab07,'utf8',_0xe5ea('0x1e'));_0xd1f26d+=_0x171e75[_0xe5ea('0x16')](_0xe5ea('0x1e'));return _0xd1f26d;};exports[_0xe5ea('0x1f')]=function(_0x3f50b1,_0x368041,_0x2a8b1a){var _0x2fd913=_0x2a8b1a||stringOptions[_0xe5ea('0x7')];var _0x28a8e9=_0x368041||stringOptions['secret'];var _0x21b17d=crypto[_0xe5ea('0x1a')](_0x2fd913,_0x28a8e9);var _0x4246a5=_0x21b17d[_0xe5ea('0x1b')](_0x3f50b1,_0xe5ea('0x1e'),_0xe5ea('0x20'));_0x4246a5+=_0x21b17d['final'](_0xe5ea('0x20'));return _0x4246a5;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index e3d5e62..1b99898 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 _0x0405=['splitSizeCsv','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','then','num','Empty','split','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','length','existsSync','mkdirSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','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','inspect','Failed','finally','exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting'];(function(_0x1e1c3c,_0x29fbff){var _0x231987=function(_0x17d05f){while(--_0x17d05f){_0x1e1c3c['push'](_0x1e1c3c['shift']());}};_0x231987(++_0x29fbff);}(_0x0405,0x16e));var _0x5040=function(_0x1d1e5b,_0x11c6c0){_0x1d1e5b=_0x1d1e5b-0x0;var _0x3458c5=_0x0405[_0x1d1e5b];return _0x3458c5;};'use strict';var util=require(_0x5040('0x0'));var path=require(_0x5040('0x1'));var _=require(_0x5040('0x2'));var csv=require(_0x5040('0x3'));var fs=require('fs');var BPromise=require(_0x5040('0x4'));var zipdir=require(_0x5040('0x5'));var rimraf=require(_0x5040('0x6'));var db=require(_0x5040('0x7'))['db'];var dbH=require('../../mysqldb')[_0x5040('0x8')];var logger=require(_0x5040('0x9'))(_0x5040('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x5040('0xb')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x5040('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xcde922,_0x40f996){var _0x30770f={'status':_0xcde922};var _0x5124f6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x40f996){_0x30770f[_0x5040('0xc')]=_0x40f996;}return db['AnalyticExtractedReport'][_0x5040('0xd')](_0x30770f,_0x5124f6);}function main(){var _0x419018=0x1388;var _0x2ec416;logger[_0x5040('0xe')](util[_0x5040('0xf')](_0x5040('0x10'),EXTRACTED_REPORT_ID,_0x5040('0x11')));return db[_0x5040('0x12')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeCsv']})['then'](function(_0x1af360){if(_0x1af360){_0x2ec416=_0x1af360;_0x419018=_0x2ec416[_0x5040('0x13')]||0x1388;}})['then'](function(){return dbH[_0x5040('0x14')][_0x5040('0x15')](util[_0x5040('0xf')](_0x5040('0x16'),QUERY),{'type':dbH['sequelize'][_0x5040('0x17')][_0x5040('0x18')]});})[_0x5040('0x19')](function(_0x27a264){if(!_0x27a264[0x0][_0x5040('0x1a')]){return analyticExtractedReport(_0x5040('0x1b'));}var _0xbc766d=[];var _0x133983=0x0;if(_0x2ec416[_0x5040('0x1c')]){if(_0x27a264&&_0x27a264['length']){var _0x1da2ad=_[_0x5040('0x1d')](_0x27a264[0x0][_0x5040('0x1a')]/_0x419018);var _0xbcc7c9=Number[_0x5040('0x1e')](_0x27a264[0x0][_0x5040('0x1a')]/_0x419018)?_0x27a264[0x0]['num']%_0x419018:0x0;_0x1da2ad['forEach'](function(_0x44dc50){if(_0x44dc50>0x0){_0x133983+=_0x419018;}_0xbc766d[_0x5040('0x1f')](dbH[_0x5040('0x14')][_0x5040('0x15')](util['format'](_0x5040('0x20'),QUERY,_0x419018,_0x133983),{'type':dbH[_0x5040('0x14')][_0x5040('0x17')][_0x5040('0x18')]}));});if(_0xbcc7c9>0x0){_0x133983+=_0x419018;_0xbc766d[_0x5040('0x1f')](dbH[_0x5040('0x14')][_0x5040('0x15')](util[_0x5040('0xf')](_0x5040('0x20'),QUERY,_0xbcc7c9,_0x133983),{'type':dbH[_0x5040('0x14')]['QueryTypes'][_0x5040('0x18')]}));}}}else{_0xbc766d[_0x5040('0x1f')](dbH[_0x5040('0x14')]['query'](QUERY,{'type':dbH[_0x5040('0x14')]['QueryTypes'][_0x5040('0x18')]}));}var _0x29fd1e=path[_0x5040('0x21')](PATH);var _0x405711=path[_0x5040('0x22')](PATH,_0x5040('0x23'));var _0x588b02=_0x2ec416[_0x5040('0x1c')]&&_0xbc766d[_0x5040('0x24')]>0x1;var _0x4e1912=[];if(!fs[_0x5040('0x25')](path['join'](_0x29fd1e,_0x405711))&&_0x588b02){fs[_0x5040('0x26')](path[_0x5040('0x27')](_0x29fd1e,_0x405711));}return BPromise[_0x5040('0x28')](_0xbc766d,function(_0x46e0ef){_0x4e1912[_0x5040('0x1f')](_0x46e0ef);})[_0x5040('0x19')](function(){for(var _0x23f808=0x0;_0x23f808<_0x4e1912[_0x5040('0x24')];_0x23f808+=0x1){var _0x363088;var _0x5f1efc=_0x4e1912[_0x23f808];if(_0x588b02){_0x363088=path[_0x5040('0x27')](_0x29fd1e,_0x405711,util[_0x5040('0xf')](_0x5040('0x29'),_0x405711,_0x23f808,_0x5040('0x2a')));}else{_0x363088=path['join'](_0x29fd1e,util[_0x5040('0xf')](_0x5040('0x2b'),_0x405711,_0x5040('0x2a')));}fs[_0x5040('0x2c')](_0x363088,csv(_0x5f1efc));}})[_0x5040('0x19')](function(){if(_0x588b02){return new Promise(function(_0x5baca1){zipdir(path[_0x5040('0x27')](_0x29fd1e,_0x405711),{'saveTo':path[_0x5040('0x27')](_0x29fd1e,util[_0x5040('0xf')]('%s.%s',_0x405711,_0x5040('0x2d')))},function(_0x4877b0,_0x34b042){rimraf(path[_0x5040('0x27')](_0x29fd1e,_0x405711),function(){});_0x5baca1(_0x5040('0x2e'));});});}})[_0x5040('0x19')](function(){logger[_0x5040('0xe')](util[_0x5040('0xf')](_0x5040('0x2f'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x5040('0x30'),_0x588b02?util[_0x5040('0xf')](_0x5040('0x2b'),_0x405711,_0x588b02?_0x5040('0x2d'):_0x5040('0x2a')):null);});})[_0x5040('0x31')](function(_0x7b338e){logger[_0x5040('0xe')](util[_0x5040('0xf')](_0x5040('0x32'),EXTRACTED_REPORT_ID,_0x5040('0x11')),util[_0x5040('0x33')](_0x7b338e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x5040('0x34'));})[_0x5040('0x35')](function(){process[_0x5040('0x36')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x63b7=['length','range','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','push','dirname','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','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','exit','util','path','lodash','to-csv','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','QueryTypes','num','Empty'];(function(_0x2c9db2,_0x332b87){var _0x50db9e=function(_0xe6d02a){while(--_0xe6d02a){_0x2c9db2['push'](_0x2c9db2['shift']());}};_0x50db9e(++_0x332b87);}(_0x63b7,0x18c));var _0x763b=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x63b7[_0x5447fd];return _0x15b28a;};'use strict';var util=require(_0x763b('0x0'));var path=require(_0x763b('0x1'));var _=require(_0x763b('0x2'));var csv=require(_0x763b('0x3'));var fs=require('fs');var BPromise=require(_0x763b('0x4'));var zipdir=require(_0x763b('0x5'));var rimraf=require('rimraf');var db=require(_0x763b('0x6'))['db'];var dbH=require('../../mysqldb')[_0x763b('0x7')];var logger=require(_0x763b('0x8'))(_0x763b('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x763b('0xa')][0x3];var PATH=process[_0x763b('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x45431d,_0x686d81){var _0x4e635d={'status':_0x45431d};var _0x3fd520={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x686d81){_0x4e635d[_0x763b('0xb')]=_0x686d81;}return db[_0x763b('0xc')][_0x763b('0xd')](_0x4e635d,_0x3fd520);}function main(){var _0x437e1b=0x1388;var _0x27e8c5;logger[_0x763b('0xe')](util[_0x763b('0xf')](_0x763b('0x10'),EXTRACTED_REPORT_ID,_0x763b('0x11')));return db[_0x763b('0x12')][_0x763b('0x13')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x763b('0x14'),_0x763b('0x15')]})[_0x763b('0x16')](function(_0x5b4ff9){if(_0x5b4ff9){_0x27e8c5=_0x5b4ff9;_0x437e1b=_0x27e8c5[_0x763b('0x15')]||0x1388;}})[_0x763b('0x16')](function(){return dbH[_0x763b('0x17')][_0x763b('0x18')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x763b('0x17')][_0x763b('0x19')]['SELECT']});})[_0x763b('0x16')](function(_0x45cfdc){if(!_0x45cfdc[0x0][_0x763b('0x1a')]){return analyticExtractedReport(_0x763b('0x1b'));}var _0x3a7ebc=[];var _0x5844c1=0x0;if(_0x27e8c5['split']){if(_0x45cfdc&&_0x45cfdc[_0x763b('0x1c')]){var _0x3b5844=_[_0x763b('0x1d')](_0x45cfdc[0x0][_0x763b('0x1a')]/_0x437e1b);var _0x43c68b=Number[_0x763b('0x1e')](_0x45cfdc[0x0]['num']/_0x437e1b)?_0x45cfdc[0x0][_0x763b('0x1a')]%_0x437e1b:0x0;_0x3b5844[_0x763b('0x1f')](function(_0x2a7649){if(_0x2a7649>0x0){_0x5844c1+=_0x437e1b;}_0x3a7ebc['push'](dbH[_0x763b('0x17')]['query'](util[_0x763b('0xf')](_0x763b('0x20'),QUERY,_0x437e1b,_0x5844c1),{'type':dbH['sequelize'][_0x763b('0x19')][_0x763b('0x21')]}));});if(_0x43c68b>0x0){_0x5844c1+=_0x437e1b;_0x3a7ebc[_0x763b('0x22')](dbH[_0x763b('0x17')]['query'](util[_0x763b('0xf')](_0x763b('0x20'),QUERY,_0x43c68b,_0x5844c1),{'type':dbH[_0x763b('0x17')][_0x763b('0x19')]['SELECT']}));}}}else{_0x3a7ebc[_0x763b('0x22')](dbH[_0x763b('0x17')][_0x763b('0x18')](QUERY,{'type':dbH[_0x763b('0x17')][_0x763b('0x19')][_0x763b('0x21')]}));}var _0xbf08b=path[_0x763b('0x23')](PATH);var _0x4ab803=path['basename'](PATH,_0x763b('0x24'));var _0x12f6f0=_0x27e8c5['split']&&_0x3a7ebc[_0x763b('0x1c')]>0x1;var _0x14a2b8=[];if(!fs[_0x763b('0x25')](path[_0x763b('0x26')](_0xbf08b,_0x4ab803))&&_0x12f6f0){fs[_0x763b('0x27')](path['join'](_0xbf08b,_0x4ab803));}return BPromise[_0x763b('0x28')](_0x3a7ebc,function(_0x3f8b44){_0x14a2b8[_0x763b('0x22')](_0x3f8b44);})[_0x763b('0x16')](function(){for(var _0x83a9c9=0x0;_0x83a9c9<_0x14a2b8[_0x763b('0x1c')];_0x83a9c9+=0x1){var _0x101863;var _0x51c0c2=_0x14a2b8[_0x83a9c9];if(_0x12f6f0){_0x101863=path[_0x763b('0x26')](_0xbf08b,_0x4ab803,util[_0x763b('0xf')](_0x763b('0x29'),_0x4ab803,_0x83a9c9,_0x763b('0x2a')));}else{_0x101863=path[_0x763b('0x26')](_0xbf08b,util[_0x763b('0xf')](_0x763b('0x2b'),_0x4ab803,_0x763b('0x2a')));}fs[_0x763b('0x2c')](_0x101863,csv(_0x51c0c2));}})[_0x763b('0x16')](function(){if(_0x12f6f0){return new Promise(function(_0x258dea){zipdir(path[_0x763b('0x26')](_0xbf08b,_0x4ab803),{'saveTo':path[_0x763b('0x26')](_0xbf08b,util[_0x763b('0xf')]('%s.%s',_0x4ab803,_0x763b('0x2d')))},function(_0x2ef52b,_0x71d535){rimraf(path['join'](_0xbf08b,_0x4ab803),function(){});_0x258dea(_0x763b('0x2e'));});});}})[_0x763b('0x16')](function(){logger['info'](util[_0x763b('0xf')](_0x763b('0x2f'),EXTRACTED_REPORT_ID,_0x763b('0x11')));return analyticExtractedReport(_0x763b('0x30'),_0x12f6f0?util['format'](_0x763b('0x2b'),_0x4ab803,_0x12f6f0?_0x763b('0x2d'):_0x763b('0x2a')):null);});})[_0x763b('0x31')](function(_0x542bca){logger['info'](util[_0x763b('0xf')](_0x763b('0x32'),EXTRACTED_REPORT_ID,_0x763b('0x11')),util['inspect'](_0x542bca,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x763b('0x33'));})['finally'](function(){process[_0x763b('0x34')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 4a61e7f..8fbc2b4 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 _0x22e9=['body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','header','pageBreak','before','landscape','\x20/\x20','footer','Arial','right','num','Empty','Setting','split','splitSizePdf','then','range','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','sequelize','dirname','join','mkdirSync','each','createPdfKitDocument','%s%d.%s','pdf','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-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','finish','error','lodash','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','tableHeader','map','pick','fill','length','auto'];(function(_0x2bb82d,_0x42c7f8){var _0x5e0b92=function(_0x19f44b){while(--_0x19f44b){_0x2bb82d['push'](_0x2bb82d['shift']());}};_0x5e0b92(++_0x42c7f8);}(_0x22e9,0x18d));var _0x922e=function(_0x32bbb1,_0xa0e27e){_0x32bbb1=_0x32bbb1-0x0;var _0x42b415=_0x22e9[_0x32bbb1];return _0x42b415;};'use strict';var _=require(_0x922e('0x0'));var fs=require('fs');var util=require(_0x922e('0x1'));var path=require(_0x922e('0x2'));var moment=require(_0x922e('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x922e('0x4'));var zipdir=require(_0x922e('0x5'));var rimraf=require(_0x922e('0x6'));var JSDOM=require(_0x922e('0x7'))[_0x922e('0x8')];var window=new JSDOM('')['window'];var BPromise=require(_0x922e('0x9'));var db=require(_0x922e('0xa'))['db'];var dbH=require('../../mysqldb')[_0x922e('0xb')];var logger=require(_0x922e('0xc'))(_0x922e('0xd'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x922e('0xe')][0x4];var NAME=process[_0x922e('0xe')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1282c6,_0x242abd){var _0x3a166c={'status':_0x1282c6};var _0x5e5a91={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x242abd){_0x3a166c[_0x922e('0xf')]=_0x242abd;}return db[_0x922e('0x10')]['update'](_0x3a166c,_0x5e5a91);}function getHeaders(_0x26f5b8){return _['map'](_0x26f5b8,function(_0x46edf1){return{'text':_0x46edf1,'style':_0x922e('0x11')};});}function getRows(_0x175e3d,_0x4f3f52){return _[_0x922e('0x12')](_0x4f3f52,function(_0x440466){return _(_0x440466)[_0x922e('0x13')](_0x175e3d)[_0x922e('0x12')](function(_0xc33442){return _0xc33442?_['toString'](_0xc33442):'';})['value']();});}function createTable(_0x4e7c92,_0x1f2e43){var _0x46be54={'widths':_[_0x922e('0x14')](Array(_0x4e7c92[_0x922e('0x15')]),0x91),'heights':function(_0x44da79){return _0x44da79===0x0?_0x922e('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x5f42a6=getHeaders(_0x4e7c92);_0x46be54[_0x922e('0x17')][_0x922e('0x18')](_0x5f42a6);var _0x172f81=getRows(_0x4e7c92,_0x1f2e43);_0x46be54['body']=_0x46be54['body'][_0x922e('0x19')](_0x172f81);return _0x46be54;}function createTables(_0x35f23b){var _0x520874=[];var _0x19962c=_[_0x922e('0x1a')](Object[_0x922e('0x1b')](_0x35f23b[0x0]),0x5);_0x19962c[_0x922e('0x1c')](function(_0x7a17f2){_0x520874['push'](createTable(_0x7a17f2,_0x35f23b));});return _0x520874;}function getPDFDocDefinition(_0xf3b48b){var _0xfe32d4=util[_0x922e('0x1d')](_0x922e('0x1e'),NAME,EXTRACTED_REPORT[_0x922e('0x1f')],moment(EXTRACTED_REPORT['startDate'])[_0x922e('0x1d')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x922e('0x1d')](FORMAT));var _0x4dd9a2=[];for(var _0x5cabd2=0x0;_0x5cabd2<_0xf3b48b[_0x922e('0x15')];_0x5cabd2++){var _0x22b0c7=[];if(_0x5cabd2===0x0){_0x22b0c7[_0x922e('0x18')]({'text':_0xfe32d4,'style':_0x922e('0x20')});}var _0x2bb885={'table':_0xf3b48b[_0x5cabd2]};if(_0x5cabd2>0x0){_0x2bb885[_0x922e('0x21')]=_0x922e('0x22');_0x2bb885['margin']=[0x0,0x46,0x0,0x0];}_0x22b0c7[_0x922e('0x18')](_0x2bb885);_0x4dd9a2[_0x922e('0x18')](_0x22b0c7);}return{'pageSize':'A4','pageOrientation':_0x922e('0x23'),'content':_0x4dd9a2,'footer':function(_0x2664b3,_0x138204){return{'text':_0x2664b3['toString']()+_0x922e('0x24')+_0x138204,'style':_0x922e('0x25')};},'defaultStyle':{'font':_0x922e('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x922e('0x27'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x44b103){var _0x45f6ff=0x1388;var _0x3d8b38;if(!_0x44b103[0x0][_0x922e('0x28')]){return analyticExtractedReport(_0x922e('0x29'));}return db[_0x922e('0x2a')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x922e('0x2b'),_0x922e('0x2c')]})[_0x922e('0x2d')](function(_0x2ca4e1){if(_0x2ca4e1){_0x3d8b38=_0x2ca4e1;_0x45f6ff=_0x3d8b38[_0x922e('0x2c')]||0x3e8;}})['then'](function(){var _0x279467=[];var _0x4ac725=0x0;if(_0x3d8b38['split']){if(_0x44b103&&_0x44b103['length']){var _0x295965=_[_0x922e('0x2e')](_0x44b103[0x0][_0x922e('0x28')]/_0x45f6ff);var _0x3f5fb7=Number['isInteger'](_0x44b103[0x0][_0x922e('0x28')]/_0x45f6ff)?_0x44b103[0x0][_0x922e('0x28')]%_0x45f6ff:0x0;_0x295965[_0x922e('0x1c')](function(_0x43fc4f){if(_0x43fc4f>0x0){_0x4ac725+=_0x45f6ff;}_0x279467[_0x922e('0x18')](dbH['sequelize'][_0x922e('0x2f')](util[_0x922e('0x1d')](_0x922e('0x30'),QUERY,_0x45f6ff,_0x4ac725),{'type':dbH['sequelize'][_0x922e('0x31')][_0x922e('0x32')]}));});if(_0x3f5fb7>0x0){_0x4ac725+=_0x45f6ff;_0x279467[_0x922e('0x18')](dbH[_0x922e('0x33')][_0x922e('0x2f')](util[_0x922e('0x1d')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3f5fb7,_0x4ac725),{'type':dbH['sequelize'][_0x922e('0x31')][_0x922e('0x32')]}));}}}else{_0x279467[_0x922e('0x18')](dbH[_0x922e('0x33')][_0x922e('0x2f')](QUERY,{'type':dbH['sequelize'][_0x922e('0x31')][_0x922e('0x32')]}));}var _0x341e3b=path[_0x922e('0x34')](PATH);var _0x135467=path['basename'](PATH,'.pdf');var _0x46bf3d=_0x3d8b38[_0x922e('0x2b')]&&_0x279467['length']>0x1;var _0x5f0219=[];if(!fs['existsSync'](path[_0x922e('0x35')](_0x341e3b,_0x135467))&&_0x46bf3d){fs[_0x922e('0x36')](path[_0x922e('0x35')](_0x341e3b,_0x135467));}return BPromise[_0x922e('0x37')](_0x279467,function(_0x4158e4){_0x5f0219[_0x922e('0x18')](_0x4158e4);})[_0x922e('0x2d')](function(){var _0x472d6e=[];for(var _0x560fa3=0x0;_0x560fa3<_0x5f0219['length'];_0x560fa3+=0x1){var _0x59f61f=_0x5f0219[_0x560fa3];var _0x1994ff=createTables(_['flatten'](_0x59f61f));var _0x63931e;var _0x34279f=getPDFDocDefinition(_0x1994ff);var _0x280fb0=getPDFPrinter();var _0x5149ea=_0x280fb0[_0x922e('0x38')](_0x34279f);if(_0x46bf3d){_0x63931e=path[_0x922e('0x35')](_0x341e3b,_0x135467,util[_0x922e('0x1d')](_0x922e('0x39'),_0x135467,_0x560fa3,_0x922e('0x3a')));}else{_0x63931e=path[_0x922e('0x35')](_0x341e3b,util['format'](_0x922e('0x3b'),_0x135467,_0x922e('0x3a')));}_0x472d6e[_0x922e('0x18')](writePDFDocument(_0x5149ea,_0x63931e));}return Promise['all'](_0x472d6e);})[_0x922e('0x2d')](function(){if(_0x46bf3d){return new Promise(function(_0x4fd5be){zipdir(path[_0x922e('0x35')](_0x341e3b,_0x135467),{'saveTo':path[_0x922e('0x35')](_0x341e3b,util['format'](_0x922e('0x3b'),_0x135467,_0x922e('0x3c')))},function(){rimraf(path[_0x922e('0x35')](_0x341e3b,_0x135467),function(){});_0x4fd5be(_0x922e('0x3d'));});});}})[_0x922e('0x2d')](function(){if(!_0x46bf3d)return;rimraf(path[_0x922e('0x35')](_0x341e3b,_0x135467),function(){});})[_0x922e('0x2d')](function(){logger[_0x922e('0x3e')](util[_0x922e('0x1d')](_0x922e('0x3f'),EXTRACTED_REPORT_ID,_0x922e('0x40')));return analyticExtractedReport('Completed',_0x46bf3d?util[_0x922e('0x1d')]('%s.%s',_0x135467,_0x46bf3d?_0x922e('0x3c'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x922e('0x3e')](util['format'](_0x922e('0x41'),EXTRACTED_REPORT_ID,_0x922e('0x40')));return db[_0x922e('0x10')][_0x922e('0x42')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x922e('0x2d')](function(_0x41bd88){EXTRACTED_REPORT=_0x41bd88;return dbH[_0x922e('0x33')][_0x922e('0x2f')](util[_0x922e('0x1d')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x922e('0x33')][_0x922e('0x31')][_0x922e('0x32')]});})[_0x922e('0x2d')](extractReport)[_0x922e('0x43')](function(_0x45ad62){logger[_0x922e('0x3e')](util[_0x922e('0x1d')](_0x922e('0x44'),EXTRACTED_REPORT_ID,_0x922e('0x40')),util[_0x922e('0x45')](_0x45ad62,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x922e('0x46'));})[_0x922e('0x47')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x34b04f=new PdfPrinter({'Arial':{'normal':__dirname+_0x922e('0x48'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x922e('0x49'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x34b04f;}function getPDFDocDefinitionFromHTML(_0x4e79e7,_0x21196a){var _0x47dc63=util[_0x922e('0x1d')](_0x922e('0x4a'),_0x21196a[_0x922e('0x4b')],_0x21196a[_0x922e('0x4c')]);var _0x2721f4=moment()[_0x922e('0x1d')](_0x922e('0x4d'))[_0x922e('0x4e')]();var _0x3b8dfb=htmlToPdfmake(_0x4e79e7,{'window':window,'tableAutoSize':!![]});return{'content':[_0x3b8dfb],'defaultStyle':{'font':_0x922e('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x922e('0x4f'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x922e('0x50'),'style':_0x922e('0x20')}];},'footer':function(_0x5f0e31,_0x1c112b){return[{'text':util[_0x922e('0x1d')](_0x922e('0x51'),_0x47dc63,_0x5f0e31,_0x1c112b,_0x2721f4),'style':_0x922e('0x25')}];}};}function writePDFDocument(_0x5e9749,_0x469052){return new Promise(function(_0x33843b,_0x2f86cf){var _0x103ced=_0x5e9749['pipe'](fs['createWriteStream'](_0x469052));_0x103ced['on'](_0x922e('0x52'),function(){_0x33843b(_0x922e('0x52'));});_0x103ced['on'](_0x922e('0x53'),function(_0x145a7b){_0x2f86cf(_0x145a7b);});_0x5e9749['end']();});}exports['createPdfFromHTML']=function(_0x1572eb,_0x559548){var _0x10e415=getPDFPrinter();var _0x15053f=getPDFDocDefinitionFromHTML(_0x1572eb,_0x559548);var _0x4e1dc7=_0x10e415[_0x922e('0x38')](_0x15053f);return writePDFDocument(_0x4e1dc7,_0x559548[_0x922e('0x2')])['catch'](function(_0x2f268e){throw _0x2f268e;});}; \ No newline at end of file +var _0x344f=['right','num','Empty','find','split','splitSizePdf','then','range','isInteger','forEach','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','existsSync','mkdirSync','join','flatten','createPdfKitDocument','all','%s.%s','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','pdf','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId','YYYY-MM-DD','Arial','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','error','end','createPdfFromHTML','lodash','util','path','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','toString','push','concat','chunk','keys','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','format','length','header','pageBreak','before','\x20/\x20','black'];(function(_0xaf12b7,_0x40c929){var _0x4fefde=function(_0x3cb99d){while(--_0x3cb99d){_0xaf12b7['push'](_0xaf12b7['shift']());}};_0x4fefde(++_0x40c929);}(_0x344f,0x136));var _0xf344=function(_0x2a4d52,_0x20357b){_0x2a4d52=_0x2a4d52-0x0;var _0x426932=_0x344f[_0x2a4d52];return _0x426932;};'use strict';var _=require(_0xf344('0x0'));var fs=require('fs');var util=require(_0xf344('0x1'));var path=require(_0xf344('0x2'));var moment=require('moment');var htmlToPdfmake=require(_0xf344('0x3'));var PdfPrinter=require(_0xf344('0x4'));var zipdir=require(_0xf344('0x5'));var rimraf=require(_0xf344('0x6'));var JSDOM=require('jsdom')[_0xf344('0x7')];var window=new JSDOM('')[_0xf344('0x8')];var BPromise=require(_0xf344('0x9'));var db=require('../../mysqldb')['db'];var dbH=require(_0xf344('0xa'))[_0xf344('0xb')];var logger=require(_0xf344('0xc'))(_0xf344('0xd'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xf344('0xe')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xf344('0xe')][0x5];var FORMAT=_0xf344('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x26b81e,_0x5460eb){var _0x31db1d={'status':_0x26b81e};var _0xb2f20a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5460eb){_0x31db1d[_0xf344('0x10')]=_0x5460eb;}return db[_0xf344('0x11')][_0xf344('0x12')](_0x31db1d,_0xb2f20a);}function getHeaders(_0x4d3fb5){return _[_0xf344('0x13')](_0x4d3fb5,function(_0x2a9dc1){return{'text':_0x2a9dc1,'style':'tableHeader'};});}function getRows(_0x475fc3,_0xc2a9cd){return _[_0xf344('0x13')](_0xc2a9cd,function(_0xd75eb8){return _(_0xd75eb8)['pick'](_0x475fc3)[_0xf344('0x13')](function(_0x15d7d4){return _0x15d7d4?_[_0xf344('0x14')](_0x15d7d4):'';})['value']();});}function createTable(_0xbc8a25,_0x4016f0){var _0xf109b5={'widths':_['fill'](Array(_0xbc8a25['length']),0x91),'heights':function(_0x3fff1b){return _0x3fff1b===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x43d602=getHeaders(_0xbc8a25);_0xf109b5['body'][_0xf344('0x15')](_0x43d602);var _0x46c195=getRows(_0xbc8a25,_0x4016f0);_0xf109b5['body']=_0xf109b5['body'][_0xf344('0x16')](_0x46c195);return _0xf109b5;}function createTables(_0x5255d6){var _0x20ed7a=[];var _0x5569c=_[_0xf344('0x17')](Object[_0xf344('0x18')](_0x5255d6[0x0]),0x5);_0x5569c['forEach'](function(_0x14ca7f){_0x20ed7a[_0xf344('0x15')](createTable(_0x14ca7f,_0x5255d6));});return _0x20ed7a;}function getPDFDocDefinition(_0x55985b){var _0x2cda0e=util['format'](_0xf344('0x19'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0xf344('0x1a')])[_0xf344('0x1b')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0xf344('0x1b')](FORMAT));var _0x200513=[];for(var _0x5686a4=0x0;_0x5686a4<_0x55985b[_0xf344('0x1c')];_0x5686a4++){var _0x113b3f=[];if(_0x5686a4===0x0){_0x113b3f['push']({'text':_0x2cda0e,'style':_0xf344('0x1d')});}var _0x5c3af5={'table':_0x55985b[_0x5686a4]};if(_0x5686a4>0x0){_0x5c3af5[_0xf344('0x1e')]=_0xf344('0x1f');_0x5c3af5['margin']=[0x0,0x46,0x0,0x0];}_0x113b3f[_0xf344('0x15')](_0x5c3af5);_0x200513[_0xf344('0x15')](_0x113b3f);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x200513,'footer':function(_0x10e277,_0x123fb2){return{'text':_0x10e277[_0xf344('0x14')]()+_0xf344('0x20')+_0x123fb2,'style':'footer'};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xf344('0x21')},'footer':{'alignment':_0xf344('0x22'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x41d5a2){var _0x215df5=0x1388;var _0x4ea94a;if(!_0x41d5a2[0x0][_0xf344('0x23')]){return analyticExtractedReport(_0xf344('0x24'));}return db['Setting'][_0xf344('0x25')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf344('0x26'),_0xf344('0x27')]})['then'](function(_0x407c48){if(_0x407c48){_0x4ea94a=_0x407c48;_0x215df5=_0x4ea94a[_0xf344('0x27')]||0x3e8;}})[_0xf344('0x28')](function(){var _0x314d90=[];var _0x34beec=0x0;if(_0x4ea94a[_0xf344('0x26')]){if(_0x41d5a2&&_0x41d5a2[_0xf344('0x1c')]){var _0x2780c9=_[_0xf344('0x29')](_0x41d5a2[0x0][_0xf344('0x23')]/_0x215df5);var _0x5e9582=Number[_0xf344('0x2a')](_0x41d5a2[0x0]['num']/_0x215df5)?_0x41d5a2[0x0]['num']%_0x215df5:0x0;_0x2780c9[_0xf344('0x2b')](function(_0x3f4a07){if(_0x3f4a07>0x0){_0x34beec+=_0x215df5;}_0x314d90['push'](dbH[_0xf344('0x2c')][_0xf344('0x2d')](util[_0xf344('0x1b')](_0xf344('0x2e'),QUERY,_0x215df5,_0x34beec),{'type':dbH['sequelize'][_0xf344('0x2f')][_0xf344('0x30')]}));});if(_0x5e9582>0x0){_0x34beec+=_0x215df5;_0x314d90[_0xf344('0x15')](dbH[_0xf344('0x2c')][_0xf344('0x2d')](util[_0xf344('0x1b')](_0xf344('0x2e'),QUERY,_0x5e9582,_0x34beec),{'type':dbH['sequelize'][_0xf344('0x2f')][_0xf344('0x30')]}));}}}else{_0x314d90[_0xf344('0x15')](dbH['sequelize'][_0xf344('0x2d')](QUERY,{'type':dbH[_0xf344('0x2c')][_0xf344('0x2f')]['SELECT']}));}var _0x3f3edf=path[_0xf344('0x31')](PATH);var _0x5de014=path[_0xf344('0x32')](PATH,'.pdf');var _0x1d88f0=_0x4ea94a['split']&&_0x314d90[_0xf344('0x1c')]>0x1;var _0xe1a58d=[];if(!fs[_0xf344('0x33')](path['join'](_0x3f3edf,_0x5de014))&&_0x1d88f0){fs[_0xf344('0x34')](path[_0xf344('0x35')](_0x3f3edf,_0x5de014));}return BPromise['each'](_0x314d90,function(_0x5a279c){_0xe1a58d['push'](_0x5a279c);})[_0xf344('0x28')](function(){var _0x283fc4=[];for(var _0x36724c=0x0;_0x36724c<_0xe1a58d[_0xf344('0x1c')];_0x36724c+=0x1){var _0x327568=_0xe1a58d[_0x36724c];var _0x166647=createTables(_[_0xf344('0x36')](_0x327568));var _0x3255a3;var _0x1c203f=getPDFDocDefinition(_0x166647);var _0xad22da=getPDFPrinter();var _0x133724=_0xad22da[_0xf344('0x37')](_0x1c203f);if(_0x1d88f0){_0x3255a3=path[_0xf344('0x35')](_0x3f3edf,_0x5de014,util[_0xf344('0x1b')]('%s%d.%s',_0x5de014,_0x36724c,'pdf'));}else{_0x3255a3=path[_0xf344('0x35')](_0x3f3edf,util[_0xf344('0x1b')]('%s.%s',_0x5de014,'pdf'));}_0x283fc4[_0xf344('0x15')](writePDFDocument(_0x133724,_0x3255a3));}return Promise[_0xf344('0x38')](_0x283fc4);})[_0xf344('0x28')](function(){if(_0x1d88f0){return new Promise(function(_0x254357){zipdir(path[_0xf344('0x35')](_0x3f3edf,_0x5de014),{'saveTo':path['join'](_0x3f3edf,util[_0xf344('0x1b')](_0xf344('0x39'),_0x5de014,'zip'))},function(){rimraf(path[_0xf344('0x35')](_0x3f3edf,_0x5de014),function(){});_0x254357(_0xf344('0x3a'));});});}})[_0xf344('0x28')](function(){if(!_0x1d88f0)return;rimraf(path[_0xf344('0x35')](_0x3f3edf,_0x5de014),function(){});})['then'](function(){logger[_0xf344('0x3b')](util[_0xf344('0x1b')](_0xf344('0x3c'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0xf344('0x3d'),_0x1d88f0?util[_0xf344('0x1b')]('%s.%s',_0x5de014,_0x1d88f0?_0xf344('0x3e'):_0xf344('0x3f')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xf344('0x3b')](util[_0xf344('0x1b')](_0xf344('0x40'),EXTRACTED_REPORT_ID,_0xf344('0x41')));return db[_0xf344('0x11')][_0xf344('0x42')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xf344('0x28')](function(_0x5ce93d){EXTRACTED_REPORT=_0x5ce93d;return dbH[_0xf344('0x2c')][_0xf344('0x2d')](util[_0xf344('0x1b')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize']['QueryTypes'][_0xf344('0x30')]});})['then'](extractReport)[_0xf344('0x43')](function(_0x4a207d){logger[_0xf344('0x3b')](util['format'](_0xf344('0x44'),EXTRACTED_REPORT_ID,_0xf344('0x41')),util[_0xf344('0x45')](_0x4a207d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xf344('0x46')](function(){process[_0xf344('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x5130f3=new PdfPrinter({'Arial':{'normal':__dirname+_0xf344('0x48'),'bold':__dirname+_0xf344('0x49'),'italics':__dirname+_0xf344('0x4a'),'bolditalics':__dirname+_0xf344('0x4b')}});return _0x5130f3;}function getPDFDocDefinitionFromHTML(_0x22edd3,_0x3f652d){var _0x14e6ca=util[_0xf344('0x1b')]('%s\x20#%d',_0x3f652d[_0xf344('0x4c')],_0x3f652d[_0xf344('0x4d')]);var _0x3f0002=moment()[_0xf344('0x1b')](_0xf344('0x4e'))['toString']();var _0x3d627e=htmlToPdfmake(_0x22edd3,{'window':window,'tableAutoSize':!![]});return{'content':[_0x3d627e],'defaultStyle':{'font':_0xf344('0x4f')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xf344('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xf344('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xf344('0x50')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':'header'}];},'footer':function(_0x4980d4,_0x3777aa){return[{'text':util['format'](_0xf344('0x51'),_0x14e6ca,_0x4980d4,_0x3777aa,_0x3f0002),'style':'footer'}];}};}function writePDFDocument(_0x34d2ca,_0x2df498){return new Promise(function(_0x9c4410,_0x59adcf){var _0x4dc75e=_0x34d2ca[_0xf344('0x52')](fs['createWriteStream'](_0x2df498));_0x4dc75e['on']('finish',function(){_0x9c4410('finish');});_0x4dc75e['on'](_0xf344('0x53'),function(_0x286e57){_0x59adcf(_0x286e57);});_0x34d2ca[_0xf344('0x54')]();});}exports[_0xf344('0x55')]=function(_0x538835,_0x33ec18){var _0x52685b=getPDFPrinter();var _0x1766e6=getPDFDocDefinitionFromHTML(_0x538835,_0x33ec18);var _0x167bb8=_0x52685b[_0xf344('0x37')](_0x1766e6);return writePDFDocument(_0x167bb8,_0x33ec18[_0xf344('0x2')])[_0xf344('0x43')](function(_0x165130){throw _0x165130;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index c7e21cf..6574a80 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 _0x2854=['dirname','basename','existsSync','join','mkdirSync','each','length','%s%d.%s','xlsx','%s.%s','writeFileSync','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','splitSizeXlsx','then','sequelize','query','QueryTypes','SELECT','Empty','range','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d'];(function(_0x3fc2ca,_0x216ef7){var _0x436186=function(_0x10e593){while(--_0x10e593){_0x3fc2ca['push'](_0x3fc2ca['shift']());}};_0x436186(++_0x216ef7);}(_0x2854,0xaa));var _0x4285=function(_0x1d9b61,_0x3e1b2e){_0x1d9b61=_0x1d9b61-0x0;var _0x2e8717=_0x2854[_0x1d9b61];return _0x2e8717;};'use strict';var util=require(_0x4285('0x0'));var path=require('path');var _=require(_0x4285('0x1'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x4285('0x2'));var zipdir=require(_0x4285('0x3'));var rimraf=require(_0x4285('0x4'));var db=require(_0x4285('0x5'))['db'];var dbH=require(_0x4285('0x5'))[_0x4285('0x6')];var logger=require(_0x4285('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x4285('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x317416,_0x3dcea0){var _0x4f7faf={'status':_0x317416};var _0x2edd78={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3dcea0){_0x4f7faf[_0x4285('0x9')]=_0x3dcea0;}return db['AnalyticExtractedReport'][_0x4285('0xa')](_0x4f7faf,_0x2edd78);}function main(){var _0x440880=0x1388;var _0x2759c1;logger[_0x4285('0xb')](util[_0x4285('0xc')](_0x4285('0xd'),EXTRACTED_REPORT_ID,_0x4285('0xe')));return db[_0x4285('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4285('0x10'),_0x4285('0x11')]})[_0x4285('0x12')](function(_0x219bb9){if(_0x219bb9){_0x2759c1=_0x219bb9;_0x440880=_0x2759c1['splitSizeXlsx']||0x1388;}})[_0x4285('0x12')](function(){return dbH[_0x4285('0x13')][_0x4285('0x14')](util[_0x4285('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x4285('0x13')][_0x4285('0x15')][_0x4285('0x16')]});})[_0x4285('0x12')](function(_0x248853){if(!_0x248853[0x0]['num']){return analyticExtractedReport(_0x4285('0x17'));}var _0x52b05b=[];var _0x1e85a4=0x0;if(_0x2759c1[_0x4285('0x10')]){if(_0x248853&&_0x248853['length']){var _0x450dbb=_[_0x4285('0x18')](_0x248853[0x0][_0x4285('0x19')]/_0x440880);var _0x148673=Number[_0x4285('0x1a')](_0x248853[0x0][_0x4285('0x19')]/_0x440880)?_0x248853[0x0]['num']%_0x440880:0x0;_0x450dbb[_0x4285('0x1b')](function(_0xc21d05){if(_0xc21d05>0x0){_0x1e85a4+=_0x440880;}_0x52b05b[_0x4285('0x1c')](dbH[_0x4285('0x13')][_0x4285('0x14')](util[_0x4285('0xc')](_0x4285('0x1d'),QUERY,_0x440880,_0x1e85a4),{'type':dbH[_0x4285('0x13')][_0x4285('0x15')][_0x4285('0x16')]}));});if(_0x148673>0x0){_0x1e85a4+=_0x440880;_0x52b05b[_0x4285('0x1c')](dbH['sequelize'][_0x4285('0x14')](util[_0x4285('0xc')](_0x4285('0x1d'),QUERY,_0x148673,_0x1e85a4),{'type':dbH['sequelize'][_0x4285('0x15')][_0x4285('0x16')]}));}}}else{_0x52b05b[_0x4285('0x1c')](dbH[_0x4285('0x13')][_0x4285('0x14')](QUERY,{'type':dbH[_0x4285('0x13')]['QueryTypes'][_0x4285('0x16')]}));}var _0x252f86=path[_0x4285('0x1e')](PATH);var _0x39af8c=path[_0x4285('0x1f')](PATH,'.xlsx');var _0x1fa890=_0x2759c1[_0x4285('0x10')]&&_0x52b05b['length']>0x1;var _0x1a1759=[];if(!fs[_0x4285('0x20')](path[_0x4285('0x21')](_0x252f86,_0x39af8c))&&_0x1fa890){fs[_0x4285('0x22')](path['join'](_0x252f86,_0x39af8c));}return BPromise[_0x4285('0x23')](_0x52b05b,function(_0x9c6fa2){_0x1a1759[_0x4285('0x1c')](_0x9c6fa2);})[_0x4285('0x12')](function(){for(var _0x11267f=0x0;_0x11267f<_0x1a1759[_0x4285('0x24')];_0x11267f+=0x1){var _0x2d0651;var _0x5d45f2=_0x1a1759[_0x11267f];if(_0x1fa890){_0x2d0651=path['join'](_0x252f86,_0x39af8c,util[_0x4285('0xc')](_0x4285('0x25'),_0x39af8c,_0x11267f,_0x4285('0x26')));}else{_0x2d0651=path[_0x4285('0x21')](_0x252f86,util['format'](_0x4285('0x27'),_0x39af8c,_0x4285('0x26')));}fs[_0x4285('0x28')](_0x2d0651,json2xls(_0x5d45f2),'binary');}})[_0x4285('0x12')](function(){if(_0x1fa890){return new Promise(function(_0x3b33bb){zipdir(path[_0x4285('0x21')](_0x252f86,_0x39af8c),{'saveTo':path[_0x4285('0x21')](_0x252f86,util[_0x4285('0xc')]('%s.%s',_0x39af8c,'zip'))},function(_0x4dc987,_0x30321c){rimraf(path[_0x4285('0x21')](_0x252f86,_0x39af8c),function(){});_0x3b33bb(_0x4285('0x29'));});});}})[_0x4285('0x12')](function(){logger[_0x4285('0xb')](util[_0x4285('0xc')](_0x4285('0x2a'),EXTRACTED_REPORT_ID,_0x4285('0xe')));return analyticExtractedReport('Completed',_0x1fa890?util['format'](_0x4285('0x27'),_0x39af8c,_0x1fa890?_0x4285('0x2b'):_0x4285('0x26')):null);});})[_0x4285('0x2c')](function(_0x287064){logger['info'](util[_0x4285('0xc')](_0x4285('0x2d'),EXTRACTED_REPORT_ID,_0x4285('0xe')),util[_0x4285('0x2e')](_0x287064,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4285('0x2f'));})[_0x4285('0x30')](function(){process[_0x4285('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xf865=['%s.%s','writeFileSync','binary','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','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','Empty','length','range','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx'];(function(_0x25eded,_0x41cc67){var _0x134f75=function(_0xafa99d){while(--_0xafa99d){_0x25eded['push'](_0x25eded['shift']());}};_0x134f75(++_0x41cc67);}(_0xf865,0x11a));var _0x5f86=function(_0x28394f,_0x5ebdd2){_0x28394f=_0x28394f-0x0;var _0x2618d2=_0xf865[_0x28394f];return _0x2618d2;};'use strict';var util=require(_0x5f86('0x0'));var path=require(_0x5f86('0x1'));var _=require(_0x5f86('0x2'));var fs=require('fs');var json2xls=require(_0x5f86('0x3'));var BPromise=require(_0x5f86('0x4'));var zipdir=require(_0x5f86('0x5'));var rimraf=require(_0x5f86('0x6'));var db=require(_0x5f86('0x7'))['db'];var dbH=require(_0x5f86('0x7'))[_0x5f86('0x8')];var logger=require(_0x5f86('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x5f86('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x5f86('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5cb1f8,_0xa00a7f){var _0x4b657b={'status':_0x5cb1f8};var _0x74e6ff={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xa00a7f){_0x4b657b[_0x5f86('0xb')]=_0xa00a7f;}return db[_0x5f86('0xc')][_0x5f86('0xd')](_0x4b657b,_0x74e6ff);}function main(){var _0x27fd76=0x1388;var _0x20312d;logger[_0x5f86('0xe')](util['format'](_0x5f86('0xf'),EXTRACTED_REPORT_ID,_0x5f86('0x10')));return db[_0x5f86('0x11')][_0x5f86('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5f86('0x13'),'splitSizeXlsx']})[_0x5f86('0x14')](function(_0x3b3ecb){if(_0x3b3ecb){_0x20312d=_0x3b3ecb;_0x27fd76=_0x20312d['splitSizeXlsx']||0x1388;}})['then'](function(){return dbH[_0x5f86('0x15')][_0x5f86('0x16')](util[_0x5f86('0x17')](_0x5f86('0x18'),QUERY),{'type':dbH[_0x5f86('0x15')][_0x5f86('0x19')]['SELECT']});})[_0x5f86('0x14')](function(_0x4fec48){if(!_0x4fec48[0x0]['num']){return analyticExtractedReport(_0x5f86('0x1a'));}var _0x1c4c4c=[];var _0x436cec=0x0;if(_0x20312d[_0x5f86('0x13')]){if(_0x4fec48&&_0x4fec48[_0x5f86('0x1b')]){var _0x3d1cc2=_[_0x5f86('0x1c')](_0x4fec48[0x0][_0x5f86('0x1d')]/_0x27fd76);var _0x466990=Number['isInteger'](_0x4fec48[0x0][_0x5f86('0x1d')]/_0x27fd76)?_0x4fec48[0x0]['num']%_0x27fd76:0x0;_0x3d1cc2['forEach'](function(_0xa589b){if(_0xa589b>0x0){_0x436cec+=_0x27fd76;}_0x1c4c4c[_0x5f86('0x1e')](dbH[_0x5f86('0x15')][_0x5f86('0x16')](util[_0x5f86('0x17')](_0x5f86('0x1f'),QUERY,_0x27fd76,_0x436cec),{'type':dbH[_0x5f86('0x15')]['QueryTypes'][_0x5f86('0x20')]}));});if(_0x466990>0x0){_0x436cec+=_0x27fd76;_0x1c4c4c[_0x5f86('0x1e')](dbH[_0x5f86('0x15')][_0x5f86('0x16')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x466990,_0x436cec),{'type':dbH['sequelize'][_0x5f86('0x19')][_0x5f86('0x20')]}));}}}else{_0x1c4c4c[_0x5f86('0x1e')](dbH[_0x5f86('0x15')]['query'](QUERY,{'type':dbH[_0x5f86('0x15')]['QueryTypes'][_0x5f86('0x20')]}));}var _0x4f4029=path[_0x5f86('0x21')](PATH);var _0x3652ee=path[_0x5f86('0x22')](PATH,_0x5f86('0x23'));var _0x2b3f93=_0x20312d['split']&&_0x1c4c4c[_0x5f86('0x1b')]>0x1;var _0x522a20=[];if(!fs[_0x5f86('0x24')](path[_0x5f86('0x25')](_0x4f4029,_0x3652ee))&&_0x2b3f93){fs[_0x5f86('0x26')](path[_0x5f86('0x25')](_0x4f4029,_0x3652ee));}return BPromise[_0x5f86('0x27')](_0x1c4c4c,function(_0x2a619c){_0x522a20[_0x5f86('0x1e')](_0x2a619c);})[_0x5f86('0x14')](function(){for(var _0x30c66c=0x0;_0x30c66c<_0x522a20[_0x5f86('0x1b')];_0x30c66c+=0x1){var _0x3b1e47;var _0x419f20=_0x522a20[_0x30c66c];if(_0x2b3f93){_0x3b1e47=path[_0x5f86('0x25')](_0x4f4029,_0x3652ee,util[_0x5f86('0x17')](_0x5f86('0x28'),_0x3652ee,_0x30c66c,_0x5f86('0x29')));}else{_0x3b1e47=path[_0x5f86('0x25')](_0x4f4029,util[_0x5f86('0x17')](_0x5f86('0x2a'),_0x3652ee,_0x5f86('0x29')));}fs[_0x5f86('0x2b')](_0x3b1e47,json2xls(_0x419f20),_0x5f86('0x2c'));}})[_0x5f86('0x14')](function(){if(_0x2b3f93){return new Promise(function(_0x56e5ce){zipdir(path['join'](_0x4f4029,_0x3652ee),{'saveTo':path[_0x5f86('0x25')](_0x4f4029,util['format']('%s.%s',_0x3652ee,'zip'))},function(_0x41ec34,_0x5a4b90){rimraf(path[_0x5f86('0x25')](_0x4f4029,_0x3652ee),function(){});_0x56e5ce(_0x5f86('0x2d'));});});}})[_0x5f86('0x14')](function(){logger[_0x5f86('0xe')](util['format'](_0x5f86('0x2e'),EXTRACTED_REPORT_ID,_0x5f86('0x10')));return analyticExtractedReport(_0x5f86('0x2f'),_0x2b3f93?util[_0x5f86('0x17')](_0x5f86('0x2a'),_0x3652ee,_0x2b3f93?_0x5f86('0x30'):_0x5f86('0x29')):null);});})[_0x5f86('0x31')](function(_0x24ec3a){logger['info'](util[_0x5f86('0x17')](_0x5f86('0x32'),EXTRACTED_REPORT_ID,_0x5f86('0x10')),util[_0x5f86('0x33')](_0x24ec3a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x5f86('0x34'));})[_0x5f86('0x35')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index f4759b0..da72420 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 _0x1134=['then','findAll','VoiceExtension','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','queue','playback','hasOwnProperty','priority','extensions','extension','format','CDR(type)=%s','type','inbound','push','Set','CDR(routeid)=','VoiceExtensionId','context','outbound','cutdigits','${EXTEN:','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','*,*,*,*','interval','IntervalId','intervals','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','app','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','error','rewrite','lodash','models','Interval'];(function(_0x45afc1,_0x52a029){var _0x182539=function(_0x547e72){while(--_0x547e72){_0x45afc1['push'](_0x45afc1['shift']());}};_0x182539(++_0x52a029);}(_0x1134,0x1e0));var _0x4113=function(_0x3c65cc,_0x1104b3){_0x3c65cc=_0x3c65cc-0x0;var _0x21a62d=_0x1134[_0x3c65cc];return _0x21a62d;};'use strict';var _=require(_0x4113('0x0'));var util=require('util');function rewrite(_0x1de27f,_0x53aa53){var _0x525949=this;return _0x1de27f[_0x4113('0x1')][_0x4113('0x2')]['findAll']({'raw':!![]})[_0x4113('0x3')](function(_0x4edb52){_0x525949['intervals']=_0x4edb52;return _0x1de27f['models']['VoiceExtension'][_0x4113('0x4')]({'where':{'IntervalId':_0x53aa53['IntervalId']},'raw':!![]});})['then'](function(_0x3671c5){return _0x1de27f[_0x4113('0x1')][_0x4113('0x5')][_0x4113('0x4')]({'where':{'exten':{'$in':_[_0x4113('0x6')](_[_0x4113('0x7')](_0x3671c5,'exten'))}},'order':[{'raw':_0x4113('0x8')}],'raw':!![]});})['then'](function(_0x5c0ee0){var _0x3c7ab9=_[_0x4113('0x9')](_0x5c0ee0,{'priority':'1'});var _0x24ae61=_[_0x4113('0x9')](_0x5c0ee0,{'isApp':0x1});var _0x2aeb91=_[_0x4113('0xa')](_0x24ae61,_0x4113('0xb'));var _0x126d71=[_0x4113('0xc'),_0x4113('0xd')];var _0x217b4a=[];var _0x48847a=[];for(var _0x340422 in _0x2aeb91){if(_0x2aeb91[_0x4113('0xe')](_0x340422)){_0x525949[_0x4113('0xf')]=0x2;_0x525949[_0x4113('0x10')]=[];_0x525949[_0x4113('0x11')]=_['find'](_0x3c7ab9,{'exten':_0x2aeb91[_0x340422][0x0][_0x4113('0xb')]});_0x525949[_0x4113('0x10')]['push']({'type':_0x2aeb91[_0x340422][0x0]['type'],'app':'Set','appdata':util[_0x4113('0x12')](_0x4113('0x13'),_0x2aeb91[_0x340422][0x0][_0x4113('0x14')]),'context':_0x2aeb91[_0x340422][0x0]['context'],'exten':_0x2aeb91[_0x340422][0x0][_0x4113('0xb')],'priority':_0x525949[_0x4113('0xf')]++,'VoiceExtensionId':_0x2aeb91[_0x340422][0x0]['VoiceExtensionId']});if(_0x2aeb91[_0x340422][0x0]['type']===_0x4113('0x15')){_0x525949['extensions'][_0x4113('0x16')]({'type':_0x2aeb91[_0x340422][0x0]['type'],'app':_0x4113('0x17'),'appdata':_0x4113('0x18')+_0x2aeb91[_0x340422][0x0][_0x4113('0x19')],'context':_0x2aeb91[_0x340422][0x0][_0x4113('0x1a')],'exten':_0x2aeb91[_0x340422][0x0]['exten'],'priority':_0x525949[_0x4113('0xf')]++,'VoiceExtensionId':_0x2aeb91[_0x340422][0x0][_0x4113('0x19')]});}else if(_0x2aeb91[_0x340422][0x0][_0x4113('0x14')]===_0x4113('0x1b')){if(_0x525949['extension']){_0x525949[_0x4113('0x10')][_0x4113('0x16')]({'type':_0x2aeb91[_0x340422][0x0]['type'],'app':'Set','appdata':'CDR(destination)='+(_0x525949[_0x4113('0x11')][_0x4113('0x1c')]?_0x4113('0x1d')+_0x525949['extension'][_0x4113('0x1c')]+'}':'${EXTEN}'),'context':_0x2aeb91[_0x340422][0x0][_0x4113('0x1a')],'exten':_0x2aeb91[_0x340422][0x0]['exten'],'priority':_0x525949['priority']++,'VoiceExtensionId':_0x2aeb91[_0x340422][0x0][_0x4113('0x19')]});}_0x525949[_0x4113('0x10')][_0x4113('0x16')]({'type':_0x2aeb91[_0x340422][0x0][_0x4113('0x14')],'app':_0x4113('0x17'),'appdata':_0x4113('0x18')+_0x2aeb91[_0x340422][0x0][_0x4113('0x19')],'context':_0x2aeb91[_0x340422][0x0][_0x4113('0x1a')],'exten':_0x2aeb91[_0x340422][0x0]['exten'],'priority':_0x525949[_0x4113('0xf')]++,'VoiceExtensionId':_0x2aeb91[_0x340422][0x0][_0x4113('0x19')]});var _0x5be9b2=_0x525949[_0x4113('0xf')]++;_0x525949['extensions'][_0x4113('0x16')]({'type':_0x2aeb91[_0x340422][0x0][_0x4113('0x14')],'app':_0x4113('0x1e'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x5be9b2+0x2)+_0x4113('0x1f')+(_0x5be9b2+0x1)+')','context':_0x2aeb91[_0x340422][0x0][_0x4113('0x1a')],'exten':_0x2aeb91[_0x340422][0x0]['exten'],'priority':_0x5be9b2,'VoiceExtensionId':_0x2aeb91[_0x340422][0x0][_0x4113('0x19')]});if(_0x525949[_0x4113('0x11')]){_0x525949['extensions'][_0x4113('0x16')]({'type':_0x2aeb91[_0x340422][0x0]['type'],'app':'Set','appdata':_0x525949[_0x4113('0x11')]['cutdigits']?_0x4113('0x20')+_0x525949[_0x4113('0x11')][_0x4113('0x1c')]+'}':'CDR(prefix)=noprefix','context':_0x2aeb91[_0x340422][0x0]['context'],'exten':_0x2aeb91[_0x340422][0x0][_0x4113('0xb')],'priority':_0x525949['priority']++,'VoiceExtensionId':_0x2aeb91[_0x340422][0x0][_0x4113('0x19')]});}_0x525949[_0x4113('0x10')][_0x4113('0x16')]({'type':_0x2aeb91[_0x340422][0x0][_0x4113('0x14')],'app':_0x4113('0x17'),'appdata':_0x4113('0x21')+_0x2aeb91[_0x340422][0x0][_0x4113('0x19')],'context':_0x2aeb91[_0x340422][0x0][_0x4113('0x1a')],'exten':_0x2aeb91[_0x340422][0x0]['exten'],'priority':_0x525949[_0x4113('0xf')]++,'VoiceExtensionId':_0x2aeb91[_0x340422][0x0][_0x4113('0x19')]});if(_0x525949[_0x4113('0x11')]&&_0x525949['extension']['hasOwnProperty'](_0x4113('0x22'))&&_0x525949[_0x4113('0x11')][_0x4113('0x22')]!==_0x4113('0x23')){_0x525949['extensions']['push']({'type':_0x2aeb91[_0x340422][0x0][_0x4113('0x14')],'app':_0x4113('0x17'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x2aeb91[_0x340422][0x0][_0x4113('0x1a')],'exten':_0x2aeb91[_0x340422][0x0][_0x4113('0xb')],'priority':_0x525949['priority']++,'VoiceExtensionId':_0x2aeb91[_0x340422][0x0][_0x4113('0x19')]});_0x525949['extensions'][_0x4113('0x16')]({'type':_0x2aeb91[_0x340422][0x0][_0x4113('0x14')],'app':_0x4113('0x17'),'appdata':_0x4113('0x24')+_0x525949['extension'][_0x4113('0x22')]||'wav','context':_0x2aeb91[_0x340422][0x0]['context'],'exten':_0x2aeb91[_0x340422][0x0]['exten'],'priority':_0x525949['priority']++,'VoiceExtensionId':_0x2aeb91[_0x340422][0x0]['VoiceExtensionId']});}}_0x525949[_0x4113('0x10')][_0x4113('0x16')]({'type':_0x2aeb91[_0x340422][0x0][_0x4113('0x14')],'app':'Set','appdata':_0x4113('0x25'),'context':_0x2aeb91[_0x340422][0x0][_0x4113('0x1a')],'exten':_0x2aeb91[_0x340422][0x0][_0x4113('0xb')],'priority':_0x525949[_0x4113('0xf')]++,'VoiceExtensionId':_0x2aeb91[_0x340422][0x0][_0x4113('0x19')]});_0x525949[_0x4113('0x10')]['push']({'type':_0x2aeb91[_0x340422][0x0][_0x4113('0x14')],'app':_0x4113('0x17'),'appdata':_0x4113('0x26'),'context':_0x2aeb91[_0x340422][0x0][_0x4113('0x1a')],'exten':_0x2aeb91[_0x340422][0x0][_0x4113('0xb')],'priority':_0x525949[_0x4113('0xf')]++,'VoiceExtensionId':_0x2aeb91[_0x340422][0x0][_0x4113('0x19')]});_0x525949[_0x4113('0x10')][_0x4113('0x16')]({'type':_0x2aeb91[_0x340422][0x0]['type'],'app':_0x4113('0x17'),'appdata':_0x4113('0x27'),'context':_0x2aeb91[_0x340422][0x0][_0x4113('0x1a')],'exten':_0x2aeb91[_0x340422][0x0][_0x4113('0xb')],'priority':_0x525949[_0x4113('0xf')]++,'VoiceExtensionId':_0x2aeb91[_0x340422][0x0][_0x4113('0x19')]});for(var _0x392ef2=0x0,_0x2d97ac=0x0;_0x392ef2<_0x2aeb91[_0x340422][_0x4113('0x28')];_0x392ef2+=0x1,_0x2d97ac=0x0){var _0xa656cf=_0x2aeb91[_0x340422][_0x392ef2];if(_0xa656cf[_0x4113('0x14')]){_0xa656cf[_0x4113('0x14')]=_0xa656cf[_0x4113('0x14')][_0x4113('0x29')]();}var _0x171c1e=[];var _0x2977a3=[];delete _0xa656cf['id'];delete _0xa656cf[_0x4113('0x2a')];delete _0xa656cf[_0x4113('0x2b')];var _0x513837=_0xa656cf['interval']!==_0x4113('0x2c')?[_0xa656cf[_0x4113('0x2d')]]:_0xa656cf[_0x4113('0x2e')]?_[_0x4113('0x7')](_[_0x4113('0x9')](_0x525949[_0x4113('0x2f')],{'IntervalId':_0xa656cf['IntervalId']}),_0x4113('0x2d')):[];if(_0xa656cf[_0x4113('0xe')]('tag')){if(_0xa656cf[_0x4113('0x30')]&&_0xa656cf['tag']!=='--'){_0x171c1e[_0x4113('0x16')]({'type':_0xa656cf[_0x4113('0x14')],'app':_0x4113('0x17'),'appdata':'CDR(tag)='+_0xa656cf[_0x4113('0x30')],'context':_0xa656cf[_0x4113('0x1a')],'exten':_0xa656cf['exten'],'priority':_0x513837['length']+_0x525949[_0x4113('0xf')]+_0x2d97ac++,'VoiceExtensionId':_0xa656cf[_0x4113('0x19')]});}}if(_0xa656cf[_0x4113('0x14')]===_0x4113('0x1b')&&_0xa656cf[_0x4113('0xe')]('callerID')){if(_0xa656cf[_0x4113('0x31')]){_0x171c1e[_0x4113('0x16')]({'type':_0xa656cf[_0x4113('0x14')],'app':_0x4113('0x1e'),'appdata':_0x4113('0x32')+_0xa656cf[_0x4113('0x31')]+')','context':_0xa656cf[_0x4113('0x1a')],'exten':_0xa656cf[_0x4113('0xb')],'priority':_0x513837[_0x4113('0x28')]+_0x525949['priority']+_0x2d97ac++,'VoiceExtensionId':_0xa656cf['VoiceExtensionId']});}else{_0x171c1e[_0x4113('0x16')]({'type':_0xa656cf['type'],'app':_0x4113('0x1e'),'appdata':_0x4113('0x33'),'context':_0xa656cf[_0x4113('0x1a')],'exten':_0xa656cf['exten'],'priority':_0x513837[_0x4113('0x28')]+_0x525949[_0x4113('0xf')]+_0x2d97ac++,'VoiceExtensionId':_0xa656cf[_0x4113('0x19')]});}}if(_0xa656cf['hasOwnProperty']('answer')){if(_0x126d71['indexOf'](_0xa656cf[_0x4113('0x34')]['toLowerCase']())>=0x0&&_0xa656cf['appType']!==_0x4113('0x35')){if(_0xa656cf[_0x4113('0x36')]){_0x171c1e[_0x4113('0x16')]({'type':_0xa656cf['type'],'app':'ExecIf','appdata':_0x4113('0x37'),'context':_0xa656cf[_0x4113('0x1a')],'exten':_0xa656cf[_0x4113('0xb')],'priority':_0x513837[_0x4113('0x28')]+_0x525949[_0x4113('0xf')]+_0x2d97ac++,'VoiceExtensionId':_0xa656cf[_0x4113('0x19')]});_0x171c1e[_0x4113('0x16')]({'type':_0xa656cf[_0x4113('0x14')],'app':_0x4113('0x17'),'appdata':_0x4113('0x38'),'context':_0xa656cf[_0x4113('0x1a')],'exten':_0xa656cf[_0x4113('0xb')],'priority':_0x513837[_0x4113('0x28')]+_0x525949[_0x4113('0xf')]+_0x2d97ac++,'VoiceExtensionId':_0xa656cf[_0x4113('0x19')]});}else{_0x171c1e[_0x4113('0x16')]({'type':_0xa656cf[_0x4113('0x14')],'app':_0x4113('0x1e'),'appdata':_0x4113('0x39'),'context':_0xa656cf[_0x4113('0x1a')],'exten':_0xa656cf[_0x4113('0xb')],'priority':_0x513837[_0x4113('0x28')]+_0x525949[_0x4113('0xf')]+_0x2d97ac++,'VoiceExtensionId':_0xa656cf['VoiceExtensionId']});_0x171c1e[_0x4113('0x16')]({'type':_0xa656cf['type'],'app':_0x4113('0x17'),'appdata':_0x4113('0x3a'),'context':_0xa656cf[_0x4113('0x1a')],'exten':_0xa656cf[_0x4113('0xb')],'priority':_0x513837[_0x4113('0x28')]+_0x525949[_0x4113('0xf')]+_0x2d97ac++,'VoiceExtensionId':_0xa656cf[_0x4113('0x19')]});}}}for(var _0x521bbd=0x0;_0x521bbd<_0x513837['length'];_0x521bbd+=0x1){var _0x4409e7=_0x525949[_0x4113('0xf')]+_0x513837['length'];var _0x8e8207=_0x521bbd===_0x513837['length']-0x1?_0x525949[_0x4113('0xf')]+_0x171c1e[_0x4113('0x28')]+_0x2977a3[_0x4113('0x28')]+0x2:_0x525949[_0x4113('0xf')]+_0x521bbd+0x1;_0x171c1e['splice'](_0x521bbd,0x0,{'type':_0xa656cf[_0x4113('0x14')],'app':'GotoIfTime','appdata':_0x513837[_0x521bbd]+'?'+_0xa656cf[_0x4113('0x1a')]+',${EXTEN},'+_0x4409e7+':'+_0xa656cf[_0x4113('0x1a')]+_0x4113('0x3b')+_0x8e8207,'exten':_0xa656cf[_0x4113('0xb')],'context':_0xa656cf[_0x4113('0x1a')],'priority':_0x525949[_0x4113('0xf')]+_0x521bbd,'VoiceExtensionId':_0x2aeb91[_0x340422][0x0][_0x4113('0x19')]});}_0xa656cf[_0x4113('0xf')]=_0x171c1e[_0x4113('0x28')]?_[_0x4113('0x3c')](_0x171c1e)[_0x4113('0xf')]+0x1:_0x525949[_0x4113('0xf')];_0x525949[_0x4113('0xf')]=(_0x2977a3[_0x4113('0x28')]?_[_0x4113('0x3c')](_0x2977a3)[_0x4113('0xf')]:_0xa656cf['priority'])+0x1;_0x525949['extensions']=_[_0x4113('0x3d')](_0x525949[_0x4113('0x10')],_0x171c1e,[_0xa656cf],_0x2977a3);}_0x525949[_0x4113('0x10')][_0x4113('0x16')]({'type':_0x2aeb91[_0x340422][0x0][_0x4113('0x14')],'app':_0x4113('0x3e'),'exten':_0x2aeb91[_0x340422][0x0][_0x4113('0xb')],'context':_0x2aeb91[_0x340422][0x0]['context'],'priority':_0x525949['priority'],'VoiceExtensionId':_0x2aeb91[_0x340422][0x0]['VoiceExtensionId']});_0x217b4a['push'](_0x2aeb91[_0x340422][0x0]['VoiceExtensionId']);_0x48847a=_[_0x4113('0x3d')](_0x48847a,_0x525949[_0x4113('0x10')]);}}return _0x1de27f[_0x4113('0x3f')](function(_0x2996dd){return _0x1de27f['models'][_0x4113('0x5')][_0x4113('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x217b4a}},'transaction':_0x2996dd})[_0x4113('0x3')](function(_0x9cb899){return _0x1de27f['models'][_0x4113('0x5')][_0x4113('0x41')](_[_0x4113('0x42')](_0x48847a,_0x4113('0xf')),{'transaction':_0x2996dd});});});})['catch'](function(_0x24a67b){console[_0x4113('0x43')](_0x24a67b);});}exports[_0x4113('0x44')]=rewrite; \ No newline at end of file +var _0xdda7=['lodash','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','type','format','CDR(type)=%s','VoiceExtensionId','inbound','Set','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','context','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','answer','indexOf','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','length','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite'];(function(_0xd8baf3,_0x238fd0){var _0x492838=function(_0xaffd75){while(--_0xaffd75){_0xd8baf3['push'](_0xd8baf3['shift']());}};_0x492838(++_0x238fd0);}(_0xdda7,0x192));var _0x7dda=function(_0x208473,_0x540349){_0x208473=_0x208473-0x0;var _0x19a428=_0xdda7[_0x208473];return _0x19a428;};'use strict';var _=require(_0x7dda('0x0'));var util=require('util');function rewrite(_0x5c7aa1,_0x18ab44){var _0x464fee=this;return _0x5c7aa1[_0x7dda('0x1')][_0x7dda('0x2')][_0x7dda('0x3')]({'raw':!![]})[_0x7dda('0x4')](function(_0x36c2e1){_0x464fee[_0x7dda('0x5')]=_0x36c2e1;return _0x5c7aa1[_0x7dda('0x1')][_0x7dda('0x6')][_0x7dda('0x3')]({'where':{'IntervalId':_0x18ab44[_0x7dda('0x7')]},'raw':!![]});})[_0x7dda('0x4')](function(_0x45692d){return _0x5c7aa1[_0x7dda('0x1')][_0x7dda('0x6')][_0x7dda('0x3')]({'where':{'exten':{'$in':_['uniq'](_[_0x7dda('0x8')](_0x45692d,_0x7dda('0x9')))}},'order':[{'raw':_0x7dda('0xa')}],'raw':!![]});})['then'](function(_0x2381f0){var _0x109016=_[_0x7dda('0xb')](_0x2381f0,{'priority':'1'});var _0x365938=_['filter'](_0x2381f0,{'isApp':0x1});var _0x497a54=_['groupBy'](_0x365938,'exten');var _0x76ee75=[_0x7dda('0xc'),_0x7dda('0xd')];var _0x2b03a9=[];var _0x7bde38=[];for(var _0x5b2e24 in _0x497a54){if(_0x497a54[_0x7dda('0xe')](_0x5b2e24)){_0x464fee[_0x7dda('0xf')]=0x2;_0x464fee[_0x7dda('0x10')]=[];_0x464fee[_0x7dda('0x11')]=_[_0x7dda('0x12')](_0x109016,{'exten':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x9')]});_0x464fee[_0x7dda('0x10')][_0x7dda('0x13')]({'type':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x14')],'app':'Set','appdata':util[_0x7dda('0x15')](_0x7dda('0x16'),_0x497a54[_0x5b2e24][0x0]['type']),'context':_0x497a54[_0x5b2e24][0x0]['context'],'exten':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x9')],'priority':_0x464fee[_0x7dda('0xf')]++,'VoiceExtensionId':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x17')]});if(_0x497a54[_0x5b2e24][0x0]['type']===_0x7dda('0x18')){_0x464fee[_0x7dda('0x10')][_0x7dda('0x13')]({'type':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x14')],'app':_0x7dda('0x19'),'appdata':_0x7dda('0x1a')+_0x497a54[_0x5b2e24][0x0][_0x7dda('0x17')],'context':_0x497a54[_0x5b2e24][0x0]['context'],'exten':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x9')],'priority':_0x464fee[_0x7dda('0xf')]++,'VoiceExtensionId':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x17')]});}else if(_0x497a54[_0x5b2e24][0x0][_0x7dda('0x14')]===_0x7dda('0x1b')){if(_0x464fee[_0x7dda('0x11')]){_0x464fee[_0x7dda('0x10')][_0x7dda('0x13')]({'type':_0x497a54[_0x5b2e24][0x0]['type'],'app':_0x7dda('0x19'),'appdata':_0x7dda('0x1c')+(_0x464fee[_0x7dda('0x11')][_0x7dda('0x1d')]?'${EXTEN:'+_0x464fee['extension']['cutdigits']+'}':'${EXTEN}'),'context':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x1e')],'exten':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x9')],'priority':_0x464fee[_0x7dda('0xf')]++,'VoiceExtensionId':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x17')]});}_0x464fee[_0x7dda('0x10')]['push']({'type':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x14')],'app':_0x7dda('0x19'),'appdata':_0x7dda('0x1a')+_0x497a54[_0x5b2e24][0x0][_0x7dda('0x17')],'context':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x1e')],'exten':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x9')],'priority':_0x464fee[_0x7dda('0xf')]++,'VoiceExtensionId':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x17')]});var _0x456fd9=_0x464fee[_0x7dda('0xf')]++;_0x464fee[_0x7dda('0x10')][_0x7dda('0x13')]({'type':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x14')],'app':_0x7dda('0x1f'),'appdata':_0x7dda('0x20')+(_0x456fd9+0x2)+'):Goto('+(_0x456fd9+0x1)+')','context':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x1e')],'exten':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x9')],'priority':_0x456fd9,'VoiceExtensionId':_0x497a54[_0x5b2e24][0x0]['VoiceExtensionId']});if(_0x464fee['extension']){_0x464fee[_0x7dda('0x10')][_0x7dda('0x13')]({'type':_0x497a54[_0x5b2e24][0x0]['type'],'app':_0x7dda('0x19'),'appdata':_0x464fee[_0x7dda('0x11')][_0x7dda('0x1d')]?'CDR(prefix)=${EXTEN:0:'+_0x464fee['extension']['cutdigits']+'}':_0x7dda('0x21'),'context':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x1e')],'exten':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x9')],'priority':_0x464fee[_0x7dda('0xf')]++,'VoiceExtensionId':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x17')]});}_0x464fee[_0x7dda('0x10')][_0x7dda('0x13')]({'type':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x14')],'app':'Set','appdata':'outboundrouteid='+_0x497a54[_0x5b2e24][0x0][_0x7dda('0x17')],'context':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x1e')],'exten':_0x497a54[_0x5b2e24][0x0]['exten'],'priority':_0x464fee[_0x7dda('0xf')]++,'VoiceExtensionId':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x17')]});if(_0x464fee[_0x7dda('0x11')]&&_0x464fee['extension'][_0x7dda('0xe')](_0x7dda('0x22'))&&_0x464fee[_0x7dda('0x11')][_0x7dda('0x22')]!==_0x7dda('0x23')){_0x464fee[_0x7dda('0x10')][_0x7dda('0x13')]({'type':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x14')],'app':_0x7dda('0x19'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x497a54[_0x5b2e24][0x0]['context'],'exten':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x9')],'priority':_0x464fee[_0x7dda('0xf')]++,'VoiceExtensionId':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x17')]});_0x464fee['extensions'][_0x7dda('0x13')]({'type':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x14')],'app':'Set','appdata':_0x7dda('0x24')+_0x464fee['extension'][_0x7dda('0x22')]||_0x7dda('0x25'),'context':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x1e')],'exten':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x9')],'priority':_0x464fee[_0x7dda('0xf')]++,'VoiceExtensionId':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x17')]});}}_0x464fee[_0x7dda('0x10')][_0x7dda('0x13')]({'type':_0x497a54[_0x5b2e24][0x0]['type'],'app':_0x7dda('0x19'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x1e')],'exten':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x9')],'priority':_0x464fee[_0x7dda('0xf')]++,'VoiceExtensionId':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x17')]});_0x464fee[_0x7dda('0x10')][_0x7dda('0x13')]({'type':_0x497a54[_0x5b2e24][0x0]['type'],'app':_0x7dda('0x19'),'appdata':_0x7dda('0x26'),'context':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x1e')],'exten':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x9')],'priority':_0x464fee[_0x7dda('0xf')]++,'VoiceExtensionId':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x17')]});_0x464fee['extensions'][_0x7dda('0x13')]({'type':_0x497a54[_0x5b2e24][0x0]['type'],'app':'Set','appdata':_0x7dda('0x27'),'context':_0x497a54[_0x5b2e24][0x0]['context'],'exten':_0x497a54[_0x5b2e24][0x0]['exten'],'priority':_0x464fee['priority']++,'VoiceExtensionId':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x17')]});for(var _0x3dc0c8=0x0,_0x304493=0x0;_0x3dc0c8<_0x497a54[_0x5b2e24]['length'];_0x3dc0c8+=0x1,_0x304493=0x0){var _0x3bbaae=_0x497a54[_0x5b2e24][_0x3dc0c8];if(_0x3bbaae[_0x7dda('0x14')]){_0x3bbaae[_0x7dda('0x14')]=_0x3bbaae[_0x7dda('0x14')][_0x7dda('0x28')]();}var _0x37b8c1=[];var _0x349776=[];delete _0x3bbaae['id'];delete _0x3bbaae['createdAt'];delete _0x3bbaae[_0x7dda('0x29')];var _0x246413=_0x3bbaae[_0x7dda('0x2a')]!==_0x7dda('0x2b')?[_0x3bbaae[_0x7dda('0x2a')]]:_0x3bbaae[_0x7dda('0x7')]?_['map'](_[_0x7dda('0xb')](_0x464fee[_0x7dda('0x5')],{'IntervalId':_0x3bbaae[_0x7dda('0x7')]}),_0x7dda('0x2a')):[];if(_0x3bbaae['hasOwnProperty'](_0x7dda('0x2c'))){if(_0x3bbaae['tag']&&_0x3bbaae['tag']!=='--'){_0x37b8c1['push']({'type':_0x3bbaae[_0x7dda('0x14')],'app':_0x7dda('0x19'),'appdata':_0x7dda('0x2d')+_0x3bbaae[_0x7dda('0x2c')],'context':_0x3bbaae[_0x7dda('0x1e')],'exten':_0x3bbaae['exten'],'priority':_0x246413['length']+_0x464fee[_0x7dda('0xf')]+_0x304493++,'VoiceExtensionId':_0x3bbaae[_0x7dda('0x17')]});}}if(_0x3bbaae[_0x7dda('0x14')]==='outbound'&&_0x3bbaae['hasOwnProperty'](_0x7dda('0x2e'))){if(_0x3bbaae[_0x7dda('0x2e')]){_0x37b8c1[_0x7dda('0x13')]({'type':_0x3bbaae[_0x7dda('0x14')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x3bbaae[_0x7dda('0x2e')]+')','context':_0x3bbaae['context'],'exten':_0x3bbaae['exten'],'priority':_0x246413['length']+_0x464fee[_0x7dda('0xf')]+_0x304493++,'VoiceExtensionId':_0x3bbaae[_0x7dda('0x17')]});}else{_0x37b8c1[_0x7dda('0x13')]({'type':_0x3bbaae[_0x7dda('0x14')],'app':_0x7dda('0x1f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x3bbaae['context'],'exten':_0x3bbaae[_0x7dda('0x9')],'priority':_0x246413['length']+_0x464fee[_0x7dda('0xf')]+_0x304493++,'VoiceExtensionId':_0x3bbaae[_0x7dda('0x17')]});}}if(_0x3bbaae[_0x7dda('0xe')](_0x7dda('0x2f'))){if(_0x76ee75[_0x7dda('0x30')](_0x3bbaae['app']['toLowerCase']())>=0x0&&_0x3bbaae[_0x7dda('0x31')]!==_0x7dda('0x32')){if(_0x3bbaae[_0x7dda('0x2f')]){_0x37b8c1[_0x7dda('0x13')]({'type':_0x3bbaae[_0x7dda('0x14')],'app':'ExecIf','appdata':_0x7dda('0x33'),'context':_0x3bbaae[_0x7dda('0x1e')],'exten':_0x3bbaae[_0x7dda('0x9')],'priority':_0x246413['length']+_0x464fee[_0x7dda('0xf')]+_0x304493++,'VoiceExtensionId':_0x3bbaae[_0x7dda('0x17')]});_0x37b8c1[_0x7dda('0x13')]({'type':_0x3bbaae['type'],'app':_0x7dda('0x19'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x3bbaae[_0x7dda('0x1e')],'exten':_0x3bbaae['exten'],'priority':_0x246413[_0x7dda('0x34')]+_0x464fee[_0x7dda('0xf')]+_0x304493++,'VoiceExtensionId':_0x3bbaae[_0x7dda('0x17')]});}else{_0x37b8c1[_0x7dda('0x13')]({'type':_0x3bbaae[_0x7dda('0x14')],'app':'ExecIf','appdata':_0x7dda('0x35'),'context':_0x3bbaae[_0x7dda('0x1e')],'exten':_0x3bbaae['exten'],'priority':_0x246413[_0x7dda('0x34')]+_0x464fee[_0x7dda('0xf')]+_0x304493++,'VoiceExtensionId':_0x3bbaae[_0x7dda('0x17')]});_0x37b8c1['push']({'type':_0x3bbaae[_0x7dda('0x14')],'app':_0x7dda('0x19'),'appdata':_0x7dda('0x36'),'context':_0x3bbaae[_0x7dda('0x1e')],'exten':_0x3bbaae[_0x7dda('0x9')],'priority':_0x246413[_0x7dda('0x34')]+_0x464fee[_0x7dda('0xf')]+_0x304493++,'VoiceExtensionId':_0x3bbaae[_0x7dda('0x17')]});}}}for(var _0x11ce1b=0x0;_0x11ce1b<_0x246413[_0x7dda('0x34')];_0x11ce1b+=0x1){var _0xf7a9af=_0x464fee[_0x7dda('0xf')]+_0x246413[_0x7dda('0x34')];var _0xc5831b=_0x11ce1b===_0x246413['length']-0x1?_0x464fee['priority']+_0x37b8c1[_0x7dda('0x34')]+_0x349776[_0x7dda('0x34')]+0x2:_0x464fee[_0x7dda('0xf')]+_0x11ce1b+0x1;_0x37b8c1[_0x7dda('0x37')](_0x11ce1b,0x0,{'type':_0x3bbaae[_0x7dda('0x14')],'app':'GotoIfTime','appdata':_0x246413[_0x11ce1b]+'?'+_0x3bbaae['context']+',${EXTEN},'+_0xf7a9af+':'+_0x3bbaae[_0x7dda('0x1e')]+_0x7dda('0x38')+_0xc5831b,'exten':_0x3bbaae[_0x7dda('0x9')],'context':_0x3bbaae['context'],'priority':_0x464fee[_0x7dda('0xf')]+_0x11ce1b,'VoiceExtensionId':_0x497a54[_0x5b2e24][0x0]['VoiceExtensionId']});}_0x3bbaae[_0x7dda('0xf')]=_0x37b8c1['length']?_[_0x7dda('0x39')](_0x37b8c1)['priority']+0x1:_0x464fee[_0x7dda('0xf')];_0x464fee['priority']=(_0x349776[_0x7dda('0x34')]?_[_0x7dda('0x39')](_0x349776)[_0x7dda('0xf')]:_0x3bbaae[_0x7dda('0xf')])+0x1;_0x464fee[_0x7dda('0x10')]=_[_0x7dda('0x3a')](_0x464fee[_0x7dda('0x10')],_0x37b8c1,[_0x3bbaae],_0x349776);}_0x464fee['extensions'][_0x7dda('0x13')]({'type':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x14')],'app':_0x7dda('0x3b'),'exten':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x9')],'context':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x1e')],'priority':_0x464fee[_0x7dda('0xf')],'VoiceExtensionId':_0x497a54[_0x5b2e24][0x0][_0x7dda('0x17')]});_0x2b03a9[_0x7dda('0x13')](_0x497a54[_0x5b2e24][0x0][_0x7dda('0x17')]);_0x7bde38=_['concat'](_0x7bde38,_0x464fee[_0x7dda('0x10')]);}}return _0x5c7aa1[_0x7dda('0x3c')](function(_0x430416){return _0x5c7aa1['models'][_0x7dda('0x6')][_0x7dda('0x3d')]({'where':{'VoiceExtensionId':{'$in':_0x2b03a9}},'transaction':_0x430416})[_0x7dda('0x4')](function(_0x3b5aff){return _0x5c7aa1['models'][_0x7dda('0x6')][_0x7dda('0x3e')](_[_0x7dda('0x3f')](_0x7bde38,_0x7dda('0xf')),{'transaction':_0x430416});});});})[_0x7dda('0x40')](function(_0x5dd1f8){console[_0x7dda('0x41')](_0x5dd1f8);});}exports[_0x7dda('0x42')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index c9bcc17..0e5f9cc 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 _0x6455=['ContactId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','sequelize','query','onlyIfOpen','VoiceQueueId','all','CampaignId','Campaign','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','finally','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','util','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','api','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','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','createdAt','updatedAt','select','field','NOW()','scheduledAt'];(function(_0x5219e4,_0x50cdef){var _0x390418=function(_0x589678){while(--_0x589678){_0x5219e4['push'](_0x5219e4['shift']());}};_0x390418(++_0x50cdef);}(_0x6455,0x189));var _0x5645=function(_0x529adc,_0x544212){_0x529adc=_0x529adc-0x0;var _0x3dde47=_0x6455[_0x529adc];return _0x3dde47;};'use strict';var BPromise=require(_0x5645('0x0'));var util=require(_0x5645('0x1'));var _=require(_0x5645('0x2'));var fs=require('fs');var squel=require(_0x5645('0x3'));var Papa=require(_0x5645('0x4'));var Redis=require(_0x5645('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0x5645('0x6'));var logger=require(_0x5645('0x7'))(_0x5645('0x8'));config[_0x5645('0x9')]=_['defaults'](config[_0x5645('0x9')],{'host':_0x5645('0xa'),'port':0x18eb});var socket=require(_0x5645('0xb'))(new Redis(config[_0x5645('0x9')]));require(_0x5645('0xc'))[_0x5645('0xd')](socket);try{if(!process[_0x5645('0xe')][0x2]||process[_0x5645('0xe')][0x2]===_0x5645('0xf')||process['argv'][0x2]==='null'){throw new Error(_0x5645('0x10'));}var FILEPATH=process['argv'][0x2];if(!process[_0x5645('0xe')][0x3]||process[_0x5645('0xe')][0x3]===_0x5645('0xf')||process[_0x5645('0xe')][0x3]===_0x5645('0x11')||!process[_0x5645('0xe')][0x4]||process[_0x5645('0xe')][0x4]===_0x5645('0xf')||process['argv'][0x4]===_0x5645('0x11')){throw new Error(_0x5645('0x12'));}var FIELDS=_[_0x5645('0x13')](process['argv'][0x3][_0x5645('0x14')](','),process['argv'][0x4][_0x5645('0x14')](','));if(!process[_0x5645('0xe')][0x5]||process[_0x5645('0xe')][0x5]===_0x5645('0xf')||process[_0x5645('0xe')][0x5]===_0x5645('0x11')){throw new Error(_0x5645('0x15'));}var LISTID=process[_0x5645('0xe')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x5645('0xe')][0x6]!==_0x5645('0xf')&&process['argv'][0x6]!==_0x5645('0x11')?process[_0x5645('0xe')][0x6]:null;var DUPLICATES=process[_0x5645('0xe')][0x7]&&process[_0x5645('0xe')][0x7]!==_0x5645('0xf')&&process[_0x5645('0xe')][0x7]!==_0x5645('0x11')?process[_0x5645('0xe')][0x7]:null;if(!process[_0x5645('0xe')][0x8]||process[_0x5645('0xe')][0x8]===_0x5645('0xf')||process['argv'][0x8]==='null'){throw new Error(_0x5645('0x16'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x2bff43){logger[_0x5645('0x17')](_0x2bff43);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(_0x3fadb5,_0x353027,_0x16581b,_0x1df670){var _0x116868={'message':_0x353027};_0x116868[_0x3fadb5]=!![];if(_0x16581b){_0x116868[_0x5645('0x18')]=_0x16581b;}if(_0x1df670){_0x116868['index']=_0x1df670;}return _0x116868;}function isEmail(_0x312455){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))*$/[_0x5645('0x19')](_0x312455);}function checkRow(_0x4c2f19,_0x25cfdf,_0x2e73fe){return new BPromise(function(_0x417d81,_0x1309e3){if(_[_0x5645('0x1a')](_0x4c2f19)){return _0x1309e3(handleCheckRowError(_0x5645('0x17'),_0x5645('0x1b'),null,_0x2e73fe));}if(_0x4c2f19['errors']&&_0x4c2f19[_0x5645('0x1c')][_0x5645('0x1d')]){var _0xb6d61c=_[_0x5645('0x1e')](_0x4c2f19['errors'],_0x5645('0x1f'))[_0x5645('0x20')](';');return _0x1309e3(handleCheckRowError(_0x5645('0x17'),_0xb6d61c,null,_0x2e73fe));}var _0x5125c5={};for(var _0x4fbfe0 in FIELDS){if(FIELDS[_0x5645('0x21')](_0x4fbfe0)&&FIELDS[_0x4fbfe0]){_0x5125c5[_0x4fbfe0]=_0x4c2f19['data'][0x0][FIELDS[_0x4fbfe0]]||_0x4c2f19[_0x5645('0x22')][0x0]['\ufeff'+FIELDS[_0x4fbfe0]];}}if(!_0x5125c5['firstName']){return _0x1309e3(handleCheckRowError('error','firstName\x20not\x20specified!',null,_0x2e73fe));}if(!_0x5125c5[_0x5645('0x23')]){return _0x1309e3(handleCheckRowError(_0x5645('0x17'),_0x5645('0x24'),null,_0x2e73fe));}if(_0x5125c5[_0x5645('0x25')]){var _0x206d38=moment(_0x5125c5[_0x5645('0x25')],_0x5645('0x26'));if(!_0x206d38['isValid']()){return _0x1309e3(handleCheckRowError(_0x5645('0x17'),_0x5645('0x27'),null,_0x2e73fe));}}if(_0x5125c5['email']){if(!isEmail(_0x5125c5[_0x5645('0x28')])){return _0x1309e3(handleCheckRowError(_0x5645('0x17'),_0x5645('0x29'),null,_0x2e73fe));}}_0x5125c5[_0x5645('0x2a')]=LISTID;_0x5125c5[_0x5645('0x2b')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x5645('0x1d')]&&_0x25cfdf){var _0x303327={};for(var _0x4eb293=0x0,_0x3f782a=DUPLICATES[_0x5645('0x1d')];_0x4eb293<_0x3f782a;_0x4eb293+=0x1){_0x303327[DUPLICATES[_0x4eb293]]=_0x5125c5[DUPLICATES[_0x4eb293]];}var _0x36a8a6=_[_0x5645('0x2c')](_0x25cfdf,_0x303327);if(_0x36a8a6){return _0x1309e3(handleCheckRowError(_0x5645('0x2d'),_0x5645('0x2e'),_0x36a8a6,_0x2e73fe));}}return db[_0x5645('0x2f')][_0x5645('0x30')](_0x5125c5,{'raw':!![],'hooks':![],'fields':_[_0x5645('0x31')](_0x5125c5)})[_0x5645('0x32')](function(_0x37d659){if(DUPLICATES&&DUPLICATES[_0x5645('0x1d')]&&_0x25cfdf){_0x25cfdf[_0x5645('0x33')](_['pick'](_0x5125c5,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x37d659['id'];return _0x417d81();})[_0x5645('0x34')](function(_0x33839e){return _0x1309e3(handleCheckRowError(_0x5645('0x17'),_0x5645('0x35')+(_0x33839e[_0x5645('0x1f')]||JSON['stringify'](_0x33839e)),null,_0x2e73fe));});});}function checkHopper(){function _0x3ff276(){return function(_0x1e1d69){logger[_0x5645('0x17')](_0x5645('0x36'),_0x5645('0x37'),util[_0x5645('0x38')](_0x1e1d69,{'showHidden':![],'depth':null}));};}var _0x3c2f4a=function(_0x147ea9,_0x26599c){var _0x2f9530=squel[_0x5645('0x39')]()[_0x5645('0x3a')](_0x5645('0x3b'))[_0x5645('0x3c')](['phone','scheduledAt','ContactId',_0x5645('0x2a'),_0x26599c,_0x5645('0x3d'),_0x5645('0x3e')],squel[_0x5645('0x3f')]()[_0x5645('0x40')](_0x5645('0x23'),_0x5645('0x23'))[_0x5645('0x40')](_0x5645('0x41'),_0x5645('0x42'))[_0x5645('0x40')]('id',_0x5645('0x43'))[_0x5645('0x40')](LISTID[_0x5645('0x44')](),'ListId')[_0x5645('0x40')](_0x147ea9['id'][_0x5645('0x44')](),_0x26599c)[_0x5645('0x40')](_0x5645('0x41'),_0x5645('0x3d'))[_0x5645('0x40')](_0x5645('0x41'),_0x5645('0x3e'))[_0x5645('0x45')](_0x5645('0x46'))['where'](_0x5645('0x47'))[_0x5645('0x48')](_0x5645('0x49'),LISTID[_0x5645('0x44')]())[_0x5645('0x48')](_0x5645('0x4a'))[_0x5645('0x48')](_0x5645('0x4b'),squel[_0x5645('0x3f')]()['field'](_0x5645('0x23'))[_0x5645('0x45')](_0x5645('0x3b'))['where'](_0x26599c+_0x5645('0x4c'),_0x147ea9['id'][_0x5645('0x44')]())))[_0x5645('0x44')]();return _0x2f9530;};var _0x1bcc3e=function(_0x6ba361,_0xe5f4cd){var _0x3560b2=squel[_0x5645('0x39')]()['into'](_0x5645('0x3b'))[_0x5645('0x3c')](['phone',_0x5645('0x42'),_0x5645('0x43'),'ListId',_0xe5f4cd,_0x5645('0x3d'),_0x5645('0x3e')],squel[_0x5645('0x3f')]()[_0x5645('0x40')](_0x5645('0x23'),_0x5645('0x23'))['field'](_0x5645('0x41'),_0x5645('0x42'))['field']('id',_0x5645('0x43'))[_0x5645('0x40')](LISTID[_0x5645('0x44')](),_0x5645('0x2a'))[_0x5645('0x40')](_0x6ba361['id'][_0x5645('0x44')](),_0xe5f4cd)[_0x5645('0x40')](_0x5645('0x41'),_0x5645('0x3d'))['field'](_0x5645('0x41'),'updatedAt')[_0x5645('0x45')](_0x5645('0x46'))[_0x5645('0x48')](_0x5645('0x47'))[_0x5645('0x48')]('ListId\x20=\x20?',LISTID[_0x5645('0x44')]())[_0x5645('0x48')](_0x5645('0x4d'),squel[_0x5645('0x4e')](hopperContacts))['where'](_0x5645('0x4a'))['where'](_0x5645('0x4b'),squel[_0x5645('0x3f')]()['field'](_0x5645('0x4f'))[_0x5645('0x45')](_0x5645('0x50'))[_0x5645('0x48')](_0xe5f4cd+_0x5645('0x4c'),_0x6ba361['id']['toString']()))['where'](_0x5645('0x4b'),squel['select']()[_0x5645('0x40')]('phone')['from'](_0x5645('0x3b'))[_0x5645('0x48')](_0xe5f4cd+_0x5645('0x4c'),_0x6ba361['id'][_0x5645('0x44')]())))[_0x5645('0x44')]();return _0x3560b2;};function _0x17a20a(_0x5e6291,_0x30828a){var _0x390876=squel[_0x5645('0x39')]()['into'](_0x5645('0x3b'))[_0x5645('0x3c')]([_0x5645('0x23'),_0x5645('0x42'),'ContactId','ListId',_0x30828a,_0x5645('0x3d'),_0x5645('0x3e')],squel[_0x5645('0x3f')]()[_0x5645('0x40')](_0x5645('0x23'),'phone')[_0x5645('0x40')]('NOW()',_0x5645('0x42'))[_0x5645('0x40')]('id',_0x5645('0x43'))[_0x5645('0x40')](LISTID['toString'](),_0x5645('0x2a'))[_0x5645('0x40')](_0x5e6291['id'][_0x5645('0x44')](),_0x30828a)[_0x5645('0x40')]('NOW()',_0x5645('0x3d'))[_0x5645('0x40')](_0x5645('0x41'),_0x5645('0x3e'))[_0x5645('0x45')](_0x5645('0x46'))['where']('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID[_0x5645('0x44')]())[_0x5645('0x48')](_0x5645('0x4d'),squel[_0x5645('0x4e')](hopperContacts))[_0x5645('0x48')](_0x5645('0x4a')))[_0x5645('0x44')]();return _0x390876;}function _0x26f9e8(_0x4fffd3,_0x23f73a){var _0x33a741=squel[_0x5645('0x39')]()[_0x5645('0x3a')](_0x5645('0x51'))[_0x5645('0x3c')]([_0x5645('0x23'),_0x5645('0x43'),_0x5645('0x2a'),_0x23f73a,'createdAt','updatedAt'],squel[_0x5645('0x3f')]()['field']('phone','phone')['field']('id','ContactId')[_0x5645('0x40')](LISTID[_0x5645('0x44')](),_0x5645('0x2a'))[_0x5645('0x40')](_0x4fffd3['id']['toString'](),_0x23f73a)[_0x5645('0x40')](_0x5645('0x41'),_0x5645('0x3d'))[_0x5645('0x40')](_0x5645('0x41'),'updatedAt')['from']('cm_contacts')['where'](_0x5645('0x47'))['where'](_0x5645('0x49'),LISTID[_0x5645('0x44')]())[_0x5645('0x48')](_0x5645('0x4d'),squel['str'](hopperContacts))[_0x5645('0x48')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x33a741;}return db[_0x5645('0x52')][_0x5645('0x53')]({'where':{'type':_0x5645('0x54')},'attributes':['id',_0x5645('0x55')],'include':[{'model':db[_0x5645('0x56')],'as':_0x5645('0x57'),'where':{'id':LISTID}}]})[_0x5645('0x32')](function(_0x1ab681){var _0x18a1d6=[];if(_0x1ab681){var _0x543463;for(var _0x1a242e=0x0,_0x236832;_0x1a242e<_0x1ab681[_0x5645('0x1d')];_0x1a242e+=0x1){_0x236832=_0x1ab681[_0x1a242e][_0x5645('0x58')]({'plain':!![]});switch(_0x236832[_0x5645('0x55')]){case'always':_0x18a1d6['push'](db[_0x5645('0x59')][_0x5645('0x5a')](_0x1bcc3e(_0x236832,'VoiceQueueId'))[_0x5645('0x32')](function(){})[_0x5645('0x34')](_0x3ff276()));break;case _0x5645('0x5b'):_0x18a1d6['push'](db['sequelize'][_0x5645('0x5a')](_0x3c2f4a(_0x236832,_0x5645('0x5c')))[_0x5645('0x32')](function(){})[_0x5645('0x34')](_0x3ff276()));break;default:_0x18a1d6[_0x5645('0x33')](db['sequelize'][_0x5645('0x5a')](_0x17a20a(_0x236832,'VoiceQueueId'))[_0x5645('0x32')](function(){})['catch'](_0x3ff276()));}}}return _0x18a1d6;})['all']()[_0x5645('0x32')](function(){return db['VoiceQueue']['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x5645('0x56')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x5ddc4d){var _0x509ab7=[];if(_0x5ddc4d){var _0x14117e;for(var _0x567449=0x0,_0x36d89f;_0x567449<_0x5ddc4d[_0x5645('0x1d')];_0x567449+=0x1){_0x36d89f=_0x5ddc4d[_0x567449][_0x5645('0x58')]({'plain':!![]});_0x509ab7[_0x5645('0x33')](db[_0x5645('0x59')][_0x5645('0x5a')](_0x26f9e8(_0x36d89f,'VoiceQueueId'))['then'](function(){})['catch'](_0x3ff276()));}}return _0x509ab7;})[_0x5645('0x5d')]();})[_0x5645('0x32')](function(){return db['Campaign']['findAll']({'attributes':['id',_0x5645('0x55')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x2258b7){var _0x464ded=[];if(_0x2258b7){for(var _0x404051=0x0,_0x481381;_0x404051<_0x2258b7[_0x5645('0x1d')];_0x404051+=0x1){_0x481381=_0x2258b7[_0x404051]['get']({'plain':!![]});switch(_0x481381['dialCheckDuplicateType']){case'always':_0x464ded['push'](db[_0x5645('0x59')][_0x5645('0x5a')](_0x1bcc3e(_0x481381,_0x5645('0x5e')))[_0x5645('0x32')](function(){})[_0x5645('0x34')](_0x3ff276()));break;case _0x5645('0x5b'):_0x464ded[_0x5645('0x33')](db[_0x5645('0x59')][_0x5645('0x5a')](_0x3c2f4a(_0x481381,_0x5645('0x5e')))[_0x5645('0x32')](function(){})[_0x5645('0x34')](_0x3ff276()));break;default:_0x464ded[_0x5645('0x33')](db[_0x5645('0x59')][_0x5645('0x5a')](_0x17a20a(_0x481381,_0x5645('0x5e')))[_0x5645('0x32')](function(){})[_0x5645('0x34')](_0x3ff276()));}}}return _0x464ded;})['all']();})[_0x5645('0x32')](function(){return db[_0x5645('0x5f')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x5645('0x56')],'as':_0x5645('0x60'),'where':{'id':LISTID}}]})[_0x5645('0x32')](function(_0x34b4f7){var _0x647df5=[];if(_0x34b4f7){for(var _0x1eb5ad=0x0,_0x423062;_0x1eb5ad<_0x34b4f7[_0x5645('0x1d')];_0x1eb5ad+=0x1){_0x423062=_0x34b4f7[_0x1eb5ad][_0x5645('0x58')]({'plain':!![]});_0x647df5[_0x5645('0x33')](db[_0x5645('0x59')][_0x5645('0x5a')](_0x26f9e8(_0x423062,'CampaignId'))[_0x5645('0x32')](function(){})['catch'](_0x3ff276()));}}return _0x647df5;})[_0x5645('0x5d')]();})[_0x5645('0x34')](function(_0xa0a61d){logger[_0x5645('0x17')](_0x5645('0x61'),_0x5645('0x62'),_0xa0a61d['message']);});}var processPromises=function(_0x44937c){return BPromise[_0x5645('0x5d')](promises)[_0x5645('0x32')](function(_0x8f5e02){})['catch'](function(_0x3033bc){logger[_0x5645('0x17')](_0x5645('0x63'),JSON[_0x5645('0x64')](_0x3033bc));})[_0x5645('0x65')](function(){socket['emit'](_0x5645('0x66')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x44937c){return _0x44937c[_0x5645('0x67')]();}});};var endCsv=function(){return BPromise[_0x5645('0x68')]()[_0x5645('0x32')](function(){if(hopperContacts){return checkHopper();}})[_0x5645('0x32')](function(){socket['emit'](_0x5645('0x66')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x5645('0x69')](FILEPATH);}catch(_0x3baf81){logger[_0x5645('0x17')](_0x5645('0x6a'),JSON[_0x5645('0x64')](_0x3baf81));}finally{process[_0x5645('0x6b')](0x0);}});};process['on'](_0x5645('0x6c'),function(){logger[_0x5645('0x6d')](_0x5645('0x6e'));endCsv();});function main(){return BPromise[_0x5645('0x68')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x5645('0x14')](',');return db['CmContact'][_0x5645('0x53')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x5645('0x32')](function(_0x3976bd){var _0x1dadb3=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x5645('0x6f')](_0x1dadb3,{'header':!![],'skipEmptyLines':!![],'step':function(_0xcc938,_0x4ee971){total+=0x1;var _0xe021b8=total;promises[_0x5645('0x33')](checkRow(_0xcc938,_0x3976bd,_0xe021b8)[_0x5645('0x32')](function(){success+=0x1;})[_0x5645('0x34')](function(_0xaf421f){if(_0xaf421f[_0x5645('0x17')]){errors+=0x1;delete _0xaf421f[_0x5645('0x17')];}else if(_0xaf421f[_0x5645('0x2d')]){duplicates+=0x1;delete _0xaf421f[_0x5645('0x2d')];}rows[_0x5645('0x33')](_0xaf421f);}));if(total%0xc8===0x0){_0x4ee971[_0x5645('0x70')]();return processPromises(_0x4ee971);}},'complete':function(){return processPromises()[_0x5645('0x32')](function(){logger[_0x5645('0x6d')](_0x5645('0x71'));endCsv();});},'error':function(_0xbcb808,_0x558bcf){logger[_0x5645('0x6d')](_0x5645('0x72'),JSON[_0x5645('0x64')](_0xbcb808));endCsv();}});})['catch'](function(_0x119162){logger[_0x5645('0x17')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x5645('0x64')](_0x119162));});}main(); \ No newline at end of file +var _0xb8ce=['cmContact','checkHopper','inspect','insert','into','cm_hopper','scheduledAt','ListId','createdAt','updatedAt','select','field','NOW()','ContactId','toString','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','fromQuery','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','cm_contacts','cm_hopper_black','VoiceQueue','findAll','dialCheckDuplicateType','then','always','push','query','catch','sequelize','all','outbound','CmList','BlackLists','VoiceQueueId','Campaign','Lists','get','onlyIfOpen','CampaignId','cmContact,\x20%s,\x20%s','message','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','SIGINT','info','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse','duplicate','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','lodash','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','../../../api/cmContact/cmContact.socket','register','undefined','Missing\x20filepath\x20parameter!','argv','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','join','error','hasOwnProperty','data','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!','CompanyId','find','Duplicate\x20Contact','create','keys','pick','stringify'];(function(_0x1ca4b7,_0x3e0323){var _0x485d56=function(_0x2edd9e){while(--_0x2edd9e){_0x1ca4b7['push'](_0x1ca4b7['shift']());}};_0x485d56(++_0x3e0323);}(_0xb8ce,0x196));var _0xeb8c=function(_0x49d92e,_0x19087c){_0x49d92e=_0x49d92e-0x0;var _0x5ab4bc=_0xb8ce[_0x49d92e];return _0x5ab4bc;};'use strict';var BPromise=require(_0xeb8c('0x0'));var util=require('util');var _=require(_0xeb8c('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0xeb8c('0x2'));var db=require(_0xeb8c('0x3'))['db'];var config=require(_0xeb8c('0x4'));var logger=require(_0xeb8c('0x5'))(_0xeb8c('0x6'));config[_0xeb8c('0x7')]=_[_0xeb8c('0x8')](config[_0xeb8c('0x7')],{'host':_0xeb8c('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeb8c('0x7')]));require(_0xeb8c('0xa'))[_0xeb8c('0xb')](socket);try{if(!process['argv'][0x2]||process['argv'][0x2]===_0xeb8c('0xc')||process['argv'][0x2]==='null'){throw new Error(_0xeb8c('0xd'));}var FILEPATH=process[_0xeb8c('0xe')][0x2];if(!process[_0xeb8c('0xe')][0x3]||process['argv'][0x3]===_0xeb8c('0xc')||process[_0xeb8c('0xe')][0x3]===_0xeb8c('0xf')||!process['argv'][0x4]||process[_0xeb8c('0xe')][0x4]==='undefined'||process['argv'][0x4]===_0xeb8c('0xf')){throw new Error(_0xeb8c('0x10'));}var FIELDS=_[_0xeb8c('0x11')](process[_0xeb8c('0xe')][0x3][_0xeb8c('0x12')](','),process[_0xeb8c('0xe')][0x4][_0xeb8c('0x12')](','));if(!process['argv'][0x5]||process[_0xeb8c('0xe')][0x5]===_0xeb8c('0xc')||process[_0xeb8c('0xe')][0x5]===_0xeb8c('0xf')){throw new Error(_0xeb8c('0x13'));}var LISTID=process[_0xeb8c('0xe')][0x5];var COMPANYID=process[_0xeb8c('0xe')][0x6]&&process[_0xeb8c('0xe')][0x6]!==_0xeb8c('0xc')&&process['argv'][0x6]!==_0xeb8c('0xf')?process['argv'][0x6]:null;var DUPLICATES=process[_0xeb8c('0xe')][0x7]&&process['argv'][0x7]!==_0xeb8c('0xc')&&process[_0xeb8c('0xe')][0x7]!=='null'?process[_0xeb8c('0xe')][0x7]:null;if(!process['argv'][0x8]||process[_0xeb8c('0xe')][0x8]===_0xeb8c('0xc')||process['argv'][0x8]==='null'){throw new Error(_0xeb8c('0x14'));}var SOCKET_TIMESTAMP=process[_0xeb8c('0xe')][0x8];}catch(_0x437c17){logger['error'](_0x437c17);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(_0x1c5342,_0x49188b,_0x31e926,_0x3625f2){var _0x25aa1b={'message':_0x49188b};_0x25aa1b[_0x1c5342]=!![];if(_0x31e926){_0x25aa1b[_0xeb8c('0x15')]=_0x31e926;}if(_0x3625f2){_0x25aa1b[_0xeb8c('0x16')]=_0x3625f2;}return _0x25aa1b;}function isEmail(_0x3648c7){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'](_0x3648c7);}function checkRow(_0x54c1d1,_0x3c8a73,_0x8f8b88){return new BPromise(function(_0x4bce06,_0x17ccdd){if(_[_0xeb8c('0x17')](_0x54c1d1)){return _0x17ccdd(handleCheckRowError('error',_0xeb8c('0x18'),null,_0x8f8b88));}if(_0x54c1d1[_0xeb8c('0x19')]&&_0x54c1d1[_0xeb8c('0x19')][_0xeb8c('0x1a')]){var _0x135ddb=_['map'](_0x54c1d1[_0xeb8c('0x19')],'message')[_0xeb8c('0x1b')](';');return _0x17ccdd(handleCheckRowError(_0xeb8c('0x1c'),_0x135ddb,null,_0x8f8b88));}var _0xb8a7a1={};for(var _0x4d9262 in FIELDS){if(FIELDS[_0xeb8c('0x1d')](_0x4d9262)&&FIELDS[_0x4d9262]){_0xb8a7a1[_0x4d9262]=_0x54c1d1[_0xeb8c('0x1e')][0x0][FIELDS[_0x4d9262]]||_0x54c1d1[_0xeb8c('0x1e')][0x0]['\ufeff'+FIELDS[_0x4d9262]];}}if(!_0xb8a7a1['firstName']){return _0x17ccdd(handleCheckRowError(_0xeb8c('0x1c'),_0xeb8c('0x1f'),null,_0x8f8b88));}if(!_0xb8a7a1[_0xeb8c('0x20')]){return _0x17ccdd(handleCheckRowError('error',_0xeb8c('0x21'),null,_0x8f8b88));}if(_0xb8a7a1[_0xeb8c('0x22')]){var _0x32bc9d=moment(_0xb8a7a1[_0xeb8c('0x22')],_0xeb8c('0x23'));if(!_0x32bc9d['isValid']()){return _0x17ccdd(handleCheckRowError(_0xeb8c('0x1c'),_0xeb8c('0x24'),null,_0x8f8b88));}}if(_0xb8a7a1['email']){if(!isEmail(_0xb8a7a1[_0xeb8c('0x25')])){return _0x17ccdd(handleCheckRowError(_0xeb8c('0x1c'),_0xeb8c('0x26'),null,_0x8f8b88));}}_0xb8a7a1['ListId']=LISTID;_0xb8a7a1[_0xeb8c('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xeb8c('0x1a')]&&_0x3c8a73){var _0x645c00={};for(var _0x35357b=0x0,_0x5538fa=DUPLICATES[_0xeb8c('0x1a')];_0x35357b<_0x5538fa;_0x35357b+=0x1){_0x645c00[DUPLICATES[_0x35357b]]=_0xb8a7a1[DUPLICATES[_0x35357b]];}var _0x894389=_[_0xeb8c('0x28')](_0x3c8a73,_0x645c00);if(_0x894389){return _0x17ccdd(handleCheckRowError('duplicate',_0xeb8c('0x29'),_0x894389,_0x8f8b88));}}return db['CmContact'][_0xeb8c('0x2a')](_0xb8a7a1,{'raw':!![],'hooks':![],'fields':_[_0xeb8c('0x2b')](_0xb8a7a1)})['then'](function(_0x2c8661){if(DUPLICATES&&DUPLICATES[_0xeb8c('0x1a')]&&_0x3c8a73){_0x3c8a73['push'](_[_0xeb8c('0x2c')](_0xb8a7a1,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2c8661['id'];return _0x4bce06();})['catch'](function(_0x2af0f3){return _0x17ccdd(handleCheckRowError(_0xeb8c('0x1c'),'Error\x20while\x20creating\x20contact:\x20'+(_0x2af0f3['message']||JSON[_0xeb8c('0x2d')](_0x2af0f3)),null,_0x8f8b88));});});}function checkHopper(){function _0x5bae19(){return function(_0x4edf8e){logger['error'](_0xeb8c('0x2e'),_0xeb8c('0x2f'),util[_0xeb8c('0x30')](_0x4edf8e,{'showHidden':![],'depth':null}));};}var _0x2e3ac2=function(_0x59fa4f,_0x570801){var _0x2d58c4=squel[_0xeb8c('0x31')]()[_0xeb8c('0x32')](_0xeb8c('0x33'))['fromQuery']([_0xeb8c('0x20'),_0xeb8c('0x34'),'ContactId',_0xeb8c('0x35'),_0x570801,_0xeb8c('0x36'),_0xeb8c('0x37')],squel[_0xeb8c('0x38')]()[_0xeb8c('0x39')](_0xeb8c('0x20'),_0xeb8c('0x20'))[_0xeb8c('0x39')](_0xeb8c('0x3a'),_0xeb8c('0x34'))[_0xeb8c('0x39')]('id',_0xeb8c('0x3b'))[_0xeb8c('0x39')](LISTID[_0xeb8c('0x3c')](),_0xeb8c('0x35'))['field'](_0x59fa4f['id'][_0xeb8c('0x3c')](),_0x570801)[_0xeb8c('0x39')](_0xeb8c('0x3a'),'createdAt')[_0xeb8c('0x39')](_0xeb8c('0x3a'),_0xeb8c('0x37'))[_0xeb8c('0x3d')]('cm_contacts')[_0xeb8c('0x3e')](_0xeb8c('0x3f'))['where'](_0xeb8c('0x40'),LISTID[_0xeb8c('0x3c')]())[_0xeb8c('0x3e')]('phone\x20IS\x20NOT\x20NULL')[_0xeb8c('0x3e')](_0xeb8c('0x41'),squel['select']()[_0xeb8c('0x39')](_0xeb8c('0x20'))['from'](_0xeb8c('0x33'))[_0xeb8c('0x3e')](_0x570801+_0xeb8c('0x42'),_0x59fa4f['id'][_0xeb8c('0x3c')]())))[_0xeb8c('0x3c')]();return _0x2d58c4;};var _0x2c03d3=function(_0x38873b,_0x5cc19f){var _0x33c6b6=squel[_0xeb8c('0x31')]()[_0xeb8c('0x32')](_0xeb8c('0x33'))[_0xeb8c('0x43')]([_0xeb8c('0x20'),_0xeb8c('0x34'),'ContactId',_0xeb8c('0x35'),_0x5cc19f,_0xeb8c('0x36'),_0xeb8c('0x37')],squel[_0xeb8c('0x38')]()[_0xeb8c('0x39')](_0xeb8c('0x20'),_0xeb8c('0x20'))[_0xeb8c('0x39')](_0xeb8c('0x3a'),'scheduledAt')[_0xeb8c('0x39')]('id',_0xeb8c('0x3b'))['field'](LISTID[_0xeb8c('0x3c')](),_0xeb8c('0x35'))[_0xeb8c('0x39')](_0x38873b['id'][_0xeb8c('0x3c')](),_0x5cc19f)['field'](_0xeb8c('0x3a'),_0xeb8c('0x36'))[_0xeb8c('0x39')](_0xeb8c('0x3a'),_0xeb8c('0x37'))['from']('cm_contacts')['where'](_0xeb8c('0x3f'))['where'](_0xeb8c('0x40'),LISTID[_0xeb8c('0x3c')]())[_0xeb8c('0x3e')](_0xeb8c('0x44'),squel[_0xeb8c('0x45')](hopperContacts))[_0xeb8c('0x3e')](_0xeb8c('0x46'))['where'](_0xeb8c('0x41'),squel['select']()['field'](_0xeb8c('0x47'))['from'](_0xeb8c('0x48'))['where'](_0x5cc19f+'\x20=\x20?',_0x38873b['id']['toString']()))[_0xeb8c('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0xeb8c('0x38')]()[_0xeb8c('0x39')](_0xeb8c('0x20'))[_0xeb8c('0x3d')](_0xeb8c('0x33'))['where'](_0x5cc19f+_0xeb8c('0x42'),_0x38873b['id'][_0xeb8c('0x3c')]())))[_0xeb8c('0x3c')]();return _0x33c6b6;};function _0x4fc853(_0x34c35a,_0x3295ff){var _0x4e7b03=squel['insert']()[_0xeb8c('0x32')]('cm_hopper')[_0xeb8c('0x43')]([_0xeb8c('0x20'),_0xeb8c('0x34'),_0xeb8c('0x3b'),_0xeb8c('0x35'),_0x3295ff,_0xeb8c('0x36'),_0xeb8c('0x37')],squel[_0xeb8c('0x38')]()[_0xeb8c('0x39')](_0xeb8c('0x20'),_0xeb8c('0x20'))['field']('NOW()','scheduledAt')[_0xeb8c('0x39')]('id',_0xeb8c('0x3b'))['field'](LISTID['toString'](),_0xeb8c('0x35'))[_0xeb8c('0x39')](_0x34c35a['id'][_0xeb8c('0x3c')](),_0x3295ff)[_0xeb8c('0x39')](_0xeb8c('0x3a'),_0xeb8c('0x36'))[_0xeb8c('0x39')](_0xeb8c('0x3a'),_0xeb8c('0x37'))['from'](_0xeb8c('0x49'))[_0xeb8c('0x3e')](_0xeb8c('0x3f'))[_0xeb8c('0x3e')](_0xeb8c('0x40'),LISTID[_0xeb8c('0x3c')]())[_0xeb8c('0x3e')](_0xeb8c('0x44'),squel['str'](hopperContacts))[_0xeb8c('0x3e')](_0xeb8c('0x46')))['toString']();return _0x4e7b03;}function _0x43e8c0(_0x378174,_0x197109){var _0x47530f=squel[_0xeb8c('0x31')]()[_0xeb8c('0x32')](_0xeb8c('0x4a'))['fromQuery']([_0xeb8c('0x20'),'ContactId',_0xeb8c('0x35'),_0x197109,_0xeb8c('0x36'),'updatedAt'],squel[_0xeb8c('0x38')]()[_0xeb8c('0x39')](_0xeb8c('0x20'),'phone')['field']('id','ContactId')['field'](LISTID[_0xeb8c('0x3c')](),_0xeb8c('0x35'))[_0xeb8c('0x39')](_0x378174['id']['toString'](),_0x197109)[_0xeb8c('0x39')](_0xeb8c('0x3a'),'createdAt')[_0xeb8c('0x39')](_0xeb8c('0x3a'),'updatedAt')[_0xeb8c('0x3d')](_0xeb8c('0x49'))[_0xeb8c('0x3e')]('deletedAt\x20IS\x20NULL')[_0xeb8c('0x3e')]('ListId\x20=\x20?',LISTID['toString']())[_0xeb8c('0x3e')](_0xeb8c('0x44'),squel[_0xeb8c('0x45')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0xeb8c('0x3c')]();return _0x47530f;}return db[_0xeb8c('0x4b')][_0xeb8c('0x4c')]({'where':{'type':'outbound'},'attributes':['id',_0xeb8c('0x4d')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0xeb8c('0x4e')](function(_0x5dff28){var _0x1a6b05=[];if(_0x5dff28){var _0x217dbb;for(var _0x42dc1e=0x0,_0x481cd1;_0x42dc1e<_0x5dff28[_0xeb8c('0x1a')];_0x42dc1e+=0x1){_0x481cd1=_0x5dff28[_0x42dc1e]['get']({'plain':!![]});switch(_0x481cd1[_0xeb8c('0x4d')]){case _0xeb8c('0x4f'):_0x1a6b05[_0xeb8c('0x50')](db['sequelize'][_0xeb8c('0x51')](_0x2c03d3(_0x481cd1,'VoiceQueueId'))[_0xeb8c('0x4e')](function(){})[_0xeb8c('0x52')](_0x5bae19()));break;case'onlyIfOpen':_0x1a6b05[_0xeb8c('0x50')](db[_0xeb8c('0x53')][_0xeb8c('0x51')](_0x2e3ac2(_0x481cd1,'VoiceQueueId'))[_0xeb8c('0x4e')](function(){})[_0xeb8c('0x52')](_0x5bae19()));break;default:_0x1a6b05[_0xeb8c('0x50')](db[_0xeb8c('0x53')][_0xeb8c('0x51')](_0x4fc853(_0x481cd1,'VoiceQueueId'))[_0xeb8c('0x4e')](function(){})['catch'](_0x5bae19()));}}}return _0x1a6b05;})[_0xeb8c('0x54')]()[_0xeb8c('0x4e')](function(){return db[_0xeb8c('0x4b')]['findAll']({'where':{'type':_0xeb8c('0x55')},'attributes':['id'],'include':[{'model':db[_0xeb8c('0x56')],'as':_0xeb8c('0x57'),'where':{'id':LISTID}}]})['then'](function(_0x4414e2){var _0x14f62b=[];if(_0x4414e2){var _0x40c3ee;for(var _0x57adc1=0x0,_0x2905f8;_0x57adc1<_0x4414e2[_0xeb8c('0x1a')];_0x57adc1+=0x1){_0x2905f8=_0x4414e2[_0x57adc1]['get']({'plain':!![]});_0x14f62b['push'](db[_0xeb8c('0x53')][_0xeb8c('0x51')](_0x43e8c0(_0x2905f8,_0xeb8c('0x58')))[_0xeb8c('0x4e')](function(){})[_0xeb8c('0x52')](_0x5bae19()));}}return _0x14f62b;})[_0xeb8c('0x54')]();})[_0xeb8c('0x4e')](function(){return db[_0xeb8c('0x59')]['findAll']({'attributes':['id',_0xeb8c('0x4d')],'include':[{'model':db[_0xeb8c('0x56')],'as':_0xeb8c('0x5a'),'where':{'id':LISTID}}]})['then'](function(_0x1251bf){var _0x5bee27=[];if(_0x1251bf){for(var _0x21780d=0x0,_0x87173e;_0x21780d<_0x1251bf['length'];_0x21780d+=0x1){_0x87173e=_0x1251bf[_0x21780d][_0xeb8c('0x5b')]({'plain':!![]});switch(_0x87173e['dialCheckDuplicateType']){case'always':_0x5bee27[_0xeb8c('0x50')](db[_0xeb8c('0x53')][_0xeb8c('0x51')](_0x2c03d3(_0x87173e,'CampaignId'))[_0xeb8c('0x4e')](function(){})[_0xeb8c('0x52')](_0x5bae19()));break;case _0xeb8c('0x5c'):_0x5bee27[_0xeb8c('0x50')](db[_0xeb8c('0x53')][_0xeb8c('0x51')](_0x2e3ac2(_0x87173e,_0xeb8c('0x5d')))[_0xeb8c('0x4e')](function(){})[_0xeb8c('0x52')](_0x5bae19()));break;default:_0x5bee27[_0xeb8c('0x50')](db[_0xeb8c('0x53')]['query'](_0x4fc853(_0x87173e,_0xeb8c('0x5d')))[_0xeb8c('0x4e')](function(){})[_0xeb8c('0x52')](_0x5bae19()));}}}return _0x5bee27;})[_0xeb8c('0x54')]();})['then'](function(){return db[_0xeb8c('0x59')][_0xeb8c('0x4c')]({'attributes':['id'],'include':[{'model':db[_0xeb8c('0x56')],'as':_0xeb8c('0x57'),'where':{'id':LISTID}}]})[_0xeb8c('0x4e')](function(_0x3d4e40){var _0x4db8d8=[];if(_0x3d4e40){for(var _0x3f50d2=0x0,_0x105e55;_0x3f50d2<_0x3d4e40[_0xeb8c('0x1a')];_0x3f50d2+=0x1){_0x105e55=_0x3d4e40[_0x3f50d2][_0xeb8c('0x5b')]({'plain':!![]});_0x4db8d8[_0xeb8c('0x50')](db[_0xeb8c('0x53')][_0xeb8c('0x51')](_0x43e8c0(_0x105e55,_0xeb8c('0x5d')))[_0xeb8c('0x4e')](function(){})[_0xeb8c('0x52')](_0x5bae19()));}}return _0x4db8d8;})[_0xeb8c('0x54')]();})[_0xeb8c('0x52')](function(_0x338de1){logger[_0xeb8c('0x1c')](_0xeb8c('0x5e'),'generalCheckHopper',_0x338de1[_0xeb8c('0x5f')]);});}var processPromises=function(_0x303241){return BPromise[_0xeb8c('0x54')](promises)[_0xeb8c('0x4e')](function(_0x5544d7){})[_0xeb8c('0x52')](function(_0x14fc7b){logger[_0xeb8c('0x1c')](_0xeb8c('0x60'),JSON[_0xeb8c('0x2d')](_0x14fc7b));})[_0xeb8c('0x61')](function(){socket[_0xeb8c('0x62')](_0xeb8c('0x63')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x303241){return _0x303241[_0xeb8c('0x64')]();}});};var endCsv=function(){return BPromise[_0xeb8c('0x65')]()[_0xeb8c('0x4e')](function(){if(hopperContacts){return checkHopper();}})[_0xeb8c('0x4e')](function(){socket[_0xeb8c('0x62')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xeb8c('0x66')](FILEPATH);}catch(_0x466d36){logger[_0xeb8c('0x1c')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0xeb8c('0x2d')](_0x466d36));}finally{process['exit'](0x0);}});};process['on'](_0xeb8c('0x67'),function(){logger[_0xeb8c('0x68')](_0xeb8c('0x69'));endCsv();});function main(){return BPromise['resolve']()[_0xeb8c('0x4e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0xeb8c('0x6a')][_0xeb8c('0x4c')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xeb8c('0x4e')](function(_0x4f7b6d){var _0x4a1b2e=fs[_0xeb8c('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xeb8c('0x6c')](_0x4a1b2e,{'header':!![],'skipEmptyLines':!![],'step':function(_0x265b4c,_0x55dca0){total+=0x1;var _0x51365e=total;promises[_0xeb8c('0x50')](checkRow(_0x265b4c,_0x4f7b6d,_0x51365e)[_0xeb8c('0x4e')](function(){success+=0x1;})['catch'](function(_0x47bdcd){if(_0x47bdcd[_0xeb8c('0x1c')]){errors+=0x1;delete _0x47bdcd[_0xeb8c('0x1c')];}else if(_0x47bdcd[_0xeb8c('0x6d')]){duplicates+=0x1;delete _0x47bdcd[_0xeb8c('0x6d')];}rows[_0xeb8c('0x50')](_0x47bdcd);}));if(total%0xc8===0x0){_0x55dca0[_0xeb8c('0x6e')]();return processPromises(_0x55dca0);}},'complete':function(){return processPromises()[_0xeb8c('0x4e')](function(){logger[_0xeb8c('0x68')](_0xeb8c('0x6f'));endCsv();});},'error':function(_0x14db3e,_0x54274a){logger[_0xeb8c('0x68')](_0xeb8c('0x70'),JSON[_0xeb8c('0x2d')](_0x14db3e));endCsv();}});})[_0xeb8c('0x52')](function(_0x21d1da){logger[_0xeb8c('0x1c')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0xeb8c('0x2d')](_0x21d1da));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index a2d8bb3..ceeaf09 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 _0x0b7f=['cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','toString','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','keys','CompanyId','insert',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','error','exit','push','code','message','sequelize','catch','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','header','writeFileSync','parse','data','rows','errors','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','includes','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','length','SystemRow','appendFileSync','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','then','finish','affectedRows','unlink','argv','arguments\x20\x20\x20','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','into','cm_hopper','fromQuery','scheduledat','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?'];(function(_0x40c50e,_0x3c645b){var _0x3f2686=function(_0x382e41){while(--_0x382e41){_0x40c50e['push'](_0x40c50e['shift']());}};_0x3f2686(++_0x3c645b);}(_0x0b7f,0x1d0));var _0xf0b7=function(_0x3e6d97,_0xec789){_0x3e6d97=_0x3e6d97-0x0;var _0x45035e=_0x0b7f[_0x3e6d97];return _0x45035e;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xf0b7('0x0'));var Papa=require(_0xf0b7('0x1'));var util=require(_0xf0b7('0x2'));var BPromise=require(_0xf0b7('0x3'));var moment=require(_0xf0b7('0x4'));var squel=require(_0xf0b7('0x5'));var Redis=require(_0xf0b7('0x6'));var db=require(_0xf0b7('0x7'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xf0b7('0x8'));config[_0xf0b7('0x9')]=_['defaults'](config[_0xf0b7('0x9')],{'host':_0xf0b7('0xa'),'port':0x18eb});var socket=require(_0xf0b7('0xb'))(new Redis(config[_0xf0b7('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xf0b7('0xc')](_0xf0b7('0xd'));function isEmail(_0x3535f2){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'](_0x3535f2);}function selectNotIn(_0x44f5c1,_0x4fc096,_0x727fde,_0x24398b,_0x4d85e5){return squel[_0xf0b7('0xe')]()[_0xf0b7('0xf')](_0xf0b7('0x10'))[_0xf0b7('0x11')](_0x24398b)[_0xf0b7('0x12')](_0x4fc096,null,_0x4fc096+_0xf0b7('0x13')+_0x24398b+'.'+_0x727fde)[_0xf0b7('0x14')](_0x24398b+'.'+_0x727fde+_0xf0b7('0x15')+_0x44f5c1+'.'+_0x727fde)[_0xf0b7('0x14')](_0x4fc096+'.dialCheckDuplicateType\x20IN\x20('+_0x4d85e5['join']()+')');}function insertCmHopper(_0x1c5bfd,_0x3a03e3,_0x52d603,_0x2bb129,_0x539e32){var _0x404688=[_0xf0b7('0x16'),_0xf0b7('0x17'),_0xf0b7('0x18'),_0xf0b7('0x19'),_0x3a03e3+'.'+_0x2bb129,_0xf0b7('0x1a'),_0xf0b7('0x1b'),'cm_contacts.priority',_0xf0b7('0x1c'),'\x22'+_0x539e32+'\x22'];return squel['insert']()[_0xf0b7('0x1d')](_0xf0b7('0x1e'))[_0xf0b7('0x1f')](['phone',_0xf0b7('0x20'),'ContactId',_0xf0b7('0x21'),_0x2bb129,_0xf0b7('0x22'),_0xf0b7('0x23'),_0xf0b7('0x24'),_0xf0b7('0x25'),_0xf0b7('0x26')],squel[_0xf0b7('0xe')]()[_0xf0b7('0x27')](_0x404688)[_0xf0b7('0x11')](_0x3a03e3)[_0xf0b7('0x12')](_0xf0b7('0x28'),null,_0xf0b7('0x29')+_0x3a03e3+_0xf0b7('0x2a'))['join'](_0x52d603,null,_0x52d603+_0xf0b7('0x13')+_0x3a03e3+'.'+_0x2bb129)[_0xf0b7('0x14')](_0x3a03e3+_0xf0b7('0x2b'),_0x1c5bfd)[_0xf0b7('0x14')](_0xf0b7('0x2c'),NOW)[_0xf0b7('0x14')](_0xf0b7('0x2d'),selectNotIn(_0x3a03e3,_0x52d603,_0x2bb129,_0xf0b7('0x1e'),['\x22always\x22',_0xf0b7('0x2e')]))[_0xf0b7('0x14')](_0xf0b7('0x2d'),selectNotIn(_0x3a03e3,_0x52d603,_0x2bb129,'cm_hopper',[_0xf0b7('0x2f')])))[_0xf0b7('0x30')]();}function insertCmHopperBlack(_0x5a3d7d,_0x1c31f4,_0xf1426c,_0x309dc7){var _0x31490c=[_0xf0b7('0x16'),_0xf0b7('0x18'),_0xf0b7('0x19'),_0x1c31f4+'.'+_0x309dc7,_0xf0b7('0x1a'),_0xf0b7('0x1b')];return squel['insert']()[_0xf0b7('0x1d')](_0xf0b7('0x31'))[_0xf0b7('0x1f')]([_0xf0b7('0x10'),'ContactId','ListId',_0x309dc7,_0xf0b7('0x22'),_0xf0b7('0x23')],squel[_0xf0b7('0xe')]()['fields'](_0x31490c)[_0xf0b7('0x11')](_0x1c31f4)[_0xf0b7('0x12')]('cm_contacts',null,_0xf0b7('0x29')+_0x1c31f4+_0xf0b7('0x2a'))[_0xf0b7('0x12')](_0xf1426c,null,_0xf1426c+_0xf0b7('0x13')+_0x1c31f4+'.'+_0x309dc7)['where'](_0x1c31f4+_0xf0b7('0x2b'),_0x5a3d7d)['where'](_0xf0b7('0x2c'),NOW)[_0xf0b7('0x14')](_0xf0b7('0x2d'),squel[_0xf0b7('0xe')]()[_0xf0b7('0xf')]('phone')['from'](_0xf0b7('0x31'))[_0xf0b7('0x14')](_0xf0b7('0x32'),_0x5a3d7d)['where'](_0x309dc7+_0xf0b7('0x33'),_0x1c31f4+'.'+_0x309dc7)))['toString']();}function insertCmContact(_0x43de8d,_0x1a3843,_0x42efcf,_0x47ca98){var _0x3d7058=_['concat'](_[_0xf0b7('0x34')](_0x47ca98),['ListId',_0xf0b7('0x35'),_0xf0b7('0x22'),_0xf0b7('0x23')]);return squel[_0xf0b7('0x36')]()[_0xf0b7('0x1d')]('cm_contacts')['fromQuery'](_0x3d7058,squel[_0xf0b7('0xe')]()['fields'](_0x3d7058)[_0xf0b7('0x11')](_0x1a3843)[_0xf0b7('0x14')]('('+_0x42efcf[_0xf0b7('0x12')](',')+_0xf0b7('0x37'),squel[_0xf0b7('0xe')]()[_0xf0b7('0x27')](_0x42efcf)[_0xf0b7('0x11')](_0xf0b7('0x28'))[_0xf0b7('0x14')]('ListId\x20=\x20?',_0x43de8d)[_0xf0b7('0x14')](_0xf0b7('0x38')))[_0xf0b7('0x14')](_0xf0b7('0x39'),squel[_0xf0b7('0xe')]()[_0xf0b7('0xf')]('MIN(id)',_0xf0b7('0x3a'))[_0xf0b7('0x11')](_0x1a3843)[_0xf0b7('0x3b')](_0x42efcf[_0xf0b7('0x12')](','))))[_0xf0b7('0x30')]();}function handleStop(){logger[_0xf0b7('0x3c')](_0xf0b7('0x3d'));stopped=!![];}function handleUncaughtException(_0x3f2726){logger[_0xf0b7('0x3e')](_0x3f2726['message']);process[_0xf0b7('0x3f')](0x1);}function handleError(_0x17bbf4,_0x310d23){stats['errors'][_0xf0b7('0x40')]({'name':_0x310d23[_0xf0b7('0x41')],'message':_0x310d23[_0xf0b7('0x42')],'row':_0x17bbf4});}function handleQuery(_0x28e1d7){logger[_0xf0b7('0x3c')](_0x28e1d7);return db[_0xf0b7('0x43')]['query'](_0x28e1d7)['spread'](function(_0x38c9a4){results['push'](_0x38c9a4);})[_0xf0b7('0x44')](function(_0x5da92a){logger[_0xf0b7('0x3e')](_0x5da92a[_0xf0b7('0x42')]);});}function main(_0x5ddb45,_0x49c30a,_0x4220dd,_0x578868){logger[_0xf0b7('0x3c')]('main',_0x5ddb45,JSON[_0xf0b7('0x45')](_0x49c30a));process[_0xf0b7('0x46')](_0xf0b7('0x47'));var _0x271807=_0x49c30a[_0xf0b7('0x48')];var _0xddbdaa=_0x49c30a[_0xf0b7('0x49')];var _0x164afa=path[_0xf0b7('0x12')](config[_0xf0b7('0x4a')],_0xf0b7('0x4b'),_0xddbdaa+'.csv');var _0xcec30a=_['keys'](_0x271807)[_0xf0b7('0x12')]();logger[_0xf0b7('0x3c')](_0xf0b7('0x4c'),_0xcec30a);fs[_0xf0b7('0x4d')](_0x164afa,_0xcec30a+'\x0a');Papa[_0xf0b7('0x4e')](fs['createReadStream'](_0x5ddb45),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1eaa55,_0x1a46b1){try{for(var _0x228f15=0x0,_0x322470=[];_0x228f15<_0x1eaa55[_0xf0b7('0x4f')]['length'];_0x228f15++){stats[_0xf0b7('0x50')]+=0x1;if(_0x1eaa55[_0xf0b7('0x51')][_0x228f15]){handleError(_0x1eaa55[_0xf0b7('0x4f')][_0x228f15],_0x1eaa55['errors'][_0x228f15]);}else{var _0x52f32b=[];for(var _0x3482df in _0x271807){if(_0x271807[_0xf0b7('0x52')](_0x3482df)){if(_0x1eaa55[_0xf0b7('0x4f')][_0x228f15][_0x271807[_0x3482df]]){var _0x359036=_[_0xf0b7('0x53')](_0x1eaa55[_0xf0b7('0x4f')][_0x228f15][_0x271807[_0x3482df]][_0xf0b7('0x54')](/"/g,'\x27'));switch(_0x3482df){case _0xf0b7('0x20'):var _0x41d5d4=moment(_0x359036,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x41d5d4[_0xf0b7('0x55')]()){_0x322470['push']('\x22'+_0x359036+'\x22');}else{_0x52f32b[_0xf0b7('0x40')](_0xf0b7('0x56'));}break;case _0xf0b7('0x24'):var _0x203f68=parseInt(_0x359036);_0x359036=_['isNaN'](_0x203f68)||_0x203f68<0x0||_0x203f68>0x4?_0x578868?0x3:0x2:_0x203f68;_0x322470[_0xf0b7('0x40')]('\x22'+_0x359036+'\x22');break;case _0xf0b7('0x25'):var _0x46a606=parseInt(_0x359036);if(_[_0xf0b7('0x57')](_0x46a606)&&_[_0xf0b7('0x58')](_0x4220dd,_0x46a606)){_0x322470[_0xf0b7('0x40')]('\x22'+_0x46a606+'\x22');}else{_0x52f32b['push'](_0xf0b7('0x59'));}break;case'email':if(isEmail(_0x359036)){_0x322470[_0xf0b7('0x40')]('\x22'+_0x359036+'\x22');}else{_0x52f32b['push'](_0xf0b7('0x5a'));}break;case'dateOfBirth':var _0x36b3e5=moment(_0x359036,'YYYY-MM-DD',!![]);if(_0x36b3e5[_0xf0b7('0x55')]()){_0x322470['push']('\x22'+_0x359036+'\x22');}else{_0x52f32b[_0xf0b7('0x40')](_0xf0b7('0x5b'));}break;default:_0x322470['push']('\x22'+_0x359036+'\x22');}}else{switch(_0x3482df){case'firstName':case _0xf0b7('0x10'):_0x52f32b[_0xf0b7('0x40')](_0x3482df+'\x20not\x20specified');break;default:_0x322470['push']('\x22\x22');}}}}if(_0x52f32b[_0xf0b7('0x5c')]){handleError(_0x1eaa55[_0xf0b7('0x4f')][_0x228f15],{'code':_0xf0b7('0x5d'),'message':_0x52f32b['join']()});}else{fs[_0xf0b7('0x5e')](_0x164afa,_0x322470[_0xf0b7('0x12')]()+'\x0a');}_0x322470=[];}if(!(stats[_0xf0b7('0x50')]%0xc8)){socket['emit']('contact:import:'+_0xddbdaa,stats);stats['errors']=[];}}if(stopped){logger[_0xf0b7('0x3c')](_0xf0b7('0x5f'));_0x1a46b1[_0xf0b7('0x60')]();}}catch(_0x2f40cd){handleError(_0x1eaa55['data'][_0x228f15],{'code':_0xf0b7('0x61'),'message':_0x2f40cd[_0xf0b7('0x42')]});logger[_0xf0b7('0x3e')](_0xf0b7('0x62'),_0x2f40cd[_0xf0b7('0x42')]);}},'complete':function(){try{var _0x5c830b=[];var _0x51b9e3='cm_contacts';if(_0x49c30a[_0xf0b7('0x63')]&&_0x49c30a[_0xf0b7('0x63')]['length']){_0x51b9e3=_0xf0b7('0x64')+_0xddbdaa;_0x5c830b[_0xf0b7('0x40')](_0xf0b7('0x65')+_0x51b9e3+_0xf0b7('0x66'));}var _0x44e5a8=util[_0xf0b7('0xc')](_0xf0b7('0x67'),_0x164afa,_0x51b9e3,_0xcec30a,_0x49c30a['ListId'],_0x49c30a[_0xf0b7('0x35')]||null,NOW,NOW);if(_[_0xf0b7('0x68')](_0x271807[_0xf0b7('0x20')])){_0x44e5a8+=_0xf0b7('0x69');}_0x5c830b[_0xf0b7('0x40')](_0x44e5a8);if(_0x49c30a['duplicates']&&_0x49c30a['duplicates'][_0xf0b7('0x5c')]){_0x5c830b[_0xf0b7('0x40')](insertCmContact(_0x49c30a[_0xf0b7('0x21')],_0x51b9e3,_0x49c30a[_0xf0b7('0x63')],_0x271807));_0x5c830b[_0xf0b7('0x40')](_0xf0b7('0x6a')+_0x51b9e3+';');}_0x5c830b[_0xf0b7('0x40')](insertCmHopper(_0x49c30a['ListId'],_0xf0b7('0x6b'),_0xf0b7('0x6c'),_0xf0b7('0x6d'),_0x578868));_0x5c830b[_0xf0b7('0x40')](insertCmHopperBlack(_0x49c30a[_0xf0b7('0x21')],_0xf0b7('0x6e'),_0xf0b7('0x6c'),'VoiceQueueId'));_0x5c830b[_0xf0b7('0x40')](insertCmHopper(_0x49c30a['ListId'],_0xf0b7('0x6f'),_0xf0b7('0x70'),_0xf0b7('0x71'),_0x578868));_0x5c830b['push'](insertCmHopperBlack(_0x49c30a[_0xf0b7('0x21')],_0xf0b7('0x72'),'campaigns','CampaignId'));BPromise['each'](_0x5c830b,handleQuery)[_0xf0b7('0x73')](function(_0x4df49a){stats[_0xf0b7('0x74')]=!![];stats[_0xf0b7('0x75')]=_0x49c30a[_0xf0b7('0x63')]&&_0x49c30a[_0xf0b7('0x63')][_0xf0b7('0x5c')]?results[0x2][_0xf0b7('0x75')]:results[0x0][_0xf0b7('0x75')];socket['emit']('contact:import:'+_0xddbdaa,stats);fs[_0xf0b7('0x76')](_0x5ddb45);fs['unlink'](_0x164afa);process[_0xf0b7('0x3f')](0x0);})[_0xf0b7('0x44')](function(_0x3041f8){logger['error'](_0x3041f8[_0xf0b7('0x42')]);process[_0xf0b7('0x3f')](0x1);});}catch(_0x38276a){logger['error']('complete',_0x38276a[_0xf0b7('0x42')]);process[_0xf0b7('0x3f')](0x1);}},'error':function(_0x5705be,_0x28d783,_0x3eda01,_0x384e29){throw new Error(_0x384e29);}});}function validate(){if(process[_0xf0b7('0x77')]&&process[_0xf0b7('0x77')][_0xf0b7('0x5c')]<0x4){throw new Error(_0xf0b7('0x78'));}var _0x6a10b6=path[_0xf0b7('0x12')](config[_0xf0b7('0x4a')],_0xf0b7('0x4b'),process[_0xf0b7('0x77')][0x2]);if(!fs['existsSync'](_0x6a10b6)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x1c5c90={};try{_0x1c5c90=JSON[_0xf0b7('0x4e')](process[_0xf0b7('0x77')][0x3]);if(!_0x1c5c90[_0xf0b7('0x48')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x1c5c90[_0xf0b7('0x48')][_0xf0b7('0x10')]){throw new Error(_0xf0b7('0x79'));}if(!_0x1c5c90[_0xf0b7('0x48')]['firstName']){throw new Error('firstName\x20is\x20mandatory');}var _0x4e6271=0x0;if(_0x1c5c90[_0xf0b7('0x48')][_0xf0b7('0x25')]){_0x4e6271=0x1;}if(!_0x1c5c90[_0xf0b7('0x21')]){throw new Error(_0xf0b7('0x7a'));}}catch(_0x564b45){throw new Error(_0xf0b7('0x7b'));}var _0x4819d5=[];try{_0x4819d5=_[_0xf0b7('0x7c')](JSON[_0xf0b7('0x4e')](process[_0xf0b7('0x77')][0x4]),'id');}catch(_0x5a7e23){logger['info']('No\x20agent\x20available');}main(_0x6a10b6,_0x1c5c90,_0x4819d5,_0x4e6271);}validate();process['on'](_0xf0b7('0x7d'),handleStop);process['on'](_0xf0b7('0x7e'),handleUncaughtException); \ No newline at end of file +var _0x4902=['ContactId','ListId','createdAt','priority','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_hopper','\x22onlyIfOpen\x22','\x22always\x22','toString','cm_hopper_black','updatedAt','cm_contacts.phone\x20NOT\x20IN\x20(?)','ListId\x20=\x20?','\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','MIN(id)','group','Received\x20SIGINT','message','exit','push','code','info','sequelize','query','spread','catch','error','stringify','send','start','root','server/files/tmp','header','parse','data','length','rows','errors','hasOwnProperty','trim','replace','scheduledat','UserId','isNumber','includes','email','email\x20wrong\x20format','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','then','finish','affectedRows','contact:import:','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','path','papaparse','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','insert','into','fromQuery'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x4902,0x64));var _0x2490=function(_0x4058d9,_0x240215){_0x4058d9=_0x4058d9-0x0;var _0x184d87=_0x4902[_0x4058d9];return _0x184d87;};'use strict';var fs=require('fs');var path=require(_0x2490('0x0'));var _=require('lodash');var Papa=require(_0x2490('0x1'));var util=require('util');var BPromise=require(_0x2490('0x2'));var moment=require(_0x2490('0x3'));var squel=require(_0x2490('0x4'));var Redis=require(_0x2490('0x5'));var db=require(_0x2490('0x6'))['db'];var config=require(_0x2490('0x7'));var logger=require('../../../config/logger')('import');config[_0x2490('0x8')]=_[_0x2490('0x9')](config[_0x2490('0x8')],{'host':_0x2490('0xa'),'port':0x18eb});var socket=require(_0x2490('0xb'))(new Redis(config[_0x2490('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x2490('0xc')](_0x2490('0xd'));function isEmail(_0x323881){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))*$/[_0x2490('0xe')](_0x323881);}function selectNotIn(_0x22aeaf,_0x593fb6,_0x57420d,_0x593afa,_0x3d42b5){return squel[_0x2490('0xf')]()[_0x2490('0x10')](_0x2490('0x11'))[_0x2490('0x12')](_0x593afa)[_0x2490('0x13')](_0x593fb6,null,_0x593fb6+_0x2490('0x14')+_0x593afa+'.'+_0x57420d)[_0x2490('0x15')](_0x593afa+'.'+_0x57420d+_0x2490('0x16')+_0x22aeaf+'.'+_0x57420d)[_0x2490('0x15')](_0x593fb6+_0x2490('0x17')+_0x3d42b5['join']()+')');}function insertCmHopper(_0xdf7d73,_0x44dbb0,_0x4ebb4d,_0x45b4ce,_0xbb2141){var _0x7b8f4b=[_0x2490('0x18'),'cm_contacts.scheduledat',_0x2490('0x19'),_0x2490('0x1a'),_0x44dbb0+'.'+_0x45b4ce,_0x2490('0x1b'),_0x2490('0x1c'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0xbb2141+'\x22'];return squel[_0x2490('0x1d')]()[_0x2490('0x1e')]('cm_hopper')[_0x2490('0x1f')]([_0x2490('0x11'),'scheduledat',_0x2490('0x20'),_0x2490('0x21'),_0x45b4ce,_0x2490('0x22'),'updatedAt',_0x2490('0x23'),'UserId',_0x2490('0x24')],squel[_0x2490('0xf')]()[_0x2490('0x25')](_0x7b8f4b)[_0x2490('0x12')](_0x44dbb0)['join'](_0x2490('0x26'),null,_0x2490('0x27')+_0x44dbb0+_0x2490('0x28'))[_0x2490('0x13')](_0x4ebb4d,null,_0x4ebb4d+_0x2490('0x14')+_0x44dbb0+'.'+_0x45b4ce)[_0x2490('0x15')](_0x44dbb0+_0x2490('0x29'),_0xdf7d73)[_0x2490('0x15')](_0x2490('0x2a'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x44dbb0,_0x4ebb4d,_0x45b4ce,_0x2490('0x2b'),['\x22always\x22',_0x2490('0x2c')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x44dbb0,_0x4ebb4d,_0x45b4ce,'cm_hopper',[_0x2490('0x2d')])))[_0x2490('0x2e')]();}function insertCmHopperBlack(_0x510812,_0xc0c6a5,_0x16e99f,_0x575d8a){var _0x138119=[_0x2490('0x18'),_0x2490('0x19'),_0x2490('0x1a'),_0xc0c6a5+'.'+_0x575d8a,_0x2490('0x1b'),_0x2490('0x1c')];return squel[_0x2490('0x1d')]()[_0x2490('0x1e')](_0x2490('0x2f'))[_0x2490('0x1f')](['phone',_0x2490('0x20'),_0x2490('0x21'),_0x575d8a,_0x2490('0x22'),_0x2490('0x30')],squel[_0x2490('0xf')]()[_0x2490('0x25')](_0x138119)['from'](_0xc0c6a5)['join'](_0x2490('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0xc0c6a5+_0x2490('0x28'))['join'](_0x16e99f,null,_0x16e99f+_0x2490('0x14')+_0xc0c6a5+'.'+_0x575d8a)[_0x2490('0x15')](_0xc0c6a5+_0x2490('0x29'),_0x510812)[_0x2490('0x15')](_0x2490('0x2a'),NOW)['where'](_0x2490('0x31'),squel['select']()[_0x2490('0x10')]('phone')[_0x2490('0x12')]('cm_hopper_black')[_0x2490('0x15')](_0x2490('0x32'),_0x510812)[_0x2490('0x15')](_0x575d8a+_0x2490('0x33'),_0xc0c6a5+'.'+_0x575d8a)))[_0x2490('0x2e')]();}function insertCmContact(_0x540adc,_0xbac590,_0xd58dcd,_0x346a90){var _0x4b7b8b=_[_0x2490('0x34')](_[_0x2490('0x35')](_0x346a90),['ListId',_0x2490('0x36'),_0x2490('0x22'),'updatedAt']);return squel[_0x2490('0x1d')]()[_0x2490('0x1e')](_0x2490('0x26'))[_0x2490('0x1f')](_0x4b7b8b,squel[_0x2490('0xf')]()[_0x2490('0x25')](_0x4b7b8b)[_0x2490('0x12')](_0xbac590)[_0x2490('0x15')]('('+_0xd58dcd[_0x2490('0x13')](',')+_0x2490('0x37'),squel['select']()['fields'](_0xd58dcd)[_0x2490('0x12')](_0x2490('0x26'))['where'](_0x2490('0x32'),_0x540adc)[_0x2490('0x15')](_0x2490('0x38')))[_0x2490('0x15')]('id\x20IN\x20?',squel[_0x2490('0xf')]()[_0x2490('0x10')](_0x2490('0x39'),'min_id')['from'](_0xbac590)[_0x2490('0x3a')](_0xd58dcd[_0x2490('0x13')](','))))['toString']();}function handleStop(){logger['info'](_0x2490('0x3b'));stopped=!![];}function handleUncaughtException(_0x548ca7){logger['error'](_0x548ca7[_0x2490('0x3c')]);process[_0x2490('0x3d')](0x1);}function handleError(_0xba79f9,_0x39307d){stats['errors'][_0x2490('0x3e')]({'name':_0x39307d[_0x2490('0x3f')],'message':_0x39307d[_0x2490('0x3c')],'row':_0xba79f9});}function handleQuery(_0x5a1e9d){logger[_0x2490('0x40')](_0x5a1e9d);return db[_0x2490('0x41')][_0x2490('0x42')](_0x5a1e9d)[_0x2490('0x43')](function(_0x32aa45){results[_0x2490('0x3e')](_0x32aa45);})[_0x2490('0x44')](function(_0x11af58){logger[_0x2490('0x45')](_0x11af58[_0x2490('0x3c')]);});}function main(_0x1506d5,_0x34dd00,_0x2a3fc9,_0x5b5413){logger[_0x2490('0x40')]('main',_0x1506d5,JSON[_0x2490('0x46')](_0x34dd00));process[_0x2490('0x47')](_0x2490('0x48'));var _0x1a7802=_0x34dd00['binding'];var _0x487a3b=_0x34dd00['socket_timestamp'];var _0x286d19=path[_0x2490('0x13')](config[_0x2490('0x49')],_0x2490('0x4a'),_0x487a3b+'.csv');var _0x7ec188=_[_0x2490('0x35')](_0x1a7802)[_0x2490('0x13')]();logger[_0x2490('0x40')](_0x2490('0x4b'),_0x7ec188);fs['writeFileSync'](_0x286d19,_0x7ec188+'\x0a');Papa[_0x2490('0x4c')](fs['createReadStream'](_0x1506d5),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1db006,_0x36a00f){try{for(var _0x450f4a=0x0,_0x17f52e=[];_0x450f4a<_0x1db006[_0x2490('0x4d')][_0x2490('0x4e')];_0x450f4a++){stats[_0x2490('0x4f')]+=0x1;if(_0x1db006[_0x2490('0x50')][_0x450f4a]){handleError(_0x1db006[_0x2490('0x4d')][_0x450f4a],_0x1db006['errors'][_0x450f4a]);}else{var _0x3baf6b=[];for(var _0x1f6c21 in _0x1a7802){if(_0x1a7802[_0x2490('0x51')](_0x1f6c21)){if(_0x1db006[_0x2490('0x4d')][_0x450f4a][_0x1a7802[_0x1f6c21]]){var _0x45f2f4=_[_0x2490('0x52')](_0x1db006[_0x2490('0x4d')][_0x450f4a][_0x1a7802[_0x1f6c21]][_0x2490('0x53')](/"/g,'\x27'));switch(_0x1f6c21){case _0x2490('0x54'):var _0xcb560a=moment(_0x45f2f4,_0x2490('0xd'),!![]);if(_0xcb560a['isValid']()){_0x17f52e['push']('\x22'+_0x45f2f4+'\x22');}else{_0x3baf6b[_0x2490('0x3e')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x2490('0x23'):var _0x1ed82d=parseInt(_0x45f2f4);_0x45f2f4=_['isNaN'](_0x1ed82d)||_0x1ed82d<0x0||_0x1ed82d>0x4?_0x5b5413?0x3:0x2:_0x1ed82d;_0x17f52e['push']('\x22'+_0x45f2f4+'\x22');break;case _0x2490('0x55'):var _0x4ff081=parseInt(_0x45f2f4);if(_[_0x2490('0x56')](_0x4ff081)&&_[_0x2490('0x57')](_0x2a3fc9,_0x4ff081)){_0x17f52e[_0x2490('0x3e')]('\x22'+_0x4ff081+'\x22');}else{_0x3baf6b[_0x2490('0x3e')]('agent\x20not\x20exists');}break;case _0x2490('0x58'):if(isEmail(_0x45f2f4)){_0x17f52e[_0x2490('0x3e')]('\x22'+_0x45f2f4+'\x22');}else{_0x3baf6b[_0x2490('0x3e')](_0x2490('0x59'));}break;case'dateOfBirth':var _0x2d81fb=moment(_0x45f2f4,_0x2490('0x5a'),!![]);if(_0x2d81fb[_0x2490('0x5b')]()){_0x17f52e[_0x2490('0x3e')]('\x22'+_0x45f2f4+'\x22');}else{_0x3baf6b['push'](_0x2490('0x5c'));}break;default:_0x17f52e['push']('\x22'+_0x45f2f4+'\x22');}}else{switch(_0x1f6c21){case _0x2490('0x5d'):case _0x2490('0x11'):_0x3baf6b[_0x2490('0x3e')](_0x1f6c21+_0x2490('0x5e'));break;default:_0x17f52e['push']('\x22\x22');}}}}if(_0x3baf6b[_0x2490('0x4e')]){handleError(_0x1db006[_0x2490('0x4d')][_0x450f4a],{'code':_0x2490('0x5f'),'message':_0x3baf6b[_0x2490('0x13')]()});}else{fs[_0x2490('0x60')](_0x286d19,_0x17f52e['join']()+'\x0a');}_0x17f52e=[];}if(!(stats[_0x2490('0x4f')]%0xc8)){socket[_0x2490('0x61')]('contact:import:'+_0x487a3b,stats);stats[_0x2490('0x50')]=[];}}if(stopped){logger[_0x2490('0x40')]('Abort\x20parser');_0x36a00f['abort']();}}catch(_0x304736){handleError(_0x1db006['data'][_0x450f4a],{'code':_0x2490('0x62'),'message':_0x304736[_0x2490('0x3c')]});logger[_0x2490('0x45')](_0x2490('0x63'),_0x304736[_0x2490('0x3c')]);}},'complete':function(){try{var _0x265917=[];var _0x196c18=_0x2490('0x26');if(_0x34dd00[_0x2490('0x64')]&&_0x34dd00[_0x2490('0x64')][_0x2490('0x4e')]){_0x196c18=_0x2490('0x65')+_0x487a3b;_0x265917[_0x2490('0x3e')](_0x2490('0x66')+_0x196c18+_0x2490('0x67'));}var _0x54ecdd=util[_0x2490('0xc')](_0x2490('0x68'),_0x286d19,_0x196c18,_0x7ec188,_0x34dd00['ListId'],_0x34dd00[_0x2490('0x36')]||null,NOW,NOW);if(_[_0x2490('0x69')](_0x1a7802[_0x2490('0x54')])){_0x54ecdd+=_0x2490('0x6a');}_0x265917['push'](_0x54ecdd);if(_0x34dd00['duplicates']&&_0x34dd00['duplicates'][_0x2490('0x4e')]){_0x265917[_0x2490('0x3e')](insertCmContact(_0x34dd00[_0x2490('0x21')],_0x196c18,_0x34dd00[_0x2490('0x64')],_0x1a7802));_0x265917[_0x2490('0x3e')](_0x2490('0x6b')+_0x196c18+';');}_0x265917[_0x2490('0x3e')](insertCmHopper(_0x34dd00[_0x2490('0x21')],_0x2490('0x6c'),_0x2490('0x6d'),'VoiceQueueId',_0x5b5413));_0x265917[_0x2490('0x3e')](insertCmHopperBlack(_0x34dd00['ListId'],_0x2490('0x6e'),_0x2490('0x6d'),'VoiceQueueId'));_0x265917[_0x2490('0x3e')](insertCmHopper(_0x34dd00[_0x2490('0x21')],_0x2490('0x6f'),'campaigns','CampaignId',_0x5b5413));_0x265917['push'](insertCmHopperBlack(_0x34dd00[_0x2490('0x21')],'campaigns_has_cm_blacklists',_0x2490('0x70'),_0x2490('0x71')));BPromise['each'](_0x265917,handleQuery)[_0x2490('0x72')](function(_0x4adffc){stats[_0x2490('0x73')]=!![];stats[_0x2490('0x74')]=_0x34dd00[_0x2490('0x64')]&&_0x34dd00[_0x2490('0x64')][_0x2490('0x4e')]?results[0x2]['affectedRows']:results[0x0][_0x2490('0x74')];socket[_0x2490('0x61')](_0x2490('0x75')+_0x487a3b,stats);fs[_0x2490('0x76')](_0x1506d5);fs[_0x2490('0x76')](_0x286d19);process[_0x2490('0x3d')](0x0);})['catch'](function(_0x1cebb1){logger[_0x2490('0x45')](_0x1cebb1[_0x2490('0x3c')]);process[_0x2490('0x3d')](0x1);});}catch(_0xd98010){logger['error'](_0x2490('0x77'),_0xd98010['message']);process[_0x2490('0x3d')](0x1);}},'error':function(_0x217b30,_0x58d797,_0x100e63,_0x4ba475){throw new Error(_0x4ba475);}});}function validate(){if(process[_0x2490('0x78')]&&process[_0x2490('0x78')][_0x2490('0x4e')]<0x4){throw new Error(_0x2490('0x79'));}var _0x461389=path[_0x2490('0x13')](config[_0x2490('0x49')],_0x2490('0x4a'),process['argv'][0x2]);if(!fs[_0x2490('0x7a')](_0x461389)){throw new Error(_0x2490('0x7b'));}var _0x1398b1={};try{_0x1398b1=JSON[_0x2490('0x4c')](process[_0x2490('0x78')][0x3]);if(!_0x1398b1[_0x2490('0x7c')]){throw new Error(_0x2490('0x7d'));}if(!_0x1398b1[_0x2490('0x7c')][_0x2490('0x11')]){throw new Error(_0x2490('0x7e'));}if(!_0x1398b1[_0x2490('0x7c')][_0x2490('0x5d')]){throw new Error(_0x2490('0x7f'));}var _0x550a4f=0x0;if(_0x1398b1[_0x2490('0x7c')][_0x2490('0x55')]){_0x550a4f=0x1;}if(!_0x1398b1[_0x2490('0x21')]){throw new Error(_0x2490('0x80'));}}catch(_0x4afba7){throw new Error('body\x20id\x20mandatory');}var _0x3fdc25=[];try{_0x3fdc25=_[_0x2490('0x81')](JSON[_0x2490('0x4c')](process[_0x2490('0x78')][0x4]),'id');}catch(_0x5aebcb){logger[_0x2490('0x40')](_0x2490('0x82'));}main(_0x461389,_0x1398b1,_0x3fdc25,_0x550a4f);}validate();process['on'](_0x2490('0x83'),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 957117a..44a08d7 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 _0x66c7=['[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','calleridnum','outbound','string','destcalleridnum','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Queue','queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','Agent\x20Number','***\x20Time\x20Info\x20***','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','Answer\x20Time','Complete\x20Time','endtime','Duration','Billable\x20Time','billableseconds'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x66c7,0x111));var _0x766c=function(_0x274de3,_0x3c6b41){_0x274de3=_0x274de3-0x0;var _0x2bb217=_0x66c7[_0x274de3];return _0x2bb217;};'use strict';exports['getSubjects']=function(_0x4a2630,_0x2be24c){var _0xdadbf0=[{'type':'string','content':_0x766c('0x0'),'variableName':null}];switch(_0x4a2630[_0x766c('0x1')]()){case _0x766c('0x2'):switch(_0x2be24c[_0x766c('0x1')]()){case _0x766c('0x3'):_0xdadbf0['push']({'type':'variable','content':'','variableName':'queue'});_0xdadbf0[_0x766c('0x4')]({'type':_0x766c('0x5'),'content':'','variableName':_0x766c('0x6')});break;case _0x766c('0x7'):_0xdadbf0[_0x766c('0x4')]({'type':_0x766c('0x8'),'content':'Outbound\x20Call','variableName':null});_0xdadbf0[_0x766c('0x4')]({'type':'variable','content':'','variableName':_0x766c('0x9')});break;}}return _0xdadbf0;};exports['getDescriptions']=function(_0x5dee06,_0x30ca3a){var _0x4d7bd6=[];switch(_0x5dee06[_0x766c('0x1')]()){case'voice':switch(_0x30ca3a['toLowerCase']()){case _0x766c('0x3'):_0x4d7bd6=[{'type':_0x766c('0x8'),'content':_0x766c('0xa'),'key':null,'keyType':null,'variableName':null},{'type':_0x766c('0xb'),'content':'','key':_0x766c('0xc'),'keyType':_0x766c('0x5'),'variableName':_0x766c('0x6')},{'type':_0x766c('0xb'),'content':'','key':_0x766c('0xd'),'keyType':_0x766c('0x5'),'variableName':_0x766c('0xe')},{'type':'keyValue','content':'','key':'Call\x20To','keyType':'variable','variableName':'destexten'},{'type':_0x766c('0xb'),'content':'','key':_0x766c('0xf'),'keyType':_0x766c('0x5'),'variableName':_0x766c('0x10')},{'type':_0x766c('0xb'),'content':'','key':_0x766c('0x11'),'keyType':_0x766c('0x5'),'variableName':_0x766c('0x12')},{'type':_0x766c('0xb'),'content':'','key':_0x766c('0x13'),'keyType':_0x766c('0x5'),'variableName':_0x766c('0x14')},{'type':_0x766c('0x8'),'content':_0x766c('0x15'),'key':null,'keyType':null,'variableName':null},{'type':_0x766c('0xb'),'content':'','key':_0x766c('0x16'),'keyType':_0x766c('0x5'),'variableName':'destcalleridname'},{'type':_0x766c('0xb'),'content':'','key':_0x766c('0x17'),'keyType':_0x766c('0x5'),'variableName':'destcalleridnum'},{'type':_0x766c('0x8'),'content':_0x766c('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0x766c('0xb'),'content':'','key':'Agent\x20Ring','keyType':'variable','variableName':_0x766c('0x14')},{'type':_0x766c('0xb'),'content':'','key':'Agent\x20Connect','keyType':_0x766c('0x5'),'variableName':_0x766c('0x19')},{'type':_0x766c('0xb'),'content':'','key':_0x766c('0x1a'),'keyType':'variable','variableName':_0x766c('0x1b')},{'type':_0x766c('0xb'),'content':'','key':_0x766c('0x1c'),'keyType':_0x766c('0x5'),'variableName':_0x766c('0x1d')},{'type':_0x766c('0xb'),'content':'','key':_0x766c('0x1e'),'keyType':_0x766c('0x5'),'variableName':_0x766c('0x1f')}];break;case _0x766c('0x7'):_0x4d7bd6=[{'type':_0x766c('0x8'),'content':_0x766c('0xa'),'variableName':null},{'type':_0x766c('0xb'),'content':'','key':_0x766c('0x20'),'keyType':_0x766c('0x5'),'keyContent':'','variableName':'destcalleridnum'},{'type':'keyValue','content':'','key':'Member\x20Name','keyType':'variable','keyContent':'','variableName':'membername'},{'type':'keyValue','content':'','key':_0x766c('0x11'),'keyType':_0x766c('0x5'),'keyContent':'','variableName':'uniqueid'},{'type':_0x766c('0xb'),'content':'','key':_0x766c('0x13'),'keyType':_0x766c('0x5'),'keyContent':'','variableName':'starttime'},{'type':_0x766c('0x8'),'content':_0x766c('0x18')},{'type':_0x766c('0xb'),'content':'','key':_0x766c('0x21'),'keyType':_0x766c('0x5'),'keyContent':'','variableName':'answertime'},{'type':_0x766c('0xb'),'content':'','key':_0x766c('0x22'),'keyType':_0x766c('0x5'),'keyContent':'','variableName':_0x766c('0x23')},{'type':_0x766c('0xb'),'content':'','key':_0x766c('0x24'),'keyType':_0x766c('0x5'),'keyContent':'','variableName':'duration'},{'type':'keyValue','content':'','key':_0x766c('0x25'),'keyType':_0x766c('0x5'),'keyContent':'','variableName':_0x766c('0x26')}];break;}}return _0x4d7bd6;}; \ No newline at end of file +var _0x4764=['[xCALLY\x20Ticket]','toLowerCase','voice','inbound','variable','calleridnum','outbound','push','string','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','Caller\x20Number','keyValue','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','queue','UniqueId','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','Agent\x20Complete','agentcompleteAt','Hold\x20Time','talktime','Called\x20Number','Member\x20Name','membername','starttime','Answer\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects'];(function(_0x1112ee,_0x591ae8){var _0x5a1c08=function(_0xe72364){while(--_0xe72364){_0x1112ee['push'](_0x1112ee['shift']());}};_0x5a1c08(++_0x591ae8);}(_0x4764,0x18b));var _0x4476=function(_0x1fb3e4,_0x5765c8){_0x1fb3e4=_0x1fb3e4-0x0;var _0x44224b=_0x4764[_0x1fb3e4];return _0x44224b;};'use strict';exports[_0x4476('0x0')]=function(_0x2b2468,_0x28f461){var _0x388bb2=[{'type':'string','content':_0x4476('0x1'),'variableName':null}];switch(_0x2b2468[_0x4476('0x2')]()){case _0x4476('0x3'):switch(_0x28f461['toLowerCase']()){case _0x4476('0x4'):_0x388bb2['push']({'type':'variable','content':'','variableName':'queue'});_0x388bb2['push']({'type':_0x4476('0x5'),'content':'','variableName':_0x4476('0x6')});break;case _0x4476('0x7'):_0x388bb2[_0x4476('0x8')]({'type':_0x4476('0x9'),'content':_0x4476('0xa'),'variableName':null});_0x388bb2['push']({'type':_0x4476('0x5'),'content':'','variableName':_0x4476('0xb')});break;}}return _0x388bb2;};exports[_0x4476('0xc')]=function(_0x10ca13,_0x1b8f5d){var _0x3bb224=[];switch(_0x10ca13[_0x4476('0x2')]()){case _0x4476('0x3'):switch(_0x1b8f5d[_0x4476('0x2')]()){case _0x4476('0x4'):_0x3bb224=[{'type':_0x4476('0x9'),'content':_0x4476('0xd'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x4476('0xe'),'keyType':'variable','variableName':_0x4476('0x6')},{'type':_0x4476('0xf'),'content':'','key':_0x4476('0x10'),'keyType':_0x4476('0x5'),'variableName':_0x4476('0x11')},{'type':_0x4476('0xf'),'content':'','key':_0x4476('0x12'),'keyType':_0x4476('0x5'),'variableName':_0x4476('0x13')},{'type':_0x4476('0xf'),'content':'','key':_0x4476('0x14'),'keyType':_0x4476('0x5'),'variableName':_0x4476('0x15')},{'type':'keyValue','content':'','key':_0x4476('0x16'),'keyType':_0x4476('0x5'),'variableName':'uniqueid'},{'type':_0x4476('0xf'),'content':'','key':_0x4476('0x17'),'keyType':_0x4476('0x5'),'variableName':_0x4476('0x18')},{'type':'string','content':_0x4476('0x19'),'key':null,'keyType':null,'variableName':null},{'type':_0x4476('0xf'),'content':'','key':'Agent\x20Name','keyType':_0x4476('0x5'),'variableName':'destcalleridname'},{'type':_0x4476('0xf'),'content':'','key':_0x4476('0x1a'),'keyType':'variable','variableName':_0x4476('0xb')},{'type':_0x4476('0x9'),'content':_0x4476('0x1b'),'key':null,'keyType':null,'variableName':null},{'type':_0x4476('0xf'),'content':'','key':_0x4476('0x1c'),'keyType':'variable','variableName':_0x4476('0x18')},{'type':_0x4476('0xf'),'content':'','key':_0x4476('0x1d'),'keyType':_0x4476('0x5'),'variableName':'agentconnectAt'},{'type':_0x4476('0xf'),'content':'','key':_0x4476('0x1e'),'keyType':_0x4476('0x5'),'variableName':_0x4476('0x1f')},{'type':'keyValue','content':'','key':_0x4476('0x20'),'keyType':'variable','variableName':'holdtime'},{'type':_0x4476('0xf'),'content':'','key':'Talk\x20Time','keyType':_0x4476('0x5'),'variableName':_0x4476('0x21')}];break;case'outbound':_0x3bb224=[{'type':_0x4476('0x9'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0x4476('0xf'),'content':'','key':_0x4476('0x22'),'keyType':_0x4476('0x5'),'keyContent':'','variableName':_0x4476('0xb')},{'type':_0x4476('0xf'),'content':'','key':_0x4476('0x23'),'keyType':_0x4476('0x5'),'keyContent':'','variableName':_0x4476('0x24')},{'type':_0x4476('0xf'),'content':'','key':'UniqueId','keyType':_0x4476('0x5'),'keyContent':'','variableName':'uniqueid'},{'type':_0x4476('0xf'),'content':'','key':_0x4476('0x17'),'keyType':'variable','keyContent':'','variableName':_0x4476('0x25')},{'type':_0x4476('0x9'),'content':_0x4476('0x1b')},{'type':_0x4476('0xf'),'content':'','key':_0x4476('0x26'),'keyType':_0x4476('0x5'),'keyContent':'','variableName':'answertime'},{'type':_0x4476('0xf'),'content':'','key':'Complete\x20Time','keyType':_0x4476('0x5'),'keyContent':'','variableName':_0x4476('0x27')},{'type':_0x4476('0xf'),'content':'','key':_0x4476('0x28'),'keyType':_0x4476('0x5'),'keyContent':'','variableName':_0x4476('0x29')},{'type':'keyValue','content':'','key':_0x4476('0x2a'),'keyType':_0x4476('0x5'),'keyContent':'','variableName':_0x4476('0x2b')}];break;}}return _0x3bb224;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index d15e37d..4740b9d 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 _0xa675=['html','mobile','lodash','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','InteractionId','upperFirst','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','stringify','null','Interaction','findOne','then','catch','error','tracked','user','clone','body','omit'];(function(_0x2ed1a0,_0x36acd9){var _0x3d272e=function(_0x41460c){while(--_0x41460c){_0x2ed1a0['push'](_0x2ed1a0['shift']());}};_0x3d272e(++_0x36acd9);}(_0xa675,0x72));var _0x5a67=function(_0x5b11e0,_0x48afdf){_0x5b11e0=_0x5b11e0-0x0;var _0x40256b=_0xa675[_0x5b11e0];return _0x40256b;};'use strict';var _=require(_0x5a67('0x0'));var db=require(_0x5a67('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')('openchannel-interactions'),'mail':require(_0x5a67('0x2'))(_0x5a67('0x3')),'fax':require(_0x5a67('0x2'))(_0x5a67('0x4')),'sms':require('../../config/logger')(_0x5a67('0x5')),'chat':require('../../config/logger')(_0x5a67('0x6')),'whatsapp':require(_0x5a67('0x2'))('whatsapp-interactions')};function getInteractionId(_0x116b26,_0x48a916,_0xc803bf){if(_0x116b26&&_0x116b26[_['upperFirst'](_0xc803bf)+_0x5a67('0x7')]){return _0x116b26[_[_0x5a67('0x8')](_0xc803bf)+_0x5a67('0x7')];}else if(_0x116b26&&_0x116b26['id']){return _0x116b26['id'];}else if(_0x48a916&&_0x48a916['id']){return _0x48a916['id'];}else{return _0x5a67('0x9');}}function log(_0x533c78,_0x3fce2c,_0x2e4b91,_0x2798d7,_0x5dab26,_0xba4fea){loggers[_0x5dab26[_0x5a67('0xa')]()][_0x533c78](_0x5a67('0xb'),_0xba4fea[_0x5a67('0xc')](),_0x3fce2c?_0x3fce2c['id']:null,_0x3fce2c?_0x3fce2c['name']:null,_0x3fce2c?_0x3fce2c[_0x5a67('0xd')]:null,getInteractionId(_0x2e4b91,_0x2798d7,_0x5dab26),_0x2e4b91?JSON[_0x5a67('0xe')](_0x2e4b91):_0x5a67('0xf'));}function updateUser(_0x23e710,_0x4e1b93,_0x2b02ba,_0x397af5,_0x21d134){db[_[_0x5a67('0x8')](_0x397af5)+_0x5a67('0x10')][_0x5a67('0x11')]({'where':{'id':getInteractionId(_0x4e1b93,_0x2b02ba,_0x397af5)}})[_0x5a67('0x12')](function(_0x53737d){if(_0x53737d){return _0x53737d['update']({'UserId':_0x23e710?_0x23e710['id']:null});}})[_0x5a67('0x12')](function(_0x235cab){if(_0x235cab){log('info',_0x23e710,_0x4e1b93,_0x2b02ba,_0x397af5,_0x21d134);}})[_0x5a67('0x13')](function(){log(_0x5a67('0x14'),_0x23e710,_0x4e1b93,_0x2b02ba,_0x397af5,_0x21d134);});}exports[_0x5a67('0x15')]=function(_0x4672ef,_0x6f4be4){return function(_0x233342,_0x468bb8,_0x35baef){var _0x23c758=_0x233342[_0x5a67('0x16')];var _0x501bb0={};var _0x5e00d0=_0x233342['query'];if(_0x501bb0){_0x501bb0=_[_0x5a67('0x17')](_0x233342[_0x5a67('0x18')]);_0x501bb0=_[_0x5a67('0x19')](_0x501bb0,[_0x5a67('0x18'),_0x5a67('0x1a'),'phone','fax',_0x5a67('0x1b')]);}updateUser(_0x23c758,_0x501bb0,_0x5e00d0,_0x4672ef,_0x6f4be4);_0x35baef(null);};}; \ No newline at end of file +var _0x286f=['sms-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','stringify','null','Interaction','findOne','info','catch','error','tracked','user','query','clone','body','omit','html','fax','mobile','lodash','../../mysqldb','openchannel-interactions','../../config/logger','fax-interactions'];(function(_0x8a6a05,_0x3f3c3e){var _0x4917de=function(_0xc6bea0){while(--_0xc6bea0){_0x8a6a05['push'](_0x8a6a05['shift']());}};_0x4917de(++_0x3f3c3e);}(_0x286f,0x181));var _0xf286=function(_0x537716,_0x379ef6){_0x537716=_0x537716-0x0;var _0x8e9d15=_0x286f[_0x537716];return _0x8e9d15;};'use strict';var _=require(_0xf286('0x0'));var db=require(_0xf286('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0xf286('0x2')),'mail':require(_0xf286('0x3'))('mail-interactions'),'fax':require(_0xf286('0x3'))(_0xf286('0x4')),'sms':require(_0xf286('0x3'))(_0xf286('0x5')),'chat':require(_0xf286('0x3'))('chat-interactions'),'whatsapp':require(_0xf286('0x3'))(_0xf286('0x6'))};function getInteractionId(_0x1c0f24,_0x4c75c9,_0x23cd65){if(_0x1c0f24&&_0x1c0f24[_[_0xf286('0x7')](_0x23cd65)+_0xf286('0x8')]){return _0x1c0f24[_['upperFirst'](_0x23cd65)+'InteractionId'];}else if(_0x1c0f24&&_0x1c0f24['id']){return _0x1c0f24['id'];}else if(_0x4c75c9&&_0x4c75c9['id']){return _0x4c75c9['id'];}else{return _0xf286('0x9');}}function log(_0x43738f,_0x2fff3b,_0x57a8c0,_0x206824,_0x185aab,_0x49176a){loggers[_0x185aab[_0xf286('0xa')]()][_0x43738f](_0xf286('0xb'),_0x49176a[_0xf286('0xc')](),_0x2fff3b?_0x2fff3b['id']:null,_0x2fff3b?_0x2fff3b['name']:null,_0x2fff3b?_0x2fff3b[_0xf286('0xd')]:null,getInteractionId(_0x57a8c0,_0x206824,_0x185aab),_0x57a8c0?JSON[_0xf286('0xe')](_0x57a8c0):_0xf286('0xf'));}function updateUser(_0x1530cc,_0x4720d1,_0x170956,_0x547b30,_0x574dca){db[_[_0xf286('0x7')](_0x547b30)+_0xf286('0x10')][_0xf286('0x11')]({'where':{'id':getInteractionId(_0x4720d1,_0x170956,_0x547b30)}})['then'](function(_0x419093){if(_0x419093){return _0x419093['update']({'UserId':_0x1530cc?_0x1530cc['id']:null});}})['then'](function(_0x1487fd){if(_0x1487fd){log(_0xf286('0x12'),_0x1530cc,_0x4720d1,_0x170956,_0x547b30,_0x574dca);}})[_0xf286('0x13')](function(){log(_0xf286('0x14'),_0x1530cc,_0x4720d1,_0x170956,_0x547b30,_0x574dca);});}exports[_0xf286('0x15')]=function(_0x1e2d87,_0x3edb90){return function(_0x2ceaa8,_0x521936,_0x1e718e){var _0x497486=_0x2ceaa8[_0xf286('0x16')];var _0x3fb284={};var _0x582573=_0x2ceaa8[_0xf286('0x17')];if(_0x3fb284){_0x3fb284=_[_0xf286('0x18')](_0x2ceaa8[_0xf286('0x19')]);_0x3fb284=_[_0xf286('0x1a')](_0x3fb284,[_0xf286('0x19'),_0xf286('0x1b'),'phone',_0xf286('0x1c'),_0xf286('0x1d')]);}updateUser(_0x497486,_0x3fb284,_0x582573,_0x1e2d87,_0x3edb90);_0x1e718e(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 472c8c6..af03514 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 _0xa63d=['license','split','createDecipher','aes-256-ctr','format','base64','utf8','final','parse','hasOwnProperty','use','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','util','composable-middleware','../../mysqldb','../../config/environment','data1'];(function(_0x18d36f,_0x31b65f){var _0x10034d=function(_0x38bb30){while(--_0x38bb30){_0x18d36f['push'](_0x18d36f['shift']());}};_0x10034d(++_0x31b65f);}(_0xa63d,0xbf));var _0xda63=function(_0x4854ed,_0xf1d3e2){_0x4854ed=_0x4854ed-0x0;var _0x17bd4c=_0xa63d[_0x4854ed];return _0x17bd4c;};'use strict';var crypto=require('crypto');var util=require(_0xda63('0x0'));var compose=require(_0xda63('0x1'));var db=require(_0xda63('0x2'))['db'];var config=require(_0xda63('0x3'));function getValueFromLicense(_0x575a75,_0x46fa8e){if(_0x575a75&&_0x46fa8e){if(_0x46fa8e[_0xda63('0x4')]&&_0x46fa8e[_0xda63('0x5')]){var _0x588ca4=_0x46fa8e[_0xda63('0x4')];var _0x50aeaf=_0x46fa8e[_0xda63('0x5')];var _0xc1dfff=_0x588ca4[_0xda63('0x6')]('-')[0x4];var _0x43fe37=_0x588ca4[_0xda63('0x6')]('-')[0x0];var _0xbc83dd=crypto[_0xda63('0x7')](_0xda63('0x8'),util[_0xda63('0x9')]('%s:%s:%s',_0xc1dfff,_0x588ca4,_0x43fe37));var _0x117bd3=_0xbc83dd['update'](_0x50aeaf,_0xda63('0xa'),_0xda63('0xb'));_0x117bd3+=_0xbc83dd[_0xda63('0xc')](_0xda63('0xb'));var _0x3c022a=JSON[_0xda63('0xd')](_0x117bd3);return _0x3c022a[_0xda63('0xe')](_0x575a75)?_0x3c022a[_0x575a75]:null;}}return null;}function isLimit(_0x3340f5,_0x41d7c7,_0x1f7159,_0x51555c){var _0x5dac31=_0x41d7c7;return compose()[_0xda63('0xf')](function(_0x1fac2d,_0x4ca602,_0x4d843e){return db['License'][_0xda63('0x10')]({'where':{'id':0x1},'raw':!![]})[_0xda63('0x11')](function(_0x21937b){var _0x104f1d=getValueFromLicense(_0x3340f5,_0x21937b);return _0x104f1d?_0x104f1d:_0x5dac31;})[_0xda63('0x11')](function(_0xabbf72){_0x5dac31=_0xabbf72;return _0x1f7159[_0xda63('0x12')](_0x51555c);})[_0xda63('0x11')](function(_0x364996){if(_0x364996>=_0x5dac31){return _0x4ca602[_0xda63('0x13')](0x193)[_0xda63('0x14')]({'message':util[_0xda63('0x9')](_0xda63('0x15'),_0x3340f5)});}_0x4d843e();})[_0xda63('0x16')](function(_0xca94fe){_0x4d843e(_0xca94fe);});});}function isUserLimit(){return isLimit(_0xda63('0x17'),0x1,db[_0xda63('0x18')],{'where':{'$or':[{'role':_0xda63('0x19')},{'role':_0xda63('0x1a')}]}});}exports[_0xda63('0x1b')]=isUserLimit; \ No newline at end of file +var _0xde75=['crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','format','update','base64','utf8','parse','hasOwnProperty','use','License','findOne','then','count','Maximum\x20%s\x20limit\x20have\x20been\x20reached','User','admin','user','isUserLimit'];(function(_0x1301aa,_0x4da5c4){var _0x5146a1=function(_0x417cd1){while(--_0x417cd1){_0x1301aa['push'](_0x1301aa['shift']());}};_0x5146a1(++_0x4da5c4);}(_0xde75,0x64));var _0x5de7=function(_0x2b1867,_0x30b683){_0x2b1867=_0x2b1867-0x0;var _0x519519=_0xde75[_0x2b1867];return _0x519519;};'use strict';var crypto=require(_0x5de7('0x0'));var util=require(_0x5de7('0x1'));var compose=require(_0x5de7('0x2'));var db=require(_0x5de7('0x3'))['db'];var config=require(_0x5de7('0x4'));function getValueFromLicense(_0x1b6bfb,_0x5c6109){if(_0x1b6bfb&&_0x5c6109){if(_0x5c6109[_0x5de7('0x5')]&&_0x5c6109[_0x5de7('0x6')]){var _0xdd4c20=_0x5c6109[_0x5de7('0x5')];var _0x21b0aa=_0x5c6109[_0x5de7('0x6')];var _0x31adbf=_0xdd4c20[_0x5de7('0x7')]('-')[0x4];var _0x3f19e6=_0xdd4c20[_0x5de7('0x7')]('-')[0x0];var _0x19ac44=crypto[_0x5de7('0x8')]('aes-256-ctr',util[_0x5de7('0x9')]('%s:%s:%s',_0x31adbf,_0xdd4c20,_0x3f19e6));var _0x514762=_0x19ac44[_0x5de7('0xa')](_0x21b0aa,_0x5de7('0xb'),_0x5de7('0xc'));_0x514762+=_0x19ac44['final'](_0x5de7('0xc'));var _0x3c9fa5=JSON[_0x5de7('0xd')](_0x514762);return _0x3c9fa5[_0x5de7('0xe')](_0x1b6bfb)?_0x3c9fa5[_0x1b6bfb]:null;}}return null;}function isLimit(_0x4d5a36,_0x3e41d6,_0x5d9f2e,_0x47511c){var _0x1c4622=_0x3e41d6;return compose()[_0x5de7('0xf')](function(_0x2d5d10,_0x256092,_0x405fd2){return db[_0x5de7('0x10')][_0x5de7('0x11')]({'where':{'id':0x1},'raw':!![]})[_0x5de7('0x12')](function(_0x18eb36){var _0x1689c1=getValueFromLicense(_0x4d5a36,_0x18eb36);return _0x1689c1?_0x1689c1:_0x1c4622;})[_0x5de7('0x12')](function(_0x2ec7d2){_0x1c4622=_0x2ec7d2;return _0x5d9f2e[_0x5de7('0x13')](_0x47511c);})[_0x5de7('0x12')](function(_0x52d837){if(_0x52d837>=_0x1c4622){return _0x256092['status'](0x193)['json']({'message':util[_0x5de7('0x9')](_0x5de7('0x14'),_0x4d5a36)});}_0x405fd2();})['catch'](function(_0x299baa){_0x405fd2(_0x299baa);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x5de7('0x15')],{'where':{'$or':[{'role':_0x5de7('0x16')},{'role':_0x5de7('0x17')}]}});}exports[_0x5de7('0x18')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index a44eb23..4bd7c6f 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 _0x2fd3=['$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','start','pop','utcOffset','hours','minutes','moment','parseSearch','sqlOperator','startsWith','and','replace','[$and]','[$or]','length','split','slice','shift','forEach','filter','indexOf','map','conditions','DATE','operator','$between','value','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','field','\x20AS\x20','includes','$ne','$notIn','\x20OR\x20','IN\x20?','NOT\x20IN\x20?','$eq','=\x20?','<>\x20?'];(function(_0x32729c,_0xf5afd8){var _0x482cfd=function(_0x231471){while(--_0x231471){_0x32729c['push'](_0x32729c['shift']());}};_0x482cfd(++_0xf5afd8);}(_0x2fd3,0xf0));var _0x32fd=function(_0x5cbe2b,_0x15b394){_0x5cbe2b=_0x5cbe2b-0x0;var _0xef566=_0x2fd3[_0x5cbe2b];return _0xef566;};'use strict';var _=require('lodash');var moment=require(_0x32fd('0x0'));exports[_0x32fd('0x1')]=function(_0x4e90aa){var _0x37f53a={'conditions':[]};_0x37f53a[_0x32fd('0x2')]=_[_0x32fd('0x3')](_0x4e90aa,'[$or]')?'or':_0x32fd('0x4');var _0x58c264=_0x4e90aa[_0x32fd('0x5')](_0x32fd('0x6'),'')[_0x32fd('0x5')](_0x32fd('0x7'),'')['split']('||');for(var _0x355102=0x0;_0x355102<_0x58c264[_0x32fd('0x8')];_0x355102++){var _0x59ae33=_0x58c264[_0x355102][_0x32fd('0x9')](':=');var _0x521bd4=_0x59ae33[0x0];var _0x55bb6a=_0x59ae33[_0x32fd('0xa')](0x1);_0x55bb6a['forEach'](function(_0xc8a6af){var _0x32b4c3=_0xc8a6af['split']('[')[_0x32fd('0xb')]();var _0x434775=_0xc8a6af['match'](/\[(.*?)\]/g);_0x434775[_0x32fd('0xc')](function(_0x1eceb8){var _0x2ba0af=_0x1eceb8['split']('[')[_0x32fd('0xd')](function(_0x25230a){return _0x25230a[_0x32fd('0xe')](']')>-0x1;})[_0x32fd('0xf')](function(_0x16c334){return _0x16c334['split'](']')[0x0];})[0x0];_0x37f53a[_0x32fd('0x10')]['push']({'field':_0x521bd4,'operator':_0x32b4c3,'value':_0x2ba0af});});});}return _0x37f53a;};exports['buildExpression']=function(_0x17f58f,_0x587a43,_0x3fcb76){var _0x37b201={};if(_0x587a43===_0x32fd('0x11')){if(_0x3fcb76[_0x32fd('0x12')]==='$eq'){_0x3fcb76['operator']=_0x32fd('0x13');_0x3fcb76['value']+=','+_0x3fcb76[_0x32fd('0x14')];}else if(_['includes']([_0x32fd('0x15'),_0x32fd('0x16')],_0x3fcb76[_0x32fd('0x12')])){_0x3fcb76[_0x32fd('0x14')]=moment(_0x3fcb76[_0x32fd('0x14')])[_0x32fd('0x17')](0x1,_0x32fd('0x18'))[_0x32fd('0x19')](_0x32fd('0x1a'));}}if(_0x3fcb76[_0x32fd('0x1b')]){_0x587a43=_0x3fcb76[_0x32fd('0x1b')];_0x37b201[_0x32fd('0x1c')]='CAST('+_0x17f58f+'.'+_0x3fcb76[_0x32fd('0x1d')]+_0x32fd('0x1e')+_0x3fcb76[_0x32fd('0x1b')]+')\x20'+parseOperator(_0x3fcb76[_0x32fd('0x12')]);}else{_0x37b201[_0x32fd('0x1c')]=_0x17f58f+'.'+_0x3fcb76[_0x32fd('0x1d')]+'\x20'+parseOperator(_0x3fcb76[_0x32fd('0x12')]);}if(_[_0x32fd('0x1f')]([_0x32fd('0x20'),_0x32fd('0x21')],_0x3fcb76[_0x32fd('0x12')]))_0x37b201['text']='('+_0x37b201[_0x32fd('0x1c')]+_0x32fd('0x22')+_0x17f58f+'.'+_0x3fcb76[_0x32fd('0x1d')]+'\x20IS\x20NULL)';_0x37b201[_0x32fd('0x14')]=parseValue(_0x587a43,_0x3fcb76[_0x32fd('0x12')],_0x3fcb76[_0x32fd('0x14')]);return _0x37b201;};function parseOperator(_0x3ed4e9){var _0x595dd5;switch(_0x3ed4e9){case'$in':_0x595dd5=_0x32fd('0x23');break;case _0x32fd('0x21'):_0x595dd5=_0x32fd('0x24');break;case _0x32fd('0x25'):_0x595dd5=_0x32fd('0x26');break;case _0x32fd('0x20'):_0x595dd5=_0x32fd('0x27');break;case _0x32fd('0x28'):case _0x32fd('0x29'):case _0x32fd('0x2a'):_0x595dd5=_0x32fd('0x2b');break;case _0x32fd('0x2c'):_0x595dd5=_0x32fd('0x2d');break;case _0x32fd('0x15'):_0x595dd5=_0x32fd('0x2e');break;case _0x32fd('0x16'):_0x595dd5=_0x32fd('0x2f');break;case'$gte':_0x595dd5=_0x32fd('0x30');break;case _0x32fd('0x13'):_0x595dd5=_0x32fd('0x31');break;}return _0x595dd5;}function parseValue(_0x2bfe67,_0x22b150,_0x280c11){var _0x2c7900={'start':undefined,'end':undefined};switch(_0x22b150){case _0x32fd('0x32'):case _0x32fd('0x21'):_0x2c7900[_0x32fd('0x33')]=_0x280c11['split'](',');break;case'$substring':_0x2c7900[_0x32fd('0x33')]='%'+_0x280c11+'%';break;case _0x32fd('0x29'):_0x2c7900[_0x32fd('0x33')]=_0x280c11+'%';break;case'$endsWith':_0x2c7900['start']='%'+_0x280c11;break;case'$between':var _0x370b31=_0x280c11[_0x32fd('0x9')](',');var _0x280c11=_0x370b31[_0x32fd('0xb')]();var _0x59f8fd=_0x370b31[_0x32fd('0x34')]();if(_0x2bfe67===_0x32fd('0x11')){_0x280c11=moment(_0x280c11)[_0x32fd('0x35')](0x0,!![])[_0x32fd('0x19')]();_0x59f8fd=moment(_0x59f8fd)[_0x32fd('0x35')](0x0,!![])[_0x32fd('0x17')](0x17,_0x32fd('0x36'))[_0x32fd('0x17')](0x3b,_0x32fd('0x37'))[_0x32fd('0x17')](0x3b,'seconds')[_0x32fd('0x19')]();}_0x2c7900={'start':_0x280c11,'end':_0x59f8fd};break;default:_0x2c7900[_0x32fd('0x33')]=_0x280c11;break;}return _0x2c7900;} \ No newline at end of file +var _0x92b9=['field','\x20AS\x20','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','$lte','<=\x20?','BETWEEN\x20?\x20AND\x20?','start','utcOffset','format','hours','moment','parseSearch','sqlOperator','startsWith','and','replace','split','slice','forEach','shift','match','filter','map','conditions','push','buildExpression','DATE','operator','$eq','$between','includes','$gt','value','add','days','YYYY-MM-DD','castTo','text','CAST('];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x92b9,0x1b7));var _0x992b=function(_0x45b945,_0xe126c6){_0x45b945=_0x45b945-0x0;var _0x2bf9e8=_0x92b9[_0x45b945];return _0x2bf9e8;};'use strict';var _=require('lodash');var moment=require(_0x992b('0x0'));exports[_0x992b('0x1')]=function(_0x140014){var _0x4999bd={'conditions':[]};_0x4999bd[_0x992b('0x2')]=_[_0x992b('0x3')](_0x140014,'[$or]')?'or':_0x992b('0x4');var _0x547829=_0x140014[_0x992b('0x5')]('[$and]','')[_0x992b('0x5')]('[$or]','')[_0x992b('0x6')]('||');for(var _0x51a5bc=0x0;_0x51a5bc<_0x547829['length'];_0x51a5bc++){var _0x1457ef=_0x547829[_0x51a5bc][_0x992b('0x6')](':=');var _0xc35a77=_0x1457ef[0x0];var _0x30fecd=_0x1457ef[_0x992b('0x7')](0x1);_0x30fecd[_0x992b('0x8')](function(_0x414677){var _0xf9090f=_0x414677[_0x992b('0x6')]('[')[_0x992b('0x9')]();var _0x25e27c=_0x414677[_0x992b('0xa')](/\[(.*?)\]/g);_0x25e27c[_0x992b('0x8')](function(_0x1e474b){var _0x45aa11=_0x1e474b[_0x992b('0x6')]('[')[_0x992b('0xb')](function(_0x330fa8){return _0x330fa8['indexOf'](']')>-0x1;})[_0x992b('0xc')](function(_0x52da80){return _0x52da80['split'](']')[0x0];})[0x0];_0x4999bd[_0x992b('0xd')][_0x992b('0xe')]({'field':_0xc35a77,'operator':_0xf9090f,'value':_0x45aa11});});});}return _0x4999bd;};exports[_0x992b('0xf')]=function(_0x1e55ed,_0x1227c9,_0x322eb6){var _0x1f9a89={};if(_0x1227c9===_0x992b('0x10')){if(_0x322eb6[_0x992b('0x11')]===_0x992b('0x12')){_0x322eb6[_0x992b('0x11')]=_0x992b('0x13');_0x322eb6['value']+=','+_0x322eb6['value'];}else if(_[_0x992b('0x14')]([_0x992b('0x15'),'$lte'],_0x322eb6[_0x992b('0x11')])){_0x322eb6[_0x992b('0x16')]=moment(_0x322eb6['value'])[_0x992b('0x17')](0x1,_0x992b('0x18'))['format'](_0x992b('0x19'));}}if(_0x322eb6[_0x992b('0x1a')]){_0x1227c9=_0x322eb6[_0x992b('0x1a')];_0x1f9a89[_0x992b('0x1b')]=_0x992b('0x1c')+_0x1e55ed+'.'+_0x322eb6[_0x992b('0x1d')]+_0x992b('0x1e')+_0x322eb6[_0x992b('0x1a')]+')\x20'+parseOperator(_0x322eb6['operator']);}else{_0x1f9a89[_0x992b('0x1b')]=_0x1e55ed+'.'+_0x322eb6[_0x992b('0x1d')]+'\x20'+parseOperator(_0x322eb6[_0x992b('0x11')]);}if(_[_0x992b('0x14')](['$ne',_0x992b('0x1f')],_0x322eb6['operator']))_0x1f9a89[_0x992b('0x1b')]='('+_0x1f9a89[_0x992b('0x1b')]+'\x20OR\x20'+_0x1e55ed+'.'+_0x322eb6['field']+_0x992b('0x20');_0x1f9a89['value']=parseValue(_0x1227c9,_0x322eb6['operator'],_0x322eb6[_0x992b('0x16')]);return _0x1f9a89;};function parseOperator(_0x45392e){var _0x32aac0;switch(_0x45392e){case _0x992b('0x21'):_0x32aac0=_0x992b('0x22');break;case _0x992b('0x1f'):_0x32aac0=_0x992b('0x23');break;case _0x992b('0x12'):_0x32aac0=_0x992b('0x24');break;case _0x992b('0x25'):_0x32aac0=_0x992b('0x26');break;case _0x992b('0x27'):case _0x992b('0x28'):case _0x992b('0x29'):_0x32aac0=_0x992b('0x2a');break;case _0x992b('0x2b'):_0x32aac0=_0x992b('0x2c');break;case _0x992b('0x15'):_0x32aac0='>\x20?';break;case _0x992b('0x2d'):_0x32aac0=_0x992b('0x2e');break;case'$gte':_0x32aac0='>=\x20?';break;case _0x992b('0x13'):_0x32aac0=_0x992b('0x2f');break;}return _0x32aac0;}function parseValue(_0x1f0a47,_0xfd04f,_0x24a02d){var _0x175c71={'start':undefined,'end':undefined};switch(_0xfd04f){case _0x992b('0x21'):case _0x992b('0x1f'):_0x175c71['start']=_0x24a02d[_0x992b('0x6')](',');break;case _0x992b('0x27'):_0x175c71[_0x992b('0x30')]='%'+_0x24a02d+'%';break;case _0x992b('0x28'):_0x175c71[_0x992b('0x30')]=_0x24a02d+'%';break;case _0x992b('0x29'):_0x175c71[_0x992b('0x30')]='%'+_0x24a02d;break;case _0x992b('0x13'):var _0xcc40e5=_0x24a02d['split'](',');var _0x24a02d=_0xcc40e5[_0x992b('0x9')]();var _0x3c8502=_0xcc40e5['pop']();if(_0x1f0a47===_0x992b('0x10')){_0x24a02d=moment(_0x24a02d)[_0x992b('0x31')](0x0,!![])[_0x992b('0x32')]();_0x3c8502=moment(_0x3c8502)['utcOffset'](0x0,!![])[_0x992b('0x17')](0x17,_0x992b('0x33'))[_0x992b('0x17')](0x3b,'minutes')[_0x992b('0x17')](0x3b,'seconds')[_0x992b('0x32')]();}_0x175c71={'start':_0x24a02d,'end':_0x3c8502};break;default:_0x175c71[_0x992b('0x30')]=_0x24a02d;break;}return _0x175c71;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 038b702..d3ba4b5 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 _0xa630=['parse','keys','includes','fields','filters','isEmpty','forOwn','find','DATE','isPlainObject','$gte','YYYY-MM-DD','utc','format','$lte','subtract','name','isArray','split','limit','offset','sort','map','indexOf','priority','cast','col','unsigned','DESC','ASC','omit','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','join','getOptions','query','$id','model','attributes','intersection','length','nolimit','pick','filter','object','columns','value','where','type','VIRTUAL','lower','merge','options','lodash','sequelize'];(function(_0x1777bd,_0x3f119c){var _0x2a162e=function(_0x24f293){while(--_0x24f293){_0x1777bd['push'](_0x1777bd['shift']());}};_0x2a162e(++_0x3f119c);}(_0xa630,0xbe));var _0x0a63=function(_0x216242,_0x84456a){_0x216242=_0x216242-0x0;var _0x3c646e=_0xa630[_0x216242];return _0x3c646e;};'use strict';var _=require(_0x0a63('0x0'));var sequelize=require(_0x0a63('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x52ad93){var _0x1a9586=['ne'];try{var _0x4f6b34=JSON[_0x0a63('0x2')](_0x52ad93);var _0x506b55=Object[_0x0a63('0x3')](_0x4f6b34)[0x0];return _0x1a9586[_0x0a63('0x4')](_0x506b55);}catch(_0x2cfdeb){return![];}}function getOperatorValue(_0x2380f8){var _0x37b4c9=JSON['parse'](_0x2380f8);var _0x2760b0=Object[_0x0a63('0x3')](_0x37b4c9)[0x0];var _0xc2dcd7=_0x37b4c9[_0x2760b0];return{['$'+_0x2760b0]:_0xc2dcd7};}exports[_0x0a63('0x5')]=function(_0x12a7df){var _0x2a1bd7=null;if(_0x12a7df){_0x2a1bd7=_0x12a7df['split'](',');}return _0x2a1bd7;};exports[_0x0a63('0x6')]=function(_0xb714c7,_0x2dcbda){var _0x218142={};if(!_[_0x0a63('0x7')](_0xb714c7)){_[_0x0a63('0x8')](_0xb714c7,function(_0x207434,_0x22f340){try{if(_0x2dcbda){var _0x258511=_[_0x0a63('0x9')](_0x2dcbda,{'name':_0x22f340})||{};if(hasSequelizeOperator(_0x207434)){_0x218142[_0x22f340]=getOperatorValue(_0x207434);}else if(_0x258511['type']===_0x0a63('0xa')&&_[_0x0a63('0xb')](_0x207434)){var _0x2fce86=JSON[_0x0a63('0x2')](_0x207434);var _0x55cb2f={'$gte':moment(moment(_0x2fce86[_0x0a63('0xc')])['format'](_0x0a63('0xd')))[_0x0a63('0xe')]()[_0x0a63('0xf')](),'$lte':moment(moment(_0x2fce86[_0x0a63('0x10')])[_0x0a63('0xf')](_0x0a63('0xd')))[_0x0a63('0xe')]()[_0x0a63('0x11')](0x1,'s')['format']()};_0x218142[_0x22f340]=_0x55cb2f;}else if(_0x258511[_0x0a63('0x12')]==='uniqueid'){_0x218142[_0x22f340]=_0x207434;}else{_0x218142[_0x22f340]=_[_0x0a63('0x13')](_0x207434)?_0x207434:JSON[_0x0a63('0x2')](_0x207434);}}else{_0x218142[_0x22f340]=_[_0x0a63('0x13')](_0x207434)?_0x207434:JSON[_0x0a63('0x2')](_0x207434);}}catch(_0x1f7481){_0x218142[_0x22f340]=_0x207434[_0x0a63('0x14')](',');}});}return _0x218142;};exports[_0x0a63('0x15')]=function(_0x374c52){_0x374c52=parseInt(_0x374c52,0xa);if(!_0x374c52||_0x374c52<0x0){_0x374c52=LIMIT_VALUE;}return _0x374c52;};exports[_0x0a63('0x16')]=function(_0x3cc74d){_0x3cc74d=parseInt(_0x3cc74d,0xa);if(!_0x3cc74d||_0x3cc74d<0x0){_0x3cc74d=0x0;}return _0x3cc74d;};exports[_0x0a63('0x17')]=function(_0x4ea56f){var _0x550568,_0x7b2ccd=null;if(_0x4ea56f){_0x550568=_0x4ea56f['split'](',');_0x7b2ccd=_[_0x0a63('0x18')](_0x550568,function(_0x5937df){if(_0x5937df[_0x0a63('0x19')]('-')===0x0){return[_0x5937df===_0x0a63('0x1a')?sequelize[_0x0a63('0x1b')](sequelize[_0x0a63('0x1c')]('priority'),_0x0a63('0x1d')):_0x5937df['substr'](0x1),_0x0a63('0x1e')];}else{return[_0x5937df===_0x0a63('0x1a')?sequelize[_0x0a63('0x1b')](sequelize[_0x0a63('0x1c')](_0x0a63('0x1a')),_0x0a63('0x1d')):_0x5937df,_0x0a63('0x1f')];}});}return _0x7b2ccd;};exports[_0x0a63('0x20')]=function(_0x567017,_0x5e5987){if(_['isEmpty'](_0x567017)){return _0x567017;}if(_['isArray'](_0x567017)){for(var _0xeacfc9=0x0;_0xeacfc9<_0x567017['length'];_0xeacfc9+=0x1){_0x567017[_0xeacfc9]=this['omit'](_0x567017[_0xeacfc9],_0x5e5987);}return _0x567017;}if(!_[_0x0a63('0x21')](_0x567017)){return _0x567017;}if(_[_0x0a63('0x22')](_0x5e5987)){_0x5e5987=[_0x5e5987];}if(!_[_0x0a63('0x13')](_0x5e5987)){return _0x567017;}for(var _0x2e2526=0x0;_0x2e2526<_0x5e5987['length'];_0x2e2526+=0x1){_[_0x0a63('0x23')](_0x567017,_0x5e5987[_0x2e2526]);}for(var _0x498371 in _0x567017){if(_0x567017[_0x0a63('0x24')](_0x498371)){_0x567017[_0x498371]=this['omit'](_0x567017[_0x498371],_0x5e5987);}}return _0x567017;};exports[_0x0a63('0x25')]=function(_0xcf409){return _0xcf409[_0x0a63('0x26')](RegExp(_0x0a63('0x27')))?!![]:![];};exports[_0x0a63('0x28')]=function(_0x4577b6){return _0x4577b6[_0x0a63('0x26')](/^\S+@\S+$/)?!![]:![];};exports[_0x0a63('0x29')]=function(_0x5f0145){var _0x58cc71=[];_0x5f0145['split'](/[ ,]+/)[_0x0a63('0x2a')](function(_0xc8caf6){_0xc8caf6=_0xc8caf6[_0x0a63('0x2b')](/([^:]")"+/g,'$1');_0xc8caf6='+'+_0xc8caf6+'*';var _0x26de7a=/[ `!@#$%^&*()_\-?~]/;if(_0xc8caf6[_0x0a63('0x26')](_0x26de7a))_0xc8caf6='\x22'+_0xc8caf6+'\x22';_0x58cc71['push'](_0xc8caf6);});return _0x58cc71[_0x0a63('0x2c')]('\x20');};exports[_0x0a63('0x2d')]=function(_0x33a717,_0x46fb40,_0x59d06c){var _0x28f321={},_0x28b3b4={};if(_0x46fb40['query']['$id']){_0x46fb40[_0x0a63('0x2e')]['id']=_0x46fb40['query']['$id'];delete _0x46fb40[_0x0a63('0x2e')][_0x0a63('0x2f')];}_0x28f321['model']=_[_0x0a63('0x18')](_0x33a717,_0x0a63('0x12'));_0x28f321[_0x0a63('0x2e')]=_[_0x0a63('0x3')](_0x46fb40[_0x0a63('0x2e')]);_0x28f321['filters']=_['intersection'](_0x28f321[_0x0a63('0x30')],_0x28f321[_0x0a63('0x2e')]);_0x28b3b4[_0x0a63('0x31')]=_[_0x0a63('0x32')](_0x28f321[_0x0a63('0x30')],this[_0x0a63('0x5')](_0x46fb40['query'][_0x0a63('0x5')]));_0x28b3b4[_0x0a63('0x31')]=_0x28b3b4['attributes'][_0x0a63('0x33')]?_0x28b3b4['attributes']:_0x28f321['model'];if(!_0x46fb40[_0x0a63('0x2e')][_0x0a63('0x24')](_0x0a63('0x34'))){_0x28b3b4['limit']=this[_0x0a63('0x15')](_0x46fb40[_0x0a63('0x2e')][_0x0a63('0x15')]);_0x28b3b4[_0x0a63('0x16')]=this[_0x0a63('0x16')](_0x46fb40[_0x0a63('0x2e')][_0x0a63('0x16')]);}_0x28b3b4['order']=this[_0x0a63('0x17')](_0x46fb40[_0x0a63('0x2e')][_0x0a63('0x17')]);_0x28b3b4['where']=this['filters'](_[_0x0a63('0x35')](_0x46fb40['query'],_0x28f321[_0x0a63('0x6')]),_0x33a717);if(_0x46fb40[_0x0a63('0x2e')][_0x0a63('0x36')]){var _0x5c7b78=_0x33a717;var _0x2af987=_0x46fb40[_0x0a63('0x2e')][_0x0a63('0x36')];if(typeof _0x2af987===_0x0a63('0x37')){_0x5c7b78=_['filter'](_0x33a717,function(_0x1e3b70){return _[_0x0a63('0x4')](_0x2af987[_0x0a63('0x38')],_0x1e3b70[_0x0a63('0x12')]);});_0x2af987=_0x2af987[_0x0a63('0x39')];}_0x28b3b4[_0x0a63('0x3a')]=_['merge'](_0x28b3b4[_0x0a63('0x3a')],{'$or':_[_0x0a63('0x18')](_0x5c7b78,function(_0x347a0b){if(_0x347a0b[_0x0a63('0x3b')]!==_0x0a63('0x3c')){if(_0x59d06c){return sequelize[_0x0a63('0x3a')](sequelize['fn'](_0x0a63('0x3d'),sequelize[_0x0a63('0x1c')](_0x347a0b[_0x0a63('0x12')])),{'$like':sequelize['fn'](_0x0a63('0x3d'),'%'+_0x46fb40[_0x0a63('0x2e')][_0x0a63('0x36')]+'%')});}else{var _0xed7787={};_0xed7787[_0x347a0b[_0x0a63('0x12')]]={'$like':'%'+_0x46fb40[_0x0a63('0x2e')][_0x0a63('0x36')]+'%'};return _0xed7787;}}})});}_0x28b3b4=_[_0x0a63('0x3e')]({},_0x28b3b4,_0x46fb40[_0x0a63('0x3f')]);return _0x28b3b4;}; \ No newline at end of file +var _0x0faf=['value','where','merge','VIRTUAL','lower','options','lodash','moment','parse','keys','includes','isEmpty','forOwn','type','isPlainObject','$gte','utc','$lte','format','YYYY-MM-DD','subtract','name','uniqueid','isArray','split','limit','sort','map','indexOf','priority','cast','unsigned','substr','DESC','col','omit','isObject','isString','unset','hasOwnProperty','match','^[+]?[0-9]*$','getFullTextValue','forEach','replace','push','query','$id','model','filters','intersection','attributes','fields','length','offset','order','pick','filter','object','columns'];(function(_0x436fd6,_0x3a416a){var _0x45cd28=function(_0x4096c7){while(--_0x4096c7){_0x436fd6['push'](_0x436fd6['shift']());}};_0x45cd28(++_0x3a416a);}(_0x0faf,0x132));var _0xf0fa=function(_0x540c49,_0x3e88d9){_0x540c49=_0x540c49-0x0;var _0x390f69=_0x0faf[_0x540c49];return _0x390f69;};'use strict';var _=require(_0xf0fa('0x0'));var sequelize=require('sequelize');var moment=require(_0xf0fa('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1b4763){var _0x2c6207=['ne'];try{var _0x35a260=JSON[_0xf0fa('0x2')](_0x1b4763);var _0xdc9ce3=Object[_0xf0fa('0x3')](_0x35a260)[0x0];return _0x2c6207[_0xf0fa('0x4')](_0xdc9ce3);}catch(_0x283f04){return![];}}function getOperatorValue(_0x5d9b58){var _0x3637a3=JSON[_0xf0fa('0x2')](_0x5d9b58);var _0x25b5c4=Object[_0xf0fa('0x3')](_0x3637a3)[0x0];var _0x2db1d9=_0x3637a3[_0x25b5c4];return{['$'+_0x25b5c4]:_0x2db1d9};}exports['fields']=function(_0x42f7fd){var _0x18db40=null;if(_0x42f7fd){_0x18db40=_0x42f7fd['split'](',');}return _0x18db40;};exports['filters']=function(_0x3bda51,_0x1e8cc0){var _0x25dfec={};if(!_[_0xf0fa('0x5')](_0x3bda51)){_[_0xf0fa('0x6')](_0x3bda51,function(_0x1151ea,_0x379ff6){try{if(_0x1e8cc0){var _0x20fd09=_['find'](_0x1e8cc0,{'name':_0x379ff6})||{};if(hasSequelizeOperator(_0x1151ea)){_0x25dfec[_0x379ff6]=getOperatorValue(_0x1151ea);}else if(_0x20fd09[_0xf0fa('0x7')]==='DATE'&&_[_0xf0fa('0x8')](_0x1151ea)){var _0x521034=JSON[_0xf0fa('0x2')](_0x1151ea);var _0x17326f={'$gte':moment(moment(_0x521034[_0xf0fa('0x9')])['format']('YYYY-MM-DD'))[_0xf0fa('0xa')]()['format'](),'$lte':moment(moment(_0x521034[_0xf0fa('0xb')])[_0xf0fa('0xc')](_0xf0fa('0xd')))[_0xf0fa('0xa')]()[_0xf0fa('0xe')](0x1,'s')[_0xf0fa('0xc')]()};_0x25dfec[_0x379ff6]=_0x17326f;}else if(_0x20fd09[_0xf0fa('0xf')]===_0xf0fa('0x10')){_0x25dfec[_0x379ff6]=_0x1151ea;}else{_0x25dfec[_0x379ff6]=_['isArray'](_0x1151ea)?_0x1151ea:JSON[_0xf0fa('0x2')](_0x1151ea);}}else{_0x25dfec[_0x379ff6]=_[_0xf0fa('0x11')](_0x1151ea)?_0x1151ea:JSON[_0xf0fa('0x2')](_0x1151ea);}}catch(_0x1d3c22){_0x25dfec[_0x379ff6]=_0x1151ea[_0xf0fa('0x12')](',');}});}return _0x25dfec;};exports[_0xf0fa('0x13')]=function(_0x5ba2eb){_0x5ba2eb=parseInt(_0x5ba2eb,0xa);if(!_0x5ba2eb||_0x5ba2eb<0x0){_0x5ba2eb=LIMIT_VALUE;}return _0x5ba2eb;};exports['offset']=function(_0x2f376d){_0x2f376d=parseInt(_0x2f376d,0xa);if(!_0x2f376d||_0x2f376d<0x0){_0x2f376d=0x0;}return _0x2f376d;};exports[_0xf0fa('0x14')]=function(_0x151d09){var _0x2385e2,_0x1a3620=null;if(_0x151d09){_0x2385e2=_0x151d09[_0xf0fa('0x12')](',');_0x1a3620=_[_0xf0fa('0x15')](_0x2385e2,function(_0x3de639){if(_0x3de639[_0xf0fa('0x16')]('-')===0x0){return[_0x3de639===_0xf0fa('0x17')?sequelize[_0xf0fa('0x18')](sequelize['col'](_0xf0fa('0x17')),_0xf0fa('0x19')):_0x3de639[_0xf0fa('0x1a')](0x1),_0xf0fa('0x1b')];}else{return[_0x3de639===_0xf0fa('0x17')?sequelize[_0xf0fa('0x18')](sequelize[_0xf0fa('0x1c')](_0xf0fa('0x17')),_0xf0fa('0x19')):_0x3de639,'ASC'];}});}return _0x1a3620;};exports[_0xf0fa('0x1d')]=function(_0x19e392,_0x56134e){if(_[_0xf0fa('0x5')](_0x19e392)){return _0x19e392;}if(_[_0xf0fa('0x11')](_0x19e392)){for(var _0x2efe88=0x0;_0x2efe88<_0x19e392['length'];_0x2efe88+=0x1){_0x19e392[_0x2efe88]=this[_0xf0fa('0x1d')](_0x19e392[_0x2efe88],_0x56134e);}return _0x19e392;}if(!_[_0xf0fa('0x1e')](_0x19e392)){return _0x19e392;}if(_[_0xf0fa('0x1f')](_0x56134e)){_0x56134e=[_0x56134e];}if(!_[_0xf0fa('0x11')](_0x56134e)){return _0x19e392;}for(var _0x4e6eef=0x0;_0x4e6eef<_0x56134e['length'];_0x4e6eef+=0x1){_[_0xf0fa('0x20')](_0x19e392,_0x56134e[_0x4e6eef]);}for(var _0x1c5eaf in _0x19e392){if(_0x19e392[_0xf0fa('0x21')](_0x1c5eaf)){_0x19e392[_0x1c5eaf]=this[_0xf0fa('0x1d')](_0x19e392[_0x1c5eaf],_0x56134e);}}return _0x19e392;};exports['isNumeric']=function(_0x4058d6){return _0x4058d6[_0xf0fa('0x22')](RegExp(_0xf0fa('0x23')))?!![]:![];};exports['isEmail']=function(_0x9ad0e3){return _0x9ad0e3['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xf0fa('0x24')]=function(_0x1e3875){var _0x28e057=[];_0x1e3875['split'](/[ ,]+/)[_0xf0fa('0x25')](function(_0x33cc64){_0x33cc64=_0x33cc64[_0xf0fa('0x26')](/([^:]")"+/g,'$1');_0x33cc64='+'+_0x33cc64+'*';var _0x212986=/[ `!@#$%^&*()_\-?~]/;if(_0x33cc64[_0xf0fa('0x22')](_0x212986))_0x33cc64='\x22'+_0x33cc64+'\x22';_0x28e057[_0xf0fa('0x27')](_0x33cc64);});return _0x28e057['join']('\x20');};exports['getOptions']=function(_0x36173a,_0x255f9d,_0x485fe2){var _0x38cf8c={},_0x50e0bd={};if(_0x255f9d['query']['$id']){_0x255f9d[_0xf0fa('0x28')]['id']=_0x255f9d['query'][_0xf0fa('0x29')];delete _0x255f9d[_0xf0fa('0x28')][_0xf0fa('0x29')];}_0x38cf8c[_0xf0fa('0x2a')]=_[_0xf0fa('0x15')](_0x36173a,_0xf0fa('0xf'));_0x38cf8c[_0xf0fa('0x28')]=_[_0xf0fa('0x3')](_0x255f9d['query']);_0x38cf8c[_0xf0fa('0x2b')]=_[_0xf0fa('0x2c')](_0x38cf8c[_0xf0fa('0x2a')],_0x38cf8c['query']);_0x50e0bd[_0xf0fa('0x2d')]=_[_0xf0fa('0x2c')](_0x38cf8c[_0xf0fa('0x2a')],this[_0xf0fa('0x2e')](_0x255f9d['query']['fields']));_0x50e0bd[_0xf0fa('0x2d')]=_0x50e0bd[_0xf0fa('0x2d')][_0xf0fa('0x2f')]?_0x50e0bd[_0xf0fa('0x2d')]:_0x38cf8c[_0xf0fa('0x2a')];if(!_0x255f9d['query']['hasOwnProperty']('nolimit')){_0x50e0bd['limit']=this[_0xf0fa('0x13')](_0x255f9d[_0xf0fa('0x28')]['limit']);_0x50e0bd['offset']=this[_0xf0fa('0x30')](_0x255f9d[_0xf0fa('0x28')][_0xf0fa('0x30')]);}_0x50e0bd[_0xf0fa('0x31')]=this[_0xf0fa('0x14')](_0x255f9d[_0xf0fa('0x28')][_0xf0fa('0x14')]);_0x50e0bd['where']=this['filters'](_[_0xf0fa('0x32')](_0x255f9d[_0xf0fa('0x28')],_0x38cf8c[_0xf0fa('0x2b')]),_0x36173a);if(_0x255f9d[_0xf0fa('0x28')][_0xf0fa('0x33')]){var _0x1d0129=_0x36173a;var _0x5acfa4=_0x255f9d[_0xf0fa('0x28')]['filter'];if(typeof _0x5acfa4===_0xf0fa('0x34')){_0x1d0129=_[_0xf0fa('0x33')](_0x36173a,function(_0x6e1fd9){return _[_0xf0fa('0x4')](_0x5acfa4[_0xf0fa('0x35')],_0x6e1fd9[_0xf0fa('0xf')]);});_0x5acfa4=_0x5acfa4[_0xf0fa('0x36')];}_0x50e0bd[_0xf0fa('0x37')]=_[_0xf0fa('0x38')](_0x50e0bd['where'],{'$or':_['map'](_0x1d0129,function(_0x52221a){if(_0x52221a[_0xf0fa('0x7')]!==_0xf0fa('0x39')){if(_0x485fe2){return sequelize['where'](sequelize['fn'](_0xf0fa('0x3a'),sequelize[_0xf0fa('0x1c')](_0x52221a[_0xf0fa('0xf')])),{'$like':sequelize['fn'](_0xf0fa('0x3a'),'%'+_0x255f9d['query'][_0xf0fa('0x33')]+'%')});}else{var _0x1f3916={};_0x1f3916[_0x52221a[_0xf0fa('0xf')]]={'$like':'%'+_0x255f9d[_0xf0fa('0x28')][_0xf0fa('0x33')]+'%'};return _0x1f3916;}}})});}_0x50e0bd=_[_0xf0fa('0x38')]({},_0x50e0bd,_0x255f9d[_0xf0fa('0x3b')]);return _0x50e0bd;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 54322c7..7438d5c 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x773d=['get','env','appPath','root','test','set','join','client','json\x20replacer','split','use','views','/server/views','engine','ejs','html','urlencoded','50mb','json','serve-favicon','method-override','cookie-parser','errorhandler','path','passport','cors','moment','../mysqldb'];(function(_0x5e608c,_0x453591){var _0x44d7fc=function(_0xc9de57){while(--_0xc9de57){_0x5e608c['push'](_0x5e608c['shift']());}};_0x44d7fc(++_0x453591);}(_0x773d,0xf3));var _0xd773=function(_0x2f5711,_0x389860){_0x2f5711=_0x2f5711-0x0;var _0x19b206=_0x773d[_0x2f5711];return _0x19b206;};'use strict';var express=require('express');var favicon=require(_0xd773('0x0'));var bodyParser=require('body-parser');var methodOverride=require(_0xd773('0x1'));var cookieParser=require(_0xd773('0x2'));var errorHandler=require(_0xd773('0x3'));var path=require(_0xd773('0x4'));var passport=require(_0xd773('0x5'));var cors=require(_0xd773('0x6'));var moment=require(_0xd773('0x7'));var config=require('./environment');var db=require(_0xd773('0x8'))['db'];exports['default']=function(_0x4608c3){var _0x3538c5=_0x4608c3[_0xd773('0x9')](_0xd773('0xa'));if(_0x3538c5==='production'){_0x4608c3['set'](_0xd773('0xb'),path['join'](config[_0xd773('0xc')],'public'));}if(_0x3538c5==='development'||_0x3538c5===_0xd773('0xd')){_0x4608c3[_0xd773('0xe')](_0xd773('0xb'),path[_0xd773('0xf')](config['root'],_0xd773('0x10')));_0x4608c3['use'](errorHandler());}_0x4608c3[_0xd773('0xe')](_0xd773('0x11'),function(_0x2e74e8,_0x45ffb9){if(this[_0x2e74e8]instanceof Date){_0x45ffb9=this[_0x2e74e8]['toISOString']()[_0xd773('0x12')]('.')[0x0]+'Z';}return _0x45ffb9;});_0x4608c3[_0xd773('0x13')](express['static'](_0x4608c3[_0xd773('0x9')](_0xd773('0xb'))));_0x4608c3['set'](_0xd773('0x14'),config[_0xd773('0xc')]+_0xd773('0x15'));_0x4608c3[_0xd773('0x16')]('html',require(_0xd773('0x17'))['renderFile']);_0x4608c3[_0xd773('0xe')]('view\x20engine',_0xd773('0x18'));_0x4608c3[_0xd773('0x13')](bodyParser[_0xd773('0x19')]({'limit':_0xd773('0x1a'),'extended':!![]}));_0x4608c3['use'](bodyParser[_0xd773('0x1b')]({'limit':_0xd773('0x1a')}));_0x4608c3[_0xd773('0x13')](cors());_0x4608c3[_0xd773('0x13')](methodOverride());_0x4608c3['use'](cookieParser());_0x4608c3[_0xd773('0x13')](passport['initialize']());}; \ No newline at end of file +var _0xeadf=['client','use','toISOString','split','static','views','/server/views','engine','html','renderFile','view\x20engine','50mb','json','initialize','serve-favicon','body-parser','cookie-parser','errorhandler','path','passport','cors','moment','../mysqldb','default','get','env','production','set','appPath','join','public','development','test','root'];(function(_0xd81a45,_0x2ea650){var _0x24f3a5=function(_0x2b250e){while(--_0x2b250e){_0xd81a45['push'](_0xd81a45['shift']());}};_0x24f3a5(++_0x2ea650);}(_0xeadf,0x162));var _0xfead=function(_0xa79977,_0x4f7f12){_0xa79977=_0xa79977-0x0;var _0x109f10=_0xeadf[_0xa79977];return _0x109f10;};'use strict';var express=require('express');var favicon=require(_0xfead('0x0'));var bodyParser=require(_0xfead('0x1'));var methodOverride=require('method-override');var cookieParser=require(_0xfead('0x2'));var errorHandler=require(_0xfead('0x3'));var path=require(_0xfead('0x4'));var passport=require(_0xfead('0x5'));var cors=require(_0xfead('0x6'));var moment=require(_0xfead('0x7'));var config=require('./environment');var db=require(_0xfead('0x8'))['db'];exports[_0xfead('0x9')]=function(_0x3cfd1d){var _0x2d8e89=_0x3cfd1d[_0xfead('0xa')](_0xfead('0xb'));if(_0x2d8e89===_0xfead('0xc')){_0x3cfd1d[_0xfead('0xd')](_0xfead('0xe'),path[_0xfead('0xf')](config['root'],_0xfead('0x10')));}if(_0x2d8e89===_0xfead('0x11')||_0x2d8e89===_0xfead('0x12')){_0x3cfd1d[_0xfead('0xd')](_0xfead('0xe'),path[_0xfead('0xf')](config[_0xfead('0x13')],_0xfead('0x14')));_0x3cfd1d[_0xfead('0x15')](errorHandler());}_0x3cfd1d[_0xfead('0xd')]('json\x20replacer',function(_0x16f6d2,_0x2c5f2b){if(this[_0x16f6d2]instanceof Date){_0x2c5f2b=this[_0x16f6d2][_0xfead('0x16')]()[_0xfead('0x17')]('.')[0x0]+'Z';}return _0x2c5f2b;});_0x3cfd1d[_0xfead('0x15')](express[_0xfead('0x18')](_0x3cfd1d[_0xfead('0xa')]('appPath')));_0x3cfd1d[_0xfead('0xd')](_0xfead('0x19'),config[_0xfead('0x13')]+_0xfead('0x1a'));_0x3cfd1d[_0xfead('0x1b')](_0xfead('0x1c'),require('ejs')[_0xfead('0x1d')]);_0x3cfd1d[_0xfead('0xd')](_0xfead('0x1e'),_0xfead('0x1c'));_0x3cfd1d[_0xfead('0x15')](bodyParser['urlencoded']({'limit':_0xfead('0x1f'),'extended':!![]}));_0x3cfd1d[_0xfead('0x15')](bodyParser[_0xfead('0x20')]({'limit':_0xfead('0x1f')}));_0x3cfd1d['use'](cors());_0x3cfd1d[_0xfead('0x15')](methodOverride());_0x3cfd1d[_0xfead('0x15')](cookieParser());_0x3cfd1d['use'](passport[_0xfead('0x21')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 358c6ca..4531e86 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 _0x6e6d=['child_process','../environment','networkInterfaces','keys','filter','family','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','md5','update','hex','getUuid','platform','licenseToken','win32','utf8','hostname','macAddress','ipAddress','createHash','digest','substring','crypto','bimedia-machine-uuid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6e6d,0xc4));var _0xd6e6=function(_0xd4532e,_0x527207){_0xd4532e=_0xd4532e-0x0;var _0x588545=_0x6e6d[_0xd4532e];return _0x588545;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xd6e6('0x0'));var machine=require(_0xd6e6('0x1'));var exec=require(_0xd6e6('0x2'))['execSync'];var config=require(_0xd6e6('0x3'));function getInterfaces(){var _0x5849bf=[];var _0x138ea4=os[_0xd6e6('0x4')]();var _0x43ffe3=_['orderBy'](_[_0xd6e6('0x5')](_0x138ea4));for(var _0x2d6cad=0x0;_0x2d6cad<_0x43ffe3['length'];_0x2d6cad++){var _0xe08152=_0x138ea4[_0x43ffe3[_0x2d6cad]][_0xd6e6('0x6')](function(_0x5e117b){return _0x5e117b[_0xd6e6('0x7')]==='IPv4'&&_0x5e117b[_0xd6e6('0x8')]===![];});_0x5849bf=_0x5849bf[_0xd6e6('0x9')](_0xe08152);}return _0x5849bf;}function getFirstInterface(){var _0x314e83=_[_0xd6e6('0xa')](getInterfaces());return{'macAddress':_0x314e83&&_0x314e83[_0xd6e6('0xb')]?_0x314e83[_0xd6e6('0xb')]:_0xd6e6('0xc'),'ipAddress':_0x314e83&&_0x314e83[_0xd6e6('0xd')]?_0x314e83['address']:_0xd6e6('0xe')};}exports[_0xd6e6('0xf')]=getFirstInterface;function getCPUhash(){var _0x37fb22=_['orderBy'](os[_0xd6e6('0x10')]()[_0xd6e6('0x11')](function(_0x4e32d4){return _0x4e32d4[_0xd6e6('0x12')];}))['join'](':');return crypto['createHash'](_0xd6e6('0x13'))[_0xd6e6('0x14')](_0x37fb22)['digest'](_0xd6e6('0x15'));}exports[_0xd6e6('0x16')]=function(){var _0x1a58b3=os[_0xd6e6('0x17')]();var _0x2f678e=/[0-9a-f-]{36}/;if(config[_0xd6e6('0x18')]&&_0x2f678e['test'](config[_0xd6e6('0x18')])){return config[_0xd6e6('0x18')];}else if(_0x1a58b3===_0xd6e6('0x19')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0xd6e6('0x1a')})['replace']('\x0d\x0a','');}else{var _0x563ade=getFirstInterface();var _0x52a3ce=getCPUhash();var _0x224b6f=_0x52a3ce+'|'+os[_0xd6e6('0x1b')]()+'|'+_0x563ade[_0xd6e6('0x1c')]+'|'+_0x563ade[_0xd6e6('0x1d')];var _0x4934ae=crypto[_0xd6e6('0x1e')](_0xd6e6('0x13'))['update'](_0x224b6f)[_0xd6e6('0x1f')](_0xd6e6('0x15'));return _0x4934ae['substring'](0x0,0x8)+'-'+_0x4934ae[_0xd6e6('0x20')](0x8,0xc)+'-'+_0x4934ae[_0xd6e6('0x20')](0xc,0x10)+'-'+_0x4934ae['substring'](0x10,0x14)+'-'+_0x4934ae['substring'](0x14);}}; \ No newline at end of file +var _0xb91e=['lodash','crypto','bimedia-machine-uuid','../environment','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','head','mac','00:00:00:00:00:00','address','getFirstInterface','cpus','model','join','createHash','md5','update','hex','getUuid','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','replace','hostname','macAddress','ipAddress','substring'];(function(_0x4d5b45,_0x45f91a){var _0x59ce24=function(_0x58f66f){while(--_0x58f66f){_0x4d5b45['push'](_0x4d5b45['shift']());}};_0x59ce24(++_0x45f91a);}(_0xb91e,0x132));var _0xeb91=function(_0x1a913b,_0x6889d9){_0x1a913b=_0x1a913b-0x0;var _0x2308a7=_0xb91e[_0x1a913b];return _0x2308a7;};'use strict';var _=require(_0xeb91('0x0'));var os=require('os');var crypto=require(_0xeb91('0x1'));var machine=require(_0xeb91('0x2'));var exec=require('child_process')['execSync'];var config=require(_0xeb91('0x3'));function getInterfaces(){var _0x26d432=[];var _0x4535b7=os[_0xeb91('0x4')]();var _0x324813=_[_0xeb91('0x5')](_[_0xeb91('0x6')](_0x4535b7));for(var _0x438b54=0x0;_0x438b54<_0x324813[_0xeb91('0x7')];_0x438b54++){var _0x54ecda=_0x4535b7[_0x324813[_0x438b54]][_0xeb91('0x8')](function(_0x22408d){return _0x22408d[_0xeb91('0x9')]===_0xeb91('0xa')&&_0x22408d[_0xeb91('0xb')]===![];});_0x26d432=_0x26d432['concat'](_0x54ecda);}return _0x26d432;}function getFirstInterface(){var _0x1beeaa=_[_0xeb91('0xc')](getInterfaces());return{'macAddress':_0x1beeaa&&_0x1beeaa[_0xeb91('0xd')]?_0x1beeaa[_0xeb91('0xd')]:_0xeb91('0xe'),'ipAddress':_0x1beeaa&&_0x1beeaa[_0xeb91('0xf')]?_0x1beeaa['address']:'127.0.0.1'};}exports[_0xeb91('0x10')]=getFirstInterface;function getCPUhash(){var _0x2a3833=_[_0xeb91('0x5')](os[_0xeb91('0x11')]()['map'](function(_0xaec5d7){return _0xaec5d7[_0xeb91('0x12')];}))[_0xeb91('0x13')](':');return crypto[_0xeb91('0x14')](_0xeb91('0x15'))[_0xeb91('0x16')](_0x2a3833)['digest'](_0xeb91('0x17'));}exports[_0xeb91('0x18')]=function(){var _0x2bf8a0=os[_0xeb91('0x19')]();var _0x74621e=/[0-9a-f-]{36}/;if(config[_0xeb91('0x1a')]&&_0x74621e[_0xeb91('0x1b')](config['licenseToken'])){return config[_0xeb91('0x1a')];}else if(_0x2bf8a0==='win32'){return exec(_0xeb91('0x1c'),{'encoding':'utf8'})[_0xeb91('0x1d')]('\x0d\x0a','');}else{var _0x39598e=getFirstInterface();var _0x5c0f92=getCPUhash();var _0x47f537=_0x5c0f92+'|'+os[_0xeb91('0x1e')]()+'|'+_0x39598e[_0xeb91('0x1f')]+'|'+_0x39598e[_0xeb91('0x20')];var _0xbf473a=crypto[_0xeb91('0x14')](_0xeb91('0x15'))[_0xeb91('0x16')](_0x47f537)['digest'](_0xeb91('0x17'));return _0xbf473a[_0xeb91('0x21')](0x0,0x8)+'-'+_0xbf473a['substring'](0x8,0xc)+'-'+_0xbf473a[_0xeb91('0x21')](0xc,0x10)+'-'+_0xbf473a['substring'](0x10,0x14)+'-'+_0xbf473a[_0xeb91('0x21')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 13ca691..3b79a0f 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 _0xa803=['catch','get','data1','data2','active','license','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','update','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','format','YYYY-MM-DD\x20HH:mm','encryptString','diff','days','DEMO\x20START\x20AT\x20%s','error','finally','getUuid','spread','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','./hardware','../logger','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','then'];(function(_0x17b11b,_0x2889b8){var _0x413a68=function(_0x36fb85){while(--_0x36fb85){_0x17b11b['push'](_0x17b11b['shift']());}};_0x413a68(++_0x2889b8);}(_0xa803,0x140));var _0x3a80=function(_0x4e281d,_0xd6e1f4){_0x4e281d=_0x4e281d-0x0;var _0x544a27=_0xa803[_0x4e281d];return _0x544a27;};'use strict';var util=require(_0x3a80('0x0'));var moment=require(_0x3a80('0x1'));var rp=require(_0x3a80('0x2'));var BPromise=require(_0x3a80('0x3'));var pkginfo=require(_0x3a80('0x4'))(module,_0x3a80('0x5'));var db=require(_0x3a80('0x6'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x3a80('0x7'));var logger=require(_0x3a80('0x8'))('license');var HOST=_0x3a80('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x114463){return new BPromise(function(_0x549b46,_0x4e8226){var _0x3d4f2e=util['format'](_0x3a80('0xa'),HOST,_0x114463,module[_0x3a80('0xb')][_0x3a80('0x5')]);if(oldToken){_0x3d4f2e=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x114463,module['exports'][_0x3a80('0x5')],oldToken);}var _0x2260e3={'uri':_0x3d4f2e,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x2260e3)[_0x3a80('0xc')](function(_0x579685){_0x549b46(_0x579685);})[_0x3a80('0xd')](function(_0x41b8a6){_0x4e8226(_0x41b8a6);});});}function manageLicense(_0x3af406,_0x5cffa7){var _0x262a90=_0x5cffa7[_0x3a80('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x262a90[_0x3a80('0xf')]!==_0x3af406&&!_0x262a90[_0x3a80('0x10')]){oldToken=_0x262a90[_0x3a80('0xf')];}httpRequest(_0x3af406)['then'](function(_0x4df4ce){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x4df4ce[_0x3a80('0x11')]){isOldTokenSent=![];if(!_0x262a90[_0x3a80('0x12')]&&_0x262a90[_0x3a80('0x12')]!=_0x4df4ce[_0x3a80('0x12')]||_0x262a90[_0x3a80('0x12')]&&_0x262a90[_0x3a80('0x10')]){logger['info'](_0x3a80('0x13'));}if(_0x262a90[_0x3a80('0x12')]&&!_0x262a90[_0x3a80('0x10')]&&_0x262a90[_0x3a80('0x12')]!=_0x4df4ce[_0x3a80('0x12')]){logger[_0x3a80('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x262a90[_0x3a80('0x12')]&&!_0x262a90['data2']&&_0x262a90[_0x3a80('0x12')]==_0x4df4ce[_0x3a80('0x12')]){return _0x5cffa7;}return _0x5cffa7[_0x3a80('0x15')]({'data1':_0x3af406,'data2':null,'license':_0x4df4ce[_0x3a80('0x12')]});}else{if(_0x4df4ce['license']||_0x262a90['license']){if(!_0x262a90[_0x3a80('0x10')]){if(_0x262a90[_0x3a80('0xf')]==_0x3af406){GRAY_PERIOD_REASON=_0x3a80('0x16');logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x3a80('0x17');logger[_0x3a80('0x14')](_0x3a80('0x18'),_0x262a90[_0x3a80('0xf')],_0x3af406);}logger['info'](_0x3a80('0x19'),GRAY_PERIOD_REASON[_0x3a80('0x1a')](),moment()[_0x3a80('0x1b')](_0x3a80('0x1c')));return _0x5cffa7[_0x3a80('0x15')]({'data2':encryptor[_0x3a80('0x1d')](moment()[_0x3a80('0x1b')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x3a80('0x1e')](encryptor['decryptString'](_0x262a90[_0x3a80('0x10')]),_0x3a80('0x1f'))>DAYS){logger[_0x3a80('0x14')](_0x3a80('0x20'),moment()['format'](_0x3a80('0x1c')));isOldTokenSent=![];return _0x5cffa7['update']({'data1':_0x3af406,'data2':null,'license':null});}}}else{if(_0x262a90[_0x3a80('0xf')]!=_0x3af406){logger[_0x3a80('0x14')](_0x3a80('0x18'),_0x262a90[_0x3a80('0xf')],_0x3af406);return _0x5cffa7[_0x3a80('0x15')]({'data1':_0x3af406,'data2':null,'license':null});}}}return _0x5cffa7;})['then'](function(_0x1fb129){_0x5cffa7=_0x1fb129;})['catch'](function(_0x96bc23){logger[_0x3a80('0x21')](_0x96bc23['message']);})[_0x3a80('0x22')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x5cffa7);},TIME);});}function defaultLicense(){var _0x12cb64=hardware[_0x3a80('0x23')]();if(_0x12cb64){return db['License']['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x12cb64}})[_0x3a80('0x24')](function(_0x230d35,_0x4810c5){logger[_0x3a80('0x14')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x12cb64);manageLicense(_0x12cb64,_0x230d35);})[_0x3a80('0xd')](function(_0x32fdb4){logger[_0x3a80('0x21')](_0x32fdb4['message']);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0xc189=['info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','decryptString','days','DEMO\x20START\x20AT\x20%s','catch','error','message','finally','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','GET','get','data1','data2','then','active'];(function(_0x2ac85,_0x4c1ffd){var _0x2352d2=function(_0x50bde1){while(--_0x50bde1){_0x2ac85['push'](_0x2ac85['shift']());}};_0x2352d2(++_0x4c1ffd);}(_0xc189,0x1e4));var _0x9c18=function(_0x2c0ded,_0x3de22c){_0x2c0ded=_0x2c0ded-0x0;var _0x4473e5=_0xc189[_0x2c0ded];return _0x4473e5;};'use strict';var util=require(_0x9c18('0x0'));var moment=require(_0x9c18('0x1'));var rp=require(_0x9c18('0x2'));var BPromise=require(_0x9c18('0x3'));var pkginfo=require(_0x9c18('0x4'))(module,_0x9c18('0x5'));var db=require(_0x9c18('0x6'))['db'];var encryptor=require(_0x9c18('0x7'));var hardware=require('./hardware');var logger=require(_0x9c18('0x8'))(_0x9c18('0x9'));var HOST=_0x9c18('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x5244ee){return new BPromise(function(_0xcd8f36,_0x5e3f7c){var _0x40526d=util[_0x9c18('0xb')](_0x9c18('0xc'),HOST,_0x5244ee,module[_0x9c18('0xd')][_0x9c18('0x5')]);if(oldToken){_0x40526d=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x5244ee,module[_0x9c18('0xd')][_0x9c18('0x5')],oldToken);}var _0x1fbabc={'uri':_0x40526d,'method':_0x9c18('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x1fbabc)['then'](function(_0x25709f){_0xcd8f36(_0x25709f);})['catch'](function(_0x301469){_0x5e3f7c(_0x301469);});});}function manageLicense(_0x394a73,_0x164f6d){var _0x579dad=_0x164f6d[_0x9c18('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x579dad[_0x9c18('0x10')]!==_0x394a73&&!_0x579dad[_0x9c18('0x11')]){oldToken=_0x579dad['data1'];}httpRequest(_0x394a73)[_0x9c18('0x12')](function(_0x2eeac4){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x2eeac4[_0x9c18('0x13')]){isOldTokenSent=![];if(!_0x579dad[_0x9c18('0x9')]&&_0x579dad[_0x9c18('0x9')]!=_0x2eeac4['license']||_0x579dad[_0x9c18('0x9')]&&_0x579dad[_0x9c18('0x11')]){logger[_0x9c18('0x14')](_0x9c18('0x15'));}if(_0x579dad[_0x9c18('0x9')]&&!_0x579dad[_0x9c18('0x11')]&&_0x579dad[_0x9c18('0x9')]!=_0x2eeac4[_0x9c18('0x9')]){logger[_0x9c18('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x579dad['license']&&!_0x579dad[_0x9c18('0x11')]&&_0x579dad[_0x9c18('0x9')]==_0x2eeac4['license']){return _0x164f6d;}return _0x164f6d[_0x9c18('0x16')]({'data1':_0x394a73,'data2':null,'license':_0x2eeac4[_0x9c18('0x9')]});}else{if(_0x2eeac4['license']||_0x579dad['license']){if(!_0x579dad[_0x9c18('0x11')]){if(_0x579dad['data1']==_0x394a73){GRAY_PERIOD_REASON=_0x9c18('0x17');logger[_0x9c18('0x14')](_0x9c18('0x18'));}else{GRAY_PERIOD_REASON=_0x9c18('0x19');logger[_0x9c18('0x14')](_0x9c18('0x1a'),_0x579dad['data1'],_0x394a73);}logger['info'](_0x9c18('0x1b'),GRAY_PERIOD_REASON[_0x9c18('0x1c')](),moment()[_0x9c18('0xb')](_0x9c18('0x1d')));return _0x164f6d[_0x9c18('0x16')]({'data2':encryptor[_0x9c18('0x1e')](moment()['format'](_0x9c18('0x1d')))});}else{if(moment()['diff'](encryptor[_0x9c18('0x1f')](_0x579dad['data2']),_0x9c18('0x20'))>DAYS){logger[_0x9c18('0x14')](_0x9c18('0x21'),moment()['format'](_0x9c18('0x1d')));isOldTokenSent=![];return _0x164f6d[_0x9c18('0x16')]({'data1':_0x394a73,'data2':null,'license':null});}}}else{if(_0x579dad[_0x9c18('0x10')]!=_0x394a73){logger['info'](_0x9c18('0x1a'),_0x579dad[_0x9c18('0x10')],_0x394a73);return _0x164f6d['update']({'data1':_0x394a73,'data2':null,'license':null});}}}return _0x164f6d;})[_0x9c18('0x12')](function(_0x1ddff2){_0x164f6d=_0x1ddff2;})[_0x9c18('0x22')](function(_0x13f424){logger[_0x9c18('0x23')](_0x13f424[_0x9c18('0x24')]);})[_0x9c18('0x25')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x164f6d);},TIME);});}function defaultLicense(){var _0x49bb94=hardware['getUuid']();if(_0x49bb94){return db[_0x9c18('0x26')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x49bb94}})[_0x9c18('0x27')](function(_0x2d841e,_0x37d49f){logger['info'](_0x9c18('0x28'),_0x49bb94);manageLicense(_0x49bb94,_0x2d841e);})['catch'](function(_0x246cae){logger[_0x9c18('0x23')](_0x246cae['message']);});}}exports[_0x9c18('0x29')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 1d16be4..a5ff7d7 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 _0x535f=['days','grayReason','disabled','message','User','findAll','COUNT','col','role','count','admin','user','telephone','telephones','catch','pick','countBy','License\x20limit\x20reached\x20for\x20telephones','moment','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','getUuid','find','defaults','then','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline'];(function(_0x291cf9,_0x2f6de9){var _0x203118=function(_0x1d073d){while(--_0x1d073d){_0x291cf9['push'](_0x291cf9['shift']());}};_0x203118(++_0x2f6de9);}(_0x535f,0xbe));var _0xf535=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x535f[_0x11ce46];return _0x368a1e;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xf535('0x0'));var BPromise=require('bluebird');var hardware=require(_0xf535('0x1'));var encryptor=require('../../components/encryptor');var db=require(_0xf535('0x2'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xf535('0x3'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xf535('0x4'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xf535('0x3'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xf535('0x5'),'machineUuid':hardware[_0xf535('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x191bd3){return new BPromise(function(_0x5dbf1e,_0x45bed7){return db['License'][_0xf535('0x7')](_[_0xf535('0x8')](_0x191bd3,{'raw':!![],'where':{'id':0x1}}))[_0xf535('0x9')](function(_0x45ace6){return checkLicense(_0x45ace6,null);})[_0xf535('0x9')](function(_0x109641){_0x5dbf1e(_0x109641);return;})['catch'](function(_0x89ca0a){_0x45bed7(_0x89ca0a);});});}function checkLicense(_0x292f39,_0x215e9b){if(!_0x292f39){demoLicense[_0xf535('0xa')]=_0x292f39[_0xf535('0xb')];return demoLicense;}try{var _0x29e1b1=_0x215e9b||_0x292f39[_0xf535('0xc')];if(_[_0xf535('0xd')](_0x29e1b1)){throw new Error(_0xf535('0xe'));}var _0x815c55=_0x292f39[_0xf535('0xb')];var _0x298366=_0x292f39[_0xf535('0xf')];var _0x490d75=_0x815c55[_0xf535('0x10')]('-')[0x4];var _0xb61c66=_0x815c55[_0xf535('0x10')]('-')[0x0];var _0x1be218=encryptor[_0xf535('0x11')](_0x29e1b1,util[_0xf535('0x12')](_0xf535('0x13'),_0x490d75,_0x815c55,_0xb61c66));var _0x1df7b0=JSON[_0xf535('0x14')](_0x1be218);_0x1df7b0[_0xf535('0x15')]=![];_0x1df7b0[_0xf535('0xa')]=_0x815c55;_0x1df7b0[_0xf535('0x16')]=hardware[_0xf535('0x6')]();if(_0x298366){var _0x222b85=encryptor[_0xf535('0x11')](_0x298366);_0x1df7b0[_0xf535('0x17')]=_0x222b85;_0x1df7b0[_0xf535('0x18')]=moment(_0x222b85)['add'](0x7,_0xf535('0x19'))[_0xf535('0x12')]();_0x1df7b0[_0xf535('0x1a')]=_0x1df7b0[_0xf535('0xa')]!=_0x1df7b0['machineUuid']?'changed':_0xf535('0x1b');}return _0x1df7b0;}catch(_0x46e118){breakingLicense[_0xf535('0xa')]=_0x292f39[_0xf535('0xb')];breakingLicense[_0xf535('0x1c')]=_0x46e118['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x571bb7,_0x249791){getLicense()[_0xf535('0x9')](function(_0xf4c0bd){return db[_0xf535('0x1d')][_0xf535('0x1e')]({'attributes':['role',[db['sequelize']['fn'](_0xf535('0x1f'),db['sequelize'][_0xf535('0x20')](_0xf535('0x21'))),_0xf535('0x22')]],'group':'role','where':{'role':{'$or':[_0xf535('0x23'),_0xf535('0x24'),_0xf535('0x25')]}},'raw':!![]})['then'](function(_0x38c97e){var _0x158d3e={'user':_0xf4c0bd['users']||0x0,'telephone':_0xf4c0bd[_0xf535('0x26')]||0x0};_0x38c97e['forEach'](function(_0x341c0b){var _0xdb01dd=_0x341c0b[_0xf535('0x21')]===_0xf535('0x23')?_0xf535('0x24'):_0x341c0b[_0xf535('0x21')];_0x158d3e[_0xdb01dd]-=_0x341c0b[_0xf535('0x22')];if(_0x158d3e[_0xdb01dd]<0x0)_0x158d3e[_0xdb01dd]=0x0;});_0x571bb7(_0x158d3e);return;});})[_0xf535('0x27')](function(_0x36711d){_0x249791(_0x36711d);});});}function checkUserLimits(_0xd24abd){return new BPromise(function(_0x57debb,_0x38ef0e){getLimits()['then'](function(_0x4f2554){var _0x23d564=_[_0xf535('0x28')](_[_0xf535('0x29')](_0xd24abd,'role'),['admin','user',_0xf535('0x25')]);var _0x277d3a=(_0x23d564[_0xf535('0x23')]||0x0)+(_0x23d564['user']||0x0);var _0x515893=_0x23d564[_0xf535('0x25')]||0x0;if(_0x277d3a>_0x4f2554[_0xf535('0x24')])return _0x38ef0e('License\x20limit\x20reached\x20for\x20users');if(_0x515893>_0x4f2554[_0xf535('0x25')])return _0x38ef0e(_0xf535('0x2a'));return _0x57debb();})[_0xf535('0x27')](function(_0x57241e){_0x38ef0e(_0x57241e);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x68e7=['License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','demo','gray','deadline','add','days','grayReason','machineUuid','changed','disabled','message','User','findAll','role','COUNT','sequelize','count','admin','telephones','forEach','user','pick','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','defaults','then','catch','uuid','data1','license'];(function(_0x9a3f78,_0x304a61){var _0x2933a5=function(_0x41501b){while(--_0x41501b){_0x9a3f78['push'](_0x9a3f78['shift']());}};_0x2933a5(++_0x304a61);}(_0x68e7,0x133));var _0x768e=function(_0x34f9f0,_0xa63711){_0x34f9f0=_0x34f9f0-0x0;var _0x52bcd1=_0x68e7[_0x34f9f0];return _0x52bcd1;};'use strict';var util=require(_0x768e('0x0'));var _=require(_0x768e('0x1'));var moment=require(_0x768e('0x2'));var BPromise=require(_0x768e('0x3'));var hardware=require(_0x768e('0x4'));var encryptor=require('../../components/encryptor');var db=require(_0x768e('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x768e('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x768e('0x7'),'machineUuid':hardware[_0x768e('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x768e('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x768e('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4275bf){return new BPromise(function(_0x15faae,_0x45ead4){return db['License']['find'](_[_0x768e('0x9')](_0x4275bf,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x563452){return checkLicense(_0x563452,null);})[_0x768e('0xa')](function(_0x525060){_0x15faae(_0x525060);return;})[_0x768e('0xb')](function(_0x53e6e5){_0x45ead4(_0x53e6e5);});});}function checkLicense(_0x306bfe,_0x4a5940){if(!_0x306bfe){demoLicense[_0x768e('0xc')]=_0x306bfe[_0x768e('0xd')];return demoLicense;}try{var _0x54cef9=_0x4a5940||_0x306bfe[_0x768e('0xe')];if(_['isEmpty'](_0x54cef9)){throw new Error(_0x768e('0xf'));}var _0x165ed8=_0x306bfe[_0x768e('0xd')];var _0x2f3148=_0x306bfe[_0x768e('0x10')];var _0x2b2320=_0x165ed8[_0x768e('0x11')]('-')[0x4];var _0xe3a8f5=_0x165ed8[_0x768e('0x11')]('-')[0x0];var _0x487ae3=encryptor[_0x768e('0x12')](_0x54cef9,util[_0x768e('0x13')](_0x768e('0x14'),_0x2b2320,_0x165ed8,_0xe3a8f5));var _0x75db08=JSON['parse'](_0x487ae3);_0x75db08[_0x768e('0x15')]=![];_0x75db08[_0x768e('0xc')]=_0x165ed8;_0x75db08['machineUuid']=hardware[_0x768e('0x8')]();if(_0x2f3148){var _0x133b90=encryptor[_0x768e('0x12')](_0x2f3148);_0x75db08[_0x768e('0x16')]=_0x133b90;_0x75db08[_0x768e('0x17')]=moment(_0x133b90)[_0x768e('0x18')](0x7,_0x768e('0x19'))[_0x768e('0x13')]();_0x75db08[_0x768e('0x1a')]=_0x75db08[_0x768e('0xc')]!=_0x75db08[_0x768e('0x1b')]?_0x768e('0x1c'):_0x768e('0x1d');}return _0x75db08;}catch(_0x2f293a){breakingLicense[_0x768e('0xc')]=_0x306bfe[_0x768e('0xd')];breakingLicense[_0x768e('0x1e')]=_0x2f293a[_0x768e('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x39ef27,_0x902134){getLicense()[_0x768e('0xa')](function(_0x111e35){return db[_0x768e('0x1f')][_0x768e('0x20')]({'attributes':[_0x768e('0x21'),[db['sequelize']['fn'](_0x768e('0x22'),db[_0x768e('0x23')]['col'](_0x768e('0x21'))),_0x768e('0x24')]],'group':_0x768e('0x21'),'where':{'role':{'$or':[_0x768e('0x25'),'user','telephone']}},'raw':!![]})[_0x768e('0xa')](function(_0x2b310a){var _0x5a2cc4={'user':_0x111e35['users']||0x0,'telephone':_0x111e35[_0x768e('0x26')]||0x0};_0x2b310a[_0x768e('0x27')](function(_0xe38ba6){var _0x1003a7=_0xe38ba6[_0x768e('0x21')]===_0x768e('0x25')?_0x768e('0x28'):_0xe38ba6[_0x768e('0x21')];_0x5a2cc4[_0x1003a7]-=_0xe38ba6['count'];if(_0x5a2cc4[_0x1003a7]<0x0)_0x5a2cc4[_0x1003a7]=0x0;});_0x39ef27(_0x5a2cc4);return;});})[_0x768e('0xb')](function(_0x5d78cb){_0x902134(_0x5d78cb);});});}function checkUserLimits(_0x2daa65){return new BPromise(function(_0x341060,_0x15433b){getLimits()['then'](function(_0xda46fc){var _0x2d961c=_[_0x768e('0x29')](_['countBy'](_0x2daa65,_0x768e('0x21')),[_0x768e('0x25'),_0x768e('0x28'),_0x768e('0x2a')]);var _0x10b0a8=(_0x2d961c[_0x768e('0x25')]||0x0)+(_0x2d961c[_0x768e('0x28')]||0x0);var _0x3c2ee2=_0x2d961c[_0x768e('0x2a')]||0x0;if(_0x10b0a8>_0xda46fc[_0x768e('0x28')])return _0x15433b(_0x768e('0x2b'));if(_0x3c2ee2>_0xda46fc[_0x768e('0x2a')])return _0x15433b(_0x768e('0x2c'));return _0x341060();})['catch'](function(_0x5cc970){_0x15433b(_0x5cc970);});});}module[_0x768e('0x2d')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index a670f4f..cf0e773 100644 --- a/server/config/local.env.js +++ b/server/config/local.env.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a85=['secret','myappanuglar-secret','app-id'];(function(_0x1e2ff9,_0x208714){var _0xeb1624=function(_0x226ccc){while(--_0x226ccc){_0x1e2ff9['push'](_0x1e2ff9['shift']());}};_0xeb1624(++_0x208714);}(_0x1a85,0x178));var _0x51a8=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x1a85[_0x346737];return _0x1ade2e;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x51a8('0x0'),'GOOGLE_ID':_0x51a8('0x1'),'GOOGLE_SECRET':_0x51a8('0x2'),'DEBUG':''}; \ No newline at end of file +var _0xbbbc=['secret','exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x1138d0,_0x12be34){var _0xdc7d1e=function(_0x4fa9a8){while(--_0x4fa9a8){_0x1138d0['push'](_0x1138d0['shift']());}};_0xdc7d1e(++_0x12be34);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x1a00b8,_0x5b1016){_0x1a00b8=_0x1a00b8-0x0;var _0x3a8fd9=_0xbbbc[_0x1a00b8];return _0x3a8fd9;};'use strict';module[_0xcbbb('0x0')]={'DOMAIN':_0xcbbb('0x1'),'SESSION_SECRET':_0xcbbb('0x2'),'GOOGLE_ID':_0xcbbb('0x3'),'GOOGLE_SECRET':_0xcbbb('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 9b54c0f..ed9538c 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b0f=['Logger','transports','File','error','%s-%s','info','Console','env','path','join','/var','log','xcally','message','}}}','replace','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b0f,0x168));var _0xf6b0=function(_0x265f97,_0x2be832){_0x265f97=_0x265f97-0x0;var _0x240e95=_0x6b0f[_0x265f97];return _0x240e95;};'use strict';var moment=require('moment');var winston=require('winston');var util=require('util');var path=require(_0xf6b0('0x0'));var debugLevel='INFO';function filename(_0x314983,_0xcd91f1){return path[_0xf6b0('0x1')](_0xf6b0('0x2'),_0xf6b0('0x3'),_0xf6b0('0x4'),util['format']('%s-%s.log',_0x314983,_0xcd91f1));}function formatter(_0x34b023,_0x314921){_0x314921[_0xf6b0('0x5')]=_0x314921[_0xf6b0('0x5')]['replace'](/@@{/g,'{{{')['replace'](/}@@/g,_0xf6b0('0x6'))[_0xf6b0('0x7')](/@{/g,'{{')[_0xf6b0('0x7')](/}@/g,'}}');return util[_0xf6b0('0x8')](_0xf6b0('0x9'),moment()[_0xf6b0('0x8')](_0xf6b0('0xa')),_0x314921[_0xf6b0('0xb')][_0xf6b0('0xc')](),_0x34b023,_0x314921[_0xf6b0('0x5')]);}module[_0xf6b0('0xd')]=function(_0x40683e){return new winston[(_0xf6b0('0xe'))]({'transports':[new winston[(_0xf6b0('0xf'))][(_0xf6b0('0x10'))]({'name':util[_0xf6b0('0x8')]('%s-%s',_0x40683e,_0xf6b0('0x11')),'filename':filename(_0x40683e,_0xf6b0('0x11')),'level':_0xf6b0('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x305365){return formatter(_0x40683e,_0x305365);}}),new winston[(_0xf6b0('0xf'))][(_0xf6b0('0x10'))]({'name':util[_0xf6b0('0x8')](_0xf6b0('0x12'),_0x40683e,_0xf6b0('0x13')),'filename':filename(_0x40683e,_0xf6b0('0x13')),'level':_0xf6b0('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5905d8){return formatter(_0x40683e,_0x5905d8);}}),new winston['transports'][(_0xf6b0('0x14'))]({'level':process[_0xf6b0('0x15')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x2e6dec){return formatter(_0x40683e,_0x2e6dec);}})]});}; \ No newline at end of file +var _0xdf9a=['error','info','Console','env','moment','util','path','INFO','join','/var','log','xcally','format','%s-%s.log','message','replace','{{{','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','Logger','transports','File','%s-%s'];(function(_0x37c6a9,_0x5cf326){var _0x8e787b=function(_0x329668){while(--_0x329668){_0x37c6a9['push'](_0x37c6a9['shift']());}};_0x8e787b(++_0x5cf326);}(_0xdf9a,0x1c6));var _0xadf9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdf9a[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xadf9('0x0'));var winston=require('winston');var util=require(_0xadf9('0x1'));var path=require(_0xadf9('0x2'));var debugLevel=_0xadf9('0x3');function filename(_0x299370,_0x19aeab){return path[_0xadf9('0x4')](_0xadf9('0x5'),_0xadf9('0x6'),_0xadf9('0x7'),util[_0xadf9('0x8')](_0xadf9('0x9'),_0x299370,_0x19aeab));}function formatter(_0x46e27b,_0xe7f882){_0xe7f882[_0xadf9('0xa')]=_0xe7f882[_0xadf9('0xa')][_0xadf9('0xb')](/@@{/g,_0xadf9('0xc'))['replace'](/}@@/g,'}}}')['replace'](/@{/g,'{{')[_0xadf9('0xb')](/}@/g,'}}');return util[_0xadf9('0x8')](_0xadf9('0xd'),moment()[_0xadf9('0x8')](_0xadf9('0xe')),_0xe7f882[_0xadf9('0xf')][_0xadf9('0x10')](),_0x46e27b,_0xe7f882[_0xadf9('0xa')]);}module['exports']=function(_0x399eca){return new winston[(_0xadf9('0x11'))]({'transports':[new winston[(_0xadf9('0x12'))][(_0xadf9('0x13'))]({'name':util[_0xadf9('0x8')](_0xadf9('0x14'),_0x399eca,_0xadf9('0x15')),'filename':filename(_0x399eca,_0xadf9('0x15')),'level':_0xadf9('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x229655){return formatter(_0x399eca,_0x229655);}}),new winston['transports']['File']({'name':util[_0xadf9('0x8')](_0xadf9('0x14'),_0x399eca,_0xadf9('0x16')),'filename':filename(_0x399eca,'info'),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4eba0e){return formatter(_0x399eca,_0x4eba0e);}}),new winston[(_0xadf9('0x12'))][(_0xadf9('0x17'))]({'level':process[_0xadf9('0x18')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x2bafb7){return formatter(_0x399eca,_0x2bafb7);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 225b9d6..d5bb4a7 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 _0x1802=['exports','join','../../services/express/index.js','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','../../services/xdr/index.js'];(function(_0x2724e5,_0x229d74){var _0x4b6621=function(_0x787046){while(--_0x787046){_0x2724e5['push'](_0x2724e5['shift']());}};_0x4b6621(++_0x229d74);}(_0x1802,0x64));var _0x2180=function(_0x53de30,_0x4e7e85){_0x53de30=_0x53de30-0x0;var _0x29e2b1=_0x1802[_0x53de30];return _0x29e2b1;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':'express','script':path[_0x2180('0x0')](__dirname,_0x2180('0x1'))},{'name':'ami','script':path[_0x2180('0x0')](__dirname,'../../services/ami/index.js')},{'name':'agi','script':path[_0x2180('0x0')](__dirname,_0x2180('0x2'))},{'name':_0x2180('0x3'),'script':path['join'](__dirname,_0x2180('0x4'))},{'name':_0x2180('0x5'),'script':path[_0x2180('0x0')](__dirname,_0x2180('0x6'))},{'name':'xdr','script':path[_0x2180('0x0')](__dirname,_0x2180('0x7'))}]};module[_0x2180('0x8')]=config; \ No newline at end of file +var _0x129b=['xdr','../../services/xdr/index.js','exports','../../services/express/index.js','join','agi','../../services/agi/index.js','email','routing','../../services/routing/index.js'];(function(_0x4affb8,_0x57b5a0){var _0x36fc44=function(_0x41b48e){while(--_0x41b48e){_0x4affb8['push'](_0x4affb8['shift']());}};_0x36fc44(++_0x57b5a0);}(_0x129b,0x14d));var _0xb129=function(_0x580971,_0x10984d){_0x580971=_0x580971-0x0;var _0x16d873=_0x129b[_0x580971];return _0x16d873;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':'express','script':path['join'](__dirname,_0xb129('0x0'))},{'name':'ami','script':path[_0xb129('0x1')](__dirname,'../../services/ami/index.js')},{'name':_0xb129('0x2'),'script':path[_0xb129('0x1')](__dirname,_0xb129('0x3'))},{'name':_0xb129('0x4'),'script':path[_0xb129('0x1')](__dirname,'../../services/email/index.js')},{'name':_0xb129('0x5'),'script':path[_0xb129('0x1')](__dirname,_0xb129('0x6'))},{'name':_0xb129('0x7'),'script':path[_0xb129('0x1')](__dirname,_0xb129('0x8'))}]};module[_0xb129('0x9')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 32e679f..5fb2576 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 _0x85b9=['then','start','stop','disconnect','list','describe','delete','saved','bluebird','./config','connected'];(function(_0x1acb0f,_0x53350d){var _0xb6892b=function(_0xbb69b8){while(--_0xbb69b8){_0x1acb0f['push'](_0x1acb0f['shift']());}};_0xb6892b(++_0x53350d);}(_0x85b9,0xb8));var _0x985b=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0x85b9[_0x1477ef];return _0x164acd;};'use strict';var pm2=require('pm2');var BPromise=require(_0x985b('0x0'));var config=require(_0x985b('0x1'));function connect(){return new BPromise(function(_0x37faad,_0x476450){return pm2['connect'](function(_0x568133){if(_0x568133){return _0x476450(_0x568133);}return _0x37faad(_0x985b('0x2'));});});};exports['start']=function(_0x48960a){return connect()[_0x985b('0x3')](function(){return new BPromise(function(_0x1d7d95,_0x28fbcb){return pm2[_0x985b('0x4')](_0x48960a,function(_0x34a465,_0x49d0c5){if(_0x34a465){return _0x28fbcb(_0x34a465);}pm2['disconnect']();return _0x1d7d95(_0x49d0c5);});});});};exports['stop']=function(_0x17e075){return connect()[_0x985b('0x3')](function(){return new BPromise(function(_0x5c9ab4,_0x33b085){return pm2[_0x985b('0x5')](_0x17e075,function(_0x49f715,_0x2cb03c){if(_0x49f715){return _0x33b085(_0x49f715);}pm2[_0x985b('0x6')]();return _0x5c9ab4(_0x2cb03c);});});});};exports['restart']=function(_0x338630){return connect()[_0x985b('0x3')](function(){return new BPromise(function(_0x55bd1b,_0x56770b){return pm2['restart'](_0x338630,function(_0x409253,_0x16c26b){if(_0x409253){return _0x56770b(_0x409253);}pm2['disconnect']();return _0x55bd1b(_0x16c26b);});});});};exports[_0x985b('0x7')]=function(){return connect()[_0x985b('0x3')](function(){return new BPromise(function(_0x52a3f2,_0x189c52){return pm2['list'](function(_0x4fcd0f,_0x4b6261){if(_0x4fcd0f){return _0x189c52(_0x4fcd0f);}pm2[_0x985b('0x6')]();return _0x52a3f2(_0x4b6261);});});});};exports[_0x985b('0x8')]=function(_0x59cb37){return connect()[_0x985b('0x3')](function(){return new BPromise(function(_0x2d89bc,_0x36491a){return pm2[_0x985b('0x8')](_0x59cb37,function(_0x5244ec,_0x2cd88b){if(_0x5244ec){return _0x36491a(_0x5244ec);}pm2[_0x985b('0x6')]();return _0x2d89bc(_0x2cd88b);});});});};exports[_0x985b('0x9')]=function(_0x4bb2ea){return connect()['then'](function(){return new BPromise(function(_0x43aca9,_0x2df537){return pm2['delete'](_0x4bb2ea,function(_0x393ab0,_0xb91eb4){if(_0x393ab0){return _0x2df537(_0x393ab0);}pm2['disconnect']();return _0x43aca9(_0xb91eb4);});});});};exports['dump']=function(){return connect()[_0x985b('0x3')](function(){return new BPromise(function(_0x50fc46,_0x3f79be){return pm2['dump'](function(_0x325637){if(_0x325637){return _0x3f79be(_0x325637);}return _0x50fc46(_0x985b('0xa'));});});});}; \ No newline at end of file +var _0xcd84=['saved','pm2','./config','connect','start','then','disconnect','stop','restart','list','describe','delete','dump'];(function(_0x47f6b2,_0x5c8dc6){var _0x33aeb5=function(_0x46d3df){while(--_0x46d3df){_0x47f6b2['push'](_0x47f6b2['shift']());}};_0x33aeb5(++_0x5c8dc6);}(_0xcd84,0x187));var _0x4cd8=function(_0x53d6f4,_0x3e3c72){_0x53d6f4=_0x53d6f4-0x0;var _0x20322c=_0xcd84[_0x53d6f4];return _0x20322c;};'use strict';var pm2=require(_0x4cd8('0x0'));var BPromise=require('bluebird');var config=require(_0x4cd8('0x1'));function connect(){return new BPromise(function(_0x224bb7,_0x26cf19){return pm2[_0x4cd8('0x2')](function(_0x5c2b88){if(_0x5c2b88){return _0x26cf19(_0x5c2b88);}return _0x224bb7('connected');});});};exports[_0x4cd8('0x3')]=function(_0x462293){return connect()[_0x4cd8('0x4')](function(){return new BPromise(function(_0x290aca,_0x87cad0){return pm2[_0x4cd8('0x3')](_0x462293,function(_0x244e8b,_0x3c2bb6){if(_0x244e8b){return _0x87cad0(_0x244e8b);}pm2[_0x4cd8('0x5')]();return _0x290aca(_0x3c2bb6);});});});};exports[_0x4cd8('0x6')]=function(_0x29eb41){return connect()[_0x4cd8('0x4')](function(){return new BPromise(function(_0x3d4014,_0x55ade3){return pm2[_0x4cd8('0x6')](_0x29eb41,function(_0xa4bc2a,_0x7f21eb){if(_0xa4bc2a){return _0x55ade3(_0xa4bc2a);}pm2[_0x4cd8('0x5')]();return _0x3d4014(_0x7f21eb);});});});};exports[_0x4cd8('0x7')]=function(_0x2742f1){return connect()[_0x4cd8('0x4')](function(){return new BPromise(function(_0x452b69,_0x15aa9c){return pm2[_0x4cd8('0x7')](_0x2742f1,function(_0x175bd4,_0x4e3488){if(_0x175bd4){return _0x15aa9c(_0x175bd4);}pm2[_0x4cd8('0x5')]();return _0x452b69(_0x4e3488);});});});};exports[_0x4cd8('0x8')]=function(){return connect()[_0x4cd8('0x4')](function(){return new BPromise(function(_0xeeefa5,_0x28059e){return pm2[_0x4cd8('0x8')](function(_0x802b84,_0x467ad9){if(_0x802b84){return _0x28059e(_0x802b84);}pm2[_0x4cd8('0x5')]();return _0xeeefa5(_0x467ad9);});});});};exports[_0x4cd8('0x9')]=function(_0x48caeb){return connect()[_0x4cd8('0x4')](function(){return new BPromise(function(_0x483e9a,_0xf0bbf7){return pm2[_0x4cd8('0x9')](_0x48caeb,function(_0x540881,_0x2ea46e){if(_0x540881){return _0xf0bbf7(_0x540881);}pm2[_0x4cd8('0x5')]();return _0x483e9a(_0x2ea46e);});});});};exports[_0x4cd8('0xa')]=function(_0xe98141){return connect()[_0x4cd8('0x4')](function(){return new BPromise(function(_0x273ead,_0x4d26ab){return pm2[_0x4cd8('0xa')](_0xe98141,function(_0x3e7da9,_0x653501){if(_0x3e7da9){return _0x4d26ab(_0x3e7da9);}pm2[_0x4cd8('0x5')]();return _0x273ead(_0x653501);});});});};exports[_0x4cd8('0xb')]=function(){return connect()[_0x4cd8('0x4')](function(){return new BPromise(function(_0x6c56ed,_0x4e0f9b){return pm2[_0x4cd8('0xb')](function(_0x41322c){if(_0x41322c){return _0x4e0f9b(_0x41322c);}return _0x6c56ed(_0x4cd8('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 191e03e..d15a213 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 _0x8a06=['subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','system','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt'];(function(_0x3a488e,_0x39b229){var _0x5de53d=function(_0x56a9a9){while(--_0x56a9a9){_0x3a488e['push'](_0x3a488e['shift']());}};_0x5de53d(++_0x39b229);}(_0x8a06,0xc7));var _0x68a0=function(_0xc8a11,_0x347a33){_0xc8a11=_0xc8a11-0x0;var _0x55a500=_0x8a06[_0xc8a11];return _0x55a500;};'use strict';var _=require(_0x68a0('0x0'));var moment=require(_0x68a0('0x1'));var Redis=require(_0x68a0('0x2'));var util=require(_0x68a0('0x3'));var config=require(_0x68a0('0x4'));var db=require(_0x68a0('0x5'))['db'];var logger=require(_0x68a0('0x6'))(_0x68a0('0x7'));config[_0x68a0('0x8')]=_['defaults'](config[_0x68a0('0x8')],{'host':_0x68a0('0x9'),'port':0x18eb});var io=require(_0x68a0('0xa'))(new Redis(config[_0x68a0('0x8')]));function closeInteractions(){var _0x4916fc=0x0;var _0x297c1e=[];return db[_0x68a0('0xb')][_0x68a0('0xc')]({'raw':!![],'attributes':['id',_0x68a0('0xd')],'where':{'id':0x1}})[_0x68a0('0xe')](function(_0x3eec7a){_0x4916fc=_0x3eec7a[_0x68a0('0xd')];if(_0x4916fc){return db[_0x68a0('0xf')][_0x68a0('0x10')]({'raw':!![],'attributes':['id',_0x68a0('0x11')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x68a0('0x12')](_0x3eec7a[_0x68a0('0xd')],_0x68a0('0x13'))}}});}else{return[];}})[_0x68a0('0xe')](function(_0x1e155){if(_0x1e155&&_0x1e155[_0x68a0('0x14')]){_0x297c1e=_[_0x68a0('0x15')](_0x1e155||[],'id');logger[_0x68a0('0x16')](_0x68a0('0x17'),_0x297c1e[_0x68a0('0x18')]());return db[_0x68a0('0xf')]['update']({'closeReason':_0x68a0('0x19'),'disposition':'timeout','closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x297c1e}});}})[_0x68a0('0xe')](function(){if(_0x297c1e&&_0x297c1e[_0x68a0('0x14')]){logger['info']('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x297c1e['join']());for(var _0x58622b=0x0;_0x58622b<_0x297c1e[_0x68a0('0x14')];_0x58622b++){io[_0x68a0('0x1a')](_0x68a0('0x1b'),{'id':_0x297c1e[_0x58622b],'closed':!![]});}}})[_0x68a0('0x1c')](function(_0x3ca56c){logger[_0x68a0('0x1d')](_0x68a0('0x1e'),_0x3ca56c?util['inspect'](_0x3ca56c,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x3c59=['lodash','moment','ioredis','util','../../config/environment','../logger','schedule','redis','defaults','localhost','find','then','chatTimeout','ChatInteraction','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect'];(function(_0x2c3530,_0x591054){var _0x537a16=function(_0xabde4d){while(--_0xabde4d){_0x2c3530['push'](_0x2c3530['shift']());}};_0x537a16(++_0x591054);}(_0x3c59,0xe7));var _0x93c5=function(_0x1d5d6a,_0x1ec6b4){_0x1d5d6a=_0x1d5d6a-0x0;var _0x1c2058=_0x3c59[_0x1d5d6a];return _0x1c2058;};'use strict';var _=require(_0x93c5('0x0'));var moment=require(_0x93c5('0x1'));var Redis=require(_0x93c5('0x2'));var util=require(_0x93c5('0x3'));var config=require(_0x93c5('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x93c5('0x5'))(_0x93c5('0x6'));config[_0x93c5('0x7')]=_[_0x93c5('0x8')](config['redis'],{'host':_0x93c5('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x93c5('0x7')]));function closeInteractions(){var _0x24789d=0x0;var _0x3d392e=[];return db['Setting'][_0x93c5('0xa')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x93c5('0xb')](function(_0x1a0bd8){_0x24789d=_0x1a0bd8[_0x93c5('0xc')];if(_0x24789d){return db[_0x93c5('0xd')]['findAll']({'raw':!![],'attributes':['id',_0x93c5('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x93c5('0xf')](_0x1a0bd8[_0x93c5('0xc')],_0x93c5('0x10'))}}});}else{return[];}})[_0x93c5('0xb')](function(_0x284fc1){if(_0x284fc1&&_0x284fc1[_0x93c5('0x11')]){_0x3d392e=_[_0x93c5('0x12')](_0x284fc1||[],'id');logger[_0x93c5('0x13')](_0x93c5('0x14'),_0x3d392e[_0x93c5('0x15')]());return db[_0x93c5('0xd')][_0x93c5('0x16')]({'closeReason':'system','disposition':_0x93c5('0x17'),'closed':!![],'closedAt':moment()[_0x93c5('0x18')](_0x93c5('0x19'))},{'where':{'id':_0x3d392e}});}})['then'](function(){if(_0x3d392e&&_0x3d392e[_0x93c5('0x11')]){logger[_0x93c5('0x13')](_0x93c5('0x1a'),_0x3d392e['join']());for(var _0x2498e2=0x0;_0x2498e2<_0x3d392e[_0x93c5('0x11')];_0x2498e2++){io[_0x93c5('0x1b')](_0x93c5('0x1c'),{'id':_0x3d392e[_0x2498e2],'closed':!![]});}}})[_0x93c5('0x1d')](function(_0x31d54d){logger[_0x93c5('0x1e')](_0x93c5('0x1f'),_0x31d54d?util[_0x93c5('0x20')](_0x31d54d,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index ffbb069..97810fc 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 _0x5ce0=['exports','startAllRefreshIntervals'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x5ce0,0x121));var _0x05ce=function(_0x2af053,_0x4f6d28){_0x2af053=_0x2af053-0x0;var _0x4b4001=_0x5ce0[_0x2af053];return _0x4b4001;};'use strict';function start(){var _0x9d3a88=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x9d3a88[_0x05ce('0x0')]();}module[_0x05ce('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xd3c3=['../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x25b022,_0x394a08){var _0x2e13a5=function(_0xe9495d){while(--_0xe9495d){_0x25b022['push'](_0x25b022['shift']());}};_0x2e13a5(++_0x394a08);}(_0xd3c3,0xcb));var _0x3d3c=function(_0x3ef38a,_0x5dfce2){_0x3ef38a=_0x3ef38a-0x0;var _0xec601a=_0xd3c3[_0x3ef38a];return _0xec601a;};'use strict';function start(){var _0xf68fd6=require(_0x3d3c('0x0'));return _0xf68fd6['startAllRefreshIntervals']();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 8536a90..973d069 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 _0xe12a=['intersection','length','exists','stop','deleteJob','delete\x20cron','my\x20id','resolve','run\x20job','active','startAt','endAt','cron','start','add\x20cron','stop\x20cron','isBetween','update\x20cron','run','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','%s.%s','basename','savename','extname','zip','existsSync','status','Sent','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','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','SendMail','error\x20mail','email\x20sent','catch','error','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','map','toString','difference'];(function(_0x15d5a4,_0x5e27af){var _0x388b48=function(_0x3c39cd){while(--_0x3c39cd){_0x15d5a4['push'](_0x15d5a4['shift']());}};_0x388b48(++_0x5e27af);}(_0xe12a,0x187));var _0xae12=function(_0x20d39a,_0x2ab24b){_0x20d39a=_0x20d39a-0x0;var _0x48bffb=_0xe12a[_0x20d39a];return _0x48bffb;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xae12('0x0'));var _=require(_0xae12('0x1'));var moment=require(_0xae12('0x2'));var CronJobManager=require(_0xae12('0x3'));var jayson=require(_0xae12('0x4'));var BPromise=require(_0xae12('0x5'));var logger=require('../logger')(_0xae12('0x6'));var db=require(_0xae12('0x7'))['db'];var analyticCustomReportController=require(_0xae12('0x8'));var analyticDefaultReportController=require(_0xae12('0x9'));var client=jayson['client'][_0xae12('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x19810e,_0x579690){return function(){logger[_0xae12('0xb')](_0xae12('0xc'),_0x19810e[_0xae12('0xd')]);var _0x226c9a=!![];var _0x5393e8={'tls':{'rejectUnauthorized':![]}};if(_0x19810e[_0xae12('0xe')][_0xae12('0xf')]['service']){_0x5393e8['service']=_0x19810e[_0xae12('0xe')][_0xae12('0xf')][_0xae12('0x10')];}else{_0x5393e8['host']=_0x19810e[_0xae12('0xe')]['Smtp'][_0xae12('0x11')];_0x5393e8[_0xae12('0x12')]=_0x19810e[_0xae12('0xe')][_0xae12('0xf')]['port'];_0x5393e8['secure']=_0x19810e[_0xae12('0xe')][_0xae12('0xf')]['secure'];}if(_0x19810e['MailAccount'][_0xae12('0xf')][_0xae12('0x13')]){_0x5393e8[_0xae12('0x14')]={'user':_0x19810e[_0xae12('0xe')][_0xae12('0xf')][_0xae12('0x15')],'pass':_0x19810e[_0xae12('0xe')][_0xae12('0xf')][_0xae12('0x16')]};}var _0x2ea3d2={'account':_0x5393e8,'message':{'from':util[_0xae12('0x17')](_0xae12('0x18'),_0x19810e[_0xae12('0xe')][_0xae12('0x19')],_0x19810e[_0xae12('0xe')]['email']||_0x19810e[_0xae12('0xe')][_0xae12('0xf')][_0xae12('0x15')]),'to':_0x19810e[_0xae12('0xd')],'cc':_0x19810e['cc'],'bcc':_0x19810e[_0xae12('0x1a')],'subject':util[_0xae12('0x17')](_0xae12('0x1b'),_0x579690['name'],_0x19810e[_0xae12('0x1c')],_0x19810e['subtractUnit'])}};var _0x1f4636=path[_0xae12('0x1d')](__dirname,_0xae12('0x1e'));var _0x4bfb86=_0x579690['savename'];var _0x4c7a39=util[_0xae12('0x17')](_0xae12('0x1f'),path[_0xae12('0x20')](_0x579690[_0xae12('0x21')],path[_0xae12('0x22')](_0x579690[_0xae12('0x21')])),_0xae12('0x23'));var _0x4813e2=path[_0xae12('0x1d')](_0x1f4636,_0x4bfb86);var _0x13c145=path['join'](_0x1f4636,_0x4c7a39);if(fs[_0xae12('0x24')](_0x4813e2)){_0x579690[_0xae12('0x25')]=_0xae12('0x26');_0x2ea3d2[_0xae12('0x27')][_0xae12('0x28')]=[{'filename':_0x4bfb86,'path':_0x4813e2}];_0x2ea3d2[_0xae12('0x27')][_0xae12('0x29')]=util[_0xae12('0x17')](_0xae12('0x2a'),JSON[_0xae12('0x2b')](_0x579690,null,0x2));}else if(fs['existsSync'](_0x13c145)){_0x579690['status']=_0xae12('0x26');_0x2ea3d2['message'][_0xae12('0x28')]=[{'filename':_0x4c7a39,'path':_0x13c145}];}else{_0x2ea3d2[_0xae12('0x27')][_0xae12('0x29')]=_0xae12('0x2c');if(!_0x19810e[_0xae12('0x2d')]){_0x226c9a=![];logger['info'](_0xae12('0x2e'));}}if(_0x226c9a){return client['request'](_0xae12('0x2f'),_0x2ea3d2)['then'](function(_0x14fc29){if(_0x14fc29['error']){return logger['error'](_0xae12('0x30'),JSON['stringify'](_0x14fc29));}return logger['info'](_0xae12('0x31'));})[_0xae12('0x32')](function(_0x42a545){return logger[_0xae12('0x33')](_0xae12('0x30'),JSON[_0xae12('0x2b')](_0x42a545));});}};}function handleError(){return function(_0x13560b){return logger[_0xae12('0x33')](JSON[_0xae12('0x2b')](_0x13560b));};}function handleResult(_0x7199a7){return function(_0x4d04d7){logger['info'](_0xae12('0x34'),JSON[_0xae12('0x2b')](_0x4d04d7));if(_0x7199a7['MailAccount']&&_0x7199a7[_0xae12('0xe')][_0xae12('0xf')]&&!_[_0xae12('0x35')](_0x7199a7[_0xae12('0xd')])){setTimeout(handleSendEmail(_0x7199a7,_0x4d04d7),0x3c*0x3e8);}};}function handleJob(_0x2e63bb){return function(){try{if(_[_0xae12('0x35')](_0x2e63bb[_0xae12('0x1c')])){return logger['info'](_0xae12('0x36'));}if(_[_0xae12('0x35')](_0x2e63bb[_0xae12('0x37')])){return logger[_0xae12('0xb')]('subtractUnit\x20null\x20or\x20undefined');}var _0x5cc9fe={'startDate':moment()[_0xae12('0x38')](_0x2e63bb['subtractNumber'],_0x2e63bb['subtractUnit'])[_0xae12('0x17')](_0xae12('0x39')),'endDate':moment()[_0xae12('0x17')](_0xae12('0x39')),'type':_0xae12('0x3a'),'output':_0x2e63bb['output'],'name':_0x2e63bb['name']};if(!_[_0xae12('0x35')](_0x2e63bb[_0xae12('0x3b')])){logger[_0xae12('0xb')](_0xae12('0x3c'),_0x2e63bb[_0xae12('0x3b')]);return analyticDefaultReportController[_0xae12('0x3d')]({'id':_0x2e63bb[_0xae12('0x3b')]},_0x5cc9fe)[_0xae12('0x3e')](handleResult(_0x2e63bb))[_0xae12('0x32')](handleError());}if(!_[_0xae12('0x35')](_0x2e63bb['CustomReportId'])){logger[_0xae12('0xb')](_0xae12('0x3f'),_0x2e63bb[_0xae12('0x40')]);return analyticCustomReportController['runReport']({'id':_0x2e63bb[_0xae12('0x40')]},_0x5cc9fe)[_0xae12('0x3e')](handleResult(_0x2e63bb))['catch'](handleError());}}catch(_0x3847b4){logger['error'](JSON[_0xae12('0x2b')](_0x3847b4));}return logger[_0xae12('0xb')](_0xae12('0x41'));};}function getJobs(_0x435342){var _0x18bec5={};if(_0x435342){_0x18bec5['id']=_0x435342;}return db[_0xae12('0x42')][_0xae12('0x43')]({'where':_0x18bec5,'include':[{'model':db['MailAccount'],'attributes':['id',_0xae12('0x19'),_0xae12('0xd')],'include':[{'model':db[_0xae12('0x44')],'as':_0xae12('0xf')}]}]})['then'](function(_0x49a72f){var _0xfffe55=_[_0xae12('0x45')](manager[_0xae12('0x46')]);var _0x50c479=_[_0xae12('0x47')](_0x49a72f,function(_0x50eb5c){return _0x50eb5c['id'][_0xae12('0x48')]();});var _0x552976=_['keyBy'](_0x49a72f,function(_0x27bfab){return _0x27bfab['id']['toString']();});var _0x4a6ad3=_0x435342?_0x50c479:_[_0xae12('0x49')](_0x50c479,_0xfffe55);var _0x3e0322=_[_0xae12('0x4a')](_0x50c479,_0xfffe55);var _0x4b0cb4=_[_0xae12('0x49')](_0xfffe55,_0x50c479);var _0x239c08;var _0x248b32;for(_0x239c08=0x0;_0x239c08<_0x4b0cb4[_0xae12('0x4b')]&&!_0x435342;_0x239c08+=0x1){_0x248b32=_0x4b0cb4[_0x239c08][_0xae12('0x48')]();if(manager[_0xae12('0x4c')](_0x248b32)){manager[_0xae12('0x4d')](_0x248b32);manager[_0xae12('0x4e')](_0x248b32);logger[_0xae12('0xb')](_0xae12('0x4f'),_0x248b32);}}logger[_0xae12('0xb')]('toRun',JSON[_0xae12('0x2b')](_0x4a6ad3));for(_0x239c08=0x0;_0x239c08<_0x4a6ad3[_0xae12('0x4b')];_0x239c08+=0x1){_0x248b32=_0x4a6ad3[_0x239c08][_0xae12('0x48')]();logger['info']('index',_0x248b32);if(_0x435342){logger[_0xae12('0xb')](_0xae12('0x50'),_0x435342);logger['info'](JSON[_0xae12('0x2b')](_0x552976[_0x248b32]));BPromise[_0xae12('0x51')]()[_0xae12('0x3e')](handleJob(_0x552976[_0x248b32]));logger[_0xae12('0xb')](_0xae12('0x52'),_0x552976[_0x248b32][_0xae12('0x19')],_0x552976[_0x248b32]['cron']);}else if(_0x552976[_0x248b32]['cron']&&_0x552976[_0x248b32][_0xae12('0x53')]&&moment()['isBetween'](_0x552976[_0x248b32][_0xae12('0x54')],_0x552976[_0x248b32][_0xae12('0x55')])){manager['add'](_0x248b32,_0x552976[_0x248b32][_0xae12('0x56')],handleJob(_0x552976[_0x248b32]));manager[_0xae12('0x57')](_0x248b32);logger[_0xae12('0xb')](_0xae12('0x58'),_0x552976[_0x248b32][_0xae12('0x19')],_0x552976[_0x248b32]['cron']);}else if(manager[_0xae12('0x4c')](_0x248b32)){manager[_0xae12('0x4d')](_0x248b32);manager['deleteJob'](_0x248b32);logger['info'](_0xae12('0x59'),_0x552976[_0x248b32][_0xae12('0x19')],_0x552976[_0x248b32]['cron']);}}for(_0x239c08=0x0,_0x248b32;_0x239c08<_0x3e0322[_0xae12('0x4b')]&&!_0x435342;_0x239c08+=0x1){_0x248b32=_0x3e0322[_0x239c08][_0xae12('0x48')]();if(manager[_0xae12('0x4c')](_0x248b32)){if(_0x552976[_0x248b32][_0xae12('0x56')]&&_0x552976[_0x248b32][_0xae12('0x53')]&&moment()[_0xae12('0x5a')](_0x552976[_0x248b32][_0xae12('0x54')],_0x552976[_0x248b32][_0xae12('0x55')])){manager['update'](_0x248b32,_0x552976[_0x248b32][_0xae12('0x56')],handleJob(_0x552976[_0x248b32]));logger[_0xae12('0xb')](_0xae12('0x5b'),_0x552976[_0x248b32]['name'],_0x552976[_0x248b32][_0xae12('0x56')]);}else{manager[_0xae12('0x4d')](_0x248b32);manager[_0xae12('0x4e')](_0x248b32);logger[_0xae12('0xb')](_0xae12('0x59'),_0x552976[_0x248b32][_0xae12('0x19')],_0x552976[_0x248b32][_0xae12('0x56')]);}}}})['catch'](function(_0x51f8f1){logger[_0xae12('0x33')](JSON['stringify'](_0x51f8f1));});}exports[_0xae12('0x5c')]=function(_0x1a58d8){return getJobs(_0x1a58d8);};exports[_0xae12('0x57')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xc39e=['name','bcc','subtractNumber','subtractUnit','../../files/reports','%s.%s','basename','savename','extname','join','existsSync','status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','request','SendMail','then','error','error\x20mail','stringify','email\x20sent','catch','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','MailServerOut','jobs','map','toString','difference','intersection','length','exists','deleteJob','delete\x20cron','toRun','index','my\x20id','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','stop','stop\x20cron','update','update\x20cron','util','path','lodash','cron-job-manager','bluebird','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','format'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc39e,0xf6));var _0xec39=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0xc39e[_0x1d87fc];return _0x492b56;};'use strict';var fs=require('fs');var util=require(_0xec39('0x0'));var path=require(_0xec39('0x1'));var _=require(_0xec39('0x2'));var moment=require('moment');var CronJobManager=require(_0xec39('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0xec39('0x4'));var logger=require(_0xec39('0x5'))(_0xec39('0x6'));var db=require(_0xec39('0x7'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0xec39('0x8'));var client=jayson[_0xec39('0x9')][_0xec39('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xad851a,_0x1f35db){return function(){logger['info'](_0xec39('0xb'),_0xad851a[_0xec39('0xc')]);var _0x26f901=!![];var _0x12a8ee={'tls':{'rejectUnauthorized':![]}};if(_0xad851a[_0xec39('0xd')][_0xec39('0xe')][_0xec39('0xf')]){_0x12a8ee[_0xec39('0xf')]=_0xad851a[_0xec39('0xd')][_0xec39('0xe')][_0xec39('0xf')];}else{_0x12a8ee[_0xec39('0x10')]=_0xad851a[_0xec39('0xd')][_0xec39('0xe')][_0xec39('0x10')];_0x12a8ee[_0xec39('0x11')]=_0xad851a[_0xec39('0xd')][_0xec39('0xe')]['port'];_0x12a8ee[_0xec39('0x12')]=_0xad851a[_0xec39('0xd')][_0xec39('0xe')]['secure'];}if(_0xad851a[_0xec39('0xd')][_0xec39('0xe')][_0xec39('0x13')]){_0x12a8ee[_0xec39('0x14')]={'user':_0xad851a['MailAccount']['Smtp'][_0xec39('0x15')],'pass':_0xad851a[_0xec39('0xd')]['Smtp'][_0xec39('0x16')]};}var _0x554d39={'account':_0x12a8ee,'message':{'from':util[_0xec39('0x17')]('\x22%s\x22\x20<%s>',_0xad851a[_0xec39('0xd')][_0xec39('0x18')],_0xad851a['MailAccount'][_0xec39('0xc')]||_0xad851a[_0xec39('0xd')]['Smtp'][_0xec39('0x15')]),'to':_0xad851a['email'],'cc':_0xad851a['cc'],'bcc':_0xad851a[_0xec39('0x19')],'subject':util[_0xec39('0x17')]('Report\x20%s\x20last\x20%s\x20%s',_0x1f35db[_0xec39('0x18')],_0xad851a[_0xec39('0x1a')],_0xad851a[_0xec39('0x1b')])}};var _0x14a94a=path['join'](__dirname,_0xec39('0x1c'));var _0xeb8d9=_0x1f35db['savename'];var _0x4c6756=util['format'](_0xec39('0x1d'),path[_0xec39('0x1e')](_0x1f35db[_0xec39('0x1f')],path[_0xec39('0x20')](_0x1f35db[_0xec39('0x1f')])),'zip');var _0x4b5a7d=path[_0xec39('0x21')](_0x14a94a,_0xeb8d9);var _0x347f94=path['join'](_0x14a94a,_0x4c6756);if(fs[_0xec39('0x22')](_0x4b5a7d)){_0x1f35db[_0xec39('0x23')]=_0xec39('0x24');_0x554d39[_0xec39('0x25')]['attachments']=[{'filename':_0xeb8d9,'path':_0x4b5a7d}];_0x554d39[_0xec39('0x25')][_0xec39('0x26')]=util[_0xec39('0x17')](_0xec39('0x27'),JSON['stringify'](_0x1f35db,null,0x2));}else if(fs[_0xec39('0x22')](_0x347f94)){_0x1f35db[_0xec39('0x23')]=_0xec39('0x24');_0x554d39[_0xec39('0x25')][_0xec39('0x28')]=[{'filename':_0x4c6756,'path':_0x347f94}];}else{_0x554d39[_0xec39('0x25')][_0xec39('0x26')]=_0xec39('0x29');if(!_0xad851a[_0xec39('0x2a')]){_0x26f901=![];logger[_0xec39('0x2b')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x26f901){return client[_0xec39('0x2c')](_0xec39('0x2d'),_0x554d39)[_0xec39('0x2e')](function(_0x39a332){if(_0x39a332[_0xec39('0x2f')]){return logger['error'](_0xec39('0x30'),JSON[_0xec39('0x31')](_0x39a332));}return logger[_0xec39('0x2b')](_0xec39('0x32'));})[_0xec39('0x33')](function(_0x15e6ed){return logger[_0xec39('0x2f')](_0xec39('0x30'),JSON[_0xec39('0x31')](_0x15e6ed));});}};}function handleError(){return function(_0x242854){return logger[_0xec39('0x2f')](JSON[_0xec39('0x31')](_0x242854));};}function handleResult(_0x3d8ff0){return function(_0x251750){logger[_0xec39('0x2b')]('data',JSON[_0xec39('0x31')](_0x251750));if(_0x3d8ff0[_0xec39('0xd')]&&_0x3d8ff0[_0xec39('0xd')][_0xec39('0xe')]&&!_[_0xec39('0x34')](_0x3d8ff0[_0xec39('0xc')])){setTimeout(handleSendEmail(_0x3d8ff0,_0x251750),0x3c*0x3e8);}};}function handleJob(_0x3631db){return function(){try{if(_[_0xec39('0x34')](_0x3631db[_0xec39('0x1a')])){return logger[_0xec39('0x2b')](_0xec39('0x35'));}if(_[_0xec39('0x34')](_0x3631db[_0xec39('0x1b')])){return logger[_0xec39('0x2b')](_0xec39('0x36'));}var _0x2c8bfe={'startDate':moment()['subtract'](_0x3631db[_0xec39('0x1a')],_0x3631db['subtractUnit'])[_0xec39('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xec39('0x17')](_0xec39('0x37')),'type':_0xec39('0x38'),'output':_0x3631db[_0xec39('0x39')],'name':_0x3631db[_0xec39('0x18')]};if(!_[_0xec39('0x34')](_0x3631db[_0xec39('0x3a')])){logger[_0xec39('0x2b')]('exec\x20defaul\x20report\x20id:%s',_0x3631db[_0xec39('0x3a')]);return analyticDefaultReportController[_0xec39('0x3b')]({'id':_0x3631db[_0xec39('0x3a')]},_0x2c8bfe)['then'](handleResult(_0x3631db))[_0xec39('0x33')](handleError());}if(!_[_0xec39('0x34')](_0x3631db[_0xec39('0x3c')])){logger['info'](_0xec39('0x3d'),_0x3631db[_0xec39('0x3c')]);return analyticCustomReportController[_0xec39('0x3b')]({'id':_0x3631db[_0xec39('0x3c')]},_0x2c8bfe)[_0xec39('0x2e')](handleResult(_0x3631db))[_0xec39('0x33')](handleError());}}catch(_0x4b36de){logger[_0xec39('0x2f')](JSON[_0xec39('0x31')](_0x4b36de));}return logger[_0xec39('0x2b')](_0xec39('0x3e'));};}function getJobs(_0x405c7a){var _0x563f17={};if(_0x405c7a){_0x563f17['id']=_0x405c7a;}return db[_0xec39('0x3f')]['findAll']({'where':_0x563f17,'include':[{'model':db[_0xec39('0xd')],'attributes':['id',_0xec39('0x18'),'email'],'include':[{'model':db[_0xec39('0x40')],'as':_0xec39('0xe')}]}]})['then'](function(_0x3443bb){var _0x18fee6=_['keys'](manager[_0xec39('0x41')]);var _0x2a05ce=_[_0xec39('0x42')](_0x3443bb,function(_0x541d29){return _0x541d29['id'][_0xec39('0x43')]();});var _0x178adf=_['keyBy'](_0x3443bb,function(_0x41264f){return _0x41264f['id'][_0xec39('0x43')]();});var _0x2abb5e=_0x405c7a?_0x2a05ce:_[_0xec39('0x44')](_0x2a05ce,_0x18fee6);var _0x2d8416=_[_0xec39('0x45')](_0x2a05ce,_0x18fee6);var _0x53f6ca=_['difference'](_0x18fee6,_0x2a05ce);var _0x429d6e;var _0x16d5ec;for(_0x429d6e=0x0;_0x429d6e<_0x53f6ca[_0xec39('0x46')]&&!_0x405c7a;_0x429d6e+=0x1){_0x16d5ec=_0x53f6ca[_0x429d6e]['toString']();if(manager[_0xec39('0x47')](_0x16d5ec)){manager['stop'](_0x16d5ec);manager[_0xec39('0x48')](_0x16d5ec);logger[_0xec39('0x2b')](_0xec39('0x49'),_0x16d5ec);}}logger[_0xec39('0x2b')](_0xec39('0x4a'),JSON['stringify'](_0x2abb5e));for(_0x429d6e=0x0;_0x429d6e<_0x2abb5e[_0xec39('0x46')];_0x429d6e+=0x1){_0x16d5ec=_0x2abb5e[_0x429d6e][_0xec39('0x43')]();logger[_0xec39('0x2b')](_0xec39('0x4b'),_0x16d5ec);if(_0x405c7a){logger[_0xec39('0x2b')](_0xec39('0x4c'),_0x405c7a);logger['info'](JSON[_0xec39('0x31')](_0x178adf[_0x16d5ec]));BPromise['resolve']()['then'](handleJob(_0x178adf[_0x16d5ec]));logger[_0xec39('0x2b')](_0xec39('0x4d'),_0x178adf[_0x16d5ec][_0xec39('0x18')],_0x178adf[_0x16d5ec][_0xec39('0x4e')]);}else if(_0x178adf[_0x16d5ec][_0xec39('0x4e')]&&_0x178adf[_0x16d5ec][_0xec39('0x4f')]&&moment()[_0xec39('0x50')](_0x178adf[_0x16d5ec][_0xec39('0x51')],_0x178adf[_0x16d5ec][_0xec39('0x52')])){manager[_0xec39('0x53')](_0x16d5ec,_0x178adf[_0x16d5ec][_0xec39('0x4e')],handleJob(_0x178adf[_0x16d5ec]));manager[_0xec39('0x54')](_0x16d5ec);logger['info'](_0xec39('0x55'),_0x178adf[_0x16d5ec][_0xec39('0x18')],_0x178adf[_0x16d5ec][_0xec39('0x4e')]);}else if(manager['exists'](_0x16d5ec)){manager[_0xec39('0x56')](_0x16d5ec);manager['deleteJob'](_0x16d5ec);logger[_0xec39('0x2b')](_0xec39('0x57'),_0x178adf[_0x16d5ec][_0xec39('0x18')],_0x178adf[_0x16d5ec][_0xec39('0x4e')]);}}for(_0x429d6e=0x0,_0x16d5ec;_0x429d6e<_0x2d8416[_0xec39('0x46')]&&!_0x405c7a;_0x429d6e+=0x1){_0x16d5ec=_0x2d8416[_0x429d6e][_0xec39('0x43')]();if(manager['exists'](_0x16d5ec)){if(_0x178adf[_0x16d5ec]['cron']&&_0x178adf[_0x16d5ec][_0xec39('0x4f')]&&moment()[_0xec39('0x50')](_0x178adf[_0x16d5ec][_0xec39('0x51')],_0x178adf[_0x16d5ec][_0xec39('0x52')])){manager[_0xec39('0x58')](_0x16d5ec,_0x178adf[_0x16d5ec][_0xec39('0x4e')],handleJob(_0x178adf[_0x16d5ec]));logger[_0xec39('0x2b')](_0xec39('0x59'),_0x178adf[_0x16d5ec][_0xec39('0x18')],_0x178adf[_0x16d5ec]['cron']);}else{manager[_0xec39('0x56')](_0x16d5ec);manager['deleteJob'](_0x16d5ec);logger[_0xec39('0x2b')]('stop\x20cron',_0x178adf[_0x16d5ec][_0xec39('0x18')],_0x178adf[_0x16d5ec][_0xec39('0x4e')]);}}}})[_0xec39('0x33')](function(_0x2c3169){logger[_0xec39('0x2f')](JSON[_0xec39('0x31')](_0x2c3169));});}exports['run']=function(_0x83bfd8){return getJobs(_0x83bfd8);};exports[_0xec39('0x54')]=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 2bf6053..95b0db8 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 _0xc698=['aws-sdk','request-promise','util','bluebird','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info','format','transcribeName','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','sentimentAccountId','findOne','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Positive','SentimentScore','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Transcript\x20not\x20available','CloudProvider','Sentiment','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','transcribeAccountId','Transcribe\x20not\x20configured','Cloud\x20Provider\x20not\x20available','forEach','push','all','catch','lodash'];(function(_0x5a26d1,_0x1b1d20){var _0x460dd8=function(_0x3cdb0a){while(--_0x3cdb0a){_0x5a26d1['push'](_0x5a26d1['shift']());}};_0x460dd8(++_0x1b1d20);}(_0xc698,0x85));var _0x8c69=function(_0x152136,_0x4f14f1){_0x152136=_0x152136-0x0;var _0x20df44=_0xc698[_0x152136];return _0x20df44;};var _=require(_0x8c69('0x0'));var AWS=require(_0x8c69('0x1'));var rp=require(_0x8c69('0x2'));var util=require(_0x8c69('0x3'));var BPromise=require(_0x8c69('0x4'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x8c69('0x5'));function getTranscriptionJob(_0x55386c,_0x1b1dae,_0x4b29d1,_0x35259c){return new Promise(function(_0x5e8069,_0x5c0109){var _0x350620=new AWS[(_0x8c69('0x6'))]({'accessKeyId':_0x1b1dae,'secretAccessKey':_0x55386c,'region':_0x4b29d1});_0x350620[_0x8c69('0x7')]({'TranscriptionJobName':_0x35259c},function(_0x20a688,_0x34a8e8){if(_0x20a688){return _0x5c0109(_0x20a688);}else{return _0x5e8069(_0x34a8e8);}});});}function sentiment(_0x315ce0,_0x2921ee,_0x260354,_0x356fa0,_0x443da4){return new Promise(function(_0xf26d66,_0x4825fc){var _0x21df81=new AWS[(_0x8c69('0x8'))]({'accessKeyId':_0x2921ee,'secretAccessKey':_0x315ce0,'region':_0x260354});_0x21df81[_0x8c69('0x9')]({'Text':_0x356fa0,'LanguageCode':_0x443da4['substring'](0x0,0x2)},function(_0x5e4f68,_0x5e4d32){if(_0x5e4f68){return _0x4825fc(_0x5e4f68);}else{return _0xf26d66(_0x5e4d32);}});});}function checkTranscribeJob(_0xd95d06,_0x5886d3,_0x33e020){var _0x5bbd63;return new BPromise(function(_0x1ebe38,_0x56299e){logger[_0x8c69('0xa')](util[_0x8c69('0xb')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0xd95d06['id'],_0xd95d06[_0x8c69('0xc')]));return getTranscriptionJob(_0x33e020['data1'],_0x33e020[_0x8c69('0xd')],_0x5886d3[_0x8c69('0xe')],_0xd95d06[_0x8c69('0xc')])[_0x8c69('0xf')](function(_0x557918){logger[_0x8c69('0xa')](util[_0x8c69('0xb')](_0x8c69('0x10'),_0xd95d06['id'],_0xd95d06['transcribeName'],_0x557918[_0x8c69('0x11')][_0x8c69('0x12')]));if(!_0xd95d06[_0x8c69('0x13')]){switch(_0x557918[_0x8c69('0x11')]['TranscriptionJobStatus']){case _0x8c69('0x14'):var _0x3b0355={'transcribeStatus':_0x557918[_0x8c69('0x11')][_0x8c69('0x12')],'fileUri':_0x557918[_0x8c69('0x11')]['Transcript'][_0x8c69('0x15')]};logger['info'](util[_0x8c69('0xb')](_0x8c69('0x16'),_0xd95d06['id']));return rp({'uri':_0x557918[_0x8c69('0x11')][_0x8c69('0x17')][_0x8c69('0x15')],'json':!![]})['then'](function(_0x327ce4){logger[_0x8c69('0xa')](util[_0x8c69('0xb')](_0x8c69('0x18'),_0xd95d06['id']));if(_0x327ce4&&_0x327ce4[_0x8c69('0x19')]&&_0x327ce4[_0x8c69('0x19')]['transcripts']&&_0x327ce4[_0x8c69('0x19')][_0x8c69('0x1a')]['length']){_0x3b0355[_0x8c69('0x13')]='';for(var _0x2ee467=0x0;_0x2ee467<_0x327ce4[_0x8c69('0x19')]['transcripts']['length'];_0x2ee467++){_0x3b0355[_0x8c69('0x13')]+=_0x327ce4['results']['transcripts'][_0x2ee467]['transcript']+'';}}return _0xd95d06[_0x8c69('0x1b')](_0x3b0355);})[_0x8c69('0xf')](function(){logger[_0x8c69('0xa')](util[_0x8c69('0xb')](_0x8c69('0x1c'),_0xd95d06['id']));if(!_0xd95d06[_0x8c69('0x1d')]){throw new db[(_0x8c69('0x1e'))][(_0x8c69('0x1f'))](_0x8c69('0x20'));}if(!_0x5886d3[_0x8c69('0x21')]||!_0x5886d3['sentimentAccountId']||!_0x5886d3[_0x8c69('0x22')]||!_0x5886d3[_0x8c69('0x23')]||!_0x5886d3[_0x8c69('0x24')]){throw new db[(_0x8c69('0x1e'))]['ValidationError'](_0x8c69('0x25'));}if(!_0x3b0355[_0x8c69('0x13')]){throw new Error('Transcript\x20not\x20available');}if(_0x5886d3[_0x8c69('0x26')]===_0x33e020['id']){return _0x33e020;}else{return db['CloudProvider'][_0x8c69('0x27')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x8c69('0xf')](function(_0x485875){if(!_0x485875){throw new db['Sequelize'][(_0x8c69('0x1f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x485875[_0x8c69('0x28')]||!_0x485875[_0x8c69('0xd')]){throw new db['Sequelize'][(_0x8c69('0x1f'))](_0x8c69('0x29'));}_0x5bbd63=_0x485875;logger[_0x8c69('0xa')](util[_0x8c69('0xb')](_0x8c69('0x2a'),_0xd95d06['id']));return sentiment(_0x5bbd63[_0x8c69('0x28')],_0x5bbd63['data2'],_0x5886d3[_0x8c69('0x22')],_0x3b0355[_0x8c69('0x13')],_0x5886d3[_0x8c69('0x23')]);})[_0x8c69('0xf')](function(_0x4e8e4c){logger[_0x8c69('0xa')](util[_0x8c69('0xb')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0xd95d06['id']));return _0xd95d06['update']({'sentiment':_0x4e8e4c['Sentiment'],'sPositive':_0x4e8e4c['SentimentScore'][_0x8c69('0x2b')],'sNegative':_0x4e8e4c[_0x8c69('0x2c')]['Negative'],'sMixed':_0x4e8e4c['SentimentScore']['Mixed'],'sNeutral':_0x4e8e4c[_0x8c69('0x2c')][_0x8c69('0x2d')]});})['then'](function(){logger['info'](util[_0x8c69('0xb')](_0x8c69('0x1c'),_0xd95d06['id']));_0x1ebe38();});case _0x8c69('0x2e'):return _0xd95d06['update']({'transcribeStatus':_0x8c69('0x2e'),'failureReason':_0x557918[_0x8c69('0x11')][_0x8c69('0x2f')]})[_0x8c69('0xf')](function(){logger[_0x8c69('0xa')](util[_0x8c69('0xb')](_0x8c69('0x1c'),_0xd95d06['id']));_0x1ebe38();});default:logger['info'](util[_0x8c69('0xb')](_0x8c69('0x30'),_0xd95d06['id']));break;}}else{return BPromise['resolve']()[_0x8c69('0xf')](function(){if(!_0xd95d06[_0x8c69('0x1d')]){throw new db[(_0x8c69('0x1e'))][(_0x8c69('0x1f'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x5886d3[_0x8c69('0x21')]||!_0x5886d3[_0x8c69('0x26')]||!_0x5886d3[_0x8c69('0x22')]||!_0x5886d3[_0x8c69('0x23')]||!_0x5886d3['bucket']){throw new db[(_0x8c69('0x1e'))][(_0x8c69('0x1f'))](_0x8c69('0x25'));}if(!_0xd95d06[_0x8c69('0x13')]){throw new Error(_0x8c69('0x31'));}if(_0x5886d3[_0x8c69('0x26')]===_0x33e020['id']){return _0x33e020;}else{return db[_0x8c69('0x32')]['findOne']({'where':{'id':_settings[_0x8c69('0x26')]}});}})['then'](function(_0x58df85){if(!_0x58df85){throw new db[(_0x8c69('0x1e'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x58df85['data1']||!_0x58df85[_0x8c69('0xd')]){throw new db[(_0x8c69('0x1e'))][(_0x8c69('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x5bbd63=_0x58df85;logger['info'](util['format'](_0x8c69('0x2a'),_0xd95d06['id']));return sentiment(_0x5bbd63['data1'],_0x5bbd63['data2'],_0x5886d3['sentimentRegion'],_0xd95d06[_0x8c69('0x13')],_0x5886d3[_0x8c69('0x23')]);})[_0x8c69('0xf')](function(_0xc4edab){logger[_0x8c69('0xa')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0xd95d06['id']));return _0xd95d06[_0x8c69('0x1b')]({'sentiment':_0xc4edab[_0x8c69('0x33')],'sPositive':_0xc4edab[_0x8c69('0x2c')][_0x8c69('0x2b')],'sNegative':_0xc4edab[_0x8c69('0x2c')]['Negative'],'sMixed':_0xc4edab[_0x8c69('0x2c')]['Mixed'],'sNeutral':_0xc4edab[_0x8c69('0x2c')][_0x8c69('0x2d')],'transcribeStatus':'COMPLETED'});})[_0x8c69('0xf')](function(){logger[_0x8c69('0xa')](util[_0x8c69('0xb')](_0x8c69('0x1c'),_0xd95d06['id']));_0x1ebe38();});}})['catch'](function(_0x328da7){if(_0x328da7){if(!_0x328da7[_0x8c69('0x34')]||_0x328da7[_0x8c69('0x34')]!==_0x8c69('0x35')){logger[_0x8c69('0x36')](util[_0x8c69('0xb')](_0x8c69('0x37'),_0xd95d06['id']),util[_0x8c69('0x38')](_0x328da7,{'showHidden':![],'depth':null}));}}_0x1ebe38();});});}function checkTranscribe(){var _0x3c6d9a;var _0x55c599;var _0x1d91d0;return db[_0x8c69('0x39')]['findAll']({'where':{'transcribeStatus':_0x8c69('0x3a')}})[_0x8c69('0xf')](function(_0x4d514d){if(!_0x4d514d||!_0x4d514d['length']){throw new db[(_0x8c69('0x1e'))]['ValidationError'](_0x8c69('0x3b'));}_0x3c6d9a=_0x4d514d;return db['Setting']['findOne']({'where':{'id':0x1}});})['then'](function(_0x51549a){if(!_0x51549a){throw new db[(_0x8c69('0x1e'))][(_0x8c69('0x1f'))]('Settings\x20not\x20available');}_0x55c599=_0x51549a;if(!_0x55c599['transcribe']||!_0x55c599[_0x8c69('0x3c')]||!_0x55c599[_0x8c69('0xe')]||!_0x55c599['language']||!_0x55c599[_0x8c69('0x24')]){throw new db['Sequelize'][(_0x8c69('0x1f'))](_0x8c69('0x3d'));}return db['CloudProvider'][_0x8c69('0x27')]({'where':{'id':_0x55c599[_0x8c69('0x3c')]}});})[_0x8c69('0xf')](function(_0x2de454){if(!_0x2de454){throw new db[(_0x8c69('0x1e'))]['ValidationError'](_0x8c69('0x3e'));}if(!_0x2de454[_0x8c69('0x28')]||!_0x2de454[_0x8c69('0xd')]){throw new db[(_0x8c69('0x1e'))][(_0x8c69('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x1d91d0=_0x2de454;var _0xdd7326=[];_0x3c6d9a[_0x8c69('0x3f')](function(_0xaf6404){_0xdd7326[_0x8c69('0x40')](checkTranscribeJob(_0xaf6404,_0x55c599,_0x1d91d0));});return BPromise[_0x8c69('0x41')](_0xdd7326);})[_0x8c69('0x42')](function(_0x3d67f1){if(_0x3d67f1){if(!_0x3d67f1[_0x8c69('0x34')]||_0x3d67f1[_0x8c69('0x34')]!=='SequelizeValidationError'){logger[_0x8c69('0x36')](util[_0x8c69('0x38')](_0x3d67f1,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xa45c=['sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Negative','SentimentScore','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','resolve','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','bucket','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','Positive','Mixed','COMPLETED','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','all','start','lodash','aws-sdk','bluebird','../../config/logger','getTranscriptionJob','Comprehend','detectSentiment','format','transcribeName','data1','data2','transcribeRegion','then','TranscriptionJob','TranscriptionJobStatus','TranscriptFileUri','info','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','update','tempSentiment','Sequelize','ValidationError'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xa45c,0x6d));var _0xca45=function(_0x29c03a,_0x2fd3b8){_0x29c03a=_0x29c03a-0x0;var _0x4adcb7=_0xa45c[_0x29c03a];return _0x4adcb7;};var _=require(_0xca45('0x0'));var AWS=require(_0xca45('0x1'));var rp=require('request-promise');var util=require('util');var BPromise=require(_0xca45('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xca45('0x3'))('transcribe');function getTranscriptionJob(_0x16a36c,_0x47d8b9,_0x4d45e6,_0x33a162){return new Promise(function(_0x3803d6,_0x18d789){var _0x15628b=new AWS['TranscribeService']({'accessKeyId':_0x47d8b9,'secretAccessKey':_0x16a36c,'region':_0x4d45e6});_0x15628b[_0xca45('0x4')]({'TranscriptionJobName':_0x33a162},function(_0x276897,_0x7ceab1){if(_0x276897){return _0x18d789(_0x276897);}else{return _0x3803d6(_0x7ceab1);}});});}function sentiment(_0x307649,_0x312400,_0x5c18b9,_0xeb0cd9,_0x342542){return new Promise(function(_0x32afdc,_0x151691){var _0x3a551=new AWS[(_0xca45('0x5'))]({'accessKeyId':_0x312400,'secretAccessKey':_0x307649,'region':_0x5c18b9});_0x3a551[_0xca45('0x6')]({'Text':_0xeb0cd9,'LanguageCode':_0x342542['substring'](0x0,0x2)},function(_0x643942,_0x360ee9){if(_0x643942){return _0x151691(_0x643942);}else{return _0x32afdc(_0x360ee9);}});});}function checkTranscribeJob(_0x44a6cc,_0x17ebf7,_0x580c43){var _0x3044b1;return new BPromise(function(_0x711b03,_0x26f5a0){logger['info'](util[_0xca45('0x7')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x44a6cc['id'],_0x44a6cc[_0xca45('0x8')]));return getTranscriptionJob(_0x580c43[_0xca45('0x9')],_0x580c43[_0xca45('0xa')],_0x17ebf7[_0xca45('0xb')],_0x44a6cc[_0xca45('0x8')])[_0xca45('0xc')](function(_0x18dd61){logger['info'](util[_0xca45('0x7')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x44a6cc['id'],_0x44a6cc['transcribeName'],_0x18dd61[_0xca45('0xd')][_0xca45('0xe')]));if(!_0x44a6cc['fileText']){switch(_0x18dd61[_0xca45('0xd')][_0xca45('0xe')]){case'COMPLETED':var _0x40540f={'transcribeStatus':_0x18dd61[_0xca45('0xd')][_0xca45('0xe')],'fileUri':_0x18dd61[_0xca45('0xd')]['Transcript'][_0xca45('0xf')]};logger[_0xca45('0x10')](util[_0xca45('0x7')](_0xca45('0x11'),_0x44a6cc['id']));return rp({'uri':_0x18dd61['TranscriptionJob'][_0xca45('0x12')][_0xca45('0xf')],'json':!![]})[_0xca45('0xc')](function(_0x34bb8d){logger[_0xca45('0x10')](util[_0xca45('0x7')](_0xca45('0x13'),_0x44a6cc['id']));if(_0x34bb8d&&_0x34bb8d[_0xca45('0x14')]&&_0x34bb8d[_0xca45('0x14')]['transcripts']&&_0x34bb8d[_0xca45('0x14')][_0xca45('0x15')][_0xca45('0x16')]){_0x40540f[_0xca45('0x17')]='';for(var _0x242cb1=0x0;_0x242cb1<_0x34bb8d['results']['transcripts']['length'];_0x242cb1++){_0x40540f[_0xca45('0x17')]+=_0x34bb8d['results']['transcripts'][_0x242cb1][_0xca45('0x18')]+'';}}return _0x44a6cc[_0xca45('0x19')](_0x40540f);})[_0xca45('0xc')](function(){logger[_0xca45('0x10')](util[_0xca45('0x7')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x44a6cc['id']));if(!_0x44a6cc[_0xca45('0x1a')]){throw new db[(_0xca45('0x1b'))][(_0xca45('0x1c'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x17ebf7['sentiment']||!_0x17ebf7['sentimentAccountId']||!_0x17ebf7[_0xca45('0x1d')]||!_0x17ebf7[_0xca45('0x1e')]||!_0x17ebf7['bucket']){throw new db[(_0xca45('0x1b'))][(_0xca45('0x1c'))](_0xca45('0x1f'));}if(!_0x40540f[_0xca45('0x17')]){throw new Error('Transcript\x20not\x20available');}if(_0x17ebf7['sentimentAccountId']===_0x580c43['id']){return _0x580c43;}else{return db['CloudProvider'][_0xca45('0x20')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x4adb91){if(!_0x4adb91){throw new db[(_0xca45('0x1b'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x4adb91[_0xca45('0x9')]||!_0x4adb91[_0xca45('0xa')]){throw new db[(_0xca45('0x1b'))]['ValidationError'](_0xca45('0x21'));}_0x3044b1=_0x4adb91;logger[_0xca45('0x10')](util['format'](_0xca45('0x22'),_0x44a6cc['id']));return sentiment(_0x3044b1[_0xca45('0x9')],_0x3044b1[_0xca45('0xa')],_0x17ebf7[_0xca45('0x1d')],_0x40540f[_0xca45('0x17')],_0x17ebf7[_0xca45('0x1e')]);})[_0xca45('0xc')](function(_0x291dd6){logger[_0xca45('0x10')](util[_0xca45('0x7')](_0xca45('0x23'),_0x44a6cc['id']));return _0x44a6cc[_0xca45('0x19')]({'sentiment':_0x291dd6[_0xca45('0x24')],'sPositive':_0x291dd6['SentimentScore']['Positive'],'sNegative':_0x291dd6['SentimentScore'][_0xca45('0x25')],'sMixed':_0x291dd6[_0xca45('0x26')]['Mixed'],'sNeutral':_0x291dd6['SentimentScore'][_0xca45('0x27')]});})['then'](function(){logger[_0xca45('0x10')](util['format'](_0xca45('0x28'),_0x44a6cc['id']));_0x711b03();});case _0xca45('0x29'):return _0x44a6cc[_0xca45('0x19')]({'transcribeStatus':_0xca45('0x29'),'failureReason':_0x18dd61[_0xca45('0xd')]['FailureReason']})[_0xca45('0xc')](function(){logger['info'](util[_0xca45('0x7')](_0xca45('0x28'),_0x44a6cc['id']));_0x711b03();});default:logger[_0xca45('0x10')](util[_0xca45('0x7')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x44a6cc['id']));break;}}else{return BPromise[_0xca45('0x2a')]()[_0xca45('0xc')](function(){if(!_0x44a6cc[_0xca45('0x1a')]){throw new db['Sequelize']['ValidationError'](_0xca45('0x2b'));}if(!_0x17ebf7[_0xca45('0x2c')]||!_0x17ebf7[_0xca45('0x2d')]||!_0x17ebf7[_0xca45('0x1d')]||!_0x17ebf7[_0xca45('0x1e')]||!_0x17ebf7[_0xca45('0x2e')]){throw new db[(_0xca45('0x1b'))][(_0xca45('0x1c'))](_0xca45('0x1f'));}if(!_0x44a6cc[_0xca45('0x17')]){throw new Error(_0xca45('0x2f'));}if(_0x17ebf7[_0xca45('0x2d')]===_0x580c43['id']){return _0x580c43;}else{return db[_0xca45('0x30')][_0xca45('0x20')]({'where':{'id':_settings[_0xca45('0x2d')]}});}})[_0xca45('0xc')](function(_0x288d8c){if(!_0x288d8c){throw new db[(_0xca45('0x1b'))]['ValidationError'](_0xca45('0x31'));}if(!_0x288d8c[_0xca45('0x9')]||!_0x288d8c[_0xca45('0xa')]){throw new db['Sequelize'][(_0xca45('0x1c'))](_0xca45('0x21'));}_0x3044b1=_0x288d8c;logger[_0xca45('0x10')](util[_0xca45('0x7')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x44a6cc['id']));return sentiment(_0x3044b1[_0xca45('0x9')],_0x3044b1[_0xca45('0xa')],_0x17ebf7[_0xca45('0x1d')],_0x44a6cc[_0xca45('0x17')],_0x17ebf7[_0xca45('0x1e')]);})[_0xca45('0xc')](function(_0x447057){logger[_0xca45('0x10')](util[_0xca45('0x7')](_0xca45('0x23'),_0x44a6cc['id']));return _0x44a6cc[_0xca45('0x19')]({'sentiment':_0x447057[_0xca45('0x24')],'sPositive':_0x447057[_0xca45('0x26')][_0xca45('0x32')],'sNegative':_0x447057[_0xca45('0x26')][_0xca45('0x25')],'sMixed':_0x447057[_0xca45('0x26')][_0xca45('0x33')],'sNeutral':_0x447057[_0xca45('0x26')]['Neutral'],'transcribeStatus':_0xca45('0x34')});})[_0xca45('0xc')](function(){logger[_0xca45('0x10')](util[_0xca45('0x7')](_0xca45('0x28'),_0x44a6cc['id']));_0x711b03();});}})[_0xca45('0x35')](function(_0x3dadb2){if(_0x3dadb2){if(!_0x3dadb2[_0xca45('0x36')]||_0x3dadb2[_0xca45('0x36')]!==_0xca45('0x37')){logger[_0xca45('0x38')](util[_0xca45('0x7')](_0xca45('0x39'),_0x44a6cc['id']),util[_0xca45('0x3a')](_0x3dadb2,{'showHidden':![],'depth':null}));}}_0x711b03();});});}function checkTranscribe(){var _0x5b1c63;var _0x386463;var _0x457008;return db[_0xca45('0x3b')][_0xca45('0x3c')]({'where':{'transcribeStatus':_0xca45('0x3d')}})[_0xca45('0xc')](function(_0x43fd72){if(!_0x43fd72||!_0x43fd72[_0xca45('0x16')]){throw new db[(_0xca45('0x1b'))][(_0xca45('0x1c'))](_0xca45('0x3e'));}_0x5b1c63=_0x43fd72;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0xca45('0xc')](function(_0x1b15be){if(!_0x1b15be){throw new db['Sequelize'][(_0xca45('0x1c'))](_0xca45('0x3f'));}_0x386463=_0x1b15be;if(!_0x386463[_0xca45('0x40')]||!_0x386463[_0xca45('0x41')]||!_0x386463[_0xca45('0xb')]||!_0x386463[_0xca45('0x1e')]||!_0x386463[_0xca45('0x2e')]){throw new db[(_0xca45('0x1b'))][(_0xca45('0x1c'))](_0xca45('0x42'));}return db[_0xca45('0x30')][_0xca45('0x20')]({'where':{'id':_0x386463[_0xca45('0x41')]}});})['then'](function(_0x45de07){if(!_0x45de07){throw new db[(_0xca45('0x1b'))][(_0xca45('0x1c'))](_0xca45('0x31'));}if(!_0x45de07[_0xca45('0x9')]||!_0x45de07[_0xca45('0xa')]){throw new db[(_0xca45('0x1b'))][(_0xca45('0x1c'))](_0xca45('0x21'));}_0x457008=_0x45de07;var _0x48b492=[];_0x5b1c63['forEach'](function(_0x4cb20b){_0x48b492['push'](checkTranscribeJob(_0x4cb20b,_0x386463,_0x457008));});return BPromise[_0xca45('0x43')](_0x48b492);})[_0xca45('0x35')](function(_0x3827fa){if(_0x3827fa){if(!_0x3827fa[_0xca45('0x36')]||_0x3827fa['name']!==_0xca45('0x37')){logger[_0xca45('0x38')](util['inspect'](_0x3827fa,{'showHidden':![],'depth':null}));}}});}exports[_0xca45('0x44')]=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 035711f..9d998ef 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 _0xd7e0=['util','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','subtract','hours','then','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','error','lodash','moment','ioredis'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd7e0,0xb3));var _0x0d7e=function(_0x563a5a,_0x2a4aa4){_0x563a5a=_0x563a5a-0x0;var _0x3819b4=_0xd7e0[_0x563a5a];return _0x3819b4;};'use strict';var _=require(_0x0d7e('0x0'));var moment=require(_0x0d7e('0x1'));var Redis=require(_0x0d7e('0x2'));var util=require(_0x0d7e('0x3'));var config=require('../../config/environment');var db=require(_0x0d7e('0x4'))['db'];var logger=require(_0x0d7e('0x5'))(_0x0d7e('0x6'));config[_0x0d7e('0x7')]=_['defaults'](config[_0x0d7e('0x7')],{'host':_0x0d7e('0x8'),'port':0x18eb});var io=require(_0x0d7e('0x9'))(new Redis(config[_0x0d7e('0x7')]));function closeInteractions(){var _0x2d0db2=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x0d7e('0xa')](0x18,_0x0d7e('0xb'))}}})[_0x0d7e('0xc')](function(_0x24f4e1){if(_0x24f4e1&&_0x24f4e1[_0x0d7e('0xd')]){_0x2d0db2=_['map'](_0x24f4e1||[],'id');logger[_0x0d7e('0xe')](_0x0d7e('0xf'),_0x2d0db2[_0x0d7e('0x10')]());return db[_0x0d7e('0x11')][_0x0d7e('0x12')]({'closeReason':_0x0d7e('0x13'),'disposition':_0x0d7e('0x14'),'closed':!![],'closedAt':moment()['format'](_0x0d7e('0x15'))},{'where':{'id':_0x2d0db2}});}})[_0x0d7e('0xc')](function(){if(_0x2d0db2&&_0x2d0db2[_0x0d7e('0xd')]){logger[_0x0d7e('0xe')](_0x0d7e('0x16'),_0x2d0db2[_0x0d7e('0x10')]());for(var _0x2cf2f1=0x0;_0x2cf2f1<_0x2d0db2[_0x0d7e('0xd')];_0x2cf2f1++){io[_0x0d7e('0x17')](_0x0d7e('0x18'),{'id':_0x2d0db2[_0x2cf2f1],'closed':!![]});}}})['catch'](function(_0x19c5f7){logger[_0x0d7e('0x19')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x19c5f7?util['inspect'](_0x19c5f7,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xc9b1=['util','../../config/environment','schedule','redis','defaults','socket.io-emitter','WhatsappInteraction','findAll','subtract','then','length','map','info','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','moment','ioredis'];(function(_0x3b0f7e,_0x21928e){var _0x3c9d68=function(_0x420b3c){while(--_0x420b3c){_0x3b0f7e['push'](_0x3b0f7e['shift']());}};_0x3c9d68(++_0x21928e);}(_0xc9b1,0x1ae));var _0x1c9b=function(_0x5eb20b,_0x4b8c24){_0x5eb20b=_0x5eb20b-0x0;var _0x408b22=_0xc9b1[_0x5eb20b];return _0x408b22;};'use strict';var _=require('lodash');var moment=require(_0x1c9b('0x0'));var Redis=require(_0x1c9b('0x1'));var util=require(_0x1c9b('0x2'));var config=require(_0x1c9b('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0x1c9b('0x4'));config[_0x1c9b('0x5')]=_[_0x1c9b('0x6')](config[_0x1c9b('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x1c9b('0x7'))(new Redis(config[_0x1c9b('0x5')]));function closeInteractions(){var _0x166ade=[];return db[_0x1c9b('0x8')][_0x1c9b('0x9')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x1c9b('0xa')](0x18,'hours')}}})[_0x1c9b('0xb')](function(_0x365bc8){if(_0x365bc8&&_0x365bc8[_0x1c9b('0xc')]){_0x166ade=_[_0x1c9b('0xd')](_0x365bc8||[],'id');logger[_0x1c9b('0xe')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x166ade[_0x1c9b('0xf')]());return db[_0x1c9b('0x8')][_0x1c9b('0x10')]({'closeReason':_0x1c9b('0x11'),'disposition':_0x1c9b('0x12'),'closed':!![],'closedAt':moment()[_0x1c9b('0x13')](_0x1c9b('0x14'))},{'where':{'id':_0x166ade}});}})[_0x1c9b('0xb')](function(){if(_0x166ade&&_0x166ade[_0x1c9b('0xc')]){logger['info'](_0x1c9b('0x15'),_0x166ade[_0x1c9b('0xf')]());for(var _0x455fea=0x0;_0x455fea<_0x166ade['length'];_0x455fea++){io[_0x1c9b('0x16')](_0x1c9b('0x17'),{'id':_0x166ade[_0x455fea],'closed':!![]});}}})[_0x1c9b('0x18')](function(_0xb0ec28){logger['error'](_0x1c9b('0x19'),_0xb0ec28?util[_0x1c9b('0x1a')](_0xb0ec28,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index bb35b09..3b117d4 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ff7=['push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate','contacts1','CmHopper','finished\x20populating','hopper1','log','contacts2','hopper2','catch','../mysqldb'];(function(_0x24aebb,_0x43db2f){var _0x3671ab=function(_0x50d4c3){while(--_0x50d4c3){_0x24aebb['push'](_0x24aebb['shift']());}};_0x3671ab(++_0x43db2f);}(_0x5ff7,0x1b4));var _0x75ff=function(_0x55cbfe,_0xc95758){_0x55cbfe=_0x55cbfe-0x0;var _0x2c352b=_0x5ff7[_0x55cbfe];return _0x2c352b;};'use strict';var util=require('util');var db=require(_0x75ff('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x75ff('0x1')]({'id':i,'firstName':_0x75ff('0x2')+i,'lastName':_0x75ff('0x3')+i,'phone':0xf879fb460+i,'email':_0x75ff('0x4')+i+_0x75ff('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x75ff('0x1')]({'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[_0x75ff('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x75ff('0x2')+i,'lastName':_0x75ff('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x75ff('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x75ff('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x75ff('0x6')](),'updatedAt':Date[_0x75ff('0x6')]()});}db[_0x75ff('0x7')][_0x75ff('0x8')]({'where':{}})[_0x75ff('0x9')](function(){return db[_0x75ff('0x7')][_0x75ff('0xa')](contacts);})[_0x75ff('0x9')](function(){console['log']('finished\x20populating',_0x75ff('0xb'));return db[_0x75ff('0xc')]['destroy']({'where':{}});})[_0x75ff('0x9')](function(){return db[_0x75ff('0xc')]['bulkCreate'](hopper);})[_0x75ff('0x9')](function(){console['log'](_0x75ff('0xd'),_0x75ff('0xe'));return db['CmContact'][_0x75ff('0xa')](contacts2);})[_0x75ff('0x9')](function(){console[_0x75ff('0xf')]('finished\x20populating',_0x75ff('0x10'));return db[_0x75ff('0xc')][_0x75ff('0xa')](hopper2);})['then'](function(){console[_0x75ff('0xf')](_0x75ff('0xd'),_0x75ff('0x11'));})[_0x75ff('0x12')](function(_0x2a141a){console[_0x75ff('0xf')](_0x2a141a);}); \ No newline at end of file +var _0x59b6=['catch','util','../mysqldb','Innocenzo','innocenzo.biondo','@xcally.com','now','push','Biondo','CmContact','destroy','then','bulkCreate','log','finished\x20populating','CmHopper','hopper1'];(function(_0x962fc5,_0x58f074){var _0x43667c=function(_0x5e6ec0){while(--_0x5e6ec0){_0x962fc5['push'](_0x962fc5['shift']());}};_0x43667c(++_0x58f074);}(_0x59b6,0x155));var _0x659b=function(_0x2e4ac0,_0x336aca){_0x2e4ac0=_0x2e4ac0-0x0;var _0xab5985=_0x59b6[_0x2e4ac0];return _0xab5985;};'use strict';var util=require(_0x659b('0x0'));var db=require(_0x659b('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x659b('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x659b('0x3')+i+_0x659b('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x659b('0x5')](),'updatedAt':Date[_0x659b('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x659b('0x6')]({'id':i,'firstName':_0x659b('0x2')+i,'lastName':_0x659b('0x7')+i,'phone':0xf879fb460+i,'email':_0x659b('0x3')+i+_0x659b('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x659b('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[_0x659b('0x5')]()});}db[_0x659b('0x8')][_0x659b('0x9')]({'where':{}})[_0x659b('0xa')](function(){return db['CmContact'][_0x659b('0xb')](contacts);})['then'](function(){console[_0x659b('0xc')](_0x659b('0xd'),'contacts1');return db[_0x659b('0xe')][_0x659b('0x9')]({'where':{}});})[_0x659b('0xa')](function(){return db[_0x659b('0xe')][_0x659b('0xb')](hopper);})['then'](function(){console[_0x659b('0xc')](_0x659b('0xd'),_0x659b('0xf'));return db[_0x659b('0x8')][_0x659b('0xb')](contacts2);})[_0x659b('0xa')](function(){console[_0x659b('0xc')](_0x659b('0xd'),'contacts2');return db['CmHopper']['bulkCreate'](hopper2);})['then'](function(){console[_0x659b('0xc')](_0x659b('0xd'),'hopper2');})[_0x659b('0x10')](function(_0xfbaa8){console[_0x659b('0xc')](_0xfbaa8);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 1fc61ed..235c8b7 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3116=['add\x20user','catch','log','../mysqldb','push','format','%s%s','agent','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x3116,0x71));var _0x6311=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x3116[_0x3054be];return _0x3df150;};'use strict';var util=require('util');var db=require(_0x6311('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x6311('0x1')]({'name':util[_0x6311('0x2')]('%s%s','agent',i),'fullname':util['format'](_0x6311('0x3'),_0x6311('0x4'),i),'email':util[_0x6311('0x2')]('%s%s@xcally.com','agent',i),'role':_0x6311('0x4'),'password':_0x6311('0x5'),'internal':0xfa0+i,'type':_0x6311('0x6'),'transport':[_0x6311('0x7'),'ws',_0x6311('0x8')],'disallow':[_0x6311('0x9')],'allow':[_0x6311('0xa')],'defaultuser':util[_0x6311('0x2')](_0x6311('0x3'),_0x6311('0x4'),i),'encryption':'yes','avpf':_0x6311('0xb'),'force_avp':_0x6311('0xb'),'icesupport':_0x6311('0xb'),'dtlsenable':_0x6311('0xb'),'dtlsverify':'no','dtlscertfile':_0x6311('0xc'),'dtlsprivatekey':_0x6311('0xd'),'dtlssetup':_0x6311('0xe'),'callerid':util[_0x6311('0x2')](_0x6311('0xf'),util[_0x6311('0x2')](_0x6311('0x3'),'agent',i),0xfa0+i)});}db[_0x6311('0x10')][_0x6311('0x11')](users)[_0x6311('0x12')](function(){console['log'](_0x6311('0x13'));})[_0x6311('0x14')](function(_0x37255f){console[_0x6311('0x15')](_0x37255f);}); \ No newline at end of file +var _0x6b21=['/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','then','log','add\x20user','util','../mysqldb','push','format','%s%s','agent','udp','all','yes','/etc/pki/tls/certs/motion.crt'];(function(_0x4796c1,_0x2ede3b){var _0x4f14cd=function(_0x33f82){while(--_0x33f82){_0x4796c1['push'](_0x4796c1['shift']());}};_0x4f14cd(++_0x2ede3b);}(_0x6b21,0xa0));var _0x16b2=function(_0x4c6ac8,_0x2efad3){_0x4c6ac8=_0x4c6ac8-0x0;var _0x35c625=_0x6b21[_0x4c6ac8];return _0x35c625;};'use strict';var util=require(_0x16b2('0x0'));var db=require(_0x16b2('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x16b2('0x2')]({'name':util[_0x16b2('0x3')](_0x16b2('0x4'),_0x16b2('0x5'),i),'fullname':util[_0x16b2('0x3')](_0x16b2('0x4'),_0x16b2('0x5'),i),'email':util[_0x16b2('0x3')]('%s%s@xcally.com',_0x16b2('0x5'),i),'role':_0x16b2('0x5'),'password':'password','internal':0xfa0+i,'type':'friend','transport':[_0x16b2('0x6'),'ws','wss'],'disallow':[_0x16b2('0x7')],'allow':['ulaw'],'defaultuser':util[_0x16b2('0x3')](_0x16b2('0x4'),'agent',i),'encryption':'yes','avpf':_0x16b2('0x8'),'force_avp':'yes','icesupport':_0x16b2('0x8'),'dtlsenable':_0x16b2('0x8'),'dtlsverify':'no','dtlscertfile':_0x16b2('0x9'),'dtlsprivatekey':_0x16b2('0xa'),'dtlssetup':_0x16b2('0xb'),'callerid':util[_0x16b2('0x3')](_0x16b2('0xc'),util[_0x16b2('0x3')](_0x16b2('0x4'),_0x16b2('0x5'),i),0xfa0+i)});}db[_0x16b2('0xd')]['bulkCreate'](users)[_0x16b2('0xe')](function(){console[_0x16b2('0xf')](_0x16b2('0x10'));})['catch'](function(_0x3e7be8){console[_0x16b2('0xf')](_0x3e7be8);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 21ef059..54a21f2 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd4ad=['findAll','Telephones','Trunks','IvrCampaigns','resourceId','map','where','role','telephone','Campaign','%s:queue:%s','Agents','length','format','query','find','userProfileId','handshake','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','SmsInteraction','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','FaxQueue','MailQueue','OpenchannelQueue','user','VoiceQueues','ChatQueue','SmsQueue','MailQueues','WhatsappQueues','WhatsappQueue','Trunk','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','voice','chat','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','join','default','setMaxListeners','address','connection','remoteAddress','request','remotePort','connectedAt','log','SocketIO\x20','disconnect','DISCONNECTED','lodash','util','bluebird','../mysqldb','./environment','User','name','agent','type','ivr','UserProfileSection','then','autoAssociation','FaxQueues','SmsQueues','OpenchannelQueues'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xd4ad,0x1e4));var _0xdd4a=function(_0x42aac6,_0x48df92){_0x42aac6=_0x42aac6-0x0;var _0x314705=_0xd4ad[_0x42aac6];return _0x314705;};'use strict';var _=require(_0xdd4a('0x0'));var util=require(_0xdd4a('0x1'));var BPromise=require(_0xdd4a('0x2'));var db=require(_0xdd4a('0x3'))['db'];var config=require(_0xdd4a('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':'Agents','model':db[_0xdd4a('0x5')],'attributes':['id',_0xdd4a('0x6'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xdd4a('0x6')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xdd4a('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xdd4a('0x8')],'where':{'type':_0xdd4a('0x9')}};function getAssociatedResources(_0x3a9192,_0x16f5ba,_0xd1ee35){return db[_0xdd4a('0xa')]['findOne']({'where':{'name':_0x3a9192,'userProfileId':_0x16f5ba},'raw':!![]})[_0xdd4a('0xb')](function(_0x337598){if(_0x337598){if(_0x337598[_0xdd4a('0xc')]){switch(_0x3a9192){case'VoiceQueues':case'ChatQueues':case _0xdd4a('0xd'):case _0xdd4a('0xe'):case'MailQueues':case _0xdd4a('0xf'):case'WhatsappQueues':return db[_0xd1ee35][_0xdd4a('0x10')](queryQueues);case _0xdd4a('0x11'):return db[_0xd1ee35][_0xdd4a('0x10')](queryTelephones);case _0xdd4a('0x12'):return db[_0xd1ee35][_0xdd4a('0x10')](queryTrunks);case _0xdd4a('0x13'):return db[_0xd1ee35][_0xdd4a('0x10')](queryCampaigns);}}else{return db['UserProfileResource'][_0xdd4a('0x10')]({'attributes':[_0xdd4a('0x14')],'where':{'sectionId':_0x337598['id']},'raw':!![]})[_0xdd4a('0xb')](function(_0x1859f4){if(_0x1859f4){var _0x229a65={'where':{'id':_[_0xdd4a('0x15')](_0x1859f4,_0xdd4a('0x14'))},'raw':!![]};switch(_0xd1ee35){case _0xdd4a('0x5'):_0x229a65[_0xdd4a('0x16')][_0xdd4a('0x17')]=_0xdd4a('0x18');break;case _0xdd4a('0x19'):_0x229a65[_0xdd4a('0x16')][_0xdd4a('0x8')]=_0xdd4a('0x9');break;}return db[_0xd1ee35][_0xdd4a('0x10')](_0x229a65);}else{return[];}});}}else{return[];}})[_0xdd4a('0xb')](function(_0x49c234){return _0x49c234;});}function joinOrLeaveQueues(_0x31a80a,_0x4c7b67,_0x52a229,_0x13ca63){_0x31a80a[_0x4c7b67](util['format'](_0xdd4a('0x1a'),_0x52a229,_0x13ca63['name']));if(_0x13ca63['Agents']){for(var _0xfc51f=0x0;_0xfc51f<_0x13ca63[_0xdd4a('0x1b')][_0xdd4a('0x1c')];_0xfc51f+=0x1){_0x31a80a[_0x4c7b67](util[_0xdd4a('0x1d')]('user:%s',_0x13ca63['Agents'][_0xfc51f][_0xdd4a('0x6')]));}}}function joinOrLeave(_0x3e8cf8,_0x547721,_0x51112d){var _0x3d2b3a;if(_0x3e8cf8['handshake'][_0xdd4a('0x1e')]['id']){db[_0xdd4a('0x5')][_0xdd4a('0x1f')]({'attributes':['id',_0xdd4a('0x6'),_0xdd4a('0x17'),_0xdd4a('0x20')],'where':{'id':_0x3e8cf8[_0xdd4a('0x21')][_0xdd4a('0x1e')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0xdd4a('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0xdd4a('0x23')],'as':_0xdd4a('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xdd4a('0x25')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xdd4a('0x26')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xdd4a('0x27')],'as':_0xdd4a('0x28'),'attributes':['id'],'raw':!![]}]})[_0xdd4a('0xb')](function(_0x3a5033){if(_0x3a5033){_0x3d2b3a=_0x3a5033;_0x3e8cf8[_0x547721](util[_0xdd4a('0x1d')](_0xdd4a('0x29'),_0x3a5033[_0xdd4a('0x6')]));var _0x117ba7=[];switch(_0x3a5033['role']){case _0xdd4a('0x2a'):_0x3e8cf8[_0x547721](_0xdd4a('0x2b'));_0x3e8cf8[_0x547721](_0xdd4a('0x2c'));if(queryQueues[_0xdd4a('0x2d')]('include')){delete queryQueues[_0xdd4a('0x2e')];}_0x117ba7[_0xdd4a('0x2f')](db[_0xdd4a('0x30')][_0xdd4a('0x10')](queryQueues));_0x117ba7[_0xdd4a('0x2f')](db['ChatQueue'][_0xdd4a('0x10')](queryQueues));_0x117ba7[_0xdd4a('0x2f')](db[_0xdd4a('0x31')][_0xdd4a('0x10')](queryQueues));_0x117ba7['push'](db['SmsQueue']['findAll'](queryQueues));_0x117ba7[_0xdd4a('0x2f')](db[_0xdd4a('0x32')]['findAll'](queryQueues));_0x117ba7['push'](db[_0xdd4a('0x33')][_0xdd4a('0x10')](queryQueues));_0x117ba7[_0xdd4a('0x2f')](db['WhatsappQueue']['findAll'](queryQueues));_0x117ba7[_0xdd4a('0x2f')](db['User'][_0xdd4a('0x10')](queryTelephones));_0x117ba7[_0xdd4a('0x2f')](db['Trunk'][_0xdd4a('0x10')](queryTrunks));_0x117ba7['push'](db['Campaign']['findAll'](queryCampaigns));_0x117ba7[_0xdd4a('0x2f')](db[_0xdd4a('0x5')][_0xdd4a('0x10')](queryAgents));break;case _0xdd4a('0x34'):_0x3e8cf8[_0x547721](_0xdd4a('0x2b'));_0x3e8cf8[_0x547721](_0xdd4a('0x2c'));_0x117ba7[_0xdd4a('0x2f')](getAssociatedResources(_0xdd4a('0x35'),_0x3a5033['userProfileId'],_0xdd4a('0x30')));_0x117ba7['push'](getAssociatedResources('ChatQueues',_0x3a5033[_0xdd4a('0x20')],_0xdd4a('0x36')));_0x117ba7[_0xdd4a('0x2f')](getAssociatedResources(_0xdd4a('0xd'),_0x3a5033['userProfileId'],_0xdd4a('0x31')));_0x117ba7[_0xdd4a('0x2f')](getAssociatedResources('SmsQueues',_0x3a5033[_0xdd4a('0x20')],_0xdd4a('0x37')));_0x117ba7['push'](getAssociatedResources(_0xdd4a('0x38'),_0x3a5033['userProfileId'],_0xdd4a('0x32')));_0x117ba7['push'](getAssociatedResources('OpenchannelQueues',_0x3a5033[_0xdd4a('0x20')],_0xdd4a('0x33')));_0x117ba7[_0xdd4a('0x2f')](getAssociatedResources(_0xdd4a('0x39'),_0x3a5033[_0xdd4a('0x20')],_0xdd4a('0x3a')));_0x117ba7[_0xdd4a('0x2f')](getAssociatedResources(_0xdd4a('0x11'),_0x3a5033[_0xdd4a('0x20')],_0xdd4a('0x5')));_0x117ba7[_0xdd4a('0x2f')](getAssociatedResources(_0xdd4a('0x12'),_0x3a5033[_0xdd4a('0x20')],_0xdd4a('0x3b')));_0x117ba7[_0xdd4a('0x2f')](getAssociatedResources(_0xdd4a('0x13'),_0x3a5033['userProfileId'],'Campaign'));_0x117ba7['push'](db['User'][_0xdd4a('0x10')](queryAgents));break;case _0xdd4a('0x7'):_0x3e8cf8[_0x547721](_0xdd4a('0x2b'));_0x3e8cf8[_0x547721]('voice:outbound');_0x117ba7[_0xdd4a('0x2f')](_0x3a5033[_0xdd4a('0x3c')]({'attributes':['id','name']}));_0x117ba7['push'](_0x3a5033[_0xdd4a('0x3d')]({'attributes':['id','name']}));_0x117ba7['push'](_0x3a5033[_0xdd4a('0x3e')]({'attributes':['id','name']}));_0x117ba7[_0xdd4a('0x2f')](_0x3a5033['getSmsQueues']({'attributes':['id',_0xdd4a('0x6')]}));_0x117ba7['push'](_0x3a5033[_0xdd4a('0x3f')]({'attributes':['id',_0xdd4a('0x6')]}));_0x117ba7[_0xdd4a('0x2f')](_0x3a5033['getOpenchannelQueues']({'attributes':['id',_0xdd4a('0x6')]}));_0x117ba7[_0xdd4a('0x2f')](_0x3a5033['getWhatsappQueues']({'attributes':['id',_0xdd4a('0x6')]}));break;}return BPromise['all'](_0x117ba7);}})[_0xdd4a('0xb')](function(_0x47487f){if(_0x47487f&&_0x47487f['length']){for(var _0x177163=0x0;_0x177163<_0x47487f[_0xdd4a('0x1c')];_0x177163+=0x1){for(var _0xd32e15=0x0;_0xd32e15<_0x47487f[_0x177163][_0xdd4a('0x1c')];_0xd32e15+=0x1){switch(_0x177163){case 0x0:joinOrLeaveQueues(_0x3e8cf8,_0x547721,_0xdd4a('0x40'),_0x47487f[_0x177163][_0xd32e15]);break;case 0x1:joinOrLeaveQueues(_0x3e8cf8,_0x547721,_0xdd4a('0x41'),_0x47487f[_0x177163][_0xd32e15]);break;case 0x2:joinOrLeaveQueues(_0x3e8cf8,_0x547721,'fax',_0x47487f[_0x177163][_0xd32e15]);break;case 0x3:joinOrLeaveQueues(_0x3e8cf8,_0x547721,'sms',_0x47487f[_0x177163][_0xd32e15]);break;case 0x4:joinOrLeaveQueues(_0x3e8cf8,_0x547721,_0xdd4a('0x42'),_0x47487f[_0x177163][_0xd32e15]);break;case 0x5:joinOrLeaveQueues(_0x3e8cf8,_0x547721,_0xdd4a('0x43'),_0x47487f[_0x177163][_0xd32e15]);break;case 0x6:joinOrLeaveQueues(_0x3e8cf8,_0x547721,_0xdd4a('0x44'),_0x47487f[_0x177163][_0xd32e15]);break;case 0x7:if(_0x3d2b3a[_0xdd4a('0x17')]!=='agent')_0x3e8cf8[_0x547721](util['format'](_0xdd4a('0x45'),_0x47487f[_0x177163][_0xd32e15][_0xdd4a('0x6')]));break;case 0x8:if(_0x3d2b3a[_0xdd4a('0x17')]!=='agent')_0x3e8cf8[_0x547721](util[_0xdd4a('0x1d')](_0xdd4a('0x46'),_0x47487f[_0x177163][_0xd32e15][_0xdd4a('0x6')]));break;case 0x9:if(_0x3d2b3a[_0xdd4a('0x17')]!==_0xdd4a('0x7'))_0x3e8cf8[_0x547721](util[_0xdd4a('0x1d')](_0xdd4a('0x47'),_0x47487f[_0x177163][_0xd32e15]['type'],_0x47487f[_0x177163][_0xd32e15]['name']));break;case 0xa:_0x3e8cf8[_0x547721](util[_0xdd4a('0x1d')]('user:%s',_0x47487f[_0x177163][_0xd32e15][_0xdd4a('0x6')]));break;}}}}})[_0xdd4a('0xb')](function(){if(_0x547721===_0xdd4a('0x48')){var _0x343091=_[_0xdd4a('0x15')](_0x3d2b3a['ChatInteractions'],'id');return _0x3d2b3a[_0xdd4a('0x49')](_0x343091)[_0xdd4a('0xb')](function(){for(var _0x11d62f=0x0;_0x11d62f<_0x343091['length'];_0x11d62f+=0x1){_0x51112d['emit'](_0xdd4a('0x4a'),{'ChatInteractionId':Number(_0x343091[_0x11d62f]),'UserId':Number(_0x3d2b3a['id'])});}});}})[_0xdd4a('0xb')](function(){if(_0x547721===_0xdd4a('0x48')){var _0xacc22=_[_0xdd4a('0x15')](_0x3d2b3a['MailInteractions'],'id');return _0x3d2b3a[_0xdd4a('0x4b')](_0xacc22)[_0xdd4a('0xb')](function(){for(var _0x26fb33=0x0;_0x26fb33<_0xacc22[_0xdd4a('0x1c')];_0x26fb33+=0x1){_0x51112d[_0xdd4a('0x4c')](_0xdd4a('0x4d'),{'MailInteractionId':Number(_0xacc22[_0x26fb33]),'UserId':Number(_0x3d2b3a['id'])});}});}})[_0xdd4a('0xb')](function(){if(_0x547721===_0xdd4a('0x48')){var _0x19baf3=_[_0xdd4a('0x15')](_0x3d2b3a[_0xdd4a('0x4e')],'id');return _0x3d2b3a[_0xdd4a('0x4f')](_0x19baf3)[_0xdd4a('0xb')](function(){for(var _0x2d153c=0x0;_0x2d153c<_0x19baf3[_0xdd4a('0x1c')];_0x2d153c+=0x1){_0x51112d[_0xdd4a('0x4c')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x19baf3[_0x2d153c]),'UserId':Number(_0x3d2b3a['id'])});}});}})['then'](function(){if(_0x547721==='leave'){var _0x691c39=_[_0xdd4a('0x15')](_0x3d2b3a[_0xdd4a('0x50')],'id');return _0x3d2b3a[_0xdd4a('0x51')](_0x691c39)[_0xdd4a('0xb')](function(){for(var _0x3088cd=0x0;_0x3088cd<_0x691c39['length'];_0x3088cd+=0x1){_0x51112d[_0xdd4a('0x4c')](_0xdd4a('0x52'),{'SmsInteractionId':Number(_0x691c39[_0x3088cd]),'UserId':Number(_0x3d2b3a['id'])});}});}})['then'](function(){if(_0x547721===_0xdd4a('0x48')){var _0x52575e=_['map'](_0x3d2b3a[_0xdd4a('0x53')],'id');return _0x3d2b3a[_0xdd4a('0x54')](_0x52575e)['then'](function(){for(var _0x14ff0e=0x0;_0x14ff0e<_0x52575e['length'];_0x14ff0e+=0x1){_0x51112d[_0xdd4a('0x4c')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x52575e[_0x14ff0e]),'UserId':Number(_0x3d2b3a['id'])});}});}})[_0xdd4a('0xb')](function(){if(_0x547721===_0xdd4a('0x48')){var _0x2ffe49=_['map'](_0x3d2b3a[_0xdd4a('0x28')],'id');return _0x3d2b3a[_0xdd4a('0x55')](_0x2ffe49)[_0xdd4a('0xb')](function(){for(var _0x297d73=0x0;_0x297d73<_0x2ffe49[_0xdd4a('0x1c')];_0x297d73+=0x1){_0x51112d[_0xdd4a('0x4c')](_0xdd4a('0x56'),{'WhatsappInteractionId':Number(_0x2ffe49[_0x297d73]),'UserId':Number(_0x3d2b3a['id'])});}});}})['catch'](function(_0x489388){_0x3e8cf8['log'](_0x489388);});}}function onDisconnect(_0x4b63b4,_0x873684){joinOrLeave(_0x4b63b4,'leave',_0x873684);}function onConnect(_0x453f2f){joinOrLeave(_0x453f2f,_0xdd4a('0x57'));}exports[_0xdd4a('0x58')]=function(_0x5f48d4){_0x5f48d4['on']('connection',function(_0x6299fb){_0x6299fb[_0xdd4a('0x59')](0x0);_0x6299fb[_0xdd4a('0x5a')]=_0x6299fb['request'][_0xdd4a('0x5b')][_0xdd4a('0x5c')]+':'+_0x6299fb[_0xdd4a('0x5d')][_0xdd4a('0x5b')][_0xdd4a('0x5e')];_0x6299fb[_0xdd4a('0x5f')]=new Date();_0x6299fb[_0xdd4a('0x60')]=function(_0x3d2289){console[_0xdd4a('0x60')](_0xdd4a('0x61')+_0x6299fb['nsp']['name']+'['+_0x6299fb[_0xdd4a('0x5a')]+']',_0x3d2289);};_0x6299fb['on'](_0xdd4a('0x62'),function(){onDisconnect(_0x6299fb,_0x5f48d4);_0x6299fb['log'](_0xdd4a('0x63'));});onConnect(_0x6299fb);_0x6299fb[_0xdd4a('0x60')]('CONNECTED');});}; \ No newline at end of file +var _0x04cc=['findAll','IvrCampaigns','resourceId','then','User','where','format','%s:queue:%s','Agents','length','user:%s','query','find','userProfileId','handshake','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','admin','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','push','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','FaxQueue','WhatsappQueues','getVoiceQueues','getSmsQueues','all','voice','chat','fax','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','removeSmsInteractions','user_has_sms_interactions:remove','map','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','lodash','util','bluebird','../mysqldb','name','role','agent','telephone','type','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','Telephones','Trunks'];(function(_0x55adcb,_0x1dfbb5){var _0x5abbbf=function(_0x1a0737){while(--_0x1a0737){_0x55adcb['push'](_0x55adcb['shift']());}};_0x5abbbf(++_0x1dfbb5);}(_0x04cc,0x11a));var _0xc04c=function(_0x5bfaa7,_0x404773){_0x5bfaa7=_0x5bfaa7-0x0;var _0xe1b1a3=_0x04cc[_0x5bfaa7];return _0xe1b1a3;};'use strict';var _=require(_0xc04c('0x0'));var util=require(_0xc04c('0x1'));var BPromise=require(_0xc04c('0x2'));var db=require(_0xc04c('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xc04c('0x4')],'include':[{'as':'Agents','model':db['User'],'attributes':['id',_0xc04c('0x4'),_0xc04c('0x5')],'raw':!![],'where':{'role':_0xc04c('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xc04c('0x4')],'where':{'role':_0xc04c('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0xc04c('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xc04c('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0xc04c('0x4'),_0xc04c('0x8')],'where':{'type':_0xc04c('0x9')}};function getAssociatedResources(_0x26a695,_0x335812,_0x1dbc1c){return db[_0xc04c('0xa')][_0xc04c('0xb')]({'where':{'name':_0x26a695,'userProfileId':_0x335812},'raw':!![]})['then'](function(_0x4c6e10){if(_0x4c6e10){if(_0x4c6e10[_0xc04c('0xc')]){switch(_0x26a695){case _0xc04c('0xd'):case _0xc04c('0xe'):case _0xc04c('0xf'):case _0xc04c('0x10'):case _0xc04c('0x11'):case _0xc04c('0x12'):case'WhatsappQueues':return db[_0x1dbc1c]['findAll'](queryQueues);case _0xc04c('0x13'):return db[_0x1dbc1c]['findAll'](queryTelephones);case _0xc04c('0x14'):return db[_0x1dbc1c][_0xc04c('0x15')](queryTrunks);case _0xc04c('0x16'):return db[_0x1dbc1c][_0xc04c('0x15')](queryCampaigns);}}else{return db['UserProfileResource'][_0xc04c('0x15')]({'attributes':[_0xc04c('0x17')],'where':{'sectionId':_0x4c6e10['id']},'raw':!![]})[_0xc04c('0x18')](function(_0x247582){if(_0x247582){var _0x4c1154={'where':{'id':_['map'](_0x247582,'resourceId')},'raw':!![]};switch(_0x1dbc1c){case _0xc04c('0x19'):_0x4c1154[_0xc04c('0x1a')]['role']=_0xc04c('0x7');break;case'Campaign':_0x4c1154[_0xc04c('0x1a')][_0xc04c('0x8')]='ivr';break;}return db[_0x1dbc1c][_0xc04c('0x15')](_0x4c1154);}else{return[];}});}}else{return[];}})[_0xc04c('0x18')](function(_0x3627ac){return _0x3627ac;});}function joinOrLeaveQueues(_0x1ad3e6,_0x29db9f,_0xa20dae,_0x260a51){_0x1ad3e6[_0x29db9f](util[_0xc04c('0x1b')](_0xc04c('0x1c'),_0xa20dae,_0x260a51[_0xc04c('0x4')]));if(_0x260a51[_0xc04c('0x1d')]){for(var _0x5d7c0e=0x0;_0x5d7c0e<_0x260a51[_0xc04c('0x1d')][_0xc04c('0x1e')];_0x5d7c0e+=0x1){_0x1ad3e6[_0x29db9f](util[_0xc04c('0x1b')](_0xc04c('0x1f'),_0x260a51[_0xc04c('0x1d')][_0x5d7c0e][_0xc04c('0x4')]));}}}function joinOrLeave(_0x461d1d,_0x244e80,_0x204d03){var _0x17bc59;if(_0x461d1d['handshake'][_0xc04c('0x20')]['id']){db['User'][_0xc04c('0x21')]({'attributes':['id',_0xc04c('0x4'),_0xc04c('0x5'),_0xc04c('0x22')],'where':{'id':_0x461d1d[_0xc04c('0x23')]['query']['id']},'include':[{'model':db[_0xc04c('0x24')],'as':_0xc04c('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xc04c('0x26')],'as':_0xc04c('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xc04c('0x28')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xc04c('0x29')],'as':_0xc04c('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0xc04c('0x2b')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xc04c('0x2c')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0xc04c('0x18')](function(_0x14ba62){if(_0x14ba62){_0x17bc59=_0x14ba62;_0x461d1d[_0x244e80](util[_0xc04c('0x1b')]('user:%s',_0x14ba62[_0xc04c('0x4')]));var _0x56cd49=[];switch(_0x14ba62[_0xc04c('0x5')]){case _0xc04c('0x2d'):_0x461d1d[_0x244e80](_0xc04c('0x2e'));_0x461d1d[_0x244e80](_0xc04c('0x2f'));if(queryQueues[_0xc04c('0x30')]('include')){delete queryQueues[_0xc04c('0x31')];}_0x56cd49['push'](db[_0xc04c('0x32')]['findAll'](queryQueues));_0x56cd49['push'](db['ChatQueue'][_0xc04c('0x15')](queryQueues));_0x56cd49[_0xc04c('0x33')](db['FaxQueue']['findAll'](queryQueues));_0x56cd49[_0xc04c('0x33')](db[_0xc04c('0x34')][_0xc04c('0x15')](queryQueues));_0x56cd49[_0xc04c('0x33')](db['MailQueue'][_0xc04c('0x15')](queryQueues));_0x56cd49[_0xc04c('0x33')](db[_0xc04c('0x35')][_0xc04c('0x15')](queryQueues));_0x56cd49[_0xc04c('0x33')](db[_0xc04c('0x36')][_0xc04c('0x15')](queryQueues));_0x56cd49[_0xc04c('0x33')](db[_0xc04c('0x19')]['findAll'](queryTelephones));_0x56cd49[_0xc04c('0x33')](db[_0xc04c('0x37')][_0xc04c('0x15')](queryTrunks));_0x56cd49[_0xc04c('0x33')](db[_0xc04c('0x38')][_0xc04c('0x15')](queryCampaigns));_0x56cd49['push'](db[_0xc04c('0x19')]['findAll'](queryAgents));break;case'user':_0x461d1d[_0x244e80]('voice:inbound');_0x461d1d[_0x244e80](_0xc04c('0x2f'));_0x56cd49[_0xc04c('0x33')](getAssociatedResources(_0xc04c('0xd'),_0x14ba62[_0xc04c('0x22')],_0xc04c('0x32')));_0x56cd49[_0xc04c('0x33')](getAssociatedResources(_0xc04c('0xe'),_0x14ba62[_0xc04c('0x22')],'ChatQueue'));_0x56cd49[_0xc04c('0x33')](getAssociatedResources(_0xc04c('0xf'),_0x14ba62['userProfileId'],_0xc04c('0x39')));_0x56cd49[_0xc04c('0x33')](getAssociatedResources(_0xc04c('0x10'),_0x14ba62[_0xc04c('0x22')],_0xc04c('0x34')));_0x56cd49[_0xc04c('0x33')](getAssociatedResources(_0xc04c('0x11'),_0x14ba62[_0xc04c('0x22')],'MailQueue'));_0x56cd49[_0xc04c('0x33')](getAssociatedResources('OpenchannelQueues',_0x14ba62[_0xc04c('0x22')],_0xc04c('0x35')));_0x56cd49[_0xc04c('0x33')](getAssociatedResources(_0xc04c('0x3a'),_0x14ba62[_0xc04c('0x22')],_0xc04c('0x36')));_0x56cd49[_0xc04c('0x33')](getAssociatedResources('Telephones',_0x14ba62[_0xc04c('0x22')],_0xc04c('0x19')));_0x56cd49[_0xc04c('0x33')](getAssociatedResources(_0xc04c('0x14'),_0x14ba62[_0xc04c('0x22')],_0xc04c('0x37')));_0x56cd49[_0xc04c('0x33')](getAssociatedResources(_0xc04c('0x16'),_0x14ba62[_0xc04c('0x22')],'Campaign'));_0x56cd49[_0xc04c('0x33')](db[_0xc04c('0x19')]['findAll'](queryAgents));break;case _0xc04c('0x6'):_0x461d1d[_0x244e80](_0xc04c('0x2e'));_0x461d1d[_0x244e80](_0xc04c('0x2f'));_0x56cd49[_0xc04c('0x33')](_0x14ba62[_0xc04c('0x3b')]({'attributes':['id',_0xc04c('0x4')]}));_0x56cd49[_0xc04c('0x33')](_0x14ba62['getChatQueues']({'attributes':['id',_0xc04c('0x4')]}));_0x56cd49[_0xc04c('0x33')](_0x14ba62['getFaxQueues']({'attributes':['id',_0xc04c('0x4')]}));_0x56cd49[_0xc04c('0x33')](_0x14ba62[_0xc04c('0x3c')]({'attributes':['id',_0xc04c('0x4')]}));_0x56cd49['push'](_0x14ba62['getMailQueues']({'attributes':['id','name']}));_0x56cd49['push'](_0x14ba62['getOpenchannelQueues']({'attributes':['id',_0xc04c('0x4')]}));_0x56cd49[_0xc04c('0x33')](_0x14ba62['getWhatsappQueues']({'attributes':['id',_0xc04c('0x4')]}));break;}return BPromise[_0xc04c('0x3d')](_0x56cd49);}})[_0xc04c('0x18')](function(_0x364f29){if(_0x364f29&&_0x364f29[_0xc04c('0x1e')]){for(var _0x5af3eb=0x0;_0x5af3eb<_0x364f29['length'];_0x5af3eb+=0x1){for(var _0x2fd5e5=0x0;_0x2fd5e5<_0x364f29[_0x5af3eb][_0xc04c('0x1e')];_0x2fd5e5+=0x1){switch(_0x5af3eb){case 0x0:joinOrLeaveQueues(_0x461d1d,_0x244e80,_0xc04c('0x3e'),_0x364f29[_0x5af3eb][_0x2fd5e5]);break;case 0x1:joinOrLeaveQueues(_0x461d1d,_0x244e80,_0xc04c('0x3f'),_0x364f29[_0x5af3eb][_0x2fd5e5]);break;case 0x2:joinOrLeaveQueues(_0x461d1d,_0x244e80,_0xc04c('0x40'),_0x364f29[_0x5af3eb][_0x2fd5e5]);break;case 0x3:joinOrLeaveQueues(_0x461d1d,_0x244e80,'sms',_0x364f29[_0x5af3eb][_0x2fd5e5]);break;case 0x4:joinOrLeaveQueues(_0x461d1d,_0x244e80,_0xc04c('0x41'),_0x364f29[_0x5af3eb][_0x2fd5e5]);break;case 0x5:joinOrLeaveQueues(_0x461d1d,_0x244e80,_0xc04c('0x42'),_0x364f29[_0x5af3eb][_0x2fd5e5]);break;case 0x6:joinOrLeaveQueues(_0x461d1d,_0x244e80,_0xc04c('0x43'),_0x364f29[_0x5af3eb][_0x2fd5e5]);break;case 0x7:if(_0x17bc59[_0xc04c('0x5')]!==_0xc04c('0x6'))_0x461d1d[_0x244e80](util['format'](_0xc04c('0x44'),_0x364f29[_0x5af3eb][_0x2fd5e5]['name']));break;case 0x8:if(_0x17bc59['role']!==_0xc04c('0x6'))_0x461d1d[_0x244e80](util['format'](_0xc04c('0x45'),_0x364f29[_0x5af3eb][_0x2fd5e5]['name']));break;case 0x9:if(_0x17bc59[_0xc04c('0x5')]!==_0xc04c('0x6'))_0x461d1d[_0x244e80](util['format'](_0xc04c('0x46'),_0x364f29[_0x5af3eb][_0x2fd5e5]['type'],_0x364f29[_0x5af3eb][_0x2fd5e5][_0xc04c('0x4')]));break;case 0xa:_0x461d1d[_0x244e80](util[_0xc04c('0x1b')](_0xc04c('0x1f'),_0x364f29[_0x5af3eb][_0x2fd5e5][_0xc04c('0x4')]));break;}}}}})[_0xc04c('0x18')](function(){if(_0x244e80===_0xc04c('0x47')){var _0x2e2e0c=_['map'](_0x17bc59[_0xc04c('0x25')],'id');return _0x17bc59[_0xc04c('0x48')](_0x2e2e0c)[_0xc04c('0x18')](function(){for(var _0x3d9692=0x0;_0x3d9692<_0x2e2e0c[_0xc04c('0x1e')];_0x3d9692+=0x1){_0x204d03[_0xc04c('0x49')](_0xc04c('0x4a'),{'ChatInteractionId':Number(_0x2e2e0c[_0x3d9692]),'UserId':Number(_0x17bc59['id'])});}});}})[_0xc04c('0x18')](function(){if(_0x244e80===_0xc04c('0x47')){var _0x5c9cfe=_['map'](_0x17bc59[_0xc04c('0x27')],'id');return _0x17bc59[_0xc04c('0x4b')](_0x5c9cfe)[_0xc04c('0x18')](function(){for(var _0x54b2a5=0x0;_0x54b2a5<_0x5c9cfe[_0xc04c('0x1e')];_0x54b2a5+=0x1){_0x204d03[_0xc04c('0x49')](_0xc04c('0x4c'),{'MailInteractionId':Number(_0x5c9cfe[_0x54b2a5]),'UserId':Number(_0x17bc59['id'])});}});}})[_0xc04c('0x18')](function(){if(_0x244e80===_0xc04c('0x47')){var _0x3ed8ac=_['map'](_0x17bc59[_0xc04c('0x4d')],'id');return _0x17bc59[_0xc04c('0x4e')](_0x3ed8ac)[_0xc04c('0x18')](function(){for(var _0x1cafcb=0x0;_0x1cafcb<_0x3ed8ac[_0xc04c('0x1e')];_0x1cafcb+=0x1){_0x204d03['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x3ed8ac[_0x1cafcb]),'UserId':Number(_0x17bc59['id'])});}});}})[_0xc04c('0x18')](function(){if(_0x244e80===_0xc04c('0x47')){var _0xb636e5=_['map'](_0x17bc59[_0xc04c('0x2a')],'id');return _0x17bc59[_0xc04c('0x4f')](_0xb636e5)[_0xc04c('0x18')](function(){for(var _0x4daffb=0x0;_0x4daffb<_0xb636e5['length'];_0x4daffb+=0x1){_0x204d03[_0xc04c('0x49')](_0xc04c('0x50'),{'SmsInteractionId':Number(_0xb636e5[_0x4daffb]),'UserId':Number(_0x17bc59['id'])});}});}})['then'](function(){if(_0x244e80==='leave'){var _0x332f72=_[_0xc04c('0x51')](_0x17bc59[_0xc04c('0x52')],'id');return _0x17bc59[_0xc04c('0x53')](_0x332f72)[_0xc04c('0x18')](function(){for(var _0x5aab1f=0x0;_0x5aab1f<_0x332f72['length'];_0x5aab1f+=0x1){_0x204d03[_0xc04c('0x49')](_0xc04c('0x54'),{'OpenchannelInteractionId':Number(_0x332f72[_0x5aab1f]),'UserId':Number(_0x17bc59['id'])});}});}})[_0xc04c('0x18')](function(){if(_0x244e80===_0xc04c('0x47')){var _0x43291c=_[_0xc04c('0x51')](_0x17bc59[_0xc04c('0x55')],'id');return _0x17bc59['removeWhatsappInteractions'](_0x43291c)[_0xc04c('0x18')](function(){for(var _0x2d2069=0x0;_0x2d2069<_0x43291c['length'];_0x2d2069+=0x1){_0x204d03[_0xc04c('0x49')](_0xc04c('0x56'),{'WhatsappInteractionId':Number(_0x43291c[_0x2d2069]),'UserId':Number(_0x17bc59['id'])});}});}})[_0xc04c('0x57')](function(_0x43dfa2){_0x461d1d[_0xc04c('0x58')](_0x43dfa2);});}}function onDisconnect(_0x26eabd,_0x426854){joinOrLeave(_0x26eabd,_0xc04c('0x47'),_0x426854);}function onConnect(_0x396fa6){joinOrLeave(_0x396fa6,_0xc04c('0x59'));}exports[_0xc04c('0x5a')]=function(_0x5a85b7){_0x5a85b7['on'](_0xc04c('0x5b'),function(_0x23b3d5){_0x23b3d5[_0xc04c('0x5c')](0x0);_0x23b3d5[_0xc04c('0x5d')]=_0x23b3d5[_0xc04c('0x5e')][_0xc04c('0x5b')][_0xc04c('0x5f')]+':'+_0x23b3d5[_0xc04c('0x5e')]['connection'][_0xc04c('0x60')];_0x23b3d5[_0xc04c('0x61')]=new Date();_0x23b3d5['log']=function(_0x339c3c){console['log'](_0xc04c('0x62')+_0x23b3d5[_0xc04c('0x63')]['name']+'['+_0x23b3d5[_0xc04c('0x5d')]+']',_0x339c3c);};_0x23b3d5['on'](_0xc04c('0x64'),function(){onDisconnect(_0x23b3d5,_0x5a85b7);_0x23b3d5['log']('DISCONNECTED');});onConnect(_0x23b3d5);_0x23b3d5[_0xc04c('0x58')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index edcffc5..87e1604 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 _0x760e=['closed','substatus','find','email','internal','default','length','hasOwnProperty','model','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','triggers','client','Chat','ChatInteraction','afterCreate','afterUpdate','closedinteraction','ChatMessage','ChatOfflineMessage','newmessage','Sms','SmsInteraction','SmsMessage','WhatsappInteraction','newinteraction','Whatsapp','WhatsappMessage','Fax','FaxInteraction','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','EventManager','info','Trigger,\x20%s','error','catch','event','direction','resolve','then','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','UserId','interface','format','name','agent','incomingmessage','outgoingmessage','AfterCreateMessage','get','channel','motionChannel','offlineMessage','query','AfterCreate','changed'];(function(_0x1eb74e,_0x230422){var _0x3c7800=function(_0x2b339a){while(--_0x2b339a){_0x1eb74e['push'](_0x1eb74e['shift']());}};_0x3c7800(++_0x230422);}(_0x760e,0x130));var _0xe760=function(_0x4974ab,_0x48c56d){_0x4974ab=_0x4974ab-0x0;var _0x1f4e0a=_0x760e[_0x4974ab];return _0x1f4e0a;};'use strict';var util=require(_0xe760('0x0'));var db=require(_0xe760('0x1'))['db'];var jayson=require(_0xe760('0x2'));var logger=require(_0xe760('0x3'))(_0xe760('0x4'));var client=jayson[_0xe760('0x5')]['http']({'port':0x232a});var triggers=[{'channel':_0xe760('0x6'),'model':_0xe760('0x7'),'event':_0xe760('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':'Chat','model':'ChatInteraction','event':_0xe760('0x9'),'condition':_0xe760('0xa'),'callback':afterUpdate},{'channel':_0xe760('0x6'),'model':_0xe760('0xb'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0xe760('0x6'),'model':_0xe760('0xc'),'event':'afterCreate','condition':_0xe760('0xd'),'callback':afterCreateOfflineMessage},{'channel':_0xe760('0xe'),'model':'SmsInteraction','event':_0xe760('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xe760('0xe'),'model':_0xe760('0xf'),'event':_0xe760('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xe760('0xe'),'model':_0xe760('0x10'),'event':_0xe760('0x8'),'condition':_0xe760('0xd'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0xe760('0x11'),'event':_0xe760('0x8'),'condition':_0xe760('0x12'),'callback':afterCreate},{'channel':_0xe760('0x13'),'model':_0xe760('0x11'),'event':_0xe760('0x9'),'condition':_0xe760('0xa'),'callback':afterUpdate},{'channel':_0xe760('0x13'),'model':_0xe760('0x14'),'event':_0xe760('0x8'),'condition':_0xe760('0xd'),'callback':afterCreateMessage},{'channel':_0xe760('0x15'),'model':_0xe760('0x16'),'event':_0xe760('0x8'),'condition':_0xe760('0x12'),'callback':afterCreate},{'channel':'Fax','model':_0xe760('0x16'),'event':_0xe760('0x9'),'condition':_0xe760('0xa'),'callback':afterUpdate},{'channel':_0xe760('0x15'),'model':'FaxMessage','event':_0xe760('0x8'),'condition':_0xe760('0xd'),'callback':afterCreateMessage},{'channel':_0xe760('0x17'),'model':'MailInteraction','event':_0xe760('0x8'),'condition':_0xe760('0x12'),'callback':afterCreate},{'channel':_0xe760('0x17'),'model':_0xe760('0x18'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0xe760('0x17'),'model':_0xe760('0x19'),'event':_0xe760('0x8'),'condition':_0xe760('0xd'),'callback':afterCreateMessage},{'channel':_0xe760('0x1a'),'model':_0xe760('0x1b'),'event':_0xe760('0x8'),'condition':_0xe760('0x12'),'callback':afterCreate},{'channel':_0xe760('0x1a'),'model':_0xe760('0x1b'),'event':_0xe760('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xe760('0x1a'),'model':_0xe760('0x1c'),'event':_0xe760('0x8'),'condition':_0xe760('0xd'),'callback':afterCreateMessage}];function request(_0x49cb14){return client['request'](_0xe760('0x1d'),_0x49cb14)['then'](function(_0x349eda){logger[_0xe760('0x1e')](_0xe760('0x1f'),_0xe760('0x1d'),_0x349eda);if(_0x349eda[_0xe760('0x20')]){if(_0x349eda[_0xe760('0x20')]['code']===0x1f4){logger[_0xe760('0x20')](_0xe760('0x1f'),_0xe760('0x1d'),_0x349eda[_0xe760('0x20')]);}}})[_0xe760('0x21')](function(_0x24185d){logger['error'](_0xe760('0x1f'),'EventManager',_0x24185d);});}function afterCreateMessage(_0x5dec47){return function(_0x45efe5){_0x45efe5=_0x45efe5['get']({'plain':!![]});_0x45efe5['channel']=_0x5dec47;_0x45efe5['motionChannel']=_0x5dec47;_0x45efe5[_0xe760('0x22')]=_0x45efe5[_0xe760('0x23')];Promise[_0xe760('0x24')]()[_0xe760('0x25')](function(){if(typeof _0x45efe5[_0xe760('0x26')]===_0xe760('0x27'))return null;var _0x22a151=_0xe760('0x28')+_0x45efe5[_0xe760('0x26')];return db[_0xe760('0x29')]['query'](_0x22a151,{'type':db[_0xe760('0x2a')][_0xe760('0x2b')][_0xe760('0x2c')],'raw':!![]});})[_0xe760('0x25')](function(_0x33e276){if(_0x33e276){_0x45efe5[_0xe760('0x2d')]=_0x33e276[0x0];}if(typeof _0x45efe5['UserId']===_0xe760('0x27'))return;return getAgent(_0x45efe5[_0xe760('0x2e')]);})[_0xe760('0x25')](function(_0x4f92d1){if(_0x4f92d1){_0x45efe5[_0xe760('0x2f')]=util[_0xe760('0x30')]('SIP/%s',_0x4f92d1[_0xe760('0x31')]);_0x45efe5[_0xe760('0x32')]=_0x4f92d1;_0x45efe5['channel']=_0x5dec47;return request({'event':_0xe760('0x33'),'message':_0x45efe5});}else{return request({'event':_0xe760('0x34'),'message':_0x45efe5});}})[_0xe760('0x21')](function(_0x453e76){logger[_0xe760('0x20')]('Trigger,\x20%s',_0xe760('0x35'),_0x453e76);});};}function afterCreateOfflineMessage(_0x28523a){return function(_0x25b392){_0x25b392=_0x25b392[_0xe760('0x36')]({'plain':!![]});_0x25b392[_0xe760('0x37')]=_0x28523a;_0x25b392[_0xe760('0x38')]=_0x28523a;_0x25b392[_0xe760('0x22')]=_0xe760('0x39');return request({'event':_0x25b392[_0xe760('0x22')],'message':_0x25b392});};}function afterCreate(_0x465ac6,_0xf4dcd6){return function(_0x311c25){_0x311c25=_0x311c25[_0xe760('0x36')]({'plain':!![]});_0x311c25[_0xe760('0x37')]=_0x465ac6;_0x311c25[_0xe760('0x38')]=_0x465ac6;_0x311c25[_0xe760('0x22')]='opened';Promise[_0xe760('0x24')]()['then'](function(){var _0x2c1915=_0xe760('0x28')+_0x311c25[_0xe760('0x26')];return db['sequelize'][_0xe760('0x3a')](_0x2c1915,{'type':db['Sequelize'][_0xe760('0x2b')][_0xe760('0x2c')],'raw':!![]});})[_0xe760('0x25')](function(_0xdd3796){if(_0xdd3796){_0x311c25[_0xe760('0x2d')]=_0xdd3796[0x0];}if(typeof _0x311c25['UserId']==='undefined')return;return getAgent(_0x311c25[_0xe760('0x2e')]);})['then'](function(_0x1e5f32){if(_0x1e5f32){_0x311c25[_0xe760('0x2f')]=util['format']('SIP/%s',_0x1e5f32[_0xe760('0x31')]);_0x311c25[_0xe760('0x32')]=_0x1e5f32;}return request({'event':_0xf4dcd6,'message':_0x311c25});})[_0xe760('0x21')](function(_0x4f7384){logger['error']('Trigger,\x20%s',_0xe760('0x3b'),_0x4f7384);});};}function afterUpdate(_0x3ab821){return function(_0x2cf5c0){var _0x112fa9=_0x2cf5c0[_0xe760('0x3c')](_0xe760('0x3d'))&&_0x2cf5c0['closed'];var _0x3ddf53=_0x2cf5c0[_0xe760('0x3c')](_0xe760('0x3e'));if(_0x112fa9||_0x3ddf53){var _0x31485b=_0x112fa9?'closedinteraction':'substatus';var _0x4e63ad=_0x2cf5c0[_0xe760('0x36')]({'plain':!![]});_0x4e63ad[_0xe760('0x37')]=_0x3ab821;_0x4e63ad[_0xe760('0x38')]=_0x3ab821;_0x4e63ad[_0xe760('0x22')]=_0x112fa9?_0xe760('0x3d'):'substatus';var _0xdd1711=_0xe760('0x28')+_0x4e63ad[_0xe760('0x26')];return db[_0xe760('0x29')][_0xe760('0x3a')](_0xdd1711,{'type':db[_0xe760('0x2a')][_0xe760('0x2b')][_0xe760('0x2c')],'raw':!![]})['then'](function(_0x34f12a){if(_0x34f12a){_0x4e63ad[_0xe760('0x2d')]=_0x34f12a[0x0];}if(typeof _0x4e63ad[_0xe760('0x2e')]==='undefined')return;return getAgent(_0x4e63ad['UserId']);})[_0xe760('0x25')](function(_0x5eb6bf){if(_0x5eb6bf){_0x4e63ad['interface']=util[_0xe760('0x30')]('SIP/%s',_0x5eb6bf[_0xe760('0x31')]);_0x4e63ad[_0xe760('0x32')]=_0x5eb6bf;}return request({'event':_0x31485b,'message':_0x4e63ad});})[_0xe760('0x21')](function(_0x574589){logger[_0xe760('0x20')](_0xe760('0x1f'),'AfterUpdate',_0x574589);});}};}function getAgent(_0x466d37){return db['User'][_0xe760('0x3f')]({'where':{'id':_0x466d37},'attributes':['id',_0xe760('0x31'),'fullname',_0xe760('0x40'),_0xe760('0x41')],'raw':!![]})[_0xe760('0x25')](function(_0x3d2464){return _0x3d2464;});}exports[_0xe760('0x42')]=function(){for(var _0x47f519=0x0;_0x47f519=_0x29425d['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x3489ab(_0x3f8405);})[_0xda11('0x14')](function(_0x2a96df){_0xa3d3d8(_0x2a96df);});});}; \ No newline at end of file +var _0xf252=['blockedAt','getLicense','User','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','voice','mail','chat','sms','openchannel','toLowerCase','includes'];(function(_0x3cfb3c,_0x8b172){var _0x5c3d52=function(_0x26b7c4){while(--_0x26b7c4){_0x3cfb3c['push'](_0x3cfb3c['shift']());}};_0x5c3d52(++_0x8b172);}(_0xf252,0xdf));var _0x2f25=function(_0x610d0e,_0x106bec){_0x610d0e=_0x610d0e-0x0;var _0x58922a=_0xf252[_0x610d0e];return _0x58922a;};'use strict';var _=require(_0x2f25('0x0'));var BPromise=require(_0x2f25('0x1'));var db=require(_0x2f25('0x2'))['db'];var util=require(_0x2f25('0x3'));var channels=[_0x2f25('0x4'),_0x2f25('0x5'),_0x2f25('0x6'),'fax',_0x2f25('0x7'),'whatsapp',_0x2f25('0x8')];exports['getChannels']=function(){return channels;};exports['isValidChannel']=function(_0x4d1eae){_0x4d1eae=_0x4d1eae[_0x2f25('0x9')]();return _[_0x2f25('0xa')](channels,_0x4d1eae);};exports['clearBlockUser']=function(_0x9e9757,_0x128640,_0x3f81d0,_0x14e5ed){var _0x336cf2={'loginAttempts':_0x128640,'blocked':_0x3f81d0};if(!_['isUndefined'](_0x14e5ed)){_0x336cf2[_0x2f25('0xb')]=_0x14e5ed;}return _0x9e9757['updateAttributes'](_0x336cf2);};exports[_0x2f25('0xc')]=function(_0x343cc6){return new BPromise(function(_0x417ba6,_0xf33398){var _0x97a1f7=0x0;if(_0x343cc6['role']!=='agent'){_0x417ba6(_0x343cc6);}db[_0x2f25('0xd')]['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x343cc6['id']}}})[_0x2f25('0xe')](function(_0x2f72ae){_0x97a1f7=_0x2f72ae;return util['getLicense']();})[_0x2f25('0xe')](function(_0x41aaf8){if(_0x41aaf8&&_0x41aaf8[_0x2f25('0xf')]&&_0x97a1f7>=_0x41aaf8[_0x2f25('0xf')]){throw Error(_0x2f25('0x10'));}_0x417ba6(_0x343cc6);})[_0x2f25('0x11')](function(_0x52261b){_0xf33398(_0x52261b);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 8b1caf2..8989236 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafdf=['exports','status','render'];(function(_0x55b728,_0xe943c2){var _0x54773f=function(_0x5cbd96){while(--_0x5cbd96){_0x55b728['push'](_0x55b728['shift']());}};_0x54773f(++_0xe943c2);}(_0xafdf,0xf6));var _0xfafd=function(_0x597ca0,_0x525f0c){_0x597ca0=_0x597ca0-0x0;var _0x5de237=_0xafdf[_0x597ca0];return _0x5de237;};'use strict';module[_0xfafd('0x0')][0x194]=function pageNotFound(_0x4be494,_0x504c67){var _0x2ee544='404';var _0x40a3f2=0x194;var _0x49a90d={'status':_0x40a3f2};_0x504c67['status'](_0x49a90d[_0xfafd('0x1')]);_0x504c67[_0xfafd('0x2')](_0x2ee544,{},function(_0x45fd66,_0xb96a7b){if(_0x45fd66){return _0x504c67[_0xfafd('0x1')](_0x49a90d['status'])['json'](_0x49a90d);}_0x504c67['send'](_0xb96a7b);});}; \ No newline at end of file +var _0xc462=['exports','404','status','json','send'];(function(_0x253889,_0x4d077f){var _0x3dd963=function(_0x252f06){while(--_0x252f06){_0x253889['push'](_0x253889['shift']());}};_0x3dd963(++_0x4d077f);}(_0xc462,0x1d6));var _0x2c46=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xc462[_0x13b02f];return _0x12e9a6;};'use strict';module[_0x2c46('0x0')][0x194]=function pageNotFound(_0x4ca7fe,_0x216110){var _0x4d1f26=_0x2c46('0x1');var _0x21a013=0x194;var _0x1fe561={'status':_0x21a013};_0x216110[_0x2c46('0x2')](_0x1fe561['status']);_0x216110['render'](_0x4d1f26,{},function(_0x117238,_0x4fee3d){if(_0x117238){return _0x216110[_0x2c46('0x2')](_0x1fe561[_0x2c46('0x2')])[_0x2c46('0x3')](_0x1fe561);}_0x216110[_0x2c46('0x4')](_0x4fee3d);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index fbe596b..65a5bda 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe48=['JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','JscriptyProject','Setting','../api/setting/setting.model','SquareOdbc','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','HopperFinals','OpenchannelInteractions','ChatInteractions','SmsInteraction','FaxInteractions','MailInteractions','WhatsappInteractions','belongsTo','belongsToMany','Groups','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','MailQueues','UserMailQueue','ChatQueue','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','ChatWebsites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProject','SquareProjects','user_has_square_projects','ChanSpyId','Applications','Members','VoiceQueueId','Hoppers','HopperHistories','CmHopperBlack','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','mandatoryDispositionPause','mandatoryDispositionPauseId','Teams','TeamVoiceQueue','voice_queues_has_cm_blacklists','VoiceRecording','VoiceMailMessage','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','ContactId','MailAccountId','CloudProviderId','restrict','MailServerOut','Imap','Dispositions','CannedAnswer','Answers','Messages','Interactions','MailApplication','List','TemplateId','Agents','MailQueue','team_has_mail_queues','Account','Contact','Owner','mail_interaction_has_tags','MailInteractionId','ChatWebsiteId','TagId','ListId','DashboardItem','Items','FaxAccountId','FaxInteractionId','Tags','ThroughTags','Users','Interaction','Attachment','AttachmentId','team_has_fax_queues','SmsAccountId','IntervalId','SmsMessage','SmsInteractionId','UserSmsQueue','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ProactiveActions','ChatApplication','user_has_chat_websites','Website','ChatMessage','ChatInteractionId','chat_interaction_has_tags','Attachments','team_has_chat_queues','ChatGroupId','CompanyId','JscriptySessionReport','Company','cm_contact_has_tags','Agent','Queue','CampaignId','OwnerId','All','OneAll','AutomationAllId','OneAny','Actions','AutomationId','Intervals','MailApplications','ChatApplications','Schedule','DefaultReportId','CustomReportId','Mohs','moh_has_sounds','sms_interaction_has_tags','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Fields','AnalyticDefaultReport','AnalyticMetric','MetricId','Configurations','Subjects','SubjectId','FieldId','AccountId','Subject','DescriptionId','Field','Variable','VariableId','Description','Descriptions','ZohoConfiguration','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','ServicenowField','Dynamics365Account','FreshsalesField','ChatQueueReport','ToId','JscriptyQuestionReport','SessionId','ProjectId','VoiceQueues','WhatsappQueue','team_has_whatsapp_queues','VoicePrefixes','HopperBlacks','SquareProjectId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','ChatOfflineMessageId','MailTransferReport','FromMailAccountId','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToAccount','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','FromAccount','ToFaxQueueId','OpenchannelTransferReport','ToOpenchannelQueueId','FromSmsAccountId','ToSmsQueueId','CustomFields','HopperHistory','Queues','Extensions','userProfileId','UserProfileSection','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','../config/environment','sequelize','lodash','jstz','determine','motion2','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','defaultsDeep','sequelizeHistory','username','password','database','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsQueue','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','IntegrationReport','AnalyticCustomReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../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','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Integration','../api/integration/integration.model','Network','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xbe48,0x121));var _0x8be4=function(_0x1e9658,_0x131c1a){_0x1e9658=_0x1e9658-0x0;var _0x26fa44=_0xbe48[_0x1e9658];return _0x26fa44;};'use strict';var config=require(_0x8be4('0x0'));var Sequelize=require(_0x8be4('0x1'));var _=require(_0x8be4('0x2'));var jstz=require(_0x8be4('0x3'));var timezone=jstz[_0x8be4('0x4')]();config['sequelize']=_['defaultsDeep'](config[_0x8be4('0x1')],{'database':_0x8be4('0x5'),'username':'xcall','password':_0x8be4('0x6'),'options':{'host':_0x8be4('0x7'),'port':0xcea,'dialect':_0x8be4('0x8'),'dialectOptions':{'charset':_0x8be4('0x9')},'logging':![],'timezone':timezone[_0x8be4('0xa')](),'define':{'charset':_0x8be4('0xb'),'collate':_0x8be4('0xc')}}});config['sequelizeHistory']=_[_0x8be4('0xd')](config[_0x8be4('0xe')],{'database':'motion2','username':'xcall','password':_0x8be4('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x8be4('0x9')},'logging':![],'timezone':timezone[_0x8be4('0xa')](),'define':{'charset':_0x8be4('0xb'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x8be4('0x1')][_0x8be4('0xf')],config[_0x8be4('0x1')][_0x8be4('0x10')],config['sequelize']['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x8be4('0xe')][_0x8be4('0x11')],config[_0x8be4('0xe')][_0x8be4('0xf')],config['sequelizeHistory'][_0x8be4('0x10')],config['sequelizeHistory'][_0x8be4('0x12')])};db[_0x8be4('0x13')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x15'));db[_0x8be4('0x16')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x17'));db[_0x8be4('0x18')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x19'));db[_0x8be4('0x1a')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x1b'));db[_0x8be4('0x1c')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0x1d'));db[_0x8be4('0x1e')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x1f'));db['VoiceRecording']=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/voiceRecording/voiceRecording.model');db[_0x8be4('0x20')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0x21'));db['VoiceMail']=db[_0x8be4('0x1')]['import'](_0x8be4('0x22'));db['VoiceMailMessage']=db[_0x8be4('0x1')]['import'](_0x8be4('0x23'));db[_0x8be4('0x24')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/voiceCallReport/voiceCallReport.model');db[_0x8be4('0x25')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x26'));db[_0x8be4('0x27')]=db[_0x8be4('0x1')]['import'](_0x8be4('0x28'));db[_0x8be4('0x29')]=db[_0x8be4('0x1')]['import'](_0x8be4('0x2a'));db[_0x8be4('0x2b')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x2c'));db[_0x8be4('0x2d')]=db['sequelize']['import']('../api/trunk/trunk.model');db['VoiceTransferReport']=db[_0x8be4('0x1')]['import'](_0x8be4('0x2e'));db[_0x8be4('0x2f')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x8be4('0x30')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x31'));db['UserChatQueue']=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/userChatQueue/userChatQueue.model');db['UserMailQueue']=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/userMailQueue/userMailQueue.model');db[_0x8be4('0x32')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0x33'));db['UserSmsQueue']=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/userSmsQueue/userSmsQueue.model');db[_0x8be4('0x34')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x35'));db[_0x8be4('0x36')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0x37'));db[_0x8be4('0x38')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x39'));db['MailServerOut']=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x3a'));db[_0x8be4('0x3b')]=db['sequelize'][_0x8be4('0x14')]('../api/mailAccount/mailAccount.model');db['MailQueue']=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x3c'));db['MailSubstatus']=db['sequelize'][_0x8be4('0x14')](_0x8be4('0x3d'));db[_0x8be4('0x3e')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0x3f'));db[_0x8be4('0x40')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x41'));db['MailApplication']=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x42'));db[_0x8be4('0x43')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x44'));db[_0x8be4('0x45')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x46'));db['DashboardItem']=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x47'));db[_0x8be4('0x48')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x49'));db[_0x8be4('0x4a')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x4b'));db[_0x8be4('0x4c')]=db['sequelize']['import'](_0x8be4('0x4d'));db[_0x8be4('0x4e')]=db[_0x8be4('0x1')]['import'](_0x8be4('0x4f'));db[_0x8be4('0x50')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0x51'));db[_0x8be4('0x52')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0x53'));db[_0x8be4('0x54')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0x55'));db[_0x8be4('0x56')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x57'));db['SmsInteraction']=db['sequelize'][_0x8be4('0x14')]('../api/smsInteraction/smsInteraction.model');db['SmsMessage']=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/smsMessage/smsMessage.model');db[_0x8be4('0x58')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/smsQueue/smsQueue.model');db[_0x8be4('0x59')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/openchannelAccount/openchannelAccount.model');db[_0x8be4('0x5a')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x5b'));db[_0x8be4('0x5c')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x5d'));db[_0x8be4('0x5e')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0x5f'));db[_0x8be4('0x60')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0x61'));db[_0x8be4('0x62')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/chatWebsite/chatWebsite.model');db[_0x8be4('0x63')]=db['sequelize'][_0x8be4('0x14')]('../api/openchannelQueueReport/openchannelQueueReport.model');db['ChatApplication']=db[_0x8be4('0x1')]['import'](_0x8be4('0x64'));db[_0x8be4('0x65')]=db[_0x8be4('0x1')]['import'](_0x8be4('0x66'));db['ChatMessage']=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x67'));db[_0x8be4('0x68')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/chatOfflineMessage/chatOfflineMessage.model');db['ChatQueue']=db['sequelize'][_0x8be4('0x14')](_0x8be4('0x69'));db[_0x8be4('0x6a')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x6b'));db[_0x8be4('0x6c')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x6d'));db[_0x8be4('0x6e')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x6f'));db['CmContact']=db['sequelize'][_0x8be4('0x14')]('../api/cmContact/cmContact.model');db[_0x8be4('0x70')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x71'));db['CmHopperBlack']=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x72'));db[_0x8be4('0x73')]=db[_0x8be4('0x1')]['import'](_0x8be4('0x74'));db[_0x8be4('0x75')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x76'));db[_0x8be4('0x77')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x78'));db[_0x8be4('0x79')]=db[_0x8be4('0x1')]['import'](_0x8be4('0x7a'));db[_0x8be4('0x7b')]=db[_0x8be4('0x1')]['import'](_0x8be4('0x7c'));db[_0x8be4('0x7d')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x7e'));db['CannedAnswer']=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x7f'));db[_0x8be4('0x80')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x81'));db[_0x8be4('0x82')]=db[_0x8be4('0x1')]['import'](_0x8be4('0x83'));db[_0x8be4('0x84')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0x85'));db[_0x8be4('0x86')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x87'));db['Cdr']=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x88'));db[_0x8be4('0x89')]=db[_0x8be4('0x1')]['import'](_0x8be4('0x8a'));db['Schedule']=db['sequelize'][_0x8be4('0x14')](_0x8be4('0x8b'));db[_0x8be4('0x8c')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x8d'));db[_0x8be4('0x8e')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x8f'));db[_0x8be4('0x90')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x91'));db[_0x8be4('0x92')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x93'));db['Variable']=db[_0x8be4('0x1')]['import'](_0x8be4('0x94'));db['Integration']=db['sequelize'][_0x8be4('0x14')]('../api/integration/integration.model');db[_0x8be4('0x95')]=db[_0x8be4('0x1')]['import']('../api/integrationReport/integrationReport.model');db[_0x8be4('0x96')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/analyticCustomReport/analyticCustomReport.model');db['AnalyticDefaultReport']=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x97'));db[_0x8be4('0x98')]=db['sequelize'][_0x8be4('0x14')]('../api/analyticExtractedReport/analyticExtractedReport.model');db['AnalyticMetric']=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/analyticMetric/analyticMetric.model');db[_0x8be4('0x99')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x9a'));db[_0x8be4('0x9b')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x9c'));db[_0x8be4('0x9d')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x9e'));db[_0x8be4('0x9f')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xa0'));db[_0x8be4('0xa1')]=db[_0x8be4('0x1')]['import'](_0x8be4('0xa2'));db[_0x8be4('0xa3')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xa4'));db[_0x8be4('0xa5')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x8be4('0xa6')]=db[_0x8be4('0x1')]['import'](_0x8be4('0xa7'));db[_0x8be4('0xa8')]=db[_0x8be4('0x1')]['import']('../api/intDeskAccount/intDeskAccount.model');db[_0x8be4('0xa9')]=db[_0x8be4('0x1')]['import'](_0x8be4('0xaa'));db[_0x8be4('0xab')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xac'));db[_0x8be4('0xad')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xae'));db['ZohoConfiguration']=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xaf'));db[_0x8be4('0xb0')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xb1'));db[_0x8be4('0xb2')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0x8be4('0xb3')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0xb4'));db[_0x8be4('0xb5')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xb6'));db[_0x8be4('0xb7')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x8be4('0xb8')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xb9'));db[_0x8be4('0xba')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xbb'));db[_0x8be4('0xbc')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x8be4('0xbd')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xbe'));db[_0x8be4('0xbf')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/intVtigerField/intVtigerField.model');db[_0x8be4('0xc0')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0xc1'));db[_0x8be4('0xc2')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xc3'));db['ServicenowField']=db[_0x8be4('0x1')]['import']('../api/intServicenowField/intServicenowField.model');db['Dynamics365Account']=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xc4'));db[_0x8be4('0xc5')]=db['sequelize'][_0x8be4('0x14')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x8be4('0xc6')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0xc7'));db[_0x8be4('0xc8')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xc9'));db[_0x8be4('0xca')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xcb'));db['FreshsalesField']=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xcc'));db[_0x8be4('0xcd')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xce'));db[_0x8be4('0xcf')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/network/network.model');db['ChatQueueReport']=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xd0'));db[_0x8be4('0xd1')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xd2'));db[_0x8be4('0xd3')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xd4'));db['JscriptyQuestionReport']=db['sequelize']['import'](_0x8be4('0xd5'));db['JscriptySessionReport']=db[_0x8be4('0x1')]['import'](_0x8be4('0xd6'));db[_0x8be4('0xd7')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0xd8'));db[_0x8be4('0xd9')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xda'));db['SquareDetailsReport']=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/squareReportDetail/squareReportDetail.model');db[_0x8be4('0xdb')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/jscriptyProject/jscriptyProject.model');db[_0x8be4('0xdc')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xdd'));db[_0x8be4('0xde')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/squareOdbc/squareOdbc.model');db['SquareProject']=db['sequelize'][_0x8be4('0x14')](_0x8be4('0xdf'));db[_0x8be4('0xe0')]=db[_0x8be4('0x1')]['import']('../api/squareRecording/squareRecording.model');db[_0x8be4('0xe1')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/squareMessage/squareMessage.model');db[_0x8be4('0xe2')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xe3'));db[_0x8be4('0xe4')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xe5'));db[_0x8be4('0xe6')]=db['sequelize']['import'](_0x8be4('0xe7'));db['Migration']=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xe8'));db['Attachment']=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xe9'));db[_0x8be4('0xea')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xeb'));db['MailTransferReport']=db['sequelize'][_0x8be4('0x14')](_0x8be4('0xec'));db[_0x8be4('0xed')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xee'));db[_0x8be4('0xef')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0xf0'));db['OpenchannelTransferReport']=db['sequelize'][_0x8be4('0x14')](_0x8be4('0xf1'));db[_0x8be4('0xf2')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0xf3'));db[_0x8be4('0xf4')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/cmList/cmList.model');db[_0x8be4('0xf5')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/voicePrefix/voicePrefix.model');db[_0x8be4('0xf6')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0xf7'));db['UserProfileSection']=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xf8'));db['UserProfileResource']=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/userProfileResource/userProfileResource.model');db[_0x8be4('0xf9')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xfa'));db[_0x8be4('0xfb')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/whatsappAccount/whatsappAccount.model');db['WhatsappApplication']=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xfc'));db[_0x8be4('0xfd')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xfe'));db[_0x8be4('0xff')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x100'));db[_0x8be4('0x101')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0x102'));db[_0x8be4('0x103')]=db['sequelize']['import']('../api/whatsappTransferReport/whatsappTransferReport.model');db['WhatsappQueue']=db[_0x8be4('0x1')]['import']('../api/whatsappQueue/whatsappQueue.model');db[_0x8be4('0x104')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0x105'));db['TeamVoiceQueue']=db[_0x8be4('0x1')]['import']('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0x8be4('0x106')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x107'));db[_0x8be4('0x108')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0x109'));db[_0x8be4('0x13')][_0x8be4('0x10a')](db[_0x8be4('0x10b')],{'as':_0x8be4('0x10b'),'onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x10d')});db[_0x8be4('0x13')][_0x8be4('0x10e')](db['VoiceRecording'],{'as':_0x8be4('0x10f'),'foreignKey':'UserId'});db[_0x8be4('0x13')][_0x8be4('0x10e')](db[_0x8be4('0x2f')],{'as':_0x8be4('0x110'),'foreignKey':_0x8be4('0x10d')});db['User'][_0x8be4('0x10e')](db[_0x8be4('0x1a')],{'as':'Extensions','onDelete':_0x8be4('0x10c'),'hooks':!![]});db[_0x8be4('0x13')]['hasMany'](db['CmHopperFinal'],{'as':_0x8be4('0x111'),'foreignKey':_0x8be4('0x10d')});db[_0x8be4('0x13')][_0x8be4('0x10e')](db[_0x8be4('0x75')],{'as':'HopperHistory','foreignKey':_0x8be4('0x10d')});db[_0x8be4('0x13')][_0x8be4('0x10e')](db['ReportAgentPreview'],{'as':_0x8be4('0x77'),'foreignKey':_0x8be4('0x10d')});db[_0x8be4('0x13')]['hasMany'](db['OpenchannelInteraction'],{'as':_0x8be4('0x112'),'foreignKey':_0x8be4('0x10d')});db[_0x8be4('0x13')][_0x8be4('0x10e')](db[_0x8be4('0x65')],{'as':_0x8be4('0x113'),'foreignKey':_0x8be4('0x10d')});db[_0x8be4('0x13')]['hasMany'](db[_0x8be4('0x114')],{'as':'SmsInteractions','foreignKey':'UserId'});db[_0x8be4('0x13')]['hasMany'](db[_0x8be4('0x4c')],{'as':_0x8be4('0x115'),'foreignKey':_0x8be4('0x10d')});db[_0x8be4('0x13')][_0x8be4('0x10e')](db['MailInteraction'],{'as':_0x8be4('0x116'),'foreignKey':'UserId'});db['User'][_0x8be4('0x10e')](db[_0x8be4('0xfd')],{'as':_0x8be4('0x117'),'foreignKey':_0x8be4('0x10d')});db[_0x8be4('0x13')][_0x8be4('0x10e')](db[_0x8be4('0xf9')],{'as':'UserNotifications','foreignKey':'SenderId'});db[_0x8be4('0x13')][_0x8be4('0x118')](db[_0x8be4('0xf6')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x8be4('0x119')](db[_0x8be4('0x6a')],{'as':_0x8be4('0x11a'),'through':'chat_group_has_users'});db[_0x8be4('0x13')]['belongsToMany'](db[_0x8be4('0x11b')],{'as':_0x8be4('0x11c'),'through':_0x8be4('0x11d')});db[_0x8be4('0x13')][_0x8be4('0x119')](db['CmList'],{'as':_0x8be4('0x11e'),'through':_0x8be4('0x11f')});db[_0x8be4('0x13')][_0x8be4('0x119')](db[_0x8be4('0xe2')],{'through':_0x8be4('0x120')});db[_0x8be4('0x13')][_0x8be4('0x119')](db[_0x8be4('0x3e')],{'as':_0x8be4('0x116'),'through':_0x8be4('0x121')});db[_0x8be4('0x13')][_0x8be4('0x119')](db[_0x8be4('0x65')],{'as':_0x8be4('0x113'),'through':_0x8be4('0x122')});db[_0x8be4('0x13')][_0x8be4('0x119')](db[_0x8be4('0x4c')],{'as':_0x8be4('0x115'),'through':_0x8be4('0x123')});db[_0x8be4('0x13')]['belongsToMany'](db[_0x8be4('0x114')],{'as':_0x8be4('0x124'),'through':_0x8be4('0x125')});db['User'][_0x8be4('0x119')](db[_0x8be4('0x5c')],{'as':_0x8be4('0x112'),'through':_0x8be4('0x126')});db[_0x8be4('0x13')][_0x8be4('0x119')](db[_0x8be4('0xfd')],{'as':'WhatsappInteractions','through':_0x8be4('0x127')});db[_0x8be4('0x13')]['belongsToMany'](db[_0x8be4('0x1e')],{'as':'VoiceQueues','through':_0x8be4('0x30'),'required':![]});db[_0x8be4('0x13')][_0x8be4('0x119')](db[_0x8be4('0xf5')],{'as':'VoicePrefixes','through':'UserVoicePrefix','required':![]});db[_0x8be4('0x13')][_0x8be4('0x119')](db['MailQueue'],{'as':_0x8be4('0x128'),'through':_0x8be4('0x129'),'required':![]});db[_0x8be4('0x13')][_0x8be4('0x119')](db[_0x8be4('0x12a')],{'as':_0x8be4('0x12b'),'through':_0x8be4('0x12c'),'required':![],'hooks':!![]});db[_0x8be4('0x13')]['belongsToMany'](db['FaxQueue'],{'as':_0x8be4('0x12d'),'through':_0x8be4('0x32'),'required':![]});db[_0x8be4('0x13')]['belongsToMany'](db['SmsQueue'],{'as':_0x8be4('0x12e'),'through':'UserSmsQueue','required':![]});db[_0x8be4('0x13')][_0x8be4('0x119')](db[_0x8be4('0x60')],{'as':_0x8be4('0x12f'),'through':_0x8be4('0x34'),'required':![]});db[_0x8be4('0x13')][_0x8be4('0x119')](db['WhatsappQueue'],{'as':_0x8be4('0x130'),'through':_0x8be4('0x36'),'required':![]});db[_0x8be4('0x13')]['belongsToMany'](db[_0x8be4('0xf4')],{'through':'cm_user_has_lists'});db[_0x8be4('0x13')][_0x8be4('0x119')](db[_0x8be4('0x62')],{'as':_0x8be4('0x131'),'through':'user_has_chat_websites'});db[_0x8be4('0x13')]['belongsToMany'](db['FaxAccount'],{'as':_0x8be4('0x132'),'through':_0x8be4('0x133')});db['User'][_0x8be4('0x119')](db['MailAccount'],{'as':_0x8be4('0x134'),'through':_0x8be4('0x135')});db['User'][_0x8be4('0x119')](db[_0x8be4('0x59')],{'as':_0x8be4('0x136'),'through':'user_has_openchannel_accounts'});db[_0x8be4('0x13')][_0x8be4('0x119')](db[_0x8be4('0x54')],{'as':'SmsAccounts','through':_0x8be4('0x137')});db[_0x8be4('0x13')][_0x8be4('0x119')](db[_0x8be4('0xfb')],{'as':_0x8be4('0x138'),'through':_0x8be4('0x139')});db[_0x8be4('0x13')][_0x8be4('0x119')](db[_0x8be4('0x13a')],{'as':_0x8be4('0x13b'),'through':_0x8be4('0x13c')});db['VoiceChanSpy'][_0x8be4('0x10e')](db['VoiceExtension'],{'as':'SpiedAgents','onDelete':'cascade','foreignKey':_0x8be4('0x13d')});db[_0x8be4('0x18')][_0x8be4('0x10e')](db[_0x8be4('0x1a')],{'onDelete':_0x8be4('0x10c')});db[_0x8be4('0x1a')]['hasMany'](db[_0x8be4('0x1a')],{'as':_0x8be4('0x13e'),'onDelete':_0x8be4('0x10c')});db['VoiceMusicOnHold'][_0x8be4('0x119')](db[_0x8be4('0x8c')],{'as':'Sounds','through':'moh_has_sounds'});db[_0x8be4('0x1e')][_0x8be4('0x10e')](db[_0x8be4('0x2f')],{'as':_0x8be4('0x13f'),'foreignKey':_0x8be4('0x140')});db[_0x8be4('0x1e')]['hasMany'](db[_0x8be4('0x70')],{'as':_0x8be4('0x141'),'foreignKey':'VoiceQueueId'});db[_0x8be4('0x1e')]['hasMany'](db[_0x8be4('0x73')],{'as':_0x8be4('0x111'),'foreignKey':_0x8be4('0x140')});db[_0x8be4('0x1e')][_0x8be4('0x10e')](db[_0x8be4('0x75')],{'as':_0x8be4('0x142'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x8be4('0x10e')](db[_0x8be4('0x77')],{'as':_0x8be4('0x77'),'foreignKey':_0x8be4('0x140')});db[_0x8be4('0x1e')][_0x8be4('0x10e')](db[_0x8be4('0x143')],{'as':'HopperBlacks','foreignKey':_0x8be4('0x140')});db[_0x8be4('0x1e')]['hasMany'](db['JscriptySessionReport'],{'as':_0x8be4('0x144'),'foreignKey':'VoiceQueueId'});db['VoiceQueue']['belongsTo'](db['Trunk'],{'as':'Trunk','foreignKey':_0x8be4('0x145')});db[_0x8be4('0x1e')][_0x8be4('0x118')](db[_0x8be4('0x2d')],{'as':_0x8be4('0x146'),'foreignKey':_0x8be4('0x147')});db['VoiceQueue'][_0x8be4('0x118')](db[_0x8be4('0x84')],{'as':_0x8be4('0x84'),'foreignKey':'IntervalId'});db[_0x8be4('0x1e')][_0x8be4('0x118')](db['Pause'],{'as':_0x8be4('0x148'),'foreignKey':_0x8be4('0x149')});db['VoiceQueue'][_0x8be4('0x119')](db[_0x8be4('0xf4')],{'as':'Lists','through':'voice_queues_has_cm_lists'});db[_0x8be4('0x1e')][_0x8be4('0x119')](db[_0x8be4('0x13')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x8be4('0x1e')][_0x8be4('0x119')](db[_0x8be4('0xe2')],{'as':_0x8be4('0x14a'),'through':_0x8be4('0x14b')});db[_0x8be4('0x1e')][_0x8be4('0x119')](db['CmList'],{'as':'BlackLists','through':_0x8be4('0x14c')});db[_0x8be4('0x14d')][_0x8be4('0x118')](db[_0x8be4('0x13')],{'as':_0x8be4('0x13'),'foreignKey':_0x8be4('0x10d')});db['ScreenRecording'][_0x8be4('0x118')](db[_0x8be4('0x13')],{'as':_0x8be4('0x13'),'foreignKey':_0x8be4('0x10d')});db[_0x8be4('0x10b')][_0x8be4('0x10e')](db[_0x8be4('0x14e')],{'as':'Messages','onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x14f'),'sourceKey':_0x8be4('0x150')});db[_0x8be4('0x14e')][_0x8be4('0x118')](db[_0x8be4('0x10b')],{'foreignKey':_0x8be4('0x14f'),'targetKey':_0x8be4('0x150')});db[_0x8be4('0x24')][_0x8be4('0x10e')](db[_0x8be4('0x29')],{'as':_0x8be4('0x151'),'foreignKey':_0x8be4('0x152'),'constraints':![]});db['VoiceCallReport'][_0x8be4('0x10e')](db[_0x8be4('0x27')],{'as':_0x8be4('0x153'),'foreignKey':_0x8be4('0x152'),'constraints':![]});db['VoiceCallReport'][_0x8be4('0x118')](db['User'],{'as':_0x8be4('0x13'),'foreignKey':'UserId'});db[_0x8be4('0x24')][_0x8be4('0x118')](db['CmContact'],{'as':'Contact','foreignKey':_0x8be4('0x154')});db[_0x8be4('0x38')][_0x8be4('0x118')](db['MailAccount'],{'as':_0x8be4('0x3b'),'foreignKey':_0x8be4('0x155')});db[_0x8be4('0x38')][_0x8be4('0x118')](db[_0x8be4('0x104')],{'as':_0x8be4('0x104'),'foreignKey':_0x8be4('0x156'),'onDelete':_0x8be4('0x157')});db[_0x8be4('0x158')][_0x8be4('0x118')](db[_0x8be4('0x3b')],{'as':'MailAccount','foreignKey':_0x8be4('0x155')});db[_0x8be4('0x158')][_0x8be4('0x118')](db[_0x8be4('0x104')],{'as':_0x8be4('0x104'),'foreignKey':_0x8be4('0x156'),'onDelete':_0x8be4('0x157')});db[_0x8be4('0x3b')][_0x8be4('0x10a')](db[_0x8be4('0x38')],{'as':_0x8be4('0x159'),'onDelete':_0x8be4('0x10c')});db[_0x8be4('0x3b')]['hasOne'](db[_0x8be4('0x158')],{'as':'Smtp','onDelete':'cascade'});db[_0x8be4('0x3b')]['hasMany'](db[_0x8be4('0x80')],{'as':_0x8be4('0x15a'),'foreignKey':'MailAccountId','onDelete':_0x8be4('0x10c')});db[_0x8be4('0x3b')][_0x8be4('0x10e')](db[_0x8be4('0x15b')],{'as':_0x8be4('0x15c'),'foreignKey':'MailAccountId'});db[_0x8be4('0x3b')][_0x8be4('0x10e')](db[_0x8be4('0x40')],{'as':_0x8be4('0x15d'),'foreignKey':_0x8be4('0x155')});db[_0x8be4('0x3b')]['hasMany'](db[_0x8be4('0x3e')],{'as':_0x8be4('0x15e')});db['MailAccount'][_0x8be4('0x10e')](db[_0x8be4('0x15f')],{'as':_0x8be4('0x13e')});db[_0x8be4('0x3b')][_0x8be4('0x118')](db[_0x8be4('0xf4')],{'as':_0x8be4('0x160'),'foreignKey':'ListId'});db[_0x8be4('0x3b')][_0x8be4('0x118')](db[_0x8be4('0x90')],{'as':_0x8be4('0x90'),'foreignKey':_0x8be4('0x161')});db['MailAccount'][_0x8be4('0x118')](db[_0x8be4('0x86')],{'as':_0x8be4('0x148'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x8be4('0x3b')]['belongsToMany'](db['User'],{'as':_0x8be4('0x162'),'through':_0x8be4('0x135')});db[_0x8be4('0x163')][_0x8be4('0x119')](db[_0x8be4('0x13')],{'as':'Agents','through':_0x8be4('0x129')});db[_0x8be4('0x163')][_0x8be4('0x119')](db[_0x8be4('0xe2')],{'through':_0x8be4('0x164'),'as':_0x8be4('0x14a')});db[_0x8be4('0x3e')][_0x8be4('0x10e')](db[_0x8be4('0x40')],{'as':_0x8be4('0x15d'),'onDelete':'cascade','foreignKey':'MailInteractionId'});db[_0x8be4('0x3e')][_0x8be4('0x118')](db[_0x8be4('0x3b')],{'as':_0x8be4('0x165'),'foreignKey':_0x8be4('0x155')});db[_0x8be4('0x3e')][_0x8be4('0x118')](db['CmContact'],{'as':_0x8be4('0x166'),'foreignKey':_0x8be4('0x154')});db['MailInteraction'][_0x8be4('0x118')](db[_0x8be4('0x13')],{'as':_0x8be4('0x167'),'foreignKey':'UserId'});db[_0x8be4('0x3e')][_0x8be4('0x119')](db['Tag'],{'through':_0x8be4('0x168'),'as':'Tags'});db[_0x8be4('0x3e')][_0x8be4('0x119')](db[_0x8be4('0x8e')],{'through':_0x8be4('0x168'),'as':'ThroughTags'});db[_0x8be4('0x3e')][_0x8be4('0x119')](db[_0x8be4('0x13')],{'as':'Users','through':'user_has_mail_interactions','foreignKey':_0x8be4('0x169')});db[_0x8be4('0x40')][_0x8be4('0x10e')](db['Attachment'],{'as':'Attachments','onDelete':'cascade'});db[_0x8be4('0x40')][_0x8be4('0x118')](db[_0x8be4('0x13')],{'as':_0x8be4('0x13')});db[_0x8be4('0x40')][_0x8be4('0x118')](db[_0x8be4('0x11b')],{'onDelete':'cascade','as':_0x8be4('0x166')});db[_0x8be4('0x40')][_0x8be4('0x118')](db[_0x8be4('0x3e')],{'as':'Interaction','foreignKey':_0x8be4('0x169')});db['MailMessage'][_0x8be4('0x118')](db[_0x8be4('0x3b')],{'as':_0x8be4('0x165'),'foreignKey':'MailAccountId'});db[_0x8be4('0x40')][_0x8be4('0x118')](db[_0x8be4('0x62')],{'as':_0x8be4('0x62'),'foreignKey':_0x8be4('0x16a')});db[_0x8be4('0x40')]['belongsTo'](db[_0x8be4('0x68')],{'as':_0x8be4('0x68'),'foreignKey':'ChatOfflineMessageId'});db[_0x8be4('0x15f')][_0x8be4('0x118')](db[_0x8be4('0x13')],{'onDelete':_0x8be4('0x157')});db['MailApplication']['belongsTo'](db[_0x8be4('0x163')],{'onDelete':_0x8be4('0x157')});db[_0x8be4('0x15f')][_0x8be4('0x118')](db[_0x8be4('0x3b')],{'onDelete':_0x8be4('0x157')});db[_0x8be4('0x15f')][_0x8be4('0x118')](db[_0x8be4('0x84')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x8be4('0x15f')][_0x8be4('0x118')](db['Tag'],{'onDelete':_0x8be4('0x157'),'foreignKey':_0x8be4('0x16b')});db[_0x8be4('0x43')][_0x8be4('0x118')](db[_0x8be4('0x3b')],{});db[_0x8be4('0x43')][_0x8be4('0x118')](db[_0x8be4('0xf4')],{'as':_0x8be4('0x160'),'foreignKey':_0x8be4('0x16c')});db[_0x8be4('0x43')][_0x8be4('0x118')](db[_0x8be4('0x11b')],{'as':_0x8be4('0x166'),'foreignKey':_0x8be4('0x154')});db[_0x8be4('0x43')][_0x8be4('0x118')](db[_0x8be4('0x3e')],{});db[_0x8be4('0x43')][_0x8be4('0x118')](db[_0x8be4('0x40')],{});db[_0x8be4('0x43')][_0x8be4('0x118')](db[_0x8be4('0x13')],{});db[_0x8be4('0x43')][_0x8be4('0x118')](db['MailQueue'],{});db[_0x8be4('0x45')][_0x8be4('0x10e')](db[_0x8be4('0x16d')],{'as':_0x8be4('0x16e'),'onDelete':_0x8be4('0x10c')});db[_0x8be4('0x48')][_0x8be4('0x10e')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x8be4('0x16f'),'onDelete':_0x8be4('0x10c')});db[_0x8be4('0x48')][_0x8be4('0x10e')](db['CannedAnswer'],{'as':_0x8be4('0x15c'),'foreignKey':'FaxAccountId'});db[_0x8be4('0x48')][_0x8be4('0x10e')](db[_0x8be4('0x4c')],{'as':'Interactions'});db[_0x8be4('0x48')][_0x8be4('0x10e')](db[_0x8be4('0x4a')],{'as':_0x8be4('0x13e')});db[_0x8be4('0x48')][_0x8be4('0x10e')](db[_0x8be4('0x1a')],{'as':'Exntensions','onDelete':_0x8be4('0x10c')});db[_0x8be4('0x48')][_0x8be4('0x10e')](db['FaxMessage'],{'as':_0x8be4('0x15d')});db[_0x8be4('0x48')]['belongsTo'](db[_0x8be4('0x2d')],{'as':_0x8be4('0x2d')});db[_0x8be4('0x48')][_0x8be4('0x118')](db[_0x8be4('0xf4')],{'as':_0x8be4('0x160'),'foreignKey':_0x8be4('0x16c')});db['FaxAccount'][_0x8be4('0x118')](db[_0x8be4('0x86')],{'as':_0x8be4('0x148'),'foreignKey':_0x8be4('0x149')});db[_0x8be4('0x48')][_0x8be4('0x119')](db[_0x8be4('0x13')],{'as':'Agents','through':_0x8be4('0x133')});db[_0x8be4('0x4a')][_0x8be4('0x118')](db[_0x8be4('0x13')],{'onDelete':_0x8be4('0x157')});db[_0x8be4('0x4a')][_0x8be4('0x118')](db['FaxQueue'],{'onDelete':'restrict'});db[_0x8be4('0x4a')]['belongsTo'](db['FaxAccount'],{'onDelete':'restrict'});db['FaxApplication'][_0x8be4('0x118')](db['Tag'],{'onDelete':_0x8be4('0x157'),'foreignKey':_0x8be4('0x16b')});db[_0x8be4('0x4c')][_0x8be4('0x10e')](db[_0x8be4('0x4e')],{'as':_0x8be4('0x15d'),'onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x170')});db[_0x8be4('0x4c')]['belongsTo'](db[_0x8be4('0x48')],{'as':_0x8be4('0x165'),'foreignKey':'FaxAccountId'});db[_0x8be4('0x4c')][_0x8be4('0x118')](db[_0x8be4('0x11b')],{'as':_0x8be4('0x166'),'foreignKey':_0x8be4('0x154')});db['FaxInteraction'][_0x8be4('0x118')](db[_0x8be4('0x13')],{'as':_0x8be4('0x167'),'foreignKey':'UserId'});db['FaxInteraction'][_0x8be4('0x119')](db[_0x8be4('0x8e')],{'through':'fax_interaction_has_tags','as':_0x8be4('0x171')});db['FaxInteraction'][_0x8be4('0x119')](db[_0x8be4('0x8e')],{'through':'fax_interaction_has_tags','as':_0x8be4('0x172')});db[_0x8be4('0x4c')][_0x8be4('0x119')](db[_0x8be4('0x13')],{'as':_0x8be4('0x173'),'through':_0x8be4('0x123'),'foreignKey':_0x8be4('0x170')});db['FaxMessage'][_0x8be4('0x118')](db[_0x8be4('0x13')],{'onDelete':_0x8be4('0x10c'),'as':'User'});db[_0x8be4('0x4e')][_0x8be4('0x118')](db[_0x8be4('0x4c')],{'as':_0x8be4('0x174'),'foreignKey':_0x8be4('0x170')});db[_0x8be4('0x4e')][_0x8be4('0x118')](db[_0x8be4('0x11b')],{'onDelete':_0x8be4('0x10c'),'as':_0x8be4('0x166')});db['FaxMessage'][_0x8be4('0x118')](db[_0x8be4('0x175')],{'as':_0x8be4('0x175'),'foreignKey':_0x8be4('0x176')});db[_0x8be4('0x4e')]['belongsTo'](db[_0x8be4('0x48')],{'as':_0x8be4('0x165'),'foreignKey':_0x8be4('0x16f')});db[_0x8be4('0x50')][_0x8be4('0x119')](db[_0x8be4('0x13')],{'as':'Agents','through':'UserFaxQueue'});db[_0x8be4('0x50')]['belongsToMany'](db[_0x8be4('0xe2')],{'through':_0x8be4('0x177'),'as':_0x8be4('0x14a')});db[_0x8be4('0x52')]['belongsTo'](db[_0x8be4('0x48')],{});db[_0x8be4('0x52')][_0x8be4('0x118')](db[_0x8be4('0xf4')],{'as':_0x8be4('0x160'),'foreignKey':'ListId'});db['FaxQueueReport'][_0x8be4('0x118')](db[_0x8be4('0x11b')],{'as':_0x8be4('0x166'),'foreignKey':'ContactId'});db[_0x8be4('0x52')]['belongsTo'](db['FaxInteraction'],{});db['FaxQueueReport']['belongsTo'](db['FaxMessage'],{});db[_0x8be4('0x52')]['belongsTo'](db['User'],{});db[_0x8be4('0x52')][_0x8be4('0x118')](db['FaxQueue'],{});db[_0x8be4('0x54')]['hasMany'](db[_0x8be4('0x80')],{'as':_0x8be4('0x15a'),'foreignKey':_0x8be4('0x178'),'onDelete':_0x8be4('0x10c')});db['SmsAccount'][_0x8be4('0x10e')](db[_0x8be4('0x15b')],{'as':_0x8be4('0x15c'),'foreignKey':_0x8be4('0x178')});db[_0x8be4('0x54')][_0x8be4('0x10e')](db['SmsMessage'],{'as':_0x8be4('0x15d'),'foreignKey':'SmsAccountId'});db['SmsAccount']['hasMany'](db['SmsInteraction'],{'as':_0x8be4('0x15e')});db[_0x8be4('0x54')][_0x8be4('0x10e')](db[_0x8be4('0x56')],{'as':_0x8be4('0x13e')});db[_0x8be4('0x54')][_0x8be4('0x118')](db[_0x8be4('0xf4')],{'as':_0x8be4('0x160'),'foreignKey':'ListId'});db[_0x8be4('0x54')][_0x8be4('0x118')](db[_0x8be4('0x86')],{'as':_0x8be4('0x148'),'foreignKey':_0x8be4('0x149')});db[_0x8be4('0x54')]['belongsToMany'](db[_0x8be4('0x13')],{'as':_0x8be4('0x162'),'through':_0x8be4('0x137')});db[_0x8be4('0x56')]['belongsTo'](db[_0x8be4('0x13')],{'onDelete':_0x8be4('0x157')});db['SmsApplication'][_0x8be4('0x118')](db[_0x8be4('0x58')],{'onDelete':_0x8be4('0x157')});db[_0x8be4('0x56')]['belongsTo'](db[_0x8be4('0x54')],{'onDelete':_0x8be4('0x157')});db[_0x8be4('0x56')][_0x8be4('0x118')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x8be4('0x179')});db[_0x8be4('0x56')][_0x8be4('0x118')](db[_0x8be4('0x8e')],{'onDelete':_0x8be4('0x157'),'foreignKey':_0x8be4('0x16b')});db[_0x8be4('0x114')]['hasMany'](db[_0x8be4('0x17a')],{'as':'Messages','onDelete':_0x8be4('0x10c'),'foreignKey':'SmsInteractionId'});db['SmsInteraction'][_0x8be4('0x118')](db['SmsAccount'],{'as':_0x8be4('0x165'),'foreignKey':'SmsAccountId'});db[_0x8be4('0x114')][_0x8be4('0x118')](db[_0x8be4('0x11b')],{'as':_0x8be4('0x166'),'foreignKey':_0x8be4('0x154')});db[_0x8be4('0x114')][_0x8be4('0x118')](db['User'],{'as':_0x8be4('0x167'),'foreignKey':_0x8be4('0x10d')});db['SmsInteraction'][_0x8be4('0x119')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0x8be4('0x171')});db[_0x8be4('0x114')][_0x8be4('0x119')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0x8be4('0x172')});db['SmsInteraction'][_0x8be4('0x119')](db[_0x8be4('0x13')],{'as':_0x8be4('0x173'),'through':_0x8be4('0x125'),'foreignKey':_0x8be4('0x17b')});db[_0x8be4('0x17a')]['belongsTo'](db[_0x8be4('0x13')],{'as':_0x8be4('0x13')});db[_0x8be4('0x17a')][_0x8be4('0x118')](db[_0x8be4('0x11b')],{'onDelete':_0x8be4('0x10c'),'as':'Contact'});db[_0x8be4('0x17a')][_0x8be4('0x118')](db['SmsInteraction'],{'onDelete':_0x8be4('0x10c'),'as':_0x8be4('0x174'),'foreignKey':_0x8be4('0x17b')});db[_0x8be4('0x17a')]['belongsTo'](db[_0x8be4('0x54')],{'as':_0x8be4('0x165'),'foreignKey':_0x8be4('0x178')});db[_0x8be4('0x58')][_0x8be4('0x119')](db[_0x8be4('0x13')],{'as':'Agents','through':_0x8be4('0x17c'),'foreignKey':_0x8be4('0x17d')});db[_0x8be4('0x58')][_0x8be4('0x119')](db[_0x8be4('0xe2')],{'through':_0x8be4('0x17e'),'as':_0x8be4('0x14a')});db[_0x8be4('0x59')][_0x8be4('0x10e')](db[_0x8be4('0x80')],{'as':_0x8be4('0x15a'),'foreignKey':'OpenchannelAccountId','onDelete':_0x8be4('0x10c')});db[_0x8be4('0x59')][_0x8be4('0x10e')](db[_0x8be4('0x15b')],{'as':_0x8be4('0x15c'),'foreignKey':_0x8be4('0x17f')});db[_0x8be4('0x59')][_0x8be4('0x10e')](db['OpenchannelInteraction'],{'as':_0x8be4('0x15e'),'foreignKey':_0x8be4('0x17f')});db[_0x8be4('0x59')]['hasMany'](db[_0x8be4('0x5e')],{'as':_0x8be4('0x15d'),'foreignKey':_0x8be4('0x17f')});db[_0x8be4('0x59')][_0x8be4('0x10e')](db[_0x8be4('0x5a')],{'as':_0x8be4('0x13e'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x8be4('0x118')](db['CmList'],{'as':_0x8be4('0x160'),'foreignKey':_0x8be4('0x16c')});db[_0x8be4('0x59')]['belongsTo'](db[_0x8be4('0x86')],{'as':'mandatoryDispositionPause','foreignKey':_0x8be4('0x149')});db['OpenchannelAccount'][_0x8be4('0x119')](db[_0x8be4('0x13')],{'as':_0x8be4('0x162'),'through':_0x8be4('0x180')});db[_0x8be4('0x5a')][_0x8be4('0x118')](db['User'],{'onDelete':'restrict'});db[_0x8be4('0x5a')][_0x8be4('0x118')](db[_0x8be4('0x60')],{'onDelete':_0x8be4('0x157'),'foreignKey':_0x8be4('0x181')});db[_0x8be4('0x5a')][_0x8be4('0x118')](db['OpenchannelAccount'],{'onDelete':_0x8be4('0x157'),'foreignKey':_0x8be4('0x17f')});db['OpenchannelApplication'][_0x8be4('0x118')](db[_0x8be4('0x84')],{'onDelete':'restrict','foreignKey':'IntervalId'});db['OpenchannelApplication'][_0x8be4('0x118')](db[_0x8be4('0x8e')],{'onDelete':_0x8be4('0x157'),'foreignKey':'TagId'});db[_0x8be4('0x5c')][_0x8be4('0x10e')](db[_0x8be4('0x5e')],{'as':_0x8be4('0x15d'),'onDelete':_0x8be4('0x10c'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelInteraction']['belongsTo'](db[_0x8be4('0x59')],{'as':_0x8be4('0x165'),'foreignKey':_0x8be4('0x17f')});db[_0x8be4('0x5c')]['belongsTo'](db['CmContact'],{'as':_0x8be4('0x166'),'foreignKey':'ContactId'});db[_0x8be4('0x5c')]['belongsTo'](db[_0x8be4('0x13')],{'as':'Owner','foreignKey':_0x8be4('0x10d')});db['OpenchannelInteraction'][_0x8be4('0x119')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x8be4('0x171')});db['OpenchannelInteraction']['belongsToMany'](db[_0x8be4('0x8e')],{'through':'openchannel_interaction_has_tags','as':_0x8be4('0x172')});db[_0x8be4('0x5c')]['belongsToMany'](db[_0x8be4('0x13')],{'as':'Users','through':_0x8be4('0x126'),'foreignKey':_0x8be4('0x182')});db[_0x8be4('0x5e')][_0x8be4('0x118')](db[_0x8be4('0x13')],{'onDelete':_0x8be4('0x10c'),'as':_0x8be4('0x13')});db['OpenchannelMessage'][_0x8be4('0x118')](db[_0x8be4('0x11b')],{'onDelete':_0x8be4('0x10c'),'as':_0x8be4('0x166')});db[_0x8be4('0x5e')][_0x8be4('0x118')](db['OpenchannelInteraction'],{'onDelete':_0x8be4('0x10c'),'as':_0x8be4('0x174'),'foreignKey':_0x8be4('0x182')});db[_0x8be4('0x5e')][_0x8be4('0x118')](db[_0x8be4('0x175')],{'as':_0x8be4('0x175'),'foreignKey':_0x8be4('0x176')});db[_0x8be4('0x5e')][_0x8be4('0x118')](db[_0x8be4('0x59')],{'as':'Account','foreignKey':_0x8be4('0x17f')});db['OpenchannelQueue']['belongsToMany'](db[_0x8be4('0x13')],{'as':_0x8be4('0x162'),'through':'UserOpenchannelQueue','foreignKey':_0x8be4('0x181')});db['OpenchannelQueue'][_0x8be4('0x119')](db[_0x8be4('0xe2')],{'through':_0x8be4('0x183'),'as':_0x8be4('0x14a')});db['ChatWebsite']['hasMany'](db['Disposition'],{'as':_0x8be4('0x15a'),'foreignKey':_0x8be4('0x16a'),'onDelete':_0x8be4('0x10c')});db[_0x8be4('0x62')][_0x8be4('0x10e')](db['CannedAnswer'],{'as':_0x8be4('0x15c'),'foreignKey':_0x8be4('0x16a')});db[_0x8be4('0x62')][_0x8be4('0x10e')](db[_0x8be4('0x6c')],{'as':_0x8be4('0x184')});db[_0x8be4('0x62')][_0x8be4('0x10e')](db[_0x8be4('0x65')],{'as':_0x8be4('0x15e')});db['ChatWebsite']['hasMany'](db[_0x8be4('0x185')],{'as':'Applications'});db['ChatWebsite'][_0x8be4('0x10e')](db['ChatMessage'],{'as':_0x8be4('0x15d')});db[_0x8be4('0x62')][_0x8be4('0x118')](db[_0x8be4('0xf4')],{'as':_0x8be4('0x160'),'foreignKey':_0x8be4('0x16c')});db[_0x8be4('0x62')]['belongsTo'](db[_0x8be4('0x84')],{'as':'Interval','foreignKey':_0x8be4('0x179')});db[_0x8be4('0x62')][_0x8be4('0x118')](db[_0x8be4('0x3b')],{'as':_0x8be4('0x3b'),'foreignKey':_0x8be4('0x155')});db[_0x8be4('0x62')]['belongsTo'](db[_0x8be4('0x86')],{'as':'mandatoryDispositionPause','foreignKey':_0x8be4('0x149')});db[_0x8be4('0x62')][_0x8be4('0x119')](db[_0x8be4('0x13')],{'as':'Agents','through':_0x8be4('0x186')});db[_0x8be4('0x63')][_0x8be4('0x118')](db[_0x8be4('0x59')],{});db[_0x8be4('0x63')][_0x8be4('0x118')](db[_0x8be4('0xf4')],{'as':_0x8be4('0x160'),'foreignKey':'ListId'});db[_0x8be4('0x63')][_0x8be4('0x118')](db[_0x8be4('0x11b')],{'as':'Contact','foreignKey':_0x8be4('0x154')});db[_0x8be4('0x63')][_0x8be4('0x118')](db['OpenchannelInteraction'],{});db[_0x8be4('0x63')]['belongsTo'](db['OpenchannelMessage'],{});db[_0x8be4('0x63')]['belongsTo'](db[_0x8be4('0x13')],{});db[_0x8be4('0x63')][_0x8be4('0x118')](db[_0x8be4('0x60')],{});db['ChatApplication'][_0x8be4('0x118')](db[_0x8be4('0x13')],{'as':'Agent','foreignKey':_0x8be4('0x10d'),'onDelete':_0x8be4('0x157')});db[_0x8be4('0x185')]['belongsTo'](db[_0x8be4('0x12a')],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':_0x8be4('0x157')});db['ChatApplication'][_0x8be4('0x118')](db[_0x8be4('0x62')],{'as':_0x8be4('0x187'),'foreignKey':_0x8be4('0x16a'),'onDelete':'restrict'});db[_0x8be4('0x185')][_0x8be4('0x118')](db['Tag'],{'onDelete':_0x8be4('0x157'),'foreignKey':'TagId'});db[_0x8be4('0x65')]['hasMany'](db[_0x8be4('0x188')],{'as':'Messages','onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x189')});db[_0x8be4('0x65')][_0x8be4('0x118')](db['ChatWebsite'],{'as':_0x8be4('0x165'),'foreignKey':_0x8be4('0x16a')});db[_0x8be4('0x65')][_0x8be4('0x118')](db[_0x8be4('0x11b')],{'as':_0x8be4('0x166'),'foreignKey':'ContactId'});db[_0x8be4('0x65')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x8be4('0x10d')});db[_0x8be4('0x65')][_0x8be4('0x119')](db[_0x8be4('0x8e')],{'through':_0x8be4('0x18a'),'as':'Tags'});db[_0x8be4('0x65')][_0x8be4('0x119')](db[_0x8be4('0x8e')],{'through':_0x8be4('0x18a'),'as':'ThroughTags'});db[_0x8be4('0x65')][_0x8be4('0x119')](db[_0x8be4('0x13')],{'as':_0x8be4('0x173'),'through':_0x8be4('0x122'),'foreignKey':'ChatInteractionId'});db[_0x8be4('0x188')]['belongsTo'](db[_0x8be4('0x13')],{'onDelete':'cascade','as':'User'});db['ChatMessage'][_0x8be4('0x118')](db['CmContact'],{'onDelete':'cascade','as':_0x8be4('0x166'),'foreignKey':'ContactId'});db[_0x8be4('0x188')]['belongsTo'](db['ChatInteraction'],{'onDelete':_0x8be4('0x10c'),'as':_0x8be4('0x174'),'foreignKey':_0x8be4('0x189')});db[_0x8be4('0x188')][_0x8be4('0x118')](db[_0x8be4('0x175')],{'as':'Attachment','foreignKey':_0x8be4('0x176')});db[_0x8be4('0x188')]['belongsTo'](db[_0x8be4('0x62')],{'as':_0x8be4('0x165'),'foreignKey':'ChatWebsiteId'});db[_0x8be4('0x68')][_0x8be4('0x10e')](db[_0x8be4('0x175')],{'as':_0x8be4('0x18b'),'foreignKey':'ChatOfflineMessageId','onDelete':'cascade','hooks':!![]});db[_0x8be4('0x68')]['belongsTo'](db[_0x8be4('0x11b')],{'onDelete':_0x8be4('0x10c'),'as':_0x8be4('0x166'),'foreignKey':_0x8be4('0x154')});db[_0x8be4('0x68')][_0x8be4('0x118')](db[_0x8be4('0x62')],{'as':_0x8be4('0x165'),'foreignKey':'ChatWebsiteId'});db[_0x8be4('0x12a')][_0x8be4('0x119')](db[_0x8be4('0x13')],{'as':'Agents','through':_0x8be4('0x12c'),'hooks':!![]});db['ChatQueue'][_0x8be4('0x119')](db[_0x8be4('0xe2')],{'through':_0x8be4('0x18c'),'as':_0x8be4('0x14a')});db['ChatGroup'][_0x8be4('0x10e')](db['ChatInternalMessage'],{'as':_0x8be4('0x15d'),'foreignKey':_0x8be4('0x18d'),'onDelete':_0x8be4('0x10c')});db[_0x8be4('0x6a')][_0x8be4('0x119')](db['User'],{'as':_0x8be4('0x13f'),'through':'chat_group_has_users'});db[_0x8be4('0x6c')]['belongsTo'](db['ChatWebsite'],{'as':_0x8be4('0x187'),'foreignKey':_0x8be4('0x16a')});db['CmCompany']['hasMany'](db[_0x8be4('0x11b')],{'as':_0x8be4('0x11c'),'foreignKey':_0x8be4('0x18e')});db[_0x8be4('0x11b')][_0x8be4('0x10e')](db[_0x8be4('0x70')],{'as':'Hoppers','foreignKey':_0x8be4('0x154')});db[_0x8be4('0x11b')][_0x8be4('0x10e')](db[_0x8be4('0x73')],{'as':_0x8be4('0x111'),'foreignKey':_0x8be4('0x154')});db[_0x8be4('0x11b')][_0x8be4('0x10e')](db['CmHopperHistory'],{'as':_0x8be4('0x142'),'foreignKey':_0x8be4('0x154')});db[_0x8be4('0x11b')][_0x8be4('0x10e')](db[_0x8be4('0x77')],{'as':_0x8be4('0x77'),'foreignKey':_0x8be4('0x154')});db['CmContact'][_0x8be4('0x10e')](db[_0x8be4('0x18f')],{'as':'JscriptySessions','foreignKey':_0x8be4('0x154')});db[_0x8be4('0x11b')][_0x8be4('0x10e')](db['OpenchannelInteraction'],{'as':_0x8be4('0x112'),'foreignKey':'ContactId','onDelete':_0x8be4('0x157')});db['CmContact'][_0x8be4('0x10e')](db[_0x8be4('0x65')],{'as':_0x8be4('0x113'),'foreignKey':_0x8be4('0x154'),'onDelete':_0x8be4('0x157')});db[_0x8be4('0x11b')][_0x8be4('0x10e')](db[_0x8be4('0x114')],{'as':_0x8be4('0x124'),'foreignKey':_0x8be4('0x154'),'onDelete':_0x8be4('0x157')});db['CmContact'][_0x8be4('0x10e')](db[_0x8be4('0x4c')],{'as':_0x8be4('0x115'),'foreignKey':_0x8be4('0x154'),'onDelete':_0x8be4('0x157')});db[_0x8be4('0x11b')][_0x8be4('0x10e')](db[_0x8be4('0x3e')],{'as':_0x8be4('0x116'),'foreignKey':'ContactId','onDelete':'restrict'});db['CmContact'][_0x8be4('0x118')](db[_0x8be4('0x6e')],{'as':_0x8be4('0x190'),'foreignKey':_0x8be4('0x18e')});db['CmContact']['belongsTo'](db[_0x8be4('0xf4')],{'as':_0x8be4('0x160'),'foreignKey':_0x8be4('0x16c'),'onDelete':_0x8be4('0x10c')});db[_0x8be4('0x11b')][_0x8be4('0x119')](db[_0x8be4('0x13')],{'as':'Users','through':'cm_user_has_contacts'});db[_0x8be4('0x11b')]['belongsToMany'](db[_0x8be4('0x8e')],{'as':_0x8be4('0x171'),'through':_0x8be4('0x191')});db[_0x8be4('0x11b')][_0x8be4('0x119')](db[_0x8be4('0x8e')],{'through':_0x8be4('0x191'),'as':_0x8be4('0x172')});db[_0x8be4('0x70')][_0x8be4('0x118')](db[_0x8be4('0x11b')],{'as':'Contact','foreignKey':_0x8be4('0x154'),'onDelete':_0x8be4('0x10c')});db[_0x8be4('0x70')][_0x8be4('0x118')](db[_0x8be4('0xf4')],{'as':_0x8be4('0x160'),'foreignKey':_0x8be4('0x16c'),'onDelete':'cascade'});db[_0x8be4('0x70')][_0x8be4('0x118')](db[_0x8be4('0x13')],{'as':_0x8be4('0x192'),'foreignKey':_0x8be4('0x10d')});db['CmHopper'][_0x8be4('0x118')](db[_0x8be4('0x1e')],{'as':_0x8be4('0x193'),'foreignKey':_0x8be4('0x140'),'onDelete':_0x8be4('0x10c')});db[_0x8be4('0x70')][_0x8be4('0x118')](db[_0x8be4('0xe6')],{'as':_0x8be4('0xe6'),'foreignKey':_0x8be4('0x194'),'onDelete':'cascade'});db[_0x8be4('0x70')]['belongsTo'](db[_0x8be4('0x13')],{'as':_0x8be4('0x167'),'foreignKey':_0x8be4('0x195')});db[_0x8be4('0x143')][_0x8be4('0x118')](db['CmContact'],{'as':_0x8be4('0x166'),'foreignKey':_0x8be4('0x154'),'onDelete':_0x8be4('0x10c')});db[_0x8be4('0x143')][_0x8be4('0x118')](db[_0x8be4('0xf4')],{'as':_0x8be4('0x160'),'foreignKey':_0x8be4('0x16c'),'onDelete':_0x8be4('0x10c')});db[_0x8be4('0x143')][_0x8be4('0x118')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x8be4('0x140'),'onDelete':_0x8be4('0x10c')});db['CmHopperBlack'][_0x8be4('0x118')](db[_0x8be4('0xe6')],{'as':_0x8be4('0xe6'),'foreignKey':'CampaignId','onDelete':_0x8be4('0x10c')});db[_0x8be4('0x7d')][_0x8be4('0x10e')](db['Condition'],{'as':{'plural':_0x8be4('0x196'),'singular':_0x8be4('0x197')},'foreignKey':_0x8be4('0x198'),'onDelete':_0x8be4('0x10c'),'hooks':!![]});db[_0x8be4('0x7d')][_0x8be4('0x10e')](db[_0x8be4('0x82')],{'as':{'plural':'Any','singular':_0x8be4('0x199')},'foreignKey':'AutomationAnyId','onDelete':'cascade','hooks':!![]});db[_0x8be4('0x7d')]['hasMany'](db[_0x8be4('0x7b')],{'as':_0x8be4('0x19a'),'foreignKey':_0x8be4('0x19b'),'onDelete':_0x8be4('0x10c'),'hooks':!![]});db[_0x8be4('0x80')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':'ParentId','onDelete':_0x8be4('0x10c')});db[_0x8be4('0x84')][_0x8be4('0x10e')](db[_0x8be4('0x84')],{'as':_0x8be4('0x19c'),'foreignKey':'IntervalId','onDelete':_0x8be4('0x10c'),'hooks':!![],'required':![]});db[_0x8be4('0x84')][_0x8be4('0x10e')](db[_0x8be4('0x1a')],{'as':'Extensions','foreignKey':_0x8be4('0x179'),'onDelete':_0x8be4('0x157')});db[_0x8be4('0x84')]['hasMany'](db[_0x8be4('0x15f')],{'as':_0x8be4('0x19d'),'foreignKey':_0x8be4('0x179')});db[_0x8be4('0x84')][_0x8be4('0x10e')](db['ChatApplication'],{'as':_0x8be4('0x19e'),'foreignKey':_0x8be4('0x179')});db[_0x8be4('0x84')][_0x8be4('0x10e')](db['FaxApplication'],{'as':'FaxApplications','foreignKey':_0x8be4('0x179')});db[_0x8be4('0x84')][_0x8be4('0x10e')](db[_0x8be4('0x56')],{'as':'SmsApplications','foreignKey':'IntervalId'});db[_0x8be4('0x19f')][_0x8be4('0x118')](db[_0x8be4('0x3b')],{});db[_0x8be4('0x19f')][_0x8be4('0x118')](db['AnalyticDefaultReport'],{'foreignKey':_0x8be4('0x1a0')});db[_0x8be4('0x19f')][_0x8be4('0x118')](db[_0x8be4('0x96')],{'foreignKey':_0x8be4('0x1a1')});db[_0x8be4('0x8c')][_0x8be4('0x119')](db[_0x8be4('0x1c')],{'as':_0x8be4('0x1a2'),'through':_0x8be4('0x1a3'),'onDelete':_0x8be4('0x157')});db[_0x8be4('0x8e')][_0x8be4('0x119')](db[_0x8be4('0x11b')],{'through':_0x8be4('0x191')});db[_0x8be4('0x8e')][_0x8be4('0x119')](db[_0x8be4('0x65')],{'through':_0x8be4('0x18a')});db[_0x8be4('0x8e')][_0x8be4('0x119')](db[_0x8be4('0x3e')],{'through':_0x8be4('0x168')});db[_0x8be4('0x8e')][_0x8be4('0x119')](db['SmsInteraction'],{'through':_0x8be4('0x1a4')});db[_0x8be4('0x8e')]['belongsToMany'](db['FaxInteraction'],{'through':'fax_interaction_has_tags'});db[_0x8be4('0x8e')]['belongsToMany'](db[_0x8be4('0x5c')],{'through':'openchannel_interaction_has_tags'});db[_0x8be4('0x8e')][_0x8be4('0x119')](db[_0x8be4('0xfd')],{'through':_0x8be4('0x1a5')});db[_0x8be4('0x92')][_0x8be4('0x10e')](db[_0x8be4('0x82')],{'as':{'plural':_0x8be4('0x1a6'),'singular':_0x8be4('0x1a7')},'foreignKey':_0x8be4('0x1a8'),'onDelete':'cascade','hooks':!![]});db[_0x8be4('0x92')][_0x8be4('0x10e')](db[_0x8be4('0x82')],{'as':{'plural':_0x8be4('0x1a9'),'singular':_0x8be4('0x1aa')},'foreignKey':_0x8be4('0x1ab'),'onDelete':'cascade','hooks':!![]});db['Trigger'][_0x8be4('0x10e')](db['Action'],{'as':_0x8be4('0x19a'),'foreignKey':'TriggerId','onDelete':_0x8be4('0x10c'),'hooks':!![]});db[_0x8be4('0x96')][_0x8be4('0x10e')](db[_0x8be4('0x99')],{'as':_0x8be4('0x1ac'),'onDelete':'cascade','foreignKey':'CustomReportId','hooks':!![]});db[_0x8be4('0x1ad')][_0x8be4('0x10e')](db[_0x8be4('0x99')],{'as':'Fields','onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x1a0')});db[_0x8be4('0x1ae')][_0x8be4('0x10e')](db[_0x8be4('0x99')],{'as':_0x8be4('0x1ac'),'onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x1af')});db[_0x8be4('0x99')][_0x8be4('0x118')](db['AnalyticMetric'],{'foreignKey':'MetricId'});db[_0x8be4('0x9d')][_0x8be4('0x10e')](db['SalesforceConfiguration'],{'as':_0x8be4('0x1b0'),'onDelete':_0x8be4('0x10c'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x8be4('0x10e')](db['SalesforceField'],{'as':_0x8be4('0x1b1'),'onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x1b2')});db['SalesforceConfiguration']['hasMany'](db[_0x8be4('0xa1')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x8be4('0x9f')][_0x8be4('0x10e')](db[_0x8be4('0xa1')],{'as':_0x8be4('0x1ac'),'onDelete':'cascade','foreignKey':_0x8be4('0x1b3')});db[_0x8be4('0x9f')]['belongsTo'](db['SalesforceAccount'],{'as':_0x8be4('0x165'),'foreignKey':_0x8be4('0x1b4')});db[_0x8be4('0xa1')]['hasMany'](db[_0x8be4('0xa1')],{'as':_0x8be4('0x1b5'),'foreignKey':_0x8be4('0x1b2')});db[_0x8be4('0xa1')][_0x8be4('0x10e')](db[_0x8be4('0xa1')],{'as':'Description','foreignKey':_0x8be4('0x1b6')});db[_0x8be4('0xa1')][_0x8be4('0x10e')](db[_0x8be4('0xa1')],{'as':_0x8be4('0x1b7'),'foreignKey':_0x8be4('0x1b3')});db['SalesforceField'][_0x8be4('0x118')](db[_0x8be4('0x1b8')],{'as':'Variable','foreignKey':_0x8be4('0x1b9')});db[_0x8be4('0xa3')][_0x8be4('0x10e')](db['SugarcrmConfiguration'],{'as':_0x8be4('0x1b0'),'onDelete':_0x8be4('0x10c'),'foreignKey':'AccountId'});db[_0x8be4('0xa5')][_0x8be4('0x10e')](db[_0x8be4('0xa6')],{'as':_0x8be4('0x1b1'),'onDelete':'cascade','foreignKey':_0x8be4('0x1b2')});db[_0x8be4('0xa5')][_0x8be4('0x10e')](db[_0x8be4('0xa6')],{'as':'Descriptions','onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x1b6')});db[_0x8be4('0xa5')][_0x8be4('0x10e')](db[_0x8be4('0xa6')],{'as':_0x8be4('0x1ac'),'onDelete':_0x8be4('0x10c'),'foreignKey':'FieldId'});db[_0x8be4('0xa5')]['belongsTo'](db[_0x8be4('0xa3')],{'as':_0x8be4('0x165'),'foreignKey':_0x8be4('0x1b4')});db[_0x8be4('0xa6')][_0x8be4('0x10e')](db[_0x8be4('0xa6')],{'as':_0x8be4('0x1b5'),'foreignKey':'SubjectId'});db['SugarcrmField']['hasMany'](db[_0x8be4('0xa6')],{'as':_0x8be4('0x1ba'),'foreignKey':_0x8be4('0x1b6')});db[_0x8be4('0xa6')][_0x8be4('0x10e')](db[_0x8be4('0xa6')],{'as':_0x8be4('0x1b7'),'foreignKey':_0x8be4('0x1b3')});db[_0x8be4('0xa6')]['belongsTo'](db[_0x8be4('0x1b8')],{'as':'Variable','foreignKey':_0x8be4('0x1b9')});db['DeskAccount'][_0x8be4('0x10e')](db[_0x8be4('0xa9')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x8be4('0x1b4')});db[_0x8be4('0xa9')][_0x8be4('0x10e')](db['DeskField'],{'as':_0x8be4('0x1b1'),'onDelete':_0x8be4('0x10c'),'foreignKey':'SubjectId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':_0x8be4('0x1bb'),'onDelete':_0x8be4('0x10c'),'foreignKey':'DescriptionId'});db[_0x8be4('0xa9')][_0x8be4('0x10e')](db[_0x8be4('0xab')],{'as':_0x8be4('0x1ac'),'onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x1b3')});db['DeskConfiguration']['belongsTo'](db[_0x8be4('0xa8')],{'as':'Account','foreignKey':_0x8be4('0x1b4')});db[_0x8be4('0xa9')]['belongsToMany'](db[_0x8be4('0x8e')],{'through':'int_desk_configuration_has_tags'});db[_0x8be4('0xab')]['hasMany'](db['DeskField'],{'as':_0x8be4('0x1b5'),'foreignKey':'SubjectId'});db[_0x8be4('0xab')][_0x8be4('0x10e')](db[_0x8be4('0xab')],{'as':'Description','foreignKey':_0x8be4('0x1b6')});db[_0x8be4('0xab')][_0x8be4('0x10e')](db[_0x8be4('0xab')],{'as':_0x8be4('0x1b7'),'foreignKey':_0x8be4('0x1b3')});db[_0x8be4('0xab')][_0x8be4('0x118')](db[_0x8be4('0x1b8')],{'as':_0x8be4('0x1b8'),'foreignKey':_0x8be4('0x1b9')});db[_0x8be4('0xad')]['hasMany'](db['ZohoConfiguration'],{'as':_0x8be4('0x1b0'),'onDelete':_0x8be4('0x10c'),'foreignKey':'AccountId'});db['ZohoConfiguration'][_0x8be4('0x10e')](db[_0x8be4('0xb0')],{'as':_0x8be4('0x1b1'),'onDelete':_0x8be4('0x10c'),'foreignKey':'SubjectId'});db[_0x8be4('0x1bc')][_0x8be4('0x10e')](db[_0x8be4('0xb0')],{'as':_0x8be4('0x1bb'),'onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x1b6')});db['ZohoConfiguration'][_0x8be4('0x10e')](db[_0x8be4('0xb0')],{'as':'Fields','onDelete':_0x8be4('0x10c'),'foreignKey':'FieldId'});db[_0x8be4('0x1bc')]['belongsTo'](db[_0x8be4('0xad')],{'as':'Account','foreignKey':_0x8be4('0x1b4')});db[_0x8be4('0xb0')]['hasMany'](db[_0x8be4('0xb0')],{'as':_0x8be4('0x1b5'),'foreignKey':'SubjectId'});db[_0x8be4('0xb0')][_0x8be4('0x10e')](db[_0x8be4('0xb0')],{'as':'Description','foreignKey':'DescriptionId'});db['ZohoField'][_0x8be4('0x10e')](db[_0x8be4('0xb0')],{'as':_0x8be4('0x1b7'),'foreignKey':_0x8be4('0x1b3')});db['ZohoField']['belongsTo'](db[_0x8be4('0x1b8')],{'as':_0x8be4('0x1b8'),'foreignKey':'VariableId'});db[_0x8be4('0xb2')][_0x8be4('0x10e')](db[_0x8be4('0xb3')],{'as':_0x8be4('0x1b0'),'onDelete':'cascade','foreignKey':_0x8be4('0x1b4')});db[_0x8be4('0xb3')][_0x8be4('0x10e')](db[_0x8be4('0xb5')],{'as':_0x8be4('0x1b1'),'foreignKey':_0x8be4('0x1b2')});db[_0x8be4('0xb3')]['hasMany'](db[_0x8be4('0xb5')],{'as':_0x8be4('0x1bb'),'foreignKey':_0x8be4('0x1b6')});db[_0x8be4('0xb3')][_0x8be4('0x10e')](db['ZendeskField'],{'as':_0x8be4('0x1ac'),'foreignKey':_0x8be4('0x1b3')});db[_0x8be4('0xb3')][_0x8be4('0x118')](db[_0x8be4('0xb2')],{'as':_0x8be4('0x165'),'foreignKey':_0x8be4('0x1b4')});db[_0x8be4('0xb3')][_0x8be4('0x119')](db[_0x8be4('0x8e')],{'through':_0x8be4('0x1bd')});db[_0x8be4('0xb5')][_0x8be4('0x10e')](db[_0x8be4('0xb5')],{'as':_0x8be4('0x1b5'),'foreignKey':_0x8be4('0x1b2')});db[_0x8be4('0xb5')]['hasMany'](db[_0x8be4('0xb5')],{'as':_0x8be4('0x1ba'),'foreignKey':'DescriptionId'});db[_0x8be4('0xb5')][_0x8be4('0x10e')](db[_0x8be4('0xb5')],{'as':_0x8be4('0x1b7'),'foreignKey':_0x8be4('0x1b3')});db[_0x8be4('0xb5')][_0x8be4('0x118')](db['Variable'],{'as':_0x8be4('0x1b8'),'foreignKey':_0x8be4('0x1b9')});db['FreshdeskAccount'][_0x8be4('0x10e')](db[_0x8be4('0xb8')],{'as':_0x8be4('0x1b0'),'onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x1b4')});db[_0x8be4('0xb8')][_0x8be4('0x10e')](db[_0x8be4('0xba')],{'as':_0x8be4('0x1b1'),'onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x1b2')});db[_0x8be4('0xb8')][_0x8be4('0x10e')](db[_0x8be4('0xba')],{'as':_0x8be4('0x1bb'),'onDelete':_0x8be4('0x10c'),'foreignKey':'DescriptionId'});db[_0x8be4('0xb8')][_0x8be4('0x10e')](db[_0x8be4('0xba')],{'as':'Fields','onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x1b3')});db[_0x8be4('0xb8')]['belongsTo'](db[_0x8be4('0xb7')],{'as':_0x8be4('0x165'),'foreignKey':_0x8be4('0x1b4')});db[_0x8be4('0xb8')][_0x8be4('0x119')](db[_0x8be4('0x8e')],{'through':_0x8be4('0x1be')});db['FreshdeskField'][_0x8be4('0x10e')](db[_0x8be4('0xba')],{'as':_0x8be4('0x1b5'),'foreignKey':_0x8be4('0x1b2')});db[_0x8be4('0xba')][_0x8be4('0x10e')](db['FreshdeskField'],{'as':_0x8be4('0x1ba'),'foreignKey':_0x8be4('0x1b6')});db[_0x8be4('0xba')][_0x8be4('0x10e')](db[_0x8be4('0xba')],{'as':'Field','foreignKey':_0x8be4('0x1b3')});db[_0x8be4('0xba')]['belongsTo'](db[_0x8be4('0x1b8')],{'as':'Variable','foreignKey':_0x8be4('0x1b9')});db[_0x8be4('0xbc')][_0x8be4('0x10e')](db['VtigerConfiguration'],{'as':_0x8be4('0x1b0'),'onDelete':'cascade','foreignKey':_0x8be4('0x1b4')});db[_0x8be4('0xbd')][_0x8be4('0x10e')](db[_0x8be4('0xbf')],{'as':_0x8be4('0x1b1'),'foreignKey':_0x8be4('0x1b2')});db[_0x8be4('0xbd')][_0x8be4('0x10e')](db[_0x8be4('0xbf')],{'as':_0x8be4('0x1bb'),'foreignKey':'DescriptionId'});db[_0x8be4('0xbd')]['hasMany'](db[_0x8be4('0xbf')],{'as':'Fields','foreignKey':_0x8be4('0x1b3')});db[_0x8be4('0xbd')][_0x8be4('0x118')](db[_0x8be4('0xbc')],{'as':_0x8be4('0x165'),'foreignKey':_0x8be4('0x1b4')});db[_0x8be4('0xbf')][_0x8be4('0x10e')](db['VtigerField'],{'as':_0x8be4('0x1b5'),'foreignKey':_0x8be4('0x1b2')});db[_0x8be4('0xbf')][_0x8be4('0x10e')](db['VtigerField'],{'as':_0x8be4('0x1ba'),'foreignKey':_0x8be4('0x1b6')});db[_0x8be4('0xbf')][_0x8be4('0x10e')](db[_0x8be4('0xbf')],{'as':'Field','foreignKey':_0x8be4('0x1b3')});db[_0x8be4('0xbf')]['belongsTo'](db[_0x8be4('0x1b8')],{'as':_0x8be4('0x1b8'),'foreignKey':'VariableId'});db[_0x8be4('0xc0')][_0x8be4('0x10e')](db['ServicenowConfiguration'],{'as':_0x8be4('0x1b0'),'onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x1b4')});db[_0x8be4('0xc2')]['hasMany'](db['ServicenowField'],{'as':_0x8be4('0x1b1'),'foreignKey':_0x8be4('0x1b2')});db[_0x8be4('0xc2')][_0x8be4('0x10e')](db[_0x8be4('0x1bf')],{'as':'Descriptions','foreignKey':_0x8be4('0x1b6')});db[_0x8be4('0xc2')][_0x8be4('0x10e')](db[_0x8be4('0x1bf')],{'as':_0x8be4('0x1ac'),'foreignKey':_0x8be4('0x1b3')});db['ServicenowConfiguration'][_0x8be4('0x118')](db[_0x8be4('0xc0')],{'as':_0x8be4('0x165'),'foreignKey':'AccountId'});db[_0x8be4('0x1bf')][_0x8be4('0x10e')](db[_0x8be4('0x1bf')],{'as':_0x8be4('0x1b5'),'foreignKey':_0x8be4('0x1b2')});db[_0x8be4('0x1bf')][_0x8be4('0x10e')](db[_0x8be4('0x1bf')],{'as':_0x8be4('0x1ba'),'foreignKey':_0x8be4('0x1b6')});db[_0x8be4('0x1bf')]['hasMany'](db[_0x8be4('0x1bf')],{'as':_0x8be4('0x1b7'),'foreignKey':_0x8be4('0x1b3')});db['ServicenowField'][_0x8be4('0x118')](db['Variable'],{'as':'Variable','foreignKey':_0x8be4('0x1b9')});db['Dynamics365Account'][_0x8be4('0x10e')](db[_0x8be4('0xc5')],{'as':_0x8be4('0x1b0'),'onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x1b4')});db[_0x8be4('0xc5')]['hasMany'](db['Dynamics365Field'],{'as':_0x8be4('0x1b1'),'onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x1b2')});db[_0x8be4('0xc5')][_0x8be4('0x10e')](db['Dynamics365Field'],{'as':_0x8be4('0x1bb'),'onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x1b6')});db[_0x8be4('0xc5')][_0x8be4('0x10e')](db[_0x8be4('0xc6')],{'as':'Fields','onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x1b3')});db[_0x8be4('0xc5')][_0x8be4('0x118')](db[_0x8be4('0x1c0')],{'as':_0x8be4('0x165'),'foreignKey':'AccountId'});db[_0x8be4('0xc6')]['hasMany'](db['Dynamics365Field'],{'as':_0x8be4('0x1b5'),'foreignKey':'SubjectId'});db[_0x8be4('0xc6')][_0x8be4('0x10e')](db[_0x8be4('0xc6')],{'as':_0x8be4('0x1ba'),'foreignKey':_0x8be4('0x1b6')});db['Dynamics365Field'][_0x8be4('0x10e')](db[_0x8be4('0xc6')],{'as':'Field','foreignKey':'FieldId'});db['Dynamics365Field'][_0x8be4('0x118')](db['Variable'],{'as':_0x8be4('0x1b8'),'foreignKey':'VariableId'});db['FreshsalesAccount'][_0x8be4('0x10e')](db[_0x8be4('0xca')],{'as':_0x8be4('0x1b0'),'onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x1b4')});db[_0x8be4('0xca')]['hasMany'](db['FreshsalesField'],{'as':_0x8be4('0x1b1'),'foreignKey':_0x8be4('0x1b2')});db[_0x8be4('0xca')][_0x8be4('0x10e')](db[_0x8be4('0x1c1')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x8be4('0xca')][_0x8be4('0x10e')](db[_0x8be4('0x1c1')],{'as':_0x8be4('0x1ac'),'foreignKey':_0x8be4('0x1b3')});db['FreshsalesConfiguration'][_0x8be4('0x118')](db[_0x8be4('0xc8')],{'as':'Account','foreignKey':_0x8be4('0x1b4')});db['FreshsalesField'][_0x8be4('0x10e')](db[_0x8be4('0x1c1')],{'as':_0x8be4('0x1b5'),'foreignKey':_0x8be4('0x1b2')});db[_0x8be4('0x1c1')][_0x8be4('0x10e')](db[_0x8be4('0x1c1')],{'as':_0x8be4('0x1ba'),'foreignKey':'DescriptionId'});db['FreshsalesField'][_0x8be4('0x10e')](db[_0x8be4('0x1c1')],{'as':_0x8be4('0x1b7'),'foreignKey':'FieldId'});db['FreshsalesField']['belongsTo'](db[_0x8be4('0x1b8')],{'as':'Variable','foreignKey':_0x8be4('0x1b9')});db[_0x8be4('0x1c2')][_0x8be4('0x118')](db['ChatWebsite'],{});db[_0x8be4('0x1c2')]['belongsTo'](db['CmList'],{'as':_0x8be4('0x160'),'foreignKey':_0x8be4('0x16c')});db[_0x8be4('0x1c2')][_0x8be4('0x118')](db['CmContact'],{'as':'Contact','foreignKey':_0x8be4('0x154')});db[_0x8be4('0x1c2')]['belongsTo'](db[_0x8be4('0x65')],{});db[_0x8be4('0x1c2')][_0x8be4('0x118')](db[_0x8be4('0x188')],{});db[_0x8be4('0x1c2')][_0x8be4('0x118')](db[_0x8be4('0x13')],{});db[_0x8be4('0x1c2')][_0x8be4('0x118')](db[_0x8be4('0x12a')],{});db[_0x8be4('0xd1')][_0x8be4('0x118')](db[_0x8be4('0x13')],{'onDelete':_0x8be4('0x10c'),'foreignKey':'FromId'});db[_0x8be4('0xd1')][_0x8be4('0x118')](db['User'],{'onDelete':'cascade','foreignKey':_0x8be4('0x1c3')});db['JscriptySessionReport']['hasMany'](db[_0x8be4('0x1c4')],{'foreignKey':_0x8be4('0x1c5'),'onDelete':'cascade'});db[_0x8be4('0x18f')][_0x8be4('0x10e')](db[_0x8be4('0xd3')],{'foreignKey':_0x8be4('0x1c5'),'onDelete':_0x8be4('0x10c')});db[_0x8be4('0xd7')][_0x8be4('0x118')](db[_0x8be4('0x54')],{});db[_0x8be4('0xd7')][_0x8be4('0x118')](db[_0x8be4('0xf4')],{'as':_0x8be4('0x160'),'foreignKey':'ListId'});db[_0x8be4('0xd7')]['belongsTo'](db[_0x8be4('0x11b')],{'as':_0x8be4('0x166'),'foreignKey':_0x8be4('0x154')});db['SmsQueueReport'][_0x8be4('0x118')](db[_0x8be4('0x114')],{});db[_0x8be4('0xd7')][_0x8be4('0x118')](db['SmsMessage'],{});db[_0x8be4('0xd7')]['belongsTo'](db['User'],{});db['SmsQueueReport'][_0x8be4('0x118')](db[_0x8be4('0x58')],{});db[_0x8be4('0xdb')]['hasMany'](db[_0x8be4('0x18f')],{'foreignKey':_0x8be4('0x1c6')});db[_0x8be4('0xdb')][_0x8be4('0x10e')](db[_0x8be4('0x1c4')],{'foreignKey':_0x8be4('0x1c6')});db[_0x8be4('0xdb')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0x8be4('0x1c6')});db['SquareProject'][_0x8be4('0x119')](db[_0x8be4('0x13')],{'as':_0x8be4('0x173'),'through':_0x8be4('0x13c')});db['Team']['belongsToMany'](db[_0x8be4('0x13')],{'as':'Agents','through':_0x8be4('0x120')});db[_0x8be4('0xe2')][_0x8be4('0x119')](db[_0x8be4('0x1e')],{'through':_0x8be4('0x14b'),'as':_0x8be4('0x1c7')});db['Team'][_0x8be4('0x119')](db[_0x8be4('0x163')],{'through':_0x8be4('0x164'),'as':_0x8be4('0x128')});db[_0x8be4('0xe2')][_0x8be4('0x119')](db[_0x8be4('0x12a')],{'through':'team_has_chat_queues','as':_0x8be4('0x12b')});db[_0x8be4('0xe2')]['belongsToMany'](db[_0x8be4('0x50')],{'through':'team_has_fax_queues','as':_0x8be4('0x12d')});db[_0x8be4('0xe2')]['belongsToMany'](db[_0x8be4('0x58')],{'through':_0x8be4('0x17e'),'as':_0x8be4('0x12e')});db[_0x8be4('0xe2')][_0x8be4('0x119')](db['OpenchannelQueue'],{'through':_0x8be4('0x183'),'as':_0x8be4('0x12f')});db[_0x8be4('0xe2')][_0x8be4('0x119')](db[_0x8be4('0x1c8')],{'through':_0x8be4('0x1c9'),'as':_0x8be4('0x130')});db['Team']['belongsToMany'](db[_0x8be4('0xf5')],{'through':'TeamVoicePrefix','as':_0x8be4('0x1ca')});db[_0x8be4('0xe6')][_0x8be4('0x10e')](db[_0x8be4('0x70')],{'as':_0x8be4('0x141'),'foreignKey':'CampaignId'});db[_0x8be4('0xe6')][_0x8be4('0x10e')](db[_0x8be4('0x73')],{'as':_0x8be4('0x111'),'foreignKey':_0x8be4('0x194')});db[_0x8be4('0xe6')][_0x8be4('0x10e')](db[_0x8be4('0x75')],{'as':_0x8be4('0x142'),'foreignKey':_0x8be4('0x194')});db['Campaign'][_0x8be4('0x10e')](db[_0x8be4('0x143')],{'as':_0x8be4('0x1cb'),'foreignKey':_0x8be4('0x194')});db[_0x8be4('0xe6')][_0x8be4('0x118')](db[_0x8be4('0x2d')],{'as':_0x8be4('0x2d'),'foreignKey':_0x8be4('0x145')});db[_0x8be4('0xe6')][_0x8be4('0x118')](db[_0x8be4('0x2d')],{'as':_0x8be4('0x146'),'foreignKey':'TrunkBackupId'});db[_0x8be4('0xe6')][_0x8be4('0x118')](db[_0x8be4('0x84')],{'as':_0x8be4('0x84'),'foreignKey':_0x8be4('0x179')});db[_0x8be4('0xe6')][_0x8be4('0x118')](db[_0x8be4('0x13a')],{'as':_0x8be4('0x13a'),'foreignKey':_0x8be4('0x1cc')});db[_0x8be4('0xe6')][_0x8be4('0x119')](db['CmList'],{'as':_0x8be4('0x11e'),'through':_0x8be4('0x1cd')});db[_0x8be4('0xe6')][_0x8be4('0x119')](db['CmList'],{'as':_0x8be4('0x1ce'),'through':_0x8be4('0x1cf')});db[_0x8be4('0x175')][_0x8be4('0x118')](db[_0x8be4('0x68')],{'as':_0x8be4('0x68'),'foreignKey':_0x8be4('0x1d0')});db[_0x8be4('0x1d1')][_0x8be4('0x118')](db[_0x8be4('0x40')],{});db[_0x8be4('0x1d1')][_0x8be4('0x118')](db['MailInteraction'],{});db[_0x8be4('0x1d1')]['belongsTo'](db['MailAccount'],{'foreignKey':_0x8be4('0x1d2'),'as':'FromAccount'});db['MailTransferReport'][_0x8be4('0x118')](db[_0x8be4('0x13')],{'foreignKey':_0x8be4('0x1d3'),'as':_0x8be4('0x1d4')});db[_0x8be4('0x1d1')][_0x8be4('0x118')](db[_0x8be4('0x13')],{'foreignKey':_0x8be4('0x1d5'),'as':_0x8be4('0x1d6')});db[_0x8be4('0x1d1')][_0x8be4('0x118')](db['MailQueue'],{'foreignKey':_0x8be4('0x1d7'),'as':_0x8be4('0x1d8')});db['MailTransferReport'][_0x8be4('0x118')](db['MailAccount'],{'foreignKey':'ToMailAccountId','as':_0x8be4('0x1d9')});db[_0x8be4('0xed')][_0x8be4('0x118')](db['ChatMessage'],{});db['ChatTransferReport']['belongsTo'](db['ChatInteraction'],{});db[_0x8be4('0xed')][_0x8be4('0x118')](db['ChatWebsite'],{'foreignKey':_0x8be4('0x1da'),'as':'FromAccount'});db[_0x8be4('0xed')][_0x8be4('0x118')](db['User'],{'foreignKey':_0x8be4('0x1d3'),'as':'FromAgent'});db['ChatTransferReport'][_0x8be4('0x118')](db[_0x8be4('0x13')],{'foreignKey':_0x8be4('0x1d5'),'as':_0x8be4('0x1d6')});db[_0x8be4('0xed')]['belongsTo'](db[_0x8be4('0x12a')],{'foreignKey':_0x8be4('0x1db'),'as':_0x8be4('0x1d8')});db[_0x8be4('0xed')][_0x8be4('0x118')](db[_0x8be4('0x62')],{'foreignKey':_0x8be4('0x1dc'),'as':_0x8be4('0x1d9')});db[_0x8be4('0xef')][_0x8be4('0x118')](db['FaxMessage'],{});db[_0x8be4('0xef')][_0x8be4('0x118')](db[_0x8be4('0x4c')],{});db['FaxTransferReport'][_0x8be4('0x118')](db[_0x8be4('0x48')],{'foreignKey':_0x8be4('0x1dd'),'as':_0x8be4('0x1de')});db['FaxTransferReport'][_0x8be4('0x118')](db[_0x8be4('0x13')],{'foreignKey':_0x8be4('0x1d3'),'as':_0x8be4('0x1d4')});db[_0x8be4('0xef')][_0x8be4('0x118')](db[_0x8be4('0x13')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x8be4('0xef')][_0x8be4('0x118')](db[_0x8be4('0x50')],{'foreignKey':_0x8be4('0x1df'),'as':_0x8be4('0x1d8')});db[_0x8be4('0xef')]['belongsTo'](db[_0x8be4('0x48')],{'foreignKey':'ToFaxAccountId','as':_0x8be4('0x1d9')});db['OpenchannelTransferReport'][_0x8be4('0x118')](db[_0x8be4('0x5e')],{});db['OpenchannelTransferReport'][_0x8be4('0x118')](db[_0x8be4('0x5c')],{});db[_0x8be4('0x1e0')][_0x8be4('0x118')](db[_0x8be4('0x59')],{'foreignKey':'FromOpenchannelAccountId','as':_0x8be4('0x1de')});db[_0x8be4('0x1e0')]['belongsTo'](db[_0x8be4('0x13')],{'foreignKey':_0x8be4('0x1d3'),'as':_0x8be4('0x1d4')});db[_0x8be4('0x1e0')]['belongsTo'](db[_0x8be4('0x13')],{'foreignKey':'ToUserId','as':_0x8be4('0x1d6')});db['OpenchannelTransferReport']['belongsTo'](db[_0x8be4('0x60')],{'foreignKey':_0x8be4('0x1e1'),'as':'ToQueue'});db[_0x8be4('0x1e0')]['belongsTo'](db[_0x8be4('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':_0x8be4('0x1d9')});db['SmsTransferReport']['belongsTo'](db[_0x8be4('0x17a')],{});db[_0x8be4('0xf2')][_0x8be4('0x118')](db['SmsInteraction'],{});db[_0x8be4('0xf2')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0x8be4('0x1e2'),'as':_0x8be4('0x1de')});db[_0x8be4('0xf2')][_0x8be4('0x118')](db[_0x8be4('0x13')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x8be4('0xf2')][_0x8be4('0x118')](db[_0x8be4('0x13')],{'foreignKey':_0x8be4('0x1d5'),'as':_0x8be4('0x1d6')});db[_0x8be4('0xf2')][_0x8be4('0x118')](db[_0x8be4('0x58')],{'foreignKey':_0x8be4('0x1e3'),'as':_0x8be4('0x1d8')});db['SmsTransferReport'][_0x8be4('0x118')](db[_0x8be4('0x54')],{'foreignKey':'ToSmsAccountId','as':_0x8be4('0x1d9')});db[_0x8be4('0xf4')][_0x8be4('0x10e')](db[_0x8be4('0x80')],{'as':'Dispositions','foreignKey':_0x8be4('0x16c'),'onDelete':'cascade'});db['CmList']['hasMany'](db[_0x8be4('0x79')],{'as':_0x8be4('0x1e4'),'foreignKey':_0x8be4('0x16c')});db[_0x8be4('0xf4')][_0x8be4('0x10e')](db[_0x8be4('0x11b')],{'as':_0x8be4('0x11c'),'onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x16c')});db[_0x8be4('0xf4')][_0x8be4('0x10e')](db[_0x8be4('0x73')],{'as':_0x8be4('0x111'),'foreignKey':_0x8be4('0x16c')});db[_0x8be4('0xf4')][_0x8be4('0x10e')](db[_0x8be4('0x75')],{'as':_0x8be4('0x1e5'),'foreignKey':'ListId'});db[_0x8be4('0xf4')][_0x8be4('0x10e')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':'ListId'});db[_0x8be4('0xf4')][_0x8be4('0x119')](db['VoiceQueue'],{'as':_0x8be4('0x1e6'),'through':'voice_queues_has_cm_lists'});db[_0x8be4('0xf4')][_0x8be4('0x119')](db[_0x8be4('0x13')],{'as':_0x8be4('0x162'),'through':_0x8be4('0x11f')});db[_0x8be4('0xf5')]['hasMany'](db['VoiceExtension'],{'as':_0x8be4('0x1e7'),'onDelete':'cascade'});db[_0x8be4('0xf5')][_0x8be4('0x119')](db[_0x8be4('0x13')],{'as':'Agents','through':_0x8be4('0x108')});db['VoicePrefix'][_0x8be4('0x119')](db[_0x8be4('0xe2')],{'through':_0x8be4('0x106'),'as':'Teams'});db[_0x8be4('0xf6')]['hasMany'](db[_0x8be4('0x13')],{'as':'Users','foreignKey':_0x8be4('0x1e8')});db[_0x8be4('0xf6')][_0x8be4('0x10e')](db[_0x8be4('0x1e9')],{'as':_0x8be4('0x1ea'),'foreignKey':_0x8be4('0x1e8'),'onDelete':_0x8be4('0x10c')});db[_0x8be4('0x1e9')]['hasMany'](db['UserProfileResource'],{'as':_0x8be4('0x1eb'),'foreignKey':_0x8be4('0x1ec'),'onDelete':_0x8be4('0x10c')});db[_0x8be4('0xfb')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0x8be4('0x1ed'),'onDelete':_0x8be4('0x10c')});db[_0x8be4('0xfb')][_0x8be4('0x10e')](db[_0x8be4('0x15b')],{'as':_0x8be4('0x15c'),'foreignKey':_0x8be4('0x1ed')});db[_0x8be4('0xfb')][_0x8be4('0x10e')](db[_0x8be4('0xff')],{'as':_0x8be4('0x15d'),'foreignKey':_0x8be4('0x1ed')});db[_0x8be4('0xfb')][_0x8be4('0x10e')](db['WhatsappInteraction'],{'as':'Interactions'});db[_0x8be4('0xfb')]['hasMany'](db[_0x8be4('0x1ee')],{'as':_0x8be4('0x13e')});db[_0x8be4('0xfb')][_0x8be4('0x118')](db['CmList'],{'as':_0x8be4('0x160'),'foreignKey':_0x8be4('0x16c')});db[_0x8be4('0xfb')][_0x8be4('0x118')](db[_0x8be4('0x86')],{'as':_0x8be4('0x148'),'foreignKey':_0x8be4('0x149')});db['WhatsappAccount'][_0x8be4('0x119')](db[_0x8be4('0x13')],{'as':_0x8be4('0x162'),'through':_0x8be4('0x139')});db['WhatsappApplication'][_0x8be4('0x118')](db[_0x8be4('0x13')],{'onDelete':'restrict'});db[_0x8be4('0x1ee')][_0x8be4('0x118')](db[_0x8be4('0x1c8')],{'onDelete':_0x8be4('0x157')});db[_0x8be4('0x1ee')][_0x8be4('0x118')](db[_0x8be4('0xfb')],{'onDelete':_0x8be4('0x157')});db['WhatsappApplication'][_0x8be4('0x118')](db[_0x8be4('0x84')],{'onDelete':_0x8be4('0x157'),'foreignKey':_0x8be4('0x179')});db['WhatsappApplication'][_0x8be4('0x118')](db[_0x8be4('0x8e')],{'onDelete':_0x8be4('0x157'),'foreignKey':'TagId'});db[_0x8be4('0xfd')]['hasMany'](db[_0x8be4('0xff')],{'as':_0x8be4('0x15d'),'onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x1ef')});db[_0x8be4('0xfd')][_0x8be4('0x118')](db[_0x8be4('0xfb')],{'as':_0x8be4('0x165'),'foreignKey':_0x8be4('0x1ed')});db[_0x8be4('0xfd')][_0x8be4('0x118')](db[_0x8be4('0x11b')],{'as':'Contact','foreignKey':'ContactId'});db[_0x8be4('0xfd')][_0x8be4('0x118')](db[_0x8be4('0x13')],{'as':_0x8be4('0x167'),'foreignKey':'UserId'});db['WhatsappInteraction'][_0x8be4('0x119')](db['Tag'],{'through':_0x8be4('0x1a5'),'as':_0x8be4('0x171')});db[_0x8be4('0xfd')][_0x8be4('0x119')](db[_0x8be4('0x8e')],{'through':_0x8be4('0x1a5'),'as':'ThroughTags'});db[_0x8be4('0xfd')][_0x8be4('0x119')](db[_0x8be4('0x13')],{'as':_0x8be4('0x173'),'through':_0x8be4('0x127'),'foreignKey':'WhatsappInteractionId'});db['WhatsappMessage'][_0x8be4('0x118')](db['User'],{'as':'User'});db[_0x8be4('0xff')][_0x8be4('0x118')](db[_0x8be4('0x11b')],{'onDelete':_0x8be4('0x10c'),'as':_0x8be4('0x166')});db['WhatsappMessage']['belongsTo'](db[_0x8be4('0xfd')],{'onDelete':_0x8be4('0x10c'),'as':_0x8be4('0x174'),'foreignKey':'WhatsappInteractionId'});db[_0x8be4('0xff')][_0x8be4('0x118')](db['WhatsappAccount'],{'as':_0x8be4('0x165'),'foreignKey':_0x8be4('0x1ed')});db[_0x8be4('0x101')][_0x8be4('0x118')](db[_0x8be4('0xfb')],{});db[_0x8be4('0x101')]['belongsTo'](db[_0x8be4('0xf4')],{'as':'List','foreignKey':_0x8be4('0x16c')});db[_0x8be4('0x101')][_0x8be4('0x118')](db[_0x8be4('0x11b')],{'as':_0x8be4('0x166'),'foreignKey':_0x8be4('0x154')});db[_0x8be4('0x101')][_0x8be4('0x118')](db[_0x8be4('0xfd')],{});db[_0x8be4('0x101')]['belongsTo'](db[_0x8be4('0x1c8')],{});db[_0x8be4('0x101')][_0x8be4('0x118')](db[_0x8be4('0xff')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x8be4('0x13')],{});db[_0x8be4('0x103')][_0x8be4('0x118')](db[_0x8be4('0xff')],{});db['WhatsappTransferReport'][_0x8be4('0x118')](db[_0x8be4('0xfd')],{});db[_0x8be4('0x103')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x8be4('0x1f0'),'as':_0x8be4('0x1de')});db[_0x8be4('0x103')][_0x8be4('0x118')](db[_0x8be4('0xfb')],{'foreignKey':_0x8be4('0x1f1'),'as':_0x8be4('0x1d9')});db[_0x8be4('0x103')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x8be4('0x1f2'),'as':_0x8be4('0x1d8')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x8be4('0x1d4')});db[_0x8be4('0x103')]['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x8be4('0x1c8')][_0x8be4('0x119')](db['User'],{'as':'Agents','through':_0x8be4('0x36'),'foreignKey':_0x8be4('0x1f3')});db[_0x8be4('0x1c8')][_0x8be4('0x119')](db[_0x8be4('0xe2')],{'through':'team_has_whatsapp_queues','as':_0x8be4('0x14a')});db['CloudProvider']['hasOne'](db[_0x8be4('0x38')],{'as':_0x8be4('0x159'),'onDelete':_0x8be4('0x157')});db[_0x8be4('0x104')][_0x8be4('0x10a')](db[_0x8be4('0x158')],{'as':'Smtp','onDelete':_0x8be4('0x157')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xdfcc=['Interactions','List','ListId','TemplateId','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Contact','Interaction','TagId','Items','Dispositions','FaxAccountId','FaxInteractionId','fax_interaction_has_tags','AttachmentId','SmsAccountId','mandatoryDispositionPause','SmsMessage','SmsInteractionId','sms_interaction_has_tags','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','ChatMessage','Agent','Queue','ChatQueueId','Website','ChatInteractionId','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','chat_group_has_users','ChatProactiveAction','CompanyId','JscriptySessionReport','Company','cm_user_has_contacts','cm_contact_has_tags','OwnerId','CampaignId','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','FaxApplications','SmsApplications','Schedule','DefaultReportId','CustomReportId','Mohs','chat_interaction_has_tags','whatsapp_interaction_has_tags','AllConditions','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','AnalyticFieldReport','Fields','MetricId','AccountId','Subjects','SubjectId','Descriptions','FieldId','Subject','Description','DescriptionId','Field','VariableId','SugarcrmConfiguration','SugarcrmField','int_desk_configuration_has_tags','Configurations','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','ServicenowAccount','ServicenowConfiguration','Dynamics365Configuration','FromId','ToId','SessionId','ProjectId','team_has_mail_queues','MailQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToAgent','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','FromAccount','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','Queues','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','../config/environment','sequelize','lodash','determine','defaultsDeep','motion2','mysql','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','xC@LL1234','127.0.0.1','name','database','password','options','username','User','import','../api/user/user.model','VoiceContext','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','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','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../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','ChatInternalMessage','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','hasMany','Recordings','UserId','Extensions','cascade','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','SmsInteraction','FaxInteractions','UserNotification','UserNotifications','userProfileId','belongsToMany','Groups','Contacts','cm_user_has_lists','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueues','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','user_has_square_projects','ChanSpyId','Applications','moh_has_sounds','VoiceQueueId','Hoppers','HopperFinals','HopperHistories','JscriptySessions','belongsTo','Trunk','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','Teams','ScreenRecording','mailboxuser','mailbox','VoiceCallReport','QueueCalls','AgentReports','uniqueid','ContactId','MailAccountId','CloudProvider','CloudProviderId','restrict','Imap','Smtp','CannedAnswer','Answers','Messages'];(function(_0x141e87,_0x538678){var _0x25e291=function(_0x29b507){while(--_0x29b507){_0x141e87['push'](_0x141e87['shift']());}};_0x25e291(++_0x538678);}(_0xdfcc,0x8d));var _0xcdfc=function(_0x4c70c4,_0x963969){_0x4c70c4=_0x4c70c4-0x0;var _0x437865=_0xdfcc[_0x4c70c4];return _0x437865;};'use strict';var config=require(_0xcdfc('0x0'));var Sequelize=require(_0xcdfc('0x1'));var _=require(_0xcdfc('0x2'));var jstz=require('jstz');var timezone=jstz[_0xcdfc('0x3')]();config[_0xcdfc('0x1')]=_[_0xcdfc('0x4')](config['sequelize'],{'database':_0xcdfc('0x5'),'username':'xcall','password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xcdfc('0x6'),'dialectOptions':{'charset':_0xcdfc('0x7')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xcdfc('0x8'),'collate':_0xcdfc('0x9')}}});config[_0xcdfc('0xa')]=_[_0xcdfc('0x4')](config['sequelizeHistory'],{'database':_0xcdfc('0x5'),'username':'xcall','password':_0xcdfc('0xb'),'options':{'host':_0xcdfc('0xc'),'port':0xcea,'dialect':_0xcdfc('0x6'),'dialectOptions':{'charset':_0xcdfc('0x7')},'logging':![],'timezone':timezone[_0xcdfc('0xd')](),'define':{'charset':_0xcdfc('0x8'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0xcdfc('0xe')],config[_0xcdfc('0x1')]['username'],config[_0xcdfc('0x1')][_0xcdfc('0xf')],config['sequelize'][_0xcdfc('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xcdfc('0xa')][_0xcdfc('0xe')],config['sequelizeHistory'][_0xcdfc('0x11')],config[_0xcdfc('0xa')]['password'],config[_0xcdfc('0xa')][_0xcdfc('0x10')])};db[_0xcdfc('0x12')]=db['sequelize'][_0xcdfc('0x13')](_0xcdfc('0x14'));db['VoiceChanSpy']=db[_0xcdfc('0x1')][_0xcdfc('0x13')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0xcdfc('0x15')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')]('../api/voiceContext/voiceContext.model');db[_0xcdfc('0x16')]=db[_0xcdfc('0x1')]['import'](_0xcdfc('0x17'));db[_0xcdfc('0x18')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x19'));db[_0xcdfc('0x1a')]=db['sequelize'][_0xcdfc('0x13')]('../api/voiceQueue/voiceQueue.model');db[_0xcdfc('0x1b')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x1c'));db['ScreenRecording']=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x1d'));db[_0xcdfc('0x1e')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x1f'));db[_0xcdfc('0x20')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x21'));db['VoiceCallReport']=db[_0xcdfc('0x1')]['import'](_0xcdfc('0x22'));db[_0xcdfc('0x23')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x24'));db[_0xcdfc('0x25')]=db[_0xcdfc('0x1')]['import']('../api/voiceAgentReport/voiceAgentReport.model');db[_0xcdfc('0x26')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x27'));db['MemberReport']=db[_0xcdfc('0x1')][_0xcdfc('0x13')]('../api/memberReport/memberReport.model');db['Trunk']=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x28'));db['VoiceTransferReport']=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x29'));db[_0xcdfc('0x2a')]=db['sequelize'][_0xcdfc('0x13')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db['UserVoiceQueue']=db[_0xcdfc('0x1')][_0xcdfc('0x13')]('../api/userVoiceQueue/userVoiceQueue.model');db['UserChatQueue']=db[_0xcdfc('0x1')]['import'](_0xcdfc('0x2b'));db[_0xcdfc('0x2c')]=db[_0xcdfc('0x1')]['import'](_0xcdfc('0x2d'));db[_0xcdfc('0x2e')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x2f'));db['UserSmsQueue']=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x30'));db[_0xcdfc('0x31')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x32'));db[_0xcdfc('0x33')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x34'));db[_0xcdfc('0x35')]=db['sequelize'][_0xcdfc('0x13')](_0xcdfc('0x36'));db[_0xcdfc('0x37')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')]('../api/mailServerOut/mailServerOut.model');db[_0xcdfc('0x38')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x39'));db[_0xcdfc('0x3a')]=db['sequelize'][_0xcdfc('0x13')](_0xcdfc('0x3b'));db['MailSubstatus']=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x3c'));db[_0xcdfc('0x3d')]=db['sequelize']['import']('../api/mailInteraction/mailInteraction.model');db[_0xcdfc('0x3e')]=db[_0xcdfc('0x1')]['import'](_0xcdfc('0x3f'));db[_0xcdfc('0x40')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')]('../api/mailApplication/mailApplication.model');db[_0xcdfc('0x41')]=db['sequelize'][_0xcdfc('0x13')](_0xcdfc('0x42'));db[_0xcdfc('0x43')]=db[_0xcdfc('0x1')]['import'](_0xcdfc('0x44'));db[_0xcdfc('0x45')]=db['sequelize']['import'](_0xcdfc('0x46'));db[_0xcdfc('0x47')]=db[_0xcdfc('0x1')]['import'](_0xcdfc('0x48'));db[_0xcdfc('0x49')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x4a'));db[_0xcdfc('0x4b')]=db['sequelize'][_0xcdfc('0x13')]('../api/faxInteraction/faxInteraction.model');db[_0xcdfc('0x4c')]=db[_0xcdfc('0x1')]['import']('../api/faxMessage/faxMessage.model');db[_0xcdfc('0x4d')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x4e'));db[_0xcdfc('0x4f')]=db[_0xcdfc('0x1')]['import'](_0xcdfc('0x50'));db[_0xcdfc('0x51')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x52'));db[_0xcdfc('0x53')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x54'));db['SmsInteraction']=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x55'));db['SmsMessage']=db['sequelize'][_0xcdfc('0x13')]('../api/smsMessage/smsMessage.model');db[_0xcdfc('0x56')]=db[_0xcdfc('0x1')]['import']('../api/smsQueue/smsQueue.model');db[_0xcdfc('0x57')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x58'));db[_0xcdfc('0x59')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')]('../api/openchannelApplication/openchannelApplication.model');db[_0xcdfc('0x5a')]=db[_0xcdfc('0x1')]['import'](_0xcdfc('0x5b'));db[_0xcdfc('0x5c')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x5d'));db[_0xcdfc('0x5e')]=db['sequelize']['import']('../api/openchannelQueue/openchannelQueue.model');db[_0xcdfc('0x5f')]=db['sequelize']['import']('../api/chatWebsite/chatWebsite.model');db[_0xcdfc('0x60')]=db['sequelize'][_0xcdfc('0x13')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0xcdfc('0x61')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x62'));db[_0xcdfc('0x63')]=db[_0xcdfc('0x1')]['import'](_0xcdfc('0x64'));db['ChatMessage']=db[_0xcdfc('0x1')][_0xcdfc('0x13')]('../api/chatMessage/chatMessage.model');db[_0xcdfc('0x65')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0xcdfc('0x66')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')]('../api/chatQueue/chatQueue.model');db[_0xcdfc('0x67')]=db[_0xcdfc('0x1')]['import'](_0xcdfc('0x68'));db['ChatProactiveAction']=db[_0xcdfc('0x1')][_0xcdfc('0x13')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0xcdfc('0x69')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x6a'));db[_0xcdfc('0x6b')]=db['sequelize']['import'](_0xcdfc('0x6c'));db[_0xcdfc('0x6d')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')]('../api/cmHopper/cmHopper.model');db[_0xcdfc('0x6e')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0xcdfc('0x6f')]=db[_0xcdfc('0x1')]['import'](_0xcdfc('0x70'));db[_0xcdfc('0x71')]=db['sequelize']['import'](_0xcdfc('0x72'));db['ReportAgentPreview']=db[_0xcdfc('0x1')]['import']('../api/reportAgentPreview/reportAgentPreview.model');db[_0xcdfc('0x73')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x74'));db[_0xcdfc('0x75')]=db[_0xcdfc('0x1')]['import'](_0xcdfc('0x76'));db[_0xcdfc('0x77')]=db['sequelize'][_0xcdfc('0x13')](_0xcdfc('0x78'));db['CannedAnswer']=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x79'));db[_0xcdfc('0x7a')]=db[_0xcdfc('0x1')]['import']('../api/disposition/disposition.model');db[_0xcdfc('0x7b')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x7c'));db[_0xcdfc('0x7d')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')]('../api/interval/interval.model');db[_0xcdfc('0x7e')]=db['sequelize'][_0xcdfc('0x13')](_0xcdfc('0x7f'));db[_0xcdfc('0x80')]=db['sequelize'][_0xcdfc('0x13')](_0xcdfc('0x81'));db[_0xcdfc('0x82')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')]('../api/voiceQueuesLog/voiceQueuesLog.model');db['Schedule']=db['sequelize']['import'](_0xcdfc('0x83'));db[_0xcdfc('0x84')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x85'));db[_0xcdfc('0x86')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x87'));db[_0xcdfc('0x88')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x89'));db[_0xcdfc('0x8a')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x8b'));db[_0xcdfc('0x8c')]=db['sequelize'][_0xcdfc('0x13')](_0xcdfc('0x8d'));db[_0xcdfc('0x8e')]=db['sequelize'][_0xcdfc('0x13')](_0xcdfc('0x8f'));db[_0xcdfc('0x90')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x91'));db[_0xcdfc('0x92')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x93'));db[_0xcdfc('0x94')]=db['sequelize'][_0xcdfc('0x13')](_0xcdfc('0x95'));db[_0xcdfc('0x96')]=db[_0xcdfc('0x1')]['import'](_0xcdfc('0x97'));db[_0xcdfc('0x98')]=db[_0xcdfc('0x1')]['import'](_0xcdfc('0x99'));db['AnalyticFieldReport']=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x9a'));db[_0xcdfc('0x9b')]=db[_0xcdfc('0x1')]['import'](_0xcdfc('0x9c'));db[_0xcdfc('0x9d')]=db[_0xcdfc('0x1')]['import'](_0xcdfc('0x9e'));db[_0xcdfc('0x9f')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0xcdfc('0xa0')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0xa1'));db[_0xcdfc('0xa2')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db['SugarcrmConfiguration']=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0xa3'));db['SugarcrmField']=db['sequelize']['import']('../api/intSugarcrmField/intSugarcrmField.model');db[_0xcdfc('0xa4')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0xa5'));db[_0xcdfc('0xa6')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0xa7'));db[_0xcdfc('0xa8')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0xa9'));db[_0xcdfc('0xaa')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0xab'));db[_0xcdfc('0xac')]=db[_0xcdfc('0x1')]['import']('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0xcdfc('0xad')]=db[_0xcdfc('0x1')]['import'](_0xcdfc('0xae'));db[_0xcdfc('0xaf')]=db['sequelize'][_0xcdfc('0x13')](_0xcdfc('0xb0'));db[_0xcdfc('0xb1')]=db[_0xcdfc('0x1')]['import'](_0xcdfc('0xb2'));db[_0xcdfc('0xb3')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0xb4'));db[_0xcdfc('0xb5')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0xcdfc('0xb6')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0xb7'));db[_0xcdfc('0xb8')]=db['sequelize']['import'](_0xcdfc('0xb9'));db[_0xcdfc('0xba')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0xbb'));db[_0xcdfc('0xbc')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0xbd'));db[_0xcdfc('0xbe')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')]('../api/intVtigerField/intVtigerField.model');db['ServicenowAccount']=db[_0xcdfc('0x1')][_0xcdfc('0x13')]('../api/intServicenowAccount/intServicenowAccount.model');db['ServicenowConfiguration']=db['sequelize'][_0xcdfc('0x13')](_0xcdfc('0xbf'));db[_0xcdfc('0xc0')]=db['sequelize'][_0xcdfc('0x13')](_0xcdfc('0xc1'));db[_0xcdfc('0xc2')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0xc3'));db['Dynamics365Configuration']=db[_0xcdfc('0x1')]['import'](_0xcdfc('0xc4'));db[_0xcdfc('0xc5')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0xc6'));db[_0xcdfc('0xc7')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0xc8'));db[_0xcdfc('0xc9')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0xca'));db[_0xcdfc('0xcb')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0xcc'));db[_0xcdfc('0x8e')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x8f'));db[_0xcdfc('0xcd')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0xce'));db[_0xcdfc('0xcf')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0xd0'));db[_0xcdfc('0xd1')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0xcdfc('0xd2')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0xcdfc('0xd3')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0xd4'));db['JscriptySessionReport']=db['sequelize'][_0xcdfc('0x13')](_0xcdfc('0xd5'));db[_0xcdfc('0xd6')]=db['sequelize'][_0xcdfc('0x13')]('../api/smsQueueReport/smsQueueReport.model');db[_0xcdfc('0xd7')]=db['sequelize'][_0xcdfc('0x13')](_0xcdfc('0xd8'));db[_0xcdfc('0xd9')]=db['sequelize'][_0xcdfc('0x13')](_0xcdfc('0xda'));db[_0xcdfc('0xdb')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0xdc'));db[_0xcdfc('0xdd')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0xde'));db[_0xcdfc('0xdf')]=db[_0xcdfc('0x1')]['import'](_0xcdfc('0xe0'));db[_0xcdfc('0xe1')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0xe2'));db['SquareRecording']=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0xe3'));db[_0xcdfc('0xe4')]=db[_0xcdfc('0x1')]['import'](_0xcdfc('0xe5'));db[_0xcdfc('0xe6')]=db[_0xcdfc('0x1')]['import'](_0xcdfc('0xe7'));db[_0xcdfc('0xe8')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0xe9'));db[_0xcdfc('0xea')]=db['sequelize'][_0xcdfc('0x13')](_0xcdfc('0xeb'));db[_0xcdfc('0xec')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')]('../api/migration/migration.model');db[_0xcdfc('0xed')]=db[_0xcdfc('0x1')]['import'](_0xcdfc('0xee'));db[_0xcdfc('0xef')]=db['sequelize'][_0xcdfc('0x13')](_0xcdfc('0xf0'));db[_0xcdfc('0xf1')]=db[_0xcdfc('0x1')]['import']('../api/mailTransferReport/mailTransferReport.model');db[_0xcdfc('0xf2')]=db[_0xcdfc('0x1')]['import'](_0xcdfc('0xf3'));db[_0xcdfc('0xf4')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0xf5'));db['OpenchannelTransferReport']=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0xf6'));db[_0xcdfc('0xf7')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0xf8'));db[_0xcdfc('0xf9')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0xfa'));db[_0xcdfc('0xfb')]=db['sequelize'][_0xcdfc('0x13')](_0xcdfc('0xfc'));db[_0xcdfc('0xfd')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0xfe'));db[_0xcdfc('0xff')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x100'));db[_0xcdfc('0x101')]=db[_0xcdfc('0x1')]['import'](_0xcdfc('0x102'));db['UserNotification']=db[_0xcdfc('0x1')][_0xcdfc('0x13')]('../api/userNotification/userNotification.model');db[_0xcdfc('0x103')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x104'));db[_0xcdfc('0x105')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x106'));db[_0xcdfc('0x107')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0xcdfc('0x108')]=db['sequelize'][_0xcdfc('0x13')](_0xcdfc('0x109'));db[_0xcdfc('0x10a')]=db['sequelize'][_0xcdfc('0x13')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0xcdfc('0x10b')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x10c'));db[_0xcdfc('0x10d')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x10e'));db['CloudProvider']=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x10f'));db[_0xcdfc('0x110')]=db[_0xcdfc('0x1')][_0xcdfc('0x13')](_0xcdfc('0x111'));db[_0xcdfc('0x112')]=db[_0xcdfc('0x1')]['import'](_0xcdfc('0x113'));db[_0xcdfc('0x114')]=db[_0xcdfc('0x1')]['import'](_0xcdfc('0x115'));db[_0xcdfc('0x12')][_0xcdfc('0x116')](db['VoiceMail'],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0xcdfc('0x12')][_0xcdfc('0x117')](db[_0xcdfc('0x1b')],{'as':_0xcdfc('0x118'),'foreignKey':_0xcdfc('0x119')});db[_0xcdfc('0x12')][_0xcdfc('0x117')](db[_0xcdfc('0x2a')],{'as':'VoiceQueuesRt','foreignKey':_0xcdfc('0x119')});db[_0xcdfc('0x12')][_0xcdfc('0x117')](db[_0xcdfc('0x16')],{'as':_0xcdfc('0x11a'),'onDelete':_0xcdfc('0x11b'),'hooks':!![]});db[_0xcdfc('0x12')]['hasMany'](db[_0xcdfc('0x6f')],{'as':'HopperFinals','foreignKey':'UserId'});db['User'][_0xcdfc('0x117')](db[_0xcdfc('0x71')],{'as':_0xcdfc('0x11c'),'foreignKey':_0xcdfc('0x119')});db[_0xcdfc('0x12')][_0xcdfc('0x117')](db[_0xcdfc('0x11d')],{'as':_0xcdfc('0x11d'),'foreignKey':_0xcdfc('0x119')});db[_0xcdfc('0x12')]['hasMany'](db[_0xcdfc('0x5a')],{'as':_0xcdfc('0x11e'),'foreignKey':_0xcdfc('0x119')});db[_0xcdfc('0x12')][_0xcdfc('0x117')](db['ChatInteraction'],{'as':_0xcdfc('0x11f'),'foreignKey':'UserId'});db[_0xcdfc('0x12')][_0xcdfc('0x117')](db[_0xcdfc('0x120')],{'as':'SmsInteractions','foreignKey':'UserId'});db[_0xcdfc('0x12')]['hasMany'](db[_0xcdfc('0x4b')],{'as':_0xcdfc('0x121'),'foreignKey':_0xcdfc('0x119')});db[_0xcdfc('0x12')][_0xcdfc('0x117')](db[_0xcdfc('0x3d')],{'as':'MailInteractions','foreignKey':_0xcdfc('0x119')});db[_0xcdfc('0x12')][_0xcdfc('0x117')](db[_0xcdfc('0x107')],{'as':'WhatsappInteractions','foreignKey':'UserId'});db[_0xcdfc('0x12')][_0xcdfc('0x117')](db[_0xcdfc('0x122')],{'as':_0xcdfc('0x123'),'foreignKey':'SenderId'});db['User']['belongsTo'](db[_0xcdfc('0xfd')],{'as':_0xcdfc('0xfd'),'foreignKey':_0xcdfc('0x124')});db[_0xcdfc('0x12')][_0xcdfc('0x125')](db[_0xcdfc('0x67')],{'as':_0xcdfc('0x126'),'through':'chat_group_has_users'});db[_0xcdfc('0x12')][_0xcdfc('0x125')](db[_0xcdfc('0x6b')],{'as':_0xcdfc('0x127'),'through':'cm_user_has_contacts'});db['User'][_0xcdfc('0x125')](db[_0xcdfc('0xf9')],{'as':'Lists','through':_0xcdfc('0x128')});db[_0xcdfc('0x12')][_0xcdfc('0x125')](db['Team'],{'through':_0xcdfc('0x129')});db[_0xcdfc('0x12')][_0xcdfc('0x125')](db[_0xcdfc('0x3d')],{'as':_0xcdfc('0x12a'),'through':_0xcdfc('0x12b')});db[_0xcdfc('0x12')][_0xcdfc('0x125')](db[_0xcdfc('0x63')],{'as':_0xcdfc('0x11f'),'through':'user_has_chat_interactions'});db[_0xcdfc('0x12')][_0xcdfc('0x125')](db[_0xcdfc('0x4b')],{'as':_0xcdfc('0x121'),'through':_0xcdfc('0x12c')});db[_0xcdfc('0x12')][_0xcdfc('0x125')](db[_0xcdfc('0x120')],{'as':_0xcdfc('0x12d'),'through':_0xcdfc('0x12e')});db[_0xcdfc('0x12')][_0xcdfc('0x125')](db[_0xcdfc('0x5a')],{'as':_0xcdfc('0x11e'),'through':_0xcdfc('0x12f')});db[_0xcdfc('0x12')][_0xcdfc('0x125')](db[_0xcdfc('0x107')],{'as':_0xcdfc('0x130'),'through':_0xcdfc('0x131')});db['User'][_0xcdfc('0x125')](db[_0xcdfc('0x1a')],{'as':_0xcdfc('0x132'),'through':_0xcdfc('0x133'),'required':![]});db[_0xcdfc('0x12')][_0xcdfc('0x125')](db[_0xcdfc('0xfb')],{'as':_0xcdfc('0x134'),'through':_0xcdfc('0x114'),'required':![]});db[_0xcdfc('0x12')]['belongsToMany'](db[_0xcdfc('0x3a')],{'as':'MailQueues','through':_0xcdfc('0x2c'),'required':![]});db['User'][_0xcdfc('0x125')](db[_0xcdfc('0x66')],{'as':_0xcdfc('0x135'),'through':_0xcdfc('0x136'),'required':![],'hooks':!![]});db['User'][_0xcdfc('0x125')](db[_0xcdfc('0x4d')],{'as':_0xcdfc('0x137'),'through':_0xcdfc('0x2e'),'required':![]});db[_0xcdfc('0x12')][_0xcdfc('0x125')](db[_0xcdfc('0x56')],{'as':_0xcdfc('0x138'),'through':_0xcdfc('0x139'),'required':![]});db[_0xcdfc('0x12')][_0xcdfc('0x125')](db[_0xcdfc('0x5e')],{'as':_0xcdfc('0x13a'),'through':_0xcdfc('0x31'),'required':![]});db['User']['belongsToMany'](db[_0xcdfc('0x10d')],{'as':_0xcdfc('0x13b'),'through':_0xcdfc('0x33'),'required':![]});db[_0xcdfc('0x12')][_0xcdfc('0x125')](db[_0xcdfc('0xf9')],{'through':_0xcdfc('0x128')});db[_0xcdfc('0x12')][_0xcdfc('0x125')](db[_0xcdfc('0x5f')],{'as':'ChatWebsites','through':'user_has_chat_websites'});db[_0xcdfc('0x12')]['belongsToMany'](db[_0xcdfc('0x47')],{'as':_0xcdfc('0x13c'),'through':_0xcdfc('0x13d')});db[_0xcdfc('0x12')][_0xcdfc('0x125')](db[_0xcdfc('0x38')],{'as':_0xcdfc('0x13e'),'through':_0xcdfc('0x13f')});db[_0xcdfc('0x12')][_0xcdfc('0x125')](db[_0xcdfc('0x57')],{'as':_0xcdfc('0x140'),'through':_0xcdfc('0x141')});db['User'][_0xcdfc('0x125')](db[_0xcdfc('0x51')],{'as':_0xcdfc('0x142'),'through':_0xcdfc('0x143')});db['User']['belongsToMany'](db[_0xcdfc('0x103')],{'as':_0xcdfc('0x144'),'through':_0xcdfc('0x145')});db[_0xcdfc('0x12')]['belongsToMany'](db[_0xcdfc('0xe1')],{'as':'SquareProjects','through':_0xcdfc('0x146')});db['VoiceChanSpy'][_0xcdfc('0x117')](db[_0xcdfc('0x16')],{'as':'SpiedAgents','onDelete':_0xcdfc('0x11b'),'foreignKey':_0xcdfc('0x147')});db['VoiceContext'][_0xcdfc('0x117')](db[_0xcdfc('0x16')],{'onDelete':_0xcdfc('0x11b')});db['VoiceExtension'][_0xcdfc('0x117')](db['VoiceExtension'],{'as':_0xcdfc('0x148'),'onDelete':_0xcdfc('0x11b')});db[_0xcdfc('0x18')][_0xcdfc('0x125')](db[_0xcdfc('0x84')],{'as':'Sounds','through':_0xcdfc('0x149')});db['VoiceQueue']['hasMany'](db['UserVoiceQueueRt'],{'as':'Members','foreignKey':_0xcdfc('0x14a')});db[_0xcdfc('0x1a')][_0xcdfc('0x117')](db[_0xcdfc('0x6d')],{'as':_0xcdfc('0x14b'),'foreignKey':_0xcdfc('0x14a')});db[_0xcdfc('0x1a')][_0xcdfc('0x117')](db[_0xcdfc('0x6f')],{'as':_0xcdfc('0x14c'),'foreignKey':_0xcdfc('0x14a')});db[_0xcdfc('0x1a')][_0xcdfc('0x117')](db[_0xcdfc('0x71')],{'as':_0xcdfc('0x14d'),'foreignKey':_0xcdfc('0x14a')});db['VoiceQueue'][_0xcdfc('0x117')](db[_0xcdfc('0x11d')],{'as':_0xcdfc('0x11d'),'foreignKey':_0xcdfc('0x14a')});db[_0xcdfc('0x1a')][_0xcdfc('0x117')](db[_0xcdfc('0x6e')],{'as':'HopperBlacks','foreignKey':_0xcdfc('0x14a')});db[_0xcdfc('0x1a')][_0xcdfc('0x117')](db['JscriptySessionReport'],{'as':_0xcdfc('0x14e'),'foreignKey':_0xcdfc('0x14a')});db['VoiceQueue'][_0xcdfc('0x14f')](db['Trunk'],{'as':_0xcdfc('0x150'),'foreignKey':_0xcdfc('0x151')});db[_0xcdfc('0x1a')]['belongsTo'](db['Trunk'],{'as':_0xcdfc('0x152'),'foreignKey':_0xcdfc('0x153')});db['VoiceQueue'][_0xcdfc('0x14f')](db['Interval'],{'as':_0xcdfc('0x7d'),'foreignKey':_0xcdfc('0x154')});db[_0xcdfc('0x1a')][_0xcdfc('0x14f')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xcdfc('0x155')});db[_0xcdfc('0x1a')]['belongsToMany'](db[_0xcdfc('0xf9')],{'as':_0xcdfc('0x156'),'through':_0xcdfc('0x157')});db['VoiceQueue'][_0xcdfc('0x125')](db['User'],{'as':_0xcdfc('0x158'),'through':'UserVoiceQueue'});db[_0xcdfc('0x1a')][_0xcdfc('0x125')](db[_0xcdfc('0xe6')],{'as':_0xcdfc('0x159'),'through':_0xcdfc('0x110')});db['VoiceQueue']['belongsToMany'](db[_0xcdfc('0xf9')],{'as':'BlackLists','through':'voice_queues_has_cm_blacklists'});db[_0xcdfc('0x1b')][_0xcdfc('0x14f')](db[_0xcdfc('0x12')],{'as':_0xcdfc('0x12'),'foreignKey':_0xcdfc('0x119')});db[_0xcdfc('0x15a')][_0xcdfc('0x14f')](db[_0xcdfc('0x12')],{'as':_0xcdfc('0x12'),'foreignKey':_0xcdfc('0x119')});db[_0xcdfc('0x1e')][_0xcdfc('0x117')](db[_0xcdfc('0x20')],{'as':'Messages','onDelete':_0xcdfc('0x11b'),'foreignKey':_0xcdfc('0x15b'),'sourceKey':'mailbox'});db[_0xcdfc('0x20')][_0xcdfc('0x14f')](db[_0xcdfc('0x1e')],{'foreignKey':_0xcdfc('0x15b'),'targetKey':_0xcdfc('0x15c')});db[_0xcdfc('0x15d')][_0xcdfc('0x117')](db[_0xcdfc('0x26')],{'as':_0xcdfc('0x15e'),'foreignKey':'uniqueid','constraints':![]});db[_0xcdfc('0x15d')][_0xcdfc('0x117')](db[_0xcdfc('0x25')],{'as':_0xcdfc('0x15f'),'foreignKey':_0xcdfc('0x160'),'constraints':![]});db[_0xcdfc('0x15d')][_0xcdfc('0x14f')](db[_0xcdfc('0x12')],{'as':_0xcdfc('0x12'),'foreignKey':_0xcdfc('0x119')});db[_0xcdfc('0x15d')][_0xcdfc('0x14f')](db[_0xcdfc('0x6b')],{'as':'Contact','foreignKey':_0xcdfc('0x161')});db[_0xcdfc('0x35')][_0xcdfc('0x14f')](db[_0xcdfc('0x38')],{'as':_0xcdfc('0x38'),'foreignKey':_0xcdfc('0x162')});db[_0xcdfc('0x35')][_0xcdfc('0x14f')](db[_0xcdfc('0x163')],{'as':_0xcdfc('0x163'),'foreignKey':_0xcdfc('0x164'),'onDelete':_0xcdfc('0x165')});db[_0xcdfc('0x37')][_0xcdfc('0x14f')](db[_0xcdfc('0x38')],{'as':_0xcdfc('0x38'),'foreignKey':_0xcdfc('0x162')});db[_0xcdfc('0x37')][_0xcdfc('0x14f')](db[_0xcdfc('0x163')],{'as':_0xcdfc('0x163'),'foreignKey':_0xcdfc('0x164'),'onDelete':_0xcdfc('0x165')});db['MailAccount'][_0xcdfc('0x116')](db['MailServerIn'],{'as':_0xcdfc('0x166'),'onDelete':_0xcdfc('0x11b')});db['MailAccount']['hasOne'](db[_0xcdfc('0x37')],{'as':_0xcdfc('0x167'),'onDelete':_0xcdfc('0x11b')});db[_0xcdfc('0x38')][_0xcdfc('0x117')](db[_0xcdfc('0x7a')],{'as':'Dispositions','foreignKey':'MailAccountId','onDelete':_0xcdfc('0x11b')});db['MailAccount']['hasMany'](db[_0xcdfc('0x168')],{'as':_0xcdfc('0x169'),'foreignKey':_0xcdfc('0x162')});db[_0xcdfc('0x38')][_0xcdfc('0x117')](db[_0xcdfc('0x3e')],{'as':_0xcdfc('0x16a'),'foreignKey':_0xcdfc('0x162')});db[_0xcdfc('0x38')][_0xcdfc('0x117')](db[_0xcdfc('0x3d')],{'as':_0xcdfc('0x16b')});db['MailAccount'][_0xcdfc('0x117')](db[_0xcdfc('0x40')],{'as':_0xcdfc('0x148')});db[_0xcdfc('0x38')][_0xcdfc('0x14f')](db['CmList'],{'as':_0xcdfc('0x16c'),'foreignKey':_0xcdfc('0x16d')});db[_0xcdfc('0x38')][_0xcdfc('0x14f')](db['Template'],{'as':'Template','foreignKey':_0xcdfc('0x16e')});db[_0xcdfc('0x38')]['belongsTo'](db[_0xcdfc('0x7e')],{'as':'mandatoryDispositionPause','foreignKey':_0xcdfc('0x155')});db['MailAccount'][_0xcdfc('0x125')](db[_0xcdfc('0x12')],{'as':'Agents','through':_0xcdfc('0x13f')});db[_0xcdfc('0x3a')]['belongsToMany'](db[_0xcdfc('0x12')],{'as':_0xcdfc('0x158'),'through':_0xcdfc('0x2c')});db['MailQueue'][_0xcdfc('0x125')](db['Team'],{'through':'team_has_mail_queues','as':'Teams'});db['MailInteraction'][_0xcdfc('0x117')](db[_0xcdfc('0x3e')],{'as':_0xcdfc('0x16a'),'onDelete':_0xcdfc('0x11b'),'foreignKey':_0xcdfc('0x16f')});db[_0xcdfc('0x3d')][_0xcdfc('0x14f')](db[_0xcdfc('0x38')],{'as':_0xcdfc('0x170'),'foreignKey':'MailAccountId'});db['MailInteraction'][_0xcdfc('0x14f')](db[_0xcdfc('0x6b')],{'as':'Contact','foreignKey':_0xcdfc('0x161')});db[_0xcdfc('0x3d')]['belongsTo'](db[_0xcdfc('0x12')],{'as':_0xcdfc('0x171'),'foreignKey':_0xcdfc('0x119')});db[_0xcdfc('0x3d')][_0xcdfc('0x125')](db[_0xcdfc('0x86')],{'through':_0xcdfc('0x172'),'as':_0xcdfc('0x173')});db[_0xcdfc('0x3d')][_0xcdfc('0x125')](db[_0xcdfc('0x86')],{'through':_0xcdfc('0x172'),'as':_0xcdfc('0x174')});db['MailInteraction']['belongsToMany'](db[_0xcdfc('0x12')],{'as':_0xcdfc('0x175'),'through':'user_has_mail_interactions','foreignKey':_0xcdfc('0x16f')});db[_0xcdfc('0x3e')][_0xcdfc('0x117')](db[_0xcdfc('0xed')],{'as':_0xcdfc('0x176'),'onDelete':_0xcdfc('0x11b')});db[_0xcdfc('0x3e')]['belongsTo'](db[_0xcdfc('0x12')],{'as':_0xcdfc('0x12')});db[_0xcdfc('0x3e')]['belongsTo'](db[_0xcdfc('0x6b')],{'onDelete':'cascade','as':_0xcdfc('0x177')});db[_0xcdfc('0x3e')]['belongsTo'](db[_0xcdfc('0x3d')],{'as':_0xcdfc('0x178'),'foreignKey':_0xcdfc('0x16f')});db[_0xcdfc('0x3e')][_0xcdfc('0x14f')](db[_0xcdfc('0x38')],{'as':_0xcdfc('0x170'),'foreignKey':'MailAccountId'});db[_0xcdfc('0x3e')][_0xcdfc('0x14f')](db[_0xcdfc('0x5f')],{'as':_0xcdfc('0x5f'),'foreignKey':'ChatWebsiteId'});db[_0xcdfc('0x3e')][_0xcdfc('0x14f')](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db[_0xcdfc('0x40')]['belongsTo'](db[_0xcdfc('0x12')],{'onDelete':_0xcdfc('0x165')});db[_0xcdfc('0x40')][_0xcdfc('0x14f')](db[_0xcdfc('0x3a')],{'onDelete':'restrict'});db[_0xcdfc('0x40')][_0xcdfc('0x14f')](db[_0xcdfc('0x38')],{'onDelete':_0xcdfc('0x165')});db[_0xcdfc('0x40')][_0xcdfc('0x14f')](db['Interval'],{'onDelete':_0xcdfc('0x165'),'foreignKey':'IntervalId'});db[_0xcdfc('0x40')][_0xcdfc('0x14f')](db[_0xcdfc('0x86')],{'onDelete':_0xcdfc('0x165'),'foreignKey':_0xcdfc('0x179')});db[_0xcdfc('0x41')]['belongsTo'](db[_0xcdfc('0x38')],{});db[_0xcdfc('0x41')][_0xcdfc('0x14f')](db[_0xcdfc('0xf9')],{'as':_0xcdfc('0x16c'),'foreignKey':_0xcdfc('0x16d')});db[_0xcdfc('0x41')]['belongsTo'](db['CmContact'],{'as':_0xcdfc('0x177'),'foreignKey':'ContactId'});db['MailQueueReport'][_0xcdfc('0x14f')](db[_0xcdfc('0x3d')],{});db[_0xcdfc('0x41')]['belongsTo'](db[_0xcdfc('0x3e')],{});db[_0xcdfc('0x41')][_0xcdfc('0x14f')](db[_0xcdfc('0x12')],{});db['MailQueueReport'][_0xcdfc('0x14f')](db['MailQueue'],{});db[_0xcdfc('0x43')][_0xcdfc('0x117')](db['DashboardItem'],{'as':_0xcdfc('0x17a'),'onDelete':_0xcdfc('0x11b')});db['FaxAccount']['hasMany'](db['Disposition'],{'as':_0xcdfc('0x17b'),'foreignKey':_0xcdfc('0x17c'),'onDelete':_0xcdfc('0x11b')});db[_0xcdfc('0x47')][_0xcdfc('0x117')](db[_0xcdfc('0x168')],{'as':_0xcdfc('0x169'),'foreignKey':'FaxAccountId'});db[_0xcdfc('0x47')][_0xcdfc('0x117')](db['FaxInteraction'],{'as':_0xcdfc('0x16b')});db[_0xcdfc('0x47')][_0xcdfc('0x117')](db['FaxApplication'],{'as':_0xcdfc('0x148')});db[_0xcdfc('0x47')][_0xcdfc('0x117')](db[_0xcdfc('0x16')],{'as':'Exntensions','onDelete':_0xcdfc('0x11b')});db[_0xcdfc('0x47')][_0xcdfc('0x117')](db['FaxMessage'],{'as':_0xcdfc('0x16a')});db[_0xcdfc('0x47')][_0xcdfc('0x14f')](db[_0xcdfc('0x150')],{'as':_0xcdfc('0x150')});db[_0xcdfc('0x47')]['belongsTo'](db[_0xcdfc('0xf9')],{'as':_0xcdfc('0x16c'),'foreignKey':'ListId'});db[_0xcdfc('0x47')][_0xcdfc('0x14f')](db[_0xcdfc('0x7e')],{'as':'mandatoryDispositionPause','foreignKey':_0xcdfc('0x155')});db['FaxAccount'][_0xcdfc('0x125')](db[_0xcdfc('0x12')],{'as':_0xcdfc('0x158'),'through':_0xcdfc('0x13d')});db[_0xcdfc('0x49')][_0xcdfc('0x14f')](db['User'],{'onDelete':_0xcdfc('0x165')});db['FaxApplication'][_0xcdfc('0x14f')](db[_0xcdfc('0x4d')],{'onDelete':_0xcdfc('0x165')});db[_0xcdfc('0x49')][_0xcdfc('0x14f')](db['FaxAccount'],{'onDelete':'restrict'});db['FaxApplication'][_0xcdfc('0x14f')](db[_0xcdfc('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xcdfc('0x4b')][_0xcdfc('0x117')](db['FaxMessage'],{'as':_0xcdfc('0x16a'),'onDelete':_0xcdfc('0x11b'),'foreignKey':_0xcdfc('0x17d')});db[_0xcdfc('0x4b')][_0xcdfc('0x14f')](db['FaxAccount'],{'as':_0xcdfc('0x170'),'foreignKey':'FaxAccountId'});db[_0xcdfc('0x4b')]['belongsTo'](db[_0xcdfc('0x6b')],{'as':_0xcdfc('0x177'),'foreignKey':_0xcdfc('0x161')});db['FaxInteraction'][_0xcdfc('0x14f')](db[_0xcdfc('0x12')],{'as':'Owner','foreignKey':_0xcdfc('0x119')});db['FaxInteraction'][_0xcdfc('0x125')](db[_0xcdfc('0x86')],{'through':_0xcdfc('0x17e'),'as':_0xcdfc('0x173')});db['FaxInteraction'][_0xcdfc('0x125')](db[_0xcdfc('0x86')],{'through':_0xcdfc('0x17e'),'as':_0xcdfc('0x174')});db['FaxInteraction']['belongsToMany'](db[_0xcdfc('0x12')],{'as':_0xcdfc('0x175'),'through':_0xcdfc('0x12c'),'foreignKey':'FaxInteractionId'});db[_0xcdfc('0x4c')][_0xcdfc('0x14f')](db['User'],{'onDelete':_0xcdfc('0x11b'),'as':_0xcdfc('0x12')});db[_0xcdfc('0x4c')][_0xcdfc('0x14f')](db[_0xcdfc('0x4b')],{'as':'Interaction','foreignKey':_0xcdfc('0x17d')});db[_0xcdfc('0x4c')]['belongsTo'](db[_0xcdfc('0x6b')],{'onDelete':'cascade','as':_0xcdfc('0x177')});db[_0xcdfc('0x4c')]['belongsTo'](db[_0xcdfc('0xed')],{'as':'Attachment','foreignKey':_0xcdfc('0x17f')});db[_0xcdfc('0x4c')][_0xcdfc('0x14f')](db[_0xcdfc('0x47')],{'as':_0xcdfc('0x170'),'foreignKey':'FaxAccountId'});db[_0xcdfc('0x4d')][_0xcdfc('0x125')](db[_0xcdfc('0x12')],{'as':'Agents','through':_0xcdfc('0x2e')});db[_0xcdfc('0x4d')][_0xcdfc('0x125')](db[_0xcdfc('0xe6')],{'through':'team_has_fax_queues','as':_0xcdfc('0x159')});db[_0xcdfc('0x4f')][_0xcdfc('0x14f')](db[_0xcdfc('0x47')],{});db[_0xcdfc('0x4f')][_0xcdfc('0x14f')](db[_0xcdfc('0xf9')],{'as':_0xcdfc('0x16c'),'foreignKey':_0xcdfc('0x16d')});db[_0xcdfc('0x4f')][_0xcdfc('0x14f')](db['CmContact'],{'as':'Contact','foreignKey':_0xcdfc('0x161')});db['FaxQueueReport']['belongsTo'](db[_0xcdfc('0x4b')],{});db[_0xcdfc('0x4f')][_0xcdfc('0x14f')](db[_0xcdfc('0x4c')],{});db[_0xcdfc('0x4f')][_0xcdfc('0x14f')](db[_0xcdfc('0x12')],{});db[_0xcdfc('0x4f')]['belongsTo'](db[_0xcdfc('0x4d')],{});db[_0xcdfc('0x51')][_0xcdfc('0x117')](db[_0xcdfc('0x7a')],{'as':_0xcdfc('0x17b'),'foreignKey':'SmsAccountId','onDelete':_0xcdfc('0x11b')});db[_0xcdfc('0x51')]['hasMany'](db[_0xcdfc('0x168')],{'as':_0xcdfc('0x169'),'foreignKey':'SmsAccountId'});db['SmsAccount'][_0xcdfc('0x117')](db['SmsMessage'],{'as':'Messages','foreignKey':_0xcdfc('0x180')});db[_0xcdfc('0x51')][_0xcdfc('0x117')](db[_0xcdfc('0x120')],{'as':_0xcdfc('0x16b')});db['SmsAccount'][_0xcdfc('0x117')](db[_0xcdfc('0x53')],{'as':_0xcdfc('0x148')});db[_0xcdfc('0x51')][_0xcdfc('0x14f')](db[_0xcdfc('0xf9')],{'as':_0xcdfc('0x16c'),'foreignKey':_0xcdfc('0x16d')});db[_0xcdfc('0x51')][_0xcdfc('0x14f')](db[_0xcdfc('0x7e')],{'as':_0xcdfc('0x181'),'foreignKey':_0xcdfc('0x155')});db[_0xcdfc('0x51')][_0xcdfc('0x125')](db[_0xcdfc('0x12')],{'as':_0xcdfc('0x158'),'through':_0xcdfc('0x143')});db[_0xcdfc('0x53')]['belongsTo'](db[_0xcdfc('0x12')],{'onDelete':_0xcdfc('0x165')});db['SmsApplication']['belongsTo'](db['SmsQueue'],{'onDelete':_0xcdfc('0x165')});db[_0xcdfc('0x53')]['belongsTo'](db[_0xcdfc('0x51')],{'onDelete':_0xcdfc('0x165')});db[_0xcdfc('0x53')][_0xcdfc('0x14f')](db[_0xcdfc('0x7d')],{'onDelete':'restrict','foreignKey':'IntervalId'});db['SmsApplication'][_0xcdfc('0x14f')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xcdfc('0x179')});db[_0xcdfc('0x120')][_0xcdfc('0x117')](db[_0xcdfc('0x182')],{'as':'Messages','onDelete':_0xcdfc('0x11b'),'foreignKey':_0xcdfc('0x183')});db['SmsInteraction'][_0xcdfc('0x14f')](db[_0xcdfc('0x51')],{'as':_0xcdfc('0x170'),'foreignKey':_0xcdfc('0x180')});db[_0xcdfc('0x120')][_0xcdfc('0x14f')](db[_0xcdfc('0x6b')],{'as':'Contact','foreignKey':'ContactId'});db[_0xcdfc('0x120')][_0xcdfc('0x14f')](db['User'],{'as':'Owner','foreignKey':'UserId'});db['SmsInteraction'][_0xcdfc('0x125')](db['Tag'],{'through':_0xcdfc('0x184'),'as':'Tags'});db[_0xcdfc('0x120')]['belongsToMany'](db['Tag'],{'through':_0xcdfc('0x184'),'as':_0xcdfc('0x174')});db['SmsInteraction'][_0xcdfc('0x125')](db['User'],{'as':_0xcdfc('0x175'),'through':_0xcdfc('0x12e'),'foreignKey':_0xcdfc('0x183')});db['SmsMessage'][_0xcdfc('0x14f')](db['User'],{'as':_0xcdfc('0x12')});db['SmsMessage'][_0xcdfc('0x14f')](db['CmContact'],{'onDelete':_0xcdfc('0x11b'),'as':_0xcdfc('0x177')});db[_0xcdfc('0x182')][_0xcdfc('0x14f')](db[_0xcdfc('0x120')],{'onDelete':_0xcdfc('0x11b'),'as':_0xcdfc('0x178'),'foreignKey':'SmsInteractionId'});db['SmsMessage'][_0xcdfc('0x14f')](db[_0xcdfc('0x51')],{'as':_0xcdfc('0x170'),'foreignKey':_0xcdfc('0x180')});db[_0xcdfc('0x56')][_0xcdfc('0x125')](db['User'],{'as':_0xcdfc('0x158'),'through':'UserSmsQueue','foreignKey':'SmsQueueId'});db[_0xcdfc('0x56')]['belongsToMany'](db[_0xcdfc('0xe6')],{'through':_0xcdfc('0x185'),'as':_0xcdfc('0x159')});db['OpenchannelAccount']['hasMany'](db[_0xcdfc('0x7a')],{'as':_0xcdfc('0x17b'),'foreignKey':_0xcdfc('0x186'),'onDelete':_0xcdfc('0x11b')});db[_0xcdfc('0x57')]['hasMany'](db[_0xcdfc('0x168')],{'as':_0xcdfc('0x169'),'foreignKey':'OpenchannelAccountId'});db[_0xcdfc('0x57')][_0xcdfc('0x117')](db[_0xcdfc('0x5a')],{'as':_0xcdfc('0x16b'),'foreignKey':_0xcdfc('0x186')});db[_0xcdfc('0x57')]['hasMany'](db['OpenchannelMessage'],{'as':'Messages','foreignKey':'OpenchannelAccountId'});db[_0xcdfc('0x57')][_0xcdfc('0x117')](db[_0xcdfc('0x59')],{'as':_0xcdfc('0x148'),'foreignKey':'OpenchannelAccountId'});db[_0xcdfc('0x57')][_0xcdfc('0x14f')](db['CmList'],{'as':_0xcdfc('0x16c'),'foreignKey':_0xcdfc('0x16d')});db[_0xcdfc('0x57')][_0xcdfc('0x14f')](db[_0xcdfc('0x7e')],{'as':_0xcdfc('0x181'),'foreignKey':_0xcdfc('0x155')});db[_0xcdfc('0x57')][_0xcdfc('0x125')](db[_0xcdfc('0x12')],{'as':'Agents','through':_0xcdfc('0x141')});db[_0xcdfc('0x59')][_0xcdfc('0x14f')](db[_0xcdfc('0x12')],{'onDelete':_0xcdfc('0x165')});db[_0xcdfc('0x59')][_0xcdfc('0x14f')](db['OpenchannelQueue'],{'onDelete':_0xcdfc('0x165'),'foreignKey':_0xcdfc('0x187')});db['OpenchannelApplication'][_0xcdfc('0x14f')](db[_0xcdfc('0x57')],{'onDelete':_0xcdfc('0x165'),'foreignKey':_0xcdfc('0x186')});db[_0xcdfc('0x59')][_0xcdfc('0x14f')](db[_0xcdfc('0x7d')],{'onDelete':_0xcdfc('0x165'),'foreignKey':_0xcdfc('0x154')});db[_0xcdfc('0x59')][_0xcdfc('0x14f')](db[_0xcdfc('0x86')],{'onDelete':_0xcdfc('0x165'),'foreignKey':_0xcdfc('0x179')});db[_0xcdfc('0x5a')][_0xcdfc('0x117')](db[_0xcdfc('0x5c')],{'as':_0xcdfc('0x16a'),'onDelete':_0xcdfc('0x11b'),'foreignKey':_0xcdfc('0x188')});db[_0xcdfc('0x5a')][_0xcdfc('0x14f')](db['OpenchannelAccount'],{'as':_0xcdfc('0x170'),'foreignKey':_0xcdfc('0x186')});db[_0xcdfc('0x5a')][_0xcdfc('0x14f')](db[_0xcdfc('0x6b')],{'as':_0xcdfc('0x177'),'foreignKey':_0xcdfc('0x161')});db[_0xcdfc('0x5a')][_0xcdfc('0x14f')](db[_0xcdfc('0x12')],{'as':_0xcdfc('0x171'),'foreignKey':_0xcdfc('0x119')});db[_0xcdfc('0x5a')][_0xcdfc('0x125')](db[_0xcdfc('0x86')],{'through':_0xcdfc('0x189'),'as':_0xcdfc('0x173')});db['OpenchannelInteraction'][_0xcdfc('0x125')](db['Tag'],{'through':_0xcdfc('0x189'),'as':_0xcdfc('0x174')});db[_0xcdfc('0x5a')]['belongsToMany'](db['User'],{'as':_0xcdfc('0x175'),'through':_0xcdfc('0x12f'),'foreignKey':_0xcdfc('0x188')});db[_0xcdfc('0x5c')][_0xcdfc('0x14f')](db[_0xcdfc('0x12')],{'onDelete':_0xcdfc('0x11b'),'as':'User'});db[_0xcdfc('0x5c')][_0xcdfc('0x14f')](db[_0xcdfc('0x6b')],{'onDelete':_0xcdfc('0x11b'),'as':'Contact'});db[_0xcdfc('0x5c')][_0xcdfc('0x14f')](db[_0xcdfc('0x5a')],{'onDelete':_0xcdfc('0x11b'),'as':_0xcdfc('0x178'),'foreignKey':_0xcdfc('0x188')});db[_0xcdfc('0x5c')]['belongsTo'](db[_0xcdfc('0xed')],{'as':'Attachment','foreignKey':_0xcdfc('0x17f')});db[_0xcdfc('0x5c')][_0xcdfc('0x14f')](db['OpenchannelAccount'],{'as':_0xcdfc('0x170'),'foreignKey':_0xcdfc('0x186')});db['OpenchannelQueue'][_0xcdfc('0x125')](db['User'],{'as':_0xcdfc('0x158'),'through':_0xcdfc('0x31'),'foreignKey':_0xcdfc('0x187')});db[_0xcdfc('0x5e')][_0xcdfc('0x125')](db[_0xcdfc('0xe6')],{'through':_0xcdfc('0x18a'),'as':_0xcdfc('0x159')});db[_0xcdfc('0x5f')][_0xcdfc('0x117')](db[_0xcdfc('0x7a')],{'as':_0xcdfc('0x17b'),'foreignKey':_0xcdfc('0x18b'),'onDelete':_0xcdfc('0x11b')});db[_0xcdfc('0x5f')]['hasMany'](db[_0xcdfc('0x168')],{'as':_0xcdfc('0x169'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0xcdfc('0x117')](db['ChatProactiveAction'],{'as':_0xcdfc('0x18c')});db[_0xcdfc('0x5f')][_0xcdfc('0x117')](db[_0xcdfc('0x63')],{'as':_0xcdfc('0x16b')});db[_0xcdfc('0x5f')]['hasMany'](db['ChatApplication'],{'as':_0xcdfc('0x148')});db[_0xcdfc('0x5f')][_0xcdfc('0x117')](db[_0xcdfc('0x18d')],{'as':_0xcdfc('0x16a')});db[_0xcdfc('0x5f')][_0xcdfc('0x14f')](db[_0xcdfc('0xf9')],{'as':'List','foreignKey':_0xcdfc('0x16d')});db[_0xcdfc('0x5f')][_0xcdfc('0x14f')](db['Interval'],{'as':_0xcdfc('0x7d'),'foreignKey':_0xcdfc('0x154')});db['ChatWebsite'][_0xcdfc('0x14f')](db[_0xcdfc('0x38')],{'as':'MailAccount','foreignKey':_0xcdfc('0x162')});db['ChatWebsite'][_0xcdfc('0x14f')](db[_0xcdfc('0x7e')],{'as':_0xcdfc('0x181'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xcdfc('0x5f')][_0xcdfc('0x125')](db[_0xcdfc('0x12')],{'as':'Agents','through':'user_has_chat_websites'});db['OpenchannelQueueReport'][_0xcdfc('0x14f')](db[_0xcdfc('0x57')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0xcdfc('0xf9')],{'as':_0xcdfc('0x16c'),'foreignKey':_0xcdfc('0x16d')});db[_0xcdfc('0x60')][_0xcdfc('0x14f')](db[_0xcdfc('0x6b')],{'as':_0xcdfc('0x177'),'foreignKey':_0xcdfc('0x161')});db[_0xcdfc('0x60')][_0xcdfc('0x14f')](db[_0xcdfc('0x5a')],{});db[_0xcdfc('0x60')][_0xcdfc('0x14f')](db[_0xcdfc('0x5c')],{});db[_0xcdfc('0x60')][_0xcdfc('0x14f')](db['User'],{});db[_0xcdfc('0x60')][_0xcdfc('0x14f')](db[_0xcdfc('0x5e')],{});db['ChatApplication']['belongsTo'](db[_0xcdfc('0x12')],{'as':_0xcdfc('0x18e'),'foreignKey':'UserId','onDelete':_0xcdfc('0x165')});db[_0xcdfc('0x61')][_0xcdfc('0x14f')](db['ChatQueue'],{'as':_0xcdfc('0x18f'),'foreignKey':_0xcdfc('0x190'),'onDelete':_0xcdfc('0x165')});db[_0xcdfc('0x61')][_0xcdfc('0x14f')](db[_0xcdfc('0x5f')],{'as':_0xcdfc('0x191'),'foreignKey':_0xcdfc('0x18b'),'onDelete':_0xcdfc('0x165')});db[_0xcdfc('0x61')][_0xcdfc('0x14f')](db[_0xcdfc('0x86')],{'onDelete':_0xcdfc('0x165'),'foreignKey':_0xcdfc('0x179')});db[_0xcdfc('0x63')]['hasMany'](db[_0xcdfc('0x18d')],{'as':_0xcdfc('0x16a'),'onDelete':_0xcdfc('0x11b'),'foreignKey':_0xcdfc('0x192')});db[_0xcdfc('0x63')]['belongsTo'](db[_0xcdfc('0x5f')],{'as':_0xcdfc('0x170'),'foreignKey':_0xcdfc('0x18b')});db[_0xcdfc('0x63')][_0xcdfc('0x14f')](db[_0xcdfc('0x6b')],{'as':_0xcdfc('0x177'),'foreignKey':_0xcdfc('0x161')});db['ChatInteraction'][_0xcdfc('0x14f')](db[_0xcdfc('0x12')],{'as':'Owner','foreignKey':_0xcdfc('0x119')});db[_0xcdfc('0x63')][_0xcdfc('0x125')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0xcdfc('0x173')});db[_0xcdfc('0x63')][_0xcdfc('0x125')](db[_0xcdfc('0x86')],{'through':'chat_interaction_has_tags','as':_0xcdfc('0x174')});db[_0xcdfc('0x63')][_0xcdfc('0x125')](db[_0xcdfc('0x12')],{'as':'Users','through':_0xcdfc('0x193'),'foreignKey':_0xcdfc('0x192')});db[_0xcdfc('0x18d')][_0xcdfc('0x14f')](db[_0xcdfc('0x12')],{'onDelete':_0xcdfc('0x11b'),'as':_0xcdfc('0x12')});db[_0xcdfc('0x18d')][_0xcdfc('0x14f')](db['CmContact'],{'onDelete':_0xcdfc('0x11b'),'as':_0xcdfc('0x177'),'foreignKey':_0xcdfc('0x161')});db[_0xcdfc('0x18d')]['belongsTo'](db['ChatInteraction'],{'onDelete':_0xcdfc('0x11b'),'as':_0xcdfc('0x178'),'foreignKey':_0xcdfc('0x192')});db[_0xcdfc('0x18d')]['belongsTo'](db[_0xcdfc('0xed')],{'as':_0xcdfc('0xed'),'foreignKey':_0xcdfc('0x17f')});db['ChatMessage'][_0xcdfc('0x14f')](db[_0xcdfc('0x5f')],{'as':_0xcdfc('0x170'),'foreignKey':_0xcdfc('0x18b')});db[_0xcdfc('0x65')][_0xcdfc('0x117')](db[_0xcdfc('0xed')],{'as':'Attachments','foreignKey':_0xcdfc('0x194'),'onDelete':_0xcdfc('0x11b'),'hooks':!![]});db[_0xcdfc('0x65')][_0xcdfc('0x14f')](db[_0xcdfc('0x6b')],{'onDelete':_0xcdfc('0x11b'),'as':_0xcdfc('0x177'),'foreignKey':_0xcdfc('0x161')});db[_0xcdfc('0x65')][_0xcdfc('0x14f')](db['ChatWebsite'],{'as':_0xcdfc('0x170'),'foreignKey':'ChatWebsiteId'});db[_0xcdfc('0x66')][_0xcdfc('0x125')](db[_0xcdfc('0x12')],{'as':'Agents','through':_0xcdfc('0x136'),'hooks':!![]});db[_0xcdfc('0x66')][_0xcdfc('0x125')](db[_0xcdfc('0xe6')],{'through':_0xcdfc('0x195'),'as':_0xcdfc('0x159')});db[_0xcdfc('0x67')][_0xcdfc('0x117')](db[_0xcdfc('0xd1')],{'as':'Messages','foreignKey':_0xcdfc('0x196'),'onDelete':_0xcdfc('0x11b')});db[_0xcdfc('0x67')]['belongsToMany'](db[_0xcdfc('0x12')],{'as':'Members','through':_0xcdfc('0x197')});db[_0xcdfc('0x198')][_0xcdfc('0x14f')](db[_0xcdfc('0x5f')],{'as':_0xcdfc('0x191'),'foreignKey':'ChatWebsiteId'});db[_0xcdfc('0x69')][_0xcdfc('0x117')](db['CmContact'],{'as':_0xcdfc('0x127'),'foreignKey':_0xcdfc('0x199')});db['CmContact'][_0xcdfc('0x117')](db['CmHopper'],{'as':_0xcdfc('0x14b'),'foreignKey':_0xcdfc('0x161')});db['CmContact'][_0xcdfc('0x117')](db[_0xcdfc('0x6f')],{'as':'HopperFinals','foreignKey':_0xcdfc('0x161')});db[_0xcdfc('0x6b')]['hasMany'](db[_0xcdfc('0x71')],{'as':'HopperHistories','foreignKey':_0xcdfc('0x161')});db[_0xcdfc('0x6b')][_0xcdfc('0x117')](db[_0xcdfc('0x11d')],{'as':_0xcdfc('0x11d'),'foreignKey':'ContactId'});db[_0xcdfc('0x6b')][_0xcdfc('0x117')](db[_0xcdfc('0x19a')],{'as':'JscriptySessions','foreignKey':'ContactId'});db[_0xcdfc('0x6b')][_0xcdfc('0x117')](db[_0xcdfc('0x5a')],{'as':'OpenchannelInteractions','foreignKey':_0xcdfc('0x161'),'onDelete':_0xcdfc('0x165')});db['CmContact'][_0xcdfc('0x117')](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0xcdfc('0x161'),'onDelete':_0xcdfc('0x165')});db[_0xcdfc('0x6b')][_0xcdfc('0x117')](db[_0xcdfc('0x120')],{'as':_0xcdfc('0x12d'),'foreignKey':_0xcdfc('0x161'),'onDelete':_0xcdfc('0x165')});db[_0xcdfc('0x6b')][_0xcdfc('0x117')](db[_0xcdfc('0x4b')],{'as':_0xcdfc('0x121'),'foreignKey':_0xcdfc('0x161'),'onDelete':_0xcdfc('0x165')});db[_0xcdfc('0x6b')]['hasMany'](db['MailInteraction'],{'as':_0xcdfc('0x12a'),'foreignKey':'ContactId','onDelete':_0xcdfc('0x165')});db['CmContact'][_0xcdfc('0x14f')](db[_0xcdfc('0x69')],{'as':_0xcdfc('0x19b'),'foreignKey':_0xcdfc('0x199')});db[_0xcdfc('0x6b')][_0xcdfc('0x14f')](db[_0xcdfc('0xf9')],{'as':'List','foreignKey':_0xcdfc('0x16d'),'onDelete':_0xcdfc('0x11b')});db[_0xcdfc('0x6b')][_0xcdfc('0x125')](db['User'],{'as':_0xcdfc('0x175'),'through':_0xcdfc('0x19c')});db[_0xcdfc('0x6b')]['belongsToMany'](db[_0xcdfc('0x86')],{'as':_0xcdfc('0x173'),'through':'cm_contact_has_tags'});db['CmContact']['belongsToMany'](db[_0xcdfc('0x86')],{'through':_0xcdfc('0x19d'),'as':'ThroughTags'});db[_0xcdfc('0x6d')]['belongsTo'](db[_0xcdfc('0x6b')],{'as':_0xcdfc('0x177'),'foreignKey':_0xcdfc('0x161'),'onDelete':_0xcdfc('0x11b')});db[_0xcdfc('0x6d')]['belongsTo'](db[_0xcdfc('0xf9')],{'as':_0xcdfc('0x16c'),'foreignKey':_0xcdfc('0x16d'),'onDelete':_0xcdfc('0x11b')});db[_0xcdfc('0x6d')][_0xcdfc('0x14f')](db[_0xcdfc('0x12')],{'as':'Agent','foreignKey':'UserId'});db[_0xcdfc('0x6d')]['belongsTo'](db[_0xcdfc('0x1a')],{'as':_0xcdfc('0x18f'),'foreignKey':_0xcdfc('0x14a'),'onDelete':_0xcdfc('0x11b')});db['CmHopper'][_0xcdfc('0x14f')](db['Campaign'],{'as':_0xcdfc('0xea'),'foreignKey':'CampaignId','onDelete':_0xcdfc('0x11b')});db[_0xcdfc('0x6d')][_0xcdfc('0x14f')](db[_0xcdfc('0x12')],{'as':_0xcdfc('0x171'),'foreignKey':_0xcdfc('0x19e')});db[_0xcdfc('0x6e')][_0xcdfc('0x14f')](db['CmContact'],{'as':_0xcdfc('0x177'),'foreignKey':_0xcdfc('0x161'),'onDelete':_0xcdfc('0x11b')});db[_0xcdfc('0x6e')][_0xcdfc('0x14f')](db[_0xcdfc('0xf9')],{'as':_0xcdfc('0x16c'),'foreignKey':_0xcdfc('0x16d'),'onDelete':'cascade'});db[_0xcdfc('0x6e')][_0xcdfc('0x14f')](db[_0xcdfc('0x1a')],{'as':_0xcdfc('0x18f'),'foreignKey':_0xcdfc('0x14a'),'onDelete':_0xcdfc('0x11b')});db[_0xcdfc('0x6e')]['belongsTo'](db[_0xcdfc('0xea')],{'as':_0xcdfc('0xea'),'foreignKey':_0xcdfc('0x19f'),'onDelete':_0xcdfc('0x11b')});db[_0xcdfc('0x77')][_0xcdfc('0x117')](db[_0xcdfc('0x7b')],{'as':{'plural':'All','singular':_0xcdfc('0x1a0')},'foreignKey':_0xcdfc('0x1a1'),'onDelete':_0xcdfc('0x11b'),'hooks':!![]});db[_0xcdfc('0x77')][_0xcdfc('0x117')](db['Condition'],{'as':{'plural':_0xcdfc('0x1a2'),'singular':_0xcdfc('0x1a3')},'foreignKey':_0xcdfc('0x1a4'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0xcdfc('0x117')](db[_0xcdfc('0x75')],{'as':_0xcdfc('0x1a5'),'foreignKey':_0xcdfc('0x1a6'),'onDelete':_0xcdfc('0x11b'),'hooks':!![]});db[_0xcdfc('0x7a')][_0xcdfc('0x117')](db[_0xcdfc('0x7a')],{'as':_0xcdfc('0x17b'),'foreignKey':_0xcdfc('0x1a7'),'onDelete':_0xcdfc('0x11b')});db[_0xcdfc('0x7d')][_0xcdfc('0x117')](db[_0xcdfc('0x7d')],{'as':_0xcdfc('0x1a8'),'foreignKey':'IntervalId','onDelete':_0xcdfc('0x11b'),'hooks':!![],'required':![]});db[_0xcdfc('0x7d')][_0xcdfc('0x117')](db[_0xcdfc('0x16')],{'as':_0xcdfc('0x11a'),'foreignKey':_0xcdfc('0x154'),'onDelete':_0xcdfc('0x165')});db[_0xcdfc('0x7d')][_0xcdfc('0x117')](db[_0xcdfc('0x40')],{'as':_0xcdfc('0x1a9'),'foreignKey':_0xcdfc('0x154')});db[_0xcdfc('0x7d')][_0xcdfc('0x117')](db['ChatApplication'],{'as':'ChatApplications','foreignKey':'IntervalId'});db['Interval']['hasMany'](db[_0xcdfc('0x49')],{'as':_0xcdfc('0x1aa'),'foreignKey':_0xcdfc('0x154')});db[_0xcdfc('0x7d')]['hasMany'](db['SmsApplication'],{'as':_0xcdfc('0x1ab'),'foreignKey':'IntervalId'});db[_0xcdfc('0x1ac')]['belongsTo'](db[_0xcdfc('0x38')],{});db['Schedule']['belongsTo'](db[_0xcdfc('0x94')],{'foreignKey':_0xcdfc('0x1ad')});db[_0xcdfc('0x1ac')][_0xcdfc('0x14f')](db[_0xcdfc('0x92')],{'foreignKey':_0xcdfc('0x1ae')});db[_0xcdfc('0x84')][_0xcdfc('0x125')](db[_0xcdfc('0x18')],{'as':_0xcdfc('0x1af'),'through':_0xcdfc('0x149'),'onDelete':'restrict'});db[_0xcdfc('0x86')][_0xcdfc('0x125')](db[_0xcdfc('0x6b')],{'through':'cm_contact_has_tags'});db[_0xcdfc('0x86')][_0xcdfc('0x125')](db[_0xcdfc('0x63')],{'through':_0xcdfc('0x1b0')});db['Tag'][_0xcdfc('0x125')](db[_0xcdfc('0x3d')],{'through':'mail_interaction_has_tags'});db[_0xcdfc('0x86')][_0xcdfc('0x125')](db[_0xcdfc('0x120')],{'through':_0xcdfc('0x184')});db[_0xcdfc('0x86')][_0xcdfc('0x125')](db[_0xcdfc('0x4b')],{'through':_0xcdfc('0x17e')});db[_0xcdfc('0x86')][_0xcdfc('0x125')](db['OpenchannelInteraction'],{'through':'openchannel_interaction_has_tags'});db[_0xcdfc('0x86')][_0xcdfc('0x125')](db['WhatsappInteraction'],{'through':_0xcdfc('0x1b1')});db[_0xcdfc('0x8a')][_0xcdfc('0x117')](db['Condition'],{'as':{'plural':_0xcdfc('0x1b2'),'singular':'AllCondition'},'foreignKey':_0xcdfc('0x1b3'),'onDelete':'cascade','hooks':!![]});db[_0xcdfc('0x8a')]['hasMany'](db[_0xcdfc('0x7b')],{'as':{'plural':_0xcdfc('0x1b4'),'singular':_0xcdfc('0x1b5')},'foreignKey':_0xcdfc('0x1b6'),'onDelete':_0xcdfc('0x11b'),'hooks':!![]});db[_0xcdfc('0x8a')][_0xcdfc('0x117')](db[_0xcdfc('0x75')],{'as':'Actions','foreignKey':_0xcdfc('0x1b7'),'onDelete':_0xcdfc('0x11b'),'hooks':!![]});db[_0xcdfc('0x92')]['hasMany'](db[_0xcdfc('0x1b8')],{'as':_0xcdfc('0x1b9'),'onDelete':_0xcdfc('0x11b'),'foreignKey':_0xcdfc('0x1ae'),'hooks':!![]});db[_0xcdfc('0x94')]['hasMany'](db[_0xcdfc('0x1b8')],{'as':_0xcdfc('0x1b9'),'onDelete':_0xcdfc('0x11b'),'foreignKey':_0xcdfc('0x1ad')});db['AnalyticMetric']['hasMany'](db['AnalyticFieldReport'],{'as':'Fields','onDelete':'cascade','foreignKey':_0xcdfc('0x1ba')});db['AnalyticFieldReport'][_0xcdfc('0x14f')](db[_0xcdfc('0x98')],{'foreignKey':_0xcdfc('0x1ba')});db[_0xcdfc('0x9d')][_0xcdfc('0x117')](db[_0xcdfc('0x9f')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xcdfc('0x1bb')});db[_0xcdfc('0x9f')][_0xcdfc('0x117')](db[_0xcdfc('0xa0')],{'as':_0xcdfc('0x1bc'),'onDelete':_0xcdfc('0x11b'),'foreignKey':_0xcdfc('0x1bd')});db['SalesforceConfiguration'][_0xcdfc('0x117')](db[_0xcdfc('0xa0')],{'as':_0xcdfc('0x1be'),'onDelete':_0xcdfc('0x11b'),'foreignKey':'DescriptionId'});db[_0xcdfc('0x9f')][_0xcdfc('0x117')](db[_0xcdfc('0xa0')],{'as':_0xcdfc('0x1b9'),'onDelete':_0xcdfc('0x11b'),'foreignKey':_0xcdfc('0x1bf')});db[_0xcdfc('0x9f')][_0xcdfc('0x14f')](db[_0xcdfc('0x9d')],{'as':_0xcdfc('0x170'),'foreignKey':_0xcdfc('0x1bb')});db[_0xcdfc('0xa0')][_0xcdfc('0x117')](db[_0xcdfc('0xa0')],{'as':_0xcdfc('0x1c0'),'foreignKey':_0xcdfc('0x1bd')});db[_0xcdfc('0xa0')][_0xcdfc('0x117')](db[_0xcdfc('0xa0')],{'as':_0xcdfc('0x1c1'),'foreignKey':_0xcdfc('0x1c2')});db[_0xcdfc('0xa0')]['hasMany'](db['SalesforceField'],{'as':_0xcdfc('0x1c3'),'foreignKey':_0xcdfc('0x1bf')});db['SalesforceField']['belongsTo'](db['Variable'],{'as':_0xcdfc('0x8c'),'foreignKey':_0xcdfc('0x1c4')});db[_0xcdfc('0xa2')][_0xcdfc('0x117')](db[_0xcdfc('0x1c5')],{'as':'Configurations','onDelete':_0xcdfc('0x11b'),'foreignKey':_0xcdfc('0x1bb')});db[_0xcdfc('0x1c5')][_0xcdfc('0x117')](db['SugarcrmField'],{'as':'Subjects','onDelete':_0xcdfc('0x11b'),'foreignKey':_0xcdfc('0x1bd')});db['SugarcrmConfiguration']['hasMany'](db[_0xcdfc('0x1c6')],{'as':_0xcdfc('0x1be'),'onDelete':_0xcdfc('0x11b'),'foreignKey':'DescriptionId'});db[_0xcdfc('0x1c5')][_0xcdfc('0x117')](db[_0xcdfc('0x1c6')],{'as':_0xcdfc('0x1b9'),'onDelete':_0xcdfc('0x11b'),'foreignKey':_0xcdfc('0x1bf')});db[_0xcdfc('0x1c5')]['belongsTo'](db[_0xcdfc('0xa2')],{'as':'Account','foreignKey':_0xcdfc('0x1bb')});db[_0xcdfc('0x1c6')][_0xcdfc('0x117')](db[_0xcdfc('0x1c6')],{'as':_0xcdfc('0x1c0'),'foreignKey':_0xcdfc('0x1bd')});db['SugarcrmField'][_0xcdfc('0x117')](db['SugarcrmField'],{'as':_0xcdfc('0x1c1'),'foreignKey':_0xcdfc('0x1c2')});db['SugarcrmField'][_0xcdfc('0x117')](db[_0xcdfc('0x1c6')],{'as':'Field','foreignKey':_0xcdfc('0x1bf')});db[_0xcdfc('0x1c6')][_0xcdfc('0x14f')](db['Variable'],{'as':_0xcdfc('0x8c'),'foreignKey':_0xcdfc('0x1c4')});db[_0xcdfc('0xa4')][_0xcdfc('0x117')](db[_0xcdfc('0xa6')],{'as':'Configurations','onDelete':_0xcdfc('0x11b'),'foreignKey':'AccountId'});db[_0xcdfc('0xa6')][_0xcdfc('0x117')](db[_0xcdfc('0xa8')],{'as':_0xcdfc('0x1bc'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0xcdfc('0xa6')][_0xcdfc('0x117')](db[_0xcdfc('0xa8')],{'as':_0xcdfc('0x1be'),'onDelete':_0xcdfc('0x11b'),'foreignKey':_0xcdfc('0x1c2')});db[_0xcdfc('0xa6')][_0xcdfc('0x117')](db[_0xcdfc('0xa8')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xcdfc('0x1bf')});db['DeskConfiguration'][_0xcdfc('0x14f')](db[_0xcdfc('0xa4')],{'as':_0xcdfc('0x170'),'foreignKey':_0xcdfc('0x1bb')});db[_0xcdfc('0xa6')]['belongsToMany'](db[_0xcdfc('0x86')],{'through':_0xcdfc('0x1c7')});db['DeskField'][_0xcdfc('0x117')](db[_0xcdfc('0xa8')],{'as':_0xcdfc('0x1c0'),'foreignKey':_0xcdfc('0x1bd')});db[_0xcdfc('0xa8')][_0xcdfc('0x117')](db['DeskField'],{'as':_0xcdfc('0x1c1'),'foreignKey':_0xcdfc('0x1c2')});db[_0xcdfc('0xa8')][_0xcdfc('0x117')](db[_0xcdfc('0xa8')],{'as':_0xcdfc('0x1c3'),'foreignKey':'FieldId'});db[_0xcdfc('0xa8')]['belongsTo'](db[_0xcdfc('0x8c')],{'as':_0xcdfc('0x8c'),'foreignKey':_0xcdfc('0x1c4')});db[_0xcdfc('0xaa')][_0xcdfc('0x117')](db[_0xcdfc('0xac')],{'as':_0xcdfc('0x1c8'),'onDelete':'cascade','foreignKey':_0xcdfc('0x1bb')});db['ZohoConfiguration']['hasMany'](db[_0xcdfc('0xad')],{'as':_0xcdfc('0x1bc'),'onDelete':_0xcdfc('0x11b'),'foreignKey':_0xcdfc('0x1bd')});db[_0xcdfc('0xac')][_0xcdfc('0x117')](db[_0xcdfc('0xad')],{'as':_0xcdfc('0x1be'),'onDelete':_0xcdfc('0x11b'),'foreignKey':_0xcdfc('0x1c2')});db[_0xcdfc('0xac')]['hasMany'](db[_0xcdfc('0xad')],{'as':_0xcdfc('0x1b9'),'onDelete':_0xcdfc('0x11b'),'foreignKey':_0xcdfc('0x1bf')});db['ZohoConfiguration'][_0xcdfc('0x14f')](db['ZohoAccount'],{'as':_0xcdfc('0x170'),'foreignKey':'AccountId'});db[_0xcdfc('0xad')]['hasMany'](db['ZohoField'],{'as':_0xcdfc('0x1c0'),'foreignKey':_0xcdfc('0x1bd')});db[_0xcdfc('0xad')][_0xcdfc('0x117')](db[_0xcdfc('0xad')],{'as':_0xcdfc('0x1c1'),'foreignKey':_0xcdfc('0x1c2')});db[_0xcdfc('0xad')][_0xcdfc('0x117')](db[_0xcdfc('0xad')],{'as':_0xcdfc('0x1c3'),'foreignKey':_0xcdfc('0x1bf')});db['ZohoField']['belongsTo'](db['Variable'],{'as':_0xcdfc('0x8c'),'foreignKey':_0xcdfc('0x1c4')});db[_0xcdfc('0xaf')]['hasMany'](db['ZendeskConfiguration'],{'as':_0xcdfc('0x1c8'),'onDelete':_0xcdfc('0x11b'),'foreignKey':_0xcdfc('0x1bb')});db[_0xcdfc('0xb1')][_0xcdfc('0x117')](db['ZendeskField'],{'as':_0xcdfc('0x1bc'),'foreignKey':_0xcdfc('0x1bd')});db['ZendeskConfiguration']['hasMany'](db['ZendeskField'],{'as':_0xcdfc('0x1be'),'foreignKey':'DescriptionId'});db[_0xcdfc('0xb1')][_0xcdfc('0x117')](db[_0xcdfc('0xb3')],{'as':_0xcdfc('0x1b9'),'foreignKey':_0xcdfc('0x1bf')});db[_0xcdfc('0xb1')][_0xcdfc('0x14f')](db[_0xcdfc('0xaf')],{'as':_0xcdfc('0x170'),'foreignKey':_0xcdfc('0x1bb')});db[_0xcdfc('0xb1')]['belongsToMany'](db['Tag'],{'through':_0xcdfc('0x1c9')});db[_0xcdfc('0xb3')]['hasMany'](db['ZendeskField'],{'as':'Subject','foreignKey':_0xcdfc('0x1bd')});db['ZendeskField']['hasMany'](db[_0xcdfc('0xb3')],{'as':_0xcdfc('0x1c1'),'foreignKey':_0xcdfc('0x1c2')});db[_0xcdfc('0xb3')][_0xcdfc('0x117')](db[_0xcdfc('0xb3')],{'as':_0xcdfc('0x1c3'),'foreignKey':_0xcdfc('0x1bf')});db['ZendeskField'][_0xcdfc('0x14f')](db[_0xcdfc('0x8c')],{'as':_0xcdfc('0x8c'),'foreignKey':_0xcdfc('0x1c4')});db[_0xcdfc('0xb5')]['hasMany'](db[_0xcdfc('0xb6')],{'as':'Configurations','onDelete':_0xcdfc('0x11b'),'foreignKey':'AccountId'});db[_0xcdfc('0xb6')][_0xcdfc('0x117')](db['FreshdeskField'],{'as':_0xcdfc('0x1bc'),'onDelete':'cascade','foreignKey':_0xcdfc('0x1bd')});db[_0xcdfc('0xb6')][_0xcdfc('0x117')](db['FreshdeskField'],{'as':_0xcdfc('0x1be'),'onDelete':_0xcdfc('0x11b'),'foreignKey':_0xcdfc('0x1c2')});db[_0xcdfc('0xb6')]['hasMany'](db[_0xcdfc('0xb8')],{'as':_0xcdfc('0x1b9'),'onDelete':_0xcdfc('0x11b'),'foreignKey':_0xcdfc('0x1bf')});db[_0xcdfc('0xb6')][_0xcdfc('0x14f')](db[_0xcdfc('0xb5')],{'as':_0xcdfc('0x170'),'foreignKey':_0xcdfc('0x1bb')});db[_0xcdfc('0xb6')][_0xcdfc('0x125')](db[_0xcdfc('0x86')],{'through':_0xcdfc('0x1ca')});db[_0xcdfc('0xb8')][_0xcdfc('0x117')](db[_0xcdfc('0xb8')],{'as':_0xcdfc('0x1c0'),'foreignKey':_0xcdfc('0x1bd')});db[_0xcdfc('0xb8')][_0xcdfc('0x117')](db[_0xcdfc('0xb8')],{'as':_0xcdfc('0x1c1'),'foreignKey':_0xcdfc('0x1c2')});db[_0xcdfc('0xb8')]['hasMany'](db[_0xcdfc('0xb8')],{'as':_0xcdfc('0x1c3'),'foreignKey':_0xcdfc('0x1bf')});db[_0xcdfc('0xb8')][_0xcdfc('0x14f')](db[_0xcdfc('0x8c')],{'as':_0xcdfc('0x8c'),'foreignKey':_0xcdfc('0x1c4')});db[_0xcdfc('0xba')][_0xcdfc('0x117')](db[_0xcdfc('0xbc')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xcdfc('0x1bb')});db[_0xcdfc('0xbc')]['hasMany'](db[_0xcdfc('0xbe')],{'as':_0xcdfc('0x1bc'),'foreignKey':_0xcdfc('0x1bd')});db[_0xcdfc('0xbc')][_0xcdfc('0x117')](db[_0xcdfc('0xbe')],{'as':'Descriptions','foreignKey':_0xcdfc('0x1c2')});db[_0xcdfc('0xbc')][_0xcdfc('0x117')](db[_0xcdfc('0xbe')],{'as':_0xcdfc('0x1b9'),'foreignKey':_0xcdfc('0x1bf')});db[_0xcdfc('0xbc')]['belongsTo'](db[_0xcdfc('0xba')],{'as':_0xcdfc('0x170'),'foreignKey':_0xcdfc('0x1bb')});db[_0xcdfc('0xbe')][_0xcdfc('0x117')](db[_0xcdfc('0xbe')],{'as':_0xcdfc('0x1c0'),'foreignKey':_0xcdfc('0x1bd')});db[_0xcdfc('0xbe')][_0xcdfc('0x117')](db[_0xcdfc('0xbe')],{'as':_0xcdfc('0x1c1'),'foreignKey':_0xcdfc('0x1c2')});db[_0xcdfc('0xbe')]['hasMany'](db[_0xcdfc('0xbe')],{'as':_0xcdfc('0x1c3'),'foreignKey':_0xcdfc('0x1bf')});db[_0xcdfc('0xbe')]['belongsTo'](db['Variable'],{'as':_0xcdfc('0x8c'),'foreignKey':_0xcdfc('0x1c4')});db[_0xcdfc('0x1cb')][_0xcdfc('0x117')](db['ServicenowConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xcdfc('0x1bb')});db[_0xcdfc('0x1cc')]['hasMany'](db[_0xcdfc('0xc0')],{'as':_0xcdfc('0x1bc'),'foreignKey':_0xcdfc('0x1bd')});db[_0xcdfc('0x1cc')][_0xcdfc('0x117')](db[_0xcdfc('0xc0')],{'as':_0xcdfc('0x1be'),'foreignKey':'DescriptionId'});db[_0xcdfc('0x1cc')]['hasMany'](db['ServicenowField'],{'as':'Fields','foreignKey':_0xcdfc('0x1bf')});db[_0xcdfc('0x1cc')][_0xcdfc('0x14f')](db[_0xcdfc('0x1cb')],{'as':_0xcdfc('0x170'),'foreignKey':_0xcdfc('0x1bb')});db['ServicenowField'][_0xcdfc('0x117')](db[_0xcdfc('0xc0')],{'as':_0xcdfc('0x1c0'),'foreignKey':'SubjectId'});db[_0xcdfc('0xc0')]['hasMany'](db['ServicenowField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0xcdfc('0xc0')]['hasMany'](db[_0xcdfc('0xc0')],{'as':'Field','foreignKey':_0xcdfc('0x1bf')});db[_0xcdfc('0xc0')][_0xcdfc('0x14f')](db[_0xcdfc('0x8c')],{'as':_0xcdfc('0x8c'),'foreignKey':_0xcdfc('0x1c4')});db['Dynamics365Account']['hasMany'](db[_0xcdfc('0x1cd')],{'as':_0xcdfc('0x1c8'),'onDelete':_0xcdfc('0x11b'),'foreignKey':_0xcdfc('0x1bb')});db[_0xcdfc('0x1cd')][_0xcdfc('0x117')](db[_0xcdfc('0xc5')],{'as':_0xcdfc('0x1bc'),'onDelete':_0xcdfc('0x11b'),'foreignKey':_0xcdfc('0x1bd')});db[_0xcdfc('0x1cd')][_0xcdfc('0x117')](db[_0xcdfc('0xc5')],{'as':_0xcdfc('0x1be'),'onDelete':'cascade','foreignKey':_0xcdfc('0x1c2')});db[_0xcdfc('0x1cd')][_0xcdfc('0x117')](db[_0xcdfc('0xc5')],{'as':'Fields','onDelete':_0xcdfc('0x11b'),'foreignKey':_0xcdfc('0x1bf')});db['Dynamics365Configuration']['belongsTo'](db['Dynamics365Account'],{'as':_0xcdfc('0x170'),'foreignKey':_0xcdfc('0x1bb')});db[_0xcdfc('0xc5')][_0xcdfc('0x117')](db['Dynamics365Field'],{'as':_0xcdfc('0x1c0'),'foreignKey':_0xcdfc('0x1bd')});db[_0xcdfc('0xc5')][_0xcdfc('0x117')](db['Dynamics365Field'],{'as':_0xcdfc('0x1c1'),'foreignKey':_0xcdfc('0x1c2')});db[_0xcdfc('0xc5')]['hasMany'](db[_0xcdfc('0xc5')],{'as':'Field','foreignKey':_0xcdfc('0x1bf')});db[_0xcdfc('0xc5')][_0xcdfc('0x14f')](db[_0xcdfc('0x8c')],{'as':_0xcdfc('0x8c'),'foreignKey':_0xcdfc('0x1c4')});db[_0xcdfc('0xc7')][_0xcdfc('0x117')](db[_0xcdfc('0xc9')],{'as':_0xcdfc('0x1c8'),'onDelete':_0xcdfc('0x11b'),'foreignKey':_0xcdfc('0x1bb')});db[_0xcdfc('0xc9')][_0xcdfc('0x117')](db[_0xcdfc('0xcb')],{'as':_0xcdfc('0x1bc'),'foreignKey':_0xcdfc('0x1bd')});db[_0xcdfc('0xc9')][_0xcdfc('0x117')](db[_0xcdfc('0xcb')],{'as':_0xcdfc('0x1be'),'foreignKey':_0xcdfc('0x1c2')});db[_0xcdfc('0xc9')][_0xcdfc('0x117')](db[_0xcdfc('0xcb')],{'as':_0xcdfc('0x1b9'),'foreignKey':_0xcdfc('0x1bf')});db[_0xcdfc('0xc9')][_0xcdfc('0x14f')](db[_0xcdfc('0xc7')],{'as':_0xcdfc('0x170'),'foreignKey':_0xcdfc('0x1bb')});db[_0xcdfc('0xcb')][_0xcdfc('0x117')](db[_0xcdfc('0xcb')],{'as':_0xcdfc('0x1c0'),'foreignKey':_0xcdfc('0x1bd')});db[_0xcdfc('0xcb')][_0xcdfc('0x117')](db['FreshsalesField'],{'as':_0xcdfc('0x1c1'),'foreignKey':_0xcdfc('0x1c2')});db[_0xcdfc('0xcb')][_0xcdfc('0x117')](db[_0xcdfc('0xcb')],{'as':'Field','foreignKey':_0xcdfc('0x1bf')});db[_0xcdfc('0xcb')]['belongsTo'](db['Variable'],{'as':_0xcdfc('0x8c'),'foreignKey':_0xcdfc('0x1c4')});db[_0xcdfc('0xcf')][_0xcdfc('0x14f')](db['ChatWebsite'],{});db[_0xcdfc('0xcf')][_0xcdfc('0x14f')](db[_0xcdfc('0xf9')],{'as':_0xcdfc('0x16c'),'foreignKey':_0xcdfc('0x16d')});db[_0xcdfc('0xcf')][_0xcdfc('0x14f')](db[_0xcdfc('0x6b')],{'as':_0xcdfc('0x177'),'foreignKey':_0xcdfc('0x161')});db[_0xcdfc('0xcf')]['belongsTo'](db[_0xcdfc('0x63')],{});db['ChatQueueReport'][_0xcdfc('0x14f')](db[_0xcdfc('0x18d')],{});db[_0xcdfc('0xcf')]['belongsTo'](db[_0xcdfc('0x12')],{});db[_0xcdfc('0xcf')][_0xcdfc('0x14f')](db[_0xcdfc('0x66')],{});db[_0xcdfc('0xd1')][_0xcdfc('0x14f')](db[_0xcdfc('0x12')],{'onDelete':_0xcdfc('0x11b'),'foreignKey':_0xcdfc('0x1ce')});db['ChatInternalMessage']['belongsTo'](db[_0xcdfc('0x12')],{'onDelete':'cascade','foreignKey':_0xcdfc('0x1cf')});db[_0xcdfc('0x19a')][_0xcdfc('0x117')](db[_0xcdfc('0xd3')],{'foreignKey':_0xcdfc('0x1d0'),'onDelete':'cascade'});db['JscriptySessionReport'][_0xcdfc('0x117')](db['JscriptyAnswerReport'],{'foreignKey':_0xcdfc('0x1d0'),'onDelete':_0xcdfc('0x11b')});db[_0xcdfc('0xd6')][_0xcdfc('0x14f')](db[_0xcdfc('0x51')],{});db[_0xcdfc('0xd6')]['belongsTo'](db[_0xcdfc('0xf9')],{'as':_0xcdfc('0x16c'),'foreignKey':'ListId'});db[_0xcdfc('0xd6')][_0xcdfc('0x14f')](db[_0xcdfc('0x6b')],{'as':_0xcdfc('0x177'),'foreignKey':'ContactId'});db['SmsQueueReport']['belongsTo'](db['SmsInteraction'],{});db[_0xcdfc('0xd6')]['belongsTo'](db[_0xcdfc('0x182')],{});db['SmsQueueReport'][_0xcdfc('0x14f')](db[_0xcdfc('0x12')],{});db[_0xcdfc('0xd6')][_0xcdfc('0x14f')](db[_0xcdfc('0x56')],{});db[_0xcdfc('0xdb')][_0xcdfc('0x117')](db['JscriptySessionReport'],{'foreignKey':_0xcdfc('0x1d1')});db[_0xcdfc('0xdb')][_0xcdfc('0x117')](db[_0xcdfc('0xd3')],{'foreignKey':_0xcdfc('0x1d1')});db[_0xcdfc('0xdb')][_0xcdfc('0x117')](db[_0xcdfc('0xd2')],{'foreignKey':_0xcdfc('0x1d1')});db[_0xcdfc('0xe1')][_0xcdfc('0x125')](db[_0xcdfc('0x12')],{'as':_0xcdfc('0x175'),'through':'user_has_square_projects'});db[_0xcdfc('0xe6')][_0xcdfc('0x125')](db[_0xcdfc('0x12')],{'as':_0xcdfc('0x158'),'through':_0xcdfc('0x129')});db[_0xcdfc('0xe6')]['belongsToMany'](db[_0xcdfc('0x1a')],{'through':_0xcdfc('0x110'),'as':_0xcdfc('0x132')});db['Team'][_0xcdfc('0x125')](db[_0xcdfc('0x3a')],{'through':_0xcdfc('0x1d2'),'as':_0xcdfc('0x1d3')});db[_0xcdfc('0xe6')][_0xcdfc('0x125')](db['ChatQueue'],{'through':_0xcdfc('0x195'),'as':'ChatQueues'});db['Team']['belongsToMany'](db[_0xcdfc('0x4d')],{'through':'team_has_fax_queues','as':_0xcdfc('0x137')});db['Team'][_0xcdfc('0x125')](db[_0xcdfc('0x56')],{'through':_0xcdfc('0x185'),'as':_0xcdfc('0x138')});db[_0xcdfc('0xe6')][_0xcdfc('0x125')](db[_0xcdfc('0x5e')],{'through':'team_has_openchannel_queues','as':_0xcdfc('0x13a')});db[_0xcdfc('0xe6')]['belongsToMany'](db[_0xcdfc('0x10d')],{'through':_0xcdfc('0x1d4'),'as':'WhatsappQueues'});db[_0xcdfc('0xe6')]['belongsToMany'](db[_0xcdfc('0xfb')],{'through':_0xcdfc('0x112'),'as':'VoicePrefixes'});db[_0xcdfc('0xea')][_0xcdfc('0x117')](db[_0xcdfc('0x6d')],{'as':'Hoppers','foreignKey':_0xcdfc('0x19f')});db['Campaign'][_0xcdfc('0x117')](db[_0xcdfc('0x6f')],{'as':_0xcdfc('0x14c'),'foreignKey':_0xcdfc('0x19f')});db[_0xcdfc('0xea')][_0xcdfc('0x117')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':'CampaignId'});db['Campaign'][_0xcdfc('0x117')](db[_0xcdfc('0x6e')],{'as':'HopperBlacks','foreignKey':_0xcdfc('0x19f')});db[_0xcdfc('0xea')][_0xcdfc('0x14f')](db[_0xcdfc('0x150')],{'as':_0xcdfc('0x150'),'foreignKey':_0xcdfc('0x151')});db[_0xcdfc('0xea')][_0xcdfc('0x14f')](db[_0xcdfc('0x150')],{'as':_0xcdfc('0x152'),'foreignKey':_0xcdfc('0x153')});db[_0xcdfc('0xea')]['belongsTo'](db['Interval'],{'as':_0xcdfc('0x7d'),'foreignKey':_0xcdfc('0x154')});db['Campaign'][_0xcdfc('0x14f')](db[_0xcdfc('0xe1')],{'as':'SquareProject','foreignKey':_0xcdfc('0x1d5')});db[_0xcdfc('0xea')][_0xcdfc('0x125')](db[_0xcdfc('0xf9')],{'as':'Lists','through':_0xcdfc('0x1d6')});db['Campaign'][_0xcdfc('0x125')](db[_0xcdfc('0xf9')],{'as':_0xcdfc('0x1d7'),'through':_0xcdfc('0x1d8')});db[_0xcdfc('0xed')][_0xcdfc('0x14f')](db[_0xcdfc('0x65')],{'as':'ChatOfflineMessage','foreignKey':_0xcdfc('0x194')});db[_0xcdfc('0xf1')][_0xcdfc('0x14f')](db[_0xcdfc('0x3e')],{});db[_0xcdfc('0xf1')][_0xcdfc('0x14f')](db[_0xcdfc('0x3d')],{});db['MailTransferReport'][_0xcdfc('0x14f')](db['MailAccount'],{'foreignKey':'FromMailAccountId','as':'FromAccount'});db[_0xcdfc('0xf1')][_0xcdfc('0x14f')](db[_0xcdfc('0x12')],{'foreignKey':_0xcdfc('0x1d9'),'as':_0xcdfc('0x1da')});db[_0xcdfc('0xf1')][_0xcdfc('0x14f')](db[_0xcdfc('0x12')],{'foreignKey':_0xcdfc('0x1db'),'as':'ToAgent'});db[_0xcdfc('0xf1')][_0xcdfc('0x14f')](db[_0xcdfc('0x3a')],{'foreignKey':_0xcdfc('0x1dc'),'as':_0xcdfc('0x1dd')});db[_0xcdfc('0xf1')][_0xcdfc('0x14f')](db[_0xcdfc('0x38')],{'foreignKey':_0xcdfc('0x1de'),'as':_0xcdfc('0x1df')});db[_0xcdfc('0xf2')][_0xcdfc('0x14f')](db['ChatMessage'],{});db[_0xcdfc('0xf2')]['belongsTo'](db['ChatInteraction'],{});db[_0xcdfc('0xf2')][_0xcdfc('0x14f')](db['ChatWebsite'],{'foreignKey':_0xcdfc('0x1e0'),'as':'FromAccount'});db['ChatTransferReport']['belongsTo'](db['User'],{'foreignKey':_0xcdfc('0x1d9'),'as':_0xcdfc('0x1da')});db[_0xcdfc('0xf2')]['belongsTo'](db[_0xcdfc('0x12')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xcdfc('0xf2')][_0xcdfc('0x14f')](db['ChatQueue'],{'foreignKey':_0xcdfc('0x1e1'),'as':_0xcdfc('0x1dd')});db[_0xcdfc('0xf2')][_0xcdfc('0x14f')](db['ChatWebsite'],{'foreignKey':_0xcdfc('0x1e2'),'as':_0xcdfc('0x1df')});db[_0xcdfc('0xf4')][_0xcdfc('0x14f')](db['FaxMessage'],{});db['FaxTransferReport'][_0xcdfc('0x14f')](db[_0xcdfc('0x4b')],{});db[_0xcdfc('0xf4')]['belongsTo'](db['FaxAccount'],{'foreignKey':_0xcdfc('0x1e3'),'as':'FromAccount'});db['FaxTransferReport'][_0xcdfc('0x14f')](db[_0xcdfc('0x12')],{'foreignKey':_0xcdfc('0x1d9'),'as':_0xcdfc('0x1da')});db[_0xcdfc('0xf4')]['belongsTo'](db[_0xcdfc('0x12')],{'foreignKey':_0xcdfc('0x1db'),'as':_0xcdfc('0x1e4')});db[_0xcdfc('0xf4')][_0xcdfc('0x14f')](db[_0xcdfc('0x4d')],{'foreignKey':'ToFaxQueueId','as':'ToQueue'});db['FaxTransferReport'][_0xcdfc('0x14f')](db[_0xcdfc('0x47')],{'foreignKey':_0xcdfc('0x1e5'),'as':'ToAccount'});db['OpenchannelTransferReport'][_0xcdfc('0x14f')](db[_0xcdfc('0x5c')],{});db[_0xcdfc('0x1e6')]['belongsTo'](db['OpenchannelInteraction'],{});db[_0xcdfc('0x1e6')][_0xcdfc('0x14f')](db[_0xcdfc('0x57')],{'foreignKey':_0xcdfc('0x1e7'),'as':_0xcdfc('0x1e8')});db[_0xcdfc('0x1e6')][_0xcdfc('0x14f')](db[_0xcdfc('0x12')],{'foreignKey':'FromUserId','as':_0xcdfc('0x1da')});db['OpenchannelTransferReport'][_0xcdfc('0x14f')](db[_0xcdfc('0x12')],{'foreignKey':_0xcdfc('0x1db'),'as':_0xcdfc('0x1e4')});db['OpenchannelTransferReport'][_0xcdfc('0x14f')](db[_0xcdfc('0x5e')],{'foreignKey':'ToOpenchannelQueueId','as':_0xcdfc('0x1dd')});db[_0xcdfc('0x1e6')][_0xcdfc('0x14f')](db[_0xcdfc('0x57')],{'foreignKey':_0xcdfc('0x1e9'),'as':_0xcdfc('0x1df')});db[_0xcdfc('0xf7')][_0xcdfc('0x14f')](db[_0xcdfc('0x182')],{});db[_0xcdfc('0xf7')][_0xcdfc('0x14f')](db[_0xcdfc('0x120')],{});db[_0xcdfc('0xf7')][_0xcdfc('0x14f')](db['SmsAccount'],{'foreignKey':_0xcdfc('0x1ea'),'as':_0xcdfc('0x1e8')});db[_0xcdfc('0xf7')]['belongsTo'](db[_0xcdfc('0x12')],{'foreignKey':_0xcdfc('0x1d9'),'as':_0xcdfc('0x1da')});db['SmsTransferReport'][_0xcdfc('0x14f')](db[_0xcdfc('0x12')],{'foreignKey':_0xcdfc('0x1db'),'as':_0xcdfc('0x1e4')});db[_0xcdfc('0xf7')][_0xcdfc('0x14f')](db[_0xcdfc('0x56')],{'foreignKey':_0xcdfc('0x1eb'),'as':_0xcdfc('0x1dd')});db[_0xcdfc('0xf7')][_0xcdfc('0x14f')](db['SmsAccount'],{'foreignKey':'ToSmsAccountId','as':_0xcdfc('0x1df')});db[_0xcdfc('0xf9')]['hasMany'](db[_0xcdfc('0x7a')],{'as':_0xcdfc('0x17b'),'foreignKey':_0xcdfc('0x16d'),'onDelete':_0xcdfc('0x11b')});db[_0xcdfc('0xf9')][_0xcdfc('0x117')](db[_0xcdfc('0x73')],{'as':_0xcdfc('0x1ec'),'foreignKey':'ListId'});db[_0xcdfc('0xf9')][_0xcdfc('0x117')](db[_0xcdfc('0x6b')],{'as':_0xcdfc('0x127'),'onDelete':'cascade','foreignKey':_0xcdfc('0x16d')});db['CmList'][_0xcdfc('0x117')](db['CmHopperFinal'],{'as':_0xcdfc('0x14c'),'foreignKey':_0xcdfc('0x16d')});db[_0xcdfc('0xf9')][_0xcdfc('0x117')](db[_0xcdfc('0x71')],{'as':_0xcdfc('0x11c'),'foreignKey':_0xcdfc('0x16d')});db['CmList']['hasMany'](db[_0xcdfc('0x11d')],{'as':'ReportAgentPreview','foreignKey':_0xcdfc('0x16d')});db['CmList']['belongsToMany'](db[_0xcdfc('0x1a')],{'as':_0xcdfc('0x1ed'),'through':_0xcdfc('0x157')});db[_0xcdfc('0xf9')]['belongsToMany'](db[_0xcdfc('0x12')],{'as':'Agents','through':_0xcdfc('0x128')});db['VoicePrefix'][_0xcdfc('0x117')](db[_0xcdfc('0x16')],{'as':_0xcdfc('0x11a'),'onDelete':'cascade'});db['VoicePrefix'][_0xcdfc('0x125')](db[_0xcdfc('0x12')],{'as':'Agents','through':_0xcdfc('0x114')});db[_0xcdfc('0xfb')][_0xcdfc('0x125')](db[_0xcdfc('0xe6')],{'through':_0xcdfc('0x112'),'as':_0xcdfc('0x159')});db[_0xcdfc('0xfd')][_0xcdfc('0x117')](db[_0xcdfc('0x12')],{'as':_0xcdfc('0x175'),'foreignKey':_0xcdfc('0x124')});db[_0xcdfc('0xfd')]['hasMany'](db[_0xcdfc('0xff')],{'as':_0xcdfc('0x1ee'),'foreignKey':_0xcdfc('0x124'),'onDelete':_0xcdfc('0x11b')});db[_0xcdfc('0xff')][_0xcdfc('0x117')](db[_0xcdfc('0x101')],{'as':_0xcdfc('0x1ef'),'foreignKey':_0xcdfc('0x1f0'),'onDelete':_0xcdfc('0x11b')});db[_0xcdfc('0x103')]['hasMany'](db[_0xcdfc('0x7a')],{'as':_0xcdfc('0x17b'),'foreignKey':_0xcdfc('0x1f1'),'onDelete':_0xcdfc('0x11b')});db['WhatsappAccount'][_0xcdfc('0x117')](db[_0xcdfc('0x168')],{'as':_0xcdfc('0x169'),'foreignKey':'WhatsappAccountId'});db[_0xcdfc('0x103')][_0xcdfc('0x117')](db[_0xcdfc('0x108')],{'as':'Messages','foreignKey':_0xcdfc('0x1f1')});db[_0xcdfc('0x103')][_0xcdfc('0x117')](db[_0xcdfc('0x107')],{'as':_0xcdfc('0x16b')});db[_0xcdfc('0x103')][_0xcdfc('0x117')](db[_0xcdfc('0x105')],{'as':_0xcdfc('0x148')});db[_0xcdfc('0x103')]['belongsTo'](db[_0xcdfc('0xf9')],{'as':'List','foreignKey':'ListId'});db[_0xcdfc('0x103')][_0xcdfc('0x14f')](db[_0xcdfc('0x7e')],{'as':_0xcdfc('0x181'),'foreignKey':_0xcdfc('0x155')});db[_0xcdfc('0x103')]['belongsToMany'](db[_0xcdfc('0x12')],{'as':_0xcdfc('0x158'),'through':_0xcdfc('0x145')});db[_0xcdfc('0x105')][_0xcdfc('0x14f')](db[_0xcdfc('0x12')],{'onDelete':_0xcdfc('0x165')});db[_0xcdfc('0x105')][_0xcdfc('0x14f')](db[_0xcdfc('0x10d')],{'onDelete':_0xcdfc('0x165')});db[_0xcdfc('0x105')][_0xcdfc('0x14f')](db['WhatsappAccount'],{'onDelete':_0xcdfc('0x165')});db[_0xcdfc('0x105')][_0xcdfc('0x14f')](db['Interval'],{'onDelete':_0xcdfc('0x165'),'foreignKey':'IntervalId'});db[_0xcdfc('0x105')][_0xcdfc('0x14f')](db[_0xcdfc('0x86')],{'onDelete':_0xcdfc('0x165'),'foreignKey':'TagId'});db['WhatsappInteraction'][_0xcdfc('0x117')](db[_0xcdfc('0x108')],{'as':_0xcdfc('0x16a'),'onDelete':_0xcdfc('0x11b'),'foreignKey':_0xcdfc('0x1f2')});db[_0xcdfc('0x107')]['belongsTo'](db[_0xcdfc('0x103')],{'as':'Account','foreignKey':_0xcdfc('0x1f1')});db['WhatsappInteraction'][_0xcdfc('0x14f')](db[_0xcdfc('0x6b')],{'as':_0xcdfc('0x177'),'foreignKey':_0xcdfc('0x161')});db[_0xcdfc('0x107')][_0xcdfc('0x14f')](db['User'],{'as':_0xcdfc('0x171'),'foreignKey':_0xcdfc('0x119')});db[_0xcdfc('0x107')][_0xcdfc('0x125')](db[_0xcdfc('0x86')],{'through':_0xcdfc('0x1b1'),'as':'Tags'});db[_0xcdfc('0x107')][_0xcdfc('0x125')](db[_0xcdfc('0x86')],{'through':_0xcdfc('0x1b1'),'as':_0xcdfc('0x174')});db[_0xcdfc('0x107')]['belongsToMany'](db['User'],{'as':_0xcdfc('0x175'),'through':_0xcdfc('0x131'),'foreignKey':_0xcdfc('0x1f2')});db['WhatsappMessage'][_0xcdfc('0x14f')](db[_0xcdfc('0x12')],{'as':_0xcdfc('0x12')});db[_0xcdfc('0x108')]['belongsTo'](db[_0xcdfc('0x6b')],{'onDelete':'cascade','as':'Contact'});db['WhatsappMessage'][_0xcdfc('0x14f')](db[_0xcdfc('0x107')],{'onDelete':_0xcdfc('0x11b'),'as':_0xcdfc('0x178'),'foreignKey':_0xcdfc('0x1f2')});db['WhatsappMessage'][_0xcdfc('0x14f')](db[_0xcdfc('0x103')],{'as':_0xcdfc('0x170'),'foreignKey':_0xcdfc('0x1f1')});db[_0xcdfc('0x10a')][_0xcdfc('0x14f')](db[_0xcdfc('0x103')],{});db[_0xcdfc('0x10a')]['belongsTo'](db['CmList'],{'as':_0xcdfc('0x16c'),'foreignKey':_0xcdfc('0x16d')});db[_0xcdfc('0x10a')][_0xcdfc('0x14f')](db[_0xcdfc('0x6b')],{'as':_0xcdfc('0x177'),'foreignKey':_0xcdfc('0x161')});db[_0xcdfc('0x10a')][_0xcdfc('0x14f')](db[_0xcdfc('0x107')],{});db[_0xcdfc('0x10a')][_0xcdfc('0x14f')](db[_0xcdfc('0x10d')],{});db[_0xcdfc('0x10a')][_0xcdfc('0x14f')](db[_0xcdfc('0x108')],{});db[_0xcdfc('0x10a')][_0xcdfc('0x14f')](db['User'],{});db['WhatsappTransferReport'][_0xcdfc('0x14f')](db[_0xcdfc('0x108')],{});db['WhatsappTransferReport'][_0xcdfc('0x14f')](db[_0xcdfc('0x107')],{});db[_0xcdfc('0x10b')][_0xcdfc('0x14f')](db[_0xcdfc('0x103')],{'foreignKey':_0xcdfc('0x1f3'),'as':'FromAccount'});db[_0xcdfc('0x10b')][_0xcdfc('0x14f')](db[_0xcdfc('0x103')],{'foreignKey':_0xcdfc('0x1f4'),'as':_0xcdfc('0x1df')});db[_0xcdfc('0x10b')]['belongsTo'](db[_0xcdfc('0x10d')],{'foreignKey':_0xcdfc('0x1f5'),'as':_0xcdfc('0x1dd')});db[_0xcdfc('0x10b')]['belongsTo'](db[_0xcdfc('0x12')],{'foreignKey':'FromUserId','as':_0xcdfc('0x1da')});db['WhatsappTransferReport'][_0xcdfc('0x14f')](db[_0xcdfc('0x12')],{'foreignKey':_0xcdfc('0x1db'),'as':_0xcdfc('0x1e4')});db[_0xcdfc('0x10d')][_0xcdfc('0x125')](db[_0xcdfc('0x12')],{'as':_0xcdfc('0x158'),'through':'UserWhatsappQueue','foreignKey':_0xcdfc('0x1f6')});db[_0xcdfc('0x10d')][_0xcdfc('0x125')](db[_0xcdfc('0xe6')],{'through':'team_has_whatsapp_queues','as':_0xcdfc('0x159')});db['CloudProvider'][_0xcdfc('0x116')](db[_0xcdfc('0x35')],{'as':_0xcdfc('0x166'),'onDelete':'restrict'});db[_0xcdfc('0x163')][_0xcdfc('0x116')](db[_0xcdfc('0x37')],{'as':_0xcdfc('0x167'),'onDelete':_0xcdfc('0x165')});module[_0xcdfc('0x1f7')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 1fa29a9..44d663b 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b5f=['/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','./api/variable','/api/integrations','./api/integration','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','/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/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','/api/attachments','./api/attachment','./api/plugin','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/cloudProvider','/api/realtime','./api/realtime','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','./api/rpc','./api/version','/api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','join','/www','static','root','/demo','/snippet','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','username','apiKey','firstName','lastName','street','phone','fax','clientId','clientSecret','code','accessKey','tenantId','token','channelSecret','accessToken','authToken','membername','calleridname','calleridnum','exten','privateKey','secretaccesskey','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','replace','@@{','includes','express','express-winston','./errors','./config/logger','api','auth','./safe-template','safeTemplate','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','\x20body=%s','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','name','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','role','other','agent_name','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/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/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','/api/fax/interactions','./api/faxInteraction'];(function(_0x480c20,_0x5f369a){var _0x289581=function(_0x57d660){while(--_0x57d660){_0x480c20['push'](_0x480c20['shift']());}};_0x289581(++_0x5f369a);}(_0x8b5f,0x106));var _0xf8b5=function(_0xccfd1d,_0x100964){_0xccfd1d=_0xccfd1d-0x0;var _0x347d12=_0x8b5f[_0xccfd1d];return _0x347d12;};'use strict';var _=require('lodash');var path=require('path');var express=require(_0xf8b5('0x0'));var ewinston=require(_0xf8b5('0x1'));var util=require('util');var errors=require(_0xf8b5('0x2'));var config=require('./config/environment');var logger=require(_0xf8b5('0x3'))(_0xf8b5('0x4'));var authLogger=require(_0xf8b5('0x3'))(_0xf8b5('0x5'));var safeTemplate=require(_0xf8b5('0x6'))[_0xf8b5('0x7')];exports[_0xf8b5('0x8')]=function(_0x4184c3){_0x4184c3[_0xf8b5('0x9')](ewinston[_0xf8b5('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x435110,_0x2229bb){var _0x2e9a1=_0xf8b5('0xb');if(!_['isEmpty'](_0x435110[_0xf8b5('0xc')])){_0x2e9a1+=_0xf8b5('0xd');var _0x57b31f=_0x435110['body'];maskSensitiveData(_0x57b31f);}return safeTemplate(util['format'](_0x2e9a1,_0x435110[_0xf8b5('0xe')],_0x435110['headers']['x-forwarded-for']?_0x435110[_0xf8b5('0xf')][_0xf8b5('0x10')]:_0x435110[_0xf8b5('0x11')][_0xf8b5('0x12')]||_0x435110['ip'],_0x435110[_0xf8b5('0x13')],_0x2229bb[_0xf8b5('0x14')],_0x2229bb[_0xf8b5('0x15')],_0x435110[_0xf8b5('0x16')]?_0x435110[_0xf8b5('0x16')]['id']:null,_0x435110[_0xf8b5('0x16')]?_0x435110['user'][_0xf8b5('0x17')]:null,_0x435110['user']?_0x435110['user']['role']:null,_0x57b31f?util[_0xf8b5('0x18')](_0x57b31f,![],null):''));}}));_0x4184c3[_0xf8b5('0x9')](ewinston[_0xf8b5('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x4c2e0c,_0x2f3e88){var _0x27c8da=_0xf8b5('0x19');if(_0x4c2e0c[_0xf8b5('0xc')]&&_0x4c2e0c[_0xf8b5('0xc')][_0xf8b5('0x1a')]&&_0x4c2e0c[_0xf8b5('0xc')][_0xf8b5('0x1b')]){_0x27c8da=_0xf8b5('0x1c');}return util[_0xf8b5('0x1d')](_0x27c8da,_0x4c2e0c[_0xf8b5('0xe')],_0x4c2e0c['headers'][_0xf8b5('0x10')]?_0x4c2e0c[_0xf8b5('0xf')][_0xf8b5('0x10')]:_0x4c2e0c[_0xf8b5('0x11')][_0xf8b5('0x12')]||_0x4c2e0c['ip'],_0x4c2e0c[_0xf8b5('0x13')],_0x2f3e88[_0xf8b5('0x14')],_0x2f3e88[_0xf8b5('0x15')],_0x4c2e0c['user']?_0x4c2e0c[_0xf8b5('0x16')]['id']:null,_0x4c2e0c[_0xf8b5('0x16')]?_0x4c2e0c[_0xf8b5('0x16')]['name']:null,_0x4c2e0c['user']?_0x4c2e0c[_0xf8b5('0x16')][_0xf8b5('0x1e')]:null,_0x4c2e0c[_0xf8b5('0xc')]&&_0x4c2e0c[_0xf8b5('0xc')][_0xf8b5('0x1a')]?_0x4c2e0c[_0xf8b5('0xc')][_0xf8b5('0x1a')]:_0xf8b5('0x1f'),_0x4c2e0c['body']&&_0x4c2e0c['body'][_0xf8b5('0x1b')]?_0x4c2e0c[_0xf8b5('0xc')][_0xf8b5('0x1b')]:'',_0x4c2e0c['body']&&_0x4c2e0c[_0xf8b5('0xc')]['agent_name']?_0x4c2e0c[_0xf8b5('0xc')][_0xf8b5('0x20')]:'');},'ignoreRoute':function(_0x3e5972){var _0x1ef0c5=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1ef0c5['test'](_0x3e5972['url']);}}));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x21'),require(_0xf8b5('0x22')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x23'),require(_0xf8b5('0x24')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x25'),require(_0xf8b5('0x26')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x27'),require(_0xf8b5('0x28')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x29'),require(_0xf8b5('0x2a')));_0x4184c3['use'](_0xf8b5('0x2b'),require(_0xf8b5('0x2c')));_0x4184c3['use'](_0xf8b5('0x2d'),require(_0xf8b5('0x2e')));_0x4184c3[_0xf8b5('0x9')]('/api/screen/recordings',require(_0xf8b5('0x2f')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x30'),require(_0xf8b5('0x31')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x32'),require(_0xf8b5('0x33')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x34'),require(_0xf8b5('0x35')));_0x4184c3['use'](_0xf8b5('0x36'),require(_0xf8b5('0x37')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x38'),require(_0xf8b5('0x39')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x3a'),require(_0xf8b5('0x3b')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x3c'),require(_0xf8b5('0x3d')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x3e'),require(_0xf8b5('0x3f')));_0x4184c3['use']('/api/voice/transfers/reports',require(_0xf8b5('0x40')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x41'),require('./api/mailServerOut'));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x42'),require(_0xf8b5('0x43')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x44'),require(_0xf8b5('0x45')));_0x4184c3['use'](_0xf8b5('0x46'),require('./api/mailSubstatus'));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x47'),require(_0xf8b5('0x48')));_0x4184c3[_0xf8b5('0x9')]('/api/mail/messages',require(_0xf8b5('0x49')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x4a'),require(_0xf8b5('0x4b')));_0x4184c3[_0xf8b5('0x9')]('/api/mail/reports/queue',require('./api/mailQueueReport'));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x4c'),require(_0xf8b5('0x4d')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x4e'),require(_0xf8b5('0x4f')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x50'),require('./api/faxAccount'));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x51'),require('./api/faxApplication'));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x52'),require(_0xf8b5('0x53')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x54'),require(_0xf8b5('0x55')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x56'),require(_0xf8b5('0x57')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x58'),require('./api/faxQueueReport'));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x59'),require('./api/smsAccount'));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x5a'),require(_0xf8b5('0x5b')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x5c'),require(_0xf8b5('0x5d')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x5e'),require(_0xf8b5('0x5f')));_0x4184c3['use'](_0xf8b5('0x60'),require('./api/smsQueue'));_0x4184c3['use'](_0xf8b5('0x61'),require(_0xf8b5('0x62')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x63'),require(_0xf8b5('0x64')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x65'),require(_0xf8b5('0x66')));_0x4184c3['use'](_0xf8b5('0x67'),require('./api/openchannelMessage'));_0x4184c3['use'](_0xf8b5('0x68'),require(_0xf8b5('0x69')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x6a'),require(_0xf8b5('0x6b')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x6c'),require('./api/openchannelQueueReport'));_0x4184c3['use'](_0xf8b5('0x6d'),require(_0xf8b5('0x6e')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x6f'),require(_0xf8b5('0x70')));_0x4184c3['use'](_0xf8b5('0x71'),require(_0xf8b5('0x72')));_0x4184c3['use'](_0xf8b5('0x73'),require('./api/chatOfflineMessage'));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x74'),require('./api/chatQueue'));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x75'),require(_0xf8b5('0x76')));_0x4184c3[_0xf8b5('0x9')]('/api/chat/proactive_actions',require(_0xf8b5('0x77')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x78'),require('./api/cmCompany'));_0x4184c3['use']('/api/cm/contacts',require(_0xf8b5('0x79')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x7a'),require('./api/cmHopper'));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x7b'),require(_0xf8b5('0x7c')));_0x4184c3[_0xf8b5('0x9')]('/api/cm/hopper_final',require(_0xf8b5('0x7d')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x7e'),require(_0xf8b5('0x7f')));_0x4184c3['use'](_0xf8b5('0x80'),require(_0xf8b5('0x81')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x82'),require(_0xf8b5('0x83')));_0x4184c3[_0xf8b5('0x9')]('/api/automations',require(_0xf8b5('0x84')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x85'),require(_0xf8b5('0x86')));_0x4184c3['use']('/api/dispositions',require(_0xf8b5('0x87')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x88'),require('./api/condition'));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x89'),require(_0xf8b5('0x8a')));_0x4184c3['use'](_0xf8b5('0x8b'),require(_0xf8b5('0x8c')));_0x4184c3[_0xf8b5('0x9')]('/api/cdr',require(_0xf8b5('0x8d')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x8e'),require(_0xf8b5('0x8f')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x90'),require(_0xf8b5('0x91')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x92'),require(_0xf8b5('0x93')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x94'),require(_0xf8b5('0x95')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x96'),require(_0xf8b5('0x97')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x98'),require(_0xf8b5('0x99')));_0x4184c3[_0xf8b5('0x9')]('/api/variables',require(_0xf8b5('0x9a')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x9b'),require(_0xf8b5('0x9c')));_0x4184c3[_0xf8b5('0x9')]('/api/integrations/reports',require(_0xf8b5('0x9d')));_0x4184c3[_0xf8b5('0x9')]('/api/analytics/custom_reports',require(_0xf8b5('0x9e')));_0x4184c3['use'](_0xf8b5('0x9f'),require(_0xf8b5('0xa0')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xa1'),require('./api/analyticExtractedReport'));_0x4184c3['use'](_0xf8b5('0xa2'),require(_0xf8b5('0xa3')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xa4'),require(_0xf8b5('0xa5')));_0x4184c3[_0xf8b5('0x9')]('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0x4184c3[_0xf8b5('0x9')]('/api/integrations/salesforce/accounts',require(_0xf8b5('0xa6')));_0x4184c3['use'](_0xf8b5('0xa7'),require(_0xf8b5('0xa8')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xa9'),require(_0xf8b5('0xaa')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xab'),require(_0xf8b5('0xac')));_0x4184c3['use'](_0xf8b5('0xad'),require(_0xf8b5('0xae')));_0x4184c3[_0xf8b5('0x9')]('/api/integrations/sugarcrm/fields',require(_0xf8b5('0xaf')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xb0'),require(_0xf8b5('0xb1')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xb2'),require('./api/intDeskConfiguration'));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xb3'),require('./api/intDeskField'));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xb4'),require(_0xf8b5('0xb5')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xb6'),require(_0xf8b5('0xb7')));_0x4184c3[_0xf8b5('0x9')]('/api/integrations/zoho/fields',require(_0xf8b5('0xb8')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xb9'),require(_0xf8b5('0xba')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xbb'),require('./api/intZendeskConfiguration'));_0x4184c3['use'](_0xf8b5('0xbc'),require(_0xf8b5('0xbd')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xbe'),require(_0xf8b5('0xbf')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xc0'),require('./api/intFreshdeskConfiguration'));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xc1'),require(_0xf8b5('0xc2')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xc3'),require(_0xf8b5('0xc4')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xc5'),require('./api/intVtigerConfiguration'));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xc6'),require(_0xf8b5('0xc7')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xc8'),require('./api/intServicenowAccount'));_0x4184c3['use'](_0xf8b5('0xc9'),require(_0xf8b5('0xca')));_0x4184c3[_0xf8b5('0x9')]('/api/integrations/servicenow/fields',require(_0xf8b5('0xcb')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xcc'),require(_0xf8b5('0xcd')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xce'),require(_0xf8b5('0xcf')));_0x4184c3[_0xf8b5('0x9')]('/api/integrations/dynamics365/fields',require('./api/intDynamics365Field'));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xd0'),require(_0xf8b5('0xd1')));_0x4184c3[_0xf8b5('0x9')]('/api/integrations/freshsales/configurations',require(_0xf8b5('0xd2')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xd3'),require(_0xf8b5('0xd4')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xd5'),require(_0xf8b5('0xd6')));_0x4184c3['use'](_0xf8b5('0xd7'),require(_0xf8b5('0xd8')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xd9'),require(_0xf8b5('0xda')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xdb'),require(_0xf8b5('0xdc')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xdd'),require(_0xf8b5('0xde')));_0x4184c3['use'](_0xf8b5('0xdf'),require(_0xf8b5('0xe0')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xe1'),require(_0xf8b5('0xe2')));_0x4184c3[_0xf8b5('0x9')]('/api/square/reports',require(_0xf8b5('0xe3')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xe4'),require(_0xf8b5('0xe5')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xe6'),require(_0xf8b5('0xe7')));_0x4184c3[_0xf8b5('0x9')]('/api/settings',require(_0xf8b5('0xe8')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xe9'),require(_0xf8b5('0xea')));_0x4184c3['use'](_0xf8b5('0xeb'),require('./api/squareProject'));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xec'),require(_0xf8b5('0xed')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xee'),require('./api/squareMessage'));_0x4184c3['use'](_0xf8b5('0xef'),require(_0xf8b5('0xf0')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xf1'),require(_0xf8b5('0xf2')));_0x4184c3['use'](_0xf8b5('0xf3'),require(_0xf8b5('0xf4')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xf5'),require('./api/migration'));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xf6'),require(_0xf8b5('0xf7')));_0x4184c3[_0xf8b5('0x9')]('/api/plugins',require(_0xf8b5('0xf8')));_0x4184c3['use']('/api/mail/reports/transfer',require(_0xf8b5('0xf9')));_0x4184c3[_0xf8b5('0x9')]('/api/chat/reports/transfer',require(_0xf8b5('0xfa')));_0x4184c3['use'](_0xf8b5('0xfb'),require(_0xf8b5('0xfc')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xfd'),require(_0xf8b5('0xfe')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xff'),require(_0xf8b5('0x100')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x101'),require(_0xf8b5('0x102')));_0x4184c3['use'](_0xf8b5('0x103'),require(_0xf8b5('0x104')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x105'),require(_0xf8b5('0x106')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x107'),require(_0xf8b5('0x108')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x109'),require(_0xf8b5('0x10a')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x10b'),require(_0xf8b5('0x10c')));_0x4184c3[_0xf8b5('0x9')]('/api/whatsapp/accounts',require(_0xf8b5('0x10d')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x10e'),require(_0xf8b5('0x10f')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x110'),require(_0xf8b5('0x111')));_0x4184c3[_0xf8b5('0x9')]('/api/whatsapp/messages',require(_0xf8b5('0x112')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x113'),require(_0xf8b5('0x114')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x115'),require(_0xf8b5('0x116')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x117'),require('./api/whatsappQueue'));_0x4184c3['use']('/api/cloudProviders',require(_0xf8b5('0x118')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x119'),require(_0xf8b5('0x11a')));_0x4184c3['use']('/api/auth/local',require(_0xf8b5('0x11b')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x11c'),require(_0xf8b5('0x11d')));_0x4184c3['use']('/api/auth/activedirectory',require('./api/authActiveDirectory'));_0x4184c3['use'](_0xf8b5('0x11e'),require(_0xf8b5('0x11f')));_0x4184c3[_0xf8b5('0x9')]('/api/rpc',require(_0xf8b5('0x120')));_0x4184c3['use']('/api/version',require(_0xf8b5('0x121')));_0x4184c3['use'](_0xf8b5('0x122'),require('./api/system'));_0x4184c3['use'](_0xf8b5('0x123'),require(_0xf8b5('0x124')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x125'),require(_0xf8b5('0x126')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x127'),express['static'](path[_0xf8b5('0x128')](config['root'],'/apidoc')));_0x4184c3['use'](_0xf8b5('0x129'),express[_0xf8b5('0x12a')](path[_0xf8b5('0x128')](config[_0xf8b5('0x12b')],_0xf8b5('0x129'))));_0x4184c3['use']('/demo',express[_0xf8b5('0x12a')](path['join'](config['root'],_0xf8b5('0x12c'))));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x12d'),express['static'](path[_0xf8b5('0x128')](config[_0xf8b5('0x12b')],'snippet',_0xf8b5('0x12e'))));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x12f'),express[_0xf8b5('0x12a')](path[_0xf8b5('0x128')](config[_0xf8b5('0x12b')],_0xf8b5('0x130'))));_0x4184c3[_0xf8b5('0x131')](_0xf8b5('0x132'))[_0xf8b5('0x133')](errors[0x194]);_0x4184c3[_0xf8b5('0x131')]('/*')[_0xf8b5('0x133')](function(_0x4c4e4c,_0x3ec6ac){_0x3ec6ac[_0xf8b5('0x134')](path[_0xf8b5('0x135')](_0x4184c3[_0xf8b5('0x133')](_0xf8b5('0x136'))+'/index.html'));});};var sensitiveFields=[_0xf8b5('0x137'),'password','newPassword',_0xf8b5('0x138'),_0xf8b5('0x139'),_0xf8b5('0x13a'),_0xf8b5('0x13b'),_0xf8b5('0x13c'),'mobile',_0xf8b5('0x13d'),'email',_0xf8b5('0x13e'),_0xf8b5('0x13f'),'securityToken',_0xf8b5('0x140'),_0xf8b5('0x141'),_0xf8b5('0x142'),_0xf8b5('0x143'),_0xf8b5('0x144'),_0xf8b5('0x145'),'accessTokenSecret',_0xf8b5('0x146'),'consumerKey','consumerSecret',_0xf8b5('0x147'),_0xf8b5('0x148'),_0xf8b5('0x149'),_0xf8b5('0x14a'),'vidaooApiKey','clientEmail',_0xf8b5('0x14b'),'accesskeyid',_0xf8b5('0x14c'),'key','user',_0xf8b5('0x14d'),_0xf8b5('0x14e'),_0xf8b5('0x14f'),_0xf8b5('0x150'),_0xf8b5('0x151'),_0xf8b5('0x152'),_0xf8b5('0x153')];function maskSensitiveData(_0x56a210){var _0x50dc91=/(?!^)[\s\S](?!$)/g;if(!_[_0xf8b5('0x154')](_0x56a210))return;for(var _0x2c826c in _0x56a210){if(_[_0xf8b5('0x155')](_0x56a210[_0x2c826c])){for(var _0x1efec0=0x0;_0x1efec0<_0x56a210[_0x2c826c][_0xf8b5('0x156')];_0x1efec0++){maskSensitiveData(_0x56a210[_0x2c826c][_0x1efec0]);}}else if(_[_0xf8b5('0x154')](_0x56a210[_0x2c826c])){maskSensitiveData(_0x56a210[_0x2c826c]);}else if(_['isString'](_0x56a210[_0x2c826c])){_0x56a210[_0x2c826c]=_0x56a210[_0x2c826c][_0xf8b5('0x157')](/{{{/g,_0xf8b5('0x158'))[_0xf8b5('0x157')](/}}}/g,'}@@')[_0xf8b5('0x157')](/{{/g,'@{')[_0xf8b5('0x157')](/}}/g,'}@');if(_[_0xf8b5('0x159')](sensitiveFields,_0x2c826c)){_0x56a210[_0x2c826c]=_0x56a210[_0x2c826c]['replace'](_0x50dc91,'*');}}}} \ No newline at end of file +var _0x9e7b=['./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','./api/tag','/api/templates','./api/template','/api/triggers','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./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/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyQuestionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','./api/team','./api/license','/api/campaigns','./api/migration','/api/attachments','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/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/whatsappQueue','/api/cloudProviders','/api/realtime','/api/auth/local','./api/authLocal','/api/auth/google','/api/auth/activedirectory','./api/authActiveDirectory','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','./api/webbar','static','join','root','/apidoc','/www','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','route','sendFile','resolve','appPath','/index.html','password','apiKey','lastName','street','phone','fax','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','calleridname','calleridnum','exten','vidaooApiKey','accesskeyid','secretaccesskey','key','accountSid','localstationid','dsn','registry','isPlainObject','isArray','length','isString','@@{','}@@','replace','includes','lodash','path','express-winston','util','./errors','./config/logger','api','auth','./safe-template','safeTemplate','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','\x20body=%s','body','format','method','x-forwarded-for','headers','connection','remoteAddress','user','name','role','%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)','url','responseTime','other','agent_name','test','/api/users','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues'];(function(_0x27224d,_0x3dcc83){var _0x72586f=function(_0x39cb05){while(--_0x39cb05){_0x27224d['push'](_0x27224d['shift']());}};_0x72586f(++_0x3dcc83);}(_0x9e7b,0xed));var _0xb9e7=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x9e7b[_0x500419];return _0x241c1a;};'use strict';var _=require(_0xb9e7('0x0'));var path=require(_0xb9e7('0x1'));var express=require('express');var ewinston=require(_0xb9e7('0x2'));var util=require(_0xb9e7('0x3'));var errors=require(_0xb9e7('0x4'));var config=require('./config/environment');var logger=require(_0xb9e7('0x5'))(_0xb9e7('0x6'));var authLogger=require(_0xb9e7('0x5'))(_0xb9e7('0x7'));var safeTemplate=require(_0xb9e7('0x8'))[_0xb9e7('0x9')];exports['default']=function(_0x3733cf){_0x3733cf[_0xb9e7('0xa')](ewinston[_0xb9e7('0xb')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x43c7ee,_0x491766){var _0x375dbb=_0xb9e7('0xc');if(!_['isEmpty'](_0x43c7ee['body'])){_0x375dbb+=_0xb9e7('0xd');var _0x1b4679=_0x43c7ee[_0xb9e7('0xe')];maskSensitiveData(_0x1b4679);}return safeTemplate(util[_0xb9e7('0xf')](_0x375dbb,_0x43c7ee[_0xb9e7('0x10')],_0x43c7ee['headers'][_0xb9e7('0x11')]?_0x43c7ee[_0xb9e7('0x12')][_0xb9e7('0x11')]:_0x43c7ee[_0xb9e7('0x13')][_0xb9e7('0x14')]||_0x43c7ee['ip'],_0x43c7ee['url'],_0x491766['statusCode'],_0x491766['responseTime'],_0x43c7ee[_0xb9e7('0x15')]?_0x43c7ee[_0xb9e7('0x15')]['id']:null,_0x43c7ee[_0xb9e7('0x15')]?_0x43c7ee[_0xb9e7('0x15')][_0xb9e7('0x16')]:null,_0x43c7ee[_0xb9e7('0x15')]?_0x43c7ee[_0xb9e7('0x15')][_0xb9e7('0x17')]:null,_0x1b4679?util['inspect'](_0x1b4679,![],null):''));}}));_0x3733cf[_0xb9e7('0xa')](ewinston[_0xb9e7('0xb')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x5157af,_0x32a300){var _0x227a95=_0xb9e7('0x18');if(_0x5157af['body']&&_0x5157af[_0xb9e7('0xe')][_0xb9e7('0x19')]&&_0x5157af[_0xb9e7('0xe')]['agent_id']){_0x227a95=_0xb9e7('0x1a');}return util[_0xb9e7('0xf')](_0x227a95,_0x5157af[_0xb9e7('0x10')],_0x5157af[_0xb9e7('0x12')][_0xb9e7('0x11')]?_0x5157af[_0xb9e7('0x12')][_0xb9e7('0x11')]:_0x5157af[_0xb9e7('0x13')][_0xb9e7('0x14')]||_0x5157af['ip'],_0x5157af[_0xb9e7('0x1b')],_0x32a300['statusCode'],_0x32a300[_0xb9e7('0x1c')],_0x5157af[_0xb9e7('0x15')]?_0x5157af[_0xb9e7('0x15')]['id']:null,_0x5157af['user']?_0x5157af['user'][_0xb9e7('0x16')]:null,_0x5157af['user']?_0x5157af[_0xb9e7('0x15')][_0xb9e7('0x17')]:null,_0x5157af[_0xb9e7('0xe')]&&_0x5157af[_0xb9e7('0xe')]['device']?_0x5157af[_0xb9e7('0xe')][_0xb9e7('0x19')]:_0xb9e7('0x1d'),_0x5157af[_0xb9e7('0xe')]&&_0x5157af[_0xb9e7('0xe')]['agent_id']?_0x5157af['body']['agent_id']:'',_0x5157af[_0xb9e7('0xe')]&&_0x5157af[_0xb9e7('0xe')][_0xb9e7('0x1e')]?_0x5157af['body']['agent_name']:'');},'ignoreRoute':function(_0x1edf06){var _0x1ab062=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1ab062[_0xb9e7('0x1f')](_0x1edf06[_0xb9e7('0x1b')]);}}));_0x3733cf['use'](_0xb9e7('0x20'),require('./api/user'));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x21'),require('./api/voiceChanSpy'));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x22'),require(_0xb9e7('0x23')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x24'),require(_0xb9e7('0x25')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x26'),require(_0xb9e7('0x27')));_0x3733cf['use'](_0xb9e7('0x28'),require(_0xb9e7('0x29')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x2a'),require(_0xb9e7('0x2b')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x2c'),require(_0xb9e7('0x2d')));_0x3733cf[_0xb9e7('0xa')]('/api/voice/mails',require(_0xb9e7('0x2e')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x2f'),require(_0xb9e7('0x30')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x31'),require(_0xb9e7('0x32')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x33'),require(_0xb9e7('0x34')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x35'),require(_0xb9e7('0x36')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x37'),require('./api/voiceQueueReport'));_0x3733cf[_0xb9e7('0xa')]('/api/members/reports',require(_0xb9e7('0x38')));_0x3733cf['use']('/api/trunks',require(_0xb9e7('0x39')));_0x3733cf['use'](_0xb9e7('0x3a'),require(_0xb9e7('0x3b')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x3c'),require(_0xb9e7('0x3d')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x3e'),require(_0xb9e7('0x3f')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x40'),require(_0xb9e7('0x41')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x42'),require(_0xb9e7('0x43')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x44'),require('./api/mailInteraction'));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x45'),require('./api/mailMessage'));_0x3733cf['use'](_0xb9e7('0x46'),require(_0xb9e7('0x47')));_0x3733cf['use'](_0xb9e7('0x48'),require(_0xb9e7('0x49')));_0x3733cf['use'](_0xb9e7('0x4a'),require(_0xb9e7('0x4b')));_0x3733cf[_0xb9e7('0xa')]('/api/dashboards/items',require(_0xb9e7('0x4c')));_0x3733cf[_0xb9e7('0xa')]('/api/fax/accounts',require(_0xb9e7('0x4d')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x4e'),require(_0xb9e7('0x4f')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x50'),require(_0xb9e7('0x51')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x52'),require('./api/faxMessage'));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x53'),require(_0xb9e7('0x54')));_0x3733cf[_0xb9e7('0xa')]('/api/fax/reports/queue',require(_0xb9e7('0x55')));_0x3733cf['use'](_0xb9e7('0x56'),require(_0xb9e7('0x57')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x58'),require(_0xb9e7('0x59')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x5a'),require(_0xb9e7('0x5b')));_0x3733cf[_0xb9e7('0xa')]('/api/sms/messages',require(_0xb9e7('0x5c')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x5d'),require('./api/smsQueue'));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x5e'),require(_0xb9e7('0x5f')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x60'),require(_0xb9e7('0x61')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x62'),require(_0xb9e7('0x63')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x64'),require('./api/openchannelMessage'));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x65'),require(_0xb9e7('0x66')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x67'),require('./api/chatWebsite'));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x68'),require(_0xb9e7('0x69')));_0x3733cf['use']('/api/chat/applications',require('./api/chatApplication'));_0x3733cf[_0xb9e7('0xa')]('/api/chat/interactions',require(_0xb9e7('0x6a')));_0x3733cf['use']('/api/chat/messages',require(_0xb9e7('0x6b')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x6c'),require(_0xb9e7('0x6d')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x6e'),require(_0xb9e7('0x6f')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x70'),require('./api/chatGroup'));_0x3733cf[_0xb9e7('0xa')]('/api/chat/proactive_actions',require(_0xb9e7('0x71')));_0x3733cf['use'](_0xb9e7('0x72'),require(_0xb9e7('0x73')));_0x3733cf['use'](_0xb9e7('0x74'),require(_0xb9e7('0x75')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x76'),require(_0xb9e7('0x77')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x78'),require(_0xb9e7('0x79')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x7a'),require(_0xb9e7('0x7b')));_0x3733cf['use']('/api/cm/hopper_history',require(_0xb9e7('0x7c')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x7d'),require(_0xb9e7('0x7e')));_0x3733cf['use']('/api/actions',require(_0xb9e7('0x7f')));_0x3733cf['use'](_0xb9e7('0x80'),require(_0xb9e7('0x81')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x82'),require(_0xb9e7('0x83')));_0x3733cf[_0xb9e7('0xa')]('/api/dispositions',require(_0xb9e7('0x84')));_0x3733cf['use']('/api/conditions',require(_0xb9e7('0x85')));_0x3733cf['use'](_0xb9e7('0x86'),require(_0xb9e7('0x87')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x88'),require(_0xb9e7('0x89')));_0x3733cf[_0xb9e7('0xa')]('/api/cdr',require(_0xb9e7('0x8a')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x8b'),require(_0xb9e7('0x8c')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x8d'),require(_0xb9e7('0x8e')));_0x3733cf['use'](_0xb9e7('0x8f'),require(_0xb9e7('0x90')));_0x3733cf[_0xb9e7('0xa')]('/api/tags',require(_0xb9e7('0x91')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x92'),require(_0xb9e7('0x93')));_0x3733cf['use'](_0xb9e7('0x94'),require('./api/trigger'));_0x3733cf['use'](_0xb9e7('0x95'),require(_0xb9e7('0x96')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x97'),require('./api/integration'));_0x3733cf['use'](_0xb9e7('0x98'),require(_0xb9e7('0x99')));_0x3733cf[_0xb9e7('0xa')]('/api/analytics/custom_reports',require(_0xb9e7('0x9a')));_0x3733cf['use'](_0xb9e7('0x9b'),require('./api/analyticDefaultReport'));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x9c'),require(_0xb9e7('0x9d')));_0x3733cf['use'](_0xb9e7('0x9e'),require(_0xb9e7('0x9f')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0xa0'),require(_0xb9e7('0xa1')));_0x3733cf['use'](_0xb9e7('0xa2'),require(_0xb9e7('0xa3')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0xa4'),require('./api/intSalesforceAccount'));_0x3733cf['use'](_0xb9e7('0xa5'),require(_0xb9e7('0xa6')));_0x3733cf['use'](_0xb9e7('0xa7'),require(_0xb9e7('0xa8')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0xa9'),require(_0xb9e7('0xaa')));_0x3733cf[_0xb9e7('0xa')]('/api/integrations/sugarcrm/configurations',require('./api/intSugarcrmConfiguration'));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0xab'),require(_0xb9e7('0xac')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0xad'),require('./api/intDeskAccount'));_0x3733cf['use'](_0xb9e7('0xae'),require('./api/intDeskConfiguration'));_0x3733cf['use'](_0xb9e7('0xaf'),require(_0xb9e7('0xb0')));_0x3733cf['use'](_0xb9e7('0xb1'),require(_0xb9e7('0xb2')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0xb3'),require('./api/intZohoConfiguration'));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0xb4'),require(_0xb9e7('0xb5')));_0x3733cf['use'](_0xb9e7('0xb6'),require(_0xb9e7('0xb7')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0xb8'),require(_0xb9e7('0xb9')));_0x3733cf[_0xb9e7('0xa')]('/api/integrations/zendesk/fields',require(_0xb9e7('0xba')));_0x3733cf[_0xb9e7('0xa')]('/api/integrations/freshdesk/accounts',require(_0xb9e7('0xbb')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0xbc'),require(_0xb9e7('0xbd')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0xbe'),require(_0xb9e7('0xbf')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0xc0'),require(_0xb9e7('0xc1')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0xc2'),require(_0xb9e7('0xc3')));_0x3733cf['use'](_0xb9e7('0xc4'),require(_0xb9e7('0xc5')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0xc6'),require('./api/intServicenowAccount'));_0x3733cf['use']('/api/integrations/servicenow/configurations',require('./api/intServicenowConfiguration'));_0x3733cf[_0xb9e7('0xa')]('/api/integrations/servicenow/fields',require(_0xb9e7('0xc7')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0xc8'),require('./api/intDynamics365Account'));_0x3733cf['use'](_0xb9e7('0xc9'),require(_0xb9e7('0xca')));_0x3733cf['use'](_0xb9e7('0xcb'),require(_0xb9e7('0xcc')));_0x3733cf['use'](_0xb9e7('0xcd'),require(_0xb9e7('0xce')));_0x3733cf['use'](_0xb9e7('0xcf'),require(_0xb9e7('0xd0')));_0x3733cf[_0xb9e7('0xa')]('/api/integrations/freshsales/fields',require(_0xb9e7('0xd1')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0xd2'),require('./api/network'));_0x3733cf[_0xb9e7('0xa')]('/api/chat/reports/queue',require(_0xb9e7('0xd3')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0xd4'),require('./api/chatInternalMessage'));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0xd5'),require('./api/jscriptyAnswerReport'));_0x3733cf[_0xb9e7('0xa')]('/api/jscripty/questions/reports',require(_0xb9e7('0xd6')));_0x3733cf['use']('/api/jscripty/sessions/reports',require('./api/jscriptySessionReport'));_0x3733cf['use']('/api/sms/reports/queue',require(_0xb9e7('0xd7')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0xd8'),require(_0xb9e7('0xd9')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0xda'),require(_0xb9e7('0xdb')));_0x3733cf['use'](_0xb9e7('0xdc'),require(_0xb9e7('0xdd')));_0x3733cf[_0xb9e7('0xa')]('/api/settings',require(_0xb9e7('0xde')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0xdf'),require(_0xb9e7('0xe0')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0xe1'),require('./api/squareProject'));_0x3733cf['use'](_0xb9e7('0xe2'),require('./api/squareRecording'));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0xe3'),require(_0xb9e7('0xe4')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0xe5'),require(_0xb9e7('0xe6')));_0x3733cf['use']('/api/license',require(_0xb9e7('0xe7')));_0x3733cf['use'](_0xb9e7('0xe8'),require('./api/campaign'));_0x3733cf[_0xb9e7('0xa')]('/api/migrations',require(_0xb9e7('0xe9')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0xea'),require('./api/attachment'));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0xeb'),require(_0xb9e7('0xec')));_0x3733cf[_0xb9e7('0xa')]('/api/mail/reports/transfer',require(_0xb9e7('0xed')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0xee'),require(_0xb9e7('0xef')));_0x3733cf['use'](_0xb9e7('0xf0'),require(_0xb9e7('0xf1')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0xf2'),require(_0xb9e7('0xf3')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0xf4'),require('./api/smsTransferReport'));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0xf5'),require(_0xb9e7('0xf6')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0xf7'),require('./api/voicePrefix'));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0xf8'),require(_0xb9e7('0xf9')));_0x3733cf[_0xb9e7('0xa')]('/api/userProfile/sections',require(_0xb9e7('0xfa')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0xfb'),require(_0xb9e7('0xfc')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0xfd'),require(_0xb9e7('0xfe')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0xff'),require(_0xb9e7('0x100')));_0x3733cf[_0xb9e7('0xa')]('/api/whatsapp/applications',require(_0xb9e7('0x101')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x102'),require(_0xb9e7('0x103')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x104'),require(_0xb9e7('0x105')));_0x3733cf['use'](_0xb9e7('0x106'),require(_0xb9e7('0x107')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x108'),require(_0xb9e7('0x109')));_0x3733cf['use'](_0xb9e7('0x10a'),require(_0xb9e7('0x10b')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x10c'),require('./api/cloudProvider'));_0x3733cf['use'](_0xb9e7('0x10d'),require('./api/realtime'));_0x3733cf['use'](_0xb9e7('0x10e'),require(_0xb9e7('0x10f')));_0x3733cf['use'](_0xb9e7('0x110'),require('./api/authGoogle'));_0x3733cf['use'](_0xb9e7('0x111'),require(_0xb9e7('0x112')));_0x3733cf[_0xb9e7('0xa')]('/api/jira',require(_0xb9e7('0x113')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x114'),require(_0xb9e7('0x115')));_0x3733cf[_0xb9e7('0xa')]('/api/version',require(_0xb9e7('0x116')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x117'),require(_0xb9e7('0x118')));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x119'),require(_0xb9e7('0x11a')));_0x3733cf[_0xb9e7('0xa')]('/api/webbar',require(_0xb9e7('0x11b')));_0x3733cf[_0xb9e7('0xa')]('/apidoc',express[_0xb9e7('0x11c')](path[_0xb9e7('0x11d')](config[_0xb9e7('0x11e')],_0xb9e7('0x11f'))));_0x3733cf['use'](_0xb9e7('0x120'),express[_0xb9e7('0x11c')](path['join'](config[_0xb9e7('0x11e')],_0xb9e7('0x120'))));_0x3733cf['use'](_0xb9e7('0x121'),express[_0xb9e7('0x11c')](path[_0xb9e7('0x11d')](config[_0xb9e7('0x11e')],_0xb9e7('0x121'))));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x122'),express[_0xb9e7('0x11c')](path[_0xb9e7('0x11d')](config[_0xb9e7('0x11e')],_0xb9e7('0x123'),_0xb9e7('0x124'))));_0x3733cf[_0xb9e7('0xa')](_0xb9e7('0x125'),express[_0xb9e7('0x11c')](path[_0xb9e7('0x11d')](config[_0xb9e7('0x11e')],_0xb9e7('0x126'))));_0x3733cf['route'](_0xb9e7('0x127'))[_0xb9e7('0x128')](errors[0x194]);_0x3733cf[_0xb9e7('0x129')]('/*')['get'](function(_0x24308a,_0x3145e9){_0x3145e9[_0xb9e7('0x12a')](path[_0xb9e7('0x12b')](_0x3733cf[_0xb9e7('0x128')](_0xb9e7('0x12c'))+_0xb9e7('0x12d')));});};var sensitiveFields=['username',_0xb9e7('0x12e'),'newPassword',_0xb9e7('0x12f'),'firstName',_0xb9e7('0x130'),_0xb9e7('0x131'),_0xb9e7('0x132'),'mobile',_0xb9e7('0x133'),'email',_0xb9e7('0x134'),_0xb9e7('0x135'),_0xb9e7('0x136'),_0xb9e7('0x137'),_0xb9e7('0x138'),_0xb9e7('0x139'),_0xb9e7('0x13a'),'channelSecret',_0xb9e7('0x13b'),_0xb9e7('0x13c'),_0xb9e7('0x13d'),_0xb9e7('0x13e'),_0xb9e7('0x13f'),'membername',_0xb9e7('0x140'),_0xb9e7('0x141'),_0xb9e7('0x142'),_0xb9e7('0x143'),'clientEmail','privateKey',_0xb9e7('0x144'),_0xb9e7('0x145'),_0xb9e7('0x146'),_0xb9e7('0x15'),'pass',_0xb9e7('0x147'),_0xb9e7('0x148'),_0xb9e7('0x149'),'secret',_0xb9e7('0x14a'),'oldPassword'];function maskSensitiveData(_0x290b09){var _0x524632=/(?!^)[\s\S](?!$)/g;if(!_[_0xb9e7('0x14b')](_0x290b09))return;for(var _0x2edb93 in _0x290b09){if(_[_0xb9e7('0x14c')](_0x290b09[_0x2edb93])){for(var _0x29f1f3=0x0;_0x29f1f3<_0x290b09[_0x2edb93][_0xb9e7('0x14d')];_0x29f1f3++){maskSensitiveData(_0x290b09[_0x2edb93][_0x29f1f3]);}}else if(_[_0xb9e7('0x14b')](_0x290b09[_0x2edb93])){maskSensitiveData(_0x290b09[_0x2edb93]);}else if(_[_0xb9e7('0x14e')](_0x290b09[_0x2edb93])){_0x290b09[_0x2edb93]=_0x290b09[_0x2edb93]['replace'](/{{{/g,_0xb9e7('0x14f'))['replace'](/}}}/g,_0xb9e7('0x150'))[_0xb9e7('0x151')](/{{/g,'@{')[_0xb9e7('0x151')](/}}/g,'}@');if(_[_0xb9e7('0x152')](sensitiveFields,_0x2edb93)){_0x290b09[_0x2edb93]=_0x290b09[_0x2edb93]['replace'](_0x524632,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index efd7543..3f8dc71 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7c4f=['../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x7c4f,0x12a));var _0xf7c4=function(_0x146c2b,_0x5ec1bf){_0x146c2b=_0x146c2b-0x0;var _0x794d=_0x7c4f[_0x146c2b];return _0x794d;};'use strict';var jayson=require(_0xf7c4('0x0'));var BPromise=require('bluebird');var _=require(_0xf7c4('0x1'));var config=require(_0xf7c4('0x2'));exports[_0xf7c4('0x3')]=function(){return new BPromise(function(_0x1ace7e,_0x4711dd){var _0x5392d7={};_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x5')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x6')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x7')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x8')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x9')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0xa')));_0x5392d7=_['merge'](_0x5392d7,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0xb')));_0x5392d7=_['merge'](_0x5392d7,require(_0xf7c4('0xc')));_0x5392d7=_['merge'](_0x5392d7,require(_0xf7c4('0xd')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0xe')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0xf')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x10')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x11')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x12')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x13')));_0x5392d7=_['merge'](_0x5392d7,require('../api/mailApplication/mailApplication.rpc'));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x14')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x15')));_0x5392d7=_['merge'](_0x5392d7,require(_0xf7c4('0x16')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x17')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x18')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x19')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x1a')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x1b')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require('../api/smsInteraction/smsInteraction.rpc'));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x1c')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require('../api/smsQueue/smsQueue.rpc'));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x5392d7=_['merge'](_0x5392d7,require(_0xf7c4('0x1d')));_0x5392d7=_['merge'](_0x5392d7,require(_0xf7c4('0x1e')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x1f')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x20')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x21')));_0x5392d7=_['merge'](_0x5392d7,require(_0xf7c4('0x22')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x23')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x24')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require('../api/cmHopper/cmHopper.rpc'));_0x5392d7=_['merge'](_0x5392d7,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x25')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x26')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x27')));_0x5392d7=_['merge'](_0x5392d7,require(_0xf7c4('0x28')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x29')));_0x5392d7=_['merge'](_0x5392d7,require(_0xf7c4('0x2a')));_0x5392d7=_['merge'](_0x5392d7,require('../api/variable/variable.rpc'));_0x5392d7=_['merge'](_0x5392d7,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x2b')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x2c')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x2d')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x2e')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x2f')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x5392d7=_['merge'](_0x5392d7,require(_0xf7c4('0x30')));_0x5392d7=_['merge'](_0x5392d7,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x31')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x5392d7=_['merge'](_0x5392d7,require(_0xf7c4('0x32')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require('../api/squareReport/squareReport.rpc'));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x33')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require('../api/setting/setting.rpc'));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x34')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require('../api/squareProject/squareProject.rpc'));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require('../api/squareRecording/squareRecording.rpc'));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require('../api/squareMessage/squareMessage.rpc'));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x35')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x36')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x37')));_0x5392d7=_['merge'](_0x5392d7,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x38')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x39')));var _0x4115fa=jayson['server'](_0x5392d7)[_0xf7c4('0x3a')]();var _0x334a00=config[_0xf7c4('0x3b')][_0xf7c4('0x3c')]||config['port']+0x1;var _0x17da63=config[_0xf7c4('0x3b')]['ip']||_0xf7c4('0x3d');_0x4115fa['on'](_0xf7c4('0x3e'),function(_0x3300ab){return _0x4711dd(_0x3300ab);});_0x4115fa[_0xf7c4('0x3')](_0x334a00,_0x17da63,function(){console[_0xf7c4('0x3f')](_0xf7c4('0x40'),_0x17da63,_0x334a00);require(_0xf7c4('0x41'))['default']();return _0x1ace7e('RPC\x20listening\x20on\x20'+_0x17da63+':'+_0x334a00);});});}; \ No newline at end of file +var _0x20f2=['../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','localhost','error','listen','log','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc'];(function(_0x2415a8,_0x1646ec){var _0x31cad6=function(_0x2815e6){while(--_0x2815e6){_0x2415a8['push'](_0x2415a8['shift']());}};_0x31cad6(++_0x1646ec);}(_0x20f2,0x141));var _0x220f=function(_0x387241,_0x3b1ee6){_0x387241=_0x387241-0x0;var _0xeeba62=_0x20f2[_0x387241];return _0xeeba62;};'use strict';var jayson=require(_0x220f('0x0'));var BPromise=require(_0x220f('0x1'));var _=require(_0x220f('0x2'));var config=require(_0x220f('0x3'));exports['listen']=function(){return new BPromise(function(_0x138d05,_0xdda925){var _0x237326={};_0x237326=_['merge'](_0x237326,require('../api/user/user.rpc'));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0x5')));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0x6')));_0x237326=_[_0x220f('0x4')](_0x237326,require('../api/voiceRecording/voiceRecording.rpc'));_0x237326=_[_0x220f('0x4')](_0x237326,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0x7')));_0x237326=_['merge'](_0x237326,require(_0x220f('0x8')));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0x9')));_0x237326=_['merge'](_0x237326,require('../api/memberReport/memberReport.rpc'));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0xa')));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0xb')));_0x237326=_[_0x220f('0x4')](_0x237326,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0xc')));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0xd')));_0x237326=_[_0x220f('0x4')](_0x237326,require('../api/mailQueue/mailQueue.rpc'));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0xe')));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0xf')));_0x237326=_['merge'](_0x237326,require('../api/mailApplication/mailApplication.rpc'));_0x237326=_['merge'](_0x237326,require(_0x220f('0x10')));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0x11')));_0x237326=_[_0x220f('0x4')](_0x237326,require('../api/faxApplication/faxApplication.rpc'));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0x12')));_0x237326=_[_0x220f('0x4')](_0x237326,require('../api/faxMessage/faxMessage.rpc'));_0x237326=_['merge'](_0x237326,require(_0x220f('0x13')));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0x14')));_0x237326=_['merge'](_0x237326,require(_0x220f('0x15')));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0x16')));_0x237326=_['merge'](_0x237326,require(_0x220f('0x17')));_0x237326=_['merge'](_0x237326,require(_0x220f('0x18')));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0x19')));_0x237326=_[_0x220f('0x4')](_0x237326,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0x1a')));_0x237326=_['merge'](_0x237326,require(_0x220f('0x1b')));_0x237326=_['merge'](_0x237326,require(_0x220f('0x1c')));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0x1d')));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0x1e')));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0x1f')));_0x237326=_['merge'](_0x237326,require(_0x220f('0x20')));_0x237326=_[_0x220f('0x4')](_0x237326,require('../api/cmHopper/cmHopper.rpc'));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0x21')));_0x237326=_[_0x220f('0x4')](_0x237326,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0x22')));_0x237326=_['merge'](_0x237326,require(_0x220f('0x23')));_0x237326=_[_0x220f('0x4')](_0x237326,require('../api/interval/interval.rpc'));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0x24')));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0x25')));_0x237326=_['merge'](_0x237326,require(_0x220f('0x26')));_0x237326=_[_0x220f('0x4')](_0x237326,require('../api/trigger/trigger.rpc'));_0x237326=_['merge'](_0x237326,require(_0x220f('0x27')));_0x237326=_[_0x220f('0x4')](_0x237326,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0x28')));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0x29')));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0x2a')));_0x237326=_[_0x220f('0x4')](_0x237326,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0x2b')));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0x2c')));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0x2d')));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0x2e')));_0x237326=_[_0x220f('0x4')](_0x237326,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0x2f')));_0x237326=_['merge'](_0x237326,require(_0x220f('0x30')));_0x237326=_['merge'](_0x237326,require('../api/squareReport/squareReport.rpc'));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0x31')));_0x237326=_[_0x220f('0x4')](_0x237326,require('../api/setting/setting.rpc'));_0x237326=_[_0x220f('0x4')](_0x237326,require('../api/squareOdbc/squareOdbc.rpc'));_0x237326=_[_0x220f('0x4')](_0x237326,require('../api/squareProject/squareProject.rpc'));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0x32')));_0x237326=_['merge'](_0x237326,require('../api/squareMessage/squareMessage.rpc'));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0x33')));_0x237326=_['merge'](_0x237326,require(_0x220f('0x34')));_0x237326=_[_0x220f('0x4')](_0x237326,require('../api/plugin/plugin.rpc'));_0x237326=_['merge'](_0x237326,require(_0x220f('0x35')));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0x36')));_0x237326=_['merge'](_0x237326,require(_0x220f('0x37')));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0x38')));_0x237326=_[_0x220f('0x4')](_0x237326,require(_0x220f('0x39')));var _0x1f8f8c=jayson[_0x220f('0x3a')](_0x237326)[_0x220f('0x3b')]();var _0x3ce422=config[_0x220f('0x3c')]['port']||config['port']+0x1;var _0x191062=config['rpc']['ip']||_0x220f('0x3d');_0x1f8f8c['on'](_0x220f('0x3e'),function(_0x11416c){return _0xdda925(_0x11416c);});_0x1f8f8c[_0x220f('0x3f')](_0x3ce422,_0x191062,function(){console[_0x220f('0x40')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x191062,_0x3ce422);require(_0x220f('0x41'))['default']();return _0x138d05(_0x220f('0x42')+_0x191062+':'+_0x3ce422);});});}; \ No newline at end of file diff --git a/server/safe-template.js b/server/safe-template.js index 06bb234..780d741 100644 --- a/server/safe-template.js +++ b/server/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd4a2=['exports','safeTemplate','lodash','\x20}\x20}','replace','map','isPlainObject','keys','reduce'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xd4a2,0x173));var _0x2d4a=function(_0x26a62d,_0x4faecc){_0x26a62d=_0x26a62d-0x0;var _0x27b1d3=_0xd4a2[_0x26a62d];return _0x27b1d3;};var _=require(_0x2d4a('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x5d70e1){return _0x5d70e1==='{{'?'{\x20{\x20':_0x2d4a('0x1');}function safeTemplate(_0x576ffe){var _0x2a8a71=_0x576ffe;if(typeof _0x576ffe==='string'){_0x2a8a71=_0x576ffe[_0x2d4a('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x576ffe)){_0x2a8a71=_0x576ffe[_0x2d4a('0x3')](function(_0x40d744){return safeTemplate(_0x40d744);});}else if(_[_0x2d4a('0x4')](_0x576ffe)){_0x2a8a71=Object[_0x2d4a('0x5')](_0x576ffe)[_0x2d4a('0x6')](function(_0x57058f,_0x45fefb){_0x57058f[_0x45fefb]=safeTemplate(_0x576ffe[_0x45fefb]);return _0x57058f;},{});}return _0x2a8a71;}module[_0x2d4a('0x7')][_0x2d4a('0x8')]=safeTemplate; \ No newline at end of file +var _0x9c00=['isPlainObject','exports','safeTemplate','lodash','replace','isArray','map'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x9c00,0x1a0));var _0x09c0=function(_0x51f40e,_0x14e8ea){_0x51f40e=_0x51f40e-0x0;var _0xb37761=_0x9c00[_0x51f40e];return _0xb37761;};var _=require(_0x09c0('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x170d8b){return _0x170d8b==='{{'?'{\x20{\x20':'\x20}\x20}';}function safeTemplate(_0xe0d293){var _0x8c9907=_0xe0d293;if(typeof _0xe0d293==='string'){_0x8c9907=_0xe0d293[_0x09c0('0x1')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x09c0('0x2')](_0xe0d293)){_0x8c9907=_0xe0d293[_0x09c0('0x3')](function(_0x2fd03e){return safeTemplate(_0x2fd03e);});}else if(_[_0x09c0('0x4')](_0xe0d293)){_0x8c9907=Object['keys'](_0xe0d293)['reduce'](function(_0x1f3d7e,_0x17d11f){_0x1f3d7e[_0x17d11f]=safeTemplate(_0xe0d293[_0x17d11f]);return _0x1f3d7e;},{});}return _0x8c9907;}module[_0x09c0('0x5')][_0x09c0('0x6')]=safeTemplate; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 205a43b..16f352a 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 _0x74d3=['E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','function','write','inherits','prototype','sendRequest','sync','answer','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','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','continueAt','extension','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','lodash','events','./reply','setEncoding','utf8','setTimeout','headers','ready','line','hangup','substring','520-Invalid','no\x20code','replace','substr','startsWith','split','length','error','emit','E_AGI_SOCKET_ERROR','code','close','timeout'];(function(_0x319db5,_0x689330){var _0x1ebde2=function(_0x5efdc4){while(--_0x5efdc4){_0x319db5['push'](_0x319db5['shift']());}};_0x1ebde2(++_0x689330);}(_0x74d3,0x159));var _0x374d=function(_0x441380,_0x73cd00){_0x441380=_0x441380-0x0;var _0x3cc38b=_0x74d3[_0x441380];return _0x3cc38b;};'use strict';var util=require(_0x374d('0x0'));var _=require(_0x374d('0x1'));var EventEmitter=require(_0x374d('0x2'))['EventEmitter'];var AGIReply=require(_0x374d('0x3'));var AGIError=require('./error');function AGIChannel(_0x356a4e){var _0x9f6268=this,_0x1a79ae=new AGIReply(),_0x5e7908=![],_0x2ef1fc={};EventEmitter['call'](_0x9f6268);_0x356a4e[_0x374d('0x4')](_0x374d('0x5'));_0x356a4e[_0x374d('0x6')](0x8*0x3c*0x3c*0x3e8);_0x1a79ae['setEncoding'](_0x374d('0x5'));_0x1a79ae['on'](_0x374d('0x7'),function(_0x3668d1){for(var _0x5f400f in _0x3668d1){_0x9f6268[_0x5f400f]=_0x3668d1[_0x5f400f];}_0x9f6268['emit'](_0x374d('0x8'));});_0x1a79ae['on'](_0x374d('0x9'),function(_0x44fb2f){if(_0x44fb2f['toLowerCase']()=='hangup'){_0x9f6268['emit'](_0x374d('0xa'));return;}if(_0x44fb2f[_0x374d('0xb')](0x0,0xb)==_0x374d('0xc')){_0x5e7908=!![];}if(_0x5e7908){_0x2ef1fc['rx']+=_0x44fb2f+'\x0a';if(_0x44fb2f['search']('520\x20End\x20of\x20proper')!=-0x1){_0x5e7908=![];}}else{_0x2ef1fc['rx']=_0x44fb2f;}if(_0x5e7908){return;}if(typeof _0x2ef1fc['cb']=='function'){var _0x18cb16=_0x2ef1fc['rx'][_0x374d('0xb')](0x0,0x3),_0x40b492=null,_0x412286=null;_0x18cb16=parseInt(_0x18cb16);if(isNaN(_0x18cb16)){_0x2ef1fc['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x374d('0xd')});return;}if(_0x18cb16!=0xc8){_0x2ef1fc['cb'](null,{'code':_0x18cb16,'result':-0x1,'extra':'KO'});return;}_0x40b492=_0x2ef1fc['rx'][_0x374d('0xb')](0x4)[_0x374d('0xe')]('result=','');if(_0x40b492['indexOf']('\x20')!=-0x1){_0x40b492=_0x40b492[_0x374d('0xf')](0x0,_0x40b492['indexOf']('\x20'));}if(_[_0x374d('0x10')](_0x40b492,'-1')){_0x40b492=parseInt(_0x40b492);}_0x412286=_0x2ef1fc['rx'][_0x374d('0x11')]('\x20');if(_0x412286[_0x374d('0x12')]==0x3){_0x412286=_0x412286[0x2][_0x374d('0xb')](0x1,_0x412286[0x2][_0x374d('0x12')]-0x1);}else if(_0x412286['length']>0x3){var _0x27651f=/\((.+)\)/;var _0x18776c=_0x2ef1fc['rx']['match'](_0x27651f);if(_0x18776c){_0x412286=_0x18776c[0x1];}else{_0x412286=null;}}else{_0x412286=null;}_0x2ef1fc['cb'](null,{'code':_0x18cb16,'result':_0x40b492,'extra':_0x412286});}});_0x356a4e['on'](_0x374d('0x13'),function(_0x323c53){_0x9f6268[_0x374d('0x14')](_0x374d('0x13'),new AGIError(_0x374d('0x15'),_0x323c53[_0x374d('0x16')]));});_0x356a4e['on'](_0x374d('0x17'),function(){_0x9f6268['emit']('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0x356a4e['on'](_0x374d('0x18'),function(){_0x9f6268[_0x374d('0x14')]('timeout',new AGIError(_0x374d('0x19')));_0x356a4e[_0x374d('0x1a')]();});_0x356a4e[_0x374d('0x1b')](_0x1a79ae);this[_0x374d('0x1c')]=function(_0x3ecfc0,_0x32b865){var _0x3ecfc0=_0x3ecfc0||'',_0x32b865=typeof _0x32b865==_0x374d('0x1d')?_0x32b865:new Function();_0x2ef1fc={'tx':_0x3ecfc0,'rx':'','cb':_0x32b865};_0x356a4e[_0x374d('0x1e')](_0x3ecfc0+'\x0a');},this[_0x374d('0x17')]=function(){_0x356a4e['destroy']();};}util[_0x374d('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0x374d('0x20')][_0x374d('0x21')]=function(_0x58cbb1){return this[_0x374d('0x1c')][_0x374d('0x22')](this,_0x58cbb1);};AGIChannel[_0x374d('0x20')][_0x374d('0x23')]=function(){return this[_0x374d('0x21')]('ANSWER');};AGIChannel[_0x374d('0x20')]['getData']=function(_0x23c47a,_0x49a8ec,_0xd96ed9){_0x23c47a=_0x23c47a===undefined?'beep':_0x23c47a;_0x49a8ec=_0x49a8ec===undefined?'5':_0x49a8ec;_0xd96ed9=_0xd96ed9===undefined?'1':_0xd96ed9;return this[_0x374d('0x21')](util[_0x374d('0x24')](_0x374d('0x25'),_0x23c47a,_0x49a8ec*0x3e8,_0xd96ed9));};AGIChannel[_0x374d('0x20')][_0x374d('0x26')]=function(_0x322ccf){_0x322ccf=_0x322ccf||_0x374d('0x27');return this[_0x374d('0x21')](util['format'](_0x374d('0x28'),_0x322ccf));};AGIChannel[_0x374d('0x20')][_0x374d('0x29')]=function(_0x2ed03,_0x5ee217){if(_[_0x374d('0x2a')](_0x5ee217)){return this[_0x374d('0x21')](util[_0x374d('0x24')](_0x374d('0x2b'),_0x2ed03,_0x5ee217[_0x374d('0x2c')](',')));}return this['sendRequest'](util[_0x374d('0x24')](_0x374d('0x2b'),_0x2ed03,_0x5ee217));};AGIChannel[_0x374d('0x20')][_0x374d('0x2d')]=function(_0x367617){return this[_0x374d('0x21')](util[_0x374d('0x24')](_0x374d('0x2e'),_0x367617));};AGIChannel['prototype'][_0x374d('0x2f')]=function(_0x5df502){return this[_0x374d('0x21')](util['format']('SET\x20EXTENSION\x20%s',_0x5df502));};AGIChannel[_0x374d('0x20')][_0x374d('0x30')]=function(_0x272e89){return this[_0x374d('0x21')](util[_0x374d('0x24')](_0x374d('0x31'),_0x272e89));};AGIChannel['prototype'][_0x374d('0xa')]=function(){return this[_0x374d('0x21')](_0x374d('0x32'));};AGIChannel[_0x374d('0x20')][_0x374d('0x33')]=function(_0x29e0e8,_0x39e0c3){var _0x1d3089=_[_0x374d('0x34')](_0x39e0c3)||_[_0x374d('0x35')](_0x39e0c3)?_0x39e0c3[_0x374d('0x36')]():_0x39e0c3;return this[_0x374d('0x21')](util[_0x374d('0x24')](_0x374d('0x37'),_0x29e0e8,_0x1d3089?_0x1d3089[_0x374d('0x36')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x374d('0x20')][_0x374d('0x38')]=function(_0x2a2dc2,_0x189480){return this[_0x374d('0x21')](util[_0x374d('0x24')](_0x374d('0x39'),_0x2a2dc2,_0x189480));};AGIChannel['prototype'][_0x374d('0x3a')]=function(_0x348998,_0x55dcb8){return this[_0x374d('0x21')](util['format'](_0x374d('0x3b'),_0x348998,_0x55dcb8));};AGIChannel[_0x374d('0x20')][_0x374d('0x3c')]=function(_0x5413c1,_0x58ffb2){return this[_0x374d('0x21')](util['format']('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x5413c1,_0x58ffb2));};AGIChannel[_0x374d('0x20')][_0x374d('0x3d')]=function(_0x4ef8fd,_0x5c658c,_0x3c324a){_0x5c658c=_0x5c658c||this[_0x374d('0x3e')];_0x3c324a=_0x3c324a||0x1;this[_0x374d('0x2d')](_0x4ef8fd);this['setExtension'](_0x5c658c);this[_0x374d('0x30')](_0x3c324a);return this['noop'](util[_0x374d('0x24')]('GOTO\x20%s\x20%s\x20%s',_0x4ef8fd,_0x5c658c,_0x3c324a));};AGIChannel['prototype']['getVariable']=function(_0x32d43b){return this[_0x374d('0x21')](util[_0x374d('0x24')]('GET\x20VARIABLE\x20\x22%s\x22',_0x32d43b));};AGIChannel[_0x374d('0x20')][_0x374d('0x3f')]=function(_0x4c8e2e,_0x43157e,_0x324793,_0x16a985,_0x51ec22,_0x277015){_0x43157e=_0x43157e||_0x374d('0x40');_0x324793=_0x324793||'';_0x16a985=_0x16a985===undefined?-0x1:_0x16a985==='-1'?-0x1:_0x16a985*0x3e8;_0x51ec22=_0x51ec22===undefined?'':'s='+_0x51ec22;_0x277015=_0x277015?_0x374d('0x41'):'';return this[_0x374d('0x21')](util['format'](_0x374d('0x42'),_0x4c8e2e,_0x43157e,_0x324793,_0x16a985,_0x277015,_0x51ec22));};AGIChannel['prototype'][_0x374d('0x43')]=function(_0x3ec703,_0x36355c){_0x36355c=_0x36355c||'';return this['sendRequest'](util[_0x374d('0x24')](_0x374d('0x44'),_0x3ec703,_0x36355c));};AGIChannel[_0x374d('0x20')][_0x374d('0x45')]=function(_0x319cba){return this[_0x374d('0x29')](_0x374d('0x46'),_0x319cba);};AGIChannel[_0x374d('0x20')]['wait']=function(_0x1b3633){return this[_0x374d('0x29')](_0x374d('0x47'),_0x1b3633);};AGIChannel[_0x374d('0x20')][_0x374d('0x13')]=function(_0x40d1f7,_0x336aef){this[_0x374d('0x26')](util['format'](_0x374d('0x48'),_0x40d1f7['id'],_0x40d1f7['label'],_0x336aef));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x374d('0x49')]=AGIChannel; \ No newline at end of file +var _0x5b64=['headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','no\x20code','result=','substr','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','function','destroy','prototype','sendRequest','sync','ANSWER','getData','beep','format','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','AGI','label','util','lodash','EventEmitter','./error','call','setEncoding','utf8','setTimeout'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x5b64,0x16f));var _0x45b6=function(_0x5e7a4a,_0xaf1bc5){_0x5e7a4a=_0x5e7a4a-0x0;var _0x2c689e=_0x5b64[_0x5e7a4a];return _0x2c689e;};'use strict';var util=require(_0x45b6('0x0'));var _=require(_0x45b6('0x1'));var EventEmitter=require('events')[_0x45b6('0x2')];var AGIReply=require('./reply');var AGIError=require(_0x45b6('0x3'));function AGIChannel(_0x7ac7c5){var _0x1db287=this,_0x15541f=new AGIReply(),_0x335494=![],_0x47e2cf={};EventEmitter[_0x45b6('0x4')](_0x1db287);_0x7ac7c5[_0x45b6('0x5')](_0x45b6('0x6'));_0x7ac7c5[_0x45b6('0x7')](0x8*0x3c*0x3c*0x3e8);_0x15541f[_0x45b6('0x5')]('utf8');_0x15541f['on'](_0x45b6('0x8'),function(_0x5ae3f9){for(var _0x28cde5 in _0x5ae3f9){_0x1db287[_0x28cde5]=_0x5ae3f9[_0x28cde5];}_0x1db287[_0x45b6('0x9')](_0x45b6('0xa'));});_0x15541f['on'](_0x45b6('0xb'),function(_0x3dd881){if(_0x3dd881[_0x45b6('0xc')]()==_0x45b6('0xd')){_0x1db287[_0x45b6('0x9')](_0x45b6('0xd'));return;}if(_0x3dd881[_0x45b6('0xe')](0x0,0xb)==_0x45b6('0xf')){_0x335494=!![];}if(_0x335494){_0x47e2cf['rx']+=_0x3dd881+'\x0a';if(_0x3dd881[_0x45b6('0x10')](_0x45b6('0x11'))!=-0x1){_0x335494=![];}}else{_0x47e2cf['rx']=_0x3dd881;}if(_0x335494){return;}if(typeof _0x47e2cf['cb']=='function'){var _0x34daf=_0x47e2cf['rx'][_0x45b6('0xe')](0x0,0x3),_0x554d69=null,_0x40db1a=null;_0x34daf=parseInt(_0x34daf);if(isNaN(_0x34daf)){_0x47e2cf['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x45b6('0x12')});return;}if(_0x34daf!=0xc8){_0x47e2cf['cb'](null,{'code':_0x34daf,'result':-0x1,'extra':'KO'});return;}_0x554d69=_0x47e2cf['rx'][_0x45b6('0xe')](0x4)['replace'](_0x45b6('0x13'),'');if(_0x554d69['indexOf']('\x20')!=-0x1){_0x554d69=_0x554d69[_0x45b6('0x14')](0x0,_0x554d69[_0x45b6('0x15')]('\x20'));}if(_[_0x45b6('0x16')](_0x554d69,'-1')){_0x554d69=parseInt(_0x554d69);}_0x40db1a=_0x47e2cf['rx'][_0x45b6('0x17')]('\x20');if(_0x40db1a[_0x45b6('0x18')]==0x3){_0x40db1a=_0x40db1a[0x2]['substring'](0x1,_0x40db1a[0x2]['length']-0x1);}else if(_0x40db1a[_0x45b6('0x18')]>0x3){var _0x4d983a=/\((.+)\)/;var _0xf0a809=_0x47e2cf['rx'][_0x45b6('0x19')](_0x4d983a);if(_0xf0a809){_0x40db1a=_0xf0a809[0x1];}else{_0x40db1a=null;}}else{_0x40db1a=null;}_0x47e2cf['cb'](null,{'code':_0x34daf,'result':_0x554d69,'extra':_0x40db1a});}});_0x7ac7c5['on'](_0x45b6('0x1a'),function(_0x365882){_0x1db287[_0x45b6('0x9')](_0x45b6('0x1a'),new AGIError(_0x45b6('0x1b'),_0x365882[_0x45b6('0x1c')]));});_0x7ac7c5['on'](_0x45b6('0x1d'),function(){_0x1db287['emit'](_0x45b6('0x1d'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x7ac7c5['on'](_0x45b6('0x1e'),function(){_0x1db287[_0x45b6('0x9')](_0x45b6('0x1e'),new AGIError(_0x45b6('0x1f')));_0x7ac7c5['destroy']();});_0x7ac7c5[_0x45b6('0x20')](_0x15541f);this[_0x45b6('0x21')]=function(_0x24c777,_0x4785b0){var _0x24c777=_0x24c777||'',_0x4785b0=typeof _0x4785b0==_0x45b6('0x22')?_0x4785b0:new Function();_0x47e2cf={'tx':_0x24c777,'rx':'','cb':_0x4785b0};_0x7ac7c5['write'](_0x24c777+'\x0a');},this[_0x45b6('0x1d')]=function(){_0x7ac7c5[_0x45b6('0x23')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x45b6('0x24')][_0x45b6('0x25')]=function(_0x52ad66){return this['command'][_0x45b6('0x26')](this,_0x52ad66);};AGIChannel['prototype']['answer']=function(){return this[_0x45b6('0x25')](_0x45b6('0x27'));};AGIChannel[_0x45b6('0x24')][_0x45b6('0x28')]=function(_0x4cc9ed,_0x14f214,_0x1acb32){_0x4cc9ed=_0x4cc9ed===undefined?_0x45b6('0x29'):_0x4cc9ed;_0x14f214=_0x14f214===undefined?'5':_0x14f214;_0x1acb32=_0x1acb32===undefined?'1':_0x1acb32;return this[_0x45b6('0x25')](util[_0x45b6('0x2a')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x4cc9ed,_0x14f214*0x3e8,_0x1acb32));};AGIChannel['prototype'][_0x45b6('0x2b')]=function(_0x35388b){_0x35388b=_0x35388b||_0x45b6('0x2c');return this[_0x45b6('0x25')](util[_0x45b6('0x2a')](_0x45b6('0x2d'),_0x35388b));};AGIChannel[_0x45b6('0x24')][_0x45b6('0x2e')]=function(_0x513d8b,_0x2eae6b){if(_[_0x45b6('0x2f')](_0x2eae6b)){return this[_0x45b6('0x25')](util[_0x45b6('0x2a')]('EXEC\x20%s\x20%s',_0x513d8b,_0x2eae6b[_0x45b6('0x30')](',')));}return this[_0x45b6('0x25')](util[_0x45b6('0x2a')](_0x45b6('0x31'),_0x513d8b,_0x2eae6b));};AGIChannel[_0x45b6('0x24')]['setContext']=function(_0x5269eb){return this[_0x45b6('0x25')](util['format']('SET\x20CONTEXT\x20%s',_0x5269eb));};AGIChannel[_0x45b6('0x24')][_0x45b6('0x32')]=function(_0x45dca6){return this[_0x45b6('0x25')](util[_0x45b6('0x2a')]('SET\x20EXTENSION\x20%s',_0x45dca6));};AGIChannel[_0x45b6('0x24')][_0x45b6('0x33')]=function(_0x27ae87){return this[_0x45b6('0x25')](util[_0x45b6('0x2a')](_0x45b6('0x34'),_0x27ae87));};AGIChannel[_0x45b6('0x24')][_0x45b6('0xd')]=function(){return this['sendRequest'](_0x45b6('0x35'));};AGIChannel[_0x45b6('0x24')][_0x45b6('0x36')]=function(_0x2c624c,_0x88ce8e){var _0x49382b=_[_0x45b6('0x37')](_0x88ce8e)||_[_0x45b6('0x38')](_0x88ce8e)?_0x88ce8e[_0x45b6('0x39')]():_0x88ce8e;return this[_0x45b6('0x25')](util[_0x45b6('0x2a')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x2c624c,_0x49382b?_0x49382b[_0x45b6('0x39')]()[_0x45b6('0x3a')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x45b6('0x24')][_0x45b6('0x3b')]=function(_0xb5d5a6,_0x8de684){return this[_0x45b6('0x25')](util[_0x45b6('0x2a')](_0x45b6('0x3c'),_0xb5d5a6,_0x8de684));};AGIChannel['prototype'][_0x45b6('0x3d')]=function(_0x262513,_0x5172d8){return this[_0x45b6('0x25')](util[_0x45b6('0x2a')](_0x45b6('0x3e'),_0x262513,_0x5172d8));};AGIChannel[_0x45b6('0x24')][_0x45b6('0x3f')]=function(_0x455b63,_0x32510d){return this['sendRequest'](util[_0x45b6('0x2a')](_0x45b6('0x40'),_0x455b63,_0x32510d));};AGIChannel[_0x45b6('0x24')]['continueAt']=function(_0x41ef15,_0xa6676d,_0x5f3508){_0xa6676d=_0xa6676d||this[_0x45b6('0x41')];_0x5f3508=_0x5f3508||0x1;this['setContext'](_0x41ef15);this['setExtension'](_0xa6676d);this['setPriority'](_0x5f3508);return this[_0x45b6('0x2b')](util['format'](_0x45b6('0x42'),_0x41ef15,_0xa6676d,_0x5f3508));};AGIChannel['prototype'][_0x45b6('0x43')]=function(_0x2c1b3a){return this['sendRequest'](util[_0x45b6('0x2a')](_0x45b6('0x44'),_0x2c1b3a));};AGIChannel[_0x45b6('0x24')][_0x45b6('0x45')]=function(_0xc47969,_0x140708,_0x1039e9,_0x4aef4a,_0x22292b,_0x540f57){_0x140708=_0x140708||_0x45b6('0x46');_0x1039e9=_0x1039e9||'';_0x4aef4a=_0x4aef4a===undefined?-0x1:_0x4aef4a==='-1'?-0x1:_0x4aef4a*0x3e8;_0x22292b=_0x22292b===undefined?'':'s='+_0x22292b;_0x540f57=_0x540f57?_0x45b6('0x47'):'';return this[_0x45b6('0x25')](util['format'](_0x45b6('0x48'),_0xc47969,_0x140708,_0x1039e9,_0x4aef4a,_0x540f57,_0x22292b));};AGIChannel[_0x45b6('0x24')]['streamFile']=function(_0xefedba,_0x596063){_0x596063=_0x596063||'';return this[_0x45b6('0x25')](util[_0x45b6('0x2a')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0xefedba,_0x596063));};AGIChannel[_0x45b6('0x24')]['agi']=function(_0x225425){return this[_0x45b6('0x2e')](_0x45b6('0x49'),_0x225425);};AGIChannel[_0x45b6('0x24')]['wait']=function(_0x4e101b){return this['exec']('WAIT',_0x4e101b);};AGIChannel[_0x45b6('0x24')][_0x45b6('0x1a')]=function(_0x3db78d,_0x56ae98){this[_0x45b6('0x2b')](util[_0x45b6('0x2a')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x3db78d['id'],_0x3db78d[_0x45b6('0x4a')],_0x56ae98));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 ec00f36..efc249b 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 _0x78e3=['Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','push','format','apply','message','name','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x78e3,0xf9));var _0x378e=function(_0xaa563e,_0x3c2d87){_0xaa563e=_0xaa563e-0x0;var _0x447e64=_0x78e3[_0xaa563e];return _0x447e64;};'use strict';var util=require(_0x378e('0x0'));var error={'E_AGI_UNDEFINED':_0x378e('0x1'),'E_AGI_ARGUMENT_PORT':_0x378e('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x378e('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x378e('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x378e('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x378e('0x6'),'E_AGI_COMMAND_EMPTY':_0x378e('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x378e('0x8'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0xdff0bc){var _0xdff0bc=_0xdff0bc||null,_0x293daf=_0x293daf||[],_0xafd35=0x1,_0x400f73='';if(!error[_0xdff0bc]){_0xdff0bc='E_AGI_UNDEFINED';}_0x293daf['push'](error[_0xdff0bc]);while(arguments[_0xafd35]){_0x293daf[_0x378e('0x9')](arguments[_0xafd35]);_0xafd35++;}_0x400f73=util[_0x378e('0xa')][_0x378e('0xb')](util,_0x293daf);this[_0x378e('0xc')]=_0x400f73;this[_0x378e('0xd')]=_0xdff0bc;}module['exports']=AGIError; \ No newline at end of file +var _0x52fe=['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\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','format','message','exports','util'];(function(_0x3ef472,_0x5dbbea){var _0xcd2af4=function(_0x50ef00){while(--_0x50ef00){_0x3ef472['push'](_0x3ef472['shift']());}};_0xcd2af4(++_0x5dbbea);}(_0x52fe,0x1a3));var _0xe52f=function(_0x2c33d9,_0x448e22){_0x2c33d9=_0x2c33d9-0x0;var _0x687ee8=_0x52fe[_0x2c33d9];return _0x687ee8;};'use strict';var util=require(_0xe52f('0x0'));var error={'E_AGI_UNDEFINED':_0xe52f('0x1'),'E_AGI_ARGUMENT_PORT':_0xe52f('0x2'),'E_AGI_SERVER_ERROR':_0xe52f('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xe52f('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xe52f('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0xe52f('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xe52f('0x7'),'E_AGI_COMMAND_EMPTY':_0xe52f('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0xe52f('0x9')};function AGIError(_0xd56730){var _0xd56730=_0xd56730||null,_0x93d4f9=_0x93d4f9||[],_0x4ebaa5=0x1,_0x44986c='';if(!error[_0xd56730]){_0xd56730=_0xe52f('0xa');}_0x93d4f9['push'](error[_0xd56730]);while(arguments[_0x4ebaa5]){_0x93d4f9['push'](arguments[_0x4ebaa5]);_0x4ebaa5++;}_0x44986c=util[_0xe52f('0xb')]['apply'](util,_0x93d4f9);this[_0xe52f('0xc')]=_0x44986c;this['name']=_0xd56730;}module[_0xe52f('0xd')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 1136adb..569528d 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 _0x1e50=['addEdge','push','size','relations','getVertex','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','vswitch','target','default','agicommand','invalid','traverseBFS','default\x20on\x20switch\x20not\x20found','includes','exports','../../../config/logger','agi','menu','getsecretdigits','vertices','edges','numberOfEdges','prototype'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x1e50,0xa6));var _0x01e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e50[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var logger=require(_0x01e5('0x0'))(_0x01e5('0x1'));var verticesWithRetry=[_0x01e5('0x2'),'getdigits',_0x01e5('0x3')];var Graph=function(){this[_0x01e5('0x4')]={};this[_0x01e5('0x5')]={};this[_0x01e5('0x6')]=0x0;};Graph[_0x01e5('0x7')]['addVertex']=function(_0xf556b8){this[_0x01e5('0x4')][_0xf556b8['id']]=_0xf556b8;this['edges'][_0xf556b8['id']]=[];};Graph[_0x01e5('0x7')][_0x01e5('0x8')]=function(_0x2c0305,_0x6aaf5e,_0x388945){this['edges'][_0x2c0305][_0x01e5('0x9')]({'target':_0x6aaf5e,'condition':_0x388945});this[_0x01e5('0x6')]+=0x1;};Graph[_0x01e5('0x7')][_0x01e5('0xa')]=function(){return _[_0x01e5('0xa')](this[_0x01e5('0x4')]);};Graph[_0x01e5('0x7')][_0x01e5('0xb')]=function(){return this[_0x01e5('0x6')];};Graph[_0x01e5('0x7')][_0x01e5('0xc')]=function(_0x4e937f){return this[_0x01e5('0x4')][_0x4e937f];};Graph[_0x01e5('0x7')]['traverseBFS']=function(_0x4e0fd3,_0x179df6){if(!this[_0x01e5('0x4')][_0x4e0fd3]){return logger[_0x01e5('0xd')](_0x01e5('0xe'));}var _0x30102b=_0x179df6(this['vertices'][_0x4e0fd3]);if(!_0x30102b){return logger[_0x01e5('0xd')](_0x01e5('0xf'));}if(this[_0x01e5('0x5')][_0x4e0fd3][_0x01e5('0x10')]===0x0){return logger['info'](_0x01e5('0x11'));}for(var _0x2f5521=0x0,_0x28f3d9=[],_0x3cce68=![];_0x2f5521\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','value','getSquareProject','catch','createSquareReport','then','agi_','substring','inspect','variables','stringify','close','timeout','hangup','production','start','root','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','debug','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','isUndefined','result','toString','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0xaecf,0x11c));var _0xfaec=function(_0x156c8a,_0x403e7f){_0x156c8a=_0x156c8a-0x0;var _0x5f0f3e=_0xaecf[_0x156c8a];return _0x5f0f3e;};'use strict';var parser=require('xml2json');var _=require(_0xfaec('0x0'));var syncho=require('syncho');var util=require(_0xfaec('0x1'));var moment=require(_0xfaec('0x2'));var config=require(_0xfaec('0x3'));var logger=require('../../config/logger')('agi');var utilLicense=require(_0xfaec('0x4'));var rpc=require(_0xfaec('0x5'));var mailRpc=require(_0xfaec('0x6'));var Graph=require(_0xfaec('0x7'));var Vertices=require(_0xfaec('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xfaec('0x9')]=_[_0xfaec('0xa')](config['agi'],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0xbe227e){process[_0xfaec('0xb')](function(){syncho(function(){try{setChannelVariables(_0xbe227e);agiHandler(_0xbe227e);}catch(_0x4a8bc5){logger[_0xfaec('0xc')](_0x4a8bc5['stack']);}});});}function listeningHandler(){console[_0xfaec('0xd')](_0xfaec('0xe'),config[_0xfaec('0x9')]['port']);logger[_0xfaec('0xf')](util[_0xfaec('0x10')](_0xfaec('0x11'),config['agi']['ip'],config[_0xfaec('0x9')][_0xfaec('0x12')]));}function errorHandler(_0x4c764b){if(_0x4c764b&&_0x4c764b[_0xfaec('0x13')]&&_0x4c764b[_0xfaec('0x14')]){logger[_0xfaec('0xc')](util['format'](_0xfaec('0x15'),_0x4c764b[_0xfaec('0x13')],_0x4c764b[_0xfaec('0x14')]));}else{logger[_0xfaec('0xc')](util[_0xfaec('0x10')](_0xfaec('0x16'),_0x4c764b[_0xfaec('0x17')]));}}function closeHandler(){logger['info'](util[_0xfaec('0x10')](_0xfaec('0x18'),this[_0xfaec('0x19')],this[_0xfaec('0x1a')],this[_0xfaec('0x1b')],this[_0xfaec('0x1c')],this['uniqueid']));try{createSquareReport(this);}catch(_0x3c3b5c){logger[_0xfaec('0xc')](_0x3c3b5c[_0xfaec('0x17')]);}}function timeoutHandler(){logger['info'](util[_0xfaec('0x10')](_0xfaec('0x1d'),this[_0xfaec('0x19')],this[_0xfaec('0x1a')],this['callerid'],this[_0xfaec('0x1c')],this[_0xfaec('0x1e')]));}function hangupHandler(){logger[_0xfaec('0xf')](util[_0xfaec('0x10')](_0xfaec('0x1f'),this[_0xfaec('0x19')],this[_0xfaec('0x1a')],this[_0xfaec('0x1b')],this[_0xfaec('0x1c')],this['uniqueid']));this[_0xfaec('0x20')]=!![];}function getRoot(_0x2d2b17){return parser[_0xfaec('0x21')](_0x2d2b17,{'object':!![]})[_0xfaec('0x22')]['root'];}function addVertex(_0x40e291,_0x1c3c5c,_0x26401f){_0x1c3c5c[_0xfaec('0x23')]=_0x26401f;if(_0x1c3c5c[_0xfaec('0x24')](_0xfaec('0x25'))){_0x1c3c5c[_0xfaec('0x26')]=parseInt(_0x1c3c5c[_0xfaec('0x25')],0xa);}_0x40e291[_0xfaec('0x27')](_[_0xfaec('0x28')](_0x1c3c5c,_0xfaec('0x29')));}function initGraph(_0x71fffb,_0x4744c3){var _0x1c388a=new Graph();for(var _0xe3c7e9 in _0x71fffb){if(_0x71fffb[_0xfaec('0x24')](_0xe3c7e9)){if(_[_0xfaec('0x2a')](_0x71fffb[_0xe3c7e9])){for(var _0x283451=0x0;_0x283451<_0x71fffb[_0xe3c7e9]['length'];_0x283451+=0x1){addVertex(_0x1c388a,_0x71fffb[_0xe3c7e9][_0x283451],_0xe3c7e9);}}else{addVertex(_0x1c388a,_0x71fffb[_0xe3c7e9],_0xe3c7e9);}}}for(var _0x2d42d9=0x0;_0x2d42d9<_0x4744c3[_0xfaec('0x2b')];_0x2d42d9+=0x1){if(_0x4744c3[_0x2d42d9]['source']&&_0x4744c3[_0x2d42d9]['target']){_0x1c388a['addEdge'](_0x4744c3[_0x2d42d9][_0xfaec('0x2c')],_0x4744c3[_0x2d42d9][_0xfaec('0x2d')],_0x4744c3[_0x2d42d9][_0xfaec('0x2e')]);}}return _0x1c388a;}function getSquareProject(_0x3d0a86,_0x328976){rpc[_0xfaec('0x2f')](_0x3d0a86)['then'](function(_0x1c4f16){_0x328976(null,_0x1c4f16);})[_0xfaec('0x30')](function(_0x4ee274){_0x328976(null,_0x4ee274);});}function createSquareReport(_0x526504,_0x1d5206){rpc[_0xfaec('0x31')](_0x526504)[_0xfaec('0x32')](function(_0x719575){if(_0x1d5206){_0x1d5206(null,_0x719575);}})[_0xfaec('0x30')](function(_0x8c53d6){if(_0x1d5206){_0x1d5206(null,_0x8c53d6);}});}function setChannelVariables(_0x1dc065){for(var _0x9afaa3 in _0x1dc065){if(_0x1dc065['hasOwnProperty'](_0x9afaa3)){if(_0x9afaa3['indexOf'](_0xfaec('0x33'))===0x0){_0x1dc065[_0x9afaa3[_0xfaec('0x34')](0x4)]=_0x1dc065[_0x9afaa3];delete _0x1dc065[_0x9afaa3];}}}}function getLogFromObject(_0x23a749){return util[_0xfaec('0x35')](_0x23a749,{'showHidden':![],'depth':null});}function agiHandler(_0x53788d){var _0x2a9436,_0x468c10,_0x57bd33,_0xed52bb,_0x5aa768;logger['debug'](_0xfaec('0x36'),JSON[_0xfaec('0x37')](_0x53788d,null,0x2));logger[_0xfaec('0xf')](util['format']('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x53788d[_0xfaec('0x19')],_0x53788d[_0xfaec('0x1a')],_0x53788d['callerid'],_0x53788d[_0xfaec('0x1c')],_0x53788d[_0xfaec('0x1e')]));_0x53788d['on'](_0xfaec('0xc'),errorHandler);_0x53788d['on'](_0xfaec('0x38'),closeHandler);_0x53788d['on'](_0xfaec('0x39'),timeoutHandler);_0x53788d[_0xfaec('0x20')]=![];_0x53788d['on'](_0xfaec('0x3a'),hangupHandler);var _0x5743c5=getSquareProject['sync'](null,_0x53788d[_0xfaec('0x19')]);if(_0x5743c5){if(_0x5743c5[_0xfaec('0x3b')]){_0x2a9436=getRoot(_0x5743c5['production']);if(_0x2a9436&&_0x2a9436[_0xfaec('0x3c')]){logger['debug'](_0xfaec('0x3d'),JSON['stringify'](_0x2a9436,null,0x2));_0x53788d[_0xfaec('0x3e')]=moment()[_0xfaec('0x10')](_0xfaec('0x3f'));_0x468c10=initGraph(_['omit'](_0x2a9436,_0xfaec('0x29')),_0x2a9436['mxCell']);_0x57bd33=new Vertices(_0x53788d,rpc,mailRpc);logger['info'](util[_0xfaec('0x10')](_0xfaec('0x40'),_0x53788d[_0xfaec('0x19')],_0x53788d['calleridname'],_0x53788d['callerid'],_0x53788d[_0xfaec('0x1c')],_0x53788d[_0xfaec('0x1e')]));_0x468c10[_0xfaec('0x41')](_0x2a9436[_0xfaec('0x3c')]['id'],function(_0x46b6e3){try{_0x46b6e3=_0x57bd33[_0xfaec('0x42')](_0x46b6e3);logger[_0xfaec('0x43')](_0xfaec('0x44'),JSON[_0xfaec('0x37')](_0x46b6e3,null,0x2));if(_0x46b6e3[_0xfaec('0x23')]===_0xfaec('0x45')){logger[_0xfaec('0xf')](_0xfaec('0x46'));_0x53788d[_0xfaec('0x47')]=_0x46b6e3[_0xfaec('0x47')]||_0x53788d['context'];_0x53788d[_0xfaec('0x48')]=_0x46b6e3[_0xfaec('0x48')];_0x53788d[_0xfaec('0x49')]=_0x46b6e3[_0xfaec('0x49')]?_0x46b6e3[_0xfaec('0x49')]-0x1:0x1;return null;}else if(_0x46b6e3&&_0x57bd33[_0x46b6e3[_0xfaec('0x23')]]){_0x5aa768=_0x57bd33[_0x46b6e3['agicommand']](_0x46b6e3);logger[_0xfaec('0xf')](_0xfaec('0x4a'),JSON[_0xfaec('0x37')](_0x5aa768,null,0x2));if(_0x5aa768&&_0x5aa768['code']===AGI_CODE_SUCCESS&&_0x5aa768['result']!==AGI_RESULT_ERROR&&!_0x53788d[_0xfaec('0x20')]){logger['debug']('response',getLogFromObject(_0x5aa768));return _[_0xfaec('0x4b')](_0x5aa768[_0xfaec('0x4c')])?null:_0x5aa768[_0xfaec('0x4c')][_0xfaec('0x4d')]();}else{logger[_0xfaec('0xc')](_0xfaec('0x4a'),getLogFromObject(_0x5aa768));return null;}}else{logger[_0xfaec('0xc')](_0xfaec('0x4e'));return null;}}catch(_0x5cc7e6){logger[_0xfaec('0xc')](_0x5cc7e6[_0xfaec('0x17')]);return null;}});if(_0x2a9436['finally']){logger[_0xfaec('0xf')](util[_0xfaec('0x10')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x53788d['arg_1'],_0x53788d['calleridname'],_0x53788d['callerid'],_0x53788d[_0xfaec('0x1c')],_0x53788d[_0xfaec('0x1e')]));_0x468c10['traverseBFS'](_0x2a9436['finally']['id'],function(_0x445374){try{_0x445374=_0x57bd33['clear'](_0x445374);logger[_0xfaec('0x43')](_0xfaec('0x44'),JSON[_0xfaec('0x37')](_0x445374,null,0x2));if(_0x445374&&_0x57bd33[_0x445374[_0xfaec('0x23')]]){_0x5aa768=_0x57bd33[_0x445374['agicommand']](_0x445374);if(_0x5aa768){logger[_0xfaec('0x43')](_0xfaec('0x4a'),getLogFromObject(_0x5aa768));return _[_0xfaec('0x4b')](_0x5aa768[_0xfaec('0x4c')])?null:_0x5aa768[_0xfaec('0x4c')]['toString']();}else{logger['error']('response',getLogFromObject(_0x5aa768));return null;}}else{logger[_0xfaec('0xc')]('agicommand\x20not\x20found');return null;}}catch(_0x1ea222){logger[_0xfaec('0xc')](_0x1ea222['stack']);return null;}});}logger[_0xfaec('0xf')](util[_0xfaec('0x10')](_0xfaec('0x4f'),_0x53788d['arg_1'],_0x53788d[_0xfaec('0x1a')],_0x53788d[_0xfaec('0x1b')],_0x53788d[_0xfaec('0x1c')],_0x53788d[_0xfaec('0x1e')]));logger[_0xfaec('0xf')](util[_0xfaec('0x10')](_0xfaec('0x50'),_0x53788d[_0xfaec('0x47')],_0x53788d['extension'],parseInt(_0x53788d[_0xfaec('0x49')],0xa)+0x1));_0x53788d[_0xfaec('0x51')](_0x53788d[_0xfaec('0x47')],_0x53788d['extension'],parseInt(_0x53788d[_0xfaec('0x49')],0xa)+0x1);_0x53788d[_0xfaec('0x38')]();}}else{logger[_0xfaec('0xc')](util['format']('Project\x20%s\x20not\x20published',_0x53788d[_0xfaec('0x19')]));_0x53788d[_0xfaec('0x51')](_0x53788d[_0xfaec('0x47')],_0x53788d[_0xfaec('0x48')],parseInt(_0x53788d[_0xfaec('0x49')],0xa)+0x1);_0x53788d[_0xfaec('0x38')]();}}else{logger[_0xfaec('0xc')](util[_0xfaec('0x10')]('Project\x20%s\x20not\x20found',_0x53788d[_0xfaec('0x19')]));_0x53788d[_0xfaec('0x51')](_0x53788d['context'],_0x53788d[_0xfaec('0x48')],parseInt(_0x53788d[_0xfaec('0x49')],0xa)+0x1);_0x53788d['close']();}}function main(){var _0x3eedf0;return utilLicense[_0xfaec('0x52')]()[_0xfaec('0x32')](function(_0x2d41ec){if(_0x2d41ec){if(_0x2d41ec[_0xfaec('0x53')]){if(_0x2d41ec['callysquare']&&_0x2d41ec['callysquare']>0x0){logger[_0xfaec('0xf')](util[_0xfaec('0x10')]('[LICENSE]\x20CHANNELS:\x20%s',_0x2d41ec[_0xfaec('0x54')]));_0x3eedf0=_0x2d41ec[_0xfaec('0x54')];}else{logger[_0xfaec('0xf')](_0xfaec('0x55'));}}else{logger[_0xfaec('0xf')](_0xfaec('0x56'));_0x3eedf0=-0x1;}}})[_0xfaec('0x30')](function(_0x2b9002){logger['error']('[LICENSE]',_0x2b9002[_0xfaec('0x17')]);})[_0xfaec('0x57')](function(){var _0x4f6b87=require(_0xfaec('0x58'))(config['agi'][_0xfaec('0x12')],config[_0xfaec('0x9')]['ip'],_0x3eedf0);_0x4f6b87['on'](_0xfaec('0xc'),errorHandler);_0x4f6b87['on'](_0xfaec('0x59'),listeningHandler);_0x4f6b87['on'](_0xfaec('0x5a'),connectionHandler);_0x4f6b87['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x28bc=['traverseBFS','start','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','response','isUndefined','toString','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20published','getLicense','voice','[LICENSE]\x20CHANNELS:\x20%s','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','lodash','syncho','util','../../config/environment','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','agi','defaults','127.0.0.1','error','log','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','[%s]\x20%s','name','message','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','target','addEdge','source','value','getSquareProject','then','catch','createSquareReport','indexOf','agi_','substring','inspect','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s'];(function(_0x582474,_0x46f056){var _0x422c31=function(_0x1868f9){while(--_0x1868f9){_0x582474['push'](_0x582474['shift']());}};_0x422c31(++_0x46f056);}(_0x28bc,0x141));var _0xc28b=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x28bc[_0x187ee1];return _0x388160;};'use strict';var parser=require(_0xc28b('0x0'));var _=require(_0xc28b('0x1'));var syncho=require(_0xc28b('0x2'));var util=require(_0xc28b('0x3'));var moment=require('moment');var config=require(_0xc28b('0x4'));var logger=require('../../config/logger')('agi');var utilLicense=require(_0xc28b('0x5'));var rpc=require(_0xc28b('0x6'));var mailRpc=require(_0xc28b('0x7'));var Graph=require(_0xc28b('0x8'));var Vertices=require(_0xc28b('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xc28b('0xa')]=_[_0xc28b('0xb')](config[_0xc28b('0xa')],{'ip':_0xc28b('0xc'),'port':0x11dd});function connectionHandler(_0x4da5a4){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x4da5a4);agiHandler(_0x4da5a4);}catch(_0x2caea2){logger[_0xc28b('0xd')](_0x2caea2['stack']);}});});}function listeningHandler(){console[_0xc28b('0xe')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0xc28b('0xa')][_0xc28b('0xf')]);logger[_0xc28b('0x10')](util[_0xc28b('0x11')](_0xc28b('0x12'),config['agi']['ip'],config[_0xc28b('0xa')][_0xc28b('0xf')]));}function errorHandler(_0x4daf26){if(_0x4daf26&&_0x4daf26['name']&&_0x4daf26['message']){logger[_0xc28b('0xd')](util[_0xc28b('0x11')](_0xc28b('0x13'),_0x4daf26[_0xc28b('0x14')],_0x4daf26[_0xc28b('0x15')]));}else{logger['error'](util['format']('[ERROR]\x20%s',_0x4daf26[_0xc28b('0x16')]));}}function closeHandler(){logger[_0xc28b('0x10')](util[_0xc28b('0x11')](_0xc28b('0x17'),this[_0xc28b('0x18')],this[_0xc28b('0x19')],this[_0xc28b('0x1a')],this[_0xc28b('0x1b')],this[_0xc28b('0x1c')]));try{createSquareReport(this);}catch(_0x24972e){logger['error'](_0x24972e[_0xc28b('0x16')]);}}function timeoutHandler(){logger[_0xc28b('0x10')](util[_0xc28b('0x11')](_0xc28b('0x1d'),this['arg_1'],this[_0xc28b('0x19')],this[_0xc28b('0x1a')],this['dnid'],this[_0xc28b('0x1c')]));}function hangupHandler(){logger[_0xc28b('0x10')](util[_0xc28b('0x11')](_0xc28b('0x1e'),this[_0xc28b('0x18')],this['calleridname'],this[_0xc28b('0x1a')],this['dnid'],this['uniqueid']));this[_0xc28b('0x1f')]=!![];}function getRoot(_0x4fddd4){return parser[_0xc28b('0x20')](_0x4fddd4,{'object':!![]})[_0xc28b('0x21')][_0xc28b('0x22')];}function addVertex(_0x96ee28,_0x389b2b,_0x3ccb80){_0x389b2b[_0xc28b('0x23')]=_0x3ccb80;if(_0x389b2b[_0xc28b('0x24')](_0xc28b('0x25'))){_0x389b2b[_0xc28b('0x26')]=parseInt(_0x389b2b[_0xc28b('0x25')],0xa);}_0x96ee28[_0xc28b('0x27')](_[_0xc28b('0x28')](_0x389b2b,_0xc28b('0x29')));}function initGraph(_0x29d41d,_0xebb2f8){var _0x32b81f=new Graph();for(var _0x28bcab in _0x29d41d){if(_0x29d41d['hasOwnProperty'](_0x28bcab)){if(_[_0xc28b('0x2a')](_0x29d41d[_0x28bcab])){for(var _0xa1af49=0x0;_0xa1af49<_0x29d41d[_0x28bcab][_0xc28b('0x2b')];_0xa1af49+=0x1){addVertex(_0x32b81f,_0x29d41d[_0x28bcab][_0xa1af49],_0x28bcab);}}else{addVertex(_0x32b81f,_0x29d41d[_0x28bcab],_0x28bcab);}}}for(var _0x7e9508=0x0;_0x7e9508<_0xebb2f8[_0xc28b('0x2b')];_0x7e9508+=0x1){if(_0xebb2f8[_0x7e9508]['source']&&_0xebb2f8[_0x7e9508][_0xc28b('0x2c')]){_0x32b81f[_0xc28b('0x2d')](_0xebb2f8[_0x7e9508][_0xc28b('0x2e')],_0xebb2f8[_0x7e9508][_0xc28b('0x2c')],_0xebb2f8[_0x7e9508][_0xc28b('0x2f')]);}}return _0x32b81f;}function getSquareProject(_0x5a0362,_0x323db8){rpc[_0xc28b('0x30')](_0x5a0362)[_0xc28b('0x31')](function(_0x4dcddf){_0x323db8(null,_0x4dcddf);})[_0xc28b('0x32')](function(_0xbc2693){_0x323db8(null,_0xbc2693);});}function createSquareReport(_0x29b40d,_0x16b98b){rpc[_0xc28b('0x33')](_0x29b40d)[_0xc28b('0x31')](function(_0x19f8de){if(_0x16b98b){_0x16b98b(null,_0x19f8de);}})[_0xc28b('0x32')](function(_0x2e6aff){if(_0x16b98b){_0x16b98b(null,_0x2e6aff);}});}function setChannelVariables(_0x5cded3){for(var _0x1ca6e2 in _0x5cded3){if(_0x5cded3['hasOwnProperty'](_0x1ca6e2)){if(_0x1ca6e2[_0xc28b('0x34')](_0xc28b('0x35'))===0x0){_0x5cded3[_0x1ca6e2[_0xc28b('0x36')](0x4)]=_0x5cded3[_0x1ca6e2];delete _0x5cded3[_0x1ca6e2];}}}}function getLogFromObject(_0xdf9cee){return util[_0xc28b('0x37')](_0xdf9cee,{'showHidden':![],'depth':null});}function agiHandler(_0x111ec5){var _0x3346d2,_0x464bb4,_0x5133e8,_0x56e32c,_0xe8fb80;logger[_0xc28b('0x38')]('variables',JSON[_0xc28b('0x39')](_0x111ec5,null,0x2));logger['info'](util[_0xc28b('0x11')](_0xc28b('0x3a'),_0x111ec5['arg_1'],_0x111ec5['calleridname'],_0x111ec5[_0xc28b('0x1a')],_0x111ec5['dnid'],_0x111ec5[_0xc28b('0x1c')]));_0x111ec5['on']('error',errorHandler);_0x111ec5['on'](_0xc28b('0x3b'),closeHandler);_0x111ec5['on'](_0xc28b('0x3c'),timeoutHandler);_0x111ec5[_0xc28b('0x1f')]=![];_0x111ec5['on'](_0xc28b('0x3d'),hangupHandler);var _0x24c26f=getSquareProject[_0xc28b('0x3e')](null,_0x111ec5[_0xc28b('0x18')]);if(_0x24c26f){if(_0x24c26f[_0xc28b('0x3f')]){_0x3346d2=getRoot(_0x24c26f['production']);if(_0x3346d2&&_0x3346d2['start']){logger[_0xc28b('0x38')](_0xc28b('0x22'),JSON[_0xc28b('0x39')](_0x3346d2,null,0x2));_0x111ec5[_0xc28b('0x40')]=moment()[_0xc28b('0x11')](_0xc28b('0x41'));_0x464bb4=initGraph(_[_0xc28b('0x28')](_0x3346d2,_0xc28b('0x29')),_0x3346d2['mxCell']);_0x5133e8=new Vertices(_0x111ec5,rpc,mailRpc);logger['info'](util['format'](_0xc28b('0x42'),_0x111ec5[_0xc28b('0x18')],_0x111ec5['calleridname'],_0x111ec5[_0xc28b('0x1a')],_0x111ec5['dnid'],_0x111ec5[_0xc28b('0x1c')]));_0x464bb4[_0xc28b('0x43')](_0x3346d2[_0xc28b('0x44')]['id'],function(_0x3581b7){try{_0x3581b7=_0x5133e8[_0xc28b('0x45')](_0x3581b7);logger[_0xc28b('0x38')](_0xc28b('0x46'),JSON[_0xc28b('0x39')](_0x3581b7,null,0x2));if(_0x3581b7[_0xc28b('0x23')]===_0xc28b('0x47')){logger[_0xc28b('0x10')](_0xc28b('0x48'));_0x111ec5[_0xc28b('0x49')]=_0x3581b7['context']||_0x111ec5[_0xc28b('0x49')];_0x111ec5[_0xc28b('0x4a')]=_0x3581b7[_0xc28b('0x4a')];_0x111ec5['priority']=_0x3581b7[_0xc28b('0x4b')]?_0x3581b7[_0xc28b('0x4b')]-0x1:0x1;return null;}else if(_0x3581b7&&_0x5133e8[_0x3581b7[_0xc28b('0x23')]]){_0xe8fb80=_0x5133e8[_0x3581b7[_0xc28b('0x23')]](_0x3581b7);logger['info']('response',JSON['stringify'](_0xe8fb80,null,0x2));if(_0xe8fb80&&_0xe8fb80[_0xc28b('0x4c')]===AGI_CODE_SUCCESS&&_0xe8fb80[_0xc28b('0x4d')]!==AGI_RESULT_ERROR&&!_0x111ec5[_0xc28b('0x1f')]){logger[_0xc28b('0x38')](_0xc28b('0x4e'),getLogFromObject(_0xe8fb80));return _[_0xc28b('0x4f')](_0xe8fb80[_0xc28b('0x4d')])?null:_0xe8fb80[_0xc28b('0x4d')][_0xc28b('0x50')]();}else{logger[_0xc28b('0xd')](_0xc28b('0x4e'),getLogFromObject(_0xe8fb80));return null;}}else{logger[_0xc28b('0xd')]('agicommand\x20not\x20found');return null;}}catch(_0x1a20a7){logger[_0xc28b('0xd')](_0x1a20a7[_0xc28b('0x16')]);return null;}});if(_0x3346d2[_0xc28b('0x51')]){logger[_0xc28b('0x10')](util[_0xc28b('0x11')](_0xc28b('0x52'),_0x111ec5[_0xc28b('0x18')],_0x111ec5[_0xc28b('0x19')],_0x111ec5[_0xc28b('0x1a')],_0x111ec5['dnid'],_0x111ec5[_0xc28b('0x1c')]));_0x464bb4[_0xc28b('0x43')](_0x3346d2[_0xc28b('0x51')]['id'],function(_0x442b47){try{_0x442b47=_0x5133e8[_0xc28b('0x45')](_0x442b47);logger[_0xc28b('0x38')](_0xc28b('0x46'),JSON[_0xc28b('0x39')](_0x442b47,null,0x2));if(_0x442b47&&_0x5133e8[_0x442b47[_0xc28b('0x23')]]){_0xe8fb80=_0x5133e8[_0x442b47['agicommand']](_0x442b47);if(_0xe8fb80){logger['debug']('response',getLogFromObject(_0xe8fb80));return _[_0xc28b('0x4f')](_0xe8fb80[_0xc28b('0x4d')])?null:_0xe8fb80[_0xc28b('0x4d')][_0xc28b('0x50')]();}else{logger['error'](_0xc28b('0x4e'),getLogFromObject(_0xe8fb80));return null;}}else{logger[_0xc28b('0xd')](_0xc28b('0x53'));return null;}}catch(_0x3c935f){logger[_0xc28b('0xd')](_0x3c935f[_0xc28b('0x16')]);return null;}});}logger['info'](util[_0xc28b('0x11')](_0xc28b('0x54'),_0x111ec5[_0xc28b('0x18')],_0x111ec5['calleridname'],_0x111ec5[_0xc28b('0x1a')],_0x111ec5[_0xc28b('0x1b')],_0x111ec5[_0xc28b('0x1c')]));logger[_0xc28b('0x10')](util[_0xc28b('0x11')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x111ec5[_0xc28b('0x49')],_0x111ec5['extension'],parseInt(_0x111ec5['priority'],0xa)+0x1));_0x111ec5[_0xc28b('0x55')](_0x111ec5[_0xc28b('0x49')],_0x111ec5['extension'],parseInt(_0x111ec5[_0xc28b('0x4b')],0xa)+0x1);_0x111ec5[_0xc28b('0x3b')]();}}else{logger[_0xc28b('0xd')](util[_0xc28b('0x11')](_0xc28b('0x56'),_0x111ec5[_0xc28b('0x18')]));_0x111ec5[_0xc28b('0x55')](_0x111ec5[_0xc28b('0x49')],_0x111ec5[_0xc28b('0x4a')],parseInt(_0x111ec5[_0xc28b('0x4b')],0xa)+0x1);_0x111ec5[_0xc28b('0x3b')]();}}else{logger[_0xc28b('0xd')](util[_0xc28b('0x11')]('Project\x20%s\x20not\x20found',_0x111ec5['arg_1']));_0x111ec5[_0xc28b('0x55')](_0x111ec5[_0xc28b('0x49')],_0x111ec5[_0xc28b('0x4a')],parseInt(_0x111ec5[_0xc28b('0x4b')],0xa)+0x1);_0x111ec5[_0xc28b('0x3b')]();}}function main(){var _0x2ff3c7;return utilLicense[_0xc28b('0x57')]()['then'](function(_0x148210){if(_0x148210){if(_0x148210[_0xc28b('0x58')]){if(_0x148210['callysquare']&&_0x148210['callysquare']>0x0){logger['info'](util[_0xc28b('0x11')](_0xc28b('0x59'),_0x148210[_0xc28b('0x5a')]));_0x2ff3c7=_0x148210['callysquare'];}else{logger['info'](_0xc28b('0x5b'));}}else{logger[_0xc28b('0x10')](_0xc28b('0x5c'));_0x2ff3c7=-0x1;}}})['catch'](function(_0x1acf77){logger[_0xc28b('0xd')](_0xc28b('0x5d'),_0x1acf77[_0xc28b('0x16')]);})[_0xc28b('0x51')](function(){var _0x980603=require(_0xc28b('0x5e'))(config[_0xc28b('0xa')]['port'],config[_0xc28b('0xa')]['ip'],_0x2ff3c7);_0x980603['on'](_0xc28b('0xd'),errorHandler);_0x980603['on'](_0xc28b('0x5f'),listeningHandler);_0x980603['on'](_0xc28b('0x60'),connectionHandler);_0x980603['on'](_0xc28b('0x3b'),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 6ff79a8..977da10 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 _0xd928=['http','request','then','error','message','catch','sendMailMessage','SendMail','bluebird','client'];(function(_0x3059ad,_0x1ea91f){var _0x4dffb1=function(_0x3bc04a){while(--_0x3bc04a){_0x3059ad['push'](_0x3059ad['shift']());}};_0x4dffb1(++_0x1ea91f);}(_0xd928,0x184));var _0x8d92=function(_0x24ce2e,_0x300669){_0x24ce2e=_0x24ce2e-0x0;var _0x122867=_0xd928[_0x24ce2e];return _0x122867;};'use strict';var BPromise=require(_0x8d92('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x8d92('0x1')][_0x8d92('0x2')]({'port':0x232b});function request(_0x488d54,_0x51d179){return new BPromise(function(_0x1ed708,_0x401edd){return client[_0x8d92('0x3')](_0x488d54,_0x51d179)[_0x8d92('0x4')](function(_0x4c0ecd){if(_0x4c0ecd[_0x8d92('0x5')]){return _0x401edd(_0x4c0ecd[_0x8d92('0x5')][_0x8d92('0x6')]);}else{return _0x1ed708(_0x4c0ecd['result']);}})[_0x8d92('0x7')](function(_0x248489){return _0x401edd(_0x248489);});});}exports[_0x8d92('0x8')]=function(_0x28d995,_0xd2abdf){return request(_0x8d92('0x9'),{'account':_0x28d995,'message':_0xd2abdf});}; \ No newline at end of file +var _0xb815=['jayson/promise','http','request','then','error','message','catch','sendMailMessage','SendMail','bluebird'];(function(_0x1ee7e4,_0x4ba132){var _0x4a99aa=function(_0x115d2d){while(--_0x115d2d){_0x1ee7e4['push'](_0x1ee7e4['shift']());}};_0x4a99aa(++_0x4ba132);}(_0xb815,0x121));var _0x5b81=function(_0x5d0fda,_0x45fdda){_0x5d0fda=_0x5d0fda-0x0;var _0x4fb4ad=_0xb815[_0x5d0fda];return _0x4fb4ad;};'use strict';var BPromise=require(_0x5b81('0x0'));var jayson=require(_0x5b81('0x1'));var client=jayson['client'][_0x5b81('0x2')]({'port':0x232b});function request(_0x3eb581,_0x42e905){return new BPromise(function(_0x5b1edf,_0x1dfa20){return client[_0x5b81('0x3')](_0x3eb581,_0x42e905)[_0x5b81('0x4')](function(_0x41ca47){if(_0x41ca47[_0x5b81('0x5')]){return _0x1dfa20(_0x41ca47[_0x5b81('0x5')][_0x5b81('0x6')]);}else{return _0x5b1edf(_0x41ca47['result']);}})[_0x5b81('0x7')](function(_0x22c0cb){return _0x1dfa20(_0x22c0cb);});});}exports[_0x5b81('0x8')]=function(_0x387e3b,_0x9d5830){return request(_0x5b81('0x9'),{'account':_0x387e3b,'message':_0x9d5830});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 46c5e07..1328297 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 _0x6fd6=['substring','length','split','slice','trim','emit','headers','exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','_transform','toString','indexOf'];(function(_0xd2a270,_0x36ece1){var _0x41e28e=function(_0x59e3f0){while(--_0x59e3f0){_0xd2a270['push'](_0xd2a270['shift']());}};_0x41e28e(++_0x36ece1);}(_0x6fd6,0x86));var _0x66fd=function(_0x2c80a8,_0x40354a){_0x2c80a8=_0x2c80a8-0x0;var _0x52cf13=_0x6fd6[_0x2c80a8];return _0x52cf13;};'use strict';var util=require(_0x66fd('0x0'));var Transform=require(_0x66fd('0x1'))[_0x66fd('0x2')];function AGIReply(_0x23b0c3){Transform[_0x66fd('0x3')](this,_0x23b0c3);this[_0x66fd('0x4')]='';this[_0x66fd('0x5')]=![];}util[_0x66fd('0x6')](AGIReply,Transform);AGIReply['prototype'][_0x66fd('0x7')]=function(_0x2f4307,_0x264c77,_0x36f5c9){var _0x3a927f='\x0a',_0x45219c=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x3b75ac=-0x1,_0x22aad5=-0x1,_0x425b58='',_0x4c5ced=0x0,_0x5214d3='',_0x256a99='';this['_localBuffer']+=_0x2f4307[_0x66fd('0x8')]();_0x5214d3=this[_0x66fd('0x4')];if(!this[_0x66fd('0x5')]){_0x4c5ced=0x0;while(_0x45219c[_0x4c5ced]){while((_0x22aad5=_0x5214d3[_0x66fd('0x9')](_0x45219c[_0x4c5ced]))!=-0x1){_0x425b58=_0x45219c[_0x4c5ced];_0x256a99=_0x5214d3['substring'](0x0,_0x22aad5);_0x5214d3=_0x5214d3[_0x66fd('0xa')](_0x22aad5+_0x425b58[_0x66fd('0xb')]);var _0x4fa475=_0x256a99[_0x66fd('0xc')](_0x3a927f),_0x2eb8ec=0x0,_0x991fd={},_0xa3e795='',_0x20466c='',_0xc54220=-0x1;while(_0x4fa475[_0x2eb8ec]){_0xc54220=_0x4fa475[_0x2eb8ec][_0x66fd('0x9')](':');if(_0xc54220!=-0x1){_0xa3e795=_0x4fa475[_0x2eb8ec][_0x66fd('0xd')](0x0,_0xc54220)[_0x66fd('0xe')]();_0x20466c=_0x4fa475[_0x2eb8ec][_0x66fd('0xd')](_0xc54220+0x1)[_0x66fd('0xe')]();if(_0xa3e795[_0x66fd('0xb')]>0x0){_0x991fd[_0xa3e795]=_0x20466c;}}else{}_0x2eb8ec++;}this[_0x66fd('0xf')](_0x66fd('0x10'),_0x991fd);this['_inBody']=!![];}_0x4c5ced++;}this['_localBuffer']=_0x5214d3;}else{while((_0x3b75ac=_0x5214d3[_0x66fd('0x9')](_0x3a927f))!=-0x1){_0x256a99=_0x5214d3[_0x66fd('0xa')](0x0,_0x3b75ac);this['emit']('line',_0x256a99);_0x5214d3=_0x5214d3[_0x66fd('0xa')](_0x3b75ac+_0x3a927f[_0x66fd('0xb')]);}this[_0x66fd('0x4')]=_0x5214d3;}_0x36f5c9();};module[_0x66fd('0x11')]=AGIReply; \ No newline at end of file +var _0x0326=['indexOf','slice','trim','headers','emit','line','exports','util','stream','Transform','_localBuffer','_inBody','prototype','_transform','\x0d\x0a\x0d\x0a','substring','length','split'];(function(_0xb924fc,_0x62b819){var _0x19c71a=function(_0x30023b){while(--_0x30023b){_0xb924fc['push'](_0xb924fc['shift']());}};_0x19c71a(++_0x62b819);}(_0x0326,0x115));var _0x6032=function(_0x2efb31,_0x2c0882){_0x2efb31=_0x2efb31-0x0;var _0x893d76=_0x0326[_0x2efb31];return _0x893d76;};'use strict';var util=require(_0x6032('0x0'));var Transform=require(_0x6032('0x1'))[_0x6032('0x2')];function AGIReply(_0x4d7cea){Transform['call'](this,_0x4d7cea);this[_0x6032('0x3')]='';this[_0x6032('0x4')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x6032('0x5')][_0x6032('0x6')]=function(_0x23b558,_0x10f350,_0xefe798){var _0xf8769b='\x0a',_0x13a919=['\x0a\x0a',_0x6032('0x7')],_0x18ba9c=-0x1,_0x8ae1ff=-0x1,_0x3c94ee='',_0x292fff=0x0,_0x281859='',_0x58eaa4='';this[_0x6032('0x3')]+=_0x23b558['toString']();_0x281859=this[_0x6032('0x3')];if(!this[_0x6032('0x4')]){_0x292fff=0x0;while(_0x13a919[_0x292fff]){while((_0x8ae1ff=_0x281859['indexOf'](_0x13a919[_0x292fff]))!=-0x1){_0x3c94ee=_0x13a919[_0x292fff];_0x58eaa4=_0x281859[_0x6032('0x8')](0x0,_0x8ae1ff);_0x281859=_0x281859['substring'](_0x8ae1ff+_0x3c94ee[_0x6032('0x9')]);var _0x3addba=_0x58eaa4[_0x6032('0xa')](_0xf8769b),_0x521166=0x0,_0x49e212={},_0x54afde='',_0x5ae1d3='',_0x39cce0=-0x1;while(_0x3addba[_0x521166]){_0x39cce0=_0x3addba[_0x521166][_0x6032('0xb')](':');if(_0x39cce0!=-0x1){_0x54afde=_0x3addba[_0x521166][_0x6032('0xc')](0x0,_0x39cce0)[_0x6032('0xd')]();_0x5ae1d3=_0x3addba[_0x521166]['slice'](_0x39cce0+0x1)[_0x6032('0xd')]();if(_0x54afde[_0x6032('0x9')]>0x0){_0x49e212[_0x54afde]=_0x5ae1d3;}}else{}_0x521166++;}this['emit'](_0x6032('0xe'),_0x49e212);this[_0x6032('0x4')]=!![];}_0x292fff++;}this[_0x6032('0x3')]=_0x281859;}else{while((_0x18ba9c=_0x281859[_0x6032('0xb')](_0xf8769b))!=-0x1){_0x58eaa4=_0x281859['substring'](0x0,_0x18ba9c);this[_0x6032('0xf')](_0x6032('0x10'),_0x58eaa4);_0x281859=_0x281859[_0x6032('0x8')](_0x18ba9c+_0xf8769b[_0x6032('0x9')]);}this[_0x6032('0x3')]=_0x281859;}_0xefe798();};module[_0x6032('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 f8047fb..42644cf 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 _0x6e45=['getIntervalById','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','phone','ListId','CreateCmContact','agentLogin','agentPause','PauseUser','agentUnpause','agentLogout','bluebird','moment','lodash','util','jayson/promise','client','http','request','then','error','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowVariable','ShowSquareOdbc','dsn','getUserById','ShowUser','getSoundById','ShowSound','save_name'];(function(_0x16b0bd,_0x1731a3){var _0x5c30a3=function(_0x3972d4){while(--_0x3972d4){_0x16b0bd['push'](_0x16b0bd['shift']());}};_0x5c30a3(++_0x1731a3);}(_0x6e45,0x1b9));var _0x56e4=function(_0x12c9be,_0xe23d5){_0x12c9be=_0x12c9be-0x0;var _0x4b4fcf=_0x6e45[_0x12c9be];return _0x4b4fcf;};'use strict';var BPromise=require(_0x56e4('0x0'));var moment=require(_0x56e4('0x1'));var _=require(_0x56e4('0x2'));var util=require(_0x56e4('0x3'));var jayson=require(_0x56e4('0x4'));var client=jayson[_0x56e4('0x5')][_0x56e4('0x6')]({'port':0x2329});function request(_0x3b62db,_0x568f9e){return new BPromise(function(_0x3d5d54,_0x279541){return client[_0x56e4('0x7')](_0x3b62db,_0x568f9e)[_0x56e4('0x8')](function(_0x428a5e){if(_0x428a5e[_0x56e4('0x9')]){return _0x279541(_0x428a5e['error']['message']);}else{return _0x3d5d54(_0x428a5e[_0x56e4('0xa')]);}})[_0x56e4('0xb')](function(_0x2a7d55){return _0x279541(_0x2a7d55);});});}exports[_0x56e4('0xc')]=function(_0x266405){return request(_0x56e4('0xd'),{'options':{'raw':![],'where':{'name':_0x266405},'attributes':[_0x56e4('0xe')]}});};exports[_0x56e4('0xf')]=function(_0x25f28d){return request(_0x56e4('0x10'),{'options':{'raw':![],'where':{'id':_0x25f28d},'include':[{'model':_0x56e4('0x11'),'as':_0x56e4('0x12')}],'attributes':['id',_0x56e4('0x13'),'email']}});};exports[_0x56e4('0x14')]=function(_0x3db180){return request(_0x56e4('0xd'),{'options':{'where':{'id':_0x3db180},'attributes':['name']}});};exports[_0x56e4('0x15')]=function(_0xe33152){return request(_0x56e4('0x16'),{'options':{'where':{'id':_0xe33152},'attributes':[_0x56e4('0x13')]}});};exports['getVariableById']=function(_0x2d4ff5){return request(_0x56e4('0x17'),{'options':{'where':{'id':_0x2d4ff5},'attributes':['name']}});};exports['getSquareOdbcById']=function(_0x4a52e0){return request(_0x56e4('0x18'),{'options':{'where':{'id':_0x4a52e0},'attributes':[_0x56e4('0x19')]}});};exports[_0x56e4('0x1a')]=function(_0x4e853a){return request(_0x56e4('0x1b'),{'options':{'where':{'id':_0x4e853a},'attributes':[_0x56e4('0x13')]}});};exports['getTrunkById']=function(_0x25e755){return request('ShowTrunk',{'options':{'where':{'id':_0x25e755},'attributes':[_0x56e4('0x13')]}});};exports[_0x56e4('0x1c')]=function(_0x382fda){return request(_0x56e4('0x1d'),{'options':{'where':{'id':_0x382fda},'attributes':[_0x56e4('0x1e')]}});};exports[_0x56e4('0x1f')]=function(_0xb3bed7){return request(_0x56e4('0x20'),{'options':{'raw':![],'where':{'id':_0xb3bed7},'include':[{'model':'Interval','as':_0x56e4('0x21')}]}});};exports[_0x56e4('0x22')]=function(_0x4c1764){return request(_0x56e4('0x23'),{'options':{'where':{'id':_0x4c1764},'attributes':['id',_0x56e4('0x13')]}});};exports[_0x56e4('0x24')]=function(_0x295fec){return request(_0x56e4('0x25'),{'body':_0x295fec});};exports[_0x56e4('0x26')]=function(_0x2dd4b1){return request(_0x56e4('0x27'),{'body':_0x2dd4b1});};exports[_0x56e4('0x28')]=function(_0x194a1e){return request(_0x56e4('0x29'),{'body':_[_0x56e4('0x2a')](_0x194a1e,{'project_name':_0x194a1e[_0x56e4('0x2b')],'prev_project_name':_0x194a1e[_0x56e4('0x2c')]||'','is_subproject':_0x194a1e[_0x56e4('0x2c')]?!![]:![],'leaveAt':moment()[_0x56e4('0x2d')](_0x56e4('0x2e'))})});};exports[_0x56e4('0x2f')]=function(_0x48cac9){return request(_0x56e4('0x30'),{'body':_0x48cac9});};exports[_0x56e4('0x31')]=function(_0x2c68cc){return request('CreateSquareMessage',{'body':_0x2c68cc});};exports[_0x56e4('0x32')]=function(_0x5f122c){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x5f122c[_0x56e4('0x33')],'ListId':_0x5f122c[_0x56e4('0x34')]}}})[_0x56e4('0x8')](function(_0x443164){if(_0x443164){return _0x443164;}return request(_0x56e4('0x35'),{'body':_0x5f122c});});};exports['getPauseById']=function(_0x25aea6){return request('ShowPause',{'options':{'where':{'id':_0x25aea6},'attributes':[_0x56e4('0x13')]}});};exports[_0x56e4('0x36')]=function(_0x547f78,_0x200725){return request('LoginUser',{'body':{'interface':_0x200725},'options':{'where':_0x547f78}});};exports[_0x56e4('0x37')]=function(_0x3ecb00,_0x2ace6f,_0xaac61a){return request(_0x56e4('0x38'),{'body':{'type':_0x2ace6f,'uniqueid':_0xaac61a},'options':{'where':_0x3ecb00}});};exports[_0x56e4('0x39')]=function(_0x4b92c2){return request('UnpauseUser',{'body':{},'options':{'where':_0x4b92c2}});};exports[_0x56e4('0x3a')]=function(_0x2ba4f0){return request('LogoutUser',{'body':{},'options':{'where':_0x2ba4f0}});}; \ No newline at end of file +var _0xa131=['CreateCmContact','getPauseById','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','moment','lodash','util','client','http','request','then','error','message','result','getSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','email','getSquareProjectById','name','getVoiceQueueById','getSquareOdbcById','ShowSquareOdbc','dsn','getTrunkById','ShowSound','save_name','getIntervalById','Interval','Intervals','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId'];(function(_0x53d729,_0x1a2198){var _0x568f90=function(_0x48bd5b){while(--_0x48bd5b){_0x53d729['push'](_0x53d729['shift']());}};_0x568f90(++_0x1a2198);}(_0xa131,0x117));var _0x1a13=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa131[_0x4cf98e];return _0x1623ac;};'use strict';var BPromise=require('bluebird');var moment=require(_0x1a13('0x0'));var _=require(_0x1a13('0x1'));var util=require(_0x1a13('0x2'));var jayson=require('jayson/promise');var client=jayson[_0x1a13('0x3')][_0x1a13('0x4')]({'port':0x2329});function request(_0xef4257,_0x3439d4){return new BPromise(function(_0x46c5c1,_0x1e13b0){return client[_0x1a13('0x5')](_0xef4257,_0x3439d4)[_0x1a13('0x6')](function(_0x563b78){if(_0x563b78['error']){return _0x1e13b0(_0x563b78[_0x1a13('0x7')][_0x1a13('0x8')]);}else{return _0x46c5c1(_0x563b78[_0x1a13('0x9')]);}})['catch'](function(_0x574c09){return _0x1e13b0(_0x574c09);});});}exports[_0x1a13('0xa')]=function(_0x131a94){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x131a94},'attributes':[_0x1a13('0xb')]}});};exports[_0x1a13('0xc')]=function(_0x11fafd){return request(_0x1a13('0xd'),{'options':{'raw':![],'where':{'id':_0x11fafd},'include':[{'model':_0x1a13('0xe'),'as':_0x1a13('0xf')}],'attributes':['id','name',_0x1a13('0x10')]}});};exports[_0x1a13('0x11')]=function(_0x1b7b4c){return request('ShowSquareProject',{'options':{'where':{'id':_0x1b7b4c},'attributes':[_0x1a13('0x12')]}});};exports[_0x1a13('0x13')]=function(_0x18fbfc){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x18fbfc},'attributes':[_0x1a13('0x12')]}});};exports['getVariableById']=function(_0x47ab13){return request('ShowVariable',{'options':{'where':{'id':_0x47ab13},'attributes':[_0x1a13('0x12')]}});};exports[_0x1a13('0x14')]=function(_0x166847){return request(_0x1a13('0x15'),{'options':{'where':{'id':_0x166847},'attributes':[_0x1a13('0x16')]}});};exports['getUserById']=function(_0x5baaf7){return request('ShowUser',{'options':{'where':{'id':_0x5baaf7},'attributes':[_0x1a13('0x12')]}});};exports[_0x1a13('0x17')]=function(_0x3c2a6d){return request('ShowTrunk',{'options':{'where':{'id':_0x3c2a6d},'attributes':[_0x1a13('0x12')]}});};exports['getSoundById']=function(_0x4ca8db){return request(_0x1a13('0x18'),{'options':{'where':{'id':_0x4ca8db},'attributes':[_0x1a13('0x19')]}});};exports[_0x1a13('0x1a')]=function(_0x55967b){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x55967b},'include':[{'model':_0x1a13('0x1b'),'as':_0x1a13('0x1c')}]}});};exports['getSmsAccountById']=function(_0x1e3332){return request(_0x1a13('0x1d'),{'options':{'where':{'id':_0x1e3332},'attributes':['id',_0x1a13('0x12')]}});};exports['createSmsMessage']=function(_0x438f98){return request(_0x1a13('0x1e'),{'body':_0x438f98});};exports[_0x1a13('0x1f')]=function(_0x1e2972){return request(_0x1a13('0x20'),{'body':_0x1e2972});};exports['createSquareReport']=function(_0x357029){return request(_0x1a13('0x21'),{'body':_[_0x1a13('0x22')](_0x357029,{'project_name':_0x357029[_0x1a13('0x23')],'prev_project_name':_0x357029[_0x1a13('0x24')]||'','is_subproject':_0x357029[_0x1a13('0x24')]?!![]:![],'leaveAt':moment()[_0x1a13('0x25')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0x17dcb4){return request(_0x1a13('0x26'),{'body':_0x17dcb4});};exports[_0x1a13('0x27')]=function(_0x9af236){return request(_0x1a13('0x28'),{'body':_0x9af236});};exports[_0x1a13('0x29')]=function(_0x5eadb1){return request(_0x1a13('0x2a'),{'options':{'raw':![],'where':{'phone':_0x5eadb1[_0x1a13('0x2b')],'ListId':_0x5eadb1[_0x1a13('0x2c')]}}})[_0x1a13('0x6')](function(_0x2d0a41){if(_0x2d0a41){return _0x2d0a41;}return request(_0x1a13('0x2d'),{'body':_0x5eadb1});});};exports[_0x1a13('0x2e')]=function(_0x12c7dd){return request('ShowPause',{'options':{'where':{'id':_0x12c7dd},'attributes':[_0x1a13('0x12')]}});};exports[_0x1a13('0x2f')]=function(_0xedafc4,_0x25779d){return request(_0x1a13('0x30'),{'body':{'interface':_0x25779d},'options':{'where':_0xedafc4}});};exports[_0x1a13('0x31')]=function(_0x9a3ed4,_0x1acd36,_0x21665e){return request(_0x1a13('0x32'),{'body':{'type':_0x1acd36,'uniqueid':_0x21665e},'options':{'where':_0x9a3ed4}});};exports['agentUnpause']=function(_0x284891){return request(_0x1a13('0x33'),{'body':{},'options':{'where':_0x284891}});};exports[_0x1a13('0x34')]=function(_0x1f5e2d){return request(_0x1a13('0x35'),{'body':{},'options':{'where':_0x1f5e2d}});}; \ 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 bfb75ec..254c29c 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 _0x3831=['./polly','exports'];(function(_0x1fe75e,_0xa1ea15){var _0xc12009=function(_0x3f89f9){while(--_0x3f89f9){_0x1fe75e['push'](_0x1fe75e['shift']());}};_0xc12009(++_0xa1ea15);}(_0x3831,0x14c));var _0x1383=function(_0x56b5d1,_0x59be02){_0x56b5d1=_0x56b5d1-0x0;var _0x5bfe4a=_0x3831[_0x56b5d1];return _0x5bfe4a;};var polly=require(_0x1383('0x0'));var lex=require('./lex');module[_0x1383('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x7722=['exports','./polly','./lex'];(function(_0x491cbe,_0x45c8ba){var _0x59449d=function(_0x21b463){while(--_0x21b463){_0x491cbe['push'](_0x491cbe['shift']());}};_0x59449d(++_0x45c8ba);}(_0x7722,0x14e));var _0x2772=function(_0x5c8eae,_0x272f80){_0x5c8eae=_0x5c8eae-0x0;var _0x3899b5=_0x7722[_0x5c8eae];return _0x3899b5;};var polly=require(_0x2772('0x0'));var lex=require(_0x2772('0x1'));module[_0x2772('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index c48a238..b2a6288 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9348=['exports','./lib/api'];(function(_0x28de2a,_0x1960b3){var _0x351dc6=function(_0x13886b){while(--_0x13886b){_0x28de2a['push'](_0x28de2a['shift']());}};_0x351dc6(++_0x1960b3);}(_0x9348,0x10d));var _0x8934=function(_0x57cd52,_0x13b734){_0x57cd52=_0x57cd52-0x0;var _0x3ff63f=_0x9348[_0x57cd52];return _0x3ff63f;};'use strict';var lex=require(_0x8934('0x0'));module[_0x8934('0x1')]=function(_0x472223,_0x135b2c,_0x46a231,_0x4a2577,_0x34d032,_0x35da0b){return lex(_0x472223,_0x135b2c,_0x46a231,_0x4a2577,_0x34d032,_0x35da0b);}; \ No newline at end of file +var _0x5b02=['exports','./lib/api'];(function(_0x28f575,_0x4873a5){var _0x4c546d=function(_0xa87adf){while(--_0xa87adf){_0x28f575['push'](_0x28f575['shift']());}};_0x4c546d(++_0x4873a5);}(_0x5b02,0xe9));var _0x25b0=function(_0x1500f7,_0x2d0803){_0x1500f7=_0x1500f7-0x0;var _0x1d7568=_0x5b02[_0x1500f7];return _0x1d7568;};'use strict';var lex=require(_0x25b0('0x0'));module[_0x25b0('0x1')]=function(_0x428458,_0x1c3295,_0x4ef71c,_0x4cb227,_0x2b5f2d,_0x53493e){return lex(_0x428458,_0x1c3295,_0x4ef71c,_0x4cb227,_0x2b5f2d,_0x53493e);}; \ 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 2329abb..e1c878b 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(_0x15509d,_0x2d0913){var _0x9ad04e=function(_0x35c999){while(--_0x35c999){_0x15509d['push'](_0x15509d['shift']());}};_0x9ad04e(++_0x2d0913);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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(_0x5c17a5,_0x4feaa6){var _0x4baaee=function(_0x12543b){while(--_0x12543b){_0x5c17a5['push'](_0x5c17a5['shift']());}};_0x4baaee(++_0x4feaa6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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 4cde82d..c033c02 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 _0x13bd=['exports','./lib/api'];(function(_0x168f68,_0x3e0d63){var _0x1b959c=function(_0x300620){while(--_0x300620){_0x168f68['push'](_0x168f68['shift']());}};_0x1b959c(++_0x3e0d63);}(_0x13bd,0x1c9));var _0xd13b=function(_0x5bc95c,_0xfed759){_0x5bc95c=_0x5bc95c-0x0;var _0x3721fc=_0x13bd[_0x5bc95c];return _0x3721fc;};'use strict';var polly=require(_0xd13b('0x0'));module[_0xd13b('0x1')]=function(_0x48f64a,_0x3d133c,_0x543b18,_0x179fd4,_0x10b02a,_0x2d3c5c,_0xe9d0f0){return polly(_0x48f64a,_0x3d133c,_0x543b18,_0x179fd4,_0x10b02a,_0x2d3c5c,_0xe9d0f0);}; \ No newline at end of file +var _0xabc9=['./lib/api','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xabc9,0x12a));var _0x9abc=function(_0x561316,_0x198f82){_0x561316=_0x561316-0x0;var _0x38b773=_0xabc9[_0x561316];return _0x38b773;};'use strict';var polly=require(_0x9abc('0x0'));module[_0x9abc('0x1')]=function(_0x4f6709,_0x227413,_0x4f2726,_0xb5d33e,_0x3d6c3f,_0x3efe0f,_0x40f437){return polly(_0x4f6709,_0x227413,_0x4f2726,_0xb5d33e,_0x3d6c3f,_0x3efe0f,_0x40f437);}; \ 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 488b1c1..e473678 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 _0x4d8d=['exports','Polly','text','mp3','bluebird','randomstring','synthesizeSpeech','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x536dd0,_0x3fb35c){var _0x1b1372=function(_0x3e1cee){while(--_0x3e1cee){_0x536dd0['push'](_0x536dd0['shift']());}};_0x1b1372(++_0x3fb35c);}(_0x4d8d,0x86));var _0xd4d8=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4d8d[_0x2dafbe];return _0x58a45a;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xd4d8('0x0'));var rs=require(_0xd4d8('0x1'));var AWS=require('aws-sdk');function pollyResult(_0x42f572,_0x422c6b,_0x108538){return new BPromise(function(_0x50a9e5,_0x29b598){_0x42f572[_0xd4d8('0x2')](_0x422c6b,function(_0x3a6b05,_0x5f2e87){if(_0x3a6b05){_0x29b598(_0x3a6b05);}else if(_0x5f2e87){if(_0x5f2e87[_0xd4d8('0x3')]instanceof Buffer){fs[_0xd4d8('0x4')](_0x108538,_0x5f2e87[_0xd4d8('0x3')],function(_0x25f25e){if(_0x25f25e){_0x29b598(_0x25f25e);}else{_0x50a9e5();}});}else{_0x29b598(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x29b598(new Error(_0xd4d8('0x5')));}});});}module[_0xd4d8('0x6')]=function(_0x309953,_0x52df77,_0x2c1edf,_0x19ea23,_0x37c06f,_0x3ffcd7,_0x5584ae){var _0x482b7b=new AWS[(_0xd4d8('0x7'))]({'accessKeyId':_0x309953,'secretAccessKey':_0x52df77,'region':_0x2c1edf});var _0x7dfc17={'Text':_0x37c06f,'TextType':_0x3ffcd7||_0xd4d8('0x8'),'OutputFormat':_0xd4d8('0x9'),'VoiceId':_0x19ea23};return pollyResult(_0x482b7b,_0x7dfc17,_0x5584ae);}; \ No newline at end of file +var _0x2f3e=['randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','text','mp3','path'];(function(_0x162780,_0x47f2e2){var _0x1ea2dc=function(_0x123898){while(--_0x123898){_0x162780['push'](_0x162780['shift']());}};_0x1ea2dc(++_0x47f2e2);}(_0x2f3e,0x1a3));var _0xe2f3=function(_0x541ea6,_0x51cab6){_0x541ea6=_0x541ea6-0x0;var _0x3c3e84=_0x2f3e[_0x541ea6];return _0x3c3e84;};'use strict';var fs=require('fs');var path=require(_0xe2f3('0x0'));var BPromise=require('bluebird');var rs=require(_0xe2f3('0x1'));var AWS=require(_0xe2f3('0x2'));function pollyResult(_0x22d0d7,_0x114be4,_0x37d303){return new BPromise(function(_0x2391ce,_0xeaae5){_0x22d0d7[_0xe2f3('0x3')](_0x114be4,function(_0x362eb5,_0x349143){if(_0x362eb5){_0xeaae5(_0x362eb5);}else if(_0x349143){if(_0x349143[_0xe2f3('0x4')]instanceof Buffer){fs[_0xe2f3('0x5')](_0x37d303,_0x349143['AudioStream'],function(_0x74cc10){if(_0x74cc10){_0xeaae5(_0x74cc10);}else{_0x2391ce();}});}else{_0xeaae5(new Error(_0xe2f3('0x6')));}}else{_0xeaae5(new Error(_0xe2f3('0x7')));}});});}module['exports']=function(_0x37a68b,_0x129f54,_0x36604e,_0x54fa4e,_0x450768,_0x2a6493,_0x4f40c2){var _0x106dd0=new AWS['Polly']({'accessKeyId':_0x37a68b,'secretAccessKey':_0x129f54,'region':_0x36604e});var _0x1ff43f={'Text':_0x450768,'TextType':_0x2a6493||_0xe2f3('0x8'),'OutputFormat':_0xe2f3('0x9'),'VoiceId':_0x54fa4e};return pollyResult(_0x106dd0,_0x1ff43f,_0x4f40c2);}; \ 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 c97635c..c4428f6 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 _0xb25d=['exports','./lib/api'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb25d,0x191));var _0xdb25=function(_0xbd7fee,_0x207cf4){_0xbd7fee=_0xbd7fee-0x0;var _0x14ede4=_0xb25d[_0xbd7fee];return _0x14ede4;};'use strict';var asr=require(_0xdb25('0x0'));module[_0xdb25('0x1')]=function(_0x2375a8,_0x2caa96,_0x1f19be,_0x22acbb){return asr(_0x2375a8,_0x2caa96,_0x1f19be);}; \ No newline at end of file +var _0xf71c=['./lib/api'];(function(_0x2a8dc3,_0x59f6fb){var _0x34beb7=function(_0x354409){while(--_0x354409){_0x2a8dc3['push'](_0x2a8dc3['shift']());}};_0x34beb7(++_0x59f6fb);}(_0xf71c,0x1a4));var _0xcf71=function(_0x474a37,_0x43012e){_0x474a37=_0x474a37-0x0;var _0x13c63e=_0xf71c[_0x474a37];return _0x13c63e;};'use strict';var asr=require(_0xcf71('0x0'));module['exports']=function(_0x58e673,_0x489744,_0x3e5496,_0x17cda5){return asr(_0x58e673,_0x489744,_0x3e5496);}; \ 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 79cf25a..09930e5 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 _0x222f=['url','bluebird','https://speech.googleapis.com','exports','length','string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','LINEAR16','8000'];(function(_0x320b97,_0x293fda){var _0x1fe43f=function(_0xcebabc){while(--_0xcebabc){_0x320b97['push'](_0x320b97['shift']());}};_0x1fe43f(++_0x293fda);}(_0x222f,0x1a4));var _0xf222=function(_0x4e0c31,_0x208e9f){_0x4e0c31=_0x4e0c31-0x0;var _0x3fd7df=_0x222f[_0x4e0c31];return _0x3fd7df;};'use strict';var url=require(_0xf222('0x0'));var BPromise=require(_0xf222('0x1'));var fs=require('fs');var host=_0xf222('0x2');module[_0xf222('0x3')]=function(_0x4d09ec,_0x4b4237,_0x195de1){return new BPromise(function(_0x233e95,_0x307791){var _0x7b187d;if(typeof _0x4d09ec!=='string'||_0x4d09ec[_0xf222('0x4')]===0x0){return _0x307791('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x4b4237!==_0xf222('0x5')||_0x4b4237[_0xf222('0x4')]===0x0){return _0x307791('key\x20should\x20be\x20a\x20string');}if(typeof _0x195de1!==_0xf222('0x6')&&(typeof _0x195de1!==_0xf222('0x5')||_0x195de1['length']===0x0)){return _0x307791(_0xf222('0x7'));}try{_0x7b187d=fs[_0xf222('0x8')](_0x4d09ec)[_0xf222('0x9')](_0xf222('0xa'));}catch(_0x46ccfe){return _0x307791(_0x46ccfe);}return _0x233e95({'method':_0xf222('0xb'),'uri':host+'/v1/speech:recognize?key='+_0x4b4237,'body':{'config':{'encoding':_0xf222('0xc'),'sampleRateHertz':_0xf222('0xd'),'languageCode':_0x195de1},'audio':{'content':_0x7b187d}},'json':!![]});});}; \ No newline at end of file +var _0x402f=['lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','8000','url','https://speech.googleapis.com','length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string'];(function(_0x44c87c,_0x5b9e85){var _0x1b6cd4=function(_0x9e2f7d){while(--_0x9e2f7d){_0x44c87c['push'](_0x44c87c['shift']());}};_0x1b6cd4(++_0x5b9e85);}(_0x402f,0x6f));var _0xf402=function(_0x3da2ec,_0x275558){_0x3da2ec=_0x3da2ec-0x0;var _0x2de712=_0x402f[_0x3da2ec];return _0x2de712;};'use strict';var url=require(_0xf402('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0xf402('0x1');module['exports']=function(_0x588b83,_0x3ccbce,_0xe1847c){return new BPromise(function(_0x86f726,_0x4a52b8){var _0x246c5f;if(typeof _0x588b83!=='string'||_0x588b83[_0xf402('0x2')]===0x0){return _0x4a52b8(_0xf402('0x3'));}if(typeof _0x3ccbce!==_0xf402('0x4')||_0x3ccbce[_0xf402('0x2')]===0x0){return _0x4a52b8(_0xf402('0x5'));}if(typeof _0xe1847c!=='undefined'&&(typeof _0xe1847c!=='string'||_0xe1847c[_0xf402('0x2')]===0x0)){return _0x4a52b8(_0xf402('0x6'));}try{_0x246c5f=fs[_0xf402('0x7')](_0x588b83)[_0xf402('0x8')](_0xf402('0x9'));}catch(_0x298e44){return _0x4a52b8(_0x298e44);}return _0x86f726({'method':_0xf402('0xa'),'uri':host+_0xf402('0xb')+_0x3ccbce,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xf402('0xc'),'languageCode':_0xe1847c},'audio':{'content':_0x246c5f}},'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 133cabb..4940b05 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 _0xeddd=['./asr'];(function(_0x690d52,_0x5755fb){var _0x3e6435=function(_0x972ac9){while(--_0x972ac9){_0x690d52['push'](_0x690d52['shift']());}};_0x3e6435(++_0x5755fb);}(_0xeddd,0x167));var _0xdedd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xeddd[_0x2641f9];return _0x585741;};var asr=require(_0xdedd('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x0595=['exports'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x0595,0x1e5));var _0x5059=function(_0x480bb9,_0x5ac765){_0x480bb9=_0x480bb9-0x0;var _0x345f1d=_0x0595[_0x480bb9];return _0x345f1d;};var asr=require('./asr');module[_0x5059('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 374bf42..bcd302c 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 _0xc16c=['\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish','close','unlink','download\x20error','pipe','request\x20to\x20','end','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','then','777','split','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','text:synthesize','POST','.mp3','from','audioContent','writeFile','chmodSync','googleCloudTTS\x20path','googleTTS','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','generic','slice','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','writeFileSync','info','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','name','message','googleDialogflow','textRequest','source','result','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','displayName','languageCode','queryText','responseId','tildeASR','Tilde\x20ASR\x20transcription','awsPolly','polly','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','Data','audiofile','dirName','apiai-promise','dialogflow','http','https','md5','path','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','error'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xc16c,0x108));var _0xcc16=function(_0x2ba4e3,_0x97c0cd){_0x2ba4e3=_0x2ba4e3-0x0;var _0x4e3b27=_0xc16c[_0x2ba4e3];return _0x4e3b27;};'use strict';var apiai=require(_0xcc16('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0xcc16('0x1'));var fs=require('fs');var http=require(_0xcc16('0x2'));var https=require(_0xcc16('0x3'));var md5=require(_0xcc16('0x4'));var path=require(_0xcc16('0x5'));var querystring=require('querystring');var rp=require(_0xcc16('0x6'));var rs=require(_0xcc16('0x7'));var sox=require(_0xcc16('0x8'));var tts=require(_0xcc16('0x9'));var urlParse=require(_0xcc16('0xa'))[_0xcc16('0xb')];var util=require(_0xcc16('0xc'));var aws=require(_0xcc16('0xd'));var google=require(_0xcc16('0xe'));var sestek=require(_0xcc16('0xf'));var tilde=require(_0xcc16('0x10'));var logger=require(_0xcc16('0x11'))(_0xcc16('0x12'));var ISPEECH_API=_0xcc16('0x13');function downloadFile(_0x26a9a6,_0x30237c){return new BPromise(function(_0x336b1f,_0x3c29d9){var _0x4f3b34=urlParse(_0x26a9a6);var _0x181ec7=_0x4f3b34[_0xcc16('0x14')]===_0xcc16('0x15')?https:http;var _0x4e2ae3={'host':_0x4f3b34[_0xcc16('0x16')],'path':_0x4f3b34[_0xcc16('0x5')],'headers':{'user-agent':_0xcc16('0x17')}};_0x181ec7[_0xcc16('0x18')](_0x4e2ae3,function(_0x583a50){if(_0x583a50['statusCode']!==0xc8){logger[_0xcc16('0x19')]('request\x20to\x20'+_0x26a9a6+_0xcc16('0x1a')+_0x583a50[_0xcc16('0x1b')]+'\x20('+_0x583a50[_0xcc16('0x1c')]+')');_0x3c29d9(new Error('request\x20to\x20'+_0x26a9a6+_0xcc16('0x1a')+_0x583a50[_0xcc16('0x1b')]+'\x20('+_0x583a50[_0xcc16('0x1c')]+')'));return;}var _0x1c7856=fs[_0xcc16('0x1d')](_0x30237c);_0x1c7856['on'](_0xcc16('0x1e'),function(){logger['info']('finish\x20download\x20file');_0x1c7856[_0xcc16('0x1f')](_0x336b1f);});_0x1c7856['on'](_0xcc16('0x19'),function(_0x128077){fs[_0xcc16('0x20')](_0x30237c);logger[_0xcc16('0x19')](_0xcc16('0x21'),_0x128077);_0x3c29d9(_0x128077);});_0x583a50[_0xcc16('0x22')](_0x1c7856);})['on'](_0xcc16('0x19'),function(_0x47d06c){logger[_0xcc16('0x19')](_0x47d06c);_0x3c29d9(_0x47d06c);})['end']();});}function uploadFile(_0xfb29fe){return new BPromise(function(_0x599bf9,_0x40da3f){var _0x15a1fc=urlParse(_0xfb29fe);var _0x232424=_0x15a1fc[_0xcc16('0x14')]===_0xcc16('0x15')?https:http;var _0xfd55b7={'host':_0x15a1fc[_0xcc16('0x16')],'path':_0x15a1fc['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x232424[_0xcc16('0x18')](_0xfd55b7,function(_0x5053b4){if(_0x5053b4[_0xcc16('0x1b')]!==0xc8){_0x40da3f(new Error(_0xcc16('0x23')+_0xfb29fe+_0xcc16('0x1a')+_0x5053b4['statusCode']+'\x20('+_0x5053b4['statusMessage']+')'));return;}var _0x4c741b='';_0x5053b4['on']('data',function(_0x309614){_0x4c741b+=_0x309614;});_0x5053b4['on'](_0xcc16('0x24'),function(){_0x599bf9(_0x4c741b);});})['on'](_0xcc16('0x19'),function(_0x534925){_0x40da3f(_0x534925);})[_0xcc16('0x24')]();});}function convertFile(_0x38437a,_0x168f0e){return new BPromise(function(_0x4f4db1,_0x58cb06){var _0x274d80=sox[_0xcc16('0x25')](_0x38437a,_0x168f0e,{'sampleRate':0x1f40,'format':_0xcc16('0x26'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x274d80['on'](_0xcc16('0x19'),function(_0x7b3789){logger['error'](_0xcc16('0x27'),_0x7b3789);_0x58cb06(_0x7b3789);});_0x274d80['on'](_0xcc16('0x24'),function(){logger['info'](_0xcc16('0x28'));_0x4f4db1();});_0x274d80[_0xcc16('0x29')]();});}function base64Decode(_0x439864,_0x174fb1){var _0x30b368=path[_0xcc16('0x2a')](__dirname,_0xcc16('0x2b'),rs[_0xcc16('0x2c')](0x4)+_0xcc16('0x2d'));fs['writeFileSync'](_0x30b368,_0x439864,'base64');return convertFile(_0x30b368,_0x174fb1)[_0xcc16('0x2e')](function(){try{fs[_0xcc16('0x20')](_0x30b368);fs['chmodSync'](_0x174fb1,_0xcc16('0x2f'));}catch(_0x3e4882){logger[_0xcc16('0x19')](_0x3e4882);}return _0x174fb1[_0xcc16('0x30')]('.')[0x0];});}function base64Encode(_0x1991ca){var _0x519acc=fs['readFileSync'](_0x1991ca);return new Buffer(_0x519acc)[_0xcc16('0x31')](_0xcc16('0x32'));}exports[_0xcc16('0x33')]=function(_0x1b4e32,_0x2de6b5,_0x12f383,_0x470599,_0x3bfb7a,_0x24b21a){var _0x9e3384,_0x188838;var _0xc30478=_0xcc16('0x34');var _0x9e9a36=_0xcc16('0x35')+_0x1b4e32;var _0xf09221={};if(_0x2de6b5===_0xcc16('0x36')){_0xf09221[_0xcc16('0x37')]={'ssml':_0x12f383};}else{_0xf09221['input']={'text':_0x12f383};};_0xf09221[_0xcc16('0x38')]={'languageCode':_0x470599,'ssmlGender':_0x3bfb7a};_0xf09221[_0xcc16('0x39')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x1ed7f2={'url':_0xc30478+_0xcc16('0x3a')+_0x9e9a36,'method':_0xcc16('0x3b'),'json':!![],'body':_0xf09221};return rp(_0x1ed7f2)[_0xcc16('0x2e')](function(_0x9485ea){return new BPromise(function(_0x852270,_0x363afa){_0x9e3384=path[_0xcc16('0x2a')](__dirname,_0xcc16('0x2b'),rs[_0xcc16('0x2c')](0x4)+_0xcc16('0x3c'));var _0x2f03a4=Buffer[_0xcc16('0x3d')](_0x9485ea[_0xcc16('0x3e')],_0xcc16('0x32'));return fs[_0xcc16('0x3f')](_0x9e3384,_0x2f03a4,function(_0x42e04e){_0x363afa(_0x42e04e);},function(_0x264eac){fs['chmodSync'](_0x9e3384,_0xcc16('0x2f'));_0x852270(_0x264eac);});});})[_0xcc16('0x2e')](function(_0x327e64){_0x188838=path[_0xcc16('0x2a')](__dirname,'tmp',rs['generate'](0x4)+_0xcc16('0x2d'));return convertFile(_0x9e3384,_0x188838);})[_0xcc16('0x2e')](function(){try{fs[_0xcc16('0x20')](_0x9e3384);fs[_0xcc16('0x40')](_0x188838,_0xcc16('0x2f'));}catch(_0x33ebb1){logger[_0xcc16('0x19')](_0x33ebb1);}logger['info'](_0xcc16('0x41'),_0x188838['split']('.')[0x0]);return _0x188838['split']('.')[0x0];});};exports[_0xcc16('0x42')]=function(_0x3be2f2,_0x5b41a7){var _0x56727c='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x1951dc,_0x2f929a;var _0x2031a6;var _0x7e5992={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x56727c,'headers':{'Content-Type':_0xcc16('0x43')},'body':_0xcc16('0x44')+encodeURIComponent(JSON[_0xcc16('0x45')]([[[_0xcc16('0x46'),JSON[_0xcc16('0x45')]([_0x3be2f2,_0x5b41a7||'en',![],'null']),null,_0xcc16('0x47')]]]))};return rp(_0x7e5992)[_0xcc16('0x2e')](function(_0x554fb1){try{_0x2031a6=eval(_0x554fb1[_0xcc16('0x48')](0x5))[0x0][0x2];}catch(_0x2de0e5){throw new Error(_0xcc16('0x49')+_0x554fb1[_0xcc16('0x4a')]);}if(!_0x2031a6){if(_0x3be2f2[_0xcc16('0x4b')]>0xc8){throw new Error(_0xcc16('0x4c'));}else{throw new Error(_0xcc16('0x4d')+_0x5b41a7+'\x22\x20might\x20not\x20exist');}}try{_0x2031a6=eval(_0x2031a6)[0x0];}catch(_0x3026fa){throw new Error(_0xcc16('0x49')+res[_0xcc16('0x4a')]);}const _0x2a2db7=_0x2031a6;_0x1951dc=path[_0xcc16('0x2a')](__dirname,_0xcc16('0x2b'),rs['generate'](0x4)+_0xcc16('0x3c'));fs[_0xcc16('0x4e')](_0x1951dc,_0x2031a6,{'encoding':_0xcc16('0x32')});_0x2f929a=path['resolve'](__dirname,_0xcc16('0x2b'),rs[_0xcc16('0x2c')](0x4)+_0xcc16('0x2d'));return convertFile(_0x1951dc,_0x2f929a);})[_0xcc16('0x2e')](function(){try{fs['unlink'](_0x1951dc);fs['chmodSync'](_0x2f929a,_0xcc16('0x2f'));}catch(_0x1b8d50){logger['error'](_0x1b8d50);}logger[_0xcc16('0x4f')](_0xcc16('0x50'),_0x2f929a[_0xcc16('0x30')]('.')[0x0]);return _0x2f929a[_0xcc16('0x30')]('.')[0x0];});};exports['googleASR']=function(_0x2585e8,_0x58302a,_0x34d8d4){return google[_0xcc16('0x51')](_0x2585e8,_0x58302a,_0x34d8d4)['then'](function(_0x54decd){logger[_0xcc16('0x4f')](_0x54decd[_0xcc16('0x52')]);return rp(_0x54decd);})[_0xcc16('0x2e')](function(_0x4f81e8){var _0x990ab8='';var _0x20c1fc=0x0;try{fs[_0xcc16('0x20')](_0x2585e8);}catch(_0x201aaf){logger['error'](_0x201aaf);}if(_0x4f81e8&&_0x4f81e8[_0xcc16('0x53')]){_0x990ab8=_0x4f81e8[_0xcc16('0x53')][_0xcc16('0x54')](function(_0x5d973a){return _0x5d973a&&_0x5d973a['alternatives'][0x0]&&_0x5d973a[_0xcc16('0x55')][0x0][_0xcc16('0x56')]?_0x5d973a[_0xcc16('0x55')][0x0][_0xcc16('0x56')]:'';})[_0xcc16('0x57')]('\x0a');_0x20c1fc=_0x4f81e8[_0xcc16('0x53')][_0xcc16('0x54')](function(_0x1fb7bc){return _0x1fb7bc&&_0x1fb7bc[_0xcc16('0x55')][0x0]&&_0x1fb7bc[_0xcc16('0x55')][0x0][_0xcc16('0x58')]?_0x1fb7bc[_0xcc16('0x55')][0x0][_0xcc16('0x58')]:0x0;})[_0xcc16('0x57')]('\x0a');}logger['info'](_0xcc16('0x59'),_0x990ab8);logger[_0xcc16('0x4f')]('googleASR\x20confidence',_0x20c1fc);return{'transcript':_0x990ab8,'confidence':_0x20c1fc};})[_0xcc16('0x5a')](function(_0x304fd0){logger[_0xcc16('0x19')]('[%s]\x20%s:%s',_0x304fd0['statusCode'],_0x304fd0[_0xcc16('0x5b')],_0x304fd0[_0xcc16('0x5c')]);});};exports[_0xcc16('0x5d')]=function(_0x16108f,_0x465630,_0xfd2024,_0x3853dc){var _0x273a32=apiai(_0x465630,{'language':_0x3853dc||'en'});return _0x273a32[_0xcc16('0x5e')](_0xfd2024,{'sessionId':md5(_0x16108f)})[_0xcc16('0x2e')](function(_0x3a3567){logger[_0xcc16('0x4f')](JSON[_0xcc16('0x45')](_0x3a3567));return{'source':_0x3a3567['result'][_0xcc16('0x5f')],'resolvedQuery':_0x3a3567[_0xcc16('0x60')][_0xcc16('0x61')],'action':_0x3a3567['result'][_0xcc16('0x62')],'actionIncomplete':_0x3a3567['result'][_0xcc16('0x63')],'speech':_0x3a3567[_0xcc16('0x60')][_0xcc16('0x64')][_0xcc16('0x65')],'score':_0x3a3567[_0xcc16('0x60')][_0xcc16('0x66')],'statusCode':_0x3a3567[_0xcc16('0x67')]['code'],'endConversation':_0x3a3567[_0xcc16('0x60')]['metadata'][_0xcc16('0x68')]||![],'isFallbackIntent':_0x3a3567[_0xcc16('0x60')][_0xcc16('0x69')][_0xcc16('0x6a')]};});};exports[_0xcc16('0x6b')]=function(_0x5ea1eb,_0x576924,_0x252dfe,_0x58e910,_0x230099,_0x4e4c0d){var _0xeb8e88=_0x58e910[_0xcc16('0x6c')](/\\n/g,'\x0a');var _0x181d1f={'credentials':{'private_key':_0xeb8e88,'client_email':_0x252dfe}};var _0xbfbd2f=new dialogflow[(_0xcc16('0x6d'))](_0x181d1f);var _0x316e3d=_0xbfbd2f[_0xcc16('0x6e')](_0x576924,md5(_0x5ea1eb));var _0x29ba1f={'session':_0x316e3d,'queryInput':{'text':{'text':_0x230099,'languageCode':_0x4e4c0d}}};return _0xbfbd2f[_0xcc16('0x6f')](_0x29ba1f)[_0xcc16('0x2e')](function(_0x3afa3d){if(_0x3afa3d&&_0x3afa3d['length']){logger[_0xcc16('0x4f')](_0xcc16('0x70'),JSON[_0xcc16('0x45')](_0x3afa3d));var _0xc4a8b2=_0x3afa3d[0x0];if(_0xc4a8b2){var _0x242338={'action':_0xc4a8b2[_0xcc16('0x71')]['action'],'allRequiredParamsPresent':_0xc4a8b2[_0xcc16('0x71')][_0xcc16('0x72')],'endConversation':_0xc4a8b2['queryResult'][_0xcc16('0x73')]&&_0xc4a8b2[_0xcc16('0x71')][_0xcc16('0x73')][_0xcc16('0x74')]?_0xc4a8b2['queryResult'][_0xcc16('0x73')][_0xcc16('0x74')][_0xcc16('0x75')][_0xcc16('0x76')]:![],'fulfillmentText':_0xc4a8b2[_0xcc16('0x71')][_0xcc16('0x77')],'intentName':_0xc4a8b2[_0xcc16('0x71')]['intent']['name'],'intentDisplayName':_0xc4a8b2[_0xcc16('0x71')][_0xcc16('0x78')][_0xcc16('0x79')],'isFallbackIntent':_0xc4a8b2[_0xcc16('0x71')][_0xcc16('0x78')]['isFallback'],'languageCode':_0xc4a8b2[_0xcc16('0x71')][_0xcc16('0x7a')],'queryText':_0xc4a8b2[_0xcc16('0x71')][_0xcc16('0x7b')],'responseId':_0xc4a8b2[_0xcc16('0x7c')],'score':_0xc4a8b2['queryResult']['intentDetectionConfidence'],'speech':_0xc4a8b2['queryResult']['fulfillmentText'],'providerResponse':JSON[_0xcc16('0x45')](_0x3afa3d)};return _0x242338;}}});};exports[_0xcc16('0x7d')]=function(_0x244c6d,_0x4504ff,_0x4280d4,_0x773eb8){return tilde[_0xcc16('0x51')](_0x244c6d,_0x4504ff,_0x4280d4,_0x773eb8)[_0xcc16('0x2e')](function(_0x2e931b){try{fs[_0xcc16('0x20')](_0x244c6d);}catch(_0x4872de){logger[_0xcc16('0x19')](_0x4872de);}logger['info'](_0xcc16('0x7e'),_0x2e931b[_0xcc16('0x56')]);logger[_0xcc16('0x4f')]('Tilde\x20ASR\x20confidence',_0x2e931b['confidence']);return _0x2e931b;});};exports[_0xcc16('0x7f')]=function(_0x5c8cee,_0x9f4ea5,_0x568b4a,_0x88b7c3,_0x39f93d,_0x4a879e){var _0x2ac99f=path[_0xcc16('0x2a')](__dirname,_0xcc16('0x2b'),rs[_0xcc16('0x2c')](0x4)+_0xcc16('0x3c'));var _0xb54acb;return aws[_0xcc16('0x80')](_0x5c8cee,_0x9f4ea5,_0x568b4a,_0x88b7c3,_0x39f93d,_0x4a879e,_0x2ac99f)[_0xcc16('0x2e')](function(){_0xb54acb=path[_0xcc16('0x2a')](__dirname,_0xcc16('0x2b'),rs['generate'](0x4)+_0xcc16('0x2d'));return convertFile(_0x2ac99f,_0xb54acb);})[_0xcc16('0x2e')](function(){try{fs['unlink'](_0x2ac99f);fs[_0xcc16('0x40')](_0xb54acb,'777');}catch(_0xda45e4){logger[_0xcc16('0x19')](_0xda45e4);}return _0xb54acb[_0xcc16('0x30')]('.')[0x0];});};exports['awsLex']=function(_0x403402,_0x33adec,_0x518737,_0x22cdc2,_0x5cbc59,_0x50735b){return aws[_0xcc16('0x81')](_0x403402,_0x33adec,_0x518737,_0x22cdc2,_0x5cbc59,_0x50735b)['then'](function(_0x1d0180){logger['info'](JSON[_0xcc16('0x45')](_0x1d0180));return _0x1d0180;});};exports[_0xcc16('0x82')]=function(_0x179477,_0x338e49,_0x22fe80,_0x55bc10){var _0x280ab0=util[_0xcc16('0x83')](_0xcc16('0x84'),ISPEECH_API,_0x179477,encodeURIComponent(_0x338e49),_0x22fe80,_0x55bc10);var _0xab8d62=path['resolve'](__dirname,_0xcc16('0x2b'),rs['generate'](0x4)+'.mp3');var _0x368e9e;return downloadFile(_0x280ab0,_0xab8d62)[_0xcc16('0x2e')](function(){_0x368e9e=path[_0xcc16('0x2a')](__dirname,_0xcc16('0x2b'),rs[_0xcc16('0x2c')](0x4)+_0xcc16('0x2d'));return convertFile(_0xab8d62,_0x368e9e);})[_0xcc16('0x2e')](function(){try{fs[_0xcc16('0x20')](_0xab8d62);fs['chmodSync'](_0x368e9e,_0xcc16('0x2f'));}catch(_0xc71608){logger[_0xcc16('0x19')](_0xc71608);}return _0x368e9e['split']('.')[0x0];});};exports[_0xcc16('0x85')]=function(_0xb1ef39,_0x2cb955,_0x15f895,_0x5cc3ac){var _0x401022=util[_0xcc16('0x83')](_0xcc16('0x86'),ISPEECH_API,_0x2cb955,_0x15f895,base64Encode(_0xb1ef39),_0x5cc3ac?util['format'](_0xcc16('0x87'),encodeURIComponent(_0x5cc3ac)):_0xcc16('0x88'));return uploadFile(_0x401022)['then'](function(_0x7855d5){return querystring[_0xcc16('0xb')](_0x7855d5);});};exports[_0xcc16('0x89')]=function(_0x2e7a62,_0x2b5798){return sestek[_0xcc16('0x8a')](_0x2e7a62,_0x2b5798)[_0xcc16('0x2e')](function(_0x22718b){logger['info'](JSON[_0xcc16('0x45')](_0x22718b));var _0x480e3c={'speech':_0x22718b[_0xcc16('0x8b')],'action':_0x22718b[_0xcc16('0x8c')]?_0x22718b['channelData'][_0xcc16('0x8d')]:undefined,'actiondata':_0x22718b[_0xcc16('0x8c')]?_0x22718b[_0xcc16('0x8c')]['CustomActionData']:undefined};if(_0x22718b[_0xcc16('0x8c')]&&_0x22718b[_0xcc16('0x8c')]['AudioFromTts']){return base64Decode(_0x22718b['channelData']['AudioFromTts'][_0xcc16('0x8e')],path[_0xcc16('0x2a')](__dirname,_0xcc16('0x2b'),rs['generate'](0x4)+_0xcc16('0x2d')))[_0xcc16('0x2e')](function(_0x4b3a7f){_0x480e3c[_0xcc16('0x8f')]=_0x4b3a7f;return _0x480e3c;});}return _0x480e3c;});};exports[_0xcc16('0x90')]=function(){return __dirname;}; \ No newline at end of file +var _0xa156=['createWriteStream','finish','info','close','error','unlink','pipe','end','WHAT_EVER','get','data','wav','error\x20convert','finish\x20to\x20convert','tmp','generate','.wav','writeFileSync','chmodSync','777','split','readFileSync','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','audioConfig','MP3','POST','then','resolve','.mp3','writeFile','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','lang\x20\x22','\x22\x20might\x20not\x20exist','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','source','result','resolvedQuery','actionIncomplete','fulfillment','status','metadata','endConversation','isFallbackIntent','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','action','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','name','displayName','isFallback','languageCode','queryText','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','apiai-promise','bluebird','dialogflow','https','md5','path','request-promise','randomstring','sox','google-tts-api','url','parse','./aws','./google','./tilde','../../../config/logger','agi','protocol','https:','host','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage'];(function(_0x16aea0,_0x1ff3a9){var _0x5b2343=function(_0x42a786){while(--_0x42a786){_0x16aea0['push'](_0x16aea0['shift']());}};_0x5b2343(++_0x1ff3a9);}(_0xa156,0x1f4));var _0x6a15=function(_0x15bad1,_0x4d2f22){_0x15bad1=_0x15bad1-0x0;var _0xeaa172=_0xa156[_0x15bad1];return _0xeaa172;};'use strict';var apiai=require(_0x6a15('0x0'));var BPromise=require(_0x6a15('0x1'));var dialogflow=require(_0x6a15('0x2'));var fs=require('fs');var http=require('http');var https=require(_0x6a15('0x3'));var md5=require(_0x6a15('0x4'));var path=require(_0x6a15('0x5'));var querystring=require('querystring');var rp=require(_0x6a15('0x6'));var rs=require(_0x6a15('0x7'));var sox=require(_0x6a15('0x8'));var tts=require(_0x6a15('0x9'));var urlParse=require(_0x6a15('0xa'))[_0x6a15('0xb')];var util=require('util');var aws=require(_0x6a15('0xc'));var google=require(_0x6a15('0xd'));var sestek=require('./sestek');var tilde=require(_0x6a15('0xe'));var logger=require(_0x6a15('0xf'))(_0x6a15('0x10'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x34dbd3,_0xddc6d1){return new BPromise(function(_0x2d066e,_0x474616){var _0x341c20=urlParse(_0x34dbd3);var _0x17d075=_0x341c20[_0x6a15('0x11')]===_0x6a15('0x12')?https:http;var _0x4bc259={'host':_0x341c20[_0x6a15('0x13')],'path':_0x341c20[_0x6a15('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0x17d075['get'](_0x4bc259,function(_0x58c210){if(_0x58c210[_0x6a15('0x14')]!==0xc8){logger['error'](_0x6a15('0x15')+_0x34dbd3+_0x6a15('0x16')+_0x58c210['statusCode']+'\x20('+_0x58c210[_0x6a15('0x17')]+')');_0x474616(new Error(_0x6a15('0x15')+_0x34dbd3+_0x6a15('0x16')+_0x58c210['statusCode']+'\x20('+_0x58c210[_0x6a15('0x17')]+')'));return;}var _0x168df1=fs[_0x6a15('0x18')](_0xddc6d1);_0x168df1['on'](_0x6a15('0x19'),function(){logger[_0x6a15('0x1a')]('finish\x20download\x20file');_0x168df1[_0x6a15('0x1b')](_0x2d066e);});_0x168df1['on'](_0x6a15('0x1c'),function(_0x469b8a){fs[_0x6a15('0x1d')](_0xddc6d1);logger[_0x6a15('0x1c')]('download\x20error',_0x469b8a);_0x474616(_0x469b8a);});_0x58c210[_0x6a15('0x1e')](_0x168df1);})['on'](_0x6a15('0x1c'),function(_0x421435){logger[_0x6a15('0x1c')](_0x421435);_0x474616(_0x421435);})[_0x6a15('0x1f')]();});}function uploadFile(_0x325366){return new BPromise(function(_0x384768,_0x382c44){var _0x980060=urlParse(_0x325366);var _0x18f9e9=_0x980060['protocol']===_0x6a15('0x12')?https:http;var _0x15e797={'host':_0x980060[_0x6a15('0x13')],'path':_0x980060[_0x6a15('0x5')],'headers':{'user-agent':_0x6a15('0x20')}};_0x18f9e9[_0x6a15('0x21')](_0x15e797,function(_0x5a7cec){if(_0x5a7cec[_0x6a15('0x14')]!==0xc8){_0x382c44(new Error(_0x6a15('0x15')+_0x325366+_0x6a15('0x16')+_0x5a7cec['statusCode']+'\x20('+_0x5a7cec['statusMessage']+')'));return;}var _0x2f9547='';_0x5a7cec['on'](_0x6a15('0x22'),function(_0x522922){_0x2f9547+=_0x522922;});_0x5a7cec['on']('end',function(){_0x384768(_0x2f9547);});})['on'](_0x6a15('0x1c'),function(_0x4dbb49){_0x382c44(_0x4dbb49);})[_0x6a15('0x1f')]();});}function convertFile(_0x240530,_0x5440c2){return new BPromise(function(_0x436c1f,_0x28f62a){var _0x2c8e73=sox['transcode'](_0x240530,_0x5440c2,{'sampleRate':0x1f40,'format':_0x6a15('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2c8e73['on'](_0x6a15('0x1c'),function(_0x1122b5){logger[_0x6a15('0x1c')](_0x6a15('0x24'),_0x1122b5);_0x28f62a(_0x1122b5);});_0x2c8e73['on']('end',function(){logger[_0x6a15('0x1a')](_0x6a15('0x25'));_0x436c1f();});_0x2c8e73['start']();});}function base64Decode(_0x2a3c08,_0x163d80){var _0xd6d48=path['resolve'](__dirname,_0x6a15('0x26'),rs[_0x6a15('0x27')](0x4)+_0x6a15('0x28'));fs[_0x6a15('0x29')](_0xd6d48,_0x2a3c08,'base64');return convertFile(_0xd6d48,_0x163d80)['then'](function(){try{fs[_0x6a15('0x1d')](_0xd6d48);fs[_0x6a15('0x2a')](_0x163d80,_0x6a15('0x2b'));}catch(_0x610c60){logger[_0x6a15('0x1c')](_0x610c60);}return _0x163d80[_0x6a15('0x2c')]('.')[0x0];});}function base64Encode(_0x1c3455){var _0x41beb7=fs[_0x6a15('0x2d')](_0x1c3455);return new Buffer(_0x41beb7)[_0x6a15('0x2e')](_0x6a15('0x2f'));}exports[_0x6a15('0x30')]=function(_0x5a6d6a,_0x262930,_0x345c9b,_0x28aac1,_0x1baf8b,_0x241c1e){var _0x268e64,_0x15f8a5;var _0x1c3bfa=_0x6a15('0x31');var _0x5bc2c8='?key='+_0x5a6d6a;var _0x30ca55={};if(_0x262930===_0x6a15('0x32')){_0x30ca55[_0x6a15('0x33')]={'ssml':_0x345c9b};}else{_0x30ca55[_0x6a15('0x33')]={'text':_0x345c9b};};_0x30ca55[_0x6a15('0x34')]={'languageCode':_0x28aac1,'ssmlGender':_0x1baf8b};_0x30ca55[_0x6a15('0x35')]={'audioEncoding':_0x6a15('0x36'),'sampleRateHertz':0x1f40};var _0x3eaae5={'url':_0x1c3bfa+'text:synthesize'+_0x5bc2c8,'method':_0x6a15('0x37'),'json':!![],'body':_0x30ca55};return rp(_0x3eaae5)[_0x6a15('0x38')](function(_0x54f34b){return new BPromise(function(_0x59925d,_0x56fbf5){_0x268e64=path[_0x6a15('0x39')](__dirname,_0x6a15('0x26'),rs[_0x6a15('0x27')](0x4)+_0x6a15('0x3a'));var _0x104c7c=Buffer['from'](_0x54f34b['audioContent'],_0x6a15('0x2f'));return fs[_0x6a15('0x3b')](_0x268e64,_0x104c7c,function(_0x1d60e3){_0x56fbf5(_0x1d60e3);},function(_0x1ceafb){fs[_0x6a15('0x2a')](_0x268e64,'777');_0x59925d(_0x1ceafb);});});})['then'](function(_0x5bbc76){_0x15f8a5=path[_0x6a15('0x39')](__dirname,_0x6a15('0x26'),rs[_0x6a15('0x27')](0x4)+_0x6a15('0x28'));return convertFile(_0x268e64,_0x15f8a5);})['then'](function(){try{fs[_0x6a15('0x1d')](_0x268e64);fs[_0x6a15('0x2a')](_0x15f8a5,'777');}catch(_0x474467){logger[_0x6a15('0x1c')](_0x474467);}logger[_0x6a15('0x1a')]('googleCloudTTS\x20path',_0x15f8a5[_0x6a15('0x2c')]('.')[0x0]);return _0x15f8a5[_0x6a15('0x2c')]('.')[0x0];});};exports['googleTTS']=function(_0x1c8ad5,_0x47bbfb){var _0x32c476=_0x6a15('0x3c');var _0x220e76,_0x2ce08b;var _0xf4a8d8;var _0x2b359e={'encoding':'utf8','method':_0x6a15('0x37'),'timeout':0x2710,'url':_0x32c476,'headers':{'Content-Type':_0x6a15('0x3d')},'body':_0x6a15('0x3e')+encodeURIComponent(JSON[_0x6a15('0x3f')]([[[_0x6a15('0x40'),JSON['stringify']([_0x1c8ad5,_0x47bbfb||'en',![],_0x6a15('0x41')]),null,_0x6a15('0x42')]]]))};return rp(_0x2b359e)[_0x6a15('0x38')](function(_0x24d2dd){try{_0xf4a8d8=eval(_0x24d2dd[_0x6a15('0x43')](0x5))[0x0][0x2];}catch(_0x47b774){throw new Error(_0x6a15('0x44')+_0x24d2dd[_0x6a15('0x22')]);}if(!_0xf4a8d8){if(_0x1c8ad5['length']>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x6a15('0x45')+_0x47bbfb+_0x6a15('0x46'));}}try{_0xf4a8d8=eval(_0xf4a8d8)[0x0];}catch(_0xe1d65b){throw new Error(_0x6a15('0x44')+res[_0x6a15('0x22')]);}const _0x30faab=_0xf4a8d8;_0x220e76=path[_0x6a15('0x39')](__dirname,'tmp',rs[_0x6a15('0x27')](0x4)+_0x6a15('0x3a'));fs[_0x6a15('0x29')](_0x220e76,_0xf4a8d8,{'encoding':_0x6a15('0x2f')});_0x2ce08b=path[_0x6a15('0x39')](__dirname,_0x6a15('0x26'),rs[_0x6a15('0x27')](0x4)+'.wav');return convertFile(_0x220e76,_0x2ce08b);})['then'](function(){try{fs[_0x6a15('0x1d')](_0x220e76);fs[_0x6a15('0x2a')](_0x2ce08b,_0x6a15('0x2b'));}catch(_0x1afe65){logger[_0x6a15('0x1c')](_0x1afe65);}logger['info']('goggleTTS\x20path',_0x2ce08b[_0x6a15('0x2c')]('.')[0x0]);return _0x2ce08b[_0x6a15('0x2c')]('.')[0x0];});};exports[_0x6a15('0x47')]=function(_0x364df6,_0x192f54,_0x2fa78c){return google[_0x6a15('0x48')](_0x364df6,_0x192f54,_0x2fa78c)['then'](function(_0x40418e){logger[_0x6a15('0x1a')](_0x40418e[_0x6a15('0x49')]);return rp(_0x40418e);})[_0x6a15('0x38')](function(_0x40b2f0){var _0xff350a='';var _0xfa8349=0x0;try{fs[_0x6a15('0x1d')](_0x364df6);}catch(_0x19b0cd){logger[_0x6a15('0x1c')](_0x19b0cd);}if(_0x40b2f0&&_0x40b2f0[_0x6a15('0x4a')]){_0xff350a=_0x40b2f0['results'][_0x6a15('0x4b')](function(_0x59877b){return _0x59877b&&_0x59877b[_0x6a15('0x4c')][0x0]&&_0x59877b['alternatives'][0x0]['transcript']?_0x59877b[_0x6a15('0x4c')][0x0][_0x6a15('0x4d')]:'';})[_0x6a15('0x4e')]('\x0a');_0xfa8349=_0x40b2f0['results'][_0x6a15('0x4b')](function(_0x1f0e6a){return _0x1f0e6a&&_0x1f0e6a[_0x6a15('0x4c')][0x0]&&_0x1f0e6a['alternatives'][0x0][_0x6a15('0x4f')]?_0x1f0e6a[_0x6a15('0x4c')][0x0][_0x6a15('0x4f')]:0x0;})[_0x6a15('0x4e')]('\x0a');}logger['info'](_0x6a15('0x50'),_0xff350a);logger[_0x6a15('0x1a')](_0x6a15('0x51'),_0xfa8349);return{'transcript':_0xff350a,'confidence':_0xfa8349};})[_0x6a15('0x52')](function(_0x7ab591){logger['error'](_0x6a15('0x53'),_0x7ab591[_0x6a15('0x14')],_0x7ab591['name'],_0x7ab591[_0x6a15('0x54')]);});};exports[_0x6a15('0x55')]=function(_0x51ef03,_0x2796b5,_0x429079,_0x14ec97){var _0x139620=apiai(_0x2796b5,{'language':_0x14ec97||'en'});return _0x139620[_0x6a15('0x56')](_0x429079,{'sessionId':md5(_0x51ef03)})['then'](function(_0x385fa9){logger[_0x6a15('0x1a')](JSON['stringify'](_0x385fa9));return{'source':_0x385fa9['result'][_0x6a15('0x57')],'resolvedQuery':_0x385fa9[_0x6a15('0x58')][_0x6a15('0x59')],'action':_0x385fa9[_0x6a15('0x58')]['action'],'actionIncomplete':_0x385fa9['result'][_0x6a15('0x5a')],'speech':_0x385fa9[_0x6a15('0x58')][_0x6a15('0x5b')]['speech'],'score':_0x385fa9['result']['score'],'statusCode':_0x385fa9[_0x6a15('0x5c')]['code'],'endConversation':_0x385fa9[_0x6a15('0x58')][_0x6a15('0x5d')][_0x6a15('0x5e')]||![],'isFallbackIntent':_0x385fa9['result'][_0x6a15('0x5d')][_0x6a15('0x5f')]};});};exports['googleDialogflowV2']=function(_0x3f94dc,_0x3e3bc4,_0x49f750,_0x2b005a,_0x3ffa33,_0x315df4){var _0x461686=_0x2b005a[_0x6a15('0x60')](/\\n/g,'\x0a');var _0x4260d5={'credentials':{'private_key':_0x461686,'client_email':_0x49f750}};var _0xe7e8f4=new dialogflow[(_0x6a15('0x61'))](_0x4260d5);var _0x24a9a6=_0xe7e8f4[_0x6a15('0x62')](_0x3e3bc4,md5(_0x3f94dc));var _0x401175={'session':_0x24a9a6,'queryInput':{'text':{'text':_0x3ffa33,'languageCode':_0x315df4}}};return _0xe7e8f4[_0x6a15('0x63')](_0x401175)[_0x6a15('0x38')](function(_0x58eb6f){if(_0x58eb6f&&_0x58eb6f['length']){logger['info'](_0x6a15('0x64'),JSON[_0x6a15('0x3f')](_0x58eb6f));var _0x254fb9=_0x58eb6f[0x0];if(_0x254fb9){var _0x5eb0da={'action':_0x254fb9['queryResult'][_0x6a15('0x65')],'allRequiredParamsPresent':_0x254fb9[_0x6a15('0x66')][_0x6a15('0x67')],'endConversation':_0x254fb9[_0x6a15('0x66')][_0x6a15('0x68')]&&_0x254fb9[_0x6a15('0x66')]['diagnosticInfo'][_0x6a15('0x69')]?_0x254fb9[_0x6a15('0x66')][_0x6a15('0x68')][_0x6a15('0x69')][_0x6a15('0x6a')]['boolValue']:![],'fulfillmentText':_0x254fb9[_0x6a15('0x66')][_0x6a15('0x6b')],'intentName':_0x254fb9[_0x6a15('0x66')][_0x6a15('0x6c')][_0x6a15('0x6d')],'intentDisplayName':_0x254fb9[_0x6a15('0x66')]['intent'][_0x6a15('0x6e')],'isFallbackIntent':_0x254fb9[_0x6a15('0x66')][_0x6a15('0x6c')][_0x6a15('0x6f')],'languageCode':_0x254fb9[_0x6a15('0x66')][_0x6a15('0x70')],'queryText':_0x254fb9[_0x6a15('0x66')][_0x6a15('0x71')],'responseId':_0x254fb9['responseId'],'score':_0x254fb9[_0x6a15('0x66')]['intentDetectionConfidence'],'speech':_0x254fb9[_0x6a15('0x66')][_0x6a15('0x6b')],'providerResponse':JSON[_0x6a15('0x3f')](_0x58eb6f)};return _0x5eb0da;}}});};exports[_0x6a15('0x72')]=function(_0x43ed12,_0x1e66c5,_0x55ccf4,_0x4250ae){return tilde[_0x6a15('0x48')](_0x43ed12,_0x1e66c5,_0x55ccf4,_0x4250ae)[_0x6a15('0x38')](function(_0x1cf4ea){try{fs['unlink'](_0x43ed12);}catch(_0x3af99e){logger[_0x6a15('0x1c')](_0x3af99e);}logger[_0x6a15('0x1a')](_0x6a15('0x73'),_0x1cf4ea[_0x6a15('0x4d')]);logger['info'](_0x6a15('0x74'),_0x1cf4ea['confidence']);return _0x1cf4ea;});};exports[_0x6a15('0x75')]=function(_0x144c39,_0x24b44e,_0xe9ee04,_0x29adc6,_0x38ce3c,_0xb6e5e7){var _0x1e66a7=path[_0x6a15('0x39')](__dirname,'tmp',rs[_0x6a15('0x27')](0x4)+_0x6a15('0x3a'));var _0x5192b7;return aws[_0x6a15('0x76')](_0x144c39,_0x24b44e,_0xe9ee04,_0x29adc6,_0x38ce3c,_0xb6e5e7,_0x1e66a7)['then'](function(){_0x5192b7=path[_0x6a15('0x39')](__dirname,_0x6a15('0x26'),rs[_0x6a15('0x27')](0x4)+_0x6a15('0x28'));return convertFile(_0x1e66a7,_0x5192b7);})[_0x6a15('0x38')](function(){try{fs[_0x6a15('0x1d')](_0x1e66a7);fs[_0x6a15('0x2a')](_0x5192b7,_0x6a15('0x2b'));}catch(_0x1d071e){logger[_0x6a15('0x1c')](_0x1d071e);}return _0x5192b7[_0x6a15('0x2c')]('.')[0x0];});};exports[_0x6a15('0x77')]=function(_0x124f4c,_0x178cc7,_0x272666,_0x2591f3,_0x3aa39b,_0x3ed806){return aws[_0x6a15('0x78')](_0x124f4c,_0x178cc7,_0x272666,_0x2591f3,_0x3aa39b,_0x3ed806)[_0x6a15('0x38')](function(_0x3d9881){logger[_0x6a15('0x1a')](JSON[_0x6a15('0x3f')](_0x3d9881));return _0x3d9881;});};exports['ispeechTTS']=function(_0x5c65d5,_0x8fe7f8,_0xa3245f,_0x53a51f){var _0x9d8683=util['format'](_0x6a15('0x79'),ISPEECH_API,_0x5c65d5,encodeURIComponent(_0x8fe7f8),_0xa3245f,_0x53a51f);var _0x3510c4=path['resolve'](__dirname,_0x6a15('0x26'),rs[_0x6a15('0x27')](0x4)+_0x6a15('0x3a'));var _0x105af2;return downloadFile(_0x9d8683,_0x3510c4)['then'](function(){_0x105af2=path['resolve'](__dirname,'tmp',rs[_0x6a15('0x27')](0x4)+_0x6a15('0x28'));return convertFile(_0x3510c4,_0x105af2);})['then'](function(){try{fs[_0x6a15('0x1d')](_0x3510c4);fs['chmodSync'](_0x105af2,_0x6a15('0x2b'));}catch(_0x5a7169){logger['error'](_0x5a7169);}return _0x105af2[_0x6a15('0x2c')]('.')[0x0];});};exports['ispeechASR']=function(_0x3d0f78,_0x405b3e,_0x2ff3a9,_0x553b79){var _0x52b049=util['format'](_0x6a15('0x7a'),ISPEECH_API,_0x405b3e,_0x2ff3a9,base64Encode(_0x3d0f78),_0x553b79?util['format'](_0x6a15('0x7b'),encodeURIComponent(_0x553b79)):_0x6a15('0x7c'));return uploadFile(_0x52b049)['then'](function(_0x556e37){return querystring[_0x6a15('0xb')](_0x556e37);});};exports['sestekNDA']=function(_0x3addf2,_0xed1fe2){return sestek[_0x6a15('0x7d')](_0x3addf2,_0xed1fe2)[_0x6a15('0x38')](function(_0xa6ede3){logger[_0x6a15('0x1a')](JSON[_0x6a15('0x3f')](_0xa6ede3));var _0x17c53b={'speech':_0xa6ede3[_0x6a15('0x7e')],'action':_0xa6ede3['channelData']?_0xa6ede3[_0x6a15('0x7f')][_0x6a15('0x80')]:undefined,'actiondata':_0xa6ede3[_0x6a15('0x7f')]?_0xa6ede3['channelData'][_0x6a15('0x81')]:undefined};if(_0xa6ede3[_0x6a15('0x7f')]&&_0xa6ede3['channelData'][_0x6a15('0x82')]){return base64Decode(_0xa6ede3['channelData'][_0x6a15('0x82')]['Data'],path[_0x6a15('0x39')](__dirname,_0x6a15('0x26'),rs[_0x6a15('0x27')](0x4)+_0x6a15('0x28')))[_0x6a15('0x38')](function(_0x2696c7){_0x17c53b['audiofile']=_0x2696c7;return _0x17c53b;});}return _0x17c53b;});};exports['dirName']=function(){return __dirname;}; \ 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 31651b1..33564e3 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 _0x24a6=['dnid','extension','Bearer\x20','access_token','ProjectName','ndagenerate_audio','body','channelData','AudioOutputSettings','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','calleridname'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x24a6,0x14f));var _0x624a=function(_0x4a24f3,_0x115720){_0x4a24f3=_0x4a24f3-0x0;var _0x35da16=_0x24a6[_0x4a24f3];return _0x35da16;};'use strict';var rp=require(_0x624a('0x0'));var url=require('url');var logger=require(_0x624a('0x1'))(_0x624a('0x2'));module[_0x624a('0x3')]=function(_0x346672,_0x3074cb){var _0x45aae2={'method':_0x624a('0x4'),'uri':url[_0x624a('0x5')](_0x3074cb[_0x624a('0x6')],_0x624a('0x7')),'form':{'grant_type':_0x624a('0x8'),'username':_0x3074cb[_0x624a('0x9')],'password':_0x3074cb[_0x624a('0x8')]},'json':!![]};return rp(_0x45aae2)[_0x624a('0xa')](function(_0x58243){var _0x40cb85={'method':_0x624a('0x4'),'uri':url[_0x624a('0x5')](_0x3074cb[_0x624a('0xb')],_0x624a('0xc')),'body':{'type':_0x3074cb[_0x624a('0xd')]||_0x624a('0xe'),'channelId':_0x624a('0xf'),'conversation':{'id':_0x346672['uniqueid']},'from':{'id':_0x346672['callerid'],'name':_0x346672[_0x624a('0x10')]},'recipient':{'id':_0x346672[_0x624a('0x11')],'name':_0x346672[_0x624a('0x12')]},'text':_0x3074cb['text'],'channelData':{}},'headers':{'Authorization':_0x624a('0x13')+_0x58243[_0x624a('0x14')]},'json':!![]};if(_0x3074cb['project']){_0x40cb85['body']['channelData'][_0x624a('0x15')]=_0x3074cb['project'];}if(_0x3074cb[_0x624a('0x16')]=='1'){_0x40cb85[_0x624a('0x17')][_0x624a('0x18')][_0x624a('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x3074cb[_0x624a('0x1a')]){_0x40cb85['body'][_0x624a('0x18')][_0x624a('0x1b')]=_0x3074cb['custom_action'];if(_0x3074cb[_0x624a('0x1c')]){_0x40cb85[_0x624a('0x17')][_0x624a('0x18')][_0x624a('0x1d')]=_0x3074cb[_0x624a('0x1c')];}}logger[_0x624a('0x1e')](JSON[_0x624a('0x1f')](_0x40cb85));return rp(_0x40cb85);});}; \ No newline at end of file +var _0x579c=['ndaactivity_type','message','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','AudioOutputSettings','custom_action','CustomAction','CustomActionData','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x579c,0xda));var _0xc579=function(_0x12704a,_0x51c538){_0x12704a=_0x12704a-0x0;var _0x46e6ee=_0x579c[_0x12704a];return _0x46e6ee;};'use strict';var rp=require(_0xc579('0x0'));var url=require(_0xc579('0x1'));var logger=require(_0xc579('0x2'))(_0xc579('0x3'));module[_0xc579('0x4')]=function(_0x586948,_0x1e2808){var _0x5399d7={'method':_0xc579('0x5'),'uri':url[_0xc579('0x6')](_0x1e2808[_0xc579('0x7')],_0xc579('0x8')),'form':{'grant_type':_0xc579('0x9'),'username':_0x1e2808[_0xc579('0xa')],'password':_0x1e2808[_0xc579('0x9')]},'json':!![]};return rp(_0x5399d7)['then'](function(_0x1c6d9c){var _0x293c4a={'method':_0xc579('0x5'),'uri':url[_0xc579('0x6')](_0x1e2808[_0xc579('0xb')],_0xc579('0xc')),'body':{'type':_0x1e2808[_0xc579('0xd')]||_0xc579('0xe'),'channelId':'Nda','conversation':{'id':_0x586948[_0xc579('0xf')]},'from':{'id':_0x586948[_0xc579('0x10')],'name':_0x586948[_0xc579('0x11')]},'recipient':{'id':_0x586948[_0xc579('0x12')],'name':_0x586948[_0xc579('0x13')]},'text':_0x1e2808[_0xc579('0x14')],'channelData':{}},'headers':{'Authorization':_0xc579('0x15')+_0x1c6d9c[_0xc579('0x16')]},'json':!![]};if(_0x1e2808[_0xc579('0x17')]){_0x293c4a[_0xc579('0x18')][_0xc579('0x19')]['ProjectName']=_0x1e2808[_0xc579('0x17')];}if(_0x1e2808['ndagenerate_audio']=='1'){_0x293c4a[_0xc579('0x18')]['channelData'][_0xc579('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x1e2808[_0xc579('0x1b')]){_0x293c4a['body'][_0xc579('0x19')][_0xc579('0x1c')]=_0x1e2808['custom_action'];if(_0x1e2808['custom_action_data']){_0x293c4a[_0xc579('0x18')][_0xc579('0x19')][_0xc579('0x1d')]=_0x1e2808[_0xc579('0x1e')];}}logger[_0xc579('0x1f')](JSON[_0xc579('0x20')](_0x293c4a));return rp(_0x293c4a);});}; \ 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 ea77c6a..da24304 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 _0x8946=['exports','./lib/api'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x8946,0x193));var _0x6894=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x8946[_0x5c9307];return _0x373e29;};'use strict';var asr=require(_0x6894('0x0'));module[_0x6894('0x1')]=function(_0x21a979,_0x1b6035,_0x5c3641,_0x559301){return asr(_0x21a979,_0x1b6035,_0x5c3641,_0x559301);}; \ No newline at end of file +var _0x8cf3=['./lib/api','exports'];(function(_0x4f481e,_0x4a3e94){var _0x4f1685=function(_0x2b9916){while(--_0x2b9916){_0x4f481e['push'](_0x4f481e['shift']());}};_0x4f1685(++_0x4a3e94);}(_0x8cf3,0x10a));var _0x38cf=function(_0x27d8af,_0x423c80){_0x27d8af=_0x27d8af-0x0;var _0xf4c794=_0x8cf3[_0x27d8af];return _0xf4c794;};'use strict';var asr=require(_0x38cf('0x0'));module[_0x38cf('0x1')]=function(_0x2d9e7c,_0x318565,_0x22f7c8,_0x3807eb){return asr(_0x2d9e7c,_0x318565,_0x22f7c8,_0x3807eb);}; \ 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 bbbf7df..14c6905 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 _0xb826=['agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','info','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','result','hypotheses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','open','bluebird','lodash','moment','crypto','../../../../../../config/logger'];(function(_0x333714,_0x3370ac){var _0x4c211e=function(_0x34219b){while(--_0x34219b){_0x333714['push'](_0x333714['shift']());}};_0x4c211e(++_0x3370ac);}(_0xb826,0x1e5));var _0x6b82=function(_0x3ca5ee,_0x3c7435){_0x3ca5ee=_0x3ca5ee-0x0;var _0x270b80=_0xb826[_0x3ca5ee];return _0x270b80;};'use strict';var BPromise=require(_0x6b82('0x0'));var _=require(_0x6b82('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x6b82('0x2'));var crypto=require(_0x6b82('0x3'));var logger=require(_0x6b82('0x4'))(_0x6b82('0x5'));module[_0x6b82('0x6')]=function(_0x34db63,_0x2dba77,_0x129443,_0x4ac296){return new BPromise(function(_0x3f75ff,_0x45c6cf){logger['info'](_0x6b82('0x7'),_0x4ac296||_0x6b82('0x8'));var _0xeb5e43=new WebSocket(_0x4ac296||_0x6b82('0x8'),{'perMessageDeflate':![]});var _0x557311='';var _0x13bda5='0';var _0x28eb5d='1';var _0x284824=_0x6b82('0x9');function _0x164e3f(_0x1dce53){var _0x1ebda0=crypto['createHash']('sha1');_0x1ebda0['update'](_0x1dce53);return _0x1ebda0['digest']('hex');}function _0x560818(){try{logger[_0x6b82('0xa')](_0x6b82('0xb'));var _0x3fb2fc=moment()[_0x6b82('0xc')]();var _0x17728b=_0x164e3f(_0x3fb2fc+_0x2dba77+_0x129443);_0xeb5e43[_0x6b82('0xd')](JSON[_0x6b82('0xe')]({'appID':_0x2dba77,'timestamp':_0x3fb2fc,'appKey':_0x17728b}));var _0x2b4395=fs[_0x6b82('0xf')](_0x34db63);_0x2b4395['on'](_0x6b82('0x10'),function(_0x2a4672){_0xeb5e43[_0x6b82('0xd')](_0x2a4672);});_0x2b4395['on'](_0x6b82('0x11'),function(){_0xeb5e43[_0x6b82('0xd')](_0x6b82('0x12'));});}catch(_0x12905a){logger[_0x6b82('0x13')](_0x6b82('0x14'),JSON['stringify'](_0x12905a));_0xeb5e43[_0x6b82('0x15')]();}}function _0x3460dd(_0x4e53ef){try{if(_0x4e53ef){var _0xeea80=JSON['parse'](_0x4e53ef);switch(_0xeea80['status']){case 0x0:if(_0xeea80[_0x6b82('0x16')]){if(_0xeea80[_0x6b82('0x16')]['final']){logger[_0x6b82('0xa')]('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0xeea80[_0x6b82('0x16')][_0x6b82('0x17')]));_0x557311=_0xeea80[_0x6b82('0x16')][_0x6b82('0x17')][0x0][_0x6b82('0x18')];_0x13bda5=_0xeea80[_0x6b82('0x16')][_0x6b82('0x17')][0x0][_0x6b82('0x19')];_0x28eb5d='0';_0x284824='Success.';_0xeb5e43[_0x6b82('0x15')]();}}break;case 0x1:logger[_0x6b82('0xa')](_0x6b82('0x9'));_0x28eb5d='1';_0x284824=_0x6b82('0x9');break;case 0x2:logger[_0x6b82('0xa')](_0x6b82('0x1a'));_0x28eb5d='2';_0x284824='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x6b82('0xa')](_0x6b82('0x1b'));_0x28eb5d='9';_0x284824=_0x6b82('0x1b');break;case 0xa:logger['info'](_0x6b82('0x1c'));_0x28eb5d='10';_0x284824=_0x6b82('0x1c');break;case 0xb:logger[_0x6b82('0xa')](_0x6b82('0x1d'));_0x28eb5d='11';_0x284824=_0x6b82('0x1d');}}}catch(_0x301d75){logger['error'](_0x6b82('0x1e'),JSON[_0x6b82('0xe')](_0x301d75));_0xeb5e43[_0x6b82('0x15')]();}}function _0x214f55(){logger[_0x6b82('0xa')](_0x6b82('0x1f'));_0x3f75ff({'transcript':_0x557311,'confidence':_0x13bda5,'status':_0x28eb5d,'status_message':_0x284824});}function _0x290846(_0xb4da35){logger[_0x6b82('0x13')](_0x6b82('0x20'));if(!_[_0x6b82('0x21')](_0xb4da35)){logger[_0x6b82('0x13')](_['isObject'](_0xb4da35)?JSON[_0x6b82('0xe')](_0xb4da35):_0xb4da35);}}_0xeb5e43['on'](_0x6b82('0x22'),_0x560818);_0xeb5e43['on']('message',_0x3460dd);_0xeb5e43['on'](_0x6b82('0x11'),_0x214f55);_0xeb5e43['on'](_0x6b82('0x13'),_0x290846);});}; \ No newline at end of file +var _0x6de2=['createReadStream','data','close','EOS','Tilde\x20ASR\x20send\x20error','terminate','parse','result','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','open','bluebird','lodash','../../../../../../config/logger','agi','exports','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','update','digest','info','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify'];(function(_0x2ffc18,_0x25327b){var _0x13dad7=function(_0x237bae){while(--_0x237bae){_0x2ffc18['push'](_0x2ffc18['shift']());}};_0x13dad7(++_0x25327b);}(_0x6de2,0x1a3));var _0x26de=function(_0x3cc75a,_0x41cbf1){_0x3cc75a=_0x3cc75a-0x0;var _0x21d393=_0x6de2[_0x3cc75a];return _0x21d393;};'use strict';var BPromise=require(_0x26de('0x0'));var _=require(_0x26de('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require('crypto');var logger=require(_0x26de('0x2'))(_0x26de('0x3'));module[_0x26de('0x4')]=function(_0x2aecac,_0x203205,_0x4f5293,_0x41eeab){return new BPromise(function(_0x4ba154,_0x423e28){logger['info']('Tilde\x20URI',_0x41eeab||_0x26de('0x5'));var _0x1f72c6=new WebSocket(_0x41eeab||_0x26de('0x5'),{'perMessageDeflate':![]});var _0x171e7d='';var _0x294c05='0';var _0x2596d5='1';var _0x43acda='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x2c58ae(_0x3c66ae){var _0x5da6b4=crypto['createHash']('sha1');_0x5da6b4[_0x26de('0x6')](_0x3c66ae);return _0x5da6b4[_0x26de('0x7')]('hex');}function _0x968bfb(){try{logger[_0x26de('0x8')](_0x26de('0x9'));var _0x4733b8=moment()[_0x26de('0xa')]();var _0x198952=_0x2c58ae(_0x4733b8+_0x203205+_0x4f5293);_0x1f72c6[_0x26de('0xb')](JSON[_0x26de('0xc')]({'appID':_0x203205,'timestamp':_0x4733b8,'appKey':_0x198952}));var _0x1b3278=fs[_0x26de('0xd')](_0x2aecac);_0x1b3278['on'](_0x26de('0xe'),function(_0x40a2ac){_0x1f72c6['send'](_0x40a2ac);});_0x1b3278['on'](_0x26de('0xf'),function(){_0x1f72c6[_0x26de('0xb')](_0x26de('0x10'));});}catch(_0x302f79){logger['error'](_0x26de('0x11'),JSON['stringify'](_0x302f79));_0x1f72c6[_0x26de('0x12')]();}}function _0x2d7676(_0x7918d3){try{if(_0x7918d3){var _0x543e3e=JSON[_0x26de('0x13')](_0x7918d3);switch(_0x543e3e['status']){case 0x0:if(_0x543e3e[_0x26de('0x14')]){if(_0x543e3e[_0x26de('0x14')]['final']){logger[_0x26de('0x8')](_0x26de('0x15'),JSON[_0x26de('0xc')](_0x543e3e[_0x26de('0x14')][_0x26de('0x16')]));_0x171e7d=_0x543e3e[_0x26de('0x14')][_0x26de('0x16')][0x0]['transcript'];_0x294c05=_0x543e3e[_0x26de('0x14')][_0x26de('0x16')][0x0][_0x26de('0x17')];_0x2596d5='0';_0x43acda=_0x26de('0x18');_0x1f72c6[_0x26de('0x12')]();}}break;case 0x1:logger['info'](_0x26de('0x19'));_0x2596d5='1';_0x43acda=_0x26de('0x19');break;case 0x2:logger[_0x26de('0x8')](_0x26de('0x1a'));_0x2596d5='2';_0x43acda='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x26de('0x8')](_0x26de('0x1b'));_0x2596d5='9';_0x43acda=_0x26de('0x1b');break;case 0xa:logger['info']('Authentication\x20failed.');_0x2596d5='10';_0x43acda=_0x26de('0x1c');break;case 0xb:logger[_0x26de('0x8')](_0x26de('0x1d'));_0x2596d5='11';_0x43acda=_0x26de('0x1d');}}}catch(_0x3d3743){logger[_0x26de('0x1e')](_0x26de('0x1f'),JSON[_0x26de('0xc')](_0x3d3743));_0x1f72c6[_0x26de('0x12')]();}}function _0x21dfb4(){logger[_0x26de('0x8')](_0x26de('0x20'));_0x4ba154({'transcript':_0x171e7d,'confidence':_0x294c05,'status':_0x2596d5,'status_message':_0x43acda});}function _0x49143f(_0x349f54){logger[_0x26de('0x1e')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x26de('0x21')](_0x349f54)){logger[_0x26de('0x1e')](_[_0x26de('0x22')](_0x349f54)?JSON[_0x26de('0xc')](_0x349f54):_0x349f54);}}_0x1f72c6['on'](_0x26de('0x23'),_0x968bfb);_0x1f72c6['on']('message',_0x2d7676);_0x1f72c6['on'](_0x26de('0xf'),_0x21dfb4);_0x1f72c6['on'](_0x26de('0x1e'),_0x49143f);});}; \ 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 acc0331..37cbdf3 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 _0xdb66=['exports'];(function(_0x2c8db7,_0xfa05d6){var _0xee0bd3=function(_0x2a1f6f){while(--_0x2a1f6f){_0x2c8db7['push'](_0x2c8db7['shift']());}};_0xee0bd3(++_0xfa05d6);}(_0xdb66,0xfe));var _0x6db6=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xdb66[_0x5c9307];return _0x373e29;};var asr=require('./asr');module[_0x6db6('0x0')]={'asr':asr}; \ No newline at end of file +var _0x11d1=['exports'];(function(_0x25e501,_0x1d2820){var _0x998cc9=function(_0x34eff6){while(--_0x34eff6){_0x25e501['push'](_0x25e501['shift']());}};_0x998cc9(++_0x1d2820);}(_0x11d1,0xdf));var _0x111d=function(_0x4e2986,_0x3dc4a9){_0x4e2986=_0x4e2986-0x0;var _0xef6bc6=_0x11d1[_0x4e2986];return _0xef6bc6;};var asr=require('./asr');module[_0x111d('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 64ff0e8..d58eedf 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 _0x0f01=['exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','connection','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0f01,0xc1));var _0x10f0=function(_0x4bd06e,_0x593701){_0x4bd06e=_0x4bd06e-0x0;var _0x85ebb=_0x0f01[_0x4bd06e];return _0x85ebb;};'use strict';var util=require(_0x10f0('0x0'));var net=require(_0x10f0('0x1'));var EventEmitter=require(_0x10f0('0x2'))['EventEmitter'];var AGIError=require(_0x10f0('0x3'));var AGIChannel=require(_0x10f0('0x4'));var AGIServer=function(_0xa68566,_0x377a7b,_0x5afcf2){var _0x1697af=this,_0xa68566=_0xa68566||0x11dd,_0x377a7b=_0x377a7b||_0x10f0('0x5'),_0x17749f=null,_0x265146=0x0;EventEmitter[_0x10f0('0x6')](_0x1697af);function _0x1bfbe2(){if(!_0xa68566){_0x1697af[_0x10f0('0x7')](_0x10f0('0x8'),new AGIError(_0x10f0('0x9')));return![];}_0x17749f=net[_0x10f0('0xa')]();_0x17749f[_0x10f0('0xb')](_0xa68566,_0x377a7b);_0x17749f['on'](_0x10f0('0xc'),function(){_0x1697af[_0x10f0('0x7')](_0x10f0('0xc'));});_0x17749f['on']('connection',function(_0x45a3d4){_0x17749f['getConnections'](function(_0x2a2eda,_0x212e1b){if(_0x2a2eda){_0x1697af[_0x10f0('0x7')](_0x10f0('0x8'),new AGIError(_0x10f0('0xd'),_0x2a2eda));}else if(_0x5afcf2&&_0x5afcf2<0x0){_0x1697af[_0x10f0('0x7')](_0x10f0('0x8'),new AGIError(_0x10f0('0xe')));_0x45a3d4[_0x10f0('0xf')]();}else if(_0x5afcf2&&_0x5afcf2>0x0&&_0x5afcf2<_0x212e1b){_0x265146+=0x1;_0x1697af[_0x10f0('0x7')](_0x10f0('0x8'),new AGIError(_0x10f0('0x10'),_0x265146));_0x45a3d4['destroy']();}else{var _0x377aa7=new AGIChannel(_0x45a3d4);_0x377aa7['on']('ready',function(){_0x1697af[_0x10f0('0x7')](_0x10f0('0x11'),_0x377aa7);});}});});_0x17749f['on'](_0x10f0('0x8'),function(_0x221eee){_0x1697af['emit'](_0x10f0('0x8'),new AGIError(_0x10f0('0xd'),_0x221eee[_0x10f0('0x12')]));});_0x17749f['on'](_0x10f0('0x13'),function(){_0x1697af[_0x10f0('0x7')](_0x10f0('0x13'),new AGIError(_0x10f0('0x14')));});}process[_0x10f0('0x15')](function(){_0x1bfbe2();});};util[_0x10f0('0x16')](AGIServer,EventEmitter);module[_0x10f0('0x17')]=function(_0x45d60a,_0x22e0bd,_0x569072){return new AGIServer(_0x45d60a,_0x22e0bd,_0x569072);}; \ No newline at end of file +var _0x9185=['E_AGI_SERVER_MAXCONNECTION','ready','connection','code','close','E_AGI_SERVER_CLOSE','nextTick','exports','net','EventEmitter','./error','./channel','emit','error','createServer','listening','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x4ee9cd,_0xd375b0){var _0x328a5b=function(_0x3ad1f4){while(--_0x3ad1f4){_0x4ee9cd['push'](_0x4ee9cd['shift']());}};_0x328a5b(++_0xd375b0);}(_0x9185,0xd9));var _0x5918=function(_0x2b0960,_0x525d1c){_0x2b0960=_0x2b0960-0x0;var _0x140c06=_0x9185[_0x2b0960];return _0x140c06;};'use strict';var util=require('util');var net=require(_0x5918('0x0'));var EventEmitter=require('events')[_0x5918('0x1')];var AGIError=require(_0x5918('0x2'));var AGIChannel=require(_0x5918('0x3'));var AGIServer=function(_0x517047,_0x5406eb,_0x166706){var _0x11a8f8=this,_0x517047=_0x517047||0x11dd,_0x5406eb=_0x5406eb||'127.0.0.1',_0x3ae004=null,_0xab2f03=0x0;EventEmitter['call'](_0x11a8f8);function _0x5aa838(){if(!_0x517047){_0x11a8f8[_0x5918('0x4')](_0x5918('0x5'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x3ae004=net[_0x5918('0x6')]();_0x3ae004['listen'](_0x517047,_0x5406eb);_0x3ae004['on'](_0x5918('0x7'),function(){_0x11a8f8[_0x5918('0x4')]('listening');});_0x3ae004['on']('connection',function(_0x41b4d3){_0x3ae004['getConnections'](function(_0x9b0d4d,_0x3f2f74){if(_0x9b0d4d){_0x11a8f8[_0x5918('0x4')](_0x5918('0x5'),new AGIError(_0x5918('0x8'),_0x9b0d4d));}else if(_0x166706&&_0x166706<0x0){_0x11a8f8[_0x5918('0x4')](_0x5918('0x5'),new AGIError(_0x5918('0x9')));_0x41b4d3[_0x5918('0xa')]();}else if(_0x166706&&_0x166706>0x0&&_0x166706<_0x3f2f74){_0xab2f03+=0x1;_0x11a8f8[_0x5918('0x4')]('error',new AGIError(_0x5918('0xb'),_0xab2f03));_0x41b4d3[_0x5918('0xa')]();}else{var _0x56c8f7=new AGIChannel(_0x41b4d3);_0x56c8f7['on'](_0x5918('0xc'),function(){_0x11a8f8[_0x5918('0x4')](_0x5918('0xd'),_0x56c8f7);});}});});_0x3ae004['on']('error',function(_0x4cf613){_0x11a8f8['emit']('error',new AGIError(_0x5918('0x8'),_0x4cf613[_0x5918('0xe')]));});_0x3ae004['on'](_0x5918('0xf'),function(){_0x11a8f8[_0x5918('0x4')]('close',new AGIError(_0x5918('0x10')));});}process[_0x5918('0x11')](function(){_0x5aa838();});};util['inherits'](AGIServer,EventEmitter);module[_0x5918('0x12')]=function(_0xfd444a,_0x54b2fd,_0xd55cf0){return new AGIServer(_0xfd444a,_0x54b2fd,_0xd55cf0);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 8e28fbd..02933d8 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 _0x8404=['An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','computedVariables','sync','uri','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','clear','agicommand','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','isString','saveRestApiResult','%s.%s','split','length','replaceAll','extra','getAndSetVariable','result','setVariable','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','mrcprecog','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','callback_priority','createCmContact','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','dialogflowV2','dialogflowV2_project_id','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','providerResponse','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','audiofile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','opts','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','awsLex','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','NOBEEP','recordFile','intKey','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','beep','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','context','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','login','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','variable\x20%s[key]\x20set','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','PLAYBACK','queue','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','gosub','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','digits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','Smtp','user','bcc','subject','service','secure','authentication','auth','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','AGI','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','exports','path','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','menu','getdigits','getsecretdigits','rpc','mailRpc','getVariable','then','name','catch','prototype','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','arg_1','callerid','createSquareRecording','priority','accountcode','dnid','file','createSquareMessage','isEmpty','isNil','callback_','random','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','getPause','getPauseById','agent','agentPause','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','exec','googleCloudTTS','text','languageCode','en-US','ssmlGender','MALE','MP3','restAPI','url','method','number','timeout','includes','POST','PUT','toUpperCase','rawBody','parse'];(function(_0x2c6d8d,_0xd0025f){var _0x5f3ab8=function(_0x22a4d7){while(--_0x22a4d7){_0x2c6d8d['push'](_0x2c6d8d['shift']());}};_0x5f3ab8(++_0xd0025f);}(_0x8404,0x15d));var _0x4840=function(_0x5585b7,_0x57e174){_0x5585b7=_0x5585b7-0x0;var _0x4e3f75=_0x8404[_0x5585b7];return _0x4e3f75;};'use strict';var fs=require('fs');var path=require(_0x4840('0x0'));var util=require(_0x4840('0x1'));var _=require(_0x4840('0x2'));var sh=require(_0x4840('0x3'));var odbc=require(_0x4840('0x4'))();var rs=require(_0x4840('0x5'));var moment=require(_0x4840('0x6'));var Mustache=require(_0x4840('0x7'));var rp=require(_0x4840('0x8'));var logger=require('../../config/logger')(_0x4840('0x9'));var config=require(_0x4840('0xa'));var scripts=require(_0x4840('0xb'));var FILES_PATH=_0x4840('0xc');var recursiveMapAttributes=['rawHeaders','rawBody'];var verticesWithRetry=[_0x4840('0xd'),_0x4840('0xe'),_0x4840('0xf')];var AGIVertices=function(_0x3e9856,_0x2fee69,_0x1ebef2){this['channel']=_0x3e9856;this[_0x4840('0x10')]=_0x2fee69;this[_0x4840('0x11')]=_0x1ebef2;};AGIVertices['prototype'][_0x4840('0x12')]=function(_0x43e97c,_0x16bee1){this[_0x4840('0x10')]['getVariableById'](_0x43e97c)[_0x4840('0x13')](function(_0x2dfec2){_0x16bee1(null,_0x2dfec2?_0x2dfec2[_0x4840('0x14')]:![]);})[_0x4840('0x15')](function(_0x16e4fd){_0x16bee1(_0x16e4fd);});};AGIVertices[_0x4840('0x16')][_0x4840('0x17')]=function(_0x5be053,_0x4d9cbb){this[_0x4840('0x10')][_0x4840('0x18')](_0x5be053)['then'](function(_0x4449e9){_0x4d9cbb(null,_0x4449e9?_0x4449e9[_0x4840('0x14')]:![]);})['catch'](function(_0x477823){_0x4d9cbb(_0x477823);});};AGIVertices['prototype'][_0x4840('0x19')]=function(_0x1a9282,_0xe693d2){this[_0x4840('0x10')][_0x4840('0x1a')](_0x1a9282)[_0x4840('0x13')](function(_0x1c3dde){_0xe693d2(null,_0x1c3dde?_0x1c3dde['name']:![]);})['catch'](function(_0x319ea4){_0xe693d2(_0x319ea4);});};AGIVertices['prototype'][_0x4840('0x1b')]=function(_0x36e515,_0x470050){this[_0x4840('0x10')]['getSquareOdbcById'](_0x36e515)['then'](function(_0x8d4c52){_0x470050(null,_0x8d4c52?_0x8d4c52[_0x4840('0x1c')]:![]);})['catch'](function(_0xbd08dd){_0x470050(_0xbd08dd);});};AGIVertices[_0x4840('0x16')][_0x4840('0x1d')]=function(_0x2ac38f,_0x4a05bb){this[_0x4840('0x10')][_0x4840('0x1e')](_0x2ac38f)['then'](function(_0x5b65c1){_0x4a05bb(null,_0x5b65c1?_0x5b65c1[_0x4840('0x14')]:![]);})[_0x4840('0x15')](function(_0x35939b){_0x4a05bb(_0x35939b);});};AGIVertices[_0x4840('0x16')][_0x4840('0x1f')]=function(_0x15ec23,_0x2e6760){this['rpc'][_0x4840('0x20')](_0x15ec23)[_0x4840('0x13')](function(_0x76a1be){_0x2e6760(null,_0x76a1be?_0x76a1be[_0x4840('0x14')]:![]);})[_0x4840('0x15')](function(_0x3c7afe){_0x2e6760(_0x3c7afe);});};AGIVertices['prototype'][_0x4840('0x21')]=function(_0x584584,_0x14dee2){var _0x22451c=this;this[_0x4840('0x10')][_0x4840('0x22')](_0x584584)[_0x4840('0x13')](function(_0x5559da){_0x14dee2(null,_0x5559da?_0x22451c[_0x4840('0x23')](_0x5559da['save_name']):![]);})[_0x4840('0x15')](function(_0x141be8){_0x14dee2(_0x141be8);});};AGIVertices[_0x4840('0x16')]['getMailAccount']=function(_0x5ddb38,_0x1944fe){this[_0x4840('0x10')][_0x4840('0x24')](_0x5ddb38)[_0x4840('0x13')](function(_0x243069){_0x1944fe(null,_0x243069?_0x243069:![]);})[_0x4840('0x15')](function(_0x3bdda3){_0x1944fe(_0x3bdda3);});};AGIVertices[_0x4840('0x16')]['sendMailMessage']=function(_0x48aa39,_0x2ee40b,_0x5d1846){this[_0x4840('0x11')][_0x4840('0x25')](_0x48aa39,_0x2ee40b)[_0x4840('0x13')](function(){_0x5d1846(null);})['catch'](function(_0x2c88d5){_0x5d1846(_0x2c88d5);});};AGIVertices[_0x4840('0x16')][_0x4840('0x26')]=function(_0xc532b7,_0x73333a){this[_0x4840('0x10')][_0x4840('0x27')](_0xc532b7)[_0x4840('0x13')](function(_0x569845){if(_0x569845){if(_0x569845[_0x4840('0x28')]){_0x73333a(null,[_0x569845['interval']]);}else{_0x73333a(null,_[_0x4840('0x29')](_0x569845[_0x4840('0x2a')],'interval'));}}else{_0x73333a(null,![]);}})['catch'](function(_0x1aeb01){_0x73333a(_0x1aeb01);});};AGIVertices[_0x4840('0x16')][_0x4840('0x23')]=function(_0x2d3b52){return util[_0x4840('0x2b')](_0x4840('0x2c'),FILES_PATH,_0x2d3b52);};AGIVertices[_0x4840('0x16')][_0x4840('0x2d')]=function(_0x3b0795,_0xeed716,_0x5ab62b){odbc[_0x4840('0x2e')](_0x3b0795,function(_0x524782){if(_0x524782){logger[_0x4840('0x2f')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x524782);_0x5ab62b(_0x524782);}else{logger[_0x4840('0x30')](_0x4840('0x31'));odbc[_0x4840('0x32')](_0xeed716,function(_0x407494,_0xd9a692){if(_0x407494){logger[_0x4840('0x30')](_0x4840('0x33'),_0xeed716);_0x5ab62b(_0x407494);}else{logger[_0x4840('0x30')](_0x4840('0x34'),_0xeed716);odbc[_0x4840('0x35')](function(_0x339716){if(_0x339716){logger[_0x4840('0x2f')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x339716);}_0x5ab62b(null,_0xd9a692);});}});}});};AGIVertices[_0x4840('0x16')][_0x4840('0x36')]=function(_0x3edd50,_0x2e5515){this['rpc'][_0x4840('0x37')](_0x3edd50)[_0x4840('0x13')](function(_0x54241b){_0x2e5515(null,_0x54241b?_0x54241b:![]);})[_0x4840('0x15')](function(_0x51a8e7){_0x2e5515(_0x51a8e7);});};AGIVertices[_0x4840('0x16')][_0x4840('0x38')]=function(_0x8d3c51,_0x1541f5){this[_0x4840('0x10')][_0x4840('0x38')](_0x8d3c51)[_0x4840('0x13')](function(_0x2ba80d){_0x1541f5(null,_0x2ba80d);})[_0x4840('0x15')](function(_0x44e503){_0x1541f5(_0x44e503);});};AGIVertices[_0x4840('0x16')]['createSquareDetailsReport']=function(_0x969393,_0x3d7f94,_0xd7741e){this[_0x4840('0x10')][_0x4840('0x39')]({'uniqueid':this[_0x4840('0x3a')][_0x4840('0x3b')],'node':_0x969393[_0x4840('0x3c')],'application':_0x969393['agicommand'],'data':_0x3d7f94||null,'project_name':this[_0x4840('0x3a')][_0x4840('0x3d')],'callerid':this['channel'][_0x4840('0x3e')]})[_0x4840('0x13')](function(_0x53bbf5){if(_0xd7741e){_0xd7741e(null,_0x53bbf5);}})[_0x4840('0x15')](function(_0x3745dc){if(_0xd7741e){_0xd7741e(_0x3745dc);}});};AGIVertices['prototype'][_0x4840('0x3f')]=function(_0x4e9fbe,_0x7451b0,_0x554a79,_0x53749e){this['rpc'][_0x4840('0x3f')]({'uniqueid':this['channel'][_0x4840('0x3b')],'callerid':this['channel'][_0x4840('0x3e')],'calleridname':this['channel']['calleridname'],'context':this[_0x4840('0x3a')]['context'],'extension':this[_0x4840('0x3a')]['extension'],'priority':this[_0x4840('0x3a')][_0x4840('0x40')],'accountcode':this['channel'][_0x4840('0x41')],'dnid':this[_0x4840('0x3a')][_0x4840('0x42')],'projectName':this['channel'][_0x4840('0x3d')],'saveName':_0x7451b0,'filename':_0x4e9fbe[_0x4840('0x43')]||_0x7451b0,'savePath':_0x554a79})[_0x4840('0x13')](function(_0x5a32fe){_0x53749e(null,_0x5a32fe);})[_0x4840('0x15')](function(_0x4bfcec){_0x53749e(_0x4bfcec);});};AGIVertices[_0x4840('0x16')]['createSquareMessage']=function(_0x1b37f6,_0x264948,_0x124f37,_0x224a8e,_0x7606e8){this['rpc'][_0x4840('0x44')]({'uniqueid':this[_0x4840('0x3a')][_0x4840('0x3b')],'body':_0x1b37f6,'direction':_0x264948,'providerName':_0x124f37,'providerResponse':_0x224a8e})['then'](function(_0x346d87){if(_0x7606e8){_0x7606e8(null,_0x346d87);}})[_0x4840('0x15')](function(_0x4c1d40){if(_0x7606e8){_0x7606e8(_0x4c1d40);}});};AGIVertices[_0x4840('0x16')]['createCmContact']=function(_0x2562a6,_0x5f2f3c){this[_0x4840('0x10')]['createCmContact']({'firstName':_[_0x4840('0x45')](_0x2562a6['name'])||_[_0x4840('0x46')](_0x2562a6[_0x4840('0x14')])?_0x4840('0x47')+Math[_0x4840('0x48')]():_0x2562a6['name'],'lastName':_[_0x4840('0x45')](_0x2562a6[_0x4840('0x49')])||_[_0x4840('0x46')](_0x2562a6['lastName'])?null:_0x2562a6[_0x4840('0x49')],'phone':_0x2562a6[_0x4840('0x4a')],'ListId':_0x2562a6[_0x4840('0x4b')],'scheduledat':_0x2562a6['scheduledAt'],'callbackUniqueid':this['channel'][_0x4840('0x3b')],'tags':_0x4840('0x4c'),'description':_0x4840('0x4d')+_0x2562a6[_0x4840('0x4e')][_0x4840('0x4f')](),'priority':_0x2562a6['callback_priority']})[_0x4840('0x13')](function(_0x277ead){_0x5f2f3c(null,_0x277ead);})[_0x4840('0x15')](function(_0x41448c){_0x5f2f3c(_0x41448c);});};AGIVertices[_0x4840('0x16')][_0x4840('0x50')]=function(_0x49edf8,_0x10881a){this[_0x4840('0x10')][_0x4840('0x51')](_0x49edf8)[_0x4840('0x13')](function(_0x75902c){_0x10881a(null,_0x75902c?_0x75902c[_0x4840('0x14')]:![]);})['catch'](function(_0x308bbc){_0x10881a(_0x308bbc);});};AGIVertices[_0x4840('0x16')]['agentPause']=function(_0x37b649,_0x153e2f,_0x1ee145){var _0x42aacd={'role':_0x4840('0x52')};_0x42aacd[_0x37b649]=this[_0x4840('0x3a')][_0x4840('0x3e')];this[_0x4840('0x10')][_0x4840('0x53')](_0x42aacd,_0x153e2f,this[_0x4840('0x3a')][_0x4840('0x3b')])['then'](function(_0x4dd09e){_0x1ee145(null,_[_0x4840('0x46')](_0x4dd09e)?![]:!![]);})['catch'](function(_0x3f7e2d){logger['error'](_0x3f7e2d);_0x1ee145(null,![]);});};AGIVertices[_0x4840('0x16')]['agentUnpause']=function(_0x1bc9fa,_0x246f76){var _0x32a6a8={'role':_0x4840('0x52')};_0x32a6a8[_0x1bc9fa]=this[_0x4840('0x3a')][_0x4840('0x3e')];this[_0x4840('0x10')][_0x4840('0x54')](_0x32a6a8)[_0x4840('0x13')](function(_0x15c849){_0x246f76(null,_['isNil'](_0x15c849)?![]:!![]);})[_0x4840('0x15')](function(_0x86a20a){logger[_0x4840('0x2f')](_0x86a20a);_0x246f76(null,![]);});};AGIVertices[_0x4840('0x16')][_0x4840('0x55')]=function(_0x289e8c,_0x3a5b47){var _0x230749={'role':_0x4840('0x52')};_0x230749[_0x289e8c]=this[_0x4840('0x3a')][_0x4840('0x3e')];this[_0x4840('0x10')][_0x4840('0x55')](_0x230749)[_0x4840('0x13')](function(_0x305ba3){_0x3a5b47(null,_['isNil'](_0x305ba3)?![]:!![]);})[_0x4840('0x15')](function(_0x40422c){logger[_0x4840('0x2f')](_0x40422c);_0x3a5b47(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x2e3ac5,_0x2f73e0){var _0x6829e0={'role':_0x4840('0x52')};_0x6829e0[_0x2e3ac5]=this[_0x4840('0x3a')][_0x4840('0x3e')];var _0x114521=_0x2e3ac5!=_0x4840('0x56')?util[_0x4840('0x2b')](_0x4840('0x57'),_0x4840('0x58'),this[_0x4840('0x3a')][_0x4840('0x3e')]):undefined;this['rpc'][_0x4840('0x59')](_0x6829e0,_0x114521)[_0x4840('0x13')](function(_0x37e027){_0x2f73e0(null,_[_0x4840('0x46')](_0x37e027)?![]:!![]);})[_0x4840('0x15')](function(_0x508284){logger['error'](_0x508284);_0x2f73e0(null,![]);});};AGIVertices[_0x4840('0x16')][_0x4840('0x5a')]=function(_0x507056,_0x44b6d8){sh[_0x4840('0x5b')](_['trim'](_0x507056),function(_0x31d330,_0x4736b8){var _0x280ea7=_0x4736b8['replace'](/(\r\n|\n|\r)/gm,'');_0x44b6d8(null,_0x280ea7);});};AGIVertices[_0x4840('0x16')]['googleCloudTTS']=function(_0x162a24,_0x193764){scripts[_0x4840('0x5c')](_0x162a24['apiKey'],_0x162a24['google_cloud_tts_text_type']||_0x4840('0x5d'),_0x162a24[_0x4840('0x5d')],_0x162a24[_0x4840('0x5e')]||_0x4840('0x5f'),_0x162a24[_0x4840('0x60')]||_0x4840('0x61'),_0x162a24['audioEncoding']||_0x4840('0x62'))['then'](function(_0x25aa3c){_0x193764(null,_0x25aa3c);})[_0x4840('0x15')](function(_0x36c53a){_0x193764(_0x36c53a);});};AGIVertices[_0x4840('0x16')]['googleTTS']=function(_0x1e2d74,_0x4aa6c0){scripts['googleTTS'](_0x1e2d74[_0x4840('0x5d')],_0x1e2d74['google_tts_language']||'en',0x1)[_0x4840('0x13')](function(_0xf84cec){_0x4aa6c0(null,_0xf84cec);})['catch'](function(_0x1dda1f){_0x4aa6c0(_0x1dda1f);});};AGIVertices[_0x4840('0x16')][_0x4840('0x63')]=function(_0x479743,_0x23902){var _0x253814={'uri':_0x479743[_0x4840('0x64')],'method':_0x479743[_0x4840('0x65')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x479743['timeout'])===_0x4840('0x66')&&parseInt(_0x479743[_0x4840('0x67')])>=0x1?parseInt(_0x479743[_0x4840('0x67')])*0x3e8:0x5*0x3e8};if(_[_0x4840('0x68')]([_0x4840('0x69'),_0x4840('0x6a')],_0x253814[_0x4840('0x65')][_0x4840('0x6b')]())){try{_0x253814['body']=_0x479743[_0x4840('0x6c')]?JSON[_0x4840('0x6d')](_0x479743[_0x4840('0x6c')]):{};}catch(_0x1486fd){logger[_0x4840('0x2f')](_0x4840('0x6e'),_0x1486fd);}}try{_0x253814[_0x4840('0x6f')]=_0x479743['rawHeaders']?JSON[_0x4840('0x6d')](_0x479743[_0x4840('0x70')]):{};}catch(_0x339276){logger[_0x4840('0x2f')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x339276);}if(_0x479743[_0x4840('0x71')]){try{var _0x15fa5f=require(_0x479743[_0x4840('0x71')])[_0x4840('0x72')](this,_0x253814);_0x253814[_0x4840('0x73')]=Mustache['render'](_0x479743[_0x4840('0x64')],_0x15fa5f,{},['$$','$$']);if(_0x253814[_0x4840('0x6f')]){_0x253814[_0x4840('0x6f')]=JSON['parse'](Mustache[_0x4840('0x74')](JSON[_0x4840('0x75')](_0x253814[_0x4840('0x6f')]),_0x15fa5f,{},['$$','$$']));}if(_0x253814[_0x4840('0x76')]){_0x253814[_0x4840('0x76')]=JSON[_0x4840('0x6d')](Mustache['render'](JSON[_0x4840('0x75')](_0x253814[_0x4840('0x76')]),_0x15fa5f,{},['$$','$$']));}}catch(_0x1576c5){logger['error'](_0x4840('0x77'),_0x1576c5);}}rp(_0x253814)['then'](function(_0x227ba8){var _0x4ff2a4={'statusCode':_0x227ba8[_0x4840('0x78')]||0xc8,'statusMessage':_0x227ba8[_0x4840('0x79')]||'OK','headers':_0x227ba8[_0x4840('0x6f')]||{},'body':_0x227ba8[_0x4840('0x76')]||{}};_0x23902(null,_0x4ff2a4);})[_0x4840('0x15')](function(_0xecaa13){var _0x31c38f={'statusCode':_0xecaa13['statusCode']||0x1f4,'statusMessage':_0xecaa13['message']||_0x4840('0x7a'),'headers':_0xecaa13[_0x4840('0x7b')][_0x4840('0x6f')]||{},'body':_0xecaa13['options'][_0x4840('0x76')]||{}};_0x23902(null,_0x31c38f);});};AGIVertices['prototype'][_0x4840('0x7c')]=function(_0x5df914,_0x1f6df7){scripts['googleDialogflow'](this[_0x4840('0x3a')][_0x4840('0x3b')],_0x5df914[_0x4840('0x7d')],_0x5df914[_0x4840('0x5d')],_0x5df914['dialogflow_language']||'en')[_0x4840('0x13')](function(_0x12b7ee){_0x1f6df7(null,_0x12b7ee);})[_0x4840('0x15')](function(_0x439ce1){_0x1f6df7(_0x439ce1);});};AGIVertices[_0x4840('0x16')][_0x4840('0x7e')]=function(_0x582dd5,_0xffa5eb){scripts['googleDialogflowV2'](this[_0x4840('0x3a')]['uniqueid'],_0x582dd5['dialogflowV2_project_id'],_0x582dd5[_0x4840('0x7f')],_0x582dd5['private_key'],_0x582dd5[_0x4840('0x5d')],_0x582dd5[_0x4840('0x80')]||'en')[_0x4840('0x13')](function(_0x4b2bb2){_0xffa5eb(null,_0x4b2bb2);})[_0x4840('0x15')](function(_0x384039){_0xffa5eb(_0x384039);});};AGIVertices['prototype'][_0x4840('0x81')]=function(_0x4b0d1c,_0x53c78b){scripts[_0x4840('0x81')](this['channel'],_0x4b0d1c)['then'](function(_0x282884){_0x53c78b(null,_0x282884);})[_0x4840('0x15')](function(_0x4a6587){_0x53c78b(_0x4a6587);});};AGIVertices[_0x4840('0x16')][_0x4840('0x82')]=function(_0x39866c,_0x54a38b){scripts['ispeechTTS'](_0x39866c[_0x4840('0x7d')],_0x39866c['text'],_0x39866c[_0x4840('0x83')]||_0x4840('0x5f'),_0x39866c[_0x4840('0x84')])['then'](function(_0x36ca53){_0x54a38b(null,_0x36ca53);})[_0x4840('0x15')](function(_0x4f4891){_0x54a38b(_0x4f4891);});};AGIVertices['prototype'][_0x4840('0x85')]=function(_0x7c87d6,_0x55ee04,_0x5c2666){scripts[_0x4840('0x85')](_0x55ee04,_0x7c87d6['key'],_0x7c87d6[_0x4840('0x86')]||_0x4840('0x5f'),this[_0x4840('0x87')](_0x7c87d6['model'])?_0x7c87d6[_0x4840('0x88')]:undefined)[_0x4840('0x13')](function(_0x2a741f){_0x5c2666(null,_0x2a741f);})[_0x4840('0x15')](function(_0x2d7fee){_0x5c2666(_0x2d7fee);});};AGIVertices[_0x4840('0x16')][_0x4840('0x89')]=function(_0x82eaa1,_0x211a0c){scripts[_0x4840('0x89')](_0x82eaa1[_0x4840('0x8a')],_0x82eaa1[_0x4840('0x8b')],_0x82eaa1[_0x4840('0x8c')],_0x82eaa1[_0x4840('0x8d')]||'Amy',_0x82eaa1[_0x4840('0x5d')],_0x82eaa1['aws_text_type']||'text')['then'](function(_0x43623c){_0x211a0c(null,_0x43623c);})[_0x4840('0x15')](function(_0x22c744){_0x211a0c(_0x22c744);});};AGIVertices['prototype']['awsLex']=function(_0x14c259,_0x5364e0){scripts['awsLex'](this[_0x4840('0x3a')][_0x4840('0x3b')],_0x14c259[_0x4840('0x8a')],_0x14c259[_0x4840('0x8b')],_0x14c259[_0x4840('0x8e')],_0x14c259[_0x4840('0x5d')],_0x14c259[_0x4840('0x8f')])[_0x4840('0x13')](function(_0x3d9f44){_0x5364e0(null,_0x3d9f44);})['catch'](function(_0x198ab1){_0x5364e0(_0x198ab1);});};AGIVertices[_0x4840('0x16')][_0x4840('0x90')]=function(_0x41b99f,_0x445fa6,_0x3edca5){scripts[_0x4840('0x90')](_0x445fa6,_0x41b99f[_0x4840('0x7d')],_0x41b99f[_0x4840('0x91')]||'en-US')[_0x4840('0x13')](function(_0x423ddb){_0x3edca5(null,_0x423ddb);})['catch'](function(_0x30a4ab){_0x3edca5(_0x30a4ab);});};AGIVertices[_0x4840('0x16')][_0x4840('0x92')]=function(_0x298f9e,_0x122590,_0x3ceba4){scripts['tildeASR'](_0x122590,_0x298f9e['appid'],_0x298f9e[_0x4840('0x93')],_0x298f9e[_0x4840('0x73')])['then'](function(_0x101d66){_0x3ceba4(null,_0x101d66);})[_0x4840('0x15')](function(_0x45b217){_0x3ceba4(_0x45b217);});};AGIVertices[_0x4840('0x16')][_0x4840('0x94')]=function(_0x1ec4a6){var _0x49c5e1=_['includes'](verticesWithRetry,_0x1ec4a6[_0x4840('0x95')])?_0x1ec4a6:_[_0x4840('0x96')](_0x1ec4a6);for(var _0x20bc5e in _0x49c5e1){if(_0x49c5e1[_0x4840('0x97')](_0x20bc5e)){if(_0x49c5e1[_0x20bc5e]&&_['isString'](_0x49c5e1[_0x20bc5e])){if(_['includes'](recursiveMapAttributes,_0x20bc5e)){_0x49c5e1[_0x20bc5e]=this[_0x4840('0x98')](_0x49c5e1[_0x20bc5e]);}else{_0x49c5e1[_0x20bc5e]=this[_0x4840('0x99')](_0x49c5e1[_0x20bc5e]);}}}}return _0x49c5e1;};AGIVertices[_0x4840('0x16')][_0x4840('0x9a')]=function(_0x931af7){for(var _0xc0fb48 in _0x931af7){if(_0x931af7[_0x4840('0x97')](_0xc0fb48)){if(_[_0x4840('0x9b')](_0x931af7[_0xc0fb48])){this[_0x4840('0x9a')](_0x931af7[_0xc0fb48]);}else if(_[_0x4840('0x9c')](_0x931af7[_0xc0fb48])){for(var _0x5dd988=0x0;_0x5dd988<_0x931af7[_0xc0fb48]['length'];_0x5dd988++){this[_0x4840('0x9a')](_0x931af7[_0xc0fb48][_0x5dd988]);}}else if(_[_0x4840('0x9d')](_0x931af7[_0xc0fb48])){_0x931af7[_0xc0fb48]=this[_0x4840('0x99')](_0x931af7[_0xc0fb48]);}}}};AGIVertices[_0x4840('0x16')][_0x4840('0x9e')]=function(_0x56eae8,_0x19add2){for(var _0x24315f in _0x56eae8){if(_0x56eae8['hasOwnProperty'](_0x24315f)){if(_[_0x4840('0x9b')](_0x56eae8[_0x24315f])){if(!_[_0x4840('0x45')](_0x56eae8[_0x24315f])){this[_0x4840('0x9e')](_0x56eae8[_0x24315f],util[_0x4840('0x2b')]('%s.%s',_0x19add2,_0x24315f));}}else if(_['isArray'](_0x56eae8[_0x24315f])){for(var _0x56a9aa=0x0;_0x56a9aa<_0x56eae8[_0x24315f]['length'];_0x56a9aa++){this['saveRestApiResult'](_0x56eae8[_0x24315f][_0x56a9aa],util[_0x4840('0x2b')](_0x4840('0x9f'),_0x19add2,_0x24315f+'['+_0x56a9aa+']'));}}else{if(!_[_0x4840('0x46')](_0x56eae8[_0x24315f])){this[_0x4840('0x3a')]['setVariable'](util[_0x4840('0x2b')](_0x4840('0x9f'),_0x19add2,_0x24315f),_0x56eae8[_0x24315f]);}}}}};AGIVertices['prototype'][_0x4840('0x98')]=function(_0x5a720a){try{var _0x4ecf1e=JSON[_0x4840('0x6d')](_0x5a720a);this['recursiveNodeIndex'](_0x4ecf1e);return JSON[_0x4840('0x75')](_0x4ecf1e);}catch(_0x4bba5b){return this[_0x4840('0x99')](_0x5a720a);}};AGIVertices[_0x4840('0x16')][_0x4840('0x99')]=function(_0x19c986){var _0x3d0887=_0x19c986[_0x4840('0xa0')]('{');for(var _0x530ec1=0x1;_0x530ec1<_0x3d0887[_0x4840('0xa1')];_0x530ec1+=0x1){var _0x55f360=_0x3d0887[_0x530ec1][_0x4840('0xa0')]('}');if(_0x55f360['length']>0x1){_0x19c986=_0x19c986[_0x4840('0xa2')]('{'+_0x55f360[0x0]+'}',this[_0x4840('0x3a')][_0x4840('0x12')](_0x55f360[0x0])[_0x4840('0xa3')]||_0x55f360[0x0]);}}if(_0x3d0887['length']===0x1){return _0x19c986[_0x4840('0x4f')]();}return this[_0x4840('0x99')](_0x19c986);};AGIVertices['prototype'][_0x4840('0xa4')]=function(_0x3dc5ff,_0x279e26){var _0x43121e=this[_0x4840('0x3a')]['getVariable'](_0x3dc5ff);if(_0x43121e[_0x4840('0xa5')]===-0x1){return _0x43121e;}logger[_0x4840('0x30')](util[_0x4840('0x2b')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x279e26,_0x43121e[_0x4840('0xa3')]));return this[_0x4840('0x3a')][_0x4840('0xa6')](_0x279e26,_0x43121e['extra']);};AGIVertices[_0x4840('0x16')]['isConfigured']=function(_0x33e211){return _0x33e211&&_0x33e211!=='0'&&_0x33e211!=='-1'&&_0x33e211!=='';};AGIVertices['prototype'][_0x4840('0xa7')]=function(_0x52ed21){this[_0x4840('0x39')][_0x4840('0x72')](this,_0x52ed21,'-');_0x52ed21[_0x4840('0xa8')]=_0x52ed21[_0x4840('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x4840('0x16')][_0x4840('0xa9')]=function(_0x35b970){logger['info'](util[_0x4840('0x2b')](_0x4840('0xaa'),_0x35b970[_0x4840('0x3c')]));if(!this[_0x4840('0x87')](_0x35b970['text'])){return this[_0x4840('0x3a')][_0x4840('0xab')](_0x4840('0xac'));}var _0x4fb078='\x22'+_0x35b970[_0x4840('0x5d')]+'\x22';if(this[_0x4840('0x87')](_0x35b970[_0x4840('0x7b')])){_0x4fb078+=','+_0x35b970[_0x4840('0x7b')];}var _0x24cae4=this[_0x4840('0x3a')][_0x4840('0x5b')](_0x4840('0xad'),_0x4fb078);if(_0x24cae4[_0x4840('0xa5')]===-0x1){return _0x24cae4;}return this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4fb078));};AGIVertices[_0x4840('0x16')][_0x4840('0xae')]=function(_0xf0425a){logger['info'](util[_0x4840('0x2b')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0xf0425a['label']));if(!this[_0x4840('0x87')](_0xf0425a['grammar'])){return this['channel']['noop'](_0x4840('0xaf'));}var _0x261ffe=_0xf0425a[_0x4840('0xb0')];if(this['isConfigured'](_0xf0425a[_0x4840('0x7b')])){_0x261ffe+=','+_0xf0425a['options'];}var _0x1dc627=this[_0x4840('0x3a')][_0x4840('0x5b')](_0x4840('0xb1'),_0x261ffe);if(_0x1dc627['result']===-0x1){return _0x1dc627;}var _0x1533e4=this[_0x4840('0xa4')](_0x4840('0xb2'),_0x4840('0xb3'));if(_0x1533e4[_0x4840('0xa5')]===-0x1){return _0x1533e4;}var _0x25521c=this[_0x4840('0xa4')](_0x4840('0xb4'),_0x4840('0xb5'));if(_0x25521c[_0x4840('0xa5')]===-0x1){return _0x25521c;}var _0x1b20fe=this['getAndSetVariable']('RECOG_INSTANCE()',_0x4840('0xb6'));if(_0x1b20fe[_0x4840('0xa5')]===-0x1){return _0x1b20fe;}return this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0xb7'),_0x261ffe));};AGIVertices[_0x4840('0x16')][_0x4840('0x9')]=function(_0x31ef61){logger[_0x4840('0x30')](util[_0x4840('0x2b')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x31ef61[_0x4840('0x3c')]));return this[_0x4840('0x3a')][_0x4840('0x9')]([_0x31ef61[_0x4840('0xb8')],_0x31ef61[_0x4840('0xb9')]]);};AGIVertices[_0x4840('0x16')][_0x4840('0xba')]=function(_0x433c02){logger[_0x4840('0x30')](util['format'](_0x4840('0xbb'),_0x433c02[_0x4840('0x3c')]));if(this[_0x4840('0x87')](_0x433c02['timeout'])){logger['info'](util['format']('Wait\x20%s\x20seconds\x20before\x20answer',_0x433c02[_0x4840('0x67')]));var _0x2b0c9c=this[_0x4840('0x3a')][_0x4840('0xbc')](_0x433c02[_0x4840('0x67')]);if(_0x2b0c9c[_0x4840('0xa5')]===-0x1){return _0x2b0c9c;}}return this[_0x4840('0x3a')][_0x4840('0xba')]();};AGIVertices[_0x4840('0x16')][_0x4840('0x4c')]=function(_0x571815){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0xbd'),_0x571815[_0x4840('0x3c')]));if(!this[_0x4840('0x87')](_0x571815[_0x4840('0x4b')])){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x571815,_0x4840('0xbe'));}_0x571815[_0x4840('0x4e')]=moment();if(this[_0x4840('0x87')](_0x571815[_0x4840('0xbf')])){_0x571815['scheduledAt']=moment()[_0x4840('0xc0')](_0x571815[_0x4840('0xbf')],_0x4840('0xc1'));}if(!this[_0x4840('0x87')](_0x571815['callback_priority'])){_0x571815[_0x4840('0xc2')]=0x2;}this[_0x4840('0xc3')][_0x4840('0x72')](this,_0x571815);return this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0xc4'),_0x571815[_0x4840('0x4a')],_0x571815[_0x4840('0x4b')],_0x571815[_0x4840('0x4e')]));};AGIVertices[_0x4840('0x16')]['custom_app']=function(_0x37b991){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0xc5'),_0x37b991['label']));var _0x31511b=this[_0x4840('0x3a')][_0x4840('0x5b')](_0x37b991[_0x4840('0xc6')],_0x37b991[_0x4840('0x7b')]);if(_0x31511b[_0x4840('0xa5')]===-0x1){return _0x31511b;}return this['channel'][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0xc7'),_0x37b991['application'],_0x37b991['options']));};AGIVertices[_0x4840('0x16')][_0x4840('0xc8')]=function(_0x9c6fde){logger['info'](util[_0x4840('0x2b')](_0x4840('0xc9'),_0x9c6fde['label']));if(!this['isConfigured'](_0x9c6fde['text'])){return this[_0x4840('0x3a')]['noop'](_0x4840('0xac'));}var _0x5ebf18='\x22'+_0x9c6fde[_0x4840('0x5d')]+'\x22';if(this[_0x4840('0x87')](_0x9c6fde['options'])){_0x5ebf18+=','+_0x9c6fde[_0x4840('0x7b')];}var _0x428bf9=this['channel'][_0x4840('0x5b')](_0x4840('0xad'),_0x5ebf18);if(_0x428bf9['result']===-0x1){return _0x428bf9;}return this['channel'][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0xca'),_0x5ebf18));};AGIVertices[_0x4840('0x16')][_0x4840('0xcb')]=function(_0x272d92){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0xcc'),_0x272d92[_0x4840('0x3c')]));if(!this[_0x4840('0x87')](_0x272d92[_0x4840('0x5d')])){return this[_0x4840('0x3a')]['noop'](_0x4840('0xac'));}var _0x3de0fe='\x22'+_0x272d92[_0x4840('0x5d')]+'\x22';if(this['isConfigured'](_0x272d92['options'])){_0x3de0fe+=','+_0x272d92[_0x4840('0x7b')];}var _0x37f303=this['channel'][_0x4840('0x5b')](_0x4840('0xad'),_0x3de0fe);if(_0x37f303[_0x4840('0xa5')]===-0x1){return _0x37f303;}return this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')]('Executed\x20command\x20MRCPSynth\x20%s',_0x3de0fe));};AGIVertices[_0x4840('0x16')][_0x4840('0xcd')]=function(_0x2f3a7){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0xce'),_0x2f3a7[_0x4840('0x3c')]));if(!this['isConfigured'](_0x2f3a7['grammar'])){return this['channel'][_0x4840('0xab')]('no\x20grammar\x20configured');}var _0x42b1f0=_0x2f3a7[_0x4840('0xb0')];if(this['isConfigured'](_0x2f3a7[_0x4840('0x7b')])){_0x42b1f0+=','+_0x2f3a7[_0x4840('0x7b')];}var _0x220757=this[_0x4840('0x3a')][_0x4840('0x5b')](_0x4840('0xb1'),_0x42b1f0);if(_0x220757[_0x4840('0xa5')]===-0x1){return _0x220757;}var _0x3c5e67=this[_0x4840('0xa4')](_0x4840('0xb2'),_0x4840('0xcf'));if(_0x3c5e67['result']===-0x1){return _0x3c5e67;}var _0xcdf4b0=this[_0x4840('0xa4')](_0x4840('0xb4'),_0x4840('0xd0'));if(_0xcdf4b0[_0x4840('0xa5')]===-0x1){return _0xcdf4b0;}var _0x386ddd=this['getAndSetVariable'](_0x4840('0xd1'),'LUMENVOX_ASR_INSTANCE');if(_0x386ddd[_0x4840('0xa5')]===-0x1){return _0x386ddd;}return this['channel'][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0xb7'),_0x42b1f0));};AGIVertices['prototype'][_0x4840('0xd2')]=function(_0x5781e8){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0xd3'),_0x5781e8[_0x4840('0x3c')]));if(!this[_0x4840('0x87')](_0x5781e8[_0x4840('0xb0')])){return this[_0x4840('0x3a')][_0x4840('0xab')](_0x4840('0xaf'));}var _0x36d911=_0x5781e8[_0x4840('0xb0')];if(this['isConfigured'](_0x5781e8[_0x4840('0x7b')])){_0x36d911+=','+_0x5781e8[_0x4840('0x7b')];}var _0x12280a=this[_0x4840('0x3a')]['exec'](_0x4840('0xb1'),_0x36d911);if(_0x12280a[_0x4840('0xa5')]===-0x1){return _0x12280a;}var _0x19b775=this[_0x4840('0xa4')]('RECOG_CONFIDENCE()',_0x4840('0xd4'));if(_0x19b775[_0x4840('0xa5')]===-0x1){return _0x19b775;}var _0x42fdff=this[_0x4840('0xa4')](_0x4840('0xb4'),_0x4840('0xd5'));if(_0x42fdff[_0x4840('0xa5')]===-0x1){return _0x42fdff;}var _0x1208fc=this[_0x4840('0xa4')](_0x4840('0xd1'),'SESTEK_ASR_INSTANCE');if(_0x1208fc['result']===-0x1){return _0x1208fc;}return this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0xb7'),_0x36d911));};AGIVertices[_0x4840('0x16')][_0x4840('0xd6')]=function(_0x141a05){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0xd7'),_0x141a05[_0x4840('0x3c')]));if(!this[_0x4840('0x87')](_0x141a05[_0x4840('0xd8')])){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x141a05,_0x4840('0xd9'));}var _0x4ab037=this[_0x4840('0x1b')][_0x4840('0x72')](this,_0x141a05[_0x4840('0xd8')]);if(!_0x4ab037){return this[_0x4840('0x3a')]['error'](_0x141a05,_0x4840('0xda'));}if(!this['isConfigured'](_0x141a05[_0x4840('0x32')])){return this['channel'][_0x4840('0x2f')](_0x141a05,_0x4840('0xdb'));}var _0x306425=_0x141a05[_0x4840('0x32')][_0x4840('0xdc')](/(\r\n|\n|\r)/gm,'\x20');this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0xdd'),_0x306425));var _0x35fba9=this[_0x4840('0x2d')][_0x4840('0x72')](this,_0x4ab037,_0x306425);this[_0x4840('0x39')][_0x4840('0x72')](this,_0x141a05,_0x306425);if(!this[_0x4840('0x87')](_0x141a05[_0x4840('0xde')])){return this[_0x4840('0x3a')][_0x4840('0xab')](_0x4840('0xdf'));}var _0x22776f=this[_0x4840('0x12')][_0x4840('0x72')](this,_0x141a05['variable_id']);if(!_0x22776f){return this[_0x4840('0x3a')]['error'](_0x141a05,_0x4840('0xe0'));}var _0x3657b9=this;_0x35fba9[_0x4840('0xe1')](function(_0x2b150e,_0x198733){Object[_0x4840('0xe2')](_0x2b150e)[_0x4840('0xe1')](function(_0x120649){_0x3657b9[_0x4840('0x3a')][_0x4840('0xa6')](util[_0x4840('0x2b')](_0x4840('0xe3'),_0x22776f,_0x198733,_0x120649),_0x2b150e[_0x120649]);});});this[_0x4840('0x3a')][_0x4840('0xa6')](util[_0x4840('0x2b')](_0x4840('0xe4'),_0x22776f),_0x35fba9[_0x4840('0xa1')]);return this['channel'][_0x4840('0xab')](util['format'](_0x4840('0xe5'),_0x22776f));};AGIVertices['prototype'][_0x4840('0xe6')]=function(_0x5bcfd5){logger[_0x4840('0xe7')](util[_0x4840('0x2b')](_0x4840('0xe8'),_0x5bcfd5[_0x4840('0x3c')]));if(!this[_0x4840('0x87')](_0x5bcfd5[_0x4840('0xe9')])){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x5bcfd5,_0x4840('0xea'));}var _0x3d57d3=this[_0x4840('0x1d')]['sync'](this,_0x5bcfd5[_0x4840('0xe9')]);if(!_0x3d57d3){return this['channel'][_0x4840('0x2f')](_0x5bcfd5,_0x4840('0xeb'));}var _0x420465=this[_0x4840('0x3a')][_0x4840('0x5b')]('DIAL',[util[_0x4840('0x2b')](_0x4840('0xec'),_0x3d57d3),_0x5bcfd5[_0x4840('0x67')],_0x5bcfd5['opts'],_0x5bcfd5['url']]);if(_0x420465['result']===-0x1){return _0x420465;}return this[_0x4840('0x3a')][_0x4840('0xab')](util['format'](_0x4840('0xed'),_0x4840('0xee')));};AGIVertices[_0x4840('0x16')][_0x4840('0xef')]=function(_0x57659f){logger['info'](util[_0x4840('0x2b')](_0x4840('0xf0'),_0x57659f['label']));if(!this[_0x4840('0x87')](_0x57659f['key'])){return this['channel'][_0x4840('0xab')](_0x4840('0xf1'));}if(!this[_0x4840('0x87')](_0x57659f[_0x4840('0x5d')])){return this['channel']['noop'](_0x4840('0xac'));}this[_0x4840('0x3a')][_0x4840('0xf2')]=!![];this[_0x4840('0x39')](_0x57659f);this['createSquareMessage'](_0x57659f[_0x4840('0x5d')],'in','','');this[_0x4840('0x3a')]['noop'](util[_0x4840('0x2b')](_0x4840('0xf3'),_0x57659f[_0x4840('0x5d')]));var _0x3e4d74=this[_0x4840('0x7c')][_0x4840('0x72')](this,_0x57659f);if(_0x3e4d74){for(var _0x327a56 in _0x3e4d74){if(_0x3e4d74['hasOwnProperty'](_0x327a56)){this[_0x4840('0x3a')][_0x4840('0xa6')](util['format'](_0x4840('0xf4'),_0x327a56['toUpperCase']()),_0x3e4d74[_0x327a56]);}}this[_0x4840('0x44')](_0x3e4d74[_0x4840('0xf5')],_0x4840('0xf6'),'dialogflow','');return this['channel'][_0x4840('0xab')](util['format']('Dialogflow\x20Result\x20%s',_0x3e4d74[_0x4840('0xf5')]));}return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x57659f,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x4840('0x16')][_0x4840('0xf7')]=function(_0x5c64d6){logger['info'](util[_0x4840('0x2b')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x5c64d6['label']));if(!this[_0x4840('0x87')](_0x5c64d6[_0x4840('0xf8')])){return this[_0x4840('0x3a')][_0x4840('0xab')]('no\x20project_id\x20configured');}if(!this['isConfigured'](_0x5c64d6[_0x4840('0x7f')])){return this[_0x4840('0x3a')][_0x4840('0xab')](_0x4840('0xf9'));}if(!this['isConfigured'](_0x5c64d6[_0x4840('0xfa')])){return this['channel']['noop'](_0x4840('0xfb'));}if(!this[_0x4840('0x87')](_0x5c64d6['dialogflowV2_language'])){return this[_0x4840('0x3a')]['noop']('no\x20anguage\x20configured');}if(!this[_0x4840('0x87')](_0x5c64d6[_0x4840('0x5d')])){return this[_0x4840('0x3a')][_0x4840('0xab')](_0x4840('0xac'));}this['channel'][_0x4840('0xf2')]=!![];this[_0x4840('0x39')](_0x5c64d6);this[_0x4840('0x44')](_0x5c64d6[_0x4840('0x5d')],'in','','');this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')]('Trying\x20DialogflowV2:\x20%s',_0x5c64d6['text']));var _0x4b05cd=this[_0x4840('0x7e')][_0x4840('0x72')](this,_0x5c64d6);if(_0x4b05cd){for(var _0x2419d5 in _0x4b05cd){if(_0x4b05cd[_0x4840('0x97')](_0x2419d5)){if(_0x2419d5!==_0x4840('0xfc')){this[_0x4840('0x3a')][_0x4840('0xa6')](util['format'](_0x4840('0xf4'),_0x2419d5[_0x4840('0x6b')]()),_0x4b05cd[_0x2419d5]);}}}this[_0x4840('0x44')](_0x4b05cd['speech'],_0x4840('0xf6'),_0x4840('0xf7'),_0x4b05cd[_0x4840('0xfc')]);return this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')]('DialogflowV2\x20Result\x20%s',_0x4b05cd[_0x4840('0xf5')]));}return this[_0x4840('0x3a')]['error'](_0x5c64d6,_0x4840('0xfd'));};AGIVertices[_0x4840('0x16')]['sesteknda']=function(_0x446d63){logger[_0x4840('0x30')](util['format'](_0x4840('0xfe'),_0x446d63[_0x4840('0x3c')]));if(!this[_0x4840('0x87')](_0x446d63[_0x4840('0xff')])){return this[_0x4840('0x3a')][_0x4840('0xab')](_0x4840('0x100'));}if(!this[_0x4840('0x87')](_0x446d63[_0x4840('0x101')])){return this['channel'][_0x4840('0xab')]('no\x20username\x20configured');}if(!this[_0x4840('0x87')](_0x446d63[_0x4840('0x102')])){return this[_0x4840('0x3a')]['noop'](_0x4840('0x103'));}if(!this[_0x4840('0x87')](_0x446d63['ndassistant_url'])){return this[_0x4840('0x3a')][_0x4840('0xab')](_0x4840('0xac'));}this[_0x4840('0x3a')]['bot']=!![];this['createSquareDetailsReport'](_0x446d63);this[_0x4840('0x44')](_0x446d63[_0x4840('0x5d')],'in','','');this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0x104'),_0x446d63['text']));var _0xc3bede=this['sestekNDA'][_0x4840('0x72')](this,_0x446d63);if(_0xc3bede){for(var _0x361109 in _0xc3bede){if(_0xc3bede[_0x4840('0x97')](_0x361109)){this[_0x4840('0x3a')]['setVariable'](util[_0x4840('0x2b')](_0x4840('0x105'),_0x361109['toUpperCase']()),_0xc3bede[_0x361109]);}}this[_0x4840('0x44')](_0xc3bede[_0x4840('0xf5')],_0x4840('0xf6'),'sesteknda','');if(_0xc3bede['audiofile']){this['channel'][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0x106'),_0xc3bede['audiofile']));var _0x57b5c8=this[_0x4840('0x3a')][_0x4840('0x107')](_0xc3bede[_0x4840('0x108')]);try{fs[_0x4840('0x109')](_0xc3bede[_0x4840('0x108')]+'.wav');}catch(_0x4a1298){logger[_0x4840('0x2f')](_0x4a1298);}return _0x57b5c8;}else{return this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0x10a'),_0xc3bede[_0x4840('0xf5')]));}}return this[_0x4840('0x3a')]['error'](_0x446d63,_0x4840('0x10b'));};AGIVertices['prototype'][_0x4840('0x10c')]=function(_0x440666){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x10d'),_0x440666[_0x4840('0x3c')]));return this[_0x4840('0x3a')][_0x4840('0xab')](_0x4840('0x10c'));};AGIVertices['prototype'][_0x4840('0x10e')]=function(_0x39abc3){logger[_0x4840('0x30')](util[_0x4840('0x2b')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x39abc3['label']));var _0x123e70='';if(_0x39abc3[_0x4840('0x10f')]){if(!this[_0x4840('0x87')](_0x39abc3[_0x4840('0x10f')])){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x39abc3,_0x4840('0x110'));}else{var _0x499244=parseInt(_0x39abc3[_0x4840('0x10f')],0xa);if(isNaN(_0x499244)){_0x123e70=_0x39abc3['trunk_id'];}else{_0x123e70=this[_0x4840('0x1f')]['sync'](this,_0x39abc3[_0x4840('0x10f')]);if(!_0x123e70){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x39abc3,_0x4840('0x111'));}}}}else if(_0x39abc3[_0x4840('0x112')]){_0x123e70=_0x39abc3[_0x4840('0x112')];}else{return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x39abc3,_0x4840('0x110'));}var _0x4c830f=this['channel'][_0x4840('0x5b')](_0x4840('0xee'),[util[_0x4840('0x2b')](_0x4840('0x113'),_0x123e70,_0x39abc3['phone']),_0x39abc3['timeout'],_0x39abc3[_0x4840('0x114')],_0x39abc3[_0x4840('0x64')]]);if(_0x4c830f[_0x4840('0xa5')]===-0x1){return _0x4c830f;}return this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0xed'),_0x4840('0xee')));};AGIVertices[_0x4840('0x16')][_0x4840('0x115')]=function(_0x4bb889){logger['info'](util['format']('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x4bb889['label']));return this['channel']['noop'](_0x4840('0x115'));};AGIVertices[_0x4840('0x16')]['getdigits']=function(_0x2a94a4){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x116'),_0x2a94a4[_0x4840('0x3c')]));if(_0x2a94a4[_0x4840('0xa8')]===0x0){return this[_0x4840('0xa7')](_0x2a94a4);}_0x2a94a4[_0x4840('0xa8')]-=0x1;if(!this[_0x4840('0x87')](_0x2a94a4[_0x4840('0x117')])){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x2a94a4,_0x4840('0x118'));}var _0x446e3e=this[_0x4840('0x21')]['sync'](this,_0x2a94a4[_0x4840('0x117')]);if(!_0x446e3e){return this['channel']['error'](_0x2a94a4,_0x4840('0x119'));}if(!this[_0x4840('0x87')](_0x2a94a4[_0x4840('0xde')])){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x4840('0xdf'));}var _0x4aa0e6=this[_0x4840('0x3a')][_0x4840('0x11a')](_0x446e3e,_0x2a94a4[_0x4840('0x11b')],_0x2a94a4[_0x4840('0x11c')]);var _0x238bf7=_0x4aa0e6[_0x4840('0xa5')]?_0x4aa0e6[_0x4840('0xa5')][_0x4840('0x4f')]():'';logger[_0x4840('0x30')](_0x4840('0x11d'),JSON['stringify'](_0x4aa0e6));if(_0x4aa0e6['result']===-0x1){this[_0x4840('0x39')]['sync'](this,_0x2a94a4,_0x238bf7);return _0x4aa0e6;}else if(_0x4aa0e6['extra']==='timeout'){_0x4aa0e6[_0x4840('0xa5')]=_0x238bf7[_0x4840('0xa1')]>=parseInt(_0x2a94a4[_0x4840('0x11e')])?'x':'i';}else{_0x4aa0e6[_0x4840('0xa5')]=_0x238bf7[_0x4840('0xa1')]>=parseInt(_0x2a94a4[_0x4840('0x11e')])&&_0x238bf7['length']<=parseInt(_0x2a94a4['maxdigit'])?'x':'i';}var _0x240520=this[_0x4840('0x12')]['sync'](this,_0x2a94a4[_0x4840('0xde')]);if(!_0x240520){return this[_0x4840('0x3a')]['error'](_0x2a94a4,_0x4840('0xe0'));}this[_0x4840('0x3a')][_0x4840('0xa6')](_0x240520,_0x238bf7);if(this[_0x4840('0x87')](_0x2a94a4[_0x4840('0x11f')])){var _0x482be2=parseInt(_0x2a94a4[_0x4840('0x11f')],0xa);var _0x6d2c4c=rs[_0x4840('0x120')]({'charset':'*','length':_0x482be2});var _0x1273a5=_0x238bf7[_0x4840('0xa1')];if(_0x1273a5>0x0){if(_0x1273a5>_0x482be2){this[_0x4840('0x39')][_0x4840('0x72')](this,_0x2a94a4,_0x2a94a4[_0x4840('0x121')]===_0x4840('0x122')?_0x6d2c4c+_0x238bf7[_0x4840('0x123')](_0x482be2):_0x238bf7['substr'](0x0,_0x1273a5-_0x482be2)+_0x6d2c4c);}else{this[_0x4840('0x39')][_0x4840('0x72')](this,_0x2a94a4,rs[_0x4840('0x120')]({'charset':'*','length':_0x1273a5}));}}else{this[_0x4840('0x39')][_0x4840('0x72')](this,_0x2a94a4,'');}}else{this['createSquareDetailsReport']['sync'](this,_0x2a94a4,_0x238bf7);}return _0x4aa0e6;};AGIVertices[_0x4840('0x16')][_0x4840('0xf')]=function(_0x540bd1){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x124'),_0x540bd1['label']));return this[_0x4840('0xe')](_0x540bd1);};AGIVertices['prototype']['goal']=function(_0x298961){logger[_0x4840('0x30')](util['format'](_0x4840('0x125'),_0x298961[_0x4840('0x3c')]));this[_0x4840('0x39')][_0x4840('0x72')](this,_0x298961,_0x298961['goalname']);return this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0x126'),_0x298961['goalname']));};AGIVertices[_0x4840('0x16')][_0x4840('0x127')]=function(_0x588ce5){logger['info'](util[_0x4840('0x2b')](_0x4840('0x128'),_0x588ce5[_0x4840('0x3c')]));if(!this['isConfigured'](_0x588ce5[_0x4840('0x8a')])||!this[_0x4840('0x87')](_0x588ce5[_0x4840('0x8b')])){return this[_0x4840('0x3a')][_0x4840('0xab')](_0x4840('0x129'));}if(!this[_0x4840('0x87')](_0x588ce5[_0x4840('0x5d')])){return this['channel']['noop'](_0x4840('0xac'));}this[_0x4840('0x3a')][_0x4840('0xab')](util['format'](_0x4840('0x12a'),_0x588ce5[_0x4840('0x5d')]));var _0x31eb20=this['awsPolly']['sync'](this,_0x588ce5);if(_0x31eb20){this['channel'][_0x4840('0xab')](util[_0x4840('0x2b')]('aws\x20Polly\x20%s\x20file\x20created',_0x31eb20));var _0x35b673=this[_0x4840('0x3a')][_0x4840('0x107')](_0x31eb20);try{fs[_0x4840('0x109')](_0x31eb20+_0x4840('0x12b'));}catch(_0x21e7a3){logger['error'](_0x21e7a3);}return _0x35b673;}return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x588ce5,_0x4840('0x12c'));};AGIVertices['prototype'][_0x4840('0x12d')]=function(_0x2a335a){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x12e'),_0x2a335a[_0x4840('0x3c')]));if(!this['isConfigured'](_0x2a335a[_0x4840('0x8a')])||!this[_0x4840('0x87')](_0x2a335a[_0x4840('0x8b')])){return this['channel'][_0x4840('0xab')](_0x4840('0x129'));}if(!this[_0x4840('0x87')](_0x2a335a[_0x4840('0x8f')])){return this[_0x4840('0x3a')][_0x4840('0xab')](_0x4840('0x12f'));}if(!this['isConfigured'](_0x2a335a['text'])){return this[_0x4840('0x3a')][_0x4840('0xab')]('no\x20text\x20configured');}this[_0x4840('0x3a')]['bot']=!![];this[_0x4840('0x39')](_0x2a335a);this[_0x4840('0x44')](_0x2a335a[_0x4840('0x5d')],'in','','');this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0x130'),_0x2a335a[_0x4840('0x5d')]));var _0x2a694d=this[_0x4840('0x131')]['sync'](this,_0x2a335a);if(_0x2a694d){for(var _0x2c6ee0 in _0x2a694d){if(_0x2a694d[_0x4840('0x97')](_0x2c6ee0)&&_[_0x4840('0x9d')](_0x2a694d[_0x2c6ee0])){this['channel']['setVariable'](util['format'](_0x4840('0x132'),_0x2c6ee0[_0x4840('0x6b')]()),_0x2a694d[_0x2c6ee0]);}}if(_['isNil'](_0x2a694d[_0x4840('0x133')])){return this[_0x4840('0x3a')][_0x4840('0xab')](_0x4840('0x134'));}else{this[_0x4840('0x44')](_0x2a694d[_0x4840('0x133')],'out',_0x4840('0x135'),'');return this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0x136'),_0x2a694d['message']));}}return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x2a335a,_0x4840('0x137'));};AGIVertices[_0x4840('0x16')][_0x4840('0x138')]=function(_0x5cb226){logger['info'](util[_0x4840('0x2b')](_0x4840('0x139'),_0x5cb226[_0x4840('0x3c')],_0x5cb226[_0x4840('0x67')]));if(!this[_0x4840('0x87')](_0x5cb226[_0x4840('0x7d')])){return this['channel'][_0x4840('0xab')](_0x4840('0xf1'));}var _0x42075c=_0x4840('0x13a');var _0x4d79c7=util[_0x4840('0x2b')](_0x4840('0x13b'),FILES_PATH,rs['generate'](0x4));var _0x1d4fd2=util[_0x4840('0x2b')](_0x4840('0x9f'),_0x4d79c7,_0x42075c);var _0x4f212e=!![];if(_0x5cb226['beep']===_0x4840('0x13c')){_0x4f212e=![];}var _0x4bc96a=this[_0x4840('0x3a')][_0x4840('0x13d')](_0x4d79c7,_0x42075c,_0x5cb226[_0x4840('0x13e')],_0x5cb226[_0x4840('0x67')],undefined,_0x4f212e);if(_0x4bc96a[_0x4840('0xa5')]!==-0x1){this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')]('google\x20%s\x20file\x20created',_0x1d4fd2));var _0xc0abf4=this[_0x4840('0x90')][_0x4840('0x72')](this,_0x5cb226,_0x1d4fd2);if(_0xc0abf4){for(var _0x28bd23 in _0xc0abf4){if(_0xc0abf4[_0x4840('0x97')](_0x28bd23)){this[_0x4840('0x3a')]['setVariable'](util['format']('GOOGLE_ASR_%s',_0x28bd23['toUpperCase']()),_0xc0abf4[_0x28bd23]);}}return this['channel'][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0x13f'),JSON['stringify'](_0xc0abf4)));}}return _0x4bc96a;};AGIVertices[_0x4840('0x16')][_0x4840('0x140')]=function(_0x266e1c){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x141'),_0x266e1c['label']));if(!this['isConfigured'](_0x266e1c[_0x4840('0x142')])){return this[_0x4840('0x3a')][_0x4840('0xab')]('no\x20appid\x20configured');}if(!this[_0x4840('0x87')](_0x266e1c['appsecret'])){return this[_0x4840('0x3a')]['noop']('no\x20appsecret\x20configured');}var _0xf2759c=_0x4840('0x13a');var _0x4bfda7=util[_0x4840('0x2b')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x1175ab=util['format'](_0x4840('0x9f'),_0x4bfda7,_0xf2759c);var _0x32416c=!![];if(_0x266e1c[_0x4840('0x143')]==='NOBEEP'){_0x32416c=![];}var _0x118578=this[_0x4840('0x3a')]['recordFile'](_0x4bfda7,_0xf2759c,_0x266e1c['intKey'],_0x266e1c[_0x4840('0x67')],undefined,_0x32416c);if(_0x118578[_0x4840('0xa5')]!==-0x1){this[_0x4840('0x3a')][_0x4840('0xab')](util['format']('tilde\x20%s\x20file\x20created',_0x1175ab));var _0x506ba7=this['tildeASR'][_0x4840('0x72')](this,_0x266e1c,_0x1175ab);if(_0x506ba7){for(var _0x516114 in _0x506ba7){if(_0x506ba7['hasOwnProperty'](_0x516114)){this[_0x4840('0x3a')][_0x4840('0xa6')](util['format'](_0x4840('0x144'),_0x516114['toUpperCase']()),_0x506ba7[_0x516114]);}}return this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0x145'),JSON[_0x4840('0x75')](_0x506ba7)));}}return _0x118578;};AGIVertices[_0x4840('0x16')][_0x4840('0x146')]=function(_0x4addd1){logger[_0x4840('0x30')](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x4addd1[_0x4840('0x3c')]));return this[_0x4840('0x3a')]['continueAt'](_0x4addd1[_0x4840('0x147')],_0x4addd1[_0x4840('0x148')],_0x4addd1['priority']);};AGIVertices['prototype'][_0x4840('0x149')]=function(_0x58b5f2){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x14a'),_0x58b5f2[_0x4840('0x3c')]));if(!this[_0x4840('0x87')](_0x58b5f2['condition'])){return this['channel'][_0x4840('0x2f')](_0x58b5f2,'no\x20condition\x20configured');}try{var _0x3ff087=eval(_0x58b5f2[_0x4840('0x14b')])?'true':'false';this[_0x4840('0x3a')]['noop'](util[_0x4840('0x2b')](_0x4840('0x14c'),_0x58b5f2[_0x4840('0x14b')],_0x3ff087));return{'code':0xc8,'result':_0x3ff087};}catch(_0x23cbe6){return{'code':0xc8,'result':_0x4840('0x14d')};}};AGIVertices[_0x4840('0x16')][_0x4840('0x14e')]=function(_0x583f01){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x14f'),_0x583f01[_0x4840('0x3c')]));if(!this[_0x4840('0x87')](_0x583f01[_0x4840('0x150')])){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x583f01,_0x4840('0x151'));}var _0x2547e8=this[_0x4840('0x26')][_0x4840('0x72')](this,_0x583f01[_0x4840('0x150')]);if(!_0x2547e8){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x583f01,_0x4840('0x152'));}for(var _0x39c64e=0x0;_0x39c64e<_0x2547e8[_0x4840('0xa1')];_0x39c64e+=0x1){var _0x167f10=this['channel'][_0x4840('0x12')](util['format'](_0x4840('0x153'),_0x2547e8[_0x39c64e]));if(_0x167f10[_0x4840('0xa5')]===-0x1){return _0x167f10;}logger['info'](util[_0x4840('0x2b')](_0x4840('0x154'),_0x2547e8[_0x39c64e],_0x167f10['extra']));if(_0x167f10[_0x4840('0xa3')]===_0x4840('0x155')){logger[_0x4840('0x30')](util['format'](_0x4840('0x154'),_0x2547e8[_0x39c64e],_0x4840('0x155')));this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0x154'),_0x2547e8[_0x39c64e],'true'));return{'code':0xc8,'result':_0x4840('0x155')};}else{logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x154'),_0x2547e8[_0x39c64e],'false'));this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0x154'),_0x2547e8[_0x39c64e],_0x4840('0x14d')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x4840('0x16')]['hangup']=function(_0x295fec){logger[_0x4840('0x30')](util['format'](_0x4840('0x156'),_0x295fec[_0x4840('0x3c')]));return this[_0x4840('0x3a')][_0x4840('0x157')]();};AGIVertices[_0x4840('0x16')][_0x4840('0x158')]=function(_0x73f8bd){logger[_0x4840('0x30')](util['format'](_0x4840('0x159'),_0x73f8bd['label']));if(!this['isConfigured'](_0x73f8bd['key'])){return this[_0x4840('0x3a')][_0x4840('0xab')](_0x4840('0xf1'));}var _0x583868='wav';var _0x2150e0=util[_0x4840('0x2b')](_0x4840('0x13b'),FILES_PATH,rs[_0x4840('0x120')](0x4));var _0x4cd369=util[_0x4840('0x2b')](_0x4840('0x9f'),_0x2150e0,_0x583868);var _0x5de4f9=!![];if(_0x73f8bd[_0x4840('0x143')]===_0x4840('0x13c')){_0x5de4f9=![];}var _0x2d8f04=this[_0x4840('0x3a')][_0x4840('0x13d')](_0x2150e0,_0x583868,_0x73f8bd['intKey'],_0x73f8bd[_0x4840('0x67')],undefined,_0x5de4f9);if(_0x2d8f04[_0x4840('0xa5')]!==-0x1){this[_0x4840('0x3a')]['noop'](util[_0x4840('0x2b')]('ispeech\x20%s\x20file\x20created',_0x4cd369));var _0x2ffd7c=this[_0x4840('0x85')][_0x4840('0x72')](this,_0x73f8bd,_0x4cd369);if(_0x2ffd7c){for(var _0x401ca6 in _0x2ffd7c){if(_0x2ffd7c[_0x4840('0x97')](_0x401ca6)){this['channel']['setVariable'](util[_0x4840('0x2b')](_0x4840('0x15a'),_0x401ca6['toUpperCase']()),_0x2ffd7c[_0x401ca6]);}}return this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')]('IspeechASR\x20Result\x20%s',JSON[_0x4840('0x75')](_0x2ffd7c)));}}return _0x2d8f04;};AGIVertices[_0x4840('0x16')][_0x4840('0x15b')]=function(_0x3ee569){logger[_0x4840('0x30')](util[_0x4840('0x2b')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x3ee569[_0x4840('0x3c')]));if(!this[_0x4840('0x87')](_0x3ee569[_0x4840('0x7d')])){return this[_0x4840('0x3a')][_0x4840('0xab')](_0x4840('0xf1'));}if(!this[_0x4840('0x87')](_0x3ee569[_0x4840('0x5d')])){return this[_0x4840('0x3a')][_0x4840('0xab')](_0x4840('0xac'));}this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0x15c'),_0x3ee569[_0x4840('0x5d')]));var _0x273263=this[_0x4840('0x82')]['sync'](this,_0x3ee569);if(_0x273263){this[_0x4840('0x3a')][_0x4840('0xab')](util['format']('ispeech\x20%s\x20file\x20created',_0x273263));var _0xa6beb2=this[_0x4840('0x3a')][_0x4840('0x107')](_0x273263,_0x3ee569[_0x4840('0x13e')]);try{fs['unlink'](_0x273263+_0x4840('0x12b'));}catch(_0x38de57){logger[_0x4840('0x2f')](_0x38de57);}return _0xa6beb2;}return this['channel'][_0x4840('0x2f')](_0x3ee569,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x4840('0x15d')]=function(_0x405c52){logger['info'](util[_0x4840('0x2b')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x405c52['label']));if(!this[_0x4840('0x87')](_0x405c52[_0x4840('0x15e')])){return this[_0x4840('0x3a')]['error'](_0x405c52,_0x4840('0x15f'));}logger[_0x4840('0x30')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x4840('0x3a')][_0x4840('0x3e')],_0x405c52[_0x4840('0x15e')]));var _0x5f0000=this[_0x4840('0x59')][_0x4840('0x72')](this,_0x405c52[_0x4840('0x15e')]);if(_0x5f0000){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x160'),this[_0x4840('0x3a')][_0x4840('0x3e')],_0x405c52['findBy']));this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x4840('0x3a')][_0x4840('0x3e')],_0x405c52[_0x4840('0x15e')]));return{'code':0xc8,'result':_0x4840('0x161')};}else{logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x162'),this['channel'][_0x4840('0x3e')],_0x405c52[_0x4840('0x15e')]));this['channel'][_0x4840('0xab')](util['format'](_0x4840('0x162'),this[_0x4840('0x3a')][_0x4840('0x3e')],_0x405c52['findBy']));return{'code':0xc8,'result':_0x4840('0x163')};}};AGIVertices[_0x4840('0x16')]['logout']=function(_0x2805c5){logger['info'](util[_0x4840('0x2b')](_0x4840('0x164'),_0x2805c5[_0x4840('0x3c')]));if(!this[_0x4840('0x87')](_0x2805c5[_0x4840('0x15e')])){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x2805c5,_0x4840('0x15f'));}logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x165'),this['channel'][_0x4840('0x3e')],_0x2805c5['findBy']));var _0x506381=this[_0x4840('0x55')][_0x4840('0x72')](this,_0x2805c5[_0x4840('0x15e')]);if(_0x506381){logger[_0x4840('0x30')](util['format'](_0x4840('0x160'),this[_0x4840('0x3a')][_0x4840('0x3e')],_0x2805c5['findBy']));this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x4840('0x3a')][_0x4840('0x3e')],_0x2805c5[_0x4840('0x15e')]));return{'code':0xc8,'result':_0x4840('0x161')};}else{logger['info'](util[_0x4840('0x2b')](_0x4840('0x162'),this[_0x4840('0x3a')][_0x4840('0x3e')],_0x2805c5[_0x4840('0x15e')]));this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0x162'),this[_0x4840('0x3a')][_0x4840('0x3e')],_0x2805c5[_0x4840('0x15e')]));return{'code':0xc8,'result':_0x4840('0x163')};}};AGIVertices[_0x4840('0x16')][_0x4840('0x166')]=function(_0xaff497){logger[_0x4840('0x30')](util['format'](_0x4840('0x167'),_0xaff497[_0x4840('0x3c')]));if(!this['isConfigured'](_0xaff497[_0x4840('0x168')])){return this[_0x4840('0x3a')]['error'](_0xaff497,_0x4840('0x169'));}this[_0x4840('0x3a')][_0x4840('0xab')](util['format']('math\x20%s',_0xaff497[_0x4840('0x168')]));var _0x2bd216=eval(_0xaff497[_0x4840('0x168')]);if(!this[_0x4840('0x87')](_0xaff497[_0x4840('0xde')])){return this[_0x4840('0x3a')][_0x4840('0xab')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x574528=this[_0x4840('0x12')][_0x4840('0x72')](this,_0xaff497['variable_id']);if(!_0x574528){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0xaff497,_0x4840('0xe0'));}if(_[_0x4840('0x9c')](_0x2bd216)){var _0x144604=this;_0x2bd216[_0x4840('0xe1')](function(_0x4db36f,_0x5782fd){_0x144604['channel']['setVariable'](util[_0x4840('0x2b')]('%s[%s]',_0x574528,_0x5782fd),_0x4db36f);});return this[_0x4840('0x3a')][_0x4840('0xab')](util['format'](_0x4840('0x16a'),_0x574528));}else{return this[_0x4840('0x3a')]['setVariable'](_0x574528,_0x2bd216);}};AGIVertices[_0x4840('0x16')][_0x4840('0xd')]=function(_0x4a20e9){logger[_0x4840('0x30')](util['format']('Enter\x20in\x20MENU\x20(%s)\x20block',_0x4a20e9[_0x4840('0x3c')]));if(_0x4a20e9[_0x4840('0xa8')]===0x0){return this[_0x4840('0xa7')](_0x4a20e9);}_0x4a20e9['retry']-=0x1;if(!this['isConfigured'](_0x4a20e9['file_id'])){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x4a20e9,_0x4840('0x118'));}var _0x3d3395=this[_0x4840('0x21')][_0x4840('0x72')](this,_0x4a20e9[_0x4840('0x117')]);if(!_0x3d3395){return this['channel'][_0x4840('0x2f')](_0x4a20e9,_0x4840('0x119'));}var _0x378b5b=this[_0x4840('0x3a')][_0x4840('0x11a')](_0x3d3395,_0x4a20e9[_0x4840('0x11b')],_0x4a20e9[_0x4840('0x16b')]);var _0x214ea3=_0x378b5b[_0x4840('0xa5')];if(_0x378b5b[_0x4840('0xa5')]===-0x1){this[_0x4840('0x39')][_0x4840('0x72')](this,_0x4a20e9,'-1');return _0x378b5b;}else if(_0x378b5b['extra']===_0x4840('0x67')){_0x378b5b[_0x4840('0xa5')]=_0x378b5b['result'][_0x4840('0xa1')]>0x0?_0x378b5b[_0x4840('0xa5')]:'t';}else if(_[_0x4840('0x45')](_0x378b5b[_0x4840('0xa5')])){_0x378b5b['result']='#';_0x214ea3='#';}if(!this[_0x4840('0x87')](_0x4a20e9[_0x4840('0xde')])){this['channel']['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x3e3f9f=this[_0x4840('0x12')][_0x4840('0x72')](this,_0x4a20e9[_0x4840('0xde')]);if(!_0x3e3f9f){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x4a20e9,_0x4840('0xe0'));}this[_0x4840('0x3a')][_0x4840('0xa6')](_0x3e3f9f,_0x214ea3);}this[_0x4840('0x39')][_0x4840('0x72')](this,_0x4a20e9,_0x214ea3);return _0x378b5b;};AGIVertices[_0x4840('0x16')][_0x4840('0xab')]=function(_0x446de0){logger['info'](util[_0x4840('0x2b')](_0x4840('0x16c'),_0x446de0[_0x4840('0x3c')]));return this[_0x4840('0x3a')][_0x4840('0xab')](_0x446de0[_0x4840('0x16d')]||_0x446de0['label']);};AGIVertices[_0x4840('0x16')][_0x4840('0x16e')]=function(_0xb7e563){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x16f'),_0xb7e563[_0x4840('0x3c')]));if(!this[_0x4840('0x87')](_0xb7e563[_0x4840('0x15e')])){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0xb7e563,'no\x20find\x20by\x20configured');}logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x165'),this[_0x4840('0x3a')]['callerid'],_0xb7e563[_0x4840('0x15e')]));var _0x3d440c=this[_0x4840('0x50')][_0x4840('0x72')](this,_0xb7e563[_0x4840('0x170')]);var _0x59460a=this[_0x4840('0x53')][_0x4840('0x72')](this,_0xb7e563[_0x4840('0x15e')],_0x3d440c);if(_0x59460a){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x160'),this[_0x4840('0x3a')][_0x4840('0x3e')],_0xb7e563[_0x4840('0x15e')]));this['channel'][_0x4840('0xab')](util[_0x4840('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x4840('0x3e')],_0xb7e563['findBy']));return{'code':0xc8,'result':_0x4840('0x161')};}else{logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x162'),this[_0x4840('0x3a')][_0x4840('0x3e')],_0xb7e563['findBy']));this[_0x4840('0x3a')]['noop'](util['format'](_0x4840('0x160'),this[_0x4840('0x3a')][_0x4840('0x3e')],_0xb7e563['findBy']));return{'code':0xc8,'result':_0x4840('0x163')};}};AGIVertices['prototype'][_0x4840('0x171')]=function(_0x12ff22){logger[_0x4840('0x30')](util[_0x4840('0x2b')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x12ff22['label']));if(!this[_0x4840('0x87')](_0x12ff22[_0x4840('0x117')])){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x12ff22,_0x4840('0x118'));}var _0x4f1189=this['getSound'][_0x4840('0x72')](this,_0x12ff22[_0x4840('0x117')]);if(!_0x4f1189){return this['channel'][_0x4840('0x2f')](_0x12ff22,_0x4840('0x119'));}var _0x3c5eda=this[_0x4840('0x3a')]['exec'](_0x4840('0x172'),[_0x4f1189,_0x12ff22['opts']]);if(_0x3c5eda[_0x4840('0xa5')]===-0x1){return _0x3c5eda;}return this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')]('Executed\x20command\x20%s\x20%s',_0x4840('0x172'),_0x4f1189));};AGIVertices[_0x4840('0x16')][_0x4840('0x173')]=function(_0x167636){logger[_0x4840('0x30')](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x167636[_0x4840('0x3c')]));if(!this[_0x4840('0x87')](_0x167636[_0x4840('0x174')])){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x167636,'no\x20queue\x20selected');}var _0x2eb9e7='';var _0x6ce4a5=parseInt(_0x167636[_0x4840('0x174')],0xa);if(isNaN(_0x6ce4a5)){_0x2eb9e7=_0x167636[_0x4840('0x174')];}else{_0x2eb9e7=this['getVoiceQueue'][_0x4840('0x72')](this,_0x167636[_0x4840('0x174')]);if(!_0x2eb9e7){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x167636,_0x4840('0x175'));}}var _0x6e4720='';if(this['isConfigured'](_0x167636[_0x4840('0x117')])){var _0x2246c5=this[_0x4840('0x21')][_0x4840('0x72')](this,_0x167636['file_id']);if(_0x2246c5){_0x6e4720=_0x2246c5;}}this[_0x4840('0x39')][_0x4840('0x72')](this,_0x167636,_0x2eb9e7);if(_0x167636['opts'][_0x4840('0x176')]('x')<0x0){_0x167636[_0x4840('0x114')]+='x';}if(_0x167636['opts']['indexOf']('X')<0x0){_0x167636[_0x4840('0x114')]+='X';}this['channel'][_0x4840('0xa6')](_0x4840('0x177'),_0x2eb9e7?_0x2eb9e7[_0x4840('0x178')]():'');var _0x1095c6=this[_0x4840('0x3a')][_0x4840('0x5b')]('QUEUE',[_0x2eb9e7,_0x167636['opts'],_0x167636[_0x4840('0x64')],_0x6e4720,_0x167636[_0x4840('0x67')],_0x167636[_0x4840('0x9')],_0x167636['macro'],_0x167636[_0x4840('0x179')],'',_0x167636[_0x4840('0x17a')]]);if(_0x1095c6[_0x4840('0xa5')]===-0x1){return _0x1095c6;}return this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0xc7'),_0x4840('0x17b'),_0x2eb9e7));};AGIVertices[_0x4840('0x16')][_0x4840('0x17c')]=function(_0x27898f){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x17d'),_0x27898f[_0x4840('0x3c')]));var _0x57b637=_0x27898f[_0x4840('0x17e')]||_0x4840('0x13a');var _0x41b7b2=util[_0x4840('0x2b')](_0x4840('0x17f'),this['channel']['uniqueid'],rs[_0x4840('0x120')](0x5));var _0x727207=util['format']('%s/recordings/%s.%s',FILES_PATH,_0x41b7b2,_0x57b637);var _0x5e2d0b=util[_0x4840('0x2b')](_0x4840('0x13b'),FILES_PATH,_0x41b7b2);this[_0x4840('0x3f')][_0x4840('0x72')](this,_0x27898f,_0x41b7b2,_0x727207);this[_0x4840('0x3a')][_0x4840('0xa6')](_0x4840('0x180'),_0x41b7b2);logger['info'](_0x4840('0x181'),_0x5e2d0b,_0x57b637,_0x27898f['escape_digits'],_0x27898f['timeout']);return this[_0x4840('0x3a')][_0x4840('0x13d')](_0x5e2d0b,_0x57b637,_0x27898f[_0x4840('0x182')],_0x27898f['timeout'],undefined,!![]);};AGIVertices[_0x4840('0x16')]['restapi']=function(_0x4e4cf6){logger[_0x4840('0x30')](util['format'](_0x4840('0x183'),_0x4e4cf6['label']));if(!this[_0x4840('0x87')](_0x4e4cf6[_0x4840('0x64')])){return this[_0x4840('0x3a')][_0x4840('0xab')](_0x4840('0x184'));}var _0x4541bb=this['restAPI'][_0x4840('0x72')](this,_0x4e4cf6);logger['info'](util[_0x4840('0x2b')]('Response:',util['inspect'](_0x4541bb,{'showHidden':![],'depth':null})));if(!this[_0x4840('0x87')](_0x4e4cf6['variable_id'])){return this[_0x4840('0x3a')][_0x4840('0xab')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x424c21=this['getVariable'][_0x4840('0x72')](this,_0x4e4cf6[_0x4840('0xde')]);if(!_0x424c21){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x4e4cf6,_0x4840('0xe0'));}this['channel']['setVariable'](util[_0x4840('0x2b')](_0x4840('0x185'),_0x424c21),_0x4541bb['statusCode']?_0x4541bb[_0x4840('0x78')]:_0x4840('0x186'));this[_0x4840('0x3a')]['setVariable'](util['format'](_0x4840('0x187'),_0x424c21),_0x4541bb[_0x4840('0x79')]?_0x4541bb[_0x4840('0x79')]:'OK');if(_0x4541bb[_0x4840('0x76')]){try{this[_0x4840('0x9e')](_0x4541bb[_0x4840('0x76')],_0x424c21);}catch(_0x1ada87){logger[_0x4840('0x2f')](util[_0x4840('0x2b')](_0x4840('0x188'),_0x424c21));}}return this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0xe5'),_0x424c21));};AGIVertices[_0x4840('0x16')][_0x4840('0x189')]=function(_0x51f79d){logger[_0x4840('0x30')](util[_0x4840('0x2b')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x51f79d[_0x4840('0x3c')]));return this[_0x4840('0x3a')]['sayDigits'](_0x51f79d[_0x4840('0x18a')]['replace'](/\s+/g,''),_0x51f79d[_0x4840('0x182')]);};AGIVertices[_0x4840('0x16')][_0x4840('0x18b')]=function(_0x4eb432){logger['info'](util[_0x4840('0x2b')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x4eb432[_0x4840('0x3c')]));return this[_0x4840('0x3a')][_0x4840('0x18c')](_0x4eb432[_0x4840('0x66')][_0x4840('0xdc')](/\s+/g,''),_0x4eb432[_0x4840('0x182')]);};AGIVertices[_0x4840('0x16')][_0x4840('0x18d')]=function(_0x18301b){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x18e'),_0x18301b[_0x4840('0x3c')]));return this[_0x4840('0x3a')][_0x4840('0x18f')](_0x18301b[_0x4840('0x5d')],_0x18301b[_0x4840('0x182')]);};AGIVertices[_0x4840('0x16')][_0x4840('0x190')]=function(_0x3e57cc){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x191'),_0x3e57cc[_0x4840('0x3c')]));if(!this['isConfigured'](_0x3e57cc[_0x4840('0x192')])){return this[_0x4840('0x3a')][_0x4840('0xab')](_0x4840('0x193'));}var _0x1c43c6=this['getMailAccount']['sync'](this,_0x3e57cc[_0x4840('0x192')]);if(!_0x1c43c6||!_0x1c43c6['Smtp']){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x3e57cc,_0x4840('0x194'));}var _0x52480e={'from':util[_0x4840('0x2b')](_0x4840('0x195'),_0x1c43c6[_0x4840('0x14')],_0x1c43c6['email']||_0x1c43c6[_0x4840('0x196')][_0x4840('0x197')]),'to':_0x3e57cc['to']||'','cc':_0x3e57cc['cc']||'','bcc':_0x3e57cc[_0x4840('0x198')]||'','subject':_0x3e57cc[_0x4840('0x199')],'html':_0x3e57cc[_0x4840('0x5d')],'text':_0x3e57cc[_0x4840('0x5d')]};var _0x483ba9={'tls':{'rejectUnauthorized':![]}};if(_0x1c43c6[_0x4840('0x196')][_0x4840('0x19a')]){_0x483ba9['service']=_0x1c43c6[_0x4840('0x196')][_0x4840('0x19a')];}else{_0x483ba9['host']=_0x1c43c6[_0x4840('0x196')]['host'];_0x483ba9['port']=_0x1c43c6[_0x4840('0x196')]['port'];_0x483ba9[_0x4840('0x19b')]=_0x1c43c6['Smtp'][_0x4840('0x19b')];}if(_0x1c43c6[_0x4840('0x196')][_0x4840('0x19c')]){_0x483ba9[_0x4840('0x19d')]={'user':_0x1c43c6['Smtp'][_0x4840('0x197')],'pass':_0x1c43c6['Smtp']['pass']};}if(this[_0x4840('0x87')](_0x3e57cc[_0x4840('0x19e')])){}logger[_0x4840('0xe7')](_0x4840('0x19f'),JSON[_0x4840('0x75')](_0x52480e));this[_0x4840('0x39')][_0x4840('0x72')](this,_0x3e57cc,_0x3e57cc[_0x4840('0x192')]);this['channel'][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0x1a0'),_0x1c43c6[_0x4840('0x14')]));this[_0x4840('0x25')]['sync'](this,_0x483ba9,_0x52480e);return this[_0x4840('0x3a')]['noop'](_0x4840('0x1a1'));};AGIVertices[_0x4840('0x16')][_0x4840('0x1a2')]=function(_0x5866a4){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x1a3'),_0x5866a4[_0x4840('0x3c')]));return this[_0x4840('0x3a')]['noop'](_0x4840('0x1a4'));};AGIVertices[_0x4840('0x16')]['sendSMS']=function(_0x4cccd0){logger[_0x4840('0x30')](util[_0x4840('0x2b')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x4cccd0['label']));if(!this[_0x4840('0x87')](_0x4cccd0[_0x4840('0x1a5')])){return this[_0x4840('0x3a')][_0x4840('0xab')]('no\x20sms\x20account\x20configured');}var _0xc8ec17=this[_0x4840('0x36')][_0x4840('0x72')](this,_0x4cccd0['sms_account_id']);if(!_0xc8ec17){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x4cccd0,_0x4840('0x1a6'));}var _0x384f73={'body':_0x4cccd0[_0x4840('0x1a7')],'phone':_0x4cccd0['to']||'','SmsAccountId':_0xc8ec17['id']};logger['debug'](_0x4840('0x1a8'),JSON['stringify'](_0x384f73));this[_0x4840('0x39')][_0x4840('0x72')](this,_0x4cccd0,_0x4cccd0['sms_account_id']);this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0x1a9'),_0xc8ec17[_0x4840('0x14')]));this[_0x4840('0x38')][_0x4840('0x72')](this,_0x384f73);return this[_0x4840('0x3a')][_0x4840('0xab')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype']['set']=function(_0x1275b4){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x1aa'),_0x1275b4['label']));if(!this[_0x4840('0x87')](_0x1275b4[_0x4840('0xde')])){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x1275b4,'no\x20variable\x20selected');}var _0x26bee0=this[_0x4840('0x12')][_0x4840('0x72')](this,_0x1275b4[_0x4840('0xde')]);if(!_0x26bee0){return this[_0x4840('0x3a')]['error'](_0x1275b4,_0x4840('0xe0'));}return this[_0x4840('0x3a')][_0x4840('0xa6')](_0x26bee0,_0x1275b4[_0x4840('0x1ab')]);};AGIVertices[_0x4840('0x16')]['start']=function(_0x7f10bf){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x1ac'),_0x7f10bf['label']));this['channel']['noop'](_0x4840('0x1ad'));if(_0x7f10bf[_0x4840('0xba')]===_0x4840('0x1ae')){this[_0x4840('0x3a')][_0x4840('0xab')](_0x4840('0x1af'));return this['channel']['answer']();}return this[_0x4840('0x3a')][_0x4840('0xab')](_0x4840('0x1b0'));};AGIVertices[_0x4840('0x16')]['subproject']=function(_0x217c8e){logger[_0x4840('0x30')](util['format']('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x217c8e[_0x4840('0x3c')]));if(!this[_0x4840('0x87')](_0x217c8e[_0x4840('0x1b1')])){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x217c8e,_0x4840('0x1b2'));}var _0x561a80=this[_0x4840('0x19')][_0x4840('0x72')](this,_0x217c8e[_0x4840('0x1b1')]);if(!this[_0x4840('0x87')](_0x561a80)){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x217c8e,util[_0x4840('0x2b')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x217c8e[_0x4840('0x1b1')]));}if(_0x561a80===this[_0x4840('0x3a')][_0x4840('0x3d')]){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x217c8e,_0x4840('0x1b3'));}this['createSquareDetailsReport'][_0x4840('0x72')](this,_0x217c8e,_0x561a80);var _0x4e487c=this[_0x4840('0x3a')][_0x4840('0x5b')]('AGI',util[_0x4840('0x2b')](_0x4840('0x1b4'),config['agi'][_0x4840('0x1b5')]||_0x4840('0x1b6'),_0x561a80,this['channel']['arg_1']));if(_0x4e487c[_0x4840('0xa5')]===-0x1){return _0x4e487c;}return this[_0x4840('0x3a')]['noop'](util[_0x4840('0x2b')](_0x4840('0xc7'),_0x4840('0x1b7'),_0x561a80));};AGIVertices[_0x4840('0x16')]['system']=function(_0x1f0369){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x1b8'),_0x1f0369[_0x4840('0x3c')]));var _0x840799=this[_0x4840('0x5a')][_0x4840('0x72')](this,_0x1f0369[_0x4840('0xb8')]);this[_0x4840('0x39')][_0x4840('0x72')](this,_0x1f0369,_0x1f0369[_0x4840('0xb8')]);if(this[_0x4840('0x87')](_0x1f0369[_0x4840('0xde')])){var _0x1b768f=this[_0x4840('0x12')][_0x4840('0x72')](this,_0x1f0369[_0x4840('0xde')]);if(_0x1b768f){this[_0x4840('0x3a')][_0x4840('0xa6')](_0x1b768f,_0x840799);return this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0x1b9'),_0x1f0369[_0x4840('0xb8')],_0x1b768f));}}return this['channel'][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0x1ba'),_0x1f0369[_0x4840('0xb8')]));};AGIVertices[_0x4840('0x16')]['google_cloud_tts']=function(_0x43b61d){logger[_0x4840('0x30')](util[_0x4840('0x2b')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x43b61d['label']));_0x43b61d['text']=_0x43b61d[_0x4840('0x5d')][_0x4840('0xdc')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x4840('0x87')](_0x43b61d[_0x4840('0x1bb')])){return this['channel'][_0x4840('0xab')](_0x4840('0x1bc'));}if(!this[_0x4840('0x87')](_0x43b61d[_0x4840('0x5d')])){return this['channel'][_0x4840('0xab')](_0x4840('0xac'));}this['channel'][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0x1bd'),_0x43b61d[_0x4840('0x5d')]));var _0x1138f9=this['googleCloudTTS'][_0x4840('0x72')](this,_0x43b61d);if(_0x1138f9){this[_0x4840('0x3a')]['noop'](util[_0x4840('0x2b')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x1138f9));var _0x56c677=this['channel'][_0x4840('0x107')](_0x1138f9);try{fs[_0x4840('0x109')](_0x1138f9+_0x4840('0x12b'));}catch(_0x332cd8){logger[_0x4840('0x2f')](_0x332cd8);}return _0x56c677;}return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x43b61d,_0x4840('0x1be'));};AGIVertices[_0x4840('0x16')][_0x4840('0x1bf')]=function(_0x23ded5){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x1c0'),_0x23ded5[_0x4840('0x3c')]));_0x23ded5[_0x4840('0x5d')]=_0x23ded5[_0x4840('0x5d')][_0x4840('0xdc')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x4840('0x87')](_0x23ded5[_0x4840('0x5d')])){return this['channel'][_0x4840('0xab')]('no\x20text\x20configured');}this[_0x4840('0x3a')][_0x4840('0xab')](util['format'](_0x4840('0x1c1'),_0x23ded5[_0x4840('0x5d')]));var _0x2d95a4=this['googleTTS'][_0x4840('0x72')](this,_0x23ded5);if(_0x2d95a4){this[_0x4840('0x3a')][_0x4840('0xab')](util['format']('Google\x20TTS\x20%s\x20file\x20created',_0x2d95a4));var _0xbcf7b3=this[_0x4840('0x3a')][_0x4840('0x107')](_0x2d95a4);try{fs['unlink'](_0x2d95a4+_0x4840('0x12b'));}catch(_0x353299){logger[_0x4840('0x2f')](_0x353299);}return _0xbcf7b3;}return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x23ded5,_0x4840('0x1c2'));};AGIVertices['prototype']['unpause']=function(_0xf3a055){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x1c3'),_0xf3a055['label']));if(!this[_0x4840('0x87')](_0xf3a055[_0x4840('0x15e')])){return this['channel'][_0x4840('0x2f')](_0xf3a055,'no\x20find\x20by\x20configured');}logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x165'),this['channel'][_0x4840('0x3e')],_0xf3a055[_0x4840('0x15e')]));var _0x481a5f=this['agentUnpause'][_0x4840('0x72')](this,_0xf3a055['findBy']);if(_0x481a5f){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x160'),this[_0x4840('0x3a')][_0x4840('0x3e')],_0xf3a055['findBy']));this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0x160'),this[_0x4840('0x3a')][_0x4840('0x3e')],_0xf3a055[_0x4840('0x15e')]));return{'code':0xc8,'result':_0x4840('0x161')};}else{logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x162'),this['channel']['callerid'],_0xf3a055[_0x4840('0x15e')]));this['channel'][_0x4840('0xab')](util['format'](_0x4840('0x162'),this['channel']['callerid'],_0xf3a055[_0x4840('0x15e')]));return{'code':0xc8,'result':_0x4840('0x163')};}};AGIVertices[_0x4840('0x16')]['voicemail']=function(_0x1dff7f){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x1c4'),_0x1dff7f[_0x4840('0x3c')]));var _0x274d89=this[_0x4840('0x3a')]['exec'](_0x4840('0x1c5'),[_0x1dff7f[_0x4840('0x1c6')],_0x1dff7f[_0x4840('0x7b')]]);if(_0x274d89['result']===-0x1){return _0x274d89;}return this[_0x4840('0x3a')]['noop'](util['format'](_0x4840('0xc7'),_0x4840('0x1c5'),_0x1dff7f['mailbox']));};AGIVertices[_0x4840('0x16')]['vswitch']=function(_0x3c7fe3){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x1c7'),_0x3c7fe3[_0x4840('0x3c')]));if(!this[_0x4840('0x87')](_0x3c7fe3[_0x4840('0xde')])){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x3c7fe3,_0x4840('0x1c8'));}var _0x3a1568=this[_0x4840('0x12')][_0x4840('0x72')](this,_0x3c7fe3[_0x4840('0xde')]);if(!_0x3a1568){return this['channel']['error'](_0x3c7fe3,_0x4840('0xe0'));}var _0x1454f0=this[_0x4840('0x3a')]['getVariable'](_0x3a1568);return{'code':0xc8,'result':_0x1454f0[_0x4840('0xa3')]?_0x1454f0[_0x4840('0xa3')]:'-'};};String[_0x4840('0x16')][_0x4840('0xa2')]=function(_0x4e151b,_0x10645b){return this[_0x4840('0xa0')](_0x4e151b)[_0x4840('0x1c9')](_0x10645b);};module[_0x4840('0x1ca')]=AGIVertices; \ No newline at end of file +var _0xdaf2=['VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','util','lodash','odbc','randomstring','moment','mustache','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','rawBody','menu','getdigits','getsecretdigits','channel','rpc','getVariable','getVariableById','name','catch','getVoiceQueue','then','prototype','getSquareProject','getSquareOdbc','getSquareOdbcById','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','sendMailMessage','getIntervals','getIntervalById','IntervalId','map','Intervals','interval','format','%s/sounds/converted/%s','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','query','info','Error\x20executing\x20query\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agent','error','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','agentLogin','shellCommand','exec','trim','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','googleTTS','google_tts_language','restAPI','url','method','timeout','number','POST','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','stringify','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','speed','ispeechASR','ispeech_asr_language','isConfigured','model','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','includes','clone','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','isPlainObject','length','saveRestApiResult','%s.%s','isArray','setVariable','replaceObjectAllVariables','split','replaceAll','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','sync','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','options','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','getUser','no\x20user\x20found','SIP/%s','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','Dialogflow\x20Result\x20%s','speech','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','SIP/%s/%s','phone','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','getData','response','maxdigit','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','awsPolly','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','no\x20key\x20configured','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','continueAt','extension','priority','gotoif','condition','true','false','gotoiftime','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','FIND\x20AGENT\x20%s\x20BY\x20%s','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','digit','output','pause','pause_id','agentPause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','inspect','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','replace','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','\x22%s\x22\x20<%s>','email','user','bcc','subject','Smtp','service','host','port','secure','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','googleCloudTTS','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail'];(function(_0x846eb,_0x520889){var _0x4b74e9=function(_0x1e056f){while(--_0x1e056f){_0x846eb['push'](_0x846eb['shift']());}};_0x4b74e9(++_0x520889);}(_0xdaf2,0x1cf));var _0x2daf=function(_0x1f6f84,_0x2bab55){_0x1f6f84=_0x1f6f84-0x0;var _0x177f40=_0xdaf2[_0x1f6f84];return _0x177f40;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x2daf('0x0'));var _=require(_0x2daf('0x1'));var sh=require('shelljs');var odbc=require(_0x2daf('0x2'))();var rs=require(_0x2daf('0x3'));var moment=require(_0x2daf('0x4'));var Mustache=require(_0x2daf('0x5'));var rp=require('request-promise');var logger=require(_0x2daf('0x6'))(_0x2daf('0x7'));var config=require(_0x2daf('0x8'));var scripts=require('./scripts');var FILES_PATH=_0x2daf('0x9');var recursiveMapAttributes=['rawHeaders',_0x2daf('0xa')];var verticesWithRetry=[_0x2daf('0xb'),_0x2daf('0xc'),_0x2daf('0xd')];var AGIVertices=function(_0xd0fd9c,_0x42e4a6,_0x3f8992){this[_0x2daf('0xe')]=_0xd0fd9c;this[_0x2daf('0xf')]=_0x42e4a6;this['mailRpc']=_0x3f8992;};AGIVertices['prototype'][_0x2daf('0x10')]=function(_0x85008d,_0x63a169){this[_0x2daf('0xf')][_0x2daf('0x11')](_0x85008d)['then'](function(_0x8d2540){_0x63a169(null,_0x8d2540?_0x8d2540[_0x2daf('0x12')]:![]);})[_0x2daf('0x13')](function(_0x4cb364){_0x63a169(_0x4cb364);});};AGIVertices['prototype'][_0x2daf('0x14')]=function(_0x331ac1,_0x48fdf0){this[_0x2daf('0xf')]['getVoiceQueueById'](_0x331ac1)[_0x2daf('0x15')](function(_0x58aba2){_0x48fdf0(null,_0x58aba2?_0x58aba2[_0x2daf('0x12')]:![]);})[_0x2daf('0x13')](function(_0x5f1e86){_0x48fdf0(_0x5f1e86);});};AGIVertices[_0x2daf('0x16')][_0x2daf('0x17')]=function(_0x1ab102,_0x13a472){this[_0x2daf('0xf')]['getSquareProjectById'](_0x1ab102)[_0x2daf('0x15')](function(_0x12e61f){_0x13a472(null,_0x12e61f?_0x12e61f[_0x2daf('0x12')]:![]);})[_0x2daf('0x13')](function(_0x461268){_0x13a472(_0x461268);});};AGIVertices[_0x2daf('0x16')][_0x2daf('0x18')]=function(_0x1145a2,_0x4de970){this['rpc'][_0x2daf('0x19')](_0x1145a2)[_0x2daf('0x15')](function(_0x110923){_0x4de970(null,_0x110923?_0x110923['dsn']:![]);})[_0x2daf('0x13')](function(_0x978127){_0x4de970(_0x978127);});};AGIVertices[_0x2daf('0x16')]['getUser']=function(_0x79e8bf,_0x9c15d0){this['rpc'][_0x2daf('0x1a')](_0x79e8bf)[_0x2daf('0x15')](function(_0x351573){_0x9c15d0(null,_0x351573?_0x351573[_0x2daf('0x12')]:![]);})[_0x2daf('0x13')](function(_0x1415d8){_0x9c15d0(_0x1415d8);});};AGIVertices[_0x2daf('0x16')][_0x2daf('0x1b')]=function(_0x3e77f8,_0x8e0082){this[_0x2daf('0xf')][_0x2daf('0x1c')](_0x3e77f8)[_0x2daf('0x15')](function(_0x4dcdd2){_0x8e0082(null,_0x4dcdd2?_0x4dcdd2[_0x2daf('0x12')]:![]);})[_0x2daf('0x13')](function(_0x2d27f7){_0x8e0082(_0x2d27f7);});};AGIVertices[_0x2daf('0x16')][_0x2daf('0x1d')]=function(_0x1ca012,_0x4a8dc3){var _0x2429df=this;this[_0x2daf('0xf')][_0x2daf('0x1e')](_0x1ca012)[_0x2daf('0x15')](function(_0x5325fa){_0x4a8dc3(null,_0x5325fa?_0x2429df[_0x2daf('0x1f')](_0x5325fa[_0x2daf('0x20')]):![]);})['catch'](function(_0x538023){_0x4a8dc3(_0x538023);});};AGIVertices[_0x2daf('0x16')]['getMailAccount']=function(_0x3e9847,_0x161952){this[_0x2daf('0xf')]['getMailAccountById'](_0x3e9847)[_0x2daf('0x15')](function(_0x159406){_0x161952(null,_0x159406?_0x159406:![]);})['catch'](function(_0x1d1827){_0x161952(_0x1d1827);});};AGIVertices[_0x2daf('0x16')]['sendMailMessage']=function(_0x430ab2,_0x1fb6f5,_0x1b094e){this['mailRpc'][_0x2daf('0x21')](_0x430ab2,_0x1fb6f5)['then'](function(){_0x1b094e(null);})[_0x2daf('0x13')](function(_0x1eaa80){_0x1b094e(_0x1eaa80);});};AGIVertices[_0x2daf('0x16')][_0x2daf('0x22')]=function(_0x188b41,_0x5781ba){this[_0x2daf('0xf')][_0x2daf('0x23')](_0x188b41)[_0x2daf('0x15')](function(_0x21c5e6){if(_0x21c5e6){if(_0x21c5e6[_0x2daf('0x24')]){_0x5781ba(null,[_0x21c5e6['interval']]);}else{_0x5781ba(null,_[_0x2daf('0x25')](_0x21c5e6[_0x2daf('0x26')],_0x2daf('0x27')));}}else{_0x5781ba(null,![]);}})[_0x2daf('0x13')](function(_0x372101){_0x5781ba(_0x372101);});};AGIVertices[_0x2daf('0x16')][_0x2daf('0x1f')]=function(_0x29deb4){return util[_0x2daf('0x28')](_0x2daf('0x29'),FILES_PATH,_0x29deb4);};AGIVertices[_0x2daf('0x16')][_0x2daf('0x2a')]=function(_0x5094c6,_0x44b834,_0x629c55){odbc[_0x2daf('0x2b')](_0x5094c6,function(_0x4fd38d){if(_0x4fd38d){logger['error'](_0x2daf('0x2c'),_0x4fd38d);_0x629c55(_0x4fd38d);}else{logger['info']('ODBC\x20connection\x20successfully');odbc[_0x2daf('0x2d')](_0x44b834,function(_0x219beb,_0x364f46){if(_0x219beb){logger[_0x2daf('0x2e')](_0x2daf('0x2f'),_0x44b834);_0x629c55(_0x219beb);}else{logger[_0x2daf('0x2e')]('Query\x20executed\x20correctly\x20%s',_0x44b834);odbc['close'](function(_0x4d6d0f){if(_0x4d6d0f){logger['error'](_0x2daf('0x30'),_0x4d6d0f);}_0x629c55(null,_0x364f46);});}});}});};AGIVertices[_0x2daf('0x16')][_0x2daf('0x31')]=function(_0x46438e,_0x292b4a){this[_0x2daf('0xf')][_0x2daf('0x32')](_0x46438e)[_0x2daf('0x15')](function(_0x43e72c){_0x292b4a(null,_0x43e72c?_0x43e72c:![]);})[_0x2daf('0x13')](function(_0xf83ec4){_0x292b4a(_0xf83ec4);});};AGIVertices['prototype'][_0x2daf('0x33')]=function(_0x30fcaa,_0x3c444b){this['rpc'][_0x2daf('0x33')](_0x30fcaa)[_0x2daf('0x15')](function(_0x1adbe3){_0x3c444b(null,_0x1adbe3);})[_0x2daf('0x13')](function(_0xccf4c){_0x3c444b(_0xccf4c);});};AGIVertices[_0x2daf('0x16')][_0x2daf('0x34')]=function(_0x2be007,_0x1fe27a,_0x3792a2){this[_0x2daf('0xf')][_0x2daf('0x34')]({'uniqueid':this[_0x2daf('0xe')][_0x2daf('0x35')],'node':_0x2be007[_0x2daf('0x36')],'application':_0x2be007[_0x2daf('0x37')],'data':_0x1fe27a||null,'project_name':this[_0x2daf('0xe')][_0x2daf('0x38')],'callerid':this[_0x2daf('0xe')][_0x2daf('0x39')]})[_0x2daf('0x15')](function(_0x22612e){if(_0x3792a2){_0x3792a2(null,_0x22612e);}})[_0x2daf('0x13')](function(_0x2dcad7){if(_0x3792a2){_0x3792a2(_0x2dcad7);}});};AGIVertices['prototype'][_0x2daf('0x3a')]=function(_0xcf8be2,_0x4331a9,_0x53efec,_0x5db090){this['rpc'][_0x2daf('0x3a')]({'uniqueid':this[_0x2daf('0xe')]['uniqueid'],'callerid':this[_0x2daf('0xe')][_0x2daf('0x39')],'calleridname':this[_0x2daf('0xe')][_0x2daf('0x3b')],'context':this[_0x2daf('0xe')][_0x2daf('0x3c')],'extension':this[_0x2daf('0xe')]['extension'],'priority':this[_0x2daf('0xe')]['priority'],'accountcode':this[_0x2daf('0xe')][_0x2daf('0x3d')],'dnid':this[_0x2daf('0xe')][_0x2daf('0x3e')],'projectName':this[_0x2daf('0xe')][_0x2daf('0x38')],'saveName':_0x4331a9,'filename':_0xcf8be2[_0x2daf('0x3f')]||_0x4331a9,'savePath':_0x53efec})[_0x2daf('0x15')](function(_0x513349){_0x5db090(null,_0x513349);})[_0x2daf('0x13')](function(_0x340ffb){_0x5db090(_0x340ffb);});};AGIVertices[_0x2daf('0x16')][_0x2daf('0x40')]=function(_0x4dbc8c,_0x285c41,_0x144b51,_0x5735bf,_0x230542){this['rpc'][_0x2daf('0x40')]({'uniqueid':this['channel'][_0x2daf('0x35')],'body':_0x4dbc8c,'direction':_0x285c41,'providerName':_0x144b51,'providerResponse':_0x5735bf})['then'](function(_0x12aa06){if(_0x230542){_0x230542(null,_0x12aa06);}})['catch'](function(_0x359635){if(_0x230542){_0x230542(_0x359635);}});};AGIVertices[_0x2daf('0x16')][_0x2daf('0x41')]=function(_0x3ab265,_0x31386e){this['rpc'][_0x2daf('0x41')]({'firstName':_[_0x2daf('0x42')](_0x3ab265[_0x2daf('0x12')])||_[_0x2daf('0x43')](_0x3ab265['name'])?_0x2daf('0x44')+Math[_0x2daf('0x45')]():_0x3ab265[_0x2daf('0x12')],'lastName':_[_0x2daf('0x42')](_0x3ab265[_0x2daf('0x46')])||_[_0x2daf('0x43')](_0x3ab265[_0x2daf('0x46')])?null:_0x3ab265[_0x2daf('0x46')],'phone':_0x3ab265['phone'],'ListId':_0x3ab265['list_id'],'scheduledat':_0x3ab265[_0x2daf('0x47')],'callbackUniqueid':this[_0x2daf('0xe')][_0x2daf('0x35')],'tags':'callback','description':_0x2daf('0x48')+_0x3ab265[_0x2daf('0x47')][_0x2daf('0x49')](),'priority':_0x3ab265[_0x2daf('0x4a')]})[_0x2daf('0x15')](function(_0x11ffc2){_0x31386e(null,_0x11ffc2);})[_0x2daf('0x13')](function(_0x33460e){_0x31386e(_0x33460e);});};AGIVertices[_0x2daf('0x16')][_0x2daf('0x4b')]=function(_0x302ccc,_0x41e534){this[_0x2daf('0xf')][_0x2daf('0x4c')](_0x302ccc)['then'](function(_0x1e7407){_0x41e534(null,_0x1e7407?_0x1e7407[_0x2daf('0x12')]:![]);})[_0x2daf('0x13')](function(_0x2cd368){_0x41e534(_0x2cd368);});};AGIVertices[_0x2daf('0x16')]['agentPause']=function(_0x5e00f3,_0xa1bcb6,_0x3707a4){var _0x430c37={'role':_0x2daf('0x4d')};_0x430c37[_0x5e00f3]=this['channel']['callerid'];this[_0x2daf('0xf')]['agentPause'](_0x430c37,_0xa1bcb6,this[_0x2daf('0xe')][_0x2daf('0x35')])[_0x2daf('0x15')](function(_0x4c00ce){_0x3707a4(null,_[_0x2daf('0x43')](_0x4c00ce)?![]:!![]);})[_0x2daf('0x13')](function(_0x3a33bf){logger[_0x2daf('0x4e')](_0x3a33bf);_0x3707a4(null,![]);});};AGIVertices[_0x2daf('0x16')][_0x2daf('0x4f')]=function(_0x5efe2a,_0x126453){var _0x97572a={'role':_0x2daf('0x4d')};_0x97572a[_0x5efe2a]=this[_0x2daf('0xe')][_0x2daf('0x39')];this[_0x2daf('0xf')][_0x2daf('0x4f')](_0x97572a)[_0x2daf('0x15')](function(_0x47132f){_0x126453(null,_[_0x2daf('0x43')](_0x47132f)?![]:!![]);})[_0x2daf('0x13')](function(_0x5b12ef){logger[_0x2daf('0x4e')](_0x5b12ef);_0x126453(null,![]);});};AGIVertices['prototype'][_0x2daf('0x50')]=function(_0x1e7c07,_0x54c62d){var _0x35f168={'role':_0x2daf('0x4d')};_0x35f168[_0x1e7c07]=this[_0x2daf('0xe')][_0x2daf('0x39')];this[_0x2daf('0xf')][_0x2daf('0x50')](_0x35f168)[_0x2daf('0x15')](function(_0x121ce1){_0x54c62d(null,_[_0x2daf('0x43')](_0x121ce1)?![]:!![]);})[_0x2daf('0x13')](function(_0x4c30ca){logger[_0x2daf('0x4e')](_0x4c30ca);_0x54c62d(null,![]);});};AGIVertices[_0x2daf('0x16')]['agentLogin']=function(_0x5d931d,_0x390d33){var _0x4836a3={'role':_0x2daf('0x4d')};_0x4836a3[_0x5d931d]=this[_0x2daf('0xe')][_0x2daf('0x39')];var _0x52f1cf=_0x5d931d!=_0x2daf('0x51')?util[_0x2daf('0x28')](_0x2daf('0x52'),'LOCAL',this[_0x2daf('0xe')][_0x2daf('0x39')]):undefined;this[_0x2daf('0xf')][_0x2daf('0x53')](_0x4836a3,_0x52f1cf)[_0x2daf('0x15')](function(_0x417718){_0x390d33(null,_['isNil'](_0x417718)?![]:!![]);})[_0x2daf('0x13')](function(_0x3a3791){logger[_0x2daf('0x4e')](_0x3a3791);_0x390d33(null,![]);});};AGIVertices[_0x2daf('0x16')][_0x2daf('0x54')]=function(_0x442b5f,_0x3c44f7){sh[_0x2daf('0x55')](_[_0x2daf('0x56')](_0x442b5f),function(_0x2f40c3,_0x116757){var _0x473fb9=_0x116757['replace'](/(\r\n|\n|\r)/gm,'');_0x3c44f7(null,_0x473fb9);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x213924,_0x14996c){scripts['googleCloudTTS'](_0x213924[_0x2daf('0x57')],_0x213924[_0x2daf('0x58')]||_0x2daf('0x59'),_0x213924[_0x2daf('0x59')],_0x213924[_0x2daf('0x5a')]||_0x2daf('0x5b'),_0x213924[_0x2daf('0x5c')]||_0x2daf('0x5d'),_0x213924['audioEncoding']||'MP3')['then'](function(_0x2f1fce){_0x14996c(null,_0x2f1fce);})[_0x2daf('0x13')](function(_0x3e89ec){_0x14996c(_0x3e89ec);});};AGIVertices['prototype'][_0x2daf('0x5e')]=function(_0x2d3c6d,_0x33bc9a){scripts[_0x2daf('0x5e')](_0x2d3c6d[_0x2daf('0x59')],_0x2d3c6d[_0x2daf('0x5f')]||'en',0x1)[_0x2daf('0x15')](function(_0x15eaae){_0x33bc9a(null,_0x15eaae);})[_0x2daf('0x13')](function(_0x4a865d){_0x33bc9a(_0x4a865d);});};AGIVertices[_0x2daf('0x16')][_0x2daf('0x60')]=function(_0x2fc551,_0x284120){var _0x41b684={'uri':_0x2fc551[_0x2daf('0x61')],'method':_0x2fc551[_0x2daf('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x2fc551[_0x2daf('0x63')])===_0x2daf('0x64')&&parseInt(_0x2fc551[_0x2daf('0x63')])>=0x1?parseInt(_0x2fc551[_0x2daf('0x63')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x2daf('0x65'),'PUT'],_0x41b684[_0x2daf('0x62')][_0x2daf('0x66')]())){try{_0x41b684[_0x2daf('0x67')]=_0x2fc551['rawBody']?JSON[_0x2daf('0x68')](_0x2fc551[_0x2daf('0xa')]):{};}catch(_0x5bdf59){logger['error'](_0x2daf('0x69'),_0x5bdf59);}}try{_0x41b684[_0x2daf('0x6a')]=_0x2fc551[_0x2daf('0x6b')]?JSON[_0x2daf('0x68')](_0x2fc551[_0x2daf('0x6b')]):{};}catch(_0x517083){logger[_0x2daf('0x4e')](_0x2daf('0x6c'),_0x517083);}if(_0x2fc551[_0x2daf('0x6d')]){try{var _0x543603=require(_0x2fc551[_0x2daf('0x6d')])['sync'](this,_0x41b684);_0x41b684[_0x2daf('0x6e')]=Mustache[_0x2daf('0x6f')](_0x2fc551[_0x2daf('0x61')],_0x543603,{},['$$','$$']);if(_0x41b684['headers']){_0x41b684[_0x2daf('0x6a')]=JSON[_0x2daf('0x68')](Mustache['render'](JSON['stringify'](_0x41b684[_0x2daf('0x6a')]),_0x543603,{},['$$','$$']));}if(_0x41b684[_0x2daf('0x67')]){_0x41b684[_0x2daf('0x67')]=JSON[_0x2daf('0x68')](Mustache['render'](JSON[_0x2daf('0x70')](_0x41b684[_0x2daf('0x67')]),_0x543603,{},['$$','$$']));}}catch(_0x3ee9c4){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3ee9c4);}}rp(_0x41b684)[_0x2daf('0x15')](function(_0x28c8eb){var _0x469751={'statusCode':_0x28c8eb[_0x2daf('0x71')]||0xc8,'statusMessage':_0x28c8eb[_0x2daf('0x72')]||'OK','headers':_0x28c8eb['headers']||{},'body':_0x28c8eb['body']||{}};_0x284120(null,_0x469751);})[_0x2daf('0x13')](function(_0x227dab){var _0x3e0927={'statusCode':_0x227dab['statusCode']||0x1f4,'statusMessage':_0x227dab[_0x2daf('0x73')]||_0x2daf('0x74'),'headers':_0x227dab['options'][_0x2daf('0x6a')]||{},'body':_0x227dab['options'][_0x2daf('0x67')]||{}};_0x284120(null,_0x3e0927);});};AGIVertices[_0x2daf('0x16')][_0x2daf('0x75')]=function(_0x4dbe4f,_0x4dcec3){scripts[_0x2daf('0x75')](this[_0x2daf('0xe')][_0x2daf('0x35')],_0x4dbe4f[_0x2daf('0x76')],_0x4dbe4f[_0x2daf('0x59')],_0x4dbe4f[_0x2daf('0x77')]||'en')['then'](function(_0x3aeabd){_0x4dcec3(null,_0x3aeabd);})[_0x2daf('0x13')](function(_0x5dfbfe){_0x4dcec3(_0x5dfbfe);});};AGIVertices[_0x2daf('0x16')][_0x2daf('0x78')]=function(_0x1958af,_0x13a714){scripts[_0x2daf('0x78')](this[_0x2daf('0xe')]['uniqueid'],_0x1958af['dialogflowV2_project_id'],_0x1958af[_0x2daf('0x79')],_0x1958af['private_key'],_0x1958af[_0x2daf('0x59')],_0x1958af[_0x2daf('0x7a')]||'en')[_0x2daf('0x15')](function(_0xa82b60){_0x13a714(null,_0xa82b60);})[_0x2daf('0x13')](function(_0x1c7698){_0x13a714(_0x1c7698);});};AGIVertices['prototype'][_0x2daf('0x7b')]=function(_0x33d2af,_0x24fbee){scripts['sestekNDA'](this[_0x2daf('0xe')],_0x33d2af)['then'](function(_0x498440){_0x24fbee(null,_0x498440);})[_0x2daf('0x13')](function(_0x5420ea){_0x24fbee(_0x5420ea);});};AGIVertices[_0x2daf('0x16')][_0x2daf('0x7c')]=function(_0x17ad62,_0x27043e){scripts[_0x2daf('0x7c')](_0x17ad62['key'],_0x17ad62[_0x2daf('0x59')],_0x17ad62['ispeech_tts_language']||_0x2daf('0x5b'),_0x17ad62[_0x2daf('0x7d')])[_0x2daf('0x15')](function(_0xf6899a){_0x27043e(null,_0xf6899a);})[_0x2daf('0x13')](function(_0x2e5485){_0x27043e(_0x2e5485);});};AGIVertices[_0x2daf('0x16')]['ispeechASR']=function(_0x5505d8,_0x2143e0,_0x298180){scripts[_0x2daf('0x7e')](_0x2143e0,_0x5505d8[_0x2daf('0x76')],_0x5505d8[_0x2daf('0x7f')]||'en-US',this[_0x2daf('0x80')](_0x5505d8[_0x2daf('0x81')])?_0x5505d8[_0x2daf('0x81')]:undefined)[_0x2daf('0x15')](function(_0x3df52a){_0x298180(null,_0x3df52a);})['catch'](function(_0x3cfa60){_0x298180(_0x3cfa60);});};AGIVertices[_0x2daf('0x16')]['awsPolly']=function(_0x240110,_0x36e1c1){scripts['awsPolly'](_0x240110[_0x2daf('0x82')],_0x240110[_0x2daf('0x83')],_0x240110['aws_polly_region'],_0x240110[_0x2daf('0x84')]||_0x2daf('0x85'),_0x240110['text'],_0x240110['aws_text_type']||_0x2daf('0x59'))['then'](function(_0x2f5ac7){_0x36e1c1(null,_0x2f5ac7);})[_0x2daf('0x13')](function(_0x1fa342){_0x36e1c1(_0x1fa342);});};AGIVertices[_0x2daf('0x16')]['awsLex']=function(_0x4c5707,_0xa59af6){scripts[_0x2daf('0x86')](this[_0x2daf('0xe')][_0x2daf('0x35')],_0x4c5707['aws_access_key_id'],_0x4c5707[_0x2daf('0x83')],_0x4c5707['aws_lex_region'],_0x4c5707[_0x2daf('0x59')],_0x4c5707[_0x2daf('0x87')])[_0x2daf('0x15')](function(_0x324a49){_0xa59af6(null,_0x324a49);})[_0x2daf('0x13')](function(_0x52d71e){_0xa59af6(_0x52d71e);});};AGIVertices[_0x2daf('0x16')][_0x2daf('0x88')]=function(_0x235c53,_0x37233d,_0x497d8b){scripts['googleASR'](_0x37233d,_0x235c53['key'],_0x235c53[_0x2daf('0x89')]||'en-US')[_0x2daf('0x15')](function(_0x46fc2d){_0x497d8b(null,_0x46fc2d);})[_0x2daf('0x13')](function(_0x708b41){_0x497d8b(_0x708b41);});};AGIVertices[_0x2daf('0x16')]['tildeASR']=function(_0x16d2ab,_0x33b723,_0x2103fd){scripts[_0x2daf('0x8a')](_0x33b723,_0x16d2ab['appid'],_0x16d2ab[_0x2daf('0x8b')],_0x16d2ab[_0x2daf('0x6e')])[_0x2daf('0x15')](function(_0x54c39f){_0x2103fd(null,_0x54c39f);})[_0x2daf('0x13')](function(_0x51e2bd){_0x2103fd(_0x51e2bd);});};AGIVertices[_0x2daf('0x16')]['clear']=function(_0x5bf2a1){var _0x231e1e=_[_0x2daf('0x8c')](verticesWithRetry,_0x5bf2a1[_0x2daf('0x37')])?_0x5bf2a1:_[_0x2daf('0x8d')](_0x5bf2a1);for(var _0xa9bcce in _0x231e1e){if(_0x231e1e[_0x2daf('0x8e')](_0xa9bcce)){if(_0x231e1e[_0xa9bcce]&&_[_0x2daf('0x8f')](_0x231e1e[_0xa9bcce])){if(_[_0x2daf('0x8c')](recursiveMapAttributes,_0xa9bcce)){_0x231e1e[_0xa9bcce]=this['replaceObjectAllVariables'](_0x231e1e[_0xa9bcce]);}else{_0x231e1e[_0xa9bcce]=this[_0x2daf('0x90')](_0x231e1e[_0xa9bcce]);}}}}return _0x231e1e;};AGIVertices[_0x2daf('0x16')][_0x2daf('0x91')]=function(_0x36cecf){for(var _0x1617d0 in _0x36cecf){if(_0x36cecf['hasOwnProperty'](_0x1617d0)){if(_[_0x2daf('0x92')](_0x36cecf[_0x1617d0])){this[_0x2daf('0x91')](_0x36cecf[_0x1617d0]);}else if(_['isArray'](_0x36cecf[_0x1617d0])){for(var _0x188736=0x0;_0x188736<_0x36cecf[_0x1617d0][_0x2daf('0x93')];_0x188736++){this['recursiveNodeIndex'](_0x36cecf[_0x1617d0][_0x188736]);}}else if(_[_0x2daf('0x8f')](_0x36cecf[_0x1617d0])){_0x36cecf[_0x1617d0]=this['replaceAllVariables'](_0x36cecf[_0x1617d0]);}}}};AGIVertices['prototype'][_0x2daf('0x94')]=function(_0x10ef60,_0x167bac){for(var _0x1259c3 in _0x10ef60){if(_0x10ef60['hasOwnProperty'](_0x1259c3)){if(_['isPlainObject'](_0x10ef60[_0x1259c3])){if(!_[_0x2daf('0x42')](_0x10ef60[_0x1259c3])){this['saveRestApiResult'](_0x10ef60[_0x1259c3],util[_0x2daf('0x28')](_0x2daf('0x95'),_0x167bac,_0x1259c3));}}else if(_[_0x2daf('0x96')](_0x10ef60[_0x1259c3])){for(var _0x320ec2=0x0;_0x320ec2<_0x10ef60[_0x1259c3][_0x2daf('0x93')];_0x320ec2++){this[_0x2daf('0x94')](_0x10ef60[_0x1259c3][_0x320ec2],util['format'](_0x2daf('0x95'),_0x167bac,_0x1259c3+'['+_0x320ec2+']'));}}else{if(!_[_0x2daf('0x43')](_0x10ef60[_0x1259c3])){this[_0x2daf('0xe')][_0x2daf('0x97')](util[_0x2daf('0x28')](_0x2daf('0x95'),_0x167bac,_0x1259c3),_0x10ef60[_0x1259c3]);}}}}};AGIVertices[_0x2daf('0x16')][_0x2daf('0x98')]=function(_0x4708b3){try{var _0x3cccaf=JSON['parse'](_0x4708b3);this[_0x2daf('0x91')](_0x3cccaf);return JSON[_0x2daf('0x70')](_0x3cccaf);}catch(_0x45a895){return this[_0x2daf('0x90')](_0x4708b3);}};AGIVertices['prototype'][_0x2daf('0x90')]=function(_0x5050c6){var _0x1ebb47=_0x5050c6[_0x2daf('0x99')]('{');for(var _0xb81f12=0x1;_0xb81f12<_0x1ebb47[_0x2daf('0x93')];_0xb81f12+=0x1){var _0x2e7137=_0x1ebb47[_0xb81f12][_0x2daf('0x99')]('}');if(_0x2e7137[_0x2daf('0x93')]>0x1){_0x5050c6=_0x5050c6[_0x2daf('0x9a')]('{'+_0x2e7137[0x0]+'}',this[_0x2daf('0xe')][_0x2daf('0x10')](_0x2e7137[0x0])['extra']||_0x2e7137[0x0]);}}if(_0x1ebb47[_0x2daf('0x93')]===0x1){return _0x5050c6[_0x2daf('0x49')]();}return this[_0x2daf('0x90')](_0x5050c6);};AGIVertices[_0x2daf('0x16')][_0x2daf('0x9b')]=function(_0x20271b,_0x4f3d2c){var _0x4111de=this[_0x2daf('0xe')][_0x2daf('0x10')](_0x20271b);if(_0x4111de[_0x2daf('0x9c')]===-0x1){return _0x4111de;}logger[_0x2daf('0x2e')](util['format'](_0x2daf('0x9d'),_0x4f3d2c,_0x4111de[_0x2daf('0x9e')]));return this[_0x2daf('0xe')][_0x2daf('0x97')](_0x4f3d2c,_0x4111de['extra']);};AGIVertices['prototype'][_0x2daf('0x80')]=function(_0x377ec6){return _0x377ec6&&_0x377ec6!=='0'&&_0x377ec6!=='-1'&&_0x377ec6!=='';};AGIVertices['prototype'][_0x2daf('0x9f')]=function(_0x1d67f3){this[_0x2daf('0x34')][_0x2daf('0xa0')](this,_0x1d67f3,'-');_0x1d67f3[_0x2daf('0xa1')]=_0x1d67f3['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x2daf('0xa2')]=function(_0x17ff24){logger[_0x2daf('0x2e')](util[_0x2daf('0x28')](_0x2daf('0xa3'),_0x17ff24[_0x2daf('0x36')]));if(!this[_0x2daf('0x80')](_0x17ff24['text'])){return this[_0x2daf('0xe')][_0x2daf('0xa4')](_0x2daf('0xa5'));}var _0x470520='\x22'+_0x17ff24[_0x2daf('0x59')]+'\x22';if(this[_0x2daf('0x80')](_0x17ff24['options'])){_0x470520+=','+_0x17ff24[_0x2daf('0xa6')];}var _0xa8a83d=this[_0x2daf('0xe')][_0x2daf('0x55')](_0x2daf('0xa7'),_0x470520);if(_0xa8a83d[_0x2daf('0x9c')]===-0x1){return _0xa8a83d;}return this[_0x2daf('0xe')][_0x2daf('0xa4')](util['format'](_0x2daf('0xa8'),_0x470520));};AGIVertices[_0x2daf('0x16')]['mrcprecog']=function(_0x565129){logger['info'](util['format'](_0x2daf('0xa9'),_0x565129['label']));if(!this[_0x2daf('0x80')](_0x565129[_0x2daf('0xaa')])){return this[_0x2daf('0xe')][_0x2daf('0xa4')](_0x2daf('0xab'));}var _0x491fd4=_0x565129[_0x2daf('0xaa')];if(this[_0x2daf('0x80')](_0x565129[_0x2daf('0xa6')])){_0x491fd4+=','+_0x565129[_0x2daf('0xa6')];}var _0x1e06c7=this['channel']['exec'](_0x2daf('0xac'),_0x491fd4);if(_0x1e06c7[_0x2daf('0x9c')]===-0x1){return _0x1e06c7;}var _0x159b5b=this['getAndSetVariable']('RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE');if(_0x159b5b['result']===-0x1){return _0x159b5b;}var _0x4384d2=this['getAndSetVariable'](_0x2daf('0xad'),_0x2daf('0xae'));if(_0x4384d2[_0x2daf('0x9c')]===-0x1){return _0x4384d2;}var _0x1e6a61=this[_0x2daf('0x9b')](_0x2daf('0xaf'),_0x2daf('0xb0'));if(_0x1e6a61[_0x2daf('0x9c')]===-0x1){return _0x1e6a61;}return this['channel'][_0x2daf('0xa4')](util['format'](_0x2daf('0xb1'),_0x491fd4));};AGIVertices['prototype']['agi']=function(_0x4dce58){logger['info'](util['format']('Enter\x20in\x20AGI\x20(%s)\x20block',_0x4dce58[_0x2daf('0x36')]));return this[_0x2daf('0xe')]['agi']([_0x4dce58[_0x2daf('0xb2')],_0x4dce58[_0x2daf('0xb3')]]);};AGIVertices[_0x2daf('0x16')][_0x2daf('0xb4')]=function(_0x4b597e){logger[_0x2daf('0x2e')](util[_0x2daf('0x28')](_0x2daf('0xb5'),_0x4b597e['label']));if(this[_0x2daf('0x80')](_0x4b597e[_0x2daf('0x63')])){logger['info'](util['format'](_0x2daf('0xb6'),_0x4b597e[_0x2daf('0x63')]));var _0x353588=this[_0x2daf('0xe')][_0x2daf('0xb7')](_0x4b597e[_0x2daf('0x63')]);if(_0x353588['result']===-0x1){return _0x353588;}}return this[_0x2daf('0xe')][_0x2daf('0xb4')]();};AGIVertices[_0x2daf('0x16')][_0x2daf('0xb8')]=function(_0x897cf1){logger[_0x2daf('0x2e')](util['format'](_0x2daf('0xb9'),_0x897cf1[_0x2daf('0x36')]));if(!this['isConfigured'](_0x897cf1[_0x2daf('0xba')])){return this[_0x2daf('0xe')][_0x2daf('0x4e')](_0x897cf1,'no\x20list\x20selected');}_0x897cf1[_0x2daf('0x47')]=moment();if(this['isConfigured'](_0x897cf1[_0x2daf('0xbb')])){_0x897cf1[_0x2daf('0x47')]=moment()[_0x2daf('0xbc')](_0x897cf1[_0x2daf('0xbb')],_0x2daf('0xbd'));}if(!this[_0x2daf('0x80')](_0x897cf1['callback_priority'])){_0x897cf1[_0x2daf('0x4a')]=0x2;}this['createCmContact'][_0x2daf('0xa0')](this,_0x897cf1);return this[_0x2daf('0xe')]['noop'](util[_0x2daf('0x28')](_0x2daf('0xbe'),_0x897cf1['phone'],_0x897cf1[_0x2daf('0xba')],_0x897cf1[_0x2daf('0x47')]));};AGIVertices[_0x2daf('0x16')][_0x2daf('0xbf')]=function(_0x31d8fb){logger[_0x2daf('0x2e')](util[_0x2daf('0x28')](_0x2daf('0xc0'),_0x31d8fb['label']));var _0x66a41a=this['channel']['exec'](_0x31d8fb[_0x2daf('0xc1')],_0x31d8fb['options']);if(_0x66a41a[_0x2daf('0x9c')]===-0x1){return _0x66a41a;}return this[_0x2daf('0xe')][_0x2daf('0xa4')](util[_0x2daf('0x28')](_0x2daf('0xc2'),_0x31d8fb[_0x2daf('0xc1')],_0x31d8fb['options']));};AGIVertices[_0x2daf('0x16')][_0x2daf('0xc3')]=function(_0x7fd4f5){logger[_0x2daf('0x2e')](util[_0x2daf('0x28')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x7fd4f5[_0x2daf('0x36')]));if(!this[_0x2daf('0x80')](_0x7fd4f5[_0x2daf('0x59')])){return this[_0x2daf('0xe')][_0x2daf('0xa4')](_0x2daf('0xa5'));}var _0x23759b='\x22'+_0x7fd4f5['text']+'\x22';if(this[_0x2daf('0x80')](_0x7fd4f5[_0x2daf('0xa6')])){_0x23759b+=','+_0x7fd4f5[_0x2daf('0xa6')];}var _0x3e7766=this['channel']['exec']('MRCPSynth',_0x23759b);if(_0x3e7766[_0x2daf('0x9c')]===-0x1){return _0x3e7766;}return this[_0x2daf('0xe')][_0x2daf('0xa4')](util['format'](_0x2daf('0xa8'),_0x23759b));};AGIVertices[_0x2daf('0x16')][_0x2daf('0xc4')]=function(_0x5be632){logger[_0x2daf('0x2e')](util[_0x2daf('0x28')](_0x2daf('0xc5'),_0x5be632[_0x2daf('0x36')]));if(!this[_0x2daf('0x80')](_0x5be632[_0x2daf('0x59')])){return this[_0x2daf('0xe')][_0x2daf('0xa4')](_0x2daf('0xa5'));}var _0x2e7a0c='\x22'+_0x5be632['text']+'\x22';if(this['isConfigured'](_0x5be632[_0x2daf('0xa6')])){_0x2e7a0c+=','+_0x5be632[_0x2daf('0xa6')];}var _0xe9c11c=this[_0x2daf('0xe')][_0x2daf('0x55')](_0x2daf('0xa7'),_0x2e7a0c);if(_0xe9c11c[_0x2daf('0x9c')]===-0x1){return _0xe9c11c;}return this['channel'][_0x2daf('0xa4')](util[_0x2daf('0x28')]('Executed\x20command\x20MRCPSynth\x20%s',_0x2e7a0c));};AGIVertices[_0x2daf('0x16')][_0x2daf('0xc6')]=function(_0x13e1ed){logger[_0x2daf('0x2e')](util['format'](_0x2daf('0xc7'),_0x13e1ed['label']));if(!this['isConfigured'](_0x13e1ed[_0x2daf('0xaa')])){return this[_0x2daf('0xe')]['noop'](_0x2daf('0xab'));}var _0x51d544=_0x13e1ed[_0x2daf('0xaa')];if(this[_0x2daf('0x80')](_0x13e1ed[_0x2daf('0xa6')])){_0x51d544+=','+_0x13e1ed[_0x2daf('0xa6')];}var _0xe1f709=this['channel'][_0x2daf('0x55')](_0x2daf('0xac'),_0x51d544);if(_0xe1f709['result']===-0x1){return _0xe1f709;}var _0x11645b=this[_0x2daf('0x9b')](_0x2daf('0xc8'),_0x2daf('0xc9'));if(_0x11645b['result']===-0x1){return _0x11645b;}var _0x15bc35=this[_0x2daf('0x9b')](_0x2daf('0xad'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x15bc35['result']===-0x1){return _0x15bc35;}var _0x442ba0=this['getAndSetVariable'](_0x2daf('0xaf'),_0x2daf('0xca'));if(_0x442ba0[_0x2daf('0x9c')]===-0x1){return _0x442ba0;}return this[_0x2daf('0xe')]['noop'](util[_0x2daf('0x28')](_0x2daf('0xb1'),_0x51d544));};AGIVertices[_0x2daf('0x16')][_0x2daf('0xcb')]=function(_0x1b6b96){logger['info'](util[_0x2daf('0x28')](_0x2daf('0xcc'),_0x1b6b96[_0x2daf('0x36')]));if(!this[_0x2daf('0x80')](_0x1b6b96[_0x2daf('0xaa')])){return this[_0x2daf('0xe')][_0x2daf('0xa4')](_0x2daf('0xab'));}var _0x218931=_0x1b6b96[_0x2daf('0xaa')];if(this[_0x2daf('0x80')](_0x1b6b96[_0x2daf('0xa6')])){_0x218931+=','+_0x1b6b96['options'];}var _0x4dce19=this[_0x2daf('0xe')]['exec'](_0x2daf('0xac'),_0x218931);if(_0x4dce19[_0x2daf('0x9c')]===-0x1){return _0x4dce19;}var _0x4abafc=this[_0x2daf('0x9b')](_0x2daf('0xc8'),_0x2daf('0xcd'));if(_0x4abafc[_0x2daf('0x9c')]===-0x1){return _0x4abafc;}var _0x1d9bad=this[_0x2daf('0x9b')](_0x2daf('0xad'),'SESTEK_ASR_TRANSCRIPT');if(_0x1d9bad[_0x2daf('0x9c')]===-0x1){return _0x1d9bad;}var _0x388ec3=this[_0x2daf('0x9b')](_0x2daf('0xaf'),_0x2daf('0xce'));if(_0x388ec3[_0x2daf('0x9c')]===-0x1){return _0x388ec3;}return this[_0x2daf('0xe')][_0x2daf('0xa4')](util['format'](_0x2daf('0xb1'),_0x218931));};AGIVertices[_0x2daf('0x16')][_0x2daf('0xcf')]=function(_0x94e209){logger[_0x2daf('0x2e')](util['format'](_0x2daf('0xd0'),_0x94e209[_0x2daf('0x36')]));if(!this[_0x2daf('0x80')](_0x94e209[_0x2daf('0xd1')])){return this[_0x2daf('0xe')]['error'](_0x94e209,_0x2daf('0xd2'));}var _0x5c4093=this[_0x2daf('0x18')][_0x2daf('0xa0')](this,_0x94e209['odbc_id']);if(!_0x5c4093){return this[_0x2daf('0xe')][_0x2daf('0x4e')](_0x94e209,_0x2daf('0xd3'));}if(!this[_0x2daf('0x80')](_0x94e209['query'])){return this['channel'][_0x2daf('0x4e')](_0x94e209,_0x2daf('0xd4'));}var _0x449e5f=_0x94e209['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x2daf('0xa4')](util[_0x2daf('0x28')](_0x2daf('0xd5'),_0x449e5f));var _0x40c049=this[_0x2daf('0x2a')][_0x2daf('0xa0')](this,_0x5c4093,_0x449e5f);this[_0x2daf('0x34')]['sync'](this,_0x94e209,_0x449e5f);if(!this['isConfigured'](_0x94e209[_0x2daf('0xd6')])){return this[_0x2daf('0xe')]['noop'](_0x2daf('0xd7'));}var _0x5a587b=this['getVariable']['sync'](this,_0x94e209[_0x2daf('0xd6')]);if(!_0x5a587b){return this[_0x2daf('0xe')][_0x2daf('0x4e')](_0x94e209,_0x2daf('0xd8'));}var _0x2bd41a=this;_0x40c049[_0x2daf('0xd9')](function(_0xedb3da,_0x13dbfe){Object[_0x2daf('0xda')](_0xedb3da)[_0x2daf('0xd9')](function(_0xf52256){_0x2bd41a[_0x2daf('0xe')][_0x2daf('0x97')](util['format'](_0x2daf('0xdb'),_0x5a587b,_0x13dbfe,_0xf52256),_0xedb3da[_0xf52256]);});});this['channel']['setVariable'](util[_0x2daf('0x28')](_0x2daf('0xdc'),_0x5a587b),_0x40c049[_0x2daf('0x93')]);return this[_0x2daf('0xe')][_0x2daf('0xa4')](util[_0x2daf('0x28')](_0x2daf('0xdd'),_0x5a587b));};AGIVertices[_0x2daf('0x16')][_0x2daf('0xde')]=function(_0x5ef16b){logger[_0x2daf('0xdf')](util[_0x2daf('0x28')](_0x2daf('0xe0'),_0x5ef16b[_0x2daf('0x36')]));if(!this[_0x2daf('0x80')](_0x5ef16b['sip_id'])){return this[_0x2daf('0xe')][_0x2daf('0x4e')](_0x5ef16b,_0x2daf('0xe1'));}var _0x361f23=this[_0x2daf('0xe2')][_0x2daf('0xa0')](this,_0x5ef16b['sip_id']);if(!_0x361f23){return this[_0x2daf('0xe')][_0x2daf('0x4e')](_0x5ef16b,_0x2daf('0xe3'));}var _0x47eb6e=this['channel'][_0x2daf('0x55')]('DIAL',[util[_0x2daf('0x28')](_0x2daf('0xe4'),_0x361f23),_0x5ef16b[_0x2daf('0x63')],_0x5ef16b['opts'],_0x5ef16b[_0x2daf('0x61')]]);if(_0x47eb6e[_0x2daf('0x9c')]===-0x1){return _0x47eb6e;}return this[_0x2daf('0xe')][_0x2daf('0xa4')](util[_0x2daf('0x28')](_0x2daf('0xe5'),_0x2daf('0xe6')));};AGIVertices[_0x2daf('0x16')][_0x2daf('0xe7')]=function(_0x1bfd43){logger['info'](util[_0x2daf('0x28')](_0x2daf('0xe8'),_0x1bfd43[_0x2daf('0x36')]));if(!this[_0x2daf('0x80')](_0x1bfd43[_0x2daf('0x76')])){return this[_0x2daf('0xe')][_0x2daf('0xa4')]('no\x20key\x20configured');}if(!this[_0x2daf('0x80')](_0x1bfd43[_0x2daf('0x59')])){return this[_0x2daf('0xe')][_0x2daf('0xa4')](_0x2daf('0xa5'));}this[_0x2daf('0xe')][_0x2daf('0xe9')]=!![];this[_0x2daf('0x34')](_0x1bfd43);this[_0x2daf('0x40')](_0x1bfd43[_0x2daf('0x59')],'in','','');this[_0x2daf('0xe')][_0x2daf('0xa4')](util[_0x2daf('0x28')](_0x2daf('0xea'),_0x1bfd43[_0x2daf('0x59')]));var _0x434b01=this['googleDialogflow']['sync'](this,_0x1bfd43);if(_0x434b01){for(var _0x5f3a6e in _0x434b01){if(_0x434b01[_0x2daf('0x8e')](_0x5f3a6e)){this[_0x2daf('0xe')][_0x2daf('0x97')](util['format'](_0x2daf('0xeb'),_0x5f3a6e['toUpperCase']()),_0x434b01[_0x5f3a6e]);}}this['createSquareMessage'](_0x434b01['speech'],_0x2daf('0xec'),_0x2daf('0xe7'),'');return this[_0x2daf('0xe')]['noop'](util[_0x2daf('0x28')](_0x2daf('0xed'),_0x434b01[_0x2daf('0xee')]));}return this[_0x2daf('0xe')][_0x2daf('0x4e')](_0x1bfd43,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype']['dialogflowV2']=function(_0x369685){logger[_0x2daf('0x2e')](util[_0x2daf('0x28')](_0x2daf('0xef'),_0x369685[_0x2daf('0x36')]));if(!this[_0x2daf('0x80')](_0x369685[_0x2daf('0xf0')])){return this[_0x2daf('0xe')][_0x2daf('0xa4')]('no\x20project_id\x20configured');}if(!this[_0x2daf('0x80')](_0x369685[_0x2daf('0x79')])){return this[_0x2daf('0xe')]['noop'](_0x2daf('0xf1'));}if(!this['isConfigured'](_0x369685[_0x2daf('0xf2')])){return this[_0x2daf('0xe')]['noop'](_0x2daf('0xf3'));}if(!this[_0x2daf('0x80')](_0x369685['dialogflowV2_language'])){return this[_0x2daf('0xe')][_0x2daf('0xa4')](_0x2daf('0xf4'));}if(!this[_0x2daf('0x80')](_0x369685[_0x2daf('0x59')])){return this[_0x2daf('0xe')][_0x2daf('0xa4')](_0x2daf('0xa5'));}this[_0x2daf('0xe')][_0x2daf('0xe9')]=!![];this[_0x2daf('0x34')](_0x369685);this[_0x2daf('0x40')](_0x369685['text'],'in','','');this[_0x2daf('0xe')][_0x2daf('0xa4')](util[_0x2daf('0x28')](_0x2daf('0xf5'),_0x369685[_0x2daf('0x59')]));var _0x3ea82b=this[_0x2daf('0x78')][_0x2daf('0xa0')](this,_0x369685);if(_0x3ea82b){for(var _0x53c0a9 in _0x3ea82b){if(_0x3ea82b[_0x2daf('0x8e')](_0x53c0a9)){if(_0x53c0a9!=='providerResponse'){this[_0x2daf('0xe')][_0x2daf('0x97')](util[_0x2daf('0x28')](_0x2daf('0xeb'),_0x53c0a9['toUpperCase']()),_0x3ea82b[_0x53c0a9]);}}}this[_0x2daf('0x40')](_0x3ea82b[_0x2daf('0xee')],_0x2daf('0xec'),'dialogflowV2',_0x3ea82b[_0x2daf('0xf6')]);return this['channel'][_0x2daf('0xa4')](util['format']('DialogflowV2\x20Result\x20%s',_0x3ea82b['speech']));}return this[_0x2daf('0xe')][_0x2daf('0x4e')](_0x369685,_0x2daf('0xf7'));};AGIVertices[_0x2daf('0x16')][_0x2daf('0xf8')]=function(_0x3ca75d){logger[_0x2daf('0x2e')](util[_0x2daf('0x28')](_0x2daf('0xf9'),_0x3ca75d[_0x2daf('0x36')]));if(!this[_0x2daf('0x80')](_0x3ca75d['ndauth_url'])){return this[_0x2daf('0xe')]['noop'](_0x2daf('0xfa'));}if(!this[_0x2daf('0x80')](_0x3ca75d[_0x2daf('0xfb')])){return this[_0x2daf('0xe')][_0x2daf('0xa4')](_0x2daf('0xfc'));}if(!this[_0x2daf('0x80')](_0x3ca75d[_0x2daf('0xfd')])){return this[_0x2daf('0xe')][_0x2daf('0xa4')](_0x2daf('0xfe'));}if(!this[_0x2daf('0x80')](_0x3ca75d[_0x2daf('0xff')])){return this[_0x2daf('0xe')]['noop'](_0x2daf('0xa5'));}this['channel'][_0x2daf('0xe9')]=!![];this[_0x2daf('0x34')](_0x3ca75d);this[_0x2daf('0x40')](_0x3ca75d[_0x2daf('0x59')],'in','','');this['channel'][_0x2daf('0xa4')](util['format'](_0x2daf('0x100'),_0x3ca75d[_0x2daf('0x59')]));var _0x523d86=this[_0x2daf('0x7b')][_0x2daf('0xa0')](this,_0x3ca75d);if(_0x523d86){for(var _0x2ff7e1 in _0x523d86){if(_0x523d86['hasOwnProperty'](_0x2ff7e1)){this[_0x2daf('0xe')][_0x2daf('0x97')](util['format'](_0x2daf('0x101'),_0x2ff7e1[_0x2daf('0x66')]()),_0x523d86[_0x2ff7e1]);}}this[_0x2daf('0x40')](_0x523d86[_0x2daf('0xee')],'out',_0x2daf('0xf8'),'');if(_0x523d86[_0x2daf('0x102')]){this[_0x2daf('0xe')][_0x2daf('0xa4')](util['format'](_0x2daf('0x103'),_0x523d86[_0x2daf('0x102')]));var _0x58e187=this[_0x2daf('0xe')][_0x2daf('0x104')](_0x523d86[_0x2daf('0x102')]);try{fs[_0x2daf('0x105')](_0x523d86[_0x2daf('0x102')]+_0x2daf('0x106'));}catch(_0x4c86f3){logger[_0x2daf('0x4e')](_0x4c86f3);}return _0x58e187;}else{return this[_0x2daf('0xe')]['noop'](util[_0x2daf('0x28')]('SestekNDA\x20Result\x20%s',_0x523d86['speech']));}}return this['channel']['error'](_0x3ca75d,_0x2daf('0x107'));};AGIVertices['prototype'][_0x2daf('0x108')]=function(_0x2a8f5b){logger['info'](util[_0x2daf('0x28')]('Enter\x20in\x20END\x20(%s)\x20block',_0x2a8f5b[_0x2daf('0x36')]));return this[_0x2daf('0xe')][_0x2daf('0xa4')](_0x2daf('0x108'));};AGIVertices[_0x2daf('0x16')][_0x2daf('0x109')]=function(_0x39497b){logger[_0x2daf('0x2e')](util[_0x2daf('0x28')](_0x2daf('0x10a'),_0x39497b['label']));var _0x63bcd6='';if(_0x39497b[_0x2daf('0x10b')]){if(!this[_0x2daf('0x80')](_0x39497b[_0x2daf('0x10b')])){return this['channel'][_0x2daf('0x4e')](_0x39497b,_0x2daf('0x10c'));}else{var _0xe37e23=parseInt(_0x39497b['trunk_id'],0xa);if(isNaN(_0xe37e23)){_0x63bcd6=_0x39497b['trunk_id'];}else{_0x63bcd6=this[_0x2daf('0x1b')][_0x2daf('0xa0')](this,_0x39497b[_0x2daf('0x10b')]);if(!_0x63bcd6){return this['channel'][_0x2daf('0x4e')](_0x39497b,_0x2daf('0x10d'));}}}}else if(_0x39497b['trunk_name']){_0x63bcd6=_0x39497b['trunk_name'];}else{return this[_0x2daf('0xe')]['error'](_0x39497b,_0x2daf('0x10c'));}var _0x1e07ad=this['channel'][_0x2daf('0x55')](_0x2daf('0xe6'),[util[_0x2daf('0x28')](_0x2daf('0x10e'),_0x63bcd6,_0x39497b[_0x2daf('0x10f')]),_0x39497b[_0x2daf('0x63')],_0x39497b[_0x2daf('0x110')],_0x39497b[_0x2daf('0x61')]]);if(_0x1e07ad[_0x2daf('0x9c')]===-0x1){return _0x1e07ad;}return this['channel'][_0x2daf('0xa4')](util[_0x2daf('0x28')]('Executed\x20command\x20%s',_0x2daf('0xe6')));};AGIVertices[_0x2daf('0x16')][_0x2daf('0x111')]=function(_0x3a7321){logger[_0x2daf('0x2e')](util[_0x2daf('0x28')](_0x2daf('0x112'),_0x3a7321[_0x2daf('0x36')]));return this[_0x2daf('0xe')][_0x2daf('0xa4')](_0x2daf('0x111'));};AGIVertices[_0x2daf('0x16')]['getdigits']=function(_0xa343fa){logger['info'](util[_0x2daf('0x28')](_0x2daf('0x113'),_0xa343fa[_0x2daf('0x36')]));if(_0xa343fa[_0x2daf('0xa1')]===0x0){return this[_0x2daf('0x9f')](_0xa343fa);}_0xa343fa['retry']-=0x1;if(!this['isConfigured'](_0xa343fa['file_id'])){return this['channel']['error'](_0xa343fa,'no\x20file\x20audio\x20selected');}var _0x1a9c6a=this[_0x2daf('0x1d')][_0x2daf('0xa0')](this,_0xa343fa[_0x2daf('0x114')]);if(!_0x1a9c6a){return this[_0x2daf('0xe')][_0x2daf('0x4e')](_0xa343fa,'no\x20file\x20audio\x20found');}if(!this[_0x2daf('0x80')](_0xa343fa[_0x2daf('0xd6')])){return this[_0x2daf('0xe')][_0x2daf('0x4e')](_0x2daf('0xd7'));}var _0x2cf13c=this[_0x2daf('0xe')][_0x2daf('0x115')](_0x1a9c6a,_0xa343fa[_0x2daf('0x116')],_0xa343fa[_0x2daf('0x117')]);var _0x2bbda0=_0x2cf13c[_0x2daf('0x9c')]?_0x2cf13c[_0x2daf('0x9c')][_0x2daf('0x49')]():'';logger[_0x2daf('0x2e')]('test',JSON[_0x2daf('0x70')](_0x2cf13c));if(_0x2cf13c[_0x2daf('0x9c')]===-0x1){this[_0x2daf('0x34')][_0x2daf('0xa0')](this,_0xa343fa,_0x2bbda0);return _0x2cf13c;}else if(_0x2cf13c['extra']===_0x2daf('0x63')){_0x2cf13c[_0x2daf('0x9c')]=_0x2bbda0[_0x2daf('0x93')]>=parseInt(_0xa343fa[_0x2daf('0x118')])?'x':'i';}else{_0x2cf13c[_0x2daf('0x9c')]=_0x2bbda0['length']>=parseInt(_0xa343fa[_0x2daf('0x118')])&&_0x2bbda0['length']<=parseInt(_0xa343fa[_0x2daf('0x117')])?'x':'i';}var _0x47792e=this['getVariable'][_0x2daf('0xa0')](this,_0xa343fa['variable_id']);if(!_0x47792e){return this['channel'][_0x2daf('0x4e')](_0xa343fa,_0x2daf('0xd8'));}this['channel'][_0x2daf('0x97')](_0x47792e,_0x2bbda0);if(this[_0x2daf('0x80')](_0xa343fa[_0x2daf('0x119')])){var _0x2ed7df=parseInt(_0xa343fa[_0x2daf('0x119')],0xa);var _0x1f3780=rs[_0x2daf('0x11a')]({'charset':'*','length':_0x2ed7df});var _0x154b6c=_0x2bbda0[_0x2daf('0x93')];if(_0x154b6c>0x0){if(_0x154b6c>_0x2ed7df){this['createSquareDetailsReport']['sync'](this,_0xa343fa,_0xa343fa[_0x2daf('0x11b')]===_0x2daf('0x11c')?_0x1f3780+_0x2bbda0['substr'](_0x2ed7df):_0x2bbda0['substr'](0x0,_0x154b6c-_0x2ed7df)+_0x1f3780);}else{this[_0x2daf('0x34')][_0x2daf('0xa0')](this,_0xa343fa,rs[_0x2daf('0x11a')]({'charset':'*','length':_0x154b6c}));}}else{this[_0x2daf('0x34')][_0x2daf('0xa0')](this,_0xa343fa,'');}}else{this[_0x2daf('0x34')][_0x2daf('0xa0')](this,_0xa343fa,_0x2bbda0);}return _0x2cf13c;};AGIVertices['prototype'][_0x2daf('0xd')]=function(_0x42326c){logger[_0x2daf('0x2e')](util['format'](_0x2daf('0x11d'),_0x42326c[_0x2daf('0x36')]));return this[_0x2daf('0xc')](_0x42326c);};AGIVertices[_0x2daf('0x16')]['goal']=function(_0x3d7064){logger[_0x2daf('0x2e')](util[_0x2daf('0x28')](_0x2daf('0x11e'),_0x3d7064[_0x2daf('0x36')]));this[_0x2daf('0x34')][_0x2daf('0xa0')](this,_0x3d7064,_0x3d7064['goalname']);return this[_0x2daf('0xe')][_0x2daf('0xa4')](util[_0x2daf('0x28')]('GOAL\x20%s',_0x3d7064[_0x2daf('0x11f')]));};AGIVertices[_0x2daf('0x16')][_0x2daf('0x120')]=function(_0x3860ae){logger[_0x2daf('0x2e')](util['format'](_0x2daf('0x121'),_0x3860ae[_0x2daf('0x36')]));if(!this[_0x2daf('0x80')](_0x3860ae[_0x2daf('0x82')])||!this[_0x2daf('0x80')](_0x3860ae[_0x2daf('0x83')])){return this[_0x2daf('0xe')][_0x2daf('0xa4')](_0x2daf('0x122'));}if(!this[_0x2daf('0x80')](_0x3860ae[_0x2daf('0x59')])){return this['channel'][_0x2daf('0xa4')](_0x2daf('0xa5'));}this[_0x2daf('0xe')][_0x2daf('0xa4')](util[_0x2daf('0x28')](_0x2daf('0x123'),_0x3860ae[_0x2daf('0x59')]));var _0x31821b=this[_0x2daf('0x124')][_0x2daf('0xa0')](this,_0x3860ae);if(_0x31821b){this[_0x2daf('0xe')][_0x2daf('0xa4')](util[_0x2daf('0x28')](_0x2daf('0x125'),_0x31821b));var _0x42122e=this['channel'][_0x2daf('0x104')](_0x31821b);try{fs[_0x2daf('0x105')](_0x31821b+'.wav');}catch(_0x8ce2fa){logger[_0x2daf('0x4e')](_0x8ce2fa);}return _0x42122e;}return this[_0x2daf('0xe')][_0x2daf('0x4e')](_0x3860ae,_0x2daf('0x126'));};AGIVertices[_0x2daf('0x16')][_0x2daf('0x127')]=function(_0x51af18){logger[_0x2daf('0x2e')](util['format'](_0x2daf('0x128'),_0x51af18[_0x2daf('0x36')]));if(!this[_0x2daf('0x80')](_0x51af18[_0x2daf('0x82')])||!this[_0x2daf('0x80')](_0x51af18['aws_secret_access_key'])){return this['channel']['noop'](_0x2daf('0x122'));}if(!this[_0x2daf('0x80')](_0x51af18[_0x2daf('0x87')])){return this[_0x2daf('0xe')]['noop'](_0x2daf('0x129'));}if(!this['isConfigured'](_0x51af18[_0x2daf('0x59')])){return this['channel']['noop']('no\x20text\x20configured');}this['channel'][_0x2daf('0xe9')]=!![];this[_0x2daf('0x34')](_0x51af18);this[_0x2daf('0x40')](_0x51af18[_0x2daf('0x59')],'in','','');this[_0x2daf('0xe')][_0x2daf('0xa4')](util[_0x2daf('0x28')]('Trying\x20Amazon\x20Lex:\x20%s',_0x51af18[_0x2daf('0x59')]));var _0x3d93a3=this[_0x2daf('0x86')][_0x2daf('0xa0')](this,_0x51af18);if(_0x3d93a3){for(var _0x3e3c00 in _0x3d93a3){if(_0x3d93a3[_0x2daf('0x8e')](_0x3e3c00)&&_[_0x2daf('0x8f')](_0x3d93a3[_0x3e3c00])){this[_0x2daf('0xe')]['setVariable'](util[_0x2daf('0x28')](_0x2daf('0x12a'),_0x3e3c00[_0x2daf('0x66')]()),_0x3d93a3[_0x3e3c00]);}}if(_[_0x2daf('0x43')](_0x3d93a3[_0x2daf('0x73')])){return this[_0x2daf('0xe')][_0x2daf('0xa4')](_0x2daf('0x12b'));}else{this[_0x2daf('0x40')](_0x3d93a3[_0x2daf('0x73')],_0x2daf('0xec'),_0x2daf('0x12c'),'');return this[_0x2daf('0xe')]['noop'](util[_0x2daf('0x28')]('Amazon\x20Lex\x20Result\x20%s',_0x3d93a3[_0x2daf('0x73')]));}}return this[_0x2daf('0xe')][_0x2daf('0x4e')](_0x51af18,_0x2daf('0x12d'));};AGIVertices[_0x2daf('0x16')][_0x2daf('0x12e')]=function(_0x34d185){logger['info'](util[_0x2daf('0x28')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x34d185[_0x2daf('0x36')],_0x34d185[_0x2daf('0x63')]));if(!this[_0x2daf('0x80')](_0x34d185[_0x2daf('0x76')])){return this[_0x2daf('0xe')]['noop'](_0x2daf('0x12f'));}var _0x34e42b=_0x2daf('0x130');var _0x43e912=util[_0x2daf('0x28')](_0x2daf('0x131'),FILES_PATH,rs[_0x2daf('0x11a')](0x4));var _0x33c5e0=util[_0x2daf('0x28')](_0x2daf('0x95'),_0x43e912,_0x34e42b);var _0x707c93=!![];if(_0x34d185[_0x2daf('0x132')]===_0x2daf('0x133')){_0x707c93=![];}var _0x41a2b5=this['channel'][_0x2daf('0x134')](_0x43e912,_0x34e42b,_0x34d185[_0x2daf('0x135')],_0x34d185['timeout'],undefined,_0x707c93);if(_0x41a2b5[_0x2daf('0x9c')]!==-0x1){this[_0x2daf('0xe')][_0x2daf('0xa4')](util[_0x2daf('0x28')]('google\x20%s\x20file\x20created',_0x33c5e0));var _0x34623b=this['googleASR'][_0x2daf('0xa0')](this,_0x34d185,_0x33c5e0);if(_0x34623b){for(var _0x182f4d in _0x34623b){if(_0x34623b[_0x2daf('0x8e')](_0x182f4d)){this[_0x2daf('0xe')][_0x2daf('0x97')](util[_0x2daf('0x28')](_0x2daf('0x136'),_0x182f4d['toUpperCase']()),_0x34623b[_0x182f4d]);}}return this['channel'][_0x2daf('0xa4')](util[_0x2daf('0x28')](_0x2daf('0x137'),JSON[_0x2daf('0x70')](_0x34623b)));}}return _0x41a2b5;};AGIVertices['prototype'][_0x2daf('0x138')]=function(_0xde1a3a){logger['info'](util['format'](_0x2daf('0x139'),_0xde1a3a[_0x2daf('0x36')]));if(!this[_0x2daf('0x80')](_0xde1a3a[_0x2daf('0x13a')])){return this[_0x2daf('0xe')]['noop'](_0x2daf('0x13b'));}if(!this[_0x2daf('0x80')](_0xde1a3a[_0x2daf('0x8b')])){return this[_0x2daf('0xe')][_0x2daf('0xa4')]('no\x20appsecret\x20configured');}var _0x2a9e9=_0x2daf('0x130');var _0x34efe2=util[_0x2daf('0x28')](_0x2daf('0x131'),FILES_PATH,rs[_0x2daf('0x11a')](0x4));var _0x4a23e8=util[_0x2daf('0x28')](_0x2daf('0x95'),_0x34efe2,_0x2a9e9);var _0x21a326=!![];if(_0xde1a3a['beep']===_0x2daf('0x133')){_0x21a326=![];}var _0x555f81=this[_0x2daf('0xe')]['recordFile'](_0x34efe2,_0x2a9e9,_0xde1a3a['intKey'],_0xde1a3a[_0x2daf('0x63')],undefined,_0x21a326);if(_0x555f81[_0x2daf('0x9c')]!==-0x1){this[_0x2daf('0xe')][_0x2daf('0xa4')](util[_0x2daf('0x28')](_0x2daf('0x13c'),_0x4a23e8));var _0x4a7d7e=this[_0x2daf('0x8a')][_0x2daf('0xa0')](this,_0xde1a3a,_0x4a23e8);if(_0x4a7d7e){for(var _0x54f197 in _0x4a7d7e){if(_0x4a7d7e['hasOwnProperty'](_0x54f197)){this[_0x2daf('0xe')][_0x2daf('0x97')](util[_0x2daf('0x28')](_0x2daf('0x13d'),_0x54f197['toUpperCase']()),_0x4a7d7e[_0x54f197]);}}return this[_0x2daf('0xe')]['noop'](util[_0x2daf('0x28')](_0x2daf('0x13e'),JSON['stringify'](_0x4a7d7e)));}}return _0x555f81;};AGIVertices[_0x2daf('0x16')][_0x2daf('0x13f')]=function(_0x12809f){logger[_0x2daf('0x2e')](util[_0x2daf('0x28')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x12809f[_0x2daf('0x36')]));return this[_0x2daf('0xe')][_0x2daf('0x140')](_0x12809f[_0x2daf('0x3c')],_0x12809f[_0x2daf('0x141')],_0x12809f[_0x2daf('0x142')]);};AGIVertices[_0x2daf('0x16')][_0x2daf('0x143')]=function(_0x3ddedc){logger[_0x2daf('0x2e')](util['format']('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x3ddedc['label']));if(!this['isConfigured'](_0x3ddedc['condition'])){return this['channel'][_0x2daf('0x4e')](_0x3ddedc,'no\x20condition\x20configured');}try{var _0x4cac52=eval(_0x3ddedc[_0x2daf('0x144')])?_0x2daf('0x145'):_0x2daf('0x146');this[_0x2daf('0xe')][_0x2daf('0xa4')](util[_0x2daf('0x28')]('EVAL\x20CONDITION\x20%s\x20%s',_0x3ddedc[_0x2daf('0x144')],_0x4cac52));return{'code':0xc8,'result':_0x4cac52};}catch(_0x5dcb54){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x2daf('0x16')][_0x2daf('0x147')]=function(_0x14b0ed){logger[_0x2daf('0x2e')](util[_0x2daf('0x28')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x14b0ed['label']));if(!this[_0x2daf('0x80')](_0x14b0ed[_0x2daf('0x148')])){return this['channel'][_0x2daf('0x4e')](_0x14b0ed,_0x2daf('0x149'));}var _0x4ab8a4=this[_0x2daf('0x22')][_0x2daf('0xa0')](this,_0x14b0ed[_0x2daf('0x148')]);if(!_0x4ab8a4){return this[_0x2daf('0xe')][_0x2daf('0x4e')](_0x14b0ed,_0x2daf('0x14a'));}for(var _0x43f6ef=0x0;_0x43f6ef<_0x4ab8a4[_0x2daf('0x93')];_0x43f6ef+=0x1){var _0x37c94=this[_0x2daf('0xe')][_0x2daf('0x10')](util[_0x2daf('0x28')](_0x2daf('0x14b'),_0x4ab8a4[_0x43f6ef]));if(_0x37c94['result']===-0x1){return _0x37c94;}logger[_0x2daf('0x2e')](util[_0x2daf('0x28')]('IFTIME\x20%s\x20%s',_0x4ab8a4[_0x43f6ef],_0x37c94[_0x2daf('0x9e')]));if(_0x37c94[_0x2daf('0x9e')]===_0x2daf('0x145')){logger[_0x2daf('0x2e')](util[_0x2daf('0x28')]('IFTIME\x20%s\x20%s',_0x4ab8a4[_0x43f6ef],_0x2daf('0x145')));this[_0x2daf('0xe')][_0x2daf('0xa4')](util[_0x2daf('0x28')]('IFTIME\x20%s\x20%s',_0x4ab8a4[_0x43f6ef],_0x2daf('0x145')));return{'code':0xc8,'result':_0x2daf('0x145')};}else{logger[_0x2daf('0x2e')](util[_0x2daf('0x28')]('IFTIME\x20%s\x20%s',_0x4ab8a4[_0x43f6ef],_0x2daf('0x146')));this['channel']['noop'](util[_0x2daf('0x28')](_0x2daf('0x14c'),_0x4ab8a4[_0x43f6ef],_0x2daf('0x146')));}}return{'code':0xc8,'result':_0x2daf('0x146')};};AGIVertices[_0x2daf('0x16')]['hangup']=function(_0x3235ce){logger[_0x2daf('0x2e')](util['format'](_0x2daf('0x14d'),_0x3235ce[_0x2daf('0x36')]));return this[_0x2daf('0xe')]['hangup']();};AGIVertices[_0x2daf('0x16')][_0x2daf('0x14e')]=function(_0x3ae619){logger[_0x2daf('0x2e')](util[_0x2daf('0x28')](_0x2daf('0x14f'),_0x3ae619['label']));if(!this[_0x2daf('0x80')](_0x3ae619[_0x2daf('0x76')])){return this[_0x2daf('0xe')][_0x2daf('0xa4')](_0x2daf('0x12f'));}var _0x4fa333=_0x2daf('0x130');var _0x2f89c6=util[_0x2daf('0x28')](_0x2daf('0x131'),FILES_PATH,rs[_0x2daf('0x11a')](0x4));var _0x49f0eb=util[_0x2daf('0x28')](_0x2daf('0x95'),_0x2f89c6,_0x4fa333);var _0x29c260=!![];if(_0x3ae619[_0x2daf('0x132')]==='NOBEEP'){_0x29c260=![];}var _0x4ed905=this[_0x2daf('0xe')][_0x2daf('0x134')](_0x2f89c6,_0x4fa333,_0x3ae619[_0x2daf('0x135')],_0x3ae619[_0x2daf('0x63')],undefined,_0x29c260);if(_0x4ed905[_0x2daf('0x9c')]!==-0x1){this[_0x2daf('0xe')][_0x2daf('0xa4')](util[_0x2daf('0x28')](_0x2daf('0x150'),_0x49f0eb));var _0x480d98=this[_0x2daf('0x7e')]['sync'](this,_0x3ae619,_0x49f0eb);if(_0x480d98){for(var _0x150d2a in _0x480d98){if(_0x480d98['hasOwnProperty'](_0x150d2a)){this[_0x2daf('0xe')][_0x2daf('0x97')](util[_0x2daf('0x28')](_0x2daf('0x151'),_0x150d2a[_0x2daf('0x66')]()),_0x480d98[_0x150d2a]);}}return this['channel'][_0x2daf('0xa4')](util[_0x2daf('0x28')](_0x2daf('0x152'),JSON[_0x2daf('0x70')](_0x480d98)));}}return _0x4ed905;};AGIVertices['prototype'][_0x2daf('0x153')]=function(_0x24dcfa){logger[_0x2daf('0x2e')](util[_0x2daf('0x28')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x24dcfa['label']));if(!this[_0x2daf('0x80')](_0x24dcfa['key'])){return this[_0x2daf('0xe')][_0x2daf('0xa4')](_0x2daf('0x12f'));}if(!this[_0x2daf('0x80')](_0x24dcfa['text'])){return this[_0x2daf('0xe')][_0x2daf('0xa4')](_0x2daf('0xa5'));}this[_0x2daf('0xe')]['noop'](util[_0x2daf('0x28')]('Trying\x20ispeech\x20TTS\x20%s',_0x24dcfa[_0x2daf('0x59')]));var _0x4b765f=this['ispeechTTS'][_0x2daf('0xa0')](this,_0x24dcfa);if(_0x4b765f){this['channel'][_0x2daf('0xa4')](util['format']('ispeech\x20%s\x20file\x20created',_0x4b765f));var _0x5b1c18=this['channel'][_0x2daf('0x104')](_0x4b765f,_0x24dcfa[_0x2daf('0x135')]);try{fs['unlink'](_0x4b765f+'.wav');}catch(_0x4f049c){logger[_0x2daf('0x4e')](_0x4f049c);}return _0x5b1c18;}return this['channel'][_0x2daf('0x4e')](_0x24dcfa,_0x2daf('0x154'));};AGIVertices[_0x2daf('0x16')][_0x2daf('0x155')]=function(_0x2ee20b){logger[_0x2daf('0x2e')](util[_0x2daf('0x28')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x2ee20b[_0x2daf('0x36')]));if(!this[_0x2daf('0x80')](_0x2ee20b[_0x2daf('0x156')])){return this[_0x2daf('0xe')][_0x2daf('0x4e')](_0x2ee20b,_0x2daf('0x157'));}logger[_0x2daf('0x2e')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x2daf('0xe')][_0x2daf('0x39')],_0x2ee20b[_0x2daf('0x156')]));var _0x41e3c7=this[_0x2daf('0x53')][_0x2daf('0xa0')](this,_0x2ee20b[_0x2daf('0x156')]);if(_0x41e3c7){logger[_0x2daf('0x2e')](util['format'](_0x2daf('0x158'),this[_0x2daf('0xe')][_0x2daf('0x39')],_0x2ee20b[_0x2daf('0x156')]));this[_0x2daf('0xe')][_0x2daf('0xa4')](util[_0x2daf('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x2daf('0xe')][_0x2daf('0x39')],_0x2ee20b[_0x2daf('0x156')]));return{'code':0xc8,'result':_0x2daf('0x159')};}else{logger[_0x2daf('0x2e')](util['format'](_0x2daf('0x15a'),this[_0x2daf('0xe')][_0x2daf('0x39')],_0x2ee20b[_0x2daf('0x156')]));this[_0x2daf('0xe')][_0x2daf('0xa4')](util[_0x2daf('0x28')](_0x2daf('0x15a'),this[_0x2daf('0xe')][_0x2daf('0x39')],_0x2ee20b[_0x2daf('0x156')]));return{'code':0xc8,'result':_0x2daf('0x15b')};}};AGIVertices[_0x2daf('0x16')]['logout']=function(_0x123ec6){logger[_0x2daf('0x2e')](util[_0x2daf('0x28')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x123ec6[_0x2daf('0x36')]));if(!this[_0x2daf('0x80')](_0x123ec6[_0x2daf('0x156')])){return this['channel'][_0x2daf('0x4e')](_0x123ec6,'no\x20find\x20by\x20configured');}logger[_0x2daf('0x2e')](util[_0x2daf('0x28')](_0x2daf('0x15c'),this[_0x2daf('0xe')][_0x2daf('0x39')],_0x123ec6[_0x2daf('0x156')]));var _0x450a39=this[_0x2daf('0x50')][_0x2daf('0xa0')](this,_0x123ec6[_0x2daf('0x156')]);if(_0x450a39){logger[_0x2daf('0x2e')](util[_0x2daf('0x28')](_0x2daf('0x158'),this[_0x2daf('0xe')][_0x2daf('0x39')],_0x123ec6[_0x2daf('0x156')]));this[_0x2daf('0xe')][_0x2daf('0xa4')](util[_0x2daf('0x28')](_0x2daf('0x158'),this['channel'][_0x2daf('0x39')],_0x123ec6[_0x2daf('0x156')]));return{'code':0xc8,'result':_0x2daf('0x159')};}else{logger[_0x2daf('0x2e')](util[_0x2daf('0x28')](_0x2daf('0x15a'),this['channel'][_0x2daf('0x39')],_0x123ec6[_0x2daf('0x156')]));this[_0x2daf('0xe')]['noop'](util['format'](_0x2daf('0x15a'),this['channel']['callerid'],_0x123ec6['findBy']));return{'code':0xc8,'result':_0x2daf('0x15b')};}};AGIVertices[_0x2daf('0x16')][_0x2daf('0x15d')]=function(_0x222942){logger[_0x2daf('0x2e')](util['format'](_0x2daf('0x15e'),_0x222942['label']));if(!this[_0x2daf('0x80')](_0x222942[_0x2daf('0x15f')])){return this[_0x2daf('0xe')][_0x2daf('0x4e')](_0x222942,'no\x20operation\x20configured');}this[_0x2daf('0xe')][_0x2daf('0xa4')](util[_0x2daf('0x28')](_0x2daf('0x160'),_0x222942[_0x2daf('0x15f')]));var _0x24a67b=eval(_0x222942['operation']);if(!this[_0x2daf('0x80')](_0x222942[_0x2daf('0xd6')])){return this[_0x2daf('0xe')][_0x2daf('0xa4')](_0x2daf('0xd7'));}var _0x17a7df=this['getVariable'][_0x2daf('0xa0')](this,_0x222942[_0x2daf('0xd6')]);if(!_0x17a7df){return this[_0x2daf('0xe')]['error'](_0x222942,'no\x20variable\x20found');}if(_[_0x2daf('0x96')](_0x24a67b)){var _0x51ede2=this;_0x24a67b[_0x2daf('0xd9')](function(_0x2e3467,_0x49cb43){_0x51ede2['channel'][_0x2daf('0x97')](util[_0x2daf('0x28')](_0x2daf('0x161'),_0x17a7df,_0x49cb43),_0x2e3467);});return this[_0x2daf('0xe')]['noop'](util[_0x2daf('0x28')](_0x2daf('0x162'),_0x17a7df));}else{return this[_0x2daf('0xe')][_0x2daf('0x97')](_0x17a7df,_0x24a67b);}};AGIVertices[_0x2daf('0x16')][_0x2daf('0xb')]=function(_0x12b45d){logger['info'](util[_0x2daf('0x28')](_0x2daf('0x163'),_0x12b45d[_0x2daf('0x36')]));if(_0x12b45d[_0x2daf('0xa1')]===0x0){return this[_0x2daf('0x9f')](_0x12b45d);}_0x12b45d[_0x2daf('0xa1')]-=0x1;if(!this['isConfigured'](_0x12b45d[_0x2daf('0x114')])){return this[_0x2daf('0xe')][_0x2daf('0x4e')](_0x12b45d,_0x2daf('0x164'));}var _0x2341d4=this[_0x2daf('0x1d')][_0x2daf('0xa0')](this,_0x12b45d['file_id']);if(!_0x2341d4){return this['channel'][_0x2daf('0x4e')](_0x12b45d,_0x2daf('0x165'));}var _0x2e3b65=this[_0x2daf('0xe')]['getData'](_0x2341d4,_0x12b45d[_0x2daf('0x116')],_0x12b45d[_0x2daf('0x166')]);var _0x33cc8d=_0x2e3b65['result'];if(_0x2e3b65[_0x2daf('0x9c')]===-0x1){this[_0x2daf('0x34')][_0x2daf('0xa0')](this,_0x12b45d,'-1');return _0x2e3b65;}else if(_0x2e3b65[_0x2daf('0x9e')]===_0x2daf('0x63')){_0x2e3b65['result']=_0x2e3b65[_0x2daf('0x9c')]['length']>0x0?_0x2e3b65[_0x2daf('0x9c')]:'t';}else if(_[_0x2daf('0x42')](_0x2e3b65[_0x2daf('0x9c')])){_0x2e3b65[_0x2daf('0x9c')]='#';_0x33cc8d='#';}if(!this['isConfigured'](_0x12b45d[_0x2daf('0xd6')])){this['channel'][_0x2daf('0xa4')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x2ec897=this[_0x2daf('0x10')][_0x2daf('0xa0')](this,_0x12b45d[_0x2daf('0xd6')]);if(!_0x2ec897){return this[_0x2daf('0xe')][_0x2daf('0x4e')](_0x12b45d,_0x2daf('0xd8'));}this[_0x2daf('0xe')][_0x2daf('0x97')](_0x2ec897,_0x33cc8d);}this[_0x2daf('0x34')]['sync'](this,_0x12b45d,_0x33cc8d);return _0x2e3b65;};AGIVertices[_0x2daf('0x16')]['noop']=function(_0x3483c4){logger['info'](util[_0x2daf('0x28')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x3483c4[_0x2daf('0x36')]));return this[_0x2daf('0xe')][_0x2daf('0xa4')](_0x3483c4[_0x2daf('0x167')]||_0x3483c4[_0x2daf('0x36')]);};AGIVertices[_0x2daf('0x16')][_0x2daf('0x168')]=function(_0x135804){logger['info'](util[_0x2daf('0x28')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x135804[_0x2daf('0x36')]));if(!this['isConfigured'](_0x135804[_0x2daf('0x156')])){return this[_0x2daf('0xe')]['error'](_0x135804,_0x2daf('0x157'));}logger[_0x2daf('0x2e')](util[_0x2daf('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x2daf('0x39')],_0x135804[_0x2daf('0x156')]));var _0x194bd0=this[_0x2daf('0x4b')]['sync'](this,_0x135804[_0x2daf('0x169')]);var _0x2f37e0=this[_0x2daf('0x16a')][_0x2daf('0xa0')](this,_0x135804[_0x2daf('0x156')],_0x194bd0);if(_0x2f37e0){logger[_0x2daf('0x2e')](util[_0x2daf('0x28')](_0x2daf('0x158'),this[_0x2daf('0xe')][_0x2daf('0x39')],_0x135804[_0x2daf('0x156')]));this[_0x2daf('0xe')][_0x2daf('0xa4')](util[_0x2daf('0x28')](_0x2daf('0x158'),this[_0x2daf('0xe')]['callerid'],_0x135804[_0x2daf('0x156')]));return{'code':0xc8,'result':_0x2daf('0x159')};}else{logger[_0x2daf('0x2e')](util[_0x2daf('0x28')](_0x2daf('0x15a'),this[_0x2daf('0xe')]['callerid'],_0x135804[_0x2daf('0x156')]));this[_0x2daf('0xe')][_0x2daf('0xa4')](util[_0x2daf('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x2daf('0xe')][_0x2daf('0x39')],_0x135804[_0x2daf('0x156')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x2daf('0x16')][_0x2daf('0x16b')]=function(_0xe247b){logger[_0x2daf('0x2e')](util[_0x2daf('0x28')](_0x2daf('0x16c'),_0xe247b[_0x2daf('0x36')]));if(!this['isConfigured'](_0xe247b[_0x2daf('0x114')])){return this['channel'][_0x2daf('0x4e')](_0xe247b,_0x2daf('0x164'));}var _0x2dec56=this['getSound'][_0x2daf('0xa0')](this,_0xe247b[_0x2daf('0x114')]);if(!_0x2dec56){return this['channel'][_0x2daf('0x4e')](_0xe247b,_0x2daf('0x165'));}var _0x141347=this[_0x2daf('0xe')][_0x2daf('0x55')](_0x2daf('0x16d'),[_0x2dec56,_0xe247b[_0x2daf('0x110')]]);if(_0x141347[_0x2daf('0x9c')]===-0x1){return _0x141347;}return this['channel'][_0x2daf('0xa4')](util['format'](_0x2daf('0xc2'),_0x2daf('0x16d'),_0x2dec56));};AGIVertices[_0x2daf('0x16')][_0x2daf('0x16e')]=function(_0x7e38c){logger[_0x2daf('0x2e')](util['format'](_0x2daf('0x16f'),_0x7e38c['label']));if(!this[_0x2daf('0x80')](_0x7e38c[_0x2daf('0x170')])){return this['channel'][_0x2daf('0x4e')](_0x7e38c,_0x2daf('0x171'));}var _0x3f1985='';var _0x54abf2=parseInt(_0x7e38c[_0x2daf('0x170')],0xa);if(isNaN(_0x54abf2)){_0x3f1985=_0x7e38c[_0x2daf('0x170')];}else{_0x3f1985=this[_0x2daf('0x14')]['sync'](this,_0x7e38c[_0x2daf('0x170')]);if(!_0x3f1985){return this['channel'][_0x2daf('0x4e')](_0x7e38c,_0x2daf('0x172'));}}var _0x11c9da='';if(this[_0x2daf('0x80')](_0x7e38c[_0x2daf('0x114')])){var _0x91edec=this[_0x2daf('0x1d')][_0x2daf('0xa0')](this,_0x7e38c[_0x2daf('0x114')]);if(_0x91edec){_0x11c9da=_0x91edec;}}this['createSquareDetailsReport'][_0x2daf('0xa0')](this,_0x7e38c,_0x3f1985);if(_0x7e38c[_0x2daf('0x110')][_0x2daf('0x173')]('x')<0x0){_0x7e38c[_0x2daf('0x110')]+='x';}if(_0x7e38c[_0x2daf('0x110')][_0x2daf('0x173')]('X')<0x0){_0x7e38c[_0x2daf('0x110')]+='X';}this[_0x2daf('0xe')]['setVariable'](_0x2daf('0x174'),_0x3f1985?_0x3f1985[_0x2daf('0x175')]():'');var _0x4509f8=this[_0x2daf('0xe')]['exec'](_0x2daf('0x176'),[_0x3f1985,_0x7e38c[_0x2daf('0x110')],_0x7e38c[_0x2daf('0x61')],_0x11c9da,_0x7e38c[_0x2daf('0x63')],_0x7e38c['agi'],_0x7e38c['macro'],_0x7e38c[_0x2daf('0x177')],'',_0x7e38c[_0x2daf('0x178')]]);if(_0x4509f8['result']===-0x1){return _0x4509f8;}return this[_0x2daf('0xe')]['noop'](util[_0x2daf('0x28')]('Executed\x20command\x20%s\x20%s','QUEUE',_0x3f1985));};AGIVertices[_0x2daf('0x16')][_0x2daf('0x179')]=function(_0x21c1e3){logger['info'](util[_0x2daf('0x28')](_0x2daf('0x17a'),_0x21c1e3[_0x2daf('0x36')]));var _0x49f8a9=_0x21c1e3[_0x2daf('0x17b')]||_0x2daf('0x130');var _0x3328a0=util[_0x2daf('0x28')]('%s_%s',this[_0x2daf('0xe')][_0x2daf('0x35')],rs[_0x2daf('0x11a')](0x5));var _0x9a3541=util['format'](_0x2daf('0x17c'),FILES_PATH,_0x3328a0,_0x49f8a9);var _0x2d8925=util[_0x2daf('0x28')](_0x2daf('0x131'),FILES_PATH,_0x3328a0);this['createSquareRecording'][_0x2daf('0xa0')](this,_0x21c1e3,_0x3328a0,_0x9a3541);this[_0x2daf('0xe')]['setVariable']('RECORDING_SAVENAME',_0x3328a0);logger[_0x2daf('0x2e')](_0x2daf('0x17d'),_0x2d8925,_0x49f8a9,_0x21c1e3[_0x2daf('0x17e')],_0x21c1e3[_0x2daf('0x63')]);return this[_0x2daf('0xe')][_0x2daf('0x134')](_0x2d8925,_0x49f8a9,_0x21c1e3[_0x2daf('0x17e')],_0x21c1e3['timeout'],undefined,!![]);};AGIVertices[_0x2daf('0x16')]['restapi']=function(_0x135aa3){logger[_0x2daf('0x2e')](util[_0x2daf('0x28')](_0x2daf('0x17f'),_0x135aa3[_0x2daf('0x36')]));if(!this[_0x2daf('0x80')](_0x135aa3[_0x2daf('0x61')])){return this['channel']['noop']('no\x20url\x20configured');}var _0x1e617e=this[_0x2daf('0x60')][_0x2daf('0xa0')](this,_0x135aa3);logger['info'](util[_0x2daf('0x28')](_0x2daf('0x180'),util[_0x2daf('0x181')](_0x1e617e,{'showHidden':![],'depth':null})));if(!this[_0x2daf('0x80')](_0x135aa3['variable_id'])){return this[_0x2daf('0xe')][_0x2daf('0xa4')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x4eaa5f=this[_0x2daf('0x10')][_0x2daf('0xa0')](this,_0x135aa3[_0x2daf('0xd6')]);if(!_0x4eaa5f){return this['channel'][_0x2daf('0x4e')](_0x135aa3,_0x2daf('0xd8'));}this[_0x2daf('0xe')]['setVariable'](util[_0x2daf('0x28')](_0x2daf('0x182'),_0x4eaa5f),_0x1e617e[_0x2daf('0x71')]?_0x1e617e[_0x2daf('0x71')]:_0x2daf('0x183'));this[_0x2daf('0xe')][_0x2daf('0x97')](util[_0x2daf('0x28')]('%s_STATUS_MESSAGE',_0x4eaa5f),_0x1e617e[_0x2daf('0x72')]?_0x1e617e[_0x2daf('0x72')]:'OK');if(_0x1e617e[_0x2daf('0x67')]){try{this[_0x2daf('0x94')](_0x1e617e['body'],_0x4eaa5f);}catch(_0x3d6a69){logger[_0x2daf('0x4e')](util['format'](_0x2daf('0x184'),_0x4eaa5f));}}return this[_0x2daf('0xe')][_0x2daf('0xa4')](util['format'](_0x2daf('0xdd'),_0x4eaa5f));};AGIVertices['prototype'][_0x2daf('0x185')]=function(_0x752fd5){logger[_0x2daf('0x2e')](util[_0x2daf('0x28')](_0x2daf('0x186'),_0x752fd5[_0x2daf('0x36')]));return this[_0x2daf('0xe')]['sayDigits'](_0x752fd5['digits'][_0x2daf('0x187')](/\s+/g,''),_0x752fd5[_0x2daf('0x17e')]);};AGIVertices[_0x2daf('0x16')][_0x2daf('0x188')]=function(_0x556618){logger[_0x2daf('0x2e')](util[_0x2daf('0x28')](_0x2daf('0x189'),_0x556618['label']));return this[_0x2daf('0xe')][_0x2daf('0x18a')](_0x556618[_0x2daf('0x64')][_0x2daf('0x187')](/\s+/g,''),_0x556618['escape_digits']);};AGIVertices[_0x2daf('0x16')][_0x2daf('0x18b')]=function(_0x1b3545){logger[_0x2daf('0x2e')](util[_0x2daf('0x28')](_0x2daf('0x18c'),_0x1b3545[_0x2daf('0x36')]));return this[_0x2daf('0xe')][_0x2daf('0x18d')](_0x1b3545['text'],_0x1b3545[_0x2daf('0x17e')]);};AGIVertices['prototype']['sendMail']=function(_0x384486){logger['info'](util[_0x2daf('0x28')](_0x2daf('0x18e'),_0x384486[_0x2daf('0x36')]));if(!this[_0x2daf('0x80')](_0x384486[_0x2daf('0x18f')])){return this['channel']['noop'](_0x2daf('0x190'));}var _0x22d600=this['getMailAccount'][_0x2daf('0xa0')](this,_0x384486['account_id']);if(!_0x22d600||!_0x22d600['Smtp']){return this[_0x2daf('0xe')][_0x2daf('0x4e')](_0x384486,'no\x20mail\x20account\x20found');}var _0xb62ce2={'from':util[_0x2daf('0x28')](_0x2daf('0x191'),_0x22d600[_0x2daf('0x12')],_0x22d600[_0x2daf('0x192')]||_0x22d600['Smtp'][_0x2daf('0x193')]),'to':_0x384486['to']||'','cc':_0x384486['cc']||'','bcc':_0x384486[_0x2daf('0x194')]||'','subject':_0x384486[_0x2daf('0x195')],'html':_0x384486['text'],'text':_0x384486['text']};var _0xb21bf3={'tls':{'rejectUnauthorized':![]}};if(_0x22d600[_0x2daf('0x196')][_0x2daf('0x197')]){_0xb21bf3[_0x2daf('0x197')]=_0x22d600['Smtp']['service'];}else{_0xb21bf3[_0x2daf('0x198')]=_0x22d600[_0x2daf('0x196')][_0x2daf('0x198')];_0xb21bf3[_0x2daf('0x199')]=_0x22d600['Smtp']['port'];_0xb21bf3[_0x2daf('0x19a')]=_0x22d600[_0x2daf('0x196')][_0x2daf('0x19a')];}if(_0x22d600[_0x2daf('0x196')]['authentication']){_0xb21bf3['auth']={'user':_0x22d600[_0x2daf('0x196')]['user'],'pass':_0x22d600[_0x2daf('0x196')][_0x2daf('0x19b')]};}if(this[_0x2daf('0x80')](_0x384486[_0x2daf('0x19c')])){}logger[_0x2daf('0xdf')](_0x2daf('0x19d'),JSON['stringify'](_0xb62ce2));this[_0x2daf('0x34')][_0x2daf('0xa0')](this,_0x384486,_0x384486[_0x2daf('0x18f')]);this[_0x2daf('0xe')]['noop'](util[_0x2daf('0x28')](_0x2daf('0x19e'),_0x22d600['name']));this[_0x2daf('0x21')][_0x2daf('0xa0')](this,_0xb21bf3,_0xb62ce2);return this['channel']['noop'](_0x2daf('0x19f'));};AGIVertices[_0x2daf('0x16')][_0x2daf('0x1a0')]=function(_0x515f8c){logger[_0x2daf('0x2e')](util[_0x2daf('0x28')](_0x2daf('0x1a1'),_0x515f8c['label']));return this[_0x2daf('0xe')][_0x2daf('0xa4')](_0x2daf('0x1a2'));};AGIVertices[_0x2daf('0x16')][_0x2daf('0x1a3')]=function(_0x4834f4){logger[_0x2daf('0x2e')](util[_0x2daf('0x28')](_0x2daf('0x1a4'),_0x4834f4[_0x2daf('0x36')]));if(!this['isConfigured'](_0x4834f4[_0x2daf('0x1a5')])){return this[_0x2daf('0xe')][_0x2daf('0xa4')](_0x2daf('0x1a6'));}var _0x194e88=this['getSmsAccount'][_0x2daf('0xa0')](this,_0x4834f4[_0x2daf('0x1a5')]);if(!_0x194e88){return this[_0x2daf('0xe')][_0x2daf('0x4e')](_0x4834f4,'no\x20sms\x20account\x20found');}var _0x1d0ea1={'body':_0x4834f4[_0x2daf('0x1a7')],'phone':_0x4834f4['to']||'','SmsAccountId':_0x194e88['id']};logger[_0x2daf('0xdf')](_0x2daf('0x1a8'),JSON['stringify'](_0x1d0ea1));this[_0x2daf('0x34')][_0x2daf('0xa0')](this,_0x4834f4,_0x4834f4[_0x2daf('0x1a5')]);this[_0x2daf('0xe')][_0x2daf('0xa4')](util[_0x2daf('0x28')](_0x2daf('0x1a9'),_0x194e88[_0x2daf('0x12')]));this[_0x2daf('0x33')][_0x2daf('0xa0')](this,_0x1d0ea1);return this['channel'][_0x2daf('0xa4')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x2daf('0x16')][_0x2daf('0x1aa')]=function(_0x396d21){logger[_0x2daf('0x2e')](util['format'](_0x2daf('0x1ab'),_0x396d21[_0x2daf('0x36')]));if(!this[_0x2daf('0x80')](_0x396d21[_0x2daf('0xd6')])){return this['channel'][_0x2daf('0x4e')](_0x396d21,_0x2daf('0x1ac'));}var _0x42667a=this[_0x2daf('0x10')][_0x2daf('0xa0')](this,_0x396d21[_0x2daf('0xd6')]);if(!_0x42667a){return this['channel'][_0x2daf('0x4e')](_0x396d21,'no\x20variable\x20found');}return this[_0x2daf('0xe')][_0x2daf('0x97')](_0x42667a,_0x396d21[_0x2daf('0x1ad')]);};AGIVertices['prototype'][_0x2daf('0x1ae')]=function(_0xdf4114){logger['info'](util[_0x2daf('0x28')]('Enter\x20in\x20START\x20(%s)\x20block',_0xdf4114[_0x2daf('0x36')]));this[_0x2daf('0xe')][_0x2daf('0xa4')](_0x2daf('0x1af'));if(_0xdf4114[_0x2daf('0xb4')]===_0x2daf('0x1b0')){this[_0x2daf('0xe')][_0x2daf('0xa4')](_0x2daf('0x1b1'));return this['channel']['answer']();}return this[_0x2daf('0xe')][_0x2daf('0xa4')](_0x2daf('0x1b2'));};AGIVertices[_0x2daf('0x16')][_0x2daf('0x1b3')]=function(_0x51b2bb){logger[_0x2daf('0x2e')](util[_0x2daf('0x28')](_0x2daf('0x1b4'),_0x51b2bb[_0x2daf('0x36')]));if(!this[_0x2daf('0x80')](_0x51b2bb[_0x2daf('0x1b5')])){return this[_0x2daf('0xe')]['error'](_0x51b2bb,'no\x20subproject\x20selected');}var _0x213137=this[_0x2daf('0x17')]['sync'](this,_0x51b2bb['project_id']);if(!this['isConfigured'](_0x213137)){return this[_0x2daf('0xe')][_0x2daf('0x4e')](_0x51b2bb,util[_0x2daf('0x28')](_0x2daf('0x1b6'),_0x51b2bb[_0x2daf('0x1b5')]));}if(_0x213137===this['channel'][_0x2daf('0x38')]){return this[_0x2daf('0xe')][_0x2daf('0x4e')](_0x51b2bb,_0x2daf('0x1b7'));}this['createSquareDetailsReport'][_0x2daf('0xa0')](this,_0x51b2bb,_0x213137);var _0x178773=this[_0x2daf('0xe')][_0x2daf('0x55')](_0x2daf('0x1b8'),util['format'](_0x2daf('0x1b9'),config[_0x2daf('0x7')][_0x2daf('0x198')]||_0x2daf('0x1ba'),_0x213137,this['channel'][_0x2daf('0x38')]));if(_0x178773[_0x2daf('0x9c')]===-0x1){return _0x178773;}return this[_0x2daf('0xe')][_0x2daf('0xa4')](util[_0x2daf('0x28')](_0x2daf('0xc2'),_0x2daf('0x1b8'),_0x213137));};AGIVertices['prototype'][_0x2daf('0x1bb')]=function(_0x1fa44f){logger['info'](util['format'](_0x2daf('0x1bc'),_0x1fa44f[_0x2daf('0x36')]));var _0x20db00=this['shellCommand']['sync'](this,_0x1fa44f[_0x2daf('0xb2')]);this[_0x2daf('0x34')][_0x2daf('0xa0')](this,_0x1fa44f,_0x1fa44f['command']);if(this['isConfigured'](_0x1fa44f['variable_id'])){var _0x410218=this[_0x2daf('0x10')]['sync'](this,_0x1fa44f[_0x2daf('0xd6')]);if(_0x410218){this[_0x2daf('0xe')][_0x2daf('0x97')](_0x410218,_0x20db00);return this[_0x2daf('0xe')][_0x2daf('0xa4')](util[_0x2daf('0x28')](_0x2daf('0x1bd'),_0x1fa44f[_0x2daf('0xb2')],_0x410218));}}return this[_0x2daf('0xe')][_0x2daf('0xa4')](util[_0x2daf('0x28')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x1fa44f[_0x2daf('0xb2')]));};AGIVertices['prototype']['google_cloud_tts']=function(_0x11f274){logger['info'](util[_0x2daf('0x28')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x11f274[_0x2daf('0x36')]));_0x11f274[_0x2daf('0x59')]=_0x11f274[_0x2daf('0x59')][_0x2daf('0x187')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x2daf('0x80')](_0x11f274['apiKey'])){return this['channel'][_0x2daf('0xa4')](_0x2daf('0x1be'));}if(!this[_0x2daf('0x80')](_0x11f274[_0x2daf('0x59')])){return this[_0x2daf('0xe')][_0x2daf('0xa4')](_0x2daf('0xa5'));}this[_0x2daf('0xe')][_0x2daf('0xa4')](util['format'](_0x2daf('0x1bf'),_0x11f274[_0x2daf('0x59')]));var _0x3cc633=this[_0x2daf('0x1c0')][_0x2daf('0xa0')](this,_0x11f274);if(_0x3cc633){this[_0x2daf('0xe')][_0x2daf('0xa4')](util[_0x2daf('0x28')](_0x2daf('0x1c1'),_0x3cc633));var _0x15248d=this[_0x2daf('0xe')][_0x2daf('0x104')](_0x3cc633);try{fs['unlink'](_0x3cc633+_0x2daf('0x106'));}catch(_0x50e74c){logger['error'](_0x50e74c);}return _0x15248d;}return this[_0x2daf('0xe')][_0x2daf('0x4e')](_0x11f274,_0x2daf('0x1c2'));};AGIVertices['prototype'][_0x2daf('0x1c3')]=function(_0x2e9813){logger[_0x2daf('0x2e')](util[_0x2daf('0x28')](_0x2daf('0x1c4'),_0x2e9813['label']));_0x2e9813[_0x2daf('0x59')]=_0x2e9813[_0x2daf('0x59')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x2daf('0x80')](_0x2e9813[_0x2daf('0x59')])){return this[_0x2daf('0xe')]['noop']('no\x20text\x20configured');}this['channel']['noop'](util[_0x2daf('0x28')]('Trying\x20Google\x20TTS\x20%s',_0x2e9813[_0x2daf('0x59')]));var _0x5d13fc=this[_0x2daf('0x5e')][_0x2daf('0xa0')](this,_0x2e9813);if(_0x5d13fc){this['channel'][_0x2daf('0xa4')](util[_0x2daf('0x28')](_0x2daf('0x1c5'),_0x5d13fc));var _0x2f545f=this[_0x2daf('0xe')]['streamFile'](_0x5d13fc);try{fs['unlink'](_0x5d13fc+'.wav');}catch(_0x721f97){logger[_0x2daf('0x4e')](_0x721f97);}return _0x2f545f;}return this[_0x2daf('0xe')]['error'](_0x2e9813,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x2daf('0x16')][_0x2daf('0x1c6')]=function(_0x4920d3){logger[_0x2daf('0x2e')](util[_0x2daf('0x28')](_0x2daf('0x1c7'),_0x4920d3['label']));if(!this['isConfigured'](_0x4920d3['findBy'])){return this[_0x2daf('0xe')][_0x2daf('0x4e')](_0x4920d3,_0x2daf('0x157'));}logger[_0x2daf('0x2e')](util['format'](_0x2daf('0x15c'),this[_0x2daf('0xe')][_0x2daf('0x39')],_0x4920d3[_0x2daf('0x156')]));var _0x343a66=this[_0x2daf('0x4f')][_0x2daf('0xa0')](this,_0x4920d3[_0x2daf('0x156')]);if(_0x343a66){logger[_0x2daf('0x2e')](util[_0x2daf('0x28')](_0x2daf('0x158'),this[_0x2daf('0xe')]['callerid'],_0x4920d3[_0x2daf('0x156')]));this['channel'][_0x2daf('0xa4')](util['format'](_0x2daf('0x158'),this['channel'][_0x2daf('0x39')],_0x4920d3[_0x2daf('0x156')]));return{'code':0xc8,'result':'success'};}else{logger[_0x2daf('0x2e')](util[_0x2daf('0x28')](_0x2daf('0x15a'),this[_0x2daf('0xe')][_0x2daf('0x39')],_0x4920d3[_0x2daf('0x156')]));this[_0x2daf('0xe')]['noop'](util['format'](_0x2daf('0x15a'),this['channel'][_0x2daf('0x39')],_0x4920d3[_0x2daf('0x156')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x2daf('0x16')][_0x2daf('0x1c8')]=function(_0xdb842e){logger[_0x2daf('0x2e')](util[_0x2daf('0x28')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0xdb842e[_0x2daf('0x36')]));var _0x37f7ee=this[_0x2daf('0xe')]['exec'](_0x2daf('0x1c9'),[_0xdb842e[_0x2daf('0x1ca')],_0xdb842e[_0x2daf('0xa6')]]);if(_0x37f7ee['result']===-0x1){return _0x37f7ee;}return this['channel'][_0x2daf('0xa4')](util[_0x2daf('0x28')](_0x2daf('0xc2'),_0x2daf('0x1c9'),_0xdb842e[_0x2daf('0x1ca')]));};AGIVertices['prototype']['vswitch']=function(_0x2f6938){logger[_0x2daf('0x2e')](util[_0x2daf('0x28')](_0x2daf('0x1cb'),_0x2f6938[_0x2daf('0x36')]));if(!this['isConfigured'](_0x2f6938[_0x2daf('0xd6')])){return this[_0x2daf('0xe')]['error'](_0x2f6938,_0x2daf('0x1ac'));}var _0x493042=this[_0x2daf('0x10')][_0x2daf('0xa0')](this,_0x2f6938[_0x2daf('0xd6')]);if(!_0x493042){return this[_0x2daf('0xe')][_0x2daf('0x4e')](_0x2f6938,_0x2daf('0xd8'));}var _0x57dcc6=this[_0x2daf('0xe')][_0x2daf('0x10')](_0x493042);return{'code':0xc8,'result':_0x57dcc6[_0x2daf('0x9e')]?_0x57dcc6[_0x2daf('0x9e')]:'-'};};String[_0x2daf('0x16')][_0x2daf('0x9a')]=function(_0x10b5c3,_0x12b41f){return this[_0x2daf('0x99')](_0x10b5c3)['join'](_0x12b41f);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 7b6356d..24642f4 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 _0x9bfd=['finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','error','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','attended','[%s][HANGUP:UNIQUEID]','isUndefined','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','prototype','startAcw','interface','queue','voiceQueues','ACW','mandatoryDisposition','mandatoryDispositionPause','name','then','getAgent','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','timer','update','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9bfd,0x181));var _0xd9bf=function(_0xca95cd,_0x143af0){_0xca95cd=_0xca95cd-0x0;var _0x511417=_0x9bfd[_0xca95cd];return _0x511417;};'use strict';var util=require('util');var _=require(_0xd9bf('0x0'));var moment=require('moment');var ami=require(_0xd9bf('0x1'));var logger=require(_0xd9bf('0x2'))('acw');var RpcUser=require(_0xd9bf('0x3'));var RpcVoiceAgentReport=require(_0xd9bf('0x4'));function Acw(_0x1ed35e){this['voiceQueues']=_0x1ed35e['voiceQueues'];this['agents']=_0x1ed35e[_0xd9bf('0x5')];this[_0xd9bf('0x6')]=_0x1ed35e['timers'];this[_0xd9bf('0x7')]={};ami['on'](_0xd9bf('0x8'),this[_0xd9bf('0x9')][_0xd9bf('0xa')](this));ami['on'](_0xd9bf('0xb'),this['syncHangupRequest'][_0xd9bf('0xa')](this));ami['on'](_0xd9bf('0xc'),this[_0xd9bf('0xd')][_0xd9bf('0xa')](this));ami['on'](_0xd9bf('0xe'),this[_0xd9bf('0xf')][_0xd9bf('0xa')](this));ami['on'](_0xd9bf('0x10'),this[_0xd9bf('0x11')]['bind'](this));ami['on']('blindtransfer',this[_0xd9bf('0x12')][_0xd9bf('0xa')](this));ami['on'](_0xd9bf('0x13'),this[_0xd9bf('0x14')]['bind'](this));}function getDiff(_0x17ad83){var _0x1702ec=moment()[_0xd9bf('0x15')](0x0);var _0x3f7daa=moment(_0x17ad83)[_0xd9bf('0x15')](0x0);return _0x1702ec[_0xd9bf('0x16')](_0x3f7daa,'seconds');}Acw[_0xd9bf('0x17')][_0xd9bf('0x18')]=function(_0x5192d0){try{var _0x2560d8=this;var _0xb8f907=this[_0xd9bf('0x7')][_0x5192d0][_0xd9bf('0x19')];var _0x4234f2=this[_0xd9bf('0x7')][_0x5192d0][_0xd9bf('0x1a')];var _0x57332a=this[_0xd9bf('0x1b')][_0x4234f2];var _0x758c39=![];var _0x529be1=_0xd9bf('0x1c');if(_0x57332a[_0xd9bf('0x1d')]){if(_0x57332a[_0xd9bf('0x1e')]['name']){_0x758c39=!![];_0x529be1=_0x57332a['mandatoryDispositionPause'][_0xd9bf('0x1f')];}}ami['Action']({'action':'QueuePause','interface':_0xb8f907,'paused':!![],'reason':_0x529be1})[_0xd9bf('0x20')](function(_0x46a07d){if(_0x2560d8[_0xd9bf('0x5')][_0xb8f907]){return RpcUser[_0xd9bf('0x21')](_0x2560d8[_0xd9bf('0x5')][_0xb8f907]['id'])[_0xd9bf('0x20')](function(_0x8ab322){if(_0x8ab322&&!_0x8ab322['voicePause']){logger[_0xd9bf('0x22')](_0xd9bf('0x23'),_0x5192d0,_0xb8f907,_0x4234f2);var _0x1cf73f=_0x2560d8['channels'][_0x5192d0]['attended']&&_0x2560d8[_0xd9bf('0x7')][_0x5192d0][_0xd9bf('0x24')]?_0x2560d8['channels'][_0x5192d0][_0xd9bf('0x24')]:_0x5192d0;return RpcUser[_0xd9bf('0x25')](_0x2560d8[_0xd9bf('0x5')][_0xb8f907],_0x529be1,_0x1cf73f)['then'](function(_0x51e215){if(!_0x758c39){_0x2560d8[_0xd9bf('0x6')][_0xb8f907]={};logger['info'](_0xd9bf('0x26'),_0x5192d0,_0x2560d8[_0xd9bf('0x1b')][_0x4234f2][_0xd9bf('0x27')],_0xb8f907,_0x4234f2);_0x2560d8[_0xd9bf('0x6')][_0xb8f907]['timer']=setTimeout(_0x2560d8[_0xd9bf('0x28')]['bind'](_0x2560d8,_0xb8f907),_0x2560d8[_0xd9bf('0x1b')][_0x4234f2][_0xd9bf('0x27')]*0x3e8);_0x2560d8[_0xd9bf('0x6')][_0xb8f907][_0xd9bf('0x29')]=moment()['format'](_0xd9bf('0x2a'));_0x2560d8[_0xd9bf('0x6')][_0xb8f907][_0xd9bf('0x2b')]=_0x5192d0;_0x2560d8[_0xd9bf('0x6')][_0xb8f907][_0xd9bf('0x1a')]=_0x4234f2;_0x2560d8[_0xd9bf('0x6')][_0xb8f907][_0xd9bf('0x2c')]=function(){var _0x41f2d3=getDiff(_0x2560d8[_0xd9bf('0x6')][_0xb8f907][_0xd9bf('0x29')]);clearTimeout(_0x2560d8[_0xd9bf('0x6')][_0xb8f907][_0xd9bf('0x2d')]);_0x2560d8[_0xd9bf('0x6')][_0xb8f907][_0xd9bf('0x2d')]=![];RpcVoiceAgentReport[_0xd9bf('0x2e')]({'acwtime':_0x41f2d3},_0x2560d8['timers'][_0xb8f907][_0xd9bf('0x2b')],_0xb8f907)['then'](function(_0x171e24){logger[_0xd9bf('0x22')](_0xd9bf('0x2f'),_0x5192d0,_0x41f2d3,_0x171e24);})[_0xd9bf('0x30')](function(_0x3dff03){logger['error'](_0xd9bf('0x31'),_0x5192d0,_0x3dff03);});delete _0x2560d8[_0xd9bf('0x6')][_0xb8f907];};}});}else{logger[_0xd9bf('0x22')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x5192d0,_0xb8f907,_0x4234f2);}});}})[_0xd9bf('0x30')](function(_0x2c975e){logger['error'](_0xd9bf('0x26'),_0x5192d0,_0x2560d8[_0xd9bf('0x1b')][_0x4234f2]['acwTimeout'],_0xb8f907,_0x4234f2);})[_0xd9bf('0x32')](function(){delete _0x2560d8[_0xd9bf('0x7')][_0x5192d0];});}catch(_0x524a98){logger['error'](_0xd9bf('0x33'),_0x524a98[_0xd9bf('0x34')]);}};Acw[_0xd9bf('0x17')][_0xd9bf('0x28')]=function(_0x425602){try{var _0x315b81=this;if(_0x315b81[_0xd9bf('0x6')][_0x425602]){_0x315b81[_0xd9bf('0x6')][_0x425602][_0xd9bf('0x2d')]=![];var _0x10106b=_0x315b81[_0xd9bf('0x6')][_0x425602]['uniqueid'];var _0x52e16c=_0x315b81[_0xd9bf('0x6')][_0x425602][_0xd9bf('0x1a')];var _0xd8d9c5=_0x315b81[_0xd9bf('0x1b')][_0x52e16c][_0xd9bf('0x27')];logger['info'](_0xd9bf('0x35'),_0x10106b,_0x425602);RpcUser[_0xd9bf('0x36')](this['agents'][_0x425602]);RpcVoiceAgentReport[_0xd9bf('0x2e')]({'acwtime':_0xd8d9c5,'agentacw':!![]},_0x10106b,_0x425602)[_0xd9bf('0x20')](function(_0x5b203b){logger['info'](_0xd9bf('0x2f'),_0x10106b,_0xd8d9c5,_0x5b203b);})[_0xd9bf('0x30')](function(_0x293e3b){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x10106b,_0x293e3b);});}else{logger[_0xd9bf('0x37')](_0xd9bf('0x38'),_0x425602);if(_0x315b81[_0xd9bf('0x6')]){logger[_0xd9bf('0x22')](_0xd9bf('0x39'),JSON[_0xd9bf('0x3a')](_0x315b81[_0xd9bf('0x6')]));}}}catch(_0x27482b){logger[_0xd9bf('0x37')](_0xd9bf('0x3b'),_0x27482b['message']);}};Acw['prototype'][_0xd9bf('0x9')]=function(_0x364708){try{if(this['voiceQueues'][_0x364708[_0xd9bf('0x1a')]]&&(this[_0xd9bf('0x1b')][_0x364708[_0xd9bf('0x1a')]][_0xd9bf('0x3c')]||this[_0xd9bf('0x1b')][_0x364708[_0xd9bf('0x1a')]][_0xd9bf('0x1d')])){if(this['agents'][_0x364708[_0xd9bf('0x19')]]){this['channels'][_0x364708[_0xd9bf('0x2b')]]={'queue':_0x364708[_0xd9bf('0x1a')],'interface':_0x364708['interface'],'destlinkedid':_0x364708['destlinkedid']};}}}catch(_0x24906e){logger[_0xd9bf('0x37')]('[ACW][syncAgentConnect]\x20%s',_0x24906e['message']);}};Acw[_0xd9bf('0x17')]['syncAgentConnectPreview']=function(_0x5d3fbb){try{if(this['voiceQueues'][_0x5d3fbb[_0xd9bf('0x1a')]]&&(this[_0xd9bf('0x1b')][_0x5d3fbb[_0xd9bf('0x1a')]]['acw']||this[_0xd9bf('0x1b')][_0x5d3fbb['queue']][_0xd9bf('0x1d')])){if(this[_0xd9bf('0x5')][_0x5d3fbb[_0xd9bf('0x19')]]){this['channels'][_0x5d3fbb[_0xd9bf('0x2b')]]={'queue':_0x5d3fbb[_0xd9bf('0x1a')],'interface':_0x5d3fbb['interface']};}}}catch(_0x295681){logger[_0xd9bf('0x37')](_0xd9bf('0x3d'),_0x295681[_0xd9bf('0x34')]);}};Acw['prototype'][_0xd9bf('0x3e')]=function(_0x480fe1){try{if(this[_0xd9bf('0x7')][_0x480fe1[_0xd9bf('0x2b')]]&&_['isUndefined'](this[_0xd9bf('0x7')][_0x480fe1['uniqueid']][_0xd9bf('0x3f')])){logger[_0xd9bf('0x22')](_0xd9bf('0x40'),_0x480fe1[_0xd9bf('0x2b')]);this[_0xd9bf('0x18')](_0x480fe1[_0xd9bf('0x2b')]);}else if(this[_0xd9bf('0x7')][_0x480fe1['linkedid']]&&_[_0xd9bf('0x41')](this[_0xd9bf('0x7')][_0x480fe1['linkedid']]['attended'])){logger[_0xd9bf('0x22')]('[%s][HANGUP:LINKEDID]',_0x480fe1[_0xd9bf('0x42')]);this[_0xd9bf('0x18')](_0x480fe1['linkedid']);}}catch(_0x3bdbae){logger[_0xd9bf('0x37')](_0xd9bf('0x43'),_0x3bdbae['message']);}};Acw['prototype'][_0xd9bf('0xd')]=function(_0x16e2c1){try{if(this[_0xd9bf('0x7')][_0x16e2c1['uniqueid']]&&this[_0xd9bf('0x7')][_0x16e2c1[_0xd9bf('0x2b')]][_0xd9bf('0x3f')]){logger[_0xd9bf('0x22')](_0xd9bf('0x44'),_0x16e2c1[_0xd9bf('0x2b')]);this[_0xd9bf('0x18')](_0x16e2c1['uniqueid']);}else if(this[_0xd9bf('0x7')][_0x16e2c1[_0xd9bf('0x42')]]&&this[_0xd9bf('0x7')][_0x16e2c1[_0xd9bf('0x42')]][_0xd9bf('0x3f')]){logger[_0xd9bf('0x22')](_0xd9bf('0x45'),_0x16e2c1[_0xd9bf('0x42')]);this[_0xd9bf('0x18')](_0x16e2c1[_0xd9bf('0x42')]);}}catch(_0x222eb9){logger['error'](_0xd9bf('0x46'),_0x222eb9['message']);}};Acw[_0xd9bf('0x17')][_0xd9bf('0x11')]=function(_0xcf475e){try{if(!_['isNil'](this['channels'][_0xcf475e[_0xd9bf('0x47')]])){this[_0xd9bf('0x18')](_0xcf475e[_0xd9bf('0x47')]);if(this[_0xd9bf('0x7')][_0xcf475e['secondtransfereruniqueid']]){this[_0xd9bf('0x7')][_0xcf475e[_0xd9bf('0x48')]][_0xd9bf('0x3f')]=!![];this[_0xd9bf('0x7')][_0xcf475e[_0xd9bf('0x49')]]=this[_0xd9bf('0x7')][_0xcf475e[_0xd9bf('0x48')]];delete this[_0xd9bf('0x7')][_0xcf475e['secondtransfereruniqueid']];}}else if(!_[_0xd9bf('0x4a')](this[_0xd9bf('0x7')][_0xcf475e[_0xd9bf('0x49')]])){this[_0xd9bf('0x18')](_0xcf475e[_0xd9bf('0x49')]);if(this['channels'][_0xcf475e[_0xd9bf('0x4b')]]){this[_0xd9bf('0x7')][_0xcf475e[_0xd9bf('0x4b')]]['attended']=!![];this[_0xd9bf('0x7')][_0xcf475e['transfereeuniqueid']]=this[_0xd9bf('0x7')][_0xcf475e['origtransfereruniqueid']];delete this['channels'][_0xcf475e[_0xd9bf('0x4b')]];}}}catch(_0x9c3192){logger[_0xd9bf('0x37')](_0xd9bf('0x4c'),_0x9c3192['message']);}};Acw['prototype']['syncBlindTransfer']=function(_0x2d906c){try{if(this['channels'][_0x2d906c[_0xd9bf('0x4d')]]){logger['info'](_0xd9bf('0x4e'),JSON[_0xd9bf('0x3a')](_0x2d906c['transfereruniqueid']));this[_0xd9bf('0x18')](_0x2d906c[_0xd9bf('0x4d')]);}else if(this[_0xd9bf('0x7')][_0x2d906c[_0xd9bf('0x4f')]]){logger['info']('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xd9bf('0x3a')](_0x2d906c[_0xd9bf('0x4f')]));this['startAcw'](_0x2d906c[_0xd9bf('0x4f')]);}}catch(_0x35b21d){logger['error'](_0xd9bf('0x50'),_0x35b21d['message']);}};Acw[_0xd9bf('0x17')][_0xd9bf('0xf')]=function(_0x27a451){try{if(this[_0xd9bf('0x1b')][_0x27a451[_0xd9bf('0x1a')]]&&this[_0xd9bf('0x1b')][_0x27a451[_0xd9bf('0x1a')]][_0xd9bf('0x51')]===_0xd9bf('0x52')){if(this[_0xd9bf('0x5')][_0x27a451['interface']]){logger['info'](_0xd9bf('0x53'),_0x27a451[_0xd9bf('0x2b')],_0x27a451[_0xd9bf('0x19')],_0x27a451['queue']);return RpcUser[_0xd9bf('0x25')](this[_0xd9bf('0x5')][_0x27a451[_0xd9bf('0x19')]],_0xd9bf('0x54'),_0x27a451[_0xd9bf('0x2b')]);}}}catch(_0x40e50e){logger[_0xd9bf('0x37')](_0xd9bf('0x55'),_0x40e50e[_0xd9bf('0x34')]);}};module[_0xd9bf('0x56')]=Acw; \ No newline at end of file +var _0xc298=['mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','agents','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','then','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','stopAcw','acwTimeout','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','timer','update','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][TIMERS]','[ACW][STOP]\x20%s','message','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','stringify','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','moment','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','timers','channels','agentconnect','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue'];(function(_0xb74e5a,_0xd8b7fd){var _0x11b782=function(_0x266a98){while(--_0x266a98){_0xb74e5a['push'](_0xb74e5a['shift']());}};_0x11b782(++_0xd8b7fd);}(_0xc298,0x1ec));var _0x8c29=function(_0x4c8026,_0x41bff9){_0x4c8026=_0x4c8026-0x0;var _0x202724=_0xc298[_0x4c8026];return _0x202724;};'use strict';var util=require(_0x8c29('0x0'));var _=require(_0x8c29('0x1'));var moment=require(_0x8c29('0x2'));var ami=require('../ami');var logger=require(_0x8c29('0x3'))(_0x8c29('0x4'));var RpcUser=require(_0x8c29('0x5'));var RpcVoiceAgentReport=require(_0x8c29('0x6'));function Acw(_0x3144f7){this[_0x8c29('0x7')]=_0x3144f7[_0x8c29('0x7')];this['agents']=_0x3144f7['agents'];this[_0x8c29('0x8')]=_0x3144f7[_0x8c29('0x8')];this[_0x8c29('0x9')]={};ami['on'](_0x8c29('0xa'),this[_0x8c29('0xb')][_0x8c29('0xc')](this));ami['on']('hanguprequest',this[_0x8c29('0xd')]['bind'](this));ami['on'](_0x8c29('0xe'),this[_0x8c29('0xf')][_0x8c29('0xc')](this));ami['on'](_0x8c29('0x10'),this[_0x8c29('0x11')][_0x8c29('0xc')](this));ami['on'](_0x8c29('0x12'),this[_0x8c29('0x13')][_0x8c29('0xc')](this));ami['on'](_0x8c29('0x14'),this[_0x8c29('0x15')][_0x8c29('0xc')](this));ami['on'](_0x8c29('0x16'),this['syncAgentConnectPreview'][_0x8c29('0xc')](this));}function getDiff(_0x5a22dc){var _0x33343c=moment()['milliseconds'](0x0);var _0x6b948c=moment(_0x5a22dc)[_0x8c29('0x17')](0x0);return _0x33343c[_0x8c29('0x18')](_0x6b948c,_0x8c29('0x19'));}Acw[_0x8c29('0x1a')][_0x8c29('0x1b')]=function(_0x5b9302){try{var _0x4d1a50=this;var _0x266977=this[_0x8c29('0x9')][_0x5b9302][_0x8c29('0x1c')];var _0x38dec9=this[_0x8c29('0x9')][_0x5b9302][_0x8c29('0x1d')];var _0x4527bf=this[_0x8c29('0x7')][_0x38dec9];var _0x265668=![];var _0x2c17b1='ACW';if(_0x4527bf[_0x8c29('0x1e')]){if(_0x4527bf[_0x8c29('0x1f')]['name']){_0x265668=!![];_0x2c17b1=_0x4527bf['mandatoryDispositionPause'][_0x8c29('0x20')];}}ami[_0x8c29('0x21')]({'action':_0x8c29('0x22'),'interface':_0x266977,'paused':!![],'reason':_0x2c17b1})['then'](function(_0x871859){if(_0x4d1a50[_0x8c29('0x23')][_0x266977]){return RpcUser['getAgent'](_0x4d1a50[_0x8c29('0x23')][_0x266977]['id'])['then'](function(_0xae738f){if(_0xae738f&&!_0xae738f[_0x8c29('0x24')]){logger['info'](_0x8c29('0x25'),_0x5b9302,_0x266977,_0x38dec9);var _0x3d8373=_0x4d1a50[_0x8c29('0x9')][_0x5b9302][_0x8c29('0x26')]&&_0x4d1a50[_0x8c29('0x9')][_0x5b9302][_0x8c29('0x27')]?_0x4d1a50[_0x8c29('0x9')][_0x5b9302][_0x8c29('0x27')]:_0x5b9302;return RpcUser[_0x8c29('0x28')](_0x4d1a50['agents'][_0x266977],_0x2c17b1,_0x3d8373)[_0x8c29('0x29')](function(_0x9ea86e){if(!_0x265668){_0x4d1a50[_0x8c29('0x8')][_0x266977]={};logger[_0x8c29('0x2a')](_0x8c29('0x2b'),_0x5b9302,_0x4d1a50['voiceQueues'][_0x38dec9]['acwTimeout'],_0x266977,_0x38dec9);_0x4d1a50['timers'][_0x266977]['timer']=setTimeout(_0x4d1a50[_0x8c29('0x2c')]['bind'](_0x4d1a50,_0x266977),_0x4d1a50[_0x8c29('0x7')][_0x38dec9][_0x8c29('0x2d')]*0x3e8);_0x4d1a50[_0x8c29('0x8')][_0x266977]['lastPauseAt']=moment()[_0x8c29('0x2e')](_0x8c29('0x2f'));_0x4d1a50[_0x8c29('0x8')][_0x266977][_0x8c29('0x30')]=_0x5b9302;_0x4d1a50[_0x8c29('0x8')][_0x266977][_0x8c29('0x1d')]=_0x38dec9;_0x4d1a50[_0x8c29('0x8')][_0x266977][_0x8c29('0x31')]=function(){var _0xffc177=getDiff(_0x4d1a50['timers'][_0x266977]['lastPauseAt']);clearTimeout(_0x4d1a50[_0x8c29('0x8')][_0x266977][_0x8c29('0x32')]);_0x4d1a50[_0x8c29('0x8')][_0x266977]['timer']=![];RpcVoiceAgentReport[_0x8c29('0x33')]({'acwtime':_0xffc177},_0x4d1a50[_0x8c29('0x8')][_0x266977][_0x8c29('0x30')],_0x266977)[_0x8c29('0x29')](function(_0x2b1665){logger[_0x8c29('0x2a')]('[%s][UPDATE][ACWTIME:%s]',_0x5b9302,_0xffc177,_0x2b1665);})[_0x8c29('0x34')](function(_0x2ceaa7){logger[_0x8c29('0x35')](_0x8c29('0x36'),_0x5b9302,_0x2ceaa7);});delete _0x4d1a50[_0x8c29('0x8')][_0x266977];};}});}else{logger[_0x8c29('0x2a')](_0x8c29('0x37'),_0x5b9302,_0x266977,_0x38dec9);}});}})[_0x8c29('0x34')](function(_0x34e9ed){logger[_0x8c29('0x35')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x5b9302,_0x4d1a50[_0x8c29('0x7')][_0x38dec9][_0x8c29('0x2d')],_0x266977,_0x38dec9);})['finally'](function(){delete _0x4d1a50['channels'][_0x5b9302];});}catch(_0x14a17d){logger['error'](_0x8c29('0x38'),_0x14a17d['message']);}};Acw['prototype'][_0x8c29('0x2c')]=function(_0x2afae4){try{var _0x112c99=this;if(_0x112c99[_0x8c29('0x8')][_0x2afae4]){_0x112c99[_0x8c29('0x8')][_0x2afae4][_0x8c29('0x32')]=![];var _0x18166c=_0x112c99[_0x8c29('0x8')][_0x2afae4]['uniqueid'];var _0xef163f=_0x112c99[_0x8c29('0x8')][_0x2afae4]['queue'];var _0x520c43=_0x112c99[_0x8c29('0x7')][_0xef163f][_0x8c29('0x2d')];logger[_0x8c29('0x2a')](_0x8c29('0x39'),_0x18166c,_0x2afae4);RpcUser[_0x8c29('0x3a')](this[_0x8c29('0x23')][_0x2afae4]);RpcVoiceAgentReport[_0x8c29('0x33')]({'acwtime':_0x520c43,'agentacw':!![]},_0x18166c,_0x2afae4)[_0x8c29('0x29')](function(_0x53ca85){logger[_0x8c29('0x2a')](_0x8c29('0x3b'),_0x18166c,_0x520c43,_0x53ca85);})['catch'](function(_0xc304e6){logger[_0x8c29('0x35')]('[%s][UPDATE][ERRORS:%s]',_0x18166c,_0xc304e6);});}else{logger[_0x8c29('0x35')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x2afae4);if(_0x112c99[_0x8c29('0x8')]){logger['info'](_0x8c29('0x3c'),JSON['stringify'](_0x112c99[_0x8c29('0x8')]));}}}catch(_0x440359){logger[_0x8c29('0x35')](_0x8c29('0x3d'),_0x440359[_0x8c29('0x3e')]);}};Acw['prototype']['syncAgentConnect']=function(_0x27d938){try{if(this['voiceQueues'][_0x27d938[_0x8c29('0x1d')]]&&(this[_0x8c29('0x7')][_0x27d938[_0x8c29('0x1d')]]['acw']||this['voiceQueues'][_0x27d938[_0x8c29('0x1d')]]['mandatoryDisposition'])){if(this[_0x8c29('0x23')][_0x27d938['interface']]){this[_0x8c29('0x9')][_0x27d938['uniqueid']]={'queue':_0x27d938[_0x8c29('0x1d')],'interface':_0x27d938[_0x8c29('0x1c')],'destlinkedid':_0x27d938[_0x8c29('0x27')]};}}}catch(_0x5ac7b2){logger[_0x8c29('0x35')](_0x8c29('0x3f'),_0x5ac7b2[_0x8c29('0x3e')]);}};Acw[_0x8c29('0x1a')][_0x8c29('0x40')]=function(_0x28205a){try{if(this[_0x8c29('0x7')][_0x28205a[_0x8c29('0x1d')]]&&(this[_0x8c29('0x7')][_0x28205a[_0x8c29('0x1d')]]['acw']||this['voiceQueues'][_0x28205a[_0x8c29('0x1d')]][_0x8c29('0x1e')])){if(this[_0x8c29('0x23')][_0x28205a[_0x8c29('0x1c')]]){this[_0x8c29('0x9')][_0x28205a[_0x8c29('0x30')]]={'queue':_0x28205a['queue'],'interface':_0x28205a[_0x8c29('0x1c')]};}}}catch(_0x15859d){logger[_0x8c29('0x35')](_0x8c29('0x41'),_0x15859d[_0x8c29('0x3e')]);}};Acw['prototype'][_0x8c29('0xd')]=function(_0x3f32ab){try{if(this[_0x8c29('0x9')][_0x3f32ab[_0x8c29('0x30')]]&&_['isUndefined'](this['channels'][_0x3f32ab[_0x8c29('0x30')]]['attended'])){logger[_0x8c29('0x2a')](_0x8c29('0x42'),_0x3f32ab['uniqueid']);this[_0x8c29('0x1b')](_0x3f32ab[_0x8c29('0x30')]);}else if(this['channels'][_0x3f32ab[_0x8c29('0x43')]]&&_[_0x8c29('0x44')](this[_0x8c29('0x9')][_0x3f32ab[_0x8c29('0x43')]]['attended'])){logger[_0x8c29('0x2a')](_0x8c29('0x45'),_0x3f32ab[_0x8c29('0x43')]);this[_0x8c29('0x1b')](_0x3f32ab[_0x8c29('0x43')]);}}catch(_0x2708c7){logger[_0x8c29('0x35')](_0x8c29('0x46'),_0x2708c7[_0x8c29('0x3e')]);}};Acw['prototype']['syncHangup']=function(_0x5a6818){try{if(this['channels'][_0x5a6818[_0x8c29('0x30')]]&&this[_0x8c29('0x9')][_0x5a6818[_0x8c29('0x30')]][_0x8c29('0x26')]){logger[_0x8c29('0x2a')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x5a6818['uniqueid']);this[_0x8c29('0x1b')](_0x5a6818['uniqueid']);}else if(this[_0x8c29('0x9')][_0x5a6818['linkedid']]&&this[_0x8c29('0x9')][_0x5a6818['linkedid']][_0x8c29('0x26')]){logger[_0x8c29('0x2a')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x5a6818[_0x8c29('0x43')]);this[_0x8c29('0x1b')](_0x5a6818[_0x8c29('0x43')]);}}catch(_0x5021bb){logger[_0x8c29('0x35')]('[ACW][syncHangup]\x20%s',_0x5021bb['message']);}};Acw[_0x8c29('0x1a')]['syncAttendedTransfer']=function(_0x19c689){try{if(!_[_0x8c29('0x47')](this['channels'][_0x19c689[_0x8c29('0x48')]])){this[_0x8c29('0x1b')](_0x19c689[_0x8c29('0x48')]);if(this[_0x8c29('0x9')][_0x19c689[_0x8c29('0x49')]]){this['channels'][_0x19c689[_0x8c29('0x49')]][_0x8c29('0x26')]=!![];this[_0x8c29('0x9')][_0x19c689[_0x8c29('0x4a')]]=this['channels'][_0x19c689[_0x8c29('0x49')]];delete this[_0x8c29('0x9')][_0x19c689[_0x8c29('0x49')]];}}else if(!_[_0x8c29('0x47')](this[_0x8c29('0x9')][_0x19c689['transfertargetuniqueid']])){this[_0x8c29('0x1b')](_0x19c689['transfertargetuniqueid']);if(this[_0x8c29('0x9')][_0x19c689[_0x8c29('0x4b')]]){this[_0x8c29('0x9')][_0x19c689[_0x8c29('0x4b')]][_0x8c29('0x26')]=!![];this[_0x8c29('0x9')][_0x19c689[_0x8c29('0x48')]]=this['channels'][_0x19c689[_0x8c29('0x4b')]];delete this[_0x8c29('0x9')][_0x19c689[_0x8c29('0x4b')]];}}}catch(_0x427097){logger['error'](_0x8c29('0x4c'),_0x427097['message']);}};Acw[_0x8c29('0x1a')][_0x8c29('0x15')]=function(_0x18fc32){try{if(this['channels'][_0x18fc32[_0x8c29('0x4d')]]){logger[_0x8c29('0x2a')](_0x8c29('0x4e'),JSON['stringify'](_0x18fc32[_0x8c29('0x4d')]));this[_0x8c29('0x1b')](_0x18fc32[_0x8c29('0x4d')]);}else if(this[_0x8c29('0x9')][_0x18fc32[_0x8c29('0x4f')]]){logger[_0x8c29('0x2a')](_0x8c29('0x50'),JSON[_0x8c29('0x51')](_0x18fc32['transfererlinkedid']));this[_0x8c29('0x1b')](_0x18fc32['transfererlinkedid']);}}catch(_0x550e62){logger[_0x8c29('0x35')](_0x8c29('0x52'),_0x550e62[_0x8c29('0x3e')]);}};Acw[_0x8c29('0x1a')][_0x8c29('0x11')]=function(_0x5c0833){try{if(this['voiceQueues'][_0x5c0833[_0x8c29('0x1d')]]&&this[_0x8c29('0x7')][_0x5c0833[_0x8c29('0x1d')]][_0x8c29('0x53')]===_0x8c29('0x54')){if(this['agents'][_0x5c0833[_0x8c29('0x1c')]]){logger['info'](_0x8c29('0x55'),_0x5c0833[_0x8c29('0x30')],_0x5c0833[_0x8c29('0x1c')],_0x5c0833[_0x8c29('0x1d')]);return RpcUser['savePause'](this[_0x8c29('0x23')][_0x5c0833[_0x8c29('0x1c')]],'Auto-Pause',_0x5c0833[_0x8c29('0x30')]);}}}catch(_0x48dbe2){logger['error'](_0x8c29('0x56'),_0x48dbe2['message']);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index ca4e6b6..1756921 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 _0xbaf0=['once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionSipShowRegistry','catch','[ami.js][fullybooted]','exports','bluebird','moment','util','lodash','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s'];(function(_0x2258b9,_0x336201){var _0x29806f=function(_0x3b304a){while(--_0x3b304a){_0x2258b9['push'](_0x2258b9['shift']());}};_0x29806f(++_0x336201);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var _=require(_0x0baf('0x3'));var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var config=require('../../config/environment');var ami=new Manager(config[_0x0baf('0x6')][_0x0baf('0x7')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')][_0x0baf('0x9')],!![]);ami[_0x0baf('0xa')]();ami[_0x0baf('0xb')]=BPromise['promisify'](ami[_0x0baf('0xc')]);function error(_0x5f20aa){logger[_0x0baf('0xd')](util[_0x0baf('0xe')](_0x0baf('0xf'),config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')],util[_0x0baf('0x10')](_0x5f20aa,![],null)));}function close(){logger[_0x0baf('0xd')](util[_0x0baf('0xe')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk'][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x0baf('0xb')]({'action':'sipshowregistry'});};};ami[_0x0baf('0x11')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x12')});};};ami[_0x0baf('0x13')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x14')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x0baf('0x15')});};};ami[_0x0baf('0x16')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x17')});};};function connect(_0x2cf7da){logger[_0x0baf('0x18')](util['format'](_0x0baf('0x19'),config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));ami['once']('error',error);ami[_0x0baf('0x1a')](_0x0baf('0x1b'),close);}ami['on'](_0x0baf('0x1c'),connect);ami['on'](_0x0baf('0x1d'),function(_0x1fa92b){logger[_0x0baf('0x18')](util[_0x0baf('0xe')](_0x0baf('0x1e'),config[_0x0baf('0x6')][_0x0baf('0x8')],config['asterisk']['ip'],config[_0x0baf('0x6')]['port'],util[_0x0baf('0x10')](_0x1fa92b,![],null)));});ami['on']('fullybooted',function(_0x4de74c){logger[_0x0baf('0x18')](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));return BPromise['resolve']()[_0x0baf('0x1f')](ami[_0x0baf('0x20')]())[_0x0baf('0x1f')](ami[_0x0baf('0x11')]())[_0x0baf('0x1f')](ami[_0x0baf('0x13')]())[_0x0baf('0x1f')](ami['actionQueueSummary']())[_0x0baf('0x1f')](ami[_0x0baf('0x16')]())[_0x0baf('0x21')](function(_0x265915){logger['error'](_0x0baf('0x22'),util[_0x0baf('0x10')](_0x265915,{'showHidden':![],'depth':null}));});});ami['once'](_0x0baf('0xd'),error);ami[_0x0baf('0x1a')](_0x0baf('0x1b'),close);module[_0x0baf('0x23')]=ami; \ No newline at end of file +var _0x0713=['Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','catch','[ami.js][fullybooted]','exports','moment','util','lodash','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','promisify','action','error'];(function(_0x4a79c5,_0xc5943c){var _0x53255e=function(_0x34108c){while(--_0x34108c){_0x4a79c5['push'](_0x4a79c5['shift']());}};_0x53255e(++_0xc5943c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var moment=require(_0x3071('0x0'));var util=require(_0x3071('0x1'));var _=require(_0x3071('0x2'));var logger=require(_0x3071('0x3'))(_0x3071('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x3071('0x5')][_0x3071('0x6')],config[_0x3071('0x5')]['ip'],config[_0x3071('0x5')][_0x3071('0x7')],config[_0x3071('0x5')][_0x3071('0x8')],!![]);ami[_0x3071('0x9')]();ami[_0x3071('0xa')]=BPromise[_0x3071('0xb')](ami[_0x3071('0xc')]);function error(_0x2fce7a){logger[_0x3071('0xd')](util['format'](_0x3071('0xe'),config[_0x3071('0x5')][_0x3071('0x7')],config[_0x3071('0x5')]['ip'],config[_0x3071('0x5')]['port'],util[_0x3071('0xf')](_0x2fce7a,![],null)));}function close(){logger[_0x3071('0xd')](util[_0x3071('0x10')](_0x3071('0x11'),config[_0x3071('0x5')]['username'],config['asterisk']['ip'],config[_0x3071('0x5')]['port']));}ami[_0x3071('0x12')]=function(){return function(){return ami[_0x3071('0xa')]({'action':'sipshowregistry'});};};ami[_0x3071('0x13')]=function(){return function(){return ami['Action']({'action':_0x3071('0x14')});};};ami[_0x3071('0x15')]=function(){return function(){return ami[_0x3071('0xa')]({'action':_0x3071('0x16')});};};ami[_0x3071('0x17')]=function(){return function(){return ami[_0x3071('0xa')]({'action':_0x3071('0x18')});};};ami[_0x3071('0x19')]=function(){return function(){return ami[_0x3071('0xa')]({'action':_0x3071('0x1a')});};};function connect(_0x5f3c22){logger[_0x3071('0x1b')](util[_0x3071('0x10')](_0x3071('0x1c'),config[_0x3071('0x5')][_0x3071('0x7')],config[_0x3071('0x5')]['ip'],config[_0x3071('0x5')][_0x3071('0x6')]));ami['once'](_0x3071('0xd'),error);ami[_0x3071('0x1d')](_0x3071('0x1e'),close);}ami['on']('connect',connect);ami['on'](_0x3071('0x1f'),function(_0x5cd80d){logger[_0x3071('0x1b')](util[_0x3071('0x10')](_0x3071('0x20'),config[_0x3071('0x5')][_0x3071('0x7')],config[_0x3071('0x5')]['ip'],config[_0x3071('0x5')][_0x3071('0x6')],util['inspect'](_0x5cd80d,![],null)));});ami['on']('fullybooted',function(_0x2ce48a){logger[_0x3071('0x1b')](util[_0x3071('0x10')](_0x3071('0x21'),config[_0x3071('0x5')][_0x3071('0x7')],config[_0x3071('0x5')]['ip'],config[_0x3071('0x5')][_0x3071('0x6')]));return BPromise['resolve']()[_0x3071('0x22')](ami[_0x3071('0x12')]())[_0x3071('0x22')](ami['actionDeviceStateList']())[_0x3071('0x22')](ami[_0x3071('0x15')]())[_0x3071('0x22')](ami[_0x3071('0x17')]())[_0x3071('0x22')](ami[_0x3071('0x19')]())[_0x3071('0x23')](function(_0x3921a1){logger[_0x3071('0xd')](_0x3071('0x24'),util[_0x3071('0xf')](_0x3921a1,{'showHidden':![],'depth':null}));});});ami['once']('error',error);ami[_0x3071('0x1d')](_0x3071('0x1e'),close);module[_0x3071('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index d4df46c..627dad6 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 _0x70e0=['catch','exports','jayson/promise','bluebird','../../config/logger','http','Request','then','memberReport','error','rpc','message','result'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x70e0,0x17b));var _0x070e=function(_0x532bc6,_0x130bb6){_0x532bc6=_0x532bc6-0x0;var _0x5c2cdf=_0x70e0[_0x532bc6];return _0x5c2cdf;};'use strict';var jayson=require(_0x070e('0x0'));var BPromise=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('ami');var client=jayson['client'][_0x070e('0x3')]({'port':0x2329});client[_0x070e('0x4')]=function(_0x277d32,_0x2593e5){return new BPromise(function(_0x5c90fc,_0x7bce9b){return client['request'](_0x277d32,_0x2593e5)[_0x070e('0x5')](function(_0x4b041d){logger['debug']('rpc',_0x070e('0x6'),_0x277d32,_0x2593e5,_0x4b041d);if(_0x4b041d[_0x070e('0x7')]){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x4b041d[_0x070e('0x7')][_0x070e('0x9')],_0x2593e5);return _0x7bce9b(_0x4b041d['error']['message']);}else{return _0x5c90fc(_0x4b041d[_0x070e('0xa')]);}})[_0x070e('0xb')](function(_0x12bb37){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x12bb37,_0x2593e5);return _0x7bce9b(_0x12bb37);});});};module[_0x070e('0xc')]=client; \ No newline at end of file +var _0xbdb7=['result','catch','jayson/promise','bluebird','../../config/logger','ami','client','http','Request','debug','error','message'];(function(_0x1bebc8,_0x521671){var _0x27c5b8=function(_0x117b15){while(--_0x117b15){_0x1bebc8['push'](_0x1bebc8['shift']());}};_0x27c5b8(++_0x521671);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x336f5d,_0x7770c2){_0x336f5d=_0x336f5d-0x0;var _0x1d8289=_0xbdb7[_0x336f5d];return _0x1d8289;};'use strict';var jayson=require(_0x7bdb('0x0'));var BPromise=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var client=jayson[_0x7bdb('0x4')][_0x7bdb('0x5')]({'port':0x2329});client[_0x7bdb('0x6')]=function(_0x2c7e07,_0x46c068){return new BPromise(function(_0x47aec5,_0x28542c){return client['request'](_0x2c7e07,_0x46c068)['then'](function(_0xffdc86){logger[_0x7bdb('0x7')]('rpc','memberReport',_0x2c7e07,_0x46c068,_0xffdc86);if(_0xffdc86[_0x7bdb('0x8')]){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')],_0x46c068);return _0x28542c(_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')]);}else{return _0x47aec5(_0xffdc86[_0x7bdb('0xa')]);}})[_0x7bdb('0xb')](function(_0x297724){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0x297724,_0x46c068);return _0x28542c(_0x297724);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 82957fe..1001dfe 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaad5=['phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','format','\x22%s\x22\x20<%s>','substring','dialCutDigit','prototype','getQueue','lodash','isNil','string','voiceQueue','name','Contact'];(function(_0x445503,_0x129f75){var _0x3e24e9=function(_0x2a5c4b){while(--_0x2a5c4b){_0x445503['push'](_0x445503['shift']());}};_0x3e24e9(++_0x129f75);}(_0xaad5,0xd1));var _0x5aad=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xaad5[_0x1e4360];return _0x31e6b4;};'use strict';var util=require('util');var _=require(_0x5aad('0x0'));var moment=require('moment');function checkNameSurname(_0x59076b,_0x2610a4,_0x147816){var _0x34f6ce='';if(!_[_0x5aad('0x1')](_0x2610a4)&&_0x5aad('0x2')===typeof _0x2610a4){_0x34f6ce+=_0x2610a4;}if(!_['isNil'](_0x147816)&&'string'===typeof _0x147816){_0x34f6ce+='\x20'+_0x147816;}if(_0x34f6ce!==''){return _0x34f6ce;}return _0x59076b;}function Action(_0x306f72,_0x1a425d,_0x1bc7b){this[_0x5aad('0x3')]=_0x306f72;this['uniqueid']=_0x1bc7b||undefined;this[_0x5aad('0x4')]=checkNameSurname(_0x1a425d[_0x5aad('0x5')][_0x5aad('0x6')],_0x1a425d['Contact'][_0x5aad('0x7')],_0x1a425d[_0x5aad('0x5')][_0x5aad('0x8')]);this[_0x5aad('0x9')]=_0x1a425d[_0x5aad('0x5')][_0x5aad('0x6')];this[_0x5aad('0xa')]=_0x306f72[_0x5aad('0x4')];this[_0x5aad('0xb')]=_0x1a425d['active']||![];this[_0x5aad('0xc')]=_0x306f72[_0x5aad('0xc')];this[_0x5aad('0xd')]=_0x306f72[_0x5aad('0xd')]||0x3;this['scheduledat']=_0x1a425d[_0x5aad('0xe')];this[_0x5aad('0xf')]=_0x1a425d[_0x5aad('0xf')];this[_0x5aad('0x10')]=_0x1a425d[_0x5aad('0x10')];this[_0x5aad('0x11')]=_0x1a425d[_0x5aad('0x11')];this[_0x5aad('0x12')]=_0x1a425d[_0x5aad('0x12')];this[_0x5aad('0x13')]=_0x1a425d['countdropretry'];this[_0x5aad('0x14')]=_0x1a425d[_0x5aad('0x14')];this[_0x5aad('0x15')]=_0x1a425d[_0x5aad('0x15')];this['countagentrejectretry']=_0x1a425d[_0x5aad('0x16')];this[_0x5aad('0x17')]=_0x1a425d[_0x5aad('0x17')];this[_0x5aad('0x18')]=_0x1a425d[_0x5aad('0x18')];this[_0x5aad('0x19')]=_0x1a425d[_0x5aad('0x19')];this['VoiceQueueId']=_0x1a425d[_0x5aad('0x1a')];this['CampaignId']=_0x1a425d[_0x5aad('0x1b')];this['idHopper']=_0x1a425d['id'];this[_0x5aad('0x1c')]=_0x1a425d['Contact'][_0x5aad('0x7')]||'';this[_0x5aad('0x1d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x5aad('0x1e')]=_0x1a425d[_0x5aad('0x1e')];this[_0x5aad('0x1f')]=_0x1a425d['callbackuniqueid'];this[_0x5aad('0x20')]=_0x1a425d['callbackat'];this[_0x5aad('0x21')]=_0x1a425d['recallme'];this[_0x5aad('0x22')]='';this[_0x5aad('0x23')]='';}Action['prototype'][_0x5aad('0x24')]=function(){return util[_0x5aad('0x25')](_0x5aad('0x26'),this['name'],this[_0x5aad('0x3')]['dialCutDigit']>0x0?this[_0x5aad('0x9')][_0x5aad('0x27')](this[_0x5aad('0x3')][_0x5aad('0x28')]):this[_0x5aad('0x9')]);};Action[_0x5aad('0x29')][_0x5aad('0x2a')]=function(){return this[_0x5aad('0xa')];};module['exports']=Action; \ No newline at end of file +var _0x3b68=['countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','format','\x22%s\x22\x20<%s>','substring','number','getQueue','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','phone','firstName','Contact','lastName','queue','name','active','type','dialQueueTimeout','scheduledat'];(function(_0x54fbff,_0x53470e){var _0x5cf619=function(_0x28765b){while(--_0x28765b){_0x54fbff['push'](_0x54fbff['shift']());}};_0x5cf619(++_0x53470e);}(_0x3b68,0x123));var _0x83b6=function(_0x3ad351,_0x6cd01f){_0x3ad351=_0x3ad351-0x0;var _0x5369b1=_0x3b68[_0x3ad351];return _0x5369b1;};'use strict';var util=require(_0x83b6('0x0'));var _=require(_0x83b6('0x1'));var moment=require(_0x83b6('0x2'));function checkNameSurname(_0xc71615,_0xe94028,_0x55a7fd){var _0x105a26='';if(!_['isNil'](_0xe94028)&&'string'===typeof _0xe94028){_0x105a26+=_0xe94028;}if(!_[_0x83b6('0x3')](_0x55a7fd)&&_0x83b6('0x4')===typeof _0x55a7fd){_0x105a26+='\x20'+_0x55a7fd;}if(_0x105a26!==''){return _0x105a26;}return _0xc71615;}function Action(_0x5ab445,_0x37d85c,_0xee3bd1){this[_0x83b6('0x5')]=_0x5ab445;this[_0x83b6('0x6')]=_0xee3bd1||undefined;this['name']=checkNameSurname(_0x37d85c['Contact'][_0x83b6('0x7')],_0x37d85c['Contact'][_0x83b6('0x8')],_0x37d85c[_0x83b6('0x9')][_0x83b6('0xa')]);this['number']=_0x37d85c[_0x83b6('0x9')][_0x83b6('0x7')];this[_0x83b6('0xb')]=_0x5ab445[_0x83b6('0xc')];this['active']=_0x37d85c[_0x83b6('0xd')]||![];this['type']=_0x5ab445[_0x83b6('0xe')];this[_0x83b6('0xf')]=_0x5ab445[_0x83b6('0xf')]||0x3;this[_0x83b6('0x10')]=_0x37d85c[_0x83b6('0x10')];this[_0x83b6('0x11')]=_0x37d85c[_0x83b6('0x11')];this[_0x83b6('0x12')]=_0x37d85c[_0x83b6('0x12')];this[_0x83b6('0x13')]=_0x37d85c[_0x83b6('0x13')];this[_0x83b6('0x14')]=_0x37d85c[_0x83b6('0x14')];this[_0x83b6('0x15')]=_0x37d85c[_0x83b6('0x15')];this['countabandonedretry']=_0x37d85c[_0x83b6('0x16')];this[_0x83b6('0x17')]=_0x37d85c[_0x83b6('0x17')];this[_0x83b6('0x18')]=_0x37d85c['countagentrejectretry'];this['ContactId']=_0x37d85c['ContactId'];this[_0x83b6('0x19')]=_0x37d85c[_0x83b6('0x19')];this['UserId']=_0x37d85c[_0x83b6('0x1a')];this['VoiceQueueId']=_0x37d85c[_0x83b6('0x1b')];this['CampaignId']=_0x37d85c[_0x83b6('0x1c')];this['idHopper']=_0x37d85c['id'];this[_0x83b6('0x1d')]=_0x37d85c[_0x83b6('0x9')][_0x83b6('0x8')]||'';this[_0x83b6('0x1e')]=moment()['format'](_0x83b6('0x1f'));this[_0x83b6('0x20')]=_0x37d85c[_0x83b6('0x20')];this[_0x83b6('0x21')]=_0x37d85c[_0x83b6('0x21')];this[_0x83b6('0x22')]=_0x37d85c[_0x83b6('0x22')];this[_0x83b6('0x23')]=_0x37d85c[_0x83b6('0x23')];this['originatecalleridnum']='';this[_0x83b6('0x24')]='';}Action[_0x83b6('0x25')]['getCaller']=function(){return util[_0x83b6('0x26')](_0x83b6('0x27'),this[_0x83b6('0xc')],this[_0x83b6('0x5')]['dialCutDigit']>0x0?this['number'][_0x83b6('0x28')](this[_0x83b6('0x5')]['dialCutDigit']):this[_0x83b6('0x29')]);};Action[_0x83b6('0x25')][_0x83b6('0x2a')]=function(){return this[_0x83b6('0xb')];};module[_0x83b6('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 59e2919..debc1b4 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9dbb=['scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','responsetime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc'];(function(_0x3b87f4,_0x112243){var _0x63d16e=function(_0x3e7323){while(--_0x3e7323){_0x3b87f4['push'](_0x3b87f4['shift']());}};_0x63d16e(++_0x112243);}(_0x9dbb,0x85));var _0xb9db=function(_0x5098d3,_0x245091){_0x5098d3=_0x5098d3-0x0;var _0x285389=_0x9dbb[_0x5098d3];return _0x285389;};'use strict';var util=require(_0xb9db('0x0'));var _=require(_0xb9db('0x1'));var moment=require(_0xb9db('0x2'));function getSeconds(_0x377639,_0x1ac3fd){var _0x4c3c87=moment(_0x377639)['milliseconds'](0x0);var _0x59a8b9=moment(_0x1ac3fd)[_0xb9db('0x3')](0x0);return _0x4c3c87[_0xb9db('0x4')](_0x59a8b9,_0xb9db('0x5'));}function AgentComplete(_0x29c0e5,_0x426858){this[_0xb9db('0x6')]=0x4;this[_0xb9db('0x7')]='Answer';this[_0xb9db('0x8')]=_0x29c0e5[_0xb9db('0x8')];this[_0xb9db('0x9')]=_0x29c0e5[_0xb9db('0x9')];this['campaigntype']=_0x29c0e5[_0xb9db('0x9')]==='outbound'?_0xb9db('0xa'):_0x29c0e5['type'];this[_0xb9db('0xb')]=_0x29c0e5[_0xb9db('0xb')];this[_0xb9db('0xc')]=_0x29c0e5[_0xb9db('0xc')];this[_0xb9db('0xd')]=_0x29c0e5[_0xb9db('0xd')];this[_0xb9db('0xe')]=_0x29c0e5[_0xb9db('0xb')]+_0x29c0e5[_0xb9db('0xc')]+_0x29c0e5['countnoanswerretry']+_0x29c0e5[_0xb9db('0xf')]+_0x29c0e5[_0xb9db('0x10')]+_0x29c0e5[_0xb9db('0x11')]+_0x29c0e5[_0xb9db('0x12')]+_0x29c0e5['countagentrejectretry'];this[_0xb9db('0xf')]=_0x29c0e5[_0xb9db('0xf')];this['countdropretry']=_0x29c0e5[_0xb9db('0x10')];this['countabandonedretry']=_0x29c0e5[_0xb9db('0x11')];this[_0xb9db('0x12')]=_0x29c0e5['countmachineretry'];this[_0xb9db('0x13')]=_0x29c0e5[_0xb9db('0x13')];this[_0xb9db('0x14')]=_0x426858[_0xb9db('0x14')];this[_0xb9db('0x15')]=_0x29c0e5[_0xb9db('0x16')];this[_0xb9db('0x17')]=_0x29c0e5[_0xb9db('0x18')];this[_0xb9db('0x19')]=_0x29c0e5['starttime'];this['responsetime']=_0x29c0e5['responsetime'];this[_0xb9db('0x1a')]=_0x29c0e5[_0xb9db('0x1a')];this[_0xb9db('0x1b')]=moment()['format'](_0xb9db('0x1c'));this[_0xb9db('0x1d')]=getSeconds(_0x29c0e5[_0xb9db('0x1e')],_0x29c0e5[_0xb9db('0x19')]);this[_0xb9db('0x1f')]=getSeconds(_0x29c0e5[_0xb9db('0x1a')],_0x29c0e5[_0xb9db('0x1e')]);this[_0xb9db('0x20')]=getSeconds(this[_0xb9db('0x1b')],_0x29c0e5[_0xb9db('0x1a')]);this[_0xb9db('0xa')]=_0x426858[_0xb9db('0xa')];this['membername']=_0x426858[_0xb9db('0x21')];this[_0xb9db('0x22')]=_0x426858[_0xb9db('0x22')];this[_0xb9db('0x23')]=_0x29c0e5[_0xb9db('0x23')];this[_0xb9db('0x24')]=_0x29c0e5['callbackuniqueid'];this['callbackat']=_0x29c0e5[_0xb9db('0x25')];this[_0xb9db('0x26')]=_0x29c0e5[_0xb9db('0x26')];this['ContactId']=_0x29c0e5[_0xb9db('0x27')];this[_0xb9db('0x28')]=_0x29c0e5[_0xb9db('0x28')];this['UserId']=_0x29c0e5[_0xb9db('0x29')];this[_0xb9db('0x2a')]=_0x29c0e5[_0xb9db('0x2a')];this[_0xb9db('0x2b')]=_0x29c0e5[_0xb9db('0x2b')];this[_0xb9db('0x2c')]=_0x29c0e5['originatecalleridnum']||'';this[_0xb9db('0x2d')]=_0x29c0e5['originatecalleridname']||'';}module[_0xb9db('0x2e')]=AgentComplete; \ No newline at end of file +var _0xd171=['campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','calleridname','calleridnum','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','diff','seconds','state','statedesc','scheduledat','type'];(function(_0x270cad,_0x74d5f){var _0x548880=function(_0x2bb0a1){while(--_0x2bb0a1){_0x270cad['push'](_0x270cad['shift']());}};_0x548880(++_0x74d5f);}(_0xd171,0x79));var _0x1d17=function(_0x284d70,_0x4e5330){_0x284d70=_0x284d70-0x0;var _0x5a40f8=_0xd171[_0x284d70];return _0x5a40f8;};'use strict';var util=require(_0x1d17('0x0'));var _=require('lodash');var moment=require(_0x1d17('0x1'));function getSeconds(_0x40c552,_0x16e60b){var _0x1724b3=moment(_0x40c552)['milliseconds'](0x0);var _0x452b47=moment(_0x16e60b)['milliseconds'](0x0);return _0x1724b3[_0x1d17('0x2')](_0x452b47,_0x1d17('0x3'));}function AgentComplete(_0xcce1a4,_0x2382c2){this[_0x1d17('0x4')]=0x4;this[_0x1d17('0x5')]='Answer';this[_0x1d17('0x6')]=_0xcce1a4[_0x1d17('0x6')];this[_0x1d17('0x7')]=_0xcce1a4['type'];this[_0x1d17('0x8')]=_0xcce1a4[_0x1d17('0x7')]===_0x1d17('0x9')?_0x1d17('0xa'):_0xcce1a4[_0x1d17('0x7')];this[_0x1d17('0xb')]=_0xcce1a4['countbusyretry'];this['countcongestionretry']=_0xcce1a4[_0x1d17('0xc')];this[_0x1d17('0xd')]=_0xcce1a4[_0x1d17('0xd')];this[_0x1d17('0xe')]=_0xcce1a4['countbusyretry']+_0xcce1a4[_0x1d17('0xc')]+_0xcce1a4[_0x1d17('0xd')]+_0xcce1a4[_0x1d17('0xf')]+_0xcce1a4[_0x1d17('0x10')]+_0xcce1a4['countabandonedretry']+_0xcce1a4['countmachineretry']+_0xcce1a4[_0x1d17('0x11')];this['countnosuchnumberretry']=_0xcce1a4[_0x1d17('0xf')];this['countdropretry']=_0xcce1a4[_0x1d17('0x10')];this[_0x1d17('0x12')]=_0xcce1a4['countabandonedretry'];this[_0x1d17('0x13')]=_0xcce1a4[_0x1d17('0x13')];this['countagentrejectretry']=_0xcce1a4['countagentrejectretry'];this['uniqueid']=_0x2382c2['uniqueid'];this[_0x1d17('0x14')]=_0xcce1a4['name'];this[_0x1d17('0x15')]=_0xcce1a4[_0x1d17('0x16')];this[_0x1d17('0x17')]=_0xcce1a4[_0x1d17('0x17')];this[_0x1d17('0x18')]=_0xcce1a4[_0x1d17('0x18')];this[_0x1d17('0x19')]=_0xcce1a4['answertime'];this[_0x1d17('0x1a')]=moment()['format'](_0x1d17('0x1b'));this[_0x1d17('0x1c')]=getSeconds(_0xcce1a4[_0x1d17('0x18')],_0xcce1a4[_0x1d17('0x17')]);this['holdtime']=getSeconds(_0xcce1a4[_0x1d17('0x19')],_0xcce1a4[_0x1d17('0x18')]);this['talktime']=getSeconds(this['endtime'],_0xcce1a4[_0x1d17('0x19')]);this['queue']=_0x2382c2[_0x1d17('0xa')];this[_0x1d17('0x1d')]=_0x2382c2[_0x1d17('0x1d')];this['reason']=_0x2382c2[_0x1d17('0x1e')];this[_0x1d17('0x1f')]=_0xcce1a4[_0x1d17('0x1f')];this[_0x1d17('0x20')]=_0xcce1a4['callbackuniqueid'];this[_0x1d17('0x21')]=_0xcce1a4[_0x1d17('0x21')];this[_0x1d17('0x22')]=_0xcce1a4[_0x1d17('0x22')];this[_0x1d17('0x23')]=_0xcce1a4[_0x1d17('0x23')];this[_0x1d17('0x24')]=_0xcce1a4[_0x1d17('0x24')];this[_0x1d17('0x25')]=_0xcce1a4[_0x1d17('0x25')];this[_0x1d17('0x26')]=_0xcce1a4[_0x1d17('0x26')];this['CampaignId']=_0xcce1a4[_0x1d17('0x27')];this[_0x1d17('0x28')]=_0xcce1a4[_0x1d17('0x28')]||'';this[_0x1d17('0x29')]=_0xcce1a4[_0x1d17('0x29')]||'';}module[_0x1d17('0x2a')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 2dddafe..77f4708 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6d6=['util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports'];(function(_0x374e14,_0x1dcd37){var _0x4b42a8=function(_0x3945dd){while(--_0x3945dd){_0x374e14['push'](_0x374e14['shift']());}};_0x4b42a8(++_0x1dcd37);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x5e23c9,_0x216339){_0x5e23c9=_0x5e23c9-0x0;var _0x580e4c=_0xd6d6[_0x5e23c9];return _0x580e4c;};'use strict';var util=require(_0x6d6d('0x0'));var _=require(_0x6d6d('0x1'));var moment=require(_0x6d6d('0x2'));function getSeconds(_0x33226e,_0x536523){var _0x2e1aed=moment(_0x33226e)[_0x6d6d('0x3')](0x0);var _0x1b8610=moment(_0x536523)[_0x6d6d('0x3')](0x0);return _0x2e1aed[_0x6d6d('0x4')](_0x1b8610,_0x6d6d('0x5'));}function Final(_0x35a813){this['uniqueid']=_0x35a813[_0x6d6d('0x6')];this[_0x6d6d('0x7')]=_0x35a813[_0x6d6d('0x7')];this[_0x6d6d('0x8')]=_0x35a813[_0x6d6d('0x8')];this[_0x6d6d('0x9')]=_0x35a813[_0x6d6d('0x8')]==='outbound'?'queue':_0x35a813[_0x6d6d('0x8')];this[_0x6d6d('0xa')]=_0x35a813[_0x6d6d('0xa')];this[_0x6d6d('0xb')]=_0x35a813[_0x6d6d('0xb')];this['countnoanswerretry']=_0x35a813[_0x6d6d('0xc')];this[_0x6d6d('0xd')]=_0x35a813['countbusyretry']+_0x35a813['countcongestionretry']+_0x35a813[_0x6d6d('0xc')]+_0x35a813[_0x6d6d('0xe')]+_0x35a813[_0x6d6d('0xf')]+_0x35a813[_0x6d6d('0x10')]+_0x35a813[_0x6d6d('0x11')]+_0x35a813[_0x6d6d('0x12')];this[_0x6d6d('0xe')]=_0x35a813[_0x6d6d('0xe')];this['countdropretry']=_0x35a813[_0x6d6d('0xf')];this[_0x6d6d('0x10')]=_0x35a813[_0x6d6d('0x10')];this[_0x6d6d('0x11')]=_0x35a813[_0x6d6d('0x11')];this['countagentrejectretry']=_0x35a813[_0x6d6d('0x12')];this['queue']=_0x35a813[_0x6d6d('0x13')];this[_0x6d6d('0x14')]=_0x35a813[_0x6d6d('0x14')];this['calleridnum']=_0x35a813['calleridnum'];this[_0x6d6d('0x15')]=_0x35a813[_0x6d6d('0x15')];this[_0x6d6d('0x16')]=_0x35a813[_0x6d6d('0x16')];this['endtime']=_0x35a813['responsetime'];this[_0x6d6d('0x17')]=_0x35a813['ringtime']||0x0;this[_0x6d6d('0x18')]=_0x35a813[_0x6d6d('0x18')]||0x0;this[_0x6d6d('0x19')]=_0x35a813[_0x6d6d('0x19')]||0x0;this[_0x6d6d('0x1a')]=_0x35a813[_0x6d6d('0x1a')];this[_0x6d6d('0x1b')]=_0x35a813[_0x6d6d('0x1b')];this[_0x6d6d('0x1c')]=_0x35a813[_0x6d6d('0x1c')];this[_0x6d6d('0x1d')]=_0x35a813[_0x6d6d('0x1d')];this[_0x6d6d('0x1e')]=_0x35a813[_0x6d6d('0x1e')];this[_0x6d6d('0x1f')]=_0x35a813[_0x6d6d('0x1f')];this[_0x6d6d('0x20')]=_0x35a813['UserId'];this[_0x6d6d('0x21')]=_0x35a813[_0x6d6d('0x21')];this[_0x6d6d('0x22')]=_0x35a813[_0x6d6d('0x22')];this[_0x6d6d('0x23')]=_0x35a813[_0x6d6d('0x23')]||'';this['originatecalleridname']=_0x35a813[_0x6d6d('0x24')]||'';}module[_0x6d6d('0x25')]=Final; \ No newline at end of file +var _0x826a=['calleridname','calleridnum','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry'];(function(_0x552fce,_0x3f24bc){var _0x3e27a2=function(_0xc91154){while(--_0xc91154){_0x552fce['push'](_0x552fce['shift']());}};_0x3e27a2(++_0x3f24bc);}(_0x826a,0x1aa));var _0xa826=function(_0x5f337f,_0x2e412f){_0x5f337f=_0x5f337f-0x0;var _0x519374=_0x826a[_0x5f337f];return _0x519374;};'use strict';var util=require('util');var _=require(_0xa826('0x0'));var moment=require('moment');function getSeconds(_0x204abf,_0x50c70e){var _0x376d53=moment(_0x204abf)[_0xa826('0x1')](0x0);var _0x2212a4=moment(_0x50c70e)[_0xa826('0x1')](0x0);return _0x376d53['diff'](_0x2212a4,_0xa826('0x2'));}function Final(_0x15f777){this[_0xa826('0x3')]=_0x15f777[_0xa826('0x3')];this[_0xa826('0x4')]=_0x15f777[_0xa826('0x4')];this[_0xa826('0x5')]=_0x15f777[_0xa826('0x5')];this[_0xa826('0x6')]=_0x15f777[_0xa826('0x5')]===_0xa826('0x7')?_0xa826('0x8'):_0x15f777[_0xa826('0x5')];this[_0xa826('0x9')]=_0x15f777[_0xa826('0x9')];this[_0xa826('0xa')]=_0x15f777['countcongestionretry'];this[_0xa826('0xb')]=_0x15f777['countnoanswerretry'];this[_0xa826('0xc')]=_0x15f777[_0xa826('0x9')]+_0x15f777[_0xa826('0xa')]+_0x15f777[_0xa826('0xb')]+_0x15f777[_0xa826('0xd')]+_0x15f777[_0xa826('0xe')]+_0x15f777[_0xa826('0xf')]+_0x15f777['countmachineretry']+_0x15f777[_0xa826('0x10')];this['countnosuchnumberretry']=_0x15f777[_0xa826('0xd')];this[_0xa826('0xe')]=_0x15f777['countdropretry'];this['countabandonedretry']=_0x15f777['countabandonedretry'];this[_0xa826('0x11')]=_0x15f777['countmachineretry'];this['countagentrejectretry']=_0x15f777[_0xa826('0x10')];this[_0xa826('0x8')]=_0x15f777[_0xa826('0x8')];this['calleridname']=_0x15f777[_0xa826('0x12')];this[_0xa826('0x13')]=_0x15f777[_0xa826('0x13')];this[_0xa826('0x14')]=_0x15f777[_0xa826('0x14')];this['responsetime']=_0x15f777[_0xa826('0x15')];this[_0xa826('0x16')]=_0x15f777[_0xa826('0x15')];this['ringtime']=_0x15f777['ringtime']||0x0;this[_0xa826('0x17')]=_0x15f777[_0xa826('0x17')]||0x0;this[_0xa826('0x18')]=_0x15f777[_0xa826('0x18')]||0x0;this[_0xa826('0x19')]=_0x15f777['callback'];this[_0xa826('0x1a')]=_0x15f777[_0xa826('0x1a')];this[_0xa826('0x1b')]=_0x15f777['callbackat'];this['recallme']=_0x15f777[_0xa826('0x1c')];this[_0xa826('0x1d')]=_0x15f777[_0xa826('0x1d')];this['ListId']=_0x15f777[_0xa826('0x1e')];this[_0xa826('0x1f')]=_0x15f777[_0xa826('0x1f')];this[_0xa826('0x20')]=_0x15f777[_0xa826('0x20')];this['CampaignId']=_0x15f777[_0xa826('0x21')];this['originatecalleridnum']=_0x15f777[_0xa826('0x22')]||'';this[_0xa826('0x23')]=_0x15f777['originatecalleridname']||'';}module[_0xa826('0x24')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 34898db..5aa451b 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x04f0=['reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','name','calleridnum','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','membername','IVR'];(function(_0x4c23a1,_0x5e630c){var _0x524a39=function(_0x23c008){while(--_0x23c008){_0x4c23a1['push'](_0x4c23a1['shift']());}};_0x524a39(++_0x5e630c);}(_0x04f0,0x1b9));var _0x004f=function(_0x428703,_0x629d2c){_0x428703=_0x428703-0x0;var _0x4e2caa=_0x04f0[_0x428703];return _0x4e2caa;};'use strict';var util=require(_0x004f('0x0'));var _=require(_0x004f('0x1'));var moment=require(_0x004f('0x2'));function getSeconds(_0xc6f257,_0x39be6f){var _0x5108ad=moment(_0xc6f257)[_0x004f('0x3')](0x0);var _0x4b5394=moment(_0x39be6f)[_0x004f('0x3')](0x0);return _0x5108ad['diff'](_0x4b5394,_0x004f('0x4'));}function Hangup(_0x4fb86a,_0x108687){this[_0x004f('0x5')]=0x4;this[_0x004f('0x6')]=_0x004f('0x7');this['scheduledat']=_0x4fb86a[_0x004f('0x8')];this[_0x004f('0x9')]=_0x4fb86a[_0x004f('0x9')];this[_0x004f('0xa')]=_0x4fb86a['type']===_0x004f('0xb')?_0x004f('0xc'):_0x4fb86a['type'];this[_0x004f('0xd')]=_0x4fb86a['countbusyretry'];this[_0x004f('0xe')]=_0x4fb86a[_0x004f('0xe')];this['countnoanswerretry']=_0x4fb86a[_0x004f('0xf')];this[_0x004f('0x10')]=_0x4fb86a[_0x004f('0xd')]+_0x4fb86a['countcongestionretry']+_0x4fb86a[_0x004f('0xf')]+_0x4fb86a[_0x004f('0x11')]+_0x4fb86a[_0x004f('0x12')]+_0x4fb86a[_0x004f('0x13')]+_0x4fb86a['countmachineretry']+_0x4fb86a[_0x004f('0x14')];this[_0x004f('0x11')]=_0x4fb86a[_0x004f('0x11')];this[_0x004f('0x12')]=_0x4fb86a['countdropretry'];this[_0x004f('0x13')]=_0x4fb86a['countabandonedretry'];this[_0x004f('0x15')]=_0x4fb86a[_0x004f('0x15')];this['countagentrejectretry']=_0x4fb86a[_0x004f('0x14')];this[_0x004f('0x16')]=_0x108687[_0x004f('0x16')];this['calleridname']=_0x4fb86a[_0x004f('0x17')];this[_0x004f('0x18')]=_0x4fb86a['number'];this[_0x004f('0x19')]=_0x4fb86a[_0x004f('0x19')];this[_0x004f('0x1a')]=_0x4fb86a[_0x004f('0x1a')];this[_0x004f('0x1b')]=moment()['format'](_0x004f('0x1c'));this[_0x004f('0x1d')]=getSeconds(_0x4fb86a[_0x004f('0x1a')],_0x4fb86a[_0x004f('0x19')]);this['holdtime']=0x0;this['talktime']=getSeconds(this[_0x004f('0x1b')],_0x4fb86a[_0x004f('0x1a')]);this[_0x004f('0xc')]=_0x4fb86a['queue'];this[_0x004f('0x1e')]=_0x004f('0x1f');this[_0x004f('0x20')]=_0x108687['cause-txt'];this[_0x004f('0x21')]=_0x4fb86a[_0x004f('0x21')];this[_0x004f('0x22')]=_0x4fb86a[_0x004f('0x22')];this[_0x004f('0x23')]=_0x4fb86a[_0x004f('0x23')];this['recallme']=_0x4fb86a[_0x004f('0x24')];this[_0x004f('0x25')]=_0x4fb86a[_0x004f('0x25')];this['ListId']=_0x4fb86a[_0x004f('0x26')];this['UserId']=_0x4fb86a[_0x004f('0x27')];this[_0x004f('0x28')]=_0x4fb86a[_0x004f('0x28')];this['CampaignId']=_0x4fb86a[_0x004f('0x29')];}module[_0x004f('0x2a')]=Hangup; \ No newline at end of file +var _0x729c=['campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','exports','lodash','moment','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type'];(function(_0x508f85,_0x34fbca){var _0x23a9db=function(_0x260231){while(--_0x260231){_0x508f85['push'](_0x508f85['shift']());}};_0x23a9db(++_0x34fbca);}(_0x729c,0x124));var _0xc729=function(_0x1a3c69,_0x524907){_0x1a3c69=_0x1a3c69-0x0;var _0x8a554=_0x729c[_0x1a3c69];return _0x8a554;};'use strict';var util=require('util');var _=require(_0xc729('0x0'));var moment=require(_0xc729('0x1'));function getSeconds(_0x569633,_0x3480ad){var _0x7a8757=moment(_0x569633)[_0xc729('0x2')](0x0);var _0x4820a0=moment(_0x3480ad)[_0xc729('0x2')](0x0);return _0x7a8757[_0xc729('0x3')](_0x4820a0,_0xc729('0x4'));}function Hangup(_0x2d90e1,_0x2fbc16){this['state']=0x4;this[_0xc729('0x5')]=_0xc729('0x6');this[_0xc729('0x7')]=_0x2d90e1[_0xc729('0x7')];this[_0xc729('0x8')]=_0x2d90e1[_0xc729('0x8')];this[_0xc729('0x9')]=_0x2d90e1['type']===_0xc729('0xa')?_0xc729('0xb'):_0x2d90e1['type'];this[_0xc729('0xc')]=_0x2d90e1[_0xc729('0xc')];this['countcongestionretry']=_0x2d90e1[_0xc729('0xd')];this[_0xc729('0xe')]=_0x2d90e1[_0xc729('0xe')];this[_0xc729('0xf')]=_0x2d90e1['countbusyretry']+_0x2d90e1[_0xc729('0xd')]+_0x2d90e1['countnoanswerretry']+_0x2d90e1[_0xc729('0x10')]+_0x2d90e1[_0xc729('0x11')]+_0x2d90e1[_0xc729('0x12')]+_0x2d90e1[_0xc729('0x13')]+_0x2d90e1['countagentrejectretry'];this['countnosuchnumberretry']=_0x2d90e1['countnosuchnumberretry'];this['countdropretry']=_0x2d90e1[_0xc729('0x11')];this['countabandonedretry']=_0x2d90e1[_0xc729('0x12')];this[_0xc729('0x13')]=_0x2d90e1[_0xc729('0x13')];this[_0xc729('0x14')]=_0x2d90e1['countagentrejectretry'];this[_0xc729('0x15')]=_0x2fbc16['uniqueid'];this[_0xc729('0x16')]=_0x2d90e1[_0xc729('0x17')];this['calleridnum']=_0x2d90e1[_0xc729('0x18')];this[_0xc729('0x19')]=_0x2d90e1[_0xc729('0x19')];this[_0xc729('0x1a')]=_0x2d90e1['responsetime'];this[_0xc729('0x1b')]=moment()['format'](_0xc729('0x1c'));this[_0xc729('0x1d')]=getSeconds(_0x2d90e1[_0xc729('0x1a')],_0x2d90e1['starttime']);this['holdtime']=0x0;this[_0xc729('0x1e')]=getSeconds(this['endtime'],_0x2d90e1[_0xc729('0x1a')]);this[_0xc729('0xb')]=_0x2d90e1[_0xc729('0xb')];this[_0xc729('0x1f')]=_0xc729('0x20');this['reason']=_0x2fbc16[_0xc729('0x21')];this[_0xc729('0x22')]=_0x2d90e1['callback'];this['callbackuniqueid']=_0x2d90e1[_0xc729('0x23')];this[_0xc729('0x24')]=_0x2d90e1['callbackat'];this[_0xc729('0x25')]=_0x2d90e1[_0xc729('0x25')];this[_0xc729('0x26')]=_0x2d90e1['ContactId'];this['ListId']=_0x2d90e1['ListId'];this[_0xc729('0x27')]=_0x2d90e1[_0xc729('0x27')];this[_0xc729('0x28')]=_0x2d90e1['VoiceQueueId'];this[_0xc729('0x29')]=_0x2d90e1['CampaignId'];}module[_0xc729('0x2a')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 0684528..7ab17c8 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c60=['countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x3c60,0x14c));var _0x03c6=function(_0x3e2489,_0x41d9dd){_0x3e2489=_0x3e2489-0x0;var _0x2254ce=_0x3c60[_0x3e2489];return _0x2254ce;};'use strict';var util=require('util');var _=require(_0x03c6('0x0'));var moment=require(_0x03c6('0x1'));function getSeconds(_0x1f19fd,_0x1741ef){var _0x5b7053=moment(_0x1f19fd)['milliseconds'](0x0);var _0x55defe=moment(_0x1741ef)[_0x03c6('0x2')](0x0);return _0x5b7053['diff'](_0x55defe,_0x03c6('0x3'));}function History(_0x1b4ac7){this['uniqueid']=_0x1b4ac7[_0x03c6('0x4')];this['scheduledat']=_0x1b4ac7[_0x03c6('0x5')]||undefined;this[_0x03c6('0x6')]=_0x1b4ac7[_0x03c6('0x6')];this['campaigntype']=_0x1b4ac7[_0x03c6('0x6')]==='outbound'?_0x03c6('0x7'):_0x1b4ac7['type'];this[_0x03c6('0x8')]=_0x1b4ac7[_0x03c6('0x8')];this[_0x03c6('0x9')]=_0x1b4ac7[_0x03c6('0x9')];this[_0x03c6('0xa')]=_0x1b4ac7[_0x03c6('0xa')];this[_0x03c6('0xb')]=_0x1b4ac7[_0x03c6('0x8')]+_0x1b4ac7[_0x03c6('0x9')]+_0x1b4ac7[_0x03c6('0xa')]+_0x1b4ac7[_0x03c6('0xc')]+_0x1b4ac7[_0x03c6('0xd')]+_0x1b4ac7[_0x03c6('0xe')]+_0x1b4ac7[_0x03c6('0xf')]+_0x1b4ac7['countagentrejectretry'];this[_0x03c6('0xc')]=_0x1b4ac7[_0x03c6('0xc')];this[_0x03c6('0xd')]=_0x1b4ac7['countdropretry'];this[_0x03c6('0xe')]=_0x1b4ac7[_0x03c6('0xe')];this[_0x03c6('0xf')]=_0x1b4ac7[_0x03c6('0xf')];this[_0x03c6('0x10')]=_0x1b4ac7[_0x03c6('0x10')];this[_0x03c6('0x7')]=_0x1b4ac7[_0x03c6('0x7')];this[_0x03c6('0x11')]=_0x1b4ac7[_0x03c6('0x12')];this[_0x03c6('0x13')]=_0x1b4ac7[_0x03c6('0x14')];this[_0x03c6('0x15')]=_0x1b4ac7[_0x03c6('0x15')];this[_0x03c6('0x16')]=_0x1b4ac7[_0x03c6('0x16')];this[_0x03c6('0x17')]=_0x1b4ac7[_0x03c6('0x16')];this[_0x03c6('0x18')]=getSeconds(_0x1b4ac7['responsetime'],_0x1b4ac7[_0x03c6('0x15')]);this[_0x03c6('0x19')]=0x0;this[_0x03c6('0x1a')]=0x0;this[_0x03c6('0x1b')]=_0x1b4ac7[_0x03c6('0x1b')];this[_0x03c6('0x1c')]=_0x1b4ac7[_0x03c6('0x1c')];this[_0x03c6('0x1d')]=_0x1b4ac7['callbackat'];this[_0x03c6('0x1e')]=_0x1b4ac7['recallme'];this['ContactId']=_0x1b4ac7['ContactId'];this['ListId']=_0x1b4ac7[_0x03c6('0x1f')];this[_0x03c6('0x20')]=_0x1b4ac7[_0x03c6('0x20')];this[_0x03c6('0x21')]=_0x1b4ac7['VoiceQueueId'];this[_0x03c6('0x22')]=_0x1b4ac7[_0x03c6('0x22')];this['originatecalleridnum']=_0x1b4ac7[_0x03c6('0x23')]||'';this[_0x03c6('0x24')]=_0x1b4ac7[_0x03c6('0x24')]||'';}module[_0x03c6('0x25')]=History; \ No newline at end of file +var _0x4197=['name','calleridnum','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry'];(function(_0x523291,_0x175f58){var _0x43073f=function(_0x2c753c){while(--_0x2c753c){_0x523291['push'](_0x523291['shift']());}};_0x43073f(++_0x175f58);}(_0x4197,0x131));var _0x7419=function(_0x590320,_0x58d0ce){_0x590320=_0x590320-0x0;var _0x10aa68=_0x4197[_0x590320];return _0x10aa68;};'use strict';var util=require(_0x7419('0x0'));var _=require(_0x7419('0x1'));var moment=require(_0x7419('0x2'));function getSeconds(_0x52621b,_0x4bdaf2){var _0x28b643=moment(_0x52621b)[_0x7419('0x3')](0x0);var _0x5d9111=moment(_0x4bdaf2)['milliseconds'](0x0);return _0x28b643[_0x7419('0x4')](_0x5d9111,'seconds');}function History(_0x2d6936){this[_0x7419('0x5')]=_0x2d6936[_0x7419('0x5')];this[_0x7419('0x6')]=_0x2d6936[_0x7419('0x6')]||undefined;this['type']=_0x2d6936[_0x7419('0x7')];this['campaigntype']=_0x2d6936[_0x7419('0x7')]===_0x7419('0x8')?_0x7419('0x9'):_0x2d6936['type'];this[_0x7419('0xa')]=_0x2d6936[_0x7419('0xa')];this[_0x7419('0xb')]=_0x2d6936[_0x7419('0xb')];this[_0x7419('0xc')]=_0x2d6936[_0x7419('0xc')];this[_0x7419('0xd')]=_0x2d6936[_0x7419('0xa')]+_0x2d6936[_0x7419('0xb')]+_0x2d6936[_0x7419('0xc')]+_0x2d6936[_0x7419('0xe')]+_0x2d6936['countdropretry']+_0x2d6936[_0x7419('0xf')]+_0x2d6936[_0x7419('0x10')]+_0x2d6936[_0x7419('0x11')];this[_0x7419('0xe')]=_0x2d6936[_0x7419('0xe')];this[_0x7419('0x12')]=_0x2d6936[_0x7419('0x12')];this['countabandonedretry']=_0x2d6936['countabandonedretry'];this[_0x7419('0x10')]=_0x2d6936['countmachineretry'];this[_0x7419('0x11')]=_0x2d6936[_0x7419('0x11')];this[_0x7419('0x9')]=_0x2d6936['queue'];this['calleridname']=_0x2d6936[_0x7419('0x13')];this[_0x7419('0x14')]=_0x2d6936['number'];this[_0x7419('0x15')]=_0x2d6936[_0x7419('0x15')];this[_0x7419('0x16')]=_0x2d6936[_0x7419('0x16')];this[_0x7419('0x17')]=_0x2d6936['responsetime'];this['ringtime']=getSeconds(_0x2d6936['responsetime'],_0x2d6936['starttime']);this[_0x7419('0x18')]=0x0;this[_0x7419('0x19')]=0x0;this[_0x7419('0x1a')]=_0x2d6936[_0x7419('0x1a')];this[_0x7419('0x1b')]=_0x2d6936['callbackuniqueid'];this['callbackat']=_0x2d6936[_0x7419('0x1c')];this[_0x7419('0x1d')]=_0x2d6936[_0x7419('0x1d')];this['ContactId']=_0x2d6936[_0x7419('0x1e')];this[_0x7419('0x1f')]=_0x2d6936['ListId'];this['UserId']=_0x2d6936[_0x7419('0x20')];this[_0x7419('0x21')]=_0x2d6936[_0x7419('0x21')];this['CampaignId']=_0x2d6936['CampaignId'];this[_0x7419('0x22')]=_0x2d6936[_0x7419('0x22')]||'';this[_0x7419('0x23')]=_0x2d6936[_0x7419('0x23')]||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index dc4ed1a..a3d4f8a 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 _0x4377=['[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','Action','command','interval','indexOf','iftime\x20%s,%s','content','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','handlePower','dialPowerLevel','method\x20not\x20recognized','checkPreviewRecallReminder','Agent','user:%s','dialActive','dialTimezone','dialPreviewRecallmeReminder','dialGlobalInterval','launchHandleIvr','pow','replace','random','match','actionOriginate','Contact','phone','originate','getCaller','\x22agi://%s/square,%s\x22','NONE','outbound','\x22%s,%s%s,,,%s\x22','dialAgiAfterHangupAgent','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','isTrunkReachable','dialPrefix','trim','dialCutDigit','SIP/%s/%s%s','substring','from-sip','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','syncOriginateResponse','responsetime','getQueue','response','[callProgressDetecting]\x20','checkRetriveMax','countbusyretry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callProgressDetecting','object','[callProgressDetecting]','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','noanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Success','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','[CatchErlangB]','outboundQueuePauses','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','inBlackList','handleIvr','limitCalls','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','checkIsBlackListIvr','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','booked','dialLimitQueue','not_inuse','dialOrderByScheduledAt','[countReScheduled]\x20','tryOriginatePredictive','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','interval\x20=\x20','Amax\x20=\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','p\x20=\x20','exports','lodash','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','../ami','defaults','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/setting','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','agentcomplete','syncAgentComplete','hangup','syncHangup','varset','syncVarSet','queuemember','queuestatuscomplete','previewRecallmeReminderInterval','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','Intervals','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','abandoned','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','format','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','inspect','error','stack','length','undefined','[decremetOriginate]\x20is\x20null\x20or\x20undefined','[getContactDialer2][ReScheduled]','contactsRescheduled','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','statedesc','endtime','starttime','loopClearZombieChannels','[uniqueid]','clearZombieChannels','[actions]','sequence','status','updateOriginated','[Dialer][checkChannel]','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','checkIsBlackList','catch','[checkIsBlackList]\x20','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','ListId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','isSuccess','SIP/%s','reachable','uniqueId','uniqueid','isNil','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','state','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','[syncHangupInAMDIvr]','countcongestionretry','countdropretry','dialMachineMaxRetry','ivrAnswerCallsDay','dialQueueProject','AGI','[syncHangupIvr][createHistory]','[syncHangupIvr]','cause-txt','reason','agent','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[syncAgentComplete][createHistory][11]','channel','syncQueueMember','strategy','roundrobin','actionid','stateinterface','locked','rrmemory','push','idHopper','paused','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','syncQueueStatusComplete','run','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20'];(function(_0x51639f,_0x2f1dc3){var _0x10b89a=function(_0x2df606){while(--_0x2df606){_0x51639f['push'](_0x51639f['shift']());}};_0x10b89a(++_0x2f1dc3);}(_0x4377,0xeb));var _0x7437=function(_0x33c03f,_0x2a4016){_0x33c03f=_0x33c03f-0x0;var _0x97eb85=_0x4377[_0x33c03f];return _0x97eb85;};'use strict';var util=require('util');var _=require(_0x7437('0x0'));var BPromise=require(_0x7437('0x1'));var uuid=require(_0x7437('0x2'));var moment=require(_0x7437('0x3'));var rr=require('rr');var md5=require(_0x7437('0x4'));var Redis=require(_0x7437('0x5'));var ut=require(_0x7437('0x6'));var config=require(_0x7437('0x7'));var logger=require(_0x7437('0x8'))(_0x7437('0x9'));var loggerBooked=require('../../../config/logger')('booked');var loggerPredictive=require(_0x7437('0x8'))(_0x7437('0xa'));var loggerPredictiveCalls=require(_0x7437('0x8'))(_0x7437('0xb'));var loggerSyncQueueSummary=require(_0x7437('0x8'))(_0x7437('0xc'));var ami=require(_0x7437('0xd'));config['redis']=_[_0x7437('0xe')](config[_0x7437('0xf')],{'host':_0x7437('0x10'),'port':0x18eb});var io=require(_0x7437('0x11'))(new Redis(config[_0x7437('0xf')]));var cmHopper=require(_0x7437('0x12'));var cmHopperHistory=require(_0x7437('0x13'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x7437('0x14'));var RpcSetting=require(_0x7437('0x15'));var Action=require(_0x7437('0x16'));var History=require(_0x7437('0x17'));var Final=require(_0x7437('0x18'));var AgentComplete=require(_0x7437('0x19'));var QueueCallerAbandon=require(_0x7437('0x1a'));var Hangup=require(_0x7437('0x1b'));var ipAgi=process[_0x7437('0x1c')]['XCALLY_IP_AGI']||_0x7437('0x1d');var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x7437('0x1e')][_0x7437('0x1f')]=function(_0x561f62){this[_0x7437('0x20')]=this[_0x7437('0x20')]?this[_0x7437('0x20')][_0x7437('0x21')](_0x561f62):_0x561f62();};function Dialer(_0x1c52af,_0x4facc9){this['sequence']=new Sequence();this[_0x7437('0x22')]=_0x4facc9;this[_0x7437('0x23')]=_0x1c52af['voiceQueues'];this[_0x7437('0x24')]=_0x1c52af[_0x7437('0x24')];this[_0x7437('0x25')]=_0x1c52af[_0x7437('0x25')];this[_0x7437('0x26')]=_0x1c52af[_0x7437('0x26')];this[_0x7437('0x27')]=config[_0x7437('0x27')]||0x2;this[_0x7437('0x28')]={};this[_0x7437('0x29')]={};this[_0x7437('0x2a')]={};this['uniqueId']={};this['optionPredictive']={};this['startPredictive']={};this[_0x7437('0x2b')]={};this[_0x7437('0x2c')]={};this[_0x7437('0x2d')]={};this[_0x7437('0x2e')]={};ami['on'](_0x7437('0x2f'),this[_0x7437('0x30')][_0x7437('0x31')](this));ami['on'](_0x7437('0x32'),this[_0x7437('0x33')]['bind'](this));ami['on'](_0x7437('0x34'),this['syncOriginateResponse'][_0x7437('0x31')](this));ami['on'](_0x7437('0x35'),this[_0x7437('0x36')]['bind'](this));ami['on']('custom:queuesummary',this[_0x7437('0xc')][_0x7437('0x31')](this));ami['on'](_0x7437('0x37'),this[_0x7437('0x38')][_0x7437('0x31')](this));ami['on']('newexten',this['syncNewExten']['bind'](this));ami['on'](_0x7437('0x39'),this[_0x7437('0x3a')][_0x7437('0x31')](this));ami['on'](_0x7437('0x3b'),this['syncQueueMember']['bind'](this));ami['on'](_0x7437('0x3c'),this['syncQueueStatusComplete']['bind'](this));this['loopCampaigns']();this['loopClearZombieChannels']();RpcSetting['getSettings']()['then'](function(_0x52c082){previewRecallmeReminderInterval=_0x52c082[_0x7437('0x3d')];});}function isNotNull(_0x1c60bf){return _0x1c60bf!==null&&!_[_0x7437('0x3e')](_0x1c60bf);}function checkIsLoggedIn(_0x2c0dd8,_0x3dbfbf){return function(){if(_0x3dbfbf<=0x0){_0x2c0dd8[_0x7437('0x3f')]=_0x7437('0x40');throw _0x2c0dd8[_0x7437('0x41')]+_0x7437('0x42');}};}function isActive(_0x5f097e){return _0x5f097e;}function checkIsActive(_0x1fd5c4,_0x349b33){return function(){if(!isActive(_0x349b33)){_0x1fd5c4['message']='NOT_ACTIVE';throw _0x1fd5c4['name']+_0x7437('0x43');}};}function checkInterval(_0xf47500){return function(){if(!isNotNull(_0xf47500['Interval'])){_0xf47500[_0x7437('0x3f')]=_0x7437('0x44');throw _0xf47500[_0x7437('0x41')]+_0x7437('0x45');}if(!isNotNull(_0xf47500[_0x7437('0x46')][_0x7437('0x47')])){_0xf47500[_0x7437('0x3f')]=_0x7437('0x44');throw _0xf47500[_0x7437('0x41')]+_0x7437('0x45');}if(!isNotNull(_['isEmpty'](_0xf47500[_0x7437('0x46')]['Intervals']))){_0xf47500[_0x7437('0x3f')]=_0x7437('0x44');throw _0xf47500['name']+_0x7437('0x45');}};}function msgResponse(_0x5ba72a,_0xfd901,_0x5675ea){return{'action':_0x5ba72a,'response':_0xfd901,'message':_0x5675ea,'stack':_0x5675ea};}function myreject(_0x127e2b){return function(_0x2680b6){return _0x127e2b(msgResponse(_0x7437('0x48'),_0x7437('0x49'),JSON[_0x7437('0x4a')](_0x2680b6)));};}function getSeconds(_0x23169f,_0x3fafe3){var _0x4e31ec=moment(_0x23169f)[_0x7437('0x4b')](0x0);var _0x54a0dc=moment(_0x3fafe3)[_0x7437('0x4b')](0x0);return _0x4e31ec[_0x7437('0x4c')](_0x54a0dc,_0x7437('0x4d'));}function emit(_0x49515d,_0xe41490,_0x565a30){io['to'](_0x49515d)[_0x7437('0x4e')](_0xe41490,_0x565a30);}function emitVoiceQueueSummary(_0x59f6a6){if(_0x59f6a6[_0x7437('0x4f')]==='outbound'){var _0x4ce6af={'id':_0x59f6a6['id'],'name':_0x59f6a6[_0x7437('0x41')],'strategy':_0x59f6a6['strategy'],'answered':_0x59f6a6[_0x7437('0x50')],'available':_0x59f6a6[_0x7437('0x51')],'loggedIn':_0x59f6a6[_0x7437('0x52')],'pTalking':_0x59f6a6[_0x7437('0x53')],'sumBillable':_0x59f6a6[_0x7437('0x54')],'sumDuration':_0x59f6a6['sumDuration'],'sumHoldTime':_0x59f6a6[_0x7437('0x55')]||0x0,'talking':_0x59f6a6[_0x7437('0x56')],'total':_0x59f6a6[_0x7437('0x57')],'type':_0x59f6a6[_0x7437('0x4f')],'unmanaged':_0x59f6a6['unmanaged'],'abandoned':_0x59f6a6[_0x7437('0x58')],'waiting':_0x59f6a6['waiting'],'loggedInDb':_0x59f6a6['loggedInDb'],'dialActive':_0x59f6a6['dialActive'],'dialMethod':_0x59f6a6[_0x7437('0x59')],'dialOriginateCallerIdName':_0x59f6a6[_0x7437('0x5a')],'dialOriginateCallerIdNumber':_0x59f6a6[_0x7437('0x5b')],'dialOriginateTimeout':_0x59f6a6[_0x7437('0x5c')],'dialPrefix':_0x59f6a6['dialPrefix'],'outboundAnswerAgiCallsDay':_0x59f6a6['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x59f6a6[_0x7437('0x5d')],'outboundBlacklistCallsDay':_0x59f6a6[_0x7437('0x5e')],'outboundBusyCallsDay':_0x59f6a6[_0x7437('0x5f')],'outboundCongestionCallsDay':_0x59f6a6[_0x7437('0x60')],'outboundDropCallsDayACS':_0x59f6a6['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x59f6a6[_0x7437('0x61')],'outboundDropCallsDayTimeout':_0x59f6a6['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x59f6a6['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x59f6a6[_0x7437('0x62')],'outboundOriginateFailureCallsDay':_0x59f6a6[_0x7437('0x63')],'outboundReCallsDay':_0x59f6a6['outboundReCallsDay'],'outboundRejectCallsDay':_0x59f6a6['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x59f6a6[_0x7437('0x64')],'predictiveIntervalAnsweredCalls':_0x59f6a6[_0x7437('0x65')],'predictiveIntervalAvgHoldtime':_0x59f6a6[_0x7437('0x66')],'predictiveIntervalAvgTalktime':_0x59f6a6[_0x7437('0x67')],'predictiveIntervalDroppedCallsCallersExit':_0x59f6a6[_0x7437('0x68')],'predictiveIntervalDroppedCallsTimeout':_0x59f6a6[_0x7437('0x69')],'predictiveIntervalErlangCalls':_0x59f6a6[_0x7437('0x6a')],'predictiveIntervalErlangCallsDroppedCalls':_0x59f6a6[_0x7437('0x6b')],'predictiveIntervalHitRate':_0x59f6a6['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x59f6a6[_0x7437('0x6c')],'predictiveIntervalPauses':_0x59f6a6[_0x7437('0x6d')],'predictiveIntervalAvailable':_0x59f6a6[_0x7437('0x6e')],'predictiveIntervalTotalCalls':_0x59f6a6[_0x7437('0x6f')],'message':_0x59f6a6['message'],'originated':_0x59f6a6[_0x7437('0x70')],'erlangCalls':_0x59f6a6[_0x7437('0x71')],'erlangCallToSecond':_0x59f6a6[_0x7437('0x72')],'erlangAbandonmentRate':_0x59f6a6[_0x7437('0x73')],'erlangBusyFactor':_0x59f6a6[_0x7437('0x74')],'startPredictive':_0x59f6a6[_0x7437('0x75')],'startProgressive':_0x59f6a6[_0x7437('0x2b')]};if(_0x59f6a6['Trunk']){_0x4ce6af['Trunk']={'id':_0x59f6a6['Trunk']['id'],'name':_0x59f6a6[_0x7437('0x76')][_0x7437('0x41')],'active':_0x59f6a6[_0x7437('0x76')][_0x7437('0x77')],'callerid':_0x59f6a6['Trunk'][_0x7437('0x78')]};}if(_0x59f6a6[_0x7437('0x46')]){_0x4ce6af[_0x7437('0x46')]={'id':_0x59f6a6[_0x7437('0x46')]['id'],'name':_0x59f6a6[_0x7437('0x46')][_0x7437('0x41')]};}var _0x3cca6d=md5(JSON[_0x7437('0x4a')](_0x4ce6af));if(_0x59f6a6[_0x7437('0x4')]!==_0x3cca6d){_0x59f6a6[_0x7437('0x4')]=_0x3cca6d;emit(util[_0x7437('0x79')]('voice:queue:%s',_0x4ce6af[_0x7437('0x41')]),_0x7437('0x7a'),_0x4ce6af);}}}function emitCampaignSummary(_0xf39f38){if(_0xf39f38[_0x7437('0x4f')]===_0x7437('0x7b')){emit(util[_0x7437('0x79')](_0x7437('0x7c'),_0xf39f38[_0x7437('0x41')]),_0x7437('0x7d'),_0xf39f38);}}function checkGetDataPredictive(_0x492e36){if(isNotNull(_0x492e36)&&!_[_0x7437('0x7e')](_0x492e36)){loggerPredictive[_0x7437('0x7f')](_0x7437('0x80'));loggerPredictive[_0x7437('0x7f')](_0x7437('0x81'),_0x492e36['predictiveIntervalTotalCalls']);loggerPredictive[_0x7437('0x7f')](_0x7437('0x82'),_0x492e36[_0x7437('0x65')]);loggerPredictive[_0x7437('0x7f')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x492e36[_0x7437('0x69')]);loggerPredictive[_0x7437('0x7f')](_0x7437('0x83'),_0x492e36[_0x7437('0x68')]);loggerPredictive['info'](_0x7437('0x84'),_0x492e36[_0x7437('0x66')]);loggerPredictive[_0x7437('0x7f')](_0x7437('0x85'),_0x492e36['predictiveIntervalAvgTalktime']);loggerPredictive[_0x7437('0x7f')](_0x7437('0x86'));if(_0x492e36[_0x7437('0x6f')]>0x0){if(!_[_0x7437('0x3e')](_0x492e36[_0x7437('0x67')])&&_0x492e36[_0x7437('0x67')]>0x0){return!![];}loggerPredictive[_0x7437('0x7f')](_0x7437('0x87'));if(!_[_0x7437('0x3e')](_0x492e36[_0x7437('0x66')])&&_0x492e36[_0x7437('0x66')]>0x0){return!![];}loggerPredictive[_0x7437('0x7f')](_0x7437('0x88'));}else{loggerPredictive[_0x7437('0x7f')](_0x7437('0x89'));}}else{loggerPredictive['info'](_0x7437('0x8a'));}return![];}function mergeDataErlangB(_0x1d7e91){return function(_0x58ba33){loggerPredictive['info'](_0x7437('0x8b'));loggerPredictive[_0x7437('0x7f')](_0x7437('0x8c'),_0x58ba33[_0x7437('0x71')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x58ba33[_0x7437('0x72')]);loggerPredictive[_0x7437('0x7f')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x58ba33[_0x7437('0x73')]);loggerPredictive[_0x7437('0x7f')](_0x7437('0x8d'),_0x58ba33[_0x7437('0x74')]);loggerPredictive[_0x7437('0x7f')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x58ba33[_0x7437('0x73')]);loggerPredictive[_0x7437('0x7f')](_0x7437('0x86'));_[_0x7437('0x8e')](_0x1d7e91,_0x58ba33);};}function getDiff(_0x3bada3){var _0x1f73f1=moment()[_0x7437('0x4b')](0x0);var _0xa28efd=moment(_0x3bada3)['milliseconds'](0x0);return _0x1f73f1[_0x7437('0x4c')](_0xa28efd,_0x7437('0x4d'));}function ifInterval(_0x62dcdc,_0x54ff5e){if(_['isUndefined'](_0x54ff5e)){return![];}return getDiff(_0x54ff5e)<_0x62dcdc*0x3c;}function freeVariablesPredictive(_0x103bbe){if(isNotNull(_0x103bbe)){if(!_[_0x7437('0x3e')](_0x103bbe[_0x7437('0x2b')])){_0x103bbe[_0x7437('0x2b')]=undefined;loggerPredictive[_0x7437('0x7f')](_0x103bbe[_0x7437('0x41')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0x7437('0x3e')](_0x103bbe['startPredictive'])){_0x103bbe['startPredictive']=undefined;loggerPredictive[_0x7437('0x7f')](_0x103bbe[_0x7437('0x41')],_0x7437('0x8f'));}if(!_[_0x7437('0x3e')](_0x103bbe[_0x7437('0x90')])){clearInterval(_0x103bbe['handlePredictive']);_0x103bbe[_0x7437('0x90')]=undefined;loggerPredictive[_0x7437('0x7f')](_0x103bbe[_0x7437('0x41')],_0x7437('0x91'));}}}function erlangb(_0x2e41f1,_0xc99929){if(_0xc99929===0x0){return 0x0;}var _0x548a59=0x1;for(var _0x51488f=0x1;_0x51488f<=_0xc99929;_0x51488f+=0x1){_0x548a59=0x1+_0x548a59*_0x51488f/_0x2e41f1;}return 0x1/_0x548a59;}function isVoiceQueueOutbound(_0x1d524c){return _0x1d524c==='outbound';}function isNotPreview(_0x34d59e){return _0x34d59e!=='preview';}function isCampaignIvr(_0x36d2fa){return _0x36d2fa===_0x7437('0x7b');}function getCallerId(_0x3fdeca,_0x4d5cb9,_0x42d7f9){if(!_[_0x7437('0x3e')](_0x42d7f9)&&typeof _0x42d7f9==='string'&&!_[_0x7437('0x7e')](_0x42d7f9)){if(!_[_0x7437('0x3e')](_0x4d5cb9)&&typeof _0x4d5cb9===_0x7437('0x92')&&!_[_0x7437('0x7e')](_0x4d5cb9)){return util['format']('\x22%s\x22\x20<%s>',_0x4d5cb9,_0x42d7f9);}return util['format']('\x22%s\x22\x20<%s>',_0x42d7f9,_0x42d7f9);}if(!_['isUndefined'](_0x3fdeca)&&typeof _0x3fdeca==='string'&&!_[_0x7437('0x7e')](_0x3fdeca)){return _0x3fdeca;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x4da1b1,_0x3870d4){return function(_0x4b5762){freeVariablesPredictive(_0x3870d4);emitVoiceQueueSummary(_0x3870d4);emitCampaignSummary(_0x3870d4);loggerSyncQueueSummary['error'](_0x4da1b1,util[_0x7437('0x93')](_0x4b5762,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1e5f94,_0x5d199b){return function(_0x4f66df){loggerPredictive['error'](_0x5d199b[_0x7437('0x41')],_0x1e5f94);loggerPredictive[_0x7437('0x94')](_0x4f66df[_0x7437('0x95')]);freeVariablesPredictive(_0x5d199b);};}function loggerCatch(_0x279699){return function(_0x4f4d6c){logger[_0x7437('0x94')](_0x279699,util[_0x7437('0x93')](_0x4f4d6c,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0xed8b61){return _0xed8b61&&!_[_0x7437('0x3e')](_0xed8b61)&&_0xed8b61[_0x7437('0x96')]>0x0;}function decremetOriginate(_0x2f2055){if(!_[_0x7437('0x3e')](_0x2f2055)&&_0x2f2055!==null){if(typeof _0x2f2055[_0x7437('0x70')]!==_0x7437('0x97')){if(_0x2f2055[_0x7437('0x70')]>0x0){_0x2f2055['originated']-=0x1;}else{logger[_0x7437('0x94')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x7437('0x94')](_0x7437('0x98'));}}function checkContactLowerLimitOriginate(_0x520ec3,_0x5e9bce,_0x3fd2bc){if(_0x5e9bce>_0x3fd2bc){for(var _0x505a83=0x0;_0x505a83<_0x5e9bce-_0x3fd2bc;_0x505a83+=0x1){decremetOriginate(_0x520ec3);}}}function loggerGetContactDialer(_0x191a86,_0x5f514f,_0x222c26){return function(_0x4e6740){checkContactLowerLimitOriginate(_0x5f514f,_0x222c26,0x0);logger[_0x7437('0x94')](_0x191a86,util[_0x7437('0x93')](_0x4e6740,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2cff87){return function(_0x5db74f){if(isNotNull(_0x5db74f)&&isNotNull(_0x5db74f[0x0])){if(_0x5db74f[0x0]['contactsRescheduled']>0x0){_0x2cff87['message']='RESCHEDULED_CONTACTS';logger['info'](_0x7437('0x99')+_0x2cff87[_0x7437('0x41')],_0x5db74f[0x0][_0x7437('0x9a')],'contacts');}else{_0x2cff87['message']=_0x7437('0x9b');logger[_0x7437('0x7f')](_0x7437('0x9c')+_0x2cff87[_0x7437('0x41')]);}}};}function notSendMessagesQueue(_0x559b2e){if(_0x559b2e[_0x7437('0x9d')]){freeVariablesPredictive(_0x559b2e);if(_0x559b2e[_0x7437('0x70')]===0x0&&_0x559b2e[_0x7437('0x56')]===0x0&&_0x559b2e['waiting']===0x0&&(_0x559b2e['pTalking']||0x0)===0x0){_0x559b2e[_0x7437('0x9d')]=![];_0x559b2e[_0x7437('0x51')]=0x0;_0x559b2e['message']='NOT_ACTIVE';loggerSyncQueueSummary[_0x7437('0x94')](_0x7437('0x9e'),_0x559b2e['name'],_0x7437('0x9f'));}else{_0x559b2e[_0x7437('0x3f')]=_0x7437('0xa0');loggerSyncQueueSummary['error'](_0x7437('0x9e'),_0x559b2e[_0x7437('0x41')],_0x7437('0xa1'));}emitVoiceQueueSummary(_0x559b2e);}}function notSendMessagesCampaign(_0x508e60){if(_0x508e60[_0x7437('0x9d')]){if(_0x508e60[_0x7437('0x70')]===0x0){_0x508e60['sendMessageOneNotActive']=![];_0x508e60[_0x7437('0x3f')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x7437('0x94')](_0x7437('0xa2'),_0x508e60[_0x7437('0x41')],_0x7437('0x9f'));}else{_0x508e60[_0x7437('0x3f')]=_0x7437('0xa0');loggerSyncQueueSummary[_0x7437('0x94')](_0x7437('0xa2'),_0x508e60[_0x7437('0x41')],'is\x20disactive');}emitCampaignSummary(_0x508e60);}}function createObjHistory(_0x35764b,_0x5a1090,_0x137c58,_0x6c85f7,_0x554cf7){_0x35764b[_0x7437('0x3f')]=_0x137c58;var _0x4f5849=new Action(_0x35764b,_0x5a1090);var _0x4265c8=new History(_0x4f5849);_0x4265c8['state']=_0x6c85f7;_0x4265c8[_0x7437('0xa3')]=_0x554cf7;_0x4265c8[_0x7437('0xa4')]=_0x4f5849[_0x7437('0xa5')];return _0x4265c8;}Dialer[_0x7437('0x1e')][_0x7437('0xa6')]=function(){var _0x22ae4e=this;setInterval(function(){_0x22ae4e['clearZombieChannels'](_0x22ae4e['uniqueId'],_0x7437('0xa7'));_0x22ae4e[_0x7437('0xa8')](_0x22ae4e[_0x7437('0x29')],_0x7437('0xa9'));},0x32c8);};Dialer[_0x7437('0x1e')][_0x7437('0xa8')]=function(_0x244c03,_0x1c9b78){var _0x4afd34=this;for(var _0x2d7892 in _0x244c03){if(typeof _0x244c03[_0x2d7892]!==_0x7437('0x97')){this[_0x7437('0xaa')][_0x7437('0x1f')](function(){if(!_['isNil'](_0x244c03[_0x2d7892])){return ami['Action']({'action':_0x7437('0xab'),'channel':_0x244c03[_0x2d7892]['channel']})['catch'](function(_0x598b69){if(_0x598b69[_0x7437('0x3f')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x244c03[_0x2d7892]&&_0x244c03[_0x2d7892]['type']!=='ivr'){_0x4afd34[_0x7437('0xac')](_0x4afd34[_0x7437('0x23')][_0x244c03[_0x2d7892]['queue']]);logger['error'](_0x7437('0xad'),_0x1c9b78,_0x2d7892,_0x244c03[_0x2d7892][_0x7437('0xae')]);delete _0x244c03[_0x2d7892];}if(_0x244c03[_0x2d7892]&&_0x244c03[_0x2d7892][_0x7437('0x4f')]===_0x7437('0x7b')){_0x4afd34[_0x7437('0xac')](_0x4afd34[_0x7437('0x24')][_0x244c03[_0x2d7892][_0x7437('0xae')]]);logger[_0x7437('0x94')](_0x7437('0xaf'),_0x1c9b78,_0x2d7892,_0x244c03[_0x2d7892][_0x7437('0xae')]);delete _0x244c03[_0x2d7892];}},0x2328);}});}});}}};Dialer['prototype'][_0x7437('0xb0')]=function(_0x2bb33e){return BPromise[_0x7437('0xb1')]()['then'](cmHopper[_0x7437('0xb0')](_0x2bb33e))['catch'](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x7437('0x1e')]['checkIsBlackList']=function(_0x4d6a5a){return BPromise[_0x7437('0xb1')]()[_0x7437('0xb2')](cmHopperBlack[_0x7437('0xb3')](_0x4d6a5a))[_0x7437('0xb4')](loggerCatch(_0x7437('0xb5')));};Dialer[_0x7437('0x1e')]['checkIsBlackListIvr']=function(_0x2336ec){return BPromise[_0x7437('0xb1')]()[_0x7437('0xb2')](cmHopperBlack['checkIsBlackListIvr'](_0x2336ec))[_0x7437('0xb4')](loggerCatch(_0x7437('0xb6')));};Dialer[_0x7437('0x1e')][_0x7437('0xb7')]=function(_0x45ae15){return BPromise[_0x7437('0xb1')]()[_0x7437('0xb2')](cmHopperHistory[_0x7437('0xb8')](_0x45ae15))[_0x7437('0xb4')](loggerCatch(_0x7437('0xb9')));};Dialer['prototype']['rescheduleContact']=function(_0x39cdd9){return BPromise[_0x7437('0xb1')]()[_0x7437('0xb2')](cmHopper[_0x7437('0xba')](_0x39cdd9))[_0x7437('0xb4')](loggerCatch(_0x7437('0xbb')));};Dialer[_0x7437('0x1e')][_0x7437('0xbc')]=function(_0x268ed7,_0x44f23d,_0x554a9a){return BPromise[_0x7437('0xb1')]()[_0x7437('0xb2')](cmHopper[_0x7437('0xbc')](_0x268ed7,_0x44f23d,_0x554a9a))['catch'](loggerCatch(_0x7437('0xbd')));};Dialer[_0x7437('0x1e')][_0x7437('0xbe')]=function(_0x1dfac1,_0x4962a5,_0x5186e0,_0x29c8f9,_0x365a63){return BPromise[_0x7437('0xb1')]()['then'](cmHopper['getContactDialer'](_0x1dfac1,_0x4962a5,_0x5186e0,_0x29c8f9))[_0x7437('0xb4')](function(_0x27fed0){_0x365a63[_0x7437('0xbf')]-=_0x5186e0;_0x365a63[_0x7437('0xbf')]=_0x365a63[_0x7437('0xbf')]>0x0?_0x365a63[_0x7437('0xbf')]:0x0;loggerCatch('[getContactDialer]\x20')(_0x27fed0);});};Dialer[_0x7437('0x1e')][_0x7437('0xc0')]=function(_0xb13c,_0x55155b,_0x1f66d3,_0x57053f){return BPromise[_0x7437('0xb1')]()[_0x7437('0xb2')](cmHopper[_0x7437('0xc0')](_0xb13c,_0x55155b,_0x1f66d3))[_0x7437('0xb4')](function(_0x22b613){_0x57053f['temp']-=_0x55155b;_0x57053f['temp']=_0x57053f['temp']>0x0?_0x57053f['temp']:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x22b613);});};Dialer[_0x7437('0x1e')][_0x7437('0xc1')]=function(_0xaa8248){return BPromise[_0x7437('0xb1')]()[_0x7437('0xb2')](voiceQueueRt[_0x7437('0xc1')](_0xaa8248))[_0x7437('0xb4')](loggerCatch(_0x7437('0xc2')));};Dialer[_0x7437('0x1e')][_0x7437('0xc3')]=function(_0x3cf7da){return BPromise[_0x7437('0xb1')]()[_0x7437('0xb2')](cmHopper[_0x7437('0xc3')](_0x3cf7da))[_0x7437('0xb4')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer['prototype']['createHistory']=function(_0x47e5bb){return BPromise[_0x7437('0xb1')]()[_0x7437('0xb2')](cmHopperHistory[_0x7437('0xc4')](_0x47e5bb))[_0x7437('0xb4')](loggerCatch('[createHistory]\x20'));};Dialer[_0x7437('0x1e')]['updateOriginated']=function(_0x920a9b){if(!_[_0x7437('0x3e')](_0x920a9b)&&_0x920a9b!==null){if(typeof _0x920a9b[_0x7437('0x70')]!==_0x7437('0x97')){if(_0x920a9b[_0x7437('0x70')]>0x0){_0x920a9b[_0x7437('0x70')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x7437('0x94')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x7437('0x1e')][_0x7437('0xc5')]=function(_0xb228c2,_0x16e1d5){var _0x5deac0=this;return function(_0x181ae3){_0x5deac0[_0x7437('0xac')](_0x16e1d5);logger[_0x7437('0x94')](_0xb228c2,util[_0x7437('0x93')](_0x181ae3,{'showHidden':![],'depth':null}));};};Dialer[_0x7437('0x1e')][_0x7437('0xc6')]=function(_0x38da44,_0x59b859,_0x3d5ced){var _0x2f5ae7={'state':0x19,'statedesc':_0x7437('0xc7')};this[_0x7437('0xac')](_0x59b859);this[_0x7437('0xc8')](_[_0x7437('0x8e')](_0x2f5ae7,_[_0x7437('0xc9')](_0x3d5ced,[_0x7437('0xca'),_0x7437('0xcb'),'UserId',_0x7437('0xcc'),_0x7437('0xcd')])),_0x7437('0xce'),'[emptyContact]');logger[_0x7437('0x94')](_0x38da44);};Dialer[_0x7437('0x1e')][_0x7437('0xcf')]=function(_0x5d2c33){return _0x5d2c33==='Success';};Dialer[_0x7437('0x1e')]['isTrunkReachable']=function(_0x2434d1){return!_['isUndefined'](_0x2434d1)&&_0x2434d1&&!_[_0x7437('0x3e')](_0x2434d1[_0x7437('0x41')])&&!_[_0x7437('0x3e')](_0x2434d1['active'])&&_0x2434d1[_0x7437('0x77')]&&(this[_0x7437('0x26')][util[_0x7437('0x79')](_0x7437('0xd0'),_0x2434d1['name'])]['status']===_0x7437('0xd1')||this[_0x7437('0x26')][util[_0x7437('0x79')]('SIP/%s',_0x2434d1[_0x7437('0x41')])][_0x7437('0xab')]==='unmonitored');};Dialer[_0x7437('0x1e')][_0x7437('0xc8')]=function(_0x397fc1,_0x28df06,_0xe5b3c8){this[_0x7437('0xc4')](_0x397fc1)[_0x7437('0xb4')](loggerCatch(_0x28df06));this[_0x7437('0xc3')](_0x397fc1)[_0x7437('0xb4')](loggerCatch(_0xe5b3c8));};Dialer[_0x7437('0x1e')][_0x7437('0x3a')]=function(_0x1ae7a4){var _0x2d2179=this[_0x7437('0xd2')][_0x1ae7a4[_0x7437('0xd3')]];var _0x2300db;if(!_['isNil'](_0x1ae7a4)&&!_[_0x7437('0xd4')](_0x1ae7a4[_0x7437('0xd5')])&&!_['isNil'](_0x1ae7a4['variable'][_0x7437('0xd6')])&&_0x1ae7a4[_0x7437('0xd7')]===_0x7437('0xd8')&&_0x2d2179){if(_0x2d2179[_0x7437('0x4f')]!==_0x7437('0x7b')&&this[_0x7437('0x23')][_0x2d2179[_0x7437('0xae')]][_0x7437('0xd9')]&&_0x1ae7a4[_0x7437('0xda')]===_0x7437('0xdb')){delete this['uniqueId'][_0x1ae7a4[_0x7437('0xd3')]];this[_0x7437('0xac')](this[_0x7437('0x23')][_0x2d2179[_0x7437('0xae')]]);this[_0x7437('0x23')][_0x2d2179['queue']][_0x7437('0x5d')]+=0x1;this['voiceQueues'][_0x2d2179[_0x7437('0xae')]][_0x7437('0xdc')]+=0x1;_0x2300db=new Hangup(_0x2d2179,_0x1ae7a4);_0x2300db[_0x7437('0xdd')]=0x12;_0x2300db[_0x7437('0xa3')]=_0x7437('0xde');_0x2300db[_0x7437('0xdf')]=_0x7437('0xe0');ami[_0x7437('0x4e')](_0x7437('0xe1'),ut[_0x7437('0xe2')](_0x2300db,_0x7437('0xe3')));this['saveInDb'](_0x2300db,_0x7437('0xe4'),_0x7437('0xe5'));}if(_0x2d2179[_0x7437('0x4f')]!==_0x7437('0x7b')&&this[_0x7437('0x23')][_0x2d2179['queue']][_0x7437('0xd9')]&&_0x1ae7a4[_0x7437('0xda')]===_0x7437('0xe6')){var _0xda8e06=this;return new BPromise(function(_0x485cf3,_0x366835){delete _0xda8e06[_0x7437('0xd2')][_0x1ae7a4[_0x7437('0xd3')]];_0xda8e06['updateOriginated'](_0xda8e06[_0x7437('0x23')][_0x2d2179[_0x7437('0xae')]]);_0xda8e06[_0x7437('0x23')][_0x2d2179['queue']][_0x7437('0x5d')]+=0x1;_0xda8e06[_0x7437('0x23')][_0x2d2179[_0x7437('0xae')]][_0x7437('0xdc')]+=0x1;var _0xf65a9e=_0xda8e06['voiceQueues'][_0x2d2179['queue']];var _0x13d9e0=new Hangup(_0x2d2179,_0x1ae7a4);_0x13d9e0[_0x7437('0xdd')]=0x13;_0x13d9e0[_0x7437('0xa3')]=_0x7437('0xe7');_0x13d9e0[_0x7437('0xdf')]=_0x7437('0xe0');_0x13d9e0[_0x7437('0xe8')]+=0x1;_0x13d9e0[_0x7437('0xe9')]+=0x1;_0x13d9e0['amd']=!![];ami[_0x7437('0x4e')](_0x7437('0xe1'),ut['buildObj'](_0x13d9e0,_0x7437('0xe3')));_0xda8e06['createHistory'](_0x13d9e0)[_0x7437('0xb4')](loggerCatch(_0x7437('0xea')));if(_0x13d9e0['countbusyretry']+_0x13d9e0['countcongestionretry']+_0x13d9e0[_0x7437('0xeb')]+_0x13d9e0[_0x7437('0xec')]+_0x13d9e0['countdropretry']+_0x13d9e0[_0x7437('0xed')]+_0x13d9e0[_0x7437('0xe8')]+_0x13d9e0[_0x7437('0xee')]>=_0xf65a9e[_0x7437('0xef')]){_0xda8e06[_0x7437('0xf0')](_0x13d9e0,_0x485cf3,_0x366835,_0x7437('0xf1'));}else{if(_0x13d9e0[_0x7437('0xe8')]>=_0xf65a9e['dialMachineMaxRetry']){_0xda8e06[_0x7437('0xf2')](_0x13d9e0,_0x485cf3,_0x366835,'reason\x2019\x20machine....');}else{_0xda8e06[_0x7437('0xba')]({'active':![],'countmachineretry':_0x13d9e0[_0x7437('0xe8')],'scheduledat':moment()[_0x7437('0xf3')](_0xf65a9e[_0x7437('0xf4')],_0x7437('0xf5'))['format'](_0x7437('0xf6')),'ContactId':_0x13d9e0[_0x7437('0xca')],'ListId':_0x13d9e0[_0x7437('0xcb')],'VoiceQueueId':_0x13d9e0[_0x7437('0xcc')]||undefined,'CampaignId':_0x13d9e0[_0x7437('0xcd')]||undefined})[_0x7437('0xb4')](loggerCatch(_0x7437('0xf7')));_0x485cf3({'reschedule':0x1});}}});}if(_0x2d2179[_0x7437('0x4f')]===_0x7437('0x7b')&&this[_0x7437('0x24')][_0x2d2179[_0x7437('0xae')]][_0x7437('0xd9')]&&_0x1ae7a4['value']==='HANGUP'){delete this[_0x7437('0xd2')][_0x1ae7a4[_0x7437('0xd3')]];this[_0x7437('0xac')](this['campaigns'][_0x2d2179[_0x7437('0xae')]]);_0x2300db=new Hangup(_0x2d2179,_0x1ae7a4);_0x2300db['state']=0x12;_0x2300db[_0x7437('0xa3')]=_0x7437('0xde');_0x2300db[_0x7437('0xdf')]='AMD';ami[_0x7437('0x4e')]('custom:amd',ut[_0x7437('0xe2')](_0x2300db,_0x7437('0xe3')));this[_0x7437('0xc8')](_0x2300db,'[syncHangupInAMDIvr][createHistory]',_0x7437('0xf8'));}if(_0x2d2179[_0x7437('0x4f')]===_0x7437('0x7b')&&this['campaigns'][_0x2d2179[_0x7437('0xae')]]['dialAMDActive']&&_0x1ae7a4[_0x7437('0xda')]==='MACHINE'){var _0xda8e06=this;return new BPromise(function(_0x2ad1d5,_0x9d4b04){delete _0xda8e06[_0x7437('0xd2')][_0x1ae7a4[_0x7437('0xd3')]];_0xda8e06[_0x7437('0xac')](_0xda8e06[_0x7437('0x24')][_0x2d2179[_0x7437('0xae')]]);_0xda8e06[_0x7437('0x24')][_0x2d2179[_0x7437('0xae')]][_0x7437('0x5d')]+=0x1;_0xda8e06[_0x7437('0x24')][_0x2d2179[_0x7437('0xae')]]['outboundAnswerAgiCallsDay']+=0x1;var _0xf1dacc=_0xda8e06[_0x7437('0x24')][_0x2d2179['queue']];var _0x1553b0=new Hangup(_0x2d2179,_0x1ae7a4);_0x1553b0['state']=0x13;_0x1553b0[_0x7437('0xa3')]='Machine';_0x1553b0[_0x7437('0xdf')]=_0x7437('0xe0');_0x1553b0[_0x7437('0xe8')]+=0x1;_0x1553b0['countglobal']+=0x1;_0x1553b0[_0x7437('0xe3')]=!![];ami['emit'](_0x7437('0xe1'),ut[_0x7437('0xe2')](_0x1553b0,_0x7437('0xe3')));_0xda8e06['createHistory'](_0x1553b0)[_0x7437('0xb4')](loggerCatch(_0x7437('0xea')));if(_0x1553b0['countbusyretry']+_0x1553b0[_0x7437('0xf9')]+_0x1553b0[_0x7437('0xeb')]+_0x1553b0[_0x7437('0xec')]+_0x1553b0[_0x7437('0xfa')]+_0x1553b0['countabandonedretry']+_0x1553b0[_0x7437('0xe8')]+_0x1553b0[_0x7437('0xee')]>=_0xf1dacc[_0x7437('0xef')]){_0xda8e06[_0x7437('0xf0')](_0x1553b0,_0x2ad1d5,_0x9d4b04,'reason19\x20machine....');}else{if(_0x1553b0[_0x7437('0xe8')]>=_0xf1dacc[_0x7437('0xfb')]){_0xda8e06[_0x7437('0xf2')](_0x1553b0,_0x2ad1d5,_0x9d4b04,'reason\x2019\x20machine....');}else{_0xda8e06[_0x7437('0xba')]({'active':![],'countmachineretry':_0x1553b0['countmachineretry'],'scheduledat':moment()[_0x7437('0xf3')](_0xf1dacc['dialMachineRetryFrequency'],_0x7437('0xf5'))[_0x7437('0x79')](_0x7437('0xf6')),'ContactId':_0x1553b0[_0x7437('0xca')],'ListId':_0x1553b0['ListId'],'VoiceQueueId':_0x1553b0['VoiceQueueId']||undefined,'CampaignId':_0x1553b0[_0x7437('0xcd')]||undefined})['catch'](loggerCatch(_0x7437('0xf7')));_0x2ad1d5({'reschedule':0x1});}}});}}};Dialer['prototype']['syncHangup']=function(_0x41f5cd){var _0x187772=this[_0x7437('0xd2')][_0x41f5cd[_0x7437('0xd3')]];var _0x1d1b71=this;var _0x41cdfd;if(_0x187772&&_0x187772[_0x7437('0x4f')]==='ivr'){delete this[_0x7437('0xd2')][_0x41f5cd['uniqueid']];this[_0x7437('0xac')](this['campaigns'][_0x187772[_0x7437('0xae')]]);this[_0x7437('0x24')][_0x187772[_0x7437('0xae')]][_0x7437('0xfc')]+=0x1;_0x41cdfd=new Hangup(_0x187772,_0x41f5cd);this['createHistory'](_0x41cdfd)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x7437('0xc3')](_0x41cdfd)[_0x7437('0xb4')](loggerCatch('[syncHangupIvr]'));}if(_0x187772&&_0x187772[_0x7437('0x4f')]!==_0x7437('0x7b')&&isNotNull(this[_0x7437('0x23')][_0x187772[_0x7437('0xae')]][_0x7437('0xfd')])){delete this[_0x7437('0xd2')][_0x41f5cd[_0x7437('0xd3')]];this[_0x7437('0xac')](this[_0x7437('0x23')][_0x187772[_0x7437('0xae')]]);this['voiceQueues'][_0x187772[_0x7437('0xae')]][_0x7437('0x5d')]+=0x1;this[_0x7437('0x23')][_0x187772[_0x7437('0xae')]][_0x7437('0xdc')]+=0x1;_0x41cdfd=new Hangup(_0x187772,_0x41f5cd);_0x41cdfd['state']=0x10;_0x41cdfd[_0x7437('0xa3')]='AnswerAGI';_0x41cdfd[_0x7437('0xdf')]=_0x7437('0xfe');this[_0x7437('0xc4')](_0x41cdfd)['catch'](loggerCatch(_0x7437('0xff')));this['moveContactManagedDialer'](_0x41cdfd)[_0x7437('0xb4')](loggerCatch(_0x7437('0x100')));}if(_0x187772&&_0x187772[_0x7437('0x4f')]!==_0x7437('0x7b')&&!isNotNull(this[_0x7437('0x23')][_0x187772[_0x7437('0xae')]][_0x7437('0xfd')])){delete this[_0x7437('0xd2')][_0x41f5cd[_0x7437('0xd3')]];this[_0x7437('0xac')](this['voiceQueues'][_0x187772[_0x7437('0xae')]]);this['voiceQueues'][_0x187772[_0x7437('0xae')]]['outboundUnknownCallsDay']+=0x1;_0x41cdfd=new Hangup(_0x187772,_0x41f5cd);_0x41cdfd['state']=0xc;_0x41cdfd[_0x7437('0xa3')]=_0x41f5cd[_0x7437('0x101')];_0x41cdfd[_0x7437('0xdf')]='Unknow';this[_0x7437('0xc4')](_0x41cdfd)[_0x7437('0xb4')](loggerCatch(_0x7437('0xff')));this[_0x7437('0xc3')](_0x41cdfd)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x7437('0x1e')]['syncAgentComplete']=function(_0x36aa3d){var _0x24af1c=this['uniqueId'][_0x36aa3d['uniqueid']];var _0xf7cd8d=this;if(this[_0x7437('0x23')][_0x36aa3d[_0x7437('0xae')]]){if(_0x24af1c&&_0x24af1c[_0x7437('0x4f')]!==_0x7437('0x7b')){delete this[_0x7437('0xd2')][_0x36aa3d[_0x7437('0xd3')]];this[_0x7437('0x23')][_0x36aa3d[_0x7437('0xae')]][_0x7437('0x5d')]+=0x1;var _0x3d169a=new AgentComplete(_0x24af1c,_0x36aa3d);if(_0x36aa3d[_0x7437('0x102')]===_0x7437('0x103')){_0x3d169a[_0x7437('0x104')]=this[_0x7437('0x23')][_0x36aa3d[_0x7437('0xae')]][_0x7437('0x105')]&&this[_0x7437('0x23')][_0x36aa3d['queue']]['dialAgiAfterHangupAgent']?moment()[_0x7437('0x79')](_0x7437('0xf6')):undefined;}this[_0x7437('0xc4')](_0x3d169a)[_0x7437('0xb4')](loggerCatch(_0x7437('0x106')));this[_0x7437('0xc3')](_0x3d169a)[_0x7437('0xb4')](loggerCatch(_0x7437('0x107')));}}};Dialer[_0x7437('0x1e')]['syncAgentConnect']=function(_0x1a392b){if(this[_0x7437('0x23')][_0x1a392b[_0x7437('0xae')]]){if(this['uniqueId'][_0x1a392b[_0x7437('0xd3')]]&&this[_0x7437('0xd2')][_0x1a392b['uniqueid']][_0x7437('0x4f')]!==_0x7437('0x7b')){this['updateOriginated'](this['voiceQueues'][_0x1a392b[_0x7437('0xae')]]);this['uniqueId'][_0x1a392b[_0x7437('0xd3')]][_0x7437('0x108')]=moment()[_0x7437('0x79')](_0x7437('0xf6'));}}};Dialer['prototype'][_0x7437('0x109')]=function(_0x2269cd){this['createHistory'](_0x2269cd)['catch'](loggerCatch(_0x7437('0x106')));this['moveContactManagedDialer'](_0x2269cd)['catch'](loggerCatch(_0x7437('0x10a')));};Dialer[_0x7437('0x1e')][_0x7437('0x33')]=function(_0x3c004e){var _0x249022=this[_0x7437('0xd2')][_0x3c004e[_0x7437('0xd3')]];var _0x5c0f00=this;if(this[_0x7437('0x23')][_0x3c004e[_0x7437('0xae')]]){if(_0x249022&&_0x249022[_0x7437('0x4f')]!=='ivr'){delete this[_0x7437('0xd2')][_0x3c004e[_0x7437('0xd3')]];this[_0x7437('0xac')](this[_0x7437('0x23')][_0x3c004e[_0x7437('0xae')]]);_0x249022[_0x7437('0x10b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x16ca6f=new QueueCallerAbandon(_0x249022,_0x3c004e);if(getSeconds(_0x249022[_0x7437('0x10b')],_0x249022['responsetime'])>=_0x249022[_0x7437('0x10c')]){this[_0x7437('0x23')][_0x3c004e[_0x7437('0xae')]][_0x7437('0x69')]+=0x1;this[_0x7437('0x23')][_0x3c004e[_0x7437('0xae')]][_0x7437('0x10d')]+=0x1;this[_0x7437('0x23')][_0x3c004e['queue']][_0x7437('0x6b')]+=0x1;_0x16ca6f['state']=0xa;_0x16ca6f[_0x7437('0xa3')]=_0x7437('0x10e');_0x16ca6f[_0x7437('0x10f')]=_0x7437('0x110');_0x16ca6f[_0x7437('0x104')]=this[_0x7437('0x23')][_0x3c004e[_0x7437('0xae')]]['dialQueueProject2']?moment()[_0x7437('0x79')](_0x7437('0xf6')):undefined;_0x16ca6f[_0x7437('0xfa')]+=0x1;_0x16ca6f[_0x7437('0xe9')]+=0x1;if(_0x16ca6f[_0x7437('0xfa')]>=this[_0x7437('0x23')][_0x3c004e[_0x7437('0xae')]][_0x7437('0x111')]){this[_0x7437('0x109')](_0x16ca6f);}else{this[_0x7437('0xba')]({'active':![],'countdropretry':_0x16ca6f['countdropretry'],'scheduledat':moment()[_0x7437('0xf3')](this[_0x7437('0x23')][_0x3c004e[_0x7437('0xae')]][_0x7437('0x112')],_0x7437('0xf5'))[_0x7437('0x79')](_0x7437('0xf6')),'ContactId':_0x249022[_0x7437('0xca')],'ListId':_0x249022[_0x7437('0xcb')],'VoiceQueueId':_0x249022['VoiceQueueId']||undefined,'CampaignId':_0x249022[_0x7437('0xcd')]||undefined})[_0x7437('0xb4')](loggerCatch(_0x7437('0x113')));var _0x40777a=new History(_0x16ca6f);_0x40777a[_0x7437('0xdd')]=0xa;_0x40777a['statedesc']='Drop';_0x40777a[_0x7437('0xa5')]=moment()['format'](_0x7437('0xf6'));_0x40777a[_0x7437('0xa4')]=_0x40777a[_0x7437('0xa5')];_0x40777a[_0x7437('0x114')]=_0x16ca6f[_0x7437('0x114')];_0x40777a['calleridnum']=_0x16ca6f[_0x7437('0x115')];this[_0x7437('0xc4')](_0x40777a)[_0x7437('0xb4')](loggerCatch(_0x7437('0x116')));}}else{this[_0x7437('0x23')][_0x3c004e[_0x7437('0xae')]][_0x7437('0x68')]+=0x1;this[_0x7437('0x23')][_0x3c004e['queue']][_0x7437('0x61')]+=0x1;_0x16ca6f[_0x7437('0xdd')]=0xb;_0x16ca6f['statedesc']=_0x7437('0x117');_0x16ca6f['dropreason']=_0x7437('0x118');_0x16ca6f[_0x7437('0xed')]+=0x1;_0x16ca6f[_0x7437('0xe9')]+=0x1;if(_0x16ca6f['countabandonedretry']>=this[_0x7437('0x23')][_0x3c004e[_0x7437('0xae')]][_0x7437('0x119')]){this[_0x7437('0x109')](_0x16ca6f);}else{this[_0x7437('0xba')]({'active':![],'countabandonedretry':_0x16ca6f[_0x7437('0xed')],'scheduledat':moment()['add'](this['voiceQueues'][_0x3c004e[_0x7437('0xae')]][_0x7437('0x11a')],_0x7437('0xf5'))[_0x7437('0x79')](_0x7437('0xf6')),'ContactId':_0x249022[_0x7437('0xca')],'ListId':_0x249022[_0x7437('0xcb')],'VoiceQueueId':_0x249022[_0x7437('0xcc')]||undefined,'CampaignId':_0x249022[_0x7437('0xcd')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));var _0x40777a=new History(_0x16ca6f);_0x40777a[_0x7437('0xdd')]=0xb;_0x40777a['statedesc']=_0x7437('0x117');_0x40777a[_0x7437('0xa5')]=moment()[_0x7437('0x79')](_0x7437('0xf6'));_0x40777a[_0x7437('0xa4')]=_0x40777a[_0x7437('0xa5')];_0x40777a[_0x7437('0x114')]=_0x16ca6f[_0x7437('0x114')];_0x40777a[_0x7437('0x115')]=_0x16ca6f[_0x7437('0x115')];this[_0x7437('0xc4')](_0x40777a)[_0x7437('0xb4')](loggerCatch(_0x7437('0x11b')));}}}}};Dialer[_0x7437('0x1e')]['syncNewExten']=function(_0x583c63){if(this[_0x7437('0x29')][_0x583c63[_0x7437('0xd3')]]){this[_0x7437('0x29')][_0x583c63[_0x7437('0xd3')]]['channel']=_0x583c63[_0x7437('0x11c')];}if(this[_0x7437('0xd2')][_0x583c63[_0x7437('0xd3')]]){this[_0x7437('0xd2')][_0x583c63[_0x7437('0xd3')]]['channel']=_0x583c63[_0x7437('0x11c')];}};Dialer[_0x7437('0x1e')][_0x7437('0x11d')]=function(_0x4bfab6){if(strategy[this[_0x7437('0x23')][this[_0x7437('0x29')][_0x4bfab6['actionid']][_0x7437('0xae')]][_0x7437('0x11e')]]===_0x7437('0x11f')){if(this[_0x7437('0x29')][_0x4bfab6[_0x7437('0x120')]]&&_[_0x7437('0xd4')](this[_0x7437('0x29')][_0x4bfab6[_0x7437('0x120')]]['locked'])&&_0x4bfab6[_0x7437('0xab')]==='1'&&_0x4bfab6['paused']==='0'){if(this['agents'][_0x4bfab6[_0x7437('0x121')]]){if(!this[_0x7437('0x25')][_0x4bfab6[_0x7437('0x121')]][_0x7437('0x122')]){this[_0x7437('0x25')][_0x4bfab6[_0x7437('0x121')]][_0x7437('0x122')]=!![];this[_0x7437('0x29')][_0x4bfab6[_0x7437('0x120')]][_0x7437('0x122')]=!![];this[_0x7437('0x29')][_0x4bfab6['actionid']][_0x7437('0x121')]=_0x4bfab6[_0x7437('0x121')];}}}}else if((strategy[this[_0x7437('0x23')][this[_0x7437('0x29')][_0x4bfab6[_0x7437('0x120')]]['queue']][_0x7437('0x11e')]]||_0x7437('0x123'))===_0x7437('0x123')){if(this[_0x7437('0x29')][_0x4bfab6[_0x7437('0x120')]]){if(this['agents'][_0x4bfab6['stateinterface']]){this[_0x7437('0x29')][_0x4bfab6[_0x7437('0x120')]][_0x7437('0x121')]=_0x4bfab6['stateinterface'];if(_[_0x7437('0xd4')](this[_0x7437('0x2d')][this[_0x7437('0x29')][_0x4bfab6[_0x7437('0x120')]][_0x7437('0xae')]])){this[_0x7437('0x2d')][this['actions'][_0x4bfab6['actionid']][_0x7437('0xae')]]=[];}this[_0x7437('0x2d')][this['actions'][_0x4bfab6[_0x7437('0x120')]][_0x7437('0xae')]][_0x7437('0x124')](_[_0x7437('0x8e')](_[_0x7437('0xc9')](this['actions'][_0x4bfab6[_0x7437('0x120')]],[_0x7437('0x125'),_0x7437('0x121')]),{'status':_0x4bfab6[_0x7437('0xab')],'paused':_0x4bfab6[_0x7437('0x126')]}));}}}};function unlockQueueStatus(_0x406e2a,_0x3add2b){setTimeout(function(){if(_['isUndefined'](_0x406e2a[_0x7437('0x127')])){loggerBooked['error'](_0x7437('0x128'),_0x3add2b);}_0x406e2a[_0x7437('0x127')]=!![];loggerBooked['info'](_0x7437('0x129'),_0x3add2b,JSON[_0x7437('0x4a')](_[_0x7437('0xc9')](_0x406e2a,[_0x7437('0x41'),_0x7437('0x127')])));},0x1f3);}Dialer[_0x7437('0x1e')][_0x7437('0x12a')]=function(_0x334631){var _0xcb438d=this;var _0x56f52b=_0xcb438d['voiceQueues'][_0xcb438d[_0x7437('0x29')][_0x334631[_0x7437('0x120')]]['queue']];if(strategy[this[_0x7437('0x23')][this['actions'][_0x334631['actionid']][_0x7437('0xae')]][_0x7437('0x11e')]]==='roundrobin'){if(this['actions'][_0x334631['actionid']]&&this[_0x7437('0x29')][_0x334631['actionid']]['stateinterface']){this['preview'][_0x7437('0x12b')](this[_0x7437('0x29')][_0x334631[_0x7437('0x120')]][_0x7437('0x125')],this[_0x7437('0x29')][_0x334631[_0x7437('0x120')]][_0x7437('0x121')])['catch'](function(_0x2ba146){logger['error']('[Catch][Preview][syncQueueStatusComplete]',util[_0x7437('0x93')](_0x2ba146,{'showHidden':![],'depth':null}));})[_0x7437('0x21')](function(){_0xcb438d[_0x7437('0xac')](_0xcb438d[_0x7437('0x23')][_0xcb438d['actions'][_0x334631['actionid']][_0x7437('0xae')]]);_0xcb438d['agents'][_0xcb438d[_0x7437('0x29')][_0x334631[_0x7437('0x120')]][_0x7437('0x121')]][_0x7437('0x122')]=![];delete _0xcb438d[_0x7437('0x29')][_0x334631[_0x7437('0x120')]];unlockQueueStatus(_0x56f52b);});}else{this[_0x7437('0xac')](this['voiceQueues'][this[_0x7437('0x29')][_0x334631[_0x7437('0x120')]][_0x7437('0xae')]]);this[_0x7437('0xba')]({'active':![],'ContactId':this['actions'][_0x334631[_0x7437('0x120')]]['ContactId'],'ListId':this[_0x7437('0x29')][_0x334631[_0x7437('0x120')]]['ListId'],'VoiceQueueId':this[_0x7437('0x29')][_0x334631[_0x7437('0x120')]][_0x7437('0xcc')]||undefined,'CampaignId':this[_0x7437('0x29')][_0x334631[_0x7437('0x120')]][_0x7437('0xcd')]||undefined})[_0x7437('0xb4')](loggerCatch(_0x7437('0x12c')));delete this['actions'][_0x334631[_0x7437('0x120')]];unlockQueueStatus(_0x56f52b);}}else if((strategy[this[_0x7437('0x23')][this[_0x7437('0x29')][_0x334631['actionid']][_0x7437('0xae')]][_0x7437('0x11e')]]||_0x7437('0x123'))===_0x7437('0x123')){var _0x58a9c9;if(this[_0x7437('0x29')][_0x334631[_0x7437('0x120')]]&&!_[_0x7437('0x7e')](this[_0x7437('0x2d')][this['actions'][_0x334631[_0x7437('0x120')]][_0x7437('0xae')]])){if(this[_0x7437('0x2e')][_0xcb438d[_0x7437('0x29')][_0x334631[_0x7437('0x120')]][_0x7437('0xae')]]){this[_0x7437('0x2e')][_0xcb438d[_0x7437('0x29')][_0x334631[_0x7437('0x120')]]['queue']]=this[_0x7437('0x2e')][this[_0x7437('0x29')][_0x334631[_0x7437('0x120')]]['queue']]?this[_0x7437('0x2e')][this[_0x7437('0x29')][_0x334631['actionid']][_0x7437('0xae')]]:this[_0x7437('0x2d')][this['actions'][_0x334631[_0x7437('0x120')]]['queue']]?this[_0x7437('0x2d')][this['actions'][_0x334631[_0x7437('0x120')]][_0x7437('0xae')]][_0x7437('0x12d')]||0x0:0x0;}this[_0x7437('0x2d')][this['actions'][_0x334631[_0x7437('0x120')]][_0x7437('0xae')]]['_rr']=this[_0x7437('0x2e')][this['actions'][_0x334631[_0x7437('0x120')]]['queue']];for(var _0x5ac28c=0x0;_0x5ac28c=0x0;})[_0x7437('0xb4')](myreject(_0x5e05fa)));}}else{_0x590c77[_0x7437('0x124')](ami[_0x7437('0x148')]({'action':'command','command':util[_0x7437('0x79')](_0x7437('0x14c'),_0xdc10d6,!_[_0x7437('0x3e')](config[_0x7437('0x144')][_0x1b9e80])?_0x1b9e80:'')})[_0x7437('0xb2')](function(_0x5dcaa3){return _0x5dcaa3[_0x7437('0x14d')][_0x7437('0x14b')]('true')>=0x0;})[_0x7437('0xb4')](myreject(_0x5e05fa)));}BPromise['all'](_0x590c77)[_0x7437('0xb2')](function(_0x38358e){var _0x4d5fa5=_[_0x7437('0x14e')](_0x38358e);if(_0x4d5fa5){return _0x37b71c(_0x4d5fa5);}else{_0x405450['message']=_0x591cd0?_0x7437('0x14f'):_0x7437('0x150');return _0x5e05fa(msgResponse(_0x7437('0x151'),_0x7437('0x141'),'Global:\x20'+_0x591cd0+'\x20'+_0x28c52a+_0x7437('0x152')+util[_0x7437('0x93')](_0xdc10d6,{'showHidden':![],'depth':null})+_0x7437('0x153')+_0x1b9e80));}})[_0x7437('0xb4')](function(_0x55ecef){return _0x5e05fa(msgResponse('ifTime',_0x7437('0x141'),JSON['stringify'](_0x55ecef)));});});};Dialer[_0x7437('0x1e')]['checkDialMethod']=function(_0x17fbc3){var _0x599b7d=this;return function(){switch(_0x17fbc3[_0x7437('0x59')]){case _0x7437('0x154'):freeVariablesPredictive(_0x17fbc3);_0x599b7d[_0x7437('0x155')](_0x17fbc3,0x1);break;case'power':freeVariablesPredictive(_0x17fbc3);_0x599b7d[_0x7437('0x155')](_0x17fbc3,_0x17fbc3[_0x7437('0x156')]);break;case _0x7437('0xa'):_0x599b7d[_0x7437('0xa')](_0x17fbc3);break;case'booked':freeVariablesPredictive(_0x17fbc3);_0x599b7d[_0x7437('0x155')](_0x17fbc3,0x1);break;default:freeVariablesPredictive(_0x17fbc3);logger['error']('Queue',_0x17fbc3[_0x7437('0x41')],_0x7437('0x157'));}};};Dialer['prototype'][_0x7437('0x158')]=function(_0x4ae87d){return BPromise[_0x7437('0xb1')]()['then'](cmHopper['handlePreviewRecallNotifications'](_0x4ae87d['id'],previewRecallmeReminderInterval))[_0x7437('0xb2')](function(_0x1642a1){for(var _0x2a5dea=0x0;_0x2a5dea<_0x1642a1[_0x7437('0x96')];_0x2a5dea++){var _0x3d855a=_0x1642a1[_0x2a5dea][_0x7437('0x159')]['name'];if(_0x3d855a)io['to'](util['format'](_0x7437('0x15a'),_0x3d855a))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x1642a1[_0x2a5dea]});}})['catch'](function(_0x2ee9d6){});};Dialer[_0x7437('0x1e')]['launchHandleIvr']=function(_0x4a7a79){var _0x2e8f4c=this;return function(){_0x2e8f4c['handleIvr'](_0x4a7a79);};};Dialer[_0x7437('0x1e')]['syncQueueSummary']=function(_0x44da62){var _0x7f41d2=this;if(isNotPreview(_0x44da62[_0x7437('0x59')])){if(isVoiceQueueOutbound(_0x44da62[_0x7437('0x4f')])&&isActive(_0x44da62[_0x7437('0x15b')])){_0x44da62[_0x7437('0x9d')]=!![];BPromise[_0x7437('0xb1')]()[_0x7437('0xb2')](checkIsLoggedIn(_0x44da62,_0x44da62['loggedIn']))[_0x7437('0xb2')](checkIsActive(_0x44da62,_0x44da62[_0x7437('0x15b')]))['then'](checkInterval(_0x44da62))[_0x7437('0xb2')](_0x7f41d2['checkIsTrunkReachable'](_0x44da62))['then'](_0x7f41d2['checkIfTime'](_0x44da62['dialGlobalInterval'],_0x44da62['dialTimezone'],_0x44da62[_0x7437('0x41')],_0x44da62))[_0x7437('0xb2')](_0x7f41d2[_0x7437('0x140')](_0x44da62[_0x7437('0x46')],_0x44da62[_0x7437('0x15c')],_0x44da62[_0x7437('0x41')],_0x44da62))[_0x7437('0xb2')](_0x7f41d2['checkDialMethod'](_0x44da62))[_0x7437('0xb4')](loggerCatchQueueSummary('[syncQueueSummary]',_0x44da62));}else{notSendMessagesQueue(_0x44da62);}}else{freeVariablesPredictive(_0x44da62);if(_0x44da62[_0x7437('0x15d')]){_0x7f41d2[_0x7437('0x158')](_0x44da62);}}};Dialer[_0x7437('0x1e')][_0x7437('0x139')]=function(){var _0x2181b1=this;var _0x1bb817;for(var _0x526fb4 in this['campaigns']){if(typeof this['campaigns'][_0x526fb4]!=='undefined'){_0x1bb817=this['campaigns'][_0x526fb4];if(isCampaignIvr(_0x1bb817[_0x7437('0x4f')])&&isActive(_0x1bb817[_0x7437('0x77')])){_0x1bb817[_0x7437('0x9d')]=!![];BPromise[_0x7437('0xb1')]()[_0x7437('0xb2')](checkIsActive(_0x1bb817,_0x1bb817[_0x7437('0x77')]))[_0x7437('0xb2')](checkInterval(_0x1bb817))[_0x7437('0xb2')](_0x2181b1[_0x7437('0x13a')](_0x1bb817))[_0x7437('0xb2')](_0x2181b1['checkIfTime'](_0x1bb817[_0x7437('0x15e')],_0x1bb817[_0x7437('0x15c')],_0x1bb817[_0x7437('0x41')],_0x1bb817))[_0x7437('0xb2')](_0x2181b1[_0x7437('0x140')](_0x1bb817[_0x7437('0x46')],_0x1bb817['dialTimezone'],_0x1bb817[_0x7437('0x41')],_0x1bb817))[_0x7437('0xb2')](_0x2181b1[_0x7437('0x15f')](_0x1bb817))[_0x7437('0xb4')](loggerCatchQueueSummary('[syncCampaigns]',_0x1bb817));}else{notSendMessagesCampaign(_0x1bb817);}}}};function getCallerIdRandom(_0x3a630d,_0x3c54ca){var _0x1b0295;var _0x272034;var _0x9a0de5;if(_0x3c54ca<=0x0){_0x3c54ca=0x1;}_0x1b0295=new RegExp('\x5cw{0,'+_0x3c54ca+'}$');_0x272034=Math['pow'](0xa,_0x3c54ca-0x1);_0x9a0de5=Math[_0x7437('0x160')](0xa,_0x3c54ca)-0x1;return util[_0x7437('0x79')]('%s',_[_0x7437('0x161')](_0x3a630d,_0x1b0295,_[_0x7437('0x162')](_0x272034,_0x9a0de5)));}function extractCalleridName(_0x155203){var _0xeb22b6=_0x155203[_0x7437('0x163')](/"(.*?)"/);return _0xeb22b6?_0xeb22b6[0x1]:_0x155203;}function extractCalleridNumber(_0x355f49){var _0x320c23=_0x355f49[_0x7437('0x163')](/<(.*?)>/);return _0x320c23?_0x320c23[0x1]:_0x355f49;}Dialer[_0x7437('0x1e')][_0x7437('0x164')]=function(_0x3087f9,_0x13c153){var _0x3f1d25=this;var _0x2d3803=uuid['v4']();this[_0x7437('0x29')][_0x2d3803]=new Action(_0x3087f9,_0x13c153,_0x2d3803);return new BPromise(function(_0x8cb869,_0x5d8104){if(_[_0x7437('0x3e')](_0x3087f9)&&typeof _0x3087f9!=='object'){return _0x5d8104(msgResponse('originate',_0x7437('0x141'),'voiceQueue\x20is\x20undefine'));}if(_[_0x7437('0x3e')](_0x13c153[_0x7437('0x165')][_0x7437('0x166')])||_0x13c153[_0x7437('0x165')]['phone']===null){return _0x5d8104(msgResponse(_0x7437('0x167'),_0x7437('0x141'),'contact\x20is\x20undefine'));}var _0x35379b={'XMD-CALLERID':_0x3f1d25['actions'][_0x2d3803][_0x7437('0x168')](),'XMD-AGI':_0x3087f9[_0x7437('0xfd')]?util[_0x7437('0x79')](_0x7437('0x169'),ipAgi,_0x3087f9['dialQueueProject']):_0x7437('0x16a'),'XMD-AGIAFTER':_0x3087f9[_0x7437('0x105')]?util[_0x7437('0x79')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3087f9['dialQueueProject2']):_0x7437('0x16a'),'XMD-QUEUE':_0x3087f9[_0x7437('0x4f')]===_0x7437('0x16b')?util[_0x7437('0x79')](_0x7437('0x16c'),_0x3087f9[_0x7437('0x41')],_0x3087f9['dialQueueOptions']||'',_0x3087f9[_0x7437('0x16d')]?'c':'',_0x3087f9[_0x7437('0x10c')]||0x3):_0x7437('0x16a'),'XMD-CONTACTID':_0x13c153[_0x7437('0xca')],'XMD-CDRTYPE':_0x7437('0x9'),'CALLERID(all)':_0x3f1d25[_0x7437('0x29')][_0x2d3803][_0x7437('0x168')](),'XMD-AMD':_0x3087f9[_0x7437('0xd9')]?_0x7437('0x16e'):_0x7437('0x16a'),'XMD-DESTINATION':_0x7437('0xd8')};if(_0x3087f9[_0x7437('0xd9')]){_0x35379b[_0x7437('0x16f')]=_0x3087f9['dialAMDInitialSilence']||0x9c4;_0x35379b[_0x7437('0x170')]=_0x3087f9[_0x7437('0x171')]||0x5dc;_0x35379b[_0x7437('0x172')]=_0x3087f9[_0x7437('0x173')]||0x320;_0x35379b['XMD-AMDTOTALANALYSISTIME']=_0x3087f9[_0x7437('0x174')]||0x1388;_0x35379b[_0x7437('0x175')]=_0x3087f9[_0x7437('0x176')]||0x64;_0x35379b[_0x7437('0x177')]=_0x3087f9[_0x7437('0x178')]||0x32;_0x35379b[_0x7437('0x179')]=_0x3087f9[_0x7437('0x17a')]||0x3;_0x35379b[_0x7437('0x17b')]=_0x3087f9['dialAMDSilenceThreshold']||0x100;_0x35379b[_0x7437('0x17c')]=_0x3087f9[_0x7437('0x17d')]||0x1388;}if(_0x3087f9[_0x7437('0x4f')]===_0x7437('0x16b')){_0x35379b[_0x7437('0x17e')]=_0x13c153[_0x7437('0xcc')];}else{_0x35379b[_0x7437('0x17f')]=_0x13c153[_0x7437('0xcd')];}for(var _0x26d29f in _0x13c153[_0x7437('0x165')]){if(typeof _0x13c153['Contact'][_0x26d29f]!==_0x7437('0x97')){if(isNotNull(_0x13c153[_0x7437('0x165')][_0x26d29f])&&_0x26d29f!=='id'&&_0x26d29f!==_0x7437('0x180')&&_0x26d29f!==_0x7437('0x181')&&_0x26d29f!==_0x7437('0x182')){_0x35379b[util['format'](_0x7437('0x183'),_0x7437('0x184'),_[_0x7437('0x185')](_0x26d29f))]=_0x13c153['Contact'][_0x26d29f];}}}var _0x502ab7=_0x3f1d25['isTrunkReachable'](_0x3087f9[_0x7437('0x76')])?getCallerId(_0x3087f9[_0x7437('0x76')]['callerid'],_0x3087f9[_0x7437('0x5a')],_0x3087f9['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x3087f9['dialOriginateCallerIdNumber'],_0x3087f9[_0x7437('0x186')]):_0x3087f9[_0x7437('0x5b')]):getCallerId(_['isNil'](_0x3087f9['TrunkBackup'])?_0x3087f9[_0x7437('0x76')][_0x7437('0x78')]:_0x3087f9[_0x7437('0x13b')][_0x7437('0x78')],_0x3087f9['dialOriginateCallerIdName'],_0x3087f9[_0x7437('0x186')]>0x0?getCallerIdRandom(_0x3087f9[_0x7437('0x5b')],_0x3087f9[_0x7437('0x186')]):_0x3087f9[_0x7437('0x5b')]);if(_0x502ab7){_0x35379b['XMD-ORIGINATECALLERIDNAME']=_0x3f1d25['actions'][_0x2d3803][_0x7437('0x187')]=extractCalleridName(_0x502ab7);_0x35379b[_0x7437('0x188')]=_0x3f1d25[_0x7437('0x29')][_0x2d3803][_0x7437('0x189')]=extractCalleridNumber(_0x502ab7);}return ami[_0x7437('0x148')]({'actionid':_0x2d3803,'action':_0x7437('0x167'),'channel':_0x3f1d25[_0x7437('0x18a')](_0x3087f9['Trunk'])?util[_0x7437('0x79')]('SIP/%s/%s%s',_0x3087f9[_0x7437('0x76')]['name'],isNotNull(_0x3087f9[_0x7437('0x18b')])?_0x3087f9[_0x7437('0x18b')][_0x7437('0x18c')]()||'':'',_0x3087f9['dialCutDigit']>0x0?_0x13c153[_0x7437('0x165')][_0x7437('0x166')]['substring'](_0x3087f9[_0x7437('0x18d')]):_0x13c153[_0x7437('0x165')][_0x7437('0x166')]):util[_0x7437('0x79')](_0x7437('0x18e'),_['isNil'](_0x3087f9[_0x7437('0x13b')])?_0x3087f9[_0x7437('0x76')][_0x7437('0x41')]:_0x3087f9['TrunkBackup']['name'],isNotNull(_0x3087f9[_0x7437('0x18b')])?_0x3087f9[_0x7437('0x18b')][_0x7437('0x18c')]()||'':'',_0x3087f9[_0x7437('0x18d')]>0x0?_0x13c153[_0x7437('0x165')]['phone'][_0x7437('0x18f')](_0x3087f9['dialCutDigit']):_0x13c153[_0x7437('0x165')]['phone']),'callerid':_0x502ab7,'Exten':_0x7437('0xd8'),'Context':_0x7437('0x190'),'Priority':'1','variable':_0x35379b,'timeout':(_0x3087f9[_0x7437('0x5c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2d3803})[_0x7437('0xb2')](function(_0x5b1e23){return _0x8cb869(_0x5b1e23);})['catch'](function(_0x7ee51b){_0x3087f9[_0x7437('0x63')]+=0x1;var _0x39981e=new History(_0x3f1d25['actions'][_0x2d3803]);logger[_0x7437('0x94')](util[_0x7437('0x79')](_0x7437('0x191'),JSON[_0x7437('0x4a')](_0x7ee51b)));_0x39981e['state']=0xe;_0x39981e['statedesc']='OriginateError';_0x39981e[_0x7437('0xa5')]=moment()['format'](_0x7437('0xf6'));_0x39981e[_0x7437('0xa4')]=_0x39981e[_0x7437('0xa5')];_0x3f1d25[_0x7437('0xc4')](_0x39981e)[_0x7437('0xb4')](loggerCatch(_0x7437('0x192')));_0x3f1d25[_0x7437('0xc3')](_0x39981e)[_0x7437('0xb4')](loggerCatch(_0x7437('0x192')))['finally'](function(){delete _0x3f1d25[_0x7437('0x29')][_0x2d3803];return _0x5d8104(msgResponse(_0x7437('0x167'),_0x7437('0x49'),_0x7437('0x193')));});});});};Dialer[_0x7437('0x1e')][_0x7437('0x194')]=function(_0x24e87a){var _0x1372cb=this[_0x7437('0x29')][_0x24e87a[_0x7437('0x120')]];if(_0x1372cb){delete this[_0x7437('0x29')][_0x24e87a['actionid']];_0x1372cb[_0x7437('0x195')]=moment()[_0x7437('0x79')](_0x7437('0xf6'));var _0x382b92=_0x1372cb['type']===_0x7437('0x7b')?this[_0x7437('0x24')][_0x1372cb[_0x7437('0xae')]]:this['voiceQueues'][_0x1372cb[_0x7437('0x196')]()];if(!this[_0x7437('0xcf')](_0x24e87a[_0x7437('0x197')])){this[_0x7437('0xac')](_0x382b92);return this['callProgressDetecting'](_0x1372cb,_0x382b92,_0x24e87a)[_0x7437('0xb4')](loggerCatch(_0x7437('0x198')));}this[_0x7437('0xd2')][_0x24e87a[_0x7437('0xd3')]]=_0x1372cb;}};Dialer[_0x7437('0x1e')][_0x7437('0x199')]=function(_0x4c4783,_0x3c4c3a,_0x2d1afa){var _0x2eb713=new History(_0x3c4c3a);if(_0x2eb713[_0x7437('0x19a')]+_0x2eb713['countcongestionretry']+_0x2eb713[_0x7437('0xeb')]+_0x2eb713[_0x7437('0xec')]+_0x2eb713[_0x7437('0xfa')]+_0x2eb713[_0x7437('0xed')]+_0x2eb713['countmachineretry']+_0x2eb713['countagentrejectretry']>=_0x2d1afa[_0x7437('0xef')]-0x1){return!![];}switch(_0x4c4783){case 0x3:if(_0x2eb713['countnoanswerretry']>=_0x2d1afa['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0x7437('0xba')]({'active':![],'countnoanswerretry':_0x2eb713[_0x7437('0xeb')]+=0x1,'scheduledat':moment()[_0x7437('0xf3')](_0x2d1afa[_0x7437('0x19b')],_0x7437('0xf5'))[_0x7437('0x79')](_0x7437('0xf6')),'ContactId':_0x2eb713['ContactId'],'ListId':_0x2eb713[_0x7437('0xcb')],'VoiceQueueId':_0x2eb713[_0x7437('0xcc')]||undefined,'CampaignId':_0x2eb713[_0x7437('0xcd')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x2eb713['countbusyretry']>=_0x2d1afa[_0x7437('0x19c')]-0x1){return!![];}this[_0x7437('0xba')]({'active':![],'countbusyretry':_0x2eb713[_0x7437('0x19a')]+=0x1,'scheduledat':moment()['add'](_0x2d1afa[_0x7437('0x19d')],'minutes')[_0x7437('0x79')](_0x7437('0xf6')),'ContactId':_0x2eb713['ContactId'],'ListId':_0x2eb713[_0x7437('0xcb')],'VoiceQueueId':_0x2eb713['VoiceQueueId']||undefined,'CampaignId':_0x2eb713['CampaignId']||undefined})[_0x7437('0xb4')](loggerCatch(_0x7437('0x19e')));break;case 0x8:if(_0x2eb713[_0x7437('0xf9')]>=_0x2d1afa[_0x7437('0x19f')]-0x1){return!![];}this[_0x7437('0xba')]({'active':![],'countcongestionretry':_0x2eb713[_0x7437('0xf9')]+=0x1,'scheduledat':moment()[_0x7437('0xf3')](_0x2d1afa[_0x7437('0x1a0')],_0x7437('0xf5'))[_0x7437('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2eb713['ContactId'],'ListId':_0x2eb713[_0x7437('0xcb')],'VoiceQueueId':_0x2eb713[_0x7437('0xcc')]||undefined,'CampaignId':_0x2eb713[_0x7437('0xcd')]||undefined})[_0x7437('0xb4')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x2eb713[_0x7437('0xec')]>=_0x2d1afa[_0x7437('0x1a1')]-0x1){return!![];}else{this[_0x7437('0xba')]({'active':![],'countnosuchnumberretry':_0x2eb713[_0x7437('0xec')]+=0x1,'scheduledat':moment()['add'](_0x2d1afa[_0x7437('0x1a2')],_0x7437('0xf5'))[_0x7437('0x79')](_0x7437('0xf6')),'ContactId':_0x2eb713[_0x7437('0xca')],'ListId':_0x2eb713[_0x7437('0xcb')],'VoiceQueueId':_0x2eb713[_0x7437('0xcc')]||undefined,'CampaignId':_0x2eb713[_0x7437('0xcd')]||undefined})[_0x7437('0xb4')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x2eb713[_0x7437('0xfa')]>=_0x2d1afa['dialDropMaxRetry']-0x1){return!![];}this[_0x7437('0xba')]({'active':![],'countdropretry':_0x2eb713[_0x7437('0xfa')]+=0x1,'scheduledat':moment()['add'](_0x2d1afa[_0x7437('0x112')],_0x7437('0xf5'))[_0x7437('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2eb713[_0x7437('0xca')],'ListId':_0x2eb713[_0x7437('0xcb')],'VoiceQueueId':_0x2eb713[_0x7437('0xcc')]||undefined,'CampaignId':_0x2eb713[_0x7437('0xcd')]||undefined})[_0x7437('0xb4')](loggerCatch(_0x7437('0x113')));break;case 0xb:if(_0x2eb713[_0x7437('0xed')]>=_0x2d1afa[_0x7437('0x119')]-0x1){return!![];}this[_0x7437('0xba')]({'active':![],'countabandonedretry':_0x2eb713['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x2d1afa[_0x7437('0x11a')],'minutes')['format'](_0x7437('0xf6')),'ContactId':_0x2eb713[_0x7437('0xca')],'ListId':_0x2eb713['ListId'],'VoiceQueueId':_0x2eb713['VoiceQueueId']||undefined,'CampaignId':_0x2eb713['CampaignId']||undefined})['catch'](loggerCatch(_0x7437('0x1a3')));break;case 0x13:if(_0x2eb713[_0x7437('0xe8')]>=_0x2d1afa['dialMachineMaxRetry']-0x1){return!![];}this[_0x7437('0xba')]({'active':![],'countmachineretry':_0x2eb713['countmachineretry']+=0x1,'scheduledat':moment()[_0x7437('0xf3')](_0x2d1afa[_0x7437('0xf4')],'minutes')[_0x7437('0x79')](_0x7437('0xf6')),'ContactId':_0x2eb713['ContactId'],'ListId':_0x2eb713['ListId'],'VoiceQueueId':_0x2eb713[_0x7437('0xcc')]||undefined,'CampaignId':_0x2eb713[_0x7437('0xcd')]||undefined})[_0x7437('0xb4')](loggerCatch(_0x7437('0xf7')));break;case 0x14:if(_0x2eb713[_0x7437('0xee')]>=_0x2d1afa[_0x7437('0x1a4')]-0x1){return!![];}this[_0x7437('0xba')]({'active':![],'countagentrejectretry':_0x2eb713[_0x7437('0xee')]+=0x1,'scheduledat':moment()[_0x7437('0xf3')](_0x2d1afa[_0x7437('0x1a5')],'minutes')[_0x7437('0x79')](_0x7437('0xf6')),'ContactId':_0x2eb713[_0x7437('0xca')],'ListId':_0x2eb713[_0x7437('0xcb')],'VoiceQueueId':_0x2eb713[_0x7437('0xcc')]||undefined,'CampaignId':_0x2eb713[_0x7437('0xcd')]||undefined})[_0x7437('0xb4')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x7437('0x1e')][_0x7437('0x1a6')]=function(_0x481a01,_0x4be07c,_0x446d56){var _0x47b171=this;var _0x5bb794=new History(_0x481a01);return new BPromise(function(_0x1f5af8,_0x5375a6){if(_[_0x7437('0x3e')](_0x4be07c)&&typeof _0x4be07c!==_0x7437('0x1a7')){return _0x5375a6(msgResponse(_0x7437('0x1a8'),'Failure','entity\x20is\x20undefine'));}if(_[_0x7437('0x3e')](_0x446d56)&&typeof _0x446d56!==_0x7437('0x1a7')){return _0x5375a6(msgResponse(_0x7437('0x1a8'),'Failure','evt\x20is\x20undefine'));}switch(_0x446d56[_0x7437('0x102')]){case'0':_0x4be07c['outboundNoSuchCallsDay']+=0x1;_0x5bb794[_0x7437('0xdd')]=0x0;_0x5bb794['statedesc']=_0x7437('0x1a9');_0x5bb794['countnosuchnumberretry']+=0x1;_0x5bb794['countglobal']+=0x1;ami['emit'](_0x7437('0x1aa'),ut[_0x7437('0xe2')](_0x481a01,_0x7437('0x1ab')));_0x47b171[_0x7437('0xc4')](_0x5bb794)['catch'](loggerCatch(_0x7437('0xea')));if(_0x47b171[_0x7437('0x199')](0x0,_0x481a01,_0x4be07c)){if(_0x5bb794['countnosuchnumberretry']>=_0x4be07c[_0x7437('0x1a1')]){_0x47b171['createStateFinal'](_0x5bb794,_0x1f5af8,_0x5375a6,'reason\x200\x20no\x20such\x20number....');}else{_0x47b171[_0x7437('0xf0')](_0x5bb794,_0x1f5af8,_0x5375a6,_0x7437('0x1ac'));}}break;case'3':_0x4be07c[_0x7437('0x1ad')]+=0x1;_0x5bb794['state']=0x3;_0x5bb794[_0x7437('0xa3')]=_0x7437('0x1ae');_0x5bb794['countnoanswerretry']+=0x1;_0x5bb794[_0x7437('0xe9')]+=0x1;ami[_0x7437('0x4e')]('custom:agentnoanswer',ut[_0x7437('0xe2')](_0x481a01,_0x7437('0x1af')));_0x47b171[_0x7437('0xc4')](_0x5bb794)[_0x7437('0xb4')](loggerCatch(_0x7437('0x1b0')));if(_0x47b171[_0x7437('0x199')](0x3,_0x481a01,_0x4be07c)){if(_0x5bb794[_0x7437('0xeb')]>=_0x4be07c[_0x7437('0x1b1')]){_0x47b171[_0x7437('0xf2')](_0x5bb794,_0x1f5af8,_0x5375a6,_0x7437('0x1b2'));}else{_0x47b171['stateGlobal'](_0x5bb794,_0x1f5af8,_0x5375a6,_0x7437('0x1b2'));}}break;case'5':_0x4be07c['outboundBusyCallsDay']+=0x1;_0x5bb794[_0x7437('0xdd')]=0x5;_0x5bb794['statedesc']='Busy';_0x5bb794[_0x7437('0x19a')]+=0x1;_0x5bb794[_0x7437('0xe9')]+=0x1;ami[_0x7437('0x4e')](_0x7437('0x1b3'),ut['buildObj'](_0x481a01,_0x7437('0x1b4')));_0x47b171[_0x7437('0xc4')](_0x5bb794)['catch'](loggerCatch(_0x7437('0x1b5')));if(_0x47b171[_0x7437('0x199')](0x5,_0x481a01,_0x4be07c)){if(_0x5bb794[_0x7437('0x19a')]>=_0x4be07c[_0x7437('0x19c')]){_0x47b171[_0x7437('0xf2')](_0x5bb794,_0x1f5af8,_0x5375a6,_0x7437('0x1b6'));}else{_0x47b171[_0x7437('0xf0')](_0x5bb794,_0x1f5af8,_0x5375a6,_0x7437('0x1b6'));}}break;case'8':_0x4be07c['outboundCongestionCallsDay']+=0x1;_0x5bb794[_0x7437('0xdd')]=0x8;_0x5bb794[_0x7437('0xa3')]=_0x7437('0x1b7');_0x5bb794[_0x7437('0xf9')]+=0x1;_0x5bb794[_0x7437('0xe9')]+=0x1;ami[_0x7437('0x4e')](_0x7437('0x1b8'),ut[_0x7437('0xe2')](_0x481a01,_0x7437('0x1b9')));_0x47b171[_0x7437('0xc4')](_0x5bb794)[_0x7437('0xb4')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x47b171[_0x7437('0x199')](0x8,_0x481a01,_0x4be07c)){if(_0x5bb794[_0x7437('0xf9')]>=_0x4be07c[_0x7437('0x19f')]){_0x47b171[_0x7437('0xf2')](_0x5bb794,_0x1f5af8,_0x5375a6,_0x7437('0x1ba'));}else{_0x47b171['stateGlobal'](_0x5bb794,_0x1f5af8,_0x5375a6,_0x7437('0x1ba'));}}break;case'11':_0x4be07c['outboundAbandonedCallsDay']+=0x1;_0x5bb794[_0x7437('0xdd')]=0xb;_0x5bb794['statedesc']=_0x7437('0x117');_0x5bb794[_0x7437('0xed')]+=0x1;_0x5bb794['countglobal']+=0x1;_0x47b171[_0x7437('0xc4')](_0x5bb794)[_0x7437('0xb4')](loggerCatch(_0x7437('0x11b')));if(_0x47b171['checkRetriveMax'](0xb,_0x481a01,_0x4be07c)){if(_0x5bb794[_0x7437('0xed')]>=_0x4be07c['dialAbandonedMaxRetry']){_0x47b171[_0x7437('0xf2')](_0x5bb794,_0x1f5af8,_0x5375a6,_0x7437('0x1bb'));}else{_0x47b171['stateGlobal'](_0x5bb794,_0x1f5af8,_0x5375a6,_0x7437('0x1bb'));}}break;case'20':_0x4be07c[_0x7437('0x1bc')]+=0x1;_0x5bb794[_0x7437('0xdd')]=0x14;_0x5bb794[_0x7437('0xa3')]=_0x7437('0x1bd');_0x5bb794[_0x7437('0xee')]+=0x1;_0x5bb794[_0x7437('0xe9')]+=0x1;ami['emit'](_0x7437('0x1be'),ut[_0x7437('0xe2')](_0x481a01,_0x7437('0x1bf')));_0x47b171[_0x7437('0xc4')](_0x5bb794)[_0x7437('0xb4')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x47b171['checkRetriveMax'](0x14,_0x481a01,_0x4be07c)){if(_0x5bb794['countagentrejectretry']>=_0x4be07c[_0x7437('0x1a4')]){_0x47b171[_0x7437('0xf2')](_0x5bb794,_0x1f5af8,_0x5375a6,_0x7437('0x1c0'));}else{_0x47b171['stateGlobal'](_0x5bb794,_0x1f5af8,_0x5375a6,_0x7437('0x1c0'));}}break;default:_0x4be07c[_0x7437('0x64')]+=0x1;_0x5bb794[_0x7437('0xdd')]=0xc;_0x5bb794[_0x7437('0xa3')]=_0x446d56[_0x7437('0x102')];_0x47b171[_0x7437('0xc4')](_0x5bb794)[_0x7437('0xb4')](loggerCatch(_0x7437('0x1c1')));if(_0x47b171[_0x7437('0x199')](_0x446d56[_0x7437('0x102')],_0x481a01,_0x4be07c)){if(_0x5bb794[_0x7437('0x19a')]+_0x5bb794['countcongestionretry']+_0x5bb794[_0x7437('0xeb')]+_0x5bb794['countnosuchnumberretry']+_0x5bb794['countdropretry']+_0x5bb794[_0x7437('0xed')]+_0x5bb794[_0x7437('0xe8')]+_0x5bb794[_0x7437('0xee')]>=_0x4be07c['dialGlobalMaxRetry']){_0x47b171[_0x7437('0xf0')](_0x5bb794,_0x1f5af8,_0x5375a6,_0x446d56[_0x7437('0x102')]);}else{_0x47b171[_0x7437('0xf2')](_0x5bb794,_0x1f5af8,_0x5375a6,_0x446d56[_0x7437('0x102')]);}}}});};Dialer['prototype'][_0x7437('0xf0')]=function(_0x3f768e,_0x5c1b59,_0x66fee,_0x24ffbf){var _0x3e70af=new Final(_0x3f768e);_0x3e70af[_0x7437('0xdd')]=0xf;_0x3e70af[_0x7437('0xa3')]='Global';this[_0x7437('0xf2')](_0x3e70af,_0x5c1b59,_0x66fee,_0x24ffbf);};Dialer['prototype'][_0x7437('0xf2')]=function(_0x434bf3,_0x5c714d,_0x4df64d,_0x451f79){this[_0x7437('0xc3')](_0x434bf3)[_0x7437('0xb2')](function(){return _0x5c714d(msgResponse(_0x7437('0x1a8'),_0x7437('0x1c2'),_0x451f79));})[_0x7437('0xb4')](function(){return _0x4df64d(msgResponse('[moveContactManagedDialer][0]',_0x7437('0x141'),_0x7437('0x1c3')));});};Dialer['prototype']['predictive']=function(_0x237b78){var _0x52988f=_0x237b78[_0x7437('0x1c4')]/0x64;var _0x3fef02=_0x237b78['outboundDropCallsDayTimeout']/(_0x237b78['outboundDropCallsDayTimeout']+_0x237b78[_0x7437('0x5d')]);var _0x23c2bf=Math[_0x7437('0x1c5')](_0x237b78['predictiveIntervalAvailable']*(_0x237b78[_0x7437('0x1c6')]/0x64));var _0x38342f=Math[_0x7437('0x1c5')](_0x237b78['predictiveIntervalAvailable']*(_0x237b78[_0x7437('0x1c7')]/0x64));var _0x515817=_0x237b78[_0x7437('0x51')]+_0x237b78[_0x7437('0x56')];var _0x28ee2d=Math[_0x7437('0x1c8')](_0x237b78[_0x7437('0x71')]*_0x237b78[_0x7437('0x73')]*_0x237b78[_0x7437('0x1c9')]*_0x237b78[_0x7437('0x6c')]);if(_[_0x7437('0x3e')](_0x237b78[_0x7437('0x2b')])){if(!_[_0x7437('0x3e')](_0x237b78['startPredictive'])){_0x237b78[_0x7437('0x75')]=undefined;loggerPredictive[_0x7437('0x94')](_0x7437('0x1ca'),_0x7437('0x1cb'));}if(!_[_0x7437('0x3e')](_0x237b78[_0x7437('0x90')])){loggerPredictive[_0x7437('0x94')](_0x7437('0x1ca'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x237b78['handlePredictive']);_0x237b78[_0x7437('0x90')]=undefined;}_0x237b78[_0x7437('0x2b')]=moment()[_0x7437('0x79')](_0x7437('0xf6'));loggerPredictive[_0x7437('0x7f')](_0x237b78[_0x7437('0x41')],_0x7437('0x1cc'),_0x237b78[_0x7437('0x2b')]);this[_0x7437('0x155')](_0x237b78,0x1);}else if(ifInterval(_0x237b78[_0x7437('0x1cd')],_0x237b78[_0x7437('0x2b')])){this[_0x7437('0x155')](_0x237b78,0x1);loggerPredictiveCalls[_0x7437('0x7f')](_0x7437('0x1ce'),_0x237b78[_0x7437('0x2b')],_0x237b78[_0x7437('0x41')]);_0x237b78[_0x7437('0x71')]=0x0;_0x237b78[_0x7437('0x6b')]=0x0;}else if(_0x52988f<_0x3fef02&&_0x237b78[_0x7437('0x1cf')]===_0x7437('0x1d0')){freeVariablesPredictive(_0x237b78);loggerPredictive[_0x7437('0x7f')](_0x7437('0x1d1'),_0x7437('0x1d2'),_0x3fef02,'startProgressive',_0x237b78[_0x7437('0x41')]);}else if(_0x28ee2d<_0x237b78[_0x7437('0x6b')]&&_0x237b78[_0x7437('0x1cf')]===_0x7437('0x1d0')){freeVariablesPredictive(_0x237b78);loggerPredictive[_0x7437('0x7f')](_0x7437('0x1d3'),_0x7437('0x1d4'),_0x28ee2d,_0x7437('0x1d5'),_0x237b78[_0x7437('0x6b')],_0x7437('0x2b'),_0x237b78[_0x7437('0x41')]);}else if(!ifInterval(_0x237b78[_0x7437('0x1cd')],_0x237b78[_0x7437('0x2b')])&&_[_0x7437('0x3e')](_0x237b78['startPredictive'])&&!_[_0x7437('0x3e')](_0x237b78[_0x7437('0x2b')])){_0x237b78[_0x7437('0x75')]=moment()[_0x7437('0x79')](_0x7437('0xf6'));loggerPredictive[_0x7437('0x7f')](_0x237b78['name'],_0x7437('0x1d6'),_0x237b78[_0x7437('0x75')]);this['averageHandleTime'](_0x237b78[_0x7437('0x1cd')])['then'](this[_0x7437('0x1d7')](_0x237b78))['then'](mergeDataErlangB(_0x237b78))['then'](this['startMethodPredictive'](_0x237b78))['catch'](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x237b78));}else if(!ifInterval(_0x237b78[_0x7437('0x1cd')],_0x237b78[_0x7437('0x75')])){_0x237b78[_0x7437('0x6b')]=0x0;_0x237b78[_0x7437('0x75')]=moment()['format'](_0x7437('0xf6'));loggerPredictive[_0x7437('0x7f')](_0x237b78[_0x7437('0x41')],_0x7437('0x1d8'),_0x237b78['startPredictive']);clearInterval(_0x237b78['handlePredictive']);_0x237b78[_0x7437('0x90')]=undefined;this[_0x7437('0xb7')](_0x237b78[_0x7437('0x1cd')])[_0x7437('0xb2')](this['getDataPredictive'](_0x237b78))[_0x7437('0xb2')](mergeDataErlangB(_0x237b78))[_0x7437('0xb2')](this[_0x7437('0x1d9')](_0x237b78))['catch'](loggerCatchPredictive(_0x7437('0x1da'),_0x237b78));}else if(_0x237b78[_0x7437('0x6e')]&&_0x515817<_0x237b78[_0x7437('0x6e')]-_0x38342f){freeVariablesPredictive(_0x237b78);loggerPredictive['info'](_0x237b78[_0x7437('0x41')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x515817,_0x7437('0x1db'),_0x237b78[_0x7437('0x6e')],'-',_0x38342f,'=',_0x237b78[_0x7437('0x6e')]-_0x38342f,')');}else if(_0x237b78[_0x7437('0x6e')]&&_0x515817>_0x237b78[_0x7437('0x6e')]+_0x23c2bf){freeVariablesPredictive(_0x237b78);loggerPredictive['info'](_0x237b78[_0x7437('0x41')],_0x7437('0x1dc'),_0x515817,_0x7437('0x1dd'),_0x237b78[_0x7437('0x6e')],'+',_0x23c2bf,'=',_0x237b78[_0x7437('0x6e')]+_0x23c2bf,')');}};Dialer[_0x7437('0x1e')][_0x7437('0x1d7')]=function(_0x364df4){var _0xbe1b58=this;return function(_0xb275b6){return new BPromise(function(_0x2497b1,_0x125129){_['merge'](_0x364df4,_0xb275b6[0x0]);if(checkGetDataPredictive(_0xb275b6[0x0])){var _0x568764=_0x364df4[_0x7437('0x6e')]=_0x364df4[_0x7437('0x56')]+_0x364df4[_0x7437('0x51')];var _0x103736=_0x364df4[_0x7437('0x1cd')]*0x3c;var _0x5b707b=_0xb275b6[0x0]['predictiveIntervalAvgTalktime']+_0xb275b6[0x0][_0x7437('0x66')];var _0x16060b=(_0xb275b6[0x0][_0x7437('0x65')]+_0xb275b6[0x0]['predictiveIntervalDroppedCallsTimeout']+_0xb275b6[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0xb275b6[0x0]['predictiveIntervalTotalCalls'];_0x364df4['predictiveIntervalHitRate']=_0x16060b>0x0?_0x16060b:0x1;switch(_0x364df4[_0x7437('0x1cf')]){case _0x7437('0x1d0'):var _0x5c80ca=_0x364df4['dialPredictiveOptimizationPercentage']/0x64;return _0xbe1b58[_0x7437('0x1de')](_0x568764,_0x103736,_0x5b707b,_0x16060b,_0x5c80ca)['then'](function(_0x19e148){return _0x2497b1(_0x19e148);});case _0x7437('0x1df'):var _0x36e79a=_0x364df4['dialPredictiveOptimizationPercentage']/0x64;return _0xbe1b58[_0x7437('0x1e0')](_0x568764,_0x103736,_0x5b707b,_0x16060b,_0x36e79a)[_0x7437('0xb2')](function(_0x4f714d){return _0x2497b1(_0x4f714d);});default:return _0x125129(msgResponse(_0x7437('0x1e1'),'Failure',_0x7437('0x1e2')));}}else{return _0x125129(msgResponse('[getDataPredictive]',_0x7437('0x141'),'check\x20failure'));}});};};Dialer['prototype'][_0x7437('0x1e3')]=function(_0x14930c){var _0xf3d81a=this;return function(_0x21a005){return new BPromise(function(_0xd74919,_0x284785){_['merge'](_0x14930c,_0x21a005[0x0]);if(checkGetDataPredictive(_0x21a005[0x0])){loggerPredictive[_0x7437('0x7f')](JSON[_0x7437('0x4a')](_0x21a005[0x0]));if(_0x14930c[_0x7437('0x1cf')]===_0x7437('0x1d0')){return _0xf3d81a['getVoiceQueueRtPauses'](_0x14930c['id'])[_0x7437('0xb2')](function(_0x1a4e57){var _0x2eb61e=_0x14930c[_0x7437('0x52')]-_0x1a4e57[0x0]['outboundQueuePauses'];var _0x278d1c=_0x14930c[_0x7437('0x1cd')]*0x3c;var _0x33f5cc=_0x21a005[0x0]['predictiveIntervalAvgTalktime']+_0x21a005[0x0]['predictiveIntervalAvgHoldtime'];var _0xb6e3e9=(_0x21a005[0x0]['predictiveIntervalAnsweredCalls']+_0x21a005[0x0][_0x7437('0x69')]+_0x21a005[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x21a005[0x0][_0x7437('0x6f')];var _0x5c97d7=_0x14930c['dialPredictiveOptimizationPercentage']/0x64;_0x14930c['predictiveIntervalPauses']=_0x1a4e57[0x0]['outboundQueuePauses']||0x0;_0x14930c[_0x7437('0x1c9')]=_0xb6e3e9>0x0?_0xb6e3e9:0x1;return _0xf3d81a[_0x7437('0x1de')](_0x2eb61e,_0x278d1c,_0x33f5cc,_0xb6e3e9,_0x5c97d7);})[_0x7437('0xb2')](function(_0xd13cb8){return _0xd74919(_0xd13cb8);})[_0x7437('0xb4')](function(_0x1ff708){return _0x284785(msgResponse(_0x7437('0x1e4'),_0x7437('0x141'),JSON['stringify'](_0x1ff708)));});}if(_0x14930c[_0x7437('0x1cf')]===_0x7437('0x1df')){return _0xf3d81a[_0x7437('0xc1')](_0x14930c['id'])[_0x7437('0xb2')](function(_0x13a743){var _0x5950aa=_0x14930c['loggedIn']-_0x13a743[0x0][_0x7437('0x1e5')];var _0x1d6137=_0x14930c[_0x7437('0x1cd')]*0x3c;var _0x5300eb=_0x21a005[0x0]['predictiveIntervalAvgTalktime']+_0x21a005[0x0][_0x7437('0x66')];var _0x24e67e=(_0x21a005[0x0][_0x7437('0x65')]+_0x21a005[0x0][_0x7437('0x69')]+_0x21a005[0x0][_0x7437('0x68')])/_0x21a005[0x0][_0x7437('0x6f')];var _0x31c248=_0x14930c[_0x7437('0x1c4')]/0x64;_0x14930c['predictiveIntervalPauses']=_0x13a743[0x0]['outboundQueuePauses']||0x0;_0x14930c['predictiveIntervalHitRate']=_0x24e67e>0x0?_0x24e67e:0x1;return _0xf3d81a[_0x7437('0x1e0')](_0x5950aa,_0x1d6137,_0x5300eb,_0x24e67e,_0x31c248);})[_0x7437('0xb2')](function(_0xcb1083){return _0xd74919(_0xcb1083);})[_0x7437('0xb4')](function(_0x2aa529){return _0x284785(msgResponse(_0x7437('0x1e4'),_0x7437('0x141'),JSON[_0x7437('0x4a')](_0x2aa529)));});}}else{return _0x284785(msgResponse(_0x7437('0x1e1'),'Failure','check\x20failure'));}});};};Dialer['prototype']['startMethodPredictive']=function(_0x2a05ec){var _0x1b25b6=this;return function(){var _0x5d75d2=0x0;var _0x47c08a=Math[_0x7437('0x1c8')](_0x2a05ec[_0x7437('0x72')]*0x3e8);if(_0x47c08a>0x0){_0x47c08a=_0x47c08a<0x64?0x64:_0x47c08a;loggerPredictive[_0x7437('0x7f')](_0x2a05ec[_0x7437('0x41')],'one\x20call\x20every:',_0x47c08a,'milliseconds');_0x2a05ec['handlePredictive']=setInterval(function(){_0x1b25b6['handlePredictive'](_0x2a05ec);loggerPredictiveCalls[_0x7437('0x7f')](_0x7437('0x1e6'),_0x5d75d2+=0x1);},_0x47c08a);}else{loggerPredictive[_0x7437('0x7f')](_0x2a05ec[_0x7437('0x41')],_0x7437('0x1e7'));}};};Dialer['prototype'][_0x7437('0x1e8')]=function(_0x508db4,_0xe8531e){var _0x2cbb20=this;return function(_0x2b908d){if(_[_0x7437('0x7e')](_0x2b908d)){if(_['isNil'](_0xe8531e[_0x7437('0x1e9')])||!_0xe8531e[_0x7437('0x1ea')]){if(_0x508db4[_0x7437('0x59')]==='booked'){_0x508db4[_0x7437('0x127')]=_['isUndefined'](_0x508db4[_0x7437('0x127')])?!![]:_0x508db4['queueStatusComplete'];var _0x4916fc=uuid['v4']();_0x2cbb20[_0x7437('0x29')][_0x4916fc]=new Action(_0x508db4,_0xe8531e,_0x4916fc);loggerBooked[_0x7437('0x7f')](_0x7437('0x1eb'),_0x4916fc,'queueStatusComplete:\x20',JSON['stringify'](_0x508db4[_0x7437('0x127')]),_0x7437('0x1ec'),_0x508db4['name']);if(_0x508db4[_0x7437('0x127')]){_0x508db4['queueStatusComplete']=![];_0x2cbb20[_0x7437('0x2d')][_0x2cbb20['actions'][_0x4916fc]['queue']]=[];ami[_0x7437('0x148')]({'actionid':_0x4916fc,'action':'queuestatus','queue':_0x508db4[_0x7437('0x41')]})[_0x7437('0xb4')](function(){_0x2cbb20[_0x7437('0xac')](_0x508db4);_0x2cbb20['rescheduleContact']({'active':![],'ContactId':_0x2cbb20['actions'][_0x4916fc][_0x7437('0xca')],'ListId':_0x2cbb20['actions'][_0x4916fc][_0x7437('0xcb')],'VoiceQueueId':_0x2cbb20[_0x7437('0x29')][_0x4916fc]['VoiceQueueId']||undefined,'CampaignId':_0x2cbb20[_0x7437('0x29')][_0x4916fc][_0x7437('0xcd')]||undefined})['catch'](loggerCatch(_0x7437('0x1ed')));delete _0x2cbb20['actions'][_0x4916fc];});}else{loggerBooked['info'](_0x7437('0x1ee'),JSON[_0x7437('0x4a')](_0x508db4[_0x7437('0x127')]),_0x7437('0x1ec'),_0x508db4[_0x7437('0x41')]);_0x2cbb20['updateOriginated'](_0x508db4);_0x2cbb20['rescheduleContact']({'active':![],'ContactId':_0x2cbb20['actions'][_0x4916fc][_0x7437('0xca')],'ListId':_0x2cbb20[_0x7437('0x29')][_0x4916fc][_0x7437('0xcb')],'VoiceQueueId':_0x2cbb20['actions'][_0x4916fc][_0x7437('0xcc')]||undefined,'CampaignId':_0x2cbb20[_0x7437('0x29')][_0x4916fc][_0x7437('0xcd')]||undefined})[_0x7437('0xb4')](loggerCatch(_0x7437('0x1ed')));delete _0x2cbb20[_0x7437('0x29')][_0x4916fc];}}else{return _0x2cbb20[_0x7437('0x164')](_0x508db4,_0xe8531e);}}else{if(getDiff(_0xe8531e[_0x7437('0x1ef')])<_0x508db4[_0x7437('0x1f0')]*0x3c){if(_0xe8531e[_0x7437('0x159')]&&!_0xe8531e['Agent'][_0x7437('0x1f1')]){_0x2cbb20['preview'][_0x7437('0x12b')](_0xe8531e['id'])['finally'](function(){_0x2cbb20[_0x7437('0xac')](_0x508db4);});}else{_0x2cbb20[_0x7437('0xbc')]({'active':![]},_0xe8531e['id'],0x1)['finally'](function(){_0x2cbb20[_0x7437('0xac')](_0x508db4);});}}else{_0x508db4[_0x7437('0x1f2')]+=0x1;_0x2cbb20[_0x7437('0xac')](_0x508db4);if(_0x508db4['dialRecallInQueue']){_0x2cbb20['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0xe8531e['ContactId'],'ListId':_0xe8531e['ListId'],'VoiceQueueId':_0xe8531e['VoiceQueueId']||undefined,'CampaignId':_0xe8531e[_0x7437('0xcd')]||undefined})[_0x7437('0xb4')](loggerCatch(_0x7437('0x1f3')));_0x2cbb20[_0x7437('0xc4')](createObjHistory(_0x508db4,_0xe8531e,_0x7437('0x1f4'),0x17,'RecallInQueue'))[_0x7437('0xb4')](loggerCatch(_0x7437('0x1f5')));}else{_0x2cbb20[_0x7437('0xc8')](createObjHistory(_0x508db4,_0xe8531e,_0x7437('0x1f6'),0x16,_0x7437('0x1f7')),_0x7437('0x1f8'),_0x7437('0x1f9'));}}}}else{_0x508db4[_0x7437('0x5e')]+=0x1;_0x2cbb20[_0x7437('0xc8')](createObjHistory(_0x508db4,_0xe8531e,'BLACKLIST',0xd,_0x7437('0x1fa')),_0x7437('0x1fb'),'[Originate][MoveBlacklist]');throw _0x7437('0x1fc');}};};Dialer[_0x7437('0x1e')][_0x7437('0x1fd')]=function(_0x988b1e){var _0x459069=this;var _0x8f7215=_0x988b1e[_0x7437('0x1fe')]-_0x988b1e[_0x7437('0x70')]-_0x988b1e[_0x7437('0xbf')];emitCampaignSummary(_0x988b1e);if(_0x8f7215>0x0){if(_0x8f7215>this[_0x7437('0x27')]){_0x8f7215=this[_0x7437('0x27')];}_0x988b1e[_0x7437('0xbf')]+=_0x8f7215;this[_0x7437('0xc0')](_0x988b1e['id'],_0x8f7215,_0x988b1e['dialOrderByScheduledAt'],_0x988b1e)[_0x7437('0xb2')](function(_0x8ef111){_0x988b1e['temp']-=_0x8f7215;_0x988b1e[_0x7437('0xbf')]=_0x988b1e[_0x7437('0xbf')]>0x0?_0x988b1e['temp']:0x0;if(!checkContactEmpty(_0x8ef111)){_0x988b1e[_0x7437('0x3f')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x7437('0x7f')](_0x7437('0x1ff')+_0x988b1e[_0x7437('0x41')]);}else{_0x988b1e[_0x7437('0x70')]+=_0x8ef111[_0x7437('0x96')];_0x988b1e[_0x7437('0x3f')]=_0x7437('0x200');for(var _0x27b353=0x0;_0x27b353<_0x8ef111[_0x7437('0x96')];_0x27b353+=0x1){_0x988b1e['ivrTotalCallsDays']+=0x1;if(_[_0x7437('0xd4')](_0x8ef111[_0x27b353])||_[_0x7437('0xd4')](_0x8ef111[_0x27b353][_0x7437('0x165')])||_[_0x7437('0xd4')](_0x8ef111[_0x27b353][_0x7437('0x165')][_0x7437('0x166')])){_0x459069[_0x7437('0xc6')](_0x7437('0x201'),_0x988b1e,_0x8ef111[_0x27b353]);}else{_0x459069[_0x7437('0x202')](_[_0x7437('0xc9')](_0x8ef111[_0x27b353],['CampaignId',_0x7437('0x203')]))[_0x7437('0xb2')](_0x459069['checkContactBlack'](_0x988b1e,_0x8ef111[_0x27b353]))['catch'](_0x459069['loggerHandler'](_0x7437('0x204'),_0x988b1e));}}}})[_0x7437('0xb4')](loggerGetContactDialer(_0x7437('0x205'),_0x988b1e,_0x8f7215));}};Dialer[_0x7437('0x1e')][_0x7437('0x155')]=function(_0x573782,_0x17fb5b){var _0x6269fb=this;var _0x5c8173=[];var _0x2e1e01=_0x17fb5b>=0x1?_0x17fb5b:0x1;if(_0x573782[_0x7437('0x59')]===_0x7437('0x206')){_0x2e1e01=0x1;}var _0x2a9631=Math[_0x7437('0x1c8')](_0x573782[_0x7437('0x51')]*_0x2e1e01)-_0x573782[_0x7437('0x70')]-_0x573782['temp'];emitVoiceQueueSummary(_0x573782);if(_0x573782[_0x7437('0x207')]>0x0){var _0x244d61=_0x573782['dialLimitQueue']-_0x573782[_0x7437('0x70')]-_0x573782['talking']-_0x573782['temp']-_0x573782['pTalking'];if(_0x2a9631>_0x244d61){_0x2a9631=_0x244d61;}}if(_0x2a9631>0x0){if(_0x573782[_0x7437('0x59')]==='booked'){_0x2a9631=0x1;}if(_0x2a9631>this[_0x7437('0x27')]){_0x2a9631=this[_0x7437('0x27')];}_0x573782[_0x7437('0xbf')]+=_0x2a9631;for(var _0x14dc43 in this[_0x7437('0x25')]){if(typeof this[_0x7437('0x25')][_0x14dc43]!=='undefined'){if(this[_0x7437('0x25')][_0x14dc43]['state']===_0x7437('0x208')&&this['agents'][_0x14dc43][_0x7437('0xab')]===_0x7437('0xd1')){_0x5c8173[_0x7437('0x124')](this[_0x7437('0x25')][_0x14dc43]['id']);}}}this[_0x7437('0xbe')](_0x573782['id'],_0x5c8173,_0x2a9631,_0x573782[_0x7437('0x209')],_0x573782)[_0x7437('0xb2')](function(_0xb80a73){_0x573782['temp']-=_0x2a9631;_0x573782[_0x7437('0xbf')]=_0x573782[_0x7437('0xbf')]>0x0?_0x573782['temp']:0x0;if(!checkContactEmpty(_0xb80a73)){_0x6269fb[_0x7437('0xb0')](_0x573782)[_0x7437('0xb2')](sendMessageReschedule(_0x573782))[_0x7437('0xb4')](loggerCatch(_0x7437('0x20a')));}else{_0x573782[_0x7437('0x70')]+=_0xb80a73[_0x7437('0x96')];_0x573782['message']=_0x573782['dialMethod']===_0x7437('0x206')?_0x7437('0x16e'):_0x7437('0x200');for(var _0x5b3407=0x0;_0x5b3407<_0xb80a73['length'];_0x5b3407+=0x1){if(_[_0x7437('0xd4')](_0xb80a73[_0x5b3407])||_[_0x7437('0xd4')](_0xb80a73[_0x5b3407][_0x7437('0x165')])||_[_0x7437('0xd4')](_0xb80a73[_0x5b3407][_0x7437('0x165')][_0x7437('0x166')])){_0x6269fb[_0x7437('0xc6')]('[actionOriginate]\x20',_0x573782,_0xb80a73[_0x5b3407]);}else{_0x6269fb[_0x7437('0xb3')](_[_0x7437('0xc9')](_0xb80a73[_0x5b3407],[_0x7437('0xcc'),_0x7437('0x203')]))[_0x7437('0xb2')](_0x6269fb[_0x7437('0x1e8')](_0x573782,_0xb80a73[_0x5b3407]))['catch'](_0x6269fb['loggerHandler']('[actionOriginate]\x20',_0x573782));}}}})[_0x7437('0xb4')](loggerGetContactDialer('[getContactDialer2]',_0x573782,_0x2a9631));}};Dialer[_0x7437('0x1e')][_0x7437('0x90')]=function(_0x2f1e95){if(_0x2f1e95['dialLimitQueue']>0x0){var _0x2be184=_0x2f1e95[_0x7437('0x207')]-_0x2f1e95[_0x7437('0x70')]-_0x2f1e95['talking'];if(_0x2be184>0x0){this[_0x7437('0x20b')](_0x2f1e95);}else{loggerPredictiveCalls['info']('[handlePredictive][limitChannel]');}}else{this[_0x7437('0x20b')](_0x2f1e95);}};Dialer[_0x7437('0x1e')]['tryOriginatePredictive']=function(_0x378625){var _0x5475b8=this;var _0x205c5d=[];_0x378625[_0x7437('0x70')]+=0x1;for(var _0x386dfe in this['agents']){if(typeof this[_0x7437('0x25')][_0x386dfe]!==_0x7437('0x97')){if(this[_0x7437('0x25')][_0x386dfe]['state']===_0x7437('0x208')&&this[_0x7437('0x25')][_0x386dfe]['status']===_0x7437('0xd1')){_0x205c5d[_0x7437('0x124')](this[_0x7437('0x25')][_0x386dfe]['id']);}}}this[_0x7437('0xbe')](_0x378625['id'],_0x205c5d,0x1,_0x378625['dialOrderByScheduledAt'],_0x378625)[_0x7437('0xb2')](function(_0x403b16){if(!checkContactEmpty(_0x403b16)){checkContactLowerLimitOriginate(_0x378625,0x1,0x0);_0x5475b8['countReScheduled'](_0x378625)['then'](sendMessageReschedule(_0x378625))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x378625[_0x7437('0x3f')]=_0x7437('0x200');if(_[_0x7437('0xd4')](_0x403b16[0x0])||_['isNil'](_0x403b16[0x0][_0x7437('0x165')])||_[_0x7437('0xd4')](_0x403b16[0x0][_0x7437('0x165')][_0x7437('0x166')])){_0x5475b8[_0x7437('0xc6')](_0x7437('0x201'),_0x378625,_0x403b16[0x0]);}else{_0x5475b8[_0x7437('0xb3')](_[_0x7437('0xc9')](_0x403b16[0x0],[_0x7437('0xcc'),_0x7437('0x203')]))[_0x7437('0xb2')](_0x5475b8[_0x7437('0x1e8')](_0x378625,_0x403b16[0x0]))[_0x7437('0xb4')](_0x5475b8[_0x7437('0xc5')](_0x7437('0x20c'),_0x378625));}}})['catch'](loggerGetContactDialer(_0x7437('0x20d'),_0x378625,0x1));emitVoiceQueueSummary(_0x378625);};Dialer[_0x7437('0x1e')][_0x7437('0x1de')]=function(_0x22565d,_0x94e619,_0x3b7a83,_0x5047cf,_0x5b1a9f,_0x49f065){loggerPredictive[_0x7437('0x7f')](_0x7437('0x20e'));loggerPredictive[_0x7437('0x7f')](_0x7437('0x20f'),_0x22565d);loggerPredictive['info'](_0x7437('0x210'),_0x94e619);loggerPredictive[_0x7437('0x7f')]('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',_0x3b7a83);loggerPredictive[_0x7437('0x7f')](_0x7437('0x211'),_0x5047cf);loggerPredictive[_0x7437('0x7f')](_0x7437('0x212'),_0x5b1a9f);loggerPredictive[_0x7437('0x7f')](_0x7437('0x86'));return new BPromise(function(_0x234453,_0x430144){if(_0x22565d<=0x0||isNaN(_0x22565d)){return _0x430144(msgResponse(_0x7437('0x213'),_0x7437('0x49'),'m\x20=\x20'+_0x22565d));}if(_0x3b7a83<=0x0||isNaN(_0x3b7a83)){return _0x430144(msgResponse(_0x7437('0x213'),_0x7437('0x49'),_0x7437('0x214')+_0x3b7a83));}if(_0x5047cf<=0x0||isNaN(_0x5047cf)){return _0x430144(msgResponse(_0x7437('0x213'),_0x7437('0x49'),'p\x20=\x20'+_0x5047cf));}if(_0x94e619<=0x0||isNaN(_0x94e619)){return _0x430144(msgResponse('[abandonmentRate]','Error',_0x7437('0x215')+_0x94e619));}if(_0x5b1a9f<=0x0||isNaN(_0x5b1a9f)){return _0x430144(msgResponse('[abandonmentRate]',_0x7437('0x49'),_0x7437('0x216')+_0x5b1a9f));}_0x49f065=_0x49f065||0x0;var _0x3a4bcb=0x1/_0x3b7a83;var _0x370240=0x0;var _0x440c2b=0x0;var _0x382ba5=0x0;var _0x1a1842=0x0;for(var _0x4cad6a=0x0;_0x382ba5<_0x5b1a9f;_0x4cad6a+=0x1){_0x440c2b=_0x4cad6a/_0x94e619;_0x370240=(_0x5047cf*_0x440c2b+_0x49f065)/_0x3a4bcb;_0x382ba5=erlangb(_0x370240,_0x22565d);_0x1a1842=_0x370240/_0x22565d*(0x1-erlangb(_0x370240,_0x22565d));}return _0x234453({'erlangCalls':_0x4cad6a,'erlangCallToSecond':_0x94e619/_0x4cad6a,'erlangAbandonmentRate':_0x382ba5,'erlangBusyFactor':_0x1a1842});});};Dialer[_0x7437('0x1e')]['busyFactor']=function(_0x2461be,_0x45a827,_0x14599c,_0x2ac4de,_0xb31741,_0x3fa424){loggerPredictive[_0x7437('0x7f')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x7437('0x7f')](_0x7437('0x20f'),_0x2461be);loggerPredictive['info'](_0x7437('0x210'),_0x45a827);loggerPredictive[_0x7437('0x7f')](_0x7437('0x217'),_0x14599c);loggerPredictive[_0x7437('0x7f')](_0x7437('0x211'),_0x2ac4de);loggerPredictive['info'](_0x7437('0x218'),_0xb31741);loggerPredictive['info']('---------------------------');return new BPromise(function(_0x2b9a67,_0x19cd54){if(_0x2461be<=0x0||isNaN(_0x2461be)){return _0x19cd54(msgResponse(_0x7437('0x219'),_0x7437('0x49'),'m\x20=\x20'+_0x2461be));}if(_0x14599c<=0x0||isNaN(_0x14599c)){return _0x19cd54(msgResponse(_0x7437('0x219'),_0x7437('0x49'),_0x7437('0x214')+_0x14599c));}if(_0x2ac4de<=0x0||isNaN(_0x2ac4de)){return _0x19cd54(msgResponse(_0x7437('0x219'),'Error',_0x7437('0x21a')+_0x2ac4de));}if(_0x45a827<=0x0||isNaN(_0x45a827)){return _0x19cd54(msgResponse(_0x7437('0x219'),'Error','interval\x20=\x20'+_0x45a827));}if(_0xb31741<=0x0||isNaN(_0xb31741)){return _0x19cd54(msgResponse('[busyFactor]',_0x7437('0x49'),'Umin\x20=\x20'+_0xb31741));}_0x3fa424=_0x3fa424||0x0;var _0x59c205=0x1/_0x14599c;var _0x37f9c8=0x0;var _0x192f7a=0x0;var _0x333543=0x0;var _0x7fde6f=0x0;for(var _0x432dff=0x0;_0x7fde6f<_0xb31741;_0x432dff+=0x1){_0x192f7a=_0x432dff/_0x45a827;_0x37f9c8=(_0x2ac4de*_0x192f7a+_0x3fa424)/_0x59c205;_0x333543=erlangb(_0x37f9c8,_0x2461be);_0x7fde6f=_0x37f9c8/_0x2461be*(0x1-erlangb(_0x37f9c8,_0x2461be));}return _0x2b9a67({'erlangCalls':_0x432dff,'erlangCallToSecond':_0x45a827/_0x432dff,'erlangAbandonmentRate':_0x333543,'erlangBusyFactor':_0x7fde6f});});};module[_0x7437('0x21b')]=Dialer; \ No newline at end of file +var _0xe2c7=['syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','isUndefined','message','name','NOT_ACTIVE','\x20INTERVAL_IS_NULL','Interval','Intervals','INTERVAL_IS_NULL','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','answered','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','startPredictive','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','originated','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','contactsRescheduled','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','waiting','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','endtime','starttime','[uniqueid]','clearZombieChannels','undefined','channel','catch','No\x20such\x20channel','[Dialer][checkChannel]','updateOriginated','queue','countReScheduled','resolve','checkIsBlackList','then','[checkIsBlackList]\x20','checkIsBlackListIvr','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','saveInDb','ContactId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','Success','SIP/%s','status','unmonitored','uniqueid','isNil','variable','exten','xcally-motion-dialer','dialAMDActive','HANGUP','statedesc','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','MACHINE','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countdropretry','countabandonedretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','add','minutes','ListId','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','countnosuchnumberretry','countagentrejectretry','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','Unknow','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','droptime','dialQueueTimeout','Drop','dropreason','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','calleridname','[syncAgentComplete][createHistory][11]','actionid','strategy','locked','paused','stateinterface','push','idHopper','[unlockQueueStatus][undefined]','run','[Catch][Preview][syncQueueStatusComplete]','finally','_rr','unlockRR','[booked][RR]','Agent:\x20','pick','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTime','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','Failure','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','Action','command','iftime\x20%s,%s','interval','timezones','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','user:%s','user:dialPreviewRecallReminder','launchHandleIvr','handleIvr','checkIsTrunkReachable','dialTimezone','dialPreviewRecallmeReminder','syncCampaigns','checkIfTime','dialGlobalInterval','checkIfTimeIntervals','[syncCampaigns]','\x5cw{0,','pow','replace','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outbound','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','responsetime','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','countcongestionretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','floor','startProgressive','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','averageHandleTime','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','busyFactor','startMethodPredictive','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','queueStatusComplete','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[booked][checkContactBlack][else]','dialRecallMeTimeout','Agent','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','loggerHandler','dialLimitQueue','not_inuse','reachable','dialOrderByScheduledAt','[countReScheduled]\x20','[actionOriginate]\x20','Contact.phone','tryOriginatePredictive','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/setting','./action','./final','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','rrmemory','roundrobin','prototype','enqueue','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','ivrOriginated','queueBooked','queueBookedRR','agentconnect'];(function(_0x1bf99a,_0x1e1bc8){var _0x4ea85f=function(_0x23c5c2){while(--_0x23c5c2){_0x1bf99a['push'](_0x1bf99a['shift']());}};_0x4ea85f(++_0x1e1bc8);}(_0xe2c7,0x1f1));var _0x7e2c=function(_0x3055ab,_0x4d1f74){_0x3055ab=_0x3055ab-0x0;var _0x31d336=_0xe2c7[_0x3055ab];return _0x31d336;};'use strict';var util=require(_0x7e2c('0x0'));var _=require(_0x7e2c('0x1'));var BPromise=require(_0x7e2c('0x2'));var uuid=require(_0x7e2c('0x3'));var moment=require(_0x7e2c('0x4'));var rr=require('rr');var md5=require(_0x7e2c('0x5'));var Redis=require(_0x7e2c('0x6'));var ut=require(_0x7e2c('0x7'));var config=require(_0x7e2c('0x8'));var logger=require(_0x7e2c('0x9'))(_0x7e2c('0xa'));var loggerBooked=require(_0x7e2c('0x9'))(_0x7e2c('0xb'));var loggerPredictive=require(_0x7e2c('0x9'))(_0x7e2c('0xc'));var loggerPredictiveCalls=require('../../../config/logger')(_0x7e2c('0xd'));var loggerSyncQueueSummary=require(_0x7e2c('0x9'))(_0x7e2c('0xe'));var ami=require(_0x7e2c('0xf'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7e2c('0x10')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x7e2c('0x11'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x7e2c('0x12'));var RpcSetting=require(_0x7e2c('0x13'));var Action=require(_0x7e2c('0x14'));var History=require('./history');var Final=require(_0x7e2c('0x15'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x7e2c('0x16'));var Hangup=require(_0x7e2c('0x17'));var ipAgi=process[_0x7e2c('0x18')][_0x7e2c('0x19')]||'127.0.0.1';var strategy={'rrmemory':_0x7e2c('0x1a'),'roundrobin':_0x7e2c('0x1b')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x7e2c('0x1c')][_0x7e2c('0x1d')]=function(_0x3f6c91){this[_0x7e2c('0x1e')]=this['tail']?this['tail']['finally'](_0x3f6c91):_0x3f6c91();};function Dialer(_0x35c87c,_0x1701dc){this[_0x7e2c('0x1f')]=new Sequence();this[_0x7e2c('0x20')]=_0x1701dc;this[_0x7e2c('0x21')]=_0x35c87c[_0x7e2c('0x21')];this[_0x7e2c('0x22')]=_0x35c87c[_0x7e2c('0x22')];this['agents']=_0x35c87c[_0x7e2c('0x23')];this['trunks']=_0x35c87c[_0x7e2c('0x24')];this[_0x7e2c('0x25')]=config['maxNumberOriginate']||0x2;this[_0x7e2c('0x26')]={};this[_0x7e2c('0x27')]={};this[_0x7e2c('0x28')]={};this[_0x7e2c('0x29')]={};this['optionPredictive']={};this['startPredictive']={};this['startProgressive']={};this[_0x7e2c('0x2a')]={};this[_0x7e2c('0x2b')]={};this[_0x7e2c('0x2c')]={};ami['on'](_0x7e2c('0x2d'),this[_0x7e2c('0x2e')][_0x7e2c('0x2f')](this));ami['on']('queuecallerabandon',this[_0x7e2c('0x30')]['bind'](this));ami['on'](_0x7e2c('0x31'),this[_0x7e2c('0x32')][_0x7e2c('0x2f')](this));ami['on'](_0x7e2c('0x33'),this[_0x7e2c('0x34')][_0x7e2c('0x2f')](this));ami['on'](_0x7e2c('0x35'),this[_0x7e2c('0xe')][_0x7e2c('0x2f')](this));ami['on']('hangup',this[_0x7e2c('0x36')]['bind'](this));ami['on'](_0x7e2c('0x37'),this[_0x7e2c('0x38')][_0x7e2c('0x2f')](this));ami['on'](_0x7e2c('0x39'),this[_0x7e2c('0x3a')][_0x7e2c('0x2f')](this));ami['on'](_0x7e2c('0x3b'),this[_0x7e2c('0x3c')][_0x7e2c('0x2f')](this));ami['on']('queuestatuscomplete',this[_0x7e2c('0x3d')]['bind'](this));this[_0x7e2c('0x3e')]();this[_0x7e2c('0x3f')]();RpcSetting[_0x7e2c('0x40')]()['then'](function(_0x1ed2d3){previewRecallmeReminderInterval=_0x1ed2d3[_0x7e2c('0x41')];});}function isNotNull(_0x522946){return _0x522946!==null&&!_[_0x7e2c('0x42')](_0x522946);}function checkIsLoggedIn(_0x360d08,_0x4f6267){return function(){if(_0x4f6267<=0x0){_0x360d08[_0x7e2c('0x43')]='AGENTS_NOT_LOGGED';throw _0x360d08[_0x7e2c('0x44')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x422933){return _0x422933;}function checkIsActive(_0x35645d,_0x224c0f){return function(){if(!isActive(_0x224c0f)){_0x35645d['message']=_0x7e2c('0x45');throw _0x35645d[_0x7e2c('0x44')]+'\x20NOT\x20Active';}};}function checkInterval(_0x501de1){return function(){if(!isNotNull(_0x501de1['Interval'])){_0x501de1[_0x7e2c('0x43')]='INTERVAL_IS_NULL';throw _0x501de1[_0x7e2c('0x44')]+_0x7e2c('0x46');}if(!isNotNull(_0x501de1[_0x7e2c('0x47')]['Intervals'])){_0x501de1[_0x7e2c('0x43')]='INTERVAL_IS_NULL';throw _0x501de1[_0x7e2c('0x44')]+_0x7e2c('0x46');}if(!isNotNull(_['isEmpty'](_0x501de1[_0x7e2c('0x47')][_0x7e2c('0x48')]))){_0x501de1[_0x7e2c('0x43')]=_0x7e2c('0x49');throw _0x501de1['name']+_0x7e2c('0x46');}};}function msgResponse(_0x3e56c1,_0x493e8e,_0x4ee4fe){return{'action':_0x3e56c1,'response':_0x493e8e,'message':_0x4ee4fe,'stack':_0x4ee4fe};}function myreject(_0x39fbc9){return function(_0x1a938a){return _0x39fbc9(msgResponse(_0x7e2c('0x4a'),_0x7e2c('0x4b'),JSON[_0x7e2c('0x4c')](_0x1a938a)));};}function getSeconds(_0x572981,_0x274166){var _0x29e741=moment(_0x572981)[_0x7e2c('0x4d')](0x0);var _0x29e61a=moment(_0x274166)[_0x7e2c('0x4d')](0x0);return _0x29e741[_0x7e2c('0x4e')](_0x29e61a,_0x7e2c('0x4f'));}function emit(_0x3c7737,_0x1742c3,_0x38fb66){io['to'](_0x3c7737)[_0x7e2c('0x50')](_0x1742c3,_0x38fb66);}function emitVoiceQueueSummary(_0x199f3d){if(_0x199f3d[_0x7e2c('0x51')]==='outbound'){var _0x363157={'id':_0x199f3d['id'],'name':_0x199f3d['name'],'strategy':_0x199f3d['strategy'],'answered':_0x199f3d[_0x7e2c('0x52')],'available':_0x199f3d['available'],'loggedIn':_0x199f3d['loggedIn'],'pTalking':_0x199f3d[_0x7e2c('0x53')],'sumBillable':_0x199f3d[_0x7e2c('0x54')],'sumDuration':_0x199f3d[_0x7e2c('0x55')],'sumHoldTime':_0x199f3d[_0x7e2c('0x56')]||0x0,'talking':_0x199f3d[_0x7e2c('0x57')],'total':_0x199f3d[_0x7e2c('0x58')],'type':_0x199f3d[_0x7e2c('0x51')],'unmanaged':_0x199f3d[_0x7e2c('0x59')],'abandoned':_0x199f3d[_0x7e2c('0x5a')],'waiting':_0x199f3d['waiting'],'loggedInDb':_0x199f3d[_0x7e2c('0x5b')],'dialActive':_0x199f3d[_0x7e2c('0x5c')],'dialMethod':_0x199f3d[_0x7e2c('0x5d')],'dialOriginateCallerIdName':_0x199f3d[_0x7e2c('0x5e')],'dialOriginateCallerIdNumber':_0x199f3d[_0x7e2c('0x5f')],'dialOriginateTimeout':_0x199f3d[_0x7e2c('0x60')],'dialPrefix':_0x199f3d[_0x7e2c('0x61')],'outboundAnswerAgiCallsDay':_0x199f3d[_0x7e2c('0x62')],'outboundAnswerCallsDay':_0x199f3d[_0x7e2c('0x63')],'outboundBlacklistCallsDay':_0x199f3d[_0x7e2c('0x64')],'outboundBusyCallsDay':_0x199f3d[_0x7e2c('0x65')],'outboundCongestionCallsDay':_0x199f3d[_0x7e2c('0x66')],'outboundDropCallsDayACS':_0x199f3d[_0x7e2c('0x67')],'outboundDropCallsDayCallersExit':_0x199f3d[_0x7e2c('0x68')],'outboundDropCallsDayTimeout':_0x199f3d[_0x7e2c('0x69')],'outboundNoAnswerCallsDay':_0x199f3d[_0x7e2c('0x6a')],'outboundNoSuchCallsDay':_0x199f3d[_0x7e2c('0x6b')],'outboundOriginateFailureCallsDay':_0x199f3d[_0x7e2c('0x6c')],'outboundReCallsDay':_0x199f3d[_0x7e2c('0x6d')],'outboundRejectCallsDay':_0x199f3d['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x199f3d['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x199f3d['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x199f3d[_0x7e2c('0x6e')],'predictiveIntervalAvgTalktime':_0x199f3d[_0x7e2c('0x6f')],'predictiveIntervalDroppedCallsCallersExit':_0x199f3d[_0x7e2c('0x70')],'predictiveIntervalDroppedCallsTimeout':_0x199f3d['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x199f3d['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x199f3d[_0x7e2c('0x71')],'predictiveIntervalHitRate':_0x199f3d[_0x7e2c('0x72')],'predictiveIntervalMultiplicativeFactor':_0x199f3d[_0x7e2c('0x73')],'predictiveIntervalPauses':_0x199f3d[_0x7e2c('0x74')],'predictiveIntervalAvailable':_0x199f3d[_0x7e2c('0x75')],'predictiveIntervalTotalCalls':_0x199f3d[_0x7e2c('0x76')],'message':_0x199f3d[_0x7e2c('0x43')],'originated':_0x199f3d['originated'],'erlangCalls':_0x199f3d[_0x7e2c('0x77')],'erlangCallToSecond':_0x199f3d[_0x7e2c('0x78')],'erlangAbandonmentRate':_0x199f3d['erlangAbandonmentRate'],'erlangBusyFactor':_0x199f3d['erlangBusyFactor'],'startPredictive':_0x199f3d[_0x7e2c('0x79')],'startProgressive':_0x199f3d['startProgressive']};if(_0x199f3d[_0x7e2c('0x7a')]){_0x363157['Trunk']={'id':_0x199f3d[_0x7e2c('0x7a')]['id'],'name':_0x199f3d['Trunk'][_0x7e2c('0x44')],'active':_0x199f3d[_0x7e2c('0x7a')][_0x7e2c('0x7b')],'callerid':_0x199f3d[_0x7e2c('0x7a')][_0x7e2c('0x7c')]};}if(_0x199f3d[_0x7e2c('0x47')]){_0x363157[_0x7e2c('0x47')]={'id':_0x199f3d[_0x7e2c('0x47')]['id'],'name':_0x199f3d[_0x7e2c('0x47')]['name']};}var _0x448954=md5(JSON[_0x7e2c('0x4c')](_0x363157));if(_0x199f3d[_0x7e2c('0x5')]!==_0x448954){_0x199f3d['md5']=_0x448954;emit(util[_0x7e2c('0x7d')](_0x7e2c('0x7e'),_0x363157[_0x7e2c('0x44')]),_0x7e2c('0x7f'),_0x363157);}}}function emitCampaignSummary(_0x4e3593){if(_0x4e3593['type']===_0x7e2c('0x80')){emit(util[_0x7e2c('0x7d')](_0x7e2c('0x81'),_0x4e3593[_0x7e2c('0x44')]),'campaign:save',_0x4e3593);}}function checkGetDataPredictive(_0x55ffe6){if(isNotNull(_0x55ffe6)&&!_[_0x7e2c('0x82')](_0x55ffe6)){loggerPredictive[_0x7e2c('0x83')](_0x7e2c('0x84'));loggerPredictive[_0x7e2c('0x83')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x55ffe6[_0x7e2c('0x76')]);loggerPredictive[_0x7e2c('0x83')](_0x7e2c('0x85'),_0x55ffe6[_0x7e2c('0x86')]);loggerPredictive[_0x7e2c('0x83')](_0x7e2c('0x87'),_0x55ffe6[_0x7e2c('0x88')]);loggerPredictive[_0x7e2c('0x83')](_0x7e2c('0x89'),_0x55ffe6[_0x7e2c('0x70')]);loggerPredictive[_0x7e2c('0x83')](_0x7e2c('0x8a'),_0x55ffe6[_0x7e2c('0x6e')]);loggerPredictive[_0x7e2c('0x83')](_0x7e2c('0x8b'),_0x55ffe6[_0x7e2c('0x6f')]);loggerPredictive['info'](_0x7e2c('0x8c'));if(_0x55ffe6[_0x7e2c('0x76')]>0x0){if(!_[_0x7e2c('0x42')](_0x55ffe6[_0x7e2c('0x6f')])&&_0x55ffe6['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive['info'](_0x7e2c('0x8d'));if(!_['isUndefined'](_0x55ffe6['predictiveIntervalAvgHoldtime'])&&_0x55ffe6[_0x7e2c('0x6e')]>0x0){return!![];}loggerPredictive[_0x7e2c('0x83')](_0x7e2c('0x8e'));}else{loggerPredictive['info'](_0x7e2c('0x8f'));}}else{loggerPredictive['info'](_0x7e2c('0x90'));}return![];}function mergeDataErlangB(_0xc9cb4c){return function(_0x1e7de7){loggerPredictive[_0x7e2c('0x83')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x7e2c('0x83')](_0x7e2c('0x91'),_0x1e7de7['erlangCalls']);loggerPredictive[_0x7e2c('0x83')](_0x7e2c('0x92'),_0x1e7de7['erlangCallToSecond']);loggerPredictive[_0x7e2c('0x83')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1e7de7[_0x7e2c('0x93')]);loggerPredictive[_0x7e2c('0x83')](_0x7e2c('0x94'),_0x1e7de7[_0x7e2c('0x95')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1e7de7[_0x7e2c('0x93')]);loggerPredictive[_0x7e2c('0x83')](_0x7e2c('0x8c'));_[_0x7e2c('0x96')](_0xc9cb4c,_0x1e7de7);};}function getDiff(_0x3c6129){var _0x39d816=moment()[_0x7e2c('0x4d')](0x0);var _0x3c6423=moment(_0x3c6129)[_0x7e2c('0x4d')](0x0);return _0x39d816[_0x7e2c('0x4e')](_0x3c6423,'seconds');}function ifInterval(_0x105a94,_0x2b5f6a){if(_[_0x7e2c('0x42')](_0x2b5f6a)){return![];}return getDiff(_0x2b5f6a)<_0x105a94*0x3c;}function freeVariablesPredictive(_0x4ea9bb){if(isNotNull(_0x4ea9bb)){if(!_[_0x7e2c('0x42')](_0x4ea9bb['startProgressive'])){_0x4ea9bb['startProgressive']=undefined;loggerPredictive[_0x7e2c('0x83')](_0x4ea9bb['name'],_0x7e2c('0x97'));}if(!_[_0x7e2c('0x42')](_0x4ea9bb[_0x7e2c('0x79')])){_0x4ea9bb['startPredictive']=undefined;loggerPredictive[_0x7e2c('0x83')](_0x4ea9bb['name'],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x7e2c('0x42')](_0x4ea9bb[_0x7e2c('0x98')])){clearInterval(_0x4ea9bb[_0x7e2c('0x98')]);_0x4ea9bb['handlePredictive']=undefined;loggerPredictive['info'](_0x4ea9bb[_0x7e2c('0x44')],_0x7e2c('0x99'));}}}function erlangb(_0x5bd8ac,_0x47d489){if(_0x47d489===0x0){return 0x0;}var _0x1149d8=0x1;for(var _0xeeb8d5=0x1;_0xeeb8d5<=_0x47d489;_0xeeb8d5+=0x1){_0x1149d8=0x1+_0x1149d8*_0xeeb8d5/_0x5bd8ac;}return 0x1/_0x1149d8;}function isVoiceQueueOutbound(_0x108cb3){return _0x108cb3==='outbound';}function isNotPreview(_0x52584c){return _0x52584c!==_0x7e2c('0x20');}function isCampaignIvr(_0x56c756){return _0x56c756===_0x7e2c('0x80');}function getCallerId(_0x28984c,_0xee079e,_0x2219fe){if(!_[_0x7e2c('0x42')](_0x2219fe)&&typeof _0x2219fe==='string'&&!_[_0x7e2c('0x82')](_0x2219fe)){if(!_[_0x7e2c('0x42')](_0xee079e)&&typeof _0xee079e===_0x7e2c('0x9a')&&!_[_0x7e2c('0x82')](_0xee079e)){return util[_0x7e2c('0x7d')](_0x7e2c('0x9b'),_0xee079e,_0x2219fe);}return util[_0x7e2c('0x7d')](_0x7e2c('0x9b'),_0x2219fe,_0x2219fe);}if(!_[_0x7e2c('0x42')](_0x28984c)&&typeof _0x28984c===_0x7e2c('0x9a')&&!_['isEmpty'](_0x28984c)){return _0x28984c;}return _0x7e2c('0x9c');}function loggerCatchQueueSummary(_0x170e52,_0x5d2174){return function(_0x2aac59){freeVariablesPredictive(_0x5d2174);emitVoiceQueueSummary(_0x5d2174);emitCampaignSummary(_0x5d2174);loggerSyncQueueSummary[_0x7e2c('0x9d')](_0x170e52,util[_0x7e2c('0x9e')](_0x2aac59,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x4daba5,_0x25a973){return function(_0x39ceb7){loggerPredictive[_0x7e2c('0x9d')](_0x25a973[_0x7e2c('0x44')],_0x4daba5);loggerPredictive['error'](_0x39ceb7[_0x7e2c('0x9f')]);freeVariablesPredictive(_0x25a973);};}function loggerCatch(_0x1e3fe8){return function(_0x4837d3){logger[_0x7e2c('0x9d')](_0x1e3fe8,util[_0x7e2c('0x9e')](_0x4837d3,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x57ca52){return _0x57ca52&&!_[_0x7e2c('0x42')](_0x57ca52)&&_0x57ca52[_0x7e2c('0xa0')]>0x0;}function decremetOriginate(_0x533e06){if(!_['isUndefined'](_0x533e06)&&_0x533e06!==null){if(typeof _0x533e06['originated']!=='undefined'){if(_0x533e06[_0x7e2c('0xa1')]>0x0){_0x533e06['originated']-=0x1;}else{logger['error'](_0x7e2c('0xa2'));}}}else{logger[_0x7e2c('0x9d')](_0x7e2c('0xa3'));}}function checkContactLowerLimitOriginate(_0x5d2302,_0x366bad,_0x906ec0){if(_0x366bad>_0x906ec0){for(var _0x58d8c4=0x0;_0x58d8c4<_0x366bad-_0x906ec0;_0x58d8c4+=0x1){decremetOriginate(_0x5d2302);}}}function loggerGetContactDialer(_0x1dc272,_0x288741,_0xb6fbdd){return function(_0x1401f9){checkContactLowerLimitOriginate(_0x288741,_0xb6fbdd,0x0);logger[_0x7e2c('0x9d')](_0x1dc272,util[_0x7e2c('0x9e')](_0x1401f9,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x55c2e7){return function(_0x7211ae){if(isNotNull(_0x7211ae)&&isNotNull(_0x7211ae[0x0])){if(_0x7211ae[0x0]['contactsRescheduled']>0x0){_0x55c2e7[_0x7e2c('0x43')]=_0x7e2c('0xa4');logger[_0x7e2c('0x83')]('[getContactDialer2][ReScheduled]'+_0x55c2e7[_0x7e2c('0x44')],_0x7211ae[0x0][_0x7e2c('0xa5')],'contacts');}else{_0x55c2e7[_0x7e2c('0x43')]=_0x7e2c('0xa6');logger[_0x7e2c('0x83')]('[getContactDialer2][Empty]'+_0x55c2e7['name']);}}};}function notSendMessagesQueue(_0x1105e1){if(_0x1105e1[_0x7e2c('0xa7')]){freeVariablesPredictive(_0x1105e1);if(_0x1105e1[_0x7e2c('0xa1')]===0x0&&_0x1105e1[_0x7e2c('0x57')]===0x0&&_0x1105e1[_0x7e2c('0xa8')]===0x0&&(_0x1105e1['pTalking']||0x0)===0x0){_0x1105e1[_0x7e2c('0xa7')]=![];_0x1105e1[_0x7e2c('0xa9')]=0x0;_0x1105e1[_0x7e2c('0x43')]=_0x7e2c('0x45');loggerSyncQueueSummary[_0x7e2c('0x9d')](_0x7e2c('0xaa'),_0x1105e1[_0x7e2c('0x44')],_0x7e2c('0xab'));}else{_0x1105e1[_0x7e2c('0x43')]=_0x7e2c('0xac');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x1105e1[_0x7e2c('0x44')],'is\x20disactive');}emitVoiceQueueSummary(_0x1105e1);}}function notSendMessagesCampaign(_0x43a1c){if(_0x43a1c['sendMessageOneNotActive']){if(_0x43a1c['originated']===0x0){_0x43a1c[_0x7e2c('0xa7')]=![];_0x43a1c[_0x7e2c('0x43')]=_0x7e2c('0x45');loggerSyncQueueSummary[_0x7e2c('0x9d')](_0x7e2c('0xad'),_0x43a1c[_0x7e2c('0x44')],'is\x20not\x20active');}else{_0x43a1c['message']=_0x7e2c('0xac');loggerSyncQueueSummary[_0x7e2c('0x9d')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x43a1c[_0x7e2c('0x44')],'is\x20disactive');}emitCampaignSummary(_0x43a1c);}}function createObjHistory(_0x1f3d69,_0x464d2a,_0x5ee328,_0x3aa2ec,_0x34b5f1){_0x1f3d69[_0x7e2c('0x43')]=_0x5ee328;var _0x14109f=new Action(_0x1f3d69,_0x464d2a);var _0x13d79f=new History(_0x14109f);_0x13d79f[_0x7e2c('0xae')]=_0x3aa2ec;_0x13d79f['statedesc']=_0x34b5f1;_0x13d79f[_0x7e2c('0xaf')]=_0x14109f[_0x7e2c('0xb0')];return _0x13d79f;}Dialer[_0x7e2c('0x1c')][_0x7e2c('0x3f')]=function(){var _0x849cbd=this;setInterval(function(){_0x849cbd['clearZombieChannels'](_0x849cbd[_0x7e2c('0x29')],_0x7e2c('0xb1'));_0x849cbd[_0x7e2c('0xb2')](_0x849cbd[_0x7e2c('0x27')],'[actions]');},0x32c8);};Dialer[_0x7e2c('0x1c')][_0x7e2c('0xb2')]=function(_0x2b3b9a,_0x3cca8f){var _0xc20df3=this;for(var _0x181b1a in _0x2b3b9a){if(typeof _0x2b3b9a[_0x181b1a]!==_0x7e2c('0xb3')){this['sequence'][_0x7e2c('0x1d')](function(){if(!_['isNil'](_0x2b3b9a[_0x181b1a])){return ami['Action']({'action':'status','channel':_0x2b3b9a[_0x181b1a][_0x7e2c('0xb4')]})[_0x7e2c('0xb5')](function(_0x3c0181){if(_0x3c0181[_0x7e2c('0x43')]===_0x7e2c('0xb6')){setTimeout(function(){if(_0x2b3b9a[_0x181b1a]&&_0x2b3b9a[_0x181b1a][_0x7e2c('0x51')]!==_0x7e2c('0x80')){_0xc20df3['updateOriginated'](_0xc20df3[_0x7e2c('0x21')][_0x2b3b9a[_0x181b1a]['queue']]);logger[_0x7e2c('0x9d')](_0x7e2c('0xb7'),_0x3cca8f,_0x181b1a,_0x2b3b9a[_0x181b1a]['queue']);delete _0x2b3b9a[_0x181b1a];}if(_0x2b3b9a[_0x181b1a]&&_0x2b3b9a[_0x181b1a][_0x7e2c('0x51')]==='ivr'){_0xc20df3[_0x7e2c('0xb8')](_0xc20df3[_0x7e2c('0x22')][_0x2b3b9a[_0x181b1a][_0x7e2c('0xb9')]]);logger['error']('[Dialer][checkChannel][ivr]',_0x3cca8f,_0x181b1a,_0x2b3b9a[_0x181b1a][_0x7e2c('0xb9')]);delete _0x2b3b9a[_0x181b1a];}},0x2328);}});}});}}};Dialer[_0x7e2c('0x1c')][_0x7e2c('0xba')]=function(_0x2f85a1){return BPromise[_0x7e2c('0xbb')]()['then'](cmHopper[_0x7e2c('0xba')](_0x2f85a1))[_0x7e2c('0xb5')](loggerCatch('[countReScheduled]\x20'));};Dialer['prototype'][_0x7e2c('0xbc')]=function(_0x521647){return BPromise[_0x7e2c('0xbb')]()[_0x7e2c('0xbd')](cmHopperBlack[_0x7e2c('0xbc')](_0x521647))[_0x7e2c('0xb5')](loggerCatch(_0x7e2c('0xbe')));};Dialer[_0x7e2c('0x1c')][_0x7e2c('0xbf')]=function(_0x5c03c4){return BPromise[_0x7e2c('0xbb')]()[_0x7e2c('0xbd')](cmHopperBlack[_0x7e2c('0xbf')](_0x5c03c4))[_0x7e2c('0xb5')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0x7e2c('0x1c')]['averageHandleTime']=function(_0x5a7042){return BPromise['resolve']()[_0x7e2c('0xbd')](cmHopperHistory[_0x7e2c('0xc0')](_0x5a7042))['catch'](loggerCatch(_0x7e2c('0xc1')));};Dialer[_0x7e2c('0x1c')][_0x7e2c('0xc2')]=function(_0x5e1db8){return BPromise[_0x7e2c('0xbb')]()[_0x7e2c('0xbd')](cmHopper['rescheduleContact'](_0x5e1db8))[_0x7e2c('0xb5')](loggerCatch(_0x7e2c('0xc3')));};Dialer['prototype'][_0x7e2c('0xc4')]=function(_0x2eecf6,_0x5a45d0,_0x123901){return BPromise[_0x7e2c('0xbb')]()[_0x7e2c('0xbd')](cmHopper[_0x7e2c('0xc4')](_0x2eecf6,_0x5a45d0,_0x123901))['catch'](loggerCatch('[unlockContact]\x20'));};Dialer[_0x7e2c('0x1c')]['getContactDialer']=function(_0x3ce7f0,_0xb420fc,_0xc63e2,_0x436120,_0x238050){return BPromise[_0x7e2c('0xbb')]()['then'](cmHopper[_0x7e2c('0xc5')](_0x3ce7f0,_0xb420fc,_0xc63e2,_0x436120))[_0x7e2c('0xb5')](function(_0x125e22){_0x238050[_0x7e2c('0xc6')]-=_0xc63e2;_0x238050[_0x7e2c('0xc6')]=_0x238050['temp']>0x0?_0x238050['temp']:0x0;loggerCatch(_0x7e2c('0xc7'))(_0x125e22);});};Dialer[_0x7e2c('0x1c')][_0x7e2c('0xc8')]=function(_0x54c2ce,_0x4438bf,_0x4b6f98,_0x4a1592){return BPromise[_0x7e2c('0xbb')]()['then'](cmHopper['getContactDialerIvr'](_0x54c2ce,_0x4438bf,_0x4b6f98))[_0x7e2c('0xb5')](function(_0x350fa9){_0x4a1592[_0x7e2c('0xc6')]-=_0x4438bf;_0x4a1592[_0x7e2c('0xc6')]=_0x4a1592[_0x7e2c('0xc6')]>0x0?_0x4a1592[_0x7e2c('0xc6')]:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x350fa9);});};Dialer[_0x7e2c('0x1c')][_0x7e2c('0xc9')]=function(_0x41c804){return BPromise[_0x7e2c('0xbb')]()[_0x7e2c('0xbd')](voiceQueueRt['getVoiceQueueRtPauses'](_0x41c804))[_0x7e2c('0xb5')](loggerCatch(_0x7e2c('0xca')));};Dialer[_0x7e2c('0x1c')][_0x7e2c('0xcb')]=function(_0x5363b6){return BPromise['resolve']()[_0x7e2c('0xbd')](cmHopper['moveContactManagedDialer'](_0x5363b6))[_0x7e2c('0xb5')](loggerCatch(_0x7e2c('0xcc')));};Dialer['prototype']['createHistory']=function(_0x6f9237){return BPromise[_0x7e2c('0xbb')]()[_0x7e2c('0xbd')](cmHopperHistory[_0x7e2c('0xcd')](_0x6f9237))[_0x7e2c('0xb5')](loggerCatch(_0x7e2c('0xce')));};Dialer[_0x7e2c('0x1c')]['updateOriginated']=function(_0x40feaf){if(!_['isUndefined'](_0x40feaf)&&_0x40feaf!==null){if(typeof _0x40feaf[_0x7e2c('0xa1')]!==_0x7e2c('0xb3')){if(_0x40feaf['originated']>0x0){_0x40feaf[_0x7e2c('0xa1')]-=0x1;}else{logger[_0x7e2c('0x9d')](_0x7e2c('0xcf'));}}}else{logger[_0x7e2c('0x9d')](_0x7e2c('0xd0'));}};Dialer['prototype']['loggerHandler']=function(_0x36b72e,_0xe70c4f){var _0x59d0da=this;return function(_0x3e0647){_0x59d0da[_0x7e2c('0xb8')](_0xe70c4f);logger['error'](_0x36b72e,util[_0x7e2c('0x9e')](_0x3e0647,{'showHidden':![],'depth':null}));};};Dialer[_0x7e2c('0x1c')][_0x7e2c('0xd1')]=function(_0x506172,_0x3adea0,_0x1ffb56){var _0x15dd92={'state':0x19,'statedesc':'notFound'};this[_0x7e2c('0xb8')](_0x3adea0);this[_0x7e2c('0xd2')](_[_0x7e2c('0x96')](_0x15dd92,_['pick'](_0x1ffb56,[_0x7e2c('0xd3'),'ListId',_0x7e2c('0xd4'),_0x7e2c('0xd5'),_0x7e2c('0xd6')])),_0x7e2c('0xd7'),_0x7e2c('0xd8'));logger[_0x7e2c('0x9d')](_0x506172);};Dialer['prototype']['isSuccess']=function(_0x82bfe4){return _0x82bfe4===_0x7e2c('0xd9');};Dialer[_0x7e2c('0x1c')]['isTrunkReachable']=function(_0x1b2a98){return!_[_0x7e2c('0x42')](_0x1b2a98)&&_0x1b2a98&&!_[_0x7e2c('0x42')](_0x1b2a98['name'])&&!_['isUndefined'](_0x1b2a98[_0x7e2c('0x7b')])&&_0x1b2a98[_0x7e2c('0x7b')]&&(this[_0x7e2c('0x24')][util[_0x7e2c('0x7d')](_0x7e2c('0xda'),_0x1b2a98[_0x7e2c('0x44')])][_0x7e2c('0xdb')]==='reachable'||this['trunks'][util[_0x7e2c('0x7d')](_0x7e2c('0xda'),_0x1b2a98[_0x7e2c('0x44')])][_0x7e2c('0xdb')]===_0x7e2c('0xdc'));};Dialer[_0x7e2c('0x1c')]['saveInDb']=function(_0x559044,_0x5761c5,_0x3e2bfa){this[_0x7e2c('0xcd')](_0x559044)[_0x7e2c('0xb5')](loggerCatch(_0x5761c5));this[_0x7e2c('0xcb')](_0x559044)[_0x7e2c('0xb5')](loggerCatch(_0x3e2bfa));};Dialer['prototype'][_0x7e2c('0x3a')]=function(_0x163319){var _0x45e08f=this[_0x7e2c('0x29')][_0x163319[_0x7e2c('0xdd')]];var _0x2df292;if(!_[_0x7e2c('0xde')](_0x163319)&&!_[_0x7e2c('0xde')](_0x163319['variable'])&&!_['isNil'](_0x163319[_0x7e2c('0xdf')]['amdstatus'])&&_0x163319[_0x7e2c('0xe0')]===_0x7e2c('0xe1')&&_0x45e08f){if(_0x45e08f['type']!==_0x7e2c('0x80')&&this[_0x7e2c('0x21')][_0x45e08f[_0x7e2c('0xb9')]][_0x7e2c('0xe2')]&&_0x163319['value']===_0x7e2c('0xe3')){delete this['uniqueId'][_0x163319[_0x7e2c('0xdd')]];this[_0x7e2c('0xb8')](this[_0x7e2c('0x21')][_0x45e08f['queue']]);this[_0x7e2c('0x21')][_0x45e08f[_0x7e2c('0xb9')]][_0x7e2c('0x63')]+=0x1;this[_0x7e2c('0x21')][_0x45e08f[_0x7e2c('0xb9')]]['outboundAnswerAgiCallsDay']+=0x1;_0x2df292=new Hangup(_0x45e08f,_0x163319);_0x2df292[_0x7e2c('0xae')]=0x12;_0x2df292[_0x7e2c('0xe4')]='HangupInAMD';_0x2df292[_0x7e2c('0xe5')]=_0x7e2c('0xe6');ami[_0x7e2c('0x50')](_0x7e2c('0xe7'),ut[_0x7e2c('0xe8')](_0x2df292,_0x7e2c('0xe9')));this['saveInDb'](_0x2df292,_0x7e2c('0xea'),_0x7e2c('0xeb'));}if(_0x45e08f[_0x7e2c('0x51')]!==_0x7e2c('0x80')&&this[_0x7e2c('0x21')][_0x45e08f['queue']][_0x7e2c('0xe2')]&&_0x163319[_0x7e2c('0xec')]===_0x7e2c('0xed')){var _0x33c6cd=this;return new BPromise(function(_0x413cf6,_0x412414){delete _0x33c6cd['uniqueId'][_0x163319[_0x7e2c('0xdd')]];_0x33c6cd[_0x7e2c('0xb8')](_0x33c6cd[_0x7e2c('0x21')][_0x45e08f[_0x7e2c('0xb9')]]);_0x33c6cd[_0x7e2c('0x21')][_0x45e08f[_0x7e2c('0xb9')]][_0x7e2c('0x63')]+=0x1;_0x33c6cd[_0x7e2c('0x21')][_0x45e08f[_0x7e2c('0xb9')]][_0x7e2c('0x62')]+=0x1;var _0x84aa27=_0x33c6cd[_0x7e2c('0x21')][_0x45e08f['queue']];var _0x2f964c=new Hangup(_0x45e08f,_0x163319);_0x2f964c[_0x7e2c('0xae')]=0x13;_0x2f964c['statedesc']='Machine';_0x2f964c[_0x7e2c('0xe5')]='AMD';_0x2f964c[_0x7e2c('0xee')]+=0x1;_0x2f964c[_0x7e2c('0xef')]+=0x1;_0x2f964c[_0x7e2c('0xe9')]=!![];ami['emit'](_0x7e2c('0xe7'),ut[_0x7e2c('0xe8')](_0x2f964c,'amd'));_0x33c6cd[_0x7e2c('0xcd')](_0x2f964c)['catch'](loggerCatch(_0x7e2c('0xf0')));if(_0x2f964c[_0x7e2c('0xf1')]+_0x2f964c['countcongestionretry']+_0x2f964c[_0x7e2c('0xf2')]+_0x2f964c['countnosuchnumberretry']+_0x2f964c[_0x7e2c('0xf3')]+_0x2f964c[_0x7e2c('0xf4')]+_0x2f964c[_0x7e2c('0xee')]+_0x2f964c['countagentrejectretry']>=_0x84aa27[_0x7e2c('0xf5')]){_0x33c6cd[_0x7e2c('0xf6')](_0x2f964c,_0x413cf6,_0x412414,_0x7e2c('0xf7'));}else{if(_0x2f964c['countmachineretry']>=_0x84aa27[_0x7e2c('0xf8')]){_0x33c6cd[_0x7e2c('0xf9')](_0x2f964c,_0x413cf6,_0x412414,'reason\x2019\x20machine....');}else{_0x33c6cd[_0x7e2c('0xc2')]({'active':![],'countmachineretry':_0x2f964c[_0x7e2c('0xee')],'scheduledat':moment()[_0x7e2c('0xfa')](_0x84aa27['dialMachineRetryFrequency'],_0x7e2c('0xfb'))[_0x7e2c('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2f964c['ContactId'],'ListId':_0x2f964c[_0x7e2c('0xfc')],'VoiceQueueId':_0x2f964c[_0x7e2c('0xd5')]||undefined,'CampaignId':_0x2f964c['CampaignId']||undefined})[_0x7e2c('0xb5')](loggerCatch(_0x7e2c('0xfd')));_0x413cf6({'reschedule':0x1});}}});}if(_0x45e08f[_0x7e2c('0x51')]===_0x7e2c('0x80')&&this[_0x7e2c('0x22')][_0x45e08f['queue']]['dialAMDActive']&&_0x163319['value']==='HANGUP'){delete this['uniqueId'][_0x163319[_0x7e2c('0xdd')]];this['updateOriginated'](this[_0x7e2c('0x22')][_0x45e08f[_0x7e2c('0xb9')]]);_0x2df292=new Hangup(_0x45e08f,_0x163319);_0x2df292[_0x7e2c('0xae')]=0x12;_0x2df292[_0x7e2c('0xe4')]=_0x7e2c('0xfe');_0x2df292['membername']=_0x7e2c('0xe6');ami[_0x7e2c('0x50')](_0x7e2c('0xe7'),ut[_0x7e2c('0xe8')](_0x2df292,_0x7e2c('0xe9')));this[_0x7e2c('0xd2')](_0x2df292,_0x7e2c('0xff'),_0x7e2c('0x100'));}if(_0x45e08f[_0x7e2c('0x51')]===_0x7e2c('0x80')&&this['campaigns'][_0x45e08f[_0x7e2c('0xb9')]]['dialAMDActive']&&_0x163319[_0x7e2c('0xec')]===_0x7e2c('0xed')){var _0x33c6cd=this;return new BPromise(function(_0x2dcc89,_0x47f0f5){delete _0x33c6cd[_0x7e2c('0x29')][_0x163319[_0x7e2c('0xdd')]];_0x33c6cd[_0x7e2c('0xb8')](_0x33c6cd[_0x7e2c('0x22')][_0x45e08f['queue']]);_0x33c6cd['campaigns'][_0x45e08f[_0x7e2c('0xb9')]][_0x7e2c('0x63')]+=0x1;_0x33c6cd['campaigns'][_0x45e08f['queue']][_0x7e2c('0x62')]+=0x1;var _0x2226a4=_0x33c6cd[_0x7e2c('0x22')][_0x45e08f['queue']];var _0x2e3acb=new Hangup(_0x45e08f,_0x163319);_0x2e3acb[_0x7e2c('0xae')]=0x13;_0x2e3acb[_0x7e2c('0xe4')]=_0x7e2c('0x101');_0x2e3acb[_0x7e2c('0xe5')]='AMD';_0x2e3acb[_0x7e2c('0xee')]+=0x1;_0x2e3acb['countglobal']+=0x1;_0x2e3acb['amd']=!![];ami[_0x7e2c('0x50')]('custom:amd',ut['buildObj'](_0x2e3acb,_0x7e2c('0xe9')));_0x33c6cd['createHistory'](_0x2e3acb)[_0x7e2c('0xb5')](loggerCatch(_0x7e2c('0xf0')));if(_0x2e3acb['countbusyretry']+_0x2e3acb['countcongestionretry']+_0x2e3acb[_0x7e2c('0xf2')]+_0x2e3acb[_0x7e2c('0x102')]+_0x2e3acb[_0x7e2c('0xf3')]+_0x2e3acb['countabandonedretry']+_0x2e3acb[_0x7e2c('0xee')]+_0x2e3acb[_0x7e2c('0x103')]>=_0x2226a4[_0x7e2c('0xf5')]){_0x33c6cd[_0x7e2c('0xf6')](_0x2e3acb,_0x2dcc89,_0x47f0f5,_0x7e2c('0xf7'));}else{if(_0x2e3acb[_0x7e2c('0xee')]>=_0x2226a4[_0x7e2c('0xf8')]){_0x33c6cd[_0x7e2c('0xf9')](_0x2e3acb,_0x2dcc89,_0x47f0f5,'reason\x2019\x20machine....');}else{_0x33c6cd[_0x7e2c('0xc2')]({'active':![],'countmachineretry':_0x2e3acb[_0x7e2c('0xee')],'scheduledat':moment()[_0x7e2c('0xfa')](_0x2226a4[_0x7e2c('0x104')],_0x7e2c('0xfb'))[_0x7e2c('0x7d')](_0x7e2c('0x105')),'ContactId':_0x2e3acb[_0x7e2c('0xd3')],'ListId':_0x2e3acb[_0x7e2c('0xfc')],'VoiceQueueId':_0x2e3acb[_0x7e2c('0xd5')]||undefined,'CampaignId':_0x2e3acb[_0x7e2c('0xd6')]||undefined})[_0x7e2c('0xb5')](loggerCatch(_0x7e2c('0xfd')));_0x2dcc89({'reschedule':0x1});}}});}}};Dialer[_0x7e2c('0x1c')][_0x7e2c('0x36')]=function(_0x27d057){var _0x175fb2=this['uniqueId'][_0x27d057['uniqueid']];var _0x2cd052=this;var _0x5da81c;if(_0x175fb2&&_0x175fb2['type']==='ivr'){delete this[_0x7e2c('0x29')][_0x27d057['uniqueid']];this[_0x7e2c('0xb8')](this['campaigns'][_0x175fb2[_0x7e2c('0xb9')]]);this[_0x7e2c('0x22')][_0x175fb2[_0x7e2c('0xb9')]][_0x7e2c('0x106')]+=0x1;_0x5da81c=new Hangup(_0x175fb2,_0x27d057);this[_0x7e2c('0xcd')](_0x5da81c)['catch'](loggerCatch(_0x7e2c('0x107')));this[_0x7e2c('0xcb')](_0x5da81c)['catch'](loggerCatch(_0x7e2c('0x108')));}if(_0x175fb2&&_0x175fb2['type']!=='ivr'&&isNotNull(this[_0x7e2c('0x21')][_0x175fb2[_0x7e2c('0xb9')]][_0x7e2c('0x109')])){delete this[_0x7e2c('0x29')][_0x27d057[_0x7e2c('0xdd')]];this[_0x7e2c('0xb8')](this['voiceQueues'][_0x175fb2[_0x7e2c('0xb9')]]);this[_0x7e2c('0x21')][_0x175fb2[_0x7e2c('0xb9')]]['outboundAnswerCallsDay']+=0x1;this[_0x7e2c('0x21')][_0x175fb2['queue']][_0x7e2c('0x62')]+=0x1;_0x5da81c=new Hangup(_0x175fb2,_0x27d057);_0x5da81c[_0x7e2c('0xae')]=0x10;_0x5da81c['statedesc']=_0x7e2c('0x10a');_0x5da81c[_0x7e2c('0xe5')]=_0x7e2c('0x10b');this['createHistory'](_0x5da81c)[_0x7e2c('0xb5')](loggerCatch(_0x7e2c('0x107')));this[_0x7e2c('0xcb')](_0x5da81c)[_0x7e2c('0xb5')](loggerCatch('[syncHangupIvr]'));}if(_0x175fb2&&_0x175fb2['type']!==_0x7e2c('0x80')&&!isNotNull(this[_0x7e2c('0x21')][_0x175fb2['queue']]['dialQueueProject'])){delete this['uniqueId'][_0x27d057[_0x7e2c('0xdd')]];this[_0x7e2c('0xb8')](this[_0x7e2c('0x21')][_0x175fb2['queue']]);this[_0x7e2c('0x21')][_0x175fb2[_0x7e2c('0xb9')]][_0x7e2c('0x10c')]+=0x1;_0x5da81c=new Hangup(_0x175fb2,_0x27d057);_0x5da81c['state']=0xc;_0x5da81c['statedesc']=_0x27d057['cause-txt'];_0x5da81c[_0x7e2c('0xe5')]=_0x7e2c('0x10d');this['createHistory'](_0x5da81c)['catch'](loggerCatch(_0x7e2c('0x107')));this['moveContactManagedDialer'](_0x5da81c)[_0x7e2c('0xb5')](loggerCatch(_0x7e2c('0x108')));}};Dialer[_0x7e2c('0x1c')][_0x7e2c('0x34')]=function(_0x144515){var _0x28d1c6=this[_0x7e2c('0x29')][_0x144515[_0x7e2c('0xdd')]];var _0x20dde0=this;if(this[_0x7e2c('0x21')][_0x144515[_0x7e2c('0xb9')]]){if(_0x28d1c6&&_0x28d1c6[_0x7e2c('0x51')]!=='ivr'){delete this[_0x7e2c('0x29')][_0x144515[_0x7e2c('0xdd')]];this[_0x7e2c('0x21')][_0x144515['queue']][_0x7e2c('0x63')]+=0x1;var _0x8facab=new AgentComplete(_0x28d1c6,_0x144515);if(_0x144515[_0x7e2c('0x10e')]==='agent'){_0x8facab[_0x7e2c('0x10f')]=this['voiceQueues'][_0x144515[_0x7e2c('0xb9')]][_0x7e2c('0x110')]&&this[_0x7e2c('0x21')][_0x144515[_0x7e2c('0xb9')]][_0x7e2c('0x111')]?moment()['format'](_0x7e2c('0x105')):undefined;}this[_0x7e2c('0xcd')](_0x8facab)[_0x7e2c('0xb5')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x7e2c('0xcb')](_0x8facab)[_0x7e2c('0xb5')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x7e2c('0x1c')][_0x7e2c('0x2e')]=function(_0x4ef61c){if(this['voiceQueues'][_0x4ef61c[_0x7e2c('0xb9')]]){if(this[_0x7e2c('0x29')][_0x4ef61c['uniqueid']]&&this[_0x7e2c('0x29')][_0x4ef61c[_0x7e2c('0xdd')]]['type']!==_0x7e2c('0x80')){this['updateOriginated'](this[_0x7e2c('0x21')][_0x4ef61c[_0x7e2c('0xb9')]]);this['uniqueId'][_0x4ef61c[_0x7e2c('0xdd')]][_0x7e2c('0x112')]=moment()[_0x7e2c('0x7d')](_0x7e2c('0x105'));}}};Dialer['prototype'][_0x7e2c('0x113')]=function(_0x500fd5){this[_0x7e2c('0xcd')](_0x500fd5)[_0x7e2c('0xb5')](loggerCatch(_0x7e2c('0x114')));this[_0x7e2c('0xcb')](_0x500fd5)[_0x7e2c('0xb5')](loggerCatch(_0x7e2c('0x115')));};Dialer['prototype']['syncQueueCallerAbandon']=function(_0x49fd58){var _0x1ade40=this[_0x7e2c('0x29')][_0x49fd58[_0x7e2c('0xdd')]];var _0x51409c=this;if(this[_0x7e2c('0x21')][_0x49fd58[_0x7e2c('0xb9')]]){if(_0x1ade40&&_0x1ade40[_0x7e2c('0x51')]!==_0x7e2c('0x80')){delete this[_0x7e2c('0x29')][_0x49fd58[_0x7e2c('0xdd')]];this[_0x7e2c('0xb8')](this['voiceQueues'][_0x49fd58['queue']]);_0x1ade40[_0x7e2c('0x116')]=moment()[_0x7e2c('0x7d')](_0x7e2c('0x105'));var _0x2a091a=new QueueCallerAbandon(_0x1ade40,_0x49fd58);if(getSeconds(_0x1ade40['droptime'],_0x1ade40['responsetime'])>=_0x1ade40[_0x7e2c('0x117')]){this[_0x7e2c('0x21')][_0x49fd58['queue']][_0x7e2c('0x88')]+=0x1;this[_0x7e2c('0x21')][_0x49fd58[_0x7e2c('0xb9')]][_0x7e2c('0x69')]+=0x1;this[_0x7e2c('0x21')][_0x49fd58[_0x7e2c('0xb9')]][_0x7e2c('0x71')]+=0x1;_0x2a091a[_0x7e2c('0xae')]=0xa;_0x2a091a[_0x7e2c('0xe4')]=_0x7e2c('0x118');_0x2a091a[_0x7e2c('0x119')]=_0x7e2c('0x11a');_0x2a091a[_0x7e2c('0x10f')]=this[_0x7e2c('0x21')][_0x49fd58['queue']][_0x7e2c('0x110')]?moment()[_0x7e2c('0x7d')](_0x7e2c('0x105')):undefined;_0x2a091a['countdropretry']+=0x1;_0x2a091a['countglobal']+=0x1;if(_0x2a091a[_0x7e2c('0xf3')]>=this[_0x7e2c('0x21')][_0x49fd58[_0x7e2c('0xb9')]][_0x7e2c('0x11b')]){this[_0x7e2c('0x113')](_0x2a091a);}else{this[_0x7e2c('0xc2')]({'active':![],'countdropretry':_0x2a091a[_0x7e2c('0xf3')],'scheduledat':moment()['add'](this[_0x7e2c('0x21')][_0x49fd58[_0x7e2c('0xb9')]][_0x7e2c('0x11c')],_0x7e2c('0xfb'))[_0x7e2c('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1ade40[_0x7e2c('0xd3')],'ListId':_0x1ade40[_0x7e2c('0xfc')],'VoiceQueueId':_0x1ade40[_0x7e2c('0xd5')]||undefined,'CampaignId':_0x1ade40['CampaignId']||undefined})['catch'](loggerCatch(_0x7e2c('0x11d')));var _0x2dca14=new History(_0x2a091a);_0x2dca14['state']=0xa;_0x2dca14[_0x7e2c('0xe4')]=_0x7e2c('0x118');_0x2dca14[_0x7e2c('0xb0')]=moment()[_0x7e2c('0x7d')](_0x7e2c('0x105'));_0x2dca14['endtime']=_0x2dca14[_0x7e2c('0xb0')];_0x2dca14['calleridname']=_0x2a091a['calleridname'];_0x2dca14[_0x7e2c('0x11e')]=_0x2a091a[_0x7e2c('0x11e')];this['createHistory'](_0x2dca14)['catch'](loggerCatch(_0x7e2c('0x11f')));}}else{this[_0x7e2c('0x21')][_0x49fd58[_0x7e2c('0xb9')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x7e2c('0x21')][_0x49fd58[_0x7e2c('0xb9')]][_0x7e2c('0x68')]+=0x1;_0x2a091a[_0x7e2c('0xae')]=0xb;_0x2a091a['statedesc']=_0x7e2c('0x120');_0x2a091a[_0x7e2c('0x119')]=_0x7e2c('0x121');_0x2a091a[_0x7e2c('0xf4')]+=0x1;_0x2a091a['countglobal']+=0x1;if(_0x2a091a[_0x7e2c('0xf4')]>=this[_0x7e2c('0x21')][_0x49fd58[_0x7e2c('0xb9')]][_0x7e2c('0x122')]){this[_0x7e2c('0x113')](_0x2a091a);}else{this[_0x7e2c('0xc2')]({'active':![],'countabandonedretry':_0x2a091a[_0x7e2c('0xf4')],'scheduledat':moment()[_0x7e2c('0xfa')](this[_0x7e2c('0x21')][_0x49fd58['queue']][_0x7e2c('0x123')],_0x7e2c('0xfb'))['format'](_0x7e2c('0x105')),'ContactId':_0x1ade40[_0x7e2c('0xd3')],'ListId':_0x1ade40[_0x7e2c('0xfc')],'VoiceQueueId':_0x1ade40[_0x7e2c('0xd5')]||undefined,'CampaignId':_0x1ade40[_0x7e2c('0xd6')]||undefined})[_0x7e2c('0xb5')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x2dca14=new History(_0x2a091a);_0x2dca14[_0x7e2c('0xae')]=0xb;_0x2dca14['statedesc']='Abandoned';_0x2dca14['starttime']=moment()[_0x7e2c('0x7d')]('YYYY-MM-DD\x20HH:mm:ss');_0x2dca14[_0x7e2c('0xaf')]=_0x2dca14[_0x7e2c('0xb0')];_0x2dca14[_0x7e2c('0x124')]=_0x2a091a[_0x7e2c('0x124')];_0x2dca14[_0x7e2c('0x11e')]=_0x2a091a[_0x7e2c('0x11e')];this[_0x7e2c('0xcd')](_0x2dca14)[_0x7e2c('0xb5')](loggerCatch(_0x7e2c('0x125')));}}}}};Dialer['prototype']['syncNewExten']=function(_0x275855){if(this[_0x7e2c('0x27')][_0x275855[_0x7e2c('0xdd')]]){this[_0x7e2c('0x27')][_0x275855['uniqueid']][_0x7e2c('0xb4')]=_0x275855[_0x7e2c('0xb4')];}if(this[_0x7e2c('0x29')][_0x275855[_0x7e2c('0xdd')]]){this[_0x7e2c('0x29')][_0x275855[_0x7e2c('0xdd')]][_0x7e2c('0xb4')]=_0x275855[_0x7e2c('0xb4')];}};Dialer[_0x7e2c('0x1c')]['syncQueueMember']=function(_0x49ddfd){if(strategy[this[_0x7e2c('0x21')][this[_0x7e2c('0x27')][_0x49ddfd[_0x7e2c('0x126')]]['queue']][_0x7e2c('0x127')]]===_0x7e2c('0x1b')){if(this[_0x7e2c('0x27')][_0x49ddfd[_0x7e2c('0x126')]]&&_[_0x7e2c('0xde')](this[_0x7e2c('0x27')][_0x49ddfd[_0x7e2c('0x126')]][_0x7e2c('0x128')])&&_0x49ddfd[_0x7e2c('0xdb')]==='1'&&_0x49ddfd[_0x7e2c('0x129')]==='0'){if(this[_0x7e2c('0x23')][_0x49ddfd[_0x7e2c('0x12a')]]){if(!this['agents'][_0x49ddfd[_0x7e2c('0x12a')]][_0x7e2c('0x128')]){this[_0x7e2c('0x23')][_0x49ddfd['stateinterface']][_0x7e2c('0x128')]=!![];this[_0x7e2c('0x27')][_0x49ddfd[_0x7e2c('0x126')]][_0x7e2c('0x128')]=!![];this['actions'][_0x49ddfd[_0x7e2c('0x126')]][_0x7e2c('0x12a')]=_0x49ddfd[_0x7e2c('0x12a')];}}}}else if((strategy[this[_0x7e2c('0x21')][this['actions'][_0x49ddfd[_0x7e2c('0x126')]][_0x7e2c('0xb9')]][_0x7e2c('0x127')]]||'rrmemory')===_0x7e2c('0x1a')){if(this['actions'][_0x49ddfd[_0x7e2c('0x126')]]){if(this[_0x7e2c('0x23')][_0x49ddfd[_0x7e2c('0x12a')]]){this[_0x7e2c('0x27')][_0x49ddfd['actionid']]['stateinterface']=_0x49ddfd[_0x7e2c('0x12a')];if(_['isNil'](this[_0x7e2c('0x2b')][this[_0x7e2c('0x27')][_0x49ddfd[_0x7e2c('0x126')]][_0x7e2c('0xb9')]])){this[_0x7e2c('0x2b')][this[_0x7e2c('0x27')][_0x49ddfd[_0x7e2c('0x126')]][_0x7e2c('0xb9')]]=[];}this[_0x7e2c('0x2b')][this[_0x7e2c('0x27')][_0x49ddfd[_0x7e2c('0x126')]][_0x7e2c('0xb9')]][_0x7e2c('0x12b')](_[_0x7e2c('0x96')](_['pick'](this[_0x7e2c('0x27')][_0x49ddfd['actionid']],[_0x7e2c('0x12c'),'stateinterface']),{'status':_0x49ddfd[_0x7e2c('0xdb')],'paused':_0x49ddfd[_0x7e2c('0x129')]}));}}}};function unlockQueueStatus(_0x328f4d,_0x380aa0){setTimeout(function(){if(_['isUndefined'](_0x328f4d['queueStatusComplete'])){loggerBooked[_0x7e2c('0x9d')](_0x7e2c('0x12d'),_0x380aa0);}_0x328f4d['queueStatusComplete']=!![];loggerBooked['info']('[booked][unlockQueueStatus]',_0x380aa0,JSON['stringify'](_['pick'](_0x328f4d,[_0x7e2c('0x44'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x7e2c('0x1c')][_0x7e2c('0x3d')]=function(_0x8909ac){var _0x32d47d=this;var _0x12f947=_0x32d47d[_0x7e2c('0x21')][_0x32d47d[_0x7e2c('0x27')][_0x8909ac[_0x7e2c('0x126')]][_0x7e2c('0xb9')]];if(strategy[this[_0x7e2c('0x21')][this[_0x7e2c('0x27')][_0x8909ac['actionid']][_0x7e2c('0xb9')]][_0x7e2c('0x127')]]===_0x7e2c('0x1b')){if(this[_0x7e2c('0x27')][_0x8909ac[_0x7e2c('0x126')]]&&this[_0x7e2c('0x27')][_0x8909ac[_0x7e2c('0x126')]][_0x7e2c('0x12a')]){this[_0x7e2c('0x20')][_0x7e2c('0x12e')](this[_0x7e2c('0x27')][_0x8909ac[_0x7e2c('0x126')]]['idHopper'],this[_0x7e2c('0x27')][_0x8909ac[_0x7e2c('0x126')]]['stateinterface'])[_0x7e2c('0xb5')](function(_0x542b88){logger[_0x7e2c('0x9d')](_0x7e2c('0x12f'),util['inspect'](_0x542b88,{'showHidden':![],'depth':null}));})[_0x7e2c('0x130')](function(){_0x32d47d[_0x7e2c('0xb8')](_0x32d47d[_0x7e2c('0x21')][_0x32d47d[_0x7e2c('0x27')][_0x8909ac[_0x7e2c('0x126')]][_0x7e2c('0xb9')]]);_0x32d47d['agents'][_0x32d47d[_0x7e2c('0x27')][_0x8909ac[_0x7e2c('0x126')]][_0x7e2c('0x12a')]][_0x7e2c('0x128')]=![];delete _0x32d47d[_0x7e2c('0x27')][_0x8909ac[_0x7e2c('0x126')]];unlockQueueStatus(_0x12f947);});}else{this['updateOriginated'](this[_0x7e2c('0x21')][this['actions'][_0x8909ac['actionid']]['queue']]);this[_0x7e2c('0xc2')]({'active':![],'ContactId':this[_0x7e2c('0x27')][_0x8909ac[_0x7e2c('0x126')]]['ContactId'],'ListId':this['actions'][_0x8909ac[_0x7e2c('0x126')]][_0x7e2c('0xfc')],'VoiceQueueId':this[_0x7e2c('0x27')][_0x8909ac[_0x7e2c('0x126')]][_0x7e2c('0xd5')]||undefined,'CampaignId':this[_0x7e2c('0x27')][_0x8909ac[_0x7e2c('0x126')]][_0x7e2c('0xd6')]||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x7e2c('0x27')][_0x8909ac[_0x7e2c('0x126')]];unlockQueueStatus(_0x12f947);}}else if((strategy[this[_0x7e2c('0x21')][this[_0x7e2c('0x27')][_0x8909ac[_0x7e2c('0x126')]]['queue']][_0x7e2c('0x127')]]||_0x7e2c('0x1a'))===_0x7e2c('0x1a')){var _0x592b9e;if(this[_0x7e2c('0x27')][_0x8909ac['actionid']]&&!_[_0x7e2c('0x82')](this['queueBooked'][this[_0x7e2c('0x27')][_0x8909ac['actionid']][_0x7e2c('0xb9')]])){if(this['queueBookedRR'][_0x32d47d[_0x7e2c('0x27')][_0x8909ac[_0x7e2c('0x126')]][_0x7e2c('0xb9')]]){this[_0x7e2c('0x2c')][_0x32d47d[_0x7e2c('0x27')][_0x8909ac[_0x7e2c('0x126')]][_0x7e2c('0xb9')]]=this['queueBookedRR'][this[_0x7e2c('0x27')][_0x8909ac[_0x7e2c('0x126')]][_0x7e2c('0xb9')]]?this[_0x7e2c('0x2c')][this['actions'][_0x8909ac['actionid']][_0x7e2c('0xb9')]]:this[_0x7e2c('0x2b')][this[_0x7e2c('0x27')][_0x8909ac[_0x7e2c('0x126')]][_0x7e2c('0xb9')]]?this['queueBooked'][this[_0x7e2c('0x27')][_0x8909ac[_0x7e2c('0x126')]][_0x7e2c('0xb9')]][_0x7e2c('0x131')]||0x0:0x0;}this[_0x7e2c('0x2b')][this[_0x7e2c('0x27')][_0x8909ac[_0x7e2c('0x126')]][_0x7e2c('0xb9')]][_0x7e2c('0x131')]=this[_0x7e2c('0x2c')][this[_0x7e2c('0x27')][_0x8909ac[_0x7e2c('0x126')]][_0x7e2c('0xb9')]];for(var _0x58cb1f=0x0;_0x58cb1f=0x0;})[_0x7e2c('0xb5')](myreject(_0x617f24)));}}else{_0x1561ba[_0x7e2c('0x12b')](ami['Action']({'action':_0x7e2c('0x14b'),'command':util[_0x7e2c('0x7d')](_0x7e2c('0x14c'),_0x552125,!_[_0x7e2c('0x42')](config[_0x7e2c('0x14e')][_0x321ddb])?_0x321ddb:'')})[_0x7e2c('0xbd')](function(_0x5aaa11){return _0x5aaa11[_0x7e2c('0x14f')]['indexOf'](_0x7e2c('0x151'))>=0x0;})[_0x7e2c('0xb5')](myreject(_0x617f24)));}BPromise[_0x7e2c('0x152')](_0x1561ba)[_0x7e2c('0xbd')](function(_0x5d414d){var _0xe36447=_[_0x7e2c('0x153')](_0x5d414d);if(_0xe36447){return _0x148f22(_0xe36447);}else{_0x145658[_0x7e2c('0x43')]=_0x2303db?_0x7e2c('0x154'):_0x7e2c('0x155');return _0x617f24(msgResponse(_0x7e2c('0x156'),_0x7e2c('0x145'),_0x7e2c('0x157')+_0x2303db+'\x20'+_0x4bf106+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x552125,{'showHidden':![],'depth':null})+_0x7e2c('0x158')+_0x321ddb));}})['catch'](function(_0x26f9e3){return _0x617f24(msgResponse(_0x7e2c('0x142'),'Failure',JSON[_0x7e2c('0x4c')](_0x26f9e3)));});});};Dialer[_0x7e2c('0x1c')][_0x7e2c('0x159')]=function(_0x4b31b2){var _0x5bbcaa=this;return function(){switch(_0x4b31b2['dialMethod']){case _0x7e2c('0x15a'):freeVariablesPredictive(_0x4b31b2);_0x5bbcaa[_0x7e2c('0x15b')](_0x4b31b2,0x1);break;case _0x7e2c('0x15c'):freeVariablesPredictive(_0x4b31b2);_0x5bbcaa[_0x7e2c('0x15b')](_0x4b31b2,_0x4b31b2['dialPowerLevel']);break;case _0x7e2c('0xc'):_0x5bbcaa[_0x7e2c('0xc')](_0x4b31b2);break;case _0x7e2c('0xb'):freeVariablesPredictive(_0x4b31b2);_0x5bbcaa[_0x7e2c('0x15b')](_0x4b31b2,0x1);break;default:freeVariablesPredictive(_0x4b31b2);logger[_0x7e2c('0x9d')](_0x7e2c('0x15d'),_0x4b31b2[_0x7e2c('0x44')],_0x7e2c('0x15e'));}};};Dialer[_0x7e2c('0x1c')][_0x7e2c('0x15f')]=function(_0x235788){return BPromise[_0x7e2c('0xbb')]()[_0x7e2c('0xbd')](cmHopper[_0x7e2c('0x160')](_0x235788['id'],previewRecallmeReminderInterval))[_0x7e2c('0xbd')](function(_0x587337){for(var _0x17f9a9=0x0;_0x17f9a9<_0x587337[_0x7e2c('0xa0')];_0x17f9a9++){var _0x4dff92=_0x587337[_0x17f9a9]['Agent'][_0x7e2c('0x44')];if(_0x4dff92)io['to'](util[_0x7e2c('0x7d')](_0x7e2c('0x161'),_0x4dff92))[_0x7e2c('0x50')](_0x7e2c('0x162'),{'hopper':_0x587337[_0x17f9a9]});}})['catch'](function(_0x2e4d5d){});};Dialer[_0x7e2c('0x1c')][_0x7e2c('0x163')]=function(_0x1fdd43){var _0x3ff0ba=this;return function(){_0x3ff0ba[_0x7e2c('0x164')](_0x1fdd43);};};Dialer[_0x7e2c('0x1c')][_0x7e2c('0xe')]=function(_0x24a778){var _0x50dfeb=this;if(isNotPreview(_0x24a778[_0x7e2c('0x5d')])){if(isVoiceQueueOutbound(_0x24a778[_0x7e2c('0x51')])&&isActive(_0x24a778[_0x7e2c('0x5c')])){_0x24a778[_0x7e2c('0xa7')]=!![];BPromise[_0x7e2c('0xbb')]()[_0x7e2c('0xbd')](checkIsLoggedIn(_0x24a778,_0x24a778['loggedIn']))[_0x7e2c('0xbd')](checkIsActive(_0x24a778,_0x24a778['dialActive']))['then'](checkInterval(_0x24a778))[_0x7e2c('0xbd')](_0x50dfeb[_0x7e2c('0x165')](_0x24a778))[_0x7e2c('0xbd')](_0x50dfeb['checkIfTime'](_0x24a778['dialGlobalInterval'],_0x24a778[_0x7e2c('0x166')],_0x24a778[_0x7e2c('0x44')],_0x24a778))[_0x7e2c('0xbd')](_0x50dfeb['checkIfTimeIntervals'](_0x24a778[_0x7e2c('0x47')],_0x24a778[_0x7e2c('0x166')],_0x24a778['name'],_0x24a778))[_0x7e2c('0xbd')](_0x50dfeb['checkDialMethod'](_0x24a778))[_0x7e2c('0xb5')](loggerCatchQueueSummary('[syncQueueSummary]',_0x24a778));}else{notSendMessagesQueue(_0x24a778);}}else{freeVariablesPredictive(_0x24a778);if(_0x24a778[_0x7e2c('0x167')]){_0x50dfeb[_0x7e2c('0x15f')](_0x24a778);}}};Dialer[_0x7e2c('0x1c')][_0x7e2c('0x168')]=function(){var _0x5d6175=this;var _0x15784e;for(var _0x3e0cc1 in this[_0x7e2c('0x22')]){if(typeof this[_0x7e2c('0x22')][_0x3e0cc1]!==_0x7e2c('0xb3')){_0x15784e=this[_0x7e2c('0x22')][_0x3e0cc1];if(isCampaignIvr(_0x15784e[_0x7e2c('0x51')])&&isActive(_0x15784e[_0x7e2c('0x7b')])){_0x15784e['sendMessageOneNotActive']=!![];BPromise[_0x7e2c('0xbb')]()[_0x7e2c('0xbd')](checkIsActive(_0x15784e,_0x15784e['active']))[_0x7e2c('0xbd')](checkInterval(_0x15784e))[_0x7e2c('0xbd')](_0x5d6175['checkIsTrunkReachable'](_0x15784e))[_0x7e2c('0xbd')](_0x5d6175[_0x7e2c('0x169')](_0x15784e[_0x7e2c('0x16a')],_0x15784e[_0x7e2c('0x166')],_0x15784e[_0x7e2c('0x44')],_0x15784e))[_0x7e2c('0xbd')](_0x5d6175[_0x7e2c('0x16b')](_0x15784e[_0x7e2c('0x47')],_0x15784e[_0x7e2c('0x166')],_0x15784e[_0x7e2c('0x44')],_0x15784e))[_0x7e2c('0xbd')](_0x5d6175['launchHandleIvr'](_0x15784e))[_0x7e2c('0xb5')](loggerCatchQueueSummary(_0x7e2c('0x16c'),_0x15784e));}else{notSendMessagesCampaign(_0x15784e);}}}};function getCallerIdRandom(_0x357491,_0x4e4abb){var _0x2c1b2c;var _0x4076bd;var _0x110e8a;if(_0x4e4abb<=0x0){_0x4e4abb=0x1;}_0x2c1b2c=new RegExp(_0x7e2c('0x16d')+_0x4e4abb+'}$');_0x4076bd=Math[_0x7e2c('0x16e')](0xa,_0x4e4abb-0x1);_0x110e8a=Math[_0x7e2c('0x16e')](0xa,_0x4e4abb)-0x1;return util[_0x7e2c('0x7d')]('%s',_[_0x7e2c('0x16f')](_0x357491,_0x2c1b2c,_['random'](_0x4076bd,_0x110e8a)));}function extractCalleridName(_0x544508){var _0x3cb298=_0x544508['match'](/"(.*?)"/);return _0x3cb298?_0x3cb298[0x1]:_0x544508;}function extractCalleridNumber(_0x486b2e){var _0x1910b8=_0x486b2e['match'](/<(.*?)>/);return _0x1910b8?_0x1910b8[0x1]:_0x486b2e;}Dialer[_0x7e2c('0x1c')][_0x7e2c('0x170')]=function(_0x23e7b3,_0x54482f){var _0x219c76=this;var _0x54ee19=uuid['v4']();this['actions'][_0x54ee19]=new Action(_0x23e7b3,_0x54482f,_0x54ee19);return new BPromise(function(_0x5e9ea2,_0x109ddd){if(_[_0x7e2c('0x42')](_0x23e7b3)&&typeof _0x23e7b3!==_0x7e2c('0x171')){return _0x109ddd(msgResponse(_0x7e2c('0x172'),_0x7e2c('0x145'),_0x7e2c('0x173')));}if(_[_0x7e2c('0x42')](_0x54482f[_0x7e2c('0x174')][_0x7e2c('0x175')])||_0x54482f[_0x7e2c('0x174')][_0x7e2c('0x175')]===null){return _0x109ddd(msgResponse(_0x7e2c('0x172'),_0x7e2c('0x145'),_0x7e2c('0x176')));}var _0x564280={'XMD-CALLERID':_0x219c76[_0x7e2c('0x27')][_0x54ee19][_0x7e2c('0x177')](),'XMD-AGI':_0x23e7b3[_0x7e2c('0x109')]?util[_0x7e2c('0x7d')](_0x7e2c('0x178'),ipAgi,_0x23e7b3[_0x7e2c('0x109')]):_0x7e2c('0x179'),'XMD-AGIAFTER':_0x23e7b3[_0x7e2c('0x110')]?util[_0x7e2c('0x7d')](_0x7e2c('0x178'),ipAgi,_0x23e7b3[_0x7e2c('0x110')]):'NONE','XMD-QUEUE':_0x23e7b3[_0x7e2c('0x51')]==='outbound'?util[_0x7e2c('0x7d')](_0x7e2c('0x17a'),_0x23e7b3[_0x7e2c('0x44')],_0x23e7b3['dialQueueOptions']||'',_0x23e7b3[_0x7e2c('0x111')]?'c':'',_0x23e7b3[_0x7e2c('0x117')]||0x3):_0x7e2c('0x179'),'XMD-CONTACTID':_0x54482f[_0x7e2c('0xd3')],'XMD-CDRTYPE':_0x7e2c('0xa'),'CALLERID(all)':_0x219c76['actions'][_0x54ee19][_0x7e2c('0x177')](),'XMD-AMD':_0x23e7b3[_0x7e2c('0xe2')]?_0x7e2c('0x17b'):'NONE','XMD-DESTINATION':_0x7e2c('0xe1')};if(_0x23e7b3['dialAMDActive']){_0x564280[_0x7e2c('0x17c')]=_0x23e7b3[_0x7e2c('0x17d')]||0x9c4;_0x564280['XMD-AMDGREETING']=_0x23e7b3[_0x7e2c('0x17e')]||0x5dc;_0x564280[_0x7e2c('0x17f')]=_0x23e7b3[_0x7e2c('0x180')]||0x320;_0x564280['XMD-AMDTOTALANALYSISTIME']=_0x23e7b3['dialAMDTotalAnalysisTime']||0x1388;_0x564280[_0x7e2c('0x181')]=_0x23e7b3[_0x7e2c('0x182')]||0x64;_0x564280[_0x7e2c('0x183')]=_0x23e7b3[_0x7e2c('0x184')]||0x32;_0x564280['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x23e7b3[_0x7e2c('0x185')]||0x3;_0x564280[_0x7e2c('0x186')]=_0x23e7b3[_0x7e2c('0x187')]||0x100;_0x564280['XMD-AMDMAXIMUMWORDLENGTH']=_0x23e7b3[_0x7e2c('0x188')]||0x1388;}if(_0x23e7b3[_0x7e2c('0x51')]===_0x7e2c('0x189')){_0x564280[_0x7e2c('0x18a')]=_0x54482f['VoiceQueueId'];}else{_0x564280[_0x7e2c('0x18b')]=_0x54482f['CampaignId'];}for(var _0x108cd5 in _0x54482f[_0x7e2c('0x174')]){if(typeof _0x54482f[_0x7e2c('0x174')][_0x108cd5]!==_0x7e2c('0xb3')){if(isNotNull(_0x54482f['Contact'][_0x108cd5])&&_0x108cd5!=='id'&&_0x108cd5!=='tags'&&_0x108cd5!=='createdAt'&&_0x108cd5!==_0x7e2c('0x18c')){_0x564280[util[_0x7e2c('0x7d')](_0x7e2c('0x18d'),_0x7e2c('0x18e'),_[_0x7e2c('0x18f')](_0x108cd5))]=_0x54482f['Contact'][_0x108cd5];}}}var _0x51e07f=_0x219c76[_0x7e2c('0x13e')](_0x23e7b3[_0x7e2c('0x7a')])?getCallerId(_0x23e7b3['Trunk'][_0x7e2c('0x7c')],_0x23e7b3['dialOriginateCallerIdName'],_0x23e7b3[_0x7e2c('0x190')]>0x0?getCallerIdRandom(_0x23e7b3[_0x7e2c('0x5f')],_0x23e7b3[_0x7e2c('0x190')]):_0x23e7b3[_0x7e2c('0x5f')]):getCallerId(_['isNil'](_0x23e7b3[_0x7e2c('0x13f')])?_0x23e7b3[_0x7e2c('0x7a')][_0x7e2c('0x7c')]:_0x23e7b3['TrunkBackup']['callerid'],_0x23e7b3[_0x7e2c('0x5e')],_0x23e7b3[_0x7e2c('0x190')]>0x0?getCallerIdRandom(_0x23e7b3[_0x7e2c('0x5f')],_0x23e7b3[_0x7e2c('0x190')]):_0x23e7b3[_0x7e2c('0x5f')]);if(_0x51e07f){_0x564280['XMD-ORIGINATECALLERIDNAME']=_0x219c76['actions'][_0x54ee19][_0x7e2c('0x191')]=extractCalleridName(_0x51e07f);_0x564280[_0x7e2c('0x192')]=_0x219c76[_0x7e2c('0x27')][_0x54ee19][_0x7e2c('0x193')]=extractCalleridNumber(_0x51e07f);}return ami[_0x7e2c('0x14a')]({'actionid':_0x54ee19,'action':'originate','channel':_0x219c76['isTrunkReachable'](_0x23e7b3[_0x7e2c('0x7a')])?util[_0x7e2c('0x7d')](_0x7e2c('0x194'),_0x23e7b3['Trunk'][_0x7e2c('0x44')],isNotNull(_0x23e7b3[_0x7e2c('0x61')])?_0x23e7b3[_0x7e2c('0x61')][_0x7e2c('0x195')]()||'':'',_0x23e7b3[_0x7e2c('0x196')]>0x0?_0x54482f[_0x7e2c('0x174')][_0x7e2c('0x175')][_0x7e2c('0x197')](_0x23e7b3[_0x7e2c('0x196')]):_0x54482f[_0x7e2c('0x174')][_0x7e2c('0x175')]):util['format']('SIP/%s/%s%s',_[_0x7e2c('0xde')](_0x23e7b3[_0x7e2c('0x13f')])?_0x23e7b3[_0x7e2c('0x7a')][_0x7e2c('0x44')]:_0x23e7b3[_0x7e2c('0x13f')][_0x7e2c('0x44')],isNotNull(_0x23e7b3[_0x7e2c('0x61')])?_0x23e7b3['dialPrefix']['trim']()||'':'',_0x23e7b3[_0x7e2c('0x196')]>0x0?_0x54482f['Contact'][_0x7e2c('0x175')]['substring'](_0x23e7b3['dialCutDigit']):_0x54482f[_0x7e2c('0x174')][_0x7e2c('0x175')]),'callerid':_0x51e07f,'Exten':_0x7e2c('0xe1'),'Context':_0x7e2c('0x198'),'Priority':'1','variable':_0x564280,'timeout':(_0x23e7b3[_0x7e2c('0x60')]||0x1e)*0x3e8,'async':!![],'channelid':_0x54ee19})[_0x7e2c('0xbd')](function(_0x3bbb52){return _0x5e9ea2(_0x3bbb52);})['catch'](function(_0x37d58b){_0x23e7b3[_0x7e2c('0x6c')]+=0x1;var _0x344cb6=new History(_0x219c76[_0x7e2c('0x27')][_0x54ee19]);logger[_0x7e2c('0x9d')](util['format'](_0x7e2c('0x199'),JSON[_0x7e2c('0x4c')](_0x37d58b)));_0x344cb6[_0x7e2c('0xae')]=0xe;_0x344cb6[_0x7e2c('0xe4')]=_0x7e2c('0x19a');_0x344cb6[_0x7e2c('0xb0')]=moment()[_0x7e2c('0x7d')](_0x7e2c('0x105'));_0x344cb6[_0x7e2c('0xaf')]=_0x344cb6[_0x7e2c('0xb0')];_0x219c76[_0x7e2c('0xcd')](_0x344cb6)[_0x7e2c('0xb5')](loggerCatch(_0x7e2c('0x19b')));_0x219c76['moveContactManagedDialer'](_0x344cb6)['catch'](loggerCatch('[originate][error]'))['finally'](function(){delete _0x219c76[_0x7e2c('0x27')][_0x54ee19];return _0x109ddd(msgResponse('originate',_0x7e2c('0x4b'),_0x7e2c('0x19c')));});});});};Dialer[_0x7e2c('0x1c')][_0x7e2c('0x32')]=function(_0x498227){var _0x5c1289=this[_0x7e2c('0x27')][_0x498227['actionid']];if(_0x5c1289){delete this[_0x7e2c('0x27')][_0x498227[_0x7e2c('0x126')]];_0x5c1289[_0x7e2c('0x19d')]=moment()[_0x7e2c('0x7d')](_0x7e2c('0x105'));var _0xe3cac7=_0x5c1289['type']===_0x7e2c('0x80')?this[_0x7e2c('0x22')][_0x5c1289['queue']]:this[_0x7e2c('0x21')][_0x5c1289[_0x7e2c('0x19e')]()];if(!this['isSuccess'](_0x498227[_0x7e2c('0x19f')])){this['updateOriginated'](_0xe3cac7);return this[_0x7e2c('0x1a0')](_0x5c1289,_0xe3cac7,_0x498227)[_0x7e2c('0xb5')](loggerCatch(_0x7e2c('0x1a1')));}this[_0x7e2c('0x29')][_0x498227[_0x7e2c('0xdd')]]=_0x5c1289;}};Dialer['prototype']['checkRetriveMax']=function(_0x2b82ce,_0x29f57b,_0x589c28){var _0x25c34d=new History(_0x29f57b);if(_0x25c34d[_0x7e2c('0xf1')]+_0x25c34d[_0x7e2c('0x1a2')]+_0x25c34d['countnoanswerretry']+_0x25c34d[_0x7e2c('0x102')]+_0x25c34d['countdropretry']+_0x25c34d['countabandonedretry']+_0x25c34d['countmachineretry']+_0x25c34d[_0x7e2c('0x103')]>=_0x589c28[_0x7e2c('0xf5')]-0x1){return!![];}switch(_0x2b82ce){case 0x3:if(_0x25c34d['countnoanswerretry']>=_0x589c28[_0x7e2c('0x1a3')]-0x1){return!![];}this[_0x7e2c('0xc2')]({'active':![],'countnoanswerretry':_0x25c34d[_0x7e2c('0xf2')]+=0x1,'scheduledat':moment()['add'](_0x589c28[_0x7e2c('0x1a4')],'minutes')['format'](_0x7e2c('0x105')),'ContactId':_0x25c34d[_0x7e2c('0xd3')],'ListId':_0x25c34d[_0x7e2c('0xfc')],'VoiceQueueId':_0x25c34d[_0x7e2c('0xd5')]||undefined,'CampaignId':_0x25c34d[_0x7e2c('0xd6')]||undefined})[_0x7e2c('0xb5')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x25c34d[_0x7e2c('0xf1')]>=_0x589c28[_0x7e2c('0x1a5')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x25c34d['countbusyretry']+=0x1,'scheduledat':moment()[_0x7e2c('0xfa')](_0x589c28[_0x7e2c('0x1a6')],_0x7e2c('0xfb'))[_0x7e2c('0x7d')](_0x7e2c('0x105')),'ContactId':_0x25c34d[_0x7e2c('0xd3')],'ListId':_0x25c34d[_0x7e2c('0xfc')],'VoiceQueueId':_0x25c34d[_0x7e2c('0xd5')]||undefined,'CampaignId':_0x25c34d['CampaignId']||undefined})[_0x7e2c('0xb5')](loggerCatch(_0x7e2c('0x1a7')));break;case 0x8:if(_0x25c34d[_0x7e2c('0x1a2')]>=_0x589c28[_0x7e2c('0x1a8')]-0x1){return!![];}this[_0x7e2c('0xc2')]({'active':![],'countcongestionretry':_0x25c34d['countcongestionretry']+=0x1,'scheduledat':moment()[_0x7e2c('0xfa')](_0x589c28[_0x7e2c('0x1a9')],_0x7e2c('0xfb'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x25c34d['ContactId'],'ListId':_0x25c34d['ListId'],'VoiceQueueId':_0x25c34d[_0x7e2c('0xd5')]||undefined,'CampaignId':_0x25c34d[_0x7e2c('0xd6')]||undefined})[_0x7e2c('0xb5')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x25c34d[_0x7e2c('0x102')]>=_0x589c28[_0x7e2c('0x1aa')]-0x1){return!![];}else{this[_0x7e2c('0xc2')]({'active':![],'countnosuchnumberretry':_0x25c34d[_0x7e2c('0x102')]+=0x1,'scheduledat':moment()['add'](_0x589c28[_0x7e2c('0x1ab')],_0x7e2c('0xfb'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x25c34d['ContactId'],'ListId':_0x25c34d[_0x7e2c('0xfc')],'VoiceQueueId':_0x25c34d[_0x7e2c('0xd5')]||undefined,'CampaignId':_0x25c34d[_0x7e2c('0xd6')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x25c34d[_0x7e2c('0xf3')]>=_0x589c28[_0x7e2c('0x11b')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x25c34d[_0x7e2c('0xf3')]+=0x1,'scheduledat':moment()[_0x7e2c('0xfa')](_0x589c28[_0x7e2c('0x11c')],_0x7e2c('0xfb'))[_0x7e2c('0x7d')](_0x7e2c('0x105')),'ContactId':_0x25c34d[_0x7e2c('0xd3')],'ListId':_0x25c34d[_0x7e2c('0xfc')],'VoiceQueueId':_0x25c34d['VoiceQueueId']||undefined,'CampaignId':_0x25c34d['CampaignId']||undefined})[_0x7e2c('0xb5')](loggerCatch(_0x7e2c('0x11d')));break;case 0xb:if(_0x25c34d[_0x7e2c('0xf4')]>=_0x589c28['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x7e2c('0xc2')]({'active':![],'countabandonedretry':_0x25c34d['countabandonedretry']+=0x1,'scheduledat':moment()[_0x7e2c('0xfa')](_0x589c28[_0x7e2c('0x123')],'minutes')[_0x7e2c('0x7d')](_0x7e2c('0x105')),'ContactId':_0x25c34d[_0x7e2c('0xd3')],'ListId':_0x25c34d[_0x7e2c('0xfc')],'VoiceQueueId':_0x25c34d[_0x7e2c('0xd5')]||undefined,'CampaignId':_0x25c34d[_0x7e2c('0xd6')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x25c34d[_0x7e2c('0xee')]>=_0x589c28['dialMachineMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x25c34d[_0x7e2c('0xee')]+=0x1,'scheduledat':moment()[_0x7e2c('0xfa')](_0x589c28[_0x7e2c('0x104')],_0x7e2c('0xfb'))[_0x7e2c('0x7d')](_0x7e2c('0x105')),'ContactId':_0x25c34d[_0x7e2c('0xd3')],'ListId':_0x25c34d[_0x7e2c('0xfc')],'VoiceQueueId':_0x25c34d[_0x7e2c('0xd5')]||undefined,'CampaignId':_0x25c34d[_0x7e2c('0xd6')]||undefined})['catch'](loggerCatch(_0x7e2c('0xfd')));break;case 0x14:if(_0x25c34d[_0x7e2c('0x103')]>=_0x589c28['dialAgentRejectMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x25c34d['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x7e2c('0xfa')](_0x589c28[_0x7e2c('0x1ac')],_0x7e2c('0xfb'))[_0x7e2c('0x7d')](_0x7e2c('0x105')),'ContactId':_0x25c34d[_0x7e2c('0xd3')],'ListId':_0x25c34d[_0x7e2c('0xfc')],'VoiceQueueId':_0x25c34d['VoiceQueueId']||undefined,'CampaignId':_0x25c34d['CampaignId']||undefined})[_0x7e2c('0xb5')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer['prototype'][_0x7e2c('0x1a0')]=function(_0x5af68a,_0x25173d,_0x1c4d5d){var _0x1fc59e=this;var _0x1e117c=new History(_0x5af68a);return new BPromise(function(_0x29ddd6,_0x1916ef){if(_['isUndefined'](_0x25173d)&&typeof _0x25173d!=='object'){return _0x1916ef(msgResponse(_0x7e2c('0x1ad'),_0x7e2c('0x145'),_0x7e2c('0x1ae')));}if(_[_0x7e2c('0x42')](_0x1c4d5d)&&typeof _0x1c4d5d!==_0x7e2c('0x171')){return _0x1916ef(msgResponse('[callProgressDetecting]','Failure',_0x7e2c('0x1af')));}switch(_0x1c4d5d['reason']){case'0':_0x25173d['outboundNoSuchCallsDay']+=0x1;_0x1e117c['state']=0x0;_0x1e117c['statedesc']=_0x7e2c('0x1b0');_0x1e117c[_0x7e2c('0x102')]+=0x1;_0x1e117c['countglobal']+=0x1;ami['emit'](_0x7e2c('0x1b1'),ut[_0x7e2c('0xe8')](_0x5af68a,'nosuchnumber'));_0x1fc59e['createHistory'](_0x1e117c)[_0x7e2c('0xb5')](loggerCatch(_0x7e2c('0xf0')));if(_0x1fc59e[_0x7e2c('0x1b2')](0x0,_0x5af68a,_0x25173d)){if(_0x1e117c['countnosuchnumberretry']>=_0x25173d[_0x7e2c('0x1aa')]){_0x1fc59e['createStateFinal'](_0x1e117c,_0x29ddd6,_0x1916ef,'reason\x200\x20no\x20such\x20number....');}else{_0x1fc59e['stateGlobal'](_0x1e117c,_0x29ddd6,_0x1916ef,_0x7e2c('0x1b3'));}}break;case'3':_0x25173d[_0x7e2c('0x6a')]+=0x1;_0x1e117c[_0x7e2c('0xae')]=0x3;_0x1e117c['statedesc']='NoAnswer';_0x1e117c[_0x7e2c('0xf2')]+=0x1;_0x1e117c[_0x7e2c('0xef')]+=0x1;ami[_0x7e2c('0x50')](_0x7e2c('0x1b4'),ut['buildObj'](_0x5af68a,_0x7e2c('0x1b5')));_0x1fc59e[_0x7e2c('0xcd')](_0x1e117c)[_0x7e2c('0xb5')](loggerCatch(_0x7e2c('0x1b6')));if(_0x1fc59e[_0x7e2c('0x1b2')](0x3,_0x5af68a,_0x25173d)){if(_0x1e117c[_0x7e2c('0xf2')]>=_0x25173d[_0x7e2c('0x1a3')]){_0x1fc59e[_0x7e2c('0xf9')](_0x1e117c,_0x29ddd6,_0x1916ef,_0x7e2c('0x1b7'));}else{_0x1fc59e['stateGlobal'](_0x1e117c,_0x29ddd6,_0x1916ef,_0x7e2c('0x1b7'));}}break;case'5':_0x25173d[_0x7e2c('0x65')]+=0x1;_0x1e117c['state']=0x5;_0x1e117c[_0x7e2c('0xe4')]='Busy';_0x1e117c[_0x7e2c('0xf1')]+=0x1;_0x1e117c[_0x7e2c('0xef')]+=0x1;ami[_0x7e2c('0x50')]('custom:agentbusy',ut[_0x7e2c('0xe8')](_0x5af68a,_0x7e2c('0x1b8')));_0x1fc59e['createHistory'](_0x1e117c)[_0x7e2c('0xb5')](loggerCatch(_0x7e2c('0x1b9')));if(_0x1fc59e[_0x7e2c('0x1b2')](0x5,_0x5af68a,_0x25173d)){if(_0x1e117c[_0x7e2c('0xf1')]>=_0x25173d['dialBusyMaxRetry']){_0x1fc59e[_0x7e2c('0xf9')](_0x1e117c,_0x29ddd6,_0x1916ef,_0x7e2c('0x1ba'));}else{_0x1fc59e['stateGlobal'](_0x1e117c,_0x29ddd6,_0x1916ef,_0x7e2c('0x1ba'));}}break;case'8':_0x25173d[_0x7e2c('0x66')]+=0x1;_0x1e117c[_0x7e2c('0xae')]=0x8;_0x1e117c[_0x7e2c('0xe4')]=_0x7e2c('0x1bb');_0x1e117c[_0x7e2c('0x1a2')]+=0x1;_0x1e117c[_0x7e2c('0xef')]+=0x1;ami[_0x7e2c('0x50')](_0x7e2c('0x1bc'),ut[_0x7e2c('0xe8')](_0x5af68a,_0x7e2c('0x1bd')));_0x1fc59e[_0x7e2c('0xcd')](_0x1e117c)[_0x7e2c('0xb5')](loggerCatch(_0x7e2c('0x1be')));if(_0x1fc59e[_0x7e2c('0x1b2')](0x8,_0x5af68a,_0x25173d)){if(_0x1e117c['countcongestionretry']>=_0x25173d[_0x7e2c('0x1a8')]){_0x1fc59e[_0x7e2c('0xf9')](_0x1e117c,_0x29ddd6,_0x1916ef,_0x7e2c('0x1bf'));}else{_0x1fc59e['stateGlobal'](_0x1e117c,_0x29ddd6,_0x1916ef,_0x7e2c('0x1bf'));}}break;case'11':_0x25173d[_0x7e2c('0x1c0')]+=0x1;_0x1e117c[_0x7e2c('0xae')]=0xb;_0x1e117c[_0x7e2c('0xe4')]=_0x7e2c('0x120');_0x1e117c[_0x7e2c('0xf4')]+=0x1;_0x1e117c['countglobal']+=0x1;_0x1fc59e[_0x7e2c('0xcd')](_0x1e117c)['catch'](loggerCatch(_0x7e2c('0x125')));if(_0x1fc59e[_0x7e2c('0x1b2')](0xb,_0x5af68a,_0x25173d)){if(_0x1e117c[_0x7e2c('0xf4')]>=_0x25173d[_0x7e2c('0x122')]){_0x1fc59e[_0x7e2c('0xf9')](_0x1e117c,_0x29ddd6,_0x1916ef,'reason\x2011\x20abandoned');}else{_0x1fc59e[_0x7e2c('0xf6')](_0x1e117c,_0x29ddd6,_0x1916ef,'reason\x2011\x20abandoned');}}break;case'20':_0x25173d['outboundRejectCallsDay']+=0x1;_0x1e117c['state']=0x14;_0x1e117c['statedesc']='AgentReject';_0x1e117c[_0x7e2c('0x103')]+=0x1;_0x1e117c[_0x7e2c('0xef')]+=0x1;ami[_0x7e2c('0x50')](_0x7e2c('0x1c1'),ut[_0x7e2c('0xe8')](_0x5af68a,_0x7e2c('0x1c2')));_0x1fc59e['createHistory'](_0x1e117c)[_0x7e2c('0xb5')](loggerCatch(_0x7e2c('0x1c3')));if(_0x1fc59e[_0x7e2c('0x1b2')](0x14,_0x5af68a,_0x25173d)){if(_0x1e117c[_0x7e2c('0x103')]>=_0x25173d[_0x7e2c('0x1c4')]){_0x1fc59e['createStateFinal'](_0x1e117c,_0x29ddd6,_0x1916ef,_0x7e2c('0x1c5'));}else{_0x1fc59e['stateGlobal'](_0x1e117c,_0x29ddd6,_0x1916ef,_0x7e2c('0x1c5'));}}break;default:_0x25173d['outboundUnknownCallsDay']+=0x1;_0x1e117c[_0x7e2c('0xae')]=0xc;_0x1e117c[_0x7e2c('0xe4')]=_0x1c4d5d[_0x7e2c('0x10e')];_0x1fc59e[_0x7e2c('0xcd')](_0x1e117c)[_0x7e2c('0xb5')](loggerCatch(_0x7e2c('0x1c6')));if(_0x1fc59e[_0x7e2c('0x1b2')](_0x1c4d5d[_0x7e2c('0x10e')],_0x5af68a,_0x25173d)){if(_0x1e117c[_0x7e2c('0xf1')]+_0x1e117c[_0x7e2c('0x1a2')]+_0x1e117c[_0x7e2c('0xf2')]+_0x1e117c[_0x7e2c('0x102')]+_0x1e117c['countdropretry']+_0x1e117c[_0x7e2c('0xf4')]+_0x1e117c['countmachineretry']+_0x1e117c[_0x7e2c('0x103')]>=_0x25173d[_0x7e2c('0xf5')]){_0x1fc59e[_0x7e2c('0xf6')](_0x1e117c,_0x29ddd6,_0x1916ef,_0x1c4d5d[_0x7e2c('0x10e')]);}else{_0x1fc59e[_0x7e2c('0xf9')](_0x1e117c,_0x29ddd6,_0x1916ef,_0x1c4d5d['reason']);}}}});};Dialer[_0x7e2c('0x1c')][_0x7e2c('0xf6')]=function(_0x59effc,_0x237e41,_0x4396a5,_0x5ec7a5){var _0x3fec35=new Final(_0x59effc);_0x3fec35['state']=0xf;_0x3fec35[_0x7e2c('0xe4')]='Global';this['createStateFinal'](_0x3fec35,_0x237e41,_0x4396a5,_0x5ec7a5);};Dialer[_0x7e2c('0x1c')][_0x7e2c('0xf9')]=function(_0xed8b4e,_0x98bb24,_0x142d28,_0x1cd7f7){this[_0x7e2c('0xcb')](_0xed8b4e)[_0x7e2c('0xbd')](function(){return _0x98bb24(msgResponse(_0x7e2c('0x1ad'),'Success',_0x1cd7f7));})[_0x7e2c('0xb5')](function(){return _0x142d28(msgResponse(_0x7e2c('0x1c7'),_0x7e2c('0x145'),_0x7e2c('0x1c8')));});};Dialer[_0x7e2c('0x1c')][_0x7e2c('0xc')]=function(_0x5f2cee){var _0x40375e=_0x5f2cee[_0x7e2c('0x1c9')]/0x64;var _0x500abf=_0x5f2cee[_0x7e2c('0x69')]/(_0x5f2cee[_0x7e2c('0x69')]+_0x5f2cee[_0x7e2c('0x63')]);var _0x32c92c=Math[_0x7e2c('0x1ca')](_0x5f2cee['predictiveIntervalAvailable']*(_0x5f2cee[_0x7e2c('0x1cb')]/0x64));var _0x14e27b=Math[_0x7e2c('0x1ca')](_0x5f2cee['predictiveIntervalAvailable']*(_0x5f2cee['predictiveIntervalMinThreshold']/0x64));var _0x39010a=_0x5f2cee[_0x7e2c('0xa9')]+_0x5f2cee[_0x7e2c('0x57')];var _0x206b93=Math[_0x7e2c('0x1cc')](_0x5f2cee[_0x7e2c('0x77')]*_0x5f2cee[_0x7e2c('0x93')]*_0x5f2cee[_0x7e2c('0x72')]*_0x5f2cee['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x5f2cee[_0x7e2c('0x1cd')])){if(!_['isUndefined'](_0x5f2cee[_0x7e2c('0x79')])){_0x5f2cee[_0x7e2c('0x79')]=undefined;loggerPredictive['error'](_0x7e2c('0x1ce'),_0x7e2c('0x1cf'));}if(!_['isUndefined'](_0x5f2cee[_0x7e2c('0x98')])){loggerPredictive['error'](_0x7e2c('0x1ce'),_0x7e2c('0x1d0'));clearInterval(_0x5f2cee['handlePredictive']);_0x5f2cee[_0x7e2c('0x98')]=undefined;}_0x5f2cee['startProgressive']=moment()[_0x7e2c('0x7d')](_0x7e2c('0x105'));loggerPredictive[_0x7e2c('0x83')](_0x5f2cee[_0x7e2c('0x44')],_0x7e2c('0x1d1'),_0x5f2cee[_0x7e2c('0x1cd')]);this['handlePower'](_0x5f2cee,0x1);}else if(ifInterval(_0x5f2cee[_0x7e2c('0x1d2')],_0x5f2cee[_0x7e2c('0x1cd')])){this[_0x7e2c('0x15b')](_0x5f2cee,0x1);loggerPredictiveCalls['info'](_0x7e2c('0x1d3'),_0x5f2cee[_0x7e2c('0x1cd')],_0x5f2cee[_0x7e2c('0x44')]);_0x5f2cee[_0x7e2c('0x77')]=0x0;_0x5f2cee[_0x7e2c('0x71')]=0x0;}else if(_0x40375e<_0x500abf&&_0x5f2cee[_0x7e2c('0x1d4')]===_0x7e2c('0x1d5')){freeVariablesPredictive(_0x5f2cee);loggerPredictive[_0x7e2c('0x83')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x7e2c('0x1d6'),_0x500abf,_0x7e2c('0x1cd'),_0x5f2cee[_0x7e2c('0x44')]);}else if(_0x206b93<_0x5f2cee[_0x7e2c('0x71')]&&_0x5f2cee['dialPredictiveOptimization']===_0x7e2c('0x1d5')){freeVariablesPredictive(_0x5f2cee);loggerPredictive[_0x7e2c('0x83')](_0x7e2c('0x1d7'),_0x7e2c('0x1d8'),_0x206b93,'Drop\x20in\x20this\x20interval',_0x5f2cee[_0x7e2c('0x71')],'startProgressive',_0x5f2cee['name']);}else if(!ifInterval(_0x5f2cee[_0x7e2c('0x1d2')],_0x5f2cee[_0x7e2c('0x1cd')])&&_['isUndefined'](_0x5f2cee['startPredictive'])&&!_['isUndefined'](_0x5f2cee['startProgressive'])){_0x5f2cee[_0x7e2c('0x79')]=moment()[_0x7e2c('0x7d')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x5f2cee[_0x7e2c('0x44')],_0x7e2c('0x1d9'),_0x5f2cee[_0x7e2c('0x79')]);this[_0x7e2c('0x1da')](_0x5f2cee[_0x7e2c('0x1d2')])[_0x7e2c('0xbd')](this[_0x7e2c('0x1db')](_0x5f2cee))[_0x7e2c('0xbd')](mergeDataErlangB(_0x5f2cee))[_0x7e2c('0xbd')](this['startMethodPredictive'](_0x5f2cee))['catch'](loggerCatchPredictive(_0x7e2c('0x1dc'),_0x5f2cee));}else if(!ifInterval(_0x5f2cee[_0x7e2c('0x1d2')],_0x5f2cee[_0x7e2c('0x79')])){_0x5f2cee[_0x7e2c('0x71')]=0x0;_0x5f2cee[_0x7e2c('0x79')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x7e2c('0x83')](_0x5f2cee['name'],_0x7e2c('0x1dd'),_0x5f2cee['startPredictive']);clearInterval(_0x5f2cee[_0x7e2c('0x98')]);_0x5f2cee[_0x7e2c('0x98')]=undefined;this[_0x7e2c('0x1da')](_0x5f2cee['dialPredictiveInterval'])[_0x7e2c('0xbd')](this[_0x7e2c('0x1db')](_0x5f2cee))[_0x7e2c('0xbd')](mergeDataErlangB(_0x5f2cee))[_0x7e2c('0xbd')](this['startMethodPredictive'](_0x5f2cee))[_0x7e2c('0xb5')](loggerCatchPredictive(_0x7e2c('0x1de'),_0x5f2cee));}else if(_0x5f2cee[_0x7e2c('0x75')]&&_0x39010a<_0x5f2cee[_0x7e2c('0x75')]-_0x14e27b){freeVariablesPredictive(_0x5f2cee);loggerPredictive[_0x7e2c('0x83')](_0x5f2cee[_0x7e2c('0x44')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x39010a,_0x7e2c('0x1df'),_0x5f2cee[_0x7e2c('0x75')],'-',_0x14e27b,'=',_0x5f2cee['predictiveIntervalAvailable']-_0x14e27b,')');}else if(_0x5f2cee['predictiveIntervalAvailable']&&_0x39010a>_0x5f2cee[_0x7e2c('0x75')]+_0x32c92c){freeVariablesPredictive(_0x5f2cee);loggerPredictive[_0x7e2c('0x83')](_0x5f2cee[_0x7e2c('0x44')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x39010a,_0x7e2c('0x1e0'),_0x5f2cee[_0x7e2c('0x75')],'+',_0x32c92c,'=',_0x5f2cee[_0x7e2c('0x75')]+_0x32c92c,')');}};Dialer[_0x7e2c('0x1c')][_0x7e2c('0x1db')]=function(_0x577724){var _0x14d71e=this;return function(_0x4f732f){return new BPromise(function(_0x5f0f73,_0x209613){_[_0x7e2c('0x96')](_0x577724,_0x4f732f[0x0]);if(checkGetDataPredictive(_0x4f732f[0x0])){var _0x35d304=_0x577724[_0x7e2c('0x75')]=_0x577724[_0x7e2c('0x57')]+_0x577724[_0x7e2c('0xa9')];var _0x423ead=_0x577724[_0x7e2c('0x1d2')]*0x3c;var _0x441f6f=_0x4f732f[0x0]['predictiveIntervalAvgTalktime']+_0x4f732f[0x0][_0x7e2c('0x6e')];var _0x594af0=(_0x4f732f[0x0][_0x7e2c('0x86')]+_0x4f732f[0x0][_0x7e2c('0x88')]+_0x4f732f[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4f732f[0x0][_0x7e2c('0x76')];_0x577724[_0x7e2c('0x72')]=_0x594af0>0x0?_0x594af0:0x1;switch(_0x577724['dialPredictiveOptimization']){case _0x7e2c('0x1d5'):var _0x3d03ca=_0x577724[_0x7e2c('0x1c9')]/0x64;return _0x14d71e[_0x7e2c('0x1e1')](_0x35d304,_0x423ead,_0x441f6f,_0x594af0,_0x3d03ca)[_0x7e2c('0xbd')](function(_0x1feb41){return _0x5f0f73(_0x1feb41);});case _0x7e2c('0x1e2'):var _0x158377=_0x577724[_0x7e2c('0x1c9')]/0x64;return _0x14d71e['busyFactor'](_0x35d304,_0x423ead,_0x441f6f,_0x594af0,_0x158377)['then'](function(_0x6dc2ae){return _0x5f0f73(_0x6dc2ae);});default:return _0x209613(msgResponse(_0x7e2c('0x1e3'),_0x7e2c('0x145'),_0x7e2c('0x1e4')));}}else{return _0x209613(msgResponse(_0x7e2c('0x1e3'),_0x7e2c('0x145'),_0x7e2c('0x1e5')));}});};};Dialer[_0x7e2c('0x1c')][_0x7e2c('0x1e6')]=function(_0x5d96d4){var _0x237451=this;return function(_0x4c4492){return new BPromise(function(_0x5dbcff,_0xcdd818){_['merge'](_0x5d96d4,_0x4c4492[0x0]);if(checkGetDataPredictive(_0x4c4492[0x0])){loggerPredictive['info'](JSON[_0x7e2c('0x4c')](_0x4c4492[0x0]));if(_0x5d96d4[_0x7e2c('0x1d4')]==='dropRate'){return _0x237451[_0x7e2c('0xc9')](_0x5d96d4['id'])[_0x7e2c('0xbd')](function(_0x4b4a2f){var _0x279cc6=_0x5d96d4[_0x7e2c('0x1e7')]-_0x4b4a2f[0x0][_0x7e2c('0x1e8')];var _0x1f2308=_0x5d96d4[_0x7e2c('0x1d2')]*0x3c;var _0x809012=_0x4c4492[0x0]['predictiveIntervalAvgTalktime']+_0x4c4492[0x0][_0x7e2c('0x6e')];var _0x1de763=(_0x4c4492[0x0][_0x7e2c('0x86')]+_0x4c4492[0x0][_0x7e2c('0x88')]+_0x4c4492[0x0][_0x7e2c('0x70')])/_0x4c4492[0x0][_0x7e2c('0x76')];var _0x20cebf=_0x5d96d4[_0x7e2c('0x1c9')]/0x64;_0x5d96d4['predictiveIntervalPauses']=_0x4b4a2f[0x0][_0x7e2c('0x1e8')]||0x0;_0x5d96d4[_0x7e2c('0x72')]=_0x1de763>0x0?_0x1de763:0x1;return _0x237451[_0x7e2c('0x1e1')](_0x279cc6,_0x1f2308,_0x809012,_0x1de763,_0x20cebf);})['then'](function(_0x4476bf){return _0x5dbcff(_0x4476bf);})[_0x7e2c('0xb5')](function(_0x235334){return _0xcdd818(msgResponse('[CatchErlangB]','Failure',JSON[_0x7e2c('0x4c')](_0x235334)));});}if(_0x5d96d4[_0x7e2c('0x1d4')]==='agentBusyFactor'){return _0x237451['getVoiceQueueRtPauses'](_0x5d96d4['id'])[_0x7e2c('0xbd')](function(_0x4fcd3d){var _0x31b839=_0x5d96d4[_0x7e2c('0x1e7')]-_0x4fcd3d[0x0]['outboundQueuePauses'];var _0x12e07e=_0x5d96d4[_0x7e2c('0x1d2')]*0x3c;var _0x267c16=_0x4c4492[0x0][_0x7e2c('0x6f')]+_0x4c4492[0x0]['predictiveIntervalAvgHoldtime'];var _0x587ceb=(_0x4c4492[0x0][_0x7e2c('0x86')]+_0x4c4492[0x0][_0x7e2c('0x88')]+_0x4c4492[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4c4492[0x0][_0x7e2c('0x76')];var _0x592b9b=_0x5d96d4['dialPredictiveOptimizationPercentage']/0x64;_0x5d96d4[_0x7e2c('0x74')]=_0x4fcd3d[0x0]['outboundQueuePauses']||0x0;_0x5d96d4['predictiveIntervalHitRate']=_0x587ceb>0x0?_0x587ceb:0x1;return _0x237451[_0x7e2c('0x1e9')](_0x31b839,_0x12e07e,_0x267c16,_0x587ceb,_0x592b9b);})[_0x7e2c('0xbd')](function(_0x38a788){return _0x5dbcff(_0x38a788);})[_0x7e2c('0xb5')](function(_0x38f589){return _0xcdd818(msgResponse('[CatchErlangB]','Failure',JSON['stringify'](_0x38f589)));});}}else{return _0xcdd818(msgResponse(_0x7e2c('0x1e3'),_0x7e2c('0x145'),_0x7e2c('0x1e5')));}});};};Dialer[_0x7e2c('0x1c')][_0x7e2c('0x1ea')]=function(_0x132e46){var _0xfaf626=this;return function(){var _0x43aebb=0x0;var _0x14e409=Math[_0x7e2c('0x1cc')](_0x132e46[_0x7e2c('0x78')]*0x3e8);if(_0x14e409>0x0){_0x14e409=_0x14e409<0x64?0x64:_0x14e409;loggerPredictive[_0x7e2c('0x83')](_0x132e46['name'],_0x7e2c('0x1eb'),_0x14e409,_0x7e2c('0x4d'));_0x132e46[_0x7e2c('0x98')]=setInterval(function(){_0xfaf626[_0x7e2c('0x98')](_0x132e46);loggerPredictiveCalls['info']('[handlePredictive]',_0x43aebb+=0x1);},_0x14e409);}else{loggerPredictive[_0x7e2c('0x83')](_0x132e46['name'],_0x7e2c('0x1ec'));}};};Dialer['prototype'][_0x7e2c('0x1ed')]=function(_0xb4d3e8,_0x492e26){var _0x2d96ad=this;return function(_0x3ec32a){if(_[_0x7e2c('0x82')](_0x3ec32a)){if(_[_0x7e2c('0xde')](_0x492e26[_0x7e2c('0xd4')])||!_0x492e26[_0x7e2c('0x1ee')]){if(_0xb4d3e8[_0x7e2c('0x5d')]===_0x7e2c('0xb')){_0xb4d3e8['queueStatusComplete']=_['isUndefined'](_0xb4d3e8[_0x7e2c('0x1ef')])?!![]:_0xb4d3e8[_0x7e2c('0x1ef')];var _0x4abc43=uuid['v4']();_0x2d96ad['actions'][_0x4abc43]=new Action(_0xb4d3e8,_0x492e26,_0x4abc43);loggerBooked[_0x7e2c('0x83')](_0x7e2c('0x1f0'),_0x4abc43,_0x7e2c('0x1f1'),JSON[_0x7e2c('0x4c')](_0xb4d3e8[_0x7e2c('0x1ef')]),'Queue:\x20',_0xb4d3e8[_0x7e2c('0x44')]);if(_0xb4d3e8[_0x7e2c('0x1ef')]){_0xb4d3e8[_0x7e2c('0x1ef')]=![];_0x2d96ad[_0x7e2c('0x2b')][_0x2d96ad[_0x7e2c('0x27')][_0x4abc43]['queue']]=[];ami[_0x7e2c('0x14a')]({'actionid':_0x4abc43,'action':_0x7e2c('0x1f2'),'queue':_0xb4d3e8[_0x7e2c('0x44')]})[_0x7e2c('0xb5')](function(){_0x2d96ad[_0x7e2c('0xb8')](_0xb4d3e8);_0x2d96ad[_0x7e2c('0xc2')]({'active':![],'ContactId':_0x2d96ad[_0x7e2c('0x27')][_0x4abc43][_0x7e2c('0xd3')],'ListId':_0x2d96ad[_0x7e2c('0x27')][_0x4abc43]['ListId'],'VoiceQueueId':_0x2d96ad[_0x7e2c('0x27')][_0x4abc43][_0x7e2c('0xd5')]||undefined,'CampaignId':_0x2d96ad[_0x7e2c('0x27')][_0x4abc43][_0x7e2c('0xd6')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x2d96ad[_0x7e2c('0x27')][_0x4abc43];});}else{loggerBooked[_0x7e2c('0x83')](_0x7e2c('0x1f3'),JSON['stringify'](_0xb4d3e8['queueStatusComplete']),'Queue:\x20',_0xb4d3e8['name']);_0x2d96ad[_0x7e2c('0xb8')](_0xb4d3e8);_0x2d96ad[_0x7e2c('0xc2')]({'active':![],'ContactId':_0x2d96ad[_0x7e2c('0x27')][_0x4abc43][_0x7e2c('0xd3')],'ListId':_0x2d96ad[_0x7e2c('0x27')][_0x4abc43][_0x7e2c('0xfc')],'VoiceQueueId':_0x2d96ad[_0x7e2c('0x27')][_0x4abc43][_0x7e2c('0xd5')]||undefined,'CampaignId':_0x2d96ad['actions'][_0x4abc43][_0x7e2c('0xd6')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x2d96ad[_0x7e2c('0x27')][_0x4abc43];}}else{return _0x2d96ad[_0x7e2c('0x170')](_0xb4d3e8,_0x492e26);}}else{if(getDiff(_0x492e26['scheduledat'])<_0xb4d3e8[_0x7e2c('0x1f4')]*0x3c){if(_0x492e26[_0x7e2c('0x1f5')]&&!_0x492e26[_0x7e2c('0x1f5')]['voicePause']){_0x2d96ad['preview'][_0x7e2c('0x12e')](_0x492e26['id'])[_0x7e2c('0x130')](function(){_0x2d96ad['updateOriginated'](_0xb4d3e8);});}else{_0x2d96ad[_0x7e2c('0xc4')]({'active':![]},_0x492e26['id'],0x1)[_0x7e2c('0x130')](function(){_0x2d96ad['updateOriginated'](_0xb4d3e8);});}}else{_0xb4d3e8['outboundReCallsDay']+=0x1;_0x2d96ad[_0x7e2c('0xb8')](_0xb4d3e8);if(_0xb4d3e8[_0x7e2c('0x1f6')]){_0x2d96ad[_0x7e2c('0xc2')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x492e26[_0x7e2c('0xd3')],'ListId':_0x492e26['ListId'],'VoiceQueueId':_0x492e26['VoiceQueueId']||undefined,'CampaignId':_0x492e26[_0x7e2c('0xd6')]||undefined})[_0x7e2c('0xb5')](loggerCatch(_0x7e2c('0x1f7')));_0x2d96ad[_0x7e2c('0xcd')](createObjHistory(_0xb4d3e8,_0x492e26,_0x7e2c('0x1f8'),0x17,_0x7e2c('0x1f9')))['catch'](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x2d96ad['saveInDb'](createObjHistory(_0xb4d3e8,_0x492e26,'RECALLFAILEDTIMEOUT',0x16,_0x7e2c('0x1fa')),_0x7e2c('0x1fb'),_0x7e2c('0x1fc'));}}}}else{_0xb4d3e8['outboundBlacklistCallsDay']+=0x1;_0x2d96ad[_0x7e2c('0xd2')](createObjHistory(_0xb4d3e8,_0x492e26,_0x7e2c('0x1fd'),0xd,_0x7e2c('0x1fe')),_0x7e2c('0x1ff'),_0x7e2c('0x200'));throw _0x7e2c('0x201');}};};Dialer['prototype']['handleIvr']=function(_0x143c6c){var _0x29df85=this;var _0xb2e987=_0x143c6c[_0x7e2c('0x202')]-_0x143c6c['originated']-_0x143c6c[_0x7e2c('0xc6')];emitCampaignSummary(_0x143c6c);if(_0xb2e987>0x0){if(_0xb2e987>this[_0x7e2c('0x25')]){_0xb2e987=this[_0x7e2c('0x25')];}_0x143c6c[_0x7e2c('0xc6')]+=_0xb2e987;this[_0x7e2c('0xc8')](_0x143c6c['id'],_0xb2e987,_0x143c6c['dialOrderByScheduledAt'],_0x143c6c)[_0x7e2c('0xbd')](function(_0x2fe74e){_0x143c6c[_0x7e2c('0xc6')]-=_0xb2e987;_0x143c6c[_0x7e2c('0xc6')]=_0x143c6c[_0x7e2c('0xc6')]>0x0?_0x143c6c['temp']:0x0;if(!checkContactEmpty(_0x2fe74e)){_0x143c6c['message']=_0x7e2c('0xa6');logger[_0x7e2c('0x83')](_0x7e2c('0x203')+_0x143c6c[_0x7e2c('0x44')]);}else{_0x143c6c['originated']+=_0x2fe74e[_0x7e2c('0xa0')];_0x143c6c[_0x7e2c('0x43')]=_0x7e2c('0x204');for(var _0x23e8a0=0x0;_0x23e8a0<_0x2fe74e[_0x7e2c('0xa0')];_0x23e8a0+=0x1){_0x143c6c[_0x7e2c('0x205')]+=0x1;if(_['isNil'](_0x2fe74e[_0x23e8a0])||_['isNil'](_0x2fe74e[_0x23e8a0]['Contact'])||_[_0x7e2c('0xde')](_0x2fe74e[_0x23e8a0]['Contact'][_0x7e2c('0x175')])){_0x29df85['emptyContact']('[actionOriginate]\x20',_0x143c6c,_0x2fe74e[_0x23e8a0]);}else{_0x29df85[_0x7e2c('0xbf')](_[_0x7e2c('0x135')](_0x2fe74e[_0x23e8a0],[_0x7e2c('0xd6'),'Contact.phone']))[_0x7e2c('0xbd')](_0x29df85['checkContactBlack'](_0x143c6c,_0x2fe74e[_0x23e8a0]))[_0x7e2c('0xb5')](_0x29df85[_0x7e2c('0x206')]('[actionOriginateIvr]\x20',_0x143c6c));}}}})[_0x7e2c('0xb5')](loggerGetContactDialer('[getContactCampaign2]',_0x143c6c,_0xb2e987));}};Dialer[_0x7e2c('0x1c')]['handlePower']=function(_0x441657,_0x5d75df){var _0x4c8239=this;var _0x4834d3=[];var _0x4b2f08=_0x5d75df>=0x1?_0x5d75df:0x1;if(_0x441657['dialMethod']===_0x7e2c('0xb')){_0x4b2f08=0x1;}var _0x2765cc=Math[_0x7e2c('0x1cc')](_0x441657[_0x7e2c('0xa9')]*_0x4b2f08)-_0x441657[_0x7e2c('0xa1')]-_0x441657[_0x7e2c('0xc6')];emitVoiceQueueSummary(_0x441657);if(_0x441657[_0x7e2c('0x207')]>0x0){var _0x4c8447=_0x441657[_0x7e2c('0x207')]-_0x441657[_0x7e2c('0xa1')]-_0x441657[_0x7e2c('0x57')]-_0x441657[_0x7e2c('0xc6')]-_0x441657[_0x7e2c('0x53')];if(_0x2765cc>_0x4c8447){_0x2765cc=_0x4c8447;}}if(_0x2765cc>0x0){if(_0x441657[_0x7e2c('0x5d')]===_0x7e2c('0xb')){_0x2765cc=0x1;}if(_0x2765cc>this[_0x7e2c('0x25')]){_0x2765cc=this[_0x7e2c('0x25')];}_0x441657[_0x7e2c('0xc6')]+=_0x2765cc;for(var _0x5568ab in this[_0x7e2c('0x23')]){if(typeof this[_0x7e2c('0x23')][_0x5568ab]!==_0x7e2c('0xb3')){if(this['agents'][_0x5568ab]['state']===_0x7e2c('0x208')&&this[_0x7e2c('0x23')][_0x5568ab]['status']===_0x7e2c('0x209')){_0x4834d3[_0x7e2c('0x12b')](this[_0x7e2c('0x23')][_0x5568ab]['id']);}}}this['getContactDialer'](_0x441657['id'],_0x4834d3,_0x2765cc,_0x441657[_0x7e2c('0x20a')],_0x441657)[_0x7e2c('0xbd')](function(_0x1dbbbe){_0x441657[_0x7e2c('0xc6')]-=_0x2765cc;_0x441657['temp']=_0x441657['temp']>0x0?_0x441657[_0x7e2c('0xc6')]:0x0;if(!checkContactEmpty(_0x1dbbbe)){_0x4c8239[_0x7e2c('0xba')](_0x441657)[_0x7e2c('0xbd')](sendMessageReschedule(_0x441657))[_0x7e2c('0xb5')](loggerCatch(_0x7e2c('0x20b')));}else{_0x441657[_0x7e2c('0xa1')]+=_0x1dbbbe['length'];_0x441657['message']=_0x441657[_0x7e2c('0x5d')]===_0x7e2c('0xb')?_0x7e2c('0x17b'):'RUNNING';for(var _0xcce615=0x0;_0xcce615<_0x1dbbbe['length'];_0xcce615+=0x1){if(_[_0x7e2c('0xde')](_0x1dbbbe[_0xcce615])||_['isNil'](_0x1dbbbe[_0xcce615][_0x7e2c('0x174')])||_[_0x7e2c('0xde')](_0x1dbbbe[_0xcce615][_0x7e2c('0x174')]['phone'])){_0x4c8239[_0x7e2c('0xd1')](_0x7e2c('0x20c'),_0x441657,_0x1dbbbe[_0xcce615]);}else{_0x4c8239['checkIsBlackList'](_[_0x7e2c('0x135')](_0x1dbbbe[_0xcce615],[_0x7e2c('0xd5'),_0x7e2c('0x20d')]))[_0x7e2c('0xbd')](_0x4c8239[_0x7e2c('0x1ed')](_0x441657,_0x1dbbbe[_0xcce615]))[_0x7e2c('0xb5')](_0x4c8239[_0x7e2c('0x206')](_0x7e2c('0x20c'),_0x441657));}}}})[_0x7e2c('0xb5')](loggerGetContactDialer('[getContactDialer2]',_0x441657,_0x2765cc));}};Dialer[_0x7e2c('0x1c')][_0x7e2c('0x98')]=function(_0x5d05c8){if(_0x5d05c8[_0x7e2c('0x207')]>0x0){var _0x1ba070=_0x5d05c8['dialLimitQueue']-_0x5d05c8[_0x7e2c('0xa1')]-_0x5d05c8[_0x7e2c('0x57')];if(_0x1ba070>0x0){this['tryOriginatePredictive'](_0x5d05c8);}else{loggerPredictiveCalls[_0x7e2c('0x83')]('[handlePredictive][limitChannel]');}}else{this[_0x7e2c('0x20e')](_0x5d05c8);}};Dialer[_0x7e2c('0x1c')][_0x7e2c('0x20e')]=function(_0x497797){var _0x2188cf=this;var _0x5e8b41=[];_0x497797[_0x7e2c('0xa1')]+=0x1;for(var _0x4505f2 in this[_0x7e2c('0x23')]){if(typeof this[_0x7e2c('0x23')][_0x4505f2]!==_0x7e2c('0xb3')){if(this['agents'][_0x4505f2][_0x7e2c('0xae')]===_0x7e2c('0x208')&&this['agents'][_0x4505f2]['status']===_0x7e2c('0x209')){_0x5e8b41['push'](this['agents'][_0x4505f2]['id']);}}}this[_0x7e2c('0xc5')](_0x497797['id'],_0x5e8b41,0x1,_0x497797[_0x7e2c('0x20a')],_0x497797)[_0x7e2c('0xbd')](function(_0x58766a){if(!checkContactEmpty(_0x58766a)){checkContactLowerLimitOriginate(_0x497797,0x1,0x0);_0x2188cf[_0x7e2c('0xba')](_0x497797)[_0x7e2c('0xbd')](sendMessageReschedule(_0x497797))[_0x7e2c('0xb5')](loggerCatch('[countReScheduled]\x20'));}else{_0x497797[_0x7e2c('0x43')]=_0x7e2c('0x204');if(_[_0x7e2c('0xde')](_0x58766a[0x0])||_[_0x7e2c('0xde')](_0x58766a[0x0][_0x7e2c('0x174')])||_[_0x7e2c('0xde')](_0x58766a[0x0][_0x7e2c('0x174')]['phone'])){_0x2188cf['emptyContact'](_0x7e2c('0x20c'),_0x497797,_0x58766a[0x0]);}else{_0x2188cf[_0x7e2c('0xbc')](_[_0x7e2c('0x135')](_0x58766a[0x0],['VoiceQueueId','Contact.phone']))['then'](_0x2188cf[_0x7e2c('0x1ed')](_0x497797,_0x58766a[0x0]))[_0x7e2c('0xb5')](_0x2188cf['loggerHandler'](_0x7e2c('0x20f'),_0x497797));}}})[_0x7e2c('0xb5')](loggerGetContactDialer(_0x7e2c('0x210'),_0x497797,0x1));emitVoiceQueueSummary(_0x497797);};Dialer['prototype'][_0x7e2c('0x1e1')]=function(_0x5c9b4a,_0x45df0b,_0x733d74,_0x3293ea,_0x25a478,_0x4431d2){loggerPredictive[_0x7e2c('0x83')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x7e2c('0x83')](_0x7e2c('0x211'),_0x5c9b4a);loggerPredictive[_0x7e2c('0x83')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x45df0b);loggerPredictive[_0x7e2c('0x83')](_0x7e2c('0x212'),_0x733d74);loggerPredictive[_0x7e2c('0x83')](_0x7e2c('0x213'),_0x3293ea);loggerPredictive[_0x7e2c('0x83')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x25a478);loggerPredictive[_0x7e2c('0x83')]('---------------------------');return new BPromise(function(_0x211ed6,_0x485b9d){if(_0x5c9b4a<=0x0||isNaN(_0x5c9b4a)){return _0x485b9d(msgResponse('[abandonmentRate]',_0x7e2c('0x4b'),_0x7e2c('0x214')+_0x5c9b4a));}if(_0x733d74<=0x0||isNaN(_0x733d74)){return _0x485b9d(msgResponse(_0x7e2c('0x215'),'Error','Ts\x20=\x20'+_0x733d74));}if(_0x3293ea<=0x0||isNaN(_0x3293ea)){return _0x485b9d(msgResponse(_0x7e2c('0x215'),'Error',_0x7e2c('0x216')+_0x3293ea));}if(_0x45df0b<=0x0||isNaN(_0x45df0b)){return _0x485b9d(msgResponse(_0x7e2c('0x215'),_0x7e2c('0x4b'),_0x7e2c('0x217')+_0x45df0b));}if(_0x25a478<=0x0||isNaN(_0x25a478)){return _0x485b9d(msgResponse(_0x7e2c('0x215'),'Error',_0x7e2c('0x218')+_0x25a478));}_0x4431d2=_0x4431d2||0x0;var _0x2ec4fa=0x1/_0x733d74;var _0x485b37=0x0;var _0x366017=0x0;var _0x58777c=0x0;var _0x5b4f91=0x0;for(var _0x1e079b=0x0;_0x58777c<_0x25a478;_0x1e079b+=0x1){_0x366017=_0x1e079b/_0x45df0b;_0x485b37=(_0x3293ea*_0x366017+_0x4431d2)/_0x2ec4fa;_0x58777c=erlangb(_0x485b37,_0x5c9b4a);_0x5b4f91=_0x485b37/_0x5c9b4a*(0x1-erlangb(_0x485b37,_0x5c9b4a));}return _0x211ed6({'erlangCalls':_0x1e079b,'erlangCallToSecond':_0x45df0b/_0x1e079b,'erlangAbandonmentRate':_0x58777c,'erlangBusyFactor':_0x5b4f91});});};Dialer[_0x7e2c('0x1c')][_0x7e2c('0x1e9')]=function(_0x128480,_0x440ad5,_0x554473,_0x328bd8,_0x5a9484,_0x35a900){loggerPredictive[_0x7e2c('0x83')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x7e2c('0x83')](_0x7e2c('0x211'),_0x128480);loggerPredictive['info'](_0x7e2c('0x219'),_0x440ad5);loggerPredictive[_0x7e2c('0x83')]('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',_0x554473);loggerPredictive[_0x7e2c('0x83')](_0x7e2c('0x213'),_0x328bd8);loggerPredictive[_0x7e2c('0x83')](_0x7e2c('0x21a'),_0x5a9484);loggerPredictive[_0x7e2c('0x83')](_0x7e2c('0x8c'));return new BPromise(function(_0x2c08fd,_0x45ff01){if(_0x128480<=0x0||isNaN(_0x128480)){return _0x45ff01(msgResponse(_0x7e2c('0x21b'),_0x7e2c('0x4b'),_0x7e2c('0x214')+_0x128480));}if(_0x554473<=0x0||isNaN(_0x554473)){return _0x45ff01(msgResponse(_0x7e2c('0x21b'),_0x7e2c('0x4b'),_0x7e2c('0x21c')+_0x554473));}if(_0x328bd8<=0x0||isNaN(_0x328bd8)){return _0x45ff01(msgResponse(_0x7e2c('0x21b'),_0x7e2c('0x4b'),_0x7e2c('0x216')+_0x328bd8));}if(_0x440ad5<=0x0||isNaN(_0x440ad5)){return _0x45ff01(msgResponse(_0x7e2c('0x21b'),_0x7e2c('0x4b'),_0x7e2c('0x217')+_0x440ad5));}if(_0x5a9484<=0x0||isNaN(_0x5a9484)){return _0x45ff01(msgResponse(_0x7e2c('0x21b'),'Error',_0x7e2c('0x21d')+_0x5a9484));}_0x35a900=_0x35a900||0x0;var _0x5470d9=0x1/_0x554473;var _0x2ff448=0x0;var _0x27b9d2=0x0;var _0x18d490=0x0;var _0x3ef599=0x0;for(var _0x1cd579=0x0;_0x3ef599<_0x5a9484;_0x1cd579+=0x1){_0x27b9d2=_0x1cd579/_0x440ad5;_0x2ff448=(_0x328bd8*_0x27b9d2+_0x35a900)/_0x5470d9;_0x18d490=erlangb(_0x2ff448,_0x128480);_0x3ef599=_0x2ff448/_0x128480*(0x1-erlangb(_0x2ff448,_0x128480));}return _0x2c08fd({'erlangCalls':_0x1cd579,'erlangCallToSecond':_0x440ad5/_0x1cd579,'erlangAbandonmentRate':_0x18d490,'erlangBusyFactor':_0x3ef599});});};module[_0x7e2c('0x21e')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 5f236ca..b408b08 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce9d=['util','lodash','moment','milliseconds','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','droptime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xce9d,0x1ce));var _0xdce9=function(_0x1937fc,_0x120f75){_0x1937fc=_0x1937fc-0x0;var _0x2689cf=_0xce9d[_0x1937fc];return _0x2689cf;};'use strict';var util=require(_0xdce9('0x0'));var _=require(_0xdce9('0x1'));var moment=require(_0xdce9('0x2'));function getSeconds(_0x3f26cb,_0x489a82){var _0x2d702d=moment(_0x3f26cb)['milliseconds'](0x0);var _0x155991=moment(_0x489a82)[_0xdce9('0x3')](0x0);return _0x2d702d['diff'](_0x155991,_0xdce9('0x4'));}function QueueCallerAbandon(_0x360b42,_0x3b2a80){this[_0xdce9('0x5')]=_0x360b42[_0xdce9('0x5')];this[_0xdce9('0x6')]=_0x360b42[_0xdce9('0x6')];this[_0xdce9('0x7')]=_0x360b42[_0xdce9('0x6')]===_0xdce9('0x8')?_0xdce9('0x9'):_0x360b42[_0xdce9('0x6')];this['countbusyretry']=_0x360b42[_0xdce9('0xa')];this[_0xdce9('0xb')]=_0x360b42[_0xdce9('0xb')];this[_0xdce9('0xc')]=_0x360b42[_0xdce9('0xc')];this['countglobal']=_0x360b42[_0xdce9('0xa')]+_0x360b42[_0xdce9('0xb')]+_0x360b42[_0xdce9('0xc')]+_0x360b42['countnosuchnumberretry']+_0x360b42[_0xdce9('0xd')]+_0x360b42[_0xdce9('0xe')]+_0x360b42[_0xdce9('0xf')]+_0x360b42['countagentrejectretry'];this[_0xdce9('0x10')]=_0x360b42[_0xdce9('0x10')];this[_0xdce9('0xd')]=_0x360b42[_0xdce9('0xd')];this[_0xdce9('0xe')]=_0x360b42['countabandonedretry'];this[_0xdce9('0xf')]=_0x360b42[_0xdce9('0xf')];this['countagentrejectretry']=_0x360b42[_0xdce9('0x11')];this[_0xdce9('0x12')]=_0x3b2a80['uniqueid'];this[_0xdce9('0x13')]=_0x360b42[_0xdce9('0x14')];this[_0xdce9('0x15')]=_0x360b42['number'];this[_0xdce9('0x16')]=_0x360b42[_0xdce9('0x16')];this[_0xdce9('0x17')]=_0x360b42[_0xdce9('0x17')];this[_0xdce9('0x18')]=_0x360b42[_0xdce9('0x18')];this['endtime']=this['droptime'];this['ringtime']=getSeconds(_0x360b42[_0xdce9('0x17')],_0x360b42['starttime']);this[_0xdce9('0x19')]=getSeconds(this[_0xdce9('0x18')],_0x360b42[_0xdce9('0x17')]);this[_0xdce9('0x1a')]=0x0;this[_0xdce9('0x9')]=_0x3b2a80[_0xdce9('0x9')];this[_0xdce9('0x1b')]=_0x3b2a80[_0xdce9('0x1c')];this['reason']=_0x3b2a80[_0xdce9('0x1d')];this['callback']=_0x360b42[_0xdce9('0x1e')];this[_0xdce9('0x1f')]=_0x360b42[_0xdce9('0x1f')];this[_0xdce9('0x20')]=_0x360b42[_0xdce9('0x20')];this[_0xdce9('0x21')]=_0x360b42['recallme'];this[_0xdce9('0x22')]=_0x360b42[_0xdce9('0x22')];this[_0xdce9('0x23')]=_0x360b42[_0xdce9('0x23')];this[_0xdce9('0x24')]=_0x360b42[_0xdce9('0x24')];this[_0xdce9('0x25')]=_0x360b42[_0xdce9('0x25')];this[_0xdce9('0x26')]=_0x360b42[_0xdce9('0x26')];this[_0xdce9('0x27')]=_0x360b42['originatecalleridnum']||'';this[_0xdce9('0x28')]=_0x360b42[_0xdce9('0x28')]||'';}module[_0xdce9('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0x16fc=['countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','milliseconds','diff','seconds','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x16fc,0x1ab));var _0xc16f=function(_0x9b4e7a,_0x123c47){_0x9b4e7a=_0x9b4e7a-0x0;var _0x409334=_0x16fc[_0x9b4e7a];return _0x409334;};'use strict';var util=require(_0xc16f('0x0'));var _=require(_0xc16f('0x1'));var moment=require('moment');function getSeconds(_0x5477c7,_0x31d5ec){var _0x2dd604=moment(_0x5477c7)[_0xc16f('0x2')](0x0);var _0x3ee6d0=moment(_0x31d5ec)[_0xc16f('0x2')](0x0);return _0x2dd604[_0xc16f('0x3')](_0x3ee6d0,_0xc16f('0x4'));}function QueueCallerAbandon(_0x1dca3c,_0x1c78d9){this[_0xc16f('0x5')]=_0x1dca3c['scheduledat'];this[_0xc16f('0x6')]=_0x1dca3c[_0xc16f('0x6')];this['campaigntype']=_0x1dca3c[_0xc16f('0x6')]===_0xc16f('0x7')?'queue':_0x1dca3c[_0xc16f('0x6')];this[_0xc16f('0x8')]=_0x1dca3c[_0xc16f('0x8')];this[_0xc16f('0x9')]=_0x1dca3c[_0xc16f('0x9')];this[_0xc16f('0xa')]=_0x1dca3c[_0xc16f('0xa')];this['countglobal']=_0x1dca3c[_0xc16f('0x8')]+_0x1dca3c[_0xc16f('0x9')]+_0x1dca3c[_0xc16f('0xa')]+_0x1dca3c[_0xc16f('0xb')]+_0x1dca3c[_0xc16f('0xc')]+_0x1dca3c[_0xc16f('0xd')]+_0x1dca3c[_0xc16f('0xe')]+_0x1dca3c['countagentrejectretry'];this[_0xc16f('0xb')]=_0x1dca3c[_0xc16f('0xb')];this[_0xc16f('0xc')]=_0x1dca3c['countdropretry'];this[_0xc16f('0xd')]=_0x1dca3c[_0xc16f('0xd')];this[_0xc16f('0xe')]=_0x1dca3c[_0xc16f('0xe')];this['countagentrejectretry']=_0x1dca3c[_0xc16f('0xf')];this[_0xc16f('0x10')]=_0x1c78d9[_0xc16f('0x10')];this[_0xc16f('0x11')]=_0x1dca3c[_0xc16f('0x12')];this[_0xc16f('0x13')]=_0x1dca3c[_0xc16f('0x14')];this[_0xc16f('0x15')]=_0x1dca3c[_0xc16f('0x15')];this[_0xc16f('0x16')]=_0x1dca3c[_0xc16f('0x16')];this[_0xc16f('0x17')]=_0x1dca3c[_0xc16f('0x17')];this[_0xc16f('0x18')]=this['droptime'];this[_0xc16f('0x19')]=getSeconds(_0x1dca3c['responsetime'],_0x1dca3c['starttime']);this[_0xc16f('0x1a')]=getSeconds(this['droptime'],_0x1dca3c[_0xc16f('0x16')]);this['talktime']=0x0;this[_0xc16f('0x1b')]=_0x1c78d9[_0xc16f('0x1b')];this[_0xc16f('0x1c')]=_0x1c78d9[_0xc16f('0x1d')];this[_0xc16f('0x1e')]=_0x1c78d9[_0xc16f('0x1e')];this[_0xc16f('0x1f')]=_0x1dca3c[_0xc16f('0x1f')];this[_0xc16f('0x20')]=_0x1dca3c[_0xc16f('0x20')];this['callbackat']=_0x1dca3c['callbackat'];this['recallme']=_0x1dca3c['recallme'];this[_0xc16f('0x21')]=_0x1dca3c[_0xc16f('0x21')];this[_0xc16f('0x22')]=_0x1dca3c[_0xc16f('0x22')];this[_0xc16f('0x23')]=_0x1dca3c['UserId'];this['VoiceQueueId']=_0x1dca3c[_0xc16f('0x24')];this['CampaignId']=_0x1dca3c[_0xc16f('0x25')];this[_0xc16f('0x26')]=_0x1dca3c[_0xc16f('0x26')]||'';this[_0xc16f('0x27')]=_0x1dca3c['originatecalleridname']||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 8aecdf1..38d53f3 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(_0x227105,_0x193852){var _0x5f0acf=function(_0x5ebfca){while(--_0x5ebfca){_0x227105['push'](_0x227105['shift']());}};_0x5f0acf(++_0x193852);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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(_0x90d16c,_0x92f05a){var _0x16b1e7=function(_0x14821d){while(--_0x14821d){_0x90d16c['push'](_0x90d16c['shift']());}};_0x16b1e7(++_0x92f05a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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 e972305..e3a0426 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 _0xd914=['dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','isTrunkReachable','isNil','active','format','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','syncVarSet','bind','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','channelstate','channelstatedesc','variable','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20receiveFax\x20','stringify','merge','pick','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif'];(function(_0x3c9ee9,_0x3c2001){var _0xf24909=function(_0x2ca6ab){while(--_0x2ca6ab){_0x3c9ee9['push'](_0x3c9ee9['shift']());}};_0xf24909(++_0x3c2001);}(_0xd914,0x17f));var _0x4d91=function(_0x644560,_0x1783aa){_0x644560=_0x644560-0x0;var _0x41b76b=_0xd914[_0x644560];return _0x41b76b;};'use strict';var util=require(_0x4d91('0x0'));var _=require(_0x4d91('0x1'));var BPromise=require('bluebird');var uuid=require(_0x4d91('0x2'));var moment=require(_0x4d91('0x3'));var path=require(_0x4d91('0x4'));var tiff2pdf=require(_0x4d91('0x5'));var gs=require(_0x4d91('0x6'));var logger=require(_0x4d91('0x7'))('fax');var ami=require(_0x4d91('0x8'));var rpcDb=require('./rpcDb');var Channel=require(_0x4d91('0x9'));var ut=require(_0x4d91('0xa'));var Action=require(_0x4d91('0xb'));var faxAccount=require(_0x4d91('0xc'));var attachment=require(_0x4d91('0xd'));var faxMessage=require(_0x4d91('0xe'));function Fax(_0x3016c0){this[_0x4d91('0xf')]={};this['faxAccounts']=_0x3016c0[_0x4d91('0x10')];this[_0x4d91('0x11')]=_0x3016c0[_0x4d91('0x11')];this[_0x4d91('0x12')]={};ami['on'](_0x4d91('0x13'),this[_0x4d91('0x14')]['bind'](this));ami['on']('varset',this[_0x4d91('0x15')][_0x4d91('0x16')](this));ami['on'](_0x4d91('0x17'),this[_0x4d91('0x18')][_0x4d91('0x16')](this));ami['on'](_0x4d91('0x19'),this['syncNewExten']['bind'](this));ami['on'](_0x4d91('0x1a'),this[_0x4d91('0x1b')][_0x4d91('0x16')](this));ami['on'](_0x4d91('0x1c'),this[_0x4d91('0x1d')][_0x4d91('0x16')](this));ami['on'](_0x4d91('0x1e'),this['syncHangup'][_0x4d91('0x16')](this));ami['on'](_0x4d91('0x1f'),this[_0x4d91('0x20')][_0x4d91('0x16')](this));}Fax[_0x4d91('0x21')]['syncNewchannel']=function(_0x1241a1){if(_0x1241a1[_0x4d91('0x22')]===_0x4d91('0x23')){for(var _0x44b9a7 in this['faxAccounts']){if(this[_0x4d91('0x10')][_0x4d91('0x24')](_0x44b9a7)){if(_0x1241a1[_0x4d91('0x25')]===this['faxAccounts'][_0x44b9a7][_0x4d91('0x26')]){this[_0x4d91('0xf')][_0x1241a1[_0x4d91('0x27')]]={};this[_0x4d91('0xf')][_0x1241a1[_0x4d91('0x27')]][_0x4d91('0x28')]=_0x1241a1[_0x4d91('0x28')];this[_0x4d91('0xf')][_0x1241a1[_0x4d91('0x27')]]['id']=this[_0x4d91('0x10')][_0x44b9a7]['id'];this['channels'][_0x1241a1[_0x4d91('0x27')]]['name']=this['faxAccounts'][_0x44b9a7][_0x4d91('0x29')];logger[_0x4d91('0x2a')](_0x1241a1[_0x4d91('0x27')],_0x4d91('0x2b'));}}}}if(this[_0x4d91('0x12')][_0x1241a1[_0x4d91('0x27')]]){this[_0x4d91('0xf')][_0x1241a1[_0x4d91('0x27')]]={};this['channels'][_0x1241a1['uniqueid']][_0x4d91('0x28')]=_0x1241a1[_0x4d91('0x28')];logger[_0x4d91('0x2a')](_0x1241a1[_0x4d91('0x27')],_0x4d91('0x2b'));}};Fax[_0x4d91('0x21')][_0x4d91('0x15')]=function(_0x560966){if(this[_0x4d91('0xf')][_0x560966[_0x4d91('0x27')]]){for(var _0x12ac74 in _0x560966['variable']){if(_0x560966['variable'][_0x4d91('0x24')](_0x12ac74)){this[_0x4d91('0xf')][_0x560966['uniqueid']][_0x12ac74]=_0x560966['value'];}}}};Fax[_0x4d91('0x21')][_0x4d91('0x18')]=function(_0x43371e){if(this[_0x4d91('0xf')][_0x43371e['uniqueid']]){this[_0x4d91('0xf')][_0x43371e[_0x4d91('0x27')]][_0x4d91('0x2c')]=_0x43371e[_0x4d91('0x2c')];this[_0x4d91('0xf')][_0x43371e[_0x4d91('0x27')]][_0x4d91('0x2d')]=_0x43371e['channelstatedesc'];}};Fax[_0x4d91('0x21')]['syncNewExten']=function(_0x4ad7bf){if(this[_0x4d91('0xf')][_0x4ad7bf[_0x4d91('0x27')]]){for(var _0x4f95f0 in _0x4ad7bf[_0x4d91('0x2e')]){if(_0x4ad7bf[_0x4d91('0x2e')][_0x4d91('0x24')](_0x4f95f0)){this[_0x4d91('0xf')][_0x4ad7bf[_0x4d91('0x27')]][_0x4f95f0]=_0x4ad7bf['value'];}}}};Fax[_0x4d91('0x21')][_0x4d91('0x1b')]=function(_0x36d7e0){if(this[_0x4d91('0xf')][_0x36d7e0[_0x4d91('0x27')]]){this[_0x4d91('0xf')][_0x36d7e0['uniqueid']][_0x4d91('0x2f')]=_0x36d7e0[_0x4d91('0x2f')];this['channels'][_0x36d7e0[_0x4d91('0x27')]][_0x4d91('0x30')]=_0x36d7e0[_0x4d91('0x30')];this['channels'][_0x36d7e0[_0x4d91('0x27')]][_0x4d91('0x26')]=_0x36d7e0[_0x4d91('0x26')];this[_0x4d91('0xf')][_0x36d7e0['uniqueid']][_0x4d91('0x31')]=_0x36d7e0[_0x4d91('0x31')];logger[_0x4d91('0x2a')](_0x36d7e0[_0x4d91('0x27')],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0x4d91('0x1d')]=function(_0x3dac76){var _0x524052=this;if(this[_0x4d91('0xf')][_0x3dac76[_0x4d91('0x27')]]){var _0x197ea6=this[_0x4d91('0xf')][_0x3dac76['uniqueid']]['id'];this[_0x4d91('0xf')][_0x3dac76[_0x4d91('0x27')]]['remotestationid']=_0x3dac76[_0x4d91('0x32')];this['channels'][_0x3dac76[_0x4d91('0x27')]]['pagestransferred']=_0x3dac76[_0x4d91('0x33')];this['channels'][_0x3dac76[_0x4d91('0x27')]][_0x4d91('0x26')]=_0x3dac76[_0x4d91('0x26')];this[_0x4d91('0xf')][_0x3dac76['uniqueid']]['resolution']=_0x3dac76[_0x4d91('0x34')];this['channels'][_0x3dac76[_0x4d91('0x27')]][_0x4d91('0x35')]=_0x3dac76['transferrate'];this[_0x4d91('0xf')][_0x3dac76[_0x4d91('0x27')]][_0x4d91('0x31')]=_0x3dac76[_0x4d91('0x31')];this[_0x4d91('0xf')][_0x3dac76[_0x4d91('0x27')]][_0x4d91('0x36')]=_0x3dac76['calleridnum'];if(this[_0x4d91('0xf')][_0x3dac76['uniqueid']][_0x4d91('0x33')]>0x0){tiff2pdf(_0x3dac76[_0x4d91('0x31')],_0x4d91('0x37'),function(_0x2483c4){logger[_0x4d91('0x2a')](_0x3dac76[_0x4d91('0x27')],'\x20result\x20conversion\x20file\x20',_0x2483c4['message']);attachment[_0x4d91('0x38')]({'name':path[_0x4d91('0x39')](_0x3dac76['filename'])[_0x4d91('0x29')],'basename':path[_0x4d91('0x39')](_0x3dac76[_0x4d91('0x31')])[_0x4d91('0x29')]+_0x4d91('0x3a'),'type':_0x4d91('0x3b')})[_0x4d91('0x3c')](function(_0x971da4){faxAccount[_0x4d91('0x3d')](_0x197ea6,{'from':_0x3dac76['calleridnum'],'mapKey':'fax','body':path[_0x4d91('0x39')](_0x3dac76['filename'])[_0x4d91('0x29')]+_0x4d91('0x3a'),'AttachmentId':_0x971da4['id']})[_0x4d91('0x3e')](function(_0x10b1bb){logger['error'](_0x3dac76[_0x4d91('0x27')],'\x20notify\x20',JSON['stringify'](_0x10b1bb));});})[_0x4d91('0x3e')](function(_0xfd7c52){logger[_0x4d91('0x3f')](_0x3dac76[_0x4d91('0x27')],_0x4d91('0x40'),JSON[_0x4d91('0x41')](_0xfd7c52));});});}logger['info'](_0x3dac76[_0x4d91('0x27')],_0x4d91('0x40'));}};Fax[_0x4d91('0x21')][_0x4d91('0x20')]=function(_0x106e5b){if(this[_0x4d91('0x12')][_0x106e5b[_0x4d91('0x27')]]){_[_0x4d91('0x42')](this[_0x4d91('0xf')][_0x106e5b[_0x4d91('0x27')]],_[_0x4d91('0x43')](_0x106e5b,['response',_0x4d91('0x44')]));}};function updateStatus(_0x5a5c03){if(_0x5a5c03[_0x4d91('0x45')]){faxMessage[_0x4d91('0x46')](_0x5a5c03[_0x4d91('0x45')],{'failMessage':_0x4d91('0x47')})[_0x4d91('0x3c')](function(_0x3edc43){ut[_0x4d91('0x48')](_0x4d91('0x49'),_0x3edc43);})['catch'](function(_0x63f708){ut[_0x4d91('0x48')](_0x4d91('0x4a'),_0x63f708);});}else{ut[_0x4d91('0x48')](_0x4d91('0x4b'));}}Fax[_0x4d91('0x21')][_0x4d91('0x4c')]=function(_0x4aae23,_0x392cc3,_0x2159e4){var _0x413b25=this;var _0x4382ff={};if(_0x392cc3){_0x4382ff={'read':_0x392cc3};}else{_0x4382ff={'failMessage':_0x2159e4};}if(this[_0x4d91('0x12')][_0x4aae23][_0x4d91('0x45')]){faxMessage[_0x4d91('0x46')](this[_0x4d91('0x12')][_0x4aae23][_0x4d91('0x45')],_0x4382ff)[_0x4d91('0x3c')](function(_0x8339dd){ut[_0x4d91('0x48')](_0x4d91('0x4d'),_0x8339dd);})[_0x4d91('0x3e')](function(_0x3e9154){ut[_0x4d91('0x48')](_0x4d91('0x4e'),_0x3e9154);})['finally'](function(){delete _0x413b25['channels'][_0x4aae23];delete _0x413b25['actions'][_0x4aae23];});}else{ut[_0x4d91('0x48')](_0x4d91('0x4f'));delete this[_0x4d91('0xf')][_0x4aae23];delete this['actions'][_0x4aae23];}};Fax[_0x4d91('0x21')][_0x4d91('0x50')]=function(_0x3985f3){var _0x4ac087=this;if(this['channels'][_0x3985f3['uniqueid']]){if(this[_0x4d91('0x12')][_0x3985f3[_0x4d91('0x27')]]){this[_0x4d91('0xf')][_0x3985f3[_0x4d91('0x27')]]['id']=this[_0x4d91('0x12')][_0x3985f3['uniqueid']]['id'];this[_0x4d91('0xf')][_0x3985f3[_0x4d91('0x27')]]['name']=this['actions'][_0x3985f3[_0x4d91('0x27')]]['name'];}logger[_0x4d91('0x2a')](_0x3985f3[_0x4d91('0x27')],this[_0x4d91('0x12')][_0x3985f3['uniqueid']]?_0x4d91('0x51'):_0x4d91('0x52'),JSON[_0x4d91('0x41')](this[_0x4d91('0xf')][_0x3985f3[_0x4d91('0x27')]]));if(this[_0x4d91('0x12')][_0x3985f3[_0x4d91('0x27')]]){if(this['channels'][_0x3985f3['uniqueid']]['faxpages']>0x0&&this['channels'][_0x3985f3[_0x4d91('0x27')]][_0x4d91('0x1a')]===_0x4d91('0x53')){this['updateStatus'](_0x3985f3[_0x4d91('0x27')],!![]);}else{this['updateStatus'](_0x3985f3[_0x4d91('0x27')],![],this[_0x4d91('0xf')][_0x3985f3['uniqueid']]['faxstatusstring']?_0x4d91('0x54')+this[_0x4d91('0xf')][_0x3985f3[_0x4d91('0x27')]][_0x4d91('0x55')]:_0x4d91('0x56'));}}}};Fax[_0x4d91('0x21')][_0x4d91('0x57')]=function(_0x42e550){var _0xd384a9=this;return new BPromise(function(_0xd660b3,_0x5bfb08){_0xd384a9['execOriginate'](_0x42e550,_0xd384a9[_0x4d91('0x10')][_0x42e550[_0x4d91('0x58')]])[_0x4d91('0x3c')](function(_0x13281d){ut[_0x4d91('0x48')](_0x4d91('0x59'),_0x13281d);_0xd660b3(ut[_0x4d91('0x5a')](_0x4d91('0x5b')));})[_0x4d91('0x3e')](function(_0x564885){ut['logger']('[Fax][execOriginate][failure]',_0x564885);updateStatus(_0x42e550);_0x5bfb08(ut['message'](_0x4d91('0x5c')));});});};Fax[_0x4d91('0x21')][_0x4d91('0x5d')]=function(_0x12f7de){var _0x8565e3=this;return new BPromise(function(_0x12fa2e,_0x37710b){var _0xa1b6e5=_0x8565e3[_0x4d91('0x5e')](_0x8565e3[_0x4d91('0x10')][_0x12f7de[_0x4d91('0x58')]][_0x4d91('0x5f')],_0x12f7de);if(_0xa1b6e5[_0x4d91('0x60')]){_0x12fa2e(ut[_0x4d91('0x5a')](_0x4d91('0x61')));}else{_0x37710b(ut[_0x4d91('0x5a')](_0xa1b6e5[_0x4d91('0x5a')]));}});};function originate(_0x5b3a38,_0x4062c6,_0x1be4b1){return new BPromise(function(_0xc4ef10,_0x2e2105){if(_0x1be4b1){var _0x1cad5b=util['format'](_0x4d91('0x62'),path[_0x4d91('0x39')](_0x5b3a38['path'])[_0x4d91('0x29')],_0x5b3a38[_0x4d91('0x4')]);gs[_0x4d91('0x63')](_0x1cad5b)[_0x4d91('0x3c')](function(){_0x5b3a38[_0x4d91('0x4')]=util['format'](_0x4d91('0x64'),path[_0x4d91('0x39')](_0x5b3a38['path'])[_0x4d91('0x65')],path[_0x4d91('0x39')](_0x5b3a38[_0x4d91('0x4')])['name']);_0x4062c6[_0x4d91('0x66')]=_0x5b3a38[_0x4d91('0x4')];ut[_0x4d91('0x48')](_0x4d91('0x67'),'');ami[_0x4d91('0x68')](ut[_0x4d91('0x69')](_0x5b3a38,_0x4062c6))[_0x4d91('0x3c')](function(_0x4fcc58){_0xc4ef10(_0x4fcc58);})[_0x4d91('0x3e')](function(_0x2e014b){_0x2e2105(_0x2e014b);});})['catch'](function(_0x221e44){_0x2e2105(_0x221e44);});}else{ami['Action'](ut['variablesAction'](_0x5b3a38,_0x4062c6))[_0x4d91('0x3c')](function(_0x4b19e2){_0xc4ef10(_0x4b19e2);})[_0x4d91('0x3e')](function(_0x1a4a33){_0x2e2105(_0x1a4a33);});}});}Fax[_0x4d91('0x21')][_0x4d91('0x6a')]=function(_0x10211f,_0x3fa0e0){var _0x17e61c=this;return new BPromise(function(_0x497f84,_0x485da1){var _0x1c27e7=uuid['v4']();var _0x431223=ut[_0x4d91('0x6b')](_0x10211f,_0x3fa0e0);_0x17e61c[_0x4d91('0x12')][_0x1c27e7]=new Action(_0x1c27e7,_0x3fa0e0,_0x10211f);var _0x1e3838=_0x17e61c['actions'][_0x1c27e7];if(path['parse'](_0x10211f[_0x4d91('0x4')])['ext']==='.pdf'){originate(_0x1e3838,_0x431223,!![])[_0x4d91('0x3c')](function(_0x54fea8){_0x497f84(_0x54fea8);})['catch'](function(_0x216c33){_0x485da1(_0x216c33);});}else{originate(_0x1e3838,_0x431223,![])[_0x4d91('0x3c')](function(_0x1987fa){_0x497f84(_0x1987fa);})['catch'](function(_0x5028c5){_0x485da1(_0x5028c5);});}});};Fax['prototype'][_0x4d91('0x6c')]=function(_0x8d84f3){return!_[_0x4d91('0x6d')](_0x8d84f3)&&!_[_0x4d91('0x6d')](_0x8d84f3[_0x4d91('0x29')])&&!_[_0x4d91('0x6d')](_0x8d84f3[_0x4d91('0x6e')])&&_0x8d84f3[_0x4d91('0x6e')]&&!_[_0x4d91('0x6d')](this['trunks'][util[_0x4d91('0x6f')]('SIP/%s',_0x8d84f3['name'])])&&!_[_0x4d91('0x6d')](this[_0x4d91('0x11')][util[_0x4d91('0x6f')](_0x4d91('0x70'),_0x8d84f3['name'])][_0x4d91('0x30')])&&(this[_0x4d91('0x11')][util[_0x4d91('0x6f')](_0x4d91('0x70'),_0x8d84f3[_0x4d91('0x29')])][_0x4d91('0x30')]===_0x4d91('0x71')||this['trunks'][util[_0x4d91('0x6f')](_0x4d91('0x70'),_0x8d84f3[_0x4d91('0x29')])]['status']===_0x4d91('0x72'));};Fax[_0x4d91('0x21')][_0x4d91('0x5e')]=function(_0x2f4796,_0xb3688a){if(!this[_0x4d91('0x6c')](_0x2f4796)){ut['logger'](_0x4d91('0x73'),_['isNil'](_0x2f4796)?'':_0x2f4796[_0x4d91('0x29')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x4d91('0x74')};}if(_[_0x4d91('0x6d')](_0xb3688a['fax'])){ut['logger']('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x4d91('0x41')](_0xb3688a));return{'isValid':![],'message':_0x4d91('0x75')};}if(_[_0x4d91('0x6d')](_0xb3688a[_0x4d91('0x4')])){ut[_0x4d91('0x48')]('[Fax][checkTrunk][Empty\x20path]',JSON['stringify'](_0xb3688a));return{'isValid':![],'message':_0x4d91('0x76')};}return{'isValid':!![],'message':_0x4d91('0x77')};};module[_0x4d91('0x78')]=Fax; \ No newline at end of file +var _0x2547=['exports','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','../ami','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','trunks','actions','newchannel','syncNewchannel','bind','varset','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','prototype','context','from-voip-provider','faxAccounts','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf','then','notify','fax','.pdf','error','stringify','catch','syncOriginateResponse','merge','response','reason','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','finally','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isNil','active','SIP/%s','unmonitored','isTrunkReachable','\x20Trunk\x20is\x20not\x20active','Empty\x20path','Is\x20Valid'];(function(_0x1e4f2d,_0x22e2bb){var _0xd05ce5=function(_0x4c7b43){while(--_0x4c7b43){_0x1e4f2d['push'](_0x1e4f2d['shift']());}};_0xd05ce5(++_0x22e2bb);}(_0x2547,0x1cd));var _0x7254=function(_0x3145a8,_0x23b091){_0x3145a8=_0x3145a8-0x0;var _0x44d93f=_0x2547[_0x3145a8];return _0x44d93f;};'use strict';var util=require('util');var _=require(_0x7254('0x0'));var BPromise=require(_0x7254('0x1'));var uuid=require(_0x7254('0x2'));var moment=require(_0x7254('0x3'));var path=require(_0x7254('0x4'));var tiff2pdf=require(_0x7254('0x5'));var gs=require(_0x7254('0x6'));var logger=require(_0x7254('0x7'))('fax');var ami=require(_0x7254('0x8'));var rpcDb=require(_0x7254('0x9'));var Channel=require(_0x7254('0xa'));var ut=require(_0x7254('0xb'));var Action=require('./action');var faxAccount=require(_0x7254('0xc'));var attachment=require(_0x7254('0xd'));var faxMessage=require(_0x7254('0xe'));function Fax(_0x5da1ec){this[_0x7254('0xf')]={};this['faxAccounts']=_0x5da1ec['faxAccounts'];this['trunks']=_0x5da1ec[_0x7254('0x10')];this[_0x7254('0x11')]={};ami['on'](_0x7254('0x12'),this[_0x7254('0x13')][_0x7254('0x14')](this));ami['on'](_0x7254('0x15'),this['syncVarSet'][_0x7254('0x14')](this));ami['on']('newstate',this[_0x7254('0x16')]['bind'](this));ami['on'](_0x7254('0x17'),this[_0x7254('0x18')][_0x7254('0x14')](this));ami['on'](_0x7254('0x19'),this[_0x7254('0x1a')][_0x7254('0x14')](this));ami['on'](_0x7254('0x1b'),this[_0x7254('0x1c')][_0x7254('0x14')](this));ami['on'](_0x7254('0x1d'),this[_0x7254('0x1e')][_0x7254('0x14')](this));ami['on'](_0x7254('0x1f'),this['syncOriginateResponse'][_0x7254('0x14')](this));}Fax[_0x7254('0x20')][_0x7254('0x13')]=function(_0x39909d){if(_0x39909d[_0x7254('0x21')]===_0x7254('0x22')){for(var _0x2737e0 in this['faxAccounts']){if(this[_0x7254('0x23')][_0x7254('0x24')](_0x2737e0)){if(_0x39909d[_0x7254('0x25')]===this[_0x7254('0x23')][_0x2737e0][_0x7254('0x26')]){this[_0x7254('0xf')][_0x39909d[_0x7254('0x27')]]={};this[_0x7254('0xf')][_0x39909d[_0x7254('0x27')]][_0x7254('0x28')]=_0x39909d[_0x7254('0x28')];this[_0x7254('0xf')][_0x39909d[_0x7254('0x27')]]['id']=this[_0x7254('0x23')][_0x2737e0]['id'];this[_0x7254('0xf')][_0x39909d[_0x7254('0x27')]][_0x7254('0x29')]=this[_0x7254('0x23')][_0x2737e0][_0x7254('0x29')];logger[_0x7254('0x2a')](_0x39909d[_0x7254('0x27')],'\x20syncNewchannel\x20');}}}}if(this['actions'][_0x39909d[_0x7254('0x27')]]){this[_0x7254('0xf')][_0x39909d[_0x7254('0x27')]]={};this[_0x7254('0xf')][_0x39909d[_0x7254('0x27')]][_0x7254('0x28')]=_0x39909d[_0x7254('0x28')];logger['info'](_0x39909d[_0x7254('0x27')],_0x7254('0x2b'));}};Fax[_0x7254('0x20')]['syncVarSet']=function(_0x3c22d0){if(this['channels'][_0x3c22d0[_0x7254('0x27')]]){for(var _0x134a9e in _0x3c22d0['variable']){if(_0x3c22d0[_0x7254('0x2c')][_0x7254('0x24')](_0x134a9e)){this['channels'][_0x3c22d0[_0x7254('0x27')]][_0x134a9e]=_0x3c22d0[_0x7254('0x2d')];}}}};Fax[_0x7254('0x20')][_0x7254('0x16')]=function(_0x43bf02){if(this[_0x7254('0xf')][_0x43bf02['uniqueid']]){this[_0x7254('0xf')][_0x43bf02[_0x7254('0x27')]]['channelstate']=_0x43bf02[_0x7254('0x2e')];this[_0x7254('0xf')][_0x43bf02[_0x7254('0x27')]]['channelstatedesc']=_0x43bf02[_0x7254('0x2f')];}};Fax[_0x7254('0x20')][_0x7254('0x18')]=function(_0x173b6b){if(this[_0x7254('0xf')][_0x173b6b[_0x7254('0x27')]]){for(var _0x43cd7a in _0x173b6b['variable']){if(_0x173b6b[_0x7254('0x2c')]['hasOwnProperty'](_0x43cd7a)){this['channels'][_0x173b6b[_0x7254('0x27')]][_0x43cd7a]=_0x173b6b[_0x7254('0x2d')];}}}};Fax[_0x7254('0x20')][_0x7254('0x1a')]=function(_0x375abc){if(this[_0x7254('0xf')][_0x375abc[_0x7254('0x27')]]){this[_0x7254('0xf')][_0x375abc[_0x7254('0x27')]][_0x7254('0x30')]=_0x375abc[_0x7254('0x30')];this[_0x7254('0xf')][_0x375abc[_0x7254('0x27')]][_0x7254('0x31')]=_0x375abc['status'];this[_0x7254('0xf')][_0x375abc[_0x7254('0x27')]][_0x7254('0x26')]=_0x375abc[_0x7254('0x26')];this[_0x7254('0xf')][_0x375abc['uniqueid']][_0x7254('0x32')]=_0x375abc['filename'];logger[_0x7254('0x2a')](_0x375abc[_0x7254('0x27')],_0x7254('0x33'));}};Fax[_0x7254('0x20')][_0x7254('0x1c')]=function(_0x4e6213){var _0x17cf70=this;if(this['channels'][_0x4e6213[_0x7254('0x27')]]){var _0x12bd3b=this['channels'][_0x4e6213[_0x7254('0x27')]]['id'];this[_0x7254('0xf')][_0x4e6213[_0x7254('0x27')]][_0x7254('0x34')]=_0x4e6213[_0x7254('0x34')];this[_0x7254('0xf')][_0x4e6213['uniqueid']][_0x7254('0x35')]=_0x4e6213[_0x7254('0x35')];this[_0x7254('0xf')][_0x4e6213['uniqueid']][_0x7254('0x26')]=_0x4e6213[_0x7254('0x26')];this[_0x7254('0xf')][_0x4e6213['uniqueid']][_0x7254('0x36')]=_0x4e6213[_0x7254('0x36')];this[_0x7254('0xf')][_0x4e6213[_0x7254('0x27')]][_0x7254('0x37')]=_0x4e6213['transferrate'];this['channels'][_0x4e6213[_0x7254('0x27')]][_0x7254('0x32')]=_0x4e6213[_0x7254('0x32')];this[_0x7254('0xf')][_0x4e6213['uniqueid']]['calleridnum']=_0x4e6213[_0x7254('0x38')];if(this['channels'][_0x4e6213[_0x7254('0x27')]][_0x7254('0x35')]>0x0){tiff2pdf(_0x4e6213[_0x7254('0x32')],_0x7254('0x39'),function(_0x5e75e9){logger['info'](_0x4e6213[_0x7254('0x27')],_0x7254('0x3a'),_0x5e75e9[_0x7254('0x3b')]);attachment[_0x7254('0x3c')]({'name':path[_0x7254('0x3d')](_0x4e6213['filename'])['name'],'basename':path[_0x7254('0x3d')](_0x4e6213[_0x7254('0x32')])[_0x7254('0x29')]+'.pdf','type':_0x7254('0x3e')})[_0x7254('0x3f')](function(_0x55945f){faxAccount[_0x7254('0x40')](_0x12bd3b,{'from':_0x4e6213[_0x7254('0x38')],'mapKey':_0x7254('0x41'),'body':path[_0x7254('0x3d')](_0x4e6213['filename'])[_0x7254('0x29')]+_0x7254('0x42'),'AttachmentId':_0x55945f['id']})['catch'](function(_0x12d0e4){logger[_0x7254('0x43')](_0x4e6213[_0x7254('0x27')],'\x20notify\x20',JSON[_0x7254('0x44')](_0x12d0e4));});})[_0x7254('0x45')](function(_0x47f40d){logger['error'](_0x4e6213[_0x7254('0x27')],'\x20receiveFax\x20',JSON[_0x7254('0x44')](_0x47f40d));});});}logger[_0x7254('0x2a')](_0x4e6213['uniqueid'],'\x20receiveFax\x20');}};Fax[_0x7254('0x20')][_0x7254('0x46')]=function(_0x38bcd5){if(this[_0x7254('0x11')][_0x38bcd5[_0x7254('0x27')]]){_[_0x7254('0x47')](this['channels'][_0x38bcd5[_0x7254('0x27')]],_['pick'](_0x38bcd5,[_0x7254('0x48'),_0x7254('0x49')]));}};function updateStatus(_0x450d24){if(_0x450d24['AttachmentId']){faxMessage[_0x7254('0x4a')](_0x450d24[_0x7254('0x4b')],{'failMessage':_0x7254('0x4c')})['then'](function(_0xdbaf7a){ut[_0x7254('0x4d')](_0x7254('0x4e'),_0xdbaf7a);})[_0x7254('0x45')](function(_0x9c1c1){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0x9c1c1);});}else{ut[_0x7254('0x4d')](_0x7254('0x4f'));}}Fax[_0x7254('0x20')][_0x7254('0x50')]=function(_0x3b0002,_0x4c6838,_0x5a44fb){var _0x37f72f=this;var _0x2d91ab={};if(_0x4c6838){_0x2d91ab={'read':_0x4c6838};}else{_0x2d91ab={'failMessage':_0x5a44fb};}if(this[_0x7254('0x11')][_0x3b0002][_0x7254('0x4b')]){faxMessage['update'](this[_0x7254('0x11')][_0x3b0002][_0x7254('0x4b')],_0x2d91ab)['then'](function(_0x460766){ut['logger'](_0x7254('0x51'),_0x460766);})['catch'](function(_0x15fc0e){ut['logger']('[Fax][Message][NoUpdate1]',_0x15fc0e);})[_0x7254('0x52')](function(){delete _0x37f72f[_0x7254('0xf')][_0x3b0002];delete _0x37f72f[_0x7254('0x11')][_0x3b0002];});}else{ut[_0x7254('0x4d')]('[Fax][Message][NoUpdate2]');delete this[_0x7254('0xf')][_0x3b0002];delete this['actions'][_0x3b0002];}};Fax[_0x7254('0x20')][_0x7254('0x1e')]=function(_0x3145c2){var _0x25cb48=this;if(this[_0x7254('0xf')][_0x3145c2[_0x7254('0x27')]]){if(this['actions'][_0x3145c2[_0x7254('0x27')]]){this[_0x7254('0xf')][_0x3145c2[_0x7254('0x27')]]['id']=this[_0x7254('0x11')][_0x3145c2[_0x7254('0x27')]]['id'];this[_0x7254('0xf')][_0x3145c2['uniqueid']][_0x7254('0x29')]=this[_0x7254('0x11')][_0x3145c2[_0x7254('0x27')]][_0x7254('0x29')];}logger[_0x7254('0x2a')](_0x3145c2[_0x7254('0x27')],this[_0x7254('0x11')][_0x3145c2['uniqueid']]?'\x20hangup\x20sendFile\x20':_0x7254('0x53'),JSON['stringify'](this['channels'][_0x3145c2[_0x7254('0x27')]]));if(this[_0x7254('0x11')][_0x3145c2[_0x7254('0x27')]]){if(this['channels'][_0x3145c2[_0x7254('0x27')]]['faxpages']>0x0&&this[_0x7254('0xf')][_0x3145c2[_0x7254('0x27')]][_0x7254('0x19')]===_0x7254('0x54')){this[_0x7254('0x50')](_0x3145c2['uniqueid'],!![]);}else{this[_0x7254('0x50')](_0x3145c2[_0x7254('0x27')],![],this[_0x7254('0xf')][_0x3145c2[_0x7254('0x27')]]['faxstatusstring']?'SENDING\x20FAILED:\x20'+this[_0x7254('0xf')][_0x3145c2[_0x7254('0x27')]][_0x7254('0x55')]:_0x7254('0x56'));}}}};Fax[_0x7254('0x20')][_0x7254('0x57')]=function(_0x464680){var _0x38cba1=this;return new BPromise(function(_0x146f6c,_0x160df0){_0x38cba1[_0x7254('0x58')](_0x464680,_0x38cba1[_0x7254('0x23')][_0x464680[_0x7254('0x59')]])['then'](function(_0x476787){ut[_0x7254('0x4d')](_0x7254('0x5a'),_0x476787);_0x146f6c(ut['message'](_0x7254('0x5b')));})[_0x7254('0x45')](function(_0x2df8fa){ut[_0x7254('0x4d')]('[Fax][execOriginate][failure]',_0x2df8fa);updateStatus(_0x464680);_0x160df0(ut[_0x7254('0x3b')]('Fax\x20failed'));});});};Fax[_0x7254('0x20')][_0x7254('0x5c')]=function(_0x1112d7){var _0x333497=this;return new BPromise(function(_0x54536c,_0xc9bb71){var _0x5ccade=_0x333497[_0x7254('0x5d')](_0x333497['faxAccounts'][_0x1112d7[_0x7254('0x59')]][_0x7254('0x5e')],_0x1112d7);if(_0x5ccade[_0x7254('0x5f')]){_0x54536c(ut[_0x7254('0x3b')](_0x7254('0x60')));}else{_0xc9bb71(ut[_0x7254('0x3b')](_0x5ccade[_0x7254('0x3b')]));}});};function originate(_0x23b89a,_0x4e07c6,_0x37562a){return new BPromise(function(_0x57c0a0,_0x12c36e){if(_0x37562a){var _0x16a9ef=util[_0x7254('0x61')](_0x7254('0x62'),path[_0x7254('0x3d')](_0x23b89a[_0x7254('0x4')])[_0x7254('0x29')],_0x23b89a[_0x7254('0x4')]);gs['execute'](_0x16a9ef)[_0x7254('0x3f')](function(){_0x23b89a['path']=util[_0x7254('0x61')](_0x7254('0x63'),path[_0x7254('0x3d')](_0x23b89a[_0x7254('0x4')])[_0x7254('0x64')],path[_0x7254('0x3d')](_0x23b89a[_0x7254('0x4')])[_0x7254('0x29')]);_0x4e07c6[_0x7254('0x65')]=_0x23b89a[_0x7254('0x4')];ut[_0x7254('0x4d')](_0x7254('0x66'),'');ami[_0x7254('0x67')](ut[_0x7254('0x68')](_0x23b89a,_0x4e07c6))[_0x7254('0x3f')](function(_0xb16dcd){_0x57c0a0(_0xb16dcd);})[_0x7254('0x45')](function(_0x4a2446){_0x12c36e(_0x4a2446);});})['catch'](function(_0x3cb711){_0x12c36e(_0x3cb711);});}else{ami[_0x7254('0x67')](ut['variablesAction'](_0x23b89a,_0x4e07c6))['then'](function(_0x4d8e70){_0x57c0a0(_0x4d8e70);})[_0x7254('0x45')](function(_0x7f5d4d){_0x12c36e(_0x7f5d4d);});}});}Fax[_0x7254('0x20')][_0x7254('0x58')]=function(_0x55ae4b,_0x2f8e8e){var _0x323140=this;return new BPromise(function(_0x5725fc,_0x4e5c34){var _0x166fca=uuid['v4']();var _0x85b2e4=ut['addVariables'](_0x55ae4b,_0x2f8e8e);_0x323140['actions'][_0x166fca]=new Action(_0x166fca,_0x2f8e8e,_0x55ae4b);var _0x220066=_0x323140[_0x7254('0x11')][_0x166fca];if(path['parse'](_0x55ae4b[_0x7254('0x4')])[_0x7254('0x69')]===_0x7254('0x42')){originate(_0x220066,_0x85b2e4,!![])[_0x7254('0x3f')](function(_0x24fcb1){_0x5725fc(_0x24fcb1);})['catch'](function(_0xc94982){_0x4e5c34(_0xc94982);});}else{originate(_0x220066,_0x85b2e4,![])[_0x7254('0x3f')](function(_0x353f8c){_0x5725fc(_0x353f8c);})['catch'](function(_0x33d5bb){_0x4e5c34(_0x33d5bb);});}});};Fax['prototype']['isTrunkReachable']=function(_0x5bac64){return!_[_0x7254('0x6a')](_0x5bac64)&&!_['isNil'](_0x5bac64['name'])&&!_[_0x7254('0x6a')](_0x5bac64[_0x7254('0x6b')])&&_0x5bac64[_0x7254('0x6b')]&&!_['isNil'](this[_0x7254('0x10')][util['format'](_0x7254('0x6c'),_0x5bac64[_0x7254('0x29')])])&&!_['isNil'](this[_0x7254('0x10')][util[_0x7254('0x61')](_0x7254('0x6c'),_0x5bac64[_0x7254('0x29')])][_0x7254('0x31')])&&(this[_0x7254('0x10')][util[_0x7254('0x61')]('SIP/%s',_0x5bac64[_0x7254('0x29')])]['status']==='reachable'||this[_0x7254('0x10')][util[_0x7254('0x61')](_0x7254('0x6c'),_0x5bac64[_0x7254('0x29')])]['status']===_0x7254('0x6d'));};Fax[_0x7254('0x20')][_0x7254('0x5d')]=function(_0x276179,_0x503d37){if(!this[_0x7254('0x6e')](_0x276179)){ut['logger']('[Fax][checkTrunk][Trunk\x20not\x20work]',_['isNil'](_0x276179)?'':_0x276179[_0x7254('0x29')]+_0x7254('0x6f'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_['isNil'](_0x503d37[_0x7254('0x41')])){ut['logger']('[Fax][checkTrunk][Empty\x20Fax]',JSON['stringify'](_0x503d37));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x7254('0x6a')](_0x503d37[_0x7254('0x4')])){ut['logger']('[Fax][checkTrunk][Empty\x20path]',JSON[_0x7254('0x44')](_0x503d37));return{'isValid':![],'message':_0x7254('0x70')};}return{'isValid':!![],'message':_0x7254('0x71')};};module[_0x7254('0x72')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 8e087e1..efa4d38 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 _0xfcb4=['error','inspect','notify','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount'];(function(_0x57be57,_0x1e16a5){var _0x110f19=function(_0x4c3deb){while(--_0x4c3deb){_0x57be57['push'](_0x57be57['shift']());}};_0x110f19(++_0x1e16a5);}(_0xfcb4,0x1bc));var _0x4fcb=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xfcb4[_0x1facfa];return _0x9ec701;};'use strict';var util=require(_0x4fcb('0x0'));var BPromise=require(_0x4fcb('0x1'));var logger=require(_0x4fcb('0x2'))(_0x4fcb('0x3'));var _=require(_0x4fcb('0x4'));var faxAccount=require(_0x4fcb('0x5'));function loggerCatch(_0x321b52){return function(_0x46588b){logger[_0x4fcb('0x6')](_0x321b52,util[_0x4fcb('0x7')](_0x46588b,{'showHidden':![],'depth':null}));};}exports[_0x4fcb('0x8')]=function(_0x3e7171,_0x5e078b){return BPromise['resolve']()['then'](faxAccount[_0x4fcb('0x8')](_0x3e7171,_0x5e078b))['catch'](loggerCatch(_0x4fcb('0x9')));}; \ No newline at end of file +var _0xfa39=['inspect','notify','then','catch','[Notify]\x20','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error'];(function(_0x1c06d1,_0x21b507){var _0xd88999=function(_0x22a6b1){while(--_0x22a6b1){_0x1c06d1['push'](_0x1c06d1['shift']());}};_0xd88999(++_0x21b507);}(_0xfa39,0x10d));var _0x9fa3=function(_0x40df5f,_0x8fd59f){_0x40df5f=_0x40df5f-0x0;var _0x1573f1=_0xfa39[_0x40df5f];return _0x1573f1;};'use strict';var util=require('util');var BPromise=require(_0x9fa3('0x0'));var logger=require(_0x9fa3('0x1'))(_0x9fa3('0x2'));var _=require(_0x9fa3('0x3'));var faxAccount=require(_0x9fa3('0x4'));function loggerCatch(_0x4e0efa){return function(_0x129d9e){logger[_0x9fa3('0x5')](_0x4e0efa,util[_0x9fa3('0x6')](_0x129d9e,{'showHidden':![],'depth':null}));};}exports[_0x9fa3('0x7')]=function(_0x5a5552,_0xbfb662){return BPromise['resolve']()[_0x9fa3('0x8')](faxAccount[_0x9fa3('0x7')](_0x5a5552,_0xbfb662))[_0x9fa3('0x9')](loggerCatch(_0x9fa3('0xa')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index e8bf0a0..7acc540 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 _0x3922=['../../../../config/logger','fax','bluebird','exec','execute','info','Exec\x20gs','inspect','util'];(function(_0x2ce9d,_0x4ff962){var _0x578428=function(_0x2e0888){while(--_0x2e0888){_0x2ce9d['push'](_0x2ce9d['shift']());}};_0x578428(++_0x4ff962);}(_0x3922,0xbc));var _0x2392=function(_0x51ef65,_0x7bafbc){_0x51ef65=_0x51ef65-0x0;var _0xd5d69d=_0x3922[_0x51ef65];return _0xd5d69d;};'use strict';var util=require(_0x2392('0x0'));var logger=require(_0x2392('0x1'))(_0x2392('0x2'));var BPromise=require(_0x2392('0x3'));var exec=require('child_process')[_0x2392('0x4')];exports[_0x2392('0x5')]=function(_0x4871d3){return new BPromise(function(_0x5bb34e,_0x5cdaca){exec(_0x4871d3,function(_0x28578d,_0x479a96,_0x3fdaa3){logger[_0x2392('0x6')](_0x2392('0x7'),_0x479a96);if(_0x28578d){logger[_0x2392('0x6')](_0x2392('0x7'),'\x20Error\x20:',util[_0x2392('0x8')](_0x28578d,{'showHidden':![],'depth':null}),_0x479a96,_0x3fdaa3);_0x5cdaca(_0x28578d);}_0x5bb34e(_0x479a96);});});}; \ No newline at end of file +var _0xa63a=['inspect','bluebird','child_process','info','Exec\x20gs','\x20Error\x20:'];(function(_0x44ca98,_0x146765){var _0x197227=function(_0x1f6f13){while(--_0x1f6f13){_0x44ca98['push'](_0x44ca98['shift']());}};_0x197227(++_0x146765);}(_0xa63a,0x9d));var _0xaa63=function(_0xc0638b,_0x2fccf4){_0xc0638b=_0xc0638b-0x0;var _0xd57dfa=_0xa63a[_0xc0638b];return _0xd57dfa;};'use strict';var util=require('util');var logger=require('../../../../config/logger')('fax');var BPromise=require(_0xaa63('0x0'));var exec=require(_0xaa63('0x1'))['exec'];exports['execute']=function(_0x376c6b){return new BPromise(function(_0x3f2d46,_0x25eaba){exec(_0x376c6b,function(_0x42cab4,_0x19bc79,_0x5ecd17){logger[_0xaa63('0x2')](_0xaa63('0x3'),_0x19bc79);if(_0x42cab4){logger[_0xaa63('0x2')](_0xaa63('0x3'),_0xaa63('0x4'),util[_0xaa63('0x5')](_0x42cab4,{'showHidden':![],'depth':null}),_0x19bc79,_0x5ecd17);_0x25eaba(_0x42cab4);}_0x3f2d46(_0x19bc79);});});}; \ 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 b0df2b7..3a1c9d4 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 _0xe561=['minrate','maxrate','format','\x22%s\x22','modem','gateway','t38timeout','path','variablesAction','uniqueid','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','headerinfo','localstationid','util','lodash','moment','fax','message','logger','inspect','addVariables','ecm'];(function(_0x357f1f,_0x402762){var _0x316285=function(_0x199dc0){while(--_0x199dc0){_0x357f1f['push'](_0x357f1f['shift']());}};_0x316285(++_0x402762);}(_0xe561,0x117));var _0x1e56=function(_0x102a91,_0x4fa93e){_0x102a91=_0x102a91-0x0;var _0xfcc98c=_0xe561[_0x102a91];return _0xfcc98c;};'use strict';var util=require(_0x1e56('0x0'));var _=require(_0x1e56('0x1'));var moment=require(_0x1e56('0x2'));var logger=require('../../../../config/logger')(_0x1e56('0x3'));exports[_0x1e56('0x4')]=function(_0x58aea5){return{'message':_0x58aea5};};exports[_0x1e56('0x5')]=function(_0x22dd5b,_0x58e59d){logger['info'](_0x22dd5b,util[_0x1e56('0x6')](_0x58e59d,{'showHidden':![],'depth':null}));};exports[_0x1e56('0x7')]=function(_0x15af6c,_0x897a2d){var _0x3e417c={'XMF-ECM':_0x897a2d[_0x1e56('0x8')],'XMF-HEADERINFO':_0x897a2d['headerinfo'],'XMF-MINRATE':_0x897a2d[_0x1e56('0x9')],'XMF-MAXRATE':_0x897a2d[_0x1e56('0xa')],'XMF-MODEM':util[_0x1e56('0xb')](_0x1e56('0xc'),_0x897a2d[_0x1e56('0xd')]),'XMF-GATEWAY':_0x897a2d[_0x1e56('0xe')],'XMF-FAXDETECT':_0x897a2d['faxdetect'],'XMF-T38TIMEOUT':_0x897a2d[_0x1e56('0xf')],'XMF-LOCALSTATIONID':_0x897a2d['localstationid'],'XMF-PATH':_0x15af6c[_0x1e56('0x10')]};return _0x3e417c;};exports[_0x1e56('0x11')]=function(_0x3f15e2,_0x35624d){return{'actionid':_0x3f15e2[_0x1e56('0x12')],'action':'originate','channel':_0x3f15e2[_0x1e56('0x13')],'Exten':_0x1e56('0x14'),'Context':'from-sip','Priority':'1','callerid':util[_0x1e56('0xb')](_0x1e56('0x15'),_0x3f15e2[_0x1e56('0x16')]?_0x3f15e2['headerinfo']:'',_0x3f15e2[_0x1e56('0x17')]),'variable':_0x35624d,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x3f15e2[_0x1e56('0x12')]};}; \ No newline at end of file +var _0x0363=['modem','gateway','faxdetect','t38timeout','path','uniqueid','originate','channel','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','localstationid','util','lodash','../../../../config/logger','fax','message','info','inspect','headerinfo','maxrate','\x22%s\x22'];(function(_0x5b34c0,_0x3ad403){var _0x242bd3=function(_0x51d0ce){while(--_0x51d0ce){_0x5b34c0['push'](_0x5b34c0['shift']());}};_0x242bd3(++_0x3ad403);}(_0x0363,0x138));var _0x3036=function(_0x247d83,_0x3d9584){_0x247d83=_0x247d83-0x0;var _0x17bab4=_0x0363[_0x247d83];return _0x17bab4;};'use strict';var util=require(_0x3036('0x0'));var _=require(_0x3036('0x1'));var moment=require('moment');var logger=require(_0x3036('0x2'))(_0x3036('0x3'));exports[_0x3036('0x4')]=function(_0x2bdf11){return{'message':_0x2bdf11};};exports['logger']=function(_0x10d137,_0x302da8){logger[_0x3036('0x5')](_0x10d137,util[_0x3036('0x6')](_0x302da8,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x4acfc3,_0x605db0){var _0x1014ae={'XMF-ECM':_0x605db0['ecm'],'XMF-HEADERINFO':_0x605db0[_0x3036('0x7')],'XMF-MINRATE':_0x605db0['minrate'],'XMF-MAXRATE':_0x605db0[_0x3036('0x8')],'XMF-MODEM':util['format'](_0x3036('0x9'),_0x605db0[_0x3036('0xa')]),'XMF-GATEWAY':_0x605db0[_0x3036('0xb')],'XMF-FAXDETECT':_0x605db0[_0x3036('0xc')],'XMF-T38TIMEOUT':_0x605db0[_0x3036('0xd')],'XMF-LOCALSTATIONID':_0x605db0['localstationid'],'XMF-PATH':_0x4acfc3[_0x3036('0xe')]};return _0x1014ae;};exports['variablesAction']=function(_0x5a795b,_0x3a8a95){return{'actionid':_0x5a795b[_0x3036('0xf')],'action':_0x3036('0x10'),'channel':_0x5a795b[_0x3036('0x11')],'Exten':_0x3036('0x12'),'Context':_0x3036('0x13'),'Priority':'1','callerid':util[_0x3036('0x14')](_0x3036('0x15'),_0x5a795b['headerinfo']?_0x5a795b[_0x3036('0x7')]:'',_0x5a795b[_0x3036('0x16')]),'variable':_0x3a8a95,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5a795b[_0x3036('0xf')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 8a2ad45..1402b49 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 _0x70c8=['getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getVoiceCallReports','catch','error','[index.js][initParams]','inspect','[index.js][main]','bluebird','./server','./realtime','./acw','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','../../config/logger','ami','get','hour','resolve','then'];(function(_0x444779,_0x3fc36a){var _0xdaa3bc=function(_0x322604){while(--_0x322604){_0x444779['push'](_0x444779['shift']());}};_0xdaa3bc(++_0x3fc36a);}(_0x70c8,0x6b));var _0x870c=function(_0x361707,_0x2addbb){_0x361707=_0x361707-0x0;var _0x1495b1=_0x70c8[_0x361707];return _0x1495b1;};'use strict';var BPromise=require(_0x870c('0x0'));var util=require('util');var moment=require('moment');var server=require(_0x870c('0x1'));var Realtime=require(_0x870c('0x2'));var Report=require('./report');var Acw=require(_0x870c('0x3'));var Trigger=require(_0x870c('0x4'));var Dialer=require(_0x870c('0x5'));var Preview=require(_0x870c('0x6'));var Fax=require(_0x870c('0x7'));var user=require('./rpc/user');var voiceQueue=require(_0x870c('0x8'));var voiceQueueReport=require(_0x870c('0x9'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require('./rpc/trunk');var trigger=require(_0x870c('0xa'));var template=require(_0x870c('0xb'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x870c('0xc'));var voiceExtension=require(_0x870c('0xd'));var faxAccount=require(_0x870c('0xe'));var zendesk=require(_0x870c('0xf'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x870c('0x10'));var desk=require(_0x870c('0x11'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x870c('0x12'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require('./rpc/integrations/dynamics365');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(_0x870c('0x13'))(_0x870c('0x14'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x870c('0x15')](_0x870c('0x16'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get']('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x870c('0x17')]()[_0x870c('0x18')](user[_0x870c('0x19')]())[_0x870c('0x18')](realtime[_0x870c('0x1a')]())[_0x870c('0x18')](user[_0x870c('0x1b')]())['then'](realtime[_0x870c('0x1c')]())['then'](trunk[_0x870c('0x1d')]())[_0x870c('0x18')](realtime[_0x870c('0x1e')]())[_0x870c('0x18')](voiceQueue[_0x870c('0x1f')]())[_0x870c('0x18')](realtime[_0x870c('0x20')]())[_0x870c('0x18')](trigger['getTriggers']())[_0x870c('0x18')](realtime[_0x870c('0x21')]())[_0x870c('0x18')](template['getTemplates']())[_0x870c('0x18')](realtime[_0x870c('0x22')]())[_0x870c('0x18')](zendesk['getZendeskAccounts']())[_0x870c('0x18')](realtime[_0x870c('0x23')]())[_0x870c('0x18')](salesforce[_0x870c('0x24')]())['then'](realtime['initSalesforceAccounts']())[_0x870c('0x18')](sugarcrm[_0x870c('0x25')]())[_0x870c('0x18')](realtime['initSugarcrmAccounts']())[_0x870c('0x18')](freshdesk[_0x870c('0x26')]())[_0x870c('0x18')](realtime[_0x870c('0x27')]())[_0x870c('0x18')](desk[_0x870c('0x28')]())[_0x870c('0x18')](realtime[_0x870c('0x29')]())[_0x870c('0x18')](zoho[_0x870c('0x2a')]())[_0x870c('0x18')](realtime[_0x870c('0x2b')]())[_0x870c('0x18')](vtiger[_0x870c('0x2c')]())[_0x870c('0x18')](realtime[_0x870c('0x2d')]())[_0x870c('0x18')](freshsales[_0x870c('0x2e')]())[_0x870c('0x18')](realtime[_0x870c('0x2f')]())[_0x870c('0x18')](servicenow[_0x870c('0x30')]())[_0x870c('0x18')](realtime[_0x870c('0x31')]())['then'](dynamics365[_0x870c('0x32')]())['then'](realtime[_0x870c('0x33')]())[_0x870c('0x18')](campaign[_0x870c('0x34')]())[_0x870c('0x18')](realtime[_0x870c('0x35')]())[_0x870c('0x18')](voiceExtension[_0x870c('0x36')]())[_0x870c('0x18')](realtime['initVoiceExtensions']())[_0x870c('0x18')](faxAccount['getFaxAccounts']())[_0x870c('0x18')](realtime[_0x870c('0x37')]())[_0x870c('0x18')](function(){return realtime;});}function initParams(){return BPromise[_0x870c('0x17')]()[_0x870c('0x18')](voiceQueueReport[_0x870c('0x38')]())[_0x870c('0x18')](realtime[_0x870c('0x39')]())['then'](cmHopperHistory[_0x870c('0x3a')]())[_0x870c('0x18')](realtime[_0x870c('0x3b')]())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0x870c('0x18')](realtime['initCampaignHopperHistory']())[_0x870c('0x18')](voiceCallReport[_0x870c('0x3c')]())['then'](realtime['initVoiceCallReports']())[_0x870c('0x3d')](function(_0x42d286){logger[_0x870c('0x3e')](_0x870c('0x3f'),util[_0x870c('0x40')](_0x42d286,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x870c('0x18')](function(_0x14fd69){return initRealtime();})[_0x870c('0x18')](function(){return initParams();})[_0x870c('0x18')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x870c('0x3d')](function(_0x303fe3){logger['error'](_0x870c('0x41'),util[_0x870c('0x40')](_0x303fe3,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xd448=['getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','inspect','listen','sync','error','[index.js][main]','bluebird','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','../../config/logger','ami','get','hour','resolve','getAgents','then','initAgents','getTelephones','initTelephones','initVoiceQueues','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts'];(function(_0x403bf2,_0x4e0f76){var _0x31316b=function(_0x36e522){while(--_0x36e522){_0x403bf2['push'](_0x403bf2['shift']());}};_0x31316b(++_0x4e0f76);}(_0xd448,0x129));var _0x8d44=function(_0x26635e,_0x411f96){_0x26635e=_0x26635e-0x0;var _0x2cfa7=_0xd448[_0x26635e];return _0x2cfa7;};'use strict';var BPromise=require(_0x8d44('0x0'));var util=require(_0x8d44('0x1'));var moment=require(_0x8d44('0x2'));var server=require(_0x8d44('0x3'));var Realtime=require(_0x8d44('0x4'));var Report=require(_0x8d44('0x5'));var Acw=require(_0x8d44('0x6'));var Trigger=require(_0x8d44('0x7'));var Dialer=require(_0x8d44('0x8'));var Preview=require(_0x8d44('0x9'));var Fax=require(_0x8d44('0xa'));var user=require('./rpc/user');var voiceQueue=require(_0x8d44('0xb'));var voiceQueueReport=require(_0x8d44('0xc'));var voiceCallReport=require(_0x8d44('0xd'));var trunk=require(_0x8d44('0xe'));var trigger=require(_0x8d44('0xf'));var template=require('./rpc/template');var cmHopperHistory=require(_0x8d44('0x10'));var campaign=require(_0x8d44('0x11'));var voiceExtension=require(_0x8d44('0x12'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x8d44('0x13'));var salesforce=require(_0x8d44('0x14'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x8d44('0x15'));var desk=require(_0x8d44('0x16'));var zoho=require(_0x8d44('0x17'));var vtiger=require(_0x8d44('0x18'));var freshsales=require(_0x8d44('0x19'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require('./rpc/integrations/dynamics365');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(_0x8d44('0x1a'))(_0x8d44('0x1b'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x8d44('0x1c')](_0x8d44('0x1d'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x8d44('0x1c')](_0x8d44('0x1d'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x8d44('0x1e')]()['then'](user[_0x8d44('0x1f')]())[_0x8d44('0x20')](realtime[_0x8d44('0x21')]())[_0x8d44('0x20')](user[_0x8d44('0x22')]())[_0x8d44('0x20')](realtime[_0x8d44('0x23')]())['then'](trunk['getTrunks']())[_0x8d44('0x20')](realtime['initTrunks']())['then'](voiceQueue['getVoiceQueues']())[_0x8d44('0x20')](realtime[_0x8d44('0x24')]())[_0x8d44('0x20')](trigger['getTriggers']())[_0x8d44('0x20')](realtime[_0x8d44('0x25')]())['then'](template['getTemplates']())[_0x8d44('0x20')](realtime[_0x8d44('0x26')]())[_0x8d44('0x20')](zendesk[_0x8d44('0x27')]())[_0x8d44('0x20')](realtime[_0x8d44('0x28')]())['then'](salesforce[_0x8d44('0x29')]())['then'](realtime[_0x8d44('0x2a')]())['then'](sugarcrm['getSugarcrmAccounts']())[_0x8d44('0x20')](realtime[_0x8d44('0x2b')]())[_0x8d44('0x20')](freshdesk['getFreshdeskAccounts']())[_0x8d44('0x20')](realtime[_0x8d44('0x2c')]())[_0x8d44('0x20')](desk['getDeskAccounts']())['then'](realtime[_0x8d44('0x2d')]())[_0x8d44('0x20')](zoho[_0x8d44('0x2e')]())['then'](realtime[_0x8d44('0x2f')]())['then'](vtiger[_0x8d44('0x30')]())[_0x8d44('0x20')](realtime[_0x8d44('0x31')]())[_0x8d44('0x20')](freshsales['getFreshsalesAccounts']())[_0x8d44('0x20')](realtime['initFreshsalesAccounts']())[_0x8d44('0x20')](servicenow[_0x8d44('0x32')]())[_0x8d44('0x20')](realtime[_0x8d44('0x33')]())['then'](dynamics365[_0x8d44('0x34')]())['then'](realtime['initDynamics365Accounts']())[_0x8d44('0x20')](campaign[_0x8d44('0x35')]())[_0x8d44('0x20')](realtime[_0x8d44('0x36')]())[_0x8d44('0x20')](voiceExtension[_0x8d44('0x37')]())['then'](realtime['initVoiceExtensions']())[_0x8d44('0x20')](faxAccount[_0x8d44('0x38')]())[_0x8d44('0x20')](realtime[_0x8d44('0x39')]())[_0x8d44('0x20')](function(){return realtime;});}function initParams(){return BPromise[_0x8d44('0x1e')]()[_0x8d44('0x20')](voiceQueueReport['getVoiceQueueReports']())[_0x8d44('0x20')](realtime[_0x8d44('0x3a')]())[_0x8d44('0x20')](cmHopperHistory[_0x8d44('0x3b')]())[_0x8d44('0x20')](realtime['initVoiceQueueHopperHistory']())[_0x8d44('0x20')](cmHopperHistory[_0x8d44('0x3c')]())[_0x8d44('0x20')](realtime[_0x8d44('0x3d')]())[_0x8d44('0x20')](voiceCallReport[_0x8d44('0x3e')]())['then'](realtime[_0x8d44('0x3f')]())[_0x8d44('0x40')](function(_0x20e703){logger['error']('[index.js][initParams]',util[_0x8d44('0x41')](_0x20e703,{'showHidden':![],'depth':null}));});}function main(){return server[_0x8d44('0x42')](realtime,preview,fax)['then'](function(_0x307f00){return initRealtime();})[_0x8d44('0x20')](function(){return initParams();})[_0x8d44('0x20')](function(){report[_0x8d44('0x43')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x3b7936){logger[_0x8d44('0x44')](_0x8d44('0x45'),util[_0x8d44('0x41')](_0x3b7936,{'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 03443e2..835df58 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 _0x0713=['idle','inuse','talking','voiceStatusTime','toNumber','format','voiceStatusQueue','stringify','user:%s','emit','user:save','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','onhold','local','prototype','state','toLowerCase','not_inuse'];(function(_0x1ff8ca,_0x6588c){var _0x357108=function(_0x3070ed){while(--_0x3070ed){_0x1ff8ca['push'](_0x1ff8ca['shift']());}};_0x357108(++_0x6588c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var md5=require(_0x3071('0x1'));var Redis=require(_0x3071('0x2'));var config=require(_0x3071('0x3'));config[_0x3071('0x4')]=_['defaults'](config[_0x3071('0x4')],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x4')]));function Agent(_0xabd7b6){this['id']=_0xabd7b6['id']||0x0;this[_0x3071('0x7')]=_0xabd7b6[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0xabd7b6[_0x3071('0x8')]||'';this[_0x3071('0x9')]=_0xabd7b6[_0x3071('0x9')]||'';this[_0x3071('0xa')]=_0xabd7b6[_0x3071('0xa')]||'';this['state']=_0x3071('0xb');this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]=_0x3071('0xb');this[_0x3071('0xe')]='';this['phone']='';this[_0x3071('0xf')]='';this[_0x3071('0x10')]='';this[_0x3071('0x11')]=_0xabd7b6[_0x3071('0x11')]||![];this[_0x3071('0x12')]='unknown';this['voiceStatusTime']=0x0;this[_0x3071('0x13')]='';this['voiceStatusQueue']='';this[_0x3071('0x14')]=![];this[_0x3071('0x15')]=![];this['md5']='';}Agent[_0x3071('0x16')]['updateStatusRealtime']=function(_0x2fc15d){var _0x45c93b;if(_0x2fc15d&&_0x2fc15d[_0x3071('0x17')]){_0x45c93b=_0x2fc15d[_0x3071('0x17')][_0x3071('0x18')]();switch(_0x45c93b){case _0x3071('0x19'):_0x45c93b=_0x3071('0x1a');break;case _0x3071('0x1b'):_0x45c93b=_0x3071('0x1c');break;}}if(_0x45c93b&&this[_0x3071('0x12')]!==_0x45c93b||_0x2fc15d['statePause']){this[_0x3071('0x1d')]=_[_0x3071('0x1e')](moment()[_0x3071('0x1f')]('x'));}if(_0x45c93b){this[_0x3071('0x12')]=_0x45c93b;}var _0x3acf0e={'id':this['id'],'name':this[_0x3071('0x7')],'email':this[_0x3071('0x8')],'accountcode':this[_0x3071('0x9')],'fullname':this['fullname'],'state':this[_0x3071('0x17')],'stateTime':this[_0x3071('0xc')],'status':this[_0x3071('0xd')],'address':this['address'],'online':this[_0x3071('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x3071('0x1d')],'voiceStatusCallerIdNumber':this[_0x3071('0x13')],'voiceStatusQueue':this[_0x3071('0x20')],'interface':this[_0x3071('0x10')],'onhold':this[_0x3071('0x14')]};var _0x34c50e=md5(JSON[_0x3071('0x21')](_0x3acf0e));if(this[_0x3071('0x1')]!==_0x34c50e){this['md5']=_0x34c50e;io['to'](util['format'](_0x3071('0x22'),_0x3acf0e[_0x3071('0x7')]))[_0x3071('0x23')](_0x3071('0x24'),_0x3acf0e);io[_0x3071('0x23')](_0x3071('0x25'),_0x3acf0e);}};module[_0x3071('0x26')]=Agent; \ No newline at end of file +var _0x34e8=['interface','online','voiceStatusTime','voiceStatusQueue','onhold','local','updateStatusRealtime','toLowerCase','not_inuse','inuse','talking','voiceStatus','toNumber','format','voiceStatusCallerIdNumber','stringify','user:%s','emit','user:save','exports','lodash','util','moment','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile'];(function(_0x1b1717,_0x3a035a){var _0x2c5e18=function(_0x27d4da){while(--_0x27d4da){_0x1b1717['push'](_0x1b1717['shift']());}};_0x2c5e18(++_0x3a035a);}(_0x34e8,0x12c));var _0x834e=function(_0x5536ef,_0x4a4cdd){_0x5536ef=_0x5536ef-0x0;var _0x40970d=_0x34e8[_0x5536ef];return _0x40970d;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var Redis=require('ioredis');var config=require(_0x834e('0x4'));config[_0x834e('0x5')]=_[_0x834e('0x6')](config[_0x834e('0x5')],{'host':_0x834e('0x7'),'port':0x18eb});var io=require(_0x834e('0x8'))(new Redis(config[_0x834e('0x5')]));function Agent(_0x4a2018){this['id']=_0x4a2018['id']||0x0;this[_0x834e('0x9')]=_0x4a2018['name']||'';this[_0x834e('0xa')]=_0x4a2018[_0x834e('0xa')]||'';this[_0x834e('0xb')]=_0x4a2018[_0x834e('0xb')]||'';this[_0x834e('0xc')]=_0x4a2018[_0x834e('0xc')]||'';this[_0x834e('0xd')]=_0x834e('0xe');this[_0x834e('0xf')]=0x0;this[_0x834e('0x10')]=_0x834e('0xe');this[_0x834e('0x11')]='';this[_0x834e('0x12')]='';this[_0x834e('0x13')]='';this[_0x834e('0x14')]='';this[_0x834e('0x15')]=_0x4a2018[_0x834e('0x15')]||![];this['voiceStatus']=_0x834e('0xe');this[_0x834e('0x16')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x834e('0x17')]='';this[_0x834e('0x18')]=![];this[_0x834e('0x19')]=![];this[_0x834e('0x3')]='';}Agent['prototype'][_0x834e('0x1a')]=function(_0x302cbd){var _0x57274a;if(_0x302cbd&&_0x302cbd[_0x834e('0xd')]){_0x57274a=_0x302cbd['state'][_0x834e('0x1b')]();switch(_0x57274a){case _0x834e('0x1c'):_0x57274a='idle';break;case _0x834e('0x1d'):_0x57274a=_0x834e('0x1e');break;}}if(_0x57274a&&this[_0x834e('0x1f')]!==_0x57274a||_0x302cbd['statePause']){this[_0x834e('0x16')]=_[_0x834e('0x20')](moment()[_0x834e('0x21')]('x'));}if(_0x57274a){this[_0x834e('0x1f')]=_0x57274a;}var _0x237947={'id':this['id'],'name':this[_0x834e('0x9')],'email':this[_0x834e('0xa')],'accountcode':this['accountcode'],'fullname':this[_0x834e('0xc')],'state':this[_0x834e('0xd')],'stateTime':this[_0x834e('0xf')],'status':this[_0x834e('0x10')],'address':this['address'],'online':this[_0x834e('0x15')],'voiceStatus':this[_0x834e('0x1f')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x834e('0x22')],'voiceStatusQueue':this[_0x834e('0x17')],'interface':this[_0x834e('0x14')],'onhold':this['onhold']};var _0x4e3f48=md5(JSON[_0x834e('0x23')](_0x237947));if(this[_0x834e('0x3')]!==_0x4e3f48){this['md5']=_0x4e3f48;io['to'](util[_0x834e('0x21')](_0x834e('0x24'),_0x237947['name']))[_0x834e('0x25')](_0x834e('0x26'),_0x237947);io[_0x834e('0x25')]('user:presence',_0x237947);}};module[_0x834e('0x27')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 48b7770..612a637 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 _0xb5ed=['sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','ivrAnswerCallsDay'];(function(_0x38fbc2,_0x641aa1){var _0x43c7d4=function(_0x45d3b9){while(--_0x45d3b9){_0x38fbc2['push'](_0x38fbc2['shift']());}};_0x43c7d4(++_0x641aa1);}(_0xb5ed,0x191));var _0xdb5e=function(_0x9ff750,_0x22316b){_0x9ff750=_0x9ff750-0x0;var _0x54c37b=_0xb5ed[_0x9ff750];return _0x54c37b;};'use strict';function Campaign(_0x1ca4f9){this['id']=_0x1ca4f9['id']||0x0;this[_0xdb5e('0x0')]=_0x1ca4f9[_0xdb5e('0x0')]||'';this[_0xdb5e('0x1')]=_0x1ca4f9[_0xdb5e('0x1')]||_0xdb5e('0x2');this['originated']=0x0;this['temp']=0x0;this[_0xdb5e('0x3')]=0x0;this['ivrTotalCallsDays']=0x0;this['message']='';this[_0xdb5e('0x4')]=!![];this[_0xdb5e('0x5')]=_0x1ca4f9[_0xdb5e('0x5')];this[_0xdb5e('0x6')]=_0x1ca4f9[_0xdb5e('0x6')];this[_0xdb5e('0x7')]=_0x1ca4f9['dialTimezone']||null;this[_0xdb5e('0x8')]=_0x1ca4f9[_0xdb5e('0x8')]?_0x1ca4f9[_0xdb5e('0x8')]:null;this['dialOriginateCallerIdName']=_0x1ca4f9[_0xdb5e('0x9')];this[_0xdb5e('0xa')]=_0x1ca4f9[_0xdb5e('0xa')];this['dialOriginateTimeout']=_0x1ca4f9[_0xdb5e('0xb')]||0x1e;this['dialCongestionMaxRetry']=_0x1ca4f9['dialCongestionMaxRetry'];this[_0xdb5e('0xc')]=_0x1ca4f9[_0xdb5e('0xc')];this['dialBusyMaxRetry']=_0x1ca4f9[_0xdb5e('0xd')];this[_0xdb5e('0xe')]=_0x1ca4f9[_0xdb5e('0xe')];this[_0xdb5e('0xf')]=_0x1ca4f9[_0xdb5e('0xf')];this[_0xdb5e('0x10')]=_0x1ca4f9[_0xdb5e('0x10')];this[_0xdb5e('0x11')]=_0x1ca4f9[_0xdb5e('0x11')];this['dialNoSuchNumberMaxRetry']=_0x1ca4f9[_0xdb5e('0x12')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x1ca4f9[_0xdb5e('0x13')]||0x96;this['dialDropMaxRetry']=_0x1ca4f9['dialDropMaxRetry']||0x3;this[_0xdb5e('0x14')]=_0x1ca4f9[_0xdb5e('0x14')]||0x96;this[_0xdb5e('0x15')]=_0x1ca4f9[_0xdb5e('0x15')]||0x3;this[_0xdb5e('0x16')]=_0x1ca4f9['dialAbandonedRetryFrequency']||0x96;this[_0xdb5e('0x17')]=_0x1ca4f9[_0xdb5e('0x17')]||0x3;this[_0xdb5e('0x18')]=_0x1ca4f9[_0xdb5e('0x18')]||0x96;this[_0xdb5e('0x19')]=_0x1ca4f9[_0xdb5e('0x19')]||0x3;this[_0xdb5e('0x1a')]=_0x1ca4f9[_0xdb5e('0x1a')]||0x96;this['dialOrderByScheduledAt']=_0x1ca4f9['dialOrderByScheduledAt']||'DESC';this[_0xdb5e('0x1b')]=_0x1ca4f9['dialPrefix']||undefined;this[_0xdb5e('0x1c')]=_0x1ca4f9[_0xdb5e('0x1c')]||undefined;this['dialCutDigit']=_0x1ca4f9[_0xdb5e('0x1d')]||undefined;this[_0xdb5e('0x1e')]=_0x1ca4f9['TrunkBackup']?_0x1ca4f9[_0xdb5e('0x1e')]:undefined;this['Trunk']=_0x1ca4f9[_0xdb5e('0x1f')]?_0x1ca4f9['Trunk']:undefined;this[_0xdb5e('0x20')]=_0x1ca4f9[_0xdb5e('0x20')]?_0x1ca4f9[_0xdb5e('0x20')]:undefined;this[_0xdb5e('0x21')]=_0x1ca4f9[_0xdb5e('0x21')]?_0x1ca4f9['SquareProject']:undefined;this[_0xdb5e('0x22')]=_0x1ca4f9[_0xdb5e('0x21')]?_0x1ca4f9['SquareProject'][_0xdb5e('0x0')]:undefined;this[_0xdb5e('0x23')]=_0x1ca4f9['dialAMDActive']||![];this[_0xdb5e('0x24')]=_0x1ca4f9[_0xdb5e('0x24')];this['dialAMDGreeting']=_0x1ca4f9[_0xdb5e('0x25')];this[_0xdb5e('0x26')]=_0x1ca4f9['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x1ca4f9['dialAMDTotalAnalysisTime'];this[_0xdb5e('0x27')]=_0x1ca4f9[_0xdb5e('0x27')];this[_0xdb5e('0x28')]=_0x1ca4f9[_0xdb5e('0x28')];this[_0xdb5e('0x29')]=_0x1ca4f9[_0xdb5e('0x29')];this[_0xdb5e('0x2a')]=_0x1ca4f9[_0xdb5e('0x2a')];this[_0xdb5e('0x2b')]=_0x1ca4f9[_0xdb5e('0x2b')];}module[_0xdb5e('0x2c')]=Campaign; \ No newline at end of file +var _0x7c2b=['dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency'];(function(_0x31830c,_0x25c77d){var _0x492c62=function(_0x3a56bc){while(--_0x3a56bc){_0x31830c['push'](_0x31830c['shift']());}};_0x492c62(++_0x25c77d);}(_0x7c2b,0x1a2));var _0xb7c2=function(_0x13de1a,_0x56a487){_0x13de1a=_0x13de1a-0x0;var _0x216555=_0x7c2b[_0x13de1a];return _0x216555;};'use strict';function Campaign(_0x46de36){this['id']=_0x46de36['id']||0x0;this['name']=_0x46de36[_0xb7c2('0x0')]||'';this[_0xb7c2('0x1')]=_0x46de36[_0xb7c2('0x1')]||_0xb7c2('0x2');this['originated']=0x0;this[_0xb7c2('0x3')]=0x0;this[_0xb7c2('0x4')]=0x0;this[_0xb7c2('0x5')]=0x0;this[_0xb7c2('0x6')]='';this[_0xb7c2('0x7')]=!![];this['active']=_0x46de36['active'];this[_0xb7c2('0x8')]=_0x46de36[_0xb7c2('0x8')];this['dialTimezone']=_0x46de36[_0xb7c2('0x9')]||null;this[_0xb7c2('0xa')]=_0x46de36[_0xb7c2('0xa')]?_0x46de36[_0xb7c2('0xa')]:null;this[_0xb7c2('0xb')]=_0x46de36[_0xb7c2('0xb')];this[_0xb7c2('0xc')]=_0x46de36[_0xb7c2('0xc')];this['dialOriginateTimeout']=_0x46de36[_0xb7c2('0xd')]||0x1e;this[_0xb7c2('0xe')]=_0x46de36[_0xb7c2('0xe')];this[_0xb7c2('0xf')]=_0x46de36[_0xb7c2('0xf')];this[_0xb7c2('0x10')]=_0x46de36['dialBusyMaxRetry'];this['dialBusyRetryFrequency']=_0x46de36[_0xb7c2('0x11')];this['dialNoAnswerMaxRetry']=_0x46de36[_0xb7c2('0x12')];this[_0xb7c2('0x13')]=_0x46de36['dialNoAnswerRetryFrequency'];this[_0xb7c2('0x14')]=_0x46de36[_0xb7c2('0x14')];this[_0xb7c2('0x15')]=_0x46de36[_0xb7c2('0x15')]||0x3;this[_0xb7c2('0x16')]=_0x46de36['dialNoSuchNumberRetryFrequency']||0x96;this[_0xb7c2('0x17')]=_0x46de36['dialDropMaxRetry']||0x3;this[_0xb7c2('0x18')]=_0x46de36[_0xb7c2('0x18')]||0x96;this['dialAbandonedMaxRetry']=_0x46de36['dialAbandonedMaxRetry']||0x3;this[_0xb7c2('0x19')]=_0x46de36[_0xb7c2('0x19')]||0x96;this[_0xb7c2('0x1a')]=_0x46de36[_0xb7c2('0x1a')]||0x3;this['dialMachineRetryFrequency']=_0x46de36['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x46de36[_0xb7c2('0x1b')]||0x3;this['dialAgentRejectRetryFrequency']=_0x46de36[_0xb7c2('0x1c')]||0x96;this[_0xb7c2('0x1d')]=_0x46de36['dialOrderByScheduledAt']||'DESC';this[_0xb7c2('0x1e')]=_0x46de36[_0xb7c2('0x1e')]||undefined;this[_0xb7c2('0x1f')]=_0x46de36[_0xb7c2('0x1f')]||undefined;this[_0xb7c2('0x20')]=_0x46de36[_0xb7c2('0x20')]||undefined;this[_0xb7c2('0x21')]=_0x46de36[_0xb7c2('0x21')]?_0x46de36[_0xb7c2('0x21')]:undefined;this[_0xb7c2('0x22')]=_0x46de36[_0xb7c2('0x22')]?_0x46de36['Trunk']:undefined;this[_0xb7c2('0x23')]=_0x46de36[_0xb7c2('0x23')]?_0x46de36['Interval']:undefined;this[_0xb7c2('0x24')]=_0x46de36[_0xb7c2('0x24')]?_0x46de36[_0xb7c2('0x24')]:undefined;this[_0xb7c2('0x25')]=_0x46de36['SquareProject']?_0x46de36['SquareProject']['name']:undefined;this[_0xb7c2('0x26')]=_0x46de36[_0xb7c2('0x26')]||![];this[_0xb7c2('0x27')]=_0x46de36[_0xb7c2('0x27')];this['dialAMDGreeting']=_0x46de36[_0xb7c2('0x28')];this['dialAMDAfterGreetingSilence']=_0x46de36[_0xb7c2('0x29')];this[_0xb7c2('0x2a')]=_0x46de36[_0xb7c2('0x2a')];this[_0xb7c2('0x2b')]=_0x46de36[_0xb7c2('0x2b')];this[_0xb7c2('0x2c')]=_0x46de36['dialAMDBetweenWordsSilence'];this[_0xb7c2('0x2d')]=_0x46de36[_0xb7c2('0x2d')];this[_0xb7c2('0x2e')]=_0x46de36[_0xb7c2('0x2e')];this[_0xb7c2('0x2f')]=_0x46de36[_0xb7c2('0x2f')];}module[_0xb7c2('0x30')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 2148e4f..7f2279c 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 _0x958a=['unmanaged','abandoned','lastapplication','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','starttime','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','uniqueid','exten','answered','answertime','endtime'];(function(_0x5654e3,_0x2e326b){var _0x3d67fa=function(_0xa32661){while(--_0xa32661){_0x5654e3['push'](_0x5654e3['shift']());}};_0x3d67fa(++_0x2e326b);}(_0x958a,0x128));var _0xa958=function(_0x2dfa49,_0x4986ec){_0x2dfa49=_0x2dfa49-0x0;var _0x5b7900=_0x958a[_0x2dfa49];return _0x5b7900;};'use strict';function Channel(){this[_0xa958('0x0')]=null;this[_0xa958('0x1')]='';this['destinationchannel']='';this[_0xa958('0x2')]=0x0;this[_0xa958('0x3')]='';this[_0xa958('0x4')]=undefined;this[_0xa958('0x5')]=undefined;this[_0xa958('0x6')]=0x0;this['context']='';this[_0xa958('0x7')]=0x0;this['linkedid']=0x0;this[_0xa958('0x8')]=0x0;this[_0xa958('0x9')]=![];this[_0xa958('0xa')]=null;this[_0xa958('0xb')]=null;this[_0xa958('0xc')]=![];this[_0xa958('0xd')]=![];this[_0xa958('0xe')]='';this['lastdata']='';this['duration']=0x0;this[_0xa958('0xf')]=0x0;this[_0xa958('0x10')]=0x0;this[_0xa958('0x11')]=null;this[_0xa958('0x12')]=null;this[_0xa958('0x13')]=null;this[_0xa958('0x14')]=![];this[_0xa958('0x15')]=null;this[_0xa958('0x16')]=null;this[_0xa958('0x17')]=[];this[_0xa958('0x18')]=undefined;this[_0xa958('0x19')]=undefined;this[_0xa958('0x1a')]=undefined;this[_0xa958('0x1b')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0xde1a=['exports','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','linkedid','exten','answered','answertime','endtime','unmanaged','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitorFilename','queue','transfercalleridnum','transferconnectedlinenum','transferType'];(function(_0x33f30b,_0x220540){var _0x12e1c3=function(_0x5439f0){while(--_0x5439f0){_0x33f30b['push'](_0x33f30b['shift']());}};_0x12e1c3(++_0x220540);}(_0xde1a,0xfd));var _0xade1=function(_0x17cc5c,_0x581a7f){_0x17cc5c=_0x17cc5c-0x0;var _0x2fbdaf=_0xde1a[_0x17cc5c];return _0x2fbdaf;};'use strict';function Channel(){this['starttime']=null;this[_0xade1('0x0')]='';this[_0xade1('0x1')]='';this[_0xade1('0x2')]=0x0;this[_0xade1('0x3')]='';this[_0xade1('0x4')]=undefined;this[_0xade1('0x5')]=undefined;this[_0xade1('0x6')]=0x0;this[_0xade1('0x7')]='';this['uniqueid']=0x0;this[_0xade1('0x8')]=0x0;this[_0xade1('0x9')]=0x0;this[_0xade1('0xa')]=![];this[_0xade1('0xb')]=null;this[_0xade1('0xc')]=null;this[_0xade1('0xd')]=![];this['abandoned']=![];this[_0xade1('0xe')]='';this[_0xade1('0xf')]='';this[_0xade1('0x10')]=0x0;this[_0xade1('0x11')]=0x0;this[_0xade1('0x12')]=0x0;this[_0xade1('0x13')]=null;this[_0xade1('0x14')]=null;this[_0xade1('0x15')]=null;this['monitor']=![];this[_0xade1('0x16')]=null;this[_0xade1('0x17')]=null;this['monitors']=[];this[_0xade1('0x18')]=undefined;this[_0xade1('0x19')]=undefined;this[_0xade1('0x1a')]=undefined;this['mohtime']=0x0;}module[_0xade1('0x1b')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index dfda405..1a002d2 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 _0x7ebc=['username','remoteUri','authType','password','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name'];(function(_0x1fb8d5,_0x5ad2fd){var _0x302103=function(_0x22d799){while(--_0x22d799){_0x1fb8d5['push'](_0x1fb8d5['shift']());}};_0x302103(++_0x5ad2fd);}(_0x7ebc,0x1eb));var _0xc7eb=function(_0x1fcaf1,_0x21c3c2){_0x1fcaf1=_0x1fcaf1-0x0;var _0x55f464=_0x7ebc[_0x1fcaf1];return _0x55f464;};'use strict';function DeskAccount(_0x21f597){this['id']=_0x21f597['id']||0x0;this[_0xc7eb('0x0')]=_0x21f597[_0xc7eb('0x0')]||'';this['username']=_0x21f597[_0xc7eb('0x1')]||'';this[_0xc7eb('0x2')]=_0x21f597[_0xc7eb('0x2')]||'';this[_0xc7eb('0x3')]=_0x21f597[_0xc7eb('0x3')]||'';this[_0xc7eb('0x4')]=_0x21f597[_0xc7eb('0x4')]||'';this['consumerKey']=_0x21f597['consumerKey']||'';this[_0xc7eb('0x5')]=_0x21f597[_0xc7eb('0x5')]||'';this[_0xc7eb('0x6')]=_0x21f597[_0xc7eb('0x6')]||'';this[_0xc7eb('0x7')]=_0x21f597[_0xc7eb('0x7')]||'';this[_0xc7eb('0x8')]=_0x21f597['type']||'';this[_0xc7eb('0x9')]=_0x21f597[_0xc7eb('0x9')]||'';this[_0xc7eb('0xa')]=_0x21f597['Configurations']||{};}module[_0xc7eb('0xb')]=DeskAccount; \ No newline at end of file +var _0x20c1=['username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name'];(function(_0x4f3edb,_0x586ae2){var _0x520401=function(_0x4473cf){while(--_0x4473cf){_0x4f3edb['push'](_0x4f3edb['shift']());}};_0x520401(++_0x586ae2);}(_0x20c1,0x1ed));var _0x120c=function(_0x13d467,_0x5b4def){_0x13d467=_0x13d467-0x0;var _0xce4f2b=_0x20c1[_0x13d467];return _0xce4f2b;};'use strict';function DeskAccount(_0x471a5d){this['id']=_0x471a5d['id']||0x0;this[_0x120c('0x0')]=_0x471a5d[_0x120c('0x0')]||'';this['username']=_0x471a5d[_0x120c('0x1')]||'';this[_0x120c('0x2')]=_0x471a5d[_0x120c('0x2')]||'';this[_0x120c('0x3')]=_0x471a5d['authType']||'';this[_0x120c('0x4')]=_0x471a5d['password']||'';this[_0x120c('0x5')]=_0x471a5d['consumerKey']||'';this[_0x120c('0x6')]=_0x471a5d[_0x120c('0x6')]||'';this[_0x120c('0x7')]=_0x471a5d[_0x120c('0x7')]||'';this[_0x120c('0x8')]=_0x471a5d[_0x120c('0x8')]||'';this['type']=_0x471a5d[_0x120c('0x9')]||'';this['serverUrl']=_0x471a5d[_0x120c('0xa')]||'';this[_0x120c('0xb')]=_0x471a5d[_0x120c('0xb')]||{};}module[_0x120c('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 6ed6219..d93cd16 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 _0xbaf0=['Configurations','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x468e61,_0x59723d){var _0x1c0325=function(_0x34cef3){while(--_0x34cef3){_0x468e61['push'](_0x468e61['shift']());}};_0x1c0325(++_0x59723d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';function Dynamics365Account(_0x61caa9){this['id']=_0x61caa9['id']||0x0;this[_0x0baf('0x0')]=_0x61caa9[_0x0baf('0x0')]||'';this[_0x0baf('0x1')]=_0x61caa9[_0x0baf('0x1')]||'';this[_0x0baf('0x2')]=_0x61caa9[_0x0baf('0x2')]||'';this['remoteUri']=_0x61caa9[_0x0baf('0x3')]||'';this[_0x0baf('0x4')]=_0x61caa9[_0x0baf('0x4')]||'';this[_0x0baf('0x5')]=_0x61caa9[_0x0baf('0x5')]||'';this[_0x0baf('0x6')]=_0x61caa9[_0x0baf('0x6')]||{};this[_0x0baf('0x7')]=_0x61caa9[_0x0baf('0x7')]||'';this['Configurations']=_0x61caa9[_0x0baf('0x8')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0xee5b=['clientId','clientSecret','name','username','password','remoteUri'];(function(_0x4854d6,_0x2f1264){var _0x3885c0=function(_0x4d564d){while(--_0x4d564d){_0x4854d6['push'](_0x4854d6['shift']());}};_0x3885c0(++_0x2f1264);}(_0xee5b,0x1f4));var _0xbee5=function(_0x264e0f,_0x3ee130){_0x264e0f=_0x264e0f-0x0;var _0x3c1923=_0xee5b[_0x264e0f];return _0x3c1923;};'use strict';function Dynamics365Account(_0x5384bd){this['id']=_0x5384bd['id']||0x0;this['name']=_0x5384bd[_0xbee5('0x0')]||'';this[_0xbee5('0x1')]=_0x5384bd['username']||'';this[_0xbee5('0x2')]=_0x5384bd[_0xbee5('0x2')]||'';this[_0xbee5('0x3')]=_0x5384bd[_0xbee5('0x3')]||'';this['tenantId']=_0x5384bd['tenantId']||'';this[_0xbee5('0x4')]=_0x5384bd[_0xbee5('0x4')]||'';this[_0xbee5('0x5')]=_0x5384bd[_0xbee5('0x5')]||{};this['serverUrl']=_0x5384bd['serverUrl']||'';this['Configurations']=_0x5384bd['Configurations']||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 65d3945..644751c 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 _0x83a5=['modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','ecm','headerinfo','localstationid','minrate'];(function(_0x276f91,_0x22d9fc){var _0x1ba447=function(_0x198337){while(--_0x198337){_0x276f91['push'](_0x276f91['shift']());}};_0x1ba447(++_0x22d9fc);}(_0x83a5,0xcb));var _0x583a=function(_0x5dce70,_0x246f01){_0x5dce70=_0x5dce70-0x0;var _0x107197=_0x83a5[_0x5dce70];return _0x107197;};'use strict';function FaxAccount(_0x42caff){this['id']=_0x42caff['id']||0x0;this[_0x583a('0x0')]=_0x42caff[_0x583a('0x0')]||'';this['description']=_0x42caff['description'];this[_0x583a('0x1')]=_0x42caff[_0x583a('0x1')];this[_0x583a('0x2')]=_0x42caff['headerinfo'];this[_0x583a('0x3')]=_0x42caff[_0x583a('0x3')];this[_0x583a('0x4')]=_0x42caff['minrate']||0x960;this['maxrate']=_0x42caff['maxrate']||0x3840;this[_0x583a('0x5')]=_0x42caff[_0x583a('0x5')]||_0x583a('0x6');this[_0x583a('0x7')]=_0x42caff[_0x583a('0x7')]||'no';this[_0x583a('0x8')]=_0x42caff[_0x583a('0x8')]||'no';this[_0x583a('0x9')]=_0x42caff[_0x583a('0x9')]||0x1388;this['tech']=_0x42caff[_0x583a('0xa')]||_0x583a('0xb');this[_0x583a('0xc')]=_0x42caff['Trunk']?_0x42caff['Trunk']:undefined;this[_0x583a('0xd')]=_0x42caff[_0x583a('0xd')];this[_0x583a('0xe')]=_0x42caff[_0x583a('0xe')];}module[_0x583a('0xf')]=FaxAccount; \ No newline at end of file +var _0x024b=['description','ecm','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','t38timeout','tech','SIP','Trunk','ListId','key','exports','name'];(function(_0x2ac71a,_0x1d2a02){var _0x3ee904=function(_0x5c902a){while(--_0x5c902a){_0x2ac71a['push'](_0x2ac71a['shift']());}};_0x3ee904(++_0x1d2a02);}(_0x024b,0x1df));var _0xb024=function(_0x50e690,_0x3bdbaa){_0x50e690=_0x50e690-0x0;var _0x49df86=_0x024b[_0x50e690];return _0x49df86;};'use strict';function FaxAccount(_0x4f5d0b){this['id']=_0x4f5d0b['id']||0x0;this[_0xb024('0x0')]=_0x4f5d0b[_0xb024('0x0')]||'';this[_0xb024('0x1')]=_0x4f5d0b[_0xb024('0x1')];this[_0xb024('0x2')]=_0x4f5d0b[_0xb024('0x2')];this['headerinfo']=_0x4f5d0b['headerinfo'];this[_0xb024('0x3')]=_0x4f5d0b[_0xb024('0x3')];this[_0xb024('0x4')]=_0x4f5d0b['minrate']||0x960;this['maxrate']=_0x4f5d0b[_0xb024('0x5')]||0x3840;this['modem']=_0x4f5d0b[_0xb024('0x6')]||_0xb024('0x7');this['gateway']=_0x4f5d0b[_0xb024('0x8')]||'no';this['faxdetect']=_0x4f5d0b['faxdetect']||'no';this[_0xb024('0x9')]=_0x4f5d0b[_0xb024('0x9')]||0x1388;this[_0xb024('0xa')]=_0x4f5d0b['tech']||_0xb024('0xb');this['Trunk']=_0x4f5d0b[_0xb024('0xc')]?_0x4f5d0b[_0xb024('0xc')]:undefined;this[_0xb024('0xd')]=_0x4f5d0b['ListId'];this['key']=_0x4f5d0b[_0xb024('0xe')];}module[_0xb024('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 5a67cdd..f6df62a 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 _0x633d=['remoteUri','serverUrl','Configurations','exports','username','apiKey','token'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x633d,0x100));var _0xd633=function(_0x3ef0d0,_0x4b6e6c){_0x3ef0d0=_0x3ef0d0-0x0;var _0x4dcaeb=_0x633d[_0x3ef0d0];return _0x4dcaeb;};'use strict';function FreshdeskAccount(_0x36fb9b){this['id']=_0x36fb9b['id']||0x0;this['name']=_0x36fb9b['name']||'';this['username']=_0x36fb9b[_0xd633('0x0')]||'';this[_0xd633('0x1')]=_0x36fb9b[_0xd633('0x2')]||'';this[_0xd633('0x3')]=_0x36fb9b[_0xd633('0x3')]||'';this[_0xd633('0x4')]=_0x36fb9b[_0xd633('0x4')]||'';this[_0xd633('0x5')]=_0x36fb9b[_0xd633('0x5')]||{};}module[_0xd633('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0xe545=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xe545,0xed));var _0x5e54=function(_0x55c108,_0x2334e0){_0x55c108=_0x55c108-0x0;var _0x2db5b5=_0xe545[_0x55c108];return _0x2db5b5;};'use strict';function FreshdeskAccount(_0x275eb0){this['id']=_0x275eb0['id']||0x0;this[_0x5e54('0x0')]=_0x275eb0['name']||'';this[_0x5e54('0x1')]=_0x275eb0[_0x5e54('0x1')]||'';this[_0x5e54('0x2')]=_0x275eb0[_0x5e54('0x3')]||'';this[_0x5e54('0x4')]=_0x275eb0['remoteUri']||'';this[_0x5e54('0x5')]=_0x275eb0[_0x5e54('0x5')]||'';this[_0x5e54('0x6')]=_0x275eb0[_0x5e54('0x6')]||{};}module[_0x5e54('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 47b68e5..753a69a 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 _0x2427=['name','username','apiKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x2427,0x165));var _0x7242=function(_0x566414,_0x35b82a){_0x566414=_0x566414-0x0;var _0x4c90f2=_0x2427[_0x566414];return _0x4c90f2;};'use strict';function FreshsalesAccount(_0x284545){this['id']=_0x284545['id']||0x0;this[_0x7242('0x0')]=_0x284545['name']||'';this[_0x7242('0x1')]=_0x284545['username']||'';this[_0x7242('0x2')]=_0x284545['token']||'';this[_0x7242('0x3')]=_0x284545[_0x7242('0x3')]||'';this[_0x7242('0x4')]=_0x284545['serverUrl']||'';this[_0x7242('0x5')]=_0x284545['Configurations']||{};}module[_0x7242('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x950a=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x421725,_0x318a04){var _0x51b322=function(_0xe58018){while(--_0xe58018){_0x421725['push'](_0x421725['shift']());}};_0x51b322(++_0x318a04);}(_0x950a,0x111));var _0xa950=function(_0x3e20e8,_0x58a046){_0x3e20e8=_0x3e20e8-0x0;var _0x58ede5=_0x950a[_0x3e20e8];return _0x58ede5;};'use strict';function FreshsalesAccount(_0x95ee3e){this['id']=_0x95ee3e['id']||0x0;this[_0xa950('0x0')]=_0x95ee3e[_0xa950('0x0')]||'';this[_0xa950('0x1')]=_0x95ee3e['username']||'';this[_0xa950('0x2')]=_0x95ee3e[_0xa950('0x3')]||'';this[_0xa950('0x4')]=_0x95ee3e[_0xa950('0x4')]||'';this['serverUrl']=_0x95ee3e[_0xa950('0x5')]||'';this[_0xa950('0x6')]=_0x95ee3e['Configurations']||{};}module[_0xa950('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 0824345..bb9e891 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 _0x2b84=['queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','context','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','exports','type','inbound','uniqueid','queuecallerjoinAt','position','count','queuecallerabandon','queuecallercompleteAt'];(function(_0x3df3c6,_0x496e1a){var _0x254c43=function(_0x371daa){while(--_0x371daa){_0x3df3c6['push'](_0x3df3c6['shift']());}};_0x254c43(++_0x496e1a);}(_0x2b84,0xbe));var _0x42b8=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x2b84[_0x2763f2];return _0x3ef471;};'use strict';function QueueReport(){this[_0x42b8('0x0')]=_0x42b8('0x1');this[_0x42b8('0x2')]='';this['calleridnum']='';this['calleridname']='';this['queue']='';this[_0x42b8('0x3')]=null;this['queuecallerleaveAt']=null;this[_0x42b8('0x4')]=0x1;this[_0x42b8('0x5')]=0x1;this[_0x42b8('0x6')]=![];this['queuecallerabandonAt']=null;this['queuecallercomplete']=![];this[_0x42b8('0x7')]=null;this[_0x42b8('0x8')]=![];this[_0x42b8('0x9')]=null;this['originalposition']=0x1;this[_0x42b8('0xa')]='';this[_0x42b8('0xb')]='';this[_0x42b8('0xc')]='';this['accountcode']='';this[_0x42b8('0xd')]='';this[_0x42b8('0xe')]='';this[_0x42b8('0xf')]='';this[_0x42b8('0x10')]=0x0;this[_0x42b8('0x11')]=![];this[_0x42b8('0x12')]='';this[_0x42b8('0x13')]=_0x42b8('0x14');this['mohtime']=0x0;this['variables']={};}module[_0x42b8('0x15')]=QueueReport; \ No newline at end of file +var _0x2583=['connectedlinenum','accountcode','exten','priority','holdtime','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexit','channel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2583,0xac));var _0x3258=function(_0x35aa08,_0x317634){_0x35aa08=_0x35aa08-0x0;var _0x4705b8=_0x2583[_0x35aa08];return _0x4705b8;};'use strict';function QueueReport(){this[_0x3258('0x0')]=_0x3258('0x1');this[_0x3258('0x2')]='';this[_0x3258('0x3')]='';this['calleridname']='';this['queue']='';this['queuecallerjoinAt']=null;this[_0x3258('0x4')]=null;this[_0x3258('0x5')]=0x1;this[_0x3258('0x6')]=0x1;this[_0x3258('0x7')]=![];this[_0x3258('0x8')]=null;this[_0x3258('0x9')]=![];this['queuecallercompleteAt']=null;this[_0x3258('0xa')]=![];this['queuecallerexitAt']=null;this['originalposition']=0x1;this[_0x3258('0xb')]='';this[_0x3258('0xc')]='';this['connectedlinename']='';this[_0x3258('0xd')]='';this['context']='';this[_0x3258('0xe')]='';this[_0x3258('0xf')]='';this[_0x3258('0x10')]=0x0;this['assigned']=![];this[_0x3258('0x11')]='';this[_0x3258('0x12')]=_0x3258('0x13');this[_0x3258('0x14')]=0x0;this[_0x3258('0x15')]={};}module[_0x3258('0x16')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 1d62a07..8da6e5a 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 _0x1902=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','exports','name'];(function(_0x44e3ad,_0x28f252){var _0x2db038=function(_0x23b331){while(--_0x23b331){_0x44e3ad['push'](_0x44e3ad['shift']());}};_0x2db038(++_0x28f252);}(_0x1902,0x83));var _0x2190=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1902[_0x3dd15e];return _0x231fd0;};'use strict';function SalesforceAccount(_0x1042cc){this['id']=_0x1042cc['id']||0x0;this[_0x2190('0x0')]=_0x1042cc['name']||'';this[_0x2190('0x1')]=_0x1042cc[_0x2190('0x1')]||'';this[_0x2190('0x2')]=_0x1042cc[_0x2190('0x2')]||'';this[_0x2190('0x3')]=_0x1042cc[_0x2190('0x3')]||'';this[_0x2190('0x4')]=_0x1042cc['clientId']||'';this[_0x2190('0x5')]=_0x1042cc[_0x2190('0x5')]||'';this[_0x2190('0x6')]=_0x1042cc[_0x2190('0x6')]||'';this[_0x2190('0x7')]=_0x1042cc['type']||_0x2190('0x8');this[_0x2190('0x9')]=_0x1042cc[_0x2190('0x9')]||'';this['Configurations']=_0x1042cc['Configurations']||{};}module[_0x2190('0xa')]=SalesforceAccount; \ No newline at end of file +var _0xd0f5=['Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl'];(function(_0x5064fd,_0x539799){var _0xf32505=function(_0x174be1){while(--_0x174be1){_0x5064fd['push'](_0x5064fd['shift']());}};_0xf32505(++_0x539799);}(_0xd0f5,0xda));var _0x5d0f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd0f5[_0x3dd15e];return _0x231fd0;};'use strict';function SalesforceAccount(_0x23c2bf){this['id']=_0x23c2bf['id']||0x0;this[_0x5d0f('0x0')]=_0x23c2bf['name']||'';this[_0x5d0f('0x1')]=_0x23c2bf[_0x5d0f('0x1')]||'';this[_0x5d0f('0x2')]=_0x23c2bf[_0x5d0f('0x2')]||'';this[_0x5d0f('0x3')]=_0x23c2bf[_0x5d0f('0x3')]||'';this[_0x5d0f('0x4')]=_0x23c2bf[_0x5d0f('0x4')]||'';this['clientSecret']=_0x23c2bf[_0x5d0f('0x5')]||'';this[_0x5d0f('0x6')]=_0x23c2bf['securityToken']||'';this[_0x5d0f('0x7')]=_0x23c2bf[_0x5d0f('0x7')]||_0x5d0f('0x8');this[_0x5d0f('0x9')]=_0x23c2bf['serverUrl']||'';this[_0x5d0f('0xa')]=_0x23c2bf[_0x5d0f('0xa')]||{};}module[_0x5d0f('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 03aefc2..717a741 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 _0x86bd=['serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x86bd,0xaa));var _0xd86b=function(_0x15fc3a,_0x5d83f4){_0x15fc3a=_0x15fc3a-0x0;var _0x34f2b4=_0x86bd[_0x15fc3a];return _0x34f2b4;};'use strict';function ServicenowAccount(_0x44190a){this['id']=_0x44190a['id']||0x0;this[_0xd86b('0x0')]=_0x44190a[_0xd86b('0x0')]||'';this[_0xd86b('0x1')]=_0x44190a[_0xd86b('0x1')]||'';this[_0xd86b('0x2')]=_0x44190a[_0xd86b('0x2')]||'';this[_0xd86b('0x3')]=_0x44190a[_0xd86b('0x3')]||'';this[_0xd86b('0x4')]=_0x44190a[_0xd86b('0x4')]||'';this[_0xd86b('0x5')]=_0x44190a[_0xd86b('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x13ac=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x13ac,0x1c2));var _0xc13a=function(_0x2c0a6d,_0x1007ce){_0x2c0a6d=_0x2c0a6d-0x0;var _0x49f6f5=_0x13ac[_0x2c0a6d];return _0x49f6f5;};'use strict';function ServicenowAccount(_0x478c7a){this['id']=_0x478c7a['id']||0x0;this[_0xc13a('0x0')]=_0x478c7a[_0xc13a('0x0')]||'';this[_0xc13a('0x1')]=_0x478c7a[_0xc13a('0x1')]||'';this[_0xc13a('0x2')]=_0x478c7a[_0xc13a('0x2')]||'';this[_0xc13a('0x3')]=_0x478c7a['remoteUri']||'';this[_0xc13a('0x4')]=_0x478c7a[_0xc13a('0x4')]||'';this['Configurations']=_0x478c7a[_0xc13a('0x5')]||{};}module[_0xc13a('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 dca77f4..47242d3 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 _0x4de0=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x429abb,_0xccaac8){var _0x301ca4=function(_0xfaa0dd){while(--_0xfaa0dd){_0x429abb['push'](_0x429abb['shift']());}};_0x301ca4(++_0xccaac8);}(_0x4de0,0x8e));var _0x04de=function(_0x4bdb5b,_0x5b1e61){_0x4bdb5b=_0x4bdb5b-0x0;var _0x745a0f=_0x4de0[_0x4bdb5b];return _0x745a0f;};'use strict';function SugarcrmAccount(_0x2549de){this['id']=_0x2549de['id']||0x0;this['name']=_0x2549de[_0x04de('0x0')]||'';this[_0x04de('0x1')]=_0x2549de[_0x04de('0x1')]||'';this[_0x04de('0x2')]=_0x2549de['password']||'';this['remoteUri']=_0x2549de[_0x04de('0x3')]||'';this[_0x04de('0x4')]=_0x2549de[_0x04de('0x4')]||'';this[_0x04de('0x5')]=_0x2549de[_0x04de('0x5')]||{};}module[_0x04de('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xb49e=['password','remoteUri','serverUrl','Configurations','username'];(function(_0x39349f,_0x2b03eb){var _0x352d2c=function(_0x2d0d76){while(--_0x2d0d76){_0x39349f['push'](_0x39349f['shift']());}};_0x352d2c(++_0x2b03eb);}(_0xb49e,0xe5));var _0xeb49=function(_0x263e3d,_0x44eee6){_0x263e3d=_0x263e3d-0x0;var _0x3c5cc6=_0xb49e[_0x263e3d];return _0x3c5cc6;};'use strict';function SugarcrmAccount(_0xcbf079){this['id']=_0xcbf079['id']||0x0;this['name']=_0xcbf079['name']||'';this[_0xeb49('0x0')]=_0xcbf079['username']||'';this[_0xeb49('0x1')]=_0xcbf079['password']||'';this[_0xeb49('0x2')]=_0xcbf079['remoteUri']||'';this[_0xeb49('0x3')]=_0xcbf079[_0xeb49('0x3')]||'';this['Configurations']=_0xcbf079[_0xeb49('0x4')]||{};}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 b928689..ffef337 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 _0x6b74=['name','accountcode','unknown','stateTime','status','exports'];(function(_0x5e1f0f,_0x45a0e7){var _0x99c34a=function(_0x66dbdb){while(--_0x66dbdb){_0x5e1f0f['push'](_0x5e1f0f['shift']());}};_0x99c34a(++_0x45a0e7);}(_0x6b74,0xcc));var _0x46b7=function(_0x340756,_0xad31ae){_0x340756=_0x340756-0x0;var _0x2ef745=_0x6b74[_0x340756];return _0x2ef745;};'use strict';function Telephone(_0x24fbf7){this['id']=_0x24fbf7['id']||0x0;this[_0x46b7('0x0')]=_0x24fbf7['name']||'';this[_0x46b7('0x1')]=_0x24fbf7[_0x46b7('0x1')]||'';this['state']=_0x46b7('0x2');this[_0x46b7('0x3')]=0x0;this[_0x46b7('0x4')]='unknown';this['address']='';}module[_0x46b7('0x5')]=Telephone; \ No newline at end of file +var _0x7c47=['accountcode','state','unknown','stateTime','status','address','name'];(function(_0x32b124,_0x170a02){var _0x438ace=function(_0x38f276){while(--_0x38f276){_0x32b124['push'](_0x32b124['shift']());}};_0x438ace(++_0x170a02);}(_0x7c47,0x1b8));var _0x77c4=function(_0x4a408d,_0x234198){_0x4a408d=_0x4a408d-0x0;var _0x7284c5=_0x7c47[_0x4a408d];return _0x7284c5;};'use strict';function Telephone(_0x1b8584){this['id']=_0x1b8584['id']||0x0;this['name']=_0x1b8584[_0x77c4('0x0')]||'';this[_0x77c4('0x1')]=_0x1b8584[_0x77c4('0x1')]||'';this[_0x77c4('0x2')]=_0x77c4('0x3');this[_0x77c4('0x4')]=0x0;this[_0x77c4('0x5')]='unknown';this[_0x77c4('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 144ff48..d4bc102 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x1c6d5c,_0x225e50){var _0x53ad10=function(_0x32088d){while(--_0x32088d){_0x1c6d5c['push'](_0x1c6d5c['shift']());}};_0x53ad10(++_0x225e50);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x54fd77,_0x3dae82){var _0x57fdd8=function(_0x4dcb88){while(--_0x4dcb88){_0x54fd77['push'](_0x54fd77['shift']());}};_0x57fdd8(++_0x3dae82);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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 a5a955c..a2b71df 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 _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0x3bd7c1,_0x158e62){var _0x487f3f=function(_0x4d626f){while(--_0x4d626f){_0x3bd7c1['push'](_0x3bd7c1['shift']());}};_0x487f3f(++_0x158e62);}(_0x8603,0x190));var _0x3860=function(_0xe31fc4,_0x2939c4){_0xe31fc4=_0xe31fc4-0x0;var _0x3a975c=_0x8603[_0xe31fc4];return _0x3a975c;};'use strict';function Trigger(_0xba4b79){this['id']=_0xba4b79['id']||0x0;this[_0x3860('0x0')]=_0xba4b79[_0x3860('0x0')]||'';this[_0x3860('0x1')]=_0xba4b79['channel']||'voice';this[_0x3860('0x2')]=_0xba4b79[_0x3860('0x2')]||![];this[_0x3860('0x3')]=_0xba4b79['AllConditions']||[];this[_0x3860('0x4')]=_0xba4b79['AnyConditions']||[];this[_0x3860('0x5')]=_0xba4b79[_0x3860('0x5')]||[];}module[_0x3860('0x6')]=Trigger; \ No newline at end of file +var _0x14a0=['voice','status','AnyConditions','Actions','name','channel'];(function(_0x115b5b,_0x19ea8d){var _0x5295d0=function(_0x25f9c6){while(--_0x25f9c6){_0x115b5b['push'](_0x115b5b['shift']());}};_0x5295d0(++_0x19ea8d);}(_0x14a0,0x8e));var _0x014a=function(_0x49b71c,_0x343fed){_0x49b71c=_0x49b71c-0x0;var _0x231b46=_0x14a0[_0x49b71c];return _0x231b46;};'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 diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 16d45da..cc23a17 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 _0x1995=['defaultuser','exports','active','name','state','unknown','stateTime','status','registry','host','port','domainport','registrationtime'];(function(_0x15ad2e,_0x2c7d3c){var _0x51e0a2=function(_0x496c6a){while(--_0x496c6a){_0x15ad2e['push'](_0x15ad2e['shift']());}};_0x51e0a2(++_0x2c7d3c);}(_0x1995,0x154));var _0x5199=function(_0x39819f,_0x33e1d9){_0x39819f=_0x39819f-0x0;var _0x362eb3=_0x1995[_0x39819f];return _0x362eb3;};'use strict';function Trunk(_0x3e7eb5){this['id']=_0x3e7eb5['id']||0x0;this[_0x5199('0x0')]=_0x3e7eb5['active']||![];this['name']=_0x3e7eb5[_0x5199('0x1')]||'';this[_0x5199('0x2')]=_0x5199('0x3');this[_0x5199('0x4')]=0x0;this[_0x5199('0x5')]=_0x5199('0x3');this[_0x5199('0x6')]=_0x3e7eb5['registry']&&_0x3e7eb5[_0x5199('0x6')]['indexOf'](':')?_0x3e7eb5[_0x5199('0x6')]['split'](':')[0x0]:'';this[_0x5199('0x7')]='';this[_0x5199('0x8')]='';this['domain']='';this[_0x5199('0x9')]='';this['refresh']='';this['stateRegistry']=_0x5199('0x3');this[_0x5199('0xa')]='';this['address']='';this[_0x5199('0xb')]=_0x3e7eb5[_0x5199('0xb')]||'';}module[_0x5199('0xc')]=Trunk; \ No newline at end of file +var _0x8703=['stateRegistry','registrationtime','address','defaultuser','exports','active','name','unknown','stateTime','registry','indexOf','port','domain','domainport'];(function(_0x24d1ca,_0x43b341){var _0x223b23=function(_0x435381){while(--_0x435381){_0x24d1ca['push'](_0x24d1ca['shift']());}};_0x223b23(++_0x43b341);}(_0x8703,0xe5));var _0x3870=function(_0x4b0820,_0x45e5be){_0x4b0820=_0x4b0820-0x0;var _0x22b870=_0x8703[_0x4b0820];return _0x22b870;};'use strict';function Trunk(_0x297722){this['id']=_0x297722['id']||0x0;this['active']=_0x297722[_0x3870('0x0')]||![];this[_0x3870('0x1')]=_0x297722[_0x3870('0x1')]||'';this['state']=_0x3870('0x2');this[_0x3870('0x3')]=0x0;this['status']=_0x3870('0x2');this[_0x3870('0x4')]=_0x297722[_0x3870('0x4')]&&_0x297722[_0x3870('0x4')][_0x3870('0x5')](':')?_0x297722[_0x3870('0x4')]['split'](':')[0x0]:'';this['host']='';this[_0x3870('0x6')]='';this[_0x3870('0x7')]='';this[_0x3870('0x8')]='';this['refresh']='';this[_0x3870('0x9')]='unknown';this[_0x3870('0xa')]='';this[_0x3870('0xb')]='';this['defaultuser']=_0x297722[_0x3870('0xc')]||'';}module[_0x3870('0xd')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 9205405..4e0e466 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 _0x5b81=['mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x4a724f,_0x5b001a){var _0x35adab=function(_0x56298f){while(--_0x56298f){_0x4a724f['push'](_0x4a724f['shift']());}};_0x35adab(++_0x5b001a);}(_0x5b81,0x1de));var _0x15b8=function(_0x428a5f,_0x56c9cf){_0x428a5f=_0x428a5f-0x0;var _0x1a591b=_0x5b81[_0x428a5f];return _0x1a591b;};'use strict';function voiceExtension(_0x1f6acd){this['id']=_0x1f6acd['id']||0x0;this[_0x15b8('0x0')]=_0x1f6acd[_0x15b8('0x0')]||'';this['recordingFormat']=_0x1f6acd[_0x15b8('0x1')]||'none';this[_0x15b8('0x2')]=_0x1f6acd[_0x15b8('0x2')]||![];}module[_0x15b8('0x3')]=voiceExtension; \ No newline at end of file +var _0xc4e6=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x4bb257,_0x1a41a8){var _0x37da70=function(_0x1133bb){while(--_0x1133bb){_0x4bb257['push'](_0x4bb257['shift']());}};_0x37da70(++_0x1a41a8);}(_0xc4e6,0x170));var _0x6c4e=function(_0xb99421,_0xaab133){_0xb99421=_0xb99421-0x0;var _0x4b3ec7=_0xc4e6[_0xb99421];return _0x4b3ec7;};'use strict';function voiceExtension(_0x558636){this['id']=_0x558636['id']||0x0;this[_0x6c4e('0x0')]=_0x558636[_0x6c4e('0x0')]||'';this[_0x6c4e('0x1')]=_0x558636[_0x6c4e('0x1')]||_0x6c4e('0x2');this['mandatoryDisposition']=_0x558636[_0x6c4e('0x3')]||![];}module[_0x6c4e('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 8bae6a0..f6d68aa 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 _0x0949=['outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','inuse','ringing','ringinuse','onhold','wav','wav49','name','monitor_format','type','inbound','talking','total','answered','sumDuration','sumHoldTime','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength'];(function(_0x3c8499,_0x1e052e){var _0x51d346=function(_0x311729){while(--_0x311729){_0x3c8499['push'](_0x3c8499['shift']());}};_0x51d346(++_0x1e052e);}(_0x0949,0xa3));var _0x9094=function(_0x1d98a3,_0x28e1b8){_0x1d98a3=_0x1d98a3-0x0;var _0x4b8246=_0x0949[_0x1d98a3];return _0x4b8246;};'use strict';var statusDesc=['unknown','not_inuse',_0x9094('0x0'),'busy','invalid','unavailable',_0x9094('0x1'),_0x9094('0x2'),_0x9094('0x3')];var monitorFormat={'wav':_0x9094('0x4'),'wav49':_0x9094('0x5'),'gsm':'gsm'};var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};function VoiceQueue(_0x3730cc){this['id']=_0x3730cc['id']||0x0;this['name']=_0x3730cc[_0x9094('0x6')]||'';this[_0x9094('0x7')]=_0x3730cc['monitor_format']||'';this[_0x9094('0x8')]=_0x3730cc[_0x9094('0x8')]||_0x9094('0x9');this['waiting']=0x0;this[_0x9094('0xa')]=0x0;this[_0x9094('0xb')]=0x0;this[_0x9094('0xc')]=0x0;this[_0x9094('0xd')]=0x0;this[_0x9094('0xe')]=0x0;this['sumBillable']=0x0;this[_0x9094('0xf')]=0x0;this[_0x9094('0x10')]=0x0;this[_0x9094('0x11')]=0x0;this[_0x9094('0x12')]=0x0;this[_0x9094('0x13')]=_0x3730cc[_0x9094('0x13')]||![];this[_0x9094('0x14')]=_0x3730cc[_0x9094('0x14')]||0xa;this['autopause']=_0x3730cc['autopause']||'no';this[_0x9094('0x15')]=!![];this[_0x9094('0x16')]='';this[_0x9094('0x17')]=0x0;this[_0x9094('0x18')]=0x0;this[_0x9094('0x19')]=_0x3730cc[_0x9094('0x19')]||null;this[_0x9094('0x1a')]=_0x3730cc[_0x9094('0x1a')]?_0x3730cc[_0x9094('0x1a')]:null;this[_0x9094('0x1b')]=_0x3730cc[_0x9094('0x1b')];this['dialMethod']=_0x3730cc[_0x9094('0x1c')]||_0x9094('0x1d');this[_0x9094('0x1e')]=_0x3730cc[_0x9094('0x1e')]||0x0;this[_0x9094('0x1f')]=_0x3730cc['dialLimitQueue']||0x0;this[_0x9094('0x20')]=_0x3730cc[_0x9094('0x20')]||0x1;this[_0x9094('0x21')]=_0x3730cc['dialPredictiveOptimization']||_0x9094('0x22');this[_0x9094('0x23')]=_0x3730cc[_0x9094('0x23')]||0.03;this[_0x9094('0x24')]=_0x3730cc[_0x9094('0x24')]||0x258;this[_0x9094('0x25')]=_0x3730cc[_0x9094('0x25')]||_0x9094('0x26');this[_0x9094('0x27')]=_0x3730cc[_0x9094('0x27')]||_0x9094('0x26');this['dialOriginateTimeout']=_0x3730cc[_0x9094('0x28')]||0x1e;this[_0x9094('0x29')]=_0x3730cc[_0x9094('0x29')]||_0x9094('0x2a');this[_0x9094('0x2b')]=_0x3730cc[_0x9094('0x2b')]||0x3;this[_0x9094('0x2c')]=_0x3730cc['dialQueueProject']||undefined;this[_0x9094('0x2d')]=_0x3730cc['dialCongestionMaxRetry']||0x3;this[_0x9094('0x2e')]=_0x3730cc[_0x9094('0x2e')]||0x96;this[_0x9094('0x2f')]=_0x3730cc[_0x9094('0x2f')]||0x3;this['dialBusyRetryFrequency']=_0x3730cc[_0x9094('0x30')]||0x96;this[_0x9094('0x31')]=_0x3730cc[_0x9094('0x31')]||0x3;this[_0x9094('0x32')]=_0x3730cc['dialNoAnswerRetryFrequency']||0x96;this[_0x9094('0x33')]=_0x3730cc[_0x9094('0x33')]||0x3;this[_0x9094('0x34')]=_0x3730cc[_0x9094('0x34')]||0x96;this[_0x9094('0x35')]=_0x3730cc[_0x9094('0x35')]||0x3;this[_0x9094('0x36')]=_0x3730cc[_0x9094('0x36')]||0x96;this[_0x9094('0x37')]=_0x3730cc['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x3730cc[_0x9094('0x38')]||0x96;this[_0x9094('0x39')]=_0x3730cc[_0x9094('0x39')]||0x3;this[_0x9094('0x3a')]=_0x3730cc['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x3730cc['dialAgentRejectMaxRetry']||0x3;this[_0x9094('0x3b')]=_0x3730cc[_0x9094('0x3b')]||0x96;this['dialGlobalMaxRetry']=_0x3730cc[_0x9094('0x3c')]||0x4;this[_0x9094('0x3d')]=_0x3730cc[_0x9094('0x3d')]?_0x3730cc[_0x9094('0x3d')]:undefined;this[_0x9094('0x3e')]=_0x3730cc[_0x9094('0x3e')]?_0x3730cc['TrunkBackup']:undefined;this[_0x9094('0x3f')]=_0x3730cc[_0x9094('0x3f')]||undefined;this[_0x9094('0x40')]=_0x3730cc[_0x9094('0x40')]?_0x3730cc['Interval']:undefined;this[_0x9094('0x41')]=_0x3730cc[_0x9094('0x41')]||_0x9094('0x42');this[_0x9094('0x43')]=_0x3730cc['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x9094('0x44')]=_0x3730cc[_0x9094('0x44')]||undefined;this[_0x9094('0x45')]=strategy[_0x3730cc['strategy']]||_0x9094('0x46');this[_0x9094('0x47')]=!![];this[_0x9094('0x48')]=_0x3730cc[_0x9094('0x48')]||![];this['dialAMDInitialSilence']=_0x3730cc['dialAMDInitialSilence'];this[_0x9094('0x49')]=_0x3730cc[_0x9094('0x49')];this[_0x9094('0x4a')]=_0x3730cc[_0x9094('0x4a')];this[_0x9094('0x4b')]=_0x3730cc[_0x9094('0x4b')];this['dialAMDMinWordLength']=_0x3730cc[_0x9094('0x4c')];this[_0x9094('0x4d')]=_0x3730cc['dialAMDBetweenWordsSilence'];this[_0x9094('0x4e')]=_0x3730cc[_0x9094('0x4e')];this['dialAMDSilenceThreshold']=_0x3730cc[_0x9094('0x4f')];this[_0x9094('0x50')]=_0x3730cc[_0x9094('0x50')];this[_0x9094('0x51')]=0x0;this[_0x9094('0x52')]=0x0;this[_0x9094('0x53')]=_0x3730cc[_0x9094('0x53')];this[_0x9094('0x54')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x9094('0x55')]=0x0;this[_0x9094('0x56')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x9094('0x57')]=0x0;this[_0x9094('0x58')]=0x0;this[_0x9094('0x59')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x9094('0x5a')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x9094('0x5b')]=0x0;this[_0x9094('0x5c')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x9094('0x5d')]=undefined;this[_0x9094('0x5e')]=undefined;this[_0x9094('0x5f')]=undefined;this[_0x9094('0x60')]=1.05;this[_0x9094('0x61')]=0x0;this[_0x9094('0x62')]=0x0;this[_0x9094('0x63')]=0x0;this[_0x9094('0x64')]=0x0;this[_0x9094('0x65')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x9094('0x66')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x9094('0x67')]=_0x3730cc[_0x9094('0x68')]||0x14;this[_0x9094('0x69')]=_0x3730cc[_0x9094('0x68')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x9094('0x6a')]=0x0;this[_0x9094('0x6b')]=0x1;this[_0x9094('0x6c')]=0x0;this[_0x9094('0x6d')]=0x0;this[_0x9094('0x6e')]=0x0;this[_0x9094('0x6f')]=0x0;this['dialRecallMeTimeout']=_0x3730cc[_0x9094('0x70')]||0x1e;this['dialRecallInQueue']=_0x3730cc[_0x9094('0x71')]||![];this[_0x9094('0x72')]=!!_0x3730cc[_0x9094('0x72')]||![];this['dialPreviewRecallmeReminder']=!!_0x3730cc[_0x9094('0x73')]||![];this[_0x9094('0x74')]=_0x3730cc[_0x9094('0x74')]||undefined;this['dialAgiAfterHangupClient']=_0x3730cc[_0x9094('0x75')]||![];this[_0x9094('0x76')]=_0x3730cc[_0x9094('0x76')]||![];this[_0x9094('0x7')]=monitorFormat[_0x3730cc[_0x9094('0x7')]]?monitorFormat[_0x3730cc[_0x9094('0x7')]]:undefined;this[_0x9094('0x77')]=_0x3730cc[_0x9094('0x77')]||![];this[_0x9094('0x78')]=_0x3730cc[_0x9094('0x78')]?_0x3730cc[_0x9094('0x78')]:undefined;}module[_0x9094('0x79')]=VoiceQueue; \ No newline at end of file +var _0xf292=['talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','available','acw','acwTimeout','autopause','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','monitor_format','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','gsm','rrmemory','roundrobin','name','type','waiting'];(function(_0x1293dd,_0xf28d6d){var _0x12faa8=function(_0x38635d){while(--_0x38635d){_0x1293dd['push'](_0x1293dd['shift']());}};_0x12faa8(++_0xf28d6d);}(_0xf292,0x70));var _0x2f29=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0xf292[_0x307d86];return _0x361745;};'use strict';var statusDesc=[_0x2f29('0x0'),_0x2f29('0x1'),_0x2f29('0x2'),_0x2f29('0x3'),_0x2f29('0x4'),_0x2f29('0x5'),_0x2f29('0x6'),_0x2f29('0x7'),_0x2f29('0x8')];var monitorFormat={'wav':_0x2f29('0x9'),'wav49':'wav49','gsm':_0x2f29('0xa')};var strategy={'rrmemory':_0x2f29('0xb'),'roundrobin':_0x2f29('0xc')};function VoiceQueue(_0x3f77f9){this['id']=_0x3f77f9['id']||0x0;this['name']=_0x3f77f9[_0x2f29('0xd')]||'';this['monitor_format']=_0x3f77f9['monitor_format']||'';this[_0x2f29('0xe')]=_0x3f77f9[_0x2f29('0xe')]||'inbound';this[_0x2f29('0xf')]=0x0;this[_0x2f29('0x10')]=0x0;this[_0x2f29('0x11')]=0x0;this[_0x2f29('0x12')]=0x0;this[_0x2f29('0x13')]=0x0;this[_0x2f29('0x14')]=0x0;this[_0x2f29('0x15')]=0x0;this[_0x2f29('0x16')]=0x0;this['abandoned']=0x0;this['loggedIn']=0x0;this[_0x2f29('0x17')]=0x0;this['acw']=_0x3f77f9[_0x2f29('0x18')]||![];this[_0x2f29('0x19')]=_0x3f77f9[_0x2f29('0x19')]||0xa;this[_0x2f29('0x1a')]=_0x3f77f9[_0x2f29('0x1a')]||'no';this['sendMessageOneNotActive']=!![];this[_0x2f29('0x1b')]='';this[_0x2f29('0x1c')]=0x0;this['temp']=0x0;this[_0x2f29('0x1d')]=_0x3f77f9[_0x2f29('0x1d')]||null;this['dialGlobalInterval']=_0x3f77f9[_0x2f29('0x1e')]?_0x3f77f9['dialGlobalInterval']:null;this['dialActive']=_0x3f77f9[_0x2f29('0x1f')];this[_0x2f29('0x20')]=_0x3f77f9[_0x2f29('0x20')]||'progressive';this[_0x2f29('0x21')]=_0x3f77f9[_0x2f29('0x21')]||0x0;this[_0x2f29('0x22')]=_0x3f77f9['dialLimitQueue']||0x0;this[_0x2f29('0x23')]=_0x3f77f9['dialPowerLevel']||0x1;this[_0x2f29('0x24')]=_0x3f77f9[_0x2f29('0x24')]||'dropRate';this[_0x2f29('0x25')]=_0x3f77f9[_0x2f29('0x25')]||0.03;this[_0x2f29('0x26')]=_0x3f77f9[_0x2f29('0x26')]||0x258;this['dialOriginateCallerIdName']=_0x3f77f9['dialOriginateCallerIdName']||_0x2f29('0x27');this[_0x2f29('0x28')]=_0x3f77f9[_0x2f29('0x28')]||_0x2f29('0x27');this[_0x2f29('0x29')]=_0x3f77f9['dialOriginateTimeout']||0x1e;this[_0x2f29('0x2a')]=_0x3f77f9[_0x2f29('0x2a')]||_0x2f29('0x2b');this[_0x2f29('0x2c')]=_0x3f77f9[_0x2f29('0x2c')]||0x3;this[_0x2f29('0x2d')]=_0x3f77f9[_0x2f29('0x2d')]||undefined;this[_0x2f29('0x2e')]=_0x3f77f9[_0x2f29('0x2e')]||0x3;this[_0x2f29('0x2f')]=_0x3f77f9[_0x2f29('0x2f')]||0x96;this[_0x2f29('0x30')]=_0x3f77f9[_0x2f29('0x30')]||0x3;this['dialBusyRetryFrequency']=_0x3f77f9[_0x2f29('0x31')]||0x96;this[_0x2f29('0x32')]=_0x3f77f9[_0x2f29('0x32')]||0x3;this[_0x2f29('0x33')]=_0x3f77f9[_0x2f29('0x33')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x3f77f9[_0x2f29('0x34')]||0x3;this[_0x2f29('0x35')]=_0x3f77f9[_0x2f29('0x35')]||0x96;this[_0x2f29('0x36')]=_0x3f77f9[_0x2f29('0x36')]||0x3;this[_0x2f29('0x37')]=_0x3f77f9['dialDropRetryFrequency']||0x96;this[_0x2f29('0x38')]=_0x3f77f9[_0x2f29('0x38')]||0x3;this[_0x2f29('0x39')]=_0x3f77f9[_0x2f29('0x39')]||0x96;this[_0x2f29('0x3a')]=_0x3f77f9[_0x2f29('0x3a')]||0x3;this[_0x2f29('0x3b')]=_0x3f77f9[_0x2f29('0x3b')]||0x96;this[_0x2f29('0x3c')]=_0x3f77f9[_0x2f29('0x3c')]||0x3;this[_0x2f29('0x3d')]=_0x3f77f9[_0x2f29('0x3d')]||0x96;this[_0x2f29('0x3e')]=_0x3f77f9[_0x2f29('0x3e')]||0x4;this['Trunk']=_0x3f77f9[_0x2f29('0x3f')]?_0x3f77f9[_0x2f29('0x3f')]:undefined;this[_0x2f29('0x40')]=_0x3f77f9['TrunkBackup']?_0x3f77f9[_0x2f29('0x40')]:undefined;this['dialPrefix']=_0x3f77f9[_0x2f29('0x41')]||undefined;this[_0x2f29('0x42')]=_0x3f77f9[_0x2f29('0x42')]?_0x3f77f9[_0x2f29('0x42')]:undefined;this[_0x2f29('0x43')]=_0x3f77f9[_0x2f29('0x43')]||_0x2f29('0x44');this['dialRandomLastDigitCallerIdNumber']=_0x3f77f9[_0x2f29('0x45')]||undefined;this['dialCutDigit']=_0x3f77f9[_0x2f29('0x46')]||undefined;this[_0x2f29('0x47')]=strategy[_0x3f77f9[_0x2f29('0x47')]]||'rrmemory';this[_0x2f29('0x48')]=!![];this[_0x2f29('0x49')]=_0x3f77f9['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x3f77f9[_0x2f29('0x4a')];this[_0x2f29('0x4b')]=_0x3f77f9['dialAMDGreeting'];this[_0x2f29('0x4c')]=_0x3f77f9[_0x2f29('0x4c')];this[_0x2f29('0x4d')]=_0x3f77f9['dialAMDTotalAnalysisTime'];this[_0x2f29('0x4e')]=_0x3f77f9[_0x2f29('0x4e')];this[_0x2f29('0x4f')]=_0x3f77f9['dialAMDBetweenWordsSilence'];this[_0x2f29('0x50')]=_0x3f77f9[_0x2f29('0x50')];this[_0x2f29('0x51')]=_0x3f77f9[_0x2f29('0x51')];this[_0x2f29('0x52')]=_0x3f77f9[_0x2f29('0x52')];this[_0x2f29('0x53')]=0x0;this[_0x2f29('0x54')]=0x0;this[_0x2f29('0x55')]=_0x3f77f9[_0x2f29('0x55')];this[_0x2f29('0x56')]=0x0;this[_0x2f29('0x57')]=0x0;this[_0x2f29('0x58')]=0x0;this[_0x2f29('0x59')]=0x0;this[_0x2f29('0x5a')]=0x0;this[_0x2f29('0x5b')]=0x0;this[_0x2f29('0x5c')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x2f29('0x5d')]=0x0;this[_0x2f29('0x5e')]=0x0;this[_0x2f29('0x5f')]=0x0;this[_0x2f29('0x60')]=0x0;this[_0x2f29('0x61')]=0x0;this[_0x2f29('0x62')]=0x0;this[_0x2f29('0x63')]=undefined;this[_0x2f29('0x64')]=undefined;this[_0x2f29('0x65')]=undefined;this[_0x2f29('0x66')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x2f29('0x67')]=0x0;this[_0x2f29('0x68')]=0x0;this[_0x2f29('0x69')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x2f29('0x6a')]=0x0;this[_0x2f29('0x6b')]=0x0;this[_0x2f29('0x6c')]=_0x3f77f9[_0x2f29('0x6d')]||0x14;this[_0x2f29('0x6e')]=_0x3f77f9[_0x2f29('0x6d')]||0xa;this[_0x2f29('0x6f')]=0x0;this[_0x2f29('0x70')]=0x0;this[_0x2f29('0x71')]=0x1;this[_0x2f29('0x72')]=0x0;this[_0x2f29('0x73')]=0x0;this[_0x2f29('0x74')]=0x0;this['erlangBusyFactor']=0x0;this[_0x2f29('0x75')]=_0x3f77f9[_0x2f29('0x75')]||0x1e;this[_0x2f29('0x76')]=_0x3f77f9[_0x2f29('0x76')]||![];this[_0x2f29('0x77')]=!!_0x3f77f9['dialPreviewAutoRecallMe']||![];this[_0x2f29('0x78')]=!!_0x3f77f9[_0x2f29('0x78')]||![];this[_0x2f29('0x79')]=_0x3f77f9[_0x2f29('0x79')]||undefined;this['dialAgiAfterHangupClient']=_0x3f77f9[_0x2f29('0x7a')]||![];this[_0x2f29('0x7b')]=_0x3f77f9[_0x2f29('0x7b')]||![];this[_0x2f29('0x7c')]=monitorFormat[_0x3f77f9['monitor_format']]?monitorFormat[_0x3f77f9[_0x2f29('0x7c')]]:undefined;this['mandatoryDisposition']=_0x3f77f9[_0x2f29('0x7d')]||![];this[_0x2f29('0x7e')]=_0x3f77f9[_0x2f29('0x7e')]?_0x3f77f9[_0x2f29('0x7e')]:undefined;}module[_0x2f29('0x7f')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 6681ad1..ba0aee0 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 _0xf156=['username','accessKey','remoteUri','serverUrl','Configurations','name'];(function(_0x38a660,_0x3a6593){var _0x5a601c=function(_0x2190a8){while(--_0x2190a8){_0x38a660['push'](_0x38a660['shift']());}};_0x5a601c(++_0x3a6593);}(_0xf156,0x137));var _0x6f15=function(_0x32808f,_0x248954){_0x32808f=_0x32808f-0x0;var _0x158091=_0xf156[_0x32808f];return _0x158091;};'use strict';function VtigerAccount(_0x48eacf){this['id']=_0x48eacf['id']||0x0;this[_0x6f15('0x0')]=_0x48eacf[_0x6f15('0x0')]||'';this['username']=_0x48eacf[_0x6f15('0x1')]||'';this['accessKey']=_0x48eacf[_0x6f15('0x2')]||'';this[_0x6f15('0x3')]=_0x48eacf[_0x6f15('0x3')]||'';this[_0x6f15('0x4')]=_0x48eacf[_0x6f15('0x4')]||'';this[_0x6f15('0x5')]=_0x48eacf['Configurations']||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x1c3d=['exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x5b345b,_0x17fbfc){var _0x136545=function(_0x3b6d7f){while(--_0x3b6d7f){_0x5b345b['push'](_0x5b345b['shift']());}};_0x136545(++_0x17fbfc);}(_0x1c3d,0xdf));var _0xd1c3=function(_0x503854,_0x1a8eb0){_0x503854=_0x503854-0x0;var _0xe2c333=_0x1c3d[_0x503854];return _0xe2c333;};'use strict';function VtigerAccount(_0x63d51d){this['id']=_0x63d51d['id']||0x0;this[_0xd1c3('0x0')]=_0x63d51d[_0xd1c3('0x0')]||'';this[_0xd1c3('0x1')]=_0x63d51d[_0xd1c3('0x1')]||'';this[_0xd1c3('0x2')]=_0x63d51d['accessKey']||'';this[_0xd1c3('0x3')]=_0x63d51d['remoteUri']||'';this['serverUrl']=_0x63d51d[_0xd1c3('0x4')]||'';this['Configurations']=_0x63d51d['Configurations']||{};}module[_0xd1c3('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index e054784..76cc864 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 _0xec12=['username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','name'];(function(_0x45fc6a,_0x166adb){var _0x14bcfd=function(_0x3ba718){while(--_0x3ba718){_0x45fc6a['push'](_0x45fc6a['shift']());}};_0x14bcfd(++_0x166adb);}(_0xec12,0x13f));var _0x2ec1=function(_0x16cf52,_0xb9d255){_0x16cf52=_0x16cf52-0x0;var _0x343e1a=_0xec12[_0x16cf52];return _0x343e1a;};'use strict';function ZendeskAccount(_0x4b1cef){this['id']=_0x4b1cef['id']||0x0;this['name']=_0x4b1cef[_0x2ec1('0x0')]||'';this[_0x2ec1('0x1')]=_0x4b1cef[_0x2ec1('0x1')]||'';this[_0x2ec1('0x2')]=_0x4b1cef['password']||'';this[_0x2ec1('0x3')]=_0x4b1cef['token']||'';this[_0x2ec1('0x4')]=_0x4b1cef[_0x2ec1('0x4')]||'';this['authType']=_0x4b1cef[_0x2ec1('0x5')]||'';this[_0x2ec1('0x6')]=_0x4b1cef[_0x2ec1('0x6')]||_0x2ec1('0x7');this[_0x2ec1('0x8')]=_0x4b1cef[_0x2ec1('0x8')]||'';this[_0x2ec1('0x9')]=_0x4b1cef[_0x2ec1('0x9')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0xff37=['exports','name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations'];(function(_0x585b82,_0x14ac15){var _0x2cb262=function(_0x2fd954){while(--_0x2fd954){_0x585b82['push'](_0x585b82['shift']());}};_0x2cb262(++_0x14ac15);}(_0xff37,0x135));var _0x7ff3=function(_0x3a12e0,_0x154cda){_0x3a12e0=_0x3a12e0-0x0;var _0x2fe645=_0xff37[_0x3a12e0];return _0x2fe645;};'use strict';function ZendeskAccount(_0xe2c6b3){this['id']=_0xe2c6b3['id']||0x0;this[_0x7ff3('0x0')]=_0xe2c6b3[_0x7ff3('0x0')]||'';this[_0x7ff3('0x1')]=_0xe2c6b3[_0x7ff3('0x1')]||'';this[_0x7ff3('0x2')]=_0xe2c6b3[_0x7ff3('0x2')]||'';this[_0x7ff3('0x3')]=_0xe2c6b3[_0x7ff3('0x3')]||'';this[_0x7ff3('0x4')]=_0xe2c6b3[_0x7ff3('0x4')]||'';this['authType']=_0xe2c6b3[_0x7ff3('0x5')]||'';this['type']=_0xe2c6b3[_0x7ff3('0x6')]||_0x7ff3('0x7');this[_0x7ff3('0x8')]=_0xe2c6b3[_0x7ff3('0x8')]||'';this[_0x7ff3('0x9')]=_0xe2c6b3['Configurations']||{};}module[_0x7ff3('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 3c04e5a..ae1229d 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 _0x8f26=['refreshToken','Configurations','exports','name','description','host','zone','clientId','serverUrl','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8f26,0x7b));var _0x68f2=function(_0x1aa910,_0x27f9fa){_0x1aa910=_0x1aa910-0x0;var _0x1518bb=_0x8f26[_0x1aa910];return _0x1518bb;};'use strict';function ZohoAccount(_0x4cf846){this['id']=_0x4cf846['id']||0x0;this[_0x68f2('0x0')]=_0x4cf846[_0x68f2('0x0')]||'';this['description']=_0x4cf846[_0x68f2('0x1')]||'';this[_0x68f2('0x2')]=_0x4cf846[_0x68f2('0x2')]||'';this[_0x68f2('0x3')]=_0x4cf846[_0x68f2('0x3')]||'';this[_0x68f2('0x4')]=_0x4cf846[_0x68f2('0x4')]||'';this['clientSecret']=_0x4cf846['clientSecret']||'';this[_0x68f2('0x5')]=_0x4cf846['serverUrl']||'';this[_0x68f2('0x6')]=_0x4cf846[_0x68f2('0x6')]||'';this[_0x68f2('0x7')]=_0x4cf846[_0x68f2('0x7')]||'';this[_0x68f2('0x8')]=_0x4cf846['Configurations']||{};}module[_0x68f2('0x9')]=ZohoAccount; \ No newline at end of file +var _0x8fbc=['serverUrl','code','refreshToken','Configurations','exports','name','host','zone','clientSecret'];(function(_0x3efe87,_0x35ad48){var _0x56a4cc=function(_0x47869e){while(--_0x47869e){_0x3efe87['push'](_0x3efe87['shift']());}};_0x56a4cc(++_0x35ad48);}(_0x8fbc,0x16d));var _0xc8fb=function(_0x2f0e61,_0x4213ba){_0x2f0e61=_0x2f0e61-0x0;var _0x316146=_0x8fbc[_0x2f0e61];return _0x316146;};'use strict';function ZohoAccount(_0x24e1b4){this['id']=_0x24e1b4['id']||0x0;this['name']=_0x24e1b4[_0xc8fb('0x0')]||'';this['description']=_0x24e1b4['description']||'';this['host']=_0x24e1b4[_0xc8fb('0x1')]||'';this[_0xc8fb('0x2')]=_0x24e1b4['zone']||'';this['clientId']=_0x24e1b4['clientId']||'';this[_0xc8fb('0x3')]=_0x24e1b4[_0xc8fb('0x3')]||'';this[_0xc8fb('0x4')]=_0x24e1b4['serverUrl']||'';this[_0xc8fb('0x5')]=_0x24e1b4['code']||'';this[_0xc8fb('0x6')]=_0x24e1b4['refreshToken']||'';this[_0xc8fb('0x7')]=_0x24e1b4[_0xc8fb('0x7')]||{};}module[_0xc8fb('0x8')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 2bcef99..3c6b705 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 _0xee4b=['scheduledat','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','format','calleridname','phone','Contact','firstName','lastName','calleridnum'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xee4b,0x177));var _0xbee4=function(_0x1857c6,_0x48840c){_0x1857c6=_0x1857c6-0x0;var _0x51011c=_0xee4b[_0x1857c6];return _0x51011c;};'use strict';var util=require(_0xbee4('0x0'));var _=require(_0xbee4('0x1'));var moment=require(_0xbee4('0x2'));function checkNameSurname(_0x426a03,_0x1ce324,_0x32e90a){var _0x207320='';if(!_[_0xbee4('0x3')](_0x1ce324)&&_0xbee4('0x4')===typeof _0x1ce324){_0x207320+=_0x1ce324;}if(!_[_0xbee4('0x3')](_0x32e90a)&&'string'===typeof _0x32e90a){_0x207320+='\x20'+_0x32e90a;}if(_0x207320!==''){return _0x207320;}return _0x426a03;}function Action(_0x26b7ff,_0x482916,_0x8253ea,_0x70c3c,_0x1d7c24){this[_0xbee4('0x5')]=_0x8253ea||undefined;this[_0xbee4('0x6')]=_0x26b7ff['id'];this[_0xbee4('0x7')]=_0x482916[_0xbee4('0x8')];this[_0xbee4('0x9')]=_0x482916[_0xbee4('0x9')];this[_0xbee4('0xa')]='queue';this[_0xbee4('0xb')]=![];this[_0xbee4('0xc')]=_['isNil'](_0x26b7ff[_0xbee4('0xd')])?undefined:_0x26b7ff[_0xbee4('0xd')][_0xbee4('0x8')];this['channelAgent']=this['membername']?util[_0xbee4('0xe')]('SIP/%s',this[_0xbee4('0xc')]):_0x70c3c||undefined;this[_0xbee4('0xf')]=checkNameSurname(_0x26b7ff['Contact'][_0xbee4('0x10')],_0x26b7ff[_0xbee4('0x11')][_0xbee4('0x12')],_0x26b7ff[_0xbee4('0x11')][_0xbee4('0x13')]);this['active']=_0x26b7ff['active']||![];this[_0xbee4('0x14')]=_0x26b7ff[_0xbee4('0x11')][_0xbee4('0x10')];this[_0xbee4('0x15')]=_0x26b7ff[_0xbee4('0x15')];this['countbusyretry']=_0x26b7ff[_0xbee4('0x16')]||0x0;this[_0xbee4('0x17')]=_0x26b7ff['countcongestionretry']||0x0;this['countnoanswerretry']=_0x26b7ff['countnoanswerretry']||0x0;this[_0xbee4('0x18')]=(_0x26b7ff[_0xbee4('0x16')]||0x0)+(_0x26b7ff['countcongestionretry']||0x0)+(_0x26b7ff[_0xbee4('0x19')]||0x0)+(_0x26b7ff[_0xbee4('0x1a')]||0x0)+(_0x26b7ff[_0xbee4('0x1b')]||0x0)+(_0x26b7ff['countabandonedretry']||0x0)+(_0x26b7ff[_0xbee4('0x1c')]||0x0)+(_0x26b7ff[_0xbee4('0x1d')]||0x0);this['countnosuchnumberretry']=_0x26b7ff[_0xbee4('0x1a')]||0x0;this['countdropretry']=_0x26b7ff[_0xbee4('0x1b')]||0x0;this[_0xbee4('0x1e')]=_0x26b7ff[_0xbee4('0x1e')]||0x0;this[_0xbee4('0x1c')]=_0x26b7ff[_0xbee4('0x1c')]||0x0;this[_0xbee4('0x1d')]=_0x26b7ff[_0xbee4('0x1d')]||0x0;this[_0xbee4('0x1f')]=_0x26b7ff[_0xbee4('0x1f')];this[_0xbee4('0x20')]=_0x26b7ff[_0xbee4('0x20')];this['callbackat']=_0x26b7ff[_0xbee4('0x21')];this[_0xbee4('0x22')]=_0x26b7ff[_0xbee4('0x22')];this[_0xbee4('0x23')]=_0x26b7ff['ContactId'];this[_0xbee4('0x24')]=_0x26b7ff[_0xbee4('0x24')];this[_0xbee4('0x25')]=_['isNil'](_0x26b7ff[_0xbee4('0xd')])?_0x26b7ff[_0xbee4('0x25')]:_0x26b7ff[_0xbee4('0xd')]['id'];this['VoiceQueueId']=_0x26b7ff['VoiceQueueId'];this[_0xbee4('0x26')]='';this['originatecalleridname']='';}Action[_0xbee4('0x27')][_0xbee4('0x28')]=function(){return util[_0xbee4('0xe')](_0xbee4('0x29'),this[_0xbee4('0xf')],this[_0xbee4('0x2a')]);};module[_0xbee4('0x2b')]=Action; \ No newline at end of file +var _0xdeee=['countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','\x22%s\x22\x20<%s>','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','dialAnswer','membername','Agent','format','SIP/%s','calleridname','Contact','firstName','active','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x3b90ab,_0x174a22){var _0x206e92=function(_0x21fbd3){while(--_0x21fbd3){_0x3b90ab['push'](_0x3b90ab['shift']());}};_0x206e92(++_0x174a22);}(_0xdeee,0x14d));var _0xedee=function(_0x5c6a4e,_0x3634ee){_0x5c6a4e=_0x5c6a4e-0x0;var _0x63f694=_0xdeee[_0x5c6a4e];return _0x63f694;};'use strict';var util=require(_0xedee('0x0'));var _=require(_0xedee('0x1'));var moment=require(_0xedee('0x2'));function checkNameSurname(_0xfbee11,_0xcd88dc,_0x133d21){var _0xb15b1='';if(!_[_0xedee('0x3')](_0xcd88dc)&&_0xedee('0x4')===typeof _0xcd88dc){_0xb15b1+=_0xcd88dc;}if(!_[_0xedee('0x3')](_0x133d21)&&_0xedee('0x4')===typeof _0x133d21){_0xb15b1+='\x20'+_0x133d21;}if(_0xb15b1!==''){return _0xb15b1;}return _0xfbee11;}function Action(_0x25de08,_0x59cb14,_0x3b8477,_0x22b3ed,_0x4286e6){this[_0xedee('0x5')]=_0x3b8477||undefined;this[_0xedee('0x6')]=_0x25de08['id'];this[_0xedee('0x7')]=_0x59cb14[_0xedee('0x8')];this[_0xedee('0x9')]=_0x59cb14[_0xedee('0x9')];this['campaigntype']='queue';this[_0xedee('0xa')]=![];this[_0xedee('0xb')]=_[_0xedee('0x3')](_0x25de08['Agent'])?undefined:_0x25de08[_0xedee('0xc')]['name'];this['channelAgent']=this[_0xedee('0xb')]?util[_0xedee('0xd')](_0xedee('0xe'),this[_0xedee('0xb')]):_0x22b3ed||undefined;this[_0xedee('0xf')]=checkNameSurname(_0x25de08['Contact']['phone'],_0x25de08[_0xedee('0x10')][_0xedee('0x11')],_0x25de08[_0xedee('0x10')]['lastName']);this[_0xedee('0x12')]=_0x25de08[_0xedee('0x12')]||![];this['calleridnum']=_0x25de08[_0xedee('0x10')][_0xedee('0x13')];this['scheduledat']=_0x25de08[_0xedee('0x14')];this[_0xedee('0x15')]=_0x25de08[_0xedee('0x15')]||0x0;this[_0xedee('0x16')]=_0x25de08['countcongestionretry']||0x0;this[_0xedee('0x17')]=_0x25de08['countnoanswerretry']||0x0;this['countglobal']=(_0x25de08[_0xedee('0x15')]||0x0)+(_0x25de08[_0xedee('0x16')]||0x0)+(_0x25de08[_0xedee('0x17')]||0x0)+(_0x25de08[_0xedee('0x18')]||0x0)+(_0x25de08[_0xedee('0x19')]||0x0)+(_0x25de08[_0xedee('0x1a')]||0x0)+(_0x25de08[_0xedee('0x1b')]||0x0)+(_0x25de08['countagentrejectretry']||0x0);this[_0xedee('0x18')]=_0x25de08[_0xedee('0x18')]||0x0;this[_0xedee('0x19')]=_0x25de08[_0xedee('0x19')]||0x0;this[_0xedee('0x1a')]=_0x25de08[_0xedee('0x1a')]||0x0;this[_0xedee('0x1b')]=_0x25de08[_0xedee('0x1b')]||0x0;this[_0xedee('0x1c')]=_0x25de08[_0xedee('0x1c')]||0x0;this[_0xedee('0x1d')]=_0x25de08[_0xedee('0x1d')];this[_0xedee('0x1e')]=_0x25de08['callbackuniqueid'];this[_0xedee('0x1f')]=_0x25de08[_0xedee('0x1f')];this[_0xedee('0x20')]=_0x25de08[_0xedee('0x20')];this[_0xedee('0x21')]=_0x25de08[_0xedee('0x21')];this[_0xedee('0x22')]=_0x25de08[_0xedee('0x22')];this['UserId']=_['isNil'](_0x25de08[_0xedee('0xc')])?_0x25de08[_0xedee('0x23')]:_0x25de08['Agent']['id'];this[_0xedee('0x24')]=_0x25de08[_0xedee('0x24')];this[_0xedee('0x25')]='';this['originatecalleridname']='';}Action['prototype']['getCaller']=function(){return util['format'](_0xedee('0x26'),this['calleridname'],this['number']);};module[_0xedee('0x27')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 252c22b..78ee453 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 _0x00bb=['[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','CONGESTION','outboundCongestionCallsDay','countcongestionretry','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','uniqueid','object','isUndefined','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','Contact\x20is\x20undefined','isEmpty','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','Calling','catch','Call\x20failed','logBlacklist','SIP/%s','status','reachable','unmonitored','execRun','unlockContact','getContactPreview','recallme','validateContact','[Preview][checkIsBlackList]','Empty\x20Contact','ACTIVE','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','execCall','SIP/%s/%s%s','trim','dialCutDigit','substring','phone','getCallerId','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','extractCalleridName','originatecalleridnum','addVariables','merge','toLowerVariables','Action','variablesAction','[originated][increment]','OriginateError','actionid','lookAgent','logLookAgent','isFailure','response','custom:agentringnoanswer','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','destlinkedid','destuniqueid','variables','syncVarSet','filterKey','variable','addVariable','keys','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','util','lodash','bluebird','moment','ioredis','../../../config/environment','preview','../../../config/logger','./action','./util/util','redis','defaults','localhost','prototype','enqueue','tail','finally','voiceQueues','trunks','actions','agents','originateresponse','syncOriginateResponse','hangup','syncHangup','syncHangupRequest','syncDialEnd','bind','newexten','syncNewExten','varset','syncAttendedTransfer','blindtransfer','syncBlindTransfer','campaignsPreview','emit','outbound','name','strategy','available','loggedIn','sumBillable','sumDuration','talking','total','type','unmanaged','loggedInDb','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','message','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','stringify','md5','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','loopCampaigns','syncCampaigns','clockClearZombieChannels','hasOwnProperty','dialMethod','booked','clearZombieChannels','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','Queue','queue','originated:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','channel','updateOriginated','[clearZombieChannel]','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','isNil','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','then','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','dialRecallInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','isActive','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','createCustomerFinal','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','ANSWER','responsetime','answertime','pTalking','[syncHangup][talking][increment]','\x20Queue','pTalking:\x20','custom:agentconnect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime'];(function(_0x17e94e,_0x2f5ab6){var _0x15e14a=function(_0x40be27){while(--_0x40be27){_0x17e94e['push'](_0x17e94e['shift']());}};_0x15e14a(++_0x2f5ab6);}(_0x00bb,0x1d8));var _0xb00b=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x00bb[_0x37bd26];return _0xe83dc4;};'use strict';var util=require(_0xb00b('0x0'));var _=require(_0xb00b('0x1'));var BPromise=require(_0xb00b('0x2'));var uuid=require('uuid');var moment=require(_0xb00b('0x3'));var md5=require('md5');var Redis=require(_0xb00b('0x4'));var config=require(_0xb00b('0x5'));var logger=require('../../../config/logger')(_0xb00b('0x6'));var loggerAction=require(_0xb00b('0x7'))('actionPreview');var ami=require('../ami');var rpcDb=require('./rpcDb');var Action=require(_0xb00b('0x8'));var ut=require(_0xb00b('0x9'));config[_0xb00b('0xa')]=_[_0xb00b('0xb')](config[_0xb00b('0xa')],{'host':_0xb00b('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xb00b('0xd')][_0xb00b('0xe')]=function(_0x5851d4){this[_0xb00b('0xf')]=this[_0xb00b('0xf')]?this['tail'][_0xb00b('0x10')](_0x5851d4):_0x5851d4();};function Preview(_0x5a63ed){this['sequence']=new Sequence();this['campaignsPreview']=_0x5a63ed[_0xb00b('0x11')];this[_0xb00b('0x12')]=_0x5a63ed[_0xb00b('0x12')];this[_0xb00b('0x13')]={};this[_0xb00b('0x14')]=_0x5a63ed[_0xb00b('0x14')];this['clockClearZombieChannels']=0x0;ami['on'](_0xb00b('0x15'),this[_0xb00b('0x16')]['bind'](this));ami['on'](_0xb00b('0x17'),this[_0xb00b('0x18')]['bind'](this));ami['on']('hanguprequest',this[_0xb00b('0x19')]['bind'](this));ami['on']('dialend',this[_0xb00b('0x1a')][_0xb00b('0x1b')](this));ami['on'](_0xb00b('0x1c'),this[_0xb00b('0x1d')]['bind'](this));ami['on'](_0xb00b('0x1e'),this['syncVarSet'][_0xb00b('0x1b')](this));ami['on']('attendedtransfer',this[_0xb00b('0x1f')]['bind'](this));ami['on'](_0xb00b('0x20'),this[_0xb00b('0x21')]['bind'](this));this['loopCampaigns'](this[_0xb00b('0x22')]);}function emit(_0x4a334b,_0x1344c4,_0x43da66){io['to'](_0x4a334b)[_0xb00b('0x23')](_0x1344c4,_0x43da66);}function emitCampaignPreview(_0x3501af){if(_0x3501af['type']===_0xb00b('0x24')){var _0x4df284={'id':_0x3501af['id'],'name':_0x3501af[_0xb00b('0x25')],'strategy':_0x3501af[_0xb00b('0x26')],'answered':_0x3501af['answered'],'available':_0x3501af[_0xb00b('0x27')],'loggedIn':_0x3501af[_0xb00b('0x28')],'pTalking':_0x3501af['pTalking'],'sumBillable':_0x3501af[_0xb00b('0x29')],'sumDuration':_0x3501af[_0xb00b('0x2a')],'sumHoldTime':_0x3501af['sumHoldTime']||0x0,'talking':_0x3501af[_0xb00b('0x2b')],'total':_0x3501af[_0xb00b('0x2c')],'type':_0x3501af[_0xb00b('0x2d')],'unmanaged':_0x3501af[_0xb00b('0x2e')],'abandoned':_0x3501af['abandoned'],'waiting':_0x3501af['waiting'],'loggedInDb':_0x3501af[_0xb00b('0x2f')],'dialActive':_0x3501af['dialActive'],'dialMethod':_0x3501af['dialMethod'],'dialOriginateCallerIdName':_0x3501af['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x3501af[_0xb00b('0x30')],'dialOriginateTimeout':_0x3501af[_0xb00b('0x31')],'dialPrefix':_0x3501af[_0xb00b('0x32')],'outboundAnswerAgiCallsDay':_0x3501af[_0xb00b('0x33')],'outboundAnswerCallsDay':_0x3501af[_0xb00b('0x34')],'outboundBlacklistCallsDay':_0x3501af[_0xb00b('0x35')],'outboundBusyCallsDay':_0x3501af[_0xb00b('0x36')],'outboundCongestionCallsDay':_0x3501af['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x3501af[_0xb00b('0x37')],'outboundDropCallsDayCallersExit':_0x3501af['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x3501af[_0xb00b('0x38')],'outboundNoAnswerCallsDay':_0x3501af[_0xb00b('0x39')],'outboundNoSuchCallsDay':_0x3501af[_0xb00b('0x3a')],'outboundOriginateFailureCallsDay':_0x3501af['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x3501af[_0xb00b('0x3b')],'outboundRejectCallsDay':_0x3501af[_0xb00b('0x3c')],'outboundUnknownCallsDay':_0x3501af[_0xb00b('0x3d')],'outboundAbandonedCallsDay':_0x3501af[_0xb00b('0x3e')],'predictiveIntervalAnsweredCalls':_0x3501af[_0xb00b('0x3f')],'predictiveIntervalAvgHoldtime':_0x3501af[_0xb00b('0x40')],'predictiveIntervalAvgTalktime':_0x3501af[_0xb00b('0x41')],'predictiveIntervalDroppedCallsCallersExit':_0x3501af[_0xb00b('0x42')],'predictiveIntervalDroppedCallsTimeout':_0x3501af[_0xb00b('0x43')],'predictiveIntervalErlangCalls':_0x3501af['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x3501af[_0xb00b('0x44')],'predictiveIntervalHitRate':_0x3501af[_0xb00b('0x45')],'predictiveIntervalMultiplicativeFactor':_0x3501af['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x3501af[_0xb00b('0x46')],'predictiveIntervalAvailable':_0x3501af[_0xb00b('0x47')],'predictiveIntervalTotalCalls':_0x3501af['predictiveIntervalTotalCalls'],'message':_0x3501af[_0xb00b('0x48')],'originated':_0x3501af['originated'],'erlangCalls':_0x3501af[_0xb00b('0x49')],'erlangCallToSecond':_0x3501af[_0xb00b('0x4a')],'erlangAbandonmentRate':_0x3501af[_0xb00b('0x4b')],'erlangBusyFactor':_0x3501af[_0xb00b('0x4c')],'startPredictive':_0x3501af[_0xb00b('0x4d')],'startProgressive':_0x3501af[_0xb00b('0x4e')]};if(_0x3501af[_0xb00b('0x4f')]){_0x4df284['Trunk']={'id':_0x3501af['Trunk']['id'],'name':_0x3501af['Trunk'][_0xb00b('0x25')],'active':_0x3501af[_0xb00b('0x4f')][_0xb00b('0x50')],'callerid':_0x3501af[_0xb00b('0x4f')]['callerid']};}if(_0x3501af[_0xb00b('0x51')]){_0x4df284[_0xb00b('0x51')]={'id':_0x3501af[_0xb00b('0x51')]['id'],'name':_0x3501af[_0xb00b('0x51')][_0xb00b('0x25')]};}var _0x39da49=md5(JSON[_0xb00b('0x52')](_0x4df284));if(_0x3501af[_0xb00b('0x53')]!==_0x39da49){_0x3501af['md5']=_0x39da49;emit(util['format'](_0xb00b('0x54'),_0x4df284['name']),_0xb00b('0x55'),_0x4df284);}}}function emitVoiceQueueChannelRemove(_0x1c5400){logger[_0xb00b('0x56')](_0xb00b('0x57'),JSON[_0xb00b('0x52')](_0x1c5400));emit(util[_0xb00b('0x58')](_0xb00b('0x54'),_0x1c5400['name']),_0xb00b('0x59'),_0x1c5400);io[_0xb00b('0x23')](_0xb00b('0x5a'),_0x1c5400);}function notSendMessagesQueue(_0xd9c03f){if(_0xd9c03f[_0xb00b('0x5b')]){if(_0xd9c03f[_0xb00b('0x5c')]===0x0&&_0xd9c03f['pTalking']===0x0){_0xd9c03f[_0xb00b('0x5b')]=![];_0xd9c03f[_0xb00b('0x27')]=0x0;_0xd9c03f['paused']=0x0;_0xd9c03f[_0xb00b('0x48')]=_0xb00b('0x5d');ut[_0xb00b('0x5e')](_0xb00b('0x5f'),_0xd9c03f[_0xb00b('0x25')]+'\x20is\x20not\x20active');}else{_0xd9c03f[_0xb00b('0x48')]=_0xb00b('0x60');ut[_0xb00b('0x5e')](_0xb00b('0x5f'),_0xd9c03f['name']+'\x20is\x20disactive');}emitCampaignPreview(_0xd9c03f);}}Preview[_0xb00b('0xd')][_0xb00b('0x61')]=function(){var _0x10a348=this;setInterval(function(){_0x10a348[_0xb00b('0x62')]();},0x7cf);};Preview[_0xb00b('0xd')][_0xb00b('0x62')]=function(){var _0x275664=this['campaignsPreview'];this[_0xb00b('0x63')]+=0x1;for(var _0x3b72c4 in _0x275664){if(_0x275664[_0xb00b('0x64')](_0x3b72c4)&&(_0x275664[_0x3b72c4][_0xb00b('0x65')]===_0xb00b('0x6')||_0x275664[_0x3b72c4][_0xb00b('0x65')]===_0xb00b('0x66'))&&_0x275664[_0x3b72c4][_0xb00b('0x2d')]===_0xb00b('0x24')){if(this[_0xb00b('0x63')]>0x7){this[_0xb00b('0x63')]=0x0;this[_0xb00b('0x67')]();}}if(_0x275664['hasOwnProperty'](_0x3b72c4)&&_0x275664[_0x3b72c4][_0xb00b('0x65')]===_0xb00b('0x6')&&_0x275664[_0x3b72c4][_0xb00b('0x2d')]===_0xb00b('0x24')){if(_0x275664[_0x3b72c4][_0xb00b('0x68')]){this[_0xb00b('0x69')](_0x275664[_0x3b72c4]);if(_0x275664[_0x3b72c4][_0xb00b('0x6a')])this[_0xb00b('0x6b')](_0x275664[_0x3b72c4]);}else{notSendMessagesQueue(_0x275664[_0x3b72c4]);}}}};Preview[_0xb00b('0xd')][_0xb00b('0x6c')]=function(_0x1eec12){var _0x3b3031=this;this['sequence']['enqueue'](function(){if(!_['isNil'](_0x3b3031[_0xb00b('0x13')][_0x1eec12])){loggerAction[_0xb00b('0x56')]('[clearZombieChannels][talking]',_0x1eec12,_0xb00b('0x6d'),_0x3b3031[_0xb00b('0x13')][_0x1eec12][_0xb00b('0x6e')],_0xb00b('0x6f'),JSON['stringify'](_0x3b3031['campaignsPreview'][_0x3b3031[_0xb00b('0x13')][_0x1eec12][_0xb00b('0x6e')]]['originated']),'pTalking:\x20',JSON[_0xb00b('0x52')](_0x3b3031[_0xb00b('0x22')][_0x3b3031['actions'][_0x1eec12][_0xb00b('0x6e')]]['pTalking']),JSON['stringify'](_0x3b3031['actions'][_0x1eec12][_0xb00b('0x70')]),JSON['stringify'](_[_0xb00b('0x71')](_0x3b3031[_0xb00b('0x13')][_0x1eec12],[_0xb00b('0x72'),_0xb00b('0x73'),_0xb00b('0x74'),_0xb00b('0x75')])));return ami['Action']({'action':'status','channel':_0x3b3031[_0xb00b('0x13')][_0x1eec12][_0xb00b('0x76')]})['catch'](function(_0x114750){if(_0x114750[_0xb00b('0x48')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x3b3031[_0xb00b('0x13')][_0x1eec12]){ut[_0xb00b('0x77')](_0x3b3031[_0xb00b('0x22')][_0x3b3031['actions'][_0x1eec12]['queue']],_0xb00b('0x78'));if(_0x3b3031[_0xb00b('0x13')][_0x1eec12][_0xb00b('0x70')]===!![]){ut[_0xb00b('0x79')](_0x3b3031['campaignsPreview'][_0x3b3031[_0xb00b('0x13')][_0x1eec12][_0xb00b('0x6e')]],'[clearZombieChannel]');ut['loggerError'](_0xb00b('0x7a')+_0x1eec12,_0x3b3031['actions'][_0x1eec12][_0xb00b('0x6e')]);}ut[_0xb00b('0x7b')](_0xb00b('0x7c')+_0x1eec12,_0x3b3031[_0xb00b('0x13')][_0x1eec12][_0xb00b('0x6e')]);delete _0x3b3031[_0xb00b('0x13')][_0x1eec12];}},0x2328);}});}});};Preview['prototype'][_0xb00b('0x67')]=function(){var _0x51c9e3=this;loggerAction[_0xb00b('0x56')](_0xb00b('0x7d'),_[_0xb00b('0x7e')](this['actions']));for(var _0x248335 in this[_0xb00b('0x13')]){if(_0x51c9e3[_0xb00b('0x13')]['hasOwnProperty'](_0x248335)){_0x51c9e3[_0xb00b('0x6c')](_0x248335);}}};Preview[_0xb00b('0xd')][_0xb00b('0x6b')]=function(_0x385029){var _0x131848=this;rpcDb[_0xb00b('0x7f')](_0x385029['id'],ut[_0xb00b('0x80')](this[_0xb00b('0x14')]))['then'](function(_0x153551){if(!_[_0xb00b('0x81')](_0x153551)){for(var _0x1b4860=0x0;_0x1b4860<_0x153551['length'];_0x1b4860+=0x1){if(ut[_0xb00b('0x82')](_0x153551[_0x1b4860][_0xb00b('0x83')])<_0x385029[_0xb00b('0x84')]*0x3c){if(_0x153551[_0x1b4860][_0xb00b('0x85')]&&!_0x153551[_0x1b4860][_0xb00b('0x85')]['voicePause']){_0x131848[_0xb00b('0x86')](_0x153551[_0x1b4860]['id'])[_0xb00b('0x87')](ut[_0xb00b('0x88')](_0xb00b('0x89')))['catch'](ut[_0xb00b('0x88')](_0xb00b('0x89')));}else{rpcDb[_0xb00b('0x8a')](_0x153551[_0x1b4860]['id']);}}else{var _0x2d73bb=new Action(_0x153551[_0x1b4860],_0x385029);_0x2d73bb[_0xb00b('0x8b')]=moment()[_0xb00b('0x58')](_0xb00b('0x8c'));_0x385029['outboundReCallsDay']+=0x1;ut[_0xb00b('0x8d')](_0x2d73bb,0x17,'RecallInQueue');if(_0x385029[_0xb00b('0x8e')]){rpcDb['rescheduleContactInQueue'](ut[_0xb00b('0x8f')](_0x153551[_0x1b4860]));rpcDb['createCustomerHistory'](_0x2d73bb,_0xb00b('0x90'));}else{ut['logCustomer'](_0x2d73bb,0x16,_0xb00b('0x91'));rpcDb[_0xb00b('0x92')](_0x2d73bb,_0xb00b('0x93'));rpcDb['createCustomerFinal'](_0x2d73bb,'[HistoryRecallClose]');}}}}})['catch'](ut[_0xb00b('0x88')](_0xb00b('0x94')));};Preview[_0xb00b('0xd')]['setMessage']=function(_0x311f49){_0x311f49[_0xb00b('0x5b')]=!![];if(ut[_0xb00b('0x95')](_0x311f49[_0xb00b('0x28')])){_0x311f49[_0xb00b('0x48')]='AGENTS_NOT_LOGGED';}else if(!ut[_0xb00b('0x96')](_0x311f49[_0xb00b('0x68')])){_0x311f49['message']=_0xb00b('0x5d');}else if(!this[_0xb00b('0x97')](_0x311f49[_0xb00b('0x4f')])){if(!this['isTrunkReachable'](_0x311f49['TrunkBackup'])){_0x311f49[_0xb00b('0x48')]=_0xb00b('0x98');}else{_0x311f49[_0xb00b('0x48')]='ACTIVE';}}else{_0x311f49['message']='ACTIVE';}emitCampaignPreview(_0x311f49);};Preview['prototype'][_0xb00b('0x99')]=function(_0x4df7fa,_0x2434a0,_0x30c0a7){var _0x53dd22=this;var _0x7523d5=this[_0xb00b('0x13')][_0x2434a0];var _0x2d21ec=this[_0xb00b('0x22')][_0x7523d5[_0xb00b('0x6e')]];var _0x48a57e;if(_0x2d21ec){switch(_0x30c0a7){case'1':_0x2d21ec[_0xb00b('0x3a')]+=0x1;_0x7523d5[_0xb00b('0x9a')]+=0x1;_0x7523d5[_0xb00b('0x9b')]=ut[_0xb00b('0x9c')](_0x7523d5);ut[_0xb00b('0x8d')](_0x7523d5,0x0,_0xb00b('0x9d'));ami[_0xb00b('0x23')]('custom:agentnosuchnumber',ut[_0xb00b('0x9e')](_0x7523d5,_0xb00b('0x9f')));rpcDb[_0xb00b('0x92')](_0x7523d5,_0xb00b('0xa0'));if(ut[_0xb00b('0x9c')](_0x7523d5)>=_0x2d21ec[_0xb00b('0xa1')]){_0x48a57e=ut[_0xb00b('0xa2')](_0x7523d5,0xf,_0xb00b('0xa3'));rpcDb['createCustomerFinal'](_0x48a57e,_0xb00b('0xa4'));}else{if(_0x7523d5[_0xb00b('0x9a')]>=_0x2d21ec[_0xb00b('0xa5')]){rpcDb[_0xb00b('0xa6')](_0x7523d5,_0xb00b('0xa4'));}else{rpcDb[_0xb00b('0xa7')](ut[_0xb00b('0xa8')](_0x7523d5,_0xb00b('0x9a'),_0x2d21ec['dialNoSuchNumberRetryFrequency']),_0x7523d5[_0xb00b('0xa9')],_0x7523d5[_0xb00b('0xaa')]);}}delete this[_0xb00b('0x13')][_0x4df7fa[_0xb00b('0xab')]];break;case _0xb00b('0xac'):var _0x376adc=moment()[_0xb00b('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x7523d5[_0xb00b('0xad')]=_0x376adc;_0x7523d5[_0xb00b('0xae')]=_0x376adc;_0x7523d5[_0xb00b('0x70')]=!![];_0x2d21ec[_0xb00b('0xaf')]+=0x1;logger[_0xb00b('0x56')](_0xb00b('0xb0'),_0x7523d5['uniqueid'],_0xb00b('0xb1'),_0x2d21ec['name'],_0xb00b('0xb2'),_0x2d21ec['pTalking']);ami[_0xb00b('0x23')](_0xb00b('0xb3'),ut[_0xb00b('0x9e')](_0x7523d5,'connect',this['campaignsPreview'][_0x7523d5[_0xb00b('0x6e')]]));if(_0x2d21ec[_0xb00b('0xb4')]){ami[_0xb00b('0x23')](_0xb00b('0xb5'),ut[_0xb00b('0xb6')](_0x7523d5));}break;case'16':ami[_0xb00b('0x23')](_0xb00b('0xb7'),ut[_0xb00b('0x9e')](_0x7523d5,_0xb00b('0xb8'),this[_0xb00b('0x22')][_0x7523d5[_0xb00b('0x6e')]]));emitVoiceQueueChannelRemove(ut[_0xb00b('0x9e')](_0x7523d5,_0xb00b('0xb8')));_0x2d21ec[_0xb00b('0x34')]+=0x1;_0x2d21ec['total']+=0x1;_0x2d21ec['answered']+=0x1;ut[_0xb00b('0x79')](_0x2d21ec,_0xb00b('0xb9'));_0x7523d5['countglobal']=ut['totalGlobal'](_0x7523d5);ut[_0xb00b('0x8d')](_0x7523d5,0x4,_0xb00b('0xba'));rpcDb[_0xb00b('0x92')](_0x7523d5,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xb00b('0xa6')](_0x7523d5,_0xb00b('0xbb'));rpcDb[_0xb00b('0xbc')](_0x7523d5);_0x2d21ec[_0xb00b('0x2a')]+=_0x7523d5[_0xb00b('0xbd')];_0x2d21ec[_0xb00b('0x29')]+=_0x7523d5[_0xb00b('0xbd')];logger['info'](_0xb00b('0xbe'),_0x7523d5['uniqueid'],_0xb00b('0xb1'),_0x2d21ec[_0xb00b('0x25')],'pTalking:\x20',_0x2d21ec[_0xb00b('0xaf')]);delete this[_0xb00b('0x13')][_0x4df7fa[_0xb00b('0xab')]];break;case _0xb00b('0xbf'):_0x2d21ec[_0xb00b('0x36')]+=0x1;_0x7523d5[_0xb00b('0xc0')]+=0x1;_0x7523d5[_0xb00b('0x9b')]=ut[_0xb00b('0x9c')](_0x7523d5);ut[_0xb00b('0x8d')](_0x7523d5,0x5,_0xb00b('0xc1'));ami[_0xb00b('0x23')](_0xb00b('0xc2'),ut['buildObj'](_0x7523d5,_0xb00b('0xc3')));rpcDb[_0xb00b('0x92')](_0x7523d5,_0xb00b('0xc4'));if(ut[_0xb00b('0x9c')](_0x7523d5)>=_0x2d21ec['dialGlobalMaxRetry']){_0x48a57e=ut[_0xb00b('0xa2')](_0x7523d5,0xf,_0xb00b('0xa3'));rpcDb[_0xb00b('0xa6')](_0x48a57e,_0xb00b('0xc5'));}else{if(_0x7523d5[_0xb00b('0xc0')]>=_0x2d21ec['dialBusyMaxRetry']){rpcDb[_0xb00b('0xa6')](_0x7523d5,_0xb00b('0xc4'));}else{rpcDb[_0xb00b('0xa7')](ut[_0xb00b('0xa8')](_0x7523d5,'countbusyretry',_0x2d21ec[_0xb00b('0xc6')]),_0x7523d5['unlockAgent'],_0x7523d5[_0xb00b('0xaa')]);}}break;case _0xb00b('0xc7'):_0x2d21ec[_0xb00b('0x39')]+=0x1;_0x7523d5[_0xb00b('0xc8')]+=0x1;_0x7523d5[_0xb00b('0x9b')]=ut[_0xb00b('0x9c')](_0x7523d5);ut[_0xb00b('0x8d')](_0x7523d5,0x3,_0xb00b('0xc9'));ami[_0xb00b('0x23')](_0xb00b('0xca'),ut[_0xb00b('0x9e')](_0x7523d5,'noanswer'));rpcDb[_0xb00b('0x92')](_0x7523d5,_0xb00b('0xcb'));if(ut[_0xb00b('0x9c')](_0x7523d5)>=_0x2d21ec[_0xb00b('0xa1')]){_0x48a57e=ut['cloneAction'](_0x7523d5,0xf,_0xb00b('0xa3'));rpcDb[_0xb00b('0xa6')](_0x48a57e,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x7523d5[_0xb00b('0xc8')]>=_0x2d21ec['dialNoAnswerMaxRetry']){rpcDb[_0xb00b('0xa6')](_0x7523d5,_0xb00b('0xcb'));}else{rpcDb[_0xb00b('0xa7')](ut['scheduledAt'](_0x7523d5,_0xb00b('0xc8'),_0x2d21ec[_0xb00b('0xcc')]),_0x7523d5[_0xb00b('0xa9')],_0x7523d5[_0xb00b('0xaa')]);}}break;case _0xb00b('0xcd'):_0x2d21ec[_0xb00b('0xce')]+=0x1;_0x7523d5[_0xb00b('0xcf')]+=0x1;_0x7523d5[_0xb00b('0x9b')]=ut[_0xb00b('0x9c')](_0x7523d5);ut['logCustomer'](_0x7523d5,0x8,'Congestion');ami[_0xb00b('0x23')](_0xb00b('0xd0'),ut[_0xb00b('0x9e')](_0x7523d5,_0xb00b('0xd1')));rpcDb['createCustomerHistory'](_0x7523d5,_0xb00b('0xd2'));if(ut[_0xb00b('0x9c')](_0x7523d5)>=_0x2d21ec['dialGlobalMaxRetry']){_0x48a57e=ut[_0xb00b('0xa2')](_0x7523d5,0xf,_0xb00b('0xa3'));rpcDb[_0xb00b('0xa6')](_0x48a57e,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x7523d5[_0xb00b('0xcf')]>=_0x2d21ec[_0xb00b('0xd3')]){rpcDb['createCustomerFinal'](_0x7523d5,_0xb00b('0xd2'));}else{rpcDb[_0xb00b('0xa7')](ut[_0xb00b('0xa8')](_0x7523d5,_0xb00b('0xcf'),_0x2d21ec[_0xb00b('0xc6')]),_0x7523d5[_0xb00b('0xa9')],_0x7523d5[_0xb00b('0xaa')]);}}break;case _0xb00b('0xd4'):_0x2d21ec['outboundRejectCallsDay']+=0x1;_0x7523d5[_0xb00b('0xd5')]+=0x1;_0x7523d5[_0xb00b('0x9b')]=ut[_0xb00b('0x9c')](_0x7523d5);ut[_0xb00b('0x8d')](_0x7523d5,0x14,'AgentReject');ami[_0xb00b('0x23')]('custom:agentreject',ut[_0xb00b('0x9e')](_0x7523d5,'agentreject'));rpcDb[_0xb00b('0x92')](_0x7523d5,_0xb00b('0xd6'));if(ut[_0xb00b('0x9c')](_0x7523d5)>=_0x2d21ec[_0xb00b('0xa1')]){_0x48a57e=ut[_0xb00b('0xa2')](_0x7523d5,0x14,'AgentReject');rpcDb[_0xb00b('0xa6')](_0x48a57e,_0xb00b('0xd7'));}else{if(_0x7523d5['countagentrejectretry']>=_0x2d21ec[_0xb00b('0xd8')]){rpcDb['createCustomerFinal'](_0x7523d5,_0xb00b('0xd7'));}else{rpcDb[_0xb00b('0xa7')](ut[_0xb00b('0xa8')](_0x7523d5,_0xb00b('0xd5'),_0x2d21ec['dialAgentRejectRetryFrequency']),_0x7523d5[_0xb00b('0xa9')],_0x7523d5[_0xb00b('0xaa')]);}}break;case _0xb00b('0xd9'):_0x2d21ec[_0xb00b('0x3e')]+=0x1;_0x7523d5[_0xb00b('0xda')]+=0x1;_0x7523d5['countglobal']=ut['totalGlobal'](_0x7523d5);ut[_0xb00b('0x8d')](_0x7523d5,0xb,_0xb00b('0xdb'));rpcDb[_0xb00b('0x92')](_0x7523d5,_0xb00b('0xdc'));if(ut[_0xb00b('0x9c')](_0x7523d5)>=_0x2d21ec['dialGlobalMaxRetry']){_0x48a57e=ut['cloneAction'](_0x7523d5,0xf,_0xb00b('0xa3'));rpcDb[_0xb00b('0xa6')](_0x48a57e,_0xb00b('0xdc'));}else{if(_0x7523d5[_0xb00b('0xdd')]>=_0x2d21ec[_0xb00b('0xde')]){rpcDb[_0xb00b('0xa6')](_0x7523d5,_0xb00b('0xdc'));}else{rpcDb['rescheduleContact'](ut[_0xb00b('0xa8')](_0x7523d5,'countabandonedretry',_0x2d21ec[_0xb00b('0xdf')]),_0x7523d5['unlockAgent'],_0x7523d5[_0xb00b('0xaa')]);}}break;case'18':_0x2d21ec[_0xb00b('0x3d')]+=0x1;_0x7523d5[_0xb00b('0xe0')]+=0x1;_0x7523d5[_0xb00b('0x9b')]=ut[_0xb00b('0x9c')](_0x7523d5);ut[_0xb00b('0x8d')](_0x7523d5,0x12,_0x4df7fa[_0xb00b('0xe1')]||_0x4df7fa[_0xb00b('0xe2')]);ami[_0xb00b('0x23')](_0xb00b('0xe3'),ut[_0xb00b('0x9e')](_0x7523d5,'amd'));rpcDb[_0xb00b('0x92')](_0x7523d5,_0xb00b('0xe4'));if(ut[_0xb00b('0x9c')](_0x7523d5)>=_0x2d21ec[_0xb00b('0xa1')]){_0x48a57e=ut['cloneAction'](_0x7523d5,0xf,_0xb00b('0xa3'));rpcDb[_0xb00b('0xa6')](_0x48a57e,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0xb00b('0xa6')](_0x7523d5,'[callProgressDetectingCustomer][hangupInAMD]');}delete this[_0xb00b('0x13')][_0x4df7fa[_0xb00b('0xab')]];break;case'19':_0x2d21ec['outboundUnknownCallsDay']+=0x1;_0x7523d5[_0xb00b('0x9b')]=ut[_0xb00b('0x9c')](_0x7523d5);ut[_0xb00b('0x8d')](_0x7523d5,0x13,_0x4df7fa[_0xb00b('0xe1')]||_0x4df7fa[_0xb00b('0xe2')]);ami[_0xb00b('0x23')]('custom:amd',ut[_0xb00b('0x9e')](_0x7523d5,'amd'));rpcDb[_0xb00b('0x92')](_0x7523d5,_0xb00b('0xe5'));if(ut[_0xb00b('0x9c')](_0x7523d5)>=_0x2d21ec[_0xb00b('0xa1')]){_0x48a57e=ut['cloneAction'](_0x7523d5,0xf,_0xb00b('0xa3'));rpcDb[_0xb00b('0xa6')](_0x48a57e,_0xb00b('0xe5'));}else{rpcDb['createCustomerFinal'](_0x7523d5,_0xb00b('0xe5'));}delete this[_0xb00b('0x13')][_0x4df7fa[_0xb00b('0xab')]];break;default:if(_0x7523d5[_0xb00b('0x70')]){ut['decrementTalkink'](_0x2d21ec,_0xb00b('0xe6'));ut[_0xb00b('0x7b')](_0xb00b('0xe7')+_0x2d21ec[_0xb00b('0x25')],_0x4df7fa);}_0x2d21ec[_0xb00b('0x3d')]+=0x1;_0x7523d5[_0xb00b('0x9b')]=ut['totalGlobal'](_0x7523d5);ut['logCustomer'](_0x7523d5,0xc,_0x4df7fa[_0xb00b('0xe1')]||_0x4df7fa[_0xb00b('0xe2')]);rpcDb[_0xb00b('0x92')](_0x7523d5,_0xb00b('0xe8'));if(ut[_0xb00b('0x9c')](_0x7523d5)>=_0x2d21ec['dialGlobalMaxRetry']){_0x48a57e=ut[_0xb00b('0xa2')](_0x7523d5,0xf,_0xb00b('0xa3'));rpcDb[_0xb00b('0xa6')](_0x48a57e,_0xb00b('0xe9'));}else{rpcDb[_0xb00b('0xa6')](_0x7523d5,_0xb00b('0xe9'));}delete this['actions'][_0x4df7fa[_0xb00b('0xab')]];}if(!(_0x7523d5[_0xb00b('0x70')]&&_0x30c0a7==='16')){ut[_0xb00b('0x77')](_0x2d21ec,_0xb00b('0xea'));logger[_0xb00b('0x56')](_0xb00b('0xeb'),_0x7523d5[_0xb00b('0xec')],_0xb00b('0xb1'),_0x2d21ec[_0xb00b('0x25')],_0xb00b('0x6f'),_0x2d21ec['originated']);}if(_0x30c0a7!=='ANSWER'){delete this[_0xb00b('0x13')][_0x4df7fa[_0xb00b('0xab')]];delete this[_0xb00b('0x13')][_0x4df7fa['destlinkedid']];}}};Preview['prototype']['callProgressDetectingAgent']=function(_0xf6c3bc,_0x1e50ca,_0xce62a){if(_['isUndefined'](_0x1e50ca)&&_0xb00b('0xed')!==typeof _0x1e50ca){return;}if(_[_0xb00b('0xee')](_0xce62a)&&_0xb00b('0xed')!==typeof _0xce62a){return;}switch(_0xce62a[_0xb00b('0xef')]){case'0':ut['logAgent'](_0xf6c3bc,0x0,_0xb00b('0x9d'));rpcDb[_0xb00b('0xf0')](_0xf6c3bc,_0xb00b('0xf1'));break;case'3':ut[_0xb00b('0xf2')](_0xf6c3bc,0x3,_0xb00b('0xc9'));rpcDb[_0xb00b('0xf0')](_0xf6c3bc,_0xb00b('0xf3'));break;case'5':ut[_0xb00b('0xf2')](_0xf6c3bc,0x5,'Busy');rpcDb[_0xb00b('0xf0')](_0xf6c3bc,_0xb00b('0xf4'));break;case'8':ut[_0xb00b('0xf2')](_0xf6c3bc,0x8,_0xb00b('0xf5'));rpcDb[_0xb00b('0xf0')](_0xf6c3bc,_0xb00b('0xf6'));break;case'22':ut[_0xb00b('0xf2')](_0xf6c3bc,0x16,_0xb00b('0xf7'));rpcDb['createAgentHistory'](_0xf6c3bc,_0xb00b('0xf8'));break;default:ut[_0xb00b('0xf2')](_0xf6c3bc,0xc,_0xce62a[_0xb00b('0xef')]);rpcDb[_0xb00b('0xf0')](_0xf6c3bc,'[callProgressDetectingAgent][logCongestion]');}ut[_0xb00b('0x77')](_0x1e50ca,_0xb00b('0xf9'));logger[_0xb00b('0x56')](_0xb00b('0xfa'),_0xf6c3bc[_0xb00b('0xec')],_0xb00b('0xb1'),_0x1e50ca[_0xb00b('0x25')],_0xb00b('0x6f'),_0x1e50ca['originated']);delete this['actions'][_0xf6c3bc[_0xb00b('0xec')]];};Preview[_0xb00b('0xd')][_0xb00b('0xfb')]=function(_0x58894a,_0x3aa890,_0xdf20d6,_0xfae545,_0x581548){var _0x44d3c0=this;return new BPromise(function(_0x3d5880,_0x3d9e1e){if(_['isNil'](_0x3aa890)||_['isNil'](_0x3aa890[_0xb00b('0xfc')])||_['isNil'](_0x3aa890[_0xb00b('0xfc')]['phone'])||_['isNil'](_0x3aa890[_0xb00b('0x74')])){_0x3d9e1e(ut[_0xb00b('0x48')](_0xb00b('0xfd'),_0xfae545,_0x581548));return;}var _0xcbfe37=uuid['v4']();var _0x41ee74=_0x44d3c0['campaignsPreview'][_0x3aa890[_0xb00b('0x6d')]['name']];var _0x592206=_0xdf20d6?_0x44d3c0[_0xb00b('0x14')][_0xdf20d6]['id']:undefined;_0x44d3c0[_0xb00b('0x13')][_0xcbfe37]=new Action(_0x3aa890,_0x41ee74,_0xcbfe37,_0xdf20d6,_0x592206);var _0xf3a747=_0x44d3c0[_0xb00b('0x13')][_0xcbfe37];_0xf3a747[_0xb00b('0xa9')]=_0xfae545;_0xf3a747[_0xb00b('0xaa')]=_0x581548;_0xf3a747['lookAgent']=_0xdf20d6;if(_[_0xb00b('0xfe')](_0x58894a)){_0x44d3c0['execCall'](_0xf3a747,_0x41ee74,_0x3aa890,_0xdf20d6)[_0xb00b('0x87')](function(_0x8abc0b){logger[_0xb00b('0x56')]('[Preview][execCall][success]',_0xb00b('0xff')+_0xf3a747[_0xb00b('0x6e')]+_0xb00b('0x100')+_0xf3a747[_0xb00b('0x101')],JSON['stringify'](_0x8abc0b));ami['emit'](_0xb00b('0x102'),ut['buildObj'](_0xf3a747,'called',_0x44d3c0[_0xb00b('0x22')][_0xf3a747['queue']]));_0x3d5880(ut['message'](_0xb00b('0x103')));})[_0xb00b('0x104')](function(_0x745803){ut[_0xb00b('0x5e')]('[Preview][execCall][failure]',_0x745803);_0x3d9e1e(ut['message'](_0xb00b('0x105'),_0xfae545,_0x581548));});}else{_0x41ee74[_0xb00b('0x35')]+=0x1;ut[_0xb00b('0x106')](_0xf3a747);rpcDb['createHistory'](_0xf3a747,'[Blacklist][error]');delete _0x44d3c0[_0xb00b('0x13')][_0xcbfe37];_0x3d9e1e(ut['message']('Contact\x20in\x20black\x20List',_0xfae545,_0x581548));}});};Preview[_0xb00b('0xd')]['isTrunkReachable']=function(_0x291010){return!_['isNil'](_0x291010)&&!_[_0xb00b('0x81')](_0x291010['name'])&&!_[_0xb00b('0x81')](_0x291010[_0xb00b('0x50')])&&_0x291010[_0xb00b('0x50')]&&!_['isNil'](this[_0xb00b('0x12')][util['format'](_0xb00b('0x107'),_0x291010[_0xb00b('0x25')])])&&!_['isNil'](this['trunks'][util['format']('SIP/%s',_0x291010[_0xb00b('0x25')])]['status'])&&(this[_0xb00b('0x12')][util['format'](_0xb00b('0x107'),_0x291010[_0xb00b('0x25')])][_0xb00b('0x108')]===_0xb00b('0x109')||this[_0xb00b('0x12')][util['format'](_0xb00b('0x107'),_0x291010[_0xb00b('0x25')])][_0xb00b('0x108')]===_0xb00b('0x10a'));};Preview['prototype']['run']=function(_0xe1f667,_0xfee3f5){var _0x181393=this;return new BPromise(function(_0x226d78,_0xa100a4){_0x181393[_0xb00b('0x10b')](_0xe1f667,_0xfee3f5)[_0xb00b('0x87')](function(_0x8dc8f7){_0x226d78(_[_0xb00b('0x71')](_0x8dc8f7,['message']));})[_0xb00b('0x104')](function(_0x2fd7f1){if(_0x2fd7f1['unlock']){rpcDb[_0xb00b('0x10c')](_0xe1f667);}if(_0x2fd7f1['active']){rpcDb[_0xb00b('0x8a')](_0xe1f667);}_0xa100a4(_[_0xb00b('0x71')](_0x2fd7f1,['message']));});});};Preview['prototype'][_0xb00b('0x10b')]=function(_0x3b9285,_0x240f04){var _0x4a5a72=this;return new BPromise(function(_0x3b3a53,_0x69b160){var _0x9acbff,_0x47a0b8;rpcDb[_0xb00b('0x10d')](_0x3b9285)['then'](function(_0x5bf454){if(!_['isNil'](_0x5bf454[0x0])){_0x47a0b8=_0x5bf454[0x0][_0xb00b('0x10e')]?![]:!![];_0x9acbff=_0x5bf454[0x0]['recallme']?!![]:![];_0x9acbff=_0x240f04?!![]:_0x9acbff;}var _0x1b8d45=_0x4a5a72[_0xb00b('0x10f')](_0x5bf454);if(_0x1b8d45['isValid']){rpcDb['checkIsBlackList'](_[_0xb00b('0x71')](_0x5bf454[0x0],[_0xb00b('0x74'),'Contact.phone']))[_0xb00b('0x87')](function(_0x3bcd75){_0x4a5a72[_0xb00b('0xfb')](_0x3bcd75,_0x5bf454[0x0],_0x240f04,_0x47a0b8,_0x9acbff)[_0xb00b('0x87')](function(_0x1ceb60){_0x3b3a53(_0x1ceb60);})[_0xb00b('0x104')](function(_0x49cfd5){_0x69b160(_0x49cfd5);});})[_0xb00b('0x104')](function(_0x22b425){ut['logger'](_0xb00b('0x110'),_0x22b425);_0x69b160(ut['message']('Call\x20unsuccessful',_0x47a0b8,_0x9acbff));});}else{_0x69b160(ut[_0xb00b('0x48')](_0x1b8d45['message'],_0x47a0b8,_0x9acbff));}})[_0xb00b('0x104')](function(_0xd75be6){ut[_0xb00b('0x5e')]('[Preview][getContactPreview]',_0xd75be6);_0x69b160(ut['message']('Call\x20unsuccessful',![],!![]));});});};Preview[_0xb00b('0xd')][_0xb00b('0x10f')]=function(_0x4cb653){if(_[_0xb00b('0x81')](_0x4cb653)||_[_0xb00b('0xfe')](_0x4cb653)||!_[_0xb00b('0x81')](_0x4cb653[0x0][_0xb00b('0x85')])&&_[_0xb00b('0x81')](_0x4cb653[0x0][_0xb00b('0x85')][_0xb00b('0x25')])){ut[_0xb00b('0x5e')]('[Preview][validateContact][Empty\x20Contact]',_0x4cb653);return{'isValid':![],'message':_0xb00b('0x111')};}var _0x3da033=this[_0xb00b('0x22')][_0x4cb653[0x0]['Queue']['name']];_0x3da033['message']=_0xb00b('0x112');if(_[_0xb00b('0x81')](_0x3da033)){ut[_0xb00b('0x5e')]('[Preview][validateContact][Empty\x20Campaign]',_0x3da033);return{'isValid':![],'message':_0xb00b('0x113')};}if(!this[_0xb00b('0x97')](_0x3da033[_0xb00b('0x4f')])){ut[_0xb00b('0x5e')](_0xb00b('0x114'),'campaign\x20Name:\x20'+_0x3da033[_0xb00b('0x25')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xb00b('0x97')](_0x3da033[_0xb00b('0x115')])){ut[_0xb00b('0x5e')](_0xb00b('0x114'),_0x3da033[_0xb00b('0x25')]+_0xb00b('0x116'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut[_0xb00b('0x96')](_0x3da033[_0xb00b('0x68')])){ut[_0xb00b('0x5e')](_0xb00b('0x117'),_0x3da033[_0xb00b('0x25')]+_0xb00b('0x118'));return{'isValid':![],'message':_0xb00b('0x119')+_0x3da033[_0xb00b('0x25')]+_0xb00b('0x118')};}return{'isValid':!![],'message':_0xb00b('0x11a')};};Preview['prototype'][_0xb00b('0x11b')]=function(_0x33952b,_0x4cd459,_0x3c4684,_0x5175c6){var _0x4c1a3a=this;return new BPromise(function(_0x5c95c2,_0x384a16){var _0x4d6930=_0x33952b[_0xb00b('0xec')];var _0x2cfe9f=_0x4c1a3a[_0xb00b('0x97')](_0x4cd459[_0xb00b('0x4f')])?util[_0xb00b('0x58')](_0xb00b('0x11c'),_0x4cd459[_0xb00b('0x4f')][_0xb00b('0x25')],_[_0xb00b('0x81')](_0x4cd459[_0xb00b('0x32')])?'':_0x4cd459[_0xb00b('0x32')][_0xb00b('0x11d')]()||'',_0x4cd459[_0xb00b('0x11e')]>0x0?_0x3c4684[_0xb00b('0xfc')]['phone'][_0xb00b('0x11f')](_0x4cd459[_0xb00b('0x11e')]):_0x3c4684[_0xb00b('0xfc')][_0xb00b('0x120')]):util[_0xb00b('0x58')]('SIP/%s/%s%s',_[_0xb00b('0x81')](_0x4cd459[_0xb00b('0x115')])?_0x4cd459['Trunk']['name']:_0x4cd459[_0xb00b('0x115')][_0xb00b('0x25')],_[_0xb00b('0x81')](_0x4cd459[_0xb00b('0x32')])?'':_0x4cd459[_0xb00b('0x32')][_0xb00b('0x11d')]()||'',_0x4cd459[_0xb00b('0x11e')]>0x0?_0x3c4684[_0xb00b('0xfc')][_0xb00b('0x120')][_0xb00b('0x11f')](_0x4cd459[_0xb00b('0x11e')]):_0x3c4684['Contact'][_0xb00b('0x120')]);var _0x4d067a=_0x4c1a3a[_0xb00b('0x97')](_0x4cd459[_0xb00b('0x4f')])?ut[_0xb00b('0x121')](_0x4cd459[_0xb00b('0x4f')][_0xb00b('0x122')],_0x4cd459[_0xb00b('0x123')],_0x4cd459['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xb00b('0x124')](_0x4cd459[_0xb00b('0x30')],_0x4cd459[_0xb00b('0x125')]):_0x4cd459[_0xb00b('0x30')]):ut['getCallerId'](_[_0xb00b('0x81')](_0x4cd459[_0xb00b('0x115')])?_0x4cd459['Trunk'][_0xb00b('0x122')]:_0x4cd459[_0xb00b('0x115')][_0xb00b('0x122')],_0x4cd459[_0xb00b('0x123')],_0x4cd459[_0xb00b('0x125')]>0x0?ut[_0xb00b('0x124')](_0x4cd459[_0xb00b('0x30')],_0x4cd459[_0xb00b('0x125')]):_0x4cd459[_0xb00b('0x30')]);if(_0x4d067a){_0x33952b['originatecalleridname']=ut[_0xb00b('0x126')](_0x4d067a);_0x33952b[_0xb00b('0x127')]=ut['extractCalleridNumber'](_0x4d067a);}var _0x51995c=ut[_0xb00b('0x128')](_0x4cd459,_0x3c4684,_0x2cfe9f,_0x4d067a,_0x4d6930,_0x33952b);_[_0xb00b('0x129')](_0x33952b,ut[_0xb00b('0x12a')](_0x51995c));_0x33952b[_0xb00b('0x8b')]=moment()[_0xb00b('0x58')](_0xb00b('0x8c'));ami[_0xb00b('0x12b')](ut[_0xb00b('0x12c')](_0x33952b,_0x4cd459,_0x51995c,_0x33952b[_0xb00b('0xaa')],_0x5175c6))[_0xb00b('0x87')](function(_0x5943a2){_0x4cd459[_0xb00b('0x5c')]+=0x1;logger[_0xb00b('0x56')](_0xb00b('0x12d'),_0x4d6930,'\x20Queue',_0x4cd459[_0xb00b('0x25')],_0xb00b('0x6f'),_0x4cd459[_0xb00b('0x5c')]);_0x5c95c2(_0x5943a2);})[_0xb00b('0x104')](function(_0x49ccb6){ut[_0xb00b('0xf2')](_0x33952b,0xe,_0xb00b('0x12e'));rpcDb['createAgentHistory'](_0x33952b,'[originateFailure][logOriginateFailure]');_0x384a16(_0x49ccb6);});});};Preview[_0xb00b('0xd')][_0xb00b('0x1d')]=function(_0x482f60){if(this[_0xb00b('0x13')][_0x482f60['linkedid']]){this['actions'][_0x482f60[_0xb00b('0xab')]]['channel']=_0x482f60['channel'];}};Preview[_0xb00b('0xd')][_0xb00b('0x16')]=function(_0x37d3d1){var _0xb34a7c=this;var _0x11e9b4=this[_0xb00b('0x13')][_0x37d3d1[_0xb00b('0x12f')]];if(_0x11e9b4){if(_0x11e9b4[_0xb00b('0x130')]&&this[_0xb00b('0x14')][_0x11e9b4[_0xb00b('0x130')]]){ut[_0xb00b('0x131')](_0x11e9b4,this[_0xb00b('0x14')][_0x11e9b4[_0xb00b('0x130')]][_0xb00b('0x25')],this['agents'][_0x11e9b4[_0xb00b('0x130')]]['id']);}var _0x388bf8=_['clone'](_0x11e9b4);_0x388bf8[_0xb00b('0xad')]=moment()['format'](_0xb00b('0x8c'));var _0x40546f=_0xb34a7c[_0xb00b('0x22')][_0x11e9b4['queue']];if(ut[_0xb00b('0x132')](_0x37d3d1[_0xb00b('0x133')])){if(_0x11e9b4['unlockAgent']){rpcDb[_0xb00b('0x10c')](_0x11e9b4[_0xb00b('0x101')]);}if(_0x11e9b4[_0xb00b('0xaa')]){rpcDb[_0xb00b('0x8a')](_0x11e9b4['idContact']);}ami[_0xb00b('0x23')](_0xb00b('0x134'),ut[_0xb00b('0x9e')](_0x11e9b4,'rejected',this['campaignsPreview'][_0x11e9b4['queue']]));this[_0xb00b('0x135')](_0x388bf8,_0x40546f,_0x37d3d1);}else{_0x11e9b4[_0xb00b('0x8b')]=moment()[_0xb00b('0x58')](_0xb00b('0x8c'));ut[_0xb00b('0xf2')](_0x388bf8,0x4,_0xb00b('0xba'));rpcDb[_0xb00b('0xf0')](_0x388bf8,_0xb00b('0x136'));}}};Preview[_0xb00b('0xd')]['syncHangup']=function(_0x59e4eb){var _0x5cee95=this;var _0x198da1=this['actions'][_0x59e4eb[_0xb00b('0xab')]];var _0x525fb3;if(_0x198da1){_0x525fb3=this[_0xb00b('0x22')][_0x198da1['queue']];logger[_0xb00b('0x56')](_0xb00b('0x137'),_0x59e4eb['linkedid'],_0xb00b('0xb1'),_0x525fb3[_0xb00b('0x25')],'pTalking:\x20',_0x525fb3[_0xb00b('0xaf')]);}if(this['actions'][_0x59e4eb[_0xb00b('0xab')]]&&_0x59e4eb[_0xb00b('0xab')]!==_0x59e4eb[_0xb00b('0xec')]){if(_0x59e4eb[_0xb00b('0x138')]==='16'&&this[_0xb00b('0x13')][_0x59e4eb[_0xb00b('0xab')]][_0xb00b('0x70')]){this[_0xb00b('0x99')](_0x59e4eb,_0x59e4eb[_0xb00b('0xab')],_0x59e4eb[_0xb00b('0x138')]);}else if(this['actions'][_0x59e4eb['linkedid']][_0xb00b('0x70')]){logger['info'](_0xb00b('0x139'),_0x59e4eb['linkedid'],_0x59e4eb[_0xb00b('0x138')],_0xb00b('0xb1'),_0x525fb3['name'],_0xb00b('0xb2'),_0x525fb3['pTalking']);this[_0xb00b('0x99')](_0x59e4eb,_0x59e4eb[_0xb00b('0xab')],_0x59e4eb['cause']);}}else if(_0x198da1&&_[_0xb00b('0x81')](_0x198da1[_0xb00b('0x13a')])&&_0x525fb3[_0xb00b('0x13b')]&&_0x59e4eb[_0xb00b('0xab')]===_0x59e4eb[_0xb00b('0xec')]&&_['isNil'](_0x59e4eb[_0xb00b('0xef')])&&_0x59e4eb[_0xb00b('0x138')]==='16'&&_0x59e4eb['channelstate']==='6'&&_['isUndefined'](_0x198da1[_0xb00b('0x13c')])){if(_0x198da1['unlockAgent']){rpcDb['unlockContact'](_0x198da1['idContact']);}if(_0x198da1[_0xb00b('0xaa')]){rpcDb[_0xb00b('0x8a')](_0x198da1[_0xb00b('0x101')]);}_0x59e4eb[_0xb00b('0xef')]='22';this['callProgressDetectingAgent'](_0x198da1,_0x525fb3,_0x59e4eb);}else if(_0x198da1&&_0x198da1[_0xb00b('0x13c')]){if(_0x59e4eb['cause']==='16'&&this[_0xb00b('0x13')][_0x59e4eb[_0xb00b('0xab')]][_0xb00b('0x70')]){logger[_0xb00b('0x56')]('[syncHangup][talking][transfer]',_0x59e4eb[_0xb00b('0xab')],_0x59e4eb[_0xb00b('0x138')],'\x20Queue',_0x525fb3[_0xb00b('0x25')],_0xb00b('0xb2'),_0x525fb3[_0xb00b('0xaf')]);this['callProgressDetectingCustomer'](_0x59e4eb,_0x59e4eb['linkedid'],_0x59e4eb[_0xb00b('0x138')]);}else if(this[_0xb00b('0x13')][_0x59e4eb[_0xb00b('0xab')]][_0xb00b('0x70')]){logger[_0xb00b('0x56')](_0xb00b('0x139'),_0x59e4eb[_0xb00b('0xab')],_0x59e4eb['cause'],'\x20Queue',_0x525fb3[_0xb00b('0x25')],'pTalking:\x20',_0x525fb3['pTalking']);this[_0xb00b('0x99')](_0x59e4eb,_0x59e4eb[_0xb00b('0xab')],_0x59e4eb['cause']);}}};Preview[_0xb00b('0xd')][_0xb00b('0x1a')]=function(_0x13783c){if(this['actions'][_0x13783c[_0xb00b('0x13d')]]&&_0x13783c[_0xb00b('0x13d')]!==_0x13783c[_0xb00b('0x13e')]){this[_0xb00b('0x99')](_0x13783c,_0x13783c[_0xb00b('0x13d')],_0x13783c[_0xb00b('0xe2')]);}};Preview[_0xb00b('0xd')]['syncHangupRequest']=function(_0x22e757){if(this[_0xb00b('0x13')][_0x22e757['linkedid']]&&_0x22e757['linkedid']!==_0x22e757['uniqueid']&&!this[_0xb00b('0x13')][_0x22e757[_0xb00b('0xab')]][_0xb00b('0x70')]){if(_0x22e757[_0xb00b('0x138')]==='1'){this[_0xb00b('0x99')](_0x22e757,_0x22e757[_0xb00b('0xab')],_0x22e757[_0xb00b('0x138')]);}}};Preview['prototype']['addVariable']=function(_0x1290d9,_0x19d624,_0x50d9a3){if(this[_0xb00b('0x13')][_0x1290d9]){if(_[_0xb00b('0x81')](this['actions'][_0x1290d9][_0xb00b('0x13f')])){this['actions'][_0x1290d9][_0xb00b('0x13f')]={};}this['actions'][_0x1290d9]['variables'][_0x19d624]=_0x50d9a3;}};Preview['prototype'][_0xb00b('0x140')]=function(_0x230223){try{if(!_[_0xb00b('0x81')](_0x230223)){if(ut[_0xb00b('0x141')](_['keys'](_0x230223[_0xb00b('0x142')])[0x0])){this[_0xb00b('0x143')](_0x230223[_0xb00b('0xec')],_[_0xb00b('0x144')](_0x230223[_0xb00b('0x142')])[0x0],_0x230223[_0xb00b('0x145')]);}}}catch(_0x1cc9fb){logger[_0xb00b('0x146')](_0xb00b('0x147'),util[_0xb00b('0x148')](_0x1cc9fb,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x3fe113){if(_0x3fe113){if(this[_0xb00b('0x13')][_0x3fe113[_0xb00b('0x149')]]){this[_0xb00b('0x13')][_0x3fe113[_0xb00b('0x149')]][_0xb00b('0x13c')]=!![];}}};Preview[_0xb00b('0xd')][_0xb00b('0x21')]=function(_0x2bba6e){if(_0x2bba6e){if(this['actions'][_0x2bba6e[_0xb00b('0x14a')]]){this[_0xb00b('0x13')][_0x2bba6e[_0xb00b('0x14a')]][_0xb00b('0x13c')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0xdc97=['syncOriginateResponse','bind','hangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','attendedtransfer','blindtransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','emit','outbound','strategy','answered','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','waiting','loggedInDb','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','message','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','md5','format','name','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','prototype','syncCampaigns','hasOwnProperty','type','clearZombieChannels','dialMethod','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','sequence','isNil','Queue','originated:\x20','queue','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','size','getContactRecallMe','length','dialRecallMeTimeout','Agent','voicePause','run','then','logger2','catch','[RecallMe]','disableContact','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerFinal','IsNotLoggedIn','isActive','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','connect','custom:agentConnectPreview','custom:agentcomplete','complete','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','sumDuration','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','dialGlobalMaxRetry','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','CONGESTION','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','outboundUnknownCallsDay','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','destlinkedid','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','createAgentHistory','[callProgressDetectingAgent][logBusy]','Congestion','AnswerAGI','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','lookAgent','isEmpty','execCall','\x20IdHopper:\x20','idContact','custom:agentcalled','Calling','Call\x20failed','logBlacklist','createHistory','Contact\x20in\x20black\x20List','SIP/%s','status','unmonitored','execRun','unlock','getContactPreview','recallme','validateContact','isValid','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','trim','phone','dialCutDigit','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','merge','toLowerVariables','starttime','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','channel','actionid','logLookAgent','clone','responsetime','isFailure','response','unlockContact','custom:agentringnoanswer','rejected','Answer','syncHangup','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','addVariable','variables','filterKey','variable','keys','value','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','moment','ioredis','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./action','defaults','redis','localhost','socket.io-emitter','enqueue','tail','finally','trunks','actions','agents','clockClearZombieChannels','originateresponse'];(function(_0x9dde62,_0x5522f9){var _0xcd55f3=function(_0x4bb664){while(--_0x4bb664){_0x9dde62['push'](_0x9dde62['shift']());}};_0xcd55f3(++_0x5522f9);}(_0xdc97,0x13b));var _0x7dc9=function(_0xd79a12,_0x4019db){_0xd79a12=_0xd79a12-0x0;var _0x43be4e=_0xdc97[_0xd79a12];return _0x43be4e;};'use strict';var util=require(_0x7dc9('0x0'));var _=require(_0x7dc9('0x1'));var BPromise=require(_0x7dc9('0x2'));var uuid=require('uuid');var moment=require(_0x7dc9('0x3'));var md5=require('md5');var Redis=require(_0x7dc9('0x4'));var config=require(_0x7dc9('0x5'));var logger=require('../../../config/logger')(_0x7dc9('0x6'));var loggerAction=require(_0x7dc9('0x7'))(_0x7dc9('0x8'));var ami=require(_0x7dc9('0x9'));var rpcDb=require('./rpcDb');var Action=require(_0x7dc9('0xa'));var ut=require('./util/util');config['redis']=_[_0x7dc9('0xb')](config[_0x7dc9('0xc')],{'host':_0x7dc9('0xd'),'port':0x18eb});var io=require(_0x7dc9('0xe'))(new Redis(config[_0x7dc9('0xc')]));var Sequence=function(){};Sequence['prototype'][_0x7dc9('0xf')]=function(_0x44fe24){this[_0x7dc9('0x10')]=this[_0x7dc9('0x10')]?this[_0x7dc9('0x10')][_0x7dc9('0x11')](_0x44fe24):_0x44fe24();};function Preview(_0x1e336a){this['sequence']=new Sequence();this['campaignsPreview']=_0x1e336a['voiceQueues'];this['trunks']=_0x1e336a[_0x7dc9('0x12')];this[_0x7dc9('0x13')]={};this['agents']=_0x1e336a[_0x7dc9('0x14')];this[_0x7dc9('0x15')]=0x0;ami['on'](_0x7dc9('0x16'),this[_0x7dc9('0x17')][_0x7dc9('0x18')](this));ami['on'](_0x7dc9('0x19'),this['syncHangup'][_0x7dc9('0x18')](this));ami['on'](_0x7dc9('0x1a'),this[_0x7dc9('0x1b')][_0x7dc9('0x18')](this));ami['on'](_0x7dc9('0x1c'),this[_0x7dc9('0x1d')][_0x7dc9('0x18')](this));ami['on'](_0x7dc9('0x1e'),this[_0x7dc9('0x1f')]['bind'](this));ami['on'](_0x7dc9('0x20'),this['syncVarSet'][_0x7dc9('0x18')](this));ami['on'](_0x7dc9('0x21'),this['syncAttendedTransfer'][_0x7dc9('0x18')](this));ami['on'](_0x7dc9('0x22'),this[_0x7dc9('0x23')][_0x7dc9('0x18')](this));this[_0x7dc9('0x24')](this[_0x7dc9('0x25')]);}function emit(_0x2dad65,_0x2895f5,_0x155cc4){io['to'](_0x2dad65)[_0x7dc9('0x26')](_0x2895f5,_0x155cc4);}function emitCampaignPreview(_0x576681){if(_0x576681['type']===_0x7dc9('0x27')){var _0x5981e2={'id':_0x576681['id'],'name':_0x576681['name'],'strategy':_0x576681[_0x7dc9('0x28')],'answered':_0x576681[_0x7dc9('0x29')],'available':_0x576681['available'],'loggedIn':_0x576681[_0x7dc9('0x2a')],'pTalking':_0x576681[_0x7dc9('0x2b')],'sumBillable':_0x576681[_0x7dc9('0x2c')],'sumDuration':_0x576681['sumDuration'],'sumHoldTime':_0x576681[_0x7dc9('0x2d')]||0x0,'talking':_0x576681[_0x7dc9('0x2e')],'total':_0x576681[_0x7dc9('0x2f')],'type':_0x576681['type'],'unmanaged':_0x576681['unmanaged'],'abandoned':_0x576681['abandoned'],'waiting':_0x576681[_0x7dc9('0x30')],'loggedInDb':_0x576681[_0x7dc9('0x31')],'dialActive':_0x576681['dialActive'],'dialMethod':_0x576681['dialMethod'],'dialOriginateCallerIdName':_0x576681[_0x7dc9('0x32')],'dialOriginateCallerIdNumber':_0x576681['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x576681[_0x7dc9('0x33')],'dialPrefix':_0x576681[_0x7dc9('0x34')],'outboundAnswerAgiCallsDay':_0x576681[_0x7dc9('0x35')],'outboundAnswerCallsDay':_0x576681[_0x7dc9('0x36')],'outboundBlacklistCallsDay':_0x576681[_0x7dc9('0x37')],'outboundBusyCallsDay':_0x576681[_0x7dc9('0x38')],'outboundCongestionCallsDay':_0x576681[_0x7dc9('0x39')],'outboundDropCallsDayACS':_0x576681[_0x7dc9('0x3a')],'outboundDropCallsDayCallersExit':_0x576681[_0x7dc9('0x3b')],'outboundDropCallsDayTimeout':_0x576681[_0x7dc9('0x3c')],'outboundNoAnswerCallsDay':_0x576681[_0x7dc9('0x3d')],'outboundNoSuchCallsDay':_0x576681[_0x7dc9('0x3e')],'outboundOriginateFailureCallsDay':_0x576681['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x576681['outboundReCallsDay'],'outboundRejectCallsDay':_0x576681['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x576681['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x576681['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x576681['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x576681['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x576681['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x576681[_0x7dc9('0x3f')],'predictiveIntervalDroppedCallsTimeout':_0x576681[_0x7dc9('0x40')],'predictiveIntervalErlangCalls':_0x576681[_0x7dc9('0x41')],'predictiveIntervalErlangCallsDroppedCalls':_0x576681[_0x7dc9('0x42')],'predictiveIntervalHitRate':_0x576681[_0x7dc9('0x43')],'predictiveIntervalMultiplicativeFactor':_0x576681[_0x7dc9('0x44')],'predictiveIntervalPauses':_0x576681['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x576681['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x576681['predictiveIntervalTotalCalls'],'message':_0x576681[_0x7dc9('0x45')],'originated':_0x576681['originated'],'erlangCalls':_0x576681[_0x7dc9('0x46')],'erlangCallToSecond':_0x576681[_0x7dc9('0x47')],'erlangAbandonmentRate':_0x576681[_0x7dc9('0x48')],'erlangBusyFactor':_0x576681[_0x7dc9('0x49')],'startPredictive':_0x576681[_0x7dc9('0x4a')],'startProgressive':_0x576681[_0x7dc9('0x4b')]};if(_0x576681[_0x7dc9('0x4c')]){_0x5981e2[_0x7dc9('0x4c')]={'id':_0x576681['Trunk']['id'],'name':_0x576681[_0x7dc9('0x4c')]['name'],'active':_0x576681[_0x7dc9('0x4c')][_0x7dc9('0x4d')],'callerid':_0x576681[_0x7dc9('0x4c')][_0x7dc9('0x4e')]};}if(_0x576681['Interval']){_0x5981e2[_0x7dc9('0x4f')]={'id':_0x576681['Interval']['id'],'name':_0x576681[_0x7dc9('0x4f')]['name']};}var _0x590bed=md5(JSON[_0x7dc9('0x50')](_0x5981e2));if(_0x576681[_0x7dc9('0x51')]!==_0x590bed){_0x576681[_0x7dc9('0x51')]=_0x590bed;emit(util[_0x7dc9('0x52')]('voice:queue:%s',_0x5981e2[_0x7dc9('0x53')]),_0x7dc9('0x54'),_0x5981e2);}}}function emitVoiceQueueChannelRemove(_0x138f33){logger[_0x7dc9('0x55')](_0x7dc9('0x56'),JSON[_0x7dc9('0x50')](_0x138f33));emit(util[_0x7dc9('0x52')](_0x7dc9('0x57'),_0x138f33[_0x7dc9('0x53')]),_0x7dc9('0x58'),_0x138f33);io[_0x7dc9('0x26')](_0x7dc9('0x59'),_0x138f33);}function notSendMessagesQueue(_0x5a94b5){if(_0x5a94b5[_0x7dc9('0x5a')]){if(_0x5a94b5[_0x7dc9('0x5b')]===0x0&&_0x5a94b5[_0x7dc9('0x2b')]===0x0){_0x5a94b5[_0x7dc9('0x5a')]=![];_0x5a94b5['available']=0x0;_0x5a94b5[_0x7dc9('0x5c')]=0x0;_0x5a94b5[_0x7dc9('0x45')]=_0x7dc9('0x5d');ut[_0x7dc9('0x5e')](_0x7dc9('0x5f'),_0x5a94b5[_0x7dc9('0x53')]+'\x20is\x20not\x20active');}else{_0x5a94b5['message']=_0x7dc9('0x60');ut[_0x7dc9('0x5e')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x5a94b5[_0x7dc9('0x53')]+'\x20is\x20disactive');}emitCampaignPreview(_0x5a94b5);}}Preview[_0x7dc9('0x61')][_0x7dc9('0x24')]=function(){var _0x3bca9c=this;setInterval(function(){_0x3bca9c['syncCampaigns']();},0x7cf);};Preview[_0x7dc9('0x61')][_0x7dc9('0x62')]=function(){var _0x1929b6=this[_0x7dc9('0x25')];this[_0x7dc9('0x15')]+=0x1;for(var _0x23499a in _0x1929b6){if(_0x1929b6[_0x7dc9('0x63')](_0x23499a)&&(_0x1929b6[_0x23499a]['dialMethod']===_0x7dc9('0x6')||_0x1929b6[_0x23499a]['dialMethod']==='booked')&&_0x1929b6[_0x23499a][_0x7dc9('0x64')]===_0x7dc9('0x27')){if(this[_0x7dc9('0x15')]>0x7){this[_0x7dc9('0x15')]=0x0;this[_0x7dc9('0x65')]();}}if(_0x1929b6[_0x7dc9('0x63')](_0x23499a)&&_0x1929b6[_0x23499a][_0x7dc9('0x66')]===_0x7dc9('0x6')&&_0x1929b6[_0x23499a][_0x7dc9('0x64')]==='outbound'){if(_0x1929b6[_0x23499a][_0x7dc9('0x67')]){this[_0x7dc9('0x68')](_0x1929b6[_0x23499a]);if(_0x1929b6[_0x23499a][_0x7dc9('0x69')])this[_0x7dc9('0x6a')](_0x1929b6[_0x23499a]);}else{notSendMessagesQueue(_0x1929b6[_0x23499a]);}}}};Preview[_0x7dc9('0x61')][_0x7dc9('0x6b')]=function(_0x575393){var _0x3774cb=this;this[_0x7dc9('0x6c')]['enqueue'](function(){if(!_[_0x7dc9('0x6d')](_0x3774cb[_0x7dc9('0x13')][_0x575393])){loggerAction[_0x7dc9('0x55')]('[clearZombieChannels][talking]',_0x575393,_0x7dc9('0x6e'),_0x3774cb['actions'][_0x575393]['queue'],_0x7dc9('0x6f'),JSON[_0x7dc9('0x50')](_0x3774cb[_0x7dc9('0x25')][_0x3774cb['actions'][_0x575393]['queue']][_0x7dc9('0x5b')]),'pTalking:\x20',JSON[_0x7dc9('0x50')](_0x3774cb[_0x7dc9('0x25')][_0x3774cb['actions'][_0x575393][_0x7dc9('0x70')]][_0x7dc9('0x2b')]),JSON[_0x7dc9('0x50')](_0x3774cb[_0x7dc9('0x13')][_0x575393][_0x7dc9('0x71')]),JSON[_0x7dc9('0x50')](_[_0x7dc9('0x72')](_0x3774cb[_0x7dc9('0x13')][_0x575393],[_0x7dc9('0x73'),_0x7dc9('0x74'),_0x7dc9('0x75'),_0x7dc9('0x76')])));return ami[_0x7dc9('0x77')]({'action':'status','channel':_0x3774cb[_0x7dc9('0x13')][_0x575393]['channel']})['catch'](function(_0x446103){if(_0x446103[_0x7dc9('0x45')]===_0x7dc9('0x78')){setTimeout(function(){if(_0x3774cb[_0x7dc9('0x13')][_0x575393]){ut[_0x7dc9('0x79')](_0x3774cb['campaignsPreview'][_0x3774cb[_0x7dc9('0x13')][_0x575393][_0x7dc9('0x70')]],_0x7dc9('0x7a'));if(_0x3774cb['actions'][_0x575393][_0x7dc9('0x71')]===!![]){ut[_0x7dc9('0x7b')](_0x3774cb[_0x7dc9('0x25')][_0x3774cb[_0x7dc9('0x13')][_0x575393][_0x7dc9('0x70')]],_0x7dc9('0x7a'));ut['loggerError'](_0x7dc9('0x7c')+_0x575393,_0x3774cb[_0x7dc9('0x13')][_0x575393][_0x7dc9('0x70')]);}ut[_0x7dc9('0x7d')](_0x7dc9('0x7e')+_0x575393,_0x3774cb[_0x7dc9('0x13')][_0x575393][_0x7dc9('0x70')]);delete _0x3774cb[_0x7dc9('0x13')][_0x575393];}},0x2328);}});}});};Preview[_0x7dc9('0x61')][_0x7dc9('0x65')]=function(){var _0x329950=this;loggerAction[_0x7dc9('0x55')]('[action]',_[_0x7dc9('0x7f')](this[_0x7dc9('0x13')]));for(var _0x38df9a in this[_0x7dc9('0x13')]){if(_0x329950[_0x7dc9('0x13')]['hasOwnProperty'](_0x38df9a)){_0x329950[_0x7dc9('0x6b')](_0x38df9a);}}};Preview[_0x7dc9('0x61')][_0x7dc9('0x6a')]=function(_0x17ed6c){var _0x2a1db8=this;rpcDb[_0x7dc9('0x80')](_0x17ed6c['id'],ut['agentReadyId'](this['agents']))['then'](function(_0x25bdee){if(!_[_0x7dc9('0x6d')](_0x25bdee)){for(var _0x32a64f=0x0;_0x32a64f<_0x25bdee[_0x7dc9('0x81')];_0x32a64f+=0x1){if(ut['getDiff'](_0x25bdee[_0x32a64f]['scheduledat'])<_0x17ed6c[_0x7dc9('0x82')]*0x3c){if(_0x25bdee[_0x32a64f][_0x7dc9('0x83')]&&!_0x25bdee[_0x32a64f][_0x7dc9('0x83')][_0x7dc9('0x84')]){_0x2a1db8[_0x7dc9('0x85')](_0x25bdee[_0x32a64f]['id'])[_0x7dc9('0x86')](ut[_0x7dc9('0x87')]('[RecallMe]'))[_0x7dc9('0x88')](ut[_0x7dc9('0x87')](_0x7dc9('0x89')));}else{rpcDb[_0x7dc9('0x8a')](_0x25bdee[_0x32a64f]['id']);}}else{var _0x4683b3=new Action(_0x25bdee[_0x32a64f],_0x17ed6c);_0x4683b3['starttime']=moment()[_0x7dc9('0x52')](_0x7dc9('0x8b'));_0x17ed6c[_0x7dc9('0x8c')]+=0x1;ut[_0x7dc9('0x8d')](_0x4683b3,0x17,_0x7dc9('0x8e'));if(_0x17ed6c[_0x7dc9('0x8f')]){rpcDb[_0x7dc9('0x90')](ut[_0x7dc9('0x91')](_0x25bdee[_0x32a64f]));rpcDb[_0x7dc9('0x92')](_0x4683b3,_0x7dc9('0x93'));}else{ut[_0x7dc9('0x8d')](_0x4683b3,0x16,_0x7dc9('0x94'));rpcDb[_0x7dc9('0x92')](_0x4683b3,'[HistoryRecallClose]');rpcDb[_0x7dc9('0x95')](_0x4683b3,'[HistoryRecallClose]');}}}}})[_0x7dc9('0x88')](ut[_0x7dc9('0x87')]('[getContactRecallMe]'));};Preview[_0x7dc9('0x61')][_0x7dc9('0x68')]=function(_0x50e9a9){_0x50e9a9[_0x7dc9('0x5a')]=!![];if(ut[_0x7dc9('0x96')](_0x50e9a9[_0x7dc9('0x2a')])){_0x50e9a9['message']='AGENTS_NOT_LOGGED';}else if(!ut[_0x7dc9('0x97')](_0x50e9a9[_0x7dc9('0x67')])){_0x50e9a9[_0x7dc9('0x45')]=_0x7dc9('0x5d');}else if(!this[_0x7dc9('0x98')](_0x50e9a9[_0x7dc9('0x4c')])){if(!this[_0x7dc9('0x98')](_0x50e9a9[_0x7dc9('0x99')])){_0x50e9a9[_0x7dc9('0x45')]='TRUNK_IS_NOT_REACHABLE';}else{_0x50e9a9[_0x7dc9('0x45')]=_0x7dc9('0x9a');}}else{_0x50e9a9[_0x7dc9('0x45')]='ACTIVE';}emitCampaignPreview(_0x50e9a9);};Preview['prototype'][_0x7dc9('0x9b')]=function(_0x117444,_0x123fa8,_0x2cf485){var _0x59f3bd=this;var _0x4c7c6b=this[_0x7dc9('0x13')][_0x123fa8];var _0x182bc6=this[_0x7dc9('0x25')][_0x4c7c6b[_0x7dc9('0x70')]];var _0x5d211b;if(_0x182bc6){switch(_0x2cf485){case'1':_0x182bc6[_0x7dc9('0x3e')]+=0x1;_0x4c7c6b[_0x7dc9('0x9c')]+=0x1;_0x4c7c6b[_0x7dc9('0x9d')]=ut[_0x7dc9('0x9e')](_0x4c7c6b);ut[_0x7dc9('0x8d')](_0x4c7c6b,0x0,_0x7dc9('0x9f'));ami[_0x7dc9('0x26')]('custom:agentnosuchnumber',ut[_0x7dc9('0xa0')](_0x4c7c6b,_0x7dc9('0xa1')));rpcDb['createCustomerHistory'](_0x4c7c6b,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0x7dc9('0x9e')](_0x4c7c6b)>=_0x182bc6['dialGlobalMaxRetry']){_0x5d211b=ut[_0x7dc9('0xa2')](_0x4c7c6b,0xf,_0x7dc9('0xa3'));rpcDb[_0x7dc9('0x95')](_0x5d211b,_0x7dc9('0xa4'));}else{if(_0x4c7c6b[_0x7dc9('0x9c')]>=_0x182bc6[_0x7dc9('0xa5')]){rpcDb[_0x7dc9('0x95')](_0x4c7c6b,_0x7dc9('0xa4'));}else{rpcDb[_0x7dc9('0xa6')](ut[_0x7dc9('0xa7')](_0x4c7c6b,'countnosuchnumberretry',_0x182bc6[_0x7dc9('0xa8')]),_0x4c7c6b[_0x7dc9('0xa9')],_0x4c7c6b[_0x7dc9('0xaa')]);}}delete this['actions'][_0x117444[_0x7dc9('0xab')]];break;case'ANSWER':var _0x5904c6=moment()[_0x7dc9('0x52')](_0x7dc9('0x8b'));_0x4c7c6b['responsetime']=_0x5904c6;_0x4c7c6b[_0x7dc9('0xac')]=_0x5904c6;_0x4c7c6b['dialAnswer']=!![];_0x182bc6['pTalking']+=0x1;logger[_0x7dc9('0x55')](_0x7dc9('0xad'),_0x4c7c6b[_0x7dc9('0xae')],_0x7dc9('0xaf'),_0x182bc6['name'],_0x7dc9('0xb0'),_0x182bc6[_0x7dc9('0x2b')]);ami[_0x7dc9('0x26')](_0x7dc9('0xb1'),ut[_0x7dc9('0xa0')](_0x4c7c6b,_0x7dc9('0xb2'),this[_0x7dc9('0x25')][_0x4c7c6b[_0x7dc9('0x70')]]));if(_0x182bc6['acw']){ami['emit'](_0x7dc9('0xb3'),ut['buildAcw'](_0x4c7c6b));}break;case'16':ami[_0x7dc9('0x26')](_0x7dc9('0xb4'),ut[_0x7dc9('0xa0')](_0x4c7c6b,_0x7dc9('0xb5'),this['campaignsPreview'][_0x4c7c6b[_0x7dc9('0x70')]]));emitVoiceQueueChannelRemove(ut[_0x7dc9('0xa0')](_0x4c7c6b,'complete'));_0x182bc6[_0x7dc9('0x36')]+=0x1;_0x182bc6[_0x7dc9('0x2f')]+=0x1;_0x182bc6[_0x7dc9('0x29')]+=0x1;ut[_0x7dc9('0x7b')](_0x182bc6,'[16]');_0x4c7c6b[_0x7dc9('0x9d')]=ut[_0x7dc9('0x9e')](_0x4c7c6b);ut['logCustomer'](_0x4c7c6b,0x4,'Answer');rpcDb[_0x7dc9('0x92')](_0x4c7c6b,_0x7dc9('0xb6'));rpcDb['createCustomerFinal'](_0x4c7c6b,_0x7dc9('0xb7'));rpcDb['crateCustomerReportQueue'](_0x4c7c6b);_0x182bc6[_0x7dc9('0xb8')]+=_0x4c7c6b[_0x7dc9('0xb9')];_0x182bc6[_0x7dc9('0x2c')]+=_0x4c7c6b['talktime'];logger[_0x7dc9('0x55')](_0x7dc9('0xba'),_0x4c7c6b[_0x7dc9('0xae')],'\x20Queue',_0x182bc6[_0x7dc9('0x53')],'pTalking:\x20',_0x182bc6['pTalking']);delete this[_0x7dc9('0x13')][_0x117444[_0x7dc9('0xab')]];break;case _0x7dc9('0xbb'):_0x182bc6[_0x7dc9('0x38')]+=0x1;_0x4c7c6b[_0x7dc9('0xbc')]+=0x1;_0x4c7c6b['countglobal']=ut[_0x7dc9('0x9e')](_0x4c7c6b);ut[_0x7dc9('0x8d')](_0x4c7c6b,0x5,_0x7dc9('0xbd'));ami[_0x7dc9('0x26')](_0x7dc9('0xbe'),ut['buildObj'](_0x4c7c6b,_0x7dc9('0xbf')));rpcDb[_0x7dc9('0x92')](_0x4c7c6b,_0x7dc9('0xc0'));if(ut[_0x7dc9('0x9e')](_0x4c7c6b)>=_0x182bc6['dialGlobalMaxRetry']){_0x5d211b=ut[_0x7dc9('0xa2')](_0x4c7c6b,0xf,'Global');rpcDb['createCustomerFinal'](_0x5d211b,_0x7dc9('0xc1'));}else{if(_0x4c7c6b['countbusyretry']>=_0x182bc6[_0x7dc9('0xc2')]){rpcDb[_0x7dc9('0x95')](_0x4c7c6b,_0x7dc9('0xc0'));}else{rpcDb[_0x7dc9('0xa6')](ut[_0x7dc9('0xa7')](_0x4c7c6b,_0x7dc9('0xbc'),_0x182bc6['dialBusyRetryFrequency']),_0x4c7c6b[_0x7dc9('0xa9')],_0x4c7c6b[_0x7dc9('0xaa')]);}}break;case _0x7dc9('0xc3'):_0x182bc6[_0x7dc9('0x3d')]+=0x1;_0x4c7c6b[_0x7dc9('0xc4')]+=0x1;_0x4c7c6b['countglobal']=ut[_0x7dc9('0x9e')](_0x4c7c6b);ut['logCustomer'](_0x4c7c6b,0x3,_0x7dc9('0xc5'));ami[_0x7dc9('0x26')](_0x7dc9('0xc6'),ut['buildObj'](_0x4c7c6b,_0x7dc9('0xc7')));rpcDb[_0x7dc9('0x92')](_0x4c7c6b,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0x7dc9('0x9e')](_0x4c7c6b)>=_0x182bc6[_0x7dc9('0xc8')]){_0x5d211b=ut[_0x7dc9('0xa2')](_0x4c7c6b,0xf,_0x7dc9('0xa3'));rpcDb['createCustomerFinal'](_0x5d211b,_0x7dc9('0xc9'));}else{if(_0x4c7c6b['countnoanswerretry']>=_0x182bc6[_0x7dc9('0xca')]){rpcDb[_0x7dc9('0x95')](_0x4c7c6b,_0x7dc9('0xcb'));}else{rpcDb['rescheduleContact'](ut[_0x7dc9('0xa7')](_0x4c7c6b,_0x7dc9('0xc4'),_0x182bc6[_0x7dc9('0xcc')]),_0x4c7c6b['unlockAgent'],_0x4c7c6b['activeContact']);}}break;case _0x7dc9('0xcd'):_0x182bc6[_0x7dc9('0x39')]+=0x1;_0x4c7c6b['countcongestionretry']+=0x1;_0x4c7c6b['countglobal']=ut[_0x7dc9('0x9e')](_0x4c7c6b);ut[_0x7dc9('0x8d')](_0x4c7c6b,0x8,'Congestion');ami[_0x7dc9('0x26')]('custom:agentcongestion',ut[_0x7dc9('0xa0')](_0x4c7c6b,_0x7dc9('0xce')));rpcDb[_0x7dc9('0x92')](_0x4c7c6b,_0x7dc9('0xcf'));if(ut[_0x7dc9('0x9e')](_0x4c7c6b)>=_0x182bc6[_0x7dc9('0xc8')]){_0x5d211b=ut['cloneAction'](_0x4c7c6b,0xf,_0x7dc9('0xa3'));rpcDb[_0x7dc9('0x95')](_0x5d211b,_0x7dc9('0xd0'));}else{if(_0x4c7c6b[_0x7dc9('0xd1')]>=_0x182bc6[_0x7dc9('0xd2')]){rpcDb['createCustomerFinal'](_0x4c7c6b,_0x7dc9('0xcf'));}else{rpcDb[_0x7dc9('0xa6')](ut[_0x7dc9('0xa7')](_0x4c7c6b,_0x7dc9('0xd1'),_0x182bc6['dialBusyRetryFrequency']),_0x4c7c6b[_0x7dc9('0xa9')],_0x4c7c6b[_0x7dc9('0xaa')]);}}break;case'CANCEL':_0x182bc6[_0x7dc9('0xd3')]+=0x1;_0x4c7c6b['countagentrejectretry']+=0x1;_0x4c7c6b[_0x7dc9('0x9d')]=ut[_0x7dc9('0x9e')](_0x4c7c6b);ut[_0x7dc9('0x8d')](_0x4c7c6b,0x14,_0x7dc9('0xd4'));ami[_0x7dc9('0x26')](_0x7dc9('0xd5'),ut[_0x7dc9('0xa0')](_0x4c7c6b,_0x7dc9('0xd6')));rpcDb['createCustomerHistory'](_0x4c7c6b,_0x7dc9('0xd7'));if(ut[_0x7dc9('0x9e')](_0x4c7c6b)>=_0x182bc6[_0x7dc9('0xc8')]){_0x5d211b=ut[_0x7dc9('0xa2')](_0x4c7c6b,0x14,_0x7dc9('0xd4'));rpcDb['createCustomerFinal'](_0x5d211b,_0x7dc9('0xd8'));}else{if(_0x4c7c6b[_0x7dc9('0xd9')]>=_0x182bc6[_0x7dc9('0xda')]){rpcDb[_0x7dc9('0x95')](_0x4c7c6b,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x7dc9('0xa6')](ut['scheduledAt'](_0x4c7c6b,_0x7dc9('0xd9'),_0x182bc6['dialAgentRejectRetryFrequency']),_0x4c7c6b[_0x7dc9('0xa9')],_0x4c7c6b[_0x7dc9('0xaa')]);}}break;case _0x7dc9('0xdb'):_0x182bc6[_0x7dc9('0xdc')]+=0x1;_0x4c7c6b[_0x7dc9('0xdd')]+=0x1;_0x4c7c6b[_0x7dc9('0x9d')]=ut[_0x7dc9('0x9e')](_0x4c7c6b);ut[_0x7dc9('0x8d')](_0x4c7c6b,0xb,_0x7dc9('0xde'));rpcDb[_0x7dc9('0x92')](_0x4c7c6b,_0x7dc9('0xdf'));if(ut[_0x7dc9('0x9e')](_0x4c7c6b)>=_0x182bc6['dialGlobalMaxRetry']){_0x5d211b=ut[_0x7dc9('0xa2')](_0x4c7c6b,0xf,_0x7dc9('0xa3'));rpcDb[_0x7dc9('0x95')](_0x5d211b,_0x7dc9('0xdf'));}else{if(_0x4c7c6b['countabandonedetry']>=_0x182bc6[_0x7dc9('0xe0')]){rpcDb[_0x7dc9('0x95')](_0x4c7c6b,_0x7dc9('0xdf'));}else{rpcDb[_0x7dc9('0xa6')](ut['scheduledAt'](_0x4c7c6b,_0x7dc9('0xdd'),_0x182bc6[_0x7dc9('0xe1')]),_0x4c7c6b[_0x7dc9('0xa9')],_0x4c7c6b['activeContact']);}}break;case'18':_0x182bc6['outboundUnknownCallsDay']+=0x1;_0x4c7c6b[_0x7dc9('0xe2')]+=0x1;_0x4c7c6b[_0x7dc9('0x9d')]=ut[_0x7dc9('0x9e')](_0x4c7c6b);ut[_0x7dc9('0x8d')](_0x4c7c6b,0x12,_0x117444[_0x7dc9('0xe3')]||_0x117444['dialstatus']);ami[_0x7dc9('0x26')](_0x7dc9('0xe4'),ut[_0x7dc9('0xa0')](_0x4c7c6b,_0x7dc9('0xe5')));rpcDb['createCustomerHistory'](_0x4c7c6b,_0x7dc9('0xe6'));if(ut['totalGlobal'](_0x4c7c6b)>=_0x182bc6[_0x7dc9('0xc8')]){_0x5d211b=ut['cloneAction'](_0x4c7c6b,0xf,_0x7dc9('0xa3'));rpcDb[_0x7dc9('0x95')](_0x5d211b,_0x7dc9('0xe6'));}else{rpcDb['createCustomerFinal'](_0x4c7c6b,_0x7dc9('0xe6'));}delete this[_0x7dc9('0x13')][_0x117444['linkedid']];break;case'19':_0x182bc6['outboundUnknownCallsDay']+=0x1;_0x4c7c6b[_0x7dc9('0x9d')]=ut['totalGlobal'](_0x4c7c6b);ut['logCustomer'](_0x4c7c6b,0x13,_0x117444[_0x7dc9('0xe3')]||_0x117444[_0x7dc9('0xe7')]);ami[_0x7dc9('0x26')]('custom:amd',ut['buildObj'](_0x4c7c6b,'amd'));rpcDb[_0x7dc9('0x92')](_0x4c7c6b,_0x7dc9('0xe8'));if(ut[_0x7dc9('0x9e')](_0x4c7c6b)>=_0x182bc6[_0x7dc9('0xc8')]){_0x5d211b=ut['cloneAction'](_0x4c7c6b,0xf,'Global');rpcDb[_0x7dc9('0x95')](_0x5d211b,_0x7dc9('0xe8'));}else{rpcDb[_0x7dc9('0x95')](_0x4c7c6b,'[callProgressDetectingCustomer][machine]');}delete this['actions'][_0x117444[_0x7dc9('0xab')]];break;default:if(_0x4c7c6b['dialAnswer']){ut[_0x7dc9('0x7b')](_0x182bc6,_0x7dc9('0xe9'));ut['loggerError'](_0x7dc9('0xea')+_0x182bc6[_0x7dc9('0x53')],_0x117444);}_0x182bc6[_0x7dc9('0xeb')]+=0x1;_0x4c7c6b[_0x7dc9('0x9d')]=ut[_0x7dc9('0x9e')](_0x4c7c6b);ut[_0x7dc9('0x8d')](_0x4c7c6b,0xc,_0x117444[_0x7dc9('0xe3')]||_0x117444[_0x7dc9('0xe7')]);rpcDb['createCustomerHistory'](_0x4c7c6b,_0x7dc9('0xec'));if(ut['totalGlobal'](_0x4c7c6b)>=_0x182bc6[_0x7dc9('0xc8')]){_0x5d211b=ut['cloneAction'](_0x4c7c6b,0xf,_0x7dc9('0xa3'));rpcDb[_0x7dc9('0x95')](_0x5d211b,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x7dc9('0x95')](_0x4c7c6b,_0x7dc9('0xed'));}delete this[_0x7dc9('0x13')][_0x117444[_0x7dc9('0xab')]];}if(!(_0x4c7c6b[_0x7dc9('0x71')]&&_0x2cf485==='16')){ut['updateOriginated'](_0x182bc6,_0x7dc9('0xee'));logger['info'](_0x7dc9('0xef'),_0x4c7c6b[_0x7dc9('0xae')],_0x7dc9('0xaf'),_0x182bc6[_0x7dc9('0x53')],'originated:\x20',_0x182bc6[_0x7dc9('0x5b')]);}if(_0x2cf485!==_0x7dc9('0xf0')){delete this['actions'][_0x117444[_0x7dc9('0xab')]];delete this[_0x7dc9('0x13')][_0x117444[_0x7dc9('0xf1')]];}}};Preview[_0x7dc9('0x61')]['callProgressDetectingAgent']=function(_0x3bbeee,_0x43a729,_0x330bf7){if(_[_0x7dc9('0xf2')](_0x43a729)&&_0x7dc9('0xf3')!==typeof _0x43a729){return;}if(_['isUndefined'](_0x330bf7)&&_0x7dc9('0xf3')!==typeof _0x330bf7){return;}switch(_0x330bf7[_0x7dc9('0xf4')]){case'0':ut[_0x7dc9('0xf5')](_0x3bbeee,0x0,_0x7dc9('0x9f'));rpcDb['createAgentHistory'](_0x3bbeee,_0x7dc9('0xf6'));break;case'3':ut['logAgent'](_0x3bbeee,0x3,'NoAnswer');rpcDb['createAgentHistory'](_0x3bbeee,_0x7dc9('0xf7'));break;case'5':ut[_0x7dc9('0xf5')](_0x3bbeee,0x5,_0x7dc9('0xbd'));rpcDb[_0x7dc9('0xf8')](_0x3bbeee,_0x7dc9('0xf9'));break;case'8':ut[_0x7dc9('0xf5')](_0x3bbeee,0x8,_0x7dc9('0xfa'));rpcDb[_0x7dc9('0xf8')](_0x3bbeee,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x7dc9('0xf5')](_0x3bbeee,0x16,_0x7dc9('0xfb'));rpcDb[_0x7dc9('0xf8')](_0x3bbeee,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x7dc9('0xf5')](_0x3bbeee,0xc,_0x330bf7[_0x7dc9('0xf4')]);rpcDb[_0x7dc9('0xf8')](_0x3bbeee,_0x7dc9('0xfc'));}ut[_0x7dc9('0x79')](_0x43a729,_0x7dc9('0xfd'));logger[_0x7dc9('0x55')](_0x7dc9('0xfe'),_0x3bbeee[_0x7dc9('0xae')],_0x7dc9('0xaf'),_0x43a729[_0x7dc9('0x53')],_0x7dc9('0x6f'),_0x43a729[_0x7dc9('0x5b')]);delete this[_0x7dc9('0x13')][_0x3bbeee[_0x7dc9('0xae')]];};Preview[_0x7dc9('0x61')][_0x7dc9('0xff')]=function(_0x809ae5,_0x4158eb,_0x26868d,_0x5e5ed6,_0x179bfd){var _0x530e6f=this;return new BPromise(function(_0x12c10b,_0x56e1ba){if(_['isNil'](_0x4158eb)||_[_0x7dc9('0x6d')](_0x4158eb[_0x7dc9('0x100')])||_['isNil'](_0x4158eb[_0x7dc9('0x100')]['phone'])||_[_0x7dc9('0x6d')](_0x4158eb[_0x7dc9('0x75')])){_0x56e1ba(ut['message']('Contact\x20is\x20undefined',_0x5e5ed6,_0x179bfd));return;}var _0x338c78=uuid['v4']();var _0xfb704a=_0x530e6f[_0x7dc9('0x25')][_0x4158eb[_0x7dc9('0x6e')]['name']];var _0x204694=_0x26868d?_0x530e6f[_0x7dc9('0x14')][_0x26868d]['id']:undefined;_0x530e6f['actions'][_0x338c78]=new Action(_0x4158eb,_0xfb704a,_0x338c78,_0x26868d,_0x204694);var _0x2df2c0=_0x530e6f[_0x7dc9('0x13')][_0x338c78];_0x2df2c0['unlockAgent']=_0x5e5ed6;_0x2df2c0['activeContact']=_0x179bfd;_0x2df2c0[_0x7dc9('0x101')]=_0x26868d;if(_[_0x7dc9('0x102')](_0x809ae5)){_0x530e6f[_0x7dc9('0x103')](_0x2df2c0,_0xfb704a,_0x4158eb,_0x26868d)[_0x7dc9('0x86')](function(_0x559cfc){logger[_0x7dc9('0x55')]('[Preview][execCall][success]','Queue:\x20'+_0x2df2c0[_0x7dc9('0x70')]+_0x7dc9('0x104')+_0x2df2c0[_0x7dc9('0x105')],JSON[_0x7dc9('0x50')](_0x559cfc));ami[_0x7dc9('0x26')](_0x7dc9('0x106'),ut[_0x7dc9('0xa0')](_0x2df2c0,'called',_0x530e6f[_0x7dc9('0x25')][_0x2df2c0[_0x7dc9('0x70')]]));_0x12c10b(ut[_0x7dc9('0x45')](_0x7dc9('0x107')));})[_0x7dc9('0x88')](function(_0x17c063){ut[_0x7dc9('0x5e')]('[Preview][execCall][failure]',_0x17c063);_0x56e1ba(ut[_0x7dc9('0x45')](_0x7dc9('0x108'),_0x5e5ed6,_0x179bfd));});}else{_0xfb704a[_0x7dc9('0x37')]+=0x1;ut[_0x7dc9('0x109')](_0x2df2c0);rpcDb[_0x7dc9('0x10a')](_0x2df2c0,'[Blacklist][error]');delete _0x530e6f[_0x7dc9('0x13')][_0x338c78];_0x56e1ba(ut['message'](_0x7dc9('0x10b'),_0x5e5ed6,_0x179bfd));}});};Preview[_0x7dc9('0x61')]['isTrunkReachable']=function(_0x438d70){return!_[_0x7dc9('0x6d')](_0x438d70)&&!_[_0x7dc9('0x6d')](_0x438d70[_0x7dc9('0x53')])&&!_[_0x7dc9('0x6d')](_0x438d70[_0x7dc9('0x4d')])&&_0x438d70['active']&&!_[_0x7dc9('0x6d')](this[_0x7dc9('0x12')][util['format'](_0x7dc9('0x10c'),_0x438d70[_0x7dc9('0x53')])])&&!_['isNil'](this['trunks'][util[_0x7dc9('0x52')](_0x7dc9('0x10c'),_0x438d70[_0x7dc9('0x53')])]['status'])&&(this[_0x7dc9('0x12')][util['format'](_0x7dc9('0x10c'),_0x438d70[_0x7dc9('0x53')])][_0x7dc9('0x10d')]==='reachable'||this[_0x7dc9('0x12')][util['format']('SIP/%s',_0x438d70[_0x7dc9('0x53')])][_0x7dc9('0x10d')]===_0x7dc9('0x10e'));};Preview[_0x7dc9('0x61')][_0x7dc9('0x85')]=function(_0x56d169,_0x510a56){var _0x26f2b3=this;return new BPromise(function(_0x46162c,_0x13e685){_0x26f2b3[_0x7dc9('0x10f')](_0x56d169,_0x510a56)['then'](function(_0x42706e){_0x46162c(_['pick'](_0x42706e,[_0x7dc9('0x45')]));})['catch'](function(_0x393ea7){if(_0x393ea7[_0x7dc9('0x110')]){rpcDb['unlockContact'](_0x56d169);}if(_0x393ea7[_0x7dc9('0x4d')]){rpcDb[_0x7dc9('0x8a')](_0x56d169);}_0x13e685(_[_0x7dc9('0x72')](_0x393ea7,[_0x7dc9('0x45')]));});});};Preview[_0x7dc9('0x61')]['execRun']=function(_0x2491ea,_0x1ec900){var _0x34f00c=this;return new BPromise(function(_0x220625,_0x4b3637){var _0x435eb3,_0x43f718;rpcDb[_0x7dc9('0x111')](_0x2491ea)[_0x7dc9('0x86')](function(_0x48be46){if(!_['isNil'](_0x48be46[0x0])){_0x43f718=_0x48be46[0x0]['recallme']?![]:!![];_0x435eb3=_0x48be46[0x0][_0x7dc9('0x112')]?!![]:![];_0x435eb3=_0x1ec900?!![]:_0x435eb3;}var _0x30e562=_0x34f00c[_0x7dc9('0x113')](_0x48be46);if(_0x30e562[_0x7dc9('0x114')]){rpcDb['checkIsBlackList'](_[_0x7dc9('0x72')](_0x48be46[0x0],['VoiceQueueId','Contact.phone']))['then'](function(_0x2e1bf9){_0x34f00c[_0x7dc9('0xff')](_0x2e1bf9,_0x48be46[0x0],_0x1ec900,_0x43f718,_0x435eb3)[_0x7dc9('0x86')](function(_0x1c8358){_0x220625(_0x1c8358);})['catch'](function(_0x5025c2){_0x4b3637(_0x5025c2);});})['catch'](function(_0x4640f0){ut[_0x7dc9('0x5e')](_0x7dc9('0x115'),_0x4640f0);_0x4b3637(ut[_0x7dc9('0x45')](_0x7dc9('0x116'),_0x43f718,_0x435eb3));});}else{_0x4b3637(ut[_0x7dc9('0x45')](_0x30e562['message'],_0x43f718,_0x435eb3));}})[_0x7dc9('0x88')](function(_0x34ef15){ut[_0x7dc9('0x5e')](_0x7dc9('0x117'),_0x34ef15);_0x4b3637(ut[_0x7dc9('0x45')](_0x7dc9('0x116'),![],!![]));});});};Preview[_0x7dc9('0x61')]['validateContact']=function(_0x4c59ea){if(_[_0x7dc9('0x6d')](_0x4c59ea)||_[_0x7dc9('0x102')](_0x4c59ea)||!_[_0x7dc9('0x6d')](_0x4c59ea[0x0]['Agent'])&&_[_0x7dc9('0x6d')](_0x4c59ea[0x0][_0x7dc9('0x83')][_0x7dc9('0x53')])){ut[_0x7dc9('0x5e')](_0x7dc9('0x118'),_0x4c59ea);return{'isValid':![],'message':_0x7dc9('0x119')};}var _0x25a6f9=this[_0x7dc9('0x25')][_0x4c59ea[0x0][_0x7dc9('0x6e')][_0x7dc9('0x53')]];_0x25a6f9[_0x7dc9('0x45')]=_0x7dc9('0x9a');if(_[_0x7dc9('0x6d')](_0x25a6f9)){ut[_0x7dc9('0x5e')]('[Preview][validateContact][Empty\x20Campaign]',_0x25a6f9);return{'isValid':![],'message':_0x7dc9('0x11a')};}if(!this[_0x7dc9('0x98')](_0x25a6f9[_0x7dc9('0x4c')])){ut[_0x7dc9('0x5e')](_0x7dc9('0x11b'),_0x7dc9('0x11c')+_0x25a6f9['name']+_0x7dc9('0x11d'));if(!this[_0x7dc9('0x98')](_0x25a6f9[_0x7dc9('0x99')])){ut[_0x7dc9('0x5e')](_0x7dc9('0x11b'),_0x25a6f9['name']+_0x7dc9('0x11e'));return{'isValid':![],'message':_0x7dc9('0x11f')};}}if(!ut['isActive'](_0x25a6f9[_0x7dc9('0x67')])){ut['logger'](_0x7dc9('0x120'),_0x25a6f9[_0x7dc9('0x53')]+_0x7dc9('0x121'));return{'isValid':![],'message':_0x7dc9('0x11c')+_0x25a6f9[_0x7dc9('0x53')]+_0x7dc9('0x121')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview['prototype'][_0x7dc9('0x103')]=function(_0x163919,_0x5c4a53,_0x2310bd,_0x44ec1b){var _0x3529c3=this;return new BPromise(function(_0x3c3c04,_0x143efb){var _0x468b00=_0x163919[_0x7dc9('0xae')];var _0x4185ab=_0x3529c3[_0x7dc9('0x98')](_0x5c4a53[_0x7dc9('0x4c')])?util['format'](_0x7dc9('0x122'),_0x5c4a53[_0x7dc9('0x4c')][_0x7dc9('0x53')],_['isNil'](_0x5c4a53[_0x7dc9('0x34')])?'':_0x5c4a53[_0x7dc9('0x34')][_0x7dc9('0x123')]()||'',_0x5c4a53['dialCutDigit']>0x0?_0x2310bd[_0x7dc9('0x100')][_0x7dc9('0x124')]['substring'](_0x5c4a53[_0x7dc9('0x125')]):_0x2310bd[_0x7dc9('0x100')][_0x7dc9('0x124')]):util[_0x7dc9('0x52')](_0x7dc9('0x122'),_[_0x7dc9('0x6d')](_0x5c4a53[_0x7dc9('0x99')])?_0x5c4a53[_0x7dc9('0x4c')][_0x7dc9('0x53')]:_0x5c4a53[_0x7dc9('0x99')][_0x7dc9('0x53')],_[_0x7dc9('0x6d')](_0x5c4a53[_0x7dc9('0x34')])?'':_0x5c4a53[_0x7dc9('0x34')][_0x7dc9('0x123')]()||'',_0x5c4a53[_0x7dc9('0x125')]>0x0?_0x2310bd[_0x7dc9('0x100')]['phone']['substring'](_0x5c4a53[_0x7dc9('0x125')]):_0x2310bd[_0x7dc9('0x100')][_0x7dc9('0x124')]);var _0x125242=_0x3529c3['isTrunkReachable'](_0x5c4a53[_0x7dc9('0x4c')])?ut[_0x7dc9('0x126')](_0x5c4a53[_0x7dc9('0x4c')][_0x7dc9('0x4e')],_0x5c4a53[_0x7dc9('0x32')],_0x5c4a53[_0x7dc9('0x127')]>0x0?ut[_0x7dc9('0x128')](_0x5c4a53['dialOriginateCallerIdNumber'],_0x5c4a53[_0x7dc9('0x127')]):_0x5c4a53[_0x7dc9('0x129')]):ut[_0x7dc9('0x126')](_['isNil'](_0x5c4a53[_0x7dc9('0x99')])?_0x5c4a53['Trunk'][_0x7dc9('0x4e')]:_0x5c4a53[_0x7dc9('0x99')][_0x7dc9('0x4e')],_0x5c4a53[_0x7dc9('0x32')],_0x5c4a53[_0x7dc9('0x127')]>0x0?ut[_0x7dc9('0x128')](_0x5c4a53['dialOriginateCallerIdNumber'],_0x5c4a53[_0x7dc9('0x127')]):_0x5c4a53[_0x7dc9('0x129')]);if(_0x125242){_0x163919[_0x7dc9('0x12a')]=ut[_0x7dc9('0x12b')](_0x125242);_0x163919[_0x7dc9('0x12c')]=ut['extractCalleridNumber'](_0x125242);}var _0x5d84b1=ut['addVariables'](_0x5c4a53,_0x2310bd,_0x4185ab,_0x125242,_0x468b00,_0x163919);_[_0x7dc9('0x12d')](_0x163919,ut[_0x7dc9('0x12e')](_0x5d84b1));_0x163919[_0x7dc9('0x12f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ami[_0x7dc9('0x77')](ut['variablesAction'](_0x163919,_0x5c4a53,_0x5d84b1,_0x163919[_0x7dc9('0xaa')],_0x44ec1b))[_0x7dc9('0x86')](function(_0x5bb362){_0x5c4a53['originated']+=0x1;logger['info'](_0x7dc9('0x130'),_0x468b00,_0x7dc9('0xaf'),_0x5c4a53[_0x7dc9('0x53')],_0x7dc9('0x6f'),_0x5c4a53[_0x7dc9('0x5b')]);_0x3c3c04(_0x5bb362);})[_0x7dc9('0x88')](function(_0x112461){ut[_0x7dc9('0xf5')](_0x163919,0xe,_0x7dc9('0x131'));rpcDb[_0x7dc9('0xf8')](_0x163919,_0x7dc9('0x132'));_0x143efb(_0x112461);});});};Preview[_0x7dc9('0x61')][_0x7dc9('0x1f')]=function(_0x593fa1){if(this['actions'][_0x593fa1[_0x7dc9('0xab')]]){this[_0x7dc9('0x13')][_0x593fa1[_0x7dc9('0xab')]][_0x7dc9('0x133')]=_0x593fa1[_0x7dc9('0x133')];}};Preview[_0x7dc9('0x61')][_0x7dc9('0x17')]=function(_0x32a792){var _0x2033ea=this;var _0x1194b5=this[_0x7dc9('0x13')][_0x32a792[_0x7dc9('0x134')]];if(_0x1194b5){if(_0x1194b5['lookAgent']&&this[_0x7dc9('0x14')][_0x1194b5[_0x7dc9('0x101')]]){ut[_0x7dc9('0x135')](_0x1194b5,this[_0x7dc9('0x14')][_0x1194b5[_0x7dc9('0x101')]][_0x7dc9('0x53')],this[_0x7dc9('0x14')][_0x1194b5[_0x7dc9('0x101')]]['id']);}var _0x3ea91e=_[_0x7dc9('0x136')](_0x1194b5);_0x3ea91e[_0x7dc9('0x137')]=moment()[_0x7dc9('0x52')](_0x7dc9('0x8b'));var _0x3ca6ce=_0x2033ea[_0x7dc9('0x25')][_0x1194b5['queue']];if(ut[_0x7dc9('0x138')](_0x32a792[_0x7dc9('0x139')])){if(_0x1194b5[_0x7dc9('0xa9')]){rpcDb[_0x7dc9('0x13a')](_0x1194b5[_0x7dc9('0x105')]);}if(_0x1194b5['activeContact']){rpcDb[_0x7dc9('0x8a')](_0x1194b5[_0x7dc9('0x105')]);}ami[_0x7dc9('0x26')](_0x7dc9('0x13b'),ut['buildObj'](_0x1194b5,_0x7dc9('0x13c'),this[_0x7dc9('0x25')][_0x1194b5[_0x7dc9('0x70')]]));this['callProgressDetectingAgent'](_0x3ea91e,_0x3ca6ce,_0x32a792);}else{_0x1194b5[_0x7dc9('0x12f')]=moment()['format'](_0x7dc9('0x8b'));ut['logAgent'](_0x3ea91e,0x4,_0x7dc9('0x13d'));rpcDb[_0x7dc9('0xf8')](_0x3ea91e,'[callProgressDetectingAgent][logAnswer]');}}};Preview['prototype'][_0x7dc9('0x13e')]=function(_0x151c57){var _0x3e7472=this;var _0x2dd442=this[_0x7dc9('0x13')][_0x151c57[_0x7dc9('0xab')]];var _0x413f4d;if(_0x2dd442){_0x413f4d=this['campaignsPreview'][_0x2dd442[_0x7dc9('0x70')]];logger[_0x7dc9('0x55')]('[syncHangup][talking]',_0x151c57[_0x7dc9('0xab')],_0x7dc9('0xaf'),_0x413f4d[_0x7dc9('0x53')],'pTalking:\x20',_0x413f4d[_0x7dc9('0x2b')]);}if(this['actions'][_0x151c57[_0x7dc9('0xab')]]&&_0x151c57[_0x7dc9('0xab')]!==_0x151c57['uniqueid']){if(_0x151c57[_0x7dc9('0x13f')]==='16'&&this['actions'][_0x151c57[_0x7dc9('0xab')]][_0x7dc9('0x71')]){this[_0x7dc9('0x9b')](_0x151c57,_0x151c57[_0x7dc9('0xab')],_0x151c57[_0x7dc9('0x13f')]);}else if(this['actions'][_0x151c57[_0x7dc9('0xab')]][_0x7dc9('0x71')]){logger[_0x7dc9('0x55')](_0x7dc9('0x140'),_0x151c57[_0x7dc9('0xab')],_0x151c57['cause'],_0x7dc9('0xaf'),_0x413f4d[_0x7dc9('0x53')],_0x7dc9('0xb0'),_0x413f4d[_0x7dc9('0x2b')]);this['callProgressDetectingCustomer'](_0x151c57,_0x151c57['linkedid'],_0x151c57['cause']);}}else if(_0x2dd442&&_[_0x7dc9('0x6d')](_0x2dd442[_0x7dc9('0x141')])&&_0x413f4d[_0x7dc9('0x142')]&&_0x151c57['linkedid']===_0x151c57[_0x7dc9('0xae')]&&_[_0x7dc9('0x6d')](_0x151c57[_0x7dc9('0xf4')])&&_0x151c57[_0x7dc9('0x13f')]==='16'&&_0x151c57[_0x7dc9('0x143')]==='6'&&_[_0x7dc9('0xf2')](_0x2dd442[_0x7dc9('0x144')])){if(_0x2dd442[_0x7dc9('0xa9')]){rpcDb[_0x7dc9('0x13a')](_0x2dd442[_0x7dc9('0x105')]);}if(_0x2dd442['activeContact']){rpcDb[_0x7dc9('0x8a')](_0x2dd442[_0x7dc9('0x105')]);}_0x151c57[_0x7dc9('0xf4')]='22';this['callProgressDetectingAgent'](_0x2dd442,_0x413f4d,_0x151c57);}else if(_0x2dd442&&_0x2dd442[_0x7dc9('0x144')]){if(_0x151c57[_0x7dc9('0x13f')]==='16'&&this[_0x7dc9('0x13')][_0x151c57[_0x7dc9('0xab')]]['dialAnswer']){logger[_0x7dc9('0x55')](_0x7dc9('0x145'),_0x151c57['linkedid'],_0x151c57['cause'],'\x20Queue',_0x413f4d['name'],_0x7dc9('0xb0'),_0x413f4d[_0x7dc9('0x2b')]);this[_0x7dc9('0x9b')](_0x151c57,_0x151c57['linkedid'],_0x151c57[_0x7dc9('0x13f')]);}else if(this[_0x7dc9('0x13')][_0x151c57[_0x7dc9('0xab')]]['dialAnswer']){logger['info'](_0x7dc9('0x140'),_0x151c57[_0x7dc9('0xab')],_0x151c57[_0x7dc9('0x13f')],'\x20Queue',_0x413f4d[_0x7dc9('0x53')],_0x7dc9('0xb0'),_0x413f4d[_0x7dc9('0x2b')]);this[_0x7dc9('0x9b')](_0x151c57,_0x151c57[_0x7dc9('0xab')],_0x151c57[_0x7dc9('0x13f')]);}}};Preview[_0x7dc9('0x61')][_0x7dc9('0x1d')]=function(_0x3ac91d){if(this['actions'][_0x3ac91d[_0x7dc9('0xf1')]]&&_0x3ac91d['destlinkedid']!==_0x3ac91d['destuniqueid']){this[_0x7dc9('0x9b')](_0x3ac91d,_0x3ac91d[_0x7dc9('0xf1')],_0x3ac91d[_0x7dc9('0xe7')]);}};Preview[_0x7dc9('0x61')][_0x7dc9('0x1b')]=function(_0x1b617c){if(this[_0x7dc9('0x13')][_0x1b617c[_0x7dc9('0xab')]]&&_0x1b617c[_0x7dc9('0xab')]!==_0x1b617c['uniqueid']&&!this['actions'][_0x1b617c[_0x7dc9('0xab')]][_0x7dc9('0x71')]){if(_0x1b617c[_0x7dc9('0x13f')]==='1'){this[_0x7dc9('0x9b')](_0x1b617c,_0x1b617c[_0x7dc9('0xab')],_0x1b617c['cause']);}}};Preview[_0x7dc9('0x61')][_0x7dc9('0x146')]=function(_0x4f4e80,_0x476da8,_0x450ca7){if(this['actions'][_0x4f4e80]){if(_[_0x7dc9('0x6d')](this['actions'][_0x4f4e80][_0x7dc9('0x147')])){this['actions'][_0x4f4e80][_0x7dc9('0x147')]={};}this[_0x7dc9('0x13')][_0x4f4e80][_0x7dc9('0x147')][_0x476da8]=_0x450ca7;}};Preview[_0x7dc9('0x61')]['syncVarSet']=function(_0x5def76){try{if(!_[_0x7dc9('0x6d')](_0x5def76)){if(ut[_0x7dc9('0x148')](_['keys'](_0x5def76[_0x7dc9('0x149')])[0x0])){this[_0x7dc9('0x146')](_0x5def76[_0x7dc9('0xae')],_[_0x7dc9('0x14a')](_0x5def76[_0x7dc9('0x149')])[0x0],_0x5def76[_0x7dc9('0x14b')]);}}}catch(_0x2f3282){logger['error'](_0x7dc9('0x14c'),util[_0x7dc9('0x14d')](_0x2f3282,{'showHidden':![],'depth':null}));}};Preview[_0x7dc9('0x61')][_0x7dc9('0x14e')]=function(_0x5e7cf2){if(_0x5e7cf2){if(this[_0x7dc9('0x13')][_0x5e7cf2[_0x7dc9('0x14f')]]){this[_0x7dc9('0x13')][_0x5e7cf2[_0x7dc9('0x14f')]][_0x7dc9('0x144')]=!![];}}};Preview['prototype'][_0x7dc9('0x23')]=function(_0x276c04){if(_0x276c04){if(this[_0x7dc9('0x13')][_0x276c04[_0x7dc9('0x150')]]){this[_0x7dc9('0x13')][_0x276c04[_0x7dc9('0x150')]][_0x7dc9('0x144')]=!![];}}};module[_0x7dc9('0x151')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index c042f00..5707ff6 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 _0x9b6e=['rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueReport','error','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','UserId','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','getContactRecallMe','[GetContactRecallMe]\x20'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0x9b6e,0x1d2));var _0xe9b6=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x9b6e[_0x1b2ff7];return _0x31656a;};'use strict';var util=require(_0xe9b6('0x0'));var BPromise=require(_0xe9b6('0x1'));var logger=require(_0xe9b6('0x2'))(_0xe9b6('0x3'));var _=require(_0xe9b6('0x4'));var cmHopper=require(_0xe9b6('0x5'));var cmHopperFinal=require(_0xe9b6('0x6'));var cmHopperHistory=require(_0xe9b6('0x7'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xe9b6('0x8'));function loggerCatch(_0x41843b){return function(_0x542e05){logger[_0xe9b6('0x9')](_0x41843b,util['inspect'](_0x542e05,{'showHidden':![],'depth':null}));};}function create(_0x316b88){return BPromise[_0xe9b6('0xa')]()[_0xe9b6('0xb')](cmHopperHistory[_0xe9b6('0xc')](_0x316b88))[_0xe9b6('0xd')](loggerCatch(_0xe9b6('0xe')));}function createAgent(_0x2c9d50){return BPromise[_0xe9b6('0xa')]()['then'](agentReportPreview[_0xe9b6('0xc')](_0x2c9d50))['catch'](loggerCatch(_0xe9b6('0xe')));}function moveContact(_0x4d4adf){return BPromise['resolve']()['then'](cmHopper[_0xe9b6('0xf')](_0x4d4adf,!![]))[_0xe9b6('0xd')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xe9b6('0x10')]=function(_0xe53653){return BPromise['resolve']()['then'](cmHopperBlack['checkIsBlackList'](_0xe53653))[_0xe9b6('0xd')](loggerCatch(_0xe9b6('0x11')));};exports[_0xe9b6('0x12')]=function(_0x1d16e1){return BPromise['resolve']()[_0xe9b6('0xb')](cmHopper[_0xe9b6('0x12')](_0x1d16e1))[_0xe9b6('0xd')](loggerCatch(_0xe9b6('0x13')));};exports[_0xe9b6('0xc')]=function(_0x3ec6b0,_0xe4e090){create(_0x3ec6b0)['catch'](loggerCatch(_0xe4e090));moveContact(_0x3ec6b0)[_0xe9b6('0xd')](loggerCatch(_0xe4e090));};exports['createAgentHistory']=function(_0x2ee164,_0x3935f6){createAgent(_0x2ee164)['catch'](loggerCatch(_0x3935f6));};exports[_0xe9b6('0x14')]=function(_0x405352,_0x5bf6a2){create(_0x405352)[_0xe9b6('0xd')](loggerCatch(_0x5bf6a2));};exports[_0xe9b6('0x15')]=function(_0xf343c0,_0xcb6974){moveContact(_0xf343c0)[_0xe9b6('0xd')](loggerCatch(_0xcb6974));};exports['rescheduleContact']=function(_0x24f7c0,_0x741048,_0x44e0a6){if(_0x741048){_0x24f7c0[_0xe9b6('0x16')]=null;}if(_0x44e0a6){_0x24f7c0[_0xe9b6('0x17')]=![];}return BPromise[_0xe9b6('0xa')]()[_0xe9b6('0xb')](cmHopper[_0xe9b6('0x18')](_0x24f7c0))[_0xe9b6('0xd')](loggerCatch(_0xe9b6('0x19')));};exports[_0xe9b6('0x1a')]=function(_0x3954dd){return BPromise[_0xe9b6('0xa')]()[_0xe9b6('0xb')](cmHopper[_0xe9b6('0x1a')](_0x3954dd))[_0xe9b6('0xd')](loggerCatch(_0xe9b6('0x1b')));};exports[_0xe9b6('0x1c')]=function(_0x17be40){return BPromise[_0xe9b6('0xa')]()[_0xe9b6('0xb')](cmHopper[_0xe9b6('0x1c')]({'UserId':null},_0x17be40,0x1))['catch'](loggerCatch(_0xe9b6('0x1d')));};exports['disableContact']=function(_0x3e5bf0){return BPromise[_0xe9b6('0xa')]()['then'](cmHopper['unlockContact']({'active':![]},_0x3e5bf0,0x1))['catch'](loggerCatch(_0xe9b6('0x1e')));};exports[_0xe9b6('0x1f')]=function(_0x4c16e2){var _0x444074={};_0x444074[_0xe9b6('0x20')]=_0x4c16e2[_0xe9b6('0x20')];_0x444074[_0xe9b6('0x21')]=_0x4c16e2[_0xe9b6('0x21')];_0x444074[_0xe9b6('0x22')]=_0x4c16e2[_0xe9b6('0x22')];_0x444074['calleridname']=_0x4c16e2[_0xe9b6('0x23')];_0x444074[_0xe9b6('0x24')]=_0x4c16e2[_0xe9b6('0x24')];_0x444074[_0xe9b6('0x25')]=_0x4c16e2['answertime'];_0x444074[_0xe9b6('0x26')]=_0x4c16e2[_0xe9b6('0x27')];_0x444074[_0xe9b6('0x28')]=0x1;_0x444074[_0xe9b6('0x29')]=_0x4c16e2[_0xe9b6('0x2a')];_0x444074[_0xe9b6('0x2b')]=_0x4c16e2[_0xe9b6('0x2c')];_0x444074[_0xe9b6('0x2d')]=_0xe9b6('0x2e');_0x444074[_0xe9b6('0x2f')]=_0xe9b6('0x30');_0x444074[_0xe9b6('0x31')]=0x0;_0x444074[_0xe9b6('0x32')]=0x1;_0x444074[_0xe9b6('0x33')]=_0x4c16e2[_0xe9b6('0x2c')];_0x444074[_0xe9b6('0x34')]=_0xe9b6('0x35');return BPromise[_0xe9b6('0xa')]()[_0xe9b6('0xb')](voiceQueueReport['create'](_0x444074))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports['getContactRecallMe']=function(_0x3c572e,_0x28fa94){return BPromise[_0xe9b6('0xa')]()['then'](cmHopper[_0xe9b6('0x36')](_0x3c572e,_0x28fa94))[_0xe9b6('0xd')](loggerCatch(_0xe9b6('0x37')));};exports[_0xe9b6('0x38')]=function(_0x93e464){return BPromise[_0xe9b6('0xa')]()[_0xe9b6('0xb')](cmHopper[_0xe9b6('0x18')](_0x93e464,!![],!![]))['catch'](loggerCatch(_0xe9b6('0x39')));}; \ No newline at end of file +var _0xd9c1=['[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','membername','context','from-sip','exten','holdtime','assigned','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','util','bluebird','preview','lodash','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','inspect','resolve','createHistory','catch','[createHistory]\x20','then'];(function(_0x52e5fb,_0x49aeff){var _0x1dbeaf=function(_0x419031){while(--_0x419031){_0x52e5fb['push'](_0x52e5fb['shift']());}};_0x1dbeaf(++_0x49aeff);}(_0xd9c1,0x104));var _0x1d9c=function(_0x2dae37,_0x537a9a){_0x2dae37=_0x2dae37-0x0;var _0x32a2c3=_0xd9c1[_0x2dae37];return _0x32a2c3;};'use strict';var util=require(_0x1d9c('0x0'));var BPromise=require(_0x1d9c('0x1'));var logger=require('../../../config/logger')(_0x1d9c('0x2'));var _=require(_0x1d9c('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x1d9c('0x4'));var cmHopperHistory=require(_0x1d9c('0x5'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x1d9c('0x6'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x1d9c('0x7'));function loggerCatch(_0x4da851){return function(_0x85913a){logger[_0x1d9c('0x8')](_0x4da851,util[_0x1d9c('0x9')](_0x85913a,{'showHidden':![],'depth':null}));};}function create(_0xa99daf){return BPromise[_0x1d9c('0xa')]()['then'](cmHopperHistory[_0x1d9c('0xb')](_0xa99daf))[_0x1d9c('0xc')](loggerCatch(_0x1d9c('0xd')));}function createAgent(_0x591144){return BPromise[_0x1d9c('0xa')]()[_0x1d9c('0xe')](agentReportPreview[_0x1d9c('0xb')](_0x591144))['catch'](loggerCatch(_0x1d9c('0xd')));}function moveContact(_0x374383){return BPromise[_0x1d9c('0xa')]()[_0x1d9c('0xe')](cmHopper['moveContactManagedDialer'](_0x374383,!![]))[_0x1d9c('0xc')](loggerCatch(_0x1d9c('0xf')));}exports['checkIsBlackList']=function(_0x337c28){return BPromise[_0x1d9c('0xa')]()[_0x1d9c('0xe')](cmHopperBlack[_0x1d9c('0x10')](_0x337c28))[_0x1d9c('0xc')](loggerCatch(_0x1d9c('0x11')));};exports[_0x1d9c('0x12')]=function(_0x1b3760){return BPromise['resolve']()[_0x1d9c('0xe')](cmHopper[_0x1d9c('0x12')](_0x1b3760))['catch'](loggerCatch(_0x1d9c('0x13')));};exports[_0x1d9c('0xb')]=function(_0x36a218,_0x365e9a){create(_0x36a218)['catch'](loggerCatch(_0x365e9a));moveContact(_0x36a218)[_0x1d9c('0xc')](loggerCatch(_0x365e9a));};exports[_0x1d9c('0x14')]=function(_0x57e983,_0x2dadc8){createAgent(_0x57e983)[_0x1d9c('0xc')](loggerCatch(_0x2dadc8));};exports[_0x1d9c('0x15')]=function(_0x5aef61,_0x216adf){create(_0x5aef61)[_0x1d9c('0xc')](loggerCatch(_0x216adf));};exports[_0x1d9c('0x16')]=function(_0x923201,_0x17a757){moveContact(_0x923201)[_0x1d9c('0xc')](loggerCatch(_0x17a757));};exports[_0x1d9c('0x17')]=function(_0x1f23ee,_0x31f7b6,_0x48f5de){if(_0x31f7b6){_0x1f23ee[_0x1d9c('0x18')]=null;}if(_0x48f5de){_0x1f23ee[_0x1d9c('0x19')]=![];}return BPromise[_0x1d9c('0xa')]()[_0x1d9c('0xe')](cmHopper[_0x1d9c('0x17')](_0x1f23ee))['catch'](loggerCatch(_0x1d9c('0x1a')));};exports[_0x1d9c('0x1b')]=function(_0x20a2cf){return BPromise[_0x1d9c('0xa')]()[_0x1d9c('0xe')](cmHopper[_0x1d9c('0x1b')](_0x20a2cf))[_0x1d9c('0xc')](loggerCatch('[countReScheduled]\x20'));};exports[_0x1d9c('0x1c')]=function(_0x226415){return BPromise[_0x1d9c('0xa')]()[_0x1d9c('0xe')](cmHopper[_0x1d9c('0x1c')]({'UserId':null},_0x226415,0x1))[_0x1d9c('0xc')](loggerCatch(_0x1d9c('0x1d')));};exports[_0x1d9c('0x1e')]=function(_0x2af54c){return BPromise[_0x1d9c('0xa')]()[_0x1d9c('0xe')](cmHopper[_0x1d9c('0x1c')]({'active':![]},_0x2af54c,0x1))[_0x1d9c('0xc')](loggerCatch(_0x1d9c('0x1f')));};exports[_0x1d9c('0x20')]=function(_0x3264c0){var _0x50835c={};_0x50835c[_0x1d9c('0x21')]=_0x3264c0[_0x1d9c('0x21')];_0x50835c[_0x1d9c('0x22')]=_0x3264c0['uniqueid'];_0x50835c['calleridnum']=_0x3264c0[_0x1d9c('0x23')];_0x50835c['calleridname']=_0x3264c0[_0x1d9c('0x24')];_0x50835c[_0x1d9c('0x25')]=_0x3264c0[_0x1d9c('0x25')];_0x50835c[_0x1d9c('0x26')]=_0x3264c0[_0x1d9c('0x27')];_0x50835c[_0x1d9c('0x28')]=_0x3264c0[_0x1d9c('0x27')];_0x50835c[_0x1d9c('0x29')]=0x1;_0x50835c['queuecallercompleteAt']=_0x3264c0[_0x1d9c('0x2a')];_0x50835c['connectedlinename']=_0x3264c0[_0x1d9c('0x2b')];_0x50835c[_0x1d9c('0x2c')]=_0x1d9c('0x2d');_0x50835c[_0x1d9c('0x2e')]='xcally-motion-preview';_0x50835c[_0x1d9c('0x2f')]=0x0;_0x50835c[_0x1d9c('0x30')]=0x1;_0x50835c['lastAssignedTo']=_0x3264c0[_0x1d9c('0x2b')];_0x50835c[_0x1d9c('0x31')]=_0x1d9c('0x32');return BPromise[_0x1d9c('0xa')]()['then'](voiceQueueReport[_0x1d9c('0x33')](_0x50835c))[_0x1d9c('0xc')](loggerCatch(_0x1d9c('0x34')));};exports['getContactRecallMe']=function(_0x5cc50c,_0x37a065){return BPromise[_0x1d9c('0xa')]()[_0x1d9c('0xe')](cmHopper[_0x1d9c('0x35')](_0x5cc50c,_0x37a065))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x1d9c('0x36')]=function(_0x311e95){return BPromise['resolve']()[_0x1d9c('0xe')](cmHopper[_0x1d9c('0x17')](_0x311e95,!![],!![]))[_0x1d9c('0xc')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 4ffd38f..74e7188 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 _0x7f8f=['getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','util','lodash','moment','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','name','calleridnum','ContactId','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','Contact','tags','createdAt','XMD-','toUpper','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','endtime','logAgent','statedesc','responsetime','ringtime','logLookAgent','UserId','logCustomer','starttime','talktime','answertime','Failure','variablesAction','RECALL','calleridname','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','scheduledAt','scheduledat','minutes','ListId','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','queue','interface','motionChannel','voice','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','push','getDiff','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','membername','active','countnoanswerretry','callbackuniqueid','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid'];(function(_0x4f30bd,_0xf47f9b){var _0x457faa=function(_0x3ff51a){while(--_0x3ff51a){_0x4f30bd['push'](_0x4f30bd['shift']());}};_0x457faa(++_0xf47f9b);}(_0x7f8f,0x121));var _0xf7f8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7f8f[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0xf7f8('0x0'));var _=require(_0xf7f8('0x1'));var moment=require(_0xf7f8('0x2'));var logger=require('../../../../config/logger')(_0xf7f8('0x3'));var ipAgi=process[_0xf7f8('0x4')][_0xf7f8('0x5')]||_0xf7f8('0x6');function getSeconds(_0x5e93d4,_0x112cc5){var _0x42fa42=moment(_0x5e93d4)[_0xf7f8('0x7')](0x0);var _0x4264f5=moment(_0x112cc5)[_0xf7f8('0x7')](0x0);return _0x42fa42[_0xf7f8('0x8')](_0x4264f5,_0xf7f8('0x9'));}exports[_0xf7f8('0xa')]=function(_0x381361){return function(_0x2f7f4f){logger[_0xf7f8('0xb')](_0x381361,util[_0xf7f8('0xc')](_0x2f7f4f,{'showHidden':![],'depth':null}));};};exports[_0xf7f8('0xd')]=function(_0x38f4ed,_0x10eed6){logger[_0xf7f8('0xe')](_0x38f4ed,util[_0xf7f8('0xc')](_0x10eed6,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x4f597a,_0x50438a){logger['error'](_0x4f597a,util[_0xf7f8('0xc')](_0x50438a,{'showHidden':![],'depth':null}));};exports[_0xf7f8('0xf')]=function(_0x17c6f4){return function(_0x450bec){logger[_0xf7f8('0xe')](_0x17c6f4,util['inspect'](_0x450bec,{'showHidden':![],'depth':null}));};};exports[_0xf7f8('0x10')]=function(_0x55e81e,_0x1c7918,_0xa14f4f){return{'message':_0x55e81e,'unlock':_0x1c7918,'active':_0xa14f4f};};exports[_0xf7f8('0x11')]=function(_0x526612,_0x15d3a4,_0xc5704){if(!_[_0xf7f8('0x12')](_0xc5704)&&_0xf7f8('0x13')===typeof _0xc5704&&!_['isEmpty'](_0xc5704)){if(!_['isUndefined'](_0x15d3a4)&&_0xf7f8('0x13')===typeof _0x15d3a4&&!_[_0xf7f8('0x14')](_0x15d3a4)){return util[_0xf7f8('0x15')](_0xf7f8('0x16'),_0x15d3a4,_0xc5704);}return util['format']('\x22%s\x22\x20<%s>',_0xc5704,_0xc5704);}if(!_['isUndefined'](_0x526612)&&'string'===typeof _0x526612&&!_[_0xf7f8('0x14')](_0x526612)){return _0x526612;}return'\x22\x22\x20<>';};exports[_0xf7f8('0x17')]=function(_0x1ff33e){if(_[_0xf7f8('0x18')](_0x1ff33e)){return![];}return _0x1ff33e;};exports[_0xf7f8('0x19')]=function(_0x5be475,_0x39cac3,_0x11aacf,_0x472018,_0x4168b2,_0x4aa81e){var _0x272712={'XMD-QUEUE':_0x39cac3[_0xf7f8('0x1a')]?_0x39cac3['Queue'][_0xf7f8('0x1b')]:'','XMD-CALLERID':_0x472018,'XMD-CALLERID-PREVIEW':_0x4aa81e?util[_0xf7f8('0x15')](_0xf7f8('0x16'),_0x4aa81e['calleridname'],_0x4aa81e[_0xf7f8('0x1c')]):_0x472018,'XMD-DIALID':_0x4168b2,'XMD-CONTACTID':_0x39cac3[_0xf7f8('0x1d')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x472018,'XMD-VOICEQUEUEID':_0x39cac3[_0xf7f8('0x1e')],'XMD-DIALCHANNEL':_0x11aacf,'XMD-DIALTIMEOUT':_0x5be475[_0xf7f8('0x1f')]||0x1e,'XMD-DIALOPTIONS':util[_0xf7f8('0x15')]('\x22rtTxX%s%s\x22',_0x5be475[_0xf7f8('0x20')]?'g':'',_[_0xf7f8('0x14')](_0x5be475[_0xf7f8('0x21')])?'':_0xf7f8('0x22')),'XMD-DIALURL':_0x5be475[_0xf7f8('0x23')]||'','XMD-AGI':_0x5be475['dialQueueProject']?util[_0xf7f8('0x15')](_0xf7f8('0x24'),ipAgi,_0x5be475[_0xf7f8('0x25')]):'NONE','XMD-AGIAFTER':_0x5be475[_0xf7f8('0x20')]?util[_0xf7f8('0x15')](_0xf7f8('0x24'),ipAgi,_0x5be475[_0xf7f8('0x20')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x4aa81e?_0x4aa81e[_0xf7f8('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x4aa81e?_0x4aa81e[_0xf7f8('0x27')]:'','XMD-DESTINATION':_0xf7f8('0x28'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0xf7f8('0x14')](_0x5be475['monitor_format'])){_0x272712[util[_0xf7f8('0x15')]('%s',_0xf7f8('0x29'))]=_0x5be475[_0xf7f8('0x21')];_0x272712[util[_0xf7f8('0x15')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x4168b2;}if(_0x39cac3&&_0x39cac3[_0xf7f8('0x2a')]){for(var _0x5345d2 in _0x39cac3[_0xf7f8('0x2a')]){if(_0x39cac3[_0xf7f8('0x2a')]['hasOwnProperty'](_0x5345d2)){if(!_[_0xf7f8('0x18')](_0x39cac3[_0xf7f8('0x2a')][_0x5345d2])&&_0x5345d2!=='id'&&_0x5345d2!==_0xf7f8('0x2b')&&_0x5345d2!==_0xf7f8('0x2c')&&_0x5345d2!=='updatedAt'){_0x272712[util[_0xf7f8('0x15')]('%s%s',_0xf7f8('0x2d'),_[_0xf7f8('0x2e')](_0x5345d2))]=_0x39cac3[_0xf7f8('0x2a')][_0x5345d2];}}}}return _0x272712;};exports['toLowerVariables']=function(_0x11d203){var _0x42a76c={};for(var _0x490d8c in _0x11d203){if(_0x11d203[_0xf7f8('0x2f')](_0x490d8c)){_0x42a76c[util[_0xf7f8('0x15')]('%s',_[_0xf7f8('0x30')](_0x490d8c))]=_0x11d203[_0x490d8c];}}return{'variables':_0x42a76c};};exports[_0xf7f8('0x31')]=function(_0x12f808,_0x254ae2){if(!_[_0xf7f8('0x18')](_0x12f808)){if(_0x12f808[_0xf7f8('0x2f')](_0xf7f8('0x32'))){if(_0x12f808[_0xf7f8('0x32')]>0x0){_0x12f808['originated']-=0x1;}else{logger[_0xf7f8('0xb')](_0xf7f8('0x33'),_0x254ae2);}}}else{logger[_0xf7f8('0xb')](_0xf7f8('0x34'),_0x254ae2);}};exports[_0xf7f8('0x35')]=function(_0x3ff0b6){var _0xc3feb9=moment()['format'](_0xf7f8('0x36'));_0x3ff0b6[_0xf7f8('0x37')]=0xd;_0x3ff0b6['statedesc']=_0xf7f8('0x38');_0x3ff0b6['starttime']=_0xc3feb9;_0x3ff0b6['responsetime']=_0xc3feb9;_0x3ff0b6[_0xf7f8('0x39')]=_0xc3feb9;};exports[_0xf7f8('0x3a')]=function(_0x254dda,_0x3ae6f0,_0x589d93){var _0x2deef8=moment()['format'](_0xf7f8('0x36'));_0x254dda['state']=_0x3ae6f0;_0x254dda[_0xf7f8('0x3b')]=_0x589d93;_0x254dda[_0xf7f8('0x3c')]=_0x2deef8;_0x254dda[_0xf7f8('0x3d')]=getSeconds(_0x254dda[_0xf7f8('0x3c')],_0x254dda['starttime']);};exports[_0xf7f8('0x3e')]=function(_0x1b58ed,_0x40dfa5,_0x56df10){_0x1b58ed['membername']=_0x40dfa5;_0x1b58ed[_0xf7f8('0x3f')]=_0x56df10;};exports[_0xf7f8('0x40')]=function(_0x1dca8b,_0x514a52,_0x20a661){var _0x7af758=moment()[_0xf7f8('0x15')](_0xf7f8('0x36'));_0x1dca8b['state']=_0x514a52;_0x1dca8b[_0xf7f8('0x3b')]=_0x20a661;_0x1dca8b[_0xf7f8('0x3c')]=_0x1dca8b[_0xf7f8('0x3c')]?_0x1dca8b[_0xf7f8('0x3c')]:_0x7af758;_0x1dca8b[_0xf7f8('0x39')]=_0x1dca8b['endtime']?_0x1dca8b[_0xf7f8('0x39')]:_0x7af758;_0x1dca8b[_0xf7f8('0x3d')]=getSeconds(_0x1dca8b['responsetime']||0x0,_0x1dca8b[_0xf7f8('0x41')]||0x0);_0x1dca8b[_0xf7f8('0x42')]=_0x1dca8b[_0xf7f8('0x43')]?getSeconds(_0x1dca8b[_0xf7f8('0x39')],_0x1dca8b[_0xf7f8('0x43')]):0x0;};exports['isFailure']=function(_0x330815){return _0x330815===_0xf7f8('0x44');};exports[_0xf7f8('0x45')]=function(_0x4fb6ce,_0x2db5fe,_0x5ba2e0,_0x32afd5,_0x30b79f){var _0x322f97=_0x32afd5?_0xf7f8('0x46'):_0x4fb6ce[_0xf7f8('0x47')];_0x322f97=_0x30b79f?_0xf7f8('0x48'):_0x322f97;return{'actionid':_0x4fb6ce[_0xf7f8('0x49')],'action':_0xf7f8('0x4a'),'channel':_0x4fb6ce[_0xf7f8('0x4b')],'callerid':util['format'](_0xf7f8('0x16'),_0x322f97,_0x4fb6ce[_0xf7f8('0x1c')]),'Exten':_0xf7f8('0x28'),'Context':_0xf7f8('0x4c'),'Priority':'1','variable':_0x5ba2e0,'timeout':(_0x2db5fe[_0xf7f8('0x4d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4fb6ce['uniqueid']};};exports[_0xf7f8('0x4e')]=function(_0x8e1a9e){return _0x8e1a9e[_0xf7f8('0x4f')]+_0x8e1a9e[_0xf7f8('0x50')]+_0x8e1a9e['countnoanswerretry']+_0x8e1a9e[_0xf7f8('0x51')]+_0x8e1a9e[_0xf7f8('0x52')];};exports[_0xf7f8('0x53')]=function(_0x342221){var _0x52cb1e=_['clone'](_0x342221);_0x52cb1e[_0xf7f8('0x37')]=0xf;_0x52cb1e[_0xf7f8('0x3b')]='Global';return _0x52cb1e;};exports[_0xf7f8('0x54')]=function(_0x15968d,_0x1ca094,_0x43ab10){var _0x25ffec={};_0x25ffec[_0x1ca094]=_0x15968d[_0x1ca094];_0x25ffec['active']=![];_0x25ffec[_0xf7f8('0x55')]=moment()['add'](_0x43ab10,_0xf7f8('0x56'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x25ffec[_0xf7f8('0x1d')]=_0x15968d[_0xf7f8('0x1d')];_0x25ffec[_0xf7f8('0x57')]=_0x15968d['ListId'];_0x25ffec['VoiceQueueId']=_0x15968d['VoiceQueueId']||undefined;return _0x25ffec;};exports['decrementTalkink']=function(_0x2fcd9b,_0x21f6b4){if(!_[_0xf7f8('0x18')](_0x2fcd9b)){if(_0x2fcd9b['pTalking']>0x0){_0x2fcd9b[_0xf7f8('0x58')]-=0x1;}else{logger[_0xf7f8('0xb')](_0x21f6b4,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xf7f8('0xb')](_0x21f6b4,_0xf7f8('0x59'));}};exports['IsNotLoggedIn']=function(_0x1baa3b){if(_0x1baa3b<=0x0){return!![];}return![];};exports[_0xf7f8('0x5a')]=function(_0x18245b,_0x38503d,_0x385f31){_0x18245b['lastevent']=_0x38503d;_0x18245b[_0xf7f8('0x1b')]=_0x18245b[_0xf7f8('0x5b')];_0x18245b[_0xf7f8('0x5c')]=_0x18245b[_0xf7f8('0x4b')];_0x18245b[_0xf7f8('0x5d')]=_0xf7f8('0x5e');if(_0x385f31){_0x18245b['mandatoryDisposition']=_0x385f31[_0xf7f8('0x5f')];}return _0x18245b;};exports[_0xf7f8('0x60')]=function(_0x19b73a){var _0x2239f6={};_0x2239f6[_0xf7f8('0x5b')]=_0x19b73a[_0xf7f8('0x5b')];_0x2239f6[_0xf7f8('0x5c')]=_0x19b73a[_0xf7f8('0x4b')];_0x2239f6['uniqueid']=_0x19b73a[_0xf7f8('0x49')];return _0x2239f6;};exports[_0xf7f8('0x61')]=function(_0x2fde6c){var _0x45ca5d=[];for(var _0x4c47ab in _0x2fde6c){if(_0x2fde6c[_0xf7f8('0x2f')](_0x4c47ab)){if(!_['isNil'](_0x2fde6c[_0x4c47ab])&&_0x2fde6c[_0x4c47ab][_0xf7f8('0x37')]===_0xf7f8('0x62')&&_0x2fde6c[_0x4c47ab][_0xf7f8('0x63')]==='reachable'){_0x45ca5d[_0xf7f8('0x64')](_0x2fde6c[_0x4c47ab]['id']);}}}return _0x45ca5d;};exports[_0xf7f8('0x65')]=function(_0x471171){var _0x3128ce=moment()['milliseconds'](0x0);var _0x3d3cf1=moment(_0x471171)[_0xf7f8('0x7')](0x0);return _0x3128ce[_0xf7f8('0x8')](_0x3d3cf1,'seconds');};exports[_0xf7f8('0x66')]=function(_0x348e3a){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x348e3a[_0xf7f8('0x1d')],'ListId':_0x348e3a['ListId'],'VoiceQueueId':_0x348e3a['VoiceQueueId']||undefined,'CampaignId':_0x348e3a[_0xf7f8('0x67')]||undefined};};exports[_0xf7f8('0x68')]=function(_0x33c7c3){if(_0x33c7c3===_0xf7f8('0x49')||_0x33c7c3===_0xf7f8('0x69')||_0x33c7c3==='queue'||_0x33c7c3===_0xf7f8('0x6a')||_0x33c7c3===_0xf7f8('0x6b')||_0x33c7c3===_0xf7f8('0x6c')||_0x33c7c3===_0xf7f8('0x6d')||_0x33c7c3===_0xf7f8('0x4b')||_0x33c7c3===_0xf7f8('0x47')||_0x33c7c3===_0xf7f8('0x6e')||_0x33c7c3===_0xf7f8('0x1c')||_0x33c7c3===_0xf7f8('0x55')||_0x33c7c3===_0xf7f8('0x4f')||_0x33c7c3===_0xf7f8('0x50')||_0x33c7c3===_0xf7f8('0x6f')||_0x33c7c3==='countglobal'||_0x33c7c3==='callback'||_0x33c7c3===_0xf7f8('0x70')||_0x33c7c3==='callbackat'||_0x33c7c3===_0xf7f8('0x71')||_0x33c7c3===_0xf7f8('0x1d')||_0x33c7c3==='ListId'||_0x33c7c3===_0xf7f8('0x3f')||_0x33c7c3===_0xf7f8('0x1e')||_0x33c7c3===_0xf7f8('0x72')||_0x33c7c3===_0xf7f8('0x73')||_0x33c7c3===_0xf7f8('0x74')||_0x33c7c3===_0xf7f8('0x75')||_0x33c7c3===_0xf7f8('0x76')||_0x33c7c3==='xmd-dialurl'||_0x33c7c3===_0xf7f8('0x77')||_0x33c7c3==='xmd-dialoptions'||_0x33c7c3===_0xf7f8('0x78')||_0x33c7c3===_0xf7f8('0x79')||_0x33c7c3===_0xf7f8('0x7a')||_0x33c7c3===_0xf7f8('0x7b')||_0x33c7c3===_0xf7f8('0x7c')||_0x33c7c3==='xmd-agiafter'||_0x33c7c3==='xmd-agi'||_0x33c7c3===_0xf7f8('0x7d')||_0x33c7c3==='rtpaudioqosbridged'||_0x33c7c3===_0xf7f8('0x7e')||_0x33c7c3===_0xf7f8('0x7f')||_0x33c7c3===_0xf7f8('0x80')||_0x33c7c3==='rtpaudioqoslossbridged'||_0x33c7c3===_0xf7f8('0x81')||_0x33c7c3===_0xf7f8('0x82')||_0x33c7c3==='rtpaudioqos'||_0x33c7c3==='rtpaudioqosbridged'||_0x33c7c3==='rtpaudioqosjitter'||_0x33c7c3===_0xf7f8('0x7f')||_0x33c7c3==='rtpaudioqosloss'||_0x33c7c3===_0xf7f8('0x83')||_0x33c7c3===_0xf7f8('0x81')||_0x33c7c3===_0xf7f8('0x82')||_0x33c7c3===_0xf7f8('0x84')||_0x33c7c3===_0xf7f8('0x85')||_0x33c7c3===_0xf7f8('0x37')||_0x33c7c3==='statedesc'){return![];}return!![];};exports[_0xf7f8('0x86')]=function(_0x368c3e,_0x5953f2){var _0x220da2,_0x3533f7,_0x273cb6;if(_0x5953f2<=0x0){_0x5953f2=0x1;}_0x220da2=new RegExp(_0xf7f8('0x87')+_0x5953f2+'}$');_0x3533f7=Math['pow'](0xa,_0x5953f2-0x1);_0x273cb6=Math[_0xf7f8('0x88')](0xa,_0x5953f2)-0x1;return util[_0xf7f8('0x15')]('%s',_[_0xf7f8('0x89')](_0x368c3e,_0x220da2,_[_0xf7f8('0x8a')](_0x3533f7,_0x273cb6)));};exports[_0xf7f8('0x8b')]=function(_0x3ddafb){var _0x369353=_0x3ddafb[_0xf7f8('0x8c')](/"(.*?)"/);return _0x369353?_0x369353[0x1]:_0x3ddafb;};exports['extractCalleridNumber']=function(_0x3f3b68){var _0x5bd255=_0x3f3b68[_0xf7f8('0x8c')](/<(.*?)>/);return _0x5bd255?_0x5bd255[0x1]:_0x3f3b68;}; \ No newline at end of file +var _0xe2e5=['answertime','isFailure','Failure','variablesAction','RECALL','uniqueid','originate','from-sip','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','cloneAction','clone','Global','active','scheduledat','minutes','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','agentReadyId','status','reachable','push','diff','seconds','CampaignId','filterKey','type','campaigntype','dialAnswer','channelAgent','countglobal','callback','callbackat','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','milliseconds','loggerCatch','error','inspect','logger','info','loggerError','message','getCallerId','string','isEmpty','format','\x22%s\x22\x20<%s>','isUndefined','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','updatedAt','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','ringtime','logLookAgent','membername','UserId','logCustomer','talktime'];(function(_0x5018f3,_0x38a9c7){var _0x138af3=function(_0xabb3a1){while(--_0xabb3a1){_0x5018f3['push'](_0x5018f3['shift']());}};_0x138af3(++_0x38a9c7);}(_0xe2e5,0xd5));var _0x5e2e=function(_0xc730c2,_0x362619){_0xc730c2=_0xc730c2-0x0;var _0x28ea39=_0xe2e5[_0xc730c2];return _0x28ea39;};'use strict';var util=require(_0x5e2e('0x0'));var _=require('lodash');var moment=require(_0x5e2e('0x1'));var logger=require(_0x5e2e('0x2'))(_0x5e2e('0x3'));var ipAgi=process[_0x5e2e('0x4')][_0x5e2e('0x5')]||'127.0.0.1';function getSeconds(_0x42a322,_0x229352){var _0xc3f3ed=moment(_0x42a322)[_0x5e2e('0x6')](0x0);var _0x4fdc8a=moment(_0x229352)[_0x5e2e('0x6')](0x0);return _0xc3f3ed['diff'](_0x4fdc8a,'seconds');}exports[_0x5e2e('0x7')]=function(_0x48d185){return function(_0x38d088){logger[_0x5e2e('0x8')](_0x48d185,util[_0x5e2e('0x9')](_0x38d088,{'showHidden':![],'depth':null}));};};exports[_0x5e2e('0xa')]=function(_0x1cb8bf,_0x34c0df){logger[_0x5e2e('0xb')](_0x1cb8bf,util['inspect'](_0x34c0df,{'showHidden':![],'depth':null}));};exports[_0x5e2e('0xc')]=function(_0x227e1e,_0x198b13){logger[_0x5e2e('0x8')](_0x227e1e,util['inspect'](_0x198b13,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x2eb2ad){return function(_0x4deb7b){logger['info'](_0x2eb2ad,util[_0x5e2e('0x9')](_0x4deb7b,{'showHidden':![],'depth':null}));};};exports[_0x5e2e('0xd')]=function(_0x20c39a,_0x5317f1,_0x4ecb2e){return{'message':_0x20c39a,'unlock':_0x5317f1,'active':_0x4ecb2e};};exports[_0x5e2e('0xe')]=function(_0x7862c7,_0x2afe05,_0x5e70f3){if(!_['isUndefined'](_0x5e70f3)&&'string'===typeof _0x5e70f3&&!_['isEmpty'](_0x5e70f3)){if(!_['isUndefined'](_0x2afe05)&&_0x5e2e('0xf')===typeof _0x2afe05&&!_[_0x5e2e('0x10')](_0x2afe05)){return util['format']('\x22%s\x22\x20<%s>',_0x2afe05,_0x5e70f3);}return util[_0x5e2e('0x11')](_0x5e2e('0x12'),_0x5e70f3,_0x5e70f3);}if(!_[_0x5e2e('0x13')](_0x7862c7)&&_0x5e2e('0xf')===typeof _0x7862c7&&!_[_0x5e2e('0x10')](_0x7862c7)){return _0x7862c7;}return _0x5e2e('0x14');};exports[_0x5e2e('0x15')]=function(_0x5213c9){if(_[_0x5e2e('0x16')](_0x5213c9)){return![];}return _0x5213c9;};exports[_0x5e2e('0x17')]=function(_0x9417a1,_0x3c3770,_0x5571c6,_0x3342bb,_0x151690,_0xf54505){var _0x3e731d={'XMD-QUEUE':_0x3c3770[_0x5e2e('0x18')]?_0x3c3770['Queue'][_0x5e2e('0x19')]:'','XMD-CALLERID':_0x3342bb,'XMD-CALLERID-PREVIEW':_0xf54505?util[_0x5e2e('0x11')](_0x5e2e('0x12'),_0xf54505[_0x5e2e('0x1a')],_0xf54505[_0x5e2e('0x1b')]):_0x3342bb,'XMD-DIALID':_0x151690,'XMD-CONTACTID':_0x3c3770['ContactId'],'XMD-CDRTYPE':_0x5e2e('0x1c'),'CALLERID(all)':_0x3342bb,'XMD-VOICEQUEUEID':_0x3c3770[_0x5e2e('0x1d')],'XMD-DIALCHANNEL':_0x5571c6,'XMD-DIALTIMEOUT':_0x9417a1[_0x5e2e('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0x5e2e('0x11')](_0x5e2e('0x1f'),_0x9417a1[_0x5e2e('0x20')]?'g':'',_['isEmpty'](_0x9417a1[_0x5e2e('0x21')])?'':_0x5e2e('0x22')),'XMD-DIALURL':_0x9417a1['dialPreviewUrl']||'','XMD-AGI':_0x9417a1[_0x5e2e('0x23')]?util[_0x5e2e('0x11')](_0x5e2e('0x24'),ipAgi,_0x9417a1[_0x5e2e('0x23')]):_0x5e2e('0x25'),'XMD-AGIAFTER':_0x9417a1[_0x5e2e('0x20')]?util[_0x5e2e('0x11')](_0x5e2e('0x24'),ipAgi,_0x9417a1['dialQueueProject2']):_0x5e2e('0x25'),'XMD-ORIGINATECALLERIDNUM':_0xf54505?_0xf54505['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0xf54505?_0xf54505[_0x5e2e('0x26')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x5e2e('0x27')};if(!_[_0x5e2e('0x10')](_0x9417a1['monitor_format'])){_0x3e731d[util[_0x5e2e('0x11')]('%s',_0x5e2e('0x28'))]=_0x9417a1['monitor_format'];_0x3e731d[util[_0x5e2e('0x11')]('%s',_0x5e2e('0x29'))]=_0x151690;}if(_0x3c3770&&_0x3c3770['Contact']){for(var _0x294920 in _0x3c3770['Contact']){if(_0x3c3770[_0x5e2e('0x2a')][_0x5e2e('0x2b')](_0x294920)){if(!_[_0x5e2e('0x16')](_0x3c3770[_0x5e2e('0x2a')][_0x294920])&&_0x294920!=='id'&&_0x294920!=='tags'&&_0x294920!=='createdAt'&&_0x294920!==_0x5e2e('0x2c')){_0x3e731d[util['format']('%s%s','XMD-',_[_0x5e2e('0x2d')](_0x294920))]=_0x3c3770[_0x5e2e('0x2a')][_0x294920];}}}}return _0x3e731d;};exports[_0x5e2e('0x2e')]=function(_0xf7ec26){var _0x4128f1={};for(var _0x38b099 in _0xf7ec26){if(_0xf7ec26[_0x5e2e('0x2b')](_0x38b099)){_0x4128f1[util['format']('%s',_[_0x5e2e('0x2f')](_0x38b099))]=_0xf7ec26[_0x38b099];}}return{'variables':_0x4128f1};};exports[_0x5e2e('0x30')]=function(_0x6c6886,_0x1ef34d){if(!_[_0x5e2e('0x16')](_0x6c6886)){if(_0x6c6886[_0x5e2e('0x2b')](_0x5e2e('0x31'))){if(_0x6c6886[_0x5e2e('0x31')]>0x0){_0x6c6886[_0x5e2e('0x31')]-=0x1;}else{logger['error'](_0x5e2e('0x32'),_0x1ef34d);}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x1ef34d);}};exports[_0x5e2e('0x33')]=function(_0x306be1){var _0x4fbbd6=moment()[_0x5e2e('0x11')](_0x5e2e('0x34'));_0x306be1[_0x5e2e('0x35')]=0xd;_0x306be1[_0x5e2e('0x36')]=_0x5e2e('0x37');_0x306be1[_0x5e2e('0x38')]=_0x4fbbd6;_0x306be1[_0x5e2e('0x39')]=_0x4fbbd6;_0x306be1[_0x5e2e('0x3a')]=_0x4fbbd6;};exports['logAgent']=function(_0x1c5e07,_0xa35c4,_0x47ec65){var _0x3ed627=moment()['format'](_0x5e2e('0x34'));_0x1c5e07[_0x5e2e('0x35')]=_0xa35c4;_0x1c5e07['statedesc']=_0x47ec65;_0x1c5e07[_0x5e2e('0x39')]=_0x3ed627;_0x1c5e07[_0x5e2e('0x3b')]=getSeconds(_0x1c5e07['responsetime'],_0x1c5e07[_0x5e2e('0x38')]);};exports[_0x5e2e('0x3c')]=function(_0x2af703,_0x7eda2e,_0x2675db){_0x2af703[_0x5e2e('0x3d')]=_0x7eda2e;_0x2af703[_0x5e2e('0x3e')]=_0x2675db;};exports[_0x5e2e('0x3f')]=function(_0xc9bbc,_0x4864e4,_0x544e21){var _0x1b23e6=moment()['format'](_0x5e2e('0x34'));_0xc9bbc[_0x5e2e('0x35')]=_0x4864e4;_0xc9bbc[_0x5e2e('0x36')]=_0x544e21;_0xc9bbc[_0x5e2e('0x39')]=_0xc9bbc[_0x5e2e('0x39')]?_0xc9bbc[_0x5e2e('0x39')]:_0x1b23e6;_0xc9bbc[_0x5e2e('0x3a')]=_0xc9bbc[_0x5e2e('0x3a')]?_0xc9bbc[_0x5e2e('0x3a')]:_0x1b23e6;_0xc9bbc[_0x5e2e('0x3b')]=getSeconds(_0xc9bbc[_0x5e2e('0x39')]||0x0,_0xc9bbc[_0x5e2e('0x38')]||0x0);_0xc9bbc[_0x5e2e('0x40')]=_0xc9bbc['answertime']?getSeconds(_0xc9bbc['endtime'],_0xc9bbc[_0x5e2e('0x41')]):0x0;};exports[_0x5e2e('0x42')]=function(_0x222927){return _0x222927===_0x5e2e('0x43');};exports[_0x5e2e('0x44')]=function(_0x8d67e8,_0x1f2e49,_0x2cf49b,_0x3e7e1b,_0x2d9d5e){var _0x1dcc73=_0x3e7e1b?_0x5e2e('0x45'):_0x8d67e8['calleridname'];_0x1dcc73=_0x2d9d5e?'BOOKED':_0x1dcc73;return{'actionid':_0x8d67e8[_0x5e2e('0x46')],'action':_0x5e2e('0x47'),'channel':_0x8d67e8['channelAgent'],'callerid':util[_0x5e2e('0x11')]('\x22%s\x22\x20<%s>',_0x1dcc73,_0x8d67e8[_0x5e2e('0x1b')]),'Exten':'xcally-motion-preview','Context':_0x5e2e('0x48'),'Priority':'1','variable':_0x2cf49b,'timeout':(_0x1f2e49['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x8d67e8[_0x5e2e('0x46')]};};exports[_0x5e2e('0x49')]=function(_0x384fb2){return _0x384fb2[_0x5e2e('0x4a')]+_0x384fb2['countcongestionretry']+_0x384fb2[_0x5e2e('0x4b')]+_0x384fb2[_0x5e2e('0x4c')]+_0x384fb2['countnosuchnumberretry'];};exports[_0x5e2e('0x4d')]=function(_0x3a378b){var _0x1ed5aa=_[_0x5e2e('0x4e')](_0x3a378b);_0x1ed5aa[_0x5e2e('0x35')]=0xf;_0x1ed5aa[_0x5e2e('0x36')]=_0x5e2e('0x4f');return _0x1ed5aa;};exports['scheduledAt']=function(_0x4a7d5c,_0x3a3177,_0x5ea6b7){var _0x4382b1={};_0x4382b1[_0x3a3177]=_0x4a7d5c[_0x3a3177];_0x4382b1[_0x5e2e('0x50')]=![];_0x4382b1[_0x5e2e('0x51')]=moment()['add'](_0x5ea6b7,_0x5e2e('0x52'))[_0x5e2e('0x11')](_0x5e2e('0x34'));_0x4382b1[_0x5e2e('0x53')]=_0x4a7d5c[_0x5e2e('0x53')];_0x4382b1[_0x5e2e('0x54')]=_0x4a7d5c['ListId'];_0x4382b1[_0x5e2e('0x1d')]=_0x4a7d5c['VoiceQueueId']||undefined;return _0x4382b1;};exports[_0x5e2e('0x55')]=function(_0x1866d0,_0x1d7b85){if(!_[_0x5e2e('0x16')](_0x1866d0)){if(_0x1866d0[_0x5e2e('0x56')]>0x0){_0x1866d0[_0x5e2e('0x56')]-=0x1;}else{logger['error'](_0x1d7b85,_0x5e2e('0x57'));}}else{logger[_0x5e2e('0x8')](_0x1d7b85,_0x5e2e('0x58'));}};exports[_0x5e2e('0x59')]=function(_0x20ef25){if(_0x20ef25<=0x0){return!![];}return![];};exports[_0x5e2e('0x5a')]=function(_0x4994e9,_0x19d11c,_0x39b860){_0x4994e9[_0x5e2e('0x5b')]=_0x19d11c;_0x4994e9[_0x5e2e('0x19')]=_0x4994e9[_0x5e2e('0x5c')];_0x4994e9[_0x5e2e('0x5d')]=_0x4994e9['channelAgent'];_0x4994e9[_0x5e2e('0x5e')]=_0x5e2e('0x5f');if(_0x39b860){_0x4994e9[_0x5e2e('0x60')]=_0x39b860[_0x5e2e('0x60')];}return _0x4994e9;};exports['buildAcw']=function(_0x52a61e){var _0x41f710={};_0x41f710[_0x5e2e('0x5c')]=_0x52a61e['queue'];_0x41f710[_0x5e2e('0x5d')]=_0x52a61e['channelAgent'];_0x41f710[_0x5e2e('0x46')]=_0x52a61e[_0x5e2e('0x46')];return _0x41f710;};exports[_0x5e2e('0x61')]=function(_0x263e2a){var _0x1f0d80=[];for(var _0x4653b9 in _0x263e2a){if(_0x263e2a[_0x5e2e('0x2b')](_0x4653b9)){if(!_[_0x5e2e('0x16')](_0x263e2a[_0x4653b9])&&_0x263e2a[_0x4653b9][_0x5e2e('0x35')]==='not_inuse'&&_0x263e2a[_0x4653b9][_0x5e2e('0x62')]===_0x5e2e('0x63')){_0x1f0d80[_0x5e2e('0x64')](_0x263e2a[_0x4653b9]['id']);}}}return _0x1f0d80;};exports['getDiff']=function(_0x15c0f8){var _0x17a4b8=moment()[_0x5e2e('0x6')](0x0);var _0x23f332=moment(_0x15c0f8)[_0x5e2e('0x6')](0x0);return _0x17a4b8[_0x5e2e('0x65')](_0x23f332,_0x5e2e('0x66'));};exports['createBody']=function(_0x58ef58){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x58ef58['ContactId'],'ListId':_0x58ef58[_0x5e2e('0x54')],'VoiceQueueId':_0x58ef58[_0x5e2e('0x1d')]||undefined,'CampaignId':_0x58ef58[_0x5e2e('0x67')]||undefined};};exports[_0x5e2e('0x68')]=function(_0x10ee46){if(_0x10ee46===_0x5e2e('0x46')||_0x10ee46==='idContact'||_0x10ee46==='queue'||_0x10ee46===_0x5e2e('0x69')||_0x10ee46===_0x5e2e('0x6a')||_0x10ee46===_0x5e2e('0x6b')||_0x10ee46===_0x5e2e('0x3d')||_0x10ee46===_0x5e2e('0x6c')||_0x10ee46===_0x5e2e('0x1a')||_0x10ee46==='active'||_0x10ee46===_0x5e2e('0x1b')||_0x10ee46===_0x5e2e('0x51')||_0x10ee46===_0x5e2e('0x4a')||_0x10ee46==='countcongestionretry'||_0x10ee46==='countnoanswerretry'||_0x10ee46===_0x5e2e('0x6d')||_0x10ee46===_0x5e2e('0x6e')||_0x10ee46==='callbackuniqueid'||_0x10ee46===_0x5e2e('0x6f')||_0x10ee46==='recallme'||_0x10ee46===_0x5e2e('0x53')||_0x10ee46==='ListId'||_0x10ee46===_0x5e2e('0x3e')||_0x10ee46===_0x5e2e('0x1d')||_0x10ee46===_0x5e2e('0x70')||_0x10ee46===_0x5e2e('0x71')||_0x10ee46==='xmd-queue'||_0x10ee46===_0x5e2e('0x72')||_0x10ee46===_0x5e2e('0x73')||_0x10ee46==='xmd-dialurl'||_0x10ee46===_0x5e2e('0x74')||_0x10ee46==='xmd-dialoptions'||_0x10ee46===_0x5e2e('0x75')||_0x10ee46==='xmd-dialchannel'||_0x10ee46===_0x5e2e('0x76')||_0x10ee46===_0x5e2e('0x77')||_0x10ee46===_0x5e2e('0x78')||_0x10ee46===_0x5e2e('0x79')||_0x10ee46===_0x5e2e('0x7a')||_0x10ee46===_0x5e2e('0x7b')||_0x10ee46===_0x5e2e('0x7c')||_0x10ee46===_0x5e2e('0x7d')||_0x10ee46===_0x5e2e('0x7e')||_0x10ee46===_0x5e2e('0x7f')||_0x10ee46===_0x5e2e('0x80')||_0x10ee46===_0x5e2e('0x81')||_0x10ee46===_0x5e2e('0x82')||_0x10ee46===_0x5e2e('0x7b')||_0x10ee46===_0x5e2e('0x7c')||_0x10ee46===_0x5e2e('0x7d')||_0x10ee46==='rtpaudioqosjitterbridged'||_0x10ee46===_0x5e2e('0x7f')||_0x10ee46===_0x5e2e('0x80')||_0x10ee46===_0x5e2e('0x81')||_0x10ee46==='rtpaudioqosrttbridged'||_0x10ee46==='bridgepeer'||_0x10ee46===_0x5e2e('0x83')||_0x10ee46===_0x5e2e('0x35')||_0x10ee46==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x398e6e,_0x19074c){var _0x19f93c,_0x449805,_0x9db31b;if(_0x19074c<=0x0){_0x19074c=0x1;}_0x19f93c=new RegExp(_0x5e2e('0x84')+_0x19074c+'}$');_0x449805=Math['pow'](0xa,_0x19074c-0x1);_0x9db31b=Math[_0x5e2e('0x85')](0xa,_0x19074c)-0x1;return util['format']('%s',_[_0x5e2e('0x86')](_0x398e6e,_0x19f93c,_[_0x5e2e('0x87')](_0x449805,_0x9db31b)));};exports[_0x5e2e('0x88')]=function(_0x4f79e9){var _0x4e3563=_0x4f79e9[_0x5e2e('0x89')](/"(.*?)"/);return _0x4e3563?_0x4e3563[0x1]:_0x4f79e9;};exports[_0x5e2e('0x8a')]=function(_0x35ff91){var _0x4768b9=_0x35ff91[_0x5e2e('0x89')](/<(.*?)>/);return _0x4768b9?_0x4768b9[0x1]:_0x35ff91;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 45ece53..ba2599a 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 _0x3f80=['boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string','number'];(function(_0xc67563,_0x5d40fb){var _0x420434=function(_0x5ec1e2){while(--_0x5ec1e2){_0xc67563['push'](_0xc67563['shift']());}};_0x420434(++_0x5d40fb);}(_0x3f80,0xa7));var _0x03f8=function(_0x32f825,_0x22a80f){_0x32f825=_0x32f825-0x0;var _0x59a157=_0x3f80[_0x32f825];return _0x59a157;};'use strict';exports[_0x03f8('0x0')]={'queue':{'type':_0x03f8('0x1'),'required':!![]},'interface':{'type':_0x03f8('0x1'),'required':!![]},'membername':{'type':_0x03f8('0x1'),'required':!![]},'penalty':{'type':_0x03f8('0x2'),'required':![]},'paused':{'type':_0x03f8('0x3'),'required':![]}};exports[_0x03f8('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]}};exports[_0x03f8('0x5')]={'interface':{'type':_0x03f8('0x1'),'required':!![]},'paused':{'type':_0x03f8('0x3')},'reason':{'type':_0x03f8('0x1'),'required':![]}};exports[_0x03f8('0x6')]={'module':{'type':_0x03f8('0x1'),'required':![]}};exports[_0x03f8('0x7')]={'uniqueid':{'type':_0x03f8('0x1'),'required':!![]}};exports[_0x03f8('0x8')]={'uniqueid':{'type':_0x03f8('0x1'),'required':!![]},'filename':{'type':_0x03f8('0x1')},'format':{'type':_0x03f8('0x1')},'mixmonitorid':{'type':_0x03f8('0x1')}};exports[_0x03f8('0x9')]={'uniqueid':{'type':'string','required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x03f8('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x0699=['queueremove','queuepause','boolean','reload','voicequeuechannelredirect','queueadd','string'];(function(_0x3b77f4,_0x4679b2){var _0x44c275=function(_0x185c86){while(--_0x185c86){_0x3b77f4['push'](_0x3b77f4['shift']());}};_0x44c275(++_0x4679b2);}(_0x0699,0x19b));var _0x9069=function(_0x2e6f54,_0x161de2){_0x2e6f54=_0x2e6f54-0x0;var _0x352d45=_0x0699[_0x2e6f54];return _0x352d45;};'use strict';exports[_0x9069('0x0')]={'queue':{'type':_0x9069('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x9069('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x9069('0x2')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x9069('0x1'),'required':!![]}};exports[_0x9069('0x3')]={'interface':{'type':_0x9069('0x1'),'required':!![]},'paused':{'type':_0x9069('0x4')},'reason':{'type':_0x9069('0x1'),'required':![]}};exports[_0x9069('0x5')]={'module':{'type':'string','required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x9069('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x9069('0x1'),'required':!![]},'filename':{'type':_0x9069('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0x9069('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x9069('0x1'),'required':!![]}};exports[_0x9069('0x6')]={'uniqueid':{'type':_0x9069('0x1'),'required':!![]},'exten':{'type':_0x9069('0x1'),'required':!![]},'context':{'type':_0x9069('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 9551cb4..3a4d0b9 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 _0xed06=['answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','total','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','interface','isUndefined','initTelephones','initVoiceQueues','initTriggers','initTemplates','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallercompleteAt','queuecallerabandonAt','queuecallerjoinAt','seconds','queuecallercomplete','duration','disposition','ANSWERED','billableseconds','dialQueueProject','SquareProject','voiceExtensions','initFaxAccounts','faxAccounts','exports','bluebird','util','lodash','../model/telephone','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','queueChannels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil'];(function(_0x21e725,_0x22283b){var _0x1859e7=function(_0x4be5f1){while(--_0x4be5f1){_0x21e725['push'](_0x21e725['shift']());}};_0x1859e7(++_0x22283b);}(_0xed06,0x117));var _0x6ed0=function(_0xcb65be,_0x551ddd){_0xcb65be=_0xcb65be-0x0;var _0x4b7824=_0xed06[_0xcb65be];return _0x4b7824;};'use strict';var BPromise=require(_0x6ed0('0x0'));var util=require(_0x6ed0('0x1'));var _=require(_0x6ed0('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Telephone=require(_0x6ed0('0x3'));var Trunk=require(_0x6ed0('0x4'));var VoiceQueue=require(_0x6ed0('0x5'));var Trigger=require('../model/trigger');var Template=require(_0x6ed0('0x6'));var Campaign=require(_0x6ed0('0x7'));var VoiceExtension=require(_0x6ed0('0x8'));var ZendeskAccount=require(_0x6ed0('0x9'));var SalesforceAccount=require(_0x6ed0('0xa'));var FreshdeskAccount=require(_0x6ed0('0xb'));var SugarcrmAccount=require(_0x6ed0('0xc'));var ZohoAccount=require(_0x6ed0('0xd'));var DeskAccount=require(_0x6ed0('0xe'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0x6ed0('0xf'));var Dynamics365Account=require(_0x6ed0('0x10'));var FreshsalesAccount=require(_0x6ed0('0x11'));var FaxAccount=require(_0x6ed0('0x12'));var Realtime=function(){this[_0x6ed0('0x13')]={};this[_0x6ed0('0x14')]={};this[_0x6ed0('0x15')]={};this[_0x6ed0('0x16')]={};this[_0x6ed0('0x17')]={};this[_0x6ed0('0x18')]={};this[_0x6ed0('0x19')]={};this[_0x6ed0('0x1a')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this['channels']={};this[_0x6ed0('0x1b')]={};this[_0x6ed0('0x1c')]={};this['timers']={};this[_0x6ed0('0x1d')]={};this[_0x6ed0('0x1e')]={};this[_0x6ed0('0x1f')]={};this[_0x6ed0('0x20')]={};this[_0x6ed0('0x21')]={};this[_0x6ed0('0x22')]={};this[_0x6ed0('0x23')]={};this[_0x6ed0('0x24')]={};this['servicenowAccounts']={};this[_0x6ed0('0x25')]={};this[_0x6ed0('0x26')]={};this['faxAccounts']={};};function freeIsNotKey(_0x2e35dc,_0x1c45ec,_0x339c09){var _0x144be7=_[_0x6ed0('0x27')](_0x2e35dc,function(_0x2901ea,_0x5d79a5){return _0x2901ea[_0x339c09];});for(var _0x2862ab in _0x1c45ec){if(_0x1c45ec[_0x6ed0('0x28')](_0x2862ab)){if(!_0x144be7[_0x2862ab]){delete _0x1c45ec[_0x2862ab];}}}}function freeIsNotKeySip(_0x59d264,_0x3fcd3b){var _0x4718ae=_[_0x6ed0('0x27')](_0x59d264,function(_0x1a1b1c,_0x22c9df){return util[_0x6ed0('0x29')](_0x6ed0('0x2a'),_0x1a1b1c[_0x6ed0('0x2b')]);});for(var _0x2d1abe in _0x3fcd3b){if(_0x3fcd3b[_0x6ed0('0x28')](_0x2d1abe)){if(!_0x4718ae[_0x2d1abe]){delete _0x3fcd3b[_0x2d1abe];}}}}function freeIsNotKeyAgent(_0x583cb8,_0x8edf19){var _0x3db026=_[_0x6ed0('0x27')](_0x583cb8,function(_0x1e76c1,_0x232c98){var _0x32074a=_[_0x6ed0('0x2c')](_0x1e76c1['interface'])?util[_0x6ed0('0x29')](_0x6ed0('0x2a'),_0x1e76c1[_0x6ed0('0x2b')]):_0x1e76c1['interface'];return _0x32074a;});for(var _0x4485a3 in _0x8edf19){if(_0x8edf19[_0x6ed0('0x28')](_0x4485a3)){if(!_0x3db026[_0x4485a3]){delete _0x8edf19[_0x4485a3];}}}}function clearVoiceCallReports(_0x2a74bd){_0x2a74bd['total']=0x0;_0x2a74bd[_0x6ed0('0x2d')]=0x0;_0x2a74bd[_0x6ed0('0x2e')]=0x0;_0x2a74bd[_0x6ed0('0x2f')]=0x0;_0x2a74bd[_0x6ed0('0x30')]=0x0;}function clearCampaigns(_0x28dcd6){if(!_[_0x6ed0('0x31')](_0x28dcd6)){for(var _0x3c7e7b in _0x28dcd6){if(_0x28dcd6[_0x6ed0('0x28')](_0x3c7e7b)){_0x28dcd6[_0x3c7e7b][_0x6ed0('0x32')]=0x0;_0x28dcd6[_0x3c7e7b]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x5558d4){if(!_[_0x6ed0('0x31')](_0x5558d4)){for(var _0x3b2205 in _0x5558d4){if(_0x5558d4[_0x6ed0('0x28')](_0x3b2205)){_0x5558d4[_0x3b2205][_0x6ed0('0x33')]=0x0;_0x5558d4[_0x3b2205][_0x6ed0('0x2d')]=0x0;_0x5558d4[_0x3b2205][_0x6ed0('0x34')]=0x0;_0x5558d4[_0x3b2205][_0x6ed0('0x35')]=0x0;_0x5558d4[_0x3b2205]['sumHoldTime']=0x0;_0x5558d4[_0x3b2205][_0x6ed0('0x2f')]=0x0;_0x5558d4[_0x3b2205][_0x6ed0('0x30')]=0x0;_0x5558d4[_0x3b2205][_0x6ed0('0x36')]=0x0;_0x5558d4[_0x3b2205][_0x6ed0('0x37')]=0x0;_0x5558d4[_0x3b2205]['outboundBusyCallsDay']=0x0;_0x5558d4[_0x3b2205][_0x6ed0('0x38')]=0x0;_0x5558d4[_0x3b2205][_0x6ed0('0x39')]=0x0;_0x5558d4[_0x3b2205][_0x6ed0('0x3a')]=0x0;_0x5558d4[_0x3b2205][_0x6ed0('0x3b')]=0x0;_0x5558d4[_0x3b2205][_0x6ed0('0x3c')]=0x0;_0x5558d4[_0x3b2205][_0x6ed0('0x3d')]=0x0;_0x5558d4[_0x3b2205]['outboundOriginateFailureCallsDay']=0x0;_0x5558d4[_0x3b2205][_0x6ed0('0x3e')]=0x0;_0x5558d4[_0x3b2205][_0x6ed0('0x3f')]=0x0;_0x5558d4[_0x3b2205]['outboundAnswerAgiCallsDay']=0x0;_0x5558d4[_0x3b2205]['outboundAnswerCallsDay']=0x0;_0x5558d4[_0x3b2205][_0x6ed0('0x40')]=!![];}}}}Realtime[_0x6ed0('0x41')][_0x6ed0('0x42')]=function(_0x2337d0,_0x306c4f){for(var _0x9d38bd in _0x306c4f){if(_0x2337d0[_0x6ed0('0x28')](_0x9d38bd)){_0x2337d0[_0x9d38bd]=_0x306c4f[_0x9d38bd];}}};Realtime[_0x6ed0('0x41')]['initAgents']=function(){var _0x51e78f=this;return function(_0x3ca7ba){if(_0x3ca7ba){freeIsNotKeyAgent(_0x3ca7ba,_0x51e78f[_0x6ed0('0x13')]);for(var _0x575718=0x0,_0x9d84bc={},_0x2f71ea={};_0x575718<_0x3ca7ba[_0x6ed0('0x43')];_0x575718+=0x1){_0x9d84bc=_0x3ca7ba[_0x575718];var _0x3d9150=_[_0x6ed0('0x2c')](_0x9d84bc['interface'])?util['format']('SIP/%s',_0x9d84bc['name']):_0x9d84bc[_0x6ed0('0x44')];if(_[_0x6ed0('0x45')](_0x51e78f[_0x6ed0('0x13')][_0x3d9150])){_0x51e78f['agents'][_0x3d9150]=new Agent(_0x9d84bc);}else{_0x51e78f[_0x6ed0('0x42')](_0x51e78f[_0x6ed0('0x13')][_0x3d9150],_0x9d84bc);}}}return _0x51e78f[_0x6ed0('0x13')];};};Realtime['prototype'][_0x6ed0('0x46')]=function(){var _0x7d9ce7=this;return function(_0xf2d3e9){if(_0xf2d3e9){freeIsNotKeySip(_0xf2d3e9,_0x7d9ce7[_0x6ed0('0x14')]);for(var _0x1cb3aa=0x0,_0x1c5c6f={},_0x1d4614={};_0x1cb3aa<_0xf2d3e9[_0x6ed0('0x43')];_0x1cb3aa+=0x1){_0x1c5c6f=_0xf2d3e9[_0x1cb3aa];if(_['isUndefined'](_0x7d9ce7[_0x6ed0('0x14')][util['format'](_0x6ed0('0x2a'),_0x1c5c6f[_0x6ed0('0x2b')])])){_0x7d9ce7[_0x6ed0('0x14')][util[_0x6ed0('0x29')](_0x6ed0('0x2a'),_0x1c5c6f[_0x6ed0('0x2b')])]=new Telephone(_0x1c5c6f);}else{_0x7d9ce7[_0x6ed0('0x42')](_0x7d9ce7[_0x6ed0('0x14')][util[_0x6ed0('0x29')](_0x6ed0('0x2a'),_0x1c5c6f[_0x6ed0('0x2b')])],_0x1c5c6f);}}}return _0x7d9ce7[_0x6ed0('0x14')];};};Realtime[_0x6ed0('0x41')]['initTrunks']=function(){var _0x1b0028=this;return function(_0x30bc95){if(_0x30bc95){freeIsNotKeySip(_0x30bc95,_0x1b0028[_0x6ed0('0x15')]);for(var _0x562c61=0x0,_0x5082fc={},_0x281f6c={};_0x562c61<_0x30bc95[_0x6ed0('0x43')];_0x562c61+=0x1){_0x5082fc=_0x30bc95[_0x562c61];if(_[_0x6ed0('0x45')](_0x1b0028['trunks'][util['format'](_0x6ed0('0x2a'),_0x5082fc[_0x6ed0('0x2b')])])){_0x1b0028['trunks'][util[_0x6ed0('0x29')]('SIP/%s',_0x5082fc['name'])]=new Trunk(_0x5082fc);}else{_0x1b0028[_0x6ed0('0x42')](_0x1b0028[_0x6ed0('0x15')][util[_0x6ed0('0x29')]('SIP/%s',_0x5082fc[_0x6ed0('0x2b')])],_0x5082fc);}}}return _0x1b0028[_0x6ed0('0x15')];};};Realtime[_0x6ed0('0x41')][_0x6ed0('0x47')]=function(){var _0x2b5318=this;return function(_0x32318c){if(_0x32318c){freeIsNotKey(_0x32318c,_0x2b5318[_0x6ed0('0x16')],_0x6ed0('0x2b'));for(var _0x33c013=0x0,_0x531ee5={},_0x1282a0={};_0x33c013<_0x32318c[_0x6ed0('0x43')];_0x33c013+=0x1){_0x531ee5=_0x32318c[_0x33c013];if(_[_0x6ed0('0x45')](_0x2b5318['voiceQueues'][_0x531ee5['name']])){_0x2b5318['voiceQueues'][_0x531ee5[_0x6ed0('0x2b')]]=new VoiceQueue(_0x531ee5);}else{_0x2b5318[_0x6ed0('0x42')](_0x2b5318[_0x6ed0('0x16')][_0x531ee5[_0x6ed0('0x2b')]],_0x531ee5);}}}return _0x2b5318[_0x6ed0('0x16')];};};Realtime[_0x6ed0('0x41')][_0x6ed0('0x48')]=function(){var _0x3a8e51=this;return function(_0x27ab8a){if(_0x27ab8a){freeIsNotKey(_0x27ab8a,_0x3a8e51[_0x6ed0('0x17')],'id');for(var _0x147c4d=0x0,_0x308fd1={},_0x135cf4={};_0x147c4d<_0x27ab8a[_0x6ed0('0x43')];_0x147c4d+=0x1){_0x308fd1=_0x27ab8a[_0x147c4d];if(_[_0x6ed0('0x45')](_0x3a8e51[_0x6ed0('0x17')][_0x308fd1['id']])){_0x3a8e51[_0x6ed0('0x17')][_0x308fd1['id']]=new Trigger(_0x308fd1);}else{_0x3a8e51[_0x6ed0('0x42')](_0x3a8e51[_0x6ed0('0x17')][_0x308fd1['id']],_0x308fd1);}}}return _0x3a8e51[_0x6ed0('0x17')];};};Realtime['prototype'][_0x6ed0('0x49')]=function(){var _0x5dbc21=this;return function(_0xb29261){if(_0xb29261){freeIsNotKey(_0xb29261,_0x5dbc21['templates'],'id');for(var _0x421e28=0x0,_0x5a1893={},_0x20b264={};_0x421e28<_0xb29261[_0x6ed0('0x43')];_0x421e28+=0x1){_0x5a1893=_0xb29261[_0x421e28];if(_[_0x6ed0('0x45')](_0x5dbc21[_0x6ed0('0x19')][_0x5a1893['id']])){_0x5dbc21[_0x6ed0('0x19')][_0x5a1893['id']]=new Template(_0x5a1893);}else{_0x5dbc21[_0x6ed0('0x42')](_0x5dbc21['templates'][_0x5a1893['id']],_0x5a1893);}}}return _0x5dbc21[_0x6ed0('0x19')];};};Realtime['prototype']['initZendeskAccounts']=function(){var _0x55dfd5=this;return function(_0xdfd3b1){if(_0xdfd3b1){freeIsNotKey(_0xdfd3b1,_0x55dfd5[_0x6ed0('0x1e')],'id');for(var _0xe33edf=0x0,_0x1aa89b={},_0x43df94={};_0xe33edf<_0xdfd3b1[_0x6ed0('0x43')];_0xe33edf+=0x1){_0x1aa89b=_0xdfd3b1[_0xe33edf];if(_[_0x6ed0('0x45')](_0x55dfd5[_0x6ed0('0x1e')][_0x1aa89b['id']])){_0x55dfd5['zendeskAccounts'][_0x1aa89b['id']]=new ZendeskAccount(_0x1aa89b);}else{_0x55dfd5[_0x6ed0('0x42')](_0x55dfd5[_0x6ed0('0x1e')][_0x1aa89b['id']],_0x1aa89b);}}}return _0x55dfd5[_0x6ed0('0x1e')];};};Realtime[_0x6ed0('0x41')][_0x6ed0('0x4a')]=function(){var _0x3bf36f=this;return function(_0x1fd65f){if(_0x1fd65f){freeIsNotKey(_0x1fd65f,_0x3bf36f['salesforceAccounts'],'id');for(var _0x395a01=0x0,_0x392d9c={},_0x5d0d60={};_0x395a01<_0x1fd65f[_0x6ed0('0x43')];_0x395a01+=0x1){_0x392d9c=_0x1fd65f[_0x395a01];if(_[_0x6ed0('0x45')](_0x3bf36f[_0x6ed0('0x1f')][_0x392d9c['id']])){_0x3bf36f['salesforceAccounts'][_0x392d9c['id']]=new SalesforceAccount(_0x392d9c);}else{_0x3bf36f[_0x6ed0('0x42')](_0x3bf36f['salesforceAccounts'][_0x392d9c['id']],_0x392d9c);}}}return _0x3bf36f[_0x6ed0('0x1f')];};};Realtime[_0x6ed0('0x41')][_0x6ed0('0x4b')]=function(){var _0x41bf24=this;return function(_0x45fb27){if(_0x45fb27){freeIsNotKey(_0x45fb27,_0x41bf24[_0x6ed0('0x21')],'id');for(var _0x3ec4b7=0x0,_0x10d9a6={},_0x211b7b={};_0x3ec4b7<_0x45fb27[_0x6ed0('0x43')];_0x3ec4b7+=0x1){_0x10d9a6=_0x45fb27[_0x3ec4b7];if(_[_0x6ed0('0x45')](_0x41bf24[_0x6ed0('0x21')][_0x10d9a6['id']])){_0x41bf24[_0x6ed0('0x21')][_0x10d9a6['id']]=new FreshdeskAccount(_0x10d9a6);}else{_0x41bf24[_0x6ed0('0x42')](_0x41bf24[_0x6ed0('0x21')][_0x10d9a6['id']],_0x10d9a6);}}}return _0x41bf24[_0x6ed0('0x21')];};};Realtime[_0x6ed0('0x41')][_0x6ed0('0x4c')]=function(){var _0x12be79=this;return function(_0x332e6f){if(_0x332e6f){freeIsNotKey(_0x332e6f,_0x12be79[_0x6ed0('0x22')],'id');for(var _0x1ffff2=0x0,_0x4a78d5={},_0x210cc6={};_0x1ffff2<_0x332e6f[_0x6ed0('0x43')];_0x1ffff2+=0x1){_0x4a78d5=_0x332e6f[_0x1ffff2];if(_[_0x6ed0('0x45')](_0x12be79[_0x6ed0('0x22')][_0x4a78d5['id']])){_0x12be79[_0x6ed0('0x22')][_0x4a78d5['id']]=new ZohoAccount(_0x4a78d5);}else{_0x12be79['mergeFromDatabase'](_0x12be79[_0x6ed0('0x22')][_0x4a78d5['id']],_0x4a78d5);}}}return _0x12be79[_0x6ed0('0x22')];};};Realtime[_0x6ed0('0x41')][_0x6ed0('0x4d')]=function(){var _0x5c993f=this;return function(_0x2e2905){if(_0x2e2905){freeIsNotKey(_0x2e2905,_0x5c993f[_0x6ed0('0x23')],'id');for(var _0x1c4b6b=0x0,_0x19f997={},_0x337f57={};_0x1c4b6b<_0x2e2905[_0x6ed0('0x43')];_0x1c4b6b+=0x1){_0x19f997=_0x2e2905[_0x1c4b6b];if(_['isUndefined'](_0x5c993f[_0x6ed0('0x23')][_0x19f997['id']])){_0x5c993f[_0x6ed0('0x23')][_0x19f997['id']]=new DeskAccount(_0x19f997);}else{_0x5c993f[_0x6ed0('0x42')](_0x5c993f['deskAccounts'][_0x19f997['id']],_0x19f997);}}}return _0x5c993f['deskAccounts'];};};Realtime[_0x6ed0('0x41')][_0x6ed0('0x4e')]=function(){var _0x20066e=this;return function(_0x9befc4){if(_0x9befc4){freeIsNotKey(_0x9befc4,_0x20066e['sugarcrmAccounts'],'id');for(var _0x397632=0x0,_0x32bffb={},_0x1f8fdd={};_0x397632<_0x9befc4['length'];_0x397632+=0x1){_0x32bffb=_0x9befc4[_0x397632];if(_['isUndefined'](_0x20066e[_0x6ed0('0x20')][_0x32bffb['id']])){_0x20066e[_0x6ed0('0x20')][_0x32bffb['id']]=new SugarcrmAccount(_0x32bffb);}else{_0x20066e[_0x6ed0('0x42')](_0x20066e[_0x6ed0('0x20')][_0x32bffb['id']],_0x32bffb);}}}return _0x20066e[_0x6ed0('0x20')];};};Realtime[_0x6ed0('0x41')][_0x6ed0('0x4f')]=function(){var _0x591006=this;return function(_0x4e5f38){if(_0x4e5f38){freeIsNotKey(_0x4e5f38,_0x591006[_0x6ed0('0x24')],'id');for(var _0x309c24=0x0,_0x42faf5={},_0x3c48fa={};_0x309c24<_0x4e5f38[_0x6ed0('0x43')];_0x309c24+=0x1){_0x42faf5=_0x4e5f38[_0x309c24];if(_[_0x6ed0('0x45')](_0x591006[_0x6ed0('0x24')][_0x42faf5['id']])){_0x591006[_0x6ed0('0x24')][_0x42faf5['id']]=new VtigerAccount(_0x42faf5);}else{_0x591006[_0x6ed0('0x42')](_0x591006['vtigerAccounts'][_0x42faf5['id']],_0x42faf5);}}}return _0x591006['vtigerAccounts'];};};Realtime[_0x6ed0('0x41')][_0x6ed0('0x50')]=function(){var _0xb1203=this;return function(_0x52af5b){if(_0x52af5b){freeIsNotKey(_0x52af5b,_0xb1203[_0x6ed0('0x51')],'id');for(var _0x5edbc3=0x0,_0x593c90={},_0x494be8={};_0x5edbc3<_0x52af5b['length'];_0x5edbc3+=0x1){_0x593c90=_0x52af5b[_0x5edbc3];if(_[_0x6ed0('0x45')](_0xb1203['servicenowAccounts'][_0x593c90['id']])){_0xb1203[_0x6ed0('0x51')][_0x593c90['id']]=new ServicenowAccount(_0x593c90);}else{_0xb1203[_0x6ed0('0x42')](_0xb1203['servicenowAccounts'][_0x593c90['id']],_0x593c90);}}}return _0xb1203[_0x6ed0('0x51')];};};Realtime[_0x6ed0('0x41')][_0x6ed0('0x52')]=function(){var _0x1356ca=this;return function(_0x36b59c){if(_0x36b59c){freeIsNotKey(_0x36b59c,_0x1356ca[_0x6ed0('0x25')],'id');for(var _0x5652e0=0x0,_0x2c0d87={},_0x3fd156={};_0x5652e0<_0x36b59c[_0x6ed0('0x43')];_0x5652e0+=0x1){_0x2c0d87=_0x36b59c[_0x5652e0];if(_[_0x6ed0('0x45')](_0x1356ca[_0x6ed0('0x25')][_0x2c0d87['id']])){_0x1356ca[_0x6ed0('0x25')][_0x2c0d87['id']]=new Dynamics365Account(_0x2c0d87);}else{_0x1356ca['mergeFromDatabase'](_0x1356ca['dynamics365Accounts'][_0x2c0d87['id']],_0x2c0d87);}}}return _0x1356ca[_0x6ed0('0x25')];};};Realtime[_0x6ed0('0x41')][_0x6ed0('0x53')]=function(){var _0x1d2677=this;return function(_0x218c9e){if(_0x218c9e){freeIsNotKey(_0x218c9e,_0x1d2677['freshsalesAccounts'],'id');for(var _0x2c01d4=0x0,_0x1acf17={},_0x123b79={};_0x2c01d4<_0x218c9e[_0x6ed0('0x43')];_0x2c01d4+=0x1){_0x1acf17=_0x218c9e[_0x2c01d4];if(_[_0x6ed0('0x45')](_0x1d2677[_0x6ed0('0x26')][_0x1acf17['id']])){_0x1d2677['freshsalesAccounts'][_0x1acf17['id']]=new FreshsalesAccount(_0x1acf17);}else{_0x1d2677[_0x6ed0('0x42')](_0x1d2677['freshsalesAccounts'][_0x1acf17['id']],_0x1acf17);}}}return _0x1d2677[_0x6ed0('0x26')];};};Realtime[_0x6ed0('0x41')][_0x6ed0('0x54')]=function(){var _0x576a2f=this;return function(_0x310a9e){for(var _0xf69c92=0x0;_0xf69c92<_0x310a9e[_0x6ed0('0x43')];_0xf69c92+=0x1){_[_0x6ed0('0x55')](_0x576a2f[_0x6ed0('0x16')][_0x310a9e[_0xf69c92]['name']],_0x310a9e[_0xf69c92]);}return _0x576a2f['voiceQueues'];};};Realtime[_0x6ed0('0x41')]['initVoiceQueueReports']=function(){var _0xfeac5b=this;return function(_0x54de68){clearVoiceQueues(_0xfeac5b[_0x6ed0('0x16')]);if(_0x54de68){_0x54de68=_[_0x6ed0('0x56')](_0x54de68,_0x6ed0('0x57'));for(var _0x2980f2 in _0x54de68){if(_0x54de68[_0x6ed0('0x28')](_0x2980f2)){var _0x3ffa2f={};for(var _0x40601c=0x0;_0x40601c<_0x54de68[_0x2980f2]['length'];_0x40601c+=0x1){var _0x49aa40=_0x54de68[_0x2980f2][_0x40601c][_0x6ed0('0x58')];if(_0xfeac5b[_0x6ed0('0x16')][_0x49aa40]){if(_0x54de68[_0x2980f2][_0x40601c][_0x6ed0('0x59')]){_0xfeac5b[_0x6ed0('0x16')][_0x49aa40][_0x6ed0('0x34')]+=0x1;}if(_0x54de68[_0x2980f2][_0x40601c][_0x6ed0('0x5a')]){_0xfeac5b[_0x6ed0('0x16')][_0x49aa40][_0x6ed0('0x35')]+=0x1;}_0xfeac5b[_0x6ed0('0x16')][_0x49aa40][_0x6ed0('0x2e')]+=moment(_0x54de68[_0x2980f2][_0x40601c][_0x6ed0('0x5b')])[_0x6ed0('0x5c')](moment(_0x54de68[_0x2980f2][_0x40601c]['queuecallerjoinAt']),'seconds')||0x0;if(_0x40601c===_0x54de68[_0x2980f2][_0x6ed0('0x43')]-0x1){_0xfeac5b[_0x6ed0('0x16')][_0x49aa40][_0x6ed0('0x2f')]+=moment(_0x54de68[_0x2980f2][_0x40601c][_0x6ed0('0x5d')]||_0x54de68[_0x2980f2][_0x40601c][_0x6ed0('0x5e')]||_0x54de68[_0x2980f2][_0x40601c]['queuecallerexitAt'])[_0x6ed0('0x5c')](moment(_0x54de68[_0x2980f2][_0x40601c][_0x6ed0('0x5f')]),_0x6ed0('0x60'))||0x0;_0xfeac5b[_0x6ed0('0x16')][_0x49aa40][_0x6ed0('0x33')]+=0x1;if(_0x54de68[_0x2980f2][_0x40601c][_0x6ed0('0x61')]){_0xfeac5b[_0x6ed0('0x16')][_0x49aa40][_0x6ed0('0x2d')]+=0x1;_0xfeac5b['voiceQueues'][_0x49aa40]['sumBillable']+=moment(_0x54de68[_0x2980f2][_0x40601c][_0x6ed0('0x5d')])['diff'](moment(_0x54de68[_0x2980f2][_0x40601c]['queuecallerleaveAt']),_0x6ed0('0x60'))||0x0;}}else{_0xfeac5b[_0x6ed0('0x16')][_0x49aa40]['sumDuration']+=_0xfeac5b['voiceQueues'][_0x49aa40]['sumHoldTime']||0x0;}}}}}}return _0xfeac5b[_0x6ed0('0x16')];};};Realtime[_0x6ed0('0x41')]['initVoiceCallReports']=function(){var _0x529e3b=this;return function(_0x4babf9){clearVoiceCallReports(_0x529e3b[_0x6ed0('0x1a')]);if(_0x4babf9){for(var _0x3f2714=0x0;_0x3f2714<_0x4babf9[_0x6ed0('0x43')];_0x3f2714+=0x1){_0x529e3b[_0x6ed0('0x1a')]['total']+=0x1;_0x529e3b['outbound'][_0x6ed0('0x2f')]+=_0x4babf9[_0x3f2714][_0x6ed0('0x62')];if(_0x4babf9[_0x3f2714][_0x6ed0('0x63')]===_0x6ed0('0x64')){_0x529e3b[_0x6ed0('0x1a')][_0x6ed0('0x2d')]+=0x1;_0x529e3b[_0x6ed0('0x1a')]['sumHoldTime']+=_0x4babf9[_0x3f2714][_0x6ed0('0x62')]-_0x4babf9[_0x3f2714][_0x6ed0('0x65')]||0x0;_0x529e3b[_0x6ed0('0x1a')][_0x6ed0('0x30')]+=_0x4babf9[_0x3f2714][_0x6ed0('0x65')];}}}return _0x529e3b[_0x6ed0('0x1a')];};};Realtime['prototype']['initCampaigns']=function(){var _0x533b87=this;return function(_0x5dd0f6){if(_0x5dd0f6){freeIsNotKey(_0x5dd0f6,_0x533b87[_0x6ed0('0x18')],'name');for(var _0x14da61=0x0,_0x582ccf={};_0x14da61<_0x5dd0f6[_0x6ed0('0x43')];_0x14da61+=0x1){_0x582ccf=_0x5dd0f6[_0x14da61];if(_[_0x6ed0('0x45')](_0x533b87[_0x6ed0('0x18')][_0x582ccf[_0x6ed0('0x2b')]])){_0x533b87[_0x6ed0('0x18')][_0x582ccf[_0x6ed0('0x2b')]]=new Campaign(_0x582ccf);}else{_0x533b87['mergeFromDatabase'](_0x533b87[_0x6ed0('0x18')][_0x582ccf[_0x6ed0('0x2b')]],_0x582ccf);_0x533b87[_0x6ed0('0x18')][_0x582ccf[_0x6ed0('0x2b')]][_0x6ed0('0x66')]=_0x582ccf[_0x6ed0('0x67')]?_0x582ccf['SquareProject'][_0x6ed0('0x2b')]:undefined;}}}return _0x533b87[_0x6ed0('0x18')];};};Realtime[_0x6ed0('0x41')]['initVoiceExtensions']=function(){var _0x472706=this;return function(_0x129d1c){if(_0x129d1c){freeIsNotKey(_0x129d1c,_0x472706[_0x6ed0('0x68')],'id');for(var _0x576dbf=0x0,_0x31e7c1={};_0x576dbf<_0x129d1c['length'];_0x576dbf+=0x1){_0x31e7c1=_0x129d1c[_0x576dbf];if(_[_0x6ed0('0x45')](_0x472706[_0x6ed0('0x68')][_0x31e7c1['id']])){_0x472706['voiceExtensions'][_0x31e7c1['id']]=new VoiceExtension(_0x31e7c1);}else{_0x472706['mergeFromDatabase'](_0x472706[_0x6ed0('0x68')][_0x31e7c1['id']],_0x31e7c1);}}}return _0x472706['voiceExtensions'];};};Realtime['prototype']['initCampaignHopperHistory']=function(){var _0x3896e7=this;return function(_0x1e93a0){clearCampaigns(_0x3896e7['campaigns']);for(var _0xf4fdfd=0x0;_0xf4fdfd<_0x1e93a0[_0x6ed0('0x43')];_0xf4fdfd+=0x1){_[_0x6ed0('0x55')](_0x3896e7[_0x6ed0('0x18')][_0x1e93a0[_0xf4fdfd][_0x6ed0('0x2b')]],_0x1e93a0[_0xf4fdfd]);}return _0x3896e7[_0x6ed0('0x18')];};};Realtime[_0x6ed0('0x41')][_0x6ed0('0x69')]=function(){var _0x40848c=this;return function(_0x372ebe){if(_0x372ebe){freeIsNotKey(_0x372ebe,_0x40848c[_0x6ed0('0x6a')],'id');for(var _0xc0d1f4=0x0,_0x21e887={},_0x5006b1={};_0xc0d1f4<_0x372ebe['length'];_0xc0d1f4+=0x1){_0x21e887=_0x372ebe[_0xc0d1f4];if(_[_0x6ed0('0x45')](_0x40848c[_0x6ed0('0x6a')][_0x21e887['id']])){_0x40848c['faxAccounts'][_0x21e887['id']]=new FaxAccount(_0x21e887);}else{_0x40848c[_0x6ed0('0x42')](_0x40848c[_0x6ed0('0x6a')][_0x21e887['id']],_0x21e887);}}}return _0x40848c[_0x6ed0('0x6a')];};};module[_0x6ed0('0x6b')]=Realtime; \ No newline at end of file +var _0x777b=['initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercomplete','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','voiceQueues','triggers','templates','voiceExtensions','channels','queueChannels','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','interface','name','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isNil','isUndefined','initTrunks','trunks','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts'];(function(_0x2fa2ae,_0x5cc972){var _0x5b7a19=function(_0x45fec5){while(--_0x45fec5){_0x2fa2ae['push'](_0x2fa2ae['shift']());}};_0x5b7a19(++_0x5cc972);}(_0x777b,0x171));var _0xb777=function(_0x3a06b0,_0x1f22ed){_0x3a06b0=_0x3a06b0-0x0;var _0x11742b=_0x777b[_0x3a06b0];return _0x11742b;};'use strict';var BPromise=require(_0xb777('0x0'));var util=require(_0xb777('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require(_0xb777('0x2'));var Telephone=require(_0xb777('0x3'));var Trunk=require(_0xb777('0x4'));var VoiceQueue=require(_0xb777('0x5'));var Trigger=require(_0xb777('0x6'));var Template=require(_0xb777('0x7'));var Campaign=require(_0xb777('0x8'));var VoiceExtension=require(_0xb777('0x9'));var ZendeskAccount=require(_0xb777('0xa'));var SalesforceAccount=require(_0xb777('0xb'));var FreshdeskAccount=require(_0xb777('0xc'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0xb777('0xd'));var DeskAccount=require(_0xb777('0xe'));var VtigerAccount=require(_0xb777('0xf'));var ServicenowAccount=require(_0xb777('0x10'));var Dynamics365Account=require(_0xb777('0x11'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xb777('0x12'));var Realtime=function(){this[_0xb777('0x13')]={};this[_0xb777('0x14')]={};this['trunks']={};this[_0xb777('0x15')]={};this[_0xb777('0x16')]={};this['campaigns']={};this[_0xb777('0x17')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xb777('0x18')]={};this[_0xb777('0x19')]={};this[_0xb777('0x1a')]={};this['outboundChannels']={};this['timers']={};this['settings']={};this[_0xb777('0x1b')]={};this['salesforceAccounts']={};this[_0xb777('0x1c')]={};this[_0xb777('0x1d')]={};this[_0xb777('0x1e')]={};this[_0xb777('0x1f')]={};this[_0xb777('0x20')]={};this['servicenowAccounts']={};this[_0xb777('0x21')]={};this[_0xb777('0x22')]={};this[_0xb777('0x23')]={};};function freeIsNotKey(_0x360ee9,_0x4d6ee4,_0x3ce7f1){var _0x55dbf1=_[_0xb777('0x24')](_0x360ee9,function(_0x4254a2,_0x4dadec){return _0x4254a2[_0x3ce7f1];});for(var _0x5d697a in _0x4d6ee4){if(_0x4d6ee4[_0xb777('0x25')](_0x5d697a)){if(!_0x55dbf1[_0x5d697a]){delete _0x4d6ee4[_0x5d697a];}}}}function freeIsNotKeySip(_0x2670fe,_0x720812){var _0x1355b2=_[_0xb777('0x24')](_0x2670fe,function(_0x7e5da1,_0x53abde){return util[_0xb777('0x26')](_0xb777('0x27'),_0x7e5da1['name']);});for(var _0x32c20c in _0x720812){if(_0x720812[_0xb777('0x25')](_0x32c20c)){if(!_0x1355b2[_0x32c20c]){delete _0x720812[_0x32c20c];}}}}function freeIsNotKeyAgent(_0x58bcc1,_0x3409d3){var _0x4f8e03=_[_0xb777('0x24')](_0x58bcc1,function(_0x1307a3,_0x17b159){var _0x24bda5=_['isNil'](_0x1307a3[_0xb777('0x28')])?util[_0xb777('0x26')]('SIP/%s',_0x1307a3[_0xb777('0x29')]):_0x1307a3[_0xb777('0x28')];return _0x24bda5;});for(var _0x1f0dbf in _0x3409d3){if(_0x3409d3[_0xb777('0x25')](_0x1f0dbf)){if(!_0x4f8e03[_0x1f0dbf]){delete _0x3409d3[_0x1f0dbf];}}}}function clearVoiceCallReports(_0x12f046){_0x12f046[_0xb777('0x2a')]=0x0;_0x12f046[_0xb777('0x2b')]=0x0;_0x12f046[_0xb777('0x2c')]=0x0;_0x12f046[_0xb777('0x2d')]=0x0;_0x12f046[_0xb777('0x2e')]=0x0;}function clearCampaigns(_0x3a6200){if(!_[_0xb777('0x2f')](_0x3a6200)){for(var _0x2cf03a in _0x3a6200){if(_0x3a6200[_0xb777('0x25')](_0x2cf03a)){_0x3a6200[_0x2cf03a][_0xb777('0x30')]=0x0;_0x3a6200[_0x2cf03a][_0xb777('0x31')]=0x0;}}}}function clearVoiceQueues(_0x53b38a){if(!_[_0xb777('0x2f')](_0x53b38a)){for(var _0x25a0ac in _0x53b38a){if(_0x53b38a[_0xb777('0x25')](_0x25a0ac)){_0x53b38a[_0x25a0ac][_0xb777('0x2a')]=0x0;_0x53b38a[_0x25a0ac][_0xb777('0x2b')]=0x0;_0x53b38a[_0x25a0ac][_0xb777('0x32')]=0x0;_0x53b38a[_0x25a0ac][_0xb777('0x33')]=0x0;_0x53b38a[_0x25a0ac]['sumHoldTime']=0x0;_0x53b38a[_0x25a0ac]['sumDuration']=0x0;_0x53b38a[_0x25a0ac][_0xb777('0x2e')]=0x0;_0x53b38a[_0x25a0ac][_0xb777('0x34')]=0x0;_0x53b38a[_0x25a0ac][_0xb777('0x35')]=0x0;_0x53b38a[_0x25a0ac][_0xb777('0x36')]=0x0;_0x53b38a[_0x25a0ac][_0xb777('0x37')]=0x0;_0x53b38a[_0x25a0ac][_0xb777('0x38')]=0x0;_0x53b38a[_0x25a0ac][_0xb777('0x39')]=0x0;_0x53b38a[_0x25a0ac]['outboundDropCallsDayTimeout']=0x0;_0x53b38a[_0x25a0ac]['outboundDropCallsDayCallersExit']=0x0;_0x53b38a[_0x25a0ac][_0xb777('0x3a')]=0x0;_0x53b38a[_0x25a0ac][_0xb777('0x3b')]=0x0;_0x53b38a[_0x25a0ac][_0xb777('0x3c')]=0x0;_0x53b38a[_0x25a0ac][_0xb777('0x3d')]=0x0;_0x53b38a[_0x25a0ac]['outboundAnswerAgiCallsDay']=0x0;_0x53b38a[_0x25a0ac]['outboundAnswerCallsDay']=0x0;_0x53b38a[_0x25a0ac][_0xb777('0x3e')]=!![];}}}}Realtime[_0xb777('0x3f')][_0xb777('0x40')]=function(_0x1bec36,_0x4f327d){for(var _0x1b3072 in _0x4f327d){if(_0x1bec36[_0xb777('0x25')](_0x1b3072)){_0x1bec36[_0x1b3072]=_0x4f327d[_0x1b3072];}}};Realtime['prototype']['initAgents']=function(){var _0x34657a=this;return function(_0x399e9b){if(_0x399e9b){freeIsNotKeyAgent(_0x399e9b,_0x34657a[_0xb777('0x13')]);for(var _0xe39e8d=0x0,_0x471b07={},_0x54993b={};_0xe39e8d<_0x399e9b[_0xb777('0x41')];_0xe39e8d+=0x1){_0x471b07=_0x399e9b[_0xe39e8d];var _0x237485=_[_0xb777('0x42')](_0x471b07['interface'])?util[_0xb777('0x26')](_0xb777('0x27'),_0x471b07[_0xb777('0x29')]):_0x471b07[_0xb777('0x28')];if(_[_0xb777('0x43')](_0x34657a[_0xb777('0x13')][_0x237485])){_0x34657a[_0xb777('0x13')][_0x237485]=new Agent(_0x471b07);}else{_0x34657a[_0xb777('0x40')](_0x34657a[_0xb777('0x13')][_0x237485],_0x471b07);}}}return _0x34657a[_0xb777('0x13')];};};Realtime['prototype']['initTelephones']=function(){var _0x1d9e7b=this;return function(_0x3da864){if(_0x3da864){freeIsNotKeySip(_0x3da864,_0x1d9e7b[_0xb777('0x14')]);for(var _0x434a72=0x0,_0x1c308d={},_0x11eb63={};_0x434a72<_0x3da864['length'];_0x434a72+=0x1){_0x1c308d=_0x3da864[_0x434a72];if(_[_0xb777('0x43')](_0x1d9e7b['telephones'][util[_0xb777('0x26')](_0xb777('0x27'),_0x1c308d[_0xb777('0x29')])])){_0x1d9e7b[_0xb777('0x14')][util['format'](_0xb777('0x27'),_0x1c308d['name'])]=new Telephone(_0x1c308d);}else{_0x1d9e7b[_0xb777('0x40')](_0x1d9e7b[_0xb777('0x14')][util[_0xb777('0x26')](_0xb777('0x27'),_0x1c308d[_0xb777('0x29')])],_0x1c308d);}}}return _0x1d9e7b[_0xb777('0x14')];};};Realtime[_0xb777('0x3f')][_0xb777('0x44')]=function(){var _0x1b908f=this;return function(_0x228eda){if(_0x228eda){freeIsNotKeySip(_0x228eda,_0x1b908f[_0xb777('0x45')]);for(var _0x243bca=0x0,_0x4f39b5={},_0x1c2900={};_0x243bca<_0x228eda[_0xb777('0x41')];_0x243bca+=0x1){_0x4f39b5=_0x228eda[_0x243bca];if(_['isUndefined'](_0x1b908f['trunks'][util[_0xb777('0x26')](_0xb777('0x27'),_0x4f39b5[_0xb777('0x29')])])){_0x1b908f[_0xb777('0x45')][util['format'](_0xb777('0x27'),_0x4f39b5[_0xb777('0x29')])]=new Trunk(_0x4f39b5);}else{_0x1b908f[_0xb777('0x40')](_0x1b908f['trunks'][util['format'](_0xb777('0x27'),_0x4f39b5[_0xb777('0x29')])],_0x4f39b5);}}}return _0x1b908f['trunks'];};};Realtime[_0xb777('0x3f')][_0xb777('0x46')]=function(){var _0x1f0360=this;return function(_0x275ff4){if(_0x275ff4){freeIsNotKey(_0x275ff4,_0x1f0360[_0xb777('0x15')],_0xb777('0x29'));for(var _0x5cda57=0x0,_0x307520={},_0x5ac96b={};_0x5cda57<_0x275ff4[_0xb777('0x41')];_0x5cda57+=0x1){_0x307520=_0x275ff4[_0x5cda57];if(_[_0xb777('0x43')](_0x1f0360[_0xb777('0x15')][_0x307520[_0xb777('0x29')]])){_0x1f0360[_0xb777('0x15')][_0x307520[_0xb777('0x29')]]=new VoiceQueue(_0x307520);}else{_0x1f0360[_0xb777('0x40')](_0x1f0360[_0xb777('0x15')][_0x307520[_0xb777('0x29')]],_0x307520);}}}return _0x1f0360['voiceQueues'];};};Realtime[_0xb777('0x3f')][_0xb777('0x47')]=function(){var _0x5ef5c2=this;return function(_0x1a65ca){if(_0x1a65ca){freeIsNotKey(_0x1a65ca,_0x5ef5c2[_0xb777('0x16')],'id');for(var _0x9afc52=0x0,_0x7fa240={},_0x188bd4={};_0x9afc52<_0x1a65ca['length'];_0x9afc52+=0x1){_0x7fa240=_0x1a65ca[_0x9afc52];if(_[_0xb777('0x43')](_0x5ef5c2[_0xb777('0x16')][_0x7fa240['id']])){_0x5ef5c2[_0xb777('0x16')][_0x7fa240['id']]=new Trigger(_0x7fa240);}else{_0x5ef5c2[_0xb777('0x40')](_0x5ef5c2[_0xb777('0x16')][_0x7fa240['id']],_0x7fa240);}}}return _0x5ef5c2[_0xb777('0x16')];};};Realtime[_0xb777('0x3f')][_0xb777('0x48')]=function(){var _0x22c03e=this;return function(_0x562671){if(_0x562671){freeIsNotKey(_0x562671,_0x22c03e['templates'],'id');for(var _0x3f3a78=0x0,_0x23bedd={},_0x52b2f5={};_0x3f3a78<_0x562671[_0xb777('0x41')];_0x3f3a78+=0x1){_0x23bedd=_0x562671[_0x3f3a78];if(_['isUndefined'](_0x22c03e['templates'][_0x23bedd['id']])){_0x22c03e[_0xb777('0x17')][_0x23bedd['id']]=new Template(_0x23bedd);}else{_0x22c03e[_0xb777('0x40')](_0x22c03e[_0xb777('0x17')][_0x23bedd['id']],_0x23bedd);}}}return _0x22c03e[_0xb777('0x17')];};};Realtime['prototype'][_0xb777('0x49')]=function(){var _0x36583e=this;return function(_0x3b33d3){if(_0x3b33d3){freeIsNotKey(_0x3b33d3,_0x36583e['zendeskAccounts'],'id');for(var _0x181e09=0x0,_0x311de9={},_0x251d04={};_0x181e09<_0x3b33d3[_0xb777('0x41')];_0x181e09+=0x1){_0x311de9=_0x3b33d3[_0x181e09];if(_[_0xb777('0x43')](_0x36583e['zendeskAccounts'][_0x311de9['id']])){_0x36583e['zendeskAccounts'][_0x311de9['id']]=new ZendeskAccount(_0x311de9);}else{_0x36583e['mergeFromDatabase'](_0x36583e['zendeskAccounts'][_0x311de9['id']],_0x311de9);}}}return _0x36583e[_0xb777('0x1b')];};};Realtime[_0xb777('0x3f')][_0xb777('0x4a')]=function(){var _0x5bb59a=this;return function(_0x21ea06){if(_0x21ea06){freeIsNotKey(_0x21ea06,_0x5bb59a[_0xb777('0x4b')],'id');for(var _0x5cd727=0x0,_0x2a6f2b={},_0x29c297={};_0x5cd727<_0x21ea06[_0xb777('0x41')];_0x5cd727+=0x1){_0x2a6f2b=_0x21ea06[_0x5cd727];if(_[_0xb777('0x43')](_0x5bb59a[_0xb777('0x4b')][_0x2a6f2b['id']])){_0x5bb59a[_0xb777('0x4b')][_0x2a6f2b['id']]=new SalesforceAccount(_0x2a6f2b);}else{_0x5bb59a[_0xb777('0x40')](_0x5bb59a[_0xb777('0x4b')][_0x2a6f2b['id']],_0x2a6f2b);}}}return _0x5bb59a[_0xb777('0x4b')];};};Realtime['prototype'][_0xb777('0x4c')]=function(){var _0x5bce49=this;return function(_0x2f1047){if(_0x2f1047){freeIsNotKey(_0x2f1047,_0x5bce49[_0xb777('0x1d')],'id');for(var _0x47ffc5=0x0,_0x1a1562={},_0x5376e3={};_0x47ffc5<_0x2f1047[_0xb777('0x41')];_0x47ffc5+=0x1){_0x1a1562=_0x2f1047[_0x47ffc5];if(_[_0xb777('0x43')](_0x5bce49[_0xb777('0x1d')][_0x1a1562['id']])){_0x5bce49['freshdeskAccounts'][_0x1a1562['id']]=new FreshdeskAccount(_0x1a1562);}else{_0x5bce49[_0xb777('0x40')](_0x5bce49[_0xb777('0x1d')][_0x1a1562['id']],_0x1a1562);}}}return _0x5bce49[_0xb777('0x1d')];};};Realtime[_0xb777('0x3f')]['initZohoAccounts']=function(){var _0x44c152=this;return function(_0x6fcf7b){if(_0x6fcf7b){freeIsNotKey(_0x6fcf7b,_0x44c152[_0xb777('0x1e')],'id');for(var _0x39179f=0x0,_0x4cc000={},_0x5dfc1e={};_0x39179f<_0x6fcf7b[_0xb777('0x41')];_0x39179f+=0x1){_0x4cc000=_0x6fcf7b[_0x39179f];if(_[_0xb777('0x43')](_0x44c152[_0xb777('0x1e')][_0x4cc000['id']])){_0x44c152['zohoAccounts'][_0x4cc000['id']]=new ZohoAccount(_0x4cc000);}else{_0x44c152[_0xb777('0x40')](_0x44c152[_0xb777('0x1e')][_0x4cc000['id']],_0x4cc000);}}}return _0x44c152[_0xb777('0x1e')];};};Realtime[_0xb777('0x3f')][_0xb777('0x4d')]=function(){var _0x1d0ca5=this;return function(_0x44f1da){if(_0x44f1da){freeIsNotKey(_0x44f1da,_0x1d0ca5[_0xb777('0x1f')],'id');for(var _0x35dfa3=0x0,_0x2cf261={},_0x5b4925={};_0x35dfa3<_0x44f1da[_0xb777('0x41')];_0x35dfa3+=0x1){_0x2cf261=_0x44f1da[_0x35dfa3];if(_['isUndefined'](_0x1d0ca5[_0xb777('0x1f')][_0x2cf261['id']])){_0x1d0ca5[_0xb777('0x1f')][_0x2cf261['id']]=new DeskAccount(_0x2cf261);}else{_0x1d0ca5[_0xb777('0x40')](_0x1d0ca5['deskAccounts'][_0x2cf261['id']],_0x2cf261);}}}return _0x1d0ca5[_0xb777('0x1f')];};};Realtime['prototype'][_0xb777('0x4e')]=function(){var _0x1991eb=this;return function(_0x4f5007){if(_0x4f5007){freeIsNotKey(_0x4f5007,_0x1991eb['sugarcrmAccounts'],'id');for(var _0x464edf=0x0,_0x254e00={},_0x2f124e={};_0x464edf<_0x4f5007['length'];_0x464edf+=0x1){_0x254e00=_0x4f5007[_0x464edf];if(_[_0xb777('0x43')](_0x1991eb[_0xb777('0x1c')][_0x254e00['id']])){_0x1991eb[_0xb777('0x1c')][_0x254e00['id']]=new SugarcrmAccount(_0x254e00);}else{_0x1991eb['mergeFromDatabase'](_0x1991eb[_0xb777('0x1c')][_0x254e00['id']],_0x254e00);}}}return _0x1991eb[_0xb777('0x1c')];};};Realtime[_0xb777('0x3f')][_0xb777('0x4f')]=function(){var _0x3ec808=this;return function(_0x5e9628){if(_0x5e9628){freeIsNotKey(_0x5e9628,_0x3ec808[_0xb777('0x20')],'id');for(var _0x474971=0x0,_0x4ffbc3={},_0x1359d6={};_0x474971<_0x5e9628[_0xb777('0x41')];_0x474971+=0x1){_0x4ffbc3=_0x5e9628[_0x474971];if(_[_0xb777('0x43')](_0x3ec808[_0xb777('0x20')][_0x4ffbc3['id']])){_0x3ec808[_0xb777('0x20')][_0x4ffbc3['id']]=new VtigerAccount(_0x4ffbc3);}else{_0x3ec808[_0xb777('0x40')](_0x3ec808[_0xb777('0x20')][_0x4ffbc3['id']],_0x4ffbc3);}}}return _0x3ec808['vtigerAccounts'];};};Realtime[_0xb777('0x3f')][_0xb777('0x50')]=function(){var _0x30cea7=this;return function(_0x470726){if(_0x470726){freeIsNotKey(_0x470726,_0x30cea7[_0xb777('0x51')],'id');for(var _0x505a48=0x0,_0x2a0d12={},_0x53221d={};_0x505a48<_0x470726[_0xb777('0x41')];_0x505a48+=0x1){_0x2a0d12=_0x470726[_0x505a48];if(_[_0xb777('0x43')](_0x30cea7[_0xb777('0x51')][_0x2a0d12['id']])){_0x30cea7['servicenowAccounts'][_0x2a0d12['id']]=new ServicenowAccount(_0x2a0d12);}else{_0x30cea7['mergeFromDatabase'](_0x30cea7['servicenowAccounts'][_0x2a0d12['id']],_0x2a0d12);}}}return _0x30cea7[_0xb777('0x51')];};};Realtime[_0xb777('0x3f')][_0xb777('0x52')]=function(){var _0x5e9ffd=this;return function(_0x5952bd){if(_0x5952bd){freeIsNotKey(_0x5952bd,_0x5e9ffd[_0xb777('0x21')],'id');for(var _0x4c62c2=0x0,_0x179771={},_0x597698={};_0x4c62c2<_0x5952bd[_0xb777('0x41')];_0x4c62c2+=0x1){_0x179771=_0x5952bd[_0x4c62c2];if(_['isUndefined'](_0x5e9ffd[_0xb777('0x21')][_0x179771['id']])){_0x5e9ffd[_0xb777('0x21')][_0x179771['id']]=new Dynamics365Account(_0x179771);}else{_0x5e9ffd[_0xb777('0x40')](_0x5e9ffd[_0xb777('0x21')][_0x179771['id']],_0x179771);}}}return _0x5e9ffd['dynamics365Accounts'];};};Realtime[_0xb777('0x3f')][_0xb777('0x53')]=function(){var _0x4e134c=this;return function(_0x2619db){if(_0x2619db){freeIsNotKey(_0x2619db,_0x4e134c['freshsalesAccounts'],'id');for(var _0x160cfe=0x0,_0x13204e={},_0x4a6c36={};_0x160cfe<_0x2619db[_0xb777('0x41')];_0x160cfe+=0x1){_0x13204e=_0x2619db[_0x160cfe];if(_[_0xb777('0x43')](_0x4e134c[_0xb777('0x22')][_0x13204e['id']])){_0x4e134c['freshsalesAccounts'][_0x13204e['id']]=new FreshsalesAccount(_0x13204e);}else{_0x4e134c[_0xb777('0x40')](_0x4e134c['freshsalesAccounts'][_0x13204e['id']],_0x13204e);}}}return _0x4e134c[_0xb777('0x22')];};};Realtime['prototype'][_0xb777('0x54')]=function(){var _0x42ed31=this;return function(_0x16e472){for(var _0x1acda0=0x0;_0x1acda0<_0x16e472[_0xb777('0x41')];_0x1acda0+=0x1){_[_0xb777('0x55')](_0x42ed31[_0xb777('0x15')][_0x16e472[_0x1acda0]['name']],_0x16e472[_0x1acda0]);}return _0x42ed31[_0xb777('0x15')];};};Realtime[_0xb777('0x3f')][_0xb777('0x56')]=function(){var _0x495ffc=this;return function(_0x3246d3){clearVoiceQueues(_0x495ffc[_0xb777('0x15')]);if(_0x3246d3){_0x3246d3=_[_0xb777('0x57')](_0x3246d3,_0xb777('0x58'));for(var _0x2fea1 in _0x3246d3){if(_0x3246d3[_0xb777('0x25')](_0x2fea1)){var _0x137ccf={};for(var _0x15fef0=0x0;_0x15fef0<_0x3246d3[_0x2fea1][_0xb777('0x41')];_0x15fef0+=0x1){var _0x5d9770=_0x3246d3[_0x2fea1][_0x15fef0][_0xb777('0x59')];if(_0x495ffc['voiceQueues'][_0x5d9770]){if(_0x3246d3[_0x2fea1][_0x15fef0][_0xb777('0x5a')]){_0x495ffc['voiceQueues'][_0x5d9770][_0xb777('0x32')]+=0x1;}if(_0x3246d3[_0x2fea1][_0x15fef0][_0xb777('0x5b')]){_0x495ffc[_0xb777('0x15')][_0x5d9770][_0xb777('0x33')]+=0x1;}_0x495ffc[_0xb777('0x15')][_0x5d9770]['sumHoldTime']+=moment(_0x3246d3[_0x2fea1][_0x15fef0]['queuecallerleaveAt'])['diff'](moment(_0x3246d3[_0x2fea1][_0x15fef0][_0xb777('0x5c')]),_0xb777('0x5d'))||0x0;if(_0x15fef0===_0x3246d3[_0x2fea1][_0xb777('0x41')]-0x1){_0x495ffc[_0xb777('0x15')][_0x5d9770][_0xb777('0x2d')]+=moment(_0x3246d3[_0x2fea1][_0x15fef0][_0xb777('0x5e')]||_0x3246d3[_0x2fea1][_0x15fef0][_0xb777('0x5f')]||_0x3246d3[_0x2fea1][_0x15fef0][_0xb777('0x60')])[_0xb777('0x61')](moment(_0x3246d3[_0x2fea1][_0x15fef0][_0xb777('0x5c')]),_0xb777('0x5d'))||0x0;_0x495ffc[_0xb777('0x15')][_0x5d9770]['total']+=0x1;if(_0x3246d3[_0x2fea1][_0x15fef0][_0xb777('0x62')]){_0x495ffc['voiceQueues'][_0x5d9770][_0xb777('0x2b')]+=0x1;_0x495ffc[_0xb777('0x15')][_0x5d9770]['sumBillable']+=moment(_0x3246d3[_0x2fea1][_0x15fef0][_0xb777('0x5e')])[_0xb777('0x61')](moment(_0x3246d3[_0x2fea1][_0x15fef0]['queuecallerleaveAt']),_0xb777('0x5d'))||0x0;}}else{_0x495ffc[_0xb777('0x15')][_0x5d9770]['sumDuration']+=_0x495ffc['voiceQueues'][_0x5d9770][_0xb777('0x2c')]||0x0;}}}}}}return _0x495ffc[_0xb777('0x15')];};};Realtime['prototype'][_0xb777('0x63')]=function(){var _0x436f64=this;return function(_0x15f77c){clearVoiceCallReports(_0x436f64[_0xb777('0x64')]);if(_0x15f77c){for(var _0x50c0af=0x0;_0x50c0af<_0x15f77c[_0xb777('0x41')];_0x50c0af+=0x1){_0x436f64['outbound'][_0xb777('0x2a')]+=0x1;_0x436f64['outbound'][_0xb777('0x2d')]+=_0x15f77c[_0x50c0af][_0xb777('0x65')];if(_0x15f77c[_0x50c0af][_0xb777('0x66')]===_0xb777('0x67')){_0x436f64[_0xb777('0x64')]['answered']+=0x1;_0x436f64[_0xb777('0x64')][_0xb777('0x2c')]+=_0x15f77c[_0x50c0af][_0xb777('0x65')]-_0x15f77c[_0x50c0af][_0xb777('0x68')]||0x0;_0x436f64[_0xb777('0x64')][_0xb777('0x2e')]+=_0x15f77c[_0x50c0af][_0xb777('0x68')];}}}return _0x436f64[_0xb777('0x64')];};};Realtime['prototype'][_0xb777('0x69')]=function(){var _0x2423ac=this;return function(_0x53ef57){if(_0x53ef57){freeIsNotKey(_0x53ef57,_0x2423ac['campaigns'],_0xb777('0x29'));for(var _0x5140a3=0x0,_0x3909fa={};_0x5140a3<_0x53ef57[_0xb777('0x41')];_0x5140a3+=0x1){_0x3909fa=_0x53ef57[_0x5140a3];if(_['isUndefined'](_0x2423ac['campaigns'][_0x3909fa[_0xb777('0x29')]])){_0x2423ac[_0xb777('0x6a')][_0x3909fa[_0xb777('0x29')]]=new Campaign(_0x3909fa);}else{_0x2423ac[_0xb777('0x40')](_0x2423ac[_0xb777('0x6a')][_0x3909fa[_0xb777('0x29')]],_0x3909fa);_0x2423ac[_0xb777('0x6a')][_0x3909fa[_0xb777('0x29')]][_0xb777('0x6b')]=_0x3909fa[_0xb777('0x6c')]?_0x3909fa[_0xb777('0x6c')][_0xb777('0x29')]:undefined;}}}return _0x2423ac['campaigns'];};};Realtime['prototype'][_0xb777('0x6d')]=function(){var _0x4436a5=this;return function(_0x223293){if(_0x223293){freeIsNotKey(_0x223293,_0x4436a5[_0xb777('0x18')],'id');for(var _0x4e97b7=0x0,_0x1cb5fa={};_0x4e97b7<_0x223293[_0xb777('0x41')];_0x4e97b7+=0x1){_0x1cb5fa=_0x223293[_0x4e97b7];if(_[_0xb777('0x43')](_0x4436a5['voiceExtensions'][_0x1cb5fa['id']])){_0x4436a5[_0xb777('0x18')][_0x1cb5fa['id']]=new VoiceExtension(_0x1cb5fa);}else{_0x4436a5['mergeFromDatabase'](_0x4436a5[_0xb777('0x18')][_0x1cb5fa['id']],_0x1cb5fa);}}}return _0x4436a5[_0xb777('0x18')];};};Realtime[_0xb777('0x3f')][_0xb777('0x6e')]=function(){var _0x4c5699=this;return function(_0x412826){clearCampaigns(_0x4c5699[_0xb777('0x6a')]);for(var _0x8f200e=0x0;_0x8f200e<_0x412826[_0xb777('0x41')];_0x8f200e+=0x1){_['merge'](_0x4c5699['campaigns'][_0x412826[_0x8f200e]['name']],_0x412826[_0x8f200e]);}return _0x4c5699['campaigns'];};};Realtime[_0xb777('0x3f')][_0xb777('0x6f')]=function(){var _0x1109b2=this;return function(_0x2b6ca9){if(_0x2b6ca9){freeIsNotKey(_0x2b6ca9,_0x1109b2[_0xb777('0x23')],'id');for(var _0x3b3a06=0x0,_0x155152={},_0x436f1a={};_0x3b3a06<_0x2b6ca9[_0xb777('0x41')];_0x3b3a06+=0x1){_0x155152=_0x2b6ca9[_0x3b3a06];if(_[_0xb777('0x43')](_0x1109b2['faxAccounts'][_0x155152['id']])){_0x1109b2[_0xb777('0x23')][_0x155152['id']]=new FaxAccount(_0x155152);}else{_0x1109b2[_0xb777('0x40')](_0x1109b2['faxAccounts'][_0x155152['id']],_0x155152);}}}return _0x1109b2[_0xb777('0x23')];};};module[_0xb777('0x70')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 012e2c2..4362fc4 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 _0x6c58=['from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','callerid','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','split','UserId','membername','monitors','monitorFilename','createdAt','exten','connectedlinename','isArray','forEach','voiceDialReport','startsWith','Local','indexOf','mobile','substring','lastIndexOf','transfererlinkedid','exports','lodash','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','prototype','realtime','xdr','disabled','custom:voiceQueueReport','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','bind','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','SIP/%s','voiceQueueReport','length','connectedlinenum','assigned','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','getCallType','channel','outbound','internal','destination','type','dialer','lastapplication','lastdata','queue','context','from-voip-provider'];(function(_0x284048,_0x5b9381){var _0x1769b0=function(_0x203f4a){while(--_0x203f4a){_0x284048['push'](_0x284048['shift']());}};_0x1769b0(++_0x5b9381);}(_0x6c58,0x141));var _0x86c5=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x6c58[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0x86c5('0x0'));var moment=require('moment');var util=require('util');var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require(_0x86c5('0x1'));var RpcVoiceCallReport=require(_0x86c5('0x2'));var RpcVoiceDialReport=require(_0x86c5('0x3'));var RpcMemberReport=require(_0x86c5('0x4'));var RpcVoiceQueueReport=require(_0x86c5('0x5'));var RpcVoiceRecording=require(_0x86c5('0x6'));var RpcVoiceTransferReport=require(_0x86c5('0x7'));var VoiceQueueReport=require(_0x86c5('0x8'));var VoiceCallReport=require(_0x86c5('0x9'));var VoiceAgentReport=require(_0x86c5('0xa'));var VoiceDialReport=require(_0x86c5('0xb'));var UserReport=require(_0x86c5('0xc'));function Report(_0x29e5ab){this['realtime']=_0x29e5ab;this[_0x86c5('0xd')]=_0x29e5ab[_0x86c5('0xd')];this[_0x86c5('0xe')]=_0x29e5ab[_0x86c5('0xe')];}Report[_0x86c5('0xf')]['sync']=function(_0x153735){var _0x539231=new VoiceQueueReport(this[_0x86c5('0x10')]);var _0x2ccad7=new VoiceAgentReport(this[_0x86c5('0x10')]);var _0x4472c0=new VoiceDialReport(this[_0x86c5('0x10')]);var _0x579c74=new VoiceCallReport(this[_0x86c5('0x10')]);var _0x397ba7=new UserReport(this[_0x86c5('0x10')]);if(config[_0x86c5('0x11')]&&config[_0x86c5('0x11')][_0x86c5('0x12')]){ami['on'](_0x86c5('0x13'),this['voiceQueueReport']['bind'](this));ami['on'](_0x86c5('0x14'),this[_0x86c5('0x15')]['bind'](this));ami['on'](_0x86c5('0x16'),this[_0x86c5('0x17')][_0x86c5('0x18')](this));ami['on'](_0x86c5('0x19'),this['voiceDialReport']['bind'](this));ami['on'](_0x86c5('0x1a'),this[_0x86c5('0x1b')]['bind'](this));ami['on'](_0x86c5('0x1c'),this[_0x86c5('0x1d')][_0x86c5('0x18')](this));}};Report[_0x86c5('0xf')][_0x86c5('0x1e')]=function(_0x52a90b){var _0x34c856;_0x34c856=_[_0x86c5('0x1f')](this[_0x86c5('0xd')],function(_0x34b852){return _0x34b852[_0x86c5('0x20')]==_0x52a90b||_0x34b852[_0x86c5('0x21')]==_0x52a90b;});if(_[_0x86c5('0x22')](_0x34c856)){var _0x4b31d4=_['find'](this[_0x86c5('0xe')],function(_0x493f75){return _0x493f75[_0x86c5('0x20')]==_0x52a90b||_0x493f75[_0x86c5('0x21')]==_0x52a90b;});if(_0x4b31d4){_0x34c856=_[_0x86c5('0x1f')](this['agents'],function(_0x312668){return _0x312668[_0x86c5('0x23')]==util['format'](_0x86c5('0x24'),_0x4b31d4[_0x86c5('0x21')]);});}}return _0x34c856;};Report[_0x86c5('0xf')][_0x86c5('0x25')]=function(_0x44bc09){for(var _0x279c58=0x0;_0x279c58<_0x44bc09[_0x86c5('0x26')];_0x279c58+=0x1){var _0x4dc461=this[_0x86c5('0x1e')](_0x44bc09[_0x279c58][_0x86c5('0x27')]);if(_0x4dc461){_0x44bc09[_0x279c58][_0x86c5('0x20')]=_0x4dc461[_0x86c5('0x20')];_0x44bc09[_0x279c58][_0x86c5('0x28')]=!![];_0x44bc09[_0x279c58]['lastAssignedTo']=_0x4dc461[_0x86c5('0x21')];_0x44bc09[_0x279c58][_0x86c5('0x23')]=_[_0x86c5('0x22')](_0x4dc461[_0x86c5('0x23')])?util[_0x86c5('0x29')]('SIP/%s',_0x4dc461['name']):_0x4dc461[_0x86c5('0x23')];if(_0x44bc09[_0x279c58][_0x86c5('0x2a')]){_0x44bc09[_0x279c58][_0x86c5('0x2b')]=moment()['format'](_0x86c5('0x2c'));}if(_0x44bc09[_0x279c58][_0x86c5('0x2d')]){_0x44bc09[_0x279c58][_0x86c5('0x2e')]=moment()[_0x86c5('0x29')](_0x86c5('0x2c'));}RpcMemberReport[_0x86c5('0x25')](_0x44bc09[_0x279c58]);}RpcVoiceQueueReport[_0x86c5('0x2f')](_0x44bc09[_0x279c58]);}};function extractCalleridNumber(_0x3deeb4){var _0x2a1ea4=_0x3deeb4[_0x86c5('0x30')](/<(.*?)>/);return _0x2a1ea4?_0x2a1ea4[0x1]:_0x3deeb4;}Report[_0x86c5('0xf')][_0x86c5('0x31')]=function(_0x33d48c){for(var _0xd82621=0x0;_0xd82621','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','UserId','membername','create','monitor','monitors','filename','createdAt','exten','connectedlinename','xcally-motion-dialer'];(function(_0x26b288,_0x109285){var _0x3f6159=function(_0x5b4a4c){while(--_0x5b4a4c){_0x26b288['push'](_0x26b288['shift']());}};_0x3f6159(++_0x109285);}(_0x1489,0x125));var _0x9148=function(_0x181d2d,_0x480cc8){_0x181d2d=_0x181d2d-0x0;var _0x4a0cfc=_0x1489[_0x181d2d];return _0x4a0cfc;};'use strict';var _=require(_0x9148('0x0'));var moment=require('moment');var util=require('util');var config=require(_0x9148('0x1'));var ami=require(_0x9148('0x2'));var RpcVoiceAgentReport=require(_0x9148('0x3'));var RpcVoiceCallReport=require(_0x9148('0x4'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x9148('0x5'));var RpcVoiceRecording=require(_0x9148('0x6'));var RpcVoiceTransferReport=require(_0x9148('0x7'));var VoiceQueueReport=require(_0x9148('0x8'));var VoiceCallReport=require(_0x9148('0x9'));var VoiceAgentReport=require(_0x9148('0xa'));var VoiceDialReport=require(_0x9148('0xb'));var UserReport=require(_0x9148('0xc'));function Report(_0x3d2409){this[_0x9148('0xd')]=_0x3d2409;this[_0x9148('0xe')]=_0x3d2409['agents'];this['telephones']=_0x3d2409['telephones'];}Report['prototype'][_0x9148('0xf')]=function(_0x1c4c4e){var _0x3c9397=new VoiceQueueReport(this[_0x9148('0xd')]);var _0x2d4a52=new VoiceAgentReport(this[_0x9148('0xd')]);var _0x8778f=new VoiceDialReport(this[_0x9148('0xd')]);var _0x1c8b7c=new VoiceCallReport(this[_0x9148('0xd')]);var _0x4edabd=new UserReport(this[_0x9148('0xd')]);if(config['xdr']&&config[_0x9148('0x10')]['disabled']){ami['on'](_0x9148('0x11'),this[_0x9148('0x12')][_0x9148('0x13')](this));ami['on'](_0x9148('0x14'),this[_0x9148('0x15')]['bind'](this));ami['on'](_0x9148('0x16'),this[_0x9148('0x17')][_0x9148('0x13')](this));ami['on'](_0x9148('0x18'),this['voiceDialReport'][_0x9148('0x13')](this));ami['on'](_0x9148('0x19'),this['blindTransfer'][_0x9148('0x13')](this));ami['on']('attendedtransfer',this[_0x9148('0x1a')][_0x9148('0x13')](this));}};Report[_0x9148('0x1b')][_0x9148('0x1c')]=function(_0x5d9b56){var _0x3f741b;_0x3f741b=_['find'](this[_0x9148('0xe')],function(_0x483a1c){return _0x483a1c[_0x9148('0x1d')]==_0x5d9b56||_0x483a1c[_0x9148('0x1e')]==_0x5d9b56;});if(_[_0x9148('0x1f')](_0x3f741b)){var _0x5dd552=_['find'](this[_0x9148('0x20')],function(_0x4b933b){return _0x4b933b[_0x9148('0x1d')]==_0x5d9b56||_0x4b933b[_0x9148('0x1e')]==_0x5d9b56;});if(_0x5dd552){_0x3f741b=_[_0x9148('0x21')](this[_0x9148('0xe')],function(_0x34943e){return _0x34943e['interface']==util['format'](_0x9148('0x22'),_0x5dd552[_0x9148('0x1e')]);});}}return _0x3f741b;};Report['prototype'][_0x9148('0x12')]=function(_0x4855be){for(var _0x5abba9=0x0;_0x5abba9<_0x4855be[_0x9148('0x23')];_0x5abba9+=0x1){var _0x432a64=this[_0x9148('0x1c')](_0x4855be[_0x5abba9][_0x9148('0x24')]);if(_0x432a64){_0x4855be[_0x5abba9]['accountcode']=_0x432a64[_0x9148('0x1d')];_0x4855be[_0x5abba9]['assigned']=!![];_0x4855be[_0x5abba9][_0x9148('0x25')]=_0x432a64['name'];_0x4855be[_0x5abba9][_0x9148('0x26')]=_[_0x9148('0x1f')](_0x432a64[_0x9148('0x26')])?util['format'](_0x9148('0x22'),_0x432a64['name']):_0x432a64[_0x9148('0x26')];if(_0x4855be[_0x5abba9][_0x9148('0x27')]){_0x4855be[_0x5abba9][_0x9148('0x28')]=moment()[_0x9148('0x29')](_0x9148('0x2a'));}if(_0x4855be[_0x5abba9][_0x9148('0x2b')]){_0x4855be[_0x5abba9][_0x9148('0x2c')]=moment()['format'](_0x9148('0x2a'));}RpcMemberReport[_0x9148('0x12')](_0x4855be[_0x5abba9]);}RpcVoiceQueueReport['create'](_0x4855be[_0x5abba9]);}};function extractCalleridNumber(_0x54b3cb){var _0x2bcde8=_0x54b3cb['match'](/<(.*?)>/);return _0x2bcde8?_0x2bcde8[0x1]:_0x54b3cb;}Report[_0x9148('0x1b')][_0x9148('0x2d')]=function(_0x23aa6d){for(var _0x1589b0=0x0;_0x1589b00x0?_0x1f9e45:0x0;this[_0xa101('0x12')][_0x3ebe99[_0xa101('0x68')]]['talking']=this[_0xa101('0x12')][_0x3ebe99['queue']][_0xa101('0x2b')]>_[_0xa101('0x6c')](_0x3ebe99[_0xa101('0x6d')])?_['toNumber'](_0x3ebe99['loggedin']):this[_0xa101('0x12')][_0x3ebe99[_0xa101('0x68')]]['talking'];this[_0xa101('0x4f')](this[_0xa101('0x12')][_0x3ebe99[_0xa101('0x68')]],_0xa101('0x15'));}logger[_0xa101('0x44')](_0xa101('0x6e'),util[_0xa101('0x3b')](this[_0xa101('0x12')][_0x3ebe99[_0xa101('0x68')]],{'showHidden':![],'depth':null}));ami[_0xa101('0x47')](_0xa101('0x6f'),this[_0xa101('0x12')][_0x3ebe99['queue']]);}}}catch(_0x1ef5b1){logger[_0xa101('0x39')](_0xa101('0x70'),util[_0xa101('0x3b')](_0x1ef5b1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa101('0x30')][_0xa101('0x71')]=function(_0x24af47){logger['debug']('[voiceQueueReport][queuesummarycomplete]\x20event:',util['inspect'](_0x24af47,{'showHidden':![],'depth':null}));this[_0xa101('0x65')]=!![];};VoiceQueueReport['prototype']['syncQueueCallerJoin']=function(_0x54ee8a){try{if(this[_0xa101('0x61')](_0x54ee8a)){logger[_0xa101('0x44')](_0xa101('0x72'),_0x54ee8a['uniqueid'],util[_0xa101('0x3b')](_0x54ee8a,{'showHidden':![],'depth':null}));if(_[_0xa101('0x62')](this[_0xa101('0xe')][_0x54ee8a[_0xa101('0x4d')]]))this[_0xa101('0xe')][_0x54ee8a['uniqueid']]=[];if(_['isUndefined'](this[_0xa101('0x10')][_0x54ee8a['uniqueid']]))this['channels'][_0x54ee8a[_0xa101('0x4d')]]={};var _0x1608fe=new QueueReport();_0x1608fe[_0xa101('0x49')]=_0x54ee8a['queue'];_0x1608fe[_0xa101('0x50')]=this['voiceQueues'][_0x1608fe[_0xa101('0x49')]]&&this[_0xa101('0x12')][_0x1608fe[_0xa101('0x49')]][_0xa101('0x50')]?this[_0xa101('0x12')][_0x1608fe['name']][_0xa101('0x50')]||_0xa101('0x51'):_0xa101('0x51');_0x1608fe[_0xa101('0x68')]=_0x54ee8a[_0xa101('0x68')];_0x1608fe[_0xa101('0x73')]=moment()[_0xa101('0x4e')](_0xa101('0x74'));_0x1608fe['position']=_0x54ee8a[_0xa101('0x75')];_0x1608fe['count']=_0x54ee8a[_0xa101('0x76')];_0x1608fe[_0xa101('0x4d')]=_0x54ee8a[_0xa101('0x4d')];_0x1608fe[_0xa101('0x77')]=this['channels'][_0x54ee8a[_0xa101('0x4d')]][_0xa101('0x77')];logger[_0xa101('0x78')](_0xa101('0x79'),_0x1608fe['name'],_0x1608fe[_0xa101('0x50')]);_[_0xa101('0x7a')](_0x1608fe,_[_0xa101('0x7b')](_0x54ee8a,_[_0xa101('0x7c')](_0x1608fe)));this[_0xa101('0xe')][_0x54ee8a[_0xa101('0x4d')]]['push'](_0x1608fe);this['channels'][_0x54ee8a['uniqueid']]=_0x1608fe;this[_0xa101('0x43')](_0x1608fe,_0xa101('0x19'));}}catch(_0x5a5bec){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x54ee8a['uniqueid'],util[_0xa101('0x3b')](_0x5a5bec,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa101('0x30')][_0xa101('0x1b')]=function(_0x397666){try{if(this['isNotNull'](_0x397666)){logger[_0xa101('0x44')](_0xa101('0x7d'),_0x397666['uniqueid'],util['inspect'](_0x397666,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x397666[_0xa101('0x4d')]]){var _0x4a295e=_['last'](this['queueReports'][_0x397666['uniqueid']]);_0x4a295e[_0xa101('0x7e')]=![];_0x4a295e[_0xa101('0x7f')]=null;_0x4a295e[_0xa101('0x80')]=_0x397666[_0xa101('0x80')];_0x4a295e[_0xa101('0x81')]=_0x397666[_0xa101('0x81')];_0x4a295e[_0xa101('0x82')]=!![];_0x4a295e[_0xa101('0x83')]=moment()[_0xa101('0x4e')](_0xa101('0x74'));_0x4a295e[_0xa101('0x84')]='ABANDONED';_0x4a295e[_0xa101('0x85')]=null;logger[_0xa101('0x78')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x4a295e['name'],_0x4a295e['type']);this['channels'][_0x397666[_0xa101('0x4d')]]=_0x4a295e;this[_0xa101('0x41')](_0x4a295e,_0xa101('0x82'));}}}catch(_0x339560){logger[_0xa101('0x39')]('[%s][voiceQueueReport][queuecallerabandon]',_0x397666[_0xa101('0x4d')],util[_0xa101('0x3b')](_0x339560,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa101('0x30')]['syncQueueCallerLeave']=function(_0x307594){try{if(this['isNotNull'](_0x307594)){logger[_0xa101('0x44')](_0xa101('0x86'),_0x307594['uniqueid'],util[_0xa101('0x3b')](_0x307594,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x307594[_0xa101('0x4d')]]){var _0x2af69e=_['last'](this[_0xa101('0xe')][_0x307594[_0xa101('0x4d')]]);_0x2af69e['queuecallerleaveAt']=moment()[_0xa101('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x2af69e[_0xa101('0x87')]=_0x307594[_0xa101('0x87')];_0x2af69e[_0xa101('0x88')]=_0x307594[_0xa101('0x88')];logger['info'](_0xa101('0x89'),_0x2af69e[_0xa101('0x49')],_0x2af69e[_0xa101('0x50')],_0x307594[_0xa101('0x87')],_0x307594['connectedlinename']);this['channels'][_0x307594[_0xa101('0x4d')]]=_0x2af69e;this[_0xa101('0x43')](_0x2af69e,_0xa101('0x1c'));}}}catch(_0x38a4e3){logger[_0xa101('0x39')]('[%s][voiceQueueReport][queuecallerleave]',_0x307594[_0xa101('0x4d')],util[_0xa101('0x3b')](_0x38a4e3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa101('0x30')][_0xa101('0x1f')]=function(_0x26379a){try{if(this['isNotNull'](_0x26379a)){logger['debug'](_0xa101('0x8a'),_0x26379a[_0xa101('0x4d')],util[_0xa101('0x3b')](_0x26379a,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x26379a[_0xa101('0x4d')]]){var _0x23b23f=_[_0xa101('0x8b')](this[_0xa101('0xe')][_0x26379a[_0xa101('0x4d')]]);_0x23b23f['queuecallercomplete']=!![];_0x23b23f[_0xa101('0x84')]='COMPLETEDBYAGENT';logger[_0xa101('0x78')](_0xa101('0x8c'),_0x23b23f[_0xa101('0x49')],_0x23b23f[_0xa101('0x50')]);}}}catch(_0x22796b){logger['error']('[%s][voiceQueueReport][agentconnect]',_0x26379a[_0xa101('0x4d')],util[_0xa101('0x3b')](_0x22796b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa101('0x30')][_0xa101('0x8d')]=function(_0x4ea052){try{if(this[_0xa101('0x61')](_0x4ea052)){logger['debug']('[%s][voiceQueueReport][agentcomplete]',_0x4ea052[_0xa101('0x4d')],util['inspect'](_0x4ea052,{'showHidden':![],'depth':null}));if(this[_0xa101('0xe')][_0x4ea052[_0xa101('0x4d')]]){var _0x54181f=_[_0xa101('0x8b')](this['queueReports'][_0x4ea052[_0xa101('0x4d')]]);_0x54181f[_0xa101('0x82')]=![];_0x54181f[_0xa101('0x83')]=null;_0x54181f[_0xa101('0x8e')]=!![];_0x54181f[_0xa101('0x85')]=_0x4ea052[_0xa101('0x8f')];_0x54181f[_0xa101('0x80')]=_0x4ea052[_0xa101('0x80')];_0x54181f[_0xa101('0x7e')]=!![];_0x54181f[_0xa101('0x90')]=![];_0x54181f[_0xa101('0x91')]=null;if(!_0x54181f[_0xa101('0x92')]){if(_0x4ea052[_0xa101('0x93')]==_0xa101('0x92')){_0x54181f[_0xa101('0x84')]=_0xa101('0x94');logger[_0xa101('0x78')](_0xa101('0x95'),_0x54181f[_0xa101('0x49')],_0x54181f[_0xa101('0x50')]);}else{if(_[_0xa101('0x96')](_0x4ea052['channel'][_0xa101('0x97')](),_0xa101('0x98'))){if(this[_0xa101('0xe')][_0x4ea052[_0xa101('0x99')]]){var _0x51385c=_[_0xa101('0x8b')](this[_0xa101('0xe')][_0x4ea052[_0xa101('0x99')]]);_0x51385c[_0xa101('0x7e')]=![];_0x51385c['queuecallerexit']=!![];_0x51385c[_0xa101('0x91')]=moment(_0x54181f[_0xa101('0x73')])[_0xa101('0x9a')](_0x4ea052['holdtime'],_0xa101('0x9b'))[_0xa101('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x51385c[_0xa101('0x84')]=_0xa101('0x9c');_0x51385c['transfer']=!![];_0x51385c[_0xa101('0x9d')]=_0xa101('0x9e');_0x51385c[_0xa101('0x9f')]=_0x4ea052['destexten'];_0x51385c[_0xa101('0xa0')]=_0x4ea052[_0xa101('0x4d')];logger[_0xa101('0x78')](_0xa101('0xa1'),_0x51385c[_0xa101('0x49')],_0x51385c[_0xa101('0x50')]);var _0x9e64e6=this[_0xa101('0xe')][_0x4ea052[_0xa101('0x99')]];this['queueReports'][_0x4ea052[_0xa101('0x99')]]=this[_0xa101('0xe')][_0x4ea052['uniqueid']];this[_0xa101('0xe')][_0x4ea052[_0xa101('0x4d')]]=_0x9e64e6;}}else{_0x54181f[_0xa101('0x84')]=_0xa101('0xa2')+_0x4ea052[_0xa101('0x93')][_0xa101('0xa3')]();logger[_0xa101('0x78')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x54181f[_0xa101('0x49')],_0x54181f['type'],_0x54181f['queuecallerexitreason']);}}}this[_0xa101('0x10')][_0x4ea052['uniqueid']]=_0x54181f;this[_0xa101('0x41')](_0x54181f,_0xa101('0xa4'));}}}catch(_0x40a38c){logger['error'](_0xa101('0xa5'),_0x4ea052['uniqueid'],util['inspect'](_0x40a38c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa101('0x30')][_0xa101('0x21')]=function(_0x2b6f02){try{if(this['isNotNull'](_0x2b6f02)){logger[_0xa101('0x44')](_0xa101('0xa6'),_0x2b6f02[_0xa101('0x4d')],util['inspect'](_0x2b6f02,{'showHidden':![],'depth':null}));this['addVariable'](_0x2b6f02[_0xa101('0x4d')],_['keys'](_0x2b6f02[_0xa101('0xa7')])[0x0],_0x2b6f02[_0xa101('0xa8')]);if(this['queueReports'][_0x2b6f02[_0xa101('0x4d')]]){var _0x20b251=_['last'](this[_0xa101('0xe')][_0x2b6f02[_0xa101('0x4d')]]);if(_0x20b251){if(this[_0xa101('0x61')](_0x2b6f02[_0xa101('0xa7')])&&this[_0xa101('0x61')](_0x2b6f02['variable'][_0xa101('0xa9')])){switch(_0x2b6f02[_0xa101('0xa8')]){case _0xa101('0xaa'):_0x20b251['queuecallerexit']=![];_0x20b251[_0xa101('0x91')]=null;break;case _0xa101('0xab'):_0x20b251[_0xa101('0xac')]=_0xa101('0xad');_0x20b251[_0xa101('0x90')]=!![];_0x20b251[_0xa101('0x91')]=moment()[_0xa101('0x4e')](_0xa101('0x74'));_0x20b251['queuecallerleaveAt']=moment()[_0xa101('0x4e')](_0xa101('0x74'));logger[_0xa101('0x44')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x2b6f02[_0xa101('0x4d')],util[_0xa101('0x3b')](_0x20b251,{'showHidden':![],'depth':null}));ami[_0xa101('0x47')](_0xa101('0xae'),_0x20b251);break;default:_0x20b251[_0xa101('0x90')]=!![];_0x20b251[_0xa101('0x91')]=moment()['format'](_0xa101('0x74'));_0x20b251[_0xa101('0xaf')]=moment()[_0xa101('0x4e')](_0xa101('0x74'));}_0x20b251[_0xa101('0x82')]=![];_0x20b251[_0xa101('0x83')]=null;_0x20b251[_0xa101('0x84')]=_0x2b6f02[_0xa101('0xa8')];this['channels'][_0x2b6f02[_0xa101('0x4d')]]=_0x20b251;this[_0xa101('0x41')](_0x20b251,'varset');}else if(this[_0xa101('0x61')](_0x2b6f02[_0xa101('0xa7')])&&this[_0xa101('0x61')](_0x2b6f02[_0xa101('0xa7')][_0xa101('0xb0')])){if(!_0x20b251[_0xa101('0x82')]){_0x20b251['queuecallerexit']=!![];_0x20b251[_0xa101('0x91')]=moment()['format'](_0xa101('0x74'));_0x20b251[_0xa101('0x84')]=_0xa101('0xb1');_0x20b251[_0xa101('0xaf')]=moment()[_0xa101('0x4e')](_0xa101('0x74'));this['channels'][_0x2b6f02[_0xa101('0x4d')]]=_0x20b251;}}logger['info'](_0xa101('0xb2'),_0x2b6f02['uniqueid'],_0x20b251[_0xa101('0x49')],_0x20b251[_0xa101('0x50')],_[_0xa101('0x7c')](_0x2b6f02['variable'])[0x0],_0x2b6f02[_0xa101('0xa8')]);_0x20b251['variables']=this['variables'][_0x2b6f02[_0xa101('0x4d')]];}}}}catch(_0x2c2f9c){logger['error'](_0xa101('0xa6'),_0x2b6f02[_0xa101('0x4d')],util[_0xa101('0x3b')](_0x2c2f9c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa101('0x30')][_0xa101('0xb3')]=function(_0x4987d0,_0x4afc65,_0x2234cb){var _0xff80cc=[_0xa101('0xb4'),_0xa101('0xb5'),_0xa101('0xb6'),_0xa101('0xb7'),_0xa101('0xb8'),_0xa101('0xb9'),_0xa101('0xba'),'rtpaudioqosrttbridged',_0xa101('0xbb'),_0xa101('0xbc'),_0xa101('0xbd'),_0xa101('0xbe'),'membercalls',_0xa101('0xbf'),_0xa101('0xc0'),_0xa101('0xc1'),_0xa101('0x8f'),_0xa101('0xc2'),_0xa101('0xc3')];if(!_[_0xa101('0x32')](_0x4afc65)&&!_[_0xa101('0xc4')](_0xff80cc,_0x4afc65)){if(_[_0xa101('0x62')](this[_0xa101('0x14')][_0x4987d0])){this[_0xa101('0x14')][_0x4987d0]={};}this[_0xa101('0x14')][_0x4987d0][_0x4afc65]=_0x2234cb;}};VoiceQueueReport[_0xa101('0x30')][_0xa101('0x23')]=function(_0x2b47ae){try{if(this['isNotNull'](_0x2b47ae)){logger[_0xa101('0x44')](_0xa101('0xc5'),_0x2b47ae[_0xa101('0x4d')],util['inspect'](_0x2b47ae,{'showHidden':![],'depth':null}));if(this[_0xa101('0xe')][_0x2b47ae['uniqueid']]){for(var _0x3bfe50=0x0,_0x1947a2={};_0x3bfe500x0?_0x2e4bd0:0x0;this[_0x8132('0x3a')][_0x10589e[_0x8132('0x5c')]][_0x8132('0x2a')]=this[_0x8132('0x3a')][_0x10589e['queue']][_0x8132('0x2a')]>_[_0x8132('0x60')](_0x10589e[_0x8132('0x62')])?_[_0x8132('0x60')](_0x10589e['loggedin']):this[_0x8132('0x3a')][_0x10589e[_0x8132('0x5c')]][_0x8132('0x2a')];this[_0x8132('0x49')](this[_0x8132('0x3a')][_0x10589e[_0x8132('0x5c')]],'queuesummary');}logger[_0x8132('0x3d')](_0x8132('0x63'),util[_0x8132('0x35')](this['voiceQueues'][_0x10589e[_0x8132('0x5c')]],{'showHidden':![],'depth':null}));ami[_0x8132('0x3c')](_0x8132('0x64'),this[_0x8132('0x3a')][_0x10589e[_0x8132('0x5c')]]);}}}catch(_0x148e9b){logger[_0x8132('0x33')](_0x8132('0x65'),util['inspect'](_0x148e9b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8132('0x37')][_0x8132('0x66')]=function(_0x1a17b8){logger[_0x8132('0x3d')](_0x8132('0x67'),util[_0x8132('0x35')](_0x1a17b8,{'showHidden':![],'depth':null}));this[_0x8132('0xf')]=!![];};VoiceQueueReport[_0x8132('0x37')]['syncQueueCallerJoin']=function(_0x4a6fe6){try{if(this['isNotNull'](_0x4a6fe6)){logger[_0x8132('0x3d')](_0x8132('0x68'),_0x4a6fe6['uniqueid'],util[_0x8132('0x35')](_0x4a6fe6,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x8132('0xc')][_0x4a6fe6[_0x8132('0x40')]]))this['queueReports'][_0x4a6fe6[_0x8132('0x40')]]=[];if(_[_0x8132('0x57')](this[_0x8132('0xe')][_0x4a6fe6[_0x8132('0x40')]]))this[_0x8132('0xe')][_0x4a6fe6[_0x8132('0x40')]]={};var _0x3f1344=new QueueReport();_0x3f1344[_0x8132('0x42')]=_0x4a6fe6[_0x8132('0x5c')];_0x3f1344[_0x8132('0x4a')]=this[_0x8132('0x3a')][_0x3f1344[_0x8132('0x42')]]&&this[_0x8132('0x3a')][_0x3f1344['name']][_0x8132('0x4a')]?this['voiceQueues'][_0x3f1344[_0x8132('0x42')]][_0x8132('0x4a')]||_0x8132('0x69'):_0x8132('0x69');_0x3f1344[_0x8132('0x5c')]=_0x4a6fe6['queue'];_0x3f1344[_0x8132('0x6a')]=moment()[_0x8132('0x46')](_0x8132('0x6b'));_0x3f1344[_0x8132('0x6c')]=_0x4a6fe6[_0x8132('0x6c')];_0x3f1344[_0x8132('0x6d')]=_0x4a6fe6[_0x8132('0x6d')];_0x3f1344[_0x8132('0x40')]=_0x4a6fe6[_0x8132('0x40')];_0x3f1344[_0x8132('0x6e')]=this[_0x8132('0xe')][_0x4a6fe6['uniqueid']]['routealias'];logger[_0x8132('0x5d')](_0x8132('0x6f'),_0x3f1344[_0x8132('0x42')],_0x3f1344['type']);_['merge'](_0x3f1344,_['pick'](_0x4a6fe6,_[_0x8132('0x70')](_0x3f1344)));this['queueReports'][_0x4a6fe6[_0x8132('0x40')]][_0x8132('0x71')](_0x3f1344);this[_0x8132('0xe')][_0x4a6fe6['uniqueid']]=_0x3f1344;this['emitVoiceQueueChannelSave'](_0x3f1344,_0x8132('0x72'));}}catch(_0x17629f){logger[_0x8132('0x33')](_0x8132('0x68'),_0x4a6fe6[_0x8132('0x40')],util['inspect'](_0x17629f,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x8132('0x16')]=function(_0x42a1eb){try{if(this[_0x8132('0x56')](_0x42a1eb)){logger[_0x8132('0x3d')]('[%s][voiceQueueReport][queuecallerabandon]',_0x42a1eb[_0x8132('0x40')],util['inspect'](_0x42a1eb,{'showHidden':![],'depth':null}));if(this[_0x8132('0xc')][_0x42a1eb[_0x8132('0x40')]]){var _0x23aa28=_[_0x8132('0x73')](this[_0x8132('0xc')][_0x42a1eb[_0x8132('0x40')]]);_0x23aa28[_0x8132('0x74')]=![];_0x23aa28[_0x8132('0x75')]=null;_0x23aa28[_0x8132('0x76')]=_0x42a1eb[_0x8132('0x76')];_0x23aa28[_0x8132('0x77')]=_0x42a1eb[_0x8132('0x77')];_0x23aa28[_0x8132('0x15')]=!![];_0x23aa28['queuecallerabandonAt']=moment()['format'](_0x8132('0x6b'));_0x23aa28['queuecallerexitreason']=_0x8132('0x78');_0x23aa28['lastAssignedTo']=null;logger[_0x8132('0x5d')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x23aa28[_0x8132('0x42')],_0x23aa28[_0x8132('0x4a')]);this[_0x8132('0xe')][_0x42a1eb[_0x8132('0x40')]]=_0x23aa28;this['emitVoiceQueueChannelRemove'](_0x23aa28,_0x8132('0x15'));}}}catch(_0xdd6057){logger['error']('[%s][voiceQueueReport][queuecallerabandon]',_0x42a1eb['uniqueid'],util[_0x8132('0x35')](_0xdd6057,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8132('0x37')][_0x8132('0x18')]=function(_0x1d9f47){try{if(this[_0x8132('0x56')](_0x1d9f47)){logger[_0x8132('0x3d')](_0x8132('0x79'),_0x1d9f47[_0x8132('0x40')],util[_0x8132('0x35')](_0x1d9f47,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1d9f47[_0x8132('0x40')]]){var _0x50302d=_[_0x8132('0x73')](this[_0x8132('0xc')][_0x1d9f47['uniqueid']]);_0x50302d['queuecallerleaveAt']=moment()[_0x8132('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x50302d['connectedlinenum']=_0x1d9f47[_0x8132('0x7a')];_0x50302d[_0x8132('0x7b')]=_0x1d9f47[_0x8132('0x7b')];logger[_0x8132('0x5d')](_0x8132('0x7c'),_0x50302d[_0x8132('0x42')],_0x50302d[_0x8132('0x4a')],_0x1d9f47['connectedlinenum'],_0x1d9f47[_0x8132('0x7b')]);this[_0x8132('0xe')][_0x1d9f47[_0x8132('0x40')]]=_0x50302d;this[_0x8132('0x7d')](_0x50302d,_0x8132('0x17'));}}}catch(_0x583c91){logger[_0x8132('0x33')](_0x8132('0x79'),_0x1d9f47[_0x8132('0x40')],util[_0x8132('0x35')](_0x583c91,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8132('0x37')][_0x8132('0x1b')]=function(_0x163c09){try{if(this[_0x8132('0x56')](_0x163c09)){logger[_0x8132('0x3d')](_0x8132('0x7e'),_0x163c09[_0x8132('0x40')],util[_0x8132('0x35')](_0x163c09,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x163c09[_0x8132('0x40')]]){var _0xfd4f27=_[_0x8132('0x73')](this[_0x8132('0xc')][_0x163c09['uniqueid']]);_0xfd4f27[_0x8132('0x74')]=!![];_0xfd4f27[_0x8132('0x7f')]=_0x8132('0x80');logger[_0x8132('0x5d')](_0x8132('0x81'),_0xfd4f27[_0x8132('0x42')],_0xfd4f27[_0x8132('0x4a')]);}}}catch(_0x4514c0){logger[_0x8132('0x33')]('[%s][voiceQueueReport][agentconnect]',_0x163c09[_0x8132('0x40')],util[_0x8132('0x35')](_0x4514c0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8132('0x37')][_0x8132('0x82')]=function(_0x12abfc){try{if(this['isNotNull'](_0x12abfc)){logger[_0x8132('0x3d')](_0x8132('0x83'),_0x12abfc[_0x8132('0x40')],util[_0x8132('0x35')](_0x12abfc,{'showHidden':![],'depth':null}));if(this[_0x8132('0xc')][_0x12abfc[_0x8132('0x40')]]){var _0x4fa740=_[_0x8132('0x73')](this['queueReports'][_0x12abfc[_0x8132('0x40')]]);_0x4fa740[_0x8132('0x15')]=![];_0x4fa740[_0x8132('0x84')]=null;_0x4fa740[_0x8132('0x85')]=!![];_0x4fa740[_0x8132('0x86')]=_0x12abfc[_0x8132('0x87')];_0x4fa740[_0x8132('0x76')]=_0x12abfc[_0x8132('0x76')];_0x4fa740['queuecallercomplete']=!![];_0x4fa740[_0x8132('0x88')]=![];_0x4fa740['queuecallerexitAt']=null;if(!_0x4fa740[_0x8132('0x89')]){if(_0x12abfc[_0x8132('0x8a')]==_0x8132('0x89')){_0x4fa740[_0x8132('0x7f')]='COMPLETED';logger[_0x8132('0x5d')](_0x8132('0x8b'),_0x4fa740[_0x8132('0x42')],_0x4fa740[_0x8132('0x4a')]);}else{if(_[_0x8132('0x8c')](_0x12abfc[_0x8132('0x8d')][_0x8132('0x8e')](),_0x8132('0x8f'))){if(this[_0x8132('0xc')][_0x12abfc['linkedid']]){var _0x5ee2fa=_[_0x8132('0x73')](this[_0x8132('0xc')][_0x12abfc['linkedid']]);_0x5ee2fa['queuecallercomplete']=![];_0x5ee2fa[_0x8132('0x88')]=!![];_0x5ee2fa['queuecallerexitAt']=moment(_0x4fa740['queuecallerjoinAt'])[_0x8132('0x90')](_0x12abfc[_0x8132('0x76')],_0x8132('0x91'))[_0x8132('0x46')](_0x8132('0x6b'));_0x5ee2fa[_0x8132('0x7f')]='FORWARDTRANSFER';_0x5ee2fa[_0x8132('0x89')]=!![];_0x5ee2fa[_0x8132('0x92')]=_0x8132('0x93');_0x5ee2fa[_0x8132('0x94')]=_0x12abfc['destexten'];_0x5ee2fa[_0x8132('0x95')]=_0x12abfc[_0x8132('0x40')];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x5ee2fa['name'],_0x5ee2fa[_0x8132('0x4a')]);var _0x11e568=this[_0x8132('0xc')][_0x12abfc[_0x8132('0x96')]];this[_0x8132('0xc')][_0x12abfc[_0x8132('0x96')]]=this[_0x8132('0xc')][_0x12abfc[_0x8132('0x40')]];this[_0x8132('0xc')][_0x12abfc[_0x8132('0x40')]]=_0x11e568;}}else{_0x4fa740[_0x8132('0x7f')]='COMPLETEDBY'+_0x12abfc[_0x8132('0x8a')]['toUpperCase']();logger[_0x8132('0x5d')](_0x8132('0x97'),_0x4fa740[_0x8132('0x42')],_0x4fa740[_0x8132('0x4a')],_0x4fa740[_0x8132('0x7f')]);}}}this['channels'][_0x12abfc[_0x8132('0x40')]]=_0x4fa740;this[_0x8132('0x3b')](_0x4fa740,_0x8132('0x19'));}}}catch(_0x38b804){logger['error'](_0x8132('0x83'),_0x12abfc[_0x8132('0x40')],util[_0x8132('0x35')](_0x38b804,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8132('0x37')]['syncVarSet']=function(_0x8f43d9){try{if(this['isNotNull'](_0x8f43d9)){logger[_0x8132('0x3d')]('[%s][voiceQueueReport][varset]',_0x8f43d9[_0x8132('0x40')],util[_0x8132('0x35')](_0x8f43d9,{'showHidden':![],'depth':null}));this[_0x8132('0x98')](_0x8f43d9['uniqueid'],_[_0x8132('0x70')](_0x8f43d9[_0x8132('0x99')])[0x0],_0x8f43d9[_0x8132('0x9a')]);if(this['queueReports'][_0x8f43d9[_0x8132('0x40')]]){var _0x5eb97d=_[_0x8132('0x73')](this[_0x8132('0xc')][_0x8f43d9['uniqueid']]);if(_0x5eb97d){if(this[_0x8132('0x56')](_0x8f43d9['variable'])&&this[_0x8132('0x56')](_0x8f43d9[_0x8132('0x99')][_0x8132('0x9b')])){switch(_0x8f43d9[_0x8132('0x9a')]){case _0x8132('0x9c'):_0x5eb97d[_0x8132('0x88')]=![];_0x5eb97d[_0x8132('0x9d')]=null;break;case _0x8132('0x9e'):_0x5eb97d[_0x8132('0x9f')]='timeout';_0x5eb97d['queuecallerexit']=!![];_0x5eb97d[_0x8132('0x9d')]=moment()[_0x8132('0x46')](_0x8132('0x6b'));_0x5eb97d[_0x8132('0xa0')]=moment()[_0x8132('0x46')](_0x8132('0x6b'));logger['debug']('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x8f43d9[_0x8132('0x40')],util[_0x8132('0x35')](_0x5eb97d,{'showHidden':![],'depth':null}));ami[_0x8132('0x3c')]('custom:timeout',_0x5eb97d);break;default:_0x5eb97d[_0x8132('0x88')]=!![];_0x5eb97d['queuecallerexitAt']=moment()[_0x8132('0x46')](_0x8132('0x6b'));_0x5eb97d[_0x8132('0xa0')]=moment()[_0x8132('0x46')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5eb97d['queuecallerabandon']=![];_0x5eb97d['queuecallerabandonAt']=null;_0x5eb97d[_0x8132('0x7f')]=_0x8f43d9['value'];this[_0x8132('0xe')][_0x8f43d9[_0x8132('0x40')]]=_0x5eb97d;this[_0x8132('0x3b')](_0x5eb97d,'varset');}else if(this[_0x8132('0x56')](_0x8f43d9['variable'])&&this[_0x8132('0x56')](_0x8f43d9[_0x8132('0x99')]['queueposition'])){if(!_0x5eb97d[_0x8132('0x15')]){_0x5eb97d[_0x8132('0x88')]=!![];_0x5eb97d['queuecallerexitAt']=moment()[_0x8132('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x5eb97d['queuecallerexitreason']=_0x8132('0xa1');_0x5eb97d['queuecallerleaveAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x8132('0xe')][_0x8f43d9[_0x8132('0x40')]]=_0x5eb97d;}}logger[_0x8132('0x5d')](_0x8132('0xa2'),_0x8f43d9[_0x8132('0x40')],_0x5eb97d[_0x8132('0x42')],_0x5eb97d[_0x8132('0x4a')],_['keys'](_0x8f43d9[_0x8132('0x99')])[0x0],_0x8f43d9[_0x8132('0x9a')]);_0x5eb97d[_0x8132('0x11')]=this[_0x8132('0x11')][_0x8f43d9['uniqueid']];}}}}catch(_0x330b4b){logger[_0x8132('0x33')]('[%s][voiceQueueReport][varset]',_0x8f43d9[_0x8132('0x40')],util['inspect'](_0x330b4b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x8132('0x98')]=function(_0x107a67,_0xf26437,_0x33b0db){var _0x260ebb=[_0x8132('0xa3'),_0x8132('0xa4'),_0x8132('0xa5'),_0x8132('0xa6'),_0x8132('0xa7'),_0x8132('0xa8'),'rtpaudioqosrtt',_0x8132('0xa9'),_0x8132('0xaa'),_0x8132('0xab'),_0x8132('0xac'),_0x8132('0xad'),_0x8132('0xae'),_0x8132('0xaf'),_0x8132('0xb0'),_0x8132('0xb1'),_0x8132('0x87'),'memberpenalty',_0x8132('0xb2')];if(!_[_0x8132('0x30')](_0xf26437)&&!_[_0x8132('0xb3')](_0x260ebb,_0xf26437)){if(_['isUndefined'](this[_0x8132('0x11')][_0x107a67])){this['variables'][_0x107a67]={};}this[_0x8132('0x11')][_0x107a67][_0xf26437]=_0x33b0db;}};VoiceQueueReport[_0x8132('0x37')][_0x8132('0x1e')]=function(_0x3de577){try{if(this['isNotNull'](_0x3de577)){logger[_0x8132('0x3d')]('[%s][voiceQueueReport][hangup]',_0x3de577[_0x8132('0x40')],util['inspect'](_0x3de577,{'showHidden':![],'depth':null}));if(this[_0x8132('0xc')][_0x3de577[_0x8132('0x40')]]){for(var _0x1873ca=0x0,_0x3edbb4={};_0x1873ca=0x0?moment(_0x10d572[_0x2f01('0x1a')])['diff'](_0x10d572[_0x2f01('0x19')],_0x2f01('0xe')):null,'data1':'outbound','data2':_0x10d572['accountcode'],'data3':_0x10d572[_0x2f01('0x11')],'data4':_0x10d572[_0x2f01('0x1b')]||null,'role':'agent','internal':_0x10d572[_0x2f01('0x14')]?_[_0x2f01('0x1c')](_0x10d572[_0x2f01('0x14')]):undefined,'uniqueid':_0x10d572[_0x2f01('0x15')]},'log':_0x2f01('0x6')});}; \ No newline at end of file +var _0x7242=['TALKING','diff','queuecallerleaveAt','seconds','inbound','calleridnum','exten','queue','accountcode','toNumber','uniqueid','voiceDialReport','voice','membername','endtime','starttime','outbound','dialstring','moment','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','lastAssignedTo','isNil','interface','format','SIP/%s'];(function(_0x51c7f6,_0xfc0902){var _0x3da310=function(_0x2dac07){while(--_0x2dac07){_0x51c7f6['push'](_0x51c7f6['shift']());}};_0x3da310(++_0xfc0902);}(_0x7242,0xd2));var _0x2724=function(_0xfc0a38,_0x5749af){_0xfc0a38=_0xfc0a38-0x0;var _0x21038b=_0x7242[_0xfc0a38];return _0x21038b;};'use strict';var moment=require(_0x2724('0x0'));var _=require(_0x2724('0x1'));var util=require(_0x2724('0x2'));var client=require(_0x2724('0x3'));exports[_0x2724('0x4')]=function(_0x2241f8){var _0x1bba59=_0x2241f8[_0x2724('0x5')]||_0x2241f8[_0x2724('0x6')];return client[_0x2724('0x7')](_0x2724('0x8'),{'body':{'channel':'voice','membername':_0x2241f8[_0x2724('0x9')],'interface':_[_0x2724('0xa')](_0x2241f8[_0x2724('0xb')])?util[_0x2724('0xc')](_0x2724('0xd'),_0x2241f8[_0x2724('0x9')]):_0x2241f8[_0x2724('0xb')],'type':_0x2724('0xe'),'enterAt':_0x2241f8['queuecallerleaveAt'],'exitAt':_0x1bba59,'duration':moment(_0x1bba59)[_0x2724('0xf')](_0x2241f8[_0x2724('0x10')],_0x2724('0x11')),'data1':_0x2724('0x12'),'data2':_0x2241f8[_0x2724('0x13')],'data3':_0x2241f8[_0x2724('0x14')],'data4':null,'data5':_0x2241f8[_0x2724('0x15')],'role':'agent','internal':_0x2241f8[_0x2724('0x16')]?_[_0x2724('0x17')](_0x2241f8['accountcode']):undefined,'uniqueid':_0x2241f8[_0x2724('0x18')]},'log':_0x2724('0x8')});};exports[_0x2724('0x19')]=function(_0x2d186e){return client[_0x2724('0x7')](_0x2724('0x8'),{'body':{'channel':_0x2724('0x1a'),'membername':_0x2d186e[_0x2724('0x1b')],'interface':_0x2d186e['interface'],'type':_0x2724('0xe'),'enterAt':_0x2d186e['starttime'],'exitAt':_0x2d186e['endtime'],'duration':moment(_0x2d186e[_0x2724('0x1c')])[_0x2724('0xf')](_0x2d186e[_0x2724('0x1d')],_0x2724('0x11'))>=0x0?moment(_0x2d186e['endtime'])['diff'](_0x2d186e['starttime'],'seconds'):null,'data1':_0x2724('0x1e'),'data2':_0x2d186e[_0x2724('0x16')],'data3':_0x2d186e[_0x2724('0x14')],'data4':_0x2d186e[_0x2724('0x1f')]||null,'role':'agent','internal':_0x2d186e[_0x2724('0x16')]?_[_0x2724('0x17')](_0x2d186e[_0x2724('0x16')]):undefined,'uniqueid':_0x2d186e['uniqueid']},'log':_0x2724('0x8')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index e05e488..4af2a08 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 _0x1458=['../client','getSettings','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings'];(function(_0x53d5c7,_0x4212b3){var _0x40cc26=function(_0x2b519a){while(--_0x2b519a){_0x53d5c7['push'](_0x53d5c7['shift']());}};_0x40cc26(++_0x4212b3);}(_0x1458,0x16c));var _0x8145=function(_0x5690c4,_0x4c8668){_0x5690c4=_0x5690c4-0x0;var _0x4b6b88=_0x1458[_0x5690c4];return _0x4b6b88;};'use strict';var client=require(_0x8145('0x0'));exports[_0x8145('0x1')]=function(){return client[_0x8145('0x2')](_0x8145('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x8145('0x4'),_0x8145('0x5')]},'log':_0x8145('0x6')});}; \ No newline at end of file +var _0xb79a=['previewRecallmeReminderInterval','GetSettings','../client','getSettings','ShowSetting','stopRecordingOnTransfer'];(function(_0x2371be,_0x8a70ae){var _0x1b8880=function(_0x5de5a1){while(--_0x5de5a1){_0x2371be['push'](_0x2371be['shift']());}};_0x1b8880(++_0x8a70ae);}(_0xb79a,0x18e));var _0xab79=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb79a[_0x2641f9];return _0x585741;};'use strict';var client=require(_0xab79('0x0'));exports[_0xab79('0x1')]=function(){return client['Request'](_0xab79('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xab79('0x3'),_0xab79('0x4')]},'log':_0xab79('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 360e6dd..891682a 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 _0xf79b=['getTemplates','Request','GetTemplate','name'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf79b,0xa0));var _0xbf79=function(_0x329fd3,_0x5721dd){_0x329fd3=_0x329fd3-0x0;var _0x5096ec=_0xf79b[_0x329fd3];return _0x5096ec;};'use strict';var client=require('../client');exports[_0xbf79('0x0')]=function(_0x15d780){return function(_0x5389ed){return client[_0xbf79('0x1')](_0xbf79('0x2'),{'options':{'raw':!![],'attributes':['id',_0xbf79('0x3'),'html']},'log':_0xbf79('0x2')});};}; \ No newline at end of file +var _0xd2ed=['GetTemplate','name','html','../client','getTemplates','Request'];(function(_0x34048b,_0x28c970){var _0x230513=function(_0x2f33b5){while(--_0x2f33b5){_0x34048b['push'](_0x34048b['shift']());}};_0x230513(++_0x28c970);}(_0xd2ed,0x14d));var _0xdd2e=function(_0x381927,_0x684dab){_0x381927=_0x381927-0x0;var _0x5f2835=_0xd2ed[_0x381927];return _0x5f2835;};'use strict';var client=require(_0xdd2e('0x0'));exports[_0xdd2e('0x1')]=function(_0x2cd406){return function(_0x261da6){return client[_0xdd2e('0x2')](_0xdd2e('0x3'),{'options':{'raw':!![],'attributes':['id',_0xdd2e('0x4'),_0xdd2e('0x5')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index efa3a1c..64df03c 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 _0x503f=['../client','Request','name','channel','status','Condition','field','value','AnyConditions','operator','Action','Actions','action','data2','data3','data4','data5','data6','data7','GetTrigger'];(function(_0x5d8bc1,_0x561111){var _0x447ae2=function(_0x40dff9){while(--_0x40dff9){_0x5d8bc1['push'](_0x5d8bc1['shift']());}};_0x447ae2(++_0x561111);}(_0x503f,0x1e0));var _0xf503=function(_0x14c360,_0xeea136){_0x14c360=_0x14c360-0x0;var _0x49e3d7=_0x503f[_0x14c360];return _0x49e3d7;};'use strict';var client=require(_0xf503('0x0'));exports['getTriggers']=function(_0xc170c5){return function(_0x2b08c7){return client[_0xf503('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xf503('0x2'),_0xf503('0x3'),_0xf503('0x4')],'include':[{'model':_0xf503('0x5'),'as':'AllConditions','attributes':['id',_0xf503('0x6'),'operator',_0xf503('0x7')]},{'model':'Condition','as':_0xf503('0x8'),'attributes':['id',_0xf503('0x6'),_0xf503('0x9'),_0xf503('0x7')]},{'model':_0xf503('0xa'),'as':_0xf503('0xb'),'attributes':['id',_0xf503('0xc'),'data1',_0xf503('0xd'),_0xf503('0xe'),_0xf503('0xf'),_0xf503('0x10'),_0xf503('0x11'),_0xf503('0x12')]}]},'log':_0xf503('0x13')});};}; \ No newline at end of file +var _0x1014=['data5','data6','data7','getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions','field','value','AnyConditions','operator','Action','Actions','data3','data4'];(function(_0x4a3632,_0x55e899){var _0x40ed2a=function(_0x1d3e5f){while(--_0x1d3e5f){_0x4a3632['push'](_0x4a3632['shift']());}};_0x40ed2a(++_0x55e899);}(_0x1014,0x1cb));var _0x4101=function(_0x5cd036,_0x46ba26){_0x5cd036=_0x5cd036-0x0;var _0x552fed=_0x1014[_0x5cd036];return _0x552fed;};'use strict';var client=require('../client');exports[_0x4101('0x0')]=function(_0x2fcba7){return function(_0x2c5c2e){return client[_0x4101('0x1')](_0x4101('0x2'),{'options':{'raw':![],'attributes':['id',_0x4101('0x3'),_0x4101('0x4'),_0x4101('0x5')],'include':[{'model':_0x4101('0x6'),'as':_0x4101('0x7'),'attributes':['id',_0x4101('0x8'),'operator',_0x4101('0x9')]},{'model':_0x4101('0x6'),'as':_0x4101('0xa'),'attributes':['id',_0x4101('0x8'),_0x4101('0xb'),_0x4101('0x9')]},{'model':_0x4101('0xc'),'as':_0x4101('0xd'),'attributes':['id','action','data1','data2',_0x4101('0xe'),_0x4101('0xf'),_0x4101('0x10'),_0x4101('0x11'),_0x4101('0x12')]}]},'log':_0x4101('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index d4efc65..425b1f2 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 _0x1403=['GetTrunk','registry','defaultuser','../client','getTrunks','Request'];(function(_0x2d49ce,_0x4903d6){var _0x3c85f7=function(_0xf93d6a){while(--_0xf93d6a){_0x2d49ce['push'](_0x2d49ce['shift']());}};_0x3c85f7(++_0x4903d6);}(_0x1403,0x153));var _0x3140=function(_0x5efea9,_0x30c556){_0x5efea9=_0x5efea9-0x0;var _0x8012dd=_0x1403[_0x5efea9];return _0x8012dd;};'use strict';var client=require(_0x3140('0x0'));exports[_0x3140('0x1')]=function(_0x222d86){return function(_0x176022){return client[_0x3140('0x2')](_0x3140('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x3140('0x4'),_0x3140('0x5')]},'log':_0x3140('0x3')});};}; \ No newline at end of file +var _0x0178=['../client','Request','GetTrunk','name','registry','defaultuser'];(function(_0xb4d810,_0x8533ae){var _0x1013be=function(_0x2500e1){while(--_0x2500e1){_0xb4d810['push'](_0xb4d810['shift']());}};_0x1013be(++_0x8533ae);}(_0x0178,0x1e6));var _0x8017=function(_0x5bf081,_0x46042d){_0x5bf081=_0x5bf081-0x0;var _0x4a4dbf=_0x0178[_0x5bf081];return _0x4a4dbf;};'use strict';var client=require(_0x8017('0x0'));exports['getTrunks']=function(_0x5e5459){return function(_0x435461){return client[_0x8017('0x1')](_0x8017('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x8017('0x3'),_0x8017('0x4'),_0x8017('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 2c197b6..ee9b6a5 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 _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x41db0c,_0x1a4f78){var _0x5412b8=function(_0x421cab){while(--_0x421cab){_0x41db0c['push'](_0x41db0c['shift']());}};_0x5412b8(++_0x1a4f78);}(_0x9c44,0x178));var _0x49c4=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x9c44[_0x279d37];return _0x530173;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file +var _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x61245a,_0x14b17f){var _0x2d578b=function(_0x2f9db1){while(--_0x2f9db1){_0x61245a['push'](_0x61245a['shift']());}};_0x2d578b(++_0x14b17f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5cb97e,_0x132a39){_0x5cb97e=_0x5cb97e-0x0;var _0x1714b4=_0xcb91[_0x5cb97e];return _0x1714b4;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 1b61c8b..8dbde1f 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 _0xcd76=['create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client'];(function(_0x3b9705,_0x5b8651){var _0x2d9c14=function(_0xf6c50b){while(--_0xf6c50b){_0x3b9705['push'](_0x3b9705['shift']());}};_0x2d9c14(++_0x5b8651);}(_0xcd76,0x101));var _0x6cd7=function(_0x14b596,_0x1a2e86){_0x14b596=_0x14b596-0x0;var _0x14ece4=_0xcd76[_0x14b596];return _0x14ece4;};'use strict';var client=require(_0x6cd7('0x0'));exports[_0x6cd7('0x1')]=function(_0x8b807){return client[_0x6cd7('0x2')](_0x6cd7('0x3'),{'body':_0x8b807,'log':_0x6cd7('0x3')});};exports[_0x6cd7('0x4')]=function(_0x38d131,_0x165c85,_0x531475){return client['Request'](_0x6cd7('0x5'),{'body':_0x38d131,'options':{'where':{'uniqueid':_0x165c85,'interface':_0x531475,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0xab38=['create','Request','CreateVoiceAgentReport','../client'];(function(_0x2d0bfd,_0x2ba336){var _0x4d806c=function(_0x47938d){while(--_0x47938d){_0x2d0bfd['push'](_0x2d0bfd['shift']());}};_0x4d806c(++_0x2ba336);}(_0xab38,0x83));var _0x8ab3=function(_0x302a88,_0x2f1780){_0x302a88=_0x302a88-0x0;var _0x49ce80=_0xab38[_0x302a88];return _0x49ce80;};'use strict';var client=require(_0x8ab3('0x0'));exports[_0x8ab3('0x1')]=function(_0x55c358){return client[_0x8ab3('0x2')](_0x8ab3('0x3'),{'body':_0x55c358,'log':_0x8ab3('0x3')});};exports['update']=function(_0x462ad5,_0x48513d,_0x2006ff){return client['Request']('UpdateVoiceAgentReport',{'body':_0x462ad5,'options':{'where':{'uniqueid':_0x48513d,'interface':_0x2006ff,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 7541873..d921f90 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 _0x0130=['calleridnum','context','CreateVoiceCallReport','getVoiceCallReports','GetVoiceCallReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','merge'];(function(_0x845587,_0x44f4f8){var _0x396303=function(_0x39959b){while(--_0x39959b){_0x845587['push'](_0x845587['shift']());}};_0x396303(++_0x44f4f8);}(_0x0130,0x174));var _0x0013=function(_0x528575,_0x2e067d){_0x528575=_0x528575-0x0;var _0x3063b7=_0x0130[_0x528575];return _0x3063b7;};'use strict';var moment=require(_0x0013('0x0'));var util=require(_0x0013('0x1'));var _=require(_0x0013('0x2'));var client=require(_0x0013('0x3'));exports[_0x0013('0x4')]=function(_0x67c17d){return client['Request']('CreateVoiceCallReport',{'body':_[_0x0013('0x5')](_0x67c17d,{'source':_0x67c17d[_0x0013('0x6')],'destinationcontext':_0x67c17d[_0x0013('0x7')],'callerid':_0x67c17d['callerid'],'amaflags':'DOCUMENTATION'}),'log':_0x0013('0x8')});};exports[_0x0013('0x9')]=function(){return function(){return client['Request'](_0x0013('0xa'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x0013('0xb')]('day')[_0x0013('0xc')](_0x0013('0xd')),moment()[_0x0013('0xe')](_0x0013('0xf'))[_0x0013('0xc')](_0x0013('0xd'))]}},'attributes':[_0x0013('0x10'),_0x0013('0x11'),_0x0013('0x12'),_0x0013('0x13')]},'log':_0x0013('0x14')});};}; \ No newline at end of file +var _0x3ed4=['format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','callerid','DOCUMENTATION','getVoiceCallReports','outbound','day'];(function(_0x57e7f9,_0x307877){var _0x52caf9=function(_0x1772df){while(--_0x1772df){_0x57e7f9['push'](_0x57e7f9['shift']());}};_0x52caf9(++_0x307877);}(_0x3ed4,0x85));var _0x43ed=function(_0x575584,_0x149395){_0x575584=_0x575584-0x0;var _0x120d12=_0x3ed4[_0x575584];return _0x120d12;};'use strict';var moment=require(_0x43ed('0x0'));var util=require(_0x43ed('0x1'));var _=require(_0x43ed('0x2'));var client=require(_0x43ed('0x3'));exports[_0x43ed('0x4')]=function(_0x363eba){return client[_0x43ed('0x5')](_0x43ed('0x6'),{'body':_[_0x43ed('0x7')](_0x363eba,{'source':_0x363eba[_0x43ed('0x8')],'destinationcontext':_0x363eba['context'],'callerid':_0x363eba[_0x43ed('0x9')],'amaflags':_0x43ed('0xa')}),'log':'CreateVoiceCallReport'});};exports[_0x43ed('0xb')]=function(){return function(){return client[_0x43ed('0x5')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x43ed('0xc')],'createdAt':{'$between':[moment()['startOf'](_0x43ed('0xd'))[_0x43ed('0xe')](_0x43ed('0xf')),moment()['endOf'](_0x43ed('0xd'))[_0x43ed('0xe')](_0x43ed('0xf'))]}},'attributes':[_0x43ed('0x10'),_0x43ed('0x11'),_0x43ed('0x12'),_0x43ed('0x13')]},'log':_0x43ed('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 217e65f..b86f74d 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 _0xad9e=['../client','CreateVoiceDialReport'];(function(_0x195577,_0x5de53a){var _0x13c367=function(_0x583022){while(--_0x583022){_0x195577['push'](_0x195577['shift']());}};_0x13c367(++_0x5de53a);}(_0xad9e,0x154));var _0xead9=function(_0x1377be,_0x536cda){_0x1377be=_0x1377be-0x0;var _0x344720=_0xad9e[_0x1377be];return _0x344720;};'use strict';var client=require(_0xead9('0x0'));exports['create']=function(_0x3704b9){return client['Request'](_0xead9('0x1'),{'body':_0x3704b9,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x119d=['../client','create','Request','CreateVoiceDialReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x119d,0x11c));var _0xd119=function(_0x236ae3,_0x1114d8){_0x236ae3=_0x236ae3-0x0;var _0x5912dc=_0x119d[_0x236ae3];return _0x5912dc;};'use strict';var client=require(_0xd119('0x0'));exports[_0xd119('0x1')]=function(_0xb135ca){return client[_0xd119('0x2')](_0xd119('0x3'),{'body':_0xb135ca,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 5a4114c..bfdefff 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 _0x2750=['exten','recordingFormat','getVoiceExtensions','../client','Request','GetVoiceExtension'];(function(_0x5954d6,_0x5c5402){var _0x3e8ad5=function(_0x2b6d21){while(--_0x2b6d21){_0x5954d6['push'](_0x5954d6['shift']());}};_0x3e8ad5(++_0x5c5402);}(_0x2750,0x13b));var _0x0275=function(_0x369883,_0x3dd9cc){_0x369883=_0x369883-0x0;var _0x4116cc=_0x2750[_0x369883];return _0x4116cc;};'use strict';var client=require(_0x0275('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x0275('0x1')](_0x0275('0x2'),{'options':{'raw':!![],'attributes':['id',_0x0275('0x3'),_0x0275('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x0275('0x5')});};}; \ No newline at end of file +var _0x9bde=['getVoiceExtensions','GetVoiceExtension','recordingFormat'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9bde,0xe1));var _0xe9bd=function(_0x31f0d3,_0x8c2351){_0x31f0d3=_0x31f0d3-0x0;var _0x1fbc42=_0x9bde[_0x31f0d3];return _0x1fbc42;};'use strict';var client=require('../client');exports[_0xe9bd('0x0')]=function(){return function(){return client['Request'](_0xe9bd('0x1'),{'options':{'raw':!![],'attributes':['id','exten',_0xe9bd('0x2')],'where':{'VoiceExtensionId':null}},'log':_0xe9bd('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 90333e6..95f4653 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 _0x9b62=['dialPreviewRecallmeReminder','Trunk','Pause','mandatoryDispositionPause','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueProject','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe'];(function(_0x41648f,_0x4a8936){var _0x20340a=function(_0x358f29){while(--_0x358f29){_0x41648f['push'](_0x41648f['shift']());}};_0x20340a(++_0x4a8936);}(_0x9b62,0x169));var _0x29b6=function(_0x148fdd,_0x116751){_0x148fdd=_0x148fdd-0x0;var _0x130f14=_0x9b62[_0x148fdd];return _0x130f14;};'use strict';var client=require(_0x29b6('0x0'));exports[_0x29b6('0x1')]=function(){return function(){return client[_0x29b6('0x2')](_0x29b6('0x3'),{'options':{'raw':![],'attributes':['id',_0x29b6('0x4'),_0x29b6('0x5'),_0x29b6('0x6'),_0x29b6('0x7'),_0x29b6('0x8'),_0x29b6('0x9'),_0x29b6('0xa'),_0x29b6('0xb'),_0x29b6('0xc'),_0x29b6('0xd'),_0x29b6('0xe'),'dialPredictiveOptimization',_0x29b6('0xf'),'dialPredictiveInterval',_0x29b6('0x10'),_0x29b6('0x11'),'dialOriginateTimeout',_0x29b6('0x12'),'dialQueueTimeout',_0x29b6('0x13'),'dialCongestionMaxRetry',_0x29b6('0x14'),'dialBusyMaxRetry',_0x29b6('0x15'),_0x29b6('0x16'),'dialNoAnswerRetryFrequency','dialGlobalMaxRetry',_0x29b6('0x17'),_0x29b6('0x18'),_0x29b6('0x19'),_0x29b6('0x1a'),'dialAMDActive',_0x29b6('0x1b'),_0x29b6('0x1c'),'dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime',_0x29b6('0x1d'),_0x29b6('0x1e'),_0x29b6('0x1f'),_0x29b6('0x20'),_0x29b6('0x21'),_0x29b6('0x22'),'dialRecallMeTimeout',_0x29b6('0x23'),_0x29b6('0x24'),'dialAgiAfterHangupAgent',_0x29b6('0x25'),'dialQueueProject2',_0x29b6('0x8'),_0x29b6('0x26'),_0x29b6('0x27'),'dialCutDigit',_0x29b6('0x28'),_0x29b6('0x29'),_0x29b6('0x2a'),_0x29b6('0x2b'),_0x29b6('0x2c'),_0x29b6('0x2d'),_0x29b6('0x2e'),'dialMachineRetryFrequency',_0x29b6('0x2f'),_0x29b6('0x30'),_0x29b6('0x31'),_0x29b6('0x32'),'dialPredictiveIntervalMinThreshold',_0x29b6('0x33'),_0x29b6('0x34')],'include':[{'model':'Trunk','as':_0x29b6('0x35'),'attributes':['id',_0x29b6('0x4'),'callerid','active']},{'model':_0x29b6('0x36'),'as':_0x29b6('0x37'),'attributes':['id',_0x29b6('0x4')]},{'model':_0x29b6('0x35'),'as':_0x29b6('0x38'),'attributes':['id',_0x29b6('0x4'),'callerid','active']},{'model':_0x29b6('0x39'),'as':_0x29b6('0x39'),'attributes':['id','name'],'include':[{'model':_0x29b6('0x39'),'as':'Intervals','attributes':['id',_0x29b6('0x4'),_0x29b6('0x3a')]}]}]},'log':_0x29b6('0x1')});};}; \ No newline at end of file +var _0xe9ff=['dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPreviewRecallmeReminder','Trunk','callerid','mandatoryDispositionPause','TrunkBackup','active','Interval','Intervals','interval','getVoiceQueues','../client','Request','name','acw','acwTimeout','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialBusyMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xe9ff,0xe3));var _0xfe9f=function(_0x5156a2,_0x4fe01a){_0x5156a2=_0x5156a2-0x0;var _0x3f971a=_0xe9ff[_0x5156a2];return _0x3f971a;};'use strict';var client=require(_0xfe9f('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0xfe9f('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0xfe9f('0x2'),_0xfe9f('0x3'),_0xfe9f('0x4'),'autopause',_0xfe9f('0x5'),_0xfe9f('0x6'),_0xfe9f('0x7'),_0xfe9f('0x8'),_0xfe9f('0x9'),_0xfe9f('0xa'),_0xfe9f('0xb'),_0xfe9f('0xc'),_0xfe9f('0xd'),_0xfe9f('0xe'),_0xfe9f('0xf'),_0xfe9f('0x10'),_0xfe9f('0x11'),_0xfe9f('0x12'),_0xfe9f('0x13'),'dialQueueProject',_0xfe9f('0x14'),'dialCongestionRetryFrequency',_0xfe9f('0x15'),'dialBusyRetryFrequency','dialNoAnswerMaxRetry',_0xfe9f('0x16'),_0xfe9f('0x17'),_0xfe9f('0x18'),_0xfe9f('0x19'),_0xfe9f('0x1a'),_0xfe9f('0x1b'),_0xfe9f('0x1c'),_0xfe9f('0x1d'),_0xfe9f('0x1e'),_0xfe9f('0x1f'),'dialAMDTotalAnalysisTime',_0xfe9f('0x20'),_0xfe9f('0x21'),_0xfe9f('0x22'),_0xfe9f('0x23'),_0xfe9f('0x24'),_0xfe9f('0x25'),_0xfe9f('0x26'),_0xfe9f('0x27'),_0xfe9f('0x28'),_0xfe9f('0x29'),'dialAgiAfterHangupClient','dialQueueProject2',_0xfe9f('0x5'),_0xfe9f('0x2a'),'dialRandomLastDigitCallerIdNumber',_0xfe9f('0x2b'),_0xfe9f('0x2c'),'dialNoSuchNumberRetryFrequency','dialDropMaxRetry',_0xfe9f('0x2d'),_0xfe9f('0x2e'),_0xfe9f('0x2f'),_0xfe9f('0x30'),_0xfe9f('0x31'),_0xfe9f('0x32'),_0xfe9f('0x33'),'mandatoryDisposition',_0xfe9f('0x34'),'dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe',_0xfe9f('0x35')],'include':[{'model':'Trunk','as':_0xfe9f('0x36'),'attributes':['id',_0xfe9f('0x2'),_0xfe9f('0x37'),'active']},{'model':'Pause','as':_0xfe9f('0x38'),'attributes':['id',_0xfe9f('0x2')]},{'model':'Trunk','as':_0xfe9f('0x39'),'attributes':['id',_0xfe9f('0x2'),'callerid',_0xfe9f('0x3a')]},{'model':_0xfe9f('0x3b'),'as':_0xfe9f('0x3b'),'attributes':['id',_0xfe9f('0x2')],'include':[{'model':'Interval','as':_0xfe9f('0x3c'),'attributes':['id','name',_0xfe9f('0x3d')]}]}]},'log':_0xfe9f('0x3e')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 944b465..26837ba 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(_0x4a08b6,_0x21a046){var _0x3fac4d=function(_0x3556d5){while(--_0x3556d5){_0x4a08b6['push'](_0x4a08b6['shift']());}};_0x3fac4d(++_0x21a046);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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(_0x32a00c,_0x577c87){var _0x2dd3f4=function(_0xa29d35){while(--_0xa29d35){_0x32a00c['push'](_0x32a00c['shift']());}};_0x2dd3f4(++_0x577c87);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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 7d4c9dd..140c877 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 _0x8888=['../client','getVoiceQueueRtPauses','GetVoiceQueueRtPauses'];(function(_0x54ab7c,_0x20d9f9){var _0x4ce8d8=function(_0x1dc0b4){while(--_0x1dc0b4){_0x54ab7c['push'](_0x54ab7c['shift']());}};_0x4ce8d8(++_0x20d9f9);}(_0x8888,0x168));var _0x8888=function(_0x57fe0e,_0x51d158){_0x57fe0e=_0x57fe0e-0x0;var _0x368c40=_0x8888[_0x57fe0e];return _0x368c40;};'use strict';var client=require(_0x8888('0x0'));exports[_0x8888('0x1')]=function(_0x391b3d){return function(){return client['Request'](_0x8888('0x2'),{'options':{'where':{'VoiceQueueId':_0x391b3d,'paused':!![]},'raw':!![]},'log':_0x8888('0x1')});};}; \ No newline at end of file +var _0x39a1=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x93703d,_0x1f5117){var _0x11f8ab=function(_0x3de0a5){while(--_0x3de0a5){_0x93703d['push'](_0x93703d['shift']());}};_0x11f8ab(++_0x1f5117);}(_0x39a1,0xab));var _0x139a=function(_0x6ccba5,_0x3899d3){_0x6ccba5=_0x6ccba5-0x0;var _0xb12fe8=_0x39a1[_0x6ccba5];return _0xb12fe8;};'use strict';var client=require(_0x139a('0x0'));exports[_0x139a('0x1')]=function(_0x5328c5){return function(){return client[_0x139a('0x2')](_0x139a('0x3'),{'options':{'where':{'VoiceQueueId':_0x5328c5,'paused':!![]},'raw':!![]},'log':_0x139a('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index b0f7f4c..6aa731b 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x5653ab,_0x6928cf){var _0x2c3efa=function(_0x2b7a2a){while(--_0x2b7a2a){_0x5653ab['push'](_0x5653ab['shift']());}};_0x2c3efa(++_0x6928cf);}(_0x7a54,0x106));var _0x47a5=function(_0x466e4d,_0x28d50e){_0x466e4d=_0x466e4d-0x0;var _0x595288=_0x7a54[_0x466e4d];return _0x595288;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x4d0f87,_0x18acab){var _0x286c7c=function(_0x4fba08){while(--_0x4fba08){_0x4d0f87['push'](_0x4d0f87['shift']());}};_0x286c7c(++_0x18acab);}(_0x7a54,0x106));var _0x47a5=function(_0x135aee,_0x52c4c1){_0x135aee=_0x135aee-0x0;var _0x14672c=_0x7a54[_0x135aee];return _0x14672c;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index de93644..70d1a0a 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 _0x81a3=['secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereeconnectedlinename','transfereelinkedid','isexternal','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname'];(function(_0x20aadb,_0x5a607a){var _0x520018=function(_0x1d258a){while(--_0x1d258a){_0x20aadb['push'](_0x20aadb['shift']());}};_0x520018(++_0x5a607a);}(_0x81a3,0x16b));var _0x381a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x81a3[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x381a('0x0'));exports[_0x381a('0x1')]={};exports[_0x381a('0x2')]=function(_0x7b0945){return client[_0x381a('0x3')](_0x381a('0x4'),{'body':{'result':_0x7b0945[_0x381a('0x5')],'transfererchannel':_0x7b0945[_0x381a('0x6')],'transferercalleridnum':_0x7b0945[_0x381a('0x7')],'transferercalleridname':_0x7b0945['transferercalleridname'],'transfererconnectedlinenum':_0x7b0945[_0x381a('0x8')],'transfererconnectedlinename':_0x7b0945['transfererconnectedlinename'],'transfereraccountcode':_0x7b0945['transfereraccountcode'],'transferercontext':_0x7b0945[_0x381a('0x9')],'transfererexten':_0x7b0945[_0x381a('0xa')],'transfererlinkedid':_0x7b0945['transfererlinkedid'],'transfereechannel':_0x7b0945[_0x381a('0xb')],'transfereecalleridnum':_0x7b0945[_0x381a('0xc')],'transfereecalleridname':_0x7b0945['transfereecalleridname'],'transfereeconnectedlinenum':_0x7b0945['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x7b0945[_0x381a('0xd')],'transfereeaccountcode':_0x7b0945['transfereeaccountcode'],'transfereecontext':_0x7b0945['transfereecontext'],'transfereeexten':_0x7b0945['transfereeexten'],'transfereelinkedid':_0x7b0945[_0x381a('0xe')],'isexternal':_0x7b0945[_0x381a('0xf')],'context':_0x7b0945['context'],'extension':_0x7b0945[_0x381a('0x10')],'type':_0x381a('0x11')},'log':'CreateVoiceTransferReport'});};exports[_0x381a('0x12')]=function(_0x3b9b5e){return client[_0x381a('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x3b9b5e[_0x381a('0x5')],'transfererchannel':_0x3b9b5e[_0x381a('0x13')],'transferercalleridnum':_0x3b9b5e[_0x381a('0x14')],'transferercalleridname':_0x3b9b5e[_0x381a('0x15')],'transfererconnectedlinenum':_0x3b9b5e[_0x381a('0x16')],'transfererconnectedlinename':_0x3b9b5e[_0x381a('0x17')],'transfereraccountcode':_0x3b9b5e[_0x381a('0x18')],'transferercontext':_0x3b9b5e['secondtransferercontext'],'transfererexten':_0x3b9b5e[_0x381a('0x19')],'transfererlinkedid':_0x3b9b5e['origtransfererlinkedid'],'transfereechannel':_0x3b9b5e['transfertargetchannel'],'transfereecalleridnum':_0x3b9b5e[_0x381a('0x1a')],'transfereecalleridname':_0x3b9b5e[_0x381a('0x1b')],'transfereeconnectedlinenum':_0x3b9b5e[_0x381a('0x1c')],'transfereeconnectedlinename':_0x3b9b5e[_0x381a('0x1d')],'transfereeaccountcode':_0x3b9b5e[_0x381a('0x1e')],'transfereecontext':_0x3b9b5e[_0x381a('0x1f')],'transfereeexten':_0x3b9b5e[_0x381a('0x20')],'transfereelinkedid':_0x3b9b5e[_0x381a('0x21')],'isexternal':_0x3b9b5e[_0x381a('0xf')],'context':_0x3b9b5e['origtransferercontext'],'extension':_0x3b9b5e['origtransfererexten'],'type':_0x381a('0x22')},'log':_0x381a('0x4')});}; \ No newline at end of file +var _0x557b=['transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','extension','blind','Request','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfereechannel','transfereecalleridnum','transfereecalleridname'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x557b,0x76));var _0xb557=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x557b[_0x2faddb];return _0x273c05;};'use strict';var client=require(_0xb557('0x0'));exports[_0xb557('0x1')]={};exports[_0xb557('0x2')]=function(_0x25a925){return client['Request'](_0xb557('0x3'),{'body':{'result':_0x25a925[_0xb557('0x4')],'transfererchannel':_0x25a925[_0xb557('0x5')],'transferercalleridnum':_0x25a925[_0xb557('0x6')],'transferercalleridname':_0x25a925[_0xb557('0x7')],'transfererconnectedlinenum':_0x25a925[_0xb557('0x8')],'transfererconnectedlinename':_0x25a925[_0xb557('0x9')],'transfereraccountcode':_0x25a925[_0xb557('0xa')],'transferercontext':_0x25a925['transferercontext'],'transfererexten':_0x25a925['transfererexten'],'transfererlinkedid':_0x25a925['transfererlinkedid'],'transfereechannel':_0x25a925[_0xb557('0xb')],'transfereecalleridnum':_0x25a925[_0xb557('0xc')],'transfereecalleridname':_0x25a925[_0xb557('0xd')],'transfereeconnectedlinenum':_0x25a925[_0xb557('0xe')],'transfereeconnectedlinename':_0x25a925[_0xb557('0xf')],'transfereeaccountcode':_0x25a925[_0xb557('0x10')],'transfereecontext':_0x25a925[_0xb557('0x11')],'transfereeexten':_0x25a925[_0xb557('0x12')],'transfereelinkedid':_0x25a925['transfereelinkedid'],'isexternal':_0x25a925[_0xb557('0x13')],'context':_0x25a925[_0xb557('0x14')],'extension':_0x25a925[_0xb557('0x15')],'type':_0xb557('0x16')},'log':_0xb557('0x3')});};exports['attendedTransfer']=function(_0x472b0f){return client[_0xb557('0x17')](_0xb557('0x3'),{'body':{'result':_0x472b0f[_0xb557('0x4')],'transfererchannel':_0x472b0f[_0xb557('0x18')],'transferercalleridnum':_0x472b0f[_0xb557('0x19')],'transferercalleridname':_0x472b0f[_0xb557('0x1a')],'transfererconnectedlinenum':_0x472b0f[_0xb557('0x1b')],'transfererconnectedlinename':_0x472b0f[_0xb557('0x1c')],'transfereraccountcode':_0x472b0f[_0xb557('0x1d')],'transferercontext':_0x472b0f['secondtransferercontext'],'transfererexten':_0x472b0f[_0xb557('0x1e')],'transfererlinkedid':_0x472b0f[_0xb557('0x1f')],'transfereechannel':_0x472b0f[_0xb557('0x20')],'transfereecalleridnum':_0x472b0f[_0xb557('0x21')],'transfereecalleridname':_0x472b0f[_0xb557('0x22')],'transfereeconnectedlinenum':_0x472b0f[_0xb557('0x23')],'transfereeconnectedlinename':_0x472b0f[_0xb557('0x24')],'transfereeaccountcode':_0x472b0f[_0xb557('0x25')],'transfereecontext':_0x472b0f[_0xb557('0x26')],'transfereeexten':_0x472b0f[_0xb557('0x27')],'transfereelinkedid':_0x472b0f[_0xb557('0x28')],'isexternal':_0x472b0f[_0xb557('0x13')],'context':_0x472b0f[_0xb557('0x29')],'extension':_0x472b0f[_0xb557('0x2a')],'type':_0xb557('0x2b')},'log':_0xb557('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 292a75e..e4132bc 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 _0x7ee1=['emit','faxAccounts','send','checkAfterSend','server','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','bluebird','moment','../../../config/environment','../ami','listen','format','timers','timer','updateAcw','agents','pause','QueuePause','isConnected','error','asterisk','username','module','action','Reload','Action','then','message','ami\x20disconnected','join','pick','command','Command','voiceQueues','hasOwnProperty','name','strategy','answered','available','pTalking','sumBillable','sumDuration','talking','total','unmanaged','waiting','type','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','find','omit','undefined','values','channels','voicechannel','validate','map','uniqueid','channel','%s.%s','MixMonitor','ai(mixmonitorid)','monitors','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','catch','toLowerCase','resolve','StopMixMonitor','destinationchannel','stop','wav','/var/spool/asterisk/monitor/','Channel\x20doesn\x27t\x20exist','queueChannels','voicequeuechannelhangup','Hangup','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7ee1,0x8d));var _0x17ee=function(_0x489d29,_0x44a00f){_0x489d29=_0x489d29-0x0;var _0x39156d=_0x7ee1[_0x489d29];return _0x39156d;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var jayson=require('jayson/promise');var schema=require('validate');var BPromise=require(_0x17ee('0x1'));var moment=require(_0x17ee('0x2'));var config=require(_0x17ee('0x3'));var properties=require('../properties');var ami=require(_0x17ee('0x4'));exports[_0x17ee('0x5')]=function(_0x10f7a8,_0x2f9ebc,_0x5c0617){return new BPromise(function(_0x52b1db,_0x29b9eb){var _0x54b4f6={'QueuePause':function(_0x3f61af){return new Promise(function(_0x57e1d1,_0x3d767b){var _0xfa5096=util[_0x17ee('0x6')]('%s/%s','SIP',_0x3f61af['name']);if(_0x10f7a8[_0x17ee('0x7')]&&_0x10f7a8['timers'][_0xfa5096]&&_0x10f7a8[_0x17ee('0x7')][_0xfa5096][_0x17ee('0x8')]){_0x10f7a8[_0x17ee('0x7')][_0xfa5096][_0x17ee('0x9')]();}if(_0x10f7a8['agents'][_0xfa5096]){_0x10f7a8[_0x17ee('0xa')][_0xfa5096]['updateStatusRealtime']({'statePause':_0x3f61af[_0x17ee('0xb')]?!![]:![]});}_0x57e1d1({'code':0xc8,'message':_0x17ee('0xc')});});},'Reload':function(_0x358514){var _0xe75682=this;return new Promise(function(_0x308ec7,_0xca5e20){if(ami[_0x17ee('0xd')]()==![]){return _0xca5e20(_0xe75682[_0x17ee('0xe')](0x1f4,[config[_0x17ee('0xf')]['ip'],config[_0x17ee('0xf')][_0x17ee('0x10')],'ami\x20disconnected']['join']('\x20')));}_0x358514=_['pick'](_0x358514,_['keys'](properties[_0x17ee('0x11')]));_0x358514[_0x17ee('0x12')]=_0x17ee('0x13');return ami[_0x17ee('0x14')](_0x358514)[_0x17ee('0x15')](function(_0x236d18){_0x308ec7({'code':0xc8,'message':_0x236d18[_0x17ee('0x16')]});})['catch'](function(_0x44fe58){_0xca5e20(_0xe75682[_0x17ee('0xe')](0x1f5,_0x44fe58[_0x17ee('0x16')]));});});},'Command':function(_0x11ca6b){var _0x31c0bd=this;return new Promise(function(_0x57925d,_0x393720){if(ami['isConnected']()==![]){return _0x393720(_0x31c0bd[_0x17ee('0xe')](0x1f4,[config['asterisk']['ip'],config[_0x17ee('0xf')][_0x17ee('0x10')],_0x17ee('0x17')][_0x17ee('0x18')]('\x20')));}_0x11ca6b=_[_0x17ee('0x19')](_0x11ca6b,_0x17ee('0x1a'));_0x11ca6b[_0x17ee('0x12')]=_0x17ee('0x1b');return ami[_0x17ee('0x14')](_0x11ca6b)[_0x17ee('0x15')](function(_0x37fe4e){_0x57925d({'code':0xc8,'message':_0x37fe4e['content']});})['catch'](function(_0x2118a6){_0x393720(_0x31c0bd[_0x17ee('0xe')](0x1f5,_0x2118a6[_0x17ee('0x16')]));});});},'VoiceQueues':function(_0x9b379d){return new Promise(function(_0x3bbddf,_0xea358f){var _0x2f6e84=[];for(var _0x1d8aa2 in _0x10f7a8[_0x17ee('0x1c')]){if(_0x10f7a8[_0x17ee('0x1c')][_0x17ee('0x1d')](_0x1d8aa2)){var _0x2a332f=_0x10f7a8['voiceQueues'][_0x1d8aa2];var _0x3634c9={'id':_0x2a332f['id'],'name':_0x2a332f[_0x17ee('0x1e')],'strategy':_0x2a332f[_0x17ee('0x1f')],'answered':_0x2a332f[_0x17ee('0x20')],'available':_0x2a332f[_0x17ee('0x21')],'loggedIn':_0x2a332f['loggedIn'],'pTalking':_0x2a332f[_0x17ee('0x22')],'sumBillable':_0x2a332f[_0x17ee('0x23')],'sumDuration':_0x2a332f[_0x17ee('0x24')],'sumHoldTime':_0x2a332f['sumHoldTime']||0x0,'talking':_0x2a332f[_0x17ee('0x25')],'total':_0x2a332f[_0x17ee('0x26')],'type':_0x2a332f['type'],'unmanaged':_0x2a332f[_0x17ee('0x27')],'abandoned':_0x2a332f['abandoned'],'waiting':_0x2a332f[_0x17ee('0x28')],'loggedInDb':_0x2a332f['loggedInDb']};if(_0x2a332f[_0x17ee('0x29')]===_0x17ee('0x2a')){_0x3634c9[_0x17ee('0x2b')]=_0x2a332f['dialActive'];_0x3634c9[_0x17ee('0x2c')]=_0x2a332f[_0x17ee('0x2c')];_0x3634c9['dialOriginateCallerIdName']=_0x2a332f[_0x17ee('0x2d')];_0x3634c9[_0x17ee('0x2e')]=_0x2a332f[_0x17ee('0x2e')];_0x3634c9['dialOriginateTimeout']=_0x2a332f['dialOriginateTimeout'];_0x3634c9[_0x17ee('0x2f')]=_0x2a332f[_0x17ee('0x2f')];_0x3634c9[_0x17ee('0x30')]=_0x2a332f[_0x17ee('0x30')];_0x3634c9['outboundAnswerAgiCallsDay']=_0x2a332f['outboundAnswerAgiCallsDay'];_0x3634c9[_0x17ee('0x31')]=_0x2a332f[_0x17ee('0x31')];_0x3634c9[_0x17ee('0x32')]=_0x2a332f[_0x17ee('0x32')];_0x3634c9[_0x17ee('0x33')]=_0x2a332f[_0x17ee('0x33')];_0x3634c9[_0x17ee('0x34')]=_0x2a332f['outboundCongestionCallsDay'];_0x3634c9['outboundDropCallsDayACS']=_0x2a332f['outboundDropCallsDayACS'];_0x3634c9[_0x17ee('0x35')]=_0x2a332f['outboundDropCallsDayCallersExit'];_0x3634c9[_0x17ee('0x36')]=_0x2a332f[_0x17ee('0x36')];_0x3634c9[_0x17ee('0x37')]=_0x2a332f['outboundNoAnswerCallsDay'];_0x3634c9[_0x17ee('0x38')]=_0x2a332f[_0x17ee('0x38')];_0x3634c9['outboundOriginateFailureCallsDay']=_0x2a332f['outboundOriginateFailureCallsDay'];_0x3634c9[_0x17ee('0x39')]=_0x2a332f[_0x17ee('0x39')];_0x3634c9[_0x17ee('0x3a')]=_0x2a332f[_0x17ee('0x3a')];_0x3634c9[_0x17ee('0x3b')]=_0x2a332f['outboundUnknownCallsDay'];_0x3634c9['predictiveIntervalAnsweredCalls']=_0x2a332f[_0x17ee('0x3c')];_0x3634c9[_0x17ee('0x3d')]=_0x2a332f[_0x17ee('0x3d')];_0x3634c9[_0x17ee('0x3e')]=_0x2a332f[_0x17ee('0x3e')];_0x3634c9[_0x17ee('0x3f')]=_0x2a332f['predictiveIntervalDroppedCallsCallersExit'];_0x3634c9['predictiveIntervalDroppedCallsTimeout']=_0x2a332f[_0x17ee('0x40')];_0x3634c9[_0x17ee('0x41')]=_0x2a332f[_0x17ee('0x41')];_0x3634c9[_0x17ee('0x42')]=_0x2a332f[_0x17ee('0x42')];_0x3634c9[_0x17ee('0x43')]=_0x2a332f[_0x17ee('0x43')];_0x3634c9[_0x17ee('0x44')]=_0x2a332f[_0x17ee('0x44')];_0x3634c9[_0x17ee('0x45')]=_0x2a332f['predictiveIntervalPauses'];_0x3634c9['predictiveIntervalAvailable']=_0x2a332f['predictiveIntervalAvailable'];_0x3634c9[_0x17ee('0x46')]=_0x2a332f[_0x17ee('0x46')];_0x3634c9[_0x17ee('0x16')]=_0x2a332f[_0x17ee('0x16')];_0x3634c9['originated']=_0x2a332f[_0x17ee('0x47')];_0x3634c9[_0x17ee('0x48')]=_0x2a332f[_0x17ee('0x48')];_0x3634c9[_0x17ee('0x49')]=_0x2a332f['erlangCallToSecond'];_0x3634c9[_0x17ee('0x4a')]=_0x2a332f[_0x17ee('0x4a')];_0x3634c9[_0x17ee('0x4b')]=_0x2a332f[_0x17ee('0x4b')];_0x3634c9[_0x17ee('0x4c')]=_0x2a332f[_0x17ee('0x4c')];_0x3634c9[_0x17ee('0x4d')]=_0x2a332f[_0x17ee('0x4d')];}if(_0x2a332f['Trunk']){_0x3634c9[_0x17ee('0x4e')]={'id':_0x2a332f[_0x17ee('0x4e')]['id'],'name':_0x2a332f[_0x17ee('0x4e')][_0x17ee('0x1e')],'active':_0x2a332f[_0x17ee('0x4e')][_0x17ee('0x4f')],'callerid':_0x2a332f[_0x17ee('0x4e')][_0x17ee('0x50')]};}if(_0x2a332f[_0x17ee('0x51')]){_0x3634c9[_0x17ee('0x51')]={'id':_0x2a332f[_0x17ee('0x51')]['id'],'name':_0x2a332f[_0x17ee('0x51')]['name']};}_0x2f6e84[_0x17ee('0x52')](_0x3634c9);}}_0x3bbddf({'count':_0x2f6e84[_0x17ee('0x53')],'rows':_0x2f6e84});});},'UpdateVoiceQueue':function(_0x578510){return new Promise(function(_0x5e3c93,_0x53a24e){var _0x329d42=_[_0x17ee('0x54')](_0x10f7a8[_0x17ee('0x1c')],{'id':parseInt(_0x578510['id'])});var _0x45aa19=_[_0x17ee('0x55')](_0x578510,['id']);if(_0x329d42){for(var _0x5b394b in _0x45aa19){if(typeof _0x45aa19[_0x5b394b]!==_0x17ee('0x56')&&typeof _0x329d42[_0x5b394b]!==_0x17ee('0x56')){_0x329d42[_0x5b394b]=_0x45aa19[_0x5b394b];}}_0x5e3c93(_0x329d42);}else{_0x53a24e();}});},'VoiceChannels':function(_0x2a6b24){return new Promise(function(_0x3a0ef8,_0x93c5fd){var _0x243ba7=_[_0x17ee('0x57')](_0x10f7a8[_0x17ee('0x58')]);_0x3a0ef8({'count':_0x243ba7[_0x17ee('0x53')],'rows':_0x243ba7});});},'VoiceChannelMixMonitor':function(_0x26d086){var _0x3f0ade=this;return new Promise(function(_0xc369f6,_0x4a99bf){if(ami['isConnected']()==![]){return _0x4a99bf(_0x3f0ade[_0x17ee('0xe')](0x1f4,[config[_0x17ee('0xf')]['ip'],config['asterisk']['username'],_0x17ee('0x17')]['join']('\x20')));}var _0x10a542=schema(properties[_0x17ee('0x59')])[_0x17ee('0x5a')](_0x26d086);if(_0x10a542[_0x17ee('0x53')]>0x0){return _0x4a99bf(_0x3f0ade[_0x17ee('0xe')](0x1f4,_[_0x17ee('0x5b')](_0x10a542,_0x17ee('0x16'))[_0x17ee('0x18')](',\x20')));}var _0x75e94a=_[_0x17ee('0x54')](_0x10f7a8[_0x17ee('0x58')],{'uniqueid':_0x26d086[_0x17ee('0x5c')]});if(_0x75e94a&&_0x75e94a[_0x17ee('0x5d')]){var _0x5be66b=util[_0x17ee('0x6')](_0x17ee('0x5e'),_0x26d086['filename']||_0x26d086[_0x17ee('0x5c')],_0x26d086[_0x17ee('0x6')]||'wav');return ami[_0x17ee('0x14')]({'action':_0x17ee('0x5f'),'channel':_0x75e94a[_0x17ee('0x5d')],'file':_0x5be66b,'options':_0x17ee('0x60')})[_0x17ee('0x15')](function(_0x10a021){var _0x2c2df5=_['find'](_0x75e94a[_0x17ee('0x61')],{'filename':'/var/spool/asterisk/monitor/'+_0x5be66b['toLowerCase']()});if(_[_0x17ee('0x62')](_0x2c2df5)){_0x75e94a[_0x17ee('0x61')][_0x17ee('0x52')]({'filename':'/var/spool/asterisk/monitor/'+_0x5be66b['toLowerCase'](),'createdAt':moment()[_0x17ee('0x6')](_0x17ee('0x63')),'mixmonitorid':_0x10a021[_0x17ee('0x64')],'status':_0x17ee('0x65')});}else{_0x2c2df5[_0x17ee('0x64')]=_0x10a021[_0x17ee('0x64')];_0x2c2df5[_0x17ee('0x66')]=_0x17ee('0x65');}_0xc369f6({'code':0xc8,'message':[_0x26d086['uniqueid'],_0x17ee('0x67'),_0x10a021[_0x17ee('0x64')]]['join']('\x20'),'mixmonitorid':_0x10a021['mixmonitorid']});})[_0x17ee('0x68')](function(_0x2ff762){_0x4a99bf(_0x3f0ade['error'](0x1f5,[_0x26d086['uniqueid'],_0x2ff762['message'][_0x17ee('0x69')]()][_0x17ee('0x18')]('\x20')));});}else{return _0x4a99bf(_0x3f0ade[_0x17ee('0xe')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x3b5284){var _0x408b60=this;return new Promise(function(_0x407317,_0x289548){if(ami['isConnected']()==![]){return _0x289548(_0x408b60[_0x17ee('0xe')](0x1f4,[config[_0x17ee('0xf')]['ip'],config['asterisk'][_0x17ee('0x10')],_0x17ee('0x17')][_0x17ee('0x18')]('\x20')));}var _0x2d3252=schema(properties[_0x17ee('0x59')])[_0x17ee('0x5a')](_0x3b5284);if(_0x2d3252[_0x17ee('0x53')]>0x0){return _0x289548(_0x408b60[_0x17ee('0xe')](0x1f4,_[_0x17ee('0x5b')](_0x2d3252,_0x17ee('0x16'))[_0x17ee('0x18')](',\x20')));}var _0x4db694=_[_0x17ee('0x54')](_0x10f7a8[_0x17ee('0x58')],{'uniqueid':_0x3b5284['uniqueid']});if(_0x4db694){return BPromise[_0x17ee('0x6a')]()[_0x17ee('0x15')](function(){if(_0x4db694[_0x17ee('0x5d')]){return ami['Action']({'action':_0x17ee('0x6b'),'channel':_0x4db694[_0x17ee('0x5d')],'mixmonitorid':_0x3b5284[_0x17ee('0x64')]})[_0x17ee('0x68')](function(_0x4aab2a){});}})[_0x17ee('0x15')](function(){if(_0x4db694[_0x17ee('0x6c')]){return ami['Action']({'action':_0x17ee('0x6b'),'channel':_0x4db694[_0x17ee('0x6c')],'mixmonitorid':_0x3b5284[_0x17ee('0x64')]})[_0x17ee('0x68')](function(_0x25b8d5){});}})[_0x17ee('0x15')](function(_0x541dc0){var _0xeabfa=_[_0x17ee('0x54')](_0x4db694[_0x17ee('0x61')],{'mixmonitorid':_0x3b5284[_0x17ee('0x64')]});if(_0xeabfa){_0xeabfa['status']=_0x17ee('0x6d');}})['then'](function(){var _0x420eee=util[_0x17ee('0x6')](_0x17ee('0x5e'),_0x3b5284['filename']||_0x3b5284['uniqueid'],_0x3b5284[_0x17ee('0x6')]||_0x17ee('0x6e'));var _0x1ee84b=_[_0x17ee('0x54')](_0x4db694['monitors'],{'filename':_0x17ee('0x6f')+_0x420eee['toLowerCase']()});if(_0x1ee84b){_0x1ee84b['status']=_0x17ee('0x6d');}})[_0x17ee('0x15')](function(){_0x407317({'code':0xc8,'message':[_0x3b5284['uniqueid'],'StopMixMonitor\x20Success'][_0x17ee('0x18')]('\x20')});})[_0x17ee('0x68')](function(_0x51a02e){_0x289548(_0x408b60[_0x17ee('0xe')](0x1f5,[_0x3b5284[_0x17ee('0x5c')],_0x51a02e[_0x17ee('0x16')][_0x17ee('0x69')]()][_0x17ee('0x18')]('\x20')));});}else{return _0x289548(_0x408b60[_0x17ee('0xe')](0x1f5,_0x17ee('0x70')));}});},'VoiceQueuesChannels':function(_0x504467){return new Promise(function(_0x1ac252,_0x273ffa){var _0x22e4b9=_[_0x17ee('0x57')](_0x10f7a8[_0x17ee('0x71')]);_0x1ac252({'count':_0x22e4b9[_0x17ee('0x53')],'rows':_0x22e4b9});});},'VoiceQueuesChannel':function(_0x278dff){var _0x44a5f3=this;return new Promise(function(_0x1dbfb0,_0x9ff7a5){var _0x22f9ee=schema(properties['voicequeuechannel'])[_0x17ee('0x5a')](_0x278dff);if(_0x22f9ee[_0x17ee('0x53')]>0x0){return _0x9ff7a5(_0x44a5f3[_0x17ee('0xe')](0x1f4,_[_0x17ee('0x5b')](_0x22f9ee,_0x17ee('0x16'))[_0x17ee('0x18')](',\x20')));}var _0x4c3af8=_[_0x17ee('0x54')](_0x10f7a8[_0x17ee('0x71')],{'uniqueid':_0x278dff['uniqueid']});if(_0x4c3af8){_0x1dbfb0(_0x4c3af8);}else{return _0x9ff7a5(_0x44a5f3[_0x17ee('0xe')](0x1f5,_0x17ee('0x70')));}});},'VoiceQueuesChannelHangup':function(_0x22ef0a){var _0x28c88f=this;return new Promise(function(_0xf0ddbf,_0x650ba4){if(ami['isConnected']()==![]){return _0x650ba4(_0x28c88f['error'](0x1f4,[config[_0x17ee('0xf')]['ip'],config['asterisk'][_0x17ee('0x10')],_0x17ee('0x17')]['join']('\x20')));}var _0x518cba=schema(properties[_0x17ee('0x72')])[_0x17ee('0x5a')](_0x22ef0a);if(_0x518cba[_0x17ee('0x53')]>0x0){return _0x650ba4(_0x28c88f['error'](0x1f4,_[_0x17ee('0x5b')](_0x518cba,_0x17ee('0x16'))[_0x17ee('0x18')](',\x20')));}var _0x45d316=_['find'](_0x10f7a8[_0x17ee('0x71')],{'uniqueid':_0x22ef0a[_0x17ee('0x5c')]});if(_0x45d316&&_0x45d316[_0x17ee('0x5d')]){return ami[_0x17ee('0x14')]({'action':_0x17ee('0x73'),'channel':_0x45d316[_0x17ee('0x5d')]})[_0x17ee('0x15')](function(_0x466ca3){_0xf0ddbf({'code':0xc8,'message':[_0x22ef0a[_0x17ee('0x5c')],_0x466ca3[_0x17ee('0x16')][_0x17ee('0x69')]()]['join']('\x20')});})[_0x17ee('0x68')](function(_0x98eabf){_0x650ba4(_0x28c88f[_0x17ee('0xe')](0x1f5,[_0x22ef0a[_0x17ee('0x5c')],_0x98eabf[_0x17ee('0x16')][_0x17ee('0x69')]()][_0x17ee('0x18')]('\x20')));});}else{return _0x650ba4(_0x28c88f['error'](0x1f5,_0x17ee('0x70')));}});},'VoiceQueuesChannelRedirect':function(_0x4157b8){var _0x2f08e0=this;return new Promise(function(_0x45b67c,_0x212fdf){if(ami[_0x17ee('0xd')]()==![]){return _0x212fdf(_0x2f08e0['error'](0x1f4,[config[_0x17ee('0xf')]['ip'],config[_0x17ee('0xf')][_0x17ee('0x10')],_0x17ee('0x17')][_0x17ee('0x18')]('\x20')));}var _0x3b8188=schema(properties['voicequeuechannelredirect'])[_0x17ee('0x5a')](_0x4157b8);if(_0x3b8188[_0x17ee('0x53')]>0x0){return _0x212fdf(_0x2f08e0[_0x17ee('0xe')](0x1f4,_[_0x17ee('0x5b')](_0x3b8188,_0x17ee('0x16'))[_0x17ee('0x18')](',\x20')));}var _0x3461e0=_[_0x17ee('0x54')](_0x10f7a8[_0x17ee('0x71')],{'uniqueid':_0x4157b8[_0x17ee('0x5c')]});if(_0x3461e0&&_0x3461e0[_0x17ee('0x5d')]){return ami[_0x17ee('0x14')]({'action':'Redirect','channel':_0x3461e0[_0x17ee('0x5d')],'exten':_0x4157b8[_0x17ee('0x74')],'context':_0x4157b8['context']||_0x3461e0[_0x17ee('0x75')],'priority':0x1})[_0x17ee('0x15')](function(_0x2e7317){_0x45b67c({'code':0xc8,'message':[_0x4157b8['uniqueid'],_0x2e7317[_0x17ee('0x16')][_0x17ee('0x69')]()][_0x17ee('0x18')]('\x20')});})[_0x17ee('0x68')](function(_0x1012b6){_0x212fdf(_0x2f08e0[_0x17ee('0xe')](0x1f5,[_0x4157b8[_0x17ee('0x5c')],_0x1012b6['message'][_0x17ee('0x69')]()][_0x17ee('0x18')]('\x20')));});}else{return _0x212fdf(_0x2f08e0[_0x17ee('0xe')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x40e04b){return new Promise(function(_0x188da2,_0x112351){var _0x2bbff6=_[_0x17ee('0x57')](_0x10f7a8['agents']);_0x188da2({'count':_0x2bbff6[_0x17ee('0x53')],'rows':_0x2bbff6});});},'Telephones':function(_0x572a43){return new Promise(function(_0xb1758c,_0xeeb388){var _0x3571a8=_[_0x17ee('0x57')](_0x10f7a8[_0x17ee('0x76')]);_0xb1758c({'count':_0x3571a8[_0x17ee('0x53')],'rows':_0x3571a8});});},'Trunks':function(_0x26ef1f){return new Promise(function(_0x550427,_0x65ecdb){var _0x3b9a31=_[_0x17ee('0x57')](_0x10f7a8[_0x17ee('0x77')]);_0x550427({'count':_0x3b9a31[_0x17ee('0x53')],'rows':_0x3b9a31});});},'OutboundChannels':function(_0x520872){return new Promise(function(_0x3e4786,_0x33b399){var _0x509613=_[_0x17ee('0x57')](_0x10f7a8[_0x17ee('0x78')]);_0x3e4786({'count':_0x509613[_0x17ee('0x53')],'rows':_0x509613});});},'Outbound':function(_0xf55cbb){return new Promise(function(_0x564a2e,_0x4c1d3f){_0x564a2e(_0x10f7a8['outbound']);});},'Campaigns':function(_0x22faec){return new Promise(function(_0x23f84c,_0x3da8cd){var _0x75bf67=_[_0x17ee('0x57')](_0x10f7a8[_0x17ee('0x79')]);_0x23f84c({'count':_0x75bf67['length'],'rows':_0x75bf67});});},'VoiceQueuesPreview':function(_0x2ed610){var _0x24793f=this;return new Promise(function(_0x8706cc,_0x1bd6cb){_0x2f9ebc[_0x17ee('0x7a')](_0x2ed610['id'])[_0x17ee('0x15')](function(_0x3bfa6d){_0x8706cc({'code':0xc8,'message':_0x3bfa6d[_0x17ee('0x16')]});})[_0x17ee('0x68')](function(_0x5b7387){_0x1bd6cb(_0x24793f[_0x17ee('0xe')](0x1f4,_0x5b7387[_0x17ee('0x16')]));});});},'EventManager':function(_0x39220a){var _0x52ef66=this;return new Promise(function(_0x50a81c,_0x1b57d4){if(!_0x39220a[_0x17ee('0x7b')]){return _0x1b57d4(_0x52ef66[_0x17ee('0xe')](0x1f4,_0x17ee('0x7c')));}ami[_0x17ee('0x7d')]('custom:'+_0x39220a[_0x17ee('0x7b')],_0x39220a[_0x17ee('0x16')]);_0x50a81c({'code':0xc8,'message':_0x39220a});});},'FaxAccounts':function(_0x1cdc32){return new Promise(function(_0x2e6906,_0x633b58){var _0x2bdf47=_[_0x17ee('0x57')](_0x10f7a8[_0x17ee('0x7e')]);_0x2e6906({'count':_0x2bdf47[_0x17ee('0x53')],'rows':_0x2bdf47});});},'SendFax':function(_0x4a95de){var _0x350fd5=this;return new Promise(function(_0x50daad,_0x3801b6){_0x5c0617[_0x17ee('0x7f')](_0x4a95de)['then'](function(_0x910850){_0x50daad({'code':0xc8,'message':_0x910850[_0x17ee('0x16')]});})['catch'](function(_0x2aaae6){_0x3801b6(_0x350fd5['error'](0x1f4,_0x2aaae6[_0x17ee('0x16')]));});});},'CheckAfterSend':function(_0x27dc3e){var _0x2e708b=this;return new Promise(function(_0xe069b0,_0x4cbb59){_0x5c0617[_0x17ee('0x80')](_0x27dc3e)[_0x17ee('0x15')](function(_0x36be47){_0xe069b0({'code':0xc8,'message':_0x36be47['message']});})[_0x17ee('0x68')](function(_0x5a4664){_0x4cbb59(_0x2e708b[_0x17ee('0xe')](0x1f4,_0x5a4664[_0x17ee('0x16')]));});});}};var _0xe749d7=jayson[_0x17ee('0x81')](_0x54b4f6)['http']();_0xe749d7['on'](_0x17ee('0xe'),function(_0x405dc5){return _0x29b9eb(_0x405dc5);});_0xe749d7[_0x17ee('0x5')](0x232a,_0x17ee('0x82'),function(){console[_0x17ee('0x83')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x52b1db(_0x17ee('0x84')+0x232a);});});}; \ No newline at end of file +var _0x57ca=['timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','keys','module','action','Action','message','catch','pick','command','Command','then','content','voiceQueues','hasOwnProperty','name','strategy','answered','loggedIn','sumDuration','sumHoldTime','total','type','unmanaged','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangBusyFactor','startPredictive','Trunk','active','callerid','Interval','length','omit','undefined','values','channels','voicechannel','validate','map','format','%s.%s','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','push','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','rec','uniqueid','MixMonitor\x20Success','find','channel','StopMixMonitor','destinationchannel','filename','stop','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','Redirect','exten','context','telephones','outbound','event','Event\x20name\x20mandatory','custom:','faxAccounts','checkAfterSend','server','http','listen','127.0.0.1','log','RPC\x20listening\x20on\x20port:','util','jayson/promise','bluebird','moment','../../../config/environment','../properties','../ami','%s/%s','SIP','timers'];(function(_0x431d1a,_0x575b1c){var _0x198ea6=function(_0x593edb){while(--_0x593edb){_0x431d1a['push'](_0x431d1a['shift']());}};_0x198ea6(++_0x575b1c);}(_0x57ca,0x108));var _0xa57c=function(_0xbe718b,_0x547e99){_0xbe718b=_0xbe718b-0x0;var _0x42f90d=_0x57ca[_0xbe718b];return _0x42f90d;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var jayson=require(_0xa57c('0x1'));var schema=require('validate');var BPromise=require(_0xa57c('0x2'));var moment=require(_0xa57c('0x3'));var config=require(_0xa57c('0x4'));var properties=require(_0xa57c('0x5'));var ami=require(_0xa57c('0x6'));exports['listen']=function(_0x40ba22,_0x1c3e31,_0x113dcf){return new BPromise(function(_0x19473f,_0xbdfffb){var _0x314574={'QueuePause':function(_0x19e28e){return new Promise(function(_0x271ccc,_0x5e3962){var _0x13dad8=util['format'](_0xa57c('0x7'),_0xa57c('0x8'),_0x19e28e['name']);if(_0x40ba22[_0xa57c('0x9')]&&_0x40ba22['timers'][_0x13dad8]&&_0x40ba22[_0xa57c('0x9')][_0x13dad8][_0xa57c('0xa')]){_0x40ba22['timers'][_0x13dad8][_0xa57c('0xb')]();}if(_0x40ba22['agents'][_0x13dad8]){_0x40ba22[_0xa57c('0xc')][_0x13dad8][_0xa57c('0xd')]({'statePause':_0x19e28e[_0xa57c('0xe')]?!![]:![]});}_0x271ccc({'code':0xc8,'message':_0xa57c('0xf')});});},'Reload':function(_0x205e72){var _0x57a546=this;return new Promise(function(_0x2644a1,_0x546cde){if(ami[_0xa57c('0x10')]()==![]){return _0x546cde(_0x57a546[_0xa57c('0x11')](0x1f4,[config[_0xa57c('0x12')]['ip'],config[_0xa57c('0x12')][_0xa57c('0x13')],_0xa57c('0x14')][_0xa57c('0x15')]('\x20')));}_0x205e72=_['pick'](_0x205e72,_[_0xa57c('0x16')](properties[_0xa57c('0x17')]));_0x205e72[_0xa57c('0x18')]='Reload';return ami[_0xa57c('0x19')](_0x205e72)['then'](function(_0x3e7afa){_0x2644a1({'code':0xc8,'message':_0x3e7afa[_0xa57c('0x1a')]});})[_0xa57c('0x1b')](function(_0xe3d505){_0x546cde(_0x57a546[_0xa57c('0x11')](0x1f5,_0xe3d505[_0xa57c('0x1a')]));});});},'Command':function(_0x6f3f89){var _0x595c7a=this;return new Promise(function(_0x4e4399,_0x8a8856){if(ami['isConnected']()==![]){return _0x8a8856(_0x595c7a['error'](0x1f4,[config[_0xa57c('0x12')]['ip'],config[_0xa57c('0x12')][_0xa57c('0x13')],_0xa57c('0x14')]['join']('\x20')));}_0x6f3f89=_[_0xa57c('0x1c')](_0x6f3f89,_0xa57c('0x1d'));_0x6f3f89[_0xa57c('0x18')]=_0xa57c('0x1e');return ami[_0xa57c('0x19')](_0x6f3f89)[_0xa57c('0x1f')](function(_0x1e0192){_0x4e4399({'code':0xc8,'message':_0x1e0192[_0xa57c('0x20')]});})[_0xa57c('0x1b')](function(_0xdf65dd){_0x8a8856(_0x595c7a[_0xa57c('0x11')](0x1f5,_0xdf65dd[_0xa57c('0x1a')]));});});},'VoiceQueues':function(_0x241dcc){return new Promise(function(_0x10a33d,_0x431bec){var _0x511a26=[];for(var _0x2db443 in _0x40ba22[_0xa57c('0x21')]){if(_0x40ba22[_0xa57c('0x21')][_0xa57c('0x22')](_0x2db443)){var _0x315ad7=_0x40ba22[_0xa57c('0x21')][_0x2db443];var _0x8ee1c0={'id':_0x315ad7['id'],'name':_0x315ad7[_0xa57c('0x23')],'strategy':_0x315ad7[_0xa57c('0x24')],'answered':_0x315ad7[_0xa57c('0x25')],'available':_0x315ad7['available'],'loggedIn':_0x315ad7[_0xa57c('0x26')],'pTalking':_0x315ad7['pTalking'],'sumBillable':_0x315ad7['sumBillable'],'sumDuration':_0x315ad7[_0xa57c('0x27')],'sumHoldTime':_0x315ad7[_0xa57c('0x28')]||0x0,'talking':_0x315ad7['talking'],'total':_0x315ad7[_0xa57c('0x29')],'type':_0x315ad7[_0xa57c('0x2a')],'unmanaged':_0x315ad7[_0xa57c('0x2b')],'abandoned':_0x315ad7['abandoned'],'waiting':_0x315ad7[_0xa57c('0x2c')],'loggedInDb':_0x315ad7['loggedInDb']};if(_0x315ad7[_0xa57c('0x2a')]==='outbound'){_0x8ee1c0[_0xa57c('0x2d')]=_0x315ad7['dialActive'];_0x8ee1c0[_0xa57c('0x2e')]=_0x315ad7['dialMethod'];_0x8ee1c0[_0xa57c('0x2f')]=_0x315ad7[_0xa57c('0x2f')];_0x8ee1c0[_0xa57c('0x30')]=_0x315ad7[_0xa57c('0x30')];_0x8ee1c0[_0xa57c('0x31')]=_0x315ad7[_0xa57c('0x31')];_0x8ee1c0[_0xa57c('0x32')]=_0x315ad7['dialPrefix'];_0x8ee1c0[_0xa57c('0x33')]=_0x315ad7['temp'];_0x8ee1c0[_0xa57c('0x34')]=_0x315ad7[_0xa57c('0x34')];_0x8ee1c0[_0xa57c('0x35')]=_0x315ad7['outboundAnswerCallsDay'];_0x8ee1c0[_0xa57c('0x36')]=_0x315ad7['outboundBlacklistCallsDay'];_0x8ee1c0[_0xa57c('0x37')]=_0x315ad7['outboundBusyCallsDay'];_0x8ee1c0[_0xa57c('0x38')]=_0x315ad7['outboundCongestionCallsDay'];_0x8ee1c0[_0xa57c('0x39')]=_0x315ad7[_0xa57c('0x39')];_0x8ee1c0['outboundDropCallsDayCallersExit']=_0x315ad7[_0xa57c('0x3a')];_0x8ee1c0['outboundDropCallsDayTimeout']=_0x315ad7[_0xa57c('0x3b')];_0x8ee1c0['outboundNoAnswerCallsDay']=_0x315ad7[_0xa57c('0x3c')];_0x8ee1c0[_0xa57c('0x3d')]=_0x315ad7[_0xa57c('0x3d')];_0x8ee1c0[_0xa57c('0x3e')]=_0x315ad7[_0xa57c('0x3e')];_0x8ee1c0[_0xa57c('0x3f')]=_0x315ad7['outboundReCallsDay'];_0x8ee1c0['outboundRejectCallsDay']=_0x315ad7[_0xa57c('0x40')];_0x8ee1c0[_0xa57c('0x41')]=_0x315ad7[_0xa57c('0x41')];_0x8ee1c0['predictiveIntervalAnsweredCalls']=_0x315ad7[_0xa57c('0x42')];_0x8ee1c0['predictiveIntervalAvgHoldtime']=_0x315ad7[_0xa57c('0x43')];_0x8ee1c0[_0xa57c('0x44')]=_0x315ad7['predictiveIntervalAvgTalktime'];_0x8ee1c0['predictiveIntervalDroppedCallsCallersExit']=_0x315ad7['predictiveIntervalDroppedCallsCallersExit'];_0x8ee1c0[_0xa57c('0x45')]=_0x315ad7[_0xa57c('0x45')];_0x8ee1c0[_0xa57c('0x46')]=_0x315ad7[_0xa57c('0x46')];_0x8ee1c0[_0xa57c('0x47')]=_0x315ad7[_0xa57c('0x47')];_0x8ee1c0['predictiveIntervalHitRate']=_0x315ad7[_0xa57c('0x48')];_0x8ee1c0[_0xa57c('0x49')]=_0x315ad7['predictiveIntervalMultiplicativeFactor'];_0x8ee1c0['predictiveIntervalPauses']=_0x315ad7[_0xa57c('0x4a')];_0x8ee1c0[_0xa57c('0x4b')]=_0x315ad7['predictiveIntervalAvailable'];_0x8ee1c0[_0xa57c('0x4c')]=_0x315ad7[_0xa57c('0x4c')];_0x8ee1c0[_0xa57c('0x1a')]=_0x315ad7[_0xa57c('0x1a')];_0x8ee1c0[_0xa57c('0x4d')]=_0x315ad7[_0xa57c('0x4d')];_0x8ee1c0['erlangCalls']=_0x315ad7[_0xa57c('0x4e')];_0x8ee1c0['erlangCallToSecond']=_0x315ad7['erlangCallToSecond'];_0x8ee1c0['erlangAbandonmentRate']=_0x315ad7['erlangAbandonmentRate'];_0x8ee1c0['erlangBusyFactor']=_0x315ad7[_0xa57c('0x4f')];_0x8ee1c0[_0xa57c('0x50')]=_0x315ad7[_0xa57c('0x50')];_0x8ee1c0['startProgressive']=_0x315ad7['startProgressive'];}if(_0x315ad7['Trunk']){_0x8ee1c0[_0xa57c('0x51')]={'id':_0x315ad7[_0xa57c('0x51')]['id'],'name':_0x315ad7[_0xa57c('0x51')][_0xa57c('0x23')],'active':_0x315ad7[_0xa57c('0x51')][_0xa57c('0x52')],'callerid':_0x315ad7['Trunk'][_0xa57c('0x53')]};}if(_0x315ad7[_0xa57c('0x54')]){_0x8ee1c0[_0xa57c('0x54')]={'id':_0x315ad7[_0xa57c('0x54')]['id'],'name':_0x315ad7[_0xa57c('0x54')][_0xa57c('0x23')]};}_0x511a26['push'](_0x8ee1c0);}}_0x10a33d({'count':_0x511a26[_0xa57c('0x55')],'rows':_0x511a26});});},'UpdateVoiceQueue':function(_0xcf1c29){return new Promise(function(_0xa3ff0,_0x14e943){var _0x269dfd=_['find'](_0x40ba22[_0xa57c('0x21')],{'id':parseInt(_0xcf1c29['id'])});var _0x13ede7=_[_0xa57c('0x56')](_0xcf1c29,['id']);if(_0x269dfd){for(var _0x17aae4 in _0x13ede7){if(typeof _0x13ede7[_0x17aae4]!==_0xa57c('0x57')&&typeof _0x269dfd[_0x17aae4]!==_0xa57c('0x57')){_0x269dfd[_0x17aae4]=_0x13ede7[_0x17aae4];}}_0xa3ff0(_0x269dfd);}else{_0x14e943();}});},'VoiceChannels':function(_0x5e155a){return new Promise(function(_0xedd288,_0x3bafba){var _0x247906=_[_0xa57c('0x58')](_0x40ba22[_0xa57c('0x59')]);_0xedd288({'count':_0x247906[_0xa57c('0x55')],'rows':_0x247906});});},'VoiceChannelMixMonitor':function(_0x57533e){var _0x516461=this;return new Promise(function(_0x578436,_0x5082ef){if(ami[_0xa57c('0x10')]()==![]){return _0x5082ef(_0x516461['error'](0x1f4,[config[_0xa57c('0x12')]['ip'],config[_0xa57c('0x12')]['username'],_0xa57c('0x14')][_0xa57c('0x15')]('\x20')));}var _0x368e87=schema(properties[_0xa57c('0x5a')])[_0xa57c('0x5b')](_0x57533e);if(_0x368e87['length']>0x0){return _0x5082ef(_0x516461[_0xa57c('0x11')](0x1f4,_[_0xa57c('0x5c')](_0x368e87,_0xa57c('0x1a'))[_0xa57c('0x15')](',\x20')));}var _0x2e4b84=_['find'](_0x40ba22[_0xa57c('0x59')],{'uniqueid':_0x57533e['uniqueid']});if(_0x2e4b84&&_0x2e4b84['channel']){var _0x464233=util[_0xa57c('0x5d')](_0xa57c('0x5e'),_0x57533e['filename']||_0x57533e['uniqueid'],_0x57533e[_0xa57c('0x5d')]||_0xa57c('0x5f'));return ami[_0xa57c('0x19')]({'action':_0xa57c('0x60'),'channel':_0x2e4b84['channel'],'file':_0x464233,'options':_0xa57c('0x61')})[_0xa57c('0x1f')](function(_0xe8c63e){var _0x59eadc=_['find'](_0x2e4b84[_0xa57c('0x62')],{'filename':_0xa57c('0x63')+_0x464233['toLowerCase']()});if(_[_0xa57c('0x64')](_0x59eadc)){_0x2e4b84[_0xa57c('0x62')][_0xa57c('0x65')]({'filename':_0xa57c('0x63')+_0x464233[_0xa57c('0x66')](),'createdAt':moment()[_0xa57c('0x5d')](_0xa57c('0x67')),'mixmonitorid':_0xe8c63e['mixmonitorid'],'status':'rec'});}else{_0x59eadc[_0xa57c('0x68')]=_0xe8c63e[_0xa57c('0x68')];_0x59eadc[_0xa57c('0x69')]=_0xa57c('0x6a');}_0x578436({'code':0xc8,'message':[_0x57533e[_0xa57c('0x6b')],_0xa57c('0x6c'),_0xe8c63e[_0xa57c('0x68')]][_0xa57c('0x15')]('\x20'),'mixmonitorid':_0xe8c63e['mixmonitorid']});})['catch'](function(_0x28997e){_0x5082ef(_0x516461['error'](0x1f5,[_0x57533e[_0xa57c('0x6b')],_0x28997e[_0xa57c('0x1a')][_0xa57c('0x66')]()]['join']('\x20')));});}else{return _0x5082ef(_0x516461[_0xa57c('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x21b00a){var _0x4b3416=this;return new Promise(function(_0x39484d,_0x170187){if(ami[_0xa57c('0x10')]()==![]){return _0x170187(_0x4b3416[_0xa57c('0x11')](0x1f4,[config['asterisk']['ip'],config[_0xa57c('0x12')][_0xa57c('0x13')],_0xa57c('0x14')][_0xa57c('0x15')]('\x20')));}var _0x3345d5=schema(properties['voicechannel'])[_0xa57c('0x5b')](_0x21b00a);if(_0x3345d5[_0xa57c('0x55')]>0x0){return _0x170187(_0x4b3416[_0xa57c('0x11')](0x1f4,_[_0xa57c('0x5c')](_0x3345d5,_0xa57c('0x1a'))[_0xa57c('0x15')](',\x20')));}var _0x143ec3=_[_0xa57c('0x6d')](_0x40ba22[_0xa57c('0x59')],{'uniqueid':_0x21b00a[_0xa57c('0x6b')]});if(_0x143ec3){return BPromise['resolve']()[_0xa57c('0x1f')](function(){if(_0x143ec3[_0xa57c('0x6e')]){return ami[_0xa57c('0x19')]({'action':_0xa57c('0x6f'),'channel':_0x143ec3[_0xa57c('0x6e')],'mixmonitorid':_0x21b00a[_0xa57c('0x68')]})['catch'](function(_0x30390f){});}})[_0xa57c('0x1f')](function(){if(_0x143ec3['destinationchannel']){return ami[_0xa57c('0x19')]({'action':_0xa57c('0x6f'),'channel':_0x143ec3[_0xa57c('0x70')],'mixmonitorid':_0x21b00a[_0xa57c('0x68')]})[_0xa57c('0x1b')](function(_0x255cef){});}})[_0xa57c('0x1f')](function(_0x5e1103){var _0xaa82e1=_['find'](_0x143ec3[_0xa57c('0x62')],{'mixmonitorid':_0x21b00a['mixmonitorid']});if(_0xaa82e1){_0xaa82e1[_0xa57c('0x69')]='stop';}})[_0xa57c('0x1f')](function(){var _0x2acf1b=util['format'](_0xa57c('0x5e'),_0x21b00a[_0xa57c('0x71')]||_0x21b00a[_0xa57c('0x6b')],_0x21b00a[_0xa57c('0x5d')]||'wav');var _0x3a3983=_[_0xa57c('0x6d')](_0x143ec3[_0xa57c('0x62')],{'filename':_0xa57c('0x63')+_0x2acf1b[_0xa57c('0x66')]()});if(_0x3a3983){_0x3a3983[_0xa57c('0x69')]=_0xa57c('0x72');}})[_0xa57c('0x1f')](function(){_0x39484d({'code':0xc8,'message':[_0x21b00a[_0xa57c('0x6b')],_0xa57c('0x73')][_0xa57c('0x15')]('\x20')});})[_0xa57c('0x1b')](function(_0x27ab1b){_0x170187(_0x4b3416[_0xa57c('0x11')](0x1f5,[_0x21b00a[_0xa57c('0x6b')],_0x27ab1b[_0xa57c('0x1a')]['toLowerCase']()][_0xa57c('0x15')]('\x20')));});}else{return _0x170187(_0x4b3416['error'](0x1f5,_0xa57c('0x74')));}});},'VoiceQueuesChannels':function(_0x24b09a){return new Promise(function(_0x245238,_0x526c59){var _0x4176b3=_[_0xa57c('0x58')](_0x40ba22[_0xa57c('0x75')]);_0x245238({'count':_0x4176b3['length'],'rows':_0x4176b3});});},'VoiceQueuesChannel':function(_0x571e10){var _0x20ff5f=this;return new Promise(function(_0x39aa65,_0x7d073e){var _0x35a169=schema(properties[_0xa57c('0x76')])[_0xa57c('0x5b')](_0x571e10);if(_0x35a169[_0xa57c('0x55')]>0x0){return _0x7d073e(_0x20ff5f[_0xa57c('0x11')](0x1f4,_[_0xa57c('0x5c')](_0x35a169,'message')[_0xa57c('0x15')](',\x20')));}var _0x29951e=_['find'](_0x40ba22[_0xa57c('0x75')],{'uniqueid':_0x571e10[_0xa57c('0x6b')]});if(_0x29951e){_0x39aa65(_0x29951e);}else{return _0x7d073e(_0x20ff5f[_0xa57c('0x11')](0x1f5,_0xa57c('0x74')));}});},'VoiceQueuesChannelHangup':function(_0x1bb561){var _0x28ec46=this;return new Promise(function(_0x42763b,_0x10616e){if(ami['isConnected']()==![]){return _0x10616e(_0x28ec46[_0xa57c('0x11')](0x1f4,[config[_0xa57c('0x12')]['ip'],config['asterisk'][_0xa57c('0x13')],_0xa57c('0x14')]['join']('\x20')));}var _0x538f77=schema(properties[_0xa57c('0x77')])[_0xa57c('0x5b')](_0x1bb561);if(_0x538f77[_0xa57c('0x55')]>0x0){return _0x10616e(_0x28ec46[_0xa57c('0x11')](0x1f4,_[_0xa57c('0x5c')](_0x538f77,'message')[_0xa57c('0x15')](',\x20')));}var _0x3eb9ba=_[_0xa57c('0x6d')](_0x40ba22['queueChannels'],{'uniqueid':_0x1bb561[_0xa57c('0x6b')]});if(_0x3eb9ba&&_0x3eb9ba['channel']){return ami[_0xa57c('0x19')]({'action':_0xa57c('0x78'),'channel':_0x3eb9ba[_0xa57c('0x6e')]})[_0xa57c('0x1f')](function(_0x4cf28c){_0x42763b({'code':0xc8,'message':[_0x1bb561[_0xa57c('0x6b')],_0x4cf28c[_0xa57c('0x1a')][_0xa57c('0x66')]()][_0xa57c('0x15')]('\x20')});})['catch'](function(_0x435065){_0x10616e(_0x28ec46[_0xa57c('0x11')](0x1f5,[_0x1bb561[_0xa57c('0x6b')],_0x435065['message'][_0xa57c('0x66')]()][_0xa57c('0x15')]('\x20')));});}else{return _0x10616e(_0x28ec46[_0xa57c('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3ea950){var _0xf17d02=this;return new Promise(function(_0x32870a,_0x173f16){if(ami['isConnected']()==![]){return _0x173f16(_0xf17d02[_0xa57c('0x11')](0x1f4,[config[_0xa57c('0x12')]['ip'],config['asterisk'][_0xa57c('0x13')],_0xa57c('0x14')]['join']('\x20')));}var _0x29a4e0=schema(properties['voicequeuechannelredirect'])[_0xa57c('0x5b')](_0x3ea950);if(_0x29a4e0[_0xa57c('0x55')]>0x0){return _0x173f16(_0xf17d02[_0xa57c('0x11')](0x1f4,_[_0xa57c('0x5c')](_0x29a4e0,'message')[_0xa57c('0x15')](',\x20')));}var _0x2288c2=_[_0xa57c('0x6d')](_0x40ba22[_0xa57c('0x75')],{'uniqueid':_0x3ea950[_0xa57c('0x6b')]});if(_0x2288c2&&_0x2288c2[_0xa57c('0x6e')]){return ami[_0xa57c('0x19')]({'action':_0xa57c('0x79'),'channel':_0x2288c2[_0xa57c('0x6e')],'exten':_0x3ea950[_0xa57c('0x7a')],'context':_0x3ea950[_0xa57c('0x7b')]||_0x2288c2['context'],'priority':0x1})['then'](function(_0x5c65ab){_0x32870a({'code':0xc8,'message':[_0x3ea950[_0xa57c('0x6b')],_0x5c65ab['message'][_0xa57c('0x66')]()][_0xa57c('0x15')]('\x20')});})[_0xa57c('0x1b')](function(_0x4c543a){_0x173f16(_0xf17d02[_0xa57c('0x11')](0x1f5,[_0x3ea950[_0xa57c('0x6b')],_0x4c543a[_0xa57c('0x1a')][_0xa57c('0x66')]()][_0xa57c('0x15')]('\x20')));});}else{return _0x173f16(_0xf17d02[_0xa57c('0x11')](0x1f5,_0xa57c('0x74')));}});},'Agents':function(_0x4db5ca){return new Promise(function(_0xcebd5e,_0x257c98){var _0x4cd2d3=_['values'](_0x40ba22[_0xa57c('0xc')]);_0xcebd5e({'count':_0x4cd2d3[_0xa57c('0x55')],'rows':_0x4cd2d3});});},'Telephones':function(_0x4fc97e){return new Promise(function(_0x4edd10,_0xc5f17e){var _0x4962ae=_[_0xa57c('0x58')](_0x40ba22[_0xa57c('0x7c')]);_0x4edd10({'count':_0x4962ae['length'],'rows':_0x4962ae});});},'Trunks':function(_0x1cda66){return new Promise(function(_0x1706f1,_0x44558f){var _0x3df8f5=_[_0xa57c('0x58')](_0x40ba22['trunks']);_0x1706f1({'count':_0x3df8f5[_0xa57c('0x55')],'rows':_0x3df8f5});});},'OutboundChannels':function(_0x4f7260){return new Promise(function(_0x30838d,_0x1ec4d3){var _0x4a2b64=_['values'](_0x40ba22['outboundChannels']);_0x30838d({'count':_0x4a2b64[_0xa57c('0x55')],'rows':_0x4a2b64});});},'Outbound':function(_0x500014){return new Promise(function(_0x502309,_0x175253){_0x502309(_0x40ba22[_0xa57c('0x7d')]);});},'Campaigns':function(_0x3f44c6){return new Promise(function(_0x49d03b,_0x3d360a){var _0x1f28e9=_[_0xa57c('0x58')](_0x40ba22['campaigns']);_0x49d03b({'count':_0x1f28e9['length'],'rows':_0x1f28e9});});},'VoiceQueuesPreview':function(_0x19f190){var _0x5079ce=this;return new Promise(function(_0x377a8b,_0x41d535){_0x1c3e31['run'](_0x19f190['id'])[_0xa57c('0x1f')](function(_0x55261e){_0x377a8b({'code':0xc8,'message':_0x55261e['message']});})['catch'](function(_0x6825df){_0x41d535(_0x5079ce['error'](0x1f4,_0x6825df['message']));});});},'EventManager':function(_0x542194){var _0x3e12e5=this;return new Promise(function(_0x23c39b,_0x54feaa){if(!_0x542194[_0xa57c('0x7e')]){return _0x54feaa(_0x3e12e5[_0xa57c('0x11')](0x1f4,_0xa57c('0x7f')));}ami['emit'](_0xa57c('0x80')+_0x542194[_0xa57c('0x7e')],_0x542194[_0xa57c('0x1a')]);_0x23c39b({'code':0xc8,'message':_0x542194});});},'FaxAccounts':function(_0x16b727){return new Promise(function(_0x54bf3d,_0x5e0db8){var _0x8391f9=_['values'](_0x40ba22[_0xa57c('0x81')]);_0x54bf3d({'count':_0x8391f9[_0xa57c('0x55')],'rows':_0x8391f9});});},'SendFax':function(_0x2cc12b){var _0x4dc6ac=this;return new Promise(function(_0x138c4e,_0x513f24){_0x113dcf['send'](_0x2cc12b)[_0xa57c('0x1f')](function(_0x58b935){_0x138c4e({'code':0xc8,'message':_0x58b935[_0xa57c('0x1a')]});})[_0xa57c('0x1b')](function(_0x536e87){_0x513f24(_0x4dc6ac['error'](0x1f4,_0x536e87[_0xa57c('0x1a')]));});});},'CheckAfterSend':function(_0x3142d1){var _0x50a940=this;return new Promise(function(_0x4f3c79,_0x2550bc){_0x113dcf[_0xa57c('0x82')](_0x3142d1)[_0xa57c('0x1f')](function(_0x5e8487){_0x4f3c79({'code':0xc8,'message':_0x5e8487[_0xa57c('0x1a')]});})[_0xa57c('0x1b')](function(_0xb51336){_0x2550bc(_0x50a940[_0xa57c('0x11')](0x1f4,_0xb51336[_0xa57c('0x1a')]));});});}};var _0x1f0c78=jayson[_0xa57c('0x83')](_0x314574)[_0xa57c('0x84')]();_0x1f0c78['on'](_0xa57c('0x11'),function(_0x75888e){return _0xbdfffb(_0x75888e);});_0x1f0c78[_0xa57c('0x85')](0x232a,_0xa57c('0x86'),function(){console[_0xa57c('0x87')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x19473f(_0xa57c('0x88')+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 946216f..3e96367 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 _0xbec5=['fax','scheduledAt','union','resolve','then','getContacts','length','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridnum','destcalleridnum','calleridname','','Unknown','destcalleridname','createContact','[CM][%s][%s]\x20Autocreate\x20disabled','push','user:%s','name','trigger:%s','toLowerCase','merge','lodash','bluebird','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','defaults','redis','localhost','info','[CM][%s][%s]','emit','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','map','routeId','firstName','phone','mobile'];(function(_0x5a4744,_0x2310bd){var _0x41f496=function(_0x2e3814){while(--_0x2e3814){_0x5a4744['push'](_0x5a4744['shift']());}};_0x41f496(++_0x2310bd);}(_0xbec5,0xe5));var _0x5bec=function(_0x3452a8,_0x4bfaa4){_0x3452a8=_0x3452a8-0x0;var _0x233814=_0xbec5[_0x3452a8];return _0x233814;};'use strict';var _=require(_0x5bec('0x0'));var BPromise=require(_0x5bec('0x1'));var Redis=require('ioredis');var util=require(_0x5bec('0x2'));var config=require(_0x5bec('0x3'));var logger=require(_0x5bec('0x4'))(_0x5bec('0x5'));var cmContactRpc=require(_0x5bec('0x6'));config['redis']=_[_0x5bec('0x7')](config[_0x5bec('0x8')],{'host':_0x5bec('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5bec('0x8')]));function emit(_0x28a427,_0x38456e,_0x406e65,_0x43d96e,_0x302aae){logger[_0x5bec('0xa')](_0x5bec('0xb'),_0x28a427,_0x38456e['id'],_0x406e65,_0x43d96e,JSON['stringify'](_0x302aae));io['to'](_0x406e65)[_0x5bec('0xc')](_0x43d96e,_0x302aae);}exports['exec']=function(_0x748f75,_0x2a70a7,_0x117162,_0x4a5482){var _0x288d1b,_0x18fa47;var _0x16226b={};var _0x57ffc4=Number(_0x117162[_0x5bec('0xd')]);var _0x1c888f=_0x117162['data2']?Boolean(Number(_0x117162[_0x5bec('0xe')])):![];var _0xaa984d;var _0x35393a=![];if(!_[_0x5bec('0xf')](_0x117162[_0x5bec('0x10')])){if(_0x117162[_0x5bec('0x10')]=='1')_0x35393a=!![];}if(!_0x35393a){if(_0x4a5482[_0x5bec('0x11')]){_0x16226b['id']=_0x4a5482[_0x5bec('0x11')];}}if(!_0x16226b['id']){_0x16226b[_0x5bec('0x12')]=_0x57ffc4;_0xaa984d=_0x117162[_0x5bec('0x13')]&&_0x117162[_0x5bec('0x13')]!=='0'?_0x117162[_0x5bec('0x13')][_0x5bec('0x14')](','):['phone'];_0x16226b['$or']=_[_0x5bec('0x15')](_0xaa984d,function(_0x773740){var _0x31ad9c={};_0x31ad9c[_0x773740]=_0x4a5482[_0x5bec('0x16')]?_0x4a5482['destcalleridnum']:_0x4a5482['calleridnum'];return _0x31ad9c;});}var _0x3cd354=['id',_0x5bec('0x17'),'lastName',_0x5bec('0x18'),_0x5bec('0x19'),_0x5bec('0x1a'),_0x5bec('0x12'),'createdAt',_0x5bec('0x1b'),'updatedAt'];var _0x191c0f=_[_0x5bec('0x1c')](_0x3cd354,_0xaa984d);BPromise[_0x5bec('0x1d')]()[_0x5bec('0x1e')](cmContactRpc[_0x5bec('0x1f')]({'attributes':_0x191c0f,'where':_0x16226b}))['then'](function(_0x232584){_0x18fa47=_0x232584;if(!_['isEmpty'](_0x18fa47)){if(_0x18fa47[_0x5bec('0x20')]===0x1){_0x288d1b=_0x18fa47[0x0];logger[_0x5bec('0xa')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x4a5482[_0x5bec('0x21')],_0x2a70a7['id'],_0x288d1b['id']);}else{logger[_0x5bec('0xa')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x4a5482[_0x5bec('0x21')],_0x2a70a7['id'],_[_0x5bec('0x15')](_0x18fa47,'id')[_0x5bec('0x22')](','));}return;}else{logger[_0x5bec('0xa')](_0x5bec('0x23'),_0x4a5482[_0x5bec('0x21')],_0x2a70a7['id']);var _0x2dc014={'ListId':_0x57ffc4};var _0x4de66a=_0x117162['data4']&&_0x117162['data4']!=='0'?_0x117162[_0x5bec('0x24')]:_0x5bec('0x18');if(_0x1c888f){logger[_0x5bec('0xa')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x4a5482[_0x5bec('0x21')],_0x2a70a7['id']);_0x2dc014[_0x4de66a]=_[_0x5bec('0xf')](_0x4a5482['routeId'])?_0x4a5482[_0x5bec('0x25')]:_0x4a5482[_0x5bec('0x26')];if(_['isNil'](_0x4a5482['routeId'])){_0x2dc014[_0x5bec('0x17')]=_0x4a5482[_0x5bec('0x27')]&&_0x4a5482[_0x5bec('0x27')]!==_0x5bec('0x28')?_0x4a5482[_0x5bec('0x27')]:_0x5bec('0x29');}else{_0x2dc014['firstName']=_0x4a5482[_0x5bec('0x2a')]&&_0x4a5482['destcalleridname']!==_0x5bec('0x28')?_0x4a5482[_0x5bec('0x2a')]:_0x5bec('0x29');}return BPromise[_0x5bec('0x1d')]()['then'](cmContactRpc[_0x5bec('0x2b')](_0x2dc014))[_0x5bec('0x1e')](function(_0xfc7d41){_0x288d1b=_0xfc7d41;_0x18fa47['push'](_0xfc7d41);if(_0x288d1b){logger[_0x5bec('0xa')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x4a5482[_0x5bec('0x21')],_0x2a70a7['id'],_0x288d1b['id']);}return;});}else{logger[_0x5bec('0xa')](_0x5bec('0x2c'),_0x4a5482['uniqueid'],_0x2a70a7['id']);_0x2dc014[_0x4de66a]=_[_0x5bec('0xf')](_0x4a5482[_0x5bec('0x16')])?_0x4a5482['calleridnum']:_0x4a5482[_0x5bec('0x26')];if(_[_0x5bec('0xf')](_0x4a5482[_0x5bec('0x16')])){_0x2dc014[_0x5bec('0x17')]=_0x4a5482[_0x5bec('0x27')]&&_0x4a5482['calleridname']!==_0x5bec('0x28')?_0x4a5482['calleridname']:_0x5bec('0x29');}else{_0x2dc014[_0x5bec('0x17')]=_0x4a5482[_0x5bec('0x2a')]&&_0x4a5482[_0x5bec('0x2a')]!==_0x5bec('0x28')?_0x4a5482[_0x5bec('0x2a')]:'Unknown';}_0x288d1b=_0x2dc014;_0x18fa47[_0x5bec('0x2d')](_0x2dc014);return;}}})[_0x5bec('0x1e')](function(){if(_0x748f75){emit(_0x4a5482[_0x5bec('0x21')],_0x2a70a7,util['format'](_0x5bec('0x2e'),_0x748f75[_0x5bec('0x2f')]),util['format'](_0x5bec('0x30'),_0x117162['action'][_0x5bec('0x31')]()),{'evt':_[_0x5bec('0x32')](_0x4a5482,{'autoCreate':_0x1c888f}),'contact':_0x288d1b===undefined?{}:_0x288d1b,'contacts':_0x18fa47[_0x5bec('0x20')]===0x0?undefined:_0x18fa47});}});}; \ No newline at end of file +var _0x7bae=['data5','xmd-contactid','ListId','data3','map','firstName','lastName','phone','mobile','createdAt','scheduledAt','updatedAt','union','resolve','getContacts','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridnum','routeId','','calleridname','Unknown','destcalleridname','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','destcalleridnum','format','user:%s','trigger:%s','action','toLowerCase','merge','ioredis','util','../../../../config/logger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data1','data2','isNil'];(function(_0x16ca8b,_0x551ee8){var _0x123101=function(_0x33f34f){while(--_0x33f34f){_0x16ca8b['push'](_0x16ca8b['shift']());}};_0x123101(++_0x551ee8);}(_0x7bae,0x13b));var _0xe7ba=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x7bae[_0x2cf2e9];return _0xd3670d;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var Redis=require(_0xe7ba('0x0'));var util=require(_0xe7ba('0x1'));var config=require('../../../../config/environment');var logger=require(_0xe7ba('0x2'))('trigger');var cmContactRpc=require(_0xe7ba('0x3'));config[_0xe7ba('0x4')]=_[_0xe7ba('0x5')](config[_0xe7ba('0x4')],{'host':_0xe7ba('0x6'),'port':0x18eb});var io=require(_0xe7ba('0x7'))(new Redis(config[_0xe7ba('0x4')]));function emit(_0x3c5e59,_0x10b307,_0x34fb18,_0x160565,_0x27b1d5){logger[_0xe7ba('0x8')](_0xe7ba('0x9'),_0x3c5e59,_0x10b307['id'],_0x34fb18,_0x160565,JSON['stringify'](_0x27b1d5));io['to'](_0x34fb18)[_0xe7ba('0xa')](_0x160565,_0x27b1d5);}exports[_0xe7ba('0xb')]=function(_0x375ebb,_0x276bc3,_0x15083a,_0x1672f0){var _0x99a86f,_0x448bcc;var _0x194447={};var _0x4b6597=Number(_0x15083a[_0xe7ba('0xc')]);var _0x588c8b=_0x15083a[_0xe7ba('0xd')]?Boolean(Number(_0x15083a[_0xe7ba('0xd')])):![];var _0x390596;var _0x17e4e6=![];if(!_[_0xe7ba('0xe')](_0x15083a[_0xe7ba('0xf')])){if(_0x15083a['data5']=='1')_0x17e4e6=!![];}if(!_0x17e4e6){if(_0x1672f0['xmd-contactid']){_0x194447['id']=_0x1672f0[_0xe7ba('0x10')];}}if(!_0x194447['id']){_0x194447[_0xe7ba('0x11')]=_0x4b6597;_0x390596=_0x15083a[_0xe7ba('0x12')]&&_0x15083a['data3']!=='0'?_0x15083a[_0xe7ba('0x12')]['split'](','):['phone'];_0x194447['$or']=_[_0xe7ba('0x13')](_0x390596,function(_0x4e87f5){var _0x41a773={};_0x41a773[_0x4e87f5]=_0x1672f0['routeId']?_0x1672f0['destcalleridnum']:_0x1672f0['calleridnum'];return _0x41a773;});}var _0x3f326a=['id',_0xe7ba('0x14'),_0xe7ba('0x15'),_0xe7ba('0x16'),_0xe7ba('0x17'),'fax',_0xe7ba('0x11'),_0xe7ba('0x18'),_0xe7ba('0x19'),_0xe7ba('0x1a')];var _0x4aaf35=_[_0xe7ba('0x1b')](_0x3f326a,_0x390596);BPromise[_0xe7ba('0x1c')]()['then'](cmContactRpc[_0xe7ba('0x1d')]({'attributes':_0x4aaf35,'where':_0x194447}))[_0xe7ba('0x1e')](function(_0x27c882){_0x448bcc=_0x27c882;if(!_[_0xe7ba('0x1f')](_0x448bcc)){if(_0x448bcc[_0xe7ba('0x20')]===0x1){_0x99a86f=_0x448bcc[0x0];logger[_0xe7ba('0x8')](_0xe7ba('0x21'),_0x1672f0[_0xe7ba('0x22')],_0x276bc3['id'],_0x99a86f['id']);}else{logger[_0xe7ba('0x8')](_0xe7ba('0x23'),_0x1672f0['uniqueid'],_0x276bc3['id'],_['map'](_0x448bcc,'id')['join'](','));}return;}else{logger['info'](_0xe7ba('0x24'),_0x1672f0['uniqueid'],_0x276bc3['id']);var _0x4ecc0d={'ListId':_0x4b6597};var _0x5ece11=_0x15083a[_0xe7ba('0x25')]&&_0x15083a[_0xe7ba('0x25')]!=='0'?_0x15083a[_0xe7ba('0x25')]:_0xe7ba('0x16');if(_0x588c8b){logger[_0xe7ba('0x8')](_0xe7ba('0x26'),_0x1672f0[_0xe7ba('0x22')],_0x276bc3['id']);_0x4ecc0d[_0x5ece11]=_[_0xe7ba('0xe')](_0x1672f0['routeId'])?_0x1672f0[_0xe7ba('0x27')]:_0x1672f0['destcalleridnum'];if(_[_0xe7ba('0xe')](_0x1672f0[_0xe7ba('0x28')])){_0x4ecc0d[_0xe7ba('0x14')]=_0x1672f0['calleridname']&&_0x1672f0['calleridname']!==_0xe7ba('0x29')?_0x1672f0[_0xe7ba('0x2a')]:_0xe7ba('0x2b');}else{_0x4ecc0d[_0xe7ba('0x14')]=_0x1672f0[_0xe7ba('0x2c')]&&_0x1672f0['destcalleridname']!==_0xe7ba('0x29')?_0x1672f0[_0xe7ba('0x2c')]:'Unknown';}return BPromise[_0xe7ba('0x1c')]()['then'](cmContactRpc['createContact'](_0x4ecc0d))[_0xe7ba('0x1e')](function(_0x134f21){_0x99a86f=_0x134f21;_0x448bcc[_0xe7ba('0x2d')](_0x134f21);if(_0x99a86f){logger['info'](_0xe7ba('0x2e'),_0x1672f0['uniqueid'],_0x276bc3['id'],_0x99a86f['id']);}return;});}else{logger[_0xe7ba('0x8')](_0xe7ba('0x2f'),_0x1672f0[_0xe7ba('0x22')],_0x276bc3['id']);_0x4ecc0d[_0x5ece11]=_[_0xe7ba('0xe')](_0x1672f0[_0xe7ba('0x28')])?_0x1672f0['calleridnum']:_0x1672f0[_0xe7ba('0x30')];if(_[_0xe7ba('0xe')](_0x1672f0['routeId'])){_0x4ecc0d[_0xe7ba('0x14')]=_0x1672f0[_0xe7ba('0x2a')]&&_0x1672f0[_0xe7ba('0x2a')]!==''?_0x1672f0[_0xe7ba('0x2a')]:_0xe7ba('0x2b');}else{_0x4ecc0d['firstName']=_0x1672f0[_0xe7ba('0x2c')]&&_0x1672f0[_0xe7ba('0x2c')]!==_0xe7ba('0x29')?_0x1672f0['destcalleridname']:_0xe7ba('0x2b');}_0x99a86f=_0x4ecc0d;_0x448bcc[_0xe7ba('0x2d')](_0x4ecc0d);return;}}})['then'](function(){if(_0x375ebb){emit(_0x1672f0[_0xe7ba('0x22')],_0x276bc3,util[_0xe7ba('0x31')](_0xe7ba('0x32'),_0x375ebb['name']),util['format'](_0xe7ba('0x33'),_0x15083a[_0xe7ba('0x34')][_0xe7ba('0x35')]()),{'evt':_[_0xe7ba('0x36')](_0x1672f0,{'autoCreate':_0x588c8b}),'contact':_0x99a86f===undefined?{}:_0x99a86f,'contacts':_0x448bcc[_0xe7ba('0x20')]===0x0?undefined:_0x448bcc});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index fcbf469..864e489 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 _0xfeda=['trigger:%s','format','exec','integration','voiceQueues','queue','routeId','urlforward','script','parse','query','search','replace','channel','AllConditions','every','checkConditions','AnyConditions','some','field','account','ChatWebsiteId','value','upperFirst','operator','AccountId','message','event','agent','membername','lastevent','mailSubstatus','null','substatus','offlineMessage','util','lodash','url','mustache','ioredis','./integration','./script','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','popup','winapp','triggers','agents','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','custom:dialconnect','custom:dialend','syncAgentDial','custom:closedinteraction','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','clone','motionChannel','undefined','voice','checkTriggers','interface','hasOwnProperty','status','merge','variables','length','Actions','action','toLowerCase','contactmanager','browser','data1','TemplateId','data2','html','template\x20not\x20found','uri','buildUri','isNil','data3','location','data4','data5','windowHeight','data6','winApplication','render','winArguments','name','trigger:%s:%s','jscripty','user:%s'];(function(_0x5e3d69,_0x140343){var _0x208905=function(_0x1dc022){while(--_0x1dc022){_0x5e3d69['push'](_0x5e3d69['shift']());}};_0x208905(++_0x140343);}(_0xfeda,0x11d));var _0xafed=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xfeda[_0x411add];return _0x238242;};'use strict';var util=require(_0xafed('0x0'));var _=require(_0xafed('0x1'));var url=require(_0xafed('0x2'));var Mustache=require(_0xafed('0x3'));var Redis=require(_0xafed('0x4'));var urlforward=require('./urlforward');var integration=require(_0xafed('0x5'));var cmContact=require('./cmContact');var script=require(_0xafed('0x6'));var config=require(_0xafed('0x7'));var logger=require(_0xafed('0x8'))('trigger');var ami=require('../ami');config[_0xafed('0x9')]=_[_0xafed('0xa')](config[_0xafed('0x9')],{'host':_0xafed('0xb'),'port':0x18eb});var io=require(_0xafed('0xc'))(new Redis(config['redis']));var operators={'equals':function(_0x14ec04,_0x1955fc){return _0x14ec04==_0x1955fc;},'not_equals':function(_0x1eb546,_0x3b27fd){return _0x1eb546!=_0x3b27fd;}};var barAndWebActions=[_0xafed('0xd'),_0xafed('0x2'),_0xafed('0xe')];function Trigger(_0x36f944){this[_0xafed('0xf')]=_0x36f944[_0xafed('0xf')];this[_0xafed('0x10')]=_0x36f944[_0xafed('0x10')];this['voiceQueues']=_0x36f944['voiceQueues'];this[_0xafed('0x11')]=_0x36f944[_0xafed('0x11')];this[_0xafed('0x12')]=_0x36f944[_0xafed('0x12')];this[_0xafed('0x13')]=_0x36f944[_0xafed('0x13')];this[_0xafed('0x14')]=_0x36f944[_0xafed('0x14')];this[_0xafed('0x15')]=_0x36f944[_0xafed('0x15')];this[_0xafed('0x16')]=_0x36f944[_0xafed('0x16')];this[_0xafed('0x17')]=_0x36f944[_0xafed('0x17')];this['deskAccounts']=_0x36f944[_0xafed('0x18')];this[_0xafed('0x19')]=_0x36f944[_0xafed('0x19')];this[_0xafed('0x1a')]=_0x36f944['servicenowAccounts'];this['dynamics365Accounts']=_0x36f944[_0xafed('0x1b')];this[_0xafed('0x1c')]=_0x36f944[_0xafed('0x1c')];this[_0xafed('0x1d')]={'zendesk':this[_0xafed('0x13')],'salesforce':this[_0xafed('0x15')],'freshdesk':this[_0xafed('0x14')],'sugarcrm':this[_0xafed('0x16')],'zoho':this['zohoAccounts'],'desk':this[_0xafed('0x18')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0xafed('0x1b')],'freshsales':this[_0xafed('0x1c')],'servicenow':this[_0xafed('0x1a')]};ami['on']('custom:agentcalled',this[_0xafed('0x1e')][_0xafed('0x1f')](this));ami['on'](_0xafed('0x20'),this[_0xafed('0x1e')][_0xafed('0x1f')](this));ami['on'](_0xafed('0x21'),this[_0xafed('0x1e')][_0xafed('0x1f')](this));ami['on'](_0xafed('0x22'),this[_0xafed('0x1e')]['bind'](this));ami['on'](_0xafed('0x23'),this[_0xafed('0x1e')][_0xafed('0x1f')](this));ami['on'](_0xafed('0x24'),this[_0xafed('0x1e')][_0xafed('0x1f')](this));ami['on'](_0xafed('0x25'),this[_0xafed('0x1e')]['bind'](this));ami['on'](_0xafed('0x26'),this['syncCustomEvent'][_0xafed('0x1f')](this));ami['on'](_0xafed('0x27'),this[_0xafed('0x1e')][_0xafed('0x1f')](this));ami['on'](_0xafed('0x28'),this[_0xafed('0x1e')][_0xafed('0x1f')](this));ami['on'](_0xafed('0x29'),this[_0xafed('0x1e')][_0xafed('0x1f')](this));ami['on'](_0xafed('0x2a'),this[_0xafed('0x1e')][_0xafed('0x1f')](this));ami['on'](_0xafed('0x2b'),this['syncAgentDial'][_0xafed('0x1f')](this));ami['on'](_0xafed('0x2c'),this['syncAgentDial'][_0xafed('0x1f')](this));ami['on'](_0xafed('0x2d'),this[_0xafed('0x2e')][_0xafed('0x1f')](this));ami['on']('custom:newinteraction',this[_0xafed('0x1e')][_0xafed('0x1f')](this));ami['on'](_0xafed('0x2f'),this['syncCustomEvent']['bind'](this));ami['on']('custom:substatus',this['syncCustomEvent'][_0xafed('0x1f')](this));ami['on']('custom:incomingmessage',this[_0xafed('0x1e')][_0xafed('0x1f')](this));ami['on']('custom:outgoingmessage',this['syncCustomEvent'][_0xafed('0x1f')](this));ami['on'](_0xafed('0x30'),this[_0xafed('0x1e')][_0xafed('0x1f')](this));ami['on'](_0xafed('0x31'),this['syncCustomEvent']['bind'](this));ami['on']('custom:offlineMessage',this[_0xafed('0x1e')]['bind'](this));}Trigger[_0xafed('0x32')][_0xafed('0x33')]=function(_0x44e5cb,_0x29dfbf,_0x133637){logger[_0xafed('0x34')](_0x44e5cb,_0x29dfbf,JSON['stringify'](_0x133637));io['to'](_0x44e5cb)[_0xafed('0x33')](_0x29dfbf,_0x133637);};Trigger['prototype'][_0xafed('0x1e')]=function(_0x5ebf8a){var _0x10999a=_[_0xafed('0x35')](_0x5ebf8a);if(typeof _0x10999a[_0xafed('0x36')]===_0xafed('0x37')){_0x10999a[_0xafed('0x36')]=_0xafed('0x38');}this[_0xafed('0x39')](_0x10999a);};Trigger[_0xafed('0x32')][_0xafed('0x2e')]=function(_0x770a9f){if(this[_0xafed('0x10')][_0x770a9f[_0xafed('0x3a')]]){this['syncCustomEvent'](_0x770a9f);}};Trigger[_0xafed('0x32')][_0xafed('0x39')]=function(_0x1c6cf0){var _0x330bc9;for(var _0x5e4d63 in this['triggers']){if(this[_0xafed('0xf')][_0xafed('0x3b')](_0x5e4d63)){if(this[_0xafed('0xf')][_0x5e4d63][_0xafed('0x3c')]){_0x330bc9=this['checkTrigger'](this[_0xafed('0xf')][_0x5e4d63],_0x1c6cf0);if(_0x330bc9){_[_0xafed('0x3d')](_0x1c6cf0,_0x1c6cf0[_0xafed('0x3e')]);for(var _0x224fde=0x0,_0x5897e5,_0x42ae4f,_0x4abe6e;_0x224fde0x0){_0x55ad0f=_[_0xf326('0x25')](_0x581531,_0x1617d2);}return _0x55ad0f;}function getCustomFields(_0x1ae23a,_0x2fa28e){var _0x5dbe63=[];var _0xc115d9={'custom_fields':{}};if(_0x1ae23a[_0xf326('0x26')]>0x0){_['forEach'](_0x1ae23a,function(_0x225776){if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776[_0xf326('0x2a')])&&_0x225776[_0xf326('0x2b')]&&!_0x225776[_0xf326('0x2c')]){_0xc115d9[_0x225776[_0xf326('0x2b')][_0xf326('0x2d')]()]=_0x225776[_0xf326('0x2e')]['toString']();}else if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776['type'])&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x225776['content'][_0xf326('0x31')]();}else if(_0x225776[_0xf326('0x2a')]===_0xf326('0x32')&&_0x225776[_0xf326('0x33')]&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776[_0xf326('0x33')]]&&(_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x2fa28e[_0x225776[_0xf326('0x33')]][_0xf326('0x31')]());}else if(_0x225776['type']===_0xf326('0x34')&&_0x225776['Variable']&&_0x225776[_0xf326('0x35')]['name']&&_0x225776['idField']&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776['Variable'][_0xf326('0x36')]['toLowerCase']()]&&(_0xc115d9[_0xf326('0x30')][_0x225776[_0xf326('0x2f')]]=_0x2fa28e[_0x225776[_0xf326('0x35')]['name'][_0xf326('0x2d')]()][_0xf326('0x31')]());}});}if(_0xc115d9['priority']){_0xc115d9[_0xf326('0x37')]=Number(_0xc115d9[_0xf326('0x37')]);}return _0xc115d9;}function getTicket(_0x40fa7a,_0xaf65e0,_0x51076c,_0x2c4416,_0xb1ef35){logger[_0xf326('0xb')](_0xf326('0x38'));var _0x1d88ed=_['merge']({'subject':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3a')],_0xb1ef35,'\x20'),'type':'phone','status':'new','labels':[_0xf326('0x3b'),'Motion','CTI'][_0xf326('0x3c')](getTags(_0x2c4416['Tags'],_0xf326('0x36'))),'description':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a'),'_links':{'assigned_user':{'href':util[_0xf326('0x13')]('/api/v2/users/%d',_0xaf65e0['id']),'class':_0xf326('0x3e')}},'message':{'direction':'in','body':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a')}},getCustomFields(_0x2c4416[_0xf326('0x3f')],_0xb1ef35));return request({'uri':util[_0xf326('0x13')](_0xf326('0x40'),_0x40fa7a[_0xf326('0x16')],_0x51076c['id']),'method':_0xf326('0x23'),'body':_0x1d88ed});}exports[_0xf326('0x41')]=function(_0x1227d3,_0x361776,_0x2bab13,_0x50d63f,_0x1b6126,_0x1637dc){var _0x2ed1a7,_0x270288;_0x1637dc[_0xf326('0x16')]=intUtil[_0xf326('0x42')](_0x1637dc['remoteUri']);_0x1637dc[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x1637dc['serverUrl']);if(_0x1b6126&&_0x1b6126[_0xf326('0x44')]){logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x46'));_0x361776[_0xf326('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1637dc[_0xf326('0x43')],_0x361776[_0xf326('0x48')],md5(_0x361776['uniqueid']));}else{_0x361776['recordingURL']='';}headers[_0xf326('0x49')]=getAuth(_0x1637dc);return getUser(_0x1637dc,_0x50d63f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x5b3705){_0x2ed1a7=_0x5b3705;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2ed1a7['id']);return getEndUser(_0x1637dc,_0x361776[_0xf326('0x4c')],_0x361776[_0xf326('0x4d')]);})[_0xf326('0xe')](function(_0x2d9bba){_0x270288=_0x2d9bba;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x270288['id']);return getTicket(_0x1637dc,_0x2ed1a7,_0x270288,_0x2bab13,_0x361776);})[_0xf326('0xe')](function(_0x27ced1){if(_0x27ced1){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x27ced1['id']);switch(_0x1637dc[_0xf326('0x2a')]){case'integrationTab':logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x51'));emit(util[_0xf326('0x13')]('user:%s',_0x50d63f[_0xf326('0x36')]),_0xf326('0x52'),{'recordId':_0x27ced1['id']});break;case _0xf326('0x53'):logger[_0xf326('0xb')]('[QUEUE]',_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x50d63f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x27ced1['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x45'),_0xf326('0x58'));}}})['catch'](function(_0x102fba){console[_0xf326('0x57')](_0x102fba);logger[_0xf326('0x57')]('[QUEUE]',JSON['stringify'](_0x102fba));});};exports[_0xf326('0x59')]=function(_0x5b4832,_0x1cf58f,_0x554277,_0x458e5f,_0x7ee57,_0x28c959,_0x25e091){var _0x212594,_0x35d3c8;_0x28c959[_0xf326('0x16')]=intUtil['stripTrailingSlash'](_0x28c959[_0xf326('0x16')]);_0x28c959[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28c959['serverUrl']);if(_0x25e091&&_0x25e091[_0xf326('0x5a')]&&_0x25e091[_0xf326('0x5a')]!==_0xf326('0x5b')){logger[_0xf326('0xb')](_0xf326('0x5c'),'Recording\x20is\x20enabled!');_0x1cf58f[_0xf326('0x47')]=util[_0xf326('0x13')](_0xf326('0x5d'),_0x28c959[_0xf326('0x43')],_0x1cf58f['uniqueid'],md5(_0x1cf58f[_0xf326('0x48')]));}headers[_0xf326('0x49')]=getAuth(_0x28c959);return getUser(_0x28c959,_0x458e5f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x4d3b9e){_0x212594=_0x4d3b9e;logger['info'](_0xf326('0x4b'),_0x212594['id']);return getEndUser(_0x28c959,_0x1cf58f[_0xf326('0x5e')],_0x1cf58f['destcalleridnum']);})[_0xf326('0xe')](function(_0x29de71){_0x35d3c8=_0x29de71;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x35d3c8['id']);return getTicket(_0x28c959,_0x212594,_0x35d3c8,_0x554277,_0x1cf58f);})['then'](function(_0xb1c18c){if(_0xb1c18c){logger['info']('Ticket\x20created!');logger[_0xf326('0xb')]('The\x20Ticket\x20ID\x20is:',_0xb1c18c['id']);switch(_0x28c959[_0xf326('0x2a')]){case _0xf326('0x5f'):logger[_0xf326('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),'trigger:desk:display',{'recordId':_0xb1c18c['id']});break;case _0xf326('0x53'):logger['info'](_0xf326('0x45'),_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util[_0xf326('0x13')](_0xf326('0x60'),_0x28c959[_0xf326('0x16')],_0xb1c18c['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x5c'),_0xf326('0x58'));}}})[_0xf326('0x61')](function(_0x4ca1b8){logger[_0xf326('0x57')]('[OUTBOUND]',JSON[_0xf326('0x62')](_0x4ca1b8));});};exports[_0xf326('0x63')]=function(_0x5e858d,_0x2b770c,_0x5283da,_0x3255b2,_0xd55246,_0x28f3cb){var _0x2d45c9,_0x31b6dd;_0x28f3cb['remoteUri']=intUtil['stripTrailingSlash'](_0x28f3cb[_0xf326('0x16')]);_0x28f3cb[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28f3cb[_0xf326('0x43')]);if(_0xd55246&&_0xd55246[_0xf326('0x44')]){logger['info']('['+_0x2b770c[_0xf326('0x64')][_0xf326('0x65')]()+']','Recording\x20is\x20enabled!');_0x2b770c['recordingURL']=util['format'](_0xf326('0x5d'),_0x28f3cb[_0xf326('0x43')],_0x2b770c[_0xf326('0x48')],md5(_0x2b770c[_0xf326('0x48')]));}else{_0x2b770c[_0xf326('0x47')]='';}headers[_0xf326('0x49')]=getAuth(_0x28f3cb);return getUser(_0x28f3cb)[_0xf326('0xe')](function(_0x4b9013){_0x2d45c9=_0x4b9013;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2d45c9['id']);return getEndUser(_0x28f3cb,_0x2b770c[_0xf326('0x4c')],_0x2b770c[_0xf326('0x4d')]);})['then'](function(_0x3717fe){_0x31b6dd=_0x3717fe;logger['info']('The\x20Enduser\x20ID\x20is:',_0x31b6dd['id']);return getTicket(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x5283da,_0x2b770c);})[_0xf326('0xe')](function(_0x540fa0){if(_0x540fa0){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x540fa0['id']);}})[_0xf326('0x61')](function(_0x541491){logger['error']('['+_0x2b770c['lastevent'][_0xf326('0x65')]()+']',JSON[_0xf326('0x62')](_0x541491));});}; \ No newline at end of file +var _0xe14b=['CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','%s/customers/%d/cases','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','integrationTab','newTab','catch','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','ioredis','./util','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','application/json','validateEmail','format','%s/users','then','total_entries','find','_embedded','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','%s/customers','remoteUri','POST','length','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variableName','custom_fields','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe14b,0x93));var _0xbe14=function(_0x36f194,_0x460f00){_0x36f194=_0x36f194-0x0;var _0x526d83=_0xe14b[_0x36f194];return _0x526d83;};'use strict';var _=require(_0xbe14('0x0'));var rp=require(_0xbe14('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0xbe14('0x2'));var intUtil=require(_0xbe14('0x3'));var config=require('../../../../config/environment');var logger=require(_0xbe14('0x4'))('desk');config['redis']=_[_0xbe14('0x5')](config[_0xbe14('0x6')],{'host':_0xbe14('0x7'),'port':0x18eb});var io=require(_0xbe14('0x8'))(new Redis(config[_0xbe14('0x6')]));function emit(_0x39387e,_0x196fca,_0x566ae7){io['to'](_0x39387e)['emit'](_0x196fca,_0x566ae7);}var headers={'Content-Type':'application/json','Accept':_0xbe14('0x9')};function getUser(_0x6fceff,_0xd68cd7){if(intUtil[_0xbe14('0xa')](_0xd68cd7)===!![]){logger['info']('Getting\x20agent\x20with\x20email',_0xd68cd7);return request({'uri':util[_0xbe14('0xb')](_0xbe14('0xc'),_0x6fceff['remoteUri'])})[_0xbe14('0xd')](function(_0x35aa19){if(_0x35aa19[_0xbe14('0xe')]){return _[_0xbe14('0xf')](_0x35aa19[_0xbe14('0x10')][_0xbe14('0x11')],{'email':_0xd68cd7});}})[_0xbe14('0xd')](function(_0x2850cb){if(_0x2850cb){logger[_0xbe14('0x12')](_0xbe14('0x13'));return _0x2850cb;}else{logger[_0xbe14('0x12')](_0xbe14('0x14'));return request({'uri':util[_0xbe14('0xb')]('%s/users/me',_0x6fceff['remoteUri'])});}});}else{logger[_0xbe14('0x12')](_0xbe14('0x15'));return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x16'),_0x6fceff['remoteUri'])});}}function request(_0x21c789){logger[_0xbe14('0x17')](_0xbe14('0x18'),JSON[_0xbe14('0x19')](_0x21c789));return rp(_[_0xbe14('0x5')](_0x21c789,{'method':_0xbe14('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x17ae86){var _0x5ea1f8;if(_0x17ae86[_0xbe14('0x1b')]===_0xbe14('0x1c')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x1d'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x1f')]);}else if(_0x17ae86['authType']===_0xbe14('0x20')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x21'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x20')]);}return util['format'](_0xbe14('0x22'),new Buffer(_0x5ea1f8)['toString'](_0xbe14('0x23')));}function getEndUser(_0x56e80c,_0x32e8eb,_0x4a25fa){logger[_0xbe14('0x12')](_0xbe14('0x24'),_0x4a25fa);return request({'uri':util['format'](_0xbe14('0x25'),_0x56e80c['remoteUri']),'qs':{'phone':_0x4a25fa}})[_0xbe14('0xd')](function(_0x4851f8){if(_0x4851f8[_0xbe14('0xe')]){logger[_0xbe14('0x12')](_0xbe14('0x26'));return _0x4851f8[_0xbe14('0x10')][_0xbe14('0x11')][0x0];}else{logger[_0xbe14('0x12')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x27'),_0x56e80c[_0xbe14('0x28')]),'method':_0xbe14('0x29'),'body':{'first_name':_0x32e8eb,'title':_0x32e8eb,'phone_numbers':[{'type':'work','value':_0x4a25fa}]}});}});}function getTags(_0x16f884,_0x29fc64){var _0x59bf34=[];if(_0x16f884&&_0x16f884[_0xbe14('0x2a')]>0x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index fc422fc..c67c291 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 _0x0d82=['Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','unmanaged','name','inspect','lodash','bluebird','request-promise','util','md5','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','access_token','catch','error','toUpperCase','message','then','GET','Bearer\x20','4.0','isNil','validateEmail','email','userEmail','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid','userId','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','substring','lastIndexOf','enduserId','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','value','length','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','string','picklist','type','nameField','indexOf','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','phonecall','callDirection','queue','phonecalls','headers','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','[QUEUE]'];(function(_0x420c44,_0x11af5b){var _0x138afb=function(_0x3e52f5){while(--_0x3e52f5){_0x420c44['push'](_0x420c44['shift']());}};_0x138afb(++_0x11af5b);}(_0x0d82,0xcf));var _0x20d8=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x0d82[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x20d8('0x0'));var BPromise=require(_0x20d8('0x1'));var rp=require(_0x20d8('0x2'));var util=require(_0x20d8('0x3'));var intUtil=require('./util');var md5=require(_0x20d8('0x4'));var Redis=require('ioredis');var logger=require(_0x20d8('0x5'))(_0x20d8('0x6'));var config=require(_0x20d8('0x7'));config[_0x20d8('0x8')]=_[_0x20d8('0x9')](config[_0x20d8('0x8')],{'host':_0x20d8('0xa'),'port':0x18eb});var io=require(_0x20d8('0xb'))(new Redis(config[_0x20d8('0x8')]));function getAuthToken(_0xe6b7b6,_0x4f5469,_0x63be3a){var _0x2e8298={'method':_0x20d8('0xc'),'uri':_0x4f5469,'form':{'client_id':_0xe6b7b6[_0x20d8('0xd')],'resource':_0xe6b7b6[_0x20d8('0xe')],'username':_0xe6b7b6[_0x20d8('0xf')],'password':_0xe6b7b6['password'],'grant_type':_0x20d8('0x10'),'client_secret':_0xe6b7b6[_0x20d8('0x11')]},'json':!![]};return rp(_0x2e8298)['then'](function(_0x5de2bb){return _0x5de2bb[_0x20d8('0x12')];})[_0x20d8('0x13')](function(_0x122c95){logger[_0x20d8('0x14')]('['+[_0x63be3a[_0x20d8('0x15')]()]+']\x20Wrong\x20credentials!');return _0x122c95[_0x20d8('0x16')];});}function getUser(_0x1c5f6c,_0x48818e,_0x4b7312,_0x2a11f1,_0x494f5b,_0x5e8b9c){return new BPromise(function(_0x2b5a25,_0x40604d){return getAuthToken(_0x48818e,_0x2a11f1,_0x5e8b9c)[_0x20d8('0x17')](function(_0x50b250){var _0x2ea2df={'method':_0x20d8('0x18'),'uri':_0x494f5b+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x20d8('0x19')+_0x50b250,'OData-Version':_0x20d8('0x1a')},'json':!![]};return rp(_0x2ea2df);})[_0x20d8('0x17')](function(_0x50bf19){var _0x514aa1=_0x50bf19['value'];var _0x3f1c8d=![];var _0x5a0dd9=null;if(!_[_0x20d8('0x1b')](_0x4b7312)){if(intUtil[_0x20d8('0x1c')](_0x4b7312[_0x20d8('0x1d')])){_0x1c5f6c[_0x20d8('0x1e')]=_0x4b7312[_0x20d8('0x1d')];for(_0x5a0dd9=0x0;_0x5a0dd9<_0x514aa1['length'];_0x5a0dd9++){if(_0x514aa1[_0x5a0dd9][_0x20d8('0x1f')]===_0x4b7312[_0x20d8('0x1d')]&&!_0x514aa1[_0x5a0dd9]['isdisabled']){_0x3f1c8d=!![];logger[_0x20d8('0x20')]('['+[_0x5e8b9c[_0x20d8('0x15')]()]+_0x20d8('0x21')+_0x514aa1[_0x5a0dd9][_0x20d8('0x22')]+'!');_0x1c5f6c[_0x20d8('0x23')]=_0x514aa1[_0x5a0dd9][_0x20d8('0x22')];}}}}if(!_0x3f1c8d){logger[_0x20d8('0x20')]('['+[_0x5e8b9c[_0x20d8('0x15')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x1c5f6c[_0x20d8('0x1e')]=_0x48818e[_0x20d8('0xf')];for(_0x5a0dd9=0x0;_0x5a0dd9<_0x514aa1['length'];_0x5a0dd9++){if(_0x514aa1[_0x5a0dd9][_0x20d8('0x1f')]===_0x48818e[_0x20d8('0xf')]){_0x1c5f6c['userId']=_0x514aa1[_0x5a0dd9][_0x20d8('0x22')];}}}_0x2b5a25(_0x1c5f6c);})['catch'](function(_0x4b84a8){_0x40604d(_0x4b84a8['message']);});});}function createEndUser(_0x172993,_0x5a1b89,_0x59e2bb,_0xd02bf8,_0xe6cfc1,_0xaf0938){return new BPromise(function(_0x49d174,_0x1e1872){return getAuthToken(_0x5a1b89,_0x59e2bb,_0xaf0938)[_0x20d8('0x17')](function(_0x206e38){var _0x59e187=_0xaf0938[_0x20d8('0x24')]()===_0x20d8('0x25')?_0xe6cfc1[_0x20d8('0x26')]:_0xe6cfc1[_0x20d8('0x27')];var _0x2f1800={'method':_0x20d8('0xc'),'uri':_0xd02bf8+_0x20d8('0x28'),'body':{'telephone1':_0x59e187,'fullname':_0x59e187,'firstname':_0x59e187,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x20d8('0x29')+_0x172993[_0x20d8('0x23')]+')'},'headers':{'Authorization':_0x20d8('0x19')+_0x206e38,'OData-Version':_0x20d8('0x1a')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x2f1800);})[_0x20d8('0x17')](function(_0x1be4e2){var _0x2bc4ed=_0x1be4e2['headers']['odata-entityid'];var _0xcdbc83=_0x2bc4ed[_0x20d8('0x2a')](_0x2bc4ed[_0x20d8('0x2b')]('(')+0x1,_0x2bc4ed[_0x20d8('0x2b')](')'));_0x172993[_0x20d8('0x2c')]=_0xcdbc83;_0x49d174(_0x172993);})[_0x20d8('0x13')](function(_0x2d9534){_0x1e1872(_0x2d9534[_0x20d8('0x16')]);});});}function getEndUser(_0x49f6f9,_0x216c1a,_0x1c8a45,_0x43a74e,_0x465adc,_0x41802f,_0x119bb4){var _0x9d18c4=_0x41802f[_0x20d8('0x24')]()==='outbound'?_0x465adc[_0x20d8('0x26')]:_0x465adc['calleridnum'];return getAuthToken(_0x216c1a,_0x1c8a45,_0x41802f)[_0x20d8('0x17')](function(_0x225ab5){var _0xd53153={'method':_0x20d8('0x18'),'uri':_0x43a74e+_0x20d8('0x2d')+_0x9d18c4[_0x20d8('0x2e')]('+',_0x20d8('0x2f'))+'\x27','headers':{'Authorization':_0x20d8('0x19')+_0x225ab5,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xd53153);})[_0x20d8('0x17')](function(_0x19daba){var _0x33baf4=![];if(!_0x19daba)return _0x33baf4;var _0x1a42a5=_0x19daba[_0x20d8('0x30')];for(var _0x20eecc=0x0;_0x20eecc<_0x1a42a5[_0x20d8('0x31')];_0x20eecc++){if(_0x1a42a5[_0x20eecc]['telephone1']===_0x9d18c4){_0x33baf4=!![];_0x49f6f9[_0x20d8('0x2c')]=_0x1a42a5[_0x20eecc][_0x20d8('0x32')];}}return _0x33baf4;})['then'](function(_0x15c98f){if(_0x15c98f)return _0x49f6f9;if(_0x119bb4===_0x20d8('0x33')){logger['info']('['+[_0x41802f['toUpperCase']()]+_0x20d8('0x34'));return _0x49f6f9;}return createEndUser(_0x49f6f9,_0x216c1a,_0x1c8a45,_0x43a74e,_0x465adc,_0x41802f)[_0x20d8('0x17')](function(_0x552479){logger[_0x20d8('0x20')]('['+[_0x41802f[_0x20d8('0x15')]()]+']\x20Enduser\x20created!',_0x552479['enduserId']);return _0x552479;});});}function getCustomFields(_0x46aefe,_0x272738,_0x4d723b){var _0x3c8104={};if(_0x46aefe[_0x20d8('0x31')]>0x0){_['forEach'](_0x46aefe,function(_0x57d903){if(_['includes']([_0x20d8('0x35'),_0x20d8('0x36')],_0x57d903[_0x20d8('0x37')])&&_0x57d903[_0x20d8('0x38')]&&!_0x57d903['customField']){var _0xe9c71=_0x57d903['idField'][_0x20d8('0x24')]();var _0x389576=_0xe9c71[_0x20d8('0x2a')](0x0,_0xe9c71[_0x20d8('0x39')]('_'));var _0xf7a381=_0xe9c71[_0x20d8('0x2a')](_0xe9c71[_0x20d8('0x39')]('_')+0x1);if(_0x389576===_0x4d723b){_0x3c8104[_0xf7a381]=_0x57d903['content'];}}});}return _0x3c8104;}function getTicket(_0x43488c,_0x3f62f2,_0x1b2a61,_0x223829,_0x6a9d90,_0x2f64fc,_0x2aa00e){return new BPromise(function(_0x465ce2,_0x129337){var _0x557f7e;return getAuthToken(_0x3f62f2,_0x1b2a61,_0x2aa00e)[_0x20d8('0x17')](function(_0x3e109d){if(_0x2f64fc['ticketType']==='incident'){_0x557f7e={'method':'POST','uri':_0x223829+_0x20d8('0x3a'),'body':Object[_0x20d8('0x3b')]({},{'title':intUtil[_0x20d8('0x3c')](_0x2f64fc[_0x20d8('0x3d')],_0x6a9d90,'\x20'),'description':intUtil[_0x20d8('0x3c')](_0x2f64fc[_0x20d8('0x3e')],_0x6a9d90,'\x0a'),'customerid_contact@odata.bind':_0x43488c[_0x20d8('0x2c')]?_0x20d8('0x3f')+_0x43488c[_0x20d8('0x2c')]+')':undefined,'ownerid@odata.bind':_0x20d8('0x29')+_0x43488c['userId']+')','caseorigincode':'1'},getCustomFields(_0x2f64fc[_0x20d8('0x40')],_0x6a9d90,_0x2f64fc['ticketType'])),'headers':{'Authorization':_0x20d8('0x19')+_0x3e109d,'OData-Version':_0x20d8('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2f64fc[_0x20d8('0x41')]===_0x20d8('0x42')){var _0x2f781c=_0x43488c['enduserId']?[{'partyid_systemuser@odata.bind':_0x20d8('0x29')+_0x43488c[_0x20d8('0x23')]+')','participationtypemask':_0x43488c[_0x20d8('0x43')]===_0x20d8('0x44')?0x2:0x1},{'partyid_contact@odata.bind':_0x20d8('0x3f')+_0x43488c[_0x20d8('0x2c')]+')','participationtypemask':_0x43488c[_0x20d8('0x43')]===_0x20d8('0x44')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x20d8('0x29')+_0x43488c[_0x20d8('0x23')]+')','participationtypemask':_0x43488c[_0x20d8('0x43')]==='queue'?0x2:0x1}];_0x557f7e={'method':_0x20d8('0xc'),'uri':_0x223829+_0x20d8('0x45'),'body':Object[_0x20d8('0x3b')]({},{'subject':intUtil['getString'](_0x2f64fc[_0x20d8('0x3d')],_0x6a9d90,'\x20'),'phonenumber':String(_0x6a9d90[_0x20d8('0x27')]),'description':intUtil[_0x20d8('0x3c')](_0x2f64fc['Descriptions'],_0x6a9d90,'\x0a'),'regardingobjectid_contact@odata.bind':_0x43488c[_0x20d8('0x2c')]?_0x20d8('0x3f')+_0x43488c[_0x20d8('0x2c')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x43488c[_0x20d8('0x23')]+')','directioncode':_0x43488c[_0x20d8('0x43')]===_0x20d8('0x44')?![]:!![],'phonecall_activity_parties':_0x2f781c},getCustomFields(_0x2f64fc['Fields'],_0x6a9d90,_0x2f64fc[_0x20d8('0x41')])),'headers':{'Authorization':'Bearer\x20'+_0x3e109d,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x557f7e);})[_0x20d8('0x17')](function(_0x2528a7){var _0x47e19e=_0x2528a7[_0x20d8('0x46')]['odata-entityid'];var _0x55bde7=_0x47e19e['substring'](_0x47e19e[_0x20d8('0x2b')]('(')+0x1,_0x47e19e['lastIndexOf'](')'));_0x43488c['ticketId']=_0x55bde7;_0x465ce2(_0x43488c);})[_0x20d8('0x13')](function(_0x1fa94c){_0x129337(_0x1fa94c['message']);});});}function emit(_0x5f1990,_0x4336da,_0x8ed8d7,_0xb1c496){var _0xa7a3ce={'uri':util[_0x20d8('0x47')](_0x20d8('0x48'),_0x5f1990,_0x8ed8d7,_0xb1c496)};io['to'](util[_0x20d8('0x47')]('user:%s',_0x4336da))['emit'](_0x20d8('0x49'),_0xa7a3ce);}exports['cs']=function(_0x184b6b,_0x3a15c3,_0x133855,_0x412d98,_0x4b3c33,_0x2cae13,_0x934810,_0x412357){var _0x5834d3={};_0x2cae13[_0x20d8('0xe')]=intUtil[_0x20d8('0x4a')](_0x2cae13[_0x20d8('0xe')]);_0x2cae13[_0x20d8('0x4b')]=intUtil[_0x20d8('0x4a')](_0x2cae13[_0x20d8('0x4b')]);_0x5834d3['callDirection']=_0x412357===_0x20d8('0x44')||_0x412357==='unmanaged'?_0x20d8('0x44'):_0x20d8('0x25');var _0x121524=util[_0x20d8('0x47')](_0x20d8('0x4c'),_0x2cae13[_0x20d8('0xe')]);var _0x3ffbf6=util[_0x20d8('0x47')](_0x20d8('0x4d'),_0x2cae13['tenantId']);var _0x27dff6=util[_0x20d8('0x47')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2cae13[_0x20d8('0x4b')],_0x3a15c3[_0x20d8('0x4e')],md5(_0x3a15c3[_0x20d8('0x4e')]));if(_0x4b3c33&&_0x4b3c33[_0x20d8('0x4f')]){logger[_0x20d8('0x20')](_0x20d8('0x50'),_0x20d8('0x51'));_0x3a15c3[_0x20d8('0x52')]=_0x27dff6;}else if(_0x934810&&_0x934810[_0x20d8('0x53')]&&_0x934810[_0x20d8('0x53')]!==_0x20d8('0x54')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x3a15c3[_0x20d8('0x52')]=_0x27dff6;}else{_0x3a15c3['recordingURL']='';}return getUser(_0x5834d3,_0x2cae13,_0x412d98,_0x3ffbf6,_0x121524,_0x412357)['then'](function(_0x4db1f8){logger['info']('['+_0x412357[_0x20d8('0x15')]()+_0x20d8('0x55'),_0x4db1f8['userId']);logger[_0x20d8('0x20')]('['+_0x412357[_0x20d8('0x15')]()+_0x20d8('0x56'),_0x4db1f8[_0x20d8('0x1e')]);return getEndUser(_0x4db1f8,_0x2cae13,_0x3ffbf6,_0x121524,_0x3a15c3,_0x412357,_0x133855[_0x20d8('0x57')]);})[_0x20d8('0x17')](function(_0xae62fa){logger[_0x20d8('0x20')]('['+_0x412357[_0x20d8('0x15')]()+_0x20d8('0x58'),_0xae62fa[_0x20d8('0x2c')]);logger[_0x20d8('0x20')]('['+_0x412357['toUpperCase']()+_0x20d8('0x59'),_0x3a15c3[_0x20d8('0x27')]);return getTicket(_0xae62fa,_0x2cae13,_0x3ffbf6,_0x121524,_0x3a15c3,_0x133855,_0x412357);})[_0x20d8('0x17')](function(_0x4fc6ad){logger['info'](util[_0x20d8('0x47')]('['+_0x412357['toUpperCase']()+_0x20d8('0x5a'),_0x133855[_0x20d8('0x41')],_0x4fc6ad[_0x20d8('0x5b')]));logger[_0x20d8('0x20')](util[_0x20d8('0x47')]('['+_0x412357[_0x20d8('0x15')]()+_0x20d8('0x5c'),_0x412357));if(_0x412357!==_0x20d8('0x5d')){logger[_0x20d8('0x20')]('['+_0x412357[_0x20d8('0x15')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x2cae13[_0x20d8('0xe')],_0x412d98[_0x20d8('0x5e')],_0x133855['ticketType'],_0x4fc6ad[_0x20d8('0x5b')]);}})[_0x20d8('0x13')](function(_0x599bbb){logger[_0x20d8('0x14')]('['+_0x412357['toUpperCase']()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0x20d8('0x5f')](_0x599bbb,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2ffd=['Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','bluebird','request-promise','util','./util','../../../../config/logger','../../../../config/environment','redis','localhost','socket.io-emitter','POST','remoteUri','username','password','clientSecret','then','access_token','catch','toUpperCase',']\x20Wrong\x20credentials!','message','GET','Bearer\x20','value','isNil','userEmail','internalemailaddress','email','isdisabled',']\x20Agent\x20found\x20','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','toLowerCase','destcalleridnum','calleridnum','contacts','/systemusers(','4.0','headers','lastIndexOf','enduserId','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','picklist','type','nameField','customField','idField','substring','indexOf','ticketType','incident','assign','Subjects','getString','Descriptions','callDirection','queue','phonecalls','Fields','odata-entityid','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','serverUrl','stripTrailingSlash','%s/api/data/v9.0/','tenantId','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x2ffd,0xc3));var _0xd2ff=function(_0x4cd48e,_0x3df49c){_0x4cd48e=_0x4cd48e-0x0;var _0x2fb8a9=_0x2ffd[_0x4cd48e];return _0x2fb8a9;};'use strict';var _=require('lodash');var BPromise=require(_0xd2ff('0x0'));var rp=require(_0xd2ff('0x1'));var util=require(_0xd2ff('0x2'));var intUtil=require(_0xd2ff('0x3'));var md5=require('md5');var Redis=require('ioredis');var logger=require(_0xd2ff('0x4'))('dynamics365');var config=require(_0xd2ff('0x5'));config[_0xd2ff('0x6')]=_['defaults'](config[_0xd2ff('0x6')],{'host':_0xd2ff('0x7'),'port':0x18eb});var io=require(_0xd2ff('0x8'))(new Redis(config['redis']));function getAuthToken(_0xdf262d,_0x1b9589,_0xc16d26){var _0x30232a={'method':_0xd2ff('0x9'),'uri':_0x1b9589,'form':{'client_id':_0xdf262d['clientId'],'resource':_0xdf262d[_0xd2ff('0xa')],'username':_0xdf262d[_0xd2ff('0xb')],'password':_0xdf262d[_0xd2ff('0xc')],'grant_type':_0xd2ff('0xc'),'client_secret':_0xdf262d[_0xd2ff('0xd')]},'json':!![]};return rp(_0x30232a)[_0xd2ff('0xe')](function(_0x5da98d){return _0x5da98d[_0xd2ff('0xf')];})[_0xd2ff('0x10')](function(_0x37d0d8){logger['error']('['+[_0xc16d26[_0xd2ff('0x11')]()]+_0xd2ff('0x12'));return _0x37d0d8[_0xd2ff('0x13')];});}function getUser(_0x36900d,_0x4d2b3f,_0x3f8c17,_0x1aed4c,_0x1aa687,_0x4928b4){return new BPromise(function(_0x49cbca,_0x48a057){return getAuthToken(_0x4d2b3f,_0x1aed4c,_0x4928b4)[_0xd2ff('0xe')](function(_0x510ca7){var _0x296f91={'method':_0xd2ff('0x14'),'uri':_0x1aa687+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0xd2ff('0x15')+_0x510ca7,'OData-Version':'4.0'},'json':!![]};return rp(_0x296f91);})[_0xd2ff('0xe')](function(_0x203921){var _0x533160=_0x203921[_0xd2ff('0x16')];var _0x1a96e6=![];var _0x336f8c=null;if(!_[_0xd2ff('0x17')](_0x3f8c17)){if(intUtil['validateEmail'](_0x3f8c17['email'])){_0x36900d[_0xd2ff('0x18')]=_0x3f8c17['email'];for(_0x336f8c=0x0;_0x336f8c<_0x533160['length'];_0x336f8c++){if(_0x533160[_0x336f8c][_0xd2ff('0x19')]===_0x3f8c17[_0xd2ff('0x1a')]&&!_0x533160[_0x336f8c][_0xd2ff('0x1b')]){_0x1a96e6=!![];logger['info']('['+[_0x4928b4[_0xd2ff('0x11')]()]+_0xd2ff('0x1c')+_0x533160[_0x336f8c][_0xd2ff('0x1d')]+'!');_0x36900d[_0xd2ff('0x1e')]=_0x533160[_0x336f8c]['systemuserid'];}}}}if(!_0x1a96e6){logger[_0xd2ff('0x1f')]('['+[_0x4928b4[_0xd2ff('0x11')]()]+_0xd2ff('0x20'));_0x36900d['userEmail']=_0x4d2b3f['username'];for(_0x336f8c=0x0;_0x336f8c<_0x533160[_0xd2ff('0x21')];_0x336f8c++){if(_0x533160[_0x336f8c][_0xd2ff('0x19')]===_0x4d2b3f[_0xd2ff('0xb')]){_0x36900d[_0xd2ff('0x1e')]=_0x533160[_0x336f8c][_0xd2ff('0x1d')];}}}_0x49cbca(_0x36900d);})[_0xd2ff('0x10')](function(_0x55602d){_0x48a057(_0x55602d['message']);});});}function createEndUser(_0x793524,_0x25d328,_0x3439f2,_0x3c6821,_0x3bed7c,_0x1d17a0){return new BPromise(function(_0x4a4330,_0x8995ad){return getAuthToken(_0x25d328,_0x3439f2,_0x1d17a0)[_0xd2ff('0xe')](function(_0x4cce97){var _0x1260f7=_0x1d17a0[_0xd2ff('0x22')]()==='outbound'?_0x3bed7c[_0xd2ff('0x23')]:_0x3bed7c[_0xd2ff('0x24')];var _0x2588c3={'method':_0xd2ff('0x9'),'uri':_0x3c6821+_0xd2ff('0x25'),'body':{'telephone1':_0x1260f7,'fullname':_0x1260f7,'firstname':_0x1260f7,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xd2ff('0x26')+_0x793524[_0xd2ff('0x1e')]+')'},'headers':{'Authorization':_0xd2ff('0x15')+_0x4cce97,'OData-Version':_0xd2ff('0x27')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x2588c3);})[_0xd2ff('0xe')](function(_0x59bab1){var _0x5064b6=_0x59bab1[_0xd2ff('0x28')]['odata-entityid'];var _0x3cbc0f=_0x5064b6['substring'](_0x5064b6['lastIndexOf']('(')+0x1,_0x5064b6[_0xd2ff('0x29')](')'));_0x793524[_0xd2ff('0x2a')]=_0x3cbc0f;_0x4a4330(_0x793524);})['catch'](function(_0x5ed2bb){_0x8995ad(_0x5ed2bb[_0xd2ff('0x13')]);});});}function getEndUser(_0x5128a2,_0x4034df,_0x36562f,_0x4ed00b,_0x52ff58,_0x153c63,_0x30e6f6){var _0xc1fb07=_0x153c63['toLowerCase']()==='outbound'?_0x52ff58[_0xd2ff('0x23')]:_0x52ff58[_0xd2ff('0x24')];return getAuthToken(_0x4034df,_0x36562f,_0x153c63)[_0xd2ff('0xe')](function(_0x3d1b6e){var _0x41000c={'method':_0xd2ff('0x14'),'uri':_0x4ed00b+_0xd2ff('0x2b')+_0xc1fb07[_0xd2ff('0x2c')]('+','%2b')+'\x27','headers':{'Authorization':'Bearer\x20'+_0x3d1b6e,'If-None-Match':null,'OData-Version':_0xd2ff('0x27')},'json':!![]};return rp(_0x41000c);})[_0xd2ff('0xe')](function(_0x125f54){var _0x1e2421=![];if(!_0x125f54)return _0x1e2421;var _0xe8f7ce=_0x125f54[_0xd2ff('0x16')];for(var _0xd37ea7=0x0;_0xd37ea7<_0xe8f7ce[_0xd2ff('0x21')];_0xd37ea7++){if(_0xe8f7ce[_0xd37ea7]['telephone1']===_0xc1fb07){_0x1e2421=!![];_0x5128a2[_0xd2ff('0x2a')]=_0xe8f7ce[_0xd37ea7][_0xd2ff('0x2d')];}}return _0x1e2421;})[_0xd2ff('0xe')](function(_0x3d3d50){if(_0x3d3d50)return _0x5128a2;if(_0x30e6f6===_0xd2ff('0x2e')){logger[_0xd2ff('0x1f')]('['+[_0x153c63[_0xd2ff('0x11')]()]+_0xd2ff('0x2f'));return _0x5128a2;}return createEndUser(_0x5128a2,_0x4034df,_0x36562f,_0x4ed00b,_0x52ff58,_0x153c63)[_0xd2ff('0xe')](function(_0x17bcbc){logger[_0xd2ff('0x1f')]('['+[_0x153c63[_0xd2ff('0x11')]()]+_0xd2ff('0x30'),_0x17bcbc[_0xd2ff('0x2a')]);return _0x17bcbc;});});}function getCustomFields(_0x188dcb,_0x4a9746,_0x1111a6){var _0x4a5551={};if(_0x188dcb[_0xd2ff('0x21')]>0x0){_[_0xd2ff('0x31')](_0x188dcb,function(_0x476242){if(_[_0xd2ff('0x32')](['string',_0xd2ff('0x33')],_0x476242[_0xd2ff('0x34')])&&_0x476242[_0xd2ff('0x35')]&&!_0x476242[_0xd2ff('0x36')]){var _0x4984dd=_0x476242[_0xd2ff('0x37')]['toLowerCase']();var _0x450409=_0x4984dd[_0xd2ff('0x38')](0x0,_0x4984dd[_0xd2ff('0x39')]('_'));var _0x5d6911=_0x4984dd[_0xd2ff('0x38')](_0x4984dd['indexOf']('_')+0x1);if(_0x450409===_0x1111a6){_0x4a5551[_0x5d6911]=_0x476242['content'];}}});}return _0x4a5551;}function getTicket(_0x213bf1,_0x2bc4b2,_0x42901d,_0x4298c2,_0x261912,_0x20b5ab,_0x25e8d1){return new BPromise(function(_0x11fe91,_0x1c18b5){var _0x5c18cd;return getAuthToken(_0x2bc4b2,_0x42901d,_0x25e8d1)[_0xd2ff('0xe')](function(_0x4976e2){if(_0x20b5ab[_0xd2ff('0x3a')]===_0xd2ff('0x3b')){_0x5c18cd={'method':_0xd2ff('0x9'),'uri':_0x4298c2+'incidents','body':Object[_0xd2ff('0x3c')]({},{'title':intUtil['getString'](_0x20b5ab[_0xd2ff('0x3d')],_0x261912,'\x20'),'description':intUtil[_0xd2ff('0x3e')](_0x20b5ab[_0xd2ff('0x3f')],_0x261912,'\x0a'),'customerid_contact@odata.bind':_0x213bf1['enduserId']?'/contacts('+_0x213bf1[_0xd2ff('0x2a')]+')':undefined,'ownerid@odata.bind':_0xd2ff('0x26')+_0x213bf1[_0xd2ff('0x1e')]+')','caseorigincode':'1'},getCustomFields(_0x20b5ab['Fields'],_0x261912,_0x20b5ab[_0xd2ff('0x3a')])),'headers':{'Authorization':'Bearer\x20'+_0x4976e2,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x20b5ab[_0xd2ff('0x3a')]==='phonecall'){var _0x5cef7b=_0x213bf1[_0xd2ff('0x2a')]?[{'partyid_systemuser@odata.bind':_0xd2ff('0x26')+_0x213bf1[_0xd2ff('0x1e')]+')','participationtypemask':_0x213bf1[_0xd2ff('0x40')]===_0xd2ff('0x41')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x213bf1[_0xd2ff('0x2a')]+')','participationtypemask':_0x213bf1[_0xd2ff('0x40')]===_0xd2ff('0x41')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xd2ff('0x26')+_0x213bf1[_0xd2ff('0x1e')]+')','participationtypemask':_0x213bf1[_0xd2ff('0x40')]==='queue'?0x2:0x1}];_0x5c18cd={'method':_0xd2ff('0x9'),'uri':_0x4298c2+_0xd2ff('0x42'),'body':Object[_0xd2ff('0x3c')]({},{'subject':intUtil[_0xd2ff('0x3e')](_0x20b5ab[_0xd2ff('0x3d')],_0x261912,'\x20'),'phonenumber':String(_0x261912[_0xd2ff('0x24')]),'description':intUtil[_0xd2ff('0x3e')](_0x20b5ab[_0xd2ff('0x3f')],_0x261912,'\x0a'),'regardingobjectid_contact@odata.bind':_0x213bf1[_0xd2ff('0x2a')]?'/contacts('+_0x213bf1['enduserId']+')':undefined,'ownerid@odata.bind':_0xd2ff('0x26')+_0x213bf1[_0xd2ff('0x1e')]+')','directioncode':_0x213bf1[_0xd2ff('0x40')]===_0xd2ff('0x41')?![]:!![],'phonecall_activity_parties':_0x5cef7b},getCustomFields(_0x20b5ab[_0xd2ff('0x43')],_0x261912,_0x20b5ab[_0xd2ff('0x3a')])),'headers':{'Authorization':_0xd2ff('0x15')+_0x4976e2,'OData-Version':_0xd2ff('0x27')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5c18cd);})[_0xd2ff('0xe')](function(_0x1afdf7){var _0x5cf932=_0x1afdf7[_0xd2ff('0x28')][_0xd2ff('0x44')];var _0x1cfbf0=_0x5cf932[_0xd2ff('0x38')](_0x5cf932[_0xd2ff('0x29')]('(')+0x1,_0x5cf932[_0xd2ff('0x29')](')'));_0x213bf1[_0xd2ff('0x45')]=_0x1cfbf0;_0x11fe91(_0x213bf1);})['catch'](function(_0x8d8573){_0x1c18b5(_0x8d8573[_0xd2ff('0x13')]);});});}function emit(_0x1c2dcb,_0x36aaa9,_0xfcae2c,_0x44120a){var _0xc0fae7={'uri':util[_0xd2ff('0x46')](_0xd2ff('0x47'),_0x1c2dcb,_0xfcae2c,_0x44120a)};io['to'](util[_0xd2ff('0x46')](_0xd2ff('0x48'),_0x36aaa9))['emit'](_0xd2ff('0x49'),_0xc0fae7);}exports['cs']=function(_0x59bed0,_0x25f76a,_0x5ab293,_0x2da98e,_0x1c5701,_0x50228e,_0x357fb6,_0x26c701){var _0x51e691={};_0x50228e[_0xd2ff('0xa')]=intUtil['stripTrailingSlash'](_0x50228e[_0xd2ff('0xa')]);_0x50228e[_0xd2ff('0x4a')]=intUtil[_0xd2ff('0x4b')](_0x50228e[_0xd2ff('0x4a')]);_0x51e691[_0xd2ff('0x40')]=_0x26c701===_0xd2ff('0x41')||_0x26c701==='unmanaged'?_0xd2ff('0x41'):'outbound';var _0x5e9f31=util['format'](_0xd2ff('0x4c'),_0x50228e[_0xd2ff('0xa')]);var _0x2254d5=util['format']('https://login.microsoftonline.com/%s/oauth2/token',_0x50228e[_0xd2ff('0x4d')]);var _0xb298c6=util[_0xd2ff('0x46')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x50228e[_0xd2ff('0x4a')],_0x25f76a[_0xd2ff('0x4e')],md5(_0x25f76a[_0xd2ff('0x4e')]));if(_0x1c5701&&_0x1c5701['monitor_format']){logger[_0xd2ff('0x1f')]('[QUEUE]',_0xd2ff('0x4f'));_0x25f76a[_0xd2ff('0x50')]=_0xb298c6;}else if(_0x357fb6&&_0x357fb6[_0xd2ff('0x51')]&&_0x357fb6[_0xd2ff('0x51')]!=='none'){logger[_0xd2ff('0x1f')](_0xd2ff('0x52'),_0xd2ff('0x4f'));_0x25f76a['recordingURL']=_0xb298c6;}else{_0x25f76a['recordingURL']='';}return getUser(_0x51e691,_0x50228e,_0x2da98e,_0x2254d5,_0x5e9f31,_0x26c701)[_0xd2ff('0xe')](function(_0xb8efd5){logger[_0xd2ff('0x1f')]('['+_0x26c701[_0xd2ff('0x11')]()+_0xd2ff('0x53'),_0xb8efd5[_0xd2ff('0x1e')]);logger[_0xd2ff('0x1f')]('['+_0x26c701[_0xd2ff('0x11')]()+_0xd2ff('0x54'),_0xb8efd5[_0xd2ff('0x18')]);return getEndUser(_0xb8efd5,_0x50228e,_0x2254d5,_0x5e9f31,_0x25f76a,_0x26c701,_0x5ab293[_0xd2ff('0x55')]);})[_0xd2ff('0xe')](function(_0x2db9d8){logger['info']('['+_0x26c701[_0xd2ff('0x11')]()+_0xd2ff('0x56'),_0x2db9d8[_0xd2ff('0x2a')]);logger[_0xd2ff('0x1f')]('['+_0x26c701[_0xd2ff('0x11')]()+_0xd2ff('0x57'),_0x25f76a[_0xd2ff('0x24')]);return getTicket(_0x2db9d8,_0x50228e,_0x2254d5,_0x5e9f31,_0x25f76a,_0x5ab293,_0x26c701);})['then'](function(_0x42b889){logger[_0xd2ff('0x1f')](util[_0xd2ff('0x46')]('['+_0x26c701[_0xd2ff('0x11')]()+_0xd2ff('0x58'),_0x5ab293[_0xd2ff('0x3a')],_0x42b889[_0xd2ff('0x45')]));logger[_0xd2ff('0x1f')](util[_0xd2ff('0x46')]('['+_0x26c701[_0xd2ff('0x11')]()+_0xd2ff('0x59'),_0x26c701));if(_0x26c701!=='unmanaged'){logger[_0xd2ff('0x1f')]('['+_0x26c701[_0xd2ff('0x11')]()+']',_0xd2ff('0x5a'));emit(_0x50228e[_0xd2ff('0xa')],_0x2da98e[_0xd2ff('0x5b')],_0x5ab293[_0xd2ff('0x3a')],_0x42b889['ticketId']);}})[_0xd2ff('0x10')](function(_0xfe2a5a){logger[_0xd2ff('0x5c')]('['+_0x26c701[_0xd2ff('0x11')]()+_0xd2ff('0x5d'),util[_0xd2ff('0x5e')](_0xfe2a5a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index 43d4630..04a0823 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 _0xcaa8=['type','variableName','customVariable','Variable','queue','serverUrl','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','trigger:browser:url','%s/helpdesk/tickets/%d','stringify','stripTrailingSlash','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','Authorization','The\x20User\x20ID\x20is:','destcalleridname','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','unmanaged','lastevent','toUpperCase','The\x20Ticket\x20ID\x20is:','lodash','request-promise','util','ioredis','./util','../../../../config/environment','freshdesk','redis','defaults','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','validateEmail','format','%s/api/v2/agents','length','Agent\x20found!','contact','info','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','apiKey','base64','debug','[HTTP]','GET','includes','string','picklist','customField','nameField','toLowerCase','toString','push','idField','content'];(function(_0xf4eafd,_0x4363bd){var _0x2a3fd6=function(_0x41cfbb){while(--_0x41cfbb){_0xf4eafd['push'](_0xf4eafd['shift']());}};_0x2a3fd6(++_0x4363bd);}(_0xcaa8,0xdb));var _0x8caa=function(_0x4e72e8,_0x201b63){_0x4e72e8=_0x4e72e8-0x0;var _0xbbd405=_0xcaa8[_0x4e72e8];return _0xbbd405;};'use strict';var _=require(_0x8caa('0x0'));var rp=require(_0x8caa('0x1'));var md5=require('md5');var util=require(_0x8caa('0x2'));var Redis=require(_0x8caa('0x3'));var intUtil=require(_0x8caa('0x4'));var config=require(_0x8caa('0x5'));var logger=require('../../../../config/logger')(_0x8caa('0x6'));config[_0x8caa('0x7')]=_[_0x8caa('0x8')](config[_0x8caa('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x8caa('0x9'))(new Redis(config['redis']));var headers={'Content-Type':_0x8caa('0xa'),'Accept':_0x8caa('0xa')};function emit(_0x2ec57a,_0x43d063,_0x839052){io['to'](_0x2ec57a)[_0x8caa('0xb')](_0x43d063,_0x839052);}function getTicket(_0x1c7522,_0x20cf9d,_0x5c410f,_0x54c491,_0x53ec2f){logger['info'](_0x8caa('0xc'));var _0x24ff4f=_[_0x8caa('0xd')]({'responder_id':_0x20cf9d['id'],'requester_id':_0x5c410f['id'],'name':util['format'](_0x8caa('0xe'),_0x53ec2f[_0x8caa('0xf')]),'phone':_0x53ec2f[_0x8caa('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x8caa('0x11')](_0x54c491[_0x8caa('0x12')],_0x53ec2f,'\x20'),'description':intUtil[_0x8caa('0x11')](_0x54c491[_0x8caa('0x13')],_0x53ec2f,'
'),'tags':getTags(_0x54c491[_0x8caa('0x14')],_0x8caa('0x15'))},getCustomFields(_0x54c491[_0x8caa('0x16')],_0x53ec2f));_0x24ff4f[_0x8caa('0x17')]=_[_0x8caa('0x18')](_[_0x8caa('0x19')](_0x24ff4f[_0x8caa('0x17')],'id'),_0x8caa('0x1a'));return request({'uri':util['format'](_0x8caa('0x1b'),_0x1c7522[_0x8caa('0x1c')]),'method':'POST','body':_0x24ff4f})[_0x8caa('0x1d')](function(_0x1f54d2){logger['info'](_0x8caa('0x1e'));return _0x1f54d2;});}function getUser(_0x48970b,_0x11f174){if(intUtil[_0x8caa('0x1f')](_0x11f174)){return request({'uri':util[_0x8caa('0x20')](_0x8caa('0x21'),_0x48970b[_0x8caa('0x1c')]),'qs':{'email':_0x11f174}})[_0x8caa('0x1d')](function(_0x3f4ac7){if(_0x3f4ac7[_0x8caa('0x22')]){logger['info'](_0x8caa('0x23'));return _['find'](_0x3f4ac7,function(_0x345243){return _0x345243[_0x8caa('0x24')]['email']===_0x11f174;});}else{logger[_0x8caa('0x25')](_0x8caa('0x26'));return request({'uri':util['format'](_0x8caa('0x27'),_0x48970b['remoteUri'])})[_0x8caa('0x1d')](function(_0x223db4){logger['info'](_0x8caa('0x28'));return _0x223db4;});}});}else{logger[_0x8caa('0x25')](_0x8caa('0x29'));return request({'uri':util[_0x8caa('0x20')]('%s/api/v2/agents/me',_0x48970b[_0x8caa('0x1c')])})[_0x8caa('0x1d')](function(_0x2c58f5){logger['info'](_0x8caa('0x28'));return _0x2c58f5;});}}function getEndUser(_0x54a060,_0x56d1b0,_0x1eba51){logger[_0x8caa('0x25')](_0x8caa('0x2a'),_0x1eba51);return request({'uri':util['format'](_0x8caa('0x2b'),_0x54a060[_0x8caa('0x1c')]),'qs':{'phone':_0x1eba51}})['then'](function(_0x4d77bc){if(_0x4d77bc[_0x8caa('0x22')]){logger[_0x8caa('0x25')]('Enduser\x20found!');return _[_0x8caa('0x2c')](_0x4d77bc,{'phone':_0x1eba51});}else{logger[_0x8caa('0x25')](_0x8caa('0x2d'));return request({'uri':util[_0x8caa('0x20')]('%s/api/v2/contacts',_0x54a060[_0x8caa('0x1c')]),'method':_0x8caa('0x2e'),'body':{'name':_0x56d1b0,'phone':_0x1eba51}})['then'](function(_0x4b13ad){logger[_0x8caa('0x25')](_0x8caa('0x2f'));return _0x4b13ad;});}});}function getAuth(_0x1c2c5c){return util[_0x8caa('0x20')]('Basic\x20%s',new Buffer(_0x1c2c5c[_0x8caa('0x30')]+':X')['toString'](_0x8caa('0x31')));}function request(_0x20a470){logger[_0x8caa('0x32')](_0x8caa('0x33'),JSON['stringify'](_0x20a470));return rp(_[_0x8caa('0x8')](_0x20a470,{'method':_0x8caa('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x2f6e23,_0x4bf6c9){var _0x7f2f74=[];if(_0x2f6e23&&_0x2f6e23[_0x8caa('0x22')]>0x0){_0x7f2f74=_['map'](_0x2f6e23,_0x4bf6c9);}return _0x7f2f74;}function getCustomFields(_0xace973,_0x4bff14){var _0x5c50bb=[];var _0x239670={'custom_fields':[]};if(_0xace973[_0x8caa('0x22')]>0x0){_['forEach'](_0xace973,function(_0x5d968e){if(_[_0x8caa('0x35')]([_0x8caa('0x36'),_0x8caa('0x37')],_0x5d968e['type'])&&_0x5d968e['nameField']&&!_0x5d968e[_0x8caa('0x38')]){_0x239670[_0x5d968e[_0x8caa('0x39')][_0x8caa('0x3a')]()]=_0x5d968e['content'][_0x8caa('0x3b')]();}else if(_[_0x8caa('0x35')]([_0x8caa('0x36'),_0x8caa('0x37')],_0x5d968e['type'])&&_0x5d968e['idField']&&_0x5d968e['customField']){_0x239670[_0x8caa('0x17')][_0x8caa('0x3c')]({'id':_0x5d968e[_0x8caa('0x3d')],'value':_0x5d968e[_0x8caa('0x3e')][_0x8caa('0x3b')]()});}else if(_0x5d968e[_0x8caa('0x3f')]==='variable'&&_0x5d968e[_0x8caa('0x40')]&&_0x5d968e['idField']&&_0x5d968e['customField']){_0x4bff14[_0x5d968e[_0x8caa('0x40')]]&&_0x239670['custom_fields'][_0x8caa('0x3c')]({'id':_0x5d968e['idField'],'value':_0x4bff14[_0x5d968e[_0x8caa('0x40')]][_0x8caa('0x3b')]()});}else if(_0x5d968e[_0x8caa('0x3f')]===_0x8caa('0x41')&&_0x5d968e[_0x8caa('0x42')]&&_0x5d968e['Variable'][_0x8caa('0x15')]&&_0x5d968e[_0x8caa('0x3d')]&&_0x5d968e[_0x8caa('0x38')]){_0x4bff14[_0x5d968e['Variable'][_0x8caa('0x15')]['toLowerCase']()]&&_0x239670['custom_fields'][_0x8caa('0x3c')]({'id':_0x5d968e[_0x8caa('0x3d')],'value':_0x4bff14[_0x5d968e['Variable']['name'][_0x8caa('0x3a')]()][_0x8caa('0x3b')]()});}});}return _0x239670;}exports[_0x8caa('0x43')]=function(_0x3c4673,_0x41ed02,_0x69ebed,_0x2a5b89,_0x2e8335,_0x48558f){var _0x3e088a,_0x3d660f;_0x48558f[_0x8caa('0x1c')]=intUtil['stripTrailingSlash'](_0x48558f[_0x8caa('0x1c')]);_0x48558f['serverUrl']=intUtil['stripTrailingSlash'](_0x48558f[_0x8caa('0x44')]);if(_0x2e8335&&_0x2e8335[_0x8caa('0x45')]){logger['info'](_0x8caa('0x46'),'Recording\x20is\x20enabled!');_0x41ed02['recordingURL']=util[_0x8caa('0x20')](_0x8caa('0x47'),_0x48558f[_0x8caa('0x44')],_0x41ed02[_0x8caa('0x48')],md5(_0x41ed02[_0x8caa('0x48')]));}else{_0x41ed02[_0x8caa('0x49')]='';}headers['Authorization']=getAuth(_0x48558f);return getUser(_0x48558f,_0x2a5b89[_0x8caa('0x4a')])['then'](function(_0x2b153c){_0x3e088a=_0x2b153c;logger[_0x8caa('0x25')]('The\x20User\x20ID\x20is:',_0x3e088a['id']);return getEndUser(_0x48558f,_0x41ed02['calleridname'],_0x41ed02[_0x8caa('0x10')]);})['then'](function(_0x4ff907){_0x3d660f=_0x4ff907;logger[_0x8caa('0x25')]('The\x20Enduser\x20ID\x20is:',_0x3d660f['id']);return getTicket(_0x48558f,_0x3e088a,_0x3d660f,_0x69ebed,_0x41ed02);})['then'](function(_0x1223f7){if(_0x1223f7&&_0x1223f7['id']){logger[_0x8caa('0x25')](_0x8caa('0x1e'));logger[_0x8caa('0x25')]('The\x20Ticket\x20ID\x20is:',_0x1223f7['id']);logger[_0x8caa('0x25')](_0x8caa('0x46'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x8caa('0x20')]('user:%s',_0x2a5b89['name']),_0x8caa('0x4b'),{'uri':util['format'](_0x8caa('0x4c'),_0x48558f['remoteUri'],_0x1223f7['id'])});}})['catch'](function(_0x326122){logger['error']('[QUEUE]',JSON[_0x8caa('0x4d')](_0x326122));});};exports['outbound']=function(_0x13c3be,_0x558094,_0xddd6c9,_0x4017a6,_0x1cecfa,_0x316580,_0x5a82eb){var _0x363e39,_0x11aedf;_0x316580[_0x8caa('0x1c')]=intUtil['stripTrailingSlash'](_0x316580[_0x8caa('0x1c')]);_0x316580['serverUrl']=intUtil[_0x8caa('0x4e')](_0x316580['serverUrl']);if(_0x5a82eb&&_0x5a82eb[_0x8caa('0x4f')]&&_0x5a82eb[_0x8caa('0x4f')]!=='none'){logger['info'](_0x8caa('0x50'),_0x8caa('0x51'));_0x558094[_0x8caa('0x49')]=util[_0x8caa('0x20')](_0x8caa('0x47'),_0x316580['serverUrl'],_0x558094['uniqueid'],md5(_0x558094[_0x8caa('0x48')]));}headers[_0x8caa('0x52')]=getAuth(_0x316580);return getUser(_0x316580,_0x4017a6[_0x8caa('0x4a')])[_0x8caa('0x1d')](function(_0x5446a1){_0x363e39=_0x5446a1;logger['info'](_0x8caa('0x53'),_0x363e39['id']);return getEndUser(_0x316580,_0x558094[_0x8caa('0x54')],_0x558094['destcalleridnum']);})[_0x8caa('0x1d')](function(_0x59929e){_0x11aedf=_0x59929e;logger[_0x8caa('0x25')](_0x8caa('0x55'),_0x11aedf['id']);return getTicket(_0x316580,_0x363e39,_0x11aedf,_0xddd6c9,_0x558094);})[_0x8caa('0x1d')](function(_0x50fe07){if(_0x50fe07&&_0x50fe07['id']){logger[_0x8caa('0x25')](_0x8caa('0x1e'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x50fe07['id']);logger[_0x8caa('0x25')](_0x8caa('0x50'),_0x8caa('0x56'));emit(util[_0x8caa('0x20')](_0x8caa('0x57'),_0x4017a6[_0x8caa('0x15')]),_0x8caa('0x4b'),{'uri':util['format'](_0x8caa('0x4c'),_0x316580[_0x8caa('0x1c')],_0x50fe07['id'])});}})[_0x8caa('0x58')](function(_0x201edc){logger[_0x8caa('0x59')](_0x8caa('0x50'),JSON['stringify'](_0x201edc));});};exports[_0x8caa('0x5a')]=function(_0xb33e9,_0x2f8bef,_0x5630d3,_0x15e67c,_0x211811,_0xf646ac){var _0x4ad23c,_0x3ac916;_0xf646ac[_0x8caa('0x1c')]=intUtil[_0x8caa('0x4e')](_0xf646ac['remoteUri']);_0xf646ac['serverUrl']=intUtil[_0x8caa('0x4e')](_0xf646ac[_0x8caa('0x44')]);if(_0x211811&&_0x211811[_0x8caa('0x45')]){logger[_0x8caa('0x25')]('['+_0x2f8bef[_0x8caa('0x5b')][_0x8caa('0x5c')]()+']',_0x8caa('0x51'));_0x2f8bef[_0x8caa('0x49')]=util['format'](_0x8caa('0x47'),_0xf646ac['serverUrl'],_0x2f8bef[_0x8caa('0x48')],md5(_0x2f8bef[_0x8caa('0x48')]));}else{_0x2f8bef[_0x8caa('0x49')]='';}headers[_0x8caa('0x52')]=getAuth(_0xf646ac);return getUser(_0xf646ac,'')['then'](function(_0x154eea){_0x4ad23c=_0x154eea;logger['info'](_0x8caa('0x53'),_0x4ad23c['id']);return getEndUser(_0xf646ac,_0x2f8bef[_0x8caa('0xf')],_0x2f8bef[_0x8caa('0x10')]);})[_0x8caa('0x1d')](function(_0x37a1e8){_0x3ac916=_0x37a1e8;logger['info'](_0x8caa('0x55'),_0x3ac916['id']);return getTicket(_0xf646ac,_0x4ad23c,_0x3ac916,_0x5630d3,_0x2f8bef);})[_0x8caa('0x1d')](function(_0x5415d6){if(_0x5415d6){logger[_0x8caa('0x25')](_0x8caa('0x1e'));logger['info'](_0x8caa('0x5d'),_0x5415d6['id']);}})[_0x8caa('0x58')](function(_0x37a10f){logger[_0x8caa('0x59')]('['+_0x2f8bef['lastevent']['toUpperCase']()+']',JSON[_0x8caa('0x4d')](_0x37a10f));});}; \ No newline at end of file +var _0x6b0c=['info','Creating\x20new\x20ticket...','merge','format','calleridnum','getString','Descriptions','Tags','name','Fields','custom_fields','%s/api/v2/tickets','remoteUri','then','validateEmail','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','Basic\x20%s','apiKey','base64','[HTTP]','stringify','GET','picklist','type','customField','nameField','toLowerCase','content','includes','toString','variable','variableName','idField','customVariable','Variable','stripTrailingSlash','serverUrl','[QUEUE]','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','Ticket\x20created!','monitor_format','lastevent','toUpperCase','calleridname','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit'];(function(_0x30bc6d,_0x43bc05){var _0x217931=function(_0xe1bb8e){while(--_0xe1bb8e){_0x30bc6d['push'](_0x30bc6d['shift']());}};_0x217931(++_0x43bc05);}(_0x6b0c,0x151));var _0xc6b0=function(_0x197a38,_0xada78c){_0x197a38=_0x197a38-0x0;var _0x56e316=_0x6b0c[_0x197a38];return _0x56e316;};'use strict';var _=require(_0xc6b0('0x0'));var rp=require(_0xc6b0('0x1'));var md5=require(_0xc6b0('0x2'));var util=require(_0xc6b0('0x3'));var Redis=require(_0xc6b0('0x4'));var intUtil=require(_0xc6b0('0x5'));var config=require(_0xc6b0('0x6'));var logger=require(_0xc6b0('0x7'))(_0xc6b0('0x8'));config[_0xc6b0('0x9')]=_[_0xc6b0('0xa')](config[_0xc6b0('0x9')],{'host':_0xc6b0('0xb'),'port':0x18eb});var io=require(_0xc6b0('0xc'))(new Redis(config[_0xc6b0('0x9')]));var headers={'Content-Type':_0xc6b0('0xd'),'Accept':_0xc6b0('0xd')};function emit(_0x2a18e7,_0x1420b5,_0x1fed51){io['to'](_0x2a18e7)[_0xc6b0('0xe')](_0x1420b5,_0x1fed51);}function getTicket(_0x400e9e,_0x49d1ad,_0x4d8bce,_0x5cb111,_0x4f250a){logger[_0xc6b0('0xf')](_0xc6b0('0x10'));var _0x440216=_[_0xc6b0('0x11')]({'responder_id':_0x49d1ad['id'],'requester_id':_0x4d8bce['id'],'name':util[_0xc6b0('0x12')]('Caller\x20-\x20%s',_0x4f250a['calleridname']),'phone':_0x4f250a[_0xc6b0('0x13')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xc6b0('0x14')](_0x5cb111['Subjects'],_0x4f250a,'\x20'),'description':intUtil[_0xc6b0('0x14')](_0x5cb111[_0xc6b0('0x15')],_0x4f250a,'
'),'tags':getTags(_0x5cb111[_0xc6b0('0x16')],_0xc6b0('0x17'))},getCustomFields(_0x5cb111[_0xc6b0('0x18')],_0x4f250a));_0x440216['custom_fields']=_['mapValues'](_['keyBy'](_0x440216[_0xc6b0('0x19')],'id'),'value');return request({'uri':util['format'](_0xc6b0('0x1a'),_0x400e9e[_0xc6b0('0x1b')]),'method':'POST','body':_0x440216})[_0xc6b0('0x1c')](function(_0xd79508){logger[_0xc6b0('0xf')]('Ticket\x20created!');return _0xd79508;});}function getUser(_0x2721f2,_0xecefa8){if(intUtil[_0xc6b0('0x1d')](_0xecefa8)){return request({'uri':util['format']('%s/api/v2/agents',_0x2721f2[_0xc6b0('0x1b')]),'qs':{'email':_0xecefa8}})[_0xc6b0('0x1c')](function(_0x5f5b5a){if(_0x5f5b5a['length']){logger[_0xc6b0('0xf')]('Agent\x20found!');return _[_0xc6b0('0x1e')](_0x5f5b5a,function(_0x5e1ae0){return _0x5e1ae0[_0xc6b0('0x1f')][_0xc6b0('0x20')]===_0xecefa8;});}else{logger[_0xc6b0('0xf')](_0xc6b0('0x21'));return request({'uri':util[_0xc6b0('0x12')](_0xc6b0('0x22'),_0x2721f2[_0xc6b0('0x1b')])})[_0xc6b0('0x1c')](function(_0x1c6ca2){logger[_0xc6b0('0xf')]('Admin\x20account\x20selected.');return _0x1c6ca2;});}});}else{logger[_0xc6b0('0xf')](_0xc6b0('0x23'));return request({'uri':util[_0xc6b0('0x12')](_0xc6b0('0x22'),_0x2721f2['remoteUri'])})[_0xc6b0('0x1c')](function(_0x104efb){logger[_0xc6b0('0xf')]('Admin\x20account\x20selected.');return _0x104efb;});}}function getEndUser(_0x2340d4,_0x5e77e1,_0x56291d){logger[_0xc6b0('0xf')](_0xc6b0('0x24'),_0x56291d);return request({'uri':util['format'](_0xc6b0('0x25'),_0x2340d4[_0xc6b0('0x1b')]),'qs':{'phone':_0x56291d}})[_0xc6b0('0x1c')](function(_0x3f75ba){if(_0x3f75ba[_0xc6b0('0x26')]){logger[_0xc6b0('0xf')]('Enduser\x20found!');return _['find'](_0x3f75ba,{'phone':_0x56291d});}else{logger[_0xc6b0('0xf')](_0xc6b0('0x27'));return request({'uri':util[_0xc6b0('0x12')](_0xc6b0('0x25'),_0x2340d4['remoteUri']),'method':_0xc6b0('0x28'),'body':{'name':_0x5e77e1,'phone':_0x56291d}})[_0xc6b0('0x1c')](function(_0xb47ef2){logger['info'](_0xc6b0('0x29'));return _0xb47ef2;});}});}function getAuth(_0x874ab1){return util[_0xc6b0('0x12')](_0xc6b0('0x2a'),new Buffer(_0x874ab1[_0xc6b0('0x2b')]+':X')['toString'](_0xc6b0('0x2c')));}function request(_0xb6a031){logger['debug'](_0xc6b0('0x2d'),JSON[_0xc6b0('0x2e')](_0xb6a031));return rp(_[_0xc6b0('0xa')](_0xb6a031,{'method':_0xc6b0('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x324d5d,_0x384f91){var _0xb24874=[];if(_0x324d5d&&_0x324d5d[_0xc6b0('0x26')]>0x0){_0xb24874=_['map'](_0x324d5d,_0x384f91);}return _0xb24874;}function getCustomFields(_0x47663f,_0x33e710){var _0x4a9cb5=[];var _0x3e60c1={'custom_fields':[]};if(_0x47663f['length']>0x0){_['forEach'](_0x47663f,function(_0x263085){if(_['includes'](['string',_0xc6b0('0x30')],_0x263085[_0xc6b0('0x31')])&&_0x263085['nameField']&&!_0x263085[_0xc6b0('0x32')]){_0x3e60c1[_0x263085[_0xc6b0('0x33')][_0xc6b0('0x34')]()]=_0x263085[_0xc6b0('0x35')]['toString']();}else if(_[_0xc6b0('0x36')](['string','picklist'],_0x263085[_0xc6b0('0x31')])&&_0x263085['idField']&&_0x263085[_0xc6b0('0x32')]){_0x3e60c1[_0xc6b0('0x19')]['push']({'id':_0x263085['idField'],'value':_0x263085[_0xc6b0('0x35')][_0xc6b0('0x37')]()});}else if(_0x263085[_0xc6b0('0x31')]===_0xc6b0('0x38')&&_0x263085[_0xc6b0('0x39')]&&_0x263085[_0xc6b0('0x3a')]&&_0x263085[_0xc6b0('0x32')]){_0x33e710[_0x263085['variableName']]&&_0x3e60c1['custom_fields']['push']({'id':_0x263085[_0xc6b0('0x3a')],'value':_0x33e710[_0x263085['variableName']]['toString']()});}else if(_0x263085['type']===_0xc6b0('0x3b')&&_0x263085[_0xc6b0('0x3c')]&&_0x263085['Variable'][_0xc6b0('0x17')]&&_0x263085[_0xc6b0('0x3a')]&&_0x263085[_0xc6b0('0x32')]){_0x33e710[_0x263085[_0xc6b0('0x3c')][_0xc6b0('0x17')][_0xc6b0('0x34')]()]&&_0x3e60c1[_0xc6b0('0x19')]['push']({'id':_0x263085[_0xc6b0('0x3a')],'value':_0x33e710[_0x263085[_0xc6b0('0x3c')][_0xc6b0('0x17')][_0xc6b0('0x34')]()][_0xc6b0('0x37')]()});}});}return _0x3e60c1;}exports['queue']=function(_0x107642,_0x41af7c,_0x462cd3,_0x5c9c67,_0x4256b6,_0x23b304){var _0x2d5b4a,_0x94fb2a;_0x23b304[_0xc6b0('0x1b')]=intUtil[_0xc6b0('0x3d')](_0x23b304[_0xc6b0('0x1b')]);_0x23b304[_0xc6b0('0x3e')]=intUtil[_0xc6b0('0x3d')](_0x23b304[_0xc6b0('0x3e')]);if(_0x4256b6&&_0x4256b6['monitor_format']){logger[_0xc6b0('0xf')](_0xc6b0('0x3f'),'Recording\x20is\x20enabled!');_0x41af7c['recordingURL']=util[_0xc6b0('0x12')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x23b304[_0xc6b0('0x3e')],_0x41af7c[_0xc6b0('0x40')],md5(_0x41af7c[_0xc6b0('0x40')]));}else{_0x41af7c[_0xc6b0('0x41')]='';}headers[_0xc6b0('0x42')]=getAuth(_0x23b304);return getUser(_0x23b304,_0x5c9c67[_0xc6b0('0x20')])[_0xc6b0('0x1c')](function(_0x1dfca0){_0x2d5b4a=_0x1dfca0;logger[_0xc6b0('0xf')](_0xc6b0('0x43'),_0x2d5b4a['id']);return getEndUser(_0x23b304,_0x41af7c['calleridname'],_0x41af7c[_0xc6b0('0x13')]);})['then'](function(_0x123879){_0x94fb2a=_0x123879;logger[_0xc6b0('0xf')](_0xc6b0('0x44'),_0x94fb2a['id']);return getTicket(_0x23b304,_0x2d5b4a,_0x94fb2a,_0x462cd3,_0x41af7c);})[_0xc6b0('0x1c')](function(_0x22d94b){if(_0x22d94b&&_0x22d94b['id']){logger[_0xc6b0('0xf')]('Ticket\x20created!');logger[_0xc6b0('0xf')](_0xc6b0('0x45'),_0x22d94b['id']);logger[_0xc6b0('0xf')]('[QUEUE]',_0xc6b0('0x46'));emit(util['format'](_0xc6b0('0x47'),_0x5c9c67[_0xc6b0('0x17')]),_0xc6b0('0x48'),{'uri':util[_0xc6b0('0x12')](_0xc6b0('0x49'),_0x23b304['remoteUri'],_0x22d94b['id'])});}})[_0xc6b0('0x4a')](function(_0x268647){logger[_0xc6b0('0x4b')](_0xc6b0('0x3f'),JSON['stringify'](_0x268647));});};exports[_0xc6b0('0x4c')]=function(_0x6d5a51,_0x57ef1b,_0x20cdfb,_0x2bc742,_0xf3efd3,_0x32f2d0,_0x5e8864){var _0x4f0b90,_0x35170b;_0x32f2d0[_0xc6b0('0x1b')]=intUtil['stripTrailingSlash'](_0x32f2d0[_0xc6b0('0x1b')]);_0x32f2d0[_0xc6b0('0x3e')]=intUtil[_0xc6b0('0x3d')](_0x32f2d0[_0xc6b0('0x3e')]);if(_0x5e8864&&_0x5e8864[_0xc6b0('0x4d')]&&_0x5e8864[_0xc6b0('0x4d')]!==_0xc6b0('0x4e')){logger[_0xc6b0('0xf')](_0xc6b0('0x4f'),_0xc6b0('0x50'));_0x57ef1b[_0xc6b0('0x41')]=util[_0xc6b0('0x12')](_0xc6b0('0x51'),_0x32f2d0[_0xc6b0('0x3e')],_0x57ef1b['uniqueid'],md5(_0x57ef1b[_0xc6b0('0x40')]));}headers[_0xc6b0('0x42')]=getAuth(_0x32f2d0);return getUser(_0x32f2d0,_0x2bc742['email'])['then'](function(_0x3b1b50){_0x4f0b90=_0x3b1b50;logger['info'](_0xc6b0('0x43'),_0x4f0b90['id']);return getEndUser(_0x32f2d0,_0x57ef1b['destcalleridname'],_0x57ef1b[_0xc6b0('0x52')]);})[_0xc6b0('0x1c')](function(_0x44aab7){_0x35170b=_0x44aab7;logger[_0xc6b0('0xf')]('The\x20Enduser\x20ID\x20is:',_0x35170b['id']);return getTicket(_0x32f2d0,_0x4f0b90,_0x35170b,_0x20cdfb,_0x57ef1b);})[_0xc6b0('0x1c')](function(_0x14c385){if(_0x14c385&&_0x14c385['id']){logger[_0xc6b0('0xf')](_0xc6b0('0x53'));logger[_0xc6b0('0xf')](_0xc6b0('0x45'),_0x14c385['id']);logger[_0xc6b0('0xf')](_0xc6b0('0x4f'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc6b0('0x12')](_0xc6b0('0x47'),_0x2bc742[_0xc6b0('0x17')]),_0xc6b0('0x48'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x32f2d0[_0xc6b0('0x1b')],_0x14c385['id'])});}})[_0xc6b0('0x4a')](function(_0x53fa95){logger[_0xc6b0('0x4b')](_0xc6b0('0x4f'),JSON[_0xc6b0('0x2e')](_0x53fa95));});};exports['unmanaged']=function(_0x377c7d,_0x40de37,_0x280410,_0x4e79e6,_0x2701ed,_0x3a17cf){var _0x7e28c7,_0x48e278;_0x3a17cf[_0xc6b0('0x1b')]=intUtil['stripTrailingSlash'](_0x3a17cf[_0xc6b0('0x1b')]);_0x3a17cf[_0xc6b0('0x3e')]=intUtil['stripTrailingSlash'](_0x3a17cf[_0xc6b0('0x3e')]);if(_0x2701ed&&_0x2701ed[_0xc6b0('0x54')]){logger[_0xc6b0('0xf')]('['+_0x40de37[_0xc6b0('0x55')][_0xc6b0('0x56')]()+']',_0xc6b0('0x50'));_0x40de37[_0xc6b0('0x41')]=util[_0xc6b0('0x12')](_0xc6b0('0x51'),_0x3a17cf[_0xc6b0('0x3e')],_0x40de37['uniqueid'],md5(_0x40de37[_0xc6b0('0x40')]));}else{_0x40de37[_0xc6b0('0x41')]='';}headers[_0xc6b0('0x42')]=getAuth(_0x3a17cf);return getUser(_0x3a17cf,'')[_0xc6b0('0x1c')](function(_0x36e0b5){_0x7e28c7=_0x36e0b5;logger[_0xc6b0('0xf')]('The\x20User\x20ID\x20is:',_0x7e28c7['id']);return getEndUser(_0x3a17cf,_0x40de37[_0xc6b0('0x57')],_0x40de37[_0xc6b0('0x13')]);})[_0xc6b0('0x1c')](function(_0x43e900){_0x48e278=_0x43e900;logger['info'](_0xc6b0('0x44'),_0x48e278['id']);return getTicket(_0x3a17cf,_0x7e28c7,_0x48e278,_0x280410,_0x40de37);})[_0xc6b0('0x1c')](function(_0x30c67f){if(_0x30c67f){logger[_0xc6b0('0xf')](_0xc6b0('0x53'));logger[_0xc6b0('0xf')](_0xc6b0('0x45'),_0x30c67f['id']);}})['catch'](function(_0x3d0a38){logger[_0xc6b0('0x4b')]('['+_0x40de37['lastevent'][_0xc6b0('0x56')]()+']',JSON[_0xc6b0('0x2e')](_0x3d0a38));});}; \ 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 ea7a0af..3747ac6 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 _0x458c=['&entities=contact','contacts','format','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','contact','Creating\x20new\x20task','Subjects','getString','Descriptions','add','YYYY-MM-DDTHH:mm:ss','ticketId','task','Task\x20created:','/contacts/','user:%s','trigger:browser:url','stripTrailingSlash','remoteUri','serverUrl','username','destcalleridnum','calleridnum','queue','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','unmanaged',']\x20Error\x20running\x20Freshsales\x20integration','inspect','md5','util','moment','bluebird','ioredis','./util','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','length','email','adminEmail','adminId','Admin\x20found:','catch','message','GET','Getting\x20user\x20list','users','agentEmail','Getting\x20user\x20with\x20email','userId','User\x20found:','Admin\x20selected','userEmail','Requested\x20Resource\x20not\x20Found','error','toUpperCase','/api/lookup?q=','&f='];(function(_0x3fcf62,_0x5044bc){var _0x154b13=function(_0x335490){while(--_0x335490){_0x3fcf62['push'](_0x3fcf62['shift']());}};_0x154b13(++_0x5044bc);}(_0x458c,0x123));var _0xc458=function(_0x1c156e,_0x3263a6){_0x1c156e=_0x1c156e-0x0;var _0x58fc22=_0x458c[_0x1c156e];return _0x58fc22;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xc458('0x0'));var util=require(_0xc458('0x1'));var moment=require(_0xc458('0x2'));var Promise=require(_0xc458('0x3'));var Redis=require(_0xc458('0x4'));var intUtil=require(_0xc458('0x5'));var config=require('../../../../config/environment');var logger=require(_0xc458('0x6'))(_0xc458('0x7'));config[_0xc458('0x8')]=_[_0xc458('0x9')](config[_0xc458('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xc458('0xa'))(new Redis(config[_0xc458('0x8')]));function getAdminId(_0x3a9ffe,_0x340e0f,_0x35c652,_0x180c5c){return new Promise(function(_0x316570,_0x3dfe85){var _0x380196=![];var _0x650b1b={'method':'GET','uri':_0x180c5c+_0xc458('0xb'),'json':!![]};_0x650b1b[_0xc458('0xc')]=_0x35c652;logger[_0xc458('0xd')](_0xc458('0xe'));return rp(_0x650b1b)[_0xc458('0xf')](function(_0x2ef41c){if(_0x2ef41c){var _0x495c2e=_0x2ef41c['users'];var _0x2a1cad=null;for(_0x2a1cad=0x0;_0x2a1cad<_0x495c2e[_0xc458('0x10')];_0x2a1cad++){if(_0x495c2e[_0x2a1cad][_0xc458('0x11')]===_0x3a9ffe[_0xc458('0x12')]){_0x3a9ffe[_0xc458('0x13')]=_0x495c2e[_0x2a1cad]['id'];_0x380196=!![];}}if(_0x380196){logger['info'](_0xc458('0x14'),_0x3a9ffe['adminId']);_0x316570(_0x3a9ffe);}else{_0x3dfe85({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x3dfe85({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xc458('0x15')](function(_0x4c535c){logger['error']('['+[_0x340e0f['toUpperCase']()]+']',_0x4c535c[_0xc458('0x16')]);_0x3dfe85(_0x4c535c);});});}function getUser(_0x48382e,_0x38f375,_0x5e1ac6){return function(_0x45dcef){return new Promise(function(_0x58e713,_0xe68969){var _0x442239={'method':_0xc458('0x17'),'uri':_0x5e1ac6+_0xc458('0xb'),'json':!![]};_0x442239['headers']=_0x38f375;logger[_0xc458('0xd')](_0xc458('0x18'));return rp(_0x442239)[_0xc458('0xf')](function(_0x29ef42){if(_0x29ef42){var _0x2dcee5=_0x29ef42[_0xc458('0x19')];var _0xaabdc5=![];var _0x39dacd=null;if(_0x45dcef[_0xc458('0x1a')]!==null){logger[_0xc458('0xd')](_0xc458('0x1b'),_0x45dcef[_0xc458('0x1a')]);_0x45dcef['userEmail']=_0x45dcef[_0xc458('0x1a')];for(_0x39dacd=0x0;_0x39dacd<_0x2dcee5[_0xc458('0x10')];_0x39dacd++){if(_0x2dcee5[_0x39dacd][_0xc458('0x11')]===_0x45dcef[_0xc458('0x1a')]){_0xaabdc5=!![];_0x45dcef[_0xc458('0x1c')]=_0x2dcee5[_0x39dacd]['id'];logger[_0xc458('0xd')](_0xc458('0x1d'),_0x45dcef[_0xc458('0x1c')]);}}}if(!_0xaabdc5){logger[_0xc458('0xd')](_0xc458('0x1e'));_0x45dcef[_0xc458('0x1f')]=_0x45dcef['adminEmail'];_0x45dcef[_0xc458('0x1c')]=_0x45dcef['adminId'];_0xaabdc5=!![];}if(_0xaabdc5){_0x58e713(_0x45dcef);}else{_0xe68969({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0xe68969({'statusCode':0x194,'message':_0xc458('0x20')});}})[_0xc458('0x15')](function(_0x361d14){logger[_0xc458('0x21')]('['+[_0x48382e[_0xc458('0x22')]()]+']',_0x361d14[_0xc458('0x16')]);_0xe68969(_0x361d14);});});};}function searchContact(_0xcdc4a0,_0x57f3b8,_0x5c16d6,_0x3d46ef){return new Promise(function(_0x1f0f06,_0x53b350){var _0x306747={'method':_0xc458('0x17'),'headers':_0x57f3b8,'uri':_0xcdc4a0+_0xc458('0x23')+_0x3d46ef+_0xc458('0x24')+_0x5c16d6+_0xc458('0x25'),'json':!![]};rp(_0x306747)[_0xc458('0xf')](function(_0x20aac2){var _0x4f611a=_['find'](_0x20aac2[_0xc458('0x26')][_0xc458('0x26')],[_0x5c16d6,_0x3d46ef]);_0x1f0f06(_0x4f611a);})[_0xc458('0x15')](function(_0x164b82){_0x53b350(_0x164b82);});});}function getEndUser(_0x182977,_0x301f82,_0x2c1d1f){return function(_0x455bdf){return new Promise(function(_0x547b8f,_0x419b3d){logger['info'](util[_0xc458('0x27')]('Searching\x20contact\x20with\x20phone\x20%s',_0x455bdf[_0xc458('0x28')]));searchContact(_0x2c1d1f,_0x301f82,_0xc458('0x29'),_0x455bdf[_0xc458('0x28')])['then'](function(_0xb00e6a){if(_0xb00e6a){_0x455bdf[_0xc458('0x2a')]=_0xb00e6a['id'];logger[_0xc458('0xd')](_0xc458('0x2b'),_0x455bdf[_0xc458('0x2a')]);return _0x547b8f(_0x455bdf);}searchContact(_0x2c1d1f,_0x301f82,_0xc458('0x2c'),_0x455bdf[_0xc458('0x28')])[_0xc458('0xf')](function(_0x546993){if(_0x546993){_0x455bdf[_0xc458('0x2a')]=_0x546993['id'];logger[_0xc458('0xd')](_0xc458('0x2d'),_0x455bdf[_0xc458('0x2a')]);return _0x547b8f(_0x455bdf);}createEndUser(_0x455bdf,_0x182977,_0x301f82,_0x2c1d1f)[_0xc458('0xf')](function(_0x2f4dd6){logger['info'](_0xc458('0x2e'),_0x2f4dd6[_0xc458('0x2a')]);return _0x547b8f(_0x2f4dd6);});});})[_0xc458('0x15')](function(_0x5cd558){_0x419b3d(_0x5cd558);});});};}function createEndUser(_0xeb4566,_0x565b1e,_0xf8136f,_0x29e247){return new Promise(function(_0x73f525,_0x20fae9){var _0x3513ab=moment();var _0x2d274b={'method':_0xc458('0x2f'),'uri':_0x29e247+_0xc458('0x30'),'body':{'contact':{'last_name':_0xeb4566['contactNumber'],'work_number':_0xeb4566[_0xc458('0x28')],'mobile_number':_0xeb4566[_0xc458('0x28')],'owner_id':_0xeb4566['userId'],'created_at':_0x3513ab[_0xc458('0x27')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x2d274b[_0xc458('0xc')]=_0xf8136f;logger['info']('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x2d274b)[_0xc458('0xf')](function(_0x53b705){_0xeb4566[_0xc458('0x2a')]=_0x53b705[_0xc458('0x31')]['id'];_0x73f525(_0xeb4566);})[_0xc458('0x15')](function(_0x464f8c){logger[_0xc458('0x21')]('['+[_0x565b1e[_0xc458('0x22')]()]+']',_0x464f8c[_0xc458('0x16')]);_0x20fae9(_0x464f8c['message']);});});}function getTicket(_0x4e7cc2,_0x577c15,_0x157894,_0xa9a0fe,_0x225585){return function(_0x377e0a){logger['info'](_0xc458('0x32'));return new Promise(function(_0x54d7be,_0x49f78f){var _0x5f13d3=moment();var _0x54adda={'method':_0xc458('0x2f'),'uri':_0x157894+'/api/tasks','body':{'title':intUtil['getString'](_0xa9a0fe[_0xc458('0x33')],_0x225585,'\x20'),'description':intUtil[_0xc458('0x34')](_0xa9a0fe[_0xc458('0x35')],_0x225585,'\x0a'),'owner_id':_0x377e0a[_0xc458('0x1c')],'creater_id':_0x377e0a[_0xc458('0x13')],'targetable_id':_0x377e0a[_0xc458('0x2a')],'targetable_type':'Contact','created_at':_0x5f13d3['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x5f13d3[_0xc458('0x36')](0x1e,'m')[_0xc458('0x27')](_0xc458('0x37'))},'json':!![]};_0x54adda[_0xc458('0xc')]=_0x577c15;return rp(_0x54adda)[_0xc458('0xf')](function(_0x203711){_0x377e0a[_0xc458('0x38')]=_0x203711[_0xc458('0x39')]['id'];logger[_0xc458('0xd')](_0xc458('0x3a'),_0x377e0a[_0xc458('0x38')]);_0x54d7be(_0x377e0a);})['catch'](function(_0x53622c){logger[_0xc458('0x21')]('['+[_0x4e7cc2[_0xc458('0x22')]()]+']',_0x53622c[_0xc458('0x16')]);_0x49f78f(_0x53622c[_0xc458('0x16')]);});});};}function emit(_0x5d42ee,_0x2dceee,_0x45dd35){var _0x5989df={'uri':_0x5d42ee+_0xc458('0x3b')+_0x45dd35};io['to'](util[_0xc458('0x27')](_0xc458('0x3c'),_0x2dceee))['emit'](_0xc458('0x3d'),_0x5989df);}exports['cs']=function(_0x1dc17e,_0x369a5f,_0x2b25b1,_0x515fd6,_0x5127a8,_0x826217,_0x1c60ff,_0x3da732){var _0x4b42ce={};var _0xc16721={'Authorization':'Token\x20token='+_0x826217['apiKey']};_0x826217['remoteUri']=intUtil[_0xc458('0x3e')](_0x826217[_0xc458('0x3f')]);_0x826217[_0xc458('0x40')]=intUtil[_0xc458('0x3e')](_0x826217[_0xc458('0x40')]);var _0x14f507=_0x826217[_0xc458('0x3f')];_0x4b42ce[_0xc458('0x12')]=_0x826217[_0xc458('0x41')];_0x4b42ce[_0xc458('0x28')]=_0x3da732['toLowerCase']()==='outbound'?_0x369a5f[_0xc458('0x42')]:_0x369a5f[_0xc458('0x43')];_0x4b42ce['callDirection']=_0x3da732===_0xc458('0x44')||_0x3da732==='unmanaged'?'queue':_0xc458('0x45');if(_0x515fd6){_0x4b42ce[_0xc458('0x1a')]=_0x515fd6[_0xc458('0x11')];}var _0x1a9ce0=util[_0xc458('0x27')](_0xc458('0x46'),_0x826217[_0xc458('0x40')],_0x369a5f[_0xc458('0x47')],md5(_0x369a5f['uniqueid']));if(_0x5127a8&&_0x5127a8[_0xc458('0x48')]){logger['info']('[QUEUE]',_0xc458('0x49'));_0x369a5f[_0xc458('0x4a')]=_0x1a9ce0;}else if(_0x1c60ff&&_0x1c60ff[_0xc458('0x4b')]&&_0x1c60ff[_0xc458('0x4b')]!==_0xc458('0x4c')){logger['info'](_0xc458('0x4d'),_0xc458('0x49'));_0x369a5f[_0xc458('0x4a')]=_0x1a9ce0;}else{_0x369a5f['recordingURL']='';}return getAdminId(_0x4b42ce,_0x3da732,_0xc16721,_0x14f507)[_0xc458('0xf')](getUser(_0x3da732,_0xc16721,_0x14f507))[_0xc458('0xf')](getEndUser(_0x3da732,_0xc16721,_0x14f507))[_0xc458('0xf')](getTicket(_0x3da732,_0xc16721,_0x14f507,_0x2b25b1,_0x369a5f))[_0xc458('0xf')](function(_0x2da3ee){logger[_0xc458('0xd')](util[_0xc458('0x27')](_0xc458('0x4e'),_0x2da3ee[_0xc458('0x38')]));if(_0x3da732!==_0xc458('0x4f')){logger['info']('['+[_0x3da732[_0xc458('0x22')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x14f507,_0x515fd6['name'],_0x2da3ee['endUserId']);}})['catch'](function(_0x584a48){logger[_0xc458('0x21')]('['+[_0x3da732[_0xc458('0x22')]()]+_0xc458('0x50'),util[_0xc458('0x51')](_0x584a48,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x68ff=['The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','inspect','lodash','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter','GET','then','users','length','email','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','toUpperCase','message','/api/selector/owners','headers','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','userEmail','userId','adminEmail','catch','error','/api/lookup?q=','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','contactNumber','Contact\x20found\x20work_number:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','task','Task\x20created:','ticketId','/contacts/','emit','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','username','outbound','destcalleridnum','callDirection','queue','unmanaged','uniqueid','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!'];(function(_0x159209,_0x44af9d){var _0x110e3b=function(_0x471f3e){while(--_0x471f3e){_0x159209['push'](_0x159209['shift']());}};_0x110e3b(++_0x44af9d);}(_0x68ff,0xa3));var _0xf68f=function(_0x5beae4,_0x392b4e){_0x5beae4=_0x5beae4-0x0;var _0x4a010a=_0x68ff[_0x5beae4];return _0x4a010a;};'use strict';var _=require(_0xf68f('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xf68f('0x1'));var moment=require(_0xf68f('0x2'));var Promise=require(_0xf68f('0x3'));var Redis=require(_0xf68f('0x4'));var intUtil=require(_0xf68f('0x5'));var config=require(_0xf68f('0x6'));var logger=require(_0xf68f('0x7'))(_0xf68f('0x8'));config[_0xf68f('0x9')]=_[_0xf68f('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xf68f('0xb'))(new Redis(config[_0xf68f('0x9')]));function getAdminId(_0x143bb1,_0x24c9d6,_0x36e7ff,_0x263816){return new Promise(function(_0x436fc1,_0x786a3){var _0x2f9914=![];var _0x2dfac9={'method':_0xf68f('0xc'),'uri':_0x263816+'/api/selector/owners','json':!![]};_0x2dfac9['headers']=_0x36e7ff;logger['info']('Getting\x20admin\x20information');return rp(_0x2dfac9)[_0xf68f('0xd')](function(_0x16fc33){if(_0x16fc33){var _0x589838=_0x16fc33[_0xf68f('0xe')];var _0x197279=null;for(_0x197279=0x0;_0x197279<_0x589838[_0xf68f('0xf')];_0x197279++){if(_0x589838[_0x197279][_0xf68f('0x10')]===_0x143bb1['adminEmail']){_0x143bb1[_0xf68f('0x11')]=_0x589838[_0x197279]['id'];_0x2f9914=!![];}}if(_0x2f9914){logger[_0xf68f('0x12')](_0xf68f('0x13'),_0x143bb1[_0xf68f('0x11')]);_0x436fc1(_0x143bb1);}else{_0x786a3({'statusCode':0x194,'message':_0xf68f('0x14')});}}else{_0x786a3({'statusCode':0x194,'message':_0xf68f('0x14')});}})['catch'](function(_0x5d56d0){logger['error']('['+[_0x24c9d6[_0xf68f('0x15')]()]+']',_0x5d56d0[_0xf68f('0x16')]);_0x786a3(_0x5d56d0);});});}function getUser(_0xbc2d7b,_0x1b9861,_0x5e93cd){return function(_0x5c6b65){return new Promise(function(_0x6a2cbd,_0x2f666c){var _0x39dc8f={'method':_0xf68f('0xc'),'uri':_0x5e93cd+_0xf68f('0x17'),'json':!![]};_0x39dc8f[_0xf68f('0x18')]=_0x1b9861;logger[_0xf68f('0x12')](_0xf68f('0x19'));return rp(_0x39dc8f)[_0xf68f('0xd')](function(_0x57b2e7){if(_0x57b2e7){var _0x569e3f=_0x57b2e7[_0xf68f('0xe')];var _0x34534e=![];var _0x55de29=null;if(_0x5c6b65['agentEmail']!==null){logger[_0xf68f('0x12')](_0xf68f('0x1a'),_0x5c6b65[_0xf68f('0x1b')]);_0x5c6b65[_0xf68f('0x1c')]=_0x5c6b65[_0xf68f('0x1b')];for(_0x55de29=0x0;_0x55de29<_0x569e3f[_0xf68f('0xf')];_0x55de29++){if(_0x569e3f[_0x55de29][_0xf68f('0x10')]===_0x5c6b65[_0xf68f('0x1b')]){_0x34534e=!![];_0x5c6b65['userId']=_0x569e3f[_0x55de29]['id'];logger[_0xf68f('0x12')]('User\x20found:',_0x5c6b65[_0xf68f('0x1d')]);}}}if(!_0x34534e){logger[_0xf68f('0x12')]('Admin\x20selected');_0x5c6b65[_0xf68f('0x1c')]=_0x5c6b65[_0xf68f('0x1e')];_0x5c6b65[_0xf68f('0x1d')]=_0x5c6b65[_0xf68f('0x11')];_0x34534e=!![];}if(_0x34534e){_0x6a2cbd(_0x5c6b65);}else{_0x2f666c({'statusCode':0x194,'message':_0xf68f('0x14')});}}else{_0x2f666c({'statusCode':0x194,'message':_0xf68f('0x14')});}})[_0xf68f('0x1f')](function(_0x11e6c6){logger[_0xf68f('0x20')]('['+[_0xbc2d7b[_0xf68f('0x15')]()]+']',_0x11e6c6['message']);_0x2f666c(_0x11e6c6);});});};}function searchContact(_0x4ecfab,_0xd50884,_0x415ea6,_0x48a575){return new Promise(function(_0x18d479,_0x375141){var _0x7b8297={'method':'GET','headers':_0xd50884,'uri':_0x4ecfab+_0xf68f('0x21')+_0x48a575+_0xf68f('0x22')+_0x415ea6+_0xf68f('0x23'),'json':!![]};rp(_0x7b8297)[_0xf68f('0xd')](function(_0x4f7e50){var _0x21fc60=_['find'](_0x4f7e50[_0xf68f('0x24')][_0xf68f('0x24')],[_0x415ea6,_0x48a575]);_0x18d479(_0x21fc60);})[_0xf68f('0x1f')](function(_0x1d45fd){_0x375141(_0x1d45fd);});});}function getEndUser(_0xb2774b,_0x527c4f,_0x28b34d){return function(_0x52f7d9){return new Promise(function(_0x25eeca,_0x3c6606){logger['info'](util[_0xf68f('0x25')](_0xf68f('0x26'),_0x52f7d9['contactNumber']));searchContact(_0x28b34d,_0x527c4f,_0xf68f('0x27'),_0x52f7d9['contactNumber'])[_0xf68f('0xd')](function(_0x15824d){if(_0x15824d){_0x52f7d9[_0xf68f('0x28')]=_0x15824d['id'];logger[_0xf68f('0x12')](_0xf68f('0x29'),_0x52f7d9[_0xf68f('0x28')]);return _0x25eeca(_0x52f7d9);}searchContact(_0x28b34d,_0x527c4f,_0xf68f('0x2a'),_0x52f7d9[_0xf68f('0x2b')])['then'](function(_0x3da1e1){if(_0x3da1e1){_0x52f7d9[_0xf68f('0x28')]=_0x3da1e1['id'];logger[_0xf68f('0x12')](_0xf68f('0x2c'),_0x52f7d9['endUserId']);return _0x25eeca(_0x52f7d9);}createEndUser(_0x52f7d9,_0xb2774b,_0x527c4f,_0x28b34d)[_0xf68f('0xd')](function(_0x19a5ef){logger[_0xf68f('0x12')]('Contact\x20created:',_0x19a5ef[_0xf68f('0x28')]);return _0x25eeca(_0x19a5ef);});});})['catch'](function(_0x741cc5){_0x3c6606(_0x741cc5);});});};}function createEndUser(_0x243fee,_0x4cf47f,_0x3b7083,_0x5a202c){return new Promise(function(_0x261f05,_0x587436){var _0x45e7e2=moment();var _0x148e3c={'method':_0xf68f('0x2d'),'uri':_0x5a202c+_0xf68f('0x2e'),'body':{'contact':{'last_name':_0x243fee['contactNumber'],'work_number':_0x243fee['contactNumber'],'mobile_number':_0x243fee[_0xf68f('0x2b')],'owner_id':_0x243fee['userId'],'created_at':_0x45e7e2[_0xf68f('0x25')](_0xf68f('0x2f'))}},'json':!![]};_0x148e3c['headers']=_0x3b7083;logger[_0xf68f('0x12')](_0xf68f('0x30'));return rp(_0x148e3c)['then'](function(_0x200f03){_0x243fee['endUserId']=_0x200f03[_0xf68f('0x31')]['id'];_0x261f05(_0x243fee);})[_0xf68f('0x1f')](function(_0x1ba145){logger[_0xf68f('0x20')]('['+[_0x4cf47f[_0xf68f('0x15')]()]+']',_0x1ba145[_0xf68f('0x16')]);_0x587436(_0x1ba145[_0xf68f('0x16')]);});});}function getTicket(_0x3ea2be,_0x51ff72,_0x565021,_0x33c023,_0x2395f3){return function(_0x1eaf76){logger[_0xf68f('0x12')](_0xf68f('0x32'));return new Promise(function(_0xcd54bb,_0x416a0e){var _0x4046f2=moment();var _0x2b68b7={'method':_0xf68f('0x2d'),'uri':_0x565021+_0xf68f('0x33'),'body':{'title':intUtil[_0xf68f('0x34')](_0x33c023[_0xf68f('0x35')],_0x2395f3,'\x20'),'description':intUtil[_0xf68f('0x34')](_0x33c023[_0xf68f('0x36')],_0x2395f3,'\x0a'),'owner_id':_0x1eaf76['userId'],'creater_id':_0x1eaf76[_0xf68f('0x11')],'targetable_id':_0x1eaf76['endUserId'],'targetable_type':'Contact','created_at':_0x4046f2[_0xf68f('0x25')](_0xf68f('0x2f')),'due_date':_0x4046f2['add'](0x1e,'m')[_0xf68f('0x25')](_0xf68f('0x2f'))},'json':!![]};_0x2b68b7[_0xf68f('0x18')]=_0x51ff72;return rp(_0x2b68b7)[_0xf68f('0xd')](function(_0x1f1082){_0x1eaf76['ticketId']=_0x1f1082[_0xf68f('0x37')]['id'];logger[_0xf68f('0x12')](_0xf68f('0x38'),_0x1eaf76[_0xf68f('0x39')]);_0xcd54bb(_0x1eaf76);})[_0xf68f('0x1f')](function(_0x173525){logger[_0xf68f('0x20')]('['+[_0x3ea2be[_0xf68f('0x15')]()]+']',_0x173525[_0xf68f('0x16')]);_0x416a0e(_0x173525['message']);});});};}function emit(_0x62d542,_0x50c8c4,_0x79df27){var _0x4d1e63={'uri':_0x62d542+_0xf68f('0x3a')+_0x79df27};io['to'](util[_0xf68f('0x25')]('user:%s',_0x50c8c4))[_0xf68f('0x3b')]('trigger:browser:url',_0x4d1e63);}exports['cs']=function(_0x1edd0a,_0x5b8a9b,_0x524940,_0x99c39f,_0xa3f071,_0x22bc77,_0x5d9f4a,_0x7a7eb3){var _0xed8476={};var _0x17d411={'Authorization':_0xf68f('0x3c')+_0x22bc77[_0xf68f('0x3d')]};_0x22bc77[_0xf68f('0x3e')]=intUtil['stripTrailingSlash'](_0x22bc77['remoteUri']);_0x22bc77['serverUrl']=intUtil[_0xf68f('0x3f')](_0x22bc77['serverUrl']);var _0x232ae3=_0x22bc77['remoteUri'];_0xed8476[_0xf68f('0x1e')]=_0x22bc77[_0xf68f('0x40')];_0xed8476[_0xf68f('0x2b')]=_0x7a7eb3['toLowerCase']()===_0xf68f('0x41')?_0x5b8a9b[_0xf68f('0x42')]:_0x5b8a9b['calleridnum'];_0xed8476[_0xf68f('0x43')]=_0x7a7eb3===_0xf68f('0x44')||_0x7a7eb3===_0xf68f('0x45')?_0xf68f('0x44'):'outbound';if(_0x99c39f){_0xed8476[_0xf68f('0x1b')]=_0x99c39f['email'];}var _0x1e7edc=util[_0xf68f('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x22bc77['serverUrl'],_0x5b8a9b[_0xf68f('0x46')],md5(_0x5b8a9b[_0xf68f('0x46')]));if(_0xa3f071&&_0xa3f071['monitor_format']){logger[_0xf68f('0x12')](_0xf68f('0x47'),'Recording\x20is\x20enabled!');_0x5b8a9b[_0xf68f('0x48')]=_0x1e7edc;}else if(_0x5d9f4a&&_0x5d9f4a[_0xf68f('0x49')]&&_0x5d9f4a[_0xf68f('0x49')]!==_0xf68f('0x4a')){logger[_0xf68f('0x12')](_0xf68f('0x4b'),_0xf68f('0x4c'));_0x5b8a9b['recordingURL']=_0x1e7edc;}else{_0x5b8a9b[_0xf68f('0x48')]='';}return getAdminId(_0xed8476,_0x7a7eb3,_0x17d411,_0x232ae3)[_0xf68f('0xd')](getUser(_0x7a7eb3,_0x17d411,_0x232ae3))[_0xf68f('0xd')](getEndUser(_0x7a7eb3,_0x17d411,_0x232ae3))['then'](getTicket(_0x7a7eb3,_0x17d411,_0x232ae3,_0x524940,_0x5b8a9b))[_0xf68f('0xd')](function(_0x5f27bf){logger[_0xf68f('0x12')](util[_0xf68f('0x25')](_0xf68f('0x4d'),_0x5f27bf['ticketId']));if(_0x7a7eb3!==_0xf68f('0x45')){logger['info']('['+[_0x7a7eb3[_0xf68f('0x15')]()]+']',_0xf68f('0x4e'));emit(_0x232ae3,_0x99c39f['name'],_0x5f27bf[_0xf68f('0x28')]);}})['catch'](function(_0xaea0ae){logger[_0xf68f('0x20')]('['+[_0x7a7eb3[_0xf68f('0x15')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0xf68f('0x4f')](_0xaea0ae,{'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 e611d66..0f8e9d1 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 _0x56ab=['./servicenow','./freshsales','salesforce','freshdesk','zoho','desk','vtiger','servicenow','exec','includes','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','data1','zendesk','sugarcrm','freshsales','dynamics365','unknown\x20integration','../../../../config/logger','error','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x56ab,0x174));var _0xb56a=function(_0x47ac31,_0x45fc7a){_0x47ac31=_0x47ac31-0x0;var _0x24b428=_0x56ab[_0x47ac31];return _0x24b428;};'use strict';var _=require('lodash');var util=require(_0xb56a('0x0'));var zendesk=require(_0xb56a('0x1'));var salesforce=require(_0xb56a('0x2'));var sugarcrm=require(_0xb56a('0x3'));var freshdesk=require(_0xb56a('0x4'));var zoho=require(_0xb56a('0x5'));var desk=require(_0xb56a('0x6'));var vtiger=require(_0xb56a('0x7'));var servicenow=require(_0xb56a('0x8'));var dynamics365=require('./dynamics365');var freshsales=require(_0xb56a('0x9'));var integrations=['zendesk',_0xb56a('0xa'),'sugarcrm',_0xb56a('0xb'),_0xb56a('0xc'),_0xb56a('0xd'),_0xb56a('0xe'),'dynamics365','freshsales',_0xb56a('0xf')];exports[_0xb56a('0x10')]=function(_0x5a884d,_0x17bfcc,_0x5901ad,_0x3ea4d8,_0x405790,_0x4907b3){if(_0x5901ad){if(_[_0xb56a('0x11')](integrations,_0x5a884d['data1']['toLowerCase']())){try{var _0x10dcdd=null;var _0x4681c0='';var _0x586242=_0x5901ad[_0x5a884d['data1'][_0xb56a('0x12')]()];if(_0x586242){var _0xb2a42f=_0x586242[_0x5a884d[_0xb56a('0x13')]];if(_0xb2a42f){var _0x2f6ae7=_[_0xb56a('0x14')](_0xb2a42f[_0xb56a('0x15')],{'id':parseInt(_0x5a884d[_0xb56a('0x16')],0xa)});if(_0x2f6ae7){if(_0x3ea4d8){if(_0x405790&&_0x17bfcc[_0xb56a('0x17')]){_0x4681c0=_0xb56a('0x17');}else if(_0x17bfcc[_0xb56a('0x18')]){_0x4681c0=_0xb56a('0x19');}else{console[_0xb56a('0x1a')]('EVENT\x20UNKNOWN',_0x17bfcc);}}else{_0x4681c0='unmanaged';}switch(_0x5a884d[_0xb56a('0x1b')][_0xb56a('0x12')]()){case _0xb56a('0x1c'):zendesk[_0x4681c0](_0x5a884d,_0x17bfcc,_0x2f6ae7,_0x3ea4d8,_0x405790,_0xb2a42f,_0x4907b3);break;case _0xb56a('0xa'):salesforce[_0x4681c0](_0x5a884d,_0x17bfcc,_0x2f6ae7,_0x3ea4d8,_0x405790,_0xb2a42f,_0x4907b3);break;case _0xb56a('0x1d'):sugarcrm[_0x4681c0](_0x5a884d,_0x17bfcc,_0x2f6ae7,_0x3ea4d8,_0x405790,_0xb2a42f,_0x4907b3);break;case _0xb56a('0xb'):freshdesk[_0x4681c0](_0x5a884d,_0x17bfcc,_0x2f6ae7,_0x3ea4d8,_0x405790,_0xb2a42f,_0x4907b3);break;case _0xb56a('0xc'):zoho[_0x4681c0](_0x5a884d,_0x17bfcc,_0x2f6ae7,_0x3ea4d8,_0x405790,_0xb2a42f,_0x4907b3);break;case _0xb56a('0xd'):desk[_0x4681c0](_0x5a884d,_0x17bfcc,_0x2f6ae7,_0x3ea4d8,_0x405790,_0xb2a42f,_0x4907b3);break;case _0xb56a('0xe'):vtiger[_0x4681c0](_0x5a884d,_0x17bfcc,_0x2f6ae7,_0x3ea4d8,_0x405790,_0xb2a42f,_0x4907b3);break;case _0xb56a('0x1e'):freshsales['cs'](_0x5a884d,_0x17bfcc,_0x2f6ae7,_0x3ea4d8,_0x405790,_0xb2a42f,_0x4907b3,_0x4681c0);break;case'servicenow':servicenow['cs'](_0x5a884d,_0x17bfcc,_0x2f6ae7,_0x3ea4d8,_0x405790,_0xb2a42f,_0x4907b3,_0x4681c0);break;case _0xb56a('0x1f'):dynamics365['cs'](_0x5a884d,_0x17bfcc,_0x2f6ae7,_0x3ea4d8,_0x405790,_0xb2a42f,_0x4907b3,_0x4681c0);break;default:console[_0xb56a('0x1a')](_0xb56a('0x20'));}}else{_0x10dcdd=require(_0xb56a('0x21'))(_0x5a884d[_0xb56a('0x1b')][_0xb56a('0x12')]());_0x10dcdd[_0xb56a('0x22')]('[EXEC]',util[_0xb56a('0x23')](_0xb56a('0x24'),_0x5a884d[_0xb56a('0x1b')][_0xb56a('0x12')](),_0x5a884d['data3']));}}else{_0x10dcdd=require(_0xb56a('0x21'))(_0x5a884d[_0xb56a('0x1b')][_0xb56a('0x12')]());_0x10dcdd['error']('[EXEC]',util[_0xb56a('0x23')](_0xb56a('0x25'),_0x5a884d[_0xb56a('0x1b')][_0xb56a('0x12')](),_0x5a884d[_0xb56a('0x13')]));}}else{}}catch(_0x13cf44){console[_0xb56a('0x22')](_0x13cf44);}}}}; \ No newline at end of file +var _0x46a2=['routeId','outbound','log','desk','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','lodash','./salesforce','./sugarcrm','./freshdesk','./desk','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','vtiger','freshsales','exec','data1','toLowerCase','find','Configurations','data3','queue'];(function(_0xacb1e2,_0x55e0ab){var _0x463815=function(_0x413c3b){while(--_0x413c3b){_0xacb1e2['push'](_0xacb1e2['shift']());}};_0x463815(++_0x55e0ab);}(_0x46a2,0x1ca));var _0x246a=function(_0x27e811,_0x20137c){_0x27e811=_0x27e811-0x0;var _0x1627fa=_0x46a2[_0x27e811];return _0x1627fa;};'use strict';var _=require(_0x246a('0x0'));var util=require('util');var zendesk=require('./zendesk');var salesforce=require(_0x246a('0x1'));var sugarcrm=require(_0x246a('0x2'));var freshdesk=require(_0x246a('0x3'));var zoho=require('./zoho');var desk=require(_0x246a('0x4'));var vtiger=require('./vtiger');var servicenow=require(_0x246a('0x5'));var dynamics365=require(_0x246a('0x6'));var freshsales=require(_0x246a('0x7'));var integrations=[_0x246a('0x8'),_0x246a('0x9'),_0x246a('0xa'),_0x246a('0xb'),_0x246a('0xc'),'desk',_0x246a('0xd'),'dynamics365',_0x246a('0xe'),'servicenow'];exports[_0x246a('0xf')]=function(_0x5a098e,_0x3e3257,_0x9ceaf2,_0x496076,_0x2cd8bb,_0x4709fe){if(_0x9ceaf2){if(_['includes'](integrations,_0x5a098e[_0x246a('0x10')]['toLowerCase']())){try{var _0x375609=null;var _0x4dcf22='';var _0x46dfe8=_0x9ceaf2[_0x5a098e[_0x246a('0x10')][_0x246a('0x11')]()];if(_0x46dfe8){var _0x6ff161=_0x46dfe8[_0x5a098e['data2']];if(_0x6ff161){var _0x5ba974=_[_0x246a('0x12')](_0x6ff161[_0x246a('0x13')],{'id':parseInt(_0x5a098e[_0x246a('0x14')],0xa)});if(_0x5ba974){if(_0x496076){if(_0x2cd8bb&&_0x3e3257[_0x246a('0x15')]){_0x4dcf22='queue';}else if(_0x3e3257[_0x246a('0x16')]){_0x4dcf22=_0x246a('0x17');}else{console[_0x246a('0x18')]('EVENT\x20UNKNOWN',_0x3e3257);}}else{_0x4dcf22='unmanaged';}switch(_0x5a098e[_0x246a('0x10')]['toLowerCase']()){case _0x246a('0x8'):zendesk[_0x4dcf22](_0x5a098e,_0x3e3257,_0x5ba974,_0x496076,_0x2cd8bb,_0x6ff161,_0x4709fe);break;case _0x246a('0x9'):salesforce[_0x4dcf22](_0x5a098e,_0x3e3257,_0x5ba974,_0x496076,_0x2cd8bb,_0x6ff161,_0x4709fe);break;case'sugarcrm':sugarcrm[_0x4dcf22](_0x5a098e,_0x3e3257,_0x5ba974,_0x496076,_0x2cd8bb,_0x6ff161,_0x4709fe);break;case _0x246a('0xb'):freshdesk[_0x4dcf22](_0x5a098e,_0x3e3257,_0x5ba974,_0x496076,_0x2cd8bb,_0x6ff161,_0x4709fe);break;case _0x246a('0xc'):zoho[_0x4dcf22](_0x5a098e,_0x3e3257,_0x5ba974,_0x496076,_0x2cd8bb,_0x6ff161,_0x4709fe);break;case _0x246a('0x19'):desk[_0x4dcf22](_0x5a098e,_0x3e3257,_0x5ba974,_0x496076,_0x2cd8bb,_0x6ff161,_0x4709fe);break;case'vtiger':vtiger[_0x4dcf22](_0x5a098e,_0x3e3257,_0x5ba974,_0x496076,_0x2cd8bb,_0x6ff161,_0x4709fe);break;case _0x246a('0xe'):freshsales['cs'](_0x5a098e,_0x3e3257,_0x5ba974,_0x496076,_0x2cd8bb,_0x6ff161,_0x4709fe,_0x4dcf22);break;case'servicenow':servicenow['cs'](_0x5a098e,_0x3e3257,_0x5ba974,_0x496076,_0x2cd8bb,_0x6ff161,_0x4709fe,_0x4dcf22);break;case _0x246a('0x1a'):dynamics365['cs'](_0x5a098e,_0x3e3257,_0x5ba974,_0x496076,_0x2cd8bb,_0x6ff161,_0x4709fe,_0x4dcf22);break;default:console[_0x246a('0x18')](_0x246a('0x1b'));}}else{_0x375609=require(_0x246a('0x1c'))(_0x5a098e['data1'][_0x246a('0x11')]());_0x375609[_0x246a('0x1d')](_0x246a('0x1e'),util[_0x246a('0x1f')]('%s\x20configuration\x20#%s\x20not\x20found',_0x5a098e[_0x246a('0x10')][_0x246a('0x11')](),_0x5a098e['data3']));}}else{_0x375609=require('../../../../config/logger')(_0x5a098e[_0x246a('0x10')][_0x246a('0x11')]());_0x375609[_0x246a('0x1d')]('[EXEC]',util['format']('%s\x20account\x20#%s\x20not\x20found',_0x5a098e['data1']['toLowerCase'](),_0x5a098e['data2']));}}else{}}catch(_0x498800){console[_0x246a('0x1d')](_0x498800);}}}}; \ 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 2bba1b3..56728c2 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 _0x8fb6=['No\x20Company','upperFirst','forEach','includes','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','error','outbound','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','toUpperCase','calleridnum','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','bluebird','md5','jsforce','util','./util','salesforce','redis','localhost','assign','getString','Subjects','Descriptions','Task','ActivityDate','IsReminderSet','IsRecurrence','endUserType','lead','account','WhatId','ticketType','contact','ContactId','AccountId','info','sobject','create','isNil','validateEmail','User','find','length','Email','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','resolve','user_id','display_name','then','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','execute','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Account','Contact','first','Phone','attributes','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company'];(function(_0x300bcb,_0x59a0f2){var _0x50fdca=function(_0xe91b21){while(--_0xe91b21){_0x300bcb['push'](_0x300bcb['shift']());}};_0x50fdca(++_0x59a0f2);}(_0x8fb6,0x1b9));var _0x68fb=function(_0x4f523a,_0x578cbe){_0x4f523a=_0x4f523a-0x0;var _0x508810=_0x8fb6[_0x4f523a];return _0x508810;};'use strict';var _=require('lodash');var rp=require(_0x68fb('0x0'));var moment=require(_0x68fb('0x1'));var BPromise=require(_0x68fb('0x2'));var md5=require(_0x68fb('0x3'));var jsforce=require(_0x68fb('0x4'));var util=require(_0x68fb('0x5'));var Redis=require('ioredis');var intUtil=require(_0x68fb('0x6'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x68fb('0x7'));config['redis']=_['defaults'](config[_0x68fb('0x8')],{'host':_0x68fb('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x68fb('0x8')]));function emit(_0x2026c9,_0x39b76d,_0x58447f){io['to'](_0x2026c9)['emit'](_0x39b76d,_0x58447f);}function getTicket(_0x3c1bfc,_0xfae39c,_0x4195c5,_0x339a9a,_0x3d4aba,_0x9a2121,_0x2c1a6b,_0x371ba6){var _0x3d4317=Object[_0x68fb('0xa')]({},{'OwnerId':_0xfae39c['id'],'Subject':intUtil[_0x68fb('0xb')](_0x339a9a[_0x68fb('0xc')],_0x3d4aba,'\x20'),'Description':intUtil['getString'](_0x339a9a[_0x68fb('0xd')],_0x3d4aba,'\x0a')},getCustomFields(_0x9a2121,_0x3d4aba));if(_0x4195c5){if(_0x339a9a['ticketType']===_0x68fb('0xe')){_0x3d4317[_0x68fb('0xf')]=moment['utc']();_0x3d4317[_0x68fb('0x10')]=![];_0x3d4317[_0x68fb('0x11')]=![];if(_0x4195c5[_0x68fb('0x12')]==='contact'||_0x4195c5[_0x68fb('0x12')]===_0x68fb('0x13')){_0x3d4317['WhoId']=_0x4195c5['id'];}else if(_0x4195c5['endUserType']===_0x68fb('0x14')){_0x3d4317[_0x68fb('0x15')]=_0x4195c5['id'];}}else if(_0x339a9a[_0x68fb('0x16')]==='Case'){if(_0x4195c5['endUserType']===_0x68fb('0x17')){_0x3d4317[_0x68fb('0x18')]=_0x4195c5['id'];}else if(_0x4195c5[_0x68fb('0x12')]===_0x68fb('0x14')){_0x3d4317[_0x68fb('0x19')]=_0x4195c5['id'];}else if(_0x4195c5[_0x68fb('0x12')]===_0x68fb('0x13')&&_0x339a9a['leadId']){_0x3d4317[_0x339a9a['leadId']]=_0x4195c5['id'];}else{logger[_0x68fb('0x1a')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x2c1a6b[_0x68fb('0x1b')](_0x339a9a[_0x68fb('0x16')])[_0x68fb('0x1c')](_0x3d4317);}function getUser(_0xeffb6b,_0x1f173c,_0x228b79){if(!_[_0x68fb('0x1d')](_0x1f173c)&&intUtil[_0x68fb('0x1e')](_0x1f173c)){var _0x367d6a={'Email':_0x1f173c};var _0xf99da={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x228b79[_0x68fb('0x1b')](_0x68fb('0x1f'))[_0x68fb('0x20')](_0x367d6a,_0xf99da)['execute']()['then'](function(_0x19098b){if(_0x19098b[_0x68fb('0x21')]){var _0x54377e=_[_0x68fb('0x20')](_0x19098b,function(_0xd845){return _0xd845[_0x68fb('0x22')]===_0x1f173c;});if(_0x54377e){logger[_0x68fb('0x1a')]('Agent\x20%s\x20found.',_0x1f173c);return BPromise['resolve']({'id':_0x54377e['Id'],'name':_0x54377e[_0x68fb('0x23')]});}}else{logger['info'](_0x68fb('0x24'),_0x1f173c);return _0x228b79['identity']()['then'](function(_0x38b04b){return BPromise[_0x68fb('0x25')]({'id':_0x38b04b[_0x68fb('0x26')],'name':_0x38b04b[_0x68fb('0x27')]});});}});}else{logger[_0x68fb('0x1a')](_0x68fb('0x24'),_0x1f173c);return _0x228b79['identity']()[_0x68fb('0x28')](function(_0x43c115){return BPromise[_0x68fb('0x25')]({'id':_0x43c115[_0x68fb('0x26')],'name':_0x43c115['display_name']});});}}function getEndUser(_0x2200b0,_0x38340b,_0x3c2a50,_0x5a62a2,_0x1f9931){var _0x1aacc8={'$or':{'Phone':_0x5a62a2}};var _0x3217c3={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x68fb('0x25')]()[_0x68fb('0x28')](function(){logger[_0x68fb('0x1a')](_0x68fb('0x29'),_0x5a62a2,_0x38340b[_0x68fb('0x2a')]);switch(_0x38340b[_0x68fb('0x2a')]){case _0x68fb('0x2b'):var _0x328de9=_[_0x68fb('0x2c')](_0x1aacc8);if(_0x38340b[_0x68fb('0x2d')]){var _0x1c990e={};_0x1c990e[_0x38340b[_0x68fb('0x2d')]]=_0x5a62a2;_[_0x68fb('0x2e')](_0x328de9['$or'],_0x1c990e);}return _0x1f9931[_0x68fb('0x1b')]('Contact')[_0x68fb('0x20')](_0x328de9,_0x3217c3)[_0x68fb('0x2f')]()['then'](function(_0x15b3a2){if(_0x15b3a2&&_0x15b3a2['length']){return _0x15b3a2;}else{var _0x3c2155=_['cloneDeep'](_0x1aacc8);if(_0x38340b['additionalSearchLead']){var _0x39d15a={};_0x39d15a[_0x38340b[_0x68fb('0x30')]]=_0x5a62a2;_[_0x68fb('0x2e')](_0x3c2155[_0x68fb('0x31')],_0x39d15a);}return _0x1f9931['sobject'](_0x68fb('0x32'))[_0x68fb('0x20')](_0x3c2155,_0x3217c3);}});case _0x68fb('0x33'):var _0x16e4e5=_[_0x68fb('0x2c')](_0x1aacc8);if(_0x38340b[_0x68fb('0x34')]){var _0x1c990e={};_0x1c990e[_0x38340b[_0x68fb('0x34')]]=_0x5a62a2;_[_0x68fb('0x2e')](_0x16e4e5[_0x68fb('0x31')],_0x1c990e);}return _0x1f9931[_0x68fb('0x1b')](_0x68fb('0x35'))[_0x68fb('0x20')](_0x16e4e5,_0x3217c3)['execute']()[_0x68fb('0x28')](function(_0x52f39c){if(_0x52f39c&&_0x52f39c[_0x68fb('0x21')]){return _0x52f39c;}else{var _0x2e113d=_['cloneDeep'](_0x1aacc8);if(_0x38340b['additionalSearchContact']){var _0x1fa665={};_0x1fa665[_0x38340b[_0x68fb('0x2d')]]=_0x5a62a2;_[_0x68fb('0x2e')](_0x2e113d[_0x68fb('0x31')],_0x1fa665);}return _0x1f9931['sobject'](_0x68fb('0x36'))[_0x68fb('0x20')](_0x2e113d,_0x3217c3)[_0x68fb('0x28')](function(_0x336a7c){if(_0x336a7c&&_0x336a7c['length']){return _0x336a7c;}else{var _0x2ded34=_[_0x68fb('0x2c')](_0x1aacc8);if(_0x38340b[_0x68fb('0x30')]){var _0x1e1c1f={};_0x1e1c1f[_0x38340b['additionalSearchLead']]=_0x5a62a2;_[_0x68fb('0x2e')](_0x2ded34['$or'],_0x1e1c1f);}return _0x1f9931['sobject'](_0x68fb('0x32'))['find'](_0x2ded34,_0x3217c3);}});}});case'contact':var _0x328de9=_['cloneDeep'](_0x1aacc8);if(_0x38340b[_0x68fb('0x2d')]){var _0x1c990e={};_0x1c990e[_0x38340b[_0x68fb('0x2d')]]=_0x5a62a2;_['merge'](_0x328de9[_0x68fb('0x31')],_0x1c990e);}return _0x1f9931[_0x68fb('0x1b')](_0x68fb('0x36'))[_0x68fb('0x20')](_0x328de9,_0x3217c3)[_0x68fb('0x2f')]();case _0x68fb('0x13'):var _0xd89e02=_['cloneDeep'](_0x1aacc8);if(_0x38340b[_0x68fb('0x30')]){var _0x1c990e={};_0x1c990e[_0x38340b['additionalSearchLead']]=_0x5a62a2;_[_0x68fb('0x2e')](_0xd89e02[_0x68fb('0x31')],_0x1c990e);}return _0x1f9931[_0x68fb('0x1b')](_0x68fb('0x32'))[_0x68fb('0x20')](_0xd89e02,_0x3217c3);case _0x68fb('0x14'):var _0x16e4e5=_[_0x68fb('0x2c')](_0x1aacc8);if(_0x38340b[_0x68fb('0x34')]){var _0x1c990e={};_0x1c990e[_0x38340b['additionalSearchAccount']]=_0x5a62a2;_['merge'](_0x16e4e5[_0x68fb('0x31')],_0x1c990e);}return _0x1f9931['sobject'](_0x68fb('0x35'))['find'](_0x16e4e5,_0x3217c3);default:return null;}})[_0x68fb('0x28')](function(_0x5bcd07){if(_0x5bcd07&&_0x5bcd07[_0x68fb('0x21')]){var _0x54654e=_[_0x68fb('0x37')](_0x5bcd07);if(_0x54654e){return BPromise[_0x68fb('0x25')]({'id':_0x54654e['Id'],'name':_0x54654e['Name'],'phone':_0x54654e[_0x68fb('0x38')],'endUserType':_0x54654e[_0x68fb('0x39')][_0x68fb('0x3a')]['toLowerCase']()});}}})['then'](function(_0x3562cc){if(_0x3562cc){logger[_0x68fb('0x1a')](_0x68fb('0x3b'),_0x3562cc[_0x68fb('0x12')],_0x5a62a2);return BPromise['resolve'](_0x3562cc);}else{logger[_0x68fb('0x1a')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x5a62a2);var _0x523f34={'Phone':_0x5a62a2};if(_0x38340b[_0x68fb('0x3c')]){if(_0x38340b[_0x68fb('0x3c')]==='contact'){logger['info'](_0x68fb('0x3d'),_0x5a62a2,_0x38340b[_0x68fb('0x3c')]);_0x523f34[_0x68fb('0x3e')]=_0x3c2a50!==_0x68fb('0x3f')?_0x3c2a50:util[_0x68fb('0x40')]('Caller\x20-\x20%s',_0x5a62a2);}else if(_0x38340b['moduleCreate']===_0x68fb('0x13')){logger['info'](_0x68fb('0x3d'),_0x5a62a2,_0x38340b[_0x68fb('0x3c')]);_0x523f34[_0x68fb('0x3e')]=_0x3c2a50!==_0x68fb('0x3f')?_0x3c2a50:util[_0x68fb('0x40')](_0x68fb('0x41'),_0x5a62a2);_0x523f34[_0x68fb('0x42')]=_0x68fb('0x43');}else if(_0x38340b['moduleCreate']===_0x68fb('0x14')){logger[_0x68fb('0x1a')](_0x68fb('0x3d'),_0x5a62a2,_0x38340b['moduleCreate']);_0x523f34[_0x68fb('0x23')]=_0x3c2a50!==_0x68fb('0x3f')?_0x3c2a50:util['format']('Caller\x20-\x20%s',_0x5a62a2);}else{return null;}}return _0x1f9931[_0x68fb('0x1b')](_[_0x68fb('0x44')](_0x38340b['moduleCreate']))[_0x68fb('0x1c')](_0x523f34)['then'](function(_0x5e060f){return BPromise['resolve']({'id':_0x5e060f['id'],'endUserType':_0x38340b[_0x68fb('0x3c')]});});}});}function getCustomFields(_0x40d656,_0x4791f2){var _0x1a2784={};if(_0x40d656[_0x68fb('0x21')]>0x0){_[_0x68fb('0x45')](_0x40d656,function(_0x35b7c3){if(_[_0x68fb('0x46')]([_0x68fb('0x47'),'picklist'],_0x35b7c3['type'])&&_0x35b7c3[_0x68fb('0x48')]){_0x1a2784[_0x35b7c3[_0x68fb('0x48')]]=_0x35b7c3[_0x68fb('0x49')][_0x68fb('0x4a')]();}else if(_0x35b7c3[_0x68fb('0x3a')]===_0x68fb('0x4b')&&_0x35b7c3[_0x68fb('0x4c')]&&_0x35b7c3[_0x68fb('0x48')]){_0x4791f2[_0x35b7c3[_0x68fb('0x4c')]]&&(_0x1a2784[_0x35b7c3['idField']]=_0x4791f2[_0x35b7c3['variableName']][_0x68fb('0x4a')]());}else if(_0x35b7c3[_0x68fb('0x3a')]===_0x68fb('0x4d')&&_0x35b7c3[_0x68fb('0x4e')]&&_0x35b7c3[_0x68fb('0x4e')][_0x68fb('0x4f')]&&_0x35b7c3[_0x68fb('0x48')]){_0x4791f2[_0x35b7c3[_0x68fb('0x4e')][_0x68fb('0x4f')][_0x68fb('0x50')]()]&&(_0x1a2784[_0x35b7c3[_0x68fb('0x48')]]=_0x4791f2[_0x35b7c3[_0x68fb('0x4e')][_0x68fb('0x4f')][_0x68fb('0x50')]()][_0x68fb('0x4a')]());}});}return _0x1a2784;}function getConnection(_0x475e58){var _0x2ec989=_0x475e58[_0x68fb('0x51')][_0x68fb('0x52')](_0x475e58[_0x68fb('0x53')]);var _0x387961=new jsforce[(_0x68fb('0x54'))]({'oauth2':{'loginUrl':_0x475e58[_0x68fb('0x55')]||_0x68fb('0x56'),'clientId':_0x475e58[_0x68fb('0x57')],'clientSecret':_0x475e58[_0x68fb('0x58')]}});return _0x387961[_0x68fb('0x59')](_0x475e58[_0x68fb('0x5a')],_0x2ec989)[_0x68fb('0x28')](function(){logger['info']('Connection\x20established.');return _0x387961;});}exports[_0x68fb('0x5b')]=function(_0x306c8e,_0x4dbbfa,_0x38d082,_0x3f6342,_0xfb3449,_0x39ea35){var _0xb996f9,_0x2d6e78,_0x34429d,_0x12f21b;_0x39ea35[_0x68fb('0x5c')]=intUtil[_0x68fb('0x5d')](_0x39ea35[_0x68fb('0x5c')]);_0x39ea35['remoteUri']=intUtil[_0x68fb('0x5d')](_0x39ea35[_0x68fb('0x55')]);if(_0xfb3449&&_0xfb3449[_0x68fb('0x5e')]){logger['info'](_0x68fb('0x5f'),'Recording\x20is\x20enabled!');_0x4dbbfa['recordingURL']=util[_0x68fb('0x40')](_0x68fb('0x60'),_0x39ea35[_0x68fb('0x5c')],_0x4dbbfa['uniqueid'],md5(_0x4dbbfa[_0x68fb('0x61')]));}else{_0x4dbbfa[_0x68fb('0x62')]='';}return getConnection(_0x39ea35)[_0x68fb('0x28')](function(_0x484df6){_0x12f21b=_0x484df6;return getUser(_0x39ea35,_0x3f6342[_0x68fb('0x63')],_0x12f21b);})[_0x68fb('0x28')](function(_0x40d003){_0xb996f9=_0x40d003;return getEndUser(_0x39ea35,_0x38d082,_0x4dbbfa[_0x68fb('0x64')],_0x4dbbfa['calleridnum'],_0x12f21b);})[_0x68fb('0x28')](function(_0x197a11){_0x2d6e78=_0x197a11;return getTicket(_0x39ea35,_0xb996f9,_0x2d6e78,_0x38d082,_0x4dbbfa,_0x38d082['Fields'],_0x12f21b,_0x68fb('0x5b'));})[_0x68fb('0x28')](function(_0x588b14){_0x34429d=_0x588b14;logger[_0x68fb('0x1a')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x34429d['id']);logger[_0x68fb('0x1a')](_0x68fb('0x65'),_0x34429d['id'],_0x3f6342['name'],_0x39ea35[_0x68fb('0x3a')]);switch(_0x39ea35[_0x68fb('0x3a')]){case _0x68fb('0x66'):emit(util[_0x68fb('0x40')](_0x68fb('0x67'),_0x3f6342[_0x68fb('0x4f')]),_0x68fb('0x68'),{'recordId':_0x34429d['id']});break;case'newTab':emit(util['format'](_0x68fb('0x67'),_0x3f6342[_0x68fb('0x4f')]),_0x68fb('0x69'),{'uri':util['format'](_0x68fb('0x6a'),_0x12f21b[_0x68fb('0x6b')],_0x34429d['id'])});break;default:logger[_0x68fb('0x6c')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x21489c){logger[_0x68fb('0x6c')](_0x68fb('0x5f'),_0x21489c);});};exports[_0x68fb('0x6d')]=function(_0x2868b8,_0x27a631,_0x48ed2a,_0x412800,_0x1c952c,_0xced70c,_0x41909f){var _0x43d6cc,_0x557be8,_0x1664aa,_0x380ef7;_0xced70c[_0x68fb('0x5c')]=intUtil[_0x68fb('0x5d')](_0xced70c['serverUrl']);_0xced70c['remoteUri']=intUtil[_0x68fb('0x5d')](_0xced70c[_0x68fb('0x55')]);if(_0x41909f&&_0x41909f[_0x68fb('0x6e')]&&_0x41909f[_0x68fb('0x6e')]!==_0x68fb('0x6f')){logger[_0x68fb('0x1a')]('[OUTBOUND]',_0x68fb('0x70'));_0x27a631[_0x68fb('0x62')]=util[_0x68fb('0x40')](_0x68fb('0x60'),_0xced70c[_0x68fb('0x5c')],_0x27a631[_0x68fb('0x61')],md5(_0x27a631[_0x68fb('0x61')]));}return getConnection(_0xced70c)[_0x68fb('0x28')](function(_0x21f069){_0x380ef7=_0x21f069;return getUser(_0xced70c,_0x412800[_0x68fb('0x63')],_0x380ef7);})[_0x68fb('0x28')](function(_0x53ebe1){_0x43d6cc=_0x53ebe1;return getEndUser(_0xced70c,_0x48ed2a,_0x27a631[_0x68fb('0x71')],_0x27a631[_0x68fb('0x72')],_0x380ef7);})[_0x68fb('0x28')](function(_0x3b04b9){_0x557be8=_0x3b04b9;return getTicket(_0xced70c,_0x43d6cc,_0x557be8,_0x48ed2a,_0x27a631,_0x48ed2a[_0x68fb('0x73')],_0x380ef7,_0x68fb('0x6d'));})[_0x68fb('0x28')](function(_0x5c46e9){_0x1664aa=_0x5c46e9;logger['info'](_0x68fb('0x74'),_0x1664aa['id']);logger['info'](_0x68fb('0x75'),_0x1664aa['id'],_0x412800['name'],_0xced70c[_0x68fb('0x3a')]);switch(_0xced70c[_0x68fb('0x3a')]){case _0x68fb('0x66'):emit(util['format'](_0x68fb('0x67'),_0x412800[_0x68fb('0x4f')]),_0x68fb('0x68'),{'recordId':_0x1664aa['id']});break;case'newTab':emit(util[_0x68fb('0x40')](_0x68fb('0x67'),_0x412800[_0x68fb('0x4f')]),'trigger:browser:url',{'uri':util[_0x68fb('0x40')](_0x68fb('0x6a'),_0x380ef7[_0x68fb('0x6b')],_0x1664aa['id'])});break;default:logger[_0x68fb('0x6c')](_0x68fb('0x76'),_0x68fb('0x77'));}})[_0x68fb('0x78')](function(_0x26a617){logger['error'](_0x68fb('0x76'),_0x26a617);});};exports[_0x68fb('0x79')]=function(_0x2ca057,_0x184631,_0x5ce3bf,_0x1af9bd,_0x4a4562,_0x4396b8){var _0x26d901,_0x519545,_0x3f3bb4,_0x4feed2;_0x4396b8[_0x68fb('0x5c')]=intUtil[_0x68fb('0x5d')](_0x4396b8['serverUrl']);_0x4396b8[_0x68fb('0x55')]=intUtil[_0x68fb('0x5d')](_0x4396b8[_0x68fb('0x55')]);if(_0x4a4562&&_0x4a4562['monitor_format']){logger[_0x68fb('0x1a')]('['+_0x184631['lastevent'][_0x68fb('0x7a')]()+']','Recording\x20is\x20enabled!');_0x184631['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4396b8[_0x68fb('0x5c')],_0x184631[_0x68fb('0x61')],md5(_0x184631[_0x68fb('0x61')]));}else{_0x184631['recordingURL']='';}return getConnection(_0x4396b8)[_0x68fb('0x28')](function(_0x532cd3){_0x4feed2=_0x532cd3;if(!_[_0x68fb('0x1d')](_0x1af9bd)){return getUser(_0x4396b8,_0x1af9bd[_0x68fb('0x4f')],_0x4feed2);}else{return getUser(_0x4396b8,null,_0x4feed2);}})['then'](function(_0x2ba604){_0x26d901=_0x2ba604;return getEndUser(_0x4396b8,_0x5ce3bf,_0x184631[_0x68fb('0x64')],_0x184631[_0x68fb('0x7b')],_0x4feed2);})[_0x68fb('0x28')](function(_0x37da99){_0x519545=_0x37da99;return getTicket(_0x4396b8,_0x26d901,_0x519545,_0x5ce3bf,_0x184631,_0x5ce3bf[_0x68fb('0x73')],_0x4feed2);})[_0x68fb('0x28')](function(_0x20d35a){_0x3f3bb4=_0x20d35a;logger['info']('['+_0x184631[_0x68fb('0x7c')][_0x68fb('0x7a')]()+_0x68fb('0x7d'),_0x3f3bb4['id']);logger['info']('['+_0x184631['lastevent'][_0x68fb('0x7a')]()+_0x68fb('0x7e'),_0x4396b8[_0x68fb('0x3a')]);})[_0x68fb('0x78')](function(_0x3ce90c){logger['error']('['+_0x184631['lastevent'][_0x68fb('0x7a')]()+']',_0x3ce90c);});}; \ No newline at end of file +var _0x8f30=['calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','calleridname',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','request-promise','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','emit','assign','getString','Subjects','ticketType','Task','ActivityDate','utc','IsRecurrence','endUserType','contact','lead','account','WhatId','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','execute','then','length','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','resolve','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','Contact','additionalSearchLead','merge','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','','format','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','variable','variableName','toString','Variable','name','password','concat','securityToken','Connection','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid'];(function(_0x5ee434,_0x16ffd8){var _0x5dc45b=function(_0x61c000){while(--_0x61c000){_0x5ee434['push'](_0x5ee434['shift']());}};_0x5dc45b(++_0x16ffd8);}(_0x8f30,0x12a));var _0x08f3=function(_0x1d1a98,_0xea9f25){_0x1d1a98=_0x1d1a98-0x0;var _0x4207d4=_0x8f30[_0x1d1a98];return _0x4207d4;};'use strict';var _=require('lodash');var rp=require(_0x08f3('0x0'));var moment=require('moment');var BPromise=require(_0x08f3('0x1'));var md5=require(_0x08f3('0x2'));var jsforce=require(_0x08f3('0x3'));var util=require(_0x08f3('0x4'));var Redis=require(_0x08f3('0x5'));var intUtil=require(_0x08f3('0x6'));var config=require(_0x08f3('0x7'));var logger=require(_0x08f3('0x8'))('salesforce');config[_0x08f3('0x9')]=_['defaults'](config[_0x08f3('0x9')],{'host':_0x08f3('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x32ef21,_0x47186a,_0x3ae1a9){io['to'](_0x32ef21)[_0x08f3('0xb')](_0x47186a,_0x3ae1a9);}function getTicket(_0x21023b,_0xe2a1b3,_0x4b55f5,_0x18f38b,_0x1ce05f,_0x4a1a08,_0x46f7cd,_0x46cbf6){var _0x482bfd=Object[_0x08f3('0xc')]({},{'OwnerId':_0xe2a1b3['id'],'Subject':intUtil[_0x08f3('0xd')](_0x18f38b[_0x08f3('0xe')],_0x1ce05f,'\x20'),'Description':intUtil[_0x08f3('0xd')](_0x18f38b['Descriptions'],_0x1ce05f,'\x0a')},getCustomFields(_0x4a1a08,_0x1ce05f));if(_0x4b55f5){if(_0x18f38b[_0x08f3('0xf')]===_0x08f3('0x10')){_0x482bfd[_0x08f3('0x11')]=moment[_0x08f3('0x12')]();_0x482bfd['IsReminderSet']=![];_0x482bfd[_0x08f3('0x13')]=![];if(_0x4b55f5[_0x08f3('0x14')]===_0x08f3('0x15')||_0x4b55f5['endUserType']===_0x08f3('0x16')){_0x482bfd['WhoId']=_0x4b55f5['id'];}else if(_0x4b55f5['endUserType']===_0x08f3('0x17')){_0x482bfd[_0x08f3('0x18')]=_0x4b55f5['id'];}}else if(_0x18f38b[_0x08f3('0xf')]===_0x08f3('0x19')){if(_0x4b55f5[_0x08f3('0x14')]===_0x08f3('0x15')){_0x482bfd[_0x08f3('0x1a')]=_0x4b55f5['id'];}else if(_0x4b55f5[_0x08f3('0x14')]===_0x08f3('0x17')){_0x482bfd[_0x08f3('0x1b')]=_0x4b55f5['id'];}else if(_0x4b55f5[_0x08f3('0x14')]===_0x08f3('0x16')&&_0x18f38b[_0x08f3('0x1c')]){_0x482bfd[_0x18f38b[_0x08f3('0x1c')]]=_0x4b55f5['id'];}else{logger[_0x08f3('0x1d')](_0x08f3('0x1e'));}}}return _0x46f7cd[_0x08f3('0x1f')](_0x18f38b[_0x08f3('0xf')])[_0x08f3('0x20')](_0x482bfd);}function getUser(_0x1d2d4f,_0x43da75,_0x5839da){if(!_[_0x08f3('0x21')](_0x43da75)&&intUtil[_0x08f3('0x22')](_0x43da75)){var _0xf90287={'Email':_0x43da75};var _0x2fef26={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x5839da[_0x08f3('0x1f')](_0x08f3('0x23'))[_0x08f3('0x24')](_0xf90287,_0x2fef26)[_0x08f3('0x25')]()[_0x08f3('0x26')](function(_0x3e6bc3){if(_0x3e6bc3[_0x08f3('0x27')]){var _0x4cbf3f=_[_0x08f3('0x24')](_0x3e6bc3,function(_0x19c055){return _0x19c055['Email']===_0x43da75;});if(_0x4cbf3f){logger[_0x08f3('0x1d')](_0x08f3('0x28'),_0x43da75);return BPromise['resolve']({'id':_0x4cbf3f['Id'],'name':_0x4cbf3f[_0x08f3('0x29')]});}}else{logger['info'](_0x08f3('0x2a'),_0x43da75);return _0x5839da[_0x08f3('0x2b')]()[_0x08f3('0x26')](function(_0x5135b9){return BPromise[_0x08f3('0x2c')]({'id':_0x5135b9[_0x08f3('0x2d')],'name':_0x5135b9[_0x08f3('0x2e')]});});}});}else{logger[_0x08f3('0x1d')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x43da75);return _0x5839da['identity']()[_0x08f3('0x26')](function(_0x313cc1){return BPromise[_0x08f3('0x2c')]({'id':_0x313cc1[_0x08f3('0x2d')],'name':_0x313cc1[_0x08f3('0x2e')]});});}}function getEndUser(_0x1b8654,_0x2a7f5f,_0x4c5ff9,_0x4855e9,_0x23d35f){var _0x43479={'$or':{'Phone':_0x4855e9}};var _0x3d9178={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x08f3('0x2c')]()[_0x08f3('0x26')](function(){logger[_0x08f3('0x1d')](_0x08f3('0x2f'),_0x4855e9,_0x2a7f5f[_0x08f3('0x30')]);switch(_0x2a7f5f[_0x08f3('0x30')]){case _0x08f3('0x31'):var _0x52d967=_[_0x08f3('0x32')](_0x43479);if(_0x2a7f5f[_0x08f3('0x33')]){var _0x492071={};_0x492071[_0x2a7f5f[_0x08f3('0x33')]]=_0x4855e9;_['merge'](_0x52d967[_0x08f3('0x34')],_0x492071);}return _0x23d35f[_0x08f3('0x1f')](_0x08f3('0x35'))[_0x08f3('0x24')](_0x52d967,_0x3d9178)[_0x08f3('0x25')]()[_0x08f3('0x26')](function(_0x22fd16){if(_0x22fd16&&_0x22fd16[_0x08f3('0x27')]){return _0x22fd16;}else{var _0x2cb8f9=_[_0x08f3('0x32')](_0x43479);if(_0x2a7f5f[_0x08f3('0x36')]){var _0x531ea1={};_0x531ea1[_0x2a7f5f['additionalSearchLead']]=_0x4855e9;_[_0x08f3('0x37')](_0x2cb8f9[_0x08f3('0x34')],_0x531ea1);}return _0x23d35f['sobject'](_0x08f3('0x38'))['find'](_0x2cb8f9,_0x3d9178);}});case _0x08f3('0x39'):var _0x316ed3=_[_0x08f3('0x32')](_0x43479);if(_0x2a7f5f[_0x08f3('0x3a')]){var _0x492071={};_0x492071[_0x2a7f5f[_0x08f3('0x3a')]]=_0x4855e9;_[_0x08f3('0x37')](_0x316ed3[_0x08f3('0x34')],_0x492071);}return _0x23d35f[_0x08f3('0x1f')]('Account')[_0x08f3('0x24')](_0x316ed3,_0x3d9178)[_0x08f3('0x25')]()['then'](function(_0x38d732){if(_0x38d732&&_0x38d732[_0x08f3('0x27')]){return _0x38d732;}else{var _0x5a6841=_['cloneDeep'](_0x43479);if(_0x2a7f5f[_0x08f3('0x33')]){var _0x888133={};_0x888133[_0x2a7f5f[_0x08f3('0x33')]]=_0x4855e9;_[_0x08f3('0x37')](_0x5a6841[_0x08f3('0x34')],_0x888133);}return _0x23d35f[_0x08f3('0x1f')](_0x08f3('0x35'))[_0x08f3('0x24')](_0x5a6841,_0x3d9178)[_0x08f3('0x26')](function(_0x21be6f){if(_0x21be6f&&_0x21be6f['length']){return _0x21be6f;}else{var _0x297482=_[_0x08f3('0x32')](_0x43479);if(_0x2a7f5f[_0x08f3('0x36')]){var _0x71a701={};_0x71a701[_0x2a7f5f[_0x08f3('0x36')]]=_0x4855e9;_[_0x08f3('0x37')](_0x297482[_0x08f3('0x34')],_0x71a701);}return _0x23d35f[_0x08f3('0x1f')](_0x08f3('0x38'))[_0x08f3('0x24')](_0x297482,_0x3d9178);}});}});case _0x08f3('0x15'):var _0x52d967=_[_0x08f3('0x32')](_0x43479);if(_0x2a7f5f[_0x08f3('0x33')]){var _0x492071={};_0x492071[_0x2a7f5f['additionalSearchContact']]=_0x4855e9;_['merge'](_0x52d967['$or'],_0x492071);}return _0x23d35f['sobject'](_0x08f3('0x35'))[_0x08f3('0x24')](_0x52d967,_0x3d9178)[_0x08f3('0x25')]();case _0x08f3('0x16'):var _0x4e6371=_[_0x08f3('0x32')](_0x43479);if(_0x2a7f5f[_0x08f3('0x36')]){var _0x492071={};_0x492071[_0x2a7f5f['additionalSearchLead']]=_0x4855e9;_[_0x08f3('0x37')](_0x4e6371[_0x08f3('0x34')],_0x492071);}return _0x23d35f[_0x08f3('0x1f')](_0x08f3('0x38'))['find'](_0x4e6371,_0x3d9178);case _0x08f3('0x17'):var _0x316ed3=_['cloneDeep'](_0x43479);if(_0x2a7f5f[_0x08f3('0x3a')]){var _0x492071={};_0x492071[_0x2a7f5f['additionalSearchAccount']]=_0x4855e9;_[_0x08f3('0x37')](_0x316ed3[_0x08f3('0x34')],_0x492071);}return _0x23d35f[_0x08f3('0x1f')](_0x08f3('0x3b'))[_0x08f3('0x24')](_0x316ed3,_0x3d9178);default:return null;}})[_0x08f3('0x26')](function(_0x5a1705){if(_0x5a1705&&_0x5a1705[_0x08f3('0x27')]){var _0x2ea779=_[_0x08f3('0x3c')](_0x5a1705);if(_0x2ea779){return BPromise['resolve']({'id':_0x2ea779['Id'],'name':_0x2ea779[_0x08f3('0x29')],'phone':_0x2ea779[_0x08f3('0x3d')],'endUserType':_0x2ea779[_0x08f3('0x3e')][_0x08f3('0x3f')][_0x08f3('0x40')]()});}}})['then'](function(_0x7a0c01){if(_0x7a0c01){logger[_0x08f3('0x1d')](_0x08f3('0x41'),_0x7a0c01[_0x08f3('0x14')],_0x4855e9);return BPromise[_0x08f3('0x2c')](_0x7a0c01);}else{logger[_0x08f3('0x1d')](_0x08f3('0x42'),_0x4855e9);var _0x4f1faa={'Phone':_0x4855e9};if(_0x2a7f5f['moduleCreate']){if(_0x2a7f5f['moduleCreate']===_0x08f3('0x15')){logger[_0x08f3('0x1d')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x4855e9,_0x2a7f5f[_0x08f3('0x43')]);_0x4f1faa[_0x08f3('0x44')]=_0x4c5ff9!==_0x08f3('0x45')?_0x4c5ff9:util[_0x08f3('0x46')](_0x08f3('0x47'),_0x4855e9);}else if(_0x2a7f5f[_0x08f3('0x43')]===_0x08f3('0x16')){logger['info'](_0x08f3('0x48'),_0x4855e9,_0x2a7f5f['moduleCreate']);_0x4f1faa[_0x08f3('0x44')]=_0x4c5ff9!==_0x08f3('0x45')?_0x4c5ff9:util[_0x08f3('0x46')](_0x08f3('0x47'),_0x4855e9);_0x4f1faa['Company']=_0x08f3('0x49');}else if(_0x2a7f5f[_0x08f3('0x43')]===_0x08f3('0x17')){logger[_0x08f3('0x1d')](_0x08f3('0x48'),_0x4855e9,_0x2a7f5f[_0x08f3('0x43')]);_0x4f1faa[_0x08f3('0x29')]=_0x4c5ff9!==_0x08f3('0x45')?_0x4c5ff9:util[_0x08f3('0x46')](_0x08f3('0x47'),_0x4855e9);}else{return null;}}return _0x23d35f[_0x08f3('0x1f')](_[_0x08f3('0x4a')](_0x2a7f5f[_0x08f3('0x43')]))[_0x08f3('0x20')](_0x4f1faa)[_0x08f3('0x26')](function(_0x76e94c){return BPromise[_0x08f3('0x2c')]({'id':_0x76e94c['id'],'endUserType':_0x2a7f5f[_0x08f3('0x43')]});});}});}function getCustomFields(_0x5a4b67,_0x24dcfd){var _0x5a77ef={};if(_0x5a4b67[_0x08f3('0x27')]>0x0){_[_0x08f3('0x4b')](_0x5a4b67,function(_0x33f85d){if(_[_0x08f3('0x4c')]([_0x08f3('0x4d'),_0x08f3('0x4e')],_0x33f85d[_0x08f3('0x3f')])&&_0x33f85d[_0x08f3('0x4f')]){_0x5a77ef[_0x33f85d[_0x08f3('0x4f')]]=_0x33f85d[_0x08f3('0x50')]['toString']();}else if(_0x33f85d['type']===_0x08f3('0x51')&&_0x33f85d[_0x08f3('0x52')]&&_0x33f85d['idField']){_0x24dcfd[_0x33f85d[_0x08f3('0x52')]]&&(_0x5a77ef[_0x33f85d['idField']]=_0x24dcfd[_0x33f85d[_0x08f3('0x52')]][_0x08f3('0x53')]());}else if(_0x33f85d[_0x08f3('0x3f')]==='customVariable'&&_0x33f85d[_0x08f3('0x54')]&&_0x33f85d['Variable']['name']&&_0x33f85d['idField']){_0x24dcfd[_0x33f85d[_0x08f3('0x54')][_0x08f3('0x55')][_0x08f3('0x40')]()]&&(_0x5a77ef[_0x33f85d[_0x08f3('0x4f')]]=_0x24dcfd[_0x33f85d[_0x08f3('0x54')][_0x08f3('0x55')][_0x08f3('0x40')]()][_0x08f3('0x53')]());}});}return _0x5a77ef;}function getConnection(_0x247ee9){var _0xbe7f8a=_0x247ee9[_0x08f3('0x56')][_0x08f3('0x57')](_0x247ee9[_0x08f3('0x58')]);var _0x130439=new jsforce[(_0x08f3('0x59'))]({'oauth2':{'loginUrl':_0x247ee9['remoteUri']||'https://login.salesforce.com','clientId':_0x247ee9[_0x08f3('0x5a')],'clientSecret':_0x247ee9[_0x08f3('0x5b')]}});return _0x130439[_0x08f3('0x5c')](_0x247ee9[_0x08f3('0x5d')],_0xbe7f8a)[_0x08f3('0x26')](function(){logger[_0x08f3('0x1d')](_0x08f3('0x5e'));return _0x130439;});}exports[_0x08f3('0x5f')]=function(_0x51af22,_0x2b6e31,_0x54195c,_0x44cb0c,_0x23feee,_0x4819a0){var _0x8cc663,_0x2cdae0,_0x1c05a5,_0x5b3d13;_0x4819a0[_0x08f3('0x60')]=intUtil[_0x08f3('0x61')](_0x4819a0[_0x08f3('0x60')]);_0x4819a0['remoteUri']=intUtil['stripTrailingSlash'](_0x4819a0[_0x08f3('0x62')]);if(_0x23feee&&_0x23feee[_0x08f3('0x63')]){logger[_0x08f3('0x1d')](_0x08f3('0x64'),_0x08f3('0x65'));_0x2b6e31[_0x08f3('0x66')]=util[_0x08f3('0x46')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4819a0[_0x08f3('0x60')],_0x2b6e31[_0x08f3('0x67')],md5(_0x2b6e31['uniqueid']));}else{_0x2b6e31[_0x08f3('0x66')]='';}return getConnection(_0x4819a0)[_0x08f3('0x26')](function(_0x1e9d45){_0x5b3d13=_0x1e9d45;return getUser(_0x4819a0,_0x44cb0c['email'],_0x5b3d13);})[_0x08f3('0x26')](function(_0x25a28c){_0x8cc663=_0x25a28c;return getEndUser(_0x4819a0,_0x54195c,_0x2b6e31['calleridname'],_0x2b6e31[_0x08f3('0x68')],_0x5b3d13);})['then'](function(_0x1b353e){_0x2cdae0=_0x1b353e;return getTicket(_0x4819a0,_0x8cc663,_0x2cdae0,_0x54195c,_0x2b6e31,_0x54195c[_0x08f3('0x69')],_0x5b3d13,_0x08f3('0x5f'));})['then'](function(_0x59c6d5){_0x1c05a5=_0x59c6d5;logger[_0x08f3('0x1d')](_0x08f3('0x6a'),_0x1c05a5['id']);logger[_0x08f3('0x1d')](_0x08f3('0x6b'),_0x1c05a5['id'],_0x44cb0c['name'],_0x4819a0['type']);switch(_0x4819a0[_0x08f3('0x3f')]){case'integrationTab':emit(util[_0x08f3('0x46')](_0x08f3('0x6c'),_0x44cb0c[_0x08f3('0x55')]),_0x08f3('0x6d'),{'recordId':_0x1c05a5['id']});break;case _0x08f3('0x6e'):emit(util[_0x08f3('0x46')](_0x08f3('0x6c'),_0x44cb0c[_0x08f3('0x55')]),_0x08f3('0x6f'),{'uri':util[_0x08f3('0x46')]('%s/%s/e',_0x5b3d13[_0x08f3('0x70')],_0x1c05a5['id'])});break;default:logger['error'](_0x08f3('0x71'));}})[_0x08f3('0x72')](function(_0x590463){logger[_0x08f3('0x73')](_0x08f3('0x64'),_0x590463);});};exports[_0x08f3('0x74')]=function(_0x149945,_0x1cdf23,_0x562b4c,_0x5b6931,_0x1efed7,_0x5356eb,_0x2cae36){var _0x26abda,_0x2d35a8,_0x302dbc,_0x4633ba;_0x5356eb[_0x08f3('0x60')]=intUtil[_0x08f3('0x61')](_0x5356eb[_0x08f3('0x60')]);_0x5356eb['remoteUri']=intUtil[_0x08f3('0x61')](_0x5356eb[_0x08f3('0x62')]);if(_0x2cae36&&_0x2cae36[_0x08f3('0x75')]&&_0x2cae36['recordingFormat']!==_0x08f3('0x76')){logger[_0x08f3('0x1d')](_0x08f3('0x77'),_0x08f3('0x65'));_0x1cdf23[_0x08f3('0x66')]=util[_0x08f3('0x46')](_0x08f3('0x78'),_0x5356eb[_0x08f3('0x60')],_0x1cdf23[_0x08f3('0x67')],md5(_0x1cdf23[_0x08f3('0x67')]));}return getConnection(_0x5356eb)['then'](function(_0x1059e8){_0x4633ba=_0x1059e8;return getUser(_0x5356eb,_0x5b6931[_0x08f3('0x79')],_0x4633ba);})[_0x08f3('0x26')](function(_0xb4197e){_0x26abda=_0xb4197e;return getEndUser(_0x5356eb,_0x562b4c,_0x1cdf23[_0x08f3('0x7a')],_0x1cdf23[_0x08f3('0x7b')],_0x4633ba);})['then'](function(_0x4b13f4){_0x2d35a8=_0x4b13f4;return getTicket(_0x5356eb,_0x26abda,_0x2d35a8,_0x562b4c,_0x1cdf23,_0x562b4c[_0x08f3('0x69')],_0x4633ba,_0x08f3('0x74'));})['then'](function(_0x3f81d2){_0x302dbc=_0x3f81d2;logger['info'](_0x08f3('0x7c'),_0x302dbc['id']);logger[_0x08f3('0x1d')](_0x08f3('0x7d'),_0x302dbc['id'],_0x5b6931['name'],_0x5356eb['type']);switch(_0x5356eb[_0x08f3('0x3f')]){case'integrationTab':emit(util[_0x08f3('0x46')](_0x08f3('0x6c'),_0x5b6931[_0x08f3('0x55')]),_0x08f3('0x6d'),{'recordId':_0x302dbc['id']});break;case _0x08f3('0x6e'):emit(util['format']('user:%s',_0x5b6931[_0x08f3('0x55')]),_0x08f3('0x6f'),{'uri':util[_0x08f3('0x46')](_0x08f3('0x7e'),_0x4633ba[_0x08f3('0x70')],_0x302dbc['id'])});break;default:logger[_0x08f3('0x73')](_0x08f3('0x77'),_0x08f3('0x7f'));}})[_0x08f3('0x72')](function(_0x430d00){logger['error'](_0x08f3('0x77'),_0x430d00);});};exports[_0x08f3('0x80')]=function(_0x4c51ff,_0x4e2ec8,_0x48ae86,_0x5d4a7c,_0xea73cd,_0x944035){var _0x3986a7,_0x296e29,_0x369873,_0x41dccb;_0x944035[_0x08f3('0x60')]=intUtil[_0x08f3('0x61')](_0x944035['serverUrl']);_0x944035[_0x08f3('0x62')]=intUtil[_0x08f3('0x61')](_0x944035[_0x08f3('0x62')]);if(_0xea73cd&&_0xea73cd[_0x08f3('0x63')]){logger['info']('['+_0x4e2ec8[_0x08f3('0x81')][_0x08f3('0x82')]()+']',_0x08f3('0x65'));_0x4e2ec8['recordingURL']=util[_0x08f3('0x46')](_0x08f3('0x78'),_0x944035[_0x08f3('0x60')],_0x4e2ec8[_0x08f3('0x67')],md5(_0x4e2ec8[_0x08f3('0x67')]));}else{_0x4e2ec8['recordingURL']='';}return getConnection(_0x944035)[_0x08f3('0x26')](function(_0x2b1fe6){_0x41dccb=_0x2b1fe6;if(!_[_0x08f3('0x21')](_0x5d4a7c)){return getUser(_0x944035,_0x5d4a7c['name'],_0x41dccb);}else{return getUser(_0x944035,null,_0x41dccb);}})[_0x08f3('0x26')](function(_0x4b7345){_0x3986a7=_0x4b7345;return getEndUser(_0x944035,_0x48ae86,_0x4e2ec8[_0x08f3('0x83')],_0x4e2ec8[_0x08f3('0x68')],_0x41dccb);})[_0x08f3('0x26')](function(_0x510093){_0x296e29=_0x510093;return getTicket(_0x944035,_0x3986a7,_0x296e29,_0x48ae86,_0x4e2ec8,_0x48ae86[_0x08f3('0x69')],_0x41dccb);})[_0x08f3('0x26')](function(_0x2925f9){_0x369873=_0x2925f9;logger[_0x08f3('0x1d')]('['+_0x4e2ec8[_0x08f3('0x81')][_0x08f3('0x82')]()+_0x08f3('0x84'),_0x369873['id']);logger[_0x08f3('0x1d')]('['+_0x4e2ec8[_0x08f3('0x81')]['toUpperCase']()+_0x08f3('0x85'),_0x944035[_0x08f3('0x3f')]);})[_0x08f3('0x72')](function(_0x2aa288){logger['error']('['+_0x4e2ec8['lastevent']['toUpperCase']()+']',_0x2aa288);});}; \ 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 d561189..59a5bb5 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 _0xc74c=['email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/environment','../../../../config/logger','redis','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','result','true','userId',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','picklist','type','nameField','customField','content','toString','includes','string','idField','toLowerCase','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','label','?sysparm_query=name%3D','Incident','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','%s/api/now/table/'];(function(_0x1b027e,_0xbd225f){var _0x59125b=function(_0x41021e){while(--_0x41021e){_0x1b027e['push'](_0x1b027e['shift']());}};_0x59125b(++_0xbd225f);}(_0xc74c,0x15a));var _0xcc74=function(_0x2a2c99,_0x351a1d){_0x2a2c99=_0x2a2c99-0x0;var _0x5271bf=_0xc74c[_0x2a2c99];return _0x5271bf;};'use strict';var _=require(_0xcc74('0x0'));var Promise=require(_0xcc74('0x1'));var rp=require(_0xcc74('0x2'));var util=require(_0xcc74('0x3'));var md5=require(_0xcc74('0x4'));var Redis=require(_0xcc74('0x5'));var intUtil=require('./util');var config=require(_0xcc74('0x6'));var logger=require(_0xcc74('0x7'))('servicenow');config[_0xcc74('0x8')]=_['defaults'](config[_0xcc74('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xcc74('0x9'))(new Redis(config[_0xcc74('0x8')]));function getAdminUser(_0x188431,_0x141acf,_0x498df9,_0x56e1f4,_0x88c7c4,_0x2d0d2f){return new Promise(function(_0x423376,_0x4385bd){var _0x2b6b4b={'method':_0xcc74('0xa'),'uri':_0x56e1f4+_0xcc74('0xb')+'&'+_0x88c7c4+'&'+_0x2d0d2f,'auth':_0x141acf,'json':!![]};return rp(_0x2b6b4b)['then'](function(_0x555317){if(_0x555317['result'][_0xcc74('0xc')]>0x0){_0x498df9[_0xcc74('0xd')]=_0x555317['result'][0x0][_0xcc74('0xe')];}logger[_0xcc74('0xf')]('['+[_0x188431[_0xcc74('0x10')]()]+_0xcc74('0x11'),_0x498df9);_0x423376(_0x498df9);})[_0xcc74('0x12')](function(_0x16a513){logger[_0xcc74('0x13')]('['+[_0x188431[_0xcc74('0x10')]()]+']',_0x16a513['message']);_0x4385bd(_0x16a513[_0xcc74('0x14')]);});});}function getUser(_0xd25265,_0x14387c,_0x25ea2a,_0x3e56d1,_0x4af442){return function(_0x4d2df6){logger[_0xcc74('0xf')]('['+[_0xd25265[_0xcc74('0x10')]()]+'],\x20getUser\x20input\x20crm',_0x4d2df6);return new Promise(function(_0x42867c,_0x33c7aa){if(intUtil[_0xcc74('0x15')](_0x4d2df6[_0xcc74('0x16')])){var _0x464678={'method':'GET','uri':_0x25ea2a+_0xcc74('0x17')+_0x4d2df6['userEmail']+'&'+_0x3e56d1+'&'+_0x4af442,'auth':_0x14387c,'json':!![]};logger[_0xcc74('0xf')]('['+[_0xd25265[_0xcc74('0x10')]()]+_0xcc74('0x18'),_0x464678);return rp(_0x464678)[_0xcc74('0x19')](function(_0x5daf3f){logger[_0xcc74('0xf')]('['+[_0xd25265['toUpperCase']()]+'],\x20getUser\x20entity',_0x5daf3f);if(_0x5daf3f[_0xcc74('0x1a')]['length']>0x0&&String(_0x5daf3f[_0xcc74('0x1a')][0x0]['active'])===_0xcc74('0x1b')){_0x4d2df6[_0xcc74('0x1c')]=_0x5daf3f[_0xcc74('0x1a')][0x0][_0xcc74('0xe')];}else{_0x4d2df6[_0xcc74('0x1c')]=_0x4d2df6['adminId'];_0x4d2df6[_0xcc74('0x16')]=_0x4d2df6['adminEmail'];}logger[_0xcc74('0xf')]('['+[_0xd25265[_0xcc74('0x10')]()]+'],\x20getUser\x20crm',_0x4d2df6);_0x42867c(_0x4d2df6);})['catch'](function(_0xf61b5e){logger[_0xcc74('0x13')]('['+[_0xd25265[_0xcc74('0x10')]()]+']',_0xf61b5e['message']);_0x33c7aa(_0xf61b5e[_0xcc74('0x14')]);});}else{logger['info']('['+[_0xd25265['toUpperCase']()]+_0xcc74('0x1d'));_0x4d2df6[_0xcc74('0x1c')]=_0x4d2df6[_0xcc74('0xd')];_0x4d2df6[_0xcc74('0x16')]=_0x4d2df6[_0xcc74('0x1e')];_0x42867c(_0x4d2df6);}});};}function createEndUser(_0x4e5f4a,_0x5cb057,_0x3ee68d,_0x12edb2,_0x4ffeb9){logger[_0xcc74('0xf')]('['+[_0x4e5f4a[_0xcc74('0x10')]()]+_0xcc74('0x1f'),_0x3ee68d);return new Promise(function(_0x3cb3c9,_0x1a54a4){var _0x288a5e={'method':_0xcc74('0x20'),'uri':_0x12edb2+_0xcc74('0x21')+_0x4ffeb9,'body':{'user_name':_0x3ee68d[_0xcc74('0x22')],'roles':_0xcc74('0x23'),'first_name':_0x3ee68d['endUserNumber'],'active':_0xcc74('0x1b'),'date_format':_0xcc74('0x24'),'phone':_0x3ee68d[_0xcc74('0x22')]},'auth':_0x5cb057,'json':!![]};return rp(_0x288a5e)[_0xcc74('0x19')](function(_0x5a639e){logger['info']('['+[_0x4e5f4a['toUpperCase']()]+_0xcc74('0x25'),_0x5a639e[_0xcc74('0x1a')]);_0x3ee68d[_0xcc74('0x26')]=_0x5a639e['result'][_0xcc74('0xe')];_0x3cb3c9(_0x3ee68d);})[_0xcc74('0x12')](function(_0x3d1ab6){logger[_0xcc74('0x13')]('['+[_0x4e5f4a['toUpperCase']()]+']',_0x3d1ab6[_0xcc74('0x14')]);_0x1a54a4(_0x3d1ab6[_0xcc74('0x14')]);});});}function getEndUser(_0x5db741,_0x4c9368,_0x1bca92,_0x4445ef,_0xeb28b2){return function(_0x2c5d28){logger[_0xcc74('0xf')]('['+[_0x5db741[_0xcc74('0x10')]()]+_0xcc74('0x27'),_0x2c5d28);return new Promise(function(_0x5ab610,_0x1bf2a6){var _0x41b3be={'method':_0xcc74('0xa'),'uri':_0x1bca92+_0xcc74('0x28')+_0x2c5d28[_0xcc74('0x22')]+'&'+_0x4445ef+'&'+_0xeb28b2,'auth':_0x4c9368,'json':!![]};return rp(_0x41b3be)[_0xcc74('0x19')](function(_0x1b0ad1){if(_0x1b0ad1[_0xcc74('0x1a')]['length']>0x0){_0x2c5d28['endUserId']=_0x1b0ad1['result'][0x0]['sys_id'];logger[_0xcc74('0xf')]('['+[_0x5db741[_0xcc74('0x10')]()]+_0xcc74('0x29'),_0x2c5d28);_0x5ab610(_0x2c5d28);}else{return createEndUser(_0x5db741,_0x4c9368,_0x2c5d28,_0x1bca92,_0x4445ef)['then'](function(_0x33f1d6){logger[_0xcc74('0xf')]('['+[_0x5db741[_0xcc74('0x10')]()]+_0xcc74('0x2a'),_0x33f1d6);_0x5ab610(_0x33f1d6);});}})[_0xcc74('0x12')](function(_0x4f4ae9){logger[_0xcc74('0x13')]('['+[_0x5db741[_0xcc74('0x10')]()]+']',_0x4f4ae9[_0xcc74('0x14')]);_0x1bf2a6(_0x4f4ae9['message']);});});};}function getCustomFields(_0xbea9c8,_0x578abf){var _0x10eed0={};if(_0xbea9c8[_0xcc74('0xc')]>0x0){_[_0xcc74('0x2b')](_0xbea9c8,function(_0x361115){if(_['includes'](['string',_0xcc74('0x2c')],_0x361115[_0xcc74('0x2d')])&&_0x361115[_0xcc74('0x2e')]&&!_0x361115[_0xcc74('0x2f')]){_0x10eed0[_0x361115['nameField']['toLowerCase']()]=_0x361115[_0xcc74('0x30')][_0xcc74('0x31')]();}else if(_[_0xcc74('0x32')]([_0xcc74('0x33'),_0xcc74('0x2c')],_0x361115['type'])&&_0x361115[_0xcc74('0x34')]&&_0x361115['customField']){_0x10eed0[_0x361115[_0xcc74('0x34')][_0xcc74('0x35')]()]=_0x361115['content'][_0xcc74('0x31')]();}else if(_0x361115[_0xcc74('0x2d')]===_0xcc74('0x36')&&_0x361115[_0xcc74('0x37')]&&_0x361115['idField']&&_0x361115[_0xcc74('0x2f')]){_0x10eed0[_0x361115[_0xcc74('0x34')]['toLowerCase']()]=_0x578abf[_0x361115[_0xcc74('0x37')]][_0xcc74('0x31')]();}else if(_0x361115[_0xcc74('0x2d')]===_0xcc74('0x38')&&_0x361115[_0xcc74('0x39')]&&_0x361115[_0xcc74('0x39')][_0xcc74('0x3a')]&&_0x361115[_0xcc74('0x34')]&&_0x361115[_0xcc74('0x2f')]){_0x10eed0[_0x361115[_0xcc74('0x34')][_0xcc74('0x35')]()]=_0x578abf[_0x361115[_0xcc74('0x39')]['name'][_0xcc74('0x35')]()][_0xcc74('0x31')]();}});}return _0x10eed0;}function getTicket(_0x3da544,_0x43306f,_0x343731,_0x4d8a8a,_0x3c5362,_0x3531f4){return function(_0x320df4){logger['info']('['+[_0x3da544[_0xcc74('0x10')]()]+_0xcc74('0x3b'),_0x320df4);return new Promise(function(_0x3803ad,_0x1c6c4f){var _0x530fe1=_0x3da544['toLowerCase']()===_0xcc74('0x3c')?_0x320df4[_0xcc74('0x1c')]:_0x320df4[_0xcc74('0x26')];var _0x55c212={'method':'POST','uri':_0x343731+_0xcc74('0x3d')+'?'+_0x3531f4,'body':Object['assign']({},{'active':_0xcc74('0x1b'),'caller_id':_0x530fe1,'assigned_to':_0x320df4['userId'],'short_description':intUtil[_0xcc74('0x3e')](_0x4d8a8a[_0xcc74('0x3f')],_0x3c5362,'\x20'),'description':intUtil[_0xcc74('0x3e')](_0x4d8a8a[_0xcc74('0x40')],_0x3c5362,'\x0a')},getCustomFields(_0x4d8a8a[_0xcc74('0x41')],_0x3c5362)),'auth':_0x43306f,'json':!![]};return rp(_0x55c212)[_0xcc74('0x19')](function(_0x387b60){logger[_0xcc74('0xf')]('['+[_0x3da544[_0xcc74('0x10')]()]+_0xcc74('0x42'),_0x387b60[_0xcc74('0x1a')]);_0x320df4[_0xcc74('0x43')]=_0x387b60[_0xcc74('0x1a')]['sys_id'];_0x320df4[_0xcc74('0x44')]=_0x387b60['result']['number'];logger[_0xcc74('0xf')]('['+[_0x3da544['toUpperCase']()]+']\x20getTicket\x20crm',_0x320df4);_0x3803ad(_0x320df4);})[_0xcc74('0x12')](function(_0x5c670d){logger[_0xcc74('0x13')]('['+[_0x3da544['toUpperCase']()]+']',_0x5c670d[_0xcc74('0x14')]);_0x1c6c4f(_0x5c670d[_0xcc74('0x14')]);});});};}function createRemoteTag(_0x1a57e3,_0x5f2283,_0x395767,_0x290fab){return new Promise(function(_0x2cd9a0,_0x3f7729){var _0x57a068={'method':_0xcc74('0x20'),'uri':_0x395767+_0xcc74('0x45')+'?'+_0x290fab,'body':{'short_description':_0x1a57e3,'global':!![],'active':!![],'name':_0x1a57e3},'auth':_0x5f2283,'json':!![]};return rp(_0x57a068)[_0xcc74('0x19')](function(_0x4322e1){var _0x489387=_0x4322e1[_0xcc74('0x1a')][_0xcc74('0xe')];_0x2cd9a0(_0x489387);});});}function getRemoteTag(_0x3148b2,_0x13ced2,_0x1aadd7,_0xa64141,_0x3e1c8d){return new Promise(function(_0x899c02,_0x1d57ee){var _0x3ded7={'method':'GET','uri':_0x1aadd7+_0xcc74('0x45')+_0xcc74('0x46')+_0x3148b2+'&'+_0xa64141,'auth':_0x13ced2,'json':!![]};return rp(_0x3ded7)['then'](function(_0x4ff8da){if(_0x4ff8da[_0xcc74('0x1a')][_0xcc74('0xc')]>0x0){var _0x21e364=_0x4ff8da[_0xcc74('0x1a')][0x0][_0xcc74('0xe')];_0x899c02(_0x21e364);}else{return createRemoteTag(_0x3148b2,_0x13ced2,_0x1aadd7,_0xa64141)[_0xcc74('0x19')](function(_0x43a9d7){_0x899c02(_0x43a9d7);});}});});}function assignTagToIncident(_0x57114b,_0x2a292d,_0x31b254,_0x823ab1,_0x333c4f){return new Promise(function(_0x4a5f79,_0x5df356){var _0x539ff9={'method':_0xcc74('0x20'),'uri':_0x31b254+'label_entry'+'?'+_0x333c4f,'body':{'label':_0x57114b,'table':'incident','id_type':_0xcc74('0x47'),'table_key':_0x823ab1['ticketId'],'title':'Incident\x20-\x20'+_0x823ab1[_0xcc74('0x44')],'id_display':_0x823ab1[_0xcc74('0x44')]},'auth':_0x2a292d,'json':!![]};return rp(_0x539ff9)[_0xcc74('0x19')](function(_0x4db028){_0x4a5f79();})['catch'](function(){_0x4a5f79();});});}function manageTags(_0x14c85b,_0x4e2917,_0x131d4a,_0x5fa894,_0x2013eb,_0x38cecb,_0x54d25c){return new Promise(function(_0x4364c8,_0x15f2d7){var _0x1c6421=[];_0x4e2917[_0xcc74('0x2b')](function(_0x155f3e){_0x1c6421['push'](getRemoteTag(_0x155f3e,_0x131d4a,_0x5fa894,_0x38cecb,_0x54d25c));});return Promise[_0xcc74('0x48')](_0x1c6421)[_0xcc74('0x19')](function(_0x2f2d61){if(_0x2f2d61['length']){logger[_0xcc74('0xf')]('['+[_0x14c85b[_0xcc74('0x10')]()]+_0xcc74('0x49'),_0x2f2d61);var _0x3a6d78=[];_0x2f2d61[_0xcc74('0x2b')](function(_0x51cb69){_0x3a6d78['push'](assignTagToIncident(_0x51cb69,_0x131d4a,_0x5fa894,_0x2013eb,_0x38cecb));});return Promise[_0xcc74('0x48')](_0x3a6d78)[_0xcc74('0x19')](function(){_0x4364c8();})[_0xcc74('0x12')](function(){_0x4364c8();});}else{_0x4364c8();}});});}function getTags(_0x2fecca,_0x36d406,_0x1cd69c,_0x376330,_0x38a294,_0x3caeee){return function(_0x4e611e){return new Promise(function(_0xc4d2f3,_0x2530b6){var _0x455f54=[];var _0x1f0641=_0x376330[_0xcc74('0x4a')];if(_0x1f0641&&_0x1f0641[_0xcc74('0xc')]>0x0){_0x455f54=_[_0xcc74('0x4b')](_0x1f0641,_0xcc74('0x3a'));}if(_0x455f54[_0xcc74('0xc')]>0x0){return manageTags(_0x2fecca,_0x455f54,_0x36d406,_0x1cd69c,_0x4e611e,_0x38a294,_0x3caeee)[_0xcc74('0x19')](function(){_0xc4d2f3(_0x4e611e);});}else{_0xc4d2f3(_0x4e611e);}});};}function emit(_0x47f965,_0x3ac966,_0x403454){var _0x1f05ef=_0xcc74('0x4c')+_0xcc74('0x4d')+_0xcc74('0x4e')+'%255EORDERBYDESCnumber';var _0x2a3c8d={'uri':_0x47f965+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x403454+_0x1f05ef};io['to'](util[_0xcc74('0x4f')](_0xcc74('0x50'),_0x3ac966))[_0xcc74('0x51')](_0xcc74('0x52'),_0x2a3c8d);}exports['cs']=function(_0x2ade73,_0x16b641,_0x3442de,_0x1c3011,_0x2499c8,_0x5d5d9d,_0x38d7eb,_0x181f94){var _0x55f0ad={};var _0x3f980d={'user':_0x5d5d9d['username'],'pass':_0x5d5d9d[_0xcc74('0x53')]};var _0x159460=_0xcc74('0x54');var _0x48e46e=_0xcc74('0x55');_0x5d5d9d['remoteUri']=intUtil['stripTrailingSlash'](_0x5d5d9d[_0xcc74('0x56')]);_0x5d5d9d[_0xcc74('0x57')]=intUtil[_0xcc74('0x58')](_0x5d5d9d[_0xcc74('0x57')]);var _0x49187b=util[_0xcc74('0x4f')](_0xcc74('0x59'),_0x5d5d9d['remoteUri']);_0x55f0ad[_0xcc74('0x16')]=!_['isNil'](_0x1c3011)?_0x1c3011[_0xcc74('0x5a')]:null;_0x55f0ad['adminEmail']=_0x5d5d9d['email'];_0x55f0ad['endUserNumber']=_0x181f94[_0xcc74('0x35')]()===_0xcc74('0x3c')?_0x16b641[_0xcc74('0x5b')]:_0x16b641[_0xcc74('0x5c')];_0x55f0ad[_0xcc74('0x5d')]=_0x181f94===_0xcc74('0x5e')||_0x181f94===_0xcc74('0x5f')?_0xcc74('0x5e'):_0xcc74('0x3c');var _0x2f8a70=util[_0xcc74('0x4f')](_0xcc74('0x60'),_0x5d5d9d[_0xcc74('0x57')],_0x16b641[_0xcc74('0x61')],md5(_0x16b641[_0xcc74('0x61')]));if(_0x2499c8&&_0x2499c8[_0xcc74('0x62')]){logger[_0xcc74('0xf')](_0xcc74('0x63'),_0xcc74('0x64'));_0x16b641['recordingURL']=_0x2f8a70;}else if(_0x38d7eb&&_0x38d7eb[_0xcc74('0x65')]&&_0x38d7eb[_0xcc74('0x65')]!==_0xcc74('0x66')){logger[_0xcc74('0xf')](_0xcc74('0x67'),_0xcc74('0x64'));_0x16b641['recordingURL']=_0x2f8a70;}else{_0x16b641[_0xcc74('0x68')]='';}return getAdminUser(_0x181f94,_0x3f980d,_0x55f0ad,_0x49187b,_0x48e46e,_0x159460)[_0xcc74('0x19')](getUser(_0x181f94,_0x3f980d,_0x49187b,_0x48e46e,_0x159460))[_0xcc74('0x19')](getEndUser(_0x181f94,_0x3f980d,_0x49187b,_0x48e46e,_0x159460))[_0xcc74('0x19')](getTicket(_0x181f94,_0x3f980d,_0x49187b,_0x3442de,_0x16b641,_0x48e46e))['then'](function(_0x1f308f){logger[_0xcc74('0xf')](util[_0xcc74('0x4f')](_0xcc74('0x69'),_0x1f308f[_0xcc74('0x43')]));logger[_0xcc74('0xf')](util[_0xcc74('0x4f')](_0xcc74('0x6a'),_0x181f94));if(_0x181f94!=='unmanaged'){logger[_0xcc74('0xf')]('['+[_0x181f94[_0xcc74('0x10')]()]+']',_0xcc74('0x6b'));emit(_0x5d5d9d[_0xcc74('0x56')],_0x1c3011[_0xcc74('0x3a')],_0x1f308f[_0xcc74('0x43')]);}})[_0xcc74('0x12')](function(_0x2283c5){logger[_0xcc74('0x13')]('['+[_0x181f94[_0xcc74('0x10')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0xcc74('0x6c')](_0x2283c5,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xac76=['info','toUpperCase','],\x20getAdminUser\x20crm','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','active','true','sys_id','userId','adminId','adminEmail','],\x20getUser\x20crm','catch','error','message','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','GET','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','type','nameField','toLowerCase','content','toString','idField','customField','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','username','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','email','destcalleridnum','callDirection','unmanaged','queue','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','ticketId','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','defaults','localhost','socket.io-emitter','redis','sys_user?sysparm_query=user_name%3Dadmin','then','result','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac76,0x12b));var _0x6ac7=function(_0x166b97,_0x2833d5){_0x166b97=_0x166b97-0x0;var _0x4d3c9a=_0xac76[_0x166b97];return _0x4d3c9a;};'use strict';var _=require('lodash');var Promise=require('bluebird');var rp=require(_0x6ac7('0x0'));var util=require(_0x6ac7('0x1'));var md5=require(_0x6ac7('0x2'));var Redis=require(_0x6ac7('0x3'));var intUtil=require(_0x6ac7('0x4'));var config=require(_0x6ac7('0x5'));var logger=require(_0x6ac7('0x6'))(_0x6ac7('0x7'));config['redis']=_[_0x6ac7('0x8')](config['redis'],{'host':_0x6ac7('0x9'),'port':0x18eb});var io=require(_0x6ac7('0xa'))(new Redis(config[_0x6ac7('0xb')]));function getAdminUser(_0x486ab6,_0x33be42,_0x28a6c2,_0x585ac3,_0x10659d,_0x6af5d9){return new Promise(function(_0x1f2d26,_0x2f9dd4){var _0x45fda9={'method':'GET','uri':_0x585ac3+_0x6ac7('0xc')+'&'+_0x10659d+'&'+_0x6af5d9,'auth':_0x33be42,'json':!![]};return rp(_0x45fda9)[_0x6ac7('0xd')](function(_0x2aef5e){if(_0x2aef5e[_0x6ac7('0xe')][_0x6ac7('0xf')]>0x0){_0x28a6c2['adminId']=_0x2aef5e[_0x6ac7('0xe')][0x0]['sys_id'];}logger[_0x6ac7('0x10')]('['+[_0x486ab6[_0x6ac7('0x11')]()]+_0x6ac7('0x12'),_0x28a6c2);_0x1f2d26(_0x28a6c2);})['catch'](function(_0x2795be){logger['error']('['+[_0x486ab6[_0x6ac7('0x11')]()]+']',_0x2795be['message']);_0x2f9dd4(_0x2795be['message']);});});}function getUser(_0x84e9f9,_0x183cb7,_0x18855f,_0x11f5d0,_0x1217c6){return function(_0x17d7cc){logger['info']('['+[_0x84e9f9[_0x6ac7('0x11')]()]+_0x6ac7('0x13'),_0x17d7cc);return new Promise(function(_0x4a22d5,_0x3ea8d8){if(intUtil[_0x6ac7('0x14')](_0x17d7cc[_0x6ac7('0x15')])){var _0x3b193a={'method':'GET','uri':_0x18855f+_0x6ac7('0x16')+_0x17d7cc[_0x6ac7('0x15')]+'&'+_0x11f5d0+'&'+_0x1217c6,'auth':_0x183cb7,'json':!![]};logger[_0x6ac7('0x10')]('['+[_0x84e9f9['toUpperCase']()]+_0x6ac7('0x17'),_0x3b193a);return rp(_0x3b193a)['then'](function(_0x2e8d6){logger[_0x6ac7('0x10')]('['+[_0x84e9f9[_0x6ac7('0x11')]()]+'],\x20getUser\x20entity',_0x2e8d6);if(_0x2e8d6[_0x6ac7('0xe')][_0x6ac7('0xf')]>0x0&&String(_0x2e8d6[_0x6ac7('0xe')][0x0][_0x6ac7('0x18')])===_0x6ac7('0x19')){_0x17d7cc['userId']=_0x2e8d6[_0x6ac7('0xe')][0x0][_0x6ac7('0x1a')];}else{_0x17d7cc[_0x6ac7('0x1b')]=_0x17d7cc[_0x6ac7('0x1c')];_0x17d7cc['userEmail']=_0x17d7cc[_0x6ac7('0x1d')];}logger[_0x6ac7('0x10')]('['+[_0x84e9f9[_0x6ac7('0x11')]()]+_0x6ac7('0x1e'),_0x17d7cc);_0x4a22d5(_0x17d7cc);})[_0x6ac7('0x1f')](function(_0x4bb073){logger[_0x6ac7('0x20')]('['+[_0x84e9f9[_0x6ac7('0x11')]()]+']',_0x4bb073[_0x6ac7('0x21')]);_0x3ea8d8(_0x4bb073[_0x6ac7('0x21')]);});}else{logger['info']('['+[_0x84e9f9[_0x6ac7('0x11')]()]+']\x20using\x20admin\x20profile');_0x17d7cc[_0x6ac7('0x1b')]=_0x17d7cc['adminId'];_0x17d7cc[_0x6ac7('0x15')]=_0x17d7cc['adminEmail'];_0x4a22d5(_0x17d7cc);}});};}function createEndUser(_0x4c4144,_0x562672,_0x3aeca5,_0x39cdbd,_0x492b3c){logger[_0x6ac7('0x10')]('['+[_0x4c4144[_0x6ac7('0x11')]()]+_0x6ac7('0x22'),_0x3aeca5);return new Promise(function(_0x19d80d,_0x63ed48){var _0x434cbf={'method':_0x6ac7('0x23'),'uri':_0x39cdbd+'sys_user?'+_0x492b3c,'body':{'user_name':_0x3aeca5[_0x6ac7('0x24')],'roles':'user','first_name':_0x3aeca5[_0x6ac7('0x24')],'active':'true','date_format':_0x6ac7('0x25'),'phone':_0x3aeca5[_0x6ac7('0x24')]},'auth':_0x562672,'json':!![]};return rp(_0x434cbf)[_0x6ac7('0xd')](function(_0x266c11){logger[_0x6ac7('0x10')]('['+[_0x4c4144[_0x6ac7('0x11')]()]+_0x6ac7('0x26'),_0x266c11[_0x6ac7('0xe')]);_0x3aeca5[_0x6ac7('0x27')]=_0x266c11[_0x6ac7('0xe')][_0x6ac7('0x1a')];_0x19d80d(_0x3aeca5);})[_0x6ac7('0x1f')](function(_0x35deeb){logger['error']('['+[_0x4c4144[_0x6ac7('0x11')]()]+']',_0x35deeb[_0x6ac7('0x21')]);_0x63ed48(_0x35deeb[_0x6ac7('0x21')]);});});}function getEndUser(_0x5a1653,_0x2adf59,_0x23d31c,_0x36b980,_0x470a71){return function(_0x2a190c){logger[_0x6ac7('0x10')]('['+[_0x5a1653[_0x6ac7('0x11')]()]+_0x6ac7('0x28'),_0x2a190c);return new Promise(function(_0x49355c,_0x33a1d4){var _0x53182a={'method':_0x6ac7('0x29'),'uri':_0x23d31c+_0x6ac7('0x2a')+_0x2a190c[_0x6ac7('0x24')]+'&'+_0x36b980+'&'+_0x470a71,'auth':_0x2adf59,'json':!![]};return rp(_0x53182a)[_0x6ac7('0xd')](function(_0x3c0d58){if(_0x3c0d58[_0x6ac7('0xe')][_0x6ac7('0xf')]>0x0){_0x2a190c[_0x6ac7('0x27')]=_0x3c0d58[_0x6ac7('0xe')][0x0][_0x6ac7('0x1a')];logger[_0x6ac7('0x10')]('['+[_0x5a1653[_0x6ac7('0x11')]()]+_0x6ac7('0x2b'),_0x2a190c);_0x49355c(_0x2a190c);}else{return createEndUser(_0x5a1653,_0x2adf59,_0x2a190c,_0x23d31c,_0x36b980)[_0x6ac7('0xd')](function(_0x2e92b0){logger[_0x6ac7('0x10')]('['+[_0x5a1653[_0x6ac7('0x11')]()]+_0x6ac7('0x2c'),_0x2e92b0);_0x49355c(_0x2e92b0);});}})[_0x6ac7('0x1f')](function(_0x6fd6c7){logger['error']('['+[_0x5a1653[_0x6ac7('0x11')]()]+']',_0x6fd6c7['message']);_0x33a1d4(_0x6fd6c7[_0x6ac7('0x21')]);});});};}function getCustomFields(_0x5f1596,_0x396ec4){var _0x2f09d7={};if(_0x5f1596[_0x6ac7('0xf')]>0x0){_[_0x6ac7('0x2d')](_0x5f1596,function(_0x22d7a8){if(_[_0x6ac7('0x2e')]([_0x6ac7('0x2f'),'picklist'],_0x22d7a8[_0x6ac7('0x30')])&&_0x22d7a8[_0x6ac7('0x31')]&&!_0x22d7a8['customField']){_0x2f09d7[_0x22d7a8[_0x6ac7('0x31')][_0x6ac7('0x32')]()]=_0x22d7a8[_0x6ac7('0x33')][_0x6ac7('0x34')]();}else if(_['includes']([_0x6ac7('0x2f'),'picklist'],_0x22d7a8['type'])&&_0x22d7a8[_0x6ac7('0x35')]&&_0x22d7a8[_0x6ac7('0x36')]){_0x2f09d7[_0x22d7a8[_0x6ac7('0x35')][_0x6ac7('0x32')]()]=_0x22d7a8['content'][_0x6ac7('0x34')]();}else if(_0x22d7a8['type']==='variable'&&_0x22d7a8[_0x6ac7('0x37')]&&_0x22d7a8[_0x6ac7('0x35')]&&_0x22d7a8['customField']){_0x2f09d7[_0x22d7a8[_0x6ac7('0x35')][_0x6ac7('0x32')]()]=_0x396ec4[_0x22d7a8[_0x6ac7('0x37')]][_0x6ac7('0x34')]();}else if(_0x22d7a8['type']==='customVariable'&&_0x22d7a8[_0x6ac7('0x38')]&&_0x22d7a8[_0x6ac7('0x38')][_0x6ac7('0x39')]&&_0x22d7a8['idField']&&_0x22d7a8[_0x6ac7('0x36')]){_0x2f09d7[_0x22d7a8[_0x6ac7('0x35')][_0x6ac7('0x32')]()]=_0x396ec4[_0x22d7a8[_0x6ac7('0x38')][_0x6ac7('0x39')][_0x6ac7('0x32')]()][_0x6ac7('0x34')]();}});}return _0x2f09d7;}function getTicket(_0x48274e,_0x51fffe,_0x4e9a56,_0x2920a1,_0x2c18c9,_0x570112){return function(_0x79f610){logger['info']('['+[_0x48274e['toUpperCase']()]+_0x6ac7('0x3a'),_0x79f610);return new Promise(function(_0x48c3fe,_0x48fefa){var _0x2d1a2b=_0x48274e[_0x6ac7('0x32')]()===_0x6ac7('0x3b')?_0x79f610[_0x6ac7('0x1b')]:_0x79f610[_0x6ac7('0x27')];var _0x217b57={'method':'POST','uri':_0x4e9a56+_0x6ac7('0x3c')+'?'+_0x570112,'body':Object[_0x6ac7('0x3d')]({},{'active':_0x6ac7('0x19'),'caller_id':_0x2d1a2b,'assigned_to':_0x79f610[_0x6ac7('0x1b')],'short_description':intUtil[_0x6ac7('0x3e')](_0x2920a1['Subjects'],_0x2c18c9,'\x20'),'description':intUtil[_0x6ac7('0x3e')](_0x2920a1['Descriptions'],_0x2c18c9,'\x0a')},getCustomFields(_0x2920a1['Fields'],_0x2c18c9)),'auth':_0x51fffe,'json':!![]};return rp(_0x217b57)[_0x6ac7('0xd')](function(_0x4ac201){logger['info']('['+[_0x48274e['toUpperCase']()]+_0x6ac7('0x3f'),_0x4ac201[_0x6ac7('0xe')]);_0x79f610['ticketId']=_0x4ac201[_0x6ac7('0xe')][_0x6ac7('0x1a')];_0x79f610[_0x6ac7('0x40')]=_0x4ac201['result'][_0x6ac7('0x41')];logger['info']('['+[_0x48274e['toUpperCase']()]+_0x6ac7('0x42'),_0x79f610);_0x48c3fe(_0x79f610);})['catch'](function(_0x2448b4){logger[_0x6ac7('0x20')]('['+[_0x48274e['toUpperCase']()]+']',_0x2448b4[_0x6ac7('0x21')]);_0x48fefa(_0x2448b4[_0x6ac7('0x21')]);});});};}function createRemoteTag(_0x818146,_0x4edb75,_0x5dee36,_0x51af86){return new Promise(function(_0x3b0cac,_0x2e8ea7){var _0x4a5ed3={'method':'POST','uri':_0x5dee36+_0x6ac7('0x43')+'?'+_0x51af86,'body':{'short_description':_0x818146,'global':!![],'active':!![],'name':_0x818146},'auth':_0x4edb75,'json':!![]};return rp(_0x4a5ed3)[_0x6ac7('0xd')](function(_0x180b98){var _0x5956ff=_0x180b98['result'][_0x6ac7('0x1a')];_0x3b0cac(_0x5956ff);});});}function getRemoteTag(_0x2d7614,_0x2a335c,_0x1230ea,_0x177e20,_0x59988b){return new Promise(function(_0x1f0237,_0x50c464){var _0x1389a7={'method':'GET','uri':_0x1230ea+_0x6ac7('0x43')+_0x6ac7('0x44')+_0x2d7614+'&'+_0x177e20,'auth':_0x2a335c,'json':!![]};return rp(_0x1389a7)[_0x6ac7('0xd')](function(_0x335305){if(_0x335305[_0x6ac7('0xe')]['length']>0x0){var _0x487c8f=_0x335305[_0x6ac7('0xe')][0x0][_0x6ac7('0x1a')];_0x1f0237(_0x487c8f);}else{return createRemoteTag(_0x2d7614,_0x2a335c,_0x1230ea,_0x177e20)[_0x6ac7('0xd')](function(_0x414c7d){_0x1f0237(_0x414c7d);});}});});}function assignTagToIncident(_0x529627,_0x1169ea,_0x4b28c3,_0x3794b5,_0x166ac3){return new Promise(function(_0x46f2bb,_0x2db1a6){var _0x291000={'method':'POST','uri':_0x4b28c3+_0x6ac7('0x45')+'?'+_0x166ac3,'body':{'label':_0x529627,'table':'incident','id_type':'Incident','table_key':_0x3794b5['ticketId'],'title':_0x6ac7('0x46')+_0x3794b5[_0x6ac7('0x40')],'id_display':_0x3794b5[_0x6ac7('0x40')]},'auth':_0x1169ea,'json':!![]};return rp(_0x291000)[_0x6ac7('0xd')](function(_0x30563a){_0x46f2bb();})[_0x6ac7('0x1f')](function(){_0x46f2bb();});});}function manageTags(_0x1dbf9d,_0x52f194,_0x3da46f,_0x5d7e9d,_0x155e8e,_0x4ff99f,_0x2c0707){return new Promise(function(_0x316b10,_0x4ad944){var _0x5b5a38=[];_0x52f194['forEach'](function(_0x4363d0){_0x5b5a38[_0x6ac7('0x47')](getRemoteTag(_0x4363d0,_0x3da46f,_0x5d7e9d,_0x4ff99f,_0x2c0707));});return Promise[_0x6ac7('0x48')](_0x5b5a38)[_0x6ac7('0xd')](function(_0x1e5fe3){if(_0x1e5fe3[_0x6ac7('0xf')]){logger['info']('['+[_0x1dbf9d[_0x6ac7('0x11')]()]+_0x6ac7('0x49'),_0x1e5fe3);var _0xaf0b84=[];_0x1e5fe3[_0x6ac7('0x2d')](function(_0x3f6b78){_0xaf0b84[_0x6ac7('0x47')](assignTagToIncident(_0x3f6b78,_0x3da46f,_0x5d7e9d,_0x155e8e,_0x4ff99f));});return Promise[_0x6ac7('0x48')](_0xaf0b84)['then'](function(){_0x316b10();})[_0x6ac7('0x1f')](function(){_0x316b10();});}else{_0x316b10();}});});}function getTags(_0xc95d10,_0x4c4908,_0x1e1ef4,_0x273d71,_0x581182,_0x318407){return function(_0x4c69b2){return new Promise(function(_0x2a0574,_0x2cce60){var _0x123f9e=[];var _0x1e076c=_0x273d71['Tags'];if(_0x1e076c&&_0x1e076c['length']>0x0){_0x123f9e=_[_0x6ac7('0x4a')](_0x1e076c,_0x6ac7('0x39'));}if(_0x123f9e[_0x6ac7('0xf')]>0x0){return manageTags(_0xc95d10,_0x123f9e,_0x4c4908,_0x1e1ef4,_0x4c69b2,_0x581182,_0x318407)['then'](function(){_0x2a0574(_0x4c69b2);});}else{_0x2a0574(_0x4c69b2);}});};}function emit(_0x234869,_0x8185ed,_0x17468a){var _0x1542b1=_0x6ac7('0x4b')+_0x6ac7('0x4c')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x6ac7('0x4d');var _0x4935f7={'uri':_0x234869+_0x6ac7('0x4e')+_0x17468a+_0x1542b1};io['to'](util[_0x6ac7('0x4f')](_0x6ac7('0x50'),_0x8185ed))[_0x6ac7('0x51')]('trigger:browser:url',_0x4935f7);}exports['cs']=function(_0x486832,_0x32fa61,_0x1dd7ba,_0x37472c,_0x42e650,_0xe35623,_0x43a7ab,_0x4c2688){var _0x362d6a={};var _0x479136={'user':_0xe35623[_0x6ac7('0x52')],'pass':_0xe35623['password']};var _0x9b040='sysparm_limit=1';var _0x500b0b=_0x6ac7('0x53');_0xe35623[_0x6ac7('0x54')]=intUtil[_0x6ac7('0x55')](_0xe35623['remoteUri']);_0xe35623[_0x6ac7('0x56')]=intUtil[_0x6ac7('0x55')](_0xe35623[_0x6ac7('0x56')]);var _0x198847=util['format'](_0x6ac7('0x57'),_0xe35623['remoteUri']);_0x362d6a[_0x6ac7('0x15')]=!_['isNil'](_0x37472c)?_0x37472c[_0x6ac7('0x58')]:null;_0x362d6a['adminEmail']=_0xe35623[_0x6ac7('0x58')];_0x362d6a[_0x6ac7('0x24')]=_0x4c2688[_0x6ac7('0x32')]()===_0x6ac7('0x3b')?_0x32fa61[_0x6ac7('0x59')]:_0x32fa61['calleridnum'];_0x362d6a[_0x6ac7('0x5a')]=_0x4c2688==='queue'||_0x4c2688===_0x6ac7('0x5b')?_0x6ac7('0x5c'):_0x6ac7('0x3b');var _0x31c3fd=util[_0x6ac7('0x4f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xe35623[_0x6ac7('0x56')],_0x32fa61[_0x6ac7('0x5d')],md5(_0x32fa61[_0x6ac7('0x5d')]));if(_0x42e650&&_0x42e650[_0x6ac7('0x5e')]){logger[_0x6ac7('0x10')](_0x6ac7('0x5f'),_0x6ac7('0x60'));_0x32fa61[_0x6ac7('0x61')]=_0x31c3fd;}else if(_0x43a7ab&&_0x43a7ab[_0x6ac7('0x62')]&&_0x43a7ab[_0x6ac7('0x62')]!==_0x6ac7('0x63')){logger[_0x6ac7('0x10')](_0x6ac7('0x64'),'Recording\x20is\x20enabled!');_0x32fa61['recordingURL']=_0x31c3fd;}else{_0x32fa61['recordingURL']='';}return getAdminUser(_0x4c2688,_0x479136,_0x362d6a,_0x198847,_0x500b0b,_0x9b040)[_0x6ac7('0xd')](getUser(_0x4c2688,_0x479136,_0x198847,_0x500b0b,_0x9b040))[_0x6ac7('0xd')](getEndUser(_0x4c2688,_0x479136,_0x198847,_0x500b0b,_0x9b040))[_0x6ac7('0xd')](getTicket(_0x4c2688,_0x479136,_0x198847,_0x1dd7ba,_0x32fa61,_0x500b0b))[_0x6ac7('0xd')](function(_0x37fc9a){logger[_0x6ac7('0x10')](util['format'](_0x6ac7('0x65'),_0x37fc9a[_0x6ac7('0x66')]));logger[_0x6ac7('0x10')](util[_0x6ac7('0x4f')]('call\x20direction:\x20%s',_0x4c2688));if(_0x4c2688!==_0x6ac7('0x5b')){logger[_0x6ac7('0x10')]('['+[_0x4c2688[_0x6ac7('0x11')]()]+']',_0x6ac7('0x67'));emit(_0xe35623['remoteUri'],_0x37472c['name'],_0x37fc9a[_0x6ac7('0x66')]);}})[_0x6ac7('0x1f')](function(_0xd8447c){logger['error']('['+[_0x4c2688[_0x6ac7('0x11')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x6ac7('0x68')](_0xd8447c,{'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 366a00a..440b46d 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 _0xc5db=['calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridnum','Outbound','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','unmanaged','toUpperCase','isNil','lodash','request-promise','bluebird','md5','./util','../../../../config/logger','sugarcrm','redis','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_name','direction','variableName','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','get_entry_list','Employees','user_name','entry_list','length','find','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Enduser\x20created.','debug','map','string','nameField','customField','toLowerCase','content','type','custom_fields','push','variable','customVariable','Variable','login','username','PLAIN','sessionID','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid'];(function(_0x5b0457,_0x38e163){var _0x25231b=function(_0x4694b4){while(--_0x4694b4){_0x5b0457['push'](_0x5b0457['shift']());}};_0x25231b(++_0x38e163);}(_0xc5db,0x1e8));var _0xbc5d=function(_0x4ca868,_0xf33587){_0x4ca868=_0x4ca868-0x0;var _0x33cdb9=_0xc5db[_0x4ca868];return _0x33cdb9;};'use strict';var _=require(_0xbc5d('0x0'));var rp=require(_0xbc5d('0x1'));var BPromise=require(_0xbc5d('0x2'));var md5=require(_0xbc5d('0x3'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xbc5d('0x4'));var config=require('../../../../config/environment');var logger=require(_0xbc5d('0x5'))(_0xbc5d('0x6'));config['redis']=_['defaults'](config[_0xbc5d('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var def={'method':_0xbc5d('0x8'),'json':!![]};function emit(_0x85f257,_0x4a8be5,_0x19fb32){io['to'](_0x85f257)[_0xbc5d('0x9')](_0x4a8be5,_0x19fb32);}function getTicket(_0xf29b06,_0x3ad9ba,_0x37b67a,_0x22221b,_0x58ee49,_0x7edb0f,_0x319c40,_0x357b73){logger[_0xbc5d('0xa')](_0xbc5d('0xb'));var _0x1d2273=new Date();var _0x16aa68=[{'name':_0xbc5d('0xc'),'value':intUtil[_0xbc5d('0xd')](_0x22221b[_0xbc5d('0xe')],_0x58ee49,'\x20')},{'name':_0xbc5d('0xf'),'value':_0x3ad9ba['id']},{'name':_0xbc5d('0x10'),'value':_0x3ad9ba['id']},{'name':_0xbc5d('0x11'),'value':intUtil[_0xbc5d('0xd')](_0x22221b[_0xbc5d('0x12')],_0x58ee49,'\x0a')},{'name':_0xbc5d('0x13'),'value':_0x1d2273[_0xbc5d('0x14')]()[_0xbc5d('0x15')](0x0,0x13)[_0xbc5d('0x16')]('T','\x20')},{'name':_0xbc5d('0x17'),'value':'0'},{'name':_0xbc5d('0x18'),'value':'15'},{'name':'parent_id','value':_0x37b67a['id']},{'name':'parent_type','value':'Contacts'},{'name':_0xbc5d('0x19'),'value':_0x37b67a['name']},{'name':_0xbc5d('0x1a'),'value':_0x357b73}];if(_0x7edb0f['length']){_['forEach'](_0x7edb0f,function(_0x578052){if(_0x58ee49[_0x578052[_0xbc5d('0x1b')]]){_0x16aa68['push']({'name':_0x578052[_0xbc5d('0x1c')],'value':_0x58ee49[_0x578052[_0xbc5d('0x1b')]]});}});}return request({'form':{'method':_0xbc5d('0x1d'),'input_type':_0xbc5d('0x1e'),'response_type':'JSON','rest_data':JSON[_0xbc5d('0x1f')]({'session':_0x319c40['id'],'module_name':_0xbc5d('0x20'),'name_value_list':_0x16aa68})}});}function getAuth(_0x585a15){return util[_0xbc5d('0x21')](_0xbc5d('0x22'),new Buffer(_0x585a15[_0xbc5d('0x23')]+':X')[_0xbc5d('0x24')](_0xbc5d('0x25')));}function getServerInfo(_0x3fce54){return request({'form':{'method':_0xbc5d('0x26'),'input_type':_0xbc5d('0x1e'),'response_type':_0xbc5d('0x1e'),'rest_data':JSON[_0xbc5d('0x1f')]({'session':_0x3fce54['id']})}});}function getUser(_0x55c4c9,_0x19bd44,_0x5971d4){if(!_['isNil'](_0x19bd44)){logger[_0xbc5d('0xa')]('Getting\x20agent\x20with\x20name',_0x19bd44);return request({'form':{'method':_0xbc5d('0x27'),'input_type':_0xbc5d('0x1e'),'response_type':_0xbc5d('0x1e'),'rest_data':JSON[_0xbc5d('0x1f')]({'session':_0x5971d4['id'],'module_name':_0xbc5d('0x28'),'query':util[_0xbc5d('0x21')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x19bd44),'order_by':'','offset':'0','select_fields':['id','name',_0xbc5d('0x29')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x265f19){if(_0x265f19[_0xbc5d('0x2a')][_0xbc5d('0x2b')]){var _0x1035c1=_[_0xbc5d('0x2c')](_0x265f19['entry_list'],function(_0x473e12){return _0x473e12[_0xbc5d('0x2d')]['user_name'][_0xbc5d('0x2e')]===_0x19bd44;});if(_0x1035c1){logger[_0xbc5d('0xa')](_0xbc5d('0x2f'));return BPromise[_0xbc5d('0x30')]({'id':_0x1035c1['name_value_list']['id']['value'],'name':_0x1035c1['name_value_list']['name'][_0xbc5d('0x2e')]});}}logger['info'](_0xbc5d('0x31'));return BPromise[_0xbc5d('0x30')]({'id':_0x5971d4[_0xbc5d('0x2d')][_0xbc5d('0x32')]['value'],'name':_0x5971d4[_0xbc5d('0x2d')][_0xbc5d('0x29')]['value']});});}else{logger[_0xbc5d('0xa')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xbc5d('0x30')]({'id':_0x5971d4[_0xbc5d('0x2d')]['user_id'][_0xbc5d('0x2e')],'name':_0x5971d4['name_value_list'][_0xbc5d('0x29')][_0xbc5d('0x2e')]});}}function getEndUser(_0x110769,_0x37c742,_0x14ca78,_0x14eb5a){logger[_0xbc5d('0xa')]('Searching\x20enduser\x20with\x20phone',_0x14ca78);return request({'form':{'method':_0xbc5d('0x27'),'input_type':_0xbc5d('0x1e'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x14eb5a['id'],'module_name':_0xbc5d('0x33'),'query':util[_0xbc5d('0x21')](_0xbc5d('0x34'),_0x14ca78),'order_by':'','offset':'0','select_fields':['id',_0xbc5d('0xc'),_0xbc5d('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xbc5d('0x36')](function(_0x1cc0d0){if(_0x1cc0d0[_0xbc5d('0x2a')][_0xbc5d('0x2b')]){var _0x10e431=_[_0xbc5d('0x2c')](_0x1cc0d0[_0xbc5d('0x2a')],function(_0x50f6aa){return _0x50f6aa[_0xbc5d('0x2d')][_0xbc5d('0x35')]['value']===_0x14ca78;});if(_0x10e431){logger[_0xbc5d('0xa')](_0xbc5d('0x37'));return BPromise[_0xbc5d('0x30')]({'id':_0x10e431['name_value_list']['id'][_0xbc5d('0x2e')],'name':_0x10e431[_0xbc5d('0x2d')]['name']['value'],'phone':_0x10e431['name_value_list'][_0xbc5d('0x35')][_0xbc5d('0x2e')]});}}else{logger[_0xbc5d('0xa')](_0xbc5d('0x38'));return request({'form':{'method':_0xbc5d('0x1d'),'input_type':_0xbc5d('0x1e'),'response_type':'JSON','rest_data':JSON[_0xbc5d('0x1f')]({'session':_0x14eb5a['id'],'module_name':_0xbc5d('0x33'),'name_value_list':[{'name':_0xbc5d('0x39'),'value':_0x37c742!==''?_0x37c742:util['format']('Caller\x20-\x20%s',_0x14ca78)},{'name':_0xbc5d('0x35'),'value':_0x14ca78}]})}})[_0xbc5d('0x36')](function(_0x3e2dc3){logger[_0xbc5d('0xa')](_0xbc5d('0x3a'));return BPromise[_0xbc5d('0x30')]({'id':_0x3e2dc3['id'],'name':_0x3e2dc3[_0xbc5d('0x2a')]['first_name'][_0xbc5d('0x2e')],'phone':_0x3e2dc3[_0xbc5d('0x2a')][_0xbc5d('0x35')]['value']});});}});}function request(_0x3745e5){logger[_0xbc5d('0x3b')]('[HTTP]',JSON[_0xbc5d('0x1f')](_0x3745e5));return rp(_['merge'](def,_0x3745e5));}function getTags(_0xe89ef2,_0x26851b){var _0x1050b9=[];if(_0xe89ef2&&_0xe89ef2['length']>0x0){_0x1050b9=_[_0xbc5d('0x3c')](_0xe89ef2,_0x26851b);}return _0x1050b9;}function getCustomFields(_0x4480e1,_0x41de1c){var _0x10e9de=[];var _0x26265a={'custom_fields':[]};if(_0x4480e1[_0xbc5d('0x2b')]>0x0){_['forEach'](_0x4480e1,function(_0xc9915){if(_0xc9915['type']===_0xbc5d('0x3d')&&_0xc9915[_0xbc5d('0x3e')]&&!_0xc9915[_0xbc5d('0x3f')]){_0x26265a[_0xc9915[_0xbc5d('0x3e')][_0xbc5d('0x40')]()]=_0xc9915[_0xbc5d('0x41')][_0xbc5d('0x24')]();}else if(_0xc9915[_0xbc5d('0x42')]===_0xbc5d('0x3d')&&_0xc9915[_0xbc5d('0x1c')]&&_0xc9915['customField']){_0x26265a[_0xbc5d('0x43')][_0xbc5d('0x44')]({'id':_0xc9915[_0xbc5d('0x1c')],'value':_0xc9915[_0xbc5d('0x41')][_0xbc5d('0x24')]()});}else if(_0xc9915[_0xbc5d('0x42')]===_0xbc5d('0x45')&&_0xc9915[_0xbc5d('0x1b')]&&_0xc9915[_0xbc5d('0x1c')]&&_0xc9915[_0xbc5d('0x3f')]){_0x41de1c[_0xc9915[_0xbc5d('0x1b')]]&&_0x26265a[_0xbc5d('0x43')]['push']({'id':_0xc9915[_0xbc5d('0x1c')],'value':_0x41de1c[_0xc9915['variableName']]['toString']()});}else if(_0xc9915[_0xbc5d('0x42')]===_0xbc5d('0x46')&&_0xc9915[_0xbc5d('0x47')]&&_0xc9915[_0xbc5d('0x47')][_0xbc5d('0xc')]&&_0xc9915[_0xbc5d('0x1c')]&&_0xc9915[_0xbc5d('0x3f')]){_0x41de1c[_0xc9915[_0xbc5d('0x47')]['name']['toLowerCase']()]&&_0x26265a[_0xbc5d('0x43')][_0xbc5d('0x44')]({'id':_0xc9915[_0xbc5d('0x1c')],'value':_0x41de1c[_0xc9915[_0xbc5d('0x47')]['name'][_0xbc5d('0x40')]()][_0xbc5d('0x24')]()});}});}return _0x26265a;}function getConnection(_0x35593e){return request({'method':_0xbc5d('0x8'),'form':{'method':_0xbc5d('0x48'),'input_type':_0xbc5d('0x1e'),'response_type':'JSON','rest_data':JSON[_0xbc5d('0x1f')]({'user_auth':{'user_name':_0x35593e[_0xbc5d('0x49')],'password':_0x35593e['password'],'encryption':_0xbc5d('0x4a')},'application':'xCALLY\x20Motion\x20integration'})}})[_0xbc5d('0x36')](function(_0x3b4547){var _0x2de54b=_0x3b4547;if(_0x2de54b['id']){def[_0xbc5d('0x4b')]=_0x2de54b['id'];return BPromise['resolve'](_0x2de54b);}else{throw new Error(util[_0xbc5d('0x21')]('Account\x20%d\x20is\x20not\x20valid',_0x35593e['id']));}});}function setRelationship(_0xb4ef64,_0xb5d4e8,_0x19d492,_0x38b066){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':_0xbc5d('0x1e'),'rest_data':JSON['stringify']({'session':_0xb4ef64['id'],'module_name':_0xbc5d('0x20'),'module_id':_0x19d492['id'],'link_field_name':_0x38b066,'related_ids':[_0xb5d4e8['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xbc5d('0x4c')]=function(_0x32464c,_0xe7bcf,_0x1bd974,_0x276611,_0x4ac5a6,_0x2b1ebd){var _0x50a141,_0x13bf8a,_0x1443fe,_0x1b6928;_0x2b1ebd[_0xbc5d('0x4d')]=intUtil[_0xbc5d('0x4e')](_0x2b1ebd[_0xbc5d('0x4d')]);_0x2b1ebd[_0xbc5d('0x4f')]=intUtil[_0xbc5d('0x4e')](_0x2b1ebd[_0xbc5d('0x4f')]);def[_0xbc5d('0x50')]=util[_0xbc5d('0x21')](_0xbc5d('0x51'),_0x2b1ebd[_0xbc5d('0x4d')]);if(_0x4ac5a6&&_0x4ac5a6['monitor_format']){logger[_0xbc5d('0xa')](_0xbc5d('0x52'),_0xbc5d('0x53'));_0xe7bcf[_0xbc5d('0x54')]=util['format'](_0xbc5d('0x55'),_0x2b1ebd[_0xbc5d('0x4f')],_0xe7bcf['uniqueid'],md5(_0xe7bcf[_0xbc5d('0x56')]));}else{_0xe7bcf['recordingURL']='';}return getConnection(_0x2b1ebd)[_0xbc5d('0x36')](function(_0x4252d5){_0x1b6928=_0x4252d5;return getUser(_0x2b1ebd,_0x276611[_0xbc5d('0xc')],_0x1b6928);})[_0xbc5d('0x36')](function(_0x2c9e78){_0x50a141=_0x2c9e78;logger[_0xbc5d('0xa')]('The\x20User\x20ID\x20is:',_0x50a141['id']);return getEndUser(_0x2b1ebd,_0xe7bcf[_0xbc5d('0x57')],_0xe7bcf[_0xbc5d('0x58')],_0x1b6928);})[_0xbc5d('0x36')](function(_0x5cf7d6){_0x13bf8a=_0x5cf7d6;logger['info'](_0xbc5d('0x59'),_0x13bf8a['id']);return getTicket(_0x2b1ebd,_0x50a141,_0x13bf8a,_0x1bd974,_0xe7bcf,_0x1bd974[_0xbc5d('0x5a')],_0x1b6928,_0xbc5d('0x5b'));})['then'](function(_0x19ef79){_0x1443fe=_0x19ef79;logger[_0xbc5d('0xa')](_0xbc5d('0x5c'));logger['info'](_0xbc5d('0x5d'),_0x1443fe['id']);return setRelationship(_0x1b6928,_0x50a141,_0x1443fe,_0xbc5d('0x5e'));})[_0xbc5d('0x36')](function(){return setRelationship(_0x1b6928,_0x13bf8a,_0x1443fe,_0xbc5d('0x5f'));})[_0xbc5d('0x36')](function(){return getServerInfo(_0x1b6928);})[_0xbc5d('0x36')](function(_0x1eab6e){var _0x22ae16=parseInt(_0x1eab6e['version'][_0xbc5d('0x60')](0x0));var _0xd4b61=util[_0xbc5d('0x21')](_0xbc5d('0x61'),_0x2b1ebd[_0xbc5d('0x4d')],_0x1443fe['id']);if(_0x22ae16>0x6){_0xd4b61=util[_0xbc5d('0x21')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x2b1ebd[_0xbc5d('0x4d')],_0x1443fe['id']);}logger[_0xbc5d('0xa')](_0xbc5d('0x52'),_0xbc5d('0x62'));emit(util[_0xbc5d('0x21')]('user:%s',_0x276611['name']),_0xbc5d('0x63'),{'uri':_0xd4b61});})[_0xbc5d('0x64')](function(_0x4b480b){logger[_0xbc5d('0x65')]('[QUEUE]',JSON['stringify'](_0x4b480b));});};exports[_0xbc5d('0x66')]=function(_0x32211e,_0x2179f7,_0x4b7ee2,_0x5917cc,_0x171b01,_0x583c71,_0x4474d1){var _0x551f67,_0xadcc6f,_0x226233,_0x511b27;_0x583c71['remoteUri']=intUtil[_0xbc5d('0x4e')](_0x583c71[_0xbc5d('0x4d')]);_0x583c71[_0xbc5d('0x4f')]=intUtil[_0xbc5d('0x4e')](_0x583c71[_0xbc5d('0x4f')]);def[_0xbc5d('0x50')]=util[_0xbc5d('0x21')](_0xbc5d('0x51'),_0x583c71[_0xbc5d('0x4d')]);if(_0x4474d1&&_0x4474d1[_0xbc5d('0x67')]&&_0x4474d1[_0xbc5d('0x67')]!==_0xbc5d('0x68')){logger[_0xbc5d('0xa')](_0xbc5d('0x69'),'Recording\x20is\x20enabled!');_0x2179f7[_0xbc5d('0x54')]=util[_0xbc5d('0x21')](_0xbc5d('0x55'),_0x583c71[_0xbc5d('0x4f')],_0x2179f7[_0xbc5d('0x56')],md5(_0x2179f7['uniqueid']));}return getConnection(_0x583c71)[_0xbc5d('0x36')](function(_0x4a6769){_0x511b27=_0x4a6769;return getUser(_0x583c71,_0x5917cc[_0xbc5d('0xc')],_0x511b27);})[_0xbc5d('0x36')](function(_0x4f9441){_0x551f67=_0x4f9441;logger[_0xbc5d('0xa')](_0xbc5d('0x6a'),_0x551f67['id']);return getEndUser(_0x583c71,_0x2179f7['destcalleridname'],_0x2179f7[_0xbc5d('0x6b')],_0x511b27);})['then'](function(_0x319099){_0xadcc6f=_0x319099;logger[_0xbc5d('0xa')](_0xbc5d('0x59'),_0xadcc6f['id']);return getTicket(_0x583c71,_0x551f67,_0xadcc6f,_0x4b7ee2,_0x2179f7,_0x4b7ee2[_0xbc5d('0x5a')],_0x511b27,_0xbc5d('0x6c'));})['then'](function(_0x2fb119){_0x226233=_0x2fb119;logger[_0xbc5d('0xa')](_0xbc5d('0x5c'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x226233['id']);return setRelationship(_0x511b27,_0x551f67,_0x226233,_0xbc5d('0x5e'));})[_0xbc5d('0x36')](function(){return setRelationship(_0x511b27,_0xadcc6f,_0x226233,_0xbc5d('0x5f'));})[_0xbc5d('0x36')](function(){return getServerInfo(_0x511b27);})[_0xbc5d('0x36')](function(_0x59f58f){var _0x5a2e62=parseInt(_0x59f58f[_0xbc5d('0x6d')][_0xbc5d('0x60')](0x0));var _0xc0987d=util[_0xbc5d('0x21')](_0xbc5d('0x61'),_0x583c71[_0xbc5d('0x4d')],_0x226233['id']);if(_0x5a2e62>0x6){_0xc0987d=util[_0xbc5d('0x21')](_0xbc5d('0x6e'),_0x583c71['remoteUri'],_0x226233['id']);}logger[_0xbc5d('0xa')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xbc5d('0x21')](_0xbc5d('0x6f'),_0x5917cc[_0xbc5d('0xc')]),'trigger:browser:url',{'uri':_0xc0987d});})[_0xbc5d('0x64')](function(_0x34a025){logger[_0xbc5d('0x65')](_0xbc5d('0x69'),JSON[_0xbc5d('0x1f')](_0x34a025));});};exports[_0xbc5d('0x70')]=function(_0xc2ad24,_0x4cdc2d,_0x5b2d04,_0xbe6137,_0x385fdc,_0x584e9a){var _0xb6b5dd,_0x44f8d0,_0x473a38,_0x31c270;_0x584e9a[_0xbc5d('0x4d')]=intUtil['stripTrailingSlash'](_0x584e9a[_0xbc5d('0x4d')]);_0x584e9a[_0xbc5d('0x4f')]=intUtil[_0xbc5d('0x4e')](_0x584e9a[_0xbc5d('0x4f')]);def['uri']=util['format'](_0xbc5d('0x51'),_0x584e9a['remoteUri']);if(_0x385fdc&&_0x385fdc['monitor_format']){logger[_0xbc5d('0xa')]('['+_0x4cdc2d['lastevent'][_0xbc5d('0x71')]()+']',_0xbc5d('0x53'));_0x4cdc2d['recordingURL']=util[_0xbc5d('0x21')](_0xbc5d('0x55'),_0x584e9a[_0xbc5d('0x4f')],_0x4cdc2d['uniqueid'],md5(_0x4cdc2d[_0xbc5d('0x56')]));}else{_0x4cdc2d[_0xbc5d('0x54')]='';}return getConnection(_0x584e9a)[_0xbc5d('0x36')](function(_0x325871){_0x31c270=_0x325871;if(!_[_0xbc5d('0x72')](_0xbe6137)){return getUser(_0x584e9a,_0xbe6137[_0xbc5d('0xc')],_0x31c270);}else{return getUser(_0x584e9a,null,_0x31c270);}})[_0xbc5d('0x36')](function(_0x44d989){_0xb6b5dd=_0x44d989;logger[_0xbc5d('0xa')]('The\x20User\x20ID\x20is:',_0xb6b5dd['id']);return getEndUser(_0x584e9a,_0x4cdc2d[_0xbc5d('0x57')],_0x4cdc2d[_0xbc5d('0x58')],_0x31c270);})[_0xbc5d('0x36')](function(_0x27dc8f){_0x44f8d0=_0x27dc8f;logger[_0xbc5d('0xa')](_0xbc5d('0x59'),_0x44f8d0['id']);return getTicket(_0x584e9a,_0xb6b5dd,_0x44f8d0,_0x5b2d04,_0x4cdc2d,_0x5b2d04[_0xbc5d('0x5a')],_0x31c270,_0xbc5d('0x5b'));})[_0xbc5d('0x36')](function(_0x273d64){_0x473a38=_0x273d64;logger[_0xbc5d('0xa')](_0xbc5d('0x5c'));logger[_0xbc5d('0xa')](_0xbc5d('0x5d'),_0x473a38['id']);return setRelationship(_0x31c270,_0xb6b5dd,_0x473a38,_0xbc5d('0x5e'));})['then'](function(){return setRelationship(_0x31c270,_0x44f8d0,_0x473a38,_0xbc5d('0x5f'));})['then'](function(){return getServerInfo(_0x31c270);})['catch'](function(_0xa41e7a){logger[_0xbc5d('0x65')]('['+_0x4cdc2d['lastevent']['toUpperCase']()+']',JSON[_0xbc5d('0x1f')](_0xa41e7a));});}; \ No newline at end of file +var _0x197f=['INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','value','resolve','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','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','debug','merge','map','string','nameField','customField','content','toString','type','custom_fields','push','variable','idField','customVariable','Variable','toLowerCase','login','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','Calls','queue','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','error','unmanaged','toUpperCase','Recording\x20is\x20enabled!','calleridname','lastevent','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','socket.io-emitter','POST','info','Creating\x20new\x20ticket...','getString','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','name','direction','length','forEach','variableName','set_entry','JSON','format','apiKey','base64','get_server_info','stringify','isNil','get_entry_list','Employees'];(function(_0x2306a0,_0x19045e){var _0x425eb8=function(_0x266749){while(--_0x266749){_0x2306a0['push'](_0x2306a0['shift']());}};_0x425eb8(++_0x19045e);}(_0x197f,0xd0));var _0xf197=function(_0x43159c,_0x1b5b30){_0x43159c=_0x43159c-0x0;var _0x51d5e7=_0x197f[_0x43159c];return _0x51d5e7;};'use strict';var _=require(_0xf197('0x0'));var rp=require(_0xf197('0x1'));var BPromise=require(_0xf197('0x2'));var md5=require(_0xf197('0x3'));var util=require(_0xf197('0x4'));var Redis=require(_0xf197('0x5'));var intUtil=require(_0xf197('0x6'));var config=require(_0xf197('0x7'));var logger=require(_0xf197('0x8'))(_0xf197('0x9'));config[_0xf197('0xa')]=_[_0xf197('0xb')](config[_0xf197('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xf197('0xc'))(new Redis(config['redis']));var def={'method':_0xf197('0xd'),'json':!![]};function emit(_0x4507e6,_0x63a86d,_0x436b2b){io['to'](_0x4507e6)['emit'](_0x63a86d,_0x436b2b);}function getTicket(_0x65e5e2,_0x470f4c,_0x215719,_0x3657d3,_0x3768a2,_0x3c5316,_0x21381c,_0x4330e7){logger[_0xf197('0xe')](_0xf197('0xf'));var _0x351d6b=new Date();var _0x3acd7e=[{'name':'name','value':intUtil[_0xf197('0x10')](_0x3657d3['Subjects'],_0x3768a2,'\x20')},{'name':_0xf197('0x11'),'value':_0x470f4c['id']},{'name':_0xf197('0x12'),'value':_0x470f4c['id']},{'name':_0xf197('0x13'),'value':intUtil[_0xf197('0x10')](_0x3657d3[_0xf197('0x14')],_0x3768a2,'\x0a')},{'name':_0xf197('0x15'),'value':_0x351d6b[_0xf197('0x16')]()[_0xf197('0x17')](0x0,0x13)[_0xf197('0x18')]('T','\x20')},{'name':_0xf197('0x19'),'value':'0'},{'name':_0xf197('0x1a'),'value':'15'},{'name':_0xf197('0x1b'),'value':_0x215719['id']},{'name':_0xf197('0x1c'),'value':_0xf197('0x1d')},{'name':_0xf197('0x1e'),'value':_0x215719[_0xf197('0x1f')]},{'name':_0xf197('0x20'),'value':_0x4330e7}];if(_0x3c5316[_0xf197('0x21')]){_[_0xf197('0x22')](_0x3c5316,function(_0x25226d){if(_0x3768a2[_0x25226d[_0xf197('0x23')]]){_0x3acd7e['push']({'name':_0x25226d['idField'],'value':_0x3768a2[_0x25226d['variableName']]});}});}return request({'form':{'method':_0xf197('0x24'),'input_type':_0xf197('0x25'),'response_type':_0xf197('0x25'),'rest_data':JSON['stringify']({'session':_0x21381c['id'],'module_name':'Calls','name_value_list':_0x3acd7e})}});}function getAuth(_0x5e4d48){return util[_0xf197('0x26')]('Basic\x20%s',new Buffer(_0x5e4d48[_0xf197('0x27')]+':X')['toString'](_0xf197('0x28')));}function getServerInfo(_0x1d4994){return request({'form':{'method':_0xf197('0x29'),'input_type':_0xf197('0x25'),'response_type':_0xf197('0x25'),'rest_data':JSON[_0xf197('0x2a')]({'session':_0x1d4994['id']})}});}function getUser(_0x2e4be8,_0x44f046,_0x10bf9f){if(!_[_0xf197('0x2b')](_0x44f046)){logger[_0xf197('0xe')]('Getting\x20agent\x20with\x20name',_0x44f046);return request({'form':{'method':_0xf197('0x2c'),'input_type':_0xf197('0x25'),'response_type':_0xf197('0x25'),'rest_data':JSON[_0xf197('0x2a')]({'session':_0x10bf9f['id'],'module_name':_0xf197('0x2d'),'query':util[_0xf197('0x26')](_0xf197('0x2e'),_0x44f046),'order_by':'','offset':'0','select_fields':['id',_0xf197('0x1f'),_0xf197('0x2f')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf197('0x30')](function(_0x21ddc3){if(_0x21ddc3[_0xf197('0x31')]['length']){var _0x5c18b7=_['find'](_0x21ddc3[_0xf197('0x31')],function(_0x44da67){return _0x44da67['name_value_list'][_0xf197('0x2f')][_0xf197('0x32')]===_0x44f046;});if(_0x5c18b7){logger[_0xf197('0xe')]('Agent\x20found!');return BPromise[_0xf197('0x33')]({'id':_0x5c18b7[_0xf197('0x34')]['id'][_0xf197('0x32')],'name':_0x5c18b7['name_value_list'][_0xf197('0x1f')][_0xf197('0x32')]});}}logger[_0xf197('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x10bf9f[_0xf197('0x34')][_0xf197('0x35')][_0xf197('0x32')],'name':_0x10bf9f[_0xf197('0x34')][_0xf197('0x2f')]['value']});});}else{logger[_0xf197('0xe')](_0xf197('0x36'));return BPromise[_0xf197('0x33')]({'id':_0x10bf9f[_0xf197('0x34')]['user_id'][_0xf197('0x32')],'name':_0x10bf9f[_0xf197('0x34')][_0xf197('0x2f')][_0xf197('0x32')]});}}function getEndUser(_0x51885b,_0x47b8f8,_0x23b281,_0x328836){logger[_0xf197('0xe')](_0xf197('0x37'),_0x23b281);return request({'form':{'method':_0xf197('0x2c'),'input_type':_0xf197('0x25'),'response_type':_0xf197('0x25'),'rest_data':JSON[_0xf197('0x2a')]({'session':_0x328836['id'],'module_name':_0xf197('0x1d'),'query':util[_0xf197('0x26')](_0xf197('0x38'),_0x23b281),'order_by':'','offset':'0','select_fields':['id',_0xf197('0x1f'),_0xf197('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf197('0x30')](function(_0x7ef2b7){if(_0x7ef2b7[_0xf197('0x31')]['length']){var _0x1f2f31=_[_0xf197('0x3a')](_0x7ef2b7['entry_list'],function(_0x197eb7){return _0x197eb7[_0xf197('0x34')][_0xf197('0x39')][_0xf197('0x32')]===_0x23b281;});if(_0x1f2f31){logger[_0xf197('0xe')](_0xf197('0x3b'));return BPromise[_0xf197('0x33')]({'id':_0x1f2f31['name_value_list']['id'][_0xf197('0x32')],'name':_0x1f2f31[_0xf197('0x34')]['name'][_0xf197('0x32')],'phone':_0x1f2f31['name_value_list'][_0xf197('0x39')][_0xf197('0x32')]});}}else{logger[_0xf197('0xe')](_0xf197('0x3c'));return request({'form':{'method':_0xf197('0x24'),'input_type':_0xf197('0x25'),'response_type':'JSON','rest_data':JSON[_0xf197('0x2a')]({'session':_0x328836['id'],'module_name':'Contacts','name_value_list':[{'name':_0xf197('0x3d'),'value':_0x47b8f8!==_0xf197('0x3e')?_0x47b8f8:util[_0xf197('0x26')](_0xf197('0x3f'),_0x23b281)},{'name':_0xf197('0x39'),'value':_0x23b281}]})}})['then'](function(_0x20daed){logger['info']('Enduser\x20created.');return BPromise['resolve']({'id':_0x20daed['id'],'name':_0x20daed[_0xf197('0x31')][_0xf197('0x3d')][_0xf197('0x32')],'phone':_0x20daed[_0xf197('0x31')][_0xf197('0x39')][_0xf197('0x32')]});});}});}function request(_0x412d25){logger[_0xf197('0x40')]('[HTTP]',JSON[_0xf197('0x2a')](_0x412d25));return rp(_[_0xf197('0x41')](def,_0x412d25));}function getTags(_0x513275,_0xd9d5f){var _0xf39597=[];if(_0x513275&&_0x513275[_0xf197('0x21')]>0x0){_0xf39597=_[_0xf197('0x42')](_0x513275,_0xd9d5f);}return _0xf39597;}function getCustomFields(_0x4dba5f,_0x7a08eb){var _0x56c6ce=[];var _0xb9520e={'custom_fields':[]};if(_0x4dba5f['length']>0x0){_[_0xf197('0x22')](_0x4dba5f,function(_0x262c30){if(_0x262c30['type']===_0xf197('0x43')&&_0x262c30[_0xf197('0x44')]&&!_0x262c30[_0xf197('0x45')]){_0xb9520e[_0x262c30[_0xf197('0x44')]['toLowerCase']()]=_0x262c30[_0xf197('0x46')][_0xf197('0x47')]();}else if(_0x262c30[_0xf197('0x48')]===_0xf197('0x43')&&_0x262c30['idField']&&_0x262c30[_0xf197('0x45')]){_0xb9520e[_0xf197('0x49')][_0xf197('0x4a')]({'id':_0x262c30['idField'],'value':_0x262c30[_0xf197('0x46')][_0xf197('0x47')]()});}else if(_0x262c30[_0xf197('0x48')]===_0xf197('0x4b')&&_0x262c30[_0xf197('0x23')]&&_0x262c30['idField']&&_0x262c30[_0xf197('0x45')]){_0x7a08eb[_0x262c30[_0xf197('0x23')]]&&_0xb9520e['custom_fields'][_0xf197('0x4a')]({'id':_0x262c30[_0xf197('0x4c')],'value':_0x7a08eb[_0x262c30[_0xf197('0x23')]][_0xf197('0x47')]()});}else if(_0x262c30['type']===_0xf197('0x4d')&&_0x262c30[_0xf197('0x4e')]&&_0x262c30[_0xf197('0x4e')][_0xf197('0x1f')]&&_0x262c30[_0xf197('0x4c')]&&_0x262c30[_0xf197('0x45')]){_0x7a08eb[_0x262c30[_0xf197('0x4e')]['name'][_0xf197('0x4f')]()]&&_0xb9520e['custom_fields'][_0xf197('0x4a')]({'id':_0x262c30['idField'],'value':_0x7a08eb[_0x262c30[_0xf197('0x4e')][_0xf197('0x1f')][_0xf197('0x4f')]()][_0xf197('0x47')]()});}});}return _0xb9520e;}function getConnection(_0x3407a4){return request({'method':_0xf197('0xd'),'form':{'method':_0xf197('0x50'),'input_type':_0xf197('0x25'),'response_type':_0xf197('0x25'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x3407a4['username'],'password':_0x3407a4[_0xf197('0x51')],'encryption':'PLAIN'},'application':_0xf197('0x52')})}})[_0xf197('0x30')](function(_0x1ac771){var _0x366f10=_0x1ac771;if(_0x366f10['id']){def[_0xf197('0x53')]=_0x366f10['id'];return BPromise[_0xf197('0x33')](_0x366f10);}else{throw new Error(util[_0xf197('0x26')](_0xf197('0x54'),_0x3407a4['id']));}});}function setRelationship(_0xcebafc,_0x3fa6ea,_0x21f949,_0x40bffd){return request({'form':{'method':'set_relationship','input_type':_0xf197('0x25'),'response_type':_0xf197('0x25'),'rest_data':JSON['stringify']({'session':_0xcebafc['id'],'module_name':_0xf197('0x55'),'module_id':_0x21f949['id'],'link_field_name':_0x40bffd,'related_ids':[_0x3fa6ea['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xf197('0x56')]=function(_0x35f96d,_0x3a002a,_0x59527d,_0x5b5ced,_0x272e91,_0x49fa29){var _0x35d35c,_0x4c5f5f,_0x33021c,_0x3ef0f8;_0x49fa29['remoteUri']=intUtil[_0xf197('0x57')](_0x49fa29[_0xf197('0x58')]);_0x49fa29[_0xf197('0x59')]=intUtil[_0xf197('0x57')](_0x49fa29[_0xf197('0x59')]);def[_0xf197('0x5a')]=util[_0xf197('0x26')](_0xf197('0x5b'),_0x49fa29[_0xf197('0x58')]);if(_0x272e91&&_0x272e91[_0xf197('0x5c')]){logger[_0xf197('0xe')](_0xf197('0x5d'),'Recording\x20is\x20enabled!');_0x3a002a[_0xf197('0x5e')]=util['format'](_0xf197('0x5f'),_0x49fa29[_0xf197('0x59')],_0x3a002a[_0xf197('0x60')],md5(_0x3a002a[_0xf197('0x60')]));}else{_0x3a002a[_0xf197('0x5e')]='';}return getConnection(_0x49fa29)['then'](function(_0x3e0828){_0x3ef0f8=_0x3e0828;return getUser(_0x49fa29,_0x5b5ced['name'],_0x3ef0f8);})['then'](function(_0x1538d9){_0x35d35c=_0x1538d9;logger['info'](_0xf197('0x61'),_0x35d35c['id']);return getEndUser(_0x49fa29,_0x3a002a['calleridname'],_0x3a002a[_0xf197('0x62')],_0x3ef0f8);})[_0xf197('0x30')](function(_0xf9e761){_0x4c5f5f=_0xf9e761;logger[_0xf197('0xe')](_0xf197('0x63'),_0x4c5f5f['id']);return getTicket(_0x49fa29,_0x35d35c,_0x4c5f5f,_0x59527d,_0x3a002a,_0x59527d[_0xf197('0x64')],_0x3ef0f8,_0xf197('0x65'));})[_0xf197('0x30')](function(_0x179be8){_0x33021c=_0x179be8;logger[_0xf197('0xe')](_0xf197('0x66'));logger[_0xf197('0xe')](_0xf197('0x67'),_0x33021c['id']);return setRelationship(_0x3ef0f8,_0x35d35c,_0x33021c,_0xf197('0x68'));})[_0xf197('0x30')](function(){return setRelationship(_0x3ef0f8,_0x4c5f5f,_0x33021c,_0xf197('0x69'));})[_0xf197('0x30')](function(){return getServerInfo(_0x3ef0f8);})[_0xf197('0x30')](function(_0x1e3951){var _0x2429d3=parseInt(_0x1e3951[_0xf197('0x6a')][_0xf197('0x6b')](0x0));var _0x561142=util[_0xf197('0x26')](_0xf197('0x6c'),_0x49fa29[_0xf197('0x58')],_0x33021c['id']);if(_0x2429d3>0x6){_0x561142=util[_0xf197('0x26')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x49fa29[_0xf197('0x58')],_0x33021c['id']);}logger['info']('[QUEUE]',_0xf197('0x6d'));emit(util[_0xf197('0x26')](_0xf197('0x6e'),_0x5b5ced[_0xf197('0x1f')]),_0xf197('0x6f'),{'uri':_0x561142});})[_0xf197('0x70')](function(_0x531cad){logger['error']('[QUEUE]',JSON[_0xf197('0x2a')](_0x531cad));});};exports[_0xf197('0x71')]=function(_0x22deb7,_0x37b436,_0x21e343,_0x4d3a51,_0x2ad4ab,_0x5450f1,_0x2897c2){var _0xd13b40,_0x191b8d,_0x499b48,_0x21c835;_0x5450f1[_0xf197('0x58')]=intUtil[_0xf197('0x57')](_0x5450f1[_0xf197('0x58')]);_0x5450f1[_0xf197('0x59')]=intUtil[_0xf197('0x57')](_0x5450f1[_0xf197('0x59')]);def[_0xf197('0x5a')]=util[_0xf197('0x26')]('%s/service/v4_1/rest.php',_0x5450f1[_0xf197('0x58')]);if(_0x2897c2&&_0x2897c2[_0xf197('0x72')]&&_0x2897c2[_0xf197('0x72')]!==_0xf197('0x73')){logger[_0xf197('0xe')](_0xf197('0x74'),'Recording\x20is\x20enabled!');_0x37b436[_0xf197('0x5e')]=util[_0xf197('0x26')](_0xf197('0x5f'),_0x5450f1[_0xf197('0x59')],_0x37b436[_0xf197('0x60')],md5(_0x37b436['uniqueid']));}return getConnection(_0x5450f1)[_0xf197('0x30')](function(_0x295996){_0x21c835=_0x295996;return getUser(_0x5450f1,_0x4d3a51['name'],_0x21c835);})['then'](function(_0x3ace87){_0xd13b40=_0x3ace87;logger[_0xf197('0xe')](_0xf197('0x61'),_0xd13b40['id']);return getEndUser(_0x5450f1,_0x37b436[_0xf197('0x75')],_0x37b436[_0xf197('0x76')],_0x21c835);})[_0xf197('0x30')](function(_0x14724e){_0x191b8d=_0x14724e;logger[_0xf197('0xe')]('The\x20Enduser\x20ID\x20is:',_0x191b8d['id']);return getTicket(_0x5450f1,_0xd13b40,_0x191b8d,_0x21e343,_0x37b436,_0x21e343[_0xf197('0x64')],_0x21c835,_0xf197('0x77'));})['then'](function(_0x484973){_0x499b48=_0x484973;logger[_0xf197('0xe')](_0xf197('0x66'));logger[_0xf197('0xe')](_0xf197('0x67'),_0x499b48['id']);return setRelationship(_0x21c835,_0xd13b40,_0x499b48,_0xf197('0x68'));})['then'](function(){return setRelationship(_0x21c835,_0x191b8d,_0x499b48,_0xf197('0x69'));})[_0xf197('0x30')](function(){return getServerInfo(_0x21c835);})[_0xf197('0x30')](function(_0x7756f8){var _0x408bab=parseInt(_0x7756f8['version'][_0xf197('0x6b')](0x0));var _0x211e05=util[_0xf197('0x26')](_0xf197('0x6c'),_0x5450f1[_0xf197('0x58')],_0x499b48['id']);if(_0x408bab>0x6){_0x211e05=util[_0xf197('0x26')](_0xf197('0x78'),_0x5450f1[_0xf197('0x58')],_0x499b48['id']);}logger['info'](_0xf197('0x74'),_0xf197('0x6d'));emit(util[_0xf197('0x26')](_0xf197('0x6e'),_0x4d3a51[_0xf197('0x1f')]),_0xf197('0x6f'),{'uri':_0x211e05});})['catch'](function(_0x47c328){logger[_0xf197('0x79')]('[OUTBOUND]',JSON[_0xf197('0x2a')](_0x47c328));});};exports[_0xf197('0x7a')]=function(_0xc24247,_0x5a8a71,_0x5bac6a,_0x573cd9,_0x541cf1,_0x6d3064){var _0x1f722e,_0x4fc010,_0x48cc76,_0x43a6e1;_0x6d3064[_0xf197('0x58')]=intUtil[_0xf197('0x57')](_0x6d3064[_0xf197('0x58')]);_0x6d3064[_0xf197('0x59')]=intUtil[_0xf197('0x57')](_0x6d3064['serverUrl']);def['uri']=util['format'](_0xf197('0x5b'),_0x6d3064[_0xf197('0x58')]);if(_0x541cf1&&_0x541cf1[_0xf197('0x5c')]){logger[_0xf197('0xe')]('['+_0x5a8a71['lastevent'][_0xf197('0x7b')]()+']',_0xf197('0x7c'));_0x5a8a71[_0xf197('0x5e')]=util[_0xf197('0x26')](_0xf197('0x5f'),_0x6d3064[_0xf197('0x59')],_0x5a8a71[_0xf197('0x60')],md5(_0x5a8a71[_0xf197('0x60')]));}else{_0x5a8a71[_0xf197('0x5e')]='';}return getConnection(_0x6d3064)[_0xf197('0x30')](function(_0x2ae5bb){_0x43a6e1=_0x2ae5bb;if(!_[_0xf197('0x2b')](_0x573cd9)){return getUser(_0x6d3064,_0x573cd9['name'],_0x43a6e1);}else{return getUser(_0x6d3064,null,_0x43a6e1);}})['then'](function(_0x46322c){_0x1f722e=_0x46322c;logger[_0xf197('0xe')](_0xf197('0x61'),_0x1f722e['id']);return getEndUser(_0x6d3064,_0x5a8a71[_0xf197('0x7d')],_0x5a8a71[_0xf197('0x62')],_0x43a6e1);})['then'](function(_0x171998){_0x4fc010=_0x171998;logger[_0xf197('0xe')](_0xf197('0x63'),_0x4fc010['id']);return getTicket(_0x6d3064,_0x1f722e,_0x4fc010,_0x5bac6a,_0x5a8a71,_0x5bac6a['Fields'],_0x43a6e1,_0xf197('0x65'));})['then'](function(_0x30cac9){_0x48cc76=_0x30cac9;logger[_0xf197('0xe')](_0xf197('0x66'));logger[_0xf197('0xe')]('The\x20Ticket\x20ID\x20is:',_0x48cc76['id']);return setRelationship(_0x43a6e1,_0x1f722e,_0x48cc76,_0xf197('0x68'));})[_0xf197('0x30')](function(){return setRelationship(_0x43a6e1,_0x4fc010,_0x48cc76,'contacts');})[_0xf197('0x30')](function(){return getServerInfo(_0x43a6e1);})[_0xf197('0x70')](function(_0x5600de){logger[_0xf197('0x79')]('['+_0x5a8a71[_0xf197('0x7e')][_0xf197('0x7b')]()+']',JSON[_0xf197('0x2a')](_0x5600de));});}; \ 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 bbed0e3..8c899e9 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 _0x815a=['toLowerCase','keyValue','keyType','key','format','%s:\x20%s','customVariable','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','util','sortBy','length','type','string','variable','variableName','push','toString','Variable','name'];(function(_0x4e7ab1,_0x439952){var _0xcd4285=function(_0x1ccae3){while(--_0x1ccae3){_0x4e7ab1['push'](_0x4e7ab1['shift']());}};_0xcd4285(++_0x439952);}(_0x815a,0x1d0));var _0xa815=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x815a[_0x31e29a];return _0x32d892;};'use strict';var _=require('lodash');var util=require(_0xa815('0x0'));exports['getString']=function(_0x6ad0e1,_0x3bdd45,_0x2afa42){var _0x1ae70c=[];if(_0x6ad0e1['length']>0x0){var _0x3ff9cb=_[_0xa815('0x1')](_0x6ad0e1,['id']);for(var _0x58ff5e=0x0;_0x58ff5e<_0x3ff9cb[_0xa815('0x2')];_0x58ff5e++){var _0x4fe6d9=_0x3ff9cb[_0x58ff5e];if(_0x4fe6d9[_0xa815('0x3')]===_0xa815('0x4')){_0x1ae70c['push'](_0x4fe6d9['content']);}else if(_0x4fe6d9[_0xa815('0x3')]===_0xa815('0x5')&&_0x4fe6d9[_0xa815('0x6')]){_0x3bdd45[_0x4fe6d9[_0xa815('0x6')]]&&_0x1ae70c[_0xa815('0x7')](_0x3bdd45[_0x4fe6d9[_0xa815('0x6')]][_0xa815('0x8')]());}else if(_0x4fe6d9['type']==='customVariable'&&_0x4fe6d9[_0xa815('0x9')]&&_0x4fe6d9[_0xa815('0x9')][_0xa815('0xa')]){_0x3bdd45[_0x4fe6d9[_0xa815('0x9')]['name'][_0xa815('0xb')]()]&&_0x1ae70c[_0xa815('0x7')](_0x3bdd45[_0x4fe6d9[_0xa815('0x9')][_0xa815('0xa')][_0xa815('0xb')]()][_0xa815('0x8')]());}else if(_0x4fe6d9['type']===_0xa815('0xc')){if(_0x4fe6d9[_0xa815('0xd')]==='string'&&_0x4fe6d9[_0xa815('0xe')]){_0x1ae70c[_0xa815('0x7')](util[_0xa815('0xf')]('%s:\x20%s',_0x4fe6d9[_0xa815('0xe')],_0x4fe6d9['keyContent']));}else if(_0x4fe6d9['keyType']===_0xa815('0x5')&&_0x4fe6d9[_0xa815('0x6')]&&_0x4fe6d9[_0xa815('0xe')]){_0x3bdd45[_0x4fe6d9['variableName']]&&_0x1ae70c[_0xa815('0x7')](util[_0xa815('0xf')](_0xa815('0x10'),_0x4fe6d9['key'],_0x3bdd45[_0x4fe6d9['variableName']]));}else if(_0x4fe6d9[_0xa815('0xd')]===_0xa815('0x11')&&_0x4fe6d9[_0xa815('0x9')]&&_0x4fe6d9[_0xa815('0x9')]['name']&&_0x4fe6d9[_0xa815('0xe')]){_0x3bdd45[_0x4fe6d9['Variable'][_0xa815('0xa')][_0xa815('0xb')]()]&&_0x1ae70c[_0xa815('0x7')](util[_0xa815('0xf')](_0xa815('0x10'),_0x4fe6d9[_0xa815('0xe')],_0x3bdd45[_0x4fe6d9[_0xa815('0x9')][_0xa815('0xa')][_0xa815('0xb')]()]));}}}}return _0x1ae70c[_0xa815('0x12')](_0x2afa42);};exports[_0xa815('0x13')]=function(_0x59fe0a){var _0x18b025=_0x59fe0a[_0xa815('0x14')](-0x1);if(_0x18b025==='/'){_0x59fe0a=_0x59fe0a[_0xa815('0x15')](0x0,_0x59fe0a[_0xa815('0x16')](_0x18b025));}return _0x59fe0a;};exports[_0xa815('0x17')]=function(_0x33a93c){if(!_[_0xa815('0x18')](_0x33a93c)&&_0x33a93c!==''){var _0x366b45=/^(([^<>()\[\]\\.,;:\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 _0x366b45['test'](String(_0x33a93c)[_0xa815('0xb')]());}else{return![];}}; \ No newline at end of file +var _0x02a3=['type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','%s:\x20%s','keyContent','format','join','slice','substring','lastIndexOf','validateEmail','isNil','lodash','getString','sortBy'];(function(_0x443417,_0x4450aa){var _0x28d629=function(_0x3ef893){while(--_0x3ef893){_0x443417['push'](_0x443417['shift']());}};_0x28d629(++_0x4450aa);}(_0x02a3,0x19d));var _0x302a=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0x02a3[_0x9c2427];return _0x51984f;};'use strict';var _=require(_0x302a('0x0'));var util=require('util');exports[_0x302a('0x1')]=function(_0x4b22f0,_0x5b5def,_0x40d752){var _0x4c4b04=[];if(_0x4b22f0['length']>0x0){var _0x272db5=_[_0x302a('0x2')](_0x4b22f0,['id']);for(var _0x950a6c=0x0;_0x950a6c<_0x272db5['length'];_0x950a6c++){var _0x4b2de4=_0x272db5[_0x950a6c];if(_0x4b2de4[_0x302a('0x3')]===_0x302a('0x4')){_0x4c4b04[_0x302a('0x5')](_0x4b2de4[_0x302a('0x6')]);}else if(_0x4b2de4[_0x302a('0x3')]===_0x302a('0x7')&&_0x4b2de4[_0x302a('0x8')]){_0x5b5def[_0x4b2de4[_0x302a('0x8')]]&&_0x4c4b04[_0x302a('0x5')](_0x5b5def[_0x4b2de4[_0x302a('0x8')]][_0x302a('0x9')]());}else if(_0x4b2de4[_0x302a('0x3')]===_0x302a('0xa')&&_0x4b2de4[_0x302a('0xb')]&&_0x4b2de4[_0x302a('0xb')][_0x302a('0xc')]){_0x5b5def[_0x4b2de4['Variable']['name'][_0x302a('0xd')]()]&&_0x4c4b04[_0x302a('0x5')](_0x5b5def[_0x4b2de4[_0x302a('0xb')][_0x302a('0xc')][_0x302a('0xd')]()][_0x302a('0x9')]());}else if(_0x4b2de4[_0x302a('0x3')]===_0x302a('0xe')){if(_0x4b2de4[_0x302a('0xf')]==='string'&&_0x4b2de4[_0x302a('0x10')]){_0x4c4b04['push'](util['format'](_0x302a('0x11'),_0x4b2de4[_0x302a('0x10')],_0x4b2de4[_0x302a('0x12')]));}else if(_0x4b2de4[_0x302a('0xf')]===_0x302a('0x7')&&_0x4b2de4[_0x302a('0x8')]&&_0x4b2de4[_0x302a('0x10')]){_0x5b5def[_0x4b2de4[_0x302a('0x8')]]&&_0x4c4b04[_0x302a('0x5')](util['format']('%s:\x20%s',_0x4b2de4[_0x302a('0x10')],_0x5b5def[_0x4b2de4['variableName']]));}else if(_0x4b2de4[_0x302a('0xf')]===_0x302a('0xa')&&_0x4b2de4['Variable']&&_0x4b2de4[_0x302a('0xb')]['name']&&_0x4b2de4[_0x302a('0x10')]){_0x5b5def[_0x4b2de4['Variable'][_0x302a('0xc')][_0x302a('0xd')]()]&&_0x4c4b04[_0x302a('0x5')](util[_0x302a('0x13')](_0x302a('0x11'),_0x4b2de4['key'],_0x5b5def[_0x4b2de4[_0x302a('0xb')][_0x302a('0xc')][_0x302a('0xd')]()]));}}}}return _0x4c4b04[_0x302a('0x14')](_0x40d752);};exports['stripTrailingSlash']=function(_0x1fcf47){var _0x25dd6b=_0x1fcf47[_0x302a('0x15')](-0x1);if(_0x25dd6b==='/'){_0x1fcf47=_0x1fcf47[_0x302a('0x16')](0x0,_0x1fcf47[_0x302a('0x17')](_0x25dd6b));}return _0x1fcf47;};exports[_0x302a('0x18')]=function(_0x30af4f){if(!_[_0x302a('0x19')](_0x30af4f)&&_0x30af4f!==''){var _0x754218=/^(([^<>()\[\]\\.,;:\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 _0x754218['test'](String(_0x30af4f)[_0x302a('0xd')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 962e474..1c0b22b 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0xdba100,_0x2ed257){var _0x86a0ad=function(_0x1e3307){while(--_0x1e3307){_0xdba100['push'](_0xdba100['shift']());}};_0x86a0ad(++_0x2ed257);}(_0x9c44,0x178));var _0x49c4=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x9c44[_0x2dea24];return _0x309d58;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index e430759..b012147 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 _0xf322=['Recording\x20is\x20enabled!','recordingURL','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','Subjects','getString','Descriptions','Fields','then','Ticket\x20created!','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!','%s/users/me.json','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','filter','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','authType','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','toString','base64','[HTTP]','stringify','includes','picklist','type','nameField','customField','content','string','idField','custom_fields','push','variableName','customVariable','Variable','toLowerCase','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]'];(function(_0x436278,_0x101c83){var _0x2d93cb=function(_0x2d6153){while(--_0x2d6153){_0x436278['push'](_0x436278['shift']());}};_0x2d93cb(++_0x101c83);}(_0xf322,0x10d));var _0x2f32=function(_0x1951f1,_0x699e4){_0x1951f1=_0x1951f1-0x0;var _0x252aef=_0xf322[_0x1951f1];return _0x252aef;};'use strict';var _=require(_0x2f32('0x0'));var rp=require('request-promise');var md5=require(_0x2f32('0x1'));var util=require(_0x2f32('0x2'));var Redis=require(_0x2f32('0x3'));var intUtil=require(_0x2f32('0x4'));var config=require(_0x2f32('0x5'));var logger=require(_0x2f32('0x6'))(_0x2f32('0x7'));config[_0x2f32('0x8')]=_[_0x2f32('0x9')](config[_0x2f32('0x8')],{'host':_0x2f32('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2f32('0x8')]));function emit(_0x55ec75,_0x5a0117,_0x2f173d){io['to'](_0x55ec75)['emit'](_0x5a0117,_0x2f173d);}var headers={'Content-Type':_0x2f32('0xb'),'Accept':'application/json'};function getTicket(_0x487393,_0x55dbda,_0x4c2d57,_0x8dcd12,_0x432216){logger[_0x2f32('0xc')](_0x2f32('0xd'));return request({'uri':util[_0x2f32('0xe')](_0x2f32('0xf'),_0x487393[_0x2f32('0x10')]),'method':_0x2f32('0x11'),'body':{'ticket':_[_0x2f32('0x12')]({'requester_id':_0x4c2d57['id'],'submitter_id':_0x55dbda?_0x55dbda['id']:undefined,'assignee_id':_0x55dbda?_0x55dbda['id']:undefined,'tags':getTags(_0x8dcd12[_0x2f32('0x13')],_0x2f32('0x14')),'subject':intUtil['getString'](_0x8dcd12[_0x2f32('0x15')],_0x432216,'\x20'),'description':intUtil[_0x2f32('0x16')](_0x8dcd12[_0x2f32('0x17')],_0x432216,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x8dcd12[_0x2f32('0x17')],_0x432216,'\x0a')}},getCustomFields(_0x8dcd12[_0x2f32('0x18')],_0x432216))}})[_0x2f32('0x19')](function(_0x1889be){logger['info'](_0x2f32('0x1a'));return _0x1889be[_0x2f32('0x1b')];});}function getUser(_0x48906a,_0x27591a){if(intUtil[_0x2f32('0x1c')](_0x27591a)){logger[_0x2f32('0xc')](_0x2f32('0x1d'),_0x27591a);return request({'uri':util[_0x2f32('0xe')]('%s/search.json',_0x48906a[_0x2f32('0x10')]),'qs':{'query':util['format'](_0x2f32('0x1e'),_0x27591a)}})[_0x2f32('0x19')](function(_0x211732){if(_0x211732[_0x2f32('0x1f')]){logger[_0x2f32('0xc')](_0x2f32('0x20'));return _[_0x2f32('0x21')](_0x211732[_0x2f32('0x22')],{'email':_0x27591a,'role':_0x2f32('0x23')});}else{logger[_0x2f32('0xc')](_0x2f32('0x24'));return request({'uri':util['format'](_0x2f32('0x25'),_0x48906a[_0x2f32('0x10')])})[_0x2f32('0x19')](function(_0x49fd6f){logger['info']('Admin\x20account\x20selected.');return _0x49fd6f[_0x2f32('0x26')];});}});}else{logger[_0x2f32('0xc')](_0x2f32('0x24'));return request({'uri':util[_0x2f32('0xe')](_0x2f32('0x25'),_0x48906a['remoteUri'])})[_0x2f32('0x19')](function(_0x2e43e0){logger['info'](_0x2f32('0x27'));return _0x2e43e0[_0x2f32('0x26')];});}}function getEndUser(_0x590485,_0x2cf829,_0x1e507d){logger[_0x2f32('0xc')](_0x2f32('0x28'),_0x1e507d);return request({'uri':util[_0x2f32('0xe')]('%s/search.json',_0x590485[_0x2f32('0x10')]),'qs':{'query':util[_0x2f32('0xe')]('type:user\x20role:end-user\x20phone:%s',_0x1e507d)}})['then'](function(_0x3086b7){var _0x496942;if(_0x3086b7[_0x2f32('0x22')]['length']){_0x3086b7[_0x2f32('0x22')]=_[_0x2f32('0x29')](_0x3086b7[_0x2f32('0x22')],{'suspended':![],'role':_0x2f32('0x2a')});if(_0x3086b7[_0x2f32('0x22')][_0x2f32('0x2b')]){_0x496942=_[_0x2f32('0x2c')](_0x3086b7[_0x2f32('0x22')]);}}if(_0x496942){logger['info'](_0x2f32('0x2d'));return _0x496942;}else{logger['info'](_0x2f32('0x2e'));return request({'uri':util[_0x2f32('0xe')](_0x2f32('0x2f'),_0x590485[_0x2f32('0x10')]),'method':_0x2f32('0x11'),'body':{'user':{'role':_0x2f32('0x2a'),'name':util[_0x2f32('0xe')](_0x2f32('0x30'),_0x2cf829||_0x1e507d),'phone':_0x1e507d}}})[_0x2f32('0x19')](function(_0x3846f2){logger['info']('Enduser\x20created.');return _0x3846f2[_0x2f32('0x26')];});}});}function getAuth(_0x2b2ee6){var _0x4ae1aa;if(_0x2b2ee6[_0x2f32('0x31')]==='password'){_0x4ae1aa=util[_0x2f32('0xe')](_0x2f32('0x32'),_0x2b2ee6[_0x2f32('0x33')],_0x2b2ee6[_0x2f32('0x34')]);}else if(_0x2b2ee6['authType']===_0x2f32('0x35')){_0x4ae1aa=util[_0x2f32('0xe')](_0x2f32('0x36'),_0x2b2ee6['username'],_0x2b2ee6[_0x2f32('0x35')]);}return util[_0x2f32('0xe')](_0x2f32('0x37'),new Buffer(_0x4ae1aa)[_0x2f32('0x38')](_0x2f32('0x39')));}function request(_0x5d9072){logger['debug'](_0x2f32('0x3a'),JSON[_0x2f32('0x3b')](_0x5d9072));return rp(_[_0x2f32('0x9')](_0x5d9072,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x22aed7,_0x2aed40){var _0x237434=[];if(_0x22aed7&&_0x22aed7[_0x2f32('0x2b')]>0x0){_0x237434=_['map'](_0x22aed7,_0x2aed40);}return _0x237434;}function getCustomFields(_0x5e56ef,_0x49eb0e){var _0x3bfa79=[];var _0x3fafa3={'custom_fields':[]};if(_0x5e56ef[_0x2f32('0x2b')]>0x0){_['forEach'](_0x5e56ef,function(_0x1283db){if(_[_0x2f32('0x3c')](['string',_0x2f32('0x3d')],_0x1283db[_0x2f32('0x3e')])&&_0x1283db[_0x2f32('0x3f')]&&!_0x1283db[_0x2f32('0x40')]){_0x3fafa3[_0x1283db[_0x2f32('0x3f')]['toLowerCase']()]=_0x1283db[_0x2f32('0x41')][_0x2f32('0x38')]();}else if(_[_0x2f32('0x3c')]([_0x2f32('0x42'),'picklist'],_0x1283db[_0x2f32('0x3e')])&&_0x1283db[_0x2f32('0x43')]&&_0x1283db['customField']){_0x3fafa3[_0x2f32('0x44')][_0x2f32('0x45')]({'id':_0x1283db[_0x2f32('0x43')],'value':_0x1283db[_0x2f32('0x41')][_0x2f32('0x38')]()});}else if(_0x1283db['type']==='variable'&&_0x1283db[_0x2f32('0x46')]&&_0x1283db[_0x2f32('0x43')]&&_0x1283db['customField']){_0x49eb0e[_0x1283db[_0x2f32('0x46')]]&&_0x3fafa3[_0x2f32('0x44')]['push']({'id':_0x1283db[_0x2f32('0x43')],'value':_0x49eb0e[_0x1283db[_0x2f32('0x46')]][_0x2f32('0x38')]()});}else if(_0x1283db['type']===_0x2f32('0x47')&&_0x1283db[_0x2f32('0x48')]&&_0x1283db[_0x2f32('0x48')]['name']&&_0x1283db[_0x2f32('0x43')]&&_0x1283db['customField']){_0x49eb0e[_0x1283db[_0x2f32('0x48')]['name'][_0x2f32('0x49')]()]&&_0x3fafa3[_0x2f32('0x44')]['push']({'id':_0x1283db[_0x2f32('0x43')],'value':_0x49eb0e[_0x1283db[_0x2f32('0x48')]['name'][_0x2f32('0x49')]()][_0x2f32('0x38')]()});}});}return _0x3fafa3;}exports[_0x2f32('0x4a')]=function(_0x5420d3,_0x3c083b,_0x1ca451,_0x2d5f06,_0x4d8c96,_0x465811){var _0x389d18,_0x5c976c;_0x465811[_0x2f32('0x10')]=intUtil['stripTrailingSlash'](_0x465811['remoteUri']);_0x465811[_0x2f32('0x4b')]=intUtil[_0x2f32('0x4c')](_0x465811[_0x2f32('0x4b')]);if(_0x4d8c96&&_0x4d8c96[_0x2f32('0x4d')]){logger['info'](_0x2f32('0x4e'),_0x2f32('0x4f'));_0x3c083b[_0x2f32('0x50')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x465811[_0x2f32('0x4b')],_0x3c083b[_0x2f32('0x51')],md5(_0x3c083b['uniqueid']));}else{_0x3c083b['recordingURL']='';}headers['Authorization']=getAuth(_0x465811);return getUser(_0x465811,_0x2d5f06[_0x2f32('0x52')])['then'](function(_0x4910d7){_0x389d18=_0x4910d7;logger[_0x2f32('0xc')](_0x2f32('0x53'),_0x389d18['id']);return getEndUser(_0x465811,_0x3c083b[_0x2f32('0x54')],_0x3c083b[_0x2f32('0x55')]);})[_0x2f32('0x19')](function(_0x582af9){_0x5c976c=_0x582af9;logger[_0x2f32('0xc')](_0x2f32('0x56'),_0x5c976c['id']);return getTicket(_0x465811,_0x389d18,_0x5c976c,_0x1ca451,_0x3c083b);})['then'](function(_0x6950ce){if(_0x6950ce){logger['info']('The\x20Ticket\x20ID\x20is:',_0x6950ce['id']);switch(_0x465811[_0x2f32('0x3e')]){case _0x2f32('0x57'):logger[_0x2f32('0xc')](_0x2f32('0x4e'),_0x2f32('0x58'));return request({'uri':util[_0x2f32('0xe')](_0x2f32('0x59'),_0x465811[_0x2f32('0x10')],_0x389d18['id'],_0x6950ce['id']),'method':'POST'});case _0x2f32('0x5a'):logger[_0x2f32('0xc')](_0x2f32('0x4e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x2f32('0xe')]('user:%s',_0x2d5f06[_0x2f32('0x14')]),_0x2f32('0x5b'),{'uri':util['format'](_0x2f32('0x5c'),_0x465811[_0x2f32('0x10')][_0x2f32('0x5d')](_0x2f32('0x5e'),''),_0x6950ce['id'])});break;default:logger['error'](_0x2f32('0x4e'),_0x2f32('0x5f'));}}})[_0x2f32('0x60')](function(_0x53ab2d){logger[_0x2f32('0x61')](_0x2f32('0x62'),util['inspect'](_0x53ab2d,{'showHidden':!![],'depth':null}));});};exports[_0x2f32('0x63')]=function(_0x128988,_0x2dbc07,_0x17daf4,_0x51916f,_0x245559,_0x364b78,_0x4b06b9){var _0x91265a,_0x3ee303;_0x364b78[_0x2f32('0x10')]=intUtil[_0x2f32('0x4c')](_0x364b78[_0x2f32('0x10')]);_0x364b78[_0x2f32('0x4b')]=intUtil['stripTrailingSlash'](_0x364b78['serverUrl']);if(_0x4b06b9&&_0x4b06b9[_0x2f32('0x64')]&&_0x4b06b9[_0x2f32('0x64')]!==_0x2f32('0x65')){logger[_0x2f32('0xc')]('[OUTBOUND]',_0x2f32('0x4f'));_0x2dbc07['recordingURL']=util[_0x2f32('0xe')](_0x2f32('0x66'),_0x364b78['serverUrl'],_0x2dbc07[_0x2f32('0x51')],md5(_0x2dbc07[_0x2f32('0x51')]));}headers[_0x2f32('0x67')]=getAuth(_0x364b78);return getUser(_0x364b78,_0x51916f['email'])[_0x2f32('0x19')](function(_0x5bed1e){_0x91265a=_0x5bed1e;logger[_0x2f32('0xc')]('The\x20User\x20ID\x20is:',_0x91265a['id']);return getEndUser(_0x364b78,_0x2dbc07[_0x2f32('0x68')],_0x2dbc07[_0x2f32('0x69')]);})[_0x2f32('0x19')](function(_0x290b3c){_0x3ee303=_0x290b3c;logger['info'](_0x2f32('0x56'),_0x3ee303['id']);return getTicket(_0x364b78,_0x91265a,_0x3ee303,_0x17daf4,_0x2dbc07);})[_0x2f32('0x19')](function(_0x4f5339){if(_0x4f5339){logger[_0x2f32('0xc')](_0x2f32('0x6a'),_0x4f5339['id']);switch(_0x364b78[_0x2f32('0x3e')]){case'integrationTab':logger['info'](_0x2f32('0x6b'),_0x2f32('0x58'));return request({'uri':util[_0x2f32('0xe')](_0x2f32('0x59'),_0x364b78['remoteUri'],_0x91265a['id'],_0x4f5339['id']),'method':_0x2f32('0x11')});case _0x2f32('0x5a'):logger['info']('[OUTBOUND]',_0x2f32('0x6c'));emit(util['format'](_0x2f32('0x6d'),_0x51916f[_0x2f32('0x14')]),_0x2f32('0x5b'),{'uri':util[_0x2f32('0xe')]('%s/agent/tickets/%s',_0x364b78[_0x2f32('0x10')]['replace']('/api/v2',''),_0x4f5339['id'])});break;default:logger[_0x2f32('0x61')]('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x2f32('0x60')](function(_0x12f7b2){logger[_0x2f32('0x61')](_0x2f32('0x6e'),util[_0x2f32('0x6f')](_0x12f7b2,{'showHidden':!![],'depth':null}));});};exports[_0x2f32('0x70')]=function(_0x2de672,_0x4d909a,_0x2ee997,_0x5710c2,_0x17d163,_0x53b1ae){var _0x5e2284,_0xfd0a62;_0x53b1ae[_0x2f32('0x10')]=intUtil[_0x2f32('0x4c')](_0x53b1ae['remoteUri']);_0x53b1ae[_0x2f32('0x4b')]=intUtil[_0x2f32('0x4c')](_0x53b1ae[_0x2f32('0x4b')]);if(_0x17d163&&_0x17d163['monitor_format']){logger[_0x2f32('0xc')]('['+_0x4d909a[_0x2f32('0x71')][_0x2f32('0x72')]()+']',_0x2f32('0x4f'));_0x4d909a[_0x2f32('0x50')]=util[_0x2f32('0xe')](_0x2f32('0x66'),_0x53b1ae[_0x2f32('0x4b')],_0x4d909a[_0x2f32('0x51')],md5(_0x4d909a[_0x2f32('0x51')]));}else{_0x4d909a[_0x2f32('0x50')]='';}headers['Authorization']=getAuth(_0x53b1ae);return getUser(_0x53b1ae)[_0x2f32('0x19')](function(_0x1ab55e){_0x5e2284=_0x1ab55e;logger[_0x2f32('0xc')](_0x2f32('0x53'),_0x5e2284['id']);return getEndUser(_0x53b1ae,_0x4d909a[_0x2f32('0x54')],_0x4d909a[_0x2f32('0x55')]);})['then'](function(_0x29371a){_0xfd0a62=_0x29371a;logger['info'](_0x2f32('0x56'),_0xfd0a62['id']);return getTicket(_0x53b1ae,_0x5e2284,_0xfd0a62,_0x2ee997,_0x4d909a);})[_0x2f32('0x19')](function(_0x31c1c3){if(_0x31c1c3){logger[_0x2f32('0xc')]('The\x20Ticket\x20ID\x20is:',_0x31c1c3['id']);}})[_0x2f32('0x60')](function(_0x2f15e0){logger['error']('['+_0x4d909a[_0x2f32('0x71')][_0x2f32('0x72')]()+']'+_0x2f32('0x73'),util[_0x2f32('0x6f')](_0x2f15e0,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1307=['authType','token','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','type','nameField','customField','toLowerCase','content','string','picklist','idField','custom_fields','push','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','outbound','recordingFormat','none','destcalleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','%s/channels/voice/agents/%d/tickets/%d/display.json','/api/v2','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/logger','zendesk','defaults','localhost','emit','application/json','Creating\x20new\x20ticket...','%s/tickets.json','POST','merge','Tags','getString','Subjects','Descriptions','Fields','then','info','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','type:user\x20role:end-user\x20phone:%s','length','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','%s:%s','password'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x1307,0x123));var _0x7130=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x1307[_0x1b7368];return _0x25d54c;};'use strict';var _=require(_0x7130('0x0'));var rp=require(_0x7130('0x1'));var md5=require(_0x7130('0x2'));var util=require(_0x7130('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7130('0x4'));var config=require('../../../../config/environment');var logger=require(_0x7130('0x5'))(_0x7130('0x6'));config['redis']=_[_0x7130('0x7')](config['redis'],{'host':_0x7130('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x4e33e4,_0x151803,_0x5ccd79){io['to'](_0x4e33e4)[_0x7130('0x9')](_0x151803,_0x5ccd79);}var headers={'Content-Type':_0x7130('0xa'),'Accept':_0x7130('0xa')};function getTicket(_0x97cded,_0x5cf700,_0x18b0d8,_0x5da360,_0xca37f9){logger['info'](_0x7130('0xb'));return request({'uri':util['format'](_0x7130('0xc'),_0x97cded['remoteUri']),'method':_0x7130('0xd'),'body':{'ticket':_[_0x7130('0xe')]({'requester_id':_0x18b0d8['id'],'submitter_id':_0x5cf700?_0x5cf700['id']:undefined,'assignee_id':_0x5cf700?_0x5cf700['id']:undefined,'tags':getTags(_0x5da360[_0x7130('0xf')],'name'),'subject':intUtil[_0x7130('0x10')](_0x5da360[_0x7130('0x11')],_0xca37f9,'\x20'),'description':intUtil[_0x7130('0x10')](_0x5da360[_0x7130('0x12')],_0xca37f9,'\x0a'),'comment':{'public':![],'body':intUtil[_0x7130('0x10')](_0x5da360[_0x7130('0x12')],_0xca37f9,'\x0a')}},getCustomFields(_0x5da360[_0x7130('0x13')],_0xca37f9))}})[_0x7130('0x14')](function(_0x5ef087){logger[_0x7130('0x15')]('Ticket\x20created!');return _0x5ef087[_0x7130('0x16')];});}function getUser(_0x23b77e,_0x48ecf){if(intUtil[_0x7130('0x17')](_0x48ecf)){logger[_0x7130('0x15')](_0x7130('0x18'),_0x48ecf);return request({'uri':util[_0x7130('0x19')](_0x7130('0x1a'),_0x23b77e[_0x7130('0x1b')]),'qs':{'query':util[_0x7130('0x19')](_0x7130('0x1c'),_0x48ecf)}})['then'](function(_0x20c737){if(_0x20c737[_0x7130('0x1d')]){logger['info'](_0x7130('0x1e'));return _[_0x7130('0x1f')](_0x20c737[_0x7130('0x20')],{'email':_0x48ecf,'role':_0x7130('0x21')});}else{logger[_0x7130('0x15')](_0x7130('0x22'));return request({'uri':util[_0x7130('0x19')](_0x7130('0x23'),_0x23b77e[_0x7130('0x1b')])})[_0x7130('0x14')](function(_0x583d4f){logger[_0x7130('0x15')](_0x7130('0x24'));return _0x583d4f[_0x7130('0x25')];});}});}else{logger[_0x7130('0x15')](_0x7130('0x22'));return request({'uri':util[_0x7130('0x19')](_0x7130('0x23'),_0x23b77e['remoteUri'])})[_0x7130('0x14')](function(_0x1e4acf){logger[_0x7130('0x15')]('Admin\x20account\x20selected.');return _0x1e4acf['user'];});}}function getEndUser(_0x2ba018,_0x2e99c5,_0x2937e7){logger[_0x7130('0x15')]('Searching\x20enduser\x20with\x20phone',_0x2937e7);return request({'uri':util[_0x7130('0x19')](_0x7130('0x1a'),_0x2ba018[_0x7130('0x1b')]),'qs':{'query':util[_0x7130('0x19')](_0x7130('0x26'),_0x2937e7)}})[_0x7130('0x14')](function(_0x136535){var _0x3498a9;if(_0x136535[_0x7130('0x20')][_0x7130('0x27')]){_0x136535[_0x7130('0x20')]=_['filter'](_0x136535[_0x7130('0x20')],{'suspended':![],'role':_0x7130('0x28')});if(_0x136535[_0x7130('0x20')][_0x7130('0x27')]){_0x3498a9=_[_0x7130('0x29')](_0x136535['results']);}}if(_0x3498a9){logger[_0x7130('0x15')](_0x7130('0x2a'));return _0x3498a9;}else{logger['info'](_0x7130('0x2b'));return request({'uri':util['format'](_0x7130('0x2c'),_0x2ba018[_0x7130('0x1b')]),'method':_0x7130('0xd'),'body':{'user':{'role':_0x7130('0x28'),'name':util[_0x7130('0x19')](_0x7130('0x2d'),_0x2e99c5||_0x2937e7),'phone':_0x2937e7}}})[_0x7130('0x14')](function(_0x43afe6){logger[_0x7130('0x15')]('Enduser\x20created.');return _0x43afe6[_0x7130('0x25')];});}});}function getAuth(_0x98d388){var _0x281f63;if(_0x98d388['authType']==='password'){_0x281f63=util[_0x7130('0x19')](_0x7130('0x2e'),_0x98d388['username'],_0x98d388[_0x7130('0x2f')]);}else if(_0x98d388[_0x7130('0x30')]==='token'){_0x281f63=util[_0x7130('0x19')]('%s/token:%s',_0x98d388['username'],_0x98d388[_0x7130('0x31')]);}return util[_0x7130('0x19')](_0x7130('0x32'),new Buffer(_0x281f63)[_0x7130('0x33')](_0x7130('0x34')));}function request(_0x221154){logger[_0x7130('0x35')](_0x7130('0x36'),JSON[_0x7130('0x37')](_0x221154));return rp(_[_0x7130('0x7')](_0x221154,{'method':_0x7130('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x118dab,_0x58ba3c){var _0x3d8067=[];if(_0x118dab&&_0x118dab['length']>0x0){_0x3d8067=_[_0x7130('0x39')](_0x118dab,_0x58ba3c);}return _0x3d8067;}function getCustomFields(_0x4f32a4,_0x5bf0db){var _0x2def34=[];var _0x3a1697={'custom_fields':[]};if(_0x4f32a4[_0x7130('0x27')]>0x0){_[_0x7130('0x3a')](_0x4f32a4,function(_0x169cf9){if(_[_0x7130('0x3b')](['string','picklist'],_0x169cf9[_0x7130('0x3c')])&&_0x169cf9[_0x7130('0x3d')]&&!_0x169cf9[_0x7130('0x3e')]){_0x3a1697[_0x169cf9['nameField'][_0x7130('0x3f')]()]=_0x169cf9[_0x7130('0x40')]['toString']();}else if(_[_0x7130('0x3b')]([_0x7130('0x41'),_0x7130('0x42')],_0x169cf9[_0x7130('0x3c')])&&_0x169cf9[_0x7130('0x43')]&&_0x169cf9[_0x7130('0x3e')]){_0x3a1697[_0x7130('0x44')][_0x7130('0x45')]({'id':_0x169cf9[_0x7130('0x43')],'value':_0x169cf9[_0x7130('0x40')][_0x7130('0x33')]()});}else if(_0x169cf9['type']==='variable'&&_0x169cf9[_0x7130('0x46')]&&_0x169cf9[_0x7130('0x43')]&&_0x169cf9[_0x7130('0x3e')]){_0x5bf0db[_0x169cf9[_0x7130('0x46')]]&&_0x3a1697[_0x7130('0x44')]['push']({'id':_0x169cf9['idField'],'value':_0x5bf0db[_0x169cf9[_0x7130('0x46')]]['toString']()});}else if(_0x169cf9[_0x7130('0x3c')]===_0x7130('0x47')&&_0x169cf9[_0x7130('0x48')]&&_0x169cf9[_0x7130('0x48')][_0x7130('0x49')]&&_0x169cf9['idField']&&_0x169cf9[_0x7130('0x3e')]){_0x5bf0db[_0x169cf9['Variable'][_0x7130('0x49')]['toLowerCase']()]&&_0x3a1697['custom_fields']['push']({'id':_0x169cf9[_0x7130('0x43')],'value':_0x5bf0db[_0x169cf9[_0x7130('0x48')][_0x7130('0x49')]['toLowerCase']()]['toString']()});}});}return _0x3a1697;}exports[_0x7130('0x4a')]=function(_0x431f37,_0x373838,_0x118462,_0xe2e261,_0x201c4e,_0x875096){var _0x77fd9a,_0x391bab;_0x875096[_0x7130('0x1b')]=intUtil[_0x7130('0x4b')](_0x875096[_0x7130('0x1b')]);_0x875096[_0x7130('0x4c')]=intUtil['stripTrailingSlash'](_0x875096[_0x7130('0x4c')]);if(_0x201c4e&&_0x201c4e[_0x7130('0x4d')]){logger[_0x7130('0x15')](_0x7130('0x4e'),_0x7130('0x4f'));_0x373838[_0x7130('0x50')]=util[_0x7130('0x19')](_0x7130('0x51'),_0x875096[_0x7130('0x4c')],_0x373838[_0x7130('0x52')],md5(_0x373838[_0x7130('0x52')]));}else{_0x373838['recordingURL']='';}headers[_0x7130('0x53')]=getAuth(_0x875096);return getUser(_0x875096,_0xe2e261[_0x7130('0x54')])[_0x7130('0x14')](function(_0x2f0ac0){_0x77fd9a=_0x2f0ac0;logger[_0x7130('0x15')](_0x7130('0x55'),_0x77fd9a['id']);return getEndUser(_0x875096,_0x373838[_0x7130('0x56')],_0x373838[_0x7130('0x57')]);})[_0x7130('0x14')](function(_0x1c4357){_0x391bab=_0x1c4357;logger[_0x7130('0x15')]('The\x20Enduser\x20ID\x20is:',_0x391bab['id']);return getTicket(_0x875096,_0x77fd9a,_0x391bab,_0x118462,_0x373838);})[_0x7130('0x14')](function(_0x56061a){if(_0x56061a){logger[_0x7130('0x15')]('The\x20Ticket\x20ID\x20is:',_0x56061a['id']);switch(_0x875096['type']){case _0x7130('0x58'):logger['info']('[QUEUE]',_0x7130('0x59'));return request({'uri':util[_0x7130('0x19')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x875096[_0x7130('0x1b')],_0x77fd9a['id'],_0x56061a['id']),'method':_0x7130('0xd')});case _0x7130('0x5a'):logger['info'](_0x7130('0x4e'),_0x7130('0x5b'));emit(util[_0x7130('0x19')](_0x7130('0x5c'),_0xe2e261[_0x7130('0x49')]),_0x7130('0x5d'),{'uri':util['format'](_0x7130('0x5e'),_0x875096[_0x7130('0x1b')][_0x7130('0x5f')]('/api/v2',''),_0x56061a['id'])});break;default:logger[_0x7130('0x60')](_0x7130('0x4e'),_0x7130('0x61'));}}})[_0x7130('0x62')](function(_0x13765e){logger[_0x7130('0x60')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x7130('0x63')](_0x13765e,{'showHidden':!![],'depth':null}));});};exports[_0x7130('0x64')]=function(_0x559739,_0x3dfcc9,_0x9426ed,_0x55dff1,_0x18cb1b,_0x42d497,_0x2d93af){var _0x28b021,_0x5f4a93;_0x42d497[_0x7130('0x1b')]=intUtil[_0x7130('0x4b')](_0x42d497[_0x7130('0x1b')]);_0x42d497[_0x7130('0x4c')]=intUtil[_0x7130('0x4b')](_0x42d497['serverUrl']);if(_0x2d93af&&_0x2d93af[_0x7130('0x65')]&&_0x2d93af[_0x7130('0x65')]!==_0x7130('0x66')){logger['info']('[OUTBOUND]',_0x7130('0x4f'));_0x3dfcc9[_0x7130('0x50')]=util[_0x7130('0x19')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x42d497[_0x7130('0x4c')],_0x3dfcc9[_0x7130('0x52')],md5(_0x3dfcc9[_0x7130('0x52')]));}headers['Authorization']=getAuth(_0x42d497);return getUser(_0x42d497,_0x55dff1[_0x7130('0x54')])[_0x7130('0x14')](function(_0x4604cc){_0x28b021=_0x4604cc;logger[_0x7130('0x15')]('The\x20User\x20ID\x20is:',_0x28b021['id']);return getEndUser(_0x42d497,_0x3dfcc9['destcalleridname'],_0x3dfcc9[_0x7130('0x67')]);})[_0x7130('0x14')](function(_0x672d3a){_0x5f4a93=_0x672d3a;logger[_0x7130('0x15')](_0x7130('0x68'),_0x5f4a93['id']);return getTicket(_0x42d497,_0x28b021,_0x5f4a93,_0x9426ed,_0x3dfcc9);})[_0x7130('0x14')](function(_0x46176d){if(_0x46176d){logger[_0x7130('0x15')](_0x7130('0x69'),_0x46176d['id']);switch(_0x42d497['type']){case _0x7130('0x58'):logger['info'](_0x7130('0x6a'),_0x7130('0x59'));return request({'uri':util[_0x7130('0x19')](_0x7130('0x6b'),_0x42d497[_0x7130('0x1b')],_0x28b021['id'],_0x46176d['id']),'method':_0x7130('0xd')});case _0x7130('0x5a'):logger[_0x7130('0x15')](_0x7130('0x6a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x7130('0x19')](_0x7130('0x5c'),_0x55dff1['name']),_0x7130('0x5d'),{'uri':util[_0x7130('0x19')]('%s/agent/tickets/%s',_0x42d497[_0x7130('0x1b')][_0x7130('0x5f')](_0x7130('0x6c'),''),_0x46176d['id'])});break;default:logger[_0x7130('0x60')](_0x7130('0x6a'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x7130('0x62')](function(_0x566562){logger[_0x7130('0x60')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x7130('0x63')](_0x566562,{'showHidden':!![],'depth':null}));});};exports[_0x7130('0x6d')]=function(_0xa3ed86,_0x2a989c,_0x2ac01c,_0x5f3c08,_0x128b3a,_0x46a20f){var _0x3eed10,_0x1ff4c7;_0x46a20f[_0x7130('0x1b')]=intUtil[_0x7130('0x4b')](_0x46a20f[_0x7130('0x1b')]);_0x46a20f[_0x7130('0x4c')]=intUtil['stripTrailingSlash'](_0x46a20f[_0x7130('0x4c')]);if(_0x128b3a&&_0x128b3a[_0x7130('0x4d')]){logger[_0x7130('0x15')]('['+_0x2a989c[_0x7130('0x6e')][_0x7130('0x6f')]()+']',_0x7130('0x4f'));_0x2a989c[_0x7130('0x50')]=util[_0x7130('0x19')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x46a20f['serverUrl'],_0x2a989c[_0x7130('0x52')],md5(_0x2a989c['uniqueid']));}else{_0x2a989c[_0x7130('0x50')]='';}headers[_0x7130('0x53')]=getAuth(_0x46a20f);return getUser(_0x46a20f)[_0x7130('0x14')](function(_0x315fa6){_0x3eed10=_0x315fa6;logger[_0x7130('0x15')](_0x7130('0x55'),_0x3eed10['id']);return getEndUser(_0x46a20f,_0x2a989c[_0x7130('0x56')],_0x2a989c['calleridnum']);})[_0x7130('0x14')](function(_0x40ed49){_0x1ff4c7=_0x40ed49;logger[_0x7130('0x15')](_0x7130('0x68'),_0x1ff4c7['id']);return getTicket(_0x46a20f,_0x3eed10,_0x1ff4c7,_0x2ac01c,_0x2a989c);})[_0x7130('0x14')](function(_0xa22e2b){if(_0xa22e2b){logger[_0x7130('0x15')]('The\x20Ticket\x20ID\x20is:',_0xa22e2b['id']);}})['catch'](function(_0x5d11ab){logger[_0x7130('0x60')]('['+_0x2a989c[_0x7130('0x6e')]['toUpperCase']()+']'+_0x7130('0x70'),util[_0x7130('0x63')](_0x5d11ab,{'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 b8adbd9..37bc194 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 _0x1542=['/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','access_token','seconds','error','info','Search\x20user','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','catch','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','Error:\x20','log','GET','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','contact','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','administrator','Subject','getString','Description','Descriptions','enduserType','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','format','mm:ss','answertime','endtime','diff','starttime','lastevent','Call_Result','Called','connect','Answered','rejected','Rejected','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','YYYY-MM-DDTHH:mm:ss','Inbound','merge','/crm/v2/Calls','details','err','stack','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridnum','trigger:browser:url','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','destcalleridname','destcalleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','unmanaged','toUpperCase','calleridname','The\x20Call\x20ID\x20is:','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','socket.io-emitter','debug','stringify','includes','string','picklist','idField','content','toString','type','variableName','customVariable','Variable','name','indexOf','split','isNil','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST'];(function(_0x405052,_0x155366){var _0x39c572=function(_0x2e2341){while(--_0x2e2341){_0x405052['push'](_0x405052['shift']());}};_0x39c572(++_0x155366);}(_0x1542,0x73));var _0x2154=function(_0x39f2e1,_0x14a940){_0x39f2e1=_0x39f2e1-0x0;var _0xce7766=_0x1542[_0x39f2e1];return _0xce7766;};'use strict';var _=require(_0x2154('0x0'));var rp=require(_0x2154('0x1'));var md5=require(_0x2154('0x2'));var util=require(_0x2154('0x3'));var intUtil=require(_0x2154('0x4'));var moment=require('moment');var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0x2154('0x5'));var logger=require(_0x2154('0x6'))(_0x2154('0x7'));config['redis']=_[_0x2154('0x8')](config[_0x2154('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x2154('0xa'))(new Redis(config[_0x2154('0x9')]));function emit(_0x3b3ecc,_0x4805d1,_0x2242f8){io['to'](_0x3b3ecc)['emit'](_0x4805d1,_0x2242f8);}function request(_0x542abe){logger[_0x2154('0xb')]('[HTTP]',JSON[_0x2154('0xc')](_0x542abe));return rp(_0x542abe);}function getCustomFields(_0x589659,_0x391cfe){var _0x5c5135={};if(_0x589659['length']>0x0){_['forEach'](_0x589659,function(_0x5a2ba3){if(_[_0x2154('0xd')]([_0x2154('0xe'),_0x2154('0xf')],_0x5a2ba3['type'])&&_0x5a2ba3[_0x2154('0x10')]){_0x5c5135[_0x5a2ba3[_0x2154('0x10')]]=_0x5a2ba3[_0x2154('0x11')][_0x2154('0x12')]();}else if(_0x5a2ba3[_0x2154('0x13')]==='variable'&&_0x5a2ba3[_0x2154('0x14')]&&_0x5a2ba3[_0x2154('0x10')]&&_0x391cfe[_0x5a2ba3['variableName']]){_0x5c5135[_0x5a2ba3[_0x2154('0x10')]]=_0x391cfe[_0x5a2ba3[_0x2154('0x14')]][_0x2154('0x12')]();}else if(_0x5a2ba3['type']===_0x2154('0x15')&&_0x5a2ba3[_0x2154('0x16')]&&_0x5a2ba3['Variable'][_0x2154('0x17')]&&_0x5a2ba3[_0x2154('0x10')]&&_0x391cfe[_0x5a2ba3[_0x2154('0x16')]['name']['toLowerCase']()]){_0x5c5135[_0x5a2ba3['idField']]=_0x391cfe[_0x5a2ba3[_0x2154('0x16')][_0x2154('0x17')]['toLowerCase']()]['toString']();}});}return _0x5c5135;}function getName(_0x1e3b20){if(_0x1e3b20[_0x2154('0x18')]('\x20')>0x0){var _0x5121bd=_0x1e3b20[_0x2154('0x19')](/ (.+)/);if(_0x5121bd[0x1]){return _0x5121bd;}}return[_0x1e3b20,_0x1e3b20];}var accountsTokens={};function getAccessToken(_0x438442){return new Promise(function(_0x217e6d,_0x4bd8b8){if(!_[_0x2154('0x1a')](accountsTokens[_0x438442['id']])&&!_[_0x2154('0x1a')](accountsTokens[_0x438442['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x438442['id']]['expires_in'])){_0x217e6d(accountsTokens[_0x438442['id']]['access_token']);}}var _0x2a4bcb;switch(_0x438442[_0x2154('0x1b')]){case'US':_0x2a4bcb=_0x2154('0x1c');break;case'AU':_0x2a4bcb=_0x2154('0x1d');break;case'EU':_0x2a4bcb='https://accounts.zoho.eu';break;case'IN':_0x2a4bcb=_0x2154('0x1e');break;case'CN':_0x2a4bcb=_0x2154('0x1f');break;default:_0x2a4bcb='https://accounts.zoho.eu';break;}var _0x2878dc={'method':_0x2154('0x20'),'uri':_0x2a4bcb+_0x2154('0x21'),'qs':{'refresh_token':_0x438442[_0x2154('0x22')],'client_id':_0x438442[_0x2154('0x23')],'client_secret':_0x438442[_0x2154('0x24')],'grant_type':_0x2154('0x25')},'json':!![]};return rp(_0x2878dc)[_0x2154('0x26')](function(_0x4e4ee7){accountsTokens[_0x438442['id']]={'access_token':_0x4e4ee7[_0x2154('0x27')],'expires_in':moment()['add'](_0x4e4ee7['expires_in'],_0x2154('0x28'))};_0x217e6d(_0x4e4ee7[_0x2154('0x27')]);})['catch'](function(_0x421682){logger[_0x2154('0x29')]('Failing\x20creating\x20the\x20access_token',_0x421682['stack']);_0x4bd8b8(_0x421682);});});}function getUser(_0x30a40c,_0x546006,_0x29f038,_0x13c644){logger[_0x2154('0x2a')](_0x2154('0x2b'));return request({'method':'GET','uri':util['format']('https://www.zohoapis.%s/crm/v2/users',_0x546006),'qs':{'type':_0x2154('0x2c')},'headers':{'Authorization':_0x2154('0x2d')+_0x30a40c},'json':!![]})[_0x2154('0x26')](function(_0xd205ec){if(_0xd205ec['users']){var _0x20d767=-0x1;if(_['isArrayLikeObject'](_0xd205ec[_0x2154('0x2e')])){if(!_[_0x2154('0x1a')](_0x13c644)){_0x20d767=_[_0x2154('0x2f')](_0xd205ec[_0x2154('0x2e')],function(_0x5de924){return _0x5de924['email']===_0x13c644;});}if(_0x20d767>=0x0){logger[_0x2154('0x2a')](_0x2154('0x30'));}else{logger[_0x2154('0x2a')](_0x2154('0x31'));_0x20d767=_[_0x2154('0x2f')](_0xd205ec[_0x2154('0x2e')],function(_0x95b342){return _0x95b342['profile'][_0x2154('0x17')]==='Administrator';});}return _0xd205ec['users'][_0x20d767];}else{if(_0xd205ec['user'][_0x2154('0x32')][_0x2154('0x17')]===_0x2154('0x33')){logger[_0x2154('0x2a')]('Using\x20the\x20admin\x20account!');user=_0xd205ec[_0x2154('0x34')];return user;}else{logger[_0x2154('0x29')](_0x2154('0x35'),JSON['stringify'](_0xd205ec));throw new Error(_0x2154('0x36')+JSON['stringify'](_0xd205ec));}}}else{logger[_0x2154('0x29')](_0x2154('0x35'),JSON[_0x2154('0xc')](_0xd205ec));throw new Error(_0x2154('0x36')+JSON['stringify'](_0xd205ec));}})['catch'](function(_0xa2e0bc){console['error'](_0xa2e0bc);});}function getZohoUser(_0x2ae32d,_0x4c8b2c){return new BPromise(function(_0x260fda,_0xa91c11){request(_0x2ae32d)[_0x2154('0x26')](function(_0x2041b3){var _0x4be1ab=null;if(_0x2041b3){_0x4be1ab=_0x2041b3[_0x2154('0x37')][0x0];_0x4be1ab['enduserType']=_0x4c8b2c;}_0x260fda(_0x4be1ab);})[_0x2154('0x38')](function(_0x3a960c){_0xa91c11(_0x3a960c);});});}function createEndUser(_0x259534,_0x460c81,_0x4f6c57,_0x5594d8,_0xedaffc,_0x37d791){var _0x4f6c57=getName(_0x4f6c57);return request({'method':'POST','uri':_0x2154('0x39')+_0x460c81+'/crm/v2/'+_[_0x2154('0x3a')](_0x37d791[_0x2154('0x3b')])+'s','body':{'data':[{'Last_Name':_0x4f6c57[0x1],'First_Name':_0x4f6c57[0x0],'Phone':_0x5594d8,'Owner':{'name':!_[_0x2154('0x1a')](_0xedaffc[_0x2154('0x3c')]['name'])?_0xedaffc[_0x2154('0x3c')]['name']:!_[_0x2154('0x1a')](_0xedaffc[_0x2154('0x3d')])?_0xedaffc['first_name']+'\x20'+_0xedaffc[_0x2154('0x3e')]:_0xedaffc[_0x2154('0x3e')],'id':_0xedaffc['id']}}]},'headers':{'Authorization':_0x2154('0x2d')+_0x259534},'json':!![]})[_0x2154('0x26')](function(_0x22477e){if(_0x22477e&&_0x22477e['data'][0x0][_0x2154('0x3f')]===_0x2154('0x40')){var _0x3469a9=_0x22477e[_0x2154('0x37')][0x0]['details'];_0x3469a9['enduserType']=_[_0x2154('0x3a')](_0x37d791[_0x2154('0x3b')])+'s';return _0x3469a9;}logger[_0x2154('0x29')](_0x2154('0x35'),JSON[_0x2154('0xc')](data));throw new Error(_0x2154('0x41')+JSON[_0x2154('0xc')](data));})[_0x2154('0x38')](function(_0x402684){console[_0x2154('0x42')]('CREATE\x20ERROR',_0x402684);});}function getEndUser(_0x1bda65,_0x137bc3,_0x10bc70,_0x5991ed,_0x4767b0,_0x45ac56,_0x4ac7a7){var _0x48d020={'method':_0x2154('0x43'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1bda65},'json':!![]};switch(_0x4ac7a7[_0x2154('0x44')]){case _0x2154('0x45'):_0x48d020[_0x2154('0x46')]=_0x2154('0x39')+_0x137bc3+_0x2154('0x47')+_0x4767b0+'))';return getZohoUser(_0x48d020,_0x2154('0x48'))[_0x2154('0x26')](function(_0x2ee230){if(_0x2ee230)return _0x2ee230;_0x48d020['uri']=_0x2154('0x39')+_0x137bc3+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x4767b0+'))';return getZohoUser(_0x48d020,_0x2154('0x49'))[_0x2154('0x26')](function(_0x1f3a59){if(_0x1f3a59)return _0x1f3a59;if(_0x4ac7a7[_0x2154('0x3b')]!=_0x2154('0x4a')){return createEndUser(_0x1bda65,_0x137bc3,_0x5991ed,_0x4767b0,_0x45ac56,_0x4ac7a7);}else{return{};}});});break;case _0x2154('0x4b'):_0x48d020[_0x2154('0x46')]='https://www.zohoapis.'+_0x137bc3+_0x2154('0x47')+_0x4767b0+'))';return getZohoUser(_0x48d020,'Contacts')[_0x2154('0x26')](function(_0x333d28){if(_0x333d28)return _0x333d28;if(_0x4ac7a7[_0x2154('0x3b')]!=_0x2154('0x4a')){return createEndUser(_0x1bda65,_0x137bc3,_0x5991ed,_0x4767b0,_0x45ac56,_0x4ac7a7);}else{return{};}});break;case _0x2154('0x4c'):_0x48d020[_0x2154('0x46')]='https://www.zohoapis.'+_0x137bc3+_0x2154('0x4d')+_0x4767b0+'))';return getZohoUser(_0x48d020,_0x2154('0x49'))[_0x2154('0x26')](function(_0x50e12e){if(_0x50e12e)return _0x50e12e;if(_0x4ac7a7[_0x2154('0x3b')]!=_0x2154('0x4a')){return createEndUser(_0x1bda65,_0x137bc3,_0x5991ed,_0x4767b0,_0x45ac56,_0x4ac7a7);}else{return{};}});break;}}function getCall(_0x73f716,_0x460df3,_0x59e687,_0x413439,_0x47d116,_0x4e117a,_0x4dbfe1,_0x3c4681){logger[_0x2154('0x2a')](_0x2154('0x4e'));var _0x28d2cf={};_0x28d2cf['Owner']={'name':!_['isNil'](_0x413439['role'][_0x2154('0x17')])&&!_['isNil'](_0x413439[_0x2154('0x32')]['name'])&&_0x413439[_0x2154('0x32')]['name']===_0x2154('0x4f')?_0x413439[_0x2154('0x3c')][_0x2154('0x17')]:!_['isNil'](_0x413439[_0x2154('0x3d')])?_0x413439[_0x2154('0x3d')]+'\x20'+_0x413439[_0x2154('0x3e')]:_0x413439[_0x2154('0x3e')],'id':_0x413439['id']};_0x28d2cf[_0x2154('0x50')]=intUtil[_0x2154('0x51')](_0x4e117a['Subjects'],_0x4dbfe1,'\x20');_0x28d2cf[_0x2154('0x52')]=intUtil[_0x2154('0x51')](_0x4e117a[_0x2154('0x53')],_0x4dbfe1,'\x0a');if(_0x47d116[_0x2154('0x54')]==='Contacts'){_0x28d2cf[_0x2154('0x55')]={'name':!_[_0x2154('0x1a')](_0x47d116[_0x2154('0x56')])?_0x47d116['Full_Name']:!_['isNil'](_0x47d116[_0x2154('0x57')])?_0x47d116[_0x2154('0x57')]+'\x20'+_0x47d116[_0x2154('0x58')]:_0x47d116[_0x2154('0x58')],'id':_0x47d116['id']};}if(_0x47d116[_0x2154('0x54')]===_0x2154('0x49')){_0x28d2cf[_0x2154('0x59')]={'name':!_['isNil'](_0x47d116[_0x2154('0x56')])?_0x47d116[_0x2154('0x56')]:!_['isNil'](_0x47d116[_0x2154('0x57')])?_0x47d116['First_Name']+'\x20'+_0x47d116[_0x2154('0x58')]:_0x47d116[_0x2154('0x58')],'id':_0x47d116['id']};_0x28d2cf[_0x2154('0x5a')]=_[_0x2154('0x3a')](_0x47d116[_0x2154('0x54')]);}if(_0x4dbfe1[_0x2154('0x5b')]){_0x28d2cf[_0x2154('0x5c')]=moment[_0x2154('0x5d')](parseInt(_0x4dbfe1['talktime'])*0x3e8)[_0x2154('0x5e')](_0x2154('0x5f'));}else if(_0x4dbfe1[_0x2154('0x60')]&&_0x4dbfe1[_0x2154('0x61')]){_0x28d2cf[_0x2154('0x5c')]=moment['utc'](moment(_0x4dbfe1[_0x2154('0x61')],'YYYY-MM-DDTHH:mm:ss')[_0x2154('0x62')](moment(_0x4dbfe1[_0x2154('0x63')],'YYYY-MM-DDTHH:mm:ss')))[_0x2154('0x5e')](_0x2154('0x5f'));}switch(_0x4dbfe1[_0x2154('0x64')]){case'called':_0x28d2cf[_0x2154('0x65')]=_0x2154('0x66');break;case'complete':case _0x2154('0x67'):_0x28d2cf[_0x2154('0x65')]=_0x2154('0x68');break;case _0x2154('0x69'):_0x28d2cf[_0x2154('0x65')]=_0x2154('0x6a');break;case'abandoned':_0x28d2cf['Call_Result']=_0x2154('0x6b');break;case _0x2154('0x6c'):_0x28d2cf[_0x2154('0x65')]=_0x2154('0x6d');default:}_0x28d2cf[_0x2154('0x6e')]=(_0x3c4681===_0x2154('0x6f')?moment(_0x4dbfe1[_0x2154('0x63')])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x4dbfe1[_0x2154('0x70')])[_0x2154('0x5e')](_0x2154('0x71')))||moment()['format'](_0x2154('0x71'));_0x28d2cf['Call_Type']=_0x3c4681||_0x2154('0x72');_0x28d2cf=_[_0x2154('0x73')](_0x28d2cf,getCustomFields(_0x4e117a['Fields'],_0x4dbfe1));return request({'method':_0x2154('0x20'),'uri':_0x2154('0x39')+_0x460df3+_0x2154('0x74'),'headers':{'Authorization':_0x2154('0x2d')+_0x73f716},'body':{'data':[_0x28d2cf]},'json':!![]})[_0x2154('0x26')](function(_0x564b54){if(_0x564b54&&_0x564b54[_0x2154('0x37')][0x0]['code']===_0x2154('0x40')){logger[_0x2154('0x2a')]('Call\x20created!');return{'id':_0x564b54['data'][0x0][_0x2154('0x75')]['id']};}})[_0x2154('0x38')](function(_0x2674e4){logger[_0x2154('0x2a')](_0x2154('0x76'),_0x2674e4[_0x2154('0x77')]);console['log'](_0x2154('0x76'),_0x2674e4);});}exports['queue']=function(_0x1a3724,_0x15c5af,_0x3a4ff9,_0x1f23a7,_0x16fb54,_0x4aa75b){var _0x3ff84b,_0x2359f7,_0x5c1743;_0x4aa75b[_0x2154('0x78')]=intUtil[_0x2154('0x79')](_0x4aa75b[_0x2154('0x78')]);_0x4aa75b['serverUrl']=intUtil['stripTrailingSlash'](_0x4aa75b[_0x2154('0x7a')]);if(_0x16fb54&&_0x16fb54['monitor_format']){logger['info'](_0x2154('0x7b'),_0x2154('0x7c'));_0x15c5af[_0x2154('0x7d')]=_0x4aa75b['serverUrl']+'/api/voice/recordings/'+_0x15c5af[_0x2154('0x7e')]+_0x2154('0x7f')+md5(_0x15c5af['uniqueid']);}else{_0x15c5af[_0x2154('0x7d')]='';}var _0x241051=_0x4aa75b[_0x2154('0x78')]===_0x2154('0x80')?'eu':_0x2154('0x81');return getAccessToken(_0x4aa75b)['then'](function(_0x6f0849){_0x5c1743=_0x6f0849;return getUser(_0x5c1743,_0x241051,_0x4aa75b,_0x1f23a7[_0x2154('0x82')]);})[_0x2154('0x26')](function(_0xb02fc1){_0x3ff84b=_0xb02fc1;logger[_0x2154('0x2a')](_0x2154('0x83'),_0x3ff84b['id']);return getEndUser(_0x5c1743,_0x241051,_0x4aa75b,_0x15c5af['calleridname'],_0x15c5af[_0x2154('0x84')],_0x3ff84b,_0x3a4ff9);})[_0x2154('0x26')](function(_0x58f5c4){_0x2359f7=_0x58f5c4;return getCall(_0x5c1743,_0x241051,_0x4aa75b,_0x3ff84b,_0x2359f7,_0x3a4ff9,_0x15c5af,'Inbound');})[_0x2154('0x26')](function(_0x1a48c5){if(_0x1a48c5){logger['info']('The\x20Call\x20ID\x20is:',_0x1a48c5['id']);logger[_0x2154('0x2a')](_0x2154('0x7b'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x2154('0x5e')]('user:%s',_0x1f23a7[_0x2154('0x17')]),_0x2154('0x85'),{'uri':'https://crm.'+_0x4aa75b['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x1a48c5['id']});}})[_0x2154('0x38')](function(_0x124432){logger['error'](_0x2154('0x7b'),JSON[_0x2154('0xc')](_0x124432));});};exports[_0x2154('0x6f')]=function(_0x50dddf,_0x1e094e,_0x8e875a,_0x4adeca,_0x12dfc6,_0x3f08ef,_0x2da132){var _0x4839a6,_0x4534a1,_0x8483fb;_0x3f08ef[_0x2154('0x78')]=intUtil['stripTrailingSlash'](_0x3f08ef[_0x2154('0x78')]);_0x3f08ef['serverUrl']=intUtil[_0x2154('0x79')](_0x3f08ef[_0x2154('0x7a')]);if(_0x2da132&&_0x2da132['recordingFormat']&&_0x2da132[_0x2154('0x86')]!==_0x2154('0x87')){logger['info'](_0x2154('0x88'),_0x2154('0x7c'));_0x1e094e[_0x2154('0x7d')]=_0x3f08ef[_0x2154('0x7a')]+_0x2154('0x89')+_0x1e094e[_0x2154('0x7e')]+_0x2154('0x7f')+md5(_0x1e094e[_0x2154('0x7e')]);}var _0x6c7750=_0x3f08ef[_0x2154('0x78')]==='zoho.eu'?'eu':_0x2154('0x81');return getAccessToken(_0x3f08ef)[_0x2154('0x26')](function(_0x4d8ce5){_0x8483fb=_0x4d8ce5;return getUser(_0x8483fb,_0x6c7750,_0x3f08ef,_0x4adeca['email']);})[_0x2154('0x26')](function(_0x5d0bdd){_0x4839a6=_0x5d0bdd;logger[_0x2154('0x2a')](_0x2154('0x83'),_0x4839a6['id']);return getEndUser(_0x8483fb,_0x6c7750,_0x3f08ef,_0x1e094e[_0x2154('0x8a')],_0x1e094e[_0x2154('0x8b')],_0x4839a6,_0x8e875a);})[_0x2154('0x26')](function(_0x213e07){_0x4534a1=_0x213e07;return getCall(_0x8483fb,_0x6c7750,_0x3f08ef,_0x4839a6,_0x4534a1,_0x8e875a,_0x1e094e,'Outbound');})[_0x2154('0x26')](function(_0x4f29a2){if(_0x4f29a2){logger['info']('The\x20Call\x20ID\x20is:',_0x4f29a2['id']);logger[_0x2154('0x2a')](_0x2154('0x88'),_0x2154('0x8c'));emit(util[_0x2154('0x5e')](_0x2154('0x8d'),_0x4adeca[_0x2154('0x17')]),_0x2154('0x85'),{'uri':_0x2154('0x8e')+_0x3f08ef[_0x2154('0x78')]+_0x2154('0x8f')+_0x4f29a2['id']});}})[_0x2154('0x38')](function(_0x29ef37){logger[_0x2154('0x29')](_0x2154('0x88'),JSON[_0x2154('0xc')](_0x29ef37));});};exports[_0x2154('0x90')]=function(_0x449638,_0x62d7aa,_0xf97ca,_0x2a8b58,_0x838b8f,_0x1842d2){var _0x56c1b6,_0x13fe65,_0x3e32f5;_0x1842d2[_0x2154('0x78')]=intUtil['stripTrailingSlash'](_0x1842d2[_0x2154('0x78')]);_0x1842d2['serverUrl']=intUtil[_0x2154('0x79')](_0x1842d2[_0x2154('0x7a')]);if(_0x838b8f&&_0x838b8f['monitor_format']){logger[_0x2154('0x2a')]('['+_0x62d7aa[_0x2154('0x64')][_0x2154('0x91')]()+']',_0x2154('0x7c'));_0x62d7aa[_0x2154('0x7d')]=_0x1842d2[_0x2154('0x7a')]+'/api/voice/recordings/'+_0x62d7aa[_0x2154('0x7e')]+_0x2154('0x7f')+md5(_0x62d7aa['uniqueid']);}else{_0x62d7aa['recordingURL']='';}var _0x53ae55=_0x1842d2[_0x2154('0x78')]===_0x2154('0x80')?'eu':_0x2154('0x81');return getAccessToken(_0x1842d2)[_0x2154('0x26')](function(_0x28da12){_0x3e32f5=_0x28da12;return getUser(_0x3e32f5,_0x53ae55,_0x1842d2);})[_0x2154('0x26')](function(_0x131207){_0x56c1b6=_0x131207;logger[_0x2154('0x2a')](_0x2154('0x83'),_0x56c1b6['id']);return getEndUser(_0x3e32f5,_0x53ae55,_0x1842d2,_0x62d7aa[_0x2154('0x92')],_0x62d7aa['calleridnum'],_0x56c1b6,_0xf97ca);})[_0x2154('0x26')](function(_0x17c3bb){_0x13fe65=_0x17c3bb;return getCall(_0x3e32f5,_0x53ae55,_0x1842d2,_0x56c1b6,_0x13fe65,_0xf97ca,_0x62d7aa,_0x2154('0x72'));})[_0x2154('0x26')](function(_0x16fc04){if(_0x16fc04){logger[_0x2154('0x2a')](_0x2154('0x93'),_0x16fc04['id']);}})[_0x2154('0x38')](function(_0x2925ad){logger[_0x2154('0x29')]('['+_0x62d7aa['lastevent'][_0x2154('0x91')]()+']',JSON[_0x2154('0xc')](_0x2925ad));});}; \ No newline at end of file +var _0x5af7=['destcalleridnum','Outbound','user:%s','/crm/EntityInfo.do?module=Calls&id=','unmanaged','lastevent','toUpperCase','calleridname','lodash','md5','moment','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','stringify','forEach','includes','string','picklist','type','idField','content','toString','variableName','customVariable','Variable','name','indexOf','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','refreshToken','clientId','clientSecret','refresh_token','then','add','catch','error','Failing\x20creating\x20the\x20access_token','stack','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','findIndex','email','info','Agent\x20found!','Using\x20the\x20admin\x20account!','user','Administrator','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','enduserType','log','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','lead','Creating\x20new\x20call...','profile','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','utc','format','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','starttime','called','Called','complete','connect','Answered','Rejected','abandoned','Call_Result','Abandoned','timeout','Timeout','Call_Start_Time','Inbound','Fields','/crm/v2/Calls','Call\x20created!','details','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','com','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','[QUEUE]','outbound','none','[OUTBOUND]','zoho.eu','The\x20User\x20ID\x20is:','destcalleridname'];(function(_0x45df63,_0x21d54a){var _0x5904a1=function(_0x3bf2f9){while(--_0x3bf2f9){_0x45df63['push'](_0x45df63['shift']());}};_0x5904a1(++_0x21d54a);}(_0x5af7,0x9c));var _0x75af=function(_0x257b0e,_0x563d7e){_0x257b0e=_0x257b0e-0x0;var _0x27ac2a=_0x5af7[_0x257b0e];return _0x27ac2a;};'use strict';var _=require(_0x75af('0x0'));var rp=require('request-promise');var md5=require(_0x75af('0x1'));var util=require('util');var intUtil=require('./util');var moment=require(_0x75af('0x2'));var Redis=require('ioredis');var BPromise=require(_0x75af('0x3'));var config=require(_0x75af('0x4'));var logger=require(_0x75af('0x5'))('zoho');config[_0x75af('0x6')]=_[_0x75af('0x7')](config[_0x75af('0x6')],{'host':_0x75af('0x8'),'port':0x18eb});var io=require(_0x75af('0x9'))(new Redis(config[_0x75af('0x6')]));function emit(_0x2b0c9d,_0x239700,_0x4ee7de){io['to'](_0x2b0c9d)[_0x75af('0xa')](_0x239700,_0x4ee7de);}function request(_0x58bf3e){logger['debug']('[HTTP]',JSON[_0x75af('0xb')](_0x58bf3e));return rp(_0x58bf3e);}function getCustomFields(_0x4d0609,_0x4817dd){var _0x4a1e11={};if(_0x4d0609['length']>0x0){_[_0x75af('0xc')](_0x4d0609,function(_0x5c70d7){if(_[_0x75af('0xd')]([_0x75af('0xe'),_0x75af('0xf')],_0x5c70d7[_0x75af('0x10')])&&_0x5c70d7[_0x75af('0x11')]){_0x4a1e11[_0x5c70d7['idField']]=_0x5c70d7[_0x75af('0x12')][_0x75af('0x13')]();}else if(_0x5c70d7[_0x75af('0x10')]==='variable'&&_0x5c70d7[_0x75af('0x14')]&&_0x5c70d7[_0x75af('0x11')]&&_0x4817dd[_0x5c70d7[_0x75af('0x14')]]){_0x4a1e11[_0x5c70d7[_0x75af('0x11')]]=_0x4817dd[_0x5c70d7[_0x75af('0x14')]]['toString']();}else if(_0x5c70d7[_0x75af('0x10')]===_0x75af('0x15')&&_0x5c70d7['Variable']&&_0x5c70d7[_0x75af('0x16')][_0x75af('0x17')]&&_0x5c70d7[_0x75af('0x11')]&&_0x4817dd[_0x5c70d7[_0x75af('0x16')][_0x75af('0x17')]['toLowerCase']()]){_0x4a1e11[_0x5c70d7['idField']]=_0x4817dd[_0x5c70d7[_0x75af('0x16')][_0x75af('0x17')]['toLowerCase']()][_0x75af('0x13')]();}});}return _0x4a1e11;}function getName(_0x1bb986){if(_0x1bb986[_0x75af('0x18')]('\x20')>0x0){var _0xaa8ac7=_0x1bb986[_0x75af('0x19')](/ (.+)/);if(_0xaa8ac7[0x1]){return _0xaa8ac7;}}return[_0x1bb986,_0x1bb986];}var accountsTokens={};function getAccessToken(_0x579b34){return new Promise(function(_0x55a6ea,_0x13d5de){if(!_[_0x75af('0x1a')](accountsTokens[_0x579b34['id']])&&!_[_0x75af('0x1a')](accountsTokens[_0x579b34['id']][_0x75af('0x1b')])){if(moment()[_0x75af('0x1c')](accountsTokens[_0x579b34['id']][_0x75af('0x1d')])){_0x55a6ea(accountsTokens[_0x579b34['id']][_0x75af('0x1b')]);}}var _0x411962;switch(_0x579b34['zone']){case'US':_0x411962='https://accounts.zoho.com';break;case'AU':_0x411962=_0x75af('0x1e');break;case'EU':_0x411962=_0x75af('0x1f');break;case'IN':_0x411962='https://accounts.zoho.in';break;case'CN':_0x411962='https://accounts.zoho.com.cn';break;default:_0x411962=_0x75af('0x1f');break;}var _0x3f91bf={'method':_0x75af('0x20'),'uri':_0x411962+'/oauth/v2/token','qs':{'refresh_token':_0x579b34[_0x75af('0x21')],'client_id':_0x579b34[_0x75af('0x22')],'client_secret':_0x579b34[_0x75af('0x23')],'grant_type':_0x75af('0x24')},'json':!![]};return rp(_0x3f91bf)[_0x75af('0x25')](function(_0x5786c1){accountsTokens[_0x579b34['id']]={'access_token':_0x5786c1[_0x75af('0x1b')],'expires_in':moment()[_0x75af('0x26')](_0x5786c1[_0x75af('0x1d')],'seconds')};_0x55a6ea(_0x5786c1['access_token']);})[_0x75af('0x27')](function(_0x190f01){logger[_0x75af('0x28')](_0x75af('0x29'),_0x190f01[_0x75af('0x2a')]);_0x13d5de(_0x190f01);});});}function getUser(_0x3d2268,_0x28839b,_0x4d6e93,_0x361b58){logger['info']('Search\x20user');return request({'method':_0x75af('0x2b'),'uri':util['format'](_0x75af('0x2c'),_0x28839b),'qs':{'type':_0x75af('0x2d')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3d2268},'json':!![]})[_0x75af('0x25')](function(_0x2ab0c3){if(_0x2ab0c3[_0x75af('0x2e')]){var _0x3d57dd=-0x1;if(_['isArrayLikeObject'](_0x2ab0c3[_0x75af('0x2e')])){if(!_[_0x75af('0x1a')](_0x361b58)){_0x3d57dd=_[_0x75af('0x2f')](_0x2ab0c3[_0x75af('0x2e')],function(_0x3c36f7){return _0x3c36f7[_0x75af('0x30')]===_0x361b58;});}if(_0x3d57dd>=0x0){logger[_0x75af('0x31')](_0x75af('0x32'));}else{logger[_0x75af('0x31')](_0x75af('0x33'));_0x3d57dd=_[_0x75af('0x2f')](_0x2ab0c3['users'],function(_0x29a938){return _0x29a938['profile'][_0x75af('0x17')]==='Administrator';});}return _0x2ab0c3[_0x75af('0x2e')][_0x3d57dd];}else{if(_0x2ab0c3[_0x75af('0x34')]['profile'][_0x75af('0x17')]===_0x75af('0x35')){logger['info'](_0x75af('0x33'));user=_0x2ab0c3[_0x75af('0x34')];return user;}else{logger[_0x75af('0x28')]('The\x20failing\x20result\x20is',JSON['stringify'](_0x2ab0c3));throw new Error(_0x75af('0x36')+JSON[_0x75af('0xb')](_0x2ab0c3));}}}else{logger[_0x75af('0x28')](_0x75af('0x37'),JSON[_0x75af('0xb')](_0x2ab0c3));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x75af('0xb')](_0x2ab0c3));}})[_0x75af('0x27')](function(_0x547e33){console['error'](_0x547e33);});}function getZohoUser(_0xe13409,_0x2a4f9d){return new BPromise(function(_0x26c314,_0x14eb5b){request(_0xe13409)[_0x75af('0x25')](function(_0x474951){var _0x4109e6=null;if(_0x474951){_0x4109e6=_0x474951[_0x75af('0x38')][0x0];_0x4109e6['enduserType']=_0x2a4f9d;}_0x26c314(_0x4109e6);})[_0x75af('0x27')](function(_0x5e3d00){_0x14eb5b(_0x5e3d00);});});}function createEndUser(_0x55b996,_0x4a0681,_0x25dbd2,_0x2729ce,_0x1e72ed,_0x152f20){var _0x25dbd2=getName(_0x25dbd2);return request({'method':_0x75af('0x20'),'uri':_0x75af('0x39')+_0x4a0681+_0x75af('0x3a')+_[_0x75af('0x3b')](_0x152f20[_0x75af('0x3c')])+'s','body':{'data':[{'Last_Name':_0x25dbd2[0x1],'First_Name':_0x25dbd2[0x0],'Phone':_0x2729ce,'Owner':{'name':!_[_0x75af('0x1a')](_0x1e72ed[_0x75af('0x3d')][_0x75af('0x17')])?_0x1e72ed['role']['name']:!_['isNil'](_0x1e72ed[_0x75af('0x3e')])?_0x1e72ed['first_name']+'\x20'+_0x1e72ed['last_name']:_0x1e72ed[_0x75af('0x3f')],'id':_0x1e72ed['id']}}]},'headers':{'Authorization':_0x75af('0x40')+_0x55b996},'json':!![]})[_0x75af('0x25')](function(_0x527c4a){if(_0x527c4a&&_0x527c4a[_0x75af('0x38')][0x0][_0x75af('0x41')]===_0x75af('0x42')){var _0x1fbc0c=_0x527c4a[_0x75af('0x38')][0x0]['details'];_0x1fbc0c[_0x75af('0x43')]=_['startCase'](_0x152f20[_0x75af('0x3c')])+'s';return _0x1fbc0c;}logger[_0x75af('0x28')](_0x75af('0x37'),JSON[_0x75af('0xb')](data));throw new Error('Error:\x20'+JSON[_0x75af('0xb')](data));})[_0x75af('0x27')](function(_0x387195){console[_0x75af('0x44')]('CREATE\x20ERROR',_0x387195);});}function getEndUser(_0x423b8b,_0x1948af,_0x3661cc,_0x28a051,_0x429013,_0x4652ed,_0x3c2b3c){var _0x44c345={'method':'GET','uri':'','headers':{'Authorization':_0x75af('0x40')+_0x423b8b},'json':!![]};switch(_0x3c2b3c[_0x75af('0x45')]){case _0x75af('0x46'):_0x44c345[_0x75af('0x47')]=_0x75af('0x39')+_0x1948af+_0x75af('0x48')+_0x429013+'))';return getZohoUser(_0x44c345,_0x75af('0x49'))[_0x75af('0x25')](function(_0x591230){if(_0x591230)return _0x591230;_0x44c345[_0x75af('0x47')]=_0x75af('0x39')+_0x1948af+_0x75af('0x4a')+_0x429013+'))';return getZohoUser(_0x44c345,_0x75af('0x4b'))[_0x75af('0x25')](function(_0x1560c3){if(_0x1560c3)return _0x1560c3;if(_0x3c2b3c['moduleCreate']!=_0x75af('0x4c')){return createEndUser(_0x423b8b,_0x1948af,_0x28a051,_0x429013,_0x4652ed,_0x3c2b3c);}else{return{};}});});break;case'contact':_0x44c345[_0x75af('0x47')]=_0x75af('0x39')+_0x1948af+_0x75af('0x48')+_0x429013+'))';return getZohoUser(_0x44c345,_0x75af('0x49'))[_0x75af('0x25')](function(_0x1dfafa){if(_0x1dfafa)return _0x1dfafa;if(_0x3c2b3c[_0x75af('0x3c')]!='nothing'){return createEndUser(_0x423b8b,_0x1948af,_0x28a051,_0x429013,_0x4652ed,_0x3c2b3c);}else{return{};}});break;case _0x75af('0x4d'):_0x44c345[_0x75af('0x47')]=_0x75af('0x39')+_0x1948af+_0x75af('0x4a')+_0x429013+'))';return getZohoUser(_0x44c345,_0x75af('0x4b'))['then'](function(_0x5d807d){if(_0x5d807d)return _0x5d807d;if(_0x3c2b3c['moduleCreate']!=_0x75af('0x4c')){return createEndUser(_0x423b8b,_0x1948af,_0x28a051,_0x429013,_0x4652ed,_0x3c2b3c);}else{return{};}});break;}}function getCall(_0x3ccf82,_0x349449,_0x3d37b8,_0xe3e338,_0x4d5bae,_0x3583dd,_0x58be5f,_0x4c1837){logger['info'](_0x75af('0x4e'));var _0x367de0={};_0x367de0['Owner']={'name':!_['isNil'](_0xe3e338['role'][_0x75af('0x17')])&&!_['isNil'](_0xe3e338[_0x75af('0x4f')][_0x75af('0x17')])&&_0xe3e338[_0x75af('0x4f')][_0x75af('0x17')]===_0x75af('0x50')?_0xe3e338['role'][_0x75af('0x17')]:!_[_0x75af('0x1a')](_0xe3e338[_0x75af('0x3e')])?_0xe3e338['first_name']+'\x20'+_0xe3e338[_0x75af('0x3f')]:_0xe3e338[_0x75af('0x3f')],'id':_0xe3e338['id']};_0x367de0[_0x75af('0x51')]=intUtil[_0x75af('0x52')](_0x3583dd[_0x75af('0x53')],_0x58be5f,'\x20');_0x367de0[_0x75af('0x54')]=intUtil[_0x75af('0x52')](_0x3583dd[_0x75af('0x55')],_0x58be5f,'\x0a');if(_0x4d5bae[_0x75af('0x43')]===_0x75af('0x49')){_0x367de0[_0x75af('0x56')]={'name':!_['isNil'](_0x4d5bae[_0x75af('0x57')])?_0x4d5bae[_0x75af('0x57')]:!_[_0x75af('0x1a')](_0x4d5bae[_0x75af('0x58')])?_0x4d5bae[_0x75af('0x58')]+'\x20'+_0x4d5bae[_0x75af('0x59')]:_0x4d5bae['Last_Name'],'id':_0x4d5bae['id']};}if(_0x4d5bae[_0x75af('0x43')]===_0x75af('0x4b')){_0x367de0[_0x75af('0x5a')]={'name':!_[_0x75af('0x1a')](_0x4d5bae[_0x75af('0x57')])?_0x4d5bae[_0x75af('0x57')]:!_[_0x75af('0x1a')](_0x4d5bae[_0x75af('0x58')])?_0x4d5bae[_0x75af('0x58')]+'\x20'+_0x4d5bae[_0x75af('0x59')]:_0x4d5bae[_0x75af('0x59')],'id':_0x4d5bae['id']};_0x367de0['$se_module']=_[_0x75af('0x3b')](_0x4d5bae[_0x75af('0x43')]);}if(_0x58be5f[_0x75af('0x5b')]){_0x367de0[_0x75af('0x5c')]=moment[_0x75af('0x5d')](parseInt(_0x58be5f[_0x75af('0x5b')])*0x3e8)[_0x75af('0x5e')](_0x75af('0x5f'));}else if(_0x58be5f[_0x75af('0x60')]&&_0x58be5f['endtime']){_0x367de0[_0x75af('0x5c')]=moment[_0x75af('0x5d')](moment(_0x58be5f[_0x75af('0x61')],_0x75af('0x62'))['diff'](moment(_0x58be5f[_0x75af('0x63')],_0x75af('0x62'))))['format'](_0x75af('0x5f'));}switch(_0x58be5f['lastevent']){case _0x75af('0x64'):_0x367de0['Call_Result']=_0x75af('0x65');break;case _0x75af('0x66'):case _0x75af('0x67'):_0x367de0['Call_Result']=_0x75af('0x68');break;case'rejected':_0x367de0['Call_Result']=_0x75af('0x69');break;case _0x75af('0x6a'):_0x367de0[_0x75af('0x6b')]=_0x75af('0x6c');break;case _0x75af('0x6d'):_0x367de0[_0x75af('0x6b')]=_0x75af('0x6e');default:}_0x367de0[_0x75af('0x6f')]=(_0x4c1837==='outbound'?moment(_0x58be5f[_0x75af('0x63')])[_0x75af('0x5e')](_0x75af('0x62')):moment(_0x58be5f['agentcalledAt'])[_0x75af('0x5e')](_0x75af('0x62')))||moment()[_0x75af('0x5e')]('YYYY-MM-DDTHH:mm:ss');_0x367de0['Call_Type']=_0x4c1837||_0x75af('0x70');_0x367de0=_['merge'](_0x367de0,getCustomFields(_0x3583dd[_0x75af('0x71')],_0x58be5f));return request({'method':_0x75af('0x20'),'uri':_0x75af('0x39')+_0x349449+_0x75af('0x72'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3ccf82},'body':{'data':[_0x367de0]},'json':!![]})[_0x75af('0x25')](function(_0x105742){if(_0x105742&&_0x105742[_0x75af('0x38')][0x0][_0x75af('0x41')]===_0x75af('0x42')){logger[_0x75af('0x31')](_0x75af('0x73'));return{'id':_0x105742[_0x75af('0x38')][0x0][_0x75af('0x74')]['id']};}})['catch'](function(_0x5d071c){logger['info'](_0x75af('0x75'),_0x5d071c['stack']);console[_0x75af('0x44')]('err',_0x5d071c);});}exports[_0x75af('0x76')]=function(_0x119a13,_0x5b004f,_0x4d2a0c,_0x2752cf,_0x5a36fa,_0x5e23e3){var _0x25a800,_0x267879,_0xb08433;_0x5e23e3[_0x75af('0x77')]=intUtil[_0x75af('0x78')](_0x5e23e3[_0x75af('0x77')]);_0x5e23e3[_0x75af('0x79')]=intUtil[_0x75af('0x78')](_0x5e23e3['serverUrl']);if(_0x5a36fa&&_0x5a36fa[_0x75af('0x7a')]){logger['info']('[QUEUE]',_0x75af('0x7b'));_0x5b004f[_0x75af('0x7c')]=_0x5e23e3['serverUrl']+'/api/voice/recordings/'+_0x5b004f[_0x75af('0x7d')]+_0x75af('0x7e')+md5(_0x5b004f[_0x75af('0x7d')]);}else{_0x5b004f['recordingURL']='';}var _0xd66e0e=_0x5e23e3[_0x75af('0x77')]==='zoho.eu'?'eu':_0x75af('0x7f');return getAccessToken(_0x5e23e3)['then'](function(_0x29dd05){_0xb08433=_0x29dd05;return getUser(_0xb08433,_0xd66e0e,_0x5e23e3,_0x2752cf[_0x75af('0x30')]);})['then'](function(_0x3ad7e4){_0x25a800=_0x3ad7e4;logger[_0x75af('0x31')]('The\x20User\x20ID\x20is:',_0x25a800['id']);return getEndUser(_0xb08433,_0xd66e0e,_0x5e23e3,_0x5b004f['calleridname'],_0x5b004f[_0x75af('0x80')],_0x25a800,_0x4d2a0c);})[_0x75af('0x25')](function(_0x5f5318){_0x267879=_0x5f5318;return getCall(_0xb08433,_0xd66e0e,_0x5e23e3,_0x25a800,_0x267879,_0x4d2a0c,_0x5b004f,'Inbound');})[_0x75af('0x25')](function(_0x9a435c){if(_0x9a435c){logger[_0x75af('0x31')](_0x75af('0x81'),_0x9a435c['id']);logger[_0x75af('0x31')]('[QUEUE]',_0x75af('0x82'));emit(util[_0x75af('0x5e')]('user:%s',_0x2752cf[_0x75af('0x17')]),_0x75af('0x83'),{'uri':_0x75af('0x84')+_0x5e23e3['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x9a435c['id']});}})[_0x75af('0x27')](function(_0x34e384){logger[_0x75af('0x28')](_0x75af('0x85'),JSON[_0x75af('0xb')](_0x34e384));});};exports[_0x75af('0x86')]=function(_0x4e67c5,_0x184064,_0x27338b,_0x38133e,_0x4bb395,_0x111e33,_0x38444b){var _0x28553c,_0x2e5977,_0x594235;_0x111e33[_0x75af('0x77')]=intUtil[_0x75af('0x78')](_0x111e33[_0x75af('0x77')]);_0x111e33[_0x75af('0x79')]=intUtil[_0x75af('0x78')](_0x111e33['serverUrl']);if(_0x38444b&&_0x38444b['recordingFormat']&&_0x38444b['recordingFormat']!==_0x75af('0x87')){logger[_0x75af('0x31')](_0x75af('0x88'),_0x75af('0x7b'));_0x184064[_0x75af('0x7c')]=_0x111e33['serverUrl']+'/api/voice/recordings/'+_0x184064[_0x75af('0x7d')]+'/downloads?type=uniqueid&token='+md5(_0x184064['uniqueid']);}var _0x3b8b17=_0x111e33[_0x75af('0x77')]===_0x75af('0x89')?'eu':'com';return getAccessToken(_0x111e33)[_0x75af('0x25')](function(_0x26fd1e){_0x594235=_0x26fd1e;return getUser(_0x594235,_0x3b8b17,_0x111e33,_0x38133e[_0x75af('0x30')]);})[_0x75af('0x25')](function(_0x2ae6f5){_0x28553c=_0x2ae6f5;logger[_0x75af('0x31')](_0x75af('0x8a'),_0x28553c['id']);return getEndUser(_0x594235,_0x3b8b17,_0x111e33,_0x184064[_0x75af('0x8b')],_0x184064[_0x75af('0x8c')],_0x28553c,_0x27338b);})['then'](function(_0x9a47f6){_0x2e5977=_0x9a47f6;return getCall(_0x594235,_0x3b8b17,_0x111e33,_0x28553c,_0x2e5977,_0x27338b,_0x184064,_0x75af('0x8d'));})[_0x75af('0x25')](function(_0x39bb65){if(_0x39bb65){logger[_0x75af('0x31')](_0x75af('0x81'),_0x39bb65['id']);logger[_0x75af('0x31')]('[OUTBOUND]',_0x75af('0x82'));emit(util[_0x75af('0x5e')](_0x75af('0x8e'),_0x38133e[_0x75af('0x17')]),_0x75af('0x83'),{'uri':_0x75af('0x84')+_0x111e33[_0x75af('0x77')]+_0x75af('0x8f')+_0x39bb65['id']});}})['catch'](function(_0x2c6428){logger[_0x75af('0x28')](_0x75af('0x88'),JSON[_0x75af('0xb')](_0x2c6428));});};exports[_0x75af('0x90')]=function(_0xdb3193,_0xc8a35c,_0x5cf8db,_0x4ee274,_0x3699dd,_0x3e17bf){var _0x1c7ab2,_0x9161c0,_0x8b6207;_0x3e17bf['host']=intUtil[_0x75af('0x78')](_0x3e17bf['host']);_0x3e17bf[_0x75af('0x79')]=intUtil[_0x75af('0x78')](_0x3e17bf['serverUrl']);if(_0x3699dd&&_0x3699dd[_0x75af('0x7a')]){logger[_0x75af('0x31')]('['+_0xc8a35c[_0x75af('0x91')][_0x75af('0x92')]()+']','Recording\x20is\x20enabled!');_0xc8a35c['recordingURL']=_0x3e17bf[_0x75af('0x79')]+'/api/voice/recordings/'+_0xc8a35c['uniqueid']+_0x75af('0x7e')+md5(_0xc8a35c[_0x75af('0x7d')]);}else{_0xc8a35c[_0x75af('0x7c')]='';}var _0x24e07b=_0x3e17bf[_0x75af('0x77')]===_0x75af('0x89')?'eu':_0x75af('0x7f');return getAccessToken(_0x3e17bf)[_0x75af('0x25')](function(_0x4802a8){_0x8b6207=_0x4802a8;return getUser(_0x8b6207,_0x24e07b,_0x3e17bf);})[_0x75af('0x25')](function(_0x1086db){_0x1c7ab2=_0x1086db;logger[_0x75af('0x31')]('The\x20User\x20ID\x20is:',_0x1c7ab2['id']);return getEndUser(_0x8b6207,_0x24e07b,_0x3e17bf,_0xc8a35c[_0x75af('0x93')],_0xc8a35c[_0x75af('0x80')],_0x1c7ab2,_0x5cf8db);})[_0x75af('0x25')](function(_0x51c3bc){_0x9161c0=_0x51c3bc;return getCall(_0x8b6207,_0x24e07b,_0x3e17bf,_0x1c7ab2,_0x9161c0,_0x5cf8db,_0xc8a35c,_0x75af('0x70'));})[_0x75af('0x25')](function(_0x32b819){if(_0x32b819){logger[_0x75af('0x31')](_0x75af('0x81'),_0x32b819['id']);}})[_0x75af('0x27')](function(_0x99164d){logger[_0x75af('0x28')]('['+_0xc8a35c[_0x75af('0x91')][_0x75af('0x92')]()+']',JSON[_0x75af('0xb')](_0x99164d));});}; \ 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 dde8658..ede210b 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 _0x8ef3=['data2','Script','render','data3','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','exec'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8ef3,0x7c));var _0x38ef=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x8ef3[_0x3bf83f];return _0x22c4a9;};'use strict';var util=require(_0x38ef('0x0'));var sh=require(_0x38ef('0x1'));var Mustache=require(_0x38ef('0x2'));var logger=require(_0x38ef('0x3'))(_0x38ef('0x4'));exports[_0x38ef('0x5')]=function(_0x517efd,_0x46d77b){var _0x1aa33e=_0x517efd[_0x38ef('0x6')]?_0x517efd[_0x38ef('0x6')]:_0x38ef('0x7');var _0x2a7cc1=_0x517efd['data3']?Mustache[_0x38ef('0x8')](_0x517efd[_0x38ef('0x9')],_0x46d77b):_0x46d77b;sh['exec'](_0x2a7cc1,function(_0x810e7b,_0x2a4532,_0x3ac9aa){if(_0x810e7b!==0x0){logger['error'](util[_0x38ef('0xa')](_0x38ef('0xb'),_0x1aa33e,_0x2a7cc1,_0x810e7b,_0x3ac9aa));}else{logger['info'](util[_0x38ef('0xa')](_0x38ef('0xc'),_0x1aa33e,_0x2a7cc1,_0x2a4532));}});}; \ No newline at end of file +var _0x26f4=['trigger','exec','data2','Script','data3','render','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format','shelljs','mustache','../../../../config/logger'];(function(_0x19ecb5,_0x8fc0b9){var _0x4f2ae3=function(_0x2d358a){while(--_0x2d358a){_0x19ecb5['push'](_0x19ecb5['shift']());}};_0x4f2ae3(++_0x8fc0b9);}(_0x26f4,0x1aa));var _0x426f=function(_0x9f4475,_0x1d734e){_0x9f4475=_0x9f4475-0x0;var _0x495cb1=_0x26f4[_0x9f4475];return _0x495cb1;};'use strict';var util=require('util');var sh=require(_0x426f('0x0'));var Mustache=require(_0x426f('0x1'));var logger=require(_0x426f('0x2'))(_0x426f('0x3'));exports[_0x426f('0x4')]=function(_0x4fcea6,_0x204e4a){var _0x1e9cc6=_0x4fcea6[_0x426f('0x5')]?_0x4fcea6[_0x426f('0x5')]:_0x426f('0x6');var _0x468ef5=_0x4fcea6[_0x426f('0x7')]?Mustache[_0x426f('0x8')](_0x4fcea6['data3'],_0x204e4a):_0x204e4a;sh['exec'](_0x468ef5,function(_0x4d1a15,_0x19ac8f,_0x2b17cc){if(_0x4d1a15!==0x0){logger[_0x426f('0x9')](util['format'](_0x426f('0xa'),_0x1e9cc6,_0x468ef5,_0x4d1a15,_0x2b17cc));}else{logger[_0x426f('0xb')](util[_0x426f('0xc')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x1e9cc6,_0x468ef5,_0x19ac8f));}});}; \ 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 6fdc1fd..24479fb 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 _0x134f=['render','data2','data5','number','headers','parse','stack','GET','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then',',\x20request\x20body:\x20','object','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase'];(function(_0x182265,_0x5a6140){var _0x18b8df=function(_0x6771de){while(--_0x6771de){_0x182265['push'](_0x182265['shift']());}};_0x18b8df(++_0x5a6140);}(_0x134f,0xa6));var _0xf134=function(_0x5c2daa,_0x307bd8){_0x5c2daa=_0x5c2daa-0x0;var _0x31839a=_0x134f[_0x5c2daa];return _0x31839a;};'use strict';var rp=require(_0xf134('0x0'));var util=require(_0xf134('0x1'));var _=require(_0xf134('0x2'));var Mustache=require(_0xf134('0x3'));var logger=require(_0xf134('0x4'))(_0xf134('0x5'));exports[_0xf134('0x6')]=function(_0x276b1f,_0x188dff){var _0x43eb00,_0x71494a;var _0xc161ea={'method':_0x276b1f[_0xf134('0x7')][_0xf134('0x8')](),'uri':Mustache[_0xf134('0x9')](_0x276b1f[_0xf134('0xa')],_0x188dff),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x276b1f[_0xf134('0xb')])===_0xf134('0xc')&&parseInt(_0x276b1f[_0xf134('0xb')])>=0x1&&parseInt(_0x276b1f[_0xf134('0xb')])<=0xa?parseInt(_0x276b1f[_0xf134('0xb')])*0x3e8:0x5*0x3e8};try{_0xc161ea[_0xf134('0xd')]=_0x276b1f['data6']?JSON[_0xf134('0xe')](Mustache[_0xf134('0x9')](_0x276b1f['data6'],_0x188dff)):{};}catch(_0x2b8ce0){logger['error'](_0x2b8ce0[_0xf134('0xf')]);}switch(_0x276b1f['data1'][_0xf134('0x8')]()){case _0xf134('0x10'):case'DELETE':_0x43eb00=null;_0xc161ea['qs']=_0x188dff;break;case _0xf134('0x11'):case _0xf134('0x12'):if(_0x276b1f['data7']){try{_0x43eb00=JSON[_0xf134('0xe')](Mustache[_0xf134('0x9')](_0x276b1f[_0xf134('0x13')],_0x188dff));_0xc161ea[_0xf134('0x14')]=_0x43eb00;}catch(_0x547828){logger[_0xf134('0x15')](_0x547828[_0xf134('0xf')]);logger[_0xf134('0x15')](_0xf134('0x16'));}}else{_0x43eb00=_0x188dff;_0xc161ea[_0xf134('0x14')]=_0x43eb00;}break;}logger[_0xf134('0x17')](util['format'](_0xf134('0x18'),_0x276b1f['data1'],_0x276b1f[_0xf134('0xa')],JSON[_0xf134('0x19')](_0xc161ea)));rp(_0xc161ea)[_0xf134('0x1a')](function(_0x5eea79){_0x43eb00=!_['isNil'](_0x43eb00)?_0xf134('0x1b')+_0x43eb00:'';_0x71494a=typeof _0x5eea79[_0xf134('0x14')]===_0xf134('0x1c')?JSON[_0xf134('0x19')](_0x5eea79[_0xf134('0x14')]):_0x5eea79[_0xf134('0x14')];logger[_0xf134('0x17')](util[_0xf134('0x1d')](_0xf134('0x1e'),_0x276b1f['data1'],_0x276b1f[_0xf134('0xa')],_0x5eea79[_0xf134('0x1f')],_0x71494a));})['catch'](function(_0x3aaba3){logger[_0xf134('0x15')](util[_0xf134('0x1d')](_0xf134('0x20'),_0x276b1f[_0xf134('0x7')],_0x276b1f[_0xf134('0xa')],_0x3aaba3[_0xf134('0x1f')],_0x3aaba3[_0xf134('0x21')],_0x3aaba3[_0xf134('0x22')]));});}; \ No newline at end of file +var _0x8086=['error','DELETE','POST','PUT','data7','parse','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','isNil','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','util','lodash','mustache','exec','data1','toUpperCase','render','data2','data5','number','headers','data6'];(function(_0x132646,_0x773860){var _0xcf5ad2=function(_0x1b4007){while(--_0x1b4007){_0x132646['push'](_0x132646['shift']());}};_0xcf5ad2(++_0x773860);}(_0x8086,0x1a6));var _0x6808=function(_0x18854a,_0x54b714){_0x18854a=_0x18854a-0x0;var _0x1b0831=_0x8086[_0x18854a];return _0x1b0831;};'use strict';var rp=require('request-promise');var util=require(_0x6808('0x0'));var _=require(_0x6808('0x1'));var Mustache=require(_0x6808('0x2'));var logger=require('../../../../config/logger')('trigger');exports[_0x6808('0x3')]=function(_0x40d552,_0x428056){var _0x1e116f,_0x5e5960;var _0x511d73={'method':_0x40d552[_0x6808('0x4')][_0x6808('0x5')](),'uri':Mustache[_0x6808('0x6')](_0x40d552[_0x6808('0x7')],_0x428056),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x40d552[_0x6808('0x8')])===_0x6808('0x9')&&parseInt(_0x40d552[_0x6808('0x8')])>=0x1&&parseInt(_0x40d552[_0x6808('0x8')])<=0xa?parseInt(_0x40d552[_0x6808('0x8')])*0x3e8:0x5*0x3e8};try{_0x511d73[_0x6808('0xa')]=_0x40d552[_0x6808('0xb')]?JSON['parse'](Mustache['render'](_0x40d552[_0x6808('0xb')],_0x428056)):{};}catch(_0x2469bf){logger[_0x6808('0xc')](_0x2469bf['stack']);}switch(_0x40d552[_0x6808('0x4')][_0x6808('0x5')]()){case'GET':case _0x6808('0xd'):_0x1e116f=null;_0x511d73['qs']=_0x428056;break;case _0x6808('0xe'):case _0x6808('0xf'):if(_0x40d552[_0x6808('0x10')]){try{_0x1e116f=JSON[_0x6808('0x11')](Mustache[_0x6808('0x6')](_0x40d552[_0x6808('0x10')],_0x428056));_0x511d73[_0x6808('0x12')]=_0x1e116f;}catch(_0x34670b){logger[_0x6808('0xc')](_0x34670b['stack']);logger[_0x6808('0xc')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x1e116f=_0x428056;_0x511d73[_0x6808('0x12')]=_0x1e116f;}break;}logger[_0x6808('0x13')](util[_0x6808('0x14')](_0x6808('0x15'),_0x40d552[_0x6808('0x4')],_0x40d552['data2'],JSON[_0x6808('0x16')](_0x511d73)));rp(_0x511d73)['then'](function(_0x8740e2){_0x1e116f=!_[_0x6808('0x17')](_0x1e116f)?',\x20request\x20body:\x20'+_0x1e116f:'';_0x5e5960=typeof _0x8740e2[_0x6808('0x12')]===_0x6808('0x18')?JSON['stringify'](_0x8740e2['body']):_0x8740e2['body'];logger['info'](util[_0x6808('0x14')](_0x6808('0x19'),_0x40d552[_0x6808('0x4')],_0x40d552[_0x6808('0x7')],_0x8740e2[_0x6808('0x1a')],_0x5e5960));})[_0x6808('0x1b')](function(_0xe69085){logger[_0x6808('0xc')](util[_0x6808('0x14')](_0x6808('0x1c'),_0x40d552['data1'],_0x40d552['data2'],_0xe69085[_0x6808('0x1a')],_0xe69085[_0x6808('0x1d')],_0xe69085[_0x6808('0x1e')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 6518dcb..25e9886 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 _0x3a7d=['message','result','exports','../../config/logger','routing','http','request','rpc','error'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x3a7d,0x108));var _0xd3a7=function(_0x162f44,_0x2b0eb3){_0x162f44=_0x162f44-0x0;var _0x510bae=_0x3a7d[_0x162f44];return _0x510bae;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0xd3a7('0x0'))(_0xd3a7('0x1'));var client=jayson['client'][_0xd3a7('0x2')]({'port':0x2329});client['Request']=function(_0x361c64,_0x16d836){return new BPromise(function(_0xc0b65,_0x1c4f5f){return client[_0xd3a7('0x3')](_0x361c64,_0x16d836)['then'](function(_0x4b08bf){logger['debug'](_0xd3a7('0x4'),_0xd3a7('0x1'),_0x361c64,_0x16d836,_0x4b08bf);if(_0x4b08bf[_0xd3a7('0x5')]){logger[_0xd3a7('0x5')]('rpc','routing',_0x361c64,_0x4b08bf[_0xd3a7('0x5')][_0xd3a7('0x6')],_0x16d836);return _0x1c4f5f(_0x4b08bf['error'][_0xd3a7('0x6')]);}else{return _0xc0b65(_0x4b08bf[_0xd3a7('0x7')]);}})['catch'](function(_0x2e8f60){logger[_0xd3a7('0x5')](_0xd3a7('0x4'),_0xd3a7('0x1'),_0x361c64,_0x2e8f60,_0x16d836);return _0x1c4f5f(_0x2e8f60);});});};module[_0xd3a7('0x8')]=client; \ No newline at end of file +var _0xf9cb=['bluebird','client','Request','request','then','rpc','routing','error','message','result','catch','exports','jayson/promise'];(function(_0x53a390,_0x1c4aec){var _0x39e4d8=function(_0x42b900){while(--_0x42b900){_0x53a390['push'](_0x53a390['shift']());}};_0x39e4d8(++_0x1c4aec);}(_0xf9cb,0xa8));var _0xbf9c=function(_0x4ded65,_0xc8d7c1){_0x4ded65=_0x4ded65-0x0;var _0x5864fb=_0xf9cb[_0x4ded65];return _0x5864fb;};'use strict';var jayson=require(_0xbf9c('0x0'));var BPromise=require(_0xbf9c('0x1'));var logger=require('../../config/logger')('routing');var client=jayson[_0xbf9c('0x2')]['http']({'port':0x2329});client[_0xbf9c('0x3')]=function(_0x347947,_0x4ad126){return new BPromise(function(_0x38ed8e,_0x16d4b8){return client[_0xbf9c('0x4')](_0x347947,_0x4ad126)[_0xbf9c('0x5')](function(_0x1b99aa){logger['debug'](_0xbf9c('0x6'),_0xbf9c('0x7'),_0x347947,_0x4ad126,_0x1b99aa);if(_0x1b99aa[_0xbf9c('0x8')]){logger[_0xbf9c('0x8')](_0xbf9c('0x6'),_0xbf9c('0x7'),_0x347947,_0x1b99aa[_0xbf9c('0x8')][_0xbf9c('0x9')],_0x4ad126);return _0x16d4b8(_0x1b99aa[_0xbf9c('0x8')][_0xbf9c('0x9')]);}else{return _0x38ed8e(_0x1b99aa[_0xbf9c('0xa')]);}})[_0xbf9c('0xb')](function(_0x44d3f9){logger['error'](_0xbf9c('0x6'),_0xbf9c('0x7'),_0x347947,_0x44d3f9,_0x4ad126);return _0x16d4b8(_0x44d3f9);});});};module[_0xbf9c('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index c7c1c0b..26243fa 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 _0x1f53=['Email\x20service\x20initialization','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','error'];(function(_0x3640e2,_0x562103){var _0x277415=function(_0x1b2c89){while(--_0x1b2c89){_0x3640e2['push'](_0x3640e2['shift']());}};_0x277415(++_0x562103);}(_0x1f53,0x1bb));var _0x31f5=function(_0xd9a0ad,_0x202e71){_0xd9a0ad=_0xd9a0ad-0x0;var _0x84eea6=_0x1f53[_0xd9a0ad];return _0x84eea6;};'use strict';var server=require('./server');var Realtime=require(_0x31f5('0x0'));var EmailChannel=require(_0x31f5('0x1'));var mailAccount=require(_0x31f5('0x2'));var setting=require(_0x31f5('0x3'));var logger=require(_0x31f5('0x4'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x31f5('0x5')]()[_0x31f5('0x6')](mailAccount[_0x31f5('0x7')]())[_0x31f5('0x6')](realtime[_0x31f5('0x8')]())[_0x31f5('0x6')](function(){email[_0x31f5('0x9')](realtime[_0x31f5('0xa')]);return realtime;});}function main(){return server[_0x31f5('0xb')](realtime,email)[_0x31f5('0x6')](function(){return initRealtime();})[_0x31f5('0x6')](function(){return setting[_0x31f5('0xc')]();})[_0x31f5('0x6')](function(_0x465145){return setInterval(initRealtime,_0x465145[_0x31f5('0xd')]*0x3e8);})[_0x31f5('0xe')](function(_0x385ccb){logger[_0x31f5('0xf')](_0x31f5('0x10'),_0x385ccb);});}main(); \ No newline at end of file +var _0x3f6a=['error','Email\x20service\x20initialization','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','getSettings','loginMailFrequency'];(function(_0x3e863b,_0x487759){var _0x52d896=function(_0x11da2b){while(--_0x11da2b){_0x3e863b['push'](_0x3e863b['shift']());}};_0x52d896(++_0x487759);}(_0x3f6a,0x1c4));var _0xa3f6=function(_0x40b7ea,_0x550490){_0x40b7ea=_0x40b7ea-0x0;var _0x2627ec=_0x3f6a[_0x40b7ea];return _0x2627ec;};'use strict';var server=require('./server');var Realtime=require(_0xa3f6('0x0'));var EmailChannel=require(_0xa3f6('0x1'));var mailAccount=require(_0xa3f6('0x2'));var setting=require(_0xa3f6('0x3'));var logger=require(_0xa3f6('0x4'))(_0xa3f6('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0xa3f6('0x6')](mailAccount[_0xa3f6('0x7')]())[_0xa3f6('0x6')](realtime[_0xa3f6('0x8')]())[_0xa3f6('0x6')](function(){email[_0xa3f6('0x9')](realtime[_0xa3f6('0xa')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0xa3f6('0x6')](function(){return initRealtime();})[_0xa3f6('0x6')](function(){return setting[_0xa3f6('0xb')]();})[_0xa3f6('0x6')](function(_0x70b2c4){return setInterval(initRealtime,_0x70b2c4[_0xa3f6('0xc')]*0x3e8);})['catch'](function(_0x2b3895){logger[_0xa3f6('0xd')](_0xa3f6('0xe'),_0x2b3895);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index ec34db1..cfcc006 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 _0xc7d1=['email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','name','key','active','Imap','status','messageStatus','total','isNil','stringify','emit','mailAccount:update','prototype','hasOwnProperty','service','provider','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','handleImapError','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','send','verifySmtp','Smtp','lastSync','verify','verified','exports','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger'];(function(_0xe6e78c,_0x582369){var _0x2a09c8=function(_0x470ccc){while(--_0x470ccc){_0xe6e78c['push'](_0xe6e78c['shift']());}};_0x2a09c8(++_0x582369);}(_0xc7d1,0x1da));var _0x1c7d=function(_0x4905a9,_0x206549){_0x4905a9=_0x4905a9-0x0;var _0x5bfcf5=_0xc7d1[_0x4905a9];return _0x5bfcf5;};'use strict';var _=require('lodash');var moment=require(_0x1c7d('0x0'));var BPromise=require(_0x1c7d('0x1'));var md5=require(_0x1c7d('0x2'));var Redis=require(_0x1c7d('0x3'));var config=require(_0x1c7d('0x4'));var logger=require(_0x1c7d('0x5'))(_0x1c7d('0x6'));config[_0x1c7d('0x7')]=_[_0x1c7d('0x8')](config[_0x1c7d('0x7')],{'host':_0x1c7d('0x9'),'port':0x18eb});var io=require(_0x1c7d('0xa'))(new Redis(config[_0x1c7d('0x7')]));var EmailImap=require(_0x1c7d('0xb'));var EmailSmtp=require(_0x1c7d('0xc'));var mailAccount=require(_0x1c7d('0xd'));var md5Accounts={};function EmailChannel(_0x394893){logger[_0x1c7d('0xe')]('start\x20email\x20channel');this[_0x1c7d('0xf')]=_0x394893[_0x1c7d('0xf')];this[_0x1c7d('0x10')]={};this[_0x1c7d('0x11')]=new EmailSmtp();}EmailChannel['prototype']['emit']=function(_0xb7c6d8){var _0x3059e3=this[_0x1c7d('0xf')][_0xb7c6d8];var _0x18fe68={'id':_0x3059e3['id'],'name':_0x3059e3[_0x1c7d('0x12')],'key':_0x3059e3[_0x1c7d('0x13')],'active':_0x3059e3[_0x1c7d('0x14')],'Imap':{'status':_0x3059e3[_0x1c7d('0x15')][_0x1c7d('0x16')],'messageStatus':_0x3059e3['Imap'][_0x1c7d('0x17')],'total':_0x3059e3[_0x1c7d('0x15')][_0x1c7d('0x18')]}};if(_[_0x1c7d('0x19')](md5Accounts[_0xb7c6d8])){md5Accounts[_0xb7c6d8]={};}var _0xa54205=md5(JSON[_0x1c7d('0x1a')](_0x18fe68));if(md5Accounts[_0xb7c6d8][_0x1c7d('0x2')]!==_0xa54205){md5Accounts[_0xb7c6d8][_0x1c7d('0x2')]=_0xa54205;io[_0x1c7d('0x1b')](_0x1c7d('0x1c'),_0x18fe68);}};EmailChannel[_0x1c7d('0x1d')]['refresh']=function(_0x13850e){for(var _0x4acc68 in _0x13850e){if(_0x13850e[_0x1c7d('0x1e')](_0x4acc68)){if(_0x13850e[_0x4acc68][_0x1c7d('0x15')]&&_0x13850e[_0x4acc68][_0x1c7d('0x14')]){var _0x432705=_0x13850e[_0x4acc68][_0x1c7d('0x15')];if(!_0x432705[_0x1c7d('0x1f')]&&_0x13850e[_0x4acc68][_0x1c7d('0x20')]!=='custom')_0x432705[_0x1c7d('0x1f')]=_0x13850e[_0x4acc68]['provider'];if(!this[_0x1c7d('0x10')][_0x1c7d('0x1e')](_0x432705['id'])){this['imapAccounts'][_0x432705['id']]=new EmailImap(_0x432705,_0x13850e[_0x4acc68]['email']);this[_0x1c7d('0x10')][_0x432705['id']]['on'](_0x1c7d('0x21'),this[_0x1c7d('0x22')][_0x1c7d('0x23')](this,_0x4acc68));this['imapAccounts'][_0x432705['id']]['on'](_0x1c7d('0x6'),this[_0x1c7d('0x24')][_0x1c7d('0x23')](this,_0x4acc68));this[_0x1c7d('0x10')][_0x432705['id']]['on'](_0x1c7d('0x25'),this[_0x1c7d('0x26')]['bind'](this,_0x4acc68));this[_0x1c7d('0x10')][_0x432705['id']]['on']('error',this[_0x1c7d('0x27')]['bind'](this,_0x4acc68));}}else{if(_['isNil'](this[_0x1c7d('0xf')][_0x4acc68]['Imap'])){this[_0x1c7d('0xf')][_0x4acc68]['Imap']={};}this[_0x1c7d('0xf')][_0x4acc68][_0x1c7d('0x15')][_0x1c7d('0x16')]='disabled';this[_0x1c7d('0xf')][_0x4acc68]['Imap'][_0x1c7d('0x17')]='';this[_0x1c7d('0x1b')](_0x4acc68);}}}};EmailChannel['prototype'][_0x1c7d('0x22')]=function(_0x4a09e9,_0x236f52){if(this[_0x1c7d('0xf')][_0x4a09e9]){this[_0x1c7d('0xf')][_0x4a09e9][_0x1c7d('0x15')]['status']=_0x1c7d('0x28');this[_0x1c7d('0xf')][_0x4a09e9][_0x1c7d('0x15')]['messageStatus']=_0x236f52[_0x1c7d('0x12')];if(_0x236f52[_0x1c7d('0x29')]){this[_0x1c7d('0xf')][_0x4a09e9][_0x1c7d('0x15')][_0x1c7d('0x18')]=_0x236f52['messages'][_0x1c7d('0x18')];}return this[_0x1c7d('0x1b')](_0x4a09e9);}};EmailChannel['prototype'][_0x1c7d('0x24')]=function(_0x21cf52,_0x18f22c){logger['info'](_0x1c7d('0x2a'),_0x18f22c[_0x1c7d('0x2b')],_0x18f22c[_0x1c7d('0x2c')],_0x18f22c[_0x1c7d('0x2d')],_0x21cf52);if(this[_0x1c7d('0xf')][_0x21cf52]){return mailAccount[_0x1c7d('0x2e')](_0x21cf52,_0x18f22c)[_0x1c7d('0x2f')](function(_0x31ef7b){if(_0x31ef7b){logger[_0x1c7d('0xe')](_0x1c7d('0x30'));}})[_0x1c7d('0x31')](function(_0x2e4cbe){logger[_0x1c7d('0x32')](_0x1c7d('0x33'),JSON[_0x1c7d('0x1a')](_0x2e4cbe));});}};EmailChannel[_0x1c7d('0x1d')][_0x1c7d('0x26')]=function(_0x144c98){if(this[_0x1c7d('0xf')][_0x144c98]&&this['mailAccounts'][_0x144c98]['Imap']){if(this[_0x1c7d('0x10')][this['mailAccounts'][_0x144c98][_0x1c7d('0x15')]['id']]){delete this['imapAccounts'][this[_0x1c7d('0xf')][_0x144c98][_0x1c7d('0x15')]['id']];}this[_0x1c7d('0xf')][_0x144c98]['Imap']['lastSync']=moment();this[_0x1c7d('0x1b')](_0x144c98);}};EmailChannel[_0x1c7d('0x1d')][_0x1c7d('0x27')]=function(_0x263273,_0x45ca49){if(this[_0x1c7d('0xf')][_0x263273]){this['mailAccounts'][_0x263273][_0x1c7d('0x15')][_0x1c7d('0x16')]=_0x1c7d('0x32');this['mailAccounts'][_0x263273][_0x1c7d('0x15')]['messageStatus']=_0x45ca49;return this[_0x1c7d('0x1b')](_0x263273);}};EmailChannel[_0x1c7d('0x1d')][_0x1c7d('0x34')]=function(_0x3fe886,_0x5ef7b1){return this[_0x1c7d('0x11')][_0x1c7d('0x35')](_0x3fe886,_0x5ef7b1);};EmailChannel['prototype'][_0x1c7d('0x36')]=function(_0x180019){var _0x2b5578=this;if(this[_0x1c7d('0xf')][_0x180019['id']]){if(_['isNil'](this[_0x1c7d('0xf')][_0x180019['id']]['Smtp'])){this[_0x1c7d('0xf')][_0x180019['id']][_0x1c7d('0x37')]={};}this['mailAccounts'][_0x180019['id']][_0x1c7d('0x37')][_0x1c7d('0x38')]=moment();return new BPromise(function(_0x440f1e,_0x5c655c){return _0x2b5578[_0x1c7d('0x11')][_0x1c7d('0x39')](_0x180019)[_0x1c7d('0x2f')](function(_0x306a06){_0x2b5578[_0x1c7d('0xf')][_0x180019['id']][_0x1c7d('0x37')][_0x1c7d('0x16')]=_0x1c7d('0x3a');_0x2b5578[_0x1c7d('0xf')][_0x180019['id']]['Smtp'][_0x1c7d('0x17')]='';_0x2b5578['emit'](_0x180019['id']);_0x440f1e(_0x306a06);})['catch'](function(_0x2a6b9c){_0x2b5578[_0x1c7d('0xf')][_0x180019['id']]['Smtp'][_0x1c7d('0x16')]=_0x1c7d('0x32');_0x2b5578[_0x1c7d('0xf')][_0x180019['id']]['Smtp']['messageStatus']=_0x2a6b9c;_0x2b5578[_0x1c7d('0x1b')](_0x180019['id']);_0x5c655c(_0x2a6b9c);});});}return this[_0x1c7d('0x11')][_0x1c7d('0x39')](_0x180019);};module[_0x1c7d('0x3b')]=EmailChannel; \ No newline at end of file +var _0x22b8=['total','isNil','stringify','md5','mailAccount:update','refresh','hasOwnProperty','service','custom','provider','handleImapBox','handleImapEnd','bind','error','disabled','messages','firstName','lastName','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','Smtp','verify','then','verified','catch','exports','lodash','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','email','redis','localhost','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus'];(function(_0x1c3e2f,_0x14f882){var _0x36e8a7=function(_0x533d4f){while(--_0x533d4f){_0x1c3e2f['push'](_0x1c3e2f['shift']());}};_0x36e8a7(++_0x14f882);}(_0x22b8,0x1f0));var _0x822b=function(_0x131050,_0x3aa020){_0x131050=_0x131050-0x0;var _0x4e9e65=_0x22b8[_0x131050];return _0x4e9e65;};'use strict';var _=require(_0x822b('0x0'));var moment=require(_0x822b('0x1'));var BPromise=require(_0x822b('0x2'));var md5=require('md5');var Redis=require(_0x822b('0x3'));var config=require(_0x822b('0x4'));var logger=require(_0x822b('0x5'))(_0x822b('0x6'));config[_0x822b('0x7')]=_['defaults'](config['redis'],{'host':_0x822b('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x822b('0x7')]));var EmailImap=require(_0x822b('0x9'));var EmailSmtp=require(_0x822b('0xa'));var mailAccount=require(_0x822b('0xb'));var md5Accounts={};function EmailChannel(_0x5c0021){logger[_0x822b('0xc')]('start\x20email\x20channel');this[_0x822b('0xd')]=_0x5c0021[_0x822b('0xd')];this[_0x822b('0xe')]={};this[_0x822b('0xf')]=new EmailSmtp();}EmailChannel[_0x822b('0x10')][_0x822b('0x11')]=function(_0x369a98){var _0x3197f0=this[_0x822b('0xd')][_0x369a98];var _0x1e42f8={'id':_0x3197f0['id'],'name':_0x3197f0[_0x822b('0x12')],'key':_0x3197f0[_0x822b('0x13')],'active':_0x3197f0[_0x822b('0x14')],'Imap':{'status':_0x3197f0[_0x822b('0x15')][_0x822b('0x16')],'messageStatus':_0x3197f0['Imap'][_0x822b('0x17')],'total':_0x3197f0['Imap'][_0x822b('0x18')]}};if(_[_0x822b('0x19')](md5Accounts[_0x369a98])){md5Accounts[_0x369a98]={};}var _0x1eb0a4=md5(JSON[_0x822b('0x1a')](_0x1e42f8));if(md5Accounts[_0x369a98][_0x822b('0x1b')]!==_0x1eb0a4){md5Accounts[_0x369a98][_0x822b('0x1b')]=_0x1eb0a4;io[_0x822b('0x11')](_0x822b('0x1c'),_0x1e42f8);}};EmailChannel['prototype'][_0x822b('0x1d')]=function(_0x2f88d3){for(var _0x461a97 in _0x2f88d3){if(_0x2f88d3[_0x822b('0x1e')](_0x461a97)){if(_0x2f88d3[_0x461a97][_0x822b('0x15')]&&_0x2f88d3[_0x461a97][_0x822b('0x14')]){var _0x1301b7=_0x2f88d3[_0x461a97]['Imap'];if(!_0x1301b7[_0x822b('0x1f')]&&_0x2f88d3[_0x461a97]['provider']!==_0x822b('0x20'))_0x1301b7[_0x822b('0x1f')]=_0x2f88d3[_0x461a97][_0x822b('0x21')];if(!this['imapAccounts'][_0x822b('0x1e')](_0x1301b7['id'])){this['imapAccounts'][_0x1301b7['id']]=new EmailImap(_0x1301b7,_0x2f88d3[_0x461a97]['email']);this[_0x822b('0xe')][_0x1301b7['id']]['on']('box',this[_0x822b('0x22')]['bind'](this,_0x461a97));this[_0x822b('0xe')][_0x1301b7['id']]['on'](_0x822b('0x6'),this['handleImapEmail']['bind'](this,_0x461a97));this['imapAccounts'][_0x1301b7['id']]['on']('end',this[_0x822b('0x23')][_0x822b('0x24')](this,_0x461a97));this[_0x822b('0xe')][_0x1301b7['id']]['on'](_0x822b('0x25'),this['handleImapError'][_0x822b('0x24')](this,_0x461a97));}}else{if(_[_0x822b('0x19')](this[_0x822b('0xd')][_0x461a97][_0x822b('0x15')])){this[_0x822b('0xd')][_0x461a97][_0x822b('0x15')]={};}this[_0x822b('0xd')][_0x461a97][_0x822b('0x15')][_0x822b('0x16')]=_0x822b('0x26');this[_0x822b('0xd')][_0x461a97]['Imap'][_0x822b('0x17')]='';this[_0x822b('0x11')](_0x461a97);}}}};EmailChannel[_0x822b('0x10')][_0x822b('0x22')]=function(_0x128e5b,_0x26a8fc){if(this[_0x822b('0xd')][_0x128e5b]){this[_0x822b('0xd')][_0x128e5b][_0x822b('0x15')]['status']='connected';this[_0x822b('0xd')][_0x128e5b][_0x822b('0x15')][_0x822b('0x17')]=_0x26a8fc['name'];if(_0x26a8fc[_0x822b('0x27')]){this[_0x822b('0xd')][_0x128e5b][_0x822b('0x15')][_0x822b('0x18')]=_0x26a8fc['messages']['total'];}return this[_0x822b('0x11')](_0x128e5b);}};EmailChannel[_0x822b('0x10')]['handleImapEmail']=function(_0x57504c,_0x33d46b){logger[_0x822b('0xc')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x33d46b[_0x822b('0x28')],_0x33d46b[_0x822b('0x29')],_0x33d46b['from'],_0x57504c);if(this['mailAccounts'][_0x57504c]){return mailAccount['notify'](_0x57504c,_0x33d46b)['then'](function(_0x8b1cd){if(_0x8b1cd){logger[_0x822b('0xc')]('Mail\x20accepted\x20from\x20routing');}})['catch'](function(_0x29712a){logger[_0x822b('0x25')](_0x822b('0x2a'),JSON[_0x822b('0x1a')](_0x29712a));});}};EmailChannel['prototype'][_0x822b('0x23')]=function(_0x26bff5){if(this['mailAccounts'][_0x26bff5]&&this[_0x822b('0xd')][_0x26bff5][_0x822b('0x15')]){if(this[_0x822b('0xe')][this[_0x822b('0xd')][_0x26bff5][_0x822b('0x15')]['id']]){delete this['imapAccounts'][this[_0x822b('0xd')][_0x26bff5][_0x822b('0x15')]['id']];}this['mailAccounts'][_0x26bff5][_0x822b('0x15')][_0x822b('0x2b')]=moment();this['emit'](_0x26bff5);}};EmailChannel[_0x822b('0x10')]['handleImapError']=function(_0x57547a,_0x26e809){if(this['mailAccounts'][_0x57547a]){this[_0x822b('0xd')][_0x57547a][_0x822b('0x15')]['status']=_0x822b('0x25');this[_0x822b('0xd')][_0x57547a]['Imap'][_0x822b('0x17')]=_0x26e809;return this[_0x822b('0x11')](_0x57547a);}};EmailChannel[_0x822b('0x10')][_0x822b('0x2c')]=function(_0x560520,_0x48c05d){return this[_0x822b('0xf')][_0x822b('0x2d')](_0x560520,_0x48c05d);};EmailChannel[_0x822b('0x10')]['verifySmtp']=function(_0x594402){var _0x27b45a=this;if(this[_0x822b('0xd')][_0x594402['id']]){if(_[_0x822b('0x19')](this[_0x822b('0xd')][_0x594402['id']][_0x822b('0x2e')])){this['mailAccounts'][_0x594402['id']][_0x822b('0x2e')]={};}this[_0x822b('0xd')][_0x594402['id']][_0x822b('0x2e')][_0x822b('0x2b')]=moment();return new BPromise(function(_0x11ab1c,_0x498da2){return _0x27b45a[_0x822b('0xf')][_0x822b('0x2f')](_0x594402)[_0x822b('0x30')](function(_0x51d162){_0x27b45a[_0x822b('0xd')][_0x594402['id']][_0x822b('0x2e')]['status']=_0x822b('0x31');_0x27b45a['mailAccounts'][_0x594402['id']][_0x822b('0x2e')][_0x822b('0x17')]='';_0x27b45a['emit'](_0x594402['id']);_0x11ab1c(_0x51d162);})[_0x822b('0x32')](function(_0x5ba828){_0x27b45a[_0x822b('0xd')][_0x594402['id']][_0x822b('0x2e')][_0x822b('0x16')]=_0x822b('0x25');_0x27b45a[_0x822b('0xd')][_0x594402['id']][_0x822b('0x2e')][_0x822b('0x17')]=_0x5ba828;_0x27b45a['emit'](_0x594402['id']);_0x498da2(_0x5ba828);});});}return this['smtp'][_0x822b('0x2f')](_0x594402);};module[_0x822b('0x33')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index a958193..a29f6d2 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 _0xd8fb=['box','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','fetch','message','handleFetchError','handleFetchEnd','closeBox','handleFetchMessage','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleEnd','account','stringify','upperFirst','emit','exports','lodash','util','imap','mailparser','events','EventEmitter','../../../config/logger','email','INBOX','getAccount','once','ready','handleReady','bind','error','connect','inherits','prototype','connTimeout','authTimeout','isNil','authentication','user','password','host','port','tls','required','xoauth2','generateXOAuth2Token','CloudProvider','data5','getHost','service','anonymous@xcally.com','openBox','mailbox','handleOpenBox','handleError'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd8fb,0x99));var _0xbd8f=function(_0x8e00d3,_0x5d02b6){_0x8e00d3=_0x8e00d3-0x0;var _0x13c585=_0xd8fb[_0x8e00d3];return _0x13c585;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var Imap=require(_0xbd8f('0x2'));var simpleParser=require(_0xbd8f('0x3'))['simpleParser'];var Iconv=require('iconv')['Iconv'];var EventEmitter=require(_0xbd8f('0x4'))[_0xbd8f('0x5')];var utils=require('./utils');var logger=require(_0xbd8f('0x6'))(_0xbd8f('0x7'));function EmailImap(_0x5543b2,_0x33d541){this['mailbox']=_0xbd8f('0x8');this['account']=this[_0xbd8f('0x9')](_0x5543b2,_0x33d541);this[_0xbd8f('0x2')]=new Imap(this['account']);this['imap'][_0xbd8f('0xa')](_0xbd8f('0xb'),this[_0xbd8f('0xc')]['bind'](this));this[_0xbd8f('0x2')][_0xbd8f('0xa')]('end',this['handleEnd'][_0xbd8f('0xd')](this));this[_0xbd8f('0x2')]['on'](_0xbd8f('0xe'),this['handleError'][_0xbd8f('0xd')](this));this[_0xbd8f('0x2')][_0xbd8f('0xf')]();}util[_0xbd8f('0x10')](EmailImap,EventEmitter);EmailImap[_0xbd8f('0x11')][_0xbd8f('0x9')]=function(_0x37d4d5,_0x29ffe8){var _0x14606c={'connTimeout':_0x37d4d5['connTimeout']?_0x37d4d5[_0xbd8f('0x12')]*0x3e8:0x2710,'authTimeout':_0x37d4d5[_0xbd8f('0x13')]?_0x37d4d5[_0xbd8f('0x13')]*0x3e8:0x1388};if(_[_0xbd8f('0x14')](_0x37d4d5['service'])){if(_0x37d4d5[_0xbd8f('0x15')]){_0x14606c[_0xbd8f('0x16')]=_0x37d4d5['user'];_0x14606c[_0xbd8f('0x17')]=_0x37d4d5[_0xbd8f('0x17')];}_0x14606c['host']=_0x37d4d5[_0xbd8f('0x18')];_0x14606c[_0xbd8f('0x19')]=_0x37d4d5['port']||0x3e1;if(_0x37d4d5['tls']){_0x14606c[_0xbd8f('0x1a')]=!![];}else{_0x14606c['tls']=![];_0x14606c['autotls']=_0xbd8f('0x1b');}}else{if(_0x37d4d5['modernAuthentication']){_0x14606c[_0xbd8f('0x1c')]=utils[_0xbd8f('0x1d')](_0x37d4d5[_0xbd8f('0x1e')][_0xbd8f('0x1f')],_0x37d4d5[_0xbd8f('0x16')]);_0x14606c[_0xbd8f('0x16')]=_0x37d4d5[_0xbd8f('0x16')];}else{_0x14606c[_0xbd8f('0x16')]=_0x37d4d5[_0xbd8f('0x16')];_0x14606c[_0xbd8f('0x17')]=_0x37d4d5[_0xbd8f('0x17')];}_0x14606c[_0xbd8f('0x18')]=utils[_0xbd8f('0x20')](_0x37d4d5[_0xbd8f('0x21')]);_0x14606c[_0xbd8f('0x19')]=0x3e1;_0x14606c[_0xbd8f('0x1a')]=!![];}_0x14606c[_0xbd8f('0x7')]=_0x29ffe8||_0x37d4d5['user']||_0xbd8f('0x22');return _0x14606c;};EmailImap[_0xbd8f('0x11')][_0xbd8f('0xc')]=function(){this[_0xbd8f('0x2')][_0xbd8f('0x23')](this[_0xbd8f('0x24')],![],this[_0xbd8f('0x25')][_0xbd8f('0xd')](this));};EmailImap['prototype'][_0xbd8f('0x25')]=function(_0x421f3e,_0x5a3a8c){if(_0x421f3e){this[_0xbd8f('0x26')](_0x421f3e,!![]);}else{this['emit'](_0xbd8f('0x27'),_0x5a3a8c);this[_0xbd8f('0x28')]();}};EmailImap[_0xbd8f('0x11')][_0xbd8f('0x29')]=function(_0x2aefa2){if(_0x2aefa2){this[_0xbd8f('0x26')](_0x2aefa2,!![]);}else{this['imap'][_0xbd8f('0x2a')]();}};EmailImap[_0xbd8f('0x11')][_0xbd8f('0x28')]=function(){this[_0xbd8f('0x2')][_0xbd8f('0x2b')]([_0xbd8f('0x2c')],this[_0xbd8f('0x2d')]['bind'](this));};EmailImap[_0xbd8f('0x11')][_0xbd8f('0x2d')]=function(_0xb9214c,_0x7ca145){if(_0xb9214c){this['handleError'](_0xb9214c,!![]);}else{if(_0x7ca145['length']){try{var _0x1c2274=this[_0xbd8f('0x2')][_0xbd8f('0x2e')](_0x7ca145,{'bodies':'','markSeen':!![]});_0x1c2274['on'](_0xbd8f('0x2f'),this['handleFetchMessage'][_0xbd8f('0xd')](this));_0x1c2274[_0xbd8f('0xa')](_0xbd8f('0xe'),this[_0xbd8f('0x30')][_0xbd8f('0xd')](this));_0x1c2274['once'](_0xbd8f('0x2a'),this[_0xbd8f('0x31')][_0xbd8f('0xd')](this));}catch(_0x3949c2){logger[_0xbd8f('0xe')](_0x3949c2);}}else{this['imap'][_0xbd8f('0x32')](!![],this['handleCloseBox'][_0xbd8f('0xd')](this));}}};EmailImap[_0xbd8f('0x11')][_0xbd8f('0x33')]=function(_0x386a29){_0x386a29['on'](_0xbd8f('0x34'),this[_0xbd8f('0x35')]['bind'](this));_0x386a29['once']('attributes',this[_0xbd8f('0x36')][_0xbd8f('0xd')](this));_0x386a29[_0xbd8f('0xa')](_0xbd8f('0x2a'),this[_0xbd8f('0x37')][_0xbd8f('0xd')](this));};EmailImap[_0xbd8f('0x11')][_0xbd8f('0x35')]=function(_0x2d4882){simpleParser(_0x2d4882,{'Iconv':Iconv},this[_0xbd8f('0x38')][_0xbd8f('0xd')](this));};EmailImap[_0xbd8f('0x11')][_0xbd8f('0x36')]=function(){};EmailImap[_0xbd8f('0x11')][_0xbd8f('0x37')]=function(){};EmailImap['prototype'][_0xbd8f('0x38')]=function(_0x4181e0,_0x47f9cd){if(_0x4181e0){logger[_0xbd8f('0xe')](_0x4181e0);}else{var _0x40204a=this;utils[_0xbd8f('0x39')](this['account'],_0x47f9cd,function(_0x21da54){_0x40204a['emit'](_0xbd8f('0x7'),_0x21da54);});}};EmailImap[_0xbd8f('0x11')][_0xbd8f('0x31')]=function(){this['imap'][_0xbd8f('0x32')](!![],this[_0xbd8f('0x29')][_0xbd8f('0xd')](this));};EmailImap['prototype'][_0xbd8f('0x30')]=function(_0x3d82ef){this[_0xbd8f('0x26')](_0x3d82ef);this[_0xbd8f('0x2')][_0xbd8f('0x32')](!![],this[_0xbd8f('0x29')][_0xbd8f('0xd')](this));};EmailImap[_0xbd8f('0x11')][_0xbd8f('0x3a')]=function(){this['emit']('end');};EmailImap[_0xbd8f('0x11')][_0xbd8f('0x26')]=function(_0x353e34,_0x2f014b){logger['error'](_0xbd8f('0x26'),this[_0xbd8f('0x3b')][_0xbd8f('0x7')],JSON[_0xbd8f('0x3c')](_0x353e34));var _0x753f0='';if(_0x353e34){if(_0x353e34['textCode']){_0x753f0=_0x353e34['textCode'];}else{for(var _0x44776c in _0x353e34){if(_0x353e34['hasOwnProperty'](_0x44776c)){_0x753f0+=_[_0xbd8f('0x3d')](_0x44776c)+':\x20'+_0x353e34[_0x44776c]+'\x0a';}}}}if(_0x2f014b){this[_0xbd8f('0x2')][_0xbd8f('0x2a')]();}else{this[_0xbd8f('0x3e')](_0xbd8f('0xe'),_0x753f0);this[_0xbd8f('0x3e')](_0xbd8f('0x2a'));}};module[_0xbd8f('0x3f')]=EmailImap; \ No newline at end of file +var _0x4819=['host','getHost','anonymous@xcally.com','openBox','handleOpenBox','emit','readUnseen','handleCloseBox','search','handleReadUnseen','fetch','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','parser','email','stringify','textCode','upperFirst','util','imap','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','INBOX','account','getAccount','once','handleReady','end','handleEnd','bind','error','handleError','inherits','prototype','connTimeout','authTimeout','service','user','password','port','tls','autotls','required','modernAuthentication','xoauth2','CloudProvider','data5'];(function(_0x146ee9,_0x19befe){var _0x60b23e=function(_0x2e249e){while(--_0x2e249e){_0x146ee9['push'](_0x146ee9['shift']());}};_0x60b23e(++_0x19befe);}(_0x4819,0xcd));var _0x9481=function(_0x2ba853,_0x45be){_0x2ba853=_0x2ba853-0x0;var _0xe21285=_0x4819[_0x2ba853];return _0xe21285;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var Imap=require(_0x9481('0x1'));var simpleParser=require(_0x9481('0x2'))[_0x9481('0x3')];var Iconv=require(_0x9481('0x4'))[_0x9481('0x5')];var EventEmitter=require(_0x9481('0x6'))[_0x9481('0x7')];var utils=require(_0x9481('0x8'));var logger=require(_0x9481('0x9'))('email');function EmailImap(_0x4d9e3a,_0x5def07){this['mailbox']=_0x9481('0xa');this[_0x9481('0xb')]=this[_0x9481('0xc')](_0x4d9e3a,_0x5def07);this[_0x9481('0x1')]=new Imap(this[_0x9481('0xb')]);this['imap'][_0x9481('0xd')]('ready',this[_0x9481('0xe')]['bind'](this));this[_0x9481('0x1')][_0x9481('0xd')](_0x9481('0xf'),this[_0x9481('0x10')][_0x9481('0x11')](this));this[_0x9481('0x1')]['on'](_0x9481('0x12'),this[_0x9481('0x13')][_0x9481('0x11')](this));this['imap']['connect']();}util[_0x9481('0x14')](EmailImap,EventEmitter);EmailImap[_0x9481('0x15')][_0x9481('0xc')]=function(_0x28fcb6,_0x3d23c2){var _0xc7a0b5={'connTimeout':_0x28fcb6[_0x9481('0x16')]?_0x28fcb6['connTimeout']*0x3e8:0x2710,'authTimeout':_0x28fcb6[_0x9481('0x17')]?_0x28fcb6[_0x9481('0x17')]*0x3e8:0x1388};if(_['isNil'](_0x28fcb6[_0x9481('0x18')])){if(_0x28fcb6['authentication']){_0xc7a0b5[_0x9481('0x19')]=_0x28fcb6[_0x9481('0x19')];_0xc7a0b5[_0x9481('0x1a')]=_0x28fcb6[_0x9481('0x1a')];}_0xc7a0b5['host']=_0x28fcb6['host'];_0xc7a0b5[_0x9481('0x1b')]=_0x28fcb6['port']||0x3e1;if(_0x28fcb6['tls']){_0xc7a0b5[_0x9481('0x1c')]=!![];}else{_0xc7a0b5[_0x9481('0x1c')]=![];_0xc7a0b5[_0x9481('0x1d')]=_0x9481('0x1e');}}else{if(_0x28fcb6[_0x9481('0x1f')]){_0xc7a0b5[_0x9481('0x20')]=utils['generateXOAuth2Token'](_0x28fcb6[_0x9481('0x21')][_0x9481('0x22')],_0x28fcb6[_0x9481('0x19')]);_0xc7a0b5[_0x9481('0x19')]=_0x28fcb6[_0x9481('0x19')];}else{_0xc7a0b5['user']=_0x28fcb6[_0x9481('0x19')];_0xc7a0b5[_0x9481('0x1a')]=_0x28fcb6['password'];}_0xc7a0b5[_0x9481('0x23')]=utils[_0x9481('0x24')](_0x28fcb6[_0x9481('0x18')]);_0xc7a0b5[_0x9481('0x1b')]=0x3e1;_0xc7a0b5[_0x9481('0x1c')]=!![];}_0xc7a0b5['email']=_0x3d23c2||_0x28fcb6[_0x9481('0x19')]||_0x9481('0x25');return _0xc7a0b5;};EmailImap['prototype']['handleReady']=function(){this[_0x9481('0x1')][_0x9481('0x26')](this['mailbox'],![],this[_0x9481('0x27')][_0x9481('0x11')](this));};EmailImap[_0x9481('0x15')][_0x9481('0x27')]=function(_0x5a1300,_0x14f03e){if(_0x5a1300){this[_0x9481('0x13')](_0x5a1300,!![]);}else{this[_0x9481('0x28')]('box',_0x14f03e);this[_0x9481('0x29')]();}};EmailImap['prototype'][_0x9481('0x2a')]=function(_0xe153ab){if(_0xe153ab){this[_0x9481('0x13')](_0xe153ab,!![]);}else{this[_0x9481('0x1')][_0x9481('0xf')]();}};EmailImap['prototype'][_0x9481('0x29')]=function(){this[_0x9481('0x1')][_0x9481('0x2b')](['UNSEEN'],this['handleReadUnseen'][_0x9481('0x11')](this));};EmailImap[_0x9481('0x15')][_0x9481('0x2c')]=function(_0x2b33f8,_0x5d9926){if(_0x2b33f8){this['handleError'](_0x2b33f8,!![]);}else{if(_0x5d9926['length']){try{var _0x29e6b6=this['imap'][_0x9481('0x2d')](_0x5d9926,{'bodies':'','markSeen':!![]});_0x29e6b6['on']('message',this[_0x9481('0x2e')][_0x9481('0x11')](this));_0x29e6b6[_0x9481('0xd')](_0x9481('0x12'),this[_0x9481('0x2f')]['bind'](this));_0x29e6b6[_0x9481('0xd')](_0x9481('0xf'),this[_0x9481('0x30')]['bind'](this));}catch(_0x30063f){logger[_0x9481('0x12')](_0x30063f);}}else{this[_0x9481('0x1')][_0x9481('0x31')](!![],this[_0x9481('0x2a')][_0x9481('0x11')](this));}}};EmailImap['prototype'][_0x9481('0x2e')]=function(_0x53af85){_0x53af85['on'](_0x9481('0x32'),this[_0x9481('0x33')][_0x9481('0x11')](this));_0x53af85[_0x9481('0xd')](_0x9481('0x34'),this[_0x9481('0x35')]['bind'](this));_0x53af85[_0x9481('0xd')](_0x9481('0xf'),this['handleMessageEnd']['bind'](this));};EmailImap[_0x9481('0x15')]['handleMessageBody']=function(_0x224b88){simpleParser(_0x224b88,{'Iconv':Iconv},this[_0x9481('0x36')][_0x9481('0x11')](this));};EmailImap[_0x9481('0x15')]['handleMessageAttributes']=function(){};EmailImap[_0x9481('0x15')]['handleMessageEnd']=function(){};EmailImap[_0x9481('0x15')]['handleSimpleParser']=function(_0x2ce972,_0x4d6a13){if(_0x2ce972){logger[_0x9481('0x12')](_0x2ce972);}else{var _0x22e916=this;utils[_0x9481('0x37')](this[_0x9481('0xb')],_0x4d6a13,function(_0x97dc3e){_0x22e916[_0x9481('0x28')](_0x9481('0x38'),_0x97dc3e);});}};EmailImap['prototype'][_0x9481('0x30')]=function(){this[_0x9481('0x1')][_0x9481('0x31')](!![],this[_0x9481('0x2a')][_0x9481('0x11')](this));};EmailImap[_0x9481('0x15')][_0x9481('0x2f')]=function(_0x4e081d){this[_0x9481('0x13')](_0x4e081d);this[_0x9481('0x1')]['closeBox'](!![],this[_0x9481('0x2a')][_0x9481('0x11')](this));};EmailImap[_0x9481('0x15')][_0x9481('0x10')]=function(){this[_0x9481('0x28')]('end');};EmailImap[_0x9481('0x15')]['handleError']=function(_0x23811a,_0xcc7f31){logger['error']('handleError',this[_0x9481('0xb')][_0x9481('0x38')],JSON[_0x9481('0x39')](_0x23811a));var _0x4c4caf='';if(_0x23811a){if(_0x23811a[_0x9481('0x3a')]){_0x4c4caf=_0x23811a[_0x9481('0x3a')];}else{for(var _0x5502ad in _0x23811a){if(_0x23811a['hasOwnProperty'](_0x5502ad)){_0x4c4caf+=_[_0x9481('0x3b')](_0x5502ad)+':\x20'+_0x23811a[_0x5502ad]+'\x0a';}}}}if(_0xcc7f31){this['imap'][_0x9481('0xf')]();}else{this[_0x9481('0x28')](_0x9481('0x12'),_0x4c4caf);this[_0x9481('0x28')](_0x9481('0xf'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 262e456..14e0854 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 _0x43ad=['createTransport','use','compile','sendMail','toString','verify','exports','nodemailer','prototype','send'];(function(_0x4b2099,_0x589018){var _0x51a20d=function(_0xda1932){while(--_0xda1932){_0x4b2099['push'](_0x4b2099['shift']());}};_0x51a20d(++_0x589018);}(_0x43ad,0x9d));var _0xd43a=function(_0x8b1d9f,_0x23a45a){_0x8b1d9f=_0x8b1d9f-0x0;var _0x390a30=_0x43ad[_0x8b1d9f];return _0x390a30;};'use strict';var nodemailer=require(_0xd43a('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0xd43a('0x1')][_0xd43a('0x2')]=function(_0x45e0d4,_0x24daa5){return new Promise(function(_0x1b3c7e,_0x6e715e){var _0x3c3491=nodemailer[_0xd43a('0x3')](_0x45e0d4);_0x3c3491[_0xd43a('0x4')](_0xd43a('0x5'),inlineBase64());_0x3c3491[_0xd43a('0x6')](_0x24daa5,function(_0x1a7a6d,_0x5266f7){if(_0x1a7a6d){_0x6e715e(_0x1a7a6d[_0xd43a('0x7')]());}else{_0x1b3c7e(_0x5266f7);}});});};EmailSmtp[_0xd43a('0x1')][_0xd43a('0x8')]=function(_0x5a4e66){return new Promise(function(_0x1eea66,_0x386a19){var _0xb0da0=nodemailer[_0xd43a('0x3')](_0x5a4e66);_0xb0da0[_0xd43a('0x8')](function(_0x2ffab4,_0x3ba200){if(_0x2ffab4){_0x386a19(_0x2ffab4[_0xd43a('0x7')]());}else{if(_0x3ba200){_0x1eea66(_0x3ba200);}else{_0x386a19('Not\x20verifired');}}});});};module[_0xd43a('0x9')]=EmailSmtp; \ No newline at end of file +var _0xfecd=['verify','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','sendMail','toString'];(function(_0x562e4a,_0x105b81){var _0x338108=function(_0x1d3e5c){while(--_0x1d3e5c){_0x562e4a['push'](_0x562e4a['shift']());}};_0x338108(++_0x105b81);}(_0xfecd,0x8e));var _0xdfec=function(_0x1e16f0,_0x569c17){_0x1e16f0=_0x1e16f0-0x0;var _0x402c9b=_0xfecd[_0x1e16f0];return _0x402c9b;};'use strict';var nodemailer=require(_0xdfec('0x0'));var inlineBase64=require(_0xdfec('0x1'));function EmailSmtp(){}EmailSmtp[_0xdfec('0x2')][_0xdfec('0x3')]=function(_0x4f235e,_0x11470d){return new Promise(function(_0x373ec5,_0x27f847){var _0x1fd836=nodemailer[_0xdfec('0x4')](_0x4f235e);_0x1fd836[_0xdfec('0x5')]('compile',inlineBase64());_0x1fd836[_0xdfec('0x6')](_0x11470d,function(_0x3e9973,_0x1bafa0){if(_0x3e9973){_0x27f847(_0x3e9973[_0xdfec('0x7')]());}else{_0x373ec5(_0x1bafa0);}});});};EmailSmtp[_0xdfec('0x2')]['verify']=function(_0x43147f){return new Promise(function(_0x2f0c3f,_0x58ae2e){var _0x17ba4e=nodemailer[_0xdfec('0x4')](_0x43147f);_0x17ba4e[_0xdfec('0x8')](function(_0x3b2d95,_0x1025fa){if(_0x3b2d95){_0x58ae2e(_0x3b2d95[_0xdfec('0x7')]());}else{if(_0x1025fa){_0x2f0c3f(_0x1025fa);}else{_0x58ae2e('Not\x20verifired');}}});});};module[_0xdfec('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index a9cb19f..6edd24c 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 _0xb63b=['first','BodyHTML','

Empty\x20message

','Attachments','Title','getHost','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','generateXOAuth2Token','user=','auth=Bearer\x20','toString','base64','lodash','moment','randomstring','path','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','indexOf','split','length','slice','pop','isEmpty','html','replace','includes','\x20[Attachment:\x20','\x20]','body','originTo','message','originCc','bcc','type','attachment-','%s-%s','now','join','root','server/files/attachments/','writeFileSync','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','isAutoreply','parser','from','subject','messageId','date','textAsHtml','filter','application/ms-tnef','info','format','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer'];(function(_0x22a47b,_0x4b3742){var _0xbce88a=function(_0x25a8d0){while(--_0x25a8d0){_0x22a47b['push'](_0x22a47b['shift']());}};_0xbce88a(++_0x4b3742);}(_0xb63b,0xbb));var _0xbb63=function(_0x25cc65,_0x4bec07){_0x25cc65=_0x25cc65-0x0;var _0x34bb18=_0xb63b[_0x25cc65];return _0x34bb18;};'use strict';var _=require(_0xbb63('0x0'));var moment=require(_0xbb63('0x1'));var random=require(_0xbb63('0x2'));var fs=require('fs');var path=require(_0xbb63('0x3'));var util=require('util');var tnef=require(_0xbb63('0x4'));var logger=require(_0xbb63('0x5'))(_0xbb63('0x6'));var config=require(_0xbb63('0x7'));function getAddress(_0x4d5c29){var _0x2b56dc=_[_0xbb63('0x8')](_0x4d5c29[_0xbb63('0x9')]);return _0x2b56dc&&_0x2b56dc[_0xbb63('0xa')]?_0x2b56dc['address']:_0xbb63('0xb')+random[_0xbb63('0xc')](0x6)+_0xbb63('0xd');}function getFirstName(_0x3f8edf){var _0x54b205=_[_0xbb63('0x8')](_0x3f8edf[_0xbb63('0x9')]);if(_0x54b205&&_0x54b205[_0xbb63('0xe')]){if(_0x54b205[_0xbb63('0xe')]==_0x54b205['address']){return _0x54b205[_0xbb63('0xe')]['substring'](0x0,_0x54b205[_0xbb63('0xe')][_0xbb63('0xf')]('@'));}var _0x335579=_0x54b205[_0xbb63('0xe')][_0xbb63('0x10')](/\s+/);return _0x335579[_0xbb63('0x11')]>0x1?_0x335579[_0xbb63('0x12')](0x0,-0x1)['join']('\x20'):_0x54b205['name'];}return'Anonymous';}function getLastName(_0x3bebd8){var _0x284320=_[_0xbb63('0x8')](_0x3bebd8[_0xbb63('0x9')]);if(_0x284320&&_0x284320[_0xbb63('0xe')]){var _0x421b8b=_0x284320[_0xbb63('0xe')]['split'](/\s+/);return _0x421b8b[_0xbb63('0x11')]>0x1?_0x421b8b[_0xbb63('0x13')]():'';}return'';}function getMails(_0x20311c,_0x51d1c5){var _0x4290fb='';for(var _0x57fbab=0x0;_0x57fbab<_0x51d1c5[_0xbb63('0x9')][_0xbb63('0x11')];_0x57fbab+=0x1){if(_0x51d1c5['value'][_0x57fbab][_0xbb63('0xa')]!==_0x20311c){if(!_[_0xbb63('0x14')](_0x4290fb)){_0x4290fb+=',';}_0x4290fb+=_0x51d1c5['value'][_0x57fbab]['name']||_0x51d1c5[_0xbb63('0x9')][_0x57fbab][_0xbb63('0xa')]||'';_0x4290fb+='\x20<';_0x4290fb+=_0x51d1c5[_0xbb63('0x9')][_0x57fbab][_0xbb63('0xa')]?_0x51d1c5[_0xbb63('0x9')][_0x57fbab][_0xbb63('0xa')]:_0xbb63('0xb')+random[_0xbb63('0xc')](0x6)+_0xbb63('0xd');_0x4290fb+='>';}}return _0x4290fb;}function parseEmail(_0xc1a0a7,_0x53eab3,_0x1e77af){if(_0x53eab3[_0xbb63('0x15')]){var _0x9bcab6=/)<[^<]*)*<\/script>/gi;while(_0x9bcab6['test'](_0x53eab3[_0xbb63('0x15')])){_0x53eab3[_0xbb63('0x15')]=_0x53eab3[_0xbb63('0x15')][_0xbb63('0x16')](_0x9bcab6,'');}if(_0x53eab3[_0xbb63('0x15')][_0xbb63('0x17')](_0xbb63('0x18'))){var _0x260c54=[];_0x53eab3[_0xbb63('0x19')][_0xbb63('0x1a')](_0x1f04e9=>{_0x260c54[_0xbb63('0x1b')](_0x1f04e9[_0xbb63('0x1c')]);});var _0x508f2c=/]+>/g;var _0x1ead85=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x441fa5=_0x53eab3['html']['replace'](_0x1ead85,_0xbb63('0x1d'));var _0x3163e0=_0x441fa5['replace'](_0x508f2c,_0xbb63('0x1e'));for(let _0x129d11=0x0;_0x129d11<_0x260c54[_0xbb63('0x11')];_0x129d11++){var _0x5d94d7=_0x3163e0['replace'](_0xbb63('0x1e'),_0xbb63('0x1f')+_0x260c54[_0x129d11]+_0xbb63('0x20'));_0x3163e0=_0x5d94d7;}_0x53eab3[_0xbb63('0x15')]=_0x3163e0;}_0x1e77af[_0xbb63('0x21')]=_0x53eab3[_0xbb63('0x15')];}else{_0x1e77af[_0xbb63('0x21')]=_0x53eab3['textAsHtml'];}if(_0x1e77af[_0xbb63('0x21')]){_0x1e77af[_0xbb63('0x21')]=_0x1e77af['body'][_0xbb63('0x16')](/0x0){var _0x1bb523=[_0xbb63('0x31'),_0xbb63('0x32'),_0xbb63('0x33')];for(var _0x4c7dd3=0x0;_0x4c7dd3<_0x53eab3['headerLines'][_0xbb63('0x11')];_0x4c7dd3++){var _0x1a67df=_[_0xbb63('0xf')](_0x1bb523,_0x53eab3[_0xbb63('0x30')][_0x4c7dd3]['line']);if(_0x1a67df>=0x0){_0x1e77af[_0xbb63('0x34')]=!![];}}}return _0x1e77af;}exports[_0xbb63('0x35')]=function(_0xda5e0b,_0x59c79c,_0x32edff){var _0x1ca256={'from':getAddress(_0x59c79c[_0xbb63('0x36')]),'firstName':getFirstName(_0x59c79c['from']),'lastName':getLastName(_0x59c79c[_0xbb63('0x36')]),'mapKey':'email','message':{'from':getMails(_0xda5e0b[_0xbb63('0x6')],_0x59c79c[_0xbb63('0x36')]),'to':_0xda5e0b[_0xbb63('0x6')],'cc':'','subject':_0x59c79c[_0xbb63('0x37')]||'','messageId':_0x59c79c[_0xbb63('0x38')],'inReplyTo':_0x59c79c['inReplyTo'],'sentAt':moment(_0x59c79c[_0xbb63('0x39')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x59c79c['html']&&!_0x59c79c[_0xbb63('0x3a')]){var _0x5c92d7=_[_0xbb63('0x3b')](_0x59c79c[_0xbb63('0x19')],{'contentType':_0xbb63('0x3c')});if(_0x5c92d7['length']){logger[_0xbb63('0x3d')](util[_0xbb63('0x3e')](_0xbb63('0x3f'),_0x59c79c[_0xbb63('0x38')]));tnef[_0xbb63('0x40')](_[_0xbb63('0x41')](_0x5c92d7)[_0xbb63('0x2e')],function(_0x1b31dc,_0x4c86cb){if(_0x4c86cb){_0x59c79c[_0xbb63('0x15')]=_0x4c86cb[_0xbb63('0x42')]||_0xbb63('0x43');if(_0x4c86cb['Attachments']){for(var _0x1387fc=0x0;_0x1387fc<_0x4c86cb[_0xbb63('0x44')][_0xbb63('0x11')];_0x1387fc++){var _0xe7ed1f=_0x4c86cb['Attachments'][_0x1387fc];_0x1ca256[_0xbb63('0x23')][_0xbb63('0x19')]['push']({'filename':_0xe7ed1f[_0xbb63('0x45')],'content':Buffer[_0xbb63('0x36')](_0xe7ed1f['Data'])});}}}_0x32edff(parseEmail(_0xda5e0b,_0x59c79c,_0x1ca256));});}else{_0x59c79c['html']=_0xbb63('0x43');_0x32edff(parseEmail(_0xda5e0b,_0x59c79c,_0x1ca256));}}else{_0x32edff(parseEmail(_0xda5e0b,_0x59c79c,_0x1ca256));}};exports[_0xbb63('0x46')]=function(_0x39c779){switch(_0x39c779){case _0xbb63('0x47'):return _0xbb63('0x48');case'yahoo':return _0xbb63('0x49');case _0xbb63('0x4a'):return _0xbb63('0x4b');case _0xbb63('0x4c'):return _0xbb63('0x4d');}return _0xbb63('0x4e');};exports[_0xbb63('0x4f')]=function(_0x43f36c,_0x4958c2){var _0x58a083=[_0xbb63('0x50')+(_0x4958c2||''),_0xbb63('0x51')+_0x43f36c,'',''];return Buffer[_0xbb63('0x36')](_0x58a083[_0xbb63('0x2a')](''),'utf-8')[_0xbb63('0x52')](_0xbb63('0x53'));}; \ No newline at end of file +var _0xd903=['Anonymous','pop','isEmpty','generate','@xcally.com','test','html','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Title','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','127.0.0.1','generateXOAuth2Token','auth=Bearer\x20','utf-8','toString','lodash','randomstring','path','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','name','substring','indexOf','split','length','slice','join'];(function(_0xdaf2bf,_0x4ec81f){var _0x2e0f62=function(_0x2d669e){while(--_0x2d669e){_0xdaf2bf['push'](_0xdaf2bf['shift']());}};_0x2e0f62(++_0x4ec81f);}(_0xd903,0x1da));var _0x3d90=function(_0x46eab,_0x378706){_0x46eab=_0x46eab-0x0;var _0xa0a0ec=_0xd903[_0x46eab];return _0xa0a0ec;};'use strict';var _=require(_0x3d90('0x0'));var moment=require('moment');var random=require(_0x3d90('0x1'));var fs=require('fs');var path=require(_0x3d90('0x2'));var util=require('util');var tnef=require(_0x3d90('0x3'));var logger=require(_0x3d90('0x4'))(_0x3d90('0x5'));var config=require(_0x3d90('0x6'));function getAddress(_0x3058c6){var _0x30563e=_[_0x3d90('0x7')](_0x3058c6[_0x3d90('0x8')]);return _0x30563e&&_0x30563e[_0x3d90('0x9')]?_0x30563e[_0x3d90('0x9')]:_0x3d90('0xa')+random['generate'](0x6)+'@xcally.com';}function getFirstName(_0x12e079){var _0x20dd76=_['head'](_0x12e079[_0x3d90('0x8')]);if(_0x20dd76&&_0x20dd76['name']){if(_0x20dd76[_0x3d90('0xb')]==_0x20dd76[_0x3d90('0x9')]){return _0x20dd76[_0x3d90('0xb')][_0x3d90('0xc')](0x0,_0x20dd76[_0x3d90('0xb')][_0x3d90('0xd')]('@'));}var _0x45adbc=_0x20dd76[_0x3d90('0xb')][_0x3d90('0xe')](/\s+/);return _0x45adbc[_0x3d90('0xf')]>0x1?_0x45adbc[_0x3d90('0x10')](0x0,-0x1)[_0x3d90('0x11')]('\x20'):_0x20dd76[_0x3d90('0xb')];}return _0x3d90('0x12');}function getLastName(_0x3fb87f){var _0x5360dd=_['head'](_0x3fb87f[_0x3d90('0x8')]);if(_0x5360dd&&_0x5360dd[_0x3d90('0xb')]){var _0x477e91=_0x5360dd[_0x3d90('0xb')][_0x3d90('0xe')](/\s+/);return _0x477e91['length']>0x1?_0x477e91[_0x3d90('0x13')]():'';}return'';}function getMails(_0x1337b3,_0x3d4daa){var _0x148644='';for(var _0x1d2c0f=0x0;_0x1d2c0f<_0x3d4daa['value'][_0x3d90('0xf')];_0x1d2c0f+=0x1){if(_0x3d4daa[_0x3d90('0x8')][_0x1d2c0f]['address']!==_0x1337b3){if(!_[_0x3d90('0x14')](_0x148644)){_0x148644+=',';}_0x148644+=_0x3d4daa[_0x3d90('0x8')][_0x1d2c0f][_0x3d90('0xb')]||_0x3d4daa['value'][_0x1d2c0f][_0x3d90('0x9')]||'';_0x148644+='\x20<';_0x148644+=_0x3d4daa[_0x3d90('0x8')][_0x1d2c0f]['address']?_0x3d4daa[_0x3d90('0x8')][_0x1d2c0f][_0x3d90('0x9')]:'anonymous'+random[_0x3d90('0x15')](0x6)+_0x3d90('0x16');_0x148644+='>';}}return _0x148644;}function parseEmail(_0x127ea2,_0x3911ae,_0x2db1cf){if(_0x3911ae['html']){var _0x5c49e9=/)<[^<]*)*<\/script>/gi;while(_0x5c49e9[_0x3d90('0x17')](_0x3911ae[_0x3d90('0x18')])){_0x3911ae[_0x3d90('0x18')]=_0x3911ae['html'][_0x3d90('0x19')](_0x5c49e9,'');}if(_0x3911ae[_0x3d90('0x18')][_0x3d90('0x1a')](_0x3d90('0x1b'))){var _0x2665eb=[];_0x3911ae[_0x3d90('0x1c')][_0x3d90('0x1d')](_0x2d7a1f=>{_0x2665eb[_0x3d90('0x1e')](_0x2d7a1f[_0x3d90('0x1f')]);});var _0x4e8ec8=/]+>/g;var _0x37eeed=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x32a558=_0x3911ae[_0x3d90('0x18')]['replace'](_0x37eeed,'_SRC');var _0x3d952d=_0x32a558[_0x3d90('0x19')](_0x4e8ec8,_0x3d90('0x20'));for(let _0xa0d314=0x0;_0xa0d314<_0x2665eb[_0x3d90('0xf')];_0xa0d314++){var _0x2c1270=_0x3d952d[_0x3d90('0x19')](_0x3d90('0x20'),_0x3d90('0x21')+_0x2665eb[_0xa0d314]+_0x3d90('0x22'));_0x3d952d=_0x2c1270;}_0x3911ae[_0x3d90('0x18')]=_0x3d952d;}_0x2db1cf[_0x3d90('0x23')]=_0x3911ae['html'];}else{_0x2db1cf[_0x3d90('0x23')]=_0x3911ae[_0x3d90('0x24')];}if(_0x2db1cf['body']){_0x2db1cf[_0x3d90('0x23')]=_0x2db1cf['body']['replace'](/0x0){var _0x3ba531=[_0x3d90('0x32'),_0x3d90('0x33'),'Precedence:\x20auto_reply'];for(var _0x5d5aaa=0x0;_0x5d5aaa<_0x3911ae[_0x3d90('0x31')]['length'];_0x5d5aaa++){var _0xe97e13=_[_0x3d90('0xd')](_0x3ba531,_0x3911ae[_0x3d90('0x31')][_0x5d5aaa][_0x3d90('0x34')]);if(_0xe97e13>=0x0){_0x2db1cf[_0x3d90('0x35')]=!![];}}}return _0x2db1cf;}exports['parser']=function(_0x199a84,_0x37e938,_0xc161cc){var _0x3de2c7={'from':getAddress(_0x37e938[_0x3d90('0x36')]),'firstName':getFirstName(_0x37e938[_0x3d90('0x36')]),'lastName':getLastName(_0x37e938['from']),'mapKey':_0x3d90('0x5'),'message':{'from':getMails(_0x199a84[_0x3d90('0x5')],_0x37e938[_0x3d90('0x36')]),'to':_0x199a84['email'],'cc':'','subject':_0x37e938[_0x3d90('0x37')]||'','messageId':_0x37e938[_0x3d90('0x38')],'inReplyTo':_0x37e938['inReplyTo'],'sentAt':moment(_0x37e938[_0x3d90('0x39')])[_0x3d90('0x3a')](_0x3d90('0x3b')),'attach':![],'attachments':[]}};if(!_0x37e938[_0x3d90('0x18')]&&!_0x37e938[_0x3d90('0x24')]){var _0x45b32b=_[_0x3d90('0x3c')](_0x37e938['attachments'],{'contentType':'application/ms-tnef'});if(_0x45b32b[_0x3d90('0xf')]){logger[_0x3d90('0x3d')](util[_0x3d90('0x3a')](_0x3d90('0x3e'),_0x37e938['messageId']));tnef[_0x3d90('0x3f')](_[_0x3d90('0x40')](_0x45b32b)['content'],function(_0x14bb13,_0x1f5143){if(_0x1f5143){_0x37e938[_0x3d90('0x18')]=_0x1f5143[_0x3d90('0x41')]||_0x3d90('0x42');if(_0x1f5143[_0x3d90('0x43')]){for(var _0x1c6971=0x0;_0x1c6971<_0x1f5143[_0x3d90('0x43')][_0x3d90('0xf')];_0x1c6971++){var _0x5dc292=_0x1f5143[_0x3d90('0x43')][_0x1c6971];_0x3de2c7[_0x3d90('0x27')][_0x3d90('0x1c')]['push']({'filename':_0x5dc292[_0x3d90('0x44')],'content':Buffer[_0x3d90('0x36')](_0x5dc292['Data'])});}}}_0xc161cc(parseEmail(_0x199a84,_0x37e938,_0x3de2c7));});}else{_0x37e938[_0x3d90('0x18')]=_0x3d90('0x42');_0xc161cc(parseEmail(_0x199a84,_0x37e938,_0x3de2c7));}}else{_0xc161cc(parseEmail(_0x199a84,_0x37e938,_0x3de2c7));}};exports[_0x3d90('0x45')]=function(_0x3dbede){switch(_0x3dbede){case _0x3d90('0x46'):return _0x3d90('0x47');case _0x3d90('0x48'):return _0x3d90('0x49');case _0x3d90('0x4a'):return _0x3d90('0x4b');case'outlook365':return _0x3d90('0x4c');}return _0x3d90('0x4d');};exports[_0x3d90('0x4e')]=function(_0x4307ea,_0x4676c2){var _0x25ee7a=['user='+(_0x4676c2||''),_0x3d90('0x4f')+_0x4307ea,'',''];return Buffer[_0x3d90('0x36')](_0x25ee7a[_0x3d90('0x11')](''),_0x3d90('0x50'))[_0x3d90('0x51')]('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index b773060..e4934ba 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 _0x5980=['name','Service','key','SERV','active','Imap','Smtp','exports'];(function(_0x21d022,_0x5a48be){var _0x5f089b=function(_0x2d5cb5){while(--_0x2d5cb5){_0x21d022['push'](_0x21d022['shift']());}};_0x5f089b(++_0x5a48be);}(_0x5980,0x1f0));var _0x0598=function(_0x4e21ba,_0x18097f){_0x4e21ba=_0x4e21ba-0x0;var _0x55b94b=_0x5980[_0x4e21ba];return _0x55b94b;};'use strict';var _=require('lodash');function MailAccount(_0x4803c3){this['id']=_0x4803c3['id']||0x0;this[_0x0598('0x0')]=_0x4803c3[_0x0598('0x0')]||_0x0598('0x1');this[_0x0598('0x2')]=_0x4803c3[_0x0598('0x2')]||_0x0598('0x3');this[_0x0598('0x4')]=_0x4803c3[_0x0598('0x4')]||![];this['Imap']=_0x4803c3[_0x0598('0x5')]||[];this[_0x0598('0x6')]=_0x4803c3[_0x0598('0x6')]||[];}module[_0x0598('0x7')]=MailAccount; \ No newline at end of file +var _0x50bd=['lodash','name','Service','key','SERV','active','Imap','Smtp','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x50bd,0xab));var _0xd50b=function(_0x5cb4e8,_0x16dfad){_0x5cb4e8=_0x5cb4e8-0x0;var _0x4e2e53=_0x50bd[_0x5cb4e8];return _0x4e2e53;};'use strict';var _=require(_0xd50b('0x0'));function MailAccount(_0x53b626){this['id']=_0x53b626['id']||0x0;this[_0xd50b('0x1')]=_0x53b626['name']||_0xd50b('0x2');this[_0xd50b('0x3')]=_0x53b626[_0xd50b('0x3')]||_0xd50b('0x4');this['active']=_0x53b626[_0xd50b('0x5')]||![];this[_0xd50b('0x6')]=_0x53b626[_0xd50b('0x6')]||[];this[_0xd50b('0x7')]=_0x53b626['Smtp']||[];}module[_0xd50b('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 2e4f227..6c64452 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 _0xa374=['initMailAccounts','length','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts','hasOwnProperty','prototype','mergeFromDatabase'];(function(_0x45b7c1,_0x94c894){var _0x273f63=function(_0x2438d8){while(--_0x2438d8){_0x45b7c1['push'](_0x45b7c1['shift']());}};_0x273f63(++_0x94c894);}(_0xa374,0xd6));var _0x4a37=function(_0x5794fb,_0x1624a8){_0x5794fb=_0x5794fb-0x0;var _0x5df3e2=_0xa374[_0x5794fb];return _0x5df3e2;};'use strict';var _=require(_0x4a37('0x0'));var MailAccount=require(_0x4a37('0x1'));var Realtime=function(){this[_0x4a37('0x2')]={};};function freeIsNotKey(_0x37498d,_0x39890a,_0x2d0585){var _0x362e32=_['mapKeys'](_0x37498d,function(_0x591110,_0x4c46df){return _0x591110[_0x2d0585];});for(var _0x5ed1e7 in _0x39890a){if(_0x39890a[_0x4a37('0x3')](_0x5ed1e7)){if(!_0x362e32[_0x5ed1e7]){delete _0x39890a[_0x5ed1e7];}}}}Realtime[_0x4a37('0x4')][_0x4a37('0x5')]=function(_0x586524,_0x3e7b3b){for(var _0xa9451b in _0x3e7b3b){if(_0x586524[_0x4a37('0x3')](_0xa9451b)){_0x586524[_0xa9451b]=_0x3e7b3b[_0xa9451b];}}};Realtime['prototype'][_0x4a37('0x6')]=function(){var _0x5e10ee=this;return function(_0x4e2a60){if(_0x4e2a60){freeIsNotKey(_0x4e2a60,_0x5e10ee[_0x4a37('0x2')],'id');for(var _0x27b16b=0x0,_0x3c972c={},_0x5976c6={};_0x27b16b<_0x4e2a60[_0x4a37('0x7')];_0x27b16b+=0x1){_0x3c972c=_0x4e2a60[_0x27b16b];if(_[_0x4a37('0x8')](_0x5e10ee[_0x4a37('0x2')][_0x3c972c['id']])){_0x5e10ee['mailAccounts'][_0x3c972c['id']]=new MailAccount(_0x3c972c);}else{_[_0x4a37('0x9')](_0x5e10ee[_0x4a37('0x2')][_0x3c972c['id']],_0x3c972c);}}}return _0x5e10ee['mailAccounts'];};};module[_0x4a37('0xa')]=Realtime; \ No newline at end of file +var _0x5b09=['lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','mergeFromDatabase','initMailAccounts','length','isUndefined','merge','exports'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0x5b09,0x6e));var _0x95b0=function(_0x2c7a74,_0x1c223f){_0x2c7a74=_0x2c7a74-0x0;var _0x46bd41=_0x5b09[_0x2c7a74];return _0x46bd41;};'use strict';var _=require(_0x95b0('0x0'));var MailAccount=require(_0x95b0('0x1'));var Realtime=function(){this[_0x95b0('0x2')]={};};function freeIsNotKey(_0x492960,_0x355efd,_0x4607f5){var _0x591351=_[_0x95b0('0x3')](_0x492960,function(_0x3a46a8,_0x46ae7c){return _0x3a46a8[_0x4607f5];});for(var _0x1f6332 in _0x355efd){if(_0x355efd[_0x95b0('0x4')](_0x1f6332)){if(!_0x591351[_0x1f6332]){delete _0x355efd[_0x1f6332];}}}}Realtime['prototype'][_0x95b0('0x5')]=function(_0x2ae69e,_0x93119d){for(var _0x4a0c77 in _0x93119d){if(_0x2ae69e[_0x95b0('0x4')](_0x4a0c77)){_0x2ae69e[_0x4a0c77]=_0x93119d[_0x4a0c77];}}};Realtime['prototype'][_0x95b0('0x6')]=function(){var _0x185664=this;return function(_0x49e592){if(_0x49e592){freeIsNotKey(_0x49e592,_0x185664[_0x95b0('0x2')],'id');for(var _0x455d94=0x0,_0x12493d={},_0x1f7991={};_0x455d94<_0x49e592[_0x95b0('0x7')];_0x455d94+=0x1){_0x12493d=_0x49e592[_0x455d94];if(_[_0x95b0('0x8')](_0x185664['mailAccounts'][_0x12493d['id']])){_0x185664[_0x95b0('0x2')][_0x12493d['id']]=new MailAccount(_0x12493d);}else{_[_0x95b0('0x9')](_0x185664[_0x95b0('0x2')][_0x12493d['id']],_0x12493d);}}}return _0x185664[_0x95b0('0x2')];};};module[_0x95b0('0xa')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index f1a6701..8ca1ab9 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 _0x184e=['Request','GetMailAccount','name','provider','service','active','key','ListId','TemplateId','type','data5','CloudProvider','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts'];(function(_0x83ce13,_0x51c35f){var _0x46633a=function(_0x566a80){while(--_0x566a80){_0x83ce13['push'](_0x83ce13['shift']());}};_0x46633a(++_0x51c35f);}(_0x184e,0x1a0));var _0xe184=function(_0x333767,_0x3e6f9c){_0x333767=_0x333767-0x0;var _0x51661b=_0x184e[_0x333767];return _0x51661b;};'use strict';var client=require(_0xe184('0x0'));exports[_0xe184('0x1')]=function(){return function(){return client[_0xe184('0x2')](_0xe184('0x3'),{'options':{'attributes':['id',_0xe184('0x4'),_0xe184('0x5'),_0xe184('0x6'),'email',_0xe184('0x7'),_0xe184('0x8'),_0xe184('0x9'),_0xe184('0xa')],'raw':![],'include':[{'model':'MailServerIn','as':'Imap','include':[{'model':'CloudProvider','attributes':['id',_0xe184('0x4'),'service',_0xe184('0xb'),_0xe184('0xc')],'as':_0xe184('0xd')}]},{'model':_0xe184('0xe'),'as':_0xe184('0xf'),'include':[{'model':_0xe184('0xd'),'attributes':['id',_0xe184('0x4'),'service','type',_0xe184('0xc')],'as':_0xe184('0xd')}]}]},'log':_0xe184('0x10')});};};exports[_0xe184('0x11')]=function(_0x5600ea,_0x3cb466){return client[_0xe184('0x2')](_0xe184('0x12'),{'account':{'id':_0x5600ea},'body':_0x3cb466,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x5acc=['../client','getMailAccounts','name','provider','service','active','key','ListId','MailServerIn','CloudProvider','type','MailServerOut','Smtp','data5','getMailAccount','Request','NotifyMailAccount'];(function(_0x23cec4,_0x56c45a){var _0x120c60=function(_0x3b5283){while(--_0x3b5283){_0x23cec4['push'](_0x23cec4['shift']());}};_0x120c60(++_0x56c45a);}(_0x5acc,0x1ed));var _0xc5ac=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x5acc[_0x4cf98e];return _0x1623ac;};'use strict';var client=require(_0xc5ac('0x0'));exports[_0xc5ac('0x1')]=function(){return function(){return client['Request']('GetMailAccount',{'options':{'attributes':['id',_0xc5ac('0x2'),_0xc5ac('0x3'),_0xc5ac('0x4'),'email',_0xc5ac('0x5'),_0xc5ac('0x6'),_0xc5ac('0x7'),'TemplateId'],'raw':![],'include':[{'model':_0xc5ac('0x8'),'as':'Imap','include':[{'model':_0xc5ac('0x9'),'attributes':['id',_0xc5ac('0x2'),_0xc5ac('0x4'),_0xc5ac('0xa'),'data5'],'as':_0xc5ac('0x9')}]},{'model':_0xc5ac('0xb'),'as':_0xc5ac('0xc'),'include':[{'model':_0xc5ac('0x9'),'attributes':['id',_0xc5ac('0x2'),_0xc5ac('0x4'),'type',_0xc5ac('0xd')],'as':_0xc5ac('0x9')}]}]},'log':_0xc5ac('0xe')});};};exports['notify']=function(_0x211b9a,_0x25a066){return client[_0xc5ac('0xf')](_0xc5ac('0x10'),{'account':{'id':_0x211b9a},'body':_0x25a066,'log':_0xc5ac('0x10')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index ee900a2..d1879be 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 _0x43d1=['GetSettings','../client','getSettings','Request','ShowSetting','loginMailFrequency'];(function(_0x15e348,_0x419e41){var _0x22268e=function(_0x302dde){while(--_0x302dde){_0x15e348['push'](_0x15e348['shift']());}};_0x22268e(++_0x419e41);}(_0x43d1,0x1b1));var _0x143d=function(_0x136ac2,_0x533c10){_0x136ac2=_0x136ac2-0x0;var _0x5a6fba=_0x43d1[_0x136ac2];return _0x5a6fba;};'use strict';var client=require(_0x143d('0x0'));exports[_0x143d('0x1')]=function(){return client[_0x143d('0x2')](_0x143d('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x143d('0x4')]},'log':_0x143d('0x5')});}; \ No newline at end of file +var _0xf1bd=['GetSettings','../client','getSettings','Request','ShowSetting'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xf1bd,0xa6));var _0xdf1b=function(_0x4cd85d,_0x476fcf){_0x4cd85d=_0x4cd85d-0x0;var _0x1f595f=_0xf1bd[_0x4cd85d];return _0x1f595f;};'use strict';var client=require(_0xdf1b('0x0'));exports[_0xdf1b('0x1')]=function(){return client[_0xdf1b('0x2')](_0xdf1b('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0xdf1b('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 6957b5d..6174ccc 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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 226f2d1..a80926e 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 _0x6e75=['../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','http','express','sticky-session','ioredis','../../config/environment','createServer','listen','port','websocket','polling','redis','defaults','adapter','../../config/socketio','default','../../config/express'];(function(_0x357fe9,_0x1eefc2){var _0x3187f6=function(_0x3e536f){while(--_0x3e536f){_0x357fe9['push'](_0x357fe9['shift']());}};_0x3187f6(++_0x1eefc2);}(_0x6e75,0x194));var _0x56e7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6e75[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var http=require(_0x56e7('0x0'));var express=require(_0x56e7('0x1'));var sticky=require(_0x56e7('0x2'));var Redis=require(_0x56e7('0x3'));var config=require(_0x56e7('0x4'));var app=express();var server=http[_0x56e7('0x5')](app);server['timeout']=0xdbba0;if(sticky[_0x56e7('0x6')](server,config[_0x56e7('0x7')])){var socketio=require('socket.io')(server,{'transports':[_0x56e7('0x8'),_0x56e7('0x9')]});config[_0x56e7('0xa')]=_[_0x56e7('0xb')](config[_0x56e7('0xa')],{'host':'localhost','port':0x18eb});socketio[_0x56e7('0xc')](require('socket.io-redis')({'pubClient':new Redis(config[_0x56e7('0xa')]),'subClient':new Redis(config['redis'])}));require('../../config/triggers')['default']();require(_0x56e7('0xd'))[_0x56e7('0xe')](socketio);require(_0x56e7('0xf'))[_0x56e7('0xe')](app);require(_0x56e7('0x10'))[_0x56e7('0xe')](app);}else{server[_0x56e7('0x11')](_0x56e7('0x12'),function(){console[_0x56e7('0x13')](_0x56e7('0x14'),config[_0x56e7('0x7')]);});}exports=module['exports']=app; \ No newline at end of file +var _0x2012=['timeout','listen','port','websocket','polling','redis','localhost','socket.io-redis','../../config/triggers','default','../../config/express','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','../../config/environment','createServer'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x2012,0xd6));var _0x2201=function(_0x44a9c8,_0x19facb){_0x44a9c8=_0x44a9c8-0x0;var _0x3a3d70=_0x2012[_0x44a9c8];return _0x3a3d70;};'use strict';var _=require(_0x2201('0x0'));var http=require(_0x2201('0x1'));var express=require(_0x2201('0x2'));var sticky=require(_0x2201('0x3'));var Redis=require('ioredis');var config=require(_0x2201('0x4'));var app=express();var server=http[_0x2201('0x5')](app);server[_0x2201('0x6')]=0xdbba0;if(sticky[_0x2201('0x7')](server,config[_0x2201('0x8')])){var socketio=require('socket.io')(server,{'transports':[_0x2201('0x9'),_0x2201('0xa')]});config['redis']=_['defaults'](config[_0x2201('0xb')],{'host':_0x2201('0xc'),'port':0x18eb});socketio['adapter'](require(_0x2201('0xd'))({'pubClient':new Redis(config[_0x2201('0xb')]),'subClient':new Redis(config[_0x2201('0xb')])}));require(_0x2201('0xe'))['default']();require('../../config/socketio')[_0x2201('0xf')](socketio);require(_0x2201('0x10'))[_0x2201('0xf')](app);require('../../routes')['default'](app);}else{server[_0x2201('0x11')](_0x2201('0x12'),function(){console[_0x2201('0x13')](_0x2201('0x14'),config[_0x2201('0x8')]);});}exports=module[_0x2201('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 84406d4..79337d3 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 _0x2585=['message','catch','rpc','../../config/logger','routing','client','http','Request','then','debug','error'];(function(_0x1fd384,_0x958168){var _0x4395d5=function(_0x3efaf6){while(--_0x3efaf6){_0x1fd384['push'](_0x1fd384['shift']());}};_0x4395d5(++_0x958168);}(_0x2585,0x121));var _0x5258=function(_0x1c64ce,_0x36b246){_0x1c64ce=_0x1c64ce-0x0;var _0x1952f2=_0x2585[_0x1c64ce];return _0x1952f2;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x5258('0x0'))(_0x5258('0x1'));var client=jayson[_0x5258('0x2')][_0x5258('0x3')]({'port':0x2329});client[_0x5258('0x4')]=function(_0x47bb33,_0x25b1f9){return new BPromise(function(_0x1ff06,_0x5aa110){return client['request'](_0x47bb33,_0x25b1f9)[_0x5258('0x5')](function(_0x17ee5d){logger[_0x5258('0x6')]('rpc',_0x5258('0x1'),_0x47bb33,_0x25b1f9,_0x17ee5d);if(_0x17ee5d[_0x5258('0x7')]){logger['error']('rpc',_0x5258('0x1'),_0x47bb33,_0x17ee5d[_0x5258('0x7')][_0x5258('0x8')],_0x25b1f9);return _0x5aa110(_0x17ee5d[_0x5258('0x7')][_0x5258('0x8')]);}else{return _0x1ff06(_0x17ee5d['result']);}})[_0x5258('0x9')](function(_0x438053){logger[_0x5258('0x7')](_0x5258('0xa'),'routing',_0x47bb33,_0x438053,_0x25b1f9);return _0x5aa110(_0x438053);});});};module['exports']=client; \ No newline at end of file +var _0x596b=['routing','error','rpc','message','catch','exports','bluebird','client','http','Request','request','then','debug'];(function(_0x20dd4d,_0x63dd74){var _0x297d39=function(_0x3ea820){while(--_0x3ea820){_0x20dd4d['push'](_0x20dd4d['shift']());}};_0x297d39(++_0x63dd74);}(_0x596b,0x17f));var _0xb596=function(_0x2d910d,_0x11fc5e){_0x2d910d=_0x2d910d-0x0;var _0x56f94a=_0x596b[_0x2d910d];return _0x56f94a;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xb596('0x0'));var logger=require('../../config/logger')('routing');var client=jayson[_0xb596('0x1')][_0xb596('0x2')]({'port':0x2329});client[_0xb596('0x3')]=function(_0x20afe5,_0x345ea3){return new BPromise(function(_0x2e7ef1,_0x245348){return client[_0xb596('0x4')](_0x20afe5,_0x345ea3)[_0xb596('0x5')](function(_0x346a14){logger[_0xb596('0x6')]('rpc',_0xb596('0x7'),_0x20afe5,_0x345ea3,_0x346a14);if(_0x346a14[_0xb596('0x8')]){logger[_0xb596('0x8')](_0xb596('0x9'),'routing',_0x20afe5,_0x346a14['error'][_0xb596('0xa')],_0x345ea3);return _0x245348(_0x346a14[_0xb596('0x8')][_0xb596('0xa')]);}else{return _0x2e7ef1(_0x346a14['result']);}})[_0xb596('0xb')](function(_0x27e2d9){logger[_0xb596('0x8')](_0xb596('0x9'),_0xb596('0x7'),_0x20afe5,_0x27e2d9,_0x345ea3);return _0x245348(_0x27e2d9);});});};module[_0xb596('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index fa6f7d9..ba7c87a 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 _0xc4a8=['getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','getAgents','then','getIntervals'];(function(_0x9d806f,_0x486ab0){var _0x1fad91=function(_0x272db4){while(--_0x272db4){_0x9d806f['push'](_0x9d806f['shift']());}};_0x1fad91(++_0x486ab0);}(_0xc4a8,0x89));var _0x8c4a=function(_0x2ca703,_0x52ab3c){_0x2ca703=_0x2ca703-0x0;var _0x1a19a9=_0xc4a8[_0x2ca703];return _0x1a19a9;};'use strict';var BPromise=require(_0x8c4a('0x0'));var server=require(_0x8c4a('0x1'));var Realtime=require(_0x8c4a('0x2'));var user=require(_0x8c4a('0x3'));var interval=require(_0x8c4a('0x4'));var openchannelQueue=require(_0x8c4a('0x5'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x8c4a('0x6'));var faxQueue=require(_0x8c4a('0x7'));var whatsappQueue=require(_0x8c4a('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x8c4a('0x9')]()['then'](user[_0x8c4a('0xa')]())[_0x8c4a('0xb')](realtime['initAgents']())[_0x8c4a('0xb')](interval[_0x8c4a('0xc')]())['then'](realtime['initIntervals']())[_0x8c4a('0xb')](openchannelQueue[_0x8c4a('0xd')]())[_0x8c4a('0xb')](realtime[_0x8c4a('0xe')]())[_0x8c4a('0xb')](chatQueue[_0x8c4a('0xf')]())['then'](realtime[_0x8c4a('0x10')]())[_0x8c4a('0xb')](smsQueue[_0x8c4a('0x11')]())[_0x8c4a('0xb')](realtime[_0x8c4a('0x12')]())[_0x8c4a('0xb')](mailQueue['getMailQueues']())['then'](realtime[_0x8c4a('0x13')]())[_0x8c4a('0xb')](faxQueue[_0x8c4a('0x14')]())['then'](realtime[_0x8c4a('0x15')]())[_0x8c4a('0xb')](whatsappQueue[_0x8c4a('0x16')]())['then'](realtime[_0x8c4a('0x17')]())[_0x8c4a('0xb')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x8c4a('0xb')](function(_0x45dab4){return initRealtime();})['then'](function(_0x1cf913){return setInterval(initRealtime,0x1388);})['catch'](function(_0x4d9f70){console[_0x8c4a('0x18')](_0x4d9f70);});}main(); \ No newline at end of file +var _0x3535=['then','getAgents','initAgents','getIntervals','getOpenchannelQueues','getChatQueues','getSmsQueues','initSmsQueues','getMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve'];(function(_0x86c0,_0x33c6ef){var _0x1cfd10=function(_0x1c2331){while(--_0x1c2331){_0x86c0['push'](_0x86c0['shift']());}};_0x1cfd10(++_0x33c6ef);}(_0x3535,0x1db));var _0x5353=function(_0x1aac2f,_0x126280){_0x1aac2f=_0x1aac2f-0x0;var _0x4debbd=_0x3535[_0x1aac2f];return _0x4debbd;};'use strict';var BPromise=require(_0x5353('0x0'));var server=require('./server');var Realtime=require(_0x5353('0x1'));var user=require(_0x5353('0x2'));var interval=require(_0x5353('0x3'));var openchannelQueue=require(_0x5353('0x4'));var chatQueue=require(_0x5353('0x5'));var smsQueue=require(_0x5353('0x6'));var mailQueue=require(_0x5353('0x7'));var faxQueue=require(_0x5353('0x8'));var whatsappQueue=require(_0x5353('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x5353('0xa')]()[_0x5353('0xb')](user[_0x5353('0xc')]())[_0x5353('0xb')](realtime[_0x5353('0xd')]())[_0x5353('0xb')](interval[_0x5353('0xe')]())[_0x5353('0xb')](realtime['initIntervals']())[_0x5353('0xb')](openchannelQueue[_0x5353('0xf')]())[_0x5353('0xb')](realtime['initOpenchannelQueues']())[_0x5353('0xb')](chatQueue[_0x5353('0x10')]())[_0x5353('0xb')](realtime['initChatQueues']())[_0x5353('0xb')](smsQueue[_0x5353('0x11')]())['then'](realtime[_0x5353('0x12')]())['then'](mailQueue[_0x5353('0x13')]())['then'](realtime['initMailQueues']())['then'](faxQueue[_0x5353('0x14')]())[_0x5353('0xb')](realtime[_0x5353('0x15')]())[_0x5353('0xb')](whatsappQueue[_0x5353('0x16')]())['then'](realtime[_0x5353('0x17')]())['then'](function(){return realtime;});}function main(){return server[_0x5353('0x18')](realtime)[_0x5353('0xb')](function(_0x3ff321){return initRealtime();})[_0x5353('0xb')](function(_0x21d6bf){return setInterval(initRealtime,0x1388);})[_0x5353('0x19')](function(_0x34eef9){console[_0x5353('0x1a')](_0x34eef9);});}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 cf4ef9c..4818bd4 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 _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x217706,_0x2d6f90){var _0x159670=function(_0x423cd7){while(--_0x423cd7){_0x217706['push'](_0x217706['shift']());}};_0x159670(++_0x2d6f90);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xc4aa[_0x4d613c];return _0x301fe3;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file +var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x510057,_0x52ee6f){var _0x5d4539=function(_0x372039){while(--_0x372039){_0x510057['push'](_0x510057['shift']());}};_0x5d4539(++_0x52ee6f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xc4aa[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index d3b2c0d..004a923 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 _0xa0cc=['bluebird','jayson/promise','client','then','error','message','SendMail'];(function(_0xe7955b,_0xa67a96){var _0x4383bf=function(_0x2ec671){while(--_0x2ec671){_0xe7955b['push'](_0xe7955b['shift']());}};_0x4383bf(++_0xa67a96);}(_0xa0cc,0x1c0));var _0xca0c=function(_0x33ad42,_0x4b421b){_0x33ad42=_0x33ad42-0x0;var _0x5478e9=_0xa0cc[_0x33ad42];return _0x5478e9;};'use strict';var BPromise=require(_0xca0c('0x0'));var jayson=require(_0xca0c('0x1'));var client=jayson[_0xca0c('0x2')]['http']({'port':0x232b});function request(_0x548961,_0x4a437c){return new BPromise(function(_0x43bb3c,_0x40e8a2){return client['request'](_0x548961,_0x4a437c)[_0xca0c('0x3')](function(_0x3480a6){if(_0x3480a6[_0xca0c('0x4')]){return _0x40e8a2(_0x3480a6[_0xca0c('0x4')][_0xca0c('0x5')]);}else{return _0x43bb3c(_0x3480a6['result']);}})['catch'](function(_0xf7a1b9){return _0x40e8a2(_0xf7a1b9);});});}exports['sendMailMessage']=function(_0x4ffc46,_0x53b340){return request(_0xca0c('0x6'),{'account':_0x4ffc46,'message':_0x53b340});}; \ No newline at end of file +var _0x67cf=['error','result','catch','bluebird','jayson/promise','client','request','then'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x67cf,0x1b3));var _0xf67c=function(_0x51b661,_0x566ef8){_0x51b661=_0x51b661-0x0;var _0x5d1971=_0x67cf[_0x51b661];return _0x5d1971;};'use strict';var BPromise=require(_0xf67c('0x0'));var jayson=require(_0xf67c('0x1'));var client=jayson[_0xf67c('0x2')]['http']({'port':0x232b});function request(_0x230085,_0xabb3dd){return new BPromise(function(_0x46d8b7,_0x4612df){return client[_0xf67c('0x3')](_0x230085,_0xabb3dd)[_0xf67c('0x4')](function(_0x125987){if(_0x125987['error']){return _0x4612df(_0x125987[_0xf67c('0x5')]['message']);}else{return _0x46d8b7(_0x125987[_0xf67c('0x6')]);}})[_0xf67c('0x7')](function(_0x8db019){return _0x4612df(_0x8db019);});});}exports['sendMailMessage']=function(_0x8035de,_0x170031){return request('SendMail',{'account':_0x8035de,'message':_0x170031});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 34e09b8..6c51cd2 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 _0x35fc=['whatsappStatus','stringify','emit','user:save','exports','lodash','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','voicePause','chatPause','mailPause','smsPause','openchannelPause','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','md5','updateRealtime','prototype','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax','length','getChannelStatus','Status','StatusTime','toNumber','format','online','chatStatus','mailStatusTime','faxStatusTime','faxCurrentCapacity'];(function(_0x1c085c,_0x14880c){var _0x27695a=function(_0x15bbe7){while(--_0x15bbe7){_0x1c085c['push'](_0x1c085c['shift']());}};_0x27695a(++_0x14880c);}(_0x35fc,0x7f));var _0xc35f=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x35fc[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xc35f('0x0'));var moment=require(_0xc35f('0x1'));var md5=require('md5');var Redis=require(_0xc35f('0x2'));var config=require(_0xc35f('0x3'));config[_0xc35f('0x4')]=_[_0xc35f('0x5')](config[_0xc35f('0x4')],{'host':_0xc35f('0x6'),'port':0x18eb});var io=require(_0xc35f('0x7'))(new Redis(config[_0xc35f('0x4')]));function Agent(_0x2624ca){this['id']=_0x2624ca['id']||0x0;this[_0xc35f('0x8')]=_0x2624ca[_0xc35f('0x8')]||'';this['online']=_0x2624ca['online']||!![];this[_0xc35f('0x9')]=_0x2624ca[_0xc35f('0x9')]||![];this[_0xc35f('0xa')]=_0x2624ca[_0xc35f('0xa')]||![];this[_0xc35f('0xb')]=_0x2624ca['mailPause']||![];this['faxPause']=_0x2624ca['faxPause']||![];this[_0xc35f('0xc')]=_0x2624ca[_0xc35f('0xc')]||![];this['openchannelPause']=_0x2624ca[_0xc35f('0xd')]||![];this['chatStatus']='unknown';this[_0xc35f('0xe')]=0x0;this[_0xc35f('0xf')]=_0x2624ca[_0xc35f('0xf')]||0x0;this[_0xc35f('0x10')]=0x0;this[_0xc35f('0x11')]=_0xc35f('0x12');this['mailStatusTime']=0x0;this[_0xc35f('0x13')]=_0x2624ca[_0xc35f('0x13')]||0x0;this[_0xc35f('0x14')]=0x0;this[_0xc35f('0x15')]='unknown';this['faxStatusTime']=0x0;this['faxCapacity']=_0x2624ca[_0xc35f('0x16')]||0x0;this['faxCurrentCapacity']=0x0;this[_0xc35f('0x17')]='unknown';this[_0xc35f('0x18')]=0x0;this[_0xc35f('0x19')]=_0x2624ca[_0xc35f('0x19')]||0x0;this[_0xc35f('0x1a')]=0x0;this['whatsappStatus']='unknown';this[_0xc35f('0x1b')]=0x0;this[_0xc35f('0x1c')]=_0x2624ca[_0xc35f('0x1c')]||0x0;this['whatsappCurrentCapacity']=0x0;this['openchannelStatus']=_0xc35f('0x12');this[_0xc35f('0x1d')]=0x0;this[_0xc35f('0x1e')]=_0x2624ca['openchannelCapacity']||0x0;this[_0xc35f('0x1f')]=0x0;this[_0xc35f('0x20')]=![];this[_0xc35f('0x21')]=undefined;this[_0xc35f('0x22')]='';this[_0xc35f('0x23')]();}Agent[_0xc35f('0x24')]['getChannelStatus']=function(_0x43120d){if(this[_0x43120d+'CurrentCapacity']>0x0){if(this[_0x43120d+'Capacity']>0x0&&this[_0x43120d+'CurrentCapacity']>=this[_0x43120d+_0xc35f('0x25')]){return _0xc35f('0x26');}else{return _0xc35f('0x27');}}else{return _0xc35f('0x28');}};Agent[_0xc35f('0x24')]['updateRealtime']=function(){var _0x55c29c=[_0xc35f('0x29'),_0xc35f('0x2a'),_0xc35f('0x2b'),_0xc35f('0x2c'),'sms','whatsapp'];for(var _0x2ad120=0x0;_0x2ad120<_0x55c29c[_0xc35f('0x2d')];_0x2ad120+=0x1){var _0x194300=this[_0xc35f('0x2e')](_0x55c29c[_0x2ad120]);if(this[_0x55c29c[_0x2ad120]+_0xc35f('0x2f')]!==_0x194300){this[_0x55c29c[_0x2ad120]+_0xc35f('0x30')]=_[_0xc35f('0x31')](moment()[_0xc35f('0x32')]('x'));}this[_0x55c29c[_0x2ad120]+'Status']=_0x194300;}var _0x5c314e={'id':this['id'],'name':this[_0xc35f('0x8')],'online':this[_0xc35f('0x33')],'voicePause':this[_0xc35f('0x9')],'chatPause':this[_0xc35f('0xa')],'mailPause':this[_0xc35f('0xb')],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0xc35f('0x34')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0xc35f('0xf')],'chatCurrentCapacity':this[_0xc35f('0x10')],'mailStatus':this[_0xc35f('0x11')],'mailStatusTime':this[_0xc35f('0x35')],'mailCapacity':this[_0xc35f('0x13')],'mailCurrentCapacity':this[_0xc35f('0x14')],'faxStatus':this[_0xc35f('0x15')],'faxStatusTime':this[_0xc35f('0x36')],'faxCapacity':this[_0xc35f('0x16')],'faxCurrentCapacity':this[_0xc35f('0x37')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xc35f('0x18')],'smsCapacity':this[_0xc35f('0x19')],'smsCurrentCapacity':this[_0xc35f('0x1a')],'whatsappStatus':this[_0xc35f('0x38')],'whatsappStatusTime':this[_0xc35f('0x1b')],'whatsappCapacity':this[_0xc35f('0x1c')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xc35f('0x1d')],'openchannelCapacity':this[_0xc35f('0x1e')],'openchannelCurrentCapacity':this[_0xc35f('0x1f')],'busy':this['busy'],'busyQueue':this['busyQueue']};var _0x4102e0=md5(JSON[_0xc35f('0x39')](_0x5c314e));if(this[_0xc35f('0x22')]!==_0x4102e0){this[_0xc35f('0x22')]=_0x4102e0;io[_0xc35f('0x3a')](_0xc35f('0x3b'),_0x5c314e);}};module[_0xc35f('0x3c')]=Agent; \ No newline at end of file +var _0x09b0=['toNumber','format','Status','mailStatus','faxStatusTime','smsStatus','smsStatusTime','openchannelCurrentCapacity','emit','user:save','exports','lodash','md5','../../../config/environment','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','unknown','faxCapacity','faxCurrentCapacity','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','busy','busyQueue','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','length','StatusTime'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x09b0,0x1f3));var _0x009b=function(_0x3ccc74,_0x187285){_0x3ccc74=_0x3ccc74-0x0;var _0x1e4a90=_0x09b0[_0x3ccc74];return _0x1e4a90;};'use strict';var _=require(_0x009b('0x0'));var moment=require('moment');var md5=require(_0x009b('0x1'));var Redis=require('ioredis');var config=require(_0x009b('0x2'));config['redis']=_['defaults'](config[_0x009b('0x3')],{'host':_0x009b('0x4'),'port':0x18eb});var io=require(_0x009b('0x5'))(new Redis(config['redis']));function Agent(_0x2ba814){this['id']=_0x2ba814['id']||0x0;this[_0x009b('0x6')]=_0x2ba814['name']||'';this[_0x009b('0x7')]=_0x2ba814[_0x009b('0x7')]||!![];this[_0x009b('0x8')]=_0x2ba814[_0x009b('0x8')]||![];this[_0x009b('0x9')]=_0x2ba814[_0x009b('0x9')]||![];this[_0x009b('0xa')]=_0x2ba814[_0x009b('0xa')]||![];this[_0x009b('0xb')]=_0x2ba814[_0x009b('0xb')]||![];this[_0x009b('0xc')]=_0x2ba814[_0x009b('0xc')]||![];this[_0x009b('0xd')]=_0x2ba814[_0x009b('0xd')]||![];this[_0x009b('0xe')]='unknown';this[_0x009b('0xf')]=0x0;this[_0x009b('0x10')]=_0x2ba814[_0x009b('0x10')]||0x0;this[_0x009b('0x11')]=0x0;this['mailStatus']='unknown';this[_0x009b('0x12')]=0x0;this[_0x009b('0x13')]=_0x2ba814[_0x009b('0x13')]||0x0;this[_0x009b('0x14')]=0x0;this[_0x009b('0x15')]=_0x009b('0x16');this['faxStatusTime']=0x0;this['faxCapacity']=_0x2ba814[_0x009b('0x17')]||0x0;this[_0x009b('0x18')]=0x0;this['smsStatus']='unknown';this['smsStatusTime']=0x0;this[_0x009b('0x19')]=_0x2ba814[_0x009b('0x19')]||0x0;this[_0x009b('0x1a')]=0x0;this[_0x009b('0x1b')]=_0x009b('0x16');this[_0x009b('0x1c')]=0x0;this[_0x009b('0x1d')]=_0x2ba814[_0x009b('0x1d')]||0x0;this[_0x009b('0x1e')]=0x0;this[_0x009b('0x1f')]=_0x009b('0x16');this['openchannelStatusTime']=0x0;this[_0x009b('0x20')]=_0x2ba814[_0x009b('0x20')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x009b('0x21')]=![];this[_0x009b('0x22')]=undefined;this[_0x009b('0x1')]='';this[_0x009b('0x23')]();}Agent['prototype'][_0x009b('0x24')]=function(_0x147f20){if(this[_0x147f20+_0x009b('0x25')]>0x0){if(this[_0x147f20+_0x009b('0x26')]>0x0&&this[_0x147f20+_0x009b('0x25')]>=this[_0x147f20+_0x009b('0x26')]){return _0x009b('0x27');}else{return _0x009b('0x28');}}else{return _0x009b('0x29');}};Agent['prototype'][_0x009b('0x23')]=function(){var _0x337fa5=[_0x009b('0x2a'),_0x009b('0x2b'),_0x009b('0x2c'),_0x009b('0x2d'),_0x009b('0x2e'),_0x009b('0x2f')];for(var _0x287a52=0x0;_0x287a52<_0x337fa5[_0x009b('0x30')];_0x287a52+=0x1){var _0x8f7008=this['getChannelStatus'](_0x337fa5[_0x287a52]);if(this[_0x337fa5[_0x287a52]+'Status']!==_0x8f7008){this[_0x337fa5[_0x287a52]+_0x009b('0x31')]=_[_0x009b('0x32')](moment()[_0x009b('0x33')]('x'));}this[_0x337fa5[_0x287a52]+_0x009b('0x34')]=_0x8f7008;}var _0x200075={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this['voicePause'],'chatPause':this[_0x009b('0x9')],'mailPause':this[_0x009b('0xa')],'smsPause':this[_0x009b('0xc')],'faxPause':this[_0x009b('0xb')],'openchannelPause':this[_0x009b('0xd')],'chatStatus':this[_0x009b('0xe')],'chatStatusTime':this[_0x009b('0xf')],'chatCapacity':this[_0x009b('0x10')],'chatCurrentCapacity':this[_0x009b('0x11')],'mailStatus':this[_0x009b('0x35')],'mailStatusTime':this[_0x009b('0x12')],'mailCapacity':this[_0x009b('0x13')],'mailCurrentCapacity':this[_0x009b('0x14')],'faxStatus':this[_0x009b('0x15')],'faxStatusTime':this[_0x009b('0x36')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x009b('0x18')],'smsStatus':this[_0x009b('0x37')],'smsStatusTime':this[_0x009b('0x38')],'smsCapacity':this[_0x009b('0x19')],'smsCurrentCapacity':this[_0x009b('0x1a')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x009b('0x1c')],'whatsappCapacity':this[_0x009b('0x1d')],'whatsappCurrentCapacity':this[_0x009b('0x1e')],'openchannelStatus':this[_0x009b('0x1f')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x009b('0x20')],'openchannelCurrentCapacity':this[_0x009b('0x39')],'busy':this['busy'],'busyQueue':this[_0x009b('0x22')]};var _0x358a4d=md5(JSON['stringify'](_0x200075));if(this[_0x009b('0x1')]!==_0x358a4d){this['md5']=_0x358a4d;io[_0x009b('0x3a')](_0x009b('0x3b'),_0x200075);}};module[_0x009b('0x3c')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 412df84..1effcaf 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 _0x94d6=['lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','chatPause','available','stringify','emit','chat_queue:save'];(function(_0x97d1b4,_0x279adf){var _0x118e30=function(_0x5a893e){while(--_0x5a893e){_0x97d1b4['push'](_0x97d1b4['shift']());}};_0x118e30(++_0x279adf);}(_0x94d6,0xa2));var _0x694d=function(_0x467886,_0x341b0e){_0x467886=_0x467886-0x0;var _0x4dede8=_0x94d6[_0x467886];return _0x4dede8;};'use strict';var _=require(_0x694d('0x0'));var md5=require(_0x694d('0x1'));var util=require('util');var Redis=require(_0x694d('0x2'));var config=require(_0x694d('0x3'));config[_0x694d('0x4')]=_[_0x694d('0x5')](config[_0x694d('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x694d('0x6'))(new Redis(config[_0x694d('0x4')]));function ChatQueue(_0x39d6b1){this['id']=_0x39d6b1['id']||0x0;this['name']=_0x39d6b1[_0x694d('0x7')]||'';this[_0x694d('0x8')]=_0x39d6b1[_0x694d('0x8')]||0xa;this[_0x694d('0x9')]=_0x39d6b1['strategy']||_0x694d('0xa');this['Agents']=_0x39d6b1[_0x694d('0xb')];this[_0x694d('0xc')]={};this[_0x694d('0xd')]=0x0;this[_0x694d('0x1')]='';this['updateRouting']();this[_0x694d('0xe')]();}ChatQueue[_0x694d('0xf')]['updateRouting']=function(){var _0x2f03d1=this[_0x694d('0xc')][_0x694d('0x10')];this[_0x694d('0xc')]=_[_0x694d('0x11')](this['Agents'],'id');this['mapAgentsId'][_0x694d('0x10')]=_0x2f03d1;};ChatQueue[_0x694d('0xf')][_0x694d('0xe')]=function(){this[_0x694d('0x12')]=0x0;this[_0x694d('0x13')]=0x0;for(var _0x3a0622=0x0;_0x3a0622=0x0?this[_0x694d('0x17')]:0x0;var _0x4eff3a={'id':this['id'],'available':this['available'],'loggedIn':this[_0x694d('0x12')],'name':this[_0x694d('0x7')],'paused':this['paused'],'waiting':this[_0x694d('0xd')]};var _0xbeeac=md5(JSON[_0x694d('0x18')](_0x4eff3a));if(this[_0x694d('0x1')]!==_0xbeeac){this['md5']=_0xbeeac;io['to'](util['format']('chat:queue:%s',_0x4eff3a['name']))[_0x694d('0x19')](_0x694d('0x1a'),_0x4eff3a);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x113a=['paused','chat:queue:%s','chat_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRealtime','prototype','mapAgentsId','_rr','length','chatPause','available','loggedIn'];(function(_0x2b2ef0,_0x3decc9){var _0x27125b=function(_0x19b9b2){while(--_0x19b9b2){_0x2b2ef0['push'](_0x2b2ef0['shift']());}};_0x27125b(++_0x3decc9);}(_0x113a,0xfd));var _0xa113=function(_0x1322bd,_0x38fecf){_0x1322bd=_0x1322bd-0x0;var _0x9d9aff=_0x113a[_0x1322bd];return _0x9d9aff;};'use strict';var _=require(_0xa113('0x0'));var md5=require(_0xa113('0x1'));var util=require(_0xa113('0x2'));var Redis=require(_0xa113('0x3'));var config=require(_0xa113('0x4'));config[_0xa113('0x5')]=_[_0xa113('0x6')](config[_0xa113('0x5')],{'host':_0xa113('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa113('0x5')]));function ChatQueue(_0x2b026e){this['id']=_0x2b026e['id']||0x0;this['name']=_0x2b026e[_0xa113('0x8')]||'';this[_0xa113('0x9')]=_0x2b026e['timeout']||0xa;this[_0xa113('0xa')]=_0x2b026e['strategy']||_0xa113('0xb');this[_0xa113('0xc')]=_0x2b026e['Agents'];this['mapAgentsId']={};this[_0xa113('0xd')]=0x0;this['md5']='';this['updateRouting']();this[_0xa113('0xe')]();}ChatQueue[_0xa113('0xf')]['updateRouting']=function(){var _0x24f58a=this[_0xa113('0x10')]['_rr'];this[_0xa113('0x10')]=_['map'](this[_0xa113('0xc')],'id');this[_0xa113('0x10')][_0xa113('0x11')]=_0x24f58a;};ChatQueue[_0xa113('0xf')]['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x2a5a6a=0x0;_0x2a5a6a=0x0?this['available']:0x0;var _0x100cfa={'id':this['id'],'available':this['available'],'loggedIn':this[_0xa113('0x15')],'name':this['name'],'paused':this['paused'],'waiting':this[_0xa113('0xd')]};var _0x13169c=md5(JSON['stringify'](_0x100cfa));if(this[_0xa113('0x1')]!==_0x13169c){this['md5']=_0x13169c;io['to'](util['format'](_0xa113('0x17'),_0x100cfa['name']))['emit'](_0xa113('0x18'),_0x100cfa);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 050ceff..bd9133d 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 _0x99f3=['timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','faxPause','available','format','fax:queue:%s','fax_queue:save','md5','util','defaults','localhost','redis','name'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x99f3,0x1a3));var _0x399f=function(_0x329664,_0x130748){_0x329664=_0x329664-0x0;var _0x4e346e=_0x99f3[_0x329664];return _0x4e346e;};'use strict';var _=require('lodash');var md5=require(_0x399f('0x0'));var util=require(_0x399f('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0x399f('0x2')](config['redis'],{'host':_0x399f('0x3'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x399f('0x4')]));function FaxQueue(_0x24c392){this['id']=_0x24c392['id']||0x0;this[_0x399f('0x5')]=_0x24c392[_0x399f('0x5')]||'';this[_0x399f('0x6')]=_0x24c392['timeout']||0xa;this[_0x399f('0x7')]=_0x24c392['strategy']||_0x399f('0x8');this[_0x399f('0x9')]=_0x24c392['Agents'];this[_0x399f('0xa')]={};this['waiting']=0x0;this[_0x399f('0x0')]='';this[_0x399f('0xb')]();this[_0x399f('0xc')]();}FaxQueue[_0x399f('0xd')][_0x399f('0xb')]=function(){var _0x56d358=this[_0x399f('0xa')][_0x399f('0xe')];this[_0x399f('0xa')]=_[_0x399f('0xf')](this[_0x399f('0x9')],'id');this[_0x399f('0xa')][_0x399f('0xe')]=_0x56d358;};FaxQueue['prototype'][_0x399f('0xc')]=function(){this[_0x399f('0x10')]=0x0;this[_0x399f('0x11')]=0x0;for(var _0x4a0de0=0x0;_0x4a0de0=0x0?this[_0x399f('0x15')]:0x0;var _0x56ecd9={'id':this['id'],'available':this[_0x399f('0x15')],'loggedIn':this[_0x399f('0x10')],'name':this['name'],'paused':this[_0x399f('0x11')],'waiting':this['waiting']};var _0x40cbe2=md5(JSON['stringify'](_0x56ecd9));if(this[_0x399f('0x0')]!==_0x40cbe2){this[_0x399f('0x0')]=_0x40cbe2;io['to'](util[_0x399f('0x16')](_0x399f('0x17'),_0x56ecd9['name']))['emit'](_0x399f('0x18'),_0x56ecd9);}};module['exports']=FaxQueue; \ No newline at end of file +var _0x9433=['localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','online','faxPause','available','waiting','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','../../../config/environment','redis','defaults'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9433,0x91));var _0x3943=function(_0x58db65,_0x21499e){_0x58db65=_0x58db65-0x0;var _0x2ba06e=_0x9433[_0x58db65];return _0x2ba06e;};'use strict';var _=require(_0x3943('0x0'));var md5=require(_0x3943('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x3943('0x2'));config[_0x3943('0x3')]=_[_0x3943('0x4')](config[_0x3943('0x3')],{'host':_0x3943('0x5'),'port':0x18eb});var io=require(_0x3943('0x6'))(new Redis(config[_0x3943('0x3')]));function FaxQueue(_0x34a61b){this['id']=_0x34a61b['id']||0x0;this['name']=_0x34a61b[_0x3943('0x7')]||'';this[_0x3943('0x8')]=_0x34a61b[_0x3943('0x8')]||0xa;this[_0x3943('0x9')]=_0x34a61b[_0x3943('0x9')]||_0x3943('0xa');this['Agents']=_0x34a61b[_0x3943('0xb')];this[_0x3943('0xc')]={};this['waiting']=0x0;this[_0x3943('0x1')]='';this[_0x3943('0xd')]();this[_0x3943('0xe')]();}FaxQueue[_0x3943('0xf')]['updateRouting']=function(){var _0x30d35d=this[_0x3943('0xc')][_0x3943('0x10')];this[_0x3943('0xc')]=_[_0x3943('0x11')](this[_0x3943('0xb')],'id');this[_0x3943('0xc')][_0x3943('0x10')]=_0x30d35d;};FaxQueue['prototype']['updateRealtime']=function(){this[_0x3943('0x12')]=0x0;this[_0x3943('0x13')]=0x0;for(var _0x180c2e=0x0;_0x180c2e=0x0?this[_0x3943('0x16')]:0x0;var _0x36c26e={'id':this['id'],'available':this[_0x3943('0x16')],'loggedIn':this[_0x3943('0x12')],'name':this['name'],'paused':this[_0x3943('0x13')],'waiting':this[_0x3943('0x17')]};var _0x537f57=md5(JSON[_0x3943('0x18')](_0x36c26e));if(this[_0x3943('0x1')]!==_0x537f57){this['md5']=_0x537f57;io['to'](util[_0x3943('0x19')](_0x3943('0x1a'),_0x36c26e['name']))[_0x3943('0x1b')](_0x3943('0x1c'),_0x36c26e);}};module[_0x3943('0x1d')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index f3e452f..5a4f7af 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 _0x0c71=['exports','Intervals'];(function(_0x468857,_0x2f4090){var _0x1ab002=function(_0x450dac){while(--_0x450dac){_0x468857['push'](_0x468857['shift']());}};_0x1ab002(++_0x2f4090);}(_0x0c71,0xd7));var _0x10c7=function(_0x2ea738,_0x17d6a9){_0x2ea738=_0x2ea738-0x0;var _0x46acd0=_0x0c71[_0x2ea738];return _0x46acd0;};'use strict';function Interval(_0x5dad24){this['id']=_0x5dad24['id']||0x0;this['name']=_0x5dad24['name']||'';this[_0x10c7('0x0')]=_0x5dad24['Intervals']||{};}module[_0x10c7('0x1')]=Interval; \ No newline at end of file +var _0xa91f=['Intervals','name'];(function(_0x12e983,_0x4d8a7c){var _0x64f62f=function(_0x380dd2){while(--_0x380dd2){_0x12e983['push'](_0x12e983['shift']());}};_0x64f62f(++_0x4d8a7c);}(_0xa91f,0x107));var _0xfa91=function(_0x369acc,_0x58fd06){_0x369acc=_0x369acc-0x0;var _0xc57597=_0xa91f[_0x369acc];return _0xc57597;};'use strict';function Interval(_0x2a15b1){this['id']=_0x2a15b1['id']||0x0;this['name']=_0x2a15b1[_0xfa91('0x0')]||'';this[_0xfa91('0x1')]=_0x2a15b1[_0xfa91('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 409f992..6acd13d 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 _0x2b63=['name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','online','available','format','mail_queue:save','exports','lodash','md5','util','ioredis','defaults','redis','localhost'];(function(_0x19dc2c,_0x2709ab){var _0x34949a=function(_0x8d94af){while(--_0x8d94af){_0x19dc2c['push'](_0x19dc2c['shift']());}};_0x34949a(++_0x2709ab);}(_0x2b63,0x13d));var _0x32b6=function(_0x3b8326,_0x212581){_0x3b8326=_0x3b8326-0x0;var _0x160763=_0x2b63[_0x3b8326];return _0x160763;};'use strict';var _=require(_0x32b6('0x0'));var md5=require(_0x32b6('0x1'));var util=require(_0x32b6('0x2'));var Redis=require(_0x32b6('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x32b6('0x4')](config[_0x32b6('0x5')],{'host':_0x32b6('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function MailQueue(_0x29c735){this['id']=_0x29c735['id']||0x0;this[_0x32b6('0x7')]=_0x29c735['name']||'';this[_0x32b6('0x8')]=_0x29c735[_0x32b6('0x8')]||0xa;this[_0x32b6('0x9')]=_0x29c735[_0x32b6('0x9')]||_0x32b6('0xa');this[_0x32b6('0xb')]=_0x29c735[_0x32b6('0xb')];this[_0x32b6('0xc')]={};this[_0x32b6('0xd')]=0x0;this[_0x32b6('0x1')]='';this[_0x32b6('0xe')]();this[_0x32b6('0xf')]();}MailQueue[_0x32b6('0x10')][_0x32b6('0xe')]=function(){var _0x343e7a=this[_0x32b6('0xc')]['_rr'];this[_0x32b6('0xc')]=_[_0x32b6('0x11')](this[_0x32b6('0xb')],'id');this['mapAgentsId'][_0x32b6('0x12')]=_0x343e7a;};MailQueue[_0x32b6('0x10')][_0x32b6('0xf')]=function(){this[_0x32b6('0x13')]=0x0;this[_0x32b6('0x14')]=0x0;for(var _0x22d155=0x0;_0x22d155=0x0?this['available']:0x0;var _0x225b6d={'id':this['id'],'available':this[_0x32b6('0x17')],'loggedIn':this[_0x32b6('0x13')],'name':this['name'],'paused':this[_0x32b6('0x14')],'waiting':this[_0x32b6('0xd')]};var _0x53f003=md5(JSON['stringify'](_0x225b6d));if(this['md5']!==_0x53f003){this[_0x32b6('0x1')]=_0x53f003;io['to'](util[_0x32b6('0x18')]('mail:queue:%s',_0x225b6d[_0x32b6('0x7')]))['emit'](_0x32b6('0x19'),_0x225b6d);}};module[_0x32b6('0x1a')]=MailQueue; \ No newline at end of file +var _0x0422=['map','updateRealtime','paused','length','online','loggedIn','mailPause','available','stringify','mail:queue:%s','emit','mail_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr'];(function(_0x5d6c3e,_0x409a3e){var _0x44ecb7=function(_0x936b6a){while(--_0x936b6a){_0x5d6c3e['push'](_0x5d6c3e['shift']());}};_0x44ecb7(++_0x409a3e);}(_0x0422,0x66));var _0x2042=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x0422[_0x47fd36];return _0x21a0fc;};'use strict';var _=require(_0x2042('0x0'));var md5=require(_0x2042('0x1'));var util=require(_0x2042('0x2'));var Redis=require(_0x2042('0x3'));var config=require(_0x2042('0x4'));config[_0x2042('0x5')]=_[_0x2042('0x6')](config[_0x2042('0x5')],{'host':_0x2042('0x7'),'port':0x18eb});var io=require(_0x2042('0x8'))(new Redis(config[_0x2042('0x5')]));function MailQueue(_0x5a2cd2){this['id']=_0x5a2cd2['id']||0x0;this[_0x2042('0x9')]=_0x5a2cd2[_0x2042('0x9')]||'';this[_0x2042('0xa')]=_0x5a2cd2[_0x2042('0xa')]||0xa;this[_0x2042('0xb')]=_0x5a2cd2[_0x2042('0xb')]||_0x2042('0xc');this[_0x2042('0xd')]=_0x5a2cd2['Agents'];this[_0x2042('0xe')]={};this[_0x2042('0xf')]=0x0;this['md5']='';this[_0x2042('0x10')]();this['updateRealtime']();}MailQueue['prototype'][_0x2042('0x10')]=function(){var _0x41b7f5=this['mapAgentsId'][_0x2042('0x11')];this[_0x2042('0xe')]=_[_0x2042('0x12')](this['Agents'],'id');this['mapAgentsId'][_0x2042('0x11')]=_0x41b7f5;};MailQueue['prototype'][_0x2042('0x13')]=function(){this['loggedIn']=0x0;this[_0x2042('0x14')]=0x0;for(var _0x2c601d=0x0;_0x2c601d=0x0?this[_0x2042('0x19')]:0x0;var _0x268d96={'id':this['id'],'available':this['available'],'loggedIn':this[_0x2042('0x17')],'name':this['name'],'paused':this[_0x2042('0x14')],'waiting':this[_0x2042('0xf')]};var _0xc5d9b8=md5(JSON[_0x2042('0x1a')](_0x268d96));if(this[_0x2042('0x1')]!==_0xc5d9b8){this[_0x2042('0x1')]=_0xc5d9b8;io['to'](util['format'](_0x2042('0x1b'),_0x268d96[_0x2042('0x9')]))[_0x2042('0x1c')](_0x2042('0x1d'),_0x268d96);}};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 4fdbb00..7838972 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc4aa[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0x1261=['available','stringify','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x25a42a,_0x3d489b){var _0x1129b1=function(_0x4ae61b){while(--_0x4ae61b){_0x25a42a['push'](_0x25a42a['shift']());}};_0x1129b1(++_0x3d489b);}(_0x1261,0x144));var _0x1126=function(_0x1347f8,_0x233feb){_0x1347f8=_0x1347f8-0x0;var _0x218368=_0x1261[_0x1347f8];return _0x218368;};'use strict';var _=require('lodash');var md5=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var Redis=require(_0x1126('0x2'));var config=require(_0x1126('0x3'));config[_0x1126('0x4')]=_[_0x1126('0x5')](config[_0x1126('0x4')],{'host':_0x1126('0x6'),'port':0x18eb});var io=require(_0x1126('0x7'))(new Redis(config[_0x1126('0x4')]));function OpenchannelQueue(_0x5a2189){this['id']=_0x5a2189['id']||0x0;this['name']=_0x5a2189[_0x1126('0x8')]||'';this[_0x1126('0x9')]=_0x5a2189['timeout']||0xa;this[_0x1126('0xa')]=_0x5a2189[_0x1126('0xa')]||_0x1126('0xb');this[_0x1126('0xc')]=_0x5a2189[_0x1126('0xc')];this['mapAgentsId']={};this[_0x1126('0xd')]=0x0;this[_0x1126('0x0')]='';this[_0x1126('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0x1126('0xf')]['updateRouting']=function(){var _0x52ef15=this[_0x1126('0x10')]['_rr'];this[_0x1126('0x10')]=_[_0x1126('0x11')](this[_0x1126('0xc')],'id');this[_0x1126('0x10')][_0x1126('0x12')]=_0x52ef15;};OpenchannelQueue[_0x1126('0xf')][_0x1126('0x13')]=function(){this[_0x1126('0x14')]=0x0;this[_0x1126('0x15')]=0x0;for(var _0x53a8f0=0x0;_0x53a8f0=0x0?this['available']:0x0;var _0x4d2b38={'id':this['id'],'available':this[_0x1126('0x18')],'loggedIn':this[_0x1126('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1126('0xd')]};var _0x58b109=md5(JSON[_0x1126('0x19')](_0x4d2b38));if(this[_0x1126('0x0')]!==_0x58b109){this[_0x1126('0x0')]=_0x58b109;io['to'](util['format'](_0x1126('0x1a'),_0x4d2b38['name']))['emit'](_0x1126('0x1b'),_0x4d2b38);}};module[_0x1126('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 5b60748..dc1be37 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 _0xb2b5=['md5','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','length','online','smsPause','available','paused','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0xba1760,_0x191969){var _0x1f3143=function(_0x5aa807){while(--_0x5aa807){_0xba1760['push'](_0xba1760['shift']());}};_0x1f3143(++_0x191969);}(_0xb2b5,0xa3));var _0x5b2b=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xb2b5[_0x17b6e3];return _0x3906f3;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require('ioredis');var config=require(_0x5b2b('0x0'));config[_0x5b2b('0x1')]=_['defaults'](config['redis'],{'host':_0x5b2b('0x2'),'port':0x18eb});var io=require(_0x5b2b('0x3'))(new Redis(config[_0x5b2b('0x1')]));function SmsQueue(_0x3c073f){this['id']=_0x3c073f['id']||0x0;this['name']=_0x3c073f[_0x5b2b('0x4')]||'';this[_0x5b2b('0x5')]=_0x3c073f['timeout']||0xa;this['strategy']=_0x3c073f[_0x5b2b('0x6')]||_0x5b2b('0x7');this[_0x5b2b('0x8')]=_0x3c073f[_0x5b2b('0x8')];this[_0x5b2b('0x9')]={};this[_0x5b2b('0xa')]=0x0;this[_0x5b2b('0xb')]='';this[_0x5b2b('0xc')]();this['updateRealtime']();}SmsQueue[_0x5b2b('0xd')][_0x5b2b('0xc')]=function(){var _0x53e4ca=this[_0x5b2b('0x9')][_0x5b2b('0xe')];this['mapAgentsId']=_[_0x5b2b('0xf')](this[_0x5b2b('0x8')],'id');this[_0x5b2b('0x9')][_0x5b2b('0xe')]=_0x53e4ca;};SmsQueue[_0x5b2b('0xd')][_0x5b2b('0x10')]=function(){this[_0x5b2b('0x11')]=0x0;this['paused']=0x0;for(var _0x30e9a3=0x0;_0x30e9a3=0x0?this['available']:0x0;var _0x13eaa1={'id':this['id'],'available':this[_0x5b2b('0x15')],'loggedIn':this[_0x5b2b('0x11')],'name':this[_0x5b2b('0x4')],'paused':this[_0x5b2b('0x16')],'waiting':this['waiting']};var _0x35b589=md5(JSON[_0x5b2b('0x17')](_0x13eaa1));if(this[_0x5b2b('0xb')]!==_0x35b589){this[_0x5b2b('0xb')]=_0x35b589;io['to'](util[_0x5b2b('0x18')](_0x5b2b('0x19'),_0x13eaa1[_0x5b2b('0x4')]))[_0x5b2b('0x1a')](_0x5b2b('0x1b'),_0x13eaa1);}};module[_0x5b2b('0x1c')]=SmsQueue; \ No newline at end of file +var _0x0834=['beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','map','_rr','online','loggedIn','smsPause','available','paused','stringify','sms:queue:%s','emit','sms_queue:save','exports','util','ioredis','redis','localhost','name','timeout','strategy'];(function(_0x2a9a83,_0xf716d0){var _0x14ff36=function(_0x239514){while(--_0x239514){_0x2a9a83['push'](_0x2a9a83['shift']());}};_0x14ff36(++_0xf716d0);}(_0x0834,0x18e));var _0x4083=function(_0x25b2f5,_0x4bcdab){_0x25b2f5=_0x25b2f5-0x0;var _0x305bcb=_0x0834[_0x25b2f5];return _0x305bcb;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x4083('0x0'));var Redis=require(_0x4083('0x1'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0x4083('0x2')],{'host':_0x4083('0x3'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4083('0x2')]));function SmsQueue(_0x32ea06){this['id']=_0x32ea06['id']||0x0;this['name']=_0x32ea06[_0x4083('0x4')]||'';this['timeout']=_0x32ea06[_0x4083('0x5')]||0xa;this[_0x4083('0x6')]=_0x32ea06[_0x4083('0x6')]||_0x4083('0x7');this[_0x4083('0x8')]=_0x32ea06[_0x4083('0x8')];this[_0x4083('0x9')]={};this[_0x4083('0xa')]=0x0;this[_0x4083('0xb')]='';this[_0x4083('0xc')]();this[_0x4083('0xd')]();}SmsQueue[_0x4083('0xe')][_0x4083('0xc')]=function(){var _0x5d6067=this[_0x4083('0x9')]['_rr'];this['mapAgentsId']=_[_0x4083('0xf')](this[_0x4083('0x8')],'id');this['mapAgentsId'][_0x4083('0x10')]=_0x5d6067;};SmsQueue[_0x4083('0xe')][_0x4083('0xd')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0xb5badb=0x0;_0xb5badb=0x0?this['available']:0x0;var _0x4d6089={'id':this['id'],'available':this[_0x4083('0x14')],'loggedIn':this[_0x4083('0x12')],'name':this['name'],'paused':this[_0x4083('0x15')],'waiting':this['waiting']};var _0x2ae9d5=md5(JSON[_0x4083('0x16')](_0x4d6089));if(this[_0x4083('0xb')]!==_0x2ae9d5){this[_0x4083('0xb')]=_0x2ae9d5;io['to'](util['format'](_0x4083('0x17'),_0x4d6089['name']))[_0x4083('0x18')](_0x4083('0x19'),_0x4d6089);}};module[_0x4083('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 5f18f98..614c88d 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 _0x983e=['strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','online','whatsappPause','available','stringify','md5','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout'];(function(_0x20ed42,_0x5f58dc){var _0x3a51a7=function(_0x5a4bfe){while(--_0x5a4bfe){_0x20ed42['push'](_0x20ed42['shift']());}};_0x3a51a7(++_0x5f58dc);}(_0x983e,0x92));var _0xe983=function(_0x181dc2,_0x1e96e5){_0x181dc2=_0x181dc2-0x0;var _0x35f6ed=_0x983e[_0x181dc2];return _0x35f6ed;};'use strict';var _=require(_0xe983('0x0'));var md5=require('md5');var util=require(_0xe983('0x1'));var Redis=require(_0xe983('0x2'));var config=require('../../../config/environment');config[_0xe983('0x3')]=_[_0xe983('0x4')](config[_0xe983('0x3')],{'host':_0xe983('0x5'),'port':0x18eb});var io=require(_0xe983('0x6'))(new Redis(config['redis']));function WhatsappQueue(_0x42b6f3){this['id']=_0x42b6f3['id']||0x0;this[_0xe983('0x7')]=_0x42b6f3[_0xe983('0x7')]||'';this[_0xe983('0x8')]=_0x42b6f3[_0xe983('0x8')]||0xa;this[_0xe983('0x9')]=_0x42b6f3[_0xe983('0x9')]||'beepall';this[_0xe983('0xa')]=_0x42b6f3['Agents'];this[_0xe983('0xb')]={};this[_0xe983('0xc')]=0x0;this['md5']='';this[_0xe983('0xd')]();this[_0xe983('0xe')]();}WhatsappQueue[_0xe983('0xf')][_0xe983('0xd')]=function(){var _0x1f3114=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0xe983('0x10')](this[_0xe983('0xa')],'id');this[_0xe983('0xb')][_0xe983('0x11')]=_0x1f3114;};WhatsappQueue['prototype'][_0xe983('0xe')]=function(){this[_0xe983('0x12')]=0x0;this[_0xe983('0x13')]=0x0;for(var _0x5cc68b=0x0;_0x5cc68b=0x0?this[_0xe983('0x17')]:0x0;var _0x180361={'id':this['id'],'available':this[_0xe983('0x17')],'loggedIn':this[_0xe983('0x12')],'name':this[_0xe983('0x7')],'paused':this[_0xe983('0x13')],'waiting':this[_0xe983('0xc')]};var _0x20960e=md5(JSON[_0xe983('0x18')](_0x180361));if(this[_0xe983('0x19')]!==_0x20960e){this[_0xe983('0x19')]=_0x20960e;io['to'](util[_0xe983('0x1a')](_0xe983('0x1b'),_0x180361[_0xe983('0x7')]))[_0xe983('0x1c')](_0xe983('0x1d'),_0x180361);}};module[_0xe983('0x1e')]=WhatsappQueue; \ No newline at end of file +var _0xfed4=['available','stringify','format','whatsapp:queue:%s','whatsapp_queue:save','exports','md5','util','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','paused','Agents','online','loggedIn','whatsappPause'];(function(_0x7ff50b,_0x399dc0){var _0x43e570=function(_0x16b092){while(--_0x16b092){_0x7ff50b['push'](_0x7ff50b['shift']());}};_0x43e570(++_0x399dc0);}(_0xfed4,0x158));var _0x4fed=function(_0x2ca5d2,_0xa91f39){_0x2ca5d2=_0x2ca5d2-0x0;var _0x2bae29=_0xfed4[_0x2ca5d2];return _0x2bae29;};'use strict';var _=require('lodash');var md5=require(_0x4fed('0x0'));var util=require(_0x4fed('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0x4fed('0x2')],{'host':_0x4fed('0x3'),'port':0x18eb});var io=require(_0x4fed('0x4'))(new Redis(config[_0x4fed('0x2')]));function WhatsappQueue(_0x368293){this['id']=_0x368293['id']||0x0;this[_0x4fed('0x5')]=_0x368293[_0x4fed('0x5')]||'';this[_0x4fed('0x6')]=_0x368293[_0x4fed('0x6')]||0xa;this[_0x4fed('0x7')]=_0x368293[_0x4fed('0x7')]||_0x4fed('0x8');this['Agents']=_0x368293['Agents'];this[_0x4fed('0x9')]={};this[_0x4fed('0xa')]=0x0;this[_0x4fed('0x0')]='';this[_0x4fed('0xb')]();this[_0x4fed('0xc')]();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x4e0b7e=this['mapAgentsId'][_0x4fed('0xd')];this[_0x4fed('0x9')]=_[_0x4fed('0xe')](this['Agents'],'id');this[_0x4fed('0x9')]['_rr']=_0x4e0b7e;};WhatsappQueue['prototype'][_0x4fed('0xc')]=function(){this['loggedIn']=0x0;this[_0x4fed('0xf')]=0x0;for(var _0x4b5c4a=0x0;_0x4b5c4a=0x0?this[_0x4fed('0x14')]:0x0;var _0x3a8120={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x4fed('0xf')],'waiting':this[_0x4fed('0xa')]};var _0x388e19=md5(JSON[_0x4fed('0x15')](_0x3a8120));if(this[_0x4fed('0x0')]!==_0x388e19){this[_0x4fed('0x0')]=_0x388e19;io['to'](util[_0x4fed('0x16')](_0x4fed('0x17'),_0x3a8120[_0x4fed('0x5')]))['emit'](_0x4fed('0x18'),_0x3a8120);}};module[_0x4fed('0x19')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 8c8ac32..88f98db 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x45554e,_0x2f89db){var _0x18c2aa=function(_0x109928){while(--_0x109928){_0x45554e['push'](_0x45554e['shift']());}};_0x18c2aa(++_0x2f89db);}(_0xb10b,0x12a));var _0xbb10=function(_0x5e24d7,_0x11218f){_0x5e24d7=_0x5e24d7-0x0;var _0x10063d=_0xb10b[_0x5e24d7];return _0x10063d;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index acef1d8..94277e4 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 _0xbe17=['addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x498784,_0x58af60){var _0x26238d=function(_0x2a48ed){while(--_0x2a48ed){_0x498784['push'](_0x498784['shift']());}};_0x26238d(++_0x58af60);}(_0xbe17,0xfb));var _0x7be1=function(_0x4042e8,_0x4aeb45){_0x4042e8=_0x4042e8-0x0;var _0x660e36=_0xbe17[_0x4042e8];return _0x660e36;};'use strict';var client=require(_0x7be1('0x0'));exports[_0x7be1('0x1')]=function(_0xd3265,_0x1ac9bb){return client[_0x7be1('0x2')](_0x7be1('0x3'),{'body':_0x1ac9bb,'options':{'where':{'id':_0xd3265}},'log':_0x7be1('0x4')});};exports[_0x7be1('0x5')]=function(_0x459ef2,_0x41bff5){return client[_0x7be1('0x2')](_0x7be1('0x6'),{'body':_0x41bff5,'options':{'where':{'id':_0x459ef2}},'log':_0x7be1('0x7')});}; \ No newline at end of file +var _0xecc4=['UpdateChatInteraction','addTags','addTagsToChatInteraction','../client','update','Request'];(function(_0x5cbbf0,_0x57cc2a){var _0x25d99f=function(_0x3069c4){while(--_0x3069c4){_0x5cbbf0['push'](_0x5cbbf0['shift']());}};_0x25d99f(++_0x57cc2a);}(_0xecc4,0x1ef));var _0x4ecc=function(_0x7e1454,_0x3f6b8e){_0x7e1454=_0x7e1454-0x0;var _0xc55cbb=_0xecc4[_0x7e1454];return _0xc55cbb;};'use strict';var client=require(_0x4ecc('0x0'));exports[_0x4ecc('0x1')]=function(_0x437614,_0xe29a67){return client[_0x4ecc('0x2')](_0x4ecc('0x3'),{'body':_0xe29a67,'options':{'where':{'id':_0x437614}},'log':'updateChatInteraction'});};exports[_0x4ecc('0x4')]=function(_0x38b42c,_0x2230ef){return client[_0x4ecc('0x2')]('AddTagsToChatInteraction',{'body':_0x2230ef,'options':{'where':{'id':_0x38b42c}},'log':_0x4ecc('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 61a3b80..5984c70 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 _0xba48=['Request','CreateChatMessage','createChatMessage','../client','create'];(function(_0x21b75d,_0x48fa9c){var _0x4ab2c2=function(_0x3f5400){while(--_0x3f5400){_0x21b75d['push'](_0x21b75d['shift']());}};_0x4ab2c2(++_0x48fa9c);}(_0xba48,0xfd));var _0x8ba4=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xba48[_0x2cfb58];return _0xd99951;};'use strict';var client=require(_0x8ba4('0x0'));exports[_0x8ba4('0x1')]=function(_0x36fde4){return client[_0x8ba4('0x2')](_0x8ba4('0x3'),{'body':_0x36fde4,'log':_0x8ba4('0x4')});}; \ No newline at end of file +var _0xb3ea=['create','Request','CreateChatMessage','createChatMessage'];(function(_0x3e2b98,_0x4f3bad){var _0x5e141d=function(_0x24f3f6){while(--_0x24f3f6){_0x3e2b98['push'](_0x3e2b98['shift']());}};_0x5e141d(++_0x4f3bad);}(_0xb3ea,0xc0));var _0xab3e=function(_0x115091,_0xde9423){_0x115091=_0x115091-0x0;var _0x345afb=_0xb3ea[_0x115091];return _0x345afb;};'use strict';var client=require('../client');exports[_0xab3e('0x0')]=function(_0x345f23){return client[_0xab3e('0x1')](_0xab3e('0x2'),{'body':_0x345f23,'log':_0xab3e('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 6767dad..9f2d49c 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 _0x29d4=['name','timeout','strategy','Agents','online','chatPause','getChatQueues','../client','Request','GetChatQueue'];(function(_0x3c5acb,_0x35f0af){var _0x3e069c=function(_0x56eb5f){while(--_0x56eb5f){_0x3c5acb['push'](_0x3c5acb['shift']());}};_0x3e069c(++_0x35f0af);}(_0x29d4,0x1a1));var _0x429d=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x29d4[_0x54d4fe];return _0x1ab5bb;};'use strict';var client=require(_0x429d('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x429d('0x1')](_0x429d('0x2'),{'options':{'raw':![],'attributes':['id',_0x429d('0x3'),_0x429d('0x4'),_0x429d('0x5')],'include':[{'model':'User','as':_0x429d('0x6'),'attributes':['id',_0x429d('0x3'),_0x429d('0x7'),_0x429d('0x8')]}]},'log':_0x429d('0x9')});};}; \ No newline at end of file +var _0x7b83=['getChatQueues','Request','timeout','strategy','User','name','online','chatPause','../client'];(function(_0x20e295,_0x308599){var _0x33ffbe=function(_0x2eeb46){while(--_0x2eeb46){_0x20e295['push'](_0x20e295['shift']());}};_0x33ffbe(++_0x308599);}(_0x7b83,0xa1));var _0x37b8=function(_0x252ee5,_0x4b6bcb){_0x252ee5=_0x252ee5-0x0;var _0x3cbf63=_0x7b83[_0x252ee5];return _0x3cbf63;};'use strict';var client=require(_0x37b8('0x0'));exports[_0x37b8('0x1')]=function(){return function(){return client[_0x37b8('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id','name',_0x37b8('0x3'),_0x37b8('0x4')],'include':[{'model':_0x37b8('0x5'),'as':'Agents','attributes':['id',_0x37b8('0x6'),_0x37b8('0x7'),_0x37b8('0x8')]}]},'log':_0x37b8('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index e804b58..e10678b 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 _0x0ef0=['DESC','UpdateChatQueueReport','../client','create','Request','CreateChatQueueReport','update'];(function(_0x49f2e9,_0x115c19){var _0x3801db=function(_0x6665b){while(--_0x6665b){_0x49f2e9['push'](_0x49f2e9['shift']());}};_0x3801db(++_0x115c19);}(_0x0ef0,0x80));var _0x00ef=function(_0x255036,_0xf94145){_0x255036=_0x255036-0x0;var _0x3c4c56=_0x0ef0[_0x255036];return _0x3c4c56;};'use strict';var client=require(_0x00ef('0x0'));exports[_0x00ef('0x1')]=function(_0x498146){return client[_0x00ef('0x2')](_0x00ef('0x3'),{'body':_0x498146,'log':_0x00ef('0x3')});};exports[_0x00ef('0x4')]=function(_0xd4ab59,_0x92e0b){return client['Request']('UpdateChatQueueReport',{'body':_0x92e0b,'options':{'where':{'uniqueid':_0xd4ab59},'order':[['id',_0x00ef('0x5')]],'limit':0x1},'log':_0x00ef('0x6')});}; \ No newline at end of file +var _0xc997=['CreateChatQueueReport','UpdateChatQueueReport','DESC','create','Request'];(function(_0x19e467,_0x4bf652){var _0xbe21b9=function(_0x159d80){while(--_0x159d80){_0x19e467['push'](_0x19e467['shift']());}};_0xbe21b9(++_0x4bf652);}(_0xc997,0x1ac));var _0x7c99=function(_0xad86de,_0x3b6f79){_0xad86de=_0xad86de-0x0;var _0x1bdf58=_0xc997[_0xad86de];return _0x1bdf58;};'use strict';var client=require('../client');exports[_0x7c99('0x0')]=function(_0x3b4b36){return client[_0x7c99('0x1')](_0x7c99('0x2'),{'body':_0x3b4b36,'log':_0x7c99('0x2')});};exports['update']=function(_0x2226d5,_0x114fe0){return client[_0x7c99('0x1')](_0x7c99('0x3'),{'body':_0x114fe0,'options':{'where':{'uniqueid':_0x2226d5},'order':[['id',_0x7c99('0x4')]],'limit':0x1},'log':_0x7c99('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index bd6b468..99ad0df 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x4d79bc,_0x32c905){var _0x4b4760=function(_0x212302){while(--_0x212302){_0x4d79bc['push'](_0x4d79bc['shift']());}};_0x4b4760(++_0x32c905);}(_0x7a54,0x106));var _0x47a5=function(_0x2dd3a0,_0x45701e){_0x2dd3a0=_0x2dd3a0-0x0;var _0x593d5b=_0x7a54[_0x2dd3a0];return _0x593d5b;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x3dcdc6,_0x762d2){var _0x1ed3a6=function(_0x3aca44){while(--_0x3aca44){_0x3dcdc6['push'](_0x3dcdc6['shift']());}};_0x1ed3a6(++_0x762d2);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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 a681b47..675ab76 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 _0x22ef=['CreateFaxMessage','createFaxMessage','../client','create','Request'];(function(_0x560448,_0x2c1082){var _0x550276=function(_0x37e949){while(--_0x37e949){_0x560448['push'](_0x560448['shift']());}};_0x550276(++_0x2c1082);}(_0x22ef,0x1a6));var _0xf22e=function(_0x41030b,_0x1bd93a){_0x41030b=_0x41030b-0x0;var _0x4706b2=_0x22ef[_0x41030b];return _0x4706b2;};'use strict';var client=require(_0xf22e('0x0'));exports[_0xf22e('0x1')]=function(_0x3d3d92){return client[_0xf22e('0x2')](_0xf22e('0x3'),{'body':_0x3d3d92,'log':_0xf22e('0x4')});}; \ No newline at end of file +var _0xef15=['CreateFaxMessage','createFaxMessage','../client','create'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xef15,0x16e));var _0x5ef1=function(_0x3326c3,_0x14382c){_0x3326c3=_0x3326c3-0x0;var _0x14eb8a=_0xef15[_0x3326c3];return _0x14eb8a;};'use strict';var client=require(_0x5ef1('0x0'));exports[_0x5ef1('0x1')]=function(_0x315ed6){return client['Request'](_0x5ef1('0x2'),{'body':_0x315ed6,'log':_0x5ef1('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 0ae0d0c..6ea54f9 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 _0x869c=['GetFaxQueue','name','timeout','faxPause','../client','getFaxQueues','Request'];(function(_0x2a6a4e,_0x3cca0d){var _0x1c8a82=function(_0x4be1d6){while(--_0x4be1d6){_0x2a6a4e['push'](_0x2a6a4e['shift']());}};_0x1c8a82(++_0x3cca0d);}(_0x869c,0x66));var _0xc869=function(_0x11579f,_0x26ab6b){_0x11579f=_0x11579f-0x0;var _0x56e613=_0x869c[_0x11579f];return _0x56e613;};'use strict';var client=require(_0xc869('0x0'));exports[_0xc869('0x1')]=function(){return function(){return client[_0xc869('0x2')](_0xc869('0x3'),{'options':{'raw':![],'attributes':['id',_0xc869('0x4'),_0xc869('0x5'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id',_0xc869('0x4'),'online',_0xc869('0x6')]}]},'log':_0xc869('0x1')});};}; \ No newline at end of file +var _0x7bd4=['timeout','strategy','Agents','faxPause','Request','GetFaxQueue','name'];(function(_0x2ada4d,_0x4b3c02){var _0x258271=function(_0x166fb1){while(--_0x166fb1){_0x2ada4d['push'](_0x2ada4d['shift']());}};_0x258271(++_0x4b3c02);}(_0x7bd4,0x1bd));var _0x47bd=function(_0x5e4909,_0x12ce31){_0x5e4909=_0x5e4909-0x0;var _0x5a337c=_0x7bd4[_0x5e4909];return _0x5a337c;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client[_0x47bd('0x0')](_0x47bd('0x1'),{'options':{'raw':![],'attributes':['id',_0x47bd('0x2'),_0x47bd('0x3'),_0x47bd('0x4')],'include':[{'model':'User','as':_0x47bd('0x5'),'attributes':['id',_0x47bd('0x2'),'online',_0x47bd('0x6')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index e502f0c..0a8c061 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 _0xadd5=['UpdateFaxQueueReport','../client','create','Request','CreateFaxQueueReport','update'];(function(_0x42bcba,_0x1f6e71){var _0x2b8da7=function(_0x58a792){while(--_0x58a792){_0x42bcba['push'](_0x42bcba['shift']());}};_0x2b8da7(++_0x1f6e71);}(_0xadd5,0x19f));var _0x5add=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xadd5[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x5add('0x0'));exports[_0x5add('0x1')]=function(_0x5cb135){return client[_0x5add('0x2')](_0x5add('0x3'),{'body':_0x5cb135,'log':_0x5add('0x3')});};exports[_0x5add('0x4')]=function(_0x5a8db1,_0x14b884){return client[_0x5add('0x2')](_0x5add('0x5'),{'body':_0x14b884,'options':{'where':{'uniqueid':_0x5a8db1},'order':[['id','DESC']],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x5cda=['DESC','../client','CreateFaxQueueReport','update','Request','UpdateFaxQueueReport'];(function(_0x49b056,_0x392db0){var _0x429028=function(_0x2653be){while(--_0x2653be){_0x49b056['push'](_0x49b056['shift']());}};_0x429028(++_0x392db0);}(_0x5cda,0x1f3));var _0xa5cd=function(_0x2b100f,_0x237749){_0x2b100f=_0x2b100f-0x0;var _0x38edf2=_0x5cda[_0x2b100f];return _0x38edf2;};'use strict';var client=require(_0xa5cd('0x0'));exports['create']=function(_0x3d877b){return client['Request'](_0xa5cd('0x1'),{'body':_0x3d877b,'log':'CreateFaxQueueReport'});};exports[_0xa5cd('0x2')]=function(_0x3cefef,_0x135ee6){return client[_0xa5cd('0x3')](_0xa5cd('0x4'),{'body':_0x135ee6,'options':{'where':{'uniqueid':_0x3cefef},'order':[['id',_0xa5cd('0x5')]],'limit':0x1},'log':_0xa5cd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 3f8abe5..00487c2 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 _0xfc5c=['GetInterval','Interval','Intervals','name','getIntervals'];(function(_0x2b91c5,_0x3b6db5){var _0xbd5531=function(_0x54783d){while(--_0x54783d){_0x2b91c5['push'](_0x2b91c5['shift']());}};_0xbd5531(++_0x3b6db5);}(_0xfc5c,0x10d));var _0xcfc5=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xfc5c[_0x465a0c];return _0x1e202e;};'use strict';var client=require('../client');exports[_0xcfc5('0x0')]=function(){return function(){return client['Request'](_0xcfc5('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xcfc5('0x2'),'as':_0xcfc5('0x3'),'attributes':['id',_0xcfc5('0x4'),'interval']}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x31d5=['name','interval','../client','getIntervals','Request','GetInterval','Interval'];(function(_0x3b939f,_0x4f5a23){var _0x49d5ce=function(_0x36b33f){while(--_0x36b33f){_0x3b939f['push'](_0x3b939f['shift']());}};_0x49d5ce(++_0x4f5a23);}(_0x31d5,0x191));var _0x531d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x31d5[_0x1facfa];return _0x9ec701;};'use strict';var client=require(_0x531d('0x0'));exports[_0x531d('0x1')]=function(){return function(){return client[_0x531d('0x2')](_0x531d('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x531d('0x4'),'as':'Intervals','attributes':['id',_0x531d('0x5'),_0x531d('0x6')]}]},'log':_0x531d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 22bcb81..4a4b2ed 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 _0x4cf8=['Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','../client','update'];(function(_0x489358,_0x38dbdd){var _0x4e4b56=function(_0x4a0722){while(--_0x4a0722){_0x489358['push'](_0x489358['shift']());}};_0x4e4b56(++_0x38dbdd);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x287059,_0x499940){_0x287059=_0x287059-0x0;var _0x225c79=_0x4cf8[_0x287059];return _0x225c79;};'use strict';var client=require(_0x84cf('0x0'));exports[_0x84cf('0x1')]=function(_0x287eb2,_0x2125ed){return client[_0x84cf('0x2')](_0x84cf('0x3'),{'body':_0x2125ed,'options':{'where':{'id':_0x287eb2}},'log':_0x84cf('0x4')});};exports[_0x84cf('0x5')]=function(_0x3bbbc3,_0x2d38c0){return client[_0x84cf('0x2')](_0x84cf('0x6'),{'body':_0x2d38c0,'options':{'where':{'id':_0x3bbbc3}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x68b3=['addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','updateMailInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68b3,0x1d8));var _0x368b=function(_0x2a9d1c,_0x4f29d0){_0x2a9d1c=_0x2a9d1c-0x0;var _0xd00a45=_0x68b3[_0x2a9d1c];return _0xd00a45;};'use strict';var client=require(_0x368b('0x0'));exports[_0x368b('0x1')]=function(_0x3e8034,_0xa371c){return client[_0x368b('0x2')]('UpdateMailInteraction',{'body':_0xa371c,'options':{'where':{'id':_0x3e8034}},'log':_0x368b('0x3')});};exports[_0x368b('0x4')]=function(_0xc40116,_0x404282){return client['Request'](_0x368b('0x5'),{'body':_0x404282,'options':{'where':{'id':_0xc40116}},'log':_0x368b('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 37843a4..5fe7bb2 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 _0x51e4=['create','Request','CreateMailMessage','createMailMessage','../client'];(function(_0x27e811,_0x1fad22){var _0x1bfe61=function(_0x2d8d02){while(--_0x2d8d02){_0x27e811['push'](_0x27e811['shift']());}};_0x1bfe61(++_0x1fad22);}(_0x51e4,0xc2));var _0x451e=function(_0x5cf4a4,_0xbb03a1){_0x5cf4a4=_0x5cf4a4-0x0;var _0x3dcc02=_0x51e4[_0x5cf4a4];return _0x3dcc02;};'use strict';var client=require(_0x451e('0x0'));exports[_0x451e('0x1')]=function(_0x3817f6){return client[_0x451e('0x2')](_0x451e('0x3'),{'body':_0x3817f6,'log':_0x451e('0x4')});}; \ No newline at end of file +var _0x601a=['../client','create','Request','CreateMailMessage','createMailMessage'];(function(_0x3359e0,_0x3b0371){var _0x48ddc7=function(_0x18d01a){while(--_0x18d01a){_0x3359e0['push'](_0x3359e0['shift']());}};_0x48ddc7(++_0x3b0371);}(_0x601a,0x122));var _0xa601=function(_0x506259,_0x190579){_0x506259=_0x506259-0x0;var _0x1201a9=_0x601a[_0x506259];return _0x1201a9;};'use strict';var client=require(_0xa601('0x0'));exports[_0xa601('0x1')]=function(_0x51b17b){return client[_0xa601('0x2')](_0xa601('0x3'),{'body':_0x51b17b,'log':_0xa601('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index a1e7285..de63291 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 _0x1df0=['strategy','User','Agents','online','mailPause','../client','getMailQueues','Request','GetMailQueue','name','timeout'];(function(_0x54a2df,_0x376f96){var _0x42e322=function(_0x12c3cf){while(--_0x12c3cf){_0x54a2df['push'](_0x54a2df['shift']());}};_0x42e322(++_0x376f96);}(_0x1df0,0x19c));var _0x01df=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x1df0[_0x5ddb1c];return _0x354adc;};'use strict';var client=require(_0x01df('0x0'));exports[_0x01df('0x1')]=function(){return function(){return client[_0x01df('0x2')](_0x01df('0x3'),{'options':{'raw':![],'attributes':['id',_0x01df('0x4'),_0x01df('0x5'),_0x01df('0x6')],'include':[{'model':_0x01df('0x7'),'as':_0x01df('0x8'),'attributes':['id',_0x01df('0x4'),_0x01df('0x9'),_0x01df('0xa')]}]},'log':_0x01df('0x1')});};}; \ No newline at end of file +var _0xbddc=['name','timeout','strategy','mailPause','getMailQueues','Request'];(function(_0x1f5873,_0x1497be){var _0x2a75d9=function(_0x16c497){while(--_0x16c497){_0x1f5873['push'](_0x1f5873['shift']());}};_0x2a75d9(++_0x1497be);}(_0xbddc,0x14e));var _0xcbdd=function(_0x35a8e3,_0x1e6990){_0x35a8e3=_0x35a8e3-0x0;var _0x2d181d=_0xbddc[_0x35a8e3];return _0x2d181d;};'use strict';var client=require('../client');exports[_0xcbdd('0x0')]=function(){return function(){return client[_0xcbdd('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xcbdd('0x2'),_0xcbdd('0x3'),_0xcbdd('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id','name','online',_0xcbdd('0x5')]}]},'log':_0xcbdd('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index a09e227..272e5b5 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 _0x3d88=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','../client','create'];(function(_0x5935d9,_0x42fff7){var _0x247e32=function(_0xbc97c){while(--_0xbc97c){_0x5935d9['push'](_0x5935d9['shift']());}};_0x247e32(++_0x42fff7);}(_0x3d88,0x142));var _0x83d8=function(_0x3dfc20,_0x82a51f){_0x3dfc20=_0x3dfc20-0x0;var _0x2ef297=_0x3d88[_0x3dfc20];return _0x2ef297;};'use strict';var client=require(_0x83d8('0x0'));exports[_0x83d8('0x1')]=function(_0x5e3359){return client[_0x83d8('0x2')](_0x83d8('0x3'),{'body':_0x5e3359,'log':'CreateMailQueueReport'});};exports[_0x83d8('0x4')]=function(_0x2474d7,_0x508807){return client[_0x83d8('0x2')](_0x83d8('0x5'),{'body':_0x508807,'options':{'where':{'uniqueid':_0x2474d7},'order':[['id','DESC']],'limit':0x1},'log':_0x83d8('0x5')});}; \ No newline at end of file +var _0x94af=['CreateMailQueueReport','UpdateMailQueueReport','DESC','../client','Request'];(function(_0x43f136,_0x365817){var _0x531928=function(_0x5a59e9){while(--_0x5a59e9){_0x43f136['push'](_0x43f136['shift']());}};_0x531928(++_0x365817);}(_0x94af,0xbc));var _0xf94a=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x94af[_0x1facfa];return _0x9ec701;};'use strict';var client=require(_0xf94a('0x0'));exports['create']=function(_0x43e52c){return client[_0xf94a('0x1')]('CreateMailQueueReport',{'body':_0x43e52c,'log':_0xf94a('0x2')});};exports['update']=function(_0x90cf0b,_0x2e546f){return client[_0xf94a('0x1')](_0xf94a('0x3'),{'body':_0x2e546f,'options':{'where':{'uniqueid':_0x90cf0b},'order':[['id',_0xf94a('0x4')]],'limit':0x1},'log':_0xf94a('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 95deb17..be0a83b 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 _0x1a7c=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','update'];(function(_0x1c323c,_0x116b58){var _0x40a6f9=function(_0x11947f){while(--_0x11947f){_0x1c323c['push'](_0x1c323c['shift']());}};_0x40a6f9(++_0x116b58);}(_0x1a7c,0xa1));var _0xc1a7=function(_0x35289d,_0x230ce7){_0x35289d=_0x35289d-0x0;var _0x2dec71=_0x1a7c[_0x35289d];return _0x2dec71;};'use strict';var client=require('../client');exports[_0xc1a7('0x0')]=function(_0x2eb088,_0x2d068d){return client[_0xc1a7('0x1')](_0xc1a7('0x2'),{'body':_0x2d068d,'options':{'where':{'id':_0x2eb088}},'log':_0xc1a7('0x3')});};exports[_0xc1a7('0x4')]=function(_0x4d870b,_0x1a5f57){return client[_0xc1a7('0x1')](_0xc1a7('0x5'),{'body':_0x1a5f57,'options':{'where':{'id':_0x4d870b}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xa729=['../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x1d3498,_0x504228){var _0x47439e=function(_0x491949){while(--_0x491949){_0x1d3498['push'](_0x1d3498['shift']());}};_0x47439e(++_0x504228);}(_0xa729,0x1ec));var _0x9a72=function(_0x6cf246,_0x2e22b3){_0x6cf246=_0x6cf246-0x0;var _0x356a43=_0xa729[_0x6cf246];return _0x356a43;};'use strict';var client=require(_0x9a72('0x0'));exports[_0x9a72('0x1')]=function(_0x2aa0d1,_0xa06954){return client[_0x9a72('0x2')](_0x9a72('0x3'),{'body':_0xa06954,'options':{'where':{'id':_0x2aa0d1}},'log':_0x9a72('0x4')});};exports['addTags']=function(_0x520329,_0x3fd5fd){return client[_0x9a72('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0x3fd5fd,'options':{'where':{'id':_0x520329}},'log':_0x9a72('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 6f6315f..d9dcf78 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 _0x7c08=['CreateOpenchannelMessage','../client','create','Request'];(function(_0x98c584,_0x15f015){var _0x4e45c0=function(_0x304831){while(--_0x304831){_0x98c584['push'](_0x98c584['shift']());}};_0x4e45c0(++_0x15f015);}(_0x7c08,0xb1));var _0x87c0=function(_0x409247,_0x36d78a){_0x409247=_0x409247-0x0;var _0x3b1340=_0x7c08[_0x409247];return _0x3b1340;};'use strict';var client=require(_0x87c0('0x0'));exports[_0x87c0('0x1')]=function(_0x5a8706){return client[_0x87c0('0x2')](_0x87c0('0x3'),{'body':_0x5a8706,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0x750a=['CreateOpenchannelMessage','createOpenchannelMessage','../client','Request'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x750a,0x1d2));var _0xa750=function(_0x3fa6fb,_0x454bf3){_0x3fa6fb=_0x3fa6fb-0x0;var _0x21c1f7=_0x750a[_0x3fa6fb];return _0x21c1f7;};'use strict';var client=require(_0xa750('0x0'));exports['create']=function(_0x31ede2){return client[_0xa750('0x1')](_0xa750('0x2'),{'body':_0x31ede2,'log':_0xa750('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index aaff310..7c56bee 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 _0xbd45=['name','timeout','strategy','User','Agents','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue'];(function(_0xe71c66,_0x325fdc){var _0x280b8b=function(_0x59d9c5){while(--_0x59d9c5){_0xe71c66['push'](_0xe71c66['shift']());}};_0x280b8b(++_0x325fdc);}(_0xbd45,0xf6));var _0x5bd4=function(_0x24711a,_0x4cb71f){_0x24711a=_0x24711a-0x0;var _0x1a47ec=_0xbd45[_0x24711a];return _0x1a47ec;};'use strict';var client=require(_0x5bd4('0x0'));exports[_0x5bd4('0x1')]=function(){return function(){return client[_0x5bd4('0x2')](_0x5bd4('0x3'),{'options':{'raw':![],'attributes':['id',_0x5bd4('0x4'),_0x5bd4('0x5'),_0x5bd4('0x6')],'include':[{'model':_0x5bd4('0x7'),'as':_0x5bd4('0x8'),'attributes':['id',_0x5bd4('0x4'),'online',_0x5bd4('0x9')]}]},'log':_0x5bd4('0x1')});};}; \ No newline at end of file +var _0x25af=['../client','getOpenchannelQueues','timeout','strategy','User','Agents','name','online','openchannelPause'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x25af,0x6c));var _0xf25a=function(_0x31779d,_0x1eb1a5){_0x31779d=_0x31779d-0x0;var _0x5cda16=_0x25af[_0x31779d];return _0x5cda16;};'use strict';var client=require(_0xf25a('0x0'));exports[_0xf25a('0x1')]=function(){return function(){return client['Request']('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id','name',_0xf25a('0x2'),_0xf25a('0x3')],'include':[{'model':_0xf25a('0x4'),'as':_0xf25a('0x5'),'attributes':['id',_0xf25a('0x6'),_0xf25a('0x7'),_0xf25a('0x8')]}]},'log':_0xf25a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index d23ef80..6c463fb 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 _0x9d3f=['CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','create','Request'];(function(_0xdf2038,_0x242be5){var _0x2f4a0d=function(_0x18e322){while(--_0x18e322){_0xdf2038['push'](_0xdf2038['shift']());}};_0x2f4a0d(++_0x242be5);}(_0x9d3f,0x18e));var _0xf9d3=function(_0x46be86,_0x491f52){_0x46be86=_0x46be86-0x0;var _0x2962c8=_0x9d3f[_0x46be86];return _0x2962c8;};'use strict';var client=require('../client');exports[_0xf9d3('0x0')]=function(_0x594ce1){return client[_0xf9d3('0x1')](_0xf9d3('0x2'),{'body':_0x594ce1,'log':_0xf9d3('0x2')});};exports['update']=function(_0x5b3818,_0x2a29c6){return client[_0xf9d3('0x1')](_0xf9d3('0x3'),{'body':_0x2a29c6,'options':{'where':{'uniqueid':_0x5b3818},'order':[['id','DESC']],'limit':0x1},'log':_0xf9d3('0x3')});}; \ No newline at end of file +var _0xc2e9=['UpdateOpenchannelQueueReport','DESC','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xc2e9,0xce));var _0x9c2e=function(_0x3d9dfa,_0x2940dc){_0x3d9dfa=_0x3d9dfa-0x0;var _0x59a282=_0xc2e9[_0x3d9dfa];return _0x59a282;};'use strict';var client=require(_0x9c2e('0x0'));exports[_0x9c2e('0x1')]=function(_0xd7857d){return client[_0x9c2e('0x2')](_0x9c2e('0x3'),{'body':_0xd7857d,'log':_0x9c2e('0x3')});};exports['update']=function(_0x339d24,_0x273117){return client['Request'](_0x9c2e('0x4'),{'body':_0x273117,'options':{'where':{'uniqueid':_0x339d24},'order':[['id',_0x9c2e('0x5')]],'limit':0x1},'log':_0x9c2e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 7394d97..b2b297e 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 _0xceae=['AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','UpdateSmsInteraction','Request'];(function(_0x525a94,_0x5ed4da){var _0x589d42=function(_0x4cfb03){while(--_0x4cfb03){_0x525a94['push'](_0x525a94['shift']());}};_0x589d42(++_0x5ed4da);}(_0xceae,0x122));var _0xecea=function(_0x35f15b,_0x387db3){_0x35f15b=_0x35f15b-0x0;var _0x262619=_0xceae[_0x35f15b];return _0x262619;};'use strict';var client=require(_0xecea('0x0'));exports[_0xecea('0x1')]=function(_0x49d585,_0x5533c7){return client['Request'](_0xecea('0x2'),{'body':_0x5533c7,'options':{'where':{'id':_0x49d585}},'log':'updateSmsInteraction'});};exports['addTags']=function(_0x28b2cf,_0x457d37){return client[_0xecea('0x3')](_0xecea('0x4'),{'body':_0x457d37,'options':{'where':{'id':_0x28b2cf}},'log':_0xecea('0x5')});}; \ No newline at end of file +var _0xe14f=['updateSmsInteraction','addTags','AddTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction'];(function(_0x5c931b,_0x28b4a9){var _0x26604f=function(_0xfa9b32){while(--_0xfa9b32){_0x5c931b['push'](_0x5c931b['shift']());}};_0x26604f(++_0x28b4a9);}(_0xe14f,0xea));var _0xfe14=function(_0x572576,_0x2e1b97){_0x572576=_0x572576-0x0;var _0x15cdf2=_0xe14f[_0x572576];return _0x15cdf2;};'use strict';var client=require(_0xfe14('0x0'));exports[_0xfe14('0x1')]=function(_0x33ee9b,_0x2d348b){return client[_0xfe14('0x2')](_0xfe14('0x3'),{'body':_0x2d348b,'options':{'where':{'id':_0x33ee9b}},'log':_0xfe14('0x4')});};exports[_0xfe14('0x5')]=function(_0x2b7784,_0x4b7546){return client['Request'](_0xfe14('0x6'),{'body':_0x4b7546,'options':{'where':{'id':_0x2b7784}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 3472d03..e6a8652 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 _0x06fc=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x554cc3,_0x20bb6e){var _0x26fa3d=function(_0x433c27){while(--_0x433c27){_0x554cc3['push'](_0x554cc3['shift']());}};_0x26fa3d(++_0x20bb6e);}(_0x06fc,0x1f1));var _0xc06f=function(_0x550186,_0x27a8f5){_0x550186=_0x550186-0x0;var _0x2c5a5e=_0x06fc[_0x550186];return _0x2c5a5e;};'use strict';var client=require(_0xc06f('0x0'));exports[_0xc06f('0x1')]=function(_0x3ffa10){return client[_0xc06f('0x2')](_0xc06f('0x3'),{'body':_0x3ffa10,'log':_0xc06f('0x4')});}; \ No newline at end of file +var _0xd3ce=['Request','CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x2f32c4,_0x531dc6){var _0x3f3018=function(_0x406998){while(--_0x406998){_0x2f32c4['push'](_0x2f32c4['shift']());}};_0x3f3018(++_0x531dc6);}(_0xd3ce,0x152));var _0xed3c=function(_0x33351e,_0x4b5d71){_0x33351e=_0x33351e-0x0;var _0xb0dfa=_0xd3ce[_0x33351e];return _0xb0dfa;};'use strict';var client=require(_0xed3c('0x0'));exports[_0xed3c('0x1')]=function(_0x633bb2){return client[_0xed3c('0x2')](_0xed3c('0x3'),{'body':_0x633bb2,'log':_0xed3c('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 871b878..f7e4b52 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(_0x38a8ad,_0x381d7e){var _0x434122=function(_0xc1ed36){while(--_0xc1ed36){_0x38a8ad['push'](_0x38a8ad['shift']());}};_0x434122(++_0x381d7e);}(_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 _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x58a4ac,_0x43fd42){var _0x545810=function(_0x308e65){while(--_0x308e65){_0x58a4ac['push'](_0x58a4ac['shift']());}};_0x545810(++_0x43fd42);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 9a7e6ff..0a48251 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x22193e,_0x2ae001){var _0x10c378=function(_0x411e3f){while(--_0x411e3f){_0x22193e['push'](_0x22193e['shift']());}};_0x10c378(++_0x2ae001);}(_0x008c,0x188));var _0xc008=function(_0x1238e0,_0x16bd9b){_0x1238e0=_0x1238e0-0x0;var _0x59dfc8=_0x008c[_0x1238e0];return _0x59dfc8;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file +var _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x25ffd4,_0x16b31d){var _0x414452=function(_0x4440d2){while(--_0x4440d2){_0x25ffd4['push'](_0x25ffd4['shift']());}};_0x414452(++_0x16b31d);}(_0x008c,0x188));var _0xc008=function(_0x58010d,_0x49b16a){_0x58010d=_0x58010d-0x0;var _0x4f93db=_0x008c[_0x58010d];return _0x4f93db;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index b5c95de..47c587c 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(_0x54bd66,_0x361ba1){var _0x3ff510=function(_0x18c95e){while(--_0x18c95e){_0x54bd66['push'](_0x54bd66['shift']());}};_0x3ff510(++_0x361ba1);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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(_0x2bd886,_0x225eaa){var _0x372f76=function(_0x5e03df){while(--_0x5e03df){_0x2bd886['push'](_0x2bd886['shift']());}};_0x372f76(++_0x225eaa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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 28b20e0..01fa291 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 _0xe2bc=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags'];(function(_0xa48e4f,_0x442ba4){var _0x483abf=function(_0x241512){while(--_0x241512){_0xa48e4f['push'](_0xa48e4f['shift']());}};_0x483abf(++_0x442ba4);}(_0xe2bc,0x1a6));var _0xce2b=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0xe2bc[_0x432fca];return _0x3adba4;};'use strict';var client=require(_0xce2b('0x0'));exports['update']=function(_0x15775c,_0x47cd82){return client[_0xce2b('0x1')](_0xce2b('0x2'),{'body':_0x47cd82,'options':{'where':{'id':_0x15775c}},'log':_0xce2b('0x3')});};exports[_0xce2b('0x4')]=function(_0x3f7887,_0x5af322){return client[_0xce2b('0x1')](_0xce2b('0x5'),{'body':_0x5af322,'options':{'where':{'id':_0x3f7887}},'log':_0xce2b('0x6')});}; \ No newline at end of file +var _0xe626=['updateWhatsappInteraction','addTags','../client','update','UpdateWhatsappInteraction'];(function(_0x36c6eb,_0x4fb127){var _0x30675b=function(_0x3a788b){while(--_0x3a788b){_0x36c6eb['push'](_0x36c6eb['shift']());}};_0x30675b(++_0x4fb127);}(_0xe626,0x9d));var _0x6e62=function(_0x57433f,_0x3e2256){_0x57433f=_0x57433f-0x0;var _0x1edb89=_0xe626[_0x57433f];return _0x1edb89;};'use strict';var client=require(_0x6e62('0x0'));exports[_0x6e62('0x1')]=function(_0x14eb81,_0x1e49b0){return client['Request'](_0x6e62('0x2'),{'body':_0x1e49b0,'options':{'where':{'id':_0x14eb81}},'log':_0x6e62('0x3')});};exports[_0x6e62('0x4')]=function(_0xb5cd38,_0x2ebc77){return client['Request']('AddTagsToWhatsappInteraction',{'body':_0x2ebc77,'options':{'where':{'id':_0xb5cd38}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index b6df1db..01930c3 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 _0xfbdf=['create','createWhatsappMessage','../client'];(function(_0x34f44c,_0x4baeea){var _0x4c0d7c=function(_0x5ecd89){while(--_0x5ecd89){_0x34f44c['push'](_0x34f44c['shift']());}};_0x4c0d7c(++_0x4baeea);}(_0xfbdf,0x188));var _0xffbd=function(_0x2df2c4,_0x3b183b){_0x2df2c4=_0x2df2c4-0x0;var _0x3244d3=_0xfbdf[_0x2df2c4];return _0x3244d3;};'use strict';var client=require(_0xffbd('0x0'));exports[_0xffbd('0x1')]=function(_0x592149){return client['Request']('CreateWhatsappMessage',{'body':_0x592149,'log':_0xffbd('0x2')});}; \ No newline at end of file +var _0x3441=['Request','CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0x5969a0,_0xdc867c){var _0x4c2f5b=function(_0x24fc33){while(--_0x24fc33){_0x5969a0['push'](_0x5969a0['shift']());}};_0x4c2f5b(++_0xdc867c);}(_0x3441,0xc6));var _0x1344=function(_0x357702,_0x203968){_0x357702=_0x357702-0x0;var _0x4dd94a=_0x3441[_0x357702];return _0x4dd94a;};'use strict';var client=require(_0x1344('0x0'));exports[_0x1344('0x1')]=function(_0xd3f295){return client[_0x1344('0x2')](_0x1344('0x3'),{'body':_0xd3f295,'log':_0x1344('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 94892fe..91de73f 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 _0xd77a=['User','Agents','online','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy'];(function(_0x221085,_0x5dbc19){var _0x29e0bd=function(_0x520b6a){while(--_0x520b6a){_0x221085['push'](_0x221085['shift']());}};_0x29e0bd(++_0x5dbc19);}(_0xd77a,0xeb));var _0xad77=function(_0x53af73,_0x16a217){_0x53af73=_0x53af73-0x0;var _0x14749a=_0xd77a[_0x53af73];return _0x14749a;};'use strict';var client=require(_0xad77('0x0'));exports[_0xad77('0x1')]=function(){return function(){return client[_0xad77('0x2')](_0xad77('0x3'),{'options':{'raw':![],'attributes':['id',_0xad77('0x4'),_0xad77('0x5'),_0xad77('0x6')],'include':[{'model':_0xad77('0x7'),'as':_0xad77('0x8'),'attributes':['id',_0xad77('0x4'),_0xad77('0x9'),_0xad77('0xa')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0xa410=['../client','getWhatsappQueues','GetWhatsappQueue','name','timeout','strategy','User','Agents','online','whatsappPause'];(function(_0x5d35d0,_0x3c0512){var _0x36c110=function(_0xb49603){while(--_0xb49603){_0x5d35d0['push'](_0x5d35d0['shift']());}};_0x36c110(++_0x3c0512);}(_0xa410,0x1d6));var _0x0a41=function(_0x4ba2b1,_0x9348d5){_0x4ba2b1=_0x4ba2b1-0x0;var _0x8d72ef=_0xa410[_0x4ba2b1];return _0x8d72ef;};'use strict';var client=require(_0x0a41('0x0'));exports[_0x0a41('0x1')]=function(){return function(){return client['Request'](_0x0a41('0x2'),{'options':{'raw':![],'attributes':['id',_0x0a41('0x3'),_0x0a41('0x4'),_0x0a41('0x5')],'include':[{'model':_0x0a41('0x6'),'as':_0x0a41('0x7'),'attributes':['id','name',_0x0a41('0x8'),_0x0a41('0x9')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 9d58639..4cf3ee7 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 _0x5155=['Request','UpdateWhatsappQueueReport','DESC','../client','create'];(function(_0x3a13cf,_0x478c62){var _0x4817c=function(_0x3a2e75){while(--_0x3a2e75){_0x3a13cf['push'](_0x3a13cf['shift']());}};_0x4817c(++_0x478c62);}(_0x5155,0x125));var _0x5515=function(_0x3a112c,_0x2830c7){_0x3a112c=_0x3a112c-0x0;var _0x24e770=_0x5155[_0x3a112c];return _0x24e770;};'use strict';var client=require(_0x5515('0x0'));exports[_0x5515('0x1')]=function(_0x2251d9){return client[_0x5515('0x2')]('CreateWhatsappQueueReport',{'body':_0x2251d9,'log':'CreateWhatsappQueueReport'});};exports['update']=function(_0x5eda08,_0x1a0bc9){return client[_0x5515('0x2')](_0x5515('0x3'),{'body':_0x1a0bc9,'options':{'where':{'uniqueid':_0x5eda08},'order':[['id',_0x5515('0x4')]],'limit':0x1},'log':_0x5515('0x3')});}; \ No newline at end of file +var _0x5368=['UpdateWhatsappQueueReport','DESC','../client','create','CreateWhatsappQueueReport','Request'];(function(_0x16715c,_0x52eff8){var _0xeee64=function(_0xfd2e72){while(--_0xfd2e72){_0x16715c['push'](_0x16715c['shift']());}};_0xeee64(++_0x52eff8);}(_0x5368,0x1dc));var _0x8536=function(_0x542a81,_0x449f1d){_0x542a81=_0x542a81-0x0;var _0x1a62c6=_0x5368[_0x542a81];return _0x1a62c6;};'use strict';var client=require(_0x8536('0x0'));exports[_0x8536('0x1')]=function(_0x4146d1){return client['Request'](_0x8536('0x2'),{'body':_0x4146d1,'log':'CreateWhatsappQueueReport'});};exports['update']=function(_0xf6de1b,_0x394dd5){return client[_0x8536('0x3')](_0x8536('0x4'),{'body':_0x394dd5,'options':{'where':{'uniqueid':_0xf6de1b},'order':[['id',_0x8536('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index f876dc7..5dba998 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 _0xab14=['atimeout','channel','START:%s','rules','end','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','lodash','util','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','consequence','error','[%s][AGENT]\x20%s','join','stop','agents','timeout','createQueue'];(function(_0x4fdc74,_0x3186d0){var _0x516645=function(_0xa11c9b){while(--_0xa11c9b){_0x4fdc74['push'](_0x4fdc74['shift']());}};_0x516645(++_0x3186d0);}(_0xab14,0x16b));var _0x4ab1=function(_0x5eb62d,_0x47cdc9){_0x5eb62d=_0x5eb62d-0x0;var _0x4ef958=_0xab14[_0x5eb62d];return _0x4ef958;};'use strict';var schema=require(_0x4ab1('0x0'));var _=require(_0x4ab1('0x1'));var util=require(_0x4ab1('0x2'));var seqqueue=require('seq-queue');var logger=require(_0x4ab1('0x3'))(_0x4ab1('0x4'));var strategy=require(_0x4ab1('0x5'));var queue=schema({'name':{'type':_0x4ab1('0x6'),'required':!![],'message':_0x4ab1('0x7')},'timeout':{'type':'number','message':_0x4ab1('0x8')}});function writeLog(_0x3acd91,_0x2a0d07,_0x5d986e){return logger[_0x4ab1('0x9')](util[_0x4ab1('0xa')](_0x4ab1('0xb'),_0x3acd91,_0x2a0d07[_0x4ab1('0xc')],_0x5d986e));}function handleFindAgent(_0x345775){return function(_0xebf253){return _0xebf253[_0x4ab1('0xc')]['toLowerCase']()===_0x345775['toLowerCase']();};}exports[_0x4ab1('0xd')]=function(_0x386fa9,_0xeba40,_0x17d873,_0x5f13bb){return function(_0x5ec8cf){try{var _0x78fbcf={'name':_0xeba40[0x0],'timeout':_0xeba40[0x1]};var _0x41ad2d=queue[_0x4ab1('0x0')](_0x78fbcf,{'typecast':!![]});if(_0x41ad2d['length']){logger[_0x4ab1('0xe')](_0x4ab1('0xf'),_0x386fa9,_['map'](_0x41ad2d,'message')[_0x4ab1('0x10')](',\x20'));_0x5ec8cf[_0x4ab1('0x11')]();}else{var _0xdcf3b4=_['find'](_0x17d873[_0x4ab1('0x12')],handleFindAgent(_0x78fbcf[_0x4ab1('0xc')]));if(_0xdcf3b4){var _0x10a708=(_0x78fbcf[_0x4ab1('0x13')]||0xa)*0x3e8;var _0x832b70,_0x3aa8d9;var _0x38b4c9=seqqueue[_0x4ab1('0x14')](_0x10a708);_0x38b4c9['id']=_0x386fa9;_0x38b4c9[_0x4ab1('0x15')]=_0x10a708;_0x38b4c9['channel']=_0x5f13bb[_0x4ab1('0x16')];writeLog(_0x386fa9,_0xdcf3b4,util[_0x4ab1('0xa')](_0x4ab1('0x17'),_0x10a708));_0x17d873[_0x4ab1('0x18')][_0x386fa9]['on'](_0x4ab1('0x19'),function(){logger[_0x4ab1('0x9')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x386fa9);clearTimeout(_0x3aa8d9);_0x3aa8d9=undefined;_0x38b4c9[_0x4ab1('0x1a')]();if(_0x17d873[_0x4ab1('0x18')][_0x386fa9]){delete _0x17d873[_0x4ab1('0x18')][_0x386fa9];}_0x5ec8cf[_0x4ab1('0x11')]();});_0x17d873[_0x4ab1('0x18')][_0x386fa9]['on']('complete',function(){if(_0x17d873[_0x4ab1('0x18')][_0x386fa9]){delete _0x17d873[_0x4ab1('0x18')][_0x386fa9];}});_0x3aa8d9=setTimeout(function(){logger[_0x4ab1('0x9')]('[%s][AGENT]\x20ROUTING\x20END',_0x386fa9);clearTimeout(_0x3aa8d9);_0x38b4c9['close']();_0x5ec8cf[_0x4ab1('0x1b')]();},_0x10a708);strategy[_0x4ab1('0x1c')](_0x38b4c9,_0xdcf3b4,_0x17d873,_0x5f13bb);}else{logger['error'](_0x4ab1('0x1d'),_0x386fa9,_0x78fbcf[_0x4ab1('0xc')]);_0x5ec8cf['stop']();}}}catch(_0xe6bf8d){console['log'](_0xe6bf8d);logger[_0x4ab1('0xe')](_0x4ab1('0x1e'),_0x386fa9,_0xe6bf8d[_0x4ab1('0x1f')]);_0x5ec8cf[_0x4ab1('0x11')]();}};}; \ No newline at end of file +var _0x5c91=['[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','validate','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','error','[%s][AGENT]\x20%s','map','message','stop','find','agents','timeout','atimeout','channel','START:%s','rules','end','close','[%s][AGENT]\x20ROUTING\x20END','next','agent'];(function(_0x3ced9d,_0x18daa5){var _0xa06cbb=function(_0x3e6c51){while(--_0x3e6c51){_0x3ced9d['push'](_0x3ced9d['shift']());}};_0xa06cbb(++_0x18daa5);}(_0x5c91,0xe9));var _0x15c9=function(_0x349918,_0x10fb9d){_0x349918=_0x349918-0x0;var _0x308c1d=_0x5c91[_0x349918];return _0x308c1d;};'use strict';var schema=require(_0x15c9('0x0'));var _=require('lodash');var util=require(_0x15c9('0x1'));var seqqueue=require(_0x15c9('0x2'));var logger=require(_0x15c9('0x3'))(_0x15c9('0x4'));var strategy=require(_0x15c9('0x5'));var queue=schema({'name':{'type':_0x15c9('0x6'),'required':!![],'message':_0x15c9('0x7')},'timeout':{'type':'number','message':_0x15c9('0x8')}});function writeLog(_0x5f1a1e,_0x169358,_0x229e2f){return logger[_0x15c9('0x9')](util['format'](_0x15c9('0xa'),_0x5f1a1e,_0x169358['name'],_0x229e2f));}function handleFindAgent(_0x5d0670){return function(_0x14e0a2){return _0x14e0a2[_0x15c9('0xb')][_0x15c9('0xc')]()===_0x5d0670[_0x15c9('0xc')]();};}exports[_0x15c9('0xd')]=function(_0x4c3d24,_0x4f8f16,_0x4e54b5,_0x12cf7c){return function(_0x3dc1b2){try{var _0x4efe0e={'name':_0x4f8f16[0x0],'timeout':_0x4f8f16[0x1]};var _0x2c7bdf=queue[_0x15c9('0x0')](_0x4efe0e,{'typecast':!![]});if(_0x2c7bdf['length']){logger[_0x15c9('0xe')](_0x15c9('0xf'),_0x4c3d24,_[_0x15c9('0x10')](_0x2c7bdf,_0x15c9('0x11'))['join'](',\x20'));_0x3dc1b2[_0x15c9('0x12')]();}else{var _0x325b5f=_[_0x15c9('0x13')](_0x4e54b5[_0x15c9('0x14')],handleFindAgent(_0x4efe0e['name']));if(_0x325b5f){var _0x5b93f2=(_0x4efe0e[_0x15c9('0x15')]||0xa)*0x3e8;var _0x59305e,_0x3b280d;var _0x25e7c6=seqqueue['createQueue'](_0x5b93f2);_0x25e7c6['id']=_0x4c3d24;_0x25e7c6[_0x15c9('0x16')]=_0x5b93f2;_0x25e7c6[_0x15c9('0x17')]=_0x12cf7c['channel'];writeLog(_0x4c3d24,_0x325b5f,util['format'](_0x15c9('0x18'),_0x5b93f2));_0x4e54b5[_0x15c9('0x19')][_0x4c3d24]['on'](_0x15c9('0x1a'),function(){logger['info']('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x4c3d24);clearTimeout(_0x3b280d);_0x3b280d=undefined;_0x25e7c6[_0x15c9('0x1b')]();if(_0x4e54b5[_0x15c9('0x19')][_0x4c3d24]){delete _0x4e54b5['rules'][_0x4c3d24];}_0x3dc1b2[_0x15c9('0x12')]();});_0x4e54b5[_0x15c9('0x19')][_0x4c3d24]['on']('complete',function(){if(_0x4e54b5[_0x15c9('0x19')][_0x4c3d24]){delete _0x4e54b5[_0x15c9('0x19')][_0x4c3d24];}});_0x3b280d=setTimeout(function(){logger['info'](_0x15c9('0x1c'),_0x4c3d24);clearTimeout(_0x3b280d);_0x25e7c6[_0x15c9('0x1b')]();_0x3dc1b2[_0x15c9('0x1d')]();},_0x5b93f2);strategy[_0x15c9('0x1e')](_0x25e7c6,_0x325b5f,_0x4e54b5,_0x12cf7c);}else{logger[_0x15c9('0xe')](_0x15c9('0x1f'),_0x4c3d24,_0x4efe0e[_0x15c9('0xb')]);_0x3dc1b2[_0x15c9('0x12')]();}}}catch(_0x28d07a){console['log'](_0x28d07a);logger[_0x15c9('0xe')](_0x15c9('0x20'),_0x4c3d24,_0x28d07a['stack']);_0x3dc1b2[_0x15c9('0x12')]();}};}; \ 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 143f35f..f3e1ca2 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 _0x3f32=['ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','body','getMustacheRender','Message','create','then','[%s][AMAZONLEX]\x20%s','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','amazonlex','providerName','providerResponse','stringify','dialogState','Failed','catch','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone'];(function(_0x48ebe8,_0x300832){var _0x5c65fb=function(_0x55a95b){while(--_0x55a95b){_0x48ebe8['push'](_0x48ebe8['shift']());}};_0x5c65fb(++_0x300832);}(_0x3f32,0xdc));var _0x23f3=function(_0x54f859,_0x59d463){_0x54f859=_0x54f859-0x0;var _0x17a08b=_0x3f32[_0x54f859];return _0x17a08b;};'use strict';var _=require('lodash');var moment=require(_0x23f3('0x0'));var AWS=require('aws-sdk');var utils=require(_0x23f3('0x1'));var logger=require(_0x23f3('0x2'))(_0x23f3('0x3'));var rpc={'chatMessage':require(_0x23f3('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x23f3('0x5')),'smsMessage':require(_0x23f3('0x6')),'faxMessage':require(_0x23f3('0x7')),'whatsappMessage':require(_0x23f3('0x8'))};exports['consequence']=function(_0x2237a3,_0x262253){return function(_0x3581b6){try{if(!_[_0x23f3('0x9')](this[_0x23f3('0xa')][_0x23f3('0xb')])){logger[_0x23f3('0xc')]('[%s][AMAZONLEX]\x20%s',_0x2237a3,_0x23f3('0xd'));return _0x3581b6[_0x23f3('0xe')]();}var _0x24bf8a={'ContactId':this['contact']['id'],'sentAt':moment()[_0x23f3('0xf')](_0x23f3('0x10')),'direction':_0x23f3('0x11')};if(this[_0x23f3('0x12')]==='sms'||this[_0x23f3('0x12')]==='whatsapp'){_0x24bf8a[_0x23f3('0x13')]=this[_0x23f3('0xa')]['phone'];}var _0x4b063d=this['channel'];if(_0x4b063d==='chat'){_0x24bf8a[_0x23f3('0x14')]=this['account']['id'];}else{_0x24bf8a[_[_0x23f3('0x15')](_0x4b063d)+_0x23f3('0x16')]=this[_0x23f3('0x17')]['id'];}_0x24bf8a[_[_0x23f3('0x15')](_0x4b063d)+_0x23f3('0x18')]=this[_0x23f3('0xa')]['id'];if(this[_0x23f3('0xa')][_0x23f3('0x19')]){var _0x2841c0=_0x262253[0x4];if(!_['isEmpty'](_0x2841c0)){_0x24bf8a[_0x23f3('0x1a')]=utils[_0x23f3('0x1b')](_0x2841c0,this);return rpc[_0x4b063d+_0x23f3('0x1c')][_0x23f3('0x1d')](_0x24bf8a)[_0x23f3('0x1e')](function(_0x8d934f){logger[_0x23f3('0xc')](_0x23f3('0x1f'),_0x2237a3,_0x24bf8a[_0x23f3('0x1a')]);})['catch'](function(_0x48e0ea){logger[_0x23f3('0x20')](_0x23f3('0x1f'),_0x2237a3,JSON['stringify'](_0x48e0ea));})[_0x23f3('0x21')](function(){logger['info'](_0x23f3('0x22'),_0x2237a3);_0x3581b6[_0x23f3('0x23')]();});}else{logger[_0x23f3('0xc')](_0x23f3('0x24'),_0x2237a3);_0x3581b6['stop']();}}else{var _0x5a86c1=this;var _0x349541=new AWS[(_0x23f3('0x25'))]({'accessKeyId':_0x262253[0x0],'secretAccessKey':_0x262253[0x1],'region':_0x262253[0x2]});var _0x14e0e9={'botAlias':_0x23f3('0x26'),'botName':_0x262253[0x3],'inputText':this[_0x23f3('0x27')][_0x23f3('0x1a')],'userId':this[_0x23f3('0x12')]+':'+this[_0x23f3('0xa')]['id'][_0x23f3('0x28')]()};_0x349541['postText'](_0x14e0e9,function(_0x27e27d,_0x48ca85){if(_0x27e27d){logger[_0x23f3('0x20')](_0x23f3('0x1f'),_0x2237a3,_0x27e27d[_0x23f3('0x27')]);_0x3581b6['next']();}else if(_0x48ca85&&_0x48ca85[_0x23f3('0x27')]){_0x5a86c1[_0x23f3('0x1a')][_0x23f3('0x29')]=_0x48ca85;_0x24bf8a['body']=_0x48ca85['message'];_0x24bf8a[_0x23f3('0x2a')]=_0x23f3('0x29');_0x24bf8a[_0x23f3('0x2b')]=JSON[_0x23f3('0x2c')](_0x48ca85);return rpc[_0x4b063d+_0x23f3('0x1c')][_0x23f3('0x1d')](_0x24bf8a)[_0x23f3('0x1e')](function(_0x160895){logger[_0x23f3('0xc')](_0x23f3('0x1f'),_0x2237a3,_0x24bf8a[_0x23f3('0x1a')]);if(_0x48ca85[_0x23f3('0x2d')]==_0x23f3('0x2e')){_0x3581b6[_0x23f3('0xe')]();}else{_0x3581b6[_0x23f3('0x23')]();}})[_0x23f3('0x2f')](function(_0x593a35){logger[_0x23f3('0x20')](_0x23f3('0x1f'),_0x2237a3,JSON[_0x23f3('0x2c')](_0x593a35));_0x3581b6[_0x23f3('0xe')]();});}else{_0x3581b6['next']();}});}}catch(_0x504ce5){logger['error'](_0x23f3('0x1f'),_0x2237a3,JSON[_0x23f3('0x2c')](_0x504ce5));_0x3581b6['stop']();}};}; \ No newline at end of file +var _0x5fcc=['created','isEmpty','body','Message','create','then','catch','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','error','next','amazonlex','providerName','providerResponse','dialogState','Failed','lodash','aws-sdk','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','info','[%s][AMAZONLEX]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone','interaction','chat','account','InteractionId'];(function(_0x5caf7e,_0x52e1bc){var _0x5c3435=function(_0xb77e11){while(--_0xb77e11){_0x5caf7e['push'](_0x5caf7e['shift']());}};_0x5c3435(++_0x52e1bc);}(_0x5fcc,0x12c));var _0xc5fc=function(_0x14767c,_0xae3b4){_0x14767c=_0x14767c-0x0;var _0x36f33d=_0x5fcc[_0x14767c];return _0x36f33d;};'use strict';var _=require(_0xc5fc('0x0'));var moment=require('moment');var AWS=require(_0xc5fc('0x1'));var utils=require(_0xc5fc('0x2'));var logger=require(_0xc5fc('0x3'))('routing');var rpc={'chatMessage':require(_0xc5fc('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xc5fc('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xc5fc('0x6')),'whatsappMessage':require(_0xc5fc('0x7'))};exports[_0xc5fc('0x8')]=function(_0x44e84d,_0x1ff30f){return function(_0x38ac9d){try{if(!_[_0xc5fc('0x9')](this['interaction']['UserId'])){logger[_0xc5fc('0xa')](_0xc5fc('0xb'),_0x44e84d,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x38ac9d['next']();}var _0x1f6b3a={'ContactId':this[_0xc5fc('0xc')]['id'],'sentAt':moment()[_0xc5fc('0xd')](_0xc5fc('0xe')),'direction':_0xc5fc('0xf')};if(this[_0xc5fc('0x10')]==='sms'||this[_0xc5fc('0x10')]==='whatsapp'){_0x1f6b3a[_0xc5fc('0x11')]=this[_0xc5fc('0x12')]['phone'];}var _0x1cfc97=this['channel'];if(_0x1cfc97===_0xc5fc('0x13')){_0x1f6b3a['ChatWebsiteId']=this[_0xc5fc('0x14')]['id'];}else{_0x1f6b3a[_['upperFirst'](_0x1cfc97)+'AccountId']=this[_0xc5fc('0x14')]['id'];}_0x1f6b3a[_['upperFirst'](_0x1cfc97)+_0xc5fc('0x15')]=this[_0xc5fc('0x12')]['id'];if(this[_0xc5fc('0x12')][_0xc5fc('0x16')]){var _0x20fbf4=_0x1ff30f[0x4];if(!_[_0xc5fc('0x17')](_0x20fbf4)){_0x1f6b3a[_0xc5fc('0x18')]=utils['getMustacheRender'](_0x20fbf4,this);return rpc[_0x1cfc97+_0xc5fc('0x19')][_0xc5fc('0x1a')](_0x1f6b3a)[_0xc5fc('0x1b')](function(_0x3243bb){logger[_0xc5fc('0xa')](_0xc5fc('0xb'),_0x44e84d,_0x1f6b3a[_0xc5fc('0x18')]);})[_0xc5fc('0x1c')](function(_0x326031){logger['error'](_0xc5fc('0xb'),_0x44e84d,JSON[_0xc5fc('0x1d')](_0x326031));})[_0xc5fc('0x1e')](function(){logger[_0xc5fc('0xa')](_0xc5fc('0x1f'),_0x44e84d);_0x38ac9d[_0xc5fc('0x20')]();});}else{logger['info'](_0xc5fc('0x21'),_0x44e84d);_0x38ac9d[_0xc5fc('0x20')]();}}else{var _0x33c177=this;var _0x37abda=new AWS[(_0xc5fc('0x22'))]({'accessKeyId':_0x1ff30f[0x0],'secretAccessKey':_0x1ff30f[0x1],'region':_0x1ff30f[0x2]});var _0x340239={'botAlias':_0xc5fc('0x23'),'botName':_0x1ff30f[0x3],'inputText':this[_0xc5fc('0x24')][_0xc5fc('0x18')],'userId':this[_0xc5fc('0x10')]+':'+this['interaction']['id'][_0xc5fc('0x25')]()};_0x37abda[_0xc5fc('0x26')](_0x340239,function(_0x31f262,_0x457972){if(_0x31f262){logger[_0xc5fc('0x27')]('[%s][AMAZONLEX]\x20%s',_0x44e84d,_0x31f262[_0xc5fc('0x24')]);_0x38ac9d[_0xc5fc('0x28')]();}else if(_0x457972&&_0x457972[_0xc5fc('0x24')]){_0x33c177[_0xc5fc('0x18')][_0xc5fc('0x29')]=_0x457972;_0x1f6b3a['body']=_0x457972['message'];_0x1f6b3a[_0xc5fc('0x2a')]=_0xc5fc('0x29');_0x1f6b3a[_0xc5fc('0x2b')]=JSON['stringify'](_0x457972);return rpc[_0x1cfc97+'Message'][_0xc5fc('0x1a')](_0x1f6b3a)[_0xc5fc('0x1b')](function(_0x29030a){logger['info']('[%s][AMAZONLEX]\x20%s',_0x44e84d,_0x1f6b3a['body']);if(_0x457972[_0xc5fc('0x2c')]==_0xc5fc('0x2d')){_0x38ac9d[_0xc5fc('0x28')]();}else{_0x38ac9d[_0xc5fc('0x20')]();}})[_0xc5fc('0x1c')](function(_0xedff6a){logger[_0xc5fc('0x27')](_0xc5fc('0xb'),_0x44e84d,JSON['stringify'](_0xedff6a));_0x38ac9d[_0xc5fc('0x28')]();});}else{_0x38ac9d[_0xc5fc('0x28')]();}});}}catch(_0x448437){logger[_0xc5fc('0x27')](_0xc5fc('0xb'),_0x44e84d,JSON[_0xc5fc('0x1d')](_0x448437));_0x38ac9d[_0xc5fc('0x20')]();}};}; \ 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 2de0747..1203728 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 _0x419e=[''+_[_0xe419('0x37')](_0x117e61[_0xe419('0x12')],_0xe419('0x38'),_0xe419('0x39'))+'';_0x117e61[_0xe419('0x3a')]={'Auto-Submitted':_0xe419('0x3b'),'X-Auto-Response-Suppress':_0xe419('0x3c'),'Precedence':'auto_reply'};return mailRpc[_0xe419('0x3d')](_0x274301,_0x117e61)[_0xe419('0x3e')](function(_0x34fcb9){logger[_0xe419('0x14')](_0xe419('0x3f'),_0xd14718);_0x117e61[_0xe419('0x35')]=_0x34fcb9[_0xe419('0x1f')][_0xe419('0x35')];return rpc[_0x505774+_0xe419('0x2b')][_0xe419('0x40')](_0x117e61);})['then'](function(_0x486189){logger[_0xe419('0x14')](_0xe419('0x15'),_0xd14718,JSON['stringify'](_0x486189));})[_0xe419('0x41')](function(_0x2446fd){logger[_0xe419('0x42')](_0xe419('0x43'),_0xd14718,JSON['stringify'](_0x2446fd));})['finally'](function(){Promise[_0xe419('0x44')]()[_0xe419('0x3e')](function(){if(_0x2ee44f[0x0]!=='2'||_0x3869a2[_0xe419('0x19')])return;return rpc[_0x505774+'Interaction'][_0xe419('0x45')](_0x3869a2['id'],{'autoreplyExecuted':!![]})[_0xe419('0x3e')](function(_0x11921e){logger[_0xe419('0x14')](_0xe419('0x1a'),_0xd14718,JSON[_0xe419('0x46')](_0x11921e));})[_0xe419('0x41')](function(_0x157756){logger['error']('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0xd14718,JSON[_0xe419('0x46')](_0x157756));});})[_0xe419('0x3e')](function(){_0x4c3b99[_0xe419('0x16')]();});});}else{return rpc[this[_0xe419('0x10')]+'Message'][_0xe419('0x40')](_0x117e61)['then'](function(_0x523bf5){logger[_0xe419('0x14')](_0xe419('0x15'),_0xd14718,_0x117e61['body']);})[_0xe419('0x41')](function(_0x437e5c){logger[_0xe419('0x42')](_0xe419('0x15'),_0xd14718,JSON[_0xe419('0x46')](_0x437e5c));})[_0xe419('0x47')](function(){Promise[_0xe419('0x44')]()[_0xe419('0x3e')](function(){if(_0x2ee44f[0x0]!=='2'||_0x3869a2[_0xe419('0x19')])return;return rpc[_0x505774+_0xe419('0x48')][_0xe419('0x45')](_0x3869a2['id'],{'autoreplyExecuted':!![]})['then'](function(_0x1e2e7d){logger[_0xe419('0x14')](_0xe419('0x1a'),_0xd14718,JSON['stringify'](_0x1e2e7d));})[_0xe419('0x41')](function(_0x41c6fc){logger[_0xe419('0x42')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0xd14718,JSON['stringify'](_0x41c6fc));});})[_0xe419('0x3e')](function(){_0x4c3b99[_0xe419('0x16')]();});});}}}catch(_0x3a512e){logger[_0xe419('0x42')](_0xe419('0x15'),_0xd14718,JSON[_0xe419('0x46')](_0x3a512e));_0x4c3b99[_0xe419('0x49')]();}};}; \ No newline at end of file +var _0xb129=['read','subject','startsWith','Re:','Re:\x20','chat','account','upperFirst','AccountId','InteractionId','Message','Smtp','service','host','port','secure','authentication','user','pass','inReplyTo','messageId','','replace','','headers','All','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','mail','body','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','info','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','getMustacheRender','message','phone'];(function(_0x4c5e14,_0x3d62a9){var _0x35d4b6=function(_0x406c92){while(--_0x406c92){_0x4c5e14['push'](_0x4c5e14['shift']());}};_0x35d4b6(++_0x3d62a9);}(_0xb129,0x75));var _0x9b12=function(_0x17de8f,_0x2d5177){_0x17de8f=_0x17de8f-0x0;var _0xc19ec4=_0xb129[_0x17de8f];return _0xc19ec4;};'use strict';var _=require(_0x9b12('0x0'));var moment=require('moment');var utils=require(_0x9b12('0x1'));var logger=require(_0x9b12('0x2'))('routing');var rpc={'chatMessage':require(_0x9b12('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x9b12('0x4')),'smsMessage':require(_0x9b12('0x5')),'faxMessage':require(_0x9b12('0x6')),'whatsappMessage':require(_0x9b12('0x7')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0x9b12('0x8')),'whatsappInteraction':require(_0x9b12('0x9'))};var mailRpc=require(_0x9b12('0xa'));exports['consequence']=function(_0x553e41,_0x3ffc6f,_0x4f560c,_0x9a746f){return function(_0x4628c2){try{var _0x9676d=this['channel'];if(_0x9676d===_0x9b12('0xb')&&_0x9a746f[_0x9b12('0xc')][_0x9b12('0xd')]){logger['info'](_0x9b12('0xe'),_0x553e41,_0x9b12('0xf'));return _0x4628c2[_0x9b12('0x10')]();}if(_0x3ffc6f[0x0]==='1'&&(_[_0x9b12('0x11')](this[_0x9b12('0x12')][_0x9b12('0x13')])||!this[_0x9b12('0x12')][_0x9b12('0x13')])){logger[_0x9b12('0x14')]('[%s][AUTOREPLY]\x20%s',_0x553e41,_0x9b12('0x15'));return _0x4628c2[_0x9b12('0x10')]();}if(_0x3ffc6f[0x0]==='2'&&this[_0x9b12('0x12')][_0x9b12('0x16')]){logger[_0x9b12('0x14')](_0x9b12('0x17'),_0x553e41,_0x9b12('0x18'));return _0x4628c2['next']();}var _0x188af3={'ContactId':this[_0x9b12('0x19')]['id'],'sentAt':moment()[_0x9b12('0x1a')](_0x9b12('0x1b')),'direction':_0x9b12('0x1c')};if(this[_0x9b12('0x1d')]===_0x9b12('0xb')){_0x188af3[_0x9b12('0xc')]=utils[_0x9b12('0x1e')](_0x3ffc6f[0x2],this);}else{_0x188af3['body']=utils['getMustacheRender'](_0x3ffc6f[0x1],this);}if(this[_0x9b12('0x1f')]){_0x188af3['to']=this[_0x9b12('0x1f')]['from']||'';if(this[_0x9b12('0x1d')]===_0x9b12('0xb')&&_0x3ffc6f[0x1]==='1'){_0x188af3['cc']=this['message']['cc']||'';}_0x188af3['from']=this[_0x9b12('0x1f')]['to']||'';_0x188af3[_0x9b12('0x20')]=this['message'][_0x9b12('0x20')]||'';_0x188af3[_0x9b12('0x21')]=!![];if(this['message']['subject']){_0x188af3[_0x9b12('0x22')]='';_0x188af3[_0x9b12('0x22')]+=_[_0x9b12('0x23')](this[_0x9b12('0x1f')][_0x9b12('0x22')],_0x9b12('0x24'))?'':_0x9b12('0x25');_0x188af3[_0x9b12('0x22')]+=this[_0x9b12('0x1f')]['subject'];}}if(this[_0x9b12('0x1d')]===_0x9b12('0x26')){_0x188af3['ChatWebsiteId']=this[_0x9b12('0x27')]['id'];}else{_0x188af3[_[_0x9b12('0x28')](this['channel'])+_0x9b12('0x29')]=this[_0x9b12('0x27')]['id'];}_0x188af3[_[_0x9b12('0x28')](this[_0x9b12('0x1d')])+_0x9b12('0x2a')]=this[_0x9b12('0x12')]['id'];var _0x95da94=this[_0x9b12('0x12')];if(rpc[this[_0x9b12('0x1d')]+_0x9b12('0x2b')]){if(this[_0x9b12('0x1d')]===_0x9b12('0xb')){var _0x3f4b6f={'tls':{'rejectUnauthorized':![]}};if(this[_0x9b12('0x27')][_0x9b12('0x2c')][_0x9b12('0x2d')]){_0x3f4b6f[_0x9b12('0x2d')]=this[_0x9b12('0x27')]['Smtp'][_0x9b12('0x2d')];}else{_0x3f4b6f['host']=this[_0x9b12('0x27')][_0x9b12('0x2c')][_0x9b12('0x2e')];_0x3f4b6f[_0x9b12('0x2f')]=this[_0x9b12('0x27')][_0x9b12('0x2c')]['port'];_0x3f4b6f[_0x9b12('0x30')]=this[_0x9b12('0x27')][_0x9b12('0x2c')][_0x9b12('0x30')];}if(this[_0x9b12('0x27')][_0x9b12('0x2c')][_0x9b12('0x31')]){_0x3f4b6f['auth']={'user':this['account'][_0x9b12('0x2c')][_0x9b12('0x32')],'pass':this[_0x9b12('0x27')][_0x9b12('0x2c')][_0x9b12('0x33')]};}_0x188af3[_0x9b12('0x34')]=this[_0x9b12('0x1f')][_0x9b12('0x35')];_0x188af3['html']=_0x9b12('0x36')+_[_0x9b12('0x37')](_0x188af3['body'],_0x9b12('0x38'),_0x9b12('0x39'))+_0x9b12('0x3a');_0x188af3[_0x9b12('0x3b')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x9b12('0x3c'),'Precedence':_0x9b12('0x3d')};return mailRpc[_0x9b12('0x3e')](_0x3f4b6f,_0x188af3)[_0x9b12('0x3f')](function(_0x232c6){logger['info'](_0x9b12('0x40'),_0x553e41);_0x188af3[_0x9b12('0x35')]=_0x232c6[_0x9b12('0x1f')][_0x9b12('0x35')];return rpc[_0x9676d+_0x9b12('0x2b')][_0x9b12('0x41')](_0x188af3);})[_0x9b12('0x3f')](function(_0x52dcd4){logger['info'](_0x9b12('0xe'),_0x553e41,JSON[_0x9b12('0x42')](_0x52dcd4));})[_0x9b12('0x43')](function(_0x5b800c){logger[_0x9b12('0x44')](_0x9b12('0x45'),_0x553e41,JSON[_0x9b12('0x42')](_0x5b800c));})[_0x9b12('0x46')](function(){Promise['resolve']()[_0x9b12('0x3f')](function(){if(_0x3ffc6f[0x0]!=='2'||_0x95da94[_0x9b12('0x16')])return;return rpc[_0x9676d+_0x9b12('0x47')][_0x9b12('0x48')](_0x95da94['id'],{'autoreplyExecuted':!![]})['then'](function(_0x5e8801){logger[_0x9b12('0x14')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x553e41,JSON[_0x9b12('0x42')](_0x5e8801));})['catch'](function(_0x4fc679){logger[_0x9b12('0x44')](_0x9b12('0x49'),_0x553e41,JSON[_0x9b12('0x42')](_0x4fc679));});})[_0x9b12('0x3f')](function(){_0x4628c2[_0x9b12('0x10')]();});});}else{return rpc[this[_0x9b12('0x1d')]+_0x9b12('0x2b')][_0x9b12('0x41')](_0x188af3)[_0x9b12('0x3f')](function(_0x57b0ac){logger[_0x9b12('0x14')](_0x9b12('0xe'),_0x553e41,_0x188af3['body']);})['catch'](function(_0x402814){logger['error']('[%s][AUTOREPLY]\x20%s',_0x553e41,JSON[_0x9b12('0x42')](_0x402814));})[_0x9b12('0x46')](function(){Promise['resolve']()['then'](function(){if(_0x3ffc6f[0x0]!=='2'||_0x95da94[_0x9b12('0x16')])return;return rpc[_0x9676d+_0x9b12('0x47')][_0x9b12('0x48')](_0x95da94['id'],{'autoreplyExecuted':!![]})[_0x9b12('0x3f')](function(_0x21f891){logger['info'](_0x9b12('0x17'),_0x553e41,JSON[_0x9b12('0x42')](_0x21f891));})[_0x9b12('0x43')](function(_0x54a010){logger[_0x9b12('0x44')](_0x9b12('0x49'),_0x553e41,JSON[_0x9b12('0x42')](_0x54a010));});})[_0x9b12('0x3f')](function(){_0x4628c2[_0x9b12('0x10')]();});});}}}catch(_0x22ed11){logger[_0x9b12('0x44')](_0x9b12('0xe'),_0x553e41,JSON['stringify'](_0x22ed11));_0x4628c2[_0x9b12('0x4a')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index de317ab..e47cb82 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x97d5=['../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','then','interaction','error','[%s][CLOSE]\x20%s','finally','stop','stringify','../../../../config/logger','routing'];(function(_0x2b97f6,_0x3109dd){var _0x605ab=function(_0x595423){while(--_0x595423){_0x2b97f6['push'](_0x2b97f6['shift']());}};_0x605ab(++_0x3109dd);}(_0x97d5,0x1ca));var _0x597d=function(_0x3f1a77,_0x100ae0){_0x3f1a77=_0x3f1a77-0x0;var _0x3370ed=_0x97d5[_0x3f1a77];return _0x3370ed;};'use strict';var moment=require('moment');var logger=require(_0x597d('0x0'))(_0x597d('0x1'));var rpc={'chatInteraction':require(_0x597d('0x2')),'openchannelInteraction':require(_0x597d('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x597d('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x597d('0x5')]=function(_0x447f32,_0x46e4b6,_0x436e2a,_0xcd37c2){return function(_0x544f3b){try{logger[_0x597d('0x6')](_0x597d('0x7'),_0x447f32,_0x46e4b6[0x0]);var _0x49a3a4={'closed':0x1,'closedAt':moment()[_0x597d('0x8')](_0x597d('0x9')),'closeReason':'system','disposition':_0x46e4b6[0x0]};if(rpc[_0xcd37c2[_0x597d('0xa')]+_0x597d('0xb')]){rpc[_0xcd37c2[_0x597d('0xa')]+_0x597d('0xb')][_0x597d('0xc')](_0xcd37c2['interaction']['id'],_0x49a3a4)[_0x597d('0xd')](function(_0x19886c){logger[_0x597d('0x6')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x447f32,_0xcd37c2[_0x597d('0xe')]['id']);})['catch'](function(_0x2384cb){logger[_0x597d('0xf')](_0x597d('0x10'),_0x447f32,JSON['stringify'](_0x2384cb));})[_0x597d('0x11')](function(){_0x544f3b[_0x597d('0x12')]();});}}catch(_0x4c6c1c){logger['error'](_0x597d('0x10'),_0x447f32,JSON[_0x597d('0x13')](_0x4c6c1c));_0x544f3b[_0x597d('0x12')]();}};}; \ No newline at end of file +var _0xff69=['YYYY-MM-DD\x20HH:mm:ss','system','Interaction','channel','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','stringify','finally','stop','error','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','format'];(function(_0x2cbe7e,_0x392465){var _0x4fd793=function(_0x175c40){while(--_0x175c40){_0x2cbe7e['push'](_0x2cbe7e['shift']());}};_0x4fd793(++_0x392465);}(_0xff69,0xce));var _0x9ff6=function(_0x2ff4bd,_0x4780a6){_0x2ff4bd=_0x2ff4bd-0x0;var _0x28edc6=_0xff69[_0x2ff4bd];return _0x28edc6;};'use strict';var moment=require('moment');var logger=require(_0x9ff6('0x0'))(_0x9ff6('0x1'));var rpc={'chatInteraction':require(_0x9ff6('0x2')),'openchannelInteraction':require(_0x9ff6('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x9ff6('0x4')),'faxInteraction':require(_0x9ff6('0x5')),'whatsappInteraction':require(_0x9ff6('0x6'))};exports[_0x9ff6('0x7')]=function(_0x3cb4bd,_0x3290fd,_0xd42f52,_0x17e3ec){return function(_0x145a26){try{logger[_0x9ff6('0x8')]('[%s][CLOSE]\x20reason\x20%s',_0x3cb4bd,_0x3290fd[0x0]);var _0x1238af={'closed':0x1,'closedAt':moment()[_0x9ff6('0x9')](_0x9ff6('0xa')),'closeReason':_0x9ff6('0xb'),'disposition':_0x3290fd[0x0]};if(rpc[_0x17e3ec['channel']+_0x9ff6('0xc')]){rpc[_0x17e3ec[_0x9ff6('0xd')]+_0x9ff6('0xc')][_0x9ff6('0xe')](_0x17e3ec[_0x9ff6('0xf')]['id'],_0x1238af)[_0x9ff6('0x10')](function(_0x58ef0e){logger[_0x9ff6('0x8')](_0x9ff6('0x11'),_0x3cb4bd,_0x17e3ec[_0x9ff6('0xf')]['id']);})[_0x9ff6('0x12')](function(_0x2500c6){logger['error'](_0x9ff6('0x13'),_0x3cb4bd,JSON[_0x9ff6('0x14')](_0x2500c6));})[_0x9ff6('0x15')](function(){_0x145a26[_0x9ff6('0x16')]();});}}catch(_0xff0889){logger[_0x9ff6('0x17')](_0x9ff6('0x13'),_0x3cb4bd,JSON[_0x9ff6('0x14')](_0xff0889));_0x145a26[_0x9ff6('0x16')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index a2b11de..2d359b4 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5419=['endConversation','catch','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','phone','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','body','getMustacheRender','Message','create','then','[%s][DIALOGFLOW]\x20%s','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','fulfillment','providerName','providerResponse','metadata'];(function(_0x49e759,_0x26f831){var _0x3f1269=function(_0x5a46d3){while(--_0x5a46d3){_0x49e759['push'](_0x49e759['shift']());}};_0x3f1269(++_0x26f831);}(_0x5419,0x175));var _0x9541=function(_0x37ee87,_0x2b2b62){_0x37ee87=_0x37ee87-0x0;var _0x4ffc88=_0x5419[_0x37ee87];return _0x4ffc88;};'use strict';var _=require(_0x9541('0x0'));var moment=require(_0x9541('0x1'));var apiai=require(_0x9541('0x2'));var md5=require(_0x9541('0x3'));var utils=require(_0x9541('0x4'));var logger=require(_0x9541('0x5'))(_0x9541('0x6'));var rpc={'chatMessage':require(_0x9541('0x7')),'openchannelMessage':require(_0x9541('0x8')),'mailMessage':require(_0x9541('0x9')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x9541('0xa')),'whatsappMessage':require(_0x9541('0xb'))};exports[_0x9541('0xc')]=function(_0x3c8491,_0x2aed30){return function(_0x22f42f){try{if(!_[_0x9541('0xd')](this[_0x9541('0xe')]['UserId'])){logger[_0x9541('0xf')]('[%s][DIALOGFLOW]\x20%s',_0x3c8491,_0x9541('0x10'));return _0x22f42f[_0x9541('0x11')]();}var _0x76ee06={'ContactId':this[_0x9541('0x12')]['id'],'sentAt':moment()[_0x9541('0x13')](_0x9541('0x14')),'direction':_0x9541('0x15')};if(this['channel']===_0x9541('0x16')||this['channel']==='whatsapp'){_0x76ee06[_0x9541('0x17')]=this['interaction'][_0x9541('0x17')];}var _0x596222=this[_0x9541('0x18')];if(_0x596222===_0x9541('0x19')){_0x76ee06[_0x9541('0x1a')]=this[_0x9541('0x1b')]['id'];}else{_0x76ee06[_[_0x9541('0x1c')](_0x596222)+_0x9541('0x1d')]=this['account']['id'];}_0x76ee06[_[_0x9541('0x1c')](_0x596222)+'InteractionId']=this[_0x9541('0xe')]['id'];if(this['interaction'][_0x9541('0x1e')]){var _0x5ad2f5=_0x2aed30[0x2];if(!_[_0x9541('0x1f')](_0x5ad2f5)){_0x76ee06[_0x9541('0x20')]=utils[_0x9541('0x21')](_0x5ad2f5,this);return rpc[_0x596222+_0x9541('0x22')][_0x9541('0x23')](_0x76ee06)[_0x9541('0x24')](function(_0x50e39f){logger['info'](_0x9541('0x25'),_0x3c8491,_0x76ee06[_0x9541('0x20')]);})['catch'](function(_0x4cf375){logger[_0x9541('0x26')](_0x9541('0x25'),_0x3c8491,JSON[_0x9541('0x27')](_0x4cf375));})[_0x9541('0x28')](function(){logger[_0x9541('0xf')](_0x9541('0x29'),_0x3c8491);_0x22f42f[_0x9541('0x2a')]();});}else{logger[_0x9541('0xf')](_0x9541('0x2b'),_0x3c8491);_0x22f42f[_0x9541('0x2a')]();}}else{var _0x43bb4c=this;var _0x54a827=apiai(_0x2aed30[0x0],{'language':_0x2aed30[0x1]||'en'});return _0x54a827[_0x9541('0x2c')](this[_0x9541('0x2d')][_0x9541('0x20')],{'sessionId':md5(this[_0x9541('0xe')]['id'])})[_0x9541('0x24')](function(_0x2f6b0a){_0x43bb4c[_0x9541('0x20')][_0x9541('0x2e')]=_0x2f6b0a;_0x76ee06[_0x9541('0x20')]=_0x2f6b0a['result'][_0x9541('0x2f')]['speech'];_0x76ee06[_0x9541('0x30')]=_0x9541('0x2e');_0x76ee06[_0x9541('0x31')]=JSON[_0x9541('0x27')](_0x2f6b0a);return rpc[_0x596222+'Message'][_0x9541('0x23')](_0x76ee06)[_0x9541('0x24')](function(_0x4f5602){logger[_0x9541('0xf')]('[%s][DIALOGFLOW]\x20%s',_0x3c8491,_0x76ee06[_0x9541('0x20')]);if(_0x2f6b0a['result'][_0x9541('0x32')][_0x9541('0x33')]){_0x22f42f['next']();}else{_0x22f42f[_0x9541('0x2a')]();}})[_0x9541('0x34')](function(_0x4f4d23){logger[_0x9541('0x26')](_0x9541('0x25'),_0x3c8491,JSON['stringify'](_0x4f4d23));_0x22f42f[_0x9541('0x11')]();});})['catch'](function(_0x4455cf){logger[_0x9541('0x26')](_0x9541('0x25'),_0x3c8491,_0x4455cf[_0x9541('0x2d')]);_0x22f42f[_0x9541('0x11')]();});}}catch(_0x33259c){logger[_0x9541('0x26')]('[%s][DIALOGFLOW]\x20%s',_0x3c8491,JSON[_0x9541('0x27')](_0x33259c));_0x22f42f[_0x9541('0x2a')]();}};}; \ No newline at end of file +var _0x8585=['fulfillment','providerResponse','metadata','endConversation','lodash','moment','apiai-promise','./utils','../../../../config/logger','../../rpc/mailMessage','../../rpc/smsMessage','consequence','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','info','[%s][DIALOGFLOW]\x20%s','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','then','result'];(function(_0x376246,_0xe73794){var _0x42de50=function(_0x502bcc){while(--_0x502bcc){_0x376246['push'](_0x376246['shift']());}};_0x42de50(++_0xe73794);}(_0x8585,0x64));var _0x5858=function(_0xcb2409,_0x401674){_0xcb2409=_0xcb2409-0x0;var _0x30e960=_0x8585[_0xcb2409];return _0x30e960;};'use strict';var _=require(_0x5858('0x0'));var moment=require(_0x5858('0x1'));var apiai=require(_0x5858('0x2'));var md5=require('md5');var utils=require(_0x5858('0x3'));var logger=require(_0x5858('0x4'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x5858('0x5')),'smsMessage':require(_0x5858('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x5858('0x7')]=function(_0x1d26d1,_0x3fd63f){return function(_0x5c8e94){try{if(!_['isNil'](this[_0x5858('0x8')][_0x5858('0x9')])){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x1d26d1,_0x5858('0xa'));return _0x5c8e94[_0x5858('0xb')]();}var _0x4f25d6={'ContactId':this[_0x5858('0xc')]['id'],'sentAt':moment()[_0x5858('0xd')](_0x5858('0xe')),'direction':_0x5858('0xf')};if(this[_0x5858('0x10')]===_0x5858('0x11')||this[_0x5858('0x10')]===_0x5858('0x12')){_0x4f25d6[_0x5858('0x13')]=this['interaction'][_0x5858('0x13')];}var _0x11d333=this[_0x5858('0x10')];if(_0x11d333==='chat'){_0x4f25d6[_0x5858('0x14')]=this[_0x5858('0x15')]['id'];}else{_0x4f25d6[_[_0x5858('0x16')](_0x11d333)+_0x5858('0x17')]=this[_0x5858('0x15')]['id'];}_0x4f25d6[_[_0x5858('0x16')](_0x11d333)+_0x5858('0x18')]=this[_0x5858('0x8')]['id'];if(this[_0x5858('0x8')][_0x5858('0x19')]){var _0x3b0f08=_0x3fd63f[0x2];if(!_[_0x5858('0x1a')](_0x3b0f08)){_0x4f25d6[_0x5858('0x1b')]=utils[_0x5858('0x1c')](_0x3b0f08,this);return rpc[_0x11d333+_0x5858('0x1d')][_0x5858('0x1e')](_0x4f25d6)['then'](function(_0x18100f){logger[_0x5858('0x1f')](_0x5858('0x20'),_0x1d26d1,_0x4f25d6['body']);})[_0x5858('0x21')](function(_0x30b51d){logger[_0x5858('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x1d26d1,JSON[_0x5858('0x23')](_0x30b51d));})[_0x5858('0x24')](function(){logger['info'](_0x5858('0x25'),_0x1d26d1);_0x5c8e94[_0x5858('0x26')]();});}else{logger[_0x5858('0x1f')](_0x5858('0x27'),_0x1d26d1);_0x5c8e94[_0x5858('0x26')]();}}else{var _0x49d1af=this;var _0x1d772c=apiai(_0x3fd63f[0x0],{'language':_0x3fd63f[0x1]||'en'});return _0x1d772c[_0x5858('0x28')](this[_0x5858('0x29')]['body'],{'sessionId':md5(this[_0x5858('0x8')]['id'])})[_0x5858('0x2a')](function(_0x28105f){_0x49d1af[_0x5858('0x1b')]['dialogflow']=_0x28105f;_0x4f25d6['body']=_0x28105f[_0x5858('0x2b')][_0x5858('0x2c')]['speech'];_0x4f25d6['providerName']='dialogflow';_0x4f25d6[_0x5858('0x2d')]=JSON[_0x5858('0x23')](_0x28105f);return rpc[_0x11d333+_0x5858('0x1d')]['create'](_0x4f25d6)[_0x5858('0x2a')](function(_0x1d0539){logger[_0x5858('0x1f')]('[%s][DIALOGFLOW]\x20%s',_0x1d26d1,_0x4f25d6[_0x5858('0x1b')]);if(_0x28105f[_0x5858('0x2b')][_0x5858('0x2e')][_0x5858('0x2f')]){_0x5c8e94['next']();}else{_0x5c8e94[_0x5858('0x26')]();}})[_0x5858('0x21')](function(_0x598538){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x1d26d1,JSON[_0x5858('0x23')](_0x598538));_0x5c8e94[_0x5858('0xb')]();});})[_0x5858('0x21')](function(_0x4dc403){logger[_0x5858('0x22')](_0x5858('0x20'),_0x1d26d1,_0x4dc403[_0x5858('0x29')]);_0x5c8e94[_0x5858('0xb')]();});}}catch(_0x4c1a05){logger[_0x5858('0x22')](_0x5858('0x20'),_0x1d26d1,JSON['stringify'](_0x4c1a05));_0x5c8e94[_0x5858('0x26')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index f93725e..7a96a05 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc343=['diagnosticInfo','DIALOGFLOWV2_INTENTNAME','name','intent','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','intentDetectionConfidence','providerResponse','fulfillmentText','push','all','error','dialogflow','md5','moment','bluebird','../../../../config/logger','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','[%s][DIALOGFLOWV2]\x20%s','catch','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','getMustacheRender','then','info','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xc343,0x1bf));var _0x3c34=function(_0x40441b,_0xf0c91f){_0x40441b=_0x40441b-0x0;var _0x5a657e=_0xc343[_0x40441b];return _0x5a657e;};'use strict';var _=require('lodash');var dialogflow=require(_0x3c34('0x0'));var md5=require(_0x3c34('0x1'));var moment=require(_0x3c34('0x2'));var Promise=require(_0x3c34('0x3'));var logger=require(_0x3c34('0x4'))('routing');var utils=require(_0x3c34('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x3c34('0x6')),'mailMessage':require(_0x3c34('0x7')),'smsMessage':require(_0x3c34('0x8')),'faxMessage':require(_0x3c34('0x9')),'whatsappMessage':require(_0x3c34('0xa'))};function createMessage(_0x28e239,_0x568d4a,_0x3b7b81,_0x5c379d){return new Promise(function(_0x509d05,_0x5f02cd){var _0xda66bf=_[_0x3c34('0xb')](_0x3b7b81);_0xda66bf[_0x3c34('0xc')]=_0x5c379d;return rpc[_0x568d4a+_0x3c34('0xd')][_0x3c34('0xe')](_0xda66bf)['then'](function(){logger['info'](_0x3c34('0xf'),_0x28e239,_0xda66bf['body']);_0x509d05();})[_0x3c34('0x10')](function(_0x563e01){logger['error'](_0x3c34('0xf'),_0x28e239,JSON[_0x3c34('0x11')](_0x563e01));_0x5f02cd(_0x563e01);});});}exports[_0x3c34('0x12')]=function(_0x2b0e2e,_0x520207){return function(_0x390a86){try{if(!_[_0x3c34('0x13')](this[_0x3c34('0x14')][_0x3c34('0x15')])){logger['info'](_0x3c34('0xf'),_0x2b0e2e,_0x3c34('0x16'));return _0x390a86[_0x3c34('0x17')]();}var _0x6c1379={'ContactId':this[_0x3c34('0x18')]['id'],'sentAt':moment()['format'](_0x3c34('0x19')),'direction':_0x3c34('0x1a')};if(this[_0x3c34('0x1b')]===_0x3c34('0x1c')||this[_0x3c34('0x1b')]===_0x3c34('0x1d')){_0x6c1379[_0x3c34('0x1e')]=this['interaction'][_0x3c34('0x1e')];}var _0x3f15ac=this[_0x3c34('0x1b')];if(_0x3f15ac==='chat'){_0x6c1379[_0x3c34('0x1f')]=this[_0x3c34('0x20')]['id'];}else{_0x6c1379[_[_0x3c34('0x21')](_0x3f15ac)+_0x3c34('0x22')]=this[_0x3c34('0x20')]['id'];}_0x6c1379[_['upperFirst'](_0x3f15ac)+_0x3c34('0x23')]=this[_0x3c34('0x14')]['id'];if(this[_0x3c34('0x14')][_0x3c34('0x24')]){var _0x478159=_0x520207[0x4];if(!_['isEmpty'](_0x478159)){_0x6c1379[_0x3c34('0xc')]=utils[_0x3c34('0x25')](_0x478159,this);return rpc[_0x3f15ac+_0x3c34('0xd')][_0x3c34('0xe')](_0x6c1379)[_0x3c34('0x26')](function(_0x28ebb5){logger[_0x3c34('0x27')](_0x3c34('0xf'),_0x2b0e2e,_0x6c1379[_0x3c34('0xc')]);})[_0x3c34('0x10')](function(_0x866b8b){logger['error'](_0x3c34('0xf'),_0x2b0e2e,JSON['stringify'](_0x866b8b));})['finally'](function(){logger[_0x3c34('0x27')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x2b0e2e);_0x390a86[_0x3c34('0x28')]();});}else{logger['info'](_0x3c34('0x29'),_0x2b0e2e);_0x390a86[_0x3c34('0x28')]();}}else{var _0x108c48=this;var _0x156e3e=_0x520207[0x2][_0x3c34('0x2a')](/\\n/g,'\x0a');var _0x91e5f7={'credentials':{'private_key':_0x156e3e,'client_email':_0x520207[0x1]}};var _0x399438=new dialogflow[(_0x3c34('0x2b'))](_0x91e5f7);var _0x1e7b1a=_0x399438[_0x3c34('0x2c')](_0x520207[0x0],md5(_0x108c48['interaction']['id']));var _0x4b7366={'session':_0x1e7b1a,'queryInput':{'text':{'text':_0x108c48[_0x3c34('0x2d')][_0x3c34('0xc')],'languageCode':_0x520207[0x3]||'en'}}};return _0x399438[_0x3c34('0x2e')](_0x4b7366)[_0x3c34('0x26')](function(_0x3abec0){if(_0x3abec0&&_0x3abec0[_0x3c34('0x2f')]){_0x108c48[_0x3c34('0xc')][_0x3c34('0x30')]=_0x3abec0;var _0x4bdaef=_0x3abec0[0x0];var _0x39218f=_0x4bdaef[_0x3c34('0x31')]['diagnosticInfo']&&_0x4bdaef[_0x3c34('0x31')]['diagnosticInfo'][_0x3c34('0x32')]?_0x4bdaef[_0x3c34('0x31')]['diagnosticInfo'][_0x3c34('0x32')][_0x3c34('0x33')][_0x3c34('0x34')]:![];_0x108c48['body'][_0x3c34('0x35')]=_0x4bdaef[_0x3c34('0x31')][_0x3c34('0x36')];_0x108c48[_0x3c34('0xc')][_0x3c34('0x37')]=_0x4bdaef['queryResult'][_0x3c34('0x38')];_0x108c48[_0x3c34('0xc')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x4bdaef['queryResult'][_0x3c34('0x39')]&&_0x4bdaef[_0x3c34('0x31')]['diagnosticInfo'][_0x3c34('0x32')]?_0x4bdaef[_0x3c34('0x31')][_0x3c34('0x39')][_0x3c34('0x32')]['end_conversation'][_0x3c34('0x34')]:![];_0x108c48['body'][_0x3c34('0x3a')]=_0x4bdaef[_0x3c34('0x31')]['intent'][_0x3c34('0x3b')];_0x108c48[_0x3c34('0xc')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x4bdaef[_0x3c34('0x31')][_0x3c34('0x3c')]['displayName'];_0x108c48[_0x3c34('0xc')][_0x3c34('0x3d')]=_0x4bdaef['queryResult'][_0x3c34('0x3c')][_0x3c34('0x3e')];_0x108c48[_0x3c34('0xc')]['DIALOGFLOWV2_LANGUAGECODE']=_0x4bdaef['queryResult'][_0x3c34('0x3f')];_0x108c48['body'][_0x3c34('0x40')]=_0x4bdaef[_0x3c34('0x31')][_0x3c34('0x41')];_0x108c48[_0x3c34('0xc')]['DIALOGFLOWV2_SCORE']=_0x4bdaef[_0x3c34('0x31')][_0x3c34('0x42')];_0x6c1379['providerName']=_0x3c34('0x30');_0x6c1379[_0x3c34('0x43')]=JSON[_0x3c34('0x11')](_0x3abec0);var _0x546ca7=[];for(var _0x3269f2=0x0;_0x3269f2<_0x3abec0[_0x3c34('0x2f')];_0x3269f2++){var _0x42f789=_0x3abec0[_0x3269f2];if(_0x42f789&&_0x42f789['queryResult']&&_0x42f789[_0x3c34('0x31')][_0x3c34('0x44')]){_0x546ca7[_0x3c34('0x45')](createMessage(_0x2b0e2e,_0x3f15ac,_0x6c1379,_0x42f789['queryResult']['fulfillmentText']));}}return Promise[_0x3c34('0x46')](_0x546ca7)['then'](function(){if(_0x39218f){_0x390a86['next']();}else{_0x390a86[_0x3c34('0x28')]();}})[_0x3c34('0x10')](function(_0x467306){logger[_0x3c34('0x47')](_0x3c34('0xf'),_0x2b0e2e,JSON[_0x3c34('0x11')](_0x467306));_0x390a86['next']();});}})[_0x3c34('0x10')](function(_0x1fe038){logger[_0x3c34('0x47')]('[%s][DIALOGFLOWV2]\x20%s',_0x2b0e2e,_0x1fe038['message']);_0x390a86['next']();});}}catch(_0x17caa6){logger[_0x3c34('0x47')](_0x3c34('0xf'),_0x2b0e2e,JSON[_0x3c34('0x11')](_0x17caa6));_0x390a86[_0x3c34('0x28')]();}};}; \ No newline at end of file +var _0xfb33=['length','fulfillmentText','push','all','error','lodash','dialogflow','md5','moment','bluebird','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','clone','body','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','YYYY-MM-DD\x20HH:mm:ss','whatsapp','phone','channel','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','getMustacheRender','Message','stringify','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','sessionPath','message','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','dialogflowV2','providerResponse'];(function(_0x2d37b7,_0x3bf618){var _0x4dfbdb=function(_0x18fc40){while(--_0x18fc40){_0x2d37b7['push'](_0x2d37b7['shift']());}};_0x4dfbdb(++_0x3bf618);}(_0xfb33,0x19d));var _0x3fb3=function(_0x58db4e,_0x439d8d){_0x58db4e=_0x58db4e-0x0;var _0x40139a=_0xfb33[_0x58db4e];return _0x40139a;};'use strict';var _=require(_0x3fb3('0x0'));var dialogflow=require(_0x3fb3('0x1'));var md5=require(_0x3fb3('0x2'));var moment=require(_0x3fb3('0x3'));var Promise=require(_0x3fb3('0x4'));var logger=require('../../../../config/logger')(_0x3fb3('0x5'));var utils=require(_0x3fb3('0x6'));var rpc={'chatMessage':require(_0x3fb3('0x7')),'openchannelMessage':require(_0x3fb3('0x8')),'mailMessage':require(_0x3fb3('0x9')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x3fb3('0xa'))};function createMessage(_0x3d1249,_0x4d1752,_0x13ad56,_0x15915b){return new Promise(function(_0x1eb54f,_0x583f55){var _0x3b73ed=_[_0x3fb3('0xb')](_0x13ad56);_0x3b73ed[_0x3fb3('0xc')]=_0x15915b;return rpc[_0x4d1752+'Message'][_0x3fb3('0xd')](_0x3b73ed)[_0x3fb3('0xe')](function(){logger[_0x3fb3('0xf')](_0x3fb3('0x10'),_0x3d1249,_0x3b73ed[_0x3fb3('0xc')]);_0x1eb54f();})[_0x3fb3('0x11')](function(_0x3d2f34){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x3d1249,JSON['stringify'](_0x3d2f34));_0x583f55(_0x3d2f34);});});}exports['consequence']=function(_0x302983,_0x2364e6){return function(_0x52163e){try{if(!_['isNil'](this[_0x3fb3('0x12')][_0x3fb3('0x13')])){logger[_0x3fb3('0xf')](_0x3fb3('0x10'),_0x302983,_0x3fb3('0x14'));return _0x52163e[_0x3fb3('0x15')]();}var _0x425fe6={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x3fb3('0x16')),'direction':'out'};if(this['channel']==='sms'||this['channel']===_0x3fb3('0x17')){_0x425fe6[_0x3fb3('0x18')]=this[_0x3fb3('0x12')]['phone'];}var _0x2835a6=this[_0x3fb3('0x19')];if(_0x2835a6==='chat'){_0x425fe6[_0x3fb3('0x1a')]=this[_0x3fb3('0x1b')]['id'];}else{_0x425fe6[_[_0x3fb3('0x1c')](_0x2835a6)+_0x3fb3('0x1d')]=this['account']['id'];}_0x425fe6[_[_0x3fb3('0x1c')](_0x2835a6)+_0x3fb3('0x1e')]=this['interaction']['id'];if(this[_0x3fb3('0x12')][_0x3fb3('0x1f')]){var _0x185ddb=_0x2364e6[0x4];if(!_['isEmpty'](_0x185ddb)){_0x425fe6[_0x3fb3('0xc')]=utils[_0x3fb3('0x20')](_0x185ddb,this);return rpc[_0x2835a6+_0x3fb3('0x21')][_0x3fb3('0xd')](_0x425fe6)[_0x3fb3('0xe')](function(_0x633002){logger[_0x3fb3('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x302983,_0x425fe6[_0x3fb3('0xc')]);})[_0x3fb3('0x11')](function(_0x31c9f7){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x302983,JSON[_0x3fb3('0x22')](_0x31c9f7));})[_0x3fb3('0x23')](function(){logger['info'](_0x3fb3('0x24'),_0x302983);_0x52163e[_0x3fb3('0x25')]();});}else{logger[_0x3fb3('0xf')](_0x3fb3('0x26'),_0x302983);_0x52163e[_0x3fb3('0x25')]();}}else{var _0x373c4e=this;var _0x55bf34=_0x2364e6[0x2][_0x3fb3('0x27')](/\\n/g,'\x0a');var _0x181dd2={'credentials':{'private_key':_0x55bf34,'client_email':_0x2364e6[0x1]}};var _0x5276ec=new dialogflow['SessionsClient'](_0x181dd2);var _0x12078d=_0x5276ec[_0x3fb3('0x28')](_0x2364e6[0x0],md5(_0x373c4e[_0x3fb3('0x12')]['id']));var _0x570c24={'session':_0x12078d,'queryInput':{'text':{'text':_0x373c4e[_0x3fb3('0x29')][_0x3fb3('0xc')],'languageCode':_0x2364e6[0x3]||'en'}}};return _0x5276ec['detectIntent'](_0x570c24)[_0x3fb3('0xe')](function(_0x4ccf9e){if(_0x4ccf9e&&_0x4ccf9e['length']){_0x373c4e['body']['dialogflowV2']=_0x4ccf9e;var _0x4d46f0=_0x4ccf9e[0x0];var _0x5b1d7=_0x4d46f0[_0x3fb3('0x2a')][_0x3fb3('0x2b')]&&_0x4d46f0[_0x3fb3('0x2a')][_0x3fb3('0x2b')][_0x3fb3('0x2c')]?_0x4d46f0[_0x3fb3('0x2a')][_0x3fb3('0x2b')][_0x3fb3('0x2c')][_0x3fb3('0x2d')][_0x3fb3('0x2e')]:![];_0x373c4e['body'][_0x3fb3('0x2f')]=_0x4d46f0[_0x3fb3('0x2a')][_0x3fb3('0x30')];_0x373c4e[_0x3fb3('0xc')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x4d46f0[_0x3fb3('0x2a')][_0x3fb3('0x31')];_0x373c4e[_0x3fb3('0xc')][_0x3fb3('0x32')]=_0x4d46f0['queryResult'][_0x3fb3('0x2b')]&&_0x4d46f0[_0x3fb3('0x2a')]['diagnosticInfo'][_0x3fb3('0x2c')]?_0x4d46f0[_0x3fb3('0x2a')][_0x3fb3('0x2b')]['fields'][_0x3fb3('0x2d')]['boolValue']:![];_0x373c4e['body'][_0x3fb3('0x33')]=_0x4d46f0[_0x3fb3('0x2a')][_0x3fb3('0x34')][_0x3fb3('0x35')];_0x373c4e[_0x3fb3('0xc')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x4d46f0[_0x3fb3('0x2a')][_0x3fb3('0x34')]['displayName'];_0x373c4e[_0x3fb3('0xc')][_0x3fb3('0x36')]=_0x4d46f0[_0x3fb3('0x2a')][_0x3fb3('0x34')][_0x3fb3('0x37')];_0x373c4e[_0x3fb3('0xc')]['DIALOGFLOWV2_LANGUAGECODE']=_0x4d46f0[_0x3fb3('0x2a')][_0x3fb3('0x38')];_0x373c4e[_0x3fb3('0xc')][_0x3fb3('0x39')]=_0x4d46f0[_0x3fb3('0x2a')]['queryText'];_0x373c4e['body'][_0x3fb3('0x3a')]=_0x4d46f0[_0x3fb3('0x2a')][_0x3fb3('0x3b')];_0x425fe6[_0x3fb3('0x3c')]=_0x3fb3('0x3d');_0x425fe6[_0x3fb3('0x3e')]=JSON['stringify'](_0x4ccf9e);var _0x924603=[];for(var _0x1a17b=0x0;_0x1a17b<_0x4ccf9e[_0x3fb3('0x3f')];_0x1a17b++){var _0x9bd840=_0x4ccf9e[_0x1a17b];if(_0x9bd840&&_0x9bd840[_0x3fb3('0x2a')]&&_0x9bd840[_0x3fb3('0x2a')][_0x3fb3('0x40')]){_0x924603[_0x3fb3('0x41')](createMessage(_0x302983,_0x2835a6,_0x425fe6,_0x9bd840['queryResult'][_0x3fb3('0x40')]));}}return Promise[_0x3fb3('0x42')](_0x924603)[_0x3fb3('0xe')](function(){if(_0x5b1d7){_0x52163e['next']();}else{_0x52163e[_0x3fb3('0x25')]();}})[_0x3fb3('0x11')](function(_0x524b4d){logger[_0x3fb3('0x43')](_0x3fb3('0x10'),_0x302983,JSON[_0x3fb3('0x22')](_0x524b4d));_0x52163e[_0x3fb3('0x15')]();});}})[_0x3fb3('0x11')](function(_0x19c5e0){logger[_0x3fb3('0x43')](_0x3fb3('0x10'),_0x302983,_0x19c5e0[_0x3fb3('0x29')]);_0x52163e['next']();});}}catch(_0x54fe0d){logger['error'](_0x3fb3('0x10'),_0x302983,JSON['stringify'](_0x54fe0d));_0x52163e[_0x3fb3('0x25')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 76b0589..03ed2fd 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2118=['lodash','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','join','stop','condition','priorityTrue','priorityFalse','info','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate'];(function(_0x4d9c59,_0x4e44c8){var _0x166b0b=function(_0x2c26bf){while(--_0x2c26bf){_0x4d9c59['push'](_0x4d9c59['shift']());}};_0x166b0b(++_0x4e44c8);}(_0x2118,0x194));var _0x8211=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x2118[_0x3e5086];return _0xfeb102;};'use strict';var schema=require(_0x8211('0x0'));var _=require(_0x8211('0x1'));var htmlToText=require('html-to-text');var utils=require('./utils');var logger=require(_0x8211('0x2'))(_0x8211('0x3'));var gotoif=schema({'condition':{'type':_0x8211('0x4'),'required':!![],'message':_0x8211('0x5')},'priorityTrue':{'type':'number','message':_0x8211('0x6')},'priorityFalse':{'type':_0x8211('0x7'),'message':_0x8211('0x8')}});exports[_0x8211('0x9')]=function(_0x3be54c,_0x140a13){return function(_0x50b590){try{var _0x480906={'condition':htmlToText[_0x8211('0xa')](utils[_0x8211('0xb')](_0x140a13[0x0],this),{'wordwrap':![]})[_0x8211('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x140a13[0x1],'priorityFalse':_0x140a13[0x2]};var _0x3b04b0=gotoif[_0x8211('0x0')](_0x480906,{'typecast':!![]});if(_0x3b04b0[_0x8211('0xd')]){logger[_0x8211('0xe')]('[%s][GOTOIF]\x20%s',_0x3be54c,_['map'](_0x3b04b0,'message')[_0x8211('0xf')](',\x20'));_0x50b590[_0x8211('0x10')]();}else{try{var _0x3c9be3=eval('('+_0x480906[_0x8211('0x11')]+')');var _0x4db80d=_0x3c9be3?_0x480906[_0x8211('0x12')]:_0x480906[_0x8211('0x13')];logger[_0x8211('0x14')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x3be54c,_0x480906[_0x8211('0x11')],_0x3c9be3,_0x4db80d||'next');if(_0x4db80d){var _0x39f10e=_[_0x8211('0x15')](_0x50b590[_0x8211('0x16')](),{'p':_0x4db80d});if(_0x39f10e>=0x0){logger['info'](_0x8211('0x17'),_0x3be54c,_0x4db80d||_0x8211('0x18'),_0x39f10e);_0x50b590[_0x8211('0x18')](_0x39f10e);}else{logger[_0x8211('0x14')](_0x8211('0x19'),_0x3be54c,_0x4db80d||_0x8211('0x18'));_0x50b590['stop']();}}else{_0x50b590[_0x8211('0x18')]();}}catch(_0x4615cb){logger[_0x8211('0xe')](_0x8211('0x1a'),_0x3be54c,_0x4615cb['message']);_0x50b590[_0x8211('0x10')]();}}}catch(_0x4f9fb7){logger[_0x8211('0xe')]('[%s][GOTOIF]\x20%s',_0x3be54c,JSON['stringify'](_0x4f9fb7));_0x50b590[_0x8211('0x10')]();}};}; \ No newline at end of file +var _0x74c4=['priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','join','stop','priorityFalse','info','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','lodash','html-to-text','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number'];(function(_0x41f324,_0x3b0b2b){var _0x45f719=function(_0x54425e){while(--_0x54425e){_0x41f324['push'](_0x41f324['shift']());}};_0x45f719(++_0x3b0b2b);}(_0x74c4,0x106));var _0x474c=function(_0x572357,_0x3f70ae){_0x572357=_0x572357-0x0;var _0xa9fcfe=_0x74c4[_0x572357];return _0xa9fcfe;};'use strict';var schema=require('validate');var _=require(_0x474c('0x0'));var htmlToText=require(_0x474c('0x1'));var utils=require(_0x474c('0x2'));var logger=require('../../../../config/logger')(_0x474c('0x3'));var gotoif=schema({'condition':{'type':_0x474c('0x4'),'required':!![],'message':_0x474c('0x5')},'priorityTrue':{'type':_0x474c('0x6'),'message':_0x474c('0x7')},'priorityFalse':{'type':_0x474c('0x6'),'message':_0x474c('0x8')}});exports[_0x474c('0x9')]=function(_0x1001cb,_0x225d34){return function(_0x4c7a4a){try{var _0x27fa96={'condition':htmlToText[_0x474c('0xa')](utils[_0x474c('0xb')](_0x225d34[0x0],this),{'wordwrap':![]})[_0x474c('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x225d34[0x1],'priorityFalse':_0x225d34[0x2]};var _0x4d1b13=gotoif['validate'](_0x27fa96,{'typecast':!![]});if(_0x4d1b13[_0x474c('0xd')]){logger[_0x474c('0xe')](_0x474c('0xf'),_0x1001cb,_['map'](_0x4d1b13,'message')[_0x474c('0x10')](',\x20'));_0x4c7a4a[_0x474c('0x11')]();}else{try{var _0x47ec2d=eval('('+_0x27fa96['condition']+')');var _0x25667c=_0x47ec2d?_0x27fa96['priorityTrue']:_0x27fa96[_0x474c('0x12')];logger[_0x474c('0x13')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x1001cb,_0x27fa96['condition'],_0x47ec2d,_0x25667c||'next');if(_0x25667c){var _0x5d348=_['findIndex'](_0x4c7a4a[_0x474c('0x14')](),{'p':_0x25667c});if(_0x5d348>=0x0){logger[_0x474c('0x13')](_0x474c('0x15'),_0x1001cb,_0x25667c||_0x474c('0x16'),_0x5d348);_0x4c7a4a[_0x474c('0x16')](_0x5d348);}else{logger[_0x474c('0x13')](_0x474c('0x17'),_0x1001cb,_0x25667c||'next');_0x4c7a4a[_0x474c('0x11')]();}}else{_0x4c7a4a[_0x474c('0x16')]();}}catch(_0x560965){logger[_0x474c('0xe')](_0x474c('0x18'),_0x1001cb,_0x560965[_0x474c('0x19')]);_0x4c7a4a[_0x474c('0x11')]();}}}catch(_0x3329d9){logger[_0x474c('0xe')]('[%s][GOTOIF]\x20%s',_0x1001cb,JSON[_0x474c('0x1a')](_0x3329d9));_0x4c7a4a['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index d67f168..cde0b3b 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 _0xf145=['[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','rules','info'];(function(_0x54f518,_0xac40b){var _0x5a59dd=function(_0x1da504){while(--_0x1da504){_0x54f518['push'](_0x54f518['shift']());}};_0x5a59dd(++_0xac40b);}(_0xf145,0x16c));var _0x5f14=function(_0xd511d,_0x3546b9){_0xd511d=_0xd511d-0x0;var _0x3f148e=_0xf145[_0xd511d];return _0x3f148e;};'use strict';var schema=require(_0x5f14('0x0'));var _=require('lodash');var logger=require('../../../../config/logger')('routing');var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x5f14('0x1')}});exports[_0x5f14('0x2')]=function(_0x467a73,_0x8d870){return function(_0x556ce6){try{var _0x240d37={'priority':_0x8d870[0x0]};var _0x1795dc=gotop['validate'](_0x240d37,{'typecast':!![]});if(_0x1795dc[_0x5f14('0x3')]){logger[_0x5f14('0x4')](_0x5f14('0x5'),_0x467a73,_[_0x5f14('0x6')](_0x1795dc,_0x5f14('0x7'))[_0x5f14('0x8')](',\x20'));_0x556ce6[_0x5f14('0x9')]();}else{logger['info'](_0x5f14('0xa'),_0x467a73,_0x240d37[_0x5f14('0xb')]);if(_0x240d37['priority']){var _0x358174=_['findIndex'](_0x556ce6[_0x5f14('0xc')](),{'p':_0x240d37['priority']});if(_0x358174>=0x0){logger[_0x5f14('0xd')](_0x5f14('0xe'),_0x467a73,_0x240d37[_0x5f14('0xb')]||_0x5f14('0xf'),_0x358174);_0x556ce6[_0x5f14('0xf')](_0x358174);}else{logger[_0x5f14('0xd')](_0x5f14('0x10'),_0x467a73,_0x240d37[_0x5f14('0xb')]||'next');_0x556ce6[_0x5f14('0x9')]();}}else{_0x556ce6[_0x5f14('0xf')]();}}}catch(_0x339246){logger[_0x5f14('0x4')](_0x5f14('0x5'),_0x467a73,JSON[_0x5f14('0x11')](_0x339246));_0x556ce6[_0x5f14('0x9')]();}};}; \ No newline at end of file +var _0x97ba=['stringify','validate','lodash','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','[%s][GOTOP]\x20%s','map','message','join','stop','priority','findIndex','info','next'];(function(_0x4f0916,_0x15bd1d){var _0x49c5e3=function(_0x9c4773){while(--_0x9c4773){_0x4f0916['push'](_0x4f0916['shift']());}};_0x49c5e3(++_0x15bd1d);}(_0x97ba,0xf1));var _0xa97b=function(_0x3355c2,_0x33d1d0){_0x3355c2=_0x3355c2-0x0;var _0x168244=_0x97ba[_0x3355c2];return _0x168244;};'use strict';var schema=require(_0xa97b('0x0'));var _=require(_0xa97b('0x1'));var logger=require('../../../../config/logger')('routing');var gotop=schema({'priority':{'type':'number','required':!![],'message':_0xa97b('0x2')}});exports[_0xa97b('0x3')]=function(_0x50bd18,_0x1ad0c9){return function(_0x5ece9e){try{var _0x482ce6={'priority':_0x1ad0c9[0x0]};var _0x4d1902=gotop[_0xa97b('0x0')](_0x482ce6,{'typecast':!![]});if(_0x4d1902[_0xa97b('0x4')]){logger['error'](_0xa97b('0x5'),_0x50bd18,_[_0xa97b('0x6')](_0x4d1902,_0xa97b('0x7'))[_0xa97b('0x8')](',\x20'));_0x5ece9e[_0xa97b('0x9')]();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x50bd18,_0x482ce6[_0xa97b('0xa')]);if(_0x482ce6['priority']){var _0xf717f4=_[_0xa97b('0xb')](_0x5ece9e['rules'](),{'p':_0x482ce6[_0xa97b('0xa')]});if(_0xf717f4>=0x0){logger[_0xa97b('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x50bd18,_0x482ce6[_0xa97b('0xa')]||'next',_0xf717f4);_0x5ece9e[_0xa97b('0xd')](_0xf717f4);}else{logger[_0xa97b('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x50bd18,_0x482ce6['priority']||'next');_0x5ece9e[_0xa97b('0x9')]();}}else{_0x5ece9e['next']();}}}catch(_0x4dbae7){logger['error'](_0xa97b('0x5'),_0x50bd18,JSON[_0xa97b('0xe')](_0x4dbae7));_0x5ece9e[_0xa97b('0x9')]();}};}; \ 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 e831da9..9a5848e 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 _0x36ad=['Message','create','then','info','[%s][MESSAGE]\x20%s','catch','stringify','stop','error','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','chat','ChatWebsiteId','account','upperFirst','channel','AccountId','InteractionId','interaction'];(function(_0x4eff77,_0x23cb4a){var _0x5bf6d5=function(_0x22bc8e){while(--_0x22bc8e){_0x4eff77['push'](_0x4eff77['shift']());}};_0x5bf6d5(++_0x23cb4a);}(_0x36ad,0x95));var _0xd36a=function(_0x37c631,_0x264bf8){_0x37c631=_0x37c631-0x0;var _0x1589d4=_0x36ad[_0x37c631];return _0x1589d4;};'use strict';var _=require(_0xd36a('0x0'));var utils=require(_0xd36a('0x1'));var logger=require(_0xd36a('0x2'))(_0xd36a('0x3'));var rpc={'chatMessage':require(_0xd36a('0x4')),'openchannelMessage':require(_0xd36a('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xd36a('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xd36a('0x7'))};exports[_0xd36a('0x8')]=function(_0x352dc1,_0x276f48){return function(_0x51290f){try{var _0x45e3af={'body':utils[_0xd36a('0x9')](_0x276f48[0x0],this),'ContactId':this[_0xd36a('0xa')]['id']};if(this['channel']===_0xd36a('0xb')){_0x45e3af[_0xd36a('0xc')]=this[_0xd36a('0xd')]['id'];}else{_0x45e3af[_[_0xd36a('0xe')](this[_0xd36a('0xf')])+_0xd36a('0x10')]=this['account']['id'];}_0x45e3af[_[_0xd36a('0xe')](this[_0xd36a('0xf')])+_0xd36a('0x11')]=this[_0xd36a('0x12')]['id'];if(rpc[this['channel']+_0xd36a('0x13')]){return rpc[this['channel']+_0xd36a('0x13')][_0xd36a('0x14')](_0x45e3af)[_0xd36a('0x15')](function(_0x589a1b){logger[_0xd36a('0x16')](_0xd36a('0x17'),_0x352dc1,_0x45e3af['body']);_0x51290f['next']();})[_0xd36a('0x18')](function(_0x435613){logger['error']('[%s][MESSAGE]\x20%s',_0x352dc1,JSON[_0xd36a('0x19')](_0x435613));_0x51290f[_0xd36a('0x1a')]();});}}catch(_0x187079){logger[_0xd36a('0x1b')]('[%s][MESSAGE]\x20%s',_0x352dc1,JSON[_0xd36a('0x19')](_0x187079));_0x51290f[_0xd36a('0x1a')]();}};}; \ No newline at end of file +var _0x27dd=['[%s][MESSAGE]\x20%s','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','consequence','getMustacheRender','contact','chat','account','AccountId','InteractionId','interaction','channel','Message','info','body','next','catch','stop','error'];(function(_0x34ca55,_0x2e1717){var _0x4405f1=function(_0x2f9487){while(--_0x2f9487){_0x34ca55['push'](_0x34ca55['shift']());}};_0x4405f1(++_0x2e1717);}(_0x27dd,0x177));var _0xd27d=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x27dd[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0xd27d('0x0'));var utils=require('./utils');var logger=require(_0xd27d('0x1'))(_0xd27d('0x2'));var rpc={'chatMessage':require(_0xd27d('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xd27d('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xd27d('0x5')]=function(_0xf4f0c0,_0x57f9df){return function(_0x1485e7){try{var _0x2c917e={'body':utils[_0xd27d('0x6')](_0x57f9df[0x0],this),'ContactId':this[_0xd27d('0x7')]['id']};if(this['channel']===_0xd27d('0x8')){_0x2c917e['ChatWebsiteId']=this[_0xd27d('0x9')]['id'];}else{_0x2c917e[_['upperFirst'](this['channel'])+_0xd27d('0xa')]=this[_0xd27d('0x9')]['id'];}_0x2c917e[_['upperFirst'](this['channel'])+_0xd27d('0xb')]=this[_0xd27d('0xc')]['id'];if(rpc[this[_0xd27d('0xd')]+_0xd27d('0xe')]){return rpc[this[_0xd27d('0xd')]+'Message']['create'](_0x2c917e)['then'](function(_0x4925c7){logger[_0xd27d('0xf')]('[%s][MESSAGE]\x20%s',_0xf4f0c0,_0x2c917e[_0xd27d('0x10')]);_0x1485e7[_0xd27d('0x11')]();})[_0xd27d('0x12')](function(_0x55ee0c){logger['error']('[%s][MESSAGE]\x20%s',_0xf4f0c0,JSON['stringify'](_0x55ee0c));_0x1485e7[_0xd27d('0x13')]();});}}catch(_0x4b2a48){logger[_0xd27d('0x14')](_0xd27d('0x15'),_0xf4f0c0,JSON['stringify'](_0x4b2a48));_0x1485e7[_0xd27d('0x13')]();}};}; \ 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 6330369..5b721c5 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 _0xc877=['./utils','../../../../config/logger','routing','info','next','error','[%s][NOOP]\x20%s','stringify','stop'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0xc877,0x129));var _0x7c87=function(_0x5297c1,_0x2636a7){_0x5297c1=_0x5297c1-0x0;var _0x1086c2=_0xc877[_0x5297c1];return _0x1086c2;};'use strict';var utils=require(_0x7c87('0x0'));var logger=require(_0x7c87('0x1'))(_0x7c87('0x2'));exports['consequence']=function(_0x44f54f,_0x491c54){return function(_0x4b9b4e){try{logger[_0x7c87('0x3')]('[%s][NOOP]\x20%s',_0x44f54f,utils['getMustacheRender'](_0x491c54[0x0],this));_0x4b9b4e[_0x7c87('0x4')]();}catch(_0x21f59e){logger[_0x7c87('0x5')](_0x7c87('0x6'),_0x44f54f,JSON[_0x7c87('0x7')](_0x21f59e));_0x4b9b4e[_0x7c87('0x8')]();}};}; \ No newline at end of file +var _0xc730=['info','getMustacheRender','next','error','[%s][NOOP]\x20%s','stringify','stop','routing'];(function(_0x289a67,_0x1e5a3c){var _0x572b49=function(_0x22e036){while(--_0x22e036){_0x289a67['push'](_0x289a67['shift']());}};_0x572b49(++_0x1e5a3c);}(_0xc730,0x157));var _0x0c73=function(_0x1e1c58,_0x21faaa){_0x1e1c58=_0x1e1c58-0x0;var _0x1ebd99=_0xc730[_0x1e1c58];return _0x1ebd99;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')(_0x0c73('0x0'));exports['consequence']=function(_0x446ce5,_0xb13462){return function(_0x25061f){try{logger[_0x0c73('0x1')]('[%s][NOOP]\x20%s',_0x446ce5,utils[_0x0c73('0x2')](_0xb13462[0x0],this));_0x25061f[_0x0c73('0x3')]();}catch(_0x3b71b4){logger[_0x0c73('0x4')](_0x0c73('0x5'),_0x446ce5,JSON[_0x0c73('0x6')](_0x3b71b4));_0x25061f[_0x0c73('0x7')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index e88728a..d7b48fa 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 _0xcf33=['remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','QueueId','upperFirst','interaction','channel','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','update','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','find','timeout','createQueue','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','moment','../../../../config/environment','../../../../config/logger','routing','redis','localhost','queue_id','account','from','joinAt','emit','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save'];(function(_0x5afec7,_0x3710e8){var _0x3d72d0=function(_0xae2974){while(--_0xae2974){_0x5afec7['push'](_0x5afec7['shift']());}};_0x3d72d0(++_0x3710e8);}(_0xcf33,0x114));var _0x3cf3=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xcf33[_0x4a53d];return _0x27410e;};'use strict';var schema=require(_0x3cf3('0x0'));var _=require(_0x3cf3('0x1'));var util=require(_0x3cf3('0x2'));var seqqueue=require('seq-queue');var moment=require(_0x3cf3('0x3'));var Redis=require('ioredis');var config=require(_0x3cf3('0x4'));var logger=require(_0x3cf3('0x5'))(_0x3cf3('0x6'));var strategy=require('./strategy');config[_0x3cf3('0x7')]=_['defaults'](config[_0x3cf3('0x7')],{'host':_0x3cf3('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3cf3('0x7')]));var attributes=['id',_0x3cf3('0x9'),_0x3cf3('0xa'),'queue',_0x3cf3('0xb'),_0x3cf3('0xc')];function emit(_0x2c24e2,_0x1a3572,_0x45b370){io['to'](_0x2c24e2)[_0x3cf3('0xd')](_0x1a3572,_0x45b370);}function emitChannelQueueInteraction(_0x5c7478,_0x564664,_0xfbaae8,_0x411f83,_0x8ed04e,_0x985e2a,_0x124ee2,_0x4744b3){var _0x4b8e82=_['clone'](_0xfbaae8);_0x4b8e82[_0x3cf3('0x9')]=_0x4744b3;_0x4b8e82['queue']=_0x564664;_0x4b8e82[_0x3cf3('0xa')]=_0x411f83;_0x4b8e82['id']=_0x8ed04e;if(_0x985e2a){_0x124ee2[util['format'](_0x3cf3('0xe'),_0x5c7478)][_0x8ed04e]=_[_0x3cf3('0xf')](_0x4b8e82,attributes);}else{delete _0x124ee2[util[_0x3cf3('0x10')](_0x3cf3('0xe'),_0x5c7478)][_0x8ed04e];}emit(util[_0x3cf3('0x10')](_0x3cf3('0x11'),_0x5c7478,_0x564664),util[_0x3cf3('0x10')](_0x3cf3('0x12'),_0x5c7478,_0x985e2a?_0x3cf3('0x13'):_0x3cf3('0x14')),_[_0x3cf3('0xf')](_0x4b8e82,attributes));}var rpc={'openchannelQueueReport':require(_0x3cf3('0x15')),'mailQueueReport':require(_0x3cf3('0x16')),'chatQueueReport':require(_0x3cf3('0x17')),'smsQueueReport':require(_0x3cf3('0x18')),'faxQueueReport':require(_0x3cf3('0x19')),'whatsappQueueReport':require(_0x3cf3('0x1a'))};var queue=schema({'name':{'type':_0x3cf3('0x1b'),'required':!![],'message':_0x3cf3('0x1c')},'timeout':{'type':'number','message':_0x3cf3('0x1d')}});function startRouting(_0x3a8f34,_0x3fddba,_0x4c50a0,_0x4b2cdb){if(_0x3a8f34&&_0x3fddba&&_0x4c50a0){_0x3fddba[_0x3cf3('0x1e')]+=0x1;var _0x498698={'uniqueid':_0x3a8f34,'from':_0x4c50a0[_0x3cf3('0x1f')]?_0x4c50a0[_0x3cf3('0x1f')]['from']:'','joinAt':moment()[_0x3cf3('0x10')](_0x3cf3('0x20')),'ContactId':_0x4c50a0[_0x3cf3('0x21')]?_0x4c50a0['contact']['id']:null,'ListId':_0x4c50a0['list']?_0x4c50a0[_0x3cf3('0x22')]['id']:null};_0x498698[_['upperFirst'](_0x4c50a0['channel'])+_0x3cf3('0x23')]=_0x3fddba['id']||null;_0x498698[_[_0x3cf3('0x24')](_0x4c50a0['channel'])+'InteractionId']=_0x4c50a0[_0x3cf3('0x25')]?_0x4c50a0[_0x3cf3('0x25')]['id']:null;_0x498698[_[_0x3cf3('0x24')](_0x4c50a0[_0x3cf3('0x26')])+'MessageId']=_0x4c50a0[_0x3cf3('0x27')]?_0x4c50a0[_0x3cf3('0x27')]['id']:null;_0x498698[_['upperFirst'](_0x4c50a0['channel'])+(_0x4c50a0[_0x3cf3('0x26')]!==_0x3cf3('0x28')?_0x3cf3('0x29'):_0x3cf3('0x2a'))]=_0x4c50a0[_0x3cf3('0xa')]?_0x4c50a0[_0x3cf3('0xa')]['id']:null;logger[_0x3cf3('0x2b')](util[_0x3cf3('0x10')](_0x3cf3('0x2c'),_0x3a8f34,_0x3fddba[_0x3cf3('0x2d')]));emitChannelQueueInteraction(_0x4c50a0[_0x3cf3('0x26')],_0x3fddba[_0x3cf3('0x2d')],_0x498698,_0x4c50a0[_0x3cf3('0xa')][_0x3cf3('0x2d')],_0x4c50a0[_0x3cf3('0x27')]['id'],!![],_0x4b2cdb,_0x3fddba['id']);if(rpc[_0x4c50a0[_0x3cf3('0x26')]+_0x3cf3('0x2e')]){return rpc[_0x4c50a0[_0x3cf3('0x26')]+_0x3cf3('0x2e')][_0x3cf3('0x2f')](_0x498698)[_0x3cf3('0x30')](function(_0x5b911d){logger[_0x3cf3('0x31')]('create\x20queue\x20report');});}}}function stopRouting(_0x1c061c,_0x19c891,_0x104955,_0x34b3e2){if(_0x1c061c&&_0x19c891){_0x19c891[_0x3cf3('0x1e')]-=0x1;var _0x127257={'leaveAt':moment()[_0x3cf3('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x3cf3('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'accepted'};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x1c061c,_0x19c891[_0x3cf3('0x2d')]));emitChannelQueueInteraction(_0x104955['channel'],_0x19c891['name'],_0x104955[_0x3cf3('0x1f')],_0x104955['account'][_0x3cf3('0x2d')],_0x104955[_0x3cf3('0x27')]['id'],![],_0x34b3e2,_0x19c891['id']);if(rpc[_0x104955[_0x3cf3('0x26')]+_0x3cf3('0x2e')]){return rpc[_0x104955['channel']+_0x3cf3('0x2e')][_0x3cf3('0x32')](_0x1c061c,_0x127257)['catch'](function(_0x4a9702){logger[_0x3cf3('0x31')](_0x3cf3('0x33'));});}}}function endRouting(_0xea8816,_0x41e0be,_0xc12b43,_0xf590a2){if(_0xea8816&&_0x41e0be){_0x41e0be[_0x3cf3('0x1e')]-=0x1;var _0x44bc99={'leaveAt':moment()[_0x3cf3('0x10')](_0x3cf3('0x20')),'exitAt':moment()['format'](_0x3cf3('0x20')),'reason':'timeout'};logger[_0x3cf3('0x2b')](util[_0x3cf3('0x10')](_0x3cf3('0x34'),_0xea8816,_0x41e0be[_0x3cf3('0x2d')]));emitChannelQueueInteraction(_0xc12b43[_0x3cf3('0x26')],_0x41e0be[_0x3cf3('0x2d')],_0xc12b43[_0x3cf3('0x1f')],_0xc12b43['account'][_0x3cf3('0x2d')],_0xc12b43[_0x3cf3('0x27')]['id'],![],_0xf590a2);if(rpc[_0xc12b43[_0x3cf3('0x26')]+_0x3cf3('0x2e')]){return rpc[_0xc12b43[_0x3cf3('0x26')]+_0x3cf3('0x2e')][_0x3cf3('0x32')](_0xea8816,_0x44bc99)[_0x3cf3('0x30')](function(_0x4e0da5){logger[_0x3cf3('0x31')](_0x3cf3('0x33'));});}}}function handleFindQueue(_0x3f2c7b){return function(_0x5728b6){return _0x5728b6[_0x3cf3('0x2d')][_0x3cf3('0x35')]()===_0x3f2c7b[_0x3cf3('0x35')]();};}exports[_0x3cf3('0x36')]=function(_0x23b769,_0x16bc5b,_0x5164b1,_0x29a95a){return function(_0x384cc2){try{var _0x236749={'name':_0x16bc5b[0x0],'timeout':_0x16bc5b[0x1]};var _0x39d2d6=queue[_0x3cf3('0x0')](_0x236749,{'typecast':!![]});if(_0x39d2d6[_0x3cf3('0x37')]){logger[_0x3cf3('0x31')](_0x3cf3('0x38'),_0x23b769,_['map'](_0x39d2d6,_0x3cf3('0x27'))['join'](',\x20'));_0x384cc2['stop']();}else{var _0xd33197=_[_0x3cf3('0x39')](_0x5164b1[_0x29a95a[_0x3cf3('0x26')]+'Queues'],handleFindQueue(_0x236749[_0x3cf3('0x2d')]));if(_0xd33197){startRouting(_0x23b769,_0xd33197,_0x29a95a,_0x5164b1);var _0x5cddc9=(_0xd33197['timeout']||0xa)*0x3e8;var _0x328a62=(_0x236749[_0x3cf3('0x3a')]||0x14)*0x3e8;var _0x5db6be,_0x4159b3;if(_0x5cddc9>_0x328a62){_0x328a62=_0x5cddc9;}var _0x4904c4=seqqueue[_0x3cf3('0x3b')](_0x5cddc9);_0x4904c4['id']=_0x23b769;_0x4904c4['atimeout']=_0x5cddc9;_0x4904c4['qtimeout']=_0x328a62;_0x4904c4[_0x3cf3('0x26')]=_0x29a95a[_0x3cf3('0x26')];_0x5164b1[_0x3cf3('0x3c')][_0x23b769]['on'](_0x3cf3('0x3d'),function(){logger[_0x3cf3('0x2b')](_0x3cf3('0x3e'),_0x23b769);stopRouting(_0x23b769,_0xd33197,_0x29a95a,_0x5164b1);clearTimeout(_0x5db6be);_0x5db6be=undefined;_0x4904c4[_0x3cf3('0x3f')](!![]);if(_0x5164b1[_0x3cf3('0x3c')][_0x23b769]){delete _0x5164b1[_0x3cf3('0x3c')][_0x23b769];}_0x384cc2[_0x3cf3('0x40')]();});_0x5164b1['rules'][_0x23b769]['on'](_0x3cf3('0x41'),function(){if(_0x5164b1[_0x3cf3('0x3c')][_0x23b769]){delete _0x5164b1[_0x3cf3('0x3c')][_0x23b769];}});_0x5db6be=setTimeout(function(){logger[_0x3cf3('0x2b')](_0x3cf3('0x42'),_0x23b769);endRouting(_0x23b769,_0xd33197,_0x29a95a,_0x5164b1);clearTimeout(_0x5db6be);_0x4904c4[_0x3cf3('0x3f')](!![]);_0x384cc2[_0x3cf3('0x43')]();},_0x328a62);switch(_0xd33197[_0x3cf3('0x44')]){case _0x3cf3('0x45'):strategy[_0x3cf3('0x45')](_0x4904c4,_0xd33197,_0x5164b1,_0x29a95a);break;default:strategy[_0x3cf3('0x46')](_0x4904c4,_0xd33197,_0x5164b1,_0x29a95a);}}else{logger['error'](_0x3cf3('0x47'),_0x23b769,_0x236749['name']);_0x384cc2[_0x3cf3('0x40')]();}}}catch(_0x4889a9){console[_0x3cf3('0x48')](_0x4889a9);logger[_0x3cf3('0x31')](_0x3cf3('0x38'),_0x23b769,_0x4889a9[_0x3cf3('0x49')]);_0x384cc2['stop']();}};}; \ No newline at end of file +var _0x9b05=['create','catch','[%s][STOP:QUEUE][NAME:%s]','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','validate','length','map','join','stop','Queues','[%s][QUEUE]\x20ROUTING\x20STOPPED','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','next','rrmemory','beepall','error','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','queue_id','account','from','joinAt','emit','%sQueuesWaitingInteractions','pick','format','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','list','upperFirst','QueueId','channel','InteractionId','interaction','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport'];(function(_0x148475,_0x40e8a7){var _0x345f17=function(_0x1edfa9){while(--_0x1edfa9){_0x148475['push'](_0x148475['shift']());}};_0x345f17(++_0x40e8a7);}(_0x9b05,0x1cb));var _0x59b0=function(_0xcb8fde,_0x24399c){_0xcb8fde=_0xcb8fde-0x0;var _0x16dd77=_0x9b05[_0xcb8fde];return _0x16dd77;};'use strict';var schema=require('validate');var _=require(_0x59b0('0x0'));var util=require(_0x59b0('0x1'));var seqqueue=require(_0x59b0('0x2'));var moment=require(_0x59b0('0x3'));var Redis=require(_0x59b0('0x4'));var config=require(_0x59b0('0x5'));var logger=require(_0x59b0('0x6'))('routing');var strategy=require('./strategy');config[_0x59b0('0x7')]=_[_0x59b0('0x8')](config[_0x59b0('0x7')],{'host':_0x59b0('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x59b0('0x7')]));var attributes=['id',_0x59b0('0xa'),_0x59b0('0xb'),'queue',_0x59b0('0xc'),_0x59b0('0xd')];function emit(_0x26612c,_0x492e1e,_0x469b28){io['to'](_0x26612c)[_0x59b0('0xe')](_0x492e1e,_0x469b28);}function emitChannelQueueInteraction(_0x312bef,_0x73c7ab,_0x4942db,_0x183e5d,_0x9c04b0,_0x34788d,_0x46d6fd,_0x13e42a){var _0x5bb966=_['clone'](_0x4942db);_0x5bb966[_0x59b0('0xa')]=_0x13e42a;_0x5bb966['queue']=_0x73c7ab;_0x5bb966[_0x59b0('0xb')]=_0x183e5d;_0x5bb966['id']=_0x9c04b0;if(_0x34788d){_0x46d6fd[util['format'](_0x59b0('0xf'),_0x312bef)][_0x9c04b0]=_[_0x59b0('0x10')](_0x5bb966,attributes);}else{delete _0x46d6fd[util['format'](_0x59b0('0xf'),_0x312bef)][_0x9c04b0];}emit(util[_0x59b0('0x11')]('%s:queue:%s',_0x312bef,_0x73c7ab),util[_0x59b0('0x11')](_0x59b0('0x12'),_0x312bef,_0x34788d?_0x59b0('0x13'):_0x59b0('0x14')),_[_0x59b0('0x10')](_0x5bb966,attributes));}var rpc={'openchannelQueueReport':require(_0x59b0('0x15')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x59b0('0x16')),'smsQueueReport':require(_0x59b0('0x17')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x59b0('0x18'))};var queue=schema({'name':{'type':_0x59b0('0x19'),'required':!![],'message':_0x59b0('0x1a')},'timeout':{'type':_0x59b0('0x1b'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x38829f,_0x5334d5,_0x4898d9,_0x10f769){if(_0x38829f&&_0x5334d5&&_0x4898d9){_0x5334d5[_0x59b0('0x1c')]+=0x1;var _0xeca5d4={'uniqueid':_0x38829f,'from':_0x4898d9[_0x59b0('0x1d')]?_0x4898d9['body']['from']:'','joinAt':moment()[_0x59b0('0x11')](_0x59b0('0x1e')),'ContactId':_0x4898d9['contact']?_0x4898d9['contact']['id']:null,'ListId':_0x4898d9[_0x59b0('0x1f')]?_0x4898d9['list']['id']:null};_0xeca5d4[_[_0x59b0('0x20')](_0x4898d9['channel'])+_0x59b0('0x21')]=_0x5334d5['id']||null;_0xeca5d4[_[_0x59b0('0x20')](_0x4898d9[_0x59b0('0x22')])+_0x59b0('0x23')]=_0x4898d9[_0x59b0('0x24')]?_0x4898d9[_0x59b0('0x24')]['id']:null;_0xeca5d4[_[_0x59b0('0x20')](_0x4898d9[_0x59b0('0x22')])+'MessageId']=_0x4898d9[_0x59b0('0x25')]?_0x4898d9['message']['id']:null;_0xeca5d4[_[_0x59b0('0x20')](_0x4898d9[_0x59b0('0x22')])+(_0x4898d9[_0x59b0('0x22')]!==_0x59b0('0x26')?_0x59b0('0x27'):_0x59b0('0x28'))]=_0x4898d9[_0x59b0('0xb')]?_0x4898d9[_0x59b0('0xb')]['id']:null;logger[_0x59b0('0x29')](util[_0x59b0('0x11')](_0x59b0('0x2a'),_0x38829f,_0x5334d5[_0x59b0('0x2b')]));emitChannelQueueInteraction(_0x4898d9[_0x59b0('0x22')],_0x5334d5[_0x59b0('0x2b')],_0xeca5d4,_0x4898d9[_0x59b0('0xb')]['name'],_0x4898d9['message']['id'],!![],_0x10f769,_0x5334d5['id']);if(rpc[_0x4898d9[_0x59b0('0x22')]+_0x59b0('0x2c')]){return rpc[_0x4898d9[_0x59b0('0x22')]+_0x59b0('0x2c')][_0x59b0('0x2d')](_0xeca5d4)[_0x59b0('0x2e')](function(_0x5dda76){logger['error']('create\x20queue\x20report');});}}}function stopRouting(_0x5a05da,_0x211d1f,_0xca0425,_0x5d9335){if(_0x5a05da&&_0x211d1f){_0x211d1f[_0x59b0('0x1c')]-=0x1;var _0x5b2f63={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x59b0('0x11')](_0x59b0('0x1e')),'reason':'accepted'};logger[_0x59b0('0x29')](util[_0x59b0('0x11')](_0x59b0('0x2f'),_0x5a05da,_0x211d1f[_0x59b0('0x2b')]));emitChannelQueueInteraction(_0xca0425[_0x59b0('0x22')],_0x211d1f[_0x59b0('0x2b')],_0xca0425[_0x59b0('0x1d')],_0xca0425[_0x59b0('0xb')][_0x59b0('0x2b')],_0xca0425['message']['id'],![],_0x5d9335,_0x211d1f['id']);if(rpc[_0xca0425['channel']+_0x59b0('0x2c')]){return rpc[_0xca0425['channel']+_0x59b0('0x2c')]['update'](_0x5a05da,_0x5b2f63)[_0x59b0('0x2e')](function(_0x50fc7f){logger['error'](_0x59b0('0x30'));});}}}function endRouting(_0x57ae9b,_0xbeb43e,_0x34a08d,_0x14cd94){if(_0x57ae9b&&_0xbeb43e){_0xbeb43e[_0x59b0('0x1c')]-=0x1;var _0x4365c5={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x59b0('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x59b0('0x31')};logger['info'](util[_0x59b0('0x11')](_0x59b0('0x32'),_0x57ae9b,_0xbeb43e['name']));emitChannelQueueInteraction(_0x34a08d[_0x59b0('0x22')],_0xbeb43e[_0x59b0('0x2b')],_0x34a08d[_0x59b0('0x1d')],_0x34a08d[_0x59b0('0xb')][_0x59b0('0x2b')],_0x34a08d[_0x59b0('0x25')]['id'],![],_0x14cd94);if(rpc[_0x34a08d[_0x59b0('0x22')]+_0x59b0('0x2c')]){return rpc[_0x34a08d[_0x59b0('0x22')]+'QueueReport'][_0x59b0('0x33')](_0x57ae9b,_0x4365c5)[_0x59b0('0x2e')](function(_0x516904){logger['error'](_0x59b0('0x30'));});}}}function handleFindQueue(_0x61251b){return function(_0x4e5e77){return _0x4e5e77[_0x59b0('0x2b')][_0x59b0('0x34')]()===_0x61251b[_0x59b0('0x34')]();};}exports[_0x59b0('0x35')]=function(_0x14e90c,_0x1a730,_0x4b35a4,_0x3bbb2e){return function(_0x440817){try{var _0x4a37d3={'name':_0x1a730[0x0],'timeout':_0x1a730[0x1]};var _0x45b6a5=queue[_0x59b0('0x36')](_0x4a37d3,{'typecast':!![]});if(_0x45b6a5[_0x59b0('0x37')]){logger['error']('[%s][QUEUE]\x20%s',_0x14e90c,_[_0x59b0('0x38')](_0x45b6a5,_0x59b0('0x25'))[_0x59b0('0x39')](',\x20'));_0x440817[_0x59b0('0x3a')]();}else{var _0x50bb13=_['find'](_0x4b35a4[_0x3bbb2e[_0x59b0('0x22')]+_0x59b0('0x3b')],handleFindQueue(_0x4a37d3['name']));if(_0x50bb13){startRouting(_0x14e90c,_0x50bb13,_0x3bbb2e,_0x4b35a4);var _0x19ad93=(_0x50bb13['timeout']||0xa)*0x3e8;var _0x1ff4bb=(_0x4a37d3[_0x59b0('0x31')]||0x14)*0x3e8;var _0x4a1df7,_0x8acd75;if(_0x19ad93>_0x1ff4bb){_0x1ff4bb=_0x19ad93;}var _0x47e6a9=seqqueue['createQueue'](_0x19ad93);_0x47e6a9['id']=_0x14e90c;_0x47e6a9['atimeout']=_0x19ad93;_0x47e6a9['qtimeout']=_0x1ff4bb;_0x47e6a9['channel']=_0x3bbb2e[_0x59b0('0x22')];_0x4b35a4['rules'][_0x14e90c]['on']('end',function(){logger[_0x59b0('0x29')](_0x59b0('0x3c'),_0x14e90c);stopRouting(_0x14e90c,_0x50bb13,_0x3bbb2e,_0x4b35a4);clearTimeout(_0x4a1df7);_0x4a1df7=undefined;_0x47e6a9['close'](!![]);if(_0x4b35a4[_0x59b0('0x3d')][_0x14e90c]){delete _0x4b35a4[_0x59b0('0x3d')][_0x14e90c];}_0x440817[_0x59b0('0x3a')]();});_0x4b35a4[_0x59b0('0x3d')][_0x14e90c]['on'](_0x59b0('0x3e'),function(){if(_0x4b35a4['rules'][_0x14e90c]){delete _0x4b35a4['rules'][_0x14e90c];}});_0x4a1df7=setTimeout(function(){logger[_0x59b0('0x29')](_0x59b0('0x3f'),_0x14e90c);endRouting(_0x14e90c,_0x50bb13,_0x3bbb2e,_0x4b35a4);clearTimeout(_0x4a1df7);_0x47e6a9[_0x59b0('0x40')](!![]);_0x440817[_0x59b0('0x41')]();},_0x1ff4bb);switch(_0x50bb13['strategy']){case'rrmemory':strategy[_0x59b0('0x42')](_0x47e6a9,_0x50bb13,_0x4b35a4,_0x3bbb2e);break;default:strategy[_0x59b0('0x43')](_0x47e6a9,_0x50bb13,_0x4b35a4,_0x3bbb2e);}}else{logger[_0x59b0('0x44')](_0x59b0('0x45'),_0x14e90c,_0x4a37d3[_0x59b0('0x2b')]);_0x440817[_0x59b0('0x3a')]();}}}catch(_0x43c500){console['log'](_0x43c500);logger[_0x59b0('0x44')](_0x59b0('0x46'),_0x14e90c,_0x43c500[_0x59b0('0x47')]);_0x440817[_0x59b0('0x3a')]();}};}; \ 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 2435721..54a900d 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 _0x9122=['notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','drained','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents','channel','busy','busyQueue','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing'];(function(_0x5f4e27,_0x4a6767){var _0x38564a=function(_0x1cc49e){while(--_0x1cc49e){_0x5f4e27['push'](_0x5f4e27['shift']());}};_0x38564a(++_0x4a6767);}(_0x9122,0xa5));var _0x2912=function(_0xedeb5b,_0x129a28){_0xedeb5b=_0xedeb5b-0x0;var _0x3ec94f=_0x9122[_0xedeb5b];return _0x3ec94f;};'use strict';var _=require(_0x2912('0x0'));var uuid=require(_0x2912('0x1'));var util=require(_0x2912('0x2'));var logger=require(_0x2912('0x3'))(_0x2912('0x4'));var Agent=function(_0x46da56,_0x24a063,_0x394455,_0x354eb2){this[_0x2912('0x5')]=uuid['v4']();this[_0x2912('0x6')]=_0x46da56;this[_0x2912('0x7')]=_0x24a063;this[_0x2912('0x8')]=_0x394455;this[_0x2912('0x4')]=_0x354eb2;this[_0x2912('0x6')][_0x2912('0x9')](this[_0x2912('0xa')][_0x2912('0xb')](this),this[_0x2912('0xc')][_0x2912('0xb')](this));this[_0x2912('0x6')]['on']('timeout',this['handleTimeout']['bind'](this));this[_0x2912('0x6')]['on'](_0x2912('0xd'),this[_0x2912('0xe')]['bind'](this));};Agent[_0x2912('0xf')][_0x2912('0x9')]=function(){this['squeue'][_0x2912('0x9')](this[_0x2912('0xa')]['bind'](this),this['handleTimeout'][_0x2912('0xb')](this));};Agent[_0x2912('0xf')]['handleDrained']=function(){this[_0x2912('0xc')](!![]);};Agent[_0x2912('0xf')]['handleRun']=function(_0x9c1426){logger['info'](_0x2912('0x10'),this[_0x2912('0x6')]['id'],this['agent']['id']);if(_['isNil'](this['realtime']['agents'][this[_0x2912('0x7')]['id']])){logger[_0x2912('0x11')](_0x2912('0x12'),this[_0x2912('0x6')]['id'],this['agent']['id']);setTimeout(this[_0x2912('0x9')][_0x2912('0xb')](this),0x3e8);}else{if(this[_0x2912('0x4')][_0x2912('0x13')]||util[_0x2912('0x14')](this[_0x2912('0x6')]['id'],this[_0x2912('0x8')][_0x2912('0x15')][this[_0x2912('0x7')]['id']],this[_0x2912('0x6')][_0x2912('0x16')],![])){this[_0x2912('0x8')]['agents'][this[_0x2912('0x7')]['id']][_0x2912('0x17')]=!![];this[_0x2912('0x8')][_0x2912('0x15')][this[_0x2912('0x7')]['id']][_0x2912('0x18')]=undefined;util['showNotification'](this['notificationId'],this[_0x2912('0x6')]['id'],this['realtime'][_0x2912('0x15')][this[_0x2912('0x7')]['id']],null,this[_0x2912('0x4')]);util[_0x2912('0x19')](this[_0x2912('0x6')]['id'],this[_0x2912('0x8')]['agents'][this[_0x2912('0x7')]['id']],_0x2912('0x1a')+(this['routing']['forcedOwnership']?':FORCED':''));}else{logger[_0x2912('0x11')](_0x2912('0x1b'),this[_0x2912('0x6')]['id'],this[_0x2912('0x7')]['id']);setTimeout(this['push'][_0x2912('0xb')](this),0x3e8);}}};Agent[_0x2912('0xf')]['handleTimeout']=function(_0x19f81e){if(_[_0x2912('0x1c')](this[_0x2912('0x8')][_0x2912('0x15')][this[_0x2912('0x7')]['id']])){return logger[_0x2912('0x11')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this['agent']['id']);}else{logger[_0x2912('0x11')](_0x2912('0x1d'),this[_0x2912('0x6')]['id'],this[_0x2912('0x7')]['id']);util[_0x2912('0x1e')](this[_0x2912('0x5')],this[_0x2912('0x6')]['id'],this[_0x2912('0x8')][_0x2912('0x15')][this['agent']['id']],null,this[_0x2912('0x4')]);this[_0x2912('0x8')][_0x2912('0x15')][this['agent']['id']]['busy']=![];this[_0x2912('0x8')]['agents'][this[_0x2912('0x7')]['id']][_0x2912('0x18')]=undefined;util[_0x2912('0x19')](this[_0x2912('0x6')]['id'],this['realtime'][_0x2912('0x15')][this[_0x2912('0x7')]['id']],_0x19f81e?_0x2912('0x1f'):_0x2912('0x20'));}if(!_0x19f81e){setTimeout(this['push'][_0x2912('0xb')](this),0x3e8);}};function agent(_0x191799,_0x35d170,_0x587d66,_0x3ff4c4){return new Agent(_0x191799,_0x35d170,_0x587d66,_0x3ff4c4);}module[_0x2912('0x21')]=agent; \ No newline at end of file +var _0x6956=['handleRun','bind','timeout','handleTimeout','drained','handleDrained','prototype','info','agents','agent','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','showNotification','notificationId','writeLog',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','exports','lodash','uuid','./util','../../../../../config/logger','routing','realtime','squeue','push'];(function(_0x131a94,_0x3b95ac){var _0x5b807f=function(_0x279e9f){while(--_0x279e9f){_0x131a94['push'](_0x131a94['shift']());}};_0x5b807f(++_0x3b95ac);}(_0x6956,0x198));var _0x6695=function(_0x2ad008,_0x45c253){_0x2ad008=_0x2ad008-0x0;var _0x4538cf=_0x6956[_0x2ad008];return _0x4538cf;};'use strict';var _=require(_0x6695('0x0'));var uuid=require(_0x6695('0x1'));var util=require(_0x6695('0x2'));var logger=require(_0x6695('0x3'))(_0x6695('0x4'));var Agent=function(_0x365dc8,_0x1f5a6a,_0x54d710,_0x9e7521){this['notificationId']=uuid['v4']();this['squeue']=_0x365dc8;this['agent']=_0x1f5a6a;this[_0x6695('0x5')]=_0x54d710;this[_0x6695('0x4')]=_0x9e7521;this[_0x6695('0x6')][_0x6695('0x7')](this[_0x6695('0x8')][_0x6695('0x9')](this),this['handleTimeout'][_0x6695('0x9')](this));this['squeue']['on'](_0x6695('0xa'),this[_0x6695('0xb')][_0x6695('0x9')](this));this[_0x6695('0x6')]['on'](_0x6695('0xc'),this[_0x6695('0xd')][_0x6695('0x9')](this));};Agent['prototype'][_0x6695('0x7')]=function(){this[_0x6695('0x6')][_0x6695('0x7')](this[_0x6695('0x8')][_0x6695('0x9')](this),this[_0x6695('0xb')][_0x6695('0x9')](this));};Agent[_0x6695('0xe')][_0x6695('0xd')]=function(){this[_0x6695('0xb')](!![]);};Agent[_0x6695('0xe')]['handleRun']=function(_0x23a61d){logger[_0x6695('0xf')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x6695('0x6')]['id'],this['agent']['id']);if(_['isNil'](this[_0x6695('0x5')][_0x6695('0x10')][this[_0x6695('0x11')]['id']])){logger[_0x6695('0xf')](_0x6695('0x12'),this[_0x6695('0x6')]['id'],this['agent']['id']);setTimeout(this[_0x6695('0x7')][_0x6695('0x9')](this),0x3e8);}else{if(this[_0x6695('0x4')][_0x6695('0x13')]||util[_0x6695('0x14')](this[_0x6695('0x6')]['id'],this['realtime'][_0x6695('0x10')][this['agent']['id']],this[_0x6695('0x6')][_0x6695('0x15')],![])){this[_0x6695('0x5')][_0x6695('0x10')][this[_0x6695('0x11')]['id']][_0x6695('0x16')]=!![];this[_0x6695('0x5')][_0x6695('0x10')][this['agent']['id']][_0x6695('0x17')]=undefined;util[_0x6695('0x18')](this[_0x6695('0x19')],this[_0x6695('0x6')]['id'],this[_0x6695('0x5')]['agents'][this['agent']['id']],null,this[_0x6695('0x4')]);util[_0x6695('0x1a')](this[_0x6695('0x6')]['id'],this[_0x6695('0x5')][_0x6695('0x10')][this[_0x6695('0x11')]['id']],'RINGING'+(this['routing'][_0x6695('0x13')]?_0x6695('0x1b'):''));}else{logger[_0x6695('0xf')](_0x6695('0x1c'),this[_0x6695('0x6')]['id'],this[_0x6695('0x11')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent['prototype'][_0x6695('0xb')]=function(_0x18b0f1){if(_['isNil'](this[_0x6695('0x5')][_0x6695('0x10')][this[_0x6695('0x11')]['id']])){return logger[_0x6695('0xf')](_0x6695('0x12'),this['squeue']['id'],this[_0x6695('0x11')]['id']);}else{logger[_0x6695('0xf')](_0x6695('0x1d'),this[_0x6695('0x6')]['id'],this[_0x6695('0x11')]['id']);util[_0x6695('0x1e')](this[_0x6695('0x19')],this[_0x6695('0x6')]['id'],this['realtime']['agents'][this['agent']['id']],null,this[_0x6695('0x4')]);this['realtime'][_0x6695('0x10')][this[_0x6695('0x11')]['id']][_0x6695('0x16')]=![];this[_0x6695('0x5')]['agents'][this['agent']['id']]['busyQueue']=undefined;util[_0x6695('0x1a')](this[_0x6695('0x6')]['id'],this[_0x6695('0x5')][_0x6695('0x10')][this[_0x6695('0x11')]['id']],_0x18b0f1?'STOP':'TIMEOUT');}if(!_0x18b0f1){setTimeout(this['push'][_0x6695('0x9')](this),0x3e8);}};function agent(_0x441e52,_0x567a7b,_0x88727b,_0x1f00ed){return new Agent(_0x441e52,_0x567a7b,_0x88727b,_0x1f00ed);}module[_0x6695('0x1f')]=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 3d602c2..daaf236 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 _0x8c52=['queue','realtime','handleTimeout','bind','drained','handleDrained','prototype','push','handleRun','isNil','Agents','length','agents','isAgentAvailable','channel','writeLog','RINGING','busy','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','info','[%s][QUEUE]\x20EMPTY','hideNotification','TIMEOUT','busyQueue','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue'];(function(_0x14faef,_0x3a6086){var _0x203401=function(_0x5f35ef){while(--_0x5f35ef){_0x14faef['push'](_0x14faef['shift']());}};_0x203401(++_0x3a6086);}(_0x8c52,0x7e));var _0x28c5=function(_0xb3bbc8,_0x2a3635){_0xb3bbc8=_0xb3bbc8-0x0;var _0x3254b7=_0x8c52[_0xb3bbc8];return _0x3254b7;};'use strict';var _=require(_0x28c5('0x0'));var uuid=require('uuid');var util=require(_0x28c5('0x1'));var logger=require(_0x28c5('0x2'))(_0x28c5('0x3'));var Beepall=function(_0x37c10f,_0x398f22,_0x41668f,_0x412a0a){this[_0x28c5('0x4')]=uuid['v4']();this[_0x28c5('0x5')]=_0x37c10f;this[_0x28c5('0x6')]=_0x398f22;this[_0x28c5('0x7')]=_0x41668f;this[_0x28c5('0x3')]=_0x412a0a;this['squeue']['push'](this['handleRun']['bind'](this),this[_0x28c5('0x8')][_0x28c5('0x9')](this));this[_0x28c5('0x5')]['on']('timeout',this[_0x28c5('0x8')][_0x28c5('0x9')](this));this['squeue']['on'](_0x28c5('0xa'),this[_0x28c5('0xb')][_0x28c5('0x9')](this));};Beepall[_0x28c5('0xc')][_0x28c5('0xd')]=function(){this[_0x28c5('0x5')][_0x28c5('0xd')](this[_0x28c5('0xe')][_0x28c5('0x9')](this),this[_0x28c5('0x8')]['bind'](this));};Beepall[_0x28c5('0xc')][_0x28c5('0xb')]=function(_0x3a39f3){this[_0x28c5('0x8')](!![]);};Beepall['prototype'][_0x28c5('0xe')]=function(_0x236732){var _0xa2e982=!![];if(!_[_0x28c5('0xf')](this[_0x28c5('0x6')])&&!_[_0x28c5('0xf')](this[_0x28c5('0x6')][_0x28c5('0x10')])&&this['queue'][_0x28c5('0x10')][_0x28c5('0x11')]>0x0){for(var _0x19fc7f=0x0,_0x5214c6;_0x19fc7f0x0){for(var _0x57b986=0x0,_0x1e921c;_0x57b9860x0&&_0x59af4b[_0x11290c+_0x6a45('0x24')]>=_0x59af4b[_0x11290c+_0x6a45('0x23')]){writeLog(_0x3faae5,_0x59af4b,_0x11290c[_0x6a45('0x25')]()+_0x6a45('0x26'));return![];}}return!![];};exports[_0x6a45('0x27')]=function(_0x526062,_0x2b8cc8,_0x308003,_0x4770cc,_0x1ccff0){return sendNotification(!![],_0x526062,_0x2b8cc8,_0x308003,_0x4770cc,_0x1ccff0);};exports[_0x6a45('0x28')]=function(_0x227b6f,_0x3fac9b,_0x313c13,_0x54286d,_0x14adb5){return sendNotification(![],_0x227b6f,_0x3fac9b,_0x313c13,_0x54286d,_0x14adb5);};exports[_0x6a45('0x29')]=writeLog; \ No newline at end of file +var _0x7bd0=['notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','hideNotification','lodash','util','../utils','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','defaults','redis','localhost','socket.io-emitter','emit','format','user:%s','name','user:save','split','\x20interaction','account','notificationShake','body','queue','getMustacheRender','notificationTemplate','msg','error','message'];(function(_0x27c0cf,_0x3038f6){var _0xf7cd0a=function(_0x411d7b){while(--_0x411d7b){_0x27c0cf['push'](_0x27c0cf['shift']());}};_0xf7cd0a(++_0x3038f6);}(_0x7bd0,0x111));var _0x07bd=function(_0x52bfa5,_0x42cf21){_0x52bfa5=_0x52bfa5-0x0;var _0x26f80b=_0x7bd0[_0x52bfa5];return _0x26f80b;};'use strict';var _=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var utils=require(_0x07bd('0x2'));var Mustache=require(_0x07bd('0x3'));var Redis=require(_0x07bd('0x4'));var config=require(_0x07bd('0x5'));var logger=require(_0x07bd('0x6'))(_0x07bd('0x7'));config['redis']=_[_0x07bd('0x8')](config[_0x07bd('0x9')],{'host':_0x07bd('0xa'),'port':0x18eb});var io=require(_0x07bd('0xb'))(new Redis(config[_0x07bd('0x9')]));function emit(_0x422a22,_0x2e4cd1,_0x5a939d){io['to'](_0x422a22)[_0x07bd('0xc')](_0x2e4cd1,_0x5a939d);}function sendNotification(_0x5cd446,_0x8032dc,_0xb10241,_0x323724,_0x5984fa,_0x2bace8){io['to'](util[_0x07bd('0xd')](_0x07bd('0xe'),_0x323724[_0x07bd('0xf')]))['emit'](_0x07bd('0x10'),_0x323724);var _0x313ca5=_0x2bace8||{};var _0x1b067a=_0xb10241[_0x07bd('0x11')]('.');var _0x456ecd={'uniqueid':_0x8032dc,'channel':_0x1b067a[0x0],'id':_0x1b067a[0x1],'title':_0x1b067a[0x0]+_0x07bd('0x12'),'interactionId':_0x1b067a[0x2],'queue':_0x5984fa?_0x5984fa[_0x07bd('0xf')]:null,'sound':_0x313ca5[_0x07bd('0x13')]['notificationSound'],'shake':_0x313ca5['account'][_0x07bd('0x14')]};try{if(!_0x313ca5[_0x07bd('0x15')]){_0x313ca5[_0x07bd('0x15')]={};}if(_0x5984fa){_0x313ca5[_0x07bd('0x15')][_0x07bd('0x16')]=_0x5984fa;}else if(_0x313ca5[_0x07bd('0x15')][_0x07bd('0x16')]){delete _0x313ca5['body'][_0x07bd('0x16')];}_0x456ecd['msg']=utils[_0x07bd('0x17')](_0x313ca5[_0x07bd('0x13')][_0x07bd('0x18')],_0x313ca5);}catch(_0x1713ca){_0x456ecd[_0x07bd('0x19')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0x07bd('0x1a')](util[_0x07bd('0xd')]('[%s][QUEUE]\x20%s',_0x8032dc,_0x1713ca[_0x07bd('0x1b')]));}io['to'](util[_0x07bd('0xd')](_0x07bd('0xe'),_0x323724[_0x07bd('0xf')]))[_0x07bd('0xc')](util[_0x07bd('0xd')](_0x07bd('0x1c'),_0x5cd446?_0x07bd('0x1d'):_0x07bd('0x1e')),_0x456ecd);}function writeLog(_0x50109f,_0x15c0b8,_0x227807){return logger[_0x07bd('0x1f')](util[_0x07bd('0xd')](_0x07bd('0x20'),_0x50109f,_0x15c0b8['name'],_0x227807));}exports['isAgentAvailable']=function(_0xbb7117,_0x51ca22,_0x2b0dee,_0x480c9c){if(_0x51ca22['busy']){writeLog(_0xbb7117,_0x51ca22,_0x07bd('0x21'));return![];}if(!_0x51ca22[_0x07bd('0x22')]){writeLog(_0xbb7117,_0x51ca22,_0x07bd('0x23'));return![];}if(_0x51ca22[_0x2b0dee+_0x07bd('0x24')]){writeLog(_0xbb7117,_0x51ca22,_0x07bd('0x25'));return![];}if(_0x480c9c&&_0x51ca22[_0x07bd('0x26')](_0x2b0dee+'Capacity')&&_0x51ca22[_0x07bd('0x26')](_0x2b0dee+_0x07bd('0x27'))){if(_0x51ca22[_0x2b0dee+_0x07bd('0x28')]>0x0&&_0x51ca22[_0x2b0dee+_0x07bd('0x27')]>=_0x51ca22[_0x2b0dee+_0x07bd('0x28')]){writeLog(_0xbb7117,_0x51ca22,_0x2b0dee[_0x07bd('0x29')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports['showNotification']=function(_0x5184dc,_0x335d61,_0xfa7566,_0x5b31f7,_0x51efa8){return sendNotification(!![],_0x5184dc,_0x335d61,_0xfa7566,_0x5b31f7,_0x51efa8);};exports[_0x07bd('0x2a')]=function(_0x400cc0,_0x253dc0,_0x46ed12,_0x3f9424,_0x13bf6b){return sendNotification(![],_0x400cc0,_0x253dc0,_0x46ed12,_0x3f9424,_0x13bf6b);};exports['writeLog']=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 c3ec6af..56f2127 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 _0x6944=['[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','[%s][SYSTEM]\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','body'];(function(_0x514be6,_0x1ca62c){var _0x250c5c=function(_0x403fbe){while(--_0x403fbe){_0x514be6['push'](_0x514be6['shift']());}};_0x250c5c(++_0x1ca62c);}(_0x6944,0xe6));var _0x4694=function(_0x171462,_0x489a7e){_0x171462=_0x171462-0x0;var _0x5c4ab2=_0x6944[_0x171462];return _0x5c4ab2;};'use strict';var schema=require(_0x4694('0x0'));var sh=require(_0x4694('0x1'));var _=require(_0x4694('0x2'));var utils=require(_0x4694('0x3'));var logger=require(_0x4694('0x4'))('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0x4694('0x5')}});exports['consequence']=function(_0x454c18,_0x216ccb){return function(_0x270d1c){try{var _0x401ff1={'command':_0x216ccb[0x0]};var _0x2b677a=system[_0x4694('0x0')](_0x401ff1,{'typecast':!![]});if(_0x2b677a[_0x4694('0x6')]){logger['error']('[%s][SYSTEM]\x20%s',_0x454c18,_[_0x4694('0x7')](_0x2b677a,_0x4694('0x8'))[_0x4694('0x9')](',\x20'));logger['info'](_0x4694('0xa'),_0x454c18);_0x270d1c[_0x4694('0xb')]();}else{var _0x1e08e7=this;var _0x29bb08=utils['getMustacheRender'](_0x216ccb[0x0],this);logger[_0x4694('0xc')](_0x4694('0xd'),_0x454c18,_0x29bb08);sh[_0x4694('0xe')](_[_0x4694('0xf')](_0x29bb08),function(_0x52511d,_0x136d5c){logger['info'](_0x4694('0x10'),_0x454c18,_0x52511d);if(_0x52511d==0x0){var _0x4fc853=_0x136d5c[_0x4694('0x11')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x216ccb[0x1])||_[_0x4694('0x12')](_0x216ccb[0x1])){logger[_0x4694('0xc')]('[%s][SYSTEM]\x20no\x20variable',_0x454c18);_0x1e08e7[_0x4694('0x13')][_0x216ccb[0x1]]=_0x4fc853;}else{logger[_0x4694('0xc')](_0x4694('0x14'),_0x454c18,_0x216ccb[0x1],_0x4fc853);_0x1e08e7[_0x4694('0x13')][_0x216ccb[0x1]]=_0x4fc853;}}_0x270d1c[_0x4694('0xb')]();});}}catch(_0x402eeb){logger[_0x4694('0x15')](_0x4694('0x16'),_0x454c18,_[_0x4694('0x17')](_0x402eeb)?JSON[_0x4694('0x18')](_0x402eeb):_0x402eeb);logger[_0x4694('0xc')](_0x4694('0xa'),_0x454c18);_0x270d1c['next']();}};}; \ No newline at end of file +var _0x2227=['length','[%s][SYSTEM]\x20%s','join','next','info','exec','replace','isNil','isEmpty','body','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','shelljs','lodash','./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence'];(function(_0x544ae2,_0x38197f){var _0x9100e1=function(_0xc8d376){while(--_0xc8d376){_0x544ae2['push'](_0x544ae2['shift']());}};_0x9100e1(++_0x38197f);}(_0x2227,0x103));var _0x7222=function(_0x1b2422,_0x1e98d4){_0x1b2422=_0x1b2422-0x0;var _0x376573=_0x2227[_0x1b2422];return _0x376573;};'use strict';var schema=require('validate');var sh=require(_0x7222('0x0'));var _=require(_0x7222('0x1'));var utils=require(_0x7222('0x2'));var logger=require(_0x7222('0x3'))('routing');var system=schema({'command':{'type':_0x7222('0x4'),'required':!![],'message':_0x7222('0x5')}});exports[_0x7222('0x6')]=function(_0x494e85,_0x482250){return function(_0x475641){try{var _0x5cdc96={'command':_0x482250[0x0]};var _0x5240fb=system['validate'](_0x5cdc96,{'typecast':!![]});if(_0x5240fb[_0x7222('0x7')]){logger['error'](_0x7222('0x8'),_0x494e85,_['map'](_0x5240fb,'message')[_0x7222('0x9')](',\x20'));logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x494e85);_0x475641[_0x7222('0xa')]();}else{var _0x5521df=this;var _0x33a1fc=utils['getMustacheRender'](_0x482250[0x0],this);logger[_0x7222('0xb')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x494e85,_0x33a1fc);sh[_0x7222('0xc')](_['trim'](_0x33a1fc),function(_0x51640d,_0x42b76a){logger['info']('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x494e85,_0x51640d);if(_0x51640d==0x0){var _0x4a5af3=_0x42b76a[_0x7222('0xd')](/(\r\n|\n|\r)/gm,'');if(_[_0x7222('0xe')](_0x482250[0x1])||_[_0x7222('0xf')](_0x482250[0x1])){logger[_0x7222('0xb')]('[%s][SYSTEM]\x20no\x20variable',_0x494e85);_0x5521df['body'][_0x482250[0x1]]=_0x4a5af3;}else{logger[_0x7222('0xb')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x494e85,_0x482250[0x1],_0x4a5af3);_0x5521df[_0x7222('0x10')][_0x482250[0x1]]=_0x4a5af3;}}_0x475641['next']();});}}catch(_0x5170a4){logger['error'](_0x7222('0x8'),_0x494e85,_['isObject'](_0x5170a4)?JSON[_0x7222('0x11')](_0x5170a4):_0x5170a4);logger[_0x7222('0xb')](_0x7222('0x12'),_0x494e85);_0x475641[_0x7222('0xa')]();}};}; \ 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 4a2cbbd..156f772 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 _0x7fa8=['join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','channel','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','stringify','finally','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][TAG]\x20%s','map'];(function(_0x4b4865,_0xb43449){var _0x190dc2=function(_0x2b41f7){while(--_0x2b41f7){_0x4b4865['push'](_0x4b4865['shift']());}};_0x190dc2(++_0xb43449);}(_0x7fa8,0xcb));var _0x87fa=function(_0x39dd10,_0x134622){_0x39dd10=_0x39dd10-0x0;var _0x35bd8a=_0x7fa8[_0x39dd10];return _0x35bd8a;};'use strict';var schema=require(_0x87fa('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x87fa('0x1')),'openchannelInteraction':require(_0x87fa('0x2')),'smsInteraction':require(_0x87fa('0x3')),'mailInteraction':require(_0x87fa('0x4')),'faxInteraction':require(_0x87fa('0x5')),'whatsappInteraction':require(_0x87fa('0x6'))};var logger=require('../../../../config/logger')(_0x87fa('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x87fa('0x8')}});exports[_0x87fa('0x9')]=function(_0x3bdaee,_0x4380c7,_0x44e37f,_0x3011d2){return function(_0x339a2c){try{var _0x2ab527={'tag':_0x4380c7[0x0]};var _0x575888=tag[_0x87fa('0x0')](_0x2ab527,{'typecast':!![]});if(_0x575888[_0x87fa('0xa')]){logger['error'](_0x87fa('0xb'),_0x3bdaee,_[_0x87fa('0xc')](_0x575888,'message')[_0x87fa('0xd')](',\x20'));logger[_0x87fa('0xe')](_0x87fa('0xf'),_0x3bdaee);_0x339a2c[_0x87fa('0x10')]();}else{var _0x384d5f={'ids':[_0x4380c7[0x0]]};if(rpc[_0x3011d2['channel']+_0x87fa('0x11')]){rpc[_0x3011d2[_0x87fa('0x12')]+_0x87fa('0x11')][_0x87fa('0x13')](_0x3011d2[_0x87fa('0x14')]['id'],_0x384d5f)[_0x87fa('0x15')](function(_0x384d7d){logger[_0x87fa('0xe')](_0x87fa('0x16'),_0x3bdaee,_0x4380c7[0x1],_0x3011d2[_0x87fa('0x12')],_0x3011d2[_0x87fa('0x14')]['id']);})[_0x87fa('0x17')](function(_0x17b1d2){logger[_0x87fa('0x18')](_0x87fa('0xb'),_0x3bdaee,JSON[_0x87fa('0x19')](_0x17b1d2));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3bdaee);})[_0x87fa('0x1a')](function(){_0x339a2c[_0x87fa('0x10')]();});}}}catch(_0x380e70){logger[_0x87fa('0x18')](_0x87fa('0xb'),_0x3bdaee,_['isObject'](_0x380e70)?JSON[_0x87fa('0x19')](_0x380e70):_0x380e70);logger[_0x87fa('0xe')](_0x87fa('0xf'),_0x3bdaee);_0x339a2c[_0x87fa('0x10')]();}};}; \ No newline at end of file +var _0xa155=['channel','Interaction','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][TAG]\x20%s','message','join','info','next'];(function(_0x1e9d3a,_0x46c188){var _0x3d00bd=function(_0x5e80c9){while(--_0x5e80c9){_0x1e9d3a['push'](_0x1e9d3a['shift']());}};_0x3d00bd(++_0x46c188);}(_0xa155,0x180));var _0x5a15=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xa155[_0x13e741];return _0x3f8bb3;};'use strict';var schema=require(_0x5a15('0x0'));var _=require(_0x5a15('0x1'));var rpc={'chatInteraction':require(_0x5a15('0x2')),'openchannelInteraction':require(_0x5a15('0x3')),'smsInteraction':require(_0x5a15('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x5a15('0x5'))};var logger=require(_0x5a15('0x6'))(_0x5a15('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x5a15('0x8')}});exports[_0x5a15('0x9')]=function(_0x451095,_0x41bfd9,_0x403a09,_0x296703){return function(_0x13da37){try{var _0x22b220={'tag':_0x41bfd9[0x0]};var _0x2b841d=tag[_0x5a15('0x0')](_0x22b220,{'typecast':!![]});if(_0x2b841d['length']){logger[_0x5a15('0xa')](_0x5a15('0xb'),_0x451095,_['map'](_0x2b841d,_0x5a15('0xc'))[_0x5a15('0xd')](',\x20'));logger[_0x5a15('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x451095);_0x13da37[_0x5a15('0xf')]();}else{var _0xa8a48d={'ids':[_0x41bfd9[0x0]]};if(rpc[_0x296703[_0x5a15('0x10')]+'Interaction']){rpc[_0x296703[_0x5a15('0x10')]+_0x5a15('0x11')][_0x5a15('0x12')](_0x296703[_0x5a15('0x13')]['id'],_0xa8a48d)['then'](function(_0x2b0943){logger[_0x5a15('0xe')](_0x5a15('0x14'),_0x451095,_0x41bfd9[0x1],_0x296703[_0x5a15('0x10')],_0x296703[_0x5a15('0x13')]['id']);})[_0x5a15('0x15')](function(_0x22c3f3){logger[_0x5a15('0xa')](_0x5a15('0xb'),_0x451095,JSON[_0x5a15('0x16')](_0x22c3f3));logger['info'](_0x5a15('0x17'),_0x451095);})[_0x5a15('0x18')](function(){_0x13da37['next']();});}}}catch(_0xbcc65b){logger[_0x5a15('0xa')](_0x5a15('0xb'),_0x451095,_['isObject'](_0xbcc65b)?JSON[_0x5a15('0x16')](_0xbcc65b):_0xbcc65b);logger[_0x5a15('0xe')](_0x5a15('0x17'),_0x451095);_0x13da37['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 7c92a00..ab132b4 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 _0x2195=['replace','\x20-\x20','includes','urlOnAnswer','?params=','urlOnRing','title','2.0','method','login','push','stringify','utf8','parse','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','then','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger','lodash','consequence'];(function(_0x2fa137,_0x15d570){var _0x15a421=function(_0x5797c7){while(--_0x5797c7){_0x2fa137['push'](_0x2fa137['shift']());}};_0x15a421(++_0x15d570);}(_0x2195,0xfd));var _0x5219=function(_0x10c2d3,_0x2f5914){_0x10c2d3=_0x10c2d3-0x0;var _0x5a0b13=_0x2195[_0x10c2d3];return _0x5a0b13;};'use strict';var rp=require('request-promise');var logger=require(_0x5219('0x0'))('routing');var _=require(_0x5219('0x1'));var arr=[];exports[_0x5219('0x2')]=function(_0x95dd84,_0x19da7a){return function(_0x1cef82){var _0x23a749=_0x19da7a[0xa];var _0x31405b=_0x19da7a[0xb];var _0x3e8f2a=_0x19da7a[0xc];var _0x115b03=_0x19da7a[0xd];var _0x15c4a6=_0x19da7a[0xe];var _0x92d4ff=_0x19da7a[0xf][_0x5219('0x3')](/\n/g,_0x5219('0x4'));var _0x4ef8f7=_0x19da7a[0x10][_0x5219('0x3')](/\n/g,'\x20');if(!arr[_0x5219('0x5')](_0x31405b)){arr['push'](_0x31405b);var _0x2db601=_0x19da7a[0x3];var _0x43d73a=_0x19da7a[0x4];var _0x29f611=_0x19da7a[0x1];var _0x195614=_0x19da7a[0x0];var _0x4b9ea2={};_0x4b9ea2[_0x5219('0x6')]=_0x19da7a[0x8]+_0x5219('0x7')+_0x3e8f2a+'|'+_0x23a749+'|'+_0x115b03+'|'+_0x31405b+'|'+_0x15c4a6;_0x4b9ea2[_0x5219('0x8')]=_0x19da7a[0x7]+'?params='+_0x3e8f2a+'|'+_0x23a749+'|'+_0x115b03+'|'+_0x31405b+'|'+_0x15c4a6+'|'+_0x92d4ff+'|'+_0x4ef8f7;_0x4b9ea2[_0x5219('0x9')]=_0x19da7a[0x9];var _0x4097b5={};_0x4097b5['jsonrpc']=_0x5219('0xa');_0x4097b5[_0x5219('0xb')]=_0x5219('0xc');var _0x2cf57e=[];_0x2cf57e['push'](_0x19da7a[0x2]);_0x2cf57e[_0x5219('0xd')](_0x19da7a[0x5]);_0x2cf57e[_0x5219('0xd')](_0x19da7a[0x6]);_0x4097b5['params']=_0x2cf57e;_0x4097b5['id']=0x1;var _0x6b9c17=JSON[_0x5219('0xe')](_0x4097b5);var _0x49624c={'encoding':_0x5219('0xf'),'method':'POST','timeout':0x2710,'url':_0x2db601,'headers':{'Content-Type':'application/json-rpc'},'body':_0x6b9c17};return rp(_0x49624c)['then'](function(_0x4e75a6){const _0x198074=JSON[_0x5219('0x10')](_0x4e75a6);if(!_0x198074['result'][_0x5219('0x11')]){throw new Error(_0x5219('0x12'));}var _0x2435c4=_0x31405b;var _0x1e283f=_0x5219('0x13')+_0x29f611+_0x5219('0x14')+_0x195614+_0x5219('0x15')+_0x2435c4+_0x5219('0x16')+JSON[_0x5219('0xe')](_0x4b9ea2);var _0x1337e5=_0x43d73a+'?'+_0x1e283f;return rp(_0x1337e5);})[_0x5219('0x17')](function(_0x41d447){logger[_0x5219('0x18')](_0x5219('0x19'),_0x95dd84,_0x41d447);_0x1cef82[_0x5219('0x1a')]();})[_0x5219('0x1b')](function(_0x425938){logger[_0x5219('0x1c')]('[%s][TVOX]\x20%s',_0x95dd84,_[_0x5219('0x1d')](_0x425938)?JSON[_0x5219('0xe')](_0x425938):_0x425938);_0x1cef82[_0x5219('0x1a')]();});}else{logger[_0x5219('0x18')](_0x5219('0x1e'),_0x95dd84);_0x1cef82[_0x5219('0x1f')]();}};}; \ No newline at end of file +var _0x9dc9=['?params=','title','2.0','method','login','params','stringify','utf8','POST','then','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','[%s][TVOX]\x20%s','isObject','request-promise','../../../../config/logger','consequence','replace','\x20-\x20','push','urlOnRing'];(function(_0x11fda4,_0x465374){var _0x188e31=function(_0x50e774){while(--_0x50e774){_0x11fda4['push'](_0x11fda4['shift']());}};_0x188e31(++_0x465374);}(_0x9dc9,0xd9));var _0x99dc=function(_0x572374,_0x522d14){_0x572374=_0x572374-0x0;var _0x5ba165=_0x9dc9[_0x572374];return _0x5ba165;};'use strict';var rp=require(_0x99dc('0x0'));var logger=require(_0x99dc('0x1'))('routing');var _=require('lodash');var arr=[];exports[_0x99dc('0x2')]=function(_0x455089,_0x36f366){return function(_0x2851dd){var _0x5be058=_0x36f366[0xa];var _0x4346b1=_0x36f366[0xb];var _0x3aac08=_0x36f366[0xc];var _0x2afb5f=_0x36f366[0xd];var _0x434f7c=_0x36f366[0xe];var _0x57fcbb=_0x36f366[0xf][_0x99dc('0x3')](/\n/g,_0x99dc('0x4'));var _0x323a50=_0x36f366[0x10][_0x99dc('0x3')](/\n/g,'\x20');if(!arr['includes'](_0x4346b1)){arr[_0x99dc('0x5')](_0x4346b1);var _0x227a12=_0x36f366[0x3];var _0x489259=_0x36f366[0x4];var _0x108e25=_0x36f366[0x1];var _0x5eabfa=_0x36f366[0x0];var _0x232887={};_0x232887['urlOnAnswer']=_0x36f366[0x8]+'?params='+_0x3aac08+'|'+_0x5be058+'|'+_0x2afb5f+'|'+_0x4346b1+'|'+_0x434f7c;_0x232887[_0x99dc('0x6')]=_0x36f366[0x7]+_0x99dc('0x7')+_0x3aac08+'|'+_0x5be058+'|'+_0x2afb5f+'|'+_0x4346b1+'|'+_0x434f7c+'|'+_0x57fcbb+'|'+_0x323a50;_0x232887[_0x99dc('0x8')]=_0x36f366[0x9];var _0xd51b34={};_0xd51b34['jsonrpc']=_0x99dc('0x9');_0xd51b34[_0x99dc('0xa')]=_0x99dc('0xb');var _0x1ad5f4=[];_0x1ad5f4[_0x99dc('0x5')](_0x36f366[0x2]);_0x1ad5f4[_0x99dc('0x5')](_0x36f366[0x5]);_0x1ad5f4['push'](_0x36f366[0x6]);_0xd51b34[_0x99dc('0xc')]=_0x1ad5f4;_0xd51b34['id']=0x1;var _0x50dc11=JSON[_0x99dc('0xd')](_0xd51b34);var _0x423057={'encoding':_0x99dc('0xe'),'method':_0x99dc('0xf'),'timeout':0x2710,'url':_0x227a12,'headers':{'Content-Type':'application/json-rpc'},'body':_0x50dc11};return rp(_0x423057)[_0x99dc('0x10')](function(_0x5bc92e){const _0x1b6641=JSON['parse'](_0x5bc92e);if(!_0x1b6641['result'][_0x99dc('0x11')]){throw new Error(_0x99dc('0x12'));}var _0x3d7aca=_0x4346b1;var _0x38c104='channelId='+_0x108e25+_0x99dc('0x13')+_0x5eabfa+_0x99dc('0x14')+_0x3d7aca+_0x99dc('0x15')+JSON[_0x99dc('0xd')](_0x232887);var _0x47fa80=_0x489259+'?'+_0x38c104;return rp(_0x47fa80);})[_0x99dc('0x10')](function(_0x395fff){logger[_0x99dc('0x16')](_0x99dc('0x17'),_0x455089,_0x395fff);_0x2851dd[_0x99dc('0x18')]();})[_0x99dc('0x19')](function(_0x3adf2f){logger['error'](_0x99dc('0x1a'),_0x455089,_[_0x99dc('0x1b')](_0x3adf2f)?JSON[_0x99dc('0xd')](_0x3adf2f):_0x3adf2f);_0x2851dd[_0x99dc('0x18')]();});}else{logger['info']('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x455089);_0x2851dd['next']();}};}; \ 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 3a9c51d..c82b277 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x299620,_0x1252fa){var _0x24cef9=function(_0x3afde3){while(--_0x3afde3){_0x299620['push'](_0x299620['shift']());}};_0x24cef9(++_0x1252fa);}(_0xe706,0xa3));var _0x6e70=function(_0x30662f,_0x4d202e){_0x30662f=_0x30662f-0x0;var _0x40d038=_0xe706[_0x30662f];return _0x40d038;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0x9c44=['merge','body','account','list','exports','render'];(function(_0x157d3b,_0x496a98){var _0x2d94e1=function(_0x5c9367){while(--_0x5c9367){_0x157d3b['push'](_0x157d3b['shift']());}};_0x2d94e1(++_0x496a98);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 69e6349..77e2f13 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 _0x8eeb=['join','app','toLowerCase','autoreply','appdata','split','channel','mail','push','slice','dialogflow','dialogflowv2','amazonlex','TagId','tvox','getMustacheRender','account','notificationTemplate','ContactId','body','condition','intervals','./applications/','consequence','priority','info','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','Applications\x20executed','stringify','matchPath','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','emit','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','uuid','./applications/utils','../../../config/environment','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','interval','rules','message','interaction','applications','isArray','length','existsSync'];(function(_0x3b6a6d,_0x3ba7df){var _0x13268d=function(_0x3f94f1){while(--_0x3f94f1){_0x3b6a6d['push'](_0x3b6a6d['shift']());}};_0x13268d(++_0x3ba7df);}(_0x8eeb,0x183));var _0xb8ee=function(_0x2329ce,_0x2cac79){_0x2329ce=_0x2329ce-0x0;var _0x863b60=_0x8eeb[_0x2329ce];return _0x863b60;};'use strict';var _=require(_0xb8ee('0x0'));var util=require('util');var path=require(_0xb8ee('0x1'));var fs=require('fs');var jayson=require(_0xb8ee('0x2'));var BPromise=require('bluebird');var uuid=require(_0xb8ee('0x3'));var utils=require(_0xb8ee('0x4'));var config=require(_0xb8ee('0x5'));var logger=require(_0xb8ee('0x6'))(_0xb8ee('0x7'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xb8ee('0x8')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0xb8ee('0x9')),'faxQueueReport':require(_0xb8ee('0xa')),'whatsappQueueReport':require(_0xb8ee('0xb'))};var RuleEngine=require(_0xb8ee('0xc'));function getId(_0x4e2428,_0x27243c,_0x11dc1a){return util[_0xb8ee('0xd')]('%s.%s.%s',_0x4e2428,_0x27243c||0x0,_0x11dc1a||0x0);}function getIntervals(_0x1e7242,_0x4bf260){var _0x146167=[];if(!_[_0xb8ee('0xe')](_0x4bf260[_0xb8ee('0xf')])&&!_[_0xb8ee('0xe')](_0x1e7242[_0x4bf260[_0xb8ee('0xf')]])&&!_[_0xb8ee('0xe')](_0x1e7242[_0x4bf260[_0xb8ee('0xf')]][_0xb8ee('0x10')])){_0x146167=_['map'](_0x1e7242[_0x4bf260[_0xb8ee('0xf')]][_0xb8ee('0x10')],_0xb8ee('0x11'));}else if(!_[_0xb8ee('0xe')](_0x4bf260[_0xb8ee('0x11')])){_0x146167=[_0x4bf260[_0xb8ee('0x11')]];}return _0x146167;}exports['listen']=function(_0x237f49){_0x237f49[_0xb8ee('0x12')]={};return new BPromise(function(_0x2af0c5,_0x253c95){var _0x6c405c={'Start':function(_0x19f9c9){var _0x22b97b=this;return new Promise(function(_0x13b79c,_0x40be2d){if(_0x19f9c9){try{var _0x5a3f29=[];var _0x135d5d=getId(_0x19f9c9['channel'],_0x19f9c9['message']?_0x19f9c9[_0xb8ee('0x13')]['id']:0x0,_0x19f9c9[_0xb8ee('0x14')]?_0x19f9c9['interaction']['id']:0x0);if(_0x19f9c9[_0xb8ee('0x15')]&&_[_0xb8ee('0x16')](_0x19f9c9['applications'])&&_0x19f9c9[_0xb8ee('0x15')][_0xb8ee('0x17')]){for(var _0xcd3f98=0x0;_0xcd3f98<_0x19f9c9['applications'][_0xb8ee('0x17')];_0xcd3f98+=0x1){var _0x19739f=_0x19f9c9[_0xb8ee('0x15')][_0xcd3f98];if(fs[_0xb8ee('0x18')](path[_0xb8ee('0x19')](__dirname,'applications',_0x19739f[_0xb8ee('0x1a')]+'.js'))){var _0x35adf8=[];switch(_0x19739f[_0xb8ee('0x1a')][_0xb8ee('0x1b')]()){case _0xb8ee('0x1c'):var _0x17ee68=_0x19739f[_0xb8ee('0x1d')][_0xb8ee('0x1e')](',');if(_0x19f9c9[_0xb8ee('0x1f')]===_0xb8ee('0x20')){_0x35adf8[_0xb8ee('0x21')](_0x17ee68[0x0]);_0x35adf8['push'](_0x17ee68[0x1]);_0x35adf8[_0xb8ee('0x21')](_0x17ee68['slice'](0x2,_0x17ee68['length'])['join'](','));}else{_0x35adf8['push'](_0x17ee68[0x0]);_0x35adf8[_0xb8ee('0x21')](_0x17ee68[_0xb8ee('0x22')](0x1,_0x17ee68[_0xb8ee('0x17')])[_0xb8ee('0x19')](','));}break;case _0xb8ee('0x23'):var _0x33faad=_0x19739f[_0xb8ee('0x1d')][_0xb8ee('0x1e')](',');_0x35adf8['push'](_0x33faad[0x0]);_0x35adf8[_0xb8ee('0x21')](_0x33faad[0x1]);_0x35adf8[_0xb8ee('0x21')](_0x33faad[_0xb8ee('0x22')](0x2,_0x33faad[_0xb8ee('0x17')])['join'](','));break;case _0xb8ee('0x24'):var _0x1a643f=_0x19739f['appdata'][_0xb8ee('0x1e')](',');_0x35adf8[_0xb8ee('0x21')](_0x1a643f[0x0]);_0x35adf8['push'](_0x1a643f[0x1]);_0x35adf8[_0xb8ee('0x21')](_0x1a643f[0x2]);_0x35adf8[_0xb8ee('0x21')](_0x1a643f[0x3]);_0x35adf8[_0xb8ee('0x21')](_0x1a643f['slice'](0x4,_0x1a643f[_0xb8ee('0x17')])[_0xb8ee('0x19')](','));break;case _0xb8ee('0x25'):var _0x57a4e6=_0x19739f['appdata'][_0xb8ee('0x1e')](',');_0x35adf8[_0xb8ee('0x21')](_0x57a4e6[0x0]);_0x35adf8['push'](_0x57a4e6[0x1]);_0x35adf8[_0xb8ee('0x21')](_0x57a4e6[0x2]);_0x35adf8['push'](_0x57a4e6[0x3]);_0x35adf8[_0xb8ee('0x21')](_0x57a4e6['slice'](0x4,_0x57a4e6[_0xb8ee('0x17')])[_0xb8ee('0x19')](','));break;case _0xb8ee('0x13'):_0x35adf8[_0xb8ee('0x21')](_0x19739f[_0xb8ee('0x1d')]);break;case'tag':_0x35adf8['push'](_0x19739f[_0xb8ee('0x26')]);_0x35adf8[_0xb8ee('0x21')](_0x19739f[_0xb8ee('0x1d')]);break;case _0xb8ee('0x27'):var _0x18e300=utils[_0xb8ee('0x28')](_0x19f9c9[_0xb8ee('0x29')][_0xb8ee('0x2a')],_0x19f9c9);var _0xff20d2=_0x19739f[_0xb8ee('0x1d')][_0xb8ee('0x1e')](',');_0x35adf8[_0xb8ee('0x21')](_0xff20d2[0x0]);_0x35adf8[_0xb8ee('0x21')](_0xff20d2[0x1]);_0x35adf8[_0xb8ee('0x21')](_0xff20d2[0x2]);_0x35adf8[_0xb8ee('0x21')](_0xff20d2[0x3]);_0x35adf8[_0xb8ee('0x21')](_0xff20d2[0x4]);_0x35adf8[_0xb8ee('0x21')](_0xff20d2[0x5]);_0x35adf8[_0xb8ee('0x21')](_0xff20d2[0x6]);_0x35adf8[_0xb8ee('0x21')](_0xff20d2[0x7]);_0x35adf8[_0xb8ee('0x21')](_0xff20d2[0x8]);_0x35adf8[_0xb8ee('0x21')](_0xff20d2[0x9]);_0x35adf8[_0xb8ee('0x21')](_0xff20d2[0xa]);_0x35adf8[_0xb8ee('0x21')](_0x19f9c9[_0xb8ee('0x14')]['id']);_0x35adf8[_0xb8ee('0x21')](_0x19f9c9['message']['id']);_0x35adf8[_0xb8ee('0x21')](_0x19739f['ChatWebsiteId']);_0x35adf8[_0xb8ee('0x21')](_0x19f9c9[_0xb8ee('0x14')][_0xb8ee('0x2b')]);_0x35adf8[_0xb8ee('0x21')](_0x19f9c9[_0xb8ee('0x2c')]['body']);_0x35adf8['push'](_0x18e300);break;default:_0x35adf8=_['isNil'](_0x19739f[_0xb8ee('0x1d')])?[]:_0x19739f[_0xb8ee('0x1d')]['split'](',');}var _0xd68f53={'id':util[_0xb8ee('0xd')]('%s:%s:%s',_0x135d5d,_0x19739f['id'],_0x19739f[_0xb8ee('0x1a')]),'condition':require('./interval')[_0xb8ee('0x2d')](_0x135d5d,getIntervals(_0x237f49[_0xb8ee('0x2e')],_0x19739f),_0x237f49),'consequence':require(_0xb8ee('0x2f')+_0x19739f['app'])[_0xb8ee('0x30')](_0x135d5d,_0x35adf8,_0x237f49,_0x19f9c9),'p':_0x19739f[_0xb8ee('0x31')]||0x0};logger[_0xb8ee('0x32')]('Push\x20new\x20rule',_0xd68f53['id'],'on\x20interval',getIntervals(_0x237f49['intervals'],_0x19739f)[_0xb8ee('0x19')](_0xb8ee('0x33')));_0x5a3f29['push'](_0xd68f53);}else{logger[_0xb8ee('0x34')](_0xb8ee('0x35'),path[_0xb8ee('0x19')](__dirname,'applications',_0x19739f[_0xb8ee('0x1a')]+_0xb8ee('0x36')));}}_0x237f49[_0xb8ee('0x12')][_0x135d5d]=new RuleEngine(_0x5a3f29);_0x237f49[_0xb8ee('0x12')][_0x135d5d][_0xb8ee('0x37')](_0x19f9c9,function(_0x41ff6a){logger[_0xb8ee('0x32')](_0xb8ee('0x38'),JSON[_0xb8ee('0x39')](_0x41ff6a[_0xb8ee('0x3a')]));if(_0x237f49[_0xb8ee('0x12')][_0x135d5d]){_0x237f49[_0xb8ee('0x12')][_0x135d5d]['emit'](_0xb8ee('0x3b'));}});return _0x13b79c({'code':0xc8,'message':_0x19f9c9});}else{logger[_0xb8ee('0x32')](_0xb8ee('0x3c'));return _0x13b79c({'code':0xc8,'message':_0x19f9c9});}}catch(_0x39695f){logger[_0xb8ee('0x34')](_0x39695f[_0xb8ee('0x3d')]);return _0x40be2d(_0x22b97b['error'](0x1f4,_0x39695f));}}return _0x40be2d(_0xb8ee('0x3e'));});},'AcceptMessage':function(_0x207426){var _0x58f9c5=this;return new Promise(function(_0x89fe5f,_0x4e6970){if(_0x207426[_0xb8ee('0x3f')]&&_0x207426[_0xb8ee('0x3f')]['id']){if(_0x237f49['agents'][_0x207426[_0xb8ee('0x3f')]['id']]){_0x237f49[_0xb8ee('0x40')][_0x207426[_0xb8ee('0x3f')]['id']][_0xb8ee('0x41')]=![];_0x237f49[_0xb8ee('0x40')][_0x207426[_0xb8ee('0x3f')]['id']]['busyQueue']=undefined;}}if(_0x207426[_0xb8ee('0x13')]&&_0x207426[_0xb8ee('0x13')]['id']){try{var _0x43f8a8=getId(_0x207426[_0xb8ee('0x1f')],_0x207426[_0xb8ee('0x13')]?_0x207426['message']['id']:0x0,_0x207426[_0xb8ee('0x14')]?_0x207426[_0xb8ee('0x14')]['id']:0x0);if(_0x237f49[_0xb8ee('0x12')][_0x43f8a8]){_0x237f49[_0xb8ee('0x12')][_0x43f8a8][_0xb8ee('0x42')](_0xb8ee('0x43'));if(rpc[_0x207426[_0xb8ee('0x1f')]+'QueueReport']){rpc[_0x207426[_0xb8ee('0x1f')]+_0xb8ee('0x44')][_0xb8ee('0x45')](_0x43f8a8,{'UserId':_0x207426[_0xb8ee('0x13')][_0xb8ee('0x46')]})[_0xb8ee('0x47')](function(_0x55ac7c){logger[_0xb8ee('0x34')](_0xb8ee('0x48'));});}}return _0x89fe5f({'code':0xc8,'message':_0x207426});}catch(_0x2e9803){logger[_0xb8ee('0x34')](_0x2e9803[_0xb8ee('0x3d')]);return _0x4e6970(_0x58f9c5[_0xb8ee('0x34')](0x1f4,_0x2e9803));}}logger[_0xb8ee('0x34')](_0xb8ee('0x49'));return _0x4e6970(_0x58f9c5[_0xb8ee('0x34')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x591d0c){var _0x2cb7cd=this;return new Promise(function(_0x592dfc,_0x4ba434){if(_0x591d0c['agent']&&_0x591d0c[_0xb8ee('0x3f')]['id']){try{if(_0x237f49[_0xb8ee('0x40')][_0x591d0c[_0xb8ee('0x3f')]['id']]){_0x237f49['agents'][_0x591d0c[_0xb8ee('0x3f')]['id']][_0xb8ee('0x41')]=![];_0x237f49[_0xb8ee('0x40')][_0x591d0c[_0xb8ee('0x3f')]['id']]['busyQueue']=undefined;}return _0x592dfc({'code':0xc8,'message':_0x591d0c});}catch(_0x3595e0){logger['error'](_0x3595e0['stack']);return _0x4ba434(_0x2cb7cd[_0xb8ee('0x34')](0x1f4,_0x3595e0));}}logger[_0xb8ee('0x34')](_0xb8ee('0x49'));return _0x4ba434(_0x2cb7cd[_0xb8ee('0x34')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x595992){var _0xfb4ff5=this;return new Promise(function(_0x3d2f39,_0x429ad6){if(_0x595992[_0xb8ee('0x1f')]&&_0x595992[_0xb8ee('0x14')]&&_0x595992[_0xb8ee('0x14')]['id']){try{var _0x3d6c0e=getId(_0x595992[_0xb8ee('0x1f')],_0x595992[_0xb8ee('0x13')]?_0x595992['message']['id']:0x0,_0x595992['interaction']?_0x595992['interaction']['id']:0x0);if(_0x237f49[_0xb8ee('0x12')][_0x3d6c0e]){_0x237f49['rules'][_0x3d6c0e][_0xb8ee('0x42')]('end');}return _0x3d2f39({'code':0xc8,'message':_0x595992});}catch(_0x163277){logger[_0xb8ee('0x34')](_0x163277['stack']);return _0x429ad6(_0xfb4ff5[_0xb8ee('0x34')](0x1f4,_0x163277));}}logger[_0xb8ee('0x34')](_0xb8ee('0x49'));return _0x429ad6(_0xfb4ff5[_0xb8ee('0x34')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x157cdd){var _0x2b2e0a=this;return new Promise(function(_0x4f6278,_0x2e532b){if(_0x237f49[_0xb8ee('0x40')][_0xb8ee('0x4a')](_0x157cdd['id'])){for(var _0xd47a77 in _0x157cdd[_0xb8ee('0x4b')]){if(_0x157cdd['capacity'][_0xb8ee('0x4a')](_0xd47a77)){if(_0x237f49['agents'][_0x157cdd['id']][_0xb8ee('0x4a')](_0xd47a77+_0xb8ee('0x4c'))){_0x237f49[_0xb8ee('0x40')][_0x157cdd['id']][_0xd47a77+_0xb8ee('0x4c')]=parseInt(_0x157cdd[_0xb8ee('0x4b')][_0xd47a77],0xa);}}}_0x237f49['agents'][_0x157cdd['id']][_0xb8ee('0x4d')]();return _0x4f6278({'code':0xc8,'message':_0x237f49[_0xb8ee('0x40')][_0x157cdd['id']]});}else{return _0x2e532b(_0x2b2e0a[_0xb8ee('0x34')](0x1f4,_0xb8ee('0x4e')));}});},'Agents':function(_0xf135ac){return new Promise(function(_0x5deab2,_0x26385d){var _0x56ac3a=_[_0xb8ee('0x4f')](_0x237f49[_0xb8ee('0x40')]);_0x5deab2({'count':_0x56ac3a[_0xb8ee('0x17')],'rows':_0x56ac3a});});},'ChatQueues':function(_0x54f461){return new Promise(function(_0x363637,_0x4f6c5d){var _0x3042e1=[];for(var _0x84d15e in _0x237f49[_0xb8ee('0x50')]){if(_0x237f49[_0xb8ee('0x50')][_0xb8ee('0x4a')](_0x84d15e)){var _0x5eeb11=_0x237f49[_0xb8ee('0x50')][_0x84d15e];var _0x14192d={'id':_0x5eeb11['id'],'available':_0x5eeb11[_0xb8ee('0x51')],'loggedIn':_0x5eeb11[_0xb8ee('0x52')],'name':_0x5eeb11[_0xb8ee('0x53')],'paused':_0x5eeb11[_0xb8ee('0x54')],'waiting':_0x5eeb11[_0xb8ee('0x55')]};_0x3042e1[_0xb8ee('0x21')](_0x14192d);}}_0x363637({'count':_0x3042e1[_0xb8ee('0x17')],'rows':_0x3042e1});});},'MailQueues':function(_0x4bcc0f){return new Promise(function(_0xbcd97a,_0x470f98){var _0x711d72=[];for(var _0x3ca650 in _0x237f49['mailQueues']){if(_0x237f49['mailQueues']['hasOwnProperty'](_0x3ca650)){var _0x330aff=_0x237f49[_0xb8ee('0x56')][_0x3ca650];var _0x2ed878={'id':_0x330aff['id'],'available':_0x330aff[_0xb8ee('0x51')],'loggedIn':_0x330aff[_0xb8ee('0x52')],'name':_0x330aff['name'],'paused':_0x330aff[_0xb8ee('0x54')],'waiting':_0x330aff[_0xb8ee('0x55')]};_0x711d72['push'](_0x2ed878);}}_0xbcd97a({'count':_0x711d72['length'],'rows':_0x711d72});});},'OpenchannelQueues':function(_0x10c8e6){return new Promise(function(_0x28e95c,_0x40e81e){var _0x1d5542=[];for(var _0x605c14 in _0x237f49['openchannelQueues']){if(_0x237f49[_0xb8ee('0x57')]['hasOwnProperty'](_0x605c14)){var _0x45f939=_0x237f49[_0xb8ee('0x57')][_0x605c14];var _0x2251ae={'id':_0x45f939['id'],'available':_0x45f939[_0xb8ee('0x51')],'loggedIn':_0x45f939[_0xb8ee('0x52')],'name':_0x45f939[_0xb8ee('0x53')],'paused':_0x45f939[_0xb8ee('0x54')],'waiting':_0x45f939[_0xb8ee('0x55')]};_0x1d5542['push'](_0x2251ae);}}_0x28e95c({'count':_0x1d5542[_0xb8ee('0x17')],'rows':_0x1d5542});});},'SmsQueues':function(_0x418b1f){return new Promise(function(_0x1f6da4,_0xa221d7){var _0xae0acb=[];for(var _0x34fe5b in _0x237f49[_0xb8ee('0x58')]){if(_0x237f49[_0xb8ee('0x58')]['hasOwnProperty'](_0x34fe5b)){var _0x5b94a8=_0x237f49[_0xb8ee('0x58')][_0x34fe5b];var _0x4aed0b={'id':_0x5b94a8['id'],'available':_0x5b94a8[_0xb8ee('0x51')],'loggedIn':_0x5b94a8[_0xb8ee('0x52')],'name':_0x5b94a8[_0xb8ee('0x53')],'paused':_0x5b94a8[_0xb8ee('0x54')],'waiting':_0x5b94a8[_0xb8ee('0x55')]};_0xae0acb['push'](_0x4aed0b);}}_0x1f6da4({'count':_0xae0acb[_0xb8ee('0x17')],'rows':_0xae0acb});});},'FaxQueues':function(_0x23945b){return new Promise(function(_0x38d19c,_0x392d10){var _0x1f2394=[];for(var _0x1d5f58 in _0x237f49[_0xb8ee('0x59')]){if(_0x237f49[_0xb8ee('0x59')][_0xb8ee('0x4a')](_0x1d5f58)){var _0x3cd834=_0x237f49[_0xb8ee('0x59')][_0x1d5f58];var _0x5733c0={'id':_0x3cd834['id'],'available':_0x3cd834[_0xb8ee('0x51')],'loggedIn':_0x3cd834[_0xb8ee('0x52')],'name':_0x3cd834[_0xb8ee('0x53')],'paused':_0x3cd834[_0xb8ee('0x54')],'waiting':_0x3cd834[_0xb8ee('0x55')]};_0x1f2394[_0xb8ee('0x21')](_0x5733c0);}}_0x38d19c({'count':_0x1f2394['length'],'rows':_0x1f2394});});},'WhatsappQueues':function(_0x16d3e9){return new Promise(function(_0x35f5d2,_0x4962d1){var _0x1ec95b=[];for(var _0x1e4140 in _0x237f49[_0xb8ee('0x5a')]){if(_0x237f49['whatsappQueues'][_0xb8ee('0x4a')](_0x1e4140)){var _0x908921=_0x237f49[_0xb8ee('0x5a')][_0x1e4140];var _0x467040={'id':_0x908921['id'],'available':_0x908921[_0xb8ee('0x51')],'loggedIn':_0x908921['loggedIn'],'name':_0x908921[_0xb8ee('0x53')],'paused':_0x908921[_0xb8ee('0x54')],'waiting':_0x908921['waiting']};_0x1ec95b[_0xb8ee('0x21')](_0x467040);}}_0x35f5d2({'count':_0x1ec95b[_0xb8ee('0x17')],'rows':_0x1ec95b});});},'ChatQueuesWaitingInteractions':function(_0x3f5e8d){return new Promise(function(_0x678e7,_0x32117e){var _0x11bce1=_[_0xb8ee('0x4f')](_0x237f49[_0xb8ee('0x5b')]);_0x678e7({'count':_0x11bce1[_0xb8ee('0x17')],'rows':_0x11bce1});});},'MailQueuesWaitingInteractions':function(_0x20a8da){return new Promise(function(_0x5d6449,_0x157b89){var _0x667eb6=_[_0xb8ee('0x4f')](_0x237f49[_0xb8ee('0x5c')]);_0x5d6449({'count':_0x667eb6[_0xb8ee('0x17')],'rows':_0x667eb6});});},'OpenchannelQueuesWaitingInteractions':function(_0x4c7e18){return new Promise(function(_0x546f8d,_0x202d00){var _0xf8fc4a=_['values'](_0x237f49[_0xb8ee('0x5d')]);_0x546f8d({'count':_0xf8fc4a[_0xb8ee('0x17')],'rows':_0xf8fc4a});});},'SmsQueuesWaitingInteractions':function(_0x3b9ce5){return new Promise(function(_0x1364fd,_0x5efff4){var _0x1af63f=_[_0xb8ee('0x4f')](_0x237f49['smsQueuesWaitingInteractions']);_0x1364fd({'count':_0x1af63f[_0xb8ee('0x17')],'rows':_0x1af63f});});},'FaxQueuesWaitingInteractions':function(_0x938306){return new Promise(function(_0x175547,_0x5f0b07){var _0x5164bb=_[_0xb8ee('0x4f')](_0x237f49[_0xb8ee('0x5e')]);_0x175547({'count':_0x5164bb[_0xb8ee('0x17')],'rows':_0x5164bb});});},'WhatsappQueuesWaitingInteractions':function(_0x25ecd5){return new Promise(function(_0x4637b8,_0x54379e){var _0x540e63=_[_0xb8ee('0x4f')](_0x237f49[_0xb8ee('0x5f')]);_0x4637b8({'count':_0x540e63[_0xb8ee('0x17')],'rows':_0x540e63});});}};var _0x5a8565=jayson[_0xb8ee('0x60')](_0x6c405c)[_0xb8ee('0x61')]();_0x5a8565['on'](_0xb8ee('0x34'),function(_0x1037c2){logger[_0xb8ee('0x34')](JSON[_0xb8ee('0x39')](_0x1037c2));return _0x253c95(_0x1037c2);});_0x5a8565[_0xb8ee('0x62')](0x232c,_0xb8ee('0x63'),function(){console[_0xb8ee('0x64')](_0xb8ee('0x65'),0x232c);return _0x2af0c5(_0xb8ee('0x66')+0x232c);});});}; \ No newline at end of file +var _0xcffe=['message\x20is\x20empty','emit','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','uuid','./applications/utils','../../../config/environment','../../../config/logger','routing','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','listen','channel','message','interaction','applications','isArray','length','existsSync','join','app','.js','split','mail','push','slice','dialogflow','appdata','dialogflowv2','tag','TagId','getMustacheRender','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','priority','info','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','Applications\x20executed','matchPath','complete','No\x20applications\x20to\x20execute','stack','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','catch'];(function(_0x5ab735,_0x47e3bf){var _0x1d0fe3=function(_0x3853a7){while(--_0x3853a7){_0x5ab735['push'](_0x5ab735['shift']());}};_0x1d0fe3(++_0x47e3bf);}(_0xcffe,0x1a1));var _0xecff=function(_0x1058ed,_0x109d8d){_0x1058ed=_0x1058ed-0x0;var _0x4e4661=_0xcffe[_0x1058ed];return _0x4e4661;};'use strict';var _=require(_0xecff('0x0'));var util=require(_0xecff('0x1'));var path=require(_0xecff('0x2'));var fs=require('fs');var jayson=require(_0xecff('0x3'));var BPromise=require(_0xecff('0x4'));var uuid=require(_0xecff('0x5'));var utils=require(_0xecff('0x6'));var config=require(_0xecff('0x7'));var logger=require(_0xecff('0x8'))(_0xecff('0x9'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xecff('0xa')),'smsQueueReport':require(_0xecff('0xb')),'faxQueueReport':require(_0xecff('0xc')),'whatsappQueueReport':require(_0xecff('0xd'))};var RuleEngine=require(_0xecff('0xe'));function getId(_0x298c19,_0x1f7386,_0x4d4458){return util[_0xecff('0xf')](_0xecff('0x10'),_0x298c19,_0x1f7386||0x0,_0x4d4458||0x0);}function getIntervals(_0x195b15,_0x20ab4f){var _0x698e40=[];if(!_['isNil'](_0x20ab4f[_0xecff('0x11')])&&!_[_0xecff('0x12')](_0x195b15[_0x20ab4f[_0xecff('0x11')]])&&!_[_0xecff('0x12')](_0x195b15[_0x20ab4f[_0xecff('0x11')]][_0xecff('0x13')])){_0x698e40=_[_0xecff('0x14')](_0x195b15[_0x20ab4f[_0xecff('0x11')]][_0xecff('0x13')],_0xecff('0x15'));}else if(!_[_0xecff('0x12')](_0x20ab4f[_0xecff('0x15')])){_0x698e40=[_0x20ab4f[_0xecff('0x15')]];}return _0x698e40;}exports[_0xecff('0x16')]=function(_0x5495f9){_0x5495f9['rules']={};return new BPromise(function(_0xa26f3d,_0x2e1d6f){var _0x558ecd={'Start':function(_0x35ce1f){var _0x362ed0=this;return new Promise(function(_0x3a7623,_0x596b09){if(_0x35ce1f){try{var _0x52b62f=[];var _0x24abef=getId(_0x35ce1f[_0xecff('0x17')],_0x35ce1f['message']?_0x35ce1f[_0xecff('0x18')]['id']:0x0,_0x35ce1f[_0xecff('0x19')]?_0x35ce1f[_0xecff('0x19')]['id']:0x0);if(_0x35ce1f[_0xecff('0x1a')]&&_[_0xecff('0x1b')](_0x35ce1f[_0xecff('0x1a')])&&_0x35ce1f['applications'][_0xecff('0x1c')]){for(var _0x422bd8=0x0;_0x422bd8<_0x35ce1f[_0xecff('0x1a')][_0xecff('0x1c')];_0x422bd8+=0x1){var _0x49d0e2=_0x35ce1f[_0xecff('0x1a')][_0x422bd8];if(fs[_0xecff('0x1d')](path[_0xecff('0x1e')](__dirname,_0xecff('0x1a'),_0x49d0e2[_0xecff('0x1f')]+_0xecff('0x20')))){var _0x494754=[];switch(_0x49d0e2[_0xecff('0x1f')]['toLowerCase']()){case'autoreply':var _0x2d16f1=_0x49d0e2['appdata'][_0xecff('0x21')](',');if(_0x35ce1f['channel']===_0xecff('0x22')){_0x494754['push'](_0x2d16f1[0x0]);_0x494754[_0xecff('0x23')](_0x2d16f1[0x1]);_0x494754[_0xecff('0x23')](_0x2d16f1['slice'](0x2,_0x2d16f1[_0xecff('0x1c')])[_0xecff('0x1e')](','));}else{_0x494754[_0xecff('0x23')](_0x2d16f1[0x0]);_0x494754[_0xecff('0x23')](_0x2d16f1[_0xecff('0x24')](0x1,_0x2d16f1['length'])['join'](','));}break;case _0xecff('0x25'):var _0x484415=_0x49d0e2[_0xecff('0x26')][_0xecff('0x21')](',');_0x494754[_0xecff('0x23')](_0x484415[0x0]);_0x494754[_0xecff('0x23')](_0x484415[0x1]);_0x494754['push'](_0x484415['slice'](0x2,_0x484415['length'])[_0xecff('0x1e')](','));break;case _0xecff('0x27'):var _0x230d04=_0x49d0e2[_0xecff('0x26')]['split'](',');_0x494754[_0xecff('0x23')](_0x230d04[0x0]);_0x494754[_0xecff('0x23')](_0x230d04[0x1]);_0x494754[_0xecff('0x23')](_0x230d04[0x2]);_0x494754['push'](_0x230d04[0x3]);_0x494754[_0xecff('0x23')](_0x230d04[_0xecff('0x24')](0x4,_0x230d04[_0xecff('0x1c')])[_0xecff('0x1e')](','));break;case'amazonlex':var _0x7e7a6c=_0x49d0e2[_0xecff('0x26')]['split'](',');_0x494754[_0xecff('0x23')](_0x7e7a6c[0x0]);_0x494754[_0xecff('0x23')](_0x7e7a6c[0x1]);_0x494754[_0xecff('0x23')](_0x7e7a6c[0x2]);_0x494754[_0xecff('0x23')](_0x7e7a6c[0x3]);_0x494754['push'](_0x7e7a6c[_0xecff('0x24')](0x4,_0x7e7a6c[_0xecff('0x1c')])[_0xecff('0x1e')](','));break;case'message':_0x494754[_0xecff('0x23')](_0x49d0e2[_0xecff('0x26')]);break;case _0xecff('0x28'):_0x494754[_0xecff('0x23')](_0x49d0e2[_0xecff('0x29')]);_0x494754[_0xecff('0x23')](_0x49d0e2['appdata']);break;case'tvox':var _0x4dd43c=utils[_0xecff('0x2a')](_0x35ce1f['account'][_0xecff('0x2b')],_0x35ce1f);var _0x21411b=_0x49d0e2['appdata'][_0xecff('0x21')](',');_0x494754[_0xecff('0x23')](_0x21411b[0x0]);_0x494754[_0xecff('0x23')](_0x21411b[0x1]);_0x494754['push'](_0x21411b[0x2]);_0x494754[_0xecff('0x23')](_0x21411b[0x3]);_0x494754[_0xecff('0x23')](_0x21411b[0x4]);_0x494754[_0xecff('0x23')](_0x21411b[0x5]);_0x494754['push'](_0x21411b[0x6]);_0x494754[_0xecff('0x23')](_0x21411b[0x7]);_0x494754[_0xecff('0x23')](_0x21411b[0x8]);_0x494754[_0xecff('0x23')](_0x21411b[0x9]);_0x494754[_0xecff('0x23')](_0x21411b[0xa]);_0x494754[_0xecff('0x23')](_0x35ce1f[_0xecff('0x19')]['id']);_0x494754[_0xecff('0x23')](_0x35ce1f[_0xecff('0x18')]['id']);_0x494754[_0xecff('0x23')](_0x49d0e2[_0xecff('0x2c')]);_0x494754[_0xecff('0x23')](_0x35ce1f['interaction'][_0xecff('0x2d')]);_0x494754[_0xecff('0x23')](_0x35ce1f[_0xecff('0x2e')][_0xecff('0x2e')]);_0x494754[_0xecff('0x23')](_0x4dd43c);break;default:_0x494754=_[_0xecff('0x12')](_0x49d0e2[_0xecff('0x26')])?[]:_0x49d0e2[_0xecff('0x26')]['split'](',');}var _0x28141f={'id':util['format'](_0xecff('0x2f'),_0x24abef,_0x49d0e2['id'],_0x49d0e2[_0xecff('0x1f')]),'condition':require(_0xecff('0x30'))[_0xecff('0x31')](_0x24abef,getIntervals(_0x5495f9[_0xecff('0x32')],_0x49d0e2),_0x5495f9),'consequence':require(_0xecff('0x33')+_0x49d0e2[_0xecff('0x1f')])['consequence'](_0x24abef,_0x494754,_0x5495f9,_0x35ce1f),'p':_0x49d0e2[_0xecff('0x34')]||0x0};logger[_0xecff('0x35')]('Push\x20new\x20rule',_0x28141f['id'],'on\x20interval',getIntervals(_0x5495f9[_0xecff('0x32')],_0x49d0e2)[_0xecff('0x1e')](_0xecff('0x36')));_0x52b62f[_0xecff('0x23')](_0x28141f);}else{logger[_0xecff('0x37')](_0xecff('0x38'),path['join'](__dirname,_0xecff('0x1a'),_0x49d0e2[_0xecff('0x1f')]+'.js'));}}_0x5495f9[_0xecff('0x39')][_0x24abef]=new RuleEngine(_0x52b62f);_0x5495f9[_0xecff('0x39')][_0x24abef][_0xecff('0x3a')](_0x35ce1f,function(_0x4402a0){logger[_0xecff('0x35')](_0xecff('0x3b'),JSON['stringify'](_0x4402a0[_0xecff('0x3c')]));if(_0x5495f9[_0xecff('0x39')][_0x24abef]){_0x5495f9[_0xecff('0x39')][_0x24abef]['emit'](_0xecff('0x3d'));}});return _0x3a7623({'code':0xc8,'message':_0x35ce1f});}else{logger[_0xecff('0x35')](_0xecff('0x3e'));return _0x3a7623({'code':0xc8,'message':_0x35ce1f});}}catch(_0x3c73ca){logger['error'](_0x3c73ca[_0xecff('0x3f')]);return _0x596b09(_0x362ed0[_0xecff('0x37')](0x1f4,_0x3c73ca));}}return _0x596b09('routing\x20is\x20empty');});},'AcceptMessage':function(_0x22869d){var _0x1d2ac3=this;return new Promise(function(_0x4ba9e3,_0x1ee5fc){if(_0x22869d['agent']&&_0x22869d[_0xecff('0x40')]['id']){if(_0x5495f9[_0xecff('0x41')][_0x22869d[_0xecff('0x40')]['id']]){_0x5495f9[_0xecff('0x41')][_0x22869d[_0xecff('0x40')]['id']][_0xecff('0x42')]=![];_0x5495f9['agents'][_0x22869d['agent']['id']][_0xecff('0x43')]=undefined;}}if(_0x22869d[_0xecff('0x18')]&&_0x22869d[_0xecff('0x18')]['id']){try{var _0x29ff01=getId(_0x22869d[_0xecff('0x17')],_0x22869d[_0xecff('0x18')]?_0x22869d[_0xecff('0x18')]['id']:0x0,_0x22869d[_0xecff('0x19')]?_0x22869d['interaction']['id']:0x0);if(_0x5495f9[_0xecff('0x39')][_0x29ff01]){_0x5495f9[_0xecff('0x39')][_0x29ff01]['emit'](_0xecff('0x44'));if(rpc[_0x22869d['channel']+_0xecff('0x45')]){rpc[_0x22869d[_0xecff('0x17')]+'QueueReport'][_0xecff('0x46')](_0x29ff01,{'UserId':_0x22869d[_0xecff('0x18')][_0xecff('0x47')]})[_0xecff('0x48')](function(_0x27cc00){logger['error']('error\x20update\x20queue\x20report');});}}return _0x4ba9e3({'code':0xc8,'message':_0x22869d});}catch(_0x198ad6){logger[_0xecff('0x37')](_0x198ad6[_0xecff('0x3f')]);return _0x1ee5fc(_0x1d2ac3[_0xecff('0x37')](0x1f4,_0x198ad6));}}logger[_0xecff('0x37')](_0xecff('0x49'));return _0x1ee5fc(_0x1d2ac3[_0xecff('0x37')](0x1f4,_0xecff('0x49')));});},'RejectMessage':function(_0x9b44d4){var _0x4f9060=this;return new Promise(function(_0x289659,_0x56fed4){if(_0x9b44d4[_0xecff('0x40')]&&_0x9b44d4[_0xecff('0x40')]['id']){try{if(_0x5495f9[_0xecff('0x41')][_0x9b44d4['agent']['id']]){_0x5495f9[_0xecff('0x41')][_0x9b44d4['agent']['id']][_0xecff('0x42')]=![];_0x5495f9['agents'][_0x9b44d4['agent']['id']][_0xecff('0x43')]=undefined;}return _0x289659({'code':0xc8,'message':_0x9b44d4});}catch(_0x5cd819){logger[_0xecff('0x37')](_0x5cd819[_0xecff('0x3f')]);return _0x56fed4(_0x4f9060['error'](0x1f4,_0x5cd819));}}logger[_0xecff('0x37')](_0xecff('0x49'));return _0x56fed4(_0x4f9060[_0xecff('0x37')](0x1f4,_0xecff('0x49')));});},'AbandonInteraction':function(_0x181760){var _0x162938=this;return new Promise(function(_0x74fc77,_0x574c40){if(_0x181760['channel']&&_0x181760[_0xecff('0x19')]&&_0x181760[_0xecff('0x19')]['id']){try{var _0x18ead4=getId(_0x181760[_0xecff('0x17')],_0x181760[_0xecff('0x18')]?_0x181760[_0xecff('0x18')]['id']:0x0,_0x181760[_0xecff('0x19')]?_0x181760[_0xecff('0x19')]['id']:0x0);if(_0x5495f9[_0xecff('0x39')][_0x18ead4]){_0x5495f9[_0xecff('0x39')][_0x18ead4][_0xecff('0x4a')](_0xecff('0x44'));}return _0x74fc77({'code':0xc8,'message':_0x181760});}catch(_0x3f8e22){logger[_0xecff('0x37')](_0x3f8e22['stack']);return _0x574c40(_0x162938['error'](0x1f4,_0x3f8e22));}}logger[_0xecff('0x37')]('message\x20is\x20empty');return _0x574c40(_0x162938['error'](0x1f4,_0xecff('0x49')));});},'AgentCapacity':function(_0x41efbc){var _0x371e6=this;return new Promise(function(_0x48a737,_0x161190){if(_0x5495f9[_0xecff('0x41')][_0xecff('0x4b')](_0x41efbc['id'])){for(var _0x56b445 in _0x41efbc[_0xecff('0x4c')]){if(_0x41efbc['capacity']['hasOwnProperty'](_0x56b445)){if(_0x5495f9[_0xecff('0x41')][_0x41efbc['id']][_0xecff('0x4b')](_0x56b445+_0xecff('0x4d'))){_0x5495f9[_0xecff('0x41')][_0x41efbc['id']][_0x56b445+_0xecff('0x4d')]=parseInt(_0x41efbc[_0xecff('0x4c')][_0x56b445],0xa);}}}_0x5495f9[_0xecff('0x41')][_0x41efbc['id']][_0xecff('0x4e')]();return _0x48a737({'code':0xc8,'message':_0x5495f9[_0xecff('0x41')][_0x41efbc['id']]});}else{return _0x161190(_0x371e6[_0xecff('0x37')](0x1f4,_0xecff('0x4f')));}});},'Agents':function(_0x3dcafd){return new Promise(function(_0x22e778,_0x3042c3){var _0x4d6265=_['values'](_0x5495f9[_0xecff('0x41')]);_0x22e778({'count':_0x4d6265[_0xecff('0x1c')],'rows':_0x4d6265});});},'ChatQueues':function(_0x4c0b1c){return new Promise(function(_0x15be2b,_0xe7f29a){var _0x59857d=[];for(var _0x148c69 in _0x5495f9[_0xecff('0x50')]){if(_0x5495f9[_0xecff('0x50')][_0xecff('0x4b')](_0x148c69)){var _0x20e8ab=_0x5495f9[_0xecff('0x50')][_0x148c69];var _0x485361={'id':_0x20e8ab['id'],'available':_0x20e8ab[_0xecff('0x51')],'loggedIn':_0x20e8ab[_0xecff('0x52')],'name':_0x20e8ab[_0xecff('0x53')],'paused':_0x20e8ab[_0xecff('0x54')],'waiting':_0x20e8ab[_0xecff('0x55')]};_0x59857d['push'](_0x485361);}}_0x15be2b({'count':_0x59857d[_0xecff('0x1c')],'rows':_0x59857d});});},'MailQueues':function(_0x4ca3c0){return new Promise(function(_0x6988b9,_0x3e54b8){var _0x5661b5=[];for(var _0x5988c2 in _0x5495f9['mailQueues']){if(_0x5495f9[_0xecff('0x56')][_0xecff('0x4b')](_0x5988c2)){var _0x1af54d=_0x5495f9['mailQueues'][_0x5988c2];var _0x2b79b3={'id':_0x1af54d['id'],'available':_0x1af54d['available'],'loggedIn':_0x1af54d[_0xecff('0x52')],'name':_0x1af54d[_0xecff('0x53')],'paused':_0x1af54d[_0xecff('0x54')],'waiting':_0x1af54d[_0xecff('0x55')]};_0x5661b5['push'](_0x2b79b3);}}_0x6988b9({'count':_0x5661b5[_0xecff('0x1c')],'rows':_0x5661b5});});},'OpenchannelQueues':function(_0x23aa75){return new Promise(function(_0xb3594f,_0x4dfd1d){var _0x5dd627=[];for(var _0x3aa2d8 in _0x5495f9[_0xecff('0x57')]){if(_0x5495f9['openchannelQueues'][_0xecff('0x4b')](_0x3aa2d8)){var _0x3756fe=_0x5495f9[_0xecff('0x57')][_0x3aa2d8];var _0xe7f2fb={'id':_0x3756fe['id'],'available':_0x3756fe[_0xecff('0x51')],'loggedIn':_0x3756fe['loggedIn'],'name':_0x3756fe['name'],'paused':_0x3756fe[_0xecff('0x54')],'waiting':_0x3756fe[_0xecff('0x55')]};_0x5dd627['push'](_0xe7f2fb);}}_0xb3594f({'count':_0x5dd627['length'],'rows':_0x5dd627});});},'SmsQueues':function(_0xd588df){return new Promise(function(_0x5d1635,_0x1b0ccd){var _0xac26eb=[];for(var _0x5155c1 in _0x5495f9[_0xecff('0x58')]){if(_0x5495f9[_0xecff('0x58')][_0xecff('0x4b')](_0x5155c1)){var _0x3f6444=_0x5495f9[_0xecff('0x58')][_0x5155c1];var _0x11648c={'id':_0x3f6444['id'],'available':_0x3f6444[_0xecff('0x51')],'loggedIn':_0x3f6444[_0xecff('0x52')],'name':_0x3f6444['name'],'paused':_0x3f6444[_0xecff('0x54')],'waiting':_0x3f6444['waiting']};_0xac26eb['push'](_0x11648c);}}_0x5d1635({'count':_0xac26eb[_0xecff('0x1c')],'rows':_0xac26eb});});},'FaxQueues':function(_0x5aa6c7){return new Promise(function(_0x4932ff,_0x3769ff){var _0x16669b=[];for(var _0x8fcddc in _0x5495f9[_0xecff('0x59')]){if(_0x5495f9[_0xecff('0x59')]['hasOwnProperty'](_0x8fcddc)){var _0x46e71c=_0x5495f9[_0xecff('0x59')][_0x8fcddc];var _0x147766={'id':_0x46e71c['id'],'available':_0x46e71c[_0xecff('0x51')],'loggedIn':_0x46e71c[_0xecff('0x52')],'name':_0x46e71c['name'],'paused':_0x46e71c[_0xecff('0x54')],'waiting':_0x46e71c[_0xecff('0x55')]};_0x16669b[_0xecff('0x23')](_0x147766);}}_0x4932ff({'count':_0x16669b[_0xecff('0x1c')],'rows':_0x16669b});});},'WhatsappQueues':function(_0x46ba08){return new Promise(function(_0x4e829b,_0x5a0cea){var _0x29ea01=[];for(var _0x5b6054 in _0x5495f9['whatsappQueues']){if(_0x5495f9[_0xecff('0x5a')]['hasOwnProperty'](_0x5b6054)){var _0xae0c00=_0x5495f9['whatsappQueues'][_0x5b6054];var _0x5ef856={'id':_0xae0c00['id'],'available':_0xae0c00['available'],'loggedIn':_0xae0c00['loggedIn'],'name':_0xae0c00[_0xecff('0x53')],'paused':_0xae0c00[_0xecff('0x54')],'waiting':_0xae0c00[_0xecff('0x55')]};_0x29ea01[_0xecff('0x23')](_0x5ef856);}}_0x4e829b({'count':_0x29ea01[_0xecff('0x1c')],'rows':_0x29ea01});});},'ChatQueuesWaitingInteractions':function(_0x391ea3){return new Promise(function(_0x1bbf7a,_0x385909){var _0x410d73=_[_0xecff('0x5b')](_0x5495f9['chatQueuesWaitingInteractions']);_0x1bbf7a({'count':_0x410d73[_0xecff('0x1c')],'rows':_0x410d73});});},'MailQueuesWaitingInteractions':function(_0x461dfb){return new Promise(function(_0x44e34a,_0x2d77a){var _0x2c07fb=_['values'](_0x5495f9[_0xecff('0x5c')]);_0x44e34a({'count':_0x2c07fb[_0xecff('0x1c')],'rows':_0x2c07fb});});},'OpenchannelQueuesWaitingInteractions':function(_0x19d449){return new Promise(function(_0x4f3e8c,_0xd9787d){var _0x4f2af6=_[_0xecff('0x5b')](_0x5495f9['openchannelQueuesWaitingInteractions']);_0x4f3e8c({'count':_0x4f2af6[_0xecff('0x1c')],'rows':_0x4f2af6});});},'SmsQueuesWaitingInteractions':function(_0x1fd6df){return new Promise(function(_0x2d934a,_0x198b36){var _0x2d3286=_['values'](_0x5495f9[_0xecff('0x5d')]);_0x2d934a({'count':_0x2d3286[_0xecff('0x1c')],'rows':_0x2d3286});});},'FaxQueuesWaitingInteractions':function(_0x537151){return new Promise(function(_0x49c50e,_0x4306f4){var _0x334310=_[_0xecff('0x5b')](_0x5495f9[_0xecff('0x5e')]);_0x49c50e({'count':_0x334310['length'],'rows':_0x334310});});},'WhatsappQueuesWaitingInteractions':function(_0x2eb5b4){return new Promise(function(_0x28e423,_0x581e15){var _0x3f8cd9=_['values'](_0x5495f9['whatsappQueuesWaitingInteractions']);_0x28e423({'count':_0x3f8cd9[_0xecff('0x1c')],'rows':_0x3f8cd9});});}};var _0x49cc1e=jayson[_0xecff('0x5f')](_0x558ecd)[_0xecff('0x60')]();_0x49cc1e['on'](_0xecff('0x37'),function(_0x8cb05f){logger[_0xecff('0x37')](JSON['stringify'](_0x8cb05f));return _0x2e1d6f(_0x8cb05f);});_0x49cc1e['listen'](0x232c,'127.0.0.1',function(){console['log']('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0xa26f3d(_0xecff('0x61')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 58ebcc8..791b1ca 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 _0xd24b=['jayson/promise','../../../config/logger','client','http','then','error','result','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','Command','format','iftime\x20%s','message','indexOf','true','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','catch','log','stop','util'];(function(_0x10d405,_0x28d136){var _0x12bd98=function(_0x3b6cc3){while(--_0x3b6cc3){_0x10d405['push'](_0x10d405['shift']());}};_0x12bd98(++_0x28d136);}(_0xd24b,0x73));var _0xbd24=function(_0xa38daf,_0x30406b){_0xa38daf=_0xa38daf-0x0;var _0x1b786a=_0xd24b[_0xa38daf];return _0x1b786a;};'use strict';var util=require(_0xbd24('0x0'));var BPromise=require('bluebird');var jayson=require(_0xbd24('0x1'));var _=require('lodash');var logger=require(_0xbd24('0x2'))('routing');var client=jayson[_0xbd24('0x3')][_0xbd24('0x4')]({'port':0x232a});function request(_0x300749,_0x3ea439){return new BPromise(function(_0x5663cf,_0x43398e){return client['request'](_0x300749,_0x3ea439)[_0xbd24('0x5')](function(_0xe170cb){if(_0xe170cb[_0xbd24('0x6')]){return _0x43398e(_0xe170cb[_0xbd24('0x6')]['message']);}else{return _0x5663cf(_0xe170cb[_0xbd24('0x7')]);}})['catch'](function(_0x249bb2){return _0x43398e(_0x249bb2);});});}exports[_0xbd24('0x8')]=function(_0x398f5b,_0x5c1cf3,_0x139190){return function(_0x4e9eec){if(_0x139190[_0xbd24('0x9')]&&!_0x139190[_0xbd24('0x9')][_0x398f5b]){logger[_0xbd24('0xa')](_0xbd24('0xb'),_0x398f5b);return _0x4e9eec['stop']();}var _0x301e43=[];for(var _0x1a9c72=0x0;_0x1a9c72<_0x5c1cf3[_0xbd24('0xc')];_0x1a9c72+=0x1){_0x301e43[_0xbd24('0xd')](request(_0xbd24('0xe'),{'command':util[_0xbd24('0xf')](_0xbd24('0x10'),_0x5c1cf3[_0x1a9c72])})['then'](function(_0x141138){return _0x141138&&_0x141138['message']&&_0x141138[_0xbd24('0x11')][_0xbd24('0x12')](_0xbd24('0x13'))>=0x0?!![]:![];})['catch'](function(_0x5176ed){logger[_0xbd24('0x6')](_0xbd24('0x14'),_0x398f5b,_0x5c1cf3[_0x1a9c72]);}));}BPromise[_0xbd24('0x15')](_0x301e43)['then'](function(_0x13624d){var _0x1ba7fc=_['some'](_0x13624d);logger[_0xbd24('0xa')](_0xbd24('0x16'),_0x398f5b,_0x5c1cf3[_0xbd24('0x17')](_0xbd24('0x18')),_0x1ba7fc);_0x4e9eec[_0xbd24('0x19')](_0x1ba7fc);})[_0xbd24('0x1a')](function(_0x31b9c3){console[_0xbd24('0x1b')](_0x31b9c3);logger['error'](_0xbd24('0x16'),_0x398f5b,_0x5c1cf3['join'](_0xbd24('0x18')),_0x31b9c3['stack']);_0x4e9eec[_0xbd24('0x1c')]();});};}; \ No newline at end of file +var _0x6191=['[%s][INTERVAL]\x20%s','all','some','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','stop','util','bluebird','lodash','../../../config/logger','routing','client','http','request','then','error','result','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','Command','format','message','catch'];(function(_0x559bfb,_0x4e4c7e){var _0x4b8e10=function(_0x54479c){while(--_0x54479c){_0x559bfb['push'](_0x559bfb['shift']());}};_0x4b8e10(++_0x4e4c7e);}(_0x6191,0x17f));var _0x1619=function(_0x1558ab,_0x39d1de){_0x1558ab=_0x1558ab-0x0;var _0x53b64a=_0x6191[_0x1558ab];return _0x53b64a;};'use strict';var util=require(_0x1619('0x0'));var BPromise=require(_0x1619('0x1'));var jayson=require('jayson/promise');var _=require(_0x1619('0x2'));var logger=require(_0x1619('0x3'))(_0x1619('0x4'));var client=jayson[_0x1619('0x5')][_0x1619('0x6')]({'port':0x232a});function request(_0x3492ec,_0x216c1b){return new BPromise(function(_0x2bdf7b,_0x36c56e){return client[_0x1619('0x7')](_0x3492ec,_0x216c1b)[_0x1619('0x8')](function(_0x27ce2e){if(_0x27ce2e['error']){return _0x36c56e(_0x27ce2e[_0x1619('0x9')]['message']);}else{return _0x2bdf7b(_0x27ce2e[_0x1619('0xa')]);}})['catch'](function(_0x5ac575){return _0x36c56e(_0x5ac575);});});}exports[_0x1619('0xb')]=function(_0x4355e4,_0xcb0c42,_0x2c77e7){return function(_0x557f0c){if(_0x2c77e7[_0x1619('0xc')]&&!_0x2c77e7[_0x1619('0xc')][_0x4355e4]){logger['info'](_0x1619('0xd'),_0x4355e4);return _0x557f0c['stop']();}var _0x14cf61=[];for(var _0x4d7756=0x0;_0x4d7756<_0xcb0c42[_0x1619('0xe')];_0x4d7756+=0x1){_0x14cf61[_0x1619('0xf')](request(_0x1619('0x10'),{'command':util[_0x1619('0x11')]('iftime\x20%s',_0xcb0c42[_0x4d7756])})[_0x1619('0x8')](function(_0x2470e1){return _0x2470e1&&_0x2470e1[_0x1619('0x12')]&&_0x2470e1[_0x1619('0x12')]['indexOf']('true')>=0x0?!![]:![];})[_0x1619('0x13')](function(_0x4f181d){logger[_0x1619('0x9')](_0x1619('0x14'),_0x4355e4,_0xcb0c42[_0x4d7756]);}));}BPromise[_0x1619('0x15')](_0x14cf61)[_0x1619('0x8')](function(_0x359fb4){var _0x25357c=_[_0x1619('0x16')](_0x359fb4);logger[_0x1619('0x17')](_0x1619('0x18'),_0x4355e4,_0xcb0c42[_0x1619('0x19')](_0x1619('0x1a')),_0x25357c);_0x557f0c[_0x1619('0x1b')](_0x25357c);})[_0x1619('0x13')](function(_0x293666){console[_0x1619('0x1c')](_0x293666);logger[_0x1619('0x9')](_0x1619('0x18'),_0x4355e4,_0xcb0c42['join']('\x20|\x20'),_0x293666[_0x1619('0x1d')]);_0x557f0c[_0x1619('0x1e')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 94bff0d..1e13f7c 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 _0xfe57=['agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','now','timeout','reason','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','holdtime','agentconnect','connectedlinename','connect','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','[%s][agents][blindtransfer]','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','splice','agent','lodash','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','type','agentcomplete','acw','agentacw','CreateVoiceAgentReport','request','agentcalled','destuniqueid','agentcalledAt','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error'];(function(_0x553eca,_0xaa129a){var _0x221d37=function(_0x2d3981){while(--_0x2d3981){_0x553eca['push'](_0x553eca['shift']());}};_0x221d37(++_0xaa129a);}(_0xfe57,0x195));var _0x7fe5=function(_0x5cbf0e,_0x4cd140){_0x5cbf0e=_0x5cbf0e-0x0;var _0x1c76f8=_0xfe57[_0x5cbf0e];return _0x1c76f8;};'use strict';var _=require(_0x7fe5('0x0'));var util=require(_0x7fe5('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x581f71,_0x3f7dca){utils[_0x7fe5('0x2')](util[_0x7fe5('0x3')](_0x7fe5('0x4'),_0x581f71[_0x7fe5('0x5')],_0x581f71[_0x7fe5('0x6')],_0x581f71[_0x7fe5('0x7')],_0x581f71[_0x7fe5('0x8')],_0x581f71[_0x7fe5('0x9')],_0x581f71[_0x7fe5('0xa')],_0x581f71[_0x7fe5('0xb')],_0x581f71[_0x7fe5('0xc')]));if(_0x581f71[_0x7fe5('0x7')]){utils['getVoiceQueueByName'](_0x581f71[_0x7fe5('0x7')])['then'](function(_0x3564f1){if(_0x3564f1){_0x581f71[_0x7fe5('0xd')]=_0x3564f1['type'];_0x581f71['agentacw']=_0x581f71[_0x7fe5('0xe')]?_0x3564f1[_0x7fe5('0xf')]:![];_0x581f71['acwtime']=_0x581f71[_0x7fe5('0x10')]?_0x3564f1['acwTimeout']:0x0;}utils['request'](_0x7fe5('0x11'),_0x581f71);});}else{utils[_0x7fe5('0x12')](_0x7fe5('0x11'),_0x581f71);}if(_0x3f7dca){delete transfers[_0x581f71[_0x7fe5('0x5')]];}else{delete agents[_0x581f71['destuniqueid']];}}exports[_0x7fe5('0x13')]=function(_0x16bed9){try{utils['debug'](util[_0x7fe5('0x3')]('[%s][agents][agentcalled]',_0x16bed9[_0x7fe5('0x5')]),_0x16bed9);agents[_0x16bed9[_0x7fe5('0x14')]]=_0x16bed9;agents[_0x16bed9['destuniqueid']][_0x7fe5('0x15')]=utils['now']();agents[_0x16bed9[_0x7fe5('0x14')]][_0x7fe5('0xc')]=_0x7fe5('0x16');agents[_0x16bed9[_0x7fe5('0x14')]][_0x7fe5('0xb')]=null;agents[_0x16bed9[_0x7fe5('0x14')]]['connectedlinename']=null;utils[_0x7fe5('0x2')](util[_0x7fe5('0x3')](_0x7fe5('0x17'),_0x16bed9[_0x7fe5('0x5')],agents[_0x16bed9[_0x7fe5('0x14')]][_0x7fe5('0x8')],_0x16bed9[_0x7fe5('0x14')]));}catch(_0x29b0bd){utils[_0x7fe5('0x18')](util[_0x7fe5('0x3')]('[%s][agents][agentcalled]',_0x16bed9['uniqueid']),_0x29b0bd);}};exports[_0x7fe5('0x19')]=function(_0x459c2d){try{if(!_[_0x7fe5('0x1a')](agents[_0x459c2d[_0x7fe5('0x14')]])){utils[_0x7fe5('0x1b')](util[_0x7fe5('0x3')](_0x7fe5('0x1c'),_0x459c2d[_0x7fe5('0x5')]),_0x459c2d);utils[_0x7fe5('0x2')](util[_0x7fe5('0x3')](_0x7fe5('0x1d'),_0x459c2d[_0x7fe5('0x5')],agents[_0x459c2d['destuniqueid']][_0x7fe5('0x8')],_0x459c2d[_0x7fe5('0x14')]));agents[_0x459c2d[_0x7fe5('0x14')]]['agentringnoanswer']=!![];agents[_0x459c2d[_0x7fe5('0x14')]]['agentringnoanswerAt']=utils[_0x7fe5('0x1e')]();agents[_0x459c2d['destuniqueid']][_0x7fe5('0xc')]=_0x7fe5('0x1f');agents[_0x459c2d[_0x7fe5('0x14')]][_0x7fe5('0x20')]=_0x7fe5('0x1f');agents[_0x459c2d[_0x7fe5('0x14')]]['holdtime']=_0x459c2d['ringtime']?parseInt(_0x459c2d[_0x7fe5('0x21')])/0x3e8:0x0;agents[_0x459c2d[_0x7fe5('0x14')]][_0x7fe5('0x22')]=0x0;unanswered[_0x7fe5('0x23')](_0x459c2d['destuniqueid']);}}catch(_0x46f816){utils['error'](util[_0x7fe5('0x3')](_0x7fe5('0x1c'),_0x459c2d[_0x7fe5('0x5')]),_0x46f816);}};exports[_0x7fe5('0x24')]=function(_0x1f8572){try{_[_0x7fe5('0x25')](agents,function(_0x5c07f0,_0xe521c6){if(_0x5c07f0[_0x7fe5('0x5')]==_0x1f8572['uniqueid']&&!_[_0x7fe5('0x26')](unanswered,_0x5c07f0[_0x7fe5('0x14')])){utils[_0x7fe5('0x1b')](util[_0x7fe5('0x3')](_0x7fe5('0x27'),_0x1f8572['uniqueid']),_0x1f8572);utils['info'](util[_0x7fe5('0x3')](_0x7fe5('0x28'),_0x1f8572[_0x7fe5('0x5')],_0x5c07f0[_0x7fe5('0x8')],_0x5c07f0['destuniqueid']));_0x5c07f0[_0x7fe5('0x19')]=!![];_0x5c07f0[_0x7fe5('0x29')]=utils[_0x7fe5('0x1e')]();_0x5c07f0[_0x7fe5('0xc')]=_0x7fe5('0x2a');_0x5c07f0[_0x7fe5('0x20')]='abandoned';_0x5c07f0[_0x7fe5('0x2b')]=_0x1f8572[_0x7fe5('0x2b')];_0x5c07f0[_0x7fe5('0x22')]=0x0;writeDB(_0x5c07f0);}});}catch(_0x39cfe9){utils['error'](util['format'](_0x7fe5('0x27'),_0x1f8572['uniqueid']),_0x39cfe9);}};exports[_0x7fe5('0x2c')]=function(_0x513680){try{if(agents[_0x513680[_0x7fe5('0x14')]]){utils['debug'](util['format']('[%s][agents][agentconnect]',_0x513680['uniqueid']),_0x513680);utils[_0x7fe5('0x2')](util[_0x7fe5('0x3')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x513680[_0x7fe5('0x5')],agents[_0x513680[_0x7fe5('0x14')]]['membername'],_0x513680[_0x7fe5('0x14')]));agents[_0x513680['destuniqueid']]['agentconnectAt']=utils[_0x7fe5('0x1e')]();agents[_0x513680[_0x7fe5('0x14')]][_0x7fe5('0xb')]=_0x513680[_0x7fe5('0xb')];agents[_0x513680[_0x7fe5('0x14')]]['connectedlinename']=_0x513680[_0x7fe5('0x2d')];agents[_0x513680[_0x7fe5('0x14')]]['holdtime']=_0x513680[_0x7fe5('0x21')];agents[_0x513680[_0x7fe5('0x14')]][_0x7fe5('0xc')]=_0x7fe5('0x2e');_[_0x7fe5('0x25')](agents,function(_0x1c81c8,_0x1a14e3){if(_0x1c81c8['destuniqueid']!=_0x513680['destuniqueid']&&_0x1c81c8[_0x7fe5('0x5')]==_0x513680['uniqueid']){_0x1c81c8[_0x7fe5('0x22')]=0x0;_0x1c81c8[_0x7fe5('0x2b')]=_0x513680['ringtime'];_0x1c81c8[_0x7fe5('0x19')]=!![];_0x1c81c8[_0x7fe5('0x29')]=utils[_0x7fe5('0x1e')]();_0x1c81c8[_0x7fe5('0xc')]=_0x7fe5('0x2f');_0x1c81c8[_0x7fe5('0x20')]=_0x7fe5('0x2f');_0x1c81c8['answeredelsewheredestinationuniqueid']=_0x513680['destuniqueid'];_0x1c81c8[_0x7fe5('0x30')]=_0x513680['membername'];writeDB(_0x1c81c8);}});}}catch(_0xad0b05){utils[_0x7fe5('0x18')](util[_0x7fe5('0x3')](_0x7fe5('0x31'),_0x513680['uniqueid']),_0xad0b05);}};exports[_0x7fe5('0xe')]=function(_0x5439bc){try{if(!_['isNil'](agents[_0x5439bc[_0x7fe5('0x14')]])){utils[_0x7fe5('0x1b')](util['format'](_0x7fe5('0x32'),_0x5439bc[_0x7fe5('0x5')]),_0x5439bc);utils[_0x7fe5('0x2')](util[_0x7fe5('0x3')](_0x7fe5('0x33'),_0x5439bc['uniqueid'],agents[_0x5439bc[_0x7fe5('0x14')]][_0x7fe5('0x8')],_0x5439bc['destuniqueid']));agents[_0x5439bc[_0x7fe5('0x14')]][_0x7fe5('0xe')]=!![];agents[_0x5439bc[_0x7fe5('0x14')]][_0x7fe5('0x34')]=utils['now']();agents[_0x5439bc[_0x7fe5('0x14')]][_0x7fe5('0x22')]=utils[_0x7fe5('0x35')](agents[_0x5439bc['destuniqueid']][_0x7fe5('0x34')],agents[_0x5439bc[_0x7fe5('0x14')]][_0x7fe5('0x36')]);agents[_0x5439bc['destuniqueid']][_0x7fe5('0x20')]=_0x5439bc[_0x7fe5('0x20')];agents[_0x5439bc[_0x7fe5('0x14')]]['lastevent']=_0x7fe5('0x37');writeDB(agents[_0x5439bc[_0x7fe5('0x14')]]);}}catch(_0x1ac93a){utils[_0x7fe5('0x18')](util[_0x7fe5('0x3')](_0x7fe5('0x32'),_0x5439bc[_0x7fe5('0x5')]),_0x1ac93a);}};exports[_0x7fe5('0x38')]=function(_0x446f01){try{if(!_[_0x7fe5('0x1a')](agents[_0x446f01[_0x7fe5('0x39')]])){utils['debug'](util['format']('[%s][agents][blindtransfer]',_0x446f01['uniqueid']),_0x446f01);utils[_0x7fe5('0x2')](util['format'](_0x7fe5('0x3a'),_0x446f01[_0x7fe5('0x5')],agents[_0x446f01[_0x7fe5('0x39')]][_0x7fe5('0x8')],agents[_0x446f01[_0x7fe5('0x39')]]['uniqueid']));agents[_0x446f01[_0x7fe5('0x39')]][_0x7fe5('0x3b')]=!![];agents[_0x446f01[_0x7fe5('0x39')]][_0x7fe5('0x3c')]=_0x7fe5('0x3d');agents[_0x446f01[_0x7fe5('0x39')]][_0x7fe5('0x3e')]=_0x446f01[_0x7fe5('0x3f')];agents[_0x446f01[_0x7fe5('0x39')]][_0x7fe5('0x40')]=agents[_0x446f01['transfereruniqueid']][_0x7fe5('0x5')];}}catch(_0x401d05){utils[_0x7fe5('0x18')](util[_0x7fe5('0x3')](_0x7fe5('0x41'),_0x446f01[_0x7fe5('0x5')]),_0x401d05);}};exports['attendedtransfer']=function(_0x31a196){try{utils[_0x7fe5('0x1b')](util[_0x7fe5('0x3')](_0x7fe5('0x42'),_0x31a196[_0x7fe5('0x43')]),_0x31a196);if(_0x31a196[_0x7fe5('0x43')]==_0x31a196[_0x7fe5('0x44')]){if(!_['isNil'](agents[_0x31a196[_0x7fe5('0x45')]])){utils[_0x7fe5('0x2')](util[_0x7fe5('0x3')](_0x7fe5('0x46'),_0x31a196[_0x7fe5('0x43')],agents[_0x31a196['secondtransfereruniqueid']][_0x7fe5('0x8')]));agents[_0x31a196[_0x7fe5('0x45')]][_0x7fe5('0x3b')]=!![];agents[_0x31a196[_0x7fe5('0x45')]]['transfertype']=_0x7fe5('0x47');agents[_0x31a196[_0x7fe5('0x45')]][_0x7fe5('0x3e')]=_0x31a196[_0x7fe5('0x48')];agents[_0x31a196[_0x7fe5('0x45')]][_0x7fe5('0x40')]=_0x31a196[_0x7fe5('0x43')];}if(_0x31a196[_0x7fe5('0x49')]&&agents[_0x31a196[_0x7fe5('0x49')]]){agents[_0x31a196[_0x7fe5('0x49')]][_0x7fe5('0x4a')]=0x1;transfers[_0x31a196['transfereeuniqueid']]=_[_0x7fe5('0x4b')](agents[_0x31a196[_0x7fe5('0x49')]]);transfers[_0x31a196[_0x7fe5('0x49')]]['calleridnum']=agents[_0x31a196['secondtransfereruniqueid']][_0x7fe5('0xa')];transfers[_0x31a196['transfereeuniqueid']][_0x7fe5('0x4c')]=agents[_0x31a196[_0x7fe5('0x45')]]['calleridname'];transfers[_0x31a196[_0x7fe5('0x49')]]['agentcalledAt']=utils[_0x7fe5('0x1e')]();transfers[_0x31a196[_0x7fe5('0x49')]][_0x7fe5('0x36')]=utils[_0x7fe5('0x1e')]();transfers[_0x31a196[_0x7fe5('0x49')]][_0x7fe5('0x2b')]=0x0;transfers[_0x31a196['transfereeuniqueid']]['agententerreason']=0x2;}}else if(_0x31a196[_0x7fe5('0x45')]==_0x31a196[_0x7fe5('0x4d')]){if(!_[_0x7fe5('0x1a')](agents[_0x31a196[_0x7fe5('0x43')]])){utils[_0x7fe5('0x2')](util['format'](_0x7fe5('0x46'),_0x31a196[_0x7fe5('0x43')],agents[_0x31a196[_0x7fe5('0x43')]][_0x7fe5('0x8')]));agents[_0x31a196[_0x7fe5('0x43')]]['transfer']=!![];agents[_0x31a196[_0x7fe5('0x43')]][_0x7fe5('0x3c')]=_0x7fe5('0x47');agents[_0x31a196[_0x7fe5('0x43')]][_0x7fe5('0x3e')]=_0x31a196[_0x7fe5('0x4e')];agents[_0x31a196[_0x7fe5('0x43')]]['transferuniqueid']=_0x31a196[_0x7fe5('0x45')];}if(_0x31a196[_0x7fe5('0x4f')]&&agents[_0x31a196[_0x7fe5('0x4f')]]){agents[_0x31a196[_0x7fe5('0x4f')]][_0x7fe5('0x4a')]=0x1;transfers[_0x31a196[_0x7fe5('0x4f')]]=_[_0x7fe5('0x4b')](agents[_0x31a196['transfertargetuniqueid']]);transfers[_0x31a196['transfertargetuniqueid']][_0x7fe5('0xa')]=agents[_0x31a196['origtransfereruniqueid']][_0x7fe5('0xa')];transfers[_0x31a196['transfertargetuniqueid']][_0x7fe5('0x4c')]=agents[_0x31a196[_0x7fe5('0x43')]][_0x7fe5('0x4c')];transfers[_0x31a196[_0x7fe5('0x4f')]][_0x7fe5('0x15')]=utils[_0x7fe5('0x1e')]();transfers[_0x31a196[_0x7fe5('0x4f')]][_0x7fe5('0x36')]=utils['now']();transfers[_0x31a196[_0x7fe5('0x4f')]]['holdtime']=0x0;transfers[_0x31a196[_0x7fe5('0x4f')]][_0x7fe5('0x4a')]=0x2;}}}catch(_0x36ac40){utils['error'](util[_0x7fe5('0x3')](_0x7fe5('0x42'),_0x31a196[_0x7fe5('0x43')]),_0x36ac40);}};exports[_0x7fe5('0x50')]=function(_0x31404b){try{utils[_0x7fe5('0x1b')](util['format'](_0x7fe5('0x51'),_0x31404b[_0x7fe5('0x5')]),_0x31404b);if(agents[_0x31404b['uniqueid']]&&agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x20')]==='timeout'){if(_0x31404b[_0x7fe5('0x52')]==='21'){agents[_0x31404b['uniqueid']][_0x7fe5('0x20')]=_0x7fe5('0x53');agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0xc')]=_0x7fe5('0x53');}utils['info'](util[_0x7fe5('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x31404b[_0x7fe5('0x5')],agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x8')],agents[_0x31404b[_0x7fe5('0x5')]]['reason'],agents[_0x31404b[_0x7fe5('0x5')]]['lastevent']));writeDB(agents[_0x31404b[_0x7fe5('0x5')]]);var _0x2e3b94=unanswered['indexOf'](_0x31404b[_0x7fe5('0x5')]);if(_0x2e3b94>-0x1){unanswered[_0x7fe5('0x54')](_0x2e3b94,0x1);}}if(transfers[_0x31404b['uniqueid']]){transfers[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0xe')]=!![];transfers[_0x31404b[_0x7fe5('0x5')]]['agentcompleteAt']=utils[_0x7fe5('0x1e')]();transfers[_0x31404b[_0x7fe5('0x5')]]['talktime']=utils[_0x7fe5('0x35')](transfers[_0x31404b[_0x7fe5('0x5')]]['agentcompleteAt'],transfers[_0x31404b[_0x7fe5('0x5')]]['agentconnectAt']);transfers[_0x31404b['uniqueid']][_0x7fe5('0x20')]=_0x7fe5('0x55');transfers[_0x31404b['uniqueid']]['lastevent']=_0x7fe5('0x37');utils['info'](util[_0x7fe5('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x31404b[_0x7fe5('0x5')],transfers[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x8')],transfers[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x20')],transfers[_0x31404b['uniqueid']][_0x7fe5('0xc')]));writeDB(transfers[_0x31404b[_0x7fe5('0x5')]],!![]);}if(agents[_0x31404b[_0x7fe5('0x5')]]&&agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x36')]){agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0xe')]=!![];agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x34')]=utils[_0x7fe5('0x1e')]();agents[_0x31404b['uniqueid']][_0x7fe5('0x22')]=utils[_0x7fe5('0x35')](agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x34')],agents[_0x31404b[_0x7fe5('0x5')]]['agentconnectAt']);agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x20')]=agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x3b')]?_0x7fe5('0x3b'):_0x7fe5('0x55');agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0xc')]=_0x7fe5('0x37');utils[_0x7fe5('0x2')](util[_0x7fe5('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x31404b[_0x7fe5('0x5')],agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x8')],agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x20')],agents[_0x31404b['uniqueid']][_0x7fe5('0xc')]));writeDB(agents[_0x31404b[_0x7fe5('0x5')]]);}}catch(_0x226ada){utils['error'](util['format']('[%s][agents][hangup]',_0x31404b[_0x7fe5('0x5')]),_0x226ada);}}; \ No newline at end of file +var _0x97c1=['connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','now','reason','holdtime','ringtime','talktime','push','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]','agentconnectAt','connect','forIn','agentringnoanswerAt','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','agentcompleteAt','complete','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','extension','transferuniqueid','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','calleridname','agentcalledAt','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','lodash','util','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','calleridnum','connectedlinenum','lastevent','then','type','agentacw','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','called'];(function(_0x47bde8,_0x588d82){var _0x2974c3=function(_0x3b5558){while(--_0x3b5558){_0x47bde8['push'](_0x47bde8['shift']());}};_0x2974c3(++_0x588d82);}(_0x97c1,0xdf));var _0x197c=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x97c1[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x5e2e81,_0x498f9c){utils['info'](util[_0x197c('0x2')](_0x197c('0x3'),_0x5e2e81[_0x197c('0x4')],_0x5e2e81[_0x197c('0x5')],_0x5e2e81[_0x197c('0x6')],_0x5e2e81['membername'],_0x5e2e81['interface'],_0x5e2e81[_0x197c('0x7')],_0x5e2e81[_0x197c('0x8')],_0x5e2e81[_0x197c('0x9')]));if(_0x5e2e81[_0x197c('0x6')]){utils['getVoiceQueueByName'](_0x5e2e81['queue'])[_0x197c('0xa')](function(_0x5cffb8){if(_0x5cffb8){_0x5e2e81[_0x197c('0xb')]=_0x5cffb8[_0x197c('0xb')];_0x5e2e81[_0x197c('0xc')]=_0x5e2e81[_0x197c('0xd')]?_0x5cffb8['acw']:![];_0x5e2e81[_0x197c('0xe')]=_0x5e2e81[_0x197c('0xc')]?_0x5cffb8[_0x197c('0xf')]:0x0;}utils[_0x197c('0x10')](_0x197c('0x11'),_0x5e2e81);});}else{utils['request'](_0x197c('0x11'),_0x5e2e81);}if(_0x498f9c){delete transfers[_0x5e2e81[_0x197c('0x4')]];}else{delete agents[_0x5e2e81[_0x197c('0x12')]];}}exports[_0x197c('0x13')]=function(_0x567658){try{utils[_0x197c('0x14')](util[_0x197c('0x2')](_0x197c('0x15'),_0x567658[_0x197c('0x4')]),_0x567658);agents[_0x567658[_0x197c('0x12')]]=_0x567658;agents[_0x567658[_0x197c('0x12')]]['agentcalledAt']=utils['now']();agents[_0x567658[_0x197c('0x12')]][_0x197c('0x9')]=_0x197c('0x16');agents[_0x567658[_0x197c('0x12')]][_0x197c('0x8')]=null;agents[_0x567658[_0x197c('0x12')]][_0x197c('0x17')]=null;utils[_0x197c('0x18')](util['format'](_0x197c('0x19'),_0x567658['uniqueid'],agents[_0x567658['destuniqueid']][_0x197c('0x1a')],_0x567658[_0x197c('0x12')]));}catch(_0x2eca5e){utils[_0x197c('0x1b')](util['format'](_0x197c('0x15'),_0x567658[_0x197c('0x4')]),_0x2eca5e);}};exports[_0x197c('0x1c')]=function(_0x5c278a){try{if(!_[_0x197c('0x1d')](agents[_0x5c278a[_0x197c('0x12')]])){utils[_0x197c('0x14')](util[_0x197c('0x2')](_0x197c('0x1e'),_0x5c278a[_0x197c('0x4')]),_0x5c278a);utils[_0x197c('0x18')](util[_0x197c('0x2')](_0x197c('0x1f'),_0x5c278a[_0x197c('0x4')],agents[_0x5c278a[_0x197c('0x12')]][_0x197c('0x1a')],_0x5c278a[_0x197c('0x12')]));agents[_0x5c278a[_0x197c('0x12')]][_0x197c('0x1c')]=!![];agents[_0x5c278a[_0x197c('0x12')]]['agentringnoanswerAt']=utils[_0x197c('0x20')]();agents[_0x5c278a[_0x197c('0x12')]][_0x197c('0x9')]='timeout';agents[_0x5c278a[_0x197c('0x12')]][_0x197c('0x21')]='timeout';agents[_0x5c278a['destuniqueid']][_0x197c('0x22')]=_0x5c278a['ringtime']?parseInt(_0x5c278a[_0x197c('0x23')])/0x3e8:0x0;agents[_0x5c278a[_0x197c('0x12')]][_0x197c('0x24')]=0x0;unanswered[_0x197c('0x25')](_0x5c278a[_0x197c('0x12')]);}}catch(_0x3cdcd8){utils[_0x197c('0x1b')](util[_0x197c('0x2')](_0x197c('0x1e'),_0x5c278a['uniqueid']),_0x3cdcd8);}};exports['queuecallerabandon']=function(_0x574274){try{_['forIn'](agents,function(_0x5f7425,_0x4c9256){if(_0x5f7425[_0x197c('0x4')]==_0x574274[_0x197c('0x4')]&&!_['includes'](unanswered,_0x5f7425[_0x197c('0x12')])){utils['debug'](util[_0x197c('0x2')](_0x197c('0x26'),_0x574274[_0x197c('0x4')]),_0x574274);utils[_0x197c('0x18')](util[_0x197c('0x2')](_0x197c('0x27'),_0x574274[_0x197c('0x4')],_0x5f7425[_0x197c('0x1a')],_0x5f7425[_0x197c('0x12')]));_0x5f7425['agentringnoanswer']=!![];_0x5f7425['agentringnoanswerAt']=utils[_0x197c('0x20')]();_0x5f7425[_0x197c('0x9')]=_0x197c('0x28');_0x5f7425[_0x197c('0x21')]=_0x197c('0x28');_0x5f7425[_0x197c('0x22')]=_0x574274[_0x197c('0x22')];_0x5f7425['talktime']=0x0;writeDB(_0x5f7425);}});}catch(_0x54e6be){utils[_0x197c('0x1b')](util[_0x197c('0x2')]('[%s][agents][queuecallerabandon]',_0x574274['uniqueid']),_0x54e6be);}};exports[_0x197c('0x29')]=function(_0x2a884b){try{if(agents[_0x2a884b[_0x197c('0x12')]]){utils[_0x197c('0x14')](util[_0x197c('0x2')](_0x197c('0x2a'),_0x2a884b[_0x197c('0x4')]),_0x2a884b);utils[_0x197c('0x18')](util[_0x197c('0x2')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x2a884b[_0x197c('0x4')],agents[_0x2a884b[_0x197c('0x12')]][_0x197c('0x1a')],_0x2a884b[_0x197c('0x12')]));agents[_0x2a884b[_0x197c('0x12')]][_0x197c('0x2b')]=utils['now']();agents[_0x2a884b[_0x197c('0x12')]][_0x197c('0x8')]=_0x2a884b[_0x197c('0x8')];agents[_0x2a884b['destuniqueid']][_0x197c('0x17')]=_0x2a884b[_0x197c('0x17')];agents[_0x2a884b[_0x197c('0x12')]][_0x197c('0x22')]=_0x2a884b[_0x197c('0x23')];agents[_0x2a884b[_0x197c('0x12')]][_0x197c('0x9')]=_0x197c('0x2c');_[_0x197c('0x2d')](agents,function(_0x1dc01b,_0x4a12fc){if(_0x1dc01b[_0x197c('0x12')]!=_0x2a884b[_0x197c('0x12')]&&_0x1dc01b['uniqueid']==_0x2a884b['uniqueid']){_0x1dc01b[_0x197c('0x24')]=0x0;_0x1dc01b[_0x197c('0x22')]=_0x2a884b[_0x197c('0x23')];_0x1dc01b[_0x197c('0x1c')]=!![];_0x1dc01b[_0x197c('0x2e')]=utils['now']();_0x1dc01b[_0x197c('0x9')]=_0x197c('0x2f');_0x1dc01b[_0x197c('0x21')]=_0x197c('0x2f');_0x1dc01b[_0x197c('0x30')]=_0x2a884b['destuniqueid'];_0x1dc01b[_0x197c('0x31')]=_0x2a884b[_0x197c('0x1a')];writeDB(_0x1dc01b);}});}}catch(_0x6d7bda){utils[_0x197c('0x1b')](util[_0x197c('0x2')]('[%s][agents][agentconnect]',_0x2a884b[_0x197c('0x4')]),_0x6d7bda);}};exports[_0x197c('0xd')]=function(_0x3b7fc1){try{if(!_[_0x197c('0x1d')](agents[_0x3b7fc1[_0x197c('0x12')]])){utils[_0x197c('0x14')](util[_0x197c('0x2')](_0x197c('0x32'),_0x3b7fc1[_0x197c('0x4')]),_0x3b7fc1);utils[_0x197c('0x18')](util[_0x197c('0x2')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x3b7fc1['uniqueid'],agents[_0x3b7fc1['destuniqueid']]['membername'],_0x3b7fc1[_0x197c('0x12')]));agents[_0x3b7fc1[_0x197c('0x12')]]['agentcomplete']=!![];agents[_0x3b7fc1[_0x197c('0x12')]][_0x197c('0x33')]=utils['now']();agents[_0x3b7fc1[_0x197c('0x12')]][_0x197c('0x24')]=utils['diffTime'](agents[_0x3b7fc1[_0x197c('0x12')]][_0x197c('0x33')],agents[_0x3b7fc1['destuniqueid']][_0x197c('0x2b')]);agents[_0x3b7fc1[_0x197c('0x12')]][_0x197c('0x21')]=_0x3b7fc1['reason'];agents[_0x3b7fc1[_0x197c('0x12')]][_0x197c('0x9')]=_0x197c('0x34');writeDB(agents[_0x3b7fc1[_0x197c('0x12')]]);}}catch(_0x53295b){utils[_0x197c('0x1b')](util[_0x197c('0x2')](_0x197c('0x32'),_0x3b7fc1['uniqueid']),_0x53295b);}};exports['blindtransfer']=function(_0x3a5089){try{if(!_[_0x197c('0x1d')](agents[_0x3a5089[_0x197c('0x35')]])){utils[_0x197c('0x14')](util[_0x197c('0x2')](_0x197c('0x36'),_0x3a5089['uniqueid']),_0x3a5089);utils[_0x197c('0x18')](util['format'](_0x197c('0x37'),_0x3a5089[_0x197c('0x4')],agents[_0x3a5089[_0x197c('0x35')]][_0x197c('0x1a')],agents[_0x3a5089[_0x197c('0x35')]][_0x197c('0x4')]));agents[_0x3a5089[_0x197c('0x35')]][_0x197c('0x38')]=!![];agents[_0x3a5089['transfereruniqueid']][_0x197c('0x39')]=_0x197c('0x3a');agents[_0x3a5089[_0x197c('0x35')]]['transferexten']=_0x3a5089[_0x197c('0x3b')];agents[_0x3a5089['transfereruniqueid']][_0x197c('0x3c')]=agents[_0x3a5089[_0x197c('0x35')]][_0x197c('0x4')];}}catch(_0x22a106){utils[_0x197c('0x1b')](util[_0x197c('0x2')](_0x197c('0x36'),_0x3a5089[_0x197c('0x4')]),_0x22a106);}};exports['attendedtransfer']=function(_0x3e3176){try{utils[_0x197c('0x14')](util[_0x197c('0x2')]('[%s][agents][attendedtransfer]',_0x3e3176[_0x197c('0x3d')]),_0x3e3176);if(_0x3e3176[_0x197c('0x3d')]==_0x3e3176[_0x197c('0x3e')]){if(!_[_0x197c('0x1d')](agents[_0x3e3176[_0x197c('0x3f')]])){utils['info'](util['format'](_0x197c('0x40'),_0x3e3176[_0x197c('0x3d')],agents[_0x3e3176[_0x197c('0x3f')]][_0x197c('0x1a')]));agents[_0x3e3176[_0x197c('0x3f')]]['transfer']=!![];agents[_0x3e3176['secondtransfereruniqueid']][_0x197c('0x39')]=_0x197c('0x41');agents[_0x3e3176['secondtransfereruniqueid']][_0x197c('0x42')]=_0x3e3176[_0x197c('0x43')];agents[_0x3e3176[_0x197c('0x3f')]][_0x197c('0x3c')]=_0x3e3176[_0x197c('0x3d')];}if(_0x3e3176[_0x197c('0x44')]&&agents[_0x3e3176['transfereeuniqueid']]){agents[_0x3e3176[_0x197c('0x44')]][_0x197c('0x45')]=0x1;transfers[_0x3e3176['transfereeuniqueid']]=_['clone'](agents[_0x3e3176[_0x197c('0x44')]]);transfers[_0x3e3176['transfereeuniqueid']][_0x197c('0x7')]=agents[_0x3e3176[_0x197c('0x3f')]][_0x197c('0x7')];transfers[_0x3e3176['transfereeuniqueid']][_0x197c('0x46')]=agents[_0x3e3176[_0x197c('0x3f')]]['calleridname'];transfers[_0x3e3176[_0x197c('0x44')]][_0x197c('0x47')]=utils[_0x197c('0x20')]();transfers[_0x3e3176['transfereeuniqueid']][_0x197c('0x2b')]=utils[_0x197c('0x20')]();transfers[_0x3e3176['transfereeuniqueid']]['holdtime']=0x0;transfers[_0x3e3176[_0x197c('0x44')]][_0x197c('0x45')]=0x2;}}else if(_0x3e3176[_0x197c('0x3f')]==_0x3e3176['secondtransfererlinkedid']){if(!_[_0x197c('0x1d')](agents[_0x3e3176[_0x197c('0x3d')]])){utils[_0x197c('0x18')](util['format'](_0x197c('0x40'),_0x3e3176[_0x197c('0x3d')],agents[_0x3e3176[_0x197c('0x3d')]][_0x197c('0x1a')]));agents[_0x3e3176[_0x197c('0x3d')]][_0x197c('0x38')]=!![];agents[_0x3e3176[_0x197c('0x3d')]][_0x197c('0x39')]=_0x197c('0x41');agents[_0x3e3176[_0x197c('0x3d')]]['transferexten']=_0x3e3176[_0x197c('0x48')];agents[_0x3e3176['origtransfereruniqueid']]['transferuniqueid']=_0x3e3176['secondtransfereruniqueid'];}if(_0x3e3176['transfertargetuniqueid']&&agents[_0x3e3176[_0x197c('0x49')]]){agents[_0x3e3176[_0x197c('0x49')]][_0x197c('0x45')]=0x1;transfers[_0x3e3176[_0x197c('0x49')]]=_['clone'](agents[_0x3e3176[_0x197c('0x49')]]);transfers[_0x3e3176['transfertargetuniqueid']][_0x197c('0x7')]=agents[_0x3e3176['origtransfereruniqueid']][_0x197c('0x7')];transfers[_0x3e3176['transfertargetuniqueid']][_0x197c('0x46')]=agents[_0x3e3176[_0x197c('0x3d')]][_0x197c('0x46')];transfers[_0x3e3176[_0x197c('0x49')]]['agentcalledAt']=utils[_0x197c('0x20')]();transfers[_0x3e3176[_0x197c('0x49')]][_0x197c('0x2b')]=utils['now']();transfers[_0x3e3176[_0x197c('0x49')]][_0x197c('0x22')]=0x0;transfers[_0x3e3176[_0x197c('0x49')]][_0x197c('0x45')]=0x2;}}}catch(_0x5596f3){utils[_0x197c('0x1b')](util[_0x197c('0x2')](_0x197c('0x4a'),_0x3e3176[_0x197c('0x3d')]),_0x5596f3);}};exports[_0x197c('0x4b')]=function(_0x342efa){try{utils[_0x197c('0x14')](util[_0x197c('0x2')](_0x197c('0x4c'),_0x342efa[_0x197c('0x4')]),_0x342efa);if(agents[_0x342efa[_0x197c('0x4')]]&&agents[_0x342efa[_0x197c('0x4')]][_0x197c('0x21')]==='timeout'){if(_0x342efa['cause']==='21'){agents[_0x342efa['uniqueid']][_0x197c('0x21')]='rejected';agents[_0x342efa[_0x197c('0x4')]]['lastevent']='rejected';}utils[_0x197c('0x18')](util[_0x197c('0x2')](_0x197c('0x4d'),_0x342efa['uniqueid'],agents[_0x342efa[_0x197c('0x4')]][_0x197c('0x1a')],agents[_0x342efa['uniqueid']][_0x197c('0x21')],agents[_0x342efa[_0x197c('0x4')]][_0x197c('0x9')]));writeDB(agents[_0x342efa[_0x197c('0x4')]]);var _0x54206a=unanswered[_0x197c('0x4e')](_0x342efa['uniqueid']);if(_0x54206a>-0x1){unanswered[_0x197c('0x4f')](_0x54206a,0x1);}}if(transfers[_0x342efa['uniqueid']]){transfers[_0x342efa[_0x197c('0x4')]][_0x197c('0xd')]=!![];transfers[_0x342efa[_0x197c('0x4')]]['agentcompleteAt']=utils[_0x197c('0x20')]();transfers[_0x342efa[_0x197c('0x4')]][_0x197c('0x24')]=utils['diffTime'](transfers[_0x342efa[_0x197c('0x4')]][_0x197c('0x33')],transfers[_0x342efa[_0x197c('0x4')]][_0x197c('0x2b')]);transfers[_0x342efa[_0x197c('0x4')]][_0x197c('0x21')]='agent';transfers[_0x342efa[_0x197c('0x4')]]['lastevent']='complete';utils[_0x197c('0x18')](util[_0x197c('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x342efa[_0x197c('0x4')],transfers[_0x342efa[_0x197c('0x4')]][_0x197c('0x1a')],transfers[_0x342efa[_0x197c('0x4')]][_0x197c('0x21')],transfers[_0x342efa['uniqueid']]['lastevent']));writeDB(transfers[_0x342efa['uniqueid']],!![]);}if(agents[_0x342efa['uniqueid']]&&agents[_0x342efa[_0x197c('0x4')]][_0x197c('0x2b')]){agents[_0x342efa['uniqueid']]['agentcomplete']=!![];agents[_0x342efa[_0x197c('0x4')]]['agentcompleteAt']=utils['now']();agents[_0x342efa[_0x197c('0x4')]][_0x197c('0x24')]=utils[_0x197c('0x50')](agents[_0x342efa[_0x197c('0x4')]][_0x197c('0x33')],agents[_0x342efa[_0x197c('0x4')]]['agentconnectAt']);agents[_0x342efa[_0x197c('0x4')]][_0x197c('0x21')]=agents[_0x342efa[_0x197c('0x4')]][_0x197c('0x38')]?_0x197c('0x38'):_0x197c('0x51');agents[_0x342efa[_0x197c('0x4')]]['lastevent']=_0x197c('0x34');utils[_0x197c('0x18')](util[_0x197c('0x2')](_0x197c('0x4d'),_0x342efa[_0x197c('0x4')],agents[_0x342efa[_0x197c('0x4')]]['membername'],agents[_0x342efa[_0x197c('0x4')]][_0x197c('0x21')],agents[_0x342efa['uniqueid']][_0x197c('0x9')]));writeDB(agents[_0x342efa[_0x197c('0x4')]]);}}catch(_0x173303){utils[_0x197c('0x1b')](util[_0x197c('0x2')]('[%s][agents][hangup]',_0x342efa['uniqueid']),_0x173303);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 35faf15..5353b45 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 _0xcddb=['source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','Queue','lastdata','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','application','appdata','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','includes','execif','gotoif','lastapplication','lodash','util','./utils','FAILED','NO\x20ANSWER','ANSWERED','blinds','uniqueid','transfereeuniqueid','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','interface','connectedlinenum','lastevent','getUserByInternal','accountcode','UserId','request','CreateVoiceCallReport','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','isNil','channelstate','info','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','toNumber','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','starttime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstop]','mohtime','diffTime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value'];(function(_0x3585f6,_0x26b184){var _0x49c864=function(_0xe615a6){while(--_0xe615a6){_0x3585f6['push'](_0x3585f6['shift']());}};_0x49c864(++_0x26b184);}(_0xcddb,0x1c4));var _0xbcdd=function(_0x1cfbce,_0x44ee54){_0x1cfbce=_0x1cfbce-0x0;var _0x28dcf6=_0xcddb[_0x1cfbce];return _0x28dcf6;};'use strict';var _=require(_0xbcdd('0x0'));var util=require(_0xbcdd('0x1'));var utils=require(_0xbcdd('0x2'));var transfers=require('./transfers.controller');var dispositions=['NO\x20ANSWER',_0xbcdd('0x3'),'FAILED',_0xbcdd('0x4'),_0xbcdd('0x4'),_0xbcdd('0x4'),_0xbcdd('0x5'),'BUSY',_0xbcdd('0x3'),'FAILED',_0xbcdd('0x3')];var channels={};function writeDB(_0x25675b){var _0x586e64;if(transfers[_0xbcdd('0x6')][_0x25675b[_0xbcdd('0x7')]]){_0x586e64=_0x25675b['uniqueid'];_0x25675b['uniqueid']=transfers[_0xbcdd('0x6')][_0x25675b[_0xbcdd('0x7')]][_0xbcdd('0x8')];}utils['info'](util[_0xbcdd('0x9')](_0xbcdd('0xa'),_0x25675b[_0xbcdd('0x7')],_0x25675b[_0xbcdd('0xb')],_0x25675b['queue'],_0x25675b[_0xbcdd('0xc')],_0x25675b[_0xbcdd('0xd')],_0x25675b['calleridnum'],_0x25675b[_0xbcdd('0xe')],_0x25675b[_0xbcdd('0xf')]));if(_0x25675b['accountcode']){utils[_0xbcdd('0x10')](_0x25675b[_0xbcdd('0x11')])['then'](function(_0x59da7a){if(_0x59da7a){_0x25675b[_0xbcdd('0x12')]=_0x59da7a['id'];}utils[_0xbcdd('0x13')](_0xbcdd('0x14'),_0x25675b);});}else{utils[_0xbcdd('0x13')](_0xbcdd('0x14'),_0x25675b);}if(channels[_0x25675b['uniqueid']]){delete channels[_0x25675b[_0xbcdd('0x7')]];}else if(_0x586e64&&channels[_0x586e64]){if(!transfers[_0xbcdd('0x6')][_0x586e64]['recording'])delete transfers[_0xbcdd('0x6')][_0x586e64];delete channels[_0x586e64];}}exports['newchannel']=function(_0x13460b){try{utils[_0xbcdd('0x15')](util[_0xbcdd('0x9')](_0xbcdd('0x16'),_0x13460b[_0xbcdd('0x7')]),_0x13460b);if(_0x13460b[_0xbcdd('0x7')]==_0x13460b[_0xbcdd('0x17')]&&_0x13460b[_0xbcdd('0xb')]!=_0xbcdd('0x18')){utils['info'](util[_0xbcdd('0x9')](_0xbcdd('0x19'),_0x13460b[_0xbcdd('0x7')],_0x13460b[_0xbcdd('0x1a')],_0x13460b[_0xbcdd('0x1b')]));channels[_0x13460b[_0xbcdd('0x7')]]={'uniqueid':_0x13460b['uniqueid'],'accountcode':_0x13460b[_0xbcdd('0x11')],'source':_0x13460b['calleridnum'],'destination':_0x13460b[_0xbcdd('0x1b')],'destinationcontext':_0x13460b[_0xbcdd('0x1a')],'channel':_0x13460b[_0xbcdd('0xb')],'starttime':utils[_0xbcdd('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xbcdd('0x1d')};}}catch(_0x2cd0dd){utils[_0xbcdd('0x1e')](util[_0xbcdd('0x9')]('[%s][calls][newchannel]',_0x13460b[_0xbcdd('0x7')]),_0x2cd0dd);}};exports[_0xbcdd('0x1f')]=function(_0x26fd3c){try{utils[_0xbcdd('0x15')](util[_0xbcdd('0x9')]('[%s][calls][newstate]',_0x26fd3c[_0xbcdd('0x7')]),_0x26fd3c);if(!_[_0xbcdd('0x20')](channels[_0x26fd3c[_0xbcdd('0x7')]])&&_0x26fd3c[_0xbcdd('0x21')]==0x6){utils[_0xbcdd('0x22')](util['format'](_0xbcdd('0x23'),_0x26fd3c[_0xbcdd('0x7')],_0x26fd3c['context'],_0x26fd3c[_0xbcdd('0xb')]));if(_[_0xbcdd('0x20')](channels[_0x26fd3c[_0xbcdd('0x7')]][_0xbcdd('0x24')])){channels[_0x26fd3c[_0xbcdd('0x7')]]['systemanswertime']=utils[_0xbcdd('0x1c')]();}}else if(!_['isNil'](channels[_0x26fd3c['linkedid']])&&_0x26fd3c[_0xbcdd('0x21')]==0x6&&_0x26fd3c[_0xbcdd('0x1a')]!='transfer'){utils[_0xbcdd('0x22')](util[_0xbcdd('0x9')](_0xbcdd('0x25'),_0x26fd3c[_0xbcdd('0x7')],_0x26fd3c[_0xbcdd('0x17')],_0x26fd3c[_0xbcdd('0x1a')],_0x26fd3c[_0xbcdd('0xb')]));channels[_0x26fd3c[_0xbcdd('0x17')]][_0xbcdd('0x11')]=_0x26fd3c['accountcode'];channels[_0x26fd3c[_0xbcdd('0x17')]][_0xbcdd('0x26')]=_0x26fd3c['channel'];if(_['isNil'](channels[_0x26fd3c[_0xbcdd('0x17')]][_0xbcdd('0x27')])){channels[_0x26fd3c['linkedid']][_0xbcdd('0x27')]=utils['now']();}channels[_0x26fd3c[_0xbcdd('0x17')]]['disposition']=dispositions[_[_0xbcdd('0x28')](_0x26fd3c['channelstate'])]||_0xbcdd('0x5');}}catch(_0x95ed44){utils['error'](util[_0xbcdd('0x9')](_0xbcdd('0x29'),_0x26fd3c[_0xbcdd('0x7')]),_0x95ed44);}};exports[_0xbcdd('0x2a')]=function(_0x406ee4){try{if(!_['isNil'](channels[_0x406ee4[_0xbcdd('0x7')]])){utils['debug'](util[_0xbcdd('0x9')](_0xbcdd('0x2b'),_0x406ee4['uniqueid']),_0x406ee4);if(_['isNil'](channels[_0x406ee4[_0xbcdd('0x7')]]['callerid'])){channels[_0x406ee4[_0xbcdd('0x7')]][_0xbcdd('0x2c')]=_0x406ee4[_0xbcdd('0x2d')]+'\x20<'+_0x406ee4['calleridnum']+'>';}utils[_0xbcdd('0x22')](util[_0xbcdd('0x9')](_0xbcdd('0x2e'),_0x406ee4[_0xbcdd('0x7')],channels[_0x406ee4[_0xbcdd('0x7')]][_0xbcdd('0x2c')],_0x406ee4[_0xbcdd('0x2f')]));channels[_0x406ee4[_0xbcdd('0x7')]][_0xbcdd('0x30')]=utils[_0xbcdd('0x1c')]();channels[_0x406ee4[_0xbcdd('0x7')]][_0xbcdd('0x31')]=utils['diffTime'](channels[_0x406ee4[_0xbcdd('0x7')]][_0xbcdd('0x30')],channels[_0x406ee4[_0xbcdd('0x7')]][_0xbcdd('0x32')]);channels[_0x406ee4[_0xbcdd('0x7')]][_0xbcdd('0x33')]=channels[_0x406ee4['uniqueid']][_0xbcdd('0x27')]?utils['diffTime'](channels[_0x406ee4[_0xbcdd('0x7')]]['endtime'],channels[_0x406ee4[_0xbcdd('0x7')]][_0xbcdd('0x27')]):0x0;writeDB(channels[_0x406ee4['uniqueid']]);}}catch(_0x1a71a7){utils[_0xbcdd('0x1e')](util[_0xbcdd('0x9')](_0xbcdd('0x2b'),_0x406ee4['uniqueid']),_0x1a71a7);}};exports['attendedtransfer']=function(_0xe632dc){try{if(!_[_0xbcdd('0x20')](channels[_0xe632dc[_0xbcdd('0x34')]])){utils['debug'](util[_0xbcdd('0x9')](_0xbcdd('0x35'),_0xe632dc['origtransfereruniqueid']),_0xe632dc);if(channels[_0xe632dc[_0xbcdd('0x34')]][_0xbcdd('0xb')]==_0xe632dc[_0xbcdd('0x36')]){utils['info'](util[_0xbcdd('0x9')](_0xbcdd('0x37'),_0xe632dc[_0xbcdd('0x38')],_0xe632dc['localtwolinkedid'],_0xe632dc[_0xbcdd('0x39')]));channels[_0xe632dc[_0xbcdd('0x34')]][_0xbcdd('0x26')]=_0xe632dc[_0xbcdd('0x39')];channels[_0xe632dc[_0xbcdd('0x34')]][_0xbcdd('0x3a')]=_0xbcdd('0x3b');}else if(channels[_0xe632dc[_0xbcdd('0x34')]][_0xbcdd('0xb')]=_0xe632dc[_0xbcdd('0x3c')]){utils[_0xbcdd('0x22')](util[_0xbcdd('0x9')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0xe632dc[_0xbcdd('0x38')],_0xe632dc['localtwolinkedid'],_0xe632dc[_0xbcdd('0x3d')]));channels[_0xe632dc[_0xbcdd('0x34')]]['destinationchannel']=_0xe632dc[_0xbcdd('0x3d')];channels[_0xe632dc[_0xbcdd('0x34')]][_0xbcdd('0x3a')]=_0xbcdd('0x3b');}}}catch(_0x35c7c1){utils['error'](util[_0xbcdd('0x9')](_0xbcdd('0x35'),_0xe632dc['origtransfereruniqueid']),_0x35c7c1);}};exports['musiconholdstart']=function(_0xed8e01){try{if(!_[_0xbcdd('0x20')](channels[_0xed8e01[_0xbcdd('0x7')]])){utils[_0xbcdd('0x15')](util[_0xbcdd('0x9')](_0xbcdd('0x3e'),_0xed8e01[_0xbcdd('0x7')]),_0xed8e01);channels[_0xed8e01['uniqueid']][_0xbcdd('0x3f')]=utils[_0xbcdd('0x1c')]();utils['info'](util[_0xbcdd('0x9')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0xed8e01[_0xbcdd('0x7')],channels[_0xed8e01[_0xbcdd('0x7')]][_0xbcdd('0x3f')]));}}catch(_0x1519d3){utils[_0xbcdd('0x1e')](util[_0xbcdd('0x9')](_0xbcdd('0x3e'),_0xed8e01[_0xbcdd('0x7')]),_0x1519d3);}};exports['musiconholdstop']=function(_0x5f4adc){try{if(!_[_0xbcdd('0x20')](channels[_0x5f4adc[_0xbcdd('0x7')]])){utils['debug'](util[_0xbcdd('0x9')](_0xbcdd('0x40'),_0x5f4adc[_0xbcdd('0x7')]),_0x5f4adc);if(!_[_0xbcdd('0x20')](channels[_0x5f4adc[_0xbcdd('0x7')]]['musiconholdstartAt'])){channels[_0x5f4adc[_0xbcdd('0x7')]][_0xbcdd('0x41')]+=utils[_0xbcdd('0x42')](utils[_0xbcdd('0x1c')](),channels[_0x5f4adc['uniqueid']]['musiconholdstartAt']);utils['info'](util[_0xbcdd('0x9')](_0xbcdd('0x43'),_0x5f4adc[_0xbcdd('0x7')],channels[_0x5f4adc['uniqueid']][_0xbcdd('0x41')]));delete channels[_0x5f4adc[_0xbcdd('0x7')]][_0xbcdd('0x3f')];}}}catch(_0x8df2d0){utils[_0xbcdd('0x1e')](util[_0xbcdd('0x9')](_0xbcdd('0x40'),_0x5f4adc[_0xbcdd('0x7')]),_0x8df2d0);}};exports[_0xbcdd('0x44')]=function(_0x58fd16){try{if(!_[_0xbcdd('0x20')](channels[_0x58fd16[_0xbcdd('0x7')]])){utils[_0xbcdd('0x15')](util[_0xbcdd('0x9')](_0xbcdd('0x45'),_0x58fd16[_0xbcdd('0x7')]),_0x58fd16);if(!_[_0xbcdd('0x20')](_0x58fd16[_0xbcdd('0x46')]['xmd-originatecalleridnum'])){utils['info'](util[_0xbcdd('0x9')](_0xbcdd('0x47'),_0x58fd16[_0xbcdd('0x7')],_0x58fd16[_0xbcdd('0x48')]));channels[_0x58fd16['uniqueid']][_0xbcdd('0x49')]=_0x58fd16['value'];}if(!_['isNil'](_0x58fd16[_0xbcdd('0x46')][_0xbcdd('0x4a')])){utils[_0xbcdd('0x22')](util[_0xbcdd('0x9')](_0xbcdd('0x4b'),_0x58fd16[_0xbcdd('0x7')],_0x58fd16['value']));channels[_0x58fd16[_0xbcdd('0x7')]][_0xbcdd('0x4c')]=_0x58fd16['value'];channels[_0x58fd16[_0xbcdd('0x7')]]['callerid']='\x22'+_0x58fd16[_0xbcdd('0x48')]+_0xbcdd('0x4d')+_0x58fd16[_0xbcdd('0x48')]+'>';}if(!_[_0xbcdd('0x20')](_0x58fd16[_0xbcdd('0x46')]['xmd-callerid-preview'])||!_[_0xbcdd('0x20')](_0x58fd16[_0xbcdd('0x46')][_0xbcdd('0x4e')])){utils[_0xbcdd('0x22')](util['format'](_0xbcdd('0x4f'),_0x58fd16[_0xbcdd('0x7')],!_[_0xbcdd('0x20')](_0x58fd16[_0xbcdd('0x46')][_0xbcdd('0x50')])?_0xbcdd('0x50'):'xmd-callerid',_0x58fd16[_0xbcdd('0x48')]));channels[_0x58fd16[_0xbcdd('0x7')]][_0xbcdd('0x2c')]=_0x58fd16[_0xbcdd('0x48')];}if(!_[_0xbcdd('0x20')](_0x58fd16[_0xbcdd('0x46')][_0xbcdd('0x51')])||!_[_0xbcdd('0x20')](_0x58fd16[_0xbcdd('0x46')]['xmcs-queue'])){utils['info'](util[_0xbcdd('0x9')](_0xbcdd('0x4f'),_0x58fd16['uniqueid'],!_['isNil'](_0x58fd16[_0xbcdd('0x46')]['xmd-queue'])?_0xbcdd('0x51'):_0xbcdd('0x52'),_0x58fd16['value']));channels[_0x58fd16[_0xbcdd('0x7')]]['lastapplication']=_0xbcdd('0x53');channels[_0x58fd16[_0xbcdd('0x7')]][_0xbcdd('0x54')]=_0x58fd16[_0xbcdd('0x48')];channels[_0x58fd16[_0xbcdd('0x7')]]['queue']=!![];}if(!_[_0xbcdd('0x20')](_0x58fd16[_0xbcdd('0x46')]['xmd-contactid'])){utils['info'](util[_0xbcdd('0x9')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x58fd16[_0xbcdd('0x7')],_0x58fd16[_0xbcdd('0x48')]));channels[_0x58fd16[_0xbcdd('0x7')]][_0xbcdd('0x55')]=_0x58fd16[_0xbcdd('0x48')];}if(!_[_0xbcdd('0x20')](_0x58fd16[_0xbcdd('0x46')][_0xbcdd('0x56')])){utils[_0xbcdd('0x22')](util[_0xbcdd('0x9')](_0xbcdd('0x57'),_0x58fd16[_0xbcdd('0x7')],_0x58fd16[_0xbcdd('0x48')]));channels[_0x58fd16[_0xbcdd('0x7')]]['type']=_0x58fd16['value'];}if(!_[_0xbcdd('0x20')](_0x58fd16[_0xbcdd('0x46')][_0xbcdd('0x58')])){utils['info'](util[_0xbcdd('0x9')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x58fd16[_0xbcdd('0x7')],_0x58fd16[_0xbcdd('0x48')]));channels[_0x58fd16[_0xbcdd('0x7')]][_0xbcdd('0x59')]=_0x58fd16['value'];}if(!_[_0xbcdd('0x20')](_0x58fd16[_0xbcdd('0x46')][_0xbcdd('0x5a')])){utils[_0xbcdd('0x22')](util[_0xbcdd('0x9')](_0xbcdd('0x5b'),_0x58fd16['uniqueid'],_0x58fd16[_0xbcdd('0x48')]));channels[_0x58fd16[_0xbcdd('0x7')]]['sipcallid']=_0x58fd16[_0xbcdd('0x48')];}}}catch(_0x4fa7be){utils[_0xbcdd('0x1e')](util['format'](_0xbcdd('0x45'),_0x58fd16['uniqueid']),_0x4fa7be);}};exports['newexten']=function(_0x4d8748){try{if(!_['isNil'](channels[_0x4d8748[_0xbcdd('0x7')]])){utils['debug'](util[_0xbcdd('0x9')](_0xbcdd('0x5c'),_0x4d8748[_0xbcdd('0x7')]),_0x4d8748);utils['info'](util[_0xbcdd('0x9')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x4d8748[_0xbcdd('0x7')],_0x4d8748[_0xbcdd('0x5d')],_0x4d8748[_0xbcdd('0x5e')]));if(_0x4d8748['application'][_0xbcdd('0x5f')]()=='set'&&_[_0xbcdd('0x60')](_0x4d8748[_0xbcdd('0x5e')]['toLowerCase'](),_0xbcdd('0x61'))){var _0x2af157=_0x4d8748[_0xbcdd('0x5e')][_0xbcdd('0x62')]('=');var _0x5c1a20=_0x2af157[0x0][_0xbcdd('0x63')](_0x2af157[0x0][_0xbcdd('0x64')]('(')+0x1,_0x2af157[0x0][_0xbcdd('0x64')](')'));var _0x50a2de=_0x2af157[0x1];channels[_0x4d8748[_0xbcdd('0x7')]][_0x5c1a20]=_0x50a2de;}if(!_[_0xbcdd('0x65')](['hangup','noop',_0xbcdd('0x66'),'set',_0xbcdd('0x67')],_0x4d8748['application'][_0xbcdd('0x5f')]())){channels[_0x4d8748[_0xbcdd('0x7')]][_0xbcdd('0x68')]=_0x4d8748['application'];channels[_0x4d8748['uniqueid']]['lastdata']=_0x4d8748['appdata'];}}}catch(_0x1db750){utils[_0xbcdd('0x1e')](util[_0xbcdd('0x9')](_0xbcdd('0x5c'),_0x4d8748[_0xbcdd('0x7')]),_0x1db750);}}; \ No newline at end of file +var _0x1fb2=['channelstate','channel','systemanswertime','destinationchannel','answertime','disposition','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','secondtransfererchannel','userfield','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%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<','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-callerid','xmcs-queue','xmd-queue','lastapplication','Queue','lastdata','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]','application','appdata','toLowerCase','set','cdr','split','substring','lastIndexOf','noop','execif','gotoif','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','format','queue','membername','interface','calleridnum','lastevent','accountcode','then','UserId','CreateVoiceCallReport','request','recording','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','[%s][calls][newstate]','isNil'];(function(_0x4f05ff,_0x2174dc){var _0x243f65=function(_0x280cfb){while(--_0x280cfb){_0x4f05ff['push'](_0x4f05ff['shift']());}};_0x243f65(++_0x2174dc);}(_0x1fb2,0x18f));var _0x21fb=function(_0xa3029d,_0x52dc8c){_0xa3029d=_0xa3029d-0x0;var _0x2bc675=_0x1fb2[_0xa3029d];return _0x2bc675;};'use strict';var _=require(_0x21fb('0x0'));var util=require(_0x21fb('0x1'));var utils=require(_0x21fb('0x2'));var transfers=require(_0x21fb('0x3'));var dispositions=[_0x21fb('0x4'),'FAILED',_0x21fb('0x5'),_0x21fb('0x4'),'NO\x20ANSWER',_0x21fb('0x4'),_0x21fb('0x6'),_0x21fb('0x7'),'FAILED','FAILED',_0x21fb('0x5')];var channels={};function writeDB(_0x59de09){var _0x47bd6e;if(transfers[_0x21fb('0x8')][_0x59de09[_0x21fb('0x9')]]){_0x47bd6e=_0x59de09[_0x21fb('0x9')];_0x59de09[_0x21fb('0x9')]=transfers['blinds'][_0x59de09[_0x21fb('0x9')]][_0x21fb('0xa')];}utils['info'](util[_0x21fb('0xb')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x59de09['uniqueid'],_0x59de09['channel'],_0x59de09[_0x21fb('0xc')],_0x59de09[_0x21fb('0xd')],_0x59de09[_0x21fb('0xe')],_0x59de09[_0x21fb('0xf')],_0x59de09['connectedlinenum'],_0x59de09[_0x21fb('0x10')]));if(_0x59de09[_0x21fb('0x11')]){utils['getUserByInternal'](_0x59de09['accountcode'])[_0x21fb('0x12')](function(_0x3376a6){if(_0x3376a6){_0x59de09[_0x21fb('0x13')]=_0x3376a6['id'];}utils['request'](_0x21fb('0x14'),_0x59de09);});}else{utils[_0x21fb('0x15')](_0x21fb('0x14'),_0x59de09);}if(channels[_0x59de09[_0x21fb('0x9')]]){delete channels[_0x59de09['uniqueid']];}else if(_0x47bd6e&&channels[_0x47bd6e]){if(!transfers[_0x21fb('0x8')][_0x47bd6e][_0x21fb('0x16')])delete transfers[_0x21fb('0x8')][_0x47bd6e];delete channels[_0x47bd6e];}}exports[_0x21fb('0x17')]=function(_0x45f722){try{utils[_0x21fb('0x18')](util['format'](_0x21fb('0x19'),_0x45f722['uniqueid']),_0x45f722);if(_0x45f722[_0x21fb('0x9')]==_0x45f722[_0x21fb('0x1a')]&&_0x45f722['channel']!=_0x21fb('0x1b')){utils[_0x21fb('0x1c')](util[_0x21fb('0xb')](_0x21fb('0x1d'),_0x45f722['uniqueid'],_0x45f722[_0x21fb('0x1e')],_0x45f722[_0x21fb('0x1f')]));channels[_0x45f722['uniqueid']]={'uniqueid':_0x45f722[_0x21fb('0x9')],'accountcode':_0x45f722[_0x21fb('0x11')],'source':_0x45f722[_0x21fb('0xf')],'destination':_0x45f722[_0x21fb('0x1f')],'destinationcontext':_0x45f722[_0x21fb('0x1e')],'channel':_0x45f722['channel'],'starttime':utils[_0x21fb('0x20')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x21fb('0x4'),'amaflags':_0x21fb('0x21')};}}catch(_0x456496){utils[_0x21fb('0x22')](util[_0x21fb('0xb')](_0x21fb('0x19'),_0x45f722[_0x21fb('0x9')]),_0x456496);}};exports['newstate']=function(_0x28d90d){try{utils[_0x21fb('0x18')](util[_0x21fb('0xb')](_0x21fb('0x23'),_0x28d90d['uniqueid']),_0x28d90d);if(!_[_0x21fb('0x24')](channels[_0x28d90d['uniqueid']])&&_0x28d90d[_0x21fb('0x25')]==0x6){utils['info'](util['format']('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x28d90d[_0x21fb('0x9')],_0x28d90d['context'],_0x28d90d[_0x21fb('0x26')]));if(_['isNil'](channels[_0x28d90d[_0x21fb('0x9')]][_0x21fb('0x27')])){channels[_0x28d90d[_0x21fb('0x9')]][_0x21fb('0x27')]=utils[_0x21fb('0x20')]();}}else if(!_[_0x21fb('0x24')](channels[_0x28d90d[_0x21fb('0x1a')]])&&_0x28d90d['channelstate']==0x6&&_0x28d90d['context']!='transfer'){utils['info'](util[_0x21fb('0xb')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x28d90d[_0x21fb('0x9')],_0x28d90d['linkedid'],_0x28d90d[_0x21fb('0x1e')],_0x28d90d[_0x21fb('0x26')]));channels[_0x28d90d[_0x21fb('0x1a')]][_0x21fb('0x11')]=_0x28d90d[_0x21fb('0x11')];channels[_0x28d90d[_0x21fb('0x1a')]][_0x21fb('0x28')]=_0x28d90d['channel'];if(_[_0x21fb('0x24')](channels[_0x28d90d['linkedid']][_0x21fb('0x29')])){channels[_0x28d90d['linkedid']][_0x21fb('0x29')]=utils[_0x21fb('0x20')]();}channels[_0x28d90d[_0x21fb('0x1a')]][_0x21fb('0x2a')]=dispositions[_['toNumber'](_0x28d90d[_0x21fb('0x25')])]||_0x21fb('0x6');}}catch(_0x405dcf){utils[_0x21fb('0x22')](util[_0x21fb('0xb')](_0x21fb('0x23'),_0x28d90d[_0x21fb('0x9')]),_0x405dcf);}};exports[_0x21fb('0x2b')]=function(_0x17a535){try{if(!_[_0x21fb('0x24')](channels[_0x17a535[_0x21fb('0x9')]])){utils[_0x21fb('0x18')](util['format'](_0x21fb('0x2c'),_0x17a535['uniqueid']),_0x17a535);if(_[_0x21fb('0x24')](channels[_0x17a535[_0x21fb('0x9')]][_0x21fb('0x2d')])){channels[_0x17a535[_0x21fb('0x9')]][_0x21fb('0x2d')]=_0x17a535[_0x21fb('0x2e')]+'\x20<'+_0x17a535[_0x21fb('0xf')]+'>';}utils['info'](util[_0x21fb('0xb')](_0x21fb('0x2f'),_0x17a535[_0x21fb('0x9')],channels[_0x17a535[_0x21fb('0x9')]][_0x21fb('0x2d')],_0x17a535['cause-txt']));channels[_0x17a535['uniqueid']][_0x21fb('0x30')]=utils[_0x21fb('0x20')]();channels[_0x17a535['uniqueid']][_0x21fb('0x31')]=utils[_0x21fb('0x32')](channels[_0x17a535['uniqueid']][_0x21fb('0x30')],channels[_0x17a535[_0x21fb('0x9')]][_0x21fb('0x33')]);channels[_0x17a535[_0x21fb('0x9')]][_0x21fb('0x34')]=channels[_0x17a535[_0x21fb('0x9')]][_0x21fb('0x29')]?utils[_0x21fb('0x32')](channels[_0x17a535['uniqueid']]['endtime'],channels[_0x17a535[_0x21fb('0x9')]][_0x21fb('0x29')]):0x0;writeDB(channels[_0x17a535['uniqueid']]);}}catch(_0x38b493){utils[_0x21fb('0x22')](util[_0x21fb('0xb')](_0x21fb('0x2c'),_0x17a535[_0x21fb('0x9')]),_0x38b493);}};exports[_0x21fb('0x35')]=function(_0x3fdfef){try{if(!_['isNil'](channels[_0x3fdfef['localtwolinkedid']])){utils[_0x21fb('0x18')](util[_0x21fb('0xb')](_0x21fb('0x36'),_0x3fdfef[_0x21fb('0x37')]),_0x3fdfef);if(channels[_0x3fdfef['localtwolinkedid']]['channel']==_0x3fdfef['transfereechannel']){utils[_0x21fb('0x1c')](util[_0x21fb('0xb')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x3fdfef[_0x21fb('0x37')],_0x3fdfef[_0x21fb('0x38')],_0x3fdfef[_0x21fb('0x39')]));channels[_0x3fdfef[_0x21fb('0x38')]][_0x21fb('0x28')]=_0x3fdfef[_0x21fb('0x39')];channels[_0x3fdfef[_0x21fb('0x38')]][_0x21fb('0x3a')]='_attended';}else if(channels[_0x3fdfef[_0x21fb('0x38')]][_0x21fb('0x26')]=_0x3fdfef['transfertargetchannel']){utils[_0x21fb('0x1c')](util[_0x21fb('0xb')](_0x21fb('0x3b'),_0x3fdfef[_0x21fb('0x37')],_0x3fdfef[_0x21fb('0x38')],_0x3fdfef[_0x21fb('0x3c')]));channels[_0x3fdfef['localtwolinkedid']]['destinationchannel']=_0x3fdfef[_0x21fb('0x3c')];channels[_0x3fdfef[_0x21fb('0x38')]][_0x21fb('0x3a')]='_attended';}}}catch(_0x56bf8d){utils[_0x21fb('0x22')](util['format']('[%s][calls][attendedtransfer]',_0x3fdfef[_0x21fb('0x37')]),_0x56bf8d);}};exports[_0x21fb('0x3d')]=function(_0x35b37c){try{if(!_[_0x21fb('0x24')](channels[_0x35b37c['uniqueid']])){utils[_0x21fb('0x18')](util['format'](_0x21fb('0x3e'),_0x35b37c[_0x21fb('0x9')]),_0x35b37c);channels[_0x35b37c[_0x21fb('0x9')]][_0x21fb('0x3f')]=utils['now']();utils['info'](util[_0x21fb('0xb')](_0x21fb('0x40'),_0x35b37c['uniqueid'],channels[_0x35b37c[_0x21fb('0x9')]][_0x21fb('0x3f')]));}}catch(_0x2d5d90){utils[_0x21fb('0x22')](util[_0x21fb('0xb')](_0x21fb('0x3e'),_0x35b37c[_0x21fb('0x9')]),_0x2d5d90);}};exports['musiconholdstop']=function(_0x2a55da){try{if(!_[_0x21fb('0x24')](channels[_0x2a55da[_0x21fb('0x9')]])){utils[_0x21fb('0x18')](util['format'](_0x21fb('0x41'),_0x2a55da[_0x21fb('0x9')]),_0x2a55da);if(!_[_0x21fb('0x24')](channels[_0x2a55da[_0x21fb('0x9')]][_0x21fb('0x3f')])){channels[_0x2a55da['uniqueid']][_0x21fb('0x42')]+=utils[_0x21fb('0x32')](utils[_0x21fb('0x20')](),channels[_0x2a55da[_0x21fb('0x9')]]['musiconholdstartAt']);utils[_0x21fb('0x1c')](util[_0x21fb('0xb')](_0x21fb('0x43'),_0x2a55da[_0x21fb('0x9')],channels[_0x2a55da['uniqueid']][_0x21fb('0x42')]));delete channels[_0x2a55da[_0x21fb('0x9')]]['musiconholdstartAt'];}}}catch(_0x53cd42){utils[_0x21fb('0x22')](util[_0x21fb('0xb')](_0x21fb('0x41'),_0x2a55da[_0x21fb('0x9')]),_0x53cd42);}};exports[_0x21fb('0x44')]=function(_0x50a69d){try{if(!_[_0x21fb('0x24')](channels[_0x50a69d[_0x21fb('0x9')]])){utils['debug'](util['format'](_0x21fb('0x45'),_0x50a69d[_0x21fb('0x9')]),_0x50a69d);if(!_['isNil'](_0x50a69d[_0x21fb('0x46')][_0x21fb('0x47')])){utils[_0x21fb('0x1c')](util[_0x21fb('0xb')](_0x21fb('0x48'),_0x50a69d[_0x21fb('0x9')],_0x50a69d[_0x21fb('0x49')]));channels[_0x50a69d['uniqueid']][_0x21fb('0x4a')]=_0x50a69d[_0x21fb('0x49')];}if(!_[_0x21fb('0x24')](_0x50a69d[_0x21fb('0x46')][_0x21fb('0x4b')])){utils['info'](util[_0x21fb('0xb')](_0x21fb('0x4c'),_0x50a69d[_0x21fb('0x9')],_0x50a69d[_0x21fb('0x49')]));channels[_0x50a69d['uniqueid']][_0x21fb('0x4d')]=_0x50a69d[_0x21fb('0x49')];channels[_0x50a69d[_0x21fb('0x9')]][_0x21fb('0x2d')]='\x22'+_0x50a69d[_0x21fb('0x49')]+_0x21fb('0x4e')+_0x50a69d['value']+'>';}if(!_[_0x21fb('0x24')](_0x50a69d[_0x21fb('0x46')]['xmd-callerid-preview'])||!_[_0x21fb('0x24')](_0x50a69d[_0x21fb('0x46')]['xmd-callerid'])){utils[_0x21fb('0x1c')](util[_0x21fb('0xb')](_0x21fb('0x4f'),_0x50a69d[_0x21fb('0x9')],!_[_0x21fb('0x24')](_0x50a69d[_0x21fb('0x46')][_0x21fb('0x50')])?'xmd-callerid-preview':_0x21fb('0x51'),_0x50a69d[_0x21fb('0x49')]));channels[_0x50a69d['uniqueid']][_0x21fb('0x2d')]=_0x50a69d[_0x21fb('0x49')];}if(!_[_0x21fb('0x24')](_0x50a69d[_0x21fb('0x46')]['xmd-queue'])||!_[_0x21fb('0x24')](_0x50a69d[_0x21fb('0x46')][_0x21fb('0x52')])){utils[_0x21fb('0x1c')](util[_0x21fb('0xb')](_0x21fb('0x4f'),_0x50a69d[_0x21fb('0x9')],!_[_0x21fb('0x24')](_0x50a69d[_0x21fb('0x46')]['xmd-queue'])?_0x21fb('0x53'):_0x21fb('0x52'),_0x50a69d[_0x21fb('0x49')]));channels[_0x50a69d[_0x21fb('0x9')]][_0x21fb('0x54')]=_0x21fb('0x55');channels[_0x50a69d[_0x21fb('0x9')]][_0x21fb('0x56')]=_0x50a69d[_0x21fb('0x49')];channels[_0x50a69d[_0x21fb('0x9')]][_0x21fb('0xc')]=!![];}if(!_['isNil'](_0x50a69d['variable']['xmd-contactid'])){utils[_0x21fb('0x1c')](util['format']('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x50a69d[_0x21fb('0x9')],_0x50a69d[_0x21fb('0x49')]));channels[_0x50a69d[_0x21fb('0x9')]][_0x21fb('0x57')]=_0x50a69d[_0x21fb('0x49')];}if(!_[_0x21fb('0x24')](_0x50a69d['variable'][_0x21fb('0x58')])){utils[_0x21fb('0x1c')](util[_0x21fb('0xb')](_0x21fb('0x59'),_0x50a69d[_0x21fb('0x9')],_0x50a69d[_0x21fb('0x49')]));channels[_0x50a69d[_0x21fb('0x9')]][_0x21fb('0x5a')]=_0x50a69d['value'];}if(!_[_0x21fb('0x24')](_0x50a69d[_0x21fb('0x46')][_0x21fb('0x5b')])){utils[_0x21fb('0x1c')](util[_0x21fb('0xb')](_0x21fb('0x5c'),_0x50a69d[_0x21fb('0x9')],_0x50a69d['value']));channels[_0x50a69d[_0x21fb('0x9')]][_0x21fb('0x5d')]=_0x50a69d['value'];}if(!_[_0x21fb('0x24')](_0x50a69d['variable']['sipcallid'])){utils[_0x21fb('0x1c')](util[_0x21fb('0xb')](_0x21fb('0x5e'),_0x50a69d[_0x21fb('0x9')],_0x50a69d[_0x21fb('0x49')]));channels[_0x50a69d[_0x21fb('0x9')]][_0x21fb('0x5f')]=_0x50a69d['value'];}}}catch(_0x444f07){utils['error'](util['format'](_0x21fb('0x45'),_0x50a69d['uniqueid']),_0x444f07);}};exports[_0x21fb('0x60')]=function(_0x834c24){try{if(!_['isNil'](channels[_0x834c24[_0x21fb('0x9')]])){utils[_0x21fb('0x18')](util[_0x21fb('0xb')](_0x21fb('0x61'),_0x834c24[_0x21fb('0x9')]),_0x834c24);utils[_0x21fb('0x1c')](util[_0x21fb('0xb')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x834c24[_0x21fb('0x9')],_0x834c24[_0x21fb('0x62')],_0x834c24[_0x21fb('0x63')]));if(_0x834c24['application'][_0x21fb('0x64')]()==_0x21fb('0x65')&&_['startsWith'](_0x834c24[_0x21fb('0x63')][_0x21fb('0x64')](),_0x21fb('0x66'))){var _0x28f1aa=_0x834c24[_0x21fb('0x63')][_0x21fb('0x67')]('=');var _0x399beb=_0x28f1aa[0x0][_0x21fb('0x68')](_0x28f1aa[0x0][_0x21fb('0x69')]('(')+0x1,_0x28f1aa[0x0][_0x21fb('0x69')](')'));var _0x2d757d=_0x28f1aa[0x1];channels[_0x834c24[_0x21fb('0x9')]][_0x399beb]=_0x2d757d;}if(!_['includes'](['hangup',_0x21fb('0x6a'),_0x21fb('0x6b'),'set',_0x21fb('0x6c')],_0x834c24[_0x21fb('0x62')][_0x21fb('0x64')]())){channels[_0x834c24[_0x21fb('0x9')]][_0x21fb('0x54')]=_0x834c24['application'];channels[_0x834c24['uniqueid']][_0x21fb('0x56')]=_0x834c24[_0x21fb('0x63')];}}}catch(_0x2260ba){utils[_0x21fb('0x22')](util['format'](_0x21fb('0x61'),_0x834c24['uniqueid']),_0x2260ba);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 8009dc7..ef0c13d 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 _0xcd05=['error','[core]\x20error','close','managerevent','info','[core]\x20shutdown'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xcd05,0x64));var _0x5cd0=function(_0x28578d,_0xcf5cf0){_0x28578d=_0x28578d-0x0;var _0x524826=_0xcd05[_0x28578d];return _0x524826;};'use strict';var utils=require('./utils');exports['connect']=function(){utils['info']('[core]\x20connected');};exports['shutdown']=function(){utils[_0x5cd0('0x0')](_0x5cd0('0x1'));};exports['fullybooted']=function(){utils[_0x5cd0('0x0')]('[core]\x20fullybooted');};exports[_0x5cd0('0x2')]=function(_0x50e5cc){utils[_0x5cd0('0x2')](_0x5cd0('0x3'),_0x50e5cc);};exports[_0x5cd0('0x4')]=function(){utils[_0x5cd0('0x0')]('[core]\x20close');};exports[_0x5cd0('0x5')]=function(_0x839964){}; \ No newline at end of file +var _0xed36=['error','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','info','[core]\x20shutdown','fullybooted','[core]\x20fullybooted'];(function(_0x5551a0,_0x1ffb13){var _0x172652=function(_0x47268d){while(--_0x47268d){_0x5551a0['push'](_0x5551a0['shift']());}};_0x172652(++_0x1ffb13);}(_0xed36,0xaa));var _0x6ed3=function(_0x2993a6,_0x552be4){_0x2993a6=_0x2993a6-0x0;var _0x2f6d88=_0xed36[_0x2993a6];return _0x2f6d88;};'use strict';var utils=require(_0x6ed3('0x0'));exports[_0x6ed3('0x1')]=function(){utils[_0x6ed3('0x2')]('[core]\x20connected');};exports['shutdown']=function(){utils[_0x6ed3('0x2')](_0x6ed3('0x3'));};exports[_0x6ed3('0x4')]=function(){utils[_0x6ed3('0x2')](_0x6ed3('0x5'));};exports[_0x6ed3('0x6')]=function(_0x258989){utils[_0x6ed3('0x6')](_0x6ed3('0x7'),_0x258989);};exports[_0x6ed3('0x8')]=function(){utils['info'](_0x6ed3('0x9'));};exports[_0x6ed3('0xa')]=function(_0x2838b2){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index a4396df..2c1b17a 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 _0x9f48=['error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','called','[%s][dials][dialend]','ANSWER','answertime','lastevent','connect','[%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','cause-txt','endtime','holdtime','diffTime','billableseconds','lodash','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','dialstring','calleridnum','connectedlinenum','dialstatus','request','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split'];(function(_0x3c0095,_0x4d6642){var _0x33a6a6=function(_0x198050){while(--_0x198050){_0x3c0095['push'](_0x3c0095['shift']());}};_0x33a6a6(++_0x4d6642);}(_0x9f48,0x1de));var _0x89f4=function(_0x2adb30,_0x32650c){_0x2adb30=_0x2adb30-0x0;var _0x27f506=_0x9f48[_0x2adb30];return _0x27f506;};'use strict';var _=require(_0x89f4('0x0'));var util=require('util');var utils=require(_0x89f4('0x1'));var dials={};function writeDB(_0x5a4b66){utils[_0x89f4('0x2')](util[_0x89f4('0x3')](_0x89f4('0x4'),_0x5a4b66[_0x89f4('0x5')],_0x5a4b66['channel'],_0x5a4b66[_0x89f4('0x6')],_0x5a4b66[_0x89f4('0x7')],_0x5a4b66[_0x89f4('0x8')],_0x5a4b66[_0x89f4('0x9')]));utils[_0x89f4('0xa')]('CreateVoiceDialReport',_0x5a4b66);delete dials[_0x5a4b66[_0x89f4('0x5')]];}exports[_0x89f4('0xb')]=function(_0x24b880){try{utils[_0x89f4('0xc')](util[_0x89f4('0x3')](_0x89f4('0xd'),_0x24b880[_0x89f4('0x5')]),_0x24b880);utils['info'](util[_0x89f4('0x3')](_0x89f4('0xe'),_0x24b880[_0x89f4('0x5')],_0x24b880[_0x89f4('0xf')],_0x24b880[_0x89f4('0x10')]));if(_0x24b880['application'][_0x89f4('0x11')]()==_0x89f4('0x12')&&_[_0x89f4('0x13')](_0x24b880[_0x89f4('0x10')][_0x89f4('0x11')](),_0x89f4('0x14'))){var _0x28baaf=_0x24b880[_0x89f4('0x10')][_0x89f4('0x15')]('=');dials[_0x24b880[_0x89f4('0x5')]]={'routeId':_0x28baaf[0x1]};}}catch(_0x2f40db){utils[_0x89f4('0x16')](util['format']('[%s][dials][newexten]',_0x24b880['uniqueid']),_0x2f40db);}};exports[_0x89f4('0x17')]=function(_0x58321b){try{utils[_0x89f4('0xc')](util[_0x89f4('0x3')](_0x89f4('0x18'),_0x58321b['uniqueid']),_0x58321b);if(!_[_0x89f4('0x19')](_0x58321b[_0x89f4('0x1a')][_0x89f4('0x1b')])){utils[_0x89f4('0x2')](util[_0x89f4('0x3')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x58321b[_0x89f4('0x5')],_0x58321b[_0x89f4('0x1c')]));dials[_0x58321b[_0x89f4('0x5')]]={'routeId':_0x58321b[_0x89f4('0x1c')]};}}catch(_0x5eba0e){utils[_0x89f4('0x16')](util['format']('[%s][dials][varset]',_0x58321b[_0x89f4('0x5')]),_0x5eba0e);}};exports[_0x89f4('0x1d')]=function(_0x42f54a){try{if(!_[_0x89f4('0x19')](dials[_0x42f54a[_0x89f4('0x5')]])){utils['debug'](util[_0x89f4('0x3')](_0x89f4('0x1e'),_0x42f54a['uniqueid']),_0x42f54a);dials[_0x42f54a['uniqueid']]=_[_0x89f4('0x1f')](dials[_0x42f54a['uniqueid']],_0x42f54a);dials[_0x42f54a[_0x89f4('0x5')]][_0x89f4('0x20')]=utils[_0x89f4('0x21')]();dials[_0x42f54a['uniqueid']]['lastevent']=_0x89f4('0x22');utils[_0x89f4('0x2')](util[_0x89f4('0x3')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x42f54a[_0x89f4('0x5')],dials[_0x42f54a['uniqueid']]['starttime']));}}catch(_0x14cbf0){utils[_0x89f4('0x16')](util[_0x89f4('0x3')](_0x89f4('0x1e'),_0x42f54a['uniqueid']),_0x14cbf0);}};exports['dialend']=function(_0x4f9044){try{if(!_[_0x89f4('0x19')](dials[_0x4f9044[_0x89f4('0x5')]])){utils[_0x89f4('0xc')](util[_0x89f4('0x3')](_0x89f4('0x23'),_0x4f9044[_0x89f4('0x5')]),_0x4f9044);dials[_0x4f9044[_0x89f4('0x5')]]['dialstatus']=_0x4f9044['dialstatus'];if(_0x4f9044[_0x89f4('0x9')]==_0x89f4('0x24')){dials[_0x4f9044[_0x89f4('0x5')]]=_['assign'](dials[_0x4f9044[_0x89f4('0x5')]],_0x4f9044);dials[_0x4f9044[_0x89f4('0x5')]][_0x89f4('0x25')]=utils[_0x89f4('0x21')]();dials[_0x4f9044[_0x89f4('0x5')]][_0x89f4('0x26')]=_0x89f4('0x27');utils[_0x89f4('0x2')](util[_0x89f4('0x3')](_0x89f4('0x28'),_0x4f9044[_0x89f4('0x5')],_0x4f9044[_0x89f4('0x9')],dials[_0x4f9044[_0x89f4('0x5')]][_0x89f4('0x25')]));}else{utils['info'](util[_0x89f4('0x3')](_0x89f4('0x29'),_0x4f9044[_0x89f4('0x5')],_0x4f9044['dialstatus']));}}}catch(_0x2d1000){utils['error'](util[_0x89f4('0x3')](_0x89f4('0x23'),_0x4f9044['uniqueid']),_0x2d1000);}};exports[_0x89f4('0x2a')]=function(_0x4922f9){try{if(!_[_0x89f4('0x19')](dials[_0x4922f9[_0x89f4('0x5')]])){utils['debug'](util[_0x89f4('0x3')](_0x89f4('0x2b'),_0x4922f9['uniqueid']),_0x4922f9);utils['info'](util[_0x89f4('0x3')](_0x89f4('0x2c'),_0x4922f9['uniqueid'],_0x4922f9[_0x89f4('0x7')],_0x4922f9['calleridname'],_0x4922f9[_0x89f4('0x2d')]));dials[_0x4922f9[_0x89f4('0x5')]]=_[_0x89f4('0x1f')](dials[_0x4922f9['uniqueid']],{'endtime':utils[_0x89f4('0x21')](),'lastevent':'complete'});dials[_0x4922f9[_0x89f4('0x5')]]['duration']=utils['diffTime'](dials[_0x4922f9['uniqueid']][_0x89f4('0x2e')],dials[_0x4922f9[_0x89f4('0x5')]][_0x89f4('0x20')]);dials[_0x4922f9['uniqueid']][_0x89f4('0x2f')]=utils[_0x89f4('0x30')](dials[_0x4922f9['uniqueid']]['answertime']||dials[_0x4922f9[_0x89f4('0x5')]]['endtime'],dials[_0x4922f9[_0x89f4('0x5')]][_0x89f4('0x20')]);dials[_0x4922f9['uniqueid']][_0x89f4('0x31')]=dials[_0x4922f9[_0x89f4('0x5')]][_0x89f4('0x25')]?utils[_0x89f4('0x30')](dials[_0x4922f9[_0x89f4('0x5')]][_0x89f4('0x2e')],dials[_0x4922f9['uniqueid']]['answertime']):0x0;writeDB(dials[_0x4922f9[_0x89f4('0x5')]]);}}catch(_0x5aea30){utils[_0x89f4('0x16')](util[_0x89f4('0x3')](_0x89f4('0x2b'),_0x4922f9['uniqueid']),_0x5aea30);}}; \ No newline at end of file +var _0x6c6b=['outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','dialbegin','isNil','[%s][dials][dialbegin]','assign','starttime','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','debug','[%s][dials][dialend]','dialstatus','ANSWER','connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','complete','duration','diffTime','endtime','holdtime','billableseconds','[%s][dials][hangup]','lodash','util','./utils','info','uniqueid','channel','calleridnum','request','CreateVoiceDialReport','newexten','[%s][dials][newexten]','format','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr(routeid)','split','varset','[%s][dials][varset]','variable'];(function(_0x207d2f,_0x44400f){var _0x3c3498=function(_0x57fdfb){while(--_0x57fdfb){_0x207d2f['push'](_0x207d2f['shift']());}};_0x3c3498(++_0x44400f);}(_0x6c6b,0x191));var _0xb6c6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6c6b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xb6c6('0x0'));var util=require(_0xb6c6('0x1'));var utils=require(_0xb6c6('0x2'));var dials={};function writeDB(_0x4fdae9){utils[_0xb6c6('0x3')](util['format']('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x4fdae9[_0xb6c6('0x4')],_0x4fdae9[_0xb6c6('0x5')],_0x4fdae9['dialstring'],_0x4fdae9[_0xb6c6('0x6')],_0x4fdae9['connectedlinenum'],_0x4fdae9['dialstatus']));utils[_0xb6c6('0x7')](_0xb6c6('0x8'),_0x4fdae9);delete dials[_0x4fdae9[_0xb6c6('0x4')]];}exports[_0xb6c6('0x9')]=function(_0x4c5acb){try{utils['debug'](util['format'](_0xb6c6('0xa'),_0x4c5acb[_0xb6c6('0x4')]),_0x4c5acb);utils[_0xb6c6('0x3')](util[_0xb6c6('0xb')](_0xb6c6('0xc'),_0x4c5acb[_0xb6c6('0x4')],_0x4c5acb['application'],_0x4c5acb[_0xb6c6('0xd')]));if(_0x4c5acb[_0xb6c6('0xe')][_0xb6c6('0xf')]()==_0xb6c6('0x10')&&_[_0xb6c6('0x11')](_0x4c5acb['appdata'][_0xb6c6('0xf')](),_0xb6c6('0x12'))){var _0x220a0f=_0x4c5acb[_0xb6c6('0xd')][_0xb6c6('0x13')]('=');dials[_0x4c5acb[_0xb6c6('0x4')]]={'routeId':_0x220a0f[0x1]};}}catch(_0x557668){utils['error'](util[_0xb6c6('0xb')]('[%s][dials][newexten]',_0x4c5acb[_0xb6c6('0x4')]),_0x557668);}};exports[_0xb6c6('0x14')]=function(_0x3bfd0f){try{utils['debug'](util[_0xb6c6('0xb')](_0xb6c6('0x15'),_0x3bfd0f[_0xb6c6('0x4')]),_0x3bfd0f);if(!_['isNil'](_0x3bfd0f[_0xb6c6('0x16')][_0xb6c6('0x17')])){utils[_0xb6c6('0x3')](util[_0xb6c6('0xb')](_0xb6c6('0x18'),_0x3bfd0f[_0xb6c6('0x4')],_0x3bfd0f[_0xb6c6('0x19')]));dials[_0x3bfd0f['uniqueid']]={'routeId':_0x3bfd0f[_0xb6c6('0x19')]};}}catch(_0x7b3aca){utils[_0xb6c6('0x1a')](util[_0xb6c6('0xb')](_0xb6c6('0x15'),_0x3bfd0f[_0xb6c6('0x4')]),_0x7b3aca);}};exports[_0xb6c6('0x1b')]=function(_0x1dbfbc){try{if(!_[_0xb6c6('0x1c')](dials[_0x1dbfbc[_0xb6c6('0x4')]])){utils['debug'](util['format'](_0xb6c6('0x1d'),_0x1dbfbc[_0xb6c6('0x4')]),_0x1dbfbc);dials[_0x1dbfbc[_0xb6c6('0x4')]]=_[_0xb6c6('0x1e')](dials[_0x1dbfbc[_0xb6c6('0x4')]],_0x1dbfbc);dials[_0x1dbfbc[_0xb6c6('0x4')]][_0xb6c6('0x1f')]=utils[_0xb6c6('0x20')]();dials[_0x1dbfbc['uniqueid']][_0xb6c6('0x21')]='called';utils[_0xb6c6('0x3')](util[_0xb6c6('0xb')](_0xb6c6('0x22'),_0x1dbfbc[_0xb6c6('0x4')],dials[_0x1dbfbc['uniqueid']][_0xb6c6('0x1f')]));}}catch(_0x30112a){utils[_0xb6c6('0x1a')](util[_0xb6c6('0xb')](_0xb6c6('0x1d'),_0x1dbfbc['uniqueid']),_0x30112a);}};exports[_0xb6c6('0x23')]=function(_0x50dc85){try{if(!_[_0xb6c6('0x1c')](dials[_0x50dc85[_0xb6c6('0x4')]])){utils[_0xb6c6('0x24')](util['format'](_0xb6c6('0x25'),_0x50dc85['uniqueid']),_0x50dc85);dials[_0x50dc85[_0xb6c6('0x4')]][_0xb6c6('0x26')]=_0x50dc85[_0xb6c6('0x26')];if(_0x50dc85[_0xb6c6('0x26')]==_0xb6c6('0x27')){dials[_0x50dc85[_0xb6c6('0x4')]]=_[_0xb6c6('0x1e')](dials[_0x50dc85[_0xb6c6('0x4')]],_0x50dc85);dials[_0x50dc85[_0xb6c6('0x4')]]['answertime']=utils[_0xb6c6('0x20')]();dials[_0x50dc85[_0xb6c6('0x4')]][_0xb6c6('0x21')]=_0xb6c6('0x28');utils['info'](util[_0xb6c6('0xb')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x50dc85[_0xb6c6('0x4')],_0x50dc85[_0xb6c6('0x26')],dials[_0x50dc85[_0xb6c6('0x4')]][_0xb6c6('0x29')]));}else{utils[_0xb6c6('0x3')](util[_0xb6c6('0xb')](_0xb6c6('0x2a'),_0x50dc85['uniqueid'],_0x50dc85[_0xb6c6('0x26')]));}}}catch(_0x14598b){utils[_0xb6c6('0x1a')](util[_0xb6c6('0xb')]('[%s][dials][dialend]',_0x50dc85[_0xb6c6('0x4')]),_0x14598b);}};exports[_0xb6c6('0x2b')]=function(_0x2ac1bc){try{if(!_[_0xb6c6('0x1c')](dials[_0x2ac1bc[_0xb6c6('0x4')]])){utils[_0xb6c6('0x24')](util['format']('[%s][dials][hangup]',_0x2ac1bc[_0xb6c6('0x4')]),_0x2ac1bc);utils[_0xb6c6('0x3')](util[_0xb6c6('0xb')](_0xb6c6('0x2c'),_0x2ac1bc[_0xb6c6('0x4')],_0x2ac1bc['calleridnum'],_0x2ac1bc[_0xb6c6('0x2d')],_0x2ac1bc['cause-txt']));dials[_0x2ac1bc[_0xb6c6('0x4')]]=_[_0xb6c6('0x1e')](dials[_0x2ac1bc['uniqueid']],{'endtime':utils[_0xb6c6('0x20')](),'lastevent':_0xb6c6('0x2e')});dials[_0x2ac1bc[_0xb6c6('0x4')]][_0xb6c6('0x2f')]=utils[_0xb6c6('0x30')](dials[_0x2ac1bc['uniqueid']][_0xb6c6('0x31')],dials[_0x2ac1bc[_0xb6c6('0x4')]]['starttime']);dials[_0x2ac1bc[_0xb6c6('0x4')]][_0xb6c6('0x32')]=utils[_0xb6c6('0x30')](dials[_0x2ac1bc[_0xb6c6('0x4')]][_0xb6c6('0x29')]||dials[_0x2ac1bc[_0xb6c6('0x4')]][_0xb6c6('0x31')],dials[_0x2ac1bc['uniqueid']]['starttime']);dials[_0x2ac1bc[_0xb6c6('0x4')]][_0xb6c6('0x33')]=dials[_0x2ac1bc[_0xb6c6('0x4')]]['answertime']?utils[_0xb6c6('0x30')](dials[_0x2ac1bc['uniqueid']]['endtime'],dials[_0x2ac1bc[_0xb6c6('0x4')]][_0xb6c6('0x29')]):0x0;writeDB(dials[_0x2ac1bc[_0xb6c6('0x4')]]);}}catch(_0x1b7d56){utils[_0xb6c6('0x1a')](util[_0xb6c6('0xb')](_0xb6c6('0x34'),_0x2ac1bc[_0xb6c6('0x4')]),_0x1b7d56);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 76a6d39..f73e5f3 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 _0x569f=['asterisk','port','username','password','keepConnected','xdr','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','fullybooted','error','close','devicestatechange','debug','[%s][index][devicestatechange]','device','format','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util'];(function(_0x3b366d,_0x57d5ac){var _0x1ea933=function(_0xe53e3a){while(--_0xe53e3a){_0x3b366d['push'](_0x3b366d['shift']());}};_0x1ea933(++_0x57d5ac);}(_0x569f,0xcb));var _0xf569=function(_0x23b3e0,_0x802d57){_0x23b3e0=_0x23b3e0-0x0;var _0x122558=_0x569f[_0x23b3e0];return _0x122558;};var AsteriskManager=require(_0xf569('0x0'));var config=require(_0xf569('0x1'));var utils=require(_0xf569('0x2'));var util=require(_0xf569('0x3'));var ami=new AsteriskManager(config[_0xf569('0x4')][_0xf569('0x5')],config[_0xf569('0x4')]['ip'],config[_0xf569('0x4')][_0xf569('0x6')],config['asterisk'][_0xf569('0x7')],!![]);ami[_0xf569('0x8')]();if(config['xdr']&&config[_0xf569('0x9')]['disabled']){utils[_0xf569('0xa')](_0xf569('0xb'));}else{var agents=require(_0xf569('0xc'));var calls=require(_0xf569('0xd'));var queues=require(_0xf569('0xe'));var recordings=require(_0xf569('0xf'));var members=require(_0xf569('0x10'));var dials=require(_0xf569('0x11'));var transfers=require(_0xf569('0x12'));var core=require('./core.controller');ami['on']('connect',core[_0xf569('0x13')]);ami['on']('shutdown',core['shutdown']);ami['on'](_0xf569('0x14'),core['fullybooted']);ami['on'](_0xf569('0x15'),core[_0xf569('0x15')]);ami['on'](_0xf569('0x16'),core['close']);ami['on']('managerevent',core['managerevent']);ami['on'](_0xf569('0x17'),function(_0x253f29){try{utils[_0xf569('0x18')](util['format'](_0xf569('0x19'),_0x253f29[_0xf569('0x1a')]),_0x253f29);members[_0xf569('0x17')](_0x253f29);}catch(_0x3fea16){utils[_0xf569('0x15')](util[_0xf569('0x1b')](_0xf569('0x19'),_0x253f29[_0xf569('0x1a')]),_0x3fea16);}});ami['on'](_0xf569('0x1c'),function(_0x4c64ab){try{utils[_0xf569('0x18')](util[_0xf569('0x1b')](_0xf569('0x1d'),_0x4c64ab[_0xf569('0x1e')]),_0x4c64ab);agents[_0xf569('0x1c')](_0x4c64ab);}catch(_0x1d901a){utils[_0xf569('0x15')](util[_0xf569('0x1b')](_0xf569('0x1d'),_0x4c64ab['uniqueid']),_0x1d901a);}});ami['on'](_0xf569('0x1f'),function(_0x48b836){try{utils[_0xf569('0x18')](util['format']('[%s][index][agentringnoanswer]',_0x48b836['uniqueid']),_0x48b836);agents[_0xf569('0x1f')](_0x48b836);}catch(_0x24b49a){utils[_0xf569('0x15')](util[_0xf569('0x1b')](_0xf569('0x20'),_0x48b836[_0xf569('0x1e')]),_0x24b49a);}});ami['on'](_0xf569('0x21'),function(_0xdd3f67){try{utils[_0xf569('0x18')](util['format'](_0xf569('0x22'),_0xdd3f67[_0xf569('0x1e')]),_0xdd3f67);agents[_0xf569('0x21')](_0xdd3f67);queues[_0xf569('0x21')](_0xdd3f67);}catch(_0x5f163f){utils[_0xf569('0x15')](util['format'](_0xf569('0x22'),_0xdd3f67['uniqueid']),_0x5f163f);}});ami['on'](_0xf569('0x23'),function(_0x267be0){try{utils[_0xf569('0x18')](util[_0xf569('0x1b')](_0xf569('0x24'),_0x267be0[_0xf569('0x1e')]),_0x267be0);agents[_0xf569('0x23')](_0x267be0);queues['agentcomplete'](_0x267be0);members[_0xf569('0x23')](_0x267be0);}catch(_0x4a80da){utils[_0xf569('0x15')](util[_0xf569('0x1b')](_0xf569('0x24'),_0x267be0[_0xf569('0x1e')]),_0x4a80da);}});ami['on'](_0xf569('0x25'),function(_0x254c30){try{utils[_0xf569('0x18')](util[_0xf569('0x1b')](_0xf569('0x26'),_0x254c30[_0xf569('0x1e')]),_0x254c30);agents[_0xf569('0x25')](_0x254c30);queues[_0xf569('0x25')](_0x254c30);}catch(_0x1a53c4){utils['error'](util[_0xf569('0x1b')](_0xf569('0x26'),_0x254c30[_0xf569('0x1e')]),_0x1a53c4);}});ami['on'](_0xf569('0x27'),function(_0x2f9e76){try{utils[_0xf569('0x18')](util[_0xf569('0x1b')]('[%s][index][queuecallerjoin]',_0x2f9e76[_0xf569('0x1e')]),_0x2f9e76);queues[_0xf569('0x27')](_0x2f9e76);recordings['queuecallerjoin'](_0x2f9e76);}catch(_0x45dfab){utils['error'](util[_0xf569('0x1b')](_0xf569('0x28'),_0x2f9e76[_0xf569('0x1e')]),_0x45dfab);}});ami['on'](_0xf569('0x29'),function(_0x2eb5c4){try{utils[_0xf569('0x18')](util[_0xf569('0x1b')](_0xf569('0x2a'),_0x2eb5c4[_0xf569('0x1e')]),_0x2eb5c4);queues['queuecallerleave'](_0x2eb5c4);}catch(_0x2ce0d7){utils[_0xf569('0x15')](util[_0xf569('0x1b')](_0xf569('0x2a'),_0x2eb5c4[_0xf569('0x1e')]),_0x2ce0d7);}});ami['on'](_0xf569('0x2b'),function(_0x4ecdaf){try{utils[_0xf569('0x18')](util[_0xf569('0x1b')](_0xf569('0x2c'),_0x4ecdaf[_0xf569('0x1e')]),_0x4ecdaf);queues[_0xf569('0x2b')](_0x4ecdaf);calls[_0xf569('0x2b')](_0x4ecdaf);}catch(_0x3777d5){utils[_0xf569('0x15')](util[_0xf569('0x1b')](_0xf569('0x2c'),_0x4ecdaf[_0xf569('0x1e')]),_0x3777d5);}});ami['on']('musiconholdstop',function(_0x4fea47){try{utils[_0xf569('0x18')](util['format'](_0xf569('0x2d'),_0x4fea47['uniqueid']),_0x4fea47);queues[_0xf569('0x2e')](_0x4fea47);calls[_0xf569('0x2e')](_0x4fea47);}catch(_0x627ebe){utils['error'](util[_0xf569('0x1b')](_0xf569('0x2d'),_0x4fea47[_0xf569('0x1e')]),_0x627ebe);}});ami['on'](_0xf569('0x2f'),function(_0x4a7802){try{utils['debug'](util[_0xf569('0x1b')](_0xf569('0x30'),_0x4a7802[_0xf569('0x1e')]),_0x4a7802);calls[_0xf569('0x2f')](_0x4a7802);recordings[_0xf569('0x2f')](_0x4a7802);}catch(_0x57c7d2){utils[_0xf569('0x15')](util[_0xf569('0x1b')](_0xf569('0x30'),_0x4a7802[_0xf569('0x1e')]),_0x57c7d2);}});ami['on']('hangup',function(_0x191125){try{utils['debug'](util[_0xf569('0x1b')]('[%s][index][hangup]',_0x191125[_0xf569('0x1e')]),_0x191125);calls[_0xf569('0x31')](_0x191125);recordings[_0xf569('0x31')](_0x191125);dials[_0xf569('0x31')](_0x191125);agents[_0xf569('0x31')](_0x191125);queues[_0xf569('0x31')](_0x191125);}catch(_0x7f934a){utils['error'](util[_0xf569('0x1b')](_0xf569('0x32'),_0x191125[_0xf569('0x1e')]),_0x7f934a);}});ami['on'](_0xf569('0x33'),function(_0x24d77d){try{utils[_0xf569('0x18')](util[_0xf569('0x1b')]('[%s][index][cdr]',_0x24d77d[_0xf569('0x1e')]),_0x24d77d);members[_0xf569('0x33')](_0x24d77d);}catch(_0x30a6d4){utils[_0xf569('0x15')](util[_0xf569('0x1b')](_0xf569('0x34'),_0x24d77d['uniqueid']),_0x30a6d4);}});ami['on']('blindtransfer',function(_0x31697b){try{utils[_0xf569('0x18')](util['format'](_0xf569('0x35'),_0x31697b[_0xf569('0x1e')]),_0x31697b);queues[_0xf569('0x36')](_0x31697b);agents['blindtransfer'](_0x31697b);transfers[_0xf569('0x36')](_0x31697b);recordings[_0xf569('0x36')](_0x31697b);}catch(_0x400938){utils[_0xf569('0x15')](util[_0xf569('0x1b')]('[%s][index][blindtransfer]',_0x31697b[_0xf569('0x1e')]),_0x400938);}});ami['on']('attendedtransfer',function(_0x512806){try{utils[_0xf569('0x18')](util[_0xf569('0x1b')](_0xf569('0x37'),_0x512806[_0xf569('0x38')]),_0x512806);queues[_0xf569('0x39')](_0x512806);transfers[_0xf569('0x39')](_0x512806);agents[_0xf569('0x39')](_0x512806);calls['attendedtransfer'](_0x512806);}catch(_0x23600a){utils['error'](util[_0xf569('0x1b')](_0xf569('0x37'),_0x512806['origtransfereruniqueid']),_0x23600a);}});ami['on'](_0xf569('0x3a'),function(_0x1fbe96){try{utils['debug'](util[_0xf569('0x1b')](_0xf569('0x3b'),_0x1fbe96[_0xf569('0x1e')]),_0x1fbe96);queues[_0xf569('0x3a')](_0x1fbe96);recordings[_0xf569('0x3a')](_0x1fbe96);calls[_0xf569('0x3a')](_0x1fbe96);dials[_0xf569('0x3a')](_0x1fbe96);}catch(_0x18a65e){utils[_0xf569('0x15')](util[_0xf569('0x1b')]('[%s][index][varset]',_0x1fbe96[_0xf569('0x1e')]),_0x18a65e);}});ami['on']('newexten',function(_0x38fcdb){try{utils[_0xf569('0x18')](util['format'](_0xf569('0x3c'),_0x38fcdb[_0xf569('0x1e')]),_0x38fcdb);calls[_0xf569('0x3d')](_0x38fcdb);recordings[_0xf569('0x3d')](_0x38fcdb);dials[_0xf569('0x3d')](_0x38fcdb);}catch(_0x3faadc){utils['error'](util[_0xf569('0x1b')](_0xf569('0x3c'),_0x38fcdb[_0xf569('0x1e')]),_0x3faadc);}});ami['on'](_0xf569('0x3e'),function(_0x4e42c1){try{utils['debug'](util[_0xf569('0x1b')](_0xf569('0x3f'),_0x4e42c1[_0xf569('0x1e')]),_0x4e42c1);calls[_0xf569('0x3e')](_0x4e42c1);recordings[_0xf569('0x3e')](_0x4e42c1);}catch(_0x27a984){utils[_0xf569('0x15')](util[_0xf569('0x1b')](_0xf569('0x3f'),_0x4e42c1[_0xf569('0x1e')]),_0x27a984);}});ami['on'](_0xf569('0x40'),function(_0x32f2c1){try{utils[_0xf569('0x18')](util['format'](_0xf569('0x41'),_0x32f2c1['uniqueid']),_0x32f2c1);dials['dialbegin'](_0x32f2c1);}catch(_0x3ec474){utils['error'](util[_0xf569('0x1b')](_0xf569('0x42'),_0x32f2c1[_0xf569('0x1e')]),_0x3ec474);}});ami['on'](_0xf569('0x43'),function(_0x50123d){try{utils[_0xf569('0x18')](util[_0xf569('0x1b')]('[%s][index][dialend]',_0x50123d[_0xf569('0x1e')]),_0x50123d);dials[_0xf569('0x43')](_0x50123d);}catch(_0x3ffc99){utils[_0xf569('0x15')](util[_0xf569('0x1b')](_0xf569('0x44'),_0x50123d[_0xf569('0x1e')]),_0x3ffc99);}});} \ No newline at end of file +var _0x3cae=['username','password','keepConnected','xdr','disabled','XDR\x20DISABLED','./calls.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','device','[%s][index][devicestatechange]','agentcalled','uniqueid','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','asterisk','port'];(function(_0x1c50ef,_0x394c24){var _0x223298=function(_0x2946bb){while(--_0x2946bb){_0x1c50ef['push'](_0x1c50ef['shift']());}};_0x223298(++_0x394c24);}(_0x3cae,0xff));var _0xe3ca=function(_0x4099ee,_0x38495a){_0x4099ee=_0x4099ee-0x0;var _0x1b7bfc=_0x3cae[_0x4099ee];return _0x1b7bfc;};var AsteriskManager=require(_0xe3ca('0x0'));var config=require(_0xe3ca('0x1'));var utils=require(_0xe3ca('0x2'));var util=require('util');var ami=new AsteriskManager(config[_0xe3ca('0x3')][_0xe3ca('0x4')],config[_0xe3ca('0x3')]['ip'],config['asterisk'][_0xe3ca('0x5')],config[_0xe3ca('0x3')][_0xe3ca('0x6')],!![]);ami[_0xe3ca('0x7')]();if(config[_0xe3ca('0x8')]&&config[_0xe3ca('0x8')][_0xe3ca('0x9')]){utils['info'](_0xe3ca('0xa'));}else{var agents=require('./agents.controller');var calls=require(_0xe3ca('0xb'));var queues=require('./queues.controller');var recordings=require('./recordings.controller');var members=require(_0xe3ca('0xc'));var dials=require(_0xe3ca('0xd'));var transfers=require(_0xe3ca('0xe'));var core=require(_0xe3ca('0xf'));ami['on']('connect',core['connect']);ami['on'](_0xe3ca('0x10'),core[_0xe3ca('0x10')]);ami['on']('fullybooted',core[_0xe3ca('0x11')]);ami['on'](_0xe3ca('0x12'),core[_0xe3ca('0x12')]);ami['on'](_0xe3ca('0x13'),core[_0xe3ca('0x13')]);ami['on'](_0xe3ca('0x14'),core['managerevent']);ami['on'](_0xe3ca('0x15'),function(_0x164979){try{utils[_0xe3ca('0x16')](util[_0xe3ca('0x17')]('[%s][index][devicestatechange]',_0x164979[_0xe3ca('0x18')]),_0x164979);members[_0xe3ca('0x15')](_0x164979);}catch(_0x49b994){utils[_0xe3ca('0x12')](util[_0xe3ca('0x17')](_0xe3ca('0x19'),_0x164979[_0xe3ca('0x18')]),_0x49b994);}});ami['on'](_0xe3ca('0x1a'),function(_0xbbb138){try{utils[_0xe3ca('0x16')](util[_0xe3ca('0x17')]('[%s][index][agentcalled]',_0xbbb138[_0xe3ca('0x1b')]),_0xbbb138);agents['agentcalled'](_0xbbb138);}catch(_0x3166e1){utils['error'](util['format'](_0xe3ca('0x1c'),_0xbbb138[_0xe3ca('0x1b')]),_0x3166e1);}});ami['on'](_0xe3ca('0x1d'),function(_0x4d6b2f){try{utils[_0xe3ca('0x16')](util[_0xe3ca('0x17')](_0xe3ca('0x1e'),_0x4d6b2f[_0xe3ca('0x1b')]),_0x4d6b2f);agents['agentringnoanswer'](_0x4d6b2f);}catch(_0x90c05b){utils['error'](util[_0xe3ca('0x17')](_0xe3ca('0x1e'),_0x4d6b2f[_0xe3ca('0x1b')]),_0x90c05b);}});ami['on'](_0xe3ca('0x1f'),function(_0x5c2a82){try{utils['debug'](util['format']('[%s][index][agentconnect]',_0x5c2a82[_0xe3ca('0x1b')]),_0x5c2a82);agents['agentconnect'](_0x5c2a82);queues[_0xe3ca('0x1f')](_0x5c2a82);}catch(_0x281604){utils[_0xe3ca('0x12')](util['format']('[%s][index][agentconnect]',_0x5c2a82[_0xe3ca('0x1b')]),_0x281604);}});ami['on'](_0xe3ca('0x20'),function(_0x172fe3){try{utils[_0xe3ca('0x16')](util['format'](_0xe3ca('0x21'),_0x172fe3[_0xe3ca('0x1b')]),_0x172fe3);agents[_0xe3ca('0x20')](_0x172fe3);queues[_0xe3ca('0x20')](_0x172fe3);members[_0xe3ca('0x20')](_0x172fe3);}catch(_0x391e5c){utils[_0xe3ca('0x12')](util[_0xe3ca('0x17')]('[%s][index][agentcomplete]',_0x172fe3[_0xe3ca('0x1b')]),_0x391e5c);}});ami['on'](_0xe3ca('0x22'),function(_0x13d463){try{utils[_0xe3ca('0x16')](util['format'](_0xe3ca('0x23'),_0x13d463[_0xe3ca('0x1b')]),_0x13d463);agents[_0xe3ca('0x22')](_0x13d463);queues[_0xe3ca('0x22')](_0x13d463);}catch(_0x38c56e){utils[_0xe3ca('0x12')](util[_0xe3ca('0x17')](_0xe3ca('0x23'),_0x13d463[_0xe3ca('0x1b')]),_0x38c56e);}});ami['on'](_0xe3ca('0x24'),function(_0x534525){try{utils[_0xe3ca('0x16')](util[_0xe3ca('0x17')](_0xe3ca('0x25'),_0x534525[_0xe3ca('0x1b')]),_0x534525);queues[_0xe3ca('0x24')](_0x534525);recordings[_0xe3ca('0x24')](_0x534525);}catch(_0x354e09){utils[_0xe3ca('0x12')](util['format'](_0xe3ca('0x25'),_0x534525[_0xe3ca('0x1b')]),_0x354e09);}});ami['on'](_0xe3ca('0x26'),function(_0x53024c){try{utils[_0xe3ca('0x16')](util[_0xe3ca('0x17')](_0xe3ca('0x27'),_0x53024c[_0xe3ca('0x1b')]),_0x53024c);queues[_0xe3ca('0x26')](_0x53024c);}catch(_0xac786f){utils['error'](util[_0xe3ca('0x17')](_0xe3ca('0x27'),_0x53024c['uniqueid']),_0xac786f);}});ami['on'](_0xe3ca('0x28'),function(_0x4ba7ca){try{utils[_0xe3ca('0x16')](util['format'](_0xe3ca('0x29'),_0x4ba7ca['uniqueid']),_0x4ba7ca);queues[_0xe3ca('0x28')](_0x4ba7ca);calls['musiconholdstart'](_0x4ba7ca);}catch(_0x571e04){utils[_0xe3ca('0x12')](util[_0xe3ca('0x17')](_0xe3ca('0x29'),_0x4ba7ca[_0xe3ca('0x1b')]),_0x571e04);}});ami['on']('musiconholdstop',function(_0x507543){try{utils[_0xe3ca('0x16')](util[_0xe3ca('0x17')]('[%s][index][musiconholdstop]',_0x507543[_0xe3ca('0x1b')]),_0x507543);queues[_0xe3ca('0x2a')](_0x507543);calls[_0xe3ca('0x2a')](_0x507543);}catch(_0x463e22){utils['error'](util['format'](_0xe3ca('0x2b'),_0x507543[_0xe3ca('0x1b')]),_0x463e22);}});ami['on'](_0xe3ca('0x2c'),function(_0x2b19ef){try{utils[_0xe3ca('0x16')](util[_0xe3ca('0x17')](_0xe3ca('0x2d'),_0x2b19ef[_0xe3ca('0x1b')]),_0x2b19ef);calls[_0xe3ca('0x2c')](_0x2b19ef);recordings['newstate'](_0x2b19ef);}catch(_0x2614ba){utils[_0xe3ca('0x12')](util['format'](_0xe3ca('0x2d'),_0x2b19ef['uniqueid']),_0x2614ba);}});ami['on'](_0xe3ca('0x2e'),function(_0x2ec3e1){try{utils[_0xe3ca('0x16')](util[_0xe3ca('0x17')](_0xe3ca('0x2f'),_0x2ec3e1[_0xe3ca('0x1b')]),_0x2ec3e1);calls[_0xe3ca('0x2e')](_0x2ec3e1);recordings[_0xe3ca('0x2e')](_0x2ec3e1);dials['hangup'](_0x2ec3e1);agents[_0xe3ca('0x2e')](_0x2ec3e1);queues[_0xe3ca('0x2e')](_0x2ec3e1);}catch(_0x1084d3){utils['error'](util[_0xe3ca('0x17')](_0xe3ca('0x2f'),_0x2ec3e1[_0xe3ca('0x1b')]),_0x1084d3);}});ami['on']('cdr',function(_0x382aaf){try{utils[_0xe3ca('0x16')](util[_0xe3ca('0x17')](_0xe3ca('0x30'),_0x382aaf[_0xe3ca('0x1b')]),_0x382aaf);members[_0xe3ca('0x31')](_0x382aaf);}catch(_0x3ab027){utils[_0xe3ca('0x12')](util['format'](_0xe3ca('0x30'),_0x382aaf[_0xe3ca('0x1b')]),_0x3ab027);}});ami['on']('blindtransfer',function(_0x43bf1b){try{utils[_0xe3ca('0x16')](util[_0xe3ca('0x17')](_0xe3ca('0x32'),_0x43bf1b[_0xe3ca('0x1b')]),_0x43bf1b);queues[_0xe3ca('0x33')](_0x43bf1b);agents[_0xe3ca('0x33')](_0x43bf1b);transfers['blindtransfer'](_0x43bf1b);recordings['blindtransfer'](_0x43bf1b);}catch(_0x12e099){utils['error'](util[_0xe3ca('0x17')](_0xe3ca('0x32'),_0x43bf1b[_0xe3ca('0x1b')]),_0x12e099);}});ami['on'](_0xe3ca('0x34'),function(_0x1e5afe){try{utils[_0xe3ca('0x16')](util[_0xe3ca('0x17')](_0xe3ca('0x35'),_0x1e5afe[_0xe3ca('0x36')]),_0x1e5afe);queues[_0xe3ca('0x34')](_0x1e5afe);transfers[_0xe3ca('0x34')](_0x1e5afe);agents['attendedtransfer'](_0x1e5afe);calls[_0xe3ca('0x34')](_0x1e5afe);}catch(_0x86381d){utils[_0xe3ca('0x12')](util[_0xe3ca('0x17')](_0xe3ca('0x35'),_0x1e5afe[_0xe3ca('0x36')]),_0x86381d);}});ami['on']('varset',function(_0xdc6811){try{utils[_0xe3ca('0x16')](util[_0xe3ca('0x17')](_0xe3ca('0x37'),_0xdc6811['uniqueid']),_0xdc6811);queues[_0xe3ca('0x38')](_0xdc6811);recordings[_0xe3ca('0x38')](_0xdc6811);calls[_0xe3ca('0x38')](_0xdc6811);dials['varset'](_0xdc6811);}catch(_0x1ef5a1){utils[_0xe3ca('0x12')](util[_0xe3ca('0x17')](_0xe3ca('0x37'),_0xdc6811[_0xe3ca('0x1b')]),_0x1ef5a1);}});ami['on'](_0xe3ca('0x39'),function(_0x224cb8){try{utils[_0xe3ca('0x16')](util[_0xe3ca('0x17')]('[%s][index][newexten]',_0x224cb8[_0xe3ca('0x1b')]),_0x224cb8);calls[_0xe3ca('0x39')](_0x224cb8);recordings[_0xe3ca('0x39')](_0x224cb8);dials[_0xe3ca('0x39')](_0x224cb8);}catch(_0x3f6cf8){utils[_0xe3ca('0x12')](util[_0xe3ca('0x17')](_0xe3ca('0x3a'),_0x224cb8[_0xe3ca('0x1b')]),_0x3f6cf8);}});ami['on']('newchannel',function(_0x3fc238){try{utils['debug'](util['format'](_0xe3ca('0x3b'),_0x3fc238[_0xe3ca('0x1b')]),_0x3fc238);calls['newchannel'](_0x3fc238);recordings['newchannel'](_0x3fc238);}catch(_0x51e360){utils[_0xe3ca('0x12')](util['format'](_0xe3ca('0x3b'),_0x3fc238['uniqueid']),_0x51e360);}});ami['on'](_0xe3ca('0x3c'),function(_0x504ccb){try{utils[_0xe3ca('0x16')](util[_0xe3ca('0x17')](_0xe3ca('0x3d'),_0x504ccb[_0xe3ca('0x1b')]),_0x504ccb);dials[_0xe3ca('0x3c')](_0x504ccb);}catch(_0x3ab0fd){utils[_0xe3ca('0x12')](util[_0xe3ca('0x17')](_0xe3ca('0x3e'),_0x504ccb[_0xe3ca('0x1b')]),_0x3ab0fd);}});ami['on'](_0xe3ca('0x3f'),function(_0x280ab7){try{utils[_0xe3ca('0x16')](util[_0xe3ca('0x17')](_0xe3ca('0x40'),_0x280ab7['uniqueid']),_0x280ab7);dials[_0xe3ca('0x3f')](_0x280ab7);}catch(_0x3a5f79){utils[_0xe3ca('0x12')](util[_0xe3ca('0x17')](_0xe3ca('0x40'),_0x280ab7[_0xe3ca('0x1b')]),_0x3a5f79);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 377d499..efcecea 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 _0xc0f3=['data3','destination','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','util','./utils','Local/_attended@transfer','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','type','getUserByInterface','membername','name','internal','CreateMemberReport','getUserByName','split','request','catch','format','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','error','[%s][members][devicestatechange]','agentcomplete','info','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][cdr]','data1','source'];(function(_0x218396,_0x52b9ef){var _0x26e705=function(_0x3d5e89){while(--_0x3d5e89){_0x218396['push'](_0x218396['shift']());}};_0x26e705(++_0x52b9ef);}(_0xc0f3,0x1d8));var _0x3c0f=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xc0f3[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x3c0f('0x0'));var utils=require(_0x3c0f('0x1'));var members={};var exclude=[_0x3c0f('0x2'),'Queue:'];function writeDB(_0x3168a0){utils['info'](util['format'](_0x3c0f('0x3'),_0x3168a0[_0x3c0f('0x4')],_0x3168a0[_0x3c0f('0x5')],_0x3168a0[_0x3c0f('0x6')],_0x3168a0[_0x3c0f('0x7')],_0x3168a0['membername'],_0x3168a0[_0x3c0f('0x8')]));if(_0x3168a0[_0x3c0f('0x5')]){utils[_0x3c0f('0x9')](_0x3168a0[_0x3c0f('0x5')])['then'](function(_0x2dcb80){if(_0x2dcb80){_0x3168a0[_0x3c0f('0xa')]=_0x2dcb80[_0x3c0f('0xb')];_0x3168a0[_0x3c0f('0xc')]=_0x2dcb80[_0x3c0f('0xc')];utils['request'](_0x3c0f('0xd'),_0x3168a0);}else{utils[_0x3c0f('0xe')](_0x3168a0[_0x3c0f('0x5')][_0x3c0f('0xf')]('/')[0x1])['then'](function(_0x467327){if(_0x467327){_0x3168a0[_0x3c0f('0xa')]=_0x467327[_0x3c0f('0xb')];_0x3168a0[_0x3c0f('0xc')]=_0x467327[_0x3c0f('0xc')];utils[_0x3c0f('0x10')]('CreateMemberReport',_0x3168a0);}});}})[_0x3c0f('0x11')](function(_0x300911){utils['error'](util[_0x3c0f('0x12')](_0x3c0f('0x13'),_0x3168a0[_0x3c0f('0x4')]),_0x300911);});}delete members[_0x3168a0['interface']];}function startsWith(_0x5be32c,_0x2f523b){return _[_0x3c0f('0x14')](_0x5be32c,function(_0x4b2a45){return _[_0x3c0f('0x15')](_0x2f523b,_0x4b2a45);});}exports[_0x3c0f('0x16')]=function(_0xc014ae){try{utils[_0x3c0f('0x17')](util[_0x3c0f('0x12')]('[%s][members][devicestatechange]',members[_0xc014ae['device']]?members[_0xc014ae[_0x3c0f('0x18')]][_0x3c0f('0x4')]:_0xc014ae['device']),_0xc014ae);utils['info'](util['format'](_0x3c0f('0x19'),members[_0xc014ae[_0x3c0f('0x18')]]?members[_0xc014ae[_0x3c0f('0x18')]]['uniqueid']:_0xc014ae[_0x3c0f('0x18')],_0xc014ae['state'],_0xc014ae['device']));switch(_0xc014ae[_0x3c0f('0x1a')]){case _0x3c0f('0x1b'):case'BUSY':if(!startsWith(exclude,_0xc014ae[_0x3c0f('0x18')])){members[_0xc014ae[_0x3c0f('0x18')]]={'channel':_0x3c0f('0x1c'),'interface':_0xc014ae[_0x3c0f('0x18')],'type':_0x3c0f('0x1d'),'enterAt':utils[_0x3c0f('0x1e')](),'role':_0x3c0f('0x1f')};}break;case _0x3c0f('0x20'):if(!_[_0x3c0f('0x21')](members[_0xc014ae[_0x3c0f('0x18')]])){members[_0xc014ae[_0x3c0f('0x18')]][_0x3c0f('0x22')]=utils[_0x3c0f('0x1e')]();members[_0xc014ae[_0x3c0f('0x18')]][_0x3c0f('0x23')]=utils[_0x3c0f('0x24')](members[_0xc014ae[_0x3c0f('0x18')]][_0x3c0f('0x22')],members[_0xc014ae[_0x3c0f('0x18')]][_0x3c0f('0x25')]);if(members[_0xc014ae[_0x3c0f('0x18')]][_0x3c0f('0x4')]){writeDB(members[_0xc014ae[_0x3c0f('0x18')]]);}}break;default:break;}}catch(_0x140c6d){utils[_0x3c0f('0x26')](util[_0x3c0f('0x12')](_0x3c0f('0x27'),members[_0xc014ae[_0x3c0f('0x18')]]?members[_0xc014ae['device']]['uniqueid']:_0xc014ae[_0x3c0f('0x18')]),_0x140c6d);}};exports[_0x3c0f('0x28')]=function(_0x29843c){try{if(!_[_0x3c0f('0x21')](members[_0x29843c[_0x3c0f('0x5')]])){utils[_0x3c0f('0x17')](util[_0x3c0f('0x12')]('[%s][members][agentcomplete]',_0x29843c['uniqueid']),_0x29843c);utils[_0x3c0f('0x29')](util[_0x3c0f('0x12')](_0x3c0f('0x2a'),_0x29843c['uniqueid'],_0x29843c[_0x3c0f('0x5')],_0x29843c[_0x3c0f('0x2b')]));members[_0x29843c[_0x3c0f('0x5')]]=_[_0x3c0f('0x2c')](members[_0x29843c['interface']],{'data4':_0x29843c[_0x3c0f('0x2b')],'uniqueid':_0x29843c[_0x3c0f('0x4')]});}}catch(_0x470228){utils['error'](util[_0x3c0f('0x12')]('[%s][members][agentcomplete]',_0x29843c[_0x3c0f('0x4')]),_0x470228);}};exports['cdr']=function(_0x484b95){try{utils[_0x3c0f('0x17')](util[_0x3c0f('0x12')](_0x3c0f('0x2d'),_0x484b95['uniqueid']),_0x484b95);if(_0x484b95[_0x3c0f('0x6')]){var _0x5c2633=_0x484b95[_0x3c0f('0x6')][_0x3c0f('0xf')]('-')[0x0];if(!_[_0x3c0f('0x21')](members[_0x5c2633])){members[_0x5c2633]=_['assign'](members[_0x5c2633],{'data1':members[_0x5c2633][_0x3c0f('0x2e')]||_0x484b95[_0x3c0f('0x8')],'data2':members[_0x5c2633]['data2']||_0x484b95[_0x3c0f('0x2f')],'data3':members[_0x5c2633][_0x3c0f('0x30')]||_0x484b95[_0x3c0f('0x31')],'uniqueid':members[_0x5c2633]['uniqueid']||_0x484b95[_0x3c0f('0x4')]});utils[_0x3c0f('0x29')](util[_0x3c0f('0x12')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x484b95[_0x3c0f('0x4')],members[_0x5c2633][_0x3c0f('0x2e')],members[_0x5c2633][_0x3c0f('0x7')],members[_0x5c2633][_0x3c0f('0x30')]));if(members[_0x5c2633][_0x3c0f('0x22')]){writeDB(members[_0x5c2633]);}}}if(_0x484b95[_0x3c0f('0x32')]){var _0x49e573=_0x484b95[_0x3c0f('0x32')][_0x3c0f('0xf')]('-')[0x0];if(!_[_0x3c0f('0x21')](members[_0x49e573])){members[_0x49e573]=_[_0x3c0f('0x2c')](members[_0x49e573],{'data1':members[_0x49e573][_0x3c0f('0x2e')]||_0x484b95[_0x3c0f('0x8')],'data2':members[_0x49e573][_0x3c0f('0x7')]||_0x484b95['source'],'data3':members[_0x49e573]['data3']||_0x484b95[_0x3c0f('0x31')],'uniqueid':members[_0x49e573][_0x3c0f('0x4')]||_0x484b95[_0x3c0f('0x4')]});utils[_0x3c0f('0x29')](util[_0x3c0f('0x12')](_0x3c0f('0x33'),_0x484b95[_0x3c0f('0x4')],members[_0x49e573][_0x3c0f('0x2e')],members[_0x49e573][_0x3c0f('0x7')],members[_0x49e573][_0x3c0f('0x30')]));if(members[_0x49e573]['exitAt']){writeDB(members[_0x49e573]);}}}}catch(_0x24b2ee){utils[_0x3c0f('0x26')](util[_0x3c0f('0x12')]('[%s][members][cdr]',_0x484b95['uniqueid']),_0x24b2ee);}}; \ No newline at end of file +var _0xf0a3=['catch','error','[%s][members][writeDB]','startsWith','devicestatechange','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','voice','now','NOT_INUSE','isNil','exitAt','duration','enterAt','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','channel','data1','source','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destination','data3','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','data2','membername','type','getUserByInterface','then','name','internal','request','getUserByName','split'];(function(_0x1378ee,_0x372f25){var _0x303ec6=function(_0x13b4f7){while(--_0x13b4f7){_0x1378ee['push'](_0x1378ee['shift']());}};_0x303ec6(++_0x372f25);}(_0xf0a3,0xe1));var _0x3f0a=function(_0x4930c1,_0x141862){_0x4930c1=_0x4930c1-0x0;var _0x185657=_0xf0a3[_0x4930c1];return _0x185657;};'use strict';var _=require(_0x3f0a('0x0'));var util=require(_0x3f0a('0x1'));var utils=require(_0x3f0a('0x2'));var members={};var exclude=[_0x3f0a('0x3'),_0x3f0a('0x4')];function writeDB(_0x2b087c){utils[_0x3f0a('0x5')](util[_0x3f0a('0x6')](_0x3f0a('0x7'),_0x2b087c[_0x3f0a('0x8')],_0x2b087c[_0x3f0a('0x9')],_0x2b087c['channel'],_0x2b087c[_0x3f0a('0xa')],_0x2b087c[_0x3f0a('0xb')],_0x2b087c[_0x3f0a('0xc')]));if(_0x2b087c['interface']){utils[_0x3f0a('0xd')](_0x2b087c[_0x3f0a('0x9')])[_0x3f0a('0xe')](function(_0x2f3074){if(_0x2f3074){_0x2b087c[_0x3f0a('0xb')]=_0x2f3074[_0x3f0a('0xf')];_0x2b087c[_0x3f0a('0x10')]=_0x2f3074['internal'];utils[_0x3f0a('0x11')]('CreateMemberReport',_0x2b087c);}else{utils[_0x3f0a('0x12')](_0x2b087c['interface'][_0x3f0a('0x13')]('/')[0x1])['then'](function(_0x32f2d1){if(_0x32f2d1){_0x2b087c[_0x3f0a('0xb')]=_0x32f2d1[_0x3f0a('0xf')];_0x2b087c[_0x3f0a('0x10')]=_0x32f2d1[_0x3f0a('0x10')];utils[_0x3f0a('0x11')]('CreateMemberReport',_0x2b087c);}});}})[_0x3f0a('0x14')](function(_0x31588f){utils[_0x3f0a('0x15')](util[_0x3f0a('0x6')](_0x3f0a('0x16'),_0x2b087c[_0x3f0a('0x8')]),_0x31588f);});}delete members[_0x2b087c[_0x3f0a('0x9')]];}function startsWith(_0x1defea,_0x4d952e){return _['some'](_0x1defea,function(_0xc33f21){return _[_0x3f0a('0x17')](_0x4d952e,_0xc33f21);});}exports[_0x3f0a('0x18')]=function(_0x43103c){try{utils[_0x3f0a('0x19')](util[_0x3f0a('0x6')]('[%s][members][devicestatechange]',members[_0x43103c[_0x3f0a('0x1a')]]?members[_0x43103c[_0x3f0a('0x1a')]][_0x3f0a('0x8')]:_0x43103c[_0x3f0a('0x1a')]),_0x43103c);utils[_0x3f0a('0x5')](util[_0x3f0a('0x6')](_0x3f0a('0x1b'),members[_0x43103c['device']]?members[_0x43103c[_0x3f0a('0x1a')]][_0x3f0a('0x8')]:_0x43103c[_0x3f0a('0x1a')],_0x43103c['state'],_0x43103c[_0x3f0a('0x1a')]));switch(_0x43103c['state']){case'INUSE':case'BUSY':if(!startsWith(exclude,_0x43103c['device'])){members[_0x43103c[_0x3f0a('0x1a')]]={'channel':_0x3f0a('0x1c'),'interface':_0x43103c['device'],'type':'TALKING','enterAt':utils[_0x3f0a('0x1d')](),'role':'agent'};}break;case _0x3f0a('0x1e'):if(!_[_0x3f0a('0x1f')](members[_0x43103c[_0x3f0a('0x1a')]])){members[_0x43103c['device']][_0x3f0a('0x20')]=utils['now']();members[_0x43103c[_0x3f0a('0x1a')]][_0x3f0a('0x21')]=utils['diffTime'](members[_0x43103c[_0x3f0a('0x1a')]]['exitAt'],members[_0x43103c[_0x3f0a('0x1a')]][_0x3f0a('0x22')]);if(members[_0x43103c[_0x3f0a('0x1a')]][_0x3f0a('0x8')]){writeDB(members[_0x43103c['device']]);}}break;default:break;}}catch(_0x4bfeca){utils['error'](util[_0x3f0a('0x6')](_0x3f0a('0x23'),members[_0x43103c[_0x3f0a('0x1a')]]?members[_0x43103c[_0x3f0a('0x1a')]][_0x3f0a('0x8')]:_0x43103c[_0x3f0a('0x1a')]),_0x4bfeca);}};exports[_0x3f0a('0x24')]=function(_0x3303fc){try{if(!_[_0x3f0a('0x1f')](members[_0x3303fc['interface']])){utils['debug'](util[_0x3f0a('0x6')](_0x3f0a('0x25'),_0x3303fc['uniqueid']),_0x3303fc);utils[_0x3f0a('0x5')](util[_0x3f0a('0x6')](_0x3f0a('0x26'),_0x3303fc[_0x3f0a('0x8')],_0x3303fc[_0x3f0a('0x9')],_0x3303fc[_0x3f0a('0x27')]));members[_0x3303fc[_0x3f0a('0x9')]]=_[_0x3f0a('0x28')](members[_0x3303fc[_0x3f0a('0x9')]],{'data4':_0x3303fc[_0x3f0a('0x27')],'uniqueid':_0x3303fc['uniqueid']});}}catch(_0x5e1264){utils[_0x3f0a('0x15')](util[_0x3f0a('0x6')]('[%s][members][agentcomplete]',_0x3303fc[_0x3f0a('0x8')]),_0x5e1264);}};exports[_0x3f0a('0x29')]=function(_0x5723b3){try{utils[_0x3f0a('0x19')](util[_0x3f0a('0x6')](_0x3f0a('0x2a'),_0x5723b3[_0x3f0a('0x8')]),_0x5723b3);if(_0x5723b3[_0x3f0a('0x2b')]){var _0x58dd64=_0x5723b3[_0x3f0a('0x2b')][_0x3f0a('0x13')]('-')[0x0];if(!_['isNil'](members[_0x58dd64])){members[_0x58dd64]=_[_0x3f0a('0x28')](members[_0x58dd64],{'data1':members[_0x58dd64][_0x3f0a('0x2c')]||_0x5723b3['type'],'data2':members[_0x58dd64]['data2']||_0x5723b3[_0x3f0a('0x2d')],'data3':members[_0x58dd64]['data3']||_0x5723b3['destination'],'uniqueid':members[_0x58dd64]['uniqueid']||_0x5723b3[_0x3f0a('0x8')]});utils['info'](util[_0x3f0a('0x6')](_0x3f0a('0x2e'),_0x5723b3['uniqueid'],members[_0x58dd64][_0x3f0a('0x2c')],members[_0x58dd64][_0x3f0a('0xa')],members[_0x58dd64]['data3']));if(members[_0x58dd64][_0x3f0a('0x20')]){writeDB(members[_0x58dd64]);}}}if(_0x5723b3['destinationchannel']){var _0x1790ee=_0x5723b3['destinationchannel']['split']('-')[0x0];if(!_[_0x3f0a('0x1f')](members[_0x1790ee])){members[_0x1790ee]=_[_0x3f0a('0x28')](members[_0x1790ee],{'data1':members[_0x1790ee]['data1']||_0x5723b3[_0x3f0a('0xc')],'data2':members[_0x1790ee][_0x3f0a('0xa')]||_0x5723b3[_0x3f0a('0x2d')],'data3':members[_0x1790ee]['data3']||_0x5723b3[_0x3f0a('0x2f')],'uniqueid':members[_0x1790ee][_0x3f0a('0x8')]||_0x5723b3[_0x3f0a('0x8')]});utils['info'](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x5723b3['uniqueid'],members[_0x1790ee][_0x3f0a('0x2c')],members[_0x1790ee]['data2'],members[_0x1790ee][_0x3f0a('0x30')]));if(members[_0x1790ee]['exitAt']){writeDB(members[_0x1790ee]);}}}}catch(_0x490b00){utils[_0x3f0a('0x15')](util[_0x3f0a('0x6')](_0x3f0a('0x2a'),_0x5723b3[_0x3f0a('0x8')]),_0x490b00);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 563c5b6..317f15e 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 _0x0596=['queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerexit','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','diffTime','queuecallerjoinAt','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','agentcomplete','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','transfertype','ATTENDED','origtransfererexten','transfereelinkedid','queuecallerenterreason','transfertargetuniqueid','calleridname','holdtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','clone','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','hangup','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][hangup]','varset','[%s][queues][varset]','variable','queuestatus','CONTINUE','isNil','now','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','value','queueposition','queuecallerabandonAt'];(function(_0x10adc7,_0x46ad48){var _0x147f71=function(_0x44f8ce){while(--_0x44f8ce){_0x10adc7['push'](_0x10adc7['shift']());}};_0x147f71(++_0x46ad48);}(_0x0596,0x1f2));var _0x6059=function(_0xc77993,_0x416fdf){_0xc77993=_0xc77993-0x0;var _0x49a506=_0x0596[_0xc77993];return _0x49a506;};'use strict';var _=require(_0x6059('0x0'));var util=require(_0x6059('0x1'));var utils=require(_0x6059('0x2'));var queues={};function writeDB(_0x46eeb5){utils[_0x6059('0x3')](util[_0x6059('0x4')](_0x6059('0x5'),_0x46eeb5[_0x6059('0x6')],_0x46eeb5[_0x6059('0x7')],_0x46eeb5[_0x6059('0x8')],_0x46eeb5[_0x6059('0x9')],_0x46eeb5[_0x6059('0xa')],_0x46eeb5[_0x6059('0xb')],_0x46eeb5['queuecallerexitreason']));if(_0x46eeb5[_0x6059('0x8')]){utils[_0x6059('0xc')](_0x46eeb5['queue'])[_0x6059('0xd')](function(_0x267494){if(_0x267494){_0x46eeb5[_0x6059('0xe')]=_0x267494[_0x6059('0xe')];}utils['request'](_0x6059('0xf'),_0x46eeb5);});}else{utils[_0x6059('0x10')](_0x6059('0xf'),_0x46eeb5);}if(_0x46eeb5[_0x6059('0x11')]){delete queues[_0x46eeb5['transfereduniqueid']];}else{delete queues[_0x46eeb5['uniqueid']];}}exports[_0x6059('0x12')]=function(_0x346f24){try{utils[_0x6059('0x13')](util[_0x6059('0x4')](_0x6059('0x14'),_0x346f24[_0x6059('0x6')]),_0x346f24);utils[_0x6059('0x3')](util['format'](_0x6059('0x15'),_0x346f24[_0x6059('0x6')],_0x346f24[_0x6059('0x8')],_0x346f24[_0x6059('0x16')]));queues[_0x346f24[_0x6059('0x6')]]=_[_0x6059('0x17')](_0x346f24,{'originalposition':_0x346f24[_0x6059('0x16')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x17c5f5){utils[_0x6059('0x18')](util[_0x6059('0x4')](_0x6059('0x14'),_0x346f24[_0x6059('0x6')]),_0x17c5f5);}};exports[_0x6059('0x19')]=function(_0x517800){try{if(!_['isNil'](queues[_0x517800['uniqueid']])){utils[_0x6059('0x13')](util[_0x6059('0x4')]('[%s][queues][hangup]',_0x517800['uniqueid']),_0x517800);if(queues[_0x517800['uniqueid']][_0x6059('0x1a')]){if(!queues[_0x517800[_0x6059('0x6')]][_0x6059('0x1b')]&&!queues[_0x517800[_0x6059('0x6')]]['queuecallerexit']){queues[_0x517800[_0x6059('0x6')]][_0x6059('0x1c')]=!![];queues[_0x517800[_0x6059('0x6')]][_0x6059('0x1d')]=utils['now']();queues[_0x517800[_0x6059('0x6')]][_0x6059('0x1e')]='COMPLETEDBYAGENT';}utils[_0x6059('0x3')](util[_0x6059('0x4')](_0x6059('0x1f'),_0x517800[_0x6059('0x6')],queues[_0x517800[_0x6059('0x6')]][_0x6059('0x20')],queues[_0x517800[_0x6059('0x6')]][_0x6059('0x1e')]));writeDB(queues[_0x517800[_0x6059('0x6')]]);}else if(queues[_0x517800[_0x6059('0x6')]][_0x6059('0x11')]){utils[_0x6059('0x3')](util[_0x6059('0x4')](_0x6059('0x21'),_0x517800[_0x6059('0x6')],queues[_0x517800[_0x6059('0x6')]]['name'],queues[_0x517800[_0x6059('0x6')]][_0x6059('0x11')]));queues[queues[_0x517800['uniqueid']][_0x6059('0x11')]]=queues[_0x517800[_0x6059('0x6')]];queues[queues[_0x517800[_0x6059('0x6')]][_0x6059('0x11')]]['queuecallerenterreason']=0x2;delete queues[_0x517800[_0x6059('0x6')]];}}}catch(_0x571aa2){utils[_0x6059('0x18')](util[_0x6059('0x4')](_0x6059('0x22'),_0x517800['uniqueid']),_0x571aa2);}};exports[_0x6059('0x23')]=function(_0x409e8f){try{utils[_0x6059('0x13')](util['format'](_0x6059('0x24'),_0x409e8f['uniqueid']),_0x409e8f);if(!_['isNil'](_0x409e8f[_0x6059('0x25')][_0x6059('0x26')])&&_0x409e8f['value']['toUpperCase']()!==_0x6059('0x27')){if(!_[_0x6059('0x28')](queues[_0x409e8f['uniqueid']])){queues[_0x409e8f[_0x6059('0x6')]]['queuecallerabandon']=![];queues[_0x409e8f['uniqueid']]['queuecallerabandonAt']=null;queues[_0x409e8f[_0x6059('0x6')]]['queuecallerexit']=!![];queues[_0x409e8f['uniqueid']]['queuecallerexitAt']=utils[_0x6059('0x29')]();queues[_0x409e8f['uniqueid']][_0x6059('0x1e')]=_0x409e8f['value'][_0x6059('0x2a')]();utils['info'](util[_0x6059('0x4')](_0x6059('0x2b'),_0x409e8f[_0x6059('0x6')],queues[_0x409e8f[_0x6059('0x6')]]['name'],_0x409e8f[_0x6059('0x2c')],queues[_0x409e8f[_0x6059('0x6')]][_0x6059('0x1e')]));writeDB(queues[_0x409e8f[_0x6059('0x6')]]);}}else if(!_[_0x6059('0x28')](_0x409e8f[_0x6059('0x25')][_0x6059('0x2d')])){if(!_['isNil'](queues[_0x409e8f[_0x6059('0x6')]])&&!queues[_0x409e8f[_0x6059('0x6')]][_0x6059('0x1b')]){queues[_0x409e8f[_0x6059('0x6')]][_0x6059('0x1b')]=![];queues[_0x409e8f['uniqueid']][_0x6059('0x2e')]=null;queues[_0x409e8f[_0x6059('0x6')]]['queuecallerexit']=!![];queues[_0x409e8f[_0x6059('0x6')]][_0x6059('0x2f')]=utils[_0x6059('0x29')]();queues[_0x409e8f[_0x6059('0x6')]][_0x6059('0x1e')]=_0x6059('0x30');utils[_0x6059('0x3')](util[_0x6059('0x4')](_0x6059('0x31'),_0x409e8f[_0x6059('0x6')],queues[_0x409e8f[_0x6059('0x6')]][_0x6059('0x20')],_0x409e8f['value'],queues[_0x409e8f[_0x6059('0x6')]][_0x6059('0x1e')]));}}}catch(_0xb03377){utils[_0x6059('0x18')](util[_0x6059('0x4')](_0x6059('0x24'),_0x409e8f[_0x6059('0x6')]),_0xb03377);}};exports[_0x6059('0x1b')]=function(_0x347ac9){try{if(!_[_0x6059('0x28')](queues[_0x347ac9[_0x6059('0x6')]])){utils[_0x6059('0x13')](util[_0x6059('0x4')](_0x6059('0x32'),_0x347ac9['uniqueid']),_0x347ac9);queues[_0x347ac9[_0x6059('0x6')]][_0x6059('0x33')]=![];queues[_0x347ac9[_0x6059('0x6')]]['queuecallerexitAt']=null;queues[_0x347ac9[_0x6059('0x6')]][_0x6059('0x1b')]=!![];queues[_0x347ac9[_0x6059('0x6')]][_0x6059('0x2e')]=utils[_0x6059('0x29')]();queues[_0x347ac9[_0x6059('0x6')]][_0x6059('0x1e')]='ABANDONED';utils[_0x6059('0x3')](util[_0x6059('0x4')](_0x6059('0x34'),_0x347ac9[_0x6059('0x6')],queues[_0x347ac9['uniqueid']][_0x6059('0x20')],queues[_0x347ac9[_0x6059('0x6')]][_0x6059('0x1e')]));}}catch(_0x3b8c85){utils[_0x6059('0x18')](util[_0x6059('0x4')](_0x6059('0x32'),_0x347ac9[_0x6059('0x6')]),_0x3b8c85);}};exports[_0x6059('0x35')]=function(_0x356fab){try{if(!_[_0x6059('0x28')](queues[_0x356fab['uniqueid']])){utils[_0x6059('0x13')](util[_0x6059('0x4')](_0x6059('0x36'),_0x356fab[_0x6059('0x6')]),_0x356fab);utils[_0x6059('0x3')](util[_0x6059('0x4')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x356fab['uniqueid'],queues[_0x356fab[_0x6059('0x6')]][_0x6059('0x20')],_0x356fab[_0x6059('0x37')],_0x356fab[_0x6059('0x38')]));queues[_0x356fab[_0x6059('0x6')]][_0x6059('0x35')]=!![];queues[_0x356fab[_0x6059('0x6')]]['queuecallerleaveAt']=utils[_0x6059('0x29')]();queues[_0x356fab[_0x6059('0x6')]]['holdtime']=utils[_0x6059('0x39')](queues[_0x356fab[_0x6059('0x6')]][_0x6059('0x1a')],queues[_0x356fab['uniqueid']][_0x6059('0x3a')]);queues[_0x356fab['uniqueid']]['position']=_0x356fab[_0x6059('0x16')];queues[_0x356fab[_0x6059('0x6')]]['count']=_0x356fab['count'];queues[_0x356fab[_0x6059('0x6')]][_0x6059('0x37')]=_0x356fab[_0x6059('0x37')];queues[_0x356fab['uniqueid']][_0x6059('0x38')]=_0x356fab[_0x6059('0x38')];}}catch(_0x163496){utils['error'](util[_0x6059('0x4')](_0x6059('0x36'),_0x356fab[_0x6059('0x6')]),_0x163496);}};exports[_0x6059('0x3b')]=function(_0x3dff5f){try{if(!_['isNil'](queues[_0x3dff5f['uniqueid']])){utils['debug'](util[_0x6059('0x4')](_0x6059('0x3c'),_0x3dff5f[_0x6059('0x6')]),_0x3dff5f);utils[_0x6059('0x3')](util[_0x6059('0x4')](_0x6059('0x3d'),_0x3dff5f[_0x6059('0x6')],queues[_0x3dff5f[_0x6059('0x6')]][_0x6059('0x20')],_0x3dff5f[_0x6059('0x3e')],_0x3dff5f[_0x6059('0x3f')]));queues[_0x3dff5f[_0x6059('0x6')]][_0x6059('0x1b')]=![];queues[_0x3dff5f[_0x6059('0x6')]][_0x6059('0x1b')]=![];queues[_0x3dff5f['uniqueid']][_0x6059('0x2e')]=null;queues[_0x3dff5f['uniqueid']][_0x6059('0x33')]=![];queues[_0x3dff5f[_0x6059('0x6')]][_0x6059('0x1e')]=null;queues[_0x3dff5f['uniqueid']][_0x6059('0x2f')]=null;queues[_0x3dff5f[_0x6059('0x6')]]['assigned']=!![];queues[_0x3dff5f[_0x6059('0x6')]][_0x6059('0xb')]=_0x3dff5f[_0x6059('0x3f')];queues[_0x3dff5f[_0x6059('0x6')]][_0x6059('0x9')]=_0x3dff5f[_0x6059('0x3e')];}}catch(_0x5c5f0c){utils[_0x6059('0x18')](util[_0x6059('0x4')](_0x6059('0x3c'),_0x3dff5f[_0x6059('0x6')]),_0x5c5f0c);}};exports[_0x6059('0x40')]=function(_0x343c98){try{if(!_[_0x6059('0x28')](queues[_0x343c98[_0x6059('0x6')]])){if(queues[_0x343c98[_0x6059('0x6')]]['queuecallerleaveAt']){utils[_0x6059('0x13')](util[_0x6059('0x4')]('[%s][queues][agentcomplete]',_0x343c98['uniqueid']),_0x343c98);queues[_0x343c98[_0x6059('0x6')]][_0x6059('0x1b')]=![];queues[_0x343c98['uniqueid']][_0x6059('0x1b')]=![];queues[_0x343c98[_0x6059('0x6')]][_0x6059('0x2e')]=null;queues[_0x343c98[_0x6059('0x6')]]['queuecallerexit']=![];queues[_0x343c98[_0x6059('0x6')]][_0x6059('0x2f')]=null;queues[_0x343c98[_0x6059('0x6')]]['assigned']=!![];queues[_0x343c98['uniqueid']]['lastAssignedTo']=_0x343c98[_0x6059('0x3e')];queues[_0x343c98['uniqueid']]['queuecallercomplete']=!![];queues[_0x343c98[_0x6059('0x6')]][_0x6059('0x1d')]=utils[_0x6059('0x29')]();if(_0x343c98[_0x6059('0x41')]=='transfer'){if(!queues[_0x343c98[_0x6059('0x6')]][_0x6059('0x42')]){queues[_0x343c98[_0x6059('0x6')]][_0x6059('0x1e')]=_0x6059('0x43');}}else{queues[_0x343c98[_0x6059('0x6')]][_0x6059('0x1e')]=_0x6059('0x44')+_0x343c98[_0x6059('0x41')]['toUpperCase']();}utils[_0x6059('0x3')](util[_0x6059('0x4')](_0x6059('0x45'),_0x343c98[_0x6059('0x6')],queues[_0x343c98[_0x6059('0x6')]][_0x6059('0x20')],_0x343c98['membername'],queues[_0x343c98[_0x6059('0x6')]][_0x6059('0x1e')]));writeDB(queues[_0x343c98[_0x6059('0x6')]]);}}}catch(_0x3f2a4f){utils['error'](util[_0x6059('0x4')](_0x6059('0x46'),_0x343c98[_0x6059('0x6')]),_0x3f2a4f);}};exports['blindtransfer']=function(_0x4a3e42){try{if(!_['isNil'](queues[_0x4a3e42[_0x6059('0x47')]])){utils[_0x6059('0x13')](util[_0x6059('0x4')](_0x6059('0x48'),_0x4a3e42[_0x6059('0x6')]),_0x4a3e42);queues[_0x4a3e42[_0x6059('0x47')]][_0x6059('0x42')]=!![];queues[_0x4a3e42[_0x6059('0x47')]]['transfertype']=_0x6059('0x49');queues[_0x4a3e42['transfereeuniqueid']][_0x6059('0x4a')]=_0x4a3e42[_0x6059('0x4b')];queues[_0x4a3e42[_0x6059('0x47')]][_0x6059('0x4c')]=_0x4a3e42[_0x6059('0x47')];queues[_0x4a3e42[_0x6059('0x47')]][_0x6059('0x1e')]=_0x6059('0x4d');utils[_0x6059('0x3')](util[_0x6059('0x4')](_0x6059('0x4e'),_0x4a3e42[_0x6059('0x6')],queues[_0x4a3e42[_0x6059('0x47')]][_0x6059('0x20')],_0x4a3e42['transfereeuniqueid'],_0x4a3e42[_0x6059('0x4b')]));}}catch(_0x2f9d2e){utils[_0x6059('0x18')](util[_0x6059('0x4')](_0x6059('0x48'),_0x4a3e42[_0x6059('0x6')]),_0x2f9d2e);}};exports[_0x6059('0x4f')]=function(_0x3025ce){try{utils[_0x6059('0x13')](util[_0x6059('0x4')](_0x6059('0x50'),_0x3025ce[_0x6059('0x51')]),_0x3025ce);if(_0x3025ce[_0x6059('0x51')]==_0x3025ce[_0x6059('0x52')]){if(!_[_0x6059('0x28')](queues[_0x3025ce[_0x6059('0x53')]])){utils[_0x6059('0x3')](util['format'](_0x6059('0x54'),_0x3025ce[_0x6059('0x51')],queues[_0x3025ce[_0x6059('0x53')]][_0x6059('0x20')],_0x3025ce['origtransfererexten']));queues[_0x3025ce['secondtransfererlinkedid']][_0x6059('0x42')]=!![];queues[_0x3025ce[_0x6059('0x53')]][_0x6059('0x55')]=_0x6059('0x56');queues[_0x3025ce[_0x6059('0x53')]][_0x6059('0x4a')]=_0x3025ce[_0x6059('0x57')];queues[_0x3025ce['secondtransfererlinkedid']][_0x6059('0x4c')]=_0x3025ce[_0x6059('0x51')];queues[_0x3025ce[_0x6059('0x53')]][_0x6059('0x1e')]='ATTENDEDTRANSFER';}if(!_[_0x6059('0x28')](queues[_0x3025ce[_0x6059('0x52')]])){if(_0x3025ce[_0x6059('0x58')]&&queues[_0x3025ce['transfereelinkedid']]){queues[_0x3025ce[_0x6059('0x58')]][_0x6059('0x59')]=0x1;queues[_0x3025ce[_0x6059('0x47')]]=_['clone'](queues[_0x3025ce[_0x6059('0x58')]]);queues[_0x3025ce[_0x6059('0x47')]][_0x6059('0x11')]=_0x3025ce[_0x6059('0x5a')];queues[_0x3025ce['transfereeuniqueid']]['queuecallerenterreason']=0x2;queues[_0x3025ce[_0x6059('0x47')]][_0x6059('0xa')]=queues[_0x3025ce['secondtransfererlinkedid']][_0x6059('0xa')];queues[_0x3025ce[_0x6059('0x47')]][_0x6059('0x5b')]=queues[_0x3025ce['secondtransfererlinkedid']][_0x6059('0x5b')];queues[_0x3025ce['transfereeuniqueid']][_0x6059('0x3a')]=utils['now']();queues[_0x3025ce[_0x6059('0x47')]][_0x6059('0x1a')]=utils['now']();queues[_0x3025ce[_0x6059('0x47')]][_0x6059('0x5c')]=0x0;queues[_0x3025ce[_0x6059('0x47')]]['mohtime']=0x0;utils['info'](util[_0x6059('0x4')](_0x6059('0x5d'),_0x3025ce[_0x6059('0x51')],queues[_0x3025ce[_0x6059('0x47')]][_0x6059('0x20')],queues[_0x3025ce['transfereeuniqueid']]['calleridnum'],queues[_0x3025ce[_0x6059('0x47')]][_0x6059('0x5b')]));}else{utils[_0x6059('0x3')](util['format'](_0x6059('0x5e'),_0x3025ce[_0x6059('0x51')],queues[_0x3025ce[_0x6059('0x52')]][_0x6059('0x20')],_0x3025ce[_0x6059('0x53')]));queues[_0x3025ce[_0x6059('0x52')]][_0x6059('0x11')]=_0x3025ce[_0x6059('0x53')];}}}else if(_0x3025ce[_0x6059('0x5f')]==_0x3025ce[_0x6059('0x53')]){if(!_[_0x6059('0x28')](queues[_0x3025ce[_0x6059('0x52')]])){utils[_0x6059('0x3')](util[_0x6059('0x4')](_0x6059('0x60'),_0x3025ce['origtransfereruniqueid'],queues[_0x3025ce[_0x6059('0x52')]][_0x6059('0x20')],_0x3025ce[_0x6059('0x5f')],_0x3025ce[_0x6059('0x61')]));queues[_0x3025ce[_0x6059('0x52')]]['transfer']=!![];queues[_0x3025ce[_0x6059('0x52')]]['transfertype']=_0x6059('0x56');queues[_0x3025ce[_0x6059('0x52')]][_0x6059('0x4a')]=_0x3025ce['secondtransfererexten'];queues[_0x3025ce[_0x6059('0x52')]][_0x6059('0x4c')]=_0x3025ce[_0x6059('0x5f')];queues[_0x3025ce[_0x6059('0x52')]][_0x6059('0x1e')]=_0x6059('0x62');}if(!_[_0x6059('0x28')](queues[_0x3025ce[_0x6059('0x53')]])){if(_0x3025ce[_0x6059('0x63')]&&queues[_0x3025ce[_0x6059('0x63')]]){queues[_0x3025ce[_0x6059('0x63')]]['queuecallerenterreason']=0x1;queues[_0x3025ce[_0x6059('0x5a')]]=_[_0x6059('0x64')](queues[_0x3025ce[_0x6059('0x63')]]);queues[_0x3025ce[_0x6059('0x5a')]]['transfereduniqueid']=_0x3025ce['transfertargetuniqueid'];queues[_0x3025ce[_0x6059('0x5a')]]['queuecallerenterreason']=0x2;queues[_0x3025ce[_0x6059('0x5a')]]['calleridnum']=queues[_0x3025ce[_0x6059('0x52')]][_0x6059('0xa')];queues[_0x3025ce[_0x6059('0x5a')]][_0x6059('0x5b')]=queues[_0x3025ce[_0x6059('0x52')]]['calleridname'];queues[_0x3025ce[_0x6059('0x5a')]][_0x6059('0x3a')]=utils[_0x6059('0x29')]();queues[_0x3025ce[_0x6059('0x5a')]][_0x6059('0x1a')]=utils[_0x6059('0x29')]();queues[_0x3025ce[_0x6059('0x5a')]]['holdtime']=0x0;queues[_0x3025ce['transfertargetuniqueid']][_0x6059('0x65')]=0x0;utils[_0x6059('0x3')](util[_0x6059('0x4')](_0x6059('0x66'),_0x3025ce[_0x6059('0x51')],queues[_0x3025ce[_0x6059('0x5a')]][_0x6059('0x20')],queues[_0x3025ce['transfertargetuniqueid']][_0x6059('0x11')],queues[_0x3025ce[_0x6059('0x5a')]][_0x6059('0xa')],queues[_0x3025ce['transfertargetuniqueid']][_0x6059('0x5b')]));}else{utils[_0x6059('0x3')](util[_0x6059('0x4')](_0x6059('0x5e'),_0x3025ce[_0x6059('0x51')],queues[_0x3025ce[_0x6059('0x53')]][_0x6059('0x20')],_0x3025ce[_0x6059('0x52')]));queues[_0x3025ce[_0x6059('0x53')]][_0x6059('0x11')]=_0x3025ce[_0x6059('0x52')];}}}}catch(_0x2e96a3){utils[_0x6059('0x18')](util[_0x6059('0x4')]('[%s][queues][attendedtransfer]',_0x3025ce[_0x6059('0x51')]),_0x2e96a3);}};exports[_0x6059('0x67')]=function(_0x4deb2c){try{if(!_[_0x6059('0x28')](queues[_0x4deb2c[_0x6059('0x6')]])){utils['debug'](util[_0x6059('0x4')](_0x6059('0x68'),_0x4deb2c[_0x6059('0x6')]),_0x4deb2c);queues[_0x4deb2c['uniqueid']]['musiconholdstartAt']=utils[_0x6059('0x29')]();utils['info'](util['format'](_0x6059('0x69'),_0x4deb2c['uniqueid'],queues[_0x4deb2c[_0x6059('0x6')]][_0x6059('0x20')],queues[_0x4deb2c[_0x6059('0x6')]]['musiconholdstartAt']));}}catch(_0x54f206){utils[_0x6059('0x18')](util[_0x6059('0x4')](_0x6059('0x68'),_0x4deb2c['uniqueid']),_0x54f206);}};exports['musiconholdstop']=function(_0x3e438b){try{if(!_['isNil'](queues[_0x3e438b[_0x6059('0x6')]])){if(!_['isNil'](queues[_0x3e438b[_0x6059('0x6')]][_0x6059('0x6a')])){utils[_0x6059('0x13')](util[_0x6059('0x4')](_0x6059('0x6b'),_0x3e438b[_0x6059('0x6')]),_0x3e438b);queues[_0x3e438b[_0x6059('0x6')]][_0x6059('0x65')]+=utils[_0x6059('0x39')](utils[_0x6059('0x29')](),queues[_0x3e438b['uniqueid']][_0x6059('0x6a')]);utils['info'](util[_0x6059('0x4')](_0x6059('0x6c'),_0x3e438b['uniqueid'],queues[_0x3e438b[_0x6059('0x6')]]['name'],queues[_0x3e438b[_0x6059('0x6')]][_0x6059('0x65')]));delete queues[_0x3e438b[_0x6059('0x6')]]['musiconholdstartAt'];}}}catch(_0x3a5701){utils[_0x6059('0x18')](util['format'](_0x6059('0x6b'),_0x3e438b[_0x6059('0x6')]),_0x3a5701);}}; \ No newline at end of file +var _0x1314=['queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','assigned','accountcode','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][blindtransfer]','transfereeuniqueid','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','ATTENDED','transferexten','transferuniqueid','transfereelinkedid','clone','calleridname','mohtime','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','queuecallerexitreason','then','type','request','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','hangup','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','queuestatus','value','toUpperCase','queuecallerabandonAt'];(function(_0x549c77,_0x31a622){var _0x13a40c=function(_0x11d478){while(--_0x11d478){_0x549c77['push'](_0x549c77['shift']());}};_0x13a40c(++_0x31a622);}(_0x1314,0xa3));var _0x4131=function(_0x34620e,_0x582015){_0x34620e=_0x34620e-0x0;var _0x3d33cd=_0x1314[_0x34620e];return _0x3d33cd;};'use strict';var _=require(_0x4131('0x0'));var util=require('util');var utils=require(_0x4131('0x1'));var queues={};function writeDB(_0x3ff647){utils[_0x4131('0x2')](util[_0x4131('0x3')](_0x4131('0x4'),_0x3ff647[_0x4131('0x5')],_0x3ff647[_0x4131('0x6')],_0x3ff647[_0x4131('0x7')],_0x3ff647[_0x4131('0x8')],_0x3ff647[_0x4131('0x9')],_0x3ff647['accountcode'],_0x3ff647[_0x4131('0xa')]));if(_0x3ff647[_0x4131('0x7')]){utils['getVoiceQueueByName'](_0x3ff647['queue'])[_0x4131('0xb')](function(_0x37a403){if(_0x37a403){_0x3ff647[_0x4131('0xc')]=_0x37a403['type'];}utils[_0x4131('0xd')]('CreateVoiceQueueReport',_0x3ff647);});}else{utils['request']('CreateVoiceQueueReport',_0x3ff647);}if(_0x3ff647[_0x4131('0xe')]){delete queues[_0x3ff647['transfereduniqueid']];}else{delete queues[_0x3ff647['uniqueid']];}}exports[_0x4131('0xf')]=function(_0x3cad9b){try{utils['debug'](util[_0x4131('0x3')](_0x4131('0x10'),_0x3cad9b[_0x4131('0x5')]),_0x3cad9b);utils[_0x4131('0x2')](util[_0x4131('0x3')](_0x4131('0x11'),_0x3cad9b['uniqueid'],_0x3cad9b[_0x4131('0x7')],_0x3cad9b[_0x4131('0x12')]));queues[_0x3cad9b[_0x4131('0x5')]]=_[_0x4131('0x13')](_0x3cad9b,{'originalposition':_0x3cad9b[_0x4131('0x12')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x3a6b4d){utils[_0x4131('0x14')](util[_0x4131('0x3')]('[%s][queues][queuecallerjoin]',_0x3cad9b[_0x4131('0x5')]),_0x3a6b4d);}};exports[_0x4131('0x15')]=function(_0x218cd3){try{if(!_[_0x4131('0x16')](queues[_0x218cd3[_0x4131('0x5')]])){utils[_0x4131('0x17')](util[_0x4131('0x3')](_0x4131('0x18'),_0x218cd3[_0x4131('0x5')]),_0x218cd3);if(queues[_0x218cd3[_0x4131('0x5')]][_0x4131('0x19')]){if(!queues[_0x218cd3['uniqueid']][_0x4131('0x1a')]&&!queues[_0x218cd3[_0x4131('0x5')]][_0x4131('0x1b')]){queues[_0x218cd3[_0x4131('0x5')]][_0x4131('0x1c')]=!![];queues[_0x218cd3['uniqueid']][_0x4131('0x1d')]=utils[_0x4131('0x1e')]();queues[_0x218cd3[_0x4131('0x5')]][_0x4131('0xa')]=_0x4131('0x1f');}utils[_0x4131('0x2')](util['format'](_0x4131('0x20'),_0x218cd3[_0x4131('0x5')],queues[_0x218cd3[_0x4131('0x5')]][_0x4131('0x21')],queues[_0x218cd3['uniqueid']][_0x4131('0xa')]));writeDB(queues[_0x218cd3[_0x4131('0x5')]]);}else if(queues[_0x218cd3[_0x4131('0x5')]]['transfereduniqueid']){utils[_0x4131('0x2')](util['format']('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x218cd3[_0x4131('0x5')],queues[_0x218cd3[_0x4131('0x5')]][_0x4131('0x21')],queues[_0x218cd3[_0x4131('0x5')]]['transfereduniqueid']));queues[queues[_0x218cd3[_0x4131('0x5')]]['transfereduniqueid']]=queues[_0x218cd3[_0x4131('0x5')]];queues[queues[_0x218cd3[_0x4131('0x5')]][_0x4131('0xe')]][_0x4131('0x22')]=0x2;delete queues[_0x218cd3[_0x4131('0x5')]];}}}catch(_0x5b6776){utils[_0x4131('0x14')](util[_0x4131('0x3')](_0x4131('0x18'),_0x218cd3[_0x4131('0x5')]),_0x5b6776);}};exports[_0x4131('0x23')]=function(_0x1b87b3){try{utils[_0x4131('0x17')](util['format'](_0x4131('0x24'),_0x1b87b3[_0x4131('0x5')]),_0x1b87b3);if(!_[_0x4131('0x16')](_0x1b87b3['variable'][_0x4131('0x25')])&&_0x1b87b3[_0x4131('0x26')][_0x4131('0x27')]()!=='CONTINUE'){if(!_[_0x4131('0x16')](queues[_0x1b87b3[_0x4131('0x5')]])){queues[_0x1b87b3[_0x4131('0x5')]]['queuecallerabandon']=![];queues[_0x1b87b3[_0x4131('0x5')]][_0x4131('0x28')]=null;queues[_0x1b87b3[_0x4131('0x5')]][_0x4131('0x1b')]=!![];queues[_0x1b87b3[_0x4131('0x5')]][_0x4131('0x29')]=utils[_0x4131('0x1e')]();queues[_0x1b87b3[_0x4131('0x5')]][_0x4131('0xa')]=_0x1b87b3['value'][_0x4131('0x27')]();utils[_0x4131('0x2')](util[_0x4131('0x3')](_0x4131('0x2a'),_0x1b87b3[_0x4131('0x5')],queues[_0x1b87b3[_0x4131('0x5')]][_0x4131('0x21')],_0x1b87b3['value'],queues[_0x1b87b3[_0x4131('0x5')]][_0x4131('0xa')]));writeDB(queues[_0x1b87b3[_0x4131('0x5')]]);}}else if(!_[_0x4131('0x16')](_0x1b87b3[_0x4131('0x2b')]['queueposition'])){if(!_[_0x4131('0x16')](queues[_0x1b87b3[_0x4131('0x5')]])&&!queues[_0x1b87b3[_0x4131('0x5')]][_0x4131('0x1a')]){queues[_0x1b87b3[_0x4131('0x5')]][_0x4131('0x1a')]=![];queues[_0x1b87b3[_0x4131('0x5')]][_0x4131('0x28')]=null;queues[_0x1b87b3['uniqueid']][_0x4131('0x1b')]=!![];queues[_0x1b87b3[_0x4131('0x5')]][_0x4131('0x29')]=utils[_0x4131('0x1e')]();queues[_0x1b87b3['uniqueid']][_0x4131('0xa')]='EXITWITHKEY';utils['info'](util['format'](_0x4131('0x2c'),_0x1b87b3[_0x4131('0x5')],queues[_0x1b87b3[_0x4131('0x5')]][_0x4131('0x21')],_0x1b87b3['value'],queues[_0x1b87b3['uniqueid']]['queuecallerexitreason']));}}}catch(_0xa0811b){utils[_0x4131('0x14')](util[_0x4131('0x3')](_0x4131('0x24'),_0x1b87b3[_0x4131('0x5')]),_0xa0811b);}};exports[_0x4131('0x1a')]=function(_0xb9ff0c){try{if(!_[_0x4131('0x16')](queues[_0xb9ff0c[_0x4131('0x5')]])){utils[_0x4131('0x17')](util[_0x4131('0x3')](_0x4131('0x2d'),_0xb9ff0c[_0x4131('0x5')]),_0xb9ff0c);queues[_0xb9ff0c['uniqueid']][_0x4131('0x1b')]=![];queues[_0xb9ff0c['uniqueid']]['queuecallerexitAt']=null;queues[_0xb9ff0c['uniqueid']]['queuecallerabandon']=!![];queues[_0xb9ff0c['uniqueid']][_0x4131('0x28')]=utils['now']();queues[_0xb9ff0c['uniqueid']][_0x4131('0xa')]=_0x4131('0x2e');utils[_0x4131('0x2')](util[_0x4131('0x3')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0xb9ff0c['uniqueid'],queues[_0xb9ff0c[_0x4131('0x5')]][_0x4131('0x21')],queues[_0xb9ff0c[_0x4131('0x5')]][_0x4131('0xa')]));}}catch(_0xef1a90){utils[_0x4131('0x14')](util['format'](_0x4131('0x2d'),_0xb9ff0c['uniqueid']),_0xef1a90);}};exports[_0x4131('0x2f')]=function(_0x3c5044){try{if(!_[_0x4131('0x16')](queues[_0x3c5044[_0x4131('0x5')]])){utils['debug'](util[_0x4131('0x3')](_0x4131('0x30'),_0x3c5044[_0x4131('0x5')]),_0x3c5044);utils[_0x4131('0x2')](util['format'](_0x4131('0x31'),_0x3c5044[_0x4131('0x5')],queues[_0x3c5044[_0x4131('0x5')]][_0x4131('0x21')],_0x3c5044['connectedlinenum'],_0x3c5044[_0x4131('0x32')]));queues[_0x3c5044[_0x4131('0x5')]][_0x4131('0x2f')]=!![];queues[_0x3c5044[_0x4131('0x5')]][_0x4131('0x19')]=utils[_0x4131('0x1e')]();queues[_0x3c5044[_0x4131('0x5')]][_0x4131('0x33')]=utils[_0x4131('0x34')](queues[_0x3c5044['uniqueid']]['queuecallerleaveAt'],queues[_0x3c5044[_0x4131('0x5')]][_0x4131('0x35')]);queues[_0x3c5044['uniqueid']][_0x4131('0x12')]=_0x3c5044[_0x4131('0x12')];queues[_0x3c5044['uniqueid']][_0x4131('0x36')]=_0x3c5044[_0x4131('0x36')];queues[_0x3c5044[_0x4131('0x5')]][_0x4131('0x37')]=_0x3c5044[_0x4131('0x37')];queues[_0x3c5044[_0x4131('0x5')]][_0x4131('0x32')]=_0x3c5044['connectedlinename'];}}catch(_0x18d868){utils[_0x4131('0x14')](util[_0x4131('0x3')]('[%s][queues][queuecallerleave]',_0x3c5044[_0x4131('0x5')]),_0x18d868);}};exports[_0x4131('0x38')]=function(_0x53a108){try{if(!_[_0x4131('0x16')](queues[_0x53a108[_0x4131('0x5')]])){utils['debug'](util['format'](_0x4131('0x39'),_0x53a108[_0x4131('0x5')]),_0x53a108);utils[_0x4131('0x2')](util[_0x4131('0x3')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x53a108[_0x4131('0x5')],queues[_0x53a108['uniqueid']]['name'],_0x53a108[_0x4131('0x3a')],_0x53a108[_0x4131('0x3b')]));queues[_0x53a108[_0x4131('0x5')]][_0x4131('0x1a')]=![];queues[_0x53a108[_0x4131('0x5')]][_0x4131('0x1a')]=![];queues[_0x53a108['uniqueid']]['queuecallerabandonAt']=null;queues[_0x53a108[_0x4131('0x5')]][_0x4131('0x1b')]=![];queues[_0x53a108['uniqueid']]['queuecallerexitreason']=null;queues[_0x53a108[_0x4131('0x5')]]['queuecallerexitAt']=null;queues[_0x53a108[_0x4131('0x5')]][_0x4131('0x3c')]=!![];queues[_0x53a108[_0x4131('0x5')]][_0x4131('0x3d')]=_0x53a108[_0x4131('0x3b')];queues[_0x53a108[_0x4131('0x5')]][_0x4131('0x8')]=_0x53a108[_0x4131('0x3a')];}}catch(_0x5c36e8){utils[_0x4131('0x14')](util['format'](_0x4131('0x39'),_0x53a108[_0x4131('0x5')]),_0x5c36e8);}};exports[_0x4131('0x3e')]=function(_0x44b9ed){try{if(!_[_0x4131('0x16')](queues[_0x44b9ed[_0x4131('0x5')]])){if(queues[_0x44b9ed['uniqueid']][_0x4131('0x19')]){utils[_0x4131('0x17')](util[_0x4131('0x3')](_0x4131('0x3f'),_0x44b9ed[_0x4131('0x5')]),_0x44b9ed);queues[_0x44b9ed[_0x4131('0x5')]][_0x4131('0x1a')]=![];queues[_0x44b9ed[_0x4131('0x5')]][_0x4131('0x1a')]=![];queues[_0x44b9ed[_0x4131('0x5')]][_0x4131('0x28')]=null;queues[_0x44b9ed['uniqueid']]['queuecallerexit']=![];queues[_0x44b9ed['uniqueid']][_0x4131('0x29')]=null;queues[_0x44b9ed[_0x4131('0x5')]][_0x4131('0x3c')]=!![];queues[_0x44b9ed['uniqueid']]['lastAssignedTo']=_0x44b9ed[_0x4131('0x3a')];queues[_0x44b9ed[_0x4131('0x5')]][_0x4131('0x1c')]=!![];queues[_0x44b9ed[_0x4131('0x5')]][_0x4131('0x1d')]=utils[_0x4131('0x1e')]();if(_0x44b9ed[_0x4131('0x40')]==_0x4131('0x41')){if(!queues[_0x44b9ed['uniqueid']]['transfer']){queues[_0x44b9ed[_0x4131('0x5')]][_0x4131('0xa')]=_0x4131('0x42');}}else{queues[_0x44b9ed[_0x4131('0x5')]][_0x4131('0xa')]=_0x4131('0x43')+_0x44b9ed[_0x4131('0x40')][_0x4131('0x27')]();}utils['info'](util[_0x4131('0x3')](_0x4131('0x44'),_0x44b9ed[_0x4131('0x5')],queues[_0x44b9ed[_0x4131('0x5')]][_0x4131('0x21')],_0x44b9ed['membername'],queues[_0x44b9ed[_0x4131('0x5')]][_0x4131('0xa')]));writeDB(queues[_0x44b9ed['uniqueid']]);}}}catch(_0x31a00a){utils[_0x4131('0x14')](util['format'](_0x4131('0x3f'),_0x44b9ed[_0x4131('0x5')]),_0x31a00a);}};exports['blindtransfer']=function(_0xa2c2){try{if(!_[_0x4131('0x16')](queues[_0xa2c2['transfereeuniqueid']])){utils['debug'](util[_0x4131('0x3')](_0x4131('0x45'),_0xa2c2['uniqueid']),_0xa2c2);queues[_0xa2c2[_0x4131('0x46')]][_0x4131('0x41')]=!![];queues[_0xa2c2[_0x4131('0x46')]]['transfertype']='BLIND';queues[_0xa2c2[_0x4131('0x46')]]['transferexten']=_0xa2c2[_0x4131('0x47')];queues[_0xa2c2[_0x4131('0x46')]]['transferuniqueid']=_0xa2c2[_0x4131('0x46')];queues[_0xa2c2['transfereeuniqueid']][_0x4131('0xa')]=_0x4131('0x48');utils[_0x4131('0x2')](util[_0x4131('0x3')](_0x4131('0x49'),_0xa2c2['uniqueid'],queues[_0xa2c2[_0x4131('0x46')]][_0x4131('0x21')],_0xa2c2[_0x4131('0x46')],_0xa2c2[_0x4131('0x47')]));}}catch(_0x1eb5de){utils[_0x4131('0x14')](util['format'](_0x4131('0x45'),_0xa2c2[_0x4131('0x5')]),_0x1eb5de);}};exports[_0x4131('0x4a')]=function(_0xeaf33e){try{utils[_0x4131('0x17')](util['format'](_0x4131('0x4b'),_0xeaf33e[_0x4131('0x4c')]),_0xeaf33e);if(_0xeaf33e[_0x4131('0x4c')]==_0xeaf33e[_0x4131('0x4d')]){if(!_[_0x4131('0x16')](queues[_0xeaf33e[_0x4131('0x4e')]])){utils['info'](util[_0x4131('0x3')](_0x4131('0x4f'),_0xeaf33e[_0x4131('0x4c')],queues[_0xeaf33e[_0x4131('0x4e')]][_0x4131('0x21')],_0xeaf33e[_0x4131('0x50')]));queues[_0xeaf33e[_0x4131('0x4e')]][_0x4131('0x41')]=!![];queues[_0xeaf33e[_0x4131('0x4e')]][_0x4131('0x51')]=_0x4131('0x52');queues[_0xeaf33e['secondtransfererlinkedid']][_0x4131('0x53')]=_0xeaf33e['origtransfererexten'];queues[_0xeaf33e[_0x4131('0x4e')]][_0x4131('0x54')]=_0xeaf33e[_0x4131('0x4c')];queues[_0xeaf33e[_0x4131('0x4e')]][_0x4131('0xa')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0xeaf33e[_0x4131('0x4d')]])){if(_0xeaf33e['transfereelinkedid']&&queues[_0xeaf33e[_0x4131('0x55')]]){queues[_0xeaf33e['transfereelinkedid']][_0x4131('0x22')]=0x1;queues[_0xeaf33e[_0x4131('0x46')]]=_[_0x4131('0x56')](queues[_0xeaf33e[_0x4131('0x55')]]);queues[_0xeaf33e[_0x4131('0x46')]][_0x4131('0xe')]=_0xeaf33e['transfertargetuniqueid'];queues[_0xeaf33e[_0x4131('0x46')]][_0x4131('0x22')]=0x2;queues[_0xeaf33e[_0x4131('0x46')]]['calleridnum']=queues[_0xeaf33e[_0x4131('0x4e')]][_0x4131('0x9')];queues[_0xeaf33e[_0x4131('0x46')]][_0x4131('0x57')]=queues[_0xeaf33e[_0x4131('0x4e')]][_0x4131('0x57')];queues[_0xeaf33e['transfereeuniqueid']]['queuecallerjoinAt']=utils[_0x4131('0x1e')]();queues[_0xeaf33e[_0x4131('0x46')]]['queuecallerleaveAt']=utils['now']();queues[_0xeaf33e[_0x4131('0x46')]][_0x4131('0x33')]=0x0;queues[_0xeaf33e['transfereeuniqueid']][_0x4131('0x58')]=0x0;utils[_0x4131('0x2')](util[_0x4131('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0xeaf33e['origtransfereruniqueid'],queues[_0xeaf33e[_0x4131('0x46')]][_0x4131('0x21')],queues[_0xeaf33e[_0x4131('0x46')]][_0x4131('0x9')],queues[_0xeaf33e['transfereeuniqueid']][_0x4131('0x57')]));}else{utils[_0x4131('0x2')](util[_0x4131('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0xeaf33e[_0x4131('0x4c')],queues[_0xeaf33e[_0x4131('0x4d')]]['name'],_0xeaf33e[_0x4131('0x4e')]));queues[_0xeaf33e['origtransfererlinkedid']]['transfereduniqueid']=_0xeaf33e['secondtransfererlinkedid'];}}}else if(_0xeaf33e[_0x4131('0x59')]==_0xeaf33e[_0x4131('0x4e')]){if(!_[_0x4131('0x16')](queues[_0xeaf33e[_0x4131('0x4d')]])){utils['info'](util[_0x4131('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0xeaf33e[_0x4131('0x4c')],queues[_0xeaf33e[_0x4131('0x4d')]]['name'],_0xeaf33e['secondtransfereruniqueid'],_0xeaf33e[_0x4131('0x5a')]));queues[_0xeaf33e[_0x4131('0x4d')]]['transfer']=!![];queues[_0xeaf33e[_0x4131('0x4d')]][_0x4131('0x51')]=_0x4131('0x52');queues[_0xeaf33e[_0x4131('0x4d')]][_0x4131('0x53')]=_0xeaf33e[_0x4131('0x5a')];queues[_0xeaf33e[_0x4131('0x4d')]]['transferuniqueid']=_0xeaf33e[_0x4131('0x59')];queues[_0xeaf33e[_0x4131('0x4d')]][_0x4131('0xa')]='ATTENDEDTRANSFER';}if(!_[_0x4131('0x16')](queues[_0xeaf33e[_0x4131('0x4e')]])){if(_0xeaf33e[_0x4131('0x5b')]&&queues[_0xeaf33e[_0x4131('0x5b')]]){queues[_0xeaf33e[_0x4131('0x5b')]][_0x4131('0x22')]=0x1;queues[_0xeaf33e[_0x4131('0x5c')]]=_[_0x4131('0x56')](queues[_0xeaf33e[_0x4131('0x5b')]]);queues[_0xeaf33e[_0x4131('0x5c')]][_0x4131('0xe')]=_0xeaf33e[_0x4131('0x5c')];queues[_0xeaf33e[_0x4131('0x5c')]][_0x4131('0x22')]=0x2;queues[_0xeaf33e['transfertargetuniqueid']]['calleridnum']=queues[_0xeaf33e[_0x4131('0x4d')]][_0x4131('0x9')];queues[_0xeaf33e[_0x4131('0x5c')]][_0x4131('0x57')]=queues[_0xeaf33e[_0x4131('0x4d')]][_0x4131('0x57')];queues[_0xeaf33e[_0x4131('0x5c')]][_0x4131('0x35')]=utils['now']();queues[_0xeaf33e[_0x4131('0x5c')]][_0x4131('0x19')]=utils['now']();queues[_0xeaf33e['transfertargetuniqueid']]['holdtime']=0x0;queues[_0xeaf33e[_0x4131('0x5c')]]['mohtime']=0x0;utils[_0x4131('0x2')](util['format'](_0x4131('0x5d'),_0xeaf33e[_0x4131('0x4c')],queues[_0xeaf33e[_0x4131('0x5c')]][_0x4131('0x21')],queues[_0xeaf33e[_0x4131('0x5c')]][_0x4131('0xe')],queues[_0xeaf33e[_0x4131('0x5c')]][_0x4131('0x9')],queues[_0xeaf33e[_0x4131('0x5c')]]['calleridname']));}else{utils[_0x4131('0x2')](util['format'](_0x4131('0x5e'),_0xeaf33e['origtransfereruniqueid'],queues[_0xeaf33e[_0x4131('0x4e')]][_0x4131('0x21')],_0xeaf33e[_0x4131('0x4d')]));queues[_0xeaf33e[_0x4131('0x4e')]][_0x4131('0xe')]=_0xeaf33e[_0x4131('0x4d')];}}}}catch(_0x480cc9){utils[_0x4131('0x14')](util[_0x4131('0x3')](_0x4131('0x4b'),_0xeaf33e[_0x4131('0x4c')]),_0x480cc9);}};exports[_0x4131('0x5f')]=function(_0x1210f1){try{if(!_['isNil'](queues[_0x1210f1['uniqueid']])){utils[_0x4131('0x17')](util[_0x4131('0x3')](_0x4131('0x60'),_0x1210f1[_0x4131('0x5')]),_0x1210f1);queues[_0x1210f1[_0x4131('0x5')]][_0x4131('0x61')]=utils['now']();utils[_0x4131('0x2')](util[_0x4131('0x3')](_0x4131('0x62'),_0x1210f1[_0x4131('0x5')],queues[_0x1210f1['uniqueid']][_0x4131('0x21')],queues[_0x1210f1[_0x4131('0x5')]][_0x4131('0x61')]));}}catch(_0x1e0d64){utils[_0x4131('0x14')](util['format'](_0x4131('0x60'),_0x1210f1['uniqueid']),_0x1e0d64);}};exports[_0x4131('0x63')]=function(_0x90d516){try{if(!_['isNil'](queues[_0x90d516[_0x4131('0x5')]])){if(!_[_0x4131('0x16')](queues[_0x90d516[_0x4131('0x5')]][_0x4131('0x61')])){utils[_0x4131('0x17')](util['format'](_0x4131('0x64'),_0x90d516[_0x4131('0x5')]),_0x90d516);queues[_0x90d516[_0x4131('0x5')]][_0x4131('0x58')]+=utils[_0x4131('0x34')](utils[_0x4131('0x1e')](),queues[_0x90d516[_0x4131('0x5')]][_0x4131('0x61')]);utils[_0x4131('0x2')](util[_0x4131('0x3')](_0x4131('0x65'),_0x90d516['uniqueid'],queues[_0x90d516[_0x4131('0x5')]][_0x4131('0x21')],queues[_0x90d516[_0x4131('0x5')]]['mohtime']));delete queues[_0x90d516['uniqueid']][_0x4131('0x61')];}}}catch(_0x51ee2f){utils[_0x4131('0x14')](util['format'](_0x4131('0x64'),_0x90d516[_0x4131('0x5')]),_0x51ee2f);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 495e613..b11c3a0 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 _0x6763=['calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','util','./utils','./transfers.controller','info','uniqueid','blinds','transfereeuniqueid','accountcode','name','UserId','request','CreateVoiceRecording','newchannel','debug','format','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','newstate','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename','[%s][recordings][varset]','value','.wav49','replace','.WAV','find','monitors','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','cause-txt'];(function(_0x4ae767,_0x4140f0){var _0x571df1=function(_0x454c64){while(--_0x454c64){_0x4ae767['push'](_0x4ae767['shift']());}};_0x571df1(++_0x4140f0);}(_0x6763,0x12c));var _0x3676=function(_0x156a77,_0x522c13){_0x156a77=_0x156a77-0x0;var _0x32398a=_0x6763[_0x156a77];return _0x32398a;};'use strict';var _=require('lodash');var util=require(_0x3676('0x0'));var utils=require(_0x3676('0x1'));var transfers=require(_0x3676('0x2'));var recordings={};function writeDB(_0x44a6c6){var _0x157b4d;utils[_0x3676('0x3')](util['format']('[%s][recordings][writeDB]',_0x44a6c6[_0x3676('0x4')]));if(transfers['blinds'][_0x44a6c6[_0x3676('0x4')]]){_0x157b4d=_0x44a6c6[_0x3676('0x4')];_0x44a6c6[_0x3676('0x4')]=transfers[_0x3676('0x5')][_0x44a6c6['uniqueid']][_0x3676('0x6')];}if(_0x44a6c6[_0x3676('0x7')]){utils['getUserByInternal'](_0x44a6c6['accountcode'])['then'](function(_0x4e7db1){if(_0x4e7db1){_0x44a6c6['membername']=_0x4e7db1[_0x3676('0x8')];_0x44a6c6[_0x3676('0x9')]=_0x4e7db1['id'];}utils[_0x3676('0xa')](_0x3676('0xb'),_0x44a6c6);});}else{utils[_0x3676('0xa')](_0x3676('0xb'),_0x44a6c6);}if(_0x157b4d)delete transfers[_0x3676('0x5')][_0x157b4d];}exports[_0x3676('0xc')]=function(_0x47791f){try{utils[_0x3676('0xd')](util[_0x3676('0xe')](_0x3676('0xf'),_0x47791f[_0x3676('0x4')]),_0x47791f);if(_0x47791f['uniqueid']==_0x47791f[_0x3676('0x10')]){utils[_0x3676('0x3')](util['format'](_0x3676('0x11'),_0x47791f['uniqueid'],_0x47791f[_0x3676('0x12')],_0x47791f[_0x3676('0x13')]));recordings[_0x47791f[_0x3676('0x4')]]={'uniqueid':_0x47791f['uniqueid'],'accountcode':_0x47791f[_0x3676('0x7')],'exten':_0x47791f[_0x3676('0x13')],'context':_0x47791f[_0x3676('0x12')],'channel':_0x47791f['channel'],'monitors':[]};}}catch(_0x2ef043){utils[_0x3676('0x14')](util[_0x3676('0xe')]('[%s][recordings][newchannel]',_0x47791f[_0x3676('0x4')]),_0x2ef043);}};exports[_0x3676('0x15')]=function(_0x4f49cd){try{utils[_0x3676('0xd')](util[_0x3676('0xe')](_0x3676('0x16'),_0x4f49cd['uniqueid']),_0x4f49cd);if(!_[_0x3676('0x17')](recordings[_0x4f49cd[_0x3676('0x4')]])&&_0x4f49cd['channelstate']==0x6){utils['info'](util[_0x3676('0xe')](_0x3676('0x18'),_0x4f49cd[_0x3676('0x4')],_0x4f49cd[_0x3676('0x12')],_0x4f49cd[_0x3676('0x19')]));}else if(!_[_0x3676('0x17')](recordings[_0x4f49cd[_0x3676('0x10')]])&&_0x4f49cd['channelstate']==0x6&&_0x4f49cd[_0x3676('0x12')]!='transfer'){utils[_0x3676('0x3')](util['format'](_0x3676('0x1a'),_0x4f49cd[_0x3676('0x4')],_0x4f49cd[_0x3676('0x10')],_0x4f49cd[_0x3676('0x12')],_0x4f49cd[_0x3676('0x19')]));recordings[_0x4f49cd['linkedid']][_0x3676('0x7')]=_0x4f49cd['accountcode'];}}catch(_0x1fb1b8){utils[_0x3676('0x14')](util[_0x3676('0xe')]('[%s][recordings][newstate]',_0x4f49cd[_0x3676('0x4')]),_0x1fb1b8);}};exports['varset']=function(_0x49ad09){try{if(!_['isNil'](_0x49ad09['variable'])&&!_[_0x3676('0x17')](_0x49ad09[_0x3676('0x1b')][_0x3676('0x1c')])){utils[_0x3676('0xd')](util[_0x3676('0xe')](_0x3676('0x1d'),_0x49ad09[_0x3676('0x4')]),_0x49ad09);utils[_0x3676('0x3')](util[_0x3676('0xe')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x49ad09[_0x3676('0x4')],_0x49ad09[_0x3676('0x1b')],_0x49ad09[_0x3676('0x1e')]));if(_['endsWith'](_0x49ad09[_0x3676('0x1e')],_0x3676('0x1f'))){_0x49ad09['value']=_0x49ad09[_0x3676('0x1e')][_0x3676('0x20')]('.wav49',_0x3676('0x21'));}if(recordings[_0x49ad09[_0x3676('0x10')]]){var _0x14553=_[_0x3676('0x22')](recordings[_0x49ad09[_0x3676('0x10')]][_0x3676('0x23')],{'value':_0x49ad09[_0x3676('0x1e')]});if(_[_0x3676('0x17')](_0x14553)){recordings[_0x49ad09[_0x3676('0x10')]]['monitors']['push']({'value':_0x49ad09[_0x3676('0x1e')]});}}}}catch(_0xe193f4){utils[_0x3676('0x14')](util[_0x3676('0xe')](_0x3676('0x1d'),_0x49ad09[_0x3676('0x4')]),_0xe193f4);}};exports[_0x3676('0x24')]=function(_0x3c2536){try{if(!_[_0x3676('0x17')](recordings[_0x3c2536[_0x3676('0x4')]])){utils[_0x3676('0xd')](util[_0x3676('0xe')](_0x3676('0x25'),_0x3c2536[_0x3676('0x4')]),_0x3c2536);utils[_0x3676('0x3')](util[_0x3676('0xe')](_0x3676('0x26'),_0x3c2536[_0x3676('0x4')],_0x3c2536['calleridnum'],_0x3c2536['calleridname'],_0x3c2536[_0x3676('0x27')]));recordings[_0x3c2536[_0x3676('0x4')]][_0x3676('0x28')]=_0x3c2536[_0x3676('0x28')];recordings[_0x3c2536[_0x3676('0x4')]]['calleridname']=_0x3c2536[_0x3676('0x29')];recordings[_0x3c2536['uniqueid']][_0x3676('0x2a')]=_0x3c2536[_0x3676('0x2a')];recordings[_0x3c2536['uniqueid']][_0x3676('0x2b')]=_0x3c2536[_0x3676('0x2b')];if(recordings[_0x3c2536['uniqueid']][_0x3676('0x2c')]==_0x3676('0x2d')&&recordings[_0x3c2536[_0x3676('0x4')]]['accountcode']){recordings[_0x3c2536['uniqueid']][_0x3676('0x2a')]=recordings[_0x3c2536['uniqueid']][_0x3676('0x7')];recordings[_0x3c2536[_0x3676('0x4')]][_0x3676('0x2b')]='';}recordings[_0x3c2536['uniqueid']][_0x3676('0x23')][_0x3676('0x2e')](function(_0xe3547c){var _0x1d6c6c=_[_0x3676('0x2f')](recordings[_0x3c2536[_0x3676('0x4')]]);_0x1d6c6c[_0x3676('0x1e')]=_0xe3547c['value'];writeDB(_0x1d6c6c);});delete recordings[_0x3c2536[_0x3676('0x4')]];}}catch(_0x3c08ed){utils[_0x3676('0x14')](util[_0x3676('0xe')](_0x3676('0x25'),_0x3c2536[_0x3676('0x4')]),_0x3c08ed);}};exports['newexten']=function(_0x586b4f){try{if(!_[_0x3676('0x17')](recordings[_0x586b4f[_0x3676('0x4')]])){utils['debug'](util[_0x3676('0xe')]('[%s][recordings][newexten]',_0x586b4f['uniqueid']),_0x586b4f);utils[_0x3676('0x3')](util[_0x3676('0xe')](_0x3676('0x30'),_0x586b4f[_0x3676('0x4')],_0x586b4f[_0x3676('0x31')],_0x586b4f['appdata']));if(_0x586b4f[_0x3676('0x31')][_0x3676('0x32')]()==_0x3676('0x33')&&_[_0x3676('0x34')](_0x586b4f[_0x3676('0x35')]['toLowerCase'](),_0x3676('0x36'))){var _0x1f0275=_0x586b4f[_0x3676('0x35')][_0x3676('0x37')]('=');var _0x59ce85=_0x1f0275[0x0]['substring'](_0x1f0275[0x0][_0x3676('0x38')]('(')+0x1,_0x1f0275[0x0][_0x3676('0x38')](')'));var _0xcadde1=_0x1f0275[0x1];recordings[_0x586b4f[_0x3676('0x4')]][_0x59ce85]=_0xcadde1;}}}catch(_0xa911c6){utils['error'](util[_0x3676('0xe')]('[%s][recordings][newexten]',_0x586b4f[_0x3676('0x4')]),_0xa911c6);}};exports[_0x3676('0x39')]=function(_0x8bc661){try{if(!_[_0x3676('0x17')](recordings[_0x8bc661[_0x3676('0x4')]])){utils[_0x3676('0xd')](util[_0x3676('0xe')](_0x3676('0x3a'),_0x8bc661[_0x3676('0x4')]),_0x8bc661);utils[_0x3676('0x3')](util[_0x3676('0xe')](_0x3676('0x3b'),_0x8bc661[_0x3676('0x4')],_0x8bc661['queue']));recordings[_0x8bc661[_0x3676('0x4')]][_0x3676('0x3c')]=_0x8bc661[_0x3676('0x3c')];}}catch(_0x4fa7a8){utils[_0x3676('0x14')](util[_0x3676('0xe')](_0x3676('0x3a'),_0x8bc661['uniqueid']),_0x4fa7a8);}};exports[_0x3676('0x3d')]=function(_0x4001bf){try{utils[_0x3676('0xd')](util[_0x3676('0xe')]('[%s][recordings][blindtransfer]',_0x4001bf[_0x3676('0x4')]),_0x4001bf);utils[_0x3676('0x3')](util['format'](_0x3676('0x3e'),_0x4001bf[_0x3676('0x4')],_0x4001bf[_0x3676('0x3f')],_0x4001bf['transferercalleridname'],_0x4001bf[_0x3676('0x40')],_0x4001bf[_0x3676('0x41')]));if(recordings[_0x4001bf[_0x3676('0x42')]]&&transfers[_0x3676('0x5')][_0x4001bf[_0x3676('0x42')]]){transfers[_0x3676('0x5')][_0x4001bf[_0x3676('0x42')]][_0x3676('0x43')]=!![];}}catch(_0x36d1c0){utils[_0x3676('0x14')](util[_0x3676('0xe')]('[%s][recordings][blindtransfer]',_0x4001bf[_0x3676('0x4')]),_0x36d1c0);}}; \ No newline at end of file +var _0xa188=['variable','[%s][recordings][varset]','value','replace','.wav49','.WAV','monitors','push','hangup','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','[%s][recordings][queuecallerjoin]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','lodash','util','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','transfereeuniqueid','accountcode','getUserByInternal','membername','name','UserId','request','CreateVoiceRecording','blinds','newchannel','debug','linkedid','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channelstate','transfer','varset'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xa188,0xb3));var _0x8a18=function(_0x4ed412,_0x2f9990){_0x4ed412=_0x4ed412-0x0;var _0x3347e8=_0xa188[_0x4ed412];return _0x3347e8;};'use strict';var _=require(_0x8a18('0x0'));var util=require(_0x8a18('0x1'));var utils=require(_0x8a18('0x2'));var transfers=require(_0x8a18('0x3'));var recordings={};function writeDB(_0x2b030a){var _0x3c6142;utils[_0x8a18('0x4')](util[_0x8a18('0x5')](_0x8a18('0x6'),_0x2b030a[_0x8a18('0x7')]));if(transfers['blinds'][_0x2b030a[_0x8a18('0x7')]]){_0x3c6142=_0x2b030a['uniqueid'];_0x2b030a['uniqueid']=transfers['blinds'][_0x2b030a['uniqueid']][_0x8a18('0x8')];}if(_0x2b030a[_0x8a18('0x9')]){utils[_0x8a18('0xa')](_0x2b030a['accountcode'])['then'](function(_0x2817ce){if(_0x2817ce){_0x2b030a[_0x8a18('0xb')]=_0x2817ce[_0x8a18('0xc')];_0x2b030a[_0x8a18('0xd')]=_0x2817ce['id'];}utils[_0x8a18('0xe')](_0x8a18('0xf'),_0x2b030a);});}else{utils[_0x8a18('0xe')]('CreateVoiceRecording',_0x2b030a);}if(_0x3c6142)delete transfers[_0x8a18('0x10')][_0x3c6142];}exports[_0x8a18('0x11')]=function(_0x144f48){try{utils[_0x8a18('0x12')](util[_0x8a18('0x5')]('[%s][recordings][newchannel]',_0x144f48['uniqueid']),_0x144f48);if(_0x144f48['uniqueid']==_0x144f48[_0x8a18('0x13')]){utils[_0x8a18('0x4')](util['format']('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x144f48[_0x8a18('0x7')],_0x144f48[_0x8a18('0x14')],_0x144f48['exten']));recordings[_0x144f48[_0x8a18('0x7')]]={'uniqueid':_0x144f48['uniqueid'],'accountcode':_0x144f48[_0x8a18('0x9')],'exten':_0x144f48[_0x8a18('0x15')],'context':_0x144f48[_0x8a18('0x14')],'channel':_0x144f48[_0x8a18('0x16')],'monitors':[]};}}catch(_0x12ec5d){utils[_0x8a18('0x17')](util[_0x8a18('0x5')]('[%s][recordings][newchannel]',_0x144f48[_0x8a18('0x7')]),_0x12ec5d);}};exports[_0x8a18('0x18')]=function(_0x2329af){try{utils['debug'](util[_0x8a18('0x5')](_0x8a18('0x19'),_0x2329af[_0x8a18('0x7')]),_0x2329af);if(!_[_0x8a18('0x1a')](recordings[_0x2329af[_0x8a18('0x7')]])&&_0x2329af['channelstate']==0x6){utils[_0x8a18('0x4')](util[_0x8a18('0x5')](_0x8a18('0x1b'),_0x2329af[_0x8a18('0x7')],_0x2329af[_0x8a18('0x14')],_0x2329af['channel']));}else if(!_[_0x8a18('0x1a')](recordings[_0x2329af['linkedid']])&&_0x2329af[_0x8a18('0x1c')]==0x6&&_0x2329af[_0x8a18('0x14')]!=_0x8a18('0x1d')){utils[_0x8a18('0x4')](util['format']('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x2329af[_0x8a18('0x7')],_0x2329af[_0x8a18('0x13')],_0x2329af[_0x8a18('0x14')],_0x2329af[_0x8a18('0x16')]));recordings[_0x2329af[_0x8a18('0x13')]]['accountcode']=_0x2329af[_0x8a18('0x9')];}}catch(_0x1c4a0c){utils['error'](util['format'](_0x8a18('0x19'),_0x2329af[_0x8a18('0x7')]),_0x1c4a0c);}};exports[_0x8a18('0x1e')]=function(_0x4f4c58){try{if(!_['isNil'](_0x4f4c58[_0x8a18('0x1f')])&&!_[_0x8a18('0x1a')](_0x4f4c58['variable']['mixmonitor_filename'])){utils[_0x8a18('0x12')](util[_0x8a18('0x5')](_0x8a18('0x20'),_0x4f4c58[_0x8a18('0x7')]),_0x4f4c58);utils[_0x8a18('0x4')](util[_0x8a18('0x5')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x4f4c58[_0x8a18('0x7')],_0x4f4c58['variable'],_0x4f4c58[_0x8a18('0x21')]));if(_['endsWith'](_0x4f4c58[_0x8a18('0x21')],'.wav49')){_0x4f4c58[_0x8a18('0x21')]=_0x4f4c58[_0x8a18('0x21')][_0x8a18('0x22')](_0x8a18('0x23'),_0x8a18('0x24'));}if(recordings[_0x4f4c58[_0x8a18('0x13')]]){var _0x5e566c=_['find'](recordings[_0x4f4c58['linkedid']][_0x8a18('0x25')],{'value':_0x4f4c58[_0x8a18('0x21')]});if(_[_0x8a18('0x1a')](_0x5e566c)){recordings[_0x4f4c58[_0x8a18('0x13')]][_0x8a18('0x25')][_0x8a18('0x26')]({'value':_0x4f4c58['value']});}}}}catch(_0x5e87a4){utils[_0x8a18('0x17')](util['format']('[%s][recordings][varset]',_0x4f4c58[_0x8a18('0x7')]),_0x5e87a4);}};exports[_0x8a18('0x27')]=function(_0x3bf1df){try{if(!_['isNil'](recordings[_0x3bf1df[_0x8a18('0x7')]])){utils['debug'](util[_0x8a18('0x5')]('[%s][recordings][hangup]',_0x3bf1df['uniqueid']),_0x3bf1df);utils['info'](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x3bf1df[_0x8a18('0x7')],_0x3bf1df[_0x8a18('0x28')],_0x3bf1df[_0x8a18('0x29')],_0x3bf1df[_0x8a18('0x2a')]));recordings[_0x3bf1df[_0x8a18('0x7')]][_0x8a18('0x28')]=_0x3bf1df[_0x8a18('0x28')];recordings[_0x3bf1df[_0x8a18('0x7')]][_0x8a18('0x29')]=_0x3bf1df[_0x8a18('0x29')];recordings[_0x3bf1df[_0x8a18('0x7')]][_0x8a18('0x2b')]=_0x3bf1df[_0x8a18('0x2b')];recordings[_0x3bf1df[_0x8a18('0x7')]][_0x8a18('0x2c')]=_0x3bf1df[_0x8a18('0x2c')];if(recordings[_0x3bf1df[_0x8a18('0x7')]][_0x8a18('0x2d')]==_0x8a18('0x2e')&&recordings[_0x3bf1df['uniqueid']]['accountcode']){recordings[_0x3bf1df[_0x8a18('0x7')]][_0x8a18('0x2b')]=recordings[_0x3bf1df[_0x8a18('0x7')]]['accountcode'];recordings[_0x3bf1df[_0x8a18('0x7')]][_0x8a18('0x2c')]='';}recordings[_0x3bf1df[_0x8a18('0x7')]][_0x8a18('0x25')][_0x8a18('0x2f')](function(_0x32e8f0){var _0x83a32a=_[_0x8a18('0x30')](recordings[_0x3bf1df[_0x8a18('0x7')]]);_0x83a32a[_0x8a18('0x21')]=_0x32e8f0[_0x8a18('0x21')];writeDB(_0x83a32a);});delete recordings[_0x3bf1df['uniqueid']];}}catch(_0x3194a7){utils['error'](util[_0x8a18('0x5')]('[%s][recordings][hangup]',_0x3bf1df['uniqueid']),_0x3194a7);}};exports[_0x8a18('0x31')]=function(_0x1561d9){try{if(!_[_0x8a18('0x1a')](recordings[_0x1561d9[_0x8a18('0x7')]])){utils[_0x8a18('0x12')](util[_0x8a18('0x5')](_0x8a18('0x32'),_0x1561d9[_0x8a18('0x7')]),_0x1561d9);utils['info'](util[_0x8a18('0x5')](_0x8a18('0x33'),_0x1561d9[_0x8a18('0x7')],_0x1561d9['application'],_0x1561d9[_0x8a18('0x34')]));if(_0x1561d9[_0x8a18('0x35')][_0x8a18('0x36')]()==_0x8a18('0x37')&&_[_0x8a18('0x38')](_0x1561d9['appdata'][_0x8a18('0x36')](),_0x8a18('0x39'))){var _0x19421f=_0x1561d9[_0x8a18('0x34')][_0x8a18('0x3a')]('=');var _0x7b714b=_0x19421f[0x0][_0x8a18('0x3b')](_0x19421f[0x0][_0x8a18('0x3c')]('(')+0x1,_0x19421f[0x0][_0x8a18('0x3c')](')'));var _0x24cdf7=_0x19421f[0x1];recordings[_0x1561d9[_0x8a18('0x7')]][_0x7b714b]=_0x24cdf7;}}}catch(_0x4abc1e){utils[_0x8a18('0x17')](util['format'](_0x8a18('0x32'),_0x1561d9[_0x8a18('0x7')]),_0x4abc1e);}};exports[_0x8a18('0x3d')]=function(_0x2775b8){try{if(!_[_0x8a18('0x1a')](recordings[_0x2775b8['uniqueid']])){utils[_0x8a18('0x12')](util[_0x8a18('0x5')]('[%s][recordings][queuecallerjoin]',_0x2775b8[_0x8a18('0x7')]),_0x2775b8);utils[_0x8a18('0x4')](util[_0x8a18('0x5')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x2775b8['uniqueid'],_0x2775b8[_0x8a18('0x3e')]));recordings[_0x2775b8['uniqueid']][_0x8a18('0x3e')]=_0x2775b8[_0x8a18('0x3e')];}}catch(_0x2cec1e){utils[_0x8a18('0x17')](util['format'](_0x8a18('0x3f'),_0x2775b8['uniqueid']),_0x2cec1e);}};exports['blindtransfer']=function(_0x2e08bf){try{utils['debug'](util[_0x8a18('0x5')]('[%s][recordings][blindtransfer]',_0x2e08bf['uniqueid']),_0x2e08bf);utils['info'](util['format'](_0x8a18('0x40'),_0x2e08bf[_0x8a18('0x7')],_0x2e08bf[_0x8a18('0x41')],_0x2e08bf[_0x8a18('0x42')],_0x2e08bf[_0x8a18('0x43')],_0x2e08bf[_0x8a18('0x44')]));if(recordings[_0x2e08bf[_0x8a18('0x45')]]&&transfers[_0x8a18('0x10')][_0x2e08bf[_0x8a18('0x45')]]){transfers[_0x8a18('0x10')][_0x2e08bf[_0x8a18('0x45')]]['recording']=!![];}}catch(_0x3a1756){utils[_0x8a18('0x17')](util[_0x8a18('0x5')]('[%s][recordings][blindtransfer]',_0x2e08bf[_0x8a18('0x7')]),_0x3a1756);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index b836592..a71716a 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 _0x838a=['format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','uniqueid','transferercalleridnum','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','attendedtransfer','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','origtransferercontext','isNil','transfereechannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util','./utils','info'];(function(_0x578df5,_0x294587){var _0x3d11ef=function(_0x278c6e){while(--_0x278c6e){_0x578df5['push'](_0x578df5['shift']());}};_0x3d11ef(++_0x294587);}(_0x838a,0x1d5));var _0xa838=function(_0x83af7f,_0x49c6fd){_0x83af7f=_0x83af7f-0x0;var _0x32d85c=_0x838a[_0x83af7f];return _0x32d85c;};'use strict';var _=require(_0xa838('0x0'));var util=require(_0xa838('0x1'));var utils=require(_0xa838('0x2'));function writeDB(_0x2c2a30){utils[_0xa838('0x3')](util[_0xa838('0x4')](_0xa838('0x5'),_0x2c2a30[_0xa838('0x6')]===_0xa838('0x7')?_0x2c2a30[_0xa838('0x8')]:_0x2c2a30['uniqueid'],_0x2c2a30[_0xa838('0x6')]));utils[_0xa838('0x9')](_0xa838('0xa'),_0x2c2a30);}exports[_0xa838('0xb')]={};exports[_0xa838('0xc')]=function(_0x51465f){try{utils[_0xa838('0xd')](util['format'](_0xa838('0xe'),_0x51465f['uniqueid']),_0x51465f);utils[_0xa838('0x3')](util[_0xa838('0x4')](_0xa838('0xf'),_0x51465f[_0xa838('0x10')],_0x51465f[_0xa838('0x11')],_0x51465f['transferercalleridname'],_0x51465f[_0xa838('0x12')],_0x51465f[_0xa838('0x13')]));_0x51465f[_0xa838('0x6')]=_0xa838('0x14');exports[_0xa838('0xb')][_0x51465f[_0xa838('0x15')]]=_0x51465f;writeDB(_0x51465f);}catch(_0x2371ac){utils[_0xa838('0x16')](util[_0xa838('0x4')](_0xa838('0xe'),_0x51465f[_0xa838('0x10')]),_0x2371ac);}};exports[_0xa838('0x17')]=function(_0xb9296e){try{utils[_0xa838('0xd')](util[_0xa838('0x4')]('[%s][transfers][attendedtransfer]',_0xb9296e['origtransfereruniqueid']),_0xb9296e);utils[_0xa838('0x3')](util[_0xa838('0x4')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0xb9296e[_0xa838('0x8')],_0xb9296e[_0xa838('0x18')],_0xb9296e[_0xa838('0x19')],_0xb9296e[_0xa838('0x1a')],_0xb9296e['transfertargetcalleridname']));_0xb9296e=_[_0xa838('0x1b')](_0xb9296e,{'transfererchannel':_0xb9296e[_0xa838('0x1c')],'transferercalleridnum':_0xb9296e[_0xa838('0x18')],'transferercalleridname':_0xb9296e[_0xa838('0x19')],'transfererconnectedlinenum':_0xb9296e[_0xa838('0x1d')],'transfererconnectedlinename':_0xb9296e[_0xa838('0x1e')],'transfereraccountcode':_0xb9296e[_0xa838('0x1f')],'transferercontext':_0xb9296e[_0xa838('0x20')],'transfererexten':_0xb9296e['secondtransfererexten'],'transfererlinkedid':_0xb9296e[_0xa838('0x21')],'context':_0xb9296e[_0xa838('0x22')],'extension':_0xb9296e['origtransfererexten'],'type':_0xa838('0x7')});if(_[_0xa838('0x23')](_0xb9296e[_0xa838('0x24')])){_0xb9296e=_[_0xa838('0x1b')](_0xb9296e,{'transfereechannel':_0xb9296e['transfertargetchannel'],'transfereecalleridnum':_0xb9296e[_0xa838('0x1a')],'transfereecalleridname':_0xb9296e['transfertargetcalleridname'],'transfereeconnectedlinenum':_0xb9296e[_0xa838('0x25')],'transfereeconnectedlinename':_0xb9296e[_0xa838('0x26')],'transfereeaccountcode':_0xb9296e[_0xa838('0x27')],'transfereecontext':_0xb9296e[_0xa838('0x28')],'transfereeexten':_0xb9296e['transfertargetexten'],'transfereelinkedid':_0xb9296e[_0xa838('0x29')]});}writeDB(_0xb9296e);}catch(_0x321650){utils['error'](util[_0xa838('0x4')](_0xa838('0x2a'),_0xb9296e[_0xa838('0x8')]),_0x321650);}}; \ No newline at end of file +var _0x07e4=['origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util','info','format','[%s][transfers][writeDB]\x20type:%s','type','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridname','blind','transfereruniqueid','error','attendedtransfer','debug','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum'];(function(_0xee1593,_0x39434f){var _0x17e08e=function(_0x48e4f2){while(--_0x48e4f2){_0xee1593['push'](_0xee1593['shift']());}};_0x17e08e(++_0x39434f);}(_0x07e4,0x1b5));var _0x407e=function(_0x3d6ca8,_0x5c78fb){_0x3d6ca8=_0x3d6ca8-0x0;var _0xef5b6d=_0x07e4[_0x3d6ca8];return _0xef5b6d;};'use strict';var _=require(_0x407e('0x0'));var util=require(_0x407e('0x1'));var utils=require('./utils');function writeDB(_0x533fae){utils[_0x407e('0x2')](util[_0x407e('0x3')](_0x407e('0x4'),_0x533fae[_0x407e('0x5')]==='attended'?_0x533fae['origtransfereruniqueid']:_0x533fae[_0x407e('0x6')],_0x533fae[_0x407e('0x5')]));utils[_0x407e('0x7')](_0x407e('0x8'),_0x533fae);}exports[_0x407e('0x9')]={};exports[_0x407e('0xa')]=function(_0x4a20a6){try{utils['debug'](util[_0x407e('0x3')](_0x407e('0xb'),_0x4a20a6[_0x407e('0x6')]),_0x4a20a6);utils['info'](util['format'](_0x407e('0xc'),_0x4a20a6['uniqueid'],_0x4a20a6['transferercalleridnum'],_0x4a20a6[_0x407e('0xd')],_0x4a20a6['transfereecalleridnum'],_0x4a20a6[_0x407e('0xe')]));_0x4a20a6[_0x407e('0x5')]=_0x407e('0xf');exports[_0x407e('0x9')][_0x4a20a6[_0x407e('0x10')]]=_0x4a20a6;writeDB(_0x4a20a6);}catch(_0x5b66e4){utils[_0x407e('0x11')](util[_0x407e('0x3')](_0x407e('0xb'),_0x4a20a6[_0x407e('0x6')]),_0x5b66e4);}};exports[_0x407e('0x12')]=function(_0x27e47c){try{utils[_0x407e('0x13')](util[_0x407e('0x3')]('[%s][transfers][attendedtransfer]',_0x27e47c[_0x407e('0x14')]),_0x27e47c);utils['info'](util['format'](_0x407e('0x15'),_0x27e47c[_0x407e('0x14')],_0x27e47c[_0x407e('0x16')],_0x27e47c[_0x407e('0x17')],_0x27e47c[_0x407e('0x18')],_0x27e47c[_0x407e('0x19')]));_0x27e47c=_[_0x407e('0x1a')](_0x27e47c,{'transfererchannel':_0x27e47c[_0x407e('0x1b')],'transferercalleridnum':_0x27e47c[_0x407e('0x16')],'transferercalleridname':_0x27e47c[_0x407e('0x17')],'transfererconnectedlinenum':_0x27e47c[_0x407e('0x1c')],'transfererconnectedlinename':_0x27e47c[_0x407e('0x1d')],'transfereraccountcode':_0x27e47c[_0x407e('0x1e')],'transferercontext':_0x27e47c[_0x407e('0x1f')],'transfererexten':_0x27e47c[_0x407e('0x20')],'transfererlinkedid':_0x27e47c['origtransfererlinkedid'],'context':_0x27e47c[_0x407e('0x21')],'extension':_0x27e47c[_0x407e('0x22')],'type':_0x407e('0x23')});if(_[_0x407e('0x24')](_0x27e47c[_0x407e('0x25')])){_0x27e47c=_['assign'](_0x27e47c,{'transfereechannel':_0x27e47c[_0x407e('0x26')],'transfereecalleridnum':_0x27e47c['transfertargetcalleridnum'],'transfereecalleridname':_0x27e47c[_0x407e('0x19')],'transfereeconnectedlinenum':_0x27e47c[_0x407e('0x27')],'transfereeconnectedlinename':_0x27e47c[_0x407e('0x28')],'transfereeaccountcode':_0x27e47c[_0x407e('0x29')],'transfereecontext':_0x27e47c[_0x407e('0x2a')],'transfereeexten':_0x27e47c[_0x407e('0x2b')],'transfereelinkedid':_0x27e47c[_0x407e('0x2c')]});}writeDB(_0x27e47c);}catch(_0x32a76c){utils[_0x407e('0x11')](util[_0x407e('0x3')](_0x407e('0x2d'),_0x27e47c['origtransfereruniqueid']),_0x32a76c);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 2e4340b..a56d864 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 _0xad37=['internal','name','interface','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]','getVoiceQueueByName','type','acw','acwTimeout','[utils][getVoiceQueueByName]','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','format','diff','sumTime','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser'];(function(_0x5ae639,_0x5c7c0e){var _0xead0c9=function(_0x424bf4){while(--_0x424bf4){_0x5ae639['push'](_0x5ae639['shift']());}};_0xead0c9(++_0x5c7c0e);}(_0xad37,0xaf));var _0x7ad3=function(_0x1fcc82,_0x5a1d23){_0x1fcc82=_0x1fcc82-0x0;var _0x3df629=_0xad37[_0x1fcc82];return _0x3df629;};'use strict';var BPromise=require(_0x7ad3('0x0'));var jayson=require(_0x7ad3('0x1'));var moment=require(_0x7ad3('0x2'));var util=require(_0x7ad3('0x3'));var client=jayson[_0x7ad3('0x4')][_0x7ad3('0x5')]({'port':0x2329});var logger=require(_0x7ad3('0x6'))(_0x7ad3('0x7'));exports[_0x7ad3('0x8')]=function(_0x41a1c0,_0x51d6ae){logger[_0x7ad3('0x8')](_0x41a1c0,_0x51d6ae?util[_0x7ad3('0x9')](_0x51d6ae,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x25f5b3,_0x33cba0){logger[_0x7ad3('0xa')](_0x25f5b3,_0x33cba0?util[_0x7ad3('0x9')](_0x33cba0,{'showHidden':![],'depth':null}):'');};exports[_0x7ad3('0xb')]=function(_0x2f422e,_0x43abb7){logger[_0x7ad3('0xb')](_0x2f422e,_0x43abb7?util[_0x7ad3('0x9')](_0x43abb7,{'showHidden':![],'depth':null}):'');};exports[_0x7ad3('0xc')]=function(_0x46f05d,_0x51eaf7){return client['request'](_0x46f05d,{'body':_0x51eaf7})[_0x7ad3('0xd')](function(_0xb0a5bf){logger[_0x7ad3('0xa')](_0x7ad3('0xe'),_0x46f05d,_0xb0a5bf?util['inspect'](_0xb0a5bf,{'showHidden':![],'depth':null}):'');})[_0x7ad3('0xf')](function(_0x11aab6){logger[_0x7ad3('0xb')](_0x7ad3('0xe'),_0x46f05d,_0x11aab6?util[_0x7ad3('0x9')](_0x11aab6,{'showHidden':![],'depth':null}):'');});};function getUser(_0x258e3e){return client[_0x7ad3('0xc')](_0x7ad3('0x10'),{'options':{'raw':!![],'attributes':['id',_0x7ad3('0x11'),_0x7ad3('0x12'),_0x7ad3('0x13')],'where':_0x258e3e,'limit':0x1}})[_0x7ad3('0xd')](function(_0xc5147){logger[_0x7ad3('0xa')]('[utils][getUser]\x20where:%s',JSON[_0x7ad3('0x14')](_0x258e3e),_0xc5147?util['inspect'](_0xc5147,{'showHidden':![],'depth':null}):'');return _0xc5147[_0x7ad3('0x15')][_0x7ad3('0x16')]?_0xc5147['result'][0x0]:null;});}exports[_0x7ad3('0x17')]=function(_0xeacca0){return new BPromise(function(_0x3635f4,_0x1da7e2){if(_0xeacca0){return getUser({'internal':_0xeacca0})[_0x7ad3('0xd')](function(_0x1f3e57){logger[_0x7ad3('0x8')](_0x7ad3('0x18'),_0xeacca0,_0x1f3e57?'found':_0x7ad3('0x19'));return _0x3635f4(_0x1f3e57);})[_0x7ad3('0xf')](function(_0x5209d8){logger[_0x7ad3('0xb')](_0x7ad3('0x1a'),_0x5209d8?util[_0x7ad3('0x9')](_0x5209d8,{'showHidden':![],'depth':null}):'');return _0x3635f4(null);});}return _0x3635f4(null);});};exports[_0x7ad3('0x1b')]=function(_0x158f91){return new BPromise(function(_0x395ed2,_0x150b3){if(_0x158f91){return getUser({'interface':_0x158f91})['then'](function(_0x5bb5ec){logger['info'](_0x7ad3('0x1c'),_0x158f91,_0x5bb5ec?_0x7ad3('0x1d'):_0x7ad3('0x19'));return _0x395ed2(_0x5bb5ec);})[_0x7ad3('0xf')](function(_0x416fb8){logger['error'](_0x7ad3('0x1e'),_0x416fb8?util[_0x7ad3('0x9')](_0x416fb8,{'showHidden':![],'depth':null}):'');return _0x395ed2(null);});}return _0x395ed2(null);});};exports[_0x7ad3('0x1f')]=function(_0xdfb55f){return new BPromise(function(_0x35bdf0,_0x536b44){if(_0xdfb55f){return getUser({'name':_0xdfb55f})[_0x7ad3('0xd')](function(_0x4a9f4f){logger[_0x7ad3('0x8')]('[utils][getUserByName]\x20name:%s\x20%s',_0xdfb55f,_0x4a9f4f?_0x7ad3('0x1d'):_0x7ad3('0x19'));return _0x35bdf0(_0x4a9f4f);})[_0x7ad3('0xf')](function(_0x526db4){logger[_0x7ad3('0xb')](_0x7ad3('0x20'),_0x526db4?util[_0x7ad3('0x9')](_0x526db4,{'showHidden':![],'depth':null}):'');return _0x35bdf0(null);});}return _0x35bdf0(null);});};exports[_0x7ad3('0x21')]=function(_0x268c1f){return new BPromise(function(_0x4bb0c4,_0x53d783){if(_0x268c1f){return client[_0x7ad3('0xc')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id','name',_0x7ad3('0x22'),_0x7ad3('0x23'),_0x7ad3('0x24')],'where':{'name':_0x268c1f},'limit':0x1}})['then'](function(_0x352347){logger[_0x7ad3('0xa')]('[utils][getVoiceQueueByName]\x20name:%s',_0x268c1f,_0x352347?util['inspect'](_0x352347,{'showHidden':![],'depth':null}):'');logger['info']('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x268c1f,_0x352347?_0x7ad3('0x1d'):'notfound');return _0x4bb0c4(_0x352347['result'][_0x7ad3('0x16')]?_0x352347[_0x7ad3('0x15')][0x0]:null);})['catch'](function(_0x374d36){logger[_0x7ad3('0xb')](_0x7ad3('0x25'),_0x374d36?util[_0x7ad3('0x9')](_0x374d36,{'showHidden':![],'depth':null}):'');return _0x4bb0c4(null);});}return _0x4bb0c4(null);});};exports[_0x7ad3('0x26')]=function(_0x5d8f16,_0x297e32){return moment(_0x5d8f16)[_0x7ad3('0x27')](_0x297e32,_0x7ad3('0x28'))['format'](_0x7ad3('0x29'));};exports[_0x7ad3('0x2a')]=function(_0x17071a,_0x439140){return moment(_0x17071a)['subtract'](_0x439140,_0x7ad3('0x28'))[_0x7ad3('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x33dd59,_0x116e70){return moment(_0x33dd59)[_0x7ad3('0x2c')](moment(_0x116e70),'seconds');};exports[_0x7ad3('0x2d')]=function(_0x5320b6,_0x3e40cd){return parseInt(_0x5320b6,0xa)+parseInt(_0x3e40cd,0xa);};exports['now']=function(){return moment()['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x7ad3('0x2e')]=function(_0x160ad6,_0x4ef57f){if(_0x4ef57f){return moment(_0x160ad6)['isAfter'](_0x4ef57f);}return!![];};exports[_0x7ad3('0x2f')]=function(_0x576a2e,_0x32f810){if(_0x32f810){return moment(_0x576a2e)[_0x7ad3('0x2f')](_0x32f810);}else if(_0x576a2e){return!![];}return![];}; \ No newline at end of file +var _0x01e4=['format','YYYY-MM-DD\x20HH:mm:ss','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','util','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','internal','interface','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','name','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds'];(function(_0x423097,_0x8a09f4){var _0x3a73f1=function(_0x9314f0){while(--_0x9314f0){_0x423097['push'](_0x423097['shift']());}};_0x3a73f1(++_0x8a09f4);}(_0x01e4,0x1dd));var _0x401e=function(_0x5d6bb7,_0x101286){_0x5d6bb7=_0x5d6bb7-0x0;var _0x5052b5=_0x01e4[_0x5d6bb7];return _0x5052b5;};'use strict';var BPromise=require(_0x401e('0x0'));var jayson=require(_0x401e('0x1'));var moment=require('moment');var util=require(_0x401e('0x2'));var client=jayson['client'][_0x401e('0x3')]({'port':0x2329});var logger=require(_0x401e('0x4'))(_0x401e('0x5'));exports['info']=function(_0x5a067f,_0x539447){logger[_0x401e('0x6')](_0x5a067f,_0x539447?util[_0x401e('0x7')](_0x539447,{'showHidden':![],'depth':null}):'');};exports[_0x401e('0x8')]=function(_0x1b8652,_0x4285d3){logger['debug'](_0x1b8652,_0x4285d3?util[_0x401e('0x7')](_0x4285d3,{'showHidden':![],'depth':null}):'');};exports[_0x401e('0x9')]=function(_0x457390,_0x13ff7e){logger[_0x401e('0x9')](_0x457390,_0x13ff7e?util[_0x401e('0x7')](_0x13ff7e,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x2c12e8,_0x557a64){return client[_0x401e('0xa')](_0x2c12e8,{'body':_0x557a64})[_0x401e('0xb')](function(_0x393bf0){logger['debug'](_0x401e('0xc'),_0x2c12e8,_0x393bf0?util[_0x401e('0x7')](_0x393bf0,{'showHidden':![],'depth':null}):'');})[_0x401e('0xd')](function(_0xdcb5f0){logger[_0x401e('0x9')]('[utils][request]\x20name:%s',_0x2c12e8,_0xdcb5f0?util[_0x401e('0x7')](_0xdcb5f0,{'showHidden':![],'depth':null}):'');});};function getUser(_0x2d1819){return client[_0x401e('0xa')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x401e('0xe'),'name',_0x401e('0xf')],'where':_0x2d1819,'limit':0x1}})[_0x401e('0xb')](function(_0x4ae4ed){logger['debug']('[utils][getUser]\x20where:%s',JSON[_0x401e('0x10')](_0x2d1819),_0x4ae4ed?util[_0x401e('0x7')](_0x4ae4ed,{'showHidden':![],'depth':null}):'');return _0x4ae4ed[_0x401e('0x11')][_0x401e('0x12')]?_0x4ae4ed['result'][0x0]:null;});}exports[_0x401e('0x13')]=function(_0x49e914){return new BPromise(function(_0x271437,_0x13c07a){if(_0x49e914){return getUser({'internal':_0x49e914})[_0x401e('0xb')](function(_0x45b271){logger[_0x401e('0x6')](_0x401e('0x14'),_0x49e914,_0x45b271?_0x401e('0x15'):_0x401e('0x16'));return _0x271437(_0x45b271);})[_0x401e('0xd')](function(_0x34480e){logger['error'](_0x401e('0x17'),_0x34480e?util[_0x401e('0x7')](_0x34480e,{'showHidden':![],'depth':null}):'');return _0x271437(null);});}return _0x271437(null);});};exports[_0x401e('0x18')]=function(_0x27142e){return new BPromise(function(_0x347797,_0x45722d){if(_0x27142e){return getUser({'interface':_0x27142e})[_0x401e('0xb')](function(_0x54cf77){logger[_0x401e('0x6')](_0x401e('0x19'),_0x27142e,_0x54cf77?_0x401e('0x15'):_0x401e('0x16'));return _0x347797(_0x54cf77);})['catch'](function(_0x20db4a){logger['error'](_0x401e('0x1a'),_0x20db4a?util[_0x401e('0x7')](_0x20db4a,{'showHidden':![],'depth':null}):'');return _0x347797(null);});}return _0x347797(null);});};exports[_0x401e('0x1b')]=function(_0xce2ce3){return new BPromise(function(_0x4c4125,_0x43b6dc){if(_0xce2ce3){return getUser({'name':_0xce2ce3})['then'](function(_0x34f6bf){logger[_0x401e('0x6')](_0x401e('0x1c'),_0xce2ce3,_0x34f6bf?_0x401e('0x15'):_0x401e('0x16'));return _0x4c4125(_0x34f6bf);})[_0x401e('0xd')](function(_0x1af3db){logger['error'](_0x401e('0x1d'),_0x1af3db?util[_0x401e('0x7')](_0x1af3db,{'showHidden':![],'depth':null}):'');return _0x4c4125(null);});}return _0x4c4125(null);});};exports[_0x401e('0x1e')]=function(_0x635c1b){return new BPromise(function(_0x2254de,_0x5d6072){if(_0x635c1b){return client[_0x401e('0xa')](_0x401e('0x1f'),{'options':{'raw':!![],'attributes':['id',_0x401e('0x20'),_0x401e('0x21'),'acw',_0x401e('0x22')],'where':{'name':_0x635c1b},'limit':0x1}})['then'](function(_0x5e0b6f){logger[_0x401e('0x8')]('[utils][getVoiceQueueByName]\x20name:%s',_0x635c1b,_0x5e0b6f?util[_0x401e('0x7')](_0x5e0b6f,{'showHidden':![],'depth':null}):'');logger[_0x401e('0x6')](_0x401e('0x23'),_0x635c1b,_0x5e0b6f?_0x401e('0x15'):_0x401e('0x16'));return _0x2254de(_0x5e0b6f[_0x401e('0x11')]['length']?_0x5e0b6f['result'][0x0]:null);})[_0x401e('0xd')](function(_0x2e68be){logger[_0x401e('0x9')](_0x401e('0x24'),_0x2e68be?util['inspect'](_0x2e68be,{'showHidden':![],'depth':null}):'');return _0x2254de(null);});}return _0x2254de(null);});};exports[_0x401e('0x25')]=function(_0x2d0f7b,_0x41416c){return moment(_0x2d0f7b)[_0x401e('0x26')](_0x41416c,_0x401e('0x27'))[_0x401e('0x28')](_0x401e('0x29'));};exports['subtractTime']=function(_0x47d53d,_0x285de1){return moment(_0x47d53d)['subtract'](_0x285de1,_0x401e('0x27'))[_0x401e('0x28')](_0x401e('0x29'));};exports['diffTime']=function(_0x301eb6,_0x3b5207){return moment(_0x301eb6)[_0x401e('0x2a')](moment(_0x3b5207),_0x401e('0x27'));};exports[_0x401e('0x2b')]=function(_0x572da9,_0x1c14c7){return parseInt(_0x572da9,0xa)+parseInt(_0x1c14c7,0xa);};exports[_0x401e('0x2c')]=function(){return moment()[_0x401e('0x28')](_0x401e('0x29'));};exports['isAfter']=function(_0xd0bc54,_0x17f4b2){if(_0x17f4b2){return moment(_0xd0bc54)[_0x401e('0x2d')](_0x17f4b2);}return!![];};exports[_0x401e('0x2e')]=function(_0x54c396,_0x4d510d){if(_0x4d510d){return moment(_0x54c396)[_0x401e('0x2e')](_0x4d510d);}else if(_0x54c396){return!![];}return![];}; \ No newline at end of file